From: Cris Di Sclafani Date: Fri, 30 Oct 2020 14:09:05 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=7a16434dfe0b4425d5588680fd2500b26a8efaeb;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 57173fd..c5a46d5 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.4", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-10-30T14:01:16.097Z", "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 7eb2a1c..666b416 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 _0x8818=['contactManager','integration','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','VIRTUAL','getDataValue','action','STRING'];(function(_0x284190,_0x13ed15){var _0x2ee544=function(_0x4bd36a){while(--_0x4bd36a){_0x284190['push'](_0x284190['shift']());}};_0x2ee544(++_0x13ed15);}(_0x8818,0x1af));var _0x8881=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x8818[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8881('0x0')],'get':function(_0x20f4e0){return this[_0x8881('0x1')](_0x8881('0x2'));}},'action':{'type':Sequelize[_0x8881('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8881('0x4'),_0x8881('0x5'),'motionbar',_0x8881('0x6'),'urlForward',_0x8881('0x7'),_0x8881('0x8'),_0x8881('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x8881('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x8881('0xb')},'data2':{'type':Sequelize[_0x8881('0x3')](0x1000),'comment':_0x8881('0xc')},'data3':{'type':Sequelize[_0x8881('0x3')](0x1000),'comment':_0x8881('0xd')},'data4':{'type':Sequelize[_0x8881('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x8881('0xe')]}}; \ No newline at end of file +var _0x4499=['integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','action','STRING','motionbar','jscripty','urlForward','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'];(function(_0x4686ef,_0x4ee3f2){var _0x23a1ff=function(_0x49e4c5){while(--_0x49e4c5){_0x4686ef['push'](_0x4686ef['shift']());}};_0x23a1ff(++_0x4ee3f2);}(_0x4499,0xf3));var _0x9449=function(_0x4be730,_0x341fe4){_0x4be730=_0x4be730-0x0;var _0x54bbe5=_0x4499[_0x4be730];return _0x54bbe5;};'use strict';var Sequelize=require(_0x9449('0x0'));module['exports']={'name':{'type':Sequelize[_0x9449('0x1')],'get':function(_0x22ecd4){return this['getDataValue'](_0x9449('0x2'));}},'action':{'type':Sequelize[_0x9449('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0x9449('0x4'),_0x9449('0x5'),_0x9449('0x6'),'browser','bot','script']],'msg':_0x9449('0x7')}},'comment':_0x9449('0x7')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x9449('0x8')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x9449('0x9')},'data3':{'type':Sequelize[_0x9449('0x3')](0x1000),'comment':_0x9449('0xa')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x9449('0x3')](0x1000)},'data6':{'type':Sequelize[_0x9449('0x3')]},'data7':{'type':Sequelize[_0x9449('0xb')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 5ba1585..a2eca85 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 _0x5e5f=['../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','destroy','then','error','stack','send','update','body','catch','Action','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5e6eac,_0x7d6b04){var _0x27afd9=function(_0x4cbdb9){while(--_0x4cbdb9){_0x5e6eac['push'](_0x5e6eac['shift']());}};_0x27afd9(++_0x7d6b04);}(_0x5e5f,0x17f));var _0xf5e5=function(_0xb4c671,_0x3fbc06){_0xb4c671=_0xb4c671-0x0;var _0x1a8c08=_0x5e5f[_0xb4c671];return _0x1a8c08;};'use strict';var pdf=require(_0xf5e5('0x0'));var emlformat=require(_0xf5e5('0x1'));var rimraf=require(_0xf5e5('0x2'));var zipdir=require(_0xf5e5('0x3'));var jsonpatch=require(_0xf5e5('0x4'));var rp=require(_0xf5e5('0x5'));var moment=require(_0xf5e5('0x6'));var BPromise=require(_0xf5e5('0x7'));var Mustache=require(_0xf5e5('0x8'));var util=require(_0xf5e5('0x9'));var path=require(_0xf5e5('0xa'));var sox=require(_0xf5e5('0xb'));var csv=require(_0xf5e5('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf5e5('0xd'));var squel=require(_0xf5e5('0xe'));var crypto=require(_0xf5e5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf5e5('0x10'));var toCsv=require(_0xf5e5('0xc'));var querystring=require(_0xf5e5('0x11'));var Papa=require(_0xf5e5('0x12'));var Redis=require(_0xf5e5('0x13'));var authService=require(_0xf5e5('0x14'));var qs=require(_0xf5e5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf5e5('0x16'));var logger=require('../../config/logger')(_0xf5e5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf5e5('0x18'))['db'];function respondWithStatusCode(_0x5df53b,_0x1fda65){_0x1fda65=_0x1fda65||0xcc;return function(_0x3755ec){if(_0x3755ec){return _0x5df53b[_0xf5e5('0x19')](_0x1fda65);}return _0x5df53b[_0xf5e5('0x1a')](_0x1fda65)[_0xf5e5('0x1b')]();};}function respondWithResult(_0x46e2c,_0x2fc458){_0x2fc458=_0x2fc458||0xc8;return function(_0x5ed52c){if(_0x5ed52c){return _0x46e2c[_0xf5e5('0x1a')](_0x2fc458)['json'](_0x5ed52c);}};}function respondWithFilteredResult(_0x339ec5,_0x50de41){return function(_0x22cea6){if(_0x22cea6){var _0x2250bb=_0x22cea6['count'],_0x23d0f3=_0x50de41['offset'],_0x37c1b0=_0x50de41[_0xf5e5('0x1c')]+_0x50de41[_0xf5e5('0x1d')],_0x2f3007;if(_0x37c1b0>=_0x2250bb){_0x37c1b0=_0x2250bb;_0x2f3007=0xc8;}else{_0x2f3007=0xce;}_0x339ec5[_0xf5e5('0x1a')](_0x2f3007);return _0x339ec5['set'](_0xf5e5('0x1e'),_0x23d0f3+'-'+_0x37c1b0+'/'+_0x2250bb)[_0xf5e5('0x1f')](_0x22cea6);}return null;};}function patchUpdates(_0x50b78a){return function(_0x5904ca){try{jsonpatch[_0xf5e5('0x20')](_0x5904ca,_0x50b78a,!![]);}catch(_0x42266c){return BPromise[_0xf5e5('0x21')](_0x42266c);}return _0x5904ca[_0xf5e5('0x22')]();};}function saveUpdates(_0x8365d5,_0x521429){return function(_0x16489d){if(_0x16489d){return _0x16489d['update'](_0x8365d5)['then'](function(_0x387741){return _0x387741;});}return null;};}function removeEntity(_0x56b6c7,_0x326b1b){return function(_0x554a1f){if(_0x554a1f){return _0x554a1f[_0xf5e5('0x23')]()[_0xf5e5('0x24')](function(){_0x56b6c7[_0xf5e5('0x1a')](0xcc)[_0xf5e5('0x1b')]();});}};}function handleEntityNotFound(_0x9a9660,_0xe323ee){return function(_0x19ac31){if(!_0x19ac31){_0x9a9660[_0xf5e5('0x19')](0x194);}return _0x19ac31;};}function handleError(_0x50404b,_0x57de82){_0x57de82=_0x57de82||0x1f4;return function(_0x5a3180){logger[_0xf5e5('0x25')](_0x5a3180[_0xf5e5('0x26')]);if(_0x5a3180['name']){delete _0x5a3180['name'];}_0x50404b[_0xf5e5('0x1a')](_0x57de82)[_0xf5e5('0x27')](_0x5a3180);};}exports[_0xf5e5('0x28')]=function(_0x2620f6,_0x306e36){if(_0x2620f6['body']['id']){delete _0x2620f6['body']['id'];}return db['Action']['find']({'where':{'id':_0x2620f6['params']['id']}})[_0xf5e5('0x24')](handleEntityNotFound(_0x306e36,null))[_0xf5e5('0x24')](saveUpdates(_0x2620f6[_0xf5e5('0x29')],null))[_0xf5e5('0x24')](respondWithResult(_0x306e36,null))[_0xf5e5('0x2a')](handleError(_0x306e36,null));};exports[_0xf5e5('0x23')]=function(_0x3eb697,_0x37c30b){return db[_0xf5e5('0x2b')]['find']({'where':{'id':_0x3eb697[_0xf5e5('0x2c')]['id']}})['then'](handleEntityNotFound(_0x37c30b,null))[_0xf5e5('0x24')](removeEntity(_0x37c30b,null))[_0xf5e5('0x2a')](handleError(_0x37c30b,null));}; \ No newline at end of file +var _0x338c=['fast-json-patch','request-promise','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','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','name','body','Action','find','params','catch','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x52fc49,_0x5d7d1c){var _0x496e80=function(_0x2f59d3){while(--_0x2f59d3){_0x52fc49['push'](_0x52fc49['shift']());}};_0x496e80(++_0x5d7d1c);}(_0x338c,0x1a3));var _0xc338=function(_0x1f5c9a,_0x2133a9){_0x1f5c9a=_0x1f5c9a-0x0;var _0x1764c9=_0x338c[_0x1f5c9a];return _0x1764c9;};'use strict';var pdf=require(_0xc338('0x0'));var emlformat=require(_0xc338('0x1'));var rimraf=require(_0xc338('0x2'));var zipdir=require(_0xc338('0x3'));var jsonpatch=require(_0xc338('0x4'));var rp=require(_0xc338('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc338('0x6'));var util=require(_0xc338('0x7'));var path=require(_0xc338('0x8'));var sox=require('sox');var csv=require(_0xc338('0x9'));var ejs=require(_0xc338('0xa'));var fs=require('fs');var _=require(_0xc338('0xb'));var squel=require(_0xc338('0xc'));var crypto=require(_0xc338('0xd'));var jsforce=require(_0xc338('0xe'));var deskjs=require(_0xc338('0xf'));var toCsv=require(_0xc338('0x9'));var querystring=require(_0xc338('0x10'));var Papa=require('papaparse');var Redis=require(_0xc338('0x11'));var authService=require(_0xc338('0x12'));var qs=require(_0xc338('0x13'));var as=require(_0xc338('0x14'));var hardwareService=require(_0xc338('0x15'));var logger=require(_0xc338('0x16'))(_0xc338('0x17'));var utils=require(_0xc338('0x18'));var config=require('../../config/environment');var db=require(_0xc338('0x19'))['db'];function respondWithStatusCode(_0x232fbf,_0x42020d){_0x42020d=_0x42020d||0xcc;return function(_0x1ae7ad){if(_0x1ae7ad){return _0x232fbf[_0xc338('0x1a')](_0x42020d);}return _0x232fbf[_0xc338('0x1b')](_0x42020d)['end']();};}function respondWithResult(_0x8af183,_0xc6a89){_0xc6a89=_0xc6a89||0xc8;return function(_0xe0a359){if(_0xe0a359){return _0x8af183[_0xc338('0x1b')](_0xc6a89)[_0xc338('0x1c')](_0xe0a359);}};}function respondWithFilteredResult(_0x28b510,_0x1bf6d5){return function(_0x21ebf3){if(_0x21ebf3){var _0x4033d8=_0x21ebf3[_0xc338('0x1d')],_0xf8cad8=_0x1bf6d5[_0xc338('0x1e')],_0x264566=_0x1bf6d5['offset']+_0x1bf6d5[_0xc338('0x1f')],_0x56c3aa;if(_0x264566>=_0x4033d8){_0x264566=_0x4033d8;_0x56c3aa=0xc8;}else{_0x56c3aa=0xce;}_0x28b510[_0xc338('0x1b')](_0x56c3aa);return _0x28b510[_0xc338('0x20')](_0xc338('0x21'),_0xf8cad8+'-'+_0x264566+'/'+_0x4033d8)[_0xc338('0x1c')](_0x21ebf3);}return null;};}function patchUpdates(_0x285f27){return function(_0xe88ff5){try{jsonpatch[_0xc338('0x22')](_0xe88ff5,_0x285f27,!![]);}catch(_0x30e68c){return BPromise['reject'](_0x30e68c);}return _0xe88ff5[_0xc338('0x23')]();};}function saveUpdates(_0x4ef35a,_0x1a2f1a){return function(_0x54a386){if(_0x54a386){return _0x54a386[_0xc338('0x24')](_0x4ef35a)[_0xc338('0x25')](function(_0x4f6e93){return _0x4f6e93;});}return null;};}function removeEntity(_0x1b7dc4,_0x1d9684){return function(_0x21e732){if(_0x21e732){return _0x21e732[_0xc338('0x26')]()[_0xc338('0x25')](function(){_0x1b7dc4[_0xc338('0x1b')](0xcc)[_0xc338('0x27')]();});}};}function handleEntityNotFound(_0x3cb69d,_0x5efaf3){return function(_0x4acb9f){if(!_0x4acb9f){_0x3cb69d['sendStatus'](0x194);}return _0x4acb9f;};}function handleError(_0x4a48c7,_0x5e6ebc){_0x5e6ebc=_0x5e6ebc||0x1f4;return function(_0x3ec46f){logger['error'](_0x3ec46f[_0xc338('0x28')]);if(_0x3ec46f[_0xc338('0x29')]){delete _0x3ec46f[_0xc338('0x29')];}_0x4a48c7['status'](_0x5e6ebc)['send'](_0x3ec46f);};}exports[_0xc338('0x24')]=function(_0x2a4e73,_0x33eb12){if(_0x2a4e73['body']['id']){delete _0x2a4e73[_0xc338('0x2a')]['id'];}return db[_0xc338('0x2b')][_0xc338('0x2c')]({'where':{'id':_0x2a4e73[_0xc338('0x2d')]['id']}})[_0xc338('0x25')](handleEntityNotFound(_0x33eb12,null))[_0xc338('0x25')](saveUpdates(_0x2a4e73[_0xc338('0x2a')],null))['then'](respondWithResult(_0x33eb12,null))[_0xc338('0x2e')](handleError(_0x33eb12,null));};exports[_0xc338('0x26')]=function(_0x154f86,_0x17d7b8){return db[_0xc338('0x2b')][_0xc338('0x2c')]({'where':{'id':_0x154f86[_0xc338('0x2d')]['id']}})[_0xc338('0x25')](handleEntityNotFound(_0x17d7b8,null))['then'](removeEntity(_0x17d7b8,null))[_0xc338('0x2e')](handleError(_0x17d7b8,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index f87ecbe..237bc02 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 _0xbb1a=['path','rimraf','../../config/environment','define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbb1a,0xf5));var _0xabb1=function(_0xac128d,_0x2277cd){_0xac128d=_0xac128d-0x0;var _0x389759=_0xbb1a[_0xac128d];return _0x389759;};'use strict';var _=require(_0xabb1('0x0'));var util=require(_0xabb1('0x1'));var logger=require(_0xabb1('0x2'))(_0xabb1('0x3'));var moment=require(_0xabb1('0x4'));var BPromise=require(_0xabb1('0x5'));var rp=require(_0xabb1('0x6'));var fs=require('fs');var path=require(_0xabb1('0x7'));var rimraf=require(_0xabb1('0x8'));var config=require(_0xabb1('0x9'));var attributes=require('./action.attributes');module['exports']=function(_0x58883f,_0x2bc2bb){return _0x58883f[_0xabb1('0xa')]('Action',attributes,{'tableName':_0xabb1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dfe=['request-promise','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x31e3d5,_0x3fa1cd){var _0x4da910=function(_0x5dc244){while(--_0x5dc244){_0x31e3d5['push'](_0x31e3d5['shift']());}};_0x4da910(++_0x3fa1cd);}(_0x6dfe,0xd7));var _0xe6df=function(_0x2b03cd,_0x565af3){_0x2b03cd=_0x2b03cd-0x0;var _0x3395d9=_0x6dfe[_0x2b03cd];return _0x3395d9;};'use strict';var _=require(_0xe6df('0x0'));var util=require(_0xe6df('0x1'));var logger=require(_0xe6df('0x2'))(_0xe6df('0x3'));var moment=require(_0xe6df('0x4'));var BPromise=require(_0xe6df('0x5'));var rp=require(_0xe6df('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe6df('0x7'));var attributes=require(_0xe6df('0x8'));module[_0xe6df('0x9')]=function(_0x22c78c,_0x9613d0){return _0x22c78c[_0xe6df('0xa')](_0xe6df('0xb'),attributes,{'tableName':_0xe6df('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 20d71cd..b80fa59 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3951a3,_0x8ff8e5){var _0x17a38f=function(_0x17b475){while(--_0x17b475){_0x3951a3['push'](_0x3951a3['shift']());}};_0x17a38f(++_0x8ff8e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_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')]('Action,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 9dfa9be..6763260 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 _0x2bd3=['../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','update','util','path','connect-timeout','express'];(function(_0xeb80c9,_0x3fe888){var _0x259c37=function(_0x49478c){while(--_0x49478c){_0xeb80c9['push'](_0xeb80c9['shift']());}};_0x259c37(++_0x3fe888);}(_0x2bd3,0x15a));var _0x32bd=function(_0x2141ee,_0x4181e5){_0x2141ee=_0x2141ee-0x0;var _0x5bdc07=_0x2bd3[_0x2141ee];return _0x5bdc07;};'use strict';var multer=require('multer');var util=require(_0x32bd('0x0'));var path=require(_0x32bd('0x1'));var timeout=require(_0x32bd('0x2'));var express=require(_0x32bd('0x3'));var router=express['Router']();var auth=require(_0x32bd('0x4'));var interaction=require(_0x32bd('0x5'));var config=require(_0x32bd('0x6'));var controller=require('./action.controller');router['put'](_0x32bd('0x7'),auth[_0x32bd('0x8')](),controller[_0x32bd('0x9')]);router['delete'](_0x32bd('0x7'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4f30=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','update','delete','multer'];(function(_0x10bfc9,_0x42f69c){var _0x3b4dbe=function(_0x35ea02){while(--_0x35ea02){_0x10bfc9['push'](_0x10bfc9['shift']());}};_0x3b4dbe(++_0x42f69c);}(_0x4f30,0xbd));var _0x04f3=function(_0x5e8498,_0x393ad9){_0x5e8498=_0x5e8498-0x0;var _0x3a5500=_0x4f30[_0x5e8498];return _0x3a5500;};'use strict';var multer=require(_0x04f3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x04f3('0x1'));var express=require(_0x04f3('0x2'));var router=express[_0x04f3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x04f3('0x4'));var config=require(_0x04f3('0x5'));var controller=require(_0x04f3('0x6'));router['put']('/:id',auth[_0x04f3('0x7')](),controller[_0x04f3('0x8')]);router[_0x04f3('0x9')]('/:id',auth[_0x04f3('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index f68cb23..cd8e40a 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 _0xc1d8=['sequelize','STRING','TEXT'];(function(_0x819632,_0x5c4ab5){var _0x4c72b5=function(_0x40b60b){while(--_0x40b60b){_0x819632['push'](_0x819632['shift']());}};_0x4c72b5(++_0x5c4ab5);}(_0xc1d8,0x14a));var _0x8c1d=function(_0x6f9e5e,_0x146423){_0x6f9e5e=_0x6f9e5e-0x0;var _0x33aa8b=_0xc1d8[_0x6f9e5e];return _0x33aa8b;};'use strict';var Sequelize=require(_0x8c1d('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c1d('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8c1d('0x2')]}}; \ No newline at end of file +var _0xd9cf=['exports','STRING','TEXT','sequelize'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd9cf,0x163));var _0xfd9c=function(_0xe69ad2,_0x2ff48e){_0xe69ad2=_0xe69ad2-0x0;var _0x10b22b=_0xd9cf[_0xe69ad2];return _0x10b22b;};'use strict';var Sequelize=require(_0xfd9c('0x0'));module[_0xfd9c('0x1')]={'name':{'type':Sequelize[_0xfd9c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xfd9c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xfd9c('0x3')]},'joins':{'type':Sequelize[_0xfd9c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 551e938..6cb68ba 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 _0x1e69=['Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticCustomReport','count','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','alias','%s.%s\x20=\x20%s.%s','Limited\x20Query:','No\x20available\x20data','output','web','fullPath','%s-%s.%s','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','runReport','left_join','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','offset','set'];(function(_0x375cef,_0x48df7a){var _0x3072c0=function(_0x5dfc39){while(--_0x5dfc39){_0x375cef['push'](_0x375cef['shift']());}};_0x3072c0(++_0x48df7a);}(_0x1e69,0x85));var _0x91e6=function(_0x4e1d47,_0x40d4c8){_0x4e1d47=_0x4e1d47-0x0;var _0x1c5b56=_0x1e69[_0x4e1d47];return _0x1c5b56;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x91e6('0x0'));var rimraf=require(_0x91e6('0x1'));var zipdir=require(_0x91e6('0x2'));var jsonpatch=require(_0x91e6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x91e6('0x4'));var Mustache=require(_0x91e6('0x5'));var util=require(_0x91e6('0x6'));var path=require(_0x91e6('0x7'));var sox=require(_0x91e6('0x8'));var csv=require(_0x91e6('0x9'));var ejs=require(_0x91e6('0xa'));var fs=require('fs');var _=require(_0x91e6('0xb'));var squel=require(_0x91e6('0xc'));var crypto=require(_0x91e6('0xd'));var jsforce=require(_0x91e6('0xe'));var deskjs=require(_0x91e6('0xf'));var toCsv=require(_0x91e6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x91e6('0x10'));var authService=require(_0x91e6('0x11'));var qs=require(_0x91e6('0x12'));var as=require(_0x91e6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91e6('0x14'))(_0x91e6('0x15'));var utils=require(_0x91e6('0x16'));var config=require(_0x91e6('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x91e6('0x18'))[_0x91e6('0x19')];function respondWithStatusCode(_0x1cc277,_0x35d81a){_0x35d81a=_0x35d81a||0xcc;return function(_0xf665a4){if(_0xf665a4){return _0x1cc277[_0x91e6('0x1a')](_0x35d81a);}return _0x1cc277[_0x91e6('0x1b')](_0x35d81a)['end']();};}function respondWithResult(_0x2b1d0c,_0x39d567){_0x39d567=_0x39d567||0xc8;return function(_0x332a26){if(_0x332a26){return _0x2b1d0c[_0x91e6('0x1b')](_0x39d567)['json'](_0x332a26);}};}function respondWithFilteredResult(_0xdc8f22,_0x195cf9){return function(_0x521502){if(_0x521502){var _0xf214f9=_0x521502['count'],_0x4a7219=_0x195cf9[_0x91e6('0x1c')],_0x57d30d=_0x195cf9[_0x91e6('0x1c')]+_0x195cf9['limit'],_0x51973f;if(_0x57d30d>=_0xf214f9){_0x57d30d=_0xf214f9;_0x51973f=0xc8;}else{_0x51973f=0xce;}_0xdc8f22['status'](_0x51973f);return _0xdc8f22[_0x91e6('0x1d')](_0x91e6('0x1e'),_0x4a7219+'-'+_0x57d30d+'/'+_0xf214f9)[_0x91e6('0x1f')](_0x521502);}return null;};}function patchUpdates(_0x1ffaa3){return function(_0x1c78e9){try{jsonpatch[_0x91e6('0x20')](_0x1c78e9,_0x1ffaa3,!![]);}catch(_0x163e9a){return BPromise[_0x91e6('0x21')](_0x163e9a);}return _0x1c78e9[_0x91e6('0x22')]();};}function saveUpdates(_0x2d99f7,_0x52599f){return function(_0x9d7470){if(_0x9d7470){return _0x9d7470[_0x91e6('0x23')](_0x2d99f7)[_0x91e6('0x24')](function(_0x1c4bdf){return _0x1c4bdf;});}return null;};}function removeEntity(_0x29172b,_0x458e49){return function(_0x4bdfe8){if(_0x4bdfe8){return _0x4bdfe8['destroy']()[_0x91e6('0x24')](function(){var _0xc1333b=_0x4bdfe8[_0x91e6('0x25')]({'plain':!![]});var _0x32a5a1='CustomReports';return db[_0x91e6('0x26')][_0x91e6('0x27')]({'where':{'type':_0x32a5a1,'resourceId':_0xc1333b['id']}})[_0x91e6('0x24')](function(){return _0x4bdfe8;});})[_0x91e6('0x24')](function(){_0x29172b[_0x91e6('0x1b')](0xcc)[_0x91e6('0x28')]();});}};}function handleEntityNotFound(_0x296ce9,_0x21f642){return function(_0x21da27){if(!_0x21da27){_0x296ce9[_0x91e6('0x1a')](0x194);}return _0x21da27;};}function handleError(_0x117f2b,_0x597ed5){_0x597ed5=_0x597ed5||0x1f4;return function(_0x64644e){logger[_0x91e6('0x29')](_0x64644e[_0x91e6('0x2a')]);if(_0x64644e[_0x91e6('0x2b')]){delete _0x64644e[_0x91e6('0x2b')];}_0x117f2b['status'](_0x597ed5)[_0x91e6('0x2c')](_0x64644e);};}exports[_0x91e6('0x2d')]=function(_0x4ca580,_0x2fcee6){var _0x3aed5d={},_0x3cca11={},_0x4e3924={'count':0x0,'rows':[]};var _0x2a08e0=_[_0x91e6('0x2e')](db['AnalyticCustomReport'][_0x91e6('0x2f')],function(_0x3a0b3c){return{'name':_0x3a0b3c['fieldName'],'type':_0x3a0b3c[_0x91e6('0x30')]['key']};});_0x3cca11[_0x91e6('0x31')]=_[_0x91e6('0x2e')](_0x2a08e0,'name');_0x3cca11[_0x91e6('0x32')]=_['keys'](_0x4ca580[_0x91e6('0x32')]);_0x3cca11[_0x91e6('0x33')]=_[_0x91e6('0x34')](_0x3cca11[_0x91e6('0x31')],_0x3cca11[_0x91e6('0x32')]);_0x3aed5d[_0x91e6('0x35')]=_[_0x91e6('0x34')](_0x3cca11['model'],qs[_0x91e6('0x36')](_0x4ca580['query'][_0x91e6('0x36')]));_0x3aed5d[_0x91e6('0x35')]=_0x3aed5d[_0x91e6('0x35')][_0x91e6('0x37')]?_0x3aed5d[_0x91e6('0x35')]:_0x3cca11['model'];if(!_0x4ca580[_0x91e6('0x32')][_0x91e6('0x38')]('nolimit')){_0x3aed5d[_0x91e6('0x39')]=qs['limit'](_0x4ca580[_0x91e6('0x32')]['limit']);_0x3aed5d[_0x91e6('0x1c')]=qs['offset'](_0x4ca580['query']['offset']);}_0x3aed5d[_0x91e6('0x3a')]=qs[_0x91e6('0x3b')](_0x4ca580[_0x91e6('0x32')][_0x91e6('0x3b')]);_0x3aed5d[_0x91e6('0x3c')]=qs['filters'](_['pick'](_0x4ca580[_0x91e6('0x32')],_0x3cca11[_0x91e6('0x33')]),_0x2a08e0);if(_0x4ca580[_0x91e6('0x32')][_0x91e6('0x3d')]){_0x3aed5d['where']=_[_0x91e6('0x3e')](_0x3aed5d[_0x91e6('0x3c')],{'$or':_['map'](_0x2a08e0,function(_0x5d3c18){if(_0x5d3c18[_0x91e6('0x30')]!==_0x91e6('0x3f')){var _0x50ce13={};_0x50ce13[_0x5d3c18[_0x91e6('0x2b')]]={'$like':'%'+_0x4ca580[_0x91e6('0x32')][_0x91e6('0x3d')]+'%'};return _0x50ce13;}})});}_0x3aed5d=_[_0x91e6('0x3e')]({},_0x3aed5d,_0x4ca580[_0x91e6('0x40')]);var _0x14c937={'where':_0x3aed5d[_0x91e6('0x3c')]};return db[_0x91e6('0x41')][_0x91e6('0x42')](_0x14c937)[_0x91e6('0x24')](function(_0x4c4c9c){_0x4e3924[_0x91e6('0x42')]=_0x4c4c9c;if(_0x4ca580[_0x91e6('0x32')][_0x91e6('0x43')]){_0x3aed5d[_0x91e6('0x44')]=[{'all':!![]}];}return db[_0x91e6('0x41')][_0x91e6('0x45')](_0x3aed5d);})['then'](function(_0x1735e7){_0x4e3924[_0x91e6('0x46')]=_0x1735e7;return _0x4e3924;})['then'](respondWithFilteredResult(_0x2fcee6,_0x3aed5d))[_0x91e6('0x47')](handleError(_0x2fcee6,null));};exports['show']=function(_0x2d6c3c,_0x9d8be0){var _0x3f7c55={'raw':![],'where':{'id':_0x2d6c3c[_0x91e6('0x48')]['id']}},_0x1345e1={};_0x1345e1['model']=_[_0x91e6('0x49')](db['AnalyticCustomReport'][_0x91e6('0x2f')]);_0x1345e1[_0x91e6('0x32')]=_[_0x91e6('0x49')](_0x2d6c3c[_0x91e6('0x32')]);_0x1345e1[_0x91e6('0x33')]=_[_0x91e6('0x34')](_0x1345e1[_0x91e6('0x31')],_0x1345e1[_0x91e6('0x32')]);_0x3f7c55['attributes']=_[_0x91e6('0x34')](_0x1345e1[_0x91e6('0x31')],qs[_0x91e6('0x36')](_0x2d6c3c[_0x91e6('0x32')][_0x91e6('0x36')]));_0x3f7c55[_0x91e6('0x35')]=_0x3f7c55[_0x91e6('0x35')][_0x91e6('0x37')]?_0x3f7c55['attributes']:_0x1345e1[_0x91e6('0x31')];if(_0x2d6c3c[_0x91e6('0x32')][_0x91e6('0x43')]){_0x3f7c55['include']=[{'all':!![]}];}_0x3f7c55=_['merge']({},_0x3f7c55,_0x2d6c3c['options']);return db['AnalyticCustomReport'][_0x91e6('0x4a')](_0x3f7c55)[_0x91e6('0x24')](handleEntityNotFound(_0x9d8be0,null))[_0x91e6('0x24')](respondWithResult(_0x9d8be0,null))[_0x91e6('0x47')](handleError(_0x9d8be0,null));};exports[_0x91e6('0x4b')]=function(_0x34fd2e,_0x2da3a6){return db[_0x91e6('0x41')]['create'](_0x34fd2e[_0x91e6('0x4c')],{})[_0x91e6('0x24')](function(_0x103cd4){var _0x3dff69=_0x34fd2e[_0x91e6('0x4d')][_0x91e6('0x25')]({'plain':!![]});if(!_0x3dff69)throw new Error(_0x91e6('0x4e'));if(_0x3dff69[_0x91e6('0x4f')]==='user'){var _0x5522e9=_0x103cd4[_0x91e6('0x25')]({'plain':!![]});var _0x1fd8fa='Reports';return db[_0x91e6('0x50')][_0x91e6('0x4a')]({'where':{'name':_0x1fd8fa,'userProfileId':_0x3dff69['userProfileId']},'raw':!![]})[_0x91e6('0x24')](function(_0x202d44){if(_0x202d44&&_0x202d44[_0x91e6('0x51')]===0x0){return db['UserProfileResource'][_0x91e6('0x4b')]({'name':_0x5522e9['name'],'resourceId':_0x5522e9['id'],'type':_0x91e6('0x52'),'sectionId':_0x202d44['id']},{})[_0x91e6('0x24')](function(){return _0x103cd4;});}else{return _0x103cd4;}})[_0x91e6('0x47')](function(_0xf09bd5){logger[_0x91e6('0x29')](_0x91e6('0x53'),_0xf09bd5);throw _0xf09bd5;});}return _0x103cd4;})[_0x91e6('0x24')](respondWithResult(_0x2da3a6,0xc9))[_0x91e6('0x47')](handleError(_0x2da3a6,null));};exports[_0x91e6('0x23')]=function(_0x56cef1,_0x35ce3c){if(_0x56cef1['body']['id']){delete _0x56cef1[_0x91e6('0x4c')]['id'];}return db[_0x91e6('0x41')]['find']({'where':{'id':_0x56cef1['params']['id']}})[_0x91e6('0x24')](handleEntityNotFound(_0x35ce3c,null))[_0x91e6('0x24')](saveUpdates(_0x56cef1[_0x91e6('0x4c')],null))[_0x91e6('0x24')](respondWithResult(_0x35ce3c,null))[_0x91e6('0x47')](handleError(_0x35ce3c,null));};exports[_0x91e6('0x27')]=function(_0x2b08a8,_0x1de608){return db[_0x91e6('0x41')]['find']({'where':{'id':_0x2b08a8['params']['id']}})[_0x91e6('0x24')](handleEntityNotFound(_0x1de608,null))[_0x91e6('0x24')](removeEntity(_0x1de608,null))[_0x91e6('0x47')](handleError(_0x1de608,null));};exports['preview']=function(_0x299e05,_0x31fc0d){var _0x5eda67=0xa;var _0x46db0d=[_0x91e6('0x54'),'left_join',_0x91e6('0x55'),_0x91e6('0x56')];var _0x574309={'SUM':_0x91e6('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91e6('0x58'),'MAX':'MAX(%s)','MIN':_0x91e6('0x59'),'AVG':_0x91e6('0x5a'),'GROUP_CONCAT':_0x91e6('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91e6('0x5c')};var _0x145e8f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91e6('0x5d'),'HOUR':_0x91e6('0x5e'),'ROUND':_0x91e6('0x5f'),'UNIX_TIMESTAMP':_0x91e6('0x60')};var _0x202cc7=function(_0x154301){return!_[_0x91e6('0x61')]([_0x91e6('0x62'),_0x91e6('0x63'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x154301);};var _0x5ce12e=function(_0xc5bc4a){if(!_0xc5bc4a||!_0xc5bc4a[_0x91e6('0x64')][_0x91e6('0x37')]){return'';}for(var _0x404e7e='(',_0x125386=0x0;_0x125386<_0xc5bc4a[_0x91e6('0x64')][_0x91e6('0x37')];_0x125386+=0x1){_0x125386>0x0&&(_0x404e7e+='\x20'+_0xc5bc4a[_0x91e6('0x65')]+'\x20');_0x404e7e+=_0xc5bc4a[_0x91e6('0x64')][_0x125386][_0x91e6('0x66')]?_0x5ce12e(_0xc5bc4a['rules'][_0x125386][_0x91e6('0x66')]):_0xc5bc4a[_0x91e6('0x64')][_0x125386][_0x91e6('0x67')]+'\x20'+_0xc5bc4a[_0x91e6('0x64')][_0x125386][_0x91e6('0x68')]+(_0x202cc7(_0xc5bc4a['rules'][_0x125386]['condition'])?'\x20'+_0xc5bc4a[_0x91e6('0x64')][_0x125386]['value']:'');}return _0x404e7e+')';};var _0x1d7711={'where':{'id':_0x299e05[_0x91e6('0x48')]['id']}},_0x1aeb1f,_0x5301b1,_0x597bc2,_0x5d9aef,_0x3eb8fa;_0x1d7711=_[_0x91e6('0x3e')]({},_0x1d7711,_0x299e05[_0x91e6('0x40')]);return db[_0x91e6('0x41')][_0x91e6('0x4a')](_0x1d7711)[_0x91e6('0x24')](function(_0x573f52){if(_0x573f52){_0x1aeb1f=_0x573f52;return _0x573f52[_0x91e6('0x69')]();}return null;})['then'](function(_0x238861){if(_0x238861){if(!_0x238861[_0x91e6('0x37')]){throw new db[(_0x91e6('0x6a'))][(_0x91e6('0x6b'))](_0x91e6('0x6c'),0x193);}_0x5301b1=_0x238861;return db[_0x91e6('0x6d')][_0x91e6('0x45')]({'raw':!![]});}return null;})[_0x91e6('0x24')](function(_0x2ec52c){if(_0x2ec52c){_0x597bc2=_[_0x91e6('0x6e')](_0x2ec52c,'id');var _0x314b69;var _0x1d8fd0=squel[_0x91e6('0x6f')]();_0x1d8fd0[_0x91e6('0x70')](_0x1aeb1f[_0x91e6('0x71')]);for(var _0x6fd239=0x0;_0x6fd239<_0x5301b1[_0x91e6('0x37')];_0x6fd239+=0x1){_0x314b69=_0x5301b1[_0x6fd239][_0x91e6('0x72')]?_0x597bc2[_0x5301b1[_0x6fd239][_0x91e6('0x72')]][_0x91e6('0x73')]:_0x5301b1[_0x6fd239][_0x91e6('0x67')];_0x314b69=_0x5301b1[_0x6fd239][_0x91e6('0x74')]?_['replace'](_0x574309[_0x5301b1[_0x6fd239][_0x91e6('0x74')]],'%s',_0x314b69):_0x314b69;_0x314b69=_0x5301b1[_0x6fd239][_0x91e6('0x75')]?_[_0x91e6('0x76')](_0x145e8f[_0x5301b1[_0x6fd239][_0x91e6('0x75')]],'%s',_0x314b69):_0x314b69;if(_0x5301b1[_0x6fd239][_0x91e6('0x77')]){_0x1d8fd0['group'](_0x314b69);}_0x5301b1[_0x6fd239][_0x91e6('0x78')]&&_0x1d8fd0[_0x91e6('0x3a')](_0x314b69,_0x5301b1[_0x6fd239]['orderBy']===_0x91e6('0x79')?![]:!![]);_0x1d8fd0[_0x91e6('0x67')](_0x314b69,_0x5301b1[_0x6fd239]['alias']||_0x314b69);}if(_0x1aeb1f[_0x91e6('0x7a')]){_0x1aeb1f[_0x91e6('0x7a')]=JSON['parse'](_0x1aeb1f['joins']);for(var _0x13c97f=0x0;_0x13c97f<_0x1aeb1f[_0x91e6('0x7a')][_0x91e6('0x37')];_0x13c97f+=0x1){if(_0x1aeb1f['joins'][_0x13c97f][_0x91e6('0x30')]&&_[_0x91e6('0x61')](_0x46db0d,_0x1aeb1f['joins'][_0x13c97f]['type'])&&_0x1aeb1f['joins'][_0x13c97f][_0x91e6('0x7b')]&&_0x1aeb1f['joins'][_0x13c97f]['foreignTable']&&_0x1aeb1f[_0x91e6('0x7a')][_0x13c97f]['foreignKey']){_0x1d8fd0[_0x1aeb1f[_0x91e6('0x7a')][_0x13c97f][_0x91e6('0x30')]](_0x1aeb1f[_0x91e6('0x7a')][_0x13c97f][_0x91e6('0x7c')],null,util[_0x91e6('0x75')]('%s.%s\x20=\x20%s.%s',_0x1aeb1f[_0x91e6('0x71')],_0x1aeb1f[_0x91e6('0x7a')][_0x13c97f][_0x91e6('0x7b')],_0x1aeb1f['joins'][_0x13c97f][_0x91e6('0x7c')],_0x1aeb1f[_0x91e6('0x7a')][_0x13c97f][_0x91e6('0x7d')]));}}}if(_0x1aeb1f[_0x91e6('0x7e')]){_0x1aeb1f[_0x91e6('0x7e')]=JSON[_0x91e6('0x7f')](_0x1aeb1f[_0x91e6('0x7e')]);_0x1d8fd0[_0x91e6('0x3c')](_0x5ce12e(_0x1aeb1f['conditions'][_0x91e6('0x66')]));}_0x3eb8fa=_0x1d8fd0[_0x91e6('0x80')]();_0x1d8fd0[_0x91e6('0x39')](_0x5eda67);_0x1d8fd0[_0x91e6('0x1c')](0x0);logger[_0x91e6('0x81')]('Limited\x20Query:',_0x1d8fd0['toString']());return db['sequelize'][_0x91e6('0x32')](_0x1d8fd0[_0x91e6('0x82')](),{'type':db[_0x91e6('0x83')][_0x91e6('0x84')][_0x91e6('0x85')]});}})[_0x91e6('0x24')](respondWithResult(_0x31fc0d,null))[_0x91e6('0x47')](handleError(_0x31fc0d,null));};function runReport(_0x4a7041,_0x2e3ef1,_0x1ca0c4){var _0x2d1033=_0x2e3ef1[_0x91e6('0x2b')];var _0x1cee33=0xa;var _0x1a8b47=[_0x91e6('0x54'),'left_join',_0x91e6('0x55'),_0x91e6('0x56')];var _0x30e522={'SUM':'SUM(%s)','COUNT':_0x91e6('0x86'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x91e6('0x87'),'MIN':_0x91e6('0x59'),'AVG':_0x91e6('0x5a'),'GROUP_CONCAT':_0x91e6('0x5b'),'GROUP_CONCAT ASC':_0x91e6('0x88'),'GROUP_CONCAT DESC':_0x91e6('0x5c')};var _0x3b5c8f={'SEC_TO_TIME':_0x91e6('0x89'),'DATE':_0x91e6('0x5d'),'HOUR':_0x91e6('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x91e6('0x60')};var _0xed86ee=function(_0x352475){return!_[_0x91e6('0x61')]([_0x91e6('0x62'),_0x91e6('0x63'),'IS\x20EMPTY',_0x91e6('0x8a')],_0x352475);};var _0x3af565=function(_0x490063){if(!_0x490063||!_0x490063[_0x91e6('0x64')][_0x91e6('0x37')]){return'';}for(var _0x807a2c='(',_0x4a6d65=0x0;_0x4a6d65<_0x490063['rules'][_0x91e6('0x37')];_0x4a6d65+=0x1){_0x4a6d65>0x0&&(_0x807a2c+='\x20'+_0x490063['operator']+'\x20');_0x807a2c+=_0x490063[_0x91e6('0x64')][_0x4a6d65]['group']?_0x3af565(_0x490063['rules'][_0x4a6d65][_0x91e6('0x66')]):_0x490063[_0x91e6('0x64')][_0x4a6d65][_0x91e6('0x67')]+'\x20'+_0x490063[_0x91e6('0x64')][_0x4a6d65][_0x91e6('0x68')]+(_0xed86ee(_0x490063[_0x91e6('0x64')][_0x4a6d65][_0x91e6('0x68')])?'\x20'+_0x490063[_0x91e6('0x64')][_0x4a6d65][_0x91e6('0x8b')]:'');}return _0x807a2c+')';};var _0x408263={'where':{'id':_0x4a7041['id']}},_0x97bc5a,_0x4baa87,_0x9c3c69,_0x347f3a,_0x5cf043;_0x408263=_[_0x91e6('0x3e')]({},_0x408263,_0x1ca0c4);return db[_0x91e6('0x41')][_0x91e6('0x4a')](_0x408263)[_0x91e6('0x24')](function(_0xe5d841){if(_0xe5d841){_0x97bc5a=_0xe5d841;return _0xe5d841['getFields']();}return null;})[_0x91e6('0x24')](function(_0x2104c5){if(_0x2104c5){if(!_0x2104c5[_0x91e6('0x37')]){throw new db[(_0x91e6('0x6a'))][(_0x91e6('0x6b'))](_0x91e6('0x6c'),0x193);}_0x4baa87=_0x2104c5;return db[_0x91e6('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x91e6('0x24')](function(_0x103375){if(_0x103375){_0x9c3c69=_[_0x91e6('0x6e')](_0x103375,'id');var _0x23eef6;var _0x5dee74=squel[_0x91e6('0x6f')]();_0x5dee74[_0x91e6('0x70')](_0x97bc5a[_0x91e6('0x71')]);for(var _0x53ab35=0x0;_0x53ab35<_0x4baa87[_0x91e6('0x37')];_0x53ab35+=0x1){_0x23eef6=_0x4baa87[_0x53ab35]['MetricId']?_0x9c3c69[_0x4baa87[_0x53ab35][_0x91e6('0x72')]][_0x91e6('0x73')]:_0x4baa87[_0x53ab35][_0x91e6('0x67')];_0x23eef6=_0x4baa87[_0x53ab35][_0x91e6('0x74')]?_[_0x91e6('0x76')](_0x30e522[_0x4baa87[_0x53ab35][_0x91e6('0x74')]],'%s',_0x23eef6):_0x23eef6;_0x23eef6=_0x4baa87[_0x53ab35]['format']?_[_0x91e6('0x76')](_0x3b5c8f[_0x4baa87[_0x53ab35][_0x91e6('0x75')]],'%s',_0x23eef6):_0x23eef6;if(_0x4baa87[_0x53ab35]['groupBy']){_0x5dee74['group'](_0x23eef6);}_0x4baa87[_0x53ab35]['orderBy']&&_0x5dee74[_0x91e6('0x3a')](_0x23eef6,_0x4baa87[_0x53ab35][_0x91e6('0x78')]===_0x91e6('0x79')?![]:!![]);_0x5dee74[_0x91e6('0x67')](_0x23eef6,_0x4baa87[_0x53ab35][_0x91e6('0x8c')]||_0x23eef6);}if(_0x97bc5a['joins']){_0x97bc5a[_0x91e6('0x7a')]=JSON[_0x91e6('0x7f')](_0x97bc5a['joins']);for(var _0x3a8793=0x0;_0x3a8793<_0x97bc5a[_0x91e6('0x7a')][_0x91e6('0x37')];_0x3a8793+=0x1){if(_0x97bc5a[_0x91e6('0x7a')][_0x3a8793][_0x91e6('0x30')]&&_[_0x91e6('0x61')](_0x1a8b47,_0x97bc5a['joins'][_0x3a8793][_0x91e6('0x30')])&&_0x97bc5a['joins'][_0x3a8793]['parentKey']&&_0x97bc5a[_0x91e6('0x7a')][_0x3a8793]['foreignTable']&&_0x97bc5a['joins'][_0x3a8793][_0x91e6('0x7d')]){_0x5dee74[_0x97bc5a[_0x91e6('0x7a')][_0x3a8793]['type']](_0x97bc5a[_0x91e6('0x7a')][_0x3a8793]['foreignTable'],null,util[_0x91e6('0x75')](_0x91e6('0x8d'),_0x97bc5a[_0x91e6('0x71')],_0x97bc5a[_0x91e6('0x7a')][_0x3a8793]['parentKey'],_0x97bc5a[_0x91e6('0x7a')][_0x3a8793][_0x91e6('0x7c')],_0x97bc5a[_0x91e6('0x7a')][_0x3a8793][_0x91e6('0x7d')]));}}}if(_0x97bc5a['conditions']){_0x97bc5a[_0x91e6('0x7e')]=JSON[_0x91e6('0x7f')](_0x97bc5a['conditions']);_0x5dee74['where'](_0x3af565(_0x97bc5a[_0x91e6('0x7e')]['group']));}_0x5cf043=_0x5dee74['clone']();_0x5dee74[_0x91e6('0x39')](_0x1cee33);_0x5dee74['offset'](0x0);logger[_0x91e6('0x81')](_0x91e6('0x8e'),_0x5dee74[_0x91e6('0x82')]());return db[_0x91e6('0x83')][_0x91e6('0x32')](_0x5dee74[_0x91e6('0x82')](),{'type':db[_0x91e6('0x83')][_0x91e6('0x84')]['SELECT']});}})[_0x91e6('0x24')](function(_0x12c7ae){if(!_0x12c7ae[_0x91e6('0x37')]){throw new db[(_0x91e6('0x6a'))][(_0x91e6('0x6b'))](_0x91e6('0x8f'),0xcc);}if(_0x2e3ef1[_0x91e6('0x90')]===_0x91e6('0x91')){return null;}var _0x3ca6e3=_[_0x91e6('0x3e')](_0x2e3ef1,{'name':_0x2e3ef1[_0x91e6('0x92')]||_0x2e3ef1[_0x91e6('0x2b')]||_0x97bc5a[_0x91e6('0x2b')],'basename':_0x2d1033,'savename':util[_0x91e6('0x75')](_0x91e6('0x93'),_0x2e3ef1['name']||_0x97bc5a['name'],require('randomstring')['generate'](0x4),_0x2e3ef1[_0x91e6('0x90')]||_0x91e6('0x94')),'reportId':_0x97bc5a['id'],'reportType':_0x91e6('0x95')});return db[_0x91e6('0x96')][_0x91e6('0x4b')](_0x3ca6e3,{'raw':!![]});})[_0x91e6('0x24')](function(_0x140800){if(_0x97bc5a[_0x91e6('0x71')]===_0x91e6('0x97')){_0x5cf043[_0x91e6('0x3c')](_0x97bc5a[_0x91e6('0x71')]+_0x91e6('0x98'),_0x2e3ef1['startDate'],_0x2e3ef1[_0x91e6('0x99')]);}else{_0x5cf043[_0x91e6('0x3c')](_0x97bc5a[_0x91e6('0x71')]+_0x91e6('0x9a'),_0x2e3ef1['startDate'],_0x2e3ef1['endDate']);}if(_0x140800){logger['info'](_0x91e6('0x9b'),_0x5cf043[_0x91e6('0x82')]());require(_0x91e6('0x9c'))[_0x91e6('0x9d')](path['join'](__dirname,_0x91e6('0x9e'),_0x140800[_0x91e6('0x90')]),[_0x140800['id'],_0x5cf043[_0x91e6('0x82')](),path[_0x91e6('0x54')](__dirname,_0x91e6('0x9f'),_0x140800[_0x91e6('0xa0')]),_0x2d1033]);return _0x140800;}else{var _0x31d00a=squel[_0x91e6('0x6f')]();_0x31d00a['from']('('+_0x5cf043[_0x91e6('0x82')]()+')','countTable');_0x31d00a['field']('COUNT(*)','count');_0x5cf043[_0x91e6('0x39')](_0x2e3ef1[_0x91e6('0x39')]||_0x1cee33);_0x5cf043[_0x91e6('0x1c')](_0x2e3ef1[_0x91e6('0x1c')]||0x0);return dbH['sequelize']['query'](_0x31d00a['toString'](),{'type':dbH[_0x91e6('0x83')][_0x91e6('0x84')][_0x91e6('0x85')]})['then'](function(_0x19541b){if(!_0x19541b[_0x91e6('0x37')]){_0x347f3a=0x0;}else{_0x347f3a=_0x19541b[0x0][_0x91e6('0x42')]||0x0;}return dbH[_0x91e6('0x83')][_0x91e6('0x32')](_0x5cf043[_0x91e6('0x82')](),{'type':dbH['sequelize'][_0x91e6('0x84')][_0x91e6('0x85')]});})[_0x91e6('0x24')](function(_0x252606){return{'rows':_0x252606||[],'count':_0x347f3a};});}});}exports['run']=function(_0xb5d821,_0x50a3d9){return runReport(_0xb5d821[_0x91e6('0x48')],_0xb5d821['query'],_0xb5d821[_0x91e6('0x40')])['then'](respondWithResult(_0x50a3d9,null))[_0x91e6('0x47')](handleError(_0x50a3d9,null));};exports[_0x91e6('0xa1')]=runReport;exports[_0x91e6('0x32')]=function(_0x120273,_0x1bf01c){var _0xcc77b5=0xa;var _0x196046=[_0x91e6('0x54'),_0x91e6('0xa2'),'right_join',_0x91e6('0x56')];var _0x4b3fa7={'SUM':_0x91e6('0x57'),'COUNT':_0x91e6('0x86'),'COUNT DISTINCT':_0x91e6('0x58'),'MAX':_0x91e6('0x87'),'MIN':_0x91e6('0x59'),'AVG':_0x91e6('0x5a'),'GROUP_CONCAT':_0x91e6('0x5b'),'GROUP_CONCAT ASC':_0x91e6('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x273a16={'SEC_TO_TIME':_0x91e6('0x89'),'DATE':_0x91e6('0x5d'),'HOUR':_0x91e6('0x5e'),'ROUND':_0x91e6('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3273ce=function(_0x32fa50){return!_[_0x91e6('0x61')]([_0x91e6('0x62'),_0x91e6('0x63'),'IS\x20EMPTY',_0x91e6('0x8a')],_0x32fa50);};var _0x287da6=function(_0x1c6de2){if(!_0x1c6de2||!_0x1c6de2['rules'][_0x91e6('0x37')]){return'';}for(var _0x5ca4db='(',_0x524453=0x0;_0x524453<_0x1c6de2[_0x91e6('0x64')]['length'];_0x524453+=0x1){_0x524453>0x0&&(_0x5ca4db+='\x20'+_0x1c6de2[_0x91e6('0x65')]+'\x20');_0x5ca4db+=_0x1c6de2[_0x91e6('0x64')][_0x524453][_0x91e6('0x66')]?_0x287da6(_0x1c6de2[_0x91e6('0x64')][_0x524453][_0x91e6('0x66')]):_0x1c6de2[_0x91e6('0x64')][_0x524453][_0x91e6('0x67')]+'\x20'+_0x1c6de2[_0x91e6('0x64')][_0x524453][_0x91e6('0x68')]+(_0x3273ce(_0x1c6de2[_0x91e6('0x64')][_0x524453][_0x91e6('0x68')])?'\x20'+_0x1c6de2[_0x91e6('0x64')][_0x524453]['value']:'');}return _0x5ca4db+')';};var _0x3552c9={'where':{'id':_0x120273[_0x91e6('0x48')]['id']}},_0x45e7e8,_0x19b4b9,_0x19309b,_0x4ab8cb,_0x42c504;_0x3552c9=_[_0x91e6('0x3e')]({},_0x3552c9,_0x120273[_0x91e6('0x40')]);return db['AnalyticCustomReport']['find'](_0x3552c9)[_0x91e6('0x24')](function(_0x107d05){if(_0x107d05){_0x45e7e8=_0x107d05;return _0x107d05['getFields']();}return null;})[_0x91e6('0x24')](function(_0x5d43d9){if(_0x5d43d9){if(!_0x5d43d9[_0x91e6('0x37')]){throw new db[(_0x91e6('0x6a'))][(_0x91e6('0x6b'))](_0x91e6('0x6c'),0x193);}_0x19b4b9=_0x5d43d9;return db['AnalyticMetric'][_0x91e6('0x45')]({'raw':!![]});}return null;})['then'](function(_0x8e3392){if(_0x8e3392){_0x19309b=_['keyBy'](_0x8e3392,'id');var _0x55c9e7;var _0x2a0640=squel[_0x91e6('0x6f')]();_0x2a0640['from'](_0x45e7e8[_0x91e6('0x71')]);for(var _0x5a0bca=0x0;_0x5a0bca<_0x19b4b9[_0x91e6('0x37')];_0x5a0bca+=0x1){_0x55c9e7=_0x19b4b9[_0x5a0bca][_0x91e6('0x72')]?_0x19309b[_0x19b4b9[_0x5a0bca][_0x91e6('0x72')]][_0x91e6('0x73')]:_0x19b4b9[_0x5a0bca][_0x91e6('0x67')];_0x55c9e7=_0x19b4b9[_0x5a0bca]['function']?_[_0x91e6('0x76')](_0x4b3fa7[_0x19b4b9[_0x5a0bca][_0x91e6('0x74')]],'%s',_0x55c9e7):_0x55c9e7;_0x55c9e7=_0x19b4b9[_0x5a0bca][_0x91e6('0x75')]?_[_0x91e6('0x76')](_0x273a16[_0x19b4b9[_0x5a0bca][_0x91e6('0x75')]],'%s',_0x55c9e7):_0x55c9e7;if(_0x19b4b9[_0x5a0bca][_0x91e6('0x77')]){_0x2a0640[_0x91e6('0x66')](_0x55c9e7);}_0x19b4b9[_0x5a0bca][_0x91e6('0x78')]&&_0x2a0640[_0x91e6('0x3a')](_0x55c9e7,_0x19b4b9[_0x5a0bca][_0x91e6('0x78')]===_0x91e6('0x79')?![]:!![]);_0x2a0640['field'](_0x55c9e7,_0x19b4b9[_0x5a0bca][_0x91e6('0x8c')]||_0x55c9e7);}if(_0x45e7e8['joins']){_0x45e7e8[_0x91e6('0x7a')]=JSON[_0x91e6('0x7f')](_0x45e7e8[_0x91e6('0x7a')]);for(var _0x253402=0x0;_0x253402<_0x45e7e8[_0x91e6('0x7a')]['length'];_0x253402+=0x1){if(_0x45e7e8[_0x91e6('0x7a')][_0x253402][_0x91e6('0x30')]&&_[_0x91e6('0x61')](_0x196046,_0x45e7e8[_0x91e6('0x7a')][_0x253402][_0x91e6('0x30')])&&_0x45e7e8[_0x91e6('0x7a')][_0x253402][_0x91e6('0x7b')]&&_0x45e7e8['joins'][_0x253402]['foreignTable']&&_0x45e7e8[_0x91e6('0x7a')][_0x253402]['foreignKey']){_0x2a0640[_0x45e7e8['joins'][_0x253402][_0x91e6('0x30')]](_0x45e7e8[_0x91e6('0x7a')][_0x253402]['foreignTable'],null,util[_0x91e6('0x75')](_0x91e6('0x8d'),_0x45e7e8[_0x91e6('0x71')],_0x45e7e8[_0x91e6('0x7a')][_0x253402]['parentKey'],_0x45e7e8['joins'][_0x253402]['foreignTable'],_0x45e7e8[_0x91e6('0x7a')][_0x253402][_0x91e6('0x7d')]));}}}if(_0x45e7e8[_0x91e6('0x7e')]){_0x45e7e8[_0x91e6('0x7e')]=JSON[_0x91e6('0x7f')](_0x45e7e8[_0x91e6('0x7e')]);_0x2a0640[_0x91e6('0x3c')](_0x287da6(_0x45e7e8['conditions']['group']));}_0x42c504=_0x2a0640['clone']();_0x2a0640[_0x91e6('0x39')](_0xcc77b5);_0x2a0640[_0x91e6('0x1c')](0x0);logger[_0x91e6('0x81')](_0x91e6('0x8e'),_0x2a0640[_0x91e6('0x82')]());return db[_0x91e6('0x83')][_0x91e6('0x32')](_0x2a0640[_0x91e6('0x82')](),{'type':db['sequelize'][_0x91e6('0x84')][_0x91e6('0x85')]});}})[_0x91e6('0x24')](function(){return{'sql':_0x42c504[_0x91e6('0x82')]()};})['then'](respondWithResult(_0x1bf01c,null))[_0x91e6('0x47')](handleError(_0x1bf01c,null));}; \ No newline at end of file +var _0x18a9=['fork','../../files/reports','countTable','QueryTypes','run','runReport','IS\x20NOT\x20EMPTY','debug','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','then','get','CustomReports','UserProfileResource','destroy','stack','name','send','index','map','AnalyticCustomReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','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)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','MetricId','field','function','replace','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','SELECT','join','left_join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','IS\x20NOT\x20NULL','AnalyticMetric','from','table','metric','groupBy','No\x20available\x20data','output','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process'];(function(_0x5d1691,_0x4a936a){var _0x2d522a=function(_0x249a9e){while(--_0x249a9e){_0x5d1691['push'](_0x5d1691['shift']());}};_0x2d522a(++_0x4a936a);}(_0x18a9,0x15b));var _0x918a=function(_0x518f4f,_0xc2f4c1){_0x518f4f=_0x518f4f-0x0;var _0x993397=_0x18a9[_0x518f4f];return _0x993397;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x918a('0x0'));var zipdir=require(_0x918a('0x1'));var jsonpatch=require(_0x918a('0x2'));var rp=require(_0x918a('0x3'));var moment=require(_0x918a('0x4'));var BPromise=require(_0x918a('0x5'));var Mustache=require(_0x918a('0x6'));var util=require(_0x918a('0x7'));var path=require(_0x918a('0x8'));var sox=require(_0x918a('0x9'));var csv=require(_0x918a('0xa'));var ejs=require(_0x918a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x918a('0xc'));var crypto=require(_0x918a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x918a('0xe'));var toCsv=require(_0x918a('0xa'));var querystring=require(_0x918a('0xf'));var Papa=require(_0x918a('0x10'));var Redis=require(_0x918a('0x11'));var authService=require(_0x918a('0x12'));var qs=require(_0x918a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x918a('0x14'));var logger=require(_0x918a('0x15'))(_0x918a('0x16'));var utils=require(_0x918a('0x17'));var config=require('../../config/environment');var db=require(_0x918a('0x18'))['db'];var dbH=require(_0x918a('0x18'))['dbH'];function respondWithStatusCode(_0x36f4aa,_0x3e4490){_0x3e4490=_0x3e4490||0xcc;return function(_0x1ff70a){if(_0x1ff70a){return _0x36f4aa[_0x918a('0x19')](_0x3e4490);}return _0x36f4aa['status'](_0x3e4490)[_0x918a('0x1a')]();};}function respondWithResult(_0x55c90e,_0x19583e){_0x19583e=_0x19583e||0xc8;return function(_0x595920){if(_0x595920){return _0x55c90e['status'](_0x19583e)[_0x918a('0x1b')](_0x595920);}};}function respondWithFilteredResult(_0x22bd74,_0x47ce2d){return function(_0x355174){if(_0x355174){var _0x5786e2=_0x355174['count'],_0x1c5eb9=_0x47ce2d[_0x918a('0x1c')],_0x17f988=_0x47ce2d['offset']+_0x47ce2d[_0x918a('0x1d')],_0x3decc8;if(_0x17f988>=_0x5786e2){_0x17f988=_0x5786e2;_0x3decc8=0xc8;}else{_0x3decc8=0xce;}_0x22bd74[_0x918a('0x1e')](_0x3decc8);return _0x22bd74[_0x918a('0x1f')](_0x918a('0x20'),_0x1c5eb9+'-'+_0x17f988+'/'+_0x5786e2)['json'](_0x355174);}return null;};}function patchUpdates(_0x21a4a3){return function(_0x200737){try{jsonpatch[_0x918a('0x21')](_0x200737,_0x21a4a3,!![]);}catch(_0x45e84d){return BPromise[_0x918a('0x22')](_0x45e84d);}return _0x200737[_0x918a('0x23')]();};}function saveUpdates(_0x2cf02b,_0x4fa3c4){return function(_0x17acb7){if(_0x17acb7){return _0x17acb7['update'](_0x2cf02b)[_0x918a('0x24')](function(_0x4961fb){return _0x4961fb;});}return null;};}function removeEntity(_0x4c5993,_0x4c7675){return function(_0x10d172){if(_0x10d172){return _0x10d172['destroy']()[_0x918a('0x24')](function(){var _0xd40a6c=_0x10d172[_0x918a('0x25')]({'plain':!![]});var _0x2d8077=_0x918a('0x26');return db[_0x918a('0x27')][_0x918a('0x28')]({'where':{'type':_0x2d8077,'resourceId':_0xd40a6c['id']}})[_0x918a('0x24')](function(){return _0x10d172;});})[_0x918a('0x24')](function(){_0x4c5993[_0x918a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a4106,_0x1bdb27){return function(_0x262d5c){if(!_0x262d5c){_0x1a4106['sendStatus'](0x194);}return _0x262d5c;};}function handleError(_0x22653a,_0x36f103){_0x36f103=_0x36f103||0x1f4;return function(_0x2728f2){logger['error'](_0x2728f2[_0x918a('0x29')]);if(_0x2728f2[_0x918a('0x2a')]){delete _0x2728f2[_0x918a('0x2a')];}_0x22653a[_0x918a('0x1e')](_0x36f103)[_0x918a('0x2b')](_0x2728f2);};}exports[_0x918a('0x2c')]=function(_0x51361c,_0x57b6a7){var _0x5ac4b4={},_0x89260f={},_0x2514ae={'count':0x0,'rows':[]};var _0x5e09fd=_[_0x918a('0x2d')](db[_0x918a('0x2e')]['rawAttributes'],function(_0x5c7d95){return{'name':_0x5c7d95[_0x918a('0x2f')],'type':_0x5c7d95['type'][_0x918a('0x30')]};});_0x89260f[_0x918a('0x31')]=_[_0x918a('0x2d')](_0x5e09fd,_0x918a('0x2a'));_0x89260f[_0x918a('0x32')]=_[_0x918a('0x33')](_0x51361c['query']);_0x89260f[_0x918a('0x34')]=_[_0x918a('0x35')](_0x89260f[_0x918a('0x31')],_0x89260f[_0x918a('0x32')]);_0x5ac4b4[_0x918a('0x36')]=_[_0x918a('0x35')](_0x89260f['model'],qs[_0x918a('0x37')](_0x51361c[_0x918a('0x32')][_0x918a('0x37')]));_0x5ac4b4['attributes']=_0x5ac4b4[_0x918a('0x36')]['length']?_0x5ac4b4[_0x918a('0x36')]:_0x89260f['model'];if(!_0x51361c[_0x918a('0x32')][_0x918a('0x38')](_0x918a('0x39'))){_0x5ac4b4[_0x918a('0x1d')]=qs[_0x918a('0x1d')](_0x51361c['query']['limit']);_0x5ac4b4[_0x918a('0x1c')]=qs[_0x918a('0x1c')](_0x51361c['query'][_0x918a('0x1c')]);}_0x5ac4b4[_0x918a('0x3a')]=qs[_0x918a('0x3b')](_0x51361c[_0x918a('0x32')][_0x918a('0x3b')]);_0x5ac4b4[_0x918a('0x3c')]=qs[_0x918a('0x34')](_['pick'](_0x51361c[_0x918a('0x32')],_0x89260f['filters']),_0x5e09fd);if(_0x51361c['query'][_0x918a('0x3d')]){_0x5ac4b4[_0x918a('0x3c')]=_[_0x918a('0x3e')](_0x5ac4b4[_0x918a('0x3c')],{'$or':_['map'](_0x5e09fd,function(_0xa86b9d){if(_0xa86b9d[_0x918a('0x3f')]!==_0x918a('0x40')){var _0x29461c={};_0x29461c[_0xa86b9d[_0x918a('0x2a')]]={'$like':'%'+_0x51361c['query'][_0x918a('0x3d')]+'%'};return _0x29461c;}})});}_0x5ac4b4=_[_0x918a('0x3e')]({},_0x5ac4b4,_0x51361c[_0x918a('0x41')]);var _0x11ef8e={'where':_0x5ac4b4[_0x918a('0x3c')]};return db[_0x918a('0x2e')][_0x918a('0x42')](_0x11ef8e)[_0x918a('0x24')](function(_0x2b14de){_0x2514ae['count']=_0x2b14de;if(_0x51361c[_0x918a('0x32')][_0x918a('0x43')]){_0x5ac4b4[_0x918a('0x44')]=[{'all':!![]}];}return db[_0x918a('0x2e')][_0x918a('0x45')](_0x5ac4b4);})[_0x918a('0x24')](function(_0xcc20a0){_0x2514ae['rows']=_0xcc20a0;return _0x2514ae;})[_0x918a('0x24')](respondWithFilteredResult(_0x57b6a7,_0x5ac4b4))[_0x918a('0x46')](handleError(_0x57b6a7,null));};exports[_0x918a('0x47')]=function(_0x44c419,_0x5e76d0){var _0x6140e8={'raw':![],'where':{'id':_0x44c419[_0x918a('0x48')]['id']}},_0x55107d={};_0x55107d[_0x918a('0x31')]=_['keys'](db['AnalyticCustomReport'][_0x918a('0x49')]);_0x55107d[_0x918a('0x32')]=_[_0x918a('0x33')](_0x44c419[_0x918a('0x32')]);_0x55107d['filters']=_['intersection'](_0x55107d[_0x918a('0x31')],_0x55107d[_0x918a('0x32')]);_0x6140e8[_0x918a('0x36')]=_[_0x918a('0x35')](_0x55107d['model'],qs['fields'](_0x44c419[_0x918a('0x32')]['fields']));_0x6140e8[_0x918a('0x36')]=_0x6140e8[_0x918a('0x36')][_0x918a('0x4a')]?_0x6140e8[_0x918a('0x36')]:_0x55107d[_0x918a('0x31')];if(_0x44c419[_0x918a('0x32')][_0x918a('0x43')]){_0x6140e8[_0x918a('0x44')]=[{'all':!![]}];}_0x6140e8=_[_0x918a('0x3e')]({},_0x6140e8,_0x44c419[_0x918a('0x41')]);return db[_0x918a('0x2e')][_0x918a('0x4b')](_0x6140e8)[_0x918a('0x24')](handleEntityNotFound(_0x5e76d0,null))[_0x918a('0x24')](respondWithResult(_0x5e76d0,null))['catch'](handleError(_0x5e76d0,null));};exports[_0x918a('0x4c')]=function(_0x4d3a00,_0x56af76){return db[_0x918a('0x2e')]['create'](_0x4d3a00[_0x918a('0x4d')],{})[_0x918a('0x24')](function(_0x5e1a6a){var _0x4e4c83=_0x4d3a00[_0x918a('0x4e')]['get']({'plain':!![]});if(!_0x4e4c83)throw new Error(_0x918a('0x4f'));if(_0x4e4c83[_0x918a('0x50')]===_0x918a('0x4e')){var _0x365ede=_0x5e1a6a[_0x918a('0x25')]({'plain':!![]});var _0x509241=_0x918a('0x51');return db[_0x918a('0x52')][_0x918a('0x4b')]({'where':{'name':_0x509241,'userProfileId':_0x4e4c83['userProfileId']},'raw':!![]})[_0x918a('0x24')](function(_0x4be894){if(_0x4be894&&_0x4be894[_0x918a('0x53')]===0x0){return db[_0x918a('0x27')][_0x918a('0x4c')]({'name':_0x365ede[_0x918a('0x2a')],'resourceId':_0x365ede['id'],'type':'CustomReports','sectionId':_0x4be894['id']},{})[_0x918a('0x24')](function(){return _0x5e1a6a;});}else{return _0x5e1a6a;}})[_0x918a('0x46')](function(_0x46170e){logger[_0x918a('0x54')](_0x918a('0x55'),_0x46170e);throw _0x46170e;});}return _0x5e1a6a;})['then'](respondWithResult(_0x56af76,0xc9))[_0x918a('0x46')](handleError(_0x56af76,null));};exports[_0x918a('0x56')]=function(_0x3f1632,_0x116148){if(_0x3f1632['body']['id']){delete _0x3f1632[_0x918a('0x4d')]['id'];}return db[_0x918a('0x2e')]['find']({'where':{'id':_0x3f1632[_0x918a('0x48')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x116148,null))[_0x918a('0x24')](saveUpdates(_0x3f1632[_0x918a('0x4d')],null))['then'](respondWithResult(_0x116148,null))[_0x918a('0x46')](handleError(_0x116148,null));};exports[_0x918a('0x28')]=function(_0x1a2159,_0x449554){return db[_0x918a('0x2e')][_0x918a('0x4b')]({'where':{'id':_0x1a2159[_0x918a('0x48')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x449554,null))[_0x918a('0x24')](removeEntity(_0x449554,null))[_0x918a('0x46')](handleError(_0x449554,null));};exports[_0x918a('0x57')]=function(_0x29c89c,_0x45f308){var _0x241937=0xa;var _0x109fea=['join','left_join',_0x918a('0x58'),_0x918a('0x59')];var _0x2eed85={'SUM':_0x918a('0x5a'),'COUNT':_0x918a('0x5b'),'COUNT DISTINCT':_0x918a('0x5c'),'MAX':_0x918a('0x5d'),'MIN':_0x918a('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x918a('0x5f'),'GROUP_CONCAT ASC':_0x918a('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x215e37={'SEC_TO_TIME':_0x918a('0x61'),'DATE':_0x918a('0x62'),'HOUR':_0x918a('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x918a('0x64')};var _0x27909c=function(_0x4d54bf){return!_[_0x918a('0x65')]([_0x918a('0x66'),'IS\x20NOT\x20NULL',_0x918a('0x67'),'IS\x20NOT\x20EMPTY'],_0x4d54bf);};var _0x217118=function(_0x17a61c){if(!_0x17a61c||!_0x17a61c[_0x918a('0x68')][_0x918a('0x4a')]){return'';}for(var _0x4d4d91='(',_0x37ab58=0x0;_0x37ab58<_0x17a61c[_0x918a('0x68')][_0x918a('0x4a')];_0x37ab58+=0x1){_0x37ab58>0x0&&(_0x4d4d91+='\x20'+_0x17a61c[_0x918a('0x69')]+'\x20');_0x4d4d91+=_0x17a61c[_0x918a('0x68')][_0x37ab58][_0x918a('0x6a')]?_0x217118(_0x17a61c[_0x918a('0x68')][_0x37ab58][_0x918a('0x6a')]):_0x17a61c[_0x918a('0x68')][_0x37ab58]['field']+'\x20'+_0x17a61c[_0x918a('0x68')][_0x37ab58][_0x918a('0x6b')]+(_0x27909c(_0x17a61c[_0x918a('0x68')][_0x37ab58]['condition'])?'\x20'+_0x17a61c['rules'][_0x37ab58][_0x918a('0x6c')]:'');}return _0x4d4d91+')';};var _0x465f9c={'where':{'id':_0x29c89c[_0x918a('0x48')]['id']}},_0x157ffd,_0x1c88a3,_0x262ec3,_0x4dbd13,_0x49b3fe;_0x465f9c=_[_0x918a('0x3e')]({},_0x465f9c,_0x29c89c[_0x918a('0x41')]);return db[_0x918a('0x2e')][_0x918a('0x4b')](_0x465f9c)[_0x918a('0x24')](function(_0x28117e){if(_0x28117e){_0x157ffd=_0x28117e;return _0x28117e[_0x918a('0x6d')]();}return null;})['then'](function(_0x1ce227){if(_0x1ce227){if(!_0x1ce227[_0x918a('0x4a')]){throw new db[(_0x918a('0x6e'))][(_0x918a('0x6f'))](_0x918a('0x70'),0x193);}_0x1c88a3=_0x1ce227;return db['AnalyticMetric'][_0x918a('0x45')]({'raw':!![]});}return null;})[_0x918a('0x24')](function(_0x418d25){if(_0x418d25){_0x262ec3=_[_0x918a('0x71')](_0x418d25,'id');var _0x5db7c3;var _0x236760=squel[_0x918a('0x72')]();_0x236760['from'](_0x157ffd['table']);for(var _0x411e02=0x0;_0x411e02<_0x1c88a3[_0x918a('0x4a')];_0x411e02+=0x1){_0x5db7c3=_0x1c88a3[_0x411e02][_0x918a('0x73')]?_0x262ec3[_0x1c88a3[_0x411e02]['MetricId']]['metric']:_0x1c88a3[_0x411e02][_0x918a('0x74')];_0x5db7c3=_0x1c88a3[_0x411e02][_0x918a('0x75')]?_[_0x918a('0x76')](_0x2eed85[_0x1c88a3[_0x411e02][_0x918a('0x75')]],'%s',_0x5db7c3):_0x5db7c3;_0x5db7c3=_0x1c88a3[_0x411e02][_0x918a('0x77')]?_['replace'](_0x215e37[_0x1c88a3[_0x411e02][_0x918a('0x77')]],'%s',_0x5db7c3):_0x5db7c3;if(_0x1c88a3[_0x411e02]['groupBy']){_0x236760['group'](_0x5db7c3);}_0x1c88a3[_0x411e02]['orderBy']&&_0x236760['order'](_0x5db7c3,_0x1c88a3[_0x411e02][_0x918a('0x78')]===_0x918a('0x79')?![]:!![]);_0x236760[_0x918a('0x74')](_0x5db7c3,_0x1c88a3[_0x411e02][_0x918a('0x7a')]||_0x5db7c3);}if(_0x157ffd[_0x918a('0x7b')]){_0x157ffd[_0x918a('0x7b')]=JSON['parse'](_0x157ffd['joins']);for(var _0x215d4d=0x0;_0x215d4d<_0x157ffd[_0x918a('0x7b')][_0x918a('0x4a')];_0x215d4d+=0x1){if(_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x3f')]&&_[_0x918a('0x65')](_0x109fea,_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x3f')])&&_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x7c')]&&_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x7d')]&&_0x157ffd['joins'][_0x215d4d][_0x918a('0x7e')]){_0x236760[_0x157ffd[_0x918a('0x7b')][_0x215d4d]['type']](_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x7d')],null,util[_0x918a('0x77')](_0x918a('0x7f'),_0x157ffd['table'],_0x157ffd['joins'][_0x215d4d][_0x918a('0x7c')],_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x7d')],_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x7e')]));}}}if(_0x157ffd['conditions']){_0x157ffd[_0x918a('0x80')]=JSON[_0x918a('0x81')](_0x157ffd[_0x918a('0x80')]);_0x236760['where'](_0x217118(_0x157ffd[_0x918a('0x80')]['group']));}_0x49b3fe=_0x236760[_0x918a('0x82')]();_0x236760[_0x918a('0x1d')](_0x241937);_0x236760[_0x918a('0x1c')](0x0);logger['debug']('Limited\x20Query:',_0x236760[_0x918a('0x83')]());return db[_0x918a('0x84')]['query'](_0x236760[_0x918a('0x83')](),{'type':db[_0x918a('0x84')]['QueryTypes'][_0x918a('0x85')]});}})[_0x918a('0x24')](respondWithResult(_0x45f308,null))[_0x918a('0x46')](handleError(_0x45f308,null));};function runReport(_0x3257f1,_0x11c3f1,_0x457124){var _0x150067=_0x11c3f1[_0x918a('0x2a')];var _0x1270ed=0xa;var _0x57c50d=[_0x918a('0x86'),_0x918a('0x87'),_0x918a('0x58'),_0x918a('0x59')];var _0x120609={'SUM':'SUM(%s)','COUNT':_0x918a('0x5b'),'COUNT DISTINCT':_0x918a('0x5c'),'MAX':_0x918a('0x5d'),'MIN':'MIN(%s)','AVG':_0x918a('0x88'),'GROUP_CONCAT':_0x918a('0x5f'),'GROUP_CONCAT ASC':_0x918a('0x60'),'GROUP_CONCAT DESC':_0x918a('0x89')};var _0x22029d={'SEC_TO_TIME':_0x918a('0x61'),'DATE':_0x918a('0x62'),'HOUR':_0x918a('0x63'),'ROUND':_0x918a('0x8a'),'UNIX_TIMESTAMP':_0x918a('0x64')};var _0x549004=function(_0x45c13b){return!_[_0x918a('0x65')]([_0x918a('0x66'),_0x918a('0x8b'),_0x918a('0x67'),'IS\x20NOT\x20EMPTY'],_0x45c13b);};var _0x3b499d=function(_0x32327f){if(!_0x32327f||!_0x32327f[_0x918a('0x68')]['length']){return'';}for(var _0x2b896f='(',_0x4e840b=0x0;_0x4e840b<_0x32327f['rules'][_0x918a('0x4a')];_0x4e840b+=0x1){_0x4e840b>0x0&&(_0x2b896f+='\x20'+_0x32327f['operator']+'\x20');_0x2b896f+=_0x32327f[_0x918a('0x68')][_0x4e840b][_0x918a('0x6a')]?_0x3b499d(_0x32327f[_0x918a('0x68')][_0x4e840b][_0x918a('0x6a')]):_0x32327f[_0x918a('0x68')][_0x4e840b][_0x918a('0x74')]+'\x20'+_0x32327f[_0x918a('0x68')][_0x4e840b][_0x918a('0x6b')]+(_0x549004(_0x32327f['rules'][_0x4e840b]['condition'])?'\x20'+_0x32327f['rules'][_0x4e840b][_0x918a('0x6c')]:'');}return _0x2b896f+')';};var _0x584ff7={'where':{'id':_0x3257f1['id']}},_0x436177,_0x4db9f3,_0x23e559,_0x55a6ca,_0x5b0f68;_0x584ff7=_[_0x918a('0x3e')]({},_0x584ff7,_0x457124);return db[_0x918a('0x2e')]['find'](_0x584ff7)[_0x918a('0x24')](function(_0xa6c8df){if(_0xa6c8df){_0x436177=_0xa6c8df;return _0xa6c8df[_0x918a('0x6d')]();}return null;})[_0x918a('0x24')](function(_0x5c873c){if(_0x5c873c){if(!_0x5c873c[_0x918a('0x4a')]){throw new db[(_0x918a('0x6e'))][(_0x918a('0x6f'))](_0x918a('0x70'),0x193);}_0x4db9f3=_0x5c873c;return db[_0x918a('0x8c')][_0x918a('0x45')]({'raw':!![]});}return null;})['then'](function(_0x494a06){if(_0x494a06){_0x23e559=_[_0x918a('0x71')](_0x494a06,'id');var _0x3069a7;var _0x18ca71=squel[_0x918a('0x72')]();_0x18ca71[_0x918a('0x8d')](_0x436177[_0x918a('0x8e')]);for(var _0x346b6d=0x0;_0x346b6d<_0x4db9f3['length'];_0x346b6d+=0x1){_0x3069a7=_0x4db9f3[_0x346b6d][_0x918a('0x73')]?_0x23e559[_0x4db9f3[_0x346b6d]['MetricId']][_0x918a('0x8f')]:_0x4db9f3[_0x346b6d][_0x918a('0x74')];_0x3069a7=_0x4db9f3[_0x346b6d][_0x918a('0x75')]?_[_0x918a('0x76')](_0x120609[_0x4db9f3[_0x346b6d][_0x918a('0x75')]],'%s',_0x3069a7):_0x3069a7;_0x3069a7=_0x4db9f3[_0x346b6d][_0x918a('0x77')]?_[_0x918a('0x76')](_0x22029d[_0x4db9f3[_0x346b6d][_0x918a('0x77')]],'%s',_0x3069a7):_0x3069a7;if(_0x4db9f3[_0x346b6d][_0x918a('0x90')]){_0x18ca71[_0x918a('0x6a')](_0x3069a7);}_0x4db9f3[_0x346b6d]['orderBy']&&_0x18ca71[_0x918a('0x3a')](_0x3069a7,_0x4db9f3[_0x346b6d][_0x918a('0x78')]===_0x918a('0x79')?![]:!![]);_0x18ca71['field'](_0x3069a7,_0x4db9f3[_0x346b6d][_0x918a('0x7a')]||_0x3069a7);}if(_0x436177['joins']){_0x436177['joins']=JSON[_0x918a('0x81')](_0x436177['joins']);for(var _0x352e0f=0x0;_0x352e0f<_0x436177[_0x918a('0x7b')]['length'];_0x352e0f+=0x1){if(_0x436177[_0x918a('0x7b')][_0x352e0f][_0x918a('0x3f')]&&_[_0x918a('0x65')](_0x57c50d,_0x436177['joins'][_0x352e0f][_0x918a('0x3f')])&&_0x436177[_0x918a('0x7b')][_0x352e0f]['parentKey']&&_0x436177['joins'][_0x352e0f][_0x918a('0x7d')]&&_0x436177[_0x918a('0x7b')][_0x352e0f]['foreignKey']){_0x18ca71[_0x436177[_0x918a('0x7b')][_0x352e0f][_0x918a('0x3f')]](_0x436177[_0x918a('0x7b')][_0x352e0f][_0x918a('0x7d')],null,util[_0x918a('0x77')](_0x918a('0x7f'),_0x436177['table'],_0x436177[_0x918a('0x7b')][_0x352e0f][_0x918a('0x7c')],_0x436177[_0x918a('0x7b')][_0x352e0f][_0x918a('0x7d')],_0x436177[_0x918a('0x7b')][_0x352e0f][_0x918a('0x7e')]));}}}if(_0x436177[_0x918a('0x80')]){_0x436177[_0x918a('0x80')]=JSON['parse'](_0x436177['conditions']);_0x18ca71['where'](_0x3b499d(_0x436177[_0x918a('0x80')][_0x918a('0x6a')]));}_0x5b0f68=_0x18ca71[_0x918a('0x82')]();_0x18ca71['limit'](_0x1270ed);_0x18ca71[_0x918a('0x1c')](0x0);logger['debug']('Limited\x20Query:',_0x18ca71[_0x918a('0x83')]());return db['sequelize'][_0x918a('0x32')](_0x18ca71[_0x918a('0x83')](),{'type':db[_0x918a('0x84')]['QueryTypes'][_0x918a('0x85')]});}})['then'](function(_0x899d02){if(!_0x899d02['length']){throw new db[(_0x918a('0x6e'))][(_0x918a('0x6f'))](_0x918a('0x91'),0xcc);}if(_0x11c3f1[_0x918a('0x92')]==='web'){return null;}var _0x573226=_[_0x918a('0x3e')](_0x11c3f1,{'name':_0x11c3f1['fullPath']||_0x11c3f1[_0x918a('0x2a')]||_0x436177[_0x918a('0x2a')],'basename':_0x150067,'savename':util[_0x918a('0x77')](_0x918a('0x93'),_0x11c3f1['name']||_0x436177[_0x918a('0x2a')],require(_0x918a('0x94'))[_0x918a('0x95')](0x4),_0x11c3f1[_0x918a('0x92')]||_0x918a('0x96')),'reportId':_0x436177['id'],'reportType':_0x918a('0x97')});return db[_0x918a('0x98')][_0x918a('0x4c')](_0x573226,{'raw':!![]});})[_0x918a('0x24')](function(_0x109fe4){if(_0x436177['table']==='cdr'){_0x5b0f68['where'](_0x436177[_0x918a('0x8e')]+_0x918a('0x99'),_0x11c3f1[_0x918a('0x9a')],_0x11c3f1[_0x918a('0x9b')]);}else{_0x5b0f68[_0x918a('0x3c')](_0x436177[_0x918a('0x8e')]+_0x918a('0x9c'),_0x11c3f1[_0x918a('0x9a')],_0x11c3f1[_0x918a('0x9b')]);}if(_0x109fe4){logger[_0x918a('0x9d')](_0x918a('0x9e'),_0x5b0f68['toString']());require(_0x918a('0x9f'))[_0x918a('0xa0')](path[_0x918a('0x86')](__dirname,'../../components/export/',_0x109fe4[_0x918a('0x92')]),[_0x109fe4['id'],_0x5b0f68[_0x918a('0x83')](),path[_0x918a('0x86')](__dirname,_0x918a('0xa1'),_0x109fe4['savename']),_0x150067]);return _0x109fe4;}else{var _0x1a2270=squel[_0x918a('0x72')]();_0x1a2270[_0x918a('0x8d')]('('+_0x5b0f68[_0x918a('0x83')]()+')',_0x918a('0xa2'));_0x1a2270[_0x918a('0x74')]('COUNT(*)',_0x918a('0x42'));_0x5b0f68[_0x918a('0x1d')](_0x11c3f1['limit']||_0x1270ed);_0x5b0f68['offset'](_0x11c3f1['offset']||0x0);return dbH[_0x918a('0x84')][_0x918a('0x32')](_0x1a2270[_0x918a('0x83')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x3e9580){if(!_0x3e9580[_0x918a('0x4a')]){_0x55a6ca=0x0;}else{_0x55a6ca=_0x3e9580[0x0][_0x918a('0x42')]||0x0;}return dbH[_0x918a('0x84')][_0x918a('0x32')](_0x5b0f68['toString'](),{'type':dbH[_0x918a('0x84')][_0x918a('0xa3')][_0x918a('0x85')]});})[_0x918a('0x24')](function(_0x4bd771){return{'rows':_0x4bd771||[],'count':_0x55a6ca};});}});}exports[_0x918a('0xa4')]=function(_0x38d247,_0x592726){return runReport(_0x38d247[_0x918a('0x48')],_0x38d247['query'],_0x38d247['options'])[_0x918a('0x24')](respondWithResult(_0x592726,null))[_0x918a('0x46')](handleError(_0x592726,null));};exports[_0x918a('0xa5')]=runReport;exports[_0x918a('0x32')]=function(_0x19562c,_0x2b695d){var _0x573e9a=0xa;var _0x58af2b=[_0x918a('0x86'),_0x918a('0x87'),'right_join',_0x918a('0x59')];var _0x10edc7={'SUM':_0x918a('0x5a'),'COUNT':_0x918a('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x918a('0x5d'),'MIN':'MIN(%s)','AVG':_0x918a('0x88'),'GROUP_CONCAT':_0x918a('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x918a('0x89')};var _0x8aba00={'SEC_TO_TIME':_0x918a('0x61'),'DATE':_0x918a('0x62'),'HOUR':'HOUR(%s)','ROUND':_0x918a('0x8a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x20a0a5=function(_0x46996a){return!_[_0x918a('0x65')]([_0x918a('0x66'),_0x918a('0x8b'),'IS\x20EMPTY',_0x918a('0xa6')],_0x46996a);};var _0x17b1e7=function(_0x15b680){if(!_0x15b680||!_0x15b680[_0x918a('0x68')]['length']){return'';}for(var _0x28a9e1='(',_0x15469b=0x0;_0x15469b<_0x15b680[_0x918a('0x68')][_0x918a('0x4a')];_0x15469b+=0x1){_0x15469b>0x0&&(_0x28a9e1+='\x20'+_0x15b680[_0x918a('0x69')]+'\x20');_0x28a9e1+=_0x15b680[_0x918a('0x68')][_0x15469b][_0x918a('0x6a')]?_0x17b1e7(_0x15b680[_0x918a('0x68')][_0x15469b][_0x918a('0x6a')]):_0x15b680[_0x918a('0x68')][_0x15469b][_0x918a('0x74')]+'\x20'+_0x15b680[_0x918a('0x68')][_0x15469b][_0x918a('0x6b')]+(_0x20a0a5(_0x15b680[_0x918a('0x68')][_0x15469b][_0x918a('0x6b')])?'\x20'+_0x15b680[_0x918a('0x68')][_0x15469b][_0x918a('0x6c')]:'');}return _0x28a9e1+')';};var _0x2f4033={'where':{'id':_0x19562c[_0x918a('0x48')]['id']}},_0x4564b9,_0x12302a,_0x559f5b,_0x22f364,_0x573cd6;_0x2f4033=_[_0x918a('0x3e')]({},_0x2f4033,_0x19562c['options']);return db[_0x918a('0x2e')][_0x918a('0x4b')](_0x2f4033)[_0x918a('0x24')](function(_0x2d759c){if(_0x2d759c){_0x4564b9=_0x2d759c;return _0x2d759c[_0x918a('0x6d')]();}return null;})[_0x918a('0x24')](function(_0x4fcf78){if(_0x4fcf78){if(!_0x4fcf78['length']){throw new db[(_0x918a('0x6e'))][(_0x918a('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x12302a=_0x4fcf78;return db['AnalyticMetric'][_0x918a('0x45')]({'raw':!![]});}return null;})['then'](function(_0x156f05){if(_0x156f05){_0x559f5b=_[_0x918a('0x71')](_0x156f05,'id');var _0x656c83;var _0x4242f7=squel[_0x918a('0x72')]();_0x4242f7[_0x918a('0x8d')](_0x4564b9[_0x918a('0x8e')]);for(var _0x2cdd9d=0x0;_0x2cdd9d<_0x12302a[_0x918a('0x4a')];_0x2cdd9d+=0x1){_0x656c83=_0x12302a[_0x2cdd9d][_0x918a('0x73')]?_0x559f5b[_0x12302a[_0x2cdd9d][_0x918a('0x73')]][_0x918a('0x8f')]:_0x12302a[_0x2cdd9d][_0x918a('0x74')];_0x656c83=_0x12302a[_0x2cdd9d][_0x918a('0x75')]?_['replace'](_0x10edc7[_0x12302a[_0x2cdd9d][_0x918a('0x75')]],'%s',_0x656c83):_0x656c83;_0x656c83=_0x12302a[_0x2cdd9d][_0x918a('0x77')]?_[_0x918a('0x76')](_0x8aba00[_0x12302a[_0x2cdd9d][_0x918a('0x77')]],'%s',_0x656c83):_0x656c83;if(_0x12302a[_0x2cdd9d][_0x918a('0x90')]){_0x4242f7[_0x918a('0x6a')](_0x656c83);}_0x12302a[_0x2cdd9d][_0x918a('0x78')]&&_0x4242f7[_0x918a('0x3a')](_0x656c83,_0x12302a[_0x2cdd9d]['orderBy']===_0x918a('0x79')?![]:!![]);_0x4242f7[_0x918a('0x74')](_0x656c83,_0x12302a[_0x2cdd9d]['alias']||_0x656c83);}if(_0x4564b9[_0x918a('0x7b')]){_0x4564b9[_0x918a('0x7b')]=JSON[_0x918a('0x81')](_0x4564b9[_0x918a('0x7b')]);for(var _0x2c5c92=0x0;_0x2c5c92<_0x4564b9[_0x918a('0x7b')]['length'];_0x2c5c92+=0x1){if(_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x3f')]&&_[_0x918a('0x65')](_0x58af2b,_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x3f')])&&_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x7c')]&&_0x4564b9[_0x918a('0x7b')][_0x2c5c92]['foreignTable']&&_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x7e')]){_0x4242f7[_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x3f')]](_0x4564b9['joins'][_0x2c5c92][_0x918a('0x7d')],null,util[_0x918a('0x77')](_0x918a('0x7f'),_0x4564b9['table'],_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x7c')],_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x7d')],_0x4564b9['joins'][_0x2c5c92][_0x918a('0x7e')]));}}}if(_0x4564b9[_0x918a('0x80')]){_0x4564b9[_0x918a('0x80')]=JSON[_0x918a('0x81')](_0x4564b9['conditions']);_0x4242f7[_0x918a('0x3c')](_0x17b1e7(_0x4564b9[_0x918a('0x80')][_0x918a('0x6a')]));}_0x573cd6=_0x4242f7[_0x918a('0x82')]();_0x4242f7[_0x918a('0x1d')](_0x573e9a);_0x4242f7[_0x918a('0x1c')](0x0);logger[_0x918a('0xa7')](_0x918a('0xa8'),_0x4242f7[_0x918a('0x83')]());return db[_0x918a('0x84')][_0x918a('0x32')](_0x4242f7[_0x918a('0x83')](),{'type':db[_0x918a('0x84')]['QueryTypes'][_0x918a('0x85')]});}})[_0x918a('0x24')](function(){return{'sql':_0x573cd6['toString']()};})[_0x918a('0x24')](respondWithResult(_0x2b695d,null))['catch'](handleError(_0x2b695d,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 77ef4d9..059b09e 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 _0x533c=['path','../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports','util','moment','bluebird','request-promise'];(function(_0x1f54ef,_0x58493d){var _0x821c0f=function(_0x5a65b8){while(--_0x5a65b8){_0x1f54ef['push'](_0x1f54ef['shift']());}};_0x821c0f(++_0x58493d);}(_0x533c,0x125));var _0xc533=function(_0x32e24e,_0x142f77){_0x32e24e=_0x32e24e-0x0;var _0x233eb0=_0x533c[_0x32e24e];return _0x233eb0;};'use strict';var _=require('lodash');var util=require(_0xc533('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc533('0x1'));var BPromise=require(_0xc533('0x2'));var rp=require(_0xc533('0x3'));var fs=require('fs');var path=require(_0xc533('0x4'));var rimraf=require('rimraf');var config=require(_0xc533('0x5'));var attributes=require(_0xc533('0x6'));module['exports']=function(_0x3be313,_0x3d1776){return _0x3be313['define'](_0xc533('0x7'),attributes,{'tableName':_0xc533('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77aa=['api','request-promise','rimraf','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util','../../config/logger'];(function(_0x24b81a,_0x14e995){var _0x2f99e7=function(_0x565ff2){while(--_0x565ff2){_0x24b81a['push'](_0x24b81a['shift']());}};_0x2f99e7(++_0x14e995);}(_0x77aa,0x1f1));var _0xa77a=function(_0x33b7e2,_0x5e51f2){_0x33b7e2=_0x33b7e2-0x0;var _0x43ed14=_0x77aa[_0x33b7e2];return _0x43ed14;};'use strict';var _=require(_0xa77a('0x0'));var util=require(_0xa77a('0x1'));var logger=require(_0xa77a('0x2'))(_0xa77a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa77a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa77a('0x5'));var config=require('../../config/environment');var attributes=require(_0xa77a('0x6'));module[_0xa77a('0x7')]=function(_0x5e23f5,_0x56f15d){return _0x5e23f5[_0xa77a('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xa77a('0x9'),'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 bd3eac0..059f262 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 _0xa9d7=['request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x5033bc,_0x4e0270){var _0x4d9dac=function(_0xadb933){while(--_0xadb933){_0x5033bc['push'](_0x5033bc['shift']());}};_0x4d9dac(++_0x4e0270);}(_0xa9d7,0x1d3));var _0x7a9d=function(_0x2da840,_0xb0568d){_0x2da840=_0x2da840-0x0;var _0x4b0c96=_0xa9d7[_0x2da840];return _0x4b0c96;};'use strict';var _=require(_0x7a9d('0x0'));var util=require(_0x7a9d('0x1'));var moment=require(_0x7a9d('0x2'));var BPromise=require(_0x7a9d('0x3'));var rs=require(_0x7a9d('0x4'));var fs=require('fs');var Redis=require(_0x7a9d('0x5'));var db=require(_0x7a9d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a9d('0x7'))(_0x7a9d('0x8'));var config=require(_0x7a9d('0x9'));var jayson=require(_0x7a9d('0xa'));var client=jayson[_0x7a9d('0xb')][_0x7a9d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40e23f,_0x479c7a,_0x59476f){return new BPromise(function(_0xac5141,_0x2572f8){return client[_0x7a9d('0xd')](_0x40e23f,_0x59476f)[_0x7a9d('0xe')](function(_0x23f301){logger['info'](_0x7a9d('0xf'),_0x479c7a,_0x7a9d('0x10'));logger['debug'](_0x7a9d('0x11'),_0x479c7a,_0x7a9d('0x10'),JSON['stringify'](_0x23f301));if(_0x23f301[_0x7a9d('0x12')]){if(_0x23f301[_0x7a9d('0x12')][_0x7a9d('0x13')]===0x1f4){logger[_0x7a9d('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x479c7a,_0x23f301['error'][_0x7a9d('0x14')]);return _0x2572f8(_0x23f301[_0x7a9d('0x12')][_0x7a9d('0x14')]);}logger[_0x7a9d('0x12')](_0x7a9d('0xf'),_0x479c7a,_0x23f301[_0x7a9d('0x12')][_0x7a9d('0x14')]);return _0xac5141(_0x23f301['error'][_0x7a9d('0x14')]);}else{logger[_0x7a9d('0x15')](_0x7a9d('0xf'),_0x479c7a,_0x7a9d('0x10'));_0xac5141(_0x23f301[_0x7a9d('0x16')][_0x7a9d('0x14')]);}})['catch'](function(_0x3795ec){logger['error'](_0x7a9d('0xf'),_0x479c7a,_0x3795ec);_0x2572f8(_0x3795ec);});});} \ No newline at end of file +var _0xa62b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','error','AnalyticCustomReport,\x20%s,\x20%s','message','util','moment','bluebird','randomstring'];(function(_0x3b139d,_0x4c32c0){var _0x4ff043=function(_0x5c50c9){while(--_0x5c50c9){_0x3b139d['push'](_0x3b139d['shift']());}};_0x4ff043(++_0x4c32c0);}(_0xa62b,0x152));var _0xba62=function(_0x4573ac,_0xeb05ed){_0x4573ac=_0x4573ac-0x0;var _0xc1a36b=_0xa62b[_0x4573ac];return _0xc1a36b;};'use strict';var _=require('lodash');var util=require(_0xba62('0x0'));var moment=require(_0xba62('0x1'));var BPromise=require(_0xba62('0x2'));var rs=require(_0xba62('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba62('0x4'))['db'];var utils=require(_0xba62('0x5'));var logger=require(_0xba62('0x6'))(_0xba62('0x7'));var config=require(_0xba62('0x8'));var jayson=require(_0xba62('0x9'));var client=jayson[_0xba62('0xa')][_0xba62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf286,_0x1920c5,_0x4c14b1){return new BPromise(function(_0x271560,_0x4647d5){return client[_0xba62('0xc')](_0x1bf286,_0x4c14b1)[_0xba62('0xd')](function(_0x18c78f){logger[_0xba62('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1920c5,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1920c5,'request\x20sent',JSON['stringify'](_0x18c78f));if(_0x18c78f[_0xba62('0xf')]){if(_0x18c78f[_0xba62('0xf')]['code']===0x1f4){logger['error'](_0xba62('0x10'),_0x1920c5,_0x18c78f[_0xba62('0xf')][_0xba62('0x11')]);return _0x4647d5(_0x18c78f[_0xba62('0xf')][_0xba62('0x11')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x1920c5,_0x18c78f[_0xba62('0xf')][_0xba62('0x11')]);return _0x271560(_0x18c78f[_0xba62('0xf')]['message']);}else{logger[_0xba62('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1920c5,'request\x20sent');_0x271560(_0x18c78f['result'][_0xba62('0x11')]);}})['catch'](function(_0x15ee4c){logger[_0xba62('0xf')](_0xba62('0x10'),_0x1920c5,_0x15ee4c);_0x4647d5(_0x15ee4c);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index be7f0b1..b389035 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 _0x7384=['express','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','delete','multer','util','connect-timeout'];(function(_0x253ed4,_0x342aca){var _0x22df23=function(_0x5ebbfa){while(--_0x5ebbfa){_0x253ed4['push'](_0x253ed4['shift']());}};_0x22df23(++_0x342aca);}(_0x7384,0x105));var _0x4738=function(_0x1be0d5,_0x550fee){_0x1be0d5=_0x1be0d5-0x0;var _0x507303=_0x7384[_0x1be0d5];return _0x507303;};'use strict';var multer=require(_0x4738('0x0'));var util=require(_0x4738('0x1'));var path=require('path');var timeout=require(_0x4738('0x2'));var express=require(_0x4738('0x3'));var router=express[_0x4738('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4738('0x5'));var config=require(_0x4738('0x6'));var controller=require(_0x4738('0x7'));router[_0x4738('0x8')]('/',auth['isAuthenticated'](),controller[_0x4738('0x9')]);router[_0x4738('0x8')](_0x4738('0xa'),auth[_0x4738('0xb')](),controller['show']);router[_0x4738('0x8')](_0x4738('0xc'),auth[_0x4738('0xb')](),controller[_0x4738('0xd')]);router[_0x4738('0x8')](_0x4738('0xe'),auth[_0x4738('0xb')](),controller[_0x4738('0xf')]);router['get'](_0x4738('0x10'),auth['isAuthenticated'](),controller[_0x4738('0x11')]);router[_0x4738('0x12')]('/',auth[_0x4738('0xb')](),controller[_0x4738('0x13')]);router[_0x4738('0x14')](_0x4738('0xa'),auth[_0x4738('0xb')](),controller['update']);router[_0x4738('0x15')](_0x4738('0xa'),auth[_0x4738('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x79d9=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/preview','/:id/run','run','/:id/query','query','create','put','/:id','delete'];(function(_0x2c4f75,_0x5b883d){var _0x59bf34=function(_0x1cb5c1){while(--_0x1cb5c1){_0x2c4f75['push'](_0x2c4f75['shift']());}};_0x59bf34(++_0x5b883d);}(_0x79d9,0xe9));var _0x979d=function(_0x4132c2,_0x29b8be){_0x4132c2=_0x4132c2-0x0;var _0x159cf6=_0x79d9[_0x4132c2];return _0x159cf6;};'use strict';var multer=require(_0x979d('0x0'));var util=require('util');var path=require(_0x979d('0x1'));var timeout=require(_0x979d('0x2'));var express=require(_0x979d('0x3'));var router=express[_0x979d('0x4')]();var auth=require(_0x979d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x979d('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x979d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x979d('0x7')]('/:id',auth[_0x979d('0x8')](),controller[_0x979d('0x9')]);router[_0x979d('0x7')](_0x979d('0xa'),auth[_0x979d('0x8')](),controller['preview']);router['get'](_0x979d('0xb'),auth['isAuthenticated'](),controller[_0x979d('0xc')]);router[_0x979d('0x7')](_0x979d('0xd'),auth[_0x979d('0x8')](),controller[_0x979d('0xe')]);router['post']('/',auth[_0x979d('0x8')](),controller[_0x979d('0xf')]);router[_0x979d('0x10')](_0x979d('0x11'),auth[_0x979d('0x8')](),controller['update']);router[_0x979d('0x12')]('/:id',auth[_0x979d('0x8')](),controller[_0x979d('0x13')]);module[_0x979d('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index d134ddb..0ffa393 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 _0x2a1b=['sequelize','STRING','TEXT'];(function(_0x103ddb,_0x6c6cbf){var _0x748141=function(_0x52e174){while(--_0x52e174){_0x103ddb['push'](_0x103ddb['shift']());}};_0x748141(++_0x6c6cbf);}(_0x2a1b,0x1c5));var _0xb2a1=function(_0x55436e,_0x50e740){_0x55436e=_0x55436e-0x0;var _0x3daf9c=_0x2a1b[_0x55436e];return _0x3daf9c;};'use strict';var Sequelize=require(_0xb2a1('0x0'));module['exports']={'name':{'type':Sequelize[_0xb2a1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb2a1('0x1')]},'parent':{'type':Sequelize[_0xb2a1('0x1')]},'table':{'type':Sequelize[_0xb2a1('0x1')]},'conditions':{'type':Sequelize[_0xb2a1('0x2')]},'joins':{'type':Sequelize[_0xb2a1('0x2')]}}; \ No newline at end of file +var _0xb216=['STRING','TEXT','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb216,0x12e));var _0x6b21=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0xb216[_0x100e36];return _0x1df0c9;};'use strict';var Sequelize=require(_0x6b21('0x0'));module[_0x6b21('0x1')]={'name':{'type':Sequelize[_0x6b21('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6b21('0x2')]},'parent':{'type':Sequelize[_0x6b21('0x2')]},'table':{'type':Sequelize[_0x6b21('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x6b21('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index bf30a68..3ee4de2 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 _0xbf8f=['../../config/utils','../../config/environment','../../mysqldb','dbH','status','json','count','offset','limit','set','apply','update','then','DefaultReports','UserProfileResource','destroy','end','sendStatus','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','merge','options','includeAll','include','findAll','rows','catch','show','params','create','role','user','get','Reports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','order','DESC','joins','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','left_join','cross_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','field','getFields','AnalyticMetric','No\x20available\x20data','web','fullPath','%s-%s.%s','randomstring','output','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','alias','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x236607,_0x37f8e9){var _0x1a4b1e=function(_0x3b24ce){while(--_0x3b24ce){_0x236607['push'](_0x236607['shift']());}};_0x1a4b1e(++_0x37f8e9);}(_0xbf8f,0x1d5));var _0xfbf8=function(_0x897491,_0x45bccd){_0x897491=_0x897491-0x0;var _0x11e409=_0xbf8f[_0x897491];return _0x11e409;};'use strict';var pdf=require(_0xfbf8('0x0'));var emlformat=require(_0xfbf8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfbf8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbf8('0x3'));var moment=require(_0xfbf8('0x4'));var BPromise=require(_0xfbf8('0x5'));var Mustache=require(_0xfbf8('0x6'));var util=require(_0xfbf8('0x7'));var path=require(_0xfbf8('0x8'));var sox=require('sox');var csv=require(_0xfbf8('0x9'));var ejs=require(_0xfbf8('0xa'));var fs=require('fs');var _=require(_0xfbf8('0xb'));var squel=require(_0xfbf8('0xc'));var crypto=require('crypto');var jsforce=require(_0xfbf8('0xd'));var deskjs=require(_0xfbf8('0xe'));var toCsv=require(_0xfbf8('0x9'));var querystring=require(_0xfbf8('0xf'));var Papa=require(_0xfbf8('0x10'));var Redis=require(_0xfbf8('0x11'));var authService=require(_0xfbf8('0x12'));var qs=require(_0xfbf8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbf8('0x14'));var logger=require(_0xfbf8('0x15'))(_0xfbf8('0x16'));var utils=require(_0xfbf8('0x17'));var config=require(_0xfbf8('0x18'));var db=require(_0xfbf8('0x19'))['db'];var dbH=require(_0xfbf8('0x19'))[_0xfbf8('0x1a')];function respondWithStatusCode(_0x85595,_0x42fe75){_0x42fe75=_0x42fe75||0xcc;return function(_0x5bdc53){if(_0x5bdc53){return _0x85595['sendStatus'](_0x42fe75);}return _0x85595[_0xfbf8('0x1b')](_0x42fe75)['end']();};}function respondWithResult(_0x64e40e,_0x218f57){_0x218f57=_0x218f57||0xc8;return function(_0x222724){if(_0x222724){return _0x64e40e[_0xfbf8('0x1b')](_0x218f57)[_0xfbf8('0x1c')](_0x222724);}};}function respondWithFilteredResult(_0x45cd6d,_0x17be8a){return function(_0x1ed407){if(_0x1ed407){var _0x21c8a2=_0x1ed407[_0xfbf8('0x1d')],_0x57fae7=_0x17be8a[_0xfbf8('0x1e')],_0x151dc0=_0x17be8a[_0xfbf8('0x1e')]+_0x17be8a[_0xfbf8('0x1f')],_0x511d4f;if(_0x151dc0>=_0x21c8a2){_0x151dc0=_0x21c8a2;_0x511d4f=0xc8;}else{_0x511d4f=0xce;}_0x45cd6d[_0xfbf8('0x1b')](_0x511d4f);return _0x45cd6d[_0xfbf8('0x20')]('Content-Range',_0x57fae7+'-'+_0x151dc0+'/'+_0x21c8a2)[_0xfbf8('0x1c')](_0x1ed407);}return null;};}function patchUpdates(_0x3c043f){return function(_0x204c75){try{jsonpatch[_0xfbf8('0x21')](_0x204c75,_0x3c043f,!![]);}catch(_0x10ac77){return BPromise['reject'](_0x10ac77);}return _0x204c75['save']();};}function saveUpdates(_0x4a16b2,_0x3c70c8){return function(_0x1ded2e){if(_0x1ded2e){return _0x1ded2e[_0xfbf8('0x22')](_0x4a16b2)['then'](function(_0x1af464){return _0x1af464;});}return null;};}function removeEntity(_0x2ef67c,_0x240beb){return function(_0x499a97){if(_0x499a97){return _0x499a97['destroy']()[_0xfbf8('0x23')](function(){var _0x787f48=_0x499a97['get']({'plain':!![]});var _0x5c7e54=_0xfbf8('0x24');return db[_0xfbf8('0x25')][_0xfbf8('0x26')]({'where':{'type':_0x5c7e54,'resourceId':_0x787f48['id']}})[_0xfbf8('0x23')](function(){return _0x499a97;});})[_0xfbf8('0x23')](function(){_0x2ef67c[_0xfbf8('0x1b')](0xcc)[_0xfbf8('0x27')]();});}};}function handleEntityNotFound(_0x53b44c,_0x3f1cb2){return function(_0x214053){if(!_0x214053){_0x53b44c[_0xfbf8('0x28')](0x194);}return _0x214053;};}function handleError(_0x314e93,_0x59045a){_0x59045a=_0x59045a||0x1f4;return function(_0xe747ca){logger[_0xfbf8('0x29')](_0xe747ca['stack']);if(_0xe747ca[_0xfbf8('0x2a')]){delete _0xe747ca[_0xfbf8('0x2a')];}_0x314e93[_0xfbf8('0x1b')](_0x59045a)[_0xfbf8('0x2b')](_0xe747ca);};}exports[_0xfbf8('0x2c')]=function(_0x5aa9ad,_0x44ef33){var _0x532f2b={},_0x3544d9={},_0x574717={'count':0x0,'rows':[]};var _0x1653d1=_[_0xfbf8('0x2d')](db[_0xfbf8('0x2e')][_0xfbf8('0x2f')],function(_0x56ac28){return{'name':_0x56ac28['fieldName'],'type':_0x56ac28['type']['key']};});_0x3544d9[_0xfbf8('0x30')]=_[_0xfbf8('0x2d')](_0x1653d1,_0xfbf8('0x2a'));_0x3544d9[_0xfbf8('0x31')]=_[_0xfbf8('0x32')](_0x5aa9ad[_0xfbf8('0x31')]);_0x3544d9[_0xfbf8('0x33')]=_[_0xfbf8('0x34')](_0x3544d9['model'],_0x3544d9['query']);_0x532f2b[_0xfbf8('0x35')]=_[_0xfbf8('0x34')](_0x3544d9[_0xfbf8('0x30')],qs[_0xfbf8('0x36')](_0x5aa9ad['query'][_0xfbf8('0x36')]));_0x532f2b[_0xfbf8('0x35')]=_0x532f2b[_0xfbf8('0x35')][_0xfbf8('0x37')]?_0x532f2b['attributes']:_0x3544d9['model'];if(!_0x5aa9ad[_0xfbf8('0x31')][_0xfbf8('0x38')](_0xfbf8('0x39'))){_0x532f2b['limit']=qs[_0xfbf8('0x1f')](_0x5aa9ad[_0xfbf8('0x31')][_0xfbf8('0x1f')]);_0x532f2b[_0xfbf8('0x1e')]=qs[_0xfbf8('0x1e')](_0x5aa9ad[_0xfbf8('0x31')][_0xfbf8('0x1e')]);}_0x532f2b['order']=qs[_0xfbf8('0x3a')](_0x5aa9ad[_0xfbf8('0x31')]['sort']);_0x532f2b['where']=qs['filters'](_[_0xfbf8('0x3b')](_0x5aa9ad[_0xfbf8('0x31')],_0x3544d9[_0xfbf8('0x33')]),_0x1653d1);if(_0x5aa9ad[_0xfbf8('0x31')][_0xfbf8('0x3c')]){_0x532f2b[_0xfbf8('0x3d')]=_['merge'](_0x532f2b[_0xfbf8('0x3d')],{'$or':_['map'](_0x1653d1,function(_0x1f4f0c){if(_0x1f4f0c[_0xfbf8('0x3e')]!=='VIRTUAL'){var _0x4d86cf={};_0x4d86cf[_0x1f4f0c[_0xfbf8('0x2a')]]={'$like':'%'+_0x5aa9ad[_0xfbf8('0x31')][_0xfbf8('0x3c')]+'%'};return _0x4d86cf;}})});}_0x532f2b=_[_0xfbf8('0x3f')]({},_0x532f2b,_0x5aa9ad[_0xfbf8('0x40')]);var _0x200dc5={'where':_0x532f2b['where']};return db['AnalyticDefaultReport'][_0xfbf8('0x1d')](_0x200dc5)['then'](function(_0xb2091a){_0x574717[_0xfbf8('0x1d')]=_0xb2091a;if(_0x5aa9ad['query'][_0xfbf8('0x41')]){_0x532f2b[_0xfbf8('0x42')]=[{'all':!![]}];}return db[_0xfbf8('0x2e')][_0xfbf8('0x43')](_0x532f2b);})[_0xfbf8('0x23')](function(_0xaea4eb){_0x574717[_0xfbf8('0x44')]=_0xaea4eb;return _0x574717;})[_0xfbf8('0x23')](respondWithFilteredResult(_0x44ef33,_0x532f2b))[_0xfbf8('0x45')](handleError(_0x44ef33,null));};exports[_0xfbf8('0x46')]=function(_0x579490,_0x368d5b){var _0x432da6={'raw':!![],'where':{'id':_0x579490[_0xfbf8('0x47')]['id']}},_0x152852={};_0x152852[_0xfbf8('0x30')]=_[_0xfbf8('0x32')](db[_0xfbf8('0x2e')][_0xfbf8('0x2f')]);_0x152852[_0xfbf8('0x31')]=_['keys'](_0x579490[_0xfbf8('0x31')]);_0x152852['filters']=_['intersection'](_0x152852[_0xfbf8('0x30')],_0x152852[_0xfbf8('0x31')]);_0x432da6[_0xfbf8('0x35')]=_['intersection'](_0x152852[_0xfbf8('0x30')],qs['fields'](_0x579490[_0xfbf8('0x31')][_0xfbf8('0x36')]));_0x432da6[_0xfbf8('0x35')]=_0x432da6[_0xfbf8('0x35')][_0xfbf8('0x37')]?_0x432da6['attributes']:_0x152852[_0xfbf8('0x30')];if(_0x579490[_0xfbf8('0x31')]['includeAll']){_0x432da6[_0xfbf8('0x42')]=[{'all':!![]}];}_0x432da6=_[_0xfbf8('0x3f')]({},_0x432da6,_0x579490[_0xfbf8('0x40')]);return db[_0xfbf8('0x2e')]['find'](_0x432da6)[_0xfbf8('0x23')](handleEntityNotFound(_0x368d5b,null))[_0xfbf8('0x23')](respondWithResult(_0x368d5b,null))['catch'](handleError(_0x368d5b,null));};exports[_0xfbf8('0x48')]=function(_0x3bf793,_0x57a930){return db[_0xfbf8('0x2e')][_0xfbf8('0x48')](_0x3bf793['body'],{})[_0xfbf8('0x23')](function(_0x3b0b97){var _0x21239b=_0x3bf793['user']['get']({'plain':!![]});if(!_0x21239b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21239b[_0xfbf8('0x49')]===_0xfbf8('0x4a')){var _0x4a4ee6=_0x3b0b97[_0xfbf8('0x4b')]({'plain':!![]});var _0x45abf3=_0xfbf8('0x4c');return db[_0xfbf8('0x4d')][_0xfbf8('0x4e')]({'where':{'name':_0x45abf3,'userProfileId':_0x21239b[_0xfbf8('0x4f')]},'raw':!![]})['then'](function(_0xfcbfe3){if(_0xfcbfe3&&_0xfcbfe3[_0xfbf8('0x50')]===0x0){return db['UserProfileResource'][_0xfbf8('0x48')]({'name':_0x4a4ee6['name'],'resourceId':_0x4a4ee6['id'],'type':_0xfbf8('0x24'),'sectionId':_0xfcbfe3['id']},{})[_0xfbf8('0x23')](function(){return _0x3b0b97;});}else{return _0x3b0b97;}})[_0xfbf8('0x45')](function(_0x57cee1){logger[_0xfbf8('0x29')](_0xfbf8('0x51'),_0x57cee1);throw _0x57cee1;});}return _0x3b0b97;})[_0xfbf8('0x23')](respondWithResult(_0x57a930,0xc9))[_0xfbf8('0x45')](handleError(_0x57a930,null));};exports[_0xfbf8('0x22')]=function(_0x56e079,_0x1e1e3e){if(_0x56e079[_0xfbf8('0x52')]['id']){delete _0x56e079['body']['id'];}return db[_0xfbf8('0x2e')]['find']({'where':{'id':_0x56e079[_0xfbf8('0x47')]['id']}})[_0xfbf8('0x23')](handleEntityNotFound(_0x1e1e3e,null))[_0xfbf8('0x23')](saveUpdates(_0x56e079['body'],null))[_0xfbf8('0x23')](respondWithResult(_0x1e1e3e,null))['catch'](handleError(_0x1e1e3e,null));};exports[_0xfbf8('0x26')]=function(_0x5bb6fb,_0x30de3a){return db[_0xfbf8('0x2e')][_0xfbf8('0x4e')]({'where':{'id':_0x5bb6fb[_0xfbf8('0x47')]['id']}})[_0xfbf8('0x23')](handleEntityNotFound(_0x30de3a,null))[_0xfbf8('0x23')](removeEntity(_0x30de3a,null))[_0xfbf8('0x45')](handleError(_0x30de3a,null));};exports[_0xfbf8('0x53')]=function(_0x5bd0c8,_0x58f2b0){var _0x1753d8=0xa;var _0x115507=[_0xfbf8('0x54'),'left_join',_0xfbf8('0x55'),'cross_join'];var _0x3ff7f5={'SUM':_0xfbf8('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xfbf8('0x57'),'MAX':_0xfbf8('0x58'),'MIN':'MIN(%s)','AVG':_0xfbf8('0x59'),'GROUP_CONCAT':_0xfbf8('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xfbf8('0x5b')};var _0x2aa333={'SEC_TO_TIME':_0xfbf8('0x5c'),'DATE':_0xfbf8('0x5d'),'HOUR':_0xfbf8('0x5e'),'ROUND':_0xfbf8('0x5f'),'UNIX_TIMESTAMP':_0xfbf8('0x60')};var _0x1236c3=function(_0x1cf83c){return!_['includes']([_0xfbf8('0x61'),_0xfbf8('0x62'),_0xfbf8('0x63'),_0xfbf8('0x64')],_0x1cf83c);};var _0x3ec0db=function(_0x4f9f55){if(!_0x4f9f55||!_0x4f9f55[_0xfbf8('0x65')][_0xfbf8('0x37')]){return'';}for(var _0x317bee='(',_0x46585b=0x0;_0x46585b<_0x4f9f55['rules'][_0xfbf8('0x37')];_0x46585b+=0x1){_0x46585b>0x0&&(_0x317bee+='\x20'+_0x4f9f55[_0xfbf8('0x66')]+'\x20');_0x317bee+=_0x4f9f55[_0xfbf8('0x65')][_0x46585b][_0xfbf8('0x67')]?_0x3ec0db(_0x4f9f55[_0xfbf8('0x65')][_0x46585b]['group']):_0x4f9f55['rules'][_0x46585b]['field']+'\x20'+_0x4f9f55[_0xfbf8('0x65')][_0x46585b][_0xfbf8('0x68')]+(_0x1236c3(_0x4f9f55[_0xfbf8('0x65')][_0x46585b][_0xfbf8('0x68')])?'\x20'+_0x4f9f55[_0xfbf8('0x65')][_0x46585b][_0xfbf8('0x69')]:'');}return _0x317bee+')';};var _0x5470ea={'where':{'id':_0x5bd0c8[_0xfbf8('0x47')]['id']}},_0x685c5b,_0x48d0fa,_0x1d57d5,_0x46fdce,_0x5aed57;_0x5470ea=_[_0xfbf8('0x3f')]({},_0x5470ea,_0x5bd0c8[_0xfbf8('0x40')]);return db[_0xfbf8('0x2e')][_0xfbf8('0x4e')](_0x5470ea)[_0xfbf8('0x23')](function(_0x215ae3){if(_0x215ae3){_0x685c5b=_0x215ae3;return _0x215ae3['getFields']();}return null;})['then'](function(_0x1334f5){if(_0x1334f5){if(!_0x1334f5[_0xfbf8('0x37')]){throw new db[(_0xfbf8('0x6a'))][(_0xfbf8('0x6b'))](_0xfbf8('0x6c'),0x193);}_0x48d0fa=_0x1334f5;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xfbf8('0x23')](function(_0x1d2d87){if(_0x1d2d87){_0x1d57d5=_[_0xfbf8('0x6d')](_0x1d2d87,'id');var _0x535b81;var _0x14fc63=squel[_0xfbf8('0x6e')]();_0x14fc63[_0xfbf8('0x6f')](_0x685c5b[_0xfbf8('0x70')]);for(var _0x1233e8=0x0;_0x1233e8<_0x48d0fa[_0xfbf8('0x37')];_0x1233e8+=0x1){_0x535b81=_0x48d0fa[_0x1233e8][_0xfbf8('0x71')]?_0x1d57d5[_0x48d0fa[_0x1233e8][_0xfbf8('0x71')]][_0xfbf8('0x72')]:_0x48d0fa[_0x1233e8]['field'];_0x535b81=_0x48d0fa[_0x1233e8]['function']?_[_0xfbf8('0x73')](_0x3ff7f5[_0x48d0fa[_0x1233e8][_0xfbf8('0x74')]],'%s',_0x535b81):_0x535b81;_0x535b81=_0x48d0fa[_0x1233e8][_0xfbf8('0x75')]?_[_0xfbf8('0x73')](_0x2aa333[_0x48d0fa[_0x1233e8][_0xfbf8('0x75')]],'%s',_0x535b81):_0x535b81;if(_0x48d0fa[_0x1233e8][_0xfbf8('0x76')]){_0x14fc63[_0xfbf8('0x67')](_0x535b81);}_0x48d0fa[_0x1233e8][_0xfbf8('0x77')]&&_0x14fc63[_0xfbf8('0x78')](_0x535b81,_0x48d0fa[_0x1233e8]['orderBy']===_0xfbf8('0x79')?![]:!![]);_0x14fc63['field'](_0x535b81,_0x48d0fa[_0x1233e8]['alias']||_0x535b81);}if(_0x685c5b[_0xfbf8('0x7a')]){_0x685c5b[_0xfbf8('0x7a')]=JSON['parse'](_0x685c5b['joins']);for(var _0x4b0bf5=0x0;_0x4b0bf5<_0x685c5b[_0xfbf8('0x7a')][_0xfbf8('0x37')];_0x4b0bf5+=0x1){if(_0x685c5b[_0xfbf8('0x7a')][_0x4b0bf5][_0xfbf8('0x3e')]&&_[_0xfbf8('0x7b')](_0x115507,_0x685c5b[_0xfbf8('0x7a')][_0x4b0bf5][_0xfbf8('0x3e')])&&_0x685c5b['joins'][_0x4b0bf5][_0xfbf8('0x7c')]&&_0x685c5b[_0xfbf8('0x7a')][_0x4b0bf5][_0xfbf8('0x7d')]&&_0x685c5b['joins'][_0x4b0bf5]['foreignKey']){_0x14fc63[_0x685c5b['joins'][_0x4b0bf5]['type']](_0x685c5b[_0xfbf8('0x7a')][_0x4b0bf5][_0xfbf8('0x7d')],null,util[_0xfbf8('0x75')](_0xfbf8('0x7e'),_0x685c5b['table'],_0x685c5b[_0xfbf8('0x7a')][_0x4b0bf5][_0xfbf8('0x7c')],_0x685c5b['joins'][_0x4b0bf5][_0xfbf8('0x7d')],_0x685c5b[_0xfbf8('0x7a')][_0x4b0bf5][_0xfbf8('0x7f')]));}}}if(_0x685c5b['conditions']){_0x685c5b[_0xfbf8('0x80')]=JSON[_0xfbf8('0x81')](_0x685c5b[_0xfbf8('0x80')]);_0x14fc63[_0xfbf8('0x3d')](_0x3ec0db(_0x685c5b[_0xfbf8('0x80')][_0xfbf8('0x67')]));}_0x5aed57=_0x14fc63[_0xfbf8('0x82')]();_0x14fc63[_0xfbf8('0x1f')](_0x1753d8);_0x14fc63['offset'](0x0);logger[_0xfbf8('0x83')](_0xfbf8('0x84'),_0x14fc63['toString']());return db[_0xfbf8('0x85')][_0xfbf8('0x31')](_0x14fc63[_0xfbf8('0x86')](),{'type':db[_0xfbf8('0x85')][_0xfbf8('0x87')][_0xfbf8('0x88')]});}})[_0xfbf8('0x23')](respondWithResult(_0x58f2b0,null))[_0xfbf8('0x45')](handleError(_0x58f2b0,null));};function runReport(_0x5dad78,_0x284579,_0x173118){var _0x25b3d8=_0x284579[_0xfbf8('0x2a')];var _0xf3aa95=0xa;var _0x26d0d0=[_0xfbf8('0x54'),_0xfbf8('0x89'),_0xfbf8('0x55'),_0xfbf8('0x8a')];var _0x5bb72f={'SUM':'SUM(%s)','COUNT':_0xfbf8('0x8b'),'COUNT DISTINCT':_0xfbf8('0x57'),'MAX':_0xfbf8('0x58'),'MIN':_0xfbf8('0x8c'),'AVG':_0xfbf8('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xfbf8('0x8d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xc7b9b8={'SEC_TO_TIME':_0xfbf8('0x5c'),'DATE':'DATE(%s)','HOUR':_0xfbf8('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xfbf8('0x60')};var _0x767563=function(_0x1a2ee2){return!_[_0xfbf8('0x7b')]([_0xfbf8('0x61'),'IS\x20NOT\x20NULL',_0xfbf8('0x63'),_0xfbf8('0x64')],_0x1a2ee2);};var _0x4c01d7=function(_0x1bc5c4){if(!_0x1bc5c4||!_0x1bc5c4[_0xfbf8('0x65')][_0xfbf8('0x37')]){return'';}for(var _0x446146='(',_0x40e7f4=0x0;_0x40e7f4<_0x1bc5c4[_0xfbf8('0x65')][_0xfbf8('0x37')];_0x40e7f4+=0x1){_0x40e7f4>0x0&&(_0x446146+='\x20'+_0x1bc5c4[_0xfbf8('0x66')]+'\x20');_0x446146+=_0x1bc5c4['rules'][_0x40e7f4][_0xfbf8('0x67')]?_0x4c01d7(_0x1bc5c4['rules'][_0x40e7f4][_0xfbf8('0x67')]):_0x1bc5c4[_0xfbf8('0x65')][_0x40e7f4][_0xfbf8('0x8e')]+'\x20'+_0x1bc5c4['rules'][_0x40e7f4]['condition']+(_0x767563(_0x1bc5c4[_0xfbf8('0x65')][_0x40e7f4][_0xfbf8('0x68')])?'\x20'+_0x1bc5c4[_0xfbf8('0x65')][_0x40e7f4][_0xfbf8('0x69')]:'');}return _0x446146+')';};var _0xca66fd={'where':{'id':_0x5dad78['id']}},_0x3486b2,_0x63a69,_0x500cc6,_0x3ee4bd,_0xad4c12;_0xca66fd=_['merge']({},_0xca66fd,_0x173118);return db[_0xfbf8('0x2e')][_0xfbf8('0x4e')](_0xca66fd)[_0xfbf8('0x23')](function(_0x3cf7a1){if(_0x3cf7a1){_0x3486b2=_0x3cf7a1;return _0x3cf7a1[_0xfbf8('0x8f')]();}return null;})[_0xfbf8('0x23')](function(_0x29fb49){if(_0x29fb49){if(!_0x29fb49['length']){throw new db[(_0xfbf8('0x6a'))][(_0xfbf8('0x6b'))](_0xfbf8('0x6c'),0x193);}_0x63a69=_0x29fb49;return db[_0xfbf8('0x90')][_0xfbf8('0x43')]({'raw':!![]});}return null;})[_0xfbf8('0x23')](function(_0x27ce98){if(_0x27ce98){_0x500cc6=_[_0xfbf8('0x6d')](_0x27ce98,'id');var _0x39b94c;var _0x3caf14=squel[_0xfbf8('0x6e')]();_0x3caf14['from'](_0x3486b2[_0xfbf8('0x70')]);for(var _0x4e363e=0x0;_0x4e363e<_0x63a69['length'];_0x4e363e+=0x1){_0x39b94c=_0x63a69[_0x4e363e]['MetricId']?_0x500cc6[_0x63a69[_0x4e363e][_0xfbf8('0x71')]]['metric']:_0x63a69[_0x4e363e][_0xfbf8('0x8e')];_0x39b94c=_0x63a69[_0x4e363e][_0xfbf8('0x74')]?_[_0xfbf8('0x73')](_0x5bb72f[_0x63a69[_0x4e363e][_0xfbf8('0x74')]],'%s',_0x39b94c):_0x39b94c;_0x39b94c=_0x63a69[_0x4e363e]['format']?_[_0xfbf8('0x73')](_0xc7b9b8[_0x63a69[_0x4e363e][_0xfbf8('0x75')]],'%s',_0x39b94c):_0x39b94c;if(_0x63a69[_0x4e363e][_0xfbf8('0x76')]){_0x3caf14['group'](_0x39b94c);}_0x63a69[_0x4e363e]['orderBy']&&_0x3caf14[_0xfbf8('0x78')](_0x39b94c,_0x63a69[_0x4e363e][_0xfbf8('0x77')]===_0xfbf8('0x79')?![]:!![]);_0x3caf14[_0xfbf8('0x8e')](_0x39b94c,_0x63a69[_0x4e363e]['alias']||_0x39b94c);}if(_0x3486b2[_0xfbf8('0x7a')]){_0x3486b2[_0xfbf8('0x7a')]=JSON[_0xfbf8('0x81')](_0x3486b2[_0xfbf8('0x7a')]);for(var _0x350e67=0x0;_0x350e67<_0x3486b2[_0xfbf8('0x7a')][_0xfbf8('0x37')];_0x350e67+=0x1){if(_0x3486b2[_0xfbf8('0x7a')][_0x350e67][_0xfbf8('0x3e')]&&_[_0xfbf8('0x7b')](_0x26d0d0,_0x3486b2[_0xfbf8('0x7a')][_0x350e67][_0xfbf8('0x3e')])&&_0x3486b2[_0xfbf8('0x7a')][_0x350e67][_0xfbf8('0x7c')]&&_0x3486b2[_0xfbf8('0x7a')][_0x350e67]['foreignTable']&&_0x3486b2[_0xfbf8('0x7a')][_0x350e67]['foreignKey']){_0x3caf14[_0x3486b2['joins'][_0x350e67][_0xfbf8('0x3e')]](_0x3486b2[_0xfbf8('0x7a')][_0x350e67]['foreignTable'],null,util[_0xfbf8('0x75')]('%s.%s\x20=\x20%s.%s',_0x3486b2[_0xfbf8('0x70')],_0x3486b2['joins'][_0x350e67][_0xfbf8('0x7c')],_0x3486b2[_0xfbf8('0x7a')][_0x350e67]['foreignTable'],_0x3486b2[_0xfbf8('0x7a')][_0x350e67][_0xfbf8('0x7f')]));}}}if(_0x3486b2[_0xfbf8('0x80')]){_0x3486b2['conditions']=JSON['parse'](_0x3486b2[_0xfbf8('0x80')]);_0x3caf14[_0xfbf8('0x3d')](_0x4c01d7(_0x3486b2[_0xfbf8('0x80')]['group']));}_0xad4c12=_0x3caf14[_0xfbf8('0x82')]();_0x3caf14[_0xfbf8('0x1f')](_0xf3aa95);_0x3caf14[_0xfbf8('0x1e')](0x0);logger[_0xfbf8('0x83')]('Limited\x20Query:',_0x3caf14[_0xfbf8('0x86')]());return db[_0xfbf8('0x85')]['query'](_0x3caf14[_0xfbf8('0x86')](),{'type':db[_0xfbf8('0x85')][_0xfbf8('0x87')]['SELECT']});}})[_0xfbf8('0x23')](function(_0x182b72){if(!_0x182b72['length']){throw new db['Sequelize'][(_0xfbf8('0x6b'))](_0xfbf8('0x91'),0xcc);}if(_0x284579['output']===_0xfbf8('0x92')){return null;}var _0xdcf7cc=_[_0xfbf8('0x3f')](_0x284579,{'name':_0x284579[_0xfbf8('0x93')]||_0x284579[_0xfbf8('0x2a')]||_0x3486b2[_0xfbf8('0x2a')],'basename':_0x25b3d8,'savename':util['format'](_0xfbf8('0x94'),_0x284579[_0xfbf8('0x2a')]||_0x3486b2['name'],require(_0xfbf8('0x95'))['generate'](0x4),_0x284579[_0xfbf8('0x96')]||'csv'),'reportId':_0x3486b2['id'],'reportType':'default'});return db[_0xfbf8('0x97')]['create'](_0xdcf7cc,{'raw':!![]});})[_0xfbf8('0x23')](function(_0x58de95){if(_0x3486b2[_0xfbf8('0x70')]==='cdr'){_0xad4c12[_0xfbf8('0x3d')](_0x3486b2['table']+_0xfbf8('0x98'),_0x284579[_0xfbf8('0x99')],_0x284579[_0xfbf8('0x9a')]);}else{_0xad4c12[_0xfbf8('0x3d')](_0x3486b2['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x284579[_0xfbf8('0x99')],_0x284579[_0xfbf8('0x9a')]);}if(_0x58de95){logger[_0xfbf8('0x9b')]('Run\x20Query:',_0xad4c12[_0xfbf8('0x86')]());require('child_process')[_0xfbf8('0x9c')](path[_0xfbf8('0x54')](__dirname,_0xfbf8('0x9d'),_0x58de95[_0xfbf8('0x96')]),[_0x58de95['id'],_0xad4c12[_0xfbf8('0x86')](),path[_0xfbf8('0x54')](__dirname,_0xfbf8('0x9e'),_0x58de95[_0xfbf8('0x9f')]),_0x25b3d8]);return _0x58de95;}else{var _0x19c8ef=squel[_0xfbf8('0x6e')]();_0x19c8ef[_0xfbf8('0x6f')]('('+_0xad4c12[_0xfbf8('0x86')]()+')',_0xfbf8('0xa0'));_0x19c8ef[_0xfbf8('0x8e')](_0xfbf8('0xa1'),_0xfbf8('0x1d'));_0xad4c12['limit'](_0x284579['limit']||_0xf3aa95);_0xad4c12[_0xfbf8('0x1e')](_0x284579[_0xfbf8('0x1e')]||0x0);return dbH[_0xfbf8('0x85')][_0xfbf8('0x31')](_0x19c8ef[_0xfbf8('0x86')](),{'type':dbH[_0xfbf8('0x85')][_0xfbf8('0x87')]['SELECT']})['then'](function(_0x2431a7){if(!_0x2431a7[_0xfbf8('0x37')]){_0x3ee4bd=0x0;}else{_0x3ee4bd=_0x2431a7[0x0][_0xfbf8('0x1d')]||0x0;}return dbH[_0xfbf8('0x85')][_0xfbf8('0x31')](_0xad4c12['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xfbf8('0x88')]});})['then'](function(_0x16f760){return{'rows':_0x16f760||[],'count':_0x3ee4bd};});}});}exports[_0xfbf8('0xa2')]=function(_0x6ec75,_0x48551d){return runReport(_0x6ec75['params'],_0x6ec75[_0xfbf8('0x31')],_0x6ec75['options'])[_0xfbf8('0x23')](respondWithResult(_0x48551d,null))[_0xfbf8('0x45')](handleError(_0x48551d,null));};exports['runReport']=runReport;exports['query']=function(_0x49a498,_0x3f8878){var _0x469dce=0xa;var _0x44e0f1=['join','left_join',_0xfbf8('0x55'),_0xfbf8('0x8a')];var _0x1b4cf3={'SUM':_0xfbf8('0x56'),'COUNT':_0xfbf8('0x8b'),'COUNT DISTINCT':_0xfbf8('0x57'),'MAX':_0xfbf8('0x58'),'MIN':_0xfbf8('0x8c'),'AVG':_0xfbf8('0x59'),'GROUP_CONCAT':_0xfbf8('0x5a'),'GROUP_CONCAT ASC':_0xfbf8('0x8d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2f8f4f={'SEC_TO_TIME':_0xfbf8('0x5c'),'DATE':_0xfbf8('0x5d'),'HOUR':_0xfbf8('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xfbf8('0x60')};var _0x3066ab=function(_0x5c4a69){return!_[_0xfbf8('0x7b')]([_0xfbf8('0x61'),_0xfbf8('0x62'),_0xfbf8('0x63'),_0xfbf8('0x64')],_0x5c4a69);};var _0x3c63b4=function(_0x50d731){if(!_0x50d731||!_0x50d731[_0xfbf8('0x65')][_0xfbf8('0x37')]){return'';}for(var _0x3d19f8='(',_0x4373a7=0x0;_0x4373a7<_0x50d731[_0xfbf8('0x65')][_0xfbf8('0x37')];_0x4373a7+=0x1){_0x4373a7>0x0&&(_0x3d19f8+='\x20'+_0x50d731[_0xfbf8('0x66')]+'\x20');_0x3d19f8+=_0x50d731[_0xfbf8('0x65')][_0x4373a7][_0xfbf8('0x67')]?_0x3c63b4(_0x50d731[_0xfbf8('0x65')][_0x4373a7][_0xfbf8('0x67')]):_0x50d731['rules'][_0x4373a7][_0xfbf8('0x8e')]+'\x20'+_0x50d731[_0xfbf8('0x65')][_0x4373a7][_0xfbf8('0x68')]+(_0x3066ab(_0x50d731[_0xfbf8('0x65')][_0x4373a7]['condition'])?'\x20'+_0x50d731['rules'][_0x4373a7][_0xfbf8('0x69')]:'');}return _0x3d19f8+')';};var _0x7f472c={'where':{'id':_0x49a498[_0xfbf8('0x47')]['id']}},_0x4f5d00,_0x2b6a9b,_0x2f3eca,_0x4cc335,_0x463e0c;_0x7f472c=_[_0xfbf8('0x3f')]({},_0x7f472c,_0x49a498[_0xfbf8('0x40')]);return db[_0xfbf8('0x2e')][_0xfbf8('0x4e')](_0x7f472c)[_0xfbf8('0x23')](function(_0x55ce77){if(_0x55ce77){_0x4f5d00=_0x55ce77;return _0x55ce77[_0xfbf8('0x8f')]();}return null;})[_0xfbf8('0x23')](function(_0x1d79ba){if(_0x1d79ba){if(!_0x1d79ba['length']){throw new db['Sequelize'][(_0xfbf8('0x6b'))](_0xfbf8('0x6c'),0x193);}_0x2b6a9b=_0x1d79ba;return db['AnalyticMetric'][_0xfbf8('0x43')]({'raw':!![]});}return null;})[_0xfbf8('0x23')](function(_0x50bde8){if(_0x50bde8){_0x2f3eca=_[_0xfbf8('0x6d')](_0x50bde8,'id');var _0x250495;var _0x54c8ba=squel[_0xfbf8('0x6e')]();_0x54c8ba[_0xfbf8('0x6f')](_0x4f5d00['table']);for(var _0x1971d6=0x0;_0x1971d6<_0x2b6a9b[_0xfbf8('0x37')];_0x1971d6+=0x1){_0x250495=_0x2b6a9b[_0x1971d6]['MetricId']?_0x2f3eca[_0x2b6a9b[_0x1971d6]['MetricId']]['metric']:_0x2b6a9b[_0x1971d6][_0xfbf8('0x8e')];_0x250495=_0x2b6a9b[_0x1971d6][_0xfbf8('0x74')]?_[_0xfbf8('0x73')](_0x1b4cf3[_0x2b6a9b[_0x1971d6][_0xfbf8('0x74')]],'%s',_0x250495):_0x250495;_0x250495=_0x2b6a9b[_0x1971d6][_0xfbf8('0x75')]?_['replace'](_0x2f8f4f[_0x2b6a9b[_0x1971d6]['format']],'%s',_0x250495):_0x250495;if(_0x2b6a9b[_0x1971d6]['groupBy']){_0x54c8ba[_0xfbf8('0x67')](_0x250495);}_0x2b6a9b[_0x1971d6]['orderBy']&&_0x54c8ba[_0xfbf8('0x78')](_0x250495,_0x2b6a9b[_0x1971d6][_0xfbf8('0x77')]==='DESC'?![]:!![]);_0x54c8ba[_0xfbf8('0x8e')](_0x250495,_0x2b6a9b[_0x1971d6][_0xfbf8('0xa3')]||_0x250495);}if(_0x4f5d00['joins']){_0x4f5d00[_0xfbf8('0x7a')]=JSON[_0xfbf8('0x81')](_0x4f5d00['joins']);for(var _0x5807de=0x0;_0x5807de<_0x4f5d00[_0xfbf8('0x7a')][_0xfbf8('0x37')];_0x5807de+=0x1){if(_0x4f5d00['joins'][_0x5807de][_0xfbf8('0x3e')]&&_[_0xfbf8('0x7b')](_0x44e0f1,_0x4f5d00[_0xfbf8('0x7a')][_0x5807de][_0xfbf8('0x3e')])&&_0x4f5d00[_0xfbf8('0x7a')][_0x5807de][_0xfbf8('0x7c')]&&_0x4f5d00[_0xfbf8('0x7a')][_0x5807de][_0xfbf8('0x7d')]&&_0x4f5d00['joins'][_0x5807de][_0xfbf8('0x7f')]){_0x54c8ba[_0x4f5d00['joins'][_0x5807de][_0xfbf8('0x3e')]](_0x4f5d00[_0xfbf8('0x7a')][_0x5807de][_0xfbf8('0x7d')],null,util[_0xfbf8('0x75')](_0xfbf8('0x7e'),_0x4f5d00['table'],_0x4f5d00[_0xfbf8('0x7a')][_0x5807de][_0xfbf8('0x7c')],_0x4f5d00['joins'][_0x5807de][_0xfbf8('0x7d')],_0x4f5d00[_0xfbf8('0x7a')][_0x5807de][_0xfbf8('0x7f')]));}}}if(_0x4f5d00[_0xfbf8('0x80')]){_0x4f5d00[_0xfbf8('0x80')]=JSON['parse'](_0x4f5d00[_0xfbf8('0x80')]);_0x54c8ba[_0xfbf8('0x3d')](_0x3c63b4(_0x4f5d00[_0xfbf8('0x80')]['group']));}_0x463e0c=_0x54c8ba['clone']();_0x54c8ba[_0xfbf8('0x1f')](_0x469dce);_0x54c8ba['offset'](0x0);logger[_0xfbf8('0x83')](_0xfbf8('0x84'),_0x54c8ba[_0xfbf8('0x86')]());return db[_0xfbf8('0x85')][_0xfbf8('0x31')](_0x54c8ba[_0xfbf8('0x86')](),{'type':db[_0xfbf8('0x85')][_0xfbf8('0x87')][_0xfbf8('0x88')]});}})[_0xfbf8('0x23')](function(){return{'sql':_0x463e0c[_0xfbf8('0x86')]()};})[_0xfbf8('0x23')](respondWithResult(_0x3f8878,null))[_0xfbf8('0x45')](handleError(_0x3f8878,null));}; \ No newline at end of file +var _0x44e6=['hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','include','findAll','rows','show','params','includeAll','catch','create','body','get','role','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','parse','joins','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','MAX(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','ValidationErrorItem','output','web','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','SUM(%s)','html-pdf','eml-format','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','DefaultReports','stack','name','send','AnalyticDefaultReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length'];(function(_0x204f90,_0x1af167){var _0x10794b=function(_0x1c66d4){while(--_0x1c66d4){_0x204f90['push'](_0x204f90['shift']());}};_0x10794b(++_0x1af167);}(_0x44e6,0x113));var _0x644e=function(_0x14daef,_0x5ad345){_0x14daef=_0x14daef-0x0;var _0x38d2aa=_0x44e6[_0x14daef];return _0x38d2aa;};'use strict';var pdf=require(_0x644e('0x0'));var emlformat=require(_0x644e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x644e('0x2'));var BPromise=require(_0x644e('0x3'));var Mustache=require(_0x644e('0x4'));var util=require(_0x644e('0x5'));var path=require(_0x644e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x644e('0x7'));var fs=require('fs');var _=require(_0x644e('0x8'));var squel=require(_0x644e('0x9'));var crypto=require(_0x644e('0xa'));var jsforce=require(_0x644e('0xb'));var deskjs=require(_0x644e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x644e('0xd'));var Papa=require(_0x644e('0xe'));var Redis=require('ioredis');var authService=require(_0x644e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x644e('0x10'));var hardwareService=require(_0x644e('0x11'));var logger=require(_0x644e('0x12'))('api');var utils=require(_0x644e('0x13'));var config=require('../../config/environment');var db=require(_0x644e('0x14'))['db'];var dbH=require(_0x644e('0x14'))['dbH'];function respondWithStatusCode(_0x27cb49,_0x2cea44){_0x2cea44=_0x2cea44||0xcc;return function(_0xfee823){if(_0xfee823){return _0x27cb49[_0x644e('0x15')](_0x2cea44);}return _0x27cb49[_0x644e('0x16')](_0x2cea44)[_0x644e('0x17')]();};}function respondWithResult(_0x272100,_0x5d19d8){_0x5d19d8=_0x5d19d8||0xc8;return function(_0x3d8682){if(_0x3d8682){return _0x272100[_0x644e('0x16')](_0x5d19d8)[_0x644e('0x18')](_0x3d8682);}};}function respondWithFilteredResult(_0x5dddda,_0x34bd92){return function(_0x291bbf){if(_0x291bbf){var _0x1c9aec=_0x291bbf[_0x644e('0x19')],_0x1dd54a=_0x34bd92[_0x644e('0x1a')],_0x3f79bb=_0x34bd92[_0x644e('0x1a')]+_0x34bd92[_0x644e('0x1b')],_0x1df3c1;if(_0x3f79bb>=_0x1c9aec){_0x3f79bb=_0x1c9aec;_0x1df3c1=0xc8;}else{_0x1df3c1=0xce;}_0x5dddda[_0x644e('0x16')](_0x1df3c1);return _0x5dddda[_0x644e('0x1c')](_0x644e('0x1d'),_0x1dd54a+'-'+_0x3f79bb+'/'+_0x1c9aec)[_0x644e('0x18')](_0x291bbf);}return null;};}function patchUpdates(_0x5e8618){return function(_0x39d2b1){try{jsonpatch[_0x644e('0x1e')](_0x39d2b1,_0x5e8618,!![]);}catch(_0x223f22){return BPromise[_0x644e('0x1f')](_0x223f22);}return _0x39d2b1[_0x644e('0x20')]();};}function saveUpdates(_0x435a2b,_0x1a6fa1){return function(_0x1121fe){if(_0x1121fe){return _0x1121fe['update'](_0x435a2b)[_0x644e('0x21')](function(_0x522023){return _0x522023;});}return null;};}function removeEntity(_0x5201ee,_0x23960c){return function(_0x3237a4){if(_0x3237a4){return _0x3237a4[_0x644e('0x22')]()['then'](function(){var _0xd4948b=_0x3237a4['get']({'plain':!![]});var _0x5656ce=_0x644e('0x23');return db['UserProfileResource'][_0x644e('0x22')]({'where':{'type':_0x5656ce,'resourceId':_0xd4948b['id']}})['then'](function(){return _0x3237a4;});})['then'](function(){_0x5201ee[_0x644e('0x16')](0xcc)[_0x644e('0x17')]();});}};}function handleEntityNotFound(_0x1b0f6b,_0x585af4){return function(_0x528254){if(!_0x528254){_0x1b0f6b[_0x644e('0x15')](0x194);}return _0x528254;};}function handleError(_0x478237,_0x28c748){_0x28c748=_0x28c748||0x1f4;return function(_0x3c0599){logger['error'](_0x3c0599[_0x644e('0x24')]);if(_0x3c0599[_0x644e('0x25')]){delete _0x3c0599[_0x644e('0x25')];}_0x478237[_0x644e('0x16')](_0x28c748)[_0x644e('0x26')](_0x3c0599);};}exports['index']=function(_0x59c3e3,_0x26af4f){var _0x555edf={},_0x510195={},_0x378a85={'count':0x0,'rows':[]};var _0xd9fd40=_['map'](db[_0x644e('0x27')][_0x644e('0x28')],function(_0x47d6c8){return{'name':_0x47d6c8[_0x644e('0x29')],'type':_0x47d6c8[_0x644e('0x2a')]['key']};});_0x510195[_0x644e('0x2b')]=_['map'](_0xd9fd40,_0x644e('0x25'));_0x510195['query']=_[_0x644e('0x2c')](_0x59c3e3[_0x644e('0x2d')]);_0x510195[_0x644e('0x2e')]=_['intersection'](_0x510195[_0x644e('0x2b')],_0x510195['query']);_0x555edf[_0x644e('0x2f')]=_[_0x644e('0x30')](_0x510195[_0x644e('0x2b')],qs[_0x644e('0x31')](_0x59c3e3[_0x644e('0x2d')][_0x644e('0x31')]));_0x555edf[_0x644e('0x2f')]=_0x555edf['attributes'][_0x644e('0x32')]?_0x555edf[_0x644e('0x2f')]:_0x510195[_0x644e('0x2b')];if(!_0x59c3e3['query'][_0x644e('0x33')](_0x644e('0x34'))){_0x555edf['limit']=qs['limit'](_0x59c3e3['query'][_0x644e('0x1b')]);_0x555edf['offset']=qs[_0x644e('0x1a')](_0x59c3e3[_0x644e('0x2d')][_0x644e('0x1a')]);}_0x555edf[_0x644e('0x35')]=qs[_0x644e('0x36')](_0x59c3e3[_0x644e('0x2d')][_0x644e('0x36')]);_0x555edf[_0x644e('0x37')]=qs[_0x644e('0x2e')](_[_0x644e('0x38')](_0x59c3e3[_0x644e('0x2d')],_0x510195['filters']),_0xd9fd40);if(_0x59c3e3['query']['filter']){_0x555edf['where']=_[_0x644e('0x39')](_0x555edf['where'],{'$or':_[_0x644e('0x3a')](_0xd9fd40,function(_0x1b00aa){if(_0x1b00aa[_0x644e('0x2a')]!=='VIRTUAL'){var _0x1a78ae={};_0x1a78ae[_0x1b00aa['name']]={'$like':'%'+_0x59c3e3['query'][_0x644e('0x3b')]+'%'};return _0x1a78ae;}})});}_0x555edf=_[_0x644e('0x39')]({},_0x555edf,_0x59c3e3[_0x644e('0x3c')]);var _0x13dcd2={'where':_0x555edf[_0x644e('0x37')]};return db['AnalyticDefaultReport'][_0x644e('0x19')](_0x13dcd2)[_0x644e('0x21')](function(_0x38414e){_0x378a85[_0x644e('0x19')]=_0x38414e;if(_0x59c3e3[_0x644e('0x2d')]['includeAll']){_0x555edf[_0x644e('0x3d')]=[{'all':!![]}];}return db[_0x644e('0x27')][_0x644e('0x3e')](_0x555edf);})[_0x644e('0x21')](function(_0x3c5324){_0x378a85[_0x644e('0x3f')]=_0x3c5324;return _0x378a85;})[_0x644e('0x21')](respondWithFilteredResult(_0x26af4f,_0x555edf))['catch'](handleError(_0x26af4f,null));};exports[_0x644e('0x40')]=function(_0x4f040b,_0x5adaa7){var _0x4319c2={'raw':!![],'where':{'id':_0x4f040b[_0x644e('0x41')]['id']}},_0xaa73fb={};_0xaa73fb[_0x644e('0x2b')]=_[_0x644e('0x2c')](db['AnalyticDefaultReport'][_0x644e('0x28')]);_0xaa73fb[_0x644e('0x2d')]=_['keys'](_0x4f040b[_0x644e('0x2d')]);_0xaa73fb[_0x644e('0x2e')]=_['intersection'](_0xaa73fb[_0x644e('0x2b')],_0xaa73fb['query']);_0x4319c2[_0x644e('0x2f')]=_[_0x644e('0x30')](_0xaa73fb[_0x644e('0x2b')],qs[_0x644e('0x31')](_0x4f040b[_0x644e('0x2d')]['fields']));_0x4319c2[_0x644e('0x2f')]=_0x4319c2[_0x644e('0x2f')][_0x644e('0x32')]?_0x4319c2[_0x644e('0x2f')]:_0xaa73fb[_0x644e('0x2b')];if(_0x4f040b[_0x644e('0x2d')][_0x644e('0x42')]){_0x4319c2['include']=[{'all':!![]}];}_0x4319c2=_[_0x644e('0x39')]({},_0x4319c2,_0x4f040b['options']);return db['AnalyticDefaultReport']['find'](_0x4319c2)[_0x644e('0x21')](handleEntityNotFound(_0x5adaa7,null))[_0x644e('0x21')](respondWithResult(_0x5adaa7,null))[_0x644e('0x43')](handleError(_0x5adaa7,null));};exports[_0x644e('0x44')]=function(_0x3e0e87,_0xa29fdc){return db[_0x644e('0x27')][_0x644e('0x44')](_0x3e0e87[_0x644e('0x45')],{})[_0x644e('0x21')](function(_0x1743bc){var _0x3af7e1=_0x3e0e87['user'][_0x644e('0x46')]({'plain':!![]});if(!_0x3af7e1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3af7e1[_0x644e('0x47')]===_0x644e('0x48')){var _0x19acdf=_0x1743bc[_0x644e('0x46')]({'plain':!![]});var _0x5a34c9=_0x644e('0x49');return db[_0x644e('0x4a')][_0x644e('0x4b')]({'where':{'name':_0x5a34c9,'userProfileId':_0x3af7e1[_0x644e('0x4c')]},'raw':!![]})[_0x644e('0x21')](function(_0x3fc1d6){if(_0x3fc1d6&&_0x3fc1d6[_0x644e('0x4d')]===0x0){return db['UserProfileResource'][_0x644e('0x44')]({'name':_0x19acdf[_0x644e('0x25')],'resourceId':_0x19acdf['id'],'type':'DefaultReports','sectionId':_0x3fc1d6['id']},{})['then'](function(){return _0x1743bc;});}else{return _0x1743bc;}})[_0x644e('0x43')](function(_0x1db0d8){logger[_0x644e('0x4e')](_0x644e('0x4f'),_0x1db0d8);throw _0x1db0d8;});}return _0x1743bc;})[_0x644e('0x21')](respondWithResult(_0xa29fdc,0xc9))[_0x644e('0x43')](handleError(_0xa29fdc,null));};exports[_0x644e('0x50')]=function(_0x15e872,_0x1e6fca){if(_0x15e872[_0x644e('0x45')]['id']){delete _0x15e872[_0x644e('0x45')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x15e872[_0x644e('0x41')]['id']}})[_0x644e('0x21')](handleEntityNotFound(_0x1e6fca,null))[_0x644e('0x21')](saveUpdates(_0x15e872[_0x644e('0x45')],null))[_0x644e('0x21')](respondWithResult(_0x1e6fca,null))[_0x644e('0x43')](handleError(_0x1e6fca,null));};exports[_0x644e('0x22')]=function(_0x54fd88,_0x77389d){return db[_0x644e('0x27')][_0x644e('0x4b')]({'where':{'id':_0x54fd88[_0x644e('0x41')]['id']}})[_0x644e('0x21')](handleEntityNotFound(_0x77389d,null))[_0x644e('0x21')](removeEntity(_0x77389d,null))[_0x644e('0x43')](handleError(_0x77389d,null));};exports['preview']=function(_0x378c7f,_0x186da2){var _0x5c8ad6=0xa;var _0x47a1b4=['join','left_join',_0x644e('0x51'),_0x644e('0x52')];var _0x1ecbc6={'SUM':'SUM(%s)','COUNT':_0x644e('0x53'),'COUNT DISTINCT':_0x644e('0x54'),'MAX':'MAX(%s)','MIN':_0x644e('0x55'),'AVG':_0x644e('0x56'),'GROUP_CONCAT':_0x644e('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x644e('0x58')};var _0x4ac088={'SEC_TO_TIME':_0x644e('0x59'),'DATE':'DATE(%s)','HOUR':_0x644e('0x5a'),'ROUND':_0x644e('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd7602a=function(_0x4ad34c){return!_[_0x644e('0x5c')]([_0x644e('0x5d'),_0x644e('0x5e'),_0x644e('0x5f'),_0x644e('0x60')],_0x4ad34c);};var _0x4990fa=function(_0x372690){if(!_0x372690||!_0x372690[_0x644e('0x61')][_0x644e('0x32')]){return'';}for(var _0x4859b9='(',_0x155df7=0x0;_0x155df7<_0x372690[_0x644e('0x61')][_0x644e('0x32')];_0x155df7+=0x1){_0x155df7>0x0&&(_0x4859b9+='\x20'+_0x372690[_0x644e('0x62')]+'\x20');_0x4859b9+=_0x372690[_0x644e('0x61')][_0x155df7][_0x644e('0x63')]?_0x4990fa(_0x372690['rules'][_0x155df7]['group']):_0x372690[_0x644e('0x61')][_0x155df7][_0x644e('0x64')]+'\x20'+_0x372690['rules'][_0x155df7][_0x644e('0x65')]+(_0xd7602a(_0x372690[_0x644e('0x61')][_0x155df7][_0x644e('0x65')])?'\x20'+_0x372690[_0x644e('0x61')][_0x155df7][_0x644e('0x66')]:'');}return _0x4859b9+')';};var _0x3a6914={'where':{'id':_0x378c7f[_0x644e('0x41')]['id']}},_0x3c4e06,_0x4e3e0e,_0x1ec446,_0x561f60,_0x33992e;_0x3a6914=_[_0x644e('0x39')]({},_0x3a6914,_0x378c7f['options']);return db['AnalyticDefaultReport'][_0x644e('0x4b')](_0x3a6914)['then'](function(_0x227477){if(_0x227477){_0x3c4e06=_0x227477;return _0x227477[_0x644e('0x67')]();}return null;})[_0x644e('0x21')](function(_0x57af50){if(_0x57af50){if(!_0x57af50['length']){throw new db[(_0x644e('0x68'))]['ValidationErrorItem'](_0x644e('0x69'),0x193);}_0x4e3e0e=_0x57af50;return db[_0x644e('0x6a')][_0x644e('0x3e')]({'raw':!![]});}return null;})[_0x644e('0x21')](function(_0x3fff26){if(_0x3fff26){_0x1ec446=_[_0x644e('0x6b')](_0x3fff26,'id');var _0x24ad7e;var _0x39133e=squel[_0x644e('0x6c')]();_0x39133e[_0x644e('0x6d')](_0x3c4e06[_0x644e('0x6e')]);for(var _0x1d7006=0x0;_0x1d7006<_0x4e3e0e['length'];_0x1d7006+=0x1){_0x24ad7e=_0x4e3e0e[_0x1d7006][_0x644e('0x6f')]?_0x1ec446[_0x4e3e0e[_0x1d7006]['MetricId']][_0x644e('0x70')]:_0x4e3e0e[_0x1d7006][_0x644e('0x64')];_0x24ad7e=_0x4e3e0e[_0x1d7006]['function']?_[_0x644e('0x71')](_0x1ecbc6[_0x4e3e0e[_0x1d7006][_0x644e('0x72')]],'%s',_0x24ad7e):_0x24ad7e;_0x24ad7e=_0x4e3e0e[_0x1d7006][_0x644e('0x73')]?_['replace'](_0x4ac088[_0x4e3e0e[_0x1d7006][_0x644e('0x73')]],'%s',_0x24ad7e):_0x24ad7e;if(_0x4e3e0e[_0x1d7006][_0x644e('0x74')]){_0x39133e['group'](_0x24ad7e);}_0x4e3e0e[_0x1d7006][_0x644e('0x75')]&&_0x39133e['order'](_0x24ad7e,_0x4e3e0e[_0x1d7006][_0x644e('0x75')]===_0x644e('0x76')?![]:!![]);_0x39133e['field'](_0x24ad7e,_0x4e3e0e[_0x1d7006][_0x644e('0x77')]||_0x24ad7e);}if(_0x3c4e06['joins']){_0x3c4e06['joins']=JSON[_0x644e('0x78')](_0x3c4e06[_0x644e('0x79')]);for(var _0x3a6a55=0x0;_0x3a6a55<_0x3c4e06[_0x644e('0x79')][_0x644e('0x32')];_0x3a6a55+=0x1){if(_0x3c4e06[_0x644e('0x79')][_0x3a6a55]['type']&&_[_0x644e('0x5c')](_0x47a1b4,_0x3c4e06[_0x644e('0x79')][_0x3a6a55]['type'])&&_0x3c4e06['joins'][_0x3a6a55][_0x644e('0x7a')]&&_0x3c4e06['joins'][_0x3a6a55][_0x644e('0x7b')]&&_0x3c4e06[_0x644e('0x79')][_0x3a6a55][_0x644e('0x7c')]){_0x39133e[_0x3c4e06[_0x644e('0x79')][_0x3a6a55][_0x644e('0x2a')]](_0x3c4e06[_0x644e('0x79')][_0x3a6a55][_0x644e('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3c4e06['table'],_0x3c4e06[_0x644e('0x79')][_0x3a6a55][_0x644e('0x7a')],_0x3c4e06['joins'][_0x3a6a55]['foreignTable'],_0x3c4e06[_0x644e('0x79')][_0x3a6a55][_0x644e('0x7c')]));}}}if(_0x3c4e06[_0x644e('0x7d')]){_0x3c4e06['conditions']=JSON['parse'](_0x3c4e06[_0x644e('0x7d')]);_0x39133e['where'](_0x4990fa(_0x3c4e06[_0x644e('0x7d')][_0x644e('0x63')]));}_0x33992e=_0x39133e[_0x644e('0x7e')]();_0x39133e[_0x644e('0x1b')](_0x5c8ad6);_0x39133e[_0x644e('0x1a')](0x0);logger[_0x644e('0x7f')](_0x644e('0x80'),_0x39133e[_0x644e('0x81')]());return db['sequelize']['query'](_0x39133e[_0x644e('0x81')](),{'type':db[_0x644e('0x82')][_0x644e('0x83')][_0x644e('0x84')]});}})['then'](respondWithResult(_0x186da2,null))[_0x644e('0x43')](handleError(_0x186da2,null));};function runReport(_0x2b0ee6,_0xbf8201,_0xc55e32){var _0x417018=_0xbf8201[_0x644e('0x25')];var _0x3eb4db=0xa;var _0x2447e5=[_0x644e('0x85'),_0x644e('0x86'),_0x644e('0x51'),'cross_join'];var _0x5aa37c={'SUM':'SUM(%s)','COUNT':_0x644e('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x644e('0x87'),'MIN':_0x644e('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x644e('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x644e('0x58')};var _0x4f9498={'SEC_TO_TIME':_0x644e('0x59'),'DATE':_0x644e('0x88'),'HOUR':_0x644e('0x5a'),'ROUND':_0x644e('0x5b'),'UNIX_TIMESTAMP':_0x644e('0x89')};var _0x3039a8=function(_0x43f0b7){return!_[_0x644e('0x5c')]([_0x644e('0x5d'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x43f0b7);};var _0x2f3b0e=function(_0x34ba73){if(!_0x34ba73||!_0x34ba73['rules'][_0x644e('0x32')]){return'';}for(var _0x5d20da='(',_0x2fdcf2=0x0;_0x2fdcf2<_0x34ba73[_0x644e('0x61')][_0x644e('0x32')];_0x2fdcf2+=0x1){_0x2fdcf2>0x0&&(_0x5d20da+='\x20'+_0x34ba73[_0x644e('0x62')]+'\x20');_0x5d20da+=_0x34ba73['rules'][_0x2fdcf2][_0x644e('0x63')]?_0x2f3b0e(_0x34ba73[_0x644e('0x61')][_0x2fdcf2][_0x644e('0x63')]):_0x34ba73[_0x644e('0x61')][_0x2fdcf2][_0x644e('0x64')]+'\x20'+_0x34ba73[_0x644e('0x61')][_0x2fdcf2][_0x644e('0x65')]+(_0x3039a8(_0x34ba73['rules'][_0x2fdcf2]['condition'])?'\x20'+_0x34ba73[_0x644e('0x61')][_0x2fdcf2][_0x644e('0x66')]:'');}return _0x5d20da+')';};var _0x24e369={'where':{'id':_0x2b0ee6['id']}},_0x6eb15b,_0x2b742c,_0x541014,_0xfdeff0,_0x4b872f;_0x24e369=_[_0x644e('0x39')]({},_0x24e369,_0xc55e32);return db[_0x644e('0x27')][_0x644e('0x4b')](_0x24e369)[_0x644e('0x21')](function(_0x81c948){if(_0x81c948){_0x6eb15b=_0x81c948;return _0x81c948[_0x644e('0x67')]();}return null;})[_0x644e('0x21')](function(_0x13b87f){if(_0x13b87f){if(!_0x13b87f[_0x644e('0x32')]){throw new db[(_0x644e('0x68'))][(_0x644e('0x8a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2b742c=_0x13b87f;return db[_0x644e('0x6a')][_0x644e('0x3e')]({'raw':!![]});}return null;})[_0x644e('0x21')](function(_0x1dd3f2){if(_0x1dd3f2){_0x541014=_[_0x644e('0x6b')](_0x1dd3f2,'id');var _0x2cb986;var _0x26d2d6=squel[_0x644e('0x6c')]();_0x26d2d6['from'](_0x6eb15b[_0x644e('0x6e')]);for(var _0x47a41c=0x0;_0x47a41c<_0x2b742c['length'];_0x47a41c+=0x1){_0x2cb986=_0x2b742c[_0x47a41c][_0x644e('0x6f')]?_0x541014[_0x2b742c[_0x47a41c][_0x644e('0x6f')]][_0x644e('0x70')]:_0x2b742c[_0x47a41c]['field'];_0x2cb986=_0x2b742c[_0x47a41c][_0x644e('0x72')]?_[_0x644e('0x71')](_0x5aa37c[_0x2b742c[_0x47a41c][_0x644e('0x72')]],'%s',_0x2cb986):_0x2cb986;_0x2cb986=_0x2b742c[_0x47a41c][_0x644e('0x73')]?_[_0x644e('0x71')](_0x4f9498[_0x2b742c[_0x47a41c][_0x644e('0x73')]],'%s',_0x2cb986):_0x2cb986;if(_0x2b742c[_0x47a41c][_0x644e('0x74')]){_0x26d2d6[_0x644e('0x63')](_0x2cb986);}_0x2b742c[_0x47a41c]['orderBy']&&_0x26d2d6['order'](_0x2cb986,_0x2b742c[_0x47a41c][_0x644e('0x75')]==='DESC'?![]:!![]);_0x26d2d6['field'](_0x2cb986,_0x2b742c[_0x47a41c]['alias']||_0x2cb986);}if(_0x6eb15b[_0x644e('0x79')]){_0x6eb15b[_0x644e('0x79')]=JSON[_0x644e('0x78')](_0x6eb15b[_0x644e('0x79')]);for(var _0x4cbbdd=0x0;_0x4cbbdd<_0x6eb15b[_0x644e('0x79')][_0x644e('0x32')];_0x4cbbdd+=0x1){if(_0x6eb15b[_0x644e('0x79')][_0x4cbbdd][_0x644e('0x2a')]&&_[_0x644e('0x5c')](_0x2447e5,_0x6eb15b['joins'][_0x4cbbdd][_0x644e('0x2a')])&&_0x6eb15b['joins'][_0x4cbbdd][_0x644e('0x7a')]&&_0x6eb15b[_0x644e('0x79')][_0x4cbbdd][_0x644e('0x7b')]&&_0x6eb15b[_0x644e('0x79')][_0x4cbbdd][_0x644e('0x7c')]){_0x26d2d6[_0x6eb15b['joins'][_0x4cbbdd][_0x644e('0x2a')]](_0x6eb15b[_0x644e('0x79')][_0x4cbbdd]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x6eb15b[_0x644e('0x6e')],_0x6eb15b[_0x644e('0x79')][_0x4cbbdd][_0x644e('0x7a')],_0x6eb15b['joins'][_0x4cbbdd]['foreignTable'],_0x6eb15b['joins'][_0x4cbbdd]['foreignKey']));}}}if(_0x6eb15b[_0x644e('0x7d')]){_0x6eb15b[_0x644e('0x7d')]=JSON[_0x644e('0x78')](_0x6eb15b['conditions']);_0x26d2d6[_0x644e('0x37')](_0x2f3b0e(_0x6eb15b['conditions'][_0x644e('0x63')]));}_0x4b872f=_0x26d2d6['clone']();_0x26d2d6['limit'](_0x3eb4db);_0x26d2d6['offset'](0x0);logger[_0x644e('0x7f')](_0x644e('0x80'),_0x26d2d6[_0x644e('0x81')]());return db[_0x644e('0x82')][_0x644e('0x2d')](_0x26d2d6['toString'](),{'type':db[_0x644e('0x82')][_0x644e('0x83')][_0x644e('0x84')]});}})[_0x644e('0x21')](function(_0x3e3b2b){if(!_0x3e3b2b[_0x644e('0x32')]){throw new db[(_0x644e('0x68'))][(_0x644e('0x8a'))]('No\x20available\x20data',0xcc);}if(_0xbf8201[_0x644e('0x8b')]===_0x644e('0x8c')){return null;}var _0x54cad3=_['merge'](_0xbf8201,{'name':_0xbf8201[_0x644e('0x8d')]||_0xbf8201['name']||_0x6eb15b[_0x644e('0x25')],'basename':_0x417018,'savename':util[_0x644e('0x73')](_0x644e('0x8e'),_0xbf8201[_0x644e('0x25')]||_0x6eb15b[_0x644e('0x25')],require(_0x644e('0x8f'))['generate'](0x4),_0xbf8201[_0x644e('0x8b')]||_0x644e('0x90')),'reportId':_0x6eb15b['id'],'reportType':_0x644e('0x91')});return db[_0x644e('0x92')][_0x644e('0x44')](_0x54cad3,{'raw':!![]});})[_0x644e('0x21')](function(_0x42dec7){if(_0x6eb15b[_0x644e('0x6e')]===_0x644e('0x93')){_0x4b872f['where'](_0x6eb15b[_0x644e('0x6e')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xbf8201[_0x644e('0x94')],_0xbf8201[_0x644e('0x95')]);}else{_0x4b872f[_0x644e('0x37')](_0x6eb15b[_0x644e('0x6e')]+_0x644e('0x96'),_0xbf8201['startDate'],_0xbf8201[_0x644e('0x95')]);}if(_0x42dec7){logger[_0x644e('0x97')](_0x644e('0x98'),_0x4b872f[_0x644e('0x81')]());require(_0x644e('0x99'))[_0x644e('0x9a')](path[_0x644e('0x85')](__dirname,_0x644e('0x9b'),_0x42dec7['output']),[_0x42dec7['id'],_0x4b872f[_0x644e('0x81')](),path[_0x644e('0x85')](__dirname,_0x644e('0x9c'),_0x42dec7[_0x644e('0x9d')]),_0x417018]);return _0x42dec7;}else{var _0x5c111b=squel[_0x644e('0x6c')]();_0x5c111b[_0x644e('0x6d')]('('+_0x4b872f[_0x644e('0x81')]()+')',_0x644e('0x9e'));_0x5c111b[_0x644e('0x64')](_0x644e('0x9f'),_0x644e('0x19'));_0x4b872f['limit'](_0xbf8201['limit']||_0x3eb4db);_0x4b872f['offset'](_0xbf8201['offset']||0x0);return dbH[_0x644e('0x82')][_0x644e('0x2d')](_0x5c111b[_0x644e('0x81')](),{'type':dbH['sequelize']['QueryTypes'][_0x644e('0x84')]})[_0x644e('0x21')](function(_0x1e83cf){if(!_0x1e83cf['length']){_0xfdeff0=0x0;}else{_0xfdeff0=_0x1e83cf[0x0][_0x644e('0x19')]||0x0;}return dbH['sequelize']['query'](_0x4b872f[_0x644e('0x81')](),{'type':dbH['sequelize'][_0x644e('0x83')][_0x644e('0x84')]});})[_0x644e('0x21')](function(_0x270f27){return{'rows':_0x270f27||[],'count':_0xfdeff0};});}});}exports[_0x644e('0xa0')]=function(_0x28bc9a,_0x147d8c){return runReport(_0x28bc9a[_0x644e('0x41')],_0x28bc9a[_0x644e('0x2d')],_0x28bc9a['options'])[_0x644e('0x21')](respondWithResult(_0x147d8c,null))[_0x644e('0x43')](handleError(_0x147d8c,null));};exports[_0x644e('0xa1')]=runReport;exports[_0x644e('0x2d')]=function(_0x4ec182,_0x1262b0){var _0x28aa34=0xa;var _0x2c5904=[_0x644e('0x85'),_0x644e('0x86'),_0x644e('0x51'),_0x644e('0x52')];var _0x4911b9={'SUM':_0x644e('0xa2'),'COUNT':_0x644e('0x53'),'COUNT DISTINCT':_0x644e('0x54'),'MAX':_0x644e('0x87'),'MIN':_0x644e('0x55'),'AVG':_0x644e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x644e('0x58')};var _0x2b952b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x644e('0x88'),'HOUR':_0x644e('0x5a'),'ROUND':_0x644e('0x5b'),'UNIX_TIMESTAMP':_0x644e('0x89')};var _0x2d11ea=function(_0xd0c3bd){return!_[_0x644e('0x5c')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x644e('0x60')],_0xd0c3bd);};var _0x44d441=function(_0x2a4426){if(!_0x2a4426||!_0x2a4426['rules'][_0x644e('0x32')]){return'';}for(var _0x1f1fe4='(',_0x2dafc6=0x0;_0x2dafc6<_0x2a4426[_0x644e('0x61')][_0x644e('0x32')];_0x2dafc6+=0x1){_0x2dafc6>0x0&&(_0x1f1fe4+='\x20'+_0x2a4426[_0x644e('0x62')]+'\x20');_0x1f1fe4+=_0x2a4426[_0x644e('0x61')][_0x2dafc6][_0x644e('0x63')]?_0x44d441(_0x2a4426[_0x644e('0x61')][_0x2dafc6][_0x644e('0x63')]):_0x2a4426[_0x644e('0x61')][_0x2dafc6][_0x644e('0x64')]+'\x20'+_0x2a4426[_0x644e('0x61')][_0x2dafc6]['condition']+(_0x2d11ea(_0x2a4426[_0x644e('0x61')][_0x2dafc6][_0x644e('0x65')])?'\x20'+_0x2a4426['rules'][_0x2dafc6][_0x644e('0x66')]:'');}return _0x1f1fe4+')';};var _0x57d94f={'where':{'id':_0x4ec182[_0x644e('0x41')]['id']}},_0x4bc6b7,_0x406bab,_0x523914,_0x24b48f,_0x29e865;_0x57d94f=_['merge']({},_0x57d94f,_0x4ec182['options']);return db[_0x644e('0x27')]['find'](_0x57d94f)['then'](function(_0x304a8b){if(_0x304a8b){_0x4bc6b7=_0x304a8b;return _0x304a8b[_0x644e('0x67')]();}return null;})['then'](function(_0x4eee4a){if(_0x4eee4a){if(!_0x4eee4a['length']){throw new db['Sequelize'][(_0x644e('0x8a'))](_0x644e('0x69'),0x193);}_0x406bab=_0x4eee4a;return db['AnalyticMetric'][_0x644e('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x74d429){if(_0x74d429){_0x523914=_['keyBy'](_0x74d429,'id');var _0xfe93e7;var _0xd05551=squel[_0x644e('0x6c')]();_0xd05551[_0x644e('0x6d')](_0x4bc6b7[_0x644e('0x6e')]);for(var _0x5f2f5d=0x0;_0x5f2f5d<_0x406bab[_0x644e('0x32')];_0x5f2f5d+=0x1){_0xfe93e7=_0x406bab[_0x5f2f5d][_0x644e('0x6f')]?_0x523914[_0x406bab[_0x5f2f5d][_0x644e('0x6f')]][_0x644e('0x70')]:_0x406bab[_0x5f2f5d][_0x644e('0x64')];_0xfe93e7=_0x406bab[_0x5f2f5d][_0x644e('0x72')]?_[_0x644e('0x71')](_0x4911b9[_0x406bab[_0x5f2f5d][_0x644e('0x72')]],'%s',_0xfe93e7):_0xfe93e7;_0xfe93e7=_0x406bab[_0x5f2f5d][_0x644e('0x73')]?_['replace'](_0x2b952b[_0x406bab[_0x5f2f5d][_0x644e('0x73')]],'%s',_0xfe93e7):_0xfe93e7;if(_0x406bab[_0x5f2f5d][_0x644e('0x74')]){_0xd05551['group'](_0xfe93e7);}_0x406bab[_0x5f2f5d][_0x644e('0x75')]&&_0xd05551[_0x644e('0x35')](_0xfe93e7,_0x406bab[_0x5f2f5d][_0x644e('0x75')]==='DESC'?![]:!![]);_0xd05551['field'](_0xfe93e7,_0x406bab[_0x5f2f5d][_0x644e('0x77')]||_0xfe93e7);}if(_0x4bc6b7[_0x644e('0x79')]){_0x4bc6b7[_0x644e('0x79')]=JSON['parse'](_0x4bc6b7[_0x644e('0x79')]);for(var _0x255ffc=0x0;_0x255ffc<_0x4bc6b7[_0x644e('0x79')]['length'];_0x255ffc+=0x1){if(_0x4bc6b7[_0x644e('0x79')][_0x255ffc][_0x644e('0x2a')]&&_['includes'](_0x2c5904,_0x4bc6b7[_0x644e('0x79')][_0x255ffc]['type'])&&_0x4bc6b7[_0x644e('0x79')][_0x255ffc][_0x644e('0x7a')]&&_0x4bc6b7[_0x644e('0x79')][_0x255ffc]['foreignTable']&&_0x4bc6b7[_0x644e('0x79')][_0x255ffc][_0x644e('0x7c')]){_0xd05551[_0x4bc6b7['joins'][_0x255ffc][_0x644e('0x2a')]](_0x4bc6b7[_0x644e('0x79')][_0x255ffc]['foreignTable'],null,util[_0x644e('0x73')]('%s.%s\x20=\x20%s.%s',_0x4bc6b7[_0x644e('0x6e')],_0x4bc6b7[_0x644e('0x79')][_0x255ffc][_0x644e('0x7a')],_0x4bc6b7[_0x644e('0x79')][_0x255ffc][_0x644e('0x7b')],_0x4bc6b7[_0x644e('0x79')][_0x255ffc]['foreignKey']));}}}if(_0x4bc6b7[_0x644e('0x7d')]){_0x4bc6b7[_0x644e('0x7d')]=JSON[_0x644e('0x78')](_0x4bc6b7['conditions']);_0xd05551[_0x644e('0x37')](_0x44d441(_0x4bc6b7['conditions'][_0x644e('0x63')]));}_0x29e865=_0xd05551[_0x644e('0x7e')]();_0xd05551[_0x644e('0x1b')](_0x28aa34);_0xd05551[_0x644e('0x1a')](0x0);logger[_0x644e('0x7f')](_0x644e('0x80'),_0xd05551[_0x644e('0x81')]());return db[_0x644e('0x82')]['query'](_0xd05551[_0x644e('0x81')](),{'type':db[_0x644e('0x82')][_0x644e('0x83')][_0x644e('0x84')]});}})['then'](function(){return{'sql':_0x29e865[_0x644e('0x81')]()};})[_0x644e('0x21')](respondWithResult(_0x1262b0,null))[_0x644e('0x43')](handleError(_0x1262b0,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ed3823f..bd98dca 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 _0x2ef3=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./analyticDefaultReport.attributes'];(function(_0xf2a854,_0x340c05){var _0x3d3b00=function(_0x29997a){while(--_0x29997a){_0xf2a854['push'](_0xf2a854['shift']());}};_0x3d3b00(++_0x340c05);}(_0x2ef3,0xba));var _0x32ef=function(_0x92b584,_0x115b6b){_0x92b584=_0x92b584-0x0;var _0x38cdeb=_0x2ef3[_0x92b584];return _0x38cdeb;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','util','api','moment'];(function(_0x3c9c71,_0x4c4f84){var _0x5e6c84=function(_0x12015f){while(--_0x12015f){_0x3c9c71['push'](_0x3c9c71['shift']());}};_0x5e6c84(++_0x4c4f84);}(_0xadb5,0xad));var _0x5adb=function(_0x27ea6b,_0x5516a6){_0x27ea6b=_0x27ea6b-0x0;var _0x25306b=_0xadb5[_0x27ea6b];return _0x25306b;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 18e3861..4de9431 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 _0xeb74=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x184aab,_0x49ae9c){var _0x1ec430=function(_0x4cf3c4){while(--_0x4cf3c4){_0x184aab['push'](_0x184aab['shift']());}};_0x1ec430(++_0x49ae9c);}(_0xeb74,0xe3));var _0x4eb7=function(_0x26b9fa,_0x4c1457){_0x26b9fa=_0x26b9fa-0x0;var _0x49717b=_0xeb74[_0x26b9fa];return _0x49717b;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3986cd,_0x54859c,_0xcac7c5){return new BPromise(function(_0x2cffe7,_0x588a1c){return client['request'](_0x3986cd,_0xcac7c5)[_0x4eb7('0xc')](function(_0x2f8296){logger['info'](_0x4eb7('0xd'),_0x54859c,'request\x20sent');logger[_0x4eb7('0xe')](_0x4eb7('0xf'),_0x54859c,_0x4eb7('0x10'),JSON['stringify'](_0x2f8296));if(_0x2f8296[_0x4eb7('0x11')]){if(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x12')]===0x1f4){logger[_0x4eb7('0x11')](_0x4eb7('0xd'),_0x54859c,_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);return _0x588a1c(_0x2f8296['error']['message']);}logger['error'](_0x4eb7('0xd'),_0x54859c,_0x2f8296['error'][_0x4eb7('0x13')]);return _0x2cffe7(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);}else{logger[_0x4eb7('0x14')](_0x4eb7('0xd'),_0x54859c,_0x4eb7('0x10'));_0x2cffe7(_0x2f8296[_0x4eb7('0x15')][_0x4eb7('0x13')]);}})[_0x4eb7('0x16')](function(_0x17377f){logger['error'](_0x4eb7('0xd'),_0x54859c,_0x17377f);_0x588a1c(_0x17377f);});});} \ No newline at end of file +var _0x9090=['jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0x9090,0x17f));var _0x0909=function(_0x390a7a,_0x4c8d69){_0x390a7a=_0x390a7a-0x0;var _0x599bef=_0x9090[_0x390a7a];return _0x599bef;};'use strict';var _=require(_0x0909('0x0'));var util=require(_0x0909('0x1'));var moment=require(_0x0909('0x2'));var BPromise=require(_0x0909('0x3'));var rs=require(_0x0909('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0909('0x5'));var logger=require(_0x0909('0x6'))(_0x0909('0x7'));var config=require('../../config/environment');var jayson=require(_0x0909('0x8'));var client=jayson[_0x0909('0x9')][_0x0909('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41d8fc,_0x26dfbe,_0x32bf48){return new BPromise(function(_0x1755ee,_0x571b3c){return client[_0x0909('0xb')](_0x41d8fc,_0x32bf48)[_0x0909('0xc')](function(_0x4f961d){logger[_0x0909('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x26dfbe,_0x0909('0xe'));logger[_0x0909('0xf')](_0x0909('0x10'),_0x26dfbe,_0x0909('0xe'),JSON['stringify'](_0x4f961d));if(_0x4f961d[_0x0909('0x11')]){if(_0x4f961d[_0x0909('0x11')][_0x0909('0x12')]===0x1f4){logger[_0x0909('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x26dfbe,_0x4f961d[_0x0909('0x11')][_0x0909('0x13')]);return _0x571b3c(_0x4f961d[_0x0909('0x11')][_0x0909('0x13')]);}logger[_0x0909('0x11')](_0x0909('0x14'),_0x26dfbe,_0x4f961d[_0x0909('0x11')][_0x0909('0x13')]);return _0x1755ee(_0x4f961d[_0x0909('0x11')][_0x0909('0x13')]);}else{logger['info'](_0x0909('0x14'),_0x26dfbe,_0x0909('0xe'));_0x1755ee(_0x4f961d[_0x0909('0x15')][_0x0909('0x13')]);}})[_0x0909('0x16')](function(_0x1d68cd){logger[_0x0909('0x11')](_0x0909('0x14'),_0x26dfbe,_0x1d68cd);_0x571b3c(_0x1d68cd);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index fbdd8ca..86b3ea6 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 _0x49d7=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','query','post','create','put','update','exports','multer','util','path','express','Router'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x49d7,0xab));var _0x749d=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x49d7[_0xe896bf];return _0x4c7a8a;};'use strict';var multer=require(_0x749d('0x0'));var util=require(_0x749d('0x1'));var path=require(_0x749d('0x2'));var timeout=require('connect-timeout');var express=require(_0x749d('0x3'));var router=express[_0x749d('0x4')]();var auth=require(_0x749d('0x5'));var interaction=require(_0x749d('0x6'));var config=require(_0x749d('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0x749d('0x8')]('/',auth[_0x749d('0x9')](),controller[_0x749d('0xa')]);router[_0x749d('0x8')](_0x749d('0xb'),auth[_0x749d('0x9')](),controller[_0x749d('0xc')]);router[_0x749d('0x8')]('/:id/preview',auth[_0x749d('0x9')](),controller[_0x749d('0xd')]);router[_0x749d('0x8')](_0x749d('0xe'),auth[_0x749d('0x9')](),controller[_0x749d('0xf')]);router[_0x749d('0x8')]('/:id/query',auth['isAuthenticated'](),controller[_0x749d('0x10')]);router[_0x749d('0x11')]('/',auth[_0x749d('0x9')](),controller[_0x749d('0x12')]);router[_0x749d('0x13')](_0x749d('0xb'),auth[_0x749d('0x9')](),controller[_0x749d('0x14')]);router['delete'](_0x749d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x749d('0x15')]=router; \ No newline at end of file +var _0xd787=['/:id','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','update','delete'];(function(_0x40a78d,_0xffca17){var _0x1505c7=function(_0x5b37d8){while(--_0x5b37d8){_0x40a78d['push'](_0x40a78d['shift']());}};_0x1505c7(++_0xffca17);}(_0xd787,0x1e4));var _0x7d78=function(_0x57c1fa,_0x2e53d8){_0x57c1fa=_0x57c1fa-0x0;var _0x12c2bf=_0xd787[_0x57c1fa];return _0x12c2bf;};'use strict';var multer=require(_0x7d78('0x0'));var util=require('util');var path=require(_0x7d78('0x1'));var timeout=require(_0x7d78('0x2'));var express=require(_0x7d78('0x3'));var router=express[_0x7d78('0x4')]();var auth=require(_0x7d78('0x5'));var interaction=require(_0x7d78('0x6'));var config=require(_0x7d78('0x7'));var controller=require(_0x7d78('0x8'));router[_0x7d78('0x9')]('/',auth[_0x7d78('0xa')](),controller[_0x7d78('0xb')]);router[_0x7d78('0x9')]('/:id',auth[_0x7d78('0xa')](),controller[_0x7d78('0xc')]);router[_0x7d78('0x9')](_0x7d78('0xd'),auth[_0x7d78('0xa')](),controller[_0x7d78('0xe')]);router['get'](_0x7d78('0xf'),auth[_0x7d78('0xa')](),controller[_0x7d78('0x10')]);router['get'](_0x7d78('0x11'),auth[_0x7d78('0xa')](),controller[_0x7d78('0x12')]);router[_0x7d78('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x7d78('0xa')](),controller[_0x7d78('0x14')]);router[_0x7d78('0x15')](_0x7d78('0x16'),auth[_0x7d78('0xa')](),controller['destroy']);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 9685c5c..72daa84 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 _0x423c=['moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','scheduled','INTEGER','UNSIGNED'];(function(_0x3b5359,_0x53240a){var _0x3090ce=function(_0x195946){while(--_0x195946){_0x3b5359['push'](_0x3b5359['shift']());}};_0x3090ce(++_0x53240a);}(_0x423c,0xcc));var _0xc423=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x423c[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc423('0x0'));module[_0xc423('0x1')]={'name':{'type':Sequelize[_0xc423('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xc423('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xc423('0x3')](_0xc423('0x4'),_0xc423('0x5'),_0xc423('0x6')),'allowNull':![],'defaultValue':_0xc423('0x4')},'savename':{'type':Sequelize[_0xc423('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc423('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xc423('0x2')],'defaultValue':_0xc423('0x8')},'type':{'type':Sequelize['ENUM']('manual',_0xc423('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xc423('0xa')](0xb)[_0xc423('0xb')]},'reportType':{'type':Sequelize[_0xc423('0x2')]}}; \ No newline at end of file +var _0xce53=['xlsx','DATE','Loading','ENUM','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','csv'];(function(_0xedc6d8,_0x4f8ceb){var _0x2cba41=function(_0xd94423){while(--_0xd94423){_0xedc6d8['push'](_0xedc6d8['shift']());}};_0x2cba41(++_0x4f8ceb);}(_0xce53,0x158));var _0x3ce5=function(_0x12aa6e,_0x1643ee){_0x12aa6e=_0x12aa6e-0x0;var _0x3a1b87=_0xce53[_0x12aa6e];return _0x3a1b87;};'use strict';var Sequelize=require(_0x3ce5('0x0'));var moment=require(_0x3ce5('0x1'));module['exports']={'name':{'type':Sequelize[_0x3ce5('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x3ce5('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x3ce5('0x3'),'pdf',_0x3ce5('0x4')),'allowNull':![],'defaultValue':_0x3ce5('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x3ce5('0x5')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x3ce5('0x2')],'defaultValue':_0x3ce5('0x6')},'type':{'type':Sequelize[_0x3ce5('0x7')](_0x3ce5('0x8'),_0x3ce5('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x3ce5('0xa')](0xb)[_0x3ce5('0xb')]},'reportType':{'type':Sequelize[_0x3ce5('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7f2f1f4..11e444c 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 _0x15a1=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','error','name','send','AnalyticExtractedReport','rawAttributes','key','map','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','sort','where','type','merge','options','findAll','catch','show','length','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','autoAssociation','body','params','destroy','download','basename','savename','existsSync','server/files/reports','Sequelize','exists','root','%s.%s','output','toLowerCase','html-pdf','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x15a1,0xf1));var _0x115a=function(_0x1d3a4e,_0x2fa74a){_0x1d3a4e=_0x1d3a4e-0x0;var _0x3dfbeb=_0x15a1[_0x1d3a4e];return _0x3dfbeb;};'use strict';var pdf=require(_0x115a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x115a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x115a('0x2'));var rp=require('request-promise');var moment=require(_0x115a('0x3'));var BPromise=require(_0x115a('0x4'));var Mustache=require('mustache');var util=require(_0x115a('0x5'));var path=require(_0x115a('0x6'));var sox=require(_0x115a('0x7'));var csv=require(_0x115a('0x8'));var ejs=require(_0x115a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x115a('0xa'));var crypto=require(_0x115a('0xb'));var jsforce=require(_0x115a('0xc'));var deskjs=require(_0x115a('0xd'));var toCsv=require(_0x115a('0x8'));var querystring=require('querystring');var Papa=require(_0x115a('0xe'));var Redis=require(_0x115a('0xf'));var authService=require(_0x115a('0x10'));var qs=require(_0x115a('0x11'));var as=require(_0x115a('0x12'));var hardwareService=require(_0x115a('0x13'));var logger=require(_0x115a('0x14'))(_0x115a('0x15'));var utils=require('../../config/utils');var config=require(_0x115a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5339d0,_0x5b7e7f){_0x5b7e7f=_0x5b7e7f||0xcc;return function(_0x275110){if(_0x275110){return _0x5339d0[_0x115a('0x17')](_0x5b7e7f);}return _0x5339d0['status'](_0x5b7e7f)[_0x115a('0x18')]();};}function respondWithResult(_0x290fce,_0x3c4fa8){_0x3c4fa8=_0x3c4fa8||0xc8;return function(_0x323d11){if(_0x323d11){return _0x290fce[_0x115a('0x19')](_0x3c4fa8)['json'](_0x323d11);}};}function respondWithFilteredResult(_0x5a9739,_0x50d3d6){return function(_0x43750d){if(_0x43750d){var _0x55a556=_0x43750d[_0x115a('0x1a')],_0x29f3bf=_0x50d3d6[_0x115a('0x1b')],_0x527316=_0x50d3d6['offset']+_0x50d3d6[_0x115a('0x1c')],_0x4cccb2;if(_0x527316>=_0x55a556){_0x527316=_0x55a556;_0x4cccb2=0xc8;}else{_0x4cccb2=0xce;}_0x5a9739[_0x115a('0x19')](_0x4cccb2);return _0x5a9739[_0x115a('0x1d')](_0x115a('0x1e'),_0x29f3bf+'-'+_0x527316+'/'+_0x55a556)[_0x115a('0x1f')](_0x43750d);}return null;};}function patchUpdates(_0xc5b377){return function(_0x3409a3){try{jsonpatch[_0x115a('0x20')](_0x3409a3,_0xc5b377,!![]);}catch(_0x5997e1){return BPromise[_0x115a('0x21')](_0x5997e1);}return _0x3409a3[_0x115a('0x22')]();};}function saveUpdates(_0x20cef1,_0x26f2b1){return function(_0x226805){if(_0x226805){return _0x226805[_0x115a('0x23')](_0x20cef1)['then'](function(_0x53ca31){return _0x53ca31;});}return null;};}function removeEntity(_0x1cd9e7,_0xb6135c){return function(_0x54ae99){if(_0x54ae99){return _0x54ae99['destroy']()[_0x115a('0x24')](function(){var _0x1ec9b0=_0x54ae99[_0x115a('0x25')]({'plain':!![]});var _0x2075b3='ExtractedReports';return db[_0x115a('0x26')]['destroy']({'where':{'type':_0x2075b3,'resourceId':_0x1ec9b0['id']}})[_0x115a('0x24')](function(){return _0x54ae99;});})[_0x115a('0x24')](function(){_0x1cd9e7[_0x115a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dae4,_0x5e9e80){return function(_0x143bd5){if(!_0x143bd5){_0x1dae4[_0x115a('0x17')](0x194);}return _0x143bd5;};}function handleError(_0x3deeab,_0x561bf5){_0x561bf5=_0x561bf5||0x1f4;return function(_0xe07a78){logger[_0x115a('0x27')](_0xe07a78['stack']);if(_0xe07a78[_0x115a('0x28')]){delete _0xe07a78[_0x115a('0x28')];}_0x3deeab[_0x115a('0x19')](_0x561bf5)[_0x115a('0x29')](_0xe07a78);};}exports['index']=function(_0xc81abd,_0x12bfb9){var _0x324100={},_0x359b91={},_0x450e77={'count':0x0,'rows':[]};var _0x175695=_['map'](db[_0x115a('0x2a')][_0x115a('0x2b')],function(_0x1ae33c){return{'name':_0x1ae33c['fieldName'],'type':_0x1ae33c['type'][_0x115a('0x2c')]};});_0x359b91['model']=_[_0x115a('0x2d')](_0x175695,'name');_0x359b91['query']=_[_0x115a('0x2e')](_0xc81abd['query']);_0x359b91[_0x115a('0x2f')]=_[_0x115a('0x30')](_0x359b91[_0x115a('0x31')],_0x359b91[_0x115a('0x32')]);_0x324100[_0x115a('0x33')]=_[_0x115a('0x30')](_0x359b91[_0x115a('0x31')],qs[_0x115a('0x34')](_0xc81abd['query'][_0x115a('0x34')]));_0x324100['attributes']=_0x324100['attributes']['length']?_0x324100[_0x115a('0x33')]:_0x359b91[_0x115a('0x31')];if(!_0xc81abd[_0x115a('0x32')][_0x115a('0x35')]('nolimit')){_0x324100['limit']=qs[_0x115a('0x1c')](_0xc81abd[_0x115a('0x32')][_0x115a('0x1c')]);_0x324100['offset']=qs[_0x115a('0x1b')](_0xc81abd[_0x115a('0x32')][_0x115a('0x1b')]);}_0x324100['order']=qs['sort'](_0xc81abd[_0x115a('0x32')][_0x115a('0x36')]);_0x324100[_0x115a('0x37')]=qs[_0x115a('0x2f')](_['pick'](_0xc81abd[_0x115a('0x32')],_0x359b91[_0x115a('0x2f')]),_0x175695);if(_0xc81abd[_0x115a('0x32')]['filter']){_0x324100['where']=_['merge'](_0x324100[_0x115a('0x37')],{'$or':_[_0x115a('0x2d')](_0x175695,function(_0x854830){if(_0x854830[_0x115a('0x38')]!=='VIRTUAL'){var _0x4af3d9={};_0x4af3d9[_0x854830[_0x115a('0x28')]]={'$like':'%'+_0xc81abd[_0x115a('0x32')]['filter']+'%'};return _0x4af3d9;}})});}_0x324100=_[_0x115a('0x39')]({},_0x324100,_0xc81abd[_0x115a('0x3a')]);var _0x2a6027={'where':_0x324100['where']};return db[_0x115a('0x2a')][_0x115a('0x1a')](_0x2a6027)[_0x115a('0x24')](function(_0x298a6a){_0x450e77[_0x115a('0x1a')]=_0x298a6a;if(_0xc81abd[_0x115a('0x32')]['includeAll']){_0x324100['include']=[{'all':!![]}];}return db[_0x115a('0x2a')][_0x115a('0x3b')](_0x324100);})['then'](function(_0x1f54bf){_0x450e77['rows']=_0x1f54bf;return _0x450e77;})[_0x115a('0x24')](respondWithFilteredResult(_0x12bfb9,_0x324100))[_0x115a('0x3c')](handleError(_0x12bfb9,null));};exports[_0x115a('0x3d')]=function(_0x8cd729,_0x4b799d){var _0x129150={'raw':!![],'where':{'id':_0x8cd729['params']['id']}},_0x1e2627={};_0x1e2627['model']=_[_0x115a('0x2e')](db[_0x115a('0x2a')]['rawAttributes']);_0x1e2627[_0x115a('0x32')]=_[_0x115a('0x2e')](_0x8cd729[_0x115a('0x32')]);_0x1e2627[_0x115a('0x2f')]=_[_0x115a('0x30')](_0x1e2627[_0x115a('0x31')],_0x1e2627[_0x115a('0x32')]);_0x129150[_0x115a('0x33')]=_[_0x115a('0x30')](_0x1e2627['model'],qs[_0x115a('0x34')](_0x8cd729['query'][_0x115a('0x34')]));_0x129150[_0x115a('0x33')]=_0x129150['attributes'][_0x115a('0x3e')]?_0x129150['attributes']:_0x1e2627[_0x115a('0x31')];if(_0x8cd729['query'][_0x115a('0x3f')]){_0x129150[_0x115a('0x40')]=[{'all':!![]}];}_0x129150=_[_0x115a('0x39')]({},_0x129150,_0x8cd729[_0x115a('0x3a')]);return db[_0x115a('0x2a')][_0x115a('0x41')](_0x129150)[_0x115a('0x24')](handleEntityNotFound(_0x4b799d,null))['then'](respondWithResult(_0x4b799d,null))[_0x115a('0x3c')](handleError(_0x4b799d,null));};exports[_0x115a('0x42')]=function(_0x95128d,_0x58c973){return db[_0x115a('0x2a')][_0x115a('0x42')](_0x95128d['body'],{})[_0x115a('0x24')](function(_0x34b982){var _0x4bece7=_0x95128d[_0x115a('0x43')]['get']({'plain':!![]});if(!_0x4bece7)throw new Error(_0x115a('0x44'));if(_0x4bece7['role']===_0x115a('0x43')){var _0x506dcc=_0x34b982[_0x115a('0x25')]({'plain':!![]});var _0x862199=_0x115a('0x45');return db['UserProfileSection'][_0x115a('0x41')]({'where':{'name':_0x862199,'userProfileId':_0x4bece7['userProfileId']},'raw':!![]})['then'](function(_0x4dd3ce){if(_0x4dd3ce&&_0x4dd3ce[_0x115a('0x46')]===0x0){return db[_0x115a('0x26')]['create']({'name':_0x506dcc[_0x115a('0x28')],'resourceId':_0x506dcc['id'],'type':_0x4dd3ce[_0x115a('0x28')],'sectionId':_0x4dd3ce['id']},{})['then'](function(){return _0x34b982;});}else{return _0x34b982;}})[_0x115a('0x3c')](function(_0x1c983a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c983a);throw _0x1c983a;});}return _0x34b982;})[_0x115a('0x24')](respondWithResult(_0x58c973,0xc9))[_0x115a('0x3c')](handleError(_0x58c973,null));};exports[_0x115a('0x23')]=function(_0x2b9b57,_0xbc11c6){if(_0x2b9b57[_0x115a('0x47')]['id']){delete _0x2b9b57[_0x115a('0x47')]['id'];}return db['AnalyticExtractedReport'][_0x115a('0x41')]({'where':{'id':_0x2b9b57[_0x115a('0x48')]['id']}})[_0x115a('0x24')](handleEntityNotFound(_0xbc11c6,null))['then'](saveUpdates(_0x2b9b57['body'],null))['then'](respondWithResult(_0xbc11c6,null))[_0x115a('0x3c')](handleError(_0xbc11c6,null));};exports[_0x115a('0x49')]=function(_0x460a38,_0x3db472){return db[_0x115a('0x2a')]['find']({'where':{'id':_0x460a38['params']['id']}})[_0x115a('0x24')](handleEntityNotFound(_0x3db472,null))[_0x115a('0x24')](removeEntity(_0x3db472,null))[_0x115a('0x3c')](handleError(_0x3db472,null));};exports[_0x115a('0x4a')]=function(_0x3be399,_0x5cb22f,_0xad2f9f){return db['AnalyticExtractedReport'][_0x115a('0x41')]({'where':{'id':_0x3be399[_0x115a('0x48')]['id']},'attributes':[_0x115a('0x28'),_0x115a('0x4b'),_0x115a('0x4c'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x5cb22f,null))[_0x115a('0x24')](function(_0x3b5fcf){if(_0x3b5fcf){if(!fs[_0x115a('0x4d')](path['join'](config['root'],_0x115a('0x4e'),_0x3b5fcf[_0x115a('0x4c')]))){throw new db[(_0x115a('0x4f'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x3be399[_0x115a('0x32')][_0x115a('0x50')]){return _0x5cb22f[_0x115a('0x17')](0xc8);}return _0x5cb22f[_0x115a('0x4a')](path['join'](config[_0x115a('0x51')],'server/files/reports',_0x3b5fcf[_0x115a('0x4c')]),util['format'](_0x115a('0x52'),_0x3b5fcf['basename']||_0x3b5fcf[_0x115a('0x28')],_0x3b5fcf[_0x115a('0x53')][_0x115a('0x54')]()));}})[_0x115a('0x3c')](handleError(_0x5cb22f,null));}; \ No newline at end of file +var _0x4f4d=['options','include','findAll','rows','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','params','basename','output','existsSync','join','root','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','download','format','%s.%s','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','end','status','count','offset','set','Content-Range','json','apply','reject','save','then','get','ExtractedReports','destroy','error','stack','name','send','AnalyticExtractedReport','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge'];(function(_0x2b0169,_0x3acffe){var _0x4dc92f=function(_0x369fec){while(--_0x369fec){_0x2b0169['push'](_0x2b0169['shift']());}};_0x4dc92f(++_0x3acffe);}(_0x4f4d,0x1da));var _0xd4f4=function(_0x3a4a66,_0x5afde4){_0x3a4a66=_0x3a4a66-0x0;var _0x2bd136=_0x4f4d[_0x3a4a66];return _0x2bd136;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd4f4('0x0'));var zipdir=require(_0xd4f4('0x1'));var jsonpatch=require(_0xd4f4('0x2'));var rp=require('request-promise');var moment=require(_0xd4f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd4f4('0x4'));var util=require(_0xd4f4('0x5'));var path=require(_0xd4f4('0x6'));var sox=require(_0xd4f4('0x7'));var csv=require(_0xd4f4('0x8'));var ejs=require(_0xd4f4('0x9'));var fs=require('fs');var _=require(_0xd4f4('0xa'));var squel=require('squel');var crypto=require(_0xd4f4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd4f4('0xc'));var toCsv=require(_0xd4f4('0x8'));var querystring=require('querystring');var Papa=require(_0xd4f4('0xd'));var Redis=require(_0xd4f4('0xe'));var authService=require(_0xd4f4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd4f4('0x10'));var hardwareService=require(_0xd4f4('0x11'));var logger=require(_0xd4f4('0x12'))('api');var utils=require(_0xd4f4('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x165a97,_0x5b54ab){_0x5b54ab=_0x5b54ab||0xcc;return function(_0x93c1cf){if(_0x93c1cf){return _0x165a97['sendStatus'](_0x5b54ab);}return _0x165a97['status'](_0x5b54ab)[_0xd4f4('0x14')]();};}function respondWithResult(_0x405b1a,_0x1486fd){_0x1486fd=_0x1486fd||0xc8;return function(_0x347f99){if(_0x347f99){return _0x405b1a[_0xd4f4('0x15')](_0x1486fd)['json'](_0x347f99);}};}function respondWithFilteredResult(_0x29041c,_0x255ddb){return function(_0x57bc0f){if(_0x57bc0f){var _0x8cf2a4=_0x57bc0f[_0xd4f4('0x16')],_0x57f251=_0x255ddb[_0xd4f4('0x17')],_0x10f08d=_0x255ddb[_0xd4f4('0x17')]+_0x255ddb['limit'],_0x528083;if(_0x10f08d>=_0x8cf2a4){_0x10f08d=_0x8cf2a4;_0x528083=0xc8;}else{_0x528083=0xce;}_0x29041c[_0xd4f4('0x15')](_0x528083);return _0x29041c[_0xd4f4('0x18')](_0xd4f4('0x19'),_0x57f251+'-'+_0x10f08d+'/'+_0x8cf2a4)[_0xd4f4('0x1a')](_0x57bc0f);}return null;};}function patchUpdates(_0x18a179){return function(_0x232aff){try{jsonpatch[_0xd4f4('0x1b')](_0x232aff,_0x18a179,!![]);}catch(_0x1c58c3){return BPromise[_0xd4f4('0x1c')](_0x1c58c3);}return _0x232aff[_0xd4f4('0x1d')]();};}function saveUpdates(_0x327e0e,_0x360161){return function(_0x1e2293){if(_0x1e2293){return _0x1e2293['update'](_0x327e0e)[_0xd4f4('0x1e')](function(_0x5f3f43){return _0x5f3f43;});}return null;};}function removeEntity(_0x14549e,_0x3c3d47){return function(_0x3a5de6){if(_0x3a5de6){return _0x3a5de6['destroy']()[_0xd4f4('0x1e')](function(){var _0x5a26e9=_0x3a5de6[_0xd4f4('0x1f')]({'plain':!![]});var _0x57cc57=_0xd4f4('0x20');return db['UserProfileResource'][_0xd4f4('0x21')]({'where':{'type':_0x57cc57,'resourceId':_0x5a26e9['id']}})[_0xd4f4('0x1e')](function(){return _0x3a5de6;});})[_0xd4f4('0x1e')](function(){_0x14549e[_0xd4f4('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54d344,_0x20e992){return function(_0x11bc64){if(!_0x11bc64){_0x54d344['sendStatus'](0x194);}return _0x11bc64;};}function handleError(_0x30cb0b,_0x4f7d66){_0x4f7d66=_0x4f7d66||0x1f4;return function(_0x523f94){logger[_0xd4f4('0x22')](_0x523f94[_0xd4f4('0x23')]);if(_0x523f94[_0xd4f4('0x24')]){delete _0x523f94[_0xd4f4('0x24')];}_0x30cb0b[_0xd4f4('0x15')](_0x4f7d66)[_0xd4f4('0x25')](_0x523f94);};}exports['index']=function(_0x4b6db0,_0xa76947){var _0x924a01={},_0x5710ec={},_0x42c5fe={'count':0x0,'rows':[]};var _0x3fcf6a=_['map'](db[_0xd4f4('0x26')]['rawAttributes'],function(_0x22e0f5){return{'name':_0x22e0f5[_0xd4f4('0x27')],'type':_0x22e0f5[_0xd4f4('0x28')]['key']};});_0x5710ec[_0xd4f4('0x29')]=_[_0xd4f4('0x2a')](_0x3fcf6a,_0xd4f4('0x24'));_0x5710ec[_0xd4f4('0x2b')]=_[_0xd4f4('0x2c')](_0x4b6db0[_0xd4f4('0x2b')]);_0x5710ec[_0xd4f4('0x2d')]=_[_0xd4f4('0x2e')](_0x5710ec[_0xd4f4('0x29')],_0x5710ec[_0xd4f4('0x2b')]);_0x924a01['attributes']=_[_0xd4f4('0x2e')](_0x5710ec['model'],qs[_0xd4f4('0x2f')](_0x4b6db0[_0xd4f4('0x2b')][_0xd4f4('0x2f')]));_0x924a01[_0xd4f4('0x30')]=_0x924a01[_0xd4f4('0x30')][_0xd4f4('0x31')]?_0x924a01['attributes']:_0x5710ec[_0xd4f4('0x29')];if(!_0x4b6db0[_0xd4f4('0x2b')][_0xd4f4('0x32')](_0xd4f4('0x33'))){_0x924a01[_0xd4f4('0x34')]=qs[_0xd4f4('0x34')](_0x4b6db0['query'][_0xd4f4('0x34')]);_0x924a01[_0xd4f4('0x17')]=qs[_0xd4f4('0x17')](_0x4b6db0[_0xd4f4('0x2b')][_0xd4f4('0x17')]);}_0x924a01[_0xd4f4('0x35')]=qs[_0xd4f4('0x36')](_0x4b6db0['query'][_0xd4f4('0x36')]);_0x924a01['where']=qs[_0xd4f4('0x2d')](_[_0xd4f4('0x37')](_0x4b6db0[_0xd4f4('0x2b')],_0x5710ec['filters']),_0x3fcf6a);if(_0x4b6db0[_0xd4f4('0x2b')][_0xd4f4('0x38')]){_0x924a01[_0xd4f4('0x39')]=_['merge'](_0x924a01[_0xd4f4('0x39')],{'$or':_[_0xd4f4('0x2a')](_0x3fcf6a,function(_0xbf98e5){if(_0xbf98e5[_0xd4f4('0x28')]!==_0xd4f4('0x3a')){var _0x5f0b55={};_0x5f0b55[_0xbf98e5['name']]={'$like':'%'+_0x4b6db0[_0xd4f4('0x2b')][_0xd4f4('0x38')]+'%'};return _0x5f0b55;}})});}_0x924a01=_[_0xd4f4('0x3b')]({},_0x924a01,_0x4b6db0[_0xd4f4('0x3c')]);var _0x87ba3f={'where':_0x924a01['where']};return db[_0xd4f4('0x26')][_0xd4f4('0x16')](_0x87ba3f)['then'](function(_0x4a5f04){_0x42c5fe[_0xd4f4('0x16')]=_0x4a5f04;if(_0x4b6db0[_0xd4f4('0x2b')]['includeAll']){_0x924a01[_0xd4f4('0x3d')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xd4f4('0x3e')](_0x924a01);})['then'](function(_0x4ec679){_0x42c5fe[_0xd4f4('0x3f')]=_0x4ec679;return _0x42c5fe;})[_0xd4f4('0x1e')](respondWithFilteredResult(_0xa76947,_0x924a01))['catch'](handleError(_0xa76947,null));};exports['show']=function(_0x25d8c0,_0x6ad8f1){var _0x26b693={'raw':!![],'where':{'id':_0x25d8c0['params']['id']}},_0x27973a={};_0x27973a['model']=_['keys'](db[_0xd4f4('0x26')]['rawAttributes']);_0x27973a[_0xd4f4('0x2b')]=_[_0xd4f4('0x2c')](_0x25d8c0[_0xd4f4('0x2b')]);_0x27973a['filters']=_['intersection'](_0x27973a[_0xd4f4('0x29')],_0x27973a[_0xd4f4('0x2b')]);_0x26b693[_0xd4f4('0x30')]=_[_0xd4f4('0x2e')](_0x27973a['model'],qs[_0xd4f4('0x2f')](_0x25d8c0['query'][_0xd4f4('0x2f')]));_0x26b693[_0xd4f4('0x30')]=_0x26b693[_0xd4f4('0x30')][_0xd4f4('0x31')]?_0x26b693[_0xd4f4('0x30')]:_0x27973a[_0xd4f4('0x29')];if(_0x25d8c0['query']['includeAll']){_0x26b693[_0xd4f4('0x3d')]=[{'all':!![]}];}_0x26b693=_[_0xd4f4('0x3b')]({},_0x26b693,_0x25d8c0[_0xd4f4('0x3c')]);return db[_0xd4f4('0x26')][_0xd4f4('0x40')](_0x26b693)['then'](handleEntityNotFound(_0x6ad8f1,null))['then'](respondWithResult(_0x6ad8f1,null))[_0xd4f4('0x41')](handleError(_0x6ad8f1,null));};exports[_0xd4f4('0x42')]=function(_0x3cdd98,_0x1a1baf){return db['AnalyticExtractedReport'][_0xd4f4('0x42')](_0x3cdd98[_0xd4f4('0x43')],{})[_0xd4f4('0x1e')](function(_0x275f52){var _0x2e3f0c=_0x3cdd98[_0xd4f4('0x44')][_0xd4f4('0x1f')]({'plain':!![]});if(!_0x2e3f0c)throw new Error(_0xd4f4('0x45'));if(_0x2e3f0c[_0xd4f4('0x46')]===_0xd4f4('0x44')){var _0x48153c=_0x275f52[_0xd4f4('0x1f')]({'plain':!![]});var _0x5d356c=_0xd4f4('0x20');return db[_0xd4f4('0x47')][_0xd4f4('0x40')]({'where':{'name':_0x5d356c,'userProfileId':_0x2e3f0c[_0xd4f4('0x48')]},'raw':!![]})[_0xd4f4('0x1e')](function(_0x3854ab){if(_0x3854ab&&_0x3854ab[_0xd4f4('0x49')]===0x0){return db['UserProfileResource'][_0xd4f4('0x42')]({'name':_0x48153c[_0xd4f4('0x24')],'resourceId':_0x48153c['id'],'type':_0x3854ab['name'],'sectionId':_0x3854ab['id']},{})[_0xd4f4('0x1e')](function(){return _0x275f52;});}else{return _0x275f52;}})[_0xd4f4('0x41')](function(_0x470c80){logger[_0xd4f4('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x470c80);throw _0x470c80;});}return _0x275f52;})[_0xd4f4('0x1e')](respondWithResult(_0x1a1baf,0xc9))[_0xd4f4('0x41')](handleError(_0x1a1baf,null));};exports[_0xd4f4('0x4a')]=function(_0x4f5433,_0x4dcb52){if(_0x4f5433[_0xd4f4('0x43')]['id']){delete _0x4f5433[_0xd4f4('0x43')]['id'];}return db[_0xd4f4('0x26')]['find']({'where':{'id':_0x4f5433[_0xd4f4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4dcb52,null))[_0xd4f4('0x1e')](saveUpdates(_0x4f5433[_0xd4f4('0x43')],null))[_0xd4f4('0x1e')](respondWithResult(_0x4dcb52,null))[_0xd4f4('0x41')](handleError(_0x4dcb52,null));};exports[_0xd4f4('0x21')]=function(_0x27ab4c,_0x550a6c){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x27ab4c[_0xd4f4('0x4b')]['id']}})[_0xd4f4('0x1e')](handleEntityNotFound(_0x550a6c,null))['then'](removeEntity(_0x550a6c,null))[_0xd4f4('0x41')](handleError(_0x550a6c,null));};exports['download']=function(_0x34ba13,_0xae7008,_0x59ddb3){return db[_0xd4f4('0x26')][_0xd4f4('0x40')]({'where':{'id':_0x34ba13[_0xd4f4('0x4b')]['id']},'attributes':[_0xd4f4('0x24'),_0xd4f4('0x4c'),'savename',_0xd4f4('0x4d')],'raw':!![]})[_0xd4f4('0x1e')](handleEntityNotFound(_0xae7008,null))['then'](function(_0x4e35eb){if(_0x4e35eb){if(!fs[_0xd4f4('0x4e')](path[_0xd4f4('0x4f')](config[_0xd4f4('0x50')],'server/files/reports',_0x4e35eb[_0xd4f4('0x51')]))){throw new db[(_0xd4f4('0x52'))]['ValidationError'](_0xd4f4('0x53'));}if(_0x34ba13[_0xd4f4('0x2b')][_0xd4f4('0x54')]){return _0xae7008[_0xd4f4('0x55')](0xc8);}return _0xae7008[_0xd4f4('0x56')](path[_0xd4f4('0x4f')](config[_0xd4f4('0x50')],'server/files/reports',_0x4e35eb['savename']),util[_0xd4f4('0x57')](_0xd4f4('0x58'),_0x4e35eb[_0xd4f4('0x4c')]||_0x4e35eb[_0xd4f4('0x24')],_0x4e35eb[_0xd4f4('0x4d')]['toLowerCase']()));}})[_0xd4f4('0x41')](handleError(_0xae7008,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0ba3b98..2cc9c4f 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 _0x2494=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./analyticExtractedReport.attributes','define','analytics_extracted_reports'];(function(_0x57a1ca,_0x155fca){var _0x33023b=function(_0x2534f9){while(--_0x2534f9){_0x57a1ca['push'](_0x57a1ca['shift']());}};_0x33023b(++_0x155fca);}(_0x2494,0x82));var _0x4249=function(_0x3d4898,_0x371fcd){_0x3d4898=_0x3d4898-0x0;var _0x4ddcd8=_0x2494[_0x3d4898];return _0x4ddcd8;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var logger=require(_0x4249('0x1'))(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var BPromise=require(_0x4249('0x4'));var rp=require(_0x4249('0x5'));var fs=require('fs');var path=require(_0x4249('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4249('0x7'));module['exports']=function(_0x3c2d8d,_0x1d4ca8){return _0x3c2d8d[_0x4249('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x4249('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb3c=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x10d341,_0x57ff35){var _0xddc36d=function(_0x1c24f0){while(--_0x1c24f0){_0x10d341['push'](_0x10d341['shift']());}};_0xddc36d(++_0x57ff35);}(_0xcb3c,0x150));var _0xccb3=function(_0x5e0d12,_0x1a9647){_0x5e0d12=_0x5e0d12-0x0;var _0x9d1d92=_0xcb3c[_0x5e0d12];return _0x9d1d92;};'use strict';var _=require(_0xccb3('0x0'));var util=require(_0xccb3('0x1'));var logger=require(_0xccb3('0x2'))(_0xccb3('0x3'));var moment=require('moment');var BPromise=require(_0xccb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xccb3('0x5'));var rimraf=require('rimraf');var config=require(_0xccb3('0x6'));var attributes=require(_0xccb3('0x7'));module[_0xccb3('0x8')]=function(_0x3c02f3,_0x56eec1){return _0x3c02f3[_0xccb3('0x9')](_0xccb3('0xa'),attributes,{'tableName':_0xccb3('0xb'),'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 64cce96..119972b 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 _0x38ec=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x22a672,_0x580495){var _0x2b590e=function(_0x4b1d7a){while(--_0x4b1d7a){_0x22a672['push'](_0x22a672['shift']());}};_0x2b590e(++_0x580495);}(_0x38ec,0x19b));var _0xc38e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x38ec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc38e('0x0'));var util=require(_0xc38e('0x1'));var moment=require('moment');var BPromise=require(_0xc38e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc38e('0x3'));var db=require(_0xc38e('0x4'))['db'];var utils=require(_0xc38e('0x5'));var logger=require(_0xc38e('0x6'))(_0xc38e('0x7'));var config=require(_0xc38e('0x8'));var jayson=require(_0xc38e('0x9'));var client=jayson[_0xc38e('0xa')][_0xc38e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x392b52,_0x5d1347,_0x23e4a7){return new BPromise(function(_0x5930e1,_0x3379e2){return client[_0xc38e('0xc')](_0x392b52,_0x23e4a7)[_0xc38e('0xd')](function(_0x693e4b){logger[_0xc38e('0xe')](_0xc38e('0xf'),_0x5d1347,'request\x20sent');logger[_0xc38e('0x10')](_0xc38e('0x11'),_0x5d1347,_0xc38e('0x12'),JSON[_0xc38e('0x13')](_0x693e4b));if(_0x693e4b['error']){if(_0x693e4b['error']['code']===0x1f4){logger[_0xc38e('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5d1347,_0x693e4b[_0xc38e('0x14')][_0xc38e('0x15')]);return _0x3379e2(_0x693e4b[_0xc38e('0x14')][_0xc38e('0x15')]);}logger['error'](_0xc38e('0xf'),_0x5d1347,_0x693e4b[_0xc38e('0x14')][_0xc38e('0x15')]);return _0x5930e1(_0x693e4b[_0xc38e('0x14')]['message']);}else{logger['info'](_0xc38e('0xf'),_0x5d1347,'request\x20sent');_0x5930e1(_0x693e4b[_0xc38e('0x16')][_0xc38e('0x15')]);}})[_0xc38e('0x17')](function(_0x5ddb87){logger[_0xc38e('0x14')](_0xc38e('0xf'),_0x5d1347,_0x5ddb87);_0x3379e2(_0x5ddb87);});});} \ No newline at end of file +var _0x5fa9=['lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x37c07d,_0xdbdb5f){var _0x10dadc=function(_0x2bafb7){while(--_0x2bafb7){_0x37c07d['push'](_0x37c07d['shift']());}};_0x10dadc(++_0xdbdb5f);}(_0x5fa9,0x6e));var _0x95fa=function(_0x5eb442,_0xe2ae2e){_0x5eb442=_0x5eb442-0x0;var _0x53aad0=_0x5fa9[_0x5eb442];return _0x53aad0;};'use strict';var _=require(_0x95fa('0x0'));var util=require('util');var moment=require(_0x95fa('0x1'));var BPromise=require(_0x95fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95fa('0x3'))['db'];var utils=require(_0x95fa('0x4'));var logger=require(_0x95fa('0x5'))('rpc');var config=require(_0x95fa('0x6'));var jayson=require(_0x95fa('0x7'));var client=jayson[_0x95fa('0x8')][_0x95fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a2e54,_0x42dcb9,_0x3d023d){return new BPromise(function(_0x256ecc,_0x583eb1){return client[_0x95fa('0xa')](_0x3a2e54,_0x3d023d)[_0x95fa('0xb')](function(_0x2ca882){logger['info'](_0x95fa('0xc'),_0x42dcb9,_0x95fa('0xd'));logger[_0x95fa('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x42dcb9,_0x95fa('0xd'),JSON[_0x95fa('0xf')](_0x2ca882));if(_0x2ca882[_0x95fa('0x10')]){if(_0x2ca882['error'][_0x95fa('0x11')]===0x1f4){logger[_0x95fa('0x10')](_0x95fa('0xc'),_0x42dcb9,_0x2ca882[_0x95fa('0x10')]['message']);return _0x583eb1(_0x2ca882[_0x95fa('0x10')][_0x95fa('0x12')]);}logger[_0x95fa('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x42dcb9,_0x2ca882[_0x95fa('0x10')][_0x95fa('0x12')]);return _0x256ecc(_0x2ca882[_0x95fa('0x10')][_0x95fa('0x12')]);}else{logger[_0x95fa('0x13')](_0x95fa('0xc'),_0x42dcb9,_0x95fa('0xd'));_0x256ecc(_0x2ca882[_0x95fa('0x14')][_0x95fa('0x12')]);}})[_0x95fa('0x15')](function(_0xc57748){logger[_0x95fa('0x10')](_0x95fa('0xc'),_0x42dcb9,_0xc57748);_0x583eb1(_0xc57748);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 5c6c67c..d35e572 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 _0x6611=['destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','show','/:id/download','download','post','isAuthenticated','create','put','update','delete'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x6611,0x1bb));var _0x1661=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6611[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x1661('0x0'));var path=require(_0x1661('0x1'));var timeout=require('connect-timeout');var express=require(_0x1661('0x2'));var router=express[_0x1661('0x3')]();var auth=require(_0x1661('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1661('0x5'));var controller=require(_0x1661('0x6'));router[_0x1661('0x7')]('/',auth['isAuthenticated'](),controller[_0x1661('0x8')]);router['get'](_0x1661('0x9'),auth['isAuthenticated'](),controller[_0x1661('0xa')]);router[_0x1661('0x7')](_0x1661('0xb'),auth['isAuthenticated'](),controller[_0x1661('0xc')]);router[_0x1661('0xd')]('/',auth[_0x1661('0xe')](),controller[_0x1661('0xf')]);router[_0x1661('0x10')](_0x1661('0x9'),auth['isAuthenticated'](),controller[_0x1661('0x11')]);router[_0x1661('0x12')](_0x1661('0x9'),auth[_0x1661('0xe')](),controller[_0x1661('0x13')]);module[_0x1661('0x14')]=router; \ No newline at end of file +var _0x2821=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download','post','create','put'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x2821,0x87));var _0x1282=function(_0x16de8c,_0x14386c){_0x16de8c=_0x16de8c-0x0;var _0xe111df=_0x2821[_0x16de8c];return _0xe111df;};'use strict';var multer=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var path=require(_0x1282('0x2'));var timeout=require(_0x1282('0x3'));var express=require(_0x1282('0x4'));var router=express[_0x1282('0x5')]();var auth=require(_0x1282('0x6'));var interaction=require(_0x1282('0x7'));var config=require(_0x1282('0x8'));var controller=require(_0x1282('0x9'));router[_0x1282('0xa')]('/',auth['isAuthenticated'](),controller[_0x1282('0xb')]);router[_0x1282('0xa')](_0x1282('0xc'),auth[_0x1282('0xd')](),controller[_0x1282('0xe')]);router[_0x1282('0xa')](_0x1282('0xf'),auth[_0x1282('0xd')](),controller['download']);router[_0x1282('0x10')]('/',auth[_0x1282('0xd')](),controller[_0x1282('0x11')]);router[_0x1282('0x12')](_0x1282('0xc'),auth['isAuthenticated'](),controller[_0x1282('0x13')]);router[_0x1282('0x14')]('/:id',auth[_0x1282('0xd')](),controller[_0x1282('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 9a26f71..c4c2139 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x431f56,_0x47ff4e){var _0x494a3c=function(_0xb161fa){while(--_0xb161fa){_0x431f56['push'](_0x431f56['shift']());}};_0x494a3c(++_0x47ff4e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x189de6,_0x225aae){var _0x612ae3=function(_0x1d6a2e){while(--_0x1d6a2e){_0x189de6['push'](_0x189de6['shift']());}};_0x612ae3(++_0x225aae);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index da96621..7755e43 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 _0x5d37=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','transaction','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3b4619,_0x40276d){var _0x53fff1=function(_0x5e4ab0){while(--_0x5e4ab0){_0x3b4619['push'](_0x3b4619['shift']());}};_0x53fff1(++_0x40276d);}(_0x5d37,0x135));var _0x75d3=function(_0x886f57,_0xcb8f9e){_0x886f57=_0x886f57-0x0;var _0x3a018c=_0x5d37[_0x886f57];return _0x3a018c;};'use strict';var pdf=require(_0x75d3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x75d3('0x1'));var zipdir=require(_0x75d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75d3('0x3'));var moment=require(_0x75d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x75d3('0x5'));var util=require(_0x75d3('0x6'));var path=require(_0x75d3('0x7'));var sox=require(_0x75d3('0x8'));var csv=require(_0x75d3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x75d3('0xa'));var squel=require(_0x75d3('0xb'));var crypto=require(_0x75d3('0xc'));var jsforce=require(_0x75d3('0xd'));var deskjs=require(_0x75d3('0xe'));var toCsv=require(_0x75d3('0x9'));var querystring=require(_0x75d3('0xf'));var Papa=require(_0x75d3('0x10'));var Redis=require(_0x75d3('0x11'));var authService=require(_0x75d3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x75d3('0x13'));var hardwareService=require(_0x75d3('0x14'));var logger=require(_0x75d3('0x15'))(_0x75d3('0x16'));var utils=require('../../config/utils');var config=require(_0x75d3('0x17'));var db=require(_0x75d3('0x18'))['db'];function respondWithStatusCode(_0x1cf720,_0x559713){_0x559713=_0x559713||0xcc;return function(_0x332ac8){if(_0x332ac8){return _0x1cf720['sendStatus'](_0x559713);}return _0x1cf720[_0x75d3('0x19')](_0x559713)[_0x75d3('0x1a')]();};}function respondWithResult(_0x514d7d,_0x29a766){_0x29a766=_0x29a766||0xc8;return function(_0x50d049){if(_0x50d049){return _0x514d7d['status'](_0x29a766)['json'](_0x50d049);}};}function respondWithFilteredResult(_0x3bd5ae,_0x13c72a){return function(_0x45506f){if(_0x45506f){var _0x1b0176=_0x45506f['count'],_0x4f7b9d=_0x13c72a[_0x75d3('0x1b')],_0x472865=_0x13c72a[_0x75d3('0x1b')]+_0x13c72a[_0x75d3('0x1c')],_0xbd65b;if(_0x472865>=_0x1b0176){_0x472865=_0x1b0176;_0xbd65b=0xc8;}else{_0xbd65b=0xce;}_0x3bd5ae[_0x75d3('0x19')](_0xbd65b);return _0x3bd5ae['set'](_0x75d3('0x1d'),_0x4f7b9d+'-'+_0x472865+'/'+_0x1b0176)[_0x75d3('0x1e')](_0x45506f);}return null;};}function patchUpdates(_0x40d8da){return function(_0x2aeccc){try{jsonpatch[_0x75d3('0x1f')](_0x2aeccc,_0x40d8da,!![]);}catch(_0x45638d){return BPromise[_0x75d3('0x20')](_0x45638d);}return _0x2aeccc[_0x75d3('0x21')]();};}function saveUpdates(_0x35c9f9,_0x293544){return function(_0x194c00){if(_0x194c00){return _0x194c00[_0x75d3('0x22')](_0x35c9f9)[_0x75d3('0x23')](function(_0x599313){return _0x599313;});}return null;};}function removeEntity(_0x2c36e5,_0x24a03a){return function(_0xca37c0){if(_0xca37c0){return _0xca37c0[_0x75d3('0x24')]()[_0x75d3('0x23')](function(){_0x2c36e5[_0x75d3('0x19')](0xcc)[_0x75d3('0x1a')]();});}};}function handleEntityNotFound(_0x7e3e5b,_0x3cb9ce){return function(_0x39d40e){if(!_0x39d40e){_0x7e3e5b['sendStatus'](0x194);}return _0x39d40e;};}function handleError(_0x317e73,_0x2f798b){_0x2f798b=_0x2f798b||0x1f4;return function(_0x3ae72d){logger[_0x75d3('0x25')](_0x3ae72d[_0x75d3('0x26')]);if(_0x3ae72d[_0x75d3('0x27')]){delete _0x3ae72d[_0x75d3('0x27')];}_0x317e73[_0x75d3('0x19')](_0x2f798b)[_0x75d3('0x28')](_0x3ae72d);};}exports[_0x75d3('0x29')]=function(_0x1fbc66,_0x32ec0b){var _0xf51033={},_0x4d6a99={},_0x53e043={'count':0x0,'rows':[]};var _0x423973=_['map'](db[_0x75d3('0x2a')][_0x75d3('0x2b')],function(_0x566917){return{'name':_0x566917[_0x75d3('0x2c')],'type':_0x566917['type'][_0x75d3('0x2d')]};});_0x4d6a99[_0x75d3('0x2e')]=_['map'](_0x423973,_0x75d3('0x27'));_0x4d6a99[_0x75d3('0x2f')]=_['keys'](_0x1fbc66[_0x75d3('0x2f')]);_0x4d6a99[_0x75d3('0x30')]=_[_0x75d3('0x31')](_0x4d6a99['model'],_0x4d6a99[_0x75d3('0x2f')]);_0xf51033['attributes']=_[_0x75d3('0x31')](_0x4d6a99['model'],qs[_0x75d3('0x32')](_0x1fbc66[_0x75d3('0x2f')]['fields']));_0xf51033[_0x75d3('0x33')]=_0xf51033[_0x75d3('0x33')][_0x75d3('0x34')]?_0xf51033[_0x75d3('0x33')]:_0x4d6a99[_0x75d3('0x2e')];if(!_0x1fbc66[_0x75d3('0x2f')][_0x75d3('0x35')](_0x75d3('0x36'))){_0xf51033[_0x75d3('0x1c')]=qs[_0x75d3('0x1c')](_0x1fbc66[_0x75d3('0x2f')]['limit']);_0xf51033[_0x75d3('0x1b')]=qs[_0x75d3('0x1b')](_0x1fbc66[_0x75d3('0x2f')][_0x75d3('0x1b')]);}_0xf51033[_0x75d3('0x37')]=qs[_0x75d3('0x38')](_0x1fbc66[_0x75d3('0x2f')][_0x75d3('0x38')]);_0xf51033['where']=qs[_0x75d3('0x30')](_[_0x75d3('0x39')](_0x1fbc66['query'],_0x4d6a99['filters']),_0x423973);if(_0x1fbc66[_0x75d3('0x2f')][_0x75d3('0x3a')]){_0xf51033[_0x75d3('0x3b')]=_[_0x75d3('0x3c')](_0xf51033[_0x75d3('0x3b')],{'$or':_[_0x75d3('0x3d')](_0x423973,function(_0x3903a4){if(_0x3903a4[_0x75d3('0x3e')]!==_0x75d3('0x3f')){var _0x481c66={};_0x481c66[_0x3903a4[_0x75d3('0x27')]]={'$like':'%'+_0x1fbc66['query'][_0x75d3('0x3a')]+'%'};return _0x481c66;}})});}_0xf51033=_[_0x75d3('0x3c')]({},_0xf51033,_0x1fbc66[_0x75d3('0x40')]);var _0x2624ef={'where':_0xf51033['where']};return db['AnalyticFieldReport'][_0x75d3('0x41')](_0x2624ef)[_0x75d3('0x23')](function(_0x3c4a03){_0x53e043[_0x75d3('0x41')]=_0x3c4a03;if(_0x1fbc66[_0x75d3('0x2f')][_0x75d3('0x42')]){_0xf51033[_0x75d3('0x43')]=[{'all':!![]}];}return db[_0x75d3('0x2a')][_0x75d3('0x44')](_0xf51033);})[_0x75d3('0x23')](function(_0x374c59){_0x53e043[_0x75d3('0x45')]=_0x374c59;return _0x53e043;})[_0x75d3('0x23')](respondWithFilteredResult(_0x32ec0b,_0xf51033))[_0x75d3('0x46')](handleError(_0x32ec0b,null));};exports['show']=function(_0x31fb8e,_0x4d813c){var _0x5e9aa4={'raw':![],'where':{'id':_0x31fb8e[_0x75d3('0x47')]['id']}},_0x5813f1={};_0x5813f1['model']=_['keys'](db['AnalyticFieldReport'][_0x75d3('0x2b')]);_0x5813f1[_0x75d3('0x2f')]=_[_0x75d3('0x48')](_0x31fb8e['query']);_0x5813f1[_0x75d3('0x30')]=_[_0x75d3('0x31')](_0x5813f1[_0x75d3('0x2e')],_0x5813f1['query']);_0x5e9aa4[_0x75d3('0x33')]=_[_0x75d3('0x31')](_0x5813f1[_0x75d3('0x2e')],qs['fields'](_0x31fb8e[_0x75d3('0x2f')]['fields']));_0x5e9aa4[_0x75d3('0x33')]=_0x5e9aa4[_0x75d3('0x33')]['length']?_0x5e9aa4[_0x75d3('0x33')]:_0x5813f1[_0x75d3('0x2e')];if(_0x31fb8e[_0x75d3('0x2f')][_0x75d3('0x42')]){_0x5e9aa4[_0x75d3('0x43')]=[{'all':!![]}];}_0x5e9aa4=_[_0x75d3('0x3c')]({},_0x5e9aa4,_0x31fb8e[_0x75d3('0x40')]);return db[_0x75d3('0x2a')][_0x75d3('0x49')](_0x5e9aa4)[_0x75d3('0x23')](handleEntityNotFound(_0x4d813c,null))[_0x75d3('0x23')](respondWithResult(_0x4d813c,null))['catch'](handleError(_0x4d813c,null));};exports[_0x75d3('0x4a')]=function(_0x3b8a23,_0x275d37){return db['AnalyticFieldReport'][_0x75d3('0x4a')](_0x3b8a23[_0x75d3('0x4b')],{})[_0x75d3('0x23')](respondWithResult(_0x275d37,0xc9))[_0x75d3('0x46')](handleError(_0x275d37,null));};exports['bulkCreate']=function(_0x5ab7f7,_0x276878){return db[_0x75d3('0x2a')][_0x75d3('0x4c')](_0x5ab7f7[_0x75d3('0x4b')],{'raw':![],'individualHooks':!![]})[_0x75d3('0x23')](respondWithResult(_0x276878,0xc9))['catch'](handleError(_0x276878,null));};exports[_0x75d3('0x22')]=function(_0x14005c,_0x117289){if(_0x14005c['body']['id']){delete _0x14005c[_0x75d3('0x4b')]['id'];}return db[_0x75d3('0x2a')][_0x75d3('0x49')]({'where':{'id':_0x14005c[_0x75d3('0x47')]['id']}})[_0x75d3('0x23')](handleEntityNotFound(_0x117289,null))['then'](saveUpdates(_0x14005c[_0x75d3('0x4b')],null))['then'](respondWithResult(_0x117289,null))[_0x75d3('0x46')](handleError(_0x117289,null));};exports['destroy']=function(_0x1184ff,_0x243f95){return db['AnalyticFieldReport']['find']({'where':{'id':_0x1184ff[_0x75d3('0x47')]['id']}})[_0x75d3('0x23')](handleEntityNotFound(_0x243f95,null))[_0x75d3('0x23')](removeEntity(_0x243f95,null))['catch'](handleError(_0x243f95,null));};exports[_0x75d3('0x4d')]=function(_0x1275c1,_0x391ec0){return db[_0x75d3('0x2a')][_0x75d3('0x24')]({'where':{'id':_0x1275c1[_0x75d3('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x75d3('0x23')](respondWithResult(_0x391ec0,0xcc))['catch'](handleError(_0x391ec0,null));};exports[_0x75d3('0x4e')]=function(_0x477138,_0x2eeec1,_0x4f3a0f){return db[_0x75d3('0x4f')][_0x75d3('0x50')]({'where':{'id':_0x477138[_0x75d3('0x47')]['id']}})[_0x75d3('0x23')](handleEntityNotFound(_0x2eeec1,null))[_0x75d3('0x23')](function(_0x21ddf0){if(_0x21ddf0){return db['sequelize'][_0x75d3('0x51')](function(_0x370505){return db['AnalyticFieldReport'][_0x75d3('0x24')]({'where':{'CustomReportId':_0x477138[_0x75d3('0x47')]['id']},'transaction':_0x370505})[_0x75d3('0x23')](function(_0x2cb4e4){var _0x53712c=_[_0x75d3('0x3d')](_0x477138[_0x75d3('0x4b')],function(_0x207e6d){delete _0x207e6d['id'];_0x207e6d['CustomReportId']=_0x477138['params']['id'];return _0x207e6d;});return db[_0x75d3('0x2a')][_0x75d3('0x4c')](_0x53712c,{'transaction':_0x370505});});})[_0x75d3('0x23')](function(){return db[_0x75d3('0x2a')]['findAll']({'where':{'CustomReportId':_0x477138['params']['id']}});});}})['then'](respondWithResult(_0x2eeec1,null))['catch'](handleError(_0x2eeec1,null));}; \ No newline at end of file +var _0x0773=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','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','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','keys','include','find','catch','create','bulkCreate','body','bulkDestroy','addFields','findOne','sequelize','transaction','CustomReportId','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0773,0xa1));var _0x3077=function(_0x1dcea9,_0x16e207){_0x1dcea9=_0x1dcea9-0x0;var _0x8d4f0b=_0x0773[_0x1dcea9];return _0x8d4f0b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3077('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3077('0x1'));var jsonpatch=require(_0x3077('0x2'));var rp=require('request-promise');var moment=require(_0x3077('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3077('0x4'));var util=require(_0x3077('0x5'));var path=require(_0x3077('0x6'));var sox=require(_0x3077('0x7'));var csv=require(_0x3077('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3077('0x9'));var squel=require(_0x3077('0xa'));var crypto=require(_0x3077('0xb'));var jsforce=require(_0x3077('0xc'));var deskjs=require(_0x3077('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3077('0xe'));var Papa=require(_0x3077('0xf'));var Redis=require('ioredis');var authService=require(_0x3077('0x10'));var qs=require(_0x3077('0x11'));var as=require(_0x3077('0x12'));var hardwareService=require(_0x3077('0x13'));var logger=require(_0x3077('0x14'))(_0x3077('0x15'));var utils=require(_0x3077('0x16'));var config=require(_0x3077('0x17'));var db=require(_0x3077('0x18'))['db'];function respondWithStatusCode(_0x468a31,_0x157267){_0x157267=_0x157267||0xcc;return function(_0x3280f0){if(_0x3280f0){return _0x468a31[_0x3077('0x19')](_0x157267);}return _0x468a31[_0x3077('0x1a')](_0x157267)['end']();};}function respondWithResult(_0x39a275,_0x83a5f5){_0x83a5f5=_0x83a5f5||0xc8;return function(_0xfb0580){if(_0xfb0580){return _0x39a275['status'](_0x83a5f5)[_0x3077('0x1b')](_0xfb0580);}};}function respondWithFilteredResult(_0x24cad1,_0xb9caea){return function(_0x46583d){if(_0x46583d){var _0x59e8aa=_0x46583d[_0x3077('0x1c')],_0x2a039b=_0xb9caea[_0x3077('0x1d')],_0x46c3ea=_0xb9caea[_0x3077('0x1d')]+_0xb9caea[_0x3077('0x1e')],_0x549ed2;if(_0x46c3ea>=_0x59e8aa){_0x46c3ea=_0x59e8aa;_0x549ed2=0xc8;}else{_0x549ed2=0xce;}_0x24cad1[_0x3077('0x1a')](_0x549ed2);return _0x24cad1['set'](_0x3077('0x1f'),_0x2a039b+'-'+_0x46c3ea+'/'+_0x59e8aa)[_0x3077('0x1b')](_0x46583d);}return null;};}function patchUpdates(_0xffacee){return function(_0x1ee9a6){try{jsonpatch[_0x3077('0x20')](_0x1ee9a6,_0xffacee,!![]);}catch(_0x44390b){return BPromise[_0x3077('0x21')](_0x44390b);}return _0x1ee9a6[_0x3077('0x22')]();};}function saveUpdates(_0x5c3b6d,_0x2df1fb){return function(_0xac516d){if(_0xac516d){return _0xac516d[_0x3077('0x23')](_0x5c3b6d)[_0x3077('0x24')](function(_0x573666){return _0x573666;});}return null;};}function removeEntity(_0x4f66dd,_0x17fc77){return function(_0x143993){if(_0x143993){return _0x143993[_0x3077('0x25')]()[_0x3077('0x24')](function(){_0x4f66dd[_0x3077('0x1a')](0xcc)[_0x3077('0x26')]();});}};}function handleEntityNotFound(_0x4982aa,_0x31e581){return function(_0x9292f7){if(!_0x9292f7){_0x4982aa['sendStatus'](0x194);}return _0x9292f7;};}function handleError(_0x4e99a6,_0x5ce7db){_0x5ce7db=_0x5ce7db||0x1f4;return function(_0x3bf388){logger[_0x3077('0x27')](_0x3bf388[_0x3077('0x28')]);if(_0x3bf388['name']){delete _0x3bf388[_0x3077('0x29')];}_0x4e99a6['status'](_0x5ce7db)[_0x3077('0x2a')](_0x3bf388);};}exports[_0x3077('0x2b')]=function(_0x5ee2fa,_0x1e1d8b){var _0x54c0d4={},_0x4adbc8={},_0x11283b={'count':0x0,'rows':[]};var _0x218e16=_[_0x3077('0x2c')](db[_0x3077('0x2d')][_0x3077('0x2e')],function(_0x28a343){return{'name':_0x28a343['fieldName'],'type':_0x28a343[_0x3077('0x2f')]['key']};});_0x4adbc8[_0x3077('0x30')]=_[_0x3077('0x2c')](_0x218e16,'name');_0x4adbc8[_0x3077('0x31')]=_['keys'](_0x5ee2fa[_0x3077('0x31')]);_0x4adbc8['filters']=_[_0x3077('0x32')](_0x4adbc8[_0x3077('0x30')],_0x4adbc8[_0x3077('0x31')]);_0x54c0d4[_0x3077('0x33')]=_['intersection'](_0x4adbc8[_0x3077('0x30')],qs[_0x3077('0x34')](_0x5ee2fa[_0x3077('0x31')][_0x3077('0x34')]));_0x54c0d4[_0x3077('0x33')]=_0x54c0d4[_0x3077('0x33')][_0x3077('0x35')]?_0x54c0d4[_0x3077('0x33')]:_0x4adbc8['model'];if(!_0x5ee2fa[_0x3077('0x31')][_0x3077('0x36')](_0x3077('0x37'))){_0x54c0d4[_0x3077('0x1e')]=qs['limit'](_0x5ee2fa['query'][_0x3077('0x1e')]);_0x54c0d4[_0x3077('0x1d')]=qs['offset'](_0x5ee2fa['query'][_0x3077('0x1d')]);}_0x54c0d4['order']=qs[_0x3077('0x38')](_0x5ee2fa[_0x3077('0x31')][_0x3077('0x38')]);_0x54c0d4[_0x3077('0x39')]=qs[_0x3077('0x3a')](_[_0x3077('0x3b')](_0x5ee2fa[_0x3077('0x31')],_0x4adbc8['filters']),_0x218e16);if(_0x5ee2fa[_0x3077('0x31')][_0x3077('0x3c')]){_0x54c0d4['where']=_[_0x3077('0x3d')](_0x54c0d4[_0x3077('0x39')],{'$or':_[_0x3077('0x2c')](_0x218e16,function(_0x388274){if(_0x388274[_0x3077('0x2f')]!==_0x3077('0x3e')){var _0x507913={};_0x507913[_0x388274['name']]={'$like':'%'+_0x5ee2fa['query']['filter']+'%'};return _0x507913;}})});}_0x54c0d4=_[_0x3077('0x3d')]({},_0x54c0d4,_0x5ee2fa[_0x3077('0x3f')]);var _0x5eff83={'where':_0x54c0d4[_0x3077('0x39')]};return db[_0x3077('0x2d')][_0x3077('0x1c')](_0x5eff83)[_0x3077('0x24')](function(_0x2af8fa){_0x11283b[_0x3077('0x1c')]=_0x2af8fa;if(_0x5ee2fa['query']['includeAll']){_0x54c0d4['include']=[{'all':!![]}];}return db[_0x3077('0x2d')][_0x3077('0x40')](_0x54c0d4);})[_0x3077('0x24')](function(_0x24ea09){_0x11283b[_0x3077('0x41')]=_0x24ea09;return _0x11283b;})[_0x3077('0x24')](respondWithFilteredResult(_0x1e1d8b,_0x54c0d4))['catch'](handleError(_0x1e1d8b,null));};exports[_0x3077('0x42')]=function(_0x4b4232,_0x2c2eaf){var _0x147650={'raw':![],'where':{'id':_0x4b4232[_0x3077('0x43')]['id']}},_0x41ab7c={};_0x41ab7c[_0x3077('0x30')]=_['keys'](db[_0x3077('0x2d')][_0x3077('0x2e')]);_0x41ab7c[_0x3077('0x31')]=_[_0x3077('0x44')](_0x4b4232[_0x3077('0x31')]);_0x41ab7c[_0x3077('0x3a')]=_[_0x3077('0x32')](_0x41ab7c['model'],_0x41ab7c[_0x3077('0x31')]);_0x147650[_0x3077('0x33')]=_[_0x3077('0x32')](_0x41ab7c['model'],qs[_0x3077('0x34')](_0x4b4232[_0x3077('0x31')][_0x3077('0x34')]));_0x147650[_0x3077('0x33')]=_0x147650[_0x3077('0x33')][_0x3077('0x35')]?_0x147650[_0x3077('0x33')]:_0x41ab7c['model'];if(_0x4b4232[_0x3077('0x31')]['includeAll']){_0x147650[_0x3077('0x45')]=[{'all':!![]}];}_0x147650=_[_0x3077('0x3d')]({},_0x147650,_0x4b4232[_0x3077('0x3f')]);return db[_0x3077('0x2d')][_0x3077('0x46')](_0x147650)[_0x3077('0x24')](handleEntityNotFound(_0x2c2eaf,null))[_0x3077('0x24')](respondWithResult(_0x2c2eaf,null))[_0x3077('0x47')](handleError(_0x2c2eaf,null));};exports['create']=function(_0x247b5f,_0x4a88f6){return db['AnalyticFieldReport'][_0x3077('0x48')](_0x247b5f['body'],{})[_0x3077('0x24')](respondWithResult(_0x4a88f6,0xc9))['catch'](handleError(_0x4a88f6,null));};exports[_0x3077('0x49')]=function(_0x57b236,_0x504398){return db[_0x3077('0x2d')]['bulkCreate'](_0x57b236[_0x3077('0x4a')],{'raw':![],'individualHooks':!![]})[_0x3077('0x24')](respondWithResult(_0x504398,0xc9))[_0x3077('0x47')](handleError(_0x504398,null));};exports['update']=function(_0x3f9cc9,_0x353251){if(_0x3f9cc9['body']['id']){delete _0x3f9cc9['body']['id'];}return db[_0x3077('0x2d')][_0x3077('0x46')]({'where':{'id':_0x3f9cc9[_0x3077('0x43')]['id']}})['then'](handleEntityNotFound(_0x353251,null))[_0x3077('0x24')](saveUpdates(_0x3f9cc9['body'],null))['then'](respondWithResult(_0x353251,null))[_0x3077('0x47')](handleError(_0x353251,null));};exports[_0x3077('0x25')]=function(_0x390869,_0x5dd783){return db[_0x3077('0x2d')][_0x3077('0x46')]({'where':{'id':_0x390869[_0x3077('0x43')]['id']}})['then'](handleEntityNotFound(_0x5dd783,null))['then'](removeEntity(_0x5dd783,null))[_0x3077('0x47')](handleError(_0x5dd783,null));};exports[_0x3077('0x4b')]=function(_0x699dde,_0x3d41b8){return db[_0x3077('0x2d')]['destroy']({'where':{'id':_0x699dde['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x3077('0x24')](respondWithResult(_0x3d41b8,0xcc))['catch'](handleError(_0x3d41b8,null));};exports[_0x3077('0x4c')]=function(_0x10b699,_0x749575,_0x1287c4){return db['AnalyticCustomReport'][_0x3077('0x4d')]({'where':{'id':_0x10b699[_0x3077('0x43')]['id']}})[_0x3077('0x24')](handleEntityNotFound(_0x749575,null))[_0x3077('0x24')](function(_0x3471ae){if(_0x3471ae){return db[_0x3077('0x4e')][_0x3077('0x4f')](function(_0x57be9a){return db[_0x3077('0x2d')]['destroy']({'where':{'CustomReportId':_0x10b699[_0x3077('0x43')]['id']},'transaction':_0x57be9a})[_0x3077('0x24')](function(_0x599b32){var _0x485e6a=_[_0x3077('0x2c')](_0x10b699[_0x3077('0x4a')],function(_0x3fb6b6){delete _0x3fb6b6['id'];_0x3fb6b6[_0x3077('0x50')]=_0x10b699[_0x3077('0x43')]['id'];return _0x3fb6b6;});return db[_0x3077('0x2d')][_0x3077('0x49')](_0x485e6a,{'transaction':_0x57be9a});});})[_0x3077('0x24')](function(){return db['AnalyticFieldReport'][_0x3077('0x40')]({'where':{'CustomReportId':_0x10b699['params']['id']}});});}})['then'](respondWithResult(_0x749575,null))[_0x3077('0x47')](handleError(_0x749575,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 8d05ee4..6c5b6c0 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 _0x4185=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','AnalyticFieldReport','util'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x4185,0x1b7));var _0x5418=function(_0x3dd338,_0x5ecec6){_0x3dd338=_0x3dd338-0x0;var _0x1572a2=_0x4185[_0x3dd338];return _0x1572a2;};'use strict';var _=require('lodash');var util=require(_0x5418('0x0'));var logger=require(_0x5418('0x1'))(_0x5418('0x2'));var moment=require(_0x5418('0x3'));var BPromise=require(_0x5418('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5418('0x5'));var rimraf=require('rimraf');var config=require(_0x5418('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x5418('0x7')]=function(_0x3e4002,_0x5077bc){return _0x3e4002[_0x5418('0x8')](_0x5418('0x9'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3176=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','analytics_report_fields','lodash','util'];(function(_0x5e987a,_0x1970a0){var _0x16d654=function(_0x2562ae){while(--_0x2562ae){_0x5e987a['push'](_0x5e987a['shift']());}};_0x16d654(++_0x1970a0);}(_0x3176,0x152));var _0x6317=function(_0x535f29,_0x3e9437){_0x535f29=_0x535f29-0x0;var _0x3e77ed=_0x3176[_0x535f29];return _0x3e77ed;};'use strict';var _=require(_0x6317('0x0'));var util=require(_0x6317('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6317('0x2'));var rp=require(_0x6317('0x3'));var fs=require('fs');var path=require(_0x6317('0x4'));var rimraf=require(_0x6317('0x5'));var config=require(_0x6317('0x6'));var attributes=require(_0x6317('0x7'));module[_0x6317('0x8')]=function(_0x4fe3d0,_0x30f82d){return _0x4fe3d0['define']('AnalyticFieldReport',attributes,{'tableName':_0x6317('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 22dd61d..e3c2b51 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 _0x7f2e=['message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x8f4554,_0x97e1f8){var _0x2b7465=function(_0x5d8390){while(--_0x5d8390){_0x8f4554['push'](_0x8f4554['shift']());}};_0x2b7465(++_0x97e1f8);}(_0x7f2e,0x1ce));var _0xe7f2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7f2e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe7f2('0x0'));var util=require(_0xe7f2('0x1'));var moment=require(_0xe7f2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7f2('0x4'))['db'];var utils=require(_0xe7f2('0x5'));var logger=require(_0xe7f2('0x6'))(_0xe7f2('0x7'));var config=require('../../config/environment');var jayson=require(_0xe7f2('0x8'));var client=jayson['client'][_0xe7f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2716b4,_0x15f371,_0x5652a3){return new BPromise(function(_0x1d470e,_0x22012e){return client['request'](_0x2716b4,_0x5652a3)[_0xe7f2('0xa')](function(_0x129312){logger[_0xe7f2('0xb')](_0xe7f2('0xc'),_0x15f371,_0xe7f2('0xd'));logger[_0xe7f2('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x15f371,'request\x20sent',JSON[_0xe7f2('0xf')](_0x129312));if(_0x129312[_0xe7f2('0x10')]){if(_0x129312[_0xe7f2('0x10')][_0xe7f2('0x11')]===0x1f4){logger[_0xe7f2('0x10')](_0xe7f2('0xc'),_0x15f371,_0x129312[_0xe7f2('0x10')][_0xe7f2('0x12')]);return _0x22012e(_0x129312[_0xe7f2('0x10')]['message']);}logger[_0xe7f2('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x15f371,_0x129312[_0xe7f2('0x10')]['message']);return _0x1d470e(_0x129312[_0xe7f2('0x10')][_0xe7f2('0x12')]);}else{logger[_0xe7f2('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x15f371,_0xe7f2('0xd'));_0x1d470e(_0x129312[_0xe7f2('0x13')][_0xe7f2('0x12')]);}})['catch'](function(_0x519d8d){logger[_0xe7f2('0x10')](_0xe7f2('0xc'),_0x15f371,_0x519d8d);_0x22012e(_0x519d8d);});});} \ No newline at end of file +var _0x7037=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x7037,0x1eb));var _0x7703=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x7037[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x7703('0x0'));var util=require(_0x7703('0x1'));var moment=require(_0x7703('0x2'));var BPromise=require(_0x7703('0x3'));var rs=require(_0x7703('0x4'));var fs=require('fs');var Redis=require(_0x7703('0x5'));var db=require(_0x7703('0x6'))['db'];var utils=require(_0x7703('0x7'));var logger=require(_0x7703('0x8'))(_0x7703('0x9'));var config=require(_0x7703('0xa'));var jayson=require(_0x7703('0xb'));var client=jayson[_0x7703('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42c85f,_0x14bf29,_0x2bc8b3){return new BPromise(function(_0x588dcf,_0x2cbd16){return client[_0x7703('0xd')](_0x42c85f,_0x2bc8b3)[_0x7703('0xe')](function(_0x379abd){logger[_0x7703('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x14bf29,_0x7703('0x10'));logger[_0x7703('0x11')](_0x7703('0x12'),_0x14bf29,_0x7703('0x10'),JSON[_0x7703('0x13')](_0x379abd));if(_0x379abd[_0x7703('0x14')]){if(_0x379abd[_0x7703('0x14')][_0x7703('0x15')]===0x1f4){logger[_0x7703('0x14')](_0x7703('0x16'),_0x14bf29,_0x379abd[_0x7703('0x14')]['message']);return _0x2cbd16(_0x379abd[_0x7703('0x14')][_0x7703('0x17')]);}logger[_0x7703('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0x14bf29,_0x379abd[_0x7703('0x14')][_0x7703('0x17')]);return _0x588dcf(_0x379abd['error'][_0x7703('0x17')]);}else{logger[_0x7703('0xf')](_0x7703('0x16'),_0x14bf29,'request\x20sent');_0x588dcf(_0x379abd['result'][_0x7703('0x17')]);}})[_0x7703('0x18')](function(_0x328e21){logger[_0x7703('0x14')](_0x7703('0x16'),_0x14bf29,_0x328e21);_0x2cbd16(_0x328e21);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 2b48f55..3cf906c 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(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x55ca,0x126));var _0xa55c=function(_0x412b2a,_0x11fb8a){_0x412b2a=_0x412b2a-0x0;var _0x5872e3=_0x55ca[_0x412b2a];return _0x5872e3;};'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 _0x3e74=['./analyticFieldReport.controller','get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','addFields','/:id','delete','/destroy_many','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x7f6bc8,_0x98c3bf){var _0xb899c7=function(_0x334535){while(--_0x334535){_0x7f6bc8['push'](_0x7f6bc8['shift']());}};_0xb899c7(++_0x98c3bf);}(_0x3e74,0x175));var _0x43e7=function(_0x3b2992,_0x3e38e8){_0x3b2992=_0x3b2992-0x0;var _0x5f0713=_0x3e74[_0x3b2992];return _0x5f0713;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['post'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x43e7('0xa')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['put'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0x11'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x13')]);module[_0x43e7('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 28857b4..a44174e 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 _0x2c5b=['name','sequelize','STRING'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x2c5b,0x193));var _0xb2c5=function(_0x3f938a,_0x59fff1){_0x3f938a=_0x3f938a-0x0;var _0x500d6a=_0x2c5b[_0x3f938a];return _0x500d6a;};'use strict';var Sequelize=require(_0xb2c5('0x0'));module['exports']={'name':{'type':Sequelize[_0xb2c5('0x1')],'allowNull':![],'unique':_0xb2c5('0x2')},'table':{'type':Sequelize[_0xb2c5('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1cf3=['TEXT','sequelize','exports','STRING','name'];(function(_0x34366a,_0x557e46){var _0x48acc7=function(_0x5413a3){while(--_0x5413a3){_0x34366a['push'](_0x34366a['shift']());}};_0x48acc7(++_0x557e46);}(_0x1cf3,0x1be));var _0x31cf=function(_0x49c073,_0x38f995){_0x49c073=_0x49c073-0x0;var _0x165908=_0x1cf3[_0x49c073];return _0x165908;};'use strict';var Sequelize=require(_0x31cf('0x0'));module[_0x31cf('0x1')]={'name':{'type':Sequelize[_0x31cf('0x2')],'allowNull':![],'unique':_0x31cf('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x31cf('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 17e0a9d..14be35c 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 _0x0120=['fields','length','hasOwnProperty','nolimit','sort','where','pick','type','filter','merge','options','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','Metrics','end','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','key','model','query','filters','intersection','attributes'];(function(_0x594aaf,_0x4a9273){var _0x2692aa=function(_0x417e46){while(--_0x417e46){_0x594aaf['push'](_0x594aaf['shift']());}};_0x2692aa(++_0x4a9273);}(_0x0120,0x6f));var _0x0012=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0120[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x0012('0x0'));var emlformat=require(_0x0012('0x1'));var rimraf=require(_0x0012('0x2'));var zipdir=require(_0x0012('0x3'));var jsonpatch=require(_0x0012('0x4'));var rp=require(_0x0012('0x5'));var moment=require(_0x0012('0x6'));var BPromise=require(_0x0012('0x7'));var Mustache=require(_0x0012('0x8'));var util=require(_0x0012('0x9'));var path=require(_0x0012('0xa'));var sox=require(_0x0012('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0012('0xc'));var crypto=require(_0x0012('0xd'));var jsforce=require(_0x0012('0xe'));var deskjs=require(_0x0012('0xf'));var toCsv=require(_0x0012('0x10'));var querystring=require('querystring');var Papa=require(_0x0012('0x11'));var Redis=require(_0x0012('0x12'));var authService=require(_0x0012('0x13'));var qs=require(_0x0012('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x15'));var logger=require('../../config/logger')(_0x0012('0x16'));var utils=require(_0x0012('0x17'));var config=require(_0x0012('0x18'));var db=require(_0x0012('0x19'))['db'];function respondWithStatusCode(_0x2451b5,_0x4d3e7a){_0x4d3e7a=_0x4d3e7a||0xcc;return function(_0x6d4a1a){if(_0x6d4a1a){return _0x2451b5['sendStatus'](_0x4d3e7a);}return _0x2451b5['status'](_0x4d3e7a)['end']();};}function respondWithResult(_0x5563fc,_0x3a7d50){_0x3a7d50=_0x3a7d50||0xc8;return function(_0x496a2b){if(_0x496a2b){return _0x5563fc[_0x0012('0x1a')](_0x3a7d50)[_0x0012('0x1b')](_0x496a2b);}};}function respondWithFilteredResult(_0x47a6ef,_0x24f4ed){return function(_0x1a0c0d){if(_0x1a0c0d){var _0x348810=_0x1a0c0d[_0x0012('0x1c')],_0x3b8dfc=_0x24f4ed[_0x0012('0x1d')],_0x522e9b=_0x24f4ed[_0x0012('0x1d')]+_0x24f4ed[_0x0012('0x1e')],_0x4e72da;if(_0x522e9b>=_0x348810){_0x522e9b=_0x348810;_0x4e72da=0xc8;}else{_0x4e72da=0xce;}_0x47a6ef[_0x0012('0x1a')](_0x4e72da);return _0x47a6ef[_0x0012('0x1f')](_0x0012('0x20'),_0x3b8dfc+'-'+_0x522e9b+'/'+_0x348810)[_0x0012('0x1b')](_0x1a0c0d);}return null;};}function patchUpdates(_0x5b236f){return function(_0x226968){try{jsonpatch[_0x0012('0x21')](_0x226968,_0x5b236f,!![]);}catch(_0x5797dd){return BPromise[_0x0012('0x22')](_0x5797dd);}return _0x226968[_0x0012('0x23')]();};}function saveUpdates(_0xa2e623,_0x2c837e){return function(_0x53ac2d){if(_0x53ac2d){return _0x53ac2d['update'](_0xa2e623)[_0x0012('0x24')](function(_0x1c6583){return _0x1c6583;});}return null;};}function removeEntity(_0x35f9ee,_0x7177bc){return function(_0x190f07){if(_0x190f07){return _0x190f07[_0x0012('0x25')]()[_0x0012('0x24')](function(){var _0x108b65=_0x190f07['get']({'plain':!![]});var _0x24674c=_0x0012('0x26');return db['UserProfileResource'][_0x0012('0x25')]({'where':{'type':_0x24674c,'resourceId':_0x108b65['id']}})[_0x0012('0x24')](function(){return _0x190f07;});})[_0x0012('0x24')](function(){_0x35f9ee[_0x0012('0x1a')](0xcc)[_0x0012('0x27')]();});}};}function handleEntityNotFound(_0x5e820b,_0x351ffd){return function(_0x18b0a7){if(!_0x18b0a7){_0x5e820b[_0x0012('0x28')](0x194);}return _0x18b0a7;};}function handleError(_0x2a0302,_0x173cb3){_0x173cb3=_0x173cb3||0x1f4;return function(_0xb37ef5){logger[_0x0012('0x29')](_0xb37ef5[_0x0012('0x2a')]);if(_0xb37ef5[_0x0012('0x2b')]){delete _0xb37ef5[_0x0012('0x2b')];}_0x2a0302[_0x0012('0x1a')](_0x173cb3)[_0x0012('0x2c')](_0xb37ef5);};}exports[_0x0012('0x2d')]=function(_0x3ce788,_0x1282bb){var _0x276389={},_0x1b676d={},_0x1f4a0a={'count':0x0,'rows':[]};var _0x1c23e0=_[_0x0012('0x2e')](db[_0x0012('0x2f')]['rawAttributes'],function(_0x283134){return{'name':_0x283134[_0x0012('0x30')],'type':_0x283134['type'][_0x0012('0x31')]};});_0x1b676d[_0x0012('0x32')]=_[_0x0012('0x2e')](_0x1c23e0,_0x0012('0x2b'));_0x1b676d[_0x0012('0x33')]=_['keys'](_0x3ce788[_0x0012('0x33')]);_0x1b676d[_0x0012('0x34')]=_[_0x0012('0x35')](_0x1b676d['model'],_0x1b676d[_0x0012('0x33')]);_0x276389[_0x0012('0x36')]=_[_0x0012('0x35')](_0x1b676d[_0x0012('0x32')],qs[_0x0012('0x37')](_0x3ce788[_0x0012('0x33')]['fields']));_0x276389[_0x0012('0x36')]=_0x276389[_0x0012('0x36')][_0x0012('0x38')]?_0x276389[_0x0012('0x36')]:_0x1b676d['model'];if(!_0x3ce788['query'][_0x0012('0x39')](_0x0012('0x3a'))){_0x276389[_0x0012('0x1e')]=qs[_0x0012('0x1e')](_0x3ce788[_0x0012('0x33')][_0x0012('0x1e')]);_0x276389[_0x0012('0x1d')]=qs['offset'](_0x3ce788[_0x0012('0x33')][_0x0012('0x1d')]);}_0x276389['order']=qs[_0x0012('0x3b')](_0x3ce788[_0x0012('0x33')][_0x0012('0x3b')]);_0x276389[_0x0012('0x3c')]=qs[_0x0012('0x34')](_[_0x0012('0x3d')](_0x3ce788[_0x0012('0x33')],_0x1b676d['filters']),_0x1c23e0);if(_0x3ce788[_0x0012('0x33')]['filter']){_0x276389[_0x0012('0x3c')]=_['merge'](_0x276389['where'],{'$or':_[_0x0012('0x2e')](_0x1c23e0,function(_0x379618){if(_0x379618[_0x0012('0x3e')]!=='VIRTUAL'){var _0x44dda2={};_0x44dda2[_0x379618[_0x0012('0x2b')]]={'$like':'%'+_0x3ce788[_0x0012('0x33')][_0x0012('0x3f')]+'%'};return _0x44dda2;}})});}_0x276389=_[_0x0012('0x40')]({},_0x276389,_0x3ce788[_0x0012('0x41')]);var _0x85a93e={'where':_0x276389[_0x0012('0x3c')]};return db['AnalyticMetric'][_0x0012('0x1c')](_0x85a93e)[_0x0012('0x24')](function(_0x559751){_0x1f4a0a[_0x0012('0x1c')]=_0x559751;if(_0x3ce788[_0x0012('0x33')][_0x0012('0x42')]){_0x276389[_0x0012('0x43')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x276389);})[_0x0012('0x24')](function(_0x574ece){_0x1f4a0a[_0x0012('0x44')]=_0x574ece;return _0x1f4a0a;})[_0x0012('0x24')](respondWithFilteredResult(_0x1282bb,_0x276389))[_0x0012('0x45')](handleError(_0x1282bb,null));};exports[_0x0012('0x46')]=function(_0x32c1f9,_0x5348a2){var _0x1bd93a={'raw':!![],'where':{'id':_0x32c1f9['params']['id']}},_0x375a6c={};_0x375a6c[_0x0012('0x32')]=_[_0x0012('0x47')](db[_0x0012('0x2f')][_0x0012('0x48')]);_0x375a6c['query']=_['keys'](_0x32c1f9[_0x0012('0x33')]);_0x375a6c['filters']=_[_0x0012('0x35')](_0x375a6c['model'],_0x375a6c[_0x0012('0x33')]);_0x1bd93a[_0x0012('0x36')]=_[_0x0012('0x35')](_0x375a6c[_0x0012('0x32')],qs['fields'](_0x32c1f9[_0x0012('0x33')]['fields']));_0x1bd93a[_0x0012('0x36')]=_0x1bd93a[_0x0012('0x36')][_0x0012('0x38')]?_0x1bd93a[_0x0012('0x36')]:_0x375a6c[_0x0012('0x32')];if(_0x32c1f9[_0x0012('0x33')][_0x0012('0x42')]){_0x1bd93a['include']=[{'all':!![]}];}_0x1bd93a=_[_0x0012('0x40')]({},_0x1bd93a,_0x32c1f9[_0x0012('0x41')]);return db[_0x0012('0x2f')][_0x0012('0x49')](_0x1bd93a)[_0x0012('0x24')](handleEntityNotFound(_0x5348a2,null))[_0x0012('0x24')](respondWithResult(_0x5348a2,null))['catch'](handleError(_0x5348a2,null));};exports['create']=function(_0x48de64,_0x5b6370){return db[_0x0012('0x2f')][_0x0012('0x4a')](_0x48de64[_0x0012('0x4b')],{})[_0x0012('0x24')](function(_0x184403){var _0x53d552=_0x48de64[_0x0012('0x4c')][_0x0012('0x4d')]({'plain':!![]});if(!_0x53d552)throw new Error(_0x0012('0x4e'));if(_0x53d552[_0x0012('0x4f')]===_0x0012('0x4c')){var _0x564bc4=_0x184403[_0x0012('0x4d')]({'plain':!![]});var _0x26fb2b=_0x0012('0x26');return db[_0x0012('0x50')][_0x0012('0x49')]({'where':{'name':_0x26fb2b,'userProfileId':_0x53d552['userProfileId']},'raw':!![]})[_0x0012('0x24')](function(_0x12cb8f){if(_0x12cb8f&&_0x12cb8f[_0x0012('0x51')]===0x0){return db['UserProfileResource'][_0x0012('0x4a')]({'name':_0x564bc4[_0x0012('0x2b')],'resourceId':_0x564bc4['id'],'type':_0x12cb8f[_0x0012('0x2b')],'sectionId':_0x12cb8f['id']},{})[_0x0012('0x24')](function(){return _0x184403;});}else{return _0x184403;}})[_0x0012('0x45')](function(_0x5f283f){logger[_0x0012('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f283f);throw _0x5f283f;});}return _0x184403;})[_0x0012('0x24')](respondWithResult(_0x5b6370,0xc9))[_0x0012('0x45')](handleError(_0x5b6370,null));};exports['update']=function(_0x13a4ee,_0x19cf31){if(_0x13a4ee[_0x0012('0x4b')]['id']){delete _0x13a4ee[_0x0012('0x4b')]['id'];}return db[_0x0012('0x2f')][_0x0012('0x49')]({'where':{'id':_0x13a4ee['params']['id']}})[_0x0012('0x24')](handleEntityNotFound(_0x19cf31,null))[_0x0012('0x24')](saveUpdates(_0x13a4ee[_0x0012('0x4b')],null))[_0x0012('0x24')](respondWithResult(_0x19cf31,null))['catch'](handleError(_0x19cf31,null));};exports[_0x0012('0x25')]=function(_0x3bed8b,_0x2e79aa){return db['AnalyticMetric'][_0x0012('0x49')]({'where':{'id':_0x3bed8b[_0x0012('0x52')]['id']}})[_0x0012('0x24')](handleEntityNotFound(_0x2e79aa,null))[_0x0012('0x24')](removeEntity(_0x2e79aa,null))[_0x0012('0x45')](handleError(_0x2e79aa,null));}; \ No newline at end of file +var _0x94df=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','index','map','rawAttributes','type','model','keys','query','intersection','attributes','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','name','AnalyticMetric','count','includeAll','rows','catch','show','params','fields','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Metrics','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf'];(function(_0x239cee,_0xf7018){var _0x5dbf2e=function(_0x1cfe0f){while(--_0x1cfe0f){_0x239cee['push'](_0x239cee['shift']());}};_0x5dbf2e(++_0xf7018);}(_0x94df,0xa3));var _0xf94d=function(_0x5dd868,_0x2c93a9){_0x5dd868=_0x5dd868-0x0;var _0x3c9566=_0x94df[_0x5dd868];return _0x3c9566;};'use strict';var pdf=require(_0xf94d('0x0'));var emlformat=require(_0xf94d('0x1'));var rimraf=require(_0xf94d('0x2'));var zipdir=require(_0xf94d('0x3'));var jsonpatch=require(_0xf94d('0x4'));var rp=require(_0xf94d('0x5'));var moment=require('moment');var BPromise=require(_0xf94d('0x6'));var Mustache=require(_0xf94d('0x7'));var util=require(_0xf94d('0x8'));var path=require(_0xf94d('0x9'));var sox=require(_0xf94d('0xa'));var csv=require(_0xf94d('0xb'));var ejs=require(_0xf94d('0xc'));var fs=require('fs');var _=require(_0xf94d('0xd'));var squel=require(_0xf94d('0xe'));var crypto=require(_0xf94d('0xf'));var jsforce=require(_0xf94d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf94d('0xb'));var querystring=require(_0xf94d('0x11'));var Papa=require(_0xf94d('0x12'));var Redis=require(_0xf94d('0x13'));var authService=require(_0xf94d('0x14'));var qs=require(_0xf94d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf94d('0x16'));var logger=require(_0xf94d('0x17'))(_0xf94d('0x18'));var utils=require(_0xf94d('0x19'));var config=require(_0xf94d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x580644,_0x194023){_0x194023=_0x194023||0xcc;return function(_0x3e6c70){if(_0x3e6c70){return _0x580644[_0xf94d('0x1b')](_0x194023);}return _0x580644[_0xf94d('0x1c')](_0x194023)[_0xf94d('0x1d')]();};}function respondWithResult(_0x381a5f,_0x509c69){_0x509c69=_0x509c69||0xc8;return function(_0x596da8){if(_0x596da8){return _0x381a5f[_0xf94d('0x1c')](_0x509c69)[_0xf94d('0x1e')](_0x596da8);}};}function respondWithFilteredResult(_0x305c5f,_0xcc1a3a){return function(_0x451065){if(_0x451065){var _0x14020b=_0x451065['count'],_0x2c557b=_0xcc1a3a[_0xf94d('0x1f')],_0x4fa8bf=_0xcc1a3a['offset']+_0xcc1a3a[_0xf94d('0x20')],_0x431b19;if(_0x4fa8bf>=_0x14020b){_0x4fa8bf=_0x14020b;_0x431b19=0xc8;}else{_0x431b19=0xce;}_0x305c5f['status'](_0x431b19);return _0x305c5f[_0xf94d('0x21')](_0xf94d('0x22'),_0x2c557b+'-'+_0x4fa8bf+'/'+_0x14020b)[_0xf94d('0x1e')](_0x451065);}return null;};}function patchUpdates(_0x349de5){return function(_0x55e869){try{jsonpatch[_0xf94d('0x23')](_0x55e869,_0x349de5,!![]);}catch(_0x5e0133){return BPromise[_0xf94d('0x24')](_0x5e0133);}return _0x55e869[_0xf94d('0x25')]();};}function saveUpdates(_0x45adeb,_0x2ede5b){return function(_0x5f261c){if(_0x5f261c){return _0x5f261c[_0xf94d('0x26')](_0x45adeb)['then'](function(_0x39f75d){return _0x39f75d;});}return null;};}function removeEntity(_0x1fa6bf,_0x418f99){return function(_0x56e5f5){if(_0x56e5f5){return _0x56e5f5[_0xf94d('0x27')]()[_0xf94d('0x28')](function(){var _0x2142a1=_0x56e5f5[_0xf94d('0x29')]({'plain':!![]});var _0x47470d='Metrics';return db[_0xf94d('0x2a')]['destroy']({'where':{'type':_0x47470d,'resourceId':_0x2142a1['id']}})[_0xf94d('0x28')](function(){return _0x56e5f5;});})[_0xf94d('0x28')](function(){_0x1fa6bf[_0xf94d('0x1c')](0xcc)[_0xf94d('0x1d')]();});}};}function handleEntityNotFound(_0x997b6c,_0x1c4bdf){return function(_0x2804dc){if(!_0x2804dc){_0x997b6c[_0xf94d('0x1b')](0x194);}return _0x2804dc;};}function handleError(_0x3c9fe3,_0x13c229){_0x13c229=_0x13c229||0x1f4;return function(_0x18ccd7){logger[_0xf94d('0x2b')](_0x18ccd7[_0xf94d('0x2c')]);if(_0x18ccd7['name']){delete _0x18ccd7['name'];}_0x3c9fe3['status'](_0x13c229)['send'](_0x18ccd7);};}exports[_0xf94d('0x2d')]=function(_0x1e8242,_0x56ab8c){var _0x167585={},_0x1c123b={},_0x229ff7={'count':0x0,'rows':[]};var _0x59c273=_[_0xf94d('0x2e')](db['AnalyticMetric'][_0xf94d('0x2f')],function(_0x1d15c5){return{'name':_0x1d15c5['fieldName'],'type':_0x1d15c5[_0xf94d('0x30')]['key']};});_0x1c123b[_0xf94d('0x31')]=_['map'](_0x59c273,'name');_0x1c123b['query']=_[_0xf94d('0x32')](_0x1e8242[_0xf94d('0x33')]);_0x1c123b['filters']=_[_0xf94d('0x34')](_0x1c123b['model'],_0x1c123b[_0xf94d('0x33')]);_0x167585[_0xf94d('0x35')]=_['intersection'](_0x1c123b[_0xf94d('0x31')],qs['fields'](_0x1e8242[_0xf94d('0x33')]['fields']));_0x167585[_0xf94d('0x35')]=_0x167585['attributes'][_0xf94d('0x36')]?_0x167585[_0xf94d('0x35')]:_0x1c123b[_0xf94d('0x31')];if(!_0x1e8242[_0xf94d('0x33')]['hasOwnProperty']('nolimit')){_0x167585['limit']=qs[_0xf94d('0x20')](_0x1e8242[_0xf94d('0x33')][_0xf94d('0x20')]);_0x167585[_0xf94d('0x1f')]=qs['offset'](_0x1e8242['query']['offset']);}_0x167585[_0xf94d('0x37')]=qs[_0xf94d('0x38')](_0x1e8242[_0xf94d('0x33')][_0xf94d('0x38')]);_0x167585['where']=qs[_0xf94d('0x39')](_[_0xf94d('0x3a')](_0x1e8242[_0xf94d('0x33')],_0x1c123b[_0xf94d('0x39')]),_0x59c273);if(_0x1e8242['query'][_0xf94d('0x3b')]){_0x167585[_0xf94d('0x3c')]=_[_0xf94d('0x3d')](_0x167585[_0xf94d('0x3c')],{'$or':_[_0xf94d('0x2e')](_0x59c273,function(_0x288262){if(_0x288262[_0xf94d('0x30')]!==_0xf94d('0x3e')){var _0xe9510e={};_0xe9510e[_0x288262[_0xf94d('0x3f')]]={'$like':'%'+_0x1e8242['query']['filter']+'%'};return _0xe9510e;}})});}_0x167585=_[_0xf94d('0x3d')]({},_0x167585,_0x1e8242['options']);var _0x1938f8={'where':_0x167585['where']};return db[_0xf94d('0x40')][_0xf94d('0x41')](_0x1938f8)[_0xf94d('0x28')](function(_0x183f9f){_0x229ff7[_0xf94d('0x41')]=_0x183f9f;if(_0x1e8242['query'][_0xf94d('0x42')]){_0x167585['include']=[{'all':!![]}];}return db[_0xf94d('0x40')]['findAll'](_0x167585);})[_0xf94d('0x28')](function(_0x40af20){_0x229ff7[_0xf94d('0x43')]=_0x40af20;return _0x229ff7;})[_0xf94d('0x28')](respondWithFilteredResult(_0x56ab8c,_0x167585))[_0xf94d('0x44')](handleError(_0x56ab8c,null));};exports[_0xf94d('0x45')]=function(_0x3a5703,_0x598e2b){var _0x36ac14={'raw':!![],'where':{'id':_0x3a5703[_0xf94d('0x46')]['id']}},_0x2df442={};_0x2df442['model']=_[_0xf94d('0x32')](db[_0xf94d('0x40')][_0xf94d('0x2f')]);_0x2df442[_0xf94d('0x33')]=_[_0xf94d('0x32')](_0x3a5703[_0xf94d('0x33')]);_0x2df442[_0xf94d('0x39')]=_['intersection'](_0x2df442[_0xf94d('0x31')],_0x2df442[_0xf94d('0x33')]);_0x36ac14[_0xf94d('0x35')]=_[_0xf94d('0x34')](_0x2df442[_0xf94d('0x31')],qs[_0xf94d('0x47')](_0x3a5703['query']['fields']));_0x36ac14[_0xf94d('0x35')]=_0x36ac14[_0xf94d('0x35')][_0xf94d('0x36')]?_0x36ac14[_0xf94d('0x35')]:_0x2df442[_0xf94d('0x31')];if(_0x3a5703['query'][_0xf94d('0x42')]){_0x36ac14['include']=[{'all':!![]}];}_0x36ac14=_[_0xf94d('0x3d')]({},_0x36ac14,_0x3a5703[_0xf94d('0x48')]);return db[_0xf94d('0x40')][_0xf94d('0x49')](_0x36ac14)[_0xf94d('0x28')](handleEntityNotFound(_0x598e2b,null))['then'](respondWithResult(_0x598e2b,null))[_0xf94d('0x44')](handleError(_0x598e2b,null));};exports[_0xf94d('0x4a')]=function(_0x676410,_0x3d0df2){return db['AnalyticMetric'][_0xf94d('0x4a')](_0x676410['body'],{})['then'](function(_0x2c3e83){var _0x3ee368=_0x676410[_0xf94d('0x4b')]['get']({'plain':!![]});if(!_0x3ee368)throw new Error(_0xf94d('0x4c'));if(_0x3ee368['role']===_0xf94d('0x4b')){var _0xb1b984=_0x2c3e83[_0xf94d('0x29')]({'plain':!![]});var _0x42ec76=_0xf94d('0x4d');return db[_0xf94d('0x4e')]['find']({'where':{'name':_0x42ec76,'userProfileId':_0x3ee368[_0xf94d('0x4f')]},'raw':!![]})[_0xf94d('0x28')](function(_0x3b63da){if(_0x3b63da&&_0x3b63da[_0xf94d('0x50')]===0x0){return db['UserProfileResource'][_0xf94d('0x4a')]({'name':_0xb1b984['name'],'resourceId':_0xb1b984['id'],'type':_0x3b63da[_0xf94d('0x3f')],'sectionId':_0x3b63da['id']},{})['then'](function(){return _0x2c3e83;});}else{return _0x2c3e83;}})[_0xf94d('0x44')](function(_0xdcee74){logger[_0xf94d('0x2b')](_0xf94d('0x51'),_0xdcee74);throw _0xdcee74;});}return _0x2c3e83;})[_0xf94d('0x28')](respondWithResult(_0x3d0df2,0xc9))['catch'](handleError(_0x3d0df2,null));};exports['update']=function(_0x218e25,_0x3155a4){if(_0x218e25[_0xf94d('0x52')]['id']){delete _0x218e25[_0xf94d('0x52')]['id'];}return db[_0xf94d('0x40')][_0xf94d('0x49')]({'where':{'id':_0x218e25['params']['id']}})[_0xf94d('0x28')](handleEntityNotFound(_0x3155a4,null))[_0xf94d('0x28')](saveUpdates(_0x218e25[_0xf94d('0x52')],null))[_0xf94d('0x28')](respondWithResult(_0x3155a4,null))['catch'](handleError(_0x3155a4,null));};exports['destroy']=function(_0x24daaa,_0x404b06){return db[_0xf94d('0x40')]['find']({'where':{'id':_0x24daaa[_0xf94d('0x46')]['id']}})[_0xf94d('0x28')](handleEntityNotFound(_0x404b06,null))[_0xf94d('0x28')](removeEntity(_0x404b06,null))[_0xf94d('0x44')](handleError(_0x404b06,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 421e857..aaa757f 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 _0xb613=['exports','AnalyticMetric','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticMetric.attributes'];(function(_0x2bb008,_0x30ebe2){var _0x3fbacf=function(_0x51c24a){while(--_0x51c24a){_0x2bb008['push'](_0x2bb008['shift']());}};_0x3fbacf(++_0x30ebe2);}(_0xb613,0xfc));var _0x3b61=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xb613[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require(_0x3b61('0x0'));var util=require('util');var logger=require(_0x3b61('0x1'))(_0x3b61('0x2'));var moment=require(_0x3b61('0x3'));var BPromise=require(_0x3b61('0x4'));var rp=require(_0x3b61('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b61('0x6'));var config=require('../../config/environment');var attributes=require(_0x3b61('0x7'));module[_0x3b61('0x8')]=function(_0x595bbf,_0x2d8b48){return _0x595bbf['define'](_0x3b61('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb705=['bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api','moment'];(function(_0x37a4a1,_0x356362){var _0x3c396b=function(_0xd5ec8c){while(--_0xd5ec8c){_0x37a4a1['push'](_0x37a4a1['shift']());}};_0x3c396b(++_0x356362);}(_0xb705,0x182));var _0x5b70=function(_0x459a0c,_0x6288a9){_0x459a0c=_0x459a0c-0x0;var _0x4b1bf3=_0xb705[_0x459a0c];return _0x4b1bf3;};'use strict';var _=require('lodash');var util=require(_0x5b70('0x0'));var logger=require(_0x5b70('0x1'))(_0x5b70('0x2'));var moment=require(_0x5b70('0x3'));var BPromise=require(_0x5b70('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b70('0x5'));var rimraf=require(_0x5b70('0x6'));var config=require(_0x5b70('0x7'));var attributes=require(_0x5b70('0x8'));module[_0x5b70('0x9')]=function(_0x1bbd63,_0xde5863){return _0x1bbd63[_0x5b70('0xa')](_0x5b70('0xb'),attributes,{'tableName':_0x5b70('0xc'),'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 f5506f9..44085fc 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 _0x16cb=['message','AnalyticMetric,\x20%s,\x20%s','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','debug','request\x20sent','stringify','error','code'];(function(_0x35b036,_0x4eaaf7){var _0x706824=function(_0x5e4b84){while(--_0x5e4b84){_0x35b036['push'](_0x35b036['shift']());}};_0x706824(++_0x4eaaf7);}(_0x16cb,0xae));var _0xb16c=function(_0x55a51e,_0x4eedbd){_0x55a51e=_0x55a51e-0x0;var _0x496d0e=_0x16cb[_0x55a51e];return _0x496d0e;};'use strict';var _=require(_0xb16c('0x0'));var util=require('util');var moment=require(_0xb16c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb16c('0x2'));var fs=require('fs');var Redis=require(_0xb16c('0x3'));var db=require(_0xb16c('0x4'))['db'];var utils=require(_0xb16c('0x5'));var logger=require(_0xb16c('0x6'))(_0xb16c('0x7'));var config=require(_0xb16c('0x8'));var jayson=require(_0xb16c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b3811,_0x1448a8,_0x5a8885){return new BPromise(function(_0x73384e,_0x44bd05){return client['request'](_0x4b3811,_0x5a8885)['then'](function(_0x39320e){logger[_0xb16c('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x1448a8,'request\x20sent');logger[_0xb16c('0xb')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1448a8,_0xb16c('0xc'),JSON[_0xb16c('0xd')](_0x39320e));if(_0x39320e[_0xb16c('0xe')]){if(_0x39320e[_0xb16c('0xe')][_0xb16c('0xf')]===0x1f4){logger[_0xb16c('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x1448a8,_0x39320e[_0xb16c('0xe')][_0xb16c('0x10')]);return _0x44bd05(_0x39320e['error']['message']);}logger[_0xb16c('0xe')](_0xb16c('0x11'),_0x1448a8,_0x39320e[_0xb16c('0xe')][_0xb16c('0x10')]);return _0x73384e(_0x39320e[_0xb16c('0xe')][_0xb16c('0x10')]);}else{logger[_0xb16c('0xa')](_0xb16c('0x11'),_0x1448a8,_0xb16c('0xc'));_0x73384e(_0x39320e[_0xb16c('0x12')][_0xb16c('0x10')]);}})['catch'](function(_0x234565){logger[_0xb16c('0xe')](_0xb16c('0x11'),_0x1448a8,_0x234565);_0x44bd05(_0x234565);});});} \ No newline at end of file +var _0x7ee5=['rpc','jayson/promise','client','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x326701,_0x24bb20){var _0x38fd65=function(_0x5729dc){while(--_0x5729dc){_0x326701['push'](_0x326701['shift']());}};_0x38fd65(++_0x24bb20);}(_0x7ee5,0x126));var _0x57ee=function(_0x57a9e5,_0x5009df){_0x57a9e5=_0x57a9e5-0x0;var _0x36d39e=_0x7ee5[_0x57a9e5];return _0x36d39e;};'use strict';var _=require(_0x57ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x57ee('0x1'));var fs=require('fs');var Redis=require(_0x57ee('0x2'));var db=require(_0x57ee('0x3'))['db'];var utils=require(_0x57ee('0x4'));var logger=require(_0x57ee('0x5'))(_0x57ee('0x6'));var config=require('../../config/environment');var jayson=require(_0x57ee('0x7'));var client=jayson[_0x57ee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b367b,_0x49d51d,_0x2e068a){return new BPromise(function(_0xb7fddf,_0x1cac03){return client[_0x57ee('0x9')](_0x3b367b,_0x2e068a)[_0x57ee('0xa')](function(_0x1fc33e){logger['info'](_0x57ee('0xb'),_0x49d51d,_0x57ee('0xc'));logger[_0x57ee('0xd')](_0x57ee('0xe'),_0x49d51d,_0x57ee('0xc'),JSON['stringify'](_0x1fc33e));if(_0x1fc33e[_0x57ee('0xf')]){if(_0x1fc33e[_0x57ee('0xf')][_0x57ee('0x10')]===0x1f4){logger[_0x57ee('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x49d51d,_0x1fc33e[_0x57ee('0xf')][_0x57ee('0x11')]);return _0x1cac03(_0x1fc33e['error'][_0x57ee('0x11')]);}logger['error'](_0x57ee('0xb'),_0x49d51d,_0x1fc33e[_0x57ee('0xf')]['message']);return _0xb7fddf(_0x1fc33e[_0x57ee('0xf')][_0x57ee('0x11')]);}else{logger['info'](_0x57ee('0xb'),_0x49d51d,_0x57ee('0xc'));_0xb7fddf(_0x1fc33e[_0x57ee('0x12')][_0x57ee('0x11')]);}})[_0x57ee('0x13')](function(_0x3648d7){logger['error'](_0x57ee('0xb'),_0x49d51d,_0x3648d7);_0x1cac03(_0x3648d7);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 330f76d..428d165 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 _0x53ec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','isAuthenticated'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x53ec,0x192));var _0xc53e=function(_0x3fe90c,_0x231b20){_0x3fe90c=_0x3fe90c-0x0;var _0x12c302=_0x53ec[_0x3fe90c];return _0x12c302;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x9')]);router['get'](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller['show']);router[_0xc53e('0xc')]('/',auth[_0xc53e('0xb')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc53e('0x11')]=router; \ No newline at end of file +var _0xba34=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../config/environment','./analyticMetric.controller'];(function(_0x18095f,_0x43bec3){var _0x451c33=function(_0x1f1e98){while(--_0x1f1e98){_0x18095f['push'](_0x18095f['shift']());}};_0x451c33(++_0x43bec3);}(_0xba34,0x119));var _0x4ba3=function(_0x18a756,_0x42f552){_0x18a756=_0x18a756-0x0;var _0x67fbe2=_0xba34[_0x18a756];return _0x67fbe2;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ba3('0x5'));var controller=require(_0x4ba3('0x6'));router[_0x4ba3('0x7')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0x9')]);router[_0x4ba3('0x7')](_0x4ba3('0xa'),auth['isAuthenticated'](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0xc')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller['destroy']);module[_0x4ba3('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 9e64f19..46fba45 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 _0xc81b=['exports','TEXT'];(function(_0x526c68,_0x1b8c4a){var _0x313f6d=function(_0x378584){while(--_0x378584){_0x526c68['push'](_0x526c68['shift']());}};_0x313f6d(++_0x1b8c4a);}(_0xc81b,0x188));var _0xbc81=function(_0x5a47d6,_0x1256dd){_0x5a47d6=_0x5a47d6-0x0;var _0x210d3e=_0xc81b[_0x5a47d6];return _0x210d3e;};'use strict';var Sequelize=require('sequelize');module[_0xbc81('0x0')]={'tree':{'type':Sequelize[_0xbc81('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xfd9c=['TEXT','sequelize','exports'];(function(_0x1ef7a0,_0x5406c1){var _0x39fb62=function(_0x1c623c){while(--_0x1c623c){_0x1ef7a0['push'](_0x1ef7a0['shift']());}};_0x39fb62(++_0x5406c1);}(_0xfd9c,0x11b));var _0xcfd9=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0xfd9c[_0x5d6c3e];return _0x44ecb7;};'use strict';var Sequelize=require(_0xcfd9('0x0'));module[_0xcfd9('0x1')]={'tree':{'type':Sequelize[_0xcfd9('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 667f403..8928ea9 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 _0x0571=['../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','name','send','map','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0xc83b68,_0x57a971){var _0x182444=function(_0x2c7f12){while(--_0x2c7f12){_0xc83b68['push'](_0xc83b68['shift']());}};_0x182444(++_0x57a971);}(_0x0571,0x1f2));var _0x1057=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0x0571[_0x270a54];return _0x4d07d0;};'use strict';var pdf=require(_0x1057('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1057('0x1'));var jsonpatch=require(_0x1057('0x2'));var rp=require(_0x1057('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1057('0x4'));var util=require(_0x1057('0x5'));var path=require(_0x1057('0x6'));var sox=require(_0x1057('0x7'));var csv=require(_0x1057('0x8'));var ejs=require(_0x1057('0x9'));var fs=require('fs');var _=require(_0x1057('0xa'));var squel=require(_0x1057('0xb'));var crypto=require(_0x1057('0xc'));var jsforce=require(_0x1057('0xd'));var deskjs=require(_0x1057('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1057('0xf'));var Papa=require(_0x1057('0x10'));var Redis=require('ioredis');var authService=require(_0x1057('0x11'));var qs=require(_0x1057('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1057('0x13'));var logger=require(_0x1057('0x14'))(_0x1057('0x15'));var utils=require(_0x1057('0x16'));var config=require(_0x1057('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29aa19,_0x1a08ea){_0x1a08ea=_0x1a08ea||0xcc;return function(_0x24ec5a){if(_0x24ec5a){return _0x29aa19[_0x1057('0x18')](_0x1a08ea);}return _0x29aa19[_0x1057('0x19')](_0x1a08ea)[_0x1057('0x1a')]();};}function respondWithResult(_0x5b346c,_0x5b4d9d){_0x5b4d9d=_0x5b4d9d||0xc8;return function(_0x25d2e3){if(_0x25d2e3){return _0x5b346c[_0x1057('0x19')](_0x5b4d9d)[_0x1057('0x1b')](_0x25d2e3);}};}function respondWithFilteredResult(_0x1b172b,_0xfc5e45){return function(_0x4797eb){if(_0x4797eb){var _0x4bf29d=_0x4797eb[_0x1057('0x1c')],_0x1e5a6c=_0xfc5e45['offset'],_0x29f4f3=_0xfc5e45[_0x1057('0x1d')]+_0xfc5e45[_0x1057('0x1e')],_0x3ee78a;if(_0x29f4f3>=_0x4bf29d){_0x29f4f3=_0x4bf29d;_0x3ee78a=0xc8;}else{_0x3ee78a=0xce;}_0x1b172b['status'](_0x3ee78a);return _0x1b172b[_0x1057('0x1f')](_0x1057('0x20'),_0x1e5a6c+'-'+_0x29f4f3+'/'+_0x4bf29d)[_0x1057('0x1b')](_0x4797eb);}return null;};}function patchUpdates(_0x452332){return function(_0x10b6b3){try{jsonpatch[_0x1057('0x21')](_0x10b6b3,_0x452332,!![]);}catch(_0x5656f4){return BPromise[_0x1057('0x22')](_0x5656f4);}return _0x10b6b3['save']();};}function saveUpdates(_0x32a122,_0x54a756){return function(_0x208834){if(_0x208834){return _0x208834[_0x1057('0x23')](_0x32a122)[_0x1057('0x24')](function(_0x5d3c99){return _0x5d3c99;});}return null;};}function removeEntity(_0x238906,_0x58fdcc){return function(_0x535578){if(_0x535578){return _0x535578[_0x1057('0x25')]()[_0x1057('0x24')](function(){_0x238906[_0x1057('0x19')](0xcc)[_0x1057('0x1a')]();});}};}function handleEntityNotFound(_0x5cc7e6,_0x2a933c){return function(_0x46ab18){if(!_0x46ab18){_0x5cc7e6['sendStatus'](0x194);}return _0x46ab18;};}function handleError(_0x83595a,_0x1e955b){_0x1e955b=_0x1e955b||0x1f4;return function(_0x3212f3){logger['error'](_0x3212f3['stack']);if(_0x3212f3['name']){delete _0x3212f3[_0x1057('0x26')];}_0x83595a[_0x1057('0x19')](_0x1e955b)[_0x1057('0x27')](_0x3212f3);};}exports['index']=function(_0xbf0bea,_0x51988e){var _0x35a2b3={},_0x39573c={},_0x5b2c94={'count':0x0,'rows':[]};var _0x640c09=_[_0x1057('0x28')](db['AnalyticTreeReport'][_0x1057('0x29')],function(_0x3f8cd2){return{'name':_0x3f8cd2[_0x1057('0x2a')],'type':_0x3f8cd2[_0x1057('0x2b')][_0x1057('0x2c')]};});_0x39573c['model']=_[_0x1057('0x28')](_0x640c09,_0x1057('0x26'));_0x39573c['query']=_[_0x1057('0x2d')](_0xbf0bea[_0x1057('0x2e')]);_0x39573c[_0x1057('0x2f')]=_['intersection'](_0x39573c[_0x1057('0x30')],_0x39573c[_0x1057('0x2e')]);_0x35a2b3[_0x1057('0x31')]=_[_0x1057('0x32')](_0x39573c[_0x1057('0x30')],qs[_0x1057('0x33')](_0xbf0bea[_0x1057('0x2e')][_0x1057('0x33')]));_0x35a2b3[_0x1057('0x31')]=_0x35a2b3[_0x1057('0x31')][_0x1057('0x34')]?_0x35a2b3[_0x1057('0x31')]:_0x39573c['model'];if(!_0xbf0bea['query'][_0x1057('0x35')](_0x1057('0x36'))){_0x35a2b3[_0x1057('0x1e')]=qs[_0x1057('0x1e')](_0xbf0bea[_0x1057('0x2e')]['limit']);_0x35a2b3[_0x1057('0x1d')]=qs['offset'](_0xbf0bea['query'][_0x1057('0x1d')]);}_0x35a2b3[_0x1057('0x37')]=qs[_0x1057('0x38')](_0xbf0bea[_0x1057('0x2e')]['sort']);_0x35a2b3[_0x1057('0x39')]=qs['filters'](_[_0x1057('0x3a')](_0xbf0bea[_0x1057('0x2e')],_0x39573c['filters']),_0x640c09);if(_0xbf0bea[_0x1057('0x2e')][_0x1057('0x3b')]){_0x35a2b3[_0x1057('0x39')]=_[_0x1057('0x3c')](_0x35a2b3[_0x1057('0x39')],{'$or':_['map'](_0x640c09,function(_0x15a2b9){if(_0x15a2b9[_0x1057('0x2b')]!==_0x1057('0x3d')){var _0x14ed09={};_0x14ed09[_0x15a2b9[_0x1057('0x26')]]={'$like':'%'+_0xbf0bea[_0x1057('0x2e')][_0x1057('0x3b')]+'%'};return _0x14ed09;}})});}_0x35a2b3=_[_0x1057('0x3c')]({},_0x35a2b3,_0xbf0bea['options']);var _0x560f17={'where':_0x35a2b3['where']};return db[_0x1057('0x3e')][_0x1057('0x1c')](_0x560f17)[_0x1057('0x24')](function(_0x440e65){_0x5b2c94[_0x1057('0x1c')]=_0x440e65;if(_0xbf0bea[_0x1057('0x2e')][_0x1057('0x3f')]){_0x35a2b3[_0x1057('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x1057('0x41')](_0x35a2b3);})['then'](function(_0x566164){_0x5b2c94[_0x1057('0x42')]=_0x566164;return _0x5b2c94;})[_0x1057('0x24')](respondWithFilteredResult(_0x51988e,_0x35a2b3))[_0x1057('0x43')](handleError(_0x51988e,null));};exports[_0x1057('0x44')]=function(_0x3780e0,_0x1edeaf){var _0x5c83e3={'raw':!![],'where':{'id':_0x3780e0[_0x1057('0x45')]['id']}},_0x321429={};_0x321429[_0x1057('0x30')]=_[_0x1057('0x2d')](db[_0x1057('0x3e')][_0x1057('0x29')]);_0x321429[_0x1057('0x2e')]=_[_0x1057('0x2d')](_0x3780e0[_0x1057('0x2e')]);_0x321429['filters']=_['intersection'](_0x321429[_0x1057('0x30')],_0x321429[_0x1057('0x2e')]);_0x5c83e3[_0x1057('0x31')]=_[_0x1057('0x32')](_0x321429['model'],qs[_0x1057('0x33')](_0x3780e0['query'][_0x1057('0x33')]));_0x5c83e3[_0x1057('0x31')]=_0x5c83e3[_0x1057('0x31')]['length']?_0x5c83e3[_0x1057('0x31')]:_0x321429[_0x1057('0x30')];if(_0x3780e0[_0x1057('0x2e')][_0x1057('0x3f')]){_0x5c83e3[_0x1057('0x40')]=[{'all':!![]}];}_0x5c83e3=_[_0x1057('0x3c')]({},_0x5c83e3,_0x3780e0[_0x1057('0x46')]);return db[_0x1057('0x3e')][_0x1057('0x47')](_0x5c83e3)[_0x1057('0x24')](handleEntityNotFound(_0x1edeaf,null))[_0x1057('0x24')](respondWithResult(_0x1edeaf,null))['catch'](handleError(_0x1edeaf,null));};exports[_0x1057('0x48')]=function(_0xde1d67,_0x6464eb){return db['AnalyticTreeReport']['create'](_0xde1d67[_0x1057('0x49')],{})['then'](respondWithResult(_0x6464eb,0xc9))[_0x1057('0x43')](handleError(_0x6464eb,null));};exports[_0x1057('0x23')]=function(_0x152224,_0x94496a){if(_0x152224[_0x1057('0x49')]['id']){delete _0x152224[_0x1057('0x49')]['id'];}return db[_0x1057('0x3e')][_0x1057('0x47')]({'where':{'id':_0x152224[_0x1057('0x45')]['id']}})[_0x1057('0x24')](handleEntityNotFound(_0x94496a,null))['then'](saveUpdates(_0x152224['body'],null))[_0x1057('0x24')](respondWithResult(_0x94496a,null))['catch'](handleError(_0x94496a,null));};exports[_0x1057('0x25')]=function(_0x1f7a90,_0x358fee){return db[_0x1057('0x3e')]['find']({'where':{'id':_0x1f7a90['params']['id']}})[_0x1057('0x24')](handleEntityNotFound(_0x358fee,null))[_0x1057('0x24')](removeEntity(_0x358fee,null))[_0x1057('0x43')](handleError(_0x358fee,null));}; \ No newline at end of file +var _0x0596=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','zip-dir','moment','mustache','path','sox','to-csv','ejs','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick'];(function(_0x58420f,_0x50be10){var _0x47505e=function(_0x52ad95){while(--_0x52ad95){_0x58420f['push'](_0x58420f['shift']());}};_0x47505e(++_0x50be10);}(_0x0596,0x92));var _0x6059=function(_0x161e90,_0x447193){_0x161e90=_0x161e90-0x0;var _0x1da972=_0x0596[_0x161e90];return _0x1da972;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6059('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6059('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6059('0x2'));var util=require('util');var path=require(_0x6059('0x3'));var sox=require(_0x6059('0x4'));var csv=require(_0x6059('0x5'));var ejs=require(_0x6059('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6059('0x7'));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(_0x6059('0x8'));var Redis=require(_0x6059('0x9'));var authService=require(_0x6059('0xa'));var qs=require(_0x6059('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6059('0xc'));var logger=require(_0x6059('0xd'))(_0x6059('0xe'));var utils=require(_0x6059('0xf'));var config=require(_0x6059('0x10'));var db=require(_0x6059('0x11'))['db'];function respondWithStatusCode(_0x3aaef,_0x581380){_0x581380=_0x581380||0xcc;return function(_0x16c5d2){if(_0x16c5d2){return _0x3aaef[_0x6059('0x12')](_0x581380);}return _0x3aaef[_0x6059('0x13')](_0x581380)[_0x6059('0x14')]();};}function respondWithResult(_0x4e9b85,_0x4b3a36){_0x4b3a36=_0x4b3a36||0xc8;return function(_0x2c20a9){if(_0x2c20a9){return _0x4e9b85[_0x6059('0x13')](_0x4b3a36)['json'](_0x2c20a9);}};}function respondWithFilteredResult(_0x225b8d,_0x3f87a6){return function(_0x204cc4){if(_0x204cc4){var _0x3e5373=_0x204cc4[_0x6059('0x15')],_0x2dec8f=_0x3f87a6[_0x6059('0x16')],_0x177300=_0x3f87a6['offset']+_0x3f87a6['limit'],_0x382eb1;if(_0x177300>=_0x3e5373){_0x177300=_0x3e5373;_0x382eb1=0xc8;}else{_0x382eb1=0xce;}_0x225b8d[_0x6059('0x13')](_0x382eb1);return _0x225b8d[_0x6059('0x17')](_0x6059('0x18'),_0x2dec8f+'-'+_0x177300+'/'+_0x3e5373)[_0x6059('0x19')](_0x204cc4);}return null;};}function patchUpdates(_0x47d507){return function(_0x51e47c){try{jsonpatch[_0x6059('0x1a')](_0x51e47c,_0x47d507,!![]);}catch(_0x40f60a){return BPromise['reject'](_0x40f60a);}return _0x51e47c[_0x6059('0x1b')]();};}function saveUpdates(_0xa93623,_0x5c841b){return function(_0x36ae1f){if(_0x36ae1f){return _0x36ae1f[_0x6059('0x1c')](_0xa93623)[_0x6059('0x1d')](function(_0x5cd634){return _0x5cd634;});}return null;};}function removeEntity(_0x2882bb,_0x3da474){return function(_0x3e6da4){if(_0x3e6da4){return _0x3e6da4[_0x6059('0x1e')]()[_0x6059('0x1d')](function(){_0x2882bb[_0x6059('0x13')](0xcc)[_0x6059('0x14')]();});}};}function handleEntityNotFound(_0x422945,_0x28043e){return function(_0x27cb66){if(!_0x27cb66){_0x422945['sendStatus'](0x194);}return _0x27cb66;};}function handleError(_0x4ea322,_0x5c5b83){_0x5c5b83=_0x5c5b83||0x1f4;return function(_0x128644){logger[_0x6059('0x1f')](_0x128644['stack']);if(_0x128644[_0x6059('0x20')]){delete _0x128644[_0x6059('0x20')];}_0x4ea322['status'](_0x5c5b83)[_0x6059('0x21')](_0x128644);};}exports['index']=function(_0x2c1f15,_0x469f5b){var _0x1e4b04={},_0x5b66dc={},_0x311bd4={'count':0x0,'rows':[]};var _0x12d219=_['map'](db[_0x6059('0x22')][_0x6059('0x23')],function(_0x29c064){return{'name':_0x29c064[_0x6059('0x24')],'type':_0x29c064['type'][_0x6059('0x25')]};});_0x5b66dc[_0x6059('0x26')]=_['map'](_0x12d219,_0x6059('0x20'));_0x5b66dc[_0x6059('0x27')]=_[_0x6059('0x28')](_0x2c1f15['query']);_0x5b66dc[_0x6059('0x29')]=_[_0x6059('0x2a')](_0x5b66dc[_0x6059('0x26')],_0x5b66dc[_0x6059('0x27')]);_0x1e4b04['attributes']=_[_0x6059('0x2a')](_0x5b66dc[_0x6059('0x26')],qs[_0x6059('0x2b')](_0x2c1f15['query']['fields']));_0x1e4b04['attributes']=_0x1e4b04[_0x6059('0x2c')][_0x6059('0x2d')]?_0x1e4b04[_0x6059('0x2c')]:_0x5b66dc[_0x6059('0x26')];if(!_0x2c1f15['query'][_0x6059('0x2e')](_0x6059('0x2f'))){_0x1e4b04[_0x6059('0x30')]=qs[_0x6059('0x30')](_0x2c1f15[_0x6059('0x27')][_0x6059('0x30')]);_0x1e4b04[_0x6059('0x16')]=qs['offset'](_0x2c1f15[_0x6059('0x27')][_0x6059('0x16')]);}_0x1e4b04['order']=qs['sort'](_0x2c1f15[_0x6059('0x27')][_0x6059('0x31')]);_0x1e4b04[_0x6059('0x32')]=qs[_0x6059('0x29')](_[_0x6059('0x33')](_0x2c1f15[_0x6059('0x27')],_0x5b66dc['filters']),_0x12d219);if(_0x2c1f15['query'][_0x6059('0x34')]){_0x1e4b04[_0x6059('0x32')]=_[_0x6059('0x35')](_0x1e4b04['where'],{'$or':_['map'](_0x12d219,function(_0x114156){if(_0x114156[_0x6059('0x36')]!==_0x6059('0x37')){var _0x1bb930={};_0x1bb930[_0x114156['name']]={'$like':'%'+_0x2c1f15['query'][_0x6059('0x34')]+'%'};return _0x1bb930;}})});}_0x1e4b04=_['merge']({},_0x1e4b04,_0x2c1f15[_0x6059('0x38')]);var _0x17f4fa={'where':_0x1e4b04[_0x6059('0x32')]};return db['AnalyticTreeReport'][_0x6059('0x15')](_0x17f4fa)['then'](function(_0x180041){_0x311bd4[_0x6059('0x15')]=_0x180041;if(_0x2c1f15[_0x6059('0x27')][_0x6059('0x39')]){_0x1e4b04[_0x6059('0x3a')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x6059('0x3b')](_0x1e4b04);})[_0x6059('0x1d')](function(_0x4a2f54){_0x311bd4['rows']=_0x4a2f54;return _0x311bd4;})[_0x6059('0x1d')](respondWithFilteredResult(_0x469f5b,_0x1e4b04))[_0x6059('0x3c')](handleError(_0x469f5b,null));};exports[_0x6059('0x3d')]=function(_0x1bfb6a,_0x254667){var _0x4c4de9={'raw':!![],'where':{'id':_0x1bfb6a[_0x6059('0x3e')]['id']}},_0x519c4e={};_0x519c4e[_0x6059('0x26')]=_[_0x6059('0x28')](db[_0x6059('0x22')][_0x6059('0x23')]);_0x519c4e[_0x6059('0x27')]=_['keys'](_0x1bfb6a[_0x6059('0x27')]);_0x519c4e[_0x6059('0x29')]=_[_0x6059('0x2a')](_0x519c4e['model'],_0x519c4e[_0x6059('0x27')]);_0x4c4de9[_0x6059('0x2c')]=_[_0x6059('0x2a')](_0x519c4e['model'],qs[_0x6059('0x2b')](_0x1bfb6a[_0x6059('0x27')][_0x6059('0x2b')]));_0x4c4de9[_0x6059('0x2c')]=_0x4c4de9[_0x6059('0x2c')][_0x6059('0x2d')]?_0x4c4de9[_0x6059('0x2c')]:_0x519c4e[_0x6059('0x26')];if(_0x1bfb6a[_0x6059('0x27')][_0x6059('0x39')]){_0x4c4de9['include']=[{'all':!![]}];}_0x4c4de9=_[_0x6059('0x35')]({},_0x4c4de9,_0x1bfb6a[_0x6059('0x38')]);return db[_0x6059('0x22')]['find'](_0x4c4de9)[_0x6059('0x1d')](handleEntityNotFound(_0x254667,null))['then'](respondWithResult(_0x254667,null))['catch'](handleError(_0x254667,null));};exports[_0x6059('0x3f')]=function(_0x17ba95,_0x42a8e4){return db[_0x6059('0x22')]['create'](_0x17ba95['body'],{})[_0x6059('0x1d')](respondWithResult(_0x42a8e4,0xc9))['catch'](handleError(_0x42a8e4,null));};exports[_0x6059('0x1c')]=function(_0x33ab52,_0x32f375){if(_0x33ab52[_0x6059('0x40')]['id']){delete _0x33ab52[_0x6059('0x40')]['id'];}return db[_0x6059('0x22')][_0x6059('0x41')]({'where':{'id':_0x33ab52[_0x6059('0x3e')]['id']}})[_0x6059('0x1d')](handleEntityNotFound(_0x32f375,null))[_0x6059('0x1d')](saveUpdates(_0x33ab52[_0x6059('0x40')],null))[_0x6059('0x1d')](respondWithResult(_0x32f375,null))[_0x6059('0x3c')](handleError(_0x32f375,null));};exports[_0x6059('0x1e')]=function(_0x364b66,_0x2f4580){return db[_0x6059('0x22')][_0x6059('0x41')]({'where':{'id':_0x364b66[_0x6059('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2f4580,null))['then'](removeEntity(_0x2f4580,null))[_0x6059('0x3c')](handleError(_0x2f4580,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 7e79bb6..104b49c 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 _0x8a6d=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0xb704,_0x5de98c){var _0x150465=function(_0x37cc45){while(--_0x37cc45){_0xb704['push'](_0xb704['shift']());}};_0x150465(++_0x5de98c);}(_0x8a6d,0x16e));var _0xd8a6=function(_0x460a65,_0x201a15){_0x460a65=_0x460a65-0x0;var _0x28c2bb=_0x8a6d[_0x460a65];return _0x28c2bb;};'use strict';var _=require('lodash');var util=require(_0xd8a6('0x0'));var logger=require(_0xd8a6('0x1'))('api');var moment=require(_0xd8a6('0x2'));var BPromise=require('bluebird');var rp=require(_0xd8a6('0x3'));var fs=require('fs');var path=require(_0xd8a6('0x4'));var rimraf=require(_0xd8a6('0x5'));var config=require(_0xd8a6('0x6'));var attributes=require(_0xd8a6('0x7'));module[_0xd8a6('0x8')]=function(_0x183dc5,_0x554dbc){return _0x183dc5[_0xd8a6('0x9')](_0xd8a6('0xa'),attributes,{'tableName':_0xd8a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb44a=['request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa18483,_0x837744){var _0x42e34d=function(_0x3d3cef){while(--_0x3d3cef){_0xa18483['push'](_0xa18483['shift']());}};_0x42e34d(++_0x837744);}(_0xb44a,0x11a));var _0xab44=function(_0xee37f1,_0x189f43){_0xee37f1=_0xee37f1-0x0;var _0x37fd54=_0xb44a[_0xee37f1];return _0x37fd54;};'use strict';var _=require(_0xab44('0x0'));var util=require(_0xab44('0x1'));var logger=require(_0xab44('0x2'))(_0xab44('0x3'));var moment=require(_0xab44('0x4'));var BPromise=require(_0xab44('0x5'));var rp=require(_0xab44('0x6'));var fs=require('fs');var path=require(_0xab44('0x7'));var rimraf=require('rimraf');var config=require(_0xab44('0x8'));var attributes=require(_0xab44('0x9'));module[_0xab44('0xa')]=function(_0xbafb86,_0x1f5fbe){return _0xbafb86['define']('AnalyticTreeReport',attributes,{'tableName':_0xab44('0xb'),'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 ac4479d..6ee7da2 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 _0xa7d7=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2abffd,_0x760487){var _0xe147d4=function(_0x39fa89){while(--_0x39fa89){_0x2abffd['push'](_0x2abffd['shift']());}};_0xe147d4(++_0x760487);}(_0xa7d7,0x78));var _0x7a7d=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xa7d7[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0x7a7d('0x0'));var util=require(_0x7a7d('0x1'));var moment=require(_0x7a7d('0x2'));var BPromise=require(_0x7a7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a7d('0x4'));var db=require(_0x7a7d('0x5'))['db'];var utils=require(_0x7a7d('0x6'));var logger=require(_0x7a7d('0x7'))(_0x7a7d('0x8'));var config=require(_0x7a7d('0x9'));var jayson=require(_0x7a7d('0xa'));var client=jayson[_0x7a7d('0xb')][_0x7a7d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x564738,_0x128128,_0x166a31){return new BPromise(function(_0x24df44,_0x39e53e){return client['request'](_0x564738,_0x166a31)[_0x7a7d('0xd')](function(_0x325e94){logger['info'](_0x7a7d('0xe'),_0x128128,_0x7a7d('0xf'));logger['debug'](_0x7a7d('0x10'),_0x128128,_0x7a7d('0xf'),JSON[_0x7a7d('0x11')](_0x325e94));if(_0x325e94[_0x7a7d('0x12')]){if(_0x325e94[_0x7a7d('0x12')][_0x7a7d('0x13')]===0x1f4){logger['error'](_0x7a7d('0xe'),_0x128128,_0x325e94[_0x7a7d('0x12')][_0x7a7d('0x14')]);return _0x39e53e(_0x325e94[_0x7a7d('0x12')][_0x7a7d('0x14')]);}logger['error'](_0x7a7d('0xe'),_0x128128,_0x325e94[_0x7a7d('0x12')][_0x7a7d('0x14')]);return _0x24df44(_0x325e94[_0x7a7d('0x12')][_0x7a7d('0x14')]);}else{logger['info'](_0x7a7d('0xe'),_0x128128,_0x7a7d('0xf'));_0x24df44(_0x325e94[_0x7a7d('0x15')]['message']);}})[_0x7a7d('0x16')](function(_0xa678e8){logger[_0x7a7d('0x12')](_0x7a7d('0xe'),_0x128128,_0xa678e8);_0x39e53e(_0xa678e8);});});} \ No newline at end of file +var _0x39aa=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x252c77,_0x48ca00){var _0x68d7a3=function(_0x36b4d2){while(--_0x36b4d2){_0x252c77['push'](_0x252c77['shift']());}};_0x68d7a3(++_0x48ca00);}(_0x39aa,0x12e));var _0xa39a=function(_0x61fd3a,_0x15a094){_0x61fd3a=_0x61fd3a-0x0;var _0x546d6b=_0x39aa[_0x61fd3a];return _0x546d6b;};'use strict';var _=require(_0xa39a('0x0'));var util=require(_0xa39a('0x1'));var moment=require(_0xa39a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa39a('0x3'));var db=require(_0xa39a('0x4'))['db'];var utils=require(_0xa39a('0x5'));var logger=require(_0xa39a('0x6'))(_0xa39a('0x7'));var config=require(_0xa39a('0x8'));var jayson=require(_0xa39a('0x9'));var client=jayson[_0xa39a('0xa')][_0xa39a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39b47c,_0x4bb74c,_0x21fffb){return new BPromise(function(_0x32e882,_0x3d91ef){return client['request'](_0x39b47c,_0x21fffb)['then'](function(_0x253b99){logger[_0xa39a('0xc')](_0xa39a('0xd'),_0x4bb74c,_0xa39a('0xe'));logger['debug'](_0xa39a('0xf'),_0x4bb74c,_0xa39a('0xe'),JSON[_0xa39a('0x10')](_0x253b99));if(_0x253b99[_0xa39a('0x11')]){if(_0x253b99[_0xa39a('0x11')][_0xa39a('0x12')]===0x1f4){logger['error'](_0xa39a('0xd'),_0x4bb74c,_0x253b99[_0xa39a('0x11')][_0xa39a('0x13')]);return _0x3d91ef(_0x253b99[_0xa39a('0x11')][_0xa39a('0x13')]);}logger['error'](_0xa39a('0xd'),_0x4bb74c,_0x253b99['error'][_0xa39a('0x13')]);return _0x32e882(_0x253b99[_0xa39a('0x11')][_0xa39a('0x13')]);}else{logger[_0xa39a('0xc')](_0xa39a('0xd'),_0x4bb74c,_0xa39a('0xe'));_0x32e882(_0x253b99[_0xa39a('0x14')][_0xa39a('0x13')]);}})[_0xa39a('0x15')](function(_0x3292cd){logger[_0xa39a('0x11')](_0xa39a('0xd'),_0x4bb74c,_0x3292cd);_0x3d91ef(_0x3292cd);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 2a42377..3c967eb 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 _0xa9c6=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x523212,_0x437cc3){var _0x38c3b2=function(_0x863e08){while(--_0x863e08){_0x523212['push'](_0x523212['shift']());}};_0x38c3b2(++_0x437cc3);}(_0xa9c6,0x98));var _0x6a9c=function(_0x460323,_0x351529){_0x460323=_0x460323-0x0;var _0x55a047=_0xa9c6[_0x460323];return _0x55a047;};'use strict';var multer=require(_0x6a9c('0x0'));var util=require(_0x6a9c('0x1'));var path=require(_0x6a9c('0x2'));var timeout=require(_0x6a9c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6a9c('0x4'));var interaction=require(_0x6a9c('0x5'));var config=require('../../config/environment');var controller=require(_0x6a9c('0x6'));router[_0x6a9c('0x7')]('/',auth[_0x6a9c('0x8')](),controller[_0x6a9c('0x9')]);router['get'](_0x6a9c('0xa'),auth[_0x6a9c('0x8')](),controller[_0x6a9c('0xb')]);router['post']('/',auth[_0x6a9c('0x8')](),controller[_0x6a9c('0xc')]);router[_0x6a9c('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6a9c('0xe')]);router['delete'](_0x6a9c('0xa'),auth[_0x6a9c('0x8')](),controller[_0x6a9c('0xf')]);module[_0x6a9c('0x10')]=router; \ No newline at end of file +var _0xf7ea=['isAuthenticated','/:id','show','create','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7ea,0xaa));var _0xaf7e=function(_0x336a3b,_0x1d422c){_0x336a3b=_0x336a3b-0x0;var _0x1f505a=_0xf7ea[_0x336a3b];return _0x1f505a;};'use strict';var multer=require(_0xaf7e('0x0'));var util=require(_0xaf7e('0x1'));var path=require(_0xaf7e('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf7e('0x3'));var router=express[_0xaf7e('0x4')]();var auth=require(_0xaf7e('0x5'));var interaction=require(_0xaf7e('0x6'));var config=require(_0xaf7e('0x7'));var controller=require(_0xaf7e('0x8'));router[_0xaf7e('0x9')]('/',auth[_0xaf7e('0xa')](),controller['index']);router[_0xaf7e('0x9')](_0xaf7e('0xb'),auth['isAuthenticated'](),controller[_0xaf7e('0xc')]);router['post']('/',auth[_0xaf7e('0xa')](),controller[_0xaf7e('0xd')]);router['put']('/:id',auth[_0xaf7e('0xa')](),controller['update']);router['delete'](_0xaf7e('0xb'),auth[_0xaf7e('0xa')](),controller['destroy']);module[_0xaf7e('0xe')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 90c31a2..9c6ae35 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 _0xf3a4=['STRING'];(function(_0x57062a,_0x123026){var _0xa178da=function(_0x1702d6){while(--_0x1702d6){_0x57062a['push'](_0x57062a['shift']());}};_0xa178da(++_0x123026);}(_0xf3a4,0xf4));var _0x4f3a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf3a4[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4f3a('0x0')]},'basename':{'type':Sequelize[_0x4f3a('0x0')]},'type':{'type':Sequelize[_0x4f3a('0x0')]}}; \ No newline at end of file +var _0x395c=['sequelize','STRING'];(function(_0x37544b,_0x239ad2){var _0x1a56b4=function(_0x946e2e){while(--_0x946e2e){_0x37544b['push'](_0x37544b['shift']());}};_0x1a56b4(++_0x239ad2);}(_0x395c,0x146));var _0xc395=function(_0x46bdeb,_0x3834da){_0x46bdeb=_0x46bdeb-0x0;var _0xa8c210=_0x395c[_0x46bdeb];return _0xa8c210;};'use strict';var Sequelize=require(_0xc395('0x0'));module['exports']={'name':{'type':Sequelize[_0xc395('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc395('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 75ee18c..d136e81 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 _0xfecf=['find','clone','params','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','download','findOne','root','eml-format','zip-dir','request-promise','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','options'];(function(_0x4c44ef,_0x4ee3cd){var _0x2666e3=function(_0x52cc4a){while(--_0x52cc4a){_0x4c44ef['push'](_0x4c44ef['shift']());}};_0x2666e3(++_0x4ee3cd);}(_0xfecf,0xff));var _0xffec=function(_0x3ea2d3,_0x57c4ef){_0x3ea2d3=_0x3ea2d3-0x0;var _0x59c01c=_0xfecf[_0x3ea2d3];return _0x59c01c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xffec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xffec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xffec('0x2'));var moment=require('moment');var BPromise=require(_0xffec('0x3'));var Mustache=require(_0xffec('0x4'));var util=require('util');var path=require('path');var sox=require(_0xffec('0x5'));var csv=require(_0xffec('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xffec('0x7'));var squel=require('squel');var crypto=require(_0xffec('0x8'));var jsforce=require(_0xffec('0x9'));var deskjs=require(_0xffec('0xa'));var toCsv=require(_0xffec('0x6'));var querystring=require('querystring');var Papa=require(_0xffec('0xb'));var Redis=require(_0xffec('0xc'));var authService=require(_0xffec('0xd'));var qs=require(_0xffec('0xe'));var as=require(_0xffec('0xf'));var hardwareService=require(_0xffec('0x10'));var logger=require(_0xffec('0x11'))('api');var utils=require(_0xffec('0x12'));var config=require(_0xffec('0x13'));var db=require(_0xffec('0x14'))['db'];function respondWithStatusCode(_0x1ada6a,_0x360f44){_0x360f44=_0x360f44||0xcc;return function(_0x5cd7da){if(_0x5cd7da){return _0x1ada6a['sendStatus'](_0x360f44);}return _0x1ada6a[_0xffec('0x15')](_0x360f44)['end']();};}function respondWithResult(_0x47a4a3,_0xc6923d){_0xc6923d=_0xc6923d||0xc8;return function(_0x14bf73){if(_0x14bf73){return _0x47a4a3[_0xffec('0x15')](_0xc6923d)['json'](_0x14bf73);}};}function respondWithFilteredResult(_0x2acf0c,_0x342df1){return function(_0x529080){if(_0x529080){var _0x3de83c=_0x529080[_0xffec('0x16')],_0x13ba32=_0x342df1[_0xffec('0x17')],_0x5dd03e=_0x342df1[_0xffec('0x17')]+_0x342df1[_0xffec('0x18')],_0x32150a;if(_0x5dd03e>=_0x3de83c){_0x5dd03e=_0x3de83c;_0x32150a=0xc8;}else{_0x32150a=0xce;}_0x2acf0c[_0xffec('0x15')](_0x32150a);return _0x2acf0c[_0xffec('0x19')](_0xffec('0x1a'),_0x13ba32+'-'+_0x5dd03e+'/'+_0x3de83c)[_0xffec('0x1b')](_0x529080);}return null;};}function patchUpdates(_0x9c0dad){return function(_0x280fee){try{jsonpatch['apply'](_0x280fee,_0x9c0dad,!![]);}catch(_0x3de054){return BPromise[_0xffec('0x1c')](_0x3de054);}return _0x280fee[_0xffec('0x1d')]();};}function saveUpdates(_0x4f9665,_0x2d0de4){return function(_0x27577d){if(_0x27577d){return _0x27577d[_0xffec('0x1e')](_0x4f9665)[_0xffec('0x1f')](function(_0x3e7cfb){return _0x3e7cfb;});}return null;};}function removeEntity(_0x1b5091,_0x15c219){return function(_0x253863){if(_0x253863){return _0x253863[_0xffec('0x20')]()[_0xffec('0x1f')](function(){_0x1b5091[_0xffec('0x15')](0xcc)[_0xffec('0x21')]();});}};}function handleEntityNotFound(_0x2db289,_0xe93bbf){return function(_0x636c43){if(!_0x636c43){_0x2db289[_0xffec('0x22')](0x194);}return _0x636c43;};}function handleError(_0x54bb49,_0x349a22){_0x349a22=_0x349a22||0x1f4;return function(_0x4063b1){logger[_0xffec('0x23')](_0x4063b1[_0xffec('0x24')]);if(_0x4063b1[_0xffec('0x25')]){delete _0x4063b1['name'];}_0x54bb49[_0xffec('0x15')](_0x349a22)[_0xffec('0x26')](_0x4063b1);};}exports[_0xffec('0x27')]=function(_0x1b8ea1,_0x5063f2){var _0x264311={},_0x2f54fa={},_0x51b265={'count':0x0,'rows':[]};var _0x5c53a8=_[_0xffec('0x28')](db[_0xffec('0x29')][_0xffec('0x2a')],function(_0x564951){return{'name':_0x564951[_0xffec('0x2b')],'type':_0x564951[_0xffec('0x2c')][_0xffec('0x2d')]};});_0x2f54fa[_0xffec('0x2e')]=_['map'](_0x5c53a8,'name');_0x2f54fa['query']=_['keys'](_0x1b8ea1[_0xffec('0x2f')]);_0x2f54fa[_0xffec('0x30')]=_['intersection'](_0x2f54fa[_0xffec('0x2e')],_0x2f54fa[_0xffec('0x2f')]);_0x264311['attributes']=_[_0xffec('0x31')](_0x2f54fa[_0xffec('0x2e')],qs[_0xffec('0x32')](_0x1b8ea1[_0xffec('0x2f')][_0xffec('0x32')]));_0x264311[_0xffec('0x33')]=_0x264311[_0xffec('0x33')][_0xffec('0x34')]?_0x264311['attributes']:_0x2f54fa[_0xffec('0x2e')];if(!_0x1b8ea1[_0xffec('0x2f')]['hasOwnProperty']('nolimit')){_0x264311[_0xffec('0x18')]=qs[_0xffec('0x18')](_0x1b8ea1['query'][_0xffec('0x18')]);_0x264311[_0xffec('0x17')]=qs[_0xffec('0x17')](_0x1b8ea1[_0xffec('0x2f')]['offset']);}_0x264311['order']=qs['sort'](_0x1b8ea1[_0xffec('0x2f')]['sort']);_0x264311[_0xffec('0x35')]=qs[_0xffec('0x30')](_[_0xffec('0x36')](_0x1b8ea1[_0xffec('0x2f')],_0x2f54fa['filters']),_0x5c53a8);if(_0x1b8ea1[_0xffec('0x2f')][_0xffec('0x37')]){_0x264311[_0xffec('0x35')]=_[_0xffec('0x38')](_0x264311[_0xffec('0x35')],{'$or':_[_0xffec('0x28')](_0x5c53a8,function(_0x78108f){if(_0x78108f[_0xffec('0x2c')]!==_0xffec('0x39')){var _0xc87d31={};_0xc87d31[_0x78108f[_0xffec('0x25')]]={'$like':'%'+_0x1b8ea1['query'][_0xffec('0x37')]+'%'};return _0xc87d31;}})});}_0x264311=_[_0xffec('0x38')]({},_0x264311,_0x1b8ea1['options']);var _0x51f050={'where':_0x264311[_0xffec('0x35')]};return db['Attachment']['count'](_0x51f050)[_0xffec('0x1f')](function(_0x39f56b){_0x51b265['count']=_0x39f56b;if(_0x1b8ea1[_0xffec('0x2f')][_0xffec('0x3a')]){_0x264311[_0xffec('0x3b')]=[{'all':!![]}];}return db[_0xffec('0x29')][_0xffec('0x3c')](_0x264311);})[_0xffec('0x1f')](function(_0x4d108c){_0x51b265['rows']=_0x4d108c;return _0x51b265;})[_0xffec('0x1f')](respondWithFilteredResult(_0x5063f2,_0x264311))[_0xffec('0x3d')](handleError(_0x5063f2,null));};exports[_0xffec('0x3e')]=function(_0x44342a,_0x1d5417){var _0x5cb333={'raw':!![],'where':{'id':_0x44342a['params']['id']}},_0x166887={};_0x166887[_0xffec('0x2e')]=_[_0xffec('0x3f')](db[_0xffec('0x29')][_0xffec('0x2a')]);_0x166887[_0xffec('0x2f')]=_[_0xffec('0x3f')](_0x44342a['query']);_0x166887[_0xffec('0x30')]=_[_0xffec('0x31')](_0x166887[_0xffec('0x2e')],_0x166887[_0xffec('0x2f')]);_0x5cb333['attributes']=_[_0xffec('0x31')](_0x166887['model'],qs[_0xffec('0x32')](_0x44342a[_0xffec('0x2f')][_0xffec('0x32')]));_0x5cb333[_0xffec('0x33')]=_0x5cb333[_0xffec('0x33')][_0xffec('0x34')]?_0x5cb333[_0xffec('0x33')]:_0x166887[_0xffec('0x2e')];if(_0x44342a[_0xffec('0x2f')][_0xffec('0x3a')]){_0x5cb333[_0xffec('0x3b')]=[{'all':!![]}];}_0x5cb333=_[_0xffec('0x38')]({},_0x5cb333,_0x44342a[_0xffec('0x40')]);return db[_0xffec('0x29')][_0xffec('0x41')](_0x5cb333)['then'](handleEntityNotFound(_0x1d5417,null))[_0xffec('0x1f')](respondWithResult(_0x1d5417,null))[_0xffec('0x3d')](handleError(_0x1d5417,null));};exports[_0xffec('0x42')]=function(_0x13bfe2,_0x245bc2){var _0x587c1f={'where':{'id':_0x13bfe2[_0xffec('0x43')]['id']}},_0x363b9a={};_0x363b9a[_0xffec('0x2e')]=_['keys'](db[_0xffec('0x29')][_0xffec('0x2a')]);_0x587c1f[_0xffec('0x33')]=_[_0xffec('0x31')](_0x363b9a[_0xffec('0x2e')],qs[_0xffec('0x32')](_0x13bfe2[_0xffec('0x2f')][_0xffec('0x32')]));_0x587c1f['attributes']=_0x587c1f[_0xffec('0x33')][_0xffec('0x34')]?_0x587c1f['attributes']:_0x363b9a[_0xffec('0x2e')];if(_0x13bfe2['query']['includeAll']){_0x587c1f['include']=[{'all':!![]}];}_0x587c1f=_[_0xffec('0x38')]({},_0x587c1f,_0x13bfe2[_0xffec('0x40')]);return db[_0xffec('0x29')][_0xffec('0x41')](_0x587c1f)['then'](handleEntityNotFound(_0x245bc2,null))[_0xffec('0x1f')](function(_0x1d327d){if(_0x1d327d){var _0x1abd7c=_0x1d327d['get']({'plain':!![]});_0x1abd7c=qs[_0xffec('0x44')](_0x1abd7c,['id',_0xffec('0x45'),_0xffec('0x46')]);_0x13bfe2['body']=_[_0xffec('0x44')](_0x13bfe2[_0xffec('0x47')],['id','createdAt',_0xffec('0x46')]);return db['Attachment'][_0xffec('0x48')](_[_0xffec('0x38')](_0x1abd7c,_0x13bfe2[_0xffec('0x47')]),{'include':_0x13bfe2[_0xffec('0x2f')][_0xffec('0x3a')]?[{'all':!![]}]:undefined});}})[_0xffec('0x1f')](respondWithResult(_0x245bc2,0xc9))[_0xffec('0x3d')](handleError(_0x245bc2,null));};exports[_0xffec('0x1e')]=function(_0x22f345,_0x4ae7bf){if(_0x22f345[_0xffec('0x47')]['id']){delete _0x22f345[_0xffec('0x47')]['id'];}return db['Attachment'][_0xffec('0x41')]({'where':{'id':_0x22f345[_0xffec('0x43')]['id']}})[_0xffec('0x1f')](handleEntityNotFound(_0x4ae7bf,null))[_0xffec('0x1f')](saveUpdates(_0x22f345[_0xffec('0x47')],null))[_0xffec('0x1f')](respondWithResult(_0x4ae7bf,null))[_0xffec('0x3d')](handleError(_0x4ae7bf,null));};exports['destroy']=function(_0xea5bd4,_0x541c5f){return db[_0xffec('0x29')][_0xffec('0x41')]({'where':{'id':_0xea5bd4[_0xffec('0x43')]['id']}})['then'](handleEntityNotFound(_0x541c5f,null))[_0xffec('0x1f')](removeEntity(_0x541c5f,null))[_0xffec('0x3d')](handleError(_0x541c5f,null));};exports['create']=function(_0x502c25,_0x863192,_0x152af){_0x502c25[_0xffec('0x47')][_0xffec('0x25')]=_0x502c25[_0xffec('0x49')][_0xffec('0x4a')];_0x502c25[_0xffec('0x47')][_0xffec('0x4b')]=_0x502c25[_0xffec('0x49')]['filename'];_0x502c25[_0xffec('0x47')][_0xffec('0x2c')]=_0x502c25[_0xffec('0x49')][_0xffec('0x4c')];return db['Attachment'][_0xffec('0x48')](_0x502c25[_0xffec('0x47')])[_0xffec('0x1f')](respondWithResult(_0x863192,0xc9))[_0xffec('0x3d')](handleError(_0x863192,null));};exports[_0xffec('0x4d')]=function(_0x556067,_0x9934b1,_0x19687b){return db['Attachment'][_0xffec('0x4e')]({'where':{'id':_0x556067[_0xffec('0x43')]['id']},'raw':!![]})[_0xffec('0x1f')](handleEntityNotFound(_0x9934b1,null))[_0xffec('0x1f')](function(_0x51a551){if(_0x51a551){return _0x9934b1['download'](path['join'](config[_0xffec('0x4f')],'server/files/attachments/',_0x51a551[_0xffec('0x4b')]));}})[_0xffec('0x3d')](handleError(_0x9934b1,null));}; \ No newline at end of file +var _0xe74e=['find','clone','options','get','createdAt','body','omit','create','update','originalname','basename','file','mimetype','findOne','download','join','root','server/files/attachments/','eml-format','request-promise','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','then','destroy','end','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','catch','show','params','length'];(function(_0x47e3de,_0x386d59){var _0x38f904=function(_0x126db9){while(--_0x126db9){_0x47e3de['push'](_0x47e3de['shift']());}};_0x38f904(++_0x386d59);}(_0xe74e,0x102));var _0xee74=function(_0x1f29fb,_0x5ccfd4){_0x1f29fb=_0x1f29fb-0x0;var _0x3d47aa=_0xe74e[_0x1f29fb];return _0x3d47aa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xee74('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xee74('0x1'));var moment=require('moment');var BPromise=require(_0xee74('0x2'));var Mustache=require('mustache');var util=require(_0xee74('0x3'));var path=require(_0xee74('0x4'));var sox=require('sox');var csv=require(_0xee74('0x5'));var ejs=require(_0xee74('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xee74('0x7'));var crypto=require('crypto');var jsforce=require(_0xee74('0x8'));var deskjs=require(_0xee74('0x9'));var toCsv=require('to-csv');var querystring=require(_0xee74('0xa'));var Papa=require(_0xee74('0xb'));var Redis=require('ioredis');var authService=require(_0xee74('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xee74('0xd'));var hardwareService=require(_0xee74('0xe'));var logger=require(_0xee74('0xf'))('api');var utils=require(_0xee74('0x10'));var config=require(_0xee74('0x11'));var db=require(_0xee74('0x12'))['db'];function respondWithStatusCode(_0x51ef86,_0x1b8149){_0x1b8149=_0x1b8149||0xcc;return function(_0x480fe3){if(_0x480fe3){return _0x51ef86[_0xee74('0x13')](_0x1b8149);}return _0x51ef86[_0xee74('0x14')](_0x1b8149)['end']();};}function respondWithResult(_0xaab6e9,_0x457244){_0x457244=_0x457244||0xc8;return function(_0xe1b122){if(_0xe1b122){return _0xaab6e9['status'](_0x457244)[_0xee74('0x15')](_0xe1b122);}};}function respondWithFilteredResult(_0x106efd,_0x1bbe3b){return function(_0x54d9b3){if(_0x54d9b3){var _0x5da224=_0x54d9b3['count'],_0x4b9dca=_0x1bbe3b[_0xee74('0x16')],_0x471724=_0x1bbe3b['offset']+_0x1bbe3b[_0xee74('0x17')],_0x2261cc;if(_0x471724>=_0x5da224){_0x471724=_0x5da224;_0x2261cc=0xc8;}else{_0x2261cc=0xce;}_0x106efd[_0xee74('0x14')](_0x2261cc);return _0x106efd[_0xee74('0x18')](_0xee74('0x19'),_0x4b9dca+'-'+_0x471724+'/'+_0x5da224)[_0xee74('0x15')](_0x54d9b3);}return null;};}function patchUpdates(_0x18dae8){return function(_0x22ab7a){try{jsonpatch[_0xee74('0x1a')](_0x22ab7a,_0x18dae8,!![]);}catch(_0x12d402){return BPromise[_0xee74('0x1b')](_0x12d402);}return _0x22ab7a['save']();};}function saveUpdates(_0x2ab1ec,_0x23aad8){return function(_0xb02d26){if(_0xb02d26){return _0xb02d26['update'](_0x2ab1ec)[_0xee74('0x1c')](function(_0x53d576){return _0x53d576;});}return null;};}function removeEntity(_0x43cd72,_0x8c700){return function(_0x3b9e13){if(_0x3b9e13){return _0x3b9e13[_0xee74('0x1d')]()[_0xee74('0x1c')](function(){_0x43cd72[_0xee74('0x14')](0xcc)[_0xee74('0x1e')]();});}};}function handleEntityNotFound(_0x486b33,_0x441818){return function(_0x13c530){if(!_0x13c530){_0x486b33[_0xee74('0x13')](0x194);}return _0x13c530;};}function handleError(_0x75e256,_0x358d4e){_0x358d4e=_0x358d4e||0x1f4;return function(_0x14be50){logger['error'](_0x14be50['stack']);if(_0x14be50['name']){delete _0x14be50[_0xee74('0x1f')];}_0x75e256['status'](_0x358d4e)['send'](_0x14be50);};}exports[_0xee74('0x20')]=function(_0x47e34f,_0x30add2){var _0x5b97f3={},_0x43474f={},_0x7425b9={'count':0x0,'rows':[]};var _0x4f4b73=_[_0xee74('0x21')](db[_0xee74('0x22')][_0xee74('0x23')],function(_0x540acb){return{'name':_0x540acb[_0xee74('0x24')],'type':_0x540acb[_0xee74('0x25')][_0xee74('0x26')]};});_0x43474f[_0xee74('0x27')]=_[_0xee74('0x21')](_0x4f4b73,_0xee74('0x1f'));_0x43474f[_0xee74('0x28')]=_[_0xee74('0x29')](_0x47e34f[_0xee74('0x28')]);_0x43474f[_0xee74('0x2a')]=_[_0xee74('0x2b')](_0x43474f['model'],_0x43474f[_0xee74('0x28')]);_0x5b97f3['attributes']=_[_0xee74('0x2b')](_0x43474f[_0xee74('0x27')],qs[_0xee74('0x2c')](_0x47e34f[_0xee74('0x28')][_0xee74('0x2c')]));_0x5b97f3[_0xee74('0x2d')]=_0x5b97f3['attributes']['length']?_0x5b97f3[_0xee74('0x2d')]:_0x43474f[_0xee74('0x27')];if(!_0x47e34f[_0xee74('0x28')][_0xee74('0x2e')](_0xee74('0x2f'))){_0x5b97f3[_0xee74('0x17')]=qs[_0xee74('0x17')](_0x47e34f[_0xee74('0x28')][_0xee74('0x17')]);_0x5b97f3['offset']=qs[_0xee74('0x16')](_0x47e34f[_0xee74('0x28')][_0xee74('0x16')]);}_0x5b97f3['order']=qs[_0xee74('0x30')](_0x47e34f[_0xee74('0x28')][_0xee74('0x30')]);_0x5b97f3[_0xee74('0x31')]=qs[_0xee74('0x2a')](_[_0xee74('0x32')](_0x47e34f[_0xee74('0x28')],_0x43474f['filters']),_0x4f4b73);if(_0x47e34f[_0xee74('0x28')]['filter']){_0x5b97f3[_0xee74('0x31')]=_[_0xee74('0x33')](_0x5b97f3[_0xee74('0x31')],{'$or':_[_0xee74('0x21')](_0x4f4b73,function(_0x56b49c){if(_0x56b49c[_0xee74('0x25')]!==_0xee74('0x34')){var _0x5a69f8={};_0x5a69f8[_0x56b49c['name']]={'$like':'%'+_0x47e34f['query'][_0xee74('0x35')]+'%'};return _0x5a69f8;}})});}_0x5b97f3=_[_0xee74('0x33')]({},_0x5b97f3,_0x47e34f['options']);var _0x6cb2b8={'where':_0x5b97f3[_0xee74('0x31')]};return db[_0xee74('0x22')][_0xee74('0x36')](_0x6cb2b8)[_0xee74('0x1c')](function(_0x324c0d){_0x7425b9[_0xee74('0x36')]=_0x324c0d;if(_0x47e34f['query'][_0xee74('0x37')]){_0x5b97f3[_0xee74('0x38')]=[{'all':!![]}];}return db[_0xee74('0x22')][_0xee74('0x39')](_0x5b97f3);})[_0xee74('0x1c')](function(_0x44c4ed){_0x7425b9['rows']=_0x44c4ed;return _0x7425b9;})[_0xee74('0x1c')](respondWithFilteredResult(_0x30add2,_0x5b97f3))[_0xee74('0x3a')](handleError(_0x30add2,null));};exports[_0xee74('0x3b')]=function(_0x4c3882,_0x37b28d){var _0x5bc192={'raw':!![],'where':{'id':_0x4c3882[_0xee74('0x3c')]['id']}},_0x266beb={};_0x266beb['model']=_[_0xee74('0x29')](db[_0xee74('0x22')][_0xee74('0x23')]);_0x266beb[_0xee74('0x28')]=_[_0xee74('0x29')](_0x4c3882[_0xee74('0x28')]);_0x266beb['filters']=_[_0xee74('0x2b')](_0x266beb[_0xee74('0x27')],_0x266beb['query']);_0x5bc192[_0xee74('0x2d')]=_['intersection'](_0x266beb[_0xee74('0x27')],qs['fields'](_0x4c3882[_0xee74('0x28')][_0xee74('0x2c')]));_0x5bc192[_0xee74('0x2d')]=_0x5bc192[_0xee74('0x2d')][_0xee74('0x3d')]?_0x5bc192['attributes']:_0x266beb[_0xee74('0x27')];if(_0x4c3882[_0xee74('0x28')][_0xee74('0x37')]){_0x5bc192['include']=[{'all':!![]}];}_0x5bc192=_[_0xee74('0x33')]({},_0x5bc192,_0x4c3882['options']);return db[_0xee74('0x22')][_0xee74('0x3e')](_0x5bc192)['then'](handleEntityNotFound(_0x37b28d,null))[_0xee74('0x1c')](respondWithResult(_0x37b28d,null))[_0xee74('0x3a')](handleError(_0x37b28d,null));};exports[_0xee74('0x3f')]=function(_0x4c6424,_0x5656b3){var _0x130b38={'where':{'id':_0x4c6424['params']['id']}},_0x508c8f={};_0x508c8f[_0xee74('0x27')]=_[_0xee74('0x29')](db['Attachment'][_0xee74('0x23')]);_0x130b38[_0xee74('0x2d')]=_[_0xee74('0x2b')](_0x508c8f[_0xee74('0x27')],qs[_0xee74('0x2c')](_0x4c6424['query'][_0xee74('0x2c')]));_0x130b38[_0xee74('0x2d')]=_0x130b38[_0xee74('0x2d')][_0xee74('0x3d')]?_0x130b38['attributes']:_0x508c8f[_0xee74('0x27')];if(_0x4c6424['query']['includeAll']){_0x130b38['include']=[{'all':!![]}];}_0x130b38=_[_0xee74('0x33')]({},_0x130b38,_0x4c6424[_0xee74('0x40')]);return db[_0xee74('0x22')]['find'](_0x130b38)[_0xee74('0x1c')](handleEntityNotFound(_0x5656b3,null))[_0xee74('0x1c')](function(_0x2147ac){if(_0x2147ac){var _0x5c816b=_0x2147ac[_0xee74('0x41')]({'plain':!![]});_0x5c816b=qs['omit'](_0x5c816b,['id',_0xee74('0x42'),'updatedAt']);_0x4c6424[_0xee74('0x43')]=_[_0xee74('0x44')](_0x4c6424['body'],['id','createdAt','updatedAt']);return db[_0xee74('0x22')][_0xee74('0x45')](_[_0xee74('0x33')](_0x5c816b,_0x4c6424[_0xee74('0x43')]),{'include':_0x4c6424[_0xee74('0x28')][_0xee74('0x37')]?[{'all':!![]}]:undefined});}})[_0xee74('0x1c')](respondWithResult(_0x5656b3,0xc9))['catch'](handleError(_0x5656b3,null));};exports[_0xee74('0x46')]=function(_0x5db829,_0x3fd938){if(_0x5db829[_0xee74('0x43')]['id']){delete _0x5db829[_0xee74('0x43')]['id'];}return db[_0xee74('0x22')][_0xee74('0x3e')]({'where':{'id':_0x5db829[_0xee74('0x3c')]['id']}})[_0xee74('0x1c')](handleEntityNotFound(_0x3fd938,null))[_0xee74('0x1c')](saveUpdates(_0x5db829[_0xee74('0x43')],null))[_0xee74('0x1c')](respondWithResult(_0x3fd938,null))[_0xee74('0x3a')](handleError(_0x3fd938,null));};exports['destroy']=function(_0x52e280,_0x11cbba){return db[_0xee74('0x22')][_0xee74('0x3e')]({'where':{'id':_0x52e280[_0xee74('0x3c')]['id']}})[_0xee74('0x1c')](handleEntityNotFound(_0x11cbba,null))[_0xee74('0x1c')](removeEntity(_0x11cbba,null))['catch'](handleError(_0x11cbba,null));};exports[_0xee74('0x45')]=function(_0x509817,_0x391ab4,_0x438a15){_0x509817['body'][_0xee74('0x1f')]=_0x509817['file'][_0xee74('0x47')];_0x509817[_0xee74('0x43')][_0xee74('0x48')]=_0x509817[_0xee74('0x49')]['filename'];_0x509817[_0xee74('0x43')][_0xee74('0x25')]=_0x509817[_0xee74('0x49')][_0xee74('0x4a')];return db[_0xee74('0x22')][_0xee74('0x45')](_0x509817['body'])['then'](respondWithResult(_0x391ab4,0xc9))[_0xee74('0x3a')](handleError(_0x391ab4,null));};exports['download']=function(_0x6745d4,_0xb50b1c,_0x46ae26){return db[_0xee74('0x22')][_0xee74('0x4b')]({'where':{'id':_0x6745d4['params']['id']},'raw':!![]})[_0xee74('0x1c')](handleEntityNotFound(_0xb50b1c,null))[_0xee74('0x1c')](function(_0x2c2f4f){if(_0x2c2f4f){return _0xb50b1c[_0xee74('0x4c')](path[_0xee74('0x4d')](config[_0xee74('0x4e')],_0xee74('0x4f'),_0x2c2f4f['basename']));}})[_0xee74('0x3a')](handleError(_0xb50b1c,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index add3f9d..7643cdc 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 _0x668b=['attachments','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./attachment.attributes','define','Attachment'];(function(_0x14102c,_0x1cb214){var _0x13297b=function(_0x1f4372){while(--_0x1f4372){_0x14102c['push'](_0x14102c['shift']());}};_0x13297b(++_0x1cb214);}(_0x668b,0x140));var _0xb668=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0x668b[_0x58d5ac];return _0x37985c;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./attachment.attributes','define','Attachment','attachments','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1dfb23,_0x244353){_0x1dfb23=_0x1dfb23-0x0;var _0x176e75=_0x6f0d[_0x1dfb23];return _0x176e75;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'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 84b02f7..412634a 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 _0xd4e4=['error','code','message','info','request\x20sent','result','catch','Attachment','create','body','options','raw','then','CreateAttachment','lodash','util','moment','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1fc418,_0x9078b2){var _0x44860d=function(_0x42ee07){while(--_0x42ee07){_0x1fc418['push'](_0x1fc418['shift']());}};_0x44860d(++_0x9078b2);}(_0xd4e4,0x1ea));var _0x4d4e=function(_0x2d6908,_0x508240){_0x2d6908=_0x2d6908-0x0;var _0x31ac32=_0xd4e4[_0x2d6908];return _0x31ac32;};'use strict';var _=require(_0x4d4e('0x0'));var util=require(_0x4d4e('0x1'));var moment=require(_0x4d4e('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d4e('0x3'));var fs=require('fs');var Redis=require(_0x4d4e('0x4'));var db=require(_0x4d4e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4d4e('0x6'));var client=jayson[_0x4d4e('0x7')][_0x4d4e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3188bf,_0xcef695,_0x1dc6d0){return new BPromise(function(_0x27fe3f,_0x598eca){return client[_0x4d4e('0x9')](_0x3188bf,_0x1dc6d0)['then'](function(_0x24b61d){logger['info'](_0x4d4e('0xa'),_0xcef695,'request\x20sent');logger[_0x4d4e('0xb')](_0x4d4e('0xc'),_0xcef695,'request\x20sent',JSON[_0x4d4e('0xd')](_0x24b61d));if(_0x24b61d[_0x4d4e('0xe')]){if(_0x24b61d['error'][_0x4d4e('0xf')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0xcef695,_0x24b61d[_0x4d4e('0xe')][_0x4d4e('0x10')]);return _0x598eca(_0x24b61d[_0x4d4e('0xe')]['message']);}logger[_0x4d4e('0xe')](_0x4d4e('0xa'),_0xcef695,_0x24b61d[_0x4d4e('0xe')][_0x4d4e('0x10')]);return _0x27fe3f(_0x24b61d[_0x4d4e('0xe')][_0x4d4e('0x10')]);}else{logger[_0x4d4e('0x11')](_0x4d4e('0xa'),_0xcef695,_0x4d4e('0x12'));_0x27fe3f(_0x24b61d[_0x4d4e('0x13')][_0x4d4e('0x10')]);}})[_0x4d4e('0x14')](function(_0x267f8b){logger[_0x4d4e('0xe')]('Attachment,\x20%s,\x20%s',_0xcef695,_0x267f8b);_0x598eca(_0x267f8b);});});}exports['CreateAttachment']=function(_0x41d30b){var _0x437e69=this;return new Promise(function(_0x591e68,_0x4a8e82){return db[_0x4d4e('0x15')][_0x4d4e('0x16')](_0x41d30b[_0x4d4e('0x17')],{'raw':_0x41d30b[_0x4d4e('0x18')]?_0x41d30b[_0x4d4e('0x18')][_0x4d4e('0x19')]===undefined?!![]:![]:!![]})[_0x4d4e('0x1a')](function(_0x40ce5f){logger[_0x4d4e('0x11')](_0x4d4e('0x1b'),_0x41d30b);logger[_0x4d4e('0xb')](_0x4d4e('0x1b'),_0x41d30b,JSON['stringify'](_0x40ce5f));_0x591e68(_0x40ce5f);})[_0x4d4e('0x14')](function(_0x22260d){logger[_0x4d4e('0xe')](_0x4d4e('0x1b'),_0x22260d[_0x4d4e('0x10')],_0x41d30b);_0x4a8e82(_0x437e69['error'](0x1f4,_0x22260d[_0x4d4e('0x10')]));});});}; \ No newline at end of file +var _0x9613=['stringify','error','code','Attachment,\x20%s,\x20%s','message','result','catch','Attachment','create','options','CreateAttachment','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug'];(function(_0x423b21,_0x2f8eb6){var _0x10a897=function(_0x36722b){while(--_0x36722b){_0x423b21['push'](_0x423b21['shift']());}};_0x10a897(++_0x2f8eb6);}(_0x9613,0x8d));var _0x3961=function(_0x416eb6,_0xfe7e4){_0x416eb6=_0x416eb6-0x0;var _0x104505=_0x9613[_0x416eb6];return _0x104505;};'use strict';var _=require(_0x3961('0x0'));var util=require(_0x3961('0x1'));var moment=require(_0x3961('0x2'));var BPromise=require('bluebird');var rs=require(_0x3961('0x3'));var fs=require('fs');var Redis=require(_0x3961('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3961('0x5'));var logger=require(_0x3961('0x6'))(_0x3961('0x7'));var config=require(_0x3961('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3961('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b2d40,_0x76f798,_0x21ca30){return new BPromise(function(_0x1fab20,_0x2ea5b7){return client[_0x3961('0xa')](_0x1b2d40,_0x21ca30)[_0x3961('0xb')](function(_0x550967){logger[_0x3961('0xc')]('Attachment,\x20%s,\x20%s',_0x76f798,_0x3961('0xd'));logger[_0x3961('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x76f798,_0x3961('0xd'),JSON[_0x3961('0xf')](_0x550967));if(_0x550967['error']){if(_0x550967[_0x3961('0x10')][_0x3961('0x11')]===0x1f4){logger['error'](_0x3961('0x12'),_0x76f798,_0x550967[_0x3961('0x10')][_0x3961('0x13')]);return _0x2ea5b7(_0x550967[_0x3961('0x10')][_0x3961('0x13')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x76f798,_0x550967[_0x3961('0x10')]['message']);return _0x1fab20(_0x550967['error'][_0x3961('0x13')]);}else{logger[_0x3961('0xc')](_0x3961('0x12'),_0x76f798,_0x3961('0xd'));_0x1fab20(_0x550967[_0x3961('0x14')][_0x3961('0x13')]);}})[_0x3961('0x15')](function(_0xf9de28){logger[_0x3961('0x10')](_0x3961('0x12'),_0x76f798,_0xf9de28);_0x2ea5b7(_0xf9de28);});});}exports['CreateAttachment']=function(_0x3ef458){var _0x26dc97=this;return new Promise(function(_0x2d9305,_0x2863cf){return db[_0x3961('0x16')][_0x3961('0x17')](_0x3ef458['body'],{'raw':_0x3ef458[_0x3961('0x18')]?_0x3ef458[_0x3961('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3961('0xb')](function(_0x2f3df9){logger['info'](_0x3961('0x19'),_0x3ef458);logger[_0x3961('0xe')](_0x3961('0x19'),_0x3ef458,JSON['stringify'](_0x2f3df9));_0x2d9305(_0x2f3df9);})[_0x3961('0x15')](function(_0x287ae2){logger[_0x3961('0x10')](_0x3961('0x19'),_0x287ae2['message'],_0x3ef458);_0x2863cf(_0x26dc97[_0x3961('0x10')](0x1f4,_0x287ae2[_0x3961('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3d80766..51b4c60 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 _0xee65=['single','file','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','post'];(function(_0x3a283d,_0xb82548){var _0x10c980=function(_0x336ab0){while(--_0x336ab0){_0x3a283d['push'](_0x3a283d['shift']());}};_0x10c980(++_0xb82548);}(_0xee65,0x138));var _0x5ee6=function(_0x4c6f55,_0x12ae95){_0x4c6f55=_0x4c6f55-0x0;var _0x3418f6=_0xee65[_0x4c6f55];return _0x3418f6;};'use strict';var multer=require(_0x5ee6('0x0'));var util=require(_0x5ee6('0x1'));var path=require(_0x5ee6('0x2'));var timeout=require(_0x5ee6('0x3'));var express=require(_0x5ee6('0x4'));var router=express[_0x5ee6('0x5')]();var auth=require(_0x5ee6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5ee6('0x7'));var controller=require(_0x5ee6('0x8'));router[_0x5ee6('0x9')]('/',auth[_0x5ee6('0xa')](),controller[_0x5ee6('0xb')]);router['get'](_0x5ee6('0xc'),auth['isAuthenticated'](),controller[_0x5ee6('0xd')]);router[_0x5ee6('0x9')](_0x5ee6('0xe'),auth[_0x5ee6('0xa')](),controller[_0x5ee6('0xf')]);router['post'](_0x5ee6('0x10'),auth['isAuthenticated'](),controller[_0x5ee6('0x11')]);var upload=multer({'storage':multer[_0x5ee6('0x12')]({'destination':function(_0x88c552,_0x2e9a2d,_0x52a78d){_0x52a78d(null,path[_0x5ee6('0x13')](config[_0x5ee6('0x14')],_0x5ee6('0x15')));},'filename':function(_0xb57105,_0x45bb73,_0x4c182e){_0x4c182e(null,util[_0x5ee6('0x16')](_0x5ee6('0x17'),Date[_0x5ee6('0x18')](),_0x45bb73[_0x5ee6('0x19')][_0x5ee6('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5ee6('0x1b')]('/',upload[_0x5ee6('0x1c')](_0x5ee6('0x1d')),controller[_0x5ee6('0x1e')]);router[_0x5ee6('0x1f')](_0x5ee6('0xc'),auth[_0x5ee6('0xa')](),controller['update']);router['delete'](_0x5ee6('0xc'),auth['isAuthenticated'](),controller[_0x5ee6('0x20')]);module[_0x5ee6('0x21')]=router; \ No newline at end of file +var _0xfef9=['/:id/clone','clone','join','root','server/files/attachments/','format','%s-%s','originalname','replace','single','file','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','post'];(function(_0x2d01be,_0xa27d64){var _0x2e4ec9=function(_0x2aca94){while(--_0x2aca94){_0x2d01be['push'](_0x2d01be['shift']());}};_0x2e4ec9(++_0xa27d64);}(_0xfef9,0xd3));var _0x9fef=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0xfef9[_0x24b477];return _0x4041a6;};'use strict';var multer=require(_0x9fef('0x0'));var util=require(_0x9fef('0x1'));var path=require('path');var timeout=require(_0x9fef('0x2'));var express=require(_0x9fef('0x3'));var router=express['Router']();var auth=require(_0x9fef('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9fef('0x5'));var controller=require('./attachment.controller');router[_0x9fef('0x6')]('/',auth[_0x9fef('0x7')](),controller['index']);router[_0x9fef('0x6')](_0x9fef('0x8'),auth['isAuthenticated'](),controller[_0x9fef('0x9')]);router[_0x9fef('0x6')](_0x9fef('0xa'),auth['isAuthenticated'](),controller[_0x9fef('0xb')]);router[_0x9fef('0xc')](_0x9fef('0xd'),auth['isAuthenticated'](),controller[_0x9fef('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c7241,_0x34442f,_0x2ff18e){_0x2ff18e(null,path[_0x9fef('0xf')](config[_0x9fef('0x10')],_0x9fef('0x11')));},'filename':function(_0xfd9eec,_0x5ba68a,_0x37640b){_0x37640b(null,util[_0x9fef('0x12')](_0x9fef('0x13'),Date['now'](),_0x5ba68a[_0x9fef('0x14')][_0x9fef('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9fef('0xc')]('/',upload[_0x9fef('0x16')](_0x9fef('0x17')),controller['create']);router[_0x9fef('0x18')]('/:id',auth[_0x9fef('0x7')](),controller['update']);router[_0x9fef('0x19')](_0x9fef('0x8'),auth[_0x9fef('0x7')](),controller[_0x9fef('0x1a')]);module[_0x9fef('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 4ff72da..40133b7 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 _0x3eeb=['../../components/auth/service','signToken','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','emails','admin','user','agent','disabled','blocked','blockedAt','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment'];(function(_0x2e8794,_0x589fc9){var _0xc2a1c1=function(_0x2687b3){while(--_0x2687b3){_0x2e8794['push'](_0x2e8794['shift']());}};_0xc2a1c1(++_0x589fc9);}(_0x3eeb,0x1f2));var _0xb3ee=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x3eeb[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xb3ee('0x0'));var passport=require(_0xb3ee('0x1'));var GoogleStrategy=require(_0xb3ee('0x2'))[_0xb3ee('0x3')];var moment=require('moment');var db=require(_0xb3ee('0x4'))['db'];var config=require(_0xb3ee('0x5'));var signToken=require(_0xb3ee('0x6'))[_0xb3ee('0x7')];var utils=require(_0xb3ee('0x8'));exports[_0xb3ee('0x9')]=passport['authenticate'](_0xb3ee('0xa'),{'failureRedirect':_0xb3ee('0xb'),'scope':[_0xb3ee('0xc'),_0xb3ee('0xd')],'session':![]});exports[_0xb3ee('0xe')]=passport[_0xb3ee('0xf')](_0xb3ee('0xa'),{'failureRedirect':_0xb3ee('0xb'),'session':![]});passport[_0xb3ee('0x10')](new GoogleStrategy({'clientID':config[_0xb3ee('0xa')]?config[_0xb3ee('0xa')][_0xb3ee('0x11')]:'id','clientSecret':config[_0xb3ee('0xa')]?config[_0xb3ee('0xa')]['clientSecret']:'secret','callbackURL':config['google']?config['google'][_0xb3ee('0x12')]:''},function(_0x683d68,_0x3c849c,_0x2f7880,_0x542624){var _0x508d4d,_0x13744e;return db['Setting'][_0xb3ee('0x13')]({'where':{'id':0x1},'attributes':[_0xb3ee('0x14'),_0xb3ee('0x15')],'raw':!![]})[_0xb3ee('0x16')](function(_0x4deb4b){_0x508d4d=_0x4deb4b;return db[_0xb3ee('0x17')][_0xb3ee('0x18')]({'where':{'email':_['map'](_0x2f7880[_0xb3ee('0x19')],'value'),'role':{'$or':[_0xb3ee('0x1a'),_0xb3ee('0x1b'),_0xb3ee('0x1c')]}}});})['then'](function(_0x353d50){_0x13744e=_0x353d50;if(_0x13744e){if(_0x13744e[_0xb3ee('0x1d')]){return _0x542624('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x508d4d['blockDuration']>0x0){if(_0x13744e[_0xb3ee('0x1e')]){if(moment(_0x13744e[_0xb3ee('0x1f')])['add'](_0x508d4d['blockDuration'],'minutes')>moment()){return _0x542624(_0xb3ee('0x20'));}else{return utils[_0xb3ee('0x21')](_0x13744e,0x0,![],null)['then'](function(){return utils[_0xb3ee('0x22')](_0x13744e);})['then'](function(){return _0x542624(null,_0x13744e);});}}else{return utils[_0xb3ee('0x22')](_0x13744e)[_0xb3ee('0x16')](function(){return _0x542624(null,_0x13744e);});}}else{return utils['getLicense'](_0x13744e)[_0xb3ee('0x16')](function(){return _0x542624(null,_0x13744e);});}}return _0x542624('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xb3ee('0x23')](function(_0x2deb7d){_0x542624(_0x2deb7d);});})); \ No newline at end of file +var _0x8d4f=['use','clientID','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','find','emails','value','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','getLicense','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0x8d4f,0x102));var _0xf8d4=function(_0x3da1c5,_0x53f43f){_0x3da1c5=_0x3da1c5-0x0;var _0x20d262=_0x8d4f[_0x3da1c5];return _0x20d262;};'use strict';var _=require(_0xf8d4('0x0'));var passport=require(_0xf8d4('0x1'));var GoogleStrategy=require(_0xf8d4('0x2'))['Strategy'];var moment=require(_0xf8d4('0x3'));var db=require(_0xf8d4('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0xf8d4('0x5'))[_0xf8d4('0x6')];var utils=require(_0xf8d4('0x7'));exports[_0xf8d4('0x8')]=passport[_0xf8d4('0x9')](_0xf8d4('0xa'),{'failureRedirect':_0xf8d4('0xb'),'scope':[_0xf8d4('0xc'),_0xf8d4('0xd')],'session':![]});exports['callback']=passport[_0xf8d4('0x9')](_0xf8d4('0xa'),{'failureRedirect':_0xf8d4('0xb'),'session':![]});passport[_0xf8d4('0xe')](new GoogleStrategy({'clientID':config[_0xf8d4('0xa')]?config[_0xf8d4('0xa')][_0xf8d4('0xf')]:'id','clientSecret':config['google']?config[_0xf8d4('0xa')]['clientSecret']:_0xf8d4('0x10'),'callbackURL':config[_0xf8d4('0xa')]?config['google'][_0xf8d4('0x11')]:''},function(_0x4f2d8c,_0x5542c1,_0x17675f,_0x148a53){var _0x2a7d9d,_0x261fef;return db['Setting'][_0xf8d4('0x12')]({'where':{'id':0x1},'attributes':[_0xf8d4('0x13'),_0xf8d4('0x14')],'raw':!![]})[_0xf8d4('0x15')](function(_0x3e316c){_0x2a7d9d=_0x3e316c;return db['User'][_0xf8d4('0x16')]({'where':{'email':_['map'](_0x17675f[_0xf8d4('0x17')],_0xf8d4('0x18')),'role':{'$or':['admin',_0xf8d4('0x19'),_0xf8d4('0x1a')]}}});})['then'](function(_0x1f5567){_0x261fef=_0x1f5567;if(_0x261fef){if(_0x261fef[_0xf8d4('0x1b')]){return _0x148a53(_0xf8d4('0x1c'));}else if(_0x2a7d9d[_0xf8d4('0x14')]>0x0){if(_0x261fef['blocked']){if(moment(_0x261fef[_0xf8d4('0x1d')])[_0xf8d4('0x1e')](_0x2a7d9d[_0xf8d4('0x14')],_0xf8d4('0x1f'))>moment()){return _0x148a53('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xf8d4('0x20')](_0x261fef,0x0,![],null)[_0xf8d4('0x15')](function(){return utils[_0xf8d4('0x21')](_0x261fef);})[_0xf8d4('0x15')](function(){return _0x148a53(null,_0x261fef);});}}else{return utils[_0xf8d4('0x21')](_0x261fef)[_0xf8d4('0x15')](function(){return _0x148a53(null,_0x261fef);});}}else{return utils[_0xf8d4('0x21')](_0x261fef)['then'](function(){return _0x148a53(null,_0x261fef);});}}return _0x148a53(_0xf8d4('0x1c'));})['catch'](function(_0x17615c){_0x148a53(_0x17615c);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 1e3fb7a..d8ce2dc 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 _0xcfac=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports','express','passport','Router'];(function(_0x35245b,_0x23788a){var _0x287707=function(_0x34fd2b){while(--_0x34fd2b){_0x35245b['push'](_0x35245b['shift']());}};_0x287707(++_0x23788a);}(_0xcfac,0x105));var _0xccfa=function(_0x4e4379,_0x4ad8e4){_0x4e4379=_0x4e4379-0x0;var _0x5a0073=_0xcfac[_0x4e4379];return _0x5a0073;};'use strict';var express=require(_0xccfa('0x0'));var passport=require(_0xccfa('0x1'));var router=express[_0xccfa('0x2')]();var controller=require(_0xccfa('0x3'));var userController=require(_0xccfa('0x4'));var authService=require(_0xccfa('0x5'));router[_0xccfa('0x6')]('/',controller[_0xccfa('0x7')]);router[_0xccfa('0x6')]('/callback',controller[_0xccfa('0x8')],authService[_0xccfa('0x9')],userController[_0xccfa('0x7')],authService[_0xccfa('0xa')]);module[_0xccfa('0xb')]=router; \ No newline at end of file +var _0x3eec=['login','/callback','callback','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x3d54d1,_0x1f2489){_0x3d54d1=_0x3d54d1-0x0;var _0x127321=_0x3eec[_0x3d54d1];return _0x127321;};'use strict';var express=require(_0xc3ee('0x0'));var passport=require(_0xc3ee('0x1'));var router=express[_0xc3ee('0x2')]();var controller=require(_0xc3ee('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xc3ee('0x4'));router[_0xc3ee('0x5')]('/',controller[_0xc3ee('0x6')]);router[_0xc3ee('0x5')](_0xc3ee('0x7'),controller[_0xc3ee('0x8')],authService['isMiddleware'],userController[_0xc3ee('0x6')],authService[_0xc3ee('0x9')]);module[_0xc3ee('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 5d5445a..3fd8d0c 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 _0xd183=['Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','disabled','blocked','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','blockedAt','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','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','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'];(function(_0x18c67c,_0x5af63d){var _0x2a9bad=function(_0x4377d2){while(--_0x4377d2){_0x18c67c['push'](_0x18c67c['shift']());}};_0x2a9bad(++_0x5af63d);}(_0xd183,0xb7));var _0x3d18=function(_0x1aabc7,_0x3203eb){_0x1aabc7=_0x1aabc7-0x0;var _0x3e009c=_0xd183[_0x1aabc7];return _0x3e009c;};'use strict';var util=require(_0x3d18('0x0'));var passport=require(_0x3d18('0x1'));var LocalStrategy=require(_0x3d18('0x2'))[_0x3d18('0x3')];var jayson=require('jayson/promise');var _=require(_0x3d18('0x4'));var rs=require(_0x3d18('0x5'));var moment=require(_0x3d18('0x6'));var db=require(_0x3d18('0x7'))['db'];var authService=require(_0x3d18('0x8'));var utils=require(_0x3d18('0x9'));var client=jayson['client'][_0x3d18('0xa')]({'port':0x232b});function localAuthenticate(_0x42e6de,_0x52e8b7,_0x4c95a5,_0x156650){var _0x46a159,_0x2c0658;return db[_0x3d18('0xb')][_0x3d18('0xc')]({'where':{'id':0x1},'attributes':[_0x3d18('0xd'),_0x3d18('0xe')],'raw':!![]})[_0x3d18('0xf')](function(_0x3b181b){_0x46a159=_0x3b181b;return _0x42e6de['findOne']({'attributes':['id',_0x3d18('0x10'),_0x3d18('0x11'),_0x3d18('0x12'),'role',_0x3d18('0x13'),_0x3d18('0x14'),'blockedAt','loginAttempts'],'where':{'name':_0x52e8b7,'role':{'$or':['admin',_0x3d18('0x15'),_0x3d18('0x16')]}}});})[_0x3d18('0xf')](function(_0x35e573){if(!_0x35e573||_0x35e573&&_0x35e573[_0x3d18('0x10')]!==_0x52e8b7){throw new Error(_0x3d18('0x17'));}else{_0x2c0658=_0x35e573;return _0x2c0658;}})[_0x3d18('0xf')](function(){_0x2c0658['authenticate'](_0x4c95a5,function(_0x1a319e,_0x219def){var _0x2afabd=_0x2c0658[_0x3d18('0x18')]+0x1;if(_0x1a319e){return _0x156650(_0x1a319e);}else if(!_0x219def){if(_0x2c0658[_0x3d18('0x13')]){return _0x156650(null,![],{'message':_0x3d18('0x17')});}else if(_0x46a159[_0x3d18('0xd')]>0x0){if(_0x2c0658[_0x3d18('0x14')]){if(_0x46a159[_0x3d18('0xe')]>0x0){if(moment(_0x2c0658[_0x3d18('0x19')])[_0x3d18('0x1a')](_0x46a159[_0x3d18('0xe')],'minutes')>moment()){return _0x156650(null,![],{'message':_0x3d18('0x17')});}else{return utils[_0x3d18('0x1b')](_0x2c0658,_0x2afabd,![],null)[_0x3d18('0xf')](function(){return _0x156650(null,![],{'message':_0x3d18('0x17')});});}}else{return _0x156650(null,![],{'message':_0x3d18('0x17')});}}else{if(_0x2afabd>=_0x46a159[_0x3d18('0xd')]){return utils[_0x3d18('0x1b')](_0x2c0658,0x0,!![],moment())[_0x3d18('0xf')](function(){return _0x156650(null,![],{'message':_0x3d18('0x17')});});}else{return utils[_0x3d18('0x1b')](_0x2c0658,_0x2afabd,![],null)[_0x3d18('0xf')](function(){return _0x156650(null,![],{'message':_0x3d18('0x17')});});}}}else{return _0x156650(null,![],{'message':_0x3d18('0x17')});}}else{if(_0x2c0658[_0x3d18('0x13')]){return _0x156650(null,![],{'message':_0x3d18('0x17')});}else if(_0x46a159[_0x3d18('0xd')]>0x0){if(_0x2c0658[_0x3d18('0x14')]){if(_0x46a159['blockDuration']>0x0){if(moment(_0x2c0658[_0x3d18('0x19')])[_0x3d18('0x1a')](_0x46a159['blockDuration'],_0x3d18('0x1c'))>moment()){return _0x156650(null,![],{'message':_0x3d18('0x17')});}else{return utils[_0x3d18('0x1b')](_0x2c0658,0x0,![],null)[_0x3d18('0xf')](function(){return utils[_0x3d18('0x1d')](_0x2c0658);})[_0x3d18('0xf')](function(){return _0x156650(null,_0x2c0658);});}}else{return _0x156650(null,![],{'message':_0x3d18('0x17')});}}else{return utils[_0x3d18('0x1b')](_0x2c0658,0x0,![],null)['then'](function(){return utils[_0x3d18('0x1d')](_0x2c0658);})[_0x3d18('0xf')](function(){return _0x156650(null,_0x2c0658);})['catch'](function(_0x40666e){return _0x156650(null,![],_0x40666e);});}}else{if(_0x2c0658['blocked']){return _0x156650(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3d18('0x1d')](_0x2c0658)[_0x3d18('0xf')](function(){return _0x156650(null,_0x2c0658);});}}}});})[_0x3d18('0x1e')](function(_0x25a7ab){return _0x156650(null,![],_0x25a7ab);});}function sendServiceMail(_0x210802){return db[_0x3d18('0x1f')][_0x3d18('0x20')]({'where':{'service':!![]},'attributes':['id',_0x3d18('0x10'),_0x3d18('0x21')],'include':[{'model':db[_0x3d18('0x22')],'as':_0x3d18('0x23')}]})['then'](function(_0x492f01){if(!_0x492f01){throw new Error(_0x3d18('0x24'));}var _0x4a4044={'tls':{'rejectUnauthorized':![]}};if(_0x492f01[_0x3d18('0x23')][_0x3d18('0x25')]){_0x4a4044[_0x3d18('0x25')]=_0x492f01['Smtp'][_0x3d18('0x25')];}else{_0x4a4044[_0x3d18('0x26')]=_0x492f01[_0x3d18('0x23')][_0x3d18('0x26')];_0x4a4044[_0x3d18('0x27')]=_0x492f01[_0x3d18('0x23')]['port'];_0x4a4044[_0x3d18('0x28')]=_0x492f01[_0x3d18('0x23')][_0x3d18('0x28')];}if(_0x492f01[_0x3d18('0x23')]['authentication']){_0x4a4044[_0x3d18('0x29')]={'user':_0x492f01[_0x3d18('0x23')]['user'],'pass':_0x492f01[_0x3d18('0x23')][_0x3d18('0x2a')]};}var _0x302e9c={'account':_0x4a4044,'message':_[_0x3d18('0x2b')]({'from':util['format'](_0x3d18('0x2c'),_0x492f01[_0x3d18('0x10')],_0x492f01[_0x3d18('0x21')]||_0x492f01[_0x3d18('0x23')]['user'])},_0x210802)};return client[_0x3d18('0x2d')](_0x3d18('0x2e'),_0x302e9c);})[_0x3d18('0xf')](function(_0x3ebcf9){if(_0x3ebcf9[_0x3d18('0x2f')]){throw new Error(util['format'](_0x3d18('0x30'),_0x3ebcf9['error'][_0x3d18('0x31')]||JSON['stringify'](_0x3ebcf9[_0x3d18('0x2f')])));}return!![];});}function handleError(_0x173282,_0x4d2b72,_0x280854){return _0x173282[_0x3d18('0x32')](_0x4d2b72||0x1f4)['send']({'message':_0x280854?_0x280854[_0x3d18('0x31')]||_0x280854:''});}function checkPasswordPattern(_0x44ada0,_0x4336bb,_0x1c173f){if(_0x1c173f){var _0x4c439a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c439a['test'](_0x4336bb)){return _0x44ada0;}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 _0x44ada0;}}exports[_0x3d18('0x33')]=function(_0x21bcd7,_0x2e5473,_0x6f5dec){passport[_0x3d18('0x34')](_0x3d18('0x35'),function(_0x4dd182,_0x4353f9,_0x14f175){var _0x43aede=_0x4dd182||_0x14f175;if(_0x43aede){return handleError(_0x2e5473,0x191,_0x43aede);}if(!_0x4353f9){return handleError(_0x2e5473,0x194,{'message':_0x3d18('0x36')});}else{var _0x613c7f={'payload':{'id':_0x4353f9['id'],'role':_0x4353f9[_0x3d18('0x37')]},'options':{'expiresIn':0x15180}};return authService[_0x3d18('0x38')](_0x613c7f)[_0x3d18('0xf')](function(_0x3a29c9){_0x2e5473[_0x3d18('0x39')]({'id':_0x4353f9['id'],'token':_0x3a29c9,'statusCall':'','isAlreadyLogged':_0x4353f9[_0x3d18('0x3a')]});});}})(_0x21bcd7,_0x2e5473,_0x6f5dec);};exports[_0x3d18('0x3b')]=function(_0xcbab1b,_0x2a8b18,_0x21bf7a){if(!_0xcbab1b[_0x3d18('0x3c')][_0x3d18('0x21')]){return handleError(_0x2a8b18,0x1f4,{'message':_0x3d18('0x3d')});}var _0x3e9e21=rs[_0x3d18('0x3e')]();_0xcbab1b[_0x3d18('0x3c')][_0x3d18('0x21')]=_0xcbab1b['body'][_0x3d18('0x21')]['trim']()['toLowerCase']();var _0x203889;return db[_0x3d18('0xb')][_0x3d18('0xc')]({'where':{'id':0x1},'attributes':[_0x3d18('0xd'),_0x3d18('0xe')],'raw':!![]})['then'](function(_0x3b73cd){_0x203889=_0x3b73cd;return db[_0x3d18('0x3f')][_0x3d18('0x20')]({'where':{'email':_0xcbab1b[_0x3d18('0x3c')][_0x3d18('0x21')]}});})[_0x3d18('0xf')](function(_0x892a3a){if(!_0x892a3a){throw new Error(_0x3d18('0x40'));}if(_0x892a3a[_0x3d18('0x13')]){throw new Error(_0x3d18('0x41'));}if(_0x892a3a[_0x3d18('0x14')]){if(moment(_0x892a3a[_0x3d18('0x19')])[_0x3d18('0x1a')](_0x203889[_0x3d18('0xe')],_0x3d18('0x1c'))>moment()){throw new Error(_0x3d18('0x42'));}else{_0x892a3a[_0x3d18('0x14')]=![];_0x892a3a['blockedAt']=null;}}_0x892a3a[_0x3d18('0x43')]=_0x3e9e21;_0x892a3a[_0x3d18('0x44')]=Date[_0x3d18('0x45')]()+0x36ee80;return _0x892a3a[_0x3d18('0x46')]();})[_0x3d18('0xf')](function(){return sendServiceMail({'to':_0xcbab1b[_0x3d18('0x3c')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x3d18('0x47')+_0x3d18('0x48')+_0x3d18('0x49')+_0xcbab1b[_0x3d18('0x4a')][_0x3d18('0x26')]+_0x3d18('0x4b')+_0x3e9e21+'\x0a\x0a'+_0x3d18('0x4c')});})[_0x3d18('0xf')](function(){_0x2a8b18[_0x3d18('0x32')](0xc8)[_0x3d18('0x4d')]({'message':_0x3d18('0x4e')});})[_0x3d18('0x1e')](function(_0x18981f){return handleError(_0x2a8b18,0x1f4,_0x18981f);});};exports[_0x3d18('0x4f')]=function(_0x5ef570,_0x4f77be,_0x59bec0){var _0x725c30;return db[_0x3d18('0x3f')]['find']({'where':{'resetPasswordToken':_0x5ef570[_0x3d18('0x50')][_0x3d18('0x51')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x3d18('0xf')](function(_0x1d3441){_0x725c30=_0x1d3441;if(!_0x725c30){throw new Error(_0x3d18('0x52'));}return db[_0x3d18('0xb')][_0x3d18('0xc')]({'attributes':['id',_0x3d18('0x53')]});})[_0x3d18('0xf')](function(_0x2d2ee6){return checkPasswordPattern(_0x2d2ee6,_0x5ef570[_0x3d18('0x3c')][_0x3d18('0x11')],_0x2d2ee6[_0x3d18('0x53')]);})['then'](function(){_0x725c30['password']=_0x5ef570[_0x3d18('0x3c')][_0x3d18('0x11')];_0x725c30[_0x3d18('0x43')]=null;_0x725c30['resetPasswordExpires']=null;return _0x725c30[_0x3d18('0x46')]();})[_0x3d18('0xf')](function(){_0x4f77be[_0x3d18('0x32')](0xc8)[_0x3d18('0x4d')]({'message':'Password\x20reset!'});})['catch'](function(_0xba1484){return handleError(_0x4f77be,0x1f4,_0xba1484);});};passport[_0x3d18('0x54')](new LocalStrategy({'usernameField':_0x3d18('0x10'),'passwordField':'password'},function(_0x791b5f,_0x18fcb7,_0x43874f){return localAuthenticate(db[_0x3d18('0x3f')],_0x791b5f,_0x18fcb7,_0x43874f);})); \ No newline at end of file +var _0xe9a6=['randomstring','../../mysqldb','../../config/utils','http','Setting','findOne','blockDuration','name','password','salt','role','disabled','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','allowedLoginAttempts','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','stringify','status','test','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','body','email','Email\x20parameter\x20is\x20missing','generate','trim','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash'];(function(_0x39fc4f,_0x1280f4){var _0x4759cc=function(_0x252d65){while(--_0x252d65){_0x39fc4f['push'](_0x39fc4f['shift']());}};_0x4759cc(++_0x1280f4);}(_0xe9a6,0xe1));var _0x6e9a=function(_0x42614c,_0x5b4cb9){_0x42614c=_0x42614c-0x0;var _0x25c2c3=_0xe9a6[_0x42614c];return _0x25c2c3;};'use strict';var util=require(_0x6e9a('0x0'));var passport=require(_0x6e9a('0x1'));var LocalStrategy=require(_0x6e9a('0x2'))[_0x6e9a('0x3')];var jayson=require(_0x6e9a('0x4'));var _=require(_0x6e9a('0x5'));var rs=require(_0x6e9a('0x6'));var moment=require('moment');var db=require(_0x6e9a('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x6e9a('0x8'));var client=jayson['client'][_0x6e9a('0x9')]({'port':0x232b});function localAuthenticate(_0x46e007,_0x63796a,_0x19f34c,_0x46c39c){var _0x463228,_0x10c573;return db[_0x6e9a('0xa')][_0x6e9a('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x6e9a('0xc')],'raw':!![]})['then'](function(_0x3d841e){_0x463228=_0x3d841e;return _0x46e007[_0x6e9a('0xb')]({'attributes':['id',_0x6e9a('0xd'),_0x6e9a('0xe'),_0x6e9a('0xf'),_0x6e9a('0x10'),_0x6e9a('0x11'),'blocked',_0x6e9a('0x12'),_0x6e9a('0x13')],'where':{'name':_0x63796a,'role':{'$or':['admin',_0x6e9a('0x14'),_0x6e9a('0x15')]}}});})['then'](function(_0x40859c){if(!_0x40859c||_0x40859c&&_0x40859c[_0x6e9a('0xd')]!==_0x63796a){throw new Error(_0x6e9a('0x16'));}else{_0x10c573=_0x40859c;return _0x10c573;}})[_0x6e9a('0x17')](function(){_0x10c573['authenticate'](_0x19f34c,function(_0x13f084,_0x26e04c){var _0x4e0dcd=_0x10c573[_0x6e9a('0x13')]+0x1;if(_0x13f084){return _0x46c39c(_0x13f084);}else if(!_0x26e04c){if(_0x10c573[_0x6e9a('0x11')]){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});}else if(_0x463228[_0x6e9a('0x18')]>0x0){if(_0x10c573[_0x6e9a('0x19')]){if(_0x463228['blockDuration']>0x0){if(moment(_0x10c573[_0x6e9a('0x12')])[_0x6e9a('0x1a')](_0x463228[_0x6e9a('0xc')],_0x6e9a('0x1b'))>moment()){return _0x46c39c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x6e9a('0x1c')](_0x10c573,_0x4e0dcd,![],null)['then'](function(){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});});}}else{return _0x46c39c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4e0dcd>=_0x463228[_0x6e9a('0x18')]){return utils['clearBlockUser'](_0x10c573,0x0,!![],moment())[_0x6e9a('0x17')](function(){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});});}else{return utils[_0x6e9a('0x1c')](_0x10c573,_0x4e0dcd,![],null)[_0x6e9a('0x17')](function(){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});});}}}else{return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});}}else{if(_0x10c573['disabled']){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});}else if(_0x463228[_0x6e9a('0x18')]>0x0){if(_0x10c573['blocked']){if(_0x463228['blockDuration']>0x0){if(moment(_0x10c573['blockedAt'])[_0x6e9a('0x1a')](_0x463228[_0x6e9a('0xc')],_0x6e9a('0x1b'))>moment()){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});}else{return utils[_0x6e9a('0x1c')](_0x10c573,0x0,![],null)[_0x6e9a('0x17')](function(){return utils[_0x6e9a('0x1d')](_0x10c573);})[_0x6e9a('0x17')](function(){return _0x46c39c(null,_0x10c573);});}}else{return _0x46c39c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x6e9a('0x1c')](_0x10c573,0x0,![],null)[_0x6e9a('0x17')](function(){return utils[_0x6e9a('0x1d')](_0x10c573);})['then'](function(){return _0x46c39c(null,_0x10c573);})[_0x6e9a('0x1e')](function(_0x38abdc){return _0x46c39c(null,![],_0x38abdc);});}}else{if(_0x10c573[_0x6e9a('0x19')]){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});}else{return utils[_0x6e9a('0x1d')](_0x10c573)[_0x6e9a('0x17')](function(){return _0x46c39c(null,_0x10c573);});}}}});})[_0x6e9a('0x1e')](function(_0x42a592){return _0x46c39c(null,![],_0x42a592);});}function sendServiceMail(_0x5b5db2){return db[_0x6e9a('0x1f')][_0x6e9a('0x20')]({'where':{'service':!![]},'attributes':['id',_0x6e9a('0xd'),'email'],'include':[{'model':db[_0x6e9a('0x21')],'as':'Smtp'}]})[_0x6e9a('0x17')](function(_0x124fa5){if(!_0x124fa5){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x49002e={'tls':{'rejectUnauthorized':![]}};if(_0x124fa5[_0x6e9a('0x22')][_0x6e9a('0x23')]){_0x49002e[_0x6e9a('0x23')]=_0x124fa5['Smtp'][_0x6e9a('0x23')];}else{_0x49002e[_0x6e9a('0x24')]=_0x124fa5[_0x6e9a('0x22')][_0x6e9a('0x24')];_0x49002e[_0x6e9a('0x25')]=_0x124fa5[_0x6e9a('0x22')][_0x6e9a('0x25')];_0x49002e[_0x6e9a('0x26')]=_0x124fa5['Smtp'][_0x6e9a('0x26')];}if(_0x124fa5[_0x6e9a('0x22')][_0x6e9a('0x27')]){_0x49002e[_0x6e9a('0x28')]={'user':_0x124fa5[_0x6e9a('0x22')]['user'],'pass':_0x124fa5[_0x6e9a('0x22')][_0x6e9a('0x29')]};}var _0x4d7760={'account':_0x49002e,'message':_[_0x6e9a('0x2a')]({'from':util[_0x6e9a('0x2b')](_0x6e9a('0x2c'),_0x124fa5[_0x6e9a('0xd')],_0x124fa5['email']||_0x124fa5[_0x6e9a('0x22')][_0x6e9a('0x14')])},_0x5b5db2)};return client[_0x6e9a('0x2d')](_0x6e9a('0x2e'),_0x4d7760);})[_0x6e9a('0x17')](function(_0x9e9bf){if(_0x9e9bf[_0x6e9a('0x2f')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x9e9bf[_0x6e9a('0x2f')]['message']||JSON[_0x6e9a('0x30')](_0x9e9bf['error'])));}return!![];});}function handleError(_0x59611a,_0x32f516,_0x5180c7){return _0x59611a[_0x6e9a('0x31')](_0x32f516||0x1f4)['send']({'message':_0x5180c7?_0x5180c7['message']||_0x5180c7:''});}function checkPasswordPattern(_0x5bcffe,_0x385684,_0x31a0cc){if(_0x31a0cc){var _0x1a48f6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a48f6[_0x6e9a('0x32')](_0x385684)){return _0x5bcffe;}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 _0x5bcffe;}}exports[_0x6e9a('0x33')]=function(_0x3120a0,_0x578a9c,_0xceb8e6){passport[_0x6e9a('0x34')](_0x6e9a('0x35'),function(_0x1d2138,_0x3d2954,_0xe6af73){var _0x203694=_0x1d2138||_0xe6af73;if(_0x203694){return handleError(_0x578a9c,0x191,_0x203694);}if(!_0x3d2954){return handleError(_0x578a9c,0x194,{'message':_0x6e9a('0x36')});}else{var _0x5aa85b={'payload':{'id':_0x3d2954['id'],'role':_0x3d2954['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5aa85b)[_0x6e9a('0x17')](function(_0x2f0548){_0x578a9c[_0x6e9a('0x37')]({'id':_0x3d2954['id'],'token':_0x2f0548,'statusCall':'','isAlreadyLogged':_0x3d2954[_0x6e9a('0x38')]});});}})(_0x3120a0,_0x578a9c,_0xceb8e6);};exports['forgot']=function(_0x8588a1,_0x4497bd,_0x2c7274){if(!_0x8588a1[_0x6e9a('0x39')][_0x6e9a('0x3a')]){return handleError(_0x4497bd,0x1f4,{'message':_0x6e9a('0x3b')});}var _0x2c41cd=rs[_0x6e9a('0x3c')]();_0x8588a1[_0x6e9a('0x39')][_0x6e9a('0x3a')]=_0x8588a1['body'][_0x6e9a('0x3a')][_0x6e9a('0x3d')]()['toLowerCase']();var _0x3f9f92;return db['Setting'][_0x6e9a('0xb')]({'where':{'id':0x1},'attributes':[_0x6e9a('0x18'),_0x6e9a('0xc')],'raw':!![]})['then'](function(_0x2e09a9){_0x3f9f92=_0x2e09a9;return db['User']['find']({'where':{'email':_0x8588a1[_0x6e9a('0x39')][_0x6e9a('0x3a')]}});})[_0x6e9a('0x17')](function(_0x982a7a){if(!_0x982a7a){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x982a7a[_0x6e9a('0x11')]){throw new Error(_0x6e9a('0x3e'));}if(_0x982a7a['blocked']){if(moment(_0x982a7a['blockedAt'])['add'](_0x3f9f92[_0x6e9a('0xc')],_0x6e9a('0x1b'))>moment()){throw new Error(_0x6e9a('0x3f'));}else{_0x982a7a[_0x6e9a('0x19')]=![];_0x982a7a['blockedAt']=null;}}_0x982a7a[_0x6e9a('0x40')]=_0x2c41cd;_0x982a7a['resetPasswordExpires']=Date[_0x6e9a('0x41')]()+0x36ee80;return _0x982a7a[_0x6e9a('0x42')]();})[_0x6e9a('0x17')](function(){return sendServiceMail({'to':_0x8588a1['body']['email'],'subject':_0x6e9a('0x43'),'text':_0x6e9a('0x44')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'http://'+_0x8588a1['headers'][_0x6e9a('0x24')]+'/reset/'+_0x2c41cd+'\x0a\x0a'+_0x6e9a('0x45')});})[_0x6e9a('0x17')](function(){_0x4497bd[_0x6e9a('0x31')](0xc8)[_0x6e9a('0x46')]({'message':'Reset\x20Email\x20sent!'});})[_0x6e9a('0x1e')](function(_0x5e4823){return handleError(_0x4497bd,0x1f4,_0x5e4823);});};exports[_0x6e9a('0x47')]=function(_0x20ec57,_0x3f9f07,_0x598400){var _0x2c80ae;return db['User']['find']({'where':{'resetPasswordToken':_0x20ec57['params'][_0x6e9a('0x48')],'resetPasswordExpires':{'$gt':Date[_0x6e9a('0x41')]()}}})[_0x6e9a('0x17')](function(_0x36746c){_0x2c80ae=_0x36746c;if(!_0x2c80ae){throw new Error(_0x6e9a('0x49'));}return db[_0x6e9a('0xa')][_0x6e9a('0xb')]({'attributes':['id',_0x6e9a('0x4a')]});})[_0x6e9a('0x17')](function(_0x17a9a6){return checkPasswordPattern(_0x17a9a6,_0x20ec57[_0x6e9a('0x39')][_0x6e9a('0xe')],_0x17a9a6[_0x6e9a('0x4a')]);})[_0x6e9a('0x17')](function(){_0x2c80ae[_0x6e9a('0xe')]=_0x20ec57['body'][_0x6e9a('0xe')];_0x2c80ae[_0x6e9a('0x40')]=null;_0x2c80ae['resetPasswordExpires']=null;return _0x2c80ae[_0x6e9a('0x42')]();})[_0x6e9a('0x17')](function(){_0x3f9f07[_0x6e9a('0x31')](0xc8)[_0x6e9a('0x46')]({'message':_0x6e9a('0x4b')});})[_0x6e9a('0x1e')](function(_0x415e4d){return handleError(_0x3f9f07,0x1f4,_0x415e4d);});};passport[_0x6e9a('0x4c')](new LocalStrategy({'usernameField':_0x6e9a('0xd'),'passwordField':_0x6e9a('0xe')},function(_0x49bccb,_0x1a2de6,_0x34f69f){return localAuthenticate(db['User'],_0x49bccb,_0x1a2de6,_0x34f69f);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 00f7233..8aaa6d9 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 _0xceb0=['forgot','/reset/:token','./authLocal.controller','post','login','/forgot'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xceb0,0x1b2));var _0x0ceb=function(_0x32fafd,_0x5a2a85){_0x32fafd=_0x32fafd-0x0;var _0x54e32e=_0xceb0[_0x32fafd];return _0x54e32e;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x0ceb('0x0'));router[_0x0ceb('0x1')]('/',controller[_0x0ceb('0x2')]);router[_0x0ceb('0x1')](_0x0ceb('0x3'),controller[_0x0ceb('0x4')]);router[_0x0ceb('0x1')](_0x0ceb('0x5'),controller['reset']);module['exports']=router; \ No newline at end of file +var _0x2cdd=['/reset/:token','reset','express','Router','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x48912a,_0x36913b){var _0x49d3a2=function(_0x49e005){while(--_0x49e005){_0x48912a['push'](_0x48912a['shift']());}};_0x49d3a2(++_0x36913b);}(_0x2cdd,0xe3));var _0xd2cd=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x2cdd[_0x565ed7];return _0x183ad7;};'use strict';var express=require(_0xd2cd('0x0'));var router=express[_0xd2cd('0x1')]();var controller=require(_0xd2cd('0x2'));router[_0xd2cd('0x3')]('/',controller[_0xd2cd('0x4')]);router[_0xd2cd('0x3')](_0xd2cd('0x5'),controller[_0xd2cd('0x6')]);router['post'](_0xd2cd('0x7'),controller[_0xd2cd('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 8832732..958520e 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 _0x5b9d=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x5b9d,0x1ba));var _0xd5b9=function(_0x5af565,_0xe531a7){_0x5af565=_0x5af565-0x0;var _0x2a311f=_0x5b9d[_0x5af565];return _0x2a311f;};'use strict';var Sequelize=require(_0xd5b9('0x0'));module[_0xd5b9('0x1')]={'name':{'type':Sequelize[_0xd5b9('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xd5b9('0x2')]},'description':{'type':Sequelize[_0xd5b9('0x2')]},'status':{'type':Sequelize[_0xd5b9('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd5b9('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xb2e4=['sequelize','STRING','INTEGER'];(function(_0x4157cf,_0x3ff907){var _0x3dacbe=function(_0x503dc3){while(--_0x503dc3){_0x4157cf['push'](_0x4157cf['shift']());}};_0x3dacbe(++_0x3ff907);}(_0xb2e4,0x8d));var _0x4b2e=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0xb2e4[_0x52e0ee];return _0x32534c;};'use strict';var Sequelize=require(_0x4b2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x4b2e('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x4b2e('0x1')]},'description':{'type':Sequelize[_0x4b2e('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4b2e('0x2')],'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 b54bd9f..c9202de 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 _0xa918=['where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','keys','find','create','body','Condition','addConditions','ids','getConditions','findOne','hasOwnProperty','addActions','Action','omit','getActions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','name','send','index','map','Automation','rawAttributes','type','key','model','intersection','query','attributes','fields','length','nolimit','order','sort'];(function(_0x3928d3,_0x3c16a5){var _0x49d6c6=function(_0x51ea4f){while(--_0x51ea4f){_0x3928d3['push'](_0x3928d3['shift']());}};_0x49d6c6(++_0x3c16a5);}(_0xa918,0xbd));var _0x8a91=function(_0x3c781f,_0x30c9ac){_0x3c781f=_0x3c781f-0x0;var _0x12ada8=_0xa918[_0x3c781f];return _0x12ada8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8a91('0x0'));var rimraf=require(_0x8a91('0x1'));var zipdir=require(_0x8a91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a91('0x3'));var moment=require('moment');var BPromise=require(_0x8a91('0x4'));var Mustache=require(_0x8a91('0x5'));var util=require(_0x8a91('0x6'));var path=require(_0x8a91('0x7'));var sox=require(_0x8a91('0x8'));var csv=require(_0x8a91('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8a91('0xa'));var squel=require(_0x8a91('0xb'));var crypto=require(_0x8a91('0xc'));var jsforce=require(_0x8a91('0xd'));var deskjs=require(_0x8a91('0xe'));var toCsv=require(_0x8a91('0x9'));var querystring=require(_0x8a91('0xf'));var Papa=require(_0x8a91('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8a91('0x11'));var as=require(_0x8a91('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a91('0x13'))(_0x8a91('0x14'));var utils=require(_0x8a91('0x15'));var config=require(_0x8a91('0x16'));var db=require(_0x8a91('0x17'))['db'];function respondWithStatusCode(_0x40ac5b,_0x467d8c){_0x467d8c=_0x467d8c||0xcc;return function(_0x1fa8f8){if(_0x1fa8f8){return _0x40ac5b['sendStatus'](_0x467d8c);}return _0x40ac5b['status'](_0x467d8c)[_0x8a91('0x18')]();};}function respondWithResult(_0x41c006,_0x1e1dd2){_0x1e1dd2=_0x1e1dd2||0xc8;return function(_0x5a8f6c){if(_0x5a8f6c){return _0x41c006[_0x8a91('0x19')](_0x1e1dd2)[_0x8a91('0x1a')](_0x5a8f6c);}};}function respondWithFilteredResult(_0x176dc7,_0xd04cee){return function(_0x533661){if(_0x533661){var _0x3a2c99=_0x533661['count'],_0x37b464=_0xd04cee[_0x8a91('0x1b')],_0x5ae9b9=_0xd04cee[_0x8a91('0x1b')]+_0xd04cee[_0x8a91('0x1c')],_0x1ff304;if(_0x5ae9b9>=_0x3a2c99){_0x5ae9b9=_0x3a2c99;_0x1ff304=0xc8;}else{_0x1ff304=0xce;}_0x176dc7[_0x8a91('0x19')](_0x1ff304);return _0x176dc7[_0x8a91('0x1d')](_0x8a91('0x1e'),_0x37b464+'-'+_0x5ae9b9+'/'+_0x3a2c99)[_0x8a91('0x1a')](_0x533661);}return null;};}function patchUpdates(_0x22e024){return function(_0x51d144){try{jsonpatch[_0x8a91('0x1f')](_0x51d144,_0x22e024,!![]);}catch(_0x51ef3b){return BPromise[_0x8a91('0x20')](_0x51ef3b);}return _0x51d144['save']();};}function saveUpdates(_0x2bf079,_0xc34fbd){return function(_0x27db35){if(_0x27db35){return _0x27db35[_0x8a91('0x21')](_0x2bf079)['then'](function(_0x125d01){return _0x125d01;});}return null;};}function removeEntity(_0xbb592b,_0x138f80){return function(_0x1b2961){if(_0x1b2961){return _0x1b2961[_0x8a91('0x22')]()[_0x8a91('0x23')](function(){_0xbb592b[_0x8a91('0x19')](0xcc)[_0x8a91('0x18')]();});}};}function handleEntityNotFound(_0x4c35e1,_0x605c86){return function(_0x2a025c){if(!_0x2a025c){_0x4c35e1[_0x8a91('0x24')](0x194);}return _0x2a025c;};}function handleError(_0x462840,_0xdf19a9){_0xdf19a9=_0xdf19a9||0x1f4;return function(_0x55ce6c){logger['error'](_0x55ce6c['stack']);if(_0x55ce6c[_0x8a91('0x25')]){delete _0x55ce6c[_0x8a91('0x25')];}_0x462840[_0x8a91('0x19')](_0xdf19a9)[_0x8a91('0x26')](_0x55ce6c);};}exports[_0x8a91('0x27')]=function(_0x4bf6c0,_0x54639){var _0x3afa0b={},_0x594f81={},_0xdfac48={'count':0x0,'rows':[]};var _0x16b98b=_[_0x8a91('0x28')](db[_0x8a91('0x29')][_0x8a91('0x2a')],function(_0x404846){return{'name':_0x404846['fieldName'],'type':_0x404846[_0x8a91('0x2b')][_0x8a91('0x2c')]};});_0x594f81[_0x8a91('0x2d')]=_['map'](_0x16b98b,_0x8a91('0x25'));_0x594f81['query']=_['keys'](_0x4bf6c0['query']);_0x594f81['filters']=_[_0x8a91('0x2e')](_0x594f81[_0x8a91('0x2d')],_0x594f81[_0x8a91('0x2f')]);_0x3afa0b[_0x8a91('0x30')]=_[_0x8a91('0x2e')](_0x594f81[_0x8a91('0x2d')],qs[_0x8a91('0x31')](_0x4bf6c0['query'][_0x8a91('0x31')]));_0x3afa0b['attributes']=_0x3afa0b[_0x8a91('0x30')][_0x8a91('0x32')]?_0x3afa0b[_0x8a91('0x30')]:_0x594f81[_0x8a91('0x2d')];if(!_0x4bf6c0[_0x8a91('0x2f')]['hasOwnProperty'](_0x8a91('0x33'))){_0x3afa0b[_0x8a91('0x1c')]=qs['limit'](_0x4bf6c0[_0x8a91('0x2f')][_0x8a91('0x1c')]);_0x3afa0b[_0x8a91('0x1b')]=qs[_0x8a91('0x1b')](_0x4bf6c0['query'][_0x8a91('0x1b')]);}_0x3afa0b[_0x8a91('0x34')]=qs[_0x8a91('0x35')](_0x4bf6c0[_0x8a91('0x2f')][_0x8a91('0x35')]);_0x3afa0b[_0x8a91('0x36')]=qs[_0x8a91('0x37')](_[_0x8a91('0x38')](_0x4bf6c0[_0x8a91('0x2f')],_0x594f81[_0x8a91('0x37')]),_0x16b98b);if(_0x4bf6c0[_0x8a91('0x2f')][_0x8a91('0x39')]){_0x3afa0b[_0x8a91('0x36')]=_[_0x8a91('0x3a')](_0x3afa0b['where'],{'$or':_[_0x8a91('0x28')](_0x16b98b,function(_0x12a5b0){if(_0x12a5b0[_0x8a91('0x2b')]!==_0x8a91('0x3b')){var _0x2f656d={};_0x2f656d[_0x12a5b0[_0x8a91('0x25')]]={'$like':'%'+_0x4bf6c0[_0x8a91('0x2f')][_0x8a91('0x39')]+'%'};return _0x2f656d;}})});}_0x3afa0b=_[_0x8a91('0x3a')]({},_0x3afa0b,_0x4bf6c0[_0x8a91('0x3c')]);var _0x20b6cf={'where':_0x3afa0b[_0x8a91('0x36')]};return db[_0x8a91('0x29')][_0x8a91('0x3d')](_0x20b6cf)[_0x8a91('0x23')](function(_0x119ef7){_0xdfac48['count']=_0x119ef7;if(_0x4bf6c0[_0x8a91('0x2f')][_0x8a91('0x3e')]){_0x3afa0b['include']=[{'all':!![]}];}return db[_0x8a91('0x29')][_0x8a91('0x3f')](_0x3afa0b);})[_0x8a91('0x23')](function(_0x5c7577){_0xdfac48[_0x8a91('0x40')]=_0x5c7577;return _0xdfac48;})[_0x8a91('0x23')](respondWithFilteredResult(_0x54639,_0x3afa0b))[_0x8a91('0x41')](handleError(_0x54639,null));};exports['show']=function(_0x51dde3,_0x33fce9){var _0x22437f={'raw':![],'where':{'id':_0x51dde3[_0x8a91('0x42')]['id']}},_0x25881f={};_0x25881f['model']=_[_0x8a91('0x43')](db[_0x8a91('0x29')]['rawAttributes']);_0x25881f[_0x8a91('0x2f')]=_['keys'](_0x51dde3[_0x8a91('0x2f')]);_0x25881f[_0x8a91('0x37')]=_[_0x8a91('0x2e')](_0x25881f[_0x8a91('0x2d')],_0x25881f[_0x8a91('0x2f')]);_0x22437f['attributes']=_[_0x8a91('0x2e')](_0x25881f['model'],qs[_0x8a91('0x31')](_0x51dde3[_0x8a91('0x2f')][_0x8a91('0x31')]));_0x22437f[_0x8a91('0x30')]=_0x22437f[_0x8a91('0x30')][_0x8a91('0x32')]?_0x22437f['attributes']:_0x25881f[_0x8a91('0x2d')];if(_0x51dde3[_0x8a91('0x2f')][_0x8a91('0x3e')]){_0x22437f['include']=[{'all':!![]}];}_0x22437f=_[_0x8a91('0x3a')]({},_0x22437f,_0x51dde3[_0x8a91('0x3c')]);return db[_0x8a91('0x29')][_0x8a91('0x44')](_0x22437f)[_0x8a91('0x23')](handleEntityNotFound(_0x33fce9,null))[_0x8a91('0x23')](respondWithResult(_0x33fce9,null))[_0x8a91('0x41')](handleError(_0x33fce9,null));};exports[_0x8a91('0x45')]=function(_0x576bb6,_0x3f811a){return db[_0x8a91('0x29')][_0x8a91('0x45')](_0x576bb6[_0x8a91('0x46')],{})[_0x8a91('0x23')](respondWithResult(_0x3f811a,0xc9))[_0x8a91('0x41')](handleError(_0x3f811a,null));};exports['update']=function(_0x412d0d,_0x116a5e){if(_0x412d0d[_0x8a91('0x46')]['id']){delete _0x412d0d[_0x8a91('0x46')]['id'];}return db[_0x8a91('0x29')][_0x8a91('0x44')]({'where':{'id':_0x412d0d[_0x8a91('0x42')]['id']}})[_0x8a91('0x23')](handleEntityNotFound(_0x116a5e,null))[_0x8a91('0x23')](saveUpdates(_0x412d0d[_0x8a91('0x46')],null))[_0x8a91('0x23')](respondWithResult(_0x116a5e,null))[_0x8a91('0x41')](handleError(_0x116a5e,null));};exports[_0x8a91('0x22')]=function(_0x204f19,_0x25385e){return db[_0x8a91('0x29')]['find']({'where':{'id':_0x204f19[_0x8a91('0x42')]['id']}})[_0x8a91('0x23')](handleEntityNotFound(_0x25385e,null))[_0x8a91('0x23')](removeEntity(_0x25385e,null))['catch'](handleError(_0x25385e,null));};exports['addConditions']=function(_0x836b51,_0x24f38c,_0x471bf5){return db[_0x8a91('0x47')]['find']({'where':{'id':_0x836b51[_0x8a91('0x42')]['id']}})[_0x8a91('0x23')](handleEntityNotFound(_0x24f38c,null))['then'](function(_0x2e7412){if(_0x2e7412){return _0x2e7412[_0x8a91('0x48')](_0x836b51['body'][_0x8a91('0x49')],_['omit'](_0x836b51[_0x8a91('0x46')],['ids','id'])||{});}})['then'](respondWithResult(_0x24f38c,null))[_0x8a91('0x41')](handleError(_0x24f38c,null));};exports[_0x8a91('0x4a')]=function(_0x431441,_0x433b26,_0x182570){var _0xda1f68={};var _0x2366f5={};var _0x17a92d;var _0x4e710f;return db[_0x8a91('0x29')][_0x8a91('0x4b')]({'where':{'id':_0x431441[_0x8a91('0x42')]['id']}})[_0x8a91('0x23')](handleEntityNotFound(_0x433b26,null))[_0x8a91('0x23')](function(_0x5c9e80){if(_0x5c9e80){_0x17a92d=_0x5c9e80;_0x2366f5[_0x8a91('0x2d')]=_[_0x8a91('0x43')](db[_0x8a91('0x47')][_0x8a91('0x2a')]);_0x2366f5[_0x8a91('0x2f')]=_[_0x8a91('0x43')](_0x431441[_0x8a91('0x2f')]);_0x2366f5['filters']=_['intersection'](_0x2366f5[_0x8a91('0x2d')],_0x2366f5[_0x8a91('0x2f')]);_0xda1f68[_0x8a91('0x30')]=_[_0x8a91('0x2e')](_0x2366f5[_0x8a91('0x2d')],qs[_0x8a91('0x31')](_0x431441[_0x8a91('0x2f')][_0x8a91('0x31')]));_0xda1f68[_0x8a91('0x30')]=_0xda1f68[_0x8a91('0x30')][_0x8a91('0x32')]?_0xda1f68[_0x8a91('0x30')]:_0x2366f5[_0x8a91('0x2d')];_0xda1f68[_0x8a91('0x34')]=qs[_0x8a91('0x35')](_0x431441[_0x8a91('0x2f')][_0x8a91('0x35')]);_0xda1f68['where']=qs[_0x8a91('0x37')](_[_0x8a91('0x38')](_0x431441[_0x8a91('0x2f')],_0x2366f5[_0x8a91('0x37')]));if(_0x431441[_0x8a91('0x2f')][_0x8a91('0x39')]){_0xda1f68[_0x8a91('0x36')]=_['merge'](_0xda1f68['where'],{'$or':_[_0x8a91('0x28')](_0xda1f68[_0x8a91('0x30')],function(_0x5e2f5f){var _0xa7bd08={};_0xa7bd08[_0x5e2f5f]={'$like':'%'+_0x431441[_0x8a91('0x2f')]['filter']+'%'};return _0xa7bd08;})});}_0xda1f68=_[_0x8a91('0x3a')]({},_0xda1f68,_0x431441[_0x8a91('0x3c')]);return _0x17a92d['getConditions'](_0xda1f68);}})[_0x8a91('0x23')](function(_0x4d03c4){if(_0x4d03c4){_0x4e710f=_0x4d03c4[_0x8a91('0x32')];if(!_0x431441[_0x8a91('0x2f')][_0x8a91('0x4c')](_0x8a91('0x33'))){_0xda1f68[_0x8a91('0x1c')]=qs[_0x8a91('0x1c')](_0x431441[_0x8a91('0x2f')]['limit']);_0xda1f68[_0x8a91('0x1b')]=qs[_0x8a91('0x1b')](_0x431441['query']['offset']);}return _0x17a92d[_0x8a91('0x4a')](_0xda1f68);}})[_0x8a91('0x23')](function(_0x86182a){if(_0x86182a){return _0x86182a?{'count':_0x4e710f,'rows':_0x86182a}:null;}})['then'](respondWithResult(_0x433b26,null))[_0x8a91('0x41')](handleError(_0x433b26,null));};exports[_0x8a91('0x4d')]=function(_0x429869,_0x36595d,_0x3b4d20){return db[_0x8a91('0x4e')]['find']({'where':{'id':_0x429869[_0x8a91('0x42')]['id']}})[_0x8a91('0x23')](handleEntityNotFound(_0x36595d,null))[_0x8a91('0x23')](function(_0x623704){if(_0x623704){return _0x623704[_0x8a91('0x4d')](_0x429869[_0x8a91('0x46')]['ids'],_[_0x8a91('0x4f')](_0x429869[_0x8a91('0x46')],[_0x8a91('0x49'),'id'])||{});}})['then'](respondWithResult(_0x36595d,null))[_0x8a91('0x41')](handleError(_0x36595d,null));};exports[_0x8a91('0x50')]=function(_0x5acba4,_0x145ae5,_0x3545c8){var _0x2b8bfc={};var _0x2f5b55={};var _0x101b35;var _0x1fc005;return db[_0x8a91('0x29')][_0x8a91('0x4b')]({'where':{'id':_0x5acba4[_0x8a91('0x42')]['id']}})['then'](handleEntityNotFound(_0x145ae5,null))[_0x8a91('0x23')](function(_0x5f198f){if(_0x5f198f){_0x101b35=_0x5f198f;_0x2f5b55[_0x8a91('0x2d')]=_[_0x8a91('0x43')](db[_0x8a91('0x4e')][_0x8a91('0x2a')]);_0x2f5b55[_0x8a91('0x2f')]=_[_0x8a91('0x43')](_0x5acba4[_0x8a91('0x2f')]);_0x2f5b55[_0x8a91('0x37')]=_[_0x8a91('0x2e')](_0x2f5b55[_0x8a91('0x2d')],_0x2f5b55[_0x8a91('0x2f')]);_0x2b8bfc[_0x8a91('0x30')]=_[_0x8a91('0x2e')](_0x2f5b55[_0x8a91('0x2d')],qs[_0x8a91('0x31')](_0x5acba4[_0x8a91('0x2f')][_0x8a91('0x31')]));_0x2b8bfc[_0x8a91('0x30')]=_0x2b8bfc[_0x8a91('0x30')][_0x8a91('0x32')]?_0x2b8bfc[_0x8a91('0x30')]:_0x2f5b55[_0x8a91('0x2d')];_0x2b8bfc[_0x8a91('0x34')]=qs[_0x8a91('0x35')](_0x5acba4[_0x8a91('0x2f')]['sort']);_0x2b8bfc[_0x8a91('0x36')]=qs['filters'](_['pick'](_0x5acba4[_0x8a91('0x2f')],_0x2f5b55[_0x8a91('0x37')]));if(_0x5acba4[_0x8a91('0x2f')][_0x8a91('0x39')]){_0x2b8bfc[_0x8a91('0x36')]=_[_0x8a91('0x3a')](_0x2b8bfc['where'],{'$or':_[_0x8a91('0x28')](_0x2b8bfc[_0x8a91('0x30')],function(_0x430080){var _0x3c9052={};_0x3c9052[_0x430080]={'$like':'%'+_0x5acba4[_0x8a91('0x2f')][_0x8a91('0x39')]+'%'};return _0x3c9052;})});}_0x2b8bfc=_[_0x8a91('0x3a')]({},_0x2b8bfc,_0x5acba4['options']);return _0x101b35['getActions'](_0x2b8bfc);}})[_0x8a91('0x23')](function(_0x571a48){if(_0x571a48){_0x1fc005=_0x571a48[_0x8a91('0x32')];if(!_0x5acba4['query'][_0x8a91('0x4c')](_0x8a91('0x33'))){_0x2b8bfc[_0x8a91('0x1c')]=qs[_0x8a91('0x1c')](_0x5acba4[_0x8a91('0x2f')]['limit']);_0x2b8bfc['offset']=qs[_0x8a91('0x1b')](_0x5acba4['query'][_0x8a91('0x1b')]);}return _0x101b35[_0x8a91('0x50')](_0x2b8bfc);}})[_0x8a91('0x23')](function(_0x1a96db){if(_0x1a96db){return _0x1a96db?{'count':_0x1fc005,'rows':_0x1a96db}:null;}})[_0x8a91('0x23')](respondWithResult(_0x145ae5,null))['catch'](handleError(_0x145ae5,null));}; \ No newline at end of file +var _0xc8fa=['error','name','send','index','map','Automation','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','count','offset','apply','reject','save','then','destroy'];(function(_0x1ca6a4,_0x2a7743){var _0x105953=function(_0x38431f){while(--_0x38431f){_0x1ca6a4['push'](_0x1ca6a4['shift']());}};_0x105953(++_0x2a7743);}(_0xc8fa,0xcb));var _0xac8f=function(_0x5681b8,_0x4caf5d){_0x5681b8=_0x5681b8-0x0;var _0x2205db=_0xc8fa[_0x5681b8];return _0x2205db;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xac8f('0x0'));var rimraf=require(_0xac8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac8f('0x2'));var rp=require(_0xac8f('0x3'));var moment=require('moment');var BPromise=require(_0xac8f('0x4'));var Mustache=require(_0xac8f('0x5'));var util=require(_0xac8f('0x6'));var path=require(_0xac8f('0x7'));var sox=require('sox');var csv=require(_0xac8f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xac8f('0x9'));var crypto=require(_0xac8f('0xa'));var jsforce=require(_0xac8f('0xb'));var deskjs=require(_0xac8f('0xc'));var toCsv=require(_0xac8f('0x8'));var querystring=require(_0xac8f('0xd'));var Papa=require(_0xac8f('0xe'));var Redis=require(_0xac8f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xac8f('0x10'));var hardwareService=require(_0xac8f('0x11'));var logger=require('../../config/logger')(_0xac8f('0x12'));var utils=require('../../config/utils');var config=require(_0xac8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x340bb1,_0x41daaa){_0x41daaa=_0x41daaa||0xcc;return function(_0x5a97ff){if(_0x5a97ff){return _0x340bb1[_0xac8f('0x14')](_0x41daaa);}return _0x340bb1[_0xac8f('0x15')](_0x41daaa)[_0xac8f('0x16')]();};}function respondWithResult(_0x36f318,_0x173b0e){_0x173b0e=_0x173b0e||0xc8;return function(_0xd18f5d){if(_0xd18f5d){return _0x36f318[_0xac8f('0x15')](_0x173b0e)[_0xac8f('0x17')](_0xd18f5d);}};}function respondWithFilteredResult(_0x4a7935,_0x12bbe1){return function(_0x327c58){if(_0x327c58){var _0x4ae553=_0x327c58[_0xac8f('0x18')],_0x19b4c0=_0x12bbe1['offset'],_0x27cf23=_0x12bbe1[_0xac8f('0x19')]+_0x12bbe1['limit'],_0x4dd3eb;if(_0x27cf23>=_0x4ae553){_0x27cf23=_0x4ae553;_0x4dd3eb=0xc8;}else{_0x4dd3eb=0xce;}_0x4a7935[_0xac8f('0x15')](_0x4dd3eb);return _0x4a7935['set']('Content-Range',_0x19b4c0+'-'+_0x27cf23+'/'+_0x4ae553)[_0xac8f('0x17')](_0x327c58);}return null;};}function patchUpdates(_0x15f0c3){return function(_0x257be2){try{jsonpatch[_0xac8f('0x1a')](_0x257be2,_0x15f0c3,!![]);}catch(_0x1013b8){return BPromise[_0xac8f('0x1b')](_0x1013b8);}return _0x257be2[_0xac8f('0x1c')]();};}function saveUpdates(_0x59d9c1,_0x5aa13e){return function(_0x2c0354){if(_0x2c0354){return _0x2c0354['update'](_0x59d9c1)[_0xac8f('0x1d')](function(_0x20692e){return _0x20692e;});}return null;};}function removeEntity(_0xd6243a,_0x46e6a3){return function(_0x7c64d9){if(_0x7c64d9){return _0x7c64d9[_0xac8f('0x1e')]()[_0xac8f('0x1d')](function(){_0xd6243a[_0xac8f('0x15')](0xcc)[_0xac8f('0x16')]();});}};}function handleEntityNotFound(_0x3790b5,_0x29f4c7){return function(_0x4e7769){if(!_0x4e7769){_0x3790b5[_0xac8f('0x14')](0x194);}return _0x4e7769;};}function handleError(_0x39e13a,_0x5a4f8e){_0x5a4f8e=_0x5a4f8e||0x1f4;return function(_0x4803e9){logger[_0xac8f('0x1f')](_0x4803e9['stack']);if(_0x4803e9['name']){delete _0x4803e9[_0xac8f('0x20')];}_0x39e13a[_0xac8f('0x15')](_0x5a4f8e)[_0xac8f('0x21')](_0x4803e9);};}exports[_0xac8f('0x22')]=function(_0x216521,_0x4463ab){var _0x3edfe7={},_0x1102a9={},_0x34fc19={'count':0x0,'rows':[]};var _0xea5cb5=_[_0xac8f('0x23')](db[_0xac8f('0x24')][_0xac8f('0x25')],function(_0x3fdc13){return{'name':_0x3fdc13['fieldName'],'type':_0x3fdc13[_0xac8f('0x26')][_0xac8f('0x27')]};});_0x1102a9[_0xac8f('0x28')]=_[_0xac8f('0x23')](_0xea5cb5,_0xac8f('0x20'));_0x1102a9[_0xac8f('0x29')]=_[_0xac8f('0x2a')](_0x216521[_0xac8f('0x29')]);_0x1102a9[_0xac8f('0x2b')]=_['intersection'](_0x1102a9['model'],_0x1102a9[_0xac8f('0x29')]);_0x3edfe7[_0xac8f('0x2c')]=_[_0xac8f('0x2d')](_0x1102a9[_0xac8f('0x28')],qs[_0xac8f('0x2e')](_0x216521[_0xac8f('0x29')][_0xac8f('0x2e')]));_0x3edfe7[_0xac8f('0x2c')]=_0x3edfe7[_0xac8f('0x2c')][_0xac8f('0x2f')]?_0x3edfe7['attributes']:_0x1102a9[_0xac8f('0x28')];if(!_0x216521['query'][_0xac8f('0x30')](_0xac8f('0x31'))){_0x3edfe7['limit']=qs[_0xac8f('0x32')](_0x216521['query'][_0xac8f('0x32')]);_0x3edfe7['offset']=qs[_0xac8f('0x19')](_0x216521['query'][_0xac8f('0x19')]);}_0x3edfe7[_0xac8f('0x33')]=qs[_0xac8f('0x34')](_0x216521['query'][_0xac8f('0x34')]);_0x3edfe7[_0xac8f('0x35')]=qs[_0xac8f('0x2b')](_['pick'](_0x216521['query'],_0x1102a9[_0xac8f('0x2b')]),_0xea5cb5);if(_0x216521[_0xac8f('0x29')]['filter']){_0x3edfe7['where']=_[_0xac8f('0x36')](_0x3edfe7['where'],{'$or':_[_0xac8f('0x23')](_0xea5cb5,function(_0x1d7f95){if(_0x1d7f95[_0xac8f('0x26')]!==_0xac8f('0x37')){var _0x4e44b3={};_0x4e44b3[_0x1d7f95[_0xac8f('0x20')]]={'$like':'%'+_0x216521[_0xac8f('0x29')][_0xac8f('0x38')]+'%'};return _0x4e44b3;}})});}_0x3edfe7=_[_0xac8f('0x36')]({},_0x3edfe7,_0x216521[_0xac8f('0x39')]);var _0x19f243={'where':_0x3edfe7[_0xac8f('0x35')]};return db[_0xac8f('0x24')][_0xac8f('0x18')](_0x19f243)[_0xac8f('0x1d')](function(_0x2c798c){_0x34fc19[_0xac8f('0x18')]=_0x2c798c;if(_0x216521[_0xac8f('0x29')][_0xac8f('0x3a')]){_0x3edfe7[_0xac8f('0x3b')]=[{'all':!![]}];}return db[_0xac8f('0x24')][_0xac8f('0x3c')](_0x3edfe7);})['then'](function(_0xc16c30){_0x34fc19[_0xac8f('0x3d')]=_0xc16c30;return _0x34fc19;})['then'](respondWithFilteredResult(_0x4463ab,_0x3edfe7))[_0xac8f('0x3e')](handleError(_0x4463ab,null));};exports['show']=function(_0x2cfa93,_0x1ae117){var _0x9c0450={'raw':![],'where':{'id':_0x2cfa93[_0xac8f('0x3f')]['id']}},_0x577ccd={};_0x577ccd[_0xac8f('0x28')]=_[_0xac8f('0x2a')](db[_0xac8f('0x24')][_0xac8f('0x25')]);_0x577ccd[_0xac8f('0x29')]=_[_0xac8f('0x2a')](_0x2cfa93[_0xac8f('0x29')]);_0x577ccd['filters']=_[_0xac8f('0x2d')](_0x577ccd[_0xac8f('0x28')],_0x577ccd[_0xac8f('0x29')]);_0x9c0450[_0xac8f('0x2c')]=_[_0xac8f('0x2d')](_0x577ccd[_0xac8f('0x28')],qs[_0xac8f('0x2e')](_0x2cfa93[_0xac8f('0x29')]['fields']));_0x9c0450[_0xac8f('0x2c')]=_0x9c0450[_0xac8f('0x2c')][_0xac8f('0x2f')]?_0x9c0450[_0xac8f('0x2c')]:_0x577ccd[_0xac8f('0x28')];if(_0x2cfa93[_0xac8f('0x29')][_0xac8f('0x3a')]){_0x9c0450['include']=[{'all':!![]}];}_0x9c0450=_[_0xac8f('0x36')]({},_0x9c0450,_0x2cfa93[_0xac8f('0x39')]);return db[_0xac8f('0x24')][_0xac8f('0x40')](_0x9c0450)[_0xac8f('0x1d')](handleEntityNotFound(_0x1ae117,null))[_0xac8f('0x1d')](respondWithResult(_0x1ae117,null))['catch'](handleError(_0x1ae117,null));};exports['create']=function(_0x1b61bf,_0x10112a){return db[_0xac8f('0x24')][_0xac8f('0x41')](_0x1b61bf[_0xac8f('0x42')],{})[_0xac8f('0x1d')](respondWithResult(_0x10112a,0xc9))[_0xac8f('0x3e')](handleError(_0x10112a,null));};exports[_0xac8f('0x43')]=function(_0x5e9264,_0x4edfdd){if(_0x5e9264['body']['id']){delete _0x5e9264[_0xac8f('0x42')]['id'];}return db['Automation'][_0xac8f('0x40')]({'where':{'id':_0x5e9264[_0xac8f('0x3f')]['id']}})[_0xac8f('0x1d')](handleEntityNotFound(_0x4edfdd,null))[_0xac8f('0x1d')](saveUpdates(_0x5e9264['body'],null))['then'](respondWithResult(_0x4edfdd,null))['catch'](handleError(_0x4edfdd,null));};exports[_0xac8f('0x1e')]=function(_0x177e5c,_0x940284){return db[_0xac8f('0x24')][_0xac8f('0x40')]({'where':{'id':_0x177e5c[_0xac8f('0x3f')]['id']}})[_0xac8f('0x1d')](handleEntityNotFound(_0x940284,null))[_0xac8f('0x1d')](removeEntity(_0x940284,null))[_0xac8f('0x3e')](handleError(_0x940284,null));};exports[_0xac8f('0x44')]=function(_0x50850a,_0x472ef9,_0x301518){return db[_0xac8f('0x45')][_0xac8f('0x40')]({'where':{'id':_0x50850a[_0xac8f('0x3f')]['id']}})[_0xac8f('0x1d')](handleEntityNotFound(_0x472ef9,null))[_0xac8f('0x1d')](function(_0x2e55d1){if(_0x2e55d1){return _0x2e55d1[_0xac8f('0x44')](_0x50850a[_0xac8f('0x42')][_0xac8f('0x46')],_['omit'](_0x50850a[_0xac8f('0x42')],[_0xac8f('0x46'),'id'])||{});}})[_0xac8f('0x1d')](respondWithResult(_0x472ef9,null))[_0xac8f('0x3e')](handleError(_0x472ef9,null));};exports['getConditions']=function(_0x1dab37,_0x1f0157,_0x218f67){var _0x15bc73={};var _0x1fdf19={};var _0x44c330;var _0x727916;return db[_0xac8f('0x24')][_0xac8f('0x47')]({'where':{'id':_0x1dab37[_0xac8f('0x3f')]['id']}})[_0xac8f('0x1d')](handleEntityNotFound(_0x1f0157,null))['then'](function(_0x6fafc4){if(_0x6fafc4){_0x44c330=_0x6fafc4;_0x1fdf19[_0xac8f('0x28')]=_[_0xac8f('0x2a')](db[_0xac8f('0x45')][_0xac8f('0x25')]);_0x1fdf19[_0xac8f('0x29')]=_['keys'](_0x1dab37[_0xac8f('0x29')]);_0x1fdf19[_0xac8f('0x2b')]=_['intersection'](_0x1fdf19[_0xac8f('0x28')],_0x1fdf19[_0xac8f('0x29')]);_0x15bc73[_0xac8f('0x2c')]=_['intersection'](_0x1fdf19[_0xac8f('0x28')],qs[_0xac8f('0x2e')](_0x1dab37['query'][_0xac8f('0x2e')]));_0x15bc73[_0xac8f('0x2c')]=_0x15bc73[_0xac8f('0x2c')][_0xac8f('0x2f')]?_0x15bc73[_0xac8f('0x2c')]:_0x1fdf19[_0xac8f('0x28')];_0x15bc73['order']=qs[_0xac8f('0x34')](_0x1dab37[_0xac8f('0x29')]['sort']);_0x15bc73[_0xac8f('0x35')]=qs[_0xac8f('0x2b')](_[_0xac8f('0x48')](_0x1dab37[_0xac8f('0x29')],_0x1fdf19['filters']));if(_0x1dab37[_0xac8f('0x29')]['filter']){_0x15bc73[_0xac8f('0x35')]=_[_0xac8f('0x36')](_0x15bc73[_0xac8f('0x35')],{'$or':_[_0xac8f('0x23')](_0x15bc73[_0xac8f('0x2c')],function(_0x55bdd9){var _0x3f21cd={};_0x3f21cd[_0x55bdd9]={'$like':'%'+_0x1dab37[_0xac8f('0x29')]['filter']+'%'};return _0x3f21cd;})});}_0x15bc73=_['merge']({},_0x15bc73,_0x1dab37['options']);return _0x44c330[_0xac8f('0x49')](_0x15bc73);}})[_0xac8f('0x1d')](function(_0x2847c9){if(_0x2847c9){_0x727916=_0x2847c9[_0xac8f('0x2f')];if(!_0x1dab37['query']['hasOwnProperty']('nolimit')){_0x15bc73[_0xac8f('0x32')]=qs[_0xac8f('0x32')](_0x1dab37[_0xac8f('0x29')][_0xac8f('0x32')]);_0x15bc73[_0xac8f('0x19')]=qs['offset'](_0x1dab37[_0xac8f('0x29')][_0xac8f('0x19')]);}return _0x44c330[_0xac8f('0x49')](_0x15bc73);}})[_0xac8f('0x1d')](function(_0x64f442){if(_0x64f442){return _0x64f442?{'count':_0x727916,'rows':_0x64f442}:null;}})[_0xac8f('0x1d')](respondWithResult(_0x1f0157,null))[_0xac8f('0x3e')](handleError(_0x1f0157,null));};exports[_0xac8f('0x4a')]=function(_0x285164,_0x14958a,_0x3aac1a){return db[_0xac8f('0x4b')][_0xac8f('0x40')]({'where':{'id':_0x285164[_0xac8f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x14958a,null))[_0xac8f('0x1d')](function(_0x5aaa2d){if(_0x5aaa2d){return _0x5aaa2d[_0xac8f('0x4a')](_0x285164['body'][_0xac8f('0x46')],_[_0xac8f('0x4c')](_0x285164[_0xac8f('0x42')],[_0xac8f('0x46'),'id'])||{});}})[_0xac8f('0x1d')](respondWithResult(_0x14958a,null))[_0xac8f('0x3e')](handleError(_0x14958a,null));};exports[_0xac8f('0x4d')]=function(_0x30c9f3,_0x21a5e0,_0x580178){var _0x1a233d={};var _0x140ac4={};var _0x32351f;var _0x12aa37;return db[_0xac8f('0x24')][_0xac8f('0x47')]({'where':{'id':_0x30c9f3['params']['id']}})[_0xac8f('0x1d')](handleEntityNotFound(_0x21a5e0,null))[_0xac8f('0x1d')](function(_0x341c4e){if(_0x341c4e){_0x32351f=_0x341c4e;_0x140ac4[_0xac8f('0x28')]=_[_0xac8f('0x2a')](db[_0xac8f('0x4b')][_0xac8f('0x25')]);_0x140ac4[_0xac8f('0x29')]=_[_0xac8f('0x2a')](_0x30c9f3[_0xac8f('0x29')]);_0x140ac4[_0xac8f('0x2b')]=_[_0xac8f('0x2d')](_0x140ac4[_0xac8f('0x28')],_0x140ac4[_0xac8f('0x29')]);_0x1a233d[_0xac8f('0x2c')]=_[_0xac8f('0x2d')](_0x140ac4[_0xac8f('0x28')],qs['fields'](_0x30c9f3['query'][_0xac8f('0x2e')]));_0x1a233d[_0xac8f('0x2c')]=_0x1a233d[_0xac8f('0x2c')]['length']?_0x1a233d[_0xac8f('0x2c')]:_0x140ac4['model'];_0x1a233d[_0xac8f('0x33')]=qs[_0xac8f('0x34')](_0x30c9f3[_0xac8f('0x29')]['sort']);_0x1a233d[_0xac8f('0x35')]=qs['filters'](_['pick'](_0x30c9f3['query'],_0x140ac4[_0xac8f('0x2b')]));if(_0x30c9f3[_0xac8f('0x29')][_0xac8f('0x38')]){_0x1a233d['where']=_[_0xac8f('0x36')](_0x1a233d[_0xac8f('0x35')],{'$or':_[_0xac8f('0x23')](_0x1a233d[_0xac8f('0x2c')],function(_0x108487){var _0x1fd9ad={};_0x1fd9ad[_0x108487]={'$like':'%'+_0x30c9f3['query'][_0xac8f('0x38')]+'%'};return _0x1fd9ad;})});}_0x1a233d=_[_0xac8f('0x36')]({},_0x1a233d,_0x30c9f3[_0xac8f('0x39')]);return _0x32351f[_0xac8f('0x4d')](_0x1a233d);}})[_0xac8f('0x1d')](function(_0x9f162a){if(_0x9f162a){_0x12aa37=_0x9f162a[_0xac8f('0x2f')];if(!_0x30c9f3['query'][_0xac8f('0x30')](_0xac8f('0x31'))){_0x1a233d[_0xac8f('0x32')]=qs[_0xac8f('0x32')](_0x30c9f3[_0xac8f('0x29')]['limit']);_0x1a233d[_0xac8f('0x19')]=qs['offset'](_0x30c9f3[_0xac8f('0x29')][_0xac8f('0x19')]);}return _0x32351f[_0xac8f('0x4d')](_0x1a233d);}})['then'](function(_0x1fe22a){if(_0x1fe22a){return _0x1fe22a?{'count':_0x12aa37,'rows':_0x1fe22a}:null;}})['then'](respondWithResult(_0x21a5e0,null))[_0xac8f('0x3e')](handleError(_0x21a5e0,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index b87dd0d..25968be 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 _0x55ca=['./automation.attributes','exports','define','tools_automations','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0x55ca,0x126));var _0xa55c=function(_0x2be240,_0x1e119d){_0x2be240=_0x2be240-0x0;var _0x123543=_0x55ca[_0x2be240];return _0x123543;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Automation',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5075=['bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','define','tools_automations','lodash','util','../../config/logger','api','moment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5075,0x73));var _0x5507=function(_0x4f5ef9,_0x2eaea0){_0x4f5ef9=_0x4f5ef9-0x0;var _0x4e43c1=_0x5075[_0x4f5ef9];return _0x4e43c1;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var logger=require(_0x5507('0x2'))(_0x5507('0x3'));var moment=require(_0x5507('0x4'));var BPromise=require(_0x5507('0x5'));var rp=require(_0x5507('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var attributes=require(_0x5507('0x9'));module['exports']=function(_0x5b6d7f,_0x2cd9ee){return _0x5b6d7f[_0x5507('0xa')]('Automation',attributes,{'tableName':_0x5507('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 386e842..0405cef 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 _0x324d=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xf9391f,_0x11b059){var _0x36a909=function(_0x2fde9d){while(--_0x2fde9d){_0xf9391f['push'](_0xf9391f['shift']());}};_0x36a909(++_0x11b059);}(_0x324d,0x170));var _0xd324=function(_0x132d17,_0x5e2a04){_0x132d17=_0x132d17-0x0;var _0x2b1830=_0x324d[_0x132d17];return _0x2b1830;};'use strict';var _=require(_0xd324('0x0'));var util=require(_0xd324('0x1'));var moment=require('moment');var BPromise=require(_0xd324('0x2'));var rs=require(_0xd324('0x3'));var fs=require('fs');var Redis=require(_0xd324('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd324('0x5'));var logger=require(_0xd324('0x6'))(_0xd324('0x7'));var config=require(_0xd324('0x8'));var jayson=require(_0xd324('0x9'));var client=jayson[_0xd324('0xa')][_0xd324('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c84e7,_0x23fba7,_0x39bfb4){return new BPromise(function(_0x280461,_0x5231b7){return client[_0xd324('0xc')](_0x5c84e7,_0x39bfb4)[_0xd324('0xd')](function(_0xa21a59){logger[_0xd324('0xe')](_0xd324('0xf'),_0x23fba7,_0xd324('0x10'));logger[_0xd324('0x11')](_0xd324('0x12'),_0x23fba7,_0xd324('0x10'),JSON[_0xd324('0x13')](_0xa21a59));if(_0xa21a59['error']){if(_0xa21a59[_0xd324('0x14')][_0xd324('0x15')]===0x1f4){logger['error'](_0xd324('0xf'),_0x23fba7,_0xa21a59['error'][_0xd324('0x16')]);return _0x5231b7(_0xa21a59[_0xd324('0x14')][_0xd324('0x16')]);}logger[_0xd324('0x14')]('Automation,\x20%s,\x20%s',_0x23fba7,_0xa21a59[_0xd324('0x14')][_0xd324('0x16')]);return _0x280461(_0xa21a59[_0xd324('0x14')]['message']);}else{logger['info'](_0xd324('0xf'),_0x23fba7,'request\x20sent');_0x280461(_0xa21a59[_0xd324('0x17')][_0xd324('0x16')]);}})[_0xd324('0x18')](function(_0x1065d5){logger['error'](_0xd324('0xf'),_0x23fba7,_0x1065d5);_0x5231b7(_0x1065d5);});});} \ No newline at end of file +var _0xc11f=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent','debug','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x560f7d,_0x4b8cf1){var _0x14721a=function(_0x320588){while(--_0x320588){_0x560f7d['push'](_0x560f7d['shift']());}};_0x14721a(++_0x4b8cf1);}(_0xc11f,0x1b5));var _0xfc11=function(_0x1241ad,_0x9e332a){_0x1241ad=_0x1241ad-0x0;var _0x49b9e1=_0xc11f[_0x1241ad];return _0x49b9e1;};'use strict';var _=require(_0xfc11('0x0'));var util=require('util');var moment=require(_0xfc11('0x1'));var BPromise=require(_0xfc11('0x2'));var rs=require(_0xfc11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc11('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc11('0x5'))(_0xfc11('0x6'));var config=require(_0xfc11('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfc11('0x8')][_0xfc11('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcabf9f,_0x1aa1a2,_0x2d7f15){return new BPromise(function(_0x57a481,_0x151f5f){return client[_0xfc11('0xa')](_0xcabf9f,_0x2d7f15)['then'](function(_0x60f1ed){logger['info']('Automation,\x20%s,\x20%s',_0x1aa1a2,_0xfc11('0xb'));logger[_0xfc11('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x1aa1a2,'request\x20sent',JSON[_0xfc11('0xd')](_0x60f1ed));if(_0x60f1ed[_0xfc11('0xe')]){if(_0x60f1ed[_0xfc11('0xe')][_0xfc11('0xf')]===0x1f4){logger['error'](_0xfc11('0x10'),_0x1aa1a2,_0x60f1ed['error'][_0xfc11('0x11')]);return _0x151f5f(_0x60f1ed[_0xfc11('0xe')][_0xfc11('0x11')]);}logger[_0xfc11('0xe')](_0xfc11('0x10'),_0x1aa1a2,_0x60f1ed[_0xfc11('0xe')][_0xfc11('0x11')]);return _0x57a481(_0x60f1ed[_0xfc11('0xe')]['message']);}else{logger['info'](_0xfc11('0x10'),_0x1aa1a2,_0xfc11('0xb'));_0x57a481(_0x60f1ed[_0xfc11('0x12')][_0xfc11('0x11')]);}})[_0xfc11('0x13')](function(_0x26623e){logger[_0xfc11('0xe')]('Automation,\x20%s,\x20%s',_0x1aa1a2,_0x26623e);_0x151f5f(_0x26623e);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index a7bbb93..f620ff6 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 _0x2558=['/:id/conditions','addConditions','addActions','put','update','delete','/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','show','getConditions','/:id/actions','post','create'];(function(_0x211b43,_0x3912fb){var _0x5f4576=function(_0x430838){while(--_0x430838){_0x211b43['push'](_0x211b43['shift']());}};_0x5f4576(++_0x3912fb);}(_0x2558,0x1a0));var _0x8255=function(_0x21014b,_0xb932fe){_0x21014b=_0x21014b-0x0;var _0x4da430=_0x2558[_0x21014b];return _0x4da430;};'use strict';var multer=require('multer');var util=require(_0x8255('0x0'));var path=require(_0x8255('0x1'));var timeout=require(_0x8255('0x2'));var express=require(_0x8255('0x3'));var router=express[_0x8255('0x4')]();var auth=require(_0x8255('0x5'));var interaction=require(_0x8255('0x6'));var config=require(_0x8255('0x7'));var controller=require(_0x8255('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8255('0x9')]('/:id',auth[_0x8255('0xa')](),controller[_0x8255('0xb')]);router[_0x8255('0x9')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x8255('0xc')]);router['get'](_0x8255('0xd'),auth['isAuthenticated'](),controller['getActions']);router[_0x8255('0xe')]('/',auth[_0x8255('0xa')](),controller[_0x8255('0xf')]);router[_0x8255('0xe')](_0x8255('0x10'),auth[_0x8255('0xa')](),controller[_0x8255('0x11')]);router[_0x8255('0xe')](_0x8255('0xd'),auth[_0x8255('0xa')](),controller[_0x8255('0x12')]);router[_0x8255('0x13')]('/:id',auth[_0x8255('0xa')](),controller[_0x8255('0x14')]);router[_0x8255('0x15')](_0x8255('0x16'),auth['isAuthenticated'](),controller[_0x8255('0x17')]);module['exports']=router; \ No newline at end of file +var _0x8757=['getConditions','getActions','post','create','/:id/actions','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x8757,0x157));var _0x7875=function(_0x183335,_0x20f357){_0x183335=_0x183335-0x0;var _0x23a95c=_0x8757[_0x183335];return _0x23a95c;};'use strict';var multer=require(_0x7875('0x0'));var util=require('util');var path=require(_0x7875('0x1'));var timeout=require(_0x7875('0x2'));var express=require(_0x7875('0x3'));var router=express[_0x7875('0x4')]();var auth=require(_0x7875('0x5'));var interaction=require(_0x7875('0x6'));var config=require(_0x7875('0x7'));var controller=require('./automation.controller');router[_0x7875('0x8')]('/',auth[_0x7875('0x9')](),controller[_0x7875('0xa')]);router[_0x7875('0x8')](_0x7875('0xb'),auth[_0x7875('0x9')](),controller[_0x7875('0xc')]);router[_0x7875('0x8')](_0x7875('0xd'),auth[_0x7875('0x9')](),controller[_0x7875('0xe')]);router[_0x7875('0x8')]('/:id/actions',auth[_0x7875('0x9')](),controller[_0x7875('0xf')]);router[_0x7875('0x10')]('/',auth['isAuthenticated'](),controller[_0x7875('0x11')]);router[_0x7875('0x10')]('/:id/conditions',auth[_0x7875('0x9')](),controller['addConditions']);router[_0x7875('0x10')](_0x7875('0x12'),auth[_0x7875('0x9')](),controller['addActions']);router['put'](_0x7875('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x7875('0x13')](_0x7875('0xb'),auth['isAuthenticated'](),controller[_0x7875('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index f0b195e..d7b423f 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 _0x6949=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','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)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x6949,0xd4));var _0x9694=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x6949[_0xf0bc07];return _0x1c50c2;};'use strict';var Sequelize=require('sequelize');module[_0x9694('0x0')]={'name':{'type':Sequelize[_0x9694('0x1')],'unique':_0x9694('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9694('0x3')](_0x9694('0x4')),'allowNull':![],'defaultValue':_0x9694('0x4')},'description':{'type':Sequelize[_0x9694('0x1')]},'active':{'type':Sequelize[_0x9694('0x5')],'defaultValue':0x0,'comment':_0x9694('0x6')},'limitCalls':{'type':Sequelize[_0x9694('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x9694('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9694('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x9694('0x7')](0x3)[_0x9694('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9694('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9694('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9694('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9694('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9694('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)[_0x9694('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9694('0x7')](0x3)[_0x9694('0x8')],'defaultValue':0x3,'comment':_0x9694('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)[_0x9694('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x9694('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x9694('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9694('0x1')],'defaultValue':_0x9694('0xc')},'dialCheckDuplicateType':{'type':Sequelize[_0x9694('0x3')]('always',_0x9694('0xd'),_0x9694('0xe')),'defaultValue':_0x9694('0xf')},'dialAMDActive':{'type':Sequelize[_0x9694('0x5')],'defaultValue':0x0,'comment':_0x9694('0x10')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9694('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x9694('0x7')](0x9)[_0x9694('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9694('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9694('0x7')](0x9)[_0x9694('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9694('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9694('0x7')](0x9)[_0x9694('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9694('0x13')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9694('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9694('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9694('0x7')](0x9)[_0x9694('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9694('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9694('0x7')](0x9)[_0x9694('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9694('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9694('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9694('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9694('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9694('0x3')](_0x9694('0x19'),_0x9694('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x9694('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x9694('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9694('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x9694('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9694('0x7')](0x3)[_0x9694('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9694('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)[_0x9694('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9694('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9694('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9694('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9694('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)[_0x9694('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9694('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x9694('0x7')](0x3)[_0x9694('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)[_0x9694('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9694('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9694('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9694('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9694('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 +var _0x709d=['#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\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','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','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)'];(function(_0x4333c0,_0x1b8b7d){var _0x1ea60b=function(_0x36a1ea){while(--_0x36a1ea){_0x4333c0['push'](_0x4333c0['shift']());}};_0x1ea60b(++_0x1b8b7d);}(_0x709d,0x6d));var _0xd709=function(_0x3205cf,_0x14725b){_0x3205cf=_0x3205cf-0x0;var _0x2dd813=_0x709d[_0x3205cf];return _0x2dd813;};'use strict';var Sequelize=require(_0xd709('0x0'));module[_0xd709('0x1')]={'name':{'type':Sequelize[_0xd709('0x2')],'unique':_0xd709('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd709('0x4')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xd709('0x2')]},'active':{'type':Sequelize[_0xd709('0x5')],'defaultValue':0x0,'comment':_0xd709('0x6')},'limitCalls':{'type':Sequelize[_0xd709('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd709('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd709('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd709('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xd709('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd709('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)[_0xd709('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd709('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xd709('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xd709('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd709('0x2')],'defaultValue':_0xd709('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xd709('0x4')]('always',_0xd709('0xe'),_0xd709('0xf')),'defaultValue':_0xd709('0x10')},'dialAMDActive':{'type':Sequelize[_0xd709('0x5')],'defaultValue':0x0,'comment':_0xd709('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd709('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xd709('0x7')](0x9)[_0xd709('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd709('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd709('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd709('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd709('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd709('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd709('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd709('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd709('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd709('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd709('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd709('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd709('0x4')](_0xd709('0x18'),_0xd709('0x19')),'defaultValue':_0xd709('0x18')},'dialPrefix':{'type':Sequelize[_0xd709('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd709('0x1a')},'dialCutDigit':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd709('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd709('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd709('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd709('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)[_0xd709('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd709('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd709('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd709('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)[_0xd709('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd709('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd709('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index ec5e572..788c06c 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 _0x4139=['CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','push','sequelize','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','Campaign','rows','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','CmHopper','CampaignId','CmHopperHistory','hasOwnProperty','findAll','getHopperFinals','findOne','CmHopperFinal'];(function(_0x54783c,_0x4e00e0){var _0x261a7c=function(_0x2ab459){while(--_0x2ab459){_0x54783c['push'](_0x54783c['shift']());}};_0x261a7c(++_0x4e00e0);}(_0x4139,0x136));var _0x9413=function(_0x151b07,_0x1b08be){_0x151b07=_0x151b07-0x0;var _0x42cf52=_0x4139[_0x151b07];return _0x42cf52;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9413('0x0'));var rimraf=require(_0x9413('0x1'));var zipdir=require(_0x9413('0x2'));var jsonpatch=require(_0x9413('0x3'));var rp=require(_0x9413('0x4'));var moment=require(_0x9413('0x5'));var BPromise=require(_0x9413('0x6'));var Mustache=require(_0x9413('0x7'));var util=require(_0x9413('0x8'));var path=require(_0x9413('0x9'));var sox=require('sox');var csv=require(_0x9413('0xa'));var ejs=require(_0x9413('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9413('0xc'));var crypto=require(_0x9413('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9413('0xa'));var querystring=require(_0x9413('0xe'));var Papa=require('papaparse');var Redis=require(_0x9413('0xf'));var authService=require(_0x9413('0x10'));var qs=require(_0x9413('0x11'));var as=require(_0x9413('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9413('0x13'))(_0x9413('0x14'));var utils=require(_0x9413('0x15'));var config=require(_0x9413('0x16'));var db=require(_0x9413('0x17'))['db'];function respondWithStatusCode(_0x54bc26,_0x47e138){_0x47e138=_0x47e138||0xcc;return function(_0x5b2884){if(_0x5b2884){return _0x54bc26[_0x9413('0x18')](_0x47e138);}return _0x54bc26[_0x9413('0x19')](_0x47e138)['end']();};}function respondWithResult(_0x287007,_0x5b2f22){_0x5b2f22=_0x5b2f22||0xc8;return function(_0x46fff3){if(_0x46fff3){return _0x287007['status'](_0x5b2f22)[_0x9413('0x1a')](_0x46fff3);}};}function respondWithFilteredResult(_0x46cbec,_0xec783a){return function(_0x490d5e){if(_0x490d5e){var _0x48007b=_0x490d5e['count'],_0x553f7a=_0xec783a['offset'],_0x1846a1=_0xec783a[_0x9413('0x1b')]+_0xec783a['limit'],_0xdf6717;if(_0x1846a1>=_0x48007b){_0x1846a1=_0x48007b;_0xdf6717=0xc8;}else{_0xdf6717=0xce;}_0x46cbec['status'](_0xdf6717);return _0x46cbec[_0x9413('0x1c')](_0x9413('0x1d'),_0x553f7a+'-'+_0x1846a1+'/'+_0x48007b)[_0x9413('0x1a')](_0x490d5e);}return null;};}function patchUpdates(_0x1d8c30){return function(_0x2c8645){try{jsonpatch[_0x9413('0x1e')](_0x2c8645,_0x1d8c30,!![]);}catch(_0x5af836){return BPromise[_0x9413('0x1f')](_0x5af836);}return _0x2c8645[_0x9413('0x20')]();};}function saveUpdates(_0x220678,_0x27f96f){return function(_0x12cf0e){if(_0x12cf0e){return _0x12cf0e[_0x9413('0x21')](_0x220678)['then'](function(_0x4c0288){return _0x4c0288;});}return null;};}function removeEntity(_0x5a16d4,_0xac8643){return function(_0x606401){if(_0x606401){return _0x606401[_0x9413('0x22')]()[_0x9413('0x23')](function(){var _0xb6aa2c=_0x606401['get']({'plain':!![]});var _0x4901c7=_0x9413('0x24');return db[_0x9413('0x25')][_0x9413('0x22')]({'where':{'type':_0x4901c7,'resourceId':_0xb6aa2c['id']}})[_0x9413('0x23')](function(){return _0x606401;});})[_0x9413('0x23')](function(){_0x5a16d4['status'](0xcc)[_0x9413('0x26')]();});}};}function handleEntityNotFound(_0x2dae2b,_0x57c296){return function(_0xe468cf){if(!_0xe468cf){_0x2dae2b[_0x9413('0x18')](0x194);}return _0xe468cf;};}function handleError(_0x26a84a,_0x43759a){_0x43759a=_0x43759a||0x1f4;return function(_0x5a6b4c){logger[_0x9413('0x27')](_0x5a6b4c['stack']);if(_0x5a6b4c[_0x9413('0x28')]){delete _0x5a6b4c[_0x9413('0x28')];}_0x26a84a[_0x9413('0x19')](_0x43759a)[_0x9413('0x29')](_0x5a6b4c);};}exports[_0x9413('0x2a')]=function(_0x56659e,_0x464d5f){var _0x13a8a6={},_0x413c91={},_0x241b9b={'count':0x0,'rows':[]};var _0xbb5384=_[_0x9413('0x2b')](db['Campaign'][_0x9413('0x2c')],function(_0x18443b){return{'name':_0x18443b[_0x9413('0x2d')],'type':_0x18443b[_0x9413('0x2e')][_0x9413('0x2f')]};});_0x413c91['model']=_[_0x9413('0x2b')](_0xbb5384,_0x9413('0x28'));_0x413c91[_0x9413('0x30')]=_[_0x9413('0x31')](_0x56659e[_0x9413('0x30')]);_0x413c91[_0x9413('0x32')]=_[_0x9413('0x33')](_0x413c91[_0x9413('0x34')],_0x413c91[_0x9413('0x30')]);_0x13a8a6['attributes']=_[_0x9413('0x33')](_0x413c91[_0x9413('0x34')],qs[_0x9413('0x35')](_0x56659e[_0x9413('0x30')][_0x9413('0x35')]));_0x13a8a6[_0x9413('0x36')]=_0x13a8a6[_0x9413('0x36')][_0x9413('0x37')]?_0x13a8a6[_0x9413('0x36')]:_0x413c91[_0x9413('0x34')];if(!_0x56659e['query']['hasOwnProperty'](_0x9413('0x38'))){_0x13a8a6[_0x9413('0x39')]=qs[_0x9413('0x39')](_0x56659e[_0x9413('0x30')]['limit']);_0x13a8a6[_0x9413('0x1b')]=qs[_0x9413('0x1b')](_0x56659e[_0x9413('0x30')][_0x9413('0x1b')]);}_0x13a8a6[_0x9413('0x3a')]=qs[_0x9413('0x3b')](_0x56659e[_0x9413('0x30')]['sort']);_0x13a8a6[_0x9413('0x3c')]=qs[_0x9413('0x32')](_[_0x9413('0x3d')](_0x56659e[_0x9413('0x30')],_0x413c91[_0x9413('0x32')]),_0xbb5384);if(_0x56659e[_0x9413('0x30')][_0x9413('0x3e')]){_0x13a8a6[_0x9413('0x3c')]=_[_0x9413('0x3f')](_0x13a8a6[_0x9413('0x3c')],{'$or':_['map'](_0xbb5384,function(_0x31b5bd){if(_0x31b5bd[_0x9413('0x2e')]!==_0x9413('0x40')){var _0x18509d={};_0x18509d[_0x31b5bd[_0x9413('0x28')]]={'$like':'%'+_0x56659e[_0x9413('0x30')][_0x9413('0x3e')]+'%'};return _0x18509d;}})});}_0x13a8a6=_[_0x9413('0x3f')]({},_0x13a8a6,_0x56659e[_0x9413('0x41')]);var _0x556a26={'where':_0x13a8a6[_0x9413('0x3c')]};return db['Campaign'][_0x9413('0x42')](_0x556a26)[_0x9413('0x23')](function(_0x589065){_0x241b9b[_0x9413('0x42')]=_0x589065;if(_0x56659e[_0x9413('0x30')]['includeAll']){_0x13a8a6['include']=[{'all':!![]}];}return db[_0x9413('0x43')]['findAll'](_0x13a8a6);})[_0x9413('0x23')](function(_0x7a335c){_0x241b9b[_0x9413('0x44')]=_0x7a335c;return _0x241b9b;})['then'](respondWithFilteredResult(_0x464d5f,_0x13a8a6))[_0x9413('0x45')](handleError(_0x464d5f,null));};exports[_0x9413('0x46')]=function(_0x198f87,_0x410742){var _0x3bcc4b={'raw':![],'where':{'id':_0x198f87[_0x9413('0x47')]['id']}},_0x5909d3={};_0x5909d3[_0x9413('0x34')]=_['keys'](db[_0x9413('0x43')][_0x9413('0x2c')]);_0x5909d3[_0x9413('0x30')]=_[_0x9413('0x31')](_0x198f87[_0x9413('0x30')]);_0x5909d3[_0x9413('0x32')]=_[_0x9413('0x33')](_0x5909d3['model'],_0x5909d3[_0x9413('0x30')]);_0x3bcc4b[_0x9413('0x36')]=_[_0x9413('0x33')](_0x5909d3[_0x9413('0x34')],qs[_0x9413('0x35')](_0x198f87[_0x9413('0x30')][_0x9413('0x35')]));_0x3bcc4b['attributes']=_0x3bcc4b[_0x9413('0x36')][_0x9413('0x37')]?_0x3bcc4b[_0x9413('0x36')]:_0x5909d3[_0x9413('0x34')];if(_0x198f87['query'][_0x9413('0x48')]){_0x3bcc4b[_0x9413('0x49')]=[{'all':!![]}];}_0x3bcc4b=_[_0x9413('0x3f')]({},_0x3bcc4b,_0x198f87[_0x9413('0x41')]);return db[_0x9413('0x43')][_0x9413('0x4a')](_0x3bcc4b)['then'](handleEntityNotFound(_0x410742,null))[_0x9413('0x23')](respondWithResult(_0x410742,null))[_0x9413('0x45')](handleError(_0x410742,null));};exports['create']=function(_0x40cfba,_0x14ddda){return db['Campaign'][_0x9413('0x4b')](_0x40cfba[_0x9413('0x4c')],{})['then'](function(_0x1d1dcc){var _0x204a9a=_0x40cfba[_0x9413('0x4d')][_0x9413('0x4e')]({'plain':!![]});if(!_0x204a9a)throw new Error(_0x9413('0x4f'));if(_0x204a9a[_0x9413('0x50')]==='user'){var _0x4199a7=_0x1d1dcc['get']({'plain':!![]});var _0x1f8344=_0x9413('0x24');return db[_0x9413('0x51')][_0x9413('0x4a')]({'where':{'name':_0x1f8344,'userProfileId':_0x204a9a[_0x9413('0x52')]},'raw':!![]})[_0x9413('0x23')](function(_0x3a7564){if(_0x3a7564&&_0x3a7564[_0x9413('0x53')]===0x0){return db[_0x9413('0x25')][_0x9413('0x4b')]({'name':_0x4199a7[_0x9413('0x28')],'resourceId':_0x4199a7['id'],'type':_0x3a7564[_0x9413('0x28')],'sectionId':_0x3a7564['id']},{})[_0x9413('0x23')](function(){return _0x1d1dcc;});}else{return _0x1d1dcc;}})[_0x9413('0x45')](function(_0x438aec){logger['error'](_0x9413('0x54'),_0x438aec);throw _0x438aec;});}return _0x1d1dcc;})[_0x9413('0x23')](respondWithResult(_0x14ddda,0xc9))[_0x9413('0x45')](handleError(_0x14ddda,null));};exports[_0x9413('0x55')]=function(_0x316f6d,_0x2857d6){var _0x39b41f={'where':{'id':_0x316f6d[_0x9413('0x47')]['id']}},_0x3f040d={};_0x3f040d[_0x9413('0x34')]=_['keys'](db[_0x9413('0x43')][_0x9413('0x2c')]);_0x39b41f[_0x9413('0x36')]=_['intersection'](_0x3f040d[_0x9413('0x34')],qs[_0x9413('0x35')](_0x316f6d[_0x9413('0x30')][_0x9413('0x35')]));_0x39b41f[_0x9413('0x36')]=_0x39b41f['attributes']['length']?_0x39b41f[_0x9413('0x36')]:_0x3f040d['model'];if(_0x316f6d[_0x9413('0x30')][_0x9413('0x48')]){_0x39b41f[_0x9413('0x49')]=[{'all':!![]}];}_0x39b41f=_[_0x9413('0x3f')]({},_0x39b41f,_0x316f6d[_0x9413('0x41')]);return db[_0x9413('0x43')][_0x9413('0x4a')](_0x39b41f)[_0x9413('0x23')](handleEntityNotFound(_0x2857d6,null))[_0x9413('0x23')](function(_0x390643){if(_0x390643){var _0x5d4480=_0x390643[_0x9413('0x4e')]({'plain':!![]});_0x5d4480=qs[_0x9413('0x56')](_0x5d4480,['id',_0x9413('0x57'),_0x9413('0x58')]);_0x316f6d[_0x9413('0x4c')]=_[_0x9413('0x56')](_0x316f6d[_0x9413('0x4c')],['id',_0x9413('0x57'),'updatedAt']);return db['Campaign'][_0x9413('0x4b')](_[_0x9413('0x3f')](_0x5d4480,_0x316f6d[_0x9413('0x4c')]),{'include':_0x316f6d[_0x9413('0x30')][_0x9413('0x48')]?[{'all':!![]}]:undefined})[_0x9413('0x23')](function(_0x25094e){var _0x47986f=_0x316f6d[_0x9413('0x4d')][_0x9413('0x4e')]({'plain':!![]});if(!_0x47986f)throw new Error(_0x9413('0x4f'));if(_0x47986f[_0x9413('0x50')]===_0x9413('0x4d')){var _0xd4d08d=_0x25094e[_0x9413('0x4e')]({'plain':!![]});var _0x40b6d9=_0x9413('0x24');return db[_0x9413('0x51')][_0x9413('0x4a')]({'where':{'name':_0x40b6d9,'userProfileId':_0x47986f[_0x9413('0x52')]},'raw':!![]})[_0x9413('0x23')](function(_0x26a062){if(_0x26a062&&_0x26a062[_0x9413('0x53')]===0x0){return db['UserProfileResource'][_0x9413('0x4b')]({'name':_0xd4d08d[_0x9413('0x28')],'resourceId':_0xd4d08d['id'],'type':_0x26a062[_0x9413('0x28')],'sectionId':_0x26a062['id']},{})['then'](function(){return _0x25094e;});}else{return _0x25094e;}})[_0x9413('0x45')](function(_0x2acf52){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2acf52);throw _0x2acf52;});}return _0x25094e;});}})[_0x9413('0x23')](respondWithResult(_0x2857d6,0xc9))['catch'](handleError(_0x2857d6,null));};exports[_0x9413('0x21')]=function(_0x213171,_0x1aeed5){if(_0x213171['body']['id']){delete _0x213171[_0x9413('0x4c')]['id'];}return db[_0x9413('0x43')]['find']({'where':{'id':_0x213171[_0x9413('0x47')]['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x1aeed5,null))[_0x9413('0x23')](saveUpdates(_0x213171[_0x9413('0x4c')],null))[_0x9413('0x23')](respondWithResult(_0x1aeed5,null))[_0x9413('0x45')](handleError(_0x1aeed5,null));};exports['destroy']=function(_0x2f9f26,_0x3b7575){return db[_0x9413('0x43')][_0x9413('0x4a')]({'where':{'id':_0x2f9f26[_0x9413('0x47')]['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x3b7575,null))['then'](removeEntity(_0x3b7575,null))[_0x9413('0x45')](handleError(_0x3b7575,null));};exports[_0x9413('0x59')]=function(_0x45b57d,_0x30d951,_0x87a989){var _0x59c994={'raw':!![],'where':{}};var _0x17cbff={};var _0xf5a708={'count':0x0,'rows':[]};return db[_0x9413('0x43')]['findOne']({'where':{'id':_0x45b57d['params']['id']}})['then'](handleEntityNotFound(_0x30d951,null))[_0x9413('0x23')](function(_0x58e60a){if(_0x58e60a){_0x17cbff['model']=_[_0x9413('0x31')](db[_0x9413('0x5a')][_0x9413('0x2c')]);_0x17cbff['query']=_[_0x9413('0x31')](_0x45b57d[_0x9413('0x30')]);_0x17cbff[_0x9413('0x32')]=_[_0x9413('0x33')](_0x17cbff[_0x9413('0x34')],_0x17cbff[_0x9413('0x30')]);_0x59c994['attributes']=_[_0x9413('0x33')](_0x17cbff['model'],qs['fields'](_0x45b57d[_0x9413('0x30')][_0x9413('0x35')]));_0x59c994[_0x9413('0x36')]=_0x59c994[_0x9413('0x36')][_0x9413('0x37')]?_0x59c994['attributes']:_0x17cbff['model'];if(!_0x45b57d[_0x9413('0x30')]['hasOwnProperty'](_0x9413('0x38'))){_0x59c994[_0x9413('0x39')]=qs[_0x9413('0x39')](_0x45b57d['query']['limit']);_0x59c994['offset']=qs[_0x9413('0x1b')](_0x45b57d[_0x9413('0x30')][_0x9413('0x1b')]);}_0x59c994[_0x9413('0x3a')]=qs[_0x9413('0x3b')](_0x45b57d[_0x9413('0x30')]['sort']);_0x59c994[_0x9413('0x3c')]=qs[_0x9413('0x32')](_[_0x9413('0x3d')](_0x45b57d[_0x9413('0x30')],_0x17cbff[_0x9413('0x32')]));_0x59c994[_0x9413('0x3c')][_0x9413('0x5b')]=_0x58e60a['id'];if(_0x45b57d[_0x9413('0x30')][_0x9413('0x3e')]){_0x59c994['where']=_[_0x9413('0x3f')](_0x59c994[_0x9413('0x3c')],{'$or':_[_0x9413('0x2b')](_0x59c994[_0x9413('0x36')],function(_0x29f428){var _0x2cb975={};_0x2cb975[_0x29f428]={'$like':'%'+_0x45b57d[_0x9413('0x30')]['filter']+'%'};return _0x2cb975;})});}_0x59c994=_[_0x9413('0x3f')]({},_0x59c994,_0x45b57d['options']);return db[_0x9413('0x5a')]['count']({'where':_0x59c994['where']})[_0x9413('0x23')](function(_0x528b81){_0xf5a708[_0x9413('0x42')]=_0x528b81;if(_0x45b57d[_0x9413('0x30')][_0x9413('0x48')]){_0x59c994['include']=[{'all':!![]}];}return db[_0x9413('0x5a')]['findAll'](_0x59c994);})[_0x9413('0x23')](function(_0x2b8b17){_0xf5a708[_0x9413('0x44')]=_0x2b8b17;return _0xf5a708;});}})[_0x9413('0x23')](respondWithFilteredResult(_0x30d951,_0x59c994))[_0x9413('0x45')](handleError(_0x30d951,null));};exports['getHopperHistories']=function(_0x50b445,_0x2838f3,_0x175094){var _0x55a660={'raw':!![],'where':{}};var _0x23223c={};var _0x519956={'count':0x0,'rows':[]};return db[_0x9413('0x43')]['findOne']({'where':{'id':_0x50b445[_0x9413('0x47')]['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x2838f3,null))[_0x9413('0x23')](function(_0x1f33ff){if(_0x1f33ff){_0x23223c[_0x9413('0x34')]=_[_0x9413('0x31')](db[_0x9413('0x5c')][_0x9413('0x2c')]);_0x23223c[_0x9413('0x30')]=_[_0x9413('0x31')](_0x50b445[_0x9413('0x30')]);_0x23223c[_0x9413('0x32')]=_[_0x9413('0x33')](_0x23223c['model'],_0x23223c[_0x9413('0x30')]);_0x55a660['attributes']=_[_0x9413('0x33')](_0x23223c[_0x9413('0x34')],qs[_0x9413('0x35')](_0x50b445[_0x9413('0x30')]['fields']));_0x55a660[_0x9413('0x36')]=_0x55a660[_0x9413('0x36')][_0x9413('0x37')]?_0x55a660[_0x9413('0x36')]:_0x23223c['model'];if(!_0x50b445['query'][_0x9413('0x5d')](_0x9413('0x38'))){_0x55a660[_0x9413('0x39')]=qs['limit'](_0x50b445['query'][_0x9413('0x39')]);_0x55a660[_0x9413('0x1b')]=qs[_0x9413('0x1b')](_0x50b445[_0x9413('0x30')][_0x9413('0x1b')]);}_0x55a660['order']=qs[_0x9413('0x3b')](_0x50b445[_0x9413('0x30')]['sort']);_0x55a660['where']=qs['filters'](_[_0x9413('0x3d')](_0x50b445[_0x9413('0x30')],_0x23223c[_0x9413('0x32')]));_0x55a660[_0x9413('0x3c')][_0x9413('0x5b')]=_0x1f33ff['id'];if(_0x50b445[_0x9413('0x30')]['filter']){_0x55a660[_0x9413('0x3c')]=_['merge'](_0x55a660[_0x9413('0x3c')],{'$or':_[_0x9413('0x2b')](_0x55a660[_0x9413('0x36')],function(_0x281e3a){var _0x323f37={};_0x323f37[_0x281e3a]={'$like':'%'+_0x50b445[_0x9413('0x30')]['filter']+'%'};return _0x323f37;})});}_0x55a660=_['merge']({},_0x55a660,_0x50b445['options']);return db[_0x9413('0x5c')][_0x9413('0x42')]({'where':_0x55a660[_0x9413('0x3c')]})[_0x9413('0x23')](function(_0x1d005f){_0x519956[_0x9413('0x42')]=_0x1d005f;if(_0x50b445[_0x9413('0x30')][_0x9413('0x48')]){_0x55a660[_0x9413('0x49')]=[{'all':!![]}];}return db[_0x9413('0x5c')][_0x9413('0x5e')](_0x55a660);})[_0x9413('0x23')](function(_0x34e532){_0x519956['rows']=_0x34e532;return _0x519956;});}})[_0x9413('0x23')](respondWithFilteredResult(_0x2838f3,_0x55a660))[_0x9413('0x45')](handleError(_0x2838f3,null));};exports[_0x9413('0x5f')]=function(_0x25bba5,_0x580d41,_0x355a83){var _0x5cae3c={'raw':!![],'where':{}};var _0x34e69f={};var _0x291e8a={'count':0x0,'rows':[]};return db[_0x9413('0x43')][_0x9413('0x60')]({'where':{'id':_0x25bba5['params']['id']}})['then'](handleEntityNotFound(_0x580d41,null))[_0x9413('0x23')](function(_0x5e1064){if(_0x5e1064){_0x34e69f[_0x9413('0x34')]=_[_0x9413('0x31')](db[_0x9413('0x61')]['rawAttributes']);_0x34e69f['query']=_[_0x9413('0x31')](_0x25bba5[_0x9413('0x30')]);_0x34e69f[_0x9413('0x32')]=_['intersection'](_0x34e69f['model'],_0x34e69f[_0x9413('0x30')]);_0x5cae3c[_0x9413('0x36')]=_[_0x9413('0x33')](_0x34e69f[_0x9413('0x34')],qs[_0x9413('0x35')](_0x25bba5[_0x9413('0x30')]['fields']));_0x5cae3c['attributes']=_0x5cae3c[_0x9413('0x36')][_0x9413('0x37')]?_0x5cae3c[_0x9413('0x36')]:_0x34e69f[_0x9413('0x34')];if(!_0x25bba5[_0x9413('0x30')][_0x9413('0x5d')](_0x9413('0x38'))){_0x5cae3c[_0x9413('0x39')]=qs[_0x9413('0x39')](_0x25bba5[_0x9413('0x30')]['limit']);_0x5cae3c[_0x9413('0x1b')]=qs[_0x9413('0x1b')](_0x25bba5['query'][_0x9413('0x1b')]);}_0x5cae3c[_0x9413('0x3a')]=qs[_0x9413('0x3b')](_0x25bba5[_0x9413('0x30')][_0x9413('0x3b')]);_0x5cae3c[_0x9413('0x3c')]=qs[_0x9413('0x32')](_[_0x9413('0x3d')](_0x25bba5['query'],_0x34e69f[_0x9413('0x32')]));_0x5cae3c['where'][_0x9413('0x5b')]=_0x5e1064['id'];if(_0x25bba5[_0x9413('0x30')]['filter']){_0x5cae3c[_0x9413('0x3c')]=_[_0x9413('0x3f')](_0x5cae3c[_0x9413('0x3c')],{'$or':_[_0x9413('0x2b')](_0x5cae3c['attributes'],function(_0x5d830a){var _0x6d2f3b={};_0x6d2f3b[_0x5d830a]={'$like':'%'+_0x25bba5[_0x9413('0x30')]['filter']+'%'};return _0x6d2f3b;})});}_0x5cae3c=_[_0x9413('0x3f')]({},_0x5cae3c,_0x25bba5[_0x9413('0x41')]);return db[_0x9413('0x61')][_0x9413('0x42')]({'where':_0x5cae3c[_0x9413('0x3c')]})[_0x9413('0x23')](function(_0x5eaaf9){_0x291e8a['count']=_0x5eaaf9;if(_0x25bba5['query'][_0x9413('0x48')]){_0x5cae3c[_0x9413('0x49')]=[{'all':!![]}];}return db[_0x9413('0x61')]['findAll'](_0x5cae3c);})[_0x9413('0x23')](function(_0x278d9a){_0x291e8a[_0x9413('0x44')]=_0x278d9a;return _0x291e8a;});}})[_0x9413('0x23')](respondWithFilteredResult(_0x580d41,_0x5cae3c))[_0x9413('0x45')](handleError(_0x580d41,null));};exports['getHopperBlacks']=function(_0x2ddfd8,_0x3ab125,_0x462bc9){var _0x11e121={'raw':!![],'where':{}};var _0x22ed09={};var _0x5500c2={'count':0x0,'rows':[]};return db['Campaign'][_0x9413('0x60')]({'where':{'id':_0x2ddfd8[_0x9413('0x47')]['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x3ab125,null))[_0x9413('0x23')](function(_0x3199b0){if(_0x3199b0){_0x22ed09[_0x9413('0x34')]=_[_0x9413('0x31')](db[_0x9413('0x62')][_0x9413('0x2c')]);_0x22ed09[_0x9413('0x30')]=_[_0x9413('0x31')](_0x2ddfd8[_0x9413('0x30')]);_0x22ed09[_0x9413('0x32')]=_[_0x9413('0x33')](_0x22ed09[_0x9413('0x34')],_0x22ed09[_0x9413('0x30')]);_0x11e121[_0x9413('0x36')]=_['intersection'](_0x22ed09[_0x9413('0x34')],qs[_0x9413('0x35')](_0x2ddfd8[_0x9413('0x30')]['fields']));_0x11e121[_0x9413('0x36')]=_0x11e121[_0x9413('0x36')][_0x9413('0x37')]?_0x11e121['attributes']:_0x22ed09[_0x9413('0x34')];if(!_0x2ddfd8[_0x9413('0x30')]['hasOwnProperty']('nolimit')){_0x11e121[_0x9413('0x39')]=qs['limit'](_0x2ddfd8[_0x9413('0x30')][_0x9413('0x39')]);_0x11e121['offset']=qs[_0x9413('0x1b')](_0x2ddfd8[_0x9413('0x30')][_0x9413('0x1b')]);}_0x11e121[_0x9413('0x3a')]=qs[_0x9413('0x3b')](_0x2ddfd8['query'][_0x9413('0x3b')]);_0x11e121['where']=qs[_0x9413('0x32')](_[_0x9413('0x3d')](_0x2ddfd8[_0x9413('0x30')],_0x22ed09[_0x9413('0x32')]));_0x11e121[_0x9413('0x3c')][_0x9413('0x5b')]=_0x3199b0['id'];if(_0x2ddfd8[_0x9413('0x30')][_0x9413('0x3e')]){_0x11e121['where']=_['merge'](_0x11e121[_0x9413('0x3c')],{'$or':_[_0x9413('0x2b')](_0x11e121[_0x9413('0x36')],function(_0x4fd7e6){var _0x29627e={};_0x29627e[_0x4fd7e6]={'$like':'%'+_0x2ddfd8['query'][_0x9413('0x3e')]+'%'};return _0x29627e;})});}_0x11e121=_[_0x9413('0x3f')]({},_0x11e121,_0x2ddfd8[_0x9413('0x41')]);return db[_0x9413('0x62')][_0x9413('0x42')]({'where':_0x11e121['where']})[_0x9413('0x23')](function(_0x21c68c){_0x5500c2[_0x9413('0x42')]=_0x21c68c;if(_0x2ddfd8['query']['includeAll']){_0x11e121[_0x9413('0x49')]=[{'all':!![]}];}return db[_0x9413('0x62')][_0x9413('0x5e')](_0x11e121);})[_0x9413('0x23')](function(_0x25a130){_0x5500c2['rows']=_0x25a130;return _0x5500c2;});}})[_0x9413('0x23')](respondWithFilteredResult(_0x3ab125,_0x11e121))[_0x9413('0x45')](handleError(_0x3ab125,null));};exports[_0x9413('0x63')]=function(_0x23540f,_0x66162e,_0x4faf3b){var _0x22a02c={};var _0x393800={};var _0x2a1702;var _0x1e5463;return db['Campaign'][_0x9413('0x60')]({'where':{'id':_0x23540f[_0x9413('0x47')]['id']}})['then'](handleEntityNotFound(_0x66162e,null))['then'](function(_0xab6295){if(_0xab6295){_0x2a1702=_0xab6295;_0x393800[_0x9413('0x34')]=_[_0x9413('0x31')](db['CmList'][_0x9413('0x2c')]);_0x393800[_0x9413('0x30')]=_['keys'](_0x23540f[_0x9413('0x30')]);_0x393800['filters']=_[_0x9413('0x33')](_0x393800[_0x9413('0x34')],_0x393800[_0x9413('0x30')]);_0x22a02c[_0x9413('0x36')]=_['intersection'](_0x393800[_0x9413('0x34')],qs[_0x9413('0x35')](_0x23540f[_0x9413('0x30')][_0x9413('0x35')]));_0x22a02c[_0x9413('0x36')]=_0x22a02c[_0x9413('0x36')]['length']?_0x22a02c[_0x9413('0x36')]:_0x393800[_0x9413('0x34')];_0x22a02c[_0x9413('0x3a')]=qs[_0x9413('0x3b')](_0x23540f[_0x9413('0x30')][_0x9413('0x3b')]);_0x22a02c[_0x9413('0x3c')]=qs['filters'](_[_0x9413('0x3d')](_0x23540f[_0x9413('0x30')],_0x393800['filters']));if(_0x23540f['query'][_0x9413('0x3e')]){_0x22a02c['where']=_[_0x9413('0x3f')](_0x22a02c[_0x9413('0x3c')],{'$or':_[_0x9413('0x2b')](_0x22a02c[_0x9413('0x36')],function(_0x4d35e2){var _0x548f8c={};_0x548f8c[_0x4d35e2]={'$like':'%'+_0x23540f[_0x9413('0x30')][_0x9413('0x3e')]+'%'};return _0x548f8c;})});}_0x22a02c=_['merge']({},_0x22a02c,_0x23540f['options']);return _0x2a1702[_0x9413('0x63')](_0x22a02c);}})[_0x9413('0x23')](function(_0x594ca9){if(_0x594ca9){_0x1e5463=_0x594ca9[_0x9413('0x37')];if(!_0x23540f['query'][_0x9413('0x5d')](_0x9413('0x38'))){_0x22a02c['limit']=qs[_0x9413('0x39')](_0x23540f['query'][_0x9413('0x39')]);_0x22a02c[_0x9413('0x1b')]=qs['offset'](_0x23540f[_0x9413('0x30')][_0x9413('0x1b')]);}return _0x2a1702[_0x9413('0x63')](_0x22a02c);}})['then'](function(_0x5e6f43){if(_0x5e6f43){return _0x5e6f43?{'count':_0x1e5463,'rows':_0x5e6f43}:null;}})[_0x9413('0x23')](respondWithResult(_0x66162e,null))[_0x9413('0x45')](handleError(_0x66162e,null));};exports[_0x9413('0x64')]=function(_0x2aa33c,_0x25a442,_0x5d4b25){var _0x2ccde3,_0x21bdb4;return db[_0x9413('0x43')][_0x9413('0x4a')]({'where':{'id':_0x2aa33c['params']['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x25a442,null))[_0x9413('0x23')](function(_0x276bc8){if(_0x276bc8){_0x21bdb4=_0x276bc8;return _0x276bc8[_0x9413('0x64')](_0x2aa33c[_0x9413('0x4c')][_0x9413('0x65')],_[_0x9413('0x56')](_0x2aa33c[_0x9413('0x4c')],['ids','id'])||{});}return null;})[_0x9413('0x66')](function(_0x22c0b7){var _0x5ba131;_0x2ccde3=_0x22c0b7||[];var _0x5be357=[];if(_0x22c0b7){for(var _0x3e9772=0x0;_0x3e9772<_0x22c0b7[_0x9413('0x37')];_0x3e9772+=0x1){var _0x2d5b65=_0x22c0b7[_0x3e9772][_0x9413('0x4e')]({'plain':!![]});_0x21bdb4[_0x9413('0x67')]=_0x2aa33c[_0x9413('0x4c')][_0x9413('0x67')]?_0x2aa33c[_0x9413('0x4c')]['dialCheckDuplicateType']:_0x21bdb4[_0x9413('0x67')];switch(_0x21bdb4[_0x9413('0x67')]){case _0x9413('0x68'):_0x5ba131=squel[_0x9413('0x69')]()[_0x9413('0x6a')]('cm_hopper')[_0x9413('0x6b')]([_0x9413('0x6c'),_0x9413('0x6d'),_0x9413('0x6e'),_0x9413('0x6f'),_0x9413('0x5b'),_0x9413('0x57'),_0x9413('0x58')],squel['select']()[_0x9413('0x70')](_0x9413('0x6c'),_0x9413('0x6c'))[_0x9413('0x70')]('NOW()',_0x9413('0x6d'))[_0x9413('0x70')]('id',_0x9413('0x6e'))[_0x9413('0x70')](_0x2d5b65['CmListId']['toString'](),_0x9413('0x6f'))['field'](_0x2aa33c[_0x9413('0x47')]['id'][_0x9413('0x71')](),_0x9413('0x5b'))[_0x9413('0x70')](_0x9413('0x72'),'createdAt')[_0x9413('0x70')](_0x9413('0x72'),_0x9413('0x58'))[_0x9413('0x73')](_0x9413('0x74'))[_0x9413('0x3c')](_0x9413('0x75'))[_0x9413('0x3c')]('ListId\x20=\x20?',_0x2d5b65[_0x9413('0x76')][_0x9413('0x71')]())['where'](_0x9413('0x77'))[_0x9413('0x3c')](_0x9413('0x78'),squel[_0x9413('0x79')]()['field'](_0x9413('0x7a'))[_0x9413('0x73')](_0x9413('0x7b'))[_0x9413('0x3c')]('CampaignId\x20=\x20?',_0x2aa33c[_0x9413('0x47')]['id'][_0x9413('0x71')]()))[_0x9413('0x3c')](_0x9413('0x78'),squel[_0x9413('0x79')]()['field']('COALESCE(phone,\x27\x27)')[_0x9413('0x73')](_0x9413('0x7c'))['where'](_0x9413('0x7d'),_0x2aa33c['params']['id'][_0x9413('0x71')]())))['toString']();break;case _0x9413('0x7e'):_0x5ba131=squel[_0x9413('0x69')]()[_0x9413('0x6a')](_0x9413('0x7c'))[_0x9413('0x6b')](['phone','scheduledAt',_0x9413('0x6e'),_0x9413('0x6f'),_0x9413('0x5b'),_0x9413('0x57'),_0x9413('0x58')],squel[_0x9413('0x79')]()[_0x9413('0x70')](_0x9413('0x6c'),_0x9413('0x6c'))['field'](_0x9413('0x72'),_0x9413('0x6d'))[_0x9413('0x70')]('id',_0x9413('0x6e'))['field'](_0x2d5b65[_0x9413('0x76')]['toString'](),_0x9413('0x6f'))[_0x9413('0x70')](_0x2aa33c['params']['id'][_0x9413('0x71')](),_0x9413('0x5b'))[_0x9413('0x70')]('NOW()',_0x9413('0x57'))['field'](_0x9413('0x72'),'updatedAt')[_0x9413('0x73')]('cm_contacts')[_0x9413('0x3c')](_0x9413('0x75'))[_0x9413('0x3c')]('ListId\x20=\x20?',_0x2d5b65['CmListId'][_0x9413('0x71')]())[_0x9413('0x3c')](_0x9413('0x77'))[_0x9413('0x3c')](_0x9413('0x78'),squel[_0x9413('0x79')]()[_0x9413('0x70')](_0x9413('0x7f'))[_0x9413('0x73')](_0x9413('0x7c'))[_0x9413('0x3c')]('CampaignId\x20=\x20?',_0x2aa33c['params']['id'][_0x9413('0x71')]())))['toString']();break;default:_0x5ba131=squel[_0x9413('0x69')]()['into'](_0x9413('0x7c'))[_0x9413('0x6b')]([_0x9413('0x6c'),_0x9413('0x6d'),_0x9413('0x6e'),_0x9413('0x6f'),_0x9413('0x5b'),_0x9413('0x57'),'updatedAt'],squel[_0x9413('0x79')]()[_0x9413('0x70')](_0x9413('0x6c'),_0x9413('0x6c'))['field'](_0x9413('0x72'),'scheduledAt')[_0x9413('0x70')]('id',_0x9413('0x6e'))['field'](_0x2d5b65[_0x9413('0x76')][_0x9413('0x71')](),_0x9413('0x6f'))[_0x9413('0x70')](_0x2aa33c[_0x9413('0x47')]['id'][_0x9413('0x71')](),'CampaignId')['field']('NOW()',_0x9413('0x57'))[_0x9413('0x70')](_0x9413('0x72'),_0x9413('0x58'))['from'](_0x9413('0x74'))['where']('deletedAt\x20IS\x20NULL')[_0x9413('0x3c')](_0x9413('0x80'),_0x2d5b65[_0x9413('0x76')][_0x9413('0x71')]())[_0x9413('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x9413('0x71')]();}_0x5be357[_0x9413('0x81')](db[_0x9413('0x82')][_0x9413('0x30')](_0x5ba131));}return BPromise['all'](_0x5be357);}})[_0x9413('0x23')](function(){return _0x2ccde3;})[_0x9413('0x23')](respondWithResult(_0x25a442,null))[_0x9413('0x45')](handleError(_0x25a442,null));};exports[_0x9413('0x83')]=function(_0x16ae16,_0x4ab9cb,_0x5ab4d3){return db['Campaign'][_0x9413('0x4a')]({'where':{'id':_0x16ae16[_0x9413('0x47')]['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x4ab9cb,null))[_0x9413('0x23')](function(_0x172154){if(_0x172154){return _0x172154[_0x9413('0x83')](_0x16ae16['query'][_0x9413('0x65')]);}})[_0x9413('0x23')](function(_0x13b6bb){if(_0x13b6bb){return db[_0x9413('0x5a')][_0x9413('0x22')]({'where':{'ListId':_0x16ae16['query'][_0x9413('0x65')],'CampaignId':_0x16ae16['params']['id']}})[_0x9413('0x23')](function(){return _0x13b6bb;});}})[_0x9413('0x23')](respondWithStatusCode(_0x4ab9cb,null))['catch'](handleError(_0x4ab9cb,null));};exports[_0x9413('0x84')]=function(_0x28f6bf,_0x3252b6,_0x518f2d){var _0x372eda={'raw':!![],'where':{}};var _0x20d772={};var _0x5f4f67={'count':0x0,'rows':[]};return db[_0x9413('0x43')]['findOne']({'where':{'id':_0x28f6bf['params']['id']}})['then'](handleEntityNotFound(_0x3252b6,null))[_0x9413('0x23')](function(_0x240093){if(_0x240093){_0x20d772[_0x9413('0x34')]=_[_0x9413('0x31')](db[_0x9413('0x85')][_0x9413('0x2c')]);_0x20d772['query']=_[_0x9413('0x31')](_0x28f6bf[_0x9413('0x30')]);_0x20d772[_0x9413('0x32')]=_[_0x9413('0x33')](_0x20d772[_0x9413('0x34')],_0x20d772[_0x9413('0x30')]);_0x372eda[_0x9413('0x36')]=_[_0x9413('0x33')](_0x20d772[_0x9413('0x34')],qs[_0x9413('0x35')](_0x28f6bf[_0x9413('0x30')][_0x9413('0x35')]));_0x372eda['attributes']=_0x372eda[_0x9413('0x36')][_0x9413('0x37')]?_0x372eda[_0x9413('0x36')]:_0x20d772[_0x9413('0x34')];if(!_0x28f6bf[_0x9413('0x30')][_0x9413('0x5d')]('nolimit')){_0x372eda[_0x9413('0x39')]=qs['limit'](_0x28f6bf[_0x9413('0x30')][_0x9413('0x39')]);_0x372eda['offset']=qs[_0x9413('0x1b')](_0x28f6bf[_0x9413('0x30')][_0x9413('0x1b')]);}_0x372eda['order']=qs[_0x9413('0x3b')](_0x28f6bf[_0x9413('0x30')]['sort']);_0x372eda[_0x9413('0x3c')]=qs[_0x9413('0x32')](_[_0x9413('0x3d')](_0x28f6bf[_0x9413('0x30')],_0x20d772[_0x9413('0x32')]));_0x372eda[_0x9413('0x3c')][_0x9413('0x5b')]=_0x240093['id'];if(_0x28f6bf[_0x9413('0x30')][_0x9413('0x3e')]){_0x372eda[_0x9413('0x3c')]=_[_0x9413('0x3f')](_0x372eda[_0x9413('0x3c')],{'$or':_[_0x9413('0x2b')](_0x372eda[_0x9413('0x36')],function(_0x58ef02){var _0x581b90={};_0x581b90[_0x58ef02]={'$like':'%'+_0x28f6bf[_0x9413('0x30')][_0x9413('0x3e')]+'%'};return _0x581b90;})});}_0x372eda=_[_0x9413('0x3f')]({},_0x372eda,_0x28f6bf[_0x9413('0x41')]);return db[_0x9413('0x85')][_0x9413('0x42')]({'where':_0x372eda[_0x9413('0x3c')]})['then'](function(_0x2cddab){_0x5f4f67['count']=_0x2cddab;if(_0x28f6bf['query'][_0x9413('0x48')]){_0x372eda[_0x9413('0x49')]=[{'all':!![]}];}return db[_0x9413('0x85')]['findAll'](_0x372eda);})[_0x9413('0x23')](function(_0x3d70e5){_0x5f4f67['rows']=_0x3d70e5;return _0x5f4f67;});}})[_0x9413('0x23')](respondWithFilteredResult(_0x3252b6,_0x372eda))[_0x9413('0x45')](handleError(_0x3252b6,null));};exports['addBlackLists']=function(_0x148cb3,_0x40fa0a,_0x1d50bf){var _0x577d49,_0x1f231d;return db[_0x9413('0x43')][_0x9413('0x4a')]({'where':{'id':_0x148cb3[_0x9413('0x47')]['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x40fa0a,null))[_0x9413('0x23')](function(_0xbd2218){if(_0xbd2218){_0x1f231d=_0xbd2218;return _0xbd2218[_0x9413('0x86')](_0x148cb3[_0x9413('0x4c')][_0x9413('0x65')],_[_0x9413('0x56')](_0x148cb3[_0x9413('0x4c')],[_0x9413('0x65'),'id'])||{});}return null;})['spread'](function(_0x30f67c){var _0x273c54;_0x577d49=_0x30f67c||[];var _0x6c6f10=[];if(_0x30f67c){for(var _0x314b25=0x0;_0x314b25<_0x30f67c[_0x9413('0x37')];_0x314b25+=0x1){var _0x7a5a17=_0x30f67c[_0x314b25][_0x9413('0x4e')]({'plain':!![]});_0x273c54=squel[_0x9413('0x69')]()[_0x9413('0x6a')]('cm_hopper_black')['fromQuery']([_0x9413('0x6c'),'ContactId',_0x9413('0x6f'),_0x9413('0x5b'),_0x9413('0x57'),'updatedAt'],squel[_0x9413('0x79')]()[_0x9413('0x70')](_0x9413('0x6c'),_0x9413('0x6c'))['field']('id',_0x9413('0x6e'))[_0x9413('0x70')](_0x7a5a17['CmListId'][_0x9413('0x71')](),_0x9413('0x6f'))[_0x9413('0x70')](_0x148cb3['params']['id'][_0x9413('0x71')](),_0x9413('0x5b'))['field'](_0x9413('0x72'),_0x9413('0x57'))[_0x9413('0x70')](_0x9413('0x72'),'updatedAt')[_0x9413('0x73')]('cm_contacts')[_0x9413('0x3c')](_0x9413('0x75'))[_0x9413('0x3c')](_0x9413('0x80'),_0x7a5a17[_0x9413('0x76')][_0x9413('0x71')]())[_0x9413('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x9413('0x71')]();_0x6c6f10[_0x9413('0x81')](db[_0x9413('0x82')][_0x9413('0x30')](_0x273c54));}return BPromise['all'](_0x6c6f10);}})['then'](function(){return _0x577d49;})[_0x9413('0x23')](respondWithResult(_0x40fa0a,null))[_0x9413('0x45')](handleError(_0x40fa0a,null));};exports[_0x9413('0x87')]=function(_0x3003f0,_0x43f050,_0x12e7b3){return db['Campaign'][_0x9413('0x4a')]({'where':{'id':_0x3003f0[_0x9413('0x47')]['id']}})['then'](handleEntityNotFound(_0x43f050,null))[_0x9413('0x23')](function(_0x1c73db){if(_0x1c73db){return _0x1c73db[_0x9413('0x87')](_0x3003f0[_0x9413('0x30')][_0x9413('0x65')]);}})['then'](function(_0x20336c){if(_0x20336c){return db[_0x9413('0x62')]['destroy']({'where':{'ListId':_0x3003f0['query'][_0x9413('0x65')],'CampaignId':_0x3003f0[_0x9413('0x47')]['id']}})['then'](function(){return _0x20336c;});}})[_0x9413('0x23')](respondWithStatusCode(_0x43f050,null))[_0x9413('0x45')](handleError(_0x43f050,null));}; \ No newline at end of file +var _0x9279=['fieldName','type','key','model','name','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','limit','order','where','filters','filter','merge','count','include','findAll','catch','show','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','clone','params','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','sort','pick','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','push','sequelize','all','removeLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','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','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','send','index','map','Campaign','rawAttributes'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x9279,0x1f3));var _0x9927=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x9279[_0x2601b4];return _0x3e3661;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9927('0x0'));var zipdir=require(_0x9927('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9927('0x2'));var moment=require(_0x9927('0x3'));var BPromise=require(_0x9927('0x4'));var Mustache=require(_0x9927('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9927('0x6'));var csv=require(_0x9927('0x7'));var ejs=require(_0x9927('0x8'));var fs=require('fs');var _=require(_0x9927('0x9'));var squel=require(_0x9927('0xa'));var crypto=require(_0x9927('0xb'));var jsforce=require(_0x9927('0xc'));var deskjs=require(_0x9927('0xd'));var toCsv=require(_0x9927('0x7'));var querystring=require(_0x9927('0xe'));var Papa=require('papaparse');var Redis=require(_0x9927('0xf'));var authService=require(_0x9927('0x10'));var qs=require(_0x9927('0x11'));var as=require(_0x9927('0x12'));var hardwareService=require(_0x9927('0x13'));var logger=require(_0x9927('0x14'))(_0x9927('0x15'));var utils=require(_0x9927('0x16'));var config=require(_0x9927('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59b6ca,_0xc3c0fb){_0xc3c0fb=_0xc3c0fb||0xcc;return function(_0x14be31){if(_0x14be31){return _0x59b6ca[_0x9927('0x18')](_0xc3c0fb);}return _0x59b6ca[_0x9927('0x19')](_0xc3c0fb)[_0x9927('0x1a')]();};}function respondWithResult(_0x114a7d,_0x3b801a){_0x3b801a=_0x3b801a||0xc8;return function(_0x3a636b){if(_0x3a636b){return _0x114a7d['status'](_0x3b801a)[_0x9927('0x1b')](_0x3a636b);}};}function respondWithFilteredResult(_0x267bee,_0x4b42e2){return function(_0x554cf8){if(_0x554cf8){var _0x155815=_0x554cf8['count'],_0x21fd8a=_0x4b42e2[_0x9927('0x1c')],_0x4ef1a3=_0x4b42e2[_0x9927('0x1c')]+_0x4b42e2['limit'],_0x4ea8e1;if(_0x4ef1a3>=_0x155815){_0x4ef1a3=_0x155815;_0x4ea8e1=0xc8;}else{_0x4ea8e1=0xce;}_0x267bee['status'](_0x4ea8e1);return _0x267bee[_0x9927('0x1d')](_0x9927('0x1e'),_0x21fd8a+'-'+_0x4ef1a3+'/'+_0x155815)['json'](_0x554cf8);}return null;};}function patchUpdates(_0x2c8920){return function(_0x228e4b){try{jsonpatch['apply'](_0x228e4b,_0x2c8920,!![]);}catch(_0x4c1c20){return BPromise[_0x9927('0x1f')](_0x4c1c20);}return _0x228e4b[_0x9927('0x20')]();};}function saveUpdates(_0x2957eb,_0x523ca9){return function(_0x36d393){if(_0x36d393){return _0x36d393[_0x9927('0x21')](_0x2957eb)[_0x9927('0x22')](function(_0x449d4e){return _0x449d4e;});}return null;};}function removeEntity(_0xd3e57c,_0x26ce98){return function(_0x290e02){if(_0x290e02){return _0x290e02[_0x9927('0x23')]()[_0x9927('0x22')](function(){var _0x396ca6=_0x290e02[_0x9927('0x24')]({'plain':!![]});var _0x129316='IvrCampaigns';return db[_0x9927('0x25')][_0x9927('0x23')]({'where':{'type':_0x129316,'resourceId':_0x396ca6['id']}})[_0x9927('0x22')](function(){return _0x290e02;});})[_0x9927('0x22')](function(){_0xd3e57c[_0x9927('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x451b56,_0x39d210){return function(_0x5da278){if(!_0x5da278){_0x451b56[_0x9927('0x18')](0x194);}return _0x5da278;};}function handleError(_0x3a5a70,_0x3db2ef){_0x3db2ef=_0x3db2ef||0x1f4;return function(_0x548aa3){logger[_0x9927('0x26')](_0x548aa3[_0x9927('0x27')]);if(_0x548aa3['name']){delete _0x548aa3['name'];}_0x3a5a70[_0x9927('0x19')](_0x3db2ef)[_0x9927('0x28')](_0x548aa3);};}exports[_0x9927('0x29')]=function(_0x4f1533,_0x28e0c2){var _0x567a90={},_0x150493={},_0x163b0b={'count':0x0,'rows':[]};var _0x41a54a=_[_0x9927('0x2a')](db[_0x9927('0x2b')][_0x9927('0x2c')],function(_0x3acb61){return{'name':_0x3acb61[_0x9927('0x2d')],'type':_0x3acb61[_0x9927('0x2e')][_0x9927('0x2f')]};});_0x150493[_0x9927('0x30')]=_['map'](_0x41a54a,_0x9927('0x31'));_0x150493['query']=_[_0x9927('0x32')](_0x4f1533['query']);_0x150493['filters']=_[_0x9927('0x33')](_0x150493['model'],_0x150493['query']);_0x567a90[_0x9927('0x34')]=_[_0x9927('0x33')](_0x150493[_0x9927('0x30')],qs[_0x9927('0x35')](_0x4f1533[_0x9927('0x36')]['fields']));_0x567a90[_0x9927('0x34')]=_0x567a90['attributes'][_0x9927('0x37')]?_0x567a90[_0x9927('0x34')]:_0x150493[_0x9927('0x30')];if(!_0x4f1533['query'][_0x9927('0x38')](_0x9927('0x39'))){_0x567a90[_0x9927('0x3a')]=qs[_0x9927('0x3a')](_0x4f1533[_0x9927('0x36')][_0x9927('0x3a')]);_0x567a90[_0x9927('0x1c')]=qs[_0x9927('0x1c')](_0x4f1533[_0x9927('0x36')][_0x9927('0x1c')]);}_0x567a90[_0x9927('0x3b')]=qs['sort'](_0x4f1533[_0x9927('0x36')]['sort']);_0x567a90[_0x9927('0x3c')]=qs[_0x9927('0x3d')](_['pick'](_0x4f1533[_0x9927('0x36')],_0x150493[_0x9927('0x3d')]),_0x41a54a);if(_0x4f1533['query'][_0x9927('0x3e')]){_0x567a90[_0x9927('0x3c')]=_[_0x9927('0x3f')](_0x567a90[_0x9927('0x3c')],{'$or':_[_0x9927('0x2a')](_0x41a54a,function(_0x12ceb1){if(_0x12ceb1['type']!=='VIRTUAL'){var _0xf0bbee={};_0xf0bbee[_0x12ceb1['name']]={'$like':'%'+_0x4f1533[_0x9927('0x36')][_0x9927('0x3e')]+'%'};return _0xf0bbee;}})});}_0x567a90=_[_0x9927('0x3f')]({},_0x567a90,_0x4f1533['options']);var _0x591469={'where':_0x567a90['where']};return db[_0x9927('0x2b')][_0x9927('0x40')](_0x591469)['then'](function(_0x3a0846){_0x163b0b[_0x9927('0x40')]=_0x3a0846;if(_0x4f1533['query']['includeAll']){_0x567a90[_0x9927('0x41')]=[{'all':!![]}];}return db[_0x9927('0x2b')][_0x9927('0x42')](_0x567a90);})[_0x9927('0x22')](function(_0x36668a){_0x163b0b['rows']=_0x36668a;return _0x163b0b;})[_0x9927('0x22')](respondWithFilteredResult(_0x28e0c2,_0x567a90))[_0x9927('0x43')](handleError(_0x28e0c2,null));};exports[_0x9927('0x44')]=function(_0x57a893,_0x4c7f5f){var _0x296254={'raw':![],'where':{'id':_0x57a893['params']['id']}},_0x3d4ff6={};_0x3d4ff6[_0x9927('0x30')]=_[_0x9927('0x32')](db[_0x9927('0x2b')][_0x9927('0x2c')]);_0x3d4ff6['query']=_[_0x9927('0x32')](_0x57a893[_0x9927('0x36')]);_0x3d4ff6[_0x9927('0x3d')]=_[_0x9927('0x33')](_0x3d4ff6[_0x9927('0x30')],_0x3d4ff6[_0x9927('0x36')]);_0x296254['attributes']=_[_0x9927('0x33')](_0x3d4ff6[_0x9927('0x30')],qs[_0x9927('0x35')](_0x57a893[_0x9927('0x36')]['fields']));_0x296254[_0x9927('0x34')]=_0x296254[_0x9927('0x34')][_0x9927('0x37')]?_0x296254['attributes']:_0x3d4ff6['model'];if(_0x57a893[_0x9927('0x36')][_0x9927('0x45')]){_0x296254[_0x9927('0x41')]=[{'all':!![]}];}_0x296254=_[_0x9927('0x3f')]({},_0x296254,_0x57a893[_0x9927('0x46')]);return db[_0x9927('0x2b')][_0x9927('0x47')](_0x296254)[_0x9927('0x22')](handleEntityNotFound(_0x4c7f5f,null))[_0x9927('0x22')](respondWithResult(_0x4c7f5f,null))['catch'](handleError(_0x4c7f5f,null));};exports[_0x9927('0x48')]=function(_0x38906f,_0x3f75bd){return db[_0x9927('0x2b')][_0x9927('0x48')](_0x38906f[_0x9927('0x49')],{})[_0x9927('0x22')](function(_0x20b0ea){var _0x39f2cc=_0x38906f[_0x9927('0x4a')][_0x9927('0x24')]({'plain':!![]});if(!_0x39f2cc)throw new Error(_0x9927('0x4b'));if(_0x39f2cc[_0x9927('0x4c')]===_0x9927('0x4a')){var _0x378593=_0x20b0ea['get']({'plain':!![]});var _0x192f9a=_0x9927('0x4d');return db[_0x9927('0x4e')][_0x9927('0x47')]({'where':{'name':_0x192f9a,'userProfileId':_0x39f2cc[_0x9927('0x4f')]},'raw':!![]})[_0x9927('0x22')](function(_0x11035b){if(_0x11035b&&_0x11035b[_0x9927('0x50')]===0x0){return db['UserProfileResource'][_0x9927('0x48')]({'name':_0x378593[_0x9927('0x31')],'resourceId':_0x378593['id'],'type':_0x11035b[_0x9927('0x31')],'sectionId':_0x11035b['id']},{})[_0x9927('0x22')](function(){return _0x20b0ea;});}else{return _0x20b0ea;}})['catch'](function(_0x25eaf3){logger[_0x9927('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25eaf3);throw _0x25eaf3;});}return _0x20b0ea;})[_0x9927('0x22')](respondWithResult(_0x3f75bd,0xc9))[_0x9927('0x43')](handleError(_0x3f75bd,null));};exports[_0x9927('0x51')]=function(_0x31230b,_0x39f6df){var _0x49dfc4={'where':{'id':_0x31230b[_0x9927('0x52')]['id']}},_0x4a760d={};_0x4a760d[_0x9927('0x30')]=_[_0x9927('0x32')](db[_0x9927('0x2b')][_0x9927('0x2c')]);_0x49dfc4['attributes']=_[_0x9927('0x33')](_0x4a760d['model'],qs['fields'](_0x31230b['query'][_0x9927('0x35')]));_0x49dfc4[_0x9927('0x34')]=_0x49dfc4[_0x9927('0x34')]['length']?_0x49dfc4[_0x9927('0x34')]:_0x4a760d[_0x9927('0x30')];if(_0x31230b[_0x9927('0x36')][_0x9927('0x45')]){_0x49dfc4['include']=[{'all':!![]}];}_0x49dfc4=_[_0x9927('0x3f')]({},_0x49dfc4,_0x31230b[_0x9927('0x46')]);return db[_0x9927('0x2b')][_0x9927('0x47')](_0x49dfc4)['then'](handleEntityNotFound(_0x39f6df,null))['then'](function(_0x336f48){if(_0x336f48){var _0x2fa372=_0x336f48['get']({'plain':!![]});_0x2fa372=qs[_0x9927('0x53')](_0x2fa372,['id','createdAt',_0x9927('0x54')]);_0x31230b['body']=_[_0x9927('0x53')](_0x31230b['body'],['id',_0x9927('0x55'),_0x9927('0x54')]);return db[_0x9927('0x2b')][_0x9927('0x48')](_[_0x9927('0x3f')](_0x2fa372,_0x31230b['body']),{'include':_0x31230b[_0x9927('0x36')][_0x9927('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x29c97f){var _0x200fa2=_0x31230b[_0x9927('0x4a')][_0x9927('0x24')]({'plain':!![]});if(!_0x200fa2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x200fa2[_0x9927('0x4c')]===_0x9927('0x4a')){var _0x5bf7e7=_0x29c97f[_0x9927('0x24')]({'plain':!![]});var _0x9be662=_0x9927('0x4d');return db[_0x9927('0x4e')][_0x9927('0x47')]({'where':{'name':_0x9be662,'userProfileId':_0x200fa2['userProfileId']},'raw':!![]})['then'](function(_0x4dfac6){if(_0x4dfac6&&_0x4dfac6[_0x9927('0x50')]===0x0){return db[_0x9927('0x25')]['create']({'name':_0x5bf7e7['name'],'resourceId':_0x5bf7e7['id'],'type':_0x4dfac6[_0x9927('0x31')],'sectionId':_0x4dfac6['id']},{})['then'](function(){return _0x29c97f;});}else{return _0x29c97f;}})['catch'](function(_0x5eeeba){logger[_0x9927('0x26')](_0x9927('0x56'),_0x5eeeba);throw _0x5eeeba;});}return _0x29c97f;});}})['then'](respondWithResult(_0x39f6df,0xc9))[_0x9927('0x43')](handleError(_0x39f6df,null));};exports[_0x9927('0x21')]=function(_0xfe10e1,_0x2ebfcf){if(_0xfe10e1['body']['id']){delete _0xfe10e1[_0x9927('0x49')]['id'];}return db[_0x9927('0x2b')][_0x9927('0x47')]({'where':{'id':_0xfe10e1[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x2ebfcf,null))[_0x9927('0x22')](saveUpdates(_0xfe10e1[_0x9927('0x49')],null))[_0x9927('0x22')](respondWithResult(_0x2ebfcf,null))[_0x9927('0x43')](handleError(_0x2ebfcf,null));};exports['destroy']=function(_0x3cff2b,_0x436722){return db[_0x9927('0x2b')]['find']({'where':{'id':_0x3cff2b[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x436722,null))[_0x9927('0x22')](removeEntity(_0x436722,null))[_0x9927('0x43')](handleError(_0x436722,null));};exports[_0x9927('0x57')]=function(_0x4b2eff,_0x241357,_0x11be2d){var _0x4c68bf={'raw':!![],'where':{}};var _0x539f95={};var _0x386a61={'count':0x0,'rows':[]};return db[_0x9927('0x2b')][_0x9927('0x58')]({'where':{'id':_0x4b2eff[_0x9927('0x52')]['id']}})['then'](handleEntityNotFound(_0x241357,null))[_0x9927('0x22')](function(_0x1dc407){if(_0x1dc407){_0x539f95[_0x9927('0x30')]=_[_0x9927('0x32')](db[_0x9927('0x59')][_0x9927('0x2c')]);_0x539f95[_0x9927('0x36')]=_[_0x9927('0x32')](_0x4b2eff[_0x9927('0x36')]);_0x539f95['filters']=_['intersection'](_0x539f95[_0x9927('0x30')],_0x539f95['query']);_0x4c68bf['attributes']=_[_0x9927('0x33')](_0x539f95['model'],qs['fields'](_0x4b2eff[_0x9927('0x36')][_0x9927('0x35')]));_0x4c68bf[_0x9927('0x34')]=_0x4c68bf[_0x9927('0x34')]['length']?_0x4c68bf[_0x9927('0x34')]:_0x539f95[_0x9927('0x30')];if(!_0x4b2eff[_0x9927('0x36')][_0x9927('0x38')](_0x9927('0x39'))){_0x4c68bf[_0x9927('0x3a')]=qs['limit'](_0x4b2eff['query'][_0x9927('0x3a')]);_0x4c68bf['offset']=qs[_0x9927('0x1c')](_0x4b2eff[_0x9927('0x36')]['offset']);}_0x4c68bf[_0x9927('0x3b')]=qs[_0x9927('0x5a')](_0x4b2eff[_0x9927('0x36')][_0x9927('0x5a')]);_0x4c68bf['where']=qs[_0x9927('0x3d')](_[_0x9927('0x5b')](_0x4b2eff[_0x9927('0x36')],_0x539f95['filters']));_0x4c68bf[_0x9927('0x3c')][_0x9927('0x5c')]=_0x1dc407['id'];if(_0x4b2eff[_0x9927('0x36')][_0x9927('0x3e')]){_0x4c68bf[_0x9927('0x3c')]=_['merge'](_0x4c68bf[_0x9927('0x3c')],{'$or':_[_0x9927('0x2a')](_0x4c68bf[_0x9927('0x34')],function(_0x1840f5){var _0x5ac238={};_0x5ac238[_0x1840f5]={'$like':'%'+_0x4b2eff['query'][_0x9927('0x3e')]+'%'};return _0x5ac238;})});}_0x4c68bf=_[_0x9927('0x3f')]({},_0x4c68bf,_0x4b2eff[_0x9927('0x46')]);return db['CmHopper']['count']({'where':_0x4c68bf[_0x9927('0x3c')]})['then'](function(_0x44ad88){_0x386a61['count']=_0x44ad88;if(_0x4b2eff[_0x9927('0x36')][_0x9927('0x45')]){_0x4c68bf[_0x9927('0x41')]=[{'all':!![]}];}return db[_0x9927('0x59')][_0x9927('0x42')](_0x4c68bf);})[_0x9927('0x22')](function(_0x5cbf99){_0x386a61[_0x9927('0x5d')]=_0x5cbf99;return _0x386a61;});}})['then'](respondWithFilteredResult(_0x241357,_0x4c68bf))[_0x9927('0x43')](handleError(_0x241357,null));};exports[_0x9927('0x5e')]=function(_0x1b12d3,_0x101dde,_0x56959a){var _0x354fdc={'raw':!![],'where':{}};var _0x4c0ef0={};var _0x3725c4={'count':0x0,'rows':[]};return db[_0x9927('0x2b')][_0x9927('0x58')]({'where':{'id':_0x1b12d3[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x101dde,null))['then'](function(_0x420580){if(_0x420580){_0x4c0ef0['model']=_['keys'](db['CmHopperHistory'][_0x9927('0x2c')]);_0x4c0ef0[_0x9927('0x36')]=_[_0x9927('0x32')](_0x1b12d3[_0x9927('0x36')]);_0x4c0ef0['filters']=_[_0x9927('0x33')](_0x4c0ef0[_0x9927('0x30')],_0x4c0ef0[_0x9927('0x36')]);_0x354fdc[_0x9927('0x34')]=_['intersection'](_0x4c0ef0[_0x9927('0x30')],qs[_0x9927('0x35')](_0x1b12d3[_0x9927('0x36')][_0x9927('0x35')]));_0x354fdc['attributes']=_0x354fdc[_0x9927('0x34')][_0x9927('0x37')]?_0x354fdc[_0x9927('0x34')]:_0x4c0ef0[_0x9927('0x30')];if(!_0x1b12d3[_0x9927('0x36')][_0x9927('0x38')](_0x9927('0x39'))){_0x354fdc[_0x9927('0x3a')]=qs[_0x9927('0x3a')](_0x1b12d3[_0x9927('0x36')]['limit']);_0x354fdc[_0x9927('0x1c')]=qs[_0x9927('0x1c')](_0x1b12d3[_0x9927('0x36')][_0x9927('0x1c')]);}_0x354fdc[_0x9927('0x3b')]=qs[_0x9927('0x5a')](_0x1b12d3[_0x9927('0x36')][_0x9927('0x5a')]);_0x354fdc[_0x9927('0x3c')]=qs[_0x9927('0x3d')](_[_0x9927('0x5b')](_0x1b12d3[_0x9927('0x36')],_0x4c0ef0[_0x9927('0x3d')]));_0x354fdc[_0x9927('0x3c')][_0x9927('0x5c')]=_0x420580['id'];if(_0x1b12d3['query'][_0x9927('0x3e')]){_0x354fdc[_0x9927('0x3c')]=_[_0x9927('0x3f')](_0x354fdc['where'],{'$or':_[_0x9927('0x2a')](_0x354fdc[_0x9927('0x34')],function(_0x1e6635){var _0x1ebd85={};_0x1ebd85[_0x1e6635]={'$like':'%'+_0x1b12d3[_0x9927('0x36')][_0x9927('0x3e')]+'%'};return _0x1ebd85;})});}_0x354fdc=_[_0x9927('0x3f')]({},_0x354fdc,_0x1b12d3['options']);return db['CmHopperHistory']['count']({'where':_0x354fdc['where']})['then'](function(_0x3c27bb){_0x3725c4[_0x9927('0x40')]=_0x3c27bb;if(_0x1b12d3['query'][_0x9927('0x45')]){_0x354fdc[_0x9927('0x41')]=[{'all':!![]}];}return db[_0x9927('0x5f')][_0x9927('0x42')](_0x354fdc);})['then'](function(_0x1c27ce){_0x3725c4[_0x9927('0x5d')]=_0x1c27ce;return _0x3725c4;});}})[_0x9927('0x22')](respondWithFilteredResult(_0x101dde,_0x354fdc))['catch'](handleError(_0x101dde,null));};exports[_0x9927('0x60')]=function(_0x47f118,_0x5278ae,_0x3af814){var _0x4f4f59={'raw':!![],'where':{}};var _0x1084e4={};var _0x1a50c={'count':0x0,'rows':[]};return db[_0x9927('0x2b')][_0x9927('0x58')]({'where':{'id':_0x47f118[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x5278ae,null))['then'](function(_0x35bc26){if(_0x35bc26){_0x1084e4['model']=_[_0x9927('0x32')](db['CmHopperFinal'][_0x9927('0x2c')]);_0x1084e4[_0x9927('0x36')]=_[_0x9927('0x32')](_0x47f118[_0x9927('0x36')]);_0x1084e4['filters']=_[_0x9927('0x33')](_0x1084e4[_0x9927('0x30')],_0x1084e4[_0x9927('0x36')]);_0x4f4f59[_0x9927('0x34')]=_['intersection'](_0x1084e4[_0x9927('0x30')],qs['fields'](_0x47f118[_0x9927('0x36')]['fields']));_0x4f4f59[_0x9927('0x34')]=_0x4f4f59[_0x9927('0x34')][_0x9927('0x37')]?_0x4f4f59[_0x9927('0x34')]:_0x1084e4[_0x9927('0x30')];if(!_0x47f118['query'][_0x9927('0x38')](_0x9927('0x39'))){_0x4f4f59[_0x9927('0x3a')]=qs[_0x9927('0x3a')](_0x47f118[_0x9927('0x36')][_0x9927('0x3a')]);_0x4f4f59[_0x9927('0x1c')]=qs[_0x9927('0x1c')](_0x47f118['query'][_0x9927('0x1c')]);}_0x4f4f59[_0x9927('0x3b')]=qs['sort'](_0x47f118[_0x9927('0x36')]['sort']);_0x4f4f59[_0x9927('0x3c')]=qs['filters'](_[_0x9927('0x5b')](_0x47f118[_0x9927('0x36')],_0x1084e4['filters']));_0x4f4f59[_0x9927('0x3c')][_0x9927('0x5c')]=_0x35bc26['id'];if(_0x47f118[_0x9927('0x36')]['filter']){_0x4f4f59[_0x9927('0x3c')]=_['merge'](_0x4f4f59[_0x9927('0x3c')],{'$or':_[_0x9927('0x2a')](_0x4f4f59[_0x9927('0x34')],function(_0x1a1144){var _0x599eeb={};_0x599eeb[_0x1a1144]={'$like':'%'+_0x47f118[_0x9927('0x36')][_0x9927('0x3e')]+'%'};return _0x599eeb;})});}_0x4f4f59=_[_0x9927('0x3f')]({},_0x4f4f59,_0x47f118[_0x9927('0x46')]);return db[_0x9927('0x61')][_0x9927('0x40')]({'where':_0x4f4f59[_0x9927('0x3c')]})[_0x9927('0x22')](function(_0x13e70a){_0x1a50c[_0x9927('0x40')]=_0x13e70a;if(_0x47f118[_0x9927('0x36')][_0x9927('0x45')]){_0x4f4f59[_0x9927('0x41')]=[{'all':!![]}];}return db[_0x9927('0x61')][_0x9927('0x42')](_0x4f4f59);})[_0x9927('0x22')](function(_0x518fe7){_0x1a50c['rows']=_0x518fe7;return _0x1a50c;});}})['then'](respondWithFilteredResult(_0x5278ae,_0x4f4f59))[_0x9927('0x43')](handleError(_0x5278ae,null));};exports[_0x9927('0x62')]=function(_0x4ed7e5,_0x2b16eb,_0x1cc27){var _0x4149f2={'raw':!![],'where':{}};var _0xefffde={};var _0x32d360={'count':0x0,'rows':[]};return db[_0x9927('0x2b')][_0x9927('0x58')]({'where':{'id':_0x4ed7e5['params']['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x2b16eb,null))[_0x9927('0x22')](function(_0x89b5f5){if(_0x89b5f5){_0xefffde[_0x9927('0x30')]=_['keys'](db[_0x9927('0x63')][_0x9927('0x2c')]);_0xefffde['query']=_['keys'](_0x4ed7e5[_0x9927('0x36')]);_0xefffde[_0x9927('0x3d')]=_[_0x9927('0x33')](_0xefffde['model'],_0xefffde[_0x9927('0x36')]);_0x4149f2[_0x9927('0x34')]=_[_0x9927('0x33')](_0xefffde[_0x9927('0x30')],qs[_0x9927('0x35')](_0x4ed7e5[_0x9927('0x36')][_0x9927('0x35')]));_0x4149f2[_0x9927('0x34')]=_0x4149f2[_0x9927('0x34')][_0x9927('0x37')]?_0x4149f2[_0x9927('0x34')]:_0xefffde[_0x9927('0x30')];if(!_0x4ed7e5[_0x9927('0x36')][_0x9927('0x38')]('nolimit')){_0x4149f2[_0x9927('0x3a')]=qs[_0x9927('0x3a')](_0x4ed7e5[_0x9927('0x36')]['limit']);_0x4149f2['offset']=qs['offset'](_0x4ed7e5[_0x9927('0x36')][_0x9927('0x1c')]);}_0x4149f2['order']=qs['sort'](_0x4ed7e5[_0x9927('0x36')][_0x9927('0x5a')]);_0x4149f2[_0x9927('0x3c')]=qs[_0x9927('0x3d')](_[_0x9927('0x5b')](_0x4ed7e5[_0x9927('0x36')],_0xefffde[_0x9927('0x3d')]));_0x4149f2[_0x9927('0x3c')]['CampaignId']=_0x89b5f5['id'];if(_0x4ed7e5[_0x9927('0x36')]['filter']){_0x4149f2[_0x9927('0x3c')]=_[_0x9927('0x3f')](_0x4149f2[_0x9927('0x3c')],{'$or':_[_0x9927('0x2a')](_0x4149f2[_0x9927('0x34')],function(_0x431f8e){var _0x536895={};_0x536895[_0x431f8e]={'$like':'%'+_0x4ed7e5[_0x9927('0x36')]['filter']+'%'};return _0x536895;})});}_0x4149f2=_['merge']({},_0x4149f2,_0x4ed7e5[_0x9927('0x46')]);return db[_0x9927('0x63')]['count']({'where':_0x4149f2[_0x9927('0x3c')]})[_0x9927('0x22')](function(_0x3e79eb){_0x32d360[_0x9927('0x40')]=_0x3e79eb;if(_0x4ed7e5['query'][_0x9927('0x45')]){_0x4149f2[_0x9927('0x41')]=[{'all':!![]}];}return db[_0x9927('0x63')]['findAll'](_0x4149f2);})[_0x9927('0x22')](function(_0xb3f98){_0x32d360['rows']=_0xb3f98;return _0x32d360;});}})[_0x9927('0x22')](respondWithFilteredResult(_0x2b16eb,_0x4149f2))[_0x9927('0x43')](handleError(_0x2b16eb,null));};exports['getLists']=function(_0x1e9ba5,_0x15065e,_0x1deca6){var _0x53c16a={};var _0x52f37b={};var _0x48fa8b;var _0x51a924;return db[_0x9927('0x2b')]['findOne']({'where':{'id':_0x1e9ba5[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x15065e,null))[_0x9927('0x22')](function(_0x3361de){if(_0x3361de){_0x48fa8b=_0x3361de;_0x52f37b[_0x9927('0x30')]=_[_0x9927('0x32')](db[_0x9927('0x64')][_0x9927('0x2c')]);_0x52f37b[_0x9927('0x36')]=_['keys'](_0x1e9ba5[_0x9927('0x36')]);_0x52f37b['filters']=_[_0x9927('0x33')](_0x52f37b[_0x9927('0x30')],_0x52f37b['query']);_0x53c16a['attributes']=_[_0x9927('0x33')](_0x52f37b[_0x9927('0x30')],qs[_0x9927('0x35')](_0x1e9ba5[_0x9927('0x36')][_0x9927('0x35')]));_0x53c16a[_0x9927('0x34')]=_0x53c16a[_0x9927('0x34')][_0x9927('0x37')]?_0x53c16a[_0x9927('0x34')]:_0x52f37b[_0x9927('0x30')];_0x53c16a[_0x9927('0x3b')]=qs['sort'](_0x1e9ba5[_0x9927('0x36')][_0x9927('0x5a')]);_0x53c16a[_0x9927('0x3c')]=qs[_0x9927('0x3d')](_[_0x9927('0x5b')](_0x1e9ba5[_0x9927('0x36')],_0x52f37b['filters']));if(_0x1e9ba5['query'][_0x9927('0x3e')]){_0x53c16a[_0x9927('0x3c')]=_['merge'](_0x53c16a[_0x9927('0x3c')],{'$or':_['map'](_0x53c16a[_0x9927('0x34')],function(_0xffe09e){var _0x46c2dc={};_0x46c2dc[_0xffe09e]={'$like':'%'+_0x1e9ba5[_0x9927('0x36')]['filter']+'%'};return _0x46c2dc;})});}_0x53c16a=_[_0x9927('0x3f')]({},_0x53c16a,_0x1e9ba5[_0x9927('0x46')]);return _0x48fa8b[_0x9927('0x65')](_0x53c16a);}})[_0x9927('0x22')](function(_0x31c4e8){if(_0x31c4e8){_0x51a924=_0x31c4e8[_0x9927('0x37')];if(!_0x1e9ba5[_0x9927('0x36')]['hasOwnProperty'](_0x9927('0x39'))){_0x53c16a['limit']=qs[_0x9927('0x3a')](_0x1e9ba5[_0x9927('0x36')][_0x9927('0x3a')]);_0x53c16a['offset']=qs[_0x9927('0x1c')](_0x1e9ba5[_0x9927('0x36')][_0x9927('0x1c')]);}return _0x48fa8b[_0x9927('0x65')](_0x53c16a);}})[_0x9927('0x22')](function(_0x7871a8){if(_0x7871a8){return _0x7871a8?{'count':_0x51a924,'rows':_0x7871a8}:null;}})['then'](respondWithResult(_0x15065e,null))[_0x9927('0x43')](handleError(_0x15065e,null));};exports[_0x9927('0x66')]=function(_0x46db2e,_0xec684f,_0x27f457){var _0x358742,_0x249c17;return db[_0x9927('0x2b')][_0x9927('0x47')]({'where':{'id':_0x46db2e[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0xec684f,null))[_0x9927('0x22')](function(_0x198680){if(_0x198680){_0x249c17=_0x198680;return _0x198680[_0x9927('0x66')](_0x46db2e[_0x9927('0x49')][_0x9927('0x67')],_[_0x9927('0x53')](_0x46db2e[_0x9927('0x49')],['ids','id'])||{});}return null;})[_0x9927('0x68')](function(_0xad7f60){var _0xe7df12;_0x358742=_0xad7f60||[];var _0x4ccb9d=[];if(_0xad7f60){for(var _0xea8c3d=0x0;_0xea8c3d<_0xad7f60[_0x9927('0x37')];_0xea8c3d+=0x1){var _0xe7eec=_0xad7f60[_0xea8c3d][_0x9927('0x24')]({'plain':!![]});_0x249c17[_0x9927('0x69')]=_0x46db2e[_0x9927('0x49')][_0x9927('0x69')]?_0x46db2e['body'][_0x9927('0x69')]:_0x249c17[_0x9927('0x69')];switch(_0x249c17[_0x9927('0x69')]){case'always':_0xe7df12=squel[_0x9927('0x6a')]()[_0x9927('0x6b')]('cm_hopper')[_0x9927('0x6c')]([_0x9927('0x6d'),_0x9927('0x6e'),_0x9927('0x6f'),_0x9927('0x70'),_0x9927('0x5c'),_0x9927('0x55'),'updatedAt'],squel['select']()[_0x9927('0x71')]('phone','phone')['field']('NOW()',_0x9927('0x6e'))[_0x9927('0x71')]('id',_0x9927('0x6f'))['field'](_0xe7eec[_0x9927('0x72')]['toString'](),_0x9927('0x70'))['field'](_0x46db2e['params']['id'][_0x9927('0x73')](),'CampaignId')[_0x9927('0x71')]('NOW()','createdAt')['field'](_0x9927('0x74'),_0x9927('0x54'))[_0x9927('0x75')](_0x9927('0x76'))[_0x9927('0x3c')](_0x9927('0x77'))['where'](_0x9927('0x78'),_0xe7eec[_0x9927('0x72')]['toString']())[_0x9927('0x3c')](_0x9927('0x79'))[_0x9927('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x9927('0x71')](_0x9927('0x7a'))[_0x9927('0x75')](_0x9927('0x7b'))[_0x9927('0x3c')](_0x9927('0x7c'),_0x46db2e[_0x9927('0x52')]['id'][_0x9927('0x73')]()))['where'](_0x9927('0x7d'),squel[_0x9927('0x7e')]()[_0x9927('0x71')](_0x9927('0x7f'))[_0x9927('0x75')](_0x9927('0x80'))['where'](_0x9927('0x7c'),_0x46db2e[_0x9927('0x52')]['id'][_0x9927('0x73')]())))[_0x9927('0x73')]();break;case _0x9927('0x81'):_0xe7df12=squel[_0x9927('0x6a')]()['into'](_0x9927('0x80'))['fromQuery']([_0x9927('0x6d'),_0x9927('0x6e'),_0x9927('0x6f'),_0x9927('0x70'),_0x9927('0x5c'),_0x9927('0x55'),_0x9927('0x54')],squel['select']()[_0x9927('0x71')](_0x9927('0x6d'),'phone')[_0x9927('0x71')](_0x9927('0x74'),_0x9927('0x6e'))[_0x9927('0x71')]('id',_0x9927('0x6f'))[_0x9927('0x71')](_0xe7eec[_0x9927('0x72')][_0x9927('0x73')](),_0x9927('0x70'))['field'](_0x46db2e[_0x9927('0x52')]['id']['toString'](),_0x9927('0x5c'))['field'](_0x9927('0x74'),_0x9927('0x55'))['field'](_0x9927('0x74'),_0x9927('0x54'))['from'](_0x9927('0x76'))[_0x9927('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0x9927('0x78'),_0xe7eec['CmListId'][_0x9927('0x73')]())[_0x9927('0x3c')](_0x9927('0x79'))[_0x9927('0x3c')](_0x9927('0x7d'),squel[_0x9927('0x7e')]()['field'](_0x9927('0x7f'))[_0x9927('0x75')](_0x9927('0x80'))['where'](_0x9927('0x7c'),_0x46db2e[_0x9927('0x52')]['id'][_0x9927('0x73')]())))[_0x9927('0x73')]();break;default:_0xe7df12=squel[_0x9927('0x6a')]()[_0x9927('0x6b')](_0x9927('0x80'))[_0x9927('0x6c')]([_0x9927('0x6d'),_0x9927('0x6e'),_0x9927('0x6f'),_0x9927('0x70'),_0x9927('0x5c'),_0x9927('0x55'),'updatedAt'],squel[_0x9927('0x7e')]()['field'](_0x9927('0x6d'),'phone')[_0x9927('0x71')](_0x9927('0x74'),_0x9927('0x6e'))[_0x9927('0x71')]('id','ContactId')[_0x9927('0x71')](_0xe7eec[_0x9927('0x72')][_0x9927('0x73')](),'ListId')['field'](_0x46db2e[_0x9927('0x52')]['id'][_0x9927('0x73')](),_0x9927('0x5c'))[_0x9927('0x71')](_0x9927('0x74'),_0x9927('0x55'))[_0x9927('0x71')](_0x9927('0x74'),_0x9927('0x54'))['from']('cm_contacts')[_0x9927('0x3c')]('deletedAt\x20IS\x20NULL')[_0x9927('0x3c')](_0x9927('0x78'),_0xe7eec[_0x9927('0x72')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x9927('0x73')]();}_0x4ccb9d[_0x9927('0x82')](db[_0x9927('0x83')]['query'](_0xe7df12));}return BPromise[_0x9927('0x84')](_0x4ccb9d);}})[_0x9927('0x22')](function(){return _0x358742;})['then'](respondWithResult(_0xec684f,null))[_0x9927('0x43')](handleError(_0xec684f,null));};exports[_0x9927('0x85')]=function(_0x584892,_0x53b365,_0x24dedb){return db[_0x9927('0x2b')][_0x9927('0x47')]({'where':{'id':_0x584892['params']['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x53b365,null))[_0x9927('0x22')](function(_0x323e19){if(_0x323e19){return _0x323e19[_0x9927('0x85')](_0x584892[_0x9927('0x36')][_0x9927('0x67')]);}})[_0x9927('0x22')](function(_0x5f0724){if(_0x5f0724){return db[_0x9927('0x59')][_0x9927('0x23')]({'where':{'ListId':_0x584892[_0x9927('0x36')][_0x9927('0x67')],'CampaignId':_0x584892[_0x9927('0x52')]['id']}})[_0x9927('0x22')](function(){return _0x5f0724;});}})[_0x9927('0x22')](respondWithStatusCode(_0x53b365,null))[_0x9927('0x43')](handleError(_0x53b365,null));};exports['getBlackLists']=function(_0x572fc4,_0xd6c541,_0x31522c){var _0x252956={'raw':!![],'where':{}};var _0x2882c0={};var _0x509563={'count':0x0,'rows':[]};return db[_0x9927('0x2b')]['findOne']({'where':{'id':_0x572fc4[_0x9927('0x52')]['id']}})['then'](handleEntityNotFound(_0xd6c541,null))['then'](function(_0x4eb9c4){if(_0x4eb9c4){_0x2882c0['model']=_[_0x9927('0x32')](db[_0x9927('0x64')]['rawAttributes']);_0x2882c0['query']=_[_0x9927('0x32')](_0x572fc4['query']);_0x2882c0[_0x9927('0x3d')]=_['intersection'](_0x2882c0[_0x9927('0x30')],_0x2882c0[_0x9927('0x36')]);_0x252956[_0x9927('0x34')]=_[_0x9927('0x33')](_0x2882c0[_0x9927('0x30')],qs['fields'](_0x572fc4[_0x9927('0x36')][_0x9927('0x35')]));_0x252956[_0x9927('0x34')]=_0x252956['attributes']['length']?_0x252956[_0x9927('0x34')]:_0x2882c0[_0x9927('0x30')];if(!_0x572fc4[_0x9927('0x36')][_0x9927('0x38')](_0x9927('0x39'))){_0x252956[_0x9927('0x3a')]=qs[_0x9927('0x3a')](_0x572fc4[_0x9927('0x36')]['limit']);_0x252956['offset']=qs[_0x9927('0x1c')](_0x572fc4[_0x9927('0x36')]['offset']);}_0x252956[_0x9927('0x3b')]=qs[_0x9927('0x5a')](_0x572fc4['query'][_0x9927('0x5a')]);_0x252956[_0x9927('0x3c')]=qs[_0x9927('0x3d')](_['pick'](_0x572fc4[_0x9927('0x36')],_0x2882c0[_0x9927('0x3d')]));_0x252956[_0x9927('0x3c')][_0x9927('0x5c')]=_0x4eb9c4['id'];if(_0x572fc4[_0x9927('0x36')][_0x9927('0x3e')]){_0x252956[_0x9927('0x3c')]=_['merge'](_0x252956[_0x9927('0x3c')],{'$or':_[_0x9927('0x2a')](_0x252956['attributes'],function(_0x2c3b4b){var _0xa7c3ae={};_0xa7c3ae[_0x2c3b4b]={'$like':'%'+_0x572fc4[_0x9927('0x36')][_0x9927('0x3e')]+'%'};return _0xa7c3ae;})});}_0x252956=_[_0x9927('0x3f')]({},_0x252956,_0x572fc4[_0x9927('0x46')]);return db['CmList'][_0x9927('0x40')]({'where':_0x252956['where']})[_0x9927('0x22')](function(_0x2db054){_0x509563['count']=_0x2db054;if(_0x572fc4[_0x9927('0x36')][_0x9927('0x45')]){_0x252956[_0x9927('0x41')]=[{'all':!![]}];}return db[_0x9927('0x64')][_0x9927('0x42')](_0x252956);})['then'](function(_0x2d8a52){_0x509563[_0x9927('0x5d')]=_0x2d8a52;return _0x509563;});}})[_0x9927('0x22')](respondWithFilteredResult(_0xd6c541,_0x252956))[_0x9927('0x43')](handleError(_0xd6c541,null));};exports['addBlackLists']=function(_0x32853b,_0x3a5bb8,_0x51ad93){var _0x556440,_0x3967f7;return db[_0x9927('0x2b')][_0x9927('0x47')]({'where':{'id':_0x32853b[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x3a5bb8,null))[_0x9927('0x22')](function(_0x2e7ed5){if(_0x2e7ed5){_0x3967f7=_0x2e7ed5;return _0x2e7ed5['addBlackLists'](_0x32853b['body']['ids'],_[_0x9927('0x53')](_0x32853b[_0x9927('0x49')],[_0x9927('0x67'),'id'])||{});}return null;})[_0x9927('0x68')](function(_0x7245e1){var _0x4a8bec;_0x556440=_0x7245e1||[];var _0x4c9742=[];if(_0x7245e1){for(var _0x45b542=0x0;_0x45b542<_0x7245e1[_0x9927('0x37')];_0x45b542+=0x1){var _0x5c2325=_0x7245e1[_0x45b542][_0x9927('0x24')]({'plain':!![]});_0x4a8bec=squel[_0x9927('0x6a')]()[_0x9927('0x6b')](_0x9927('0x86'))[_0x9927('0x6c')]([_0x9927('0x6d'),_0x9927('0x6f'),'ListId',_0x9927('0x5c'),_0x9927('0x55'),_0x9927('0x54')],squel[_0x9927('0x7e')]()[_0x9927('0x71')](_0x9927('0x6d'),_0x9927('0x6d'))['field']('id',_0x9927('0x6f'))[_0x9927('0x71')](_0x5c2325[_0x9927('0x72')][_0x9927('0x73')](),_0x9927('0x70'))[_0x9927('0x71')](_0x32853b[_0x9927('0x52')]['id']['toString'](),_0x9927('0x5c'))[_0x9927('0x71')](_0x9927('0x74'),_0x9927('0x55'))[_0x9927('0x71')](_0x9927('0x74'),_0x9927('0x54'))[_0x9927('0x75')]('cm_contacts')[_0x9927('0x3c')](_0x9927('0x77'))['where']('ListId\x20=\x20?',_0x5c2325[_0x9927('0x72')]['toString']())['where'](_0x9927('0x79')))['toString']();_0x4c9742['push'](db[_0x9927('0x83')]['query'](_0x4a8bec));}return BPromise['all'](_0x4c9742);}})[_0x9927('0x22')](function(){return _0x556440;})[_0x9927('0x22')](respondWithResult(_0x3a5bb8,null))[_0x9927('0x43')](handleError(_0x3a5bb8,null));};exports[_0x9927('0x87')]=function(_0x3ab60b,_0x1b601c,_0x2c5b21){return db['Campaign'][_0x9927('0x47')]({'where':{'id':_0x3ab60b[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x1b601c,null))['then'](function(_0x2b1d7b){if(_0x2b1d7b){return _0x2b1d7b[_0x9927('0x87')](_0x3ab60b[_0x9927('0x36')]['ids']);}})[_0x9927('0x22')](function(_0x467a9a){if(_0x467a9a){return db[_0x9927('0x63')][_0x9927('0x23')]({'where':{'ListId':_0x3ab60b[_0x9927('0x36')][_0x9927('0x67')],'CampaignId':_0x3ab60b[_0x9927('0x52')]['id']}})[_0x9927('0x22')](function(){return _0x467a9a;});}})[_0x9927('0x22')](respondWithStatusCode(_0x1b601c,null))[_0x9927('0x43')](handleError(_0x1b601c,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 117e1d1..83289a5 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x301a2e,_0x4b809e){var _0x19b03b=function(_0x757c28){while(--_0x757c28){_0x301a2e['push'](_0x301a2e['shift']());}};_0x19b03b(++_0x4b809e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xb83688,_0x10bce4){var _0x2ffa2b=function(_0x10a21f){while(--_0x10a21f){_0xb83688['push'](_0xb83688['shift']());}};_0x2ffa2b(++_0x10bce4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index e67d274..20727dc 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(_0x4ad762,_0x3e7464){var _0x56f931=function(_0x1a6c40){while(--_0x1a6c40){_0x4ad762['push'](_0x4ad762['shift']());}};_0x56f931(++_0x3e7464);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x17cb67,_0x1c6143){var _0x6ad9f9=function(_0x197e6e){while(--_0x197e6e){_0x17cb67['push'](_0x17cb67['shift']());}};_0x6ad9f9(++_0x1c6143);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index eb626f5..1539852 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 _0xd97e=['show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','removeLists','delete','removeBlackLists','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id'];(function(_0x3c148f,_0x3eafcf){var _0x4d956a=function(_0x4a98b4){while(--_0x4a98b4){_0x3c148f['push'](_0x3c148f['shift']());}};_0x4d956a(++_0x3eafcf);}(_0xd97e,0x7a));var _0xed97=function(_0x3eddf9,_0x20fddd){_0x3eddf9=_0x3eddf9-0x0;var _0x21eb88=_0xd97e[_0x3eddf9];return _0x21eb88;};'use strict';var multer=require('multer');var util=require(_0xed97('0x0'));var path=require(_0xed97('0x1'));var timeout=require(_0xed97('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xed97('0x3'));var interaction=require(_0xed97('0x4'));var config=require('../../config/environment');var controller=require(_0xed97('0x5'));router[_0xed97('0x6')]('/',auth[_0xed97('0x7')](),controller[_0xed97('0x8')]);router[_0xed97('0x6')](_0xed97('0x9'),auth[_0xed97('0x7')](),controller[_0xed97('0xa')]);router[_0xed97('0x6')](_0xed97('0xb'),auth[_0xed97('0x7')](),controller['getHoppers']);router[_0xed97('0x6')](_0xed97('0xc'),auth[_0xed97('0x7')](),controller[_0xed97('0xd')]);router['get'](_0xed97('0xe'),auth['isAuthenticated'](),controller[_0xed97('0xf')]);router[_0xed97('0x6')](_0xed97('0x10'),auth[_0xed97('0x7')](),controller['getHopperBlacks']);router['get'](_0xed97('0x11'),auth[_0xed97('0x7')](),controller[_0xed97('0x12')]);router['get'](_0xed97('0x13'),auth['isAuthenticated'](),controller[_0xed97('0x14')]);router[_0xed97('0x15')]('/',auth['isAuthenticated'](),controller[_0xed97('0x16')]);router['post'](_0xed97('0x17'),auth[_0xed97('0x7')](),controller[_0xed97('0x18')]);router[_0xed97('0x15')](_0xed97('0x11'),auth[_0xed97('0x7')](),controller[_0xed97('0x19')]);router[_0xed97('0x15')]('/:id/blacklists',auth[_0xed97('0x7')](),controller[_0xed97('0x1a')]);router[_0xed97('0x1b')]('/:id',auth[_0xed97('0x7')](),controller[_0xed97('0x1c')]);router['delete'](_0xed97('0x9'),auth[_0xed97('0x7')](),controller['destroy']);router['delete'](_0xed97('0x11'),auth[_0xed97('0x7')](),controller[_0xed97('0x1d')]);router[_0xed97('0x1e')](_0xed97('0x13'),auth[_0xed97('0x7')](),controller[_0xed97('0x1f')]);module[_0xed97('0x20')]=router; \ No newline at end of file +var _0x6595=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','clone','/:id/blacklists','addBlackLists','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','/:id','isAuthenticated','/:id/hoppers','getHopperHistories'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x6595,0x198));var _0x5659=function(_0x1e9bae,_0x5dae36){_0x1e9bae=_0x1e9bae-0x0;var _0x923834=_0x6595[_0x1e9bae];return _0x923834;};'use strict';var multer=require(_0x5659('0x0'));var util=require(_0x5659('0x1'));var path=require('path');var timeout=require(_0x5659('0x2'));var express=require('express');var router=express[_0x5659('0x3')]();var auth=require(_0x5659('0x4'));var interaction=require(_0x5659('0x5'));var config=require('../../config/environment');var controller=require(_0x5659('0x6'));router[_0x5659('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5659('0x7')](_0x5659('0x8'),auth[_0x5659('0x9')](),controller['show']);router[_0x5659('0x7')](_0x5659('0xa'),auth[_0x5659('0x9')](),controller['getHoppers']);router[_0x5659('0x7')]('/:id/hopper_histories',auth[_0x5659('0x9')](),controller[_0x5659('0xb')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x5659('0xc')]);router[_0x5659('0x7')](_0x5659('0xd'),auth['isAuthenticated'](),controller[_0x5659('0xe')]);router[_0x5659('0x7')](_0x5659('0xf'),auth[_0x5659('0x9')](),controller[_0x5659('0x10')]);router[_0x5659('0x7')]('/:id/blacklists',auth[_0x5659('0x9')](),controller[_0x5659('0x11')]);router['post']('/',auth[_0x5659('0x9')](),controller[_0x5659('0x12')]);router[_0x5659('0x13')](_0x5659('0x14'),auth['isAuthenticated'](),controller[_0x5659('0x15')]);router[_0x5659('0x13')]('/:id/lists',auth[_0x5659('0x9')](),controller['addLists']);router[_0x5659('0x13')](_0x5659('0x16'),auth['isAuthenticated'](),controller[_0x5659('0x17')]);router['put'](_0x5659('0x8'),auth['isAuthenticated'](),controller[_0x5659('0x18')]);router[_0x5659('0x19')](_0x5659('0x8'),auth[_0x5659('0x9')](),controller[_0x5659('0x1a')]);router['delete'](_0x5659('0xf'),auth[_0x5659('0x9')](),controller[_0x5659('0x1b')]);router[_0x5659('0x19')](_0x5659('0x16'),auth['isAuthenticated'](),controller[_0x5659('0x1c')]);module[_0x5659('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 6f481a2..bb45e0d 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 _0x4d13=['VIRTUAL','key','sequelize','STRING','TEXT'];(function(_0x40ff64,_0x25b8d9){var _0x4780dd=function(_0x1a0589){while(--_0x1a0589){_0x40ff64['push'](_0x40ff64['shift']());}};_0x4780dd(++_0x25b8d9);}(_0x4d13,0x84));var _0x34d1=function(_0x21a832,_0x5cad7d){_0x21a832=_0x21a832-0x0;var _0x1b7e26=_0x4d13[_0x21a832];return _0x1b7e26;};'use strict';var Sequelize=require(_0x34d1('0x0'));module['exports']={'key':{'type':Sequelize[_0x34d1('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x34d1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x34d1('0x1')]},'name':{'type':Sequelize[_0x34d1('0x3')],'get':function(){return this['getDataValue'](_0x34d1('0x4'));}}}; \ No newline at end of file +var _0x8eac=['exports','STRING','TEXT','VIRTUAL'];(function(_0x43b22b,_0xea722c){var _0xd4e124=function(_0x271814){while(--_0x271814){_0x43b22b['push'](_0x43b22b['shift']());}};_0xd4e124(++_0xea722c);}(_0x8eac,0x1bc));var _0xc8ea=function(_0x326c48,_0x31eee6){_0x326c48=_0x326c48-0x0;var _0xf71bc5=_0x8eac[_0x326c48];return _0xf71bc5;};'use strict';var Sequelize=require('sequelize');module[_0xc8ea('0x0')]={'key':{'type':Sequelize[_0xc8ea('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xc8ea('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc8ea('0x1')]},'name':{'type':Sequelize[_0xc8ea('0x3')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index cf1b5bd..d7e6479 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 _0x5658=['options','includeAll','include','findAll','rows','catch','show','params','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','index','CannedAnswer','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL'];(function(_0x5cc37e,_0x7fffe1){var _0x5612c3=function(_0x19c9ff){while(--_0x19c9ff){_0x5cc37e['push'](_0x5cc37e['shift']());}};_0x5612c3(++_0x7fffe1);}(_0x5658,0x170));var _0x8565=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5658[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require(_0x8565('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8565('0x1'));var zipdir=require(_0x8565('0x2'));var jsonpatch=require(_0x8565('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8565('0x4'));var Mustache=require('mustache');var util=require(_0x8565('0x5'));var path=require('path');var sox=require(_0x8565('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8565('0x7'));var squel=require(_0x8565('0x8'));var crypto=require(_0x8565('0x9'));var jsforce=require(_0x8565('0xa'));var deskjs=require(_0x8565('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8565('0xc'));var Papa=require(_0x8565('0xd'));var Redis=require(_0x8565('0xe'));var authService=require(_0x8565('0xf'));var qs=require(_0x8565('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8565('0x11'))('api');var utils=require(_0x8565('0x12'));var config=require(_0x8565('0x13'));var db=require(_0x8565('0x14'))['db'];function respondWithStatusCode(_0x1e0987,_0x2f0356){_0x2f0356=_0x2f0356||0xcc;return function(_0xcd5635){if(_0xcd5635){return _0x1e0987['sendStatus'](_0x2f0356);}return _0x1e0987[_0x8565('0x15')](_0x2f0356)[_0x8565('0x16')]();};}function respondWithResult(_0x29e595,_0x4aa6bb){_0x4aa6bb=_0x4aa6bb||0xc8;return function(_0x483bd3){if(_0x483bd3){return _0x29e595[_0x8565('0x15')](_0x4aa6bb)[_0x8565('0x17')](_0x483bd3);}};}function respondWithFilteredResult(_0x4f835f,_0x35cba7){return function(_0x2d0bae){if(_0x2d0bae){var _0x4eeea3=_0x2d0bae[_0x8565('0x18')],_0x586e7f=_0x35cba7[_0x8565('0x19')],_0x2c9ea6=_0x35cba7[_0x8565('0x19')]+_0x35cba7[_0x8565('0x1a')],_0x5d8861;if(_0x2c9ea6>=_0x4eeea3){_0x2c9ea6=_0x4eeea3;_0x5d8861=0xc8;}else{_0x5d8861=0xce;}_0x4f835f[_0x8565('0x15')](_0x5d8861);return _0x4f835f[_0x8565('0x1b')](_0x8565('0x1c'),_0x586e7f+'-'+_0x2c9ea6+'/'+_0x4eeea3)['json'](_0x2d0bae);}return null;};}function patchUpdates(_0x5b2fa4){return function(_0x2c3eab){try{jsonpatch[_0x8565('0x1d')](_0x2c3eab,_0x5b2fa4,!![]);}catch(_0x1fa5fd){return BPromise[_0x8565('0x1e')](_0x1fa5fd);}return _0x2c3eab['save']();};}function saveUpdates(_0x302243,_0x4919a3){return function(_0x4b2dda){if(_0x4b2dda){return _0x4b2dda[_0x8565('0x1f')](_0x302243)[_0x8565('0x20')](function(_0xa114df){return _0xa114df;});}return null;};}function removeEntity(_0x539948,_0x4aca70){return function(_0x19a909){if(_0x19a909){return _0x19a909[_0x8565('0x21')]()['then'](function(){var _0x97d292=_0x19a909[_0x8565('0x22')]({'plain':!![]});var _0x1c39f0='CannedAnswers';return db[_0x8565('0x23')][_0x8565('0x21')]({'where':{'type':_0x1c39f0,'resourceId':_0x97d292['id']}})[_0x8565('0x20')](function(){return _0x19a909;});})[_0x8565('0x20')](function(){_0x539948['status'](0xcc)[_0x8565('0x16')]();});}};}function handleEntityNotFound(_0x7ddc9d,_0x3981e6){return function(_0x152c13){if(!_0x152c13){_0x7ddc9d['sendStatus'](0x194);}return _0x152c13;};}function handleError(_0xce6690,_0x34a5cf){_0x34a5cf=_0x34a5cf||0x1f4;return function(_0x20decb){logger[_0x8565('0x24')](_0x20decb[_0x8565('0x25')]);if(_0x20decb['name']){delete _0x20decb['name'];}_0xce6690[_0x8565('0x15')](_0x34a5cf)['send'](_0x20decb);};}exports[_0x8565('0x26')]=function(_0x5aaadb,_0xf4555c){var _0x1aa011={},_0x3d8913={},_0x2b03af={'count':0x0,'rows':[]};var _0xea5e9b=_['map'](db[_0x8565('0x27')][_0x8565('0x28')],function(_0x43d2ca){return{'name':_0x43d2ca[_0x8565('0x29')],'type':_0x43d2ca[_0x8565('0x2a')][_0x8565('0x2b')]};});_0x3d8913[_0x8565('0x2c')]=_['map'](_0xea5e9b,_0x8565('0x2d'));_0x3d8913[_0x8565('0x2e')]=_[_0x8565('0x2f')](_0x5aaadb[_0x8565('0x2e')]);_0x3d8913[_0x8565('0x30')]=_[_0x8565('0x31')](_0x3d8913['model'],_0x3d8913[_0x8565('0x2e')]);_0x1aa011[_0x8565('0x32')]=_[_0x8565('0x31')](_0x3d8913[_0x8565('0x2c')],qs[_0x8565('0x33')](_0x5aaadb[_0x8565('0x2e')][_0x8565('0x33')]));_0x1aa011[_0x8565('0x32')]=_0x1aa011[_0x8565('0x32')][_0x8565('0x34')]?_0x1aa011['attributes']:_0x3d8913[_0x8565('0x2c')];if(!_0x5aaadb[_0x8565('0x2e')][_0x8565('0x35')](_0x8565('0x36'))){_0x1aa011[_0x8565('0x1a')]=qs[_0x8565('0x1a')](_0x5aaadb['query'][_0x8565('0x1a')]);_0x1aa011[_0x8565('0x19')]=qs['offset'](_0x5aaadb[_0x8565('0x2e')][_0x8565('0x19')]);}_0x1aa011['order']=qs[_0x8565('0x37')](_0x5aaadb[_0x8565('0x2e')][_0x8565('0x37')]);_0x1aa011[_0x8565('0x38')]=qs[_0x8565('0x30')](_[_0x8565('0x39')](_0x5aaadb[_0x8565('0x2e')],_0x3d8913[_0x8565('0x30')]),_0xea5e9b);if(_0x5aaadb[_0x8565('0x2e')][_0x8565('0x3a')]){_0x1aa011[_0x8565('0x38')]=_[_0x8565('0x3b')](_0x1aa011[_0x8565('0x38')],{'$or':_[_0x8565('0x3c')](_0xea5e9b,function(_0xf8341d){if(_0xf8341d[_0x8565('0x2a')]!==_0x8565('0x3d')){var _0x243adb={};_0x243adb[_0xf8341d[_0x8565('0x2d')]]={'$like':'%'+_0x5aaadb['query'][_0x8565('0x3a')]+'%'};return _0x243adb;}})});}_0x1aa011=_['merge']({},_0x1aa011,_0x5aaadb[_0x8565('0x3e')]);var _0x3d29cd={'where':_0x1aa011[_0x8565('0x38')]};return db[_0x8565('0x27')][_0x8565('0x18')](_0x3d29cd)[_0x8565('0x20')](function(_0x28bfce){_0x2b03af[_0x8565('0x18')]=_0x28bfce;if(_0x5aaadb[_0x8565('0x2e')][_0x8565('0x3f')]){_0x1aa011[_0x8565('0x40')]=[{'all':!![]}];}return db[_0x8565('0x27')][_0x8565('0x41')](_0x1aa011);})[_0x8565('0x20')](function(_0x146b70){_0x2b03af[_0x8565('0x42')]=_0x146b70;return _0x2b03af;})[_0x8565('0x20')](respondWithFilteredResult(_0xf4555c,_0x1aa011))[_0x8565('0x43')](handleError(_0xf4555c,null));};exports[_0x8565('0x44')]=function(_0xc5754c,_0xe6d487){var _0x24f48d={'raw':!![],'where':{'id':_0xc5754c[_0x8565('0x45')]['id']}},_0x27b8d1={};_0x27b8d1['model']=_['keys'](db[_0x8565('0x27')][_0x8565('0x28')]);_0x27b8d1['query']=_['keys'](_0xc5754c['query']);_0x27b8d1[_0x8565('0x30')]=_[_0x8565('0x31')](_0x27b8d1[_0x8565('0x2c')],_0x27b8d1[_0x8565('0x2e')]);_0x24f48d[_0x8565('0x32')]=_[_0x8565('0x31')](_0x27b8d1[_0x8565('0x2c')],qs[_0x8565('0x33')](_0xc5754c['query'][_0x8565('0x33')]));_0x24f48d[_0x8565('0x32')]=_0x24f48d['attributes'][_0x8565('0x34')]?_0x24f48d[_0x8565('0x32')]:_0x27b8d1['model'];if(_0xc5754c[_0x8565('0x2e')][_0x8565('0x3f')]){_0x24f48d[_0x8565('0x40')]=[{'all':!![]}];}_0x24f48d=_[_0x8565('0x3b')]({},_0x24f48d,_0xc5754c['options']);return db[_0x8565('0x27')][_0x8565('0x46')](_0x24f48d)[_0x8565('0x20')](handleEntityNotFound(_0xe6d487,null))[_0x8565('0x20')](respondWithResult(_0xe6d487,null))[_0x8565('0x43')](handleError(_0xe6d487,null));};exports[_0x8565('0x1f')]=function(_0x2de6ed,_0xaa28d8){if(_0x2de6ed[_0x8565('0x47')]['id']){delete _0x2de6ed['body']['id'];}return db[_0x8565('0x27')][_0x8565('0x46')]({'where':{'id':_0x2de6ed[_0x8565('0x45')]['id']}})[_0x8565('0x20')](handleEntityNotFound(_0xaa28d8,null))['then'](saveUpdates(_0x2de6ed[_0x8565('0x47')],null))[_0x8565('0x20')](respondWithResult(_0xaa28d8,null))[_0x8565('0x43')](handleError(_0xaa28d8,null));};exports['destroy']=function(_0x2b78be,_0x5484af){return db[_0x8565('0x27')]['find']({'where':{'id':_0x2b78be[_0x8565('0x45')]['id']}})[_0x8565('0x20')](handleEntityNotFound(_0x5484af,null))[_0x8565('0x20')](removeEntity(_0x5484af,null))[_0x8565('0x43')](handleError(_0x5484af,null));};exports['create']=function(_0x44bdcc,_0x1e4503){var _0x3577de={'key':_0x44bdcc['body'][_0x8565('0x2b')]};if(_0x44bdcc[_0x8565('0x47')]['MailAccountId']){_0x3577de[_0x8565('0x48')]=_0x44bdcc[_0x8565('0x47')][_0x8565('0x48')];}else if(_0x44bdcc[_0x8565('0x47')][_0x8565('0x49')]){_0x3577de[_0x8565('0x49')]=_0x44bdcc[_0x8565('0x47')][_0x8565('0x49')];}else if(_0x44bdcc[_0x8565('0x47')][_0x8565('0x4a')]){_0x3577de[_0x8565('0x4a')]=_0x44bdcc[_0x8565('0x47')][_0x8565('0x4a')];}else if(_0x44bdcc[_0x8565('0x47')][_0x8565('0x4b')]){_0x3577de['ChatWebsiteId']=_0x44bdcc['body'][_0x8565('0x4b')];}return db[_0x8565('0x27')][_0x8565('0x46')]({'where':_0x3577de})['then'](function(_0x34821a){if(_0x34821a){throw new db['Sequelize'][(_0x8565('0x4c'))](_0x8565('0x4d'));}return db[_0x8565('0x27')][_0x8565('0x4e')](_0x44bdcc[_0x8565('0x47')]);})[_0x8565('0x20')](function(_0xe44ea1){var _0x5e2677=_0x44bdcc[_0x8565('0x4f')][_0x8565('0x22')]({'plain':!![]});if(!_0x5e2677)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e2677[_0x8565('0x50')]==='user'){var _0xd7c457=_0xe44ea1[_0x8565('0x22')]({'plain':!![]});return db[_0x8565('0x51')][_0x8565('0x46')]({'where':{'name':_0x8565('0x52'),'userProfileId':_0x5e2677[_0x8565('0x53')]},'raw':!![]})[_0x8565('0x20')](function(_0x3f33f0){if(_0x3f33f0&&_0x3f33f0[_0x8565('0x54')]===0x0){return db[_0x8565('0x23')]['create']({'name':_0xd7c457[_0x8565('0x2d')],'resourceId':_0xd7c457['id'],'type':_0x3f33f0[_0x8565('0x2d')],'sectionId':_0x3f33f0['id']},{})[_0x8565('0x20')](function(){return _0xe44ea1;});}else{return _0xe44ea1;}})[_0x8565('0x43')](function(_0x3c2d79){logger[_0x8565('0x24')](_0x8565('0x55'),_0x3c2d79);throw _0x3c2d79;});}return _0xe44ea1;})['then'](respondWithResult(_0x1e4503,0xc9))[_0x8565('0x43')](handleError(_0x1e4503,null));}; \ No newline at end of file +var _0xea2e=['../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0xea2e,0x19f));var _0xeea2=function(_0xe55531,_0x53ea94){_0xe55531=_0xe55531-0x0;var _0x289834=_0xea2e[_0xe55531];return _0x289834;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeea2('0x0'));var rimraf=require(_0xeea2('0x1'));var zipdir=require(_0xeea2('0x2'));var jsonpatch=require(_0xeea2('0x3'));var rp=require(_0xeea2('0x4'));var moment=require('moment');var BPromise=require(_0xeea2('0x5'));var Mustache=require(_0xeea2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeea2('0x7'));var fs=require('fs');var _=require(_0xeea2('0x8'));var squel=require('squel');var crypto=require(_0xeea2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xeea2('0xa'));var toCsv=require('to-csv');var querystring=require(_0xeea2('0xb'));var Papa=require(_0xeea2('0xc'));var Redis=require(_0xeea2('0xd'));var authService=require(_0xeea2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xeea2('0xf'));var hardwareService=require(_0xeea2('0x10'));var logger=require('../../config/logger')(_0xeea2('0x11'));var utils=require(_0xeea2('0x12'));var config=require(_0xeea2('0x13'));var db=require(_0xeea2('0x14'))['db'];function respondWithStatusCode(_0x5b5667,_0x4d2fca){_0x4d2fca=_0x4d2fca||0xcc;return function(_0x271263){if(_0x271263){return _0x5b5667[_0xeea2('0x15')](_0x4d2fca);}return _0x5b5667[_0xeea2('0x16')](_0x4d2fca)['end']();};}function respondWithResult(_0x547968,_0x470ffc){_0x470ffc=_0x470ffc||0xc8;return function(_0x9e7f0c){if(_0x9e7f0c){return _0x547968['status'](_0x470ffc)[_0xeea2('0x17')](_0x9e7f0c);}};}function respondWithFilteredResult(_0x13d2b7,_0x1a8bab){return function(_0x5f4ef3){if(_0x5f4ef3){var _0x2e3467=_0x5f4ef3[_0xeea2('0x18')],_0x23972a=_0x1a8bab[_0xeea2('0x19')],_0x514d67=_0x1a8bab[_0xeea2('0x19')]+_0x1a8bab[_0xeea2('0x1a')],_0x2d8bc5;if(_0x514d67>=_0x2e3467){_0x514d67=_0x2e3467;_0x2d8bc5=0xc8;}else{_0x2d8bc5=0xce;}_0x13d2b7[_0xeea2('0x16')](_0x2d8bc5);return _0x13d2b7[_0xeea2('0x1b')](_0xeea2('0x1c'),_0x23972a+'-'+_0x514d67+'/'+_0x2e3467)[_0xeea2('0x17')](_0x5f4ef3);}return null;};}function patchUpdates(_0x5aa96c){return function(_0x596399){try{jsonpatch[_0xeea2('0x1d')](_0x596399,_0x5aa96c,!![]);}catch(_0x598ad6){return BPromise['reject'](_0x598ad6);}return _0x596399[_0xeea2('0x1e')]();};}function saveUpdates(_0x320fa8,_0x19fbbb){return function(_0x27622b){if(_0x27622b){return _0x27622b[_0xeea2('0x1f')](_0x320fa8)[_0xeea2('0x20')](function(_0x11e63e){return _0x11e63e;});}return null;};}function removeEntity(_0x2d9482,_0x13ba7d){return function(_0x122d8b){if(_0x122d8b){return _0x122d8b[_0xeea2('0x21')]()['then'](function(){var _0x151e6d=_0x122d8b[_0xeea2('0x22')]({'plain':!![]});var _0x479e23=_0xeea2('0x23');return db[_0xeea2('0x24')][_0xeea2('0x21')]({'where':{'type':_0x479e23,'resourceId':_0x151e6d['id']}})[_0xeea2('0x20')](function(){return _0x122d8b;});})[_0xeea2('0x20')](function(){_0x2d9482[_0xeea2('0x16')](0xcc)[_0xeea2('0x25')]();});}};}function handleEntityNotFound(_0x153602,_0x190331){return function(_0x123f96){if(!_0x123f96){_0x153602[_0xeea2('0x15')](0x194);}return _0x123f96;};}function handleError(_0x3dddbd,_0x546b4f){_0x546b4f=_0x546b4f||0x1f4;return function(_0x534cc2){logger[_0xeea2('0x26')](_0x534cc2['stack']);if(_0x534cc2[_0xeea2('0x27')]){delete _0x534cc2[_0xeea2('0x27')];}_0x3dddbd[_0xeea2('0x16')](_0x546b4f)[_0xeea2('0x28')](_0x534cc2);};}exports[_0xeea2('0x29')]=function(_0x3aa541,_0x176f27){var _0x110568={},_0x2d182d={},_0x522d07={'count':0x0,'rows':[]};var _0x50eda5=_['map'](db[_0xeea2('0x2a')][_0xeea2('0x2b')],function(_0x29d7c9){return{'name':_0x29d7c9[_0xeea2('0x2c')],'type':_0x29d7c9[_0xeea2('0x2d')][_0xeea2('0x2e')]};});_0x2d182d[_0xeea2('0x2f')]=_[_0xeea2('0x30')](_0x50eda5,'name');_0x2d182d[_0xeea2('0x31')]=_[_0xeea2('0x32')](_0x3aa541[_0xeea2('0x31')]);_0x2d182d[_0xeea2('0x33')]=_['intersection'](_0x2d182d[_0xeea2('0x2f')],_0x2d182d['query']);_0x110568[_0xeea2('0x34')]=_[_0xeea2('0x35')](_0x2d182d[_0xeea2('0x2f')],qs[_0xeea2('0x36')](_0x3aa541[_0xeea2('0x31')][_0xeea2('0x36')]));_0x110568['attributes']=_0x110568[_0xeea2('0x34')][_0xeea2('0x37')]?_0x110568['attributes']:_0x2d182d[_0xeea2('0x2f')];if(!_0x3aa541['query'][_0xeea2('0x38')](_0xeea2('0x39'))){_0x110568[_0xeea2('0x1a')]=qs['limit'](_0x3aa541[_0xeea2('0x31')][_0xeea2('0x1a')]);_0x110568[_0xeea2('0x19')]=qs[_0xeea2('0x19')](_0x3aa541[_0xeea2('0x31')][_0xeea2('0x19')]);}_0x110568[_0xeea2('0x3a')]=qs['sort'](_0x3aa541['query'][_0xeea2('0x3b')]);_0x110568[_0xeea2('0x3c')]=qs['filters'](_[_0xeea2('0x3d')](_0x3aa541[_0xeea2('0x31')],_0x2d182d[_0xeea2('0x33')]),_0x50eda5);if(_0x3aa541[_0xeea2('0x31')][_0xeea2('0x3e')]){_0x110568[_0xeea2('0x3c')]=_[_0xeea2('0x3f')](_0x110568[_0xeea2('0x3c')],{'$or':_['map'](_0x50eda5,function(_0x2bdbac){if(_0x2bdbac['type']!==_0xeea2('0x40')){var _0x81a7e3={};_0x81a7e3[_0x2bdbac[_0xeea2('0x27')]]={'$like':'%'+_0x3aa541[_0xeea2('0x31')]['filter']+'%'};return _0x81a7e3;}})});}_0x110568=_['merge']({},_0x110568,_0x3aa541[_0xeea2('0x41')]);var _0x5d0a31={'where':_0x110568['where']};return db[_0xeea2('0x2a')][_0xeea2('0x18')](_0x5d0a31)[_0xeea2('0x20')](function(_0x460008){_0x522d07['count']=_0x460008;if(_0x3aa541[_0xeea2('0x31')][_0xeea2('0x42')]){_0x110568[_0xeea2('0x43')]=[{'all':!![]}];}return db[_0xeea2('0x2a')][_0xeea2('0x44')](_0x110568);})['then'](function(_0x30a246){_0x522d07[_0xeea2('0x45')]=_0x30a246;return _0x522d07;})[_0xeea2('0x20')](respondWithFilteredResult(_0x176f27,_0x110568))[_0xeea2('0x46')](handleError(_0x176f27,null));};exports[_0xeea2('0x47')]=function(_0x311d90,_0x85eec2){var _0x15e782={'raw':!![],'where':{'id':_0x311d90[_0xeea2('0x48')]['id']}},_0x2881a6={};_0x2881a6[_0xeea2('0x2f')]=_[_0xeea2('0x32')](db[_0xeea2('0x2a')][_0xeea2('0x2b')]);_0x2881a6[_0xeea2('0x31')]=_[_0xeea2('0x32')](_0x311d90[_0xeea2('0x31')]);_0x2881a6[_0xeea2('0x33')]=_['intersection'](_0x2881a6[_0xeea2('0x2f')],_0x2881a6['query']);_0x15e782[_0xeea2('0x34')]=_[_0xeea2('0x35')](_0x2881a6['model'],qs[_0xeea2('0x36')](_0x311d90[_0xeea2('0x31')][_0xeea2('0x36')]));_0x15e782[_0xeea2('0x34')]=_0x15e782[_0xeea2('0x34')][_0xeea2('0x37')]?_0x15e782['attributes']:_0x2881a6['model'];if(_0x311d90[_0xeea2('0x31')][_0xeea2('0x42')]){_0x15e782[_0xeea2('0x43')]=[{'all':!![]}];}_0x15e782=_[_0xeea2('0x3f')]({},_0x15e782,_0x311d90[_0xeea2('0x41')]);return db[_0xeea2('0x2a')]['find'](_0x15e782)[_0xeea2('0x20')](handleEntityNotFound(_0x85eec2,null))['then'](respondWithResult(_0x85eec2,null))[_0xeea2('0x46')](handleError(_0x85eec2,null));};exports[_0xeea2('0x1f')]=function(_0x46fc0e,_0x45d2bc){if(_0x46fc0e['body']['id']){delete _0x46fc0e[_0xeea2('0x49')]['id'];}return db[_0xeea2('0x2a')][_0xeea2('0x4a')]({'where':{'id':_0x46fc0e[_0xeea2('0x48')]['id']}})['then'](handleEntityNotFound(_0x45d2bc,null))[_0xeea2('0x20')](saveUpdates(_0x46fc0e[_0xeea2('0x49')],null))[_0xeea2('0x20')](respondWithResult(_0x45d2bc,null))[_0xeea2('0x46')](handleError(_0x45d2bc,null));};exports[_0xeea2('0x21')]=function(_0x2aace5,_0x2c650b){return db[_0xeea2('0x2a')][_0xeea2('0x4a')]({'where':{'id':_0x2aace5[_0xeea2('0x48')]['id']}})[_0xeea2('0x20')](handleEntityNotFound(_0x2c650b,null))['then'](removeEntity(_0x2c650b,null))[_0xeea2('0x46')](handleError(_0x2c650b,null));};exports[_0xeea2('0x4b')]=function(_0x17dc61,_0xdc8ff){var _0x201952={'key':_0x17dc61['body'][_0xeea2('0x2e')]};if(_0x17dc61[_0xeea2('0x49')]['MailAccountId']){_0x201952[_0xeea2('0x4c')]=_0x17dc61[_0xeea2('0x49')][_0xeea2('0x4c')];}else if(_0x17dc61['body'][_0xeea2('0x4d')]){_0x201952[_0xeea2('0x4d')]=_0x17dc61[_0xeea2('0x49')]['SmsAccountId'];}else if(_0x17dc61[_0xeea2('0x49')][_0xeea2('0x4e')]){_0x201952[_0xeea2('0x4e')]=_0x17dc61[_0xeea2('0x49')][_0xeea2('0x4e')];}else if(_0x17dc61[_0xeea2('0x49')][_0xeea2('0x4f')]){_0x201952[_0xeea2('0x4f')]=_0x17dc61['body'][_0xeea2('0x4f')];}return db[_0xeea2('0x2a')][_0xeea2('0x4a')]({'where':_0x201952})[_0xeea2('0x20')](function(_0x149a23){if(_0x149a23){throw new db[(_0xeea2('0x50'))][(_0xeea2('0x51'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xeea2('0x4b')](_0x17dc61[_0xeea2('0x49')]);})[_0xeea2('0x20')](function(_0x5e461c){var _0xb091c9=_0x17dc61[_0xeea2('0x52')][_0xeea2('0x22')]({'plain':!![]});if(!_0xb091c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb091c9['role']===_0xeea2('0x52')){var _0x2bdd47=_0x5e461c[_0xeea2('0x22')]({'plain':!![]});return db[_0xeea2('0x53')]['find']({'where':{'name':_0xeea2('0x23'),'userProfileId':_0xb091c9[_0xeea2('0x54')]},'raw':!![]})[_0xeea2('0x20')](function(_0x5ad334){if(_0x5ad334&&_0x5ad334[_0xeea2('0x55')]===0x0){return db[_0xeea2('0x24')][_0xeea2('0x4b')]({'name':_0x2bdd47[_0xeea2('0x27')],'resourceId':_0x2bdd47['id'],'type':_0x5ad334['name'],'sectionId':_0x5ad334['id']},{})[_0xeea2('0x20')](function(){return _0x5e461c;});}else{return _0x5e461c;}})['catch'](function(_0x3db394){logger['error'](_0xeea2('0x56'),_0x3db394);throw _0x3db394;});}return _0x5e461c;})[_0xeea2('0x20')](respondWithResult(_0xdc8ff,0xc9))[_0xeea2('0x46')](handleError(_0xdc8ff,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 687633a..4e1659c 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 _0x4ab0=['moment','bluebird','rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x422e64,_0x4c9309){var _0x43eb46=function(_0x5cf8c2){while(--_0x5cf8c2){_0x422e64['push'](_0x422e64['shift']());}};_0x43eb46(++_0x4c9309);}(_0x4ab0,0xd5));var _0x04ab=function(_0x5da91b,_0x19efa4){_0x5da91b=_0x5da91b-0x0;var _0x2e2453=_0x4ab0[_0x5da91b];return _0x2e2453;};'use strict';var _=require('lodash');var util=require(_0x04ab('0x0'));var logger=require(_0x04ab('0x1'))(_0x04ab('0x2'));var moment=require(_0x04ab('0x3'));var BPromise=require(_0x04ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x04ab('0x5'));var config=require(_0x04ab('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x04ab('0x7')]=function(_0x2c5730,_0x4edd2e){return _0x2c5730[_0x04ab('0x8')](_0x04ab('0x9'),attributes,{'tableName':_0x04ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x04ab('0xb')});}; \ No newline at end of file +var _0x5ed2=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers'];(function(_0x11889a,_0x3c7152){var _0x4165d2=function(_0xcf4f1a){while(--_0xcf4f1a){_0x11889a['push'](_0x11889a['shift']());}};_0x4165d2(++_0x3c7152);}(_0x5ed2,0x114));var _0x25ed=function(_0x45862f,_0xf5f0a6){_0x45862f=_0x45862f-0x0;var _0x35b20b=_0x5ed2[_0x45862f];return _0x35b20b;};'use strict';var _=require(_0x25ed('0x0'));var util=require('util');var logger=require(_0x25ed('0x1'))(_0x25ed('0x2'));var moment=require('moment');var BPromise=require(_0x25ed('0x3'));var rp=require(_0x25ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25ed('0x5'));var config=require(_0x25ed('0x6'));var attributes=require(_0x25ed('0x7'));module[_0x25ed('0x8')]=function(_0x509ca3,_0x3650fd){return _0x509ca3[_0x25ed('0x9')](_0x25ed('0xa'),attributes,{'tableName':_0x25ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 6640589..d0099dc 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 _0xe641=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CannedAnswer,\x20%s,\x20%s','catch','lodash','util','moment'];(function(_0x11ccf2,_0xe2c798){var _0x3254ac=function(_0x2921e0){while(--_0x2921e0){_0x11ccf2['push'](_0x11ccf2['shift']());}};_0x3254ac(++_0xe2c798);}(_0xe641,0x1e0));var _0x1e64=function(_0x440396,_0xf8c490){_0x440396=_0x440396-0x0;var _0x221ae4=_0xe641[_0x440396];return _0x221ae4;};'use strict';var _=require(_0x1e64('0x0'));var util=require(_0x1e64('0x1'));var moment=require(_0x1e64('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e64('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e64('0x4'));var logger=require(_0x1e64('0x5'))(_0x1e64('0x6'));var config=require(_0x1e64('0x7'));var jayson=require(_0x1e64('0x8'));var client=jayson[_0x1e64('0x9')][_0x1e64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29cc45,_0x316cfa,_0x5ac3ad){return new BPromise(function(_0x162fd4,_0x51cd27){return client[_0x1e64('0xb')](_0x29cc45,_0x5ac3ad)[_0x1e64('0xc')](function(_0x287652){logger[_0x1e64('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x316cfa,'request\x20sent');logger[_0x1e64('0xe')](_0x1e64('0xf'),_0x316cfa,_0x1e64('0x10'),JSON[_0x1e64('0x11')](_0x287652));if(_0x287652[_0x1e64('0x12')]){if(_0x287652[_0x1e64('0x12')][_0x1e64('0x13')]===0x1f4){logger[_0x1e64('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x316cfa,_0x287652[_0x1e64('0x12')]['message']);return _0x51cd27(_0x287652['error'][_0x1e64('0x14')]);}logger[_0x1e64('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x316cfa,_0x287652[_0x1e64('0x12')][_0x1e64('0x14')]);return _0x162fd4(_0x287652[_0x1e64('0x12')][_0x1e64('0x14')]);}else{logger[_0x1e64('0xd')](_0x1e64('0x15'),_0x316cfa,'request\x20sent');_0x162fd4(_0x287652['result'][_0x1e64('0x14')]);}})[_0x1e64('0x16')](function(_0x240d26){logger['error'](_0x1e64('0x15'),_0x316cfa,_0x240d26);_0x51cd27(_0x240d26);});});} \ No newline at end of file +var _0x7464=['debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0x7464,0x9d));var _0x4746=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7464[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4746('0x0'));var util=require(_0x4746('0x1'));var moment=require(_0x4746('0x2'));var BPromise=require(_0x4746('0x3'));var rs=require(_0x4746('0x4'));var fs=require('fs');var Redis=require(_0x4746('0x5'));var db=require(_0x4746('0x6'))['db'];var utils=require(_0x4746('0x7'));var logger=require(_0x4746('0x8'))(_0x4746('0x9'));var config=require(_0x4746('0xa'));var jayson=require(_0x4746('0xb'));var client=jayson[_0x4746('0xc')][_0x4746('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4cbde5,_0x3826f2,_0x5dfd98){return new BPromise(function(_0x47db25,_0x240f65){return client['request'](_0x4cbde5,_0x5dfd98)[_0x4746('0xe')](function(_0x5d1e74){logger[_0x4746('0xf')](_0x4746('0x10'),_0x3826f2,_0x4746('0x11'));logger[_0x4746('0x12')](_0x4746('0x13'),_0x3826f2,_0x4746('0x11'),JSON[_0x4746('0x14')](_0x5d1e74));if(_0x5d1e74[_0x4746('0x15')]){if(_0x5d1e74[_0x4746('0x15')][_0x4746('0x16')]===0x1f4){logger[_0x4746('0x15')]('CannedAnswer,\x20%s,\x20%s',_0x3826f2,_0x5d1e74['error'][_0x4746('0x17')]);return _0x240f65(_0x5d1e74['error'][_0x4746('0x17')]);}logger[_0x4746('0x15')](_0x4746('0x10'),_0x3826f2,_0x5d1e74[_0x4746('0x15')][_0x4746('0x17')]);return _0x47db25(_0x5d1e74[_0x4746('0x15')][_0x4746('0x17')]);}else{logger[_0x4746('0xf')](_0x4746('0x10'),_0x3826f2,_0x4746('0x11'));_0x47db25(_0x5d1e74[_0x4746('0x18')][_0x4746('0x17')]);}})['catch'](function(_0xe67c10){logger[_0x4746('0x15')](_0x4746('0x10'),_0x3826f2,_0xe67c10);_0x240f65(_0xe67c10);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 145a2e1..03fb931 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 _0xe972=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x47c229,_0x59aadf){var _0xbd3f9e=function(_0x597320){while(--_0x597320){_0x47c229['push'](_0x47c229['shift']());}};_0xbd3f9e(++_0x59aadf);}(_0xe972,0x123));var _0x2e97=function(_0x10e643,_0x3a4b46){_0x10e643=_0x10e643-0x0;var _0x1ab865=_0xe972[_0x10e643];return _0x1ab865;};'use strict';var multer=require(_0x2e97('0x0'));var util=require(_0x2e97('0x1'));var path=require(_0x2e97('0x2'));var timeout=require('connect-timeout');var express=require(_0x2e97('0x3'));var router=express[_0x2e97('0x4')]();var auth=require(_0x2e97('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2e97('0x6'));var controller=require(_0x2e97('0x7'));router[_0x2e97('0x8')]('/',auth[_0x2e97('0x9')](),controller[_0x2e97('0xa')]);router[_0x2e97('0x8')](_0x2e97('0xb'),auth[_0x2e97('0x9')](),controller[_0x2e97('0xc')]);router['post']('/',auth[_0x2e97('0x9')](),controller[_0x2e97('0xd')]);router[_0x2e97('0xe')](_0x2e97('0xb'),auth[_0x2e97('0x9')](),controller['update']);router['delete'](_0x2e97('0xb'),auth[_0x2e97('0x9')](),controller[_0x2e97('0xf')]);module[_0x2e97('0x10')]=router; \ No newline at end of file +var _0x936b=['path','connect-timeout','Router','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','create','update','delete','exports','multer'];(function(_0x146d44,_0x45d093){var _0x4ba452=function(_0x1fae62){while(--_0x1fae62){_0x146d44['push'](_0x146d44['shift']());}};_0x4ba452(++_0x45d093);}(_0x936b,0x179));var _0xb936=function(_0x165fb2,_0x21bb4a){_0x165fb2=_0x165fb2-0x0;var _0x11a1b0=_0x936b[_0x165fb2];return _0x11a1b0;};'use strict';var multer=require(_0xb936('0x0'));var util=require('util');var path=require(_0xb936('0x1'));var timeout=require(_0xb936('0x2'));var express=require('express');var router=express[_0xb936('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb936('0x4'));router[_0xb936('0x5')]('/',auth[_0xb936('0x6')](),controller[_0xb936('0x7')]);router['get'](_0xb936('0x8'),auth[_0xb936('0x6')](),controller[_0xb936('0x9')]);router['post']('/',auth[_0xb936('0x6')](),controller[_0xb936('0xa')]);router['put'](_0xb936('0x8'),auth[_0xb936('0x6')](),controller[_0xb936('0xb')]);router[_0xb936('0xc')]('/:id',auth[_0xb936('0x6')](),controller['destroy']);module[_0xb936('0xd')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index d198e19..292ab52 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 _0x92f5=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x375fa9,_0x55eee1){var _0x2ffec4=function(_0x461ff3){while(--_0x461ff3){_0x375fa9['push'](_0x375fa9['shift']());}};_0x2ffec4(++_0x55eee1);}(_0x92f5,0x11f));var _0x592f=function(_0x23b1d5,_0x3043fa){_0x23b1d5=_0x23b1d5-0x0;var _0x3f5702=_0x92f5[_0x23b1d5];return _0x3f5702;};'use strict';var Sequelize=require(_0x592f('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x592f('0x1')},'clid':{'type':Sequelize[_0x592f('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x592f('0x2')]},'channel':{'type':Sequelize[_0x592f('0x2')]},'dstchannel':{'type':Sequelize[_0x592f('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x592f('0x2')]},'duration':{'type':Sequelize[_0x592f('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x592f('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x592f('0x2')]},'amaflags':{'type':Sequelize[_0x592f('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x592f('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x592f('0x2')]},'linkedid':{'type':Sequelize[_0x592f('0x2')]},'sequence':{'type':Sequelize[_0x592f('0x2')]},'peeraccount':{'type':Sequelize[_0x592f('0x2')]},'type':{'type':Sequelize[_0x592f('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0363=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x301225,_0x5de13e){var _0x70e768=function(_0x512fe9){while(--_0x512fe9){_0x301225['push'](_0x301225['shift']());}};_0x70e768(++_0x5de13e);}(_0x0363,0x180));var _0x3036=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0x0363[_0x1d83db];return _0x2dc1d1;};'use strict';var Sequelize=require(_0x3036('0x0'));module[_0x3036('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x3036('0x2')},'clid':{'type':Sequelize[_0x3036('0x3')]},'src':{'type':Sequelize[_0x3036('0x3')]},'dst':{'type':Sequelize[_0x3036('0x3')]},'dcontext':{'type':Sequelize[_0x3036('0x3')]},'channel':{'type':Sequelize[_0x3036('0x3')]},'dstchannel':{'type':Sequelize[_0x3036('0x3')]},'lastapp':{'type':Sequelize[_0x3036('0x3')]},'lastdata':{'type':Sequelize[_0x3036('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x3036('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3036('0x3')]},'amaflags':{'type':Sequelize[_0x3036('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x3036('0x3')]},'userfield':{'type':Sequelize[_0x3036('0x3')]},'uniqueid':{'type':Sequelize[_0x3036('0x3')]},'linkedid':{'type':Sequelize[_0x3036('0x3')]},'sequence':{'type':Sequelize[_0x3036('0x3')]},'peeraccount':{'type':Sequelize[_0x3036('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x3036('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index a5b0613..32ea3a1 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 _0x07ef=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3f43d6,_0x2efc89){var _0x1c693f=function(_0x3da47c){while(--_0x3da47c){_0x3f43d6['push'](_0x3f43d6['shift']());}};_0x1c693f(++_0x2efc89);}(_0x07ef,0x1af));var _0xf07e=function(_0x272202,_0x569e70){_0x272202=_0x272202-0x0;var _0xcad2a7=_0x07ef[_0x272202];return _0xcad2a7;};'use strict';var pdf=require(_0xf07e('0x0'));var emlformat=require(_0xf07e('0x1'));var rimraf=require(_0xf07e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf07e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf07e('0x4'));var util=require(_0xf07e('0x5'));var path=require('path');var sox=require(_0xf07e('0x6'));var csv=require(_0xf07e('0x7'));var ejs=require(_0xf07e('0x8'));var fs=require('fs');var _=require(_0xf07e('0x9'));var squel=require(_0xf07e('0xa'));var crypto=require(_0xf07e('0xb'));var jsforce=require(_0xf07e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf07e('0x7'));var querystring=require(_0xf07e('0xd'));var Papa=require(_0xf07e('0xe'));var Redis=require(_0xf07e('0xf'));var authService=require(_0xf07e('0x10'));var qs=require(_0xf07e('0x11'));var as=require(_0xf07e('0x12'));var hardwareService=require(_0xf07e('0x13'));var logger=require(_0xf07e('0x14'))(_0xf07e('0x15'));var utils=require(_0xf07e('0x16'));var config=require(_0xf07e('0x17'));var db=require(_0xf07e('0x18'))['db'];function respondWithStatusCode(_0x1bce24,_0x10e6f4){_0x10e6f4=_0x10e6f4||0xcc;return function(_0x78f1c8){if(_0x78f1c8){return _0x1bce24[_0xf07e('0x19')](_0x10e6f4);}return _0x1bce24['status'](_0x10e6f4)[_0xf07e('0x1a')]();};}function respondWithResult(_0x1591e4,_0x2b5dbd){_0x2b5dbd=_0x2b5dbd||0xc8;return function(_0x392c7f){if(_0x392c7f){return _0x1591e4[_0xf07e('0x1b')](_0x2b5dbd)[_0xf07e('0x1c')](_0x392c7f);}};}function respondWithFilteredResult(_0x541d62,_0x5151c7){return function(_0x43c2b9){if(_0x43c2b9){var _0x5a5e29=_0x43c2b9[_0xf07e('0x1d')],_0x4903df=_0x5151c7[_0xf07e('0x1e')],_0x33079d=_0x5151c7[_0xf07e('0x1e')]+_0x5151c7[_0xf07e('0x1f')],_0x55977c;if(_0x33079d>=_0x5a5e29){_0x33079d=_0x5a5e29;_0x55977c=0xc8;}else{_0x55977c=0xce;}_0x541d62[_0xf07e('0x1b')](_0x55977c);return _0x541d62[_0xf07e('0x20')]('Content-Range',_0x4903df+'-'+_0x33079d+'/'+_0x5a5e29)[_0xf07e('0x1c')](_0x43c2b9);}return null;};}function patchUpdates(_0x24af41){return function(_0x1fec25){try{jsonpatch[_0xf07e('0x21')](_0x1fec25,_0x24af41,!![]);}catch(_0x58c0d5){return BPromise['reject'](_0x58c0d5);}return _0x1fec25[_0xf07e('0x22')]();};}function saveUpdates(_0xf854d8,_0x161ce3){return function(_0x2628f0){if(_0x2628f0){return _0x2628f0[_0xf07e('0x23')](_0xf854d8)[_0xf07e('0x24')](function(_0x425e05){return _0x425e05;});}return null;};}function removeEntity(_0x4b106b,_0x9aac8a){return function(_0x40826d){if(_0x40826d){return _0x40826d[_0xf07e('0x25')]()[_0xf07e('0x24')](function(){_0x4b106b[_0xf07e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a951c,_0x3aa5fa){return function(_0x82549d){if(!_0x82549d){_0x7a951c['sendStatus'](0x194);}return _0x82549d;};}function handleError(_0x349aa2,_0x48eb4b){_0x48eb4b=_0x48eb4b||0x1f4;return function(_0x346cab){logger[_0xf07e('0x26')](_0x346cab[_0xf07e('0x27')]);if(_0x346cab[_0xf07e('0x28')]){delete _0x346cab[_0xf07e('0x28')];}_0x349aa2[_0xf07e('0x1b')](_0x48eb4b)[_0xf07e('0x29')](_0x346cab);};}exports[_0xf07e('0x2a')]=function(_0x38b0dd,_0x5b8082){var _0x339d02={},_0x379664={},_0x2ade37={'count':0x0,'rows':[]};var _0x4aae46=_['map'](db[_0xf07e('0x2b')][_0xf07e('0x2c')],function(_0x212115){return{'name':_0x212115['fieldName'],'type':_0x212115[_0xf07e('0x2d')][_0xf07e('0x2e')]};});_0x379664['model']=_['map'](_0x4aae46,'name');_0x379664['query']=_[_0xf07e('0x2f')](_0x38b0dd[_0xf07e('0x30')]);_0x379664[_0xf07e('0x31')]=_[_0xf07e('0x32')](_0x379664['model'],_0x379664[_0xf07e('0x30')]);_0x339d02[_0xf07e('0x33')]=_[_0xf07e('0x32')](_0x379664[_0xf07e('0x34')],qs[_0xf07e('0x35')](_0x38b0dd[_0xf07e('0x30')][_0xf07e('0x35')]));_0x339d02[_0xf07e('0x33')]=_0x339d02['attributes']['length']?_0x339d02[_0xf07e('0x33')]:_0x379664['model'];if(!_0x38b0dd[_0xf07e('0x30')][_0xf07e('0x36')](_0xf07e('0x37'))){_0x339d02['limit']=qs[_0xf07e('0x1f')](_0x38b0dd['query'][_0xf07e('0x1f')]);_0x339d02[_0xf07e('0x1e')]=qs[_0xf07e('0x1e')](_0x38b0dd[_0xf07e('0x30')][_0xf07e('0x1e')]);}_0x339d02[_0xf07e('0x38')]=qs[_0xf07e('0x39')](_0x38b0dd[_0xf07e('0x30')][_0xf07e('0x39')]);_0x339d02[_0xf07e('0x3a')]=qs[_0xf07e('0x31')](_[_0xf07e('0x3b')](_0x38b0dd[_0xf07e('0x30')],_0x379664['filters']),_0x4aae46);if(_0x38b0dd[_0xf07e('0x30')]['filter']){_0x339d02['where']=_[_0xf07e('0x3c')](_0x339d02[_0xf07e('0x3a')],{'$or':_['map'](_0x4aae46,function(_0x26d435){if(_0x26d435[_0xf07e('0x2d')]!==_0xf07e('0x3d')){var _0x41f3ca={};_0x41f3ca[_0x26d435['name']]={'$like':'%'+_0x38b0dd[_0xf07e('0x30')][_0xf07e('0x3e')]+'%'};return _0x41f3ca;}})});}_0x339d02=_['merge']({},_0x339d02,_0x38b0dd[_0xf07e('0x3f')]);var _0x22e851={'where':_0x339d02[_0xf07e('0x3a')]};return db[_0xf07e('0x2b')][_0xf07e('0x1d')](_0x22e851)[_0xf07e('0x24')](function(_0x31d72c){_0x2ade37[_0xf07e('0x1d')]=_0x31d72c;if(_0x38b0dd[_0xf07e('0x30')]['includeAll']){_0x339d02[_0xf07e('0x40')]=[{'all':!![]}];}return db[_0xf07e('0x2b')][_0xf07e('0x41')](_0x339d02);})[_0xf07e('0x24')](function(_0x4fea47){_0x2ade37[_0xf07e('0x42')]=_0x4fea47;return _0x2ade37;})[_0xf07e('0x24')](respondWithFilteredResult(_0x5b8082,_0x339d02))[_0xf07e('0x43')](handleError(_0x5b8082,null));};exports[_0xf07e('0x44')]=function(_0x3ecbb5,_0x3add47){var _0x14d47e={'raw':!![],'where':{'id':_0x3ecbb5[_0xf07e('0x45')]['id']}},_0x3f74fd={};_0x3f74fd[_0xf07e('0x34')]=_['keys'](db[_0xf07e('0x2b')]['rawAttributes']);_0x3f74fd['query']=_[_0xf07e('0x2f')](_0x3ecbb5[_0xf07e('0x30')]);_0x3f74fd[_0xf07e('0x31')]=_['intersection'](_0x3f74fd[_0xf07e('0x34')],_0x3f74fd[_0xf07e('0x30')]);_0x14d47e['attributes']=_['intersection'](_0x3f74fd[_0xf07e('0x34')],qs[_0xf07e('0x35')](_0x3ecbb5['query'][_0xf07e('0x35')]));_0x14d47e[_0xf07e('0x33')]=_0x14d47e['attributes'][_0xf07e('0x46')]?_0x14d47e[_0xf07e('0x33')]:_0x3f74fd['model'];if(_0x3ecbb5['query']['includeAll']){_0x14d47e[_0xf07e('0x40')]=[{'all':!![]}];}_0x14d47e=_['merge']({},_0x14d47e,_0x3ecbb5[_0xf07e('0x3f')]);return db[_0xf07e('0x2b')][_0xf07e('0x47')](_0x14d47e)['then'](handleEntityNotFound(_0x3add47,null))[_0xf07e('0x24')](respondWithResult(_0x3add47,null))[_0xf07e('0x43')](handleError(_0x3add47,null));};exports[_0xf07e('0x48')]=function(_0x838bdb,_0x31bbc1){return db[_0xf07e('0x2b')][_0xf07e('0x48')](_0x838bdb[_0xf07e('0x49')],{})[_0xf07e('0x24')](respondWithResult(_0x31bbc1,0xc9))['catch'](handleError(_0x31bbc1,null));};exports['update']=function(_0x56e7b2,_0x2d6fb0){if(_0x56e7b2['body']['id']){delete _0x56e7b2[_0xf07e('0x49')]['id'];}return db['Cdr'][_0xf07e('0x47')]({'where':{'id':_0x56e7b2['params']['id']}})[_0xf07e('0x24')](handleEntityNotFound(_0x2d6fb0,null))['then'](saveUpdates(_0x56e7b2[_0xf07e('0x49')],null))[_0xf07e('0x24')](respondWithResult(_0x2d6fb0,null))[_0xf07e('0x43')](handleError(_0x2d6fb0,null));};exports[_0xf07e('0x25')]=function(_0x2b988d,_0x370802){return db[_0xf07e('0x2b')][_0xf07e('0x47')]({'where':{'id':_0x2b988d[_0xf07e('0x45')]['id']}})['then'](handleEntityNotFound(_0x370802,null))['then'](removeEntity(_0x370802,null))[_0xf07e('0x43')](handleError(_0x370802,null));};exports[_0xf07e('0x4a')]=function(_0x585ccd,_0x4180cd){return db[_0xf07e('0x2b')][_0xf07e('0x4a')]()[_0xf07e('0x24')](respondWithResult(_0x4180cd,null))['catch'](handleError(_0x4180cd,null));}; \ No newline at end of file +var _0x9569=['end','json','offset','limit','apply','reject','update','then','destroy','sendStatus','error','name','send','map','Cdr','type','key','model','keys','filters','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x31d459,_0x2bd5b4){var _0x5d3f67=function(_0x218669){while(--_0x218669){_0x31d459['push'](_0x31d459['shift']());}};_0x5d3f67(++_0x2bd5b4);}(_0x9569,0x74));var _0x9956=function(_0x4c5085,_0x9bf283){_0x4c5085=_0x4c5085-0x0;var _0x21b22d=_0x9569[_0x4c5085];return _0x21b22d;};'use strict';var pdf=require(_0x9956('0x0'));var emlformat=require(_0x9956('0x1'));var rimraf=require(_0x9956('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9956('0x3'));var rp=require('request-promise');var moment=require(_0x9956('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9956('0x5'));var util=require(_0x9956('0x6'));var path=require(_0x9956('0x7'));var sox=require(_0x9956('0x8'));var csv=require(_0x9956('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9956('0xa'));var squel=require('squel');var crypto=require(_0x9956('0xb'));var jsforce=require(_0x9956('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9956('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9956('0xd'));var authService=require(_0x9956('0xe'));var qs=require(_0x9956('0xf'));var as=require(_0x9956('0x10'));var hardwareService=require(_0x9956('0x11'));var logger=require(_0x9956('0x12'))(_0x9956('0x13'));var utils=require(_0x9956('0x14'));var config=require(_0x9956('0x15'));var db=require(_0x9956('0x16'))['db'];function respondWithStatusCode(_0x4e60c2,_0x3d5791){_0x3d5791=_0x3d5791||0xcc;return function(_0x14a2f1){if(_0x14a2f1){return _0x4e60c2['sendStatus'](_0x3d5791);}return _0x4e60c2[_0x9956('0x17')](_0x3d5791)[_0x9956('0x18')]();};}function respondWithResult(_0x5ee6b8,_0x305eb8){_0x305eb8=_0x305eb8||0xc8;return function(_0x55119f){if(_0x55119f){return _0x5ee6b8[_0x9956('0x17')](_0x305eb8)[_0x9956('0x19')](_0x55119f);}};}function respondWithFilteredResult(_0x2c761d,_0x185f16){return function(_0x38eb64){if(_0x38eb64){var _0x3955d7=_0x38eb64['count'],_0x226670=_0x185f16['offset'],_0x416a23=_0x185f16[_0x9956('0x1a')]+_0x185f16[_0x9956('0x1b')],_0x38d201;if(_0x416a23>=_0x3955d7){_0x416a23=_0x3955d7;_0x38d201=0xc8;}else{_0x38d201=0xce;}_0x2c761d[_0x9956('0x17')](_0x38d201);return _0x2c761d['set']('Content-Range',_0x226670+'-'+_0x416a23+'/'+_0x3955d7)[_0x9956('0x19')](_0x38eb64);}return null;};}function patchUpdates(_0x380a0c){return function(_0x4005d3){try{jsonpatch[_0x9956('0x1c')](_0x4005d3,_0x380a0c,!![]);}catch(_0x17d7d0){return BPromise[_0x9956('0x1d')](_0x17d7d0);}return _0x4005d3['save']();};}function saveUpdates(_0x320c4f,_0x12ad2c){return function(_0x59ea1e){if(_0x59ea1e){return _0x59ea1e[_0x9956('0x1e')](_0x320c4f)[_0x9956('0x1f')](function(_0x44b718){return _0x44b718;});}return null;};}function removeEntity(_0x1c3e16,_0xacc0b1){return function(_0x37f395){if(_0x37f395){return _0x37f395[_0x9956('0x20')]()['then'](function(){_0x1c3e16[_0x9956('0x17')](0xcc)[_0x9956('0x18')]();});}};}function handleEntityNotFound(_0x1e54a6,_0x3c310e){return function(_0x4398f1){if(!_0x4398f1){_0x1e54a6[_0x9956('0x21')](0x194);}return _0x4398f1;};}function handleError(_0x48ff27,_0x42ed75){_0x42ed75=_0x42ed75||0x1f4;return function(_0x533350){logger[_0x9956('0x22')](_0x533350['stack']);if(_0x533350[_0x9956('0x23')]){delete _0x533350[_0x9956('0x23')];}_0x48ff27[_0x9956('0x17')](_0x42ed75)[_0x9956('0x24')](_0x533350);};}exports['index']=function(_0x33ce69,_0x316244){var _0x3455f6={},_0x5ce70c={},_0x50694f={'count':0x0,'rows':[]};var _0x1e05e1=_[_0x9956('0x25')](db[_0x9956('0x26')]['rawAttributes'],function(_0x79ea7){return{'name':_0x79ea7['fieldName'],'type':_0x79ea7[_0x9956('0x27')][_0x9956('0x28')]};});_0x5ce70c[_0x9956('0x29')]=_[_0x9956('0x25')](_0x1e05e1,_0x9956('0x23'));_0x5ce70c['query']=_[_0x9956('0x2a')](_0x33ce69['query']);_0x5ce70c[_0x9956('0x2b')]=_['intersection'](_0x5ce70c[_0x9956('0x29')],_0x5ce70c[_0x9956('0x2c')]);_0x3455f6[_0x9956('0x2d')]=_['intersection'](_0x5ce70c['model'],qs[_0x9956('0x2e')](_0x33ce69[_0x9956('0x2c')][_0x9956('0x2e')]));_0x3455f6[_0x9956('0x2d')]=_0x3455f6[_0x9956('0x2d')]['length']?_0x3455f6[_0x9956('0x2d')]:_0x5ce70c['model'];if(!_0x33ce69[_0x9956('0x2c')][_0x9956('0x2f')]('nolimit')){_0x3455f6[_0x9956('0x1b')]=qs[_0x9956('0x1b')](_0x33ce69[_0x9956('0x2c')][_0x9956('0x1b')]);_0x3455f6[_0x9956('0x1a')]=qs[_0x9956('0x1a')](_0x33ce69[_0x9956('0x2c')][_0x9956('0x1a')]);}_0x3455f6[_0x9956('0x30')]=qs['sort'](_0x33ce69[_0x9956('0x2c')][_0x9956('0x31')]);_0x3455f6[_0x9956('0x32')]=qs[_0x9956('0x2b')](_[_0x9956('0x33')](_0x33ce69[_0x9956('0x2c')],_0x5ce70c[_0x9956('0x2b')]),_0x1e05e1);if(_0x33ce69[_0x9956('0x2c')][_0x9956('0x34')]){_0x3455f6[_0x9956('0x32')]=_[_0x9956('0x35')](_0x3455f6[_0x9956('0x32')],{'$or':_[_0x9956('0x25')](_0x1e05e1,function(_0x285e6b){if(_0x285e6b[_0x9956('0x27')]!=='VIRTUAL'){var _0x1b6a92={};_0x1b6a92[_0x285e6b[_0x9956('0x23')]]={'$like':'%'+_0x33ce69[_0x9956('0x2c')][_0x9956('0x34')]+'%'};return _0x1b6a92;}})});}_0x3455f6=_[_0x9956('0x35')]({},_0x3455f6,_0x33ce69[_0x9956('0x36')]);var _0x472859={'where':_0x3455f6['where']};return db[_0x9956('0x26')][_0x9956('0x37')](_0x472859)[_0x9956('0x1f')](function(_0x16084f){_0x50694f[_0x9956('0x37')]=_0x16084f;if(_0x33ce69['query'][_0x9956('0x38')]){_0x3455f6[_0x9956('0x39')]=[{'all':!![]}];}return db['Cdr'][_0x9956('0x3a')](_0x3455f6);})[_0x9956('0x1f')](function(_0x42eeec){_0x50694f[_0x9956('0x3b')]=_0x42eeec;return _0x50694f;})[_0x9956('0x1f')](respondWithFilteredResult(_0x316244,_0x3455f6))[_0x9956('0x3c')](handleError(_0x316244,null));};exports[_0x9956('0x3d')]=function(_0x16cab7,_0x2e82cb){var _0xf54eb0={'raw':!![],'where':{'id':_0x16cab7[_0x9956('0x3e')]['id']}},_0x41b69d={};_0x41b69d[_0x9956('0x29')]=_[_0x9956('0x2a')](db[_0x9956('0x26')][_0x9956('0x3f')]);_0x41b69d['query']=_['keys'](_0x16cab7['query']);_0x41b69d['filters']=_['intersection'](_0x41b69d[_0x9956('0x29')],_0x41b69d['query']);_0xf54eb0[_0x9956('0x2d')]=_[_0x9956('0x40')](_0x41b69d[_0x9956('0x29')],qs[_0x9956('0x2e')](_0x16cab7[_0x9956('0x2c')]['fields']));_0xf54eb0[_0x9956('0x2d')]=_0xf54eb0[_0x9956('0x2d')][_0x9956('0x41')]?_0xf54eb0[_0x9956('0x2d')]:_0x41b69d['model'];if(_0x16cab7[_0x9956('0x2c')][_0x9956('0x38')]){_0xf54eb0[_0x9956('0x39')]=[{'all':!![]}];}_0xf54eb0=_[_0x9956('0x35')]({},_0xf54eb0,_0x16cab7['options']);return db[_0x9956('0x26')]['find'](_0xf54eb0)[_0x9956('0x1f')](handleEntityNotFound(_0x2e82cb,null))['then'](respondWithResult(_0x2e82cb,null))[_0x9956('0x3c')](handleError(_0x2e82cb,null));};exports[_0x9956('0x42')]=function(_0x4e099e,_0x1391b1){return db[_0x9956('0x26')][_0x9956('0x42')](_0x4e099e['body'],{})[_0x9956('0x1f')](respondWithResult(_0x1391b1,0xc9))[_0x9956('0x3c')](handleError(_0x1391b1,null));};exports['update']=function(_0x3cc8b4,_0x5070ee){if(_0x3cc8b4['body']['id']){delete _0x3cc8b4[_0x9956('0x43')]['id'];}return db[_0x9956('0x26')]['find']({'where':{'id':_0x3cc8b4['params']['id']}})[_0x9956('0x1f')](handleEntityNotFound(_0x5070ee,null))['then'](saveUpdates(_0x3cc8b4[_0x9956('0x43')],null))[_0x9956('0x1f')](respondWithResult(_0x5070ee,null))[_0x9956('0x3c')](handleError(_0x5070ee,null));};exports[_0x9956('0x20')]=function(_0x581800,_0xed45d3){return db['Cdr'][_0x9956('0x44')]({'where':{'id':_0x581800[_0x9956('0x3e')]['id']}})['then'](handleEntityNotFound(_0xed45d3,null))[_0x9956('0x1f')](removeEntity(_0xed45d3,null))['catch'](handleError(_0xed45d3,null));};exports[_0x9956('0x45')]=function(_0x7547eb,_0x3eec39){return db[_0x9956('0x26')]['describe']()[_0x9956('0x1f')](respondWithResult(_0x3eec39,null))['catch'](handleError(_0x3eec39,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 04e9175..bea1b2a 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 _0x3c20=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition'];(function(_0x4bb94b,_0x50628a){var _0x36dcc6=function(_0x3ea436){while(--_0x3ea436){_0x4bb94b['push'](_0x4bb94b['shift']());}};_0x36dcc6(++_0x50628a);}(_0x3c20,0x1e9));var _0x03c2=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x3c20[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x03c2('0x0'));var util=require(_0x03c2('0x1'));var logger=require(_0x03c2('0x2'))(_0x03c2('0x3'));var moment=require('moment');var BPromise=require(_0x03c2('0x4'));var rp=require(_0x03c2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x03c2('0x6'));var attributes=require(_0x03c2('0x7'));module[_0x03c2('0x8')]=function(_0x37f15c,_0x36421c){return _0x37f15c[_0x03c2('0x9')](_0x03c2('0xa'),attributes,{'tableName':_0x03c2('0xb'),'paranoid':![],'indexes':[{'name':_0x03c2('0xc'),'fields':[_0x03c2('0xc')]},{'name':_0x03c2('0xd'),'fields':[_0x03c2('0xd')]},{'name':_0x03c2('0xe'),'fields':[_0x03c2('0xe')]},{'name':'dst','fields':[_0x03c2('0xf')]},{'name':_0x03c2('0x10'),'fields':['src']},{'name':_0x03c2('0x11'),'fields':[_0x03c2('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x655f=['accountcode','calldate','disposition','dst','src','uniqueid','lodash','api','bluebird','request-promise','path','../../config/environment','./cdr.attributes','define','Cdr'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x655f,0x150));var _0xf655=function(_0x5173c3,_0x51e0a0){_0x5173c3=_0x5173c3-0x0;var _0x3ab67a=_0x655f[_0x5173c3];return _0x3ab67a;};'use strict';var _=require(_0xf655('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf655('0x1'));var moment=require('moment');var BPromise=require(_0xf655('0x2'));var rp=require(_0xf655('0x3'));var fs=require('fs');var path=require(_0xf655('0x4'));var rimraf=require('rimraf');var config=require(_0xf655('0x5'));var attributes=require(_0xf655('0x6'));module['exports']=function(_0x80e301,_0x444770){return _0x80e301[_0xf655('0x7')](_0xf655('0x8'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0xf655('0x9'),'fields':[_0xf655('0x9')]},{'name':'calldate','fields':[_0xf655('0xa')]},{'name':'disposition','fields':[_0xf655('0xb')]},{'name':_0xf655('0xc'),'fields':[_0xf655('0xc')]},{'name':'src','fields':[_0xf655('0xd')]},{'name':_0xf655('0xe'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index c729718..de2c995 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 _0xb99b=['Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x30436f,_0x4f13d2){var _0x7cca4b=function(_0x43c168){while(--_0x43c168){_0x30436f['push'](_0x30436f['shift']());}};_0x7cca4b(++_0x4f13d2);}(_0xb99b,0xc5));var _0xbb99=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb99b[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xbb99('0x0'));var moment=require(_0xbb99('0x1'));var BPromise=require(_0xbb99('0x2'));var rs=require(_0xbb99('0x3'));var fs=require('fs');var Redis=require(_0xbb99('0x4'));var db=require(_0xbb99('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb99('0x6'))(_0xbb99('0x7'));var config=require(_0xbb99('0x8'));var jayson=require(_0xbb99('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc2e01e,_0x86bc5a,_0xb307be){return new BPromise(function(_0x419d81,_0x28a712){return client[_0xbb99('0xa')](_0xc2e01e,_0xb307be)[_0xbb99('0xb')](function(_0x21d968){logger[_0xbb99('0xc')](_0xbb99('0xd'),_0x86bc5a,_0xbb99('0xe'));logger[_0xbb99('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x86bc5a,_0xbb99('0xe'),JSON[_0xbb99('0x10')](_0x21d968));if(_0x21d968[_0xbb99('0x11')]){if(_0x21d968[_0xbb99('0x11')][_0xbb99('0x12')]===0x1f4){logger[_0xbb99('0x11')](_0xbb99('0xd'),_0x86bc5a,_0x21d968[_0xbb99('0x11')][_0xbb99('0x13')]);return _0x28a712(_0x21d968['error'][_0xbb99('0x13')]);}logger[_0xbb99('0x11')](_0xbb99('0xd'),_0x86bc5a,_0x21d968['error'][_0xbb99('0x13')]);return _0x419d81(_0x21d968[_0xbb99('0x11')][_0xbb99('0x13')]);}else{logger[_0xbb99('0xc')](_0xbb99('0xd'),_0x86bc5a,_0xbb99('0xe'));_0x419d81(_0x21d968[_0xbb99('0x14')][_0xbb99('0x13')]);}})['catch'](function(_0x49147a){logger['error'](_0xbb99('0xd'),_0x86bc5a,_0x49147a);_0x28a712(_0x49147a);});});} \ No newline at end of file +var _0xd295=['../../config/environment','jayson/promise','client','request','info','Cdr,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x42214d,_0x2c6a22){var _0x263211=function(_0x517e35){while(--_0x517e35){_0x42214d['push'](_0x42214d['shift']());}};_0x263211(++_0x2c6a22);}(_0xd295,0x1db));var _0x5d29=function(_0x5d75fe,_0x38dac2){_0x5d75fe=_0x5d75fe-0x0;var _0x559e21=_0xd295[_0x5d75fe];return _0x559e21;};'use strict';var _=require(_0x5d29('0x0'));var util=require('util');var moment=require(_0x5d29('0x1'));var BPromise=require(_0x5d29('0x2'));var rs=require(_0x5d29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d29('0x4'))['db'];var utils=require(_0x5d29('0x5'));var logger=require(_0x5d29('0x6'))(_0x5d29('0x7'));var config=require(_0x5d29('0x8'));var jayson=require(_0x5d29('0x9'));var client=jayson[_0x5d29('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24f095,_0x3f324b,_0x166b39){return new BPromise(function(_0x5b5bf4,_0x2f8386){return client[_0x5d29('0xb')](_0x24f095,_0x166b39)['then'](function(_0x1a0815){logger[_0x5d29('0xc')](_0x5d29('0xd'),_0x3f324b,'request\x20sent');logger[_0x5d29('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x3f324b,'request\x20sent',JSON[_0x5d29('0xf')](_0x1a0815));if(_0x1a0815['error']){if(_0x1a0815[_0x5d29('0x10')][_0x5d29('0x11')]===0x1f4){logger['error'](_0x5d29('0xd'),_0x3f324b,_0x1a0815[_0x5d29('0x10')][_0x5d29('0x12')]);return _0x2f8386(_0x1a0815['error'][_0x5d29('0x12')]);}logger[_0x5d29('0x10')](_0x5d29('0xd'),_0x3f324b,_0x1a0815[_0x5d29('0x10')][_0x5d29('0x12')]);return _0x5b5bf4(_0x1a0815[_0x5d29('0x10')]['message']);}else{logger[_0x5d29('0xc')](_0x5d29('0xd'),_0x3f324b,_0x5d29('0x13'));_0x5b5bf4(_0x1a0815[_0x5d29('0x14')][_0x5d29('0x12')]);}})['catch'](function(_0x2c33cc){logger[_0x5d29('0x10')](_0x5d29('0xd'),_0x3f324b,_0x2c33cc);_0x2f8386(_0x2c33cc);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 2fcc2e4..daee2a1 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 _0xdc60=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','isAuthenticated','/:id','post'];(function(_0xdcfa66,_0xd39d4a){var _0xa1bc04=function(_0x1069cb){while(--_0x1069cb){_0xdcfa66['push'](_0xdcfa66['shift']());}};_0xa1bc04(++_0xd39d4a);}(_0xdc60,0x9d));var _0x0dc6=function(_0x809dbd,_0xf5f241){_0x809dbd=_0x809dbd-0x0;var _0x5497bf=_0xdc60[_0x809dbd];return _0x5497bf;};'use strict';var multer=require(_0x0dc6('0x0'));var util=require(_0x0dc6('0x1'));var path=require(_0x0dc6('0x2'));var timeout=require(_0x0dc6('0x3'));var express=require(_0x0dc6('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0dc6('0x5'));var config=require(_0x0dc6('0x6'));var controller=require(_0x0dc6('0x7'));router[_0x0dc6('0x8')]('/',auth['isAuthenticated'](),controller[_0x0dc6('0x9')]);router['get'](_0x0dc6('0xa'),auth[_0x0dc6('0xb')](),controller['describe']);router[_0x0dc6('0x8')](_0x0dc6('0xc'),auth[_0x0dc6('0xb')](),controller['show']);router[_0x0dc6('0xd')]('/',auth[_0x0dc6('0xb')](),controller[_0x0dc6('0xe')]);router[_0x0dc6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x0dc6('0x10')]);router['delete'](_0x0dc6('0xc'),auth[_0x0dc6('0xb')](),controller[_0x0dc6('0x11')]);module[_0x0dc6('0x12')]=router; \ No newline at end of file +var _0xd9c4=['isAuthenticated','index','/describe','describe','/:id','create','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./cdr.controller','get'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0xd9c4,0x119));var _0x4d9c=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xd9c4[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x4d9c('0x0'));var util=require(_0x4d9c('0x1'));var path=require(_0x4d9c('0x2'));var timeout=require(_0x4d9c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x4d9c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4d9c('0x5'));var controller=require(_0x4d9c('0x6'));router[_0x4d9c('0x7')]('/',auth[_0x4d9c('0x8')](),controller[_0x4d9c('0x9')]);router['get'](_0x4d9c('0xa'),auth[_0x4d9c('0x8')](),controller[_0x4d9c('0xb')]);router[_0x4d9c('0x7')](_0x4d9c('0xc'),auth[_0x4d9c('0x8')](),controller['show']);router['post']('/',auth[_0x4d9c('0x8')](),controller[_0x4d9c('0xd')]);router['put']('/:id',auth[_0x4d9c('0x8')](),controller['update']);router[_0x4d9c('0xe')](_0x4d9c('0xc'),auth[_0x4d9c('0x8')](),controller[_0x4d9c('0xf')]);module[_0x4d9c('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index b37f360..aedf54b 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 _0xb9d5=['INTEGER','TEXT','STRING','sequelize'];(function(_0x277a94,_0x3c5545){var _0x34968f=function(_0x4508ab){while(--_0x4508ab){_0x277a94['push'](_0x277a94['shift']());}};_0x34968f(++_0x3c5545);}(_0xb9d5,0xbf));var _0x5b9d=function(_0x4cc0a9,_0x2b96d9){_0x4cc0a9=_0x4cc0a9-0x0;var _0x21f6a3=_0xb9d5[_0x4cc0a9];return _0x21f6a3;};'use strict';var Sequelize=require(_0x5b9d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5b9d('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5b9d('0x2')]()},'description':{'type':Sequelize[_0x5b9d('0x3')]},'interval':{'type':Sequelize[_0x5b9d('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xaf34=['exports','INTEGER','STRING','noop','TEXT'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xaf34,0x186));var _0x4af3=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xaf34[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require('sequelize');module[_0x4af3('0x0')]={'priority':{'type':Sequelize[_0x4af3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4af3('0x2')],'allowNull':![],'defaultValue':_0x4af3('0x3')},'appdata':{'type':Sequelize[_0x4af3('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4af3('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 35bb6ac..6a6b7a5 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 _0xd5a0=['../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','body','find','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x104ee4,_0x4da2e0){var _0x23bbed=function(_0x2ff4e7){while(--_0x2ff4e7){_0x104ee4['push'](_0x104ee4['shift']());}};_0x23bbed(++_0x4da2e0);}(_0xd5a0,0xc6));var _0x0d5a=function(_0xaffbc8,_0x12b840){_0xaffbc8=_0xaffbc8-0x0;var _0x366bb0=_0xd5a0[_0xaffbc8];return _0x366bb0;};'use strict';var pdf=require(_0x0d5a('0x0'));var emlformat=require(_0x0d5a('0x1'));var rimraf=require(_0x0d5a('0x2'));var zipdir=require(_0x0d5a('0x3'));var jsonpatch=require(_0x0d5a('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d5a('0x5'));var Mustache=require('mustache');var util=require(_0x0d5a('0x6'));var path=require('path');var sox=require(_0x0d5a('0x7'));var csv=require(_0x0d5a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0d5a('0x9'));var squel=require(_0x0d5a('0xa'));var crypto=require(_0x0d5a('0xb'));var jsforce=require(_0x0d5a('0xc'));var deskjs=require(_0x0d5a('0xd'));var toCsv=require(_0x0d5a('0x8'));var querystring=require(_0x0d5a('0xe'));var Papa=require(_0x0d5a('0xf'));var Redis=require('ioredis');var authService=require(_0x0d5a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0d5a('0x11'));var hardwareService=require(_0x0d5a('0x12'));var logger=require('../../config/logger')(_0x0d5a('0x13'));var utils=require(_0x0d5a('0x14'));var config=require(_0x0d5a('0x15'));var db=require(_0x0d5a('0x16'))['db'];function respondWithStatusCode(_0x123e3f,_0x2cdc01){_0x2cdc01=_0x2cdc01||0xcc;return function(_0x51c864){if(_0x51c864){return _0x123e3f['sendStatus'](_0x2cdc01);}return _0x123e3f[_0x0d5a('0x17')](_0x2cdc01)[_0x0d5a('0x18')]();};}function respondWithResult(_0x1ad68c,_0x2cb2a7){_0x2cb2a7=_0x2cb2a7||0xc8;return function(_0x4085d7){if(_0x4085d7){return _0x1ad68c[_0x0d5a('0x17')](_0x2cb2a7)['json'](_0x4085d7);}};}function respondWithFilteredResult(_0x40f9bc,_0x2e4ec5){return function(_0x3a6c73){if(_0x3a6c73){var _0xbdc0e0=_0x3a6c73[_0x0d5a('0x19')],_0x3da52b=_0x2e4ec5[_0x0d5a('0x1a')],_0x3f6056=_0x2e4ec5[_0x0d5a('0x1a')]+_0x2e4ec5['limit'],_0x2b615b;if(_0x3f6056>=_0xbdc0e0){_0x3f6056=_0xbdc0e0;_0x2b615b=0xc8;}else{_0x2b615b=0xce;}_0x40f9bc['status'](_0x2b615b);return _0x40f9bc[_0x0d5a('0x1b')](_0x0d5a('0x1c'),_0x3da52b+'-'+_0x3f6056+'/'+_0xbdc0e0)[_0x0d5a('0x1d')](_0x3a6c73);}return null;};}function patchUpdates(_0x3f792d){return function(_0xc2868a){try{jsonpatch[_0x0d5a('0x1e')](_0xc2868a,_0x3f792d,!![]);}catch(_0x412c5a){return BPromise[_0x0d5a('0x1f')](_0x412c5a);}return _0xc2868a[_0x0d5a('0x20')]();};}function saveUpdates(_0x384a6f,_0x471569){return function(_0x2245ef){if(_0x2245ef){return _0x2245ef[_0x0d5a('0x21')](_0x384a6f)[_0x0d5a('0x22')](function(_0x1b40f3){return _0x1b40f3;});}return null;};}function removeEntity(_0x50587b,_0x3a069b){return function(_0xef3f55){if(_0xef3f55){return _0xef3f55[_0x0d5a('0x23')]()[_0x0d5a('0x22')](function(){_0x50587b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13f548,_0x1ecad9){return function(_0x15d9bb){if(!_0x15d9bb){_0x13f548[_0x0d5a('0x24')](0x194);}return _0x15d9bb;};}function handleError(_0x3d1ade,_0x27df12){_0x27df12=_0x27df12||0x1f4;return function(_0x4b5cd6){logger[_0x0d5a('0x25')](_0x4b5cd6[_0x0d5a('0x26')]);if(_0x4b5cd6['name']){delete _0x4b5cd6[_0x0d5a('0x27')];}_0x3d1ade[_0x0d5a('0x17')](_0x27df12)['send'](_0x4b5cd6);};}exports['show']=function(_0x5648f2,_0x501010){var _0x191c56={'raw':!![],'where':{'id':_0x5648f2[_0x0d5a('0x28')]['id']}},_0x532cc1={};_0x532cc1[_0x0d5a('0x29')]=_[_0x0d5a('0x2a')](db[_0x0d5a('0x2b')][_0x0d5a('0x2c')]);_0x532cc1[_0x0d5a('0x2d')]=_[_0x0d5a('0x2a')](_0x5648f2[_0x0d5a('0x2d')]);_0x532cc1['filters']=_[_0x0d5a('0x2e')](_0x532cc1['model'],_0x532cc1[_0x0d5a('0x2d')]);_0x191c56[_0x0d5a('0x2f')]=_[_0x0d5a('0x2e')](_0x532cc1[_0x0d5a('0x29')],qs[_0x0d5a('0x30')](_0x5648f2[_0x0d5a('0x2d')][_0x0d5a('0x30')]));_0x191c56[_0x0d5a('0x2f')]=_0x191c56['attributes'][_0x0d5a('0x31')]?_0x191c56[_0x0d5a('0x2f')]:_0x532cc1[_0x0d5a('0x29')];if(_0x5648f2['query'][_0x0d5a('0x32')]){_0x191c56[_0x0d5a('0x33')]=[{'all':!![]}];}_0x191c56=_['merge']({},_0x191c56,_0x5648f2['options']);return db[_0x0d5a('0x2b')]['find'](_0x191c56)[_0x0d5a('0x22')](handleEntityNotFound(_0x501010,null))[_0x0d5a('0x22')](respondWithResult(_0x501010,null))['catch'](handleError(_0x501010,null));};exports[_0x0d5a('0x21')]=function(_0x2f2f99,_0x595992){if(_0x2f2f99['body']['id']){delete _0x2f2f99[_0x0d5a('0x34')]['id'];}return db[_0x0d5a('0x2b')][_0x0d5a('0x35')]({'where':{'id':_0x2f2f99[_0x0d5a('0x28')]['id']}})[_0x0d5a('0x22')](handleEntityNotFound(_0x595992,null))[_0x0d5a('0x22')](saveUpdates(_0x2f2f99[_0x0d5a('0x34')],null))[_0x0d5a('0x22')](respondWithResult(_0x595992,null))[_0x0d5a('0x36')](handleError(_0x595992,null));};exports[_0x0d5a('0x23')]=function(_0x30e52d,_0x2231b8){return db['ChatApplication']['find']({'where':{'id':_0x30e52d[_0x0d5a('0x28')]['id']}})[_0x0d5a('0x22')](handleEntityNotFound(_0x2231b8,null))[_0x0d5a('0x22')](removeEntity(_0x2231b8,null))['catch'](handleError(_0x2231b8,null));}; \ No newline at end of file +var _0x60e9=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','apply','reject','save','destroy','end','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','then','catch','update','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','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'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0x60e9,0x187));var _0x960e=function(_0x3d320d,_0x3938f9){_0x3d320d=_0x3d320d-0x0;var _0x4214af=_0x60e9[_0x3d320d];return _0x4214af;};'use strict';var pdf=require(_0x960e('0x0'));var emlformat=require(_0x960e('0x1'));var rimraf=require(_0x960e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x960e('0x3'));var rp=require(_0x960e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x960e('0x5'));var sox=require(_0x960e('0x6'));var csv=require(_0x960e('0x7'));var ejs=require(_0x960e('0x8'));var fs=require('fs');var _=require(_0x960e('0x9'));var squel=require(_0x960e('0xa'));var crypto=require(_0x960e('0xb'));var jsforce=require(_0x960e('0xc'));var deskjs=require(_0x960e('0xd'));var toCsv=require(_0x960e('0x7'));var querystring=require(_0x960e('0xe'));var Papa=require(_0x960e('0xf'));var Redis=require(_0x960e('0x10'));var authService=require(_0x960e('0x11'));var qs=require(_0x960e('0x12'));var as=require(_0x960e('0x13'));var hardwareService=require(_0x960e('0x14'));var logger=require(_0x960e('0x15'))('api');var utils=require(_0x960e('0x16'));var config=require(_0x960e('0x17'));var db=require(_0x960e('0x18'))['db'];function respondWithStatusCode(_0x20a9c9,_0x3da2d2){_0x3da2d2=_0x3da2d2||0xcc;return function(_0x4a16f6){if(_0x4a16f6){return _0x20a9c9[_0x960e('0x19')](_0x3da2d2);}return _0x20a9c9[_0x960e('0x1a')](_0x3da2d2)['end']();};}function respondWithResult(_0x45a9b5,_0x18daac){_0x18daac=_0x18daac||0xc8;return function(_0x1df158){if(_0x1df158){return _0x45a9b5[_0x960e('0x1a')](_0x18daac)[_0x960e('0x1b')](_0x1df158);}};}function respondWithFilteredResult(_0x5010e4,_0x588102){return function(_0x216eba){if(_0x216eba){var _0x4d4035=_0x216eba['count'],_0x4b2f65=_0x588102[_0x960e('0x1c')],_0x376685=_0x588102[_0x960e('0x1c')]+_0x588102[_0x960e('0x1d')],_0xbd986;if(_0x376685>=_0x4d4035){_0x376685=_0x4d4035;_0xbd986=0xc8;}else{_0xbd986=0xce;}_0x5010e4[_0x960e('0x1a')](_0xbd986);return _0x5010e4['set']('Content-Range',_0x4b2f65+'-'+_0x376685+'/'+_0x4d4035)[_0x960e('0x1b')](_0x216eba);}return null;};}function patchUpdates(_0x2d369c){return function(_0x1ea8a2){try{jsonpatch[_0x960e('0x1e')](_0x1ea8a2,_0x2d369c,!![]);}catch(_0x21f1ed){return BPromise[_0x960e('0x1f')](_0x21f1ed);}return _0x1ea8a2[_0x960e('0x20')]();};}function saveUpdates(_0x38f6d3,_0x9835da){return function(_0x4fc22b){if(_0x4fc22b){return _0x4fc22b['update'](_0x38f6d3)['then'](function(_0xb02675){return _0xb02675;});}return null;};}function removeEntity(_0x2d2f7b,_0x1bc2aa){return function(_0x19b237){if(_0x19b237){return _0x19b237[_0x960e('0x21')]()['then'](function(){_0x2d2f7b[_0x960e('0x1a')](0xcc)[_0x960e('0x22')]();});}};}function handleEntityNotFound(_0xcab87a,_0x5aadd4){return function(_0x36a6ab){if(!_0x36a6ab){_0xcab87a[_0x960e('0x19')](0x194);}return _0x36a6ab;};}function handleError(_0x4a6c2d,_0x463f49){_0x463f49=_0x463f49||0x1f4;return function(_0x8c1425){logger['error'](_0x8c1425[_0x960e('0x23')]);if(_0x8c1425[_0x960e('0x24')]){delete _0x8c1425[_0x960e('0x24')];}_0x4a6c2d[_0x960e('0x1a')](_0x463f49)[_0x960e('0x25')](_0x8c1425);};}exports[_0x960e('0x26')]=function(_0x513a1c,_0xb0d110){var _0x56f27c={'raw':!![],'where':{'id':_0x513a1c[_0x960e('0x27')]['id']}},_0x1716f5={};_0x1716f5['model']=_[_0x960e('0x28')](db[_0x960e('0x29')][_0x960e('0x2a')]);_0x1716f5[_0x960e('0x2b')]=_[_0x960e('0x28')](_0x513a1c[_0x960e('0x2b')]);_0x1716f5[_0x960e('0x2c')]=_[_0x960e('0x2d')](_0x1716f5['model'],_0x1716f5[_0x960e('0x2b')]);_0x56f27c['attributes']=_[_0x960e('0x2d')](_0x1716f5[_0x960e('0x2e')],qs[_0x960e('0x2f')](_0x513a1c[_0x960e('0x2b')][_0x960e('0x2f')]));_0x56f27c[_0x960e('0x30')]=_0x56f27c['attributes'][_0x960e('0x31')]?_0x56f27c[_0x960e('0x30')]:_0x1716f5[_0x960e('0x2e')];if(_0x513a1c[_0x960e('0x2b')][_0x960e('0x32')]){_0x56f27c[_0x960e('0x33')]=[{'all':!![]}];}_0x56f27c=_[_0x960e('0x34')]({},_0x56f27c,_0x513a1c[_0x960e('0x35')]);return db[_0x960e('0x29')]['find'](_0x56f27c)['then'](handleEntityNotFound(_0xb0d110,null))[_0x960e('0x36')](respondWithResult(_0xb0d110,null))[_0x960e('0x37')](handleError(_0xb0d110,null));};exports[_0x960e('0x38')]=function(_0x9275f4,_0x34e7fb){if(_0x9275f4[_0x960e('0x39')]['id']){delete _0x9275f4['body']['id'];}return db[_0x960e('0x29')][_0x960e('0x3a')]({'where':{'id':_0x9275f4['params']['id']}})['then'](handleEntityNotFound(_0x34e7fb,null))['then'](saveUpdates(_0x9275f4[_0x960e('0x39')],null))[_0x960e('0x36')](respondWithResult(_0x34e7fb,null))[_0x960e('0x37')](handleError(_0x34e7fb,null));};exports[_0x960e('0x21')]=function(_0x19eb61,_0x2c2512){return db[_0x960e('0x29')]['find']({'where':{'id':_0x19eb61[_0x960e('0x27')]['id']}})['then'](handleEntityNotFound(_0x2c2512,null))['then'](removeEntity(_0x2c2512,null))[_0x960e('0x37')](handleError(_0x2c2512,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index ed1d317..8fb9a46 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 _0xf673=['rimraf','./chatApplication.attributes','exports','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x54abc1,_0x1d053f){var _0x3343cb=function(_0x4a7632){while(--_0x4a7632){_0x54abc1['push'](_0x54abc1['shift']());}};_0x3343cb(++_0x1d053f);}(_0xf673,0x1ab));var _0x3f67=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xf673[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x3f67('0x0'));var util=require(_0x3f67('0x1'));var logger=require(_0x3f67('0x2'))(_0x3f67('0x3'));var moment=require(_0x3f67('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f67('0x5'));var fs=require('fs');var path=require(_0x3f67('0x6'));var rimraf=require(_0x3f67('0x7'));var config=require('../../config/environment');var attributes=require(_0x3f67('0x8'));module[_0x3f67('0x9')]=function(_0x1ea01e,_0x4bef99){return _0x1ea01e[_0x3f67('0xa')]('ChatApplication',attributes,{'tableName':_0x3f67('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3f67('0xc'),'collate':_0x3f67('0xd')});}; \ No newline at end of file +var _0xfd1f=['ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x395475,_0x5bf249){var _0x56e73d=function(_0x13add8){while(--_0x13add8){_0x395475['push'](_0x395475['shift']());}};_0x56e73d(++_0x5bf249);}(_0xfd1f,0x128));var _0xffd1=function(_0x14bcbe,_0x52c886){_0x14bcbe=_0x14bcbe-0x0;var _0x4b5ad0=_0xfd1f[_0x14bcbe];return _0x4b5ad0;};'use strict';var _=require(_0xffd1('0x0'));var util=require(_0xffd1('0x1'));var logger=require(_0xffd1('0x2'))(_0xffd1('0x3'));var moment=require(_0xffd1('0x4'));var BPromise=require(_0xffd1('0x5'));var rp=require(_0xffd1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffd1('0x7'));var config=require(_0xffd1('0x8'));var attributes=require(_0xffd1('0x9'));module[_0xffd1('0xa')]=function(_0x5545b6,_0x1a0298){return _0x5545b6[_0xffd1('0xb')](_0xffd1('0xc'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xffd1('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 6deb624..274efba 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 _0xcc5a=['http','then','info','ChatApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x42bda2,_0x4106ca){var _0x625d2d=function(_0x47b4ba){while(--_0x47b4ba){_0x42bda2['push'](_0x42bda2['shift']());}};_0x625d2d(++_0x4106ca);}(_0xcc5a,0xfc));var _0xacc5=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0xcc5a[_0x65c50e];return _0x4573e7;};'use strict';var _=require('lodash');var util=require(_0xacc5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xacc5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xacc5('0x2'));var logger=require(_0xacc5('0x3'))(_0xacc5('0x4'));var config=require(_0xacc5('0x5'));var jayson=require(_0xacc5('0x6'));var client=jayson[_0xacc5('0x7')][_0xacc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31d9b0,_0x4c95d1,_0x577ef5){return new BPromise(function(_0x3ef719,_0xa7ec2){return client['request'](_0x31d9b0,_0x577ef5)[_0xacc5('0x9')](function(_0x50786f){logger[_0xacc5('0xa')](_0xacc5('0xb'),_0x4c95d1,'request\x20sent');logger[_0xacc5('0xc')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4c95d1,_0xacc5('0xd'),JSON[_0xacc5('0xe')](_0x50786f));if(_0x50786f[_0xacc5('0xf')]){if(_0x50786f[_0xacc5('0xf')][_0xacc5('0x10')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x4c95d1,_0x50786f[_0xacc5('0xf')][_0xacc5('0x11')]);return _0xa7ec2(_0x50786f['error'][_0xacc5('0x11')]);}logger[_0xacc5('0xf')](_0xacc5('0xb'),_0x4c95d1,_0x50786f['error'][_0xacc5('0x11')]);return _0x3ef719(_0x50786f[_0xacc5('0xf')][_0xacc5('0x11')]);}else{logger[_0xacc5('0xa')]('ChatApplication,\x20%s,\x20%s',_0x4c95d1,'request\x20sent');_0x3ef719(_0x50786f[_0xacc5('0x12')][_0xacc5('0x11')]);}})[_0xacc5('0x13')](function(_0x716566){logger[_0xacc5('0xf')](_0xacc5('0xb'),_0x4c95d1,_0x716566);_0xa7ec2(_0x716566);});});} \ No newline at end of file +var _0xe763=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x253c14,_0x490bcd){var _0x19f8b2=function(_0x3f9393){while(--_0x3f9393){_0x253c14['push'](_0x253c14['shift']());}};_0x19f8b2(++_0x490bcd);}(_0xe763,0x1ba));var _0x3e76=function(_0x1e8c4e,_0x4b6ba5){_0x1e8c4e=_0x1e8c4e-0x0;var _0x19088a=_0xe763[_0x1e8c4e];return _0x19088a;};'use strict';var _=require(_0x3e76('0x0'));var util=require(_0x3e76('0x1'));var moment=require(_0x3e76('0x2'));var BPromise=require(_0x3e76('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e76('0x4'));var db=require(_0x3e76('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3e76('0x6'));var config=require(_0x3e76('0x7'));var jayson=require(_0x3e76('0x8'));var client=jayson[_0x3e76('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae27e,_0x10fa39,_0x5561cc){return new BPromise(function(_0x67179b,_0x3ef688){return client['request'](_0x3ae27e,_0x5561cc)[_0x3e76('0xa')](function(_0x423c8c){logger[_0x3e76('0xb')](_0x3e76('0xc'),_0x10fa39,_0x3e76('0xd'));logger[_0x3e76('0xe')](_0x3e76('0xf'),_0x10fa39,_0x3e76('0xd'),JSON[_0x3e76('0x10')](_0x423c8c));if(_0x423c8c[_0x3e76('0x11')]){if(_0x423c8c['error'][_0x3e76('0x12')]===0x1f4){logger['error'](_0x3e76('0xc'),_0x10fa39,_0x423c8c[_0x3e76('0x11')][_0x3e76('0x13')]);return _0x3ef688(_0x423c8c[_0x3e76('0x11')][_0x3e76('0x13')]);}logger[_0x3e76('0x11')](_0x3e76('0xc'),_0x10fa39,_0x423c8c[_0x3e76('0x11')][_0x3e76('0x13')]);return _0x67179b(_0x423c8c[_0x3e76('0x11')][_0x3e76('0x13')]);}else{logger[_0x3e76('0xb')](_0x3e76('0xc'),_0x10fa39,_0x3e76('0xd'));_0x67179b(_0x423c8c[_0x3e76('0x14')]['message']);}})[_0x3e76('0x15')](function(_0x194c92){logger[_0x3e76('0x11')](_0x3e76('0xc'),_0x10fa39,_0x194c92);_0x3ef688(_0x194c92);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 5f4aa5f..b2b1e63 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 _0x7f24=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','show','isAuthenticated','update','delete','exports','multer','path'];(function(_0x55befb,_0x1b18ae){var _0x199366=function(_0x1f2435){while(--_0x1f2435){_0x55befb['push'](_0x55befb['shift']());}};_0x199366(++_0x1b18ae);}(_0x7f24,0x66));var _0x47f2=function(_0x377e11,_0x4bd449){_0x377e11=_0x377e11-0x0;var _0x270348=_0x7f24[_0x377e11];return _0x270348;};'use strict';var multer=require(_0x47f2('0x0'));var util=require('util');var path=require(_0x47f2('0x1'));var timeout=require(_0x47f2('0x2'));var express=require('express');var router=express[_0x47f2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x47f2('0x4'));var config=require(_0x47f2('0x5'));var controller=require(_0x47f2('0x6'));router['get'](_0x47f2('0x7'),auth['isAuthenticated'](),controller[_0x47f2('0x8')]);router['put']('/:id',auth[_0x47f2('0x9')](),controller[_0x47f2('0xa')]);router[_0x47f2('0xb')](_0x47f2('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x47f2('0xc')]=router; \ No newline at end of file +var _0x96ef=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','show','put','/:id','isAuthenticated','delete','destroy','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x96ef,0xa0));var _0xf96e=function(_0x1b5e32,_0x15e315){_0x1b5e32=_0x1b5e32-0x0;var _0x4edc58=_0x96ef[_0x1b5e32];return _0x4edc58;};'use strict';var multer=require(_0xf96e('0x0'));var util=require(_0xf96e('0x1'));var path=require(_0xf96e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf96e('0x3'));var router=express[_0xf96e('0x4')]();var auth=require(_0xf96e('0x5'));var interaction=require(_0xf96e('0x6'));var config=require('../../config/environment');var controller=require(_0xf96e('0x7'));router[_0xf96e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf96e('0x9')]);router[_0xf96e('0xa')](_0xf96e('0xb'),auth[_0xf96e('0xc')](),controller['update']);router[_0xf96e('0xd')](_0xf96e('0xb'),auth[_0xf96e('0xc')](),controller[_0xf96e('0xe')]);module[_0xf96e('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 10f7b34..67b1a0b 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 _0xd3b4=['sequelize','STRING'];(function(_0x3bc62b,_0x4fe051){var _0x444fd4=function(_0x43a37c){while(--_0x43a37c){_0x3bc62b['push'](_0x3bc62b['shift']());}};_0x444fd4(++_0x4fe051);}(_0xd3b4,0x120));var _0x4d3b=function(_0x12bb8e,_0x2e672a){_0x12bb8e=_0x12bb8e-0x0;var _0x4d5d1b=_0xd3b4[_0x12bb8e];return _0x4d5d1b;};'use strict';var Sequelize=require(_0x4d3b('0x0'));module['exports']={'name':{'type':Sequelize[_0x4d3b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4d3b('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xecf4=['exports','STRING','BOOLEAN','sequelize'];(function(_0x72f80e,_0x5ed6fc){var _0x35a36b=function(_0x40b6c0){while(--_0x40b6c0){_0x72f80e['push'](_0x72f80e['shift']());}};_0x35a36b(++_0x5ed6fc);}(_0xecf4,0xbf));var _0x4ecf=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0xecf4[_0x695b76];return _0x1dc21f;};'use strict';var Sequelize=require(_0x4ecf('0x0'));module[_0x4ecf('0x1')]={'name':{'type':Sequelize[_0x4ecf('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4ecf('0x2')]},'write':{'type':Sequelize[_0x4ecf('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 2db78aa..8aad81d 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 _0x3932=['includeAll','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','length','sort','removeMembers','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','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','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','json','count','offset','set','apply','reject','save','update','destroy','status','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','where','pick','VIRTUAL','filter','merge','options','ChatGroup','include','show','params'];(function(_0x5853e3,_0x2ed107){var _0x2c09e4=function(_0x52243e){while(--_0x52243e){_0x5853e3['push'](_0x5853e3['shift']());}};_0x2c09e4(++_0x2ed107);}(_0x3932,0x7f));var _0x2393=function(_0x4c0e62,_0x378d17){_0x4c0e62=_0x4c0e62-0x0;var _0x770cbb=_0x3932[_0x4c0e62];return _0x770cbb;};'use strict';var pdf=require(_0x2393('0x0'));var emlformat=require(_0x2393('0x1'));var rimraf=require(_0x2393('0x2'));var zipdir=require(_0x2393('0x3'));var jsonpatch=require(_0x2393('0x4'));var rp=require(_0x2393('0x5'));var moment=require(_0x2393('0x6'));var BPromise=require(_0x2393('0x7'));var Mustache=require('mustache');var util=require(_0x2393('0x8'));var path=require(_0x2393('0x9'));var sox=require(_0x2393('0xa'));var csv=require(_0x2393('0xb'));var ejs=require(_0x2393('0xc'));var fs=require('fs');var _=require(_0x2393('0xd'));var squel=require(_0x2393('0xe'));var crypto=require('crypto');var jsforce=require(_0x2393('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2393('0xb'));var querystring=require(_0x2393('0x10'));var Papa=require(_0x2393('0x11'));var Redis=require(_0x2393('0x12'));var authService=require(_0x2393('0x13'));var qs=require(_0x2393('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2393('0x15'))(_0x2393('0x16'));var utils=require(_0x2393('0x17'));var config=require(_0x2393('0x18'));var db=require('../../mysqldb')['db'];config[_0x2393('0x19')]=_[_0x2393('0x1a')](config[_0x2393('0x19')],{'host':_0x2393('0x1b'),'port':0x18eb});var socket=require(_0x2393('0x1c'))(new Redis(config[_0x2393('0x19')]));require(_0x2393('0x1d'))[_0x2393('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2393('0x1f')][_0x2393('0x20')]({'port':0x232a});function checkPasswordPattern(_0x41f1c8,_0x184fc5,_0x1a957d){if(_0x1a957d){var _0x37dfc3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37dfc3['test'](_0x184fc5)){return _0x41f1c8;}else{throw new db['Sequelize'][(_0x2393('0x21'))](_0x2393('0x22'));}}else{return _0x41f1c8;}}function respondWithRpcPromise(_0x392930,_0x45101b,_0x362e13,_0x1cb1eb){return new BPromise(function(_0x112035,_0x7ffd9f){var _0x1e1ffa=_0x1cb1eb||client;return _0x1e1ffa[_0x2393('0x23')](_0x392930,_0x362e13)[_0x2393('0x24')](function(_0x511e11){logger['info'](_0x2393('0x25'),_0x45101b,_0x2393('0x26'));logger[_0x2393('0x27')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x45101b,_0x2393('0x26'),JSON['stringify'](_0x511e11));if(_0x511e11['error']){if(_0x511e11[_0x2393('0x28')][_0x2393('0x29')]===0x1f4){logger[_0x2393('0x28')]('ChatGroup,\x20%s,\x20%s',_0x45101b,_0x511e11[_0x2393('0x28')][_0x2393('0x2a')]);return _0x7ffd9f(_0x511e11[_0x2393('0x28')][_0x2393('0x2a')]);}logger[_0x2393('0x28')](_0x2393('0x25'),_0x45101b,_0x511e11['error']['message']);return _0x112035(_0x511e11[_0x2393('0x28')][_0x2393('0x2a')]);}else{logger['info'](_0x2393('0x25'),_0x45101b,_0x2393('0x26'));_0x112035(_0x511e11[_0x2393('0x2b')][_0x2393('0x2a')]);}})[_0x2393('0x2c')](function(_0x568e2a){logger[_0x2393('0x28')](_0x2393('0x25'),_0x45101b,_0x568e2a);_0x7ffd9f(_0x568e2a);});});}function respondWithStatusCode(_0x14ba00,_0x2d7f89){_0x2d7f89=_0x2d7f89||0xcc;return function(_0x30726b){if(_0x30726b){return _0x14ba00[_0x2393('0x2d')](_0x2d7f89);}return _0x14ba00['status'](_0x2d7f89)[_0x2393('0x2e')]();};}function respondWithResult(_0xfa01f5,_0x458d4e){_0x458d4e=_0x458d4e||0xc8;return function(_0x2ae9ca){if(_0x2ae9ca){return _0xfa01f5['status'](_0x458d4e)[_0x2393('0x2f')](_0x2ae9ca);}};}function respondWithFilteredResult(_0x5dbe9d,_0x4732a0){return function(_0xd48553){if(_0xd48553){var _0x462d22=_0xd48553[_0x2393('0x30')],_0x591fa8=_0x4732a0[_0x2393('0x31')],_0x8c0472=_0x4732a0['offset']+_0x4732a0['limit'],_0x2f4247;if(_0x8c0472>=_0x462d22){_0x8c0472=_0x462d22;_0x2f4247=0xc8;}else{_0x2f4247=0xce;}_0x5dbe9d['status'](_0x2f4247);return _0x5dbe9d[_0x2393('0x32')]('Content-Range',_0x591fa8+'-'+_0x8c0472+'/'+_0x462d22)[_0x2393('0x2f')](_0xd48553);}return null;};}function patchUpdates(_0x214aad){return function(_0x5a4f05){try{jsonpatch[_0x2393('0x33')](_0x5a4f05,_0x214aad,!![]);}catch(_0xd9cf2c){return BPromise[_0x2393('0x34')](_0xd9cf2c);}return _0x5a4f05[_0x2393('0x35')]();};}function saveUpdates(_0xc47f3e,_0x251f56){return function(_0x57d6e9){if(_0x57d6e9){return _0x57d6e9[_0x2393('0x36')](_0xc47f3e)['then'](function(_0x25cdf9){return _0x25cdf9;});}return null;};}function removeEntity(_0x38292e,_0x1eac16){return function(_0x226ca1){if(_0x226ca1){return _0x226ca1[_0x2393('0x37')]()[_0x2393('0x24')](function(){_0x38292e[_0x2393('0x38')](0xcc)[_0x2393('0x2e')]();});}};}function handleEntityNotFound(_0x3be209,_0x114e8f){return function(_0x542f96){if(!_0x542f96){_0x3be209['sendStatus'](0x194);}return _0x542f96;};}function handleError(_0x907cb0,_0x42f5b6){_0x42f5b6=_0x42f5b6||0x1f4;return function(_0x29337){logger[_0x2393('0x28')](_0x29337[_0x2393('0x39')]);if(_0x29337[_0x2393('0x3a')]){delete _0x29337[_0x2393('0x3a')];}_0x907cb0[_0x2393('0x38')](_0x42f5b6)[_0x2393('0x3b')](_0x29337);};}exports[_0x2393('0x3c')]=function(_0x4103d4,_0x1acc6f){var _0x150390={},_0x2d419e={},_0x2d2196={'count':0x0,'rows':[]};var _0x8b0500=_[_0x2393('0x3d')](db['ChatGroup'][_0x2393('0x3e')],function(_0x15db5a){return{'name':_0x15db5a[_0x2393('0x3f')],'type':_0x15db5a[_0x2393('0x40')][_0x2393('0x41')]};});_0x2d419e[_0x2393('0x42')]=_[_0x2393('0x3d')](_0x8b0500,'name');_0x2d419e[_0x2393('0x43')]=_[_0x2393('0x44')](_0x4103d4[_0x2393('0x43')]);_0x2d419e[_0x2393('0x45')]=_[_0x2393('0x46')](_0x2d419e[_0x2393('0x42')],_0x2d419e[_0x2393('0x43')]);_0x150390['attributes']=_[_0x2393('0x46')](_0x2d419e[_0x2393('0x42')],qs[_0x2393('0x47')](_0x4103d4[_0x2393('0x43')][_0x2393('0x47')]));_0x150390[_0x2393('0x48')]=_0x150390['attributes']['length']?_0x150390[_0x2393('0x48')]:_0x2d419e[_0x2393('0x42')];if(!_0x4103d4[_0x2393('0x43')][_0x2393('0x49')](_0x2393('0x4a'))){_0x150390[_0x2393('0x4b')]=qs[_0x2393('0x4b')](_0x4103d4['query'][_0x2393('0x4b')]);_0x150390[_0x2393('0x31')]=qs[_0x2393('0x31')](_0x4103d4[_0x2393('0x43')]['offset']);}_0x150390[_0x2393('0x4c')]=qs['sort'](_0x4103d4['query']['sort']);_0x150390[_0x2393('0x4d')]=qs[_0x2393('0x45')](_[_0x2393('0x4e')](_0x4103d4['query'],_0x2d419e[_0x2393('0x45')]),_0x8b0500);if(_0x4103d4[_0x2393('0x43')]['filter']){_0x150390[_0x2393('0x4d')]=_['merge'](_0x150390['where'],{'$or':_[_0x2393('0x3d')](_0x8b0500,function(_0xabe166){if(_0xabe166[_0x2393('0x40')]!==_0x2393('0x4f')){var _0x599226={};_0x599226[_0xabe166[_0x2393('0x3a')]]={'$like':'%'+_0x4103d4[_0x2393('0x43')][_0x2393('0x50')]+'%'};return _0x599226;}})});}_0x150390=_[_0x2393('0x51')]({},_0x150390,_0x4103d4[_0x2393('0x52')]);var _0x536a0e={'where':_0x150390[_0x2393('0x4d')]};return db[_0x2393('0x53')]['count'](_0x536a0e)[_0x2393('0x24')](function(_0x5af617){_0x2d2196['count']=_0x5af617;if(_0x4103d4[_0x2393('0x43')]['includeAll']){_0x150390[_0x2393('0x54')]=[{'all':!![]}];}return db[_0x2393('0x53')]['findAll'](_0x150390);})[_0x2393('0x24')](function(_0x53423b){_0x2d2196['rows']=_0x53423b;return _0x2d2196;})[_0x2393('0x24')](respondWithFilteredResult(_0x1acc6f,_0x150390))['catch'](handleError(_0x1acc6f,null));};exports[_0x2393('0x55')]=function(_0x2ad286,_0x23ac22){var _0x46afb0={'raw':!![],'where':{'id':_0x2ad286[_0x2393('0x56')]['id']}},_0x3fdc9c={};_0x3fdc9c['model']=_[_0x2393('0x44')](db['ChatGroup']['rawAttributes']);_0x3fdc9c[_0x2393('0x43')]=_['keys'](_0x2ad286[_0x2393('0x43')]);_0x3fdc9c[_0x2393('0x45')]=_[_0x2393('0x46')](_0x3fdc9c['model'],_0x3fdc9c[_0x2393('0x43')]);_0x46afb0[_0x2393('0x48')]=_[_0x2393('0x46')](_0x3fdc9c[_0x2393('0x42')],qs[_0x2393('0x47')](_0x2ad286[_0x2393('0x43')][_0x2393('0x47')]));_0x46afb0['attributes']=_0x46afb0[_0x2393('0x48')]['length']?_0x46afb0[_0x2393('0x48')]:_0x3fdc9c['model'];if(_0x2ad286[_0x2393('0x43')][_0x2393('0x57')]){_0x46afb0[_0x2393('0x54')]=[{'all':!![]}];}_0x46afb0=_[_0x2393('0x51')]({},_0x46afb0,_0x2ad286['options']);return db['ChatGroup']['find'](_0x46afb0)[_0x2393('0x24')](handleEntityNotFound(_0x23ac22,null))['then'](respondWithResult(_0x23ac22,null))[_0x2393('0x2c')](handleError(_0x23ac22,null));};exports[_0x2393('0x58')]=function(_0x2c635b,_0x4ca406){return db[_0x2393('0x53')][_0x2393('0x58')](_0x2c635b[_0x2393('0x59')],{})[_0x2393('0x24')](respondWithResult(_0x4ca406,0xc9))['catch'](handleError(_0x4ca406,null));};exports[_0x2393('0x36')]=function(_0x5ecedc,_0x1bb087){if(_0x5ecedc[_0x2393('0x59')]['id']){delete _0x5ecedc[_0x2393('0x59')]['id'];}return db[_0x2393('0x53')][_0x2393('0x5a')]({'where':{'id':_0x5ecedc[_0x2393('0x56')]['id']}})[_0x2393('0x24')](handleEntityNotFound(_0x1bb087,null))[_0x2393('0x24')](saveUpdates(_0x5ecedc[_0x2393('0x59')],null))[_0x2393('0x24')](respondWithResult(_0x1bb087,null))['catch'](handleError(_0x1bb087,null));};exports['destroy']=function(_0x17f8c6,_0x18a90d){return db['ChatGroup'][_0x2393('0x5a')]({'where':{'id':_0x17f8c6[_0x2393('0x56')]['id']}})[_0x2393('0x24')](handleEntityNotFound(_0x18a90d,null))[_0x2393('0x24')](removeEntity(_0x18a90d,null))[_0x2393('0x2c')](handleError(_0x18a90d,null));};exports[_0x2393('0x5b')]=function(_0x2d0419,_0x1957f3){return db[_0x2393('0x53')][_0x2393('0x5b')]()[_0x2393('0x24')](respondWithResult(_0x1957f3,null))[_0x2393('0x2c')](handleError(_0x1957f3,null));};exports[_0x2393('0x5c')]=function(_0x4434b6,_0x162fc5,_0x37c9d5){return db[_0x2393('0x5d')][_0x2393('0x30')]({'where':{'ChatGroupId':_0x4434b6[_0x2393('0x56')]['id'],'ToId':_0x4434b6[_0x2393('0x5e')]['id'],'read':![]}})[_0x2393('0x24')](function(_0x3d49cc){return{'id':_[_0x2393('0x5f')](_0x4434b6[_0x2393('0x56')]['id']),'count':_0x3d49cc};})[_0x2393('0x24')](respondWithResult(_0x162fc5,null))[_0x2393('0x2c')](handleError(_0x162fc5,null));};exports['addMembers']=function(_0xae328b,_0x4f1ec7,_0x1c8a3){return db['ChatGroup'][_0x2393('0x5a')]({'where':{'id':_0xae328b[_0x2393('0x56')]['id']}})[_0x2393('0x24')](handleEntityNotFound(_0x4f1ec7,null))[_0x2393('0x24')](function(_0x586e3f){if(_0x586e3f){return _0x586e3f[_0x2393('0x60')](_0xae328b[_0x2393('0x59')][_0x2393('0x61')],_[_0x2393('0x62')](_0xae328b[_0x2393('0x59')],[_0x2393('0x61'),'id'])||{});}})[_0x2393('0x24')](respondWithResult(_0x4f1ec7,null))['catch'](handleError(_0x4f1ec7,null));};exports[_0x2393('0x63')]=function(_0x26ffad,_0x184d72,_0x3564bd){var _0x58b239={};var _0x1113d4={};var _0x2a8837;var _0x10d7b6;return db['ChatGroup']['findOne']({'where':{'id':_0x26ffad['params']['id']}})['then'](handleEntityNotFound(_0x184d72,null))['then'](function(_0x344be7){if(_0x344be7){_0x2a8837=_0x344be7;_0x1113d4[_0x2393('0x42')]=_['keys'](db['User'][_0x2393('0x3e')]);_0x1113d4[_0x2393('0x43')]=_[_0x2393('0x44')](_0x26ffad['query']);_0x1113d4[_0x2393('0x45')]=_[_0x2393('0x46')](_0x1113d4[_0x2393('0x42')],_0x1113d4[_0x2393('0x43')]);_0x58b239[_0x2393('0x48')]=_[_0x2393('0x46')](_0x1113d4[_0x2393('0x42')],qs[_0x2393('0x47')](_0x26ffad['query'][_0x2393('0x47')]));_0x58b239['attributes']=_0x58b239[_0x2393('0x48')][_0x2393('0x64')]?_0x58b239[_0x2393('0x48')]:_0x1113d4[_0x2393('0x42')];_0x58b239[_0x2393('0x4c')]=qs[_0x2393('0x65')](_0x26ffad[_0x2393('0x43')][_0x2393('0x65')]);_0x58b239[_0x2393('0x4d')]=qs[_0x2393('0x45')](_[_0x2393('0x4e')](_0x26ffad[_0x2393('0x43')],_0x1113d4[_0x2393('0x45')]));if(_0x26ffad[_0x2393('0x43')][_0x2393('0x50')]){_0x58b239['where']=_['merge'](_0x58b239[_0x2393('0x4d')],{'$or':_['map'](_0x58b239[_0x2393('0x48')],function(_0x25fc4b){var _0x395a0d={};_0x395a0d[_0x25fc4b]={'$like':'%'+_0x26ffad[_0x2393('0x43')][_0x2393('0x50')]+'%'};return _0x395a0d;})});}_0x58b239=_['merge']({},_0x58b239,_0x26ffad['options']);return _0x2a8837[_0x2393('0x63')](_0x58b239);}})[_0x2393('0x24')](function(_0x5e5210){if(_0x5e5210){_0x10d7b6=_0x5e5210[_0x2393('0x64')];if(!_0x26ffad[_0x2393('0x43')][_0x2393('0x49')](_0x2393('0x4a'))){_0x58b239[_0x2393('0x4b')]=qs[_0x2393('0x4b')](_0x26ffad[_0x2393('0x43')][_0x2393('0x4b')]);_0x58b239[_0x2393('0x31')]=qs[_0x2393('0x31')](_0x26ffad[_0x2393('0x43')]['offset']);}return _0x2a8837['getMembers'](_0x58b239);}})['then'](function(_0x742f5f){if(_0x742f5f){return _0x742f5f?{'count':_0x10d7b6,'rows':_0x742f5f}:null;}})['then'](respondWithResult(_0x184d72,null))['catch'](handleError(_0x184d72,null));};exports['removeMembers']=function(_0x37afd3,_0x216db8,_0x5cfc80){return db[_0x2393('0x53')]['find']({'where':{'id':_0x37afd3[_0x2393('0x56')]['id']}})[_0x2393('0x24')](handleEntityNotFound(_0x216db8,null))[_0x2393('0x24')](function(_0x5dbe32){if(_0x5dbe32){return _0x5dbe32[_0x2393('0x66')](_0x37afd3[_0x2393('0x43')][_0x2393('0x61')]);}})[_0x2393('0x24')](respondWithStatusCode(_0x216db8,null))['catch'](handleError(_0x216db8,null));};exports['addMessage']=function(_0x308daf,_0x50613d,_0x1e7ceb){if(_0x308daf[_0x2393('0x59')]['id']){delete _0x308daf['body']['id'];}return db[_0x2393('0x53')][_0x2393('0x5a')]({'where':{'id':_0x308daf['params']['id']}})[_0x2393('0x24')](handleEntityNotFound(_0x50613d,null))['then'](function(_0x1bfe1c){if(_0x1bfe1c){_0x308daf[_0x2393('0x59')]['ChatGroupId']=_0x1bfe1c['id'];return db[_0x2393('0x5d')][_0x2393('0x58')](_0x308daf['body']);}})[_0x2393('0x24')](respondWithResult(_0x50613d,null))[_0x2393('0x2c')](handleError(_0x50613d,null));};exports[_0x2393('0x67')]=function(_0xcf8651,_0x35ebde,_0x459099){var _0x43e2ab={};var _0x1f54a9={};var _0x283d72;var _0x10b83e;return db[_0x2393('0x53')]['findOne']({'where':{'id':_0xcf8651[_0x2393('0x56')]['id']}})[_0x2393('0x24')](handleEntityNotFound(_0x35ebde,null))[_0x2393('0x24')](function(_0x37acc6){if(_0x37acc6){_0x283d72=_0x37acc6;_0x1f54a9['model']=_[_0x2393('0x44')](db[_0x2393('0x5d')][_0x2393('0x3e')]);_0x1f54a9[_0x2393('0x43')]=_[_0x2393('0x44')](_0xcf8651[_0x2393('0x43')]);_0x1f54a9[_0x2393('0x45')]=_[_0x2393('0x46')](_0x1f54a9['model'],_0x1f54a9[_0x2393('0x43')]);_0x43e2ab[_0x2393('0x48')]=_['intersection'](_0x1f54a9[_0x2393('0x42')],qs[_0x2393('0x47')](_0xcf8651[_0x2393('0x43')][_0x2393('0x47')]));_0x43e2ab[_0x2393('0x48')]=_0x43e2ab['attributes'][_0x2393('0x64')]?_0x43e2ab['attributes']:_0x1f54a9['model'];_0x43e2ab['order']=qs[_0x2393('0x65')](_0xcf8651[_0x2393('0x43')][_0x2393('0x65')]);_0x43e2ab[_0x2393('0x4d')]=qs[_0x2393('0x45')](_['pick'](_0xcf8651[_0x2393('0x43')],_0x1f54a9[_0x2393('0x45')]));if(_0xcf8651[_0x2393('0x43')][_0x2393('0x50')]){_0x43e2ab[_0x2393('0x4d')]=_['merge'](_0x43e2ab['where'],{'$or':_['map'](_0x43e2ab['attributes'],function(_0x5b0b9c){var _0x20a40c={};_0x20a40c[_0x5b0b9c]={'$like':'%'+_0xcf8651[_0x2393('0x43')][_0x2393('0x50')]+'%'};return _0x20a40c;})});}if(_0xcf8651[_0x2393('0x43')][_0x2393('0x68')]){var _0x5da879=_0xcf8651[_0x2393('0x43')][_0x2393('0x68')][_0x2393('0x69')](',');var _0x5e0ee9={};_0x5e0ee9[_0x5da879[0x0]]={'$gte':moment(_0x5da879[0x1])['format'](_0x2393('0x6a'))};_0x43e2ab[_0x2393('0x4d')]=_[_0x2393('0x51')](_0x43e2ab[_0x2393('0x4d')],_0x5e0ee9);}_0x43e2ab=_[_0x2393('0x51')]({},_0x43e2ab,_0xcf8651['options']);return _0x283d72[_0x2393('0x67')](_0x43e2ab);}})['then'](function(_0x153244){if(_0x153244){_0x10b83e=_0x153244[_0x2393('0x64')];if(!_0xcf8651[_0x2393('0x43')][_0x2393('0x49')](_0x2393('0x4a'))){_0x43e2ab['limit']=qs[_0x2393('0x4b')](_0xcf8651[_0x2393('0x43')][_0x2393('0x4b')]);_0x43e2ab[_0x2393('0x31')]=qs[_0x2393('0x31')](_0xcf8651[_0x2393('0x43')][_0x2393('0x31')]);}return _0x283d72[_0x2393('0x67')](_0x43e2ab);}})[_0x2393('0x24')](function(_0x3226a8){if(_0x3226a8){return _0x3226a8?{'count':_0x10b83e,'rows':_0x3226a8}:null;}})[_0x2393('0x24')](respondWithResult(_0x35ebde,null))[_0x2393('0x2c')](handleError(_0x35ebde,null));}; \ No newline at end of file +var _0x5d57=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','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','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','destroy','end','stack','name','send','index','map','ChatGroup','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','User','options','removeMembers','addMessage','getMessages','pick','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x1f7420,_0x46922d){var _0x5574ac=function(_0x48f0e4){while(--_0x48f0e4){_0x1f7420['push'](_0x1f7420['shift']());}};_0x5574ac(++_0x46922d);}(_0x5d57,0x1b4));var _0x75d5=function(_0x2d110d,_0x163b61){_0x2d110d=_0x2d110d-0x0;var _0x643c91=_0x5d57[_0x2d110d];return _0x643c91;};'use strict';var pdf=require(_0x75d5('0x0'));var emlformat=require(_0x75d5('0x1'));var rimraf=require(_0x75d5('0x2'));var zipdir=require(_0x75d5('0x3'));var jsonpatch=require(_0x75d5('0x4'));var rp=require('request-promise');var moment=require(_0x75d5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x75d5('0x6'));var util=require(_0x75d5('0x7'));var path=require(_0x75d5('0x8'));var sox=require(_0x75d5('0x9'));var csv=require(_0x75d5('0xa'));var ejs=require(_0x75d5('0xb'));var fs=require('fs');var _=require(_0x75d5('0xc'));var squel=require(_0x75d5('0xd'));var crypto=require(_0x75d5('0xe'));var jsforce=require(_0x75d5('0xf'));var deskjs=require(_0x75d5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x75d5('0x11'));var Papa=require('papaparse');var Redis=require(_0x75d5('0x12'));var authService=require(_0x75d5('0x13'));var qs=require(_0x75d5('0x14'));var as=require(_0x75d5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x75d5('0x16'));var utils=require(_0x75d5('0x17'));var config=require(_0x75d5('0x18'));var db=require(_0x75d5('0x19'))['db'];config[_0x75d5('0x1a')]=_[_0x75d5('0x1b')](config[_0x75d5('0x1a')],{'host':_0x75d5('0x1c'),'port':0x18eb});var socket=require(_0x75d5('0x1d'))(new Redis(config[_0x75d5('0x1a')]));require(_0x75d5('0x1e'))[_0x75d5('0x1f')](socket);var jayson=require(_0x75d5('0x20'));var client=jayson[_0x75d5('0x21')][_0x75d5('0x22')]({'port':0x232a});function checkPasswordPattern(_0x5511e9,_0xcc513d,_0x52007c){if(_0x52007c){var _0x10fa48=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10fa48['test'](_0xcc513d)){return _0x5511e9;}else{throw new db['Sequelize'][(_0x75d5('0x23'))](_0x75d5('0x24'));}}else{return _0x5511e9;}}function respondWithRpcPromise(_0x2eb867,_0x2bed4f,_0x496628,_0xbba0dc){return new BPromise(function(_0x277aae,_0x236a23){var _0x4f4a23=_0xbba0dc||client;return _0x4f4a23[_0x75d5('0x25')](_0x2eb867,_0x496628)[_0x75d5('0x26')](function(_0x242e74){logger[_0x75d5('0x27')](_0x75d5('0x28'),_0x2bed4f,_0x75d5('0x29'));logger[_0x75d5('0x2a')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2bed4f,_0x75d5('0x29'),JSON[_0x75d5('0x2b')](_0x242e74));if(_0x242e74[_0x75d5('0x2c')]){if(_0x242e74[_0x75d5('0x2c')][_0x75d5('0x2d')]===0x1f4){logger[_0x75d5('0x2c')](_0x75d5('0x28'),_0x2bed4f,_0x242e74[_0x75d5('0x2c')][_0x75d5('0x2e')]);return _0x236a23(_0x242e74[_0x75d5('0x2c')][_0x75d5('0x2e')]);}logger[_0x75d5('0x2c')](_0x75d5('0x28'),_0x2bed4f,_0x242e74[_0x75d5('0x2c')][_0x75d5('0x2e')]);return _0x277aae(_0x242e74[_0x75d5('0x2c')]['message']);}else{logger['info'](_0x75d5('0x28'),_0x2bed4f,_0x75d5('0x29'));_0x277aae(_0x242e74['result'][_0x75d5('0x2e')]);}})[_0x75d5('0x2f')](function(_0x40ee0b){logger['error'](_0x75d5('0x28'),_0x2bed4f,_0x40ee0b);_0x236a23(_0x40ee0b);});});}function respondWithStatusCode(_0x1f7665,_0xed456c){_0xed456c=_0xed456c||0xcc;return function(_0x108a1b){if(_0x108a1b){return _0x1f7665[_0x75d5('0x30')](_0xed456c);}return _0x1f7665[_0x75d5('0x31')](_0xed456c)['end']();};}function respondWithResult(_0x6ae8fa,_0x36085b){_0x36085b=_0x36085b||0xc8;return function(_0x49d7de){if(_0x49d7de){return _0x6ae8fa[_0x75d5('0x31')](_0x36085b)[_0x75d5('0x32')](_0x49d7de);}};}function respondWithFilteredResult(_0xe336ef,_0x51131a){return function(_0x3a949d){if(_0x3a949d){var _0x22a7d9=_0x3a949d[_0x75d5('0x33')],_0x30d6be=_0x51131a[_0x75d5('0x34')],_0x1ced01=_0x51131a[_0x75d5('0x34')]+_0x51131a[_0x75d5('0x35')],_0x58b447;if(_0x1ced01>=_0x22a7d9){_0x1ced01=_0x22a7d9;_0x58b447=0xc8;}else{_0x58b447=0xce;}_0xe336ef['status'](_0x58b447);return _0xe336ef[_0x75d5('0x36')]('Content-Range',_0x30d6be+'-'+_0x1ced01+'/'+_0x22a7d9)[_0x75d5('0x32')](_0x3a949d);}return null;};}function patchUpdates(_0xa9640c){return function(_0x56f1ba){try{jsonpatch[_0x75d5('0x37')](_0x56f1ba,_0xa9640c,!![]);}catch(_0x4e8076){return BPromise[_0x75d5('0x38')](_0x4e8076);}return _0x56f1ba[_0x75d5('0x39')]();};}function saveUpdates(_0x354390,_0x1ab555){return function(_0x13554d){if(_0x13554d){return _0x13554d['update'](_0x354390)['then'](function(_0x4894c8){return _0x4894c8;});}return null;};}function removeEntity(_0x409405,_0x398044){return function(_0x4c4816){if(_0x4c4816){return _0x4c4816[_0x75d5('0x3a')]()[_0x75d5('0x26')](function(){_0x409405['status'](0xcc)[_0x75d5('0x3b')]();});}};}function handleEntityNotFound(_0x3441b9,_0x26ca22){return function(_0x11465c){if(!_0x11465c){_0x3441b9[_0x75d5('0x30')](0x194);}return _0x11465c;};}function handleError(_0x514357,_0x19d360){_0x19d360=_0x19d360||0x1f4;return function(_0x43799b){logger[_0x75d5('0x2c')](_0x43799b[_0x75d5('0x3c')]);if(_0x43799b[_0x75d5('0x3d')]){delete _0x43799b[_0x75d5('0x3d')];}_0x514357[_0x75d5('0x31')](_0x19d360)[_0x75d5('0x3e')](_0x43799b);};}exports[_0x75d5('0x3f')]=function(_0x2bd9b4,_0x1fa85d){var _0x53832e={},_0x145c6e={},_0x3b0f15={'count':0x0,'rows':[]};var _0x1c3770=_[_0x75d5('0x40')](db[_0x75d5('0x41')][_0x75d5('0x42')],function(_0x1ffe67){return{'name':_0x1ffe67['fieldName'],'type':_0x1ffe67['type'][_0x75d5('0x43')]};});_0x145c6e[_0x75d5('0x44')]=_[_0x75d5('0x40')](_0x1c3770,_0x75d5('0x3d'));_0x145c6e[_0x75d5('0x45')]=_[_0x75d5('0x46')](_0x2bd9b4[_0x75d5('0x45')]);_0x145c6e[_0x75d5('0x47')]=_['intersection'](_0x145c6e[_0x75d5('0x44')],_0x145c6e[_0x75d5('0x45')]);_0x53832e[_0x75d5('0x48')]=_[_0x75d5('0x49')](_0x145c6e['model'],qs['fields'](_0x2bd9b4[_0x75d5('0x45')][_0x75d5('0x4a')]));_0x53832e['attributes']=_0x53832e[_0x75d5('0x48')][_0x75d5('0x4b')]?_0x53832e[_0x75d5('0x48')]:_0x145c6e[_0x75d5('0x44')];if(!_0x2bd9b4[_0x75d5('0x45')][_0x75d5('0x4c')](_0x75d5('0x4d'))){_0x53832e['limit']=qs[_0x75d5('0x35')](_0x2bd9b4['query']['limit']);_0x53832e[_0x75d5('0x34')]=qs[_0x75d5('0x34')](_0x2bd9b4[_0x75d5('0x45')]['offset']);}_0x53832e['order']=qs[_0x75d5('0x4e')](_0x2bd9b4[_0x75d5('0x45')]['sort']);_0x53832e[_0x75d5('0x4f')]=qs[_0x75d5('0x47')](_['pick'](_0x2bd9b4['query'],_0x145c6e['filters']),_0x1c3770);if(_0x2bd9b4[_0x75d5('0x45')][_0x75d5('0x50')]){_0x53832e['where']=_[_0x75d5('0x51')](_0x53832e[_0x75d5('0x4f')],{'$or':_[_0x75d5('0x40')](_0x1c3770,function(_0x3c862d){if(_0x3c862d[_0x75d5('0x52')]!==_0x75d5('0x53')){var _0x1087a6={};_0x1087a6[_0x3c862d[_0x75d5('0x3d')]]={'$like':'%'+_0x2bd9b4[_0x75d5('0x45')]['filter']+'%'};return _0x1087a6;}})});}_0x53832e=_[_0x75d5('0x51')]({},_0x53832e,_0x2bd9b4['options']);var _0x44c9fb={'where':_0x53832e['where']};return db[_0x75d5('0x41')][_0x75d5('0x33')](_0x44c9fb)[_0x75d5('0x26')](function(_0x5b58ce){_0x3b0f15[_0x75d5('0x33')]=_0x5b58ce;if(_0x2bd9b4['query'][_0x75d5('0x54')]){_0x53832e[_0x75d5('0x55')]=[{'all':!![]}];}return db[_0x75d5('0x41')][_0x75d5('0x56')](_0x53832e);})[_0x75d5('0x26')](function(_0x5ed754){_0x3b0f15[_0x75d5('0x57')]=_0x5ed754;return _0x3b0f15;})['then'](respondWithFilteredResult(_0x1fa85d,_0x53832e))[_0x75d5('0x2f')](handleError(_0x1fa85d,null));};exports[_0x75d5('0x58')]=function(_0x372cfb,_0x22765e){var _0x3787d4={'raw':!![],'where':{'id':_0x372cfb[_0x75d5('0x59')]['id']}},_0x358613={};_0x358613[_0x75d5('0x44')]=_[_0x75d5('0x46')](db[_0x75d5('0x41')][_0x75d5('0x42')]);_0x358613[_0x75d5('0x45')]=_[_0x75d5('0x46')](_0x372cfb[_0x75d5('0x45')]);_0x358613['filters']=_[_0x75d5('0x49')](_0x358613[_0x75d5('0x44')],_0x358613[_0x75d5('0x45')]);_0x3787d4['attributes']=_[_0x75d5('0x49')](_0x358613['model'],qs[_0x75d5('0x4a')](_0x372cfb[_0x75d5('0x45')][_0x75d5('0x4a')]));_0x3787d4['attributes']=_0x3787d4[_0x75d5('0x48')][_0x75d5('0x4b')]?_0x3787d4[_0x75d5('0x48')]:_0x358613['model'];if(_0x372cfb['query'][_0x75d5('0x54')]){_0x3787d4[_0x75d5('0x55')]=[{'all':!![]}];}_0x3787d4=_[_0x75d5('0x51')]({},_0x3787d4,_0x372cfb['options']);return db[_0x75d5('0x41')]['find'](_0x3787d4)[_0x75d5('0x26')](handleEntityNotFound(_0x22765e,null))[_0x75d5('0x26')](respondWithResult(_0x22765e,null))['catch'](handleError(_0x22765e,null));};exports[_0x75d5('0x5a')]=function(_0xe45544,_0x387852){return db[_0x75d5('0x41')][_0x75d5('0x5a')](_0xe45544[_0x75d5('0x5b')],{})[_0x75d5('0x26')](respondWithResult(_0x387852,0xc9))['catch'](handleError(_0x387852,null));};exports['update']=function(_0x4046e6,_0x52a811){if(_0x4046e6[_0x75d5('0x5b')]['id']){delete _0x4046e6[_0x75d5('0x5b')]['id'];}return db['ChatGroup'][_0x75d5('0x5c')]({'where':{'id':_0x4046e6['params']['id']}})[_0x75d5('0x26')](handleEntityNotFound(_0x52a811,null))['then'](saveUpdates(_0x4046e6[_0x75d5('0x5b')],null))['then'](respondWithResult(_0x52a811,null))[_0x75d5('0x2f')](handleError(_0x52a811,null));};exports[_0x75d5('0x3a')]=function(_0x4728ac,_0x5d454b){return db['ChatGroup'][_0x75d5('0x5c')]({'where':{'id':_0x4728ac[_0x75d5('0x59')]['id']}})[_0x75d5('0x26')](handleEntityNotFound(_0x5d454b,null))['then'](removeEntity(_0x5d454b,null))[_0x75d5('0x2f')](handleError(_0x5d454b,null));};exports['describe']=function(_0x17a9d1,_0x3883fc){return db[_0x75d5('0x41')][_0x75d5('0x5d')]()['then'](respondWithResult(_0x3883fc,null))['catch'](handleError(_0x3883fc,null));};exports[_0x75d5('0x5e')]=function(_0x1e6c79,_0x29f993,_0x4e2410){return db[_0x75d5('0x5f')]['count']({'where':{'ChatGroupId':_0x1e6c79['params']['id'],'ToId':_0x1e6c79[_0x75d5('0x60')]['id'],'read':![]}})[_0x75d5('0x26')](function(_0x36bf76){return{'id':_[_0x75d5('0x61')](_0x1e6c79[_0x75d5('0x59')]['id']),'count':_0x36bf76};})[_0x75d5('0x26')](respondWithResult(_0x29f993,null))[_0x75d5('0x2f')](handleError(_0x29f993,null));};exports[_0x75d5('0x62')]=function(_0x1daaf5,_0x45aa6e,_0x50f5f4){return db['ChatGroup'][_0x75d5('0x5c')]({'where':{'id':_0x1daaf5[_0x75d5('0x59')]['id']}})[_0x75d5('0x26')](handleEntityNotFound(_0x45aa6e,null))['then'](function(_0x4970c2){if(_0x4970c2){return _0x4970c2[_0x75d5('0x62')](_0x1daaf5['body']['ids'],_['omit'](_0x1daaf5[_0x75d5('0x5b')],[_0x75d5('0x63'),'id'])||{});}})[_0x75d5('0x26')](respondWithResult(_0x45aa6e,null))['catch'](handleError(_0x45aa6e,null));};exports[_0x75d5('0x64')]=function(_0x342812,_0x2aa55d,_0x1d8dce){var _0x30a6dd={};var _0x21573d={};var _0x4e7357;var _0x36fc26;return db[_0x75d5('0x41')][_0x75d5('0x65')]({'where':{'id':_0x342812[_0x75d5('0x59')]['id']}})[_0x75d5('0x26')](handleEntityNotFound(_0x2aa55d,null))['then'](function(_0x5e93dc){if(_0x5e93dc){_0x4e7357=_0x5e93dc;_0x21573d[_0x75d5('0x44')]=_[_0x75d5('0x46')](db[_0x75d5('0x66')]['rawAttributes']);_0x21573d['query']=_[_0x75d5('0x46')](_0x342812['query']);_0x21573d['filters']=_[_0x75d5('0x49')](_0x21573d[_0x75d5('0x44')],_0x21573d['query']);_0x30a6dd['attributes']=_[_0x75d5('0x49')](_0x21573d[_0x75d5('0x44')],qs[_0x75d5('0x4a')](_0x342812[_0x75d5('0x45')][_0x75d5('0x4a')]));_0x30a6dd['attributes']=_0x30a6dd[_0x75d5('0x48')]['length']?_0x30a6dd[_0x75d5('0x48')]:_0x21573d[_0x75d5('0x44')];_0x30a6dd['order']=qs[_0x75d5('0x4e')](_0x342812[_0x75d5('0x45')][_0x75d5('0x4e')]);_0x30a6dd['where']=qs[_0x75d5('0x47')](_['pick'](_0x342812['query'],_0x21573d[_0x75d5('0x47')]));if(_0x342812['query'][_0x75d5('0x50')]){_0x30a6dd['where']=_[_0x75d5('0x51')](_0x30a6dd[_0x75d5('0x4f')],{'$or':_[_0x75d5('0x40')](_0x30a6dd[_0x75d5('0x48')],function(_0x2416c3){var _0x3e2e99={};_0x3e2e99[_0x2416c3]={'$like':'%'+_0x342812[_0x75d5('0x45')][_0x75d5('0x50')]+'%'};return _0x3e2e99;})});}_0x30a6dd=_[_0x75d5('0x51')]({},_0x30a6dd,_0x342812[_0x75d5('0x67')]);return _0x4e7357[_0x75d5('0x64')](_0x30a6dd);}})[_0x75d5('0x26')](function(_0x414614){if(_0x414614){_0x36fc26=_0x414614[_0x75d5('0x4b')];if(!_0x342812[_0x75d5('0x45')]['hasOwnProperty'](_0x75d5('0x4d'))){_0x30a6dd[_0x75d5('0x35')]=qs[_0x75d5('0x35')](_0x342812[_0x75d5('0x45')][_0x75d5('0x35')]);_0x30a6dd['offset']=qs[_0x75d5('0x34')](_0x342812[_0x75d5('0x45')][_0x75d5('0x34')]);}return _0x4e7357['getMembers'](_0x30a6dd);}})[_0x75d5('0x26')](function(_0x45e0a6){if(_0x45e0a6){return _0x45e0a6?{'count':_0x36fc26,'rows':_0x45e0a6}:null;}})['then'](respondWithResult(_0x2aa55d,null))[_0x75d5('0x2f')](handleError(_0x2aa55d,null));};exports[_0x75d5('0x68')]=function(_0x91648,_0x415ba3,_0x4b6ac3){return db['ChatGroup'][_0x75d5('0x5c')]({'where':{'id':_0x91648[_0x75d5('0x59')]['id']}})['then'](handleEntityNotFound(_0x415ba3,null))['then'](function(_0x3f0878){if(_0x3f0878){return _0x3f0878[_0x75d5('0x68')](_0x91648['query'][_0x75d5('0x63')]);}})[_0x75d5('0x26')](respondWithStatusCode(_0x415ba3,null))['catch'](handleError(_0x415ba3,null));};exports[_0x75d5('0x69')]=function(_0x1ce99a,_0x3abf6b,_0xd71e2d){if(_0x1ce99a['body']['id']){delete _0x1ce99a[_0x75d5('0x5b')]['id'];}return db[_0x75d5('0x41')][_0x75d5('0x5c')]({'where':{'id':_0x1ce99a[_0x75d5('0x59')]['id']}})['then'](handleEntityNotFound(_0x3abf6b,null))[_0x75d5('0x26')](function(_0x2c6f7c){if(_0x2c6f7c){_0x1ce99a['body']['ChatGroupId']=_0x2c6f7c['id'];return db[_0x75d5('0x5f')]['create'](_0x1ce99a[_0x75d5('0x5b')]);}})[_0x75d5('0x26')](respondWithResult(_0x3abf6b,null))['catch'](handleError(_0x3abf6b,null));};exports[_0x75d5('0x6a')]=function(_0x51f99d,_0x42893f,_0x99252b){var _0x55c105={};var _0x19dfa9={};var _0x3505f3;var _0x5c7c63;return db[_0x75d5('0x41')][_0x75d5('0x65')]({'where':{'id':_0x51f99d[_0x75d5('0x59')]['id']}})[_0x75d5('0x26')](handleEntityNotFound(_0x42893f,null))[_0x75d5('0x26')](function(_0xdc8f82){if(_0xdc8f82){_0x3505f3=_0xdc8f82;_0x19dfa9[_0x75d5('0x44')]=_['keys'](db[_0x75d5('0x5f')]['rawAttributes']);_0x19dfa9['query']=_[_0x75d5('0x46')](_0x51f99d[_0x75d5('0x45')]);_0x19dfa9[_0x75d5('0x47')]=_['intersection'](_0x19dfa9['model'],_0x19dfa9['query']);_0x55c105['attributes']=_[_0x75d5('0x49')](_0x19dfa9[_0x75d5('0x44')],qs[_0x75d5('0x4a')](_0x51f99d[_0x75d5('0x45')][_0x75d5('0x4a')]));_0x55c105[_0x75d5('0x48')]=_0x55c105[_0x75d5('0x48')][_0x75d5('0x4b')]?_0x55c105['attributes']:_0x19dfa9[_0x75d5('0x44')];_0x55c105['order']=qs[_0x75d5('0x4e')](_0x51f99d[_0x75d5('0x45')][_0x75d5('0x4e')]);_0x55c105['where']=qs['filters'](_[_0x75d5('0x6b')](_0x51f99d[_0x75d5('0x45')],_0x19dfa9[_0x75d5('0x47')]));if(_0x51f99d[_0x75d5('0x45')]['filter']){_0x55c105[_0x75d5('0x4f')]=_['merge'](_0x55c105[_0x75d5('0x4f')],{'$or':_['map'](_0x55c105[_0x75d5('0x48')],function(_0x2d842f){var _0x50c831={};_0x50c831[_0x2d842f]={'$like':'%'+_0x51f99d[_0x75d5('0x45')][_0x75d5('0x50')]+'%'};return _0x50c831;})});}if(_0x51f99d[_0x75d5('0x45')]['$gte']){var _0x4f70b2=_0x51f99d[_0x75d5('0x45')]['$gte'][_0x75d5('0x6c')](',');var _0x584187={};_0x584187[_0x4f70b2[0x0]]={'$gte':moment(_0x4f70b2[0x1])[_0x75d5('0x6d')](_0x75d5('0x6e'))};_0x55c105[_0x75d5('0x4f')]=_['merge'](_0x55c105[_0x75d5('0x4f')],_0x584187);}_0x55c105=_[_0x75d5('0x51')]({},_0x55c105,_0x51f99d[_0x75d5('0x67')]);return _0x3505f3['getMessages'](_0x55c105);}})[_0x75d5('0x26')](function(_0x45c676){if(_0x45c676){_0x5c7c63=_0x45c676['length'];if(!_0x51f99d[_0x75d5('0x45')][_0x75d5('0x4c')](_0x75d5('0x4d'))){_0x55c105[_0x75d5('0x35')]=qs[_0x75d5('0x35')](_0x51f99d[_0x75d5('0x45')][_0x75d5('0x35')]);_0x55c105[_0x75d5('0x34')]=qs[_0x75d5('0x34')](_0x51f99d[_0x75d5('0x45')][_0x75d5('0x34')]);}return _0x3505f3[_0x75d5('0x6a')](_0x55c105);}})['then'](function(_0x5e3f97){if(_0x5e3f97){return _0x5e3f97?{'count':_0x5c7c63,'rows':_0x5e3f97}:null;}})[_0x75d5('0x26')](respondWithResult(_0x42893f,null))[_0x75d5('0x2f')](handleError(_0x42893f,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 91fcf4b..fe5cd40 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 _0xb10b=['hasOwnProperty','hook','events','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0xb066af,_0x5b9f1e){var _0x42ca5a=function(_0x5281eb){while(--_0x5281eb){_0xb066af['push'](_0xb066af['shift']());}};_0x42ca5a(++_0x5b9f1e);}(_0xb10b,0x12a));var _0xbb10=function(_0x24d22f,_0xfa6241){_0x24d22f=_0x24d22f-0x0;var _0x33b153=_0xb10b[_0x24d22f];return _0x33b153;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatGroupEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatGroupEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatGroup[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0xadb5,0xad));var _0x5adb=function(_0x5b1760,_0x3f8f30){_0x5b1760=_0x5b1760-0x0;var _0x591c5d=_0xadb5[_0x5b1760];return _0x591c5d;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index d7eb392..8957f6a 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 _0xa751=['chat_groups','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','ChatGroup'];(function(_0x25a92f,_0x352bf0){var _0x1e43fe=function(_0x467615){while(--_0x467615){_0x25a92f['push'](_0x25a92f['shift']());}};_0x1e43fe(++_0x352bf0);}(_0xa751,0x175));var _0x1a75=function(_0x5c59c7,_0xa2f0f6){_0x5c59c7=_0x5c59c7-0x0;var _0x1ffa06=_0xa751[_0x5c59c7];return _0x1ffa06;};'use strict';var _=require(_0x1a75('0x0'));var util=require(_0x1a75('0x1'));var logger=require(_0x1a75('0x2'))(_0x1a75('0x3'));var moment=require('moment');var BPromise=require(_0x1a75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a75('0x5'));var rimraf=require(_0x1a75('0x6'));var config=require(_0x1a75('0x7'));var attributes=require('./chatGroup.attributes');module[_0x1a75('0x8')]=function(_0x220b14,_0x1719c1){return _0x220b14[_0x1a75('0x9')](_0x1a75('0xa'),attributes,{'tableName':_0x1a75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a5a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x9a5a,0x194));var _0xa9a5=function(_0x547691,_0x4b57ca){_0x547691=_0x547691-0x0;var _0x3bc0c1=_0x9a5a[_0x547691];return _0x3bc0c1;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var logger=require(_0xa9a5('0x2'))(_0xa9a5('0x3'));var moment=require(_0xa9a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9a5('0x5'));var fs=require('fs');var path=require(_0xa9a5('0x6'));var rimraf=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var attributes=require(_0xa9a5('0x9'));module[_0xa9a5('0xa')]=function(_0x4a73f4,_0xb0ccd9){return _0x4a73f4[_0xa9a5('0xb')](_0xa9a5('0xc'),attributes,{'tableName':_0xa9a5('0xd'),'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 cfd271f..8190113 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 _0x59e0=['../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x59e0,0x130));var _0x059e=function(_0x17b29a,_0x13b0dd){_0x17b29a=_0x17b29a-0x0;var _0x2c405f=_0x59e0[_0x17b29a];return _0x2c405f;};'use strict';var _=require('lodash');var util=require(_0x059e('0x0'));var moment=require(_0x059e('0x1'));var BPromise=require(_0x059e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x059e('0x3'));var db=require(_0x059e('0x4'))['db'];var utils=require(_0x059e('0x5'));var logger=require(_0x059e('0x6'))(_0x059e('0x7'));var config=require(_0x059e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x059e('0x9')][_0x059e('0xa')]({'port':0x232a});config[_0x059e('0xb')]=_[_0x059e('0xc')](config[_0x059e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x059e('0xd'))(new Redis(config[_0x059e('0xb')]));require(_0x059e('0xe'))['register'](socket);function respondWithRpcPromise(_0x37314e,_0x40a677,_0x172b08){return new BPromise(function(_0x35d45f,_0x58a934){return client['request'](_0x37314e,_0x172b08)['then'](function(_0x352e3d){logger[_0x059e('0xf')](_0x059e('0x10'),_0x40a677,_0x059e('0x11'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x40a677,'request\x20sent',JSON[_0x059e('0x12')](_0x352e3d));if(_0x352e3d[_0x059e('0x13')]){if(_0x352e3d[_0x059e('0x13')][_0x059e('0x14')]===0x1f4){logger[_0x059e('0x13')]('ChatGroup,\x20%s,\x20%s',_0x40a677,_0x352e3d[_0x059e('0x13')][_0x059e('0x15')]);return _0x58a934(_0x352e3d[_0x059e('0x13')][_0x059e('0x15')]);}logger['error'](_0x059e('0x10'),_0x40a677,_0x352e3d[_0x059e('0x13')][_0x059e('0x15')]);return _0x35d45f(_0x352e3d[_0x059e('0x13')]['message']);}else{logger[_0x059e('0xf')](_0x059e('0x10'),_0x40a677,_0x059e('0x11'));_0x35d45f(_0x352e3d[_0x059e('0x16')][_0x059e('0x15')]);}})[_0x059e('0x17')](function(_0xe12131){logger[_0x059e('0x13')](_0x059e('0x10'),_0x40a677,_0xe12131);_0x58a934(_0xe12131);});});} \ No newline at end of file +var _0x5b10=['../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5b10,0x13f));var _0x05b1=function(_0x2c89f3,_0x2a10eb){_0x2c89f3=_0x2c89f3-0x0;var _0x7a1343=_0x5b10[_0x2c89f3];return _0x7a1343;};'use strict';var _=require(_0x05b1('0x0'));var util=require(_0x05b1('0x1'));var moment=require(_0x05b1('0x2'));var BPromise=require(_0x05b1('0x3'));var rs=require(_0x05b1('0x4'));var fs=require('fs');var Redis=require(_0x05b1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x05b1('0x6'));var logger=require('../../config/logger')(_0x05b1('0x7'));var config=require(_0x05b1('0x8'));var jayson=require(_0x05b1('0x9'));var client=jayson['client'][_0x05b1('0xa')]({'port':0x232a});config[_0x05b1('0xb')]=_[_0x05b1('0xc')](config[_0x05b1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x05b1('0xd'))(new Redis(config[_0x05b1('0xb')]));require(_0x05b1('0xe'))['register'](socket);function respondWithRpcPromise(_0xa8f464,_0x36f63b,_0x375427){return new BPromise(function(_0x5df9e0,_0x2ae864){return client[_0x05b1('0xf')](_0xa8f464,_0x375427)['then'](function(_0x27c4b6){logger[_0x05b1('0x10')](_0x05b1('0x11'),_0x36f63b,_0x05b1('0x12'));logger[_0x05b1('0x13')](_0x05b1('0x14'),_0x36f63b,'request\x20sent',JSON['stringify'](_0x27c4b6));if(_0x27c4b6[_0x05b1('0x15')]){if(_0x27c4b6['error'][_0x05b1('0x16')]===0x1f4){logger[_0x05b1('0x15')](_0x05b1('0x11'),_0x36f63b,_0x27c4b6[_0x05b1('0x15')][_0x05b1('0x17')]);return _0x2ae864(_0x27c4b6['error']['message']);}logger[_0x05b1('0x15')](_0x05b1('0x11'),_0x36f63b,_0x27c4b6[_0x05b1('0x15')][_0x05b1('0x17')]);return _0x5df9e0(_0x27c4b6[_0x05b1('0x15')][_0x05b1('0x17')]);}else{logger['info'](_0x05b1('0x11'),_0x36f63b,'request\x20sent');_0x5df9e0(_0x27c4b6['result']['message']);}})[_0x05b1('0x18')](function(_0x323fc6){logger[_0x05b1('0x15')](_0x05b1('0x11'),_0x36f63b,_0x323fc6);_0x2ae864(_0x323fc6);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 3fd83de..f0c1332 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 _0xadf7=['length','./chatGroup.events','save','remove','update','emit','register'];(function(_0x58bb6b,_0x38e74f){var _0x3a0adc=function(_0x715739){while(--_0x715739){_0x58bb6b['push'](_0x58bb6b['shift']());}};_0x3a0adc(++_0x38e74f);}(_0xadf7,0x94));var _0x7adf=function(_0x46c9c1,_0x1a1949){_0x46c9c1=_0x46c9c1-0x0;var _0x3464f7=_0xadf7[_0x46c9c1];return _0x3464f7;};'use strict';var ChatGroupEvents=require(_0x7adf('0x0'));var events=[_0x7adf('0x1'),_0x7adf('0x2'),_0x7adf('0x3')];function createListener(_0x2ec2cb,_0x5dd451){return function(_0x32cdc3){_0x5dd451[_0x7adf('0x4')](_0x2ec2cb,_0x32cdc3);};}function removeListener(_0x416256,_0x1326bb){return function(){ChatGroupEvents['removeListener'](_0x416256,_0x1326bb);};}exports[_0x7adf('0x5')]=function(_0x1bc25e){for(var _0x3a2b0c=0x0,_0xef0363=events[_0x7adf('0x6')];_0x3a2b0c<_0xef0363;_0x3a2b0c++){var _0x291ddc=events[_0x3a2b0c];var _0xc5aef0=createListener('chatGroup:'+_0x291ddc,_0x1bc25e);ChatGroupEvents['on'](_0x291ddc,_0xc5aef0);}}; \ No newline at end of file +var _0xca02=['removeListener','register','length','chatGroup:','save','update','emit'];(function(_0x8e599a,_0x13f7ab){var _0xce4bbc=function(_0x53dad2){while(--_0x53dad2){_0x8e599a['push'](_0x8e599a['shift']());}};_0xce4bbc(++_0x13f7ab);}(_0xca02,0x138));var _0x2ca0=function(_0x103ede,_0x452a57){_0x103ede=_0x103ede-0x0;var _0x1f0ded=_0xca02[_0x103ede];return _0x1f0ded;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x2ca0('0x0'),'remove',_0x2ca0('0x1')];function createListener(_0x5d0e2f,_0x5b098d){return function(_0x4b3102){_0x5b098d[_0x2ca0('0x2')](_0x5d0e2f,_0x4b3102);};}function removeListener(_0x22d133,_0x1e1a22){return function(){ChatGroupEvents[_0x2ca0('0x3')](_0x22d133,_0x1e1a22);};}exports[_0x2ca0('0x4')]=function(_0x23719){for(var _0x90047e=0x0,_0x474531=events[_0x2ca0('0x5')];_0x90047e<_0x474531;_0x90047e++){var _0x4168c5=events[_0x90047e];var _0x1efd69=createListener(_0x2ca0('0x6')+_0x4168c5,_0x23719);ChatGroupEvents['on'](_0x4168c5,_0x1efd69);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6044b56..94664ce 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 _0x59e2=['isAuthenticated','describe','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','put','/:id','destroy','removeMembers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','index'];(function(_0xdcb54f,_0x340e93){var _0x690070=function(_0x365fe1){while(--_0x365fe1){_0xdcb54f['push'](_0xdcb54f['shift']());}};_0x690070(++_0x340e93);}(_0x59e2,0x7d));var _0x259e=function(_0x4921f1,_0x2b6a2a){_0x4921f1=_0x4921f1-0x0;var _0x5e1b24=_0x59e2[_0x4921f1];return _0x5e1b24;};'use strict';var multer=require(_0x259e('0x0'));var util=require(_0x259e('0x1'));var path=require(_0x259e('0x2'));var timeout=require(_0x259e('0x3'));var express=require('express');var router=express[_0x259e('0x4')]();var auth=require(_0x259e('0x5'));var interaction=require(_0x259e('0x6'));var config=require('../../config/environment');var controller=require(_0x259e('0x7'));router[_0x259e('0x8')]('/',auth['isAuthenticated'](),controller[_0x259e('0x9')]);router[_0x259e('0x8')]('/describe',auth[_0x259e('0xa')](),controller[_0x259e('0xb')]);router[_0x259e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x259e('0xc')]);router[_0x259e('0x8')](_0x259e('0xd'),auth[_0x259e('0xa')](),controller[_0x259e('0xe')]);router[_0x259e('0x8')](_0x259e('0xf'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x259e('0x10'),auth['isAuthenticated'](),controller[_0x259e('0x11')]);router[_0x259e('0x12')]('/',auth[_0x259e('0xa')](),controller[_0x259e('0x13')]);router[_0x259e('0x12')](_0x259e('0xf'),auth[_0x259e('0xa')](),controller[_0x259e('0x14')]);router[_0x259e('0x12')]('/:id/messages',auth[_0x259e('0xa')](),controller[_0x259e('0x15')]);router[_0x259e('0x16')](_0x259e('0x17'),auth[_0x259e('0xa')](),controller['update']);router['delete'](_0x259e('0x17'),auth[_0x259e('0xa')](),controller[_0x259e('0x18')]);router['delete'](_0x259e('0xf'),auth[_0x259e('0xa')](),controller[_0x259e('0x19')]);module[_0x259e('0x1a')]=router; \ No newline at end of file +var _0xd2ee=['create','addMembers','addMessage','put','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','./chatGroup.controller','isAuthenticated','index','describe','/:id','get','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xd2ee,0x9d));var _0xed2e=function(_0x1ad21d,_0x3e2a2f){_0x1ad21d=_0x1ad21d-0x0;var _0x40e017=_0xd2ee[_0x1ad21d];return _0x40e017;};'use strict';var multer=require('multer');var util=require(_0xed2e('0x0'));var path=require(_0xed2e('0x1'));var timeout=require(_0xed2e('0x2'));var express=require(_0xed2e('0x3'));var router=express[_0xed2e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed2e('0x5'));var controller=require(_0xed2e('0x6'));router['get']('/',auth[_0xed2e('0x7')](),controller[_0xed2e('0x8')]);router['get']('/describe',auth[_0xed2e('0x7')](),controller[_0xed2e('0x9')]);router['get'](_0xed2e('0xa'),auth[_0xed2e('0x7')](),controller['show']);router[_0xed2e('0xb')](_0xed2e('0xc'),auth[_0xed2e('0x7')](),controller[_0xed2e('0xd')]);router[_0xed2e('0xb')](_0xed2e('0xe'),auth[_0xed2e('0x7')](),controller[_0xed2e('0xf')]);router[_0xed2e('0xb')](_0xed2e('0x10'),auth[_0xed2e('0x7')](),controller['getMessages']);router[_0xed2e('0x11')]('/',auth[_0xed2e('0x7')](),controller[_0xed2e('0x12')]);router[_0xed2e('0x11')](_0xed2e('0xe'),auth['isAuthenticated'](),controller[_0xed2e('0x13')]);router[_0xed2e('0x11')](_0xed2e('0x10'),auth[_0xed2e('0x7')](),controller[_0xed2e('0x14')]);router[_0xed2e('0x15')](_0xed2e('0xa'),auth[_0xed2e('0x7')](),controller[_0xed2e('0x16')]);router['delete'](_0xed2e('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xed2e('0x17')](_0xed2e('0xe'),auth[_0xed2e('0x7')](),controller['removeMembers']);module[_0xed2e('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 26ed570..bf0d762 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 _0x0548=['thumb','TEXT','STRING','long','DATE','ENUM','out','BOOLEAN','star'];(function(_0x1a0a9c,_0x4f725f){var _0xdcc25a=function(_0x5782d5){while(--_0x5782d5){_0x1a0a9c['push'](_0x1a0a9c['shift']());}};_0xdcc25a(++_0x4f725f);}(_0x0548,0x14b));var _0x8054=function(_0x4e9988,_0x18bcd9){_0x4e9988=_0x4e9988-0x0;var _0x28c15d=_0x0548[_0x4e9988];return _0x28c15d;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x8054('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x8054('0x1'),_0x8054('0x2')),'defaultValue':_0x8054('0x1')},'ratingMessage':{'type':Sequelize[_0x8054('0x3')]},'pathTranscript':{'type':Sequelize[_0x8054('0x3')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8054('0x4')]},'note':{'type':Sequelize[_0x8054('0x4')]},'browserName':{'type':Sequelize[_0x8054('0x4')]},'browserVersion':{'type':Sequelize[_0x8054('0x4')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x8054('0x4')]},'deviceModel':{'type':Sequelize[_0x8054('0x4')]},'deviceVendor':{'type':Sequelize[_0x8054('0x4')]},'deviceType':{'type':Sequelize[_0x8054('0x4')]},'referer':{'type':Sequelize[_0x8054('0x3')]},'customerIp':{'type':Sequelize[_0x8054('0x4')]},'formData':{'type':Sequelize[_0x8054('0x3')](_0x8054('0x5'))},'read1stAt':{'type':Sequelize[_0x8054('0x6')]},'lastMsgAt':{'type':Sequelize[_0x8054('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x8054('0x7')]('in',_0x8054('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8054('0x4')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2aa7=['TEXT','STRING','long','DATE','ENUM','out','exports','INTEGER','thumb'];(function(_0x5e8b46,_0x21eb4a){var _0x252814=function(_0x327288){while(--_0x327288){_0x5e8b46['push'](_0x5e8b46['shift']());}};_0x252814(++_0x21eb4a);}(_0x2aa7,0x1a4));var _0x72aa=function(_0x4307e0,_0x57a10f){_0x4307e0=_0x4307e0-0x0;var _0x114911=_0x2aa7[_0x4307e0];return _0x114911;};'use strict';var Sequelize=require('sequelize');module[_0x72aa('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x72aa('0x1')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x72aa('0x2')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x72aa('0x3')]},'pathTranscript':{'type':Sequelize[_0x72aa('0x3')]},'mailTranscript':{'type':Sequelize[_0x72aa('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x72aa('0x4')]},'note':{'type':Sequelize[_0x72aa('0x4')]},'browserName':{'type':Sequelize[_0x72aa('0x4')]},'browserVersion':{'type':Sequelize[_0x72aa('0x4')]},'osName':{'type':Sequelize[_0x72aa('0x4')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x72aa('0x4')]},'deviceVendor':{'type':Sequelize[_0x72aa('0x4')]},'deviceType':{'type':Sequelize[_0x72aa('0x4')]},'referer':{'type':Sequelize[_0x72aa('0x3')]},'customerIp':{'type':Sequelize[_0x72aa('0x4')]},'formData':{'type':Sequelize[_0x72aa('0x3')](_0x72aa('0x5'))},'read1stAt':{'type':Sequelize[_0x72aa('0x6')]},'lastMsgAt':{'type':Sequelize[_0x72aa('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x72aa('0x7')]('in',_0x72aa('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x72aa('0x4')]},'customerPort':{'type':Sequelize[_0x72aa('0x4')]},'vidaooSessionId':{'type':Sequelize[_0x72aa('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index ef9b7d4..74461b0 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 _0x66fa=['./chatInteraction.socket','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','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','Users','map','fullname','split','Tags','push','TagIds','index','ChatInteraction','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','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','type','body','buildExpression','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','params','includeAll','include','create','describe','createVidaooSession','findOne','vidaooEscalation','vidaooApiKey','POST','MotionCWB:','join_url','out','user','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','closed','json','Unauthorized','attachId','download','join','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','CmContact','%s%d','agentAlias','Visitor','website_alias','agent_alias','alias','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','SendMail','sendMail','email','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','options','findAll','getMyMessages','includeAgent','rows','addTags','spread','emit','chatInteractionTags:save','unix','root','server','files','attachments','transcript-%d-%s.zip','firstName','ChatWebsite','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','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','N.A.','closedAt','disposition','browserName','referer','customerIp','customerPort','tail','createReadStream','createWriteStream','lastName','renderFile','views','downloadInteraction.html','transcript-','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost'];(function(_0x5236ca,_0x491291){var _0x214b20=function(_0x55b6a5){while(--_0x55b6a5){_0x5236ca['push'](_0x5236ca['shift']());}};_0x214b20(++_0x491291);}(_0x66fa,0x117));var _0xa66f=function(_0x451c22,_0x544ec3){_0x451c22=_0x451c22-0x0;var _0x1ab46d=_0x66fa[_0x451c22];return _0x1ab46d;};'use strict';var pdf=require(_0xa66f('0x0'));var emlformat=require(_0xa66f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa66f('0x2'));var jsonpatch=require(_0xa66f('0x3'));var rp=require(_0xa66f('0x4'));var moment=require(_0xa66f('0x5'));var BPromise=require(_0xa66f('0x6'));var Mustache=require(_0xa66f('0x7'));var util=require(_0xa66f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa66f('0x9'));var ejs=require(_0xa66f('0xa'));var fs=require('fs');var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var db=require(_0xa66f('0x14'))['db'];config['redis']=_[_0xa66f('0x15')](config[_0xa66f('0x16')],{'host':_0xa66f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa66f('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xa66f('0x19')]({'port':0x232b});var client9004=jayson[_0xa66f('0x1a')][_0xa66f('0x19')]({'port':0x232c});function checkPasswordPattern(_0x236d64,_0xd348f9,_0x567d4f){if(_0x567d4f){var _0x5510dc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5510dc[_0xa66f('0x1b')](_0xd348f9)){return _0x236d64;}else{throw new db[(_0xa66f('0x1c'))][(_0xa66f('0x1d'))](_0xa66f('0x1e'));}}else{return _0x236d64;}}function respondWithRpcPromise(_0x5c67f5,_0x1cbe64,_0x55b59d,_0x4a28d4){return new BPromise(function(_0x2f9da2,_0x413e80){var _0x342477=_0x4a28d4||client;return _0x342477[_0xa66f('0x1f')](_0x5c67f5,_0x55b59d)[_0xa66f('0x20')](function(_0x408bc7){logger[_0xa66f('0x21')](_0xa66f('0x22'),_0x1cbe64,_0xa66f('0x23'));logger[_0xa66f('0x24')](_0xa66f('0x25'),_0x1cbe64,_0xa66f('0x23'),JSON[_0xa66f('0x26')](_0x408bc7));if(_0x408bc7[_0xa66f('0x27')]){if(_0x408bc7[_0xa66f('0x27')]['code']===0x1f4){logger[_0xa66f('0x27')](_0xa66f('0x22'),_0x1cbe64,_0x408bc7[_0xa66f('0x27')][_0xa66f('0x28')]);return _0x413e80(_0x408bc7['error'][_0xa66f('0x28')]);}logger[_0xa66f('0x27')](_0xa66f('0x22'),_0x1cbe64,_0x408bc7[_0xa66f('0x27')]['message']);return _0x2f9da2(_0x408bc7['error'][_0xa66f('0x28')]);}else{logger['info'](_0xa66f('0x22'),_0x1cbe64,_0xa66f('0x23'));_0x2f9da2(_0x408bc7[_0xa66f('0x29')]['message']);}})[_0xa66f('0x2a')](function(_0x1c2903){logger[_0xa66f('0x27')](_0xa66f('0x22'),_0x1cbe64,_0x1c2903);_0x413e80(_0x1c2903);});});}function respondWithStatusCode(_0x17c103,_0x236046){_0x236046=_0x236046||0xcc;return function(_0x1eb86a){if(_0x1eb86a){return _0x17c103[_0xa66f('0x2b')](_0x236046);}return _0x17c103[_0xa66f('0x2c')](_0x236046)[_0xa66f('0x2d')]();};}function respondWithResult(_0x45f71c,_0x63650b){_0x63650b=_0x63650b||0xc8;return function(_0x42b966){if(_0x42b966){return _0x45f71c[_0xa66f('0x2c')](_0x63650b)['json'](_0x42b966);}};}function respondWithFilteredResult(_0x4c0695,_0x38daac){return function(_0x27ceae){if(_0x27ceae){var _0x55f309=_0x27ceae[_0xa66f('0x2e')],_0x44c79a=_0x38daac[_0xa66f('0x2f')],_0x2de5f3=_0x38daac[_0xa66f('0x2f')]+_0x38daac[_0xa66f('0x30')],_0x4cd7f2;if(_0x2de5f3>=_0x55f309){_0x2de5f3=_0x55f309;_0x4cd7f2=0xc8;}else{_0x4cd7f2=0xce;}_0x4c0695[_0xa66f('0x2c')](_0x4cd7f2);return _0x4c0695['set'](_0xa66f('0x31'),_0x44c79a+'-'+_0x2de5f3+'/'+_0x55f309)['json'](_0x27ceae);}return null;};}function patchUpdates(_0x306b35){return function(_0x35a0a7){try{jsonpatch[_0xa66f('0x32')](_0x35a0a7,_0x306b35,!![]);}catch(_0x486e4e){return BPromise[_0xa66f('0x33')](_0x486e4e);}return _0x35a0a7[_0xa66f('0x34')]();};}function saveUpdates(_0x4f1668,_0x1a5d4a){return function(_0x35a847){if(_0x35a847){return _0x35a847[_0xa66f('0x35')](_0x4f1668)[_0xa66f('0x20')](function(_0x10a782){return _0x10a782;});}return null;};}function removeEntity(_0x2452d2,_0x25c74c){return function(_0x41303c){if(_0x41303c){return _0x41303c[_0xa66f('0x36')]()[_0xa66f('0x20')](function(){_0x2452d2['status'](0xcc)[_0xa66f('0x2d')]();});}};}function handleEntityNotFound(_0x5bf736,_0x1c7eda){return function(_0x46f6cc){if(!_0x46f6cc){_0x5bf736[_0xa66f('0x2b')](0x194);}return _0x46f6cc;};}function handleError(_0x3b9261,_0x3722d3){_0x3722d3=_0x3722d3||0x1f4;return function(_0x201432){logger[_0xa66f('0x27')](_0x201432[_0xa66f('0x37')]);if(_0x201432['name']){delete _0x201432[_0xa66f('0x38')];}_0x3b9261['status'](_0x3722d3)[_0xa66f('0x39')](_0x201432);};}function getInteractionUsers(_0x45eeb8,_0x2ed1fb){return new BPromise(function(_0x47b21a,_0x4d60f9){try{if(_0x2ed1fb[_0x45eeb8['id']]){_0x45eeb8[_0xa66f('0x3a')]=_[_0xa66f('0x3b')](_0x2ed1fb[_0x45eeb8['id']],function(_0x20b07e){return{'id':_0x20b07e['id'],'fullname':_0x20b07e[_0xa66f('0x3c')]};});}}catch(_0x330169){_0x4d60f9(_0x330169);}_0x47b21a(_0x45eeb8);});}function getInteractionTags(_0x581dca,_0x5cb0a9){return new BPromise(function(_0x49b869,_0x30f7de){try{if(_0x581dca['TagIds']){_0x581dca['Tags']=[];_0x581dca['TagIds'][_0xa66f('0x3d')](',')['forEach'](function(_0x8965d3){_0x581dca[_0xa66f('0x3e')][_0xa66f('0x3f')](_0x5cb0a9[_0x8965d3]);});}delete _0x581dca[_0xa66f('0x40')];}catch(_0xd65c5d){_0x30f7de(_0xd65c5d);}_0x49b869(_0x581dca);});}function updateChatInteraction(_0x360e61,_0x192033,_0x261089){return new BPromise(function(_0x32ba8b,_0x2f2a98){return getInteractionUsers(_0x360e61,_0x261089)[_0xa66f('0x20')](function(_0x93f6ff){return getInteractionTags(_0x93f6ff,_0x192033);})[_0xa66f('0x20')](function(_0x13875a){_0x32ba8b(_0x13875a);})['catch'](function(_0x36037c){_0x2f2a98(_0x36037c);});});}exports[_0xa66f('0x41')]=function(_0x58c1f2,_0x248587){var _0x4b6e6b={},_0xd69aa4={},_0x27adf4={'count':0x0,'rows':[]};var _0x5f5b25=_[_0xa66f('0x3b')](db[_0xa66f('0x42')][_0xa66f('0x43')],function(_0x5276ea){return{'name':_0x5276ea[_0xa66f('0x44')],'type':_0x5276ea['type'][_0xa66f('0x45')]};});_0xd69aa4[_0xa66f('0x46')]=_[_0xa66f('0x3b')](_0x5f5b25,_0xa66f('0x38'));_0xd69aa4[_0xa66f('0x47')]=_[_0xa66f('0x48')](_0x58c1f2[_0xa66f('0x47')]);_0xd69aa4['filters']=_[_0xa66f('0x49')](_0xd69aa4[_0xa66f('0x46')],_0xd69aa4[_0xa66f('0x47')]);_0x4b6e6b[_0xa66f('0x4a')]=_[_0xa66f('0x49')](_0xd69aa4['model'],qs['fields'](_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x4b')]));_0x4b6e6b[_0xa66f('0x4a')]=_0x4b6e6b[_0xa66f('0x4a')][_0xa66f('0x4c')]?_0x4b6e6b[_0xa66f('0x4a')]:_0xd69aa4['model'];if(!_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x4d')](_0xa66f('0x4e'))){_0x4b6e6b['limit']=qs['limit'](_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x30')]);_0x4b6e6b[_0xa66f('0x2f')]=qs['offset'](_0x58c1f2['query']['offset']);}_0x4b6e6b[_0xa66f('0x4f')]=qs[_0xa66f('0x50')](_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x50')]);_0x4b6e6b[_0xa66f('0x51')]=qs[_0xa66f('0x52')](_[_0xa66f('0x53')](_0x58c1f2[_0xa66f('0x47')],_0xd69aa4['filters']),_0x5f5b25);var _0x1a299c=[];var _0x962415=squel[_0xa66f('0x54')]()[_0xa66f('0x55')]('id')[_0xa66f('0x55')](_0xa66f('0x38'))['field'](_0xa66f('0x56'))[_0xa66f('0x57')](_0xa66f('0x58'));var _0x13848d=squel[_0xa66f('0x54')]()['field'](_0xa66f('0x59'))['field'](_0xa66f('0x5a'))['field']('ui.ChatInteractionId')[_0xa66f('0x57')](_0xa66f('0x5b'),'ui')[_0xa66f('0x5c')](_0xa66f('0x5d'),'u',_0xa66f('0x5e'));var _0xe97cf4=squel['select']()[_0xa66f('0x57')](_0xa66f('0x5f'),'i')[_0xa66f('0x5c')](_0xa66f('0x60'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa66f('0x5c')]('users','o',_0xa66f('0x61'))[_0xa66f('0x5c')](_0xa66f('0x62'),'a',_0xa66f('0x63'))[_0xa66f('0x5c')](_0xa66f('0x64'),'me',_0xa66f('0x65'))['left_join'](_0xa66f('0x66'),'it',_0xa66f('0x67'))[_0xa66f('0x5c')](_0xa66f('0x58'),'t',_0xa66f('0x68'));var _0x45989a=squel[_0xa66f('0x69')]();var _0x323145=[];var _0x350fce=squel['expr']();var _0x5aed74;if(_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x6a')]){_0x5aed74=as[_0xa66f('0x6b')](_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x6a')]);var _0x1fd3f0=_0x5aed74[_0xa66f('0x6c')];for(var _0x4b10cf=0x0;_0x4b10cf<_0x5aed74[_0xa66f('0x6d')][_0xa66f('0x4c')];_0x4b10cf++){var _0x37b99b=_0x5aed74[_0xa66f('0x6d')][_0x4b10cf];var _0x53d22a='i';var _0x29f216=_[_0xa66f('0x6e')](_0x5f5b25,[_0xa66f('0x38'),_0x37b99b[_0xa66f('0x55')]]);if(!_0x29f216){switch(_0x37b99b[_0xa66f('0x55')]){case _0xa66f('0x6f'):if(_0x37b99b['value']==0x1){_0xe97cf4['having']('`'+_0x37b99b[_0xa66f('0x55')]+_0xa66f('0x70'));}else{_0xe97cf4[_0xa66f('0x71')]('`'+_0x37b99b['field']+_0xa66f('0x72'));}break;case _0xa66f('0x73'):if(_0x37b99b[_0xa66f('0x74')]===_0xa66f('0x75')){if(_0x37b99b[_0xa66f('0x76')][_0xa66f('0x3d')]('\x20')[_0xa66f('0x4c')]>0x1){_0x45989a[_0x1fd3f0](_0xa66f('0x77'),qs[_0xa66f('0x78')](_0x37b99b['value']),null);}else{var _0x394d20='%'+_0x37b99b[_0xa66f('0x76')]+'%';_0x45989a[_0x1fd3f0](_0xa66f('0x79'),_0x394d20,_0x394d20,_0x394d20);}}else{_0x29f216=_[_0xa66f('0x6e')](_0x5f5b25,[_0xa66f('0x38'),_0xa66f('0x7a')]);_0x37b99b[_0xa66f('0x55')]=_0xa66f('0x7a');_0xa6c576=as['buildExpression'](_0x53d22a,_0x29f216['type'],_0x37b99b);_0x45989a[_0x1fd3f0](_0xa6c576[_0xa66f('0x7b')],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x7c')],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x2d')]);}break;case'Tag':var _0x44525a=_0x37b99b['value'][_0xa66f('0x3d')](',')[_0xa66f('0x3b')](function(_0x450e1d){return Number(_0x450e1d);});_0x44525a[_0xa66f('0x7d')](function(_0x556fbe){_0x350fce['or'](_0xa66f('0x7e'),'%,'+_0x556fbe+',%');});_0x323145=_[_0xa66f('0x7f')](_0x323145,_0x44525a);break;case _0xa66f('0x80'):if(_0x37b99b[_0xa66f('0x74')]===_0xa66f('0x75')){_0x45989a[_0x1fd3f0](_0xa66f('0x81'),'%'+_0x37b99b[_0xa66f('0x76')]+'%',null);}else{_0x29f216=_[_0xa66f('0x6e')](_0x5f5b25,[_0xa66f('0x38'),_0xa66f('0x82')]);_0x37b99b[_0xa66f('0x55')]=_0xa66f('0x82');_0xa6c576=as['buildExpression'](_0x53d22a,_0x29f216[_0xa66f('0x83')],_0x37b99b);_0x45989a[_0x1fd3f0](_0xa6c576[_0xa66f('0x7b')],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x7c')],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x2d')]);}break;case _0xa66f('0x84'):_0xa6c576=as[_0xa66f('0x85')]('me',null,_0x37b99b);_0x45989a[_0x1fd3f0](_0xa6c576['text'],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x7c')],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x2d')]);break;}}else{var _0xa6c576=as[_0xa66f('0x85')](_0x53d22a,_0x29f216[_0xa66f('0x83')],_0x37b99b);_0x45989a[_0x1fd3f0](_0xa6c576[_0xa66f('0x7b')],_0xa6c576['value']['start'],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x2d')]);}}}else{var _0x34a590=_(_0x58c1f2['query'])['keys']()[_0xa66f('0x3b')](function(_0x421290){return _[_0xa66f('0x86')](_0x5f5b25,[_0xa66f('0x38'),_0x421290])?_0x421290:undefined;})['compact']()[_0xa66f('0x76')]();if(!_[_0xa66f('0x87')](_0x34a590)){_0x34a590[_0xa66f('0x7d')](function(_0x391d4d){if(_0x391d4d===_0xa66f('0x88')){_0xe97cf4[_0xa66f('0x51')](_0xa66f('0x89'),[][_0xa66f('0x8a')](_0x58c1f2['query'][_0x391d4d]));}else if(_0x391d4d===_0xa66f('0x8b')){var _0xbf4084=JSON['parse'](_0x58c1f2['query'][_0x391d4d])[_0xa66f('0x8c')];var _0x1d64a8=JSON['parse'](_0x58c1f2[_0xa66f('0x47')][_0x391d4d])['$lte'];_0xe97cf4[_0xa66f('0x51')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xbf4084,_0x1d64a8);}else{if(_0x58c1f2['query'][_0x391d4d]==='null'){_0xe97cf4[_0xa66f('0x51')]('i.'+_0x391d4d+_0xa66f('0x8d'));}else{_0xe97cf4[_0xa66f('0x51')]('i.'+_0x391d4d+_0xa66f('0x8e'),_0x58c1f2[_0xa66f('0x47')][_0x391d4d]);}}});}if(_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x8f')]){if(_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x8f')]==0x1){_0xe97cf4[_0xa66f('0x71')](_0xa66f('0x90'));}else{_0xe97cf4[_0xa66f('0x71')](_0xa66f('0x91'));}}if(_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x92')]){_0x323145=_[_0xa66f('0x93')](_0x58c1f2['query'][_0xa66f('0x92')])?_0x58c1f2['query'][_0xa66f('0x92')]:new Array(_0x58c1f2['query'][_0xa66f('0x92')]);_0x323145[_0xa66f('0x7d')](function(_0x2bb4e5){_0x350fce['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2bb4e5+',%');});}if(_0x58c1f2['query'][_0xa66f('0x94')]){var _0x30bbee=_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x94')][_0xa66f('0x95')]('\x5c','\x5c\x5c')[_0xa66f('0x95')]('\x27\x27',_0xa66f('0x96'));if(qs['isNumeric'](_0x30bbee)){_0x45989a['or'](_0xa66f('0x97'),_0x30bbee+'%');}else{_0x45989a['or'](_0xa66f('0x98'),qs[_0xa66f('0x78')](_0x30bbee))['or'](_0xa66f('0x99'),_0x30bbee+'%');}}}_0xe97cf4[_0xa66f('0x51')](_0x45989a);_0xe97cf4[_0xa66f('0x9a')](_0xa66f('0x9b'));var _0x3cdf95={'type':db[_0xa66f('0x1c')][_0xa66f('0x9c')][_0xa66f('0x9d')],'raw':!![]};var _0x9c7e02=_0xe97cf4[_0xa66f('0x9e')]();_0x9c7e02['field'](_0xa66f('0x9b'));_0x9c7e02[_0xa66f('0x55')](_0xa66f('0x9f'),_0xa66f('0x6f'));if(_0x4b6e6b[_0xa66f('0x4f')]){_0x4b6e6b[_0xa66f('0x4f')][_0xa66f('0x7d')](function(_0xffd447){_0xe97cf4[_0xa66f('0x4f')]('i.'+_0xffd447[0x0],_0xffd447[0x1]==='DESC'?![]:!![]);});}if(!_[_0xa66f('0x87')](_0x323145)){_0xe97cf4['having'](_0x350fce);_0x9c7e02[_0xa66f('0x51')]('t.id\x20IN\x20?',_0x323145);}BPromise[_0xa66f('0xa0')]()['then'](function(){if(!_0x5aed74){if(_0x58c1f2[_0xa66f('0x47')]['ChatWebsiteId']||_0x58c1f2[_0xa66f('0x47')][_0xa66f('0xa1')])return;_0x9c7e02[_0xa66f('0x51')](_0xa66f('0xa2'));_0xe97cf4[_0xa66f('0x51')](_0xa66f('0xa2'));return;}return _0x58c1f2['user'][_0xa66f('0xa3')]({'attributes':['id'],'raw':!![]})[_0xa66f('0x20')](function(_0x43ebd5){if(_['isEmpty'](_0x43ebd5)){_0x9c7e02[_0xa66f('0x51')](_0xa66f('0xa4'));_0xe97cf4['where'](_0xa66f('0xa4'));}else{_0x9c7e02[_0xa66f('0x51')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x43ebd5,'id'));_0xe97cf4[_0xa66f('0x51')](_0xa66f('0x89'),_[_0xa66f('0x3b')](_0x43ebd5,'id'));}});})[_0xa66f('0x20')](function(){db[_0xa66f('0xa5')]['query'](_0x9c7e02[_0xa66f('0xa6')](),_0x3cdf95)[_0xa66f('0x20')](function(_0x4ebc0f){_0x27adf4[_0xa66f('0x2e')]=_0x4ebc0f[_0xa66f('0x4c')];if(_0x27adf4['count']===0x0)return[];return db[_0xa66f('0xa5')][_0xa66f('0x47')](_0x962415[_0xa66f('0xa6')](),_0x3cdf95)[_0xa66f('0x20')](function(_0x1f28e8){_0x1a299c=_['keyBy'](_0x1f28e8,'id');_0x3cdf95=_[_0xa66f('0xa7')](_0x3cdf95,{'model':db[_0xa66f('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x4b')]){_0x4b6e6b[_0xa66f('0x4a')][_0xa66f('0x7d')](function(_0x4e318d){_0xe97cf4[_0xa66f('0x55')]('i.'+_0x4e318d);});}else{_0xe97cf4[_0xa66f('0x55')](_0xa66f('0x9f'),_0xa66f('0x6f'));_0xe97cf4[_0xa66f('0x55')](_0xa66f('0xa8'),_0xa66f('0xa9'));_0xe97cf4['field']('a.mandatoryDisposition',_0xa66f('0xaa'));_0xe97cf4['field'](_0xa66f('0xab'));_0xe97cf4[_0xa66f('0x55')]('c.firstName',_0xa66f('0xac'));_0xe97cf4[_0xa66f('0x55')](_0xa66f('0xad'),'Contact.lastName');_0xe97cf4['field'](_0xa66f('0xae'),'Contact.email');_0xe97cf4[_0xa66f('0x55')](_0xa66f('0xaf'),_0xa66f('0xb0'));_0xe97cf4['field'](_0xa66f('0xb1'),'Contact.mobile');_0xe97cf4[_0xa66f('0x55')](_0xa66f('0xb2'),_0xa66f('0xb3'));_0xe97cf4[_0xa66f('0x55')]('o.fullname',_0xa66f('0xb4'));_0xe97cf4[_0xa66f('0x55')](_0xa66f('0xb5'),_0xa66f('0xb6'));_0xe97cf4[_0xa66f('0x55')](_0xa66f('0xb7'),'TagIds');}if(_0x4b6e6b[_0xa66f('0x30')])_0xe97cf4[_0xa66f('0x30')](_0x4b6e6b[_0xa66f('0x30')]);if(_0x4b6e6b[_0xa66f('0x2f')])_0xe97cf4[_0xa66f('0x2f')](_0x4b6e6b['offset']);return db['sequelize'][_0xa66f('0x47')](_0xe97cf4[_0xa66f('0xa6')](),_0x3cdf95);})[_0xa66f('0x20')](function(_0x2895ab){_0x13848d[_0xa66f('0x51')](_0xa66f('0xb8'),_[_0xa66f('0x3b')](_0x2895ab,'id'));return db[_0xa66f('0xa5')][_0xa66f('0x47')](_0x13848d[_0xa66f('0xa6')](),_0x3cdf95)[_0xa66f('0x20')](function(_0x3fdabb){var _0x4cfdfb=_[_0xa66f('0xb9')](_0x3fdabb,_0xa66f('0xba'));var _0x55af2c=[];_0x2895ab[_0xa66f('0x7d')](function(_0x5c5445){_0x55af2c[_0xa66f('0x3f')](updateChatInteraction(_0x5c5445,_0x1a299c,_0x4cfdfb));});return BPromise['all'](_0x55af2c);});});})['then'](function(_0x1de4df){_0x27adf4['rows']=_0x1de4df;return _0x27adf4;})[_0xa66f('0x20')](respondWithFilteredResult(_0x248587,_0x4b6e6b));})[_0xa66f('0x2a')](handleError(_0x248587,null));};exports['show']=function(_0x2fa5ab,_0x651d04){var _0x57912d={'raw':![],'where':{'id':_0x2fa5ab[_0xa66f('0xbb')]['id']}},_0xa568ed={};_0xa568ed[_0xa66f('0x46')]=_[_0xa66f('0x48')](db['ChatInteraction']['rawAttributes']);_0xa568ed[_0xa66f('0x47')]=_[_0xa66f('0x48')](_0x2fa5ab[_0xa66f('0x47')]);_0xa568ed[_0xa66f('0x52')]=_[_0xa66f('0x49')](_0xa568ed[_0xa66f('0x46')],_0xa568ed[_0xa66f('0x47')]);_0x57912d[_0xa66f('0x4a')]=_[_0xa66f('0x49')](_0xa568ed[_0xa66f('0x46')],qs['fields'](_0x2fa5ab['query'][_0xa66f('0x4b')]));_0x57912d[_0xa66f('0x4a')]=_0x57912d[_0xa66f('0x4a')][_0xa66f('0x4c')]?_0x57912d[_0xa66f('0x4a')]:_0xa568ed['model'];if(_0x2fa5ab[_0xa66f('0x47')][_0xa66f('0xbc')]){_0x57912d[_0xa66f('0xbd')]=[{'all':!![]}];}_0x57912d=_['merge']({},_0x57912d,_0x2fa5ab['options']);return db['ChatInteraction'][_0xa66f('0x6e')](_0x57912d)['then'](handleEntityNotFound(_0x651d04,null))[_0xa66f('0x20')](respondWithResult(_0x651d04,null))[_0xa66f('0x2a')](handleError(_0x651d04,null));};exports[_0xa66f('0xbe')]=function(_0x90b7f1,_0x4bf3f6){return db[_0xa66f('0x42')][_0xa66f('0xbe')](_0x90b7f1['body'],{})[_0xa66f('0x20')](respondWithResult(_0x4bf3f6,0xc9))[_0xa66f('0x2a')](handleError(_0x4bf3f6,null));};exports['update']=function(_0x4fa27c,_0x2f090b){if(_0x4fa27c[_0xa66f('0x84')]['id']){delete _0x4fa27c[_0xa66f('0x84')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x4fa27c['params']['id']}})['then'](handleEntityNotFound(_0x2f090b,null))[_0xa66f('0x20')](saveUpdates(_0x4fa27c[_0xa66f('0x84')],null))[_0xa66f('0x20')](respondWithResult(_0x2f090b,null))[_0xa66f('0x2a')](handleError(_0x2f090b,null));};exports[_0xa66f('0x36')]=function(_0x46c9b2,_0x580eb7){return db[_0xa66f('0x42')][_0xa66f('0x6e')]({'where':{'id':_0x46c9b2[_0xa66f('0xbb')]['id']}})[_0xa66f('0x20')](handleEntityNotFound(_0x580eb7,null))['then'](removeEntity(_0x580eb7,null))['catch'](handleError(_0x580eb7,null));};exports[_0xa66f('0xbf')]=function(_0xe11c2d,_0x44e159){return db[_0xa66f('0x42')][_0xa66f('0xbf')]()[_0xa66f('0x20')](respondWithResult(_0x44e159,null))[_0xa66f('0x2a')](handleError(_0x44e159,null));};exports[_0xa66f('0xc0')]=function(_0x7a57e9,_0x179eb7){var _0x5e0b36=_0x7a57e9['params']['id'];var _0x451f57;var _0x597ae3;var _0x1b93e0;return db[_0xa66f('0x42')][_0xa66f('0xc1')]({'where':{'id':_0x5e0b36}})[_0xa66f('0x20')](function(_0x216668){_0x451f57=_0x216668;return db['ChatWebsite']['findOne']({'where':{'id':_0x216668['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0xa66f('0xc2')],'raw':!![]});})[_0xa66f('0x20')](function(_0x2f1806){if(_0x2f1806&&_0x2f1806[_0xa66f('0xc3')]&&_0x2f1806['vidaooEscalation']){_0x597ae3=_0x2f1806;var _0x2f3d27={'rejectUnauthorized':![],'method':_0xa66f('0xc4'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x2f1806[_0xa66f('0xc3')]},'body':{'name':_0xa66f('0xc5')+_0x5e0b36},'redirect':'follow','json':!![]};return rp(_0x2f3d27);}else{throw new db[(_0xa66f('0x1c'))][(_0xa66f('0x1d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xa66f('0x20')](function(_0x400223){_0x1b93e0=_0x400223;if(_0x1b93e0['id']){var _0x32bea5={'body':_0x1b93e0[_0xa66f('0xc6')],'ChatWebsiteId':_0x597ae3['id'],'ChatInteractionId':_0x451f57['id'],'direction':_0xa66f('0xc7'),'UserId':_0x7a57e9[_0xa66f('0xc8')]['id']};return db[_0xa66f('0xc9')][_0xa66f('0xbe')](_0x32bea5,{});}else{throw new db[(_0xa66f('0x1c'))][(_0xa66f('0x1d'))](_0xa66f('0xca'));}})['then'](function(){return _0x451f57['updateAttributes']({'vidaooSessionId':_0x1b93e0['id']});})[_0xa66f('0x20')](respondWithResult(_0x179eb7,null))[_0xa66f('0x2a')](handleError(_0x179eb7,null));};exports[_0xa66f('0xcb')]=function(_0x4e211b,_0x50f330){if(_0x4e211b[_0xa66f('0x84')]['id']){delete _0x4e211b[_0xa66f('0x84')]['id'];}return db[_0xa66f('0x42')][_0xa66f('0x6e')]({'where':{'id':_0x4e211b[_0xa66f('0xbb')]['id']}})['then'](handleEntityNotFound(_0x50f330,null))[_0xa66f('0x20')](saveUpdates(_0x4e211b[_0xa66f('0x84')],null))[_0xa66f('0x20')](respondWithResult(_0x50f330,null))[_0xa66f('0x2a')](handleError(_0x50f330,null));};exports['abandon']=function(_0x3de2ec,_0x3ea83e,_0x5774df){if(_0x3de2ec[_0xa66f('0x84')]['id']){delete _0x3de2ec[_0xa66f('0x84')]['id'];}return db['ChatInteraction'][_0xa66f('0x6e')]({'where':{'id':_0x3de2ec[_0xa66f('0xbb')]['id']}})[_0xa66f('0x20')](function(_0x23832c){if(!_0x23832c){logger[_0xa66f('0x27')](_0xa66f('0xcc'),_0xa66f('0xcd'),0x194,'entity\x20not\x20found');_0x3ea83e['sendStatus'](0x194);}else{if(_0x23832c[_0xa66f('0x82')]){throw new db[(_0xa66f('0x1c'))][(_0xa66f('0x1d'))](_0xa66f('0xce'));}}return _0x23832c;})[_0xa66f('0x20')](function(_0x4f9117){if(_0x4f9117){return _0x4f9117[_0xa66f('0x35')]({'closed':_0x3de2ec[_0xa66f('0x84')]['closed'],'disposition':_0x3de2ec[_0xa66f('0x84')]['disposition']})[_0xa66f('0x20')](function(_0x807b56){return _0x807b56;});}})[_0xa66f('0x20')](function(_0x2f8549){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3de2ec['body'],client9004);})[_0xa66f('0x20')](respondWithResult(_0x3ea83e,null))['catch'](handleError(_0x3ea83e,null));};exports[_0xa66f('0xcf')]=function(_0x55b2c3,_0x100658,_0x1a61e0){_0x55b2c3['body'][_0xa66f('0x38')]=_0x55b2c3[_0xa66f('0xd0')][_0xa66f('0xd1')];_0x55b2c3[_0xa66f('0x84')][_0xa66f('0xd2')]=_0x55b2c3[_0xa66f('0xd0')][_0xa66f('0xd3')];_0x55b2c3['body'][_0xa66f('0x83')]=_0x55b2c3[_0xa66f('0xd0')][_0xa66f('0xd4')];return db[_0xa66f('0xd5')][_0xa66f('0xbe')](_0x55b2c3[_0xa66f('0x84')])[_0xa66f('0x20')](respondWithResult(_0x100658,0xc9))[_0xa66f('0x2a')](handleError(_0x100658,null));};exports[_0xa66f('0xd6')]=function(_0x5dcf9d,_0x1f9b43,_0x4b12b5){return db[_0xa66f('0x42')][_0xa66f('0xc1')]({'where':{'id':_0x5dcf9d[_0xa66f('0xbb')]['id']},'raw':!![]})[_0xa66f('0x20')](handleEntityNotFound(_0x1f9b43,null))[_0xa66f('0x20')](function(_0x53276b){if(_0x53276b){if(_0x53276b[_0xa66f('0xd7')]){return _0x1f9b43[_0xa66f('0x2c')](0x193)[_0xa66f('0xd8')]({'status':0x193,'message':_0xa66f('0xd9')});}return db['Attachment']['findOne']({'where':{'id':_0x5dcf9d['query'][_0xa66f('0xda')]},'raw':!![]})[_0xa66f('0x20')](handleEntityNotFound(_0x1f9b43,null));}})['then'](function(_0x58c0e0){if(_0x58c0e0){return _0x1f9b43[_0xa66f('0xdb')](path[_0xa66f('0xdc')](config['root'],_0xa66f('0xdd'),_0x58c0e0[_0xa66f('0xd2')]));}})[_0xa66f('0x2a')](handleError(_0x1f9b43,null));};exports[_0xa66f('0xde')]=function(_0x551c09,_0x4c2bf9){var _0x49dff5=null;var _0x109e8f=null;var _0x39d6b3=null;var _0x13bbe7=null;if(_0x551c09[_0xa66f('0x84')]['id']){delete _0x551c09[_0xa66f('0x84')]['id'];}if(_0x551c09[_0xa66f('0x84')][_0xa66f('0xdf')]){_0x13bbe7=path[_0xa66f('0xdc')](config['root'],_0xa66f('0xe0'),util[_0xa66f('0xe1')](_0xa66f('0xe2'),Date['now']()));_0x551c09[_0xa66f('0x84')][_0xa66f('0xe3')]=_0x13bbe7;}return db[_0xa66f('0x42')]['find']({'where':{'id':_0x551c09['params']['id']},'include':[{'model':db[_0xa66f('0xc9')],'as':_0xa66f('0xe4'),'include':[{'model':db[_0xa66f('0x80')],'as':_0xa66f('0x80')}]}]})[_0xa66f('0x20')](handleEntityNotFound(_0x4c2bf9,null))[_0xa66f('0x20')](saveUpdates(_0x551c09[_0xa66f('0x84')],null))['then'](function(_0x383ce6){if(_0x383ce6){_0x49dff5=_0x383ce6;return db['ChatWebsite'][_0xa66f('0x6e')]({'where':{'id':_0x49dff5[_0xa66f('0x88')]}});}})[_0xa66f('0x20')](function(_0x855710){if(_0x855710){_0x39d6b3=_0x855710;return db[_0xa66f('0xe5')][_0xa66f('0x6e')]({'where':{'id':_0x49dff5[_0xa66f('0x7a')]}});}})[_0xa66f('0x20')](function(_0x1deff4){if(_0x1deff4){_0x109e8f=_0x1deff4;if(_0x13bbe7){var _0xb9e891=null;for(var _0x27ea65=0x1;_0x27ea65<_0x49dff5[_0xa66f('0xe4')]['length'];++_0x27ea65){_0xb9e891=_0x49dff5['Messages'][_0x27ea65];var _0x38412c=_0xb9e891[_0xa66f('0x82')]?util[_0xa66f('0xe1')](_0xa66f('0xe6'),_0x39d6b3[_0xa66f('0xe7')],_0xb9e891[_0xa66f('0x82')]):'System';var _0x1b5f18=_0x551c09['body']['customer']||util[_0xa66f('0xe1')](_0xa66f('0xe6'),_0xa66f('0xe8'),_0xb9e891[_0xa66f('0x7a')]);switch(_0x39d6b3['agentIdentifier']){case _0xa66f('0xe9'):_0x38412c=_0xb9e891[_0xa66f('0x82')]?util[_0xa66f('0xe1')](_0xa66f('0xe6'),_0x39d6b3[_0xa66f('0xe7')],_0xb9e891['UserId']):'System';break;case _0xa66f('0xea'):_0x38412c=_0xb9e891[_0xa66f('0x82')]?_0xb9e891[_0xa66f('0x80')][_0xa66f('0xeb')]||_0xb9e891['User'][_0xa66f('0x3c')]:_0xa66f('0xec');break;case _0xa66f('0xed'):_0x38412c=_0xb9e891[_0xa66f('0x82')]?_0xb9e891[_0xa66f('0x80')][_0xa66f('0x3c')]:_0xa66f('0xec');break;default:_0x38412c=_0xb9e891[_0xa66f('0x82')]?util['format'](_0xa66f('0xe6'),_0x39d6b3[_0xa66f('0xe7')],_0xb9e891['UserId']):_0xa66f('0xec');}var _0x9a2ea4=util[_0xa66f('0xe1')](_0xa66f('0xee'),moment(_0xb9e891[_0xa66f('0x8b')])['format'](_0xa66f('0xef')),_0xb9e891[_0xa66f('0xf0')]==='in'?_0x1b5f18:_0x38412c,_0xb9e891[_0xa66f('0x84')]);if(!_0xb9e891[_0xa66f('0xf1')]){fs[_0xa66f('0xf2')](_0x13bbe7,_0x9a2ea4);}}return db['MailAccount'][_0xa66f('0xc1')]({'where':{'service':!![]},'include':[{'model':db[_0xa66f('0xf3')],'as':'Smtp','raw':!![]}]});}}})[_0xa66f('0x20')](function(_0x3f542a){if(_0x3f542a&&_0x3f542a[_0xa66f('0xf4')]&&_0x551c09[_0xa66f('0x84')]){var _0x2d3123={'tls':{'rejectUnauthorized':![]}};if(_0x3f542a['Smtp'][_0xa66f('0xf5')]){_0x2d3123[_0xa66f('0xf5')]=_0x3f542a[_0xa66f('0xf4')][_0xa66f('0xf5')];}else{_0x2d3123['host']=_0x3f542a[_0xa66f('0xf4')][_0xa66f('0xf6')];_0x2d3123['port']=_0x3f542a[_0xa66f('0xf4')][_0xa66f('0xf7')];_0x2d3123[_0xa66f('0xf8')]=_0x3f542a[_0xa66f('0xf4')]['secure'];}if(_0x3f542a[_0xa66f('0xf4')][_0xa66f('0xf9')]){_0x2d3123['auth']={'user':_0x3f542a[_0xa66f('0xf4')][_0xa66f('0xc8')],'pass':_0x3f542a[_0xa66f('0xf4')]['pass']};}return respondWithRpcPromise(_0xa66f('0xfa'),_0xa66f('0xfb'),{'account':_0x2d3123,'message':{'from':util[_0xa66f('0xe1')]('\x22%s\x22\x20<%s>',_0x3f542a[_0xa66f('0x38')],_0x3f542a[_0xa66f('0xfc')]||_0x3f542a['Smtp']['user']),'to':_0x551c09[_0xa66f('0x84')][_0xa66f('0xdf')],'subject':'Mail\x20Transcript','text':util[_0xa66f('0xe1')](_0xa66f('0xfd'),_0x551c09[_0xa66f('0x84')][_0xa66f('0xdf')]),'attachments':[{'path':_0x13bbe7}]}})[_0xa66f('0x20')](function(){return _0x49dff5;})['catch'](function(_0xfc1774){console[_0xa66f('0x27')](_0xfc1774);});}else{return _0x49dff5;}})['then'](respondWithStatusCode(_0x4c2bf9,0xc8))[_0xa66f('0x2a')](handleError(_0x4c2bf9,null));};exports['addMessage']=function(_0x506797,_0x3465fe,_0xe73ef3){return db['ChatMessage'][_0xa66f('0x6e')]({'where':{'id':_0x506797['params']['id']}})[_0xa66f('0x20')](handleEntityNotFound(_0x3465fe,null))[_0xa66f('0x20')](function(_0x49553c){if(_0x49553c){return _0x49553c['addMessage'](_0x506797['body'][_0xa66f('0xfe')],_[_0xa66f('0xff')](_0x506797[_0xa66f('0x84')],[_0xa66f('0xfe'),'id'])||{});}})[_0xa66f('0x20')](respondWithResult(_0x3465fe,null))[_0xa66f('0x2a')](handleError(_0x3465fe,null));};exports[_0xa66f('0x100')]=function(_0x5a762d,_0x4f4c60,_0xb9b79b){var _0x34422e={'raw':![],'where':{}};var _0x2efe45={};var _0x3580b5={'count':0x0,'rows':[]};return db[_0xa66f('0x42')][_0xa66f('0xc1')]({'where':{'id':_0x5a762d['params']['id']}})[_0xa66f('0x20')](handleEntityNotFound(_0x4f4c60,null))[_0xa66f('0x20')](function(_0x4e6605){if(_0x4e6605){_0x2efe45[_0xa66f('0x46')]=_['keys'](db[_0xa66f('0xc9')]['rawAttributes']);_0x2efe45['query']=_[_0xa66f('0x48')](_0x5a762d[_0xa66f('0x47')]);_0x2efe45[_0xa66f('0x52')]=_[_0xa66f('0x49')](_0x2efe45[_0xa66f('0x46')],_0x2efe45['query']);_0x34422e['attributes']=_[_0xa66f('0x49')](_0x2efe45[_0xa66f('0x46')],qs[_0xa66f('0x4b')](_0x5a762d['query']['fields']));_0x34422e['attributes']=_0x34422e[_0xa66f('0x4a')][_0xa66f('0x4c')]?_0x34422e[_0xa66f('0x4a')]:_0x2efe45[_0xa66f('0x46')];if(!_0x5a762d[_0xa66f('0x47')][_0xa66f('0x4d')]('nolimit')){_0x34422e[_0xa66f('0x30')]=qs[_0xa66f('0x30')](_0x5a762d[_0xa66f('0x47')]['limit']);_0x34422e[_0xa66f('0x2f')]=qs[_0xa66f('0x2f')](_0x5a762d['query']['offset']);}_0x34422e[_0xa66f('0x4f')]=qs[_0xa66f('0x50')](_0x5a762d[_0xa66f('0x47')][_0xa66f('0x50')]);_0x34422e['where']=qs[_0xa66f('0x52')](_[_0xa66f('0x53')](_0x5a762d[_0xa66f('0x47')],_0x2efe45[_0xa66f('0x52')]));_0x34422e[_0xa66f('0x51')]['ChatInteractionId']=_0x4e6605['id'];if(_0x5a762d[_0xa66f('0x47')][_0xa66f('0x94')]){_0x34422e[_0xa66f('0x51')]=_['merge'](_0x34422e[_0xa66f('0x51')],{'$or':_[_0xa66f('0x3b')](_0x34422e['attributes'],function(_0x5d1e51){var _0x3c3aff={};_0x3c3aff[_0x5d1e51]={'$like':'%'+_0x5a762d[_0xa66f('0x47')]['filter']+'%'};return _0x3c3aff;})});}if(_0x5a762d[_0xa66f('0x47')][_0xa66f('0x8c')]){var _0x49e22d=_0x5a762d[_0xa66f('0x47')]['$gte'][_0xa66f('0x3d')](',');var _0x43cc99={};_0x43cc99[_0x49e22d[0x0]]={'$gte':moment(_0x49e22d[0x1])['format'](_0xa66f('0x101'))};_0x34422e[_0xa66f('0x51')]=_['merge'](_0x34422e['where'],_0x43cc99);}_0x34422e=_['merge']({},_0x34422e,_0x5a762d[_0xa66f('0x102')]);return db[_0xa66f('0xc9')][_0xa66f('0x2e')]({'where':_0x34422e[_0xa66f('0x51')]})[_0xa66f('0x20')](function(_0x488253){_0x3580b5[_0xa66f('0x2e')]=_0x488253;if(_0x5a762d[_0xa66f('0x47')]['includeAll']){_0x34422e['include']=[{'all':!![]}];}return db['ChatMessage'][_0xa66f('0x103')](_0x34422e);})[_0xa66f('0x20')](function(_0x434b72){_0x3580b5['rows']=_0x434b72;return _0x3580b5;});}})[_0xa66f('0x20')](respondWithFilteredResult(_0x4f4c60,_0x34422e))[_0xa66f('0x2a')](handleError(_0x4f4c60,null));};exports[_0xa66f('0x104')]=function(_0x49fb27,_0x442b85,_0x811e6c){var _0x227999={'where':{}},_0x4f06b8={},_0x37b86c={'count':0x0,'rows':[]};return db[_0xa66f('0x42')][_0xa66f('0xc1')]({'where':{'id':_0x49fb27[_0xa66f('0xbb')]['id']}})[_0xa66f('0x20')](handleEntityNotFound(_0x442b85,null))[_0xa66f('0x20')](function(_0x20e318){if(_0x20e318){_0x4f06b8[_0xa66f('0x46')]=_['keys'](db[_0xa66f('0xc9')][_0xa66f('0x43')]);_0x4f06b8[_0xa66f('0x47')]=_[_0xa66f('0x48')](_0x49fb27[_0xa66f('0x47')]);_0x4f06b8[_0xa66f('0x52')]=_[_0xa66f('0x49')](_0x4f06b8[_0xa66f('0x46')],_0x4f06b8[_0xa66f('0x47')]);_0x227999[_0xa66f('0x4a')]=_[_0xa66f('0x49')](_0x4f06b8[_0xa66f('0x46')],qs[_0xa66f('0x4b')](_0x49fb27[_0xa66f('0x47')][_0xa66f('0x4b')]));_0x227999[_0xa66f('0x4a')]=_0x227999[_0xa66f('0x4a')]['length']?_0x227999[_0xa66f('0x4a')]:_0x4f06b8['model'];if(!_0x49fb27['query']['hasOwnProperty'](_0xa66f('0x4e'))){_0x227999[_0xa66f('0x30')]=qs[_0xa66f('0x30')](_0x49fb27[_0xa66f('0x47')][_0xa66f('0x30')]);_0x227999['offset']=qs[_0xa66f('0x2f')](_0x49fb27['query'][_0xa66f('0x2f')]);}_0x227999[_0xa66f('0x4f')]=qs['sort'](_0x49fb27['query'][_0xa66f('0x50')]);_0x227999[_0xa66f('0x51')]=qs[_0xa66f('0x52')](_[_0xa66f('0x53')](_0x49fb27[_0xa66f('0x47')],_0x4f06b8['filters']));_0x227999[_0xa66f('0x51')]['ChatInteractionId']=_0x20e318['id'];if(_0x49fb27[_0xa66f('0x47')][_0xa66f('0x94')]){_0x227999[_0xa66f('0x51')]=_[_0xa66f('0xa7')](_0x227999[_0xa66f('0x51')],{'$or':_[_0xa66f('0x3b')](_0x227999[_0xa66f('0x4a')],function(_0x21ec7f){var _0x32b1c1={};_0x32b1c1[_0x21ec7f]={'$like':'%'+_0x49fb27['query'][_0xa66f('0x94')]+'%'};return _0x32b1c1;})});}_0x227999[_0xa66f('0x51')][_0xa66f('0xf1')]=![];if(_0x49fb27['query']['id']){_0x227999['where']['id']={'$gt':_0x49fb27[_0xa66f('0x47')]['id']};}_0x227999=_[_0xa66f('0xa7')]({},_0x227999,_0x49fb27[_0xa66f('0x102')]);return db['ChatMessage'][_0xa66f('0x2e')]({'where':_0x227999[_0xa66f('0x51')]})['then'](function(_0x36d3de){_0x37b86c[_0xa66f('0x2e')]=_0x36d3de;_0x227999[_0xa66f('0xbd')]=[];if(_0x49fb27[_0xa66f('0x47')][_0xa66f('0x105')]){_0x227999[_0xa66f('0xbd')][_0xa66f('0x3f')]({'model':db[_0xa66f('0x80')],'as':_0xa66f('0x80'),'attributes':['id',_0xa66f('0x3c'),_0xa66f('0xeb')]});}if(_0x49fb27[_0xa66f('0x47')]['includeAll']){_0x227999[_0xa66f('0xbd')]=[{'all':!![]}];}return db[_0xa66f('0xc9')][_0xa66f('0x103')](_0x227999);})[_0xa66f('0x20')](function(_0x4f7bae){_0x37b86c[_0xa66f('0x106')]=_0x4f7bae;return _0x37b86c;});}})['then'](respondWithFilteredResult(_0x442b85,_0x227999))[_0xa66f('0x2a')](handleError(_0x442b85,null));};exports[_0xa66f('0x107')]=function(_0x56282c,_0x5e5f6b,_0x289054){return db[_0xa66f('0x42')][_0xa66f('0x6e')]({'where':{'id':_0x56282c[_0xa66f('0xbb')]['id']}})[_0xa66f('0x20')](handleEntityNotFound(_0x5e5f6b,null))[_0xa66f('0x20')](function(_0x541624){if(_0x541624){return _0x541624['setTags'](_0x56282c['body'][_0xa66f('0xfe')],_[_0xa66f('0xff')](_0x56282c[_0xa66f('0x84')],[_0xa66f('0xfe'),'id'])||{})[_0xa66f('0x108')](function(){return db['Tag'][_0xa66f('0x103')]({'attributes':['id','name',_0xa66f('0x56')],'where':{'id':_0x56282c[_0xa66f('0x84')][_0xa66f('0xfe')]}});})['then'](function(_0x5cdbed){socket[_0xa66f('0x109')](_0xa66f('0x10a'),{'id':Number(_0x56282c[_0xa66f('0xbb')]['id']),'tags':_0x5cdbed||[]});return{'id':Number(_0x56282c[_0xa66f('0xbb')]['id']),'tags':_0x5cdbed||[]};});}})[_0xa66f('0x20')](respondWithResult(_0x5e5f6b,null))[_0xa66f('0x2a')](handleError(_0x5e5f6b,null));};exports['removeTags']=function(_0xf10419,_0x4a5657,_0x5834e7){return db[_0xa66f('0x42')][_0xa66f('0x6e')]({'where':{'id':_0xf10419[_0xa66f('0xbb')]['id']}})['then'](handleEntityNotFound(_0x4a5657,null))['then'](function(_0x579c0d){if(_0x579c0d){return _0x579c0d['removeTags'](_0xf10419[_0xa66f('0x47')][_0xa66f('0xfe')]);}})[_0xa66f('0x20')](respondWithStatusCode(_0x4a5657,null))[_0xa66f('0x2a')](handleError(_0x4a5657,null));};exports[_0xa66f('0xdb')]=function(_0x6e41fd,_0x247be){var _0x31ae31=moment()[_0xa66f('0x10b')]()[_0xa66f('0xa6')]();var _0x24e6ec=path[_0xa66f('0xdc')](config[_0xa66f('0x10c')],_0xa66f('0x10d'),'files','tmp');var _0x554ba6=path[_0xa66f('0xdc')](config[_0xa66f('0x10c')],_0xa66f('0x10d'),_0xa66f('0x10e'),_0xa66f('0x10f'));var _0x44649c=path['join'](_0x24e6ec,_0x31ae31);var _0x23c1bc=util[_0xa66f('0xe1')](_0xa66f('0x110'),_0x6e41fd['params']['id'],_0x31ae31);var _0x21a5bd=path[_0xa66f('0xdc')](_0x24e6ec,_0x23c1bc);var _0x3b9bc5=[];_0x3b9bc5[_0xa66f('0x3f')]({'model':db[_0xa66f('0x80')],'as':_0xa66f('0x80'),'attributes':['id',_0xa66f('0x3c')],'raw':!![]});_0x3b9bc5[_0xa66f('0x3f')]({'model':db['CmContact'],'as':_0xa66f('0x73'),'attributes':['id',_0xa66f('0x111'),'lastName'],'raw':!![]});if(_0x6e41fd[_0xa66f('0x47')][_0xa66f('0x10f')]){_0x3b9bc5[_0xa66f('0x3f')]({'model':db['Attachment'],'as':_0xa66f('0xd5'),'raw':!![]});}var _0x1440e4=[{'model':db[_0xa66f('0xc9')],'as':'Messages','attributes':['id',_0xa66f('0x84'),_0xa66f('0x8b'),_0xa66f('0xf0'),_0xa66f('0xf1'),'read'],'include':_0x3b9bc5}];_0x1440e4[_0xa66f('0x3f')]({'model':db[_0xa66f('0x112')],'as':_0xa66f('0x113'),'attributes':['id',_0xa66f('0x38')]});_0x1440e4[_0xa66f('0x3f')]({'model':db[_0xa66f('0x80')],'as':_0xa66f('0x114'),'attributes':['id',_0xa66f('0x3c')]});return db[_0xa66f('0x42')][_0xa66f('0x6e')]({'where':{'id':_0x6e41fd['params']['id']},'include':_0x1440e4})[_0xa66f('0x20')](handleEntityNotFound(_0x247be,null))['then'](function(_0x33d9cf){if(_0x33d9cf){var _0xd7dccf=_0x33d9cf[_0xa66f('0x115')]({'plain':!![]});fs[_0xa66f('0x116')](_0x44649c);var _0x536acf={'format':'A4','border':'10px','header':{'height':_0xa66f('0x117'),'contents':{'first':_0xa66f('0x118')}},'footer':{'height':_0xa66f('0x119'),'contents':{'default':util[_0xa66f('0xe1')](_0xa66f('0x11a'),util[_0xa66f('0xe1')](_0xa66f('0x11b'),'Chat',_0xd7dccf['id']),moment()[_0xa66f('0xe1')](_0xa66f('0x11c'))['toString']())}}};var _0x2135c8={'channel':'Chat','account':_0xd7dccf['Account'][_0xa66f('0x38')],'agent':_0xd7dccf[_0xa66f('0x114')]?_0xd7dccf[_0xa66f('0x114')]['fullname']:_0xa66f('0x11d'),'createdAt':moment(_0xd7dccf['createdAt'])[_0xa66f('0xe1')](_0xa66f('0x101'))['toString'](),'closedAt':_0xd7dccf[_0xa66f('0xd7')]?moment(_0xd7dccf[_0xa66f('0x11e')])[_0xa66f('0xe1')](_0xa66f('0x101'))[_0xa66f('0xa6')]():'','disposition':_0xd7dccf[_0xa66f('0x11f')],'chatInfo':{'browser':_0xd7dccf[_0xa66f('0x120')],'os':_0xd7dccf['osName'],'referer':_0xd7dccf[_0xa66f('0x121')],'customerIp':_0xd7dccf[_0xa66f('0x122')],'customerPort':_0xd7dccf['customerPort']?_0xd7dccf[_0xa66f('0x123')]:_0xa66f('0x11d')},'messages':_(_0xd7dccf[_0xa66f('0xe4')])[_0xa66f('0x124')]()[_0xa66f('0x94')]({'secret':![]})[_0xa66f('0x3b')](function(_0x27e026){if(_0x27e026[_0xa66f('0xd5')]){var _0x1f9354=path[_0xa66f('0xdc')](_0x554ba6,_0x27e026[_0xa66f('0xd5')][_0xa66f('0xd2')]);if(fs['existsSync'](_0x1f9354)){fs[_0xa66f('0x125')](_0x1f9354)['pipe'](fs[_0xa66f('0x126')](path[_0xa66f('0xdc')](_0x44649c,_0x27e026[_0xa66f('0xd5')][_0xa66f('0xd2')])));}}return{'date':moment(_0x27e026[_0xa66f('0x8b')])[_0xa66f('0xe1')](_0xa66f('0x101'))['toString'](),'sender':_0x27e026[_0xa66f('0xf0')]==='out'?_0x27e026[_0xa66f('0x80')]?_0x27e026[_0xa66f('0x80')][_0xa66f('0x3c')]:'System':_0x27e026[_0xa66f('0x73')][_0xa66f('0x111')]+(_0x27e026['Contact']['lastName']?'\x20'+_0x27e026[_0xa66f('0x73')][_0xa66f('0x127')]:''),'body':_0x27e026[_0xa66f('0xd5')]?_0x27e026['Attachment'][_0xa66f('0xd2')]:_0x27e026[_0xa66f('0x84')],'direction':_0x27e026[_0xa66f('0xf0')]==='out'?'A':'C','secret':_0x27e026[_0xa66f('0xf1')],'read':_0x27e026[_0xa66f('0x8f')],'attachment':_0x27e026[_0xa66f('0xd5')]};})[_0xa66f('0x76')]()};return ejs[_0xa66f('0x128')](path['join'](config[_0xa66f('0x10c')],_0xa66f('0x10d'),_0xa66f('0x129'),_0xa66f('0x12a')),{'interaction':_0x2135c8})[_0xa66f('0x20')](function(_0x1d7d57){return new BPromise(function(_0x53bbd5,_0x55e0e0){pdf[_0xa66f('0xbe')](_0x1d7d57,_0x536acf)['toFile'](path[_0xa66f('0xdc')](_0x44649c,_0xa66f('0x12b')+_0xd7dccf['id']+'-'+_0x31ae31+'.pdf'),function(_0x2b54bc,_0x20cb01){if(_0x2b54bc)return _0x55e0e0(_0x2b54bc);_0x53bbd5(_0x20cb01);});});})[_0xa66f('0x20')](function(){return new BPromise(function(_0x4c015b,_0x7cfb02){zipdir(_0x44649c,{'saveTo':_0x21a5bd},function(_0x5c6555,_0x5be285){if(_0x5c6555)return _0x7cfb02(_0x5c6555);return _0x4c015b(_0x5be285);});})['then'](function(){return new BPromise(function(_0x4d3039,_0x4fdc9b){rimraf(_0x44649c,function(_0x2eae9e){if(_0x2eae9e)_0x4fdc9b(_0x2eae9e);return _0x4d3039();});});})['then'](function(){return _0x247be[_0xa66f('0xdb')](_0x21a5bd,_0x23c1bc,function(_0x32ee82){if(_0x32ee82){console[_0xa66f('0x12c')](_0xa66f('0x12d'),_0x32ee82);}else{fs[_0xa66f('0x12e')](_0x21a5bd);}});});});}else{return _0x247be[_0xa66f('0x2b')](0xc8);}})[_0xa66f('0x2a')](handleError(_0x247be,null));}; \ No newline at end of file +var _0xc4aa=['rows','show','params','includeAll','include','options','create','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','filename','Attachment','Unauthorized','attachId','download','root','server/files/attachments/','basename','close','join','format','transcript-%s.txt','now','pathTranscript','CmContact','Messages','System','customer','%s%d','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','nolimit','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','addTags','omit','spread','emit','removeTags','unix','tmp','files','attachments','Contact','firstName','lastName','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','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','renderFile','server','views','toFile','transcript-','.pdf','log','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','./chatInteraction.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','name','Users','map','TagIds','Tags','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','left_join','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','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)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','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','concat','$gte','parse','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','sequelize','groupBy','ChatInteractionId','all'];(function(_0x115621,_0x341cde){var _0x5ef5ce=function(_0x2ca3f2){while(--_0x2ca3f2){_0x115621['push'](_0x115621['shift']());}};_0x5ef5ce(++_0x341cde);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc4aa[_0x4f9b18];return _0x29f20c;};'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);var jayson=require(_0xac4a('0x1c'));var client=jayson[_0xac4a('0x1d')][_0xac4a('0x1e')]({'port':0x232b});var client9004=jayson[_0xac4a('0x1d')][_0xac4a('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x11e101,_0x26dbb8,_0x4a2119){if(_0x4a2119){var _0x402fff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x402fff[_0xac4a('0x1f')](_0x26dbb8)){return _0x11e101;}else{throw new db[(_0xac4a('0x20'))][(_0xac4a('0x21'))](_0xac4a('0x22'));}}else{return _0x11e101;}}function respondWithRpcPromise(_0x387a54,_0x28e304,_0x44ec59,_0x546c5d){return new BPromise(function(_0x5ac21e,_0x21a729){var _0x13c8eb=_0x546c5d||client;return _0x13c8eb[_0xac4a('0x23')](_0x387a54,_0x44ec59)['then'](function(_0x39e83e){logger[_0xac4a('0x24')](_0xac4a('0x25'),_0x28e304,_0xac4a('0x26'));logger[_0xac4a('0x27')](_0xac4a('0x28'),_0x28e304,_0xac4a('0x26'),JSON[_0xac4a('0x29')](_0x39e83e));if(_0x39e83e['error']){if(_0x39e83e[_0xac4a('0x2a')][_0xac4a('0x2b')]===0x1f4){logger['error'](_0xac4a('0x25'),_0x28e304,_0x39e83e[_0xac4a('0x2a')][_0xac4a('0x2c')]);return _0x21a729(_0x39e83e[_0xac4a('0x2a')]['message']);}logger[_0xac4a('0x2a')](_0xac4a('0x25'),_0x28e304,_0x39e83e[_0xac4a('0x2a')][_0xac4a('0x2c')]);return _0x5ac21e(_0x39e83e[_0xac4a('0x2a')][_0xac4a('0x2c')]);}else{logger[_0xac4a('0x24')](_0xac4a('0x25'),_0x28e304,_0xac4a('0x26'));_0x5ac21e(_0x39e83e[_0xac4a('0x2d')][_0xac4a('0x2c')]);}})[_0xac4a('0x2e')](function(_0x14832b){logger[_0xac4a('0x2a')](_0xac4a('0x25'),_0x28e304,_0x14832b);_0x21a729(_0x14832b);});});}function respondWithStatusCode(_0x20202c,_0x4e17ce){_0x4e17ce=_0x4e17ce||0xcc;return function(_0x23b061){if(_0x23b061){return _0x20202c[_0xac4a('0x2f')](_0x4e17ce);}return _0x20202c[_0xac4a('0x30')](_0x4e17ce)[_0xac4a('0x31')]();};}function respondWithResult(_0x116700,_0x4a5a9e){_0x4a5a9e=_0x4a5a9e||0xc8;return function(_0x47f49c){if(_0x47f49c){return _0x116700[_0xac4a('0x30')](_0x4a5a9e)[_0xac4a('0x32')](_0x47f49c);}};}function respondWithFilteredResult(_0x1f12d5,_0x546b65){return function(_0x4bda1f){if(_0x4bda1f){var _0x355755=_0x4bda1f[_0xac4a('0x33')],_0x2896bc=_0x546b65['offset'],_0x228629=_0x546b65[_0xac4a('0x34')]+_0x546b65['limit'],_0x432066;if(_0x228629>=_0x355755){_0x228629=_0x355755;_0x432066=0xc8;}else{_0x432066=0xce;}_0x1f12d5[_0xac4a('0x30')](_0x432066);return _0x1f12d5['set'](_0xac4a('0x35'),_0x2896bc+'-'+_0x228629+'/'+_0x355755)[_0xac4a('0x32')](_0x4bda1f);}return null;};}function patchUpdates(_0x31501b){return function(_0x228aa7){try{jsonpatch[_0xac4a('0x36')](_0x228aa7,_0x31501b,!![]);}catch(_0x61e552){return BPromise[_0xac4a('0x37')](_0x61e552);}return _0x228aa7[_0xac4a('0x38')]();};}function saveUpdates(_0x29fb3b,_0xfd7c16){return function(_0x36ab49){if(_0x36ab49){return _0x36ab49[_0xac4a('0x39')](_0x29fb3b)[_0xac4a('0x3a')](function(_0x1a9d4e){return _0x1a9d4e;});}return null;};}function removeEntity(_0x5634e2,_0x30442d){return function(_0x1c41fb){if(_0x1c41fb){return _0x1c41fb['destroy']()[_0xac4a('0x3a')](function(){_0x5634e2[_0xac4a('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58804b,_0x11f0be){return function(_0x1ba096){if(!_0x1ba096){_0x58804b[_0xac4a('0x2f')](0x194);}return _0x1ba096;};}function handleError(_0x3de9e2,_0x4f5986){_0x4f5986=_0x4f5986||0x1f4;return function(_0x453d02){logger[_0xac4a('0x2a')](_0x453d02['stack']);if(_0x453d02[_0xac4a('0x3b')]){delete _0x453d02[_0xac4a('0x3b')];}_0x3de9e2[_0xac4a('0x30')](_0x4f5986)['send'](_0x453d02);};}function getInteractionUsers(_0x121328,_0x357f06){return new BPromise(function(_0x1b5427,_0x4e0445){try{if(_0x357f06[_0x121328['id']]){_0x121328[_0xac4a('0x3c')]=_[_0xac4a('0x3d')](_0x357f06[_0x121328['id']],function(_0x4b9faf){return{'id':_0x4b9faf['id'],'fullname':_0x4b9faf['fullname']};});}}catch(_0x4319a1){_0x4e0445(_0x4319a1);}_0x1b5427(_0x121328);});}function getInteractionTags(_0x5e0926,_0x50e03e){return new BPromise(function(_0x5f0af0,_0x4fee3a){try{if(_0x5e0926[_0xac4a('0x3e')]){_0x5e0926[_0xac4a('0x3f')]=[];_0x5e0926[_0xac4a('0x3e')][_0xac4a('0x40')](',')[_0xac4a('0x41')](function(_0x415f31){_0x5e0926[_0xac4a('0x3f')][_0xac4a('0x42')](_0x50e03e[_0x415f31]);});}delete _0x5e0926[_0xac4a('0x3e')];}catch(_0x1f7721){_0x4fee3a(_0x1f7721);}_0x5f0af0(_0x5e0926);});}function updateChatInteraction(_0x14f7d5,_0x1c2a87,_0x4e4994){return new BPromise(function(_0x5086ff,_0x5cd24f){return getInteractionUsers(_0x14f7d5,_0x4e4994)[_0xac4a('0x3a')](function(_0x5c46a){return getInteractionTags(_0x5c46a,_0x1c2a87);})[_0xac4a('0x3a')](function(_0x118be0){_0x5086ff(_0x118be0);})[_0xac4a('0x2e')](function(_0x411543){_0x5cd24f(_0x411543);});});}exports[_0xac4a('0x43')]=function(_0x3441f2,_0x3e9973){var _0x3edb19={},_0x561cb7={},_0x3f31d1={'count':0x0,'rows':[]};var _0x31bfaf=_[_0xac4a('0x3d')](db[_0xac4a('0x44')][_0xac4a('0x45')],function(_0x57b879){return{'name':_0x57b879[_0xac4a('0x46')],'type':_0x57b879[_0xac4a('0x47')]['key']};});_0x561cb7[_0xac4a('0x48')]=_['map'](_0x31bfaf,_0xac4a('0x3b'));_0x561cb7[_0xac4a('0x49')]=_[_0xac4a('0x4a')](_0x3441f2[_0xac4a('0x49')]);_0x561cb7[_0xac4a('0x4b')]=_[_0xac4a('0x4c')](_0x561cb7[_0xac4a('0x48')],_0x561cb7[_0xac4a('0x49')]);_0x3edb19[_0xac4a('0x4d')]=_[_0xac4a('0x4c')](_0x561cb7[_0xac4a('0x48')],qs[_0xac4a('0x4e')](_0x3441f2['query'][_0xac4a('0x4e')]));_0x3edb19[_0xac4a('0x4d')]=_0x3edb19[_0xac4a('0x4d')]['length']?_0x3edb19[_0xac4a('0x4d')]:_0x561cb7[_0xac4a('0x48')];if(!_0x3441f2['query'][_0xac4a('0x4f')]('nolimit')){_0x3edb19[_0xac4a('0x50')]=qs[_0xac4a('0x50')](_0x3441f2[_0xac4a('0x49')]['limit']);_0x3edb19['offset']=qs[_0xac4a('0x34')](_0x3441f2['query'][_0xac4a('0x34')]);}_0x3edb19['order']=qs[_0xac4a('0x51')](_0x3441f2['query'][_0xac4a('0x51')]);_0x3edb19[_0xac4a('0x52')]=qs[_0xac4a('0x4b')](_[_0xac4a('0x53')](_0x3441f2['query'],_0x561cb7[_0xac4a('0x4b')]),_0x31bfaf);var _0x2af87f=[];var _0x25bf3c=squel[_0xac4a('0x54')]()[_0xac4a('0x55')]('id')[_0xac4a('0x55')](_0xac4a('0x3b'))['field'](_0xac4a('0x56'))[_0xac4a('0x57')]('tools_tags');var _0x16afbe=squel[_0xac4a('0x54')]()[_0xac4a('0x55')](_0xac4a('0x58'))['field'](_0xac4a('0x59'))[_0xac4a('0x55')](_0xac4a('0x5a'))[_0xac4a('0x57')](_0xac4a('0x5b'),'ui')['left_join'](_0xac4a('0x5c'),'u','u.id\x20=\x20ui.UserId');var _0x307441=squel[_0xac4a('0x54')]()['from']('chat_interactions','i')[_0xac4a('0x5d')](_0xac4a('0x5e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xac4a('0x5d')](_0xac4a('0x5c'),'o',_0xac4a('0x5f'))[_0xac4a('0x5d')]('chat_websites','a',_0xac4a('0x60'))[_0xac4a('0x5d')](_0xac4a('0x61'),'me',_0xac4a('0x62'))[_0xac4a('0x5d')](_0xac4a('0x63'),'it',_0xac4a('0x64'))['left_join'](_0xac4a('0x65'),'t',_0xac4a('0x66'));var _0xe870ba=squel[_0xac4a('0x67')]();var _0x1b7231=[];var _0x2ac1e9=squel[_0xac4a('0x67')]();var _0x236f57;if(_0x3441f2[_0xac4a('0x49')][_0xac4a('0x68')]){_0x236f57=as[_0xac4a('0x69')](_0x3441f2[_0xac4a('0x49')][_0xac4a('0x68')]);var _0x2fe7df=_0x236f57[_0xac4a('0x6a')];for(var _0x11c753=0x0;_0x11c753<_0x236f57['conditions'][_0xac4a('0x6b')];_0x11c753++){var _0x479ebc=_0x236f57[_0xac4a('0x6c')][_0x11c753];var _0x4b7f79='i';var _0x2a30e8=_['find'](_0x31bfaf,[_0xac4a('0x3b'),_0x479ebc['field']]);if(!_0x2a30e8){switch(_0x479ebc['field']){case _0xac4a('0x6d'):if(_0x479ebc[_0xac4a('0x6e')]==0x1){_0x307441[_0xac4a('0x6f')]('`'+_0x479ebc[_0xac4a('0x55')]+_0xac4a('0x70'));}else{_0x307441[_0xac4a('0x6f')]('`'+_0x479ebc['field']+_0xac4a('0x71'));}break;case'Contact':if(_0x479ebc[_0xac4a('0x72')]==='$substring'){if(_0x479ebc[_0xac4a('0x6e')][_0xac4a('0x40')]('\x20')[_0xac4a('0x6b')]>0x1){_0xe870ba[_0x2fe7df](_0xac4a('0x73'),qs[_0xac4a('0x74')](_0x479ebc[_0xac4a('0x6e')]),null);}else{var _0x3abd57='%'+_0x479ebc[_0xac4a('0x6e')]+'%';_0xe870ba[_0x2fe7df](_0xac4a('0x75'),_0x3abd57,_0x3abd57,_0x3abd57);}}else{_0x2a30e8=_[_0xac4a('0x76')](_0x31bfaf,[_0xac4a('0x3b'),_0xac4a('0x77')]);_0x479ebc[_0xac4a('0x55')]=_0xac4a('0x77');_0xc74ce8=as[_0xac4a('0x78')](_0x4b7f79,_0x2a30e8[_0xac4a('0x47')],_0x479ebc);_0xe870ba[_0x2fe7df](_0xc74ce8[_0xac4a('0x79')],_0xc74ce8['value'][_0xac4a('0x7a')],_0xc74ce8[_0xac4a('0x6e')]['end']);}break;case _0xac4a('0x7b'):var _0x34bd1c=_0x479ebc[_0xac4a('0x6e')][_0xac4a('0x40')](',')[_0xac4a('0x3d')](function(_0x4d1440){return Number(_0x4d1440);});_0x34bd1c['forEach'](function(_0x45f3c3){_0x2ac1e9['or'](_0xac4a('0x7c'),'%,'+_0x45f3c3+',%');});_0x1b7231=_[_0xac4a('0x7d')](_0x1b7231,_0x34bd1c);break;case _0xac4a('0x7e'):if(_0x479ebc[_0xac4a('0x72')]===_0xac4a('0x7f')){_0xe870ba[_0x2fe7df](_0xac4a('0x80'),'%'+_0x479ebc[_0xac4a('0x6e')]+'%',null);}else{_0x2a30e8=_[_0xac4a('0x76')](_0x31bfaf,[_0xac4a('0x3b'),_0xac4a('0x81')]);_0x479ebc['field']='UserId';_0xc74ce8=as[_0xac4a('0x78')](_0x4b7f79,_0x2a30e8[_0xac4a('0x47')],_0x479ebc);_0xe870ba[_0x2fe7df](_0xc74ce8[_0xac4a('0x79')],_0xc74ce8[_0xac4a('0x6e')][_0xac4a('0x7a')],_0xc74ce8[_0xac4a('0x6e')][_0xac4a('0x31')]);}break;case _0xac4a('0x82'):_0xc74ce8=as[_0xac4a('0x78')]('me',null,_0x479ebc);_0xe870ba[_0x2fe7df](_0xc74ce8[_0xac4a('0x79')],_0xc74ce8[_0xac4a('0x6e')][_0xac4a('0x7a')],_0xc74ce8['value'][_0xac4a('0x31')]);break;}}else{var _0xc74ce8=as[_0xac4a('0x78')](_0x4b7f79,_0x2a30e8[_0xac4a('0x47')],_0x479ebc);_0xe870ba[_0x2fe7df](_0xc74ce8['text'],_0xc74ce8[_0xac4a('0x6e')]['start'],_0xc74ce8[_0xac4a('0x6e')][_0xac4a('0x31')]);}}}else{var _0x499abc=_(_0x3441f2['query'])[_0xac4a('0x4a')]()[_0xac4a('0x3d')](function(_0x13097f){return _['some'](_0x31bfaf,[_0xac4a('0x3b'),_0x13097f])?_0x13097f:undefined;})['compact']()[_0xac4a('0x6e')]();if(!_['isEmpty'](_0x499abc)){_0x499abc['forEach'](function(_0x118c03){if(_0x118c03==='ChatWebsiteId'){_0x307441[_0xac4a('0x52')]('i.ChatWebsiteId\x20IN\x20?',[][_0xac4a('0x83')](_0x3441f2[_0xac4a('0x49')][_0x118c03]));}else if(_0x118c03==='createdAt'){var _0x3980ae=JSON['parse'](_0x3441f2[_0xac4a('0x49')][_0x118c03])[_0xac4a('0x84')];var _0x522949=JSON[_0xac4a('0x85')](_0x3441f2['query'][_0x118c03])['$lte'];_0x307441[_0xac4a('0x52')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3980ae,_0x522949);}else{if(_0x3441f2[_0xac4a('0x49')][_0x118c03]==='null'){_0x307441['where']('i.'+_0x118c03+_0xac4a('0x86'));}else{_0x307441[_0xac4a('0x52')]('i.'+_0x118c03+_0xac4a('0x87'),_0x3441f2['query'][_0x118c03]);}}});}if(_0x3441f2['query'][_0xac4a('0x88')]){if(_0x3441f2[_0xac4a('0x49')]['read']==0x1){_0x307441['having'](_0xac4a('0x89'));}else{_0x307441[_0xac4a('0x6f')](_0xac4a('0x8a'));}}if(_0x3441f2[_0xac4a('0x49')][_0xac4a('0x8b')]){_0x1b7231=_[_0xac4a('0x8c')](_0x3441f2[_0xac4a('0x49')][_0xac4a('0x8b')])?_0x3441f2[_0xac4a('0x49')]['tag']:new Array(_0x3441f2[_0xac4a('0x49')][_0xac4a('0x8b')]);_0x1b7231[_0xac4a('0x41')](function(_0x582e1e){_0x2ac1e9['or'](_0xac4a('0x7c'),'%,'+_0x582e1e+',%');});}if(_0x3441f2[_0xac4a('0x49')][_0xac4a('0x8d')]){var _0x391c35=_0x3441f2[_0xac4a('0x49')]['filter'][_0xac4a('0x8e')]('\x5c','\x5c\x5c')[_0xac4a('0x8e')]('\x27\x27',_0xac4a('0x8f'));if(qs[_0xac4a('0x90')](_0x391c35)){_0xe870ba['or'](_0xac4a('0x91'),_0x391c35+'%');}else{_0xe870ba['or'](_0xac4a('0x92'),qs[_0xac4a('0x74')](_0x391c35))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x391c35+'%');}}}_0x307441[_0xac4a('0x52')](_0xe870ba);_0x307441[_0xac4a('0x93')](_0xac4a('0x94'));var _0x35a97c={'type':db[_0xac4a('0x20')][_0xac4a('0x95')]['SELECT'],'raw':!![]};var _0x318bee=_0x307441[_0xac4a('0x96')]();_0x318bee[_0xac4a('0x55')](_0xac4a('0x94'));_0x318bee['field'](_0xac4a('0x97'),'unreadMessages');if(_0x3edb19[_0xac4a('0x98')]){_0x3edb19[_0xac4a('0x98')]['forEach'](function(_0x5b95ab){_0x307441[_0xac4a('0x98')]('i.'+_0x5b95ab[0x0],_0x5b95ab[0x1]===_0xac4a('0x99')?![]:!![]);});}if(!_[_0xac4a('0x9a')](_0x1b7231)){_0x307441['having'](_0x2ac1e9);_0x318bee[_0xac4a('0x52')]('t.id\x20IN\x20?',_0x1b7231);}BPromise[_0xac4a('0x9b')]()[_0xac4a('0x3a')](function(){if(!_0x236f57){if(_0x3441f2[_0xac4a('0x49')][_0xac4a('0x9c')]||_0x3441f2[_0xac4a('0x49')]['journey'])return;_0x318bee['where'](_0xac4a('0x9d'));_0x307441[_0xac4a('0x52')](_0xac4a('0x9d'));return;}return _0x3441f2[_0xac4a('0x9e')][_0xac4a('0x9f')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x3a')](function(_0x1b203c){if(_[_0xac4a('0x9a')](_0x1b203c)){_0x318bee['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x307441[_0xac4a('0x52')](_0xac4a('0xa0'));}else{_0x318bee[_0xac4a('0x52')](_0xac4a('0xa1'),_[_0xac4a('0x3d')](_0x1b203c,'id'));_0x307441[_0xac4a('0x52')](_0xac4a('0xa1'),_[_0xac4a('0x3d')](_0x1b203c,'id'));}});})['then'](function(){db['sequelize'][_0xac4a('0x49')](_0x318bee[_0xac4a('0xa2')](),_0x35a97c)[_0xac4a('0x3a')](function(_0x371e06){_0x3f31d1[_0xac4a('0x33')]=_0x371e06[_0xac4a('0x6b')];if(_0x3f31d1[_0xac4a('0x33')]===0x0)return[];return db['sequelize'][_0xac4a('0x49')](_0x25bf3c[_0xac4a('0xa2')](),_0x35a97c)[_0xac4a('0x3a')](function(_0x5f323d){_0x2af87f=_[_0xac4a('0xa3')](_0x5f323d,'id');_0x35a97c=_[_0xac4a('0xa4')](_0x35a97c,{'model':db[_0xac4a('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3441f2[_0xac4a('0x49')][_0xac4a('0x4e')]){_0x3edb19[_0xac4a('0x4d')][_0xac4a('0x41')](function(_0x2ef42a){_0x307441[_0xac4a('0x55')]('i.'+_0x2ef42a);});}else{_0x307441['field'](_0xac4a('0x97'),'unreadMessages');_0x307441[_0xac4a('0x55')](_0xac4a('0xa5'),_0xac4a('0xa6'));_0x307441[_0xac4a('0x55')](_0xac4a('0xa7'),_0xac4a('0xa8'));_0x307441[_0xac4a('0x55')]('i.*');_0x307441[_0xac4a('0x55')](_0xac4a('0xa9'),_0xac4a('0xaa'));_0x307441[_0xac4a('0x55')](_0xac4a('0xab'),'Contact.lastName');_0x307441[_0xac4a('0x55')](_0xac4a('0xac'),'Contact.email');_0x307441['field'](_0xac4a('0xad'),_0xac4a('0xae'));_0x307441['field'](_0xac4a('0xaf'),_0xac4a('0xb0'));_0x307441[_0xac4a('0x55')](_0xac4a('0xb1'),_0xac4a('0xb2'));_0x307441[_0xac4a('0x55')]('o.fullname',_0xac4a('0xb3'));_0x307441[_0xac4a('0x55')](_0xac4a('0xb4'),'Owner.internal');_0x307441[_0xac4a('0x55')](_0xac4a('0xb5'),_0xac4a('0x3e'));}if(_0x3edb19[_0xac4a('0x50')])_0x307441[_0xac4a('0x50')](_0x3edb19[_0xac4a('0x50')]);if(_0x3edb19['offset'])_0x307441[_0xac4a('0x34')](_0x3edb19[_0xac4a('0x34')]);return db['sequelize'][_0xac4a('0x49')](_0x307441['toString'](),_0x35a97c);})[_0xac4a('0x3a')](function(_0x388ed7){_0x16afbe['where'](_0xac4a('0xb6'),_['map'](_0x388ed7,'id'));return db[_0xac4a('0xb7')]['query'](_0x16afbe[_0xac4a('0xa2')](),_0x35a97c)[_0xac4a('0x3a')](function(_0x24f464){var _0xfe8977=_[_0xac4a('0xb8')](_0x24f464,_0xac4a('0xb9'));var _0x7e403a=[];_0x388ed7[_0xac4a('0x41')](function(_0x15431a){_0x7e403a[_0xac4a('0x42')](updateChatInteraction(_0x15431a,_0x2af87f,_0xfe8977));});return BPromise[_0xac4a('0xba')](_0x7e403a);});});})[_0xac4a('0x3a')](function(_0x47a834){_0x3f31d1[_0xac4a('0xbb')]=_0x47a834;return _0x3f31d1;})['then'](respondWithFilteredResult(_0x3e9973,_0x3edb19));})[_0xac4a('0x2e')](handleError(_0x3e9973,null));};exports[_0xac4a('0xbc')]=function(_0x54a02e,_0x3cd213){var _0x31d190={'raw':![],'where':{'id':_0x54a02e[_0xac4a('0xbd')]['id']}},_0x1b10ad={};_0x1b10ad[_0xac4a('0x48')]=_['keys'](db[_0xac4a('0x44')]['rawAttributes']);_0x1b10ad[_0xac4a('0x49')]=_[_0xac4a('0x4a')](_0x54a02e[_0xac4a('0x49')]);_0x1b10ad[_0xac4a('0x4b')]=_['intersection'](_0x1b10ad[_0xac4a('0x48')],_0x1b10ad['query']);_0x31d190[_0xac4a('0x4d')]=_[_0xac4a('0x4c')](_0x1b10ad[_0xac4a('0x48')],qs['fields'](_0x54a02e[_0xac4a('0x49')][_0xac4a('0x4e')]));_0x31d190[_0xac4a('0x4d')]=_0x31d190['attributes'][_0xac4a('0x6b')]?_0x31d190[_0xac4a('0x4d')]:_0x1b10ad[_0xac4a('0x48')];if(_0x54a02e[_0xac4a('0x49')][_0xac4a('0xbe')]){_0x31d190[_0xac4a('0xbf')]=[{'all':!![]}];}_0x31d190=_[_0xac4a('0xa4')]({},_0x31d190,_0x54a02e[_0xac4a('0xc0')]);return db['ChatInteraction'][_0xac4a('0x76')](_0x31d190)['then'](handleEntityNotFound(_0x3cd213,null))['then'](respondWithResult(_0x3cd213,null))['catch'](handleError(_0x3cd213,null));};exports['create']=function(_0x502275,_0x261e4c){return db[_0xac4a('0x44')][_0xac4a('0xc1')](_0x502275[_0xac4a('0x82')],{})[_0xac4a('0x3a')](respondWithResult(_0x261e4c,0xc9))['catch'](handleError(_0x261e4c,null));};exports[_0xac4a('0x39')]=function(_0xc7f914,_0x332a69){if(_0xc7f914[_0xac4a('0x82')]['id']){delete _0xc7f914[_0xac4a('0x82')]['id'];}return db[_0xac4a('0x44')][_0xac4a('0x76')]({'where':{'id':_0xc7f914[_0xac4a('0xbd')]['id']}})['then'](handleEntityNotFound(_0x332a69,null))[_0xac4a('0x3a')](saveUpdates(_0xc7f914[_0xac4a('0x82')],null))[_0xac4a('0x3a')](respondWithResult(_0x332a69,null))[_0xac4a('0x2e')](handleError(_0x332a69,null));};exports[_0xac4a('0xc2')]=function(_0x154fa2,_0x13360e){return db['ChatInteraction']['find']({'where':{'id':_0x154fa2[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](handleEntityNotFound(_0x13360e,null))['then'](removeEntity(_0x13360e,null))[_0xac4a('0x2e')](handleError(_0x13360e,null));};exports[_0xac4a('0xc3')]=function(_0x503880,_0x5bd013){return db[_0xac4a('0x44')][_0xac4a('0xc3')]()[_0xac4a('0x3a')](respondWithResult(_0x5bd013,null))[_0xac4a('0x2e')](handleError(_0x5bd013,null));};exports[_0xac4a('0xc4')]=function(_0x4ab840,_0x19e340){var _0x5e9cb2=_0x4ab840['params']['id'];var _0x538cfd;var _0x63c30;var _0x4301c3;return db[_0xac4a('0x44')][_0xac4a('0xc5')]({'where':{'id':_0x5e9cb2}})[_0xac4a('0x3a')](function(_0x24cb52){_0x538cfd=_0x24cb52;return db[_0xac4a('0xc6')][_0xac4a('0xc5')]({'where':{'id':_0x24cb52['ChatWebsiteId']},'attributes':['id','vidaooApiKey','vidaooEscalation'],'raw':!![]});})[_0xac4a('0x3a')](function(_0x279852){if(_0x279852&&_0x279852[_0xac4a('0xc7')]&&_0x279852[_0xac4a('0xc8')]){_0x63c30=_0x279852;var _0x214d74={'rejectUnauthorized':![],'method':_0xac4a('0xc9'),'uri':_0xac4a('0xca'),'headers':{'X-APIKEY':_0x279852[_0xac4a('0xc7')]},'body':{'name':_0xac4a('0xcb')+_0x5e9cb2},'redirect':_0xac4a('0xcc'),'json':!![]};return rp(_0x214d74);}else{throw new db[(_0xac4a('0x20'))][(_0xac4a('0x21'))](_0xac4a('0xcd'));}})[_0xac4a('0x3a')](function(_0x356a6b){_0x4301c3=_0x356a6b;if(_0x4301c3['id']){var _0x34b93c={'body':_0x4301c3[_0xac4a('0xce')],'ChatWebsiteId':_0x63c30['id'],'ChatInteractionId':_0x538cfd['id'],'direction':_0xac4a('0xcf'),'UserId':_0x4ab840[_0xac4a('0x9e')]['id']};return db[_0xac4a('0xd0')][_0xac4a('0xc1')](_0x34b93c,{});}else{throw new db[(_0xac4a('0x20'))][(_0xac4a('0x21'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xac4a('0x3a')](function(){return _0x538cfd[_0xac4a('0xd1')]({'vidaooSessionId':_0x4301c3['id']});})[_0xac4a('0x3a')](respondWithResult(_0x19e340,null))[_0xac4a('0x2e')](handleError(_0x19e340,null));};exports[_0xac4a('0xd2')]=function(_0x31afd2,_0x2652f5){if(_0x31afd2[_0xac4a('0x82')]['id']){delete _0x31afd2['body']['id'];}return db['ChatInteraction'][_0xac4a('0x76')]({'where':{'id':_0x31afd2[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](handleEntityNotFound(_0x2652f5,null))['then'](saveUpdates(_0x31afd2['body'],null))['then'](respondWithResult(_0x2652f5,null))[_0xac4a('0x2e')](handleError(_0x2652f5,null));};exports['abandon']=function(_0x59e82c,_0x216055,_0x52963c){if(_0x59e82c[_0xac4a('0x82')]['id']){delete _0x59e82c['body']['id'];}return db[_0xac4a('0x44')][_0xac4a('0x76')]({'where':{'id':_0x59e82c[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](function(_0x403a16){if(!_0x403a16){logger[_0xac4a('0x2a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xac4a('0xd3'),0x194,_0xac4a('0xd4'));_0x216055[_0xac4a('0x2f')](0x194);}else{if(_0x403a16['UserId']){throw new db[(_0xac4a('0x20'))][(_0xac4a('0x21'))](_0xac4a('0xd5'));}}return _0x403a16;})[_0xac4a('0x3a')](function(_0x5bb911){if(_0x5bb911){return _0x5bb911[_0xac4a('0x39')]({'closed':_0x59e82c[_0xac4a('0x82')][_0xac4a('0xd6')],'disposition':_0x59e82c[_0xac4a('0x82')][_0xac4a('0xd7')]})[_0xac4a('0x3a')](function(_0x4a0cd9){return _0x4a0cd9;});}})['then'](function(_0x175f73){return respondWithRpcPromise(_0xac4a('0xd8'),_0xac4a('0xd3'),_0x59e82c[_0xac4a('0x82')],client9004);})[_0xac4a('0x3a')](respondWithResult(_0x216055,null))[_0xac4a('0x2e')](handleError(_0x216055,null));};exports['attachmentUpload']=function(_0x21a6f6,_0x580c9b,_0xe4165d){_0x21a6f6['body'][_0xac4a('0x3b')]=_0x21a6f6[_0xac4a('0xd9')][_0xac4a('0xda')];_0x21a6f6[_0xac4a('0x82')]['basename']=_0x21a6f6[_0xac4a('0xd9')][_0xac4a('0xdb')];_0x21a6f6[_0xac4a('0x82')][_0xac4a('0x47')]=_0x21a6f6[_0xac4a('0xd9')]['mimetype'];return db[_0xac4a('0xdc')][_0xac4a('0xc1')](_0x21a6f6[_0xac4a('0x82')])[_0xac4a('0x3a')](respondWithResult(_0x580c9b,0xc9))[_0xac4a('0x2e')](handleError(_0x580c9b,null));};exports['attachmentDownload']=function(_0x40f41a,_0x4f8908,_0xc2798f){return db[_0xac4a('0x44')][_0xac4a('0xc5')]({'where':{'id':_0x40f41a['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4f8908,null))['then'](function(_0x50d438){if(_0x50d438){if(_0x50d438[_0xac4a('0xd6')]){return _0x4f8908[_0xac4a('0x30')](0x193)[_0xac4a('0x32')]({'status':0x193,'message':_0xac4a('0xdd')});}return db[_0xac4a('0xdc')]['findOne']({'where':{'id':_0x40f41a[_0xac4a('0x49')][_0xac4a('0xde')]},'raw':!![]})['then'](handleEntityNotFound(_0x4f8908,null));}})[_0xac4a('0x3a')](function(_0x14b425){if(_0x14b425){return _0x4f8908[_0xac4a('0xdf')](path['join'](config[_0xac4a('0xe0')],_0xac4a('0xe1'),_0x14b425[_0xac4a('0xe2')]));}})[_0xac4a('0x2e')](handleError(_0x4f8908,null));};exports[_0xac4a('0xe3')]=function(_0x28a2dc,_0x3f9277){var _0x4351ad=null;var _0x4163f0=null;var _0x5ea1e4=null;var _0xb2b3ca=null;if(_0x28a2dc[_0xac4a('0x82')]['id']){delete _0x28a2dc['body']['id'];}if(_0x28a2dc[_0xac4a('0x82')]['mailTranscript']){_0xb2b3ca=path[_0xac4a('0xe4')](config[_0xac4a('0xe0')],'server/files/chat/upload/',util[_0xac4a('0xe5')](_0xac4a('0xe6'),Date[_0xac4a('0xe7')]()));_0x28a2dc[_0xac4a('0x82')][_0xac4a('0xe8')]=_0xb2b3ca;}return db[_0xac4a('0x44')][_0xac4a('0x76')]({'where':{'id':_0x28a2dc[_0xac4a('0xbd')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xac4a('0x7e')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x3f9277,null))[_0xac4a('0x3a')](saveUpdates(_0x28a2dc[_0xac4a('0x82')],null))[_0xac4a('0x3a')](function(_0x516225){if(_0x516225){_0x4351ad=_0x516225;return db[_0xac4a('0xc6')][_0xac4a('0x76')]({'where':{'id':_0x4351ad['ChatWebsiteId']}});}})['then'](function(_0x2e63f9){if(_0x2e63f9){_0x5ea1e4=_0x2e63f9;return db[_0xac4a('0xe9')][_0xac4a('0x76')]({'where':{'id':_0x4351ad[_0xac4a('0x77')]}});}})['then'](function(_0x421c27){if(_0x421c27){_0x4163f0=_0x421c27;if(_0xb2b3ca){var _0x4653f5=null;for(var _0x3a188e=0x1;_0x3a188e<_0x4351ad['Messages'][_0xac4a('0x6b')];++_0x3a188e){_0x4653f5=_0x4351ad[_0xac4a('0xea')][_0x3a188e];var _0x15b97a=_0x4653f5[_0xac4a('0x81')]?util[_0xac4a('0xe5')]('%s%d',_0x5ea1e4['agentAlias'],_0x4653f5[_0xac4a('0x81')]):_0xac4a('0xeb');var _0x1774e5=_0x28a2dc[_0xac4a('0x82')][_0xac4a('0xec')]||util[_0xac4a('0xe5')](_0xac4a('0xed'),_0xac4a('0xee'),_0x4653f5[_0xac4a('0x77')]);switch(_0x5ea1e4[_0xac4a('0xef')]){case _0xac4a('0xf0'):_0x15b97a=_0x4653f5[_0xac4a('0x81')]?util[_0xac4a('0xe5')]('%s%d',_0x5ea1e4[_0xac4a('0xf1')],_0x4653f5['UserId']):'System';break;case _0xac4a('0xf2'):_0x15b97a=_0x4653f5[_0xac4a('0x81')]?_0x4653f5[_0xac4a('0x7e')][_0xac4a('0xf3')]||_0x4653f5[_0xac4a('0x7e')][_0xac4a('0xf4')]:_0xac4a('0xeb');break;case _0xac4a('0xf5'):_0x15b97a=_0x4653f5[_0xac4a('0x81')]?_0x4653f5['User'][_0xac4a('0xf4')]:_0xac4a('0xeb');break;default:_0x15b97a=_0x4653f5[_0xac4a('0x81')]?util[_0xac4a('0xe5')]('%s%d',_0x5ea1e4['agentAlias'],_0x4653f5[_0xac4a('0x81')]):_0xac4a('0xeb');}var _0x20da5e=util[_0xac4a('0xe5')](_0xac4a('0xf6'),moment(_0x4653f5[_0xac4a('0xf7')])[_0xac4a('0xe5')](_0xac4a('0xf8')),_0x4653f5[_0xac4a('0xf9')]==='in'?_0x1774e5:_0x15b97a,_0x4653f5['body']);if(!_0x4653f5[_0xac4a('0xfa')]){fs[_0xac4a('0xfb')](_0xb2b3ca,_0x20da5e);}}return db[_0xac4a('0xfc')][_0xac4a('0xc5')]({'where':{'service':!![]},'include':[{'model':db[_0xac4a('0xfd')],'as':_0xac4a('0xfe'),'raw':!![]}]});}}})['then'](function(_0x4a1133){if(_0x4a1133&&_0x4a1133['Smtp']&&_0x28a2dc[_0xac4a('0x82')]){var _0x321072={'tls':{'rejectUnauthorized':![]}};if(_0x4a1133['Smtp']['service']){_0x321072[_0xac4a('0xff')]=_0x4a1133['Smtp'][_0xac4a('0xff')];}else{_0x321072['host']=_0x4a1133[_0xac4a('0xfe')][_0xac4a('0x100')];_0x321072[_0xac4a('0x101')]=_0x4a1133['Smtp'][_0xac4a('0x101')];_0x321072[_0xac4a('0x102')]=_0x4a1133['Smtp'][_0xac4a('0x102')];}if(_0x4a1133[_0xac4a('0xfe')]['authentication']){_0x321072['auth']={'user':_0x4a1133[_0xac4a('0xfe')][_0xac4a('0x9e')],'pass':_0x4a1133[_0xac4a('0xfe')][_0xac4a('0x103')]};}return respondWithRpcPromise(_0xac4a('0x104'),_0xac4a('0x105'),{'account':_0x321072,'message':{'from':util[_0xac4a('0xe5')](_0xac4a('0x106'),_0x4a1133[_0xac4a('0x3b')],_0x4a1133[_0xac4a('0x107')]||_0x4a1133[_0xac4a('0xfe')][_0xac4a('0x9e')]),'to':_0x28a2dc[_0xac4a('0x82')][_0xac4a('0x108')],'subject':_0xac4a('0x109'),'text':util[_0xac4a('0xe5')](_0xac4a('0x10a'),_0x28a2dc['body'][_0xac4a('0x108')]),'attachments':[{'path':_0xb2b3ca}]}})['then'](function(){return _0x4351ad;})[_0xac4a('0x2e')](function(_0x901233){console[_0xac4a('0x2a')](_0x901233);});}else{return _0x4351ad;}})[_0xac4a('0x3a')](respondWithStatusCode(_0x3f9277,0xc8))[_0xac4a('0x2e')](handleError(_0x3f9277,null));};exports[_0xac4a('0x10b')]=function(_0x8281c9,_0x5c7b5f,_0x368eae){return db['ChatMessage'][_0xac4a('0x76')]({'where':{'id':_0x8281c9[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](handleEntityNotFound(_0x5c7b5f,null))[_0xac4a('0x3a')](function(_0x1a06be){if(_0x1a06be){return _0x1a06be[_0xac4a('0x10b')](_0x8281c9[_0xac4a('0x82')][_0xac4a('0x10c')],_['omit'](_0x8281c9[_0xac4a('0x82')],[_0xac4a('0x10c'),'id'])||{});}})[_0xac4a('0x3a')](respondWithResult(_0x5c7b5f,null))[_0xac4a('0x2e')](handleError(_0x5c7b5f,null));};exports['getMessages']=function(_0x24c40c,_0x21ddef,_0x38ecd8){var _0x53ce1f={'raw':![],'where':{}};var _0x55ea84={};var _0x40c49b={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xac4a('0xc5')]({'where':{'id':_0x24c40c['params']['id']}})['then'](handleEntityNotFound(_0x21ddef,null))[_0xac4a('0x3a')](function(_0x1b952a){if(_0x1b952a){_0x55ea84[_0xac4a('0x48')]=_['keys'](db[_0xac4a('0xd0')][_0xac4a('0x45')]);_0x55ea84['query']=_[_0xac4a('0x4a')](_0x24c40c[_0xac4a('0x49')]);_0x55ea84['filters']=_[_0xac4a('0x4c')](_0x55ea84[_0xac4a('0x48')],_0x55ea84[_0xac4a('0x49')]);_0x53ce1f[_0xac4a('0x4d')]=_[_0xac4a('0x4c')](_0x55ea84[_0xac4a('0x48')],qs[_0xac4a('0x4e')](_0x24c40c[_0xac4a('0x49')]['fields']));_0x53ce1f[_0xac4a('0x4d')]=_0x53ce1f['attributes'][_0xac4a('0x6b')]?_0x53ce1f[_0xac4a('0x4d')]:_0x55ea84[_0xac4a('0x48')];if(!_0x24c40c[_0xac4a('0x49')][_0xac4a('0x4f')](_0xac4a('0x10d'))){_0x53ce1f['limit']=qs[_0xac4a('0x50')](_0x24c40c[_0xac4a('0x49')][_0xac4a('0x50')]);_0x53ce1f[_0xac4a('0x34')]=qs[_0xac4a('0x34')](_0x24c40c[_0xac4a('0x49')][_0xac4a('0x34')]);}_0x53ce1f[_0xac4a('0x98')]=qs['sort'](_0x24c40c[_0xac4a('0x49')]['sort']);_0x53ce1f[_0xac4a('0x52')]=qs[_0xac4a('0x4b')](_[_0xac4a('0x53')](_0x24c40c[_0xac4a('0x49')],_0x55ea84['filters']));_0x53ce1f['where'][_0xac4a('0xb9')]=_0x1b952a['id'];if(_0x24c40c[_0xac4a('0x49')][_0xac4a('0x8d')]){_0x53ce1f[_0xac4a('0x52')]=_[_0xac4a('0xa4')](_0x53ce1f[_0xac4a('0x52')],{'$or':_['map'](_0x53ce1f[_0xac4a('0x4d')],function(_0x301d17){var _0x2bf090={};_0x2bf090[_0x301d17]={'$like':'%'+_0x24c40c['query'][_0xac4a('0x8d')]+'%'};return _0x2bf090;})});}if(_0x24c40c[_0xac4a('0x49')][_0xac4a('0x84')]){var _0x59ee77=_0x24c40c['query'][_0xac4a('0x84')][_0xac4a('0x40')](',');var _0x66f911={};_0x66f911[_0x59ee77[0x0]]={'$gte':moment(_0x59ee77[0x1])[_0xac4a('0xe5')](_0xac4a('0x10e'))};_0x53ce1f[_0xac4a('0x52')]=_[_0xac4a('0xa4')](_0x53ce1f[_0xac4a('0x52')],_0x66f911);}_0x53ce1f=_[_0xac4a('0xa4')]({},_0x53ce1f,_0x24c40c['options']);return db['ChatMessage'][_0xac4a('0x33')]({'where':_0x53ce1f[_0xac4a('0x52')]})[_0xac4a('0x3a')](function(_0x547ddc){_0x40c49b[_0xac4a('0x33')]=_0x547ddc;if(_0x24c40c[_0xac4a('0x49')][_0xac4a('0xbe')]){_0x53ce1f['include']=[{'all':!![]}];}return db['ChatMessage'][_0xac4a('0x10f')](_0x53ce1f);})['then'](function(_0x12b470){_0x40c49b[_0xac4a('0xbb')]=_0x12b470;return _0x40c49b;});}})['then'](respondWithFilteredResult(_0x21ddef,_0x53ce1f))[_0xac4a('0x2e')](handleError(_0x21ddef,null));};exports[_0xac4a('0x110')]=function(_0x4cc6b7,_0xb7cbe2,_0x139121){var _0x1f49f4={'where':{}},_0x304f70={},_0x45af61={'count':0x0,'rows':[]};return db[_0xac4a('0x44')][_0xac4a('0xc5')]({'where':{'id':_0x4cc6b7[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](handleEntityNotFound(_0xb7cbe2,null))['then'](function(_0x3c6316){if(_0x3c6316){_0x304f70[_0xac4a('0x48')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x304f70[_0xac4a('0x49')]=_[_0xac4a('0x4a')](_0x4cc6b7[_0xac4a('0x49')]);_0x304f70[_0xac4a('0x4b')]=_[_0xac4a('0x4c')](_0x304f70[_0xac4a('0x48')],_0x304f70[_0xac4a('0x49')]);_0x1f49f4[_0xac4a('0x4d')]=_['intersection'](_0x304f70['model'],qs['fields'](_0x4cc6b7[_0xac4a('0x49')]['fields']));_0x1f49f4['attributes']=_0x1f49f4[_0xac4a('0x4d')]['length']?_0x1f49f4['attributes']:_0x304f70['model'];if(!_0x4cc6b7[_0xac4a('0x49')][_0xac4a('0x4f')](_0xac4a('0x10d'))){_0x1f49f4[_0xac4a('0x50')]=qs[_0xac4a('0x50')](_0x4cc6b7[_0xac4a('0x49')][_0xac4a('0x50')]);_0x1f49f4[_0xac4a('0x34')]=qs[_0xac4a('0x34')](_0x4cc6b7[_0xac4a('0x49')][_0xac4a('0x34')]);}_0x1f49f4[_0xac4a('0x98')]=qs[_0xac4a('0x51')](_0x4cc6b7['query'][_0xac4a('0x51')]);_0x1f49f4['where']=qs[_0xac4a('0x4b')](_[_0xac4a('0x53')](_0x4cc6b7[_0xac4a('0x49')],_0x304f70[_0xac4a('0x4b')]));_0x1f49f4[_0xac4a('0x52')][_0xac4a('0xb9')]=_0x3c6316['id'];if(_0x4cc6b7['query'][_0xac4a('0x8d')]){_0x1f49f4[_0xac4a('0x52')]=_[_0xac4a('0xa4')](_0x1f49f4['where'],{'$or':_[_0xac4a('0x3d')](_0x1f49f4['attributes'],function(_0x2174e6){var _0xac96a8={};_0xac96a8[_0x2174e6]={'$like':'%'+_0x4cc6b7[_0xac4a('0x49')]['filter']+'%'};return _0xac96a8;})});}_0x1f49f4[_0xac4a('0x52')][_0xac4a('0xfa')]=![];if(_0x4cc6b7['query']['id']){_0x1f49f4[_0xac4a('0x52')]['id']={'$gt':_0x4cc6b7[_0xac4a('0x49')]['id']};}_0x1f49f4=_['merge']({},_0x1f49f4,_0x4cc6b7[_0xac4a('0xc0')]);return db['ChatMessage'][_0xac4a('0x33')]({'where':_0x1f49f4[_0xac4a('0x52')]})['then'](function(_0x4df536){_0x45af61['count']=_0x4df536;_0x1f49f4['include']=[];if(_0x4cc6b7[_0xac4a('0x49')]['includeAgent']){_0x1f49f4[_0xac4a('0xbf')][_0xac4a('0x42')]({'model':db[_0xac4a('0x7e')],'as':'User','attributes':['id',_0xac4a('0xf4'),_0xac4a('0xf3')]});}if(_0x4cc6b7[_0xac4a('0x49')]['includeAll']){_0x1f49f4[_0xac4a('0xbf')]=[{'all':!![]}];}return db['ChatMessage'][_0xac4a('0x10f')](_0x1f49f4);})[_0xac4a('0x3a')](function(_0x542774){_0x45af61[_0xac4a('0xbb')]=_0x542774;return _0x45af61;});}})[_0xac4a('0x3a')](respondWithFilteredResult(_0xb7cbe2,_0x1f49f4))[_0xac4a('0x2e')](handleError(_0xb7cbe2,null));};exports[_0xac4a('0x111')]=function(_0x4f6540,_0x405b6f,_0x291f03){return db[_0xac4a('0x44')][_0xac4a('0x76')]({'where':{'id':_0x4f6540[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](handleEntityNotFound(_0x405b6f,null))[_0xac4a('0x3a')](function(_0x4ecf72){if(_0x4ecf72){return _0x4ecf72['setTags'](_0x4f6540['body'][_0xac4a('0x10c')],_[_0xac4a('0x112')](_0x4f6540['body'],[_0xac4a('0x10c'),'id'])||{})[_0xac4a('0x113')](function(){return db[_0xac4a('0x7b')][_0xac4a('0x10f')]({'attributes':['id','name',_0xac4a('0x56')],'where':{'id':_0x4f6540['body'][_0xac4a('0x10c')]}});})[_0xac4a('0x3a')](function(_0x570a1b){socket[_0xac4a('0x114')]('chatInteractionTags:save',{'id':Number(_0x4f6540['params']['id']),'tags':_0x570a1b||[]});return{'id':Number(_0x4f6540['params']['id']),'tags':_0x570a1b||[]};});}})[_0xac4a('0x3a')](respondWithResult(_0x405b6f,null))[_0xac4a('0x2e')](handleError(_0x405b6f,null));};exports['removeTags']=function(_0x19cda4,_0x39e89d,_0x5cdbfd){return db[_0xac4a('0x44')][_0xac4a('0x76')]({'where':{'id':_0x19cda4[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](handleEntityNotFound(_0x39e89d,null))[_0xac4a('0x3a')](function(_0x3f2d5f){if(_0x3f2d5f){return _0x3f2d5f[_0xac4a('0x115')](_0x19cda4[_0xac4a('0x49')][_0xac4a('0x10c')]);}})['then'](respondWithStatusCode(_0x39e89d,null))['catch'](handleError(_0x39e89d,null));};exports[_0xac4a('0xdf')]=function(_0x1f29a4,_0x18abfe){var _0x164b1b=moment()[_0xac4a('0x116')]()['toString']();var _0x74964b=path['join'](config['root'],'server','files',_0xac4a('0x117'));var _0x19cb07=path['join'](config[_0xac4a('0xe0')],'server',_0xac4a('0x118'),_0xac4a('0x119'));var _0x25c15c=path['join'](_0x74964b,_0x164b1b);var _0x3a49fb=util[_0xac4a('0xe5')]('transcript-%d-%s.zip',_0x1f29a4[_0xac4a('0xbd')]['id'],_0x164b1b);var _0xa6ba37=path['join'](_0x74964b,_0x3a49fb);var _0x333d3a=[];_0x333d3a[_0xac4a('0x42')]({'model':db[_0xac4a('0x7e')],'as':_0xac4a('0x7e'),'attributes':['id',_0xac4a('0xf4')],'raw':!![]});_0x333d3a[_0xac4a('0x42')]({'model':db['CmContact'],'as':_0xac4a('0x11a'),'attributes':['id',_0xac4a('0x11b'),_0xac4a('0x11c')],'raw':!![]});if(_0x1f29a4[_0xac4a('0x49')]['attachments']){_0x333d3a[_0xac4a('0x42')]({'model':db['Attachment'],'as':_0xac4a('0xdc'),'raw':!![]});}var _0x1182ed=[{'model':db[_0xac4a('0xd0')],'as':_0xac4a('0xea'),'attributes':['id',_0xac4a('0x82'),_0xac4a('0xf7'),_0xac4a('0xf9'),_0xac4a('0xfa'),'read'],'include':_0x333d3a}];_0x1182ed['push']({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x11d'),'attributes':['id',_0xac4a('0x3b')]});_0x1182ed[_0xac4a('0x42')]({'model':db['User'],'as':_0xac4a('0x11e'),'attributes':['id',_0xac4a('0xf4')]});return db[_0xac4a('0x44')][_0xac4a('0x76')]({'where':{'id':_0x1f29a4[_0xac4a('0xbd')]['id']},'include':_0x1182ed})[_0xac4a('0x3a')](handleEntityNotFound(_0x18abfe,null))[_0xac4a('0x3a')](function(_0x201a1d){if(_0x201a1d){var _0x445733=_0x201a1d['get']({'plain':!![]});fs[_0xac4a('0x11f')](_0x25c15c);var _0x5b61f1={'format':'A4','border':_0xac4a('0x120'),'header':{'height':_0xac4a('0x121'),'contents':{'first':_0xac4a('0x122')}},'footer':{'height':_0xac4a('0x123'),'contents':{'default':util[_0xac4a('0xe5')](_0xac4a('0x124'),util[_0xac4a('0xe5')]('%s\x20#%d',_0xac4a('0x125'),_0x445733['id']),moment()[_0xac4a('0xe5')]('YYYY-MM-DD')[_0xac4a('0xa2')]())}}};var _0x41c5f9={'channel':_0xac4a('0x125'),'account':_0x445733[_0xac4a('0x11d')][_0xac4a('0x3b')],'agent':_0x445733['Owner']?_0x445733[_0xac4a('0x11e')][_0xac4a('0xf4')]:_0xac4a('0x126'),'createdAt':moment(_0x445733[_0xac4a('0xf7')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xac4a('0xa2')](),'closedAt':_0x445733['closed']?moment(_0x445733[_0xac4a('0x127')])[_0xac4a('0xe5')](_0xac4a('0x10e'))[_0xac4a('0xa2')]():'','disposition':_0x445733[_0xac4a('0xd7')],'chatInfo':{'browser':_0x445733[_0xac4a('0x128')],'os':_0x445733[_0xac4a('0x129')],'referer':_0x445733[_0xac4a('0x12a')],'customerIp':_0x445733[_0xac4a('0x12b')],'customerPort':_0x445733[_0xac4a('0x12c')]?_0x445733[_0xac4a('0x12c')]:'N.A.'},'messages':_(_0x445733['Messages'])[_0xac4a('0x12d')]()[_0xac4a('0x8d')]({'secret':![]})[_0xac4a('0x3d')](function(_0x482c0e){if(_0x482c0e['Attachment']){var _0x1430aa=path[_0xac4a('0xe4')](_0x19cb07,_0x482c0e['Attachment'][_0xac4a('0xe2')]);if(fs[_0xac4a('0x12e')](_0x1430aa)){fs['createReadStream'](_0x1430aa)[_0xac4a('0x12f')](fs[_0xac4a('0x130')](path['join'](_0x25c15c,_0x482c0e[_0xac4a('0xdc')]['basename'])));}}return{'date':moment(_0x482c0e[_0xac4a('0xf7')])[_0xac4a('0xe5')](_0xac4a('0x10e'))['toString'](),'sender':_0x482c0e[_0xac4a('0xf9')]===_0xac4a('0xcf')?_0x482c0e['User']?_0x482c0e['User'][_0xac4a('0xf4')]:_0xac4a('0xeb'):_0x482c0e[_0xac4a('0x11a')]['firstName']+(_0x482c0e[_0xac4a('0x11a')][_0xac4a('0x11c')]?'\x20'+_0x482c0e[_0xac4a('0x11a')][_0xac4a('0x11c')]:''),'body':_0x482c0e[_0xac4a('0xdc')]?_0x482c0e[_0xac4a('0xdc')][_0xac4a('0xe2')]:_0x482c0e[_0xac4a('0x82')],'direction':_0x482c0e[_0xac4a('0xf9')]===_0xac4a('0xcf')?'A':'C','secret':_0x482c0e[_0xac4a('0xfa')],'read':_0x482c0e['read'],'attachment':_0x482c0e['Attachment']};})['value']()};return ejs[_0xac4a('0x131')](path[_0xac4a('0xe4')](config[_0xac4a('0xe0')],_0xac4a('0x132'),_0xac4a('0x133'),'downloadInteraction.html'),{'interaction':_0x41c5f9})[_0xac4a('0x3a')](function(_0x4e6941){return new BPromise(function(_0x6d09cb,_0x2f1740){pdf['create'](_0x4e6941,_0x5b61f1)[_0xac4a('0x134')](path['join'](_0x25c15c,_0xac4a('0x135')+_0x445733['id']+'-'+_0x164b1b+_0xac4a('0x136')),function(_0x1bac90,_0x3fd4a1){if(_0x1bac90)return _0x2f1740(_0x1bac90);_0x6d09cb(_0x3fd4a1);});});})['then'](function(){return new BPromise(function(_0x22e964,_0x3223e0){zipdir(_0x25c15c,{'saveTo':_0xa6ba37},function(_0x5ab5c9,_0xdd2709){if(_0x5ab5c9)return _0x3223e0(_0x5ab5c9);return _0x22e964(_0xdd2709);});})['then'](function(){return new BPromise(function(_0x111744,_0x982cd2){rimraf(_0x25c15c,function(_0x3c9a66){if(_0x3c9a66)_0x982cd2(_0x3c9a66);return _0x111744();});});})['then'](function(){return _0x18abfe[_0xac4a('0xdf')](_0xa6ba37,_0x3a49fb,function(_0x386700){if(_0x386700){console[_0xac4a('0x137')]('err',_0x386700);}else{fs[_0xac4a('0x138')](_0xa6ba37);}});});});}else{return _0x18abfe['sendStatus'](0xc8);}})[_0xac4a('0x2e')](handleError(_0x18abfe,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index facd5c8..2e14ffb 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 _0x7874=['ChatMessage','setMaxListeners','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hook','exports','ChatInteraction','../../mysqldb'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7874,0x152));var _0x4787=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0x7874[_0x124298];return _0x35ac24;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x4787('0x0')];var ChatMessage=require(_0x4787('0x1'))['db'][_0x4787('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4787('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4787('0x4'),'afterDestroy':_0x4787('0x5')};function emitEvent(_0x46b8e5){return function(_0x235718,_0x3a28ae,_0x301644){_0x235718[_0x4787('0x6')]({'attributes':['id'],'raw':!![]})[_0x4787('0x7')](function(_0xcfd7cd){_0x235718['setDataValue'](_0x4787('0x8'),_0xcfd7cd[_0x4787('0x9')](function(_0x257d8d){return{'id':_0x257d8d['id']};}));return ChatMessage[_0x4787('0xa')]({'where':{'ChatInteractionId':_0x235718['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xfda1c6){_0x235718[_0x4787('0xb')](_0x4787('0xc'),_0xfda1c6[_0x4787('0xd')]);ChatInteractionEvents[_0x4787('0xe')](_0x46b8e5+':'+_0x235718['id'],_0x235718);ChatInteractionEvents[_0x4787('0xe')](_0x46b8e5,_0x235718);_0x301644(null);})['catch'](_0x301644(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x4787('0xf')](e,emitEvent(event));}}module[_0x4787('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xa7c5=['map','findAll','unreadMessages','emit','hasOwnProperty','exports','events','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0xa7c5,0x1e6));var _0x5a7c=function(_0x4fe55b,_0x54e455){_0x4fe55b=_0x4fe55b-0x0;var _0x122529=_0xa7c5[_0x4fe55b];return _0x122529;};'use strict';var EventEmitter=require(_0x5a7c('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x5a7c('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5a7c('0x2')](0x0);var events={'afterCreate':_0x5a7c('0x3'),'afterUpdate':_0x5a7c('0x4'),'afterDestroy':_0x5a7c('0x5')};function emitEvent(_0x2944cf){return function(_0x65a0cc,_0x21a63b,_0x5ea861){_0x65a0cc[_0x5a7c('0x6')]({'attributes':['id'],'raw':!![]})[_0x5a7c('0x7')](function(_0x5279f4){_0x65a0cc[_0x5a7c('0x8')](_0x5a7c('0x9'),_0x5279f4[_0x5a7c('0xa')](function(_0xecbb69){return{'id':_0xecbb69['id']};}));return ChatMessage[_0x5a7c('0xb')]({'where':{'ChatInteractionId':_0x65a0cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5a7c('0x7')](function(_0x627aff){_0x65a0cc[_0x5a7c('0x8')](_0x5a7c('0xc'),_0x627aff['length']);ChatInteractionEvents[_0x5a7c('0xd')](_0x2944cf+':'+_0x65a0cc['id'],_0x65a0cc);ChatInteractionEvents[_0x5a7c('0xd')](_0x2944cf,_0x65a0cc);_0x5ea861(null);})['catch'](_0x5ea861(null));};}for(var e in events){if(events[_0x5a7c('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x5a7c('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 6ecdc5f..ad7eec7 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 _0xb24d=['../../config/environment','./chatInteraction.attributes','ChatInteraction','changed','closed','format','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x19621e,_0x114012){var _0x4d051f=function(_0x49dbce){while(--_0x49dbce){_0x19621e['push'](_0x19621e['shift']());}};_0x4d051f(++_0x114012);}(_0xb24d,0x16f));var _0xdb24=function(_0x54628a,_0x50ca6b){_0x54628a=_0x54628a-0x0;var _0x19c30b=_0xb24d[_0x54628a];return _0x19c30b;};'use strict';var _=require(_0xdb24('0x0'));var util=require(_0xdb24('0x1'));var logger=require(_0xdb24('0x2'))(_0xdb24('0x3'));var moment=require(_0xdb24('0x4'));var BPromise=require(_0xdb24('0x5'));var rp=require(_0xdb24('0x6'));var fs=require('fs');var path=require(_0xdb24('0x7'));var rimraf=require('rimraf');var config=require(_0xdb24('0x8'));var attributes=require(_0xdb24('0x9'));module['exports']=function(_0x13041b,_0x1b4d30){return _0x13041b['define'](_0xdb24('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d9e51,_0x3730a7,_0x2f6ca2){if(_0x2d9e51[_0xdb24('0xb')](_0xdb24('0xc'))){_0x2d9e51['closedAt']=moment()[_0xdb24('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2f6ca2(null,_0x2d9e51);}},'charset':_0xdb24('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbeed=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','changed','format'];(function(_0x3b64c0,_0x1f1d6c){var _0x2a9896=function(_0xfe26e6){while(--_0xfe26e6){_0x3b64c0['push'](_0x3b64c0['shift']());}};_0x2a9896(++_0x1f1d6c);}(_0xbeed,0x163));var _0xdbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeed[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xdbee('0x0'));var util=require('util');var logger=require(_0xdbee('0x1'))(_0xdbee('0x2'));var moment=require(_0xdbee('0x3'));var BPromise=require(_0xdbee('0x4'));var rp=require(_0xdbee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbee('0x6'));var config=require(_0xdbee('0x7'));var attributes=require(_0xdbee('0x8'));module[_0xdbee('0x9')]=function(_0x283e7f,_0x4fd7bd){return _0x283e7f['define'](_0xdbee('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x352108,_0x58a64e,_0x10c670){if(_0x352108[_0xdbee('0xb')]('closed')){_0x352108['closedAt']=moment()[_0xdbee('0xc')](_0xdbee('0xd'));}_0x10c670(null,_0x352108);}},'charset':_0xdbee('0xe'),'collate':_0xdbee('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 61eef1b..8de3ee9 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 _0xc971=['AddTags','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','UpdateChatInteraction','update','body','options','raw','where','limit','catch','AddTagsToChatInteraction','ChatInteraction','find','addTags','omit','ids','spread'];(function(_0x22c2dd,_0x33d1e7){var _0x23cc7d=function(_0x3a0e5b){while(--_0x3a0e5b){_0x22c2dd['push'](_0x22c2dd['shift']());}};_0x23cc7d(++_0x33d1e7);}(_0xc971,0x1a5));var _0x1c97=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xc971[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x1c97('0x0'));var util=require(_0x1c97('0x1'));var moment=require('moment');var BPromise=require(_0x1c97('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c97('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c97('0x4'));var logger=require(_0x1c97('0x5'))(_0x1c97('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c97('0x7'));var client=jayson[_0x1c97('0x8')]['http']({'port':0x232a});config['redis']=_[_0x1c97('0x9')](config[_0x1c97('0xa')],{'host':_0x1c97('0xb'),'port':0x18eb});var socket=require(_0x1c97('0xc'))(new Redis(config[_0x1c97('0xa')]));require(_0x1c97('0xd'))['register'](socket);function respondWithRpcPromise(_0x3b5ef1,_0x5b1dcd,_0x1c3e74){return new BPromise(function(_0x2357cb,_0x1312e5){return client[_0x1c97('0xe')](_0x3b5ef1,_0x1c3e74)[_0x1c97('0xf')](function(_0x18415b){logger[_0x1c97('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x5b1dcd,_0x1c97('0x11'));logger[_0x1c97('0x12')](_0x1c97('0x13'),_0x5b1dcd,_0x1c97('0x11'),JSON[_0x1c97('0x14')](_0x18415b));if(_0x18415b[_0x1c97('0x15')]){if(_0x18415b[_0x1c97('0x15')][_0x1c97('0x16')]===0x1f4){logger[_0x1c97('0x15')](_0x1c97('0x17'),_0x5b1dcd,_0x18415b['error'][_0x1c97('0x18')]);return _0x1312e5(_0x18415b[_0x1c97('0x15')][_0x1c97('0x18')]);}logger[_0x1c97('0x15')](_0x1c97('0x17'),_0x5b1dcd,_0x18415b[_0x1c97('0x15')]['message']);return _0x2357cb(_0x18415b['error'][_0x1c97('0x18')]);}else{logger[_0x1c97('0x10')](_0x1c97('0x17'),_0x5b1dcd,_0x1c97('0x11'));_0x2357cb(_0x18415b[_0x1c97('0x19')][_0x1c97('0x18')]);}})['catch'](function(_0x40b2f0){logger[_0x1c97('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x5b1dcd,_0x40b2f0);_0x1312e5(_0x40b2f0);});});}exports[_0x1c97('0x1a')]=function(_0x5c64e4){var _0x30d524=this;return new Promise(function(_0x24199a,_0xebdeeb){return db['ChatInteraction'][_0x1c97('0x1b')](_0x5c64e4[_0x1c97('0x1c')],{'raw':_0x5c64e4[_0x1c97('0x1d')]?_0x5c64e4['options'][_0x1c97('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c64e4['options']?_0x5c64e4[_0x1c97('0x1d')][_0x1c97('0x1f')]||null:null,'attributes':_0x5c64e4[_0x1c97('0x1d')]?_0x5c64e4['options']['attributes']||null:null,'limit':_0x5c64e4[_0x1c97('0x1d')]?_0x5c64e4[_0x1c97('0x1d')][_0x1c97('0x20')]||null:null})[_0x1c97('0xf')](function(_0x2b21b5){logger[_0x1c97('0x10')](_0x1c97('0x1a'),_0x5c64e4);logger[_0x1c97('0x12')](_0x1c97('0x1a'),_0x5c64e4,JSON['stringify'](_0x2b21b5));_0x24199a(_0x2b21b5);})[_0x1c97('0x21')](function(_0x36a2c0){logger[_0x1c97('0x15')](_0x1c97('0x1a'),_0x36a2c0[_0x1c97('0x18')],_0x5c64e4);_0xebdeeb(_0x30d524[_0x1c97('0x15')](0x1f4,_0x36a2c0[_0x1c97('0x18')]));});});};exports[_0x1c97('0x22')]=function(_0x5a3874){return new Promise(function(_0x6903da,_0x98fa28){return db[_0x1c97('0x23')][_0x1c97('0x24')]({'where':_0x5a3874['options']?_0x5a3874[_0x1c97('0x1d')][_0x1c97('0x1f')]||null:null})[_0x1c97('0xf')](function(_0x50bf38){if(_0x50bf38){return _0x50bf38[_0x1c97('0x25')](_0x5a3874[_0x1c97('0x1c')]['ids'],_[_0x1c97('0x26')](_0x5a3874[_0x1c97('0x1c')],[_0x1c97('0x27'),'id'])||{});}})[_0x1c97('0x28')](function(_0x4ba1af){logger['info'](_0x1c97('0x29'),_0x5a3874);logger[_0x1c97('0x12')](_0x1c97('0x29'),_0x5a3874,JSON[_0x1c97('0x14')](_0x4ba1af));_0x6903da(_0x4ba1af);})['catch'](function(_0x2daa0e){logger[_0x1c97('0x15')](_0x1c97('0x29'),_0x2daa0e[_0x1c97('0x18')],_0x5a3874);_0x98fa28(_this[_0x1c97('0x15')](0x1f4,_0x2daa0e[_0x1c97('0x18')]));});});}; \ No newline at end of file +var _0x626c=['attributes','AddTagsToChatInteraction','ChatInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatInteraction,\x20%s,\x20%s','request\x20sent','catch','UpdateChatInteraction','update','body','options','where'];(function(_0x2d0bfd,_0x2ba336){var _0x4d806c=function(_0x47938d){while(--_0x47938d){_0x2d0bfd['push'](_0x2d0bfd['shift']());}};_0x4d806c(++_0x2ba336);}(_0x626c,0x1d1));var _0xc626=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x626c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc626('0x0'));var util=require(_0xc626('0x1'));var moment=require(_0xc626('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc626('0x3'));var db=require(_0xc626('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc626('0x5'))('rpc');var config=require(_0xc626('0x6'));var jayson=require(_0xc626('0x7'));var client=jayson[_0xc626('0x8')]['http']({'port':0x232a});config[_0xc626('0x9')]=_['defaults'](config[_0xc626('0x9')],{'host':_0xc626('0xa'),'port':0x18eb});var socket=require(_0xc626('0xb'))(new Redis(config[_0xc626('0x9')]));require(_0xc626('0xc'))['register'](socket);function respondWithRpcPromise(_0x2487dd,_0x440ed0,_0x1ac064){return new BPromise(function(_0x520fad,_0x553a12){return client[_0xc626('0xd')](_0x2487dd,_0x1ac064)[_0xc626('0xe')](function(_0x2306c4){logger[_0xc626('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x440ed0,'request\x20sent');logger[_0xc626('0x10')](_0xc626('0x11'),_0x440ed0,'request\x20sent',JSON[_0xc626('0x12')](_0x2306c4));if(_0x2306c4[_0xc626('0x13')]){if(_0x2306c4[_0xc626('0x13')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x440ed0,_0x2306c4[_0xc626('0x13')][_0xc626('0x14')]);return _0x553a12(_0x2306c4[_0xc626('0x13')][_0xc626('0x14')]);}logger['error'](_0xc626('0x15'),_0x440ed0,_0x2306c4[_0xc626('0x13')][_0xc626('0x14')]);return _0x520fad(_0x2306c4['error'][_0xc626('0x14')]);}else{logger[_0xc626('0xf')](_0xc626('0x15'),_0x440ed0,_0xc626('0x16'));_0x520fad(_0x2306c4['result'][_0xc626('0x14')]);}})[_0xc626('0x17')](function(_0x38aa6f){logger['error'](_0xc626('0x15'),_0x440ed0,_0x38aa6f);_0x553a12(_0x38aa6f);});});}exports[_0xc626('0x18')]=function(_0x52a0b5){var _0xfddfba=this;return new Promise(function(_0x17a378,_0x14a7af){return db['ChatInteraction'][_0xc626('0x19')](_0x52a0b5[_0xc626('0x1a')],{'raw':_0x52a0b5[_0xc626('0x1b')]?_0x52a0b5[_0xc626('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52a0b5[_0xc626('0x1b')]?_0x52a0b5['options'][_0xc626('0x1c')]||null:null,'attributes':_0x52a0b5['options']?_0x52a0b5[_0xc626('0x1b')][_0xc626('0x1d')]||null:null,'limit':_0x52a0b5[_0xc626('0x1b')]?_0x52a0b5['options']['limit']||null:null})[_0xc626('0xe')](function(_0x263935){logger[_0xc626('0xf')](_0xc626('0x18'),_0x52a0b5);logger[_0xc626('0x10')](_0xc626('0x18'),_0x52a0b5,JSON[_0xc626('0x12')](_0x263935));_0x17a378(_0x263935);})[_0xc626('0x17')](function(_0x54480d){logger[_0xc626('0x13')]('UpdateChatInteraction',_0x54480d[_0xc626('0x14')],_0x52a0b5);_0x14a7af(_0xfddfba['error'](0x1f4,_0x54480d[_0xc626('0x14')]));});});};exports[_0xc626('0x1e')]=function(_0x5e4eeb){return new Promise(function(_0xb739fa,_0x23f81c){return db[_0xc626('0x1f')][_0xc626('0x20')]({'where':_0x5e4eeb[_0xc626('0x1b')]?_0x5e4eeb[_0xc626('0x1b')][_0xc626('0x1c')]||null:null})[_0xc626('0xe')](function(_0x4e8287){if(_0x4e8287){return _0x4e8287[_0xc626('0x21')](_0x5e4eeb[_0xc626('0x1a')]['ids'],_[_0xc626('0x22')](_0x5e4eeb['body'],[_0xc626('0x23'),'id'])||{});}})[_0xc626('0x24')](function(_0x5594cc){logger['info'](_0xc626('0x25'),_0x5e4eeb);logger[_0xc626('0x10')](_0xc626('0x25'),_0x5e4eeb,JSON[_0xc626('0x12')](_0x5594cc));_0xb739fa(_0x5594cc);})[_0xc626('0x17')](function(_0x37cdba){logger[_0xc626('0x13')](_0xc626('0x25'),_0x37cdba[_0xc626('0x14')],_0x5e4eeb);_0x23f81c(_this[_0xc626('0x13')](0x1f4,_0x37cdba['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 3fa1315..8d4400f 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 _0xca4f=['update','emit','removeListener','length','./chatInteraction.events','save'];(function(_0x2ddd52,_0x4e3b17){var _0x4bb4ec=function(_0x41905f){while(--_0x41905f){_0x2ddd52['push'](_0x2ddd52['shift']());}};_0x4bb4ec(++_0x4e3b17);}(_0xca4f,0x112));var _0xfca4=function(_0x594540,_0x11f303){_0x594540=_0x594540-0x0;var _0x11a7f7=_0xca4f[_0x594540];return _0x11a7f7;};'use strict';var ChatInteractionEvents=require(_0xfca4('0x0'));var events=[_0xfca4('0x1'),'remove',_0xfca4('0x2')];function createListener(_0x32e7c6,_0x58ecd3){return function(_0x266f67){_0x58ecd3[_0xfca4('0x3')](_0x32e7c6,_0x266f67);};}function removeListener(_0x21ea71,_0x197a93){return function(){ChatInteractionEvents[_0xfca4('0x4')](_0x21ea71,_0x197a93);};}exports['register']=function(_0x374250){for(var _0x32e15a=0x0,_0x1d5e87=events[_0xfca4('0x5')];_0x32e15a<_0x1d5e87;_0x32e15a++){var _0x1f3ab0=events[_0x32e15a];var _0x1ec5cb=createListener('chatInteraction:'+_0x1f3ab0,_0x374250);ChatInteractionEvents['on'](_0x1f3ab0,_0x1ec5cb);}}; \ No newline at end of file +var _0xf99d=['./chatInteraction.events','save','update','length','chatInteraction:'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0xf99d,0x186));var _0xdf99=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xf99d[_0x5f1391];return _0x50ebe3;};'use strict';var ChatInteractionEvents=require(_0xdf99('0x0'));var events=[_0xdf99('0x1'),'remove',_0xdf99('0x2')];function createListener(_0x2267aa,_0x580d4b){return function(_0x45e422){_0x580d4b['emit'](_0x2267aa,_0x45e422);};}function removeListener(_0x2e9ae0,_0xe84808){return function(){ChatInteractionEvents['removeListener'](_0x2e9ae0,_0xe84808);};}exports['register']=function(_0x67ee9e){for(var _0x55bfc6=0x0,_0x7dff4c=events[_0xdf99('0x3')];_0x55bfc6<_0x7dff4c;_0x55bfc6++){var _0x1176b6=events[_0x55bfc6];var _0xd325ef=createListener(_0xdf99('0x4')+_0x1176b6,_0x67ee9e);ChatInteractionEvents['on'](_0x1176b6,_0xd325ef);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 089fde8..aad2e39 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 _0x0e21=['removeTags','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','attachmentDownload','/:id/my_messages','isChatInteractionAuthorized','/:id/download','post','/:id/vidaoo','diskStorage','join','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','chatinteraction:destroy','destroy'];(function(_0x38c757,_0xa4ebf4){var _0x525e49=function(_0x104bd9){while(--_0x104bd9){_0x38c757['push'](_0x38c757['shift']());}};_0x525e49(++_0xa4ebf4);}(_0x0e21,0xe8));var _0x10e2=function(_0x10dd2f,_0x4e03a8){_0x10dd2f=_0x10dd2f-0x0;var _0x4d6495=_0x0e21[_0x10dd2f];return _0x4d6495;};'use strict';var multer=require('multer');var util=require(_0x10e2('0x0'));var path=require(_0x10e2('0x1'));var timeout=require(_0x10e2('0x2'));var express=require('express');var router=express[_0x10e2('0x3')]();var auth=require(_0x10e2('0x4'));var interaction=require(_0x10e2('0x5'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x10e2('0x6')]('/',auth[_0x10e2('0x7')](),controller[_0x10e2('0x8')]);router[_0x10e2('0x6')](_0x10e2('0x9'),auth[_0x10e2('0x7')](),controller[_0x10e2('0xa')]);router[_0x10e2('0x6')](_0x10e2('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x10e2('0xc')]);router['get']('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x10e2('0xd')]);router[_0x10e2('0x6')]('/:id/messages',auth[_0x10e2('0x7')](),controller['getMessages']);router[_0x10e2('0x6')](_0x10e2('0xe'),auth[_0x10e2('0xf')](),controller['getMyMessages']);router[_0x10e2('0x6')](_0x10e2('0x10'),auth[_0x10e2('0x7')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x10e2('0x11')](_0x10e2('0x12'),auth[_0x10e2('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x10e2('0x13')]({'destination':function(_0x178cc1,_0x1d6f9d,_0x40c5bc){_0x40c5bc(null,path[_0x10e2('0x14')](config[_0x10e2('0x15')],'server/files/attachments/'));},'filename':function(_0x2fd6a7,_0x284c1b,_0x388a45){_0x388a45(null,util[_0x10e2('0x16')](_0x10e2('0x17'),Date[_0x10e2('0x18')](),_0x284c1b[_0x10e2('0x19')][_0x10e2('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x10e2('0x1b'),upload[_0x10e2('0x1c')](_0x10e2('0x1d')),controller[_0x10e2('0x1e')]);router['post']('/:id/messages',auth[_0x10e2('0xf')](),controller[_0x10e2('0x1f')]);router[_0x10e2('0x11')](_0x10e2('0x20'),auth['isAuthenticated'](),interaction['tracked'](_0x10e2('0x21'),_0x10e2('0x22')),controller[_0x10e2('0x23')]);router[_0x10e2('0x24')](_0x10e2('0xb'),auth[_0x10e2('0x7')](),interaction['tracked'](_0x10e2('0x21'),_0x10e2('0x25')),controller[_0x10e2('0x26')]);router[_0x10e2('0x24')](_0x10e2('0x27'),controller[_0x10e2('0x28')]);router['put'](_0x10e2('0x29'),auth['isChatInteractionAuthorized'](),controller['abandon']);router['put']('/:id/close',controller['close']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x10e2('0x21'),_0x10e2('0x2a')),controller[_0x10e2('0x2b')]);router['delete'](_0x10e2('0x20'),auth[_0x10e2('0x7')](),controller[_0x10e2('0x2c')]);module[_0x10e2('0x2d')]=router; \ No newline at end of file +var _0xc4e1=['single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','/:id','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','/describe','get','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','isChatInteractionAuthorized','getMyMessages','/:id/download','create','post','createVidaooSession','diskStorage','join','root','format','%s-%s','originalname','replace','/:id/attachment_upload'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0xc4e1,0x172));var _0x1c4e=function(_0x2f81b0,_0x324a11){_0x2f81b0=_0x2f81b0-0x0;var _0xc384f8=_0xc4e1[_0x2f81b0];return _0xc384f8;};'use strict';var multer=require(_0x1c4e('0x0'));var util=require(_0x1c4e('0x1'));var path=require(_0x1c4e('0x2'));var timeout=require(_0x1c4e('0x3'));var express=require('express');var router=express[_0x1c4e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1c4e('0x5'));var config=require('../../config/environment');var controller=require(_0x1c4e('0x6'));router['get']('/',auth[_0x1c4e('0x7')](),controller[_0x1c4e('0x8')]);router['get'](_0x1c4e('0x9'),auth[_0x1c4e('0x7')](),controller['describe']);router[_0x1c4e('0xa')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0x1c4e('0xb')]);router['get'](_0x1c4e('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x1c4e('0xd')]);router['get'](_0x1c4e('0xe'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x1c4e('0xf'),auth[_0x1c4e('0x10')](),controller[_0x1c4e('0x11')]);router['get'](_0x1c4e('0x12'),auth[_0x1c4e('0x7')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x1c4e('0x13')]);router[_0x1c4e('0x14')]('/:id/vidaoo',auth[_0x1c4e('0x7')](),controller[_0x1c4e('0x15')]);var upload=multer({'storage':multer[_0x1c4e('0x16')]({'destination':function(_0x31708b,_0x2d55bb,_0x4b12b3){_0x4b12b3(null,path[_0x1c4e('0x17')](config[_0x1c4e('0x18')],'server/files/attachments/'));},'filename':function(_0x4a5786,_0x572737,_0x54ef20){_0x54ef20(null,util[_0x1c4e('0x19')](_0x1c4e('0x1a'),Date['now'](),_0x572737[_0x1c4e('0x1b')][_0x1c4e('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1c4e('0x14')](_0x1c4e('0x1d'),upload[_0x1c4e('0x1e')](_0x1c4e('0x1f')),controller[_0x1c4e('0x20')]);router[_0x1c4e('0x14')](_0x1c4e('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x1c4e('0x21')]);router['post'](_0x1c4e('0x22'),auth[_0x1c4e('0x7')](),interaction[_0x1c4e('0x23')](_0x1c4e('0x24'),_0x1c4e('0x25')),controller['addTags']);router[_0x1c4e('0x26')](_0x1c4e('0x27'),auth[_0x1c4e('0x7')](),interaction[_0x1c4e('0x23')](_0x1c4e('0x24'),_0x1c4e('0x28')),controller['update']);router[_0x1c4e('0x26')](_0x1c4e('0x29'),controller[_0x1c4e('0x2a')]);router[_0x1c4e('0x26')](_0x1c4e('0x2b'),auth[_0x1c4e('0x10')](),controller['abandon']);router[_0x1c4e('0x26')](_0x1c4e('0x2c'),controller['close']);router[_0x1c4e('0x2d')](_0x1c4e('0x27'),auth[_0x1c4e('0x7')](),interaction[_0x1c4e('0x23')]('chat',_0x1c4e('0x2e')),controller[_0x1c4e('0x2f')]);router[_0x1c4e('0x2d')]('/:id/tags',auth[_0x1c4e('0x7')](),controller[_0x1c4e('0x30')]);module[_0x1c4e('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index ed3a3ad..f24405d 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 _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x37308d,_0x19f8ca){var _0x1db987=function(_0x3cc89d){while(--_0x3cc89d){_0x37308d['push'](_0x37308d['shift']());}};_0x1db987(++_0x19f8ca);}(_0x57ca,0x108));var _0xa57c=function(_0x1fe092,_0x2082ef){_0x1fe092=_0x1fe092-0x0;var _0x10a587=_0x57ca[_0x1fe092];return _0x10a587;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file +var _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x3525c8,_0x3f5015){var _0x3a6039=function(_0x42d9b9){while(--_0x42d9b9){_0x3525c8['push'](_0x3525c8['shift']());}};_0x3a6039(++_0x3f5015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index fee39b0..a29f9e3 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 _0x7992=['describe','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','internal','online','showWebBar','-online','VoiceQueue','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','name','send','type','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','ChatInternalMessage','create','body','find'];(function(_0x1787b4,_0x53d1a2){var _0x7a644b=function(_0x4ad664){while(--_0x4ad664){_0x1787b4['push'](_0x1787b4['shift']());}};_0x7a644b(++_0x53d1a2);}(_0x7992,0xfa));var _0x2799=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x7992[_0x72895a];return _0x5226d5;};'use strict';var pdf=require(_0x2799('0x0'));var emlformat=require(_0x2799('0x1'));var rimraf=require(_0x2799('0x2'));var zipdir=require(_0x2799('0x3'));var jsonpatch=require(_0x2799('0x4'));var rp=require(_0x2799('0x5'));var moment=require(_0x2799('0x6'));var BPromise=require(_0x2799('0x7'));var Mustache=require(_0x2799('0x8'));var util=require(_0x2799('0x9'));var path=require(_0x2799('0xa'));var sox=require(_0x2799('0xb'));var csv=require(_0x2799('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2799('0xd'));var squel=require(_0x2799('0xe'));var crypto=require(_0x2799('0xf'));var jsforce=require(_0x2799('0x10'));var deskjs=require(_0x2799('0x11'));var toCsv=require(_0x2799('0xc'));var querystring=require(_0x2799('0x12'));var Papa=require(_0x2799('0x13'));var Redis=require(_0x2799('0x14'));var authService=require(_0x2799('0x15'));var qs=require(_0x2799('0x16'));var as=require(_0x2799('0x17'));var hardwareService=require(_0x2799('0x18'));var logger=require(_0x2799('0x19'))('api');var utils=require(_0x2799('0x1a'));var config=require(_0x2799('0x1b'));var db=require(_0x2799('0x1c'))['db'];config[_0x2799('0x1d')]=_[_0x2799('0x1e')](config[_0x2799('0x1d')],{'host':_0x2799('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2799('0x1d')]));require(_0x2799('0x20'))[_0x2799('0x21')](socket);function respondWithStatusCode(_0x347e7b,_0x57bd32){_0x57bd32=_0x57bd32||0xcc;return function(_0x274a10){if(_0x274a10){return _0x347e7b[_0x2799('0x22')](_0x57bd32);}return _0x347e7b[_0x2799('0x23')](_0x57bd32)[_0x2799('0x24')]();};}function respondWithResult(_0x371bd8,_0x2428e0){_0x2428e0=_0x2428e0||0xc8;return function(_0x35a36c){if(_0x35a36c){return _0x371bd8['status'](_0x2428e0)[_0x2799('0x25')](_0x35a36c);}};}function respondWithFilteredResult(_0xae6602,_0x349c59){return function(_0x323ae6){if(_0x323ae6){var _0x13a6b5=_0x323ae6[_0x2799('0x26')],_0x126ad6=_0x349c59[_0x2799('0x27')],_0x336a55=_0x349c59[_0x2799('0x27')]+_0x349c59[_0x2799('0x28')],_0x3ccc23;if(_0x336a55>=_0x13a6b5){_0x336a55=_0x13a6b5;_0x3ccc23=0xc8;}else{_0x3ccc23=0xce;}_0xae6602[_0x2799('0x23')](_0x3ccc23);return _0xae6602[_0x2799('0x29')](_0x2799('0x2a'),_0x126ad6+'-'+_0x336a55+'/'+_0x13a6b5)[_0x2799('0x25')](_0x323ae6);}return null;};}function patchUpdates(_0x1b2820){return function(_0x24ebb8){try{jsonpatch[_0x2799('0x2b')](_0x24ebb8,_0x1b2820,!![]);}catch(_0x1bde07){return BPromise['reject'](_0x1bde07);}return _0x24ebb8['save']();};}function saveUpdates(_0x5cfcfc,_0x147512){return function(_0x51eb0e){if(_0x51eb0e){return _0x51eb0e[_0x2799('0x2c')](_0x5cfcfc)[_0x2799('0x2d')](function(_0x47aeef){return _0x47aeef;});}return null;};}function removeEntity(_0x196a2e,_0x44ff2f){return function(_0x2299ea){if(_0x2299ea){return _0x2299ea[_0x2799('0x2e')]()[_0x2799('0x2d')](function(){_0x196a2e[_0x2799('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa9eb,_0x417e47){return function(_0x3eaa6a){if(!_0x3eaa6a){_0x3fa9eb[_0x2799('0x22')](0x194);}return _0x3eaa6a;};}function handleError(_0x237395,_0x3d6891){_0x3d6891=_0x3d6891||0x1f4;return function(_0x3e7da3){logger[_0x2799('0x2f')](_0x3e7da3['stack']);if(_0x3e7da3[_0x2799('0x30')]){delete _0x3e7da3['name'];}_0x237395['status'](_0x3d6891)[_0x2799('0x31')](_0x3e7da3);};}exports['index']=function(_0x59b0dc,_0x13517f){var _0x421897={},_0x25959b={},_0xd67cd3={'count':0x0,'rows':[]};var _0x240191=_['map'](db['ChatInternalMessage']['rawAttributes'],function(_0x5cfdb9){return{'name':_0x5cfdb9['fieldName'],'type':_0x5cfdb9[_0x2799('0x32')]['key']};});_0x25959b[_0x2799('0x33')]=_[_0x2799('0x34')](_0x240191,_0x2799('0x30'));_0x25959b['query']=_[_0x2799('0x35')](_0x59b0dc[_0x2799('0x36')]);_0x25959b['filters']=_['intersection'](_0x25959b[_0x2799('0x33')],_0x25959b[_0x2799('0x36')]);_0x421897['attributes']=_[_0x2799('0x37')](_0x25959b[_0x2799('0x33')],qs[_0x2799('0x38')](_0x59b0dc['query'][_0x2799('0x38')]));_0x421897['attributes']=_0x421897[_0x2799('0x39')][_0x2799('0x3a')]?_0x421897['attributes']:_0x25959b[_0x2799('0x33')];if(!_0x59b0dc[_0x2799('0x36')][_0x2799('0x3b')](_0x2799('0x3c'))){_0x421897[_0x2799('0x28')]=qs[_0x2799('0x28')](_0x59b0dc[_0x2799('0x36')][_0x2799('0x28')]);_0x421897[_0x2799('0x27')]=qs[_0x2799('0x27')](_0x59b0dc[_0x2799('0x36')][_0x2799('0x27')]);}_0x421897['order']=qs['sort'](_0x59b0dc[_0x2799('0x36')][_0x2799('0x3d')]);_0x421897['where']=qs['filters'](_[_0x2799('0x3e')](_0x59b0dc[_0x2799('0x36')],_0x25959b[_0x2799('0x3f')]),_0x240191);if(_0x59b0dc[_0x2799('0x36')][_0x2799('0x40')]){_0x421897[_0x2799('0x41')]=_[_0x2799('0x42')](_0x421897[_0x2799('0x41')],{'$or':_['map'](_0x240191,function(_0x201396){if(_0x201396['type']!==_0x2799('0x43')){var _0x45c515={};_0x45c515[_0x201396[_0x2799('0x30')]]={'$like':'%'+_0x59b0dc['query'][_0x2799('0x40')]+'%'};return _0x45c515;}})});}_0x421897=_[_0x2799('0x42')]({},_0x421897,_0x59b0dc['options']);var _0x432aa4={'where':_0x421897[_0x2799('0x41')]};return db['ChatInternalMessage']['count'](_0x432aa4)['then'](function(_0x2d05a6){_0xd67cd3[_0x2799('0x26')]=_0x2d05a6;if(_0x59b0dc[_0x2799('0x36')][_0x2799('0x44')]){_0x421897[_0x2799('0x45')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x2799('0x46')](_0x421897);})[_0x2799('0x2d')](function(_0x51325d){_0xd67cd3[_0x2799('0x47')]=_0x51325d;return _0xd67cd3;})[_0x2799('0x2d')](respondWithFilteredResult(_0x13517f,_0x421897))[_0x2799('0x48')](handleError(_0x13517f,null));};exports[_0x2799('0x49')]=function(_0xb7e931,_0x554a4b){var _0x3d181a={'raw':!![],'where':{'id':_0xb7e931[_0x2799('0x4a')]['id']}},_0xcb075d={};_0xcb075d[_0x2799('0x33')]=_[_0x2799('0x35')](db['ChatInternalMessage'][_0x2799('0x4b')]);_0xcb075d['query']=_[_0x2799('0x35')](_0xb7e931['query']);_0xcb075d[_0x2799('0x3f')]=_[_0x2799('0x37')](_0xcb075d[_0x2799('0x33')],_0xcb075d[_0x2799('0x36')]);_0x3d181a[_0x2799('0x39')]=_[_0x2799('0x37')](_0xcb075d[_0x2799('0x33')],qs[_0x2799('0x38')](_0xb7e931[_0x2799('0x36')][_0x2799('0x38')]));_0x3d181a[_0x2799('0x39')]=_0x3d181a[_0x2799('0x39')]['length']?_0x3d181a[_0x2799('0x39')]:_0xcb075d[_0x2799('0x33')];if(_0xb7e931[_0x2799('0x36')][_0x2799('0x44')]){_0x3d181a[_0x2799('0x45')]=[{'all':!![]}];}_0x3d181a=_['merge']({},_0x3d181a,_0xb7e931['options']);return db[_0x2799('0x4c')]['find'](_0x3d181a)[_0x2799('0x2d')](handleEntityNotFound(_0x554a4b,null))[_0x2799('0x2d')](respondWithResult(_0x554a4b,null))[_0x2799('0x48')](handleError(_0x554a4b,null));};exports[_0x2799('0x4d')]=function(_0x3d2843,_0x444625){return db[_0x2799('0x4c')][_0x2799('0x4d')](_0x3d2843[_0x2799('0x4e')],{})[_0x2799('0x2d')](respondWithResult(_0x444625,0xc9))[_0x2799('0x48')](handleError(_0x444625,null));};exports['update']=function(_0x1bf256,_0x19f1bb){if(_0x1bf256['body']['id']){delete _0x1bf256[_0x2799('0x4e')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x1bf256[_0x2799('0x4a')]['id']}})[_0x2799('0x2d')](handleEntityNotFound(_0x19f1bb,null))['then'](saveUpdates(_0x1bf256[_0x2799('0x4e')],null))[_0x2799('0x2d')](respondWithResult(_0x19f1bb,null))[_0x2799('0x48')](handleError(_0x19f1bb,null));};exports[_0x2799('0x2e')]=function(_0x31177f,_0x34a5c0){return db[_0x2799('0x4c')][_0x2799('0x4f')]({'where':{'id':_0x31177f[_0x2799('0x4a')]['id']}})['then'](handleEntityNotFound(_0x34a5c0,null))[_0x2799('0x2d')](removeEntity(_0x34a5c0,null))[_0x2799('0x48')](handleError(_0x34a5c0,null));};exports[_0x2799('0x50')]=function(_0x4b5159,_0x266aa4){return db['ChatInternalMessage']['describe']()['then'](respondWithResult(_0x266aa4,null))[_0x2799('0x48')](handleError(_0x266aa4,null));};function wrapUser(_0x5e82c9){return function(_0x36601b){var _0x469fad=_0x5e82c9['get']({'plain':!![]});_0x469fad[_0x2799('0x51')]=[];if(_0x36601b){_0x469fad[_0x2799('0x52')]=_0x36601b[_0x2799('0x53')];_0x469fad['lastMessage']=_0x36601b;}else{_0x469fad[_0x2799('0x52')]=moment(0x0)[_0x2799('0x54')](_0x2799('0x55'));_0x469fad['lastMessage']={};}return _0x469fad;};}exports[_0x2799('0x56')]=function(_0x1524b0,_0x219b36,_0x3cbe1b){var _0x320b07=[];return db[_0x2799('0x57')][_0x2799('0x46')]({'where':{'role':[_0x2799('0x58'),_0x2799('0x59'),'user']},'attributes':['id',_0x2799('0x5a'),_0x2799('0x30'),_0x2799('0x5b'),'userpic',_0x2799('0x5c'),_0x2799('0x5d'),'lastLoginAt','allowmessenger',_0x2799('0x5e')],'order':qs['sort'](_0x2799('0x5f')),'include':[{'model':db[_0x2799('0x60')],'as':_0x2799('0x61'),'attributes':['id',_0x2799('0x30'),'type'],'through':{'attributes':[]}}]})[_0x2799('0x2d')](function(_0x431087){if(_0x431087){var _0x4dbe9c=_0x1524b0[_0x2799('0x62')][_0x2799('0x63')]({'plain':!![]});if(!_0x4dbe9c)throw new Error(_0x2799('0x64'));if(_0x4dbe9c['role']==='user'){return db[_0x2799('0x65')]['find']({'where':{'name':'Agents','userProfileId':_0x4dbe9c['userProfileId']},'raw':!![]})[_0x2799('0x2d')](function(_0x3e58ce){if(_0x3e58ce){if(_0x3e58ce['autoAssociation']===0x0){return db['UserProfileResource'][_0x2799('0x46')]({'where':{'sectionId':_0x3e58ce['id']},'raw':!![]})[_0x2799('0x2d')](function(_0x179428){var _0x4257a2=[];if(_[_0x2799('0x66')](_0x179428)){_0x4257a2=_[_0x2799('0x40')](_0x431087,function(_0x31cc14){if(_0x31cc14[_0x2799('0x5b')]!==_0x2799('0x58')){return _0x31cc14;}});return _0x4257a2;}else{for(var _0x5a55f1=0x0;_0x5a55f1<_0x431087[_0x2799('0x3a')];_0x5a55f1++){var _0x4d0932=_0x431087[_0x5a55f1];if(_0x4d0932[_0x2799('0x5b')]===_0x2799('0x58')){var _0x3f124f=_[_0x2799('0x4f')](_0x179428,function(_0x4e0db8){return _0x4e0db8[_0x2799('0x67')]===_0x4d0932['id'];});if(_0x3f124f)_0x4257a2[_0x2799('0x68')](_0x4d0932);}else{_0x4257a2[_0x2799('0x68')](_0x4d0932);}}return _0x4257a2;}});}else{return _0x431087;}}else{var _0x192995=_[_0x2799('0x40')](_0x431087,function(_0x1821c7){if(_0x1821c7['role']!==_0x2799('0x58')){return _0x1821c7;}});return _0x192995;}});}else{return _0x431087;}}})['then'](function(_0x542a84){var _0x7e7e25=[];if(_0x542a84){_0x320b07=_0x542a84;for(var _0x3754f7=0x0;_0x3754f7<_0x542a84[_0x2799('0x3a')];_0x3754f7+=0x1){_0x320b07[_0x3754f7][_0x2799('0x51')]=[];_0x7e7e25[_0x2799('0x68')](db[_0x2799('0x4c')][_0x2799('0x4f')]({'where':{'FromId':[_0x1524b0['user']['id'],_0x542a84[_0x3754f7]['id']],'ToId':[_0x1524b0[_0x2799('0x62')]['id'],_0x542a84[_0x3754f7]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x2799('0x69'),_0x2799('0x6a'),_0x2799('0x6b'),'body'],'order':qs[_0x2799('0x3d')](_0x2799('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2799('0x2d')](wrapUser(_0x542a84[_0x3754f7])));}return BPromise[_0x2799('0x6d')](_0x7e7e25);}return[];})['then'](function(_0x525b05){return{'rows':_0x525b05,'count':_0x525b05['length']};})[_0x2799('0x2d')](respondWithResult(_0x219b36,null))[_0x2799('0x48')](handleError(_0x219b36,null));}; \ No newline at end of file +var _0x836a=['type','key','query','model','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','catch','show','params','keys','attributes','fields','options','find','create','body','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','user','fullname','role','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','isEmpty','resourceId','push','ToId','read','-createdAt','all','html-pdf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','json','count','offset','limit','status','reject','save','update','then','destroy','stack','name','send','map','ChatInternalMessage','rawAttributes'];(function(_0x1eee3d,_0x5a84a5){var _0x376e04=function(_0x36a199){while(--_0x36a199){_0x1eee3d['push'](_0x1eee3d['shift']());}};_0x376e04(++_0x5a84a5);}(_0x836a,0xa1));var _0xa836=function(_0x3dfbc3,_0x41a601){_0x3dfbc3=_0x3dfbc3-0x0;var _0x53fc9e=_0x836a[_0x3dfbc3];return _0x53fc9e;};'use strict';var pdf=require(_0xa836('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa836('0x1'));var moment=require(_0xa836('0x2'));var BPromise=require(_0xa836('0x3'));var Mustache=require(_0xa836('0x4'));var util=require('util');var path=require(_0xa836('0x5'));var sox=require(_0xa836('0x6'));var csv=require(_0xa836('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa836('0x8'));var squel=require(_0xa836('0x9'));var crypto=require(_0xa836('0xa'));var jsforce=require(_0xa836('0xb'));var deskjs=require(_0xa836('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa836('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa836('0xe'));var as=require(_0xa836('0xf'));var hardwareService=require(_0xa836('0x10'));var logger=require(_0xa836('0x11'))(_0xa836('0x12'));var utils=require(_0xa836('0x13'));var config=require(_0xa836('0x14'));var db=require(_0xa836('0x15'))['db'];config[_0xa836('0x16')]=_['defaults'](config[_0xa836('0x16')],{'host':_0xa836('0x17'),'port':0x18eb});var socket=require(_0xa836('0x18'))(new Redis(config[_0xa836('0x16')]));require(_0xa836('0x19'))[_0xa836('0x1a')](socket);function respondWithStatusCode(_0x52da21,_0x3ae4a7){_0x3ae4a7=_0x3ae4a7||0xcc;return function(_0x4301d0){if(_0x4301d0){return _0x52da21[_0xa836('0x1b')](_0x3ae4a7);}return _0x52da21['status'](_0x3ae4a7)[_0xa836('0x1c')]();};}function respondWithResult(_0x1c1cf1,_0x417f90){_0x417f90=_0x417f90||0xc8;return function(_0x123a3e){if(_0x123a3e){return _0x1c1cf1['status'](_0x417f90)[_0xa836('0x1d')](_0x123a3e);}};}function respondWithFilteredResult(_0x2fd3b5,_0x4ea073){return function(_0x2f5e9a){if(_0x2f5e9a){var _0x2a607e=_0x2f5e9a[_0xa836('0x1e')],_0x568cc0=_0x4ea073[_0xa836('0x1f')],_0x3c1002=_0x4ea073['offset']+_0x4ea073[_0xa836('0x20')],_0x41b5fe;if(_0x3c1002>=_0x2a607e){_0x3c1002=_0x2a607e;_0x41b5fe=0xc8;}else{_0x41b5fe=0xce;}_0x2fd3b5[_0xa836('0x21')](_0x41b5fe);return _0x2fd3b5['set']('Content-Range',_0x568cc0+'-'+_0x3c1002+'/'+_0x2a607e)[_0xa836('0x1d')](_0x2f5e9a);}return null;};}function patchUpdates(_0xdc266c){return function(_0x4f3208){try{jsonpatch['apply'](_0x4f3208,_0xdc266c,!![]);}catch(_0x304797){return BPromise[_0xa836('0x22')](_0x304797);}return _0x4f3208[_0xa836('0x23')]();};}function saveUpdates(_0x577882,_0x38af18){return function(_0x38b192){if(_0x38b192){return _0x38b192[_0xa836('0x24')](_0x577882)[_0xa836('0x25')](function(_0xfd36c9){return _0xfd36c9;});}return null;};}function removeEntity(_0x5ee9ed,_0x424e56){return function(_0x4717d7){if(_0x4717d7){return _0x4717d7[_0xa836('0x26')]()['then'](function(){_0x5ee9ed['status'](0xcc)[_0xa836('0x1c')]();});}};}function handleEntityNotFound(_0x5bbe8d,_0x1198bb){return function(_0x4d41a7){if(!_0x4d41a7){_0x5bbe8d['sendStatus'](0x194);}return _0x4d41a7;};}function handleError(_0x542f02,_0x17a2ca){_0x17a2ca=_0x17a2ca||0x1f4;return function(_0x5eb29b){logger['error'](_0x5eb29b[_0xa836('0x27')]);if(_0x5eb29b[_0xa836('0x28')]){delete _0x5eb29b[_0xa836('0x28')];}_0x542f02['status'](_0x17a2ca)[_0xa836('0x29')](_0x5eb29b);};}exports['index']=function(_0x3a218d,_0x1c7bf6){var _0x19aca2={},_0x35792e={},_0x46531c={'count':0x0,'rows':[]};var _0x5e0470=_[_0xa836('0x2a')](db[_0xa836('0x2b')][_0xa836('0x2c')],function(_0x39b46e){return{'name':_0x39b46e['fieldName'],'type':_0x39b46e[_0xa836('0x2d')][_0xa836('0x2e')]};});_0x35792e['model']=_[_0xa836('0x2a')](_0x5e0470,_0xa836('0x28'));_0x35792e[_0xa836('0x2f')]=_['keys'](_0x3a218d['query']);_0x35792e['filters']=_['intersection'](_0x35792e[_0xa836('0x30')],_0x35792e[_0xa836('0x2f')]);_0x19aca2['attributes']=_[_0xa836('0x31')](_0x35792e[_0xa836('0x30')],qs['fields'](_0x3a218d[_0xa836('0x2f')]['fields']));_0x19aca2['attributes']=_0x19aca2['attributes'][_0xa836('0x32')]?_0x19aca2['attributes']:_0x35792e[_0xa836('0x30')];if(!_0x3a218d[_0xa836('0x2f')][_0xa836('0x33')](_0xa836('0x34'))){_0x19aca2[_0xa836('0x20')]=qs['limit'](_0x3a218d[_0xa836('0x2f')][_0xa836('0x20')]);_0x19aca2['offset']=qs[_0xa836('0x1f')](_0x3a218d['query'][_0xa836('0x1f')]);}_0x19aca2[_0xa836('0x35')]=qs[_0xa836('0x36')](_0x3a218d['query'][_0xa836('0x36')]);_0x19aca2[_0xa836('0x37')]=qs['filters'](_[_0xa836('0x38')](_0x3a218d['query'],_0x35792e[_0xa836('0x39')]),_0x5e0470);if(_0x3a218d[_0xa836('0x2f')][_0xa836('0x3a')]){_0x19aca2[_0xa836('0x37')]=_[_0xa836('0x3b')](_0x19aca2['where'],{'$or':_[_0xa836('0x2a')](_0x5e0470,function(_0xeafb1e){if(_0xeafb1e[_0xa836('0x2d')]!==_0xa836('0x3c')){var _0x5cc9c5={};_0x5cc9c5[_0xeafb1e[_0xa836('0x28')]]={'$like':'%'+_0x3a218d[_0xa836('0x2f')][_0xa836('0x3a')]+'%'};return _0x5cc9c5;}})});}_0x19aca2=_[_0xa836('0x3b')]({},_0x19aca2,_0x3a218d['options']);var _0x5437f4={'where':_0x19aca2[_0xa836('0x37')]};return db[_0xa836('0x2b')][_0xa836('0x1e')](_0x5437f4)[_0xa836('0x25')](function(_0x14c52d){_0x46531c[_0xa836('0x1e')]=_0x14c52d;if(_0x3a218d[_0xa836('0x2f')][_0xa836('0x3d')]){_0x19aca2[_0xa836('0x3e')]=[{'all':!![]}];}return db[_0xa836('0x2b')]['findAll'](_0x19aca2);})[_0xa836('0x25')](function(_0x40460a){_0x46531c['rows']=_0x40460a;return _0x46531c;})[_0xa836('0x25')](respondWithFilteredResult(_0x1c7bf6,_0x19aca2))[_0xa836('0x3f')](handleError(_0x1c7bf6,null));};exports[_0xa836('0x40')]=function(_0x20a06c,_0x25fce3){var _0x5573dd={'raw':!![],'where':{'id':_0x20a06c[_0xa836('0x41')]['id']}},_0x23c4af={};_0x23c4af[_0xa836('0x30')]=_[_0xa836('0x42')](db[_0xa836('0x2b')][_0xa836('0x2c')]);_0x23c4af[_0xa836('0x2f')]=_['keys'](_0x20a06c[_0xa836('0x2f')]);_0x23c4af[_0xa836('0x39')]=_['intersection'](_0x23c4af['model'],_0x23c4af[_0xa836('0x2f')]);_0x5573dd[_0xa836('0x43')]=_[_0xa836('0x31')](_0x23c4af[_0xa836('0x30')],qs[_0xa836('0x44')](_0x20a06c[_0xa836('0x2f')]['fields']));_0x5573dd[_0xa836('0x43')]=_0x5573dd[_0xa836('0x43')][_0xa836('0x32')]?_0x5573dd['attributes']:_0x23c4af[_0xa836('0x30')];if(_0x20a06c[_0xa836('0x2f')][_0xa836('0x3d')]){_0x5573dd[_0xa836('0x3e')]=[{'all':!![]}];}_0x5573dd=_['merge']({},_0x5573dd,_0x20a06c[_0xa836('0x45')]);return db['ChatInternalMessage'][_0xa836('0x46')](_0x5573dd)[_0xa836('0x25')](handleEntityNotFound(_0x25fce3,null))[_0xa836('0x25')](respondWithResult(_0x25fce3,null))[_0xa836('0x3f')](handleError(_0x25fce3,null));};exports['create']=function(_0xab3449,_0x279fd9){return db[_0xa836('0x2b')][_0xa836('0x47')](_0xab3449['body'],{})['then'](respondWithResult(_0x279fd9,0xc9))[_0xa836('0x3f')](handleError(_0x279fd9,null));};exports['update']=function(_0x41fe89,_0x2f4717){if(_0x41fe89['body']['id']){delete _0x41fe89[_0xa836('0x48')]['id'];}return db[_0xa836('0x2b')]['find']({'where':{'id':_0x41fe89[_0xa836('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f4717,null))[_0xa836('0x25')](saveUpdates(_0x41fe89[_0xa836('0x48')],null))['then'](respondWithResult(_0x2f4717,null))[_0xa836('0x3f')](handleError(_0x2f4717,null));};exports['destroy']=function(_0x4960e2,_0x77fb48){return db[_0xa836('0x2b')][_0xa836('0x46')]({'where':{'id':_0x4960e2['params']['id']}})[_0xa836('0x25')](handleEntityNotFound(_0x77fb48,null))[_0xa836('0x25')](removeEntity(_0x77fb48,null))[_0xa836('0x3f')](handleError(_0x77fb48,null));};exports['describe']=function(_0x4c3542,_0x3f138a){return db[_0xa836('0x2b')]['describe']()[_0xa836('0x25')](respondWithResult(_0x3f138a,null))['catch'](handleError(_0x3f138a,null));};function wrapUser(_0x430d19){return function(_0x17cd4c){var _0x45f5a9=_0x430d19[_0xa836('0x49')]({'plain':!![]});_0x45f5a9[_0xa836('0x4a')]=[];if(_0x17cd4c){_0x45f5a9['lastMessageAt']=_0x17cd4c[_0xa836('0x4b')];_0x45f5a9[_0xa836('0x4c')]=_0x17cd4c;}else{_0x45f5a9[_0xa836('0x4d')]=moment(0x0)[_0xa836('0x4e')](_0xa836('0x4f'));_0x45f5a9[_0xa836('0x4c')]={};}return _0x45f5a9;};}exports['getUsers']=function(_0x5e390a,_0x218ff8,_0x36adb1){var _0x5af3b0=[];return db[_0xa836('0x50')][_0xa836('0x51')]({'where':{'role':[_0xa836('0x52'),_0xa836('0x53'),_0xa836('0x54')]},'attributes':['id',_0xa836('0x55'),_0xa836('0x28'),_0xa836('0x56'),'userpic','internal','online',_0xa836('0x57'),'allowmessenger',_0xa836('0x58')],'order':qs['sort'](_0xa836('0x59')),'include':[{'model':db[_0xa836('0x5a')],'as':_0xa836('0x5b'),'attributes':['id','name',_0xa836('0x2d')],'through':{'attributes':[]}}]})[_0xa836('0x25')](function(_0x394592){if(_0x394592){var _0x178c41=_0x5e390a[_0xa836('0x54')][_0xa836('0x49')]({'plain':!![]});if(!_0x178c41)throw new Error(_0xa836('0x5c'));if(_0x178c41[_0xa836('0x56')]===_0xa836('0x54')){return db[_0xa836('0x5d')][_0xa836('0x46')]({'where':{'name':_0xa836('0x5e'),'userProfileId':_0x178c41[_0xa836('0x5f')]},'raw':!![]})[_0xa836('0x25')](function(_0x58baf4){if(_0x58baf4){if(_0x58baf4['autoAssociation']===0x0){return db['UserProfileResource'][_0xa836('0x51')]({'where':{'sectionId':_0x58baf4['id']},'raw':!![]})['then'](function(_0x573060){var _0x5db52a=[];if(_[_0xa836('0x60')](_0x573060)){_0x5db52a=_['filter'](_0x394592,function(_0xbde0e8){if(_0xbde0e8[_0xa836('0x56')]!=='agent'){return _0xbde0e8;}});return _0x5db52a;}else{for(var _0x21ab1d=0x0;_0x21ab1d<_0x394592[_0xa836('0x32')];_0x21ab1d++){var _0x38380e=_0x394592[_0x21ab1d];if(_0x38380e[_0xa836('0x56')]==='agent'){var _0x214b7f=_[_0xa836('0x46')](_0x573060,function(_0x58a8fe){return _0x58a8fe[_0xa836('0x61')]===_0x38380e['id'];});if(_0x214b7f)_0x5db52a['push'](_0x38380e);}else{_0x5db52a[_0xa836('0x62')](_0x38380e);}}return _0x5db52a;}});}else{return _0x394592;}}else{var _0x29c770=_[_0xa836('0x3a')](_0x394592,function(_0x194c54){if(_0x194c54[_0xa836('0x56')]!==_0xa836('0x52')){return _0x194c54;}});return _0x29c770;}});}else{return _0x394592;}}})['then'](function(_0x2cce2c){var _0xccf11b=[];if(_0x2cce2c){_0x5af3b0=_0x2cce2c;for(var _0x27b6db=0x0;_0x27b6db<_0x2cce2c[_0xa836('0x32')];_0x27b6db+=0x1){_0x5af3b0[_0x27b6db][_0xa836('0x4a')]=[];_0xccf11b[_0xa836('0x62')](db[_0xa836('0x2b')]['find']({'where':{'FromId':[_0x5e390a['user']['id'],_0x2cce2c[_0x27b6db]['id']],'ToId':[_0x5e390a['user']['id'],_0x2cce2c[_0x27b6db]['id']],'ChatGroupId':null},'attributes':['id',_0xa836('0x4b'),'FromId',_0xa836('0x63'),_0xa836('0x64'),_0xa836('0x48')],'order':qs['sort'](_0xa836('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2cce2c[_0x27b6db])));}return BPromise[_0xa836('0x66')](_0xccf11b);}return[];})['then'](function(_0xa6c1be){return{'rows':_0xa6c1be,'count':_0xa6c1be[_0xa836('0x32')]};})[_0xa836('0x25')](respondWithResult(_0x218ff8,null))[_0xa836('0x3f')](handleError(_0x218ff8,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 3838d7d..639360e 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 _0x5a2a=['hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x3fa9c1,_0x27a1b9){_0x3fa9c1=_0x3fa9c1-0x0;var _0x6e0d4=_0x5a2a[_0x3fa9c1];return _0x6e0d4;};'use strict';var EventEmitter=require(_0xa5a2('0x0'));var ChatInternalMessage=require(_0xa5a2('0x1'))['db'][_0xa5a2('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa5a2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e464d){return function(_0x2cf196,_0x479d0a,_0x14bf26){ChatInternalMessageEvents[_0xa5a2('0x4')](_0x4e464d+':'+_0x2cf196['id'],_0x2cf196);ChatInternalMessageEvents[_0xa5a2('0x4')](_0x4e464d,_0x2cf196);_0x14bf26(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xa5a2('0x5')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xe186=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x5eb54c,_0x18e877){var _0x8c2e02=function(_0x348324){while(--_0x348324){_0x5eb54c['push'](_0x5eb54c['shift']());}};_0x8c2e02(++_0x18e877);}(_0xe186,0x146));var _0x6e18=function(_0x378a79,_0x2e0505){_0x378a79=_0x378a79-0x0;var _0x9cc7fe=_0xe186[_0x378a79];return _0x9cc7fe;};'use strict';var EventEmitter=require(_0x6e18('0x0'));var ChatInternalMessage=require(_0x6e18('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6e18('0x2')](0x0);var events={'afterCreate':_0x6e18('0x3'),'afterUpdate':_0x6e18('0x4'),'afterDestroy':_0x6e18('0x5')};function emitEvent(_0x2b6009){return function(_0x4b7198,_0x1d3480,_0x530594){ChatInternalMessageEvents[_0x6e18('0x6')](_0x2b6009+':'+_0x4b7198['id'],_0x4b7198);ChatInternalMessageEvents[_0x6e18('0x6')](_0x2b6009,_0x4b7198);_0x530594(null);};}for(var e in events){if(events[_0x6e18('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index bcb6f2a..ad47105 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 _0x7d5a=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','chat_internal_messages'];(function(_0x3ee0a7,_0x3c4caa){var _0x26ad58=function(_0x43e903){while(--_0x43e903){_0x3ee0a7['push'](_0x3ee0a7['shift']());}};_0x26ad58(++_0x3c4caa);}(_0x7d5a,0x1bc));var _0xa7d5=function(_0x1cabfe,_0x11df8a){_0x1cabfe=_0x1cabfe-0x0;var _0x468bad=_0x7d5a[_0x1cabfe];return _0x468bad;};'use strict';var _=require(_0xa7d5('0x0'));var util=require(_0xa7d5('0x1'));var logger=require(_0xa7d5('0x2'))(_0xa7d5('0x3'));var moment=require(_0xa7d5('0x4'));var BPromise=require(_0xa7d5('0x5'));var rp=require(_0xa7d5('0x6'));var fs=require('fs');var path=require(_0xa7d5('0x7'));var rimraf=require('rimraf');var config=require(_0xa7d5('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0xa7d5('0x9')]=function(_0x44ab87,_0x12430d){return _0x44ab87['define']('ChatInternalMessage',attributes,{'tableName':_0xa7d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa7d5('0xb'),'collate':_0xa7d5('0xc')});}; \ No newline at end of file +var _0x0c2e=['ChatInternalMessage','chat_internal_messages','lodash','../../config/logger','api','path','rimraf','../../config/environment','exports'];(function(_0x277607,_0x345a06){var _0x15fe23=function(_0x336de7){while(--_0x336de7){_0x277607['push'](_0x277607['shift']());}};_0x15fe23(++_0x345a06);}(_0x0c2e,0x1b2));var _0xe0c2=function(_0x159b78,_0x1f1acc){_0x159b78=_0x159b78-0x0;var _0x51f35d=_0x0c2e[_0x159b78];return _0x51f35d;};'use strict';var _=require(_0xe0c2('0x0'));var util=require('util');var logger=require(_0xe0c2('0x1'))(_0xe0c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0c2('0x3'));var rimraf=require(_0xe0c2('0x4'));var config=require(_0xe0c2('0x5'));var attributes=require('./chatInternalMessage.attributes');module[_0xe0c2('0x6')]=function(_0x5ee7f6,_0x27a975){return _0x5ee7f6['define'](_0xe0c2('0x7'),attributes,{'tableName':_0xe0c2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 a395bf0..dbbcd71 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 _0x754f=['bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','util'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x754f,0x1df));var _0xf754=function(_0x4577e1,_0x40f199){_0x4577e1=_0x4577e1-0x0;var _0x578b7b=_0x754f[_0x4577e1];return _0x578b7b;};'use strict';var _=require('lodash');var util=require(_0xf754('0x0'));var moment=require('moment');var BPromise=require(_0xf754('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf754('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf754('0x3'))(_0xf754('0x4'));var config=require(_0xf754('0x5'));var jayson=require(_0xf754('0x6'));var client=jayson[_0xf754('0x7')]['http']({'port':0x232a});config[_0xf754('0x8')]=_[_0xf754('0x9')](config[_0xf754('0x8')],{'host':_0xf754('0xa'),'port':0x18eb});var socket=require(_0xf754('0xb'))(new Redis(config[_0xf754('0x8')]));require(_0xf754('0xc'))[_0xf754('0xd')](socket);function respondWithRpcPromise(_0x21f33f,_0x3dd883,_0xdcfac0){return new BPromise(function(_0x1ae6d0,_0x1b03dd){return client['request'](_0x21f33f,_0xdcfac0)[_0xf754('0xe')](function(_0x2d95dd){logger[_0xf754('0xf')](_0xf754('0x10'),_0x3dd883,_0xf754('0x11'));logger[_0xf754('0x12')](_0xf754('0x13'),_0x3dd883,_0xf754('0x11'),JSON['stringify'](_0x2d95dd));if(_0x2d95dd[_0xf754('0x14')]){if(_0x2d95dd[_0xf754('0x14')]['code']===0x1f4){logger[_0xf754('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x3dd883,_0x2d95dd['error']['message']);return _0x1b03dd(_0x2d95dd[_0xf754('0x14')]['message']);}logger[_0xf754('0x14')](_0xf754('0x10'),_0x3dd883,_0x2d95dd['error'][_0xf754('0x15')]);return _0x1ae6d0(_0x2d95dd[_0xf754('0x14')][_0xf754('0x15')]);}else{logger[_0xf754('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x3dd883,_0xf754('0x11'));_0x1ae6d0(_0x2d95dd[_0xf754('0x16')][_0xf754('0x15')]);}})[_0xf754('0x17')](function(_0x18d0c7){logger[_0xf754('0x14')](_0xf754('0x10'),_0x3dd883,_0x18d0c7);_0x1b03dd(_0x18d0c7);});});} \ No newline at end of file +var _0x8e1b=['../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x32c9b9,_0x21a0cf){var _0x239eab=function(_0x25fceb){while(--_0x25fceb){_0x32c9b9['push'](_0x32c9b9['shift']());}};_0x239eab(++_0x21a0cf);}(_0x8e1b,0xfc));var _0xb8e1=function(_0x198300,_0x45af06){_0x198300=_0x198300-0x0;var _0x2d254b=_0x8e1b[_0x198300];return _0x2d254b;};'use strict';var _=require(_0xb8e1('0x0'));var util=require(_0xb8e1('0x1'));var moment=require(_0xb8e1('0x2'));var BPromise=require(_0xb8e1('0x3'));var rs=require(_0xb8e1('0x4'));var fs=require('fs');var Redis=require(_0xb8e1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb8e1('0x6'));var logger=require(_0xb8e1('0x7'))(_0xb8e1('0x8'));var config=require(_0xb8e1('0x9'));var jayson=require(_0xb8e1('0xa'));var client=jayson[_0xb8e1('0xb')]['http']({'port':0x232a});config['redis']=_[_0xb8e1('0xc')](config[_0xb8e1('0xd')],{'host':_0xb8e1('0xe'),'port':0x18eb});var socket=require(_0xb8e1('0xf'))(new Redis(config[_0xb8e1('0xd')]));require(_0xb8e1('0x10'))[_0xb8e1('0x11')](socket);function respondWithRpcPromise(_0x3e1787,_0x3e041c,_0x2e8c74){return new BPromise(function(_0x45bae4,_0x3f57b0){return client['request'](_0x3e1787,_0x2e8c74)[_0xb8e1('0x12')](function(_0x14d2cb){logger['info'](_0xb8e1('0x13'),_0x3e041c,_0xb8e1('0x14'));logger[_0xb8e1('0x15')](_0xb8e1('0x16'),_0x3e041c,_0xb8e1('0x14'),JSON[_0xb8e1('0x17')](_0x14d2cb));if(_0x14d2cb[_0xb8e1('0x18')]){if(_0x14d2cb[_0xb8e1('0x18')][_0xb8e1('0x19')]===0x1f4){logger['error'](_0xb8e1('0x13'),_0x3e041c,_0x14d2cb[_0xb8e1('0x18')]['message']);return _0x3f57b0(_0x14d2cb[_0xb8e1('0x18')]['message']);}logger[_0xb8e1('0x18')](_0xb8e1('0x13'),_0x3e041c,_0x14d2cb[_0xb8e1('0x18')][_0xb8e1('0x1a')]);return _0x45bae4(_0x14d2cb['error'][_0xb8e1('0x1a')]);}else{logger[_0xb8e1('0x1b')](_0xb8e1('0x13'),_0x3e041c,'request\x20sent');_0x45bae4(_0x14d2cb['result'][_0xb8e1('0x1a')]);}})[_0xb8e1('0x1c')](function(_0x10ddf1){logger[_0xb8e1('0x18')](_0xb8e1('0x13'),_0x3e041c,_0x10ddf1);_0x3f57b0(_0x10ddf1);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 3af7ec1..21a4da0 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 _0x33a1=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x5cad16,_0x1d3d20){var _0x3762be=function(_0x6b3cc6){while(--_0x6b3cc6){_0x5cad16['push'](_0x5cad16['shift']());}};_0x3762be(++_0x1d3d20);}(_0x33a1,0x7c));var _0x133a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33a1[_0x20a584];return _0x4b41a8;};'use strict';var ChatInternalMessageEvents=require(_0x133a('0x0'));var events=[_0x133a('0x1'),'remove','update'];function createListener(_0x5dc419,_0x4bcb17){return function(_0x2d6f40){_0x4bcb17[_0x133a('0x2')](_0x5dc419,_0x2d6f40);};}function removeListener(_0x35db62,_0x53da00){return function(){ChatInternalMessageEvents[_0x133a('0x3')](_0x35db62,_0x53da00);};}exports[_0x133a('0x4')]=function(_0x23c48d){for(var _0x557b93=0x0,_0x13fe1d=events[_0x133a('0x5')];_0x557b93<_0x13fe1d;_0x557b93++){var _0x31409d=events[_0x557b93];var _0x5f3a8f=createListener(_0x133a('0x6')+_0x31409d,_0x23c48d);ChatInternalMessageEvents['on'](_0x31409d,_0x5f3a8f);}}; \ No newline at end of file +var _0xb2b5=['chatInternalMessage:','removeListener','register'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xb2b5[_0x4fde08];return _0x12e725;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save','remove','update'];function createListener(_0x4746e7,_0x1431f3){return function(_0x518fe7){_0x1431f3['emit'](_0x4746e7,_0x518fe7);};}function removeListener(_0x31784d,_0x11fae1){return function(){ChatInternalMessageEvents[_0x5b2b('0x0')](_0x31784d,_0x11fae1);};}exports[_0x5b2b('0x1')]=function(_0x49d9f6){for(var _0x30c3e2=0x0,_0x362524=events['length'];_0x30c3e2<_0x362524;_0x30c3e2++){var _0x54389e=events[_0x30c3e2];var _0x1e08e6=createListener(_0x5b2b('0x2')+_0x54389e,_0x49d9f6);ChatInternalMessageEvents['on'](_0x54389e,_0x1e08e6);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 9803043..b92a829 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x5d6349,_0x3e7d3e){var _0x1efd28=function(_0x512604){while(--_0x512604){_0x5d6349['push'](_0x5d6349['shift']());}};_0x1efd28(++_0x3e7d3e);}(_0x70e0,0x17b));var _0x070e=function(_0x3c087d,_0x32b85a){_0x3c087d=_0x3c087d-0x0;var _0x2638c9=_0x70e0[_0x3c087d];return _0x2638c9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0xdb262b,_0x27d28c){var _0x4e5b1e=function(_0x586740){while(--_0x586740){_0xdb262b['push'](_0xdb262b['shift']());}};_0x4e5b1e(++_0x27d28c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index d609305..535caa2 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 _0x0abc=['BOOLEAN','ENUM','out','DATE','sequelize','exports','medium'];(function(_0x8fdd92,_0x3abb9c){var _0x2636a6=function(_0x58f214){while(--_0x58f214){_0x8fdd92['push'](_0x8fdd92['shift']());}};_0x2636a6(++_0x3abb9c);}(_0x0abc,0x1af));var _0xc0ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0abc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc0ab('0x0'));module[_0xc0ab('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc0ab('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc0ab('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc0ab('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc0ab('0x4')]('in',_0xc0ab('0x5')),'defaultValue':_0xc0ab('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc0ab('0x6')]}}; \ No newline at end of file +var _0x00d6=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x44cfdd,_0x24d855){var _0x49b6b9=function(_0xe5ea5c){while(--_0xe5ea5c){_0x44cfdd['push'](_0x44cfdd['shift']());}};_0x49b6b9(++_0x24d855);}(_0x00d6,0x1e5));var _0x600d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x00d6[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x600d('0x0'));module[_0x600d('0x1')]={'body':{'type':Sequelize[_0x600d('0x2')](_0x600d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x600d('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x600d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x600d('0x5')]('in',_0x600d('0x6')),'defaultValue':_0x600d('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x600d('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 9690fea..80ea695 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 _0xf703=['ChatMessage','includeAll','include','findAll','rows','show','keys','fields','length','create','body','find','params','chat-interactions','accept','chat','read','readAt','format','UserId','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','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','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options'];(function(_0x3de0af,_0x5c9af6){var _0x1203d6=function(_0x1f372a){while(--_0x1f372a){_0x3de0af['push'](_0x3de0af['shift']());}};_0x1203d6(++_0x5c9af6);}(_0xf703,0xab));var _0x3f70=function(_0x231f29,_0x1b0082){_0x231f29=_0x231f29-0x0;var _0x5d48b9=_0xf703[_0x231f29];return _0x5d48b9;};'use strict';var pdf=require(_0x3f70('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3f70('0x1'));var zipdir=require(_0x3f70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f70('0x3'));var moment=require(_0x3f70('0x4'));var BPromise=require(_0x3f70('0x5'));var Mustache=require(_0x3f70('0x6'));var util=require(_0x3f70('0x7'));var path=require(_0x3f70('0x8'));var sox=require(_0x3f70('0x9'));var csv=require(_0x3f70('0xa'));var ejs=require(_0x3f70('0xb'));var fs=require('fs');var _=require(_0x3f70('0xc'));var squel=require(_0x3f70('0xd'));var crypto=require(_0x3f70('0xe'));var jsforce=require(_0x3f70('0xf'));var deskjs=require(_0x3f70('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3f70('0x11'));var Papa=require(_0x3f70('0x12'));var Redis=require(_0x3f70('0x13'));var authService=require(_0x3f70('0x14'));var qs=require(_0x3f70('0x15'));var as=require(_0x3f70('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f70('0x17'))(_0x3f70('0x18'));var utils=require(_0x3f70('0x19'));var config=require(_0x3f70('0x1a'));var db=require(_0x3f70('0x1b'))['db'];config[_0x3f70('0x1c')]=_[_0x3f70('0x1d')](config[_0x3f70('0x1c')],{'host':_0x3f70('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f70('0x1c')]));require('./chatMessage.socket')[_0x3f70('0x1f')](socket);var jayson=require(_0x3f70('0x20'));var client=jayson[_0x3f70('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x3f70('0x21')][_0x3f70('0x22')]({'port':0x232a});function checkPasswordPattern(_0x5ab880,_0x44b2ae,_0x13671c){if(_0x13671c){var _0x5c0aa4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c0aa4[_0x3f70('0x23')](_0x44b2ae)){return _0x5ab880;}else{throw new db[(_0x3f70('0x24'))][(_0x3f70('0x25'))](_0x3f70('0x26'));}}else{return _0x5ab880;}}function respondWithRpcPromise(_0x19a429,_0x3cbc75,_0x5e608b,_0x445bc0){return new BPromise(function(_0x56df39,_0x388efa){var _0x327b5b=_0x445bc0||client;return _0x327b5b[_0x3f70('0x27')](_0x19a429,_0x5e608b)[_0x3f70('0x28')](function(_0x4b2b89){logger['info']('ChatMessage,\x20%s,\x20%s',_0x3cbc75,_0x3f70('0x29'));logger[_0x3f70('0x2a')](_0x3f70('0x2b'),_0x3cbc75,_0x3f70('0x29'),JSON[_0x3f70('0x2c')](_0x4b2b89));if(_0x4b2b89[_0x3f70('0x2d')]){if(_0x4b2b89[_0x3f70('0x2d')][_0x3f70('0x2e')]===0x1f4){logger[_0x3f70('0x2d')](_0x3f70('0x2f'),_0x3cbc75,_0x4b2b89[_0x3f70('0x2d')]['message']);return _0x388efa(_0x4b2b89['error']['message']);}logger[_0x3f70('0x2d')](_0x3f70('0x2f'),_0x3cbc75,_0x4b2b89[_0x3f70('0x2d')][_0x3f70('0x30')]);return _0x56df39(_0x4b2b89[_0x3f70('0x2d')][_0x3f70('0x30')]);}else{logger['info'](_0x3f70('0x2f'),_0x3cbc75,_0x3f70('0x29'));_0x56df39(_0x4b2b89[_0x3f70('0x31')][_0x3f70('0x30')]);}})[_0x3f70('0x32')](function(_0xe1a27b){logger[_0x3f70('0x2d')](_0x3f70('0x2f'),_0x3cbc75,_0xe1a27b);_0x388efa(_0xe1a27b);});});}function respondWithStatusCode(_0x4771e2,_0x4875fc){_0x4875fc=_0x4875fc||0xcc;return function(_0x3252ab){if(_0x3252ab){return _0x4771e2['sendStatus'](_0x4875fc);}return _0x4771e2[_0x3f70('0x33')](_0x4875fc)[_0x3f70('0x34')]();};}function respondWithResult(_0x54382c,_0x2b7ef0){_0x2b7ef0=_0x2b7ef0||0xc8;return function(_0x551e21){if(_0x551e21){return _0x54382c['status'](_0x2b7ef0)[_0x3f70('0x35')](_0x551e21);}};}function respondWithFilteredResult(_0x2e96e7,_0x45e60e){return function(_0x268789){if(_0x268789){var _0x30d455=_0x268789[_0x3f70('0x36')],_0x3c73cb=_0x45e60e[_0x3f70('0x37')],_0x22a104=_0x45e60e[_0x3f70('0x37')]+_0x45e60e['limit'],_0x4ef888;if(_0x22a104>=_0x30d455){_0x22a104=_0x30d455;_0x4ef888=0xc8;}else{_0x4ef888=0xce;}_0x2e96e7[_0x3f70('0x33')](_0x4ef888);return _0x2e96e7[_0x3f70('0x38')]('Content-Range',_0x3c73cb+'-'+_0x22a104+'/'+_0x30d455)[_0x3f70('0x35')](_0x268789);}return null;};}function patchUpdates(_0x9de0af){return function(_0x11b9c8){try{jsonpatch[_0x3f70('0x39')](_0x11b9c8,_0x9de0af,!![]);}catch(_0x38ab05){return BPromise[_0x3f70('0x3a')](_0x38ab05);}return _0x11b9c8[_0x3f70('0x3b')]();};}function saveUpdates(_0xf96a5d,_0x41e3f4){return function(_0x330764){if(_0x330764){return _0x330764[_0x3f70('0x3c')](_0xf96a5d)['then'](function(_0x209c9b){return _0x209c9b;});}return null;};}function removeEntity(_0x40dfc4,_0x245d4a){return function(_0x190776){if(_0x190776){return _0x190776[_0x3f70('0x3d')]()['then'](function(){_0x40dfc4['status'](0xcc)[_0x3f70('0x34')]();});}};}function handleEntityNotFound(_0x4caccb,_0x4d4ca6){return function(_0xca9803){if(!_0xca9803){_0x4caccb['sendStatus'](0x194);}return _0xca9803;};}function handleError(_0x5c27d4,_0x4cedf5){_0x4cedf5=_0x4cedf5||0x1f4;return function(_0x4e240a){logger[_0x3f70('0x2d')](_0x4e240a[_0x3f70('0x3e')]);if(_0x4e240a[_0x3f70('0x3f')]){delete _0x4e240a[_0x3f70('0x3f')];}_0x5c27d4['status'](_0x4cedf5)[_0x3f70('0x40')](_0x4e240a);};}exports[_0x3f70('0x41')]=function(_0x15ebb9,_0x5a9034){var _0x248ffb={},_0x1f32b8={},_0x4e3eec={'count':0x0,'rows':[]};var _0x539d54=_[_0x3f70('0x42')](db['ChatMessage'][_0x3f70('0x43')],function(_0x1c1e63){return{'name':_0x1c1e63[_0x3f70('0x44')],'type':_0x1c1e63[_0x3f70('0x45')][_0x3f70('0x46')]};});_0x1f32b8['model']=_['map'](_0x539d54,'name');_0x1f32b8['query']=_['keys'](_0x15ebb9[_0x3f70('0x47')]);_0x1f32b8['filters']=_[_0x3f70('0x48')](_0x1f32b8[_0x3f70('0x49')],_0x1f32b8[_0x3f70('0x47')]);_0x248ffb['attributes']=_['intersection'](_0x1f32b8[_0x3f70('0x49')],qs['fields'](_0x15ebb9[_0x3f70('0x47')]['fields']));_0x248ffb[_0x3f70('0x4a')]=_0x248ffb[_0x3f70('0x4a')]['length']?_0x248ffb['attributes']:_0x1f32b8[_0x3f70('0x49')];if(!_0x15ebb9[_0x3f70('0x47')]['hasOwnProperty'](_0x3f70('0x4b'))){_0x248ffb['limit']=qs[_0x3f70('0x4c')](_0x15ebb9['query'][_0x3f70('0x4c')]);_0x248ffb[_0x3f70('0x37')]=qs['offset'](_0x15ebb9['query'][_0x3f70('0x37')]);}_0x248ffb[_0x3f70('0x4d')]=qs[_0x3f70('0x4e')](_0x15ebb9['query']['sort']);_0x248ffb[_0x3f70('0x4f')]=qs[_0x3f70('0x50')](_['pick'](_0x15ebb9[_0x3f70('0x47')],_0x1f32b8[_0x3f70('0x50')]),_0x539d54);if(_0x15ebb9['query'][_0x3f70('0x51')]){_0x248ffb[_0x3f70('0x4f')]=_[_0x3f70('0x52')](_0x248ffb[_0x3f70('0x4f')],{'$or':_[_0x3f70('0x42')](_0x539d54,function(_0x48a61c){if(_0x48a61c['type']!==_0x3f70('0x53')){var _0x315415={};_0x315415[_0x48a61c['name']]={'$like':'%'+_0x15ebb9[_0x3f70('0x47')][_0x3f70('0x51')]+'%'};return _0x315415;}})});}_0x248ffb=_['merge']({},_0x248ffb,_0x15ebb9[_0x3f70('0x54')]);var _0x180f56={'where':_0x248ffb[_0x3f70('0x4f')]};return db[_0x3f70('0x55')][_0x3f70('0x36')](_0x180f56)['then'](function(_0x512ce0){_0x4e3eec['count']=_0x512ce0;if(_0x15ebb9['query'][_0x3f70('0x56')]){_0x248ffb[_0x3f70('0x57')]=[{'all':!![]}];}return db['ChatMessage'][_0x3f70('0x58')](_0x248ffb);})['then'](function(_0x52948){_0x4e3eec[_0x3f70('0x59')]=_0x52948;return _0x4e3eec;})[_0x3f70('0x28')](respondWithFilteredResult(_0x5a9034,_0x248ffb))[_0x3f70('0x32')](handleError(_0x5a9034,null));};exports[_0x3f70('0x5a')]=function(_0x7a7fcc,_0x12a4d1){var _0x3b34a0={'raw':!![],'where':{'id':_0x7a7fcc['params']['id']}},_0x535649={};_0x535649['model']=_[_0x3f70('0x5b')](db[_0x3f70('0x55')][_0x3f70('0x43')]);_0x535649[_0x3f70('0x47')]=_[_0x3f70('0x5b')](_0x7a7fcc['query']);_0x535649['filters']=_[_0x3f70('0x48')](_0x535649[_0x3f70('0x49')],_0x535649[_0x3f70('0x47')]);_0x3b34a0[_0x3f70('0x4a')]=_[_0x3f70('0x48')](_0x535649[_0x3f70('0x49')],qs['fields'](_0x7a7fcc[_0x3f70('0x47')][_0x3f70('0x5c')]));_0x3b34a0[_0x3f70('0x4a')]=_0x3b34a0['attributes'][_0x3f70('0x5d')]?_0x3b34a0[_0x3f70('0x4a')]:_0x535649[_0x3f70('0x49')];if(_0x7a7fcc[_0x3f70('0x47')]['includeAll']){_0x3b34a0[_0x3f70('0x57')]=[{'all':!![]}];}_0x3b34a0=_[_0x3f70('0x52')]({},_0x3b34a0,_0x7a7fcc[_0x3f70('0x54')]);return db['ChatMessage']['find'](_0x3b34a0)[_0x3f70('0x28')](handleEntityNotFound(_0x12a4d1,null))[_0x3f70('0x28')](respondWithResult(_0x12a4d1,null))['catch'](handleError(_0x12a4d1,null));};exports['create']=function(_0x573002,_0x263ed2){return db[_0x3f70('0x55')][_0x3f70('0x5e')](_0x573002[_0x3f70('0x5f')],{})[_0x3f70('0x28')](respondWithResult(_0x263ed2,0xc9))['catch'](handleError(_0x263ed2,null));};exports[_0x3f70('0x3c')]=function(_0x5407aa,_0x19e13f){if(_0x5407aa['body']['id']){delete _0x5407aa['body']['id'];}return db['ChatMessage'][_0x3f70('0x60')]({'where':{'id':_0x5407aa[_0x3f70('0x61')]['id']}})[_0x3f70('0x28')](handleEntityNotFound(_0x19e13f,null))[_0x3f70('0x28')](saveUpdates(_0x5407aa['body'],null))[_0x3f70('0x28')](respondWithResult(_0x19e13f,null))[_0x3f70('0x32')](handleError(_0x19e13f,null));};exports['destroy']=function(_0x516d4e,_0x5d4661){return db[_0x3f70('0x55')][_0x3f70('0x60')]({'where':{'id':_0x516d4e['params']['id']}})[_0x3f70('0x28')](handleEntityNotFound(_0x5d4661,null))[_0x3f70('0x28')](removeEntity(_0x5d4661,null))[_0x3f70('0x32')](handleError(_0x5d4661,null));};exports['describe']=function(_0x277af6,_0x3df468){return db[_0x3f70('0x55')]['describe']()[_0x3f70('0x28')](respondWithResult(_0x3df468,null))['catch'](handleError(_0x3df468,null));};var interaction_log=require(_0x3f70('0x17'))(_0x3f70('0x62'));exports[_0x3f70('0x63')]=function(_0x315f36,_0xeb400b,_0x398081){var _0x987784={'channel':_0x3f70('0x64')};if(_0x315f36[_0x3f70('0x5f')]['id']){delete _0x315f36[_0x3f70('0x5f')]['id'];}_0x315f36[_0x3f70('0x5f')][_0x3f70('0x65')]=!![];_0x315f36['body'][_0x3f70('0x66')]=moment()[_0x3f70('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x315f36['body'][_0x3f70('0x68')]=_0x315f36[_0x3f70('0x5f')][_0x3f70('0x68')]||_0x315f36['user']['id'];return db[_0x3f70('0x55')][_0x3f70('0x60')]({'where':{'id':_0x315f36['params']['id'],'UserId':null},'include':[{'model':db[_0x3f70('0x69')],'as':_0x3f70('0x6a')}]})[_0x3f70('0x28')](handleEntityNotFound(_0xeb400b,null))[_0x3f70('0x28')](saveUpdates(_0x315f36[_0x3f70('0x5f')],null))[_0x3f70('0x28')](function(_0x5e09ab){if(_0x5e09ab){_0x987784[_0x3f70('0x30')]=_0x5e09ab[_0x3f70('0x6b')]({'plain':!![]});return db[_0x3f70('0x6c')][_0x3f70('0x60')]({'where':{'id':_0x5e09ab[_0x3f70('0x6d')]}});}return null;})[_0x3f70('0x28')](handleEntityNotFound(_0xeb400b,null))[_0x3f70('0x28')](function(_0x22bd9c){if(_0x22bd9c){return _0x22bd9c[_0x3f70('0x3c')]({'UserId':_0x315f36[_0x3f70('0x5f')][_0x3f70('0x68')],'read1stAt':_[_0x3f70('0x6e')](_0x22bd9c['read1stAt'])?moment()[_0x3f70('0x67')](_0x3f70('0x6f')):undefined});}return null;})[_0x3f70('0x28')](function(_0x19f3c8){if(_0x19f3c8){_0x987784[_0x3f70('0x70')]=_0x19f3c8[_0x3f70('0x6b')]({'plain':!![]});interaction_log[_0x3f70('0x71')](_0x3f70('0x72'),_0x315f36['user']['id'],_0x315f36[_0x3f70('0x73')]['name'],_0x315f36['user']['role'],_0x987784[_0x3f70('0x70')]['id'],_0x315f36['body']?JSON[_0x3f70('0x2c')](_0x315f36['body']):_0x3f70('0x74'));return respondWithRpcPromise(_0x3f70('0x75'),_0x3f70('0x76'),_0x987784);}return null;})[_0x3f70('0x28')](function(_0xd563b7){if(_0xd563b7){if(_0x315f36['body'][_0x3f70('0x77')]){_0x987784[_0x3f70('0x30')][_0x3f70('0x78')]=util['format']('SIP/%s',_0x315f36[_0x3f70('0x73')]['name']);_0x987784[_0x3f70('0x30')][_0x3f70('0x79')]=_0x987784['channel'];_0x987784[_0x3f70('0x30')][_0x3f70('0x7a')]=_0x3f70('0x63');return respondWithRpcPromise(_0x3f70('0x7b'),_0x3f70('0x7b'),{'event':_0x3f70('0x7c'),'message':_[_0x3f70('0x52')](_0x987784[_0x3f70('0x30')],JSON['parse'](_0x987784[_0x3f70('0x70')]['formData']))},client9002)['then'](function(){return _0x987784;});}return _0x987784;}return null;})['then'](respondWithResult(_0xeb400b,null))['catch'](handleError(_0xeb400b,null));};var interaction_log=require(_0x3f70('0x17'))(_0x3f70('0x62'));exports[_0x3f70('0x3a')]=function(_0x504262,_0x1db119,_0x420f89){var _0x264603={'agent':{},'channel':'chat'};if(_0x504262[_0x3f70('0x5f')]['id']){delete _0x504262[_0x3f70('0x5f')]['id'];}_0x504262[_0x3f70('0x5f')][_0x3f70('0x68')]=_0x504262[_0x3f70('0x5f')]['UserId']||_0x504262[_0x3f70('0x73')]['id'];_0x264603['agent']['id']=_0x504262[_0x3f70('0x5f')][_0x3f70('0x68')];return db['ChatMessage']['find']({'where':{'id':_0x504262[_0x3f70('0x61')]['id'],'UserId':null}})[_0x3f70('0x28')](handleEntityNotFound(_0x1db119,null))[_0x3f70('0x28')](function(_0x5a859e){if(_0x5a859e){_0x264603[_0x3f70('0x30')]=_0x5a859e[_0x3f70('0x6b')]({'plain':!![]});return db[_0x3f70('0x6c')][_0x3f70('0x60')]({'where':{'id':_0x5a859e[_0x3f70('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x1db119,null))[_0x3f70('0x28')](function(_0x16a3e3){if(_0x16a3e3){_0x264603[_0x3f70('0x70')]=_0x16a3e3['get']({'plain':!![]});interaction_log[_0x3f70('0x71')](_0x3f70('0x7d'),_0x504262['user']['id'],_0x504262[_0x3f70('0x73')][_0x3f70('0x3f')],_0x504262[_0x3f70('0x73')][_0x3f70('0x7e')],_0x264603['interaction']['id'],_0x504262['body']?JSON[_0x3f70('0x2c')](_0x504262['body']):_0x3f70('0x74'));return respondWithRpcPromise('RejectMessage',_0x3f70('0x7f'),_0x264603);}return null;})['then'](function(_0x3e40a6){if(_0x3e40a6){_0x3e40a6['message']['interface']=util['format']('SIP/%s',_0x504262[_0x3f70('0x73')][_0x3f70('0x3f')]);_0x3e40a6[_0x3f70('0x30')][_0x3f70('0x79')]=_0x264603[_0x3f70('0x79')];_0x3e40a6[_0x3f70('0x30')][_0x3f70('0x7a')]=_0x3f70('0x3a');respondWithRpcPromise('EventManager',_0x3f70('0x7b'),{'event':'rejectmessage','message':_0x3e40a6[_0x3f70('0x30')]},client9002);return _0x264603;}return null;})[_0x3f70('0x28')](respondWithResult(_0x1db119,null))['catch'](handleError(_0x1db119,null));}; \ No newline at end of file +var _0x0aba=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save','update','destroy','name','send','index','ChatMessage','rawAttributes','fieldName','type','model','map','keys','attributes','query','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','intersection','fields','find','create','body','describe','chat-interactions','accept','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','acceptMessage','interface','channel','event','EventManager','formData','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SIP/%s','rejectmessage','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse'];(function(_0x59026b,_0x12ace5){var _0x2c6152=function(_0x193dc2){while(--_0x193dc2){_0x59026b['push'](_0x59026b['shift']());}};_0x2c6152(++_0x12ace5);}(_0x0aba,0xdc));var _0xa0ab=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x0aba[_0x58dc25];return _0x21b0a7;};'use strict';var pdf=require(_0xa0ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa0ab('0x1'));var zipdir=require(_0xa0ab('0x2'));var jsonpatch=require(_0xa0ab('0x3'));var rp=require(_0xa0ab('0x4'));var moment=require('moment');var BPromise=require(_0xa0ab('0x5'));var Mustache=require(_0xa0ab('0x6'));var util=require(_0xa0ab('0x7'));var path=require(_0xa0ab('0x8'));var sox=require('sox');var csv=require(_0xa0ab('0x9'));var ejs=require(_0xa0ab('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa0ab('0xb'));var crypto=require(_0xa0ab('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa0ab('0xd'));var toCsv=require(_0xa0ab('0x9'));var querystring=require(_0xa0ab('0xe'));var Papa=require(_0xa0ab('0xf'));var Redis=require(_0xa0ab('0x10'));var authService=require(_0xa0ab('0x11'));var qs=require(_0xa0ab('0x12'));var as=require(_0xa0ab('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0ab('0x14'))('api');var utils=require(_0xa0ab('0x15'));var config=require('../../config/environment');var db=require(_0xa0ab('0x16'))['db'];config[_0xa0ab('0x17')]=_['defaults'](config[_0xa0ab('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0ab('0x18'))(new Redis(config[_0xa0ab('0x17')]));require(_0xa0ab('0x19'))[_0xa0ab('0x1a')](socket);var jayson=require(_0xa0ab('0x1b'));var client=jayson[_0xa0ab('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xa0ab('0x1c')][_0xa0ab('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x2257d7,_0x448fcb,_0x4299d3){if(_0x4299d3){var _0x31441e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31441e[_0xa0ab('0x1e')](_0x448fcb)){return _0x2257d7;}else{throw new db['Sequelize']['ValidationError'](_0xa0ab('0x1f'));}}else{return _0x2257d7;}}function respondWithRpcPromise(_0x37a71f,_0x3eb7e6,_0x2933e8,_0x1136a9){return new BPromise(function(_0x2ad25a,_0x5c4e6b){var _0x5e5096=_0x1136a9||client;return _0x5e5096['request'](_0x37a71f,_0x2933e8)[_0xa0ab('0x20')](function(_0x1578f7){logger[_0xa0ab('0x21')](_0xa0ab('0x22'),_0x3eb7e6,_0xa0ab('0x23'));logger[_0xa0ab('0x24')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3eb7e6,_0xa0ab('0x23'),JSON[_0xa0ab('0x25')](_0x1578f7));if(_0x1578f7[_0xa0ab('0x26')]){if(_0x1578f7[_0xa0ab('0x26')][_0xa0ab('0x27')]===0x1f4){logger[_0xa0ab('0x26')]('ChatMessage,\x20%s,\x20%s',_0x3eb7e6,_0x1578f7[_0xa0ab('0x26')][_0xa0ab('0x28')]);return _0x5c4e6b(_0x1578f7[_0xa0ab('0x26')][_0xa0ab('0x28')]);}logger[_0xa0ab('0x26')](_0xa0ab('0x22'),_0x3eb7e6,_0x1578f7[_0xa0ab('0x26')][_0xa0ab('0x28')]);return _0x2ad25a(_0x1578f7[_0xa0ab('0x26')][_0xa0ab('0x28')]);}else{logger[_0xa0ab('0x21')]('ChatMessage,\x20%s,\x20%s',_0x3eb7e6,'request\x20sent');_0x2ad25a(_0x1578f7[_0xa0ab('0x29')]['message']);}})[_0xa0ab('0x2a')](function(_0x3a7324){logger[_0xa0ab('0x26')]('ChatMessage,\x20%s,\x20%s',_0x3eb7e6,_0x3a7324);_0x5c4e6b(_0x3a7324);});});}function respondWithStatusCode(_0x3ce374,_0x2fca2e){_0x2fca2e=_0x2fca2e||0xcc;return function(_0x4e11cb){if(_0x4e11cb){return _0x3ce374[_0xa0ab('0x2b')](_0x2fca2e);}return _0x3ce374['status'](_0x2fca2e)[_0xa0ab('0x2c')]();};}function respondWithResult(_0x420961,_0x2d758c){_0x2d758c=_0x2d758c||0xc8;return function(_0x2720d8){if(_0x2720d8){return _0x420961[_0xa0ab('0x2d')](_0x2d758c)['json'](_0x2720d8);}};}function respondWithFilteredResult(_0x4ff020,_0x49f9fd){return function(_0xd05742){if(_0xd05742){var _0x38e778=_0xd05742[_0xa0ab('0x2e')],_0x5ba64e=_0x49f9fd[_0xa0ab('0x2f')],_0x4c8d29=_0x49f9fd[_0xa0ab('0x2f')]+_0x49f9fd[_0xa0ab('0x30')],_0x60f069;if(_0x4c8d29>=_0x38e778){_0x4c8d29=_0x38e778;_0x60f069=0xc8;}else{_0x60f069=0xce;}_0x4ff020['status'](_0x60f069);return _0x4ff020[_0xa0ab('0x31')]('Content-Range',_0x5ba64e+'-'+_0x4c8d29+'/'+_0x38e778)[_0xa0ab('0x32')](_0xd05742);}return null;};}function patchUpdates(_0x5432fc){return function(_0x2271f8){try{jsonpatch[_0xa0ab('0x33')](_0x2271f8,_0x5432fc,!![]);}catch(_0xba23cd){return BPromise[_0xa0ab('0x34')](_0xba23cd);}return _0x2271f8[_0xa0ab('0x35')]();};}function saveUpdates(_0x40ec7c,_0x251e11){return function(_0x3318e3){if(_0x3318e3){return _0x3318e3[_0xa0ab('0x36')](_0x40ec7c)['then'](function(_0x20310d){return _0x20310d;});}return null;};}function removeEntity(_0x13d863,_0x504b8a){return function(_0x20233a){if(_0x20233a){return _0x20233a[_0xa0ab('0x37')]()[_0xa0ab('0x20')](function(){_0x13d863[_0xa0ab('0x2d')](0xcc)[_0xa0ab('0x2c')]();});}};}function handleEntityNotFound(_0xa94e3b,_0x549ba5){return function(_0x48fdf3){if(!_0x48fdf3){_0xa94e3b[_0xa0ab('0x2b')](0x194);}return _0x48fdf3;};}function handleError(_0x51b626,_0x5d4bc2){_0x5d4bc2=_0x5d4bc2||0x1f4;return function(_0x4450f2){logger[_0xa0ab('0x26')](_0x4450f2['stack']);if(_0x4450f2[_0xa0ab('0x38')]){delete _0x4450f2[_0xa0ab('0x38')];}_0x51b626[_0xa0ab('0x2d')](_0x5d4bc2)[_0xa0ab('0x39')](_0x4450f2);};}exports[_0xa0ab('0x3a')]=function(_0x5e6e4f,_0x3f037d){var _0x33160b={},_0x3777c6={},_0x1fa261={'count':0x0,'rows':[]};var _0x242466=_['map'](db[_0xa0ab('0x3b')][_0xa0ab('0x3c')],function(_0x1c9d56){return{'name':_0x1c9d56[_0xa0ab('0x3d')],'type':_0x1c9d56[_0xa0ab('0x3e')]['key']};});_0x3777c6[_0xa0ab('0x3f')]=_[_0xa0ab('0x40')](_0x242466,_0xa0ab('0x38'));_0x3777c6['query']=_[_0xa0ab('0x41')](_0x5e6e4f['query']);_0x3777c6['filters']=_['intersection'](_0x3777c6['model'],_0x3777c6['query']);_0x33160b[_0xa0ab('0x42')]=_['intersection'](_0x3777c6['model'],qs['fields'](_0x5e6e4f[_0xa0ab('0x43')]['fields']));_0x33160b[_0xa0ab('0x42')]=_0x33160b[_0xa0ab('0x42')]['length']?_0x33160b[_0xa0ab('0x42')]:_0x3777c6[_0xa0ab('0x3f')];if(!_0x5e6e4f[_0xa0ab('0x43')]['hasOwnProperty'](_0xa0ab('0x44'))){_0x33160b[_0xa0ab('0x30')]=qs['limit'](_0x5e6e4f[_0xa0ab('0x43')][_0xa0ab('0x30')]);_0x33160b[_0xa0ab('0x2f')]=qs[_0xa0ab('0x2f')](_0x5e6e4f[_0xa0ab('0x43')][_0xa0ab('0x2f')]);}_0x33160b[_0xa0ab('0x45')]=qs[_0xa0ab('0x46')](_0x5e6e4f[_0xa0ab('0x43')][_0xa0ab('0x46')]);_0x33160b[_0xa0ab('0x47')]=qs[_0xa0ab('0x48')](_[_0xa0ab('0x49')](_0x5e6e4f[_0xa0ab('0x43')],_0x3777c6['filters']),_0x242466);if(_0x5e6e4f[_0xa0ab('0x43')][_0xa0ab('0x4a')]){_0x33160b[_0xa0ab('0x47')]=_[_0xa0ab('0x4b')](_0x33160b['where'],{'$or':_[_0xa0ab('0x40')](_0x242466,function(_0x46eb08){if(_0x46eb08['type']!==_0xa0ab('0x4c')){var _0x336b4e={};_0x336b4e[_0x46eb08['name']]={'$like':'%'+_0x5e6e4f[_0xa0ab('0x43')][_0xa0ab('0x4a')]+'%'};return _0x336b4e;}})});}_0x33160b=_['merge']({},_0x33160b,_0x5e6e4f[_0xa0ab('0x4d')]);var _0x1fdae8={'where':_0x33160b['where']};return db['ChatMessage'][_0xa0ab('0x2e')](_0x1fdae8)[_0xa0ab('0x20')](function(_0x398234){_0x1fa261[_0xa0ab('0x2e')]=_0x398234;if(_0x5e6e4f['query'][_0xa0ab('0x4e')]){_0x33160b[_0xa0ab('0x4f')]=[{'all':!![]}];}return db[_0xa0ab('0x3b')][_0xa0ab('0x50')](_0x33160b);})[_0xa0ab('0x20')](function(_0x38d333){_0x1fa261['rows']=_0x38d333;return _0x1fa261;})[_0xa0ab('0x20')](respondWithFilteredResult(_0x3f037d,_0x33160b))[_0xa0ab('0x2a')](handleError(_0x3f037d,null));};exports[_0xa0ab('0x51')]=function(_0x415c09,_0x15c101){var _0x3ab469={'raw':!![],'where':{'id':_0x415c09[_0xa0ab('0x52')]['id']}},_0x40f381={};_0x40f381[_0xa0ab('0x3f')]=_['keys'](db['ChatMessage'][_0xa0ab('0x3c')]);_0x40f381['query']=_[_0xa0ab('0x41')](_0x415c09[_0xa0ab('0x43')]);_0x40f381[_0xa0ab('0x48')]=_[_0xa0ab('0x53')](_0x40f381[_0xa0ab('0x3f')],_0x40f381[_0xa0ab('0x43')]);_0x3ab469[_0xa0ab('0x42')]=_['intersection'](_0x40f381[_0xa0ab('0x3f')],qs[_0xa0ab('0x54')](_0x415c09['query']['fields']));_0x3ab469[_0xa0ab('0x42')]=_0x3ab469[_0xa0ab('0x42')]['length']?_0x3ab469['attributes']:_0x40f381[_0xa0ab('0x3f')];if(_0x415c09[_0xa0ab('0x43')][_0xa0ab('0x4e')]){_0x3ab469['include']=[{'all':!![]}];}_0x3ab469=_[_0xa0ab('0x4b')]({},_0x3ab469,_0x415c09[_0xa0ab('0x4d')]);return db[_0xa0ab('0x3b')][_0xa0ab('0x55')](_0x3ab469)['then'](handleEntityNotFound(_0x15c101,null))['then'](respondWithResult(_0x15c101,null))[_0xa0ab('0x2a')](handleError(_0x15c101,null));};exports[_0xa0ab('0x56')]=function(_0x5aaca6,_0x3f4d14){return db['ChatMessage'][_0xa0ab('0x56')](_0x5aaca6['body'],{})[_0xa0ab('0x20')](respondWithResult(_0x3f4d14,0xc9))['catch'](handleError(_0x3f4d14,null));};exports['update']=function(_0x49953f,_0x482176){if(_0x49953f['body']['id']){delete _0x49953f['body']['id'];}return db[_0xa0ab('0x3b')][_0xa0ab('0x55')]({'where':{'id':_0x49953f['params']['id']}})[_0xa0ab('0x20')](handleEntityNotFound(_0x482176,null))[_0xa0ab('0x20')](saveUpdates(_0x49953f[_0xa0ab('0x57')],null))[_0xa0ab('0x20')](respondWithResult(_0x482176,null))[_0xa0ab('0x2a')](handleError(_0x482176,null));};exports[_0xa0ab('0x37')]=function(_0x2c8451,_0xfe3143){return db[_0xa0ab('0x3b')][_0xa0ab('0x55')]({'where':{'id':_0x2c8451['params']['id']}})[_0xa0ab('0x20')](handleEntityNotFound(_0xfe3143,null))['then'](removeEntity(_0xfe3143,null))[_0xa0ab('0x2a')](handleError(_0xfe3143,null));};exports['describe']=function(_0xe3fc8,_0x57a28d){return db[_0xa0ab('0x3b')][_0xa0ab('0x58')]()[_0xa0ab('0x20')](respondWithResult(_0x57a28d,null))[_0xa0ab('0x2a')](handleError(_0x57a28d,null));};var interaction_log=require(_0xa0ab('0x14'))(_0xa0ab('0x59'));exports[_0xa0ab('0x5a')]=function(_0x5c942d,_0xc9def4,_0x36efb9){var _0x140dbb={'channel':_0xa0ab('0x5b')};if(_0x5c942d[_0xa0ab('0x57')]['id']){delete _0x5c942d['body']['id'];}_0x5c942d[_0xa0ab('0x57')]['read']=!![];_0x5c942d[_0xa0ab('0x57')][_0xa0ab('0x5c')]=moment()['format'](_0xa0ab('0x5d'));_0x5c942d['body'][_0xa0ab('0x5e')]=_0x5c942d['body'][_0xa0ab('0x5e')]||_0x5c942d['user']['id'];return db['ChatMessage'][_0xa0ab('0x55')]({'where':{'id':_0x5c942d[_0xa0ab('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xa0ab('0x5f')],'as':_0xa0ab('0x60')}]})[_0xa0ab('0x20')](handleEntityNotFound(_0xc9def4,null))[_0xa0ab('0x20')](saveUpdates(_0x5c942d['body'],null))[_0xa0ab('0x20')](function(_0x83e618){if(_0x83e618){_0x140dbb['message']=_0x83e618[_0xa0ab('0x61')]({'plain':!![]});return db[_0xa0ab('0x62')][_0xa0ab('0x55')]({'where':{'id':_0x83e618[_0xa0ab('0x63')]}});}return null;})[_0xa0ab('0x20')](handleEntityNotFound(_0xc9def4,null))[_0xa0ab('0x20')](function(_0x432914){if(_0x432914){return _0x432914[_0xa0ab('0x36')]({'UserId':_0x5c942d[_0xa0ab('0x57')][_0xa0ab('0x5e')],'read1stAt':_[_0xa0ab('0x64')](_0x432914['read1stAt'])?moment()[_0xa0ab('0x65')](_0xa0ab('0x5d')):undefined});}return null;})[_0xa0ab('0x20')](function(_0x11967b){if(_0x11967b){_0x140dbb[_0xa0ab('0x66')]=_0x11967b[_0xa0ab('0x61')]({'plain':!![]});interaction_log[_0xa0ab('0x21')](_0xa0ab('0x67'),_0x5c942d[_0xa0ab('0x68')]['id'],_0x5c942d[_0xa0ab('0x68')][_0xa0ab('0x38')],_0x5c942d['user']['role'],_0x140dbb['interaction']['id'],_0x5c942d[_0xa0ab('0x57')]?JSON[_0xa0ab('0x25')](_0x5c942d[_0xa0ab('0x57')]):_0xa0ab('0x69'));return respondWithRpcPromise('AcceptMessage',_0xa0ab('0x6a'),_0x140dbb);}return null;})[_0xa0ab('0x20')](function(_0x4c976d){if(_0x4c976d){if(_0x5c942d['body']['manual']){_0x140dbb[_0xa0ab('0x28')][_0xa0ab('0x6b')]=util[_0xa0ab('0x65')]('SIP/%s',_0x5c942d[_0xa0ab('0x68')][_0xa0ab('0x38')]);_0x140dbb[_0xa0ab('0x28')]['channel']=_0x140dbb[_0xa0ab('0x6c')];_0x140dbb[_0xa0ab('0x28')][_0xa0ab('0x6d')]=_0xa0ab('0x5a');return respondWithRpcPromise(_0xa0ab('0x6e'),_0xa0ab('0x6e'),{'event':'acceptmessage','message':_[_0xa0ab('0x4b')](_0x140dbb[_0xa0ab('0x28')],JSON['parse'](_0x140dbb['interaction'][_0xa0ab('0x6f')]))},client9002)[_0xa0ab('0x20')](function(){return _0x140dbb;});}return _0x140dbb;}return null;})[_0xa0ab('0x20')](respondWithResult(_0xc9def4,null))['catch'](handleError(_0xc9def4,null));};var interaction_log=require(_0xa0ab('0x14'))(_0xa0ab('0x59'));exports[_0xa0ab('0x34')]=function(_0x4c5dbb,_0x410bda,_0x1a338f){var _0x20efb3={'agent':{},'channel':_0xa0ab('0x5b')};if(_0x4c5dbb[_0xa0ab('0x57')]['id']){delete _0x4c5dbb[_0xa0ab('0x57')]['id'];}_0x4c5dbb[_0xa0ab('0x57')][_0xa0ab('0x5e')]=_0x4c5dbb[_0xa0ab('0x57')][_0xa0ab('0x5e')]||_0x4c5dbb[_0xa0ab('0x68')]['id'];_0x20efb3[_0xa0ab('0x70')]['id']=_0x4c5dbb[_0xa0ab('0x57')][_0xa0ab('0x5e')];return db[_0xa0ab('0x3b')][_0xa0ab('0x55')]({'where':{'id':_0x4c5dbb[_0xa0ab('0x52')]['id'],'UserId':null}})[_0xa0ab('0x20')](handleEntityNotFound(_0x410bda,null))[_0xa0ab('0x20')](function(_0x259c5c){if(_0x259c5c){_0x20efb3['message']=_0x259c5c[_0xa0ab('0x61')]({'plain':!![]});return db[_0xa0ab('0x62')]['find']({'where':{'id':_0x259c5c[_0xa0ab('0x63')]}});}return null;})[_0xa0ab('0x20')](handleEntityNotFound(_0x410bda,null))[_0xa0ab('0x20')](function(_0x377e67){if(_0x377e67){_0x20efb3[_0xa0ab('0x66')]=_0x377e67[_0xa0ab('0x61')]({'plain':!![]});interaction_log['info'](_0xa0ab('0x71'),_0x4c5dbb[_0xa0ab('0x68')]['id'],_0x4c5dbb[_0xa0ab('0x68')][_0xa0ab('0x38')],_0x4c5dbb[_0xa0ab('0x68')][_0xa0ab('0x72')],_0x20efb3['interaction']['id'],_0x4c5dbb[_0xa0ab('0x57')]?JSON[_0xa0ab('0x25')](_0x4c5dbb[_0xa0ab('0x57')]):_0xa0ab('0x69'));return respondWithRpcPromise('RejectMessage',_0xa0ab('0x73'),_0x20efb3);}return null;})['then'](function(_0x3067e9){if(_0x3067e9){_0x3067e9[_0xa0ab('0x28')][_0xa0ab('0x6b')]=util[_0xa0ab('0x65')](_0xa0ab('0x74'),_0x4c5dbb[_0xa0ab('0x68')][_0xa0ab('0x38')]);_0x3067e9['message'][_0xa0ab('0x6c')]=_0x20efb3[_0xa0ab('0x6c')];_0x3067e9[_0xa0ab('0x28')][_0xa0ab('0x6d')]=_0xa0ab('0x34');respondWithRpcPromise(_0xa0ab('0x6e'),'EventManager',{'event':_0xa0ab('0x75'),'message':_0x3067e9[_0xa0ab('0x28')]},client9002);return _0x20efb3;}return null;})[_0xa0ab('0x20')](respondWithResult(_0x410bda,null))[_0xa0ab('0x2a')](handleError(_0x410bda,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 636eb3c..04c3197 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 _0x485b=['save','emit','hook','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x24682f,_0x30b2d0){var _0x413f07=function(_0x5d6707){while(--_0x5d6707){_0x24682f['push'](_0x24682f['shift']());}};_0x413f07(++_0x30b2d0);}(_0x485b,0xf1));var _0xb485=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x485b[_0x12d033];return _0x3b4e80;};'use strict';var EventEmitter=require(_0xb485('0x0'));var ChatMessage=require(_0xb485('0x1'))['db'][_0xb485('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb485('0x3')](0x0);var events={'afterCreate':_0xb485('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x35e270){return function(_0x38e607,_0x66cc30,_0xc06621){ChatMessageEvents['emit'](_0x35e270+':'+_0x38e607['id'],_0x38e607);ChatMessageEvents[_0xb485('0x5')](_0x35e270,_0x38e607);_0xc06621(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xb485('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x40c7=['hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit'];(function(_0x193d56,_0xcb8670){var _0x22c794=function(_0x5ce5d3){while(--_0x5ce5d3){_0x193d56['push'](_0x193d56['shift']());}};_0x22c794(++_0xcb8670);}(_0x40c7,0x1a9));var _0x740c=function(_0x296923,_0x4adaed){_0x296923=_0x296923-0x0;var _0x29af70=_0x40c7[_0x296923];return _0x29af70;};'use strict';var EventEmitter=require(_0x740c('0x0'));var ChatMessage=require(_0x740c('0x1'))['db'][_0x740c('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x740c('0x3')](0x0);var events={'afterCreate':_0x740c('0x4'),'afterUpdate':_0x740c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4a1a40){return function(_0x5cedbf,_0x3feb2d,_0xfc0a9d){ChatMessageEvents['emit'](_0x4a1a40+':'+_0x5cedbf['id'],_0x5cedbf);ChatMessageEvents[_0x740c('0x6')](_0x4a1a40,_0x5cedbf);_0xfc0a9d(null);};}for(var e in events){if(events[_0x740c('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x740c('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index f205be1..1a670da 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 _0x9118=['UserId','ChatInteraction','ChatInteractionId','update','createdAt','catch','error','utf8mb4','util','api','moment','request-promise','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x1c0250,_0x340733){var _0x2e73b5=function(_0x555394){while(--_0x555394){_0x1c0250['push'](_0x1c0250['shift']());}};_0x2e73b5(++_0x340733);}(_0x9118,0x181));var _0x8911=function(_0x11c31b,_0xdf1880){_0x11c31b=_0x11c31b-0x0;var _0xd15e8f=_0x9118[_0x11c31b];return _0xd15e8f;};'use strict';var _=require('lodash');var util=require(_0x8911('0x0'));var logger=require('../../config/logger')(_0x8911('0x1'));var moment=require(_0x8911('0x2'));var BPromise=require('bluebird');var rp=require(_0x8911('0x3'));var fs=require('fs');var path=require(_0x8911('0x4'));var rimraf=require('rimraf');var config=require(_0x8911('0x5'));var attributes=require(_0x8911('0x6'));module[_0x8911('0x7')]=function(_0x2638b1,_0x46f982){return _0x2638b1[_0x8911('0x8')](_0x8911('0x9'),attributes,{'tableName':_0x8911('0xa'),'paranoid':![],'indexes':[{'name':_0x8911('0xb'),'fields':[_0x8911('0xc')],'type':_0x8911('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x403dd4,_0x28c04c,_0x491c3c){var _0x4fe645=_0x2638b1[_0x8911('0xe')];var _0x878e=_0x403dd4[_0x8911('0xf')]({'plain':!![]});if(_0x878e['direction']['toLowerCase']()==='in'||_0x878e[_0x8911('0x10')][_0x8911('0x11')]()===_0x8911('0x12')&&!_0x878e[_0x8911('0x13')]&&!_[_0x8911('0x14')](_0x878e[_0x8911('0x15')])){_0x4fe645[_0x8911('0x16')]['findOne']({'where':{'id':_0x878e[_0x8911('0x17')]}})['then'](function(_0x530f8f){if(_0x530f8f){_0x530f8f[_0x8911('0x18')]({'lastMsgAt':_0x878e[_0x8911('0x19')],'lastMsgDirection':_0x878e[_0x8911('0x10')]['toLowerCase']()});}})[_0x8911('0x1a')](function(_0x397d10){console[_0x8911('0x1b')](_0x397d10);});}_0x491c3c();}},'charset':_0x8911('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x26b1=['ChatMessage','chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','api','moment','path','./chatMessage.attributes','exports'];(function(_0x1140bf,_0x965cd5){var _0x2eeafa=function(_0x26def5){while(--_0x26def5){_0x1140bf['push'](_0x1140bf['shift']());}};_0x2eeafa(++_0x965cd5);}(_0x26b1,0x1b5));var _0x126b=function(_0x5036ab,_0xa0ebdd){_0x5036ab=_0x5036ab-0x0;var _0x425402=_0x26b1[_0x5036ab];return _0x425402;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x126b('0x0'));var moment=require(_0x126b('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x126b('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x126b('0x3'));module[_0x126b('0x4')]=function(_0x28a73f,_0x33e98b){return _0x28a73f['define'](_0x126b('0x5'),attributes,{'tableName':_0x126b('0x6'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x126b('0x7')],'type':_0x126b('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x362999,_0x2910a0,_0x4cddef){var _0x47a391=_0x28a73f[_0x126b('0x9')];var _0xd2aac5=_0x362999[_0x126b('0xa')]({'plain':!![]});if(_0xd2aac5['direction'][_0x126b('0xb')]()==='in'||_0xd2aac5[_0x126b('0xc')][_0x126b('0xb')]()===_0x126b('0xd')&&!_0xd2aac5[_0x126b('0xe')]&&!_[_0x126b('0xf')](_0xd2aac5[_0x126b('0x10')])){_0x47a391[_0x126b('0x11')][_0x126b('0x12')]({'where':{'id':_0xd2aac5[_0x126b('0x13')]}})[_0x126b('0x14')](function(_0x252e1b){if(_0x252e1b){_0x252e1b[_0x126b('0x15')]({'lastMsgAt':_0xd2aac5['createdAt'],'lastMsgDirection':_0xd2aac5[_0x126b('0xc')][_0x126b('0xb')]()});}})[_0x126b('0x16')](function(_0x4827b1){console[_0x126b('0x17')](_0x4827b1);});}_0x4cddef();}},'charset':_0x126b('0x18'),'collate':_0x126b('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 0280ad2..bc112a0 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 _0xe674=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xe674,0x7c));var _0x4e67=function(_0x201561,_0x2a8a9a){_0x201561=_0x201561-0x0;var _0x45ed5d=_0xe674[_0x201561];return _0x45ed5d;};'use strict';var _=require(_0x4e67('0x0'));var util=require(_0x4e67('0x1'));var moment=require(_0x4e67('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4e67('0x4'));var logger=require(_0x4e67('0x5'))(_0x4e67('0x6'));var config=require(_0x4e67('0x7'));var jayson=require(_0x4e67('0x8'));var client=jayson[_0x4e67('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4e67('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e67('0xb'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x4e67('0xc')](socket);function respondWithRpcPromise(_0x15c4b6,_0x588126,_0x517971){return new BPromise(function(_0x18d2e7,_0x178cd8){return client[_0x4e67('0xd')](_0x15c4b6,_0x517971)[_0x4e67('0xe')](function(_0x28b1ca){logger['info'](_0x4e67('0xf'),_0x588126,_0x4e67('0x10'));logger[_0x4e67('0x11')](_0x4e67('0x12'),_0x588126,_0x4e67('0x10'),JSON['stringify'](_0x28b1ca));if(_0x28b1ca[_0x4e67('0x13')]){if(_0x28b1ca[_0x4e67('0x13')][_0x4e67('0x14')]===0x1f4){logger['error'](_0x4e67('0xf'),_0x588126,_0x28b1ca[_0x4e67('0x13')][_0x4e67('0x15')]);return _0x178cd8(_0x28b1ca[_0x4e67('0x13')]['message']);}logger[_0x4e67('0x13')](_0x4e67('0xf'),_0x588126,_0x28b1ca[_0x4e67('0x13')][_0x4e67('0x15')]);return _0x18d2e7(_0x28b1ca[_0x4e67('0x13')][_0x4e67('0x15')]);}else{logger[_0x4e67('0x16')](_0x4e67('0xf'),_0x588126,'request\x20sent');_0x18d2e7(_0x28b1ca['result'][_0x4e67('0x15')]);}})[_0x4e67('0x17')](function(_0x164878){logger[_0x4e67('0x13')](_0x4e67('0xf'),_0x588126,_0x164878);_0x178cd8(_0x164878);});});}exports[_0x4e67('0x18')]=function(_0x2e3411){var _0x192911=this;return new Promise(function(_0x52406b,_0x2e819f){return db[_0x4e67('0x19')][_0x4e67('0x1a')](_0x2e3411[_0x4e67('0x1b')],{'raw':_0x2e3411[_0x4e67('0x1c')]?_0x2e3411[_0x4e67('0x1c')][_0x4e67('0x1d')]===undefined?!![]:![]:!![]})[_0x4e67('0xe')](function(_0x18e94a){logger[_0x4e67('0x16')](_0x4e67('0x18'),_0x2e3411);logger[_0x4e67('0x11')](_0x4e67('0x18'),_0x2e3411,JSON[_0x4e67('0x1e')](_0x18e94a));_0x52406b(_0x18e94a);})[_0x4e67('0x17')](function(_0x5009c8){logger[_0x4e67('0x13')](_0x4e67('0x18'),_0x5009c8['message'],_0x2e3411);_0x2e819f(_0x192911[_0x4e67('0x13')](0x1f4,_0x5009c8[_0x4e67('0x15')]));});});}; \ No newline at end of file +var _0xee07=['request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','options','raw','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','localhost','socket.io-emitter','redis','register'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xee07,0x6e));var _0x7ee0=function(_0x47c1e9,_0x5026c9){_0x47c1e9=_0x47c1e9-0x0;var _0x2227c0=_0xee07[_0x47c1e9];return _0x2227c0;};'use strict';var _=require('lodash');var util=require(_0x7ee0('0x0'));var moment=require(_0x7ee0('0x1'));var BPromise=require(_0x7ee0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ee0('0x3'));var db=require(_0x7ee0('0x4'))['db'];var utils=require(_0x7ee0('0x5'));var logger=require('../../config/logger')(_0x7ee0('0x6'));var config=require(_0x7ee0('0x7'));var jayson=require(_0x7ee0('0x8'));var client=jayson['client'][_0x7ee0('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x7ee0('0xa'),'port':0x18eb});var socket=require(_0x7ee0('0xb'))(new Redis(config[_0x7ee0('0xc')]));require('./chatMessage.socket')[_0x7ee0('0xd')](socket);function respondWithRpcPromise(_0x589fdb,_0x557f6f,_0x1d3a85){return new BPromise(function(_0x441a40,_0xd8bba9){return client[_0x7ee0('0xe')](_0x589fdb,_0x1d3a85)['then'](function(_0x421b9b){logger[_0x7ee0('0xf')](_0x7ee0('0x10'),_0x557f6f,_0x7ee0('0x11'));logger[_0x7ee0('0x12')](_0x7ee0('0x13'),_0x557f6f,_0x7ee0('0x11'),JSON[_0x7ee0('0x14')](_0x421b9b));if(_0x421b9b[_0x7ee0('0x15')]){if(_0x421b9b[_0x7ee0('0x15')][_0x7ee0('0x16')]===0x1f4){logger[_0x7ee0('0x15')](_0x7ee0('0x10'),_0x557f6f,_0x421b9b[_0x7ee0('0x15')]['message']);return _0xd8bba9(_0x421b9b[_0x7ee0('0x15')][_0x7ee0('0x17')]);}logger[_0x7ee0('0x15')]('ChatMessage,\x20%s,\x20%s',_0x557f6f,_0x421b9b[_0x7ee0('0x15')][_0x7ee0('0x17')]);return _0x441a40(_0x421b9b[_0x7ee0('0x15')][_0x7ee0('0x17')]);}else{logger[_0x7ee0('0xf')](_0x7ee0('0x10'),_0x557f6f,_0x7ee0('0x11'));_0x441a40(_0x421b9b['result']['message']);}})[_0x7ee0('0x18')](function(_0x35d9a2){logger[_0x7ee0('0x15')](_0x7ee0('0x10'),_0x557f6f,_0x35d9a2);_0xd8bba9(_0x35d9a2);});});}exports[_0x7ee0('0x19')]=function(_0x473b9a){var _0x157f5d=this;return new Promise(function(_0x42aea0,_0x1eb6a7){return db[_0x7ee0('0x1a')][_0x7ee0('0x1b')](_0x473b9a['body'],{'raw':_0x473b9a[_0x7ee0('0x1c')]?_0x473b9a[_0x7ee0('0x1c')][_0x7ee0('0x1d')]===undefined?!![]:![]:!![]})[_0x7ee0('0x1e')](function(_0x36d70d){logger['info']('CreateChatMessage',_0x473b9a);logger['debug'](_0x7ee0('0x19'),_0x473b9a,JSON[_0x7ee0('0x14')](_0x36d70d));_0x42aea0(_0x36d70d);})[_0x7ee0('0x18')](function(_0x457fe7){logger[_0x7ee0('0x15')]('CreateChatMessage',_0x457fe7[_0x7ee0('0x17')],_0x473b9a);_0x1eb6a7(_0x157f5d[_0x7ee0('0x15')](0x1f4,_0x457fe7['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 966f25a..36b9c29 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 _0xeda8=['chatMessage:','./chatMessage.events','save','update','emit','removeListener','register'];(function(_0x26299e,_0x394ad1){var _0x6c4f4a=function(_0x539ae9){while(--_0x539ae9){_0x26299e['push'](_0x26299e['shift']());}};_0x6c4f4a(++_0x394ad1);}(_0xeda8,0x104));var _0x8eda=function(_0x13f5ab,_0xb755ac){_0x13f5ab=_0x13f5ab-0x0;var _0x555003=_0xeda8[_0x13f5ab];return _0x555003;};'use strict';var ChatMessageEvents=require(_0x8eda('0x0'));var events=[_0x8eda('0x1'),'remove',_0x8eda('0x2')];function createListener(_0xd8b5d5,_0x2090a2){return function(_0xc01211){_0x2090a2[_0x8eda('0x3')](_0xd8b5d5,_0xc01211);};}function removeListener(_0x94b83f,_0x25b19a){return function(){ChatMessageEvents[_0x8eda('0x4')](_0x94b83f,_0x25b19a);};}exports[_0x8eda('0x5')]=function(_0x1f3556){for(var _0x349361=0x0,_0x32abe8=events['length'];_0x349361<_0x32abe8;_0x349361++){var _0x28b721=events[_0x349361];var _0x1b6a1d=createListener(_0x8eda('0x6')+_0x28b721,_0x1f3556);ChatMessageEvents['on'](_0x28b721,_0x1b6a1d);}}; \ No newline at end of file +var _0x9582=['update','emit','removeListener','register','length','./chatMessage.events','save','remove'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9582,0x95));var _0x2958=function(_0x2a053b,_0x3ad634){_0x2a053b=_0x2a053b-0x0;var _0x5968f4=_0x9582[_0x2a053b];return _0x5968f4;};'use strict';var ChatMessageEvents=require(_0x2958('0x0'));var events=[_0x2958('0x1'),_0x2958('0x2'),_0x2958('0x3')];function createListener(_0x42752c,_0x176287){return function(_0x559a01){_0x176287[_0x2958('0x4')](_0x42752c,_0x559a01);};}function removeListener(_0x3b907e,_0x136c77){return function(){ChatMessageEvents[_0x2958('0x5')](_0x3b907e,_0x136c77);};}exports[_0x2958('0x6')]=function(_0xbde128){for(var _0x88ffaa=0x0,_0x309525=events[_0x2958('0x7')];_0x88ffaa<_0x309525;_0x88ffaa++){var _0x2e571b=events[_0x88ffaa];var _0x56ca85=createListener('chatMessage:'+_0x2e571b,_0xbde128);ChatMessageEvents['on'](_0x2e571b,_0x56ca85);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 12545c7..d4351b4 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 _0x089e=['create','/:id/accept','accept','put','/:id/reject','reject','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','chat','chatmessage:create'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x089e,0x96));var _0xe089=function(_0x394142,_0x435819){_0x394142=_0x394142-0x0;var _0x1b04e0=_0x089e[_0x394142];return _0x1b04e0;};'use strict';var multer=require(_0xe089('0x0'));var util=require('util');var path=require(_0xe089('0x1'));var timeout=require('connect-timeout');var express=require(_0xe089('0x2'));var router=express[_0xe089('0x3')]();var auth=require(_0xe089('0x4'));var interaction=require(_0xe089('0x5'));var config=require(_0xe089('0x6'));var controller=require(_0xe089('0x7'));router[_0xe089('0x8')]('/',auth[_0xe089('0x9')](),controller[_0xe089('0xa')]);router['get'](_0xe089('0xb'),auth['isAuthenticated'](),controller[_0xe089('0xc')]);router[_0xe089('0x8')](_0xe089('0xd'),auth['isAuthenticated'](),controller[_0xe089('0xe')]);router[_0xe089('0xf')]('/',auth[_0xe089('0x9')](),interaction['tracked'](_0xe089('0x10'),_0xe089('0x11')),controller[_0xe089('0x12')]);router['put'](_0xe089('0xd'),controller['update']);router['put'](_0xe089('0x13'),auth[_0xe089('0x9')](),controller[_0xe089('0x14')]);router[_0xe089('0x15')](_0xe089('0x16'),auth[_0xe089('0x9')](),controller[_0xe089('0x17')]);router['delete'](_0xe089('0xd'),auth[_0xe089('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5d46=['update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','isAuthenticated','describe','/:id','show','tracked','chat','chatmessage:create','create','put'];(function(_0x2603b1,_0x3d9a8b){var _0x31d5d8=function(_0xf6df1c){while(--_0xf6df1c){_0x2603b1['push'](_0x2603b1['shift']());}};_0x31d5d8(++_0x3d9a8b);}(_0x5d46,0x13b));var _0x65d4=function(_0x161fc0,_0x7ebb3){_0x161fc0=_0x161fc0-0x0;var _0x49214d=_0x5d46[_0x161fc0];return _0x49214d;};'use strict';var multer=require(_0x65d4('0x0'));var util=require(_0x65d4('0x1'));var path=require(_0x65d4('0x2'));var timeout=require(_0x65d4('0x3'));var express=require(_0x65d4('0x4'));var router=express[_0x65d4('0x5')]();var auth=require(_0x65d4('0x6'));var interaction=require(_0x65d4('0x7'));var config=require(_0x65d4('0x8'));var controller=require(_0x65d4('0x9'));router[_0x65d4('0xa')]('/',auth['isAuthenticated'](),controller[_0x65d4('0xb')]);router[_0x65d4('0xa')]('/describe',auth[_0x65d4('0xc')](),controller[_0x65d4('0xd')]);router[_0x65d4('0xa')](_0x65d4('0xe'),auth['isAuthenticated'](),controller[_0x65d4('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x65d4('0x10')](_0x65d4('0x11'),_0x65d4('0x12')),controller[_0x65d4('0x13')]);router[_0x65d4('0x14')]('/:id',controller[_0x65d4('0x15')]);router['put'](_0x65d4('0x16'),auth[_0x65d4('0xc')](),controller[_0x65d4('0x17')]);router['put'](_0x65d4('0x18'),auth['isAuthenticated'](),controller[_0x65d4('0x19')]);router[_0x65d4('0x1a')](_0x65d4('0xe'),auth[_0x65d4('0xc')](),controller[_0x65d4('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 0b6e88c..9458559 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 _0x0203=['exports','TEXT','medium','sequelize'];(function(_0x2b0f37,_0x461185){var _0x1d1ccc=function(_0x50e4b7){while(--_0x50e4b7){_0x2b0f37['push'](_0x2b0f37['shift']());}};_0x1d1ccc(++_0x461185);}(_0x0203,0x1af));var _0x3020=function(_0x20f611,_0x8ed86f){_0x20f611=_0x20f611-0x0;var _0x559a83=_0x0203[_0x20f611];return _0x559a83;};'use strict';var Sequelize=require(_0x3020('0x0'));module[_0x3020('0x1')]={'body':{'type':Sequelize[_0x3020('0x2')](_0x3020('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xb9d2=['sequelize','exports','TEXT','medium'];(function(_0x28aa02,_0x2d3d80){var _0x43c6e9=function(_0xa58bbf){while(--_0xa58bbf){_0x28aa02['push'](_0x28aa02['shift']());}};_0x43c6e9(++_0x2d3d80);}(_0xb9d2,0x1ac));var _0x2b9d=function(_0x51b7c5,_0x218969){_0x51b7c5=_0x51b7c5-0x0;var _0x3355d7=_0xb9d2[_0x51b7c5];return _0x3355d7;};'use strict';var Sequelize=require(_0x2b9d('0x0'));module[_0x2b9d('0x1')]={'body':{'type':Sequelize[_0x2b9d('0x2')](_0x2b9d('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 53e08e2..829a1a2 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 _0xdc97=['map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','filters','find','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','name'];(function(_0x2cf0f9,_0x4dcc70){var _0x4e6ca3=function(_0x20ca04){while(--_0x20ca04){_0x2cf0f9['push'](_0x2cf0f9['shift']());}};_0x4e6ca3(++_0x4dcc70);}(_0xdc97,0x13b));var _0x7dc9=function(_0x40d075,_0x5394b0){_0x40d075=_0x40d075-0x0;var _0x4e2743=_0xdc97[_0x40d075];return _0x4e2743;};'use strict';var pdf=require(_0x7dc9('0x0'));var emlformat=require(_0x7dc9('0x1'));var rimraf=require(_0x7dc9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7dc9('0x3'));var rp=require('request-promise');var moment=require(_0x7dc9('0x4'));var BPromise=require(_0x7dc9('0x5'));var Mustache=require('mustache');var util=require(_0x7dc9('0x6'));var path=require(_0x7dc9('0x7'));var sox=require(_0x7dc9('0x8'));var csv=require(_0x7dc9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x9'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4be1c8,_0x599ef1){_0x599ef1=_0x599ef1||0xcc;return function(_0x94c75a){if(_0x94c75a){return _0x4be1c8[_0x7dc9('0x16')](_0x599ef1);}return _0x4be1c8['status'](_0x599ef1)[_0x7dc9('0x17')]();};}function respondWithResult(_0x2f3acd,_0xaadf2){_0xaadf2=_0xaadf2||0xc8;return function(_0xf37bc7){if(_0xf37bc7){return _0x2f3acd[_0x7dc9('0x18')](_0xaadf2)[_0x7dc9('0x19')](_0xf37bc7);}};}function respondWithFilteredResult(_0x524d09,_0x3a54f2){return function(_0x278191){if(_0x278191){var _0x1b0aa1=_0x278191[_0x7dc9('0x1a')],_0x442819=_0x3a54f2[_0x7dc9('0x1b')],_0x11606f=_0x3a54f2[_0x7dc9('0x1b')]+_0x3a54f2['limit'],_0xbe0437;if(_0x11606f>=_0x1b0aa1){_0x11606f=_0x1b0aa1;_0xbe0437=0xc8;}else{_0xbe0437=0xce;}_0x524d09[_0x7dc9('0x18')](_0xbe0437);return _0x524d09['set'](_0x7dc9('0x1c'),_0x442819+'-'+_0x11606f+'/'+_0x1b0aa1)[_0x7dc9('0x19')](_0x278191);}return null;};}function patchUpdates(_0x5d61d7){return function(_0x41f66e){try{jsonpatch[_0x7dc9('0x1d')](_0x41f66e,_0x5d61d7,!![]);}catch(_0x12f08d){return BPromise[_0x7dc9('0x1e')](_0x12f08d);}return _0x41f66e[_0x7dc9('0x1f')]();};}function saveUpdates(_0x184bfd,_0x2dad65){return function(_0x2895f5){if(_0x2895f5){return _0x2895f5[_0x7dc9('0x20')](_0x184bfd)[_0x7dc9('0x21')](function(_0x576681){return _0x576681;});}return null;};}function removeEntity(_0x593e60,_0x12954f){return function(_0x5981e2){if(_0x5981e2){return _0x5981e2['destroy']()[_0x7dc9('0x21')](function(){_0x593e60[_0x7dc9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xffc080,_0x43d31f){return function(_0x41110a){if(!_0x41110a){_0xffc080['sendStatus'](0x194);}return _0x41110a;};}function handleError(_0x424763,_0x1e3a8d){_0x1e3a8d=_0x1e3a8d||0x1f4;return function(_0xf95336){logger['error'](_0xf95336['stack']);if(_0xf95336['name']){delete _0xf95336[_0x7dc9('0x22')];}_0x424763[_0x7dc9('0x18')](_0x1e3a8d)['send'](_0xf95336);};}exports['index']=function(_0x47771b,_0x5afb7d){var _0x2d22eb={},_0x1c690b={},_0x3a74a0={'count':0x0,'rows':[]};var _0x3e4102=_[_0x7dc9('0x23')](db[_0x7dc9('0x24')][_0x7dc9('0x25')],function(_0x229f8e){return{'name':_0x229f8e[_0x7dc9('0x26')],'type':_0x229f8e[_0x7dc9('0x27')][_0x7dc9('0x28')]};});_0x1c690b[_0x7dc9('0x29')]=_['map'](_0x3e4102,'name');_0x1c690b['query']=_['keys'](_0x47771b['query']);_0x1c690b['filters']=_['intersection'](_0x1c690b['model'],_0x1c690b[_0x7dc9('0x2a')]);_0x2d22eb[_0x7dc9('0x2b')]=_[_0x7dc9('0x2c')](_0x1c690b[_0x7dc9('0x29')],qs[_0x7dc9('0x2d')](_0x47771b[_0x7dc9('0x2a')]['fields']));_0x2d22eb['attributes']=_0x2d22eb['attributes'][_0x7dc9('0x2e')]?_0x2d22eb['attributes']:_0x1c690b[_0x7dc9('0x29')];if(!_0x47771b[_0x7dc9('0x2a')][_0x7dc9('0x2f')](_0x7dc9('0x30'))){_0x2d22eb[_0x7dc9('0x31')]=qs[_0x7dc9('0x31')](_0x47771b[_0x7dc9('0x2a')][_0x7dc9('0x31')]);_0x2d22eb['offset']=qs[_0x7dc9('0x1b')](_0x47771b['query'][_0x7dc9('0x1b')]);}_0x2d22eb[_0x7dc9('0x32')]=qs[_0x7dc9('0x33')](_0x47771b[_0x7dc9('0x2a')]['sort']);_0x2d22eb[_0x7dc9('0x34')]=qs['filters'](_[_0x7dc9('0x35')](_0x47771b['query'],_0x1c690b['filters']),_0x3e4102);if(_0x47771b[_0x7dc9('0x2a')][_0x7dc9('0x36')]){_0x2d22eb[_0x7dc9('0x34')]=_[_0x7dc9('0x37')](_0x2d22eb['where'],{'$or':_[_0x7dc9('0x23')](_0x3e4102,function(_0x183d87){if(_0x183d87[_0x7dc9('0x27')]!==_0x7dc9('0x38')){var _0x4290b9={};_0x4290b9[_0x183d87[_0x7dc9('0x22')]]={'$like':'%'+_0x47771b[_0x7dc9('0x2a')][_0x7dc9('0x36')]+'%'};return _0x4290b9;}})});}_0x2d22eb=_[_0x7dc9('0x37')]({},_0x2d22eb,_0x47771b[_0x7dc9('0x39')]);var _0x452aed={'where':_0x2d22eb[_0x7dc9('0x34')]};return db['ChatOfflineMessage'][_0x7dc9('0x1a')](_0x452aed)[_0x7dc9('0x21')](function(_0x466b02){_0x3a74a0[_0x7dc9('0x1a')]=_0x466b02;if(_0x47771b['query'][_0x7dc9('0x3a')]){_0x2d22eb[_0x7dc9('0x3b')]=[{'all':!![]}];}return db[_0x7dc9('0x24')][_0x7dc9('0x3c')](_0x2d22eb);})[_0x7dc9('0x21')](function(_0x3436a6){_0x3a74a0['rows']=_0x3436a6;return _0x3a74a0;})['then'](respondWithFilteredResult(_0x5afb7d,_0x2d22eb))[_0x7dc9('0x3d')](handleError(_0x5afb7d,null));};exports[_0x7dc9('0x3e')]=function(_0x495100,_0x3a705c){var _0x4a37ec={'raw':!![],'where':{'id':_0x495100[_0x7dc9('0x3f')]['id']}},_0x315d65={};_0x315d65[_0x7dc9('0x29')]=_['keys'](db[_0x7dc9('0x24')][_0x7dc9('0x25')]);_0x315d65[_0x7dc9('0x2a')]=_[_0x7dc9('0x40')](_0x495100[_0x7dc9('0x2a')]);_0x315d65[_0x7dc9('0x41')]=_[_0x7dc9('0x2c')](_0x315d65['model'],_0x315d65[_0x7dc9('0x2a')]);_0x4a37ec['attributes']=_['intersection'](_0x315d65[_0x7dc9('0x29')],qs[_0x7dc9('0x2d')](_0x495100[_0x7dc9('0x2a')][_0x7dc9('0x2d')]));_0x4a37ec[_0x7dc9('0x2b')]=_0x4a37ec[_0x7dc9('0x2b')][_0x7dc9('0x2e')]?_0x4a37ec[_0x7dc9('0x2b')]:_0x315d65[_0x7dc9('0x29')];if(_0x495100['query'][_0x7dc9('0x3a')]){_0x4a37ec[_0x7dc9('0x3b')]=[{'all':!![]}];}_0x4a37ec=_[_0x7dc9('0x37')]({},_0x4a37ec,_0x495100[_0x7dc9('0x39')]);return db[_0x7dc9('0x24')][_0x7dc9('0x42')](_0x4a37ec)['then'](handleEntityNotFound(_0x3a705c,null))[_0x7dc9('0x21')](respondWithResult(_0x3a705c,null))[_0x7dc9('0x3d')](handleError(_0x3a705c,null));};exports['create']=function(_0x288c80,_0x1f7700){return db[_0x7dc9('0x24')]['create'](_0x288c80[_0x7dc9('0x43')],{})['then'](respondWithResult(_0x1f7700,0xc9))['catch'](handleError(_0x1f7700,null));};exports[_0x7dc9('0x20')]=function(_0x30a315,_0x36d591){if(_0x30a315['body']['id']){delete _0x30a315['body']['id'];}return db[_0x7dc9('0x24')]['find']({'where':{'id':_0x30a315[_0x7dc9('0x3f')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x36d591,null))['then'](saveUpdates(_0x30a315[_0x7dc9('0x43')],null))[_0x7dc9('0x21')](respondWithResult(_0x36d591,null))[_0x7dc9('0x3d')](handleError(_0x36d591,null));};exports[_0x7dc9('0x44')]=function(_0x414bf4,_0x113087){return db[_0x7dc9('0x24')][_0x7dc9('0x42')]({'where':{'id':_0x414bf4[_0x7dc9('0x3f')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x113087,null))[_0x7dc9('0x21')](removeEntity(_0x113087,null))[_0x7dc9('0x3d')](handleError(_0x113087,null));};exports[_0x7dc9('0x45')]=function(_0x59be9b,_0x3132b1){return db['ChatOfflineMessage']['describe']()[_0x7dc9('0x21')](respondWithResult(_0x3132b1,null))[_0x7dc9('0x3d')](handleError(_0x3132b1,null));}; \ No newline at end of file +var _0xcd59=['show','params','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch'];(function(_0x2f0273,_0x4e8e1d){var _0x3bd665=function(_0x3aa89c){while(--_0x3aa89c){_0x2f0273['push'](_0x2f0273['shift']());}};_0x3bd665(++_0x4e8e1d);}(_0xcd59,0x14b));var _0x9cd5=function(_0x153c6c,_0x5aa22f){_0x153c6c=_0x153c6c-0x0;var _0x3c85d3=_0xcd59[_0x153c6c];return _0x3c85d3;};'use strict';var pdf=require(_0x9cd5('0x0'));var emlformat=require(_0x9cd5('0x1'));var rimraf=require(_0x9cd5('0x2'));var zipdir=require(_0x9cd5('0x3'));var jsonpatch=require(_0x9cd5('0x4'));var rp=require(_0x9cd5('0x5'));var moment=require('moment');var BPromise=require(_0x9cd5('0x6'));var Mustache=require(_0x9cd5('0x7'));var util=require(_0x9cd5('0x8'));var path=require(_0x9cd5('0x9'));var sox=require(_0x9cd5('0xa'));var csv=require(_0x9cd5('0xb'));var ejs=require(_0x9cd5('0xc'));var fs=require('fs');var _=require(_0x9cd5('0xd'));var squel=require(_0x9cd5('0xe'));var crypto=require(_0x9cd5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9cd5('0x10'));var toCsv=require(_0x9cd5('0xb'));var querystring=require(_0x9cd5('0x11'));var Papa=require(_0x9cd5('0x12'));var Redis=require(_0x9cd5('0x13'));var authService=require(_0x9cd5('0x14'));var qs=require(_0x9cd5('0x15'));var as=require(_0x9cd5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd5('0x17'))(_0x9cd5('0x18'));var utils=require(_0x9cd5('0x19'));var config=require(_0x9cd5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d6de,_0x2c9cf1){_0x2c9cf1=_0x2c9cf1||0xcc;return function(_0x172e29){if(_0x172e29){return _0x58d6de[_0x9cd5('0x1b')](_0x2c9cf1);}return _0x58d6de[_0x9cd5('0x1c')](_0x2c9cf1)[_0x9cd5('0x1d')]();};}function respondWithResult(_0x2a1606,_0x52698b){_0x52698b=_0x52698b||0xc8;return function(_0x15b639){if(_0x15b639){return _0x2a1606[_0x9cd5('0x1c')](_0x52698b)[_0x9cd5('0x1e')](_0x15b639);}};}function respondWithFilteredResult(_0x4b9ac8,_0x541cb8){return function(_0x5c4f3d){if(_0x5c4f3d){var _0x258305=_0x5c4f3d[_0x9cd5('0x1f')],_0x1ea3f7=_0x541cb8[_0x9cd5('0x20')],_0x565db7=_0x541cb8['offset']+_0x541cb8[_0x9cd5('0x21')],_0x24c233;if(_0x565db7>=_0x258305){_0x565db7=_0x258305;_0x24c233=0xc8;}else{_0x24c233=0xce;}_0x4b9ac8[_0x9cd5('0x1c')](_0x24c233);return _0x4b9ac8[_0x9cd5('0x22')](_0x9cd5('0x23'),_0x1ea3f7+'-'+_0x565db7+'/'+_0x258305)[_0x9cd5('0x1e')](_0x5c4f3d);}return null;};}function patchUpdates(_0x1ff788){return function(_0x5c1622){try{jsonpatch[_0x9cd5('0x24')](_0x5c1622,_0x1ff788,!![]);}catch(_0x18346f){return BPromise[_0x9cd5('0x25')](_0x18346f);}return _0x5c1622[_0x9cd5('0x26')]();};}function saveUpdates(_0x2e2b47,_0x4ed8b9){return function(_0x16c4e9){if(_0x16c4e9){return _0x16c4e9[_0x9cd5('0x27')](_0x2e2b47)[_0x9cd5('0x28')](function(_0x12e402){return _0x12e402;});}return null;};}function removeEntity(_0x2ce1ae,_0x1185d7){return function(_0x1cf603){if(_0x1cf603){return _0x1cf603[_0x9cd5('0x29')]()[_0x9cd5('0x28')](function(){_0x2ce1ae['status'](0xcc)[_0x9cd5('0x1d')]();});}};}function handleEntityNotFound(_0xba8ee9,_0x1a88e3){return function(_0x43f47d){if(!_0x43f47d){_0xba8ee9['sendStatus'](0x194);}return _0x43f47d;};}function handleError(_0x24ae67,_0x990c25){_0x990c25=_0x990c25||0x1f4;return function(_0x211576){logger[_0x9cd5('0x2a')](_0x211576[_0x9cd5('0x2b')]);if(_0x211576[_0x9cd5('0x2c')]){delete _0x211576[_0x9cd5('0x2c')];}_0x24ae67['status'](_0x990c25)[_0x9cd5('0x2d')](_0x211576);};}exports[_0x9cd5('0x2e')]=function(_0x2f1e4b,_0x4af6c8){var _0x5c33e9={},_0x2e45a3={},_0x502257={'count':0x0,'rows':[]};var _0x52ef5d=_[_0x9cd5('0x2f')](db[_0x9cd5('0x30')][_0x9cd5('0x31')],function(_0x5184b9){return{'name':_0x5184b9[_0x9cd5('0x32')],'type':_0x5184b9[_0x9cd5('0x33')][_0x9cd5('0x34')]};});_0x2e45a3[_0x9cd5('0x35')]=_[_0x9cd5('0x2f')](_0x52ef5d,_0x9cd5('0x2c'));_0x2e45a3[_0x9cd5('0x36')]=_[_0x9cd5('0x37')](_0x2f1e4b[_0x9cd5('0x36')]);_0x2e45a3[_0x9cd5('0x38')]=_[_0x9cd5('0x39')](_0x2e45a3[_0x9cd5('0x35')],_0x2e45a3[_0x9cd5('0x36')]);_0x5c33e9[_0x9cd5('0x3a')]=_['intersection'](_0x2e45a3[_0x9cd5('0x35')],qs[_0x9cd5('0x3b')](_0x2f1e4b['query']['fields']));_0x5c33e9[_0x9cd5('0x3a')]=_0x5c33e9[_0x9cd5('0x3a')]['length']?_0x5c33e9[_0x9cd5('0x3a')]:_0x2e45a3['model'];if(!_0x2f1e4b['query'][_0x9cd5('0x3c')](_0x9cd5('0x3d'))){_0x5c33e9[_0x9cd5('0x21')]=qs[_0x9cd5('0x21')](_0x2f1e4b['query'][_0x9cd5('0x21')]);_0x5c33e9[_0x9cd5('0x20')]=qs[_0x9cd5('0x20')](_0x2f1e4b['query'][_0x9cd5('0x20')]);}_0x5c33e9[_0x9cd5('0x3e')]=qs[_0x9cd5('0x3f')](_0x2f1e4b[_0x9cd5('0x36')][_0x9cd5('0x3f')]);_0x5c33e9[_0x9cd5('0x40')]=qs[_0x9cd5('0x38')](_[_0x9cd5('0x41')](_0x2f1e4b[_0x9cd5('0x36')],_0x2e45a3[_0x9cd5('0x38')]),_0x52ef5d);if(_0x2f1e4b[_0x9cd5('0x36')]['filter']){_0x5c33e9[_0x9cd5('0x40')]=_['merge'](_0x5c33e9['where'],{'$or':_[_0x9cd5('0x2f')](_0x52ef5d,function(_0x3cf5e9){if(_0x3cf5e9[_0x9cd5('0x33')]!==_0x9cd5('0x42')){var _0x54bc49={};_0x54bc49[_0x3cf5e9[_0x9cd5('0x2c')]]={'$like':'%'+_0x2f1e4b[_0x9cd5('0x36')][_0x9cd5('0x43')]+'%'};return _0x54bc49;}})});}_0x5c33e9=_[_0x9cd5('0x44')]({},_0x5c33e9,_0x2f1e4b['options']);var _0x36e22c={'where':_0x5c33e9[_0x9cd5('0x40')]};return db[_0x9cd5('0x30')][_0x9cd5('0x1f')](_0x36e22c)[_0x9cd5('0x28')](function(_0x16e6b3){_0x502257['count']=_0x16e6b3;if(_0x2f1e4b[_0x9cd5('0x36')][_0x9cd5('0x45')]){_0x5c33e9[_0x9cd5('0x46')]=[{'all':!![]}];}return db[_0x9cd5('0x30')][_0x9cd5('0x47')](_0x5c33e9);})[_0x9cd5('0x28')](function(_0x12d604){_0x502257[_0x9cd5('0x48')]=_0x12d604;return _0x502257;})[_0x9cd5('0x28')](respondWithFilteredResult(_0x4af6c8,_0x5c33e9))[_0x9cd5('0x49')](handleError(_0x4af6c8,null));};exports[_0x9cd5('0x4a')]=function(_0x3ed405,_0x7ad8ec){var _0xa12319={'raw':!![],'where':{'id':_0x3ed405[_0x9cd5('0x4b')]['id']}},_0x3b316b={};_0x3b316b[_0x9cd5('0x35')]=_[_0x9cd5('0x37')](db['ChatOfflineMessage'][_0x9cd5('0x31')]);_0x3b316b['query']=_[_0x9cd5('0x37')](_0x3ed405[_0x9cd5('0x36')]);_0x3b316b[_0x9cd5('0x38')]=_[_0x9cd5('0x39')](_0x3b316b[_0x9cd5('0x35')],_0x3b316b['query']);_0xa12319[_0x9cd5('0x3a')]=_[_0x9cd5('0x39')](_0x3b316b[_0x9cd5('0x35')],qs['fields'](_0x3ed405[_0x9cd5('0x36')][_0x9cd5('0x3b')]));_0xa12319[_0x9cd5('0x3a')]=_0xa12319[_0x9cd5('0x3a')]['length']?_0xa12319[_0x9cd5('0x3a')]:_0x3b316b[_0x9cd5('0x35')];if(_0x3ed405[_0x9cd5('0x36')][_0x9cd5('0x45')]){_0xa12319[_0x9cd5('0x46')]=[{'all':!![]}];}_0xa12319=_[_0x9cd5('0x44')]({},_0xa12319,_0x3ed405[_0x9cd5('0x4c')]);return db[_0x9cd5('0x30')][_0x9cd5('0x4d')](_0xa12319)[_0x9cd5('0x28')](handleEntityNotFound(_0x7ad8ec,null))[_0x9cd5('0x28')](respondWithResult(_0x7ad8ec,null))[_0x9cd5('0x49')](handleError(_0x7ad8ec,null));};exports[_0x9cd5('0x4e')]=function(_0x1e1ba0,_0x245f9e){return db[_0x9cd5('0x30')][_0x9cd5('0x4e')](_0x1e1ba0[_0x9cd5('0x4f')],{})['then'](respondWithResult(_0x245f9e,0xc9))[_0x9cd5('0x49')](handleError(_0x245f9e,null));};exports[_0x9cd5('0x27')]=function(_0x3fead7,_0x2058a6){if(_0x3fead7['body']['id']){delete _0x3fead7[_0x9cd5('0x4f')]['id'];}return db[_0x9cd5('0x30')]['find']({'where':{'id':_0x3fead7[_0x9cd5('0x4b')]['id']}})[_0x9cd5('0x28')](handleEntityNotFound(_0x2058a6,null))[_0x9cd5('0x28')](saveUpdates(_0x3fead7[_0x9cd5('0x4f')],null))[_0x9cd5('0x28')](respondWithResult(_0x2058a6,null))[_0x9cd5('0x49')](handleError(_0x2058a6,null));};exports[_0x9cd5('0x29')]=function(_0x14c585,_0x5b6c7d){return db['ChatOfflineMessage'][_0x9cd5('0x4d')]({'where':{'id':_0x14c585[_0x9cd5('0x4b')]['id']}})[_0x9cd5('0x28')](handleEntityNotFound(_0x5b6c7d,null))[_0x9cd5('0x28')](removeEntity(_0x5b6c7d,null))['catch'](handleError(_0x5b6c7d,null));};exports[_0x9cd5('0x50')]=function(_0x55ac13,_0x5d4463){return db[_0x9cd5('0x30')][_0x9cd5('0x50')]()[_0x9cd5('0x28')](respondWithResult(_0x5d4463,null))['catch'](handleError(_0x5d4463,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index c546683..4a91d82 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 _0xb323=['./chatOfflineMessage.attributes','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb323,0xe1));var _0x3b32=function(_0x232af3,_0x42ad2c){_0x232af3=_0x232af3-0x0;var _0x3f4556=_0xb323[_0x232af3];return _0x3f4556;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3b32('0x0'));var moment=require(_0x3b32('0x1'));var BPromise=require(_0x3b32('0x2'));var rp=require(_0x3b32('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b32('0x4'));var config=require(_0x3b32('0x5'));var attributes=require(_0x3b32('0x6'));module['exports']=function(_0x50be77,_0x9af692){return _0x50be77['define'](_0x3b32('0x7'),attributes,{'tableName':_0x3b32('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b32('0x9'),'collate':_0x3b32('0xa')});}; \ No newline at end of file +var _0xb240=['path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x233602,_0x24afe3){var _0x214483=function(_0x588886){while(--_0x588886){_0x233602['push'](_0x233602['shift']());}};_0x214483(++_0x24afe3);}(_0xb240,0x1d0));var _0x0b24=function(_0x4e38d0,_0x569d79){_0x4e38d0=_0x4e38d0-0x0;var _0x65c3db=_0xb240[_0x4e38d0];return _0x65c3db;};'use strict';var _=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var logger=require('../../config/logger')(_0x0b24('0x2'));var moment=require(_0x0b24('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b24('0x4'));var rimraf=require(_0x0b24('0x5'));var config=require(_0x0b24('0x6'));var attributes=require(_0x0b24('0x7'));module[_0x0b24('0x8')]=function(_0x1af672,_0xdcdf9b){return _0x1af672[_0x0b24('0x9')]('ChatOfflineMessage',attributes,{'tableName':_0x0b24('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0b24('0xb'),'collate':_0x0b24('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 1200e1c..8d7ede5 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 _0x10df=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0x10df,0x7f));var _0xf10d=function(_0x3733eb,_0x2d9450){_0x3733eb=_0x3733eb-0x0;var _0x4c80e3=_0x10df[_0x3733eb];return _0x4c80e3;};'use strict';var _=require(_0xf10d('0x0'));var util=require('util');var moment=require(_0xf10d('0x1'));var BPromise=require(_0xf10d('0x2'));var rs=require(_0xf10d('0x3'));var fs=require('fs');var Redis=require(_0xf10d('0x4'));var db=require(_0xf10d('0x5'))['db'];var utils=require(_0xf10d('0x6'));var logger=require(_0xf10d('0x7'))(_0xf10d('0x8'));var config=require(_0xf10d('0x9'));var jayson=require(_0xf10d('0xa'));var client=jayson['client'][_0xf10d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3175eb,_0x42a567,_0x546ee1){return new BPromise(function(_0x17f75,_0x8d05a4){return client['request'](_0x3175eb,_0x546ee1)[_0xf10d('0xc')](function(_0x234fe3){logger['info'](_0xf10d('0xd'),_0x42a567,_0xf10d('0xe'));logger[_0xf10d('0xf')](_0xf10d('0x10'),_0x42a567,'request\x20sent',JSON['stringify'](_0x234fe3));if(_0x234fe3[_0xf10d('0x11')]){if(_0x234fe3[_0xf10d('0x11')][_0xf10d('0x12')]===0x1f4){logger[_0xf10d('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x42a567,_0x234fe3['error']['message']);return _0x8d05a4(_0x234fe3[_0xf10d('0x11')][_0xf10d('0x13')]);}logger[_0xf10d('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x42a567,_0x234fe3[_0xf10d('0x11')][_0xf10d('0x13')]);return _0x17f75(_0x234fe3[_0xf10d('0x11')][_0xf10d('0x13')]);}else{logger['info'](_0xf10d('0xd'),_0x42a567,_0xf10d('0xe'));_0x17f75(_0x234fe3[_0xf10d('0x14')][_0xf10d('0x13')]);}})[_0xf10d('0x15')](function(_0xaeba9a){logger[_0xf10d('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x42a567,_0xaeba9a);_0x8d05a4(_0xaeba9a);});});} \ No newline at end of file +var _0x19ba=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x19ba,0x84));var _0xa19b=function(_0x187454,_0x69cd05){_0x187454=_0x187454-0x0;var _0x4a203a=_0x19ba[_0x187454];return _0x4a203a;};'use strict';var _=require(_0xa19b('0x0'));var util=require(_0xa19b('0x1'));var moment=require('moment');var BPromise=require(_0xa19b('0x2'));var rs=require(_0xa19b('0x3'));var fs=require('fs');var Redis=require(_0xa19b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa19b('0x5'));var logger=require(_0xa19b('0x6'))(_0xa19b('0x7'));var config=require(_0xa19b('0x8'));var jayson=require(_0xa19b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaf46f8,_0x15a1ec,_0x1e1760){return new BPromise(function(_0x5b72bf,_0x2e0ce8){return client['request'](_0xaf46f8,_0x1e1760)['then'](function(_0x2962ff){logger['info'](_0xa19b('0xa'),_0x15a1ec,'request\x20sent');logger[_0xa19b('0xb')](_0xa19b('0xc'),_0x15a1ec,'request\x20sent',JSON['stringify'](_0x2962ff));if(_0x2962ff[_0xa19b('0xd')]){if(_0x2962ff[_0xa19b('0xd')][_0xa19b('0xe')]===0x1f4){logger[_0xa19b('0xd')](_0xa19b('0xa'),_0x15a1ec,_0x2962ff[_0xa19b('0xd')][_0xa19b('0xf')]);return _0x2e0ce8(_0x2962ff[_0xa19b('0xd')]['message']);}logger[_0xa19b('0xd')](_0xa19b('0xa'),_0x15a1ec,_0x2962ff[_0xa19b('0xd')][_0xa19b('0xf')]);return _0x5b72bf(_0x2962ff[_0xa19b('0xd')][_0xa19b('0xf')]);}else{logger[_0xa19b('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x15a1ec,_0xa19b('0x11'));_0x5b72bf(_0x2962ff[_0xa19b('0x12')][_0xa19b('0xf')]);}})['catch'](function(_0x48c499){logger[_0xa19b('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x15a1ec,_0x48c499);_0x2e0ce8(_0x48c499);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 4b68733..6512a10 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 _0x4a6e=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','/:id','isAuthenticated','show','create','update','delete','destroy'];(function(_0x4ab062,_0x5c56b4){var _0x487434=function(_0x467019){while(--_0x467019){_0x4ab062['push'](_0x4ab062['shift']());}};_0x487434(++_0x5c56b4);}(_0x4a6e,0x88));var _0xe4a6=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x4a6e[_0x308213];return _0x2e1619;};'use strict';var multer=require(_0xe4a6('0x0'));var util=require(_0xe4a6('0x1'));var path=require(_0xe4a6('0x2'));var timeout=require('connect-timeout');var express=require(_0xe4a6('0x3'));var router=express[_0xe4a6('0x4')]();var auth=require(_0xe4a6('0x5'));var interaction=require(_0xe4a6('0x6'));var config=require(_0xe4a6('0x7'));var controller=require(_0xe4a6('0x8'));router[_0xe4a6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe4a6('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xe4a6('0x9')](_0xe4a6('0xa'),auth[_0xe4a6('0xb')](),controller[_0xe4a6('0xc')]);router['post']('/',auth[_0xe4a6('0xb')](),controller[_0xe4a6('0xd')]);router['put'](_0xe4a6('0xa'),auth['isAuthenticated'](),controller[_0xe4a6('0xe')]);router[_0xe4a6('0xf')](_0xe4a6('0xa'),auth['isAuthenticated'](),controller[_0xe4a6('0x10')]);module['exports']=router; \ No newline at end of file +var _0x844c=['/describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x118489,_0x3e8b9e){var _0x2459c7=function(_0x554693){while(--_0x554693){_0x118489['push'](_0x118489['shift']());}};_0x2459c7(++_0x3e8b9e);}(_0x844c,0x116));var _0xc844=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0x844c[_0x3c51d4];return _0x53c45f;};'use strict';var multer=require(_0xc844('0x0'));var util=require(_0xc844('0x1'));var path=require(_0xc844('0x2'));var timeout=require(_0xc844('0x3'));var express=require(_0xc844('0x4'));var router=express[_0xc844('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc844('0x6'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0xc844('0x7')]('/',auth[_0xc844('0x8')](),controller[_0xc844('0x9')]);router[_0xc844('0x7')](_0xc844('0xa'),auth[_0xc844('0x8')](),controller['describe']);router['get'](_0xc844('0xb'),auth[_0xc844('0x8')](),controller[_0xc844('0xc')]);router[_0xc844('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc844('0xe')](_0xc844('0xb'),auth[_0xc844('0x8')](),controller['update']);router[_0xc844('0xf')](_0xc844('0xb'),auth[_0xc844('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index ddc7f1d..6c63455 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 _0x46c6=['mouseOver','INTEGER','sequelize'];(function(_0x28c5ff,_0x555851){var _0x3f696b=function(_0x521d84){while(--_0x521d84){_0x28c5ff['push'](_0x28c5ff['shift']());}};_0x3f696b(++_0x555851);}(_0x46c6,0x188));var _0x646c=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x46c6[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require(_0x646c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x646c('0x1'),'timeout'),'defaultValue':_0x646c('0x1')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x646c('0x2')]}}; \ No newline at end of file +var _0x3b6f=['STRING','mouseOver','timeout','sequelize','exports'];(function(_0x40a746,_0x21edcb){var _0x541f4e=function(_0x315849){while(--_0x315849){_0x40a746['push'](_0x40a746['shift']());}};_0x541f4e(++_0x21edcb);}(_0x3b6f,0x67));var _0xf3b6=function(_0x59acb4,_0x436954){_0x59acb4=_0x59acb4-0x0;var _0x4cd0a6=_0x3b6f[_0x59acb4];return _0x4cd0a6;};'use strict';var Sequelize=require(_0xf3b6('0x0'));module[_0xf3b6('0x1')]={'name':{'type':Sequelize[_0xf3b6('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf3b6('0x3'),_0xf3b6('0x4')),'defaultValue':_0xf3b6('0x3')},'selector':{'type':Sequelize[_0xf3b6('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 51be48e..da1c1a5 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 _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(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x421c56,_0x4efd00){_0x421c56=_0x421c56-0x0;var _0x49b244=_0xcb91[_0x421c56];return _0x49b244;};'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 +var _0x0713=['update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','options','find','catch','create','body'];(function(_0x12b811,_0x23d90c){var _0x1bfa28=function(_0x303f67){while(--_0x303f67){_0x12b811['push'](_0x12b811['shift']());}};_0x1bfa28(++_0x23d90c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={'raw':!![],'where':{'id':_0x4d5c4b[_0x3071('0x2d')]['id']}},_0x163604={};_0x163604[_0x3071('0x2e')]=_[_0x3071('0x2f')](db[_0x3071('0x30')][_0x3071('0x31')]);_0x163604[_0x3071('0x32')]=_[_0x3071('0x2f')](_0x4d5c4b[_0x3071('0x32')]);_0x163604['filters']=_['intersection'](_0x163604[_0x3071('0x2e')],_0x163604[_0x3071('0x32')]);_0x28792d[_0x3071('0x33')]=_[_0x3071('0x34')](_0x163604[_0x3071('0x2e')],qs[_0x3071('0x35')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x35')]));_0x28792d['attributes']=_0x28792d['attributes']['length']?_0x28792d[_0x3071('0x33')]:_0x163604[_0x3071('0x2e')];if(_0x4d5c4b['query'][_0x3071('0x36')]){_0x28792d[_0x3071('0x37')]=[{'all':!![]}];}_0x28792d=_[_0x3071('0x38')]({},_0x28792d,_0x4d5c4b[_0x3071('0x39')]);return db['ChatProactiveAction'][_0x3071('0x3a')](_0x28792d)[_0x3071('0x26')](handleEntityNotFound(_0x4fb1ca,null))[_0x3071('0x26')](respondWithResult(_0x4fb1ca,null))[_0x3071('0x3b')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x3c')]=function(_0x2068ce,_0x3c55c){return db[_0x3071('0x30')]['create'](_0x2068ce[_0x3071('0x3d')],{})['then'](respondWithResult(_0x3c55c,0xc9))['catch'](handleError(_0x3c55c,null));};exports[_0x3071('0x3e')]=function(_0xa3a7ae,_0x54d9c3){if(_0xa3a7ae[_0x3071('0x3d')]['id']){delete _0xa3a7ae[_0x3071('0x3d')]['id'];}return db[_0x3071('0x30')][_0x3071('0x3a')]({'where':{'id':_0xa3a7ae[_0x3071('0x2d')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x54d9c3,null))['then'](saveUpdates(_0xa3a7ae[_0x3071('0x3d')],null))[_0x3071('0x26')](respondWithResult(_0x54d9c3,null))['catch'](handleError(_0x54d9c3,null));};exports[_0x3071('0x27')]=function(_0x5b1392,_0x28f855){return db[_0x3071('0x30')]['find']({'where':{'id':_0x5b1392['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x28f855,null))[_0x3071('0x26')](removeEntity(_0x28f855,null))[_0x3071('0x3b')](handleError(_0x28f855,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index a39712a..26c70a3 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 _0xa55c=['define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x4d9b8e,_0x556975){var _0x5480d4=function(_0x232dca){while(--_0x232dca){_0x4d9b8e['push'](_0x4d9b8e['shift']());}};_0x5480d4(++_0x556975);}(_0xa55c,0x196));var _0xca55=function(_0x24c556,_0x271443){_0x24c556=_0x24c556-0x0;var _0xaaec20=_0xa55c[_0x24c556];return _0xaaec20;};'use strict';var _=require(_0xca55('0x0'));var util=require(_0xca55('0x1'));var logger=require('../../config/logger')(_0xca55('0x2'));var moment=require(_0xca55('0x3'));var BPromise=require(_0xca55('0x4'));var rp=require(_0xca55('0x5'));var fs=require('fs');var path=require(_0xca55('0x6'));var rimraf=require('rimraf');var config=require(_0xca55('0x7'));var attributes=require(_0xca55('0x8'));module[_0xca55('0x9')]=function(_0x4a6e3c,_0x3c8e3d){return _0x4a6e3c[_0xca55('0xa')](_0xca55('0xb'),attributes,{'tableName':_0xca55('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80bd=['request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','../../config/logger','api','bluebird'];(function(_0x461f9d,_0x481fff){var _0x154289=function(_0x11ce33){while(--_0x11ce33){_0x461f9d['push'](_0x461f9d['shift']());}};_0x154289(++_0x481fff);}(_0x80bd,0x197));var _0xd80b=function(_0x1b5d36,_0x16c4ae){_0x1b5d36=_0x1b5d36-0x0;var _0x5693f3=_0x80bd[_0x1b5d36];return _0x5693f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd80b('0x0'))(_0xd80b('0x1'));var moment=require('moment');var BPromise=require(_0xd80b('0x2'));var rp=require(_0xd80b('0x3'));var fs=require('fs');var path=require(_0xd80b('0x4'));var rimraf=require(_0xd80b('0x5'));var config=require(_0xd80b('0x6'));var attributes=require(_0xd80b('0x7'));module[_0xd80b('0x8')]=function(_0x269677,_0x5a0fe3){return _0x269677['define'](_0xd80b('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 0cb2add..5b514fc 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 _0x1235=['result','catch','util','randomstring','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message'];(function(_0x2c039a,_0x217a31){var _0x3f398f=function(_0x16e635){while(--_0x16e635){_0x2c039a['push'](_0x2c039a['shift']());}};_0x3f398f(++_0x217a31);}(_0x1235,0x92));var _0x5123=function(_0x1f657f,_0x217a10){_0x1f657f=_0x1f657f-0x0;var _0x12886e=_0x1235[_0x1f657f];return _0x12886e;};'use strict';var _=require('lodash');var util=require(_0x5123('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5123('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5123('0x2'));var config=require(_0x5123('0x3'));var jayson=require(_0x5123('0x4'));var client=jayson[_0x5123('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34855a,_0x20386f,_0x2d38ec){return new BPromise(function(_0x97ce6f,_0x47defc){return client[_0x5123('0x6')](_0x34855a,_0x2d38ec)[_0x5123('0x7')](function(_0x352395){logger[_0x5123('0x8')]('ChatProactiveAction,\x20%s,\x20%s',_0x20386f,_0x5123('0x9'));logger['debug'](_0x5123('0xa'),_0x20386f,_0x5123('0x9'),JSON[_0x5123('0xb')](_0x352395));if(_0x352395[_0x5123('0xc')]){if(_0x352395['error'][_0x5123('0xd')]===0x1f4){logger[_0x5123('0xc')](_0x5123('0xe'),_0x20386f,_0x352395[_0x5123('0xc')][_0x5123('0xf')]);return _0x47defc(_0x352395[_0x5123('0xc')][_0x5123('0xf')]);}logger[_0x5123('0xc')](_0x5123('0xe'),_0x20386f,_0x352395[_0x5123('0xc')][_0x5123('0xf')]);return _0x97ce6f(_0x352395[_0x5123('0xc')][_0x5123('0xf')]);}else{logger['info'](_0x5123('0xe'),_0x20386f,'request\x20sent');_0x97ce6f(_0x352395[_0x5123('0x10')][_0x5123('0xf')]);}})[_0x5123('0x11')](function(_0x260cac){logger[_0x5123('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x20386f,_0x260cac);_0x47defc(_0x260cac);});});} \ No newline at end of file +var _0xb7e0=['http','request','then','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5a43af,_0x4caf25){var _0x9c9788=function(_0x400e96){while(--_0x400e96){_0x5a43af['push'](_0x5a43af['shift']());}};_0x9c9788(++_0x4caf25);}(_0xb7e0,0x18e));var _0x0b7e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb7e0[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x0b7e('0x0'));var util=require(_0x0b7e('0x1'));var moment=require(_0x0b7e('0x2'));var BPromise=require(_0x0b7e('0x3'));var rs=require(_0x0b7e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0b7e('0x5'));var logger=require(_0x0b7e('0x6'))(_0x0b7e('0x7'));var config=require(_0x0b7e('0x8'));var jayson=require(_0x0b7e('0x9'));var client=jayson['client'][_0x0b7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x200be9,_0x2abdfb,_0x528843){return new BPromise(function(_0x428537,_0xa62b74){return client[_0x0b7e('0xb')](_0x200be9,_0x528843)[_0x0b7e('0xc')](function(_0x1b3eb5){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x2abdfb,_0x0b7e('0xd'));logger[_0x0b7e('0xe')](_0x0b7e('0xf'),_0x2abdfb,_0x0b7e('0xd'),JSON[_0x0b7e('0x10')](_0x1b3eb5));if(_0x1b3eb5[_0x0b7e('0x11')]){if(_0x1b3eb5[_0x0b7e('0x11')][_0x0b7e('0x12')]===0x1f4){logger[_0x0b7e('0x11')](_0x0b7e('0x13'),_0x2abdfb,_0x1b3eb5[_0x0b7e('0x11')]['message']);return _0xa62b74(_0x1b3eb5[_0x0b7e('0x11')][_0x0b7e('0x14')]);}logger['error'](_0x0b7e('0x13'),_0x2abdfb,_0x1b3eb5[_0x0b7e('0x11')]['message']);return _0x428537(_0x1b3eb5[_0x0b7e('0x11')][_0x0b7e('0x14')]);}else{logger[_0x0b7e('0x15')](_0x0b7e('0x13'),_0x2abdfb,'request\x20sent');_0x428537(_0x1b3eb5[_0x0b7e('0x16')]['message']);}})[_0x0b7e('0x17')](function(_0x18f879){logger[_0x0b7e('0x11')](_0x0b7e('0x13'),_0x2abdfb,_0x18f879);_0xa62b74(_0x18f879);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 19a5526..2aaaf77 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 _0xb5fd=['../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','create','put','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1c1057,_0x4a6f27){var _0x5389e9=function(_0xdfc8b9){while(--_0xdfc8b9){_0x1c1057['push'](_0x1c1057['shift']());}};_0x5389e9(++_0x4a6f27);}(_0xb5fd,0x71));var _0xdb5f=function(_0x33fd4e,_0x27057a){_0x33fd4e=_0x33fd4e-0x0;var _0x14de82=_0xb5fd[_0x33fd4e];return _0x14de82;};'use strict';var multer=require('multer');var util=require(_0xdb5f('0x0'));var path=require(_0xdb5f('0x1'));var timeout=require(_0xdb5f('0x2'));var express=require(_0xdb5f('0x3'));var router=express[_0xdb5f('0x4')]();var auth=require(_0xdb5f('0x5'));var interaction=require(_0xdb5f('0x6'));var config=require(_0xdb5f('0x7'));var controller=require(_0xdb5f('0x8'));router[_0xdb5f('0x9')](_0xdb5f('0xa'),auth[_0xdb5f('0xb')](),controller['show']);router['post']('/',auth[_0xdb5f('0xb')](),controller[_0xdb5f('0xc')]);router[_0xdb5f('0xd')](_0xdb5f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xdb5f('0xe')](_0xdb5f('0xa'),auth[_0xdb5f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4ab1=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x4ab1,0x6d));var _0x14ab=function(_0x454faa,_0x3eb0c5){_0x454faa=_0x454faa-0x0;var _0x16afb6=_0x4ab1[_0x454faa];return _0x16afb6;};'use strict';var multer=require(_0x14ab('0x0'));var util=require(_0x14ab('0x1'));var path=require('path');var timeout=require(_0x14ab('0x2'));var express=require(_0x14ab('0x3'));var router=express['Router']();var auth=require(_0x14ab('0x4'));var interaction=require(_0x14ab('0x5'));var config=require(_0x14ab('0x6'));var controller=require(_0x14ab('0x7'));router[_0x14ab('0x8')](_0x14ab('0x9'),auth[_0x14ab('0xa')](),controller[_0x14ab('0xb')]);router[_0x14ab('0xc')]('/',auth[_0x14ab('0xa')](),controller['create']);router[_0x14ab('0xd')]('/:id',auth[_0x14ab('0xa')](),controller[_0x14ab('0xe')]);router[_0x14ab('0xf')](_0x14ab('0x9'),auth[_0x14ab('0xa')](),controller[_0x14ab('0x10')]);module[_0x14ab('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 7b2b789..35cfc19 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 _0xe3a9=['roundrobin','exports','name','STRING','INTEGER','rrmemory','beepall'];(function(_0x684c4e,_0x529c01){var _0x4630de=function(_0x141462){while(--_0x141462){_0x684c4e['push'](_0x684c4e['shift']());}};_0x4630de(++_0x529c01);}(_0xe3a9,0xa2));var _0x9e3a=function(_0x2db667,_0x193cf5){_0x2db667=_0x2db667-0x0;var _0x83ff9=_0xe3a9[_0x2db667];return _0x83ff9;};'use strict';var Sequelize=require('sequelize');module[_0x9e3a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9e3a('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9e3a('0x2')]},'timeout':{'type':Sequelize[_0x9e3a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9e3a('0x4'),_0x9e3a('0x5'),_0x9e3a('0x6'))}}; \ No newline at end of file +var _0xcc36=['INTEGER','rrmemory','beepall','roundrobin','sequelize','name'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xcc36,0xdc));var _0x6cc3=function(_0x1db0d2,_0x2c0712){_0x1db0d2=_0x1db0d2-0x0;var _0x2a442b=_0xcc36[_0x1db0d2];return _0x2a442b;};'use strict';var Sequelize=require(_0x6cc3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6cc3('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6cc3('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6cc3('0x3'),_0x6cc3('0x4'),_0x6cc3('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 66eadae..b1287d8 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 _0x7cd6=['fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','keys','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','User','findAndCountAll','agent','chatPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','ids','Agents','online','flatMap','addTeams','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','all','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.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','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','type','model','query','filters','intersection','attributes'];(function(_0xfc11ac,_0x483039){var _0x26599b=function(_0x1c3fac){while(--_0x1c3fac){_0xfc11ac['push'](_0xfc11ac['shift']());}};_0x26599b(++_0x483039);}(_0x7cd6,0x17b));var _0x67cd=function(_0x488355,_0x31ad2e){_0x488355=_0x488355-0x0;var _0x3cc6ca=_0x7cd6[_0x488355];return _0x3cc6ca;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x67cd('0x0'));var zipdir=require(_0x67cd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x67cd('0x2'));var moment=require(_0x67cd('0x3'));var BPromise=require(_0x67cd('0x4'));var Mustache=require(_0x67cd('0x5'));var util=require(_0x67cd('0x6'));var path=require(_0x67cd('0x7'));var sox=require(_0x67cd('0x8'));var csv=require(_0x67cd('0x9'));var ejs=require(_0x67cd('0xa'));var fs=require('fs');var _=require(_0x67cd('0xb'));var squel=require('squel');var crypto=require(_0x67cd('0xc'));var jsforce=require(_0x67cd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x67cd('0x9'));var querystring=require('querystring');var Papa=require(_0x67cd('0xe'));var Redis=require(_0x67cd('0xf'));var authService=require(_0x67cd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x67cd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67cd('0x12'))(_0x67cd('0x13'));var utils=require(_0x67cd('0x14'));var config=require(_0x67cd('0x15'));var db=require(_0x67cd('0x16'))['db'];config[_0x67cd('0x17')]=_[_0x67cd('0x18')](config[_0x67cd('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x67cd('0x19'))(new Redis(config[_0x67cd('0x17')]));require(_0x67cd('0x1a'))[_0x67cd('0x1b')](socket);var jayson=require(_0x67cd('0x1c'));var client=jayson['client'][_0x67cd('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3cd186,_0x43d3b8,_0x1ccf19){if(_0x1ccf19){var _0x36d370=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36d370[_0x67cd('0x1e')](_0x43d3b8)){return _0x3cd186;}else{throw new db[(_0x67cd('0x1f'))][(_0x67cd('0x20'))](_0x67cd('0x21'));}}else{return _0x3cd186;}}function respondWithRpcPromise(_0x195166,_0x3332a7,_0x5f140d,_0x66097c){return new BPromise(function(_0x29e9a2,_0x595ffb){var _0x2ce3ab=_0x66097c||client;return _0x2ce3ab[_0x67cd('0x22')](_0x195166,_0x5f140d)[_0x67cd('0x23')](function(_0x66c9bc){logger['info'](_0x67cd('0x24'),_0x3332a7,_0x67cd('0x25'));logger[_0x67cd('0x26')](_0x67cd('0x27'),_0x3332a7,_0x67cd('0x25'),JSON[_0x67cd('0x28')](_0x66c9bc));if(_0x66c9bc['error']){if(_0x66c9bc[_0x67cd('0x29')][_0x67cd('0x2a')]===0x1f4){logger[_0x67cd('0x29')](_0x67cd('0x24'),_0x3332a7,_0x66c9bc[_0x67cd('0x29')]['message']);return _0x595ffb(_0x66c9bc[_0x67cd('0x29')]['message']);}logger[_0x67cd('0x29')]('ChatQueue,\x20%s,\x20%s',_0x3332a7,_0x66c9bc[_0x67cd('0x29')][_0x67cd('0x2b')]);return _0x29e9a2(_0x66c9bc[_0x67cd('0x29')][_0x67cd('0x2b')]);}else{logger[_0x67cd('0x2c')]('ChatQueue,\x20%s,\x20%s',_0x3332a7,'request\x20sent');_0x29e9a2(_0x66c9bc['result']['message']);}})[_0x67cd('0x2d')](function(_0x332988){logger[_0x67cd('0x29')](_0x67cd('0x24'),_0x3332a7,_0x332988);_0x595ffb(_0x332988);});});}function respondWithStatusCode(_0x1346b1,_0x1f8f15){_0x1f8f15=_0x1f8f15||0xcc;return function(_0x968e5e){if(_0x968e5e){return _0x1346b1[_0x67cd('0x2e')](_0x1f8f15);}return _0x1346b1['status'](_0x1f8f15)[_0x67cd('0x2f')]();};}function respondWithResult(_0x277ec6,_0x46efd1){_0x46efd1=_0x46efd1||0xc8;return function(_0x26e18b){if(_0x26e18b){return _0x277ec6[_0x67cd('0x30')](_0x46efd1)[_0x67cd('0x31')](_0x26e18b);}};}function respondWithFilteredResult(_0x47eda2,_0x1f4c1d){return function(_0x394595){if(_0x394595){var _0x15c5a8=_0x394595[_0x67cd('0x32')],_0x2cc8b3=_0x1f4c1d[_0x67cd('0x33')],_0x8587ae=_0x1f4c1d['offset']+_0x1f4c1d[_0x67cd('0x34')],_0x473964;if(_0x8587ae>=_0x15c5a8){_0x8587ae=_0x15c5a8;_0x473964=0xc8;}else{_0x473964=0xce;}_0x47eda2[_0x67cd('0x30')](_0x473964);return _0x47eda2['set'](_0x67cd('0x35'),_0x2cc8b3+'-'+_0x8587ae+'/'+_0x15c5a8)[_0x67cd('0x31')](_0x394595);}return null;};}function patchUpdates(_0x2456e2){return function(_0x49053e){try{jsonpatch['apply'](_0x49053e,_0x2456e2,!![]);}catch(_0x4a359b){return BPromise[_0x67cd('0x36')](_0x4a359b);}return _0x49053e[_0x67cd('0x37')]();};}function saveUpdates(_0x3d97ea,_0x4d63ad){return function(_0x328448){if(_0x328448){return _0x328448[_0x67cd('0x38')](_0x3d97ea)['then'](function(_0x5d144a){return _0x5d144a;});}return null;};}function removeEntity(_0x4d0a93,_0x27433c){return function(_0x25bda3){if(_0x25bda3){return _0x25bda3[_0x67cd('0x39')]()[_0x67cd('0x23')](function(){var _0x3fd973=_0x25bda3[_0x67cd('0x3a')]({'plain':!![]});var _0x455447=_0x67cd('0x3b');return db[_0x67cd('0x3c')][_0x67cd('0x39')]({'where':{'type':_0x455447,'resourceId':_0x3fd973['id']}})[_0x67cd('0x23')](function(){return _0x25bda3;});})[_0x67cd('0x23')](function(){_0x4d0a93['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13a1a6,_0xfda4b8){return function(_0x273b90){if(!_0x273b90){_0x13a1a6['sendStatus'](0x194);}return _0x273b90;};}function handleError(_0x2ef2d0,_0x17b6de){_0x17b6de=_0x17b6de||0x1f4;return function(_0x346210){logger[_0x67cd('0x29')](_0x346210[_0x67cd('0x3d')]);if(_0x346210[_0x67cd('0x3e')]){delete _0x346210[_0x67cd('0x3e')];}_0x2ef2d0[_0x67cd('0x30')](_0x17b6de)[_0x67cd('0x3f')](_0x346210);};}exports[_0x67cd('0x40')]=function(_0x5dba18,_0x1ac54d){var _0x7f5841={},_0x4b93e0={},_0x3fd77c={'count':0x0,'rows':[]};var _0x362dc5=_[_0x67cd('0x41')](db[_0x67cd('0x42')][_0x67cd('0x43')],function(_0x3f5760){return{'name':_0x3f5760['fieldName'],'type':_0x3f5760[_0x67cd('0x44')]['key']};});_0x4b93e0[_0x67cd('0x45')]=_[_0x67cd('0x41')](_0x362dc5,_0x67cd('0x3e'));_0x4b93e0[_0x67cd('0x46')]=_['keys'](_0x5dba18[_0x67cd('0x46')]);_0x4b93e0[_0x67cd('0x47')]=_[_0x67cd('0x48')](_0x4b93e0[_0x67cd('0x45')],_0x4b93e0['query']);_0x7f5841[_0x67cd('0x49')]=_[_0x67cd('0x48')](_0x4b93e0[_0x67cd('0x45')],qs[_0x67cd('0x4a')](_0x5dba18[_0x67cd('0x46')][_0x67cd('0x4a')]));_0x7f5841[_0x67cd('0x49')]=_0x7f5841[_0x67cd('0x49')][_0x67cd('0x4b')]?_0x7f5841[_0x67cd('0x49')]:_0x4b93e0[_0x67cd('0x45')];if(!_0x5dba18[_0x67cd('0x46')]['hasOwnProperty'](_0x67cd('0x4c'))){_0x7f5841[_0x67cd('0x34')]=qs[_0x67cd('0x34')](_0x5dba18[_0x67cd('0x46')]['limit']);_0x7f5841[_0x67cd('0x33')]=qs[_0x67cd('0x33')](_0x5dba18[_0x67cd('0x46')]['offset']);}_0x7f5841[_0x67cd('0x4d')]=qs[_0x67cd('0x4e')](_0x5dba18['query']['sort']);_0x7f5841[_0x67cd('0x4f')]=qs['filters'](_[_0x67cd('0x50')](_0x5dba18['query'],_0x4b93e0['filters']),_0x362dc5);if(_0x5dba18['query']['filter']){_0x7f5841[_0x67cd('0x4f')]=_['merge'](_0x7f5841[_0x67cd('0x4f')],{'$or':_[_0x67cd('0x41')](_0x362dc5,function(_0x2f1763){if(_0x2f1763[_0x67cd('0x44')]!==_0x67cd('0x51')){var _0x36d59b={};_0x36d59b[_0x2f1763[_0x67cd('0x3e')]]={'$like':'%'+_0x5dba18[_0x67cd('0x46')][_0x67cd('0x52')]+'%'};return _0x36d59b;}})});}_0x7f5841=_['merge']({},_0x7f5841,_0x5dba18[_0x67cd('0x53')]);var _0x4f3372={'where':_0x7f5841[_0x67cd('0x4f')]};return db[_0x67cd('0x42')]['count'](_0x4f3372)[_0x67cd('0x23')](function(_0x68b66f){_0x3fd77c['count']=_0x68b66f;if(_0x5dba18[_0x67cd('0x46')][_0x67cd('0x54')]){_0x7f5841[_0x67cd('0x55')]=[{'all':!![]}];}return db[_0x67cd('0x42')][_0x67cd('0x56')](_0x7f5841);})[_0x67cd('0x23')](function(_0x333908){_0x3fd77c[_0x67cd('0x57')]=_0x333908;return _0x3fd77c;})[_0x67cd('0x23')](respondWithFilteredResult(_0x1ac54d,_0x7f5841))[_0x67cd('0x2d')](handleError(_0x1ac54d,null));};exports['show']=function(_0x47acd4,_0x83d724){var _0x237868={'raw':!![],'where':{'id':_0x47acd4['params']['id']}},_0x467c81={};_0x467c81[_0x67cd('0x45')]=_[_0x67cd('0x58')](db['ChatQueue'][_0x67cd('0x43')]);_0x467c81['query']=_['keys'](_0x47acd4['query']);_0x467c81['filters']=_[_0x67cd('0x48')](_0x467c81[_0x67cd('0x45')],_0x467c81['query']);_0x237868[_0x67cd('0x49')]=_['intersection'](_0x467c81['model'],qs['fields'](_0x47acd4[_0x67cd('0x46')]['fields']));_0x237868['attributes']=_0x237868[_0x67cd('0x49')][_0x67cd('0x4b')]?_0x237868[_0x67cd('0x49')]:_0x467c81[_0x67cd('0x45')];if(_0x47acd4[_0x67cd('0x46')][_0x67cd('0x54')]){_0x237868[_0x67cd('0x55')]=[{'all':!![]}];}_0x237868=_[_0x67cd('0x59')]({},_0x237868,_0x47acd4[_0x67cd('0x53')]);return db['ChatQueue'][_0x67cd('0x5a')](_0x237868)[_0x67cd('0x23')](handleEntityNotFound(_0x83d724,null))[_0x67cd('0x23')](respondWithResult(_0x83d724,null))[_0x67cd('0x2d')](handleError(_0x83d724,null));};exports['create']=function(_0x262a1c,_0x1e9451){return db[_0x67cd('0x42')][_0x67cd('0x5b')](_0x262a1c[_0x67cd('0x5c')],{})[_0x67cd('0x23')](function(_0x19fbfb){var _0x216aaa=_0x262a1c[_0x67cd('0x5d')]['get']({'plain':!![]});if(!_0x216aaa)throw new Error(_0x67cd('0x5e'));if(_0x216aaa['role']==='user'){var _0x31b275=_0x19fbfb[_0x67cd('0x3a')]({'plain':!![]});var _0x3b5a7f=_0x67cd('0x3b');return db['UserProfileSection'][_0x67cd('0x5a')]({'where':{'name':_0x3b5a7f,'userProfileId':_0x216aaa[_0x67cd('0x5f')]},'raw':!![]})[_0x67cd('0x23')](function(_0x4061f5){if(_0x4061f5&&_0x4061f5[_0x67cd('0x60')]===0x0){return db[_0x67cd('0x3c')][_0x67cd('0x5b')]({'name':_0x31b275[_0x67cd('0x3e')],'resourceId':_0x31b275['id'],'type':_0x4061f5[_0x67cd('0x3e')],'sectionId':_0x4061f5['id']},{})[_0x67cd('0x23')](function(){return _0x19fbfb;});}else{return _0x19fbfb;}})[_0x67cd('0x2d')](function(_0x161172){logger[_0x67cd('0x29')](_0x67cd('0x61'),_0x161172);throw _0x161172;});}return _0x19fbfb;})['then'](respondWithResult(_0x1e9451,0xc9))[_0x67cd('0x2d')](handleError(_0x1e9451,null));};exports[_0x67cd('0x38')]=function(_0x200878,_0x437199){if(_0x200878[_0x67cd('0x5c')]['id']){delete _0x200878[_0x67cd('0x5c')]['id'];}return db['ChatQueue'][_0x67cd('0x5a')]({'where':{'id':_0x200878[_0x67cd('0x62')]['id']}})['then'](handleEntityNotFound(_0x437199,null))[_0x67cd('0x23')](saveUpdates(_0x200878['body'],null))[_0x67cd('0x23')](respondWithResult(_0x437199,null))[_0x67cd('0x2d')](handleError(_0x437199,null));};exports['destroy']=function(_0x910fa4,_0x5bd033){return db['ChatQueue'][_0x67cd('0x5a')]({'where':{'id':_0x910fa4['params']['id']}})[_0x67cd('0x23')](handleEntityNotFound(_0x5bd033,null))[_0x67cd('0x23')](removeEntity(_0x5bd033,null))[_0x67cd('0x2d')](handleError(_0x5bd033,null));};exports[_0x67cd('0x63')]=function(_0x52da8f,_0x145923){return db[_0x67cd('0x42')][_0x67cd('0x63')]()[_0x67cd('0x23')](respondWithResult(_0x145923,null))[_0x67cd('0x2d')](handleError(_0x145923,null));};exports[_0x67cd('0x64')]=function(_0x427a52,_0x5d927d,_0x56152e){var _0x1cba72={'raw':!![],'where':{}},_0x4949f2={},_0x312195;return db['ChatQueue'][_0x67cd('0x65')]({'where':{'id':_0x427a52[_0x67cd('0x62')]['id']}})[_0x67cd('0x23')](handleEntityNotFound(_0x5d927d,null))[_0x67cd('0x23')](function(_0x117348){if(_0x117348){_0x312195=_0x117348['get']({'plain':!![]});_0x4949f2['model']=_['keys'](db[_0x67cd('0x66')][_0x67cd('0x43')]);_0x4949f2[_0x67cd('0x46')]=_[_0x67cd('0x58')](_0x427a52['query']);_0x4949f2[_0x67cd('0x47')]=_[_0x67cd('0x48')](_0x4949f2[_0x67cd('0x45')],_0x4949f2['query']);_0x1cba72[_0x67cd('0x49')]=_[_0x67cd('0x48')](_0x4949f2[_0x67cd('0x45')],qs[_0x67cd('0x4a')](_0x427a52[_0x67cd('0x46')][_0x67cd('0x4a')]));_0x1cba72[_0x67cd('0x49')]=_0x1cba72[_0x67cd('0x49')][_0x67cd('0x4b')]?_0x1cba72[_0x67cd('0x49')]:_0x4949f2[_0x67cd('0x45')];if(!_0x427a52['query'][_0x67cd('0x67')](_0x67cd('0x4c'))){_0x1cba72[_0x67cd('0x34')]=qs['limit'](_0x427a52[_0x67cd('0x46')][_0x67cd('0x34')]);_0x1cba72['offset']=qs[_0x67cd('0x33')](_0x427a52[_0x67cd('0x46')][_0x67cd('0x33')]);}_0x1cba72['order']=qs[_0x67cd('0x4e')](_0x427a52[_0x67cd('0x46')]['sort']);_0x1cba72[_0x67cd('0x4f')]=qs[_0x67cd('0x47')](_[_0x67cd('0x50')](_0x427a52[_0x67cd('0x46')],_0x4949f2[_0x67cd('0x47')]));_0x1cba72[_0x67cd('0x4f')]['ChatQueueId']=_0x117348['id'];if(_0x427a52[_0x67cd('0x46')][_0x67cd('0x52')]){_0x1cba72[_0x67cd('0x4f')]=_[_0x67cd('0x59')](_0x1cba72[_0x67cd('0x4f')],{'$or':_[_0x67cd('0x41')](_0x1cba72['attributes'],function(_0x1cb2eb){var _0x5a4c53={};_0x5a4c53[_0x1cb2eb]={'$like':'%'+_0x427a52[_0x67cd('0x46')][_0x67cd('0x52')]+'%'};return _0x5a4c53;})});}_0x1cba72=_[_0x67cd('0x59')]({},_0x1cba72,_0x427a52['options']);return db[_0x67cd('0x66')][_0x67cd('0x56')](_0x1cba72);}})[_0x67cd('0x23')](function(_0x3efac4){if(_0x3efac4){return db[_0x67cd('0x68')][_0x67cd('0x69')]({'where':{'id':_[_0x67cd('0x41')](_0x3efac4,'UserId'),'role':_0x67cd('0x6a')},'attributes':['id',_0x67cd('0x3e'),_0x67cd('0x6b'),'updatedAt',_0x67cd('0x6c')]});}})[_0x67cd('0x23')](function(_0x2507ed){if(_0x2507ed){return{'count':_0x2507ed['count'],'rows':_[_0x67cd('0x41')](_0x2507ed[_0x67cd('0x57')],function(_0x5ad0bf){return{'membername':_0x5ad0bf[_0x67cd('0x3e')],'UserId':_0x5ad0bf['id'],'queue_name':_0x312195[_0x67cd('0x3e')],'ChatQueueId':_0x312195['id'],'interface':util['format'](_0x67cd('0x6d'),_0x67cd('0x6e'),_0x5ad0bf['name']),'penalty':0x0,'paused':_0x5ad0bf[_0x67cd('0x6b')],'createdAt':_0x5ad0bf['createdAt'],'updatedAt':_0x5ad0bf[_0x67cd('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x67cd('0x23')](respondWithFilteredResult(_0x5d927d,_0x1cba72))[_0x67cd('0x2d')](handleError(_0x5d927d,null));};exports[_0x67cd('0x70')]=function(_0x5282f4,_0x530f19,_0x2ebf1f){var _0xf763d9={};var _0xcff72b={};var _0x7aab89;var _0xa0fd00;return db[_0x67cd('0x42')][_0x67cd('0x65')]({'where':{'id':_0x5282f4[_0x67cd('0x62')]['id']}})[_0x67cd('0x23')](handleEntityNotFound(_0x530f19,null))['then'](function(_0x37f8b5){if(_0x37f8b5){_0x7aab89=_0x37f8b5;_0xcff72b[_0x67cd('0x45')]=_[_0x67cd('0x58')](db[_0x67cd('0x71')]['rawAttributes']);_0xcff72b[_0x67cd('0x46')]=_[_0x67cd('0x58')](_0x5282f4[_0x67cd('0x46')]);_0xcff72b['filters']=_[_0x67cd('0x48')](_0xcff72b['model'],_0xcff72b[_0x67cd('0x46')]);_0xf763d9[_0x67cd('0x49')]=_['intersection'](_0xcff72b[_0x67cd('0x45')],qs[_0x67cd('0x4a')](_0x5282f4[_0x67cd('0x46')][_0x67cd('0x4a')]));_0xf763d9[_0x67cd('0x49')]=_0xf763d9['attributes']['length']?_0xf763d9[_0x67cd('0x49')]:_0xcff72b[_0x67cd('0x45')];_0xf763d9['order']=qs[_0x67cd('0x4e')](_0x5282f4[_0x67cd('0x46')][_0x67cd('0x4e')]);_0xf763d9['where']=qs[_0x67cd('0x47')](_[_0x67cd('0x50')](_0x5282f4['query'],_0xcff72b[_0x67cd('0x47')]));if(_0x5282f4[_0x67cd('0x46')][_0x67cd('0x52')]){_0xf763d9['where']=_['merge'](_0xf763d9[_0x67cd('0x4f')],{'$or':_[_0x67cd('0x41')](_0xf763d9[_0x67cd('0x49')],function(_0x4daf2a){var _0x129ca2={};_0x129ca2[_0x4daf2a]={'$like':'%'+_0x5282f4[_0x67cd('0x46')][_0x67cd('0x52')]+'%'};return _0x129ca2;})});}_0xf763d9=_[_0x67cd('0x59')]({},_0xf763d9,_0x5282f4['options']);return _0x7aab89[_0x67cd('0x70')](_0xf763d9);}})[_0x67cd('0x23')](function(_0x13ed2c){if(_0x13ed2c){_0xa0fd00=_0x13ed2c[_0x67cd('0x4b')];if(!_0x5282f4['query']['hasOwnProperty'](_0x67cd('0x4c'))){_0xf763d9['limit']=qs[_0x67cd('0x34')](_0x5282f4[_0x67cd('0x46')][_0x67cd('0x34')]);_0xf763d9[_0x67cd('0x33')]=qs[_0x67cd('0x33')](_0x5282f4[_0x67cd('0x46')]['offset']);}return _0x7aab89[_0x67cd('0x70')](_0xf763d9);}})[_0x67cd('0x23')](function(_0x1f66ee){if(_0x1f66ee){return _0x1f66ee?{'count':_0xa0fd00,'rows':_0x1f66ee}:null;}})[_0x67cd('0x23')](respondWithResult(_0x530f19,null))[_0x67cd('0x2d')](handleError(_0x530f19,null));};exports['addTeams']=function(_0x296a5d,_0x36d848,_0x598e1a){var _0x5d584b=_0x296a5d['body'][_0x67cd('0x72')];return db[_0x67cd('0x71')][_0x67cd('0x56')]({'where':{'id':_0x5d584b},'attributes':['id'],'include':[{'model':db[_0x67cd('0x68')],'as':_0x67cd('0x73'),'attributes':['id',_0x67cd('0x3e'),_0x67cd('0x74'),'voicePause','interface'],'raw':!![]}]})[_0x67cd('0x23')](function(_0x3feda4){if(_0x3feda4){var _0x138600=_[_0x67cd('0x75')](_0x3feda4,function(_0x1e8dec){var _0x4da441=_0x1e8dec[_0x67cd('0x3a')]({'plain':!![]});return _0x4da441[_0x67cd('0x73')];});return db[_0x67cd('0x42')][_0x67cd('0x5a')]({'where':{'id':_0x296a5d[_0x67cd('0x62')]['id']}})[_0x67cd('0x23')](function(_0x1439f4){return db['sequelize']['transaction'](function(_0x493a15){return _0x1439f4[_0x67cd('0x76')](_0x5d584b,{'transaction':_0x493a15})['then'](function(){return BPromise[_0x67cd('0x77')](_0x138600,function(_0x5c5eaf){return db[_0x67cd('0x66')][_0x67cd('0x78')]({'where':{'UserId':_0x5c5eaf['id'],'ChatQueueId':_0x296a5d['params']['id']},'transaction':_0x493a15});});})['then'](function(){_0x138600[_0x67cd('0x79')](function(_0x5275af){socket[_0x67cd('0x7a')]('userChatQueue:save',{'UserId':_0x5275af['id'],'ChatQueueId':_0x1439f4['id']});});});});});}})[_0x67cd('0x23')](respondWithStatusCode(_0x36d848,null))[_0x67cd('0x2d')](handleError(_0x36d848,null));};exports['removeTeams']=function(_0x4fb69e,_0x55eac2,_0x11b88c){return db['Team'][_0x67cd('0x56')]({'where':{'id':_0x4fb69e['query'][_0x67cd('0x72')]},'attributes':['id'],'include':[{'model':db[_0x67cd('0x68')],'as':_0x67cd('0x73'),'attributes':['id'],'raw':!![]}]})[_0x67cd('0x23')](handleEntityNotFound(_0x55eac2,null))['then'](function(_0x110d41){var _0x549fb0=_[_0x67cd('0x41')](_0x110d41,'id');var _0x1d8b7b=[];var _0x129fd7=[];var _0x287879=squel[_0x67cd('0x7b')]();_0x287879[_0x67cd('0x7c')](_0x67cd('0x7d'))[_0x67cd('0x7e')](_0x67cd('0x7f'),'tq')[_0x67cd('0x80')](_0x67cd('0x81'),'ut',_0x67cd('0x82'))['where'](_0x67cd('0x83'),_0x4fb69e[_0x67cd('0x62')]['id']);for(var _0xd9fc60=0x0;_0xd9fc60<_0x110d41[_0x67cd('0x4b')];_0xd9fc60+=0x1){let _0x139e9d=_0x110d41[_0xd9fc60];for(var _0x4ed96f=0x0;_0x4ed96f<_0x139e9d['Agents'][_0x67cd('0x4b')];_0x4ed96f+=0x1){let _0x313e3d=_0x139e9d[_0x67cd('0x73')][_0x4ed96f];var _0x452290=_0x287879[_0x67cd('0x84')]();_0x452290[_0x67cd('0x4f')](_0x67cd('0x85'),_0x313e3d['id']);_0x129fd7[_0x67cd('0x86')](db[_0x67cd('0x87')]['query'](_0x452290[_0x67cd('0x88')](),{'type':db['sequelize']['QueryTypes'][_0x67cd('0x89')]})[_0x67cd('0x23')](function(_0x2b233d){if(_0x2b233d[_0x67cd('0x4b')]===0x1){return _0x313e3d['id'];}else{var _0x19a0fa=_[_0x67cd('0x8a')](_[_0x67cd('0x41')](_0x2b233d,'TeamId'),function(_0x27fdfd){return _['includes'](_0x549fb0,_0x27fdfd);});if(_0x19a0fa){return _0x313e3d['id'];}}}));}}return BPromise[_0x67cd('0x8b')](_0x129fd7)['then'](function(_0x73887f){_0x1d8b7b=_(_0x1d8b7b)['union'](_0x73887f)[_0x67cd('0x8c')]()[_0x67cd('0x8d')]();return db['ChatQueue'][_0x67cd('0x5a')]({'where':{'id':_0x4fb69e[_0x67cd('0x62')]['id']}})[_0x67cd('0x23')](function(_0x329dfb){return db[_0x67cd('0x87')][_0x67cd('0x8e')](function(_0x160f30){return _0x329dfb['removeTeams'](_0x4fb69e[_0x67cd('0x46')][_0x67cd('0x72')],{'transaction':_0x160f30})['then'](function(){if(!_[_0x67cd('0x8f')](_0x1d8b7b)){return _0x329dfb[_0x67cd('0x90')](_0x1d8b7b,{'transaction':_0x160f30});}})[_0x67cd('0x23')](function(){_0x1d8b7b[_0x67cd('0x79')](function(_0x24fba3){socket[_0x67cd('0x7a')]('userChatQueue:remove',{'UserId':_0x24fba3,'ChatQueueId':_0x329dfb['id']});});});});});});})[_0x67cd('0x23')](respondWithStatusCode(_0x55eac2,null))['catch'](handleError(_0x55eac2,null));};exports[_0x67cd('0x91')]=function(_0x5327ec,_0x5c6fcf,_0x457efd){return db[_0x67cd('0x42')][_0x67cd('0x5a')]({'where':{'id':_0x5327ec[_0x67cd('0x62')]['id']}})[_0x67cd('0x23')](handleEntityNotFound(_0x5c6fcf,null))[_0x67cd('0x23')](function(_0x1dbd67){if(_0x1dbd67){return _0x1dbd67[_0x67cd('0x91')](_0x5327ec[_0x67cd('0x5c')][_0x67cd('0x72')],_[_0x67cd('0x92')](_0x5327ec['body'],[_0x67cd('0x72'),'id'])||{})[_0x67cd('0x93')](function(_0x17da88){for(var _0x58cfc9=0x0;_0x58cfc9<_0x5327ec[_0x67cd('0x5c')]['ids'][_0x67cd('0x4b')];_0x58cfc9+=0x1){socket[_0x67cd('0x7a')]('userChatQueue:save',{'UserId':_0x5327ec[_0x67cd('0x5c')][_0x67cd('0x72')][_0x58cfc9],'ChatQueueId':_0x5327ec['params']['id']});}return _0x17da88;});}})[_0x67cd('0x23')](respondWithResult(_0x5c6fcf,null))[_0x67cd('0x2d')](handleError(_0x5c6fcf,null));};exports['removeAgents']=function(_0x55a748,_0x405ff9,_0x47351c){return db[_0x67cd('0x42')][_0x67cd('0x5a')]({'where':{'id':_0x55a748[_0x67cd('0x62')]['id']}})[_0x67cd('0x23')](handleEntityNotFound(_0x405ff9,null))['then'](function(_0x5df0e5){if(_0x5df0e5){return _0x5df0e5[_0x67cd('0x90')](_0x55a748['query'][_0x67cd('0x72')])[_0x67cd('0x23')](function(){if(_[_0x67cd('0x94')](_0x55a748[_0x67cd('0x46')][_0x67cd('0x72')])){for(var _0x20ccfa=0x0;_0x20ccfa<_0x55a748[_0x67cd('0x46')][_0x67cd('0x72')][_0x67cd('0x4b')];_0x20ccfa+=0x1){socket[_0x67cd('0x7a')](_0x67cd('0x95'),{'UserId':Number(_0x55a748[_0x67cd('0x46')]['ids'][_0x20ccfa]),'ChatQueueId':Number(_0x55a748[_0x67cd('0x62')]['id'])});}}else{socket[_0x67cd('0x7a')]('userChatQueue:remove',{'UserId':Number(_0x55a748['query']['ids']),'ChatQueueId':Number(_0x55a748[_0x67cd('0x62')]['id'])});}});}})[_0x67cd('0x23')](respondWithStatusCode(_0x405ff9,null))[_0x67cd('0x2d')](handleError(_0x405ff9,null));};exports['getAgents']=function(_0x450ea3,_0xf9906e,_0x38aeb3){var _0x193b31={};var _0x492884={};var _0x18f36f;var _0x33e4de;return db['ChatQueue'][_0x67cd('0x65')]({'where':{'id':_0x450ea3['params']['id']}})[_0x67cd('0x23')](handleEntityNotFound(_0xf9906e,null))[_0x67cd('0x23')](function(_0x5175a1){if(_0x5175a1){_0x18f36f=_0x5175a1;_0x492884['model']=_[_0x67cd('0x58')](db[_0x67cd('0x68')][_0x67cd('0x43')]);_0x492884['query']=_[_0x67cd('0x58')](_0x450ea3[_0x67cd('0x46')]);_0x492884[_0x67cd('0x47')]=_[_0x67cd('0x48')](_0x492884[_0x67cd('0x45')],_0x492884[_0x67cd('0x46')]);_0x193b31['attributes']=_[_0x67cd('0x48')](_0x492884['model'],qs[_0x67cd('0x4a')](_0x450ea3[_0x67cd('0x46')]['fields']));_0x193b31[_0x67cd('0x49')]=_0x193b31[_0x67cd('0x49')]['length']?_0x193b31['attributes']:_0x492884['model'];_0x193b31[_0x67cd('0x4d')]=qs[_0x67cd('0x4e')](_0x450ea3[_0x67cd('0x46')]['sort']);_0x193b31[_0x67cd('0x4f')]=qs[_0x67cd('0x47')](_[_0x67cd('0x50')](_0x450ea3['query'],_0x492884[_0x67cd('0x47')]));if(_0x450ea3[_0x67cd('0x46')][_0x67cd('0x52')]){_0x193b31['where']=_[_0x67cd('0x59')](_0x193b31[_0x67cd('0x4f')],{'$or':_[_0x67cd('0x41')](_0x193b31[_0x67cd('0x49')],function(_0x291c12){var _0x552374={};_0x552374[_0x291c12]={'$like':'%'+_0x450ea3[_0x67cd('0x46')][_0x67cd('0x52')]+'%'};return _0x552374;})});}_0x193b31=_['merge']({},_0x193b31,_0x450ea3[_0x67cd('0x53')]);return _0x18f36f['getAgents'](_0x193b31);}})[_0x67cd('0x23')](function(_0x55906b){if(_0x55906b){_0x33e4de=_0x55906b[_0x67cd('0x4b')];if(!_0x450ea3['query']['hasOwnProperty'](_0x67cd('0x4c'))){_0x193b31[_0x67cd('0x34')]=qs[_0x67cd('0x34')](_0x450ea3[_0x67cd('0x46')][_0x67cd('0x34')]);_0x193b31[_0x67cd('0x33')]=qs[_0x67cd('0x33')](_0x450ea3[_0x67cd('0x46')][_0x67cd('0x33')]);}return _0x18f36f[_0x67cd('0x96')](_0x193b31);}})['then'](function(_0x139930){if(_0x139930){return _0x139930?{'count':_0x33e4de,'rows':_0x139930}:null;}})['then'](respondWithResult(_0xf9906e,null))[_0x67cd('0x2d')](handleError(_0xf9906e,null));}; \ No newline at end of file +var _0xa1ca=['QueryTypes','SELECT','every','includes','all','union','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','http','Sequelize','ValidationError','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','UserProfileResource','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','filter','options','findAll','show','include','find','create','body','user','get','role','userProfileId','autoAssociation','params','describe','getMembers','findOne','UserChatQueue','sort','merge','UserId','updatedAt','format','chatPause','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','sequelize','transaction','each','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push'];(function(_0x50cb1d,_0x23de00){var _0x27c8d5=function(_0xa77d2c){while(--_0xa77d2c){_0x50cb1d['push'](_0x50cb1d['shift']());}};_0x27c8d5(++_0x23de00);}(_0xa1ca,0x12d));var _0xaa1c=function(_0x267390,_0x1733f2){_0x267390=_0x267390-0x0;var _0x19c5a9=_0xa1ca[_0x267390];return _0x19c5a9;};'use strict';var pdf=require(_0xaa1c('0x0'));var emlformat=require(_0xaa1c('0x1'));var rimraf=require(_0xaa1c('0x2'));var zipdir=require(_0xaa1c('0x3'));var jsonpatch=require(_0xaa1c('0x4'));var rp=require(_0xaa1c('0x5'));var moment=require('moment');var BPromise=require(_0xaa1c('0x6'));var Mustache=require(_0xaa1c('0x7'));var util=require(_0xaa1c('0x8'));var path=require(_0xaa1c('0x9'));var sox=require(_0xaa1c('0xa'));var csv=require(_0xaa1c('0xb'));var ejs=require(_0xaa1c('0xc'));var fs=require('fs');var _=require(_0xaa1c('0xd'));var squel=require(_0xaa1c('0xe'));var crypto=require(_0xaa1c('0xf'));var jsforce=require(_0xaa1c('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaa1c('0x11'));var Papa=require(_0xaa1c('0x12'));var Redis=require(_0xaa1c('0x13'));var authService=require(_0xaa1c('0x14'));var qs=require(_0xaa1c('0x15'));var as=require(_0xaa1c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa1c('0x17'));var utils=require(_0xaa1c('0x18'));var config=require(_0xaa1c('0x19'));var db=require(_0xaa1c('0x1a'))['db'];config[_0xaa1c('0x1b')]=_[_0xaa1c('0x1c')](config[_0xaa1c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa1c('0x1d'))(new Redis(config[_0xaa1c('0x1b')]));require('./chatQueue.socket')[_0xaa1c('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xaa1c('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x214244,_0x5f0f8c,_0xea774a){if(_0xea774a){var _0x513a5c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x513a5c['test'](_0x5f0f8c)){return _0x214244;}else{throw new db[(_0xaa1c('0x20'))][(_0xaa1c('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 _0x214244;}}function respondWithRpcPromise(_0x26e360,_0x34b39f,_0x391b6e,_0x8f4250){return new BPromise(function(_0x489ec4,_0x4b86d5){var _0x4f6ce6=_0x8f4250||client;return _0x4f6ce6[_0xaa1c('0x22')](_0x26e360,_0x391b6e)[_0xaa1c('0x23')](function(_0x563280){logger[_0xaa1c('0x24')](_0xaa1c('0x25'),_0x34b39f,_0xaa1c('0x26'));logger[_0xaa1c('0x27')](_0xaa1c('0x28'),_0x34b39f,_0xaa1c('0x26'),JSON['stringify'](_0x563280));if(_0x563280[_0xaa1c('0x29')]){if(_0x563280[_0xaa1c('0x29')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x34b39f,_0x563280[_0xaa1c('0x29')][_0xaa1c('0x2a')]);return _0x4b86d5(_0x563280[_0xaa1c('0x29')][_0xaa1c('0x2a')]);}logger[_0xaa1c('0x29')](_0xaa1c('0x25'),_0x34b39f,_0x563280[_0xaa1c('0x29')]['message']);return _0x489ec4(_0x563280[_0xaa1c('0x29')][_0xaa1c('0x2a')]);}else{logger[_0xaa1c('0x24')]('ChatQueue,\x20%s,\x20%s',_0x34b39f,_0xaa1c('0x26'));_0x489ec4(_0x563280['result'][_0xaa1c('0x2a')]);}})[_0xaa1c('0x2b')](function(_0x42201a){logger[_0xaa1c('0x29')](_0xaa1c('0x25'),_0x34b39f,_0x42201a);_0x4b86d5(_0x42201a);});});}function respondWithStatusCode(_0x3a5759,_0x53e5cd){_0x53e5cd=_0x53e5cd||0xcc;return function(_0x1dd25c){if(_0x1dd25c){return _0x3a5759['sendStatus'](_0x53e5cd);}return _0x3a5759[_0xaa1c('0x2c')](_0x53e5cd)[_0xaa1c('0x2d')]();};}function respondWithResult(_0x5e9cbb,_0xdf86cf){_0xdf86cf=_0xdf86cf||0xc8;return function(_0x26ff3c){if(_0x26ff3c){return _0x5e9cbb[_0xaa1c('0x2c')](_0xdf86cf)[_0xaa1c('0x2e')](_0x26ff3c);}};}function respondWithFilteredResult(_0x1ead35,_0x3e9bb5){return function(_0x4a777e){if(_0x4a777e){var _0x598c7c=_0x4a777e[_0xaa1c('0x2f')],_0x1fbaac=_0x3e9bb5[_0xaa1c('0x30')],_0x87d051=_0x3e9bb5[_0xaa1c('0x30')]+_0x3e9bb5[_0xaa1c('0x31')],_0x358ed9;if(_0x87d051>=_0x598c7c){_0x87d051=_0x598c7c;_0x358ed9=0xc8;}else{_0x358ed9=0xce;}_0x1ead35['status'](_0x358ed9);return _0x1ead35[_0xaa1c('0x32')](_0xaa1c('0x33'),_0x1fbaac+'-'+_0x87d051+'/'+_0x598c7c)[_0xaa1c('0x2e')](_0x4a777e);}return null;};}function patchUpdates(_0x26d2f9){return function(_0x32b087){try{jsonpatch[_0xaa1c('0x34')](_0x32b087,_0x26d2f9,!![]);}catch(_0x10e605){return BPromise[_0xaa1c('0x35')](_0x10e605);}return _0x32b087['save']();};}function saveUpdates(_0x2a0102,_0x5f0097){return function(_0x586cd4){if(_0x586cd4){return _0x586cd4[_0xaa1c('0x36')](_0x2a0102)[_0xaa1c('0x23')](function(_0x3ffca3){return _0x3ffca3;});}return null;};}function removeEntity(_0x3b46dc,_0x1bc6d6){return function(_0x460063){if(_0x460063){return _0x460063[_0xaa1c('0x37')]()['then'](function(){var _0x425fb6=_0x460063['get']({'plain':!![]});var _0x95188f='ChatQueues';return db[_0xaa1c('0x38')][_0xaa1c('0x37')]({'where':{'type':_0x95188f,'resourceId':_0x425fb6['id']}})[_0xaa1c('0x23')](function(){return _0x460063;});})['then'](function(){_0x3b46dc[_0xaa1c('0x2c')](0xcc)[_0xaa1c('0x2d')]();});}};}function handleEntityNotFound(_0x37dd6b,_0x5c038e){return function(_0x487479){if(!_0x487479){_0x37dd6b[_0xaa1c('0x39')](0x194);}return _0x487479;};}function handleError(_0xa1820f,_0x281640){_0x281640=_0x281640||0x1f4;return function(_0x48c66c){logger['error'](_0x48c66c[_0xaa1c('0x3a')]);if(_0x48c66c[_0xaa1c('0x3b')]){delete _0x48c66c['name'];}_0xa1820f[_0xaa1c('0x2c')](_0x281640)[_0xaa1c('0x3c')](_0x48c66c);};}exports[_0xaa1c('0x3d')]=function(_0x279475,_0x347924){var _0x5bab09={},_0x3bdecf={},_0x2c5963={'count':0x0,'rows':[]};var _0xd068d6=_[_0xaa1c('0x3e')](db[_0xaa1c('0x3f')][_0xaa1c('0x40')],function(_0x5ac8c6){return{'name':_0x5ac8c6[_0xaa1c('0x41')],'type':_0x5ac8c6[_0xaa1c('0x42')]['key']};});_0x3bdecf[_0xaa1c('0x43')]=_['map'](_0xd068d6,_0xaa1c('0x3b'));_0x3bdecf['query']=_[_0xaa1c('0x44')](_0x279475['query']);_0x3bdecf[_0xaa1c('0x45')]=_[_0xaa1c('0x46')](_0x3bdecf[_0xaa1c('0x43')],_0x3bdecf[_0xaa1c('0x47')]);_0x5bab09[_0xaa1c('0x48')]=_[_0xaa1c('0x46')](_0x3bdecf['model'],qs[_0xaa1c('0x49')](_0x279475[_0xaa1c('0x47')]['fields']));_0x5bab09['attributes']=_0x5bab09[_0xaa1c('0x48')][_0xaa1c('0x4a')]?_0x5bab09[_0xaa1c('0x48')]:_0x3bdecf[_0xaa1c('0x43')];if(!_0x279475[_0xaa1c('0x47')][_0xaa1c('0x4b')](_0xaa1c('0x4c'))){_0x5bab09['limit']=qs[_0xaa1c('0x31')](_0x279475[_0xaa1c('0x47')]['limit']);_0x5bab09[_0xaa1c('0x30')]=qs[_0xaa1c('0x30')](_0x279475['query'][_0xaa1c('0x30')]);}_0x5bab09[_0xaa1c('0x4d')]=qs['sort'](_0x279475[_0xaa1c('0x47')]['sort']);_0x5bab09[_0xaa1c('0x4e')]=qs['filters'](_[_0xaa1c('0x4f')](_0x279475['query'],_0x3bdecf[_0xaa1c('0x45')]),_0xd068d6);if(_0x279475[_0xaa1c('0x47')]['filter']){_0x5bab09['where']=_['merge'](_0x5bab09['where'],{'$or':_[_0xaa1c('0x3e')](_0xd068d6,function(_0x27b919){if(_0x27b919[_0xaa1c('0x42')]!==_0xaa1c('0x50')){var _0xc9eaf5={};_0xc9eaf5[_0x27b919[_0xaa1c('0x3b')]]={'$like':'%'+_0x279475[_0xaa1c('0x47')][_0xaa1c('0x51')]+'%'};return _0xc9eaf5;}})});}_0x5bab09=_['merge']({},_0x5bab09,_0x279475[_0xaa1c('0x52')]);var _0x344d79={'where':_0x5bab09['where']};return db[_0xaa1c('0x3f')][_0xaa1c('0x2f')](_0x344d79)['then'](function(_0x5dec5a){_0x2c5963[_0xaa1c('0x2f')]=_0x5dec5a;if(_0x279475[_0xaa1c('0x47')]['includeAll']){_0x5bab09['include']=[{'all':!![]}];}return db[_0xaa1c('0x3f')][_0xaa1c('0x53')](_0x5bab09);})['then'](function(_0x1d7037){_0x2c5963['rows']=_0x1d7037;return _0x2c5963;})[_0xaa1c('0x23')](respondWithFilteredResult(_0x347924,_0x5bab09))[_0xaa1c('0x2b')](handleError(_0x347924,null));};exports[_0xaa1c('0x54')]=function(_0x433297,_0x4c0a3c){var _0x518330={'raw':!![],'where':{'id':_0x433297['params']['id']}},_0x541c18={};_0x541c18[_0xaa1c('0x43')]=_[_0xaa1c('0x44')](db['ChatQueue'][_0xaa1c('0x40')]);_0x541c18[_0xaa1c('0x47')]=_[_0xaa1c('0x44')](_0x433297[_0xaa1c('0x47')]);_0x541c18[_0xaa1c('0x45')]=_['intersection'](_0x541c18[_0xaa1c('0x43')],_0x541c18[_0xaa1c('0x47')]);_0x518330[_0xaa1c('0x48')]=_[_0xaa1c('0x46')](_0x541c18[_0xaa1c('0x43')],qs[_0xaa1c('0x49')](_0x433297[_0xaa1c('0x47')][_0xaa1c('0x49')]));_0x518330[_0xaa1c('0x48')]=_0x518330['attributes'][_0xaa1c('0x4a')]?_0x518330[_0xaa1c('0x48')]:_0x541c18[_0xaa1c('0x43')];if(_0x433297['query']['includeAll']){_0x518330[_0xaa1c('0x55')]=[{'all':!![]}];}_0x518330=_['merge']({},_0x518330,_0x433297[_0xaa1c('0x52')]);return db[_0xaa1c('0x3f')][_0xaa1c('0x56')](_0x518330)['then'](handleEntityNotFound(_0x4c0a3c,null))[_0xaa1c('0x23')](respondWithResult(_0x4c0a3c,null))['catch'](handleError(_0x4c0a3c,null));};exports[_0xaa1c('0x57')]=function(_0x5f20c3,_0x21d3fa){return db[_0xaa1c('0x3f')][_0xaa1c('0x57')](_0x5f20c3[_0xaa1c('0x58')],{})[_0xaa1c('0x23')](function(_0x4ea400){var _0x1e6d5b=_0x5f20c3[_0xaa1c('0x59')][_0xaa1c('0x5a')]({'plain':!![]});if(!_0x1e6d5b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e6d5b[_0xaa1c('0x5b')]===_0xaa1c('0x59')){var _0x1d0a6d=_0x4ea400['get']({'plain':!![]});var _0x307719='ChatQueues';return db['UserProfileSection'][_0xaa1c('0x56')]({'where':{'name':_0x307719,'userProfileId':_0x1e6d5b[_0xaa1c('0x5c')]},'raw':!![]})[_0xaa1c('0x23')](function(_0x4bdf84){if(_0x4bdf84&&_0x4bdf84[_0xaa1c('0x5d')]===0x0){return db[_0xaa1c('0x38')]['create']({'name':_0x1d0a6d['name'],'resourceId':_0x1d0a6d['id'],'type':_0x4bdf84[_0xaa1c('0x3b')],'sectionId':_0x4bdf84['id']},{})[_0xaa1c('0x23')](function(){return _0x4ea400;});}else{return _0x4ea400;}})['catch'](function(_0x26f67c){logger[_0xaa1c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26f67c);throw _0x26f67c;});}return _0x4ea400;})[_0xaa1c('0x23')](respondWithResult(_0x21d3fa,0xc9))[_0xaa1c('0x2b')](handleError(_0x21d3fa,null));};exports['update']=function(_0x2d9ab9,_0x379496){if(_0x2d9ab9[_0xaa1c('0x58')]['id']){delete _0x2d9ab9[_0xaa1c('0x58')]['id'];}return db['ChatQueue'][_0xaa1c('0x56')]({'where':{'id':_0x2d9ab9['params']['id']}})['then'](handleEntityNotFound(_0x379496,null))[_0xaa1c('0x23')](saveUpdates(_0x2d9ab9[_0xaa1c('0x58')],null))[_0xaa1c('0x23')](respondWithResult(_0x379496,null))[_0xaa1c('0x2b')](handleError(_0x379496,null));};exports[_0xaa1c('0x37')]=function(_0x24421e,_0x1d55bc){return db[_0xaa1c('0x3f')]['find']({'where':{'id':_0x24421e[_0xaa1c('0x5e')]['id']}})[_0xaa1c('0x23')](handleEntityNotFound(_0x1d55bc,null))[_0xaa1c('0x23')](removeEntity(_0x1d55bc,null))['catch'](handleError(_0x1d55bc,null));};exports[_0xaa1c('0x5f')]=function(_0x1aff6f,_0x1e2394){return db[_0xaa1c('0x3f')][_0xaa1c('0x5f')]()[_0xaa1c('0x23')](respondWithResult(_0x1e2394,null))['catch'](handleError(_0x1e2394,null));};exports[_0xaa1c('0x60')]=function(_0x3f0301,_0x230b2d,_0x41bd2e){var _0x404d93={'raw':!![],'where':{}},_0xb1cbb6={},_0x1dbc38;return db[_0xaa1c('0x3f')][_0xaa1c('0x61')]({'where':{'id':_0x3f0301[_0xaa1c('0x5e')]['id']}})[_0xaa1c('0x23')](handleEntityNotFound(_0x230b2d,null))['then'](function(_0x53afaa){if(_0x53afaa){_0x1dbc38=_0x53afaa[_0xaa1c('0x5a')]({'plain':!![]});_0xb1cbb6['model']=_[_0xaa1c('0x44')](db[_0xaa1c('0x62')][_0xaa1c('0x40')]);_0xb1cbb6[_0xaa1c('0x47')]=_['keys'](_0x3f0301[_0xaa1c('0x47')]);_0xb1cbb6[_0xaa1c('0x45')]=_[_0xaa1c('0x46')](_0xb1cbb6[_0xaa1c('0x43')],_0xb1cbb6[_0xaa1c('0x47')]);_0x404d93[_0xaa1c('0x48')]=_['intersection'](_0xb1cbb6['model'],qs['fields'](_0x3f0301[_0xaa1c('0x47')][_0xaa1c('0x49')]));_0x404d93[_0xaa1c('0x48')]=_0x404d93[_0xaa1c('0x48')][_0xaa1c('0x4a')]?_0x404d93[_0xaa1c('0x48')]:_0xb1cbb6[_0xaa1c('0x43')];if(!_0x3f0301[_0xaa1c('0x47')][_0xaa1c('0x4b')](_0xaa1c('0x4c'))){_0x404d93['limit']=qs[_0xaa1c('0x31')](_0x3f0301['query'][_0xaa1c('0x31')]);_0x404d93[_0xaa1c('0x30')]=qs[_0xaa1c('0x30')](_0x3f0301[_0xaa1c('0x47')][_0xaa1c('0x30')]);}_0x404d93[_0xaa1c('0x4d')]=qs[_0xaa1c('0x63')](_0x3f0301[_0xaa1c('0x47')][_0xaa1c('0x63')]);_0x404d93[_0xaa1c('0x4e')]=qs['filters'](_[_0xaa1c('0x4f')](_0x3f0301['query'],_0xb1cbb6['filters']));_0x404d93[_0xaa1c('0x4e')]['ChatQueueId']=_0x53afaa['id'];if(_0x3f0301[_0xaa1c('0x47')][_0xaa1c('0x51')]){_0x404d93[_0xaa1c('0x4e')]=_[_0xaa1c('0x64')](_0x404d93[_0xaa1c('0x4e')],{'$or':_[_0xaa1c('0x3e')](_0x404d93[_0xaa1c('0x48')],function(_0x160a73){var _0x44f7d1={};_0x44f7d1[_0x160a73]={'$like':'%'+_0x3f0301['query'][_0xaa1c('0x51')]+'%'};return _0x44f7d1;})});}_0x404d93=_[_0xaa1c('0x64')]({},_0x404d93,_0x3f0301[_0xaa1c('0x52')]);return db['UserChatQueue'][_0xaa1c('0x53')](_0x404d93);}})[_0xaa1c('0x23')](function(_0x431fb0){if(_0x431fb0){return db['User']['findAndCountAll']({'where':{'id':_[_0xaa1c('0x3e')](_0x431fb0,_0xaa1c('0x65')),'role':'agent'},'attributes':['id',_0xaa1c('0x3b'),'chatPause',_0xaa1c('0x66'),'createdAt']});}})[_0xaa1c('0x23')](function(_0x21fae3){if(_0x21fae3){return{'count':_0x21fae3[_0xaa1c('0x2f')],'rows':_['map'](_0x21fae3['rows'],function(_0x4a9d38){return{'membername':_0x4a9d38['name'],'UserId':_0x4a9d38['id'],'queue_name':_0x1dbc38['name'],'ChatQueueId':_0x1dbc38['id'],'interface':util[_0xaa1c('0x67')]('%s/%s','SIP',_0x4a9d38['name']),'penalty':0x0,'paused':_0x4a9d38[_0xaa1c('0x68')],'createdAt':_0x4a9d38[_0xaa1c('0x69')],'updatedAt':_0x4a9d38[_0xaa1c('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaa1c('0x23')](respondWithFilteredResult(_0x230b2d,_0x404d93))[_0xaa1c('0x2b')](handleError(_0x230b2d,null));};exports[_0xaa1c('0x6a')]=function(_0x509ea1,_0x9609f0,_0x8b032d){var _0x23a6d0={};var _0x10e498={};var _0x5806fd;var _0x69b07f;return db[_0xaa1c('0x3f')][_0xaa1c('0x61')]({'where':{'id':_0x509ea1[_0xaa1c('0x5e')]['id']}})[_0xaa1c('0x23')](handleEntityNotFound(_0x9609f0,null))['then'](function(_0x415d19){if(_0x415d19){_0x5806fd=_0x415d19;_0x10e498[_0xaa1c('0x43')]=_['keys'](db[_0xaa1c('0x6b')][_0xaa1c('0x40')]);_0x10e498[_0xaa1c('0x47')]=_['keys'](_0x509ea1['query']);_0x10e498[_0xaa1c('0x45')]=_['intersection'](_0x10e498[_0xaa1c('0x43')],_0x10e498['query']);_0x23a6d0[_0xaa1c('0x48')]=_[_0xaa1c('0x46')](_0x10e498[_0xaa1c('0x43')],qs['fields'](_0x509ea1[_0xaa1c('0x47')][_0xaa1c('0x49')]));_0x23a6d0[_0xaa1c('0x48')]=_0x23a6d0[_0xaa1c('0x48')][_0xaa1c('0x4a')]?_0x23a6d0[_0xaa1c('0x48')]:_0x10e498[_0xaa1c('0x43')];_0x23a6d0['order']=qs['sort'](_0x509ea1[_0xaa1c('0x47')][_0xaa1c('0x63')]);_0x23a6d0['where']=qs['filters'](_[_0xaa1c('0x4f')](_0x509ea1['query'],_0x10e498[_0xaa1c('0x45')]));if(_0x509ea1['query'][_0xaa1c('0x51')]){_0x23a6d0[_0xaa1c('0x4e')]=_[_0xaa1c('0x64')](_0x23a6d0[_0xaa1c('0x4e')],{'$or':_[_0xaa1c('0x3e')](_0x23a6d0[_0xaa1c('0x48')],function(_0x229449){var _0x54bab1={};_0x54bab1[_0x229449]={'$like':'%'+_0x509ea1[_0xaa1c('0x47')][_0xaa1c('0x51')]+'%'};return _0x54bab1;})});}_0x23a6d0=_['merge']({},_0x23a6d0,_0x509ea1[_0xaa1c('0x52')]);return _0x5806fd[_0xaa1c('0x6a')](_0x23a6d0);}})['then'](function(_0x1f927e){if(_0x1f927e){_0x69b07f=_0x1f927e[_0xaa1c('0x4a')];if(!_0x509ea1[_0xaa1c('0x47')][_0xaa1c('0x4b')]('nolimit')){_0x23a6d0[_0xaa1c('0x31')]=qs[_0xaa1c('0x31')](_0x509ea1[_0xaa1c('0x47')]['limit']);_0x23a6d0[_0xaa1c('0x30')]=qs[_0xaa1c('0x30')](_0x509ea1[_0xaa1c('0x47')][_0xaa1c('0x30')]);}return _0x5806fd[_0xaa1c('0x6a')](_0x23a6d0);}})[_0xaa1c('0x23')](function(_0x974dc6){if(_0x974dc6){return _0x974dc6?{'count':_0x69b07f,'rows':_0x974dc6}:null;}})['then'](respondWithResult(_0x9609f0,null))[_0xaa1c('0x2b')](handleError(_0x9609f0,null));};exports[_0xaa1c('0x6c')]=function(_0x2306b4,_0x466900,_0x3a7ef0){var _0x1d9710=_0x2306b4[_0xaa1c('0x58')][_0xaa1c('0x6d')];return db['Team'][_0xaa1c('0x53')]({'where':{'id':_0x1d9710},'attributes':['id'],'include':[{'model':db[_0xaa1c('0x6e')],'as':_0xaa1c('0x6f'),'attributes':['id',_0xaa1c('0x3b'),_0xaa1c('0x70'),_0xaa1c('0x71'),'interface'],'raw':!![]}]})[_0xaa1c('0x23')](function(_0x384ee3){if(_0x384ee3){var _0x2b6204=_['flatMap'](_0x384ee3,function(_0x5a30a7){var _0x116386=_0x5a30a7['get']({'plain':!![]});return _0x116386['Agents'];});return db[_0xaa1c('0x3f')]['find']({'where':{'id':_0x2306b4['params']['id']}})['then'](function(_0x3e59dc){return db[_0xaa1c('0x72')][_0xaa1c('0x73')](function(_0x1c549e){return _0x3e59dc[_0xaa1c('0x6c')](_0x1d9710,{'transaction':_0x1c549e})[_0xaa1c('0x23')](function(){return BPromise[_0xaa1c('0x74')](_0x2b6204,function(_0x2368b7){return db[_0xaa1c('0x62')]['findOrCreate']({'where':{'UserId':_0x2368b7['id'],'ChatQueueId':_0x2306b4[_0xaa1c('0x5e')]['id']},'transaction':_0x1c549e});});})[_0xaa1c('0x23')](function(){_0x2b6204['forEach'](function(_0x3258a9){socket[_0xaa1c('0x75')](_0xaa1c('0x76'),{'UserId':_0x3258a9['id'],'ChatQueueId':_0x3e59dc['id']});});});});});}})['then'](respondWithStatusCode(_0x466900,null))[_0xaa1c('0x2b')](handleError(_0x466900,null));};exports[_0xaa1c('0x77')]=function(_0x3cf4df,_0x1019a8,_0xc169b2){return db['Team'][_0xaa1c('0x53')]({'where':{'id':_0x3cf4df[_0xaa1c('0x47')][_0xaa1c('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xaa1c('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xaa1c('0x23')](handleEntityNotFound(_0x1019a8,null))['then'](function(_0x12e9de){var _0x4fcde9=_[_0xaa1c('0x3e')](_0x12e9de,'id');var _0x416dc2=[];var _0x467c8e=[];var _0x5b27d7=squel[_0xaa1c('0x78')]();_0x5b27d7[_0xaa1c('0x79')](_0xaa1c('0x7a'))[_0xaa1c('0x7b')](_0xaa1c('0x7c'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xaa1c('0x7d'),_0x3cf4df[_0xaa1c('0x5e')]['id']);for(var _0x28e662=0x0;_0x28e662<_0x12e9de['length'];_0x28e662+=0x1){let _0x4bea77=_0x12e9de[_0x28e662];for(var _0x4fd139=0x0;_0x4fd139<_0x4bea77[_0xaa1c('0x6f')][_0xaa1c('0x4a')];_0x4fd139+=0x1){let _0x527001=_0x4bea77[_0xaa1c('0x6f')][_0x4fd139];var _0x474d05=_0x5b27d7['clone']();_0x474d05[_0xaa1c('0x4e')](_0xaa1c('0x7e'),_0x527001['id']);_0x467c8e[_0xaa1c('0x7f')](db[_0xaa1c('0x72')]['query'](_0x474d05['toString'](),{'type':db[_0xaa1c('0x72')][_0xaa1c('0x80')][_0xaa1c('0x81')]})[_0xaa1c('0x23')](function(_0x1e5398){if(_0x1e5398[_0xaa1c('0x4a')]===0x1){return _0x527001['id'];}else{var _0x45d09f=_[_0xaa1c('0x82')](_[_0xaa1c('0x3e')](_0x1e5398,'TeamId'),function(_0x43b1b3){return _[_0xaa1c('0x83')](_0x4fcde9,_0x43b1b3);});if(_0x45d09f){return _0x527001['id'];}}}));}}return BPromise[_0xaa1c('0x84')](_0x467c8e)[_0xaa1c('0x23')](function(_0x18b926){_0x416dc2=_(_0x416dc2)[_0xaa1c('0x85')](_0x18b926)['compact']()[_0xaa1c('0x86')]();return db[_0xaa1c('0x3f')][_0xaa1c('0x56')]({'where':{'id':_0x3cf4df['params']['id']}})[_0xaa1c('0x23')](function(_0x5cdb5b){return db['sequelize']['transaction'](function(_0x40856e){return _0x5cdb5b[_0xaa1c('0x77')](_0x3cf4df[_0xaa1c('0x47')][_0xaa1c('0x6d')],{'transaction':_0x40856e})['then'](function(){if(!_[_0xaa1c('0x87')](_0x416dc2)){return _0x5cdb5b[_0xaa1c('0x88')](_0x416dc2,{'transaction':_0x40856e});}})['then'](function(){_0x416dc2[_0xaa1c('0x89')](function(_0x4315e2){socket[_0xaa1c('0x75')](_0xaa1c('0x8a'),{'UserId':_0x4315e2,'ChatQueueId':_0x5cdb5b['id']});});});});});});})[_0xaa1c('0x23')](respondWithStatusCode(_0x1019a8,null))[_0xaa1c('0x2b')](handleError(_0x1019a8,null));};exports[_0xaa1c('0x8b')]=function(_0x25cec0,_0x133bc6,_0x1c0951){return db[_0xaa1c('0x3f')][_0xaa1c('0x56')]({'where':{'id':_0x25cec0[_0xaa1c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x133bc6,null))['then'](function(_0xc441e1){if(_0xc441e1){return _0xc441e1[_0xaa1c('0x8b')](_0x25cec0['body'][_0xaa1c('0x6d')],_[_0xaa1c('0x8c')](_0x25cec0[_0xaa1c('0x58')],[_0xaa1c('0x6d'),'id'])||{})[_0xaa1c('0x8d')](function(_0xb1c716){for(var _0x3caf65=0x0;_0x3caf65<_0x25cec0['body'][_0xaa1c('0x6d')][_0xaa1c('0x4a')];_0x3caf65+=0x1){socket[_0xaa1c('0x75')]('userChatQueue:save',{'UserId':_0x25cec0[_0xaa1c('0x58')][_0xaa1c('0x6d')][_0x3caf65],'ChatQueueId':_0x25cec0[_0xaa1c('0x5e')]['id']});}return _0xb1c716;});}})[_0xaa1c('0x23')](respondWithResult(_0x133bc6,null))['catch'](handleError(_0x133bc6,null));};exports['removeAgents']=function(_0xe91fda,_0x192f92,_0x359fd2){return db[_0xaa1c('0x3f')]['find']({'where':{'id':_0xe91fda['params']['id']}})['then'](handleEntityNotFound(_0x192f92,null))[_0xaa1c('0x23')](function(_0x4ab6cb){if(_0x4ab6cb){return _0x4ab6cb[_0xaa1c('0x88')](_0xe91fda[_0xaa1c('0x47')][_0xaa1c('0x6d')])['then'](function(){if(_['isArray'](_0xe91fda[_0xaa1c('0x47')][_0xaa1c('0x6d')])){for(var _0x88d667=0x0;_0x88d667<_0xe91fda[_0xaa1c('0x47')][_0xaa1c('0x6d')][_0xaa1c('0x4a')];_0x88d667+=0x1){socket[_0xaa1c('0x75')]('userChatQueue:remove',{'UserId':Number(_0xe91fda[_0xaa1c('0x47')][_0xaa1c('0x6d')][_0x88d667]),'ChatQueueId':Number(_0xe91fda[_0xaa1c('0x5e')]['id'])});}}else{socket[_0xaa1c('0x75')](_0xaa1c('0x8a'),{'UserId':Number(_0xe91fda[_0xaa1c('0x47')][_0xaa1c('0x6d')]),'ChatQueueId':Number(_0xe91fda[_0xaa1c('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x192f92,null))['catch'](handleError(_0x192f92,null));};exports['getAgents']=function(_0x211517,_0x51c5fd,_0x5f0471){var _0x3f6c47={};var _0x2ff664={};var _0x21eab8;var _0x3b76f;return db[_0xaa1c('0x3f')][_0xaa1c('0x61')]({'where':{'id':_0x211517['params']['id']}})[_0xaa1c('0x23')](handleEntityNotFound(_0x51c5fd,null))[_0xaa1c('0x23')](function(_0x5c3c01){if(_0x5c3c01){_0x21eab8=_0x5c3c01;_0x2ff664[_0xaa1c('0x43')]=_[_0xaa1c('0x44')](db[_0xaa1c('0x6e')][_0xaa1c('0x40')]);_0x2ff664[_0xaa1c('0x47')]=_[_0xaa1c('0x44')](_0x211517[_0xaa1c('0x47')]);_0x2ff664[_0xaa1c('0x45')]=_[_0xaa1c('0x46')](_0x2ff664[_0xaa1c('0x43')],_0x2ff664['query']);_0x3f6c47['attributes']=_['intersection'](_0x2ff664['model'],qs['fields'](_0x211517[_0xaa1c('0x47')][_0xaa1c('0x49')]));_0x3f6c47[_0xaa1c('0x48')]=_0x3f6c47[_0xaa1c('0x48')][_0xaa1c('0x4a')]?_0x3f6c47[_0xaa1c('0x48')]:_0x2ff664[_0xaa1c('0x43')];_0x3f6c47['order']=qs[_0xaa1c('0x63')](_0x211517[_0xaa1c('0x47')]['sort']);_0x3f6c47[_0xaa1c('0x4e')]=qs[_0xaa1c('0x45')](_['pick'](_0x211517[_0xaa1c('0x47')],_0x2ff664[_0xaa1c('0x45')]));if(_0x211517[_0xaa1c('0x47')][_0xaa1c('0x51')]){_0x3f6c47['where']=_[_0xaa1c('0x64')](_0x3f6c47[_0xaa1c('0x4e')],{'$or':_[_0xaa1c('0x3e')](_0x3f6c47[_0xaa1c('0x48')],function(_0x52da24){var _0x8a140e={};_0x8a140e[_0x52da24]={'$like':'%'+_0x211517[_0xaa1c('0x47')]['filter']+'%'};return _0x8a140e;})});}_0x3f6c47=_[_0xaa1c('0x64')]({},_0x3f6c47,_0x211517[_0xaa1c('0x52')]);return _0x21eab8[_0xaa1c('0x8e')](_0x3f6c47);}})[_0xaa1c('0x23')](function(_0xddd6d7){if(_0xddd6d7){_0x3b76f=_0xddd6d7['length'];if(!_0x211517[_0xaa1c('0x47')][_0xaa1c('0x4b')](_0xaa1c('0x4c'))){_0x3f6c47['limit']=qs[_0xaa1c('0x31')](_0x211517[_0xaa1c('0x47')]['limit']);_0x3f6c47[_0xaa1c('0x30')]=qs['offset'](_0x211517[_0xaa1c('0x47')][_0xaa1c('0x30')]);}return _0x21eab8[_0xaa1c('0x8e')](_0x3f6c47);}})[_0xaa1c('0x23')](function(_0x45f074){if(_0x45f074){return _0x45f074?{'count':_0x3b76f,'rows':_0x45f074}:null;}})[_0xaa1c('0x23')](respondWithResult(_0x51c5fd,null))[_0xaa1c('0x2b')](handleError(_0x51c5fd,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 07952d7..a7de271 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(_0x204583,_0x1e1986){var _0x54a7c8=function(_0x1338a7){while(--_0x1338a7){_0x204583['push'](_0x204583['shift']());}};_0x54a7c8(++_0x1e1986);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c4aef,_0x116fe2){_0x2c4aef=_0x2c4aef-0x0;var _0x3deaed=_0xb10b[_0x2c4aef];return _0x3deaed;};'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(_0x13cf88,_0x386a66){var _0x272677=function(_0x2b18f7){while(--_0x2b18f7){_0x13cf88['push'](_0x13cf88['shift']());}};_0x272677(++_0x386a66);}(_0x0b0e,0x187));var _0xe0b0=function(_0x446e61,_0x27e680){_0x446e61=_0x446e61-0x0;var _0x4160a8=_0x0b0e[_0x446e61];return _0x4160a8;};'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 14ea163..142673f 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 _0x9e88=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatQueue','chat_queues','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9e88,0x6b));var _0x89e8=function(_0xefd729,_0x3baf6a){_0xefd729=_0xefd729-0x0;var _0x51c0de=_0x9e88[_0xefd729];return _0x51c0de;};'use strict';var _=require(_0x89e8('0x0'));var util=require(_0x89e8('0x1'));var logger=require(_0x89e8('0x2'))('api');var moment=require(_0x89e8('0x3'));var BPromise=require(_0x89e8('0x4'));var rp=require(_0x89e8('0x5'));var fs=require('fs');var path=require(_0x89e8('0x6'));var rimraf=require(_0x89e8('0x7'));var config=require(_0x89e8('0x8'));var attributes=require('./chatQueue.attributes');module[_0x89e8('0x9')]=function(_0x244b28,_0x2ed6f6){return _0x244b28['define'](_0x89e8('0xa'),attributes,{'tableName':_0x89e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe94e=['../../config/environment','exports','define','ChatQueue','chat_queues','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe94e,0xd6));var _0xee94=function(_0x3c9efe,_0xbaf050){_0x3c9efe=_0x3c9efe-0x0;var _0x5133f6=_0xe94e[_0x3c9efe];return _0x5133f6;};'use strict';var _=require('lodash');var util=require(_0xee94('0x0'));var logger=require(_0xee94('0x1'))('api');var moment=require(_0xee94('0x2'));var BPromise=require('bluebird');var rp=require(_0xee94('0x3'));var fs=require('fs');var path=require(_0xee94('0x4'));var rimraf=require(_0xee94('0x5'));var config=require(_0xee94('0x6'));var attributes=require('./chatQueue.attributes');module[_0xee94('0x7')]=function(_0x71a188,_0x231758){return _0x71a188[_0xee94('0x8')](_0xee94('0x9'),attributes,{'tableName':_0xee94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index e455c48..076bf47 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 _0x6f59=['./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis'];(function(_0x106e62,_0x304267){var _0x4d8da5=function(_0x200fc1){while(--_0x200fc1){_0x106e62['push'](_0x106e62['shift']());}};_0x4d8da5(++_0x304267);}(_0x6f59,0x1be));var _0x96f5=function(_0x47d5bf,_0x3c5c17){_0x47d5bf=_0x47d5bf-0x0;var _0x268e9f=_0x6f59[_0x47d5bf];return _0x268e9f;};'use strict';var _=require(_0x96f5('0x0'));var util=require(_0x96f5('0x1'));var moment=require(_0x96f5('0x2'));var BPromise=require(_0x96f5('0x3'));var rs=require(_0x96f5('0x4'));var fs=require('fs');var Redis=require(_0x96f5('0x5'));var db=require(_0x96f5('0x6'))['db'];var utils=require(_0x96f5('0x7'));var logger=require(_0x96f5('0x8'))(_0x96f5('0x9'));var config=require(_0x96f5('0xa'));var jayson=require(_0x96f5('0xb'));var client=jayson['client'][_0x96f5('0xc')]({'port':0x232a});config['redis']=_[_0x96f5('0xd')](config['redis'],{'host':_0x96f5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96f5('0xf')]));require(_0x96f5('0x10'))[_0x96f5('0x11')](socket);function respondWithRpcPromise(_0x384556,_0x5a84ba,_0x324dc6){return new BPromise(function(_0x30ac02,_0x1fd2c0){return client[_0x96f5('0x12')](_0x384556,_0x324dc6)[_0x96f5('0x13')](function(_0x45e8fc){logger[_0x96f5('0x14')](_0x96f5('0x15'),_0x5a84ba,_0x96f5('0x16'));logger[_0x96f5('0x17')](_0x96f5('0x18'),_0x5a84ba,_0x96f5('0x16'),JSON[_0x96f5('0x19')](_0x45e8fc));if(_0x45e8fc['error']){if(_0x45e8fc[_0x96f5('0x1a')][_0x96f5('0x1b')]===0x1f4){logger[_0x96f5('0x1a')](_0x96f5('0x15'),_0x5a84ba,_0x45e8fc[_0x96f5('0x1a')][_0x96f5('0x1c')]);return _0x1fd2c0(_0x45e8fc['error'][_0x96f5('0x1c')]);}logger['error'](_0x96f5('0x15'),_0x5a84ba,_0x45e8fc[_0x96f5('0x1a')][_0x96f5('0x1c')]);return _0x30ac02(_0x45e8fc[_0x96f5('0x1a')][_0x96f5('0x1c')]);}else{logger['info'](_0x96f5('0x15'),_0x5a84ba,'request\x20sent');_0x30ac02(_0x45e8fc[_0x96f5('0x1d')]['message']);}})[_0x96f5('0x1e')](function(_0x33f7d7){logger['error'](_0x96f5('0x15'),_0x5a84ba,_0x33f7d7);_0x1fd2c0(_0x33f7d7);});});}exports['GetChatQueue']=function(_0xa14bca){var _0x502341=this;return new Promise(function(_0x1637a8,_0x212f41){return db['ChatQueue'][_0x96f5('0x1f')]({'raw':_0xa14bca[_0x96f5('0x20')]?_0xa14bca[_0x96f5('0x20')][_0x96f5('0x21')]===undefined?!![]:![]:!![],'where':_0xa14bca[_0x96f5('0x20')]?_0xa14bca[_0x96f5('0x20')][_0x96f5('0x22')]||null:null,'attributes':_0xa14bca[_0x96f5('0x20')]?_0xa14bca[_0x96f5('0x20')][_0x96f5('0x23')]||null:null,'limit':_0xa14bca[_0x96f5('0x20')]?_0xa14bca['options'][_0x96f5('0x24')]||null:null,'include':_0xa14bca[_0x96f5('0x20')]?_0xa14bca[_0x96f5('0x20')][_0x96f5('0x25')]?_[_0x96f5('0x26')](_0xa14bca[_0x96f5('0x20')][_0x96f5('0x25')],function(_0x59535d){return{'model':db[_0x59535d[_0x96f5('0x27')]],'as':_0x59535d['as'],'attributes':_0x59535d['attributes'],'include':_0x59535d[_0x96f5('0x25')]?_[_0x96f5('0x26')](_0x59535d[_0x96f5('0x25')],function(_0x30d226){return{'model':db[_0x30d226[_0x96f5('0x27')]],'as':_0x30d226['as'],'attributes':_0x30d226['attributes'],'include':_0x30d226[_0x96f5('0x25')]?_[_0x96f5('0x26')](_0x30d226['include'],function(_0x5a8bb8){return{'model':db[_0x5a8bb8['model']],'as':_0x5a8bb8['as'],'attributes':_0x5a8bb8['attributes']};}):[]};}):[]};}):[]:[]})[_0x96f5('0x13')](function(_0x430470){logger[_0x96f5('0x14')]('GetChatQueue',_0xa14bca);logger['debug'](_0x96f5('0x28'),_0xa14bca,JSON[_0x96f5('0x19')](_0x430470));_0x1637a8(_0x430470);})[_0x96f5('0x1e')](function(_0x2320e2){logger['error'](_0x96f5('0x28'),_0x2320e2[_0x96f5('0x1c')],_0xa14bca);_0x212f41(_0x502341['error'](0x1f4,_0x2320e2[_0x96f5('0x1c')]));});});};exports[_0x96f5('0x29')]=function(_0x11101c){var _0x5145a6=this;return new Promise(function(_0x58ee2e,_0x5f0057){return db['ChatQueue']['find']({'raw':_0x11101c[_0x96f5('0x20')]?_0x11101c[_0x96f5('0x20')][_0x96f5('0x21')]===undefined?!![]:![]:!![],'where':_0x11101c[_0x96f5('0x20')]?_0x11101c['options']['where']||null:null,'attributes':_0x11101c[_0x96f5('0x20')]?_0x11101c['options'][_0x96f5('0x23')]||null:null,'include':_0x11101c[_0x96f5('0x20')]?_0x11101c[_0x96f5('0x20')][_0x96f5('0x25')]?_['map'](_0x11101c['options'][_0x96f5('0x25')],function(_0x11fa48){return{'model':db[_0x11fa48[_0x96f5('0x27')]],'as':_0x11fa48['as'],'attributes':_0x11fa48[_0x96f5('0x23')],'include':_0x11fa48[_0x96f5('0x25')]?_[_0x96f5('0x26')](_0x11fa48[_0x96f5('0x25')],function(_0x11e5ed){return{'model':db[_0x11e5ed['model']],'as':_0x11e5ed['as'],'attributes':_0x11e5ed[_0x96f5('0x23')],'include':_0x11e5ed['include']?_[_0x96f5('0x26')](_0x11e5ed[_0x96f5('0x25')],function(_0x426342){return{'model':db[_0x426342['model']],'as':_0x426342['as'],'attributes':_0x426342[_0x96f5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x96f5('0x13')](function(_0x13631c){logger[_0x96f5('0x14')]('ShowChatQueue',_0x11101c);logger[_0x96f5('0x17')](_0x96f5('0x29'),_0x11101c,JSON['stringify'](_0x13631c));_0x58ee2e(_0x13631c);})['catch'](function(_0x2c0922){logger[_0x96f5('0x1a')](_0x96f5('0x29'),_0x2c0922[_0x96f5('0x1c')],_0x11101c);_0x5f0057(_0x5145a6[_0x96f5('0x1a')](0x1f4,_0x2c0922[_0x96f5('0x1c')]));});});}; \ No newline at end of file +var _0xae59=['then','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','map','include','model','attributes','info','debug','stringify','catch','ShowChatQueue','find','where','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0xae59,0x8d));var _0x9ae5=function(_0x1dfbd8,_0x54e99a){_0x1dfbd8=_0x1dfbd8-0x0;var _0x285e63=_0xae59[_0x1dfbd8];return _0x285e63;};'use strict';var _=require(_0x9ae5('0x0'));var util=require('util');var moment=require(_0x9ae5('0x1'));var BPromise=require(_0x9ae5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ae5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ae5('0x4'));var logger=require('../../config/logger')(_0x9ae5('0x5'));var config=require(_0x9ae5('0x6'));var jayson=require(_0x9ae5('0x7'));var client=jayson[_0x9ae5('0x8')][_0x9ae5('0x9')]({'port':0x232a});config[_0x9ae5('0xa')]=_[_0x9ae5('0xb')](config[_0x9ae5('0xa')],{'host':_0x9ae5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x9ae5('0xd')](socket);function respondWithRpcPromise(_0x302d4c,_0x669c38,_0x44626a){return new BPromise(function(_0x2e0557,_0x27684b){return client[_0x9ae5('0xe')](_0x302d4c,_0x44626a)[_0x9ae5('0xf')](function(_0x30a7ca){logger['info'](_0x9ae5('0x10'),_0x669c38,'request\x20sent');logger['debug'](_0x9ae5('0x11'),_0x669c38,_0x9ae5('0x12'),JSON['stringify'](_0x30a7ca));if(_0x30a7ca[_0x9ae5('0x13')]){if(_0x30a7ca[_0x9ae5('0x13')][_0x9ae5('0x14')]===0x1f4){logger[_0x9ae5('0x13')](_0x9ae5('0x10'),_0x669c38,_0x30a7ca[_0x9ae5('0x13')][_0x9ae5('0x15')]);return _0x27684b(_0x30a7ca[_0x9ae5('0x13')][_0x9ae5('0x15')]);}logger[_0x9ae5('0x13')](_0x9ae5('0x10'),_0x669c38,_0x30a7ca[_0x9ae5('0x13')][_0x9ae5('0x15')]);return _0x2e0557(_0x30a7ca[_0x9ae5('0x13')][_0x9ae5('0x15')]);}else{logger['info'](_0x9ae5('0x10'),_0x669c38,_0x9ae5('0x12'));_0x2e0557(_0x30a7ca[_0x9ae5('0x16')][_0x9ae5('0x15')]);}})['catch'](function(_0x569931){logger[_0x9ae5('0x13')](_0x9ae5('0x10'),_0x669c38,_0x569931);_0x27684b(_0x569931);});});}exports[_0x9ae5('0x17')]=function(_0x483a27){var _0x1c42f2=this;return new Promise(function(_0xc086de,_0x69855d){return db[_0x9ae5('0x18')][_0x9ae5('0x19')]({'raw':_0x483a27['options']?_0x483a27[_0x9ae5('0x1a')][_0x9ae5('0x1b')]===undefined?!![]:![]:!![],'where':_0x483a27[_0x9ae5('0x1a')]?_0x483a27['options']['where']||null:null,'attributes':_0x483a27[_0x9ae5('0x1a')]?_0x483a27[_0x9ae5('0x1a')]['attributes']||null:null,'limit':_0x483a27[_0x9ae5('0x1a')]?_0x483a27['options']['limit']||null:null,'include':_0x483a27['options']?_0x483a27[_0x9ae5('0x1a')]['include']?_[_0x9ae5('0x1c')](_0x483a27[_0x9ae5('0x1a')][_0x9ae5('0x1d')],function(_0x29d330){return{'model':db[_0x29d330[_0x9ae5('0x1e')]],'as':_0x29d330['as'],'attributes':_0x29d330[_0x9ae5('0x1f')],'include':_0x29d330['include']?_['map'](_0x29d330[_0x9ae5('0x1d')],function(_0x276f2b){return{'model':db[_0x276f2b[_0x9ae5('0x1e')]],'as':_0x276f2b['as'],'attributes':_0x276f2b[_0x9ae5('0x1f')],'include':_0x276f2b[_0x9ae5('0x1d')]?_[_0x9ae5('0x1c')](_0x276f2b[_0x9ae5('0x1d')],function(_0x38919f){return{'model':db[_0x38919f[_0x9ae5('0x1e')]],'as':_0x38919f['as'],'attributes':_0x38919f['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ae5('0xf')](function(_0x8fbae0){logger[_0x9ae5('0x20')]('GetChatQueue',_0x483a27);logger[_0x9ae5('0x21')](_0x9ae5('0x17'),_0x483a27,JSON[_0x9ae5('0x22')](_0x8fbae0));_0xc086de(_0x8fbae0);})[_0x9ae5('0x23')](function(_0x3cb0c7){logger[_0x9ae5('0x13')]('GetChatQueue',_0x3cb0c7[_0x9ae5('0x15')],_0x483a27);_0x69855d(_0x1c42f2[_0x9ae5('0x13')](0x1f4,_0x3cb0c7[_0x9ae5('0x15')]));});});};exports[_0x9ae5('0x24')]=function(_0x15f31c){var _0x48389d=this;return new Promise(function(_0x5edb8d,_0x54bd77){return db['ChatQueue'][_0x9ae5('0x25')]({'raw':_0x15f31c['options']?_0x15f31c[_0x9ae5('0x1a')][_0x9ae5('0x1b')]===undefined?!![]:![]:!![],'where':_0x15f31c[_0x9ae5('0x1a')]?_0x15f31c[_0x9ae5('0x1a')][_0x9ae5('0x26')]||null:null,'attributes':_0x15f31c[_0x9ae5('0x1a')]?_0x15f31c[_0x9ae5('0x1a')][_0x9ae5('0x1f')]||null:null,'include':_0x15f31c[_0x9ae5('0x1a')]?_0x15f31c[_0x9ae5('0x1a')][_0x9ae5('0x1d')]?_['map'](_0x15f31c[_0x9ae5('0x1a')][_0x9ae5('0x1d')],function(_0xd2ee66){return{'model':db[_0xd2ee66['model']],'as':_0xd2ee66['as'],'attributes':_0xd2ee66['attributes'],'include':_0xd2ee66[_0x9ae5('0x1d')]?_[_0x9ae5('0x1c')](_0xd2ee66['include'],function(_0x4983e5){return{'model':db[_0x4983e5['model']],'as':_0x4983e5['as'],'attributes':_0x4983e5[_0x9ae5('0x1f')],'include':_0x4983e5[_0x9ae5('0x1d')]?_[_0x9ae5('0x1c')](_0x4983e5[_0x9ae5('0x1d')],function(_0x3b0725){return{'model':db[_0x3b0725[_0x9ae5('0x1e')]],'as':_0x3b0725['as'],'attributes':_0x3b0725['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ae5('0xf')](function(_0x591889){logger['info'](_0x9ae5('0x24'),_0x15f31c);logger['debug']('ShowChatQueue',_0x15f31c,JSON['stringify'](_0x591889));_0x5edb8d(_0x591889);})[_0x9ae5('0x23')](function(_0x462221){logger['error'](_0x9ae5('0x24'),_0x462221[_0x9ae5('0x15')],_0x15f31c);_0x54bd77(_0x48389d['error'](0x1f4,_0x462221[_0x9ae5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 997259a..4f740b0 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(_0x4b6507,_0x5518b5){var _0x2001ec=function(_0x330ddf){while(--_0x330ddf){_0x4b6507['push'](_0x4b6507['shift']());}};_0x2001ec(++_0x5518b5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c24bc,_0x214139){_0x4c24bc=_0x4c24bc-0x0;var _0x3e8dd5=_0x5f2f[_0x4c24bc];return _0x3e8dd5;};'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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x22d53d,_0x339808){var _0x40dd91=function(_0x1ea0a6){while(--_0x1ea0a6){_0x22d53d['push'](_0x22d53d['shift']());}};_0x40dd91(++_0x339808);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17f3c6,_0x8a2702){_0x17f3c6=_0x17f3c6-0x0;var _0x45db94=_0x5f2f[_0x17f3c6];return _0x45db94;};'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 diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 14ea1ab..0e2869b 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 _0x4aa0=['describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','index','get','/describe'];(function(_0x1fc27e,_0x52402c){var _0x252a06=function(_0x53fa6f){while(--_0x53fa6f){_0x1fc27e['push'](_0x1fc27e['shift']());}};_0x252a06(++_0x52402c);}(_0x4aa0,0x1a7));var _0x04aa=function(_0x52f6e8,_0x408299){_0x52f6e8=_0x52f6e8-0x0;var _0x504b05=_0x4aa0[_0x52f6e8];return _0x504b05;};'use strict';var multer=require(_0x04aa('0x0'));var util=require(_0x04aa('0x1'));var path=require('path');var timeout=require(_0x04aa('0x2'));var express=require('express');var router=express[_0x04aa('0x3')]();var auth=require(_0x04aa('0x4'));var interaction=require(_0x04aa('0x5'));var config=require(_0x04aa('0x6'));var controller=require(_0x04aa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x04aa('0x8')]);router[_0x04aa('0x9')](_0x04aa('0xa'),auth['isAuthenticated'](),controller[_0x04aa('0xb')]);router['get']('/:id',auth[_0x04aa('0xc')](),controller[_0x04aa('0xd')]);router[_0x04aa('0x9')](_0x04aa('0xe'),auth[_0x04aa('0xc')](),controller[_0x04aa('0xf')]);router[_0x04aa('0x9')](_0x04aa('0x10'),auth['isAuthenticated'](),controller[_0x04aa('0x11')]);router[_0x04aa('0x9')](_0x04aa('0x12'),auth['isAuthenticated'](),controller[_0x04aa('0x13')]);router['post']('/',auth[_0x04aa('0xc')](),controller[_0x04aa('0x14')]);router['post'](_0x04aa('0x10'),auth[_0x04aa('0xc')](),controller[_0x04aa('0x15')]);router[_0x04aa('0x16')](_0x04aa('0x12'),auth[_0x04aa('0xc')](),controller[_0x04aa('0x17')]);router[_0x04aa('0x18')](_0x04aa('0x19'),auth[_0x04aa('0xc')](),controller[_0x04aa('0x1a')]);router[_0x04aa('0x1b')](_0x04aa('0x19'),auth['isAuthenticated'](),controller[_0x04aa('0x1c')]);router[_0x04aa('0x1b')](_0x04aa('0x10'),auth[_0x04aa('0xc')](),controller[_0x04aa('0x1d')]);router[_0x04aa('0x1b')](_0x04aa('0x12'),auth['isAuthenticated'](),controller[_0x04aa('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xbdd5=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','update','delete','destroy','removeTeams','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4005f4,_0x528f51){var _0x21b640=function(_0x53b223){while(--_0x53b223){_0x4005f4['push'](_0x4005f4['shift']());}};_0x21b640(++_0x528f51);}(_0xbdd5,0x1f3));var _0x5bdd=function(_0x2cbffe,_0xff4924){_0x2cbffe=_0x2cbffe-0x0;var _0x5d2a91=_0xbdd5[_0x2cbffe];return _0x5d2a91;};'use strict';var multer=require(_0x5bdd('0x0'));var util=require(_0x5bdd('0x1'));var path=require(_0x5bdd('0x2'));var timeout=require('connect-timeout');var express=require(_0x5bdd('0x3'));var router=express['Router']();var auth=require(_0x5bdd('0x4'));var interaction=require(_0x5bdd('0x5'));var config=require(_0x5bdd('0x6'));var controller=require(_0x5bdd('0x7'));router[_0x5bdd('0x8')]('/',auth[_0x5bdd('0x9')](),controller[_0x5bdd('0xa')]);router[_0x5bdd('0x8')](_0x5bdd('0xb'),auth['isAuthenticated'](),controller[_0x5bdd('0xc')]);router['get'](_0x5bdd('0xd'),auth['isAuthenticated'](),controller[_0x5bdd('0xe')]);router[_0x5bdd('0x8')](_0x5bdd('0xf'),auth[_0x5bdd('0x9')](),controller[_0x5bdd('0x10')]);router[_0x5bdd('0x8')](_0x5bdd('0x11'),auth['isAuthenticated'](),controller[_0x5bdd('0x12')]);router[_0x5bdd('0x8')](_0x5bdd('0x13'),auth[_0x5bdd('0x9')](),controller['getAgents']);router[_0x5bdd('0x14')]('/',auth[_0x5bdd('0x9')](),controller['create']);router[_0x5bdd('0x14')](_0x5bdd('0x11'),auth['isAuthenticated'](),controller[_0x5bdd('0x15')]);router[_0x5bdd('0x14')](_0x5bdd('0x13'),auth[_0x5bdd('0x9')](),controller[_0x5bdd('0x16')]);router['put']('/:id',auth[_0x5bdd('0x9')](),controller[_0x5bdd('0x17')]);router[_0x5bdd('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x5bdd('0x19')]);router[_0x5bdd('0x18')]('/:id/teams',auth[_0x5bdd('0x9')](),controller[_0x5bdd('0x1a')]);router[_0x5bdd('0x18')](_0x5bdd('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 75cf1aa..22dd906 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 _0xd4e4=['DATE','moment','sequelize','exports','STRING'];(function(_0x38e7af,_0x381679){var _0xb626fc=function(_0x490a3e){while(--_0x490a3e){_0x38e7af['push'](_0x38e7af['shift']());}};_0xb626fc(++_0x381679);}(_0xd4e4,0x11e));var _0x4d4e=function(_0x1e1ad2,_0x81f7a7){_0x1e1ad2=_0x1e1ad2-0x0;var _0x1fc203=_0xd4e4[_0x1e1ad2];return _0x1fc203;};'use strict';var moment=require(_0x4d4e('0x0'));var Sequelize=require(_0x4d4e('0x1'));module[_0x4d4e('0x2')]={'uniqueid':{'type':Sequelize[_0x4d4e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4d4e('0x3')]},'joinAt':{'type':Sequelize[_0x4d4e('0x4')]},'leaveAt':{'type':Sequelize[_0x4d4e('0x4')]},'acceptAt':{'type':Sequelize[_0x4d4e('0x4')]},'exitAt':{'type':Sequelize[_0x4d4e('0x4')]},'reason':{'type':Sequelize[_0x4d4e('0x3')]}}; \ No newline at end of file +var _0x10ed=['moment','sequelize','exports','STRING','DATE'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x10ed,0x16d));var _0xd10e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x10ed[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0xd10e('0x0'));var Sequelize=require(_0xd10e('0x1'));module[_0xd10e('0x2')]={'uniqueid':{'type':Sequelize[_0xd10e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd10e('0x3')]},'joinAt':{'type':Sequelize[_0xd10e('0x4')]},'leaveAt':{'type':Sequelize[_0xd10e('0x4')]},'acceptAt':{'type':Sequelize[_0xd10e('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 971847d..572ea4f 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 _0xbaf0=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x4cdf5e,_0x51384c){var _0x34119c=function(_0x3b8517){while(--_0x3b8517){_0x4cdf5e['push'](_0x4cdf5e['shift']());}};_0x34119c(++_0x51384c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0baf('0x0'));var rimraf=require(_0x0baf('0x1'));var zipdir=require(_0x0baf('0x2'));var jsonpatch=require(_0x0baf('0x3'));var rp=require(_0x0baf('0x4'));var moment=require(_0x0baf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0baf('0x6'));var util=require(_0x0baf('0x7'));var path=require(_0x0baf('0x8'));var sox=require(_0x0baf('0x9'));var csv=require(_0x0baf('0xa'));var ejs=require(_0x0baf('0xb'));var fs=require('fs');var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a53e2,_0x465dd7){_0x465dd7=_0x465dd7||0xcc;return function(_0xe4378c){if(_0xe4378c){return _0x5a53e2[_0x0baf('0x1b')](_0x465dd7);}return _0x5a53e2[_0x0baf('0x1c')](_0x465dd7)['end']();};}function respondWithResult(_0x2ab33e,_0x49e44b){_0x49e44b=_0x49e44b||0xc8;return function(_0x1c76a8){if(_0x1c76a8){return _0x2ab33e[_0x0baf('0x1c')](_0x49e44b)[_0x0baf('0x1d')](_0x1c76a8);}};}function respondWithFilteredResult(_0x2bc381,_0xb8339e){return function(_0x469599){if(_0x469599){var _0x4f80a8=_0x469599[_0x0baf('0x1e')],_0x4cd79d=_0xb8339e[_0x0baf('0x1f')],_0x2312c7=_0xb8339e[_0x0baf('0x1f')]+_0xb8339e[_0x0baf('0x20')],_0x38395b;if(_0x2312c7>=_0x4f80a8){_0x2312c7=_0x4f80a8;_0x38395b=0xc8;}else{_0x38395b=0xce;}_0x2bc381['status'](_0x38395b);return _0x2bc381[_0x0baf('0x21')](_0x0baf('0x22'),_0x4cd79d+'-'+_0x2312c7+'/'+_0x4f80a8)[_0x0baf('0x1d')](_0x469599);}return null;};}function patchUpdates(_0x3e9cb4){return function(_0x47070d){try{jsonpatch[_0x0baf('0x23')](_0x47070d,_0x3e9cb4,!![]);}catch(_0x4ff793){return BPromise['reject'](_0x4ff793);}return _0x47070d[_0x0baf('0x24')]();};}function saveUpdates(_0x154f48,_0x32e839){return function(_0x1848e8){if(_0x1848e8){return _0x1848e8[_0x0baf('0x25')](_0x154f48)[_0x0baf('0x26')](function(_0x210cd8){return _0x210cd8;});}return null;};}function removeEntity(_0x636a13,_0x2c42e2){return function(_0x15a2c3){if(_0x15a2c3){return _0x15a2c3['destroy']()[_0x0baf('0x26')](function(){_0x636a13['status'](0xcc)[_0x0baf('0x27')]();});}};}function handleEntityNotFound(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(!_0x2ef0aa){_0x5dbf00['sendStatus'](0x194);}return _0x2ef0aa;};}function handleError(_0x4be1b9,_0x47c4b){_0x47c4b=_0x47c4b||0x1f4;return function(_0x27b59c){logger[_0x0baf('0x28')](_0x27b59c[_0x0baf('0x29')]);if(_0x27b59c[_0x0baf('0x2a')]){delete _0x27b59c['name'];}_0x4be1b9[_0x0baf('0x1c')](_0x47c4b)[_0x0baf('0x2b')](_0x27b59c);};}exports[_0x0baf('0x2c')]=function(_0x366e71,_0x3843b8){var _0x3b9b31={},_0x453525={},_0x549fd0={'count':0x0,'rows':[]};var _0x1590b4=_[_0x0baf('0x2d')](db[_0x0baf('0x2e')][_0x0baf('0x2f')],function(_0x55c715){return{'name':_0x55c715[_0x0baf('0x30')],'type':_0x55c715[_0x0baf('0x31')]['key']};});_0x453525[_0x0baf('0x32')]=_[_0x0baf('0x2d')](_0x1590b4,_0x0baf('0x2a'));_0x453525[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0x366e71[_0x0baf('0x33')]);_0x453525[_0x0baf('0x35')]=_['intersection'](_0x453525[_0x0baf('0x32')],_0x453525[_0x0baf('0x33')]);_0x3b9b31[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x453525[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x38')]));_0x3b9b31[_0x0baf('0x36')]=_0x3b9b31[_0x0baf('0x36')][_0x0baf('0x39')]?_0x3b9b31[_0x0baf('0x36')]:_0x453525[_0x0baf('0x32')];if(!_0x366e71[_0x0baf('0x33')]['hasOwnProperty'](_0x0baf('0x3a'))){_0x3b9b31['limit']=qs[_0x0baf('0x20')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x20')]);_0x3b9b31[_0x0baf('0x1f')]=qs['offset'](_0x366e71[_0x0baf('0x33')][_0x0baf('0x1f')]);}_0x3b9b31['order']=qs[_0x0baf('0x3b')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x3b')]);_0x3b9b31[_0x0baf('0x3c')]=qs[_0x0baf('0x35')](_[_0x0baf('0x3d')](_0x366e71[_0x0baf('0x33')],_0x453525[_0x0baf('0x35')]),_0x1590b4);if(_0x366e71['query'][_0x0baf('0x3e')]){_0x3b9b31[_0x0baf('0x3c')]=_['merge'](_0x3b9b31[_0x0baf('0x3c')],{'$or':_['map'](_0x1590b4,function(_0x5c545f){if(_0x5c545f[_0x0baf('0x31')]!==_0x0baf('0x3f')){var _0x5d3ad1={};_0x5d3ad1[_0x5c545f['name']]={'$like':'%'+_0x366e71[_0x0baf('0x33')][_0x0baf('0x3e')]+'%'};return _0x5d3ad1;}})});}_0x3b9b31=_[_0x0baf('0x40')]({},_0x3b9b31,_0x366e71[_0x0baf('0x41')]);var _0x15eb5c={'where':_0x3b9b31[_0x0baf('0x3c')]};return db[_0x0baf('0x2e')][_0x0baf('0x1e')](_0x15eb5c)[_0x0baf('0x26')](function(_0x36c6d2){_0x549fd0[_0x0baf('0x1e')]=_0x36c6d2;if(_0x366e71[_0x0baf('0x33')][_0x0baf('0x42')]){_0x3b9b31[_0x0baf('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0baf('0x44')](_0x3b9b31);})[_0x0baf('0x26')](function(_0x4f1de9){_0x549fd0[_0x0baf('0x45')]=_0x4f1de9;return _0x549fd0;})[_0x0baf('0x26')](respondWithFilteredResult(_0x3843b8,_0x3b9b31))[_0x0baf('0x46')](handleError(_0x3843b8,null));};exports[_0x0baf('0x47')]=function(_0x2e20c8,_0x456d0b){var _0x57b581={'raw':!![],'where':{'id':_0x2e20c8[_0x0baf('0x48')]['id']}},_0x23ad34={};_0x23ad34['model']=_[_0x0baf('0x34')](db[_0x0baf('0x2e')][_0x0baf('0x2f')]);_0x23ad34[_0x0baf('0x33')]=_['keys'](_0x2e20c8[_0x0baf('0x33')]);_0x23ad34[_0x0baf('0x35')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],_0x23ad34[_0x0baf('0x33')]);_0x57b581[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x2e20c8[_0x0baf('0x33')]['fields']));_0x57b581[_0x0baf('0x36')]=_0x57b581[_0x0baf('0x36')][_0x0baf('0x39')]?_0x57b581[_0x0baf('0x36')]:_0x23ad34[_0x0baf('0x32')];if(_0x2e20c8['query'][_0x0baf('0x42')]){_0x57b581[_0x0baf('0x43')]=[{'all':!![]}];}_0x57b581=_[_0x0baf('0x40')]({},_0x57b581,_0x2e20c8[_0x0baf('0x41')]);return db[_0x0baf('0x2e')]['find'](_0x57b581)[_0x0baf('0x26')](handleEntityNotFound(_0x456d0b,null))[_0x0baf('0x26')](respondWithResult(_0x456d0b,null))[_0x0baf('0x46')](handleError(_0x456d0b,null));};exports[_0x0baf('0x49')]=function(_0x41599f,_0x22d10f){return db[_0x0baf('0x2e')]['create'](_0x41599f[_0x0baf('0x4a')],{})[_0x0baf('0x26')](respondWithResult(_0x22d10f,0xc9))[_0x0baf('0x46')](handleError(_0x22d10f,null));};exports['update']=function(_0x3c9de3,_0x2222b6){if(_0x3c9de3[_0x0baf('0x4a')]['id']){delete _0x3c9de3[_0x0baf('0x4a')]['id'];}return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x3c9de3[_0x0baf('0x48')]['id']}})['then'](handleEntityNotFound(_0x2222b6,null))[_0x0baf('0x26')](saveUpdates(_0x3c9de3[_0x0baf('0x4a')],null))[_0x0baf('0x26')](respondWithResult(_0x2222b6,null))[_0x0baf('0x46')](handleError(_0x2222b6,null));};exports[_0x0baf('0x4c')]=function(_0xc427b2,_0x40d4a6){return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0xc427b2[_0x0baf('0x48')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x40d4a6,null))['then'](removeEntity(_0x40d4a6,null))['catch'](handleError(_0x40d4a6,null));};exports[_0x0baf('0x4d')]=function(_0x3d6b19,_0x1cd114){return db[_0x0baf('0x2e')][_0x0baf('0x4d')]()[_0x0baf('0x26')](respondWithResult(_0x1cd114,null))[_0x0baf('0x46')](handleError(_0x1cd114,null));}; \ No newline at end of file +var _0xb7e7=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','ChatQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var db=require(_0x7b7e('0x17'))['db'];function respondWithStatusCode(_0x55620b,_0xaadda){_0xaadda=_0xaadda||0xcc;return function(_0x54d8ce){if(_0x54d8ce){return _0x55620b[_0x7b7e('0x18')](_0xaadda);}return _0x55620b[_0x7b7e('0x19')](_0xaadda)['end']();};}function respondWithResult(_0x422d3a,_0x5976ac){_0x5976ac=_0x5976ac||0xc8;return function(_0x4c6011){if(_0x4c6011){return _0x422d3a[_0x7b7e('0x19')](_0x5976ac)[_0x7b7e('0x1a')](_0x4c6011);}};}function respondWithFilteredResult(_0xf067da,_0x457ec5){return function(_0x3d2fb2){if(_0x3d2fb2){var _0x5703fd=_0x3d2fb2[_0x7b7e('0x1b')],_0x51baf6=_0x457ec5[_0x7b7e('0x1c')],_0xc7f087=_0x457ec5[_0x7b7e('0x1c')]+_0x457ec5[_0x7b7e('0x1d')],_0x36444d;if(_0xc7f087>=_0x5703fd){_0xc7f087=_0x5703fd;_0x36444d=0xc8;}else{_0x36444d=0xce;}_0xf067da[_0x7b7e('0x19')](_0x36444d);return _0xf067da[_0x7b7e('0x1e')](_0x7b7e('0x1f'),_0x51baf6+'-'+_0xc7f087+'/'+_0x5703fd)[_0x7b7e('0x1a')](_0x3d2fb2);}return null;};}function patchUpdates(_0x12e8e9){return function(_0x14f4fe){try{jsonpatch[_0x7b7e('0x20')](_0x14f4fe,_0x12e8e9,!![]);}catch(_0x3bec7d){return BPromise[_0x7b7e('0x21')](_0x3bec7d);}return _0x14f4fe[_0x7b7e('0x22')]();};}function saveUpdates(_0x3a7b8b,_0x49eddb){return function(_0x69262b){if(_0x69262b){return _0x69262b[_0x7b7e('0x23')](_0x3a7b8b)[_0x7b7e('0x24')](function(_0x4c0647){return _0x4c0647;});}return null;};}function removeEntity(_0x313122,_0xbf0cb3){return function(_0x14243b){if(_0x14243b){return _0x14243b[_0x7b7e('0x25')]()[_0x7b7e('0x24')](function(){_0x313122[_0x7b7e('0x19')](0xcc)[_0x7b7e('0x26')]();});}};}function handleEntityNotFound(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(!_0x5d6215){_0x10a66a['sendStatus'](0x194);}return _0x5d6215;};}function handleError(_0x26ee14,_0x22598e){_0x22598e=_0x22598e||0x1f4;return function(_0x23bfa3){logger['error'](_0x23bfa3['stack']);if(_0x23bfa3['name']){delete _0x23bfa3[_0x7b7e('0x27')];}_0x26ee14[_0x7b7e('0x19')](_0x22598e)[_0x7b7e('0x28')](_0x23bfa3);};}exports[_0x7b7e('0x29')]=function(_0x3ceaf5,_0x48fad1){var _0x6a1e71={},_0x21a15={},_0x4c46b8={'count':0x0,'rows':[]};var _0x57b9da=_['map'](db[_0x7b7e('0x2a')][_0x7b7e('0x2b')],function(_0x503625){return{'name':_0x503625[_0x7b7e('0x2c')],'type':_0x503625['type'][_0x7b7e('0x2d')]};});_0x21a15[_0x7b7e('0x2e')]=_[_0x7b7e('0x2f')](_0x57b9da,'name');_0x21a15[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x3ceaf5[_0x7b7e('0x30')]);_0x21a15[_0x7b7e('0x32')]=_[_0x7b7e('0x33')](_0x21a15['model'],_0x21a15[_0x7b7e('0x30')]);_0x6a1e71['attributes']=_[_0x7b7e('0x33')](_0x21a15[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x34')]));_0x6a1e71[_0x7b7e('0x35')]=_0x6a1e71[_0x7b7e('0x35')]['length']?_0x6a1e71['attributes']:_0x21a15[_0x7b7e('0x2e')];if(!_0x3ceaf5[_0x7b7e('0x30')]['hasOwnProperty'](_0x7b7e('0x36'))){_0x6a1e71[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x3ceaf5['query'][_0x7b7e('0x1d')]);_0x6a1e71[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x1c')]);}_0x6a1e71[_0x7b7e('0x37')]=qs[_0x7b7e('0x38')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x38')]);_0x6a1e71[_0x7b7e('0x39')]=qs[_0x7b7e('0x32')](_[_0x7b7e('0x3a')](_0x3ceaf5[_0x7b7e('0x30')],_0x21a15[_0x7b7e('0x32')]),_0x57b9da);if(_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]){_0x6a1e71['where']=_[_0x7b7e('0x3c')](_0x6a1e71[_0x7b7e('0x39')],{'$or':_[_0x7b7e('0x2f')](_0x57b9da,function(_0x242609){if(_0x242609[_0x7b7e('0x3d')]!==_0x7b7e('0x3e')){var _0x7f15={};_0x7f15[_0x242609[_0x7b7e('0x27')]]={'$like':'%'+_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]+'%'};return _0x7f15;}})});}_0x6a1e71=_['merge']({},_0x6a1e71,_0x3ceaf5[_0x7b7e('0x3f')]);var _0x1fa75b={'where':_0x6a1e71[_0x7b7e('0x39')]};return db[_0x7b7e('0x2a')]['count'](_0x1fa75b)[_0x7b7e('0x24')](function(_0x35b31a){_0x4c46b8[_0x7b7e('0x1b')]=_0x35b31a;if(_0x3ceaf5['query']['includeAll']){_0x6a1e71[_0x7b7e('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x7b7e('0x41')](_0x6a1e71);})[_0x7b7e('0x24')](function(_0x4de331){_0x4c46b8[_0x7b7e('0x42')]=_0x4de331;return _0x4c46b8;})[_0x7b7e('0x24')](respondWithFilteredResult(_0x48fad1,_0x6a1e71))[_0x7b7e('0x43')](handleError(_0x48fad1,null));};exports[_0x7b7e('0x44')]=function(_0x38d32f,_0x435de5){var _0xc888e4={'raw':!![],'where':{'id':_0x38d32f[_0x7b7e('0x45')]['id']}},_0x1d9bb9={};_0x1d9bb9['model']=_['keys'](db[_0x7b7e('0x2a')]['rawAttributes']);_0x1d9bb9[_0x7b7e('0x30')]=_['keys'](_0x38d32f['query']);_0x1d9bb9[_0x7b7e('0x32')]=_['intersection'](_0x1d9bb9[_0x7b7e('0x2e')],_0x1d9bb9['query']);_0xc888e4[_0x7b7e('0x35')]=_[_0x7b7e('0x33')](_0x1d9bb9[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x38d32f['query'][_0x7b7e('0x34')]));_0xc888e4[_0x7b7e('0x35')]=_0xc888e4[_0x7b7e('0x35')][_0x7b7e('0x46')]?_0xc888e4[_0x7b7e('0x35')]:_0x1d9bb9[_0x7b7e('0x2e')];if(_0x38d32f['query']['includeAll']){_0xc888e4['include']=[{'all':!![]}];}_0xc888e4=_[_0x7b7e('0x3c')]({},_0xc888e4,_0x38d32f[_0x7b7e('0x3f')]);return db[_0x7b7e('0x2a')][_0x7b7e('0x47')](_0xc888e4)[_0x7b7e('0x24')](handleEntityNotFound(_0x435de5,null))[_0x7b7e('0x24')](respondWithResult(_0x435de5,null))['catch'](handleError(_0x435de5,null));};exports[_0x7b7e('0x48')]=function(_0x42e560,_0x5a0832){return db['ChatQueueReport'][_0x7b7e('0x48')](_0x42e560[_0x7b7e('0x49')],{})[_0x7b7e('0x24')](respondWithResult(_0x5a0832,0xc9))[_0x7b7e('0x43')](handleError(_0x5a0832,null));};exports[_0x7b7e('0x23')]=function(_0xb46776,_0x590154){if(_0xb46776[_0x7b7e('0x49')]['id']){delete _0xb46776['body']['id'];}return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0xb46776[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x590154,null))['then'](saveUpdates(_0xb46776[_0x7b7e('0x49')],null))[_0x7b7e('0x24')](respondWithResult(_0x590154,null))[_0x7b7e('0x43')](handleError(_0x590154,null));};exports[_0x7b7e('0x25')]=function(_0x1f9d0f,_0x5cce7c){return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x1f9d0f[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5cce7c,null))[_0x7b7e('0x24')](removeEntity(_0x5cce7c,null))['catch'](handleError(_0x5cce7c,null));};exports[_0x7b7e('0x4a')]=function(_0x29024e,_0x46d4ee){return db[_0x7b7e('0x2a')][_0x7b7e('0x4a')]()[_0x7b7e('0x24')](respondWithResult(_0x46d4ee,null))[_0x7b7e('0x43')](handleError(_0x46d4ee,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 9e4ac6c..40fb253 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 _0x31be=['api','moment','bluebird','request-promise','path','./chatQueueReport.attributes','define','uniqueid','../../config/logger'];(function(_0x571dda,_0x1c9ed6){var _0x304e24=function(_0x578f37){while(--_0x578f37){_0x571dda['push'](_0x571dda['shift']());}};_0x304e24(++_0x1c9ed6);}(_0x31be,0xb3));var _0xe31b=function(_0x1c5843,_0x146395){_0x1c5843=_0x1c5843-0x0;var _0x829c08=_0x31be[_0x1c5843];return _0x829c08;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe31b('0x0'))(_0xe31b('0x1'));var moment=require(_0xe31b('0x2'));var BPromise=require(_0xe31b('0x3'));var rp=require(_0xe31b('0x4'));var fs=require('fs');var path=require(_0xe31b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe31b('0x6'));module['exports']=function(_0x596a03,_0x30edb3){return _0x596a03[_0xe31b('0x7')]('ChatQueueReport',attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe31b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1dc6=['ChatQueueReport','report_chat_queue','uniqueid','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x124936,_0x30def0){var _0xdc59ce=function(_0x368966){while(--_0x368966){_0x124936['push'](_0x124936['shift']());}};_0xdc59ce(++_0x30def0);}(_0x1dc6,0x116));var _0x61dc=function(_0x1b2461,_0x439f2c){_0x1b2461=_0x1b2461-0x0;var _0x21fae1=_0x1dc6[_0x1b2461];return _0x21fae1;};'use strict';var _=require(_0x61dc('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x61dc('0x1'));var rp=require(_0x61dc('0x2'));var fs=require('fs');var path=require(_0x61dc('0x3'));var rimraf=require(_0x61dc('0x4'));var config=require(_0x61dc('0x5'));var attributes=require(_0x61dc('0x6'));module[_0x61dc('0x7')]=function(_0x4f7e28,_0x153339){return _0x4f7e28['define'](_0x61dc('0x8'),attributes,{'tableName':_0x61dc('0x9'),'paranoid':![],'indexes':[{'name':_0x61dc('0xa'),'fields':[_0x61dc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index cd7475e..edcaf09 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 _0xd5f3=['update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateChatQueueReport','create','body','options','raw','UpdateChatQueueReport','ChatQueueReport'];(function(_0x852450,_0xd2456e){var _0x329404=function(_0x4d482b){while(--_0x4d482b){_0x852450['push'](_0x852450['shift']());}};_0x329404(++_0xd2456e);}(_0xd5f3,0x13f));var _0x3d5f=function(_0x5b2aa5,_0x56c22a){_0x5b2aa5=_0x5b2aa5-0x0;var _0x6e9ef1=_0xd5f3[_0x5b2aa5];return _0x6e9ef1;};'use strict';var _=require(_0x3d5f('0x0'));var util=require(_0x3d5f('0x1'));var moment=require(_0x3d5f('0x2'));var BPromise=require(_0x3d5f('0x3'));var rs=require(_0x3d5f('0x4'));var fs=require('fs');var Redis=require(_0x3d5f('0x5'));var db=require(_0x3d5f('0x6'))['db'];var utils=require(_0x3d5f('0x7'));var logger=require(_0x3d5f('0x8'))('rpc');var config=require(_0x3d5f('0x9'));var jayson=require(_0x3d5f('0xa'));var client=jayson[_0x3d5f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cd23f,_0x15dd13,_0x1eef69){return new BPromise(function(_0x2c7f49,_0x282261){return client[_0x3d5f('0xc')](_0x1cd23f,_0x1eef69)[_0x3d5f('0xd')](function(_0x46efe6){logger[_0x3d5f('0xe')](_0x3d5f('0xf'),_0x15dd13,'request\x20sent');logger[_0x3d5f('0x10')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x15dd13,'request\x20sent',JSON[_0x3d5f('0x11')](_0x46efe6));if(_0x46efe6[_0x3d5f('0x12')]){if(_0x46efe6['error'][_0x3d5f('0x13')]===0x1f4){logger[_0x3d5f('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x15dd13,_0x46efe6[_0x3d5f('0x12')][_0x3d5f('0x14')]);return _0x282261(_0x46efe6['error'][_0x3d5f('0x14')]);}logger[_0x3d5f('0x12')](_0x3d5f('0xf'),_0x15dd13,_0x46efe6[_0x3d5f('0x12')]['message']);return _0x2c7f49(_0x46efe6[_0x3d5f('0x12')][_0x3d5f('0x14')]);}else{logger[_0x3d5f('0xe')](_0x3d5f('0xf'),_0x15dd13,_0x3d5f('0x15'));_0x2c7f49(_0x46efe6[_0x3d5f('0x16')][_0x3d5f('0x14')]);}})[_0x3d5f('0x17')](function(_0x548231){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x15dd13,_0x548231);_0x282261(_0x548231);});});}exports[_0x3d5f('0x18')]=function(_0xec572f){var _0x4d540e=this;return new Promise(function(_0x1a690b,_0x345488){return db['ChatQueueReport'][_0x3d5f('0x19')](_0xec572f[_0x3d5f('0x1a')],{'raw':_0xec572f[_0x3d5f('0x1b')]?_0xec572f[_0x3d5f('0x1b')][_0x3d5f('0x1c')]===undefined?!![]:![]:!![]})[_0x3d5f('0xd')](function(_0xec3ff1){logger['info'](_0x3d5f('0x18'),_0xec572f);logger[_0x3d5f('0x10')]('CreateChatQueueReport',_0xec572f,JSON[_0x3d5f('0x11')](_0xec3ff1));_0x1a690b(_0xec3ff1);})['catch'](function(_0xe2ca7b){logger[_0x3d5f('0x12')](_0x3d5f('0x18'),_0xe2ca7b['message'],_0xec572f);_0x345488(_0x4d540e[_0x3d5f('0x12')](0x1f4,_0xe2ca7b[_0x3d5f('0x14')]));});});};exports[_0x3d5f('0x1d')]=function(_0x109eed){var _0x7ed7b8=this;return new Promise(function(_0x3f92e5,_0x358b46){return db[_0x3d5f('0x1e')][_0x3d5f('0x1f')](_0x109eed[_0x3d5f('0x1a')],{'raw':_0x109eed['options']?_0x109eed[_0x3d5f('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x109eed['options']?_0x109eed[_0x3d5f('0x1b')][_0x3d5f('0x20')]||null:null,'attributes':_0x109eed['options']?_0x109eed[_0x3d5f('0x1b')][_0x3d5f('0x21')]||null:null,'limit':_0x109eed['options']?_0x109eed['options'][_0x3d5f('0x22')]||null:null})[_0x3d5f('0xd')](function(_0x83d00a){logger[_0x3d5f('0xe')](_0x3d5f('0x1d'),_0x109eed);logger[_0x3d5f('0x10')]('UpdateChatQueueReport',_0x109eed,JSON[_0x3d5f('0x11')](_0x83d00a));_0x3f92e5(_0x83d00a);})[_0x3d5f('0x17')](function(_0x36913c){logger[_0x3d5f('0x12')]('UpdateChatQueueReport',_0x36913c[_0x3d5f('0x14')],_0x109eed);_0x358b46(_0x7ed7b8[_0x3d5f('0x12')](0x1f4,_0x36913c['message']));});});}; \ No newline at end of file +var _0x6641=['body','options','raw','then','CreateChatQueueReport','stringify','UpdateChatQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','ChatQueueReport','create'];(function(_0x3faabe,_0x24b34a){var _0x24cd69=function(_0x4bba26){while(--_0x4bba26){_0x3faabe['push'](_0x3faabe['shift']());}};_0x24cd69(++_0x24b34a);}(_0x6641,0x113));var _0x1664=function(_0x3ca3ec,_0x82b7eb){_0x3ca3ec=_0x3ca3ec-0x0;var _0x4e3632=_0x6641[_0x3ca3ec];return _0x4e3632;};'use strict';var _=require(_0x1664('0x0'));var util=require('util');var moment=require(_0x1664('0x1'));var BPromise=require(_0x1664('0x2'));var rs=require(_0x1664('0x3'));var fs=require('fs');var Redis=require(_0x1664('0x4'));var db=require(_0x1664('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1664('0x6'))(_0x1664('0x7'));var config=require(_0x1664('0x8'));var jayson=require(_0x1664('0x9'));var client=jayson['client'][_0x1664('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e81c6,_0x555e11,_0x1ec63b){return new BPromise(function(_0x276a64,_0x487825){return client[_0x1664('0xb')](_0x5e81c6,_0x1ec63b)['then'](function(_0x4031ba){logger[_0x1664('0xc')](_0x1664('0xd'),_0x555e11,'request\x20sent');logger[_0x1664('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x555e11,_0x1664('0xf'),JSON['stringify'](_0x4031ba));if(_0x4031ba[_0x1664('0x10')]){if(_0x4031ba[_0x1664('0x10')][_0x1664('0x11')]===0x1f4){logger[_0x1664('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x555e11,_0x4031ba['error']['message']);return _0x487825(_0x4031ba[_0x1664('0x10')]['message']);}logger['error'](_0x1664('0xd'),_0x555e11,_0x4031ba[_0x1664('0x10')][_0x1664('0x12')]);return _0x276a64(_0x4031ba[_0x1664('0x10')][_0x1664('0x12')]);}else{logger[_0x1664('0xc')](_0x1664('0xd'),_0x555e11,_0x1664('0xf'));_0x276a64(_0x4031ba['result'][_0x1664('0x12')]);}})[_0x1664('0x13')](function(_0x5a1f35){logger[_0x1664('0x10')](_0x1664('0xd'),_0x555e11,_0x5a1f35);_0x487825(_0x5a1f35);});});}exports['CreateChatQueueReport']=function(_0x49c013){var _0xdc5db8=this;return new Promise(function(_0x2eb800,_0x30a429){return db[_0x1664('0x14')][_0x1664('0x15')](_0x49c013[_0x1664('0x16')],{'raw':_0x49c013[_0x1664('0x17')]?_0x49c013['options'][_0x1664('0x18')]===undefined?!![]:![]:!![]})[_0x1664('0x19')](function(_0x33f9a4){logger[_0x1664('0xc')](_0x1664('0x1a'),_0x49c013);logger['debug']('CreateChatQueueReport',_0x49c013,JSON[_0x1664('0x1b')](_0x33f9a4));_0x2eb800(_0x33f9a4);})[_0x1664('0x13')](function(_0x41b247){logger[_0x1664('0x10')](_0x1664('0x1a'),_0x41b247[_0x1664('0x12')],_0x49c013);_0x30a429(_0xdc5db8[_0x1664('0x10')](0x1f4,_0x41b247[_0x1664('0x12')]));});});};exports[_0x1664('0x1c')]=function(_0x3afc8d){var _0x134b9a=this;return new Promise(function(_0x4b3bb4,_0x3b60e7){return db[_0x1664('0x14')][_0x1664('0x1d')](_0x3afc8d[_0x1664('0x16')],{'raw':_0x3afc8d[_0x1664('0x17')]?_0x3afc8d[_0x1664('0x17')][_0x1664('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3afc8d[_0x1664('0x17')]?_0x3afc8d[_0x1664('0x17')][_0x1664('0x1e')]||null:null,'attributes':_0x3afc8d[_0x1664('0x17')]?_0x3afc8d[_0x1664('0x17')][_0x1664('0x1f')]||null:null,'limit':_0x3afc8d[_0x1664('0x17')]?_0x3afc8d['options'][_0x1664('0x20')]||null:null})[_0x1664('0x19')](function(_0x4a8357){logger[_0x1664('0xc')]('UpdateChatQueueReport',_0x3afc8d);logger[_0x1664('0xe')](_0x1664('0x1c'),_0x3afc8d,JSON[_0x1664('0x1b')](_0x4a8357));_0x4b3bb4(_0x4a8357);})['catch'](function(_0x342e17){logger[_0x1664('0x10')](_0x1664('0x1c'),_0x342e17[_0x1664('0x12')],_0x3afc8d);_0x3b60e7(_0x134b9a[_0x1664('0x10')](0x1f4,_0x342e17[_0x1664('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 9a30272..2e97413 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 _0xc3ba=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update','destroy','exports','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc3ba,0x9f));var _0xac3b=function(_0x2510ea,_0x1d4b5b){_0x2510ea=_0x2510ea-0x0;var _0x4bb231=_0xc3ba[_0x2510ea];return _0x4bb231;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xac3b('0x0'));var timeout=require('connect-timeout');var express=require(_0xac3b('0x1'));var router=express['Router']();var auth=require(_0xac3b('0x2'));var interaction=require(_0xac3b('0x3'));var config=require(_0xac3b('0x4'));var controller=require(_0xac3b('0x5'));router[_0xac3b('0x6')]('/',auth[_0xac3b('0x7')](),controller[_0xac3b('0x8')]);router[_0xac3b('0x6')](_0xac3b('0x9'),auth[_0xac3b('0x7')](),controller[_0xac3b('0xa')]);router[_0xac3b('0x6')](_0xac3b('0xb'),auth[_0xac3b('0x7')](),controller[_0xac3b('0xc')]);router['post']('/',auth[_0xac3b('0x7')](),controller['create']);router['put'](_0xac3b('0xb'),auth[_0xac3b('0x7')](),controller[_0xac3b('0xd')]);router['delete'](_0xac3b('0xb'),auth[_0xac3b('0x7')](),controller[_0xac3b('0xe')]);module[_0xac3b('0xf')]=router; \ No newline at end of file +var _0x6389=['get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x6389,0x171));var _0x9638=function(_0x44e976,_0x4ff40d){_0x44e976=_0x44e976-0x0;var _0x8a7861=_0x6389[_0x44e976];return _0x8a7861;};'use strict';var multer=require('multer');var util=require(_0x9638('0x0'));var path=require('path');var timeout=require(_0x9638('0x1'));var express=require(_0x9638('0x2'));var router=express[_0x9638('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9638('0x4'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x9638('0x5')]('/',auth[_0x9638('0x6')](),controller[_0x9638('0x7')]);router['get'](_0x9638('0x8'),auth[_0x9638('0x6')](),controller[_0x9638('0x9')]);router[_0x9638('0x5')]('/:id',auth[_0x9638('0x6')](),controller['show']);router[_0x9638('0xa')]('/',auth[_0x9638('0x6')](),controller[_0x9638('0xb')]);router[_0x9638('0xc')](_0x9638('0xd'),auth[_0x9638('0x6')](),controller[_0x9638('0xe')]);router[_0x9638('0xf')](_0x9638('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x9638('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0217f4e..c3b92de 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 _0xf2e0=['sequelize','exports','STRING','ENUM','agent','queue','DATE','moment'];(function(_0x131475,_0xf2e974){var _0x47d6b9=function(_0x38a24d){while(--_0x38a24d){_0x131475['push'](_0x131475['shift']());}};_0x47d6b9(++_0xf2e974);}(_0xf2e0,0x18f));var _0x0f2e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf2e0[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x0f2e('0x0'));var Sequelize=require(_0x0f2e('0x1'));module[_0x0f2e('0x2')]={'uniqueid':{'type':Sequelize[_0x0f2e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0f2e('0x4')]('account',_0x0f2e('0x5'),_0x0f2e('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x0f2e('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xe7c3=['NOW','sequelize','exports','account','agent','queue','DATE'];(function(_0x3c268b,_0x238b63){var _0x3ed33d=function(_0xfb6291){while(--_0xfb6291){_0x3c268b['push'](_0x3c268b['shift']());}};_0x3ed33d(++_0x238b63);}(_0xe7c3,0x1f2));var _0x3e7c=function(_0x404093,_0x4fd27c){_0x404093=_0x404093-0x0;var _0x1e56fc=_0xe7c3[_0x404093];return _0x1e56fc;};'use strict';var moment=require('moment');var Sequelize=require(_0x3e7c('0x0'));module[_0x3e7c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3e7c('0x2'),_0x3e7c('0x3'),_0x3e7c('0x4')),'allowNull':![],'defaultValue':_0x3e7c('0x4')},'transferredAt':{'type':Sequelize[_0x3e7c('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x3e7c('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 6381282..9ab5b71 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 _0x5a62=['update','describe','html-pdf','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','reject','save','then','destroy','error','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','where','pick','type','VIRTUAL','filter','merge','options','ChatTransferReport','include','findAll','rows','catch','show','rawAttributes','fields','length','includeAll','find','create','body'];(function(_0x5d6b0f,_0x4a17e5){var _0x175a5c=function(_0x244c81){while(--_0x244c81){_0x5d6b0f['push'](_0x5d6b0f['shift']());}};_0x175a5c(++_0x4a17e5);}(_0x5a62,0x136));var _0x25a6=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x5a62[_0x504df1];return _0x1063b5;};'use strict';var pdf=require(_0x25a6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x25a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25a6('0x2'));var rp=require(_0x25a6('0x3'));var moment=require(_0x25a6('0x4'));var BPromise=require(_0x25a6('0x5'));var Mustache=require(_0x25a6('0x6'));var util=require(_0x25a6('0x7'));var path=require(_0x25a6('0x8'));var sox=require('sox');var csv=require(_0x25a6('0x9'));var ejs=require(_0x25a6('0xa'));var fs=require('fs');var _=require(_0x25a6('0xb'));var squel=require(_0x25a6('0xc'));var crypto=require(_0x25a6('0xd'));var jsforce=require(_0x25a6('0xe'));var deskjs=require(_0x25a6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x25a6('0x10'));var Papa=require(_0x25a6('0x11'));var Redis=require(_0x25a6('0x12'));var authService=require(_0x25a6('0x13'));var qs=require(_0x25a6('0x14'));var as=require(_0x25a6('0x15'));var hardwareService=require(_0x25a6('0x16'));var logger=require(_0x25a6('0x17'))('api');var utils=require(_0x25a6('0x18'));var config=require(_0x25a6('0x19'));var db=require(_0x25a6('0x1a'))['db'];function respondWithStatusCode(_0x1867b1,_0x4a0221){_0x4a0221=_0x4a0221||0xcc;return function(_0x8ea9fb){if(_0x8ea9fb){return _0x1867b1[_0x25a6('0x1b')](_0x4a0221);}return _0x1867b1[_0x25a6('0x1c')](_0x4a0221)[_0x25a6('0x1d')]();};}function respondWithResult(_0xf8ca97,_0x187599){_0x187599=_0x187599||0xc8;return function(_0x28e1ac){if(_0x28e1ac){return _0xf8ca97['status'](_0x187599)[_0x25a6('0x1e')](_0x28e1ac);}};}function respondWithFilteredResult(_0x103f85,_0x5dc605){return function(_0x28ee10){if(_0x28ee10){var _0x329e0f=_0x28ee10[_0x25a6('0x1f')],_0x3b7fb=_0x5dc605['offset'],_0x4f5563=_0x5dc605[_0x25a6('0x20')]+_0x5dc605['limit'],_0x5af2e6;if(_0x4f5563>=_0x329e0f){_0x4f5563=_0x329e0f;_0x5af2e6=0xc8;}else{_0x5af2e6=0xce;}_0x103f85['status'](_0x5af2e6);return _0x103f85[_0x25a6('0x21')]('Content-Range',_0x3b7fb+'-'+_0x4f5563+'/'+_0x329e0f)[_0x25a6('0x1e')](_0x28ee10);}return null;};}function patchUpdates(_0x34f883){return function(_0x17fdc3){try{jsonpatch['apply'](_0x17fdc3,_0x34f883,!![]);}catch(_0x3bc8f7){return BPromise[_0x25a6('0x22')](_0x3bc8f7);}return _0x17fdc3[_0x25a6('0x23')]();};}function saveUpdates(_0x3a101f,_0xd0f6f2){return function(_0x23f740){if(_0x23f740){return _0x23f740['update'](_0x3a101f)[_0x25a6('0x24')](function(_0x39833f){return _0x39833f;});}return null;};}function removeEntity(_0x5cba41,_0x1bf5a2){return function(_0x333d6a){if(_0x333d6a){return _0x333d6a[_0x25a6('0x25')]()['then'](function(){_0x5cba41['status'](0xcc)[_0x25a6('0x1d')]();});}};}function handleEntityNotFound(_0x181427,_0x513cbb){return function(_0x19dff3){if(!_0x19dff3){_0x181427[_0x25a6('0x1b')](0x194);}return _0x19dff3;};}function handleError(_0x2c147a,_0x261a31){_0x261a31=_0x261a31||0x1f4;return function(_0x22c6c2){logger[_0x25a6('0x26')](_0x22c6c2['stack']);if(_0x22c6c2['name']){delete _0x22c6c2[_0x25a6('0x27')];}_0x2c147a[_0x25a6('0x1c')](_0x261a31)[_0x25a6('0x28')](_0x22c6c2);};}exports[_0x25a6('0x29')]=function(_0x52a6c5,_0x425df9){var _0x3ee2dc={},_0x34171d={},_0x2b28ba={'count':0x0,'rows':[]};var _0x319c81=_[_0x25a6('0x2a')](db['ChatTransferReport']['rawAttributes'],function(_0x314220){return{'name':_0x314220[_0x25a6('0x2b')],'type':_0x314220['type'][_0x25a6('0x2c')]};});_0x34171d[_0x25a6('0x2d')]=_['map'](_0x319c81,_0x25a6('0x27'));_0x34171d[_0x25a6('0x2e')]=_[_0x25a6('0x2f')](_0x52a6c5['query']);_0x34171d[_0x25a6('0x30')]=_[_0x25a6('0x31')](_0x34171d['model'],_0x34171d[_0x25a6('0x2e')]);_0x3ee2dc[_0x25a6('0x32')]=_['intersection'](_0x34171d[_0x25a6('0x2d')],qs['fields'](_0x52a6c5[_0x25a6('0x2e')]['fields']));_0x3ee2dc[_0x25a6('0x32')]=_0x3ee2dc['attributes']['length']?_0x3ee2dc['attributes']:_0x34171d['model'];if(!_0x52a6c5[_0x25a6('0x2e')][_0x25a6('0x33')](_0x25a6('0x34'))){_0x3ee2dc['limit']=qs['limit'](_0x52a6c5[_0x25a6('0x2e')][_0x25a6('0x35')]);_0x3ee2dc[_0x25a6('0x20')]=qs[_0x25a6('0x20')](_0x52a6c5['query'][_0x25a6('0x20')]);}_0x3ee2dc[_0x25a6('0x36')]=qs['sort'](_0x52a6c5['query']['sort']);_0x3ee2dc[_0x25a6('0x37')]=qs[_0x25a6('0x30')](_[_0x25a6('0x38')](_0x52a6c5[_0x25a6('0x2e')],_0x34171d[_0x25a6('0x30')]),_0x319c81);if(_0x52a6c5[_0x25a6('0x2e')]['filter']){_0x3ee2dc[_0x25a6('0x37')]=_['merge'](_0x3ee2dc[_0x25a6('0x37')],{'$or':_[_0x25a6('0x2a')](_0x319c81,function(_0x4f8b95){if(_0x4f8b95[_0x25a6('0x39')]!==_0x25a6('0x3a')){var _0x27615e={};_0x27615e[_0x4f8b95['name']]={'$like':'%'+_0x52a6c5['query'][_0x25a6('0x3b')]+'%'};return _0x27615e;}})});}_0x3ee2dc=_[_0x25a6('0x3c')]({},_0x3ee2dc,_0x52a6c5[_0x25a6('0x3d')]);var _0x22e3df={'where':_0x3ee2dc['where']};return db[_0x25a6('0x3e')]['count'](_0x22e3df)[_0x25a6('0x24')](function(_0x3c1513){_0x2b28ba[_0x25a6('0x1f')]=_0x3c1513;if(_0x52a6c5[_0x25a6('0x2e')]['includeAll']){_0x3ee2dc[_0x25a6('0x3f')]=[{'all':!![]}];}return db[_0x25a6('0x3e')][_0x25a6('0x40')](_0x3ee2dc);})[_0x25a6('0x24')](function(_0x8b84c0){_0x2b28ba[_0x25a6('0x41')]=_0x8b84c0;return _0x2b28ba;})[_0x25a6('0x24')](respondWithFilteredResult(_0x425df9,_0x3ee2dc))[_0x25a6('0x42')](handleError(_0x425df9,null));};exports[_0x25a6('0x43')]=function(_0x4ad3b9,_0xceb344){var _0x49343f={'raw':!![],'where':{'id':_0x4ad3b9['params']['id']}},_0x39a7e0={};_0x39a7e0[_0x25a6('0x2d')]=_[_0x25a6('0x2f')](db[_0x25a6('0x3e')][_0x25a6('0x44')]);_0x39a7e0[_0x25a6('0x2e')]=_[_0x25a6('0x2f')](_0x4ad3b9[_0x25a6('0x2e')]);_0x39a7e0[_0x25a6('0x30')]=_[_0x25a6('0x31')](_0x39a7e0[_0x25a6('0x2d')],_0x39a7e0[_0x25a6('0x2e')]);_0x49343f[_0x25a6('0x32')]=_[_0x25a6('0x31')](_0x39a7e0[_0x25a6('0x2d')],qs[_0x25a6('0x45')](_0x4ad3b9[_0x25a6('0x2e')][_0x25a6('0x45')]));_0x49343f[_0x25a6('0x32')]=_0x49343f[_0x25a6('0x32')][_0x25a6('0x46')]?_0x49343f[_0x25a6('0x32')]:_0x39a7e0['model'];if(_0x4ad3b9[_0x25a6('0x2e')][_0x25a6('0x47')]){_0x49343f['include']=[{'all':!![]}];}_0x49343f=_[_0x25a6('0x3c')]({},_0x49343f,_0x4ad3b9[_0x25a6('0x3d')]);return db[_0x25a6('0x3e')][_0x25a6('0x48')](_0x49343f)[_0x25a6('0x24')](handleEntityNotFound(_0xceb344,null))[_0x25a6('0x24')](respondWithResult(_0xceb344,null))[_0x25a6('0x42')](handleError(_0xceb344,null));};exports[_0x25a6('0x49')]=function(_0x3efa10,_0x1f0f7b){return db[_0x25a6('0x3e')][_0x25a6('0x49')](_0x3efa10[_0x25a6('0x4a')],{})[_0x25a6('0x24')](respondWithResult(_0x1f0f7b,0xc9))[_0x25a6('0x42')](handleError(_0x1f0f7b,null));};exports[_0x25a6('0x4b')]=function(_0x67340e,_0x1cb150){if(_0x67340e['body']['id']){delete _0x67340e['body']['id'];}return db[_0x25a6('0x3e')][_0x25a6('0x48')]({'where':{'id':_0x67340e['params']['id']}})[_0x25a6('0x24')](handleEntityNotFound(_0x1cb150,null))['then'](saveUpdates(_0x67340e['body'],null))[_0x25a6('0x24')](respondWithResult(_0x1cb150,null))[_0x25a6('0x42')](handleError(_0x1cb150,null));};exports[_0x25a6('0x25')]=function(_0x390e19,_0x43522e){return db[_0x25a6('0x3e')][_0x25a6('0x48')]({'where':{'id':_0x390e19['params']['id']}})[_0x25a6('0x24')](handleEntityNotFound(_0x43522e,null))[_0x25a6('0x24')](removeEntity(_0x43522e,null))['catch'](handleError(_0x43522e,null));};exports[_0x25a6('0x4c')]=function(_0x182ed2,_0x1db152){return db[_0x25a6('0x3e')][_0x25a6('0x4c')]()[_0x25a6('0x24')](respondWithResult(_0x1db152,null))[_0x25a6('0x42')](handleError(_0x1db152,null));}; \ No newline at end of file +var _0x4624=['params','rawAttributes','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','error','stack','name','index','map','ChatTransferReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show'];(function(_0x42aab6,_0x487448){var _0x253d30=function(_0x1ffbe3){while(--_0x1ffbe3){_0x42aab6['push'](_0x42aab6['shift']());}};_0x253d30(++_0x487448);}(_0x4624,0x133));var _0x4462=function(_0x253790,_0x329740){_0x253790=_0x253790-0x0;var _0x4d4788=_0x4624[_0x253790];return _0x4d4788;};'use strict';var pdf=require(_0x4462('0x0'));var emlformat=require(_0x4462('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4462('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4462('0x3'));var moment=require(_0x4462('0x4'));var BPromise=require(_0x4462('0x5'));var Mustache=require(_0x4462('0x6'));var util=require(_0x4462('0x7'));var path=require(_0x4462('0x8'));var sox=require(_0x4462('0x9'));var csv=require(_0x4462('0xa'));var ejs=require(_0x4462('0xb'));var fs=require('fs');var _=require(_0x4462('0xc'));var squel=require('squel');var crypto=require(_0x4462('0xd'));var jsforce=require(_0x4462('0xe'));var deskjs=require(_0x4462('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4462('0x10'));var Papa=require(_0x4462('0x11'));var Redis=require(_0x4462('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4462('0x13'));var hardwareService=require(_0x4462('0x14'));var logger=require('../../config/logger')(_0x4462('0x15'));var utils=require(_0x4462('0x16'));var config=require(_0x4462('0x17'));var db=require(_0x4462('0x18'))['db'];function respondWithStatusCode(_0x152e8c,_0xdad084){_0xdad084=_0xdad084||0xcc;return function(_0x49dc68){if(_0x49dc68){return _0x152e8c[_0x4462('0x19')](_0xdad084);}return _0x152e8c[_0x4462('0x1a')](_0xdad084)[_0x4462('0x1b')]();};}function respondWithResult(_0x41b86d,_0xefe2c){_0xefe2c=_0xefe2c||0xc8;return function(_0x5de103){if(_0x5de103){return _0x41b86d[_0x4462('0x1a')](_0xefe2c)[_0x4462('0x1c')](_0x5de103);}};}function respondWithFilteredResult(_0x1e7051,_0x2167fd){return function(_0x471413){if(_0x471413){var _0x1ea2b5=_0x471413[_0x4462('0x1d')],_0x20a6b2=_0x2167fd[_0x4462('0x1e')],_0x5f50da=_0x2167fd['offset']+_0x2167fd[_0x4462('0x1f')],_0x26e366;if(_0x5f50da>=_0x1ea2b5){_0x5f50da=_0x1ea2b5;_0x26e366=0xc8;}else{_0x26e366=0xce;}_0x1e7051[_0x4462('0x1a')](_0x26e366);return _0x1e7051[_0x4462('0x20')](_0x4462('0x21'),_0x20a6b2+'-'+_0x5f50da+'/'+_0x1ea2b5)[_0x4462('0x1c')](_0x471413);}return null;};}function patchUpdates(_0x19be23){return function(_0x591f30){try{jsonpatch['apply'](_0x591f30,_0x19be23,!![]);}catch(_0x13cacb){return BPromise[_0x4462('0x22')](_0x13cacb);}return _0x591f30['save']();};}function saveUpdates(_0x5811fd,_0x3af4be){return function(_0x533c05){if(_0x533c05){return _0x533c05[_0x4462('0x23')](_0x5811fd)[_0x4462('0x24')](function(_0x5dce0f){return _0x5dce0f;});}return null;};}function removeEntity(_0x217bb7,_0x14e1c0){return function(_0x294d8b){if(_0x294d8b){return _0x294d8b['destroy']()[_0x4462('0x24')](function(){_0x217bb7[_0x4462('0x1a')](0xcc)[_0x4462('0x1b')]();});}};}function handleEntityNotFound(_0x261e13,_0x25fea9){return function(_0x306575){if(!_0x306575){_0x261e13['sendStatus'](0x194);}return _0x306575;};}function handleError(_0x40b69c,_0x4a6f08){_0x4a6f08=_0x4a6f08||0x1f4;return function(_0x401339){logger[_0x4462('0x25')](_0x401339[_0x4462('0x26')]);if(_0x401339['name']){delete _0x401339[_0x4462('0x27')];}_0x40b69c[_0x4462('0x1a')](_0x4a6f08)['send'](_0x401339);};}exports[_0x4462('0x28')]=function(_0x2c329f,_0x10f088){var _0x20116a={},_0x2dd10d={},_0x36eac1={'count':0x0,'rows':[]};var _0x492b17=_[_0x4462('0x29')](db[_0x4462('0x2a')]['rawAttributes'],function(_0x4162b0){return{'name':_0x4162b0[_0x4462('0x2b')],'type':_0x4162b0[_0x4462('0x2c')][_0x4462('0x2d')]};});_0x2dd10d['model']=_[_0x4462('0x29')](_0x492b17,_0x4462('0x27'));_0x2dd10d[_0x4462('0x2e')]=_[_0x4462('0x2f')](_0x2c329f[_0x4462('0x2e')]);_0x2dd10d['filters']=_[_0x4462('0x30')](_0x2dd10d[_0x4462('0x31')],_0x2dd10d[_0x4462('0x2e')]);_0x20116a[_0x4462('0x32')]=_['intersection'](_0x2dd10d[_0x4462('0x31')],qs[_0x4462('0x33')](_0x2c329f[_0x4462('0x2e')]['fields']));_0x20116a[_0x4462('0x32')]=_0x20116a[_0x4462('0x32')][_0x4462('0x34')]?_0x20116a[_0x4462('0x32')]:_0x2dd10d['model'];if(!_0x2c329f[_0x4462('0x2e')][_0x4462('0x35')](_0x4462('0x36'))){_0x20116a['limit']=qs[_0x4462('0x1f')](_0x2c329f[_0x4462('0x2e')]['limit']);_0x20116a[_0x4462('0x1e')]=qs[_0x4462('0x1e')](_0x2c329f[_0x4462('0x2e')][_0x4462('0x1e')]);}_0x20116a[_0x4462('0x37')]=qs[_0x4462('0x38')](_0x2c329f[_0x4462('0x2e')]['sort']);_0x20116a[_0x4462('0x39')]=qs[_0x4462('0x3a')](_[_0x4462('0x3b')](_0x2c329f[_0x4462('0x2e')],_0x2dd10d[_0x4462('0x3a')]),_0x492b17);if(_0x2c329f[_0x4462('0x2e')][_0x4462('0x3c')]){_0x20116a[_0x4462('0x39')]=_['merge'](_0x20116a[_0x4462('0x39')],{'$or':_[_0x4462('0x29')](_0x492b17,function(_0x252cfb){if(_0x252cfb[_0x4462('0x2c')]!=='VIRTUAL'){var _0x1f9156={};_0x1f9156[_0x252cfb[_0x4462('0x27')]]={'$like':'%'+_0x2c329f[_0x4462('0x2e')][_0x4462('0x3c')]+'%'};return _0x1f9156;}})});}_0x20116a=_[_0x4462('0x3d')]({},_0x20116a,_0x2c329f[_0x4462('0x3e')]);var _0x28336b={'where':_0x20116a[_0x4462('0x39')]};return db[_0x4462('0x2a')]['count'](_0x28336b)[_0x4462('0x24')](function(_0x553bc9){_0x36eac1[_0x4462('0x1d')]=_0x553bc9;if(_0x2c329f[_0x4462('0x2e')][_0x4462('0x3f')]){_0x20116a[_0x4462('0x40')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x20116a);})[_0x4462('0x24')](function(_0x4ec375){_0x36eac1[_0x4462('0x41')]=_0x4ec375;return _0x36eac1;})[_0x4462('0x24')](respondWithFilteredResult(_0x10f088,_0x20116a))[_0x4462('0x42')](handleError(_0x10f088,null));};exports[_0x4462('0x43')]=function(_0x234fd0,_0x1bd42d){var _0xeb6534={'raw':!![],'where':{'id':_0x234fd0[_0x4462('0x44')]['id']}},_0x593292={};_0x593292[_0x4462('0x31')]=_['keys'](db[_0x4462('0x2a')][_0x4462('0x45')]);_0x593292[_0x4462('0x2e')]=_['keys'](_0x234fd0['query']);_0x593292[_0x4462('0x3a')]=_[_0x4462('0x30')](_0x593292[_0x4462('0x31')],_0x593292[_0x4462('0x2e')]);_0xeb6534[_0x4462('0x32')]=_[_0x4462('0x30')](_0x593292[_0x4462('0x31')],qs[_0x4462('0x33')](_0x234fd0[_0x4462('0x2e')]['fields']));_0xeb6534['attributes']=_0xeb6534[_0x4462('0x32')]['length']?_0xeb6534[_0x4462('0x32')]:_0x593292[_0x4462('0x31')];if(_0x234fd0[_0x4462('0x2e')][_0x4462('0x3f')]){_0xeb6534[_0x4462('0x40')]=[{'all':!![]}];}_0xeb6534=_[_0x4462('0x3d')]({},_0xeb6534,_0x234fd0[_0x4462('0x3e')]);return db[_0x4462('0x2a')][_0x4462('0x46')](_0xeb6534)['then'](handleEntityNotFound(_0x1bd42d,null))[_0x4462('0x24')](respondWithResult(_0x1bd42d,null))[_0x4462('0x42')](handleError(_0x1bd42d,null));};exports[_0x4462('0x47')]=function(_0x11437b,_0x433a62){return db[_0x4462('0x2a')][_0x4462('0x47')](_0x11437b[_0x4462('0x48')],{})[_0x4462('0x24')](respondWithResult(_0x433a62,0xc9))[_0x4462('0x42')](handleError(_0x433a62,null));};exports[_0x4462('0x23')]=function(_0x5cee39,_0x25f117){if(_0x5cee39[_0x4462('0x48')]['id']){delete _0x5cee39[_0x4462('0x48')]['id'];}return db[_0x4462('0x2a')][_0x4462('0x46')]({'where':{'id':_0x5cee39['params']['id']}})[_0x4462('0x24')](handleEntityNotFound(_0x25f117,null))[_0x4462('0x24')](saveUpdates(_0x5cee39[_0x4462('0x48')],null))[_0x4462('0x24')](respondWithResult(_0x25f117,null))[_0x4462('0x42')](handleError(_0x25f117,null));};exports[_0x4462('0x49')]=function(_0x33fb61,_0x453091){return db[_0x4462('0x2a')]['find']({'where':{'id':_0x33fb61[_0x4462('0x44')]['id']}})['then'](handleEntityNotFound(_0x453091,null))[_0x4462('0x24')](removeEntity(_0x453091,null))['catch'](handleError(_0x453091,null));};exports[_0x4462('0x4a')]=function(_0x2d8b54,_0x3e753a){return db['ChatTransferReport'][_0x4462('0x4a')]()[_0x4462('0x24')](respondWithResult(_0x3e753a,null))['catch'](handleError(_0x3e753a,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 6f74fb7..dd9d9df 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 _0x54ef=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x483d76,_0x2c0f05){var _0x2dbecd=function(_0x4ab398){while(--_0x4ab398){_0x483d76['push'](_0x483d76['shift']());}};_0x2dbecd(++_0x2c0f05);}(_0x54ef,0x112));var _0xf54e=function(_0xf55f42,_0x415ff4){_0xf55f42=_0xf55f42-0x0;var _0x10b233=_0x54ef[_0xf55f42];return _0x10b233;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xf54e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x413601,_0x59a43a){var _0x24229d=function(_0x17c706){while(--_0x17c706){_0x413601['push'](_0x413601['shift']());}};_0x24229d(++_0x59a43a);}(_0x54ef,0x112));var _0xf54e=function(_0x3508a2,_0x43618e){_0x3508a2=_0x3508a2-0x0;var _0x537259=_0x54ef[_0x3508a2];return _0x537259;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xf54e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index f3a7bd4..3ed75be 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 _0x5c19=['../../config/logger','rpc','../../config/environment','http','request','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x12a349,_0x1f3c95){var _0x1d6caa=function(_0x1c286e){while(--_0x1c286e){_0x12a349['push'](_0x12a349['shift']());}};_0x1d6caa(++_0x1f3c95);}(_0x5c19,0xc7));var _0x95c1=function(_0x340fc7,_0x12a901){_0x340fc7=_0x340fc7-0x0;var _0x586c93=_0x5c19[_0x340fc7];return _0x586c93;};'use strict';var _=require(_0x95c1('0x0'));var util=require(_0x95c1('0x1'));var moment=require(_0x95c1('0x2'));var BPromise=require(_0x95c1('0x3'));var rs=require(_0x95c1('0x4'));var fs=require('fs');var Redis=require(_0x95c1('0x5'));var db=require(_0x95c1('0x6'))['db'];var utils=require(_0x95c1('0x7'));var logger=require(_0x95c1('0x8'))(_0x95c1('0x9'));var config=require(_0x95c1('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x95c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d3763,_0x102058,_0x4d6be2){return new BPromise(function(_0x397569,_0x21d7a5){return client[_0x95c1('0xc')](_0x1d3763,_0x4d6be2)['then'](function(_0x245211){logger[_0x95c1('0xd')](_0x95c1('0xe'),_0x102058,'request\x20sent');logger[_0x95c1('0xf')](_0x95c1('0x10'),_0x102058,_0x95c1('0x11'),JSON[_0x95c1('0x12')](_0x245211));if(_0x245211[_0x95c1('0x13')]){if(_0x245211[_0x95c1('0x13')][_0x95c1('0x14')]===0x1f4){logger['error'](_0x95c1('0xe'),_0x102058,_0x245211[_0x95c1('0x13')][_0x95c1('0x15')]);return _0x21d7a5(_0x245211[_0x95c1('0x13')][_0x95c1('0x15')]);}logger[_0x95c1('0x13')](_0x95c1('0xe'),_0x102058,_0x245211[_0x95c1('0x13')][_0x95c1('0x15')]);return _0x397569(_0x245211[_0x95c1('0x13')][_0x95c1('0x15')]);}else{logger[_0x95c1('0xd')](_0x95c1('0xe'),_0x102058,_0x95c1('0x11'));_0x397569(_0x245211['result'][_0x95c1('0x15')]);}})[_0x95c1('0x16')](function(_0x50e928){logger[_0x95c1('0x13')](_0x95c1('0xe'),_0x102058,_0x50e928);_0x21d7a5(_0x50e928);});});} \ No newline at end of file +var _0x11cc=['request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0x11cc,0x110));var _0xc11c=function(_0xbeab9,_0x37ec4a){_0xbeab9=_0xbeab9-0x0;var _0x27650c=_0x11cc[_0xbeab9];return _0x27650c;};'use strict';var _=require(_0xc11c('0x0'));var util=require(_0xc11c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc11c('0x2'));var fs=require('fs');var Redis=require(_0xc11c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc11c('0x4'));var logger=require(_0xc11c('0x5'))(_0xc11c('0x6'));var config=require(_0xc11c('0x7'));var jayson=require(_0xc11c('0x8'));var client=jayson[_0xc11c('0x9')][_0xc11c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fe3b2,_0x385cf0,_0x22a66c){return new BPromise(function(_0x2c4d35,_0x4ed95c){return client['request'](_0x3fe3b2,_0x22a66c)[_0xc11c('0xb')](function(_0x5bed64){logger[_0xc11c('0xc')](_0xc11c('0xd'),_0x385cf0,_0xc11c('0xe'));logger[_0xc11c('0xf')](_0xc11c('0x10'),_0x385cf0,_0xc11c('0xe'),JSON[_0xc11c('0x11')](_0x5bed64));if(_0x5bed64[_0xc11c('0x12')]){if(_0x5bed64[_0xc11c('0x12')][_0xc11c('0x13')]===0x1f4){logger[_0xc11c('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x385cf0,_0x5bed64['error'][_0xc11c('0x14')]);return _0x4ed95c(_0x5bed64[_0xc11c('0x12')][_0xc11c('0x14')]);}logger[_0xc11c('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x385cf0,_0x5bed64['error'][_0xc11c('0x14')]);return _0x2c4d35(_0x5bed64[_0xc11c('0x12')][_0xc11c('0x14')]);}else{logger[_0xc11c('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x385cf0,_0xc11c('0xe'));_0x2c4d35(_0x5bed64[_0xc11c('0x15')][_0xc11c('0x14')]);}})['catch'](function(_0x391a96){logger[_0xc11c('0x12')](_0xc11c('0xd'),_0x385cf0,_0x391a96);_0x4ed95c(_0x391a96);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 5b37307..0a6e301 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(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_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 _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x906120,_0x258135){var _0x1a7555=function(_0x383830){while(--_0x383830){_0x906120['push'](_0x906120['shift']());}};_0x1a7555(++_0x258135);}(_0xb7e7,0x121));var _0x7b7e=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xb7e7[_0x46d0c9];return _0x174506;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 03d53c5..569d560 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 _0x0578=['randomstring','exports','STRING','email','#ffffff','INTEGER','squared','rounded','We\x20are\x20here!','Chat','Send','BOOLEAN','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','TEXT','stringify','input','name','text','getDataValue','parse','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.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize'];(function(_0x381256,_0x5ebe30){var _0x20215f=function(_0x3f9dd0){while(--_0x3f9dd0){_0x381256['push'](_0x381256['shift']());}};_0x20215f(++_0x5ebe30);}(_0x0578,0x1b8));var _0x8057=function(_0x5bed39,_0x3d4347){_0x5bed39=_0x5bed39-0x0;var _0x523a8e=_0x0578[_0x5bed39];return _0x523a8e;};'use strict';var Sequelize=require(_0x8057('0x0'));var rs=require(_0x8057('0x1'));module[_0x8057('0x2')]={'name':{'type':Sequelize[_0x8057('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x8057('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x8057('0x3')]},'mapKey':{'type':Sequelize[_0x8057('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8057('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x8057('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8057('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8057('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8057('0x3')],'allowNull':![],'defaultValue':_0x8057('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8057('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8057('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x8057('0x7')),'defaultValue':_0x8057('0x8')},'header_online':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x9')},'start_chat_button':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8057('0xb')},'header_offline':{'type':Sequelize[_0x8057('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x8057('0xc')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8057('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x8057('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x8057('0xc')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8057('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0xf')},'noteTitle':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x10')},'placeholderMessage':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x11')},'closingMessage':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x12')},'closingMessageButton':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0xb')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8057('0x13')},'conditionAgreement':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x14')},'ratingType':{'type':Sequelize[_0x8057('0x15')](_0x8057('0x16'),_0x8057('0x17')),'defaultValue':_0x8057('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x8057('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8057('0x18')],'defaultValue':function(){return JSON[_0x8057('0x19')]({'items':[{'type':_0x8057('0x1a'),'variable':null,'config':{'placeholder':_0x8057('0x1b'),'type':_0x8057('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x8057('0x1a'),'props':{'title':_0x8057('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x8057('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8057('0x1d')]('onlineForm')?JSON[_0x8057('0x1e')](this[_0x8057('0x1d')]('onlineForm')):{};},'set':function(_0x3084b1){return this[_0x8057('0x1f')]('onlineForm',JSON[_0x8057('0x19')](_0x3084b1));}},'offlineForm':{'type':Sequelize[_0x8057('0x18')],'defaultValue':function(){return JSON[_0x8057('0x19')]({'items':[{'type':_0x8057('0x1a'),'props':{'title':_0x8057('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8057('0x4'),'type':'email'},'variable':null},{'type':_0x8057('0x20'),'config':{'placeholder':_0x8057('0x21')},'props':{'title':_0x8057('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x8057('0x1d')](_0x8057('0x22'))?JSON[_0x8057('0x1e')](this['getDataValue'](_0x8057('0x22'))):{};},'set':function(_0x497bd7){return this['setDataValue'](_0x8057('0x22'),JSON['stringify'](_0x497bd7));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8057('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8057('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8057('0x3')]},'waitingTitle':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x24')},'waitingMessage':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x8057('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x8057('0xc')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8057('0x27')},'skipUnmanaged':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x13')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x8057('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8057('0x3')]},'notificationTemplate':{'type':Sequelize[_0x8057('0x18')],'defaultValue':function(){return _0x8057('0x28');}},'notificationSound':{'type':Sequelize[_0x8057('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x8057('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x2b')},'defaultTitle':{'type':Sequelize[_0x8057('0x3')]},'customerAvatar':{'type':Sequelize[_0x8057('0x18')]},'showCustomerAvatar':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8057('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8057('0x3')],'allowNull':![],'defaultValue':_0x8057('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8057('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8057('0x6')],'comment':_0x8057('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![],'comment':_0x8057('0x2f'),'set':function(_0x2d1ae9){if(!_0x2d1ae9)this['setDataValue'](_0x8057('0x30'),null);this['setDataValue']('mandatoryDisposition',_0x2d1ae9);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0xe93a=['sequelize','randomstring','STRING','email','Agent','#011F6A','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Thanks\x20you\x20for\x20your\x20time!','Feedback','ENUM','thumb','stringify','name','getDataValue','onlineForm','parse','input','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x3a2e9a,_0x52f198){var _0x511b2c=function(_0x55bd89){while(--_0x55bd89){_0x3a2e9a['push'](_0x3a2e9a['shift']());}};_0x511b2c(++_0x52f198);}(_0xe93a,0x1a7));var _0xae93=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xe93a[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xae93('0x0'));var rs=require(_0xae93('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xae93('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0x3')},'mapKeyOffline':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xae93('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xae93('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xae93('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xae93('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xae93('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xae93('0x2')]},'animation':{'type':Sequelize[_0xae93('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xae93('0x8'),_0xae93('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0xa')},'start_chat_button':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0xb')},'download_transcript':{'type':Sequelize[_0xae93('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0xc')},'defaultWhiteLabel':{'type':Sequelize[_0xae93('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xae93('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0xf')},'closingMessageButton':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x10')},'ratingType':{'type':Sequelize[_0xae93('0x11')]('star',_0xae93('0x12')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xae93('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xae93('0xd')],'defaultValue':function(){return JSON[_0xae93('0x13')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xae93('0x14'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xae93('0x3'),'type':_0xae93('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xae93('0x15')](_0xae93('0x16'))?JSON[_0xae93('0x17')](this['getDataValue'](_0xae93('0x16'))):{};},'set':function(_0x19f2fd){return this['setDataValue'](_0xae93('0x16'),JSON[_0xae93('0x13')](_0x19f2fd));}},'offlineForm':{'type':Sequelize[_0xae93('0xd')],'defaultValue':function(){return JSON[_0xae93('0x13')]({'items':[{'type':_0xae93('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xae93('0x3'),'type':_0xae93('0x3')},'variable':null},{'type':_0xae93('0x19'),'config':{'placeholder':_0xae93('0x1a')},'props':{'title':'Comments','helpText':_0xae93('0x1b')}}],'fromKey':0x0});},'get':function(){return this[_0xae93('0x15')](_0xae93('0x1c'))?JSON[_0xae93('0x17')](this['getDataValue'](_0xae93('0x1c'))):{};},'set':function(_0x32258d){return this[_0xae93('0x1d')](_0xae93('0x1c'),JSON['stringify'](_0x32258d));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xae93('0x1e')]();}},'autoclose':{'type':Sequelize[_0xae93('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xae93('0x2')]},'forwardOffline':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xae93('0x2')]},'waitingTitle':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x1f')},'waitingMessage':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x20')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0x21')},'offlineMessageBody':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x22')},'enableUnmanagedNote':{'type':Sequelize[_0xae93('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x23')},'skipUnmanaged':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x24')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0x25')},'enableCustomerAttachment':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xae93('0xd')],'defaultValue':function(){return _0xae93('0x26');}},'notificationSound':{'type':Sequelize[_0xae93('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0xae93('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xae93('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x28')},'defaultTitle':{'type':Sequelize[_0xae93('0x2')]},'customerAvatar':{'type':Sequelize[_0xae93('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xae93('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xae93('0x2')],'allowNull':![],'defaultValue':_0xae93('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xae93('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x2a')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae93('0x6')],'comment':_0xae93('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![],'comment':_0xae93('0x2c'),'set':function(_0x2c4395){if(!_0x2c4395)this[_0xae93('0x1d')](_0xae93('0x2d'),null);this['setDataValue'](_0xae93('0x2e'),_0x2c4395);}},'vidaooEscalation':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xae93('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 0223d1f..e4866de 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 _0xe194=['findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','port','secure','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','Owner','fullname','internal','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','inspect','No\x20timezone','Interval','Intervals','virtual','License','increment','all','server/files/chat/iframe.js','utf8','remote','x-real-ip','connection','replace','render','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','online','false','offlineForm','items','fromKey','ChatOfflineMessage','Contact','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','destroy','get','UserProfileResource','stack','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','merge','name','options','where','include','findAll','show','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','customerAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','isNil','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','contact','customerIp','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','format','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','CmList'];(function(_0x24be8e,_0x45abbc){var _0x300093=function(_0x36979a){while(--_0x36979a){_0x24be8e['push'](_0x24be8e['shift']());}};_0x300093(++_0x45abbc);}(_0xe194,0x167));var _0x4e19=function(_0x1bc762,_0x523eb3){_0x1bc762=_0x1bc762-0x0;var _0x40f70c=_0xe194[_0x1bc762];return _0x40f70c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4e19('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e19('0x1'));var jsonpatch=require(_0x4e19('0x2'));var rp=require('request-promise');var moment=require(_0x4e19('0x3'));var BPromise=require(_0x4e19('0x4'));var Mustache=require('mustache');var util=require(_0x4e19('0x5'));var path=require(_0x4e19('0x6'));var sox=require(_0x4e19('0x7'));var csv=require(_0x4e19('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4e19('0x9'));var squel=require('squel');var crypto=require(_0x4e19('0xa'));var jsforce=require(_0x4e19('0xb'));var deskjs=require(_0x4e19('0xc'));var toCsv=require(_0x4e19('0x8'));var querystring=require(_0x4e19('0xd'));var Papa=require(_0x4e19('0xe'));var Redis=require(_0x4e19('0xf'));var authService=require(_0x4e19('0x10'));var qs=require(_0x4e19('0x11'));var as=require(_0x4e19('0x12'));var hardwareService=require(_0x4e19('0x13'));var logger=require(_0x4e19('0x14'))(_0x4e19('0x15'));var utils=require(_0x4e19('0x16'));var config=require(_0x4e19('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4e19('0x18')](config[_0x4e19('0x19')],{'host':_0x4e19('0x1a'),'port':0x18eb});var socket=require(_0x4e19('0x1b'))(new Redis(config[_0x4e19('0x19')]));require('./chatWebsite.socket')[_0x4e19('0x1c')](socket);var jayson=require(_0x4e19('0x1d'));var client=jayson['client'][_0x4e19('0x1e')]({'port':0x232c});var client9002=jayson[_0x4e19('0x1f')][_0x4e19('0x1e')]({'port':0x232a});var client9003=jayson[_0x4e19('0x1f')][_0x4e19('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x3436ac,_0x5373a8,_0x1ed93f){if(_0x1ed93f){var _0x445d16=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x445d16['test'](_0x5373a8)){return _0x3436ac;}else{throw new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))](_0x4e19('0x22'));}}else{return _0x3436ac;}}function respondWithRpcPromise(_0x111037,_0x279703,_0x1f48ca,_0x50abbd){return new BPromise(function(_0x267df6,_0x5a11d5){var _0x1b1607=_0x50abbd||client;return _0x1b1607[_0x4e19('0x23')](_0x111037,_0x1f48ca)['then'](function(_0x25ddb8){logger[_0x4e19('0x24')](_0x4e19('0x25'),_0x279703,'request\x20sent');logger[_0x4e19('0x26')](_0x4e19('0x27'),_0x279703,_0x4e19('0x28'),JSON['stringify'](_0x25ddb8));if(_0x25ddb8[_0x4e19('0x29')]){if(_0x25ddb8[_0x4e19('0x29')][_0x4e19('0x2a')]===0x1f4){logger[_0x4e19('0x29')](_0x4e19('0x25'),_0x279703,_0x25ddb8[_0x4e19('0x29')]['message']);return _0x5a11d5(_0x25ddb8[_0x4e19('0x29')][_0x4e19('0x2b')]);}logger[_0x4e19('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x279703,_0x25ddb8['error'][_0x4e19('0x2b')]);return _0x267df6(_0x25ddb8[_0x4e19('0x29')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x279703,'request\x20sent');_0x267df6(_0x25ddb8[_0x4e19('0x2c')][_0x4e19('0x2b')]);}})[_0x4e19('0x2d')](function(_0x1b04a9){logger[_0x4e19('0x29')](_0x4e19('0x25'),_0x279703,_0x1b04a9);_0x5a11d5(_0x1b04a9);});});}function respondWithStatusCode(_0x32aac5,_0x10bc2a){_0x10bc2a=_0x10bc2a||0xcc;return function(_0x339922){if(_0x339922){return _0x32aac5[_0x4e19('0x2e')](_0x10bc2a);}return _0x32aac5[_0x4e19('0x2f')](_0x10bc2a)[_0x4e19('0x30')]();};}function respondWithResult(_0x529e2d,_0x68da86){_0x68da86=_0x68da86||0xc8;return function(_0x503755){if(_0x503755){return _0x529e2d[_0x4e19('0x2f')](_0x68da86)['json'](_0x503755);}};}function respondWithFilteredResult(_0x243eb6,_0x3bcae5){return function(_0x5647f1){if(_0x5647f1){var _0x26d979=_0x5647f1[_0x4e19('0x31')],_0x59ce15=_0x3bcae5['offset'],_0x192157=_0x3bcae5[_0x4e19('0x32')]+_0x3bcae5[_0x4e19('0x33')],_0x3c2b1b;if(_0x192157>=_0x26d979){_0x192157=_0x26d979;_0x3c2b1b=0xc8;}else{_0x3c2b1b=0xce;}_0x243eb6['status'](_0x3c2b1b);return _0x243eb6[_0x4e19('0x34')]('Content-Range',_0x59ce15+'-'+_0x192157+'/'+_0x26d979)[_0x4e19('0x35')](_0x5647f1);}return null;};}function patchUpdates(_0x19bf81){return function(_0x16a996){try{jsonpatch[_0x4e19('0x36')](_0x16a996,_0x19bf81,!![]);}catch(_0x1ed3cf){return BPromise[_0x4e19('0x37')](_0x1ed3cf);}return _0x16a996['save']();};}function saveUpdates(_0x586929,_0xc41dc4){return function(_0x55ae48){if(_0x55ae48){return _0x55ae48[_0x4e19('0x38')](_0x586929)[_0x4e19('0x39')](function(_0x1cbf9a){return _0x1cbf9a;});}return null;};}function removeEntity(_0x545fea,_0x2c5514){return function(_0x46b448){if(_0x46b448){return _0x46b448[_0x4e19('0x3a')]()[_0x4e19('0x39')](function(){var _0x570e64=_0x46b448[_0x4e19('0x3b')]({'plain':!![]});var _0x2c227c='ChatWebsites';return db[_0x4e19('0x3c')][_0x4e19('0x3a')]({'where':{'type':_0x2c227c,'resourceId':_0x570e64['id']}})[_0x4e19('0x39')](function(){return _0x46b448;});})['then'](function(){_0x545fea['status'](0xcc)[_0x4e19('0x30')]();});}};}function handleEntityNotFound(_0xb74050,_0x50a552){return function(_0x5f13eb){if(!_0x5f13eb){_0xb74050[_0x4e19('0x2e')](0x194);}return _0x5f13eb;};}function handleError(_0x332d6c,_0x380b4e){_0x380b4e=_0x380b4e||0x1f4;return function(_0x2cd8aa){logger[_0x4e19('0x29')](_0x2cd8aa[_0x4e19('0x3d')]);if(_0x2cd8aa['name']){delete _0x2cd8aa['name'];}_0x332d6c[_0x4e19('0x2f')](_0x380b4e)[_0x4e19('0x3e')](_0x2cd8aa);};}exports['index']=function(_0x283d58,_0x30c1db){var _0x29472b={'include':[{'model':db[_0x4e19('0x3f')],'as':_0x4e19('0x40')}]},_0x3c3506={},_0x429a3f={'count':0x0,'rows':[]};var _0x2ab866=_[_0x4e19('0x41')](db[_0x4e19('0x42')][_0x4e19('0x43')],function(_0x2343ef){return{'name':_0x2343ef[_0x4e19('0x44')],'type':_0x2343ef[_0x4e19('0x45')][_0x4e19('0x46')]};});_0x3c3506[_0x4e19('0x47')]=_[_0x4e19('0x41')](_0x2ab866,'name');_0x3c3506['query']=_['keys'](_0x283d58[_0x4e19('0x48')]);_0x3c3506['filters']=_[_0x4e19('0x49')](_0x3c3506[_0x4e19('0x47')],_0x3c3506[_0x4e19('0x48')]);_0x29472b[_0x4e19('0x4a')]=_[_0x4e19('0x49')](_0x3c3506['model'],qs[_0x4e19('0x4b')](_0x283d58['query'][_0x4e19('0x4b')]));_0x29472b[_0x4e19('0x4a')]=_0x29472b[_0x4e19('0x4a')][_0x4e19('0x4c')]?_0x29472b['attributes']:_0x3c3506[_0x4e19('0x47')];if(!_0x283d58[_0x4e19('0x48')]['hasOwnProperty'](_0x4e19('0x4d'))){_0x29472b['limit']=qs['limit'](_0x283d58[_0x4e19('0x48')][_0x4e19('0x33')]);_0x29472b[_0x4e19('0x32')]=qs['offset'](_0x283d58['query']['offset']);}_0x29472b['order']=qs[_0x4e19('0x4e')](_0x283d58['query'][_0x4e19('0x4e')]);_0x29472b['where']=qs[_0x4e19('0x4f')](_[_0x4e19('0x50')](_0x283d58['query'],_0x3c3506[_0x4e19('0x4f')]),_0x2ab866);if(_0x283d58[_0x4e19('0x48')][_0x4e19('0x51')]){_0x29472b['where']=_[_0x4e19('0x52')](_0x29472b['where'],{'$or':_[_0x4e19('0x41')](_0x2ab866,function(_0x44a168){if(_0x44a168['type']!=='VIRTUAL'){var _0x523d71={};_0x523d71[_0x44a168[_0x4e19('0x53')]]={'$like':'%'+_0x283d58[_0x4e19('0x48')][_0x4e19('0x51')]+'%'};return _0x523d71;}})});}_0x29472b=_[_0x4e19('0x52')]({},_0x29472b,_0x283d58[_0x4e19('0x54')]);var _0x228597={'where':_0x29472b[_0x4e19('0x55')]};return db[_0x4e19('0x42')]['count'](_0x228597)[_0x4e19('0x39')](function(_0x4d137a){_0x429a3f['count']=_0x4d137a;if(_0x283d58[_0x4e19('0x48')]['includeAll']){_0x29472b[_0x4e19('0x56')]=[{'all':!![]}];}return db[_0x4e19('0x42')][_0x4e19('0x57')](_0x29472b);})[_0x4e19('0x39')](function(_0x89a546){_0x429a3f['rows']=_0x89a546;return _0x429a3f;})['then'](respondWithFilteredResult(_0x30c1db,_0x29472b))[_0x4e19('0x2d')](handleError(_0x30c1db,null));};exports[_0x4e19('0x58')]=function(_0x276e0f,_0x1b8acd){var _0x17e72c={'raw':![],'where':{'id':_0x276e0f['params']['id']},'include':[{'model':db[_0x4e19('0x3f')],'as':_0x4e19('0x40')}]},_0x206925={};_0x206925['model']=_[_0x4e19('0x59')](db[_0x4e19('0x42')][_0x4e19('0x43')]);_0x206925[_0x4e19('0x48')]=_[_0x4e19('0x59')](_0x276e0f[_0x4e19('0x48')]);_0x206925[_0x4e19('0x4f')]=_['intersection'](_0x206925[_0x4e19('0x47')],_0x206925[_0x4e19('0x48')]);_0x17e72c[_0x4e19('0x4a')]=_[_0x4e19('0x49')](_0x206925[_0x4e19('0x47')],qs[_0x4e19('0x4b')](_0x276e0f[_0x4e19('0x48')][_0x4e19('0x4b')]));_0x17e72c[_0x4e19('0x4a')]=_0x17e72c[_0x4e19('0x4a')][_0x4e19('0x4c')]?_0x17e72c[_0x4e19('0x4a')]:_0x206925[_0x4e19('0x47')];if(_0x276e0f['query'][_0x4e19('0x5a')]){_0x17e72c['include']=[{'all':!![]}];}_0x17e72c=_[_0x4e19('0x52')]({},_0x17e72c,_0x276e0f[_0x4e19('0x54')]);return db[_0x4e19('0x42')]['find'](_0x17e72c)[_0x4e19('0x39')](handleEntityNotFound(_0x1b8acd,null))['then'](respondWithResult(_0x1b8acd,null))['catch'](handleError(_0x1b8acd,null));};exports[_0x4e19('0x5b')]=function(_0x346bd7,_0x2c3a72){return db[_0x4e19('0x42')][_0x4e19('0x5b')](_0x346bd7[_0x4e19('0x5c')],{})[_0x4e19('0x39')](function(_0x346f6d){var _0x562dc1=_0x346bd7[_0x4e19('0x5d')][_0x4e19('0x3b')]({'plain':!![]});if(!_0x562dc1)throw new Error(_0x4e19('0x5e'));if(_0x562dc1[_0x4e19('0x5f')]===_0x4e19('0x5d')){var _0x5dcc7a=_0x346f6d[_0x4e19('0x3b')]({'plain':!![]});var _0x466f55='ChatWebsites';return db['UserProfileSection'][_0x4e19('0x60')]({'where':{'name':_0x466f55,'userProfileId':_0x562dc1['userProfileId']},'raw':!![]})['then'](function(_0x171309){if(_0x171309&&_0x171309[_0x4e19('0x61')]===0x0){return db[_0x4e19('0x3c')][_0x4e19('0x5b')]({'name':_0x5dcc7a[_0x4e19('0x53')],'resourceId':_0x5dcc7a['id'],'type':_0x171309['name'],'sectionId':_0x171309['id']},{})[_0x4e19('0x39')](function(){return _0x346f6d;});}else{return _0x346f6d;}})[_0x4e19('0x2d')](function(_0x5cdc90){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cdc90);throw _0x5cdc90;});}return _0x346f6d;})[_0x4e19('0x39')](respondWithResult(_0x2c3a72,0xc9))[_0x4e19('0x2d')](handleError(_0x2c3a72,null));};exports['update']=function(_0x2648fc,_0x274198){if(_0x2648fc[_0x4e19('0x5c')]['id']){delete _0x2648fc[_0x4e19('0x5c')]['id'];}return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x2648fc['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x4e19('0x39')](handleEntityNotFound(_0x274198,null))[_0x4e19('0x39')](saveUpdates(_0x2648fc['body'],null))[_0x4e19('0x39')](respondWithResult(_0x274198,null))[_0x4e19('0x2d')](handleError(_0x274198,null));};exports[_0x4e19('0x3a')]=function(_0x13a7fd,_0x507237){return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x13a7fd[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x507237,null))[_0x4e19('0x39')](removeEntity(_0x507237,null))[_0x4e19('0x2d')](handleError(_0x507237,null));};exports[_0x4e19('0x63')]=function(_0x55c002,_0xbb787d){return db['ChatWebsite'][_0x4e19('0x63')]()[_0x4e19('0x39')](respondWithResult(_0xbb787d,null))['catch'](handleError(_0xbb787d,null));};exports[_0x4e19('0x64')]=function(_0xd7f5cb,_0x12e443,_0x2b9ffc){if(_0xd7f5cb[_0x4e19('0x5c')]['id']){delete _0xd7f5cb[_0x4e19('0x5c')]['id'];}return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0xd7f5cb[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x12e443,null))[_0x4e19('0x39')](function(_0x5e63af){if(_0x5e63af){_0xd7f5cb[_0x4e19('0x5c')][_0x4e19('0x65')]=_0x5e63af['id'];return db[_0x4e19('0x66')][_0x4e19('0x5b')](_0xd7f5cb[_0x4e19('0x5c')]);}})[_0x4e19('0x39')](respondWithResult(_0x12e443,null))[_0x4e19('0x2d')](handleError(_0x12e443,null));};exports[_0x4e19('0x67')]=function(_0x4eafcb,_0x4fd1aa,_0x125ade){var _0x8d4715={'raw':![],'where':{}};var _0x1fa18e={};var _0x5d0126={'count':0x0,'rows':[]};return db[_0x4e19('0x42')][_0x4e19('0x68')]({'where':{'id':_0x4eafcb[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x4fd1aa,null))[_0x4e19('0x39')](function(_0x8df13a){if(_0x8df13a){_0x1fa18e[_0x4e19('0x47')]=_[_0x4e19('0x59')](db['Disposition'][_0x4e19('0x43')]);_0x1fa18e['query']=_['keys'](_0x4eafcb[_0x4e19('0x48')]);_0x1fa18e[_0x4e19('0x4f')]=_[_0x4e19('0x49')](_0x1fa18e[_0x4e19('0x47')],_0x1fa18e[_0x4e19('0x48')]);_0x8d4715[_0x4e19('0x4a')]=_[_0x4e19('0x49')](_0x1fa18e[_0x4e19('0x47')],qs[_0x4e19('0x4b')](_0x4eafcb[_0x4e19('0x48')][_0x4e19('0x4b')]));_0x8d4715[_0x4e19('0x4a')]=_0x8d4715['attributes'][_0x4e19('0x4c')]?_0x8d4715[_0x4e19('0x4a')]:_0x1fa18e[_0x4e19('0x47')];if(!_0x4eafcb['query'][_0x4e19('0x69')]('nolimit')){_0x8d4715[_0x4e19('0x33')]=qs[_0x4e19('0x33')](_0x4eafcb['query'][_0x4e19('0x33')]);_0x8d4715[_0x4e19('0x32')]=qs[_0x4e19('0x32')](_0x4eafcb[_0x4e19('0x48')][_0x4e19('0x32')]);}_0x8d4715[_0x4e19('0x6a')]=qs[_0x4e19('0x4e')](_0x4eafcb[_0x4e19('0x48')]['sort']);_0x8d4715[_0x4e19('0x55')]=qs[_0x4e19('0x4f')](_[_0x4e19('0x50')](_0x4eafcb['query'],_0x1fa18e['filters']));_0x8d4715[_0x4e19('0x55')][_0x4e19('0x65')]=_0x8df13a['id'];if(_0x4eafcb[_0x4e19('0x48')]['filter']){_0x8d4715['where']=_[_0x4e19('0x52')](_0x8d4715[_0x4e19('0x55')],{'$or':_['map'](_0x8d4715[_0x4e19('0x4a')],function(_0x3524e5){var _0x2a8744={};_0x2a8744[_0x3524e5]={'$like':'%'+_0x4eafcb[_0x4e19('0x48')][_0x4e19('0x51')]+'%'};return _0x2a8744;})});}_0x8d4715=_[_0x4e19('0x52')]({},_0x8d4715,_0x4eafcb['options']);return db[_0x4e19('0x66')][_0x4e19('0x31')]({'where':_0x8d4715[_0x4e19('0x55')]})[_0x4e19('0x39')](function(_0x5a2df3){_0x5d0126[_0x4e19('0x31')]=_0x5a2df3;if(_0x4eafcb['query'][_0x4e19('0x5a')]){_0x8d4715[_0x4e19('0x56')]=[{'all':!![]}];}return db[_0x4e19('0x66')][_0x4e19('0x57')](_0x8d4715);})[_0x4e19('0x39')](function(_0x210985){_0x5d0126[_0x4e19('0x6b')]=_0x210985;return _0x5d0126;});}})[_0x4e19('0x39')](respondWithFilteredResult(_0x4fd1aa,_0x8d4715))[_0x4e19('0x2d')](handleError(_0x4fd1aa,null));};exports['removeDispositions']=function(_0x120881,_0x1f7e94,_0x566aa3){return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x120881[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x1f7e94,null))[_0x4e19('0x39')](function(_0x2ebfa9){if(_0x2ebfa9){return _0x2ebfa9[_0x4e19('0x6c')](_0x120881[_0x4e19('0x48')][_0x4e19('0x6d')]);}})['then'](respondWithStatusCode(_0x1f7e94,null))[_0x4e19('0x2d')](handleError(_0x1f7e94,null));};exports[_0x4e19('0x6e')]=function(_0x3d2e9e,_0x312e70,_0x1f0339){if(_0x3d2e9e[_0x4e19('0x5c')]['id']){delete _0x3d2e9e[_0x4e19('0x5c')]['id'];}return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x3d2e9e[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x312e70,null))[_0x4e19('0x39')](function(_0x487b8e){if(_0x487b8e){_0x3d2e9e[_0x4e19('0x5c')]['ChatWebsiteId']=_0x487b8e['id'];return db[_0x4e19('0x6f')][_0x4e19('0x5b')](_0x3d2e9e['body']);}})[_0x4e19('0x39')](respondWithResult(_0x312e70,null))[_0x4e19('0x2d')](handleError(_0x312e70,null));};exports[_0x4e19('0x70')]=function(_0x27733e,_0x1a94c7,_0x4df53f){var _0x8a79ce={'raw':![],'where':{}};var _0x4f3a6d={};var _0xbeb3c9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4e19('0x68')]({'where':{'id':_0x27733e[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x1a94c7,null))[_0x4e19('0x39')](function(_0x12c726){if(_0x12c726){_0x4f3a6d[_0x4e19('0x47')]=_[_0x4e19('0x59')](db[_0x4e19('0x6f')][_0x4e19('0x43')]);_0x4f3a6d[_0x4e19('0x48')]=_[_0x4e19('0x59')](_0x27733e[_0x4e19('0x48')]);_0x4f3a6d['filters']=_['intersection'](_0x4f3a6d[_0x4e19('0x47')],_0x4f3a6d[_0x4e19('0x48')]);_0x8a79ce[_0x4e19('0x4a')]=_['intersection'](_0x4f3a6d[_0x4e19('0x47')],qs['fields'](_0x27733e[_0x4e19('0x48')]['fields']));_0x8a79ce[_0x4e19('0x4a')]=_0x8a79ce[_0x4e19('0x4a')][_0x4e19('0x4c')]?_0x8a79ce['attributes']:_0x4f3a6d[_0x4e19('0x47')];if(!_0x27733e[_0x4e19('0x48')][_0x4e19('0x69')](_0x4e19('0x4d'))){_0x8a79ce[_0x4e19('0x33')]=qs['limit'](_0x27733e[_0x4e19('0x48')][_0x4e19('0x33')]);_0x8a79ce[_0x4e19('0x32')]=qs['offset'](_0x27733e[_0x4e19('0x48')]['offset']);}_0x8a79ce[_0x4e19('0x6a')]=qs['sort'](_0x27733e[_0x4e19('0x48')]['sort']);_0x8a79ce[_0x4e19('0x55')]=qs['filters'](_[_0x4e19('0x50')](_0x27733e[_0x4e19('0x48')],_0x4f3a6d[_0x4e19('0x4f')]));_0x8a79ce[_0x4e19('0x55')][_0x4e19('0x65')]=_0x12c726['id'];if(_0x27733e[_0x4e19('0x48')][_0x4e19('0x51')]){_0x8a79ce[_0x4e19('0x55')]=_['merge'](_0x8a79ce[_0x4e19('0x55')],{'$or':_[_0x4e19('0x41')](_0x8a79ce[_0x4e19('0x4a')],function(_0x1c0df2){var _0x354c4e={};_0x354c4e[_0x1c0df2]={'$like':'%'+_0x27733e[_0x4e19('0x48')][_0x4e19('0x51')]+'%'};return _0x354c4e;})});}_0x8a79ce=_[_0x4e19('0x52')]({},_0x8a79ce,_0x27733e['options']);return db[_0x4e19('0x6f')][_0x4e19('0x31')]({'where':_0x8a79ce[_0x4e19('0x55')]})['then'](function(_0x512f83){_0xbeb3c9[_0x4e19('0x31')]=_0x512f83;if(_0x27733e[_0x4e19('0x48')][_0x4e19('0x5a')]){_0x8a79ce[_0x4e19('0x56')]=[{'all':!![]}];}return db[_0x4e19('0x6f')][_0x4e19('0x57')](_0x8a79ce);})[_0x4e19('0x39')](function(_0x4ee406){_0xbeb3c9[_0x4e19('0x6b')]=_0x4ee406;return _0xbeb3c9;});}})[_0x4e19('0x39')](respondWithFilteredResult(_0x1a94c7,_0x8a79ce))[_0x4e19('0x2d')](handleError(_0x1a94c7,null));};exports[_0x4e19('0x71')]=function(_0x92f31f,_0x154b79,_0x27f461){return db[_0x4e19('0x42')]['find']({'where':{'id':_0x92f31f[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x154b79,null))[_0x4e19('0x39')](function(_0x34d490){if(_0x34d490){return _0x34d490[_0x4e19('0x71')](_0x92f31f[_0x4e19('0x48')][_0x4e19('0x6d')]);}})[_0x4e19('0x39')](respondWithStatusCode(_0x154b79,null))[_0x4e19('0x2d')](handleError(_0x154b79,null));};exports[_0x4e19('0x72')]=function(_0x1ac8df,_0x4f6aba,_0x5e84a2){_0x1ac8df['body'][_0x4e19('0x73')]=_0x1ac8df[_0x4e19('0x74')][_0x4e19('0x75')];return db['ChatWebsite'][_0x4e19('0x60')]({'where':{'id':_0x1ac8df[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x4f6aba,null))[_0x4e19('0x39')](saveUpdates(_0x1ac8df[_0x4e19('0x5c')],null))[_0x4e19('0x39')](respondWithResult(_0x4f6aba,null))['catch'](handleError(_0x4f6aba,null));};exports[_0x4e19('0x76')]=function(_0x1edd7a,_0x4f6f52,_0x32be7d){_0x1edd7a[_0x4e19('0x5c')]['agentAvatar']=_0x1edd7a[_0x4e19('0x74')][_0x4e19('0x75')];return db[_0x4e19('0x42')]['find']({'where':{'id':_0x1edd7a[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x4f6f52,null))['then'](saveUpdates(_0x1edd7a[_0x4e19('0x5c')],null))[_0x4e19('0x39')](respondWithResult(_0x4f6f52,null))[_0x4e19('0x2d')](handleError(_0x4f6f52,null));};exports['addCustomerAvatar']=function(_0x3e5a92,_0xe55c16,_0x2e7882){_0x3e5a92[_0x4e19('0x5c')][_0x4e19('0x77')]=_0x3e5a92[_0x4e19('0x74')][_0x4e19('0x75')];return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x3e5a92['params']['id']}})['then'](handleEntityNotFound(_0xe55c16,null))[_0x4e19('0x39')](saveUpdates(_0x3e5a92['body'],null))['then'](respondWithResult(_0xe55c16,null))[_0x4e19('0x2d')](handleError(_0xe55c16,null));};exports['addSystemAvatar']=function(_0x8ba37,_0x125118,_0x607cd1){_0x8ba37[_0x4e19('0x5c')][_0x4e19('0x78')]=_0x8ba37[_0x4e19('0x74')][_0x4e19('0x75')];return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x8ba37['params']['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x125118,null))[_0x4e19('0x39')](saveUpdates(_0x8ba37[_0x4e19('0x5c')],null))['then'](respondWithResult(_0x125118,null))[_0x4e19('0x2d')](handleError(_0x125118,null));};exports['getLogo']=function(_0x49da29,_0x345963,_0x2d39ae){var _0x136c9b=path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x7b'));var _0x489649={'where':{'id':_0x49da29[_0x4e19('0x62')]['id']},'attributes':['id',_0x4e19('0x73')],'raw':!![]};var _0x43bab8=![];return require(_0x4e19('0x7c'))[_0x4e19('0x7d')]()[_0x4e19('0x39')](function(_0x2a9f7e){if(_0x2a9f7e){_0x43bab8=_0x2a9f7e[_0x4e19('0x7e')];}})[_0x4e19('0x39')](function(){return db[_0x4e19('0x42')][_0x4e19('0x60')](_0x489649);})[_0x4e19('0x39')](handleEntityNotFound(_0x345963,null))[_0x4e19('0x39')](function(_0x49d63a){if(_0x49d63a){if(!_['isNil'](_0x49d63a[_0x4e19('0x73')])){if(fs['existsSync'](path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x7f'),_0x49d63a[_0x4e19('0x73')]))&&_0x43bab8){_0x136c9b=path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x7f'),_0x49d63a[_0x4e19('0x73')]);}}return _0x345963[_0x4e19('0x80')](_0x136c9b);}})[_0x4e19('0x2d')](handleError(_0x345963,null));};exports['getAvatar']=function(_0x39d7a7,_0x51aadd,_0x5004b0){var _0x7f8c9c=path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x81'));var _0x39cd44={'where':{'id':_0x39d7a7['params']['id']},'attributes':['id',_0x4e19('0x82')],'raw':!![]};return db[_0x4e19('0x42')]['find'](_0x39cd44)['then'](handleEntityNotFound(_0x51aadd,null))[_0x4e19('0x39')](function(_0x3bb582){if(_0x3bb582){if(!_['isNil'](_0x3bb582[_0x4e19('0x82')])){if(fs[_0x4e19('0x83')](path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x84'),_0x3bb582[_0x4e19('0x82')]))){_0x7f8c9c=path[_0x4e19('0x79')](config['root'],_0x4e19('0x84'),_0x3bb582[_0x4e19('0x82')]);}}return _0x51aadd[_0x4e19('0x80')](_0x7f8c9c);}})[_0x4e19('0x2d')](handleError(_0x51aadd,null));};exports[_0x4e19('0x85')]=function(_0x50065d,_0x1927ef,_0x481850){var _0x173cf2=path['join'](config['root'],_0x4e19('0x86'));var _0x521661={'where':{'id':_0x50065d['params']['id']},'attributes':['id',_0x4e19('0x77'),_0x4e19('0x87')],'raw':!![]};return db[_0x4e19('0x42')][_0x4e19('0x60')](_0x521661)[_0x4e19('0x39')](handleEntityNotFound(_0x1927ef,null))['then'](function(_0x32babc){if(_0x32babc){if(!_[_0x4e19('0x88')](_0x32babc[_0x4e19('0x77')])){if(fs['existsSync'](path['join'](config[_0x4e19('0x7a')],_0x4e19('0x84'),_0x32babc[_0x4e19('0x77')]))&&_0x32babc['showCustomerAvatar']){_0x173cf2=path['join'](config['root'],_0x4e19('0x84'),_0x32babc['customerAvatar']);}}return _0x1927ef[_0x4e19('0x80')](_0x173cf2);}})['catch'](handleError(_0x1927ef,null));};exports[_0x4e19('0x89')]=function(_0x188a3a,_0x33040a,_0x21729a){var _0xb80053=path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x8a'));var _0x424d7b={'where':{'id':_0x188a3a[_0x4e19('0x62')]['id']},'attributes':['id',_0x4e19('0x78')],'raw':!![]};return db['ChatWebsite']['find'](_0x424d7b)['then'](handleEntityNotFound(_0x33040a,null))[_0x4e19('0x39')](function(_0x184449){if(_0x184449){if(!_['isNil'](_0x184449['systemAvatar'])){if(fs[_0x4e19('0x83')](path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x84'),_0x184449[_0x4e19('0x78')]))){_0xb80053=path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x84'),_0x184449[_0x4e19('0x78')]);}}return _0x33040a[_0x4e19('0x80')](_0xb80053);}})['catch'](handleError(_0x33040a,null));};exports['notify']=function(_0x3350e5,_0x6605a1,_0x17bce2){var _0x4942de=require(_0x4e19('0x8b'));var _0x1569f7=new _0x4942de();var _0x4ec1f4=_0x1569f7[_0x4e19('0x8c')](_0x3350e5[_0x4e19('0x8d')][_0x4e19('0x8e')])[_0x4e19('0x8f')]();var _0x4c6d10={'body':_0x3350e5[_0x4e19('0x5c')],'channel':_0x4e19('0x90')};var _0x2930a7=[];var _0x29713c=[];var _0x4fc4d8={};var _0x55955b=![];return db[_0x4e19('0x91')][_0x4e19('0x63')]()[_0x4e19('0x39')](function(_0x95d15c){if(!_0x95d15c){throw new db['Sequelize'][(_0x4e19('0x21'))](_0x4e19('0x92'));}_0x2930a7=_[_0x4e19('0x93')](_['keys'](_0x95d15c),['createdAt',_0x4e19('0x94')]);_0x29713c=_[_0x4e19('0x93')](_['keys'](_0x95d15c),[_0x4e19('0x95'),'updatedAt','CompanyId',_0x4e19('0x96')]);if(_0x3350e5[_0x4e19('0x5c')]['id']){delete _0x3350e5[_0x4e19('0x5c')]['id'];}if(_[_0x4e19('0x88')](_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x97')])){throw new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))](_0x4e19('0x98'));}if(_['isNil'](_0x3350e5['body']['body'])||_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x5c')]===''){throw new db[(_0x4e19('0x20'))]['ValidationError'](_0x4e19('0x99'));}if(_['isNil'](_0x3350e5[_0x4e19('0x5c')]['mapKey'])){throw new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))](_0x4e19('0x9a')+_0x29713c);}if(!_[_0x4e19('0x9b')](_0x29713c,_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x9c')])){throw new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))](_0x4e19('0x9d')+_0x29713c);}_0x4fc4d8[_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x9c')]]=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x97')];})[_0x4e19('0x39')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x3350e5[_0x4e19('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x4e19('0x9e'),'include':[{'model':db[_0x4e19('0x91')],'as':'Contacts','where':_0x4fc4d8,'limit':0x1,'order':[[_0x4e19('0x94'),'DESC']]}]},{'model':db[_0x4e19('0x9f')],'as':_0x4e19('0xa0')}]});})[_0x4e19('0x39')](handleEntityNotFound(_0x6605a1,null))['then'](function(_0x433f11){if(_0x433f11&&_0x433f11[_0x4e19('0x9e')]){_0x4c6d10[_0x4e19('0xa1')]=_0x433f11;_0x4c6d10[_0x4e19('0xa2')]=_0x433f11['Applications'];_0x4c6d10[_0x4e19('0xa3')]=_0x433f11[_0x4e19('0x9e')];_0x4c6d10[_0x4e19('0xa2')]=_[_0x4e19('0xa4')](_0x4c6d10['applications'],[_0x4e19('0xa5')],[_0x4e19('0xa6')]);if(_0x4c6d10['account'][_0x4e19('0xa0')]){delete _0x4c6d10[_0x4e19('0xa1')][_0x4e19('0xa0')];}if(_0x4c6d10[_0x4e19('0xa1')]['List']&&_0x4c6d10[_0x4e19('0xa1')]['List'][_0x4e19('0xa7')][_0x4e19('0x4c')]){return _0x4c6d10['account'][_0x4e19('0x9e')]['Contacts'][0x0];}var _0x307317=_[_0x4e19('0x18')](_0x3350e5['body'],{'firstName':_0x3350e5['body'][_0x4e19('0x97')],'ListId':_0x433f11[_0x4e19('0x96')]});_0x307317[_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x9c')]]=_0x3350e5['body'][_0x4e19('0x97')];return db['CmContact'][_0x4e19('0x5b')](_0x307317,{'fields':_0x2930a7,'raw':!![]});}})[_0x4e19('0x39')](handleEntityNotFound(_0x6605a1,null))['then'](function(_0x35b1e4){_0x4c6d10[_0x4e19('0xa8')]=_0x35b1e4;var _0x37c19b=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xa9')];if(_0x3350e5[_0x4e19('0x8d')]['cf-connecting-ip']){_0x37c19b=_0x3350e5[_0x4e19('0x8d')]['cf-connecting-ip'];}else if(_0x3350e5[_0x4e19('0x8d')][_0x4e19('0xaa')]){_0x37c19b=_[_0x4e19('0xab')](_0x3350e5[_0x4e19('0x8d')][_0x4e19('0xaa')][_0x4e19('0xac')](','));}if(_0x35b1e4){var _0x3d77c8={'ContactId':_0x35b1e4['id'],'ChatWebsiteId':_0x3350e5[_0x4e19('0x62')]['id'],'from':(_0x35b1e4[_0x4e19('0xad')]||'')+'\x20'+(_0x35b1e4[_0x4e19('0xae')]||''),'customerIp':_0x37c19b,'customerPort':_0x3350e5[_0x4e19('0x8d')][_0x4e19('0xaf')]?_0x3350e5[_0x4e19('0x8d')][_0x4e19('0xaf')]:null,'referer':_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xb0')],'browserName':_0x4ec1f4[_0x4e19('0xb1')]['name']&&_0x4ec1f4[_0x4e19('0xb1')][_0x4e19('0xb2')]?util['format'](_0x4e19('0xb3'),_0x4ec1f4[_0x4e19('0xb1')][_0x4e19('0x53')],_0x4ec1f4[_0x4e19('0xb1')][_0x4e19('0xb2')]):_0x4e19('0xb4'),'browserVersion':_0x4ec1f4[_0x4e19('0xb1')]['version']||_0x4e19('0xb4'),'osName':util['format'](_0x4e19('0xb3'),_0x4ec1f4['os']['name'],_0x4ec1f4['os']['version']),'osVersion':_0x4ec1f4['os'][_0x4e19('0xb2')],'deviceModel':_0x4ec1f4[_0x4e19('0xb5')][_0x4e19('0x47')]&&_0x4ec1f4['device'][_0x4e19('0xb6')]?util[_0x4e19('0xb7')](_0x4e19('0xb8'),_0x4ec1f4['device'][_0x4e19('0x47')],_0x4ec1f4[_0x4e19('0xb5')][_0x4e19('0xb6')],_0x4ec1f4['device'][_0x4e19('0x45')]):null,'deviceVendor':_0x4ec1f4['device'][_0x4e19('0xb6')],'deviceType':_0x4ec1f4['device'][_0x4e19('0x45')],'formData':JSON[_0x4e19('0xb9')](_0x3350e5[_0x4e19('0x5c')])};var _0x23e1c3={'ChatWebsiteId':_0x3350e5[_0x4e19('0x62')]['id'],'closed':![]};if(_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xba')]){_0x23e1c3['threadId']=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xba')];return db[_0x4e19('0xbb')][_0x4e19('0x60')]({'where':_0x23e1c3})[_0x4e19('0x39')](function(_0x3c53cc){if(_0x3c53cc){return[_0x3c53cc,![]];}_0x3d77c8['threadId']=_0x3350e5['body'][_0x4e19('0xba')];_0x3d77c8['externalUrl']=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xbc')];return db[_0x4e19('0xbb')][_0x4e19('0x5b')](_0x3d77c8)[_0x4e19('0x39')](function(_0x431057){return[_0x431057,!![]];});});}_0x23e1c3[_0x4e19('0xbd')]=_0x35b1e4['id'];if(_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xbe')]&&_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xbe')]['id']){_0x23e1c3['id']=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xbe')]['id'];return db[_0x4e19('0xbb')]['find']({'where':_0x23e1c3})[_0x4e19('0x39')](function(_0x4fec51){if(_0x4fec51){return[_0x4fec51,![]];}return db[_0x4e19('0xbb')][_0x4e19('0x5b')](_0x3d77c8)[_0x4e19('0x39')](function(_0x524d00){return[_0x524d00,!![]];});});}return db[_0x4e19('0xbb')][_0x4e19('0x5b')](_0x3d77c8)[_0x4e19('0x39')](function(_0x1019d1){return[_0x1019d1,!![]];});}})[_0x4e19('0xbf')](function(_0x1915a6,_0x4dcf7c){if(_0x1915a6){_0x55955b=_0x4dcf7c;if(!_0x4dcf7c){var _0x4d029e={'from':(_0x4c6d10[_0x4e19('0xa8')]['firstName']||'')+'\x20'+(_0x4c6d10[_0x4e19('0xa8')]['lastName']||'')};if(_0x3350e5[_0x4e19('0x5c')]['threadId']&&_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xc0')]&&_0x3350e5['body'][_0x4e19('0xba')]!=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xc0')]){_0x4d029e[_0x4e19('0xba')]=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xc0')];}return _0x1915a6[_0x4e19('0x38')](_0x4d029e);}else{return _0x1915a6;}}})[_0x4e19('0x39')](function(_0x5f00aa){_0x4c6d10[_0x4e19('0xbe')]=_0x5f00aa[_0x4e19('0x3b')]({'plain':!![]});_0x4c6d10[_0x4e19('0xbe')][_0x4e19('0xc1')]=_0x55955b;if(_0x4c6d10['interaction'][_0x4e19('0xc1')]){if(_0x4c6d10[_0x4e19('0xa1')][_0x4e19('0xc2')]){_0x4c6d10[_0x4e19('0xa2')][_0x4e19('0xc3')]({'id':0x0,'priority':_0x4c6d10[_0x4e19('0xa2')][_0x4e19('0x4c')]+0x1,'app':_0x4e19('0xc4'),'appdata':'unmanaged','interval':_0x4e19('0xc5')});}}return db[_0x4e19('0xc6')][_0x4e19('0x5b')]({'body':_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x5c')],'ChatWebsiteId':_0x3350e5[_0x4e19('0x62')]['id'],'ChatInteractionId':_0x5f00aa['id'],'direction':'in','ContactId':_0x4c6d10[_0x4e19('0xa8')]['id'],'AttachmentId':_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xc7')]});})['then'](function(_0x8d01a4){_0x4c6d10['message']=_0x8d01a4;if(_0x4c6d10[_0x4e19('0xbe')][_0x4e19('0xc8')]){return db['User'][_0x4e19('0x60')]({'attributes':['id','name'],'where':{'id':_0x4c6d10['interaction']['UserId']}})[_0x4e19('0x39')](function(_0x46a977){if(_0x46a977){_0x4c6d10[_0x4e19('0xa2')][_0x4e19('0xc9')]({'id':0x0,'priority':0x0,'app':_0x4e19('0xca'),'appdata':_0x46a977['name']+','+(_0x4c6d10['account'][_0x4e19('0xcb')]||0xa),'interval':'*,*,*,*'});_0x4c6d10[_0x4e19('0xcc')]=!![];}return respondWithRpcPromise(_0x4e19('0xcd'),'startRouting',_0x4c6d10);});}return respondWithRpcPromise('Start',_0x4e19('0xce'),_0x4c6d10);})['then'](function(_0x4808cb){respondWithRpcPromise(_0x4e19('0xcf'),_0x4e19('0xcf'),{'event':_0x4e19('0xd0'),'message':_0x4808cb},client9002);return _0x4808cb;})['then'](respondWithResult(_0x6605a1,null))[_0x4e19('0x2d')](handleError(_0x6605a1,null));};exports[_0x4e19('0xd1')]=function(_0x5ebe34,_0x584f3a,_0x5e3dbe){var _0x5eb8b5,_0x59c678,_0x3a3a1b;var _0x3000ae=[];var _0x3d383c=[];var _0x2521b7={};return db[_0x4e19('0x91')]['describe']()[_0x4e19('0x39')](function(_0x34f170){if(!_0x34f170){throw new db['Sequelize'][(_0x4e19('0x21'))]('no\x20available\x20attributes');}_0x3d383c=_[_0x4e19('0x93')](_['keys'](_0x34f170),[_0x4e19('0x95'),_0x4e19('0x94')]);_0x3000ae=_[_0x4e19('0x93')](_[_0x4e19('0x59')](_0x34f170),['createdAt','updatedAt','CompanyId',_0x4e19('0x96')]);if(_0x5ebe34[_0x4e19('0x5c')]['id']){delete _0x5ebe34[_0x4e19('0x5c')]['id'];}if(_[_0x4e19('0x88')](_0x5ebe34[_0x4e19('0x5c')][_0x4e19('0x97')])){throw _0x584f3a[_0x4e19('0x2f')](0x1f4)[_0x4e19('0x3e')](new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))]('from\x20is\x20mandatory'));}if(_[_0x4e19('0x88')](_0x5ebe34[_0x4e19('0x5c')][_0x4e19('0x5c')])||_0x5ebe34['body']['body']===''){throw _0x584f3a[_0x4e19('0x2f')](0x1f4)[_0x4e19('0x3e')](new db['Sequelize'][(_0x4e19('0x21'))](_0x4e19('0x99')));}if(_[_0x4e19('0x88')](_0x5ebe34[_0x4e19('0x5c')]['mapKeyOffline'])){throw _0x584f3a[_0x4e19('0x2f')](0x1f4)['send'](new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))](_0x4e19('0xd2')+_0x3000ae));}if(!_['includes'](_0x3000ae,_0x5ebe34[_0x4e19('0x5c')]['mapKeyOffline'])){throw _0x584f3a['status'](0x1f4)[_0x4e19('0x3e')](new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3000ae));}_0x2521b7[_0x5ebe34[_0x4e19('0x5c')][_0x4e19('0xd3')]]=_0x5ebe34['body'][_0x4e19('0x97')];})[_0x4e19('0x39')](function(){return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x5ebe34[_0x4e19('0x62')]['id']},'include':[{'model':db[_0x4e19('0xd4')],'as':_0x4e19('0x9e')}]});})['then'](handleEntityNotFound(_0x584f3a,null))[_0x4e19('0x39')](function(_0x5eb54e){if(_0x5eb54e&&_0x5eb54e[_0x4e19('0x9e')]){_0x59c678=_0x5eb54e;var _0x31c4f5=_['defaults'](_0x5ebe34[_0x4e19('0x5c')],{'firstName':_0x5ebe34['body']['from'],'phone':_0x5ebe34['body'][_0x4e19('0x97')],'ListId':_0x5eb54e[_0x4e19('0x96')]});_0x31c4f5[_0x5ebe34[_0x4e19('0x5c')]['mapKeyOffline']]=_0x5ebe34[_0x4e19('0x5c')][_0x4e19('0x97')];return db[_0x4e19('0x91')][_0x4e19('0xd5')]({'where':_0x2521b7,'defaults':_0x31c4f5});}})[_0x4e19('0xbf')](function(_0x22c17a){if(_0x22c17a){_0x3a3a1b=_0x22c17a;var _0x4fd540=fs[_0x4e19('0xd6')](path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0xd7')),'utf8');var _0x5ae95a=ejs['render'](_0x4fd540,{'body':_['toPairs'](_0x5ebe34[_0x4e19('0x5c')][_0x4e19('0x5c')]),'bodyTitle':_0x59c678['offlineMessageBody']});return db['ChatOfflineMessage'][_0x4e19('0x5b')]({'body':_0x5ae95a,'ContactId':_0x22c17a['id'],'ChatWebsiteId':_0x59c678['id']});}})['then'](function(_0x57f2c7){if(_0x57f2c7){_0x5eb8b5=_0x57f2c7;return db[_0x4e19('0xd8')][_0x4e19('0x68')]({'where':{'service':!![]},'include':[{'model':db[_0x4e19('0xd9')],'as':_0x4e19('0xda'),'raw':!![]}]});}})[_0x4e19('0x39')](function(_0x28a75f){if(_0x28a75f&&_0x28a75f[_0x4e19('0xda')]&&_0x59c678[_0x4e19('0xdb')]){var _0x3a304d={'tls':{'rejectUnauthorized':![]}};if(_0x28a75f[_0x4e19('0xda')][_0x4e19('0xdc')]){_0x3a304d[_0x4e19('0xdc')]=_0x28a75f['Smtp'][_0x4e19('0xdc')];}else{_0x3a304d['host']=_0x28a75f[_0x4e19('0xda')]['host'];_0x3a304d[_0x4e19('0xdd')]=_0x28a75f[_0x4e19('0xda')]['port'];_0x3a304d[_0x4e19('0xde')]=_0x28a75f[_0x4e19('0xda')][_0x4e19('0xde')];}if(_0x28a75f['Smtp']['authentication']){_0x3a304d['auth']={'user':_0x28a75f['Smtp'][_0x4e19('0x5d')],'pass':_0x28a75f[_0x4e19('0xda')]['pass']};}return respondWithRpcPromise(_0x4e19('0xdf'),_0x4e19('0xe0'),{'account':_0x3a304d,'message':{'from':util[_0x4e19('0xb7')](_0x4e19('0xe1'),_0x28a75f[_0x4e19('0x53')],_0x28a75f[_0x4e19('0xe2')]||_0x28a75f['Smtp'][_0x4e19('0x5d')]),'to':_0x59c678['forwardOfflineAddress'],'subject':_0x59c678[_0x4e19('0xe3')],'text':_0x5eb8b5[_0x4e19('0x5c')]}},client9003)[_0x4e19('0x39')](function(){return _0x5eb8b5;})[_0x4e19('0x2d')](function(_0x51a554){console['error'](_0x51a554);});}})[_0x4e19('0x39')](function(){if(_0x5eb8b5){return _0x5eb8b5;}})['then'](respondWithResult(_0x584f3a,null))['catch'](handleError(_0x584f3a,null));};exports[_0x4e19('0xe4')]=function(_0x230344,_0x87e88a,_0x2f3bd2){return db[_0x4e19('0xbb')][_0x4e19('0x60')]({'where':{'id':_0x230344[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x87e88a,null))['then'](function(_0x32fa71){if(_0x32fa71){return _0x32fa71[_0x4e19('0xe4')](_0x230344[_0x4e19('0x5c')][_0x4e19('0x6d')],_[_0x4e19('0xe5')](_0x230344['body'],[_0x4e19('0x6d'),'id'])||{});}})[_0x4e19('0x39')](respondWithResult(_0x87e88a,null))[_0x4e19('0x2d')](handleError(_0x87e88a,null));};exports['getInteractions']=function(_0x2e640c,_0x3be4e5,_0x44aa3f){var _0x2150f7={'raw':![],'where':{}};var _0x418687={};var _0x4a4d7b={'count':0x0,'rows':[]};return db[_0x4e19('0x42')][_0x4e19('0x68')]({'where':{'id':_0x2e640c[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x3be4e5,null))['then'](function(_0x21d35f){if(_0x21d35f){_0x418687[_0x4e19('0x47')]=_['keys'](db[_0x4e19('0xbb')][_0x4e19('0x43')]);_0x418687[_0x4e19('0x48')]=_[_0x4e19('0x59')](_0x2e640c[_0x4e19('0x48')]);_0x418687[_0x4e19('0x4f')]=_[_0x4e19('0x49')](_0x418687[_0x4e19('0x47')],_0x418687[_0x4e19('0x48')]);_0x2150f7[_0x4e19('0x4a')]=_['intersection'](_0x418687[_0x4e19('0x47')],qs[_0x4e19('0x4b')](_0x2e640c[_0x4e19('0x48')][_0x4e19('0x4b')]));_0x2150f7[_0x4e19('0x4a')]=_0x2150f7[_0x4e19('0x4a')]['length']?_0x2150f7[_0x4e19('0x4a')]:_0x418687[_0x4e19('0x47')];if(!_0x2e640c['query']['hasOwnProperty']('nolimit')){_0x2150f7['limit']=qs['limit'](_0x2e640c[_0x4e19('0x48')][_0x4e19('0x33')]);_0x2150f7[_0x4e19('0x32')]=qs['offset'](_0x2e640c[_0x4e19('0x48')]['offset']);}_0x2150f7[_0x4e19('0x6a')]=qs[_0x4e19('0x4e')](_0x2e640c[_0x4e19('0x48')][_0x4e19('0x4e')]);_0x2150f7[_0x4e19('0x55')]=qs[_0x4e19('0x4f')](_[_0x4e19('0x50')](_0x2e640c[_0x4e19('0x48')],_0x418687[_0x4e19('0x4f')]));_0x2150f7[_0x4e19('0x55')][_0x4e19('0x65')]=_0x21d35f['id'];if(_0x2e640c[_0x4e19('0x48')]['filter']){_0x2150f7[_0x4e19('0x55')]=_[_0x4e19('0x52')](_0x2150f7[_0x4e19('0x55')],{'$or':_[_0x4e19('0x41')](_0x2150f7[_0x4e19('0x4a')],function(_0x467f4d){var _0x5d62f2={};_0x5d62f2[_0x467f4d]={'$like':'%'+_0x2e640c[_0x4e19('0x48')][_0x4e19('0x51')]+'%'};return _0x5d62f2;})});}_0x2150f7=_[_0x4e19('0x52')]({},_0x2150f7,_0x2e640c[_0x4e19('0x54')]);return db['ChatInteraction'][_0x4e19('0x31')]({'where':_0x2150f7[_0x4e19('0x55')]})['then'](function(_0x55e6c7){_0x4a4d7b[_0x4e19('0x31')]=_0x55e6c7;if(_0x2e640c['query'][_0x4e19('0x5a')]){_0x2150f7[_0x4e19('0x56')]=[{'model':db[_0x4e19('0x91')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x4e19('0xe6'),'attributes':[_0x4e19('0x53'),_0x4e19('0xe7'),_0x4e19('0xe8')],'required':![]},{'model':db[_0x4e19('0xe9')],'as':'Tags','attributes':['id',_0x4e19('0x53'),_0x4e19('0xea')],'where':_0x2e640c[_0x4e19('0x48')]['tag']?{'id':_0x2e640c[_0x4e19('0x48')]['tag']}:undefined,'required':_0x2e640c['query'][_0x4e19('0xeb')]?!![]:![]}];}return db[_0x4e19('0xbb')][_0x4e19('0x57')](_0x2150f7);})[_0x4e19('0x39')](function(_0x50aef0){_0x4a4d7b[_0x4e19('0x6b')]=_0x50aef0;return _0x4a4d7b;});}})[_0x4e19('0x39')](respondWithFilteredResult(_0x3be4e5,_0x2150f7))[_0x4e19('0x2d')](handleError(_0x3be4e5,null));};function iftimePromise(_0x3c3087,_0x5078de){return respondWithRpcPromise(_0x4e19('0xec'),_0x4e19('0xed'),{'command':_0x5078de[_0x4e19('0xee')]?util[_0x4e19('0xb7')](_0x4e19('0xef'),_0x3c3087['interval'],_0x5078de[_0x4e19('0xee')]):util[_0x4e19('0xb7')]('iftime\x20%s',_0x3c3087[_0x4e19('0xf0')])},client9002)[_0x4e19('0x39')](function(_0x2b192c){var _0x2575a6=_0x2b192c&&_0x2b192c[_0x4e19('0xf1')](_0x4e19('0xf2'))>=0x0?!![]:![];logger[_0x4e19('0x24')](_0x4e19('0xf3'),_0x5078de['id'],_0x3c3087['id'],_0x3c3087[_0x4e19('0xf0')],_0x2575a6?_0x4e19('0xf4'):'OFFLINE',_0x5078de['timezone']?_0x5078de[_0x4e19('0xee')]:'No\x20timezone');return _0x2575a6;})['catch'](function(_0x358bb4){logger[_0x4e19('0x29')](_0x4e19('0xf3'),_0x5078de['id'],_0x3c3087['id'],_0x3c3087[_0x4e19('0xf0')],util[_0x4e19('0xf5')](_0x358bb4,{'showHidden':![],'depth':null}),_0x5078de[_0x4e19('0xee')]?_0x5078de[_0x4e19('0xee')]:_0x4e19('0xf6'));return![];});}exports[_0x4e19('0xed')]=function(_0x51dcbc,_0x87c979,_0x41a192){var _0x1f9b8a=0x0;var _0x53806f=0x0;var _0x527014=![];var _0x2ca997;var _0x42a113;return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x51dcbc[_0x4e19('0x62')]['id']},'include':[{'model':db[_0x4e19('0xf7')],'as':_0x4e19('0xf7'),'include':[{'model':db[_0x4e19('0xf7')],'as':_0x4e19('0xf8'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x4e19('0x39')](handleEntityNotFound(_0x87c979,null))[_0x4e19('0x39')](function(_0x424207){if(_0x424207){_0x2ca997=_0x424207;return _0x424207['getProactiveActions']({'raw':!![]});}})[_0x4e19('0x39')](function(_0x24ea11){if(_0x2ca997){if(_0x24ea11){_0x42a113=_0x24ea11;}}return require(_0x4e19('0x7c'))['getLicense']();})[_0x4e19('0x39')](function(_0x113b44){if(_0x113b44){_0x53806f=_0x113b44[_0x4e19('0xf9')];_0x527014=_0x113b44[_0x4e19('0x7e')];}})[_0x4e19('0x39')](function(){return db[_0x4e19('0xbb')][_0x4e19('0x31')]({'where':{'closed':![]}});})[_0x4e19('0x39')](function(_0x86cca6){_0x1f9b8a=_0x86cca6;if(_0x53806f&&_0x86cca6>_0x53806f){return db[_0x4e19('0xfa')]['findOne']({'where':{'id':0x1}})['then'](function(_0x12b4d6){if(_0x12b4d6){_0x12b4d6[_0x4e19('0xfb')]('chatLicenseExceeded');}});}})[_0x4e19('0x39')](function(){if(_0x2ca997[_0x4e19('0xf7')]&&_0x2ca997[_0x4e19('0xf7')][_0x4e19('0xf8')]){var _0x2cfe11=[];for(var _0x64db6f=0x0;_0x64db6f<_0x2ca997[_0x4e19('0xf7')]['Intervals'][_0x4e19('0x4c')];_0x64db6f++){var _0x24b539=_0x2ca997[_0x4e19('0xf7')][_0x4e19('0xf8')][_0x64db6f]['get']({'plain':!![]});_0x2cfe11['push'](iftimePromise(_0x24b539,_0x2ca997));}return BPromise[_0x4e19('0xfc')](_0x2cfe11)['then'](function(_0x555732){return _['some'](_0x555732);});}else{return!![];}})[_0x4e19('0x39')](function(_0x1a8079){var _0x105639=fs[_0x4e19('0xd6')](path[_0x4e19('0x79')](config['root'],_0x4e19('0xfd')),_0x4e19('0xfe'));var _0x4c7ac8={'remote':_0x2ca997[_0x4e19('0xff')],'query':querystring[_0x4e19('0xb9')](_[_0x4e19('0x52')](_0x2ca997[_0x4e19('0x3b')]({'plain':!![]}),{'customerIp':_0x51dcbc[_0x4e19('0x8d')]['x-forwarded-for']||_0x51dcbc[_0x4e19('0x8d')][_0x4e19('0x100')]||_0x51dcbc[_0x4e19('0x101')]['remoteAddress']||_0x51dcbc['ip'],'referer':_0x51dcbc[_0x4e19('0x8d')]['referer'],'openedInteractions':_0x1f9b8a,'maxInteractions':_0x53806f,'virtual':_0x527014[_0x4e19('0xf9')],'online':_0x1a8079,'custom':_0x527014}))[_0x4e19('0x102')](/'/g,'\x5c\x27')};_0x87c979[_0x4e19('0x3e')](ejs['render'](Mustache[_0x4e19('0x103')](_0x105639,_0x4c7ac8),{'proactiveActions':_0x42a113,'alignment':_0x2ca997['alignment'],'verticalAlignment':_0x2ca997[_0x4e19('0x104')],'div_color':_0x2ca997[_0x4e19('0xea')],'text_color':_0x2ca997[_0x4e19('0x105')]}));})[_0x4e19('0x2d')](handleError(_0x87c979,null));};exports[_0x4e19('0x106')]=function(_0x4237e5,_0x39ba85,_0x4cff3d){return db[_0x4e19('0x42')]['findOne']({'where':{'id':_0x4237e5[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x39ba85,null))[_0x4e19('0x39')](function(_0x311641){if(_0x311641){return db[_0x4e19('0x107')][_0x4e19('0x108')](function(_0x4db373){return db[_0x4e19('0x9f')]['destroy']({'where':{'ChatWebsiteId':_0x4237e5[_0x4e19('0x62')]['id']},'transaction':_0x4db373})[_0x4e19('0x39')](function(_0x249ae6){var _0x4a35f0=_[_0x4e19('0x41')](_0x4237e5[_0x4e19('0x5c')],function(_0x146bf1){_0x146bf1[_0x4e19('0x65')]=_0x4237e5[_0x4e19('0x62')]['id'];return _0x146bf1;});return db[_0x4e19('0x9f')][_0x4e19('0x109')](_0x4a35f0,{'transaction':_0x4db373});});})['then'](function(){return db[_0x4e19('0x9f')][_0x4e19('0x10a')]({'where':{'ChatWebsiteId':_0x4237e5['params']['id']},'order':_0x4e19('0xa5')});});}})['then'](respondWithResult(_0x39ba85,null))[_0x4e19('0x2d')](handleError(_0x39ba85,null));};exports['getApplications']=function(_0x58f243,_0x3c73df,_0x529585){var _0x4f3f79={};var _0x25e020={};var _0x349a3f;var _0x3456a8;return db['ChatWebsite']['findOne']({'where':{'id':_0x58f243[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x3c73df,null))[_0x4e19('0x39')](function(_0x329309){if(_0x329309){_0x349a3f=_0x329309;_0x25e020[_0x4e19('0x47')]=_[_0x4e19('0x59')](db[_0x4e19('0x9f')][_0x4e19('0x43')]);_0x25e020['query']=_[_0x4e19('0x59')](_0x58f243['query']);_0x25e020['filters']=_[_0x4e19('0x49')](_0x25e020[_0x4e19('0x47')],_0x25e020[_0x4e19('0x48')]);_0x4f3f79[_0x4e19('0x4a')]=_[_0x4e19('0x49')](_0x25e020[_0x4e19('0x47')],qs[_0x4e19('0x4b')](_0x58f243[_0x4e19('0x48')][_0x4e19('0x4b')]));_0x4f3f79[_0x4e19('0x4a')]=_0x4f3f79['attributes'][_0x4e19('0x4c')]?_0x4f3f79[_0x4e19('0x4a')]:_0x25e020['model'];_0x4f3f79['order']=qs[_0x4e19('0x4e')](_0x58f243[_0x4e19('0x48')][_0x4e19('0x4e')]);_0x4f3f79[_0x4e19('0x55')]=qs[_0x4e19('0x4f')](_[_0x4e19('0x50')](_0x58f243[_0x4e19('0x48')],_0x25e020[_0x4e19('0x4f')]));if(_0x58f243[_0x4e19('0x48')][_0x4e19('0x51')]){_0x4f3f79[_0x4e19('0x55')]=_[_0x4e19('0x52')](_0x4f3f79[_0x4e19('0x55')],{'$or':_[_0x4e19('0x41')](_0x4f3f79[_0x4e19('0x4a')],function(_0xf30d64){var _0x1ab25a={};_0x1ab25a[_0xf30d64]={'$like':'%'+_0x58f243['query'][_0x4e19('0x51')]+'%'};return _0x1ab25a;})});}_0x4f3f79=_['merge']({},_0x4f3f79,_0x58f243[_0x4e19('0x54')]);return _0x349a3f[_0x4e19('0x10b')](_0x4f3f79);}})['then'](function(_0x3200d5){if(_0x3200d5){_0x3456a8=_0x3200d5[_0x4e19('0x4c')];if(!_0x58f243[_0x4e19('0x48')]['hasOwnProperty'](_0x4e19('0x4d'))){_0x4f3f79[_0x4e19('0x33')]=qs[_0x4e19('0x33')](_0x58f243[_0x4e19('0x48')][_0x4e19('0x33')]);_0x4f3f79[_0x4e19('0x32')]=qs[_0x4e19('0x32')](_0x58f243[_0x4e19('0x48')][_0x4e19('0x32')]);}return _0x349a3f[_0x4e19('0x10b')](_0x4f3f79);}})['then'](function(_0x3c55eb){if(_0x3c55eb){return _0x3c55eb?{'count':_0x3456a8,'rows':_0x3c55eb}:null;}})[_0x4e19('0x39')](respondWithResult(_0x3c73df,null))['catch'](handleError(_0x3c73df,null));};exports[_0x4e19('0x10c')]=function(_0x48020a,_0x4a95dd,_0x10fc03){return db[_0x4e19('0x10d')][_0x4e19('0x60')]({'where':{'id':_0x48020a[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x4a95dd,null))[_0x4e19('0x39')](function(_0x35faa0){if(_0x35faa0){return _0x35faa0[_0x4e19('0x10c')](_0x48020a[_0x4e19('0x5c')]['ids'],_[_0x4e19('0xe5')](_0x48020a[_0x4e19('0x5c')],[_0x4e19('0x6d'),'id'])||{});}})[_0x4e19('0x39')](respondWithResult(_0x4a95dd,null))[_0x4e19('0x2d')](handleError(_0x4a95dd,null));};exports[_0x4e19('0x10e')]=function(_0x1c8f3f,_0x40a0a6,_0x40be5e){var _0x19a1a4={};var _0x3b187b={};var _0x4da893;var _0x5bd0a8;return db[_0x4e19('0x42')][_0x4e19('0x68')]({'where':{'id':_0x1c8f3f[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x40a0a6,null))[_0x4e19('0x39')](function(_0x504c80){if(_0x504c80){_0x4da893=_0x504c80;_0x3b187b[_0x4e19('0x47')]=_[_0x4e19('0x59')](db['ChatProactiveAction'][_0x4e19('0x43')]);_0x3b187b[_0x4e19('0x48')]=_['keys'](_0x1c8f3f['query']);_0x3b187b[_0x4e19('0x4f')]=_['intersection'](_0x3b187b[_0x4e19('0x47')],_0x3b187b[_0x4e19('0x48')]);_0x19a1a4[_0x4e19('0x4a')]=_['intersection'](_0x3b187b[_0x4e19('0x47')],qs['fields'](_0x1c8f3f['query'][_0x4e19('0x4b')]));_0x19a1a4[_0x4e19('0x4a')]=_0x19a1a4[_0x4e19('0x4a')][_0x4e19('0x4c')]?_0x19a1a4[_0x4e19('0x4a')]:_0x3b187b['model'];_0x19a1a4['order']=qs[_0x4e19('0x4e')](_0x1c8f3f['query']['sort']);_0x19a1a4[_0x4e19('0x55')]=qs['filters'](_[_0x4e19('0x50')](_0x1c8f3f[_0x4e19('0x48')],_0x3b187b[_0x4e19('0x4f')]));if(_0x1c8f3f[_0x4e19('0x48')][_0x4e19('0x51')]){_0x19a1a4[_0x4e19('0x55')]=_[_0x4e19('0x52')](_0x19a1a4[_0x4e19('0x55')],{'$or':_['map'](_0x19a1a4['attributes'],function(_0x8a2482){var _0x203e00={};_0x203e00[_0x8a2482]={'$like':'%'+_0x1c8f3f[_0x4e19('0x48')][_0x4e19('0x51')]+'%'};return _0x203e00;})});}_0x19a1a4=_[_0x4e19('0x52')]({},_0x19a1a4,_0x1c8f3f[_0x4e19('0x54')]);return _0x4da893[_0x4e19('0x10e')](_0x19a1a4);}})['then'](function(_0x44f9f4){if(_0x44f9f4){_0x5bd0a8=_0x44f9f4[_0x4e19('0x4c')];if(!_0x1c8f3f[_0x4e19('0x48')][_0x4e19('0x69')](_0x4e19('0x4d'))){_0x19a1a4[_0x4e19('0x33')]=qs[_0x4e19('0x33')](_0x1c8f3f[_0x4e19('0x48')][_0x4e19('0x33')]);_0x19a1a4['offset']=qs[_0x4e19('0x32')](_0x1c8f3f[_0x4e19('0x48')][_0x4e19('0x32')]);}return _0x4da893[_0x4e19('0x10e')](_0x19a1a4);}})[_0x4e19('0x39')](function(_0x26ee47){if(_0x26ee47){return _0x26ee47?{'count':_0x5bd0a8,'rows':_0x26ee47}:null;}})['then'](respondWithResult(_0x40a0a6,null))[_0x4e19('0x2d')](handleError(_0x40a0a6,null));};exports['getFields']=function(_0x29f56d,_0x212baf,_0x916039){var _0x5d9a6c=_0x29f56d['query'][_0x4e19('0x10f')]===_0x4e19('0x110')?_0x4e19('0x111'):'onlineForm';return db[_0x4e19('0x42')][_0x4e19('0x60')]({'attributes':['id',_0x5d9a6c],'where':{'id':_0x29f56d[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x212baf,null))['then'](function(_0xf96cc2){if(_0xf96cc2){var _0x5a9697=_0xf96cc2[_0x5d9a6c];var _0x1208a0=_0x5a9697&&_0x5a9697[_0x4e19('0x112')]?_0x5a9697[_0x4e19('0x112')]:[];_0x212baf[_0x4e19('0x3e')]({'fromKey':_[_0x4e19('0x88')](_0x5a9697['fromKey'])?undefined:_0x5a9697[_0x4e19('0x113')],'count':_0x1208a0[_0x4e19('0x4c')],'rows':_0x1208a0});}})[_0x4e19('0x2d')](handleError(_0x212baf,null));};exports['getOfflineMessages']=function(_0x4fd3ac,_0x3fa334,_0x41cd1c){var _0x151e30={'raw':![],'where':{}};var _0x1fc647={};var _0x5afaae={'count':0x0,'rows':[]};return db[_0x4e19('0x42')][_0x4e19('0x68')]({'where':{'id':_0x4fd3ac['params']['id']}})['then'](handleEntityNotFound(_0x3fa334,null))['then'](function(_0x35a0c7){if(_0x35a0c7){_0x1fc647[_0x4e19('0x47')]=_[_0x4e19('0x59')](db[_0x4e19('0x114')]['rawAttributes']);_0x1fc647['query']=_['keys'](_0x4fd3ac['query']);_0x1fc647[_0x4e19('0x4f')]=_['intersection'](_0x1fc647[_0x4e19('0x47')],_0x1fc647[_0x4e19('0x48')]);_0x151e30['attributes']=_[_0x4e19('0x49')](_0x1fc647['model'],qs[_0x4e19('0x4b')](_0x4fd3ac['query']['fields']));_0x151e30[_0x4e19('0x4a')]=_0x151e30[_0x4e19('0x4a')][_0x4e19('0x4c')]?_0x151e30[_0x4e19('0x4a')]:_0x1fc647['model'];if(!_0x4fd3ac[_0x4e19('0x48')][_0x4e19('0x69')]('nolimit')){_0x151e30[_0x4e19('0x33')]=qs[_0x4e19('0x33')](_0x4fd3ac['query']['limit']);_0x151e30[_0x4e19('0x32')]=qs[_0x4e19('0x32')](_0x4fd3ac['query']['offset']);}_0x151e30[_0x4e19('0x6a')]=qs['sort'](_0x4fd3ac[_0x4e19('0x48')][_0x4e19('0x4e')]);_0x151e30[_0x4e19('0x55')]=qs[_0x4e19('0x4f')](_[_0x4e19('0x50')](_0x4fd3ac[_0x4e19('0x48')],_0x1fc647[_0x4e19('0x4f')]));_0x151e30[_0x4e19('0x55')]['ChatWebsiteId']=_0x35a0c7['id'];if(_0x4fd3ac[_0x4e19('0x48')][_0x4e19('0x51')]){_0x151e30[_0x4e19('0x55')]=_[_0x4e19('0x52')](_0x151e30[_0x4e19('0x55')],{'$or':_[_0x4e19('0x41')](_0x151e30[_0x4e19('0x4a')],function(_0x26be0e){var _0x319870={};_0x319870[_0x26be0e]={'$like':'%'+_0x4fd3ac[_0x4e19('0x48')][_0x4e19('0x51')]+'%'};return _0x319870;})});}_0x151e30=_[_0x4e19('0x52')]({},_0x151e30,_0x4fd3ac[_0x4e19('0x54')]);return db[_0x4e19('0x114')]['count']({'where':_0x151e30[_0x4e19('0x55')]})[_0x4e19('0x39')](function(_0x4bcdc9){_0x5afaae[_0x4e19('0x31')]=_0x4bcdc9;if(_0x4fd3ac[_0x4e19('0x48')]['includeAll']){_0x151e30[_0x4e19('0x56')]=[{'all':!![]}];}else{_0x151e30['include']=[{'model':db[_0x4e19('0x91')],'as':_0x4e19('0x115'),'required':![]}];}return db[_0x4e19('0x114')][_0x4e19('0x57')](_0x151e30);})['then'](function(_0xb78563){_0x5afaae['rows']=_0xb78563;return _0x5afaae;});}})['then'](respondWithFilteredResult(_0x3fa334,_0x151e30))[_0x4e19('0x2d')](handleError(_0x3fa334,null));};exports[_0x4e19('0x116')]=function(_0x331c16,_0x361494,_0x173b8c){return db['ChatWebsite'][_0x4e19('0x60')]({'where':{'id':_0x331c16[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x361494,null))[_0x4e19('0x39')](function(_0x5c4688){if(_0x5c4688){return _0x5c4688[_0x4e19('0x116')](_0x331c16[_0x4e19('0x5c')][_0x4e19('0x6d')],_[_0x4e19('0xe5')](_0x331c16['body'],[_0x4e19('0x6d'),'id'])||{})[_0x4e19('0xbf')](function(_0x3dc12f){for(var _0x5bfeab=0x0;_0x5bfeab<_0x331c16[_0x4e19('0x5c')][_0x4e19('0x6d')]['length'];_0x5bfeab+=0x1){socket['emit'](_0x4e19('0x117'),{'UserId':_0x331c16['body'][_0x4e19('0x6d')][_0x5bfeab],'ChatWebsiteId':_0x331c16[_0x4e19('0x62')]['id']});}return _0x3dc12f;});}})['then'](respondWithResult(_0x361494,null))[_0x4e19('0x2d')](handleError(_0x361494,null));};exports[_0x4e19('0x118')]=function(_0x441b2a,_0x145df9,_0x1931bb){return db['ChatWebsite']['find']({'where':{'id':_0x441b2a[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x145df9,null))[_0x4e19('0x39')](function(_0x13158f){if(_0x13158f){return _0x13158f[_0x4e19('0x118')](_0x441b2a[_0x4e19('0x48')]['ids'])['then'](function(){if(_[_0x4e19('0x119')](_0x441b2a['query']['ids'])){for(var _0x346a88=0x0;_0x346a88<_0x441b2a[_0x4e19('0x48')][_0x4e19('0x6d')][_0x4e19('0x4c')];_0x346a88+=0x1){socket[_0x4e19('0x11a')](_0x4e19('0x11b'),{'UserId':Number(_0x441b2a[_0x4e19('0x48')][_0x4e19('0x6d')][_0x346a88]),'ChatWebsiteId':Number(_0x441b2a[_0x4e19('0x62')]['id'])});}}else{socket['emit'](_0x4e19('0x11b'),{'UserId':Number(_0x441b2a[_0x4e19('0x48')][_0x4e19('0x6d')]),'ChatWebsiteId':Number(_0x441b2a[_0x4e19('0x62')]['id'])});}});}})[_0x4e19('0x39')](respondWithStatusCode(_0x145df9,null))['catch'](handleError(_0x145df9,null));};exports[_0x4e19('0x11c')]=function(_0x3974db,_0x485e43,_0x5d84b6){var _0x297b17={};var _0x31df06={};var _0x412840;var _0xda39d0;return db[_0x4e19('0x42')][_0x4e19('0x68')]({'where':{'id':_0x3974db[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x485e43,null))[_0x4e19('0x39')](function(_0x3423f8){if(_0x3423f8){_0x412840=_0x3423f8;_0x31df06[_0x4e19('0x47')]=_['keys'](db[_0x4e19('0x11d')]['rawAttributes']);_0x31df06[_0x4e19('0x48')]=_[_0x4e19('0x59')](_0x3974db[_0x4e19('0x48')]);_0x31df06['filters']=_[_0x4e19('0x49')](_0x31df06[_0x4e19('0x47')],_0x31df06['query']);_0x297b17[_0x4e19('0x4a')]=_[_0x4e19('0x49')](_0x31df06[_0x4e19('0x47')],qs[_0x4e19('0x4b')](_0x3974db[_0x4e19('0x48')]['fields']));_0x297b17['attributes']=_0x297b17[_0x4e19('0x4a')][_0x4e19('0x4c')]?_0x297b17['attributes']:_0x31df06['model'];_0x297b17[_0x4e19('0x6a')]=qs[_0x4e19('0x4e')](_0x3974db[_0x4e19('0x48')][_0x4e19('0x4e')]);_0x297b17[_0x4e19('0x55')]=qs[_0x4e19('0x4f')](_[_0x4e19('0x50')](_0x3974db[_0x4e19('0x48')],_0x31df06[_0x4e19('0x4f')]));if(_0x3974db['query']['filter']){_0x297b17[_0x4e19('0x55')]=_[_0x4e19('0x52')](_0x297b17[_0x4e19('0x55')],{'$or':_[_0x4e19('0x41')](_0x297b17[_0x4e19('0x4a')],function(_0x45a149){var _0x12199b={};_0x12199b[_0x45a149]={'$like':'%'+_0x3974db['query'][_0x4e19('0x51')]+'%'};return _0x12199b;})});}_0x297b17=_[_0x4e19('0x52')]({},_0x297b17,_0x3974db[_0x4e19('0x54')]);return _0x412840[_0x4e19('0x11c')](_0x297b17);}})[_0x4e19('0x39')](function(_0x210379){if(_0x210379){_0xda39d0=_0x210379[_0x4e19('0x4c')];if(!_0x3974db[_0x4e19('0x48')]['hasOwnProperty'](_0x4e19('0x4d'))){_0x297b17[_0x4e19('0x33')]=qs['limit'](_0x3974db[_0x4e19('0x48')][_0x4e19('0x33')]);_0x297b17[_0x4e19('0x32')]=qs['offset'](_0x3974db[_0x4e19('0x48')]['offset']);}return _0x412840[_0x4e19('0x11c')](_0x297b17);}})[_0x4e19('0x39')](function(_0x1c31a6){if(_0x1c31a6){return _0x1c31a6?{'count':_0xda39d0,'rows':_0x1c31a6}:null;}})[_0x4e19('0x39')](respondWithResult(_0x485e43,null))[_0x4e19('0x2d')](handleError(_0x485e43,null));}; \ No newline at end of file +var _0x1af0=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','save','UserProfileResource','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','VIRTUAL','merge','options','ChatWebsite','findAll','rows','show','Pause','mandatoryDispositionPause','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','find','userProfileId','update','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','hasOwnProperty','includeAll','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','removeAnswers','sitepic','filename','addAvatar','file','addCustomerAvatar','customerAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','root','download','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','account','Applications','orderBy','applications','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','ListId','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','chatLicenseExceeded','Intervals','remote','connection','remoteAddress','virtual','replace','render','alignment','textColor','addApplications','sequelize','transaction','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x587a8b,_0x1e62c9){var _0x5487a8=function(_0x6d3d79){while(--_0x6d3d79){_0x587a8b['push'](_0x587a8b['shift']());}};_0x5487a8(++_0x1e62c9);}(_0x1af0,0x10c));var _0x01af=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x1af0[_0x160c73];return _0xd9302;};'use strict';var pdf=require(_0x01af('0x0'));var emlformat=require(_0x01af('0x1'));var rimraf=require(_0x01af('0x2'));var zipdir=require(_0x01af('0x3'));var jsonpatch=require(_0x01af('0x4'));var rp=require(_0x01af('0x5'));var moment=require(_0x01af('0x6'));var BPromise=require(_0x01af('0x7'));var Mustache=require(_0x01af('0x8'));var util=require(_0x01af('0x9'));var path=require('path');var sox=require(_0x01af('0xa'));var csv=require(_0x01af('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x01af('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x01af('0xd'));var toCsv=require(_0x01af('0xb'));var querystring=require(_0x01af('0xe'));var Papa=require(_0x01af('0xf'));var Redis=require('ioredis');var authService=require(_0x01af('0x10'));var qs=require(_0x01af('0x11'));var as=require(_0x01af('0x12'));var hardwareService=require(_0x01af('0x13'));var logger=require(_0x01af('0x14'))(_0x01af('0x15'));var utils=require(_0x01af('0x16'));var config=require(_0x01af('0x17'));var db=require(_0x01af('0x18'))['db'];config['redis']=_[_0x01af('0x19')](config[_0x01af('0x1a')],{'host':_0x01af('0x1b'),'port':0x18eb});var socket=require(_0x01af('0x1c'))(new Redis(config[_0x01af('0x1a')]));require('./chatWebsite.socket')[_0x01af('0x1d')](socket);var jayson=require(_0x01af('0x1e'));var client=jayson['client'][_0x01af('0x1f')]({'port':0x232c});var client9002=jayson[_0x01af('0x20')][_0x01af('0x1f')]({'port':0x232a});var client9003=jayson['client'][_0x01af('0x1f')]({'port':0x232b});function checkPasswordPattern(_0x33cb71,_0x59fad3,_0x292289){if(_0x292289){var _0x592c60=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x592c60[_0x01af('0x21')](_0x59fad3)){return _0x33cb71;}else{throw new db['Sequelize'][(_0x01af('0x22'))](_0x01af('0x23'));}}else{return _0x33cb71;}}function respondWithRpcPromise(_0x549c22,_0xc149f0,_0x3ea4b4,_0x5e4f93){return new BPromise(function(_0x25474b,_0x3b92fa){var _0x56aa57=_0x5e4f93||client;return _0x56aa57[_0x01af('0x24')](_0x549c22,_0x3ea4b4)[_0x01af('0x25')](function(_0x41d344){logger[_0x01af('0x26')]('ChatWebsite,\x20%s,\x20%s',_0xc149f0,_0x01af('0x27'));logger[_0x01af('0x28')](_0x01af('0x29'),_0xc149f0,_0x01af('0x27'),JSON[_0x01af('0x2a')](_0x41d344));if(_0x41d344[_0x01af('0x2b')]){if(_0x41d344[_0x01af('0x2b')][_0x01af('0x2c')]===0x1f4){logger[_0x01af('0x2b')](_0x01af('0x2d'),_0xc149f0,_0x41d344['error'][_0x01af('0x2e')]);return _0x3b92fa(_0x41d344[_0x01af('0x2b')]['message']);}logger[_0x01af('0x2b')](_0x01af('0x2d'),_0xc149f0,_0x41d344['error'][_0x01af('0x2e')]);return _0x25474b(_0x41d344['error']['message']);}else{logger[_0x01af('0x26')](_0x01af('0x2d'),_0xc149f0,_0x01af('0x27'));_0x25474b(_0x41d344[_0x01af('0x2f')][_0x01af('0x2e')]);}})[_0x01af('0x30')](function(_0x4cd0b3){logger[_0x01af('0x2b')]('ChatWebsite,\x20%s,\x20%s',_0xc149f0,_0x4cd0b3);_0x3b92fa(_0x4cd0b3);});});}function respondWithStatusCode(_0x3b293f,_0x5b9758){_0x5b9758=_0x5b9758||0xcc;return function(_0x51a5e1){if(_0x51a5e1){return _0x3b293f['sendStatus'](_0x5b9758);}return _0x3b293f['status'](_0x5b9758)[_0x01af('0x31')]();};}function respondWithResult(_0x306853,_0x35b27b){_0x35b27b=_0x35b27b||0xc8;return function(_0x3f0fae){if(_0x3f0fae){return _0x306853[_0x01af('0x32')](_0x35b27b)[_0x01af('0x33')](_0x3f0fae);}};}function respondWithFilteredResult(_0x4ad2f6,_0x222603){return function(_0x1fe7ac){if(_0x1fe7ac){var _0x3f5e6d=_0x1fe7ac[_0x01af('0x34')],_0x463e8b=_0x222603[_0x01af('0x35')],_0x120880=_0x222603['offset']+_0x222603[_0x01af('0x36')],_0xce1d38;if(_0x120880>=_0x3f5e6d){_0x120880=_0x3f5e6d;_0xce1d38=0xc8;}else{_0xce1d38=0xce;}_0x4ad2f6[_0x01af('0x32')](_0xce1d38);return _0x4ad2f6[_0x01af('0x37')](_0x01af('0x38'),_0x463e8b+'-'+_0x120880+'/'+_0x3f5e6d)[_0x01af('0x33')](_0x1fe7ac);}return null;};}function patchUpdates(_0x50b442){return function(_0x3e570d){try{jsonpatch['apply'](_0x3e570d,_0x50b442,!![]);}catch(_0x22b2f2){return BPromise['reject'](_0x22b2f2);}return _0x3e570d[_0x01af('0x39')]();};}function saveUpdates(_0x433604,_0x1ec0ee){return function(_0x579c1d){if(_0x579c1d){return _0x579c1d['update'](_0x433604)[_0x01af('0x25')](function(_0x1bb96d){return _0x1bb96d;});}return null;};}function removeEntity(_0x4d2f55,_0x3d7e31){return function(_0x498588){if(_0x498588){return _0x498588['destroy']()[_0x01af('0x25')](function(){var _0x340dff=_0x498588['get']({'plain':!![]});var _0x55549b='ChatWebsites';return db[_0x01af('0x3a')][_0x01af('0x3b')]({'where':{'type':_0x55549b,'resourceId':_0x340dff['id']}})[_0x01af('0x25')](function(){return _0x498588;});})[_0x01af('0x25')](function(){_0x4d2f55['status'](0xcc)[_0x01af('0x31')]();});}};}function handleEntityNotFound(_0x522295,_0x43a7a5){return function(_0x190b8b){if(!_0x190b8b){_0x522295[_0x01af('0x3c')](0x194);}return _0x190b8b;};}function handleError(_0x3a4216,_0x4aeb31){_0x4aeb31=_0x4aeb31||0x1f4;return function(_0x517335){logger[_0x01af('0x2b')](_0x517335['stack']);if(_0x517335[_0x01af('0x3d')]){delete _0x517335[_0x01af('0x3d')];}_0x3a4216[_0x01af('0x32')](_0x4aeb31)[_0x01af('0x3e')](_0x517335);};}exports[_0x01af('0x3f')]=function(_0xcab845,_0x4822f0){var _0x18ab60={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x30a898={},_0x464662={'count':0x0,'rows':[]};var _0x2555b2=_[_0x01af('0x40')](db['ChatWebsite'][_0x01af('0x41')],function(_0x1c4669){return{'name':_0x1c4669[_0x01af('0x42')],'type':_0x1c4669[_0x01af('0x43')][_0x01af('0x44')]};});_0x30a898[_0x01af('0x45')]=_[_0x01af('0x40')](_0x2555b2,_0x01af('0x3d'));_0x30a898[_0x01af('0x46')]=_[_0x01af('0x47')](_0xcab845[_0x01af('0x46')]);_0x30a898[_0x01af('0x48')]=_['intersection'](_0x30a898['model'],_0x30a898[_0x01af('0x46')]);_0x18ab60['attributes']=_[_0x01af('0x49')](_0x30a898[_0x01af('0x45')],qs[_0x01af('0x4a')](_0xcab845[_0x01af('0x46')]['fields']));_0x18ab60['attributes']=_0x18ab60[_0x01af('0x4b')][_0x01af('0x4c')]?_0x18ab60['attributes']:_0x30a898[_0x01af('0x45')];if(!_0xcab845['query']['hasOwnProperty']('nolimit')){_0x18ab60[_0x01af('0x36')]=qs[_0x01af('0x36')](_0xcab845[_0x01af('0x46')][_0x01af('0x36')]);_0x18ab60[_0x01af('0x35')]=qs[_0x01af('0x35')](_0xcab845['query'][_0x01af('0x35')]);}_0x18ab60[_0x01af('0x4d')]=qs['sort'](_0xcab845[_0x01af('0x46')][_0x01af('0x4e')]);_0x18ab60['where']=qs['filters'](_[_0x01af('0x4f')](_0xcab845[_0x01af('0x46')],_0x30a898[_0x01af('0x48')]),_0x2555b2);if(_0xcab845[_0x01af('0x46')][_0x01af('0x50')]){_0x18ab60[_0x01af('0x51')]=_['merge'](_0x18ab60[_0x01af('0x51')],{'$or':_[_0x01af('0x40')](_0x2555b2,function(_0xb46cc9){if(_0xb46cc9['type']!==_0x01af('0x52')){var _0x2d46e6={};_0x2d46e6[_0xb46cc9['name']]={'$like':'%'+_0xcab845[_0x01af('0x46')][_0x01af('0x50')]+'%'};return _0x2d46e6;}})});}_0x18ab60=_[_0x01af('0x53')]({},_0x18ab60,_0xcab845[_0x01af('0x54')]);var _0x3f9e21={'where':_0x18ab60[_0x01af('0x51')]};return db[_0x01af('0x55')]['count'](_0x3f9e21)[_0x01af('0x25')](function(_0x5db3c2){_0x464662[_0x01af('0x34')]=_0x5db3c2;if(_0xcab845[_0x01af('0x46')]['includeAll']){_0x18ab60['include']=[{'all':!![]}];}return db[_0x01af('0x55')][_0x01af('0x56')](_0x18ab60);})['then'](function(_0x8411c2){_0x464662[_0x01af('0x57')]=_0x8411c2;return _0x464662;})[_0x01af('0x25')](respondWithFilteredResult(_0x4822f0,_0x18ab60))['catch'](handleError(_0x4822f0,null));};exports[_0x01af('0x58')]=function(_0x1edc22,_0x59c1bb){var _0x219f63={'raw':![],'where':{'id':_0x1edc22['params']['id']},'include':[{'model':db[_0x01af('0x59')],'as':_0x01af('0x5a')}]},_0x34a1fa={};_0x34a1fa['model']=_[_0x01af('0x47')](db['ChatWebsite'][_0x01af('0x41')]);_0x34a1fa[_0x01af('0x46')]=_[_0x01af('0x47')](_0x1edc22['query']);_0x34a1fa[_0x01af('0x48')]=_[_0x01af('0x49')](_0x34a1fa[_0x01af('0x45')],_0x34a1fa[_0x01af('0x46')]);_0x219f63[_0x01af('0x4b')]=_[_0x01af('0x49')](_0x34a1fa['model'],qs[_0x01af('0x4a')](_0x1edc22[_0x01af('0x46')][_0x01af('0x4a')]));_0x219f63[_0x01af('0x4b')]=_0x219f63[_0x01af('0x4b')][_0x01af('0x4c')]?_0x219f63['attributes']:_0x34a1fa[_0x01af('0x45')];if(_0x1edc22[_0x01af('0x46')]['includeAll']){_0x219f63['include']=[{'all':!![]}];}_0x219f63=_['merge']({},_0x219f63,_0x1edc22['options']);return db[_0x01af('0x55')]['find'](_0x219f63)[_0x01af('0x25')](handleEntityNotFound(_0x59c1bb,null))[_0x01af('0x25')](respondWithResult(_0x59c1bb,null))[_0x01af('0x30')](handleError(_0x59c1bb,null));};exports[_0x01af('0x5b')]=function(_0x59b22f,_0x282959){return db[_0x01af('0x55')]['create'](_0x59b22f[_0x01af('0x5c')],{})['then'](function(_0x46e01a){var _0x461394=_0x59b22f[_0x01af('0x5d')][_0x01af('0x5e')]({'plain':!![]});if(!_0x461394)throw new Error(_0x01af('0x5f'));if(_0x461394[_0x01af('0x60')]===_0x01af('0x5d')){var _0x179ed5=_0x46e01a['get']({'plain':!![]});var _0x51e748=_0x01af('0x61');return db['UserProfileSection'][_0x01af('0x62')]({'where':{'name':_0x51e748,'userProfileId':_0x461394[_0x01af('0x63')]},'raw':!![]})[_0x01af('0x25')](function(_0x2b8524){if(_0x2b8524&&_0x2b8524['autoAssociation']===0x0){return db[_0x01af('0x3a')]['create']({'name':_0x179ed5['name'],'resourceId':_0x179ed5['id'],'type':_0x2b8524[_0x01af('0x3d')],'sectionId':_0x2b8524['id']},{})[_0x01af('0x25')](function(){return _0x46e01a;});}else{return _0x46e01a;}})[_0x01af('0x30')](function(_0x1bc363){logger[_0x01af('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bc363);throw _0x1bc363;});}return _0x46e01a;})[_0x01af('0x25')](respondWithResult(_0x282959,0xc9))['catch'](handleError(_0x282959,null));};exports[_0x01af('0x64')]=function(_0x47ecf7,_0x5c0714){if(_0x47ecf7[_0x01af('0x5c')]['id']){delete _0x47ecf7[_0x01af('0x5c')]['id'];}return db[_0x01af('0x55')][_0x01af('0x62')]({'where':{'id':_0x47ecf7[_0x01af('0x65')]['id']},'include':[{'model':db[_0x01af('0x59')],'as':_0x01af('0x5a')}]})[_0x01af('0x25')](handleEntityNotFound(_0x5c0714,null))[_0x01af('0x25')](saveUpdates(_0x47ecf7['body'],null))[_0x01af('0x25')](respondWithResult(_0x5c0714,null))[_0x01af('0x30')](handleError(_0x5c0714,null));};exports[_0x01af('0x3b')]=function(_0x215792,_0x319cd6){return db[_0x01af('0x55')]['find']({'where':{'id':_0x215792[_0x01af('0x65')]['id']}})['then'](handleEntityNotFound(_0x319cd6,null))['then'](removeEntity(_0x319cd6,null))[_0x01af('0x30')](handleError(_0x319cd6,null));};exports[_0x01af('0x66')]=function(_0x1082c8,_0x5c6062){return db[_0x01af('0x55')][_0x01af('0x66')]()[_0x01af('0x25')](respondWithResult(_0x5c6062,null))[_0x01af('0x30')](handleError(_0x5c6062,null));};exports[_0x01af('0x67')]=function(_0x282d5b,_0x4185c4,_0x2a3429){if(_0x282d5b[_0x01af('0x5c')]['id']){delete _0x282d5b['body']['id'];}return db['ChatWebsite'][_0x01af('0x62')]({'where':{'id':_0x282d5b[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x4185c4,null))['then'](function(_0x4460ce){if(_0x4460ce){_0x282d5b[_0x01af('0x5c')][_0x01af('0x68')]=_0x4460ce['id'];return db[_0x01af('0x69')]['create'](_0x282d5b[_0x01af('0x5c')]);}})['then'](respondWithResult(_0x4185c4,null))[_0x01af('0x30')](handleError(_0x4185c4,null));};exports[_0x01af('0x6a')]=function(_0x194736,_0x363be8,_0x4cc691){var _0x17a977={'raw':![],'where':{}};var _0x2ae840={};var _0x63cc53={'count':0x0,'rows':[]};return db[_0x01af('0x55')]['findOne']({'where':{'id':_0x194736[_0x01af('0x65')]['id']}})['then'](handleEntityNotFound(_0x363be8,null))['then'](function(_0xb79fba){if(_0xb79fba){_0x2ae840[_0x01af('0x45')]=_[_0x01af('0x47')](db['Disposition'][_0x01af('0x41')]);_0x2ae840[_0x01af('0x46')]=_['keys'](_0x194736[_0x01af('0x46')]);_0x2ae840[_0x01af('0x48')]=_[_0x01af('0x49')](_0x2ae840['model'],_0x2ae840[_0x01af('0x46')]);_0x17a977[_0x01af('0x4b')]=_[_0x01af('0x49')](_0x2ae840[_0x01af('0x45')],qs['fields'](_0x194736[_0x01af('0x46')][_0x01af('0x4a')]));_0x17a977[_0x01af('0x4b')]=_0x17a977['attributes'][_0x01af('0x4c')]?_0x17a977[_0x01af('0x4b')]:_0x2ae840[_0x01af('0x45')];if(!_0x194736[_0x01af('0x46')][_0x01af('0x6b')]('nolimit')){_0x17a977[_0x01af('0x36')]=qs[_0x01af('0x36')](_0x194736[_0x01af('0x46')][_0x01af('0x36')]);_0x17a977['offset']=qs[_0x01af('0x35')](_0x194736['query'][_0x01af('0x35')]);}_0x17a977[_0x01af('0x4d')]=qs[_0x01af('0x4e')](_0x194736[_0x01af('0x46')][_0x01af('0x4e')]);_0x17a977[_0x01af('0x51')]=qs[_0x01af('0x48')](_[_0x01af('0x4f')](_0x194736['query'],_0x2ae840['filters']));_0x17a977[_0x01af('0x51')][_0x01af('0x68')]=_0xb79fba['id'];if(_0x194736[_0x01af('0x46')][_0x01af('0x50')]){_0x17a977[_0x01af('0x51')]=_[_0x01af('0x53')](_0x17a977['where'],{'$or':_['map'](_0x17a977['attributes'],function(_0x2621d3){var _0x9f4cc2={};_0x9f4cc2[_0x2621d3]={'$like':'%'+_0x194736[_0x01af('0x46')]['filter']+'%'};return _0x9f4cc2;})});}_0x17a977=_[_0x01af('0x53')]({},_0x17a977,_0x194736['options']);return db[_0x01af('0x69')][_0x01af('0x34')]({'where':_0x17a977[_0x01af('0x51')]})['then'](function(_0x1588b8){_0x63cc53[_0x01af('0x34')]=_0x1588b8;if(_0x194736[_0x01af('0x46')][_0x01af('0x6c')]){_0x17a977[_0x01af('0x6d')]=[{'all':!![]}];}return db[_0x01af('0x69')][_0x01af('0x56')](_0x17a977);})[_0x01af('0x25')](function(_0x1c31a2){_0x63cc53[_0x01af('0x57')]=_0x1c31a2;return _0x63cc53;});}})[_0x01af('0x25')](respondWithFilteredResult(_0x363be8,_0x17a977))['catch'](handleError(_0x363be8,null));};exports[_0x01af('0x6e')]=function(_0x37c52f,_0x276faf,_0x110f36){return db[_0x01af('0x55')][_0x01af('0x62')]({'where':{'id':_0x37c52f['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x276faf,null))['then'](function(_0xadc8a0){if(_0xadc8a0){return _0xadc8a0['removeDispositions'](_0x37c52f[_0x01af('0x46')][_0x01af('0x6f')]);}})['then'](respondWithStatusCode(_0x276faf,null))[_0x01af('0x30')](handleError(_0x276faf,null));};exports[_0x01af('0x70')]=function(_0x3192d6,_0x1fc21d,_0x4a88a7){if(_0x3192d6[_0x01af('0x5c')]['id']){delete _0x3192d6[_0x01af('0x5c')]['id'];}return db[_0x01af('0x55')]['find']({'where':{'id':_0x3192d6[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x1fc21d,null))[_0x01af('0x25')](function(_0x3b0e72){if(_0x3b0e72){_0x3192d6[_0x01af('0x5c')][_0x01af('0x68')]=_0x3b0e72['id'];return db[_0x01af('0x71')][_0x01af('0x5b')](_0x3192d6['body']);}})[_0x01af('0x25')](respondWithResult(_0x1fc21d,null))[_0x01af('0x30')](handleError(_0x1fc21d,null));};exports[_0x01af('0x72')]=function(_0x5c8890,_0x48c238,_0x58bbab){var _0x4546d5={'raw':![],'where':{}};var _0x14d9ad={};var _0x200aac={'count':0x0,'rows':[]};return db[_0x01af('0x55')][_0x01af('0x73')]({'where':{'id':_0x5c8890[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x48c238,null))['then'](function(_0x11a1eb){if(_0x11a1eb){_0x14d9ad[_0x01af('0x45')]=_[_0x01af('0x47')](db[_0x01af('0x71')][_0x01af('0x41')]);_0x14d9ad['query']=_[_0x01af('0x47')](_0x5c8890[_0x01af('0x46')]);_0x14d9ad['filters']=_['intersection'](_0x14d9ad[_0x01af('0x45')],_0x14d9ad[_0x01af('0x46')]);_0x4546d5[_0x01af('0x4b')]=_['intersection'](_0x14d9ad[_0x01af('0x45')],qs[_0x01af('0x4a')](_0x5c8890[_0x01af('0x46')][_0x01af('0x4a')]));_0x4546d5[_0x01af('0x4b')]=_0x4546d5['attributes'][_0x01af('0x4c')]?_0x4546d5[_0x01af('0x4b')]:_0x14d9ad[_0x01af('0x45')];if(!_0x5c8890[_0x01af('0x46')][_0x01af('0x6b')](_0x01af('0x74'))){_0x4546d5[_0x01af('0x36')]=qs['limit'](_0x5c8890[_0x01af('0x46')][_0x01af('0x36')]);_0x4546d5[_0x01af('0x35')]=qs[_0x01af('0x35')](_0x5c8890[_0x01af('0x46')][_0x01af('0x35')]);}_0x4546d5[_0x01af('0x4d')]=qs[_0x01af('0x4e')](_0x5c8890[_0x01af('0x46')][_0x01af('0x4e')]);_0x4546d5[_0x01af('0x51')]=qs[_0x01af('0x48')](_['pick'](_0x5c8890[_0x01af('0x46')],_0x14d9ad[_0x01af('0x48')]));_0x4546d5['where']['ChatWebsiteId']=_0x11a1eb['id'];if(_0x5c8890['query'][_0x01af('0x50')]){_0x4546d5[_0x01af('0x51')]=_['merge'](_0x4546d5['where'],{'$or':_[_0x01af('0x40')](_0x4546d5[_0x01af('0x4b')],function(_0x3f5a07){var _0x3d0f3e={};_0x3d0f3e[_0x3f5a07]={'$like':'%'+_0x5c8890['query']['filter']+'%'};return _0x3d0f3e;})});}_0x4546d5=_[_0x01af('0x53')]({},_0x4546d5,_0x5c8890[_0x01af('0x54')]);return db[_0x01af('0x71')]['count']({'where':_0x4546d5[_0x01af('0x51')]})['then'](function(_0x1182a0){_0x200aac['count']=_0x1182a0;if(_0x5c8890[_0x01af('0x46')][_0x01af('0x6c')]){_0x4546d5[_0x01af('0x6d')]=[{'all':!![]}];}return db[_0x01af('0x71')]['findAll'](_0x4546d5);})['then'](function(_0x28470e){_0x200aac['rows']=_0x28470e;return _0x200aac;});}})['then'](respondWithFilteredResult(_0x48c238,_0x4546d5))[_0x01af('0x30')](handleError(_0x48c238,null));};exports['removeAnswers']=function(_0x17e137,_0x1dfff3,_0xc23a8b){return db['ChatWebsite'][_0x01af('0x62')]({'where':{'id':_0x17e137[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x1dfff3,null))[_0x01af('0x25')](function(_0x2977f6){if(_0x2977f6){return _0x2977f6[_0x01af('0x75')](_0x17e137[_0x01af('0x46')]['ids']);}})[_0x01af('0x25')](respondWithStatusCode(_0x1dfff3,null))[_0x01af('0x30')](handleError(_0x1dfff3,null));};exports['addLogo']=function(_0x4c0432,_0x4d7179,_0x45169a){_0x4c0432['body'][_0x01af('0x76')]=_0x4c0432['file'][_0x01af('0x77')];return db['ChatWebsite'][_0x01af('0x62')]({'where':{'id':_0x4c0432['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x4d7179,null))[_0x01af('0x25')](saveUpdates(_0x4c0432[_0x01af('0x5c')],null))[_0x01af('0x25')](respondWithResult(_0x4d7179,null))['catch'](handleError(_0x4d7179,null));};exports[_0x01af('0x78')]=function(_0x2da4bf,_0x4d9ac2,_0xcee7ac){_0x2da4bf[_0x01af('0x5c')]['agentAvatar']=_0x2da4bf[_0x01af('0x79')][_0x01af('0x77')];return db[_0x01af('0x55')][_0x01af('0x62')]({'where':{'id':_0x2da4bf[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x4d9ac2,null))[_0x01af('0x25')](saveUpdates(_0x2da4bf['body'],null))['then'](respondWithResult(_0x4d9ac2,null))[_0x01af('0x30')](handleError(_0x4d9ac2,null));};exports[_0x01af('0x7a')]=function(_0x17fd0b,_0xc289e1,_0x5dc8aa){_0x17fd0b[_0x01af('0x5c')][_0x01af('0x7b')]=_0x17fd0b[_0x01af('0x79')][_0x01af('0x77')];return db['ChatWebsite'][_0x01af('0x62')]({'where':{'id':_0x17fd0b[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0xc289e1,null))['then'](saveUpdates(_0x17fd0b[_0x01af('0x5c')],null))['then'](respondWithResult(_0xc289e1,null))['catch'](handleError(_0xc289e1,null));};exports['addSystemAvatar']=function(_0x50e5f4,_0x74df6a,_0x16bd61){_0x50e5f4['body'][_0x01af('0x7c')]=_0x50e5f4[_0x01af('0x79')]['filename'];return db[_0x01af('0x55')][_0x01af('0x62')]({'where':{'id':_0x50e5f4[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x74df6a,null))[_0x01af('0x25')](saveUpdates(_0x50e5f4[_0x01af('0x5c')],null))[_0x01af('0x25')](respondWithResult(_0x74df6a,null))[_0x01af('0x30')](handleError(_0x74df6a,null));};exports['getLogo']=function(_0x1d3aeb,_0x289d53,_0x39933e){var _0x2150d1=path[_0x01af('0x7d')](config['root'],_0x01af('0x7e'));var _0x28ee61={'where':{'id':_0x1d3aeb[_0x01af('0x65')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x431226=![];return require(_0x01af('0x7f'))[_0x01af('0x80')]()[_0x01af('0x25')](function(_0x2bc5c4){if(_0x2bc5c4){_0x431226=_0x2bc5c4[_0x01af('0x81')];}})[_0x01af('0x25')](function(){return db[_0x01af('0x55')][_0x01af('0x62')](_0x28ee61);})[_0x01af('0x25')](handleEntityNotFound(_0x289d53,null))[_0x01af('0x25')](function(_0x31b412){if(_0x31b412){if(!_[_0x01af('0x82')](_0x31b412[_0x01af('0x76')])){if(fs[_0x01af('0x83')](path[_0x01af('0x7d')](config[_0x01af('0x84')],'server/files/images/logos/',_0x31b412[_0x01af('0x76')]))&&_0x431226){_0x2150d1=path['join'](config[_0x01af('0x84')],'server/files/images/logos/',_0x31b412['sitepic']);}}return _0x289d53[_0x01af('0x85')](_0x2150d1);}})[_0x01af('0x30')](handleError(_0x289d53,null));};exports['getAvatar']=function(_0x353fdf,_0x2b1e2d,_0x4ba497){var _0x38caa0=path[_0x01af('0x7d')](config[_0x01af('0x84')],'server/files/images/avatars/default_avatar.png');var _0x4fdaa2={'where':{'id':_0x353fdf[_0x01af('0x65')]['id']},'attributes':['id',_0x01af('0x86')],'raw':!![]};return db[_0x01af('0x55')][_0x01af('0x62')](_0x4fdaa2)[_0x01af('0x25')](handleEntityNotFound(_0x2b1e2d,null))[_0x01af('0x25')](function(_0x211d32){if(_0x211d32){if(!_[_0x01af('0x82')](_0x211d32[_0x01af('0x86')])){if(fs[_0x01af('0x83')](path[_0x01af('0x7d')](config[_0x01af('0x84')],_0x01af('0x87'),_0x211d32[_0x01af('0x86')]))){_0x38caa0=path[_0x01af('0x7d')](config[_0x01af('0x84')],'server/files/images/avatars/',_0x211d32['agentAvatar']);}}return _0x2b1e2d[_0x01af('0x85')](_0x38caa0);}})['catch'](handleError(_0x2b1e2d,null));};exports[_0x01af('0x88')]=function(_0x34e901,_0x86629e,_0x589017){var _0x48c43d=path['join'](config['root'],_0x01af('0x89'));var _0x3b4424={'where':{'id':_0x34e901[_0x01af('0x65')]['id']},'attributes':['id','customerAvatar',_0x01af('0x8a')],'raw':!![]};return db[_0x01af('0x55')][_0x01af('0x62')](_0x3b4424)[_0x01af('0x25')](handleEntityNotFound(_0x86629e,null))[_0x01af('0x25')](function(_0xf97946){if(_0xf97946){if(!_[_0x01af('0x82')](_0xf97946[_0x01af('0x7b')])){if(fs[_0x01af('0x83')](path[_0x01af('0x7d')](config[_0x01af('0x84')],'server/files/images/avatars/',_0xf97946['customerAvatar']))&&_0xf97946['showCustomerAvatar']){_0x48c43d=path[_0x01af('0x7d')](config[_0x01af('0x84')],_0x01af('0x87'),_0xf97946[_0x01af('0x7b')]);}}return _0x86629e[_0x01af('0x85')](_0x48c43d);}})[_0x01af('0x30')](handleError(_0x86629e,null));};exports['getSystemAvatar']=function(_0x2a27da,_0x198251,_0x1f7d1e){var _0x4d329f=path['join'](config[_0x01af('0x84')],_0x01af('0x8b'));var _0x279cde={'where':{'id':_0x2a27da['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x01af('0x55')][_0x01af('0x62')](_0x279cde)[_0x01af('0x25')](handleEntityNotFound(_0x198251,null))[_0x01af('0x25')](function(_0x5223f4){if(_0x5223f4){if(!_['isNil'](_0x5223f4[_0x01af('0x7c')])){if(fs[_0x01af('0x83')](path[_0x01af('0x7d')](config['root'],_0x01af('0x87'),_0x5223f4[_0x01af('0x7c')]))){_0x4d329f=path['join'](config['root'],_0x01af('0x87'),_0x5223f4[_0x01af('0x7c')]);}}return _0x198251[_0x01af('0x85')](_0x4d329f);}})['catch'](handleError(_0x198251,null));};exports[_0x01af('0x8c')]=function(_0x25ac55,_0x4ed4a6,_0x3031d9){var _0x40f7b8=require(_0x01af('0x8d'));var _0x237d0a=new _0x40f7b8();var _0x261012=_0x237d0a[_0x01af('0x8e')](_0x25ac55[_0x01af('0x8f')][_0x01af('0x90')])['getResult']();var _0x34fc23={'body':_0x25ac55[_0x01af('0x5c')],'channel':_0x01af('0x91')};var _0x53631f=[];var _0x5935e1=[];var _0x522860={};var _0x5376b6=![];return db[_0x01af('0x92')]['describe']()[_0x01af('0x25')](function(_0x2e8175){if(!_0x2e8175){throw new db['Sequelize'][(_0x01af('0x22'))](_0x01af('0x93'));}_0x53631f=_['difference'](_[_0x01af('0x47')](_0x2e8175),[_0x01af('0x94'),_0x01af('0x95')]);_0x5935e1=_[_0x01af('0x96')](_[_0x01af('0x47')](_0x2e8175),[_0x01af('0x94'),_0x01af('0x95'),_0x01af('0x97'),'ListId']);if(_0x25ac55[_0x01af('0x5c')]['id']){delete _0x25ac55[_0x01af('0x5c')]['id'];}if(_[_0x01af('0x82')](_0x25ac55['body'][_0x01af('0x98')])){throw new db[(_0x01af('0x99'))][(_0x01af('0x22'))]('from\x20is\x20mandatory');}if(_[_0x01af('0x82')](_0x25ac55['body'][_0x01af('0x5c')])||_0x25ac55['body']['body']===''){throw new db[(_0x01af('0x99'))]['ValidationError'](_0x01af('0x9a'));}if(_['isNil'](_0x25ac55['body']['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5935e1);}if(!_[_0x01af('0x9b')](_0x5935e1,_0x25ac55[_0x01af('0x5c')][_0x01af('0x9c')])){throw new db[(_0x01af('0x99'))][(_0x01af('0x22'))](_0x01af('0x9d')+_0x5935e1);}_0x522860[_0x25ac55[_0x01af('0x5c')][_0x01af('0x9c')]]=_0x25ac55[_0x01af('0x5c')]['from'];})[_0x01af('0x25')](function(){return db[_0x01af('0x55')][_0x01af('0x62')]({'where':{'id':_0x25ac55[_0x01af('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0x01af('0x9e'),'include':[{'model':db['CmContact'],'as':_0x01af('0x9f'),'where':_0x522860,'limit':0x1,'order':[[_0x01af('0x95'),_0x01af('0xa0')]]}]},{'model':db[_0x01af('0xa1')],'as':'Applications'}]});})[_0x01af('0x25')](handleEntityNotFound(_0x4ed4a6,null))[_0x01af('0x25')](function(_0x539f35){if(_0x539f35&&_0x539f35[_0x01af('0x9e')]){_0x34fc23[_0x01af('0xa2')]=_0x539f35;_0x34fc23['applications']=_0x539f35[_0x01af('0xa3')];_0x34fc23['list']=_0x539f35[_0x01af('0x9e')];_0x34fc23['applications']=_[_0x01af('0xa4')](_0x34fc23[_0x01af('0xa5')],[_0x01af('0xa6')],[_0x01af('0xa7')]);if(_0x34fc23[_0x01af('0xa2')][_0x01af('0xa3')]){delete _0x34fc23[_0x01af('0xa2')][_0x01af('0xa3')];}if(_0x34fc23['account'][_0x01af('0x9e')]&&_0x34fc23[_0x01af('0xa2')]['List']['Contacts'][_0x01af('0x4c')]){return _0x34fc23[_0x01af('0xa2')][_0x01af('0x9e')][_0x01af('0x9f')][0x0];}var _0x2578b1=_[_0x01af('0x19')](_0x25ac55[_0x01af('0x5c')],{'firstName':_0x25ac55[_0x01af('0x5c')][_0x01af('0x98')],'ListId':_0x539f35['ListId']});_0x2578b1[_0x25ac55[_0x01af('0x5c')]['mapKey']]=_0x25ac55[_0x01af('0x5c')][_0x01af('0x98')];return db[_0x01af('0x92')][_0x01af('0x5b')](_0x2578b1,{'fields':_0x53631f,'raw':!![]});}})[_0x01af('0x25')](handleEntityNotFound(_0x4ed4a6,null))['then'](function(_0x824dc0){_0x34fc23[_0x01af('0xa8')]=_0x824dc0;var _0x2c9a5a=_0x25ac55['body'][_0x01af('0xa9')];if(_0x25ac55[_0x01af('0x8f')][_0x01af('0xaa')]){_0x2c9a5a=_0x25ac55[_0x01af('0x8f')][_0x01af('0xaa')];}else if(_0x25ac55[_0x01af('0x8f')][_0x01af('0xab')]){_0x2c9a5a=_['first'](_0x25ac55[_0x01af('0x8f')][_0x01af('0xab')][_0x01af('0xac')](','));}if(_0x824dc0){var _0x1b675d={'ContactId':_0x824dc0['id'],'ChatWebsiteId':_0x25ac55[_0x01af('0x65')]['id'],'from':(_0x824dc0['firstName']||'')+'\x20'+(_0x824dc0[_0x01af('0xad')]||''),'customerIp':_0x2c9a5a,'customerPort':_0x25ac55[_0x01af('0x8f')][_0x01af('0xae')]?_0x25ac55[_0x01af('0x8f')][_0x01af('0xae')]:null,'referer':_0x25ac55[_0x01af('0x5c')][_0x01af('0xaf')],'browserName':_0x261012[_0x01af('0xb0')][_0x01af('0x3d')]&&_0x261012[_0x01af('0xb0')][_0x01af('0xb1')]?util[_0x01af('0xb2')](_0x01af('0xb3'),_0x261012[_0x01af('0xb0')]['name'],_0x261012[_0x01af('0xb0')][_0x01af('0xb1')]):_0x01af('0xb4'),'browserVersion':_0x261012[_0x01af('0xb0')][_0x01af('0xb1')]||'unknown','osName':util[_0x01af('0xb2')](_0x01af('0xb3'),_0x261012['os'][_0x01af('0x3d')],_0x261012['os']['version']),'osVersion':_0x261012['os'][_0x01af('0xb1')],'deviceModel':_0x261012[_0x01af('0xb5')][_0x01af('0x45')]&&_0x261012[_0x01af('0xb5')][_0x01af('0xb6')]?util[_0x01af('0xb2')](_0x01af('0xb7'),_0x261012['device'][_0x01af('0x45')],_0x261012['device'][_0x01af('0xb6')],_0x261012[_0x01af('0xb5')]['type']):null,'deviceVendor':_0x261012[_0x01af('0xb5')][_0x01af('0xb6')],'deviceType':_0x261012[_0x01af('0xb5')][_0x01af('0x43')],'formData':JSON[_0x01af('0x2a')](_0x25ac55[_0x01af('0x5c')])};var _0x518530={'ChatWebsiteId':_0x25ac55['params']['id'],'closed':![]};if(_0x25ac55[_0x01af('0x5c')][_0x01af('0xb8')]){_0x518530[_0x01af('0xb8')]=_0x25ac55[_0x01af('0x5c')][_0x01af('0xb8')];return db[_0x01af('0xb9')]['find']({'where':_0x518530})[_0x01af('0x25')](function(_0x1eb582){if(_0x1eb582){return[_0x1eb582,![]];}_0x1b675d['threadId']=_0x25ac55[_0x01af('0x5c')]['threadId'];_0x1b675d[_0x01af('0xba')]=_0x25ac55['body'][_0x01af('0xba')];return db[_0x01af('0xb9')][_0x01af('0x5b')](_0x1b675d)['then'](function(_0x313bc5){return[_0x313bc5,!![]];});});}_0x518530[_0x01af('0xbb')]=_0x824dc0['id'];if(_0x25ac55[_0x01af('0x5c')][_0x01af('0xbc')]&&_0x25ac55[_0x01af('0x5c')][_0x01af('0xbc')]['id']){_0x518530['id']=_0x25ac55[_0x01af('0x5c')][_0x01af('0xbc')]['id'];return db[_0x01af('0xb9')]['find']({'where':_0x518530})[_0x01af('0x25')](function(_0x1f126a){if(_0x1f126a){return[_0x1f126a,![]];}return db[_0x01af('0xb9')]['create'](_0x1b675d)[_0x01af('0x25')](function(_0x443996){return[_0x443996,!![]];});});}return db['ChatInteraction'][_0x01af('0x5b')](_0x1b675d)[_0x01af('0x25')](function(_0x896c3e){return[_0x896c3e,!![]];});}})[_0x01af('0xbd')](function(_0x3040a6,_0x1090fd){if(_0x3040a6){_0x5376b6=_0x1090fd;if(!_0x1090fd){var _0x3861ad={'from':(_0x34fc23[_0x01af('0xa8')][_0x01af('0xbe')]||'')+'\x20'+(_0x34fc23[_0x01af('0xa8')][_0x01af('0xad')]||'')};if(_0x25ac55[_0x01af('0x5c')][_0x01af('0xb8')]&&_0x25ac55[_0x01af('0x5c')][_0x01af('0xbf')]&&_0x25ac55[_0x01af('0x5c')]['threadId']!=_0x25ac55[_0x01af('0x5c')][_0x01af('0xbf')]){_0x3861ad['threadId']=_0x25ac55[_0x01af('0x5c')][_0x01af('0xbf')];}return _0x3040a6[_0x01af('0x64')](_0x3861ad);}else{return _0x3040a6;}}})['then'](function(_0x28747a){_0x34fc23[_0x01af('0xbc')]=_0x28747a[_0x01af('0x5e')]({'plain':!![]});_0x34fc23[_0x01af('0xbc')][_0x01af('0xc0')]=_0x5376b6;if(_0x34fc23[_0x01af('0xbc')][_0x01af('0xc0')]){if(_0x34fc23[_0x01af('0xa2')][_0x01af('0xc1')]){_0x34fc23['applications'][_0x01af('0xc2')]({'id':0x0,'priority':_0x34fc23[_0x01af('0xa5')][_0x01af('0x4c')]+0x1,'app':_0x01af('0xc3'),'appdata':_0x01af('0xc4'),'interval':_0x01af('0xc5')});}}return db[_0x01af('0xc6')][_0x01af('0x5b')]({'body':_0x25ac55[_0x01af('0x5c')][_0x01af('0x5c')],'ChatWebsiteId':_0x25ac55[_0x01af('0x65')]['id'],'ChatInteractionId':_0x28747a['id'],'direction':'in','ContactId':_0x34fc23['contact']['id'],'AttachmentId':_0x25ac55['body'][_0x01af('0xc7')]});})[_0x01af('0x25')](function(_0x2d1895){_0x34fc23[_0x01af('0x2e')]=_0x2d1895;if(_0x34fc23['interaction'][_0x01af('0xc8')]){return db[_0x01af('0xc9')][_0x01af('0x62')]({'attributes':['id',_0x01af('0x3d')],'where':{'id':_0x34fc23['interaction'][_0x01af('0xc8')]}})[_0x01af('0x25')](function(_0x24abbf){if(_0x24abbf){_0x34fc23['applications'][_0x01af('0xca')]({'id':0x0,'priority':0x0,'app':_0x01af('0xcb'),'appdata':_0x24abbf[_0x01af('0x3d')]+','+(_0x34fc23[_0x01af('0xa2')][_0x01af('0xcc')]||0xa),'interval':'*,*,*,*'});_0x34fc23[_0x01af('0xcd')]=!![];}return respondWithRpcPromise(_0x01af('0xce'),_0x01af('0xcf'),_0x34fc23);});}return respondWithRpcPromise(_0x01af('0xce'),'startRouting',_0x34fc23);})['then'](function(_0x9df0e7){respondWithRpcPromise('EventManager',_0x01af('0xd0'),{'event':_0x01af('0x8c'),'message':_0x9df0e7},client9002);return _0x9df0e7;})[_0x01af('0x25')](respondWithResult(_0x4ed4a6,null))[_0x01af('0x30')](handleError(_0x4ed4a6,null));};exports[_0x01af('0xd1')]=function(_0x45632b,_0x4bbf8f,_0x2704d3){var _0x1a57bb,_0x1214ac,_0xe5648d;var _0x2c360a=[];var _0x5ca629=[];var _0x118c3b={};return db['CmContact'][_0x01af('0x66')]()[_0x01af('0x25')](function(_0x15d7b0){if(!_0x15d7b0){throw new db[(_0x01af('0x99'))][(_0x01af('0x22'))](_0x01af('0x93'));}_0x5ca629=_[_0x01af('0x96')](_['keys'](_0x15d7b0),[_0x01af('0x94'),_0x01af('0x95')]);_0x2c360a=_[_0x01af('0x96')](_[_0x01af('0x47')](_0x15d7b0),[_0x01af('0x94'),_0x01af('0x95'),_0x01af('0x97'),_0x01af('0xd2')]);if(_0x45632b['body']['id']){delete _0x45632b['body']['id'];}if(_[_0x01af('0x82')](_0x45632b[_0x01af('0x5c')]['from'])){throw _0x4bbf8f[_0x01af('0x32')](0x1f4)[_0x01af('0x3e')](new db['Sequelize']['ValidationError'](_0x01af('0xd3')));}if(_['isNil'](_0x45632b[_0x01af('0x5c')]['body'])||_0x45632b[_0x01af('0x5c')]['body']===''){throw _0x4bbf8f[_0x01af('0x32')](0x1f4)[_0x01af('0x3e')](new db[(_0x01af('0x99'))][(_0x01af('0x22'))](_0x01af('0x9a')));}if(_[_0x01af('0x82')](_0x45632b[_0x01af('0x5c')][_0x01af('0xd4')])){throw _0x4bbf8f[_0x01af('0x32')](0x1f4)[_0x01af('0x3e')](new db[(_0x01af('0x99'))]['ValidationError'](_0x01af('0xd5')+_0x2c360a));}if(!_[_0x01af('0x9b')](_0x2c360a,_0x45632b[_0x01af('0x5c')][_0x01af('0xd4')])){throw _0x4bbf8f[_0x01af('0x32')](0x1f4)[_0x01af('0x3e')](new db['Sequelize']['ValidationError'](_0x01af('0xd6')+_0x2c360a));}_0x118c3b[_0x45632b[_0x01af('0x5c')][_0x01af('0xd4')]]=_0x45632b[_0x01af('0x5c')]['from'];})[_0x01af('0x25')](function(){return db[_0x01af('0x55')]['find']({'where':{'id':_0x45632b['params']['id']},'include':[{'model':db[_0x01af('0xd7')],'as':_0x01af('0x9e')}]});})[_0x01af('0x25')](handleEntityNotFound(_0x4bbf8f,null))[_0x01af('0x25')](function(_0x37f949){if(_0x37f949&&_0x37f949[_0x01af('0x9e')]){_0x1214ac=_0x37f949;var _0x154df8=_[_0x01af('0x19')](_0x45632b[_0x01af('0x5c')],{'firstName':_0x45632b['body'][_0x01af('0x98')],'phone':_0x45632b[_0x01af('0x5c')][_0x01af('0x98')],'ListId':_0x37f949[_0x01af('0xd2')]});_0x154df8[_0x45632b['body'][_0x01af('0xd4')]]=_0x45632b['body'][_0x01af('0x98')];return db[_0x01af('0x92')][_0x01af('0xd8')]({'where':_0x118c3b,'defaults':_0x154df8});}})[_0x01af('0xbd')](function(_0x3f5e54){if(_0x3f5e54){_0xe5648d=_0x3f5e54;var _0x5dbc93=fs['readFileSync'](path[_0x01af('0x7d')](config['root'],_0x01af('0xd9')),_0x01af('0xda'));var _0x3a8ce6=ejs['render'](_0x5dbc93,{'body':_[_0x01af('0xdb')](_0x45632b[_0x01af('0x5c')]['body']),'bodyTitle':_0x1214ac[_0x01af('0xdc')]});return db[_0x01af('0xdd')][_0x01af('0x5b')]({'body':_0x3a8ce6,'ContactId':_0x3f5e54['id'],'ChatWebsiteId':_0x1214ac['id']});}})[_0x01af('0x25')](function(_0x46b683){if(_0x46b683){_0x1a57bb=_0x46b683;return db[_0x01af('0xde')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x01af('0xdf')],'as':_0x01af('0xe0'),'raw':!![]}]});}})[_0x01af('0x25')](function(_0x252f30){if(_0x252f30&&_0x252f30[_0x01af('0xe0')]&&_0x1214ac[_0x01af('0xe1')]){var _0x1f565b={'tls':{'rejectUnauthorized':![]}};if(_0x252f30[_0x01af('0xe0')][_0x01af('0xe2')]){_0x1f565b[_0x01af('0xe2')]=_0x252f30[_0x01af('0xe0')][_0x01af('0xe2')];}else{_0x1f565b['host']=_0x252f30[_0x01af('0xe0')][_0x01af('0xe3')];_0x1f565b[_0x01af('0xe4')]=_0x252f30['Smtp'][_0x01af('0xe4')];_0x1f565b[_0x01af('0xe5')]=_0x252f30[_0x01af('0xe0')]['secure'];}if(_0x252f30['Smtp']['authentication']){_0x1f565b[_0x01af('0xe6')]={'user':_0x252f30['Smtp'][_0x01af('0x5d')],'pass':_0x252f30[_0x01af('0xe0')]['pass']};}return respondWithRpcPromise('SendMail',_0x01af('0xe7'),{'account':_0x1f565b,'message':{'from':util['format'](_0x01af('0xe8'),_0x252f30['name'],_0x252f30[_0x01af('0xe9')]||_0x252f30[_0x01af('0xe0')][_0x01af('0x5d')]),'to':_0x1214ac[_0x01af('0xe1')],'subject':_0x1214ac['offlineMessageSubject'],'text':_0x1a57bb[_0x01af('0x5c')]}},client9003)[_0x01af('0x25')](function(){return _0x1a57bb;})[_0x01af('0x30')](function(_0x2643b8){console['error'](_0x2643b8);});}})[_0x01af('0x25')](function(){if(_0x1a57bb){return _0x1a57bb;}})[_0x01af('0x25')](respondWithResult(_0x4bbf8f,null))[_0x01af('0x30')](handleError(_0x4bbf8f,null));};exports['addInteraction']=function(_0x473c3f,_0x3b1cd0,_0x925092){return db[_0x01af('0xb9')][_0x01af('0x62')]({'where':{'id':_0x473c3f[_0x01af('0x65')]['id']}})['then'](handleEntityNotFound(_0x3b1cd0,null))[_0x01af('0x25')](function(_0x46b2e1){if(_0x46b2e1){return _0x46b2e1[_0x01af('0xea')](_0x473c3f[_0x01af('0x5c')][_0x01af('0x6f')],_[_0x01af('0xeb')](_0x473c3f['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x3b1cd0,null))[_0x01af('0x30')](handleError(_0x3b1cd0,null));};exports[_0x01af('0xec')]=function(_0x42a7a3,_0x1b9e1f,_0x537c79){var _0x557130={'raw':![],'where':{}};var _0x3b330b={};var _0x2e0693={'count':0x0,'rows':[]};return db[_0x01af('0x55')][_0x01af('0x73')]({'where':{'id':_0x42a7a3[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x1b9e1f,null))[_0x01af('0x25')](function(_0x31f06d){if(_0x31f06d){_0x3b330b[_0x01af('0x45')]=_[_0x01af('0x47')](db[_0x01af('0xb9')]['rawAttributes']);_0x3b330b[_0x01af('0x46')]=_[_0x01af('0x47')](_0x42a7a3[_0x01af('0x46')]);_0x3b330b['filters']=_[_0x01af('0x49')](_0x3b330b[_0x01af('0x45')],_0x3b330b[_0x01af('0x46')]);_0x557130['attributes']=_['intersection'](_0x3b330b[_0x01af('0x45')],qs['fields'](_0x42a7a3[_0x01af('0x46')][_0x01af('0x4a')]));_0x557130['attributes']=_0x557130[_0x01af('0x4b')][_0x01af('0x4c')]?_0x557130[_0x01af('0x4b')]:_0x3b330b[_0x01af('0x45')];if(!_0x42a7a3['query'][_0x01af('0x6b')](_0x01af('0x74'))){_0x557130[_0x01af('0x36')]=qs['limit'](_0x42a7a3[_0x01af('0x46')]['limit']);_0x557130[_0x01af('0x35')]=qs[_0x01af('0x35')](_0x42a7a3['query'][_0x01af('0x35')]);}_0x557130[_0x01af('0x4d')]=qs[_0x01af('0x4e')](_0x42a7a3[_0x01af('0x46')]['sort']);_0x557130['where']=qs['filters'](_['pick'](_0x42a7a3['query'],_0x3b330b[_0x01af('0x48')]));_0x557130[_0x01af('0x51')][_0x01af('0x68')]=_0x31f06d['id'];if(_0x42a7a3[_0x01af('0x46')][_0x01af('0x50')]){_0x557130['where']=_[_0x01af('0x53')](_0x557130[_0x01af('0x51')],{'$or':_['map'](_0x557130[_0x01af('0x4b')],function(_0x2748a9){var _0x5f302d={};_0x5f302d[_0x2748a9]={'$like':'%'+_0x42a7a3[_0x01af('0x46')][_0x01af('0x50')]+'%'};return _0x5f302d;})});}_0x557130=_[_0x01af('0x53')]({},_0x557130,_0x42a7a3[_0x01af('0x54')]);return db[_0x01af('0xb9')][_0x01af('0x34')]({'where':_0x557130['where']})[_0x01af('0x25')](function(_0x2192b6){_0x2e0693[_0x01af('0x34')]=_0x2192b6;if(_0x42a7a3[_0x01af('0x46')][_0x01af('0x6c')]){_0x557130[_0x01af('0x6d')]=[{'model':db[_0x01af('0x92')],'as':_0x01af('0xed'),'required':![]},{'model':db[_0x01af('0xc9')],'as':_0x01af('0xee'),'attributes':[_0x01af('0x3d'),_0x01af('0xef'),_0x01af('0xf0')],'required':![]},{'model':db[_0x01af('0xf1')],'as':'Tags','attributes':['id',_0x01af('0x3d'),_0x01af('0xf2')],'where':_0x42a7a3[_0x01af('0x46')][_0x01af('0xf3')]?{'id':_0x42a7a3['query']['tag']}:undefined,'required':_0x42a7a3[_0x01af('0x46')][_0x01af('0xf3')]?!![]:![]}];}return db['ChatInteraction'][_0x01af('0x56')](_0x557130);})[_0x01af('0x25')](function(_0x3ca09c){_0x2e0693[_0x01af('0x57')]=_0x3ca09c;return _0x2e0693;});}})[_0x01af('0x25')](respondWithFilteredResult(_0x1b9e1f,_0x557130))[_0x01af('0x30')](handleError(_0x1b9e1f,null));};function iftimePromise(_0x4b297f,_0x420cc8){return respondWithRpcPromise('Command',_0x01af('0xf4'),{'command':_0x420cc8[_0x01af('0xf5')]?util['format'](_0x01af('0xf6'),_0x4b297f[_0x01af('0xf7')],_0x420cc8['timezone']):util[_0x01af('0xb2')](_0x01af('0xf8'),_0x4b297f[_0x01af('0xf7')])},client9002)[_0x01af('0x25')](function(_0x1fb88c){var _0x36cd97=_0x1fb88c&&_0x1fb88c['indexOf'](_0x01af('0xf9'))>=0x0?!![]:![];logger[_0x01af('0x26')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x420cc8['id'],_0x4b297f['id'],_0x4b297f[_0x01af('0xf7')],_0x36cd97?'ONLINE':_0x01af('0xfa'),_0x420cc8['timezone']?_0x420cc8[_0x01af('0xf5')]:_0x01af('0xfb'));return _0x36cd97;})[_0x01af('0x30')](function(_0x232109){logger[_0x01af('0x2b')](_0x01af('0xfc'),_0x420cc8['id'],_0x4b297f['id'],_0x4b297f[_0x01af('0xf7')],util[_0x01af('0xfd')](_0x232109,{'showHidden':![],'depth':null}),_0x420cc8['timezone']?_0x420cc8[_0x01af('0xf5')]:_0x01af('0xfb'));return![];});}exports[_0x01af('0xf4')]=function(_0x853990,_0x3f0c28,_0x5d4aeb){var _0x2ecb66=0x0;var _0x1e67b9=0x0;var _0x48fbb9=![];var _0x19fec4;var _0x2468e4;return db['ChatWebsite'][_0x01af('0x62')]({'where':{'id':_0x853990[_0x01af('0x65')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x01af('0xfe')],'as':'Intervals','attributes':['id',_0x01af('0xf7')],'raw':!![]}]}]})[_0x01af('0x25')](handleEntityNotFound(_0x3f0c28,null))[_0x01af('0x25')](function(_0x59274c){if(_0x59274c){_0x19fec4=_0x59274c;return _0x59274c['getProactiveActions']({'raw':!![]});}})[_0x01af('0x25')](function(_0x312012){if(_0x19fec4){if(_0x312012){_0x2468e4=_0x312012;}}return require(_0x01af('0x7f'))[_0x01af('0x80')]();})['then'](function(_0x3e7c74){if(_0x3e7c74){_0x1e67b9=_0x3e7c74['virtual'];_0x48fbb9=_0x3e7c74[_0x01af('0x81')];}})['then'](function(){return db[_0x01af('0xb9')][_0x01af('0x34')]({'where':{'closed':![]}});})[_0x01af('0x25')](function(_0x440f15){_0x2ecb66=_0x440f15;if(_0x1e67b9&&_0x440f15>_0x1e67b9){return db['License'][_0x01af('0x73')]({'where':{'id':0x1}})[_0x01af('0x25')](function(_0x2c308a){if(_0x2c308a){_0x2c308a['increment'](_0x01af('0xff'));}});}})[_0x01af('0x25')](function(){if(_0x19fec4[_0x01af('0xfe')]&&_0x19fec4['Interval'][_0x01af('0x100')]){var _0x147869=[];for(var _0x31ba1f=0x0;_0x31ba1f<_0x19fec4[_0x01af('0xfe')][_0x01af('0x100')]['length'];_0x31ba1f++){var _0x11c3af=_0x19fec4[_0x01af('0xfe')][_0x01af('0x100')][_0x31ba1f][_0x01af('0x5e')]({'plain':!![]});_0x147869['push'](iftimePromise(_0x11c3af,_0x19fec4));}return BPromise['all'](_0x147869)[_0x01af('0x25')](function(_0x377c51){return _['some'](_0x377c51);});}else{return!![];}})['then'](function(_0x3ef1f2){var _0x10d8ef=fs['readFileSync'](path[_0x01af('0x7d')](config[_0x01af('0x84')],'server/files/chat/iframe.js'),_0x01af('0xda'));var _0x307742={'remote':_0x19fec4[_0x01af('0x101')],'query':querystring[_0x01af('0x2a')](_[_0x01af('0x53')](_0x19fec4[_0x01af('0x5e')]({'plain':!![]}),{'customerIp':_0x853990[_0x01af('0x8f')][_0x01af('0xab')]||_0x853990['headers']['x-real-ip']||_0x853990[_0x01af('0x102')][_0x01af('0x103')]||_0x853990['ip'],'referer':_0x853990['headers']['referer'],'openedInteractions':_0x2ecb66,'maxInteractions':_0x1e67b9,'virtual':_0x48fbb9[_0x01af('0x104')],'online':_0x3ef1f2,'custom':_0x48fbb9}))[_0x01af('0x105')](/'/g,'\x5c\x27')};_0x3f0c28[_0x01af('0x3e')](ejs['render'](Mustache[_0x01af('0x106')](_0x10d8ef,_0x307742),{'proactiveActions':_0x2468e4,'alignment':_0x19fec4[_0x01af('0x107')],'verticalAlignment':_0x19fec4['verticalAlignment'],'div_color':_0x19fec4[_0x01af('0xf2')],'text_color':_0x19fec4[_0x01af('0x108')]}));})['catch'](handleError(_0x3f0c28,null));};exports[_0x01af('0x109')]=function(_0x34f311,_0x36ed1f,_0x32efd0){return db['ChatWebsite'][_0x01af('0x73')]({'where':{'id':_0x34f311['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x36ed1f,null))[_0x01af('0x25')](function(_0x256018){if(_0x256018){return db[_0x01af('0x10a')][_0x01af('0x10b')](function(_0x531b1f){return db[_0x01af('0xa1')][_0x01af('0x3b')]({'where':{'ChatWebsiteId':_0x34f311[_0x01af('0x65')]['id']},'transaction':_0x531b1f})[_0x01af('0x25')](function(_0x70d537){var _0x3cf03b=_[_0x01af('0x40')](_0x34f311[_0x01af('0x5c')],function(_0x345bd4){_0x345bd4[_0x01af('0x68')]=_0x34f311['params']['id'];return _0x345bd4;});return db[_0x01af('0xa1')]['bulkCreate'](_0x3cf03b,{'transaction':_0x531b1f});});})[_0x01af('0x25')](function(){return db[_0x01af('0xa1')][_0x01af('0x10c')]({'where':{'ChatWebsiteId':_0x34f311['params']['id']},'order':_0x01af('0xa6')});});}})['then'](respondWithResult(_0x36ed1f,null))['catch'](handleError(_0x36ed1f,null));};exports[_0x01af('0x10d')]=function(_0x45a515,_0x21f05b,_0x2b2314){var _0x42011e={};var _0x4947a2={};var _0x163ae7;var _0x4505d2;return db[_0x01af('0x55')]['findOne']({'where':{'id':_0x45a515[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x21f05b,null))['then'](function(_0x13179b){if(_0x13179b){_0x163ae7=_0x13179b;_0x4947a2[_0x01af('0x45')]=_[_0x01af('0x47')](db[_0x01af('0xa1')][_0x01af('0x41')]);_0x4947a2[_0x01af('0x46')]=_[_0x01af('0x47')](_0x45a515[_0x01af('0x46')]);_0x4947a2[_0x01af('0x48')]=_[_0x01af('0x49')](_0x4947a2[_0x01af('0x45')],_0x4947a2[_0x01af('0x46')]);_0x42011e[_0x01af('0x4b')]=_[_0x01af('0x49')](_0x4947a2['model'],qs['fields'](_0x45a515[_0x01af('0x46')][_0x01af('0x4a')]));_0x42011e[_0x01af('0x4b')]=_0x42011e[_0x01af('0x4b')][_0x01af('0x4c')]?_0x42011e['attributes']:_0x4947a2[_0x01af('0x45')];_0x42011e['order']=qs[_0x01af('0x4e')](_0x45a515['query']['sort']);_0x42011e[_0x01af('0x51')]=qs[_0x01af('0x48')](_['pick'](_0x45a515[_0x01af('0x46')],_0x4947a2[_0x01af('0x48')]));if(_0x45a515[_0x01af('0x46')][_0x01af('0x50')]){_0x42011e[_0x01af('0x51')]=_['merge'](_0x42011e[_0x01af('0x51')],{'$or':_[_0x01af('0x40')](_0x42011e[_0x01af('0x4b')],function(_0x5423d4){var _0x4ce26d={};_0x4ce26d[_0x5423d4]={'$like':'%'+_0x45a515[_0x01af('0x46')][_0x01af('0x50')]+'%'};return _0x4ce26d;})});}_0x42011e=_[_0x01af('0x53')]({},_0x42011e,_0x45a515[_0x01af('0x54')]);return _0x163ae7[_0x01af('0x10d')](_0x42011e);}})[_0x01af('0x25')](function(_0x9008b2){if(_0x9008b2){_0x4505d2=_0x9008b2['length'];if(!_0x45a515[_0x01af('0x46')]['hasOwnProperty'](_0x01af('0x74'))){_0x42011e[_0x01af('0x36')]=qs['limit'](_0x45a515[_0x01af('0x46')][_0x01af('0x36')]);_0x42011e[_0x01af('0x35')]=qs['offset'](_0x45a515[_0x01af('0x46')][_0x01af('0x35')]);}return _0x163ae7['getApplications'](_0x42011e);}})[_0x01af('0x25')](function(_0x1914e0){if(_0x1914e0){return _0x1914e0?{'count':_0x4505d2,'rows':_0x1914e0}:null;}})[_0x01af('0x25')](respondWithResult(_0x21f05b,null))['catch'](handleError(_0x21f05b,null));};exports[_0x01af('0x10e')]=function(_0x468e03,_0x5e4799,_0x3dfd57){return db[_0x01af('0x10f')][_0x01af('0x62')]({'where':{'id':_0x468e03['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x5e4799,null))[_0x01af('0x25')](function(_0x3c6149){if(_0x3c6149){return _0x3c6149[_0x01af('0x10e')](_0x468e03['body'][_0x01af('0x6f')],_['omit'](_0x468e03[_0x01af('0x5c')],[_0x01af('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x5e4799,null))['catch'](handleError(_0x5e4799,null));};exports[_0x01af('0x110')]=function(_0xa6c699,_0x2032db,_0x46b8fd){var _0x3b984a={};var _0x17468b={};var _0x278bac;var _0x27b808;return db[_0x01af('0x55')]['findOne']({'where':{'id':_0xa6c699[_0x01af('0x65')]['id']}})['then'](handleEntityNotFound(_0x2032db,null))[_0x01af('0x25')](function(_0x4f3434){if(_0x4f3434){_0x278bac=_0x4f3434;_0x17468b['model']=_[_0x01af('0x47')](db[_0x01af('0x111')][_0x01af('0x41')]);_0x17468b[_0x01af('0x46')]=_[_0x01af('0x47')](_0xa6c699['query']);_0x17468b[_0x01af('0x48')]=_[_0x01af('0x49')](_0x17468b[_0x01af('0x45')],_0x17468b[_0x01af('0x46')]);_0x3b984a['attributes']=_[_0x01af('0x49')](_0x17468b[_0x01af('0x45')],qs['fields'](_0xa6c699[_0x01af('0x46')][_0x01af('0x4a')]));_0x3b984a[_0x01af('0x4b')]=_0x3b984a[_0x01af('0x4b')][_0x01af('0x4c')]?_0x3b984a['attributes']:_0x17468b['model'];_0x3b984a['order']=qs[_0x01af('0x4e')](_0xa6c699['query']['sort']);_0x3b984a[_0x01af('0x51')]=qs[_0x01af('0x48')](_[_0x01af('0x4f')](_0xa6c699[_0x01af('0x46')],_0x17468b[_0x01af('0x48')]));if(_0xa6c699[_0x01af('0x46')]['filter']){_0x3b984a[_0x01af('0x51')]=_[_0x01af('0x53')](_0x3b984a[_0x01af('0x51')],{'$or':_['map'](_0x3b984a[_0x01af('0x4b')],function(_0x1d609a){var _0x24c8cb={};_0x24c8cb[_0x1d609a]={'$like':'%'+_0xa6c699['query'][_0x01af('0x50')]+'%'};return _0x24c8cb;})});}_0x3b984a=_[_0x01af('0x53')]({},_0x3b984a,_0xa6c699['options']);return _0x278bac[_0x01af('0x110')](_0x3b984a);}})['then'](function(_0x7bfc79){if(_0x7bfc79){_0x27b808=_0x7bfc79['length'];if(!_0xa6c699[_0x01af('0x46')][_0x01af('0x6b')]('nolimit')){_0x3b984a[_0x01af('0x36')]=qs[_0x01af('0x36')](_0xa6c699[_0x01af('0x46')]['limit']);_0x3b984a[_0x01af('0x35')]=qs[_0x01af('0x35')](_0xa6c699[_0x01af('0x46')][_0x01af('0x35')]);}return _0x278bac[_0x01af('0x110')](_0x3b984a);}})[_0x01af('0x25')](function(_0xe24f0b){if(_0xe24f0b){return _0xe24f0b?{'count':_0x27b808,'rows':_0xe24f0b}:null;}})['then'](respondWithResult(_0x2032db,null))['catch'](handleError(_0x2032db,null));};exports[_0x01af('0x112')]=function(_0x324701,_0x4ff0c1,_0x5588ac){var _0x120923=_0x324701[_0x01af('0x46')][_0x01af('0x113')]===_0x01af('0x114')?'offlineForm':'onlineForm';return db[_0x01af('0x55')][_0x01af('0x62')]({'attributes':['id',_0x120923],'where':{'id':_0x324701['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x4ff0c1,null))[_0x01af('0x25')](function(_0x1b9d74){if(_0x1b9d74){var _0x5a008c=_0x1b9d74[_0x120923];var _0x5281d5=_0x5a008c&&_0x5a008c[_0x01af('0x115')]?_0x5a008c[_0x01af('0x115')]:[];_0x4ff0c1[_0x01af('0x3e')]({'fromKey':_[_0x01af('0x82')](_0x5a008c[_0x01af('0x116')])?undefined:_0x5a008c[_0x01af('0x116')],'count':_0x5281d5['length'],'rows':_0x5281d5});}})[_0x01af('0x30')](handleError(_0x4ff0c1,null));};exports[_0x01af('0x117')]=function(_0x4e3533,_0x1adb31,_0x3fcc79){var _0x23fe80={'raw':![],'where':{}};var _0x4e45f1={};var _0x504276={'count':0x0,'rows':[]};return db[_0x01af('0x55')][_0x01af('0x73')]({'where':{'id':_0x4e3533['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x1adb31,null))['then'](function(_0x2d1305){if(_0x2d1305){_0x4e45f1[_0x01af('0x45')]=_['keys'](db[_0x01af('0xdd')][_0x01af('0x41')]);_0x4e45f1[_0x01af('0x46')]=_['keys'](_0x4e3533[_0x01af('0x46')]);_0x4e45f1[_0x01af('0x48')]=_[_0x01af('0x49')](_0x4e45f1['model'],_0x4e45f1[_0x01af('0x46')]);_0x23fe80[_0x01af('0x4b')]=_['intersection'](_0x4e45f1[_0x01af('0x45')],qs[_0x01af('0x4a')](_0x4e3533[_0x01af('0x46')][_0x01af('0x4a')]));_0x23fe80['attributes']=_0x23fe80[_0x01af('0x4b')][_0x01af('0x4c')]?_0x23fe80[_0x01af('0x4b')]:_0x4e45f1[_0x01af('0x45')];if(!_0x4e3533[_0x01af('0x46')][_0x01af('0x6b')](_0x01af('0x74'))){_0x23fe80[_0x01af('0x36')]=qs[_0x01af('0x36')](_0x4e3533[_0x01af('0x46')]['limit']);_0x23fe80[_0x01af('0x35')]=qs['offset'](_0x4e3533[_0x01af('0x46')][_0x01af('0x35')]);}_0x23fe80[_0x01af('0x4d')]=qs[_0x01af('0x4e')](_0x4e3533['query'][_0x01af('0x4e')]);_0x23fe80[_0x01af('0x51')]=qs[_0x01af('0x48')](_[_0x01af('0x4f')](_0x4e3533['query'],_0x4e45f1[_0x01af('0x48')]));_0x23fe80[_0x01af('0x51')]['ChatWebsiteId']=_0x2d1305['id'];if(_0x4e3533[_0x01af('0x46')][_0x01af('0x50')]){_0x23fe80[_0x01af('0x51')]=_[_0x01af('0x53')](_0x23fe80[_0x01af('0x51')],{'$or':_[_0x01af('0x40')](_0x23fe80[_0x01af('0x4b')],function(_0x10c569){var _0x226ada={};_0x226ada[_0x10c569]={'$like':'%'+_0x4e3533['query'][_0x01af('0x50')]+'%'};return _0x226ada;})});}_0x23fe80=_['merge']({},_0x23fe80,_0x4e3533[_0x01af('0x54')]);return db[_0x01af('0xdd')]['count']({'where':_0x23fe80[_0x01af('0x51')]})[_0x01af('0x25')](function(_0x1da802){_0x504276['count']=_0x1da802;if(_0x4e3533[_0x01af('0x46')][_0x01af('0x6c')]){_0x23fe80[_0x01af('0x6d')]=[{'all':!![]}];}else{_0x23fe80[_0x01af('0x6d')]=[{'model':db[_0x01af('0x92')],'as':_0x01af('0xed'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x23fe80);})['then'](function(_0x282c4f){_0x504276[_0x01af('0x57')]=_0x282c4f;return _0x504276;});}})[_0x01af('0x25')](respondWithFilteredResult(_0x1adb31,_0x23fe80))[_0x01af('0x30')](handleError(_0x1adb31,null));};exports[_0x01af('0x118')]=function(_0x5bfc73,_0xc01e13,_0x3aef8e){return db[_0x01af('0x55')]['find']({'where':{'id':_0x5bfc73[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0xc01e13,null))['then'](function(_0x5b1ac6){if(_0x5b1ac6){return _0x5b1ac6[_0x01af('0x118')](_0x5bfc73['body'][_0x01af('0x6f')],_['omit'](_0x5bfc73[_0x01af('0x5c')],[_0x01af('0x6f'),'id'])||{})['spread'](function(_0x5b7ea0){for(var _0x400034=0x0;_0x400034<_0x5bfc73[_0x01af('0x5c')][_0x01af('0x6f')][_0x01af('0x4c')];_0x400034+=0x1){socket[_0x01af('0x119')]('userChatWebsite:save',{'UserId':_0x5bfc73[_0x01af('0x5c')][_0x01af('0x6f')][_0x400034],'ChatWebsiteId':_0x5bfc73['params']['id']});}return _0x5b7ea0;});}})[_0x01af('0x25')](respondWithResult(_0xc01e13,null))['catch'](handleError(_0xc01e13,null));};exports[_0x01af('0x11a')]=function(_0x108b45,_0x504d26,_0x225ca1){return db['ChatWebsite'][_0x01af('0x62')]({'where':{'id':_0x108b45[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x504d26,null))[_0x01af('0x25')](function(_0x35ccc4){if(_0x35ccc4){return _0x35ccc4[_0x01af('0x11a')](_0x108b45[_0x01af('0x46')]['ids'])['then'](function(){if(_['isArray'](_0x108b45[_0x01af('0x46')][_0x01af('0x6f')])){for(var _0x4f9c2b=0x0;_0x4f9c2b<_0x108b45[_0x01af('0x46')][_0x01af('0x6f')][_0x01af('0x4c')];_0x4f9c2b+=0x1){socket[_0x01af('0x119')](_0x01af('0x11b'),{'UserId':Number(_0x108b45[_0x01af('0x46')][_0x01af('0x6f')][_0x4f9c2b]),'ChatWebsiteId':Number(_0x108b45[_0x01af('0x65')]['id'])});}}else{socket[_0x01af('0x119')](_0x01af('0x11b'),{'UserId':Number(_0x108b45[_0x01af('0x46')][_0x01af('0x6f')]),'ChatWebsiteId':Number(_0x108b45['params']['id'])});}});}})[_0x01af('0x25')](respondWithStatusCode(_0x504d26,null))['catch'](handleError(_0x504d26,null));};exports[_0x01af('0x11c')]=function(_0x2ecd5c,_0x38f4c4,_0x3ce59a){var _0x260b32={};var _0x4f4580={};var _0x5814bc;var _0x3ba123;return db[_0x01af('0x55')][_0x01af('0x73')]({'where':{'id':_0x2ecd5c['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x38f4c4,null))[_0x01af('0x25')](function(_0x4d879b){if(_0x4d879b){_0x5814bc=_0x4d879b;_0x4f4580[_0x01af('0x45')]=_[_0x01af('0x47')](db[_0x01af('0xc9')][_0x01af('0x41')]);_0x4f4580[_0x01af('0x46')]=_['keys'](_0x2ecd5c[_0x01af('0x46')]);_0x4f4580[_0x01af('0x48')]=_['intersection'](_0x4f4580['model'],_0x4f4580[_0x01af('0x46')]);_0x260b32[_0x01af('0x4b')]=_[_0x01af('0x49')](_0x4f4580['model'],qs[_0x01af('0x4a')](_0x2ecd5c[_0x01af('0x46')]['fields']));_0x260b32[_0x01af('0x4b')]=_0x260b32[_0x01af('0x4b')][_0x01af('0x4c')]?_0x260b32[_0x01af('0x4b')]:_0x4f4580[_0x01af('0x45')];_0x260b32[_0x01af('0x4d')]=qs[_0x01af('0x4e')](_0x2ecd5c['query'][_0x01af('0x4e')]);_0x260b32[_0x01af('0x51')]=qs[_0x01af('0x48')](_[_0x01af('0x4f')](_0x2ecd5c[_0x01af('0x46')],_0x4f4580[_0x01af('0x48')]));if(_0x2ecd5c['query'][_0x01af('0x50')]){_0x260b32[_0x01af('0x51')]=_[_0x01af('0x53')](_0x260b32[_0x01af('0x51')],{'$or':_[_0x01af('0x40')](_0x260b32[_0x01af('0x4b')],function(_0xc2417a){var _0x2167b7={};_0x2167b7[_0xc2417a]={'$like':'%'+_0x2ecd5c[_0x01af('0x46')][_0x01af('0x50')]+'%'};return _0x2167b7;})});}_0x260b32=_[_0x01af('0x53')]({},_0x260b32,_0x2ecd5c['options']);return _0x5814bc[_0x01af('0x11c')](_0x260b32);}})['then'](function(_0x488881){if(_0x488881){_0x3ba123=_0x488881['length'];if(!_0x2ecd5c[_0x01af('0x46')][_0x01af('0x6b')](_0x01af('0x74'))){_0x260b32[_0x01af('0x36')]=qs[_0x01af('0x36')](_0x2ecd5c[_0x01af('0x46')][_0x01af('0x36')]);_0x260b32[_0x01af('0x35')]=qs[_0x01af('0x35')](_0x2ecd5c[_0x01af('0x46')][_0x01af('0x35')]);}return _0x5814bc[_0x01af('0x11c')](_0x260b32);}})[_0x01af('0x25')](function(_0x239874){if(_0x239874){return _0x239874?{'count':_0x3ba123,'rows':_0x239874}:null;}})['then'](respondWithResult(_0x38f4c4,null))[_0x01af('0x30')](handleError(_0x38f4c4,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 7ba2875..0852a0b 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 _0x5859=['save','update','remove','emit','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x4346e0,_0x103018){var _0x20cfac=function(_0x17394c){while(--_0x17394c){_0x4346e0['push'](_0x4346e0['shift']());}};_0x20cfac(++_0x103018);}(_0x5859,0xc4));var _0x9585=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5859[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x9585('0x0'));var ChatWebsite=require(_0x9585('0x1'))['db'][_0x9585('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9585('0x3')](0x0);var events={'afterCreate':_0x9585('0x4'),'afterUpdate':_0x9585('0x5'),'afterDestroy':_0x9585('0x6')};function emitEvent(_0x231c81){return function(_0x13ecbf,_0x160051,_0x150a6b){ChatWebsiteEvents[_0x9585('0x7')](_0x231c81+':'+_0x13ecbf['id'],_0x13ecbf);ChatWebsiteEvents[_0x9585('0x7')](_0x231c81,_0x13ecbf);_0x150a6b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9585('0x8')](e,emitEvent(event));}}module[_0x9585('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x86dd=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x25cf10,_0x59ae67){var _0xe1f1d9=function(_0x4a9274){while(--_0x4a9274){_0x25cf10['push'](_0x25cf10['shift']());}};_0xe1f1d9(++_0x59ae67);}(_0x86dd,0x1ee));var _0xd86d=function(_0x486406,_0x2d3158){_0x486406=_0x486406-0x0;var _0x365d5e=_0x86dd[_0x486406];return _0x365d5e;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xd86d('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd86d('0x1')](0x0);var events={'afterCreate':_0xd86d('0x2'),'afterUpdate':_0xd86d('0x3'),'afterDestroy':_0xd86d('0x4')};function emitEvent(_0x17237d){return function(_0x30a31c,_0x2e82a9,_0x240531){ChatWebsiteEvents[_0xd86d('0x5')](_0x17237d+':'+_0x30a31c['id'],_0x30a31c);ChatWebsiteEvents[_0xd86d('0x5')](_0x17237d,_0x30a31c);_0x240531(null);};}for(var e in events){if(events[_0xd86d('0x6')](e)){var event=events[e];ChatWebsite[_0xd86d('0x7')](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 22641af..e283590 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 _0xccdc=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','moment','bluebird'];(function(_0x396467,_0x2f6d45){var _0x50e2a6=function(_0x4cf9f1){while(--_0x4cf9f1){_0x396467['push'](_0x396467['shift']());}};_0x50e2a6(++_0x2f6d45);}(_0xccdc,0x1c4));var _0xcccd=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xccdc[_0x4ae625];return _0x31accf;};'use strict';var _=require(_0xcccd('0x0'));var util=require(_0xcccd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcccd('0x2'));var BPromise=require(_0xcccd('0x3'));var rp=require(_0xcccd('0x4'));var fs=require('fs');var path=require(_0xcccd('0x5'));var rimraf=require(_0xcccd('0x6'));var config=require(_0xcccd('0x7'));var attributes=require(_0xcccd('0x8'));module[_0xcccd('0x9')]=function(_0x2da46a,_0x18365a){return _0x2da46a['define'](_0xcccd('0xa'),attributes,{'tableName':_0xcccd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','api','bluebird'];(function(_0xaa790c,_0x1e6c76){var _0x36555e=function(_0xb0dfbe){while(--_0xb0dfbe){_0xaa790c['push'](_0xaa790c['shift']());}};_0x36555e(++_0x1e6c76);}(_0x9bde,0xe1));var _0xe9bd=function(_0x47aebf,_0x507238){_0x47aebf=_0x47aebf-0x0;var _0x3df5e2=_0x9bde[_0x47aebf];return _0x3df5e2;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 65bda91..1c09ca1 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 _0xef0f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x481ae3,_0x504e3c){var _0x457564=function(_0x294359){while(--_0x294359){_0x481ae3['push'](_0x481ae3['shift']());}};_0x457564(++_0x504e3c);}(_0xef0f,0x168));var _0xfef0=function(_0x16d39b,_0x100769){_0x16d39b=_0x16d39b-0x0;var _0x1bf6da=_0xef0f[_0x16d39b];return _0x1bf6da;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});config[_0xfef0('0xb')]=_[_0xfef0('0xc')](config['redis'],{'host':_0xfef0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfef0('0xb')]));require(_0xfef0('0xe'))[_0xfef0('0xf')](socket);function respondWithRpcPromise(_0x2d42dc,_0x334e74,_0x402dff){return new BPromise(function(_0xc177db,_0x4bd6f2){return client[_0xfef0('0x10')](_0x2d42dc,_0x402dff)[_0xfef0('0x11')](function(_0x410234){logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,_0xfef0('0x14'));logger['debug'](_0xfef0('0x15'),_0x334e74,_0xfef0('0x14'),JSON[_0xfef0('0x16')](_0x410234));if(_0x410234[_0xfef0('0x17')]){if(_0x410234[_0xfef0('0x17')][_0xfef0('0x18')]===0x1f4){logger[_0xfef0('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x334e74,_0x410234[_0xfef0('0x17')]['message']);return _0x4bd6f2(_0x410234['error']['message']);}logger[_0xfef0('0x17')](_0xfef0('0x13'),_0x334e74,_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);return _0xc177db(_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);}else{logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,'request\x20sent');_0xc177db(_0x410234[_0xfef0('0x1a')][_0xfef0('0x19')]);}})[_0xfef0('0x1b')](function(_0x39f9d3){logger[_0xfef0('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x334e74,_0x39f9d3);_0x4bd6f2(_0x39f9d3);});});} \ No newline at end of file +var _0xdb28=['then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request'];(function(_0x3828cb,_0x392c98){var _0x351acf=function(_0x2718da){while(--_0x2718da){_0x3828cb['push'](_0x3828cb['shift']());}};_0x351acf(++_0x392c98);}(_0xdb28,0x106));var _0x8db2=function(_0x4e2267,_0x5e81eb){_0x4e2267=_0x4e2267-0x0;var _0x11c4e2=_0xdb28[_0x4e2267];return _0x11c4e2;};'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});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 56c4490..f121aaa 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(_0x4b48e5,_0xc3c425){var _0x210b17=function(_0x43ccc1){while(--_0x43ccc1){_0x4b48e5['push'](_0x4b48e5['shift']());}};_0x210b17(++_0xc3c425);}(_0x5f2f,0x73));var _0xf5f2=function(_0x389c96,_0x2eb57c){_0x389c96=_0x389c96-0x0;var _0x169844=_0x5f2f[_0x389c96];return _0x169844;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x60878f,_0x1166d3){var _0x1fbefb=function(_0x375d8c){while(--_0x375d8c){_0x60878f['push'](_0x60878f['shift']());}};_0x1fbefb(++_0x1166d3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ded05,_0x4e71a5){_0x4ded05=_0x4ded05-0x0;var _0x52810d=_0x5f2f[_0x4ded05];return _0x52810d;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index dbe1519..7703d18 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 _0x9fc2=['./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addAnswer','join','root','%s-%s','now','originalname','/:id/logo','file','addLogo','server/files/images/avatars/','format','single','addAvatar','addCustomerAvatar','diskStorage','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','/:id/offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x9fc2,0x1a1));var _0x29fc=function(_0xff5df6,_0x514e73){_0xff5df6=_0xff5df6-0x0;var _0x2634bb=_0x9fc2[_0xff5df6];return _0x2634bb;};'use strict';var multer=require(_0x29fc('0x0'));var util=require(_0x29fc('0x1'));var path=require(_0x29fc('0x2'));var timeout=require(_0x29fc('0x3'));var express=require(_0x29fc('0x4'));var router=express[_0x29fc('0x5')]();var auth=require(_0x29fc('0x6'));var interaction=require(_0x29fc('0x7'));var config=require(_0x29fc('0x8'));var controller=require(_0x29fc('0x9'));router[_0x29fc('0xa')]('/',auth[_0x29fc('0xb')](),controller[_0x29fc('0xc')]);router['get'](_0x29fc('0xd'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x29fc('0xe'),auth[_0x29fc('0xb')](),controller[_0x29fc('0xf')]);router[_0x29fc('0xa')](_0x29fc('0x10'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x11')]);router[_0x29fc('0xa')](_0x29fc('0x12'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x13')]);router[_0x29fc('0xa')]('/:id/logo',controller[_0x29fc('0x14')]);router[_0x29fc('0xa')](_0x29fc('0x15'),controller[_0x29fc('0x16')]);router[_0x29fc('0xa')](_0x29fc('0x17'),controller[_0x29fc('0x18')]);router[_0x29fc('0xa')]('/:id/system_avatar',controller[_0x29fc('0x19')]);router[_0x29fc('0xa')]('/:id/interactions',auth[_0x29fc('0xb')](),controller[_0x29fc('0x1a')]);router[_0x29fc('0xa')](_0x29fc('0x1b'),controller[_0x29fc('0x1c')]);router['get'](_0x29fc('0x1d'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x1e')]);router[_0x29fc('0xa')](_0x29fc('0x1f'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x20')]);router['get'](_0x29fc('0x21'),controller['getFields']);router['get'](_0x29fc('0x22'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x23')]);router['get'](_0x29fc('0x24'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x25')]);router['post']('/',auth[_0x29fc('0xb')](),controller['create']);router[_0x29fc('0x26')](_0x29fc('0x10'),auth[_0x29fc('0xb')](),controller['addDisposition']);router[_0x29fc('0x26')](_0x29fc('0x12'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x423073,_0x26c463,_0x16c772){_0x16c772(null,path[_0x29fc('0x28')](config[_0x29fc('0x29')],'server/files/images/logos/'));},'filename':function(_0x1663ae,_0x86a35a,_0x13a92b){_0x13a92b(null,util['format'](_0x29fc('0x2a'),Date[_0x29fc('0x2b')](),_0x86a35a[_0x29fc('0x2c')]));}})});router[_0x29fc('0x26')](_0x29fc('0x2d'),upload['single'](_0x29fc('0x2e')),controller[_0x29fc('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4cf01d,_0x24f4d5,_0x892c90){_0x892c90(null,path['join'](config[_0x29fc('0x29')],_0x29fc('0x30')));},'filename':function(_0x3ccddd,_0x17717a,_0xc9aa9c){_0xc9aa9c(null,util[_0x29fc('0x31')](_0x29fc('0x2a'),Date[_0x29fc('0x2b')](),_0x17717a[_0x29fc('0x2c')]));}})});router[_0x29fc('0x26')](_0x29fc('0x15'),upload[_0x29fc('0x32')](_0x29fc('0x2e')),controller[_0x29fc('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5588e8,_0x264d00,_0x5c33cf){_0x5c33cf(null,path[_0x29fc('0x28')](config[_0x29fc('0x29')],'server/files/images/avatars/'));},'filename':function(_0x3ff100,_0x258742,_0x1089e6){_0x1089e6(null,util[_0x29fc('0x31')](_0x29fc('0x2a'),Date[_0x29fc('0x2b')](),_0x258742[_0x29fc('0x2c')]));}})});router['post'](_0x29fc('0x17'),upload[_0x29fc('0x32')](_0x29fc('0x2e')),controller[_0x29fc('0x34')]);var upload=multer({'storage':multer[_0x29fc('0x35')]({'destination':function(_0xbcac40,_0x346d61,_0x19f670){_0x19f670(null,path[_0x29fc('0x28')](config[_0x29fc('0x29')],'server/files/images/avatars/'));},'filename':function(_0x592bfe,_0xc87645,_0xfb628a){_0xfb628a(null,util['format'](_0x29fc('0x2a'),Date[_0x29fc('0x2b')](),_0xc87645[_0x29fc('0x2c')]));}})});router['post'](_0x29fc('0x36'),upload[_0x29fc('0x32')](_0x29fc('0x2e')),controller[_0x29fc('0x37')]);router[_0x29fc('0x26')](_0x29fc('0x38'),controller[_0x29fc('0x39')]);router[_0x29fc('0x26')](_0x29fc('0x3a'),controller['offline']);router[_0x29fc('0x26')](_0x29fc('0x3b'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x3c')]);router[_0x29fc('0x26')]('/:id/applications',auth[_0x29fc('0xb')](),controller[_0x29fc('0x3d')]);router[_0x29fc('0x26')](_0x29fc('0x1f'),auth['isAuthenticated'](),controller[_0x29fc('0x3e')]);router[_0x29fc('0x26')]('/:id/users',auth['isAuthenticated'](),controller[_0x29fc('0x3f')]);router[_0x29fc('0x40')](_0x29fc('0xe'),auth['isAuthenticated'](),controller[_0x29fc('0x41')]);router['delete'](_0x29fc('0xe'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x42')]);router[_0x29fc('0x43')]('/:id/dispositions',auth[_0x29fc('0xb')](),controller[_0x29fc('0x44')]);router[_0x29fc('0x43')](_0x29fc('0x12'),auth['isAuthenticated'](),controller[_0x29fc('0x45')]);router[_0x29fc('0x43')](_0x29fc('0x24'),auth[_0x29fc('0xb')](),controller['removeAgents']);module[_0x29fc('0x46')]=router; \ No newline at end of file +var _0xc713=['addLogo','server/files/images/avatars/','originalname','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/offline','offline','addInteraction','/:id/proactive_actions','addProactiveActions','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','getFields','/:id/offline_messages','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','single','file'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0xc713,0x19a));var _0x3c71=function(_0x3e5ec3,_0x76e378){_0x3e5ec3=_0x3e5ec3-0x0;var _0x425633=_0xc713[_0x3e5ec3];return _0x425633;};'use strict';var multer=require('multer');var util=require(_0x3c71('0x0'));var path=require(_0x3c71('0x1'));var timeout=require(_0x3c71('0x2'));var express=require(_0x3c71('0x3'));var router=express[_0x3c71('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3c71('0x5'));var config=require(_0x3c71('0x6'));var controller=require('./chatWebsite.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3c71('0x7')]);router[_0x3c71('0x8')](_0x3c71('0x9'),auth[_0x3c71('0xa')](),controller[_0x3c71('0xb')]);router[_0x3c71('0x8')]('/:id',auth[_0x3c71('0xa')](),controller[_0x3c71('0xc')]);router[_0x3c71('0x8')](_0x3c71('0xd'),auth['isAuthenticated'](),controller[_0x3c71('0xe')]);router[_0x3c71('0x8')]('/:id/canned_answers',auth[_0x3c71('0xa')](),controller[_0x3c71('0xf')]);router['get'](_0x3c71('0x10'),controller[_0x3c71('0x11')]);router[_0x3c71('0x8')](_0x3c71('0x12'),controller[_0x3c71('0x13')]);router['get'](_0x3c71('0x14'),controller['getCustomerAvatar']);router[_0x3c71('0x8')](_0x3c71('0x15'),controller['getSystemAvatar']);router[_0x3c71('0x8')](_0x3c71('0x16'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x3c71('0x8')](_0x3c71('0x17'),controller[_0x3c71('0x18')]);router[_0x3c71('0x8')](_0x3c71('0x19'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x1a')]);router[_0x3c71('0x8')]('/:id/proactive_actions',auth[_0x3c71('0xa')](),controller['getProactiveActions']);router[_0x3c71('0x8')]('/:id/fields',controller[_0x3c71('0x1b')]);router[_0x3c71('0x8')](_0x3c71('0x1c'),auth[_0x3c71('0xa')](),controller['getOfflineMessages']);router[_0x3c71('0x8')](_0x3c71('0x1d'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x1e')]);router['post']('/',auth[_0x3c71('0xa')](),controller[_0x3c71('0x1f')]);router[_0x3c71('0x20')](_0x3c71('0xd'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x21')]);router[_0x3c71('0x20')](_0x3c71('0x22'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x23')]);var upload=multer({'storage':multer[_0x3c71('0x24')]({'destination':function(_0x4fb50b,_0x51eb07,_0x4036bc){_0x4036bc(null,path[_0x3c71('0x25')](config[_0x3c71('0x26')],_0x3c71('0x27')));},'filename':function(_0x2fe8a4,_0x32b480,_0x3df529){_0x3df529(null,util[_0x3c71('0x28')](_0x3c71('0x29'),Date[_0x3c71('0x2a')](),_0x32b480['originalname']));}})});router[_0x3c71('0x20')](_0x3c71('0x10'),upload[_0x3c71('0x2b')](_0x3c71('0x2c')),controller[_0x3c71('0x2d')]);var upload=multer({'storage':multer[_0x3c71('0x24')]({'destination':function(_0xdc756a,_0x1dbd33,_0x5bb63f){_0x5bb63f(null,path['join'](config['root'],_0x3c71('0x2e')));},'filename':function(_0x146ee2,_0x42159b,_0x40e19e){_0x40e19e(null,util[_0x3c71('0x28')]('%s-%s',Date[_0x3c71('0x2a')](),_0x42159b[_0x3c71('0x2f')]));}})});router[_0x3c71('0x20')]('/:id/avatar',upload[_0x3c71('0x2b')]('file'),controller[_0x3c71('0x30')]);var upload=multer({'storage':multer[_0x3c71('0x24')]({'destination':function(_0x2657c1,_0x3b17ae,_0x3fb530){_0x3fb530(null,path[_0x3c71('0x25')](config[_0x3c71('0x26')],_0x3c71('0x2e')));},'filename':function(_0x37f0e2,_0xa2b33c,_0x527666){_0x527666(null,util['format'](_0x3c71('0x29'),Date[_0x3c71('0x2a')](),_0xa2b33c[_0x3c71('0x2f')]));}})});router['post'](_0x3c71('0x14'),upload[_0x3c71('0x2b')](_0x3c71('0x2c')),controller[_0x3c71('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19d1d4,_0xfb6a4b,_0x142eab){_0x142eab(null,path['join'](config[_0x3c71('0x26')],_0x3c71('0x2e')));},'filename':function(_0x20fad7,_0x345890,_0xab18f){_0xab18f(null,util[_0x3c71('0x28')](_0x3c71('0x29'),Date[_0x3c71('0x2a')](),_0x345890[_0x3c71('0x2f')]));}})});router[_0x3c71('0x20')]('/:id/system_avatar',upload[_0x3c71('0x2b')](_0x3c71('0x2c')),controller[_0x3c71('0x32')]);router[_0x3c71('0x20')]('/:id/notify',controller['notify']);router[_0x3c71('0x20')](_0x3c71('0x33'),controller[_0x3c71('0x34')]);router[_0x3c71('0x20')]('/:id/interactions',auth[_0x3c71('0xa')](),controller[_0x3c71('0x35')]);router[_0x3c71('0x20')](_0x3c71('0x19'),auth[_0x3c71('0xa')](),controller['addApplications']);router[_0x3c71('0x20')](_0x3c71('0x36'),auth['isAuthenticated'](),controller[_0x3c71('0x37')]);router[_0x3c71('0x20')](_0x3c71('0x1d'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x38')]);router[_0x3c71('0x39')](_0x3c71('0x3a'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x3b')]);router[_0x3c71('0x3c')]('/:id',auth[_0x3c71('0xa')](),controller['destroy']);router[_0x3c71('0x3c')]('/:id/dispositions',auth[_0x3c71('0xa')](),controller[_0x3c71('0x3d')]);router[_0x3c71('0x3c')](_0x3c71('0x22'),auth['isAuthenticated'](),controller[_0x3c71('0x3e')]);router[_0x3c71('0x3c')](_0x3c71('0x1d'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x3f')]);module[_0x3c71('0x40')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c05f2cd..783a487 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 _0x0958=['exports','STRING','AmazonAWS','Google','sequelize'];(function(_0x4c378e,_0x286afb){var _0xf41ce7=function(_0x48d22e){while(--_0x48d22e){_0x4c378e['push'](_0x4c378e['shift']());}};_0xf41ce7(++_0x286afb);}(_0x0958,0x7c));var _0x8095=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0958[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8095('0x0'));module[_0x8095('0x1')]={'name':{'type':Sequelize[_0x8095('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x8095('0x3'),_0x8095('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc7b3=['ENUM','AmazonAWS','Google','STRING','sequelize','exports'];(function(_0x18bb69,_0x11e204){var _0x14a63b=function(_0x47160e){while(--_0x47160e){_0x18bb69['push'](_0x18bb69['shift']());}};_0x14a63b(++_0x11e204);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc7b3[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0x3c7b('0x0'));module[_0x3c7b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3c7b('0x2')](_0x3c7b('0x3'),_0x3c7b('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3c7b('0x5')]},'data2':{'type':Sequelize[_0x3c7b('0x5')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 671f652..6495e89 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 _0x1c6e=['send','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','update','then','error','stack','name'];(function(_0xf2b987,_0xfa878f){var _0x4deed4=function(_0x167c15){while(--_0x167c15){_0xf2b987['push'](_0xf2b987['shift']());}};_0x4deed4(++_0xfa878f);}(_0x1c6e,0x17e));var _0xe1c6=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x1c6e[_0x4e93a9];return _0x43013c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe1c6('0x0'));var rimraf=require(_0xe1c6('0x1'));var zipdir=require(_0xe1c6('0x2'));var jsonpatch=require(_0xe1c6('0x3'));var rp=require(_0xe1c6('0x4'));var moment=require(_0xe1c6('0x5'));var BPromise=require(_0xe1c6('0x6'));var Mustache=require(_0xe1c6('0x7'));var util=require(_0xe1c6('0x8'));var path=require('path');var sox=require(_0xe1c6('0x9'));var csv=require(_0xe1c6('0xa'));var ejs=require(_0xe1c6('0xb'));var fs=require('fs');var _=require(_0xe1c6('0xc'));var squel=require('squel');var crypto=require(_0xe1c6('0xd'));var jsforce=require(_0xe1c6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe1c6('0xf'));var authService=require(_0xe1c6('0x10'));var qs=require(_0xe1c6('0x11'));var as=require(_0xe1c6('0x12'));var hardwareService=require(_0xe1c6('0x13'));var logger=require(_0xe1c6('0x14'))(_0xe1c6('0x15'));var utils=require('../../config/utils');var config=require(_0xe1c6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7a5436,_0x2f47fe){_0x2f47fe=_0x2f47fe||0xcc;return function(_0x58b862){if(_0x58b862){return _0x7a5436[_0xe1c6('0x17')](_0x2f47fe);}return _0x7a5436['status'](_0x2f47fe)[_0xe1c6('0x18')]();};}function respondWithResult(_0x46ee47,_0x5c359f){_0x5c359f=_0x5c359f||0xc8;return function(_0x4de88e){if(_0x4de88e){return _0x46ee47[_0xe1c6('0x19')](_0x5c359f)[_0xe1c6('0x1a')](_0x4de88e);}};}function respondWithFilteredResult(_0x27b21f,_0x350969){return function(_0x14456b){if(_0x14456b){var _0x421fe3=_0x14456b[_0xe1c6('0x1b')],_0x4acf23=_0x350969[_0xe1c6('0x1c')],_0x2964c1=_0x350969[_0xe1c6('0x1c')]+_0x350969['limit'],_0x18a9ed;if(_0x2964c1>=_0x421fe3){_0x2964c1=_0x421fe3;_0x18a9ed=0xc8;}else{_0x18a9ed=0xce;}_0x27b21f['status'](_0x18a9ed);return _0x27b21f[_0xe1c6('0x1d')](_0xe1c6('0x1e'),_0x4acf23+'-'+_0x2964c1+'/'+_0x421fe3)[_0xe1c6('0x1a')](_0x14456b);}return null;};}function patchUpdates(_0x35f104){return function(_0x9210f9){try{jsonpatch[_0xe1c6('0x1f')](_0x9210f9,_0x35f104,!![]);}catch(_0x567579){return BPromise['reject'](_0x567579);}return _0x9210f9[_0xe1c6('0x20')]();};}function saveUpdates(_0x31e621,_0x47c954){return function(_0x154ccc){if(_0x154ccc){return _0x154ccc[_0xe1c6('0x21')](_0x31e621)[_0xe1c6('0x22')](function(_0x565beb){return _0x565beb;});}return null;};}function removeEntity(_0x4d7e9c,_0x9d9ece){return function(_0x278b90){if(_0x278b90){return _0x278b90['destroy']()[_0xe1c6('0x22')](function(){_0x4d7e9c['status'](0xcc)[_0xe1c6('0x18')]();});}};}function handleEntityNotFound(_0x684414,_0x3af7cf){return function(_0x388358){if(!_0x388358){_0x684414[_0xe1c6('0x17')](0x194);}return _0x388358;};}function handleError(_0x45fd47,_0x3ce0ca){_0x3ce0ca=_0x3ce0ca||0x1f4;return function(_0x57b51e){logger[_0xe1c6('0x23')](_0x57b51e[_0xe1c6('0x24')]);if(_0x57b51e['name']){delete _0x57b51e[_0xe1c6('0x25')];}_0x45fd47[_0xe1c6('0x19')](_0x3ce0ca)[_0xe1c6('0x26')](_0x57b51e);};}exports['index']=function(_0x525d1c,_0x5a0d4d){var _0x637c9f={},_0x3d8d7d={},_0x5b52c9={'count':0x0,'rows':[]};var _0x3dd734=_[_0xe1c6('0x27')](db[_0xe1c6('0x28')][_0xe1c6('0x29')],function(_0x671890){return{'name':_0x671890[_0xe1c6('0x2a')],'type':_0x671890[_0xe1c6('0x2b')][_0xe1c6('0x2c')]};});_0x3d8d7d[_0xe1c6('0x2d')]=_[_0xe1c6('0x27')](_0x3dd734,_0xe1c6('0x25'));_0x3d8d7d[_0xe1c6('0x2e')]=_[_0xe1c6('0x2f')](_0x525d1c[_0xe1c6('0x2e')]);_0x3d8d7d[_0xe1c6('0x30')]=_['intersection'](_0x3d8d7d['model'],_0x3d8d7d['query']);_0x637c9f[_0xe1c6('0x31')]=_['intersection'](_0x3d8d7d[_0xe1c6('0x2d')],qs[_0xe1c6('0x32')](_0x525d1c[_0xe1c6('0x2e')]['fields']));_0x637c9f[_0xe1c6('0x31')]=_0x637c9f[_0xe1c6('0x31')]['length']?_0x637c9f[_0xe1c6('0x31')]:_0x3d8d7d[_0xe1c6('0x2d')];if(!_0x525d1c[_0xe1c6('0x2e')][_0xe1c6('0x33')](_0xe1c6('0x34'))){_0x637c9f[_0xe1c6('0x35')]=qs['limit'](_0x525d1c[_0xe1c6('0x2e')][_0xe1c6('0x35')]);_0x637c9f['offset']=qs[_0xe1c6('0x1c')](_0x525d1c[_0xe1c6('0x2e')][_0xe1c6('0x1c')]);}_0x637c9f[_0xe1c6('0x36')]=qs[_0xe1c6('0x37')](_0x525d1c[_0xe1c6('0x2e')]['sort']);_0x637c9f[_0xe1c6('0x38')]=qs[_0xe1c6('0x30')](_['pick'](_0x525d1c[_0xe1c6('0x2e')],_0x3d8d7d['filters']),_0x3dd734);if(_0x525d1c[_0xe1c6('0x2e')][_0xe1c6('0x39')]){_0x637c9f[_0xe1c6('0x38')]=_[_0xe1c6('0x3a')](_0x637c9f[_0xe1c6('0x38')],{'$or':_[_0xe1c6('0x27')](_0x3dd734,function(_0x442f61){if(_0x442f61[_0xe1c6('0x2b')]!==_0xe1c6('0x3b')){var _0x563d0e={};_0x563d0e[_0x442f61[_0xe1c6('0x25')]]={'$like':'%'+_0x525d1c['query'][_0xe1c6('0x39')]+'%'};return _0x563d0e;}})});}_0x637c9f=_['merge']({},_0x637c9f,_0x525d1c[_0xe1c6('0x3c')]);var _0x15ca6c={'where':_0x637c9f[_0xe1c6('0x38')]};return db[_0xe1c6('0x28')][_0xe1c6('0x1b')](_0x15ca6c)[_0xe1c6('0x22')](function(_0x5d51e6){_0x5b52c9[_0xe1c6('0x1b')]=_0x5d51e6;if(_0x525d1c[_0xe1c6('0x2e')][_0xe1c6('0x3d')]){_0x637c9f['include']=[{'all':!![]}];}return db[_0xe1c6('0x28')]['findAll'](_0x637c9f);})['then'](function(_0xea3724){_0x5b52c9[_0xe1c6('0x3e')]=_0xea3724;return _0x5b52c9;})[_0xe1c6('0x22')](respondWithFilteredResult(_0x5a0d4d,_0x637c9f))[_0xe1c6('0x3f')](handleError(_0x5a0d4d,null));};exports['show']=function(_0x3fb6cd,_0x2952d9){var _0x36fc96={'raw':!![],'where':{'id':_0x3fb6cd[_0xe1c6('0x40')]['id']}},_0x80f447={};_0x80f447[_0xe1c6('0x2d')]=_[_0xe1c6('0x2f')](db[_0xe1c6('0x28')][_0xe1c6('0x29')]);_0x80f447['query']=_[_0xe1c6('0x2f')](_0x3fb6cd[_0xe1c6('0x2e')]);_0x80f447[_0xe1c6('0x30')]=_[_0xe1c6('0x41')](_0x80f447[_0xe1c6('0x2d')],_0x80f447[_0xe1c6('0x2e')]);_0x36fc96[_0xe1c6('0x31')]=_[_0xe1c6('0x41')](_0x80f447[_0xe1c6('0x2d')],qs['fields'](_0x3fb6cd[_0xe1c6('0x2e')]['fields']));_0x36fc96['attributes']=_0x36fc96['attributes']['length']?_0x36fc96[_0xe1c6('0x31')]:_0x80f447[_0xe1c6('0x2d')];if(_0x3fb6cd[_0xe1c6('0x2e')][_0xe1c6('0x3d')]){_0x36fc96[_0xe1c6('0x42')]=[{'all':!![]}];}_0x36fc96=_[_0xe1c6('0x3a')]({},_0x36fc96,_0x3fb6cd[_0xe1c6('0x3c')]);return db['CloudProvider'][_0xe1c6('0x43')](_0x36fc96)[_0xe1c6('0x22')](handleEntityNotFound(_0x2952d9,null))[_0xe1c6('0x22')](respondWithResult(_0x2952d9,null))['catch'](handleError(_0x2952d9,null));};exports[_0xe1c6('0x44')]=function(_0x5a21dd,_0x35341f){return db[_0xe1c6('0x28')]['create'](_0x5a21dd['body'],{})['then'](respondWithResult(_0x35341f,0xc9))[_0xe1c6('0x3f')](handleError(_0x35341f,null));};exports[_0xe1c6('0x21')]=function(_0x2dff8e,_0x42da18){if(_0x2dff8e[_0xe1c6('0x45')]['id']){delete _0x2dff8e[_0xe1c6('0x45')]['id'];}return db[_0xe1c6('0x28')][_0xe1c6('0x43')]({'where':{'id':_0x2dff8e[_0xe1c6('0x40')]['id']}})[_0xe1c6('0x22')](handleEntityNotFound(_0x42da18,null))[_0xe1c6('0x22')](saveUpdates(_0x2dff8e[_0xe1c6('0x45')],null))[_0xe1c6('0x22')](respondWithResult(_0x42da18,null))['catch'](handleError(_0x42da18,null));};exports['destroy']=function(_0xd10675,_0x226376){return db[_0xe1c6('0x28')][_0xe1c6('0x43')]({'where':{'id':_0xd10675[_0xe1c6('0x40')]['id']}})[_0xe1c6('0x22')](handleEntityNotFound(_0x226376,null))[_0xe1c6('0x22')](removeEntity(_0x226376,null))[_0xe1c6('0x3f')](handleError(_0x226376,null));}; \ No newline at end of file +var _0x9fa8=['includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','reject','save','update','then','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','key','map','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x4577f9,_0x1be596){var _0x42dea7=function(_0x1856a){while(--_0x1856a){_0x4577f9['push'](_0x4577f9['shift']());}};_0x42dea7(++_0x1be596);}(_0x9fa8,0x12e));var _0x89fa=function(_0x4a3483,_0x43752f){_0x4a3483=_0x4a3483-0x0;var _0x4eba78=_0x9fa8[_0x4a3483];return _0x4eba78;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x89fa('0x0'));var rimraf=require(_0x89fa('0x1'));var zipdir=require(_0x89fa('0x2'));var jsonpatch=require(_0x89fa('0x3'));var rp=require(_0x89fa('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x89fa('0x5'));var path=require(_0x89fa('0x6'));var sox=require(_0x89fa('0x7'));var csv=require(_0x89fa('0x8'));var ejs=require(_0x89fa('0x9'));var fs=require('fs');var _=require(_0x89fa('0xa'));var squel=require(_0x89fa('0xb'));var crypto=require(_0x89fa('0xc'));var jsforce=require(_0x89fa('0xd'));var deskjs=require(_0x89fa('0xe'));var toCsv=require('to-csv');var querystring=require(_0x89fa('0xf'));var Papa=require('papaparse');var Redis=require(_0x89fa('0x10'));var authService=require(_0x89fa('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x89fa('0x12'));var hardwareService=require(_0x89fa('0x13'));var logger=require(_0x89fa('0x14'))(_0x89fa('0x15'));var utils=require(_0x89fa('0x16'));var config=require(_0x89fa('0x17'));var db=require(_0x89fa('0x18'))['db'];function respondWithStatusCode(_0xdea476,_0xd300c3){_0xd300c3=_0xd300c3||0xcc;return function(_0x59cb3a){if(_0x59cb3a){return _0xdea476[_0x89fa('0x19')](_0xd300c3);}return _0xdea476[_0x89fa('0x1a')](_0xd300c3)[_0x89fa('0x1b')]();};}function respondWithResult(_0x7f868b,_0x48cdf0){_0x48cdf0=_0x48cdf0||0xc8;return function(_0x4de795){if(_0x4de795){return _0x7f868b[_0x89fa('0x1a')](_0x48cdf0)[_0x89fa('0x1c')](_0x4de795);}};}function respondWithFilteredResult(_0xf0a62d,_0x55aec9){return function(_0x5933b1){if(_0x5933b1){var _0x66b229=_0x5933b1[_0x89fa('0x1d')],_0x881fbf=_0x55aec9['offset'],_0x57c3c3=_0x55aec9['offset']+_0x55aec9[_0x89fa('0x1e')],_0x212092;if(_0x57c3c3>=_0x66b229){_0x57c3c3=_0x66b229;_0x212092=0xc8;}else{_0x212092=0xce;}_0xf0a62d[_0x89fa('0x1a')](_0x212092);return _0xf0a62d[_0x89fa('0x1f')]('Content-Range',_0x881fbf+'-'+_0x57c3c3+'/'+_0x66b229)[_0x89fa('0x1c')](_0x5933b1);}return null;};}function patchUpdates(_0x4a4c71){return function(_0x48352a){try{jsonpatch['apply'](_0x48352a,_0x4a4c71,!![]);}catch(_0xe4880f){return BPromise[_0x89fa('0x20')](_0xe4880f);}return _0x48352a[_0x89fa('0x21')]();};}function saveUpdates(_0x584dcb,_0x202cdf){return function(_0x2192f6){if(_0x2192f6){return _0x2192f6[_0x89fa('0x22')](_0x584dcb)[_0x89fa('0x23')](function(_0x50d968){return _0x50d968;});}return null;};}function removeEntity(_0x59e0ac,_0x78636){return function(_0x19c426){if(_0x19c426){return _0x19c426['destroy']()[_0x89fa('0x23')](function(){_0x59e0ac[_0x89fa('0x1a')](0xcc)[_0x89fa('0x1b')]();});}};}function handleEntityNotFound(_0x913d26,_0x36ae83){return function(_0x1b8ae2){if(!_0x1b8ae2){_0x913d26[_0x89fa('0x19')](0x194);}return _0x1b8ae2;};}function handleError(_0x4c1c7a,_0xfff3a0){_0xfff3a0=_0xfff3a0||0x1f4;return function(_0x4ceffd){logger['error'](_0x4ceffd[_0x89fa('0x24')]);if(_0x4ceffd['name']){delete _0x4ceffd[_0x89fa('0x25')];}_0x4c1c7a['status'](_0xfff3a0)[_0x89fa('0x26')](_0x4ceffd);};}exports[_0x89fa('0x27')]=function(_0x3bdd97,_0x11763c){var _0xd28d03={},_0xcbbe4d={},_0x5260be={'count':0x0,'rows':[]};var _0x9323f9=_['map'](db[_0x89fa('0x28')][_0x89fa('0x29')],function(_0x2d1549){return{'name':_0x2d1549[_0x89fa('0x2a')],'type':_0x2d1549[_0x89fa('0x2b')][_0x89fa('0x2c')]};});_0xcbbe4d['model']=_[_0x89fa('0x2d')](_0x9323f9,_0x89fa('0x25'));_0xcbbe4d['query']=_['keys'](_0x3bdd97[_0x89fa('0x2e')]);_0xcbbe4d[_0x89fa('0x2f')]=_['intersection'](_0xcbbe4d[_0x89fa('0x30')],_0xcbbe4d[_0x89fa('0x2e')]);_0xd28d03['attributes']=_[_0x89fa('0x31')](_0xcbbe4d['model'],qs['fields'](_0x3bdd97['query'][_0x89fa('0x32')]));_0xd28d03['attributes']=_0xd28d03[_0x89fa('0x33')][_0x89fa('0x34')]?_0xd28d03[_0x89fa('0x33')]:_0xcbbe4d['model'];if(!_0x3bdd97[_0x89fa('0x2e')][_0x89fa('0x35')](_0x89fa('0x36'))){_0xd28d03[_0x89fa('0x1e')]=qs[_0x89fa('0x1e')](_0x3bdd97['query'][_0x89fa('0x1e')]);_0xd28d03['offset']=qs[_0x89fa('0x37')](_0x3bdd97[_0x89fa('0x2e')][_0x89fa('0x37')]);}_0xd28d03['order']=qs[_0x89fa('0x38')](_0x3bdd97[_0x89fa('0x2e')][_0x89fa('0x38')]);_0xd28d03[_0x89fa('0x39')]=qs[_0x89fa('0x2f')](_[_0x89fa('0x3a')](_0x3bdd97[_0x89fa('0x2e')],_0xcbbe4d['filters']),_0x9323f9);if(_0x3bdd97[_0x89fa('0x2e')][_0x89fa('0x3b')]){_0xd28d03[_0x89fa('0x39')]=_[_0x89fa('0x3c')](_0xd28d03['where'],{'$or':_['map'](_0x9323f9,function(_0x1b26bd){if(_0x1b26bd[_0x89fa('0x2b')]!==_0x89fa('0x3d')){var _0x7f1fb7={};_0x7f1fb7[_0x1b26bd[_0x89fa('0x25')]]={'$like':'%'+_0x3bdd97[_0x89fa('0x2e')][_0x89fa('0x3b')]+'%'};return _0x7f1fb7;}})});}_0xd28d03=_[_0x89fa('0x3c')]({},_0xd28d03,_0x3bdd97[_0x89fa('0x3e')]);var _0x16db11={'where':_0xd28d03[_0x89fa('0x39')]};return db[_0x89fa('0x28')][_0x89fa('0x1d')](_0x16db11)[_0x89fa('0x23')](function(_0x460436){_0x5260be[_0x89fa('0x1d')]=_0x460436;if(_0x3bdd97[_0x89fa('0x2e')][_0x89fa('0x3f')]){_0xd28d03[_0x89fa('0x40')]=[{'all':!![]}];}return db[_0x89fa('0x28')]['findAll'](_0xd28d03);})[_0x89fa('0x23')](function(_0x7ae371){_0x5260be[_0x89fa('0x41')]=_0x7ae371;return _0x5260be;})[_0x89fa('0x23')](respondWithFilteredResult(_0x11763c,_0xd28d03))[_0x89fa('0x42')](handleError(_0x11763c,null));};exports[_0x89fa('0x43')]=function(_0x39064e,_0x571807){var _0x661388={'raw':!![],'where':{'id':_0x39064e[_0x89fa('0x44')]['id']}},_0x1a68c4={};_0x1a68c4[_0x89fa('0x30')]=_['keys'](db[_0x89fa('0x28')][_0x89fa('0x29')]);_0x1a68c4[_0x89fa('0x2e')]=_[_0x89fa('0x45')](_0x39064e[_0x89fa('0x2e')]);_0x1a68c4[_0x89fa('0x2f')]=_[_0x89fa('0x31')](_0x1a68c4[_0x89fa('0x30')],_0x1a68c4[_0x89fa('0x2e')]);_0x661388[_0x89fa('0x33')]=_['intersection'](_0x1a68c4[_0x89fa('0x30')],qs['fields'](_0x39064e[_0x89fa('0x2e')][_0x89fa('0x32')]));_0x661388[_0x89fa('0x33')]=_0x661388[_0x89fa('0x33')][_0x89fa('0x34')]?_0x661388[_0x89fa('0x33')]:_0x1a68c4[_0x89fa('0x30')];if(_0x39064e[_0x89fa('0x2e')][_0x89fa('0x3f')]){_0x661388[_0x89fa('0x40')]=[{'all':!![]}];}_0x661388=_['merge']({},_0x661388,_0x39064e[_0x89fa('0x3e')]);return db[_0x89fa('0x28')][_0x89fa('0x46')](_0x661388)['then'](handleEntityNotFound(_0x571807,null))[_0x89fa('0x23')](respondWithResult(_0x571807,null))[_0x89fa('0x42')](handleError(_0x571807,null));};exports['create']=function(_0x15ad8a,_0x3b78f9){return db[_0x89fa('0x28')][_0x89fa('0x47')](_0x15ad8a['body'],{})['then'](respondWithResult(_0x3b78f9,0xc9))['catch'](handleError(_0x3b78f9,null));};exports[_0x89fa('0x22')]=function(_0x4d4656,_0x589876){if(_0x4d4656[_0x89fa('0x48')]['id']){delete _0x4d4656['body']['id'];}return db[_0x89fa('0x28')][_0x89fa('0x46')]({'where':{'id':_0x4d4656['params']['id']}})[_0x89fa('0x23')](handleEntityNotFound(_0x589876,null))['then'](saveUpdates(_0x4d4656['body'],null))[_0x89fa('0x23')](respondWithResult(_0x589876,null))[_0x89fa('0x42')](handleError(_0x589876,null));};exports['destroy']=function(_0x39c027,_0x2e6e9c){return db['CloudProvider']['find']({'where':{'id':_0x39c027[_0x89fa('0x44')]['id']}})[_0x89fa('0x23')](handleEntityNotFound(_0x2e6e9c,null))['then'](removeEntity(_0x2e6e9c,null))[_0x89fa('0x42')](handleError(_0x2e6e9c,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e2e8d0f..24e5d8f 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 _0xe072=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','cloud_providers','lodash'];(function(_0x282536,_0x3ba66a){var _0x76aa80=function(_0x1625ae){while(--_0x1625ae){_0x282536['push'](_0x282536['shift']());}};_0x76aa80(++_0x3ba66a);}(_0xe072,0x8f));var _0x2e07=function(_0x4baf83,_0x5c1800){_0x4baf83=_0x4baf83-0x0;var _0xbe4144=_0xe072[_0x4baf83];return _0xbe4144;};'use strict';var _=require(_0x2e07('0x0'));var util=require('util');var logger=require(_0x2e07('0x1'))('api');var moment=require(_0x2e07('0x2'));var BPromise=require(_0x2e07('0x3'));var rp=require(_0x2e07('0x4'));var fs=require('fs');var path=require(_0x2e07('0x5'));var rimraf=require('rimraf');var config=require(_0x2e07('0x6'));var attributes=require(_0x2e07('0x7'));module['exports']=function(_0x549c12,_0x3943c1){return _0x549c12['define']('CloudProvider',attributes,{'tableName':_0x2e07('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e7=['moment','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','lodash','../../config/logger','api'];(function(_0x20700f,_0x48d4ab){var _0x2c1f6a=function(_0x173bca){while(--_0x173bca){_0x20700f['push'](_0x20700f['shift']());}};_0x2c1f6a(++_0x48d4ab);}(_0xe1e7,0x16f));var _0x7e1e=function(_0x3d237d,_0x223920){_0x3d237d=_0x3d237d-0x0;var _0x51fd69=_0xe1e7[_0x3d237d];return _0x51fd69;};'use strict';var _=require(_0x7e1e('0x0'));var util=require('util');var logger=require(_0x7e1e('0x1'))(_0x7e1e('0x2'));var moment=require(_0x7e1e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e1e('0x4'));var config=require(_0x7e1e('0x5'));var attributes=require(_0x7e1e('0x6'));module[_0x7e1e('0x7')]=function(_0x26f074,_0x2f0f4a){return _0x26f074[_0x7e1e('0x8')](_0x7e1e('0x9'),attributes,{'tableName':'cloud_providers','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 a8da93f..8efeec1 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 _0x9417=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','error','code','CloudProvider,\x20%s,\x20%s','message','result','bluebird','ioredis','../../mysqldb'];(function(_0x39f401,_0x8d2573){var _0x403785=function(_0x51bf3f){while(--_0x51bf3f){_0x39f401['push'](_0x39f401['shift']());}};_0x403785(++_0x8d2573);}(_0x9417,0xd5));var _0x7941=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x9417[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7941('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7941('0x1'));var db=require(_0x7941('0x2'))['db'];var utils=require(_0x7941('0x3'));var logger=require(_0x7941('0x4'))(_0x7941('0x5'));var config=require(_0x7941('0x6'));var jayson=require(_0x7941('0x7'));var client=jayson[_0x7941('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd4f5db,_0xd76eec,_0x3dcefd){return new BPromise(function(_0x53b774,_0x14c25f){return client[_0x7941('0x9')](_0xd4f5db,_0x3dcefd)['then'](function(_0x4e3c06){logger[_0x7941('0xa')]('CloudProvider,\x20%s,\x20%s',_0xd76eec,_0x7941('0xb'));logger[_0x7941('0xc')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0xd76eec,_0x7941('0xb'),JSON['stringify'](_0x4e3c06));if(_0x4e3c06[_0x7941('0xd')]){if(_0x4e3c06[_0x7941('0xd')][_0x7941('0xe')]===0x1f4){logger[_0x7941('0xd')](_0x7941('0xf'),_0xd76eec,_0x4e3c06['error'][_0x7941('0x10')]);return _0x14c25f(_0x4e3c06['error'][_0x7941('0x10')]);}logger[_0x7941('0xd')](_0x7941('0xf'),_0xd76eec,_0x4e3c06[_0x7941('0xd')][_0x7941('0x10')]);return _0x53b774(_0x4e3c06[_0x7941('0xd')]['message']);}else{logger[_0x7941('0xa')](_0x7941('0xf'),_0xd76eec,_0x7941('0xb'));_0x53b774(_0x4e3c06[_0x7941('0x11')][_0x7941('0x10')]);}})['catch'](function(_0x5bf593){logger[_0x7941('0xd')](_0x7941('0xf'),_0xd76eec,_0x5bf593);_0x14c25f(_0x5bf593);});});} \ No newline at end of file +var _0x29e2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x196d5d,_0x35846f){var _0x4aa9de=function(_0x48724c){while(--_0x48724c){_0x196d5d['push'](_0x196d5d['shift']());}};_0x4aa9de(++_0x35846f);}(_0x29e2,0x197));var _0x229e=function(_0x3d72d4,_0x348baf){_0x3d72d4=_0x3d72d4-0x0;var _0x46c4fe=_0x29e2[_0x3d72d4];return _0x46c4fe;};'use strict';var _=require(_0x229e('0x0'));var util=require(_0x229e('0x1'));var moment=require(_0x229e('0x2'));var BPromise=require(_0x229e('0x3'));var rs=require(_0x229e('0x4'));var fs=require('fs');var Redis=require(_0x229e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x229e('0x6'));var logger=require(_0x229e('0x7'))(_0x229e('0x8'));var config=require(_0x229e('0x9'));var jayson=require(_0x229e('0xa'));var client=jayson[_0x229e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5090c5,_0x6e9d67,_0x82c9c6){return new BPromise(function(_0x38510a,_0xc70b00){return client[_0x229e('0xc')](_0x5090c5,_0x82c9c6)[_0x229e('0xd')](function(_0x584dd4){logger['info'](_0x229e('0xe'),_0x6e9d67,_0x229e('0xf'));logger['debug'](_0x229e('0x10'),_0x6e9d67,_0x229e('0xf'),JSON[_0x229e('0x11')](_0x584dd4));if(_0x584dd4[_0x229e('0x12')]){if(_0x584dd4[_0x229e('0x12')][_0x229e('0x13')]===0x1f4){logger['error'](_0x229e('0xe'),_0x6e9d67,_0x584dd4['error'][_0x229e('0x14')]);return _0xc70b00(_0x584dd4[_0x229e('0x12')][_0x229e('0x14')]);}logger[_0x229e('0x12')](_0x229e('0xe'),_0x6e9d67,_0x584dd4[_0x229e('0x12')][_0x229e('0x14')]);return _0x38510a(_0x584dd4['error']['message']);}else{logger[_0x229e('0x15')](_0x229e('0xe'),_0x6e9d67,_0x229e('0xf'));_0x38510a(_0x584dd4[_0x229e('0x16')][_0x229e('0x14')]);}})[_0x229e('0x17')](function(_0x325c5a){logger['error'](_0x229e('0xe'),_0x6e9d67,_0x325c5a);_0xc70b00(_0x325c5a);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 21edbb6..fdeb906 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 _0x8ca8=['../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x330ff0,_0x146528){var _0x215472=function(_0x57447b){while(--_0x57447b){_0x330ff0['push'](_0x330ff0['shift']());}};_0x215472(++_0x146528);}(_0x8ca8,0x1da));var _0x88ca=function(_0x297612,_0x1b363a){_0x297612=_0x297612-0x0;var _0x37a75f=_0x8ca8[_0x297612];return _0x37a75f;};'use strict';var multer=require(_0x88ca('0x0'));var util=require(_0x88ca('0x1'));var path=require('path');var timeout=require(_0x88ca('0x2'));var express=require(_0x88ca('0x3'));var router=express[_0x88ca('0x4')]();var auth=require(_0x88ca('0x5'));var interaction=require(_0x88ca('0x6'));var config=require(_0x88ca('0x7'));var controller=require(_0x88ca('0x8'));router[_0x88ca('0x9')]('/',auth['isAuthenticated'](),controller[_0x88ca('0xa')]);router[_0x88ca('0x9')](_0x88ca('0xb'),auth[_0x88ca('0xc')](),controller[_0x88ca('0xd')]);router[_0x88ca('0xe')]('/',auth[_0x88ca('0xc')](),controller[_0x88ca('0xf')]);router[_0x88ca('0x10')]('/:id',auth[_0x88ca('0xc')](),controller[_0x88ca('0x11')]);router[_0x88ca('0x12')](_0x88ca('0xb'),auth[_0x88ca('0xc')](),controller['destroy']);module[_0x88ca('0x13')]=router; \ No newline at end of file +var _0xe860=['put','update','destroy','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xe860,0x8b));var _0x0e86=function(_0x5de0ec,_0x439c1c){_0x5de0ec=_0x5de0ec-0x0;var _0x1bb675=_0xe860[_0x5de0ec];return _0x1bb675;};'use strict';var multer=require('multer');var util=require(_0x0e86('0x0'));var path=require(_0x0e86('0x1'));var timeout=require(_0x0e86('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0e86('0x3'));var interaction=require(_0x0e86('0x4'));var config=require(_0x0e86('0x5'));var controller=require(_0x0e86('0x6'));router[_0x0e86('0x7')]('/',auth[_0x0e86('0x8')](),controller[_0x0e86('0x9')]);router[_0x0e86('0x7')](_0x0e86('0xa'),auth[_0x0e86('0x8')](),controller[_0x0e86('0xb')]);router[_0x0e86('0xc')]('/',auth[_0x0e86('0x8')](),controller[_0x0e86('0xd')]);router[_0x0e86('0xe')]('/:id',auth[_0x0e86('0x8')](),controller[_0x0e86('0xf')]);router['delete'](_0x0e86('0xa'),auth[_0x0e86('0x8')](),controller[_0x0e86('0x10')]);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 03a2be8..e18b961 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 _0x7feb=['STRING','name','sequelize'];(function(_0x232bd0,_0x4883d1){var _0x2cde4c=function(_0x45b939){while(--_0x45b939){_0x232bd0['push'](_0x232bd0['shift']());}};_0x2cde4c(++_0x4883d1);}(_0x7feb,0x1b5));var _0xb7fe=function(_0x508c70,_0x1223eb){_0x508c70=_0x508c70-0x0;var _0x4d1ccd=_0x7feb[_0x508c70];return _0x4d1ccd;};'use strict';var Sequelize=require(_0xb7fe('0x0'));module['exports']={'name':{'type':Sequelize[_0xb7fe('0x1')],'unique':_0xb7fe('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb7fe('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xb7fe('0x1')]},'phone':{'type':Sequelize[_0xb7fe('0x1')]},'fax':{'type':Sequelize[_0xb7fe('0x1')]},'type':{'type':Sequelize[_0xb7fe('0x1')]},'street':{'type':Sequelize[_0xb7fe('0x1')]},'postalCode':{'type':Sequelize[_0xb7fe('0x1')]},'city':{'type':Sequelize[_0xb7fe('0x1')]},'country':{'type':Sequelize[_0xb7fe('0x1')]},'email':{'type':Sequelize[_0xb7fe('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb7fe('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xb7fe('0x1')]},'sCountry':{'type':Sequelize[_0xb7fe('0x1')]},'description':{'type':Sequelize[_0xb7fe('0x1')]}}; \ No newline at end of file +var _0xcc93=['exports','STRING','sequelize'];(function(_0x12280b,_0x16949b){var _0x50a939=function(_0x5835aa){while(--_0x5835aa){_0x12280b['push'](_0x12280b['shift']());}};_0x50a939(++_0x16949b);}(_0xcc93,0x176));var _0x3cc9=function(_0x3430a5,_0x202f8d){_0x3430a5=_0x3430a5-0x0;var _0x16189e=_0xcc93[_0x3430a5];return _0x16189e;};'use strict';var Sequelize=require(_0x3cc9('0x0'));module[_0x3cc9('0x1')]={'name':{'type':Sequelize[_0x3cc9('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3cc9('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x3cc9('0x2')]},'phone':{'type':Sequelize[_0x3cc9('0x2')]},'fax':{'type':Sequelize[_0x3cc9('0x2')]},'type':{'type':Sequelize[_0x3cc9('0x2')]},'street':{'type':Sequelize[_0x3cc9('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3cc9('0x2')]},'country':{'type':Sequelize[_0x3cc9('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x3cc9('0x2')]},'sStreet':{'type':Sequelize[_0x3cc9('0x2')]},'sPostalCode':{'type':Sequelize[_0x3cc9('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3cc9('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 659715b..42424ad 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 _0x42dd=['../../config/environment','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','then','get','UserProfileResource','destroy','error','name','send','index','CmCompany','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','count','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addContacts','CmContact','ids','getContacts','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','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x160814,_0x57b5c6){var _0x427a69=function(_0x3f1485){while(--_0x3f1485){_0x160814['push'](_0x160814['shift']());}};_0x427a69(++_0x57b5c6);}(_0x42dd,0x1e1));var _0xd42d=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x42dd[_0x1beef3];return _0x5af964;};'use strict';var pdf=require(_0xd42d('0x0'));var emlformat=require(_0xd42d('0x1'));var rimraf=require(_0xd42d('0x2'));var zipdir=require(_0xd42d('0x3'));var jsonpatch=require(_0xd42d('0x4'));var rp=require(_0xd42d('0x5'));var moment=require(_0xd42d('0x6'));var BPromise=require(_0xd42d('0x7'));var Mustache=require(_0xd42d('0x8'));var util=require('util');var path=require('path');var sox=require(_0xd42d('0x9'));var csv=require(_0xd42d('0xa'));var ejs=require(_0xd42d('0xb'));var fs=require('fs');var _=require(_0xd42d('0xc'));var squel=require(_0xd42d('0xd'));var crypto=require('crypto');var jsforce=require(_0xd42d('0xe'));var deskjs=require(_0xd42d('0xf'));var toCsv=require(_0xd42d('0xa'));var querystring=require(_0xd42d('0x10'));var Papa=require(_0xd42d('0x11'));var Redis=require(_0xd42d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd42d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd42d('0x14'));var logger=require(_0xd42d('0x15'))('api');var utils=require(_0xd42d('0x16'));var config=require(_0xd42d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d968a,_0x83d1b3){_0x83d1b3=_0x83d1b3||0xcc;return function(_0x3825c9){if(_0x3825c9){return _0x3d968a[_0xd42d('0x18')](_0x83d1b3);}return _0x3d968a[_0xd42d('0x19')](_0x83d1b3)[_0xd42d('0x1a')]();};}function respondWithResult(_0xc8cac2,_0x32b910){_0x32b910=_0x32b910||0xc8;return function(_0x3b9cdb){if(_0x3b9cdb){return _0xc8cac2['status'](_0x32b910)[_0xd42d('0x1b')](_0x3b9cdb);}};}function respondWithFilteredResult(_0x4ccb36,_0x267492){return function(_0xa7f9fb){if(_0xa7f9fb){var _0xb43162=_0xa7f9fb['count'],_0x3e8837=_0x267492['offset'],_0xb4a362=_0x267492[_0xd42d('0x1c')]+_0x267492[_0xd42d('0x1d')],_0x4adfa3;if(_0xb4a362>=_0xb43162){_0xb4a362=_0xb43162;_0x4adfa3=0xc8;}else{_0x4adfa3=0xce;}_0x4ccb36['status'](_0x4adfa3);return _0x4ccb36['set'](_0xd42d('0x1e'),_0x3e8837+'-'+_0xb4a362+'/'+_0xb43162)[_0xd42d('0x1b')](_0xa7f9fb);}return null;};}function patchUpdates(_0x2d918b){return function(_0x17e3b8){try{jsonpatch[_0xd42d('0x1f')](_0x17e3b8,_0x2d918b,!![]);}catch(_0x38fc05){return BPromise[_0xd42d('0x20')](_0x38fc05);}return _0x17e3b8['save']();};}function saveUpdates(_0xe4bbfc,_0x590116){return function(_0x4b1165){if(_0x4b1165){return _0x4b1165['update'](_0xe4bbfc)[_0xd42d('0x21')](function(_0x21892c){return _0x21892c;});}return null;};}function removeEntity(_0x524b79,_0x5aa59a){return function(_0x2a9de6){if(_0x2a9de6){return _0x2a9de6['destroy']()[_0xd42d('0x21')](function(){var _0x47683f=_0x2a9de6[_0xd42d('0x22')]({'plain':!![]});var _0x1308a6='Companies';return db[_0xd42d('0x23')][_0xd42d('0x24')]({'where':{'type':_0x1308a6,'resourceId':_0x47683f['id']}})[_0xd42d('0x21')](function(){return _0x2a9de6;});})[_0xd42d('0x21')](function(){_0x524b79[_0xd42d('0x19')](0xcc)[_0xd42d('0x1a')]();});}};}function handleEntityNotFound(_0xcd54cf,_0xdee76d){return function(_0x35d1dd){if(!_0x35d1dd){_0xcd54cf[_0xd42d('0x18')](0x194);}return _0x35d1dd;};}function handleError(_0x3ec93b,_0x5bee4c){_0x5bee4c=_0x5bee4c||0x1f4;return function(_0x2d03d4){logger[_0xd42d('0x25')](_0x2d03d4['stack']);if(_0x2d03d4[_0xd42d('0x26')]){delete _0x2d03d4['name'];}_0x3ec93b[_0xd42d('0x19')](_0x5bee4c)[_0xd42d('0x27')](_0x2d03d4);};}exports[_0xd42d('0x28')]=function(_0x110179,_0x1a6648){var _0x668bae={},_0x5516e5={},_0x1bd53a={'count':0x0,'rows':[]};return db[_0xd42d('0x29')]['describe']()[_0xd42d('0x21')](function(_0x27b1aa){_0x5516e5[_0xd42d('0x2a')]=_[_0xd42d('0x2b')](_0x27b1aa);_0x5516e5['query']=_['keys'](_0x110179['query']);_0x5516e5[_0xd42d('0x2c')]=_[_0xd42d('0x2d')](_0x5516e5['model'],_0x5516e5[_0xd42d('0x2e')]);_0x668bae[_0xd42d('0x2f')]=_[_0xd42d('0x2d')](_0x5516e5[_0xd42d('0x2a')],qs[_0xd42d('0x30')](_0x110179['query'][_0xd42d('0x30')]));_0x668bae[_0xd42d('0x2f')]=_0x668bae[_0xd42d('0x2f')][_0xd42d('0x31')]?_0x668bae[_0xd42d('0x2f')]:_0x5516e5['model'];if(!_0x110179[_0xd42d('0x2e')][_0xd42d('0x32')](_0xd42d('0x33'))){_0x668bae[_0xd42d('0x1d')]=qs[_0xd42d('0x1d')](_0x110179[_0xd42d('0x2e')][_0xd42d('0x1d')]);_0x668bae['offset']=qs[_0xd42d('0x1c')](_0x110179[_0xd42d('0x2e')]['offset']);}_0x668bae[_0xd42d('0x34')]=qs[_0xd42d('0x35')](_0x110179[_0xd42d('0x2e')][_0xd42d('0x35')]);_0x668bae['where']=qs[_0xd42d('0x2c')](_[_0xd42d('0x36')](_0x110179[_0xd42d('0x2e')],_0x5516e5[_0xd42d('0x2c')]),_0x27b1aa);if(_0x110179[_0xd42d('0x2e')][_0xd42d('0x37')]){_0x668bae[_0xd42d('0x38')]=_[_0xd42d('0x39')](_0x668bae[_0xd42d('0x38')],{'$or':_[_0xd42d('0x3a')](_0x668bae[_0xd42d('0x2f')],function(_0x25b05f){var _0x21108e={};_0x21108e[_0x25b05f]={'$like':'%'+_0x110179[_0xd42d('0x2e')][_0xd42d('0x37')]+'%'};return _0x21108e;})});}_0x668bae=_[_0xd42d('0x39')]({},_0x668bae,_0x110179[_0xd42d('0x3b')]);var _0x53145f={'where':_0x668bae[_0xd42d('0x38')]};return db[_0xd42d('0x29')][_0xd42d('0x3c')](_0x53145f)[_0xd42d('0x21')](function(_0x189c98){_0x1bd53a[_0xd42d('0x3c')]=_0x189c98;if(_0x110179[_0xd42d('0x2e')][_0xd42d('0x3d')]){_0x668bae['include']=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x668bae);})['then'](function(_0x287c24){_0x1bd53a[_0xd42d('0x3e')]=_0x287c24;return _0x1bd53a;})[_0xd42d('0x21')](respondWithFilteredResult(_0x1a6648,_0x668bae))[_0xd42d('0x3f')](handleError(_0x1a6648,null));})[_0xd42d('0x3f')](handleError(_0x1a6648,null));};exports[_0xd42d('0x40')]=function(_0x16db39,_0x113500){var _0x260757={'raw':![],'where':{'id':_0x16db39[_0xd42d('0x41')]['id']}},_0x194bcd={};_0x194bcd[_0xd42d('0x2a')]=_[_0xd42d('0x2b')](db['CmCompany'][_0xd42d('0x42')]);_0x194bcd[_0xd42d('0x2e')]=_[_0xd42d('0x2b')](_0x16db39['query']);_0x194bcd[_0xd42d('0x2c')]=_[_0xd42d('0x2d')](_0x194bcd[_0xd42d('0x2a')],_0x194bcd[_0xd42d('0x2e')]);_0x260757[_0xd42d('0x2f')]=_[_0xd42d('0x2d')](_0x194bcd[_0xd42d('0x2a')],qs[_0xd42d('0x30')](_0x16db39['query'][_0xd42d('0x30')]));_0x260757['attributes']=_0x260757[_0xd42d('0x2f')][_0xd42d('0x31')]?_0x260757[_0xd42d('0x2f')]:_0x194bcd[_0xd42d('0x2a')];if(_0x16db39[_0xd42d('0x2e')][_0xd42d('0x3d')]){_0x260757[_0xd42d('0x43')]=[{'all':!![]}];}_0x260757=_[_0xd42d('0x39')]({},_0x260757,_0x16db39[_0xd42d('0x3b')]);return db['CmCompany'][_0xd42d('0x44')](_0x260757)[_0xd42d('0x21')](handleEntityNotFound(_0x113500,null))['then'](respondWithResult(_0x113500,null))[_0xd42d('0x3f')](handleError(_0x113500,null));};exports[_0xd42d('0x45')]=function(_0x39e02e,_0x45169b){return db[_0xd42d('0x29')]['create'](_0x39e02e[_0xd42d('0x46')],{})[_0xd42d('0x21')](function(_0x417a63){var _0x209d01=_0x39e02e[_0xd42d('0x47')][_0xd42d('0x22')]({'plain':!![]});if(!_0x209d01)throw new Error(_0xd42d('0x48'));if(_0x209d01[_0xd42d('0x49')]==='user'){var _0x108cec=_0x417a63[_0xd42d('0x22')]({'plain':!![]});var _0x68b809=_0xd42d('0x4a');return db[_0xd42d('0x4b')][_0xd42d('0x44')]({'where':{'name':_0x68b809,'userProfileId':_0x209d01[_0xd42d('0x4c')]},'raw':!![]})[_0xd42d('0x21')](function(_0x3de4a7){if(_0x3de4a7&&_0x3de4a7['autoAssociation']===0x0){return db[_0xd42d('0x23')][_0xd42d('0x45')]({'name':_0x108cec[_0xd42d('0x26')],'resourceId':_0x108cec['id'],'type':_0x3de4a7[_0xd42d('0x26')],'sectionId':_0x3de4a7['id']},{})['then'](function(){return _0x417a63;});}else{return _0x417a63;}})[_0xd42d('0x3f')](function(_0x2269d2){logger['error'](_0xd42d('0x4d'),_0x2269d2);throw _0x2269d2;});}return _0x417a63;})[_0xd42d('0x21')](respondWithResult(_0x45169b,0xc9))['catch'](handleError(_0x45169b,null));};exports[_0xd42d('0x4e')]=function(_0x43c9df,_0x32a9ba){if(_0x43c9df[_0xd42d('0x46')]['id']){delete _0x43c9df[_0xd42d('0x46')]['id'];}return db[_0xd42d('0x29')]['find']({'where':{'id':_0x43c9df[_0xd42d('0x41')]['id']}})[_0xd42d('0x21')](handleEntityNotFound(_0x32a9ba,null))[_0xd42d('0x21')](saveUpdates(_0x43c9df[_0xd42d('0x46')],null))[_0xd42d('0x21')](respondWithResult(_0x32a9ba,null))[_0xd42d('0x3f')](handleError(_0x32a9ba,null));};exports[_0xd42d('0x24')]=function(_0x50a7c7,_0x15a3cc){return db[_0xd42d('0x29')]['find']({'where':{'id':_0x50a7c7['params']['id']}})[_0xd42d('0x21')](handleEntityNotFound(_0x15a3cc,null))[_0xd42d('0x21')](removeEntity(_0x15a3cc,null))[_0xd42d('0x3f')](handleError(_0x15a3cc,null));};exports['describe']=function(_0x474b62,_0x261863){return db[_0xd42d('0x29')][_0xd42d('0x4f')]()[_0xd42d('0x21')](respondWithResult(_0x261863,null))['catch'](handleError(_0x261863,null));};exports[_0xd42d('0x50')]=function(_0x3cb927,_0x39dd88,_0x213eca){return db[_0xd42d('0x51')]['find']({'where':{'id':_0x3cb927[_0xd42d('0x41')]['id']}})[_0xd42d('0x21')](handleEntityNotFound(_0x39dd88,null))[_0xd42d('0x21')](function(_0x16869a){if(_0x16869a){return _0x16869a[_0xd42d('0x50')](_0x3cb927[_0xd42d('0x46')]['ids'],_['omit'](_0x3cb927['body'],[_0xd42d('0x52'),'id'])||{});}})['then'](respondWithResult(_0x39dd88,null))[_0xd42d('0x3f')](handleError(_0x39dd88,null));};exports[_0xd42d('0x53')]=function(_0x16c84,_0x2e2f89,_0x3219fd){var _0x3e61eb={};var _0x54fb99={};var _0x34abcd;var _0x157089;return db[_0xd42d('0x29')]['findOne']({'where':{'id':_0x16c84[_0xd42d('0x41')]['id']}})[_0xd42d('0x21')](handleEntityNotFound(_0x2e2f89,null))[_0xd42d('0x21')](function(_0x404306){if(_0x404306){_0x34abcd=_0x404306;_0x54fb99[_0xd42d('0x2a')]=_[_0xd42d('0x2b')](db[_0xd42d('0x51')][_0xd42d('0x42')]);_0x54fb99['query']=_[_0xd42d('0x2b')](_0x16c84['query']);_0x54fb99[_0xd42d('0x2c')]=_[_0xd42d('0x2d')](_0x54fb99[_0xd42d('0x2a')],_0x54fb99[_0xd42d('0x2e')]);_0x3e61eb[_0xd42d('0x2f')]=_[_0xd42d('0x2d')](_0x54fb99[_0xd42d('0x2a')],qs[_0xd42d('0x30')](_0x16c84[_0xd42d('0x2e')]['fields']));_0x3e61eb[_0xd42d('0x2f')]=_0x3e61eb[_0xd42d('0x2f')]['length']?_0x3e61eb[_0xd42d('0x2f')]:_0x54fb99[_0xd42d('0x2a')];_0x3e61eb[_0xd42d('0x34')]=qs[_0xd42d('0x35')](_0x16c84[_0xd42d('0x2e')]['sort']);_0x3e61eb['where']=qs[_0xd42d('0x2c')](_['pick'](_0x16c84[_0xd42d('0x2e')],_0x54fb99['filters']));if(_0x16c84['query'][_0xd42d('0x37')]){_0x3e61eb[_0xd42d('0x38')]=_[_0xd42d('0x39')](_0x3e61eb[_0xd42d('0x38')],{'$or':_['map'](_0x3e61eb[_0xd42d('0x2f')],function(_0x5cb829){var _0x48a842={};_0x48a842[_0x5cb829]={'$like':'%'+_0x16c84[_0xd42d('0x2e')][_0xd42d('0x37')]+'%'};return _0x48a842;})});}_0x3e61eb=_[_0xd42d('0x39')]({},_0x3e61eb,_0x16c84[_0xd42d('0x3b')]);return _0x34abcd['getContacts'](_0x3e61eb);}})['then'](function(_0x27e220){if(_0x27e220){_0x157089=_0x27e220[_0xd42d('0x31')];if(!_0x16c84[_0xd42d('0x2e')][_0xd42d('0x32')](_0xd42d('0x33'))){_0x3e61eb[_0xd42d('0x1d')]=qs[_0xd42d('0x1d')](_0x16c84[_0xd42d('0x2e')][_0xd42d('0x1d')]);_0x3e61eb[_0xd42d('0x1c')]=qs[_0xd42d('0x1c')](_0x16c84['query'][_0xd42d('0x1c')]);}return _0x34abcd[_0xd42d('0x53')](_0x3e61eb);}})[_0xd42d('0x21')](function(_0xc39e4c){if(_0xc39e4c){return _0xc39e4c?{'count':_0x157089,'rows':_0xc39e4c}:null;}})[_0xd42d('0x21')](respondWithResult(_0x2e2f89,null))['catch'](handleError(_0x2e2f89,null));}; \ No newline at end of file +var _0xe071=['to-csv','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','save','then','get','Companies','UserProfileResource','sendStatus','error','stack','name','index','describe','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','CmCompany','findAll','rows','show','params','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addContacts','CmContact','omit','ids','getContacts','findOne','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','mustache','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x11b2ce,_0x31f8d4){var _0x35d74e=function(_0x3fe74f){while(--_0x3fe74f){_0x11b2ce['push'](_0x11b2ce['shift']());}};_0x35d74e(++_0x31f8d4);}(_0xe071,0xf7));var _0x1e07=function(_0x4fab79,_0x4f76dc){_0x4fab79=_0x4fab79-0x0;var _0x31ec8e=_0xe071[_0x4fab79];return _0x31ec8e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1e07('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e07('0x1'));var jsonpatch=require(_0x1e07('0x2'));var rp=require(_0x1e07('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1e07('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1e07('0x5'));var fs=require('fs');var _=require(_0x1e07('0x6'));var squel=require(_0x1e07('0x7'));var crypto=require(_0x1e07('0x8'));var jsforce=require(_0x1e07('0x9'));var deskjs=require(_0x1e07('0xa'));var toCsv=require(_0x1e07('0xb'));var querystring=require(_0x1e07('0xc'));var Papa=require(_0x1e07('0xd'));var Redis=require(_0x1e07('0xe'));var authService=require(_0x1e07('0xf'));var qs=require(_0x1e07('0x10'));var as=require(_0x1e07('0x11'));var hardwareService=require(_0x1e07('0x12'));var logger=require('../../config/logger')(_0x1e07('0x13'));var utils=require(_0x1e07('0x14'));var config=require(_0x1e07('0x15'));var db=require(_0x1e07('0x16'))['db'];function respondWithStatusCode(_0x1d544c,_0x81ef9f){_0x81ef9f=_0x81ef9f||0xcc;return function(_0x42a648){if(_0x42a648){return _0x1d544c['sendStatus'](_0x81ef9f);}return _0x1d544c[_0x1e07('0x17')](_0x81ef9f)[_0x1e07('0x18')]();};}function respondWithResult(_0x20e386,_0x186fb6){_0x186fb6=_0x186fb6||0xc8;return function(_0x27ad6a){if(_0x27ad6a){return _0x20e386[_0x1e07('0x17')](_0x186fb6)[_0x1e07('0x19')](_0x27ad6a);}};}function respondWithFilteredResult(_0x180d6d,_0x19f8a3){return function(_0x1090ef){if(_0x1090ef){var _0x2d6044=_0x1090ef[_0x1e07('0x1a')],_0x53ad8e=_0x19f8a3[_0x1e07('0x1b')],_0x57f82f=_0x19f8a3[_0x1e07('0x1b')]+_0x19f8a3[_0x1e07('0x1c')],_0x246f65;if(_0x57f82f>=_0x2d6044){_0x57f82f=_0x2d6044;_0x246f65=0xc8;}else{_0x246f65=0xce;}_0x180d6d[_0x1e07('0x17')](_0x246f65);return _0x180d6d[_0x1e07('0x1d')](_0x1e07('0x1e'),_0x53ad8e+'-'+_0x57f82f+'/'+_0x2d6044)[_0x1e07('0x19')](_0x1090ef);}return null;};}function patchUpdates(_0x26e361){return function(_0x5a619a){try{jsonpatch['apply'](_0x5a619a,_0x26e361,!![]);}catch(_0x2f6063){return BPromise['reject'](_0x2f6063);}return _0x5a619a[_0x1e07('0x1f')]();};}function saveUpdates(_0x41ce7e,_0x1c76da){return function(_0x4ed88b){if(_0x4ed88b){return _0x4ed88b['update'](_0x41ce7e)[_0x1e07('0x20')](function(_0x585230){return _0x585230;});}return null;};}function removeEntity(_0x962cbe,_0x51ef1e){return function(_0x222beb){if(_0x222beb){return _0x222beb['destroy']()[_0x1e07('0x20')](function(){var _0x2be076=_0x222beb[_0x1e07('0x21')]({'plain':!![]});var _0x72661c=_0x1e07('0x22');return db[_0x1e07('0x23')]['destroy']({'where':{'type':_0x72661c,'resourceId':_0x2be076['id']}})[_0x1e07('0x20')](function(){return _0x222beb;});})['then'](function(){_0x962cbe[_0x1e07('0x17')](0xcc)[_0x1e07('0x18')]();});}};}function handleEntityNotFound(_0x12a06d,_0x17ed08){return function(_0x30677c){if(!_0x30677c){_0x12a06d[_0x1e07('0x24')](0x194);}return _0x30677c;};}function handleError(_0x1ac57a,_0x4b6c46){_0x4b6c46=_0x4b6c46||0x1f4;return function(_0x275545){logger[_0x1e07('0x25')](_0x275545[_0x1e07('0x26')]);if(_0x275545[_0x1e07('0x27')]){delete _0x275545[_0x1e07('0x27')];}_0x1ac57a[_0x1e07('0x17')](_0x4b6c46)['send'](_0x275545);};}exports[_0x1e07('0x28')]=function(_0x29171f,_0xb76556){var _0x418165={},_0x338081={},_0x289efa={'count':0x0,'rows':[]};return db['CmCompany'][_0x1e07('0x29')]()['then'](function(_0xbc86ea){_0x338081[_0x1e07('0x2a')]=_['keys'](_0xbc86ea);_0x338081[_0x1e07('0x2b')]=_[_0x1e07('0x2c')](_0x29171f['query']);_0x338081[_0x1e07('0x2d')]=_[_0x1e07('0x2e')](_0x338081[_0x1e07('0x2a')],_0x338081[_0x1e07('0x2b')]);_0x418165['attributes']=_[_0x1e07('0x2e')](_0x338081[_0x1e07('0x2a')],qs[_0x1e07('0x2f')](_0x29171f[_0x1e07('0x2b')][_0x1e07('0x2f')]));_0x418165[_0x1e07('0x30')]=_0x418165[_0x1e07('0x30')]['length']?_0x418165[_0x1e07('0x30')]:_0x338081[_0x1e07('0x2a')];if(!_0x29171f[_0x1e07('0x2b')]['hasOwnProperty'](_0x1e07('0x31'))){_0x418165['limit']=qs[_0x1e07('0x1c')](_0x29171f[_0x1e07('0x2b')][_0x1e07('0x1c')]);_0x418165[_0x1e07('0x1b')]=qs[_0x1e07('0x1b')](_0x29171f[_0x1e07('0x2b')][_0x1e07('0x1b')]);}_0x418165[_0x1e07('0x32')]=qs[_0x1e07('0x33')](_0x29171f[_0x1e07('0x2b')][_0x1e07('0x33')]);_0x418165[_0x1e07('0x34')]=qs[_0x1e07('0x2d')](_[_0x1e07('0x35')](_0x29171f['query'],_0x338081[_0x1e07('0x2d')]),_0xbc86ea);if(_0x29171f[_0x1e07('0x2b')][_0x1e07('0x36')]){_0x418165[_0x1e07('0x34')]=_[_0x1e07('0x37')](_0x418165[_0x1e07('0x34')],{'$or':_[_0x1e07('0x38')](_0x418165[_0x1e07('0x30')],function(_0x88ebec){var _0x20443a={};_0x20443a[_0x88ebec]={'$like':'%'+_0x29171f[_0x1e07('0x2b')][_0x1e07('0x36')]+'%'};return _0x20443a;})});}_0x418165=_['merge']({},_0x418165,_0x29171f[_0x1e07('0x39')]);var _0x257ef3={'where':_0x418165['where']};return db['CmCompany']['count'](_0x257ef3)[_0x1e07('0x20')](function(_0x41c365){_0x289efa[_0x1e07('0x1a')]=_0x41c365;if(_0x29171f[_0x1e07('0x2b')][_0x1e07('0x3a')]){_0x418165['include']=[{'all':!![]}];}return db[_0x1e07('0x3b')][_0x1e07('0x3c')](_0x418165);})[_0x1e07('0x20')](function(_0x10eab5){_0x289efa[_0x1e07('0x3d')]=_0x10eab5;return _0x289efa;})[_0x1e07('0x20')](respondWithFilteredResult(_0xb76556,_0x418165))['catch'](handleError(_0xb76556,null));})['catch'](handleError(_0xb76556,null));};exports[_0x1e07('0x3e')]=function(_0x4effbe,_0x584bcd){var _0x5a51f6={'raw':![],'where':{'id':_0x4effbe[_0x1e07('0x3f')]['id']}},_0x5b809c={};_0x5b809c[_0x1e07('0x2a')]=_[_0x1e07('0x2c')](db[_0x1e07('0x3b')][_0x1e07('0x40')]);_0x5b809c['query']=_[_0x1e07('0x2c')](_0x4effbe['query']);_0x5b809c[_0x1e07('0x2d')]=_[_0x1e07('0x2e')](_0x5b809c['model'],_0x5b809c[_0x1e07('0x2b')]);_0x5a51f6['attributes']=_['intersection'](_0x5b809c['model'],qs[_0x1e07('0x2f')](_0x4effbe[_0x1e07('0x2b')]['fields']));_0x5a51f6[_0x1e07('0x30')]=_0x5a51f6['attributes'][_0x1e07('0x41')]?_0x5a51f6[_0x1e07('0x30')]:_0x5b809c['model'];if(_0x4effbe[_0x1e07('0x2b')]['includeAll']){_0x5a51f6[_0x1e07('0x42')]=[{'all':!![]}];}_0x5a51f6=_[_0x1e07('0x37')]({},_0x5a51f6,_0x4effbe[_0x1e07('0x39')]);return db['CmCompany'][_0x1e07('0x43')](_0x5a51f6)[_0x1e07('0x20')](handleEntityNotFound(_0x584bcd,null))['then'](respondWithResult(_0x584bcd,null))[_0x1e07('0x44')](handleError(_0x584bcd,null));};exports['create']=function(_0x2b273b,_0x16e5de){return db[_0x1e07('0x3b')][_0x1e07('0x45')](_0x2b273b[_0x1e07('0x46')],{})[_0x1e07('0x20')](function(_0x718fa1){var _0x70d36a=_0x2b273b[_0x1e07('0x47')][_0x1e07('0x21')]({'plain':!![]});if(!_0x70d36a)throw new Error(_0x1e07('0x48'));if(_0x70d36a[_0x1e07('0x49')]===_0x1e07('0x47')){var _0x15d724=_0x718fa1[_0x1e07('0x21')]({'plain':!![]});var _0x3719d1=_0x1e07('0x22');return db[_0x1e07('0x4a')][_0x1e07('0x43')]({'where':{'name':_0x3719d1,'userProfileId':_0x70d36a['userProfileId']},'raw':!![]})[_0x1e07('0x20')](function(_0x4a7c83){if(_0x4a7c83&&_0x4a7c83[_0x1e07('0x4b')]===0x0){return db[_0x1e07('0x23')]['create']({'name':_0x15d724['name'],'resourceId':_0x15d724['id'],'type':_0x4a7c83[_0x1e07('0x27')],'sectionId':_0x4a7c83['id']},{})[_0x1e07('0x20')](function(){return _0x718fa1;});}else{return _0x718fa1;}})[_0x1e07('0x44')](function(_0x5266af){logger[_0x1e07('0x25')](_0x1e07('0x4c'),_0x5266af);throw _0x5266af;});}return _0x718fa1;})[_0x1e07('0x20')](respondWithResult(_0x16e5de,0xc9))['catch'](handleError(_0x16e5de,null));};exports[_0x1e07('0x4d')]=function(_0x5069b6,_0x2cf626){if(_0x5069b6[_0x1e07('0x46')]['id']){delete _0x5069b6[_0x1e07('0x46')]['id'];}return db[_0x1e07('0x3b')][_0x1e07('0x43')]({'where':{'id':_0x5069b6[_0x1e07('0x3f')]['id']}})[_0x1e07('0x20')](handleEntityNotFound(_0x2cf626,null))[_0x1e07('0x20')](saveUpdates(_0x5069b6['body'],null))[_0x1e07('0x20')](respondWithResult(_0x2cf626,null))[_0x1e07('0x44')](handleError(_0x2cf626,null));};exports[_0x1e07('0x4e')]=function(_0x22c76a,_0x1c63d8){return db[_0x1e07('0x3b')][_0x1e07('0x43')]({'where':{'id':_0x22c76a[_0x1e07('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1c63d8,null))['then'](removeEntity(_0x1c63d8,null))[_0x1e07('0x44')](handleError(_0x1c63d8,null));};exports[_0x1e07('0x29')]=function(_0x8fbf13,_0x37356a){return db[_0x1e07('0x3b')]['describe']()['then'](respondWithResult(_0x37356a,null))[_0x1e07('0x44')](handleError(_0x37356a,null));};exports[_0x1e07('0x4f')]=function(_0x5331d3,_0x124391,_0x5886fb){return db[_0x1e07('0x50')]['find']({'where':{'id':_0x5331d3[_0x1e07('0x3f')]['id']}})[_0x1e07('0x20')](handleEntityNotFound(_0x124391,null))['then'](function(_0x168072){if(_0x168072){return _0x168072[_0x1e07('0x4f')](_0x5331d3['body']['ids'],_[_0x1e07('0x51')](_0x5331d3[_0x1e07('0x46')],[_0x1e07('0x52'),'id'])||{});}})['then'](respondWithResult(_0x124391,null))['catch'](handleError(_0x124391,null));};exports[_0x1e07('0x53')]=function(_0x19499e,_0x38a972,_0x4c3b57){var _0x30e426={};var _0x3fd280={};var _0x206618;var _0x213833;return db[_0x1e07('0x3b')][_0x1e07('0x54')]({'where':{'id':_0x19499e[_0x1e07('0x3f')]['id']}})[_0x1e07('0x20')](handleEntityNotFound(_0x38a972,null))[_0x1e07('0x20')](function(_0x44e064){if(_0x44e064){_0x206618=_0x44e064;_0x3fd280[_0x1e07('0x2a')]=_[_0x1e07('0x2c')](db[_0x1e07('0x50')]['rawAttributes']);_0x3fd280['query']=_['keys'](_0x19499e['query']);_0x3fd280[_0x1e07('0x2d')]=_['intersection'](_0x3fd280[_0x1e07('0x2a')],_0x3fd280[_0x1e07('0x2b')]);_0x30e426[_0x1e07('0x30')]=_['intersection'](_0x3fd280[_0x1e07('0x2a')],qs[_0x1e07('0x2f')](_0x19499e['query'][_0x1e07('0x2f')]));_0x30e426['attributes']=_0x30e426[_0x1e07('0x30')][_0x1e07('0x41')]?_0x30e426[_0x1e07('0x30')]:_0x3fd280[_0x1e07('0x2a')];_0x30e426['order']=qs[_0x1e07('0x33')](_0x19499e[_0x1e07('0x2b')]['sort']);_0x30e426[_0x1e07('0x34')]=qs[_0x1e07('0x2d')](_[_0x1e07('0x35')](_0x19499e[_0x1e07('0x2b')],_0x3fd280['filters']));if(_0x19499e['query'][_0x1e07('0x36')]){_0x30e426[_0x1e07('0x34')]=_['merge'](_0x30e426[_0x1e07('0x34')],{'$or':_[_0x1e07('0x38')](_0x30e426['attributes'],function(_0x55bac2){var _0x535463={};_0x535463[_0x55bac2]={'$like':'%'+_0x19499e[_0x1e07('0x2b')]['filter']+'%'};return _0x535463;})});}_0x30e426=_['merge']({},_0x30e426,_0x19499e['options']);return _0x206618[_0x1e07('0x53')](_0x30e426);}})[_0x1e07('0x20')](function(_0x336450){if(_0x336450){_0x213833=_0x336450[_0x1e07('0x41')];if(!_0x19499e['query'][_0x1e07('0x55')](_0x1e07('0x31'))){_0x30e426[_0x1e07('0x1c')]=qs[_0x1e07('0x1c')](_0x19499e[_0x1e07('0x2b')][_0x1e07('0x1c')]);_0x30e426['offset']=qs[_0x1e07('0x1b')](_0x19499e[_0x1e07('0x2b')]['offset']);}return _0x206618['getContacts'](_0x30e426);}})[_0x1e07('0x20')](function(_0x56ba10){if(_0x56ba10){return _0x56ba10?{'count':_0x213833,'rows':_0x56ba10}:null;}})[_0x1e07('0x20')](respondWithResult(_0x38a972,null))[_0x1e07('0x44')](handleError(_0x38a972,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 2d9ea6e..982713f 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 _0x4323=['exports','define','CmCompany','cm_companies','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x54f3e8,_0x3ed493){var _0x267b37=function(_0x58247e){while(--_0x58247e){_0x54f3e8['push'](_0x54f3e8['shift']());}};_0x267b37(++_0x3ed493);}(_0x4323,0x100));var _0x3432=function(_0x59d866,_0x55657c){_0x59d866=_0x59d866-0x0;var _0x43b7cc=_0x4323[_0x59d866];return _0x43b7cc;};'use strict';var _=require(_0x3432('0x0'));var util=require('util');var logger=require(_0x3432('0x1'))(_0x3432('0x2'));var moment=require(_0x3432('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3432('0x4'));var rimraf=require(_0x3432('0x5'));var config=require(_0x3432('0x6'));var attributes=require(_0x3432('0x7'));module[_0x3432('0x8')]=function(_0x113707,_0x272b75){return _0x113707[_0x3432('0x9')](_0x3432('0xa'),attributes,{'tableName':_0x3432('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97af=['util','api','moment','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x97af,0xfb));var _0xf97a=function(_0x3abd07,_0x5b9ca4){_0x3abd07=_0x3abd07-0x0;var _0x34a5fa=_0x97af[_0x3abd07];return _0x34a5fa;};'use strict';var _=require(_0xf97a('0x0'));var util=require(_0xf97a('0x1'));var logger=require('../../config/logger')(_0xf97a('0x2'));var moment=require(_0xf97a('0x3'));var BPromise=require('bluebird');var rp=require(_0xf97a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf97a('0x5'));var config=require(_0xf97a('0x6'));var attributes=require(_0xf97a('0x7'));module[_0xf97a('0x8')]=function(_0x5c10d1,_0x17e9ab){return _0x5c10d1[_0xf97a('0x9')](_0xf97a('0xa'),attributes,{'tableName':_0xf97a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index a80e199..674b4cc 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 _0x4c6f=['info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','then'];(function(_0x485c1b,_0x59432a){var _0x4f82b2=function(_0x1e3ae3){while(--_0x1e3ae3){_0x485c1b['push'](_0x485c1b['shift']());}};_0x4f82b2(++_0x59432a);}(_0x4c6f,0x106));var _0xf4c6=function(_0x20a68a,_0x54502e){_0x20a68a=_0x20a68a-0x0;var _0x56c5d4=_0x4c6f[_0x20a68a];return _0x56c5d4;};'use strict';var _=require(_0xf4c6('0x0'));var util=require(_0xf4c6('0x1'));var moment=require(_0xf4c6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4c6('0x3'));var fs=require('fs');var Redis=require(_0xf4c6('0x4'));var db=require(_0xf4c6('0x5'))['db'];var utils=require(_0xf4c6('0x6'));var logger=require('../../config/logger')(_0xf4c6('0x7'));var config=require(_0xf4c6('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31722d,_0x43c8d9,_0x407115){return new BPromise(function(_0x4dfb7f,_0x5b70e5){return client['request'](_0x31722d,_0x407115)[_0xf4c6('0x9')](function(_0x85f432){logger[_0xf4c6('0xa')](_0xf4c6('0xb'),_0x43c8d9,'request\x20sent');logger['debug'](_0xf4c6('0xc'),_0x43c8d9,_0xf4c6('0xd'),JSON[_0xf4c6('0xe')](_0x85f432));if(_0x85f432[_0xf4c6('0xf')]){if(_0x85f432[_0xf4c6('0xf')]['code']===0x1f4){logger[_0xf4c6('0xf')](_0xf4c6('0xb'),_0x43c8d9,_0x85f432[_0xf4c6('0xf')]['message']);return _0x5b70e5(_0x85f432['error'][_0xf4c6('0x10')]);}logger['error'](_0xf4c6('0xb'),_0x43c8d9,_0x85f432[_0xf4c6('0xf')]['message']);return _0x4dfb7f(_0x85f432[_0xf4c6('0xf')][_0xf4c6('0x10')]);}else{logger['info'](_0xf4c6('0xb'),_0x43c8d9,_0xf4c6('0xd'));_0x4dfb7f(_0x85f432['result']['message']);}})['catch'](function(_0x2f7581){logger[_0xf4c6('0xf')](_0xf4c6('0xb'),_0x43c8d9,_0x2f7581);_0x5b70e5(_0x2f7581);});});} \ No newline at end of file +var _0xb1e9=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb1e9,0xc0));var _0x9b1e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb1e9[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x9b1e('0x0'));var moment=require(_0x9b1e('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b1e('0x2'));var fs=require('fs');var Redis=require(_0x9b1e('0x3'));var db=require(_0x9b1e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b1e('0x5'))(_0x9b1e('0x6'));var config=require(_0x9b1e('0x7'));var jayson=require(_0x9b1e('0x8'));var client=jayson[_0x9b1e('0x9')][_0x9b1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e36f6,_0x5e1584,_0xed85d3){return new BPromise(function(_0x4b57bb,_0x4a3bbb){return client['request'](_0x2e36f6,_0xed85d3)[_0x9b1e('0xb')](function(_0x345591){logger['info'](_0x9b1e('0xc'),_0x5e1584,_0x9b1e('0xd'));logger[_0x9b1e('0xe')](_0x9b1e('0xf'),_0x5e1584,'request\x20sent',JSON['stringify'](_0x345591));if(_0x345591[_0x9b1e('0x10')]){if(_0x345591[_0x9b1e('0x10')][_0x9b1e('0x11')]===0x1f4){logger[_0x9b1e('0x10')](_0x9b1e('0xc'),_0x5e1584,_0x345591[_0x9b1e('0x10')][_0x9b1e('0x12')]);return _0x4a3bbb(_0x345591[_0x9b1e('0x10')]['message']);}logger[_0x9b1e('0x10')](_0x9b1e('0xc'),_0x5e1584,_0x345591['error']['message']);return _0x4b57bb(_0x345591[_0x9b1e('0x10')][_0x9b1e('0x12')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x5e1584,_0x9b1e('0xd'));_0x4b57bb(_0x345591[_0x9b1e('0x13')][_0x9b1e('0x12')]);}})[_0x9b1e('0x14')](function(_0x1618c1){logger[_0x9b1e('0x10')](_0x9b1e('0xc'),_0x5e1584,_0x1618c1);_0x4a3bbb(_0x1618c1);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 3d474ec..9068c68 100644 --- a/server/api/cmCompany/index.js +++ b/server/api/cmCompany/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['isAuthenticated','index','describe','/:id','getContacts','post','create','/:id/contacts','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./cmCompany.controller','get'];(function(_0x165a48,_0x44bc9d){var _0x6f6735=function(_0x510ec3){while(--_0x510ec3){_0x165a48['push'](_0x165a48['shift']());}};_0x6f6735(++_0x44bc9d);}(_0x3e74,0x175));var _0x43e7=function(_0x1ca0b7,_0x278dd5){_0x1ca0b7=_0x1ca0b7-0x0;var _0x38ded1=_0x3e74[_0x1ca0b7];return _0x38ded1;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['post'](_0x43e7('0xe'),auth[_0x43e7('0x7')](),controller['addContacts']);router[_0x43e7('0xf')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file +var _0x9957=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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('./cmCompany.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0xe'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index a16a8c4..1914ae2 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 _0x7894=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x5cd441,_0x33fcef){var _0x28573c=function(_0x1d10b6){while(--_0x1d10b6){_0x5cd441['push'](_0x5cd441['shift']());}};_0x28573c(++_0x33fcef);}(_0x7894,0x170));var _0x4789=function(_0x5c1a88,_0x21488c){_0x5c1a88=_0x5c1a88-0x0;var _0x32a777=_0x7894[_0x5c1a88];return _0x32a777;};'use strict';var _=require(_0x4789('0x0'));var Sequelize=require(_0x4789('0x1'));module[_0x4789('0x2')]={'firstName':{'type':Sequelize[_0x4789('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x4789('0x3')]},'street':{'type':Sequelize[_0x4789('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x4789('0x3')]},'country':{'type':Sequelize[_0x4789('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4789('0x4')]},'phone':{'type':Sequelize[_0x4789('0x3')]},'mobile':{'type':Sequelize[_0x4789('0x3')]},'fax':{'type':Sequelize[_0x4789('0x3')]},'email':{'type':Sequelize[_0x4789('0x3')]},'url':{'type':Sequelize[_0x4789('0x3')]},'facebook':{'type':Sequelize[_0x4789('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x4789('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x4789('0x3')]},'line':{'type':Sequelize[_0x4789('0x3')]},'wechat':{'type':Sequelize[_0x4789('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x4789('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4789('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4789('0x7')],'defaultValue':Sequelize[_0x4789('0x8')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5f7b=['lodash','sequelize','STRING','INTEGER','UNSIGNED'];(function(_0x34e7d4,_0x11a2c8){var _0x358daf=function(_0x5560ad){while(--_0x5560ad){_0x34e7d4['push'](_0x34e7d4['shift']());}};_0x358daf(++_0x11a2c8);}(_0x5f7b,0x14a));var _0xb5f7=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x5f7b[_0x3070dc];return _0x431489;};'use strict';var _=require(_0xb5f7('0x0'));var Sequelize=require(_0xb5f7('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xb5f7('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb5f7('0x2')]},'street':{'type':Sequelize[_0xb5f7('0x2')]},'postalCode':{'type':Sequelize[_0xb5f7('0x2')]},'city':{'type':Sequelize[_0xb5f7('0x2')]},'country':{'type':Sequelize[_0xb5f7('0x2')]},'dateOfBirth':{'type':Sequelize[_0xb5f7('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xb5f7('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xb5f7('0x2')]},'email':{'type':Sequelize[_0xb5f7('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xb5f7('0x2')]},'fb_data':{'type':Sequelize[_0xb5f7('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xb5f7('0x2')]},'teams':{'type':Sequelize[_0xb5f7('0x2')]},'viber':{'type':Sequelize[_0xb5f7('0x2')]},'line':{'type':Sequelize[_0xb5f7('0x2')]},'wechat':{'type':Sequelize[_0xb5f7('0x2')]},'telegram':{'type':Sequelize[_0xb5f7('0x2')]},'UserId':{'type':Sequelize[_0xb5f7('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xb5f7('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xb5f7('0x2')]},'utcOffset':{'type':Sequelize[_0xb5f7('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 949a4bc..90715d6 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 _0x0e8f=['hasOwnProperty','nolimit','limit','sort','where','pick','color','from','tools_tags','select','cm_contacts','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','expr','search','sqlOperator','find','field','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','filter','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','\x27\x27\x27\x27','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.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','some','conditions','user','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.fax','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','catch','tags','columnName','displayName','CmCustomField','findAll','alias','values','body','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','destroy','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','JscriptySessionReport','bulkCreate','describe','each','duplicates','$or','ListId','findOrCreate','spread','show','omit','format','cf_%d','$and','pickBy','setFields','id\x20=\x20?','toParam','phone','filters','options','getTags','setTags','ContactId','include','includeAll','getHopperFinals','rawAttributes','getJscriptySessions','No\x20ListId\x20specified','binding_values','socket_timestamp','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','parse','meta','import','binding','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','localhost','socket.io-emitter','./cmContact.socket','sendStatus','status','end','count','offset','json','apply','reject','save','update','then','error','stack','name','index','CmContact','keys','length','startsWith','cf_','push','findOne','trimStart','all','fieldType','type','model','query','intersection','fields','attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0e8f,0x197));var _0xf0e8=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x0e8f[_0xbd08b4];return _0x314f1e;};'use strict';var pdf=require(_0xf0e8('0x0'));var emlformat=require(_0xf0e8('0x1'));var rimraf=require(_0xf0e8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0e8('0x3'));var rp=require('request-promise');var moment=require(_0xf0e8('0x4'));var BPromise=require(_0xf0e8('0x5'));var Mustache=require(_0xf0e8('0x6'));var util=require(_0xf0e8('0x7'));var path=require(_0xf0e8('0x8'));var sox=require(_0xf0e8('0x9'));var csv=require(_0xf0e8('0xa'));var ejs=require(_0xf0e8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf0e8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf0e8('0xa'));var querystring=require(_0xf0e8('0xd'));var Papa=require(_0xf0e8('0xe'));var Redis=require(_0xf0e8('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf0e8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf0e8('0x11'));var config=require(_0xf0e8('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xf0e8('0x13'),'port':0x18eb});var socket=require(_0xf0e8('0x14'))(new Redis(config['redis']));require(_0xf0e8('0x15'))['register'](socket);function respondWithStatusCode(_0x596097,_0x19c9e0){_0x19c9e0=_0x19c9e0||0xcc;return function(_0x5ce891){if(_0x5ce891){return _0x596097[_0xf0e8('0x16')](_0x19c9e0);}return _0x596097[_0xf0e8('0x17')](_0x19c9e0)[_0xf0e8('0x18')]();};}function respondWithResult(_0x200408,_0x4e1a12){_0x4e1a12=_0x4e1a12||0xc8;return function(_0x2ed3aa){if(_0x2ed3aa){return _0x200408['status'](_0x4e1a12)['json'](_0x2ed3aa);}};}function respondWithFilteredResult(_0xe9664d,_0x3f4814){return function(_0x4a4621){if(_0x4a4621){var _0x387f7f=_0x4a4621[_0xf0e8('0x19')],_0x31ff72=_0x3f4814['offset'],_0x51658f=_0x3f4814[_0xf0e8('0x1a')]+_0x3f4814['limit'],_0x4f1acf;if(_0x51658f>=_0x387f7f){_0x51658f=_0x387f7f;_0x4f1acf=0xc8;}else{_0x4f1acf=0xce;}_0xe9664d['status'](_0x4f1acf);return _0xe9664d['set']('Content-Range',_0x31ff72+'-'+_0x51658f+'/'+_0x387f7f)[_0xf0e8('0x1b')](_0x4a4621);}return null;};}function patchUpdates(_0x4609b6){return function(_0x14e460){try{jsonpatch[_0xf0e8('0x1c')](_0x14e460,_0x4609b6,!![]);}catch(_0x299838){return BPromise[_0xf0e8('0x1d')](_0x299838);}return _0x14e460[_0xf0e8('0x1e')]();};}function saveUpdates(_0x818851,_0x3453bc){return function(_0x4ad405){if(_0x4ad405){return _0x4ad405[_0xf0e8('0x1f')](_0x818851)['then'](function(_0x164a8d){return _0x164a8d;});}return null;};}function removeEntity(_0x231a0d,_0x19604c){return function(_0x4e8f03){if(_0x4e8f03){return _0x4e8f03['destroy']()[_0xf0e8('0x20')](function(){_0x231a0d[_0xf0e8('0x17')](0xcc)[_0xf0e8('0x18')]();});}};}function handleEntityNotFound(_0x548aab,_0xa189ed){return function(_0x1ad842){if(!_0x1ad842){_0x548aab[_0xf0e8('0x16')](0x194);}return _0x1ad842;};}function handleError(_0x23dca6,_0x4d36b9){_0x4d36b9=_0x4d36b9||0x1f4;return function(_0x429400){logger[_0xf0e8('0x21')](_0x429400[_0xf0e8('0x22')]);if(_0x429400[_0xf0e8('0x23')]){delete _0x429400[_0xf0e8('0x23')];}_0x23dca6['status'](_0x4d36b9)['send'](_0x429400);};}exports[_0xf0e8('0x24')]=function(_0x59477c,_0x4d9caa){var _0x2936de={},_0x2cb715={},_0x125b74={'count':0x0,'rows':[]};return db[_0xf0e8('0x25')]['describe']()[_0xf0e8('0x20')](function(_0x3691ae){var _0x2826c8=[];for(var _0x341314=0x0;_0x3413140x1){_0x38a246['or'](_0xf0e8('0x5e'),qs[_0xf0e8('0x5f')](_0x58e5e9),null);}else{if(qs['isNumeric'](_0x58e5e9)){_0x38a246['or'](_0xf0e8('0x60'),_0x58e5e9+'%');_0x38a246['or'](_0xf0e8('0x61'),_0x58e5e9+'%');_0x38a246['or'](_0xf0e8('0x62'),_0x58e5e9+'%');_0x38a246['or'](_0xf0e8('0x63'),_0x58e5e9+'%');}else if(qs[_0xf0e8('0x64')](_0x58e5e9)){_0x38a246['or'](_0xf0e8('0x65'),_0x58e5e9+'%');}else{_0x38a246['or'](_0xf0e8('0x66'),'%'+_0x58e5e9+'%');_0x38a246['or']('c.lastName\x20LIKE\x20?','%'+_0x58e5e9+'%');_0x38a246['or']('c.email\x20LIKE\x20?','%'+_0x58e5e9+'%');}}}}_0x5df74d[_0xf0e8('0x39')](_0x38a246);_0x5df74d[_0xf0e8('0x67')](_0xf0e8('0x68'));var _0x5bd8a6={'type':db[_0xf0e8('0x69')][_0xf0e8('0x6a')][_0xf0e8('0x6b')],'raw':!![]};var _0x362779=_0x5df74d[_0xf0e8('0x6c')]()['field'](_0xf0e8('0x68'));if(_0x2936de[_0xf0e8('0x6d')]){_0x2936de[_0xf0e8('0x6d')][_0xf0e8('0x4d')](function(_0x5e2f1a){_0x5df74d[_0xf0e8('0x6d')]('c.'+_0x5e2f1a[0x0],_0x5e2f1a[0x1]===_0xf0e8('0x6e')?![]:!![]);});}if(!_[_0xf0e8('0x6f')](_0x5c41e1)){_0x5df74d[_0xf0e8('0x70')](_0x211a9b);_0x362779[_0xf0e8('0x39')](_0xf0e8('0x71'),_0x5c41e1);}BPromise[_0xf0e8('0x72')]()[_0xf0e8('0x20')](function(){if(_0x2ba63a&&!_[_0xf0e8('0x73')](_0x2ba63a[_0xf0e8('0x74')],[_0xf0e8('0x48'),'User'])){return _0x59477c[_0xf0e8('0x75')][_0xf0e8('0x76')]({'attributes':['id'],'raw':!![]})[_0xf0e8('0x20')](function(_0x21f62c){if(_[_0xf0e8('0x6f')](_0x21f62c)){_0x362779[_0xf0e8('0x39')](_0xf0e8('0x77'));_0x5df74d['where'](_0xf0e8('0x77'));}else{_0x362779[_0xf0e8('0x39')](_0xf0e8('0x56'),_[_0xf0e8('0x4c')](_0x21f62c,'id'));_0x5df74d[_0xf0e8('0x39')]('c.ListId\x20IN\x20?',_[_0xf0e8('0x4c')](_0x21f62c,'id'));}});}else{return;}})['then'](function(){db[_0xf0e8('0x78')][_0xf0e8('0x31')](_0x362779[_0xf0e8('0x79')](),_0x5bd8a6)['then'](function(_0x477276){_0x125b74['count']=_0x477276['length'];if(_0x125b74[_0xf0e8('0x19')]===0x0)return[];return db[_0xf0e8('0x78')][_0xf0e8('0x31')](_0x79c707[_0xf0e8('0x79')](),_0x5bd8a6);})['then'](function(_0x2ee8fb){_0x41cc99=_[_0xf0e8('0x7a')](_0x2ee8fb,'id');_0x5bd8a6=_[_0xf0e8('0x7b')](_0x5bd8a6,{'model':db[_0xf0e8('0x25')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x59477c[_0xf0e8('0x31')][_0xf0e8('0x33')]){_0x2936de[_0xf0e8('0x34')][_0xf0e8('0x4d')](function(_0x22bfba){_0x5df74d[_0xf0e8('0x48')]('c.'+_0x22bfba);});}else{_0x5df74d['field']('c.id');_0x5df74d[_0xf0e8('0x48')](_0xf0e8('0x7c'));_0x5df74d[_0xf0e8('0x48')](_0xf0e8('0x7d'));_0x5df74d[_0xf0e8('0x48')]('c.phone');_0x5df74d[_0xf0e8('0x48')]('c.mobile');_0x5df74d[_0xf0e8('0x48')](_0xf0e8('0x7e'));_0x5df74d[_0xf0e8('0x48')](_0xf0e8('0x7f'));_0x5df74d['field'](_0xf0e8('0x80'));_0x5df74d['field'](_0xf0e8('0x81'));_0x5df74d['field'](_0xf0e8('0x82'),_0xf0e8('0x83'));}if(_0x2936de['limit'])_0x5df74d[_0xf0e8('0x37')](_0x2936de['limit']);if(_0x2936de[_0xf0e8('0x1a')])_0x5df74d[_0xf0e8('0x1a')](_0x2936de[_0xf0e8('0x1a')]);return db[_0xf0e8('0x78')][_0xf0e8('0x31')](_0x5df74d['toString'](),_0x5bd8a6);})[_0xf0e8('0x20')](function(_0x318c85){_0x318c85[_0xf0e8('0x4d')](function(_0x108198){if(_0x108198['TagIds']){_0x108198['Tags']=[];_0x108198[_0xf0e8('0x83')][_0xf0e8('0x4b')](',')[_0xf0e8('0x4d')](function(_0x372752){_0x108198[_0xf0e8('0x84')]['push'](_0x41cc99[_0x372752]);});}delete _0x108198[_0xf0e8('0x83')];});_0x125b74[_0xf0e8('0x85')]=_0x318c85;return _0x125b74;})[_0xf0e8('0x20')](respondWithFilteredResult(_0x4d9caa,_0x2936de));});})['catch'](handleError(_0x4d9caa,null));};exports['destroy']=function(_0xfc4b0b,_0xdd3fbf){return db[_0xf0e8('0x25')][_0xf0e8('0x47')]({'where':{'id':_0xfc4b0b[_0xf0e8('0x86')]['id']}})[_0xf0e8('0x20')](handleEntityNotFound(_0xdd3fbf,null))[_0xf0e8('0x20')](removeEntity(_0xdd3fbf,null))[_0xf0e8('0x87')](handleError(_0xdd3fbf,null));};exports['describe']=function(_0x67f960,_0x594790){return db[_0xf0e8('0x25')]['describe']()['then'](function(_0x4dfc58){delete _0x4dfc58[_0xf0e8('0x88')];for(var _0x381673=0x0;_0x381673=_0x5895da){_0x2ac99b=_0x5895da;_0x28e070=0xc8;}else{_0x28e070=0xce;}_0x1b6338[_0xdbd2('0x1f')](_0x28e070);return _0x1b6338[_0xdbd2('0x23')](_0xdbd2('0x24'),_0x24594d+'-'+_0x2ac99b+'/'+_0x5895da)[_0xdbd2('0x21')](_0x2002a4);}return null;};}function patchUpdates(_0x265203){return function(_0x27ec6b){try{jsonpatch[_0xdbd2('0x25')](_0x27ec6b,_0x265203,!![]);}catch(_0x35beb0){return BPromise['reject'](_0x35beb0);}return _0x27ec6b[_0xdbd2('0x26')]();};}function saveUpdates(_0x3eb695,_0x17bc69){return function(_0x2a6774){if(_0x2a6774){return _0x2a6774[_0xdbd2('0x27')](_0x3eb695)[_0xdbd2('0x28')](function(_0x555538){return _0x555538;});}return null;};}function removeEntity(_0x50bddc,_0x11d108){return function(_0x44d7ce){if(_0x44d7ce){return _0x44d7ce[_0xdbd2('0x29')]()[_0xdbd2('0x28')](function(){_0x50bddc['status'](0xcc)[_0xdbd2('0x20')]();});}};}function handleEntityNotFound(_0x249a58,_0x2df97e){return function(_0x566086){if(!_0x566086){_0x249a58[_0xdbd2('0x1e')](0x194);}return _0x566086;};}function handleError(_0x27e9ee,_0x4bd26b){_0x4bd26b=_0x4bd26b||0x1f4;return function(_0x5a3b4d){logger[_0xdbd2('0x2a')](_0x5a3b4d[_0xdbd2('0x2b')]);if(_0x5a3b4d[_0xdbd2('0x2c')]){delete _0x5a3b4d[_0xdbd2('0x2c')];}_0x27e9ee['status'](_0x4bd26b)[_0xdbd2('0x2d')](_0x5a3b4d);};}exports[_0xdbd2('0x2e')]=function(_0xa0c97d,_0x4d28be){var _0x377550={},_0xa7fcd6={},_0x102704={'count':0x0,'rows':[]};return db['CmContact']['describe']()['then'](function(_0x6f6517){var _0x1d6d58=[];for(var _0x219a2a=0x0;_0x219a2a0x1){_0x118bb9['or'](_0xdbd2('0x6c'),qs[_0xdbd2('0x6d')](_0x431a3d),null);}else{if(qs['isNumeric'](_0x431a3d)){_0x118bb9['or']('c.id\x20LIKE\x20?',_0x431a3d+'%');_0x118bb9['or'](_0xdbd2('0x6e'),_0x431a3d+'%');_0x118bb9['or'](_0xdbd2('0x6f'),_0x431a3d+'%');_0x118bb9['or'](_0xdbd2('0x70'),_0x431a3d+'%');}else if(qs[_0xdbd2('0x71')](_0x431a3d)){_0x118bb9['or'](_0xdbd2('0x72'),_0x431a3d+'%');}else{_0x118bb9['or']('c.firstName\x20LIKE\x20?','%'+_0x431a3d+'%');_0x118bb9['or']('c.lastName\x20LIKE\x20?','%'+_0x431a3d+'%');_0x118bb9['or'](_0xdbd2('0x72'),'%'+_0x431a3d+'%');}}}}_0x1e1d62[_0xdbd2('0x4d')](_0x118bb9);_0x1e1d62[_0xdbd2('0x73')](_0xdbd2('0x74'));var _0x572390={'type':db['Sequelize'][_0xdbd2('0x75')][_0xdbd2('0x76')],'raw':!![]};var _0x395e0e=_0x1e1d62[_0xdbd2('0x77')]()[_0xdbd2('0x44')]('c.id');if(_0x377550[_0xdbd2('0x42')]){_0x377550[_0xdbd2('0x42')][_0xdbd2('0x63')](function(_0x3ac3d7){_0x1e1d62[_0xdbd2('0x42')]('c.'+_0x3ac3d7[0x0],_0x3ac3d7[0x1]===_0xdbd2('0x78')?![]:!![]);});}if(!_[_0xdbd2('0x62')](_0x23168e)){_0x1e1d62[_0xdbd2('0x79')](_0x44a379);_0x395e0e[_0xdbd2('0x4d')](_0xdbd2('0x7a'),_0x23168e);}BPromise['resolve']()[_0xdbd2('0x28')](function(){if(_0x387380&&!_['some'](_0x387380[_0xdbd2('0x52')],[_0xdbd2('0x44'),'User'])){return _0xa0c97d[_0xdbd2('0x7b')][_0xdbd2('0x7c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2c37ad){if(_[_0xdbd2('0x62')](_0x2c37ad)){_0x395e0e['where'](_0xdbd2('0x7d'));_0x1e1d62['where'](_0xdbd2('0x7d'));}else{_0x395e0e[_0xdbd2('0x4d')](_0xdbd2('0x65'),_['map'](_0x2c37ad,'id'));_0x1e1d62['where'](_0xdbd2('0x65'),_[_0xdbd2('0x57')](_0x2c37ad,'id'));}});}else{return;}})[_0xdbd2('0x28')](function(){db[_0xdbd2('0x7e')]['query'](_0x395e0e[_0xdbd2('0x7f')](),_0x572390)[_0xdbd2('0x28')](function(_0x1bfdbb){_0x102704[_0xdbd2('0x22')]=_0x1bfdbb['length'];if(_0x102704[_0xdbd2('0x22')]===0x0)return[];return db[_0xdbd2('0x7e')]['query'](_0x1a11ae['toString'](),_0x572390);})[_0xdbd2('0x28')](function(_0xd966ca){_0x42582e=_['keyBy'](_0xd966ca,'id');_0x572390=_[_0xdbd2('0x80')](_0x572390,{'model':db[_0xdbd2('0x81')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa0c97d[_0xdbd2('0x38')][_0xdbd2('0x3d')]){_0x377550[_0xdbd2('0x3c')][_0xdbd2('0x63')](function(_0x4d613c){_0x1e1d62[_0xdbd2('0x44')]('c.'+_0x4d613c);});}else{_0x1e1d62[_0xdbd2('0x44')](_0xdbd2('0x74'));_0x1e1d62[_0xdbd2('0x44')]('c.firstName');_0x1e1d62['field']('c.lastName');_0x1e1d62[_0xdbd2('0x44')]('c.phone');_0x1e1d62['field'](_0xdbd2('0x82'));_0x1e1d62[_0xdbd2('0x44')](_0xdbd2('0x83'));_0x1e1d62[_0xdbd2('0x44')](_0xdbd2('0x84'));_0x1e1d62['field'](_0xdbd2('0x85'));_0x1e1d62['field']('c.deletedAt');_0x1e1d62['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xdbd2('0x86'));}if(_0x377550[_0xdbd2('0x40')])_0x1e1d62[_0xdbd2('0x40')](_0x377550[_0xdbd2('0x40')]);if(_0x377550['offset'])_0x1e1d62[_0xdbd2('0x41')](_0x377550[_0xdbd2('0x41')]);return db['sequelize'][_0xdbd2('0x38')](_0x1e1d62[_0xdbd2('0x7f')](),_0x572390);})[_0xdbd2('0x28')](function(_0x4b1a28){_0x4b1a28['forEach'](function(_0x477600){if(_0x477600['TagIds']){_0x477600[_0xdbd2('0x87')]=[];_0x477600[_0xdbd2('0x86')]['split'](',')[_0xdbd2('0x63')](function(_0xbf830a){_0x477600[_0xdbd2('0x87')][_0xdbd2('0x61')](_0x42582e[_0xbf830a]);});}delete _0x477600['TagIds'];});_0x102704[_0xdbd2('0x88')]=_0x4b1a28;return _0x102704;})[_0xdbd2('0x28')](respondWithFilteredResult(_0x4d28be,_0x377550));});})[_0xdbd2('0x89')](handleError(_0x4d28be,null));};exports[_0xdbd2('0x29')]=function(_0x5dbf7a,_0x3ce068){return db[_0xdbd2('0x81')][_0xdbd2('0x53')]({'where':{'id':_0x5dbf7a[_0xdbd2('0x8a')]['id']}})[_0xdbd2('0x28')](handleEntityNotFound(_0x3ce068,null))[_0xdbd2('0x28')](removeEntity(_0x3ce068,null))[_0xdbd2('0x89')](handleError(_0x3ce068,null));};exports[_0xdbd2('0x8b')]=function(_0x555781,_0x5353bf){return db['CmContact'][_0xdbd2('0x8b')]()[_0xdbd2('0x28')](function(_0x1203bb){delete _0x1203bb[_0xdbd2('0x8c')];for(var _0x3cb1af=0x0;_0x3cb1af{}\s\\|]/g,'-');_0x2a7337(null,util[_0x8eff('0x21')](_0x8eff('0x22'),path['basename'](_0x1e9ad0[_0x8eff('0x20')],path['extname'](_0x1e9ad0[_0x8eff('0x20')])),Date[_0x8eff('0x23')](),path[_0x8eff('0x24')](_0x1e9ad0[_0x8eff('0x20')])));}})});router[_0x8eff('0x15')]('/csv',upload[_0x8eff('0x25')](_0x8eff('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x8eff('0x1c')]({'destination':function(_0x5ec3d7,_0x40404b,_0x3b698b){_0x3b698b(null,path[_0x8eff('0x1d')](config[_0x8eff('0x1e')],_0x8eff('0x1f')));},'filename':function(_0x2e8067,_0x516173,_0x3e1607){_0x516173[_0x8eff('0x20')]=_0x516173[_0x8eff('0x20')][_0x8eff('0x27')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e1607(null,util[_0x8eff('0x21')](_0x8eff('0x22'),path['basename'](_0x516173['originalname'],path[_0x8eff('0x24')](_0x516173[_0x8eff('0x20')])),Date[_0x8eff('0x23')](),path['extname'](_0x516173[_0x8eff('0x20')])));}})});router[_0x8eff('0x15')](_0x8eff('0x28'),upload[_0x8eff('0x25')](_0x8eff('0x26')),controller[_0x8eff('0x29')]);router[_0x8eff('0x15')](_0x8eff('0x2a'),auth[_0x8eff('0xb')](),controller[_0x8eff('0x2b')]);router[_0x8eff('0x2c')](_0x8eff('0xc'),auth['isAuthenticated'](),controller[_0x8eff('0x2d')]);router[_0x8eff('0x2e')](_0x8eff('0xc'),auth[_0x8eff('0xb')](),controller['destroy']);module[_0x8eff('0x2f')]=router; \ No newline at end of file +var _0x9c5a=['/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','merge','create','/create_many','bulkCreate','/:id/tags','setTags','diskStorage','join','root','server/files/tmp','originalname','%s-%s%s','basename','extname','now','/csv','file','uploadCsv','replace','format','/upload','single','/upload/:id','import','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmContact.controller','isAuthenticated','get','/describe','/:id','show','getTags','getHoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x35c514,_0x22bb8a){var _0x448f20=function(_0x54f93a){while(--_0x54f93a){_0x35c514['push'](_0x35c514['shift']());}};_0x448f20(++_0x22bb8a);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0xf393ea,_0xbf5f66){_0xf393ea=_0xf393ea-0x0;var _0x1dd13d=_0x9c5a[_0xf393ea];return _0x1dd13d;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var auth=require(_0xa9c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa9c5('0x6'));var controller=require(_0xa9c5('0x7'));router['get']('/',auth[_0xa9c5('0x8')](),controller['index']);router[_0xa9c5('0x9')](_0xa9c5('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xa9c5('0x9')](_0xa9c5('0xb'),auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0x9')]('/:id/tags',auth[_0xa9c5('0x8')](),controller[_0xa9c5('0xd')]);router['get']('/:id/hoppers',auth[_0xa9c5('0x8')](),controller[_0xa9c5('0xe')]);router[_0xa9c5('0x9')](_0xa9c5('0xf'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x10')]);router[_0xa9c5('0x9')](_0xa9c5('0x11'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x12')]);router['get'](_0xa9c5('0x13'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x14')]);router[_0xa9c5('0x15')](_0xa9c5('0x16'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x17')]);router[_0xa9c5('0x15')]('/',auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x18')]);router['post'](_0xa9c5('0x19'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x1a')]);router['post'](_0xa9c5('0x1b'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x1c')]);var upload=multer({'storage':multer[_0xa9c5('0x1d')]({'destination':function(_0x452a9b,_0x349f27,_0x3b8d4d){_0x3b8d4d(null,path[_0xa9c5('0x1e')](config[_0xa9c5('0x1f')],_0xa9c5('0x20')));},'filename':function(_0x113c8f,_0x2d95f8,_0x54f8b9){_0x2d95f8[_0xa9c5('0x21')]=_0x2d95f8[_0xa9c5('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x54f8b9(null,util['format'](_0xa9c5('0x22'),path[_0xa9c5('0x23')](_0x2d95f8[_0xa9c5('0x21')],path[_0xa9c5('0x24')](_0x2d95f8[_0xa9c5('0x21')])),Date[_0xa9c5('0x25')](),path['extname'](_0x2d95f8['originalname'])));}})});router[_0xa9c5('0x15')](_0xa9c5('0x26'),upload['single'](_0xa9c5('0x27')),controller[_0xa9c5('0x28')]);var upload=multer({'storage':multer[_0xa9c5('0x1d')]({'destination':function(_0x32fc7d,_0x4cbba1,_0x40f08b){_0x40f08b(null,path[_0xa9c5('0x1e')](config['root'],'server/files/tmp'));},'filename':function(_0x242771,_0x4cd5e6,_0x1762ac){_0x4cd5e6[_0xa9c5('0x21')]=_0x4cd5e6['originalname'][_0xa9c5('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1762ac(null,util[_0xa9c5('0x2a')]('%s-%s%s',path[_0xa9c5('0x23')](_0x4cd5e6[_0xa9c5('0x21')],path[_0xa9c5('0x24')](_0x4cd5e6[_0xa9c5('0x21')])),Date[_0xa9c5('0x25')](),path['extname'](_0x4cd5e6[_0xa9c5('0x21')])));}})});router['post'](_0xa9c5('0x2b'),upload[_0xa9c5('0x2c')](_0xa9c5('0x27')),controller['upload']);router[_0xa9c5('0x15')](_0xa9c5('0x2d'),auth['isAuthenticated'](),controller[_0xa9c5('0x2e')]);router[_0xa9c5('0x2f')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x30')]);router[_0xa9c5('0x31')](_0xa9c5('0xb'),auth['isAuthenticated'](),controller[_0xa9c5('0x32')]);module[_0xa9c5('0x33')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 48c9dd6..2ef5d75 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0689=['PHONE','exports','STRING','INTEGER'];(function(_0x1cda9f,_0x39ce5c){var _0x6cc26b=function(_0x256d61){while(--_0x256d61){_0x1cda9f['push'](_0x1cda9f['shift']());}};_0x6cc26b(++_0x39ce5c);}(_0x0689,0x161));var _0x9068=function(_0x772156,_0x5b5faa){_0x772156=_0x772156-0x0;var _0x79234b=_0x0689[_0x772156];return _0x79234b;};'use strict';var Sequelize=require('sequelize');module[_0x9068('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x9068('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x9068('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x9068('0x1')],'defaultValue':_0x9068('0x3')},'OrderBy':{'type':Sequelize[_0x9068('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x7c1a=['STRING','sequelize','exports','INTEGER'];(function(_0x1847fb,_0x938456){var _0x268823=function(_0x2363fc){while(--_0x2363fc){_0x1847fb['push'](_0x1847fb['shift']());}};_0x268823(++_0x938456);}(_0x7c1a,0x159));var _0xa7c1=function(_0xe81026,_0x146e58){_0xe81026=_0xe81026-0x0;var _0x466277=_0x7c1a[_0xe81026];return _0x466277;};'use strict';var Sequelize=require(_0xa7c1('0x0'));module[_0xa7c1('0x1')]={'CmContactId':{'type':Sequelize[_0xa7c1('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xa7c1('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa7c1('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa7c1('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xa7c1('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 2345170..cfa52d0 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6dd=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','CmContactHasItems','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','body','user','get'];(function(_0x156627,_0x27ec9a){var _0x174ce9=function(_0x12b9c2){while(--_0x12b9c2){_0x156627['push'](_0x156627['shift']());}};_0x174ce9(++_0x27ec9a);}(_0xf6dd,0xa6));var _0xdf6d=function(_0x3da2c3,_0x1e982a){_0x3da2c3=_0x3da2c3-0x0;var _0x45ec5c=_0xf6dd[_0x3da2c3];return _0x45ec5c;};'use strict';var pdf=require(_0xdf6d('0x0'));var emlformat=require(_0xdf6d('0x1'));var rimraf=require(_0xdf6d('0x2'));var zipdir=require(_0xdf6d('0x3'));var jsonpatch=require(_0xdf6d('0x4'));var rp=require(_0xdf6d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdf6d('0x6'));var path=require(_0xdf6d('0x7'));var sox=require(_0xdf6d('0x8'));var csv=require('to-csv');var ejs=require(_0xdf6d('0x9'));var fs=require('fs');var _=require(_0xdf6d('0xa'));var squel=require(_0xdf6d('0xb'));var crypto=require('crypto');var jsforce=require(_0xdf6d('0xc'));var deskjs=require(_0xdf6d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdf6d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdf6d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdf6d('0x10'));var hardwareService=require(_0xdf6d('0x11'));var logger=require('../../config/logger')(_0xdf6d('0x12'));var utils=require(_0xdf6d('0x13'));var config=require(_0xdf6d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35306f,_0x4dbb23){_0x4dbb23=_0x4dbb23||0xcc;return function(_0x1500f4){if(_0x1500f4){return _0x35306f[_0xdf6d('0x15')](_0x4dbb23);}return _0x35306f[_0xdf6d('0x16')](_0x4dbb23)[_0xdf6d('0x17')]();};}function respondWithResult(_0x33a937,_0x3f18f2){_0x3f18f2=_0x3f18f2||0xc8;return function(_0x4486cc){if(_0x4486cc){return _0x33a937[_0xdf6d('0x16')](_0x3f18f2)[_0xdf6d('0x18')](_0x4486cc);}};}function respondWithFilteredResult(_0x156fcf,_0x5b9e24){return function(_0x55cfad){if(_0x55cfad){var _0x311a2e=_0x55cfad[_0xdf6d('0x19')],_0xd9471f=_0x5b9e24[_0xdf6d('0x1a')],_0x3ec3ed=_0x5b9e24[_0xdf6d('0x1a')]+_0x5b9e24[_0xdf6d('0x1b')],_0x357a42;if(_0x3ec3ed>=_0x311a2e){_0x3ec3ed=_0x311a2e;_0x357a42=0xc8;}else{_0x357a42=0xce;}_0x156fcf[_0xdf6d('0x16')](_0x357a42);return _0x156fcf['set'](_0xdf6d('0x1c'),_0xd9471f+'-'+_0x3ec3ed+'/'+_0x311a2e)[_0xdf6d('0x18')](_0x55cfad);}return null;};}function patchUpdates(_0x181835){return function(_0x2e34){try{jsonpatch['apply'](_0x2e34,_0x181835,!![]);}catch(_0x18dedc){return BPromise[_0xdf6d('0x1d')](_0x18dedc);}return _0x2e34[_0xdf6d('0x1e')]();};}function saveUpdates(_0x5a8aa0,_0x5177fd){return function(_0x147a5c){if(_0x147a5c){return _0x147a5c[_0xdf6d('0x1f')](_0x5a8aa0)[_0xdf6d('0x20')](function(_0x1ded20){return _0x1ded20;});}return null;};}function removeEntity(_0x3c6e44,_0x4bbd12){return function(_0x3ee5a7){if(_0x3ee5a7){return _0x3ee5a7[_0xdf6d('0x21')]()[_0xdf6d('0x20')](function(){var _0x2ca56f=_0x3ee5a7['get']({'plain':!![]});var _0x42278e=_0xdf6d('0x22');return db['UserProfileResource'][_0xdf6d('0x21')]({'where':{'type':_0x42278e,'resourceId':_0x2ca56f['id']}})[_0xdf6d('0x20')](function(){return _0x3ee5a7;});})[_0xdf6d('0x20')](function(){_0x3c6e44['status'](0xcc)[_0xdf6d('0x17')]();});}};}function handleEntityNotFound(_0x3f03da,_0x2a2adb){return function(_0x5e6b92){if(!_0x5e6b92){_0x3f03da['sendStatus'](0x194);}return _0x5e6b92;};}function handleError(_0x29ccd0,_0xe6d5fb){_0xe6d5fb=_0xe6d5fb||0x1f4;return function(_0x46d925){logger[_0xdf6d('0x23')](_0x46d925['stack']);if(_0x46d925[_0xdf6d('0x24')]){delete _0x46d925['name'];}_0x29ccd0[_0xdf6d('0x16')](_0xe6d5fb)[_0xdf6d('0x25')](_0x46d925);};}exports[_0xdf6d('0x26')]=function(_0x448155,_0x2f23ca){var _0x5b6375={},_0x17146b={},_0x59d791={'count':0x0,'rows':[]};var _0x49218e=_[_0xdf6d('0x27')](db[_0xdf6d('0x28')][_0xdf6d('0x29')],function(_0x3727c0){return{'name':_0x3727c0[_0xdf6d('0x2a')],'type':_0x3727c0[_0xdf6d('0x2b')][_0xdf6d('0x2c')]};});_0x17146b[_0xdf6d('0x2d')]=_['map'](_0x49218e,_0xdf6d('0x24'));_0x17146b['query']=_[_0xdf6d('0x2e')](_0x448155[_0xdf6d('0x2f')]);_0x17146b[_0xdf6d('0x30')]=_[_0xdf6d('0x31')](_0x17146b[_0xdf6d('0x2d')],_0x17146b[_0xdf6d('0x2f')]);_0x5b6375[_0xdf6d('0x32')]=_[_0xdf6d('0x31')](_0x17146b[_0xdf6d('0x2d')],qs[_0xdf6d('0x33')](_0x448155['query'][_0xdf6d('0x33')]));_0x5b6375[_0xdf6d('0x32')]=_0x5b6375['attributes'][_0xdf6d('0x34')]?_0x5b6375['attributes']:_0x17146b['model'];if(!_0x448155['query'][_0xdf6d('0x35')](_0xdf6d('0x36'))){_0x5b6375[_0xdf6d('0x1b')]=qs[_0xdf6d('0x1b')](_0x448155[_0xdf6d('0x2f')][_0xdf6d('0x1b')]);_0x5b6375[_0xdf6d('0x1a')]=qs[_0xdf6d('0x1a')](_0x448155['query']['offset']);}_0x5b6375[_0xdf6d('0x37')]=qs[_0xdf6d('0x38')](_0x448155[_0xdf6d('0x2f')][_0xdf6d('0x38')]);_0x5b6375['where']=qs[_0xdf6d('0x30')](_[_0xdf6d('0x39')](_0x448155[_0xdf6d('0x2f')],_0x17146b[_0xdf6d('0x30')]),_0x49218e);if(_0x448155[_0xdf6d('0x2f')][_0xdf6d('0x3a')]){_0x5b6375['where']=_[_0xdf6d('0x3b')](_0x5b6375[_0xdf6d('0x3c')],{'$or':_['map'](_0x49218e,function(_0x7a0bd3){if(_0x7a0bd3[_0xdf6d('0x2b')]!==_0xdf6d('0x3d')){var _0x91bce1={};_0x91bce1[_0x7a0bd3[_0xdf6d('0x24')]]={'$like':'%'+_0x448155[_0xdf6d('0x2f')][_0xdf6d('0x3a')]+'%'};return _0x91bce1;}})});}_0x5b6375=_[_0xdf6d('0x3b')]({},_0x5b6375,_0x448155[_0xdf6d('0x3e')]);var _0x3ec35c={'where':_0x5b6375[_0xdf6d('0x3c')]};return db['CmContactHasItem']['count'](_0x3ec35c)[_0xdf6d('0x20')](function(_0x3f761d){_0x59d791[_0xdf6d('0x19')]=_0x3f761d;if(_0x448155[_0xdf6d('0x2f')][_0xdf6d('0x3f')]){_0x5b6375['include']=[{'all':!![]}];}return db[_0xdf6d('0x28')][_0xdf6d('0x40')](_0x5b6375);})[_0xdf6d('0x20')](function(_0x37e3b9){_0x59d791[_0xdf6d('0x41')]=_0x37e3b9;return _0x59d791;})[_0xdf6d('0x20')](respondWithFilteredResult(_0x2f23ca,_0x5b6375))[_0xdf6d('0x42')](handleError(_0x2f23ca,null));};exports[_0xdf6d('0x43')]=function(_0x21d5af,_0x372973){var _0x4a2a01={'raw':!![],'where':{'id':_0x21d5af[_0xdf6d('0x44')]['id']}},_0x425d92={};_0x425d92[_0xdf6d('0x2d')]=_['keys'](db['CmContactHasItem'][_0xdf6d('0x29')]);_0x425d92['query']=_['keys'](_0x21d5af[_0xdf6d('0x2f')]);_0x425d92[_0xdf6d('0x30')]=_[_0xdf6d('0x31')](_0x425d92[_0xdf6d('0x2d')],_0x425d92[_0xdf6d('0x2f')]);_0x4a2a01['attributes']=_[_0xdf6d('0x31')](_0x425d92[_0xdf6d('0x2d')],qs['fields'](_0x21d5af[_0xdf6d('0x2f')][_0xdf6d('0x33')]));_0x4a2a01[_0xdf6d('0x32')]=_0x4a2a01[_0xdf6d('0x32')][_0xdf6d('0x34')]?_0x4a2a01[_0xdf6d('0x32')]:_0x425d92['model'];if(_0x21d5af[_0xdf6d('0x2f')]['includeAll']){_0x4a2a01[_0xdf6d('0x45')]=[{'all':!![]}];}_0x4a2a01=_['merge']({},_0x4a2a01,_0x21d5af['options']);return db[_0xdf6d('0x28')][_0xdf6d('0x46')](_0x4a2a01)[_0xdf6d('0x20')](handleEntityNotFound(_0x372973,null))[_0xdf6d('0x20')](respondWithResult(_0x372973,null))[_0xdf6d('0x42')](handleError(_0x372973,null));};exports['create']=function(_0x10bcd5,_0x4f385e){return db[_0xdf6d('0x28')]['create'](_0x10bcd5[_0xdf6d('0x47')],{})[_0xdf6d('0x20')](function(_0x58a739){var _0x2c089f=_0x10bcd5[_0xdf6d('0x48')][_0xdf6d('0x49')]({'plain':!![]});if(!_0x2c089f)throw new Error(_0xdf6d('0x4a'));if(_0x2c089f['role']===_0xdf6d('0x48')){var _0x1522c1=_0x58a739['get']({'plain':!![]});var _0x2e0a5e=_0xdf6d('0x22');return db[_0xdf6d('0x4b')]['find']({'where':{'name':_0x2e0a5e,'userProfileId':_0x2c089f[_0xdf6d('0x4c')]},'raw':!![]})[_0xdf6d('0x20')](function(_0x1690f4){if(_0x1690f4&&_0x1690f4[_0xdf6d('0x4d')]===0x0){return db[_0xdf6d('0x4e')]['create']({'name':_0x1522c1[_0xdf6d('0x24')],'resourceId':_0x1522c1['id'],'type':_0x1690f4[_0xdf6d('0x24')],'sectionId':_0x1690f4['id']},{})[_0xdf6d('0x20')](function(){return _0x58a739;});}else{return _0x58a739;}})['catch'](function(_0x51074f){logger[_0xdf6d('0x23')](_0xdf6d('0x4f'),_0x51074f);throw _0x51074f;});}return _0x58a739;})[_0xdf6d('0x20')](respondWithResult(_0x4f385e,0xc9))[_0xdf6d('0x42')](handleError(_0x4f385e,null));};exports[_0xdf6d('0x1f')]=function(_0x3d3a00,_0x3d1873){if(_0x3d3a00[_0xdf6d('0x47')]['id']){delete _0x3d3a00['body']['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0x3d3a00[_0xdf6d('0x44')]['id']}})[_0xdf6d('0x20')](handleEntityNotFound(_0x3d1873,null))[_0xdf6d('0x20')](saveUpdates(_0x3d3a00[_0xdf6d('0x47')],null))['then'](respondWithResult(_0x3d1873,null))['catch'](handleError(_0x3d1873,null));};exports['destroy']=function(_0x1f2207,_0x2af439){return db[_0xdf6d('0x28')][_0xdf6d('0x46')]({'where':{'id':_0x1f2207[_0xdf6d('0x44')]['id']}})[_0xdf6d('0x20')](handleEntityNotFound(_0x2af439,null))['then'](removeEntity(_0x2af439,null))['catch'](handleError(_0x2af439,null));}; \ No newline at end of file +var _0x1fad=['Content-Range','apply','reject','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','show','params','length','includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x17959c,_0x439950){var _0x5b8968=function(_0x51a048){while(--_0x51a048){_0x17959c['push'](_0x17959c['shift']());}};_0x5b8968(++_0x439950);}(_0x1fad,0x18c));var _0xd1fa=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0x1fad[_0x4d8a8f];return _0xfc4adc;};'use strict';var pdf=require(_0xd1fa('0x0'));var emlformat=require(_0xd1fa('0x1'));var rimraf=require(_0xd1fa('0x2'));var zipdir=require(_0xd1fa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd1fa('0x4'));var moment=require('moment');var BPromise=require(_0xd1fa('0x5'));var Mustache=require(_0xd1fa('0x6'));var util=require(_0xd1fa('0x7'));var path=require(_0xd1fa('0x8'));var sox=require(_0xd1fa('0x9'));var csv=require(_0xd1fa('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd1fa('0xb'));var squel=require(_0xd1fa('0xc'));var crypto=require(_0xd1fa('0xd'));var jsforce=require(_0xd1fa('0xe'));var deskjs=require(_0xd1fa('0xf'));var toCsv=require(_0xd1fa('0xa'));var querystring=require(_0xd1fa('0x10'));var Papa=require(_0xd1fa('0x11'));var Redis=require(_0xd1fa('0x12'));var authService=require(_0xd1fa('0x13'));var qs=require(_0xd1fa('0x14'));var as=require(_0xd1fa('0x15'));var hardwareService=require(_0xd1fa('0x16'));var logger=require(_0xd1fa('0x17'))(_0xd1fa('0x18'));var utils=require(_0xd1fa('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf5d6a1,_0x338754){_0x338754=_0x338754||0xcc;return function(_0x2411db){if(_0x2411db){return _0xf5d6a1[_0xd1fa('0x1a')](_0x338754);}return _0xf5d6a1['status'](_0x338754)[_0xd1fa('0x1b')]();};}function respondWithResult(_0x5b679c,_0x41096c){_0x41096c=_0x41096c||0xc8;return function(_0x51c9c5){if(_0x51c9c5){return _0x5b679c[_0xd1fa('0x1c')](_0x41096c)[_0xd1fa('0x1d')](_0x51c9c5);}};}function respondWithFilteredResult(_0x4629d4,_0x3374d0){return function(_0x266085){if(_0x266085){var _0x44a38e=_0x266085[_0xd1fa('0x1e')],_0x2154fa=_0x3374d0[_0xd1fa('0x1f')],_0x2e4e2e=_0x3374d0[_0xd1fa('0x1f')]+_0x3374d0[_0xd1fa('0x20')],_0x30b4af;if(_0x2e4e2e>=_0x44a38e){_0x2e4e2e=_0x44a38e;_0x30b4af=0xc8;}else{_0x30b4af=0xce;}_0x4629d4[_0xd1fa('0x1c')](_0x30b4af);return _0x4629d4[_0xd1fa('0x21')](_0xd1fa('0x22'),_0x2154fa+'-'+_0x2e4e2e+'/'+_0x44a38e)[_0xd1fa('0x1d')](_0x266085);}return null;};}function patchUpdates(_0x4daba6){return function(_0x137210){try{jsonpatch[_0xd1fa('0x23')](_0x137210,_0x4daba6,!![]);}catch(_0x320b95){return BPromise[_0xd1fa('0x24')](_0x320b95);}return _0x137210[_0xd1fa('0x25')]();};}function saveUpdates(_0xbebf26,_0x2895f0){return function(_0x2bb50a){if(_0x2bb50a){return _0x2bb50a[_0xd1fa('0x26')](_0xbebf26)[_0xd1fa('0x27')](function(_0x22b066){return _0x22b066;});}return null;};}function removeEntity(_0x1cbdc6,_0x30e5f9){return function(_0x9d0e21){if(_0x9d0e21){return _0x9d0e21['destroy']()[_0xd1fa('0x27')](function(){var _0x255ec5=_0x9d0e21[_0xd1fa('0x28')]({'plain':!![]});var _0x39785b=_0xd1fa('0x29');return db[_0xd1fa('0x2a')][_0xd1fa('0x2b')]({'where':{'type':_0x39785b,'resourceId':_0x255ec5['id']}})['then'](function(){return _0x9d0e21;});})[_0xd1fa('0x27')](function(){_0x1cbdc6[_0xd1fa('0x1c')](0xcc)[_0xd1fa('0x1b')]();});}};}function handleEntityNotFound(_0x3ffe5e,_0x23aebe){return function(_0x510b41){if(!_0x510b41){_0x3ffe5e[_0xd1fa('0x1a')](0x194);}return _0x510b41;};}function handleError(_0x56da42,_0x3f5b14){_0x3f5b14=_0x3f5b14||0x1f4;return function(_0x4a0be1){logger[_0xd1fa('0x2c')](_0x4a0be1[_0xd1fa('0x2d')]);if(_0x4a0be1[_0xd1fa('0x2e')]){delete _0x4a0be1[_0xd1fa('0x2e')];}_0x56da42[_0xd1fa('0x1c')](_0x3f5b14)['send'](_0x4a0be1);};}exports[_0xd1fa('0x2f')]=function(_0x58f700,_0x461e5e){var _0x17376f={},_0x52fbf4={},_0x502ca7={'count':0x0,'rows':[]};var _0x98490a=_[_0xd1fa('0x30')](db[_0xd1fa('0x31')][_0xd1fa('0x32')],function(_0x17fb3a){return{'name':_0x17fb3a[_0xd1fa('0x33')],'type':_0x17fb3a[_0xd1fa('0x34')]['key']};});_0x52fbf4['model']=_[_0xd1fa('0x30')](_0x98490a,_0xd1fa('0x2e'));_0x52fbf4[_0xd1fa('0x35')]=_[_0xd1fa('0x36')](_0x58f700[_0xd1fa('0x35')]);_0x52fbf4[_0xd1fa('0x37')]=_[_0xd1fa('0x38')](_0x52fbf4[_0xd1fa('0x39')],_0x52fbf4[_0xd1fa('0x35')]);_0x17376f[_0xd1fa('0x3a')]=_[_0xd1fa('0x38')](_0x52fbf4[_0xd1fa('0x39')],qs[_0xd1fa('0x3b')](_0x58f700['query'][_0xd1fa('0x3b')]));_0x17376f[_0xd1fa('0x3a')]=_0x17376f['attributes']['length']?_0x17376f[_0xd1fa('0x3a')]:_0x52fbf4['model'];if(!_0x58f700[_0xd1fa('0x35')]['hasOwnProperty'](_0xd1fa('0x3c'))){_0x17376f['limit']=qs[_0xd1fa('0x20')](_0x58f700[_0xd1fa('0x35')][_0xd1fa('0x20')]);_0x17376f[_0xd1fa('0x1f')]=qs[_0xd1fa('0x1f')](_0x58f700[_0xd1fa('0x35')][_0xd1fa('0x1f')]);}_0x17376f[_0xd1fa('0x3d')]=qs[_0xd1fa('0x3e')](_0x58f700[_0xd1fa('0x35')]['sort']);_0x17376f[_0xd1fa('0x3f')]=qs[_0xd1fa('0x37')](_['pick'](_0x58f700[_0xd1fa('0x35')],_0x52fbf4[_0xd1fa('0x37')]),_0x98490a);if(_0x58f700[_0xd1fa('0x35')][_0xd1fa('0x40')]){_0x17376f[_0xd1fa('0x3f')]=_[_0xd1fa('0x41')](_0x17376f[_0xd1fa('0x3f')],{'$or':_[_0xd1fa('0x30')](_0x98490a,function(_0x42d7dd){if(_0x42d7dd[_0xd1fa('0x34')]!==_0xd1fa('0x42')){var _0x79229a={};_0x79229a[_0x42d7dd[_0xd1fa('0x2e')]]={'$like':'%'+_0x58f700['query'][_0xd1fa('0x40')]+'%'};return _0x79229a;}})});}_0x17376f=_['merge']({},_0x17376f,_0x58f700[_0xd1fa('0x43')]);var _0x1b27c5={'where':_0x17376f[_0xd1fa('0x3f')]};return db[_0xd1fa('0x31')][_0xd1fa('0x1e')](_0x1b27c5)[_0xd1fa('0x27')](function(_0x2d72d9){_0x502ca7['count']=_0x2d72d9;if(_0x58f700[_0xd1fa('0x35')]['includeAll']){_0x17376f['include']=[{'all':!![]}];}return db[_0xd1fa('0x31')][_0xd1fa('0x44')](_0x17376f);})[_0xd1fa('0x27')](function(_0x5193e1){_0x502ca7[_0xd1fa('0x45')]=_0x5193e1;return _0x502ca7;})[_0xd1fa('0x27')](respondWithFilteredResult(_0x461e5e,_0x17376f))['catch'](handleError(_0x461e5e,null));};exports[_0xd1fa('0x46')]=function(_0x2adbb6,_0x4681ca){var _0x131a45={'raw':!![],'where':{'id':_0x2adbb6[_0xd1fa('0x47')]['id']}},_0x76ac41={};_0x76ac41[_0xd1fa('0x39')]=_['keys'](db['CmContactHasItem'][_0xd1fa('0x32')]);_0x76ac41[_0xd1fa('0x35')]=_[_0xd1fa('0x36')](_0x2adbb6[_0xd1fa('0x35')]);_0x76ac41[_0xd1fa('0x37')]=_['intersection'](_0x76ac41['model'],_0x76ac41[_0xd1fa('0x35')]);_0x131a45['attributes']=_[_0xd1fa('0x38')](_0x76ac41[_0xd1fa('0x39')],qs['fields'](_0x2adbb6['query'][_0xd1fa('0x3b')]));_0x131a45[_0xd1fa('0x3a')]=_0x131a45[_0xd1fa('0x3a')][_0xd1fa('0x48')]?_0x131a45[_0xd1fa('0x3a')]:_0x76ac41[_0xd1fa('0x39')];if(_0x2adbb6[_0xd1fa('0x35')][_0xd1fa('0x49')]){_0x131a45[_0xd1fa('0x4a')]=[{'all':!![]}];}_0x131a45=_[_0xd1fa('0x41')]({},_0x131a45,_0x2adbb6[_0xd1fa('0x43')]);return db[_0xd1fa('0x31')]['find'](_0x131a45)[_0xd1fa('0x27')](handleEntityNotFound(_0x4681ca,null))['then'](respondWithResult(_0x4681ca,null))[_0xd1fa('0x4b')](handleError(_0x4681ca,null));};exports[_0xd1fa('0x4c')]=function(_0x2df47b,_0x1a1019){return db['CmContactHasItem'][_0xd1fa('0x4c')](_0x2df47b[_0xd1fa('0x4d')],{})[_0xd1fa('0x27')](function(_0x44a9ff){var _0x186da3=_0x2df47b[_0xd1fa('0x4e')][_0xd1fa('0x28')]({'plain':!![]});if(!_0x186da3)throw new Error(_0xd1fa('0x4f'));if(_0x186da3[_0xd1fa('0x50')]===_0xd1fa('0x4e')){var _0x538642=_0x44a9ff[_0xd1fa('0x28')]({'plain':!![]});var _0x528448=_0xd1fa('0x29');return db[_0xd1fa('0x51')][_0xd1fa('0x52')]({'where':{'name':_0x528448,'userProfileId':_0x186da3[_0xd1fa('0x53')]},'raw':!![]})[_0xd1fa('0x27')](function(_0x53650b){if(_0x53650b&&_0x53650b[_0xd1fa('0x54')]===0x0){return db[_0xd1fa('0x2a')]['create']({'name':_0x538642['name'],'resourceId':_0x538642['id'],'type':_0x53650b[_0xd1fa('0x2e')],'sectionId':_0x53650b['id']},{})['then'](function(){return _0x44a9ff;});}else{return _0x44a9ff;}})['catch'](function(_0x31649d){logger[_0xd1fa('0x2c')](_0xd1fa('0x55'),_0x31649d);throw _0x31649d;});}return _0x44a9ff;})[_0xd1fa('0x27')](respondWithResult(_0x1a1019,0xc9))['catch'](handleError(_0x1a1019,null));};exports[_0xd1fa('0x26')]=function(_0xf171db,_0x126e00){if(_0xf171db[_0xd1fa('0x4d')]['id']){delete _0xf171db[_0xd1fa('0x4d')]['id'];}return db['CmContactHasItem'][_0xd1fa('0x52')]({'where':{'id':_0xf171db[_0xd1fa('0x47')]['id']}})[_0xd1fa('0x27')](handleEntityNotFound(_0x126e00,null))[_0xd1fa('0x27')](saveUpdates(_0xf171db['body'],null))[_0xd1fa('0x27')](respondWithResult(_0x126e00,null))['catch'](handleError(_0x126e00,null));};exports['destroy']=function(_0x505978,_0x1bd969){return db[_0xd1fa('0x31')][_0xd1fa('0x52')]({'where':{'id':_0x505978['params']['id']}})[_0xd1fa('0x27')](handleEntityNotFound(_0x1bd969,null))[_0xd1fa('0x27')](removeEntity(_0x1bd969,null))['catch'](handleError(_0x1bd969,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index a4dca90..c36481f 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11e5=['path','../../config/environment','define','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x47c9e7,_0x44e5e8){var _0x485836=function(_0x4b1360){while(--_0x4b1360){_0x47c9e7['push'](_0x47c9e7['shift']());}};_0x485836(++_0x44e5e8);}(_0x11e5,0x8b));var _0x511e=function(_0x542da8,_0x509c26){_0x542da8=_0x542da8-0x0;var _0x533d7e=_0x11e5[_0x542da8];return _0x533d7e;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var logger=require(_0x511e('0x1'))(_0x511e('0x2'));var moment=require('moment');var BPromise=require(_0x511e('0x3'));var rp=require(_0x511e('0x4'));var fs=require('fs');var path=require(_0x511e('0x5'));var rimraf=require('rimraf');var config=require(_0x511e('0x6'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x342539,_0x323f8c){return _0x342539[_0x511e('0x7')]('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['path','exports','define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xafc4,0x69));var _0x4afc=function(_0x50ceef,_0x5536ec){_0x50ceef=_0x50ceef-0x0;var _0x298218=_0xafc4[_0x50ceef];return _0x298218;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index a931fa9..146a57e 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1f1=['stringify','code','error','message','result','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xc1f1,0x122));var _0x1c1f=function(_0x56085e,_0x5c69e9){_0x56085e=_0x56085e-0x0;var _0x4de130=_0xc1f1[_0x56085e];return _0x4de130;};'use strict';var _=require('lodash');var util=require(_0x1c1f('0x0'));var moment=require(_0x1c1f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1c1f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c1f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c1f('0x4'))('rpc');var config=require(_0x1c1f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1c1f('0x6')][_0x1c1f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d44be,_0x33ccb8,_0x2dd1e4){return new BPromise(function(_0x34b9fc,_0x4209bb){return client['request'](_0x3d44be,_0x2dd1e4)[_0x1c1f('0x8')](function(_0x5b7875){logger[_0x1c1f('0x9')](_0x1c1f('0xa'),_0x33ccb8,_0x1c1f('0xb'));logger[_0x1c1f('0xc')](_0x1c1f('0xd'),_0x33ccb8,_0x1c1f('0xb'),JSON[_0x1c1f('0xe')](_0x5b7875));if(_0x5b7875['error']){if(_0x5b7875['error'][_0x1c1f('0xf')]===0x1f4){logger[_0x1c1f('0x10')](_0x1c1f('0xa'),_0x33ccb8,_0x5b7875['error'][_0x1c1f('0x11')]);return _0x4209bb(_0x5b7875[_0x1c1f('0x10')][_0x1c1f('0x11')]);}logger[_0x1c1f('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x33ccb8,_0x5b7875['error'][_0x1c1f('0x11')]);return _0x34b9fc(_0x5b7875[_0x1c1f('0x10')][_0x1c1f('0x11')]);}else{logger[_0x1c1f('0x9')](_0x1c1f('0xa'),_0x33ccb8,_0x1c1f('0xb'));_0x34b9fc(_0x5b7875[_0x1c1f('0x12')][_0x1c1f('0x11')]);}})['catch'](function(_0x57b2ed){logger[_0x1c1f('0x10')](_0x1c1f('0xa'),_0x33ccb8,_0x57b2ed);_0x4209bb(_0x57b2ed);});});} \ No newline at end of file +var _0x2884=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0xf3d277,_0x5b8991){var _0x2c2e99=function(_0x5f513a){while(--_0x5f513a){_0xf3d277['push'](_0xf3d277['shift']());}};_0x2c2e99(++_0x5b8991);}(_0x2884,0x11a));var _0x4288=function(_0x97ab47,_0x5cdab2){_0x97ab47=_0x97ab47-0x0;var _0x2d291f=_0x2884[_0x97ab47];return _0x2d291f;};'use strict';var _=require(_0x4288('0x0'));var util=require(_0x4288('0x1'));var moment=require(_0x4288('0x2'));var BPromise=require('bluebird');var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require(_0x4288('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4288('0x5'));var logger=require(_0x4288('0x6'))('rpc');var config=require(_0x4288('0x7'));var jayson=require(_0x4288('0x8'));var client=jayson[_0x4288('0x9')][_0x4288('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18e69a,_0x55c999,_0x341f80){return new BPromise(function(_0x43150a,_0x5ef497){return client[_0x4288('0xb')](_0x18e69a,_0x341f80)['then'](function(_0x238a77){logger[_0x4288('0xc')](_0x4288('0xd'),_0x55c999,_0x4288('0xe'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x55c999,_0x4288('0xe'),JSON[_0x4288('0xf')](_0x238a77));if(_0x238a77[_0x4288('0x10')]){if(_0x238a77['error'][_0x4288('0x11')]===0x1f4){logger[_0x4288('0x10')](_0x4288('0xd'),_0x55c999,_0x238a77['error'][_0x4288('0x12')]);return _0x5ef497(_0x238a77[_0x4288('0x10')][_0x4288('0x12')]);}logger[_0x4288('0x10')](_0x4288('0xd'),_0x55c999,_0x238a77['error'][_0x4288('0x12')]);return _0x43150a(_0x238a77[_0x4288('0x10')]['message']);}else{logger[_0x4288('0xc')](_0x4288('0xd'),_0x55c999,_0x4288('0xe'));_0x43150a(_0x238a77[_0x4288('0x13')][_0x4288('0x12')]);}})[_0x4288('0x14')](function(_0xe3dd7){logger[_0x4288('0x10')](_0x4288('0xd'),_0x55c999,_0xe3dd7);_0x5ef497(_0xe3dd7);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 78e543f..8786826 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd63f=['get','isAuthenticated','index','/:id','post','create','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0xd63f,0xab));var _0xfd63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd63f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xfd63('0x0'));var util=require(_0xfd63('0x1'));var path=require('path');var timeout=require(_0xfd63('0x2'));var express=require(_0xfd63('0x3'));var router=express[_0xfd63('0x4')]();var auth=require(_0xfd63('0x5'));var interaction=require(_0xfd63('0x6'));var config=require(_0xfd63('0x7'));var controller=require(_0xfd63('0x8'));router[_0xfd63('0x9')]('/',auth[_0xfd63('0xa')](),controller[_0xfd63('0xb')]);router['get'](_0xfd63('0xc'),auth[_0xfd63('0xa')](),controller['show']);router[_0xfd63('0xd')]('/',auth[_0xfd63('0xa')](),controller[_0xfd63('0xe')]);router[_0xfd63('0xf')](_0xfd63('0xc'),auth['isAuthenticated'](),controller[_0xfd63('0x10')]);router['delete']('/:id',auth[_0xfd63('0xa')](),controller[_0xfd63('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf83f=['multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','/:id','show','post','create','update','delete','exports'];(function(_0x19d52e,_0xf84043){var _0x3be91b=function(_0x25edd6){while(--_0x25edd6){_0x19d52e['push'](_0x19d52e['shift']());}};_0x3be91b(++_0xf84043);}(_0xf83f,0x14a));var _0xff83=function(_0x1554fe,_0x3e6281){_0x1554fe=_0x1554fe-0x0;var _0x843e87=_0xf83f[_0x1554fe];return _0x843e87;};'use strict';var multer=require(_0xff83('0x0'));var util=require(_0xff83('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff83('0x2')]();var auth=require(_0xff83('0x3'));var interaction=require(_0xff83('0x4'));var config=require(_0xff83('0x5'));var controller=require(_0xff83('0x6'));router['get']('/',auth[_0xff83('0x7')](),controller['index']);router['get'](_0xff83('0x8'),auth[_0xff83('0x7')](),controller[_0xff83('0x9')]);router[_0xff83('0xa')]('/',auth[_0xff83('0x7')](),controller[_0xff83('0xb')]);router['put'](_0xff83('0x8'),auth[_0xff83('0x7')](),controller[_0xff83('0xc')]);router[_0xff83('0xd')](_0xff83('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xff83('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index b514b04..4225837 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9420=['sequelize','exports'];(function(_0x1b76e6,_0x598520){var _0x333b53=function(_0x106e6a){while(--_0x106e6a){_0x1b76e6['push'](_0x1b76e6['shift']());}};_0x333b53(++_0x598520);}(_0x9420,0x186));var _0x0942=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x9420[_0x257642];return _0x3d813b;};'use strict';var Sequelize=require(_0x0942('0x0'));module[_0x0942('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x8137=['sequelize','exports','STRING'];(function(_0x458db6,_0x4d19a0){var _0x389315=function(_0x4f2586){while(--_0x4f2586){_0x458db6['push'](_0x458db6['shift']());}};_0x389315(++_0x4d19a0);}(_0x8137,0xba));var _0x7813=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x8137[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0x7813('0x0'));module[_0x7813('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize[_0x7813('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index b72b0c3..27acd41 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x328b=['moment','mustache','util','path','sox','ejs','lodash','jsforce','to-csv','querystring','../../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','reject','save','update','destroy','then','CmContactHasPhones','UserProfileResource','stack','name','map','CmContactHasPhone','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','include','catch','show','params','keys','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0xdb33e1,_0x1f19ec){var _0x3d077b=function(_0x4b758d){while(--_0x4b758d){_0xdb33e1['push'](_0xdb33e1['shift']());}};_0x3d077b(++_0x1f19ec);}(_0x328b,0x177));var _0xb328=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x328b[_0x22cc16];return _0x399b70;};'use strict';var pdf=require(_0xb328('0x0'));var emlformat=require(_0xb328('0x1'));var rimraf=require(_0xb328('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb328('0x3'));var rp=require(_0xb328('0x4'));var moment=require(_0xb328('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb328('0x6'));var util=require(_0xb328('0x7'));var path=require(_0xb328('0x8'));var sox=require(_0xb328('0x9'));var csv=require('to-csv');var ejs=require(_0xb328('0xa'));var fs=require('fs');var _=require(_0xb328('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb328('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb328('0xd'));var querystring=require(_0xb328('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb328('0xf'));var as=require(_0xb328('0x10'));var hardwareService=require(_0xb328('0x11'));var logger=require(_0xb328('0x12'))('api');var utils=require(_0xb328('0x13'));var config=require(_0xb328('0x14'));var db=require(_0xb328('0x15'))['db'];function respondWithStatusCode(_0x4f3ea0,_0x40bbc7){_0x40bbc7=_0x40bbc7||0xcc;return function(_0x561682){if(_0x561682){return _0x4f3ea0[_0xb328('0x16')](_0x40bbc7);}return _0x4f3ea0[_0xb328('0x17')](_0x40bbc7)[_0xb328('0x18')]();};}function respondWithResult(_0x36d519,_0xdf3eae){_0xdf3eae=_0xdf3eae||0xc8;return function(_0x1178f9){if(_0x1178f9){return _0x36d519[_0xb328('0x17')](_0xdf3eae)[_0xb328('0x19')](_0x1178f9);}};}function respondWithFilteredResult(_0x4ec101,_0x1f1dbe){return function(_0x4d2f2b){if(_0x4d2f2b){var _0x1bf23a=_0x4d2f2b[_0xb328('0x1a')],_0x3edd9a=_0x1f1dbe[_0xb328('0x1b')],_0x592431=_0x1f1dbe['offset']+_0x1f1dbe['limit'],_0x35d82e;if(_0x592431>=_0x1bf23a){_0x592431=_0x1bf23a;_0x35d82e=0xc8;}else{_0x35d82e=0xce;}_0x4ec101[_0xb328('0x17')](_0x35d82e);return _0x4ec101[_0xb328('0x1c')](_0xb328('0x1d'),_0x3edd9a+'-'+_0x592431+'/'+_0x1bf23a)['json'](_0x4d2f2b);}return null;};}function patchUpdates(_0x1272fb){return function(_0x3f4cea){try{jsonpatch[_0xb328('0x1e')](_0x3f4cea,_0x1272fb,!![]);}catch(_0x1a9ebc){return BPromise[_0xb328('0x1f')](_0x1a9ebc);}return _0x3f4cea[_0xb328('0x20')]();};}function saveUpdates(_0x358657,_0x25c4e7){return function(_0x28c5cd){if(_0x28c5cd){return _0x28c5cd[_0xb328('0x21')](_0x358657)['then'](function(_0x4d7d0a){return _0x4d7d0a;});}return null;};}function removeEntity(_0x2b12d1,_0x5c86bd){return function(_0x22efd7){if(_0x22efd7){return _0x22efd7[_0xb328('0x22')]()[_0xb328('0x23')](function(){var _0x5e35b0=_0x22efd7['get']({'plain':!![]});var _0x403be1=_0xb328('0x24');return db[_0xb328('0x25')][_0xb328('0x22')]({'where':{'type':_0x403be1,'resourceId':_0x5e35b0['id']}})[_0xb328('0x23')](function(){return _0x22efd7;});})[_0xb328('0x23')](function(){_0x2b12d1[_0xb328('0x17')](0xcc)[_0xb328('0x18')]();});}};}function handleEntityNotFound(_0x586655,_0x3d7e66){return function(_0x157e35){if(!_0x157e35){_0x586655[_0xb328('0x16')](0x194);}return _0x157e35;};}function handleError(_0x2c9248,_0x1060df){_0x1060df=_0x1060df||0x1f4;return function(_0x245c37){logger['error'](_0x245c37[_0xb328('0x26')]);if(_0x245c37[_0xb328('0x27')]){delete _0x245c37[_0xb328('0x27')];}_0x2c9248[_0xb328('0x17')](_0x1060df)['send'](_0x245c37);};}exports['index']=function(_0x1fcc84,_0x1bb20e){var _0x4e97e4={},_0x7f2246={},_0xa1fd84={'count':0x0,'rows':[]};var _0x27f419=_[_0xb328('0x28')](db[_0xb328('0x29')][_0xb328('0x2a')],function(_0x35f3b6){return{'name':_0x35f3b6['fieldName'],'type':_0x35f3b6[_0xb328('0x2b')]['key']};});_0x7f2246[_0xb328('0x2c')]=_[_0xb328('0x28')](_0x27f419,'name');_0x7f2246['query']=_['keys'](_0x1fcc84[_0xb328('0x2d')]);_0x7f2246[_0xb328('0x2e')]=_[_0xb328('0x2f')](_0x7f2246[_0xb328('0x2c')],_0x7f2246['query']);_0x4e97e4[_0xb328('0x30')]=_['intersection'](_0x7f2246[_0xb328('0x2c')],qs[_0xb328('0x31')](_0x1fcc84[_0xb328('0x2d')][_0xb328('0x31')]));_0x4e97e4['attributes']=_0x4e97e4['attributes'][_0xb328('0x32')]?_0x4e97e4[_0xb328('0x30')]:_0x7f2246[_0xb328('0x2c')];if(!_0x1fcc84[_0xb328('0x2d')][_0xb328('0x33')](_0xb328('0x34'))){_0x4e97e4['limit']=qs[_0xb328('0x35')](_0x1fcc84[_0xb328('0x2d')][_0xb328('0x35')]);_0x4e97e4[_0xb328('0x1b')]=qs[_0xb328('0x1b')](_0x1fcc84[_0xb328('0x2d')][_0xb328('0x1b')]);}_0x4e97e4['order']=qs['sort'](_0x1fcc84['query'][_0xb328('0x36')]);_0x4e97e4[_0xb328('0x37')]=qs[_0xb328('0x2e')](_[_0xb328('0x38')](_0x1fcc84[_0xb328('0x2d')],_0x7f2246[_0xb328('0x2e')]),_0x27f419);if(_0x1fcc84[_0xb328('0x2d')]['filter']){_0x4e97e4[_0xb328('0x37')]=_['merge'](_0x4e97e4[_0xb328('0x37')],{'$or':_[_0xb328('0x28')](_0x27f419,function(_0xf22dde){if(_0xf22dde['type']!=='VIRTUAL'){var _0x29dc3b={};_0x29dc3b[_0xf22dde[_0xb328('0x27')]]={'$like':'%'+_0x1fcc84['query']['filter']+'%'};return _0x29dc3b;}})});}_0x4e97e4=_[_0xb328('0x39')]({},_0x4e97e4,_0x1fcc84['options']);var _0x506694={'where':_0x4e97e4[_0xb328('0x37')]};return db[_0xb328('0x29')][_0xb328('0x1a')](_0x506694)[_0xb328('0x23')](function(_0x40baa8){_0xa1fd84[_0xb328('0x1a')]=_0x40baa8;if(_0x1fcc84[_0xb328('0x2d')]['includeAll']){_0x4e97e4[_0xb328('0x3a')]=[{'all':!![]}];}return db[_0xb328('0x29')]['findAll'](_0x4e97e4);})['then'](function(_0x229c08){_0xa1fd84['rows']=_0x229c08;return _0xa1fd84;})[_0xb328('0x23')](respondWithFilteredResult(_0x1bb20e,_0x4e97e4))[_0xb328('0x3b')](handleError(_0x1bb20e,null));};exports[_0xb328('0x3c')]=function(_0x418eed,_0x3af331){var _0x4fdd65={'raw':!![],'where':{'id':_0x418eed[_0xb328('0x3d')]['id']}},_0x3ba535={};_0x3ba535['model']=_[_0xb328('0x3e')](db[_0xb328('0x29')]['rawAttributes']);_0x3ba535[_0xb328('0x2d')]=_[_0xb328('0x3e')](_0x418eed[_0xb328('0x2d')]);_0x3ba535[_0xb328('0x2e')]=_['intersection'](_0x3ba535[_0xb328('0x2c')],_0x3ba535[_0xb328('0x2d')]);_0x4fdd65[_0xb328('0x30')]=_[_0xb328('0x2f')](_0x3ba535[_0xb328('0x2c')],qs[_0xb328('0x31')](_0x418eed['query'][_0xb328('0x31')]));_0x4fdd65['attributes']=_0x4fdd65[_0xb328('0x30')][_0xb328('0x32')]?_0x4fdd65[_0xb328('0x30')]:_0x3ba535[_0xb328('0x2c')];if(_0x418eed[_0xb328('0x2d')][_0xb328('0x3f')]){_0x4fdd65[_0xb328('0x3a')]=[{'all':!![]}];}_0x4fdd65=_[_0xb328('0x39')]({},_0x4fdd65,_0x418eed[_0xb328('0x40')]);return db[_0xb328('0x29')][_0xb328('0x41')](_0x4fdd65)[_0xb328('0x23')](handleEntityNotFound(_0x3af331,null))[_0xb328('0x23')](respondWithResult(_0x3af331,null))[_0xb328('0x3b')](handleError(_0x3af331,null));};exports[_0xb328('0x42')]=function(_0x4f7f0a,_0x258549){return db[_0xb328('0x29')]['create'](_0x4f7f0a[_0xb328('0x43')],{})[_0xb328('0x23')](function(_0x32d424){var _0x95075d=_0x4f7f0a[_0xb328('0x44')][_0xb328('0x45')]({'plain':!![]});if(!_0x95075d)throw new Error(_0xb328('0x46'));if(_0x95075d[_0xb328('0x47')]===_0xb328('0x44')){var _0x1fa2e0=_0x32d424[_0xb328('0x45')]({'plain':!![]});var _0x6463bb='CmContactHasPhones';return db['UserProfileSection'][_0xb328('0x41')]({'where':{'name':_0x6463bb,'userProfileId':_0x95075d[_0xb328('0x48')]},'raw':!![]})[_0xb328('0x23')](function(_0x836813){if(_0x836813&&_0x836813[_0xb328('0x49')]===0x0){return db[_0xb328('0x25')]['create']({'name':_0x1fa2e0[_0xb328('0x27')],'resourceId':_0x1fa2e0['id'],'type':_0x836813['name'],'sectionId':_0x836813['id']},{})[_0xb328('0x23')](function(){return _0x32d424;});}else{return _0x32d424;}})[_0xb328('0x3b')](function(_0x318291){logger[_0xb328('0x4a')](_0xb328('0x4b'),_0x318291);throw _0x318291;});}return _0x32d424;})[_0xb328('0x23')](respondWithResult(_0x258549,0xc9))[_0xb328('0x3b')](handleError(_0x258549,null));};exports[_0xb328('0x21')]=function(_0x3269be,_0x330017){if(_0x3269be[_0xb328('0x43')]['id']){delete _0x3269be[_0xb328('0x43')]['id'];}return db[_0xb328('0x29')][_0xb328('0x41')]({'where':{'id':_0x3269be['params']['id']}})[_0xb328('0x23')](handleEntityNotFound(_0x330017,null))[_0xb328('0x23')](saveUpdates(_0x3269be[_0xb328('0x43')],null))[_0xb328('0x23')](respondWithResult(_0x330017,null))[_0xb328('0x3b')](handleError(_0x330017,null));};exports['destroy']=function(_0x42d436,_0x2831aa){return db[_0xb328('0x29')][_0xb328('0x41')]({'where':{'id':_0x42d436[_0xb328('0x3d')]['id']}})[_0xb328('0x23')](handleEntityNotFound(_0x2831aa,null))[_0xb328('0x23')](removeEntity(_0x2831aa,null))[_0xb328('0x3b')](handleError(_0x2831aa,null));}; \ No newline at end of file +var _0x407c=['UserProfileResource','error','name','send','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','VIRTUAL','filter','options','CmContactHasPhone','count','rows','params','includeAll','include','merge','find','catch','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','get','CmContactHasPhones'];(function(_0x485c9f,_0x399a20){var _0x2ba76e=function(_0x3598d4){while(--_0x3598d4){_0x485c9f['push'](_0x485c9f['shift']());}};_0x2ba76e(++_0x399a20);}(_0x407c,0x10a));var _0xc407=function(_0x23710a,_0x2a5257){_0x23710a=_0x23710a-0x0;var _0xb876d9=_0x407c[_0x23710a];return _0xb876d9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc407('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc407('0x1'));var rp=require(_0xc407('0x2'));var moment=require(_0xc407('0x3'));var BPromise=require(_0xc407('0x4'));var Mustache=require(_0xc407('0x5'));var util=require('util');var path=require(_0xc407('0x6'));var sox=require(_0xc407('0x7'));var csv=require(_0xc407('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc407('0x9'));var squel=require('squel');var crypto=require(_0xc407('0xa'));var jsforce=require(_0xc407('0xb'));var deskjs=require(_0xc407('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc407('0xd'));var Papa=require('papaparse');var Redis=require(_0xc407('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc407('0xf'));var hardwareService=require(_0xc407('0x10'));var logger=require('../../config/logger')(_0xc407('0x11'));var utils=require(_0xc407('0x12'));var config=require(_0xc407('0x13'));var db=require(_0xc407('0x14'))['db'];function respondWithStatusCode(_0x13d2d9,_0x39db9b){_0x39db9b=_0x39db9b||0xcc;return function(_0x3de857){if(_0x3de857){return _0x13d2d9[_0xc407('0x15')](_0x39db9b);}return _0x13d2d9[_0xc407('0x16')](_0x39db9b)[_0xc407('0x17')]();};}function respondWithResult(_0x4e9bd4,_0x548e15){_0x548e15=_0x548e15||0xc8;return function(_0x4cb080){if(_0x4cb080){return _0x4e9bd4[_0xc407('0x16')](_0x548e15)[_0xc407('0x18')](_0x4cb080);}};}function respondWithFilteredResult(_0x30f163,_0x2c6fdc){return function(_0x431f8c){if(_0x431f8c){var _0x8f7b18=_0x431f8c['count'],_0x4412ee=_0x2c6fdc[_0xc407('0x19')],_0x1b393f=_0x2c6fdc[_0xc407('0x19')]+_0x2c6fdc['limit'],_0x4297ed;if(_0x1b393f>=_0x8f7b18){_0x1b393f=_0x8f7b18;_0x4297ed=0xc8;}else{_0x4297ed=0xce;}_0x30f163[_0xc407('0x16')](_0x4297ed);return _0x30f163[_0xc407('0x1a')](_0xc407('0x1b'),_0x4412ee+'-'+_0x1b393f+'/'+_0x8f7b18)[_0xc407('0x18')](_0x431f8c);}return null;};}function patchUpdates(_0x1ad5e4){return function(_0x5dfe71){try{jsonpatch[_0xc407('0x1c')](_0x5dfe71,_0x1ad5e4,!![]);}catch(_0x54d3ea){return BPromise[_0xc407('0x1d')](_0x54d3ea);}return _0x5dfe71['save']();};}function saveUpdates(_0x22b5a1,_0xf202ce){return function(_0x2d6ce7){if(_0x2d6ce7){return _0x2d6ce7[_0xc407('0x1e')](_0x22b5a1)[_0xc407('0x1f')](function(_0x3759c8){return _0x3759c8;});}return null;};}function removeEntity(_0x3b8a88,_0x43f166){return function(_0x30a771){if(_0x30a771){return _0x30a771['destroy']()[_0xc407('0x1f')](function(){var _0x63bdd3=_0x30a771[_0xc407('0x20')]({'plain':!![]});var _0x554168=_0xc407('0x21');return db[_0xc407('0x22')]['destroy']({'where':{'type':_0x554168,'resourceId':_0x63bdd3['id']}})[_0xc407('0x1f')](function(){return _0x30a771;});})[_0xc407('0x1f')](function(){_0x3b8a88[_0xc407('0x16')](0xcc)[_0xc407('0x17')]();});}};}function handleEntityNotFound(_0x204791,_0x181f3a){return function(_0x561da3){if(!_0x561da3){_0x204791[_0xc407('0x15')](0x194);}return _0x561da3;};}function handleError(_0x1ad50a,_0x429572){_0x429572=_0x429572||0x1f4;return function(_0x38a062){logger[_0xc407('0x23')](_0x38a062['stack']);if(_0x38a062[_0xc407('0x24')]){delete _0x38a062[_0xc407('0x24')];}_0x1ad50a['status'](_0x429572)[_0xc407('0x25')](_0x38a062);};}exports['index']=function(_0xab93bc,_0x1f631b){var _0x1c437b={},_0x4ca35b={},_0x383617={'count':0x0,'rows':[]};var _0x126a52=_['map'](db['CmContactHasPhone'][_0xc407('0x26')],function(_0x4f264d){return{'name':_0x4f264d[_0xc407('0x27')],'type':_0x4f264d[_0xc407('0x28')]['key']};});_0x4ca35b[_0xc407('0x29')]=_[_0xc407('0x2a')](_0x126a52,_0xc407('0x24'));_0x4ca35b[_0xc407('0x2b')]=_[_0xc407('0x2c')](_0xab93bc[_0xc407('0x2b')]);_0x4ca35b['filters']=_[_0xc407('0x2d')](_0x4ca35b[_0xc407('0x29')],_0x4ca35b[_0xc407('0x2b')]);_0x1c437b['attributes']=_[_0xc407('0x2d')](_0x4ca35b[_0xc407('0x29')],qs[_0xc407('0x2e')](_0xab93bc[_0xc407('0x2b')]['fields']));_0x1c437b[_0xc407('0x2f')]=_0x1c437b[_0xc407('0x2f')][_0xc407('0x30')]?_0x1c437b[_0xc407('0x2f')]:_0x4ca35b['model'];if(!_0xab93bc[_0xc407('0x2b')][_0xc407('0x31')](_0xc407('0x32'))){_0x1c437b[_0xc407('0x33')]=qs[_0xc407('0x33')](_0xab93bc[_0xc407('0x2b')][_0xc407('0x33')]);_0x1c437b[_0xc407('0x19')]=qs['offset'](_0xab93bc[_0xc407('0x2b')][_0xc407('0x19')]);}_0x1c437b[_0xc407('0x34')]=qs[_0xc407('0x35')](_0xab93bc['query']['sort']);_0x1c437b[_0xc407('0x36')]=qs[_0xc407('0x37')](_['pick'](_0xab93bc['query'],_0x4ca35b[_0xc407('0x37')]),_0x126a52);if(_0xab93bc[_0xc407('0x2b')]['filter']){_0x1c437b[_0xc407('0x36')]=_['merge'](_0x1c437b[_0xc407('0x36')],{'$or':_['map'](_0x126a52,function(_0x3605ab){if(_0x3605ab[_0xc407('0x28')]!==_0xc407('0x38')){var _0x402a2f={};_0x402a2f[_0x3605ab['name']]={'$like':'%'+_0xab93bc[_0xc407('0x2b')][_0xc407('0x39')]+'%'};return _0x402a2f;}})});}_0x1c437b=_['merge']({},_0x1c437b,_0xab93bc[_0xc407('0x3a')]);var _0x487a69={'where':_0x1c437b['where']};return db[_0xc407('0x3b')][_0xc407('0x3c')](_0x487a69)[_0xc407('0x1f')](function(_0x10ed5f){_0x383617[_0xc407('0x3c')]=_0x10ed5f;if(_0xab93bc['query']['includeAll']){_0x1c437b['include']=[{'all':!![]}];}return db['CmContactHasPhone']['findAll'](_0x1c437b);})[_0xc407('0x1f')](function(_0xdb61f8){_0x383617[_0xc407('0x3d')]=_0xdb61f8;return _0x383617;})[_0xc407('0x1f')](respondWithFilteredResult(_0x1f631b,_0x1c437b))['catch'](handleError(_0x1f631b,null));};exports['show']=function(_0x27211e,_0x3532f5){var _0x4a7943={'raw':!![],'where':{'id':_0x27211e[_0xc407('0x3e')]['id']}},_0x23a595={};_0x23a595[_0xc407('0x29')]=_['keys'](db['CmContactHasPhone'][_0xc407('0x26')]);_0x23a595[_0xc407('0x2b')]=_[_0xc407('0x2c')](_0x27211e[_0xc407('0x2b')]);_0x23a595[_0xc407('0x37')]=_['intersection'](_0x23a595[_0xc407('0x29')],_0x23a595['query']);_0x4a7943[_0xc407('0x2f')]=_[_0xc407('0x2d')](_0x23a595[_0xc407('0x29')],qs[_0xc407('0x2e')](_0x27211e[_0xc407('0x2b')][_0xc407('0x2e')]));_0x4a7943[_0xc407('0x2f')]=_0x4a7943[_0xc407('0x2f')][_0xc407('0x30')]?_0x4a7943[_0xc407('0x2f')]:_0x23a595[_0xc407('0x29')];if(_0x27211e[_0xc407('0x2b')][_0xc407('0x3f')]){_0x4a7943[_0xc407('0x40')]=[{'all':!![]}];}_0x4a7943=_[_0xc407('0x41')]({},_0x4a7943,_0x27211e[_0xc407('0x3a')]);return db[_0xc407('0x3b')][_0xc407('0x42')](_0x4a7943)[_0xc407('0x1f')](handleEntityNotFound(_0x3532f5,null))[_0xc407('0x1f')](respondWithResult(_0x3532f5,null))[_0xc407('0x43')](handleError(_0x3532f5,null));};exports[_0xc407('0x44')]=function(_0x24ecdc,_0x51d5fd){return db[_0xc407('0x3b')]['create'](_0x24ecdc[_0xc407('0x45')],{})[_0xc407('0x1f')](function(_0x32f094){var _0x454504=_0x24ecdc['user'][_0xc407('0x20')]({'plain':!![]});if(!_0x454504)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x454504[_0xc407('0x46')]==='user'){var _0x452703=_0x32f094[_0xc407('0x20')]({'plain':!![]});var _0x51d879='CmContactHasPhones';return db[_0xc407('0x47')][_0xc407('0x42')]({'where':{'name':_0x51d879,'userProfileId':_0x454504[_0xc407('0x48')]},'raw':!![]})['then'](function(_0x59d0f6){if(_0x59d0f6&&_0x59d0f6[_0xc407('0x49')]===0x0){return db[_0xc407('0x22')]['create']({'name':_0x452703[_0xc407('0x24')],'resourceId':_0x452703['id'],'type':_0x59d0f6[_0xc407('0x24')],'sectionId':_0x59d0f6['id']},{})[_0xc407('0x1f')](function(){return _0x32f094;});}else{return _0x32f094;}})['catch'](function(_0x3decb3){logger[_0xc407('0x23')](_0xc407('0x4a'),_0x3decb3);throw _0x3decb3;});}return _0x32f094;})[_0xc407('0x1f')](respondWithResult(_0x51d5fd,0xc9))[_0xc407('0x43')](handleError(_0x51d5fd,null));};exports[_0xc407('0x1e')]=function(_0x2c3a48,_0x17cbf2){if(_0x2c3a48[_0xc407('0x45')]['id']){delete _0x2c3a48[_0xc407('0x45')]['id'];}return db[_0xc407('0x3b')][_0xc407('0x42')]({'where':{'id':_0x2c3a48['params']['id']}})['then'](handleEntityNotFound(_0x17cbf2,null))[_0xc407('0x1f')](saveUpdates(_0x2c3a48[_0xc407('0x45')],null))[_0xc407('0x1f')](respondWithResult(_0x17cbf2,null))[_0xc407('0x43')](handleError(_0x17cbf2,null));};exports['destroy']=function(_0x1d33d1,_0x2939b3){return db['CmContactHasPhone'][_0xc407('0x42')]({'where':{'id':_0x1d33d1['params']['id']}})[_0xc407('0x1f')](handleEntityNotFound(_0x2939b3,null))[_0xc407('0x1f')](removeEntity(_0x2939b3,null))[_0xc407('0x43')](handleError(_0x2939b3,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 91968af..58af56d 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.model.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c95=['rimraf','../../config/environment','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x56ae45,_0x537cd6){var _0x1c617d=function(_0x498d59){while(--_0x498d59){_0x56ae45['push'](_0x56ae45['shift']());}};_0x1c617d(++_0x537cd6);}(_0x4c95,0x180));var _0x54c9=function(_0xfbbb2d,_0x40e739){_0xfbbb2d=_0xfbbb2d-0x0;var _0xa2c3b9=_0x4c95[_0xfbbb2d];return _0xa2c3b9;};'use strict';var _=require(_0x54c9('0x0'));var util=require(_0x54c9('0x1'));var logger=require(_0x54c9('0x2'))(_0x54c9('0x3'));var moment=require(_0x54c9('0x4'));var BPromise=require(_0x54c9('0x5'));var rp=require(_0x54c9('0x6'));var fs=require('fs');var path=require(_0x54c9('0x7'));var rimraf=require(_0x54c9('0x8'));var config=require(_0x54c9('0x9'));var attributes=require('./cmContactHasPhone.attributes');module[_0x54c9('0xa')]=function(_0x558793,_0x4fa817){return _0x558793[_0x54c9('0xb')](_0x54c9('0xc'),attributes,{'tableName':_0x54c9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x117d=['bluebird','request-promise','path','rimraf','./cmContactHasPhone.attributes','exports','cm_contact_has_phones','lodash','util','../../config/logger','moment'];(function(_0x1abeb0,_0x36ab7a){var _0x3abfd1=function(_0x2bc6c2){while(--_0x2bc6c2){_0x1abeb0['push'](_0x1abeb0['shift']());}};_0x3abfd1(++_0x36ab7a);}(_0x117d,0xac));var _0xd117=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x117d[_0x435044];return _0x33d4c6;};'use strict';var _=require(_0xd117('0x0'));var util=require(_0xd117('0x1'));var logger=require(_0xd117('0x2'))('api');var moment=require(_0xd117('0x3'));var BPromise=require(_0xd117('0x4'));var rp=require(_0xd117('0x5'));var fs=require('fs');var path=require(_0xd117('0x6'));var rimraf=require(_0xd117('0x7'));var config=require('../../config/environment');var attributes=require(_0xd117('0x8'));module[_0xd117('0x9')]=function(_0xa760de,_0x55f7a3){return _0xa760de['define']('CmContactHasPhone',attributes,{'tableName':_0xd117('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index f4e9e9d..938d727 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32f4=['info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x4da28f,_0x164324){var _0xe49192=function(_0x29fdfc){while(--_0x29fdfc){_0x4da28f['push'](_0x4da28f['shift']());}};_0xe49192(++_0x164324);}(_0x32f4,0x154));var _0x432f=function(_0x29d484,_0x299e6d){_0x29d484=_0x29d484-0x0;var _0x19b633=_0x32f4[_0x29d484];return _0x19b633;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('CmContactHasPhone,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});} \ No newline at end of file +var _0x30cf=['info','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','error','code','CmContactHasPhone,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2f8249,_0x47bb75){var _0x12b79e=function(_0x2bb957){while(--_0x2bb957){_0x2f8249['push'](_0x2f8249['shift']());}};_0x12b79e(++_0x47bb75);}(_0x30cf,0x93));var _0xf30c=function(_0x5f1cd4,_0x1339ac){_0x5f1cd4=_0x5f1cd4-0x0;var _0x3258aa=_0x30cf[_0x5f1cd4];return _0x3258aa;};'use strict';var _=require(_0xf30c('0x0'));var util=require(_0xf30c('0x1'));var moment=require(_0xf30c('0x2'));var BPromise=require(_0xf30c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf30c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf30c('0x5'));var logger=require(_0xf30c('0x6'))(_0xf30c('0x7'));var config=require(_0xf30c('0x8'));var jayson=require(_0xf30c('0x9'));var client=jayson[_0xf30c('0xa')][_0xf30c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x597c54,_0x712b15,_0x488b9e){return new BPromise(function(_0x3d2af1,_0x5456c6){return client[_0xf30c('0xc')](_0x597c54,_0x488b9e)[_0xf30c('0xd')](function(_0x376060){logger[_0xf30c('0xe')]('CmContactHasPhone,\x20%s,\x20%s',_0x712b15,_0xf30c('0xf'));logger[_0xf30c('0x10')](_0xf30c('0x11'),_0x712b15,'request\x20sent',JSON['stringify'](_0x376060));if(_0x376060[_0xf30c('0x12')]){if(_0x376060[_0xf30c('0x12')][_0xf30c('0x13')]===0x1f4){logger[_0xf30c('0x12')](_0xf30c('0x14'),_0x712b15,_0x376060[_0xf30c('0x12')]['message']);return _0x5456c6(_0x376060[_0xf30c('0x12')][_0xf30c('0x15')]);}logger[_0xf30c('0x12')](_0xf30c('0x14'),_0x712b15,_0x376060['error'][_0xf30c('0x15')]);return _0x3d2af1(_0x376060[_0xf30c('0x12')]['message']);}else{logger[_0xf30c('0xe')](_0xf30c('0x14'),_0x712b15,'request\x20sent');_0x3d2af1(_0x376060[_0xf30c('0x16')][_0xf30c('0x15')]);}})['catch'](function(_0x29a496){logger['error'](_0xf30c('0x14'),_0x712b15,_0x29a496);_0x5456c6(_0x29a496);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 0c8efde..0d80363 100644 --- a/server/api/cmContactHasPhone/index.js +++ b/server/api/cmContactHasPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0019=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','exports','multer'];(function(_0x54da5c,_0x58832f){var _0x3301ba=function(_0x3ca43b){while(--_0x3ca43b){_0x54da5c['push'](_0x54da5c['shift']());}};_0x3301ba(++_0x58832f);}(_0x0019,0x11f));var _0x9001=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x0019[_0xaa6a4];return _0xdc31a4;};'use strict';var multer=require(_0x9001('0x0'));var util=require(_0x9001('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9001('0x2'));var router=express[_0x9001('0x3')]();var auth=require(_0x9001('0x4'));var interaction=require(_0x9001('0x5'));var config=require(_0x9001('0x6'));var controller=require(_0x9001('0x7'));router[_0x9001('0x8')]('/',auth['isAuthenticated'](),controller[_0x9001('0x9')]);router[_0x9001('0x8')](_0x9001('0xa'),auth[_0x9001('0xb')](),controller[_0x9001('0xc')]);router[_0x9001('0xd')]('/',auth[_0x9001('0xb')](),controller[_0x9001('0xe')]);router[_0x9001('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9001('0x10')]('/:id',auth[_0x9001('0xb')](),controller['destroy']);module[_0x9001('0x11')]=router; \ No newline at end of file +var _0xf83c=['./cmContactHasPhone.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf83c,0x14a));var _0xcf83=function(_0x473ee7,_0x4dd754){_0x473ee7=_0x473ee7-0x0;var _0x30f0d4=_0xf83c[_0x473ee7];return _0x30f0d4;};'use strict';var multer=require(_0xcf83('0x0'));var util=require(_0xcf83('0x1'));var path=require(_0xcf83('0x2'));var timeout=require(_0xcf83('0x3'));var express=require('express');var router=express[_0xcf83('0x4')]();var auth=require(_0xcf83('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcf83('0x6'));router['get']('/',auth[_0xcf83('0x7')](),controller[_0xcf83('0x8')]);router['get'](_0xcf83('0x9'),auth[_0xcf83('0x7')](),controller[_0xcf83('0xa')]);router[_0xcf83('0xb')]('/',auth[_0xcf83('0x7')](),controller[_0xcf83('0xc')]);router[_0xcf83('0xd')](_0xcf83('0x9'),auth[_0xcf83('0x7')](),controller[_0xcf83('0xe')]);router[_0xcf83('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 010c058..36f8a18 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 _0x6245=['long','type','parse','values','isArray','BOOLEAN','sequelize','lodash','VIRTUAL','getDataValue','setDataValue','alias','STRING','TEXT'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x6245,0x19c));var _0x5624=function(_0x2dd22e,_0xec41fe){_0x2dd22e=_0x2dd22e-0x0;var _0x257b01=_0x6245[_0x2dd22e];return _0x257b01;};'use strict';var Sequelize=require(_0x5624('0x0'));var _=require(_0x5624('0x1'));module['exports']={'name':{'type':Sequelize[_0x5624('0x2')],'get':function(_0x2cd82e){return this[_0x5624('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x463504){this[_0x5624('0x4')](_0x5624('0x5'),_0x463504?_0x463504:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x5624('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x5624('0x7')](_0x5624('0x8')),'get':function(){if(this[_0x5624('0x3')](_0x5624('0x9'))==='select'){return JSON[_0x5624('0xa')](this[_0x5624('0x3')](_0x5624('0xb')));}else{return this['getDataValue'](_0x5624('0xb'));}},'set':function(_0x23eeb3){if(Array[_0x5624('0xc')](_0x23eeb3)){this[_0x5624('0x4')](_0x5624('0xb'),JSON['stringify'](_0x23eeb3));}else{this[_0x5624('0x4')](_0x5624('0xb'),_0x23eeb3);}}},'required':{'type':Sequelize[_0x5624('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x136a=['BOOLEAN','sequelize','lodash','exports','getDataValue','alias','STRING','parse','values','setDataValue','stringify'];(function(_0x5d1ea2,_0x11173e){var _0x10cc67=function(_0xe0855b){while(--_0xe0855b){_0x5d1ea2['push'](_0x5d1ea2['shift']());}};_0x10cc67(++_0x11173e);}(_0x136a,0x11f));var _0xa136=function(_0x59f9d1,_0x1a58d0){_0x59f9d1=_0x59f9d1-0x0;var _0x54c621=_0x136a[_0x59f9d1];return _0x54c621;};'use strict';var Sequelize=require(_0xa136('0x0'));var _=require(_0xa136('0x1'));module[_0xa136('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xd34acf){return this[_0xa136('0x3')](_0xa136('0x4'));}},'alias':{'type':Sequelize[_0xa136('0x5')],'allowNull':![],'set':function(_0x203920){this['setDataValue'](_0xa136('0x4'),_0x203920?_0x203920:this[_0xa136('0x3')]('name'));}},'type':{'type':Sequelize[_0xa136('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0xa136('0x3')]('type')==='select'){return JSON[_0xa136('0x6')](this['getDataValue'](_0xa136('0x7')));}else{return this[_0xa136('0x3')](_0xa136('0x7'));}},'set':function(_0x4db26a){if(Array['isArray'](_0x4db26a)){this[_0xa136('0x8')](_0xa136('0x7'),JSON[_0xa136('0x9')](_0x4db26a));}else{this[_0xa136('0x8')](_0xa136('0x7'),_0x4db26a);}}},'required':{'type':Sequelize[_0xa136('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index b296bc1..703f4b0 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 _0x207d=['format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmCustomField','includeAll','rows','catch','show','params','include','find','body','destroy','create','sequelize','transaction','TEXT','number','Sequelize','INTEGER','switch','queryInterface','addColumn','cm_contacts'];(function(_0x38ff1e,_0x3b9385){var _0x3755d4=function(_0x6e6692){while(--_0x6e6692){_0x38ff1e['push'](_0x38ff1e['shift']());}};_0x3755d4(++_0x3b9385);}(_0x207d,0xa9));var _0xd207=function(_0x621683,_0x188675){_0x621683=_0x621683-0x0;var _0x49e6a8=_0x207d[_0x621683];return _0x49e6a8;};'use strict';var pdf=require(_0xd207('0x0'));var emlformat=require(_0xd207('0x1'));var rimraf=require(_0xd207('0x2'));var zipdir=require(_0xd207('0x3'));var jsonpatch=require(_0xd207('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd207('0x5'));var Mustache=require('mustache');var util=require(_0xd207('0x6'));var path=require('path');var sox=require(_0xd207('0x7'));var csv=require(_0xd207('0x8'));var ejs=require(_0xd207('0x9'));var fs=require('fs');var _=require(_0xd207('0xa'));var squel=require(_0xd207('0xb'));var crypto=require(_0xd207('0xc'));var jsforce=require(_0xd207('0xd'));var deskjs=require(_0xd207('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd207('0xf'));var Redis=require(_0xd207('0x10'));var authService=require(_0xd207('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd207('0x12'));var hardwareService=require(_0xd207('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd207('0x14'));var config=require(_0xd207('0x15'));var db=require(_0xd207('0x16'))['db'];function respondWithStatusCode(_0x45bfa2,_0x50166c){_0x50166c=_0x50166c||0xcc;return function(_0x19b12f){if(_0x19b12f){return _0x45bfa2['sendStatus'](_0x50166c);}return _0x45bfa2[_0xd207('0x17')](_0x50166c)[_0xd207('0x18')]();};}function respondWithResult(_0x45c303,_0x4cb75e){_0x4cb75e=_0x4cb75e||0xc8;return function(_0x5d38b5){if(_0x5d38b5){return _0x45c303[_0xd207('0x17')](_0x4cb75e)['json'](_0x5d38b5);}};}function respondWithFilteredResult(_0x35dbe3,_0xee04c7){return function(_0x1b1045){if(_0x1b1045){var _0x3af924=_0x1b1045[_0xd207('0x19')],_0x1bd1af=_0xee04c7[_0xd207('0x1a')],_0x35b300=_0xee04c7[_0xd207('0x1a')]+_0xee04c7[_0xd207('0x1b')],_0x4affc6;if(_0x35b300>=_0x3af924){_0x35b300=_0x3af924;_0x4affc6=0xc8;}else{_0x4affc6=0xce;}_0x35dbe3[_0xd207('0x17')](_0x4affc6);return _0x35dbe3[_0xd207('0x1c')]('Content-Range',_0x1bd1af+'-'+_0x35b300+'/'+_0x3af924)[_0xd207('0x1d')](_0x1b1045);}return null;};}function patchUpdates(_0x300269){return function(_0x2e5543){try{jsonpatch[_0xd207('0x1e')](_0x2e5543,_0x300269,!![]);}catch(_0x5b8de6){return BPromise[_0xd207('0x1f')](_0x5b8de6);}return _0x2e5543[_0xd207('0x20')]();};}function saveUpdates(_0x185748,_0x12750e){return function(_0x12c518){if(_0x12c518){return _0x12c518[_0xd207('0x21')](_0x185748)['then'](function(_0x3160c1){return _0x3160c1;});}return null;};}function removeEntity(_0x1296ca,_0xac60ae){return function(_0x12b983){if(_0x12b983){return _0x12b983['destroy']()[_0xd207('0x22')](function(){_0x1296ca[_0xd207('0x17')](0xcc)[_0xd207('0x18')]();});}};}function handleEntityNotFound(_0x12e280,_0x181f0f){return function(_0x20cadd){if(!_0x20cadd){_0x12e280[_0xd207('0x23')](0x194);}return _0x20cadd;};}function handleError(_0xf6c632,_0xb74238){_0xb74238=_0xb74238||0x1f4;return function(_0x209013){logger[_0xd207('0x24')](_0x209013[_0xd207('0x25')]);if(_0x209013['name']){delete _0x209013[_0xd207('0x26')];}_0xf6c632['status'](_0xb74238)[_0xd207('0x27')](_0x209013);};}exports['index']=function(_0x1601e0,_0x3a197c){var _0x46937f={},_0x2d2022={},_0x9054ea={'count':0x0,'rows':[]};var _0x59f170=_['map'](db['CmCustomField'][_0xd207('0x28')],function(_0x2f5f4d){return{'name':_0x2f5f4d[_0xd207('0x29')],'type':_0x2f5f4d[_0xd207('0x2a')]['key']};});_0x2d2022[_0xd207('0x2b')]=_[_0xd207('0x2c')](_[_0xd207('0x2d')](_0x59f170,'name'),[_0xd207('0x26')]);_0x2d2022[_0xd207('0x2e')]=_[_0xd207('0x2f')](_0x1601e0[_0xd207('0x2e')]);_0x2d2022[_0xd207('0x30')]=_[_0xd207('0x31')](_0x2d2022[_0xd207('0x2b')],_0x2d2022[_0xd207('0x2e')]);_0x46937f[_0xd207('0x32')]=_[_0xd207('0x31')](_0x2d2022[_0xd207('0x2b')],qs[_0xd207('0x33')](_0x1601e0[_0xd207('0x2e')]['fields']));_0x46937f[_0xd207('0x32')]=_0x46937f['attributes'][_0xd207('0x34')]?_0x46937f[_0xd207('0x32')]:_0x2d2022[_0xd207('0x2b')];if(!_0x1601e0['query'][_0xd207('0x35')](_0xd207('0x36'))){_0x46937f['limit']=qs[_0xd207('0x1b')](_0x1601e0[_0xd207('0x2e')][_0xd207('0x1b')]);_0x46937f['offset']=qs[_0xd207('0x1a')](_0x1601e0['query'][_0xd207('0x1a')]);}_0x46937f[_0xd207('0x37')]=qs[_0xd207('0x38')](_0x1601e0[_0xd207('0x2e')]['sort']);_0x46937f[_0xd207('0x39')]=qs[_0xd207('0x30')](_['pick'](_0x1601e0['query'],_0x2d2022[_0xd207('0x30')]),_0x59f170);if(_0x1601e0['query'][_0xd207('0x3a')]){_0x46937f[_0xd207('0x39')]=_[_0xd207('0x3b')](_0x46937f['where'],{'$or':_[_0xd207('0x2d')](_0x59f170,function(_0x463f11){if(_0x463f11['type']!==_0xd207('0x3c')){var _0xeee0c9={};_0xeee0c9[_0x463f11[_0xd207('0x26')]]={'$like':'%'+_0x1601e0[_0xd207('0x2e')][_0xd207('0x3a')]+'%'};return _0xeee0c9;}})});}_0x46937f=_[_0xd207('0x3b')]({},_0x46937f,_0x1601e0[_0xd207('0x3d')]);var _0xfbae2f={'where':_0x46937f['where']};return db[_0xd207('0x3e')][_0xd207('0x19')](_0xfbae2f)[_0xd207('0x22')](function(_0x4452bb){_0x9054ea[_0xd207('0x19')]=_0x4452bb;if(_0x1601e0[_0xd207('0x2e')][_0xd207('0x3f')]){_0x46937f['include']=[{'all':!![]}];}return db[_0xd207('0x3e')]['findAll'](_0x46937f);})[_0xd207('0x22')](function(_0x400ecc){_0x9054ea[_0xd207('0x40')]=_0x400ecc;return _0x9054ea;})[_0xd207('0x22')](respondWithFilteredResult(_0x3a197c,_0x46937f))[_0xd207('0x41')](handleError(_0x3a197c,null));};exports[_0xd207('0x42')]=function(_0x32a0b2,_0x5fc348){var _0x163de6={'raw':!![],'where':{'id':_0x32a0b2[_0xd207('0x43')]['id']}},_0xfb021f={};_0xfb021f[_0xd207('0x2b')]=_['keys'](db['CmCustomField'][_0xd207('0x28')]);_0xfb021f[_0xd207('0x2e')]=_[_0xd207('0x2f')](_0x32a0b2[_0xd207('0x2e')]);_0xfb021f['filters']=_[_0xd207('0x31')](_0xfb021f[_0xd207('0x2b')],_0xfb021f[_0xd207('0x2e')]);_0x163de6['attributes']=_[_0xd207('0x31')](_0xfb021f['model'],qs[_0xd207('0x33')](_0x32a0b2[_0xd207('0x2e')][_0xd207('0x33')]));_0x163de6[_0xd207('0x32')]=_0x163de6[_0xd207('0x32')]['length']?_0x163de6[_0xd207('0x32')]:_0xfb021f['model'];if(_0x32a0b2[_0xd207('0x2e')][_0xd207('0x3f')]){_0x163de6[_0xd207('0x44')]=[{'all':!![]}];}_0x163de6=_['merge']({},_0x163de6,_0x32a0b2[_0xd207('0x3d')]);return db['CmCustomField'][_0xd207('0x45')](_0x163de6)[_0xd207('0x22')](handleEntityNotFound(_0x5fc348,null))[_0xd207('0x22')](respondWithResult(_0x5fc348,null))[_0xd207('0x41')](handleError(_0x5fc348,null));};exports[_0xd207('0x21')]=function(_0x2bf648,_0x243707){if(_0x2bf648[_0xd207('0x46')]['id']){delete _0x2bf648['body']['id'];}return db[_0xd207('0x3e')][_0xd207('0x45')]({'where':{'id':_0x2bf648['params']['id']}})[_0xd207('0x22')](handleEntityNotFound(_0x243707,null))[_0xd207('0x22')](saveUpdates(_0x2bf648[_0xd207('0x46')],null))['then'](respondWithResult(_0x243707,null))['catch'](handleError(_0x243707,null));};exports[_0xd207('0x47')]=function(_0x316349,_0x111adf){return db[_0xd207('0x3e')][_0xd207('0x45')]({'where':{'id':_0x316349[_0xd207('0x43')]['id']}})[_0xd207('0x22')](handleEntityNotFound(_0x111adf,null))['then'](removeEntity(_0x111adf,null))[_0xd207('0x41')](handleError(_0x111adf,null));};exports[_0xd207('0x48')]=function(_0x3dceec,_0x5e8531){var _0x459c09;return db[_0xd207('0x49')][_0xd207('0x4a')](function(_0x345fff){return db[_0xd207('0x3e')][_0xd207('0x48')](_0x3dceec['body'],{'transaction':_0x345fff})['then'](function(_0x2539b8){_0x459c09=_0x2539b8;var _0x2b56cb={'type':db['Sequelize'][_0xd207('0x4b')],'transaction':_0x345fff};switch(_0x3dceec[_0xd207('0x46')]['type']){case'text':_0x2b56cb[_0xd207('0x2a')]=db['Sequelize'][_0xd207('0x4b')];break;case _0xd207('0x4c'):_0x2b56cb['type']=db[_0xd207('0x4d')][_0xd207('0x4e')];break;case _0xd207('0x4f'):_0x2b56cb[_0xd207('0x2a')]=db[_0xd207('0x4d')]['BOOLEAN'];_0x2b56cb['defaultValue']=![];break;default:}return db[_0xd207('0x49')][_0xd207('0x50')][_0xd207('0x51')](_0xd207('0x52'),util[_0xd207('0x53')]('cf_%d',_0x459c09['id']),_0x2b56cb);})[_0xd207('0x22')](function(){return _0x459c09;});})[_0xd207('0x22')](respondWithResult(_0x5e8531,0xc9))['catch'](handleError(_0x5e8531,null));}; \ No newline at end of file +var _0x47d4=['find','body','create','sequelize','Sequelize','TEXT','INTEGER','switch','defaultValue','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','count','limit','set','json','reject','save','update','destroy','then','end','name','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','keys','options'];(function(_0xf7bf02,_0x13da13){var _0x4f263f=function(_0x3b5603){while(--_0x3b5603){_0xf7bf02['push'](_0xf7bf02['shift']());}};_0x4f263f(++_0x13da13);}(_0x47d4,0x1a7));var _0x447d=function(_0x3c81ab,_0xaffc9f){_0x3c81ab=_0x3c81ab-0x0;var _0x120d48=_0x47d4[_0x3c81ab];return _0x120d48;};'use strict';var pdf=require(_0x447d('0x0'));var emlformat=require(_0x447d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x447d('0x2'));var jsonpatch=require(_0x447d('0x3'));var rp=require(_0x447d('0x4'));var moment=require(_0x447d('0x5'));var BPromise=require(_0x447d('0x6'));var Mustache=require(_0x447d('0x7'));var util=require(_0x447d('0x8'));var path=require(_0x447d('0x9'));var sox=require(_0x447d('0xa'));var csv=require(_0x447d('0xb'));var ejs=require(_0x447d('0xc'));var fs=require('fs');var _=require(_0x447d('0xd'));var squel=require(_0x447d('0xe'));var crypto=require('crypto');var jsforce=require(_0x447d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x447d('0xb'));var querystring=require(_0x447d('0x10'));var Papa=require(_0x447d('0x11'));var Redis=require(_0x447d('0x12'));var authService=require(_0x447d('0x13'));var qs=require(_0x447d('0x14'));var as=require(_0x447d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x447d('0x16'))('api');var utils=require(_0x447d('0x17'));var config=require('../../config/environment');var db=require(_0x447d('0x18'))['db'];function respondWithStatusCode(_0x5cf789,_0x389064){_0x389064=_0x389064||0xcc;return function(_0x58ceb9){if(_0x58ceb9){return _0x5cf789[_0x447d('0x19')](_0x389064);}return _0x5cf789[_0x447d('0x1a')](_0x389064)['end']();};}function respondWithResult(_0x20b977,_0x4fd454){_0x4fd454=_0x4fd454||0xc8;return function(_0x2ead3f){if(_0x2ead3f){return _0x20b977[_0x447d('0x1a')](_0x4fd454)['json'](_0x2ead3f);}};}function respondWithFilteredResult(_0x4f3e9b,_0x3a1e64){return function(_0x360ec0){if(_0x360ec0){var _0xc06f20=_0x360ec0[_0x447d('0x1b')],_0x13bcfb=_0x3a1e64['offset'],_0xbdac5b=_0x3a1e64['offset']+_0x3a1e64[_0x447d('0x1c')],_0x58f4af;if(_0xbdac5b>=_0xc06f20){_0xbdac5b=_0xc06f20;_0x58f4af=0xc8;}else{_0x58f4af=0xce;}_0x4f3e9b[_0x447d('0x1a')](_0x58f4af);return _0x4f3e9b[_0x447d('0x1d')]('Content-Range',_0x13bcfb+'-'+_0xbdac5b+'/'+_0xc06f20)[_0x447d('0x1e')](_0x360ec0);}return null;};}function patchUpdates(_0xc0cd84){return function(_0x340181){try{jsonpatch['apply'](_0x340181,_0xc0cd84,!![]);}catch(_0x1aba40){return BPromise[_0x447d('0x1f')](_0x1aba40);}return _0x340181[_0x447d('0x20')]();};}function saveUpdates(_0x26cf1e,_0x1438a4){return function(_0x14c5c3){if(_0x14c5c3){return _0x14c5c3[_0x447d('0x21')](_0x26cf1e)['then'](function(_0x31a8e8){return _0x31a8e8;});}return null;};}function removeEntity(_0x4ebd08,_0x239202){return function(_0x56127e){if(_0x56127e){return _0x56127e[_0x447d('0x22')]()[_0x447d('0x23')](function(){_0x4ebd08['status'](0xcc)[_0x447d('0x24')]();});}};}function handleEntityNotFound(_0x4e4460,_0x710031){return function(_0x2b88b1){if(!_0x2b88b1){_0x4e4460[_0x447d('0x19')](0x194);}return _0x2b88b1;};}function handleError(_0x444d4a,_0x33316f){_0x33316f=_0x33316f||0x1f4;return function(_0x5f30b8){logger['error'](_0x5f30b8['stack']);if(_0x5f30b8[_0x447d('0x25')]){delete _0x5f30b8[_0x447d('0x25')];}_0x444d4a[_0x447d('0x1a')](_0x33316f)['send'](_0x5f30b8);};}exports[_0x447d('0x26')]=function(_0x2db0e6,_0x4eeb31){var _0x110515={},_0x480834={},_0x5a9c14={'count':0x0,'rows':[]};var _0x42d2cc=_[_0x447d('0x27')](db[_0x447d('0x28')][_0x447d('0x29')],function(_0x455beb){return{'name':_0x455beb['fieldName'],'type':_0x455beb[_0x447d('0x2a')][_0x447d('0x2b')]};});_0x480834[_0x447d('0x2c')]=_[_0x447d('0x2d')](_[_0x447d('0x27')](_0x42d2cc,_0x447d('0x25')),[_0x447d('0x25')]);_0x480834[_0x447d('0x2e')]=_['keys'](_0x2db0e6['query']);_0x480834['filters']=_['intersection'](_0x480834['model'],_0x480834[_0x447d('0x2e')]);_0x110515[_0x447d('0x2f')]=_[_0x447d('0x30')](_0x480834[_0x447d('0x2c')],qs[_0x447d('0x31')](_0x2db0e6[_0x447d('0x2e')][_0x447d('0x31')]));_0x110515[_0x447d('0x2f')]=_0x110515[_0x447d('0x2f')][_0x447d('0x32')]?_0x110515[_0x447d('0x2f')]:_0x480834[_0x447d('0x2c')];if(!_0x2db0e6[_0x447d('0x2e')][_0x447d('0x33')]('nolimit')){_0x110515[_0x447d('0x1c')]=qs[_0x447d('0x1c')](_0x2db0e6[_0x447d('0x2e')][_0x447d('0x1c')]);_0x110515[_0x447d('0x34')]=qs[_0x447d('0x34')](_0x2db0e6[_0x447d('0x2e')][_0x447d('0x34')]);}_0x110515[_0x447d('0x35')]=qs[_0x447d('0x36')](_0x2db0e6['query'][_0x447d('0x36')]);_0x110515[_0x447d('0x37')]=qs[_0x447d('0x38')](_[_0x447d('0x39')](_0x2db0e6[_0x447d('0x2e')],_0x480834['filters']),_0x42d2cc);if(_0x2db0e6[_0x447d('0x2e')][_0x447d('0x3a')]){_0x110515['where']=_['merge'](_0x110515['where'],{'$or':_[_0x447d('0x27')](_0x42d2cc,function(_0x266ce5){if(_0x266ce5[_0x447d('0x2a')]!==_0x447d('0x3b')){var _0x373d54={};_0x373d54[_0x266ce5[_0x447d('0x25')]]={'$like':'%'+_0x2db0e6['query'][_0x447d('0x3a')]+'%'};return _0x373d54;}})});}_0x110515=_[_0x447d('0x3c')]({},_0x110515,_0x2db0e6['options']);var _0x3182f2={'where':_0x110515[_0x447d('0x37')]};return db['CmCustomField'][_0x447d('0x1b')](_0x3182f2)[_0x447d('0x23')](function(_0x3834b2){_0x5a9c14['count']=_0x3834b2;if(_0x2db0e6[_0x447d('0x2e')]['includeAll']){_0x110515[_0x447d('0x3d')]=[{'all':!![]}];}return db[_0x447d('0x28')][_0x447d('0x3e')](_0x110515);})['then'](function(_0x25cdf4){_0x5a9c14[_0x447d('0x3f')]=_0x25cdf4;return _0x5a9c14;})[_0x447d('0x23')](respondWithFilteredResult(_0x4eeb31,_0x110515))[_0x447d('0x40')](handleError(_0x4eeb31,null));};exports[_0x447d('0x41')]=function(_0x4e754e,_0x5b5254){var _0x2464ff={'raw':!![],'where':{'id':_0x4e754e[_0x447d('0x42')]['id']}},_0x1b0178={};_0x1b0178['model']=_['keys'](db[_0x447d('0x28')]['rawAttributes']);_0x1b0178[_0x447d('0x2e')]=_[_0x447d('0x43')](_0x4e754e[_0x447d('0x2e')]);_0x1b0178[_0x447d('0x38')]=_['intersection'](_0x1b0178[_0x447d('0x2c')],_0x1b0178[_0x447d('0x2e')]);_0x2464ff[_0x447d('0x2f')]=_['intersection'](_0x1b0178[_0x447d('0x2c')],qs['fields'](_0x4e754e[_0x447d('0x2e')][_0x447d('0x31')]));_0x2464ff[_0x447d('0x2f')]=_0x2464ff[_0x447d('0x2f')]['length']?_0x2464ff[_0x447d('0x2f')]:_0x1b0178[_0x447d('0x2c')];if(_0x4e754e[_0x447d('0x2e')]['includeAll']){_0x2464ff['include']=[{'all':!![]}];}_0x2464ff=_['merge']({},_0x2464ff,_0x4e754e[_0x447d('0x44')]);return db[_0x447d('0x28')][_0x447d('0x45')](_0x2464ff)[_0x447d('0x23')](handleEntityNotFound(_0x5b5254,null))[_0x447d('0x23')](respondWithResult(_0x5b5254,null))[_0x447d('0x40')](handleError(_0x5b5254,null));};exports[_0x447d('0x21')]=function(_0x311d04,_0xc05de0){if(_0x311d04['body']['id']){delete _0x311d04['body']['id'];}return db['CmCustomField'][_0x447d('0x45')]({'where':{'id':_0x311d04[_0x447d('0x42')]['id']}})['then'](handleEntityNotFound(_0xc05de0,null))['then'](saveUpdates(_0x311d04[_0x447d('0x46')],null))[_0x447d('0x23')](respondWithResult(_0xc05de0,null))[_0x447d('0x40')](handleError(_0xc05de0,null));};exports[_0x447d('0x22')]=function(_0x3e29e1,_0x432838){return db[_0x447d('0x28')][_0x447d('0x45')]({'where':{'id':_0x3e29e1['params']['id']}})[_0x447d('0x23')](handleEntityNotFound(_0x432838,null))[_0x447d('0x23')](removeEntity(_0x432838,null))[_0x447d('0x40')](handleError(_0x432838,null));};exports[_0x447d('0x47')]=function(_0x31e93a,_0x26761a){var _0xd4b421;return db[_0x447d('0x48')]['transaction'](function(_0x41cdb5){return db['CmCustomField'][_0x447d('0x47')](_0x31e93a[_0x447d('0x46')],{'transaction':_0x41cdb5})[_0x447d('0x23')](function(_0xe9ae60){_0xd4b421=_0xe9ae60;var _0xe1fc8={'type':db[_0x447d('0x49')][_0x447d('0x4a')],'transaction':_0x41cdb5};switch(_0x31e93a[_0x447d('0x46')][_0x447d('0x2a')]){case'text':_0xe1fc8[_0x447d('0x2a')]=db[_0x447d('0x49')][_0x447d('0x4a')];break;case'number':_0xe1fc8[_0x447d('0x2a')]=db['Sequelize'][_0x447d('0x4b')];break;case _0x447d('0x4c'):_0xe1fc8[_0x447d('0x2a')]=db['Sequelize']['BOOLEAN'];_0xe1fc8[_0x447d('0x4d')]=![];break;default:}return db[_0x447d('0x48')]['queryInterface'][_0x447d('0x4e')](_0x447d('0x4f'),util[_0x447d('0x50')](_0x447d('0x51'),_0xd4b421['id']),_0xe1fc8);})[_0x447d('0x23')](function(){return _0xd4b421;});})['then'](respondWithResult(_0x26761a,0xc9))[_0x447d('0x40')](handleError(_0x26761a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 58f0d91..6de55f7 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 _0x0e21=['cm_custom_fields','util','../../config/logger','api','bluebird','request-promise','path','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x0e21,0xe8));var _0x10e2=function(_0x5319c4,_0x398df0){_0x5319c4=_0x5319c4-0x0;var _0x5c203d=_0x0e21[_0x5319c4];return _0x5c203d;};'use strict';var _=require('lodash');var util=require(_0x10e2('0x0'));var logger=require(_0x10e2('0x1'))(_0x10e2('0x2'));var moment=require('moment');var BPromise=require(_0x10e2('0x3'));var rp=require(_0x10e2('0x4'));var fs=require('fs');var path=require(_0x10e2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x10e2('0x6'));module[_0x10e2('0x7')]=function(_0x2fb9e4,_0x44e30e){return _0x2fb9e4[_0x10e2('0x8')](_0x10e2('0x9'),attributes,{'tableName':_0x10e2('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa887=['../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2c2980,_0xbc3da6){var _0x4601a6=function(_0x49a1bb){while(--_0x49a1bb){_0x2c2980['push'](_0x2c2980['shift']());}};_0x4601a6(++_0xbc3da6);}(_0xa887,0x89));var _0x7a88=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa887[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7a88('0x0'));var util=require('util');var logger=require(_0x7a88('0x1'))(_0x7a88('0x2'));var moment=require('moment');var BPromise=require(_0x7a88('0x3'));var rp=require(_0x7a88('0x4'));var fs=require('fs');var path=require(_0x7a88('0x5'));var rimraf=require(_0x7a88('0x6'));var config=require(_0x7a88('0x7'));var attributes=require(_0x7a88('0x8'));module[_0x7a88('0x9')]=function(_0xf70f6,_0x12fabf){return _0xf70f6['define'](_0x7a88('0xa'),attributes,{'tableName':_0x7a88('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index ee845d0..dbad6ee 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 _0xcb99=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xcb99,0x8b));var _0x9cb9=function(_0xdaffc7,_0x453662){_0xdaffc7=_0xdaffc7-0x0;var _0x503d65=_0xcb99[_0xdaffc7];return _0x503d65;};'use strict';var _=require(_0x9cb9('0x0'));var util=require('util');var moment=require(_0x9cb9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cb9('0x2'));var db=require(_0x9cb9('0x3'))['db'];var utils=require(_0x9cb9('0x4'));var logger=require('../../config/logger')(_0x9cb9('0x5'));var config=require(_0x9cb9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9cb9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed26a,_0xa84493,_0x1bf9b7){return new BPromise(function(_0x1dd62f,_0x82e3e){return client[_0x9cb9('0x8')](_0x2ed26a,_0x1bf9b7)[_0x9cb9('0x9')](function(_0x3da50b){logger['info']('CmCustomField,\x20%s,\x20%s',_0xa84493,_0x9cb9('0xa'));logger[_0x9cb9('0xb')](_0x9cb9('0xc'),_0xa84493,'request\x20sent',JSON[_0x9cb9('0xd')](_0x3da50b));if(_0x3da50b[_0x9cb9('0xe')]){if(_0x3da50b['error']['code']===0x1f4){logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);return _0x82e3e(_0x3da50b['error'][_0x9cb9('0x10')]);}logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);return _0x1dd62f(_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);}else{logger[_0x9cb9('0x11')](_0x9cb9('0xf'),_0xa84493,_0x9cb9('0xa'));_0x1dd62f(_0x3da50b[_0x9cb9('0x12')][_0x9cb9('0x10')]);}})[_0x9cb9('0x13')](function(_0x140910){logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x140910);_0x82e3e(_0x140910);});});} \ No newline at end of file +var _0xbb53=['http','then','info','request\x20sent','stringify','error','message','CmCustomField,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xbb53,0x121));var _0x3bb5=function(_0x38e1c0,_0x439ba1){_0x38e1c0=_0x38e1c0-0x0;var _0x31d04b=_0xbb53[_0x38e1c0];return _0x31d04b;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var BPromise=require(_0x3bb5('0x3'));var rs=require(_0x3bb5('0x4'));var fs=require('fs');var Redis=require(_0x3bb5('0x5'));var db=require(_0x3bb5('0x6'))['db'];var utils=require(_0x3bb5('0x7'));var logger=require(_0x3bb5('0x8'))(_0x3bb5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bb5('0xa')][_0x3bb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aa7d,_0x157e04,_0x22f92f){return new BPromise(function(_0x480f9c,_0x5a4ae3){return client['request'](_0x28aa7d,_0x22f92f)[_0x3bb5('0xc')](function(_0x2e0cfa){logger[_0x3bb5('0xd')]('CmCustomField,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'),JSON[_0x3bb5('0xf')](_0x2e0cfa));if(_0x2e0cfa['error']){if(_0x2e0cfa[_0x3bb5('0x10')]['code']===0x1f4){logger[_0x3bb5('0x10')]('CmCustomField,\x20%s,\x20%s',_0x157e04,_0x2e0cfa['error'][_0x3bb5('0x11')]);return _0x5a4ae3(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}logger['error'](_0x3bb5('0x12'),_0x157e04,_0x2e0cfa[_0x3bb5('0x10')]['message']);return _0x480f9c(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x157e04,'request\x20sent');_0x480f9c(_0x2e0cfa[_0x3bb5('0x13')][_0x3bb5('0x11')]);}})['catch'](function(_0x25d774){logger[_0x3bb5('0x10')](_0x3bb5('0x12'),_0x157e04,_0x25d774);_0x5a4ae3(_0x25d774);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index f69fa6f..4fdf1cb 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 _0xa53d=['get','isAuthenticated','/:id','show','post','put','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x370c24,_0x44d426){var _0x187d27=function(_0xde5513){while(--_0xde5513){_0x370c24['push'](_0x370c24['shift']());}};_0x187d27(++_0x44d426);}(_0xa53d,0x1a1));var _0xda53=function(_0x5de4b9,_0x1644d2){_0x5de4b9=_0x5de4b9-0x0;var _0x2ec54e=_0xa53d[_0x5de4b9];return _0x2ec54e;};'use strict';var multer=require('multer');var util=require(_0xda53('0x0'));var path=require('path');var timeout=require(_0xda53('0x1'));var express=require(_0xda53('0x2'));var router=express[_0xda53('0x3')]();var auth=require(_0xda53('0x4'));var interaction=require(_0xda53('0x5'));var config=require(_0xda53('0x6'));var controller=require(_0xda53('0x7'));router[_0xda53('0x8')]('/',auth[_0xda53('0x9')](),controller['index']);router[_0xda53('0x8')](_0xda53('0xa'),auth[_0xda53('0x9')](),controller[_0xda53('0xb')]);router[_0xda53('0xc')]('/',auth[_0xda53('0x9')](),controller['create']);router[_0xda53('0xd')](_0xda53('0xa'),auth[_0xda53('0x9')](),controller[_0xda53('0xe')]);router['delete'](_0xda53('0xa'),auth[_0xda53('0x9')](),controller[_0xda53('0xf')]);module[_0xda53('0x10')]=router; \ No newline at end of file +var _0xd3a3=['express','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x2621ac,_0x4d8774){var _0x57bc8c=function(_0x2cdfef){while(--_0x2cdfef){_0x2621ac['push'](_0x2621ac['shift']());}};_0x57bc8c(++_0x4d8774);}(_0xd3a3,0xb1));var _0x3d3a=function(_0x3cc688,_0x5c9ad2){_0x3cc688=_0x3cc688-0x0;var _0x2128f7=_0xd3a3[_0x3cc688];return _0x2128f7;};'use strict';var multer=require(_0x3d3a('0x0'));var util=require(_0x3d3a('0x1'));var path=require('path');var timeout=require(_0x3d3a('0x2'));var express=require(_0x3d3a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3d3a('0x4'));var config=require(_0x3d3a('0x5'));var controller=require(_0x3d3a('0x6'));router[_0x3d3a('0x7')]('/',auth[_0x3d3a('0x8')](),controller[_0x3d3a('0x9')]);router[_0x3d3a('0x7')](_0x3d3a('0xa'),auth['isAuthenticated'](),controller[_0x3d3a('0xb')]);router[_0x3d3a('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d3a('0xd')]);router['put'](_0x3d3a('0xa'),auth[_0x3d3a('0x8')](),controller[_0x3d3a('0xe')]);router[_0x3d3a('0xf')](_0x3d3a('0xa'),auth[_0x3d3a('0x8')](),controller[_0x3d3a('0x10')]);module[_0x3d3a('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 07d9402..e722815 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 _0x2542=['contactListQueue','moment','sequelize','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED'];(function(_0x428045,_0x32cf89){var _0x378d99=function(_0x17b781){while(--_0x17b781){_0x428045['push'](_0x428045['shift']());}};_0x378d99(++_0x32cf89);}(_0x2542,0x169));var _0x2254=function(_0x5d52fe,_0x29b700){_0x5d52fe=_0x5d52fe-0x0;var _0x565d6c=_0x2542[_0x5d52fe];return _0x565d6c;};'use strict';var moment=require(_0x2254('0x0'));var Sequelize=require(_0x2254('0x1'));module[_0x2254('0x2')]={'phone':{'type':Sequelize[_0x2254('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x2254('0x4')],'defaultValue':moment()['format'](_0x2254('0x5'))},'countbusyretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x2254('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2254('0x4')]},'priority':{'type':Sequelize[_0x2254('0x6')](0x2)[_0x2254('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x2254('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x2254('0x6')],'unique':_0x2254('0x9')},'ListId':{'type':Sequelize[_0x2254('0x6')],'unique':_0x2254('0x9')},'UserId':{'type':Sequelize[_0x2254('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x2254('0x6')],'unique':_0x2254('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5fab=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x2ee69d,_0x308214){var _0x3abd2a=function(_0x37f5d4){while(--_0x37f5d4){_0x2ee69d['push'](_0x2ee69d['shift']());}};_0x3abd2a(++_0x308214);}(_0x5fab,0x177));var _0xb5fa=function(_0x1f3681,_0x43cf48){_0x1f3681=_0x1f3681-0x0;var _0x4911fd=_0x5fab[_0x1f3681];return _0x4911fd;};'use strict';var moment=require(_0xb5fa('0x0'));var Sequelize=require(_0xb5fa('0x1'));module['exports']={'phone':{'type':Sequelize[_0xb5fa('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb5fa('0x4')],'defaultValue':moment()[_0xb5fa('0x5')](_0xb5fa('0x6'))},'countbusyretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb5fa('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xb5fa('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb5fa('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb5fa('0x7')],'unique':_0xb5fa('0x9')},'UserId':{'type':Sequelize[_0xb5fa('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xb5fa('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb5fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 5c94228..1e116d2 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 _0xbb66=['hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','CmCompany','Company','List','dialActive','getOpenContacts','outbound','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','push','utcOffset','getTimezone','timezones','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/environment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','query','keys','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','update','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbb66,0x1e6));var _0x6bb6=function(_0xbb98d2,_0x152fbf){_0xbb98d2=_0xbb98d2-0x0;var _0x279874=_0xbb66[_0xbb98d2];return _0x279874;};'use strict';var pdf=require(_0x6bb6('0x0'));var emlformat=require(_0x6bb6('0x1'));var rimraf=require(_0x6bb6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6bb6('0x3'));var rp=require(_0x6bb6('0x4'));var moment=require('moment');var BPromise=require(_0x6bb6('0x5'));var Mustache=require(_0x6bb6('0x6'));var util=require(_0x6bb6('0x7'));var path=require(_0x6bb6('0x8'));var sox=require(_0x6bb6('0x9'));var csv=require(_0x6bb6('0xa'));var ejs=require(_0x6bb6('0xb'));var fs=require('fs');var _=require(_0x6bb6('0xc'));var squel=require(_0x6bb6('0xd'));var crypto=require(_0x6bb6('0xe'));var jsforce=require(_0x6bb6('0xf'));var deskjs=require(_0x6bb6('0x10'));var toCsv=require(_0x6bb6('0xa'));var querystring=require(_0x6bb6('0x11'));var Papa=require(_0x6bb6('0x12'));var Redis=require('ioredis');var shared=require(_0x6bb6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6bb6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bb6('0x15'))(_0x6bb6('0x16'));var utils=require('../../config/utils');var config=require(_0x6bb6('0x13'));var db=require(_0x6bb6('0x17'))['db'];function respondWithStatusCode(_0x2d6b08,_0x48a115){_0x48a115=_0x48a115||0xcc;return function(_0x57ecae){if(_0x57ecae){return _0x2d6b08['sendStatus'](_0x48a115);}return _0x2d6b08[_0x6bb6('0x18')](_0x48a115)[_0x6bb6('0x19')]();};}function respondWithResult(_0x44391,_0x115046){_0x115046=_0x115046||0xc8;return function(_0x587bd4){if(_0x587bd4){return _0x44391['status'](_0x115046)[_0x6bb6('0x1a')](_0x587bd4);}};}function respondWithFilteredResult(_0x59c345,_0x4e1992){return function(_0x51945a){if(_0x51945a){var _0x48ae2f=_0x51945a[_0x6bb6('0x1b')],_0x4083ad=_0x4e1992[_0x6bb6('0x1c')],_0x36e0cc=_0x4e1992[_0x6bb6('0x1c')]+_0x4e1992[_0x6bb6('0x1d')],_0x38a99d;if(_0x36e0cc>=_0x48ae2f){_0x36e0cc=_0x48ae2f;_0x38a99d=0xc8;}else{_0x38a99d=0xce;}_0x59c345[_0x6bb6('0x18')](_0x38a99d);return _0x59c345['set'](_0x6bb6('0x1e'),_0x4083ad+'-'+_0x36e0cc+'/'+_0x48ae2f)[_0x6bb6('0x1a')](_0x51945a);}return null;};}function patchUpdates(_0x3899c8){return function(_0x38570c){try{jsonpatch[_0x6bb6('0x1f')](_0x38570c,_0x3899c8,!![]);}catch(_0x1a20df){return BPromise[_0x6bb6('0x20')](_0x1a20df);}return _0x38570c[_0x6bb6('0x21')]();};}function saveUpdates(_0x3d7038,_0x2f097e){return function(_0x3c554e){if(_0x3c554e){return _0x3c554e['update'](_0x3d7038)[_0x6bb6('0x22')](function(_0xc30699){return _0xc30699;});}return null;};}function removeEntity(_0x229343,_0x5e04c3){return function(_0x107fd2){if(_0x107fd2){return _0x107fd2['destroy']()[_0x6bb6('0x22')](function(){_0x229343['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe79dae,_0x86dfda){return function(_0x39e880){if(!_0x39e880){_0xe79dae[_0x6bb6('0x23')](0x194);}return _0x39e880;};}function handleError(_0x228bcc,_0x4358c2){_0x4358c2=_0x4358c2||0x1f4;return function(_0x40e2df){logger[_0x6bb6('0x24')](_0x40e2df[_0x6bb6('0x25')]);if(_0x40e2df[_0x6bb6('0x26')]){delete _0x40e2df[_0x6bb6('0x26')];}_0x228bcc[_0x6bb6('0x18')](_0x4358c2)[_0x6bb6('0x27')](_0x40e2df);};}exports[_0x6bb6('0x28')]=function(_0x28e3ed,_0x1ae5c9){var _0x3bb269={},_0x4f7fdb={},_0x5b17e5={'count':0x0,'rows':[]};var _0xa4bb5e=_[_0x6bb6('0x29')](db[_0x6bb6('0x2a')][_0x6bb6('0x2b')],function(_0x1d192c){return{'name':_0x1d192c['fieldName'],'type':_0x1d192c[_0x6bb6('0x2c')][_0x6bb6('0x2d')]};});_0x4f7fdb[_0x6bb6('0x2e')]=_[_0x6bb6('0x29')](_0xa4bb5e,_0x6bb6('0x26'));_0x4f7fdb[_0x6bb6('0x2f')]=_[_0x6bb6('0x30')](_0x28e3ed['query']);_0x4f7fdb['filters']=_[_0x6bb6('0x31')](_0x4f7fdb[_0x6bb6('0x2e')],_0x4f7fdb['query']);_0x4f7fdb[_0x6bb6('0x32')]=_[_0x6bb6('0x33')](_0x4f7fdb[_0x6bb6('0x32')],[_0x6bb6('0x34'),_0x6bb6('0x35'),_0x6bb6('0x36'),_0x6bb6('0x37'),_0x6bb6('0x38'),_0x6bb6('0x39'),_0x6bb6('0x3a'),_0x6bb6('0x3b'),_0x6bb6('0x3c'),_0x6bb6('0x3d'),_0x6bb6('0x3e'),_0x6bb6('0x3f'),_0x6bb6('0x40'),_0x6bb6('0x41'),'$notLike','$iLike','$notILike',_0x6bb6('0x41'),'$overlap',_0x6bb6('0x42'),_0x6bb6('0x43'),_0x6bb6('0x44')]);_0x3bb269[_0x6bb6('0x45')]=_[_0x6bb6('0x31')](_0x4f7fdb[_0x6bb6('0x2e')],qs[_0x6bb6('0x46')](_0x28e3ed[_0x6bb6('0x2f')]['fields']));_0x3bb269[_0x6bb6('0x45')]=_0x3bb269[_0x6bb6('0x45')]['length']?_0x3bb269[_0x6bb6('0x45')]:_0x4f7fdb[_0x6bb6('0x2e')];if(!_0x28e3ed[_0x6bb6('0x2f')][_0x6bb6('0x47')](_0x6bb6('0x48'))){_0x3bb269[_0x6bb6('0x1d')]=qs[_0x6bb6('0x1d')](_0x28e3ed['query'][_0x6bb6('0x1d')]);_0x3bb269['offset']=qs['offset'](_0x28e3ed[_0x6bb6('0x2f')][_0x6bb6('0x1c')]);}_0x3bb269['order']=qs['sort'](_0x28e3ed[_0x6bb6('0x2f')]['sort']);_0x3bb269[_0x6bb6('0x49')]=qs['filters'](_[_0x6bb6('0x4a')](_0x28e3ed[_0x6bb6('0x2f')],_0x4f7fdb[_0x6bb6('0x32')]),_0xa4bb5e);if(_0x28e3ed['query'][_0x6bb6('0x4b')]){_0x3bb269['where']=_[_0x6bb6('0x4c')](_0x3bb269[_0x6bb6('0x49')],{'$or':_['map'](_0xa4bb5e,function(_0x27ac9f){if(_0x27ac9f[_0x6bb6('0x2c')]!==_0x6bb6('0x4d')){var _0x422e1b={};_0x422e1b[_0x27ac9f[_0x6bb6('0x26')]]={'$like':'%'+_0x28e3ed[_0x6bb6('0x2f')]['filter']+'%'};return _0x422e1b;}})});}_0x3bb269=_[_0x6bb6('0x4c')]({},_0x3bb269,_0x28e3ed[_0x6bb6('0x4e')]);var _0x445d7a={'where':_0x3bb269[_0x6bb6('0x49')]};return db['CmHopper'][_0x6bb6('0x1b')](_0x445d7a)[_0x6bb6('0x22')](function(_0x3b5162){_0x5b17e5[_0x6bb6('0x1b')]=_0x3b5162;if(_0x28e3ed[_0x6bb6('0x2f')]['includeAll']){_0x3bb269['include']=[{'all':!![]}];}return db['CmHopper'][_0x6bb6('0x4f')](_0x3bb269);})['then'](function(_0x53ba01){_0x5b17e5[_0x6bb6('0x50')]=_0x53ba01;return _0x5b17e5;})[_0x6bb6('0x22')](respondWithFilteredResult(_0x1ae5c9,_0x3bb269))[_0x6bb6('0x51')](handleError(_0x1ae5c9,null));};exports[_0x6bb6('0x52')]=function(_0x474ef1,_0x38a44e){var _0x445ce0={'raw':!![],'where':{'id':_0x474ef1[_0x6bb6('0x53')]['id']}},_0x37724a={};_0x37724a[_0x6bb6('0x2e')]=_['keys'](db[_0x6bb6('0x2a')][_0x6bb6('0x2b')]);_0x37724a[_0x6bb6('0x2f')]=_[_0x6bb6('0x30')](_0x474ef1[_0x6bb6('0x2f')]);_0x37724a[_0x6bb6('0x32')]=_['intersection'](_0x37724a[_0x6bb6('0x2e')],_0x37724a[_0x6bb6('0x2f')]);_0x445ce0[_0x6bb6('0x45')]=_[_0x6bb6('0x31')](_0x37724a[_0x6bb6('0x2e')],qs['fields'](_0x474ef1[_0x6bb6('0x2f')]['fields']));_0x445ce0[_0x6bb6('0x45')]=_0x445ce0[_0x6bb6('0x45')][_0x6bb6('0x54')]?_0x445ce0['attributes']:_0x37724a[_0x6bb6('0x2e')];if(_0x474ef1['query'][_0x6bb6('0x55')]){_0x445ce0[_0x6bb6('0x56')]=[{'all':!![]}];}_0x445ce0=_[_0x6bb6('0x4c')]({},_0x445ce0,_0x474ef1['options']);return db[_0x6bb6('0x2a')][_0x6bb6('0x57')](_0x445ce0)[_0x6bb6('0x22')](handleEntityNotFound(_0x38a44e,null))[_0x6bb6('0x22')](respondWithResult(_0x38a44e,null))[_0x6bb6('0x51')](handleError(_0x38a44e,null));};exports[_0x6bb6('0x58')]=function(_0x597b50,_0x48f027){return db[_0x6bb6('0x2a')][_0x6bb6('0x58')](_0x597b50['body'],{})[_0x6bb6('0x22')](respondWithResult(_0x48f027,0xc9))[_0x6bb6('0x51')](handleError(_0x48f027,null));};exports[_0x6bb6('0x59')]=function(_0x300dd9,_0x38e806){if(_0x300dd9[_0x6bb6('0x5a')]['id']){delete _0x300dd9[_0x6bb6('0x5a')]['id'];}return db[_0x6bb6('0x2a')][_0x6bb6('0x57')]({'where':{'id':_0x300dd9[_0x6bb6('0x53')]['id']}})[_0x6bb6('0x22')](handleEntityNotFound(_0x38e806,null))[_0x6bb6('0x22')](saveUpdates(_0x300dd9['body'],null))[_0x6bb6('0x22')](respondWithResult(_0x38e806,null))[_0x6bb6('0x51')](handleError(_0x38e806,null));};exports['describe']=function(_0x535c5a,_0x997e70){return db[_0x6bb6('0x2a')][_0x6bb6('0x5b')]()['then'](respondWithResult(_0x997e70,null))[_0x6bb6('0x51')](handleError(_0x997e70,null));};exports['destroy']=function(_0x211f64,_0x1404dc){var _0x180e46;return db[_0x6bb6('0x2a')][_0x6bb6('0x57')]({'where':{'id':_0x211f64[_0x6bb6('0x53')]['id']}})['then'](handleEntityNotFound(_0x1404dc,null))[_0x6bb6('0x22')](function(_0x5308a5){if(_0x5308a5){return _0x5308a5[_0x6bb6('0x5c')]()[_0x6bb6('0x22')](function(_0x1a1d7c){return _0x1a1d7c;});}})['then'](function(_0x5ee568){_0x180e46=_0x5ee568;if(_0x5ee568){if(_0x5ee568['VoiceQueueId']||_0x5ee568[_0x6bb6('0x5d')]){return db[_0x5ee568[_0x6bb6('0x5e')]?_0x6bb6('0x5f'):_0x6bb6('0x60')][_0x6bb6('0x57')]({'where':{'id':_0x5ee568[_0x6bb6('0x5e')]?_0x5ee568[_0x6bb6('0x5e')]:_0x5ee568[_0x6bb6('0x5d')]},'attributes':['id',_0x6bb6('0x26')],'raw':!![]});}}})[_0x6bb6('0x22')](function(_0x3fd2d3){var _0x4f9688={};if(_0x3fd2d3){_[_0x6bb6('0x4c')](_0x4f9688,_[_0x6bb6('0x61')](_0x180e46[_0x6bb6('0x62')],[_0x6bb6('0x63'),'updatedAt','id']));_0x4f9688[_0x6bb6('0x64')]=0x15;_0x4f9688[_0x6bb6('0x65')]=_0x6bb6('0x66');_0x4f9688[_0x6bb6('0x67')]=_0x3fd2d3[_0x6bb6('0x26')];_0x4f9688[_0x6bb6('0x68')]=_0x211f64[_0x6bb6('0x69')]['name'];_0x4f9688[_0x6bb6('0x6a')]=_0x211f64[_0x6bb6('0x69')]['id'];_0x4f9688[_0x6bb6('0x66')]=!![];_0x4f9688[_0x6bb6('0x6b')]=moment()[_0x6bb6('0x6c')](_0x6bb6('0x6d'));_0x4f9688[_0x6bb6('0x6e')]=_0x180e46[_0x6bb6('0x6f')];_0x4f9688[_0x6bb6('0x70')]=_0x180e46[_0x6bb6('0x5e')]?'queue':_0x6bb6('0x71');return db['CmContact']['find']({'where':{'id':_0x4f9688[_0x6bb6('0x72')]},'attributes':[_0x6bb6('0x73'),_0x6bb6('0x74')]})['then'](function(_0x3e99a0){if(!_[_0x6bb6('0x75')](_0x1404dc)&&!_[_0x6bb6('0x75')](_0x3e99a0[_0x6bb6('0x73')])){_0x4f9688[_0x6bb6('0x76')]=_0x3e99a0['firstName'];if(!_[_0x6bb6('0x75')](_0x3e99a0[_0x6bb6('0x74')])){_0x4f9688[_0x6bb6('0x76')]+='\x20'+_0x3e99a0[_0x6bb6('0x74')];}}})[_0x6bb6('0x77')](function(){return db[_0x6bb6('0x78')][_0x6bb6('0x58')](_0x4f9688);});}})['then'](function(){return _0x1404dc[_0x6bb6('0x18')](0xcc)[_0x6bb6('0x19')]();})[_0x6bb6('0x51')](handleError(_0x1404dc,null));};exports[_0x6bb6('0x79')]=function(_0x583777,_0x4a6eb2,_0x4de68a){var _0x140fd5=[];return db[_0x6bb6('0x7a')][_0x6bb6('0x5b')]()[_0x6bb6('0x22')](function(_0x275ee1){_0x140fd5=_['keys'](_0x275ee1);return _0x583777['user'][_0x6bb6('0x7b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x6bb6('0x7c')},'attributes':['id',_0x6bb6('0x7d')],'raw':!![]});})[_0x6bb6('0x22')](function(_0x5d6700){if(_0x5d6700&&_0x5d6700[_0x6bb6('0x54')]){return db[_0x6bb6('0x7e')][_0x6bb6('0x7f')](function(_0x56c04b){var _0x55293e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6bb6('0x6c')](_0x6bb6('0x6d'))},'VoiceQueueId':{'$in':_['map'](_0x5d6700,'id')},'$or':[{'UserId':null},{'UserId':_0x583777['user']['id']}]};var _0x51d7f0=[];if(_0x583777[_0x6bb6('0x5a')][_0x6bb6('0x80')]&&_0x583777['body'][_0x6bb6('0x80')]===_0x6bb6('0x81')){if(!_['isEmpty'](_0x583777['body'][_0x6bb6('0x82')])){_0x55293e['id']={'$in':_0x583777[_0x6bb6('0x5a')][_0x6bb6('0x82')]};}_0x51d7f0=[['priority',_0x6bb6('0x83')],[_0x6bb6('0x84'),_0x5d6700[0x0][_0x6bb6('0x7d')]===_0x6bb6('0x83')?_0x6bb6('0x85'):_0x6bb6('0x83')],db['sequelize'][_0x6bb6('0x86')](_0x6bb6('0x87')),['id',_0x6bb6('0x85')]];}else{if(!_[_0x6bb6('0x88')](_0x583777[_0x6bb6('0x5a')][_0x6bb6('0x82')])){_0x55293e['id']={'$notIn':_0x583777['body'][_0x6bb6('0x82')]};}_0x51d7f0=[[_0x6bb6('0x89'),_0x6bb6('0x85')],[_0x6bb6('0x84'),_0x5d6700[0x0][_0x6bb6('0x7d')]],db[_0x6bb6('0x7e')]['literal'](_0x6bb6('0x8a')),['id','ASC']];}return db['CmHopper'][_0x6bb6('0x8b')]({'attributes':['id',_0x6bb6('0x8c')],'where':_0x55293e,'order':_0x51d7f0,'transaction':_0x56c04b,'lock':_0x56c04b['LOCK'][_0x6bb6('0x8d')],'include':[{'model':db[_0x6bb6('0x7a')],'as':'Contact','attributes':_0x140fd5,'include':[{'model':db[_0x6bb6('0x8e')],'as':_0x6bb6('0x8f'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x6bb6('0x90'),'attributes':['id',_0x6bb6('0x26')]},{'model':db[_0x6bb6('0x5f')],'as':'Queue','attributes':['id',_0x6bb6('0x26'),_0x6bb6('0x91')]}]})[_0x6bb6('0x22')](function(_0x3cbaa7){if(_0x3cbaa7){return _0x3cbaa7[_0x6bb6('0x59')]({'UserId':_0x583777['user']['id']},{'transaction':_0x56c04b});}});});}})['then'](handleEntityNotFound(_0x4a6eb2,null))[_0x6bb6('0x22')](respondWithResult(_0x4a6eb2,null))[_0x6bb6('0x51')](handleError(_0x4a6eb2,null));};exports[_0x6bb6('0x92')]=function(_0x3d414f,_0x12118b,_0xdbe717){return _0x3d414f[_0x6bb6('0x69')][_0x6bb6('0x7b')]({'where':{'type':_0x6bb6('0x93'),'dialActive':!![],'dialMethod':_0x6bb6('0x7c')},'attributes':['id'],'raw':!![]})[_0x6bb6('0x22')](function(_0x115e5a){if(_0x115e5a&&_0x115e5a[_0x6bb6('0x54')]){return db[_0x6bb6('0x2a')][_0x6bb6('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6bb6('0x6c')](_0x6bb6('0x6d'))},'VoiceQueueId':{'$in':_['map'](_0x115e5a,'id')},'$or':[{'UserId':null},{'UserId':_0x3d414f[_0x6bb6('0x69')]['id']}]}});}return 0x0;})[_0x6bb6('0x22')](function(_0x709d14){if(!_[_0x6bb6('0x75')](_0x709d14)&&_['isNumber'](_0x709d14)){return _0x12118b[_0x6bb6('0x18')](0xc8)[_0x6bb6('0x1a')]({'contacts':_0x709d14});}else{logger[_0x6bb6('0x24')](_0x6bb6('0x94'),_0x6bb6('0x92'),0x194,'entity\x20not\x20found');_0x12118b['sendStatus'](0x194);}})[_0x6bb6('0x51')](handleError(_0x12118b,null));};exports[_0x6bb6('0x95')]=function(_0x4f078b,_0x99dd7b,_0x5bda40){var _0x468f2d=shared['timezones'];var _0x5705fd=[];_[_0x6bb6('0x29')](_0x468f2d,function(_0x448748){_0x5705fd[_0x6bb6('0x96')]({'id':_0x448748[_0x6bb6('0x26')],'name':_0x448748[_0x6bb6('0x26')],'utcOffset':_0x448748[_0x6bb6('0x97')]});});return _0x99dd7b[_0x6bb6('0x18')](0xc8)['json']({'tz':_0x5705fd});};exports[_0x6bb6('0x98')]=function(_0x1ebc70,_0xb71302,_0x332d9b){var _0x23c197=shared[_0x6bb6('0x99')];var _0x20048f={};if(!_[_0x6bb6('0x75')](_0x23c197[_0x1ebc70[_0x6bb6('0x5a')]['id']]))_0x20048f=_0x23c197[_0x1ebc70[_0x6bb6('0x5a')]['id']];return _0xb71302['status'](0xc8)['json'](_0x20048f);}; \ No newline at end of file +var _0xa1f4=['getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','DESC','literal','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','ASC','findOne','scheduledat','Contact','CmCompany','CmList','List','Queue','dialActive','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','update','destroy','then','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','concat','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','attributes','fields','model','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','length','options','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','firstName','isNil','calleridname','lastName','finally','CmHopperFinal'];(function(_0x488ef8,_0xf7ff03){var _0x46a72c=function(_0x10444c){while(--_0x10444c){_0x488ef8['push'](_0x488ef8['shift']());}};_0x46a72c(++_0xf7ff03);}(_0xa1f4,0x1d6));var _0x4a1f=function(_0x22985c,_0x508396){_0x22985c=_0x22985c-0x0;var _0x43e6b3=_0xa1f4[_0x22985c];return _0x43e6b3;};'use strict';var pdf=require(_0x4a1f('0x0'));var emlformat=require(_0x4a1f('0x1'));var rimraf=require(_0x4a1f('0x2'));var zipdir=require(_0x4a1f('0x3'));var jsonpatch=require(_0x4a1f('0x4'));var rp=require(_0x4a1f('0x5'));var moment=require(_0x4a1f('0x6'));var BPromise=require(_0x4a1f('0x7'));var Mustache=require(_0x4a1f('0x8'));var util=require(_0x4a1f('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x4a1f('0xa'));var ejs=require(_0x4a1f('0xb'));var fs=require('fs');var _=require(_0x4a1f('0xc'));var squel=require('squel');var crypto=require(_0x4a1f('0xd'));var jsforce=require(_0x4a1f('0xe'));var deskjs=require(_0x4a1f('0xf'));var toCsv=require(_0x4a1f('0xa'));var querystring=require(_0x4a1f('0x10'));var Papa=require(_0x4a1f('0x11'));var Redis=require(_0x4a1f('0x12'));var shared=require(_0x4a1f('0x13'));var authService=require(_0x4a1f('0x14'));var qs=require(_0x4a1f('0x15'));var as=require(_0x4a1f('0x16'));var hardwareService=require(_0x4a1f('0x17'));var logger=require(_0x4a1f('0x18'))(_0x4a1f('0x19'));var utils=require(_0x4a1f('0x1a'));var config=require(_0x4a1f('0x13'));var db=require(_0x4a1f('0x1b'))['db'];function respondWithStatusCode(_0x5874b8,_0x1eced9){_0x1eced9=_0x1eced9||0xcc;return function(_0x8c91b3){if(_0x8c91b3){return _0x5874b8[_0x4a1f('0x1c')](_0x1eced9);}return _0x5874b8[_0x4a1f('0x1d')](_0x1eced9)[_0x4a1f('0x1e')]();};}function respondWithResult(_0x2591b9,_0x2c7d6e){_0x2c7d6e=_0x2c7d6e||0xc8;return function(_0x287ae1){if(_0x287ae1){return _0x2591b9['status'](_0x2c7d6e)[_0x4a1f('0x1f')](_0x287ae1);}};}function respondWithFilteredResult(_0x27ca74,_0x456b7a){return function(_0x5c8c2c){if(_0x5c8c2c){var _0x4d3d5e=_0x5c8c2c[_0x4a1f('0x20')],_0xb263f0=_0x456b7a['offset'],_0x47f32c=_0x456b7a[_0x4a1f('0x21')]+_0x456b7a[_0x4a1f('0x22')],_0x588bb8;if(_0x47f32c>=_0x4d3d5e){_0x47f32c=_0x4d3d5e;_0x588bb8=0xc8;}else{_0x588bb8=0xce;}_0x27ca74[_0x4a1f('0x1d')](_0x588bb8);return _0x27ca74['set']('Content-Range',_0xb263f0+'-'+_0x47f32c+'/'+_0x4d3d5e)[_0x4a1f('0x1f')](_0x5c8c2c);}return null;};}function patchUpdates(_0x403a0d){return function(_0x4eada2){try{jsonpatch[_0x4a1f('0x23')](_0x4eada2,_0x403a0d,!![]);}catch(_0x2cc85e){return BPromise['reject'](_0x2cc85e);}return _0x4eada2[_0x4a1f('0x24')]();};}function saveUpdates(_0x4685e1,_0x6fdc4c){return function(_0x5572d5){if(_0x5572d5){return _0x5572d5[_0x4a1f('0x25')](_0x4685e1)['then'](function(_0x92d9d4){return _0x92d9d4;});}return null;};}function removeEntity(_0x114887,_0x17f359){return function(_0x4f0972){if(_0x4f0972){return _0x4f0972[_0x4a1f('0x26')]()[_0x4a1f('0x27')](function(){_0x114887[_0x4a1f('0x1d')](0xcc)[_0x4a1f('0x1e')]();});}};}function handleEntityNotFound(_0x1b24ab,_0x515d3f){return function(_0xccd468){if(!_0xccd468){_0x1b24ab[_0x4a1f('0x1c')](0x194);}return _0xccd468;};}function handleError(_0x15cb9c,_0x13289f){_0x13289f=_0x13289f||0x1f4;return function(_0xa07e0b){logger[_0x4a1f('0x28')](_0xa07e0b[_0x4a1f('0x29')]);if(_0xa07e0b[_0x4a1f('0x2a')]){delete _0xa07e0b[_0x4a1f('0x2a')];}_0x15cb9c[_0x4a1f('0x1d')](_0x13289f)[_0x4a1f('0x2b')](_0xa07e0b);};}exports['index']=function(_0x3aca2f,_0x562d76){var _0x3cc593={},_0xf69f1e={},_0x5f5634={'count':0x0,'rows':[]};var _0x2e1b05=_[_0x4a1f('0x2c')](db[_0x4a1f('0x2d')][_0x4a1f('0x2e')],function(_0x87eb19){return{'name':_0x87eb19[_0x4a1f('0x2f')],'type':_0x87eb19[_0x4a1f('0x30')][_0x4a1f('0x31')]};});_0xf69f1e['model']=_[_0x4a1f('0x2c')](_0x2e1b05,_0x4a1f('0x2a'));_0xf69f1e[_0x4a1f('0x32')]=_[_0x4a1f('0x33')](_0x3aca2f[_0x4a1f('0x32')]);_0xf69f1e[_0x4a1f('0x34')]=_[_0x4a1f('0x35')](_0xf69f1e['model'],_0xf69f1e[_0x4a1f('0x32')]);_0xf69f1e['filters']=_[_0x4a1f('0x36')](_0xf69f1e['filters'],['$and','$or',_0x4a1f('0x37'),_0x4a1f('0x38'),_0x4a1f('0x39'),_0x4a1f('0x3a'),_0x4a1f('0x3b'),_0x4a1f('0x3c'),_0x4a1f('0x3d'),_0x4a1f('0x3e'),_0x4a1f('0x3f'),_0x4a1f('0x40'),'$notIn',_0x4a1f('0x41'),'$notLike',_0x4a1f('0x42'),_0x4a1f('0x43'),_0x4a1f('0x41'),_0x4a1f('0x44'),'$contains','$contained','$any']);_0x3cc593[_0x4a1f('0x45')]=_[_0x4a1f('0x35')](_0xf69f1e['model'],qs[_0x4a1f('0x46')](_0x3aca2f[_0x4a1f('0x32')][_0x4a1f('0x46')]));_0x3cc593[_0x4a1f('0x45')]=_0x3cc593[_0x4a1f('0x45')]['length']?_0x3cc593[_0x4a1f('0x45')]:_0xf69f1e[_0x4a1f('0x47')];if(!_0x3aca2f[_0x4a1f('0x32')][_0x4a1f('0x48')](_0x4a1f('0x49'))){_0x3cc593[_0x4a1f('0x22')]=qs[_0x4a1f('0x22')](_0x3aca2f[_0x4a1f('0x32')][_0x4a1f('0x22')]);_0x3cc593[_0x4a1f('0x21')]=qs[_0x4a1f('0x21')](_0x3aca2f['query'][_0x4a1f('0x21')]);}_0x3cc593[_0x4a1f('0x4a')]=qs['sort'](_0x3aca2f[_0x4a1f('0x32')]['sort']);_0x3cc593['where']=qs[_0x4a1f('0x34')](_[_0x4a1f('0x4b')](_0x3aca2f[_0x4a1f('0x32')],_0xf69f1e['filters']),_0x2e1b05);if(_0x3aca2f['query']['filter']){_0x3cc593[_0x4a1f('0x4c')]=_[_0x4a1f('0x4d')](_0x3cc593['where'],{'$or':_[_0x4a1f('0x2c')](_0x2e1b05,function(_0x1164f6){if(_0x1164f6['type']!==_0x4a1f('0x4e')){var _0x424f91={};_0x424f91[_0x1164f6[_0x4a1f('0x2a')]]={'$like':'%'+_0x3aca2f['query'][_0x4a1f('0x4f')]+'%'};return _0x424f91;}})});}_0x3cc593=_[_0x4a1f('0x4d')]({},_0x3cc593,_0x3aca2f['options']);var _0xff456={'where':_0x3cc593[_0x4a1f('0x4c')]};return db['CmHopper'][_0x4a1f('0x20')](_0xff456)[_0x4a1f('0x27')](function(_0x2f23a1){_0x5f5634[_0x4a1f('0x20')]=_0x2f23a1;if(_0x3aca2f[_0x4a1f('0x32')][_0x4a1f('0x50')]){_0x3cc593[_0x4a1f('0x51')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3cc593);})[_0x4a1f('0x27')](function(_0x9c001d){_0x5f5634[_0x4a1f('0x52')]=_0x9c001d;return _0x5f5634;})[_0x4a1f('0x27')](respondWithFilteredResult(_0x562d76,_0x3cc593))[_0x4a1f('0x53')](handleError(_0x562d76,null));};exports[_0x4a1f('0x54')]=function(_0x18180f,_0x47443c){var _0x3985bb={'raw':!![],'where':{'id':_0x18180f[_0x4a1f('0x55')]['id']}},_0x860ec1={};_0x860ec1[_0x4a1f('0x47')]=_[_0x4a1f('0x33')](db[_0x4a1f('0x2d')][_0x4a1f('0x2e')]);_0x860ec1['query']=_['keys'](_0x18180f[_0x4a1f('0x32')]);_0x860ec1[_0x4a1f('0x34')]=_[_0x4a1f('0x35')](_0x860ec1['model'],_0x860ec1[_0x4a1f('0x32')]);_0x3985bb[_0x4a1f('0x45')]=_[_0x4a1f('0x35')](_0x860ec1['model'],qs[_0x4a1f('0x46')](_0x18180f[_0x4a1f('0x32')][_0x4a1f('0x46')]));_0x3985bb[_0x4a1f('0x45')]=_0x3985bb[_0x4a1f('0x45')][_0x4a1f('0x56')]?_0x3985bb['attributes']:_0x860ec1[_0x4a1f('0x47')];if(_0x18180f[_0x4a1f('0x32')][_0x4a1f('0x50')]){_0x3985bb[_0x4a1f('0x51')]=[{'all':!![]}];}_0x3985bb=_[_0x4a1f('0x4d')]({},_0x3985bb,_0x18180f[_0x4a1f('0x57')]);return db[_0x4a1f('0x2d')][_0x4a1f('0x58')](_0x3985bb)['then'](handleEntityNotFound(_0x47443c,null))[_0x4a1f('0x27')](respondWithResult(_0x47443c,null))['catch'](handleError(_0x47443c,null));};exports[_0x4a1f('0x59')]=function(_0x2af3c1,_0x1a4ea9){return db['CmHopper'][_0x4a1f('0x59')](_0x2af3c1['body'],{})['then'](respondWithResult(_0x1a4ea9,0xc9))['catch'](handleError(_0x1a4ea9,null));};exports[_0x4a1f('0x25')]=function(_0x5c58af,_0x14103d){if(_0x5c58af[_0x4a1f('0x5a')]['id']){delete _0x5c58af['body']['id'];}return db[_0x4a1f('0x2d')]['find']({'where':{'id':_0x5c58af[_0x4a1f('0x55')]['id']}})['then'](handleEntityNotFound(_0x14103d,null))[_0x4a1f('0x27')](saveUpdates(_0x5c58af[_0x4a1f('0x5a')],null))[_0x4a1f('0x27')](respondWithResult(_0x14103d,null))[_0x4a1f('0x53')](handleError(_0x14103d,null));};exports[_0x4a1f('0x5b')]=function(_0x4cb8df,_0x790bd1){return db[_0x4a1f('0x2d')][_0x4a1f('0x5b')]()[_0x4a1f('0x27')](respondWithResult(_0x790bd1,null))['catch'](handleError(_0x790bd1,null));};exports[_0x4a1f('0x26')]=function(_0x1ba77e,_0x38b116){var _0x1a3218;return db['CmHopper'][_0x4a1f('0x58')]({'where':{'id':_0x1ba77e[_0x4a1f('0x55')]['id']}})[_0x4a1f('0x27')](handleEntityNotFound(_0x38b116,null))[_0x4a1f('0x27')](function(_0x36f8a9){if(_0x36f8a9){return _0x36f8a9[_0x4a1f('0x26')]()[_0x4a1f('0x27')](function(_0x18a5cb){return _0x18a5cb;});}})['then'](function(_0x1e13e4){_0x1a3218=_0x1e13e4;if(_0x1e13e4){if(_0x1e13e4[_0x4a1f('0x5c')]||_0x1e13e4[_0x4a1f('0x5d')]){return db[_0x1e13e4[_0x4a1f('0x5c')]?_0x4a1f('0x5e'):_0x4a1f('0x5f')][_0x4a1f('0x58')]({'where':{'id':_0x1e13e4[_0x4a1f('0x5c')]?_0x1e13e4[_0x4a1f('0x5c')]:_0x1e13e4[_0x4a1f('0x5d')]},'attributes':['id','name'],'raw':!![]});}}})[_0x4a1f('0x27')](function(_0x95e12){var _0x300acc={};if(_0x95e12){_[_0x4a1f('0x4d')](_0x300acc,_[_0x4a1f('0x60')](_0x1a3218['dataValues'],[_0x4a1f('0x61'),_0x4a1f('0x62'),'id']));_0x300acc[_0x4a1f('0x63')]=0x15;_0x300acc[_0x4a1f('0x64')]=_0x4a1f('0x65');_0x300acc[_0x4a1f('0x66')]=_0x95e12['name'];_0x300acc[_0x4a1f('0x67')]=_0x1ba77e[_0x4a1f('0x68')][_0x4a1f('0x2a')];_0x300acc[_0x4a1f('0x69')]=_0x1ba77e[_0x4a1f('0x68')]['id'];_0x300acc[_0x4a1f('0x65')]=!![];_0x300acc['deletedat']=moment()[_0x4a1f('0x6a')](_0x4a1f('0x6b'));_0x300acc[_0x4a1f('0x6c')]=_0x1a3218['phone'];_0x300acc[_0x4a1f('0x6d')]=_0x1a3218['VoiceQueueId']?'queue':_0x4a1f('0x6e');return db[_0x4a1f('0x6f')][_0x4a1f('0x58')]({'where':{'id':_0x300acc['ContactId']},'attributes':[_0x4a1f('0x70'),'lastName']})[_0x4a1f('0x27')](function(_0x5d4560){if(!_['isNil'](_0x38b116)&&!_[_0x4a1f('0x71')](_0x5d4560[_0x4a1f('0x70')])){_0x300acc[_0x4a1f('0x72')]=_0x5d4560[_0x4a1f('0x70')];if(!_[_0x4a1f('0x71')](_0x5d4560['lastName'])){_0x300acc[_0x4a1f('0x72')]+='\x20'+_0x5d4560[_0x4a1f('0x73')];}}})[_0x4a1f('0x74')](function(){return db[_0x4a1f('0x75')][_0x4a1f('0x59')](_0x300acc);});}})[_0x4a1f('0x27')](function(){return _0x38b116['status'](0xcc)[_0x4a1f('0x1e')]();})['catch'](handleError(_0x38b116,null));};exports['getPreview']=function(_0x4c73f7,_0x4e42c2,_0x2cbdbc){var _0x46dc58=[];return db[_0x4a1f('0x6f')][_0x4a1f('0x5b')]()[_0x4a1f('0x27')](function(_0x428eed){_0x46dc58=_[_0x4a1f('0x33')](_0x428eed);return _0x4c73f7[_0x4a1f('0x68')][_0x4a1f('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x4a1f('0x77')},'attributes':['id',_0x4a1f('0x78')],'raw':!![]});})[_0x4a1f('0x27')](function(_0x1a8912){if(_0x1a8912&&_0x1a8912['length']){return db[_0x4a1f('0x79')][_0x4a1f('0x7a')](function(_0x34ab85){var _0x5a180d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4a1f('0x6a')](_0x4a1f('0x6b'))},'VoiceQueueId':{'$in':_[_0x4a1f('0x2c')](_0x1a8912,'id')},'$or':[{'UserId':null},{'UserId':_0x4c73f7[_0x4a1f('0x68')]['id']}]};var _0x4222c3=[];if(_0x4c73f7['body'][_0x4a1f('0x7b')]&&_0x4c73f7[_0x4a1f('0x5a')][_0x4a1f('0x7b')]===_0x4a1f('0x7c')){if(!_[_0x4a1f('0x7d')](_0x4c73f7['body']['hopperIds'])){_0x5a180d['id']={'$in':_0x4c73f7[_0x4a1f('0x5a')][_0x4a1f('0x7e')]};}_0x4222c3=[[_0x4a1f('0x7f'),'ASC'],['scheduledAt',_0x1a8912[0x0]['dialOrderByScheduledAt']==='ASC'?_0x4a1f('0x80'):'ASC'],db['sequelize'][_0x4a1f('0x81')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_['isEmpty'](_0x4c73f7['body'][_0x4a1f('0x7e')])){_0x5a180d['id']={'$notIn':_0x4c73f7[_0x4a1f('0x5a')][_0x4a1f('0x7e')]};}_0x4222c3=[[_0x4a1f('0x7f'),_0x4a1f('0x80')],[_0x4a1f('0x82'),_0x1a8912[0x0][_0x4a1f('0x78')]],db[_0x4a1f('0x79')][_0x4a1f('0x81')](_0x4a1f('0x83')),['id',_0x4a1f('0x84')]];}return db['CmHopper'][_0x4a1f('0x85')]({'attributes':['id',_0x4a1f('0x86')],'where':_0x5a180d,'order':_0x4222c3,'transaction':_0x34ab85,'lock':_0x34ab85['LOCK']['UPDATE'],'include':[{'model':db[_0x4a1f('0x6f')],'as':_0x4a1f('0x87'),'attributes':_0x46dc58,'include':[{'model':db[_0x4a1f('0x88')],'as':'Company','attributes':['id',_0x4a1f('0x2a')]}]},{'model':db[_0x4a1f('0x89')],'as':_0x4a1f('0x8a'),'attributes':['id',_0x4a1f('0x2a')]},{'model':db[_0x4a1f('0x5e')],'as':_0x4a1f('0x8b'),'attributes':['id',_0x4a1f('0x2a'),_0x4a1f('0x8c')]}]})['then'](function(_0x5e3c21){if(_0x5e3c21){return _0x5e3c21[_0x4a1f('0x25')]({'UserId':_0x4c73f7[_0x4a1f('0x68')]['id']},{'transaction':_0x34ab85});}});});}})[_0x4a1f('0x27')](handleEntityNotFound(_0x4e42c2,null))[_0x4a1f('0x27')](respondWithResult(_0x4e42c2,null))[_0x4a1f('0x53')](handleError(_0x4e42c2,null));};exports[_0x4a1f('0x8d')]=function(_0x4cb37b,_0x546d05,_0x35f88e){return _0x4cb37b['user'][_0x4a1f('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x4a1f('0x77')},'attributes':['id'],'raw':!![]})[_0x4a1f('0x27')](function(_0x3832c5){if(_0x3832c5&&_0x3832c5[_0x4a1f('0x56')]){return db[_0x4a1f('0x2d')][_0x4a1f('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x4a1f('0x2c')](_0x3832c5,'id')},'$or':[{'UserId':null},{'UserId':_0x4cb37b[_0x4a1f('0x68')]['id']}]}});}return 0x0;})[_0x4a1f('0x27')](function(_0x3d4c28){if(!_[_0x4a1f('0x71')](_0x3d4c28)&&_['isNumber'](_0x3d4c28)){return _0x546d05[_0x4a1f('0x1d')](0xc8)[_0x4a1f('0x1f')]({'contacts':_0x3d4c28});}else{logger[_0x4a1f('0x28')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x4a1f('0x8d'),0x194,_0x4a1f('0x8e'));_0x546d05['sendStatus'](0x194);}})[_0x4a1f('0x53')](handleError(_0x546d05,null));};exports[_0x4a1f('0x8f')]=function(_0x1ec28a,_0x8ad63b,_0x22fafd){var _0x4ec010=shared[_0x4a1f('0x90')];var _0x19e05e=[];_[_0x4a1f('0x2c')](_0x4ec010,function(_0x4618bc){_0x19e05e[_0x4a1f('0x91')]({'id':_0x4618bc[_0x4a1f('0x2a')],'name':_0x4618bc['name'],'utcOffset':_0x4618bc[_0x4a1f('0x92')]});});return _0x8ad63b['status'](0xc8)[_0x4a1f('0x1f')]({'tz':_0x19e05e});};exports['getTimezone']=function(_0x21bae2,_0x524b72,_0x33b60c){var _0x46217c=shared[_0x4a1f('0x90')];var _0x1dd59b={};if(!_[_0x4a1f('0x71')](_0x46217c[_0x21bae2[_0x4a1f('0x5a')]['id']]))_0x1dd59b=_0x46217c[_0x21bae2[_0x4a1f('0x5a')]['id']];return _0x524b72[_0x4a1f('0x1d')](0xc8)['json'](_0x1dd59b);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 29669a1..7abf1af 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 _0x0ce0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','phone','priority','lodash','util','../../config/logger','api'];(function(_0x3fcf30,_0xe3a49e){var _0x2ed4b0=function(_0x306e68){while(--_0x306e68){_0x3fcf30['push'](_0x3fcf30['shift']());}};_0x2ed4b0(++_0xe3a49e);}(_0x0ce0,0xb2));var _0x00ce=function(_0x48f011,_0x4f4a87){_0x48f011=_0x48f011-0x0;var _0x47824e=_0x0ce0[_0x48f011];return _0x47824e;};'use strict';var _=require(_0x00ce('0x0'));var util=require(_0x00ce('0x1'));var logger=require(_0x00ce('0x2'))(_0x00ce('0x3'));var moment=require(_0x00ce('0x4'));var BPromise=require(_0x00ce('0x5'));var rp=require(_0x00ce('0x6'));var fs=require('fs');var path=require(_0x00ce('0x7'));var rimraf=require(_0x00ce('0x8'));var config=require(_0x00ce('0x9'));var attributes=require('./cmHopper.attributes');module[_0x00ce('0xa')]=function(_0x3a2d15,_0x5dce57){return _0x3a2d15[_0x00ce('0xb')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0x00ce('0xc'),'fields':['phone']},{'name':_0x00ce('0xd'),'fields':[_0x00ce('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb65=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','CmHopper','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x3ace5f,_0x3bd72a){var _0x5e1835=function(_0x1ed686){while(--_0x1ed686){_0x3ace5f['push'](_0x3ace5f['shift']());}};_0x5e1835(++_0x3bd72a);}(_0xeb65,0xc3));var _0x5eb6=function(_0x53df49,_0x4c47a1){_0x53df49=_0x53df49-0x0;var _0x1d85f0=_0xeb65[_0x53df49];return _0x1d85f0;};'use strict';var _=require(_0x5eb6('0x0'));var util=require(_0x5eb6('0x1'));var logger=require(_0x5eb6('0x2'))('api');var moment=require(_0x5eb6('0x3'));var BPromise=require(_0x5eb6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5eb6('0x5'));var rimraf=require(_0x5eb6('0x6'));var config=require(_0x5eb6('0x7'));var attributes=require(_0x5eb6('0x8'));module['exports']=function(_0x326260,_0x29eca1){return _0x326260['define'](_0x5eb6('0x9'),attributes,{'tableName':_0x5eb6('0xa'),'paranoid':![],'indexes':[{'name':_0x5eb6('0xb'),'fields':[_0x5eb6('0xb')]},{'name':_0x5eb6('0xc'),'fields':[_0x5eb6('0xc')]},{'name':_0x5eb6('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 9d48266..b8c453c 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 _0x493c=['CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','model','attributes','include','map','debug','catch','ShowCmHopper','body','CreateCmHopper','UpdateCmHopper','update','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','limit','LOCK','UPDATE','Contact','keys','User','Agent','voicePause','UserId','push','all','MoveContactManagedDialer','CmHopperFinal','create','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','contactsRescheduled','CountReScheduled','GetContactRecallMe','log','req\x20value','phone\x20value','phone','findOne','DESC','getcontactbyohone','getContactByPhone','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2a1268,_0x4f93b8){var _0x2bf668=function(_0x50b8e5){while(--_0x50b8e5){_0x2a1268['push'](_0x2a1268['shift']());}};_0x2bf668(++_0x4f93b8);}(_0x493c,0x161));var _0xc493=function(_0x4f9ecf,_0x3004c3){_0x4f9ecf=_0x4f9ecf-0x0;var _0x10eca6=_0x493c[_0x4f9ecf];return _0x10eca6;};'use strict';var _=require('lodash');var util=require(_0xc493('0x0'));var moment=require(_0xc493('0x1'));var BPromise=require(_0xc493('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc493('0x3'));var db=require(_0xc493('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc493('0x5'));var config=require('../../config/environment');var jayson=require(_0xc493('0x6'));var client=jayson[_0xc493('0x7')][_0xc493('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41cff3,_0x40552d,_0xf5aa16){return new BPromise(function(_0x833c08,_0x1245c5){return client[_0xc493('0x9')](_0x41cff3,_0xf5aa16)[_0xc493('0xa')](function(_0x50f4a0){logger[_0xc493('0xb')](_0xc493('0xc'),_0x40552d,'request\x20sent');logger['debug'](_0xc493('0xd'),_0x40552d,_0xc493('0xe'),JSON[_0xc493('0xf')](_0x50f4a0));if(_0x50f4a0[_0xc493('0x10')]){if(_0x50f4a0['error']['code']===0x1f4){logger['error'](_0xc493('0xc'),_0x40552d,_0x50f4a0[_0xc493('0x10')][_0xc493('0x11')]);return _0x1245c5(_0x50f4a0[_0xc493('0x10')][_0xc493('0x11')]);}logger[_0xc493('0x10')](_0xc493('0xc'),_0x40552d,_0x50f4a0[_0xc493('0x10')]['message']);return _0x833c08(_0x50f4a0[_0xc493('0x10')][_0xc493('0x11')]);}else{logger[_0xc493('0xb')](_0xc493('0xc'),_0x40552d,_0xc493('0xe'));_0x833c08(_0x50f4a0[_0xc493('0x12')][_0xc493('0x11')]);}})['catch'](function(_0x4698bd){logger[_0xc493('0x10')](_0xc493('0xc'),_0x40552d,_0x4698bd);_0x1245c5(_0x4698bd);});});}exports[_0xc493('0x13')]=function(_0x26783a){var _0x388e4b=this;return new Promise(function(_0x65b13e,_0x6247e){return db[_0xc493('0x14')][_0xc493('0x15')]({'raw':_0x26783a[_0xc493('0x16')]?_0x26783a[_0xc493('0x16')][_0xc493('0x17')]===undefined?!![]:![]:!![],'where':_0x26783a['options']?_0x26783a[_0xc493('0x16')][_0xc493('0x18')]||null:null,'attributes':_0x26783a['options']?_0x26783a[_0xc493('0x16')]['attributes']||null:null,'limit':_0x26783a['options']?_0x26783a[_0xc493('0x16')]['limit']||null:null,'include':_0x26783a['options']?_0x26783a[_0xc493('0x16')]['include']?_['map'](_0x26783a['options']['include'],function(_0x31a8ca){return{'model':db[_0x31a8ca[_0xc493('0x19')]],'as':_0x31a8ca['as'],'attributes':_0x31a8ca[_0xc493('0x1a')],'include':_0x31a8ca[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x31a8ca[_0xc493('0x1b')],function(_0x4429ba){return{'model':db[_0x4429ba[_0xc493('0x19')]],'as':_0x4429ba['as'],'attributes':_0x4429ba[_0xc493('0x1a')],'include':_0x4429ba[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x4429ba[_0xc493('0x1b')],function(_0x1769de){return{'model':db[_0x1769de[_0xc493('0x19')]],'as':_0x1769de['as'],'attributes':_0x1769de[_0xc493('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc493('0xa')](function(_0x3631d1){logger[_0xc493('0xb')](_0xc493('0x13'),_0x26783a);logger[_0xc493('0x1d')](_0xc493('0x13'),_0x26783a,JSON['stringify'](_0x3631d1));_0x65b13e(_0x3631d1);})[_0xc493('0x1e')](function(_0x99df85){logger[_0xc493('0x10')](_0xc493('0x13'),_0x99df85[_0xc493('0x11')],_0x26783a);_0x6247e(_0x388e4b[_0xc493('0x10')](0x1f4,_0x99df85[_0xc493('0x11')]));});});};exports[_0xc493('0x1f')]=function(_0x3974bd){var _0x2a7a9b=this;return new Promise(function(_0x41abb1,_0x595503){return db['CmHopper']['find']({'raw':_0x3974bd['options']?_0x3974bd[_0xc493('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3974bd[_0xc493('0x16')]?_0x3974bd['options'][_0xc493('0x18')]||null:null,'attributes':_0x3974bd[_0xc493('0x16')]?_0x3974bd[_0xc493('0x16')]['attributes']||null:null,'include':_0x3974bd[_0xc493('0x16')]?_0x3974bd[_0xc493('0x16')][_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x3974bd[_0xc493('0x16')][_0xc493('0x1b')],function(_0x4e521a){return{'model':db[_0x4e521a[_0xc493('0x19')]],'as':_0x4e521a['as'],'attributes':_0x4e521a[_0xc493('0x1a')],'include':_0x4e521a[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x4e521a[_0xc493('0x1b')],function(_0x1f5f2c){return{'model':db[_0x1f5f2c[_0xc493('0x19')]],'as':_0x1f5f2c['as'],'attributes':_0x1f5f2c[_0xc493('0x1a')],'include':_0x1f5f2c[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x1f5f2c[_0xc493('0x1b')],function(_0x583341){return{'model':db[_0x583341[_0xc493('0x19')]],'as':_0x583341['as'],'attributes':_0x583341['attributes']};}):[]};}):[]};}):[]:[]})[_0xc493('0xa')](function(_0x33c1d7){logger[_0xc493('0xb')](_0xc493('0x1f'),_0x3974bd);logger[_0xc493('0x1d')](_0xc493('0x1f'),_0x3974bd,JSON[_0xc493('0xf')](_0x33c1d7));_0x41abb1(_0x33c1d7);})[_0xc493('0x1e')](function(_0x1f7e73){logger[_0xc493('0x10')](_0xc493('0x1f'),_0x1f7e73[_0xc493('0x11')],_0x3974bd);_0x595503(_0x2a7a9b[_0xc493('0x10')](0x1f4,_0x1f7e73['message']));});});};exports['CreateCmHopper']=function(_0x4acea6){var _0x58e3e6=this;return new Promise(function(_0x1b81d2,_0x14e9e4){return db[_0xc493('0x14')]['create'](_0x4acea6[_0xc493('0x20')],{'raw':_0x4acea6[_0xc493('0x16')]?_0x4acea6[_0xc493('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xc493('0xa')](function(_0x3d5a5a){logger[_0xc493('0xb')](_0xc493('0x21'),_0x4acea6);logger[_0xc493('0x1d')]('CreateCmHopper',_0x4acea6,JSON[_0xc493('0xf')](_0x3d5a5a));_0x1b81d2(_0x3d5a5a);})[_0xc493('0x1e')](function(_0x16dcb1){logger[_0xc493('0x10')]('CreateCmHopper',_0x16dcb1[_0xc493('0x11')],_0x4acea6);_0x14e9e4(_0x58e3e6['error'](0x1f4,_0x16dcb1['message']));});});};exports[_0xc493('0x22')]=function(_0xb18f2d){var _0x5530e2=this;return new Promise(function(_0xa48251,_0x582312){return db[_0xc493('0x14')][_0xc493('0x23')](_0xb18f2d[_0xc493('0x20')],{'raw':_0xb18f2d[_0xc493('0x16')]?_0xb18f2d[_0xc493('0x16')][_0xc493('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb18f2d[_0xc493('0x16')]?_0xb18f2d[_0xc493('0x16')][_0xc493('0x18')]||null:null,'attributes':_0xb18f2d[_0xc493('0x16')]?_0xb18f2d[_0xc493('0x16')][_0xc493('0x1a')]||null:null,'limit':_0xb18f2d[_0xc493('0x16')]?_0xb18f2d[_0xc493('0x16')]['limit']||null:null})[_0xc493('0xa')](function(_0x59c162){logger[_0xc493('0xb')]('UpdateCmHopper',_0xb18f2d);logger[_0xc493('0x1d')](_0xc493('0x22'),_0xb18f2d,JSON[_0xc493('0xf')](_0x59c162));_0xa48251(_0x59c162);})[_0xc493('0x1e')](function(_0x3adce9){logger[_0xc493('0x10')]('UpdateCmHopper',_0x3adce9['message'],_0xb18f2d);_0x582312(_0x5530e2[_0xc493('0x10')](0x1f4,_0x3adce9[_0xc493('0x11')]));});});};exports['DestroyCmHopper']=function(_0x441a3f){var _0x5ef527=this;return new Promise(function(_0x7ca62,_0x2be0f5){return db[_0xc493('0x14')][_0xc493('0x24')]({'where':_0x441a3f[_0xc493('0x16')]?_0x441a3f[_0xc493('0x16')][_0xc493('0x18')]||null:null})[_0xc493('0xa')](function(_0x4b336d){logger[_0xc493('0xb')]('DestroyCmHopper',_0x441a3f);logger['debug'](_0xc493('0x25'),_0x441a3f,JSON[_0xc493('0xf')](_0x4b336d));_0x7ca62(_0x4b336d);})['catch'](function(_0x1af985){logger['error']('DestroyCmHopper',_0x1af985[_0xc493('0x11')],_0x441a3f);_0x2be0f5(_0x5ef527[_0xc493('0x10')](0x1f4,_0x1af985[_0xc493('0x11')]));});});};exports[_0xc493('0x26')]=function(_0x56106c){var _0x126605=this;return new Promise(function(_0x7f809a,_0x367d01){return db[_0xc493('0x27')][_0xc493('0x28')]()[_0xc493('0xa')](function(_0x27f34d){return db['sequelize'][_0xc493('0x29')](function(_0x340dc5){return db[_0xc493('0x14')][_0xc493('0x15')]({'where':_0x56106c['options']?_0x56106c[_0xc493('0x16')]['where']||null:null,'attributes':_0x56106c[_0xc493('0x16')]?_0x56106c[_0xc493('0x16')][_0xc493('0x1a')]||null:null,'limit':_0x56106c[_0xc493('0x16')]?_0x56106c[_0xc493('0x16')][_0xc493('0x2a')]||null:null,'order':_0x56106c[_0xc493('0x16')]?_0x56106c[_0xc493('0x16')]['order']||null:null,'transaction':_0x340dc5,'lock':_0x340dc5[_0xc493('0x2b')][_0xc493('0x2c')],'include':[{'model':db['CmContact'],'as':_0xc493('0x2d'),'attributes':_[_0xc493('0x2e')](_0x27f34d)},{'model':db[_0xc493('0x2f')],'as':_0xc493('0x30'),'attributes':['id','name',_0xc493('0x31')]}]})[_0xc493('0xa')](function(_0x17d99f){var _0x371dbc=[];var _0x2113bb=[];for(var _0x3f279c=0x0;_0x3f279c<_0x17d99f['length'];_0x3f279c+=0x1){if(!_0x2113bb['includes'](_0x17d99f[_0x3f279c][_0xc493('0x32')])){_0x2113bb[_0xc493('0x33')](_0x17d99f[_0x3f279c]['UserId']);_0x371dbc[_0xc493('0x33')](_0x17d99f[_0x3f279c]['update'](_0x56106c[_0xc493('0x20')],{'transaction':_0x340dc5}));}}return BPromise[_0xc493('0x34')](_0x371dbc);});})['then'](function(_0x40fd3e){logger[_0xc493('0xb')](_0xc493('0x26'),_0x56106c);logger[_0xc493('0x1d')](_0xc493('0x26'),_0x56106c,JSON['stringify'](_0x40fd3e));_0x7f809a(_0x40fd3e);})[_0xc493('0x1e')](function(_0x3599a6){logger['error'](_0xc493('0x26'),_0x3599a6['message'],_0x56106c);_0x367d01(_0x126605[_0xc493('0x10')](0x1f4,_0x3599a6['message']));});});});};exports[_0xc493('0x35')]=function(_0x1b1848){var _0x45710d=this;return new Promise(function(_0x4ac5df,_0x24ce19){return db['sequelize'][_0xc493('0x29')](function(_0x1d1591){return db[_0xc493('0x36')][_0xc493('0x37')](_0x1b1848[_0xc493('0x20')],{'raw':_0x1b1848['options']?_0x1b1848[_0xc493('0x16')][_0xc493('0x17')]===undefined?!![]:![]:!![],'transaction':_0x1d1591})['then'](function(){return db[_0xc493('0x14')][_0xc493('0x24')]({'where':_0x1b1848['options']?_0x1b1848[_0xc493('0x16')][_0xc493('0x18')]||null:null,'transaction':_0x1d1591});});})['then'](function(_0x1dc94b){logger[_0xc493('0xb')](_0xc493('0x35'),_0x1b1848);logger[_0xc493('0x1d')](_0xc493('0x35'),_0x1b1848,JSON['stringify'](_0x1dc94b));_0x4ac5df(_0x1dc94b);})[_0xc493('0x1e')](function(_0x4eab4b){logger[_0xc493('0x10')]('MoveContactManagedDialer',_0x4eab4b['message'],_0x1b1848);_0x24ce19(_0x45710d[_0xc493('0x10')](0x1f4,_0x4eab4b['message']));});});};exports['CountReScheduled']=function(_0x479b7b){var _0x545746=this;return new Promise(function(_0x500e18,_0x308b31){return db[_0xc493('0x14')][_0xc493('0x15')]({'raw':_0x479b7b[_0xc493('0x16')]?_0x479b7b[_0xc493('0x16')][_0xc493('0x17')]===undefined?!![]:![]:!![],'where':_0x479b7b['options']?_0x479b7b[_0xc493('0x16')][_0xc493('0x18')]||null:null,'attributes':[[db[_0xc493('0x38')]['fn'](_0xc493('0x39'),db[_0xc493('0x38')]['fn']('IF',db[_0xc493('0x38')][_0xc493('0x3a')](_0xc493('0x3b')+util[_0xc493('0x3c')](_0xc493('0x3d'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0xc493('0x3e')]]})[_0xc493('0xa')](function(_0x3df2e2){logger[_0xc493('0xb')](_0xc493('0x3f'),_0x479b7b);logger[_0xc493('0x1d')]('CountReScheduled',_0x479b7b,JSON[_0xc493('0xf')](_0x3df2e2));_0x500e18(_0x3df2e2);})[_0xc493('0x1e')](function(_0x483d9d){logger[_0xc493('0x10')](_0xc493('0x3f'),_0x483d9d['message'],_0x479b7b);_0x308b31(_0x545746[_0xc493('0x10')](0x1f4,_0x483d9d[_0xc493('0x11')]));});});};exports['GetContactRecallMe']=function(_0x3b01f3){var _0x1ca7bf=this;return new Promise(function(_0x57d66f,_0xb67e03){return db['CmContact'][_0xc493('0x28')]()['then'](function(_0x501980){return db[_0xc493('0x38')][_0xc493('0x29')](function(_0x58f21c){return db[_0xc493('0x14')][_0xc493('0x15')]({'where':_0x3b01f3[_0xc493('0x16')]?_0x3b01f3[_0xc493('0x16')]['where']||null:null,'attributes':_0x3b01f3['options']?_0x3b01f3[_0xc493('0x16')][_0xc493('0x1a')]||null:null,'limit':0x1,'order':_0x3b01f3[_0xc493('0x16')]?_0x3b01f3['options']['order']||null:null,'group':db[_0xc493('0x14')]['UserId'],'transaction':_0x58f21c,'lock':_0x58f21c['LOCK'][_0xc493('0x2c')],'include':_0x3b01f3[_0xc493('0x16')]?_0x3b01f3['options']['include']?_[_0xc493('0x1c')](_0x3b01f3[_0xc493('0x16')][_0xc493('0x1b')],function(_0x1376af){return{'model':db[_0x1376af[_0xc493('0x19')]],'as':_0x1376af['as'],'attributes':_0x1376af[_0xc493('0x1a')],'include':_0x1376af[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x1376af[_0xc493('0x1b')],function(_0x124dd5){return{'model':db[_0x124dd5['model']],'as':_0x124dd5['as'],'attributes':_0x124dd5[_0xc493('0x1a')],'include':_0x124dd5[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x124dd5[_0xc493('0x1b')],function(_0x10ab21){return{'model':db[_0x10ab21[_0xc493('0x19')]],'as':_0x10ab21['as'],'attributes':_0x10ab21[_0xc493('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc493('0xa')](function(_0x25eff1){var _0x44d0d5=[];for(var _0x104132=0x0;_0x104132<_0x25eff1['length'];_0x104132+=0x1){_0x44d0d5['push'](_0x25eff1[_0x104132][_0xc493('0x23')](_0x3b01f3[_0xc493('0x20')],{'transaction':_0x58f21c}));}return BPromise['all'](_0x44d0d5);});})[_0xc493('0xa')](function(_0x5539cb){logger['info']('GetContactRecallMe',_0x3b01f3);logger[_0xc493('0x1d')](_0xc493('0x40'),_0x3b01f3,JSON[_0xc493('0xf')](_0x5539cb));_0x57d66f(_0x5539cb);})[_0xc493('0x1e')](function(_0x38e70f){logger[_0xc493('0x10')](_0xc493('0x40'),_0x38e70f[_0xc493('0x11')],_0x3b01f3);_0xb67e03(_0x1ca7bf[_0xc493('0x10')](0x1f4,_0x38e70f[_0xc493('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x2792ca){var _0x5a721d=this;return new Promise(function(_0xe63a19,_0x469465){db[_0xc493('0x27')][_0xc493('0x28')]()[_0xc493('0xa')](function(_0x335a70){return db[_0xc493('0x14')][_0xc493('0x15')]({'raw':_0x2792ca[_0xc493('0x16')]?_0x2792ca[_0xc493('0x16')][_0xc493('0x17')]===undefined?!![]:![]:!![],'where':_0x2792ca[_0xc493('0x16')]?_0x2792ca[_0xc493('0x16')][_0xc493('0x18')]||null:null,'attributes':_0x2792ca['options']?_0x2792ca[_0xc493('0x16')]['attributes']||null:null,'limit':_0x2792ca[_0xc493('0x16')]?_0x2792ca[_0xc493('0x16')]['limit']||null:null,'include':_0x2792ca[_0xc493('0x16')]?_0x2792ca[_0xc493('0x16')]['include']?_[_0xc493('0x1c')](_0x2792ca[_0xc493('0x16')][_0xc493('0x1b')],function(_0x128a96){return{'model':db[_0x128a96['model']],'as':_0x128a96['as'],'attributes':_0x128a96['as']===_0xc493('0x2d')?_['keys'](_0x335a70):_0x128a96[_0xc493('0x1a')],'include':_0x128a96[_0xc493('0x1b')]?_['map'](_0x128a96[_0xc493('0x1b')],function(_0x6f2bc4){return{'model':db[_0x6f2bc4[_0xc493('0x19')]],'as':_0x6f2bc4['as'],'attributes':_0x6f2bc4['attributes'],'include':_0x6f2bc4[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x6f2bc4[_0xc493('0x1b')],function(_0x2f5542){return{'model':db[_0x2f5542[_0xc493('0x19')]],'as':_0x2f5542['as'],'attributes':_0x2f5542[_0xc493('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc493('0xa')](function(_0x16b406){logger[_0xc493('0xb')](_0xc493('0x13'),_0x2792ca);logger[_0xc493('0x1d')](_0xc493('0x13'),_0x2792ca,JSON[_0xc493('0xf')](_0x16b406));_0xe63a19(_0x16b406);})[_0xc493('0x1e')](function(_0xc49782){logger[_0xc493('0x10')](_0xc493('0x13'),_0xc49782[_0xc493('0x11')],_0x2792ca);_0x469465(_0x5a721d[_0xc493('0x10')](0x1f4,_0xc49782[_0xc493('0x11')]));});});});};exports['GetContactByPhone']=function(_0x5823cd){console[_0xc493('0x41')](_0xc493('0x42'),_0x5823cd);console['log'](_0xc493('0x43'),_0x5823cd['options'][_0xc493('0x18')][_0xc493('0x44')]);_this=this;return new Promise(function(_0x3ac299,_0x48fc26){return db[_0xc493('0x27')][_0xc493('0x45')]({'raw':!![],'where':{'phone':_0x5823cd[_0xc493('0x16')][_0xc493('0x18')]['phone']},'attributes':['id'],'order':[['id',_0xc493('0x46')]]})[_0xc493('0xa')](function(_0x2009ad){console[_0xc493('0x41')](_0xc493('0x47'),_0x2009ad);logger[_0xc493('0xb')](_0xc493('0x48'),_0x5823cd);logger[_0xc493('0x1d')](_0xc493('0x48'),_0x5823cd,JSON[_0xc493('0xf')](_0x2009ad));_0x3ac299(_0x2009ad);})[_0xc493('0x1e')](function(_0x41e01e){logger[_0xc493('0x10')](_0xc493('0x48'),_0x41e01e[_0xc493('0x11')],_0x5823cd);_0x48fc26(_this[_0xc493('0x10')](0x1f4,_0x41e01e['message']));});});}; \ No newline at end of file +var _0xe635=['find','ShowCmHopper','create','body','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','LOCK','Contact','keys','User','name','voicePause','UserId','push','all','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','GetContactByPhone','log','req\x20value','phone\x20value','findOne','phone','dialTimezone','getcontactbyohone','getContactByPhone','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xe635,0xc9));var _0x5e63=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0xe635[_0xdeac17];return _0x33aabd;};'use strict';var _=require(_0x5e63('0x0'));var util=require(_0x5e63('0x1'));var moment=require(_0x5e63('0x2'));var BPromise=require(_0x5e63('0x3'));var rs=require(_0x5e63('0x4'));var fs=require('fs');var Redis=require(_0x5e63('0x5'));var db=require(_0x5e63('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e63('0x7'))(_0x5e63('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5e63('0x9')][_0x5e63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x525875,_0x293187,_0x4cc4db){return new BPromise(function(_0x1b0859,_0x465e91){return client['request'](_0x525875,_0x4cc4db)[_0x5e63('0xb')](function(_0x683002){logger[_0x5e63('0xc')](_0x5e63('0xd'),_0x293187,_0x5e63('0xe'));logger[_0x5e63('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x293187,_0x5e63('0xe'),JSON[_0x5e63('0x10')](_0x683002));if(_0x683002[_0x5e63('0x11')]){if(_0x683002[_0x5e63('0x11')][_0x5e63('0x12')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x293187,_0x683002['error'][_0x5e63('0x13')]);return _0x465e91(_0x683002['error'][_0x5e63('0x13')]);}logger['error'](_0x5e63('0xd'),_0x293187,_0x683002['error'][_0x5e63('0x13')]);return _0x1b0859(_0x683002['error'][_0x5e63('0x13')]);}else{logger[_0x5e63('0xc')](_0x5e63('0xd'),_0x293187,_0x5e63('0xe'));_0x1b0859(_0x683002[_0x5e63('0x14')]['message']);}})[_0x5e63('0x15')](function(_0x5df442){logger[_0x5e63('0x11')](_0x5e63('0xd'),_0x293187,_0x5df442);_0x465e91(_0x5df442);});});}exports[_0x5e63('0x16')]=function(_0x591638){var _0x5b6723=this;return new Promise(function(_0x58609f,_0x4373f6){return db[_0x5e63('0x17')][_0x5e63('0x18')]({'raw':_0x591638['options']?_0x591638[_0x5e63('0x19')][_0x5e63('0x1a')]===undefined?!![]:![]:!![],'where':_0x591638[_0x5e63('0x19')]?_0x591638[_0x5e63('0x19')][_0x5e63('0x1b')]||null:null,'attributes':_0x591638[_0x5e63('0x19')]?_0x591638[_0x5e63('0x19')][_0x5e63('0x1c')]||null:null,'limit':_0x591638[_0x5e63('0x19')]?_0x591638[_0x5e63('0x19')][_0x5e63('0x1d')]||null:null,'include':_0x591638[_0x5e63('0x19')]?_0x591638[_0x5e63('0x19')][_0x5e63('0x1e')]?_['map'](_0x591638['options'][_0x5e63('0x1e')],function(_0x3c0f53){return{'model':db[_0x3c0f53['model']],'as':_0x3c0f53['as'],'attributes':_0x3c0f53['attributes'],'include':_0x3c0f53[_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x3c0f53[_0x5e63('0x1e')],function(_0x43da17){return{'model':db[_0x43da17[_0x5e63('0x20')]],'as':_0x43da17['as'],'attributes':_0x43da17[_0x5e63('0x1c')],'include':_0x43da17['include']?_[_0x5e63('0x1f')](_0x43da17['include'],function(_0x38da1a){return{'model':db[_0x38da1a[_0x5e63('0x20')]],'as':_0x38da1a['as'],'attributes':_0x38da1a['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e63('0xb')](function(_0x3e063c){logger[_0x5e63('0xc')](_0x5e63('0x16'),_0x591638);logger['debug']('GetCmHopper',_0x591638,JSON[_0x5e63('0x10')](_0x3e063c));_0x58609f(_0x3e063c);})[_0x5e63('0x15')](function(_0x3e637d){logger['error']('GetCmHopper',_0x3e637d[_0x5e63('0x13')],_0x591638);_0x4373f6(_0x5b6723['error'](0x1f4,_0x3e637d[_0x5e63('0x13')]));});});};exports['ShowCmHopper']=function(_0x565599){var _0x479ead=this;return new Promise(function(_0x287c09,_0x2ed04f){return db[_0x5e63('0x17')][_0x5e63('0x21')]({'raw':_0x565599[_0x5e63('0x19')]?_0x565599[_0x5e63('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x565599[_0x5e63('0x19')]?_0x565599['options']['where']||null:null,'attributes':_0x565599[_0x5e63('0x19')]?_0x565599['options']['attributes']||null:null,'include':_0x565599[_0x5e63('0x19')]?_0x565599['options'][_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x565599[_0x5e63('0x19')]['include'],function(_0x12b742){return{'model':db[_0x12b742[_0x5e63('0x20')]],'as':_0x12b742['as'],'attributes':_0x12b742['attributes'],'include':_0x12b742[_0x5e63('0x1e')]?_['map'](_0x12b742[_0x5e63('0x1e')],function(_0x19f5de){return{'model':db[_0x19f5de[_0x5e63('0x20')]],'as':_0x19f5de['as'],'attributes':_0x19f5de[_0x5e63('0x1c')],'include':_0x19f5de[_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x19f5de[_0x5e63('0x1e')],function(_0x3ab1c2){return{'model':db[_0x3ab1c2['model']],'as':_0x3ab1c2['as'],'attributes':_0x3ab1c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e63('0xb')](function(_0x7d187){logger[_0x5e63('0xc')](_0x5e63('0x22'),_0x565599);logger[_0x5e63('0xf')](_0x5e63('0x22'),_0x565599,JSON[_0x5e63('0x10')](_0x7d187));_0x287c09(_0x7d187);})[_0x5e63('0x15')](function(_0x3c5348){logger[_0x5e63('0x11')](_0x5e63('0x22'),_0x3c5348[_0x5e63('0x13')],_0x565599);_0x2ed04f(_0x479ead[_0x5e63('0x11')](0x1f4,_0x3c5348['message']));});});};exports['CreateCmHopper']=function(_0x3dacf7){var _0x30b361=this;return new Promise(function(_0x251388,_0x204de7){return db[_0x5e63('0x17')][_0x5e63('0x23')](_0x3dacf7[_0x5e63('0x24')],{'raw':_0x3dacf7[_0x5e63('0x19')]?_0x3dacf7[_0x5e63('0x19')][_0x5e63('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x7f8b01){logger[_0x5e63('0xc')](_0x5e63('0x25'),_0x3dacf7);logger[_0x5e63('0xf')](_0x5e63('0x25'),_0x3dacf7,JSON[_0x5e63('0x10')](_0x7f8b01));_0x251388(_0x7f8b01);})['catch'](function(_0x4c2e3d){logger[_0x5e63('0x11')](_0x5e63('0x25'),_0x4c2e3d['message'],_0x3dacf7);_0x204de7(_0x30b361['error'](0x1f4,_0x4c2e3d[_0x5e63('0x13')]));});});};exports['UpdateCmHopper']=function(_0x591aae){var _0x25997e=this;return new Promise(function(_0x1f233f,_0x3ceabf){return db[_0x5e63('0x17')][_0x5e63('0x26')](_0x591aae[_0x5e63('0x24')],{'raw':_0x591aae[_0x5e63('0x19')]?_0x591aae[_0x5e63('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x591aae[_0x5e63('0x19')]?_0x591aae['options'][_0x5e63('0x1b')]||null:null,'attributes':_0x591aae['options']?_0x591aae[_0x5e63('0x19')][_0x5e63('0x1c')]||null:null,'limit':_0x591aae[_0x5e63('0x19')]?_0x591aae[_0x5e63('0x19')][_0x5e63('0x1d')]||null:null})[_0x5e63('0xb')](function(_0xbe5dfd){logger['info'](_0x5e63('0x27'),_0x591aae);logger['debug'](_0x5e63('0x27'),_0x591aae,JSON[_0x5e63('0x10')](_0xbe5dfd));_0x1f233f(_0xbe5dfd);})[_0x5e63('0x15')](function(_0xa1edf1){logger[_0x5e63('0x11')](_0x5e63('0x27'),_0xa1edf1['message'],_0x591aae);_0x3ceabf(_0x25997e['error'](0x1f4,_0xa1edf1['message']));});});};exports[_0x5e63('0x28')]=function(_0x59c3b5){var _0x514337=this;return new Promise(function(_0x257ff9,_0x56630a){return db[_0x5e63('0x17')][_0x5e63('0x29')]({'where':_0x59c3b5[_0x5e63('0x19')]?_0x59c3b5[_0x5e63('0x19')][_0x5e63('0x1b')]||null:null})[_0x5e63('0xb')](function(_0x117b53){logger[_0x5e63('0xc')](_0x5e63('0x28'),_0x59c3b5);logger[_0x5e63('0xf')](_0x5e63('0x28'),_0x59c3b5,JSON['stringify'](_0x117b53));_0x257ff9(_0x117b53);})[_0x5e63('0x15')](function(_0x1da26e){logger['error'](_0x5e63('0x28'),_0x1da26e[_0x5e63('0x13')],_0x59c3b5);_0x56630a(_0x514337[_0x5e63('0x11')](0x1f4,_0x1da26e['message']));});});};exports[_0x5e63('0x2a')]=function(_0x5b2837){var _0x34b6bd=this;return new Promise(function(_0x377f6c,_0x4a3b1f){return db[_0x5e63('0x2b')][_0x5e63('0x2c')]()[_0x5e63('0xb')](function(_0x46d2ef){return db['sequelize'][_0x5e63('0x2d')](function(_0x2cc09f){return db[_0x5e63('0x17')]['findAll']({'where':_0x5b2837[_0x5e63('0x19')]?_0x5b2837['options'][_0x5e63('0x1b')]||null:null,'attributes':_0x5b2837[_0x5e63('0x19')]?_0x5b2837[_0x5e63('0x19')]['attributes']||null:null,'limit':_0x5b2837[_0x5e63('0x19')]?_0x5b2837[_0x5e63('0x19')]['limit']||null:null,'order':_0x5b2837[_0x5e63('0x19')]?_0x5b2837[_0x5e63('0x19')][_0x5e63('0x2e')]||null:null,'transaction':_0x2cc09f,'lock':_0x2cc09f[_0x5e63('0x2f')]['UPDATE'],'include':[{'model':db[_0x5e63('0x2b')],'as':_0x5e63('0x30'),'attributes':_[_0x5e63('0x31')](_0x46d2ef)},{'model':db[_0x5e63('0x32')],'as':'Agent','attributes':['id',_0x5e63('0x33'),_0x5e63('0x34')]}]})[_0x5e63('0xb')](function(_0x1e8349){var _0x1cf5bc=[];var _0x31492c=[];for(var _0x369ce7=0x0;_0x369ce7<_0x1e8349['length'];_0x369ce7+=0x1){if(!_0x31492c['includes'](_0x1e8349[_0x369ce7][_0x5e63('0x35')])){_0x31492c[_0x5e63('0x36')](_0x1e8349[_0x369ce7]['UserId']);_0x1cf5bc[_0x5e63('0x36')](_0x1e8349[_0x369ce7][_0x5e63('0x26')](_0x5b2837['body'],{'transaction':_0x2cc09f}));}}return BPromise[_0x5e63('0x37')](_0x1cf5bc);});})[_0x5e63('0xb')](function(_0x46f4d5){logger['info'](_0x5e63('0x2a'),_0x5b2837);logger[_0x5e63('0xf')](_0x5e63('0x2a'),_0x5b2837,JSON[_0x5e63('0x10')](_0x46f4d5));_0x377f6c(_0x46f4d5);})[_0x5e63('0x15')](function(_0x3ecf3a){logger['error'](_0x5e63('0x2a'),_0x3ecf3a[_0x5e63('0x13')],_0x5b2837);_0x4a3b1f(_0x34b6bd[_0x5e63('0x11')](0x1f4,_0x3ecf3a[_0x5e63('0x13')]));});});});};exports[_0x5e63('0x38')]=function(_0x2d7169){var _0x1319dd=this;return new Promise(function(_0x1c0b70,_0xfaf3b8){return db[_0x5e63('0x39')][_0x5e63('0x2d')](function(_0x3ccb3b){return db[_0x5e63('0x3a')][_0x5e63('0x23')](_0x2d7169[_0x5e63('0x24')],{'raw':_0x2d7169[_0x5e63('0x19')]?_0x2d7169[_0x5e63('0x19')]['raw']===undefined?!![]:![]:!![],'transaction':_0x3ccb3b})[_0x5e63('0xb')](function(){return db['CmHopper'][_0x5e63('0x29')]({'where':_0x2d7169[_0x5e63('0x19')]?_0x2d7169[_0x5e63('0x19')][_0x5e63('0x1b')]||null:null,'transaction':_0x3ccb3b});});})[_0x5e63('0xb')](function(_0x249c10){logger['info'](_0x5e63('0x38'),_0x2d7169);logger[_0x5e63('0xf')]('MoveContactManagedDialer',_0x2d7169,JSON[_0x5e63('0x10')](_0x249c10));_0x1c0b70(_0x249c10);})[_0x5e63('0x15')](function(_0xfd69f7){logger[_0x5e63('0x11')](_0x5e63('0x38'),_0xfd69f7[_0x5e63('0x13')],_0x2d7169);_0xfaf3b8(_0x1319dd[_0x5e63('0x11')](0x1f4,_0xfd69f7[_0x5e63('0x13')]));});});};exports[_0x5e63('0x3b')]=function(_0x5f232d){var _0x2d5467=this;return new Promise(function(_0x26f9a3,_0x3c408f){return db['CmHopper'][_0x5e63('0x18')]({'raw':_0x5f232d[_0x5e63('0x19')]?_0x5f232d[_0x5e63('0x19')][_0x5e63('0x1a')]===undefined?!![]:![]:!![],'where':_0x5f232d[_0x5e63('0x19')]?_0x5f232d[_0x5e63('0x19')][_0x5e63('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x5e63('0x3c'),db[_0x5e63('0x39')]['fn']('IF',db[_0x5e63('0x39')]['literal'](_0x5e63('0x3d')+util[_0x5e63('0x3e')](_0x5e63('0x3f'),moment()[_0x5e63('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x5e63('0x40')))),_0x5e63('0x41')]]})['then'](function(_0x1ecfd1){logger[_0x5e63('0xc')](_0x5e63('0x3b'),_0x5f232d);logger['debug'](_0x5e63('0x3b'),_0x5f232d,JSON[_0x5e63('0x10')](_0x1ecfd1));_0x26f9a3(_0x1ecfd1);})[_0x5e63('0x15')](function(_0x4df9cb){logger['error'](_0x5e63('0x3b'),_0x4df9cb[_0x5e63('0x13')],_0x5f232d);_0x3c408f(_0x2d5467['error'](0x1f4,_0x4df9cb['message']));});});};exports[_0x5e63('0x42')]=function(_0x202378){var _0x320cc2=this;return new Promise(function(_0x118128,_0x6a0f98){return db[_0x5e63('0x2b')]['describe']()['then'](function(_0x200649){return db[_0x5e63('0x39')][_0x5e63('0x2d')](function(_0x4886f1){return db[_0x5e63('0x17')][_0x5e63('0x18')]({'where':_0x202378['options']?_0x202378['options']['where']||null:null,'attributes':_0x202378[_0x5e63('0x19')]?_0x202378['options']['attributes']||null:null,'limit':0x1,'order':_0x202378['options']?_0x202378['options'][_0x5e63('0x2e')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x4886f1,'lock':_0x4886f1[_0x5e63('0x2f')][_0x5e63('0x43')],'include':_0x202378[_0x5e63('0x19')]?_0x202378[_0x5e63('0x19')][_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x202378['options'][_0x5e63('0x1e')],function(_0x4bf475){return{'model':db[_0x4bf475['model']],'as':_0x4bf475['as'],'attributes':_0x4bf475[_0x5e63('0x1c')],'include':_0x4bf475['include']?_[_0x5e63('0x1f')](_0x4bf475[_0x5e63('0x1e')],function(_0x41b997){return{'model':db[_0x41b997[_0x5e63('0x20')]],'as':_0x41b997['as'],'attributes':_0x41b997[_0x5e63('0x1c')],'include':_0x41b997[_0x5e63('0x1e')]?_['map'](_0x41b997['include'],function(_0x2a1423){return{'model':db[_0x2a1423['model']],'as':_0x2a1423['as'],'attributes':_0x2a1423[_0x5e63('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5e63('0xb')](function(_0x562a66){var _0x4f0703=[];for(var _0x1d9a1c=0x0;_0x1d9a1c<_0x562a66['length'];_0x1d9a1c+=0x1){_0x4f0703[_0x5e63('0x36')](_0x562a66[_0x1d9a1c][_0x5e63('0x26')](_0x202378[_0x5e63('0x24')],{'transaction':_0x4886f1}));}return BPromise[_0x5e63('0x37')](_0x4f0703);});})['then'](function(_0x166005){logger[_0x5e63('0xc')](_0x5e63('0x42'),_0x202378);logger[_0x5e63('0xf')](_0x5e63('0x42'),_0x202378,JSON[_0x5e63('0x10')](_0x166005));_0x118128(_0x166005);})[_0x5e63('0x15')](function(_0x492f0e){logger[_0x5e63('0x11')]('GetContactRecallMe',_0x492f0e[_0x5e63('0x13')],_0x202378);_0x6a0f98(_0x320cc2[_0x5e63('0x11')](0x1f4,_0x492f0e[_0x5e63('0x13')]));});});});};exports[_0x5e63('0x44')]=function(_0x5b168c){var _0x46537d=this;return new Promise(function(_0x1bcbee,_0x51802d){db[_0x5e63('0x2b')]['describe']()['then'](function(_0x474238){return db[_0x5e63('0x17')][_0x5e63('0x18')]({'raw':_0x5b168c[_0x5e63('0x19')]?_0x5b168c[_0x5e63('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5b168c['options']?_0x5b168c[_0x5e63('0x19')][_0x5e63('0x1b')]||null:null,'attributes':_0x5b168c[_0x5e63('0x19')]?_0x5b168c[_0x5e63('0x19')][_0x5e63('0x1c')]||null:null,'limit':_0x5b168c[_0x5e63('0x19')]?_0x5b168c[_0x5e63('0x19')][_0x5e63('0x1d')]||null:null,'include':_0x5b168c[_0x5e63('0x19')]?_0x5b168c[_0x5e63('0x19')][_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x5b168c[_0x5e63('0x19')][_0x5e63('0x1e')],function(_0x24a929){return{'model':db[_0x24a929['model']],'as':_0x24a929['as'],'attributes':_0x24a929['as']===_0x5e63('0x30')?_[_0x5e63('0x31')](_0x474238):_0x24a929['attributes'],'include':_0x24a929[_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x24a929[_0x5e63('0x1e')],function(_0x1bc998){return{'model':db[_0x1bc998[_0x5e63('0x20')]],'as':_0x1bc998['as'],'attributes':_0x1bc998[_0x5e63('0x1c')],'include':_0x1bc998[_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x1bc998[_0x5e63('0x1e')],function(_0x2936c4){return{'model':db[_0x2936c4[_0x5e63('0x20')]],'as':_0x2936c4['as'],'attributes':_0x2936c4[_0x5e63('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5e63('0xb')](function(_0xdf483f){logger['info'](_0x5e63('0x16'),_0x5b168c);logger[_0x5e63('0xf')]('GetCmHopper',_0x5b168c,JSON[_0x5e63('0x10')](_0xdf483f));_0x1bcbee(_0xdf483f);})[_0x5e63('0x15')](function(_0x4f5072){logger['error']('GetCmHopper',_0x4f5072[_0x5e63('0x13')],_0x5b168c);_0x51802d(_0x46537d[_0x5e63('0x11')](0x1f4,_0x4f5072[_0x5e63('0x13')]));});});});};exports[_0x5e63('0x45')]=function(_0x58956c){console[_0x5e63('0x46')](_0x5e63('0x47'),_0x58956c);console[_0x5e63('0x46')](_0x5e63('0x48'),_0x58956c[_0x5e63('0x19')][_0x5e63('0x1b')]['phone']);_this=this;return new Promise(function(_0x1bc074,_0x3eea19){return db[_0x5e63('0x2b')][_0x5e63('0x49')]({'raw':!![],'where':{'phone':_0x58956c[_0x5e63('0x19')][_0x5e63('0x1b')][_0x5e63('0x4a')]},'attributes':['id',_0x5e63('0x4b')],'order':[['id','DESC']]})['then'](function(_0x5bbc4e){console[_0x5e63('0x46')](_0x5e63('0x4c'),_0x5bbc4e);logger['info'](_0x5e63('0x4d'),_0x58956c);logger['debug']('getContactByPhone',_0x58956c,JSON['stringify'](_0x5bbc4e));_0x1bc074(_0x5bbc4e);})[_0x5e63('0x15')](function(_0x4cb80d){logger[_0x5e63('0x11')](_0x5e63('0x4d'),_0x4cb80d[_0x5e63('0x13')],_0x58956c);_0x3eea19(_this[_0x5e63('0x11')](0x1f4,_0x4cb80d[_0x5e63('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 6c429fa..cbdf7d7 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 _0x3e74=['isAuthenticated','index','describe','/opencontacts','getTimezones','post','/preview','getPreview','getTimezone','put','update','delete','/:id','multer','path','connect-timeout','express','../../components/interaction/service','./cmHopper.controller','get'];(function(_0x4cd0c9,_0x386ef4){var _0x332421=function(_0x591d3e){while(--_0x591d3e){_0x4cd0c9['push'](_0x4cd0c9['shift']());}};_0x332421(++_0x386ef4);}(_0x3e74,0x175));var _0x43e7=function(_0xd47c9b,_0x384246){_0xd47c9b=_0xd47c9b-0x0;var _0x3950bf=_0x3e74[_0xd47c9b];return _0x3950bf;};'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['getOpenContacts']);router[_0x43e7('0x6')]('/timezones',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x7')](),controller['create']);router[_0x43e7('0xc')](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller[_0x43e7('0xe')]);router['post']('/timezone',auth[_0x43e7('0x7')](),controller[_0x43e7('0xf')]);router[_0x43e7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')](_0x43e7('0x13'),auth[_0x43e7('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeec6=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','/:id','post','/preview','getPreview','getTimezone','put','update','delete','destroy'];(function(_0x588c1c,_0x1f581f){var _0x476dd9=function(_0x32a2f9){while(--_0x32a2f9){_0x588c1c['push'](_0x588c1c['shift']());}};_0x476dd9(++_0x1f581f);}(_0xeec6,0x1c2));var _0x6eec=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0xeec6[_0x4d1ee9];return _0x9a5456;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var auth=require(_0x6eec('0x5'));var interaction=require(_0x6eec('0x6'));var config=require(_0x6eec('0x7'));var controller=require(_0x6eec('0x8'));router[_0x6eec('0x9')]('/',auth['isAuthenticated'](),controller[_0x6eec('0xa')]);router[_0x6eec('0x9')]('/describe',auth[_0x6eec('0xb')](),controller[_0x6eec('0xc')]);router[_0x6eec('0x9')](_0x6eec('0xd'),auth['isAuthenticated'](),controller[_0x6eec('0xe')]);router[_0x6eec('0x9')](_0x6eec('0xf'),auth['isAuthenticated'](),controller['getTimezones']);router['get'](_0x6eec('0x10'),auth[_0x6eec('0xb')](),controller['show']);router['post']('/',auth[_0x6eec('0xb')](),controller['create']);router[_0x6eec('0x11')](_0x6eec('0x12'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x13')]);router[_0x6eec('0x11')]('/timezone',auth[_0x6eec('0xb')](),controller[_0x6eec('0x14')]);router[_0x6eec('0x15')](_0x6eec('0x10'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x16')]);router[_0x6eec('0x17')](_0x6eec('0x10'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 7022b9f..afe5b56 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x487a=['exports','INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0x487a,0xb4));var _0xa487=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x487a[_0x1030ce];return _0x3367fd;};'use strict';var moment=require(_0xa487('0x0'));var Sequelize=require(_0xa487('0x1'));module[_0xa487('0x2')]={'CmHopperId':{'type':Sequelize[_0xa487('0x3')]},'phone':{'type':Sequelize[_0xa487('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xa487('0x5')],'defaultValue':moment()['format'](_0xa487('0x6'))},'countbusyretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1474=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','DATE','format'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x1474,0x109));var _0x4147=function(_0x45ed90,_0x111e0b){_0x45ed90=_0x45ed90-0x0;var _0x47a846=_0x1474[_0x45ed90];return _0x47a846;};'use strict';var moment=require(_0x4147('0x0'));var Sequelize=require(_0x4147('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4147('0x3')],'defaultValue':moment()[_0x4147('0x4')](_0x4147('0x5'))},'countbusyretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 50aa52e..6f08cbc 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce1d=['create','body','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x59768e,_0x50b468){var _0x10e8ea=function(_0x66b965){while(--_0x66b965){_0x59768e['push'](_0x59768e['shift']());}};_0x10e8ea(++_0x50b468);}(_0xce1d,0xb0));var _0xdce1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce1d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xdce1('0x0'));var emlformat=require(_0xdce1('0x1'));var rimraf=require(_0xdce1('0x2'));var zipdir=require(_0xdce1('0x3'));var jsonpatch=require(_0xdce1('0x4'));var rp=require(_0xdce1('0x5'));var moment=require(_0xdce1('0x6'));var BPromise=require(_0xdce1('0x7'));var Mustache=require(_0xdce1('0x8'));var util=require(_0xdce1('0x9'));var path=require('path');var sox=require(_0xdce1('0xa'));var csv=require(_0xdce1('0xb'));var ejs=require(_0xdce1('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdce1('0xd'));var jsforce=require(_0xdce1('0xe'));var deskjs=require(_0xdce1('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdce1('0x10'));var Papa=require(_0xdce1('0x11'));var Redis=require(_0xdce1('0x12'));var authService=require(_0xdce1('0x13'));var qs=require(_0xdce1('0x14'));var as=require(_0xdce1('0x15'));var hardwareService=require(_0xdce1('0x16'));var logger=require(_0xdce1('0x17'))('api');var utils=require(_0xdce1('0x18'));var config=require(_0xdce1('0x19'));var db=require(_0xdce1('0x1a'))['db'];function respondWithStatusCode(_0x47f3f6,_0x5f3c50){_0x5f3c50=_0x5f3c50||0xcc;return function(_0x221950){if(_0x221950){return _0x47f3f6[_0xdce1('0x1b')](_0x5f3c50);}return _0x47f3f6[_0xdce1('0x1c')](_0x5f3c50)[_0xdce1('0x1d')]();};}function respondWithResult(_0x4c8916,_0xb970c0){_0xb970c0=_0xb970c0||0xc8;return function(_0x174c41){if(_0x174c41){return _0x4c8916[_0xdce1('0x1c')](_0xb970c0)['json'](_0x174c41);}};}function respondWithFilteredResult(_0x291baf,_0x1f34e3){return function(_0x12bb54){if(_0x12bb54){var _0x33e679=_0x12bb54['count'],_0x556e9c=_0x1f34e3[_0xdce1('0x1e')],_0x1f379c=_0x1f34e3[_0xdce1('0x1e')]+_0x1f34e3[_0xdce1('0x1f')],_0x44813a;if(_0x1f379c>=_0x33e679){_0x1f379c=_0x33e679;_0x44813a=0xc8;}else{_0x44813a=0xce;}_0x291baf['status'](_0x44813a);return _0x291baf[_0xdce1('0x20')](_0xdce1('0x21'),_0x556e9c+'-'+_0x1f379c+'/'+_0x33e679)[_0xdce1('0x22')](_0x12bb54);}return null;};}function patchUpdates(_0x4dadeb){return function(_0x231538){try{jsonpatch[_0xdce1('0x23')](_0x231538,_0x4dadeb,!![]);}catch(_0x38b3f4){return BPromise['reject'](_0x38b3f4);}return _0x231538['save']();};}function saveUpdates(_0xab8c82,_0x4ccbec){return function(_0x3c92fd){if(_0x3c92fd){return _0x3c92fd['update'](_0xab8c82)[_0xdce1('0x24')](function(_0x44b134){return _0x44b134;});}return null;};}function removeEntity(_0x315718,_0x1d9a8f){return function(_0x596138){if(_0x596138){return _0x596138[_0xdce1('0x25')]()[_0xdce1('0x24')](function(){var _0x25c5e1=_0x596138[_0xdce1('0x26')]({'plain':!![]});var _0x5d9416=_0xdce1('0x27');return db[_0xdce1('0x28')][_0xdce1('0x25')]({'where':{'type':_0x5d9416,'resourceId':_0x25c5e1['id']}})[_0xdce1('0x24')](function(){return _0x596138;});})['then'](function(){_0x315718[_0xdce1('0x1c')](0xcc)[_0xdce1('0x1d')]();});}};}function handleEntityNotFound(_0x3f9115,_0x5e36c1){return function(_0x5b74a2){if(!_0x5b74a2){_0x3f9115[_0xdce1('0x1b')](0x194);}return _0x5b74a2;};}function handleError(_0x2705de,_0x2ade02){_0x2ade02=_0x2ade02||0x1f4;return function(_0x1e0d0a){logger['error'](_0x1e0d0a[_0xdce1('0x29')]);if(_0x1e0d0a[_0xdce1('0x2a')]){delete _0x1e0d0a[_0xdce1('0x2a')];}_0x2705de[_0xdce1('0x1c')](_0x2ade02)[_0xdce1('0x2b')](_0x1e0d0a);};}exports[_0xdce1('0x2c')]=function(_0x12245e,_0x3223df){var _0x30e30a={},_0x2d357e={},_0x502d5={'count':0x0,'rows':[]};var _0x29f790=_['map'](db[_0xdce1('0x2d')][_0xdce1('0x2e')],function(_0x1124cc){return{'name':_0x1124cc[_0xdce1('0x2f')],'type':_0x1124cc[_0xdce1('0x30')]['key']};});_0x2d357e[_0xdce1('0x31')]=_[_0xdce1('0x32')](_0x29f790,_0xdce1('0x2a'));_0x2d357e[_0xdce1('0x33')]=_[_0xdce1('0x34')](_0x12245e[_0xdce1('0x33')]);_0x2d357e[_0xdce1('0x35')]=_[_0xdce1('0x36')](_0x2d357e[_0xdce1('0x31')],_0x2d357e[_0xdce1('0x33')]);_0x30e30a['attributes']=_['intersection'](_0x2d357e[_0xdce1('0x31')],qs[_0xdce1('0x37')](_0x12245e[_0xdce1('0x33')][_0xdce1('0x37')]));_0x30e30a['attributes']=_0x30e30a[_0xdce1('0x38')][_0xdce1('0x39')]?_0x30e30a[_0xdce1('0x38')]:_0x2d357e[_0xdce1('0x31')];if(!_0x12245e[_0xdce1('0x33')][_0xdce1('0x3a')]('nolimit')){_0x30e30a['limit']=qs[_0xdce1('0x1f')](_0x12245e[_0xdce1('0x33')][_0xdce1('0x1f')]);_0x30e30a[_0xdce1('0x1e')]=qs['offset'](_0x12245e[_0xdce1('0x33')]['offset']);}_0x30e30a[_0xdce1('0x3b')]=qs['sort'](_0x12245e[_0xdce1('0x33')][_0xdce1('0x3c')]);_0x30e30a[_0xdce1('0x3d')]=qs[_0xdce1('0x35')](_[_0xdce1('0x3e')](_0x12245e[_0xdce1('0x33')],_0x2d357e[_0xdce1('0x35')]),_0x29f790);if(_0x12245e[_0xdce1('0x33')][_0xdce1('0x3f')]){_0x30e30a[_0xdce1('0x3d')]=_[_0xdce1('0x40')](_0x30e30a['where'],{'$or':_['map'](_0x29f790,function(_0x3b74cb){if(_0x3b74cb[_0xdce1('0x30')]!==_0xdce1('0x41')){var _0x4999b9={};_0x4999b9[_0x3b74cb[_0xdce1('0x2a')]]={'$like':'%'+_0x12245e[_0xdce1('0x33')]['filter']+'%'};return _0x4999b9;}})});}_0x30e30a=_[_0xdce1('0x40')]({},_0x30e30a,_0x12245e[_0xdce1('0x42')]);var _0x5b5d8f={'where':_0x30e30a[_0xdce1('0x3d')]};return db['CmHopperAdditionalPhone'][_0xdce1('0x43')](_0x5b5d8f)[_0xdce1('0x24')](function(_0x1811db){_0x502d5[_0xdce1('0x43')]=_0x1811db;if(_0x12245e[_0xdce1('0x33')][_0xdce1('0x44')]){_0x30e30a[_0xdce1('0x45')]=[{'all':!![]}];}return db[_0xdce1('0x2d')][_0xdce1('0x46')](_0x30e30a);})[_0xdce1('0x24')](function(_0x3c220a){_0x502d5[_0xdce1('0x47')]=_0x3c220a;return _0x502d5;})[_0xdce1('0x24')](respondWithFilteredResult(_0x3223df,_0x30e30a))[_0xdce1('0x48')](handleError(_0x3223df,null));};exports[_0xdce1('0x49')]=function(_0x1d775,_0x295f83){var _0x23406e={'raw':!![],'where':{'id':_0x1d775[_0xdce1('0x4a')]['id']}},_0x99c300={};_0x99c300['model']=_[_0xdce1('0x34')](db['CmHopperAdditionalPhone'][_0xdce1('0x2e')]);_0x99c300[_0xdce1('0x33')]=_[_0xdce1('0x34')](_0x1d775[_0xdce1('0x33')]);_0x99c300[_0xdce1('0x35')]=_['intersection'](_0x99c300[_0xdce1('0x31')],_0x99c300[_0xdce1('0x33')]);_0x23406e[_0xdce1('0x38')]=_[_0xdce1('0x36')](_0x99c300['model'],qs[_0xdce1('0x37')](_0x1d775[_0xdce1('0x33')]['fields']));_0x23406e[_0xdce1('0x38')]=_0x23406e[_0xdce1('0x38')]['length']?_0x23406e[_0xdce1('0x38')]:_0x99c300[_0xdce1('0x31')];if(_0x1d775[_0xdce1('0x33')][_0xdce1('0x44')]){_0x23406e[_0xdce1('0x45')]=[{'all':!![]}];}_0x23406e=_[_0xdce1('0x40')]({},_0x23406e,_0x1d775[_0xdce1('0x42')]);return db[_0xdce1('0x2d')][_0xdce1('0x4b')](_0x23406e)['then'](handleEntityNotFound(_0x295f83,null))[_0xdce1('0x24')](respondWithResult(_0x295f83,null))[_0xdce1('0x48')](handleError(_0x295f83,null));};exports[_0xdce1('0x4c')]=function(_0x2354a5,_0x168944){return db[_0xdce1('0x2d')][_0xdce1('0x4c')](_0x2354a5[_0xdce1('0x4d')],{})[_0xdce1('0x24')](function(_0x24a451){var _0x590caf=_0x2354a5[_0xdce1('0x4e')][_0xdce1('0x26')]({'plain':!![]});if(!_0x590caf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590caf['role']===_0xdce1('0x4e')){var _0x33d300=_0x24a451['get']({'plain':!![]});var _0x3c514c=_0xdce1('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x3c514c,'userProfileId':_0x590caf[_0xdce1('0x4f')]},'raw':!![]})[_0xdce1('0x24')](function(_0x1af6ed){if(_0x1af6ed&&_0x1af6ed[_0xdce1('0x50')]===0x0){return db[_0xdce1('0x28')][_0xdce1('0x4c')]({'name':_0x33d300[_0xdce1('0x2a')],'resourceId':_0x33d300['id'],'type':_0x1af6ed['name'],'sectionId':_0x1af6ed['id']},{})[_0xdce1('0x24')](function(){return _0x24a451;});}else{return _0x24a451;}})['catch'](function(_0x2722f8){logger[_0xdce1('0x51')](_0xdce1('0x52'),_0x2722f8);throw _0x2722f8;});}return _0x24a451;})[_0xdce1('0x24')](respondWithResult(_0x168944,0xc9))[_0xdce1('0x48')](handleError(_0x168944,null));};exports[_0xdce1('0x53')]=function(_0x234b9a,_0x26d83c){if(_0x234b9a[_0xdce1('0x4d')]['id']){delete _0x234b9a['body']['id'];}return db[_0xdce1('0x2d')][_0xdce1('0x4b')]({'where':{'id':_0x234b9a[_0xdce1('0x4a')]['id']}})[_0xdce1('0x24')](handleEntityNotFound(_0x26d83c,null))[_0xdce1('0x24')](saveUpdates(_0x234b9a[_0xdce1('0x4d')],null))[_0xdce1('0x24')](respondWithResult(_0x26d83c,null))[_0xdce1('0x48')](handleError(_0x26d83c,null));};exports['destroy']=function(_0xa0eb50,_0x4f385d){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0xa0eb50[_0xdce1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f385d,null))[_0xdce1('0x24')](removeEntity(_0x4f385d,null))[_0xdce1('0x48')](handleError(_0x4f385d,null));}; \ No newline at end of file +var _0x69b4=['sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','name','send','index','map','CmHopperAdditionalPhone','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','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','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x162fa0,_0x1bdecc){var _0x266b9e=function(_0x379c8d){while(--_0x379c8d){_0x162fa0['push'](_0x162fa0['shift']());}};_0x266b9e(++_0x1bdecc);}(_0x69b4,0x132));var _0x469b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x69b4[_0x432682];return _0x463d05;};'use strict';var pdf=require(_0x469b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x469b('0x1'));var zipdir=require(_0x469b('0x2'));var jsonpatch=require(_0x469b('0x3'));var rp=require(_0x469b('0x4'));var moment=require(_0x469b('0x5'));var BPromise=require(_0x469b('0x6'));var Mustache=require(_0x469b('0x7'));var util=require(_0x469b('0x8'));var path=require(_0x469b('0x9'));var sox=require(_0x469b('0xa'));var csv=require(_0x469b('0xb'));var ejs=require(_0x469b('0xc'));var fs=require('fs');var _=require(_0x469b('0xd'));var squel=require(_0x469b('0xe'));var crypto=require(_0x469b('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x469b('0x10'));var Redis=require(_0x469b('0x11'));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(_0x469b('0x12'))(_0x469b('0x13'));var utils=require(_0x469b('0x14'));var config=require(_0x469b('0x15'));var db=require(_0x469b('0x16'))['db'];function respondWithStatusCode(_0x21e768,_0x227502){_0x227502=_0x227502||0xcc;return function(_0x4d24b0){if(_0x4d24b0){return _0x21e768[_0x469b('0x17')](_0x227502);}return _0x21e768[_0x469b('0x18')](_0x227502)[_0x469b('0x19')]();};}function respondWithResult(_0x4bec18,_0x3e0497){_0x3e0497=_0x3e0497||0xc8;return function(_0x344673){if(_0x344673){return _0x4bec18[_0x469b('0x18')](_0x3e0497)[_0x469b('0x1a')](_0x344673);}};}function respondWithFilteredResult(_0x5c821a,_0x2b8b63){return function(_0x5cd50b){if(_0x5cd50b){var _0x5c3e13=_0x5cd50b[_0x469b('0x1b')],_0x546a50=_0x2b8b63[_0x469b('0x1c')],_0x30531a=_0x2b8b63[_0x469b('0x1c')]+_0x2b8b63[_0x469b('0x1d')],_0x2ef0d0;if(_0x30531a>=_0x5c3e13){_0x30531a=_0x5c3e13;_0x2ef0d0=0xc8;}else{_0x2ef0d0=0xce;}_0x5c821a[_0x469b('0x18')](_0x2ef0d0);return _0x5c821a['set'](_0x469b('0x1e'),_0x546a50+'-'+_0x30531a+'/'+_0x5c3e13)[_0x469b('0x1a')](_0x5cd50b);}return null;};}function patchUpdates(_0x4896f0){return function(_0xe9b0f4){try{jsonpatch[_0x469b('0x1f')](_0xe9b0f4,_0x4896f0,!![]);}catch(_0x54d78c){return BPromise['reject'](_0x54d78c);}return _0xe9b0f4[_0x469b('0x20')]();};}function saveUpdates(_0x368fd5,_0x3b77f5){return function(_0x4af5b3){if(_0x4af5b3){return _0x4af5b3[_0x469b('0x21')](_0x368fd5)[_0x469b('0x22')](function(_0x4621f4){return _0x4621f4;});}return null;};}function removeEntity(_0xba9548,_0x3148bc){return function(_0x374726){if(_0x374726){return _0x374726[_0x469b('0x23')]()[_0x469b('0x22')](function(){var _0x56b30e=_0x374726[_0x469b('0x24')]({'plain':!![]});var _0x43c645=_0x469b('0x25');return db[_0x469b('0x26')][_0x469b('0x23')]({'where':{'type':_0x43c645,'resourceId':_0x56b30e['id']}})[_0x469b('0x22')](function(){return _0x374726;});})['then'](function(){_0xba9548[_0x469b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x341e2a,_0x162b88){return function(_0x314874){if(!_0x314874){_0x341e2a['sendStatus'](0x194);}return _0x314874;};}function handleError(_0x147abd,_0x493067){_0x493067=_0x493067||0x1f4;return function(_0x5049c7){logger[_0x469b('0x27')](_0x5049c7['stack']);if(_0x5049c7[_0x469b('0x28')]){delete _0x5049c7['name'];}_0x147abd[_0x469b('0x18')](_0x493067)[_0x469b('0x29')](_0x5049c7);};}exports[_0x469b('0x2a')]=function(_0x4a9c68,_0x37fccb){var _0x3dc2d3={},_0x1097f6={},_0x2ff77a={'count':0x0,'rows':[]};var _0x523e5f=_[_0x469b('0x2b')](db[_0x469b('0x2c')]['rawAttributes'],function(_0x295a9a){return{'name':_0x295a9a['fieldName'],'type':_0x295a9a[_0x469b('0x2d')][_0x469b('0x2e')]};});_0x1097f6[_0x469b('0x2f')]=_[_0x469b('0x2b')](_0x523e5f,_0x469b('0x28'));_0x1097f6[_0x469b('0x30')]=_[_0x469b('0x31')](_0x4a9c68['query']);_0x1097f6[_0x469b('0x32')]=_[_0x469b('0x33')](_0x1097f6[_0x469b('0x2f')],_0x1097f6[_0x469b('0x30')]);_0x3dc2d3[_0x469b('0x34')]=_[_0x469b('0x33')](_0x1097f6[_0x469b('0x2f')],qs[_0x469b('0x35')](_0x4a9c68[_0x469b('0x30')][_0x469b('0x35')]));_0x3dc2d3[_0x469b('0x34')]=_0x3dc2d3['attributes'][_0x469b('0x36')]?_0x3dc2d3['attributes']:_0x1097f6[_0x469b('0x2f')];if(!_0x4a9c68[_0x469b('0x30')]['hasOwnProperty']('nolimit')){_0x3dc2d3[_0x469b('0x1d')]=qs[_0x469b('0x1d')](_0x4a9c68['query'][_0x469b('0x1d')]);_0x3dc2d3[_0x469b('0x1c')]=qs[_0x469b('0x1c')](_0x4a9c68['query'][_0x469b('0x1c')]);}_0x3dc2d3[_0x469b('0x37')]=qs[_0x469b('0x38')](_0x4a9c68['query'][_0x469b('0x38')]);_0x3dc2d3[_0x469b('0x39')]=qs[_0x469b('0x32')](_['pick'](_0x4a9c68[_0x469b('0x30')],_0x1097f6[_0x469b('0x32')]),_0x523e5f);if(_0x4a9c68[_0x469b('0x30')][_0x469b('0x3a')]){_0x3dc2d3['where']=_[_0x469b('0x3b')](_0x3dc2d3['where'],{'$or':_['map'](_0x523e5f,function(_0x454cd5){if(_0x454cd5['type']!=='VIRTUAL'){var _0x26f6c8={};_0x26f6c8[_0x454cd5['name']]={'$like':'%'+_0x4a9c68[_0x469b('0x30')]['filter']+'%'};return _0x26f6c8;}})});}_0x3dc2d3=_['merge']({},_0x3dc2d3,_0x4a9c68[_0x469b('0x3c')]);var _0x561a71={'where':_0x3dc2d3[_0x469b('0x39')]};return db[_0x469b('0x2c')][_0x469b('0x1b')](_0x561a71)['then'](function(_0x3bc200){_0x2ff77a[_0x469b('0x1b')]=_0x3bc200;if(_0x4a9c68[_0x469b('0x30')][_0x469b('0x3d')]){_0x3dc2d3[_0x469b('0x3e')]=[{'all':!![]}];}return db[_0x469b('0x2c')][_0x469b('0x3f')](_0x3dc2d3);})[_0x469b('0x22')](function(_0x17531e){_0x2ff77a[_0x469b('0x40')]=_0x17531e;return _0x2ff77a;})[_0x469b('0x22')](respondWithFilteredResult(_0x37fccb,_0x3dc2d3))[_0x469b('0x41')](handleError(_0x37fccb,null));};exports[_0x469b('0x42')]=function(_0x2f7c4b,_0x138ed8){var _0x288151={'raw':!![],'where':{'id':_0x2f7c4b['params']['id']}},_0x4f8f7f={};_0x4f8f7f[_0x469b('0x2f')]=_[_0x469b('0x31')](db[_0x469b('0x2c')][_0x469b('0x43')]);_0x4f8f7f[_0x469b('0x30')]=_[_0x469b('0x31')](_0x2f7c4b[_0x469b('0x30')]);_0x4f8f7f[_0x469b('0x32')]=_['intersection'](_0x4f8f7f[_0x469b('0x2f')],_0x4f8f7f[_0x469b('0x30')]);_0x288151[_0x469b('0x34')]=_[_0x469b('0x33')](_0x4f8f7f['model'],qs[_0x469b('0x35')](_0x2f7c4b[_0x469b('0x30')][_0x469b('0x35')]));_0x288151[_0x469b('0x34')]=_0x288151[_0x469b('0x34')][_0x469b('0x36')]?_0x288151[_0x469b('0x34')]:_0x4f8f7f[_0x469b('0x2f')];if(_0x2f7c4b[_0x469b('0x30')][_0x469b('0x3d')]){_0x288151[_0x469b('0x3e')]=[{'all':!![]}];}_0x288151=_[_0x469b('0x3b')]({},_0x288151,_0x2f7c4b[_0x469b('0x3c')]);return db['CmHopperAdditionalPhone'][_0x469b('0x44')](_0x288151)[_0x469b('0x22')](handleEntityNotFound(_0x138ed8,null))['then'](respondWithResult(_0x138ed8,null))['catch'](handleError(_0x138ed8,null));};exports[_0x469b('0x45')]=function(_0x1f5de4,_0x39e42c){return db[_0x469b('0x2c')][_0x469b('0x45')](_0x1f5de4[_0x469b('0x46')],{})['then'](function(_0x5f22d9){var _0x3ab2dc=_0x1f5de4[_0x469b('0x47')][_0x469b('0x24')]({'plain':!![]});if(!_0x3ab2dc)throw new Error(_0x469b('0x48'));if(_0x3ab2dc[_0x469b('0x49')]===_0x469b('0x47')){var _0x4b6dc1=_0x5f22d9[_0x469b('0x24')]({'plain':!![]});var _0xddc67f=_0x469b('0x25');return db[_0x469b('0x4a')][_0x469b('0x44')]({'where':{'name':_0xddc67f,'userProfileId':_0x3ab2dc[_0x469b('0x4b')]},'raw':!![]})['then'](function(_0xa5234f){if(_0xa5234f&&_0xa5234f[_0x469b('0x4c')]===0x0){return db[_0x469b('0x26')][_0x469b('0x45')]({'name':_0x4b6dc1[_0x469b('0x28')],'resourceId':_0x4b6dc1['id'],'type':_0xa5234f[_0x469b('0x28')],'sectionId':_0xa5234f['id']},{})[_0x469b('0x22')](function(){return _0x5f22d9;});}else{return _0x5f22d9;}})[_0x469b('0x41')](function(_0x5bcf47){logger[_0x469b('0x27')](_0x469b('0x4d'),_0x5bcf47);throw _0x5bcf47;});}return _0x5f22d9;})['then'](respondWithResult(_0x39e42c,0xc9))[_0x469b('0x41')](handleError(_0x39e42c,null));};exports[_0x469b('0x21')]=function(_0x105b0d,_0x4f8f0b){if(_0x105b0d[_0x469b('0x46')]['id']){delete _0x105b0d[_0x469b('0x46')]['id'];}return db[_0x469b('0x2c')][_0x469b('0x44')]({'where':{'id':_0x105b0d['params']['id']}})['then'](handleEntityNotFound(_0x4f8f0b,null))['then'](saveUpdates(_0x105b0d[_0x469b('0x46')],null))[_0x469b('0x22')](respondWithResult(_0x4f8f0b,null))['catch'](handleError(_0x4f8f0b,null));};exports[_0x469b('0x23')]=function(_0x2992e0,_0x5cd270){return db['CmHopperAdditionalPhone'][_0x469b('0x44')]({'where':{'id':_0x2992e0[_0x469b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5cd270,null))[_0x469b('0x22')](removeEntity(_0x5cd270,null))[_0x469b('0x41')](handleError(_0x5cd270,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 39b43a3..45185c4 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40f1=['api','path','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x2c33e4,_0x5d7805){var _0xe096d5=function(_0x28935a){while(--_0x28935a){_0x2c33e4['push'](_0x2c33e4['shift']());}};_0xe096d5(++_0x5d7805);}(_0x40f1,0x89));var _0x140f=function(_0x4e8184,_0x106054){_0x4e8184=_0x4e8184-0x0;var _0x4ac2e8=_0x40f1[_0x4e8184];return _0x4ac2e8;};'use strict';var _=require(_0x140f('0x0'));var util=require(_0x140f('0x1'));var logger=require(_0x140f('0x2'))(_0x140f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x140f('0x4'));var rimraf=require('rimraf');var config=require(_0x140f('0x5'));var attributes=require(_0x140f('0x6'));module['exports']=function(_0x1e94c2,_0x28d0ad){return _0x1e94c2[_0x140f('0x7')](_0x140f('0x8'),attributes,{'tableName':_0x140f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c25=['rimraf','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api','path'];(function(_0x47ab1b,_0x3df172){var _0x24a99c=function(_0x233baf){while(--_0x233baf){_0x47ab1b['push'](_0x47ab1b['shift']());}};_0x24a99c(++_0x3df172);}(_0x2c25,0x11c));var _0x52c2=function(_0x1f0ded,_0x404ba6){_0x1f0ded=_0x1f0ded-0x0;var _0xc14076=_0x2c25[_0x1f0ded];return _0xc14076;};'use strict';var _=require(_0x52c2('0x0'));var util=require('util');var logger=require(_0x52c2('0x1'))(_0x52c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x52c2('0x3'));var rimraf=require(_0x52c2('0x4'));var config=require('../../config/environment');var attributes=require(_0x52c2('0x5'));module[_0x52c2('0x6')]=function(_0x36ec01,_0x5842ec){return _0x36ec01['define'](_0x52c2('0x7'),attributes,{'tableName':_0x52c2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 79a4b27..dba05dd 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf929=['SwapAdditionalPhones','CmHopper','VoiceQueueId','waitTime','duration','scheduledat','add','minutes','phone','countagentrejectretry','createdAt','updatedAt','additionalToHop','transaction','update','field','IncrementPreviewCounters','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','catch','VerifyAdditionalPhones','body','ContactId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','entity','countabandonedretry','dialGlobalMaxRetry'];(function(_0x5e5616,_0x41e6f4){var _0xe4aeb9=function(_0x854887){while(--_0x854887){_0x5e5616['push'](_0x5e5616['shift']());}};_0xe4aeb9(++_0x41e6f4);}(_0xf929,0x11a));var _0x9f92=function(_0x5d106f,_0x3036ce){_0x5d106f=_0x5d106f-0x0;var _0x20dfa7=_0xf929[_0x5d106f];return _0x20dfa7;};'use strict';var _=require('lodash');var util=require(_0x9f92('0x0'));var moment=require(_0x9f92('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f92('0x2'));var db=require(_0x9f92('0x3'))['db'];var utils=require(_0x9f92('0x4'));var logger=require(_0x9f92('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9f92('0x6'));var client=jayson[_0x9f92('0x7')][_0x9f92('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69a5d2,_0x108437,_0x54dfeb){return new BPromise(function(_0x17b7f9,_0x378107){return client['request'](_0x69a5d2,_0x54dfeb)[_0x9f92('0x9')](function(_0x33c197){logger[_0x9f92('0xa')](_0x9f92('0xb'),_0x108437,_0x9f92('0xc'));logger[_0x9f92('0xd')](_0x9f92('0xe'),_0x108437,_0x9f92('0xc'),JSON['stringify'](_0x33c197));if(_0x33c197[_0x9f92('0xf')]){if(_0x33c197[_0x9f92('0xf')][_0x9f92('0x10')]===0x1f4){logger[_0x9f92('0xf')](_0x9f92('0xb'),_0x108437,_0x33c197[_0x9f92('0xf')]['message']);return _0x378107(_0x33c197[_0x9f92('0xf')][_0x9f92('0x11')]);}logger[_0x9f92('0xf')](_0x9f92('0xb'),_0x108437,_0x33c197['error'][_0x9f92('0x11')]);return _0x17b7f9(_0x33c197['error'][_0x9f92('0x11')]);}else{logger[_0x9f92('0xa')](_0x9f92('0xb'),_0x108437,_0x9f92('0xc'));_0x17b7f9(_0x33c197['result'][_0x9f92('0x11')]);}})[_0x9f92('0x12')](function(_0x3f9803){logger['error'](_0x9f92('0xb'),_0x108437,_0x3f9803);_0x378107(_0x3f9803);});});}exports[_0x9f92('0x13')]=function(_0x31746c){var _0x58be0d=this;return new Promise(function(_0x58dcbd,_0xe08620){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x31746c[_0x9f92('0x14')][_0x9f92('0x15')],'ListId':_0x31746c[_0x9f92('0x14')]['ListId'],'VoiceQueueId':_0x31746c[_0x9f92('0x14')]['VoiceQueueId']===undefined?null:_0x31746c[_0x9f92('0x14')]['VoiceQueueId'],'CampaignId':_0x31746c['body'][_0x9f92('0x16')]===undefined?null:_0x31746c[_0x9f92('0x14')]['CampaignId']}})[_0x9f92('0x9')](function(_0x368a51){if(_0x368a51!=null){return db[_0x9f92('0x17')][_0x9f92('0x18')]({'raw':!![],'where':{'CmHopperId':_0x368a51['id'],'OrderBy':{'$gt':_0x368a51[_0x9f92('0x19')]}},'order':[['OrderBy',_0x9f92('0x1a')]]})[_0x9f92('0x9')](function(_0x2fdb98){var _0x148315=0x0;if(_0x2fdb98){if(_0x2fdb98[_0x9f92('0x1b')]+_0x2fdb98[_0x9f92('0x1c')]+_0x2fdb98[_0x9f92('0x1d')]+_0x2fdb98[_0x9f92('0x1e')]+_0x2fdb98[_0x9f92('0x1f')]+_0x2fdb98['countabandonedretry']+_0x2fdb98[_0x9f92('0x20')]+_0x2fdb98['countagentrejectretry']<_0x31746c[_0x9f92('0x21')]['dialGlobalMaxRetry'])_0x148315=0x1;_0x58dcbd({'additional':_0x148315});}else{return db[_0x9f92('0x17')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x368a51['id']},'order':[[_0x9f92('0x19'),_0x9f92('0x1a')]]})[_0x9f92('0x9')](function(_0x159c4f){var _0x4e731b=0x0;if(_0x159c4f){if(_0x159c4f['countbusyretry']+_0x159c4f[_0x9f92('0x1c')]+_0x159c4f['countnoanswerretry']+_0x159c4f[_0x9f92('0x1e')]+_0x159c4f[_0x9f92('0x1f')]+_0x159c4f[_0x9f92('0x22')]+_0x159c4f[_0x9f92('0x20')]+_0x159c4f['countagentrejectretry']<_0x31746c[_0x9f92('0x21')][_0x9f92('0x23')])_0x4e731b=0x1;_0x58dcbd({'additional':_0x4e731b});}else{_0x58dcbd({'additional':0x0});}})[_0x9f92('0x12')](function(_0x5ded38){logger[_0x9f92('0xf')]('VerifyAdditionalPhones',_0x5ded38[_0x9f92('0x11')],_0x31746c);_0xe08620(_0x58be0d['error'](0x1f4,_0x5ded38[_0x9f92('0x11')]));});}})['catch'](function(_0x32fd15){logger[_0x9f92('0xf')]('VerifyAdditionalPhones',_0x32fd15[_0x9f92('0x11')],_0x31746c);_0xe08620(_0x58be0d[_0x9f92('0xf')](0x1f4,_0x32fd15[_0x9f92('0x11')]));});}else _0x58dcbd({'additional':0x0});});});};exports[_0x9f92('0x24')]=function(_0x15b5b0){var _0x2fde50=this;return new Promise(function(_0x39ca6a,_0x4e39a7){return db[_0x9f92('0x25')][_0x9f92('0x18')]({'raw':!![],'where':{'ContactId':_0x15b5b0[_0x9f92('0x14')][_0x9f92('0x15')],'ListId':_0x15b5b0['body']['ListId'],'VoiceQueueId':_0x15b5b0['body'][_0x9f92('0x26')]===undefined?null:_0x15b5b0[_0x9f92('0x14')][_0x9f92('0x26')],'CampaignId':_0x15b5b0[_0x9f92('0x14')][_0x9f92('0x16')]===undefined?null:_0x15b5b0[_0x9f92('0x14')][_0x9f92('0x16')]}})['then'](function(_0x58c7a6){if(_0x58c7a6!=null){return db[_0x9f92('0x17')][_0x9f92('0x18')]({'raw':!![],'where':{'CmHopperId':_0x58c7a6['id'],'OrderBy':{'$gt':_0x58c7a6[_0x9f92('0x19')]}},'order':[[_0x9f92('0x19'),_0x9f92('0x1a')]]})['then'](function(_0x10a8d7){if(_0x10a8d7)return activateAdditionalPhone(_0x58c7a6,_0x15b5b0['body'],_0x10a8d7,_0x15b5b0['duration'],_0x15b5b0[_0x9f92('0x27')])[_0x9f92('0x9')](function(_0x30c10f){_0x39ca6a(_0x30c10f);});else{return db[_0x9f92('0x17')][_0x9f92('0x18')]({'raw':!![],'where':{'CmHopperId':_0x58c7a6['id']},'order':[[_0x9f92('0x19'),_0x9f92('0x1a')]]})[_0x9f92('0x9')](function(_0x53b4e9){if(_0x53b4e9)return activateAdditionalPhone(_0x58c7a6,_0x15b5b0['body'],_0x53b4e9,_0x15b5b0[_0x9f92('0x28')],_0x15b5b0['waitTime'])[_0x9f92('0x9')](function(_0x9f9f9f){_0x39ca6a(_0x9f9f9f);});else{_0x39ca6a({'id':_0x58c7a6['id'],'phone':''});}})[_0x9f92('0x12')](function(_0x5f45bc){logger[_0x9f92('0xf')]('VerifyAdditionalPhones',_0x5f45bc[_0x9f92('0x11')],_0x15b5b0);_0x4e39a7(_0x2fde50[_0x9f92('0xf')](0x1f4,_0x5f45bc[_0x9f92('0x11')]));});}})['catch'](function(_0x30147a){logger['error'](_0x9f92('0x13'),_0x30147a[_0x9f92('0x11')],_0x15b5b0);_0x4e39a7(_0x2fde50[_0x9f92('0xf')](0x1f4,_0x30147a[_0x9f92('0x11')]));});}else _0x39ca6a(0x1);});});};function activateAdditionalPhone(_0x13b56a,_0x525caa,_0x370702,_0x530098,_0x3e8f00){return new Promise(function(_0x4fae98,_0x2f86a9){logger[_0x9f92('0xa')](_0x9f92('0x13'),_0x370702);var _0xe1988b;if(moment()>moment(_0x370702[_0x9f92('0x29')])){_0xe1988b=moment()[_0x9f92('0x2a')](_0x3e8f00||0x3,_0x9f92('0x2b'));}else{if(_0x370702[_0x9f92('0x19')]==0x0){_0xe1988b=moment(_0x370702[_0x9f92('0x29')]);}else{_0xe1988b=moment()['add'](_0x3e8f00||0x3,_0x9f92('0x2b'));}}var _0x214486={'phone':_0x13b56a[_0x9f92('0x2c')],'active':0x0,'OrderBy':_['isNil'](_0x13b56a[_0x9f92('0x19')])?0x0:_0x13b56a[_0x9f92('0x19')],'scheduledat':moment()[_0x9f92('0x2a')](_0x530098||0x1,_0x9f92('0x2b')),'countbusyretry':_0x525caa[_0x9f92('0x1b')],'countcongestionretry':_0x525caa['countcongestionretry'],'countnoanswerretry':_0x525caa[_0x9f92('0x1d')],'countnosuchnumberretry':_0x525caa[_0x9f92('0x1e')],'countdropretry':_0x525caa['countdropretry'],'countabandonedretry':_0x525caa['countabandonedretry'],'countmachineretry':_0x525caa['countmachineretry'],'countagentrejectretry':_0x525caa[_0x9f92('0x2d')],'createdAt':_0x525caa[_0x9f92('0x2e')],'updatedAt':_0x525caa[_0x9f92('0x2f')]};var _0x5ed171={'CmHopperId':_0x13b56a['id'],'phone':_0x370702['phone'],'active':0x0,'OrderBy':_['isNil'](_0x370702[_0x9f92('0x19')])?0x0:_0x370702[_0x9f92('0x19')],'scheduledat':_0xe1988b,'countbusyretry':_0x370702[_0x9f92('0x1b')],'countcongestionretry':_0x370702['countcongestionretry'],'countnoanswerretry':_0x370702['countnoanswerretry'],'countnosuchnumberretry':_0x525caa[_0x9f92('0x1e')],'countdropretry':_0x525caa[_0x9f92('0x1f')],'countabandonedretry':_0x525caa['countabandonedretry'],'countmachineretry':_0x525caa[_0x9f92('0x20')],'countagentrejectretry':_0x525caa['countagentrejectretry'],'createdAt':_0x370702[_0x9f92('0x2e')],'updatedAt':_0x370702[_0x9f92('0x2f')]};logger['info']('hopperToAdd',_0x214486);logger[_0x9f92('0xa')](_0x9f92('0x30'),_0x5ed171);return db['sequelize'][_0x9f92('0x31')](function(_0x4bfab1){return db['CmHopperAdditionalPhone'][_0x9f92('0x32')](_0x214486,{'where':{'id':_0x370702['id']}},{'transaction':_0x4bfab1})[_0x9f92('0x9')](function(){return db[_0x9f92('0x25')]['update'](_0x5ed171,{'where':{'id':_0x13b56a['id']}},{'transaction':_0x4bfab1});});})[_0x9f92('0x9')](function(_0x4bb600){_0x4fae98({'id':_0x13b56a['id'],'phone':_0x370702['phone']});})[_0x9f92('0x12')](function(_0x240ef9){logger[_0x9f92('0xf')](_0x9f92('0x13'),_0x240ef9['message'],req);_0x2f86a9(_this[_0x9f92('0xf')](0x1f4,_0x240ef9['message']));});});}exports['IncrementPreviewCounters']=function(_0x3228f7){var _0x49a9fd=this;return new Promise(function(_0x6b3652,_0x55ad71){return db[_0x9f92('0x25')]['update'](_0x3228f7['body'][_0x9f92('0x33')],{'where':{'id':_0x3228f7['body']['id']}})[_0x9f92('0x9')](function(_0x28d0fa){_0x6b3652(_0x28d0fa);})[_0x9f92('0x12')](function(_0x34566d){logger['error'](_0x9f92('0x34'),_0x34566d[_0x9f92('0x11')],_0x3228f7);_0x55ad71(_0x49a9fd[_0x9f92('0xf')](0x1f4,_0x34566d[_0x9f92('0x11')]));});});}; \ No newline at end of file +var _0x3fd8=['CmHopperAdditionalPhone','countdropretry','SwapAdditionalPhones','ListId','duration','waitTime','info','scheduledat','add','minutes','phone','createdAt','isNil','updatedAt','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry'];(function(_0x4f7384,_0x5e157c){var _0x41c281=function(_0x276147){while(--_0x276147){_0x4f7384['push'](_0x4f7384['shift']());}};_0x41c281(++_0x5e157c);}(_0x3fd8,0x19c));var _0x83fd=function(_0x364406,_0x3f0f37){_0x364406=_0x364406-0x0;var _0x10b5f1=_0x3fd8[_0x364406];return _0x10b5f1;};'use strict';var _=require('lodash');var util=require(_0x83fd('0x0'));var moment=require(_0x83fd('0x1'));var BPromise=require(_0x83fd('0x2'));var rs=require(_0x83fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x83fd('0x4'))['db'];var utils=require(_0x83fd('0x5'));var logger=require('../../config/logger')(_0x83fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x83fd('0x7'));var client=jayson[_0x83fd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e8463,_0x3cf9d3,_0x10cdcc){return new BPromise(function(_0x498561,_0x350f29){return client[_0x83fd('0x9')](_0x5e8463,_0x10cdcc)[_0x83fd('0xa')](function(_0x3af711){logger['info'](_0x83fd('0xb'),_0x3cf9d3,_0x83fd('0xc'));logger[_0x83fd('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x3cf9d3,_0x83fd('0xc'),JSON[_0x83fd('0xe')](_0x3af711));if(_0x3af711[_0x83fd('0xf')]){if(_0x3af711[_0x83fd('0xf')][_0x83fd('0x10')]===0x1f4){logger[_0x83fd('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3cf9d3,_0x3af711[_0x83fd('0xf')]['message']);return _0x350f29(_0x3af711[_0x83fd('0xf')]['message']);}logger[_0x83fd('0xf')](_0x83fd('0xb'),_0x3cf9d3,_0x3af711['error']['message']);return _0x498561(_0x3af711[_0x83fd('0xf')]['message']);}else{logger['info'](_0x83fd('0xb'),_0x3cf9d3,_0x83fd('0xc'));_0x498561(_0x3af711['result'][_0x83fd('0x11')]);}})[_0x83fd('0x12')](function(_0x1b9565){logger[_0x83fd('0xf')](_0x83fd('0xb'),_0x3cf9d3,_0x1b9565);_0x350f29(_0x1b9565);});});}exports[_0x83fd('0x13')]=function(_0x558087){var _0x444fc2=this;return new Promise(function(_0x392c34,_0x337e26){return db[_0x83fd('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x558087[_0x83fd('0x15')][_0x83fd('0x16')],'ListId':_0x558087[_0x83fd('0x15')]['ListId'],'VoiceQueueId':_0x558087[_0x83fd('0x15')][_0x83fd('0x17')]===undefined?null:_0x558087[_0x83fd('0x15')][_0x83fd('0x17')],'CampaignId':_0x558087['body'][_0x83fd('0x18')]===undefined?null:_0x558087['body'][_0x83fd('0x18')]}})[_0x83fd('0xa')](function(_0x132b68){if(_0x132b68!=null){return db['CmHopperAdditionalPhone'][_0x83fd('0x19')]({'raw':!![],'where':{'CmHopperId':_0x132b68['id'],'OrderBy':{'$gt':_0x132b68[_0x83fd('0x1a')]}},'order':[[_0x83fd('0x1a'),_0x83fd('0x1b')]]})[_0x83fd('0xa')](function(_0x1e857b){var _0x3dd298=0x0;if(_0x1e857b){if(_0x1e857b[_0x83fd('0x1c')]+_0x1e857b[_0x83fd('0x1d')]+_0x1e857b['countnoanswerretry']+_0x1e857b[_0x83fd('0x1e')]+_0x1e857b['countdropretry']+_0x1e857b[_0x83fd('0x1f')]+_0x1e857b[_0x83fd('0x20')]+_0x1e857b[_0x83fd('0x21')]<_0x558087[_0x83fd('0x22')][_0x83fd('0x23')])_0x3dd298=0x1;_0x392c34({'additional':_0x3dd298});}else{return db[_0x83fd('0x24')][_0x83fd('0x19')]({'raw':!![],'where':{'CmHopperId':_0x132b68['id']},'order':[[_0x83fd('0x1a'),'ASC']]})[_0x83fd('0xa')](function(_0x16a174){var _0x3f4543=0x0;if(_0x16a174){if(_0x16a174[_0x83fd('0x1c')]+_0x16a174[_0x83fd('0x1d')]+_0x16a174['countnoanswerretry']+_0x16a174['countnosuchnumberretry']+_0x16a174[_0x83fd('0x25')]+_0x16a174[_0x83fd('0x1f')]+_0x16a174[_0x83fd('0x20')]+_0x16a174[_0x83fd('0x21')]<_0x558087['entity'][_0x83fd('0x23')])_0x3f4543=0x1;_0x392c34({'additional':_0x3f4543});}else{_0x392c34({'additional':0x0});}})['catch'](function(_0x58485d){logger[_0x83fd('0xf')](_0x83fd('0x13'),_0x58485d['message'],_0x558087);_0x337e26(_0x444fc2['error'](0x1f4,_0x58485d[_0x83fd('0x11')]));});}})['catch'](function(_0x3858cf){logger[_0x83fd('0xf')](_0x83fd('0x13'),_0x3858cf[_0x83fd('0x11')],_0x558087);_0x337e26(_0x444fc2['error'](0x1f4,_0x3858cf[_0x83fd('0x11')]));});}else _0x392c34({'additional':0x0});});});};exports[_0x83fd('0x26')]=function(_0x1cec0e){var _0x4bc256=this;return new Promise(function(_0x17c77a,_0x2e3c40){return db[_0x83fd('0x14')][_0x83fd('0x19')]({'raw':!![],'where':{'ContactId':_0x1cec0e[_0x83fd('0x15')]['ContactId'],'ListId':_0x1cec0e[_0x83fd('0x15')][_0x83fd('0x27')],'VoiceQueueId':_0x1cec0e[_0x83fd('0x15')][_0x83fd('0x17')]===undefined?null:_0x1cec0e[_0x83fd('0x15')][_0x83fd('0x17')],'CampaignId':_0x1cec0e[_0x83fd('0x15')][_0x83fd('0x18')]===undefined?null:_0x1cec0e[_0x83fd('0x15')][_0x83fd('0x18')]}})['then'](function(_0x23fc2a){if(_0x23fc2a!=null){return db[_0x83fd('0x24')][_0x83fd('0x19')]({'raw':!![],'where':{'CmHopperId':_0x23fc2a['id'],'OrderBy':{'$gt':_0x23fc2a['OrderBy']}},'order':[[_0x83fd('0x1a'),_0x83fd('0x1b')]]})[_0x83fd('0xa')](function(_0x59a3f0){if(_0x59a3f0)return activateAdditionalPhone(_0x23fc2a,_0x1cec0e[_0x83fd('0x15')],_0x59a3f0,_0x1cec0e[_0x83fd('0x28')],_0x1cec0e[_0x83fd('0x29')])[_0x83fd('0xa')](function(_0x248e70){_0x17c77a(_0x248e70);});else{return db[_0x83fd('0x24')][_0x83fd('0x19')]({'raw':!![],'where':{'CmHopperId':_0x23fc2a['id']},'order':[['OrderBy',_0x83fd('0x1b')]]})[_0x83fd('0xa')](function(_0x126d19){if(_0x126d19)return activateAdditionalPhone(_0x23fc2a,_0x1cec0e['body'],_0x126d19,_0x1cec0e[_0x83fd('0x28')],_0x1cec0e[_0x83fd('0x29')])[_0x83fd('0xa')](function(_0x93de2){_0x17c77a(_0x93de2);});else{_0x17c77a({'id':_0x23fc2a['id'],'phone':''});}})['catch'](function(_0x1eb80c){logger[_0x83fd('0xf')](_0x83fd('0x13'),_0x1eb80c[_0x83fd('0x11')],_0x1cec0e);_0x2e3c40(_0x4bc256[_0x83fd('0xf')](0x1f4,_0x1eb80c[_0x83fd('0x11')]));});}})[_0x83fd('0x12')](function(_0x387b9e){logger['error']('VerifyAdditionalPhones',_0x387b9e[_0x83fd('0x11')],_0x1cec0e);_0x2e3c40(_0x4bc256[_0x83fd('0xf')](0x1f4,_0x387b9e[_0x83fd('0x11')]));});}else _0x17c77a(0x1);});});};function activateAdditionalPhone(_0x2c7221,_0x5bf9b4,_0xb2d02d,_0x1848c9,_0x3874d6){return new Promise(function(_0x2e673e,_0x4d6e38){logger[_0x83fd('0x2a')]('VerifyAdditionalPhones',_0xb2d02d);var _0xc0ecf4;if(moment()>moment(_0xb2d02d[_0x83fd('0x2b')])){_0xc0ecf4=moment()[_0x83fd('0x2c')](_0x3874d6||0x3,'minutes');}else{if(_0xb2d02d[_0x83fd('0x1a')]==0x0){_0xc0ecf4=moment(_0xb2d02d['scheduledat']);}else{_0xc0ecf4=moment()[_0x83fd('0x2c')](_0x3874d6||0x3,_0x83fd('0x2d'));}}var _0x42f4c8={'phone':_0x2c7221[_0x83fd('0x2e')],'active':0x0,'OrderBy':_['isNil'](_0x2c7221[_0x83fd('0x1a')])?0x0:_0x2c7221[_0x83fd('0x1a')],'scheduledat':moment()[_0x83fd('0x2c')](_0x1848c9||0x1,_0x83fd('0x2d')),'countbusyretry':_0x5bf9b4['countbusyretry'],'countcongestionretry':_0x5bf9b4[_0x83fd('0x1d')],'countnoanswerretry':_0x5bf9b4['countnoanswerretry'],'countnosuchnumberretry':_0x5bf9b4[_0x83fd('0x1e')],'countdropretry':_0x5bf9b4[_0x83fd('0x25')],'countabandonedretry':_0x5bf9b4[_0x83fd('0x1f')],'countmachineretry':_0x5bf9b4[_0x83fd('0x20')],'countagentrejectretry':_0x5bf9b4[_0x83fd('0x21')],'createdAt':_0x5bf9b4[_0x83fd('0x2f')],'updatedAt':_0x5bf9b4['updatedAt']};var _0x2a7da2={'CmHopperId':_0x2c7221['id'],'phone':_0xb2d02d[_0x83fd('0x2e')],'active':0x0,'OrderBy':_[_0x83fd('0x30')](_0xb2d02d[_0x83fd('0x1a')])?0x0:_0xb2d02d[_0x83fd('0x1a')],'scheduledat':_0xc0ecf4,'countbusyretry':_0xb2d02d['countbusyretry'],'countcongestionretry':_0xb2d02d[_0x83fd('0x1d')],'countnoanswerretry':_0xb2d02d['countnoanswerretry'],'countnosuchnumberretry':_0x5bf9b4[_0x83fd('0x1e')],'countdropretry':_0x5bf9b4['countdropretry'],'countabandonedretry':_0x5bf9b4['countabandonedretry'],'countmachineretry':_0x5bf9b4['countmachineretry'],'countagentrejectretry':_0x5bf9b4[_0x83fd('0x21')],'createdAt':_0xb2d02d[_0x83fd('0x2f')],'updatedAt':_0xb2d02d[_0x83fd('0x31')]};logger[_0x83fd('0x2a')](_0x83fd('0x32'),_0x42f4c8);logger['info'](_0x83fd('0x33'),_0x2a7da2);return db[_0x83fd('0x34')][_0x83fd('0x35')](function(_0x5c3ac9){return db[_0x83fd('0x24')]['update'](_0x42f4c8,{'where':{'id':_0xb2d02d['id']}},{'transaction':_0x5c3ac9})['then'](function(){return db['CmHopper'][_0x83fd('0x36')](_0x2a7da2,{'where':{'id':_0x2c7221['id']}},{'transaction':_0x5c3ac9});});})[_0x83fd('0xa')](function(_0x268112){_0x2e673e({'id':_0x2c7221['id'],'phone':_0xb2d02d[_0x83fd('0x2e')]});})[_0x83fd('0x12')](function(_0x1de72e){logger[_0x83fd('0xf')](_0x83fd('0x13'),_0x1de72e[_0x83fd('0x11')],req);_0x4d6e38(_this[_0x83fd('0xf')](0x1f4,_0x1de72e['message']));});});}exports[_0x83fd('0x37')]=function(_0x403607){var _0x432502=this;return new Promise(function(_0x3a5492,_0x1bb9a8){return db[_0x83fd('0x14')][_0x83fd('0x36')](_0x403607[_0x83fd('0x15')]['field'],{'where':{'id':_0x403607[_0x83fd('0x15')]['id']}})[_0x83fd('0xa')](function(_0x4b87d3){_0x3a5492(_0x4b87d3);})['catch'](function(_0x326d9f){logger['error']('IncrementPreviewCounters',_0x326d9f['message'],_0x403607);_0x1bb9a8(_0x432502['error'](0x1f4,_0x326d9f[_0x83fd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index c098662..eb3b32b 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x266a=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x1108b2,_0x12737a){var _0x3d9ac6=function(_0xc1deb2){while(--_0xc1deb2){_0x1108b2['push'](_0x1108b2['shift']());}};_0x3d9ac6(++_0x12737a);}(_0x266a,0x75));var _0xa266=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x266a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa266('0x0'));var util=require(_0xa266('0x1'));var path=require('path');var timeout=require(_0xa266('0x2'));var express=require(_0xa266('0x3'));var router=express[_0xa266('0x4')]();var auth=require(_0xa266('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa266('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xa266('0x7')]('/',auth[_0xa266('0x8')](),controller[_0xa266('0x9')]);router['get']('/:id',auth[_0xa266('0x8')](),controller[_0xa266('0xa')]);router[_0xa266('0xb')]('/',auth['isAuthenticated'](),controller[_0xa266('0xc')]);router[_0xa266('0xd')](_0xa266('0xe'),auth['isAuthenticated'](),controller[_0xa266('0xf')]);router[_0xa266('0x10')]('/:id',auth[_0xa266('0x8')](),controller[_0xa266('0x11')]);module[_0xa266('0x12')]=router; \ No newline at end of file +var _0x31c4=['show','post','create','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x31c4,0x1d1));var _0x431c=function(_0x475580,_0x3e1697){_0x475580=_0x475580-0x0;var _0x15fd2d=_0x31c4[_0x475580];return _0x15fd2d;};'use strict';var multer=require(_0x431c('0x0'));var util=require('util');var path=require(_0x431c('0x1'));var timeout=require(_0x431c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x431c('0x3'));var interaction=require(_0x431c('0x4'));var config=require(_0x431c('0x5'));var controller=require(_0x431c('0x6'));router[_0x431c('0x7')]('/',auth[_0x431c('0x8')](),controller[_0x431c('0x9')]);router[_0x431c('0x7')](_0x431c('0xa'),auth[_0x431c('0x8')](),controller[_0x431c('0xb')]);router[_0x431c('0xc')]('/',auth[_0x431c('0x8')](),controller[_0x431c('0xd')]);router['put'](_0x431c('0xa'),auth[_0x431c('0x8')](),controller['update']);router[_0x431c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x431c('0xf')]);module[_0x431c('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c3731d2..eaefd4f 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 _0xbd59=['INTEGER','contactListQueue','sequelize','exports','STRING'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xbd59,0x10b));var _0x9bd5=function(_0x44a924,_0x1d5cf6){_0x44a924=_0x44a924-0x0;var _0x19dc4c=_0xbd59[_0x44a924];return _0x19dc4c;};'use strict';var moment=require('moment');var Sequelize=require(_0x9bd5('0x0'));module[_0x9bd5('0x1')]={'phone':{'type':Sequelize[_0x9bd5('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9bd5('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x9bd5('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x9bd5('0x3')],'unique':_0x9bd5('0x4')}}; \ No newline at end of file +var _0x2cf8=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2cf8,0x1c7));var _0x82cf=function(_0x1af482,_0x1af5b7){_0x1af482=_0x1af482-0x0;var _0x7e7580=_0x2cf8[_0x1af482];return _0x7e7580;};'use strict';var moment=require(_0x82cf('0x0'));var Sequelize=require(_0x82cf('0x1'));module[_0x82cf('0x2')]={'phone':{'type':Sequelize[_0x82cf('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x82cf('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x82cf('0x4')],'unique':_0x82cf('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index db486b0..86ba9a3 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x5a00ae,_0x307d2d){var _0x460727=function(_0x471109){while(--_0x471109){_0x5a00ae['push'](_0x5a00ae['shift']());}};_0x460727(++_0x307d2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x3564d7,_0xa022d5){var _0x1c62f8=function(_0x4d9e88){while(--_0x4d9e88){_0x3564d7['push'](_0x3564d7['shift']());}};_0x1c62f8(++_0xa022d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 1ee3be7..a9f4429 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','CmHopperBlack','util'];(function(_0x1e73fb,_0xff79eb){var _0x1e8ca7=function(_0x2a59a9){while(--_0x2a59a9){_0x1e73fb['push'](_0x1e73fb['shift']());}};_0x1e8ca7(++_0xff79eb);}(_0xedd9,0xfc));var _0x9edd=function(_0x501651,_0x41a93c){_0x501651=_0x501651-0x0;var _0x3012a0=_0xedd9[_0x501651];return _0x3012a0;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','../../config/logger','api','moment','bluebird'];(function(_0x49a315,_0x3b3d96){var _0x167a44=function(_0x16ca1c){while(--_0x16ca1c){_0x49a315['push'](_0x49a315['shift']());}};_0x167a44(++_0x3b3d96);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index fd3bd9c..40321ca 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 _0xd619=['rpc','../../config/environment','http','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','model','map','info','raw','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x406e9b,_0x5b317f){var _0x2b869d=function(_0x854507){while(--_0x854507){_0x406e9b['push'](_0x406e9b['shift']());}};_0x2b869d(++_0x5b317f);}(_0xd619,0x82));var _0x9d61=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xd619[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x9d61('0x0'));var util=require('util');var moment=require(_0x9d61('0x1'));var BPromise=require(_0x9d61('0x2'));var rs=require(_0x9d61('0x3'));var fs=require('fs');var Redis=require(_0x9d61('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d61('0x5'));var logger=require('../../config/logger')(_0x9d61('0x6'));var config=require(_0x9d61('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9d61('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27d5c1,_0x167dcb,_0x4818d3){return new BPromise(function(_0x581d90,_0x1d44de){return client['request'](_0x27d5c1,_0x4818d3)[_0x9d61('0x9')](function(_0x48a3d3){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x167dcb,_0x9d61('0xa'));logger[_0x9d61('0xb')](_0x9d61('0xc'),_0x167dcb,_0x9d61('0xa'),JSON[_0x9d61('0xd')](_0x48a3d3));if(_0x48a3d3['error']){if(_0x48a3d3[_0x9d61('0xe')]['code']===0x1f4){logger[_0x9d61('0xe')](_0x9d61('0xf'),_0x167dcb,_0x48a3d3[_0x9d61('0xe')][_0x9d61('0x10')]);return _0x1d44de(_0x48a3d3[_0x9d61('0xe')]['message']);}logger[_0x9d61('0xe')](_0x9d61('0xf'),_0x167dcb,_0x48a3d3[_0x9d61('0xe')][_0x9d61('0x10')]);return _0x581d90(_0x48a3d3[_0x9d61('0xe')]['message']);}else{logger['info'](_0x9d61('0xf'),_0x167dcb,_0x9d61('0xa'));_0x581d90(_0x48a3d3[_0x9d61('0x11')][_0x9d61('0x10')]);}})[_0x9d61('0x12')](function(_0x3802e6){logger[_0x9d61('0xe')](_0x9d61('0xf'),_0x167dcb,_0x3802e6);_0x1d44de(_0x3802e6);});});}exports[_0x9d61('0x13')]=function(_0x482fee){var _0x11c1c1=this;return new Promise(function(_0x5c9b0f,_0x139796){return db[_0x9d61('0x14')][_0x9d61('0x15')]({'raw':_0x482fee[_0x9d61('0x16')]?_0x482fee[_0x9d61('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x482fee['options']?_0x482fee[_0x9d61('0x16')][_0x9d61('0x17')]||null:null,'attributes':_0x482fee[_0x9d61('0x16')]?_0x482fee[_0x9d61('0x16')][_0x9d61('0x18')]||null:null,'limit':_0x482fee[_0x9d61('0x16')]?_0x482fee[_0x9d61('0x16')][_0x9d61('0x19')]||null:null,'include':_0x482fee[_0x9d61('0x16')]?_0x482fee[_0x9d61('0x16')][_0x9d61('0x1a')]?_['map'](_0x482fee['options'][_0x9d61('0x1a')],function(_0x2ffb8d){return{'model':db[_0x2ffb8d[_0x9d61('0x1b')]],'as':_0x2ffb8d['as'],'attributes':_0x2ffb8d[_0x9d61('0x18')],'include':_0x2ffb8d[_0x9d61('0x1a')]?_[_0x9d61('0x1c')](_0x2ffb8d[_0x9d61('0x1a')],function(_0x342ffb){return{'model':db[_0x342ffb['model']],'as':_0x342ffb['as'],'attributes':_0x342ffb[_0x9d61('0x18')],'include':_0x342ffb[_0x9d61('0x1a')]?_[_0x9d61('0x1c')](_0x342ffb[_0x9d61('0x1a')],function(_0x95b77b){return{'model':db[_0x95b77b[_0x9d61('0x1b')]],'as':_0x95b77b['as'],'attributes':_0x95b77b[_0x9d61('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ef7ad){logger[_0x9d61('0x1d')]('GetCmHopperBlack',_0x482fee);logger[_0x9d61('0xb')](_0x9d61('0x13'),_0x482fee,JSON['stringify'](_0x1ef7ad));_0x5c9b0f(_0x1ef7ad);})[_0x9d61('0x12')](function(_0x587a13){logger[_0x9d61('0xe')](_0x9d61('0x13'),_0x587a13[_0x9d61('0x10')],_0x482fee);_0x139796(_0x11c1c1[_0x9d61('0xe')](0x1f4,_0x587a13[_0x9d61('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0x28bda6){var _0x53779f=this;return new Promise(function(_0x5f21f4,_0x4518e3){return db['CmHopperBlack']['update'](_0x28bda6['body'],{'raw':_0x28bda6['options']?_0x28bda6[_0x9d61('0x16')][_0x9d61('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28bda6[_0x9d61('0x16')]?_0x28bda6['options'][_0x9d61('0x17')]||null:null,'attributes':_0x28bda6[_0x9d61('0x16')]?_0x28bda6[_0x9d61('0x16')][_0x9d61('0x18')]||null:null,'limit':_0x28bda6[_0x9d61('0x16')]?_0x28bda6[_0x9d61('0x16')][_0x9d61('0x19')]||null:null})[_0x9d61('0x9')](function(_0x14d5a4){logger[_0x9d61('0x1d')](_0x9d61('0x1f'),_0x28bda6);logger[_0x9d61('0xb')](_0x9d61('0x1f'),_0x28bda6,JSON['stringify'](_0x14d5a4));_0x5f21f4(_0x14d5a4);})[_0x9d61('0x12')](function(_0xd03247){logger['error'](_0x9d61('0x1f'),_0xd03247[_0x9d61('0x10')],_0x28bda6);_0x4518e3(_0x53779f['error'](0x1f4,_0xd03247[_0x9d61('0x10')]));});});};exports[_0x9d61('0x20')]=function(_0x56cf28){var _0x489b65=this;return new Promise(function(_0x3b6698,_0x3f6a7b){return db['CmHopperBlack'][_0x9d61('0x21')]({'where':_0x56cf28[_0x9d61('0x16')]?_0x56cf28[_0x9d61('0x16')][_0x9d61('0x17')]||null:null})[_0x9d61('0x9')](function(_0x22ac35){logger['info']('DestroyCmHopperBlack',_0x56cf28);logger[_0x9d61('0xb')]('DestroyCmHopperBlack',_0x56cf28,JSON[_0x9d61('0xd')](_0x22ac35));_0x3b6698(_0x22ac35);})[_0x9d61('0x12')](function(_0x3436f7){logger[_0x9d61('0xe')](_0x9d61('0x20'),_0x3436f7['message'],_0x56cf28);_0x3f6a7b(_0x489b65[_0x9d61('0xe')](0x1f4,_0x3436f7[_0x9d61('0x10')]));});});}; \ No newline at end of file +var _0x07b2=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','raw','catch','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0x07b2,0xfe));var _0x207b=function(_0x50d3a3,_0x253f47){_0x50d3a3=_0x50d3a3-0x0;var _0x4ccd92=_0x07b2[_0x50d3a3];return _0x4ccd92;};'use strict';var _=require(_0x207b('0x0'));var util=require(_0x207b('0x1'));var moment=require(_0x207b('0x2'));var BPromise=require(_0x207b('0x3'));var rs=require(_0x207b('0x4'));var fs=require('fs');var Redis=require(_0x207b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x207b('0x6'));var logger=require(_0x207b('0x7'))(_0x207b('0x8'));var config=require(_0x207b('0x9'));var jayson=require(_0x207b('0xa'));var client=jayson[_0x207b('0xb')][_0x207b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b3a4b,_0x7a968b,_0xe05fc2){return new BPromise(function(_0x51dacb,_0x14d24f){return client['request'](_0x1b3a4b,_0xe05fc2)[_0x207b('0xd')](function(_0xb5d055){logger[_0x207b('0xe')](_0x207b('0xf'),_0x7a968b,'request\x20sent');logger[_0x207b('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x7a968b,'request\x20sent',JSON[_0x207b('0x11')](_0xb5d055));if(_0xb5d055['error']){if(_0xb5d055[_0x207b('0x12')]['code']===0x1f4){logger[_0x207b('0x12')](_0x207b('0xf'),_0x7a968b,_0xb5d055[_0x207b('0x12')][_0x207b('0x13')]);return _0x14d24f(_0xb5d055[_0x207b('0x12')][_0x207b('0x13')]);}logger[_0x207b('0x12')](_0x207b('0xf'),_0x7a968b,_0xb5d055['error'][_0x207b('0x13')]);return _0x51dacb(_0xb5d055[_0x207b('0x12')][_0x207b('0x13')]);}else{logger[_0x207b('0xe')](_0x207b('0xf'),_0x7a968b,_0x207b('0x14'));_0x51dacb(_0xb5d055[_0x207b('0x15')]['message']);}})['catch'](function(_0x4f91ad){logger[_0x207b('0x12')](_0x207b('0xf'),_0x7a968b,_0x4f91ad);_0x14d24f(_0x4f91ad);});});}exports[_0x207b('0x16')]=function(_0x365fd6){var _0x59d850=this;return new Promise(function(_0x4548ef,_0x555086){return db[_0x207b('0x17')]['findAll']({'raw':_0x365fd6[_0x207b('0x18')]?_0x365fd6['options']['raw']===undefined?!![]:![]:!![],'where':_0x365fd6[_0x207b('0x18')]?_0x365fd6[_0x207b('0x18')][_0x207b('0x19')]||null:null,'attributes':_0x365fd6['options']?_0x365fd6[_0x207b('0x18')][_0x207b('0x1a')]||null:null,'limit':_0x365fd6[_0x207b('0x18')]?_0x365fd6[_0x207b('0x18')][_0x207b('0x1b')]||null:null,'include':_0x365fd6[_0x207b('0x18')]?_0x365fd6[_0x207b('0x18')][_0x207b('0x1c')]?_[_0x207b('0x1d')](_0x365fd6[_0x207b('0x18')]['include'],function(_0x53ba76){return{'model':db[_0x53ba76[_0x207b('0x1e')]],'as':_0x53ba76['as'],'attributes':_0x53ba76[_0x207b('0x1a')],'include':_0x53ba76['include']?_[_0x207b('0x1d')](_0x53ba76[_0x207b('0x1c')],function(_0x378e57){return{'model':db[_0x378e57[_0x207b('0x1e')]],'as':_0x378e57['as'],'attributes':_0x378e57['attributes'],'include':_0x378e57[_0x207b('0x1c')]?_[_0x207b('0x1d')](_0x378e57[_0x207b('0x1c')],function(_0x18ba35){return{'model':db[_0x18ba35[_0x207b('0x1e')]],'as':_0x18ba35['as'],'attributes':_0x18ba35[_0x207b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x207b('0xd')](function(_0xfa5abc){logger[_0x207b('0xe')](_0x207b('0x16'),_0x365fd6);logger[_0x207b('0x10')](_0x207b('0x16'),_0x365fd6,JSON['stringify'](_0xfa5abc));_0x4548ef(_0xfa5abc);})['catch'](function(_0x50ff73){logger[_0x207b('0x12')]('GetCmHopperBlack',_0x50ff73[_0x207b('0x13')],_0x365fd6);_0x555086(_0x59d850[_0x207b('0x12')](0x1f4,_0x50ff73[_0x207b('0x13')]));});});};exports[_0x207b('0x1f')]=function(_0x72159c){var _0x1b2e82=this;return new Promise(function(_0x2095ae,_0x50654a){return db['CmHopperBlack']['update'](_0x72159c[_0x207b('0x20')],{'raw':_0x72159c['options']?_0x72159c[_0x207b('0x18')][_0x207b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x72159c[_0x207b('0x18')]?_0x72159c[_0x207b('0x18')][_0x207b('0x19')]||null:null,'attributes':_0x72159c['options']?_0x72159c[_0x207b('0x18')]['attributes']||null:null,'limit':_0x72159c['options']?_0x72159c[_0x207b('0x18')][_0x207b('0x1b')]||null:null})[_0x207b('0xd')](function(_0x15db45){logger[_0x207b('0xe')](_0x207b('0x1f'),_0x72159c);logger[_0x207b('0x10')](_0x207b('0x1f'),_0x72159c,JSON[_0x207b('0x11')](_0x15db45));_0x2095ae(_0x15db45);})[_0x207b('0x22')](function(_0x11a752){logger[_0x207b('0x12')](_0x207b('0x1f'),_0x11a752[_0x207b('0x13')],_0x72159c);_0x50654a(_0x1b2e82[_0x207b('0x12')](0x1f4,_0x11a752[_0x207b('0x13')]));});});};exports[_0x207b('0x23')]=function(_0x7956b2){var _0x8a8af9=this;return new Promise(function(_0x10872f,_0x5d0721){return db[_0x207b('0x17')][_0x207b('0x24')]({'where':_0x7956b2['options']?_0x7956b2[_0x207b('0x18')]['where']||null:null})['then'](function(_0x17038a){logger['info'](_0x207b('0x23'),_0x7956b2);logger[_0x207b('0x10')](_0x207b('0x23'),_0x7956b2,JSON[_0x207b('0x11')](_0x17038a));_0x10872f(_0x17038a);})[_0x207b('0x22')](function(_0x4580dc){logger['error'](_0x207b('0x23'),_0x4580dc[_0x207b('0x13')],_0x7956b2);_0x5d0721(_0x8a8af9[_0x207b('0x12')](0x1f4,_0x4580dc[_0x207b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index e49dffa..e6f142a 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 _0xac9d=['../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3c8f26,_0x453699){var _0x5a4dd7=function(_0xd5c4b9){while(--_0xd5c4b9){_0x3c8f26['push'](_0x3c8f26['shift']());}};_0x5a4dd7(++_0x453699);}(_0xac9d,0x14d));var _0xdac9=function(_0x49d7ca,_0x514fc4){_0x49d7ca=_0x49d7ca-0x0;var _0x12422f=_0xac9d[_0x49d7ca];return _0x12422f;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var auth=require(_0xdac9('0x6'));var interaction=require(_0xdac9('0x7'));var config=require('../../config/environment');var controller=require(_0xdac9('0x8'));router['get']('/',auth[_0xdac9('0x9')](),controller[_0xdac9('0xa')]);router[_0xdac9('0xb')](_0xdac9('0xc'),auth[_0xdac9('0x9')](),controller[_0xdac9('0xd')]);router['get'](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0xf')]);router[_0xdac9('0x10')](_0xdac9('0xe'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x11')]);router[_0xdac9('0x12')](_0xdac9('0xe'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd0bb=['path','express','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','/:id','show','put','update','delete','destroy','multer','util'];(function(_0x27b96e,_0x27b07d){var _0x54c1c2=function(_0x1f46d2){while(--_0x1f46d2){_0x27b96e['push'](_0x27b96e['shift']());}};_0x54c1c2(++_0x27b07d);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x458ed6,_0x504646){_0x458ed6=_0x458ed6-0x0;var _0xa5dfd9=_0xd0bb[_0x458ed6];return _0xa5dfd9;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var auth=require(_0xbd0b('0x4'));var interaction=require(_0xbd0b('0x5'));var config=require('../../config/environment');var controller=require(_0xbd0b('0x6'));router['get']('/',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x8')]);router[_0xbd0b('0x9')](_0xbd0b('0xa'),auth[_0xbd0b('0x7')](),controller['describe']);router[_0xbd0b('0x9')](_0xbd0b('0xb'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0xc')]);router[_0xbd0b('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index c08042d..f38ae73 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 _0x9f05=['diff','seconds','dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime'];(function(_0x2ac8b0,_0x3d6ffd){var _0x43d4b4=function(_0x798e3f){while(--_0x798e3f){_0x2ac8b0['push'](_0x2ac8b0['shift']());}};_0x43d4b4(++_0x3d6ffd);}(_0x9f05,0x1f0));var _0x59f0=function(_0x57cb95,_0x2d5854){_0x57cb95=_0x57cb95-0x0;var _0x5a10bb=_0x9f05[_0x57cb95];return _0x5a10bb;};'use strict';var Sequelize=require(_0x59f0('0x0'));var moment=require(_0x59f0('0x1'));module['exports']={'state':{'type':Sequelize[_0x59f0('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x59f0('0x3')]},'scheduledat':{'type':Sequelize[_0x59f0('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x59f0('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x59f0('0x3')]},'originatecalleridname':{'type':Sequelize[_0x59f0('0x3')]},'calleridnum':{'type':Sequelize[_0x59f0('0x3')]},'calleridname':{'type':Sequelize[_0x59f0('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x59f0('0x4')]},'answertime':{'type':Sequelize[_0x59f0('0x4')]},'droptime':{'type':Sequelize[_0x59f0('0x4')]},'endtime':{'type':Sequelize[_0x59f0('0x4')]},'ringtime':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x59f0('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x59f0('0x3')]},'membername':{'type':Sequelize[_0x59f0('0x3')]},'reason':{'type':Sequelize[_0x59f0('0x3')]},'disposition':{'type':Sequelize[_0x59f0('0x3')]},'dispositionat':{'type':Sequelize[_0x59f0('0x4')],'set':function(_0x4c70a6){var _0x3b1244=this[_0x59f0('0x5')]('endtime');if(_0x3b1244&&_0x4c70a6){this[_0x59f0('0x6')](_0x59f0('0x7'),moment(_0x4c70a6)[_0x59f0('0x8')](moment(_0x3b1244),_0x59f0('0x9')));}return this[_0x59f0('0x6')](_0x59f0('0xa'),_0x4c70a6);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x59f0('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x59f0('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x59f0('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x59f0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x59f0('0x4')]},'deleted':{'type':Sequelize[_0x59f0('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x59f0('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8a9d=['STRING','DATE','getDataValue','setDataValue','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER'];(function(_0x45b63c,_0x31ae0f){var _0x167233=function(_0x148f1c){while(--_0x148f1c){_0x45b63c['push'](_0x45b63c['shift']());}};_0x167233(++_0x31ae0f);}(_0x8a9d,0x1c9));var _0xd8a9=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x8a9d[_0x5ce3c8];return _0xa76867;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd8a9('0x0'));module[_0xd8a9('0x1')]={'state':{'type':Sequelize[_0xd8a9('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd8a9('0x3')]},'scheduledat':{'type':Sequelize[_0xd8a9('0x4')]},'countbusyretry':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd8a9('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd8a9('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd8a9('0x3')]},'calleridname':{'type':Sequelize[_0xd8a9('0x3')]},'starttime':{'type':Sequelize[_0xd8a9('0x4')]},'responsetime':{'type':Sequelize[_0xd8a9('0x4')]},'answertime':{'type':Sequelize[_0xd8a9('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd8a9('0x4')]},'ringtime':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd8a9('0x3')]},'campaign':{'type':Sequelize[_0xd8a9('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd8a9('0x3')]},'reason':{'type':Sequelize[_0xd8a9('0x3')]},'disposition':{'type':Sequelize[_0xd8a9('0x3')]},'dispositionat':{'type':Sequelize[_0xd8a9('0x4')],'set':function(_0x44078e){var _0x50af24=this[_0xd8a9('0x5')]('endtime');if(_0x50af24&&_0x44078e){this[_0xd8a9('0x6')]('followuptime',moment(_0x44078e)['diff'](moment(_0x50af24),_0xd8a9('0x7')));}return this['setDataValue'](_0xd8a9('0x8'),_0x44078e);}},'amd':{'type':Sequelize[_0xd8a9('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd8a9('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd8a9('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd8a9('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd8a9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd8a9('0x4')]},'deleted':{'type':Sequelize[_0xd8a9('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd8a9('0x4')]},'recallme':{'type':Sequelize[_0xd8a9('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd8a9('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 63d85d4..4b491db 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 _0xd2f5=['describe','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','findAll','noSuchContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','group','checkContactHopper','CmHopper','findOne','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','CmHopperFinal','count','includeAll','rows','catch','show','include','options'];(function(_0x4a042b,_0x25a4c9){var _0x33a04a=function(_0x5abeff){while(--_0x5abeff){_0x4a042b['push'](_0x4a042b['shift']());}};_0x33a04a(++_0x25a4c9);}(_0xd2f5,0x144));var _0x5d2f=function(_0x2c2c5a,_0x57cac7){_0x2c2c5a=_0x2c2c5a-0x0;var _0x126933=_0xd2f5[_0x2c2c5a];return _0x126933;};'use strict';var pdf=require(_0x5d2f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5d2f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d2f('0x2'));var rp=require('request-promise');var moment=require(_0x5d2f('0x3'));var BPromise=require(_0x5d2f('0x4'));var Mustache=require(_0x5d2f('0x5'));var util=require(_0x5d2f('0x6'));var path=require(_0x5d2f('0x7'));var sox=require(_0x5d2f('0x8'));var csv=require(_0x5d2f('0x9'));var ejs=require(_0x5d2f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5d2f('0xb'));var crypto=require(_0x5d2f('0xc'));var jsforce=require(_0x5d2f('0xd'));var deskjs=require(_0x5d2f('0xe'));var toCsv=require(_0x5d2f('0x9'));var querystring=require(_0x5d2f('0xf'));var Papa=require('papaparse');var Redis=require(_0x5d2f('0x10'));var authService=require(_0x5d2f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5d2f('0x12'));var hardwareService=require(_0x5d2f('0x13'));var logger=require(_0x5d2f('0x14'))('api');var utils=require(_0x5d2f('0x15'));var config=require(_0x5d2f('0x16'));var db=require(_0x5d2f('0x17'))['db'];function respondWithStatusCode(_0x5d07f4,_0x510eb5){_0x510eb5=_0x510eb5||0xcc;return function(_0x15530f){if(_0x15530f){return _0x5d07f4['sendStatus'](_0x510eb5);}return _0x5d07f4[_0x5d2f('0x18')](_0x510eb5)[_0x5d2f('0x19')]();};}function respondWithResult(_0x5e6a95,_0x663b11){_0x663b11=_0x663b11||0xc8;return function(_0x4b0bf6){if(_0x4b0bf6){return _0x5e6a95[_0x5d2f('0x18')](_0x663b11)[_0x5d2f('0x1a')](_0x4b0bf6);}};}function respondWithFilteredResult(_0x309985,_0x4df9b1){return function(_0x6d7c6c){if(_0x6d7c6c){var _0x39a7d5=_0x6d7c6c['count'],_0x1ca388=_0x4df9b1[_0x5d2f('0x1b')],_0x2876fb=_0x4df9b1[_0x5d2f('0x1b')]+_0x4df9b1[_0x5d2f('0x1c')],_0x1536ee;if(_0x2876fb>=_0x39a7d5){_0x2876fb=_0x39a7d5;_0x1536ee=0xc8;}else{_0x1536ee=0xce;}_0x309985[_0x5d2f('0x18')](_0x1536ee);return _0x309985['set'](_0x5d2f('0x1d'),_0x1ca388+'-'+_0x2876fb+'/'+_0x39a7d5)[_0x5d2f('0x1a')](_0x6d7c6c);}return null;};}function patchUpdates(_0x36ddf1){return function(_0x3d5ad9){try{jsonpatch[_0x5d2f('0x1e')](_0x3d5ad9,_0x36ddf1,!![]);}catch(_0x32ec09){return BPromise[_0x5d2f('0x1f')](_0x32ec09);}return _0x3d5ad9['save']();};}function saveUpdates(_0x47fe97,_0x4d3959){return function(_0x3814b1){if(_0x3814b1){return _0x3814b1[_0x5d2f('0x20')](_0x47fe97)[_0x5d2f('0x21')](function(_0x41967d){return _0x41967d;});}return null;};}function removeEntity(_0x215f0c,_0x5c6dae){return function(_0x5cc8d6){if(_0x5cc8d6){return _0x5cc8d6[_0x5d2f('0x22')]()['then'](function(){_0x215f0c[_0x5d2f('0x18')](0xcc)[_0x5d2f('0x19')]();});}};}function handleEntityNotFound(_0x102304,_0x6d8859){return function(_0x6d4ad2){if(!_0x6d4ad2){_0x102304[_0x5d2f('0x23')](0x194);}return _0x6d4ad2;};}function handleError(_0x25e953,_0x20439c){_0x20439c=_0x20439c||0x1f4;return function(_0x543cc4){logger[_0x5d2f('0x24')](_0x543cc4[_0x5d2f('0x25')]);if(_0x543cc4[_0x5d2f('0x26')]){delete _0x543cc4[_0x5d2f('0x26')];}_0x25e953[_0x5d2f('0x18')](_0x20439c)[_0x5d2f('0x27')](_0x543cc4);};}exports[_0x5d2f('0x28')]=function(_0x273223,_0x51ca6a){var _0x10351a={},_0xa95a71={},_0x3d1b95={'count':0x0,'rows':[]};var _0x3446a0=_[_0x5d2f('0x29')](db['CmHopperFinal'][_0x5d2f('0x2a')],function(_0x35e94f){return{'name':_0x35e94f[_0x5d2f('0x2b')],'type':_0x35e94f[_0x5d2f('0x2c')]['key']};});_0xa95a71[_0x5d2f('0x2d')]=_[_0x5d2f('0x29')](_0x3446a0,'name');_0xa95a71[_0x5d2f('0x2e')]=_[_0x5d2f('0x2f')](_0x273223[_0x5d2f('0x2e')]);_0xa95a71['filters']=_[_0x5d2f('0x30')](_0xa95a71[_0x5d2f('0x2d')],_0xa95a71[_0x5d2f('0x2e')]);_0x10351a[_0x5d2f('0x31')]=_[_0x5d2f('0x30')](_0xa95a71[_0x5d2f('0x2d')],qs['fields'](_0x273223[_0x5d2f('0x2e')][_0x5d2f('0x32')]));_0x10351a[_0x5d2f('0x31')]=_0x10351a['attributes']['length']?_0x10351a[_0x5d2f('0x31')]:_0xa95a71[_0x5d2f('0x2d')];if(!_0x273223[_0x5d2f('0x2e')][_0x5d2f('0x33')](_0x5d2f('0x34'))){_0x10351a[_0x5d2f('0x1c')]=qs[_0x5d2f('0x1c')](_0x273223[_0x5d2f('0x2e')][_0x5d2f('0x1c')]);_0x10351a[_0x5d2f('0x1b')]=qs[_0x5d2f('0x1b')](_0x273223[_0x5d2f('0x2e')][_0x5d2f('0x1b')]);}_0x10351a[_0x5d2f('0x35')]=qs[_0x5d2f('0x36')](_0x273223['query'][_0x5d2f('0x36')]);_0x10351a[_0x5d2f('0x37')]=qs[_0x5d2f('0x38')](_[_0x5d2f('0x39')](_0x273223[_0x5d2f('0x2e')],_0xa95a71[_0x5d2f('0x38')]),_0x3446a0);if(_0x273223[_0x5d2f('0x2e')][_0x5d2f('0x3a')]){_0x10351a[_0x5d2f('0x37')]=_['merge'](_0x10351a[_0x5d2f('0x37')],{'$or':_[_0x5d2f('0x29')](_0x3446a0,function(_0x216c35){if(_0x216c35[_0x5d2f('0x2c')]!==_0x5d2f('0x3b')){var _0x372359={};_0x372359[_0x216c35[_0x5d2f('0x26')]]={'$like':'%'+_0x273223[_0x5d2f('0x2e')]['filter']+'%'};return _0x372359;}})});}_0x10351a=_[_0x5d2f('0x3c')]({},_0x10351a,_0x273223['options']);var _0x2c5ba8={'where':_0x10351a[_0x5d2f('0x37')]};return db[_0x5d2f('0x3d')][_0x5d2f('0x3e')](_0x2c5ba8)[_0x5d2f('0x21')](function(_0x117d5d){_0x3d1b95[_0x5d2f('0x3e')]=_0x117d5d;if(_0x273223[_0x5d2f('0x2e')][_0x5d2f('0x3f')]){_0x10351a['include']=[{'all':!![]}];}return db[_0x5d2f('0x3d')]['findAll'](_0x10351a);})['then'](function(_0x168c9d){_0x3d1b95[_0x5d2f('0x40')]=_0x168c9d;return _0x3d1b95;})[_0x5d2f('0x21')](respondWithFilteredResult(_0x51ca6a,_0x10351a))[_0x5d2f('0x41')](handleError(_0x51ca6a,null));};exports[_0x5d2f('0x42')]=function(_0x2553dd,_0x195721){var _0x49c3fe={'raw':!![],'where':{'id':_0x2553dd['params']['id']}},_0x508fba={};_0x508fba[_0x5d2f('0x2d')]=_[_0x5d2f('0x2f')](db[_0x5d2f('0x3d')][_0x5d2f('0x2a')]);_0x508fba[_0x5d2f('0x2e')]=_['keys'](_0x2553dd[_0x5d2f('0x2e')]);_0x508fba[_0x5d2f('0x38')]=_[_0x5d2f('0x30')](_0x508fba['model'],_0x508fba[_0x5d2f('0x2e')]);_0x49c3fe[_0x5d2f('0x31')]=_[_0x5d2f('0x30')](_0x508fba[_0x5d2f('0x2d')],qs[_0x5d2f('0x32')](_0x2553dd[_0x5d2f('0x2e')]['fields']));_0x49c3fe[_0x5d2f('0x31')]=_0x49c3fe['attributes']['length']?_0x49c3fe[_0x5d2f('0x31')]:_0x508fba[_0x5d2f('0x2d')];if(_0x2553dd[_0x5d2f('0x2e')]['includeAll']){_0x49c3fe[_0x5d2f('0x43')]=[{'all':!![]}];}_0x49c3fe=_[_0x5d2f('0x3c')]({},_0x49c3fe,_0x2553dd[_0x5d2f('0x44')]);return db[_0x5d2f('0x3d')]['find'](_0x49c3fe)[_0x5d2f('0x21')](handleEntityNotFound(_0x195721,null))[_0x5d2f('0x21')](respondWithResult(_0x195721,null))[_0x5d2f('0x41')](handleError(_0x195721,null));};exports[_0x5d2f('0x45')]=function(_0x2db009,_0x22b252){return db[_0x5d2f('0x3d')][_0x5d2f('0x45')]()[_0x5d2f('0x21')](respondWithResult(_0x22b252,null))[_0x5d2f('0x41')](handleError(_0x22b252,null));};exports['update']=function(_0x577e8a,_0x55a4a0){if(_0x577e8a[_0x5d2f('0x46')]['uniqueid']){delete _0x577e8a[_0x5d2f('0x46')][_0x5d2f('0x47')];}return db[_0x5d2f('0x3d')][_0x5d2f('0x48')]({'where':{'uniqueid':_0x577e8a[_0x5d2f('0x49')]['id']}})[_0x5d2f('0x21')](handleEntityNotFound(_0x55a4a0,null))['then'](saveUpdates(_0x577e8a['body'],null))[_0x5d2f('0x21')](respondWithResult(_0x55a4a0,null))[_0x5d2f('0x41')](handleError(_0x55a4a0,null));};exports[_0x5d2f('0x4a')]=function(_0x1a51fa,_0x539f73,_0x3baabe){return db[_0x5d2f('0x3d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x1a51fa[_0x5d2f('0x49')]['id']},'attributes':[[db[_0x5d2f('0x4b')]['fn']('COUNT',db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x4d')))),'noSuchContacts'],[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x4f')))),_0x5d2f('0x50')],[db['sequelize']['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x5d2f('0x51')],[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x52')))),_0x5d2f('0x53')],[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db['sequelize']['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x54')))),'abandonedContacts'],[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')]['literal'](_0x5d2f('0x55')))),_0x5d2f('0x56')],[db['sequelize']['fn'](_0x5d2f('0x4e'),db['sequelize']['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x57')))),_0x5d2f('0x58')]]})['then'](handleEntityNotFound(_0x539f73,null))[_0x5d2f('0x21')](respondWithResult(_0x539f73,null))[_0x5d2f('0x41')](handleError(_0x539f73,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x393d67,_0x1eb949,_0x5a306b){return db[_0x5d2f('0x3d')][_0x5d2f('0x59')]({'raw':![],'where':{'CampaignId':_0x393d67['params']['id']},'attributes':[[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db['sequelize']['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x4d')))),_0x5d2f('0x5a')],[db['sequelize']['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x5d2f('0x4f')))),_0x5d2f('0x50')],[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x5d2f('0x5b')))),_0x5d2f('0x51')],[db['sequelize']['fn']('COUNT',db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db['sequelize']['fn']('IF',db[_0x5d2f('0x4b')]['literal'](_0x5d2f('0x5c')))),_0x5d2f('0x5d')],[db[_0x5d2f('0x4b')]['fn']('COUNT',db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x54')))),'abandonedContacts'],[db[_0x5d2f('0x4b')]['fn']('COUNT',db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')]['literal'](_0x5d2f('0x55')))),_0x5d2f('0x56')],[db['sequelize']['fn']('COUNT',db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x5d2f('0x58')]]})[_0x5d2f('0x21')](handleEntityNotFound(_0x1eb949,null))['then'](respondWithResult(_0x1eb949,null))[_0x5d2f('0x41')](handleError(_0x1eb949,null));};exports[_0x5d2f('0x5e')]=function(_0x1bd125,_0x35c992,_0x2e67f1){return db['VoiceQueue'][_0x5d2f('0x48')]({'where':{'id':_0x1bd125[_0x5d2f('0x49')]['id']}})[_0x5d2f('0x21')](handleEntityNotFound(_0x35c992,null))[_0x5d2f('0x21')](function(_0x274672){var _0x37b4a6;if(_0x274672){_0x37b4a6=squel[_0x5d2f('0x5f')]()[_0x5d2f('0x60')]('cm_hopper')[_0x5d2f('0x61')]([_0x5d2f('0x62'),_0x5d2f('0x63'),_0x5d2f('0x64'),'ListId',_0x5d2f('0x65'),_0x5d2f('0x66'),_0x5d2f('0x67')],squel[_0x5d2f('0x68')]()[_0x5d2f('0x69')](_0x5d2f('0x6a'),'phone')['field'](_0x5d2f('0x6b'),_0x5d2f('0x63'))[_0x5d2f('0x69')](_0x5d2f('0x6c'),'ContactId')[_0x5d2f('0x69')](_0x5d2f('0x6d'),'ListId')[_0x5d2f('0x69')](_0x5d2f('0x6e'),_0x5d2f('0x65'))[_0x5d2f('0x69')](_0x5d2f('0x6b'),_0x5d2f('0x66'))['field'](_0x5d2f('0x6b'),_0x5d2f('0x67'))[_0x5d2f('0x6f')](_0x5d2f('0x70'))['where']('VoiceQueueId\x20=\x20?',_0x1bd125[_0x5d2f('0x49')]['id']['toString']())[_0x5d2f('0x37')]('state\x20=\x20?',_0x1bd125[_0x5d2f('0x46')][_0x5d2f('0x71')][_0x5d2f('0x72')]())[_0x5d2f('0x37')](_0x5d2f('0x73'))['where'](_0x5d2f('0x74'),squel[_0x5d2f('0x68')]()[_0x5d2f('0x69')]('phone')[_0x5d2f('0x6f')](_0x5d2f('0x75'))['where'](_0x5d2f('0x76'),_0x1bd125[_0x5d2f('0x49')]['id'][_0x5d2f('0x72')]()))[_0x5d2f('0x37')](_0x5d2f('0x74'),squel[_0x5d2f('0x68')]()[_0x5d2f('0x69')](_0x5d2f('0x77'))[_0x5d2f('0x6f')](_0x5d2f('0x70'))[_0x5d2f('0x37')](_0x5d2f('0x76'),_0x1bd125[_0x5d2f('0x49')]['id'][_0x5d2f('0x72')]())['where'](_0x5d2f('0x78')))['group']('ContactId'))[_0x5d2f('0x72')]();return db[_0x5d2f('0x4b')]['query'](_0x37b4a6);}return[];})[_0x5d2f('0x21')](respondWithResult(_0x35c992,null))[_0x5d2f('0x41')](handleError(_0x35c992,null));};exports[_0x5d2f('0x79')]=function(_0x216a78,_0x3e6f5a,_0x7a217f){return db[_0x5d2f('0x7a')][_0x5d2f('0x48')]({'where':{'id':_0x216a78[_0x5d2f('0x49')]['id']}})[_0x5d2f('0x21')](handleEntityNotFound(_0x3e6f5a,null))[_0x5d2f('0x21')](function(_0x2e0d42){var _0x3c7782;if(_0x2e0d42){_0x3c7782=squel[_0x5d2f('0x5f')]()[_0x5d2f('0x60')]('cm_hopper')[_0x5d2f('0x61')](['phone','scheduledAt',_0x5d2f('0x64'),_0x5d2f('0x7b'),_0x5d2f('0x7c'),_0x5d2f('0x66'),'updatedAt'],squel[_0x5d2f('0x68')]()[_0x5d2f('0x69')](_0x5d2f('0x6a'),_0x5d2f('0x62'))[_0x5d2f('0x69')]('NOW()',_0x5d2f('0x63'))[_0x5d2f('0x69')](_0x5d2f('0x6c'),_0x5d2f('0x64'))[_0x5d2f('0x69')]('ANY_VALUE(ListId)',_0x5d2f('0x7b'))[_0x5d2f('0x69')]('ANY_VALUE(CampaignId)',_0x5d2f('0x7c'))[_0x5d2f('0x69')]('NOW()',_0x5d2f('0x66'))[_0x5d2f('0x69')](_0x5d2f('0x6b'),_0x5d2f('0x67'))[_0x5d2f('0x6f')](_0x5d2f('0x70'))[_0x5d2f('0x37')](_0x5d2f('0x7d'),_0x216a78['params']['id'][_0x5d2f('0x72')]())[_0x5d2f('0x37')](_0x5d2f('0x7e'),_0x216a78[_0x5d2f('0x46')]['state'][_0x5d2f('0x72')]())[_0x5d2f('0x37')](_0x5d2f('0x73'))[_0x5d2f('0x37')](_0x5d2f('0x74'),squel['select']()[_0x5d2f('0x69')](_0x5d2f('0x62'))['from'](_0x5d2f('0x75'))[_0x5d2f('0x37')](_0x5d2f('0x7d'),_0x216a78[_0x5d2f('0x49')]['id'][_0x5d2f('0x72')]()))[_0x5d2f('0x37')](_0x5d2f('0x74'),squel[_0x5d2f('0x68')]()[_0x5d2f('0x69')]('calleridnum')['from'](_0x5d2f('0x70'))[_0x5d2f('0x37')](_0x5d2f('0x7d'),_0x216a78[_0x5d2f('0x49')]['id'][_0x5d2f('0x72')]())[_0x5d2f('0x37')](_0x5d2f('0x78')))[_0x5d2f('0x7f')](_0x5d2f('0x64')))[_0x5d2f('0x72')]();return db['sequelize'][_0x5d2f('0x2e')](_0x3c7782);}return[];})[_0x5d2f('0x21')](respondWithResult(_0x3e6f5a,null))['catch'](handleError(_0x3e6f5a,null));};exports[_0x5d2f('0x80')]=function(_0x5772a6,_0x5ba863,_0x47ab3a){return db[_0x5d2f('0x81')][_0x5d2f('0x82')]({'where':{'VoiceQueueId':_0x5772a6[_0x5d2f('0x46')][_0x5d2f('0x65')],'CampaignId':_0x5772a6[_0x5d2f('0x46')][_0x5d2f('0x7c')],'ContactId':_0x5772a6[_0x5d2f('0x46')][_0x5d2f('0x64')]}})[_0x5d2f('0x21')](handleEntityNotFound(_0x5ba863,null))[_0x5d2f('0x21')](function(_0x48fc53){if(_0x48fc53){return _0x48fc53;}return null;})[_0x5d2f('0x21')](respondWithResult(_0x5ba863,null))[_0x5d2f('0x41')](handleError(_0x5ba863,null));}; \ No newline at end of file +var _0x4975=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne'];(function(_0x28e9f9,_0xad591e){var _0x521b0c=function(_0x199dcc){while(--_0x199dcc){_0x28e9f9['push'](_0x28e9f9['shift']());}};_0x521b0c(++_0xad591e);}(_0x4975,0x86));var _0x5497=function(_0x1adb4d,_0x40388f){_0x1adb4d=_0x1adb4d-0x0;var _0x3021a0=_0x4975[_0x1adb4d];return _0x3021a0;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc250bb,_0x1b23df){_0x1b23df=_0x1b23df||0xcc;return function(_0x1bb794){if(_0x1bb794){return _0xc250bb[_0x5497('0x18')](_0x1b23df);}return _0xc250bb[_0x5497('0x19')](_0x1b23df)[_0x5497('0x1a')]();};}function respondWithResult(_0x1f7169,_0xaca97d){_0xaca97d=_0xaca97d||0xc8;return function(_0x363a5b){if(_0x363a5b){return _0x1f7169[_0x5497('0x19')](_0xaca97d)['json'](_0x363a5b);}};}function respondWithFilteredResult(_0x11b0a9,_0x4fb8e9){return function(_0x4237a9){if(_0x4237a9){var _0x2bfd8a=_0x4237a9[_0x5497('0x1b')],_0x19e5f3=_0x4fb8e9[_0x5497('0x1c')],_0x3ce50b=_0x4fb8e9['offset']+_0x4fb8e9['limit'],_0x37c18e;if(_0x3ce50b>=_0x2bfd8a){_0x3ce50b=_0x2bfd8a;_0x37c18e=0xc8;}else{_0x37c18e=0xce;}_0x11b0a9[_0x5497('0x19')](_0x37c18e);return _0x11b0a9[_0x5497('0x1d')](_0x5497('0x1e'),_0x19e5f3+'-'+_0x3ce50b+'/'+_0x2bfd8a)['json'](_0x4237a9);}return null;};}function patchUpdates(_0xbf1ba7){return function(_0xcbd71d){try{jsonpatch[_0x5497('0x1f')](_0xcbd71d,_0xbf1ba7,!![]);}catch(_0x43da2c){return BPromise[_0x5497('0x20')](_0x43da2c);}return _0xcbd71d[_0x5497('0x21')]();};}function saveUpdates(_0x16d378,_0x10226f){return function(_0x2e3960){if(_0x2e3960){return _0x2e3960[_0x5497('0x22')](_0x16d378)[_0x5497('0x23')](function(_0x52c049){return _0x52c049;});}return null;};}function removeEntity(_0x720767,_0x4d1b27){return function(_0x19200a){if(_0x19200a){return _0x19200a[_0x5497('0x24')]()[_0x5497('0x23')](function(){_0x720767[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(!_0x54043a){_0x3b2fbc[_0x5497('0x18')](0x194);}return _0x54043a;};}function handleError(_0x34b97f,_0x24482a){_0x24482a=_0x24482a||0x1f4;return function(_0x281155){logger['error'](_0x281155[_0x5497('0x25')]);if(_0x281155['name']){delete _0x281155[_0x5497('0x26')];}_0x34b97f[_0x5497('0x19')](_0x24482a)[_0x5497('0x27')](_0x281155);};}exports[_0x5497('0x28')]=function(_0x163a30,_0x31cd01){var _0x48b835={},_0x4af5f4={},_0x5406e2={'count':0x0,'rows':[]};var _0x583d06=_['map'](db[_0x5497('0x29')]['rawAttributes'],function(_0x5e9356){return{'name':_0x5e9356[_0x5497('0x2a')],'type':_0x5e9356[_0x5497('0x2b')][_0x5497('0x2c')]};});_0x4af5f4['model']=_['map'](_0x583d06,'name');_0x4af5f4[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x163a30[_0x5497('0x2d')]);_0x4af5f4['filters']=_['intersection'](_0x4af5f4['model'],_0x4af5f4[_0x5497('0x2d')]);_0x48b835['attributes']=_[_0x5497('0x2f')](_0x4af5f4[_0x5497('0x30')],qs[_0x5497('0x31')](_0x163a30['query'][_0x5497('0x31')]));_0x48b835[_0x5497('0x32')]=_0x48b835['attributes'][_0x5497('0x33')]?_0x48b835[_0x5497('0x32')]:_0x4af5f4[_0x5497('0x30')];if(!_0x163a30['query'][_0x5497('0x34')](_0x5497('0x35'))){_0x48b835[_0x5497('0x36')]=qs[_0x5497('0x36')](_0x163a30[_0x5497('0x2d')]['limit']);_0x48b835[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x163a30['query'][_0x5497('0x1c')]);}_0x48b835[_0x5497('0x37')]=qs[_0x5497('0x38')](_0x163a30[_0x5497('0x2d')][_0x5497('0x38')]);_0x48b835[_0x5497('0x39')]=qs['filters'](_[_0x5497('0x3a')](_0x163a30['query'],_0x4af5f4[_0x5497('0x3b')]),_0x583d06);if(_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]){_0x48b835['where']=_['merge'](_0x48b835[_0x5497('0x39')],{'$or':_[_0x5497('0x3d')](_0x583d06,function(_0x326d48){if(_0x326d48[_0x5497('0x2b')]!==_0x5497('0x3e')){var _0xc8a689={};_0xc8a689[_0x326d48['name']]={'$like':'%'+_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]+'%'};return _0xc8a689;}})});}_0x48b835=_[_0x5497('0x3f')]({},_0x48b835,_0x163a30[_0x5497('0x40')]);var _0x275aa7={'where':_0x48b835[_0x5497('0x39')]};return db[_0x5497('0x29')][_0x5497('0x1b')](_0x275aa7)[_0x5497('0x23')](function(_0x544065){_0x5406e2[_0x5497('0x1b')]=_0x544065;if(_0x163a30[_0x5497('0x2d')][_0x5497('0x41')]){_0x48b835[_0x5497('0x42')]=[{'all':!![]}];}return db[_0x5497('0x29')][_0x5497('0x43')](_0x48b835);})[_0x5497('0x23')](function(_0x59ed13){_0x5406e2[_0x5497('0x44')]=_0x59ed13;return _0x5406e2;})[_0x5497('0x23')](respondWithFilteredResult(_0x31cd01,_0x48b835))[_0x5497('0x45')](handleError(_0x31cd01,null));};exports[_0x5497('0x46')]=function(_0x1b251b,_0x125526){var _0x114471={'raw':!![],'where':{'id':_0x1b251b[_0x5497('0x47')]['id']}},_0x547437={};_0x547437[_0x5497('0x30')]=_[_0x5497('0x2e')](db[_0x5497('0x29')][_0x5497('0x48')]);_0x547437[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x1b251b[_0x5497('0x2d')]);_0x547437[_0x5497('0x3b')]=_[_0x5497('0x2f')](_0x547437['model'],_0x547437[_0x5497('0x2d')]);_0x114471['attributes']=_[_0x5497('0x2f')](_0x547437[_0x5497('0x30')],qs[_0x5497('0x31')](_0x1b251b[_0x5497('0x2d')][_0x5497('0x31')]));_0x114471['attributes']=_0x114471[_0x5497('0x32')][_0x5497('0x33')]?_0x114471['attributes']:_0x547437[_0x5497('0x30')];if(_0x1b251b['query'][_0x5497('0x41')]){_0x114471['include']=[{'all':!![]}];}_0x114471=_[_0x5497('0x3f')]({},_0x114471,_0x1b251b[_0x5497('0x40')]);return db[_0x5497('0x29')][_0x5497('0x49')](_0x114471)[_0x5497('0x23')](handleEntityNotFound(_0x125526,null))['then'](respondWithResult(_0x125526,null))['catch'](handleError(_0x125526,null));};exports['describe']=function(_0x55f654,_0x3cbe4b){return db[_0x5497('0x29')][_0x5497('0x4a')]()[_0x5497('0x23')](respondWithResult(_0x3cbe4b,null))[_0x5497('0x45')](handleError(_0x3cbe4b,null));};exports[_0x5497('0x22')]=function(_0xc78abe,_0x466287){if(_0xc78abe[_0x5497('0x4b')]['uniqueid']){delete _0xc78abe[_0x5497('0x4b')][_0x5497('0x4c')];}return db[_0x5497('0x29')]['find']({'where':{'uniqueid':_0xc78abe[_0x5497('0x47')]['id']}})['then'](handleEntityNotFound(_0x466287,null))[_0x5497('0x23')](saveUpdates(_0xc78abe[_0x5497('0x4b')],null))[_0x5497('0x23')](respondWithResult(_0x466287,null))['catch'](handleError(_0x466287,null));};exports[_0x5497('0x4d')]=function(_0x356d61,_0x515c3e,_0x3abc92){return db['CmHopperFinal'][_0x5497('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x356d61['params']['id']},'attributes':[[db[_0x5497('0x4e')]['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')](_0x5497('0x51')))),_0x5497('0x52')],[db[_0x5497('0x4e')]['fn']('COUNT',db[_0x5497('0x4e')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x53')))),_0x5497('0x54')],[db['sequelize']['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x5497('0x55')],[db['sequelize']['fn']('COUNT',db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x5497('0x4e')]['fn']('COUNT',db[_0x5497('0x4e')]['fn']('IF',db['sequelize'][_0x5497('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5497('0x56')],[db[_0x5497('0x4e')]['fn']('COUNT',db[_0x5497('0x4e')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x57')))),_0x5497('0x58')],[db['sequelize']['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')](_0x5497('0x59')))),_0x5497('0x5a')],[db['sequelize']['fn'](_0x5497('0x4f'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5497('0x5b')))),_0x5497('0x5c')]]})[_0x5497('0x23')](handleEntityNotFound(_0x515c3e,null))['then'](respondWithResult(_0x515c3e,null))[_0x5497('0x45')](handleError(_0x515c3e,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5f0243,_0x5a676d,_0x1d320a){return db[_0x5497('0x29')][_0x5497('0x43')]({'raw':![],'where':{'CampaignId':_0x5f0243[_0x5497('0x47')]['id']},'attributes':[[db[_0x5497('0x4e')]['fn']('COUNT',db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')](_0x5497('0x51')))),'noSuchContacts'],[db[_0x5497('0x4e')]['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')]['literal'](_0x5497('0x53')))),_0x5497('0x54')],[db[_0x5497('0x4e')]['fn']('COUNT',db[_0x5497('0x4e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x5497('0x55')],[db[_0x5497('0x4e')]['fn'](_0x5497('0x4f'),db['sequelize']['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')](_0x5497('0x5d')))),_0x5497('0x5e')],[db['sequelize']['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')]['literal'](_0x5497('0x5f')))),_0x5497('0x56')],[db[_0x5497('0x4e')]['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5497('0x58')],[db[_0x5497('0x4e')]['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x5497('0x5a')],[db[_0x5497('0x4e')]['fn'](_0x5497('0x4f'),db['sequelize']['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')](_0x5497('0x5b')))),_0x5497('0x5c')]]})[_0x5497('0x23')](handleEntityNotFound(_0x5a676d,null))[_0x5497('0x23')](respondWithResult(_0x5a676d,null))[_0x5497('0x45')](handleError(_0x5a676d,null));};exports[_0x5497('0x60')]=function(_0x21da3d,_0x940188,_0x1fc6ad){return db['VoiceQueue'][_0x5497('0x49')]({'where':{'id':_0x21da3d[_0x5497('0x47')]['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x940188,null))['then'](function(_0x5794ff){var _0x589008;if(_0x5794ff){_0x589008=squel[_0x5497('0x61')]()[_0x5497('0x62')]('cm_hopper')[_0x5497('0x63')]([_0x5497('0x64'),_0x5497('0x65'),_0x5497('0x66'),'ListId',_0x5497('0x67'),_0x5497('0x68'),_0x5497('0x69')],squel['select']()[_0x5497('0x6a')](_0x5497('0x6b'),'phone')[_0x5497('0x6a')](_0x5497('0x6c'),_0x5497('0x65'))['field']('ANY_VALUE(ContactId)',_0x5497('0x66'))[_0x5497('0x6a')](_0x5497('0x6d'),_0x5497('0x6e'))[_0x5497('0x6a')](_0x5497('0x6f'),_0x5497('0x67'))['field']('NOW()',_0x5497('0x68'))[_0x5497('0x6a')]('NOW()',_0x5497('0x69'))[_0x5497('0x70')](_0x5497('0x71'))['where'](_0x5497('0x72'),_0x21da3d[_0x5497('0x47')]['id']['toString']())[_0x5497('0x39')](_0x5497('0x73'),_0x21da3d[_0x5497('0x4b')][_0x5497('0x74')][_0x5497('0x75')]())['where'](_0x5497('0x76'))[_0x5497('0x39')](_0x5497('0x77'),squel[_0x5497('0x78')]()[_0x5497('0x6a')]('phone')[_0x5497('0x70')](_0x5497('0x79'))[_0x5497('0x39')](_0x5497('0x72'),_0x21da3d['params']['id'][_0x5497('0x75')]()))[_0x5497('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5497('0x78')]()[_0x5497('0x6a')](_0x5497('0x7a'))[_0x5497('0x70')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x21da3d['params']['id']['toString']())[_0x5497('0x39')](_0x5497('0x7b')))[_0x5497('0x7c')](_0x5497('0x66')))[_0x5497('0x75')]();return db['sequelize']['query'](_0x589008);}return[];})[_0x5497('0x23')](respondWithResult(_0x940188,null))[_0x5497('0x45')](handleError(_0x940188,null));};exports[_0x5497('0x7d')]=function(_0x2737a2,_0x307dc5,_0x4ec76d){return db[_0x5497('0x7e')][_0x5497('0x49')]({'where':{'id':_0x2737a2[_0x5497('0x47')]['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x307dc5,null))['then'](function(_0x1515f1){var _0x4118ec;if(_0x1515f1){_0x4118ec=squel[_0x5497('0x61')]()[_0x5497('0x62')](_0x5497('0x79'))[_0x5497('0x63')](['phone',_0x5497('0x65'),'ContactId',_0x5497('0x6e'),_0x5497('0x7f'),_0x5497('0x68'),'updatedAt'],squel['select']()[_0x5497('0x6a')](_0x5497('0x6b'),_0x5497('0x64'))[_0x5497('0x6a')](_0x5497('0x6c'),_0x5497('0x65'))[_0x5497('0x6a')](_0x5497('0x80'),'ContactId')['field']('ANY_VALUE(ListId)',_0x5497('0x6e'))[_0x5497('0x6a')](_0x5497('0x81'),_0x5497('0x7f'))['field']('NOW()',_0x5497('0x68'))[_0x5497('0x6a')]('NOW()',_0x5497('0x69'))[_0x5497('0x70')](_0x5497('0x71'))[_0x5497('0x39')]('CampaignId\x20=\x20?',_0x2737a2['params']['id']['toString']())['where']('state\x20=\x20?',_0x2737a2[_0x5497('0x4b')]['state'][_0x5497('0x75')]())['where'](_0x5497('0x76'))[_0x5497('0x39')](_0x5497('0x77'),squel[_0x5497('0x78')]()[_0x5497('0x6a')](_0x5497('0x64'))['from'](_0x5497('0x79'))['where'](_0x5497('0x82'),_0x2737a2[_0x5497('0x47')]['id'][_0x5497('0x75')]()))[_0x5497('0x39')](_0x5497('0x77'),squel[_0x5497('0x78')]()[_0x5497('0x6a')](_0x5497('0x7a'))[_0x5497('0x70')](_0x5497('0x71'))['where'](_0x5497('0x82'),_0x2737a2['params']['id'][_0x5497('0x75')]())[_0x5497('0x39')]('state\x20=\x204'))[_0x5497('0x7c')](_0x5497('0x66')))[_0x5497('0x75')]();return db[_0x5497('0x4e')][_0x5497('0x2d')](_0x4118ec);}return[];})[_0x5497('0x23')](respondWithResult(_0x307dc5,null))[_0x5497('0x45')](handleError(_0x307dc5,null));};exports[_0x5497('0x83')]=function(_0x456ea4,_0x188fc1,_0x208a62){return db[_0x5497('0x84')][_0x5497('0x85')]({'where':{'VoiceQueueId':_0x456ea4[_0x5497('0x4b')]['VoiceQueueId'],'CampaignId':_0x456ea4[_0x5497('0x4b')][_0x5497('0x7f')],'ContactId':_0x456ea4[_0x5497('0x4b')][_0x5497('0x66')]}})[_0x5497('0x23')](handleEntityNotFound(_0x188fc1,null))['then'](function(_0x3e8fce){if(_0x3e8fce){return _0x3e8fce;}return null;})[_0x5497('0x23')](respondWithResult(_0x188fc1,null))['catch'](handleError(_0x188fc1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index dbb2adb..2bb9d2f 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 _0x9bde=['uniqueid','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x4a75a7,_0x46953d){var _0x20e748=function(_0x3b2f5f){while(--_0x3b2f5f){_0x4a75a7['push'](_0x4a75a7['shift']());}};_0x20e748(++_0x46953d);}(_0x9bde,0xe1));var _0xe9bd=function(_0x7e034f,_0x52e8eb){_0x7e034f=_0x7e034f-0x0;var _0x1b5bf8=_0x9bde[_0x7e034f];return _0x1b5bf8;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[{'name':_0xe9bd('0xc'),'fields':[_0xe9bd('0xc')]},{'name':_0xe9bd('0xd'),'fields':[_0xe9bd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdecb=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0xdecb,0xe2));var _0xbdec=function(_0x50eb13,_0x1cf5cf){_0x50eb13=_0x50eb13-0x0;var _0xbf3841=_0xdecb[_0x50eb13];return _0xbf3841;};'use strict';var _=require('lodash');var util=require(_0xbdec('0x0'));var logger=require(_0xbdec('0x1'))(_0xbdec('0x2'));var moment=require('moment');var BPromise=require(_0xbdec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbdec('0x4'));var rimraf=require(_0xbdec('0x5'));var config=require(_0xbdec('0x6'));var attributes=require(_0xbdec('0x7'));module[_0xbdec('0x8')]=function(_0x26fef3,_0x13d9f8){return _0x26fef3['define'](_0xbdec('0x9'),attributes,{'tableName':_0xbdec('0xa'),'paranoid':![],'indexes':[{'name':_0xbdec('0xb'),'fields':[_0xbdec('0xb')]},{'name':_0xbdec('0xc'),'fields':[_0xbdec('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 f6cf53c..e5b67fe 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 _0x032b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopperFinal','body','options','raw','then','CreateCmHopperFinal','stringify','util','randomstring','../../mysqldb'];(function(_0x1a7486,_0x51abe8){var _0x533784=function(_0x1621fc){while(--_0x1621fc){_0x1a7486['push'](_0x1a7486['shift']());}};_0x533784(++_0x51abe8);}(_0x032b,0x183));var _0xb032=function(_0x4b6887,_0x96c4b7){_0x4b6887=_0x4b6887-0x0;var _0x2bf120=_0x032b[_0x4b6887];return _0x2bf120;};'use strict';var _=require('lodash');var util=require(_0xb032('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb032('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb032('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb032('0x3'))(_0xb032('0x4'));var config=require(_0xb032('0x5'));var jayson=require(_0xb032('0x6'));var client=jayson[_0xb032('0x7')][_0xb032('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ee374,_0x19d67a,_0x46fd62){return new BPromise(function(_0x345d4f,_0x3c41bf){return client['request'](_0x5ee374,_0x46fd62)['then'](function(_0x46593f){logger[_0xb032('0x9')](_0xb032('0xa'),_0x19d67a,_0xb032('0xb'));logger[_0xb032('0xc')](_0xb032('0xd'),_0x19d67a,_0xb032('0xb'),JSON['stringify'](_0x46593f));if(_0x46593f['error']){if(_0x46593f[_0xb032('0xe')][_0xb032('0xf')]===0x1f4){logger[_0xb032('0xe')](_0xb032('0xa'),_0x19d67a,_0x46593f[_0xb032('0xe')]['message']);return _0x3c41bf(_0x46593f['error'][_0xb032('0x10')]);}logger[_0xb032('0xe')](_0xb032('0xa'),_0x19d67a,_0x46593f['error'][_0xb032('0x10')]);return _0x345d4f(_0x46593f[_0xb032('0xe')][_0xb032('0x10')]);}else{logger[_0xb032('0x9')](_0xb032('0xa'),_0x19d67a,_0xb032('0xb'));_0x345d4f(_0x46593f[_0xb032('0x11')][_0xb032('0x10')]);}})[_0xb032('0x12')](function(_0x394238){logger[_0xb032('0xe')](_0xb032('0xa'),_0x19d67a,_0x394238);_0x3c41bf(_0x394238);});});}exports['CreateCmHopperFinal']=function(_0x456cec){var _0x1a31e7=this;return new Promise(function(_0x5eaa19,_0x45685c){return db[_0xb032('0x13')]['create'](_0x456cec[_0xb032('0x14')],{'raw':_0x456cec[_0xb032('0x15')]?_0x456cec[_0xb032('0x15')][_0xb032('0x16')]===undefined?!![]:![]:!![]})[_0xb032('0x17')](function(_0xfcb15a){logger[_0xb032('0x9')](_0xb032('0x18'),_0x456cec);logger['debug'](_0xb032('0x18'),_0x456cec,JSON[_0xb032('0x19')](_0xfcb15a));_0x5eaa19(_0xfcb15a);})[_0xb032('0x12')](function(_0x32be95){logger[_0xb032('0xe')]('CreateCmHopperFinal',_0x32be95['message'],_0x456cec);_0x45685c(_0x1a31e7[_0xb032('0xe')](0x1f4,_0x32be95['message']));});});}; \ No newline at end of file +var _0x42ff=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmHopperFinal,\x20%s,\x20%s','message','result','CreateCmHopperFinal','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5839d3,_0xe54d19){var _0x2367a1=function(_0x1e8292){while(--_0x1e8292){_0x5839d3['push'](_0x5839d3['shift']());}};_0x2367a1(++_0xe54d19);}(_0x42ff,0xa8));var _0xf42f=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x42ff[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xf42f('0x0'));var util=require(_0xf42f('0x1'));var moment=require(_0xf42f('0x2'));var BPromise=require(_0xf42f('0x3'));var rs=require(_0xf42f('0x4'));var fs=require('fs');var Redis=require(_0xf42f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf42f('0x6'));var logger=require(_0xf42f('0x7'))('rpc');var config=require(_0xf42f('0x8'));var jayson=require(_0xf42f('0x9'));var client=jayson[_0xf42f('0xa')][_0xf42f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2da6b6,_0x475fc8,_0x3ce2db){return new BPromise(function(_0x144a3c,_0x2272ef){return client[_0xf42f('0xc')](_0x2da6b6,_0x3ce2db)[_0xf42f('0xd')](function(_0x3c8c72){logger[_0xf42f('0xe')]('CmHopperFinal,\x20%s,\x20%s',_0x475fc8,_0xf42f('0xf'));logger[_0xf42f('0x10')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x475fc8,_0xf42f('0xf'),JSON[_0xf42f('0x11')](_0x3c8c72));if(_0x3c8c72['error']){if(_0x3c8c72[_0xf42f('0x12')][_0xf42f('0x13')]===0x1f4){logger[_0xf42f('0x12')](_0xf42f('0x14'),_0x475fc8,_0x3c8c72[_0xf42f('0x12')][_0xf42f('0x15')]);return _0x2272ef(_0x3c8c72[_0xf42f('0x12')][_0xf42f('0x15')]);}logger[_0xf42f('0x12')](_0xf42f('0x14'),_0x475fc8,_0x3c8c72[_0xf42f('0x12')][_0xf42f('0x15')]);return _0x144a3c(_0x3c8c72[_0xf42f('0x12')]['message']);}else{logger[_0xf42f('0xe')](_0xf42f('0x14'),_0x475fc8,_0xf42f('0xf'));_0x144a3c(_0x3c8c72[_0xf42f('0x16')][_0xf42f('0x15')]);}})['catch'](function(_0x13d2c9){logger[_0xf42f('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x475fc8,_0x13d2c9);_0x2272ef(_0x13d2c9);});});}exports[_0xf42f('0x17')]=function(_0x2bb276){var _0x11bb8a=this;return new Promise(function(_0x2a9daa,_0x41a0b4){return db['CmHopperFinal'][_0xf42f('0x18')](_0x2bb276[_0xf42f('0x19')],{'raw':_0x2bb276[_0xf42f('0x1a')]?_0x2bb276[_0xf42f('0x1a')][_0xf42f('0x1b')]===undefined?!![]:![]:!![]})[_0xf42f('0xd')](function(_0x1d809b){logger[_0xf42f('0xe')](_0xf42f('0x17'),_0x2bb276);logger[_0xf42f('0x10')](_0xf42f('0x17'),_0x2bb276,JSON[_0xf42f('0x11')](_0x1d809b));_0x2a9daa(_0x1d809b);})[_0xf42f('0x1c')](function(_0x3a003a){logger[_0xf42f('0x12')](_0xf42f('0x17'),_0x3a003a[_0xf42f('0x15')],_0x2bb276);_0x41a0b4(_0x11bb8a['error'](0x1f4,_0x3a003a[_0xf42f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index c09b2b7..2ebc2e2 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 _0x6f75=['../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/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','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x57d27c,_0x19ecb6){var _0xd09f9a=function(_0x2e2d94){while(--_0x2e2d94){_0x57d27c['push'](_0x57d27c['shift']());}};_0xd09f9a(++_0x19ecb6);}(_0x6f75,0x180));var _0x56f7=function(_0xcb0a94,_0x2af520){_0xcb0a94=_0xcb0a94-0x0;var _0x47a1f7=_0x6f75[_0xcb0a94];return _0x47a1f7;};'use strict';var multer=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var path=require(_0x56f7('0x2'));var timeout=require(_0x56f7('0x3'));var express=require(_0x56f7('0x4'));var router=express['Router']();var auth=require(_0x56f7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x56f7('0x6'));var controller=require(_0x56f7('0x7'));router[_0x56f7('0x8')]('/',auth[_0x56f7('0x9')](),controller[_0x56f7('0xa')]);router[_0x56f7('0x8')](_0x56f7('0xb'),auth[_0x56f7('0x9')](),controller['describe']);router[_0x56f7('0x8')](_0x56f7('0xc'),auth[_0x56f7('0x9')](),controller['show']);router['get'](_0x56f7('0xd'),auth['isAuthenticated'](),controller[_0x56f7('0xe')]);router[_0x56f7('0x8')](_0x56f7('0xf'),auth[_0x56f7('0x9')](),controller[_0x56f7('0x10')]);router[_0x56f7('0x11')](_0x56f7('0x12'),auth[_0x56f7('0x9')](),controller[_0x56f7('0x13')]);router['post'](_0x56f7('0x14'),auth['isAuthenticated'](),controller[_0x56f7('0x15')]);router[_0x56f7('0x11')](_0x56f7('0x16'),auth[_0x56f7('0x9')](),controller[_0x56f7('0x17')]);router[_0x56f7('0x18')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x56f7('0x19')]=router; \ No newline at end of file +var _0x91c7=['/describe','describe','get','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','checkContactHopper','update','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x2c41ea,_0x4ca7d5){var _0x189eef=function(_0x5785f8){while(--_0x5785f8){_0x2c41ea['push'](_0x2c41ea['shift']());}};_0x189eef(++_0x4ca7d5);}(_0x91c7,0x8c));var _0x791c=function(_0x4ffafb,_0x20171a){_0x4ffafb=_0x4ffafb-0x0;var _0x4ab472=_0x91c7[_0x4ffafb];return _0x4ab472;};'use strict';var multer=require(_0x791c('0x0'));var util=require(_0x791c('0x1'));var path=require(_0x791c('0x2'));var timeout=require(_0x791c('0x3'));var express=require(_0x791c('0x4'));var router=express[_0x791c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x791c('0x6'));var config=require(_0x791c('0x7'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x791c('0x8')](),controller[_0x791c('0x9')]);router['get'](_0x791c('0xa'),auth[_0x791c('0x8')](),controller[_0x791c('0xb')]);router[_0x791c('0xc')](_0x791c('0xd'),auth[_0x791c('0x8')](),controller[_0x791c('0xe')]);router['get'](_0x791c('0xf'),auth['isAuthenticated'](),controller[_0x791c('0x10')]);router[_0x791c('0xc')](_0x791c('0x11'),auth[_0x791c('0x8')](),controller[_0x791c('0x12')]);router[_0x791c('0x13')](_0x791c('0x14'),auth[_0x791c('0x8')](),controller[_0x791c('0x15')]);router[_0x791c('0x13')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0x791c('0x16')]);router[_0x791c('0x13')]('/checkContactHopper',auth[_0x791c('0x8')](),controller[_0x791c('0x17')]);router['put'](_0x791c('0xd'),auth[_0x791c('0x8')](),controller[_0x791c('0x18')]);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 053a9ec..b687e32 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 _0xe2bc=['INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x1648a6,_0x38e0f3){var _0x161a07=function(_0x44f7ac){while(--_0x44f7ac){_0x1648a6['push'](_0x1648a6['shift']());}};_0x161a07(++_0x38e0f3);}(_0xe2bc,0xf9));var _0xce2b=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xe2bc[_0xe73080];return _0x12cbc4;};'use strict';var Sequelize=require(_0xce2b('0x0'));module['exports']={'state':{'type':Sequelize[_0xce2b('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xce2b('0x2')]},'countbusyretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xce2b('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xce2b('0x3')]},'calleridname':{'type':Sequelize[_0xce2b('0x3')]},'starttime':{'type':Sequelize[_0xce2b('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xce2b('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xce2b('0x2')]},'ringtime':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xce2b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xce2b('0x3')]},'reason':{'type':Sequelize[_0xce2b('0x3')]},'amd':{'type':Sequelize[_0xce2b('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xce2b('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xce2b('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xce2b('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xce2b('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xce2b('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xce2b('0x3')]}}; \ No newline at end of file +var _0x255b=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x4eaa77,_0x371433){var _0x380200=function(_0x2dc489){while(--_0x2dc489){_0x4eaa77['push'](_0x4eaa77['shift']());}};_0x380200(++_0x371433);}(_0x255b,0x17d));var _0xb255=function(_0x5738c4,_0xbfdf99){_0x5738c4=_0x5738c4-0x0;var _0x15830b=_0x255b[_0x5738c4];return _0x15830b;};'use strict';var Sequelize=require(_0xb255('0x0'));module[_0xb255('0x1')]={'state':{'type':Sequelize[_0xb255('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb255('0x3')]},'scheduledat':{'type':Sequelize[_0xb255('0x4')]},'countbusyretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb255('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb255('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb255('0x4')]},'responsetime':{'type':Sequelize[_0xb255('0x4')]},'answertime':{'type':Sequelize[_0xb255('0x4')]},'droptime':{'type':Sequelize[_0xb255('0x4')]},'endtime':{'type':Sequelize[_0xb255('0x4')]},'ringtime':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb255('0x3')]},'campaigntype':{'type':Sequelize[_0xb255('0x3')]},'membername':{'type':Sequelize[_0xb255('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xb255('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb255('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb255('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb255('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb255('0x4')]},'recallme':{'type':Sequelize[_0xb255('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb255('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb255('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 792983f..620b691 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 _0x2f87=['includeAll','rows','catch','show','params','include','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','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','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','options'];(function(_0x245dbe,_0x3e0831){var _0x597415=function(_0x50dfdd){while(--_0x50dfdd){_0x245dbe['push'](_0x245dbe['shift']());}};_0x597415(++_0x3e0831);}(_0x2f87,0xf5));var _0x72f8=function(_0x419fe3,_0x3fec64){_0x419fe3=_0x419fe3-0x0;var _0x49b3c8=_0x2f87[_0x419fe3];return _0x49b3c8;};'use strict';var pdf=require(_0x72f8('0x0'));var emlformat=require(_0x72f8('0x1'));var rimraf=require(_0x72f8('0x2'));var zipdir=require(_0x72f8('0x3'));var jsonpatch=require(_0x72f8('0x4'));var rp=require(_0x72f8('0x5'));var moment=require(_0x72f8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x72f8('0x7'));var util=require('util');var path=require(_0x72f8('0x8'));var sox=require(_0x72f8('0x9'));var csv=require(_0x72f8('0xa'));var ejs=require(_0x72f8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x72f8('0xc'));var crypto=require(_0x72f8('0xd'));var jsforce=require(_0x72f8('0xe'));var deskjs=require(_0x72f8('0xf'));var toCsv=require(_0x72f8('0xa'));var querystring=require(_0x72f8('0x10'));var Papa=require(_0x72f8('0x11'));var Redis=require(_0x72f8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x72f8('0x13'));var as=require(_0x72f8('0x14'));var hardwareService=require(_0x72f8('0x15'));var logger=require(_0x72f8('0x16'))(_0x72f8('0x17'));var utils=require(_0x72f8('0x18'));var config=require(_0x72f8('0x19'));var db=require(_0x72f8('0x1a'))['db'];function respondWithStatusCode(_0xfa9d1a,_0x37265f){_0x37265f=_0x37265f||0xcc;return function(_0x370b32){if(_0x370b32){return _0xfa9d1a[_0x72f8('0x1b')](_0x37265f);}return _0xfa9d1a[_0x72f8('0x1c')](_0x37265f)['end']();};}function respondWithResult(_0x138ecd,_0x5ea1a4){_0x5ea1a4=_0x5ea1a4||0xc8;return function(_0x102410){if(_0x102410){return _0x138ecd[_0x72f8('0x1c')](_0x5ea1a4)[_0x72f8('0x1d')](_0x102410);}};}function respondWithFilteredResult(_0x43d2e0,_0x279d57){return function(_0x8c4ad9){if(_0x8c4ad9){var _0xd0f601=_0x8c4ad9[_0x72f8('0x1e')],_0x43daaf=_0x279d57['offset'],_0x1f824f=_0x279d57[_0x72f8('0x1f')]+_0x279d57[_0x72f8('0x20')],_0x4ef15a;if(_0x1f824f>=_0xd0f601){_0x1f824f=_0xd0f601;_0x4ef15a=0xc8;}else{_0x4ef15a=0xce;}_0x43d2e0[_0x72f8('0x1c')](_0x4ef15a);return _0x43d2e0['set'](_0x72f8('0x21'),_0x43daaf+'-'+_0x1f824f+'/'+_0xd0f601)[_0x72f8('0x1d')](_0x8c4ad9);}return null;};}function patchUpdates(_0x196d79){return function(_0x419f18){try{jsonpatch[_0x72f8('0x22')](_0x419f18,_0x196d79,!![]);}catch(_0x50b92e){return BPromise[_0x72f8('0x23')](_0x50b92e);}return _0x419f18[_0x72f8('0x24')]();};}function saveUpdates(_0x56656a,_0x13b224){return function(_0x43ac0d){if(_0x43ac0d){return _0x43ac0d[_0x72f8('0x25')](_0x56656a)[_0x72f8('0x26')](function(_0x5687aa){return _0x5687aa;});}return null;};}function removeEntity(_0x18a9c1,_0x1f9014){return function(_0xba8213){if(_0xba8213){return _0xba8213[_0x72f8('0x27')]()[_0x72f8('0x26')](function(){_0x18a9c1[_0x72f8('0x1c')](0xcc)[_0x72f8('0x28')]();});}};}function handleEntityNotFound(_0x332419,_0xb9b3a5){return function(_0x33e69a){if(!_0x33e69a){_0x332419[_0x72f8('0x1b')](0x194);}return _0x33e69a;};}function handleError(_0x345dd5,_0x4c0aa6){_0x4c0aa6=_0x4c0aa6||0x1f4;return function(_0x4a86a9){logger[_0x72f8('0x29')](_0x4a86a9[_0x72f8('0x2a')]);if(_0x4a86a9[_0x72f8('0x2b')]){delete _0x4a86a9[_0x72f8('0x2b')];}_0x345dd5[_0x72f8('0x1c')](_0x4c0aa6)[_0x72f8('0x2c')](_0x4a86a9);};}exports[_0x72f8('0x2d')]=function(_0x1a9224,_0xee4f2b){var _0x347312={},_0xa1856b={},_0x49b174={'count':0x0,'rows':[]};var _0x2e0d60=_[_0x72f8('0x2e')](db[_0x72f8('0x2f')][_0x72f8('0x30')],function(_0x6f6043){return{'name':_0x6f6043[_0x72f8('0x31')],'type':_0x6f6043[_0x72f8('0x32')][_0x72f8('0x33')]};});_0xa1856b[_0x72f8('0x34')]=_[_0x72f8('0x2e')](_0x2e0d60,_0x72f8('0x2b'));_0xa1856b[_0x72f8('0x35')]=_[_0x72f8('0x36')](_0x1a9224[_0x72f8('0x35')]);_0xa1856b[_0x72f8('0x37')]=_['intersection'](_0xa1856b[_0x72f8('0x34')],_0xa1856b[_0x72f8('0x35')]);_0x347312[_0x72f8('0x38')]=_[_0x72f8('0x39')](_0xa1856b[_0x72f8('0x34')],qs[_0x72f8('0x3a')](_0x1a9224[_0x72f8('0x35')][_0x72f8('0x3a')]));_0x347312['attributes']=_0x347312[_0x72f8('0x38')][_0x72f8('0x3b')]?_0x347312[_0x72f8('0x38')]:_0xa1856b['model'];if(!_0x1a9224['query']['hasOwnProperty'](_0x72f8('0x3c'))){_0x347312['limit']=qs[_0x72f8('0x20')](_0x1a9224[_0x72f8('0x35')][_0x72f8('0x20')]);_0x347312['offset']=qs[_0x72f8('0x1f')](_0x1a9224[_0x72f8('0x35')]['offset']);}_0x347312[_0x72f8('0x3d')]=qs[_0x72f8('0x3e')](_0x1a9224['query'][_0x72f8('0x3e')]);_0x347312[_0x72f8('0x3f')]=qs['filters'](_['pick'](_0x1a9224['query'],_0xa1856b['filters']),_0x2e0d60);if(_0x1a9224['query'][_0x72f8('0x40')]){_0x347312[_0x72f8('0x3f')]=_[_0x72f8('0x41')](_0x347312[_0x72f8('0x3f')],{'$or':_[_0x72f8('0x2e')](_0x2e0d60,function(_0x24f0a8){if(_0x24f0a8[_0x72f8('0x32')]!=='VIRTUAL'){var _0x30a34a={};_0x30a34a[_0x24f0a8['name']]={'$like':'%'+_0x1a9224[_0x72f8('0x35')][_0x72f8('0x40')]+'%'};return _0x30a34a;}})});}_0x347312=_['merge']({},_0x347312,_0x1a9224[_0x72f8('0x42')]);var _0x288419={'where':_0x347312[_0x72f8('0x3f')]};return db[_0x72f8('0x2f')][_0x72f8('0x1e')](_0x288419)[_0x72f8('0x26')](function(_0x45d0d7){_0x49b174['count']=_0x45d0d7;if(_0x1a9224[_0x72f8('0x35')][_0x72f8('0x43')]){_0x347312['include']=[{'all':!![]}];}return db[_0x72f8('0x2f')]['findAll'](_0x347312);})[_0x72f8('0x26')](function(_0x5c0989){_0x49b174[_0x72f8('0x44')]=_0x5c0989;return _0x49b174;})['then'](respondWithFilteredResult(_0xee4f2b,_0x347312))[_0x72f8('0x45')](handleError(_0xee4f2b,null));};exports[_0x72f8('0x46')]=function(_0x57980b,_0x55ecdb){var _0x221b77={'raw':!![],'where':{'id':_0x57980b[_0x72f8('0x47')]['id']}},_0x3ca8d9={};_0x3ca8d9['model']=_[_0x72f8('0x36')](db[_0x72f8('0x2f')][_0x72f8('0x30')]);_0x3ca8d9[_0x72f8('0x35')]=_[_0x72f8('0x36')](_0x57980b[_0x72f8('0x35')]);_0x3ca8d9[_0x72f8('0x37')]=_['intersection'](_0x3ca8d9['model'],_0x3ca8d9[_0x72f8('0x35')]);_0x221b77[_0x72f8('0x38')]=_[_0x72f8('0x39')](_0x3ca8d9[_0x72f8('0x34')],qs[_0x72f8('0x3a')](_0x57980b[_0x72f8('0x35')][_0x72f8('0x3a')]));_0x221b77[_0x72f8('0x38')]=_0x221b77['attributes'][_0x72f8('0x3b')]?_0x221b77['attributes']:_0x3ca8d9[_0x72f8('0x34')];if(_0x57980b['query'][_0x72f8('0x43')]){_0x221b77[_0x72f8('0x48')]=[{'all':!![]}];}_0x221b77=_[_0x72f8('0x41')]({},_0x221b77,_0x57980b['options']);return db[_0x72f8('0x2f')][_0x72f8('0x49')](_0x221b77)[_0x72f8('0x26')](handleEntityNotFound(_0x55ecdb,null))[_0x72f8('0x26')](respondWithResult(_0x55ecdb,null))[_0x72f8('0x45')](handleError(_0x55ecdb,null));};exports[_0x72f8('0x4a')]=function(_0xdacb94,_0x1533f4){return db[_0x72f8('0x2f')][_0x72f8('0x4a')](_0xdacb94[_0x72f8('0x4b')],{})['then'](respondWithResult(_0x1533f4,0xc9))[_0x72f8('0x45')](handleError(_0x1533f4,null));};exports[_0x72f8('0x4c')]=function(_0x4f9bea,_0x409879){return db['CmHopperHistory'][_0x72f8('0x4c')]()['then'](respondWithResult(_0x409879,null))[_0x72f8('0x45')](handleError(_0x409879,null));};exports['update']=function(_0x4a9730,_0x552476){if(_0x4a9730[_0x72f8('0x4b')]['uniqueid']){delete _0x4a9730['body'][_0x72f8('0x4d')];}return db[_0x72f8('0x2f')]['find']({'where':{'uniqueid':_0x4a9730[_0x72f8('0x47')]['id']}})[_0x72f8('0x26')](handleEntityNotFound(_0x552476,null))[_0x72f8('0x26')](saveUpdates(_0x4a9730[_0x72f8('0x4b')],null))[_0x72f8('0x26')](respondWithResult(_0x552476,null))['catch'](handleError(_0x552476,null));}; \ No newline at end of file +var _0x5640=['query','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','uniqueid','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model'];(function(_0x2b60bd,_0x49418d){var _0x3d9523=function(_0x460f6b){while(--_0x460f6b){_0x2b60bd['push'](_0x2b60bd['shift']());}};_0x3d9523(++_0x49418d);}(_0x5640,0x159));var _0x0564=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5640[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x0564('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0564('0x1'));var zipdir=require(_0x0564('0x2'));var jsonpatch=require(_0x0564('0x3'));var rp=require('request-promise');var moment=require(_0x0564('0x4'));var BPromise=require(_0x0564('0x5'));var Mustache=require(_0x0564('0x6'));var util=require(_0x0564('0x7'));var path=require(_0x0564('0x8'));var sox=require(_0x0564('0x9'));var csv=require(_0x0564('0xa'));var ejs=require(_0x0564('0xb'));var fs=require('fs');var _=require(_0x0564('0xc'));var squel=require(_0x0564('0xd'));var crypto=require(_0x0564('0xe'));var jsforce=require(_0x0564('0xf'));var deskjs=require(_0x0564('0x10'));var toCsv=require(_0x0564('0xa'));var querystring=require(_0x0564('0x11'));var Papa=require(_0x0564('0x12'));var Redis=require(_0x0564('0x13'));var authService=require(_0x0564('0x14'));var qs=require(_0x0564('0x15'));var as=require(_0x0564('0x16'));var hardwareService=require(_0x0564('0x17'));var logger=require(_0x0564('0x18'))(_0x0564('0x19'));var utils=require(_0x0564('0x1a'));var config=require(_0x0564('0x1b'));var db=require(_0x0564('0x1c'))['db'];function respondWithStatusCode(_0x4dd282,_0x177659){_0x177659=_0x177659||0xcc;return function(_0x3191b6){if(_0x3191b6){return _0x4dd282['sendStatus'](_0x177659);}return _0x4dd282[_0x0564('0x1d')](_0x177659)[_0x0564('0x1e')]();};}function respondWithResult(_0x165045,_0x12c654){_0x12c654=_0x12c654||0xc8;return function(_0x3b9951){if(_0x3b9951){return _0x165045[_0x0564('0x1d')](_0x12c654)[_0x0564('0x1f')](_0x3b9951);}};}function respondWithFilteredResult(_0x57d0ff,_0x18d3e4){return function(_0x1b82a3){if(_0x1b82a3){var _0x17e221=_0x1b82a3[_0x0564('0x20')],_0x5396bd=_0x18d3e4[_0x0564('0x21')],_0x2db79a=_0x18d3e4[_0x0564('0x21')]+_0x18d3e4[_0x0564('0x22')],_0x1f09d8;if(_0x2db79a>=_0x17e221){_0x2db79a=_0x17e221;_0x1f09d8=0xc8;}else{_0x1f09d8=0xce;}_0x57d0ff[_0x0564('0x1d')](_0x1f09d8);return _0x57d0ff[_0x0564('0x23')](_0x0564('0x24'),_0x5396bd+'-'+_0x2db79a+'/'+_0x17e221)[_0x0564('0x1f')](_0x1b82a3);}return null;};}function patchUpdates(_0x5172bc){return function(_0x27555e){try{jsonpatch[_0x0564('0x25')](_0x27555e,_0x5172bc,!![]);}catch(_0xbddb2d){return BPromise[_0x0564('0x26')](_0xbddb2d);}return _0x27555e['save']();};}function saveUpdates(_0x42aa97,_0x58b0fd){return function(_0x4bef5b){if(_0x4bef5b){return _0x4bef5b[_0x0564('0x27')](_0x42aa97)[_0x0564('0x28')](function(_0x5aa162){return _0x5aa162;});}return null;};}function removeEntity(_0x5fbc5,_0x44a7e8){return function(_0x58a24d){if(_0x58a24d){return _0x58a24d[_0x0564('0x29')]()['then'](function(){_0x5fbc5[_0x0564('0x1d')](0xcc)[_0x0564('0x1e')]();});}};}function handleEntityNotFound(_0x254e12,_0x38caa3){return function(_0x20ac63){if(!_0x20ac63){_0x254e12[_0x0564('0x2a')](0x194);}return _0x20ac63;};}function handleError(_0x2886ec,_0x5a0710){_0x5a0710=_0x5a0710||0x1f4;return function(_0x2c2189){logger[_0x0564('0x2b')](_0x2c2189[_0x0564('0x2c')]);if(_0x2c2189[_0x0564('0x2d')]){delete _0x2c2189[_0x0564('0x2d')];}_0x2886ec[_0x0564('0x1d')](_0x5a0710)[_0x0564('0x2e')](_0x2c2189);};}exports[_0x0564('0x2f')]=function(_0x32e59c,_0x56949a){var _0x5a770e={},_0xc420e6={},_0x40da58={'count':0x0,'rows':[]};var _0x1c2620=_[_0x0564('0x30')](db[_0x0564('0x31')][_0x0564('0x32')],function(_0x2bc56f){return{'name':_0x2bc56f[_0x0564('0x33')],'type':_0x2bc56f[_0x0564('0x34')][_0x0564('0x35')]};});_0xc420e6[_0x0564('0x36')]=_['map'](_0x1c2620,'name');_0xc420e6[_0x0564('0x37')]=_['keys'](_0x32e59c['query']);_0xc420e6[_0x0564('0x38')]=_[_0x0564('0x39')](_0xc420e6['model'],_0xc420e6[_0x0564('0x37')]);_0x5a770e['attributes']=_[_0x0564('0x39')](_0xc420e6[_0x0564('0x36')],qs[_0x0564('0x3a')](_0x32e59c['query']['fields']));_0x5a770e['attributes']=_0x5a770e[_0x0564('0x3b')][_0x0564('0x3c')]?_0x5a770e['attributes']:_0xc420e6[_0x0564('0x36')];if(!_0x32e59c[_0x0564('0x37')]['hasOwnProperty']('nolimit')){_0x5a770e[_0x0564('0x22')]=qs['limit'](_0x32e59c[_0x0564('0x37')][_0x0564('0x22')]);_0x5a770e['offset']=qs[_0x0564('0x21')](_0x32e59c[_0x0564('0x37')][_0x0564('0x21')]);}_0x5a770e[_0x0564('0x3d')]=qs[_0x0564('0x3e')](_0x32e59c[_0x0564('0x37')][_0x0564('0x3e')]);_0x5a770e[_0x0564('0x3f')]=qs[_0x0564('0x38')](_['pick'](_0x32e59c[_0x0564('0x37')],_0xc420e6[_0x0564('0x38')]),_0x1c2620);if(_0x32e59c[_0x0564('0x37')][_0x0564('0x40')]){_0x5a770e[_0x0564('0x3f')]=_[_0x0564('0x41')](_0x5a770e[_0x0564('0x3f')],{'$or':_['map'](_0x1c2620,function(_0x277441){if(_0x277441[_0x0564('0x34')]!==_0x0564('0x42')){var _0x4e9a18={};_0x4e9a18[_0x277441[_0x0564('0x2d')]]={'$like':'%'+_0x32e59c[_0x0564('0x37')][_0x0564('0x40')]+'%'};return _0x4e9a18;}})});}_0x5a770e=_[_0x0564('0x41')]({},_0x5a770e,_0x32e59c[_0x0564('0x43')]);var _0xc5c263={'where':_0x5a770e[_0x0564('0x3f')]};return db['CmHopperHistory'][_0x0564('0x20')](_0xc5c263)['then'](function(_0x2b0fe5){_0x40da58['count']=_0x2b0fe5;if(_0x32e59c[_0x0564('0x37')][_0x0564('0x44')]){_0x5a770e[_0x0564('0x45')]=[{'all':!![]}];}return db[_0x0564('0x31')][_0x0564('0x46')](_0x5a770e);})[_0x0564('0x28')](function(_0x2314a2){_0x40da58[_0x0564('0x47')]=_0x2314a2;return _0x40da58;})[_0x0564('0x28')](respondWithFilteredResult(_0x56949a,_0x5a770e))[_0x0564('0x48')](handleError(_0x56949a,null));};exports[_0x0564('0x49')]=function(_0x15e544,_0x538237){var _0x31252a={'raw':!![],'where':{'id':_0x15e544[_0x0564('0x4a')]['id']}},_0x1e8437={};_0x1e8437[_0x0564('0x36')]=_[_0x0564('0x4b')](db['CmHopperHistory'][_0x0564('0x32')]);_0x1e8437[_0x0564('0x37')]=_[_0x0564('0x4b')](_0x15e544[_0x0564('0x37')]);_0x1e8437[_0x0564('0x38')]=_[_0x0564('0x39')](_0x1e8437[_0x0564('0x36')],_0x1e8437[_0x0564('0x37')]);_0x31252a[_0x0564('0x3b')]=_[_0x0564('0x39')](_0x1e8437[_0x0564('0x36')],qs[_0x0564('0x3a')](_0x15e544[_0x0564('0x37')][_0x0564('0x3a')]));_0x31252a[_0x0564('0x3b')]=_0x31252a[_0x0564('0x3b')]['length']?_0x31252a[_0x0564('0x3b')]:_0x1e8437[_0x0564('0x36')];if(_0x15e544[_0x0564('0x37')][_0x0564('0x44')]){_0x31252a['include']=[{'all':!![]}];}_0x31252a=_[_0x0564('0x41')]({},_0x31252a,_0x15e544[_0x0564('0x43')]);return db[_0x0564('0x31')]['find'](_0x31252a)[_0x0564('0x28')](handleEntityNotFound(_0x538237,null))['then'](respondWithResult(_0x538237,null))[_0x0564('0x48')](handleError(_0x538237,null));};exports[_0x0564('0x4c')]=function(_0x528925,_0xafc4f6){return db[_0x0564('0x31')][_0x0564('0x4c')](_0x528925[_0x0564('0x4d')],{})['then'](respondWithResult(_0xafc4f6,0xc9))[_0x0564('0x48')](handleError(_0xafc4f6,null));};exports['describe']=function(_0x89ccd7,_0x6aac3e){return db['CmHopperHistory']['describe']()[_0x0564('0x28')](respondWithResult(_0x6aac3e,null))[_0x0564('0x48')](handleError(_0x6aac3e,null));};exports['update']=function(_0x49ad55,_0x5ef270){if(_0x49ad55[_0x0564('0x4d')]['uniqueid']){delete _0x49ad55[_0x0564('0x4d')][_0x0564('0x4e')];}return db[_0x0564('0x31')][_0x0564('0x4f')]({'where':{'uniqueid':_0x49ad55[_0x0564('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ef270,null))[_0x0564('0x28')](saveUpdates(_0x49ad55[_0x0564('0x4d')],null))['then'](respondWithResult(_0x5ef270,null))[_0x0564('0x48')](handleError(_0x5ef270,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 5275353..6e8f870 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 _0x607f=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','endtime','uniqueid'];(function(_0x3b912a,_0x210f61){var _0x13113b=function(_0x5a6c86){while(--_0x5a6c86){_0x3b912a['push'](_0x3b912a['shift']());}};_0x13113b(++_0x210f61);}(_0x607f,0x1e1));var _0xf607=function(_0x228b7b,_0x22258e){_0x228b7b=_0x228b7b-0x0;var _0x140f5a=_0x607f[_0x228b7b];return _0x140f5a;};'use strict';var _=require(_0xf607('0x0'));var util=require(_0xf607('0x1'));var logger=require(_0xf607('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf607('0x3'));var rp=require(_0xf607('0x4'));var fs=require('fs');var path=require(_0xf607('0x5'));var rimraf=require(_0xf607('0x6'));var config=require(_0xf607('0x7'));var attributes=require(_0xf607('0x8'));module[_0xf607('0x9')]=function(_0x1e07c2,_0x1ed23e){return _0x1e07c2[_0xf607('0xa')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xf607('0xb'),'fields':[_0xf607('0xb')]},{'name':_0xf607('0xc'),'fields':[_0xf607('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1aa=['lodash','../../config/logger','api','moment','request-promise','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb1aa,0x1bc));var _0xab1a=function(_0x392288,_0x54ee4f){_0x392288=_0x392288-0x0;var _0x3e1eb9=_0xb1aa[_0x392288];return _0x3e1eb9;};'use strict';var _=require(_0xab1a('0x0'));var util=require('util');var logger=require(_0xab1a('0x1'))(_0xab1a('0x2'));var moment=require(_0xab1a('0x3'));var BPromise=require('bluebird');var rp=require(_0xab1a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xab1a('0x5'));var attributes=require(_0xab1a('0x6'));module[_0xab1a('0x7')]=function(_0x2162c0,_0xcfd981){return _0x2162c0['define'](_0xab1a('0x8'),attributes,{'tableName':_0xab1a('0x9'),'paranoid':![],'indexes':[{'name':_0xab1a('0xa'),'fields':['endtime']},{'name':_0xab1a('0xb'),'fields':[_0xab1a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index af9a3b1..0592727 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 _0xe5b5=['outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','findAll','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','AvgHandleTime','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null'];(function(_0x7954c7,_0x3ce522){var _0x22b1c4=function(_0x27d76b){while(--_0x27d76b){_0x7954c7['push'](_0x7954c7['shift']());}};_0x22b1c4(++_0x3ce522);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0xe5b5[_0x3df223];return _0x562d11;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});}exports[_0x5e5b('0x19')]=function(_0x45a091){var _0x4c5f9a=this;return new Promise(function(_0xe5aa6b,_0x1560e1){return db[_0x5e5b('0x1a')]['create'](_0x45a091[_0x5e5b('0x1b')],{'raw':_0x45a091[_0x5e5b('0x1c')]?_0x45a091['options'][_0x5e5b('0x1d')]===undefined?!![]:![]:!![]})[_0x5e5b('0xf')](function(_0x3c488e){logger[_0x5e5b('0x10')](_0x5e5b('0x19'),_0x45a091);logger[_0x5e5b('0x1e')](_0x5e5b('0x19'),_0x45a091,JSON[_0x5e5b('0x13')](_0x3c488e));_0xe5aa6b(_0x3c488e);})['catch'](function(_0x512e46){logger[_0x5e5b('0x14')](_0x5e5b('0x19'),_0x512e46[_0x5e5b('0x16')],_0x45a091);_0x1560e1(_0x4c5f9a[_0x5e5b('0x14')](0x1f4,_0x512e46[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x1f')]=function(_0x135c6c){var _0x18903e=this;return new Promise(function(_0x161599,_0x26bc02){return db[_0x5e5b('0x1a')]['findAll']({'raw':_0x135c6c[_0x5e5b('0x1c')]?_0x135c6c[_0x5e5b('0x1c')][_0x5e5b('0x1d')]===undefined?!![]:![]:!![],'where':_0x135c6c['options']?_0x135c6c[_0x5e5b('0x1c')][_0x5e5b('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')][_0x5e5b('0x23')]('id')),_0x5e5b('0x24')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x26')))),_0x5e5b('0x27')],[db[_0x5e5b('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x28')))),_0x5e5b('0x29')],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db['sequelize'][_0x5e5b('0x25')](_0x5e5b('0x2a')))),_0x5e5b('0x2b')],[db[_0x5e5b('0x22')]['fn']('AVG',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')]['literal'](_0x5e5b('0x2c')))),_0x5e5b('0x2d')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x2e'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x2f')))),'predictiveIntervalAvgTalktime']]})[_0x5e5b('0xf')](function(_0x37b5be){logger[_0x5e5b('0x10')](_0x5e5b('0x1f'),_0x135c6c);logger[_0x5e5b('0x1e')](_0x5e5b('0x1f'),_0x135c6c,JSON['stringify'](_0x37b5be));_0x161599(_0x37b5be);})['catch'](function(_0x1d6686){logger[_0x5e5b('0x14')](_0x5e5b('0x1f'),_0x1d6686['message'],_0x135c6c);_0x26bc02(_0x18903e[_0x5e5b('0x14')](0x1f4,_0x1d6686[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x30')]=function(_0x470b45){var _0x54320f=this;return new Promise(function(_0x5b3e0d,_0x44c6d2){return db['CmHopperHistory']['findAll']({'raw':_0x470b45[_0x5e5b('0x1c')]?_0x470b45[_0x5e5b('0x1c')][_0x5e5b('0x1d')]===undefined?!![]:![]:!![],'where':_0x470b45['options']?_0x470b45[_0x5e5b('0x1c')]['where']||null:null,'attributes':[['campaign',_0x5e5b('0x31')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x32')))),_0x5e5b('0x33')],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')]['literal'](_0x5e5b('0x34')))),'outboundNoAnswerCallsDay'],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x26')))),_0x5e5b('0x35')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')]['literal'](_0x5e5b('0x36')))),_0x5e5b('0x37')],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')]['literal'](_0x5e5b('0x38')))),_0x5e5b('0x39')],[db['sequelize']['fn'](_0x5e5b('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5e5b('0x3a')))),'outboundDropCallsDayTimeout'],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x3b')))),_0x5e5b('0x3c')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x5e5b('0x25')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x5e5b('0x21'),db['sequelize']['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x3d')))),_0x5e5b('0x3e')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db['sequelize']['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0x5e5b('0x3f')],[db['sequelize']['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')]('`state`\x20=\x2018,\x201,\x20null'))),_0x5e5b('0x40')],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x41')))),_0x5e5b('0x42')],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')]['literal'](_0x5e5b('0x43')))),_0x5e5b('0x40')],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x5e5b('0x44')]],'group':[_0x5e5b('0x45')]})[_0x5e5b('0xf')](function(_0x4a4e0f){logger['info'](_0x5e5b('0x30'),_0x470b45);logger['debug']('GetVoiceQueueHopperHistory',_0x470b45,JSON[_0x5e5b('0x13')](_0x4a4e0f));_0x5b3e0d(_0x4a4e0f);})[_0x5e5b('0x18')](function(_0x4774ee){logger['error'](_0x5e5b('0x30'),_0x4774ee[_0x5e5b('0x16')],_0x470b45);_0x44c6d2(_0x54320f[_0x5e5b('0x14')](0x1f4,_0x4774ee[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x46')]=function(_0x15f7bb){var _0x51db8b=this;return new Promise(function(_0x5d25b4,_0x3c830d){return db[_0x5e5b('0x1a')][_0x5e5b('0x47')]({'raw':_0x15f7bb[_0x5e5b('0x1c')]?_0x15f7bb['options'][_0x5e5b('0x1d')]===undefined?!![]:![]:!![],'where':_0x15f7bb['options']?_0x15f7bb[_0x5e5b('0x1c')][_0x5e5b('0x20')]||null:null,'attributes':[[_0x5e5b('0x45'),_0x5e5b('0x31')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')][_0x5e5b('0x23')]('id')),'ivrTotalCallsDays'],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0x5e5b('0x48')]],'group':[_0x5e5b('0x45')]})[_0x5e5b('0xf')](function(_0x3fc9b5){logger[_0x5e5b('0x10')]('GetCampaignHopperHistory',_0x15f7bb);logger[_0x5e5b('0x1e')]('GetCampaignHopperHistory',_0x15f7bb,JSON[_0x5e5b('0x13')](_0x3fc9b5));_0x5d25b4(_0x3fc9b5);})['catch'](function(_0x3f4750){logger[_0x5e5b('0x14')](_0x5e5b('0x46'),_0x3f4750[_0x5e5b('0x16')],_0x15f7bb);_0x3c830d(_0x51db8b[_0x5e5b('0x14')](0x1f4,_0x3f4750[_0x5e5b('0x16')]));});});}; \ No newline at end of file +var _0x96cc=['`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit'];(function(_0xa6cb09,_0x39410f){var _0x12b437=function(_0x1813cc){while(--_0x1813cc){_0xa6cb09['push'](_0xa6cb09['shift']());}};_0x12b437(++_0x39410f);}(_0x96cc,0x16c));var _0xc96c=function(_0x2d58e6,_0x55cb14){_0x2d58e6=_0x2d58e6-0x0;var _0x5bcd81=_0x96cc[_0x2d58e6];return _0x5bcd81;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});}exports[_0xc96c('0x17')]=function(_0x99c402){var _0x16b6ce=this;return new Promise(function(_0x2ae19a,_0x4aa6a3){return db[_0xc96c('0x18')][_0xc96c('0x19')](_0x99c402[_0xc96c('0x1a')],{'raw':_0x99c402[_0xc96c('0x1b')]?_0x99c402[_0xc96c('0x1b')][_0xc96c('0x1c')]===undefined?!![]:![]:!![]})[_0xc96c('0xc')](function(_0x41daba){logger[_0xc96c('0xd')](_0xc96c('0x17'),_0x99c402);logger[_0xc96c('0x1d')](_0xc96c('0x17'),_0x99c402,JSON[_0xc96c('0x11')](_0x41daba));_0x2ae19a(_0x41daba);})[_0xc96c('0x16')](function(_0x325c54){logger[_0xc96c('0x12')](_0xc96c('0x17'),_0x325c54['message'],_0x99c402);_0x4aa6a3(_0x16b6ce[_0xc96c('0x12')](0x1f4,_0x325c54[_0xc96c('0x14')]));});});};exports[_0xc96c('0x1e')]=function(_0x10ae21){var _0x2b1df9=this;return new Promise(function(_0x35f480,_0x40f23d){return db[_0xc96c('0x18')][_0xc96c('0x1f')]({'raw':_0x10ae21[_0xc96c('0x1b')]?_0x10ae21['options'][_0xc96c('0x1c')]===undefined?!![]:![]:!![],'where':_0x10ae21[_0xc96c('0x1b')]?_0x10ae21[_0xc96c('0x1b')][_0xc96c('0x20')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xc96c('0x21')][_0xc96c('0x22')]('id')),_0xc96c('0x23')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x26')))),_0xc96c('0x27')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal'](_0xc96c('0x28')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db['sequelize'][_0xc96c('0x25')](_0xc96c('0x29')))),_0xc96c('0x2a')],[db[_0xc96c('0x21')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x2b')))),'predictiveIntervalAvgHoldtime'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x2c'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal'](_0xc96c('0x2d')))),_0xc96c('0x2e')]]})['then'](function(_0x2b1dec){logger[_0xc96c('0xd')](_0xc96c('0x1e'),_0x10ae21);logger[_0xc96c('0x1d')](_0xc96c('0x1e'),_0x10ae21,JSON[_0xc96c('0x11')](_0x2b1dec));_0x35f480(_0x2b1dec);})['catch'](function(_0x35dfb7){logger[_0xc96c('0x12')](_0xc96c('0x1e'),_0x35dfb7[_0xc96c('0x14')],_0x10ae21);_0x40f23d(_0x2b1df9[_0xc96c('0x12')](0x1f4,_0x35dfb7[_0xc96c('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x56b5c9){var _0x33b4bb=this;return new Promise(function(_0x156d0f,_0x5006ec){return db['CmHopperHistory'][_0xc96c('0x1f')]({'raw':_0x56b5c9[_0xc96c('0x1b')]?_0x56b5c9[_0xc96c('0x1b')][_0xc96c('0x1c')]===undefined?!![]:![]:!![],'where':_0x56b5c9[_0xc96c('0x1b')]?_0x56b5c9[_0xc96c('0x1b')][_0xc96c('0x20')]||null:null,'attributes':[[_0xc96c('0x2f'),_0xc96c('0x30')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x31')))),_0xc96c('0x32')],[db['sequelize']['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xc96c('0x33')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x26')))),_0xc96c('0x34')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc96c('0x35')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x36')))),'outboundDropCallsDayTimeout'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc96c('0x37')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x38')))),_0xc96c('0x39')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')]('`state`\x20=\x2013,\x201,\x20null'))),_0xc96c('0x3a')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db['sequelize'][_0xc96c('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0xc96c('0x3b')],[db[_0xc96c('0x21')]['fn']('COUNT',db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x3c')))),_0xc96c('0x3d')],[db[_0xc96c('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xc96c('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0xc96c('0x3e')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x3f')))),_0xc96c('0x3d')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x40')))),_0xc96c('0x41')]],'group':[_0xc96c('0x2f')]})[_0xc96c('0xc')](function(_0xad88c3){logger[_0xc96c('0xd')]('GetVoiceQueueHopperHistory',_0x56b5c9);logger['debug']('GetVoiceQueueHopperHistory',_0x56b5c9,JSON['stringify'](_0xad88c3));_0x156d0f(_0xad88c3);})[_0xc96c('0x16')](function(_0x46c6fb){logger[_0xc96c('0x12')](_0xc96c('0x42'),_0x46c6fb[_0xc96c('0x14')],_0x56b5c9);_0x5006ec(_0x33b4bb[_0xc96c('0x12')](0x1f4,_0x46c6fb[_0xc96c('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x47115b){var _0x48dc98=this;return new Promise(function(_0x3c4b60,_0x103e90){return db[_0xc96c('0x18')][_0xc96c('0x1f')]({'raw':_0x47115b[_0xc96c('0x1b')]?_0x47115b['options'][_0xc96c('0x1c')]===undefined?!![]:![]:!![],'where':_0x47115b[_0xc96c('0x1b')]?_0x47115b[_0xc96c('0x1b')][_0xc96c('0x20')]||null:null,'attributes':[[_0xc96c('0x2f'),_0xc96c('0x30')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')][_0xc96c('0x22')]('id')),_0xc96c('0x43')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db['sequelize'][_0xc96c('0x25')](_0xc96c('0x26')))),_0xc96c('0x44')]],'group':[_0xc96c('0x2f')]})[_0xc96c('0xc')](function(_0x55219a){logger[_0xc96c('0xd')](_0xc96c('0x45'),_0x47115b);logger[_0xc96c('0x1d')](_0xc96c('0x45'),_0x47115b,JSON['stringify'](_0x55219a));_0x3c4b60(_0x55219a);})[_0xc96c('0x16')](function(_0x4629ce){logger['error']('GetCampaignHopperHistory',_0x4629ce['message'],_0x47115b);_0x103e90(_0x48dc98[_0xc96c('0x12')](0x1f4,_0x4629ce[_0xc96c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0f14ac0..5271eda 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 _0xd914=['get','index','/describe','isAuthenticated','describe','/:id','post','create','put','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x36a515,_0x53c8e9){var _0x265eaf=function(_0x95be61){while(--_0x95be61){_0x36a515['push'](_0x36a515['shift']());}};_0x265eaf(++_0x53c8e9);}(_0xd914,0x17f));var _0x4d91=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0xd914[_0x4d2993];return _0x427374;};'use strict';var multer=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var path=require('path');var timeout=require(_0x4d91('0x2'));var express=require(_0x4d91('0x3'));var router=express[_0x4d91('0x4')]();var auth=require(_0x4d91('0x5'));var interaction=require(_0x4d91('0x6'));var config=require(_0x4d91('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x4d91('0x8')]('/',auth['isAuthenticated'](),controller[_0x4d91('0x9')]);router[_0x4d91('0x8')](_0x4d91('0xa'),auth[_0x4d91('0xb')](),controller[_0x4d91('0xc')]);router[_0x4d91('0x8')](_0x4d91('0xd'),auth[_0x4d91('0xb')](),controller['show']);router[_0x4d91('0xe')]('/',auth[_0x4d91('0xb')](),controller[_0x4d91('0xf')]);router[_0x4d91('0x10')](_0x4d91('0xd'),auth[_0x4d91('0xb')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x36bc=['/:id','show','create','put','update','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x36bc,0xf5));var _0xc36b=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x36bc[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require(_0xc36b('0x0'));var util=require(_0xc36b('0x1'));var path=require('path');var timeout=require(_0xc36b('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc36b('0x3'));var config=require(_0xc36b('0x4'));var controller=require(_0xc36b('0x5'));router[_0xc36b('0x6')]('/',auth[_0xc36b('0x7')](),controller[_0xc36b('0x8')]);router['get'](_0xc36b('0x9'),auth[_0xc36b('0x7')](),controller[_0xc36b('0xa')]);router[_0xc36b('0x6')](_0xc36b('0xb'),auth['isAuthenticated'](),controller[_0xc36b('0xc')]);router['post']('/',auth[_0xc36b('0x7')](),controller[_0xc36b('0xd')]);router[_0xc36b('0xe')](_0xc36b('0xb'),auth[_0xc36b('0x7')](),controller[_0xc36b('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index bddcb8a..77a003e 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 _0x57fd=['STRING','name','exports'];(function(_0x47da69,_0x17bdd8){var _0x47218a=function(_0x9aa332){while(--_0x9aa332){_0x47da69['push'](_0x47da69['shift']());}};_0x47218a(++_0x17bdd8);}(_0x57fd,0x173));var _0xd57f=function(_0x1484df,_0x16cc4c){_0x1484df=_0x1484df-0x0;var _0x5d8a74=_0x57fd[_0x1484df];return _0x5d8a74;};'use strict';var Sequelize=require('sequelize');module[_0xd57f('0x0')]={'name':{'type':Sequelize[_0xd57f('0x1')],'unique':_0xd57f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd57f('0x1')]},'dialPrefix':{'type':Sequelize[_0xd57f('0x1')]}}; \ No newline at end of file +var _0xf3cc=['exports','STRING','name','sequelize'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xf3cc,0x1cb));var _0xcf3c=function(_0x524efa,_0xbe406e){_0x524efa=_0x524efa-0x0;var _0x775cd5=_0xf3cc[_0x524efa];return _0x775cd5;};'use strict';var Sequelize=require(_0xcf3c('0x0'));module[_0xcf3c('0x1')]={'name':{'type':Sequelize[_0xcf3c('0x2')],'unique':_0xcf3c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xcf3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index be18326..d129c18 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 _0xbb63=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','Disposition','getDispositions','findAll','rows','removeDispositions','addContacts','CmContact','tags','isArray','join','ListId','each','omit','ids','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','getContacts','getContactsCsv','raw','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','findOne','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','./cmList.socket','register','sendStatus','end','status','json','count','limit','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','name','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','catch','show','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId'];(function(_0x33c8b3,_0x27dc52){var _0x25089b=function(_0x392058){while(--_0x392058){_0x33c8b3['push'](_0x33c8b3['shift']());}};_0x25089b(++_0x27dc52);}(_0xbb63,0x1e3));var _0x3bb6=function(_0x4cd11c,_0x11925c){_0x4cd11c=_0x4cd11c-0x0;var _0x2bf15f=_0xbb63[_0x4cd11c];return _0x2bf15f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3bb6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3bb6('0x1'));var rp=require(_0x3bb6('0x2'));var moment=require(_0x3bb6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3bb6('0x4'));var util=require('util');var path=require(_0x3bb6('0x5'));var sox=require(_0x3bb6('0x6'));var csv=require(_0x3bb6('0x7'));var ejs=require(_0x3bb6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3bb6('0x9'));var jsforce=require(_0x3bb6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3bb6('0x7'));var querystring=require(_0x3bb6('0xb'));var Papa=require('papaparse');var Redis=require(_0x3bb6('0xc'));var authService=require(_0x3bb6('0xd'));var qs=require(_0x3bb6('0xe'));var as=require(_0x3bb6('0xf'));var hardwareService=require(_0x3bb6('0x10'));var logger=require('../../config/logger')(_0x3bb6('0x11'));var utils=require(_0x3bb6('0x12'));var config=require('../../config/environment');var db=require(_0x3bb6('0x13'))['db'];config[_0x3bb6('0x14')]=_['defaults'](config[_0x3bb6('0x14')],{'host':_0x3bb6('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3bb6('0x14')]));require(_0x3bb6('0x16'))[_0x3bb6('0x17')](socket);function respondWithStatusCode(_0xa1fb88,_0x15036d){_0x15036d=_0x15036d||0xcc;return function(_0x2f3e54){if(_0x2f3e54){return _0xa1fb88[_0x3bb6('0x18')](_0x15036d);}return _0xa1fb88['status'](_0x15036d)[_0x3bb6('0x19')]();};}function respondWithResult(_0x372004,_0x45530d){_0x45530d=_0x45530d||0xc8;return function(_0x4617ac){if(_0x4617ac){return _0x372004[_0x3bb6('0x1a')](_0x45530d)[_0x3bb6('0x1b')](_0x4617ac);}};}function respondWithFilteredResult(_0x14e257,_0x2c9781){return function(_0x282be5){if(_0x282be5){var _0x2376fe=_0x282be5[_0x3bb6('0x1c')],_0x470087=_0x2c9781['offset'],_0xfaa93d=_0x2c9781['offset']+_0x2c9781[_0x3bb6('0x1d')],_0x16f390;if(_0xfaa93d>=_0x2376fe){_0xfaa93d=_0x2376fe;_0x16f390=0xc8;}else{_0x16f390=0xce;}_0x14e257[_0x3bb6('0x1a')](_0x16f390);return _0x14e257['set']('Content-Range',_0x470087+'-'+_0xfaa93d+'/'+_0x2376fe)[_0x3bb6('0x1b')](_0x282be5);}return null;};}function patchUpdates(_0x5b287e){return function(_0x33548f){try{jsonpatch[_0x3bb6('0x1e')](_0x33548f,_0x5b287e,!![]);}catch(_0x520d9f){return BPromise[_0x3bb6('0x1f')](_0x520d9f);}return _0x33548f[_0x3bb6('0x20')]();};}function saveUpdates(_0x44ec5c,_0x4a8b36){return function(_0x495d20){if(_0x495d20){return _0x495d20[_0x3bb6('0x21')](_0x44ec5c)['then'](function(_0x354907){return _0x354907;});}return null;};}function removeEntity(_0x1b0d7c,_0x3bbe6d){return function(_0xb1902b){if(_0xb1902b){return _0xb1902b[_0x3bb6('0x22')]()[_0x3bb6('0x23')](function(){var _0x297093=_0xb1902b[_0x3bb6('0x24')]({'plain':!![]});var _0xd794dd=_0x3bb6('0x25');return db[_0x3bb6('0x26')][_0x3bb6('0x22')]({'where':{'type':_0xd794dd,'resourceId':_0x297093['id']}})[_0x3bb6('0x23')](function(){return _0xb1902b;});})[_0x3bb6('0x23')](function(){_0x1b0d7c[_0x3bb6('0x1a')](0xcc)[_0x3bb6('0x19')]();});}};}function handleEntityNotFound(_0x58186d,_0x4a4fe9){return function(_0x54a686){if(!_0x54a686){_0x58186d[_0x3bb6('0x18')](0x194);}return _0x54a686;};}function handleError(_0x488fb0,_0xfa4042){_0xfa4042=_0xfa4042||0x1f4;return function(_0x34d5eb){logger[_0x3bb6('0x27')](_0x34d5eb['stack']);if(_0x34d5eb[_0x3bb6('0x28')]){delete _0x34d5eb[_0x3bb6('0x28')];}_0x488fb0['status'](_0xfa4042)['send'](_0x34d5eb);};}exports['index']=function(_0x349f23,_0x4580d6){var _0x105b3b={},_0x16dd89={},_0x1f238e={'count':0x0,'rows':[]};var _0xf0c651=_[_0x3bb6('0x29')](db[_0x3bb6('0x2a')]['rawAttributes'],function(_0x4a5806){return{'name':_0x4a5806[_0x3bb6('0x2b')],'type':_0x4a5806[_0x3bb6('0x2c')][_0x3bb6('0x2d')]};});_0x16dd89[_0x3bb6('0x2e')]=_[_0x3bb6('0x29')](_0xf0c651,_0x3bb6('0x28'));_0x16dd89[_0x3bb6('0x2f')]=_[_0x3bb6('0x30')](_0x349f23[_0x3bb6('0x2f')]);_0x16dd89[_0x3bb6('0x31')]=_[_0x3bb6('0x32')](_0x16dd89['model'],_0x16dd89[_0x3bb6('0x2f')]);_0x105b3b[_0x3bb6('0x33')]=_[_0x3bb6('0x32')](_0x16dd89[_0x3bb6('0x2e')],qs[_0x3bb6('0x34')](_0x349f23['query'][_0x3bb6('0x34')]));_0x105b3b[_0x3bb6('0x33')]=_0x105b3b[_0x3bb6('0x33')][_0x3bb6('0x35')]?_0x105b3b['attributes']:_0x16dd89['model'];if(!_0x349f23[_0x3bb6('0x2f')][_0x3bb6('0x36')](_0x3bb6('0x37'))){_0x105b3b[_0x3bb6('0x1d')]=qs[_0x3bb6('0x1d')](_0x349f23[_0x3bb6('0x2f')][_0x3bb6('0x1d')]);_0x105b3b[_0x3bb6('0x38')]=qs['offset'](_0x349f23['query'][_0x3bb6('0x38')]);}_0x105b3b[_0x3bb6('0x39')]=qs[_0x3bb6('0x3a')](_0x349f23[_0x3bb6('0x2f')][_0x3bb6('0x3a')]);_0x105b3b['where']=qs['filters'](_[_0x3bb6('0x3b')](_0x349f23['query'],_0x16dd89[_0x3bb6('0x31')]),_0xf0c651);if(_0x349f23['query'][_0x3bb6('0x3c')]){_0x105b3b[_0x3bb6('0x3d')]=_['merge'](_0x105b3b[_0x3bb6('0x3d')],{'$or':_[_0x3bb6('0x29')](_0xf0c651,function(_0x2ed737){if(_0x2ed737[_0x3bb6('0x2c')]!==_0x3bb6('0x3e')){var _0x3a9749={};_0x3a9749[_0x2ed737['name']]={'$like':'%'+_0x349f23[_0x3bb6('0x2f')][_0x3bb6('0x3c')]+'%'};return _0x3a9749;}})});}_0x105b3b=_[_0x3bb6('0x3f')]({},_0x105b3b,_0x349f23[_0x3bb6('0x40')]);var _0x12b176={'where':_0x105b3b[_0x3bb6('0x3d')]};return db[_0x3bb6('0x2a')][_0x3bb6('0x1c')](_0x12b176)[_0x3bb6('0x23')](function(_0x4316a3){_0x1f238e[_0x3bb6('0x1c')]=_0x4316a3;if(_0x349f23[_0x3bb6('0x2f')][_0x3bb6('0x41')]){_0x105b3b[_0x3bb6('0x42')]=[{'all':!![]}];}return db[_0x3bb6('0x2a')]['findAll'](_0x105b3b);})[_0x3bb6('0x23')](function(_0x3f39f6){_0x1f238e['rows']=_0x3f39f6;return _0x1f238e;})['then'](respondWithFilteredResult(_0x4580d6,_0x105b3b))[_0x3bb6('0x43')](handleError(_0x4580d6,null));};exports[_0x3bb6('0x44')]=function(_0x1e2d37,_0xf89cc4){var _0x263eaa={'raw':![],'where':{'id':_0x1e2d37[_0x3bb6('0x45')]['id']}},_0xb4f974={};_0xb4f974['model']=_['keys'](db['CmList'][_0x3bb6('0x46')]);_0xb4f974[_0x3bb6('0x2f')]=_['keys'](_0x1e2d37['query']);_0xb4f974[_0x3bb6('0x31')]=_[_0x3bb6('0x32')](_0xb4f974[_0x3bb6('0x2e')],_0xb4f974[_0x3bb6('0x2f')]);_0x263eaa[_0x3bb6('0x33')]=_[_0x3bb6('0x32')](_0xb4f974[_0x3bb6('0x2e')],qs[_0x3bb6('0x34')](_0x1e2d37['query'][_0x3bb6('0x34')]));_0x263eaa[_0x3bb6('0x33')]=_0x263eaa[_0x3bb6('0x33')][_0x3bb6('0x35')]?_0x263eaa[_0x3bb6('0x33')]:_0xb4f974[_0x3bb6('0x2e')];if(_0x1e2d37['query'][_0x3bb6('0x41')]){_0x263eaa[_0x3bb6('0x42')]=[{'all':!![]}];}_0x263eaa=_[_0x3bb6('0x3f')]({},_0x263eaa,_0x1e2d37['options']);return db[_0x3bb6('0x2a')]['find'](_0x263eaa)[_0x3bb6('0x23')](handleEntityNotFound(_0xf89cc4,null))['then'](respondWithResult(_0xf89cc4,null))[_0x3bb6('0x43')](handleError(_0xf89cc4,null));};exports[_0x3bb6('0x47')]=function(_0x1fd317,_0x2ab6d8){return db[_0x3bb6('0x2a')][_0x3bb6('0x47')](_0x1fd317[_0x3bb6('0x48')],{})[_0x3bb6('0x23')](function(_0x4d7079){var _0x5512c7=_0x1fd317['user'][_0x3bb6('0x24')]({'plain':!![]});if(!_0x5512c7)throw new Error(_0x3bb6('0x49'));if(_0x5512c7['role']===_0x3bb6('0x4a')){var _0x3a3fe4=_0x4d7079[_0x3bb6('0x24')]({'plain':!![]});var _0x5c3920=_0x3bb6('0x25');return db[_0x3bb6('0x4b')]['find']({'where':{'name':_0x5c3920,'userProfileId':_0x5512c7[_0x3bb6('0x4c')]},'raw':!![]})[_0x3bb6('0x23')](function(_0x417fd2){if(_0x417fd2&&_0x417fd2[_0x3bb6('0x4d')]===0x0){return db[_0x3bb6('0x26')][_0x3bb6('0x47')]({'name':_0x3a3fe4[_0x3bb6('0x28')],'resourceId':_0x3a3fe4['id'],'type':_0x417fd2[_0x3bb6('0x28')],'sectionId':_0x417fd2['id']},{})[_0x3bb6('0x23')](function(){return _0x4d7079;});}else{return _0x4d7079;}})[_0x3bb6('0x43')](function(_0x400d2d){logger[_0x3bb6('0x27')](_0x3bb6('0x4e'),_0x400d2d);throw _0x400d2d;});}return _0x4d7079;})[_0x3bb6('0x23')](respondWithResult(_0x2ab6d8,0xc9))[_0x3bb6('0x43')](handleError(_0x2ab6d8,null));};exports[_0x3bb6('0x21')]=function(_0x245160,_0x431a11){if(_0x245160['body']['id']){delete _0x245160[_0x3bb6('0x48')]['id'];}return db[_0x3bb6('0x2a')][_0x3bb6('0x4f')]({'where':{'id':_0x245160[_0x3bb6('0x45')]['id']}})['then'](handleEntityNotFound(_0x431a11,null))[_0x3bb6('0x23')](saveUpdates(_0x245160[_0x3bb6('0x48')],null))[_0x3bb6('0x23')](respondWithResult(_0x431a11,null))[_0x3bb6('0x43')](handleError(_0x431a11,null));};exports[_0x3bb6('0x22')]=function(_0x17a7d8,_0x3b0332){return db[_0x3bb6('0x2a')]['find']({'where':{'id':_0x17a7d8[_0x3bb6('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b0332,null))['then'](removeEntity(_0x3b0332,null))[_0x3bb6('0x43')](handleError(_0x3b0332,null));};exports[_0x3bb6('0x50')]=function(_0x3cd954,_0xa5f3f7){return db['CmList'][_0x3bb6('0x50')]()[_0x3bb6('0x23')](respondWithResult(_0xa5f3f7,null))['catch'](handleError(_0xa5f3f7,null));};exports[_0x3bb6('0x51')]=function(_0x34a845,_0xd4af44,_0xc0f283){if(_0x34a845[_0x3bb6('0x48')]['id']){delete _0x34a845[_0x3bb6('0x48')]['id'];}return db['CmList'][_0x3bb6('0x4f')]({'where':{'id':_0x34a845['params']['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0xd4af44,null))[_0x3bb6('0x23')](function(_0x24b4ce){if(_0x24b4ce){_0x34a845['body']['ListId']=_0x24b4ce['id'];return db[_0x3bb6('0x52')]['create'](_0x34a845[_0x3bb6('0x48')]);}})[_0x3bb6('0x23')](respondWithResult(_0xd4af44,null))['catch'](handleError(_0xd4af44,null));};exports[_0x3bb6('0x53')]=function(_0x27efd7,_0xd9e5e5,_0x13d163){var _0x4b358d={'raw':![],'where':{}};var _0x1ba8cc={};var _0x1e1250={'count':0x0,'rows':[]};return db[_0x3bb6('0x2a')]['findOne']({'where':{'id':_0x27efd7[_0x3bb6('0x45')]['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0xd9e5e5,null))[_0x3bb6('0x23')](function(_0x4a948e){if(_0x4a948e){_0x1ba8cc[_0x3bb6('0x2e')]=_[_0x3bb6('0x30')](db[_0x3bb6('0x52')][_0x3bb6('0x46')]);_0x1ba8cc[_0x3bb6('0x2f')]=_[_0x3bb6('0x30')](_0x27efd7[_0x3bb6('0x2f')]);_0x1ba8cc[_0x3bb6('0x31')]=_[_0x3bb6('0x32')](_0x1ba8cc[_0x3bb6('0x2e')],_0x1ba8cc[_0x3bb6('0x2f')]);_0x4b358d[_0x3bb6('0x33')]=_[_0x3bb6('0x32')](_0x1ba8cc[_0x3bb6('0x2e')],qs['fields'](_0x27efd7[_0x3bb6('0x2f')][_0x3bb6('0x34')]));_0x4b358d[_0x3bb6('0x33')]=_0x4b358d['attributes'][_0x3bb6('0x35')]?_0x4b358d['attributes']:_0x1ba8cc[_0x3bb6('0x2e')];if(!_0x27efd7['query'][_0x3bb6('0x36')](_0x3bb6('0x37'))){_0x4b358d[_0x3bb6('0x1d')]=qs[_0x3bb6('0x1d')](_0x27efd7[_0x3bb6('0x2f')][_0x3bb6('0x1d')]);_0x4b358d[_0x3bb6('0x38')]=qs[_0x3bb6('0x38')](_0x27efd7[_0x3bb6('0x2f')][_0x3bb6('0x38')]);}_0x4b358d['order']=qs[_0x3bb6('0x3a')](_0x27efd7[_0x3bb6('0x2f')][_0x3bb6('0x3a')]);_0x4b358d[_0x3bb6('0x3d')]=qs[_0x3bb6('0x31')](_[_0x3bb6('0x3b')](_0x27efd7[_0x3bb6('0x2f')],_0x1ba8cc[_0x3bb6('0x31')]));_0x4b358d[_0x3bb6('0x3d')]['ListId']=_0x4a948e['id'];if(_0x27efd7[_0x3bb6('0x2f')][_0x3bb6('0x3c')]){_0x4b358d[_0x3bb6('0x3d')]=_['merge'](_0x4b358d[_0x3bb6('0x3d')],{'$or':_[_0x3bb6('0x29')](_0x4b358d['attributes'],function(_0x9ab4c4){var _0x490bb8={};_0x490bb8[_0x9ab4c4]={'$like':'%'+_0x27efd7[_0x3bb6('0x2f')][_0x3bb6('0x3c')]+'%'};return _0x490bb8;})});}_0x4b358d=_[_0x3bb6('0x3f')]({},_0x4b358d,_0x27efd7[_0x3bb6('0x40')]);return db['Disposition'][_0x3bb6('0x1c')]({'where':_0x4b358d['where']})['then'](function(_0x19e0f9){_0x1e1250['count']=_0x19e0f9;if(_0x27efd7[_0x3bb6('0x2f')]['includeAll']){_0x4b358d[_0x3bb6('0x42')]=[{'all':!![]}];}return db['Disposition'][_0x3bb6('0x54')](_0x4b358d);})[_0x3bb6('0x23')](function(_0x2a010c){_0x1e1250[_0x3bb6('0x55')]=_0x2a010c;return _0x1e1250;});}})[_0x3bb6('0x23')](respondWithFilteredResult(_0xd9e5e5,_0x4b358d))[_0x3bb6('0x43')](handleError(_0xd9e5e5,null));};exports[_0x3bb6('0x56')]=function(_0xbce05a,_0x1a46d0,_0x1e1ebd){return db[_0x3bb6('0x2a')][_0x3bb6('0x4f')]({'where':{'id':_0xbce05a[_0x3bb6('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a46d0,null))[_0x3bb6('0x23')](function(_0x348254){if(_0x348254){return _0x348254['removeDispositions'](_0xbce05a[_0x3bb6('0x2f')]['ids']);}})['then'](respondWithStatusCode(_0x1a46d0,null))[_0x3bb6('0x43')](handleError(_0x1a46d0,null));};exports[_0x3bb6('0x57')]=function(_0x425009,_0x490238,_0x231fc7){return db[_0x3bb6('0x2a')][_0x3bb6('0x4f')]({'where':{'id':_0x425009['params']['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0x490238,null))[_0x3bb6('0x23')](function(_0x5dc906){if(_0x5dc906){var _0x4cc5be=[];var _0xf9b3cf={'success':[],'errors':[]};return db[_0x3bb6('0x58')][_0x3bb6('0x50')]()['then'](function(_0x2c62fe){if(_0x425009[_0x3bb6('0x48')][_0x3bb6('0x59')]&&_[_0x3bb6('0x5a')](_0x425009['body']['tags'])){if(_0x425009[_0x3bb6('0x48')][_0x3bb6('0x59')]['length']){_0x425009[_0x3bb6('0x48')][_0x3bb6('0x59')]=_0x425009[_0x3bb6('0x48')]['tags'][_0x3bb6('0x5b')](';')+';';}else{_0x425009[_0x3bb6('0x48')][_0x3bb6('0x59')]=null;}}else{_0x425009[_0x3bb6('0x48')][_0x3bb6('0x59')]=null;}if(_0x425009[_0x3bb6('0x48')]&&_[_0x3bb6('0x5a')](_0x425009[_0x3bb6('0x48')])){for(var _0x3634b3=0x0;_0x3634b3<_0x425009[_0x3bb6('0x48')]['length'];_0x3634b3+=0x1){_0x425009[_0x3bb6('0x48')][_0x3634b3][_0x3bb6('0x5c')]=_0x425009[_0x3bb6('0x45')]['id'];_0x4cc5be['push'](_0x425009['body'][_0x3634b3]);}return BPromise[_0x3bb6('0x5d')](_0x4cc5be,function(_0x10d27f){return db[_0x3bb6('0x58')][_0x3bb6('0x47')](_[_0x3bb6('0x5e')](_0x10d27f,[_0x3bb6('0x5f'),'id'])||{},{'fields':_[_0x3bb6('0x30')](_0x2c62fe),'raw':!![]})[_0x3bb6('0x23')](function(_0x294646){_0xf9b3cf[_0x3bb6('0x60')]['push'](_0x294646[_0x3bb6('0x61')]);})[_0x3bb6('0x43')](function(_0x150ceb){_0xf9b3cf['errors']['push']({'data':_0x10d27f,'error':_0x150ceb[_0x3bb6('0x62')]});});})[_0x3bb6('0x23')](function(_0x5624b4){return _0xf9b3cf;})['catch'](function(_0x47162d){return _0x47162d;});}else{_0x490238[_0x3bb6('0x1a')](0x190)[_0x3bb6('0x1b')]({'message':_0x3bb6('0x63')});}});}})[_0x3bb6('0x23')](respondWithResult(_0x490238,null))[_0x3bb6('0x43')](handleError(_0x490238,null));};exports['getContacts']=function(_0x598666,_0x197211,_0x5bdb87){var _0x10be7f;return db['CmList'][_0x3bb6('0x4f')]({'where':{'id':_0x598666['params']['id']},'include':[{'model':db[_0x3bb6('0x64')],'as':_0x3bb6('0x65')}]})['then'](handleEntityNotFound(_0x197211,null))[_0x3bb6('0x23')](function(_0x30184a){if(_0x30184a){_0x10be7f=_0x30184a;return db[_0x3bb6('0x58')][_0x3bb6('0x46')];}})[_0x3bb6('0x23')](function(_0x463790){if(_0x463790){var _0x1061c4={};var _0x5d6f96={};_0x5d6f96[_0x3bb6('0x2e')]=_[_0x3bb6('0x66')](_['keys'](_0x463790),_[_0x3bb6('0x29')](_0x10be7f[_0x3bb6('0x65')],function(_0x5c34be){return util[_0x3bb6('0x67')](_0x3bb6('0x68'),_0x5c34be['id']);}));_0x5d6f96[_0x3bb6('0x2f')]=_['keys'](_0x598666[_0x3bb6('0x2f')]);_0x5d6f96[_0x3bb6('0x31')]=_['intersection'](_0x5d6f96[_0x3bb6('0x2e')],_0x5d6f96[_0x3bb6('0x2f')]);_0x1061c4[_0x3bb6('0x33')]=_[_0x3bb6('0x32')](_0x5d6f96['model'],qs['fields'](_0x598666[_0x3bb6('0x2f')][_0x3bb6('0x34')]));_0x1061c4[_0x3bb6('0x33')]=_0x1061c4[_0x3bb6('0x33')]['length']?_0x1061c4[_0x3bb6('0x33')]:_0x5d6f96[_0x3bb6('0x2e')];if(!_0x598666[_0x3bb6('0x2f')]['hasOwnProperty'](_0x3bb6('0x37'))){_0x1061c4[_0x3bb6('0x1d')]=qs[_0x3bb6('0x1d')](_0x598666[_0x3bb6('0x2f')]['limit']);_0x1061c4[_0x3bb6('0x38')]=qs['offset'](_0x598666[_0x3bb6('0x2f')][_0x3bb6('0x38')]);}_0x1061c4[_0x3bb6('0x39')]=qs[_0x3bb6('0x3a')](_0x598666[_0x3bb6('0x2f')][_0x3bb6('0x3a')]);_0x1061c4[_0x3bb6('0x3d')]=qs[_0x3bb6('0x31')](_['pick'](_0x598666[_0x3bb6('0x2f')],_0x5d6f96[_0x3bb6('0x31')]));_0x1061c4['raw']=!![];if(_0x598666[_0x3bb6('0x2f')]['filter']){_0x1061c4[_0x3bb6('0x3d')]=_[_0x3bb6('0x3f')](_0x1061c4[_0x3bb6('0x3d')],{'$or':_[_0x3bb6('0x29')](_0x1061c4['attributes'],function(_0x1b66be){var _0x313236={};_0x313236[_0x1b66be]={'$like':'%'+_0x598666[_0x3bb6('0x2f')][_0x3bb6('0x3c')]+'%'};return _0x313236;})});}_0x1061c4=_[_0x3bb6('0x3f')]({},_0x1061c4,_0x598666['options']);return _0x10be7f[_0x3bb6('0x69')](_0x1061c4);}})['then'](respondWithResult(_0x197211,null))['catch'](handleError(_0x197211,null));};exports[_0x3bb6('0x6a')]=function(_0x334b2d,_0x4a37cf,_0x1bce92){var _0x2ac268;return db[_0x3bb6('0x2a')]['find']({'where':{'id':_0x334b2d[_0x3bb6('0x45')]['id']},'include':[{'model':db[_0x3bb6('0x64')],'as':_0x3bb6('0x65')}]})[_0x3bb6('0x23')](handleEntityNotFound(_0x4a37cf,null))[_0x3bb6('0x23')](function(_0x199ec2){if(_0x199ec2){_0x2ac268=_0x199ec2;return db[_0x3bb6('0x58')][_0x3bb6('0x46')];}})[_0x3bb6('0x23')](function(_0x38295d){if(_0x38295d){var _0x7fd428={};var _0x8ccceb={};_0x8ccceb[_0x3bb6('0x2e')]=_[_0x3bb6('0x66')](_[_0x3bb6('0x30')](_0x38295d),_['map'](_0x2ac268[_0x3bb6('0x65')],function(_0x16a3a7){return util['format'](_0x3bb6('0x68'),_0x16a3a7['id']);}));_0x8ccceb[_0x3bb6('0x2f')]=_[_0x3bb6('0x30')](_0x334b2d[_0x3bb6('0x2f')]);_0x8ccceb[_0x3bb6('0x31')]=_[_0x3bb6('0x32')](_0x8ccceb['model'],_0x8ccceb[_0x3bb6('0x2f')]);_0x7fd428[_0x3bb6('0x33')]=_['intersection'](_0x8ccceb[_0x3bb6('0x2e')],qs[_0x3bb6('0x34')](_0x334b2d[_0x3bb6('0x2f')][_0x3bb6('0x34')]));_0x7fd428[_0x3bb6('0x33')]=_0x7fd428[_0x3bb6('0x33')][_0x3bb6('0x35')]?_0x7fd428[_0x3bb6('0x33')]:_0x8ccceb[_0x3bb6('0x2e')];if(!_0x334b2d[_0x3bb6('0x2f')][_0x3bb6('0x36')](_0x3bb6('0x37'))){_0x7fd428['limit']=qs['limit'](_0x334b2d[_0x3bb6('0x2f')][_0x3bb6('0x1d')]);_0x7fd428[_0x3bb6('0x38')]=qs['offset'](_0x334b2d['query'][_0x3bb6('0x38')]);}_0x7fd428['order']=qs[_0x3bb6('0x3a')](_0x334b2d['query']['sort']);_0x7fd428[_0x3bb6('0x3d')]=qs[_0x3bb6('0x31')](_[_0x3bb6('0x3b')](_0x334b2d[_0x3bb6('0x2f')],_0x8ccceb[_0x3bb6('0x31')]));_0x7fd428[_0x3bb6('0x6b')]=!![];if(_0x334b2d[_0x3bb6('0x2f')][_0x3bb6('0x3c')]){_0x7fd428[_0x3bb6('0x3d')]=_['merge'](_0x7fd428[_0x3bb6('0x3d')],{'$or':_['map'](_0x7fd428[_0x3bb6('0x33')],function(_0x391f68){var _0xa65dc9={};_0xa65dc9[_0x391f68]={'$like':'%'+_0x334b2d['query']['filter']+'%'};return _0xa65dc9;})});}_0x7fd428=_[_0x3bb6('0x3f')]({},_0x7fd428,_0x334b2d[_0x3bb6('0x40')]);return _0x2ac268['getContacts'](_0x7fd428);}})['then'](function(_0x43e807){if(!_[_0x3bb6('0x6c')](_0x43e807)){var _0x5bfe3d=toCsv(_0x43e807);var _0x498257=Date['now']();fs[_0x3bb6('0x6d')](util[_0x3bb6('0x67')](_0x3bb6('0x6e'),_0x2ac268['id'],_0x498257),_0x5bfe3d);_0x4a37cf['setHeader'](_0x3bb6('0x6f'),'attachment;\x20filename='+util['format'](_0x3bb6('0x70'),_0x2ac268['id'],_0x498257));_0x4a37cf[_0x3bb6('0x71')](_0x3bb6('0x72'),_0x3bb6('0x73'));return _0x4a37cf[_0x3bb6('0x74')](util['format'](_0x3bb6('0x6e'),_0x2ac268['id'],_0x498257));}else{return _0x4a37cf[_0x3bb6('0x18')](0xcc);}})[_0x3bb6('0x43')](handleError(_0x4a37cf,null));};exports[_0x3bb6('0x75')]=function(_0x285d34,_0xf556e0,_0x14c447){var _0x4bfd29;delete _0x285d34['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x285d34[_0x3bb6('0x45')]['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0xf556e0,null))[_0x3bb6('0x23')](function(_0x3b7911){if(_0x3b7911){return db['sequelize'][_0x3bb6('0x76')](function(_0x290a05){return db[_0x3bb6('0x64')][_0x3bb6('0x47')](_0x285d34['body'],{'transaction':_0x290a05})[_0x3bb6('0x23')](function(_0x2a11df){_0x4bfd29=_0x2a11df;return _0x3b7911[_0x3bb6('0x77')](_0x2a11df,{'transaction':_0x290a05});})[_0x3bb6('0x23')](function(){var _0x202716={'type':db[_0x3bb6('0x78')][_0x3bb6('0x79')],'transaction':_0x290a05};switch(_0x285d34[_0x3bb6('0x48')][_0x3bb6('0x2c')]){case'text':_0x202716['type']=db[_0x3bb6('0x78')][_0x3bb6('0x79')];break;case'number':_0x202716[_0x3bb6('0x2c')]=db['Sequelize'][_0x3bb6('0x7a')];break;case _0x3bb6('0x7b'):_0x202716[_0x3bb6('0x2c')]=db[_0x3bb6('0x78')][_0x3bb6('0x7c')];_0x202716[_0x3bb6('0x7d')]=![];break;default:}return db[_0x3bb6('0x7e')][_0x3bb6('0x7f')][_0x3bb6('0x80')](_0x3bb6('0x81'),util[_0x3bb6('0x67')](_0x3bb6('0x82'),_0x4bfd29['id']),_0x202716);})[_0x3bb6('0x23')](function(){return _0x4bfd29;});});}})[_0x3bb6('0x23')](respondWithResult(_0xf556e0,null))[_0x3bb6('0x43')](handleError(_0xf556e0,null));};exports['getCustomFields']=function(_0x49c082,_0x3621b7,_0x15860b){var _0x498701={};var _0x58b787={};var _0x3df710;var _0x5e1f42;return db[_0x3bb6('0x2a')][_0x3bb6('0x83')]({'where':{'id':_0x49c082[_0x3bb6('0x45')]['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0x3621b7,null))[_0x3bb6('0x23')](function(_0x261633){if(_0x261633){_0x3df710=_0x261633;_0x58b787[_0x3bb6('0x2e')]=_[_0x3bb6('0x30')](db[_0x3bb6('0x64')][_0x3bb6('0x46')]);_0x58b787[_0x3bb6('0x2f')]=_['keys'](_0x49c082[_0x3bb6('0x2f')]);_0x58b787['filters']=_[_0x3bb6('0x32')](_0x58b787[_0x3bb6('0x2e')],_0x58b787[_0x3bb6('0x2f')]);_0x498701[_0x3bb6('0x33')]=_[_0x3bb6('0x32')](_0x58b787[_0x3bb6('0x2e')],qs[_0x3bb6('0x34')](_0x49c082[_0x3bb6('0x2f')][_0x3bb6('0x34')]));_0x498701['attributes']=_0x498701[_0x3bb6('0x33')][_0x3bb6('0x35')]?_0x498701[_0x3bb6('0x33')]:_0x58b787[_0x3bb6('0x2e')];_0x498701[_0x3bb6('0x39')]=qs[_0x3bb6('0x3a')](_0x49c082[_0x3bb6('0x2f')][_0x3bb6('0x3a')]);_0x498701[_0x3bb6('0x3d')]=qs[_0x3bb6('0x31')](_[_0x3bb6('0x3b')](_0x49c082['query'],_0x58b787[_0x3bb6('0x31')]));_0x498701['where']=_['merge'](_0x498701[_0x3bb6('0x3d')],{'$or':[{'ListId':_0x261633['id']},{'ListId':null}]});if(_0x49c082['query'][_0x3bb6('0x3c')]){_0x498701[_0x3bb6('0x3d')]=_[_0x3bb6('0x3f')](_0x498701[_0x3bb6('0x3d')],{'$or':_[_0x3bb6('0x29')](_0x498701[_0x3bb6('0x33')],function(_0x32f5d4){var _0x26e096={};_0x26e096[_0x32f5d4]={'$like':'%'+_0x49c082[_0x3bb6('0x2f')][_0x3bb6('0x3c')]+'%'};return _0x26e096;})});}_0x498701=_[_0x3bb6('0x3f')]({},_0x498701,_0x49c082[_0x3bb6('0x40')]);return db[_0x3bb6('0x64')]['findAndCountAll'](_0x498701);}})[_0x3bb6('0x23')](respondWithResult(_0x3621b7,null))[_0x3bb6('0x43')](handleError(_0x3621b7,null));};exports[_0x3bb6('0x84')]=function(_0x39a57c,_0x4d2ad7,_0x58facc){return db[_0x3bb6('0x2a')][_0x3bb6('0x4f')]({'where':{'id':_0x39a57c['params']['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0x4d2ad7,null))['then'](function(_0x4835c9){if(_0x4835c9){return _0x4835c9[_0x3bb6('0x84')](_0x39a57c[_0x3bb6('0x48')][_0x3bb6('0x5f')],_['omit'](_0x39a57c[_0x3bb6('0x48')],[_0x3bb6('0x5f'),'id'])||{})[_0x3bb6('0x85')](function(_0x195dc2){for(var _0x24fb0a=0x0;_0x24fb0a<_0x39a57c[_0x3bb6('0x48')]['ids'][_0x3bb6('0x35')];_0x24fb0a+=0x1){socket[_0x3bb6('0x86')](_0x3bb6('0x87'),{'UserId':_0x39a57c[_0x3bb6('0x48')]['ids'][_0x24fb0a],'CmListId':_0x39a57c['params']['id']});}return _0x195dc2;});}})['then'](respondWithResult(_0x4d2ad7,null))[_0x3bb6('0x43')](handleError(_0x4d2ad7,null));};exports[_0x3bb6('0x88')]=function(_0x55ab71,_0xf6d2e7,_0xb88bf3){return db[_0x3bb6('0x2a')][_0x3bb6('0x4f')]({'where':{'id':_0x55ab71['params']['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0xf6d2e7,null))[_0x3bb6('0x23')](function(_0x46da74){if(_0x46da74){return _0x46da74[_0x3bb6('0x88')](_0x55ab71[_0x3bb6('0x2f')][_0x3bb6('0x5f')])[_0x3bb6('0x23')](function(){if(_['isArray'](_0x55ab71[_0x3bb6('0x2f')][_0x3bb6('0x5f')])){for(var _0x3af00b=0x0;_0x3af00b<_0x55ab71['query'][_0x3bb6('0x5f')][_0x3bb6('0x35')];_0x3af00b+=0x1){socket['emit'](_0x3bb6('0x89'),{'UserId':Number(_0x55ab71[_0x3bb6('0x2f')][_0x3bb6('0x5f')][_0x3af00b]),'CmListId':Number(_0x55ab71[_0x3bb6('0x45')]['id'])});}}else{socket['emit'](_0x3bb6('0x89'),{'UserId':Number(_0x55ab71[_0x3bb6('0x2f')][_0x3bb6('0x5f')]),'CmListId':Number(_0x55ab71[_0x3bb6('0x45')]['id'])});}});}})[_0x3bb6('0x23')](respondWithStatusCode(_0xf6d2e7,null))['catch'](handleError(_0xf6d2e7,null));};exports[_0x3bb6('0x8a')]=function(_0x757dc4,_0x287371,_0x2f5c35){var _0x1660ef={};var _0x393882={};var _0x4b8508;var _0x215f18;return db[_0x3bb6('0x2a')][_0x3bb6('0x83')]({'where':{'id':_0x757dc4[_0x3bb6('0x45')]['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0x287371,null))['then'](function(_0x1d4378){if(_0x1d4378){_0x4b8508=_0x1d4378;_0x393882['model']=_[_0x3bb6('0x30')](db[_0x3bb6('0x8b')][_0x3bb6('0x46')]);_0x393882[_0x3bb6('0x2f')]=_[_0x3bb6('0x30')](_0x757dc4['query']);_0x393882[_0x3bb6('0x31')]=_[_0x3bb6('0x32')](_0x393882[_0x3bb6('0x2e')],_0x393882[_0x3bb6('0x2f')]);_0x1660ef['attributes']=_[_0x3bb6('0x32')](_0x393882[_0x3bb6('0x2e')],qs['fields'](_0x757dc4[_0x3bb6('0x2f')][_0x3bb6('0x34')]));_0x1660ef[_0x3bb6('0x33')]=_0x1660ef[_0x3bb6('0x33')][_0x3bb6('0x35')]?_0x1660ef[_0x3bb6('0x33')]:_0x393882['model'];_0x1660ef['order']=qs[_0x3bb6('0x3a')](_0x757dc4[_0x3bb6('0x2f')]['sort']);_0x1660ef[_0x3bb6('0x3d')]=qs[_0x3bb6('0x31')](_['pick'](_0x757dc4[_0x3bb6('0x2f')],_0x393882[_0x3bb6('0x31')]));if(_0x757dc4['query']['filter']){_0x1660ef[_0x3bb6('0x3d')]=_[_0x3bb6('0x3f')](_0x1660ef[_0x3bb6('0x3d')],{'$or':_[_0x3bb6('0x29')](_0x1660ef['attributes'],function(_0x1a9ee8){var _0x15eb13={};_0x15eb13[_0x1a9ee8]={'$like':'%'+_0x757dc4['query'][_0x3bb6('0x3c')]+'%'};return _0x15eb13;})});}_0x1660ef=_[_0x3bb6('0x3f')]({},_0x1660ef,_0x757dc4['options']);return _0x4b8508[_0x3bb6('0x8a')](_0x1660ef);}})[_0x3bb6('0x23')](function(_0xdf1f99){if(_0xdf1f99){_0x215f18=_0xdf1f99['length'];if(!_0x757dc4[_0x3bb6('0x2f')][_0x3bb6('0x36')]('nolimit')){_0x1660ef[_0x3bb6('0x1d')]=qs[_0x3bb6('0x1d')](_0x757dc4[_0x3bb6('0x2f')][_0x3bb6('0x1d')]);_0x1660ef[_0x3bb6('0x38')]=qs[_0x3bb6('0x38')](_0x757dc4[_0x3bb6('0x2f')][_0x3bb6('0x38')]);}return _0x4b8508[_0x3bb6('0x8a')](_0x1660ef);}})[_0x3bb6('0x23')](function(_0x2f091c){if(_0x2f091c){return _0x2f091c?{'count':_0x215f18,'rows':_0x2f091c}:null;}})[_0x3bb6('0x23')](respondWithResult(_0x287371,null))[_0x3bb6('0x43')](handleError(_0x287371,null));}; \ No newline at end of file +var _0x3698=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','UserProfileResource','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','CmList','count','include','rows','show','params','rawAttributes','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','includeAll','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','each','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','isEmpty','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis'];(function(_0x1e6e3a,_0x432fac){var _0x2a4daf=function(_0xeeb55c){while(--_0xeeb55c){_0x1e6e3a['push'](_0x1e6e3a['shift']());}};_0x2a4daf(++_0x432fac);}(_0x3698,0x10e));var _0x8369=function(_0x186e7c,_0x542c10){_0x186e7c=_0x186e7c-0x0;var _0x1715e3=_0x3698[_0x186e7c];return _0x1715e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8369('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8369('0x1'));var rp=require(_0x8369('0x2'));var moment=require(_0x8369('0x3'));var BPromise=require(_0x8369('0x4'));var Mustache=require(_0x8369('0x5'));var util=require(_0x8369('0x6'));var path=require(_0x8369('0x7'));var sox=require('sox');var csv=require(_0x8369('0x8'));var ejs=require(_0x8369('0x9'));var fs=require('fs');var _=require(_0x8369('0xa'));var squel=require(_0x8369('0xb'));var crypto=require(_0x8369('0xc'));var jsforce=require(_0x8369('0xd'));var deskjs=require(_0x8369('0xe'));var toCsv=require(_0x8369('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8369('0xf'));var authService=require(_0x8369('0x10'));var qs=require(_0x8369('0x11'));var as=require(_0x8369('0x12'));var hardwareService=require(_0x8369('0x13'));var logger=require(_0x8369('0x14'))(_0x8369('0x15'));var utils=require(_0x8369('0x16'));var config=require(_0x8369('0x17'));var db=require('../../mysqldb')['db'];config[_0x8369('0x18')]=_[_0x8369('0x19')](config[_0x8369('0x18')],{'host':_0x8369('0x1a'),'port':0x18eb});var socket=require(_0x8369('0x1b'))(new Redis(config['redis']));require(_0x8369('0x1c'))[_0x8369('0x1d')](socket);function respondWithStatusCode(_0x2a9026,_0x390bd6){_0x390bd6=_0x390bd6||0xcc;return function(_0x5b8842){if(_0x5b8842){return _0x2a9026[_0x8369('0x1e')](_0x390bd6);}return _0x2a9026['status'](_0x390bd6)[_0x8369('0x1f')]();};}function respondWithResult(_0x161690,_0x322c7a){_0x322c7a=_0x322c7a||0xc8;return function(_0x277d48){if(_0x277d48){return _0x161690[_0x8369('0x20')](_0x322c7a)['json'](_0x277d48);}};}function respondWithFilteredResult(_0x5305b7,_0xb97100){return function(_0x15d538){if(_0x15d538){var _0x22263c=_0x15d538['count'],_0xa8385a=_0xb97100[_0x8369('0x21')],_0x27570b=_0xb97100[_0x8369('0x21')]+_0xb97100[_0x8369('0x22')],_0x12721c;if(_0x27570b>=_0x22263c){_0x27570b=_0x22263c;_0x12721c=0xc8;}else{_0x12721c=0xce;}_0x5305b7[_0x8369('0x20')](_0x12721c);return _0x5305b7[_0x8369('0x23')](_0x8369('0x24'),_0xa8385a+'-'+_0x27570b+'/'+_0x22263c)[_0x8369('0x25')](_0x15d538);}return null;};}function patchUpdates(_0x36cfc8){return function(_0x4d0a9e){try{jsonpatch[_0x8369('0x26')](_0x4d0a9e,_0x36cfc8,!![]);}catch(_0x11f050){return BPromise['reject'](_0x11f050);}return _0x4d0a9e[_0x8369('0x27')]();};}function saveUpdates(_0x46b343,_0x2c1395){return function(_0x9912e8){if(_0x9912e8){return _0x9912e8[_0x8369('0x28')](_0x46b343)[_0x8369('0x29')](function(_0x3e5f5c){return _0x3e5f5c;});}return null;};}function removeEntity(_0x31dadd,_0x533984){return function(_0x3be141){if(_0x3be141){return _0x3be141[_0x8369('0x2a')]()['then'](function(){var _0x2afb23=_0x3be141['get']({'plain':!![]});var _0x14fdb5='Lists';return db[_0x8369('0x2b')]['destroy']({'where':{'type':_0x14fdb5,'resourceId':_0x2afb23['id']}})['then'](function(){return _0x3be141;});})[_0x8369('0x29')](function(){_0x31dadd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x252ea3,_0x54be12){return function(_0x5d8d5e){if(!_0x5d8d5e){_0x252ea3['sendStatus'](0x194);}return _0x5d8d5e;};}function handleError(_0xc1c550,_0x48adf9){_0x48adf9=_0x48adf9||0x1f4;return function(_0x54f8c3){logger['error'](_0x54f8c3['stack']);if(_0x54f8c3[_0x8369('0x2c')]){delete _0x54f8c3[_0x8369('0x2c')];}_0xc1c550['status'](_0x48adf9)[_0x8369('0x2d')](_0x54f8c3);};}exports['index']=function(_0x596a1e,_0xfc6b04){var _0x388c40={},_0x3792bc={},_0x11a88e={'count':0x0,'rows':[]};var _0x1988a7=_[_0x8369('0x2e')](db['CmList']['rawAttributes'],function(_0x571aa2){return{'name':_0x571aa2[_0x8369('0x2f')],'type':_0x571aa2[_0x8369('0x30')][_0x8369('0x31')]};});_0x3792bc[_0x8369('0x32')]=_[_0x8369('0x2e')](_0x1988a7,'name');_0x3792bc['query']=_[_0x8369('0x33')](_0x596a1e[_0x8369('0x34')]);_0x3792bc[_0x8369('0x35')]=_[_0x8369('0x36')](_0x3792bc[_0x8369('0x32')],_0x3792bc[_0x8369('0x34')]);_0x388c40[_0x8369('0x37')]=_[_0x8369('0x36')](_0x3792bc['model'],qs[_0x8369('0x38')](_0x596a1e[_0x8369('0x34')][_0x8369('0x38')]));_0x388c40[_0x8369('0x37')]=_0x388c40[_0x8369('0x37')][_0x8369('0x39')]?_0x388c40[_0x8369('0x37')]:_0x3792bc[_0x8369('0x32')];if(!_0x596a1e[_0x8369('0x34')][_0x8369('0x3a')](_0x8369('0x3b'))){_0x388c40[_0x8369('0x22')]=qs[_0x8369('0x22')](_0x596a1e[_0x8369('0x34')][_0x8369('0x22')]);_0x388c40[_0x8369('0x21')]=qs[_0x8369('0x21')](_0x596a1e['query'][_0x8369('0x21')]);}_0x388c40[_0x8369('0x3c')]=qs[_0x8369('0x3d')](_0x596a1e[_0x8369('0x34')][_0x8369('0x3d')]);_0x388c40['where']=qs[_0x8369('0x35')](_[_0x8369('0x3e')](_0x596a1e['query'],_0x3792bc[_0x8369('0x35')]),_0x1988a7);if(_0x596a1e['query'][_0x8369('0x3f')]){_0x388c40[_0x8369('0x40')]=_['merge'](_0x388c40[_0x8369('0x40')],{'$or':_[_0x8369('0x2e')](_0x1988a7,function(_0x486a9a){if(_0x486a9a[_0x8369('0x30')]!==_0x8369('0x41')){var _0x4c3648={};_0x4c3648[_0x486a9a[_0x8369('0x2c')]]={'$like':'%'+_0x596a1e['query'][_0x8369('0x3f')]+'%'};return _0x4c3648;}})});}_0x388c40=_[_0x8369('0x42')]({},_0x388c40,_0x596a1e[_0x8369('0x43')]);var _0x359d75={'where':_0x388c40[_0x8369('0x40')]};return db[_0x8369('0x44')]['count'](_0x359d75)[_0x8369('0x29')](function(_0x184918){_0x11a88e[_0x8369('0x45')]=_0x184918;if(_0x596a1e[_0x8369('0x34')]['includeAll']){_0x388c40[_0x8369('0x46')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x388c40);})[_0x8369('0x29')](function(_0x373fc5){_0x11a88e[_0x8369('0x47')]=_0x373fc5;return _0x11a88e;})['then'](respondWithFilteredResult(_0xfc6b04,_0x388c40))['catch'](handleError(_0xfc6b04,null));};exports[_0x8369('0x48')]=function(_0x318e12,_0x3fc5dd){var _0x413b08={'raw':![],'where':{'id':_0x318e12[_0x8369('0x49')]['id']}},_0x333f5b={};_0x333f5b[_0x8369('0x32')]=_[_0x8369('0x33')](db['CmList'][_0x8369('0x4a')]);_0x333f5b[_0x8369('0x34')]=_['keys'](_0x318e12[_0x8369('0x34')]);_0x333f5b[_0x8369('0x35')]=_[_0x8369('0x36')](_0x333f5b[_0x8369('0x32')],_0x333f5b[_0x8369('0x34')]);_0x413b08[_0x8369('0x37')]=_[_0x8369('0x36')](_0x333f5b[_0x8369('0x32')],qs[_0x8369('0x38')](_0x318e12[_0x8369('0x34')][_0x8369('0x38')]));_0x413b08['attributes']=_0x413b08['attributes'][_0x8369('0x39')]?_0x413b08[_0x8369('0x37')]:_0x333f5b[_0x8369('0x32')];if(_0x318e12[_0x8369('0x34')]['includeAll']){_0x413b08[_0x8369('0x46')]=[{'all':!![]}];}_0x413b08=_[_0x8369('0x42')]({},_0x413b08,_0x318e12[_0x8369('0x43')]);return db['CmList']['find'](_0x413b08)[_0x8369('0x29')](handleEntityNotFound(_0x3fc5dd,null))[_0x8369('0x29')](respondWithResult(_0x3fc5dd,null))[_0x8369('0x4b')](handleError(_0x3fc5dd,null));};exports[_0x8369('0x4c')]=function(_0x946d3c,_0x422a00){return db['CmList']['create'](_0x946d3c[_0x8369('0x4d')],{})[_0x8369('0x29')](function(_0x4469eb){var _0x379050=_0x946d3c[_0x8369('0x4e')][_0x8369('0x4f')]({'plain':!![]});if(!_0x379050)throw new Error(_0x8369('0x50'));if(_0x379050['role']===_0x8369('0x4e')){var _0x49e9bd=_0x4469eb[_0x8369('0x4f')]({'plain':!![]});var _0x50b87f=_0x8369('0x51');return db[_0x8369('0x52')][_0x8369('0x53')]({'where':{'name':_0x50b87f,'userProfileId':_0x379050[_0x8369('0x54')]},'raw':!![]})['then'](function(_0x13acfb){if(_0x13acfb&&_0x13acfb[_0x8369('0x55')]===0x0){return db[_0x8369('0x2b')]['create']({'name':_0x49e9bd[_0x8369('0x2c')],'resourceId':_0x49e9bd['id'],'type':_0x13acfb[_0x8369('0x2c')],'sectionId':_0x13acfb['id']},{})[_0x8369('0x29')](function(){return _0x4469eb;});}else{return _0x4469eb;}})[_0x8369('0x4b')](function(_0x2b91b8){logger['error'](_0x8369('0x56'),_0x2b91b8);throw _0x2b91b8;});}return _0x4469eb;})[_0x8369('0x29')](respondWithResult(_0x422a00,0xc9))[_0x8369('0x4b')](handleError(_0x422a00,null));};exports[_0x8369('0x28')]=function(_0x1fbc5e,_0x5b3a23){if(_0x1fbc5e[_0x8369('0x4d')]['id']){delete _0x1fbc5e[_0x8369('0x4d')]['id'];}return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x1fbc5e[_0x8369('0x49')]['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x5b3a23,null))[_0x8369('0x29')](saveUpdates(_0x1fbc5e[_0x8369('0x4d')],null))[_0x8369('0x29')](respondWithResult(_0x5b3a23,null))[_0x8369('0x4b')](handleError(_0x5b3a23,null));};exports[_0x8369('0x2a')]=function(_0x45b2de,_0x7ff8a1){return db['CmList'][_0x8369('0x53')]({'where':{'id':_0x45b2de['params']['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x7ff8a1,null))[_0x8369('0x29')](removeEntity(_0x7ff8a1,null))[_0x8369('0x4b')](handleError(_0x7ff8a1,null));};exports[_0x8369('0x57')]=function(_0x386cd6,_0x4120ca){return db['CmList'][_0x8369('0x57')]()[_0x8369('0x29')](respondWithResult(_0x4120ca,null))[_0x8369('0x4b')](handleError(_0x4120ca,null));};exports[_0x8369('0x58')]=function(_0x29609b,_0x9f9e9d,_0x362dc9){if(_0x29609b[_0x8369('0x4d')]['id']){delete _0x29609b[_0x8369('0x4d')]['id'];}return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x29609b[_0x8369('0x49')]['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x9f9e9d,null))[_0x8369('0x29')](function(_0x589031){if(_0x589031){_0x29609b[_0x8369('0x4d')][_0x8369('0x59')]=_0x589031['id'];return db['Disposition']['create'](_0x29609b['body']);}})[_0x8369('0x29')](respondWithResult(_0x9f9e9d,null))['catch'](handleError(_0x9f9e9d,null));};exports['getDispositions']=function(_0x1d051e,_0x5dc0ec,_0x4cf349){var _0x55022a={'raw':![],'where':{}};var _0x114f06={};var _0x413c13={'count':0x0,'rows':[]};return db[_0x8369('0x44')]['findOne']({'where':{'id':_0x1d051e[_0x8369('0x49')]['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x5dc0ec,null))[_0x8369('0x29')](function(_0x1f858a){if(_0x1f858a){_0x114f06[_0x8369('0x32')]=_[_0x8369('0x33')](db[_0x8369('0x5a')]['rawAttributes']);_0x114f06[_0x8369('0x34')]=_['keys'](_0x1d051e['query']);_0x114f06['filters']=_[_0x8369('0x36')](_0x114f06['model'],_0x114f06[_0x8369('0x34')]);_0x55022a['attributes']=_[_0x8369('0x36')](_0x114f06['model'],qs['fields'](_0x1d051e[_0x8369('0x34')]['fields']));_0x55022a['attributes']=_0x55022a[_0x8369('0x37')][_0x8369('0x39')]?_0x55022a[_0x8369('0x37')]:_0x114f06['model'];if(!_0x1d051e[_0x8369('0x34')][_0x8369('0x3a')](_0x8369('0x3b'))){_0x55022a[_0x8369('0x22')]=qs[_0x8369('0x22')](_0x1d051e['query'][_0x8369('0x22')]);_0x55022a[_0x8369('0x21')]=qs[_0x8369('0x21')](_0x1d051e['query'][_0x8369('0x21')]);}_0x55022a[_0x8369('0x3c')]=qs[_0x8369('0x3d')](_0x1d051e[_0x8369('0x34')][_0x8369('0x3d')]);_0x55022a[_0x8369('0x40')]=qs[_0x8369('0x35')](_['pick'](_0x1d051e['query'],_0x114f06[_0x8369('0x35')]));_0x55022a[_0x8369('0x40')][_0x8369('0x59')]=_0x1f858a['id'];if(_0x1d051e['query'][_0x8369('0x3f')]){_0x55022a['where']=_[_0x8369('0x42')](_0x55022a[_0x8369('0x40')],{'$or':_[_0x8369('0x2e')](_0x55022a[_0x8369('0x37')],function(_0x57a241){var _0x51bdd7={};_0x51bdd7[_0x57a241]={'$like':'%'+_0x1d051e[_0x8369('0x34')][_0x8369('0x3f')]+'%'};return _0x51bdd7;})});}_0x55022a=_[_0x8369('0x42')]({},_0x55022a,_0x1d051e[_0x8369('0x43')]);return db['Disposition'][_0x8369('0x45')]({'where':_0x55022a['where']})[_0x8369('0x29')](function(_0x1b883d){_0x413c13[_0x8369('0x45')]=_0x1b883d;if(_0x1d051e[_0x8369('0x34')][_0x8369('0x5b')]){_0x55022a[_0x8369('0x46')]=[{'all':!![]}];}return db[_0x8369('0x5a')][_0x8369('0x5c')](_0x55022a);})['then'](function(_0x125c1d){_0x413c13[_0x8369('0x47')]=_0x125c1d;return _0x413c13;});}})[_0x8369('0x29')](respondWithFilteredResult(_0x5dc0ec,_0x55022a))['catch'](handleError(_0x5dc0ec,null));};exports[_0x8369('0x5d')]=function(_0x2ca85e,_0x45c97c,_0x58d369){return db[_0x8369('0x44')]['find']({'where':{'id':_0x2ca85e['params']['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x45c97c,null))[_0x8369('0x29')](function(_0x3567ad){if(_0x3567ad){return _0x3567ad[_0x8369('0x5d')](_0x2ca85e[_0x8369('0x34')][_0x8369('0x5e')]);}})[_0x8369('0x29')](respondWithStatusCode(_0x45c97c,null))['catch'](handleError(_0x45c97c,null));};exports[_0x8369('0x5f')]=function(_0x318671,_0x55cab4,_0x2a6731){return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x318671[_0x8369('0x49')]['id']}})['then'](handleEntityNotFound(_0x55cab4,null))[_0x8369('0x29')](function(_0xdd0787){if(_0xdd0787){var _0xbd79d7=[];var _0x3b6dac={'success':[],'errors':[]};return db[_0x8369('0x60')][_0x8369('0x57')]()['then'](function(_0x47d6f8){if(_0x318671[_0x8369('0x4d')]['tags']&&_['isArray'](_0x318671[_0x8369('0x4d')][_0x8369('0x61')])){if(_0x318671['body'][_0x8369('0x61')]['length']){_0x318671['body'][_0x8369('0x61')]=_0x318671['body'][_0x8369('0x61')]['join'](';')+';';}else{_0x318671[_0x8369('0x4d')][_0x8369('0x61')]=null;}}else{_0x318671['body'][_0x8369('0x61')]=null;}if(_0x318671[_0x8369('0x4d')]&&_[_0x8369('0x62')](_0x318671['body'])){for(var _0x2d3022=0x0;_0x2d3022<_0x318671[_0x8369('0x4d')]['length'];_0x2d3022+=0x1){_0x318671[_0x8369('0x4d')][_0x2d3022][_0x8369('0x59')]=_0x318671[_0x8369('0x49')]['id'];_0xbd79d7['push'](_0x318671['body'][_0x2d3022]);}return BPromise[_0x8369('0x63')](_0xbd79d7,function(_0x183b95){return db[_0x8369('0x60')][_0x8369('0x4c')](_[_0x8369('0x64')](_0x183b95,[_0x8369('0x5e'),'id'])||{},{'fields':_[_0x8369('0x33')](_0x47d6f8),'raw':!![]})['then'](function(_0x4da355){_0x3b6dac[_0x8369('0x65')][_0x8369('0x66')](_0x4da355[_0x8369('0x67')]);})[_0x8369('0x4b')](function(_0x8011cf){_0x3b6dac[_0x8369('0x68')][_0x8369('0x66')]({'data':_0x183b95,'error':_0x8011cf[_0x8369('0x69')]});});})[_0x8369('0x29')](function(_0x20ecb7){return _0x3b6dac;})[_0x8369('0x4b')](function(_0x4dca0b){return _0x4dca0b;});}else{_0x55cab4[_0x8369('0x20')](0x190)['json']({'message':_0x8369('0x6a')});}});}})[_0x8369('0x29')](respondWithResult(_0x55cab4,null))['catch'](handleError(_0x55cab4,null));};exports[_0x8369('0x6b')]=function(_0x6c1fe5,_0x3bf527,_0x12f43a){var _0x4ddb6;return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x6c1fe5[_0x8369('0x49')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x8369('0x6c')}]})[_0x8369('0x29')](handleEntityNotFound(_0x3bf527,null))[_0x8369('0x29')](function(_0x5c8a88){if(_0x5c8a88){_0x4ddb6=_0x5c8a88;return db[_0x8369('0x60')][_0x8369('0x4a')];}})[_0x8369('0x29')](function(_0x316a7e){if(_0x316a7e){var _0x1c89ec={};var _0x246f81={};_0x246f81['model']=_[_0x8369('0x6d')](_[_0x8369('0x33')](_0x316a7e),_[_0x8369('0x2e')](_0x4ddb6[_0x8369('0x6c')],function(_0x1469fc){return util[_0x8369('0x6e')](_0x8369('0x6f'),_0x1469fc['id']);}));_0x246f81['query']=_[_0x8369('0x33')](_0x6c1fe5[_0x8369('0x34')]);_0x246f81[_0x8369('0x35')]=_['intersection'](_0x246f81[_0x8369('0x32')],_0x246f81[_0x8369('0x34')]);_0x1c89ec['attributes']=_[_0x8369('0x36')](_0x246f81[_0x8369('0x32')],qs[_0x8369('0x38')](_0x6c1fe5[_0x8369('0x34')][_0x8369('0x38')]));_0x1c89ec['attributes']=_0x1c89ec[_0x8369('0x37')][_0x8369('0x39')]?_0x1c89ec[_0x8369('0x37')]:_0x246f81[_0x8369('0x32')];if(!_0x6c1fe5[_0x8369('0x34')][_0x8369('0x3a')](_0x8369('0x3b'))){_0x1c89ec['limit']=qs[_0x8369('0x22')](_0x6c1fe5[_0x8369('0x34')][_0x8369('0x22')]);_0x1c89ec[_0x8369('0x21')]=qs[_0x8369('0x21')](_0x6c1fe5[_0x8369('0x34')][_0x8369('0x21')]);}_0x1c89ec['order']=qs[_0x8369('0x3d')](_0x6c1fe5[_0x8369('0x34')][_0x8369('0x3d')]);_0x1c89ec[_0x8369('0x40')]=qs[_0x8369('0x35')](_[_0x8369('0x3e')](_0x6c1fe5[_0x8369('0x34')],_0x246f81[_0x8369('0x35')]));_0x1c89ec[_0x8369('0x70')]=!![];if(_0x6c1fe5[_0x8369('0x34')]['filter']){_0x1c89ec[_0x8369('0x40')]=_[_0x8369('0x42')](_0x1c89ec[_0x8369('0x40')],{'$or':_[_0x8369('0x2e')](_0x1c89ec[_0x8369('0x37')],function(_0x2d0e73){var _0x8b3e1e={};_0x8b3e1e[_0x2d0e73]={'$like':'%'+_0x6c1fe5[_0x8369('0x34')][_0x8369('0x3f')]+'%'};return _0x8b3e1e;})});}_0x1c89ec=_[_0x8369('0x42')]({},_0x1c89ec,_0x6c1fe5[_0x8369('0x43')]);return _0x4ddb6[_0x8369('0x6b')](_0x1c89ec);}})[_0x8369('0x29')](respondWithResult(_0x3bf527,null))[_0x8369('0x4b')](handleError(_0x3bf527,null));};exports[_0x8369('0x71')]=function(_0x558355,_0x46d029,_0x3cb61e){var _0x5a7ecc;return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x558355['params']['id']},'include':[{'model':db[_0x8369('0x72')],'as':_0x8369('0x6c')}]})[_0x8369('0x29')](handleEntityNotFound(_0x46d029,null))['then'](function(_0x4530bd){if(_0x4530bd){_0x5a7ecc=_0x4530bd;return db[_0x8369('0x60')][_0x8369('0x4a')];}})[_0x8369('0x29')](function(_0x415709){if(_0x415709){var _0x3e455c={};var _0x3951e0={};_0x3951e0[_0x8369('0x32')]=_['concat'](_[_0x8369('0x33')](_0x415709),_['map'](_0x5a7ecc[_0x8369('0x6c')],function(_0x4b98d7){return util[_0x8369('0x6e')](_0x8369('0x6f'),_0x4b98d7['id']);}));_0x3951e0[_0x8369('0x34')]=_['keys'](_0x558355[_0x8369('0x34')]);_0x3951e0[_0x8369('0x35')]=_[_0x8369('0x36')](_0x3951e0[_0x8369('0x32')],_0x3951e0[_0x8369('0x34')]);_0x3e455c['attributes']=_['intersection'](_0x3951e0[_0x8369('0x32')],qs['fields'](_0x558355[_0x8369('0x34')][_0x8369('0x38')]));_0x3e455c[_0x8369('0x37')]=_0x3e455c[_0x8369('0x37')][_0x8369('0x39')]?_0x3e455c[_0x8369('0x37')]:_0x3951e0[_0x8369('0x32')];if(!_0x558355['query']['hasOwnProperty'](_0x8369('0x3b'))){_0x3e455c['limit']=qs[_0x8369('0x22')](_0x558355['query'][_0x8369('0x22')]);_0x3e455c[_0x8369('0x21')]=qs['offset'](_0x558355[_0x8369('0x34')]['offset']);}_0x3e455c[_0x8369('0x3c')]=qs[_0x8369('0x3d')](_0x558355['query'][_0x8369('0x3d')]);_0x3e455c[_0x8369('0x40')]=qs[_0x8369('0x35')](_[_0x8369('0x3e')](_0x558355[_0x8369('0x34')],_0x3951e0[_0x8369('0x35')]));_0x3e455c[_0x8369('0x70')]=!![];if(_0x558355[_0x8369('0x34')][_0x8369('0x3f')]){_0x3e455c['where']=_[_0x8369('0x42')](_0x3e455c[_0x8369('0x40')],{'$or':_[_0x8369('0x2e')](_0x3e455c[_0x8369('0x37')],function(_0x22b2e5){var _0x2f2c29={};_0x2f2c29[_0x22b2e5]={'$like':'%'+_0x558355[_0x8369('0x34')][_0x8369('0x3f')]+'%'};return _0x2f2c29;})});}_0x3e455c=_[_0x8369('0x42')]({},_0x3e455c,_0x558355[_0x8369('0x43')]);return _0x5a7ecc[_0x8369('0x6b')](_0x3e455c);}})['then'](function(_0x17332a){if(!_[_0x8369('0x73')](_0x17332a)){var _0x1fbbeb=toCsv(_0x17332a);var _0x122be4=Date['now']();fs['writeFileSync'](util[_0x8369('0x6e')]('/tmp/list_%d_%s.csv',_0x5a7ecc['id'],_0x122be4),_0x1fbbeb);_0x46d029[_0x8369('0x74')]('Content-disposition',_0x8369('0x75')+util[_0x8369('0x6e')](_0x8369('0x76'),_0x5a7ecc['id'],_0x122be4));_0x46d029[_0x8369('0x74')](_0x8369('0x77'),'text/csv');return _0x46d029['download'](util[_0x8369('0x6e')]('/tmp/list_%d_%s.csv',_0x5a7ecc['id'],_0x122be4));}else{return _0x46d029[_0x8369('0x1e')](0xcc);}})['catch'](handleError(_0x46d029,null));};exports[_0x8369('0x78')]=function(_0x1d4c75,_0x4726ff,_0x3ae0e0){var _0x2b58a8;delete _0x1d4c75['body']['id'];return db['CmList'][_0x8369('0x79')]({'where':{'id':_0x1d4c75[_0x8369('0x49')]['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x4726ff,null))[_0x8369('0x29')](function(_0x5cf71d){if(_0x5cf71d){return db[_0x8369('0x7a')][_0x8369('0x7b')](function(_0x308fa2){return db['CmCustomField'][_0x8369('0x4c')](_0x1d4c75[_0x8369('0x4d')],{'transaction':_0x308fa2})[_0x8369('0x29')](function(_0x465209){_0x2b58a8=_0x465209;return _0x5cf71d[_0x8369('0x7c')](_0x465209,{'transaction':_0x308fa2});})['then'](function(){var _0x186336={'type':db[_0x8369('0x7d')][_0x8369('0x7e')],'transaction':_0x308fa2};switch(_0x1d4c75['body'][_0x8369('0x30')]){case _0x8369('0x7f'):_0x186336[_0x8369('0x30')]=db[_0x8369('0x7d')][_0x8369('0x7e')];break;case'number':_0x186336[_0x8369('0x30')]=db[_0x8369('0x7d')]['INTEGER'];break;case _0x8369('0x80'):_0x186336[_0x8369('0x30')]=db[_0x8369('0x7d')][_0x8369('0x81')];_0x186336[_0x8369('0x82')]=![];break;default:}return db[_0x8369('0x7a')][_0x8369('0x83')][_0x8369('0x84')](_0x8369('0x85'),util['format'](_0x8369('0x86'),_0x2b58a8['id']),_0x186336);})['then'](function(){return _0x2b58a8;});});}})['then'](respondWithResult(_0x4726ff,null))[_0x8369('0x4b')](handleError(_0x4726ff,null));};exports['getCustomFields']=function(_0x16a5bb,_0x4a898b,_0x3f9aa4){var _0x4fda91={};var _0x500844={};var _0xf0cc75;var _0x293eeb;return db['CmList'][_0x8369('0x79')]({'where':{'id':_0x16a5bb[_0x8369('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a898b,null))[_0x8369('0x29')](function(_0x16069d){if(_0x16069d){_0xf0cc75=_0x16069d;_0x500844[_0x8369('0x32')]=_[_0x8369('0x33')](db['CmCustomField'][_0x8369('0x4a')]);_0x500844[_0x8369('0x34')]=_['keys'](_0x16a5bb[_0x8369('0x34')]);_0x500844['filters']=_['intersection'](_0x500844['model'],_0x500844[_0x8369('0x34')]);_0x4fda91[_0x8369('0x37')]=_[_0x8369('0x36')](_0x500844[_0x8369('0x32')],qs[_0x8369('0x38')](_0x16a5bb['query'][_0x8369('0x38')]));_0x4fda91[_0x8369('0x37')]=_0x4fda91[_0x8369('0x37')][_0x8369('0x39')]?_0x4fda91[_0x8369('0x37')]:_0x500844[_0x8369('0x32')];_0x4fda91[_0x8369('0x3c')]=qs[_0x8369('0x3d')](_0x16a5bb[_0x8369('0x34')][_0x8369('0x3d')]);_0x4fda91[_0x8369('0x40')]=qs['filters'](_['pick'](_0x16a5bb['query'],_0x500844[_0x8369('0x35')]));_0x4fda91[_0x8369('0x40')]=_[_0x8369('0x42')](_0x4fda91[_0x8369('0x40')],{'$or':[{'ListId':_0x16069d['id']},{'ListId':null}]});if(_0x16a5bb[_0x8369('0x34')][_0x8369('0x3f')]){_0x4fda91[_0x8369('0x40')]=_[_0x8369('0x42')](_0x4fda91[_0x8369('0x40')],{'$or':_[_0x8369('0x2e')](_0x4fda91[_0x8369('0x37')],function(_0x1e6633){var _0x53b67f={};_0x53b67f[_0x1e6633]={'$like':'%'+_0x16a5bb[_0x8369('0x34')]['filter']+'%'};return _0x53b67f;})});}_0x4fda91=_['merge']({},_0x4fda91,_0x16a5bb[_0x8369('0x43')]);return db[_0x8369('0x72')][_0x8369('0x87')](_0x4fda91);}})[_0x8369('0x29')](respondWithResult(_0x4a898b,null))[_0x8369('0x4b')](handleError(_0x4a898b,null));};exports['addAgents']=function(_0x3ac6a4,_0x5a8acc,_0x57e257){return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x3ac6a4[_0x8369('0x49')]['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x5a8acc,null))[_0x8369('0x29')](function(_0x1dbfdf){if(_0x1dbfdf){return _0x1dbfdf[_0x8369('0x88')](_0x3ac6a4['body'][_0x8369('0x5e')],_['omit'](_0x3ac6a4[_0x8369('0x4d')],[_0x8369('0x5e'),'id'])||{})[_0x8369('0x89')](function(_0x1f3898){for(var _0x14e0c6=0x0;_0x14e0c6<_0x3ac6a4[_0x8369('0x4d')][_0x8369('0x5e')][_0x8369('0x39')];_0x14e0c6+=0x1){socket[_0x8369('0x8a')](_0x8369('0x8b'),{'UserId':_0x3ac6a4['body'][_0x8369('0x5e')][_0x14e0c6],'CmListId':_0x3ac6a4['params']['id']});}return _0x1f3898;});}})[_0x8369('0x29')](respondWithResult(_0x5a8acc,null))['catch'](handleError(_0x5a8acc,null));};exports[_0x8369('0x8c')]=function(_0x444c19,_0x12b811,_0x4a9d18){return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x444c19[_0x8369('0x49')]['id']}})['then'](handleEntityNotFound(_0x12b811,null))[_0x8369('0x29')](function(_0x186a85){if(_0x186a85){return _0x186a85[_0x8369('0x8c')](_0x444c19[_0x8369('0x34')][_0x8369('0x5e')])[_0x8369('0x29')](function(){if(_[_0x8369('0x62')](_0x444c19[_0x8369('0x34')][_0x8369('0x5e')])){for(var _0x38f821=0x0;_0x38f821<_0x444c19['query'][_0x8369('0x5e')][_0x8369('0x39')];_0x38f821+=0x1){socket[_0x8369('0x8a')](_0x8369('0x8d'),{'UserId':Number(_0x444c19[_0x8369('0x34')]['ids'][_0x38f821]),'CmListId':Number(_0x444c19[_0x8369('0x49')]['id'])});}}else{socket[_0x8369('0x8a')](_0x8369('0x8d'),{'UserId':Number(_0x444c19[_0x8369('0x34')][_0x8369('0x5e')]),'CmListId':Number(_0x444c19[_0x8369('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x12b811,null))['catch'](handleError(_0x12b811,null));};exports[_0x8369('0x8e')]=function(_0x1013c8,_0x35767d,_0x23a0e7){var _0x545790={};var _0x5b9104={};var _0x3a2799;var _0x1adc20;return db[_0x8369('0x44')]['findOne']({'where':{'id':_0x1013c8[_0x8369('0x49')]['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x35767d,null))['then'](function(_0x58bee6){if(_0x58bee6){_0x3a2799=_0x58bee6;_0x5b9104[_0x8369('0x32')]=_['keys'](db['User'][_0x8369('0x4a')]);_0x5b9104['query']=_[_0x8369('0x33')](_0x1013c8[_0x8369('0x34')]);_0x5b9104[_0x8369('0x35')]=_[_0x8369('0x36')](_0x5b9104[_0x8369('0x32')],_0x5b9104[_0x8369('0x34')]);_0x545790[_0x8369('0x37')]=_['intersection'](_0x5b9104[_0x8369('0x32')],qs[_0x8369('0x38')](_0x1013c8[_0x8369('0x34')][_0x8369('0x38')]));_0x545790['attributes']=_0x545790[_0x8369('0x37')][_0x8369('0x39')]?_0x545790[_0x8369('0x37')]:_0x5b9104[_0x8369('0x32')];_0x545790[_0x8369('0x3c')]=qs[_0x8369('0x3d')](_0x1013c8[_0x8369('0x34')]['sort']);_0x545790[_0x8369('0x40')]=qs[_0x8369('0x35')](_[_0x8369('0x3e')](_0x1013c8[_0x8369('0x34')],_0x5b9104['filters']));if(_0x1013c8[_0x8369('0x34')]['filter']){_0x545790[_0x8369('0x40')]=_[_0x8369('0x42')](_0x545790[_0x8369('0x40')],{'$or':_[_0x8369('0x2e')](_0x545790[_0x8369('0x37')],function(_0xad0073){var _0x1bbb42={};_0x1bbb42[_0xad0073]={'$like':'%'+_0x1013c8[_0x8369('0x34')][_0x8369('0x3f')]+'%'};return _0x1bbb42;})});}_0x545790=_[_0x8369('0x42')]({},_0x545790,_0x1013c8[_0x8369('0x43')]);return _0x3a2799['getAgents'](_0x545790);}})['then'](function(_0x123a87){if(_0x123a87){_0x1adc20=_0x123a87[_0x8369('0x39')];if(!_0x1013c8[_0x8369('0x34')][_0x8369('0x3a')](_0x8369('0x3b'))){_0x545790[_0x8369('0x22')]=qs[_0x8369('0x22')](_0x1013c8['query'][_0x8369('0x22')]);_0x545790[_0x8369('0x21')]=qs[_0x8369('0x21')](_0x1013c8['query'][_0x8369('0x21')]);}return _0x3a2799['getAgents'](_0x545790);}})[_0x8369('0x29')](function(_0x28a161){if(_0x28a161){return _0x28a161?{'count':_0x1adc20,'rows':_0x28a161}:null;}})[_0x8369('0x29')](respondWithResult(_0x35767d,null))['catch'](handleError(_0x35767d,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 513f62a..90c1f3f 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 _0xbd07=['update','remove','emit','hasOwnProperty','hook','exports','CmList','setMaxListeners'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbd07,0xe6));var _0x7bd0=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xbd07[_0x231e16];return _0x570a7c;};'use strict';var EventEmitter=require('events');var CmList=require('../../mysqldb')['db'][_0x7bd0('0x0')];var CmListEvents=new EventEmitter();CmListEvents[_0x7bd0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7bd0('0x2'),'afterDestroy':_0x7bd0('0x3')};function emitEvent(_0x568766){return function(_0x2896b0,_0x334122,_0x1826c4){CmListEvents[_0x7bd0('0x4')](_0x568766+':'+_0x2896b0['id'],_0x2896b0);CmListEvents[_0x7bd0('0x4')](_0x568766,_0x2896b0);_0x1826c4(null);};}for(var e in events){if(events[_0x7bd0('0x5')](e)){var event=events[e];CmList[_0x7bd0('0x6')](e,emitEvent(event));}}module[_0x7bd0('0x7')]=CmListEvents; \ No newline at end of file +var _0xb3c5=['remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xd16d26,_0x5c4e33){var _0x40e3e1=function(_0x11071b){while(--_0x11071b){_0xd16d26['push'](_0xd16d26['shift']());}};_0x40e3e1(++_0x5c4e33);}(_0xb3c5,0xb9));var _0x5b3c=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0xb3c5[_0x1d5400];return _0x21d9fe;};'use strict';var EventEmitter=require(_0x5b3c('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5b3c('0x1')};function emitEvent(_0x3333f2){return function(_0x223225,_0x4dc2e5,_0xb85125){CmListEvents[_0x5b3c('0x2')](_0x3333f2+':'+_0x223225['id'],_0x223225);CmListEvents[_0x5b3c('0x2')](_0x3333f2,_0x223225);_0xb85125(null);};}for(var e in events){if(events[_0x5b3c('0x3')](e)){var event=events[e];CmList[_0x5b3c('0x4')](e,emitEvent(event));}}module[_0x5b3c('0x5')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index fe868ca..5027c58 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 _0x184a=['exports','define','cm_lists','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x184a,0x16b));var _0xa184=function(_0x4ae133,_0x99a429){_0x4ae133=_0x4ae133-0x0;var _0x1931c0=_0x184a[_0x4ae133];return _0x1931c0;};'use strict';var _=require(_0xa184('0x0'));var util=require('util');var logger=require(_0xa184('0x1'))(_0xa184('0x2'));var moment=require(_0xa184('0x3'));var BPromise=require('bluebird');var rp=require(_0xa184('0x4'));var fs=require('fs');var path=require(_0xa184('0x5'));var rimraf=require(_0xa184('0x6'));var config=require(_0xa184('0x7'));var attributes=require(_0xa184('0x8'));module[_0xa184('0x9')]=function(_0xfed0d5,_0x5631eb){return _0xfed0d5[_0xa184('0xa')]('CmList',attributes,{'tableName':_0xa184('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24e3=['bluebird','request-promise','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','../../config/logger','api'];(function(_0x13594e,_0x6f0ed0){var _0x1a4f42=function(_0x30b064){while(--_0x30b064){_0x13594e['push'](_0x13594e['shift']());}};_0x1a4f42(++_0x6f0ed0);}(_0x24e3,0x168));var _0x324e=function(_0x53a4d8,_0x446a35){_0x53a4d8=_0x53a4d8-0x0;var _0xe97cbd=_0x24e3[_0x53a4d8];return _0xe97cbd;};'use strict';var _=require(_0x324e('0x0'));var util=require('util');var logger=require(_0x324e('0x1'))(_0x324e('0x2'));var moment=require('moment');var BPromise=require(_0x324e('0x3'));var rp=require(_0x324e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x324e('0x5'));var attributes=require(_0x324e('0x6'));module[_0x324e('0x7')]=function(_0x2f51f4,_0x1bea19){return _0x2f51f4[_0x324e('0x8')](_0x324e('0x9'),attributes,{'tableName':_0x324e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 58cf153..af1bb37 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 _0x3610=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x115e90,_0x12b067){var _0x4c03c7=function(_0x1802b8){while(--_0x1802b8){_0x115e90['push'](_0x115e90['shift']());}};_0x4c03c7(++_0x12b067);}(_0x3610,0x156));var _0x0361=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x3610[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require(_0x0361('0x0'));var moment=require(_0x0361('0x1'));var BPromise=require(_0x0361('0x2'));var rs=require(_0x0361('0x3'));var fs=require('fs');var Redis=require(_0x0361('0x4'));var db=require(_0x0361('0x5'))['db'];var utils=require(_0x0361('0x6'));var logger=require(_0x0361('0x7'))(_0x0361('0x8'));var config=require(_0x0361('0x9'));var jayson=require(_0x0361('0xa'));var client=jayson[_0x0361('0xb')]['http']({'port':0x232a});config[_0x0361('0xc')]=_[_0x0361('0xd')](config['redis'],{'host':_0x0361('0xe'),'port':0x18eb});var socket=require(_0x0361('0xf'))(new Redis(config[_0x0361('0xc')]));require(_0x0361('0x10'))[_0x0361('0x11')](socket);function respondWithRpcPromise(_0x2c2086,_0x30e62b,_0x332091){return new BPromise(function(_0x5edf47,_0x5d3deb){return client['request'](_0x2c2086,_0x332091)['then'](function(_0x45adc9){logger[_0x0361('0x12')](_0x0361('0x13'),_0x30e62b,_0x0361('0x14'));logger[_0x0361('0x15')](_0x0361('0x16'),_0x30e62b,_0x0361('0x14'),JSON['stringify'](_0x45adc9));if(_0x45adc9[_0x0361('0x17')]){if(_0x45adc9['error'][_0x0361('0x18')]===0x1f4){logger[_0x0361('0x17')](_0x0361('0x13'),_0x30e62b,_0x45adc9[_0x0361('0x17')][_0x0361('0x19')]);return _0x5d3deb(_0x45adc9['error'][_0x0361('0x19')]);}logger[_0x0361('0x17')](_0x0361('0x13'),_0x30e62b,_0x45adc9[_0x0361('0x17')]['message']);return _0x5edf47(_0x45adc9['error'][_0x0361('0x19')]);}else{logger[_0x0361('0x12')](_0x0361('0x13'),_0x30e62b,_0x0361('0x14'));_0x5edf47(_0x45adc9['result']['message']);}})[_0x0361('0x1a')](function(_0x5f3ad0){logger[_0x0361('0x17')](_0x0361('0x13'),_0x30e62b,_0x5f3ad0);_0x5d3deb(_0x5f3ad0);});});} \ No newline at end of file +var _0x86cd=['stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./cmList.socket','register','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2bf31e,_0x3d5db7){var _0x528176=function(_0x4f8d63){while(--_0x4f8d63){_0x2bf31e['push'](_0x2bf31e['shift']());}};_0x528176(++_0x3d5db7);}(_0x86cd,0x12e));var _0xd86c=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0x86cd[_0xb6e43];return _0x47c40f;};'use strict';var _=require(_0xd86c('0x0'));var util=require(_0xd86c('0x1'));var moment=require(_0xd86c('0x2'));var BPromise=require(_0xd86c('0x3'));var rs=require(_0xd86c('0x4'));var fs=require('fs');var Redis=require(_0xd86c('0x5'));var db=require(_0xd86c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd86c('0x7'))(_0xd86c('0x8'));var config=require(_0xd86c('0x9'));var jayson=require(_0xd86c('0xa'));var client=jayson['client'][_0xd86c('0xb')]({'port':0x232a});config[_0xd86c('0xc')]=_['defaults'](config['redis'],{'host':_0xd86c('0xd'),'port':0x18eb});var socket=require(_0xd86c('0xe'))(new Redis(config[_0xd86c('0xc')]));require(_0xd86c('0xf'))[_0xd86c('0x10')](socket);function respondWithRpcPromise(_0x58d004,_0xa768e,_0x229a58){return new BPromise(function(_0x397001,_0x13e0a9){return client['request'](_0x58d004,_0x229a58)['then'](function(_0x5c30a0){logger[_0xd86c('0x11')](_0xd86c('0x12'),_0xa768e,'request\x20sent');logger[_0xd86c('0x13')](_0xd86c('0x14'),_0xa768e,_0xd86c('0x15'),JSON[_0xd86c('0x16')](_0x5c30a0));if(_0x5c30a0['error']){if(_0x5c30a0['error'][_0xd86c('0x17')]===0x1f4){logger[_0xd86c('0x18')](_0xd86c('0x12'),_0xa768e,_0x5c30a0['error'][_0xd86c('0x19')]);return _0x13e0a9(_0x5c30a0[_0xd86c('0x18')]['message']);}logger[_0xd86c('0x18')](_0xd86c('0x12'),_0xa768e,_0x5c30a0[_0xd86c('0x18')][_0xd86c('0x19')]);return _0x397001(_0x5c30a0[_0xd86c('0x18')]['message']);}else{logger[_0xd86c('0x11')](_0xd86c('0x12'),_0xa768e,'request\x20sent');_0x397001(_0x5c30a0['result'][_0xd86c('0x19')]);}})[_0xd86c('0x1a')](function(_0x4cd3b5){logger[_0xd86c('0x18')](_0xd86c('0x12'),_0xa768e,_0x4cd3b5);_0x13e0a9(_0x4cd3b5);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index c5500fc..7ec6145 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 _0x0fcd=['removeListener','register','cmList:','save','remove','update'];(function(_0xd048a8,_0x47fbae){var _0x5f5013=function(_0xbf381f){while(--_0xbf381f){_0xd048a8['push'](_0xd048a8['shift']());}};_0x5f5013(++_0x47fbae);}(_0x0fcd,0x129));var _0xd0fc=function(_0x149182,_0x417bc2){_0x149182=_0x149182-0x0;var _0x100223=_0x0fcd[_0x149182];return _0x100223;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xd0fc('0x0'),_0xd0fc('0x1'),_0xd0fc('0x2')];function createListener(_0x7d13c6,_0x3e8013){return function(_0x1a3aa8){_0x3e8013['emit'](_0x7d13c6,_0x1a3aa8);};}function removeListener(_0x46c92d,_0x3552fc){return function(){CmListEvents[_0xd0fc('0x3')](_0x46c92d,_0x3552fc);};}exports[_0xd0fc('0x4')]=function(_0x5507ff){for(var _0x32b1c5=0x0,_0x5d93cc=events['length'];_0x32b1c5<_0x5d93cc;_0x32b1c5++){var _0x5ad581=events[_0x32b1c5];var _0x5e42a1=createListener(_0xd0fc('0x5')+_0x5ad581,_0x5507ff);CmListEvents['on'](_0x5ad581,_0x5e42a1);}}; \ No newline at end of file +var _0xf569=['update','emit','removeListener','length','cmList:','save','remove'];(function(_0x424774,_0x407a9e){var _0x52a4f0=function(_0xdfddd7){while(--_0xdfddd7){_0x424774['push'](_0x424774['shift']());}};_0x52a4f0(++_0x407a9e);}(_0xf569,0xd0));var _0x9f56=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf569[_0x321bb2];return _0x9c12ed;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x9f56('0x0'),_0x9f56('0x1'),_0x9f56('0x2')];function createListener(_0x9c192,_0x45b196){return function(_0x4466ac){_0x45b196[_0x9f56('0x3')](_0x9c192,_0x4466ac);};}function removeListener(_0x6d506b,_0x5bc3e8){return function(){CmListEvents[_0x9f56('0x4')](_0x6d506b,_0x5bc3e8);};}exports['register']=function(_0x467a46){for(var _0x3488f2=0x0,_0x5c5e5f=events[_0x9f56('0x5')];_0x3488f2<_0x5c5e5f;_0x3488f2++){var _0x73c3b4=events[_0x3488f2];var _0x5980f2=createListener(_0x9f56('0x6')+_0x73c3b4,_0x467a46);CmListEvents['on'](_0x73c3b4,_0x5980f2);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 4d118dc..852cd1c 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 _0x8ae8=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/dispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','create','addDisposition','post','/:id/fields','addCustomField','put','delete'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x8ae8,0xda));var _0x88ae=function(_0x165189,_0x19a741){_0x165189=_0x165189-0x0;var _0x44826b=_0x8ae8[_0x165189];return _0x44826b;};'use strict';var multer=require(_0x88ae('0x0'));var util=require(_0x88ae('0x1'));var path=require(_0x88ae('0x2'));var timeout=require(_0x88ae('0x3'));var express=require(_0x88ae('0x4'));var router=express[_0x88ae('0x5')]();var auth=require(_0x88ae('0x6'));var interaction=require(_0x88ae('0x7'));var config=require(_0x88ae('0x8'));var controller=require(_0x88ae('0x9'));router[_0x88ae('0xa')]('/',auth['isAuthenticated'](),controller[_0x88ae('0xb')]);router[_0x88ae('0xa')](_0x88ae('0xc'),auth['isAuthenticated'](),controller[_0x88ae('0xd')]);router[_0x88ae('0xa')](_0x88ae('0xe'),auth[_0x88ae('0xf')](),controller['show']);router[_0x88ae('0xa')](_0x88ae('0x10'),auth[_0x88ae('0xf')](),controller['getDispositions']);router[_0x88ae('0xa')](_0x88ae('0x11'),auth[_0x88ae('0xf')](),controller['getContacts']);router[_0x88ae('0xa')](_0x88ae('0x12'),auth[_0x88ae('0xf')](),controller[_0x88ae('0x13')]);router['get']('/:id/fields',auth[_0x88ae('0xf')](),controller[_0x88ae('0x14')]);router[_0x88ae('0xa')](_0x88ae('0x15'),auth['isAuthenticated'](),controller[_0x88ae('0x16')]);router['post']('/',auth['isAuthenticated'](),controller[_0x88ae('0x17')]);router['post'](_0x88ae('0x10'),auth[_0x88ae('0xf')](),controller[_0x88ae('0x18')]);router[_0x88ae('0x19')]('/:id/contacts',auth[_0x88ae('0xf')](),controller['addContacts']);router['post'](_0x88ae('0x1a'),auth[_0x88ae('0xf')](),controller[_0x88ae('0x1b')]);router['post']('/:id/users',auth[_0x88ae('0xf')](),controller['addAgents']);router[_0x88ae('0x1c')](_0x88ae('0xe'),auth[_0x88ae('0xf')](),controller['update']);router[_0x88ae('0x1d')](_0x88ae('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x88ae('0x10'),auth[_0x88ae('0xf')](),controller['removeDispositions']);router[_0x88ae('0x1d')](_0x88ae('0x15'),auth[_0x88ae('0xf')](),controller['removeAgents']);module[_0x88ae('0x1e')]=router; \ No newline at end of file +var _0x4cd7=['/:id/fields','post','create','addDisposition','addContacts','addCustomField','addAgents','put','delete','destroy','removeDispositions','/:id/users','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv'];(function(_0x3e8d2f,_0x59afb0){var _0x42a9e8=function(_0x511fcb){while(--_0x511fcb){_0x3e8d2f['push'](_0x3e8d2f['shift']());}};_0x42a9e8(++_0x59afb0);}(_0x4cd7,0x1de));var _0x74cd=function(_0x3f131b,_0x2507a7){_0x3f131b=_0x3f131b-0x0;var _0x6db5df=_0x4cd7[_0x3f131b];return _0x6db5df;};'use strict';var multer=require('multer');var util=require(_0x74cd('0x0'));var path=require(_0x74cd('0x1'));var timeout=require(_0x74cd('0x2'));var express=require(_0x74cd('0x3'));var router=express[_0x74cd('0x4')]();var auth=require(_0x74cd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x74cd('0x6'));var controller=require('./cmList.controller');router[_0x74cd('0x7')]('/',auth[_0x74cd('0x8')](),controller[_0x74cd('0x9')]);router[_0x74cd('0x7')]('/describe',auth[_0x74cd('0x8')](),controller[_0x74cd('0xa')]);router[_0x74cd('0x7')](_0x74cd('0xb'),auth['isAuthenticated'](),controller[_0x74cd('0xc')]);router[_0x74cd('0x7')](_0x74cd('0xd'),auth[_0x74cd('0x8')](),controller[_0x74cd('0xe')]);router['get'](_0x74cd('0xf'),auth[_0x74cd('0x8')](),controller[_0x74cd('0x10')]);router[_0x74cd('0x7')](_0x74cd('0x11'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x74cd('0x7')](_0x74cd('0x12'),auth[_0x74cd('0x8')](),controller['getCustomFields']);router[_0x74cd('0x7')]('/:id/users',auth[_0x74cd('0x8')](),controller['getAgents']);router[_0x74cd('0x13')]('/',auth[_0x74cd('0x8')](),controller[_0x74cd('0x14')]);router[_0x74cd('0x13')](_0x74cd('0xd'),auth[_0x74cd('0x8')](),controller[_0x74cd('0x15')]);router['post'](_0x74cd('0xf'),auth[_0x74cd('0x8')](),controller[_0x74cd('0x16')]);router[_0x74cd('0x13')](_0x74cd('0x12'),auth[_0x74cd('0x8')](),controller[_0x74cd('0x17')]);router['post']('/:id/users',auth[_0x74cd('0x8')](),controller[_0x74cd('0x18')]);router[_0x74cd('0x19')](_0x74cd('0xb'),auth[_0x74cd('0x8')](),controller['update']);router[_0x74cd('0x1a')](_0x74cd('0xb'),auth[_0x74cd('0x8')](),controller[_0x74cd('0x1b')]);router['delete'](_0x74cd('0xd'),auth[_0x74cd('0x8')](),controller[_0x74cd('0x1c')]);router[_0x74cd('0x1a')](_0x74cd('0x1d'),auth[_0x74cd('0x8')](),controller['removeAgents']);module[_0x74cd('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 3fca69a..dc9b815 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x283066,_0x3afd94){var _0x5001ef=function(_0x45b1e5){while(--_0x45b1e5){_0x283066['push'](_0x283066['shift']());}};_0x5001ef(++_0x3afd94);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x578b39,_0x8d559c){var _0x4994a6=function(_0x1a3116){while(--_0x1a3116){_0x578b39['push'](_0x578b39['shift']());}};_0x4994a6(++_0x8d559c);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index a46eb8d..537bdc3 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 _0x0499=['name','send','body','Condition','params','catch','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0xdd3e46,_0x4ddaed){var _0x191b08=function(_0x46c876){while(--_0x46c876){_0xdd3e46['push'](_0xdd3e46['shift']());}};_0x191b08(++_0x4ddaed);}(_0x0499,0x91));var _0x9049=function(_0x40bb16,_0x2476f3){_0x40bb16=_0x40bb16-0x0;var _0x2d7f94=_0x0499[_0x40bb16];return _0x2d7f94;};'use strict';var pdf=require(_0x9049('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9049('0x1'));var zipdir=require(_0x9049('0x2'));var jsonpatch=require(_0x9049('0x3'));var rp=require(_0x9049('0x4'));var moment=require(_0x9049('0x5'));var BPromise=require(_0x9049('0x6'));var Mustache=require(_0x9049('0x7'));var util=require(_0x9049('0x8'));var path=require(_0x9049('0x9'));var sox=require(_0x9049('0xa'));var csv=require(_0x9049('0xb'));var ejs=require(_0x9049('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9049('0xd'));var jsforce=require(_0x9049('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9049('0xb'));var querystring=require(_0x9049('0xf'));var Papa=require(_0x9049('0x10'));var Redis=require(_0x9049('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9049('0x12'));var hardwareService=require(_0x9049('0x13'));var logger=require(_0x9049('0x14'))('api');var utils=require(_0x9049('0x15'));var config=require(_0x9049('0x16'));var db=require(_0x9049('0x17'))['db'];function respondWithStatusCode(_0x527f54,_0x48b13b){_0x48b13b=_0x48b13b||0xcc;return function(_0x515ed5){if(_0x515ed5){return _0x527f54[_0x9049('0x18')](_0x48b13b);}return _0x527f54[_0x9049('0x19')](_0x48b13b)[_0x9049('0x1a')]();};}function respondWithResult(_0x5aa82e,_0x557cda){_0x557cda=_0x557cda||0xc8;return function(_0x216651){if(_0x216651){return _0x5aa82e['status'](_0x557cda)[_0x9049('0x1b')](_0x216651);}};}function respondWithFilteredResult(_0x2e1629,_0x69d96c){return function(_0x54b4d3){if(_0x54b4d3){var _0x2f0382=_0x54b4d3['count'],_0xf86cd0=_0x69d96c[_0x9049('0x1c')],_0x2063b7=_0x69d96c[_0x9049('0x1c')]+_0x69d96c['limit'],_0x1466bb;if(_0x2063b7>=_0x2f0382){_0x2063b7=_0x2f0382;_0x1466bb=0xc8;}else{_0x1466bb=0xce;}_0x2e1629[_0x9049('0x19')](_0x1466bb);return _0x2e1629[_0x9049('0x1d')](_0x9049('0x1e'),_0xf86cd0+'-'+_0x2063b7+'/'+_0x2f0382)['json'](_0x54b4d3);}return null;};}function patchUpdates(_0x48f0a1){return function(_0x4b8298){try{jsonpatch[_0x9049('0x1f')](_0x4b8298,_0x48f0a1,!![]);}catch(_0x21c596){return BPromise[_0x9049('0x20')](_0x21c596);}return _0x4b8298[_0x9049('0x21')]();};}function saveUpdates(_0x1e7253,_0x5e7a0b){return function(_0x193d16){if(_0x193d16){return _0x193d16[_0x9049('0x22')](_0x1e7253)[_0x9049('0x23')](function(_0x4862d6){return _0x4862d6;});}return null;};}function removeEntity(_0x59e3b5,_0x1eccf2){return function(_0xb9b75f){if(_0xb9b75f){return _0xb9b75f[_0x9049('0x24')]()[_0x9049('0x23')](function(){_0x59e3b5['status'](0xcc)[_0x9049('0x1a')]();});}};}function handleEntityNotFound(_0x480108,_0xe87674){return function(_0x500aad){if(!_0x500aad){_0x480108[_0x9049('0x18')](0x194);}return _0x500aad;};}function handleError(_0x44d783,_0x29a2e0){_0x29a2e0=_0x29a2e0||0x1f4;return function(_0x4031cb){logger[_0x9049('0x25')](_0x4031cb[_0x9049('0x26')]);if(_0x4031cb[_0x9049('0x27')]){delete _0x4031cb['name'];}_0x44d783['status'](_0x29a2e0)[_0x9049('0x28')](_0x4031cb);};}exports[_0x9049('0x22')]=function(_0xfbf969,_0x2be220){if(_0xfbf969[_0x9049('0x29')]['id']){delete _0xfbf969[_0x9049('0x29')]['id'];}return db[_0x9049('0x2a')]['find']({'where':{'id':_0xfbf969[_0x9049('0x2b')]['id']}})[_0x9049('0x23')](handleEntityNotFound(_0x2be220,null))[_0x9049('0x23')](saveUpdates(_0xfbf969[_0x9049('0x29')],null))[_0x9049('0x23')](respondWithResult(_0x2be220,null))[_0x9049('0x2c')](handleError(_0x2be220,null));};exports['destroy']=function(_0x1091df,_0x2c622b){return db[_0x9049('0x2a')][_0x9049('0x2d')]({'where':{'id':_0x1091df[_0x9049('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2c622b,null))['then'](removeEntity(_0x2c622b,null))[_0x9049('0x2c')](handleError(_0x2c622b,null));}; \ No newline at end of file +var _0x0b37=['../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','body','find','params','catch','destroy','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'];(function(_0x12f773,_0x38b6c9){var _0x3a2b70=function(_0xe9f474){while(--_0xe9f474){_0x12f773['push'](_0x12f773['shift']());}};_0x3a2b70(++_0x38b6c9);}(_0x0b37,0x1d7));var _0x70b3=function(_0x414d0a,_0x1cc249){_0x414d0a=_0x414d0a-0x0;var _0x4fe38f=_0x0b37[_0x414d0a];return _0x4fe38f;};'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('0x22')]=function(_0x10f83f,_0x26b2b3){if(_0x10f83f[_0x70b3('0x28')]['id']){delete _0x10f83f[_0x70b3('0x28')]['id'];}return db['Condition'][_0x70b3('0x29')]({'where':{'id':_0x10f83f[_0x70b3('0x2a')]['id']}})[_0x70b3('0x23')](handleEntityNotFound(_0x26b2b3,null))[_0x70b3('0x23')](saveUpdates(_0x10f83f['body'],null))[_0x70b3('0x23')](respondWithResult(_0x26b2b3,null))[_0x70b3('0x2b')](handleError(_0x26b2b3,null));};exports[_0x70b3('0x2c')]=function(_0x54fe9a,_0x3500fd){return db['Condition'][_0x70b3('0x29')]({'where':{'id':_0x54fe9a['params']['id']}})[_0x70b3('0x23')](handleEntityNotFound(_0x3500fd,null))[_0x70b3('0x23')](removeEntity(_0x3500fd,null))[_0x70b3('0x2b')](handleError(_0x3500fd,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index a63e277..a107d74 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 _0xde3a=['bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','tools_conditions','lodash','../../config/logger','api','moment'];(function(_0x2183c8,_0x31c322){var _0x7c4c31=function(_0x2418af){while(--_0x2418af){_0x2183c8['push'](_0x2183c8['shift']());}};_0x7c4c31(++_0x31c322);}(_0xde3a,0x125));var _0xade3=function(_0x3e9bab,_0x33fb58){_0x3e9bab=_0x3e9bab-0x0;var _0x13e263=_0xde3a[_0x3e9bab];return _0x13e263;};'use strict';var _=require(_0xade3('0x0'));var util=require('util');var logger=require(_0xade3('0x1'))(_0xade3('0x2'));var moment=require(_0xade3('0x3'));var BPromise=require(_0xade3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xade3('0x5'));var rimraf=require(_0xade3('0x6'));var config=require(_0xade3('0x7'));var attributes=require(_0xade3('0x8'));module[_0xade3('0x9')]=function(_0xd07f26,_0x31d49c){return _0xd07f26['define']('Condition',attributes,{'tableName':_0xade3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f6f=['../../config/logger','api','moment','bluebird','request-promise','path','./condition.attributes','exports','Condition','tools_conditions','lodash','util'];(function(_0x1f3e03,_0xb8977a){var _0x4e27fb=function(_0x3a33b1){while(--_0x3a33b1){_0x1f3e03['push'](_0x1f3e03['shift']());}};_0x4e27fb(++_0xb8977a);}(_0x0f6f,0xbe));var _0xf0f6=function(_0x463183,_0x56bd4e){_0x463183=_0x463183-0x0;var _0xd5fe56=_0x0f6f[_0x463183];return _0xd5fe56;};'use strict';var _=require(_0xf0f6('0x0'));var util=require(_0xf0f6('0x1'));var logger=require(_0xf0f6('0x2'))(_0xf0f6('0x3'));var moment=require(_0xf0f6('0x4'));var BPromise=require(_0xf0f6('0x5'));var rp=require(_0xf0f6('0x6'));var fs=require('fs');var path=require(_0xf0f6('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf0f6('0x8'));module[_0xf0f6('0x9')]=function(_0xff4cc8,_0x5ce071){return _0xff4cc8['define'](_0xf0f6('0xa'),attributes,{'tableName':_0xf0f6('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 a8aa68e..b2f8b4b 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 _0x82f6=['info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1c5731,_0x408a49){var _0x18f330=function(_0x1f9c40){while(--_0x1f9c40){_0x1c5731['push'](_0x1c5731['shift']());}};_0x18f330(++_0x408a49);}(_0x82f6,0xec));var _0x682f=function(_0x1a7685,_0x47e17a){_0x1a7685=_0x1a7685-0x0;var _0x255b8a=_0x82f6[_0x1a7685];return _0x255b8a;};'use strict';var _=require(_0x682f('0x0'));var util=require(_0x682f('0x1'));var moment=require('moment');var BPromise=require(_0x682f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x682f('0x3'));var db=require(_0x682f('0x4'))['db'];var utils=require(_0x682f('0x5'));var logger=require(_0x682f('0x6'))(_0x682f('0x7'));var config=require(_0x682f('0x8'));var jayson=require(_0x682f('0x9'));var client=jayson[_0x682f('0xa')][_0x682f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c7d1b,_0x1c4808,_0x27db53){return new BPromise(function(_0x317479,_0x17162a){return client[_0x682f('0xc')](_0x1c7d1b,_0x27db53)[_0x682f('0xd')](function(_0x516116){logger[_0x682f('0xe')](_0x682f('0xf'),_0x1c4808,_0x682f('0x10'));logger[_0x682f('0x11')](_0x682f('0x12'),_0x1c4808,_0x682f('0x10'),JSON[_0x682f('0x13')](_0x516116));if(_0x516116['error']){if(_0x516116[_0x682f('0x14')][_0x682f('0x15')]===0x1f4){logger['error'](_0x682f('0xf'),_0x1c4808,_0x516116[_0x682f('0x14')]['message']);return _0x17162a(_0x516116[_0x682f('0x14')][_0x682f('0x16')]);}logger[_0x682f('0x14')](_0x682f('0xf'),_0x1c4808,_0x516116[_0x682f('0x14')][_0x682f('0x16')]);return _0x317479(_0x516116[_0x682f('0x14')][_0x682f('0x16')]);}else{logger['info'](_0x682f('0xf'),_0x1c4808,'request\x20sent');_0x317479(_0x516116[_0x682f('0x17')][_0x682f('0x16')]);}})[_0x682f('0x18')](function(_0x3675a6){logger[_0x682f('0x14')](_0x682f('0xf'),_0x1c4808,_0x3675a6);_0x17162a(_0x3675a6);});});} \ No newline at end of file +var _0x496d=['message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5e88cc,_0x59e168){var _0x24dbf7=function(_0x2999dc){while(--_0x2999dc){_0x5e88cc['push'](_0x5e88cc['shift']());}};_0x24dbf7(++_0x59e168);}(_0x496d,0x1e5));var _0xd496=function(_0x330426,_0x204abb){_0x330426=_0x330426-0x0;var _0x2dd763=_0x496d[_0x330426];return _0x2dd763;};'use strict';var _=require('lodash');var util=require(_0xd496('0x0'));var moment=require(_0xd496('0x1'));var BPromise=require('bluebird');var rs=require(_0xd496('0x2'));var fs=require('fs');var Redis=require(_0xd496('0x3'));var db=require(_0xd496('0x4'))['db'];var utils=require(_0xd496('0x5'));var logger=require(_0xd496('0x6'))(_0xd496('0x7'));var config=require(_0xd496('0x8'));var jayson=require(_0xd496('0x9'));var client=jayson['client'][_0xd496('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bbcce,_0x16e811,_0x12fe54){return new BPromise(function(_0x3005c3,_0x3c2d3c){return client[_0xd496('0xb')](_0x3bbcce,_0x12fe54)[_0xd496('0xc')](function(_0x4c0ca7){logger[_0xd496('0xd')](_0xd496('0xe'),_0x16e811,_0xd496('0xf'));logger[_0xd496('0x10')](_0xd496('0x11'),_0x16e811,_0xd496('0xf'),JSON[_0xd496('0x12')](_0x4c0ca7));if(_0x4c0ca7[_0xd496('0x13')]){if(_0x4c0ca7[_0xd496('0x13')][_0xd496('0x14')]===0x1f4){logger['error'](_0xd496('0xe'),_0x16e811,_0x4c0ca7[_0xd496('0x13')][_0xd496('0x15')]);return _0x3c2d3c(_0x4c0ca7[_0xd496('0x13')]['message']);}logger[_0xd496('0x13')](_0xd496('0xe'),_0x16e811,_0x4c0ca7[_0xd496('0x13')]['message']);return _0x3005c3(_0x4c0ca7[_0xd496('0x13')][_0xd496('0x15')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x16e811,'request\x20sent');_0x3005c3(_0x4c0ca7[_0xd496('0x16')][_0xd496('0x15')]);}})['catch'](function(_0xf7468c){logger[_0xd496('0x13')]('Condition,\x20%s,\x20%s',_0x16e811,_0xf7468c);_0x3c2d3c(_0xf7468c);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 1e0fc53..972b61d 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 _0xb9eb=['../../components/auth/service','./condition.controller','put','/:id','isAuthenticated','update','multer','path','connect-timeout','express','Router'];(function(_0x4bde34,_0xaa7b76){var _0x57ef23=function(_0x371c99){while(--_0x371c99){_0x4bde34['push'](_0x4bde34['shift']());}};_0x57ef23(++_0xaa7b76);}(_0xb9eb,0x1d4));var _0xbb9e=function(_0x2b4807,_0x5f05ac){_0x2b4807=_0x2b4807-0x0;var _0x45d472=_0xb9eb[_0x2b4807];return _0x45d472;};'use strict';var multer=require(_0xbb9e('0x0'));var util=require('util');var path=require(_0xbb9e('0x1'));var timeout=require(_0xbb9e('0x2'));var express=require(_0xbb9e('0x3'));var router=express[_0xbb9e('0x4')]();var auth=require(_0xbb9e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbb9e('0x6'));router[_0xbb9e('0x7')](_0xbb9e('0x8'),auth[_0xbb9e('0x9')](),controller[_0xbb9e('0xa')]);router['delete']('/:id',auth[_0xbb9e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x863d=['update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated'];(function(_0x1422dd,_0x4465cf){var _0x304e54=function(_0xb46c63){while(--_0xb46c63){_0x1422dd['push'](_0x1422dd['shift']());}};_0x304e54(++_0x4465cf);}(_0x863d,0x1e4));var _0xd863=function(_0x5c3d42,_0xf2a84c){_0x5c3d42=_0x5c3d42-0x0;var _0xd478b3=_0x863d[_0x5c3d42];return _0xd478b3;};'use strict';var multer=require(_0xd863('0x0'));var util=require('util');var path=require(_0xd863('0x1'));var timeout=require('connect-timeout');var express=require(_0xd863('0x2'));var router=express['Router']();var auth=require(_0xd863('0x3'));var interaction=require(_0xd863('0x4'));var config=require(_0xd863('0x5'));var controller=require('./condition.controller');router['put'](_0xd863('0x6'),auth[_0xd863('0x7')](),controller[_0xd863('0x8')]);router[_0xd863('0x9')](_0xd863('0x6'),auth[_0xd863('0x7')](),controller[_0xd863('0xa')]);module[_0xd863('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 0d56ee1..4619ef1 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ae7=['INTEGER','STRING','sequelize','exports','name'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0x7ae7,0xd9));var _0x77ae=function(_0x4915be,_0x3fbdd3){_0x4915be=_0x4915be-0x0;var _0x115aba=_0x7ae7[_0x4915be];return _0x115aba;};'use strict';var Sequelize=require(_0x77ae('0x0'));module[_0x77ae('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x77ae('0x2')},'OrderBy':{'type':Sequelize[_0x77ae('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x77ae('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0xadb8=['STRING','INTEGER'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xadb8,0x1d0));var _0x8adb=function(_0x5814ca,_0x3b6713){_0x5814ca=_0x5814ca-0x0;var _0xeb1833=_0xadb8[_0x5814ca];return _0xeb1833;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8adb('0x0')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x8adb('0x1')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8adb('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index fe0b9a9..7b52cb0 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','destroy','error','name','send','map','ContactItemType','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','order','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation'];(function(_0x2fa540,_0x35a2e6){var _0x3323c3=function(_0x5cfb2e){while(--_0x5cfb2e){_0x2fa540['push'](_0x2fa540['shift']());}};_0x3323c3(++_0x35a2e6);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'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(){var _0x4f0b62=_0x527126['get']({'plain':!![]});var _0x2263ae=_0x49c4('0x21');return db[_0x49c4('0x22')][_0x49c4('0x23')]({'where':{'type':_0x2263ae,'resourceId':_0x4f0b62['id']}})['then'](function(){return _0x527126;});})['then'](function(){_0x2197d2[_0x49c4('0x16')](0xcc)[_0x49c4('0x15')]();});}};}function handleEntityNotFound(_0x565423,_0x207358){return function(_0x43e014){if(!_0x43e014){_0x565423[_0x49c4('0x14')](0x194);}return _0x43e014;};}function handleError(_0xa7a826,_0x531d92){_0x531d92=_0x531d92||0x1f4;return function(_0x543ea2){logger[_0x49c4('0x24')](_0x543ea2['stack']);if(_0x543ea2[_0x49c4('0x25')]){delete _0x543ea2[_0x49c4('0x25')];}_0xa7a826[_0x49c4('0x16')](_0x531d92)[_0x49c4('0x26')](_0x543ea2);};}exports['index']=function(_0x889909,_0x2b2793){var _0x46e04d={},_0x4f28a2={},_0x6329b3={'count':0x0,'rows':[]};var _0x29f835=_[_0x49c4('0x27')](db[_0x49c4('0x28')][_0x49c4('0x29')],function(_0x2cbd88){return{'name':_0x2cbd88[_0x49c4('0x2a')],'type':_0x2cbd88['type']['key']};});_0x4f28a2['model']=_[_0x49c4('0x27')](_0x29f835,_0x49c4('0x25'));_0x4f28a2[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x889909[_0x49c4('0x2b')]);_0x4f28a2['filters']=_[_0x49c4('0x2d')](_0x4f28a2[_0x49c4('0x2e')],_0x4f28a2[_0x49c4('0x2b')]);_0x46e04d[_0x49c4('0x2f')]=_['intersection'](_0x4f28a2['model'],qs[_0x49c4('0x30')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x30')]));_0x46e04d[_0x49c4('0x2f')]=_0x46e04d[_0x49c4('0x2f')]['length']?_0x46e04d[_0x49c4('0x2f')]:_0x4f28a2[_0x49c4('0x2e')];if(!_0x889909[_0x49c4('0x2b')]['hasOwnProperty']('nolimit')){_0x46e04d[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x1a')]);_0x46e04d[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x19')]);}_0x46e04d[_0x49c4('0x31')]=qs['sort'](_0x889909[_0x49c4('0x2b')]['sort']);_0x46e04d[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x889909[_0x49c4('0x2b')],_0x4f28a2['filters']),_0x29f835);if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x46e04d[_0x49c4('0x32')]=_['merge'](_0x46e04d[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x29f835,function(_0x178987){if(_0x178987[_0x49c4('0x36')]!==_0x49c4('0x37')){var _0x24c177={};_0x24c177[_0x178987[_0x49c4('0x25')]]={'$like':'%'+_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x24c177;}})});}_0x46e04d=_[_0x49c4('0x38')]({},_0x46e04d,_0x889909[_0x49c4('0x39')]);var _0x4e0663={'where':_0x46e04d[_0x49c4('0x32')]};return db[_0x49c4('0x28')][_0x49c4('0x18')](_0x4e0663)[_0x49c4('0x20')](function(_0x41ad28){_0x6329b3[_0x49c4('0x18')]=_0x41ad28;if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x46e04d[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x28')][_0x49c4('0x3c')](_0x46e04d);})[_0x49c4('0x20')](function(_0x326142){_0x6329b3['rows']=_0x326142;return _0x6329b3;})[_0x49c4('0x20')](respondWithFilteredResult(_0x2b2793,_0x46e04d))['catch'](handleError(_0x2b2793,null));};exports[_0x49c4('0x3d')]=function(_0x4915bc,_0x28d4fb){var _0x1480da={'raw':!![],'where':{'id':_0x4915bc[_0x49c4('0x3e')]['id']}},_0x239327={};_0x239327['model']=_['keys'](db[_0x49c4('0x28')][_0x49c4('0x29')]);_0x239327[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x4915bc['query']);_0x239327[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],_0x239327[_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2f')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x4915bc[_0x49c4('0x2b')]['fields']));_0x1480da[_0x49c4('0x2f')]=_0x1480da['attributes'][_0x49c4('0x3f')]?_0x1480da[_0x49c4('0x2f')]:_0x239327[_0x49c4('0x2e')];if(_0x4915bc[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x1480da['include']=[{'all':!![]}];}_0x1480da=_[_0x49c4('0x38')]({},_0x1480da,_0x4915bc[_0x49c4('0x39')]);return db[_0x49c4('0x28')][_0x49c4('0x40')](_0x1480da)[_0x49c4('0x20')](handleEntityNotFound(_0x28d4fb,null))[_0x49c4('0x20')](respondWithResult(_0x28d4fb,null))[_0x49c4('0x41')](handleError(_0x28d4fb,null));};exports['create']=function(_0x3bac1b,_0x5cfff9){return db[_0x49c4('0x28')][_0x49c4('0x42')](_0x3bac1b[_0x49c4('0x43')],{})[_0x49c4('0x20')](function(_0x2d8087){var _0x30bea5=_0x3bac1b[_0x49c4('0x44')]['get']({'plain':!![]});if(!_0x30bea5)throw new Error(_0x49c4('0x45'));if(_0x30bea5[_0x49c4('0x46')]==='user'){var _0x1e1ac4=_0x2d8087[_0x49c4('0x47')]({'plain':!![]});var _0xfbe179=_0x49c4('0x21');return db['UserProfileSection']['find']({'where':{'name':_0xfbe179,'userProfileId':_0x30bea5[_0x49c4('0x48')]},'raw':!![]})['then'](function(_0x4597c3){if(_0x4597c3&&_0x4597c3[_0x49c4('0x49')]===0x0){return db[_0x49c4('0x22')][_0x49c4('0x42')]({'name':_0x1e1ac4[_0x49c4('0x25')],'resourceId':_0x1e1ac4['id'],'type':_0x4597c3[_0x49c4('0x25')],'sectionId':_0x4597c3['id']},{})[_0x49c4('0x20')](function(){return _0x2d8087;});}else{return _0x2d8087;}})['catch'](function(_0x1f26c2){logger[_0x49c4('0x24')](_0x49c4('0x4a'),_0x1f26c2);throw _0x1f26c2;});}return _0x2d8087;})[_0x49c4('0x20')](respondWithResult(_0x5cfff9,0xc9))[_0x49c4('0x41')](handleError(_0x5cfff9,null));};exports[_0x49c4('0x1f')]=function(_0x156748,_0x25d174){if(_0x156748[_0x49c4('0x43')]['id']){delete _0x156748[_0x49c4('0x43')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x156748[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x25d174,null))['then'](saveUpdates(_0x156748['body'],null))[_0x49c4('0x20')](respondWithResult(_0x25d174,null))['catch'](handleError(_0x25d174,null));};exports['destroy']=function(_0x3208c2,_0x4081a5){return db[_0x49c4('0x28')][_0x49c4('0x40')]({'where':{'id':_0x3208c2[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x4081a5,null))[_0x49c4('0x20')](removeEntity(_0x4081a5,null))['catch'](handleError(_0x4081a5,null));}; \ No newline at end of file +var _0x9bde=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','sendStatus','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x17d417,_0x51e28a){var _0x309a2f=function(_0x307ff1){while(--_0x307ff1){_0x17d417['push'](_0x17d417['shift']());}};_0x309a2f(++_0x51e28a);}(_0x9bde,0xe1));var _0xe9bd=function(_0xeb47f7,_0x3a540b){_0xeb47f7=_0xeb47f7-0x0;var _0xce0f94=_0x9bde[_0xeb47f7];return _0xce0f94;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x13'));var hardwareService=require(_0xe9bd('0x14'));var logger=require(_0xe9bd('0x15'))('api');var utils=require(_0xe9bd('0x16'));var config=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x141587,_0x5e022a){_0x5e022a=_0x5e022a||0xcc;return function(_0x2c1d98){if(_0x2c1d98){return _0x141587['sendStatus'](_0x5e022a);}return _0x141587[_0xe9bd('0x19')](_0x5e022a)[_0xe9bd('0x1a')]();};}function respondWithResult(_0x3435b4,_0x51109f){_0x51109f=_0x51109f||0xc8;return function(_0x47ba5e){if(_0x47ba5e){return _0x3435b4[_0xe9bd('0x19')](_0x51109f)[_0xe9bd('0x1b')](_0x47ba5e);}};}function respondWithFilteredResult(_0x3a9e5f,_0x46a59b){return function(_0x3360bd){if(_0x3360bd){var _0x389e7b=_0x3360bd[_0xe9bd('0x1c')],_0x45a9f2=_0x46a59b[_0xe9bd('0x1d')],_0x573350=_0x46a59b['offset']+_0x46a59b[_0xe9bd('0x1e')],_0x1d11a0;if(_0x573350>=_0x389e7b){_0x573350=_0x389e7b;_0x1d11a0=0xc8;}else{_0x1d11a0=0xce;}_0x3a9e5f[_0xe9bd('0x19')](_0x1d11a0);return _0x3a9e5f[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x45a9f2+'-'+_0x573350+'/'+_0x389e7b)['json'](_0x3360bd);}return null;};}function patchUpdates(_0x20ec32){return function(_0x50a5e8){try{jsonpatch[_0xe9bd('0x21')](_0x50a5e8,_0x20ec32,!![]);}catch(_0x55b869){return BPromise[_0xe9bd('0x22')](_0x55b869);}return _0x50a5e8[_0xe9bd('0x23')]();};}function saveUpdates(_0x134c4e,_0x3dda13){return function(_0x1acb82){if(_0x1acb82){return _0x1acb82[_0xe9bd('0x24')](_0x134c4e)[_0xe9bd('0x25')](function(_0x49165b){return _0x49165b;});}return null;};}function removeEntity(_0x133318,_0x28cd17){return function(_0x4ecaf5){if(_0x4ecaf5){return _0x4ecaf5[_0xe9bd('0x26')]()['then'](function(){var _0x238ab1=_0x4ecaf5[_0xe9bd('0x27')]({'plain':!![]});var _0x36f8c0=_0xe9bd('0x28');return db['UserProfileResource'][_0xe9bd('0x26')]({'where':{'type':_0x36f8c0,'resourceId':_0x238ab1['id']}})[_0xe9bd('0x25')](function(){return _0x4ecaf5;});})[_0xe9bd('0x25')](function(){_0x133318[_0xe9bd('0x19')](0xcc)[_0xe9bd('0x1a')]();});}};}function handleEntityNotFound(_0xb52d45,_0x399f3c){return function(_0x43ea90){if(!_0x43ea90){_0xb52d45[_0xe9bd('0x29')](0x194);}return _0x43ea90;};}function handleError(_0x5987af,_0x3c211a){_0x3c211a=_0x3c211a||0x1f4;return function(_0x38fdfa){logger['error'](_0x38fdfa[_0xe9bd('0x2a')]);if(_0x38fdfa[_0xe9bd('0x2b')]){delete _0x38fdfa[_0xe9bd('0x2b')];}_0x5987af[_0xe9bd('0x19')](_0x3c211a)[_0xe9bd('0x2c')](_0x38fdfa);};}exports[_0xe9bd('0x2d')]=function(_0x519f48,_0x5b7f1d){var _0x1de54c={},_0x56e409={},_0xa45eb0={'count':0x0,'rows':[]};var _0x1f2c0e=_[_0xe9bd('0x2e')](db[_0xe9bd('0x2f')][_0xe9bd('0x30')],function(_0x509e36){return{'name':_0x509e36['fieldName'],'type':_0x509e36[_0xe9bd('0x31')][_0xe9bd('0x32')]};});_0x56e409[_0xe9bd('0x33')]=_[_0xe9bd('0x2e')](_0x1f2c0e,_0xe9bd('0x2b'));_0x56e409[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x519f48[_0xe9bd('0x34')]);_0x56e409[_0xe9bd('0x36')]=_['intersection'](_0x56e409[_0xe9bd('0x33')],_0x56e409[_0xe9bd('0x34')]);_0x1de54c[_0xe9bd('0x37')]=_['intersection'](_0x56e409['model'],qs[_0xe9bd('0x38')](_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x38')]));_0x1de54c[_0xe9bd('0x37')]=_0x1de54c[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x1de54c[_0xe9bd('0x37')]:_0x56e409[_0xe9bd('0x33')];if(!_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x3a')](_0xe9bd('0x3b'))){_0x1de54c[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x1de54c[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x519f48[_0xe9bd('0x34')]['offset']);}_0x1de54c[_0xe9bd('0x3c')]=qs[_0xe9bd('0x3d')](_0x519f48['query'][_0xe9bd('0x3d')]);_0x1de54c[_0xe9bd('0x3e')]=qs['filters'](_['pick'](_0x519f48[_0xe9bd('0x34')],_0x56e409[_0xe9bd('0x36')]),_0x1f2c0e);if(_0x519f48['query'][_0xe9bd('0x3f')]){_0x1de54c[_0xe9bd('0x3e')]=_[_0xe9bd('0x40')](_0x1de54c['where'],{'$or':_[_0xe9bd('0x2e')](_0x1f2c0e,function(_0x4d1945){if(_0x4d1945[_0xe9bd('0x31')]!==_0xe9bd('0x41')){var _0x63d67c={};_0x63d67c[_0x4d1945[_0xe9bd('0x2b')]]={'$like':'%'+_0x519f48['query'][_0xe9bd('0x3f')]+'%'};return _0x63d67c;}})});}_0x1de54c=_[_0xe9bd('0x40')]({},_0x1de54c,_0x519f48[_0xe9bd('0x42')]);var _0x3f1212={'where':_0x1de54c[_0xe9bd('0x3e')]};return db[_0xe9bd('0x2f')][_0xe9bd('0x1c')](_0x3f1212)[_0xe9bd('0x25')](function(_0x2b5a71){_0xa45eb0[_0xe9bd('0x1c')]=_0x2b5a71;if(_0x519f48['query']['includeAll']){_0x1de54c[_0xe9bd('0x43')]=[{'all':!![]}];}return db['ContactItemType'][_0xe9bd('0x44')](_0x1de54c);})[_0xe9bd('0x25')](function(_0x41881a){_0xa45eb0['rows']=_0x41881a;return _0xa45eb0;})[_0xe9bd('0x25')](respondWithFilteredResult(_0x5b7f1d,_0x1de54c))[_0xe9bd('0x45')](handleError(_0x5b7f1d,null));};exports[_0xe9bd('0x46')]=function(_0x5a4460,_0x2ef01b){var _0x3a5703={'raw':!![],'where':{'id':_0x5a4460[_0xe9bd('0x47')]['id']}},_0x2b3cd7={};_0x2b3cd7[_0xe9bd('0x33')]=_[_0xe9bd('0x35')](db[_0xe9bd('0x2f')][_0xe9bd('0x30')]);_0x2b3cd7[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x5a4460[_0xe9bd('0x34')]);_0x2b3cd7[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x2b3cd7[_0xe9bd('0x33')],_0x2b3cd7[_0xe9bd('0x34')]);_0x3a5703['attributes']=_['intersection'](_0x2b3cd7[_0xe9bd('0x33')],qs[_0xe9bd('0x38')](_0x5a4460[_0xe9bd('0x34')]['fields']));_0x3a5703['attributes']=_0x3a5703[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x3a5703[_0xe9bd('0x37')]:_0x2b3cd7[_0xe9bd('0x33')];if(_0x5a4460[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x3a5703[_0xe9bd('0x43')]=[{'all':!![]}];}_0x3a5703=_['merge']({},_0x3a5703,_0x5a4460[_0xe9bd('0x42')]);return db['ContactItemType'][_0xe9bd('0x4a')](_0x3a5703)[_0xe9bd('0x25')](handleEntityNotFound(_0x2ef01b,null))[_0xe9bd('0x25')](respondWithResult(_0x2ef01b,null))[_0xe9bd('0x45')](handleError(_0x2ef01b,null));};exports[_0xe9bd('0x4b')]=function(_0x4b7b67,_0x3317d6){return db[_0xe9bd('0x2f')][_0xe9bd('0x4b')](_0x4b7b67['body'],{})[_0xe9bd('0x25')](function(_0x476f23){var _0x34f787=_0x4b7b67['user'][_0xe9bd('0x27')]({'plain':!![]});if(!_0x34f787)throw new Error(_0xe9bd('0x4c'));if(_0x34f787[_0xe9bd('0x4d')]===_0xe9bd('0x4e')){var _0x1ee09c=_0x476f23['get']({'plain':!![]});var _0x3f4833='ContactItemTypes';return db[_0xe9bd('0x4f')][_0xe9bd('0x4a')]({'where':{'name':_0x3f4833,'userProfileId':_0x34f787[_0xe9bd('0x50')]},'raw':!![]})[_0xe9bd('0x25')](function(_0x194b7d){if(_0x194b7d&&_0x194b7d['autoAssociation']===0x0){return db[_0xe9bd('0x51')]['create']({'name':_0x1ee09c[_0xe9bd('0x2b')],'resourceId':_0x1ee09c['id'],'type':_0x194b7d[_0xe9bd('0x2b')],'sectionId':_0x194b7d['id']},{})['then'](function(){return _0x476f23;});}else{return _0x476f23;}})['catch'](function(_0x1ce539){logger['error'](_0xe9bd('0x52'),_0x1ce539);throw _0x1ce539;});}return _0x476f23;})['then'](respondWithResult(_0x3317d6,0xc9))[_0xe9bd('0x45')](handleError(_0x3317d6,null));};exports[_0xe9bd('0x24')]=function(_0x5496d7,_0x55f619){if(_0x5496d7['body']['id']){delete _0x5496d7[_0xe9bd('0x53')]['id'];}return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x5496d7['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x55f619,null))[_0xe9bd('0x25')](saveUpdates(_0x5496d7[_0xe9bd('0x53')],null))[_0xe9bd('0x25')](respondWithResult(_0x55f619,null))['catch'](handleError(_0x55f619,null));};exports['destroy']=function(_0x441f89,_0x493aae){return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x441f89[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x493aae,null))[_0xe9bd('0x25')](removeEntity(_0x493aae,null))[_0xe9bd('0x45')](handleError(_0x493aae,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index e2c3291..d84db37 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6e9=['define','tools_contact_item_types','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./contactItemType.attributes','exports'];(function(_0x121195,_0x2cd8b8){var _0x363aea=function(_0xa148f9){while(--_0xa148f9){_0x121195['push'](_0x121195['shift']());}};_0x363aea(++_0x2cd8b8);}(_0xe6e9,0x182));var _0x9e6e=function(_0x7d2c9f,_0xba0aca){_0x7d2c9f=_0x7d2c9f-0x0;var _0x2cc7ef=_0xe6e9[_0x7d2c9f];return _0x2cc7ef;};'use strict';var _=require(_0x9e6e('0x0'));var util=require(_0x9e6e('0x1'));var logger=require(_0x9e6e('0x2'))('api');var moment=require(_0x9e6e('0x3'));var BPromise=require(_0x9e6e('0x4'));var rp=require(_0x9e6e('0x5'));var fs=require('fs');var path=require(_0x9e6e('0x6'));var rimraf=require(_0x9e6e('0x7'));var config=require('../../config/environment');var attributes=require(_0x9e6e('0x8'));module[_0x9e6e('0x9')]=function(_0x206572,_0x1e8e5e){return _0x206572[_0x9e6e('0xa')]('ContactItemType',attributes,{'tableName':_0x9e6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26d1=['define','tools_contact_item_types','lodash','../../config/logger','api','moment','bluebird','rimraf','./contactItemType.attributes','exports'];(function(_0x538ba5,_0x230141){var _0x248441=function(_0x2be38c){while(--_0x2be38c){_0x538ba5['push'](_0x538ba5['shift']());}};_0x248441(++_0x230141);}(_0x26d1,0x8e));var _0x126d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x26d1[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x126d('0x0'));var util=require('util');var logger=require(_0x126d('0x1'))(_0x126d('0x2'));var moment=require(_0x126d('0x3'));var BPromise=require(_0x126d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x126d('0x5'));var config=require('../../config/environment');var attributes=require(_0x126d('0x6'));module[_0x126d('0x7')]=function(_0x442e04,_0x449ed0){return _0x442e04[_0x126d('0x8')]('ContactItemType',attributes,{'tableName':_0x126d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 9227af2..954a3fa 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bdb=['request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s'];(function(_0x5d2131,_0x2c3c20){var _0x4d5914=function(_0x4b8e65){while(--_0x4b8e65){_0x5d2131['push'](_0x5d2131['shift']());}};_0x4d5914(++_0x2c3c20);}(_0x2bdb,0x105));var _0xb2bd=function(_0x3d6689,_0x482c10){_0x3d6689=_0x3d6689-0x0;var _0x33be64=_0x2bdb[_0x3d6689];return _0x33be64;};'use strict';var _=require(_0xb2bd('0x0'));var util=require('util');var moment=require(_0xb2bd('0x1'));var BPromise=require('bluebird');var rs=require(_0xb2bd('0x2'));var fs=require('fs');var Redis=require(_0xb2bd('0x3'));var db=require(_0xb2bd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2bd('0x5'))(_0xb2bd('0x6'));var config=require(_0xb2bd('0x7'));var jayson=require(_0xb2bd('0x8'));var client=jayson[_0xb2bd('0x9')][_0xb2bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bff5b,_0x5bae78,_0x21462b){return new BPromise(function(_0x4d9d3f,_0x181f5a){return client[_0xb2bd('0xb')](_0x3bff5b,_0x21462b)[_0xb2bd('0xc')](function(_0xeaa2b7){logger[_0xb2bd('0xd')](_0xb2bd('0xe'),_0x5bae78,_0xb2bd('0xf'));logger[_0xb2bd('0x10')](_0xb2bd('0x11'),_0x5bae78,'request\x20sent',JSON[_0xb2bd('0x12')](_0xeaa2b7));if(_0xeaa2b7[_0xb2bd('0x13')]){if(_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x14')]===0x1f4){logger[_0xb2bd('0x13')](_0xb2bd('0xe'),_0x5bae78,_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);return _0x181f5a(_0xeaa2b7['error'][_0xb2bd('0x15')]);}logger['error'](_0xb2bd('0xe'),_0x5bae78,_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);return _0x4d9d3f(_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);}else{logger['info'](_0xb2bd('0xe'),_0x5bae78,_0xb2bd('0xf'));_0x4d9d3f(_0xeaa2b7[_0xb2bd('0x16')][_0xb2bd('0x15')]);}})['catch'](function(_0x14950f){logger[_0xb2bd('0x13')]('ContactItemType,\x20%s,\x20%s',_0x5bae78,_0x14950f);_0x181f5a(_0x14950f);});});} \ No newline at end of file +var _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x493683,_0x10b42a){var _0x5b2a67=function(_0x54c4cf){while(--_0x54c4cf){_0x493683['push'](_0x493683['shift']());}};_0x5b2a67(++_0x10b42a);}(_0x668b,0x140));var _0xb668=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x668b[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('ContactItemType,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 665b32c..77b99d9 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0dd8=['post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show'];(function(_0x10f3cc,_0x44b3bf){var _0x464ba1=function(_0x182f63){while(--_0x182f63){_0x10f3cc['push'](_0x10f3cc['shift']());}};_0x464ba1(++_0x44b3bf);}(_0x0dd8,0x6b));var _0x80dd=function(_0xee35d6,_0x318eec){_0xee35d6=_0xee35d6-0x0;var _0x1b4e24=_0x0dd8[_0xee35d6];return _0x1b4e24;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x80dd('0x0'));var timeout=require(_0x80dd('0x1'));var express=require(_0x80dd('0x2'));var router=express[_0x80dd('0x3')]();var auth=require(_0x80dd('0x4'));var interaction=require(_0x80dd('0x5'));var config=require(_0x80dd('0x6'));var controller=require(_0x80dd('0x7'));router[_0x80dd('0x8')]('/',auth[_0x80dd('0x9')](),controller[_0x80dd('0xa')]);router[_0x80dd('0x8')](_0x80dd('0xb'),auth[_0x80dd('0x9')](),controller[_0x80dd('0xc')]);router[_0x80dd('0xd')]('/',auth['isAuthenticated'](),controller[_0x80dd('0xe')]);router[_0x80dd('0xf')]('/:id',auth[_0x80dd('0x9')](),controller[_0x80dd('0x10')]);router[_0x80dd('0x11')](_0x80dd('0xb'),auth[_0x80dd('0x9')](),controller[_0x80dd('0x12')]);module[_0x80dd('0x13')]=router; \ No newline at end of file +var _0x71c8=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./contactItemType.controller','get'];(function(_0x325fb6,_0x370d6c){var _0x42c761=function(_0x2645b0){while(--_0x2645b0){_0x325fb6['push'](_0x325fb6['shift']());}};_0x42c761(++_0x370d6c);}(_0x71c8,0xf2));var _0x871c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x71c8[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x871c('0x0'));var util=require(_0x871c('0x1'));var path=require(_0x871c('0x2'));var timeout=require(_0x871c('0x3'));var express=require(_0x871c('0x4'));var router=express[_0x871c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x871c('0x6'));var config=require(_0x871c('0x7'));var controller=require(_0x871c('0x8'));router[_0x871c('0x9')]('/',auth[_0x871c('0xa')](),controller[_0x871c('0xb')]);router[_0x871c('0x9')](_0x871c('0xc'),auth[_0x871c('0xa')](),controller[_0x871c('0xd')]);router[_0x871c('0xe')]('/',auth[_0x871c('0xa')](),controller[_0x871c('0xf')]);router[_0x871c('0x10')](_0x871c('0xc'),auth[_0x871c('0xa')](),controller[_0x871c('0x11')]);router[_0x871c('0x12')](_0x871c('0xc'),auth['isAuthenticated'](),controller[_0x871c('0x13')]);module[_0x871c('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 27377fe..018dcb7 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 _0x3c2a=['exports','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0x22cfb7,_0x1558f8){_0x22cfb7=_0x22cfb7-0x0;var _0x282433=_0x3c2a[_0x22cfb7];return _0x282433;};'use strict';var Sequelize=require(_0xa3c2('0x0'));module[_0xa3c2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa3c2('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0f9f=['STRING','name','sequelize','exports'];(function(_0x4b793b,_0x1ee112){var _0xcfbd6a=function(_0x2eb91c){while(--_0x2eb91c){_0x4b793b['push'](_0x4b793b['shift']());}};_0xcfbd6a(++_0x1ee112);}(_0x0f9f,0xae));var _0xf0f9=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0x0f9f[_0x16b992];return _0x385c78;};'use strict';var Sequelize=require(_0xf0f9('0x0'));module[_0xf0f9('0x1')]={'name':{'type':Sequelize[_0xf0f9('0x2')],'allowNull':![],'unique':_0xf0f9('0x3')},'description':{'type':Sequelize[_0xf0f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3ba8056..d480599 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 _0xae72=['multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','findOne','nolimit','getItems','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','Dashboard','includeAll','rows','catch','show','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','role','UserProfileSection','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae72,0x184));var _0x2ae7=function(_0x581b73,_0x4fa43c){_0x581b73=_0x581b73-0x0;var _0x3ea0ec=_0xae72[_0x581b73];return _0x3ea0ec;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2ae7('0x0'));var zipdir=require(_0x2ae7('0x1'));var jsonpatch=require(_0x2ae7('0x2'));var rp=require(_0x2ae7('0x3'));var moment=require(_0x2ae7('0x4'));var BPromise=require(_0x2ae7('0x5'));var Mustache=require(_0x2ae7('0x6'));var util=require(_0x2ae7('0x7'));var path=require(_0x2ae7('0x8'));var sox=require(_0x2ae7('0x9'));var csv=require(_0x2ae7('0xa'));var ejs=require(_0x2ae7('0xb'));var fs=require('fs');var _=require(_0x2ae7('0xc'));var squel=require(_0x2ae7('0xd'));var crypto=require(_0x2ae7('0xe'));var jsforce=require(_0x2ae7('0xf'));var deskjs=require(_0x2ae7('0x10'));var toCsv=require(_0x2ae7('0xa'));var querystring=require('querystring');var Papa=require(_0x2ae7('0x11'));var Redis=require(_0x2ae7('0x12'));var authService=require(_0x2ae7('0x13'));var qs=require(_0x2ae7('0x14'));var as=require(_0x2ae7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ae7('0x16'))(_0x2ae7('0x17'));var utils=require('../../config/utils');var config=require(_0x2ae7('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2ae7('0x19')](config[_0x2ae7('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ae7('0x1b'))(new Redis(config[_0x2ae7('0x1a')]));require(_0x2ae7('0x1c'))[_0x2ae7('0x1d')](socket);function respondWithStatusCode(_0x2aa0cc,_0x2e8eda){_0x2e8eda=_0x2e8eda||0xcc;return function(_0x3b03d3){if(_0x3b03d3){return _0x2aa0cc[_0x2ae7('0x1e')](_0x2e8eda);}return _0x2aa0cc['status'](_0x2e8eda)['end']();};}function respondWithResult(_0x9dd63a,_0x1e0bb2){_0x1e0bb2=_0x1e0bb2||0xc8;return function(_0x10a30e){if(_0x10a30e){return _0x9dd63a[_0x2ae7('0x1f')](_0x1e0bb2)[_0x2ae7('0x20')](_0x10a30e);}};}function respondWithFilteredResult(_0x54d03c,_0x243067){return function(_0x4b740f){if(_0x4b740f){var _0x32a17e=_0x4b740f[_0x2ae7('0x21')],_0x5c4907=_0x243067[_0x2ae7('0x22')],_0x10a37e=_0x243067[_0x2ae7('0x22')]+_0x243067[_0x2ae7('0x23')],_0x346ca2;if(_0x10a37e>=_0x32a17e){_0x10a37e=_0x32a17e;_0x346ca2=0xc8;}else{_0x346ca2=0xce;}_0x54d03c[_0x2ae7('0x1f')](_0x346ca2);return _0x54d03c[_0x2ae7('0x24')](_0x2ae7('0x25'),_0x5c4907+'-'+_0x10a37e+'/'+_0x32a17e)[_0x2ae7('0x20')](_0x4b740f);}return null;};}function patchUpdates(_0x231ff3){return function(_0x46b2fa){try{jsonpatch[_0x2ae7('0x26')](_0x46b2fa,_0x231ff3,!![]);}catch(_0x529365){return BPromise[_0x2ae7('0x27')](_0x529365);}return _0x46b2fa[_0x2ae7('0x28')]();};}function saveUpdates(_0xbeacfa,_0x378396){return function(_0x33d9f0){if(_0x33d9f0){return _0x33d9f0[_0x2ae7('0x29')](_0xbeacfa)[_0x2ae7('0x2a')](function(_0x3f1576){return _0x3f1576;});}return null;};}function removeEntity(_0xad1f00,_0x5c659a){return function(_0x214150){if(_0x214150){return _0x214150[_0x2ae7('0x2b')]()[_0x2ae7('0x2a')](function(){var _0x9114ca=_0x214150[_0x2ae7('0x2c')]({'plain':!![]});var _0x597694='CustomDashboards';return db['UserProfileResource'][_0x2ae7('0x2b')]({'where':{'type':_0x597694,'resourceId':_0x9114ca['id']}})[_0x2ae7('0x2a')](function(){return _0x214150;});})[_0x2ae7('0x2a')](function(){_0xad1f00[_0x2ae7('0x1f')](0xcc)[_0x2ae7('0x2d')]();});}};}function handleEntityNotFound(_0x2b30ee,_0x528ec1){return function(_0xca0c7f){if(!_0xca0c7f){_0x2b30ee[_0x2ae7('0x1e')](0x194);}return _0xca0c7f;};}function handleError(_0x491524,_0x3c862e){_0x3c862e=_0x3c862e||0x1f4;return function(_0x3a3c7f){logger[_0x2ae7('0x2e')](_0x3a3c7f[_0x2ae7('0x2f')]);if(_0x3a3c7f[_0x2ae7('0x30')]){delete _0x3a3c7f['name'];}_0x491524[_0x2ae7('0x1f')](_0x3c862e)[_0x2ae7('0x31')](_0x3a3c7f);};}exports[_0x2ae7('0x32')]=function(_0x94df44,_0x2791ba){var _0x4b5dd0={},_0x1ac97c={},_0x50ca72={'count':0x0,'rows':[]};var _0x5f35fc=_[_0x2ae7('0x33')](db['Dashboard'][_0x2ae7('0x34')],function(_0x2fe1e9){return{'name':_0x2fe1e9[_0x2ae7('0x35')],'type':_0x2fe1e9[_0x2ae7('0x36')][_0x2ae7('0x37')]};});_0x1ac97c[_0x2ae7('0x38')]=_[_0x2ae7('0x33')](_0x5f35fc,_0x2ae7('0x30'));_0x1ac97c['query']=_[_0x2ae7('0x39')](_0x94df44[_0x2ae7('0x3a')]);_0x1ac97c[_0x2ae7('0x3b')]=_[_0x2ae7('0x3c')](_0x1ac97c['model'],_0x1ac97c[_0x2ae7('0x3a')]);_0x4b5dd0[_0x2ae7('0x3d')]=_[_0x2ae7('0x3c')](_0x1ac97c['model'],qs[_0x2ae7('0x3e')](_0x94df44[_0x2ae7('0x3a')][_0x2ae7('0x3e')]));_0x4b5dd0[_0x2ae7('0x3d')]=_0x4b5dd0['attributes'][_0x2ae7('0x3f')]?_0x4b5dd0['attributes']:_0x1ac97c[_0x2ae7('0x38')];if(!_0x94df44[_0x2ae7('0x3a')]['hasOwnProperty']('nolimit')){_0x4b5dd0[_0x2ae7('0x23')]=qs[_0x2ae7('0x23')](_0x94df44[_0x2ae7('0x3a')][_0x2ae7('0x23')]);_0x4b5dd0['offset']=qs[_0x2ae7('0x22')](_0x94df44[_0x2ae7('0x3a')]['offset']);}_0x4b5dd0[_0x2ae7('0x40')]=qs[_0x2ae7('0x41')](_0x94df44[_0x2ae7('0x3a')][_0x2ae7('0x41')]);_0x4b5dd0[_0x2ae7('0x42')]=qs[_0x2ae7('0x3b')](_[_0x2ae7('0x43')](_0x94df44[_0x2ae7('0x3a')],_0x1ac97c[_0x2ae7('0x3b')]),_0x5f35fc);if(_0x94df44['query'][_0x2ae7('0x44')]){_0x4b5dd0[_0x2ae7('0x42')]=_[_0x2ae7('0x45')](_0x4b5dd0[_0x2ae7('0x42')],{'$or':_[_0x2ae7('0x33')](_0x5f35fc,function(_0x4d2c6e){if(_0x4d2c6e[_0x2ae7('0x36')]!==_0x2ae7('0x46')){var _0x3ba4ef={};_0x3ba4ef[_0x4d2c6e[_0x2ae7('0x30')]]={'$like':'%'+_0x94df44[_0x2ae7('0x3a')][_0x2ae7('0x44')]+'%'};return _0x3ba4ef;}})});}_0x4b5dd0=_[_0x2ae7('0x45')]({},_0x4b5dd0,_0x94df44[_0x2ae7('0x47')]);var _0x11ed0b={'where':_0x4b5dd0[_0x2ae7('0x42')]};return db[_0x2ae7('0x48')][_0x2ae7('0x21')](_0x11ed0b)[_0x2ae7('0x2a')](function(_0x11e21b){_0x50ca72[_0x2ae7('0x21')]=_0x11e21b;if(_0x94df44[_0x2ae7('0x3a')][_0x2ae7('0x49')]){_0x4b5dd0['include']=[{'all':!![]}];}return db[_0x2ae7('0x48')]['findAll'](_0x4b5dd0);})[_0x2ae7('0x2a')](function(_0x5006ae){_0x50ca72[_0x2ae7('0x4a')]=_0x5006ae;return _0x50ca72;})[_0x2ae7('0x2a')](respondWithFilteredResult(_0x2791ba,_0x4b5dd0))[_0x2ae7('0x4b')](handleError(_0x2791ba,null));};exports[_0x2ae7('0x4c')]=function(_0x48e97e,_0x4ac0ca){var _0x37eb10={'raw':![],'where':{'id':_0x48e97e['params']['id']}},_0x16e717={};_0x16e717[_0x2ae7('0x38')]=_[_0x2ae7('0x39')](db[_0x2ae7('0x48')][_0x2ae7('0x34')]);_0x16e717[_0x2ae7('0x3a')]=_['keys'](_0x48e97e[_0x2ae7('0x3a')]);_0x16e717[_0x2ae7('0x3b')]=_[_0x2ae7('0x3c')](_0x16e717['model'],_0x16e717[_0x2ae7('0x3a')]);_0x37eb10['attributes']=_[_0x2ae7('0x3c')](_0x16e717['model'],qs[_0x2ae7('0x3e')](_0x48e97e[_0x2ae7('0x3a')][_0x2ae7('0x3e')]));_0x37eb10[_0x2ae7('0x3d')]=_0x37eb10['attributes'][_0x2ae7('0x3f')]?_0x37eb10['attributes']:_0x16e717[_0x2ae7('0x38')];if(_0x48e97e[_0x2ae7('0x3a')]['includeAll']){_0x37eb10[_0x2ae7('0x4d')]=[{'all':!![]}];}_0x37eb10=_['merge']({},_0x37eb10,_0x48e97e['options']);return db[_0x2ae7('0x48')]['find'](_0x37eb10)[_0x2ae7('0x2a')](handleEntityNotFound(_0x4ac0ca,null))[_0x2ae7('0x2a')](respondWithResult(_0x4ac0ca,null))['catch'](handleError(_0x4ac0ca,null));};exports[_0x2ae7('0x4e')]=function(_0x3d1d2d,_0xbee4d3){return db[_0x2ae7('0x48')][_0x2ae7('0x4e')](_0x3d1d2d[_0x2ae7('0x4f')],{})[_0x2ae7('0x2a')](function(_0x45377a){var _0x10fb17=_0x3d1d2d[_0x2ae7('0x50')][_0x2ae7('0x2c')]({'plain':!![]});if(!_0x10fb17)throw new Error(_0x2ae7('0x51'));if(_0x10fb17['role']===_0x2ae7('0x50')){var _0xaf6cad=_0x45377a['get']({'plain':!![]});var _0x516d3c=_0x2ae7('0x52');return db['UserProfileSection'][_0x2ae7('0x53')]({'where':{'name':_0x516d3c,'userProfileId':_0x10fb17[_0x2ae7('0x54')]},'raw':!![]})[_0x2ae7('0x2a')](function(_0x2af8b0){if(_0x2af8b0&&_0x2af8b0[_0x2ae7('0x55')]===0x0){return db[_0x2ae7('0x56')][_0x2ae7('0x4e')]({'name':_0xaf6cad[_0x2ae7('0x30')],'resourceId':_0xaf6cad['id'],'type':_0x2af8b0[_0x2ae7('0x30')],'sectionId':_0x2af8b0['id']},{})['then'](function(){return _0x45377a;});}else{return _0x45377a;}})[_0x2ae7('0x4b')](function(_0x2f3538){logger[_0x2ae7('0x2e')](_0x2ae7('0x57'),_0x2f3538);throw _0x2f3538;});}return _0x45377a;})[_0x2ae7('0x2a')](respondWithResult(_0xbee4d3,0xc9))[_0x2ae7('0x4b')](handleError(_0xbee4d3,null));};exports[_0x2ae7('0x58')]=function(_0x4113b5,_0x9e87e2){var _0x361c8c={'where':{'id':_0x4113b5[_0x2ae7('0x59')]['id']}},_0x4dc3b8={};_0x4dc3b8[_0x2ae7('0x38')]=_[_0x2ae7('0x39')](db['Dashboard'][_0x2ae7('0x34')]);_0x361c8c['attributes']=_[_0x2ae7('0x3c')](_0x4dc3b8['model'],qs[_0x2ae7('0x3e')](_0x4113b5[_0x2ae7('0x3a')][_0x2ae7('0x3e')]));_0x361c8c[_0x2ae7('0x3d')]=_0x361c8c[_0x2ae7('0x3d')][_0x2ae7('0x3f')]?_0x361c8c[_0x2ae7('0x3d')]:_0x4dc3b8[_0x2ae7('0x38')];if(_0x4113b5[_0x2ae7('0x3a')][_0x2ae7('0x49')]){_0x361c8c[_0x2ae7('0x4d')]=[{'all':!![]}];}_0x361c8c=_[_0x2ae7('0x45')]({},_0x361c8c,_0x4113b5['options']);return db['Dashboard']['find'](_0x361c8c)[_0x2ae7('0x2a')](handleEntityNotFound(_0x9e87e2,null))[_0x2ae7('0x2a')](function(_0xcfe1fe){if(_0xcfe1fe){var _0x145cd1=_0xcfe1fe[_0x2ae7('0x2c')]({'plain':!![]});_0x145cd1=qs[_0x2ae7('0x5a')](_0x145cd1,['id','createdAt',_0x2ae7('0x5b')]);_0x4113b5[_0x2ae7('0x4f')]=_['omit'](_0x4113b5['body'],['id','createdAt','updatedAt']);return db[_0x2ae7('0x48')][_0x2ae7('0x4e')](_[_0x2ae7('0x45')](_0x145cd1,_0x4113b5[_0x2ae7('0x4f')]),{'include':_0x4113b5[_0x2ae7('0x3a')][_0x2ae7('0x49')]?[{'all':!![]}]:undefined})[_0x2ae7('0x2a')](function(_0x5d67b8){var _0x35d5b7=_0x4113b5[_0x2ae7('0x50')][_0x2ae7('0x2c')]({'plain':!![]});if(!_0x35d5b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35d5b7[_0x2ae7('0x5c')]===_0x2ae7('0x50')){var _0x3b963b=_0x5d67b8[_0x2ae7('0x2c')]({'plain':!![]});var _0x1d3de7='CustomDashboards';return db[_0x2ae7('0x5d')]['find']({'where':{'name':_0x1d3de7,'userProfileId':_0x35d5b7[_0x2ae7('0x54')]},'raw':!![]})[_0x2ae7('0x2a')](function(_0x5d3ff2){if(_0x5d3ff2&&_0x5d3ff2[_0x2ae7('0x55')]===0x0){return db[_0x2ae7('0x56')][_0x2ae7('0x4e')]({'name':_0x3b963b[_0x2ae7('0x30')],'resourceId':_0x3b963b['id'],'type':_0x5d3ff2['name'],'sectionId':_0x5d3ff2['id']},{})[_0x2ae7('0x2a')](function(){return _0x5d67b8;});}else{return _0x5d67b8;}})[_0x2ae7('0x4b')](function(_0x2cfc18){logger[_0x2ae7('0x2e')](_0x2ae7('0x57'),_0x2cfc18);throw _0x2cfc18;});}return _0x5d67b8;});}})[_0x2ae7('0x2a')](respondWithResult(_0x9e87e2,0xc9))[_0x2ae7('0x4b')](handleError(_0x9e87e2,null));};exports[_0x2ae7('0x29')]=function(_0x1c0034,_0x4b5ce0){if(_0x1c0034[_0x2ae7('0x4f')]['id']){delete _0x1c0034[_0x2ae7('0x4f')]['id'];}return db[_0x2ae7('0x48')][_0x2ae7('0x53')]({'where':{'id':_0x1c0034[_0x2ae7('0x59')]['id']}})[_0x2ae7('0x2a')](handleEntityNotFound(_0x4b5ce0,null))['then'](saveUpdates(_0x1c0034[_0x2ae7('0x4f')],null))['then'](respondWithResult(_0x4b5ce0,null))[_0x2ae7('0x4b')](handleError(_0x4b5ce0,null));};exports[_0x2ae7('0x2b')]=function(_0x4cebad,_0x310897){return db[_0x2ae7('0x48')]['find']({'where':{'id':_0x4cebad['params']['id']}})[_0x2ae7('0x2a')](handleEntityNotFound(_0x310897,null))[_0x2ae7('0x2a')](removeEntity(_0x310897,null))['catch'](handleError(_0x310897,null));};function widgetAttributes(_0xa0aa2){try{switch(_0xa0aa2['type']){case _0x2ae7('0x5e'):return[{'name':_0x2ae7('0x5f'),'value':_0xa0aa2[_0x2ae7('0x5f')]||(_0xa0aa2['attrs']&&_0xa0aa2[_0x2ae7('0x60')][0x0]?_0xa0aa2[_0x2ae7('0x60')][0x0][_0x2ae7('0x61')]:undefined)||'https://'}];case _0x2ae7('0x62'):return[{'name':_0x2ae7('0x63'),'value':_0xa0aa2[_0x2ae7('0x63')]||(_0xa0aa2['attrs']&&_0xa0aa2['attrs'][0x0]?_0xa0aa2[_0x2ae7('0x60')][0x0][_0x2ae7('0x61')]:undefined)||''}];case _0x2ae7('0x64'):return[{'name':_0x2ae7('0x65'),'value':_0xa0aa2['attrHourFormat']||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2[_0x2ae7('0x60')][0x0]?_0xa0aa2['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x2ae7('0x66'),'value':_0xa0aa2['attrTimezone']||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2['attrs'][0x1]?_0xa0aa2[_0x2ae7('0x60')][0x1]['value']:undefined)||_0x2ae7('0x67')},{'name':_0x2ae7('0x68'),'value':_0xa0aa2[_0x2ae7('0x68')]||(_0xa0aa2['attrs']&&_0xa0aa2[_0x2ae7('0x60')][0x2]?_0xa0aa2[_0x2ae7('0x60')][0x2][_0x2ae7('0x61')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0xa0aa2[_0x2ae7('0x69')]||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2['attrs'][0x0]?_0xa0aa2['attrs'][0x0]['value']:undefined)||_0x2ae7('0x6a')},{'name':_0x2ae7('0x6b'),'value':_0xa0aa2[_0x2ae7('0x6b')]||(_0xa0aa2['attrs']&&_0xa0aa2[_0x2ae7('0x60')][0x1]?_0xa0aa2['attrs'][0x1][_0x2ae7('0x61')]:undefined)||[]},{'name':_0x2ae7('0x68'),'value':_0xa0aa2[_0x2ae7('0x68')]||(_0xa0aa2['attrs']&&_0xa0aa2[_0x2ae7('0x60')][0x2]?_0xa0aa2[_0x2ae7('0x60')][0x2][_0x2ae7('0x61')]:undefined)||0x14}];case _0x2ae7('0x6c'):case _0x2ae7('0x6d'):return[{'name':_0x2ae7('0x6e'),'value':_0xa0aa2[_0x2ae7('0x6e')]||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2[_0x2ae7('0x60')][0x0]?_0xa0aa2['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x2ae7('0x6f'),'value':_0xa0aa2[_0x2ae7('0x6f')]||(_0xa0aa2['attrs']&&_0xa0aa2['attrs'][0x1]?_0xa0aa2[_0x2ae7('0x60')][0x1][_0x2ae7('0x61')]:undefined)||null},{'name':_0x2ae7('0x70'),'value':_0xa0aa2['attrSerie3']||(_0xa0aa2['attrs']&&_0xa0aa2[_0x2ae7('0x60')][0x2]?_0xa0aa2['attrs'][0x2][_0x2ae7('0x61')]:undefined)||null},{'name':_0x2ae7('0x6b'),'value':_0xa0aa2[_0x2ae7('0x6b')]||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2[_0x2ae7('0x60')][0x3]?_0xa0aa2[_0x2ae7('0x60')][0x3][_0x2ae7('0x61')]:undefined)||[]}];case _0x2ae7('0x71'):return[{'name':_0x2ae7('0x72'),'type':_0xa0aa2[_0x2ae7('0x73')]||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2[_0x2ae7('0x60')][0x0]?_0xa0aa2['attrs'][0x0][_0x2ae7('0x36')]:undefined)||null,'value':_0xa0aa2[_0x2ae7('0x72')]||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2['attrs'][0x0]?_0xa0aa2['attrs'][0x0][_0x2ae7('0x61')]:undefined)||null},{'name':_0x2ae7('0x74'),'value':_0xa0aa2['attrRefresh']||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2[_0x2ae7('0x60')][0x1]?_0xa0aa2[_0x2ae7('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5429e2){logger[_0x2ae7('0x2e')](_0x2ae7('0x75'),JSON[_0x2ae7('0x76')](_0x5429e2));return[];}}exports['addItem']=function(_0x5665cf,_0x41f4bd,_0x5e81bc){if(_0x5665cf[_0x2ae7('0x4f')]['id']){delete _0x5665cf[_0x2ae7('0x4f')]['id'];}return db['Dashboard'][_0x2ae7('0x53')]({'where':{'id':_0x5665cf[_0x2ae7('0x59')]['id']}})[_0x2ae7('0x2a')](handleEntityNotFound(_0x41f4bd,null))[_0x2ae7('0x2a')](function(_0x45d5e5){if(_0x45d5e5){_0x5665cf[_0x2ae7('0x4f')][_0x2ae7('0x77')]=_0x45d5e5['id'];_0x5665cf['body'][_0x2ae7('0x60')]=widgetAttributes(_0x5665cf['body']);return db[_0x2ae7('0x78')][_0x2ae7('0x4e')](_0x5665cf[_0x2ae7('0x4f')]);}})[_0x2ae7('0x2a')](respondWithResult(_0x41f4bd,null))['catch'](handleError(_0x41f4bd,null));};exports['getItems']=function(_0x1a3bec,_0x3b079a,_0x216d17){var _0x419583={};var _0xafc800={};var _0xaf7bf6;var _0x1e36bd;return db[_0x2ae7('0x48')][_0x2ae7('0x79')]({'where':{'id':_0x1a3bec[_0x2ae7('0x59')]['id']}})[_0x2ae7('0x2a')](handleEntityNotFound(_0x3b079a,null))[_0x2ae7('0x2a')](function(_0x2533f5){if(_0x2533f5){_0xaf7bf6=_0x2533f5;_0xafc800[_0x2ae7('0x38')]=_[_0x2ae7('0x39')](db[_0x2ae7('0x78')][_0x2ae7('0x34')]);_0xafc800[_0x2ae7('0x3a')]=_['keys'](_0x1a3bec[_0x2ae7('0x3a')]);_0xafc800['filters']=_[_0x2ae7('0x3c')](_0xafc800[_0x2ae7('0x38')],_0xafc800[_0x2ae7('0x3a')]);_0x419583['attributes']=_[_0x2ae7('0x3c')](_0xafc800['model'],qs['fields'](_0x1a3bec[_0x2ae7('0x3a')]['fields']));_0x419583[_0x2ae7('0x3d')]=_0x419583[_0x2ae7('0x3d')][_0x2ae7('0x3f')]?_0x419583[_0x2ae7('0x3d')]:_0xafc800['model'];_0x419583['order']=qs['sort'](_0x1a3bec[_0x2ae7('0x3a')][_0x2ae7('0x41')]);_0x419583[_0x2ae7('0x42')]=qs[_0x2ae7('0x3b')](_[_0x2ae7('0x43')](_0x1a3bec[_0x2ae7('0x3a')],_0xafc800[_0x2ae7('0x3b')]));if(_0x1a3bec['query'][_0x2ae7('0x44')]){_0x419583[_0x2ae7('0x42')]=_[_0x2ae7('0x45')](_0x419583[_0x2ae7('0x42')],{'$or':_['map'](_0x419583['attributes'],function(_0x49e255){var _0x44cb51={};_0x44cb51[_0x49e255]={'$like':'%'+_0x1a3bec['query'][_0x2ae7('0x44')]+'%'};return _0x44cb51;})});}_0x419583=_[_0x2ae7('0x45')]({},_0x419583,_0x1a3bec['options']);return _0xaf7bf6['getItems'](_0x419583);}})[_0x2ae7('0x2a')](function(_0xc93576){if(_0xc93576){_0x1e36bd=_0xc93576[_0x2ae7('0x3f')];if(!_0x1a3bec[_0x2ae7('0x3a')]['hasOwnProperty'](_0x2ae7('0x7a'))){_0x419583[_0x2ae7('0x23')]=qs[_0x2ae7('0x23')](_0x1a3bec['query'][_0x2ae7('0x23')]);_0x419583[_0x2ae7('0x22')]=qs[_0x2ae7('0x22')](_0x1a3bec['query'][_0x2ae7('0x22')]);}return _0xaf7bf6[_0x2ae7('0x7b')](_0x419583);}})[_0x2ae7('0x2a')](function(_0x53d022){if(_0x53d022){return _0x53d022?{'count':_0x1e36bd,'rows':_0x53d022}:null;}})[_0x2ae7('0x2a')](respondWithResult(_0x3b079a,null))[_0x2ae7('0x4b')](handleError(_0x3b079a,null));}; \ No newline at end of file +var _0xb0d3=['attrUrl','attrs','https://','custom','value','clock','HH:mm:ss','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','addItem','DashboardId','DashboardItem','findOne','getItems','nolimit','eml-format','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','set','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','end','stack','name','index','map','Dashboard','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','include','findAll','rows','params','includeAll','find','catch','create','body','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb0d3,0xfa));var _0x3b0d=function(_0x89100d,_0x59c43d){_0x89100d=_0x89100d-0x0;var _0x15974a=_0xb0d3[_0x89100d];return _0x15974a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b0d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3b0d('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x3b0d('0x2'));var util=require('util');var path=require(_0x3b0d('0x3'));var sox=require(_0x3b0d('0x4'));var csv=require(_0x3b0d('0x5'));var ejs=require(_0x3b0d('0x6'));var fs=require('fs');var _=require(_0x3b0d('0x7'));var squel=require(_0x3b0d('0x8'));var crypto=require(_0x3b0d('0x9'));var jsforce=require(_0x3b0d('0xa'));var deskjs=require(_0x3b0d('0xb'));var toCsv=require(_0x3b0d('0x5'));var querystring=require(_0x3b0d('0xc'));var Papa=require(_0x3b0d('0xd'));var Redis=require(_0x3b0d('0xe'));var authService=require(_0x3b0d('0xf'));var qs=require(_0x3b0d('0x10'));var as=require(_0x3b0d('0x11'));var hardwareService=require(_0x3b0d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3b0d('0x13'));var config=require(_0x3b0d('0x14'));var db=require(_0x3b0d('0x15'))['db'];config[_0x3b0d('0x16')]=_[_0x3b0d('0x17')](config[_0x3b0d('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b0d('0x18'))(new Redis(config[_0x3b0d('0x16')]));require(_0x3b0d('0x19'))[_0x3b0d('0x1a')](socket);function respondWithStatusCode(_0x5280d8,_0x4543ef){_0x4543ef=_0x4543ef||0xcc;return function(_0x38157e){if(_0x38157e){return _0x5280d8[_0x3b0d('0x1b')](_0x4543ef);}return _0x5280d8[_0x3b0d('0x1c')](_0x4543ef)['end']();};}function respondWithResult(_0x4522eb,_0x2467d7){_0x2467d7=_0x2467d7||0xc8;return function(_0xc73bd8){if(_0xc73bd8){return _0x4522eb['status'](_0x2467d7)[_0x3b0d('0x1d')](_0xc73bd8);}};}function respondWithFilteredResult(_0x2a40b8,_0x1c8bbe){return function(_0x591003){if(_0x591003){var _0x4b2be9=_0x591003['count'],_0x511a57=_0x1c8bbe['offset'],_0x4589d2=_0x1c8bbe[_0x3b0d('0x1e')]+_0x1c8bbe['limit'],_0x11ac55;if(_0x4589d2>=_0x4b2be9){_0x4589d2=_0x4b2be9;_0x11ac55=0xc8;}else{_0x11ac55=0xce;}_0x2a40b8[_0x3b0d('0x1c')](_0x11ac55);return _0x2a40b8[_0x3b0d('0x1f')]('Content-Range',_0x511a57+'-'+_0x4589d2+'/'+_0x4b2be9)[_0x3b0d('0x1d')](_0x591003);}return null;};}function patchUpdates(_0xc4ae44){return function(_0x4c01fd){try{jsonpatch[_0x3b0d('0x20')](_0x4c01fd,_0xc4ae44,!![]);}catch(_0x1a946b){return BPromise[_0x3b0d('0x21')](_0x1a946b);}return _0x4c01fd[_0x3b0d('0x22')]();};}function saveUpdates(_0x38e45,_0x447e6f){return function(_0x5093ec){if(_0x5093ec){return _0x5093ec[_0x3b0d('0x23')](_0x38e45)[_0x3b0d('0x24')](function(_0x696856){return _0x696856;});}return null;};}function removeEntity(_0x1a6eef,_0x2465ff){return function(_0x36f536){if(_0x36f536){return _0x36f536['destroy']()[_0x3b0d('0x24')](function(){var _0x37d490=_0x36f536[_0x3b0d('0x25')]({'plain':!![]});var _0x45d605=_0x3b0d('0x26');return db[_0x3b0d('0x27')][_0x3b0d('0x28')]({'where':{'type':_0x45d605,'resourceId':_0x37d490['id']}})['then'](function(){return _0x36f536;});})[_0x3b0d('0x24')](function(){_0x1a6eef[_0x3b0d('0x1c')](0xcc)[_0x3b0d('0x29')]();});}};}function handleEntityNotFound(_0x9a6152,_0x5be812){return function(_0x5904b4){if(!_0x5904b4){_0x9a6152[_0x3b0d('0x1b')](0x194);}return _0x5904b4;};}function handleError(_0x3f812f,_0x5b5b){_0x5b5b=_0x5b5b||0x1f4;return function(_0x30b818){logger['error'](_0x30b818[_0x3b0d('0x2a')]);if(_0x30b818[_0x3b0d('0x2b')]){delete _0x30b818[_0x3b0d('0x2b')];}_0x3f812f[_0x3b0d('0x1c')](_0x5b5b)['send'](_0x30b818);};}exports[_0x3b0d('0x2c')]=function(_0x239a27,_0x139c06){var _0x2d8679={},_0x527916={},_0x363f34={'count':0x0,'rows':[]};var _0x2b7731=_[_0x3b0d('0x2d')](db[_0x3b0d('0x2e')][_0x3b0d('0x2f')],function(_0x4e5959){return{'name':_0x4e5959['fieldName'],'type':_0x4e5959['type']['key']};});_0x527916[_0x3b0d('0x30')]=_[_0x3b0d('0x2d')](_0x2b7731,_0x3b0d('0x2b'));_0x527916[_0x3b0d('0x31')]=_[_0x3b0d('0x32')](_0x239a27[_0x3b0d('0x31')]);_0x527916[_0x3b0d('0x33')]=_['intersection'](_0x527916['model'],_0x527916[_0x3b0d('0x31')]);_0x2d8679[_0x3b0d('0x34')]=_[_0x3b0d('0x35')](_0x527916[_0x3b0d('0x30')],qs[_0x3b0d('0x36')](_0x239a27[_0x3b0d('0x31')]['fields']));_0x2d8679[_0x3b0d('0x34')]=_0x2d8679[_0x3b0d('0x34')][_0x3b0d('0x37')]?_0x2d8679[_0x3b0d('0x34')]:_0x527916[_0x3b0d('0x30')];if(!_0x239a27['query'][_0x3b0d('0x38')]('nolimit')){_0x2d8679[_0x3b0d('0x39')]=qs[_0x3b0d('0x39')](_0x239a27[_0x3b0d('0x31')][_0x3b0d('0x39')]);_0x2d8679[_0x3b0d('0x1e')]=qs[_0x3b0d('0x1e')](_0x239a27[_0x3b0d('0x31')][_0x3b0d('0x1e')]);}_0x2d8679[_0x3b0d('0x3a')]=qs[_0x3b0d('0x3b')](_0x239a27[_0x3b0d('0x31')][_0x3b0d('0x3b')]);_0x2d8679[_0x3b0d('0x3c')]=qs[_0x3b0d('0x33')](_[_0x3b0d('0x3d')](_0x239a27[_0x3b0d('0x31')],_0x527916[_0x3b0d('0x33')]),_0x2b7731);if(_0x239a27[_0x3b0d('0x31')][_0x3b0d('0x3e')]){_0x2d8679[_0x3b0d('0x3c')]=_[_0x3b0d('0x3f')](_0x2d8679['where'],{'$or':_[_0x3b0d('0x2d')](_0x2b7731,function(_0x490df0){if(_0x490df0[_0x3b0d('0x40')]!==_0x3b0d('0x41')){var _0x3cdd18={};_0x3cdd18[_0x490df0[_0x3b0d('0x2b')]]={'$like':'%'+_0x239a27['query'][_0x3b0d('0x3e')]+'%'};return _0x3cdd18;}})});}_0x2d8679=_[_0x3b0d('0x3f')]({},_0x2d8679,_0x239a27['options']);var _0xe42958={'where':_0x2d8679[_0x3b0d('0x3c')]};return db['Dashboard'][_0x3b0d('0x42')](_0xe42958)[_0x3b0d('0x24')](function(_0x5de619){_0x363f34[_0x3b0d('0x42')]=_0x5de619;if(_0x239a27[_0x3b0d('0x31')]['includeAll']){_0x2d8679[_0x3b0d('0x43')]=[{'all':!![]}];}return db[_0x3b0d('0x2e')][_0x3b0d('0x44')](_0x2d8679);})[_0x3b0d('0x24')](function(_0x5ba586){_0x363f34[_0x3b0d('0x45')]=_0x5ba586;return _0x363f34;})['then'](respondWithFilteredResult(_0x139c06,_0x2d8679))['catch'](handleError(_0x139c06,null));};exports['show']=function(_0x2fcdcd,_0x221e4b){var _0x4bf62b={'raw':![],'where':{'id':_0x2fcdcd[_0x3b0d('0x46')]['id']}},_0x2c1a5a={};_0x2c1a5a['model']=_[_0x3b0d('0x32')](db[_0x3b0d('0x2e')][_0x3b0d('0x2f')]);_0x2c1a5a[_0x3b0d('0x31')]=_[_0x3b0d('0x32')](_0x2fcdcd[_0x3b0d('0x31')]);_0x2c1a5a[_0x3b0d('0x33')]=_[_0x3b0d('0x35')](_0x2c1a5a[_0x3b0d('0x30')],_0x2c1a5a['query']);_0x4bf62b[_0x3b0d('0x34')]=_[_0x3b0d('0x35')](_0x2c1a5a[_0x3b0d('0x30')],qs[_0x3b0d('0x36')](_0x2fcdcd['query']['fields']));_0x4bf62b['attributes']=_0x4bf62b[_0x3b0d('0x34')][_0x3b0d('0x37')]?_0x4bf62b[_0x3b0d('0x34')]:_0x2c1a5a[_0x3b0d('0x30')];if(_0x2fcdcd[_0x3b0d('0x31')][_0x3b0d('0x47')]){_0x4bf62b[_0x3b0d('0x43')]=[{'all':!![]}];}_0x4bf62b=_[_0x3b0d('0x3f')]({},_0x4bf62b,_0x2fcdcd['options']);return db['Dashboard'][_0x3b0d('0x48')](_0x4bf62b)[_0x3b0d('0x24')](handleEntityNotFound(_0x221e4b,null))['then'](respondWithResult(_0x221e4b,null))[_0x3b0d('0x49')](handleError(_0x221e4b,null));};exports['create']=function(_0x3678f6,_0x254d29){return db[_0x3b0d('0x2e')][_0x3b0d('0x4a')](_0x3678f6[_0x3b0d('0x4b')],{})[_0x3b0d('0x24')](function(_0x38ccdc){var _0x11c049=_0x3678f6['user']['get']({'plain':!![]});if(!_0x11c049)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11c049[_0x3b0d('0x4c')]==='user'){var _0x23377e=_0x38ccdc[_0x3b0d('0x25')]({'plain':!![]});var _0x3ba8ea=_0x3b0d('0x26');return db[_0x3b0d('0x4d')][_0x3b0d('0x48')]({'where':{'name':_0x3ba8ea,'userProfileId':_0x11c049[_0x3b0d('0x4e')]},'raw':!![]})['then'](function(_0x542b47){if(_0x542b47&&_0x542b47[_0x3b0d('0x4f')]===0x0){return db['UserProfileResource'][_0x3b0d('0x4a')]({'name':_0x23377e['name'],'resourceId':_0x23377e['id'],'type':_0x542b47[_0x3b0d('0x2b')],'sectionId':_0x542b47['id']},{})[_0x3b0d('0x24')](function(){return _0x38ccdc;});}else{return _0x38ccdc;}})[_0x3b0d('0x49')](function(_0x1ebdd1){logger[_0x3b0d('0x50')](_0x3b0d('0x51'),_0x1ebdd1);throw _0x1ebdd1;});}return _0x38ccdc;})[_0x3b0d('0x24')](respondWithResult(_0x254d29,0xc9))['catch'](handleError(_0x254d29,null));};exports[_0x3b0d('0x52')]=function(_0x13335e,_0x5684ec){var _0x496264={'where':{'id':_0x13335e[_0x3b0d('0x46')]['id']}},_0x4824c0={};_0x4824c0[_0x3b0d('0x30')]=_[_0x3b0d('0x32')](db[_0x3b0d('0x2e')]['rawAttributes']);_0x496264['attributes']=_['intersection'](_0x4824c0[_0x3b0d('0x30')],qs['fields'](_0x13335e['query'][_0x3b0d('0x36')]));_0x496264[_0x3b0d('0x34')]=_0x496264[_0x3b0d('0x34')][_0x3b0d('0x37')]?_0x496264[_0x3b0d('0x34')]:_0x4824c0[_0x3b0d('0x30')];if(_0x13335e[_0x3b0d('0x31')][_0x3b0d('0x47')]){_0x496264['include']=[{'all':!![]}];}_0x496264=_['merge']({},_0x496264,_0x13335e[_0x3b0d('0x53')]);return db['Dashboard'][_0x3b0d('0x48')](_0x496264)[_0x3b0d('0x24')](handleEntityNotFound(_0x5684ec,null))[_0x3b0d('0x24')](function(_0x2b4d12){if(_0x2b4d12){var _0x22704e=_0x2b4d12[_0x3b0d('0x25')]({'plain':!![]});_0x22704e=qs[_0x3b0d('0x54')](_0x22704e,['id',_0x3b0d('0x55'),_0x3b0d('0x56')]);_0x13335e[_0x3b0d('0x4b')]=_[_0x3b0d('0x54')](_0x13335e[_0x3b0d('0x4b')],['id',_0x3b0d('0x55'),'updatedAt']);return db['Dashboard'][_0x3b0d('0x4a')](_['merge'](_0x22704e,_0x13335e[_0x3b0d('0x4b')]),{'include':_0x13335e[_0x3b0d('0x31')][_0x3b0d('0x47')]?[{'all':!![]}]:undefined})[_0x3b0d('0x24')](function(_0x37ba0c){var _0x31b12a=_0x13335e[_0x3b0d('0x57')][_0x3b0d('0x25')]({'plain':!![]});if(!_0x31b12a)throw new Error(_0x3b0d('0x58'));if(_0x31b12a['role']===_0x3b0d('0x57')){var _0x46637f=_0x37ba0c[_0x3b0d('0x25')]({'plain':!![]});var _0x2d625f=_0x3b0d('0x26');return db[_0x3b0d('0x4d')]['find']({'where':{'name':_0x2d625f,'userProfileId':_0x31b12a['userProfileId']},'raw':!![]})[_0x3b0d('0x24')](function(_0x38ec8d){if(_0x38ec8d&&_0x38ec8d['autoAssociation']===0x0){return db[_0x3b0d('0x27')][_0x3b0d('0x4a')]({'name':_0x46637f[_0x3b0d('0x2b')],'resourceId':_0x46637f['id'],'type':_0x38ec8d[_0x3b0d('0x2b')],'sectionId':_0x38ec8d['id']},{})['then'](function(){return _0x37ba0c;});}else{return _0x37ba0c;}})[_0x3b0d('0x49')](function(_0x461771){logger[_0x3b0d('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x461771);throw _0x461771;});}return _0x37ba0c;});}})[_0x3b0d('0x24')](respondWithResult(_0x5684ec,0xc9))[_0x3b0d('0x49')](handleError(_0x5684ec,null));};exports['update']=function(_0x1a8003,_0x5e0994){if(_0x1a8003['body']['id']){delete _0x1a8003[_0x3b0d('0x4b')]['id'];}return db[_0x3b0d('0x2e')]['find']({'where':{'id':_0x1a8003[_0x3b0d('0x46')]['id']}})[_0x3b0d('0x24')](handleEntityNotFound(_0x5e0994,null))[_0x3b0d('0x24')](saveUpdates(_0x1a8003[_0x3b0d('0x4b')],null))[_0x3b0d('0x24')](respondWithResult(_0x5e0994,null))[_0x3b0d('0x49')](handleError(_0x5e0994,null));};exports['destroy']=function(_0x22b905,_0xa37736){return db[_0x3b0d('0x2e')][_0x3b0d('0x48')]({'where':{'id':_0x22b905[_0x3b0d('0x46')]['id']}})[_0x3b0d('0x24')](handleEntityNotFound(_0xa37736,null))['then'](removeEntity(_0xa37736,null))[_0x3b0d('0x49')](handleError(_0xa37736,null));};function widgetAttributes(_0x4d352b){try{switch(_0x4d352b['type']){case'iframe':return[{'name':_0x3b0d('0x59'),'value':_0x4d352b[_0x3b0d('0x59')]||(_0x4d352b['attrs']&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b[_0x3b0d('0x5a')][0x0]['value']:undefined)||_0x3b0d('0x5b')}];case _0x3b0d('0x5c'):return[{'name':'attrPath','value':_0x4d352b['attrPath']||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b[_0x3b0d('0x5a')][0x0][_0x3b0d('0x5d')]:undefined)||''}];case _0x3b0d('0x5e'):return[{'name':'attrHourFormat','value':_0x4d352b['attrHourFormat']||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b[_0x3b0d('0x5a')][0x0][_0x3b0d('0x5d')]:undefined)||_0x3b0d('0x5f')},{'name':'attrTimezone','value':_0x4d352b['attrTimezone']||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b['attrs'][0x1]?_0x4d352b['attrs'][0x1][_0x3b0d('0x5d')]:undefined)||_0x3b0d('0x60')},{'name':_0x3b0d('0x61'),'value':_0x4d352b[_0x3b0d('0x61')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x2]?_0x4d352b[_0x3b0d('0x5a')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x3b0d('0x62'),'value':_0x4d352b[_0x3b0d('0x62')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b[_0x3b0d('0x5a')][0x0][_0x3b0d('0x5d')]:undefined)||'total'},{'name':_0x3b0d('0x63'),'value':_0x4d352b['attrVoiceQueues']||(_0x4d352b['attrs']&&_0x4d352b[_0x3b0d('0x5a')][0x1]?_0x4d352b['attrs'][0x1]['value']:undefined)||[]},{'name':_0x3b0d('0x61'),'value':_0x4d352b['attrFontSize']||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b['attrs'][0x2]?_0x4d352b[_0x3b0d('0x5a')][0x2]['value']:undefined)||0x14}];case _0x3b0d('0x64'):case'pie-chart':return[{'name':_0x3b0d('0x65'),'value':_0x4d352b['attrSerie1']||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x3b0d('0x66'),'value':_0x4d352b[_0x3b0d('0x66')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b['attrs'][0x1]?_0x4d352b[_0x3b0d('0x5a')][0x1][_0x3b0d('0x5d')]:undefined)||null},{'name':'attrSerie3','value':_0x4d352b[_0x3b0d('0x67')]||(_0x4d352b['attrs']&&_0x4d352b[_0x3b0d('0x5a')][0x2]?_0x4d352b[_0x3b0d('0x5a')][0x2][_0x3b0d('0x5d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4d352b[_0x3b0d('0x63')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x3]?_0x4d352b[_0x3b0d('0x5a')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x4d352b[_0x3b0d('0x68')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b[_0x3b0d('0x5a')][0x0]['type']:undefined)||null,'value':_0x4d352b[_0x3b0d('0x69')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b[_0x3b0d('0x5a')][0x0][_0x3b0d('0x5d')]:undefined)||null},{'name':_0x3b0d('0x6a'),'value':_0x4d352b[_0x3b0d('0x6a')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b['attrs'][0x1]?_0x4d352b[_0x3b0d('0x5a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x28586d){logger[_0x3b0d('0x50')]('widgetAttributes:\x20%s',JSON['stringify'](_0x28586d));return[];}}exports[_0x3b0d('0x6b')]=function(_0x3a1305,_0xa7faa1,_0x4e50fc){if(_0x3a1305['body']['id']){delete _0x3a1305['body']['id'];}return db[_0x3b0d('0x2e')][_0x3b0d('0x48')]({'where':{'id':_0x3a1305[_0x3b0d('0x46')]['id']}})[_0x3b0d('0x24')](handleEntityNotFound(_0xa7faa1,null))[_0x3b0d('0x24')](function(_0x19681e){if(_0x19681e){_0x3a1305[_0x3b0d('0x4b')][_0x3b0d('0x6c')]=_0x19681e['id'];_0x3a1305['body'][_0x3b0d('0x5a')]=widgetAttributes(_0x3a1305[_0x3b0d('0x4b')]);return db[_0x3b0d('0x6d')][_0x3b0d('0x4a')](_0x3a1305[_0x3b0d('0x4b')]);}})[_0x3b0d('0x24')](respondWithResult(_0xa7faa1,null))['catch'](handleError(_0xa7faa1,null));};exports['getItems']=function(_0x55ab0c,_0x1cd5ac,_0x152e59){var _0x1d9a3e={};var _0x49bfeb={};var _0x2a8dea;var _0x36bdfa;return db[_0x3b0d('0x2e')][_0x3b0d('0x6e')]({'where':{'id':_0x55ab0c[_0x3b0d('0x46')]['id']}})['then'](handleEntityNotFound(_0x1cd5ac,null))[_0x3b0d('0x24')](function(_0x1ba595){if(_0x1ba595){_0x2a8dea=_0x1ba595;_0x49bfeb[_0x3b0d('0x30')]=_[_0x3b0d('0x32')](db[_0x3b0d('0x6d')][_0x3b0d('0x2f')]);_0x49bfeb[_0x3b0d('0x31')]=_[_0x3b0d('0x32')](_0x55ab0c[_0x3b0d('0x31')]);_0x49bfeb[_0x3b0d('0x33')]=_[_0x3b0d('0x35')](_0x49bfeb[_0x3b0d('0x30')],_0x49bfeb[_0x3b0d('0x31')]);_0x1d9a3e['attributes']=_[_0x3b0d('0x35')](_0x49bfeb[_0x3b0d('0x30')],qs[_0x3b0d('0x36')](_0x55ab0c[_0x3b0d('0x31')][_0x3b0d('0x36')]));_0x1d9a3e['attributes']=_0x1d9a3e[_0x3b0d('0x34')][_0x3b0d('0x37')]?_0x1d9a3e[_0x3b0d('0x34')]:_0x49bfeb[_0x3b0d('0x30')];_0x1d9a3e[_0x3b0d('0x3a')]=qs[_0x3b0d('0x3b')](_0x55ab0c[_0x3b0d('0x31')][_0x3b0d('0x3b')]);_0x1d9a3e[_0x3b0d('0x3c')]=qs['filters'](_[_0x3b0d('0x3d')](_0x55ab0c['query'],_0x49bfeb[_0x3b0d('0x33')]));if(_0x55ab0c[_0x3b0d('0x31')][_0x3b0d('0x3e')]){_0x1d9a3e['where']=_['merge'](_0x1d9a3e[_0x3b0d('0x3c')],{'$or':_[_0x3b0d('0x2d')](_0x1d9a3e[_0x3b0d('0x34')],function(_0x36bb05){var _0x5e9bfc={};_0x5e9bfc[_0x36bb05]={'$like':'%'+_0x55ab0c['query'][_0x3b0d('0x3e')]+'%'};return _0x5e9bfc;})});}_0x1d9a3e=_[_0x3b0d('0x3f')]({},_0x1d9a3e,_0x55ab0c[_0x3b0d('0x53')]);return _0x2a8dea[_0x3b0d('0x6f')](_0x1d9a3e);}})[_0x3b0d('0x24')](function(_0x1a46f3){if(_0x1a46f3){_0x36bdfa=_0x1a46f3['length'];if(!_0x55ab0c['query'][_0x3b0d('0x38')](_0x3b0d('0x70'))){_0x1d9a3e[_0x3b0d('0x39')]=qs['limit'](_0x55ab0c['query'][_0x3b0d('0x39')]);_0x1d9a3e[_0x3b0d('0x1e')]=qs[_0x3b0d('0x1e')](_0x55ab0c[_0x3b0d('0x31')][_0x3b0d('0x1e')]);}return _0x2a8dea[_0x3b0d('0x6f')](_0x1d9a3e);}})[_0x3b0d('0x24')](function(_0x17cf38){if(_0x17cf38){return _0x17cf38?{'count':_0x36bdfa,'rows':_0x17cf38}:null;}})[_0x3b0d('0x24')](respondWithResult(_0x1cd5ac,null))[_0x3b0d('0x49')](handleError(_0x1cd5ac,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a8f364b..9313ab0 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 _0xbc45=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xbc45,0x122));var _0x5bc4=function(_0x451290,_0x1078a9){_0x451290=_0x451290-0x0;var _0x9d01b9=_0xbc45[_0x451290];return _0x9d01b9;};'use strict';var EventEmitter=require(_0x5bc4('0x0'));var Dashboard=require(_0x5bc4('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5bc4('0x2')](0x0);var events={'afterCreate':_0x5bc4('0x3'),'afterUpdate':_0x5bc4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c125c){return function(_0xcd9a14,_0xdf188a,_0x46f7e1){DashboardEvents['emit'](_0x5c125c+':'+_0xcd9a14['id'],_0xcd9a14);DashboardEvents[_0x5bc4('0x5')](_0x5c125c,_0xcd9a14);_0x46f7e1(null);};}for(var e in events){if(events[_0x5bc4('0x6')](e)){var event=events[e];Dashboard[_0x5bc4('0x7')](e,emitEvent(event));}}module[_0x5bc4('0x8')]=DashboardEvents; \ No newline at end of file +var _0xf0f5=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x3a2855,_0x3495e1){var _0x1fc9cc=function(_0x3265f3){while(--_0x3265f3){_0x3a2855['push'](_0x3a2855['shift']());}};_0x1fc9cc(++_0x3495e1);}(_0xf0f5,0x119));var _0x5f0f=function(_0x44e949,_0x2757ef){_0x44e949=_0x44e949-0x0;var _0x50c736=_0xf0f5[_0x44e949];return _0x50c736;};'use strict';var EventEmitter=require(_0x5f0f('0x0'));var Dashboard=require(_0x5f0f('0x1'))['db'][_0x5f0f('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5f0f('0x3')](0x0);var events={'afterCreate':_0x5f0f('0x4'),'afterUpdate':_0x5f0f('0x5'),'afterDestroy':_0x5f0f('0x6')};function emitEvent(_0x5eb361){return function(_0x274af4,_0x73c46c,_0x1898f7){DashboardEvents[_0x5f0f('0x7')](_0x5eb361+':'+_0x274af4['id'],_0x274af4);DashboardEvents['emit'](_0x5eb361,_0x274af4);_0x1898f7(null);};}for(var e in events){if(events[_0x5f0f('0x8')](e)){var event=events[e];Dashboard[_0x5f0f('0x9')](e,emitEvent(event));}}module[_0x5f0f('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index acf00ea..9dd1792 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 _0x151f=['api','moment','request-promise','path','rimraf','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash'];(function(_0x342da2,_0x27ab1f){var _0x44c55e=function(_0x297892){while(--_0x297892){_0x342da2['push'](_0x342da2['shift']());}};_0x44c55e(++_0x27ab1f);}(_0x151f,0xfc));var _0xf151=function(_0x4e5ee9,_0x1f3bb9){_0x4e5ee9=_0x4e5ee9-0x0;var _0x1488ce=_0x151f[_0x4e5ee9];return _0x1488ce;};'use strict';var _=require(_0xf151('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf151('0x1'));var moment=require(_0xf151('0x2'));var BPromise=require('bluebird');var rp=require(_0xf151('0x3'));var fs=require('fs');var path=require(_0xf151('0x4'));var rimraf=require(_0xf151('0x5'));var config=require('../../config/environment');var attributes=require(_0xf151('0x6'));module[_0xf151('0x7')]=function(_0x1614cd,_0x1ef6cc){return _0x1614cd[_0xf151('0x8')](_0xf151('0x9'),attributes,{'tableName':_0xf151('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb426=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','util','../../config/logger','api'];(function(_0x1a30c7,_0x5d5441){var _0x3be1e6=function(_0x3ee7e8){while(--_0x3ee7e8){_0x1a30c7['push'](_0x1a30c7['shift']());}};_0x3be1e6(++_0x5d5441);}(_0xb426,0x1d8));var _0x6b42=function(_0x22c75c,_0x3624dd){_0x22c75c=_0x22c75c-0x0;var _0x392878=_0xb426[_0x22c75c];return _0x392878;};'use strict';var _=require(_0x6b42('0x0'));var util=require(_0x6b42('0x1'));var logger=require(_0x6b42('0x2'))(_0x6b42('0x3'));var moment=require(_0x6b42('0x4'));var BPromise=require(_0x6b42('0x5'));var rp=require(_0x6b42('0x6'));var fs=require('fs');var path=require(_0x6b42('0x7'));var rimraf=require(_0x6b42('0x8'));var config=require(_0x6b42('0x9'));var attributes=require(_0x6b42('0xa'));module[_0x6b42('0xb')]=function(_0x8f4d5,_0x1c14eb){return _0x8f4d5['define'](_0x6b42('0xc'),attributes,{'tableName':_0x6b42('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 2bf47e6..8a923bb 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 _0x9f1a=['./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis'];(function(_0x24052e,_0x40fc04){var _0x1a52b4=function(_0x1fff6e){while(--_0x1fff6e){_0x24052e['push'](_0x24052e['shift']());}};_0x1a52b4(++_0x40fc04);}(_0x9f1a,0x122));var _0xa9f1=function(_0x42a96a,_0x117eed){_0x42a96a=_0x42a96a-0x0;var _0x55742e=_0x9f1a[_0x42a96a];return _0x55742e;};'use strict';var _=require(_0xa9f1('0x0'));var util=require('util');var moment=require(_0xa9f1('0x1'));var BPromise=require('bluebird');var rs=require(_0xa9f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9f1('0x3'))['db'];var utils=require(_0xa9f1('0x4'));var logger=require(_0xa9f1('0x5'))(_0xa9f1('0x6'));var config=require(_0xa9f1('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xa9f1('0x8')]=_['defaults'](config[_0xa9f1('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9f1('0x8')]));require(_0xa9f1('0x9'))[_0xa9f1('0xa')](socket);function respondWithRpcPromise(_0x287db,_0x5f5173,_0x519804){return new BPromise(function(_0x302baa,_0xb47170){return client[_0xa9f1('0xb')](_0x287db,_0x519804)['then'](function(_0xec1a6d){logger['info'](_0xa9f1('0xc'),_0x5f5173,_0xa9f1('0xd'));logger[_0xa9f1('0xe')](_0xa9f1('0xf'),_0x5f5173,_0xa9f1('0xd'),JSON[_0xa9f1('0x10')](_0xec1a6d));if(_0xec1a6d[_0xa9f1('0x11')]){if(_0xec1a6d[_0xa9f1('0x11')][_0xa9f1('0x12')]===0x1f4){logger['error'](_0xa9f1('0xc'),_0x5f5173,_0xec1a6d[_0xa9f1('0x11')][_0xa9f1('0x13')]);return _0xb47170(_0xec1a6d['error']['message']);}logger[_0xa9f1('0x11')](_0xa9f1('0xc'),_0x5f5173,_0xec1a6d[_0xa9f1('0x11')][_0xa9f1('0x13')]);return _0x302baa(_0xec1a6d['error'][_0xa9f1('0x13')]);}else{logger[_0xa9f1('0x14')]('Dashboard,\x20%s,\x20%s',_0x5f5173,_0xa9f1('0xd'));_0x302baa(_0xec1a6d[_0xa9f1('0x15')]['message']);}})[_0xa9f1('0x16')](function(_0x1111ee){logger[_0xa9f1('0x11')]('Dashboard,\x20%s,\x20%s',_0x5f5173,_0x1111ee);_0xb47170(_0x1111ee);});});} \ No newline at end of file +var _0x521f=['request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','Dashboard,\x20%s,\x20%s'];(function(_0x409237,_0xe36701){var _0x2b3e72=function(_0x9c719f){while(--_0x9c719f){_0x409237['push'](_0x409237['shift']());}};_0x2b3e72(++_0xe36701);}(_0x521f,0xe8));var _0xf521=function(_0x45a6f3,_0x5047e9){_0x45a6f3=_0x45a6f3-0x0;var _0x48df23=_0x521f[_0x45a6f3];return _0x48df23;};'use strict';var _=require(_0xf521('0x0'));var util=require(_0xf521('0x1'));var moment=require('moment');var BPromise=require(_0xf521('0x2'));var rs=require(_0xf521('0x3'));var fs=require('fs');var Redis=require(_0xf521('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf521('0x5'));var logger=require(_0xf521('0x6'))(_0xf521('0x7'));var config=require(_0xf521('0x8'));var jayson=require(_0xf521('0x9'));var client=jayson[_0xf521('0xa')][_0xf521('0xb')]({'port':0x232a});config[_0xf521('0xc')]=_['defaults'](config[_0xf521('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf521('0xd'))(new Redis(config[_0xf521('0xc')]));require('./dashboard.socket')[_0xf521('0xe')](socket);function respondWithRpcPromise(_0x225421,_0x35c6d6,_0x359c29){return new BPromise(function(_0x515fd1,_0x462c8d){return client[_0xf521('0xf')](_0x225421,_0x359c29)[_0xf521('0x10')](function(_0x3f8e49){logger['info'](_0xf521('0x11'),_0x35c6d6,_0xf521('0x12'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x35c6d6,_0xf521('0x12'),JSON['stringify'](_0x3f8e49));if(_0x3f8e49[_0xf521('0x13')]){if(_0x3f8e49[_0xf521('0x13')][_0xf521('0x14')]===0x1f4){logger[_0xf521('0x13')](_0xf521('0x11'),_0x35c6d6,_0x3f8e49[_0xf521('0x13')][_0xf521('0x15')]);return _0x462c8d(_0x3f8e49[_0xf521('0x13')][_0xf521('0x15')]);}logger[_0xf521('0x13')](_0xf521('0x11'),_0x35c6d6,_0x3f8e49['error'][_0xf521('0x15')]);return _0x515fd1(_0x3f8e49[_0xf521('0x13')][_0xf521('0x15')]);}else{logger[_0xf521('0x16')]('Dashboard,\x20%s,\x20%s',_0x35c6d6,'request\x20sent');_0x515fd1(_0x3f8e49[_0xf521('0x17')]['message']);}})[_0xf521('0x18')](function(_0x426d7f){logger[_0xf521('0x13')](_0xf521('0x11'),_0x35c6d6,_0x426d7f);_0x462c8d(_0x426d7f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 121bc7a..0d1f328 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 _0x08d7=['update','emit','removeListener','register','length','dashboard:','./dashboard.events','remove'];(function(_0x55bd46,_0x5aa382){var _0x45ec3e=function(_0x4210a0){while(--_0x4210a0){_0x55bd46['push'](_0x55bd46['shift']());}};_0x45ec3e(++_0x5aa382);}(_0x08d7,0xe6));var _0x708d=function(_0x78800,_0x5c6ed5){_0x78800=_0x78800-0x0;var _0x3f873a=_0x08d7[_0x78800];return _0x3f873a;};'use strict';var DashboardEvents=require(_0x708d('0x0'));var events=['save',_0x708d('0x1'),_0x708d('0x2')];function createListener(_0x3f56d5,_0x2cdbe2){return function(_0x7e61eb){_0x2cdbe2[_0x708d('0x3')](_0x3f56d5,_0x7e61eb);};}function removeListener(_0x6a8e0b,_0x1006ef){return function(){DashboardEvents[_0x708d('0x4')](_0x6a8e0b,_0x1006ef);};}exports[_0x708d('0x5')]=function(_0xaf336b){for(var _0x1b9311=0x0,_0x20261f=events[_0x708d('0x6')];_0x1b9311<_0x20261f;_0x1b9311++){var _0x468468=events[_0x1b9311];var _0x4fc303=createListener(_0x708d('0x7')+_0x468468,_0xaf336b);DashboardEvents['on'](_0x468468,_0x4fc303);}}; \ No newline at end of file +var _0x2c74=['./dashboard.events','save','remove','update','emit','removeListener','length','dashboard:'];(function(_0x1cf5c8,_0xe8e966){var _0x26898d=function(_0x52da74){while(--_0x52da74){_0x1cf5c8['push'](_0x1cf5c8['shift']());}};_0x26898d(++_0xe8e966);}(_0x2c74,0x150));var _0x42c7=function(_0x4b9023,_0x4592cc){_0x4b9023=_0x4b9023-0x0;var _0x502620=_0x2c74[_0x4b9023];return _0x502620;};'use strict';var DashboardEvents=require(_0x42c7('0x0'));var events=[_0x42c7('0x1'),_0x42c7('0x2'),_0x42c7('0x3')];function createListener(_0x11c10d,_0x3ac10c){return function(_0x3e5fde){_0x3ac10c[_0x42c7('0x4')](_0x11c10d,_0x3e5fde);};}function removeListener(_0x2c946a,_0x6dc1ad){return function(){DashboardEvents[_0x42c7('0x5')](_0x2c946a,_0x6dc1ad);};}exports['register']=function(_0x1baac7){for(var _0x253399=0x0,_0x57682c=events[_0x42c7('0x6')];_0x253399<_0x57682c;_0x253399++){var _0x1b05d5=events[_0x253399];var _0x3bd6df=createListener(_0x42c7('0x7')+_0x1b05d5,_0x1baac7);DashboardEvents['on'](_0x1b05d5,_0x3bd6df);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5db2191..e9535fd 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 _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(_0x4894c8,_0x26bc8c){var _0x35ef8e=function(_0x1490c3){while(--_0x1490c3){_0x4894c8['push'](_0x4894c8['shift']());}};_0x35ef8e(++_0x26bc8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 +var _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x375c92,_0x2774be){var _0x49f14a=function(_0x2c4b47){while(--_0x2c4b47){_0x375c92['push'](_0x375c92['shift']());}};_0x49f14a(++_0x2774be);}(_0x70e0,0x17b));var _0x070e=function(_0x47984f,_0x425e71){_0x47984f=_0x47984f-0x0;var _0x569b22=_0x70e0[_0x47984f];return _0x569b22;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 519b6d4..fc47f59 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 _0x0c09=['STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports'];(function(_0x5a7f64,_0x347d57){var _0x3d30f1=function(_0x4bd1d6){while(--_0x4bd1d6){_0x5a7f64['push'](_0x5a7f64['shift']());}};_0x3d30f1(++_0x347d57);}(_0x0c09,0x128));var _0x90c0=function(_0x4e2c9a,_0x7a2d99){_0x4e2c9a=_0x4e2c9a-0x0;var _0x503c38=_0x0c09[_0x4e2c9a];return _0x503c38;};'use strict';var Sequelize=require(_0x90c0('0x0'));var squel=require(_0x90c0('0x1'));var _=require(_0x90c0('0x2'));module[_0x90c0('0x3')]={'title':{'type':Sequelize[_0x90c0('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x90c0('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x90c0('0x5')](_0x90c0('0x6')),'get':function(){try{return JSON[_0x90c0('0x7')](this[_0x90c0('0x8')](_0x90c0('0x9')));}catch(_0x321197){return[];}},'set':function(_0xed82d5){try{this[_0x90c0('0xa')](_0x90c0('0x9'),JSON[_0x90c0('0xb')](_0xed82d5));}catch(_0x3e69e4){this['setDataValue']('attrs',JSON[_0x90c0('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x90c0('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x90c0('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x90c0('0xc')]},'col':{'type':Sequelize[_0x90c0('0xc')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x90c0('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x90c0('0x4')],'allowNull':![],'defaultValue':_0x90c0('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x90c0('0x4')]}}; \ No newline at end of file +var _0xf01b=['INTEGER','STRING','#2196f3','sequelize','squel','lodash','exports','TEXT','long','parse','attrs','stringify','setDataValue'];(function(_0xd58277,_0x4a39f7){var _0x522e3d=function(_0x1570ee){while(--_0x1570ee){_0xd58277['push'](_0xd58277['shift']());}};_0x522e3d(++_0x4a39f7);}(_0xf01b,0x9f));var _0xbf01=function(_0x3b4af0,_0x2df7c2){_0x3b4af0=_0x3b4af0-0x0;var _0x3efe6f=_0xf01b[_0x3b4af0];return _0x3efe6f;};'use strict';var Sequelize=require(_0xbf01('0x0'));var squel=require(_0xbf01('0x1'));var _=require(_0xbf01('0x2'));module[_0xbf01('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xbf01('0x4')](_0xbf01('0x5')),'get':function(){try{return JSON[_0xbf01('0x6')](this['getDataValue'](_0xbf01('0x7')));}catch(_0x566c86){return[];}},'set':function(_0xc9892c){try{this['setDataValue'](_0xbf01('0x7'),JSON[_0xbf01('0x8')](_0xc9892c));}catch(_0x4aaf8d){this[_0xbf01('0x9')]('attrs',JSON[_0xbf01('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xbf01('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xbf01('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xbf01('0xb')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xbf01('0xb')],'allowNull':![],'defaultValue':_0xbf01('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xbf01('0xb')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index fcc3ee8..86c9266 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 _0x484c=['options','DashboardItem','find','catch','type','attrUrl','attrs','value','https://','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','offset','limit','set','json','apply','reject','save','destroy','then','error','stack','name','send','params','keys','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','include','merge'];(function(_0x17324d,_0x46fd09){var _0x47c171=function(_0x410a36){while(--_0x410a36){_0x17324d['push'](_0x17324d['shift']());}};_0x47c171(++_0x46fd09);}(_0x484c,0x1db));var _0xc484=function(_0x28c526,_0x2d2a43){_0x28c526=_0x28c526-0x0;var _0x4bfe02=_0x484c[_0x28c526];return _0x4bfe02;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc484('0x0'));var rimraf=require(_0xc484('0x1'));var zipdir=require(_0xc484('0x2'));var jsonpatch=require(_0xc484('0x3'));var rp=require(_0xc484('0x4'));var moment=require(_0xc484('0x5'));var BPromise=require(_0xc484('0x6'));var Mustache=require(_0xc484('0x7'));var util=require(_0xc484('0x8'));var path=require(_0xc484('0x9'));var sox=require(_0xc484('0xa'));var csv=require(_0xc484('0xb'));var ejs=require(_0xc484('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc484('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc484('0xe'));var toCsv=require(_0xc484('0xb'));var querystring=require(_0xc484('0xf'));var Papa=require(_0xc484('0x10'));var Redis=require(_0xc484('0x11'));var authService=require(_0xc484('0x12'));var qs=require(_0xc484('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc484('0x14'));var logger=require(_0xc484('0x15'))('api');var utils=require(_0xc484('0x16'));var config=require(_0xc484('0x17'));var db=require('../../mysqldb')['db'];config[_0xc484('0x18')]=_[_0xc484('0x19')](config['redis'],{'host':_0xc484('0x1a'),'port':0x18eb});var socket=require(_0xc484('0x1b'))(new Redis(config[_0xc484('0x18')]));require(_0xc484('0x1c'))[_0xc484('0x1d')](socket);function respondWithStatusCode(_0x270ed4,_0x5be99f){_0x5be99f=_0x5be99f||0xcc;return function(_0x4478fc){if(_0x4478fc){return _0x270ed4[_0xc484('0x1e')](_0x5be99f);}return _0x270ed4[_0xc484('0x1f')](_0x5be99f)[_0xc484('0x20')]();};}function respondWithResult(_0x4f54f2,_0x464581){_0x464581=_0x464581||0xc8;return function(_0x506b3b){if(_0x506b3b){return _0x4f54f2[_0xc484('0x1f')](_0x464581)['json'](_0x506b3b);}};}function respondWithFilteredResult(_0x5e3851,_0x5a4db2){return function(_0x4a351a){if(_0x4a351a){var _0x205ecd=_0x4a351a['count'],_0x59293f=_0x5a4db2[_0xc484('0x21')],_0x1b962c=_0x5a4db2[_0xc484('0x21')]+_0x5a4db2[_0xc484('0x22')],_0x204e45;if(_0x1b962c>=_0x205ecd){_0x1b962c=_0x205ecd;_0x204e45=0xc8;}else{_0x204e45=0xce;}_0x5e3851[_0xc484('0x1f')](_0x204e45);return _0x5e3851[_0xc484('0x23')]('Content-Range',_0x59293f+'-'+_0x1b962c+'/'+_0x205ecd)[_0xc484('0x24')](_0x4a351a);}return null;};}function patchUpdates(_0x78b1bf){return function(_0x86601f){try{jsonpatch[_0xc484('0x25')](_0x86601f,_0x78b1bf,!![]);}catch(_0x3e256a){return BPromise[_0xc484('0x26')](_0x3e256a);}return _0x86601f[_0xc484('0x27')]();};}function saveUpdates(_0x5b4ba2,_0x2060e6){return function(_0x1ec155){if(_0x1ec155){return _0x1ec155['update'](_0x5b4ba2)['then'](function(_0x1a7490){return _0x1a7490;});}return null;};}function removeEntity(_0x30819b,_0x394c8e){return function(_0x5adb90){if(_0x5adb90){return _0x5adb90[_0xc484('0x28')]()[_0xc484('0x29')](function(){_0x30819b[_0xc484('0x1f')](0xcc)[_0xc484('0x20')]();});}};}function handleEntityNotFound(_0x155874,_0x5ae22e){return function(_0x514114){if(!_0x514114){_0x155874[_0xc484('0x1e')](0x194);}return _0x514114;};}function handleError(_0x17b0ce,_0x4e246d){_0x4e246d=_0x4e246d||0x1f4;return function(_0x54e1af){logger[_0xc484('0x2a')](_0x54e1af[_0xc484('0x2b')]);if(_0x54e1af['name']){delete _0x54e1af[_0xc484('0x2c')];}_0x17b0ce['status'](_0x4e246d)[_0xc484('0x2d')](_0x54e1af);};}exports['show']=function(_0x2634c0,_0x14c6ed){var _0x13b767={'raw':![],'where':{'id':_0x2634c0[_0xc484('0x2e')]['id']}},_0x4fec31={};_0x4fec31['model']=_[_0xc484('0x2f')](db['DashboardItem'][_0xc484('0x30')]);_0x4fec31[_0xc484('0x31')]=_[_0xc484('0x2f')](_0x2634c0['query']);_0x4fec31[_0xc484('0x32')]=_[_0xc484('0x33')](_0x4fec31['model'],_0x4fec31[_0xc484('0x31')]);_0x13b767[_0xc484('0x34')]=_[_0xc484('0x33')](_0x4fec31[_0xc484('0x35')],qs[_0xc484('0x36')](_0x2634c0[_0xc484('0x31')]['fields']));_0x13b767['attributes']=_0x13b767['attributes'][_0xc484('0x37')]?_0x13b767[_0xc484('0x34')]:_0x4fec31[_0xc484('0x35')];if(_0x2634c0[_0xc484('0x31')][_0xc484('0x38')]){_0x13b767[_0xc484('0x39')]=[{'all':!![]}];}_0x13b767=_[_0xc484('0x3a')]({},_0x13b767,_0x2634c0[_0xc484('0x3b')]);return db[_0xc484('0x3c')][_0xc484('0x3d')](_0x13b767)[_0xc484('0x29')](handleEntityNotFound(_0x14c6ed,null))[_0xc484('0x29')](respondWithResult(_0x14c6ed,null))[_0xc484('0x3e')](handleError(_0x14c6ed,null));};exports[_0xc484('0x28')]=function(_0x29730b,_0x4bf888){return db[_0xc484('0x3c')]['find']({'where':{'id':_0x29730b[_0xc484('0x2e')]['id']}})[_0xc484('0x29')](handleEntityNotFound(_0x4bf888,null))[_0xc484('0x29')](removeEntity(_0x4bf888,null))[_0xc484('0x3e')](handleError(_0x4bf888,null));};function widgetAttributes(_0x1f764e){try{switch(_0x1f764e[_0xc484('0x3f')]){case'iframe':return[{'name':_0xc484('0x40'),'value':_0x1f764e[_0xc484('0x40')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e['attrs'][0x0][_0xc484('0x42')]:undefined)||_0xc484('0x43')}];case'custom':return[{'name':_0xc484('0x44'),'value':_0x1f764e['attrPath']||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e[_0xc484('0x41')][0x0][_0xc484('0x42')]:undefined)||''}];case _0xc484('0x45'):return[{'name':'attrHourFormat','value':_0x1f764e['attrHourFormat']||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e[_0xc484('0x41')][0x0][_0xc484('0x42')]:undefined)||_0xc484('0x46')},{'name':_0xc484('0x47'),'value':_0x1f764e['attrTimezone']||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x1]?_0x1f764e[_0xc484('0x41')][0x1][_0xc484('0x42')]:undefined)||_0xc484('0x48')},{'name':'attrFontSize','value':_0x1f764e[_0xc484('0x49')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e['attrs'][0x2]?_0x1f764e[_0xc484('0x41')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xc484('0x4a'),'value':_0x1f764e[_0xc484('0x4a')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e[_0xc484('0x41')][0x0][_0xc484('0x42')]:undefined)||_0xc484('0x4b')},{'name':_0xc484('0x4c'),'value':_0x1f764e[_0xc484('0x4c')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e['attrs'][0x1]?_0x1f764e[_0xc484('0x41')][0x1][_0xc484('0x42')]:undefined)||[]},{'name':_0xc484('0x49'),'value':_0x1f764e[_0xc484('0x49')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x2]?_0x1f764e[_0xc484('0x41')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0xc484('0x4d'):return[{'name':_0xc484('0x4e'),'value':_0x1f764e[_0xc484('0x4e')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e[_0xc484('0x41')][0x0][_0xc484('0x42')]:undefined)||_0xc484('0x4b')},{'name':_0xc484('0x4f'),'value':_0x1f764e[_0xc484('0x4f')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x1]?_0x1f764e[_0xc484('0x41')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x1f764e[_0xc484('0x50')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e['attrs'][0x2]?_0x1f764e[_0xc484('0x41')][0x2][_0xc484('0x42')]:undefined)||null},{'name':_0xc484('0x4c'),'value':_0x1f764e[_0xc484('0x4c')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x3]?_0x1f764e['attrs'][0x3][_0xc484('0x42')]:undefined)||[]}];case _0xc484('0x51'):return[{'name':_0xc484('0x52'),'type':_0x1f764e['reportType']||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e[_0xc484('0x41')][0x0][_0xc484('0x3f')]:undefined)||null,'value':_0x1f764e[_0xc484('0x52')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e[_0xc484('0x41')][0x0]['value']:undefined)||null},{'name':_0xc484('0x53'),'value':_0x1f764e[_0xc484('0x53')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x1]?_0x1f764e[_0xc484('0x41')][0x1][_0xc484('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x551bcd){logger[_0xc484('0x2a')](_0xc484('0x54'),JSON[_0xc484('0x55')](_0x551bcd));return[];}}exports[_0xc484('0x56')]=function(_0x1cc159,_0x426a6a){if(_0x1cc159[_0xc484('0x57')]){_0x1cc159['body']['attrs']=widgetAttributes(_0x1cc159[_0xc484('0x57')]);}return db[_0xc484('0x3c')][_0xc484('0x56')](_0x1cc159[_0xc484('0x57')],{})[_0xc484('0x29')](respondWithResult(_0x426a6a,0xc9))[_0xc484('0x3e')](handleError(_0x426a6a,null));};exports[_0xc484('0x58')]=function(_0x1e8329,_0x18a5c4){if(_0x1e8329[_0xc484('0x57')]['id']){delete _0x1e8329[_0xc484('0x57')]['id'];}_0x1e8329['body']['attrs']=widgetAttributes(_0x1e8329[_0xc484('0x57')]);return db['DashboardItem'][_0xc484('0x3d')]({'where':{'id':_0x1e8329[_0xc484('0x2e')]['id']}})[_0xc484('0x29')](handleEntityNotFound(_0x18a5c4,null))[_0xc484('0x29')](saveUpdates(_0x1e8329['body'],null))[_0xc484('0x29')](respondWithResult(_0x18a5c4,null))[_0xc484('0x3e')](handleError(_0x18a5c4,null));}; \ No newline at end of file +var _0xc90b=['attrVoiceQueues','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','DashboardItem','keys','query','filters','attributes','intersection','model','fields','length','includeAll','options','find','catch','type','iframe','attrUrl','attrs','value','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric'];(function(_0x53e12f,_0x136e5a){var _0x3bef4c=function(_0x5ed4f5){while(--_0x5ed4f5){_0x53e12f['push'](_0x53e12f['shift']());}};_0x3bef4c(++_0x136e5a);}(_0xc90b,0x165));var _0xbc90=function(_0x5299a9,_0x52b834){_0x5299a9=_0x5299a9-0x0;var _0x4b138d=_0xc90b[_0x5299a9];return _0x4b138d;};'use strict';var pdf=require(_0xbc90('0x0'));var emlformat=require(_0xbc90('0x1'));var rimraf=require(_0xbc90('0x2'));var zipdir=require(_0xbc90('0x3'));var jsonpatch=require(_0xbc90('0x4'));var rp=require(_0xbc90('0x5'));var moment=require(_0xbc90('0x6'));var BPromise=require(_0xbc90('0x7'));var Mustache=require(_0xbc90('0x8'));var util=require(_0xbc90('0x9'));var path=require(_0xbc90('0xa'));var sox=require(_0xbc90('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xbc90('0xc'));var squel=require(_0xbc90('0xd'));var crypto=require('crypto');var jsforce=require(_0xbc90('0xe'));var deskjs=require(_0xbc90('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbc90('0x10'));var Redis=require('ioredis');var authService=require(_0xbc90('0x11'));var qs=require(_0xbc90('0x12'));var as=require(_0xbc90('0x13'));var hardwareService=require(_0xbc90('0x14'));var logger=require(_0xbc90('0x15'))(_0xbc90('0x16'));var utils=require(_0xbc90('0x17'));var config=require(_0xbc90('0x18'));var db=require('../../mysqldb')['db'];config[_0xbc90('0x19')]=_['defaults'](config[_0xbc90('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc90('0x1a'))(new Redis(config[_0xbc90('0x19')]));require('./dashboardItem.socket')[_0xbc90('0x1b')](socket);function respondWithStatusCode(_0x1e977b,_0xb5c9b2){_0xb5c9b2=_0xb5c9b2||0xcc;return function(_0x548505){if(_0x548505){return _0x1e977b[_0xbc90('0x1c')](_0xb5c9b2);}return _0x1e977b['status'](_0xb5c9b2)[_0xbc90('0x1d')]();};}function respondWithResult(_0x25f62d,_0x31bf07){_0x31bf07=_0x31bf07||0xc8;return function(_0x267baa){if(_0x267baa){return _0x25f62d[_0xbc90('0x1e')](_0x31bf07)[_0xbc90('0x1f')](_0x267baa);}};}function respondWithFilteredResult(_0x9c196a,_0x5c0025){return function(_0x5ec56e){if(_0x5ec56e){var _0x3b30a0=_0x5ec56e['count'],_0x172a98=_0x5c0025[_0xbc90('0x20')],_0x1f9ff6=_0x5c0025[_0xbc90('0x20')]+_0x5c0025[_0xbc90('0x21')],_0x5839b4;if(_0x1f9ff6>=_0x3b30a0){_0x1f9ff6=_0x3b30a0;_0x5839b4=0xc8;}else{_0x5839b4=0xce;}_0x9c196a[_0xbc90('0x1e')](_0x5839b4);return _0x9c196a[_0xbc90('0x22')](_0xbc90('0x23'),_0x172a98+'-'+_0x1f9ff6+'/'+_0x3b30a0)[_0xbc90('0x1f')](_0x5ec56e);}return null;};}function patchUpdates(_0x3b63e0){return function(_0x5e2587){try{jsonpatch[_0xbc90('0x24')](_0x5e2587,_0x3b63e0,!![]);}catch(_0x525a30){return BPromise[_0xbc90('0x25')](_0x525a30);}return _0x5e2587[_0xbc90('0x26')]();};}function saveUpdates(_0x5e63d3,_0x8ad1e0){return function(_0x2512d7){if(_0x2512d7){return _0x2512d7[_0xbc90('0x27')](_0x5e63d3)[_0xbc90('0x28')](function(_0x7b024){return _0x7b024;});}return null;};}function removeEntity(_0x449274,_0xc23df6){return function(_0x21d1a0){if(_0x21d1a0){return _0x21d1a0['destroy']()[_0xbc90('0x28')](function(){_0x449274['status'](0xcc)[_0xbc90('0x1d')]();});}};}function handleEntityNotFound(_0xcf1cc2,_0x441766){return function(_0x192ca0){if(!_0x192ca0){_0xcf1cc2[_0xbc90('0x1c')](0x194);}return _0x192ca0;};}function handleError(_0x229438,_0x4dd3e6){_0x4dd3e6=_0x4dd3e6||0x1f4;return function(_0x1f343b){logger[_0xbc90('0x29')](_0x1f343b[_0xbc90('0x2a')]);if(_0x1f343b[_0xbc90('0x2b')]){delete _0x1f343b[_0xbc90('0x2b')];}_0x229438[_0xbc90('0x1e')](_0x4dd3e6)[_0xbc90('0x2c')](_0x1f343b);};}exports[_0xbc90('0x2d')]=function(_0x4c1c6a,_0x2b3e8b){var _0x49c00f={'raw':![],'where':{'id':_0x4c1c6a[_0xbc90('0x2e')]['id']}},_0x1cdd7b={};_0x1cdd7b['model']=_['keys'](db[_0xbc90('0x2f')]['rawAttributes']);_0x1cdd7b['query']=_[_0xbc90('0x30')](_0x4c1c6a[_0xbc90('0x31')]);_0x1cdd7b[_0xbc90('0x32')]=_['intersection'](_0x1cdd7b['model'],_0x1cdd7b[_0xbc90('0x31')]);_0x49c00f[_0xbc90('0x33')]=_[_0xbc90('0x34')](_0x1cdd7b[_0xbc90('0x35')],qs[_0xbc90('0x36')](_0x4c1c6a[_0xbc90('0x31')][_0xbc90('0x36')]));_0x49c00f['attributes']=_0x49c00f[_0xbc90('0x33')][_0xbc90('0x37')]?_0x49c00f[_0xbc90('0x33')]:_0x1cdd7b[_0xbc90('0x35')];if(_0x4c1c6a[_0xbc90('0x31')][_0xbc90('0x38')]){_0x49c00f['include']=[{'all':!![]}];}_0x49c00f=_['merge']({},_0x49c00f,_0x4c1c6a[_0xbc90('0x39')]);return db['DashboardItem'][_0xbc90('0x3a')](_0x49c00f)[_0xbc90('0x28')](handleEntityNotFound(_0x2b3e8b,null))[_0xbc90('0x28')](respondWithResult(_0x2b3e8b,null))[_0xbc90('0x3b')](handleError(_0x2b3e8b,null));};exports['destroy']=function(_0x4a2369,_0x2756a7){return db[_0xbc90('0x2f')][_0xbc90('0x3a')]({'where':{'id':_0x4a2369[_0xbc90('0x2e')]['id']}})['then'](handleEntityNotFound(_0x2756a7,null))[_0xbc90('0x28')](removeEntity(_0x2756a7,null))[_0xbc90('0x3b')](handleError(_0x2756a7,null));};function widgetAttributes(_0x459067){try{switch(_0x459067[_0xbc90('0x3c')]){case _0xbc90('0x3d'):return[{'name':_0xbc90('0x3e'),'value':_0x459067[_0xbc90('0x3e')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x0]?_0x459067[_0xbc90('0x3f')][0x0][_0xbc90('0x40')]:undefined)||'https://'}];case'custom':return[{'name':_0xbc90('0x41'),'value':_0x459067[_0xbc90('0x41')]||(_0x459067['attrs']&&_0x459067[_0xbc90('0x3f')][0x0]?_0x459067['attrs'][0x0][_0xbc90('0x40')]:undefined)||''}];case _0xbc90('0x42'):return[{'name':'attrHourFormat','value':_0x459067['attrHourFormat']||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x0]?_0x459067[_0xbc90('0x3f')][0x0][_0xbc90('0x40')]:undefined)||_0xbc90('0x43')},{'name':_0xbc90('0x44'),'value':_0x459067[_0xbc90('0x44')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x1]?_0x459067[_0xbc90('0x3f')][0x1]['value']:undefined)||_0xbc90('0x45')},{'name':_0xbc90('0x46'),'value':_0x459067[_0xbc90('0x46')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x2]?_0x459067[_0xbc90('0x3f')][0x2][_0xbc90('0x40')]:undefined)||0xc}];case _0xbc90('0x47'):return[{'name':_0xbc90('0x48'),'value':_0x459067[_0xbc90('0x48')]||(_0x459067['attrs']&&_0x459067[_0xbc90('0x3f')][0x0]?_0x459067[_0xbc90('0x3f')][0x0][_0xbc90('0x40')]:undefined)||'total'},{'name':_0xbc90('0x49'),'value':_0x459067[_0xbc90('0x49')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x1]?_0x459067[_0xbc90('0x3f')][0x1][_0xbc90('0x40')]:undefined)||[]},{'name':'attrFontSize','value':_0x459067[_0xbc90('0x46')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x2]?_0x459067[_0xbc90('0x3f')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0xbc90('0x4a'):return[{'name':_0xbc90('0x4b'),'value':_0x459067['attrSerie1']||(_0x459067[_0xbc90('0x3f')]&&_0x459067['attrs'][0x0]?_0x459067[_0xbc90('0x3f')][0x0]['value']:undefined)||_0xbc90('0x4c')},{'name':_0xbc90('0x4d'),'value':_0x459067[_0xbc90('0x4d')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x1]?_0x459067[_0xbc90('0x3f')][0x1][_0xbc90('0x40')]:undefined)||null},{'name':_0xbc90('0x4e'),'value':_0x459067['attrSerie3']||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x2]?_0x459067[_0xbc90('0x3f')][0x2]['value']:undefined)||null},{'name':_0xbc90('0x49'),'value':_0x459067[_0xbc90('0x49')]||(_0x459067['attrs']&&_0x459067[_0xbc90('0x3f')][0x3]?_0x459067[_0xbc90('0x3f')][0x3][_0xbc90('0x40')]:undefined)||[]}];case _0xbc90('0x4f'):return[{'name':_0xbc90('0x50'),'type':_0x459067['reportType']||(_0x459067[_0xbc90('0x3f')]&&_0x459067['attrs'][0x0]?_0x459067[_0xbc90('0x3f')][0x0][_0xbc90('0x3c')]:undefined)||null,'value':_0x459067[_0xbc90('0x50')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x0]?_0x459067[_0xbc90('0x3f')][0x0][_0xbc90('0x40')]:undefined)||null},{'name':_0xbc90('0x51'),'value':_0x459067[_0xbc90('0x51')]||(_0x459067['attrs']&&_0x459067[_0xbc90('0x3f')][0x1]?_0x459067[_0xbc90('0x3f')][0x1][_0xbc90('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x10dec4){logger[_0xbc90('0x29')](_0xbc90('0x52'),JSON[_0xbc90('0x53')](_0x10dec4));return[];}}exports[_0xbc90('0x54')]=function(_0x503963,_0x561a41){if(_0x503963['body']){_0x503963[_0xbc90('0x55')][_0xbc90('0x3f')]=widgetAttributes(_0x503963['body']);}return db[_0xbc90('0x2f')]['create'](_0x503963[_0xbc90('0x55')],{})[_0xbc90('0x28')](respondWithResult(_0x561a41,0xc9))[_0xbc90('0x3b')](handleError(_0x561a41,null));};exports[_0xbc90('0x27')]=function(_0x366c13,_0x241f0f){if(_0x366c13[_0xbc90('0x55')]['id']){delete _0x366c13[_0xbc90('0x55')]['id'];}_0x366c13[_0xbc90('0x55')][_0xbc90('0x3f')]=widgetAttributes(_0x366c13[_0xbc90('0x55')]);return db[_0xbc90('0x2f')][_0xbc90('0x3a')]({'where':{'id':_0x366c13[_0xbc90('0x2e')]['id']}})[_0xbc90('0x28')](handleEntityNotFound(_0x241f0f,null))[_0xbc90('0x28')](saveUpdates(_0x366c13[_0xbc90('0x55')],null))[_0xbc90('0x28')](respondWithResult(_0x241f0f,null))[_0xbc90('0x3b')](handleError(_0x241f0f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 02573a9..b3442ff 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 _0x6cb7=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0xdd7cf6,_0x1e33d7){var _0x20f160=function(_0x554a61){while(--_0x554a61){_0xdd7cf6['push'](_0xdd7cf6['shift']());}};_0x20f160(++_0x1e33d7);}(_0x6cb7,0x114));var _0x76cb=function(_0x1cee90,_0x39c08d){_0x1cee90=_0x1cee90-0x0;var _0x1d0b7e=_0x6cb7[_0x1cee90];return _0x1d0b7e;};'use strict';var EventEmitter=require(_0x76cb('0x0'));var DashboardItem=require(_0x76cb('0x1'))['db'][_0x76cb('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x76cb('0x3')](0x0);var events={'afterCreate':_0x76cb('0x4'),'afterUpdate':_0x76cb('0x5'),'afterDestroy':_0x76cb('0x6')};function emitEvent(_0x256eb4){return function(_0x39f22a,_0x43db23,_0x1abaf3){DashboardItemEvents['emit'](_0x256eb4+':'+_0x39f22a['id'],_0x39f22a);DashboardItemEvents[_0x76cb('0x7')](_0x256eb4,_0x39f22a);_0x1abaf3(null);};}for(var e in events){if(events[_0x76cb('0x8')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x76cb('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x5d66=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove'];(function(_0x3feddf,_0x54a0be){var _0x409181=function(_0x2668c4){while(--_0x2668c4){_0x3feddf['push'](_0x3feddf['shift']());}};_0x409181(++_0x54a0be);}(_0x5d66,0x130));var _0x65d6=function(_0x294ca7,_0x189f84){_0x294ca7=_0x294ca7-0x0;var _0x491a18=_0x5d66[_0x294ca7];return _0x491a18;};'use strict';var EventEmitter=require(_0x65d6('0x0'));var DashboardItem=require(_0x65d6('0x1'))['db'][_0x65d6('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x65d6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x65d6('0x4'),'afterDestroy':_0x65d6('0x5')};function emitEvent(_0x4aff50){return function(_0x5c339b,_0xd94f91,_0x366957){DashboardItemEvents[_0x65d6('0x6')](_0x4aff50+':'+_0x5c339b['id'],_0x5c339b);DashboardItemEvents[_0x65d6('0x6')](_0x4aff50,_0x5c339b);_0x366957(null);};}for(var e in events){if(events[_0x65d6('0x7')](e)){var event=events[e];DashboardItem[_0x65d6('0x8')](e,emitEvent(event));}}module[_0x65d6('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index fbb6400..b866241 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 _0xcbac=['rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2fb214,_0x568201){var _0xabc9cf=function(_0x321894){while(--_0x321894){_0x2fb214['push'](_0x2fb214['shift']());}};_0xabc9cf(++_0x568201);}(_0xcbac,0x1b4));var _0xccba=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xcbac[_0x2f3848];return _0x102668;};'use strict';var _=require(_0xccba('0x0'));var util=require(_0xccba('0x1'));var logger=require('../../config/logger')(_0xccba('0x2'));var moment=require(_0xccba('0x3'));var BPromise=require(_0xccba('0x4'));var rp=require(_0xccba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xccba('0x6'));var config=require(_0xccba('0x7'));var attributes=require(_0xccba('0x8'));module[_0xccba('0x9')]=function(_0x4bbc8c,_0x593647){return _0x4bbc8c[_0xccba('0xa')](_0xccba('0xb'),attributes,{'tableName':_0xccba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe99b=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe99b,0x11f));var _0xbe99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe99b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbe99('0x0'));var util=require(_0xbe99('0x1'));var logger=require(_0xbe99('0x2'))(_0xbe99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbe99('0x4'));var fs=require('fs');var path=require(_0xbe99('0x5'));var rimraf=require(_0xbe99('0x6'));var config=require(_0xbe99('0x7'));var attributes=require(_0xbe99('0x8'));module[_0xbe99('0x9')]=function(_0x3af94c,_0x22a212){return _0x3af94c[_0xbe99('0xa')](_0xbe99('0xb'),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 f13ed7b..43b05ba 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 _0x8c5b=['then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','message','DashboardItem,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8c5b,0x199));var _0xb8c5=function(_0x5a8795,_0x462f13){_0x5a8795=_0x5a8795-0x0;var _0x140a4e=_0x8c5b[_0x5a8795];return _0x140a4e;};'use strict';var _=require('lodash');var util=require(_0xb8c5('0x0'));var moment=require(_0xb8c5('0x1'));var BPromise=require(_0xb8c5('0x2'));var rs=require(_0xb8c5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8c5('0x4'))['db'];var utils=require(_0xb8c5('0x5'));var logger=require('../../config/logger')(_0xb8c5('0x6'));var config=require(_0xb8c5('0x7'));var jayson=require(_0xb8c5('0x8'));var client=jayson[_0xb8c5('0x9')][_0xb8c5('0xa')]({'port':0x232a});config[_0xb8c5('0xb')]=_[_0xb8c5('0xc')](config[_0xb8c5('0xb')],{'host':_0xb8c5('0xd'),'port':0x18eb});var socket=require(_0xb8c5('0xe'))(new Redis(config[_0xb8c5('0xb')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x2c6d5f,_0x6ec057,_0xb08f2b){return new BPromise(function(_0xc84084,_0x5500d7){return client[_0xb8c5('0xf')](_0x2c6d5f,_0xb08f2b)[_0xb8c5('0x10')](function(_0x44a756){logger[_0xb8c5('0x11')]('DashboardItem,\x20%s,\x20%s',_0x6ec057,_0xb8c5('0x12'));logger[_0xb8c5('0x13')](_0xb8c5('0x14'),_0x6ec057,'request\x20sent',JSON['stringify'](_0x44a756));if(_0x44a756[_0xb8c5('0x15')]){if(_0x44a756[_0xb8c5('0x15')]['code']===0x1f4){logger[_0xb8c5('0x15')]('DashboardItem,\x20%s,\x20%s',_0x6ec057,_0x44a756[_0xb8c5('0x15')][_0xb8c5('0x16')]);return _0x5500d7(_0x44a756['error'][_0xb8c5('0x16')]);}logger[_0xb8c5('0x15')]('DashboardItem,\x20%s,\x20%s',_0x6ec057,_0x44a756[_0xb8c5('0x15')][_0xb8c5('0x16')]);return _0xc84084(_0x44a756['error'][_0xb8c5('0x16')]);}else{logger['info'](_0xb8c5('0x17'),_0x6ec057,_0xb8c5('0x12'));_0xc84084(_0x44a756[_0xb8c5('0x18')][_0xb8c5('0x16')]);}})['catch'](function(_0x4aab4a){logger[_0xb8c5('0x15')](_0xb8c5('0x17'),_0x6ec057,_0x4aab4a);_0x5500d7(_0x4aab4a);});});} \ No newline at end of file +var _0x1404=['http','redis','defaults','localhost','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5bd10f,_0x44659f){var _0x4bd4c7=function(_0x2c299a){while(--_0x2c299a){_0x5bd10f['push'](_0x5bd10f['shift']());}};_0x4bd4c7(++_0x44659f);}(_0x1404,0x1a1));var _0x4140=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x1404[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4140('0x0'));var BPromise=require(_0x4140('0x1'));var rs=require(_0x4140('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4140('0x3'))['db'];var utils=require(_0x4140('0x4'));var logger=require(_0x4140('0x5'))(_0x4140('0x6'));var config=require('../../config/environment');var jayson=require(_0x4140('0x7'));var client=jayson['client'][_0x4140('0x8')]({'port':0x232a});config[_0x4140('0x9')]=_[_0x4140('0xa')](config['redis'],{'host':_0x4140('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4140('0x9')]));require(_0x4140('0xc'))[_0x4140('0xd')](socket);function respondWithRpcPromise(_0x1ef80a,_0x56e4e9,_0xaef271){return new BPromise(function(_0x4c6410,_0x56dc1f){return client[_0x4140('0xe')](_0x1ef80a,_0xaef271)['then'](function(_0x4e5583){logger['info'](_0x4140('0xf'),_0x56e4e9,_0x4140('0x10'));logger[_0x4140('0x11')](_0x4140('0x12'),_0x56e4e9,_0x4140('0x10'),JSON[_0x4140('0x13')](_0x4e5583));if(_0x4e5583[_0x4140('0x14')]){if(_0x4e5583[_0x4140('0x14')][_0x4140('0x15')]===0x1f4){logger[_0x4140('0x14')](_0x4140('0xf'),_0x56e4e9,_0x4e5583[_0x4140('0x14')][_0x4140('0x16')]);return _0x56dc1f(_0x4e5583[_0x4140('0x14')][_0x4140('0x16')]);}logger[_0x4140('0x14')](_0x4140('0xf'),_0x56e4e9,_0x4e5583['error']['message']);return _0x4c6410(_0x4e5583[_0x4140('0x14')][_0x4140('0x16')]);}else{logger['info'](_0x4140('0xf'),_0x56e4e9,'request\x20sent');_0x4c6410(_0x4e5583[_0x4140('0x17')][_0x4140('0x16')]);}})[_0x4140('0x18')](function(_0x4370f5){logger[_0x4140('0x14')](_0x4140('0xf'),_0x56e4e9,_0x4370f5);_0x56dc1f(_0x4370f5);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 93e7d2c..19b2d2a 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 _0x2bc1=['dashboardItem:','./dashboardItem.events','save','remove','emit','removeListener','register'];(function(_0x1cffe2,_0x5383e8){var _0x57030e=function(_0xe9c73f){while(--_0xe9c73f){_0x1cffe2['push'](_0x1cffe2['shift']());}};_0x57030e(++_0x5383e8);}(_0x2bc1,0x9b));var _0x12bc=function(_0x42867b,_0x26bdfa){_0x42867b=_0x42867b-0x0;var _0x1a748f=_0x2bc1[_0x42867b];return _0x1a748f;};'use strict';var DashboardItemEvents=require(_0x12bc('0x0'));var events=[_0x12bc('0x1'),_0x12bc('0x2'),'update'];function createListener(_0x912d09,_0x367570){return function(_0x7b4dbb){_0x367570[_0x12bc('0x3')](_0x912d09,_0x7b4dbb);};}function removeListener(_0x29f50e,_0x26cf8b){return function(){DashboardItemEvents[_0x12bc('0x4')](_0x29f50e,_0x26cf8b);};}exports[_0x12bc('0x5')]=function(_0x4f3bcd){for(var _0x27ffea=0x0,_0x3b9c5f=events['length'];_0x27ffea<_0x3b9c5f;_0x27ffea++){var _0x414cc9=events[_0x27ffea];var _0xc839f0=createListener(_0x12bc('0x6')+_0x414cc9,_0x4f3bcd);DashboardItemEvents['on'](_0x414cc9,_0xc839f0);}}; \ No newline at end of file +var _0xc520=['save','remove','update','emit','length','./dashboardItem.events'];(function(_0x458031,_0x5c93a1){var _0x3d6aa2=function(_0x34bc08){while(--_0x34bc08){_0x458031['push'](_0x458031['shift']());}};_0x3d6aa2(++_0x5c93a1);}(_0xc520,0x1df));var _0x0c52=function(_0x1a4e52,_0x37f7b0){_0x1a4e52=_0x1a4e52-0x0;var _0x37cfb1=_0xc520[_0x1a4e52];return _0x37cfb1;};'use strict';var DashboardItemEvents=require(_0x0c52('0x0'));var events=[_0x0c52('0x1'),_0x0c52('0x2'),_0x0c52('0x3')];function createListener(_0x3fa60f,_0x33c63e){return function(_0x2a056b){_0x33c63e[_0x0c52('0x4')](_0x3fa60f,_0x2a056b);};}function removeListener(_0x47a220,_0x533899){return function(){DashboardItemEvents['removeListener'](_0x47a220,_0x533899);};}exports['register']=function(_0x250ab0){for(var _0x4eb1f2=0x0,_0x1bd8e0=events[_0x0c52('0x5')];_0x4eb1f2<_0x1bd8e0;_0x4eb1f2++){var _0x215dd2=events[_0x4eb1f2];var _0x2ecddd=createListener('dashboardItem:'+_0x215dd2,_0x250ab0);DashboardItemEvents['on'](_0x215dd2,_0x2ecddd);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 6d869b6..e5ab7c2 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x187d=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x187d,0x93));var _0xd187=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x187d[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/:id',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0xc')]);router[_0xd187('0xd')](_0xd187('0xe'),auth[_0xd187('0x9')](),controller['update']);router[_0xd187('0xf')](_0xd187('0xe'),auth[_0xd187('0x9')](),controller[_0xd187('0x10')]);module[_0xd187('0x11')]=router; \ No newline at end of file +var _0x31f0=['create','put','/:id','isAuthenticated','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','post'];(function(_0x505a68,_0xa297b7){var _0x4caac6=function(_0xa21052){while(--_0xa21052){_0x505a68['push'](_0x505a68['shift']());}};_0x4caac6(++_0xa297b7);}(_0x31f0,0xb7));var _0x031f=function(_0x5ee4c6,_0x10d394){_0x5ee4c6=_0x5ee4c6-0x0;var _0x39b8f7=_0x31f0[_0x5ee4c6];return _0x39b8f7;};'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')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x031f('0x8')]('/',auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0xa')](_0x031f('0xb'),auth[_0x031f('0xc')](),controller['update']);router[_0x031f('0xd')](_0x031f('0xb'),auth[_0x031f('0xc')](),controller[_0x031f('0xe')]);module[_0x031f('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 7605ecc..2a8b37e 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 _0xeb74=['STRING','sequelize','exports'];(function(_0x37dbb8,_0x3669e1){var _0x587a3c=function(_0x9045ce){while(--_0x9045ce){_0x37dbb8['push'](_0x37dbb8['shift']());}};_0x587a3c(++_0x3669e1);}(_0xeb74,0xa3));var _0x4eb7=function(_0x55fcaa,_0x1231f8){_0x55fcaa=_0x55fcaa-0x0;var _0xf595d8=_0xeb74[_0x55fcaa];return _0xf595d8;};'use strict';var Sequelize=require(_0x4eb7('0x0'));module[_0x4eb7('0x1')]={'name':{'type':Sequelize[_0x4eb7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xec50=['STRING','sequelize'];(function(_0x5a2973,_0x367fa5){var _0x47165e=function(_0x2e69f7){while(--_0x2e69f7){_0x5a2973['push'](_0x5a2973['shift']());}};_0x47165e(++_0x367fa5);}(_0xec50,0x1a3));var _0x0ec5=function(_0x20b9fc,_0x5dab92){_0x20b9fc=_0x20b9fc-0x0;var _0x511a2b=_0xec50[_0x20b9fc];return _0x511a2b;};'use strict';var Sequelize=require(_0x0ec5('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ec5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index fe3441e..3354d7d 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 _0x5e06=['merge','VIRTUAL','options','include','findAll','rows','show','rawAttributes','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','get','Dispositions','error','stack','name','index','map','Disposition','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where'];(function(_0x337ce4,_0xbb56a){var _0x5958c3=function(_0x3664d9){while(--_0x3664d9){_0x337ce4['push'](_0x337ce4['shift']());}};_0x5958c3(++_0xbb56a);}(_0x5e06,0x1a3));var _0x65e0=function(_0x4dc8fd,_0x16a480){_0x4dc8fd=_0x4dc8fd-0x0;var _0x290c6a=_0x5e06[_0x4dc8fd];return _0x290c6a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65e0('0x0'));var rimraf=require(_0x65e0('0x1'));var zipdir=require(_0x65e0('0x2'));var jsonpatch=require(_0x65e0('0x3'));var rp=require(_0x65e0('0x4'));var moment=require(_0x65e0('0x5'));var BPromise=require(_0x65e0('0x6'));var Mustache=require('mustache');var util=require(_0x65e0('0x7'));var path=require('path');var sox=require(_0x65e0('0x8'));var csv=require('to-csv');var ejs=require(_0x65e0('0x9'));var fs=require('fs');var _=require(_0x65e0('0xa'));var squel=require('squel');var crypto=require(_0x65e0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x65e0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x65e0('0xd'));var Papa=require(_0x65e0('0xe'));var Redis=require(_0x65e0('0xf'));var authService=require(_0x65e0('0x10'));var qs=require(_0x65e0('0x11'));var as=require(_0x65e0('0x12'));var hardwareService=require(_0x65e0('0x13'));var logger=require(_0x65e0('0x14'))(_0x65e0('0x15'));var utils=require('../../config/utils');var config=require(_0x65e0('0x16'));var db=require(_0x65e0('0x17'))['db'];function respondWithStatusCode(_0x17614f,_0xdc0ef7){_0xdc0ef7=_0xdc0ef7||0xcc;return function(_0x6e57b6){if(_0x6e57b6){return _0x17614f[_0x65e0('0x18')](_0xdc0ef7);}return _0x17614f[_0x65e0('0x19')](_0xdc0ef7)[_0x65e0('0x1a')]();};}function respondWithResult(_0x13ccc3,_0xa3db3c){_0xa3db3c=_0xa3db3c||0xc8;return function(_0x2c7715){if(_0x2c7715){return _0x13ccc3[_0x65e0('0x19')](_0xa3db3c)[_0x65e0('0x1b')](_0x2c7715);}};}function respondWithFilteredResult(_0xf018b9,_0x12fc36){return function(_0x5ab90c){if(_0x5ab90c){var _0xe962a9=_0x5ab90c[_0x65e0('0x1c')],_0x26b52f=_0x12fc36[_0x65e0('0x1d')],_0x1aba2b=_0x12fc36[_0x65e0('0x1d')]+_0x12fc36[_0x65e0('0x1e')],_0x313250;if(_0x1aba2b>=_0xe962a9){_0x1aba2b=_0xe962a9;_0x313250=0xc8;}else{_0x313250=0xce;}_0xf018b9[_0x65e0('0x19')](_0x313250);return _0xf018b9[_0x65e0('0x1f')](_0x65e0('0x20'),_0x26b52f+'-'+_0x1aba2b+'/'+_0xe962a9)[_0x65e0('0x1b')](_0x5ab90c);}return null;};}function patchUpdates(_0x1711b4){return function(_0x2bc5bc){try{jsonpatch['apply'](_0x2bc5bc,_0x1711b4,!![]);}catch(_0x2a91ed){return BPromise[_0x65e0('0x21')](_0x2a91ed);}return _0x2bc5bc['save']();};}function saveUpdates(_0x1082dd,_0x15efe6){return function(_0x221e38){if(_0x221e38){return _0x221e38[_0x65e0('0x22')](_0x1082dd)['then'](function(_0x2362c8){return _0x2362c8;});}return null;};}function removeEntity(_0x1efd76,_0x2cc998){return function(_0x1af3bb){if(_0x1af3bb){return _0x1af3bb[_0x65e0('0x23')]()[_0x65e0('0x24')](function(){var _0x2c7bc6=_0x1af3bb[_0x65e0('0x25')]({'plain':!![]});var _0x518019=_0x65e0('0x26');return db['UserProfileResource'][_0x65e0('0x23')]({'where':{'type':_0x518019,'resourceId':_0x2c7bc6['id']}})[_0x65e0('0x24')](function(){return _0x1af3bb;});})['then'](function(){_0x1efd76[_0x65e0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20049f,_0x4e29d8){return function(_0x5342d3){if(!_0x5342d3){_0x20049f[_0x65e0('0x18')](0x194);}return _0x5342d3;};}function handleError(_0x383e6d,_0x1bec9a){_0x1bec9a=_0x1bec9a||0x1f4;return function(_0x2025b8){logger[_0x65e0('0x27')](_0x2025b8[_0x65e0('0x28')]);if(_0x2025b8['name']){delete _0x2025b8[_0x65e0('0x29')];}_0x383e6d['status'](_0x1bec9a)['send'](_0x2025b8);};}exports[_0x65e0('0x2a')]=function(_0x4da9f0,_0x5a0aa3){var _0xa148e7={},_0x4eec01={},_0x2b50af={'count':0x0,'rows':[]};var _0x551dae=_[_0x65e0('0x2b')](db[_0x65e0('0x2c')]['rawAttributes'],function(_0x2139a8){return{'name':_0x2139a8[_0x65e0('0x2d')],'type':_0x2139a8[_0x65e0('0x2e')][_0x65e0('0x2f')]};});_0x4eec01[_0x65e0('0x30')]=_['map'](_0x551dae,_0x65e0('0x29'));_0x4eec01[_0x65e0('0x31')]=_[_0x65e0('0x32')](_0x4da9f0[_0x65e0('0x31')]);_0x4eec01[_0x65e0('0x33')]=_[_0x65e0('0x34')](_0x4eec01[_0x65e0('0x30')],_0x4eec01['query']);_0xa148e7[_0x65e0('0x35')]=_['intersection'](_0x4eec01[_0x65e0('0x30')],qs[_0x65e0('0x36')](_0x4da9f0[_0x65e0('0x31')]['fields']));_0xa148e7[_0x65e0('0x35')]=_0xa148e7[_0x65e0('0x35')][_0x65e0('0x37')]?_0xa148e7['attributes']:_0x4eec01['model'];if(!_0x4da9f0[_0x65e0('0x31')][_0x65e0('0x38')]('nolimit')){_0xa148e7['limit']=qs[_0x65e0('0x1e')](_0x4da9f0[_0x65e0('0x31')][_0x65e0('0x1e')]);_0xa148e7['offset']=qs[_0x65e0('0x1d')](_0x4da9f0[_0x65e0('0x31')][_0x65e0('0x1d')]);}_0xa148e7[_0x65e0('0x39')]=qs[_0x65e0('0x3a')](_0x4da9f0[_0x65e0('0x31')][_0x65e0('0x3a')]);_0xa148e7['where']=qs[_0x65e0('0x33')](_[_0x65e0('0x3b')](_0x4da9f0[_0x65e0('0x31')],_0x4eec01[_0x65e0('0x33')]),_0x551dae);if(_0x4da9f0['query']['filter']){_0xa148e7[_0x65e0('0x3c')]=_[_0x65e0('0x3d')](_0xa148e7[_0x65e0('0x3c')],{'$or':_[_0x65e0('0x2b')](_0x551dae,function(_0x26ee56){if(_0x26ee56[_0x65e0('0x2e')]!==_0x65e0('0x3e')){var _0x496f11={};_0x496f11[_0x26ee56['name']]={'$like':'%'+_0x4da9f0['query']['filter']+'%'};return _0x496f11;}})});}_0xa148e7=_[_0x65e0('0x3d')]({},_0xa148e7,_0x4da9f0[_0x65e0('0x3f')]);var _0x4c782f={'where':_0xa148e7['where']};return db[_0x65e0('0x2c')][_0x65e0('0x1c')](_0x4c782f)[_0x65e0('0x24')](function(_0x90d904){_0x2b50af['count']=_0x90d904;if(_0x4da9f0[_0x65e0('0x31')]['includeAll']){_0xa148e7[_0x65e0('0x40')]=[{'all':!![]}];}return db[_0x65e0('0x2c')][_0x65e0('0x41')](_0xa148e7);})[_0x65e0('0x24')](function(_0x526db2){_0x2b50af[_0x65e0('0x42')]=_0x526db2;return _0x2b50af;})[_0x65e0('0x24')](respondWithFilteredResult(_0x5a0aa3,_0xa148e7))['catch'](handleError(_0x5a0aa3,null));};exports[_0x65e0('0x43')]=function(_0x4f0d2f,_0x3e16f8){var _0x4194f9={'raw':!![],'where':{'id':_0x4f0d2f['params']['id']}},_0x2d5a55={};_0x2d5a55[_0x65e0('0x30')]=_[_0x65e0('0x32')](db[_0x65e0('0x2c')][_0x65e0('0x44')]);_0x2d5a55[_0x65e0('0x31')]=_[_0x65e0('0x32')](_0x4f0d2f[_0x65e0('0x31')]);_0x2d5a55[_0x65e0('0x33')]=_['intersection'](_0x2d5a55[_0x65e0('0x30')],_0x2d5a55['query']);_0x4194f9[_0x65e0('0x35')]=_['intersection'](_0x2d5a55['model'],qs['fields'](_0x4f0d2f['query'][_0x65e0('0x36')]));_0x4194f9[_0x65e0('0x35')]=_0x4194f9[_0x65e0('0x35')]['length']?_0x4194f9[_0x65e0('0x35')]:_0x2d5a55[_0x65e0('0x30')];if(_0x4f0d2f['query'][_0x65e0('0x45')]){_0x4194f9['include']=[{'all':!![]}];}_0x4194f9=_['merge']({},_0x4194f9,_0x4f0d2f[_0x65e0('0x3f')]);return db[_0x65e0('0x2c')][_0x65e0('0x46')](_0x4194f9)['then'](handleEntityNotFound(_0x3e16f8,null))[_0x65e0('0x24')](respondWithResult(_0x3e16f8,null))[_0x65e0('0x47')](handleError(_0x3e16f8,null));};exports[_0x65e0('0x48')]=function(_0x5a0ee6,_0x5d52cb){return db[_0x65e0('0x2c')]['create'](_0x5a0ee6[_0x65e0('0x49')],{})['then'](function(_0x3299b3){var _0x109046=_0x5a0ee6['user']['get']({'plain':!![]});if(!_0x109046)throw new Error(_0x65e0('0x4a'));if(_0x109046[_0x65e0('0x4b')]===_0x65e0('0x4c')){var _0x188afa=_0x3299b3['get']({'plain':!![]});var _0x231da8=_0x65e0('0x26');return db[_0x65e0('0x4d')][_0x65e0('0x46')]({'where':{'name':_0x231da8,'userProfileId':_0x109046['userProfileId']},'raw':!![]})['then'](function(_0xadd640){if(_0xadd640&&_0xadd640[_0x65e0('0x4e')]===0x0){return db['UserProfileResource'][_0x65e0('0x48')]({'name':_0x188afa['name'],'resourceId':_0x188afa['id'],'type':_0xadd640[_0x65e0('0x29')],'sectionId':_0xadd640['id']},{})[_0x65e0('0x24')](function(){return _0x3299b3;});}else{return _0x3299b3;}})[_0x65e0('0x47')](function(_0x5cbbc0){logger[_0x65e0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cbbc0);throw _0x5cbbc0;});}return _0x3299b3;})['then'](respondWithResult(_0x5d52cb,0xc9))[_0x65e0('0x47')](handleError(_0x5d52cb,null));};exports[_0x65e0('0x22')]=function(_0x1e5665,_0x1907c4){if(_0x1e5665[_0x65e0('0x49')]['id']){delete _0x1e5665[_0x65e0('0x49')]['id'];}return db[_0x65e0('0x2c')][_0x65e0('0x46')]({'where':{'id':_0x1e5665[_0x65e0('0x4f')]['id']}})[_0x65e0('0x24')](handleEntityNotFound(_0x1907c4,null))[_0x65e0('0x24')](saveUpdates(_0x1e5665[_0x65e0('0x49')],null))[_0x65e0('0x24')](respondWithResult(_0x1907c4,null))[_0x65e0('0x47')](handleError(_0x1907c4,null));};exports[_0x65e0('0x23')]=function(_0x19b0ae,_0x2eeb0f){return db[_0x65e0('0x2c')][_0x65e0('0x46')]({'where':{'id':_0x19b0ae[_0x65e0('0x4f')]['id']}})[_0x65e0('0x24')](handleEntityNotFound(_0x2eeb0f,null))['then'](removeEntity(_0x2eeb0f,null))['catch'](handleError(_0x2eeb0f,null));}; \ No newline at end of file +var _0x9e46=['../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','catch','show','params','keys','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x48c059,_0x5cb1fe){var _0xcb0f8c=function(_0x539ba7){while(--_0x539ba7){_0x48c059['push'](_0x48c059['shift']());}};_0xcb0f8c(++_0x5cb1fe);}(_0x9e46,0x19b));var _0x69e4=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9e46[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x69e4('0x0'));var emlformat=require(_0x69e4('0x1'));var rimraf=require(_0x69e4('0x2'));var zipdir=require(_0x69e4('0x3'));var jsonpatch=require(_0x69e4('0x4'));var rp=require(_0x69e4('0x5'));var moment=require('moment');var BPromise=require(_0x69e4('0x6'));var Mustache=require(_0x69e4('0x7'));var util=require(_0x69e4('0x8'));var path=require(_0x69e4('0x9'));var sox=require(_0x69e4('0xa'));var csv=require(_0x69e4('0xb'));var ejs=require(_0x69e4('0xc'));var fs=require('fs');var _=require(_0x69e4('0xd'));var squel=require(_0x69e4('0xe'));var crypto=require(_0x69e4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x69e4('0x10'));var toCsv=require('to-csv');var querystring=require(_0x69e4('0x11'));var Papa=require(_0x69e4('0x12'));var Redis=require(_0x69e4('0x13'));var authService=require(_0x69e4('0x14'));var qs=require(_0x69e4('0x15'));var as=require(_0x69e4('0x16'));var hardwareService=require(_0x69e4('0x17'));var logger=require(_0x69e4('0x18'))('api');var utils=require(_0x69e4('0x19'));var config=require(_0x69e4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5daba6,_0x5afeea){_0x5afeea=_0x5afeea||0xcc;return function(_0x5d8dd1){if(_0x5d8dd1){return _0x5daba6[_0x69e4('0x1b')](_0x5afeea);}return _0x5daba6[_0x69e4('0x1c')](_0x5afeea)[_0x69e4('0x1d')]();};}function respondWithResult(_0x421cee,_0x1b0516){_0x1b0516=_0x1b0516||0xc8;return function(_0x2e2436){if(_0x2e2436){return _0x421cee[_0x69e4('0x1c')](_0x1b0516)[_0x69e4('0x1e')](_0x2e2436);}};}function respondWithFilteredResult(_0x5cb39d,_0x47bd8f){return function(_0x3a5cf2){if(_0x3a5cf2){var _0x34419e=_0x3a5cf2['count'],_0xeaa774=_0x47bd8f[_0x69e4('0x1f')],_0x2a69a9=_0x47bd8f[_0x69e4('0x1f')]+_0x47bd8f[_0x69e4('0x20')],_0x27c26d;if(_0x2a69a9>=_0x34419e){_0x2a69a9=_0x34419e;_0x27c26d=0xc8;}else{_0x27c26d=0xce;}_0x5cb39d['status'](_0x27c26d);return _0x5cb39d[_0x69e4('0x21')]('Content-Range',_0xeaa774+'-'+_0x2a69a9+'/'+_0x34419e)[_0x69e4('0x1e')](_0x3a5cf2);}return null;};}function patchUpdates(_0x5b3a95){return function(_0x4627f2){try{jsonpatch[_0x69e4('0x22')](_0x4627f2,_0x5b3a95,!![]);}catch(_0x3da7e0){return BPromise[_0x69e4('0x23')](_0x3da7e0);}return _0x4627f2[_0x69e4('0x24')]();};}function saveUpdates(_0x4b31ef,_0x52bb9f){return function(_0x1f9ee5){if(_0x1f9ee5){return _0x1f9ee5[_0x69e4('0x25')](_0x4b31ef)[_0x69e4('0x26')](function(_0x3d5ea9){return _0x3d5ea9;});}return null;};}function removeEntity(_0x322ab0,_0x3607ef){return function(_0x5cf15f){if(_0x5cf15f){return _0x5cf15f[_0x69e4('0x27')]()['then'](function(){var _0x364bab=_0x5cf15f[_0x69e4('0x28')]({'plain':!![]});var _0xeba747=_0x69e4('0x29');return db[_0x69e4('0x2a')]['destroy']({'where':{'type':_0xeba747,'resourceId':_0x364bab['id']}})[_0x69e4('0x26')](function(){return _0x5cf15f;});})[_0x69e4('0x26')](function(){_0x322ab0[_0x69e4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49b1df,_0x4a2863){return function(_0x5e5371){if(!_0x5e5371){_0x49b1df['sendStatus'](0x194);}return _0x5e5371;};}function handleError(_0x1b20e3,_0x227ba2){_0x227ba2=_0x227ba2||0x1f4;return function(_0x5cae8a){logger[_0x69e4('0x2b')](_0x5cae8a[_0x69e4('0x2c')]);if(_0x5cae8a[_0x69e4('0x2d')]){delete _0x5cae8a[_0x69e4('0x2d')];}_0x1b20e3[_0x69e4('0x1c')](_0x227ba2)[_0x69e4('0x2e')](_0x5cae8a);};}exports[_0x69e4('0x2f')]=function(_0x4390b1,_0xeeb857){var _0xbdbbb3={},_0x455934={},_0x3d8d75={'count':0x0,'rows':[]};var _0x5a98a4=_[_0x69e4('0x30')](db[_0x69e4('0x31')][_0x69e4('0x32')],function(_0x4f0e6f){return{'name':_0x4f0e6f[_0x69e4('0x33')],'type':_0x4f0e6f[_0x69e4('0x34')][_0x69e4('0x35')]};});_0x455934['model']=_[_0x69e4('0x30')](_0x5a98a4,_0x69e4('0x2d'));_0x455934[_0x69e4('0x36')]=_['keys'](_0x4390b1['query']);_0x455934[_0x69e4('0x37')]=_[_0x69e4('0x38')](_0x455934[_0x69e4('0x39')],_0x455934[_0x69e4('0x36')]);_0xbdbbb3[_0x69e4('0x3a')]=_[_0x69e4('0x38')](_0x455934[_0x69e4('0x39')],qs[_0x69e4('0x3b')](_0x4390b1['query'][_0x69e4('0x3b')]));_0xbdbbb3['attributes']=_0xbdbbb3[_0x69e4('0x3a')][_0x69e4('0x3c')]?_0xbdbbb3['attributes']:_0x455934['model'];if(!_0x4390b1[_0x69e4('0x36')][_0x69e4('0x3d')](_0x69e4('0x3e'))){_0xbdbbb3[_0x69e4('0x20')]=qs[_0x69e4('0x20')](_0x4390b1[_0x69e4('0x36')]['limit']);_0xbdbbb3[_0x69e4('0x1f')]=qs['offset'](_0x4390b1['query']['offset']);}_0xbdbbb3[_0x69e4('0x3f')]=qs[_0x69e4('0x40')](_0x4390b1[_0x69e4('0x36')][_0x69e4('0x40')]);_0xbdbbb3[_0x69e4('0x41')]=qs['filters'](_[_0x69e4('0x42')](_0x4390b1['query'],_0x455934[_0x69e4('0x37')]),_0x5a98a4);if(_0x4390b1['query']['filter']){_0xbdbbb3[_0x69e4('0x41')]=_[_0x69e4('0x43')](_0xbdbbb3[_0x69e4('0x41')],{'$or':_['map'](_0x5a98a4,function(_0x51e33a){if(_0x51e33a['type']!==_0x69e4('0x44')){var _0x44fa09={};_0x44fa09[_0x51e33a[_0x69e4('0x2d')]]={'$like':'%'+_0x4390b1[_0x69e4('0x36')][_0x69e4('0x45')]+'%'};return _0x44fa09;}})});}_0xbdbbb3=_[_0x69e4('0x43')]({},_0xbdbbb3,_0x4390b1[_0x69e4('0x46')]);var _0x9235a5={'where':_0xbdbbb3[_0x69e4('0x41')]};return db[_0x69e4('0x31')][_0x69e4('0x47')](_0x9235a5)[_0x69e4('0x26')](function(_0x3b2687){_0x3d8d75[_0x69e4('0x47')]=_0x3b2687;if(_0x4390b1['query'][_0x69e4('0x48')]){_0xbdbbb3['include']=[{'all':!![]}];}return db[_0x69e4('0x31')][_0x69e4('0x49')](_0xbdbbb3);})[_0x69e4('0x26')](function(_0x5761ab){_0x3d8d75['rows']=_0x5761ab;return _0x3d8d75;})['then'](respondWithFilteredResult(_0xeeb857,_0xbdbbb3))[_0x69e4('0x4a')](handleError(_0xeeb857,null));};exports[_0x69e4('0x4b')]=function(_0x32d0aa,_0x4f6e7b){var _0x599dd0={'raw':!![],'where':{'id':_0x32d0aa[_0x69e4('0x4c')]['id']}},_0x246fc3={};_0x246fc3[_0x69e4('0x39')]=_[_0x69e4('0x4d')](db['Disposition'][_0x69e4('0x32')]);_0x246fc3['query']=_[_0x69e4('0x4d')](_0x32d0aa[_0x69e4('0x36')]);_0x246fc3['filters']=_[_0x69e4('0x38')](_0x246fc3['model'],_0x246fc3[_0x69e4('0x36')]);_0x599dd0['attributes']=_[_0x69e4('0x38')](_0x246fc3[_0x69e4('0x39')],qs[_0x69e4('0x3b')](_0x32d0aa['query']['fields']));_0x599dd0[_0x69e4('0x3a')]=_0x599dd0['attributes'][_0x69e4('0x3c')]?_0x599dd0[_0x69e4('0x3a')]:_0x246fc3[_0x69e4('0x39')];if(_0x32d0aa[_0x69e4('0x36')][_0x69e4('0x48')]){_0x599dd0[_0x69e4('0x4e')]=[{'all':!![]}];}_0x599dd0=_[_0x69e4('0x43')]({},_0x599dd0,_0x32d0aa[_0x69e4('0x46')]);return db[_0x69e4('0x31')][_0x69e4('0x4f')](_0x599dd0)[_0x69e4('0x26')](handleEntityNotFound(_0x4f6e7b,null))[_0x69e4('0x26')](respondWithResult(_0x4f6e7b,null))[_0x69e4('0x4a')](handleError(_0x4f6e7b,null));};exports[_0x69e4('0x50')]=function(_0x366046,_0x3dee13){return db[_0x69e4('0x31')][_0x69e4('0x50')](_0x366046[_0x69e4('0x51')],{})[_0x69e4('0x26')](function(_0x284b2e){var _0x251aca=_0x366046[_0x69e4('0x52')]['get']({'plain':!![]});if(!_0x251aca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x251aca['role']===_0x69e4('0x52')){var _0x51d917=_0x284b2e[_0x69e4('0x28')]({'plain':!![]});var _0x29dded=_0x69e4('0x29');return db[_0x69e4('0x53')][_0x69e4('0x4f')]({'where':{'name':_0x29dded,'userProfileId':_0x251aca[_0x69e4('0x54')]},'raw':!![]})['then'](function(_0x97ba0b){if(_0x97ba0b&&_0x97ba0b[_0x69e4('0x55')]===0x0){return db[_0x69e4('0x2a')][_0x69e4('0x50')]({'name':_0x51d917[_0x69e4('0x2d')],'resourceId':_0x51d917['id'],'type':_0x97ba0b[_0x69e4('0x2d')],'sectionId':_0x97ba0b['id']},{})['then'](function(){return _0x284b2e;});}else{return _0x284b2e;}})[_0x69e4('0x4a')](function(_0x499eb4){logger[_0x69e4('0x2b')](_0x69e4('0x56'),_0x499eb4);throw _0x499eb4;});}return _0x284b2e;})[_0x69e4('0x26')](respondWithResult(_0x3dee13,0xc9))[_0x69e4('0x4a')](handleError(_0x3dee13,null));};exports[_0x69e4('0x25')]=function(_0x3b35e9,_0x184ff8){if(_0x3b35e9[_0x69e4('0x51')]['id']){delete _0x3b35e9[_0x69e4('0x51')]['id'];}return db[_0x69e4('0x31')][_0x69e4('0x4f')]({'where':{'id':_0x3b35e9[_0x69e4('0x4c')]['id']}})[_0x69e4('0x26')](handleEntityNotFound(_0x184ff8,null))[_0x69e4('0x26')](saveUpdates(_0x3b35e9['body'],null))['then'](respondWithResult(_0x184ff8,null))['catch'](handleError(_0x184ff8,null));};exports[_0x69e4('0x27')]=function(_0x56853e,_0x12f424){return db[_0x69e4('0x31')]['find']({'where':{'id':_0x56853e[_0x69e4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x12f424,null))[_0x69e4('0x26')](removeEntity(_0x12f424,null))[_0x69e4('0x4a')](handleError(_0x12f424,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 5a66b22..dc61fbe 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 _0x1323=['Disposition','tools_dispositions','name','ListId','name_chat','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','WhatsappAccountId','lodash','util','api','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x1323,0x14e));var _0x3132=function(_0x580f6a,_0x1d638e){_0x580f6a=_0x580f6a-0x0;var _0x43bfd3=_0x1323[_0x580f6a];return _0x43bfd3;};'use strict';var _=require(_0x3132('0x0'));var util=require(_0x3132('0x1'));var logger=require('../../config/logger')(_0x3132('0x2'));var moment=require('moment');var BPromise=require(_0x3132('0x3'));var rp=require(_0x3132('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3132('0x5'));var attributes=require('./disposition.attributes');module[_0x3132('0x6')]=function(_0x534e53,_0x39ae44){return _0x534e53[_0x3132('0x7')](_0x3132('0x8'),attributes,{'tableName':_0x3132('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x3132('0xa'),_0x3132('0xb')]},{'unique':!![],'name':_0x3132('0xc'),'fields':[_0x3132('0xa'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x3132('0xa'),_0x3132('0xd')]},{'unique':!![],'name':'name_sms','fields':['name',_0x3132('0xe')]},{'unique':!![],'name':_0x3132('0xf'),'fields':[_0x3132('0xa'),_0x3132('0x10')]},{'unique':!![],'name':_0x3132('0x11'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x3132('0xa'),_0x3132('0x12')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e89=['define','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','request-promise','../../config/environment','./disposition.attributes','exports'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0x3e89,0x1ec));var _0x93e8=function(_0x34089e,_0x340ac1){_0x34089e=_0x34089e-0x0;var _0x2302de=_0x3e89[_0x34089e];return _0x2302de;};'use strict';var _=require('lodash');var util=require(_0x93e8('0x0'));var logger=require(_0x93e8('0x1'))(_0x93e8('0x2'));var moment=require(_0x93e8('0x3'));var BPromise=require('bluebird');var rp=require(_0x93e8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x93e8('0x5'));var attributes=require(_0x93e8('0x6'));module[_0x93e8('0x7')]=function(_0x3e2b91,_0xa3ebc5){return _0x3e2b91[_0x93e8('0x8')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x93e8('0x9'),'fields':[_0x93e8('0xa'),_0x93e8('0xb')]},{'unique':!![],'name':'name_chat','fields':[_0x93e8('0xa'),_0x93e8('0xc')]},{'unique':!![],'name':_0x93e8('0xd'),'fields':[_0x93e8('0xa'),_0x93e8('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0x93e8('0xa'),_0x93e8('0xf')]},{'unique':!![],'name':'name_fax','fields':[_0x93e8('0xa'),_0x93e8('0x10')]},{'unique':!![],'name':'name_openchannel','fields':[_0x93e8('0xa'),_0x93e8('0x11')]},{'unique':!![],'name':_0x93e8('0x12'),'fields':[_0x93e8('0xa'),_0x93e8('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index d03a942..d854fdd 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 _0x41c4=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x41c4,0x198));var _0x441c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x41c4[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x441c('0x0'));var util=require(_0x441c('0x1'));var moment=require(_0x441c('0x2'));var BPromise=require(_0x441c('0x3'));var rs=require(_0x441c('0x4'));var fs=require('fs');var Redis=require(_0x441c('0x5'));var db=require(_0x441c('0x6'))['db'];var utils=require(_0x441c('0x7'));var logger=require(_0x441c('0x8'))(_0x441c('0x9'));var config=require(_0x441c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x441c('0xb')][_0x441c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1af75f,_0x1746a0,_0x12c79f){return new BPromise(function(_0x4d3a05,_0x115b6f){return client[_0x441c('0xd')](_0x1af75f,_0x12c79f)[_0x441c('0xe')](function(_0x61763a){logger[_0x441c('0xf')](_0x441c('0x10'),_0x1746a0,_0x441c('0x11'));logger[_0x441c('0x12')](_0x441c('0x13'),_0x1746a0,_0x441c('0x11'),JSON[_0x441c('0x14')](_0x61763a));if(_0x61763a[_0x441c('0x15')]){if(_0x61763a[_0x441c('0x15')][_0x441c('0x16')]===0x1f4){logger[_0x441c('0x15')](_0x441c('0x10'),_0x1746a0,_0x61763a[_0x441c('0x15')][_0x441c('0x17')]);return _0x115b6f(_0x61763a[_0x441c('0x15')]['message']);}logger['error'](_0x441c('0x10'),_0x1746a0,_0x61763a['error'][_0x441c('0x17')]);return _0x4d3a05(_0x61763a['error'][_0x441c('0x17')]);}else{logger[_0x441c('0xf')](_0x441c('0x10'),_0x1746a0,_0x441c('0x11'));_0x4d3a05(_0x61763a[_0x441c('0x18')][_0x441c('0x17')]);}})[_0x441c('0x19')](function(_0x54dbd9){logger[_0x441c('0x15')](_0x441c('0x10'),_0x1746a0,_0x54dbd9);_0x115b6f(_0x54dbd9);});});} \ No newline at end of file +var _0x12d3=['request','then','info','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','Disposition,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x12d3,0xbb));var _0x312d=function(_0x5d63c9,_0x4bed60){_0x5d63c9=_0x5d63c9-0x0;var _0x311536=_0x12d3[_0x5d63c9];return _0x311536;};'use strict';var _=require(_0x312d('0x0'));var util=require(_0x312d('0x1'));var moment=require(_0x312d('0x2'));var BPromise=require(_0x312d('0x3'));var rs=require(_0x312d('0x4'));var fs=require('fs');var Redis=require(_0x312d('0x5'));var db=require(_0x312d('0x6'))['db'];var utils=require(_0x312d('0x7'));var logger=require(_0x312d('0x8'))('rpc');var config=require(_0x312d('0x9'));var jayson=require(_0x312d('0xa'));var client=jayson[_0x312d('0xb')][_0x312d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a19d2,_0x3211bf,_0x176d2d){return new BPromise(function(_0x2d3a63,_0xdf2f88){return client[_0x312d('0xd')](_0x3a19d2,_0x176d2d)[_0x312d('0xe')](function(_0x41a5e5){logger[_0x312d('0xf')]('Disposition,\x20%s,\x20%s',_0x3211bf,_0x312d('0x10'));logger[_0x312d('0x11')](_0x312d('0x12'),_0x3211bf,_0x312d('0x10'),JSON[_0x312d('0x13')](_0x41a5e5));if(_0x41a5e5[_0x312d('0x14')]){if(_0x41a5e5[_0x312d('0x14')][_0x312d('0x15')]===0x1f4){logger['error'](_0x312d('0x16'),_0x3211bf,_0x41a5e5[_0x312d('0x14')][_0x312d('0x17')]);return _0xdf2f88(_0x41a5e5[_0x312d('0x14')][_0x312d('0x17')]);}logger['error'](_0x312d('0x16'),_0x3211bf,_0x41a5e5[_0x312d('0x14')]['message']);return _0x2d3a63(_0x41a5e5[_0x312d('0x14')][_0x312d('0x17')]);}else{logger['info'](_0x312d('0x16'),_0x3211bf,_0x312d('0x10'));_0x2d3a63(_0x41a5e5[_0x312d('0x18')]['message']);}})['catch'](function(_0x227e3e){logger[_0x312d('0x14')](_0x312d('0x16'),_0x3211bf,_0x227e3e);_0xdf2f88(_0x227e3e);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 3f10a9d..2b5b114 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 _0xdf5d=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1cbc6c,_0x488147){var _0x24998b=function(_0x1fe822){while(--_0x1fe822){_0x1cbc6c['push'](_0x1cbc6c['shift']());}};_0x24998b(++_0x488147);}(_0xdf5d,0x126));var _0xddf5=function(_0x2df5e0,_0x8e0b0e){_0x2df5e0=_0x2df5e0-0x0;var _0x4694f0=_0xdf5d[_0x2df5e0];return _0x4694f0;};'use strict';var multer=require(_0xddf5('0x0'));var util=require(_0xddf5('0x1'));var path=require(_0xddf5('0x2'));var timeout=require(_0xddf5('0x3'));var express=require(_0xddf5('0x4'));var router=express[_0xddf5('0x5')]();var auth=require(_0xddf5('0x6'));var interaction=require(_0xddf5('0x7'));var config=require('../../config/environment');var controller=require(_0xddf5('0x8'));router[_0xddf5('0x9')]('/',auth[_0xddf5('0xa')](),controller[_0xddf5('0xb')]);router[_0xddf5('0x9')](_0xddf5('0xc'),auth[_0xddf5('0xa')](),controller[_0xddf5('0xd')]);router[_0xddf5('0xe')]('/',auth[_0xddf5('0xa')](),controller[_0xddf5('0xf')]);router[_0xddf5('0x10')](_0xddf5('0xc'),auth[_0xddf5('0xa')](),controller[_0xddf5('0x11')]);router[_0xddf5('0x12')]('/:id',auth[_0xddf5('0xa')](),controller[_0xddf5('0x13')]);module[_0xddf5('0x14')]=router; \ No newline at end of file +var _0xccef=['get','/:id','show','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xccef,0x1d4));var _0xfcce=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xccef[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xfcce('0x0'));var path=require('path');var timeout=require(_0xfcce('0x1'));var express=require(_0xfcce('0x2'));var router=express[_0xfcce('0x3')]();var auth=require(_0xfcce('0x4'));var interaction=require(_0xfcce('0x5'));var config=require(_0xfcce('0x6'));var controller=require('./disposition.controller');router['get']('/',auth[_0xfcce('0x7')](),controller['index']);router[_0xfcce('0x8')](_0xfcce('0x9'),auth[_0xfcce('0x7')](),controller[_0xfcce('0xa')]);router[_0xfcce('0xb')]('/',auth[_0xfcce('0x7')](),controller[_0xfcce('0xc')]);router['put'](_0xfcce('0x9'),auth[_0xfcce('0x7')](),controller[_0xfcce('0xd')]);router[_0xfcce('0xe')](_0xfcce('0x9'),auth[_0xfcce('0x7')](),controller[_0xfcce('0xf')]);module[_0xfcce('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index abba70a..a7623aa 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 _0x3123=['9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','4800','12000','14400','7200'];(function(_0x4179b3,_0x2eaff2){var _0x5b5c7e=function(_0x568341){while(--_0x568341){_0x4179b3['push'](_0x4179b3['shift']());}};_0x5b5c7e(++_0x2eaff2);}(_0x3123,0x16c));var _0x3312=function(_0x5578d6,_0xb7ffe9){_0x5578d6=_0x5578d6-0x0;var _0x42ab6a=_0x3123[_0x5578d6];return _0x42ab6a;};'use strict';var Sequelize=require(_0x3312('0x0'));module[_0x3312('0x1')]={'name':{'type':Sequelize[_0x3312('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3312('0x2')]},'ecm':{'type':Sequelize[_0x3312('0x3')](_0x3312('0x4'),'no'),'defaultValue':_0x3312('0x4')},'headerinfo':{'type':Sequelize[_0x3312('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x3312('0x2')],'unique':_0x3312('0x5')},'minrate':{'type':Sequelize[_0x3312('0x3')](_0x3312('0x6'),_0x3312('0x7'),'7200','9600',_0x3312('0x8'),_0x3312('0x9')),'defaultValue':_0x3312('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x3312('0x6'),_0x3312('0x7'),_0x3312('0xa'),_0x3312('0xb'),'12000','14400'),'defaultValue':_0x3312('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x3312('0xc')},'gateway':{'type':Sequelize[_0x3312('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x3312('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x3312('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x3312('0x3')](_0x3312('0xe'),_0x3312('0xf'),_0x3312('0x10'),_0x3312('0x11')),'defaultValue':_0x3312('0xe')},'key':{'type':Sequelize[_0x3312('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3312('0x12')],'defaultValue':function(){return _0x3312('0x13');}},'notificationSound':{'type':Sequelize[_0x3312('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3312('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3312('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3312('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3312('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3312('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4df2b9){if(!_0x4df2b9)this[_0x3312('0x16')](_0x3312('0x17'),null);this[_0x3312('0x16')](_0x3312('0x18'),_0x4df2b9);}}}; \ No newline at end of file +var _0xdd6f=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','xCALLY\x20Motion\x20Fax','localstationid','ENUM','4800','7200','9600','12000','2400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0xda6d11,_0x2b1545){var _0x58d9c7=function(_0x4c16db){while(--_0x4c16db){_0xda6d11['push'](_0xda6d11['shift']());}};_0x58d9c7(++_0x2b1545);}(_0xdd6f,0x10b));var _0xfdd6=function(_0x2d1e32,_0x161c8a){_0x2d1e32=_0x2d1e32-0x0;var _0x140378=_0xdd6f[_0x2d1e32];return _0x140378;};'use strict';var Sequelize=require('sequelize');module[_0xfdd6('0x0')]={'name':{'type':Sequelize[_0xfdd6('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfdd6('0x1')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xfdd6('0x2')},'localstationid':{'type':Sequelize[_0xfdd6('0x1')],'unique':_0xfdd6('0x3')},'minrate':{'type':Sequelize[_0xfdd6('0x4')]('2400',_0xfdd6('0x5'),_0xfdd6('0x6'),_0xfdd6('0x7'),_0xfdd6('0x8'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xfdd6('0x4')](_0xfdd6('0x9'),_0xfdd6('0x5'),_0xfdd6('0x6'),_0xfdd6('0x7'),'12000','14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xfdd6('0x1')],'defaultValue':_0xfdd6('0xa')},'gateway':{'type':Sequelize[_0xfdd6('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xfdd6('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xfdd6('0x4')](_0xfdd6('0xc'),_0xfdd6('0xd'),_0xfdd6('0xe'),_0xfdd6('0xf')),'defaultValue':_0xfdd6('0xc')},'key':{'type':Sequelize[_0xfdd6('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfdd6('0x10')],'defaultValue':function(){return _0xfdd6('0x11');}},'notificationSound':{'type':Sequelize[_0xfdd6('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfdd6('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfdd6('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfdd6('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfdd6('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfdd6('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfdd6('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0xfdd6('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xfdd6('0x12')],'defaultValue':![],'comment':_0xfdd6('0x14'),'set':function(_0x3acd62){if(!_0x3acd62)this[_0xfdd6('0x15')](_0xfdd6('0x16'),null);this[_0xfdd6('0x15')](_0xfdd6('0x17'),_0x3acd62);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 047020b..79d885e 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 _0xc6b0=['exten','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','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','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','defaults','ListId','List\x20not\x20found','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','out','filename','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./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~!@#$%^&-_=+[{]}.','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','count','offset','status','set','json','apply','reject','then','destroy','get','end','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','filter','options','includeAll','findAll','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','FaxAccountId','getDispositions','findOne','Disposition','nolimit','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications'];(function(_0x5f4a14,_0x3fb334){var _0x56260e=function(_0x583232){while(--_0x583232){_0x5f4a14['push'](_0x5f4a14['shift']());}};_0x56260e(++_0x3fb334);}(_0xc6b0,0x1cd));var _0x0c6b=function(_0x46b1d0,_0x39fff6){_0x46b1d0=_0x46b1d0-0x0;var _0x1b0552=_0xc6b0[_0x46b1d0];return _0x1b0552;};'use strict';var pdf=require(_0x0c6b('0x0'));var emlformat=require(_0x0c6b('0x1'));var rimraf=require(_0x0c6b('0x2'));var zipdir=require(_0x0c6b('0x3'));var jsonpatch=require(_0x0c6b('0x4'));var rp=require(_0x0c6b('0x5'));var moment=require(_0x0c6b('0x6'));var BPromise=require(_0x0c6b('0x7'));var Mustache=require('mustache');var util=require(_0x0c6b('0x8'));var path=require(_0x0c6b('0x9'));var sox=require(_0x0c6b('0xa'));var csv=require(_0x0c6b('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0c6b('0xc'));var squel=require(_0x0c6b('0xd'));var crypto=require(_0x0c6b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0c6b('0xb'));var querystring=require(_0x0c6b('0xf'));var Papa=require(_0x0c6b('0x10'));var Redis=require(_0x0c6b('0x11'));var authService=require(_0x0c6b('0x12'));var qs=require(_0x0c6b('0x13'));var as=require(_0x0c6b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c6b('0x15'))(_0x0c6b('0x16'));var utils=require(_0x0c6b('0x17'));var config=require('../../config/environment');var db=require(_0x0c6b('0x18'))['db'];config[_0x0c6b('0x19')]=_['defaults'](config[_0x0c6b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0c6b('0x1a'))(new Redis(config[_0x0c6b('0x19')]));require(_0x0c6b('0x1b'))[_0x0c6b('0x1c')](socket);var jayson=require(_0x0c6b('0x1d'));var client=jayson[_0x0c6b('0x1e')][_0x0c6b('0x1f')]({'port':0x232c});var client9002=jayson[_0x0c6b('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x33094a,_0x4d699e,_0x2d7714){if(_0x2d7714){var _0x1b5b38=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b5b38[_0x0c6b('0x20')](_0x4d699e)){return _0x33094a;}else{throw new db[(_0x0c6b('0x21'))]['ValidationError'](_0x0c6b('0x22'));}}else{return _0x33094a;}}function respondWithRpcPromise(_0x132788,_0x411d9f,_0x12c607,_0x54eb05){return new BPromise(function(_0x342cf0,_0x5ac679){var _0x1b606b=_0x54eb05||client;return _0x1b606b['request'](_0x132788,_0x12c607)['then'](function(_0x567895){logger[_0x0c6b('0x23')]('FaxAccount,\x20%s,\x20%s',_0x411d9f,_0x0c6b('0x24'));logger['debug'](_0x0c6b('0x25'),_0x411d9f,_0x0c6b('0x24'),JSON[_0x0c6b('0x26')](_0x567895));if(_0x567895[_0x0c6b('0x27')]){if(_0x567895[_0x0c6b('0x27')][_0x0c6b('0x28')]===0x1f4){logger[_0x0c6b('0x27')](_0x0c6b('0x29'),_0x411d9f,_0x567895['error']['message']);return _0x5ac679(_0x567895[_0x0c6b('0x27')][_0x0c6b('0x2a')]);}logger[_0x0c6b('0x27')](_0x0c6b('0x29'),_0x411d9f,_0x567895[_0x0c6b('0x27')][_0x0c6b('0x2a')]);return _0x342cf0(_0x567895['error'][_0x0c6b('0x2a')]);}else{logger[_0x0c6b('0x23')](_0x0c6b('0x29'),_0x411d9f,_0x0c6b('0x24'));_0x342cf0(_0x567895[_0x0c6b('0x2b')][_0x0c6b('0x2a')]);}})[_0x0c6b('0x2c')](function(_0x2d3512){logger['error'](_0x0c6b('0x29'),_0x411d9f,_0x2d3512);_0x5ac679(_0x2d3512);});});}function respondWithStatusCode(_0x52f609,_0xd1ee9d){_0xd1ee9d=_0xd1ee9d||0xcc;return function(_0x4dd0a7){if(_0x4dd0a7){return _0x52f609[_0x0c6b('0x2d')](_0xd1ee9d);}return _0x52f609['status'](_0xd1ee9d)['end']();};}function respondWithResult(_0x193579,_0x366705){_0x366705=_0x366705||0xc8;return function(_0x1c3f8f){if(_0x1c3f8f){return _0x193579['status'](_0x366705)['json'](_0x1c3f8f);}};}function respondWithFilteredResult(_0x12a847,_0x3b523c){return function(_0x4cc308){if(_0x4cc308){var _0x20439=_0x4cc308[_0x0c6b('0x2e')],_0x126fc8=_0x3b523c[_0x0c6b('0x2f')],_0x5105c8=_0x3b523c['offset']+_0x3b523c['limit'],_0x58304e;if(_0x5105c8>=_0x20439){_0x5105c8=_0x20439;_0x58304e=0xc8;}else{_0x58304e=0xce;}_0x12a847[_0x0c6b('0x30')](_0x58304e);return _0x12a847[_0x0c6b('0x31')]('Content-Range',_0x126fc8+'-'+_0x5105c8+'/'+_0x20439)[_0x0c6b('0x32')](_0x4cc308);}return null;};}function patchUpdates(_0x144e51){return function(_0x41a8c6){try{jsonpatch[_0x0c6b('0x33')](_0x41a8c6,_0x144e51,!![]);}catch(_0x1de1c0){return BPromise[_0x0c6b('0x34')](_0x1de1c0);}return _0x41a8c6['save']();};}function saveUpdates(_0x1b55b4,_0x5692fd){return function(_0x30f145){if(_0x30f145){return _0x30f145['update'](_0x1b55b4)[_0x0c6b('0x35')](function(_0xef78f2){return _0xef78f2;});}return null;};}function removeEntity(_0x15db19,_0x26aeae){return function(_0x413236){if(_0x413236){return _0x413236[_0x0c6b('0x36')]()[_0x0c6b('0x35')](function(){var _0x24418d=_0x413236[_0x0c6b('0x37')]({'plain':!![]});var _0x4c4a4d='FaxAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x4c4a4d,'resourceId':_0x24418d['id']}})[_0x0c6b('0x35')](function(){return _0x413236;});})[_0x0c6b('0x35')](function(){_0x15db19[_0x0c6b('0x30')](0xcc)[_0x0c6b('0x38')]();});}};}function handleEntityNotFound(_0x523165,_0x41f89a){return function(_0x398b77){if(!_0x398b77){_0x523165[_0x0c6b('0x2d')](0x194);}return _0x398b77;};}function handleError(_0xee6757,_0x4ddc52){_0x4ddc52=_0x4ddc52||0x1f4;return function(_0x3c7eb5){logger[_0x0c6b('0x27')](_0x3c7eb5[_0x0c6b('0x39')]);if(_0x3c7eb5[_0x0c6b('0x3a')]){delete _0x3c7eb5[_0x0c6b('0x3a')];}_0xee6757['status'](_0x4ddc52)[_0x0c6b('0x3b')](_0x3c7eb5);};}exports['index']=function(_0x3cee37,_0x5898ef){var _0x52ed1a={'include':[{'model':db[_0x0c6b('0x3c')],'as':_0x0c6b('0x3d')}]},_0x30e3d1={},_0x52fa3b={'count':0x0,'rows':[]};var _0x4879ab=_[_0x0c6b('0x3e')](db[_0x0c6b('0x3f')][_0x0c6b('0x40')],function(_0xa1819c){return{'name':_0xa1819c[_0x0c6b('0x41')],'type':_0xa1819c[_0x0c6b('0x42')][_0x0c6b('0x43')]};});_0x30e3d1[_0x0c6b('0x44')]=_[_0x0c6b('0x3e')](_0x4879ab,'name');_0x30e3d1[_0x0c6b('0x45')]=_[_0x0c6b('0x46')](_0x3cee37['query']);_0x30e3d1[_0x0c6b('0x47')]=_[_0x0c6b('0x48')](_0x30e3d1[_0x0c6b('0x44')],_0x30e3d1[_0x0c6b('0x45')]);_0x52ed1a[_0x0c6b('0x49')]=_[_0x0c6b('0x48')](_0x30e3d1[_0x0c6b('0x44')],qs[_0x0c6b('0x4a')](_0x3cee37[_0x0c6b('0x45')]['fields']));_0x52ed1a['attributes']=_0x52ed1a[_0x0c6b('0x49')][_0x0c6b('0x4b')]?_0x52ed1a[_0x0c6b('0x49')]:_0x30e3d1[_0x0c6b('0x44')];if(!_0x3cee37[_0x0c6b('0x45')][_0x0c6b('0x4c')]('nolimit')){_0x52ed1a[_0x0c6b('0x4d')]=qs[_0x0c6b('0x4d')](_0x3cee37[_0x0c6b('0x45')]['limit']);_0x52ed1a[_0x0c6b('0x2f')]=qs['offset'](_0x3cee37[_0x0c6b('0x45')]['offset']);}_0x52ed1a[_0x0c6b('0x4e')]=qs[_0x0c6b('0x4f')](_0x3cee37[_0x0c6b('0x45')][_0x0c6b('0x4f')]);_0x52ed1a[_0x0c6b('0x50')]=qs[_0x0c6b('0x47')](_[_0x0c6b('0x51')](_0x3cee37[_0x0c6b('0x45')],_0x30e3d1[_0x0c6b('0x47')]),_0x4879ab);if(_0x3cee37[_0x0c6b('0x45')]['filter']){_0x52ed1a[_0x0c6b('0x50')]=_[_0x0c6b('0x52')](_0x52ed1a[_0x0c6b('0x50')],{'$or':_[_0x0c6b('0x3e')](_0x4879ab,function(_0x545d89){if(_0x545d89[_0x0c6b('0x42')]!=='VIRTUAL'){var _0x240dd3={};_0x240dd3[_0x545d89[_0x0c6b('0x3a')]]={'$like':'%'+_0x3cee37['query'][_0x0c6b('0x53')]+'%'};return _0x240dd3;}})});}_0x52ed1a=_[_0x0c6b('0x52')]({},_0x52ed1a,_0x3cee37[_0x0c6b('0x54')]);var _0x5e3f7a={'where':_0x52ed1a[_0x0c6b('0x50')]};return db[_0x0c6b('0x3f')][_0x0c6b('0x2e')](_0x5e3f7a)[_0x0c6b('0x35')](function(_0xeea92b){_0x52fa3b[_0x0c6b('0x2e')]=_0xeea92b;if(_0x3cee37['query'][_0x0c6b('0x55')]){_0x52ed1a['include']=[{'all':!![]}];}return db['FaxAccount'][_0x0c6b('0x56')](_0x52ed1a);})['then'](function(_0xbd854b){_0x52fa3b['rows']=_0xbd854b;return _0x52fa3b;})[_0x0c6b('0x35')](respondWithFilteredResult(_0x5898ef,_0x52ed1a))[_0x0c6b('0x2c')](handleError(_0x5898ef,null));};exports['show']=function(_0x272999,_0x49a32b){var _0x1e1db2={'raw':![],'where':{'id':_0x272999[_0x0c6b('0x57')]['id']},'include':[{'model':db[_0x0c6b('0x3c')],'as':_0x0c6b('0x3d')}]},_0xc24ee7={};_0xc24ee7[_0x0c6b('0x44')]=_[_0x0c6b('0x46')](db['FaxAccount'][_0x0c6b('0x40')]);_0xc24ee7[_0x0c6b('0x45')]=_[_0x0c6b('0x46')](_0x272999[_0x0c6b('0x45')]);_0xc24ee7['filters']=_[_0x0c6b('0x48')](_0xc24ee7[_0x0c6b('0x44')],_0xc24ee7['query']);_0x1e1db2['attributes']=_[_0x0c6b('0x48')](_0xc24ee7[_0x0c6b('0x44')],qs[_0x0c6b('0x4a')](_0x272999[_0x0c6b('0x45')][_0x0c6b('0x4a')]));_0x1e1db2[_0x0c6b('0x49')]=_0x1e1db2[_0x0c6b('0x49')][_0x0c6b('0x4b')]?_0x1e1db2[_0x0c6b('0x49')]:_0xc24ee7[_0x0c6b('0x44')];if(_0x272999[_0x0c6b('0x45')][_0x0c6b('0x55')]){_0x1e1db2[_0x0c6b('0x58')]=[{'all':!![]}];}_0x1e1db2=_['merge']({},_0x1e1db2,_0x272999['options']);return db[_0x0c6b('0x3f')]['find'](_0x1e1db2)['then'](handleEntityNotFound(_0x49a32b,null))[_0x0c6b('0x35')](respondWithResult(_0x49a32b,null))[_0x0c6b('0x2c')](handleError(_0x49a32b,null));};exports[_0x0c6b('0x59')]=function(_0x2fd8b2,_0x2626b3){return db[_0x0c6b('0x3f')][_0x0c6b('0x59')](_0x2fd8b2['body'],{})['then'](function(_0x4d29ec){var _0x5b901=_0x2fd8b2[_0x0c6b('0x5a')][_0x0c6b('0x37')]({'plain':!![]});if(!_0x5b901)throw new Error(_0x0c6b('0x5b'));if(_0x5b901[_0x0c6b('0x5c')]===_0x0c6b('0x5a')){var _0x16f56f=_0x4d29ec[_0x0c6b('0x37')]({'plain':!![]});var _0xb549c3=_0x0c6b('0x5d');return db[_0x0c6b('0x5e')][_0x0c6b('0x5f')]({'where':{'name':_0xb549c3,'userProfileId':_0x5b901[_0x0c6b('0x60')]},'raw':!![]})[_0x0c6b('0x35')](function(_0x3a521f){if(_0x3a521f&&_0x3a521f[_0x0c6b('0x61')]===0x0){return db[_0x0c6b('0x62')]['create']({'name':_0x16f56f[_0x0c6b('0x3a')],'resourceId':_0x16f56f['id'],'type':_0x3a521f[_0x0c6b('0x3a')],'sectionId':_0x3a521f['id']},{})[_0x0c6b('0x35')](function(){return _0x4d29ec;});}else{return _0x4d29ec;}})[_0x0c6b('0x2c')](function(_0x1c3ab3){logger[_0x0c6b('0x27')](_0x0c6b('0x63'),_0x1c3ab3);throw _0x1c3ab3;});}return _0x4d29ec;})['then'](respondWithResult(_0x2626b3,0xc9))[_0x0c6b('0x2c')](handleError(_0x2626b3,null));};exports[_0x0c6b('0x64')]=function(_0x57657b,_0x512c08){if(_0x57657b['body']['id']){delete _0x57657b[_0x0c6b('0x65')]['id'];}return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x57657b[_0x0c6b('0x57')]['id']},'include':[{'model':db[_0x0c6b('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x0c6b('0x35')](handleEntityNotFound(_0x512c08,null))[_0x0c6b('0x35')](saveUpdates(_0x57657b['body'],null))[_0x0c6b('0x35')](respondWithResult(_0x512c08,null))[_0x0c6b('0x2c')](handleError(_0x512c08,null));};exports['destroy']=function(_0x93a61b,_0x2faa62){return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x93a61b[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x2faa62,null))[_0x0c6b('0x35')](removeEntity(_0x2faa62,null))['catch'](handleError(_0x2faa62,null));};exports[_0x0c6b('0x66')]=function(_0xd2ac3b,_0x4bb71d){return db['FaxAccount'][_0x0c6b('0x66')]()['then'](respondWithResult(_0x4bb71d,null))[_0x0c6b('0x2c')](handleError(_0x4bb71d,null));};exports['addDisposition']=function(_0x2f6015,_0x420d4a,_0x580b1c){if(_0x2f6015[_0x0c6b('0x65')]['id']){delete _0x2f6015[_0x0c6b('0x65')]['id'];}return db[_0x0c6b('0x3f')]['find']({'where':{'id':_0x2f6015[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x420d4a,null))[_0x0c6b('0x35')](function(_0x36ee56){if(_0x36ee56){_0x2f6015['body'][_0x0c6b('0x67')]=_0x36ee56['id'];return db['Disposition'][_0x0c6b('0x59')](_0x2f6015[_0x0c6b('0x65')]);}})[_0x0c6b('0x35')](respondWithResult(_0x420d4a,null))[_0x0c6b('0x2c')](handleError(_0x420d4a,null));};exports[_0x0c6b('0x68')]=function(_0x251316,_0xcabcb9,_0x24f9b2){var _0x2f7721={'raw':![],'where':{}};var _0x30afa8={};var _0x570328={'count':0x0,'rows':[]};return db[_0x0c6b('0x3f')][_0x0c6b('0x69')]({'where':{'id':_0x251316[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0xcabcb9,null))['then'](function(_0x15a2ef){if(_0x15a2ef){_0x30afa8[_0x0c6b('0x44')]=_[_0x0c6b('0x46')](db[_0x0c6b('0x6a')][_0x0c6b('0x40')]);_0x30afa8['query']=_[_0x0c6b('0x46')](_0x251316[_0x0c6b('0x45')]);_0x30afa8['filters']=_['intersection'](_0x30afa8[_0x0c6b('0x44')],_0x30afa8[_0x0c6b('0x45')]);_0x2f7721['attributes']=_[_0x0c6b('0x48')](_0x30afa8[_0x0c6b('0x44')],qs['fields'](_0x251316[_0x0c6b('0x45')][_0x0c6b('0x4a')]));_0x2f7721[_0x0c6b('0x49')]=_0x2f7721[_0x0c6b('0x49')]['length']?_0x2f7721['attributes']:_0x30afa8[_0x0c6b('0x44')];if(!_0x251316[_0x0c6b('0x45')][_0x0c6b('0x4c')](_0x0c6b('0x6b'))){_0x2f7721[_0x0c6b('0x4d')]=qs['limit'](_0x251316[_0x0c6b('0x45')][_0x0c6b('0x4d')]);_0x2f7721['offset']=qs['offset'](_0x251316[_0x0c6b('0x45')][_0x0c6b('0x2f')]);}_0x2f7721[_0x0c6b('0x4e')]=qs[_0x0c6b('0x4f')](_0x251316[_0x0c6b('0x45')][_0x0c6b('0x4f')]);_0x2f7721[_0x0c6b('0x50')]=qs['filters'](_[_0x0c6b('0x51')](_0x251316['query'],_0x30afa8['filters']));_0x2f7721[_0x0c6b('0x50')][_0x0c6b('0x67')]=_0x15a2ef['id'];if(_0x251316['query'][_0x0c6b('0x53')]){_0x2f7721['where']=_[_0x0c6b('0x52')](_0x2f7721['where'],{'$or':_[_0x0c6b('0x3e')](_0x2f7721[_0x0c6b('0x49')],function(_0x5e3d9f){var _0x526237={};_0x526237[_0x5e3d9f]={'$like':'%'+_0x251316[_0x0c6b('0x45')][_0x0c6b('0x53')]+'%'};return _0x526237;})});}_0x2f7721=_[_0x0c6b('0x52')]({},_0x2f7721,_0x251316['options']);return db[_0x0c6b('0x6a')]['count']({'where':_0x2f7721[_0x0c6b('0x50')]})[_0x0c6b('0x35')](function(_0x405f3f){_0x570328[_0x0c6b('0x2e')]=_0x405f3f;if(_0x251316[_0x0c6b('0x45')]['includeAll']){_0x2f7721[_0x0c6b('0x58')]=[{'all':!![]}];}return db[_0x0c6b('0x6a')]['findAll'](_0x2f7721);})['then'](function(_0xbd854d){_0x570328[_0x0c6b('0x6c')]=_0xbd854d;return _0x570328;});}})[_0x0c6b('0x35')](respondWithFilteredResult(_0xcabcb9,_0x2f7721))[_0x0c6b('0x2c')](handleError(_0xcabcb9,null));};exports[_0x0c6b('0x6d')]=function(_0x1b7d08,_0x5c31b8,_0x5dd332){return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x1b7d08['params']['id']}})['then'](handleEntityNotFound(_0x5c31b8,null))[_0x0c6b('0x35')](function(_0x2cbc7e){if(_0x2cbc7e){return _0x2cbc7e[_0x0c6b('0x6d')](_0x1b7d08[_0x0c6b('0x45')][_0x0c6b('0x6e')]);}})['then'](respondWithStatusCode(_0x5c31b8,null))[_0x0c6b('0x2c')](handleError(_0x5c31b8,null));};exports[_0x0c6b('0x6f')]=function(_0x1dd0ed,_0x3135bb,_0x578d27){if(_0x1dd0ed[_0x0c6b('0x65')]['id']){delete _0x1dd0ed[_0x0c6b('0x65')]['id'];}return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x1dd0ed[_0x0c6b('0x57')]['id']}})['then'](handleEntityNotFound(_0x3135bb,null))['then'](function(_0x44946c){if(_0x44946c){_0x1dd0ed['body'][_0x0c6b('0x67')]=_0x44946c['id'];return db[_0x0c6b('0x70')][_0x0c6b('0x59')](_0x1dd0ed['body']);}})['then'](respondWithResult(_0x3135bb,null))[_0x0c6b('0x2c')](handleError(_0x3135bb,null));};exports[_0x0c6b('0x71')]=function(_0x534f26,_0x5e8b28,_0x5de4ad){var _0x29b2c5={'raw':![],'where':{}};var _0x4d3c42={};var _0x2f612d={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x534f26['params']['id']}})['then'](handleEntityNotFound(_0x5e8b28,null))[_0x0c6b('0x35')](function(_0x52c313){if(_0x52c313){_0x4d3c42[_0x0c6b('0x44')]=_['keys'](db[_0x0c6b('0x70')][_0x0c6b('0x40')]);_0x4d3c42[_0x0c6b('0x45')]=_[_0x0c6b('0x46')](_0x534f26[_0x0c6b('0x45')]);_0x4d3c42[_0x0c6b('0x47')]=_[_0x0c6b('0x48')](_0x4d3c42[_0x0c6b('0x44')],_0x4d3c42[_0x0c6b('0x45')]);_0x29b2c5['attributes']=_[_0x0c6b('0x48')](_0x4d3c42[_0x0c6b('0x44')],qs[_0x0c6b('0x4a')](_0x534f26['query']['fields']));_0x29b2c5[_0x0c6b('0x49')]=_0x29b2c5[_0x0c6b('0x49')]['length']?_0x29b2c5['attributes']:_0x4d3c42[_0x0c6b('0x44')];if(!_0x534f26[_0x0c6b('0x45')][_0x0c6b('0x4c')](_0x0c6b('0x6b'))){_0x29b2c5[_0x0c6b('0x4d')]=qs[_0x0c6b('0x4d')](_0x534f26[_0x0c6b('0x45')][_0x0c6b('0x4d')]);_0x29b2c5['offset']=qs['offset'](_0x534f26[_0x0c6b('0x45')]['offset']);}_0x29b2c5[_0x0c6b('0x4e')]=qs[_0x0c6b('0x4f')](_0x534f26[_0x0c6b('0x45')]['sort']);_0x29b2c5[_0x0c6b('0x50')]=qs[_0x0c6b('0x47')](_[_0x0c6b('0x51')](_0x534f26[_0x0c6b('0x45')],_0x4d3c42[_0x0c6b('0x47')]));_0x29b2c5[_0x0c6b('0x50')][_0x0c6b('0x67')]=_0x52c313['id'];if(_0x534f26[_0x0c6b('0x45')]['filter']){_0x29b2c5[_0x0c6b('0x50')]=_[_0x0c6b('0x52')](_0x29b2c5[_0x0c6b('0x50')],{'$or':_[_0x0c6b('0x3e')](_0x29b2c5['attributes'],function(_0x2e4496){var _0x179f8a={};_0x179f8a[_0x2e4496]={'$like':'%'+_0x534f26[_0x0c6b('0x45')][_0x0c6b('0x53')]+'%'};return _0x179f8a;})});}_0x29b2c5=_['merge']({},_0x29b2c5,_0x534f26[_0x0c6b('0x54')]);return db['CannedAnswer'][_0x0c6b('0x2e')]({'where':_0x29b2c5[_0x0c6b('0x50')]})['then'](function(_0x169144){_0x2f612d[_0x0c6b('0x2e')]=_0x169144;if(_0x534f26['query'][_0x0c6b('0x55')]){_0x29b2c5[_0x0c6b('0x58')]=[{'all':!![]}];}return db[_0x0c6b('0x70')][_0x0c6b('0x56')](_0x29b2c5);})[_0x0c6b('0x35')](function(_0x401938){_0x2f612d['rows']=_0x401938;return _0x2f612d;});}})[_0x0c6b('0x35')](respondWithFilteredResult(_0x5e8b28,_0x29b2c5))[_0x0c6b('0x2c')](handleError(_0x5e8b28,null));};exports[_0x0c6b('0x72')]=function(_0x50ebc0,_0x42f3b5,_0x4e8cdd){return db['FaxAccount'][_0x0c6b('0x5f')]({'where':{'id':_0x50ebc0[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x42f3b5,null))['then'](function(_0x3a6ffc){if(_0x3a6ffc){return _0x3a6ffc[_0x0c6b('0x72')](_0x50ebc0['query']['ids']);}})['then'](respondWithStatusCode(_0x42f3b5,null))[_0x0c6b('0x2c')](handleError(_0x42f3b5,null));};exports[_0x0c6b('0x73')]=function(_0x28bd18,_0x27cffd,_0x65f495){return db[_0x0c6b('0x74')]['find']({'where':{'id':_0x28bd18['params']['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x27cffd,null))[_0x0c6b('0x35')](function(_0x34c8df){if(_0x34c8df){return _0x34c8df[_0x0c6b('0x73')](_0x28bd18[_0x0c6b('0x65')][_0x0c6b('0x6e')],_['omit'](_0x28bd18[_0x0c6b('0x65')],['ids','id'])||{});}})[_0x0c6b('0x35')](respondWithResult(_0x27cffd,null))[_0x0c6b('0x2c')](handleError(_0x27cffd,null));};exports[_0x0c6b('0x75')]=function(_0x18052b,_0x20589e,_0x1efc90){var _0x523720={'raw':![],'where':{}};var _0x8b36da={};var _0x4f31b7={'count':0x0,'rows':[]};return db[_0x0c6b('0x3f')][_0x0c6b('0x69')]({'where':{'id':_0x18052b['params']['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x20589e,null))[_0x0c6b('0x35')](function(_0xdba1b8){if(_0xdba1b8){_0x8b36da[_0x0c6b('0x44')]=_[_0x0c6b('0x46')](db['FaxInteraction'][_0x0c6b('0x40')]);_0x8b36da[_0x0c6b('0x45')]=_[_0x0c6b('0x46')](_0x18052b[_0x0c6b('0x45')]);_0x8b36da[_0x0c6b('0x47')]=_[_0x0c6b('0x48')](_0x8b36da[_0x0c6b('0x44')],_0x8b36da[_0x0c6b('0x45')]);_0x523720[_0x0c6b('0x49')]=_[_0x0c6b('0x48')](_0x8b36da['model'],qs[_0x0c6b('0x4a')](_0x18052b[_0x0c6b('0x45')][_0x0c6b('0x4a')]));_0x523720[_0x0c6b('0x49')]=_0x523720[_0x0c6b('0x49')][_0x0c6b('0x4b')]?_0x523720[_0x0c6b('0x49')]:_0x8b36da['model'];if(!_0x18052b[_0x0c6b('0x45')][_0x0c6b('0x4c')](_0x0c6b('0x6b'))){_0x523720['limit']=qs[_0x0c6b('0x4d')](_0x18052b['query'][_0x0c6b('0x4d')]);_0x523720[_0x0c6b('0x2f')]=qs[_0x0c6b('0x2f')](_0x18052b[_0x0c6b('0x45')][_0x0c6b('0x2f')]);}_0x523720[_0x0c6b('0x4e')]=qs[_0x0c6b('0x4f')](_0x18052b[_0x0c6b('0x45')][_0x0c6b('0x4f')]);_0x523720[_0x0c6b('0x50')]=qs[_0x0c6b('0x47')](_[_0x0c6b('0x51')](_0x18052b[_0x0c6b('0x45')],_0x8b36da[_0x0c6b('0x47')]));_0x523720[_0x0c6b('0x50')][_0x0c6b('0x67')]=_0xdba1b8['id'];if(_0x18052b[_0x0c6b('0x45')][_0x0c6b('0x53')]){_0x523720[_0x0c6b('0x50')]=_[_0x0c6b('0x52')](_0x523720[_0x0c6b('0x50')],{'$or':_[_0x0c6b('0x3e')](_0x523720[_0x0c6b('0x49')],function(_0x4ef406){var _0x560d9e={};_0x560d9e[_0x4ef406]={'$like':'%'+_0x18052b[_0x0c6b('0x45')]['filter']+'%'};return _0x560d9e;})});}_0x523720=_[_0x0c6b('0x52')]({},_0x523720,_0x18052b['options']);return db[_0x0c6b('0x74')][_0x0c6b('0x2e')]({'where':_0x523720['where']})[_0x0c6b('0x35')](function(_0x54a121){_0x4f31b7['count']=_0x54a121;if(_0x18052b[_0x0c6b('0x45')]['includeAll']){_0x523720[_0x0c6b('0x58')]=[{'model':db[_0x0c6b('0x76')],'as':_0x0c6b('0x77'),'required':![]},{'model':db[_0x0c6b('0x78')],'as':_0x0c6b('0x79'),'attributes':[_0x0c6b('0x3a'),_0x0c6b('0x7a'),_0x0c6b('0x7b')],'required':![]},{'model':db[_0x0c6b('0x7c')],'as':_0x0c6b('0x7d'),'attributes':['id',_0x0c6b('0x3a'),_0x0c6b('0x7e')],'where':_0x18052b[_0x0c6b('0x45')][_0x0c6b('0x7f')]?{'id':_0x18052b['query'][_0x0c6b('0x7f')]}:undefined,'required':_0x18052b[_0x0c6b('0x45')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x0c6b('0x56')](_0x523720);})['then'](function(_0x4a2a18){_0x4f31b7[_0x0c6b('0x6c')]=_0x4a2a18;return _0x4f31b7;});}})[_0x0c6b('0x35')](respondWithFilteredResult(_0x20589e,_0x523720))[_0x0c6b('0x2c')](handleError(_0x20589e,null));};exports[_0x0c6b('0x80')]=function(_0xae1593,_0x54a789,_0x35265c){return db[_0x0c6b('0x3f')][_0x0c6b('0x69')]({'where':{'id':_0xae1593[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x54a789,null))[_0x0c6b('0x35')](function(_0x4422c9){if(_0x4422c9){return db[_0x0c6b('0x81')][_0x0c6b('0x82')](function(_0x516b22){return db[_0x0c6b('0x83')][_0x0c6b('0x36')]({'where':{'FaxAccountId':_0xae1593[_0x0c6b('0x57')]['id']},'transaction':_0x516b22})[_0x0c6b('0x35')](function(_0x18b60c){var _0x337030=_[_0x0c6b('0x3e')](_0xae1593[_0x0c6b('0x65')],function(_0x4791c1){_0x4791c1[_0x0c6b('0x67')]=_0xae1593[_0x0c6b('0x57')]['id'];return _0x4791c1;});return db['FaxApplication'][_0x0c6b('0x84')](_0x337030,{'transaction':_0x516b22});});})[_0x0c6b('0x35')](function(){return db['FaxApplication'][_0x0c6b('0x85')]({'where':{'FaxAccountId':_0xae1593[_0x0c6b('0x57')]['id']},'order':_0x0c6b('0x86')});});}})['then'](respondWithResult(_0x54a789,null))[_0x0c6b('0x2c')](handleError(_0x54a789,null));};exports[_0x0c6b('0x87')]=function(_0x1bf2bf,_0x16378e,_0x9016c9){var _0x23e35e={};var _0x2b4a5c={};var _0x2cb46d;var _0x30d203;return db['FaxAccount'][_0x0c6b('0x69')]({'where':{'id':_0x1bf2bf[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x16378e,null))['then'](function(_0x57b36b){if(_0x57b36b){_0x2cb46d=_0x57b36b;_0x2b4a5c[_0x0c6b('0x44')]=_[_0x0c6b('0x46')](db['FaxApplication']['rawAttributes']);_0x2b4a5c['query']=_[_0x0c6b('0x46')](_0x1bf2bf[_0x0c6b('0x45')]);_0x2b4a5c[_0x0c6b('0x47')]=_[_0x0c6b('0x48')](_0x2b4a5c[_0x0c6b('0x44')],_0x2b4a5c[_0x0c6b('0x45')]);_0x23e35e[_0x0c6b('0x49')]=_[_0x0c6b('0x48')](_0x2b4a5c['model'],qs[_0x0c6b('0x4a')](_0x1bf2bf[_0x0c6b('0x45')][_0x0c6b('0x4a')]));_0x23e35e[_0x0c6b('0x49')]=_0x23e35e[_0x0c6b('0x49')][_0x0c6b('0x4b')]?_0x23e35e['attributes']:_0x2b4a5c[_0x0c6b('0x44')];_0x23e35e[_0x0c6b('0x4e')]=qs['sort'](_0x1bf2bf[_0x0c6b('0x45')][_0x0c6b('0x4f')]);_0x23e35e[_0x0c6b('0x50')]=qs[_0x0c6b('0x47')](_[_0x0c6b('0x51')](_0x1bf2bf[_0x0c6b('0x45')],_0x2b4a5c[_0x0c6b('0x47')]));if(_0x1bf2bf[_0x0c6b('0x45')][_0x0c6b('0x53')]){_0x23e35e[_0x0c6b('0x50')]=_[_0x0c6b('0x52')](_0x23e35e[_0x0c6b('0x50')],{'$or':_[_0x0c6b('0x3e')](_0x23e35e[_0x0c6b('0x49')],function(_0x3a6658){var _0x289e6a={};_0x289e6a[_0x3a6658]={'$like':'%'+_0x1bf2bf[_0x0c6b('0x45')][_0x0c6b('0x53')]+'%'};return _0x289e6a;})});}_0x23e35e=_[_0x0c6b('0x52')]({},_0x23e35e,_0x1bf2bf['options']);return _0x2cb46d[_0x0c6b('0x87')](_0x23e35e);}})[_0x0c6b('0x35')](function(_0x395a2c){if(_0x395a2c){_0x30d203=_0x395a2c[_0x0c6b('0x4b')];if(!_0x1bf2bf[_0x0c6b('0x45')][_0x0c6b('0x4c')]('nolimit')){_0x23e35e[_0x0c6b('0x4d')]=qs[_0x0c6b('0x4d')](_0x1bf2bf[_0x0c6b('0x45')]['limit']);_0x23e35e[_0x0c6b('0x2f')]=qs[_0x0c6b('0x2f')](_0x1bf2bf['query'][_0x0c6b('0x2f')]);}return _0x2cb46d[_0x0c6b('0x87')](_0x23e35e);}})[_0x0c6b('0x35')](function(_0x318fdb){if(_0x318fdb){return _0x318fdb?{'count':_0x30d203,'rows':_0x318fdb}:null;}})[_0x0c6b('0x35')](respondWithResult(_0x16378e,null))[_0x0c6b('0x2c')](handleError(_0x16378e,null));};function Extension(_0x3f779d,_0x18d420,_0x149ece,_0x27316a){this['context']='from-voip-provider';this[_0x0c6b('0x88')]=_0x3f779d[_0x0c6b('0x89')];this['app']=_0x27316a;this[_0x0c6b('0x42')]=_0x0c6b('0x8a');this[_0x0c6b('0x8b')]=_0x0c6b('0x8c');this[_0x0c6b('0x67')]=_0x3f779d['id'];this[_0x0c6b('0x86')]=_0x18d420;this[_0x0c6b('0x8d')]=_0x149ece;}function createExtensionsReciveFax(_0xfae9e3){var _0x3fb054=0x1;var _0x4247b0=[];_0x4247b0[_0x0c6b('0x8e')](new Extension(_0xfae9e3,_0x3fb054,'',_0x0c6b('0x8f')));_0x3fb054+=0x1;_0x4247b0[_0x0c6b('0x8e')](new Extension(_0xfae9e3,_0x3fb054,_0x0c6b('0x90'),'Set'));_0x3fb054+=0x1;for(var _0x34ea9d in _0xfae9e3){if(_0xfae9e3['hasOwnProperty'](_0x34ea9d)&&(_0x34ea9d===_0x0c6b('0x91')||_0x34ea9d===_0x0c6b('0x89')||_0x34ea9d===_0x0c6b('0x92')||_0x34ea9d===_0x0c6b('0x93')||_0x34ea9d===_0x0c6b('0x94')||_0x34ea9d===_0x0c6b('0x95')||_0x34ea9d===_0x0c6b('0x96')||_0x34ea9d===_0x0c6b('0x97')||_0x34ea9d===_0x0c6b('0x98'))){_0x4247b0[_0x0c6b('0x8e')](new Extension(_0xfae9e3,_0x3fb054,_0x0c6b('0x99')+_0x34ea9d+')='+_0xfae9e3[_0x34ea9d],_0x0c6b('0x9a')));_0x3fb054+=0x1;}}_0x4247b0['push'](new Extension(_0xfae9e3,_0x3fb054,'6',_0x0c6b('0x9b')));_0x3fb054+=0x1;_0x4247b0[_0x0c6b('0x8e')](new Extension(_0xfae9e3,_0x3fb054,_0x0c6b('0x9c'),'ReceiveFax'));_0x3fb054=0x0;return _0x4247b0;}exports['addAccountApplications']=function(_0xe98119,_0x265f79,_0x28f714){var _0x1920fa;return db['sequelize'][_0x0c6b('0x82')](function(_0x4cd995){return db[_0x0c6b('0x3f')]['create'](_0xe98119['body'],{'transaction':_0x4cd995})[_0x0c6b('0x35')](function(_0x21b6ac){_0x1920fa=_0x21b6ac[_0x0c6b('0x37')]({'plain':!![]});return db[_0x0c6b('0x9d')][_0x0c6b('0x84')](createExtensionsReciveFax(_0x1920fa),{'transaction':_0x4cd995});});})[_0x0c6b('0x35')](function(){return _0x1920fa;})['then'](respondWithResult(_0x265f79,null))[_0x0c6b('0x2c')](handleError(_0x265f79,null));};exports[_0x0c6b('0x9e')]=function(_0x42b6c6,_0x595023,_0x48e4ba){var _0x3090ce;return db['sequelize'][_0x0c6b('0x82')](function(_0x3b71f2){return db[_0x0c6b('0x3f')][_0x0c6b('0x64')](_0x42b6c6[_0x0c6b('0x65')],{'where':{'id':_0x42b6c6[_0x0c6b('0x65')]['id']},'transaction':_0x3b71f2})[_0x0c6b('0x35')](function(_0x52f985){return db[_0x0c6b('0x9d')]['destroy']({'where':{'FaxAccountId':_0x42b6c6['body']['id']},'transaction':_0x3b71f2})[_0x0c6b('0x35')](function(_0x1519ac){return db[_0x0c6b('0x9d')][_0x0c6b('0x84')](createExtensionsReciveFax(_[_0x0c6b('0x9f')](_0x42b6c6[_0x0c6b('0x65')],[_0x0c6b('0xa0'),_0x0c6b('0x43'),_0x0c6b('0xa1'),_0x0c6b('0xa2'),_0x0c6b('0xa3'),'ListId'])),{'transaction':_0x3b71f2});});});})[_0x0c6b('0x35')](function(){return db[_0x0c6b('0x3f')]['findById'](_0x42b6c6[_0x0c6b('0x65')]['id']);})['then'](respondWithResult(_0x595023,null))[_0x0c6b('0x2c')](handleError(_0x595023,null));};exports[_0x0c6b('0xa4')]=function(_0x203941,_0x33cd67,_0x4a4e1b){var _0x16ab4d={'raw':!![],'where':{}};var _0x4483ce={};var _0x2c93db={'count':0x0,'rows':[]};return db[_0x0c6b('0x3f')][_0x0c6b('0x69')]({'where':{'id':_0x203941[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x33cd67,null))[_0x0c6b('0x35')](function(_0x987570){if(_0x987570){_0x4483ce[_0x0c6b('0x44')]=_[_0x0c6b('0x46')](db['FaxMessage']['rawAttributes']);_0x4483ce['query']=_[_0x0c6b('0x46')](_0x203941[_0x0c6b('0x45')]);_0x4483ce[_0x0c6b('0x47')]=_['intersection'](_0x4483ce[_0x0c6b('0x44')],_0x4483ce[_0x0c6b('0x45')]);_0x16ab4d[_0x0c6b('0x49')]=_[_0x0c6b('0x48')](_0x4483ce[_0x0c6b('0x44')],qs[_0x0c6b('0x4a')](_0x203941[_0x0c6b('0x45')][_0x0c6b('0x4a')]));_0x16ab4d['attributes']=_0x16ab4d['attributes'][_0x0c6b('0x4b')]?_0x16ab4d['attributes']:_0x4483ce[_0x0c6b('0x44')];if(!_0x203941[_0x0c6b('0x45')][_0x0c6b('0x4c')]('nolimit')){_0x16ab4d[_0x0c6b('0x4d')]=qs[_0x0c6b('0x4d')](_0x203941['query']['limit']);_0x16ab4d['offset']=qs[_0x0c6b('0x2f')](_0x203941[_0x0c6b('0x45')][_0x0c6b('0x2f')]);}_0x16ab4d[_0x0c6b('0x4e')]=qs[_0x0c6b('0x4f')](_0x203941[_0x0c6b('0x45')][_0x0c6b('0x4f')]);_0x16ab4d['where']=qs['filters'](_['pick'](_0x203941[_0x0c6b('0x45')],_0x4483ce[_0x0c6b('0x47')]));_0x16ab4d[_0x0c6b('0x50')][_0x0c6b('0x67')]=_0x987570['id'];if(_0x203941[_0x0c6b('0x45')][_0x0c6b('0x53')]){_0x16ab4d['where']=_['merge'](_0x16ab4d[_0x0c6b('0x50')],{'$or':_[_0x0c6b('0x3e')](_0x16ab4d[_0x0c6b('0x49')],function(_0x5d5f78){var _0x56ba93={};_0x56ba93[_0x5d5f78]={'$like':'%'+_0x203941['query'][_0x0c6b('0x53')]+'%'};return _0x56ba93;})});}if(_0x203941[_0x0c6b('0x45')][_0x0c6b('0xa5')]){var _0x73abe=_0x203941['query']['$gte'][_0x0c6b('0xa6')](',');var _0x1158b4={};_0x1158b4[_0x73abe[0x0]]={'$gte':moment(_0x73abe[0x1])['format'](_0x0c6b('0xa7'))};_0x16ab4d['where']=_['merge'](_0x16ab4d[_0x0c6b('0x50')],_0x1158b4);}_0x16ab4d=_['merge']({},_0x16ab4d,_0x203941['options']);return db['FaxMessage'][_0x0c6b('0x2e')]({'where':_0x16ab4d[_0x0c6b('0x50')]})[_0x0c6b('0x35')](function(_0xb6e660){_0x2c93db['count']=_0xb6e660;if(_0x203941[_0x0c6b('0x45')][_0x0c6b('0x55')]){_0x16ab4d['include']=[{'all':!![]}];}return db[_0x0c6b('0xa8')][_0x0c6b('0x56')](_0x16ab4d);})[_0x0c6b('0x35')](function(_0x53121a){_0x2c93db['rows']=_0x53121a;return _0x2c93db;});}})[_0x0c6b('0x35')](respondWithFilteredResult(_0x33cd67,_0x16ab4d))['catch'](handleError(_0x33cd67,null));};exports['send']=function(_0x35ff5a,_0x448810,_0x8ad955){var _0x5c15b8,_0x577453={},_0x50946c;if(_0x35ff5a[_0x0c6b('0x65')]['to']){_0x50946c=_0x35ff5a[_0x0c6b('0x65')]['to'][0x0];}return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x35ff5a[_0x0c6b('0x57')]['id']},'include':[{'model':db[_0x0c6b('0xa9')],'as':_0x0c6b('0xaa'),'include':[{'model':db['CmContact'],'as':_0x0c6b('0xab'),'where':{'fax':_0x50946c},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x0c6b('0x35')](handleEntityNotFound(_0x448810,null))[_0x0c6b('0x35')](function(_0x4e9150){_0x5c15b8=_0x4e9150;if(_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')]&&_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')][_0x0c6b('0x4b')]){for(var _0x4002e7=0x0;_0x4002e7<_0x35ff5a['body'][_0x0c6b('0xac')][_0x0c6b('0x4b')];_0x4002e7+=0x1){_0x35ff5a['body'][_0x0c6b('0xac')][_0x4002e7]={'filename':_0x35ff5a['body'][_0x0c6b('0xac')][_0x4002e7]['name'],'id':_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')][_0x4002e7]['id'],'path':path[_0x0c6b('0xad')](config[_0x0c6b('0xae')],_0x0c6b('0xaf'),_0x35ff5a['body'][_0x0c6b('0xac')][_0x4002e7][_0x0c6b('0xb0')])};}}return respondWithRpcPromise(_0x0c6b('0xb1'),_0x0c6b('0xb1'),{'FaxAccountId':_[_0x0c6b('0xb2')](_0x35ff5a[_0x0c6b('0x57')]['id'])?undefined:_0x35ff5a[_0x0c6b('0x57')]['id'],'path':_[_0x0c6b('0xb2')](_0x35ff5a['body']['attachments'][0x0][_0x0c6b('0x9')])?undefined:_0x35ff5a[_0x0c6b('0x65')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x35ff5a[_0x0c6b('0x65')]['to'][0x0])?undefined:_0x35ff5a[_0x0c6b('0x65')]['to'][0x0]},client9002);})[_0x0c6b('0x35')](function(){if(_0x5c15b8){if(_['isNil'](_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xb3')])){_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xb3')]=util['format'](_0x0c6b('0xb4'),_0x5c15b8[_0x0c6b('0x3a')],_0x5c15b8['fax']);}if(_0x5c15b8[_0x0c6b('0xaa')]){if(_0x5c15b8[_0x0c6b('0xaa')]['Contacts'][_0x0c6b('0x4b')]){return _0x5c15b8[_0x0c6b('0xaa')][_0x0c6b('0xab')][0x0];}else{return db[_0x0c6b('0x76')][_0x0c6b('0x59')](_[_0x0c6b('0xb5')](_0x35ff5a[_0x0c6b('0x65')],{'firstName':_0x35ff5a[_0x0c6b('0x65')]['to'][0x0],'phone':_0x35ff5a[_0x0c6b('0x65')]['to'][0x0],'fax':_0x35ff5a[_0x0c6b('0x65')]['to'][0x0],'ListId':_0x5c15b8[_0x0c6b('0xb6')]}));}}else{throw new Error(_0x0c6b('0xb7'));}}else{throw new Error(_0x0c6b('0xb8'));}})[_0x0c6b('0x35')](function(_0x227887){if(_0x227887){return db[_0x0c6b('0x74')]['find']({'where':{'ContactId':_0x227887['id'],'closed':![],'FaxAccountId':_0x5c15b8['id']}})['then'](function(_0x3c924b){if(_0x3c924b){return[_0x3c924b,![]];}return db[_0x0c6b('0x74')]['create']({'UserId':_0x35ff5a[_0x0c6b('0x5a')]['id'],'ContactId':_0x227887['id'],'FaxAccountId':_0x5c15b8['id'],'fax':_0x35ff5a[_0x0c6b('0x65')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x0c6b('0x52')](_0x35ff5a[_0x0c6b('0x65')],{'read':![],'body':_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')][0x0]['filename'],'FaxAccountId':_0x5c15b8['id'],'UserId':_0x35ff5a[_0x0c6b('0x5a')]['id'],'ContactId':_0x227887['id'],'AttachmentId':_0x35ff5a['body'][_0x0c6b('0xac')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x0c6b('0xb9')}]})[_0x0c6b('0x35')](function(_0x47b5a9){return[_0x47b5a9,!![]];});});}else{throw new Error(_0x0c6b('0xba'));}})[_0x0c6b('0xbb')](function(_0x1cf6bb,_0x3de5f7){if(_0x3de5f7){return _0x1cf6bb;}return db[_0x0c6b('0xa8')][_0x0c6b('0x59')]({'direction':_0x0c6b('0xbc'),'read':![],'body':_0x35ff5a[_0x0c6b('0x65')]['attachments'][0x0][_0x0c6b('0xbd')],'FaxAccountId':_0x5c15b8['id'],'FaxInteractionId':_0x1cf6bb['id'],'UserId':_0x35ff5a[_0x0c6b('0x5a')]['id'],'ContactId':_0x1cf6bb[_0x0c6b('0xbe')],'AttachmentId':_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')][0x0]['id']})[_0x0c6b('0x35')](function(_0x4ef759){_0x1cf6bb[_0x0c6b('0xbf')][_0x0c6b('0xb9')]=[];_0x1cf6bb[_0x0c6b('0xbf')]['Messages'][_0x0c6b('0x8e')](_0x4ef759[_0x0c6b('0xbf')]);return _0x1cf6bb;});})[_0x0c6b('0x35')](function(_0x1f08bb){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x0c6b('0xb2')](_0x35ff5a[_0x0c6b('0x57')]['id'])?undefined:_0x35ff5a['params']['id'],'path':_[_0x0c6b('0xb2')](_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')][0x0][_0x0c6b('0x9')])?undefined:_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')][0x0][_0x0c6b('0x9')],'fax':_[_0x0c6b('0xb2')](_0x35ff5a['body']['to'][0x0])?undefined:_0x35ff5a['body']['to'][0x0],'AttachmentId':_0x35ff5a[_0x0c6b('0x65')]['attachments'][0x0]['id']},client9002)[_0x0c6b('0x35')](function(_0x9c322c){logger[_0x0c6b('0x23')](_0x0c6b('0xc0'),_0x9c322c);})['catch'](function(_0x55f3bb){logger[_0x0c6b('0x23')]('SendFaxRpc,\x20%s',_0x55f3bb);});return _0x1f08bb;})[_0x0c6b('0x35')](respondWithResult(_0x448810,null))[_0x0c6b('0x2c')](handleError(_0x448810,null));};exports['addAgents']=function(_0x1c06d4,_0x2bf552,_0x11b835){return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x1c06d4[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x2bf552,null))['then'](function(_0x4aa6f8){if(_0x4aa6f8){return _0x4aa6f8[_0x0c6b('0xc1')](_0x1c06d4[_0x0c6b('0x65')][_0x0c6b('0x6e')],_['omit'](_0x1c06d4[_0x0c6b('0x65')],[_0x0c6b('0x6e'),'id'])||{})['spread'](function(_0x52e224){for(var _0x401e1b=0x0;_0x401e1b<_0x1c06d4[_0x0c6b('0x65')][_0x0c6b('0x6e')][_0x0c6b('0x4b')];_0x401e1b+=0x1){socket[_0x0c6b('0xc2')](_0x0c6b('0xc3'),{'UserId':_0x1c06d4[_0x0c6b('0x65')][_0x0c6b('0x6e')][_0x401e1b],'FaxAccountId':_0x1c06d4[_0x0c6b('0x57')]['id']});}return _0x52e224;});}})[_0x0c6b('0x35')](respondWithResult(_0x2bf552,null))[_0x0c6b('0x2c')](handleError(_0x2bf552,null));};exports[_0x0c6b('0xc4')]=function(_0x589317,_0x106097,_0x350443){return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x589317[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x106097,null))[_0x0c6b('0x35')](function(_0x274215){if(_0x274215){return _0x274215[_0x0c6b('0xc4')](_0x589317[_0x0c6b('0x45')]['ids'])['then'](function(){if(_['isArray'](_0x589317[_0x0c6b('0x45')][_0x0c6b('0x6e')])){for(var _0x1138d2=0x0;_0x1138d2<_0x589317['query'][_0x0c6b('0x6e')]['length'];_0x1138d2+=0x1){socket[_0x0c6b('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x589317[_0x0c6b('0x45')][_0x0c6b('0x6e')][_0x1138d2]),'FaxAccountId':Number(_0x589317[_0x0c6b('0x57')]['id'])});}}else{socket[_0x0c6b('0xc2')](_0x0c6b('0xc5'),{'UserId':Number(_0x589317[_0x0c6b('0x45')][_0x0c6b('0x6e')]),'FaxAccountId':Number(_0x589317['params']['id'])});}});}})[_0x0c6b('0x35')](respondWithStatusCode(_0x106097,null))[_0x0c6b('0x2c')](handleError(_0x106097,null));};exports[_0x0c6b('0xc6')]=function(_0x3c6a76,_0x4e2bf1,_0x41fbe6){var _0x119ad2={};var _0x3fb1f6={};var _0x5026be;var _0x543075;return db[_0x0c6b('0x3f')][_0x0c6b('0x69')]({'where':{'id':_0x3c6a76[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x4e2bf1,null))[_0x0c6b('0x35')](function(_0x270c66){if(_0x270c66){_0x5026be=_0x270c66;_0x3fb1f6[_0x0c6b('0x44')]=_[_0x0c6b('0x46')](db['User']['rawAttributes']);_0x3fb1f6[_0x0c6b('0x45')]=_[_0x0c6b('0x46')](_0x3c6a76['query']);_0x3fb1f6[_0x0c6b('0x47')]=_[_0x0c6b('0x48')](_0x3fb1f6[_0x0c6b('0x44')],_0x3fb1f6[_0x0c6b('0x45')]);_0x119ad2['attributes']=_[_0x0c6b('0x48')](_0x3fb1f6[_0x0c6b('0x44')],qs['fields'](_0x3c6a76[_0x0c6b('0x45')][_0x0c6b('0x4a')]));_0x119ad2[_0x0c6b('0x49')]=_0x119ad2[_0x0c6b('0x49')]['length']?_0x119ad2[_0x0c6b('0x49')]:_0x3fb1f6[_0x0c6b('0x44')];_0x119ad2[_0x0c6b('0x4e')]=qs[_0x0c6b('0x4f')](_0x3c6a76[_0x0c6b('0x45')][_0x0c6b('0x4f')]);_0x119ad2[_0x0c6b('0x50')]=qs['filters'](_['pick'](_0x3c6a76['query'],_0x3fb1f6['filters']));if(_0x3c6a76[_0x0c6b('0x45')][_0x0c6b('0x53')]){_0x119ad2['where']=_[_0x0c6b('0x52')](_0x119ad2[_0x0c6b('0x50')],{'$or':_['map'](_0x119ad2[_0x0c6b('0x49')],function(_0x13cb88){var _0x27c8c1={};_0x27c8c1[_0x13cb88]={'$like':'%'+_0x3c6a76['query'][_0x0c6b('0x53')]+'%'};return _0x27c8c1;})});}_0x119ad2=_[_0x0c6b('0x52')]({},_0x119ad2,_0x3c6a76[_0x0c6b('0x54')]);return _0x5026be[_0x0c6b('0xc6')](_0x119ad2);}})[_0x0c6b('0x35')](function(_0x269772){if(_0x269772){_0x543075=_0x269772[_0x0c6b('0x4b')];if(!_0x3c6a76[_0x0c6b('0x45')]['hasOwnProperty'](_0x0c6b('0x6b'))){_0x119ad2[_0x0c6b('0x4d')]=qs[_0x0c6b('0x4d')](_0x3c6a76[_0x0c6b('0x45')][_0x0c6b('0x4d')]);_0x119ad2['offset']=qs[_0x0c6b('0x2f')](_0x3c6a76[_0x0c6b('0x45')]['offset']);}return _0x5026be[_0x0c6b('0xc6')](_0x119ad2);}})[_0x0c6b('0x35')](function(_0x5526d7){if(_0x5526d7){return _0x5526d7?{'count':_0x543075,'rows':_0x5526d7}:null;}})['then'](respondWithResult(_0x4e2bf1,null))[_0x0c6b('0x2c')](handleError(_0x4e2bf1,null));}; \ No newline at end of file +var _0xf8ed=['FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxAccount,\x20%s,\x20%s','result','catch','status','end','json','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','Pause','map','fieldName','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','count','includeAll','findAll','rows','show','mandatoryDispositionPause','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','Contact','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','type','system','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','updateAccountApplications','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','Contacts','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','User','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','debug'];(function(_0x1d5906,_0x4c4b3f){var _0x180e04=function(_0xeec8e9){while(--_0xeec8e9){_0x1d5906['push'](_0x1d5906['shift']());}};_0x180e04(++_0x4c4b3f);}(_0xf8ed,0x164));var _0xdf8e=function(_0x19adcf,_0xfd60aa){_0x19adcf=_0x19adcf-0x0;var _0x23677c=_0xf8ed[_0x19adcf];return _0x23677c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdf8e('0x0'));var jsonpatch=require(_0xdf8e('0x1'));var rp=require(_0xdf8e('0x2'));var moment=require(_0xdf8e('0x3'));var BPromise=require(_0xdf8e('0x4'));var Mustache=require(_0xdf8e('0x5'));var util=require(_0xdf8e('0x6'));var path=require(_0xdf8e('0x7'));var sox=require(_0xdf8e('0x8'));var csv=require(_0xdf8e('0x9'));var ejs=require(_0xdf8e('0xa'));var fs=require('fs');var _=require(_0xdf8e('0xb'));var squel=require(_0xdf8e('0xc'));var crypto=require(_0xdf8e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdf8e('0xe'));var toCsv=require(_0xdf8e('0x9'));var querystring=require(_0xdf8e('0xf'));var Papa=require(_0xdf8e('0x10'));var Redis=require(_0xdf8e('0x11'));var authService=require(_0xdf8e('0x12'));var qs=require(_0xdf8e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdf8e('0x14'));var config=require('../../config/environment');var db=require(_0xdf8e('0x15'))['db'];config[_0xdf8e('0x16')]=_[_0xdf8e('0x17')](config['redis'],{'host':_0xdf8e('0x18'),'port':0x18eb});var socket=require(_0xdf8e('0x19'))(new Redis(config[_0xdf8e('0x16')]));require(_0xdf8e('0x1a'))[_0xdf8e('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdf8e('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xdf8e('0x1c')][_0xdf8e('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x2aa6d3,_0x88115a,_0x5d3d99){if(_0x5d3d99){var _0x61e00=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x61e00[_0xdf8e('0x1e')](_0x88115a)){return _0x2aa6d3;}else{throw new db[(_0xdf8e('0x1f'))][(_0xdf8e('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 _0x2aa6d3;}}function respondWithRpcPromise(_0x22434f,_0x481cac,_0x1fbd41,_0x3711f7){return new BPromise(function(_0x5568fe,_0x5ab3af){var _0x3aabd7=_0x3711f7||client;return _0x3aabd7[_0xdf8e('0x21')](_0x22434f,_0x1fbd41)[_0xdf8e('0x22')](function(_0xee50b2){logger[_0xdf8e('0x23')]('FaxAccount,\x20%s,\x20%s',_0x481cac,_0xdf8e('0x24'));logger[_0xdf8e('0x25')](_0xdf8e('0x26'),_0x481cac,_0xdf8e('0x24'),JSON[_0xdf8e('0x27')](_0xee50b2));if(_0xee50b2[_0xdf8e('0x28')]){if(_0xee50b2[_0xdf8e('0x28')]['code']===0x1f4){logger[_0xdf8e('0x28')]('FaxAccount,\x20%s,\x20%s',_0x481cac,_0xee50b2[_0xdf8e('0x28')][_0xdf8e('0x29')]);return _0x5ab3af(_0xee50b2[_0xdf8e('0x28')][_0xdf8e('0x29')]);}logger[_0xdf8e('0x28')]('FaxAccount,\x20%s,\x20%s',_0x481cac,_0xee50b2[_0xdf8e('0x28')][_0xdf8e('0x29')]);return _0x5568fe(_0xee50b2[_0xdf8e('0x28')][_0xdf8e('0x29')]);}else{logger['info'](_0xdf8e('0x2a'),_0x481cac,'request\x20sent');_0x5568fe(_0xee50b2[_0xdf8e('0x2b')][_0xdf8e('0x29')]);}})[_0xdf8e('0x2c')](function(_0x58f962){logger[_0xdf8e('0x28')](_0xdf8e('0x2a'),_0x481cac,_0x58f962);_0x5ab3af(_0x58f962);});});}function respondWithStatusCode(_0x27de2c,_0x5dba67){_0x5dba67=_0x5dba67||0xcc;return function(_0x48b813){if(_0x48b813){return _0x27de2c['sendStatus'](_0x5dba67);}return _0x27de2c[_0xdf8e('0x2d')](_0x5dba67)[_0xdf8e('0x2e')]();};}function respondWithResult(_0x37b97c,_0x549e75){_0x549e75=_0x549e75||0xc8;return function(_0x4981c9){if(_0x4981c9){return _0x37b97c['status'](_0x549e75)[_0xdf8e('0x2f')](_0x4981c9);}};}function respondWithFilteredResult(_0x326f86,_0x50ad16){return function(_0x4dbb3b){if(_0x4dbb3b){var _0x17853f=_0x4dbb3b['count'],_0x20bf1f=_0x50ad16['offset'],_0xc70ada=_0x50ad16['offset']+_0x50ad16['limit'],_0x2021af;if(_0xc70ada>=_0x17853f){_0xc70ada=_0x17853f;_0x2021af=0xc8;}else{_0x2021af=0xce;}_0x326f86[_0xdf8e('0x2d')](_0x2021af);return _0x326f86['set']('Content-Range',_0x20bf1f+'-'+_0xc70ada+'/'+_0x17853f)[_0xdf8e('0x2f')](_0x4dbb3b);}return null;};}function patchUpdates(_0x17e78d){return function(_0x4715b0){try{jsonpatch[_0xdf8e('0x30')](_0x4715b0,_0x17e78d,!![]);}catch(_0x45a3e9){return BPromise[_0xdf8e('0x31')](_0x45a3e9);}return _0x4715b0[_0xdf8e('0x32')]();};}function saveUpdates(_0xa33937,_0x188e97){return function(_0x44562f){if(_0x44562f){return _0x44562f[_0xdf8e('0x33')](_0xa33937)[_0xdf8e('0x22')](function(_0x257d5c){return _0x257d5c;});}return null;};}function removeEntity(_0x144040,_0x1dce62){return function(_0x298889){if(_0x298889){return _0x298889[_0xdf8e('0x34')]()[_0xdf8e('0x22')](function(){var _0x3e1d3c=_0x298889[_0xdf8e('0x35')]({'plain':!![]});var _0x320109='FaxAccounts';return db[_0xdf8e('0x36')][_0xdf8e('0x34')]({'where':{'type':_0x320109,'resourceId':_0x3e1d3c['id']}})[_0xdf8e('0x22')](function(){return _0x298889;});})[_0xdf8e('0x22')](function(){_0x144040['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b320f,_0x5ab210){return function(_0x3e0d39){if(!_0x3e0d39){_0x4b320f[_0xdf8e('0x37')](0x194);}return _0x3e0d39;};}function handleError(_0x3fa53a,_0x183215){_0x183215=_0x183215||0x1f4;return function(_0x1e5c4c){logger[_0xdf8e('0x28')](_0x1e5c4c[_0xdf8e('0x38')]);if(_0x1e5c4c[_0xdf8e('0x39')]){delete _0x1e5c4c['name'];}_0x3fa53a[_0xdf8e('0x2d')](_0x183215)[_0xdf8e('0x3a')](_0x1e5c4c);};}exports[_0xdf8e('0x3b')]=function(_0x2f0ecd,_0x43de1b){var _0x518637={'include':[{'model':db[_0xdf8e('0x3c')],'as':'mandatoryDispositionPause'}]},_0x56f3d5={},_0x17336f={'count':0x0,'rows':[]};var _0xa9305e=_[_0xdf8e('0x3d')](db['FaxAccount']['rawAttributes'],function(_0x6acf93){return{'name':_0x6acf93[_0xdf8e('0x3e')],'type':_0x6acf93['type']['key']};});_0x56f3d5['model']=_[_0xdf8e('0x3d')](_0xa9305e,_0xdf8e('0x39'));_0x56f3d5['query']=_[_0xdf8e('0x3f')](_0x2f0ecd[_0xdf8e('0x40')]);_0x56f3d5[_0xdf8e('0x41')]=_['intersection'](_0x56f3d5[_0xdf8e('0x42')],_0x56f3d5['query']);_0x518637[_0xdf8e('0x43')]=_[_0xdf8e('0x44')](_0x56f3d5['model'],qs[_0xdf8e('0x45')](_0x2f0ecd[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x518637['attributes']=_0x518637['attributes'][_0xdf8e('0x46')]?_0x518637[_0xdf8e('0x43')]:_0x56f3d5[_0xdf8e('0x42')];if(!_0x2f0ecd[_0xdf8e('0x40')][_0xdf8e('0x47')](_0xdf8e('0x48'))){_0x518637[_0xdf8e('0x49')]=qs[_0xdf8e('0x49')](_0x2f0ecd[_0xdf8e('0x40')][_0xdf8e('0x49')]);_0x518637['offset']=qs['offset'](_0x2f0ecd[_0xdf8e('0x40')][_0xdf8e('0x4a')]);}_0x518637['order']=qs[_0xdf8e('0x4b')](_0x2f0ecd[_0xdf8e('0x40')][_0xdf8e('0x4b')]);_0x518637[_0xdf8e('0x4c')]=qs[_0xdf8e('0x41')](_[_0xdf8e('0x4d')](_0x2f0ecd[_0xdf8e('0x40')],_0x56f3d5['filters']),_0xa9305e);if(_0x2f0ecd['query'][_0xdf8e('0x4e')]){_0x518637[_0xdf8e('0x4c')]=_[_0xdf8e('0x4f')](_0x518637['where'],{'$or':_['map'](_0xa9305e,function(_0x1057d7){if(_0x1057d7['type']!==_0xdf8e('0x50')){var _0x173cd9={};_0x173cd9[_0x1057d7[_0xdf8e('0x39')]]={'$like':'%'+_0x2f0ecd['query'][_0xdf8e('0x4e')]+'%'};return _0x173cd9;}})});}_0x518637=_['merge']({},_0x518637,_0x2f0ecd[_0xdf8e('0x51')]);var _0x2893a1={'where':_0x518637[_0xdf8e('0x4c')]};return db[_0xdf8e('0x52')][_0xdf8e('0x53')](_0x2893a1)['then'](function(_0x8577af){_0x17336f['count']=_0x8577af;if(_0x2f0ecd[_0xdf8e('0x40')][_0xdf8e('0x54')]){_0x518637['include']=[{'all':!![]}];}return db[_0xdf8e('0x52')][_0xdf8e('0x55')](_0x518637);})[_0xdf8e('0x22')](function(_0x1823d5){_0x17336f[_0xdf8e('0x56')]=_0x1823d5;return _0x17336f;})[_0xdf8e('0x22')](respondWithFilteredResult(_0x43de1b,_0x518637))[_0xdf8e('0x2c')](handleError(_0x43de1b,null));};exports[_0xdf8e('0x57')]=function(_0x20f186,_0x486076){var _0x5b4770={'raw':![],'where':{'id':_0x20f186['params']['id']},'include':[{'model':db[_0xdf8e('0x3c')],'as':_0xdf8e('0x58')}]},_0xb579eb={};_0xb579eb[_0xdf8e('0x42')]=_[_0xdf8e('0x3f')](db[_0xdf8e('0x52')][_0xdf8e('0x59')]);_0xb579eb[_0xdf8e('0x40')]=_[_0xdf8e('0x3f')](_0x20f186[_0xdf8e('0x40')]);_0xb579eb[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0xb579eb['model'],_0xb579eb[_0xdf8e('0x40')]);_0x5b4770[_0xdf8e('0x43')]=_[_0xdf8e('0x44')](_0xb579eb[_0xdf8e('0x42')],qs[_0xdf8e('0x45')](_0x20f186[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x5b4770[_0xdf8e('0x43')]=_0x5b4770[_0xdf8e('0x43')]['length']?_0x5b4770['attributes']:_0xb579eb[_0xdf8e('0x42')];if(_0x20f186[_0xdf8e('0x40')][_0xdf8e('0x54')]){_0x5b4770[_0xdf8e('0x5a')]=[{'all':!![]}];}_0x5b4770=_[_0xdf8e('0x4f')]({},_0x5b4770,_0x20f186['options']);return db[_0xdf8e('0x52')][_0xdf8e('0x5b')](_0x5b4770)['then'](handleEntityNotFound(_0x486076,null))[_0xdf8e('0x22')](respondWithResult(_0x486076,null))[_0xdf8e('0x2c')](handleError(_0x486076,null));};exports['create']=function(_0x1705b9,_0x5c536f){return db[_0xdf8e('0x52')][_0xdf8e('0x5c')](_0x1705b9[_0xdf8e('0x5d')],{})[_0xdf8e('0x22')](function(_0x1e3ba7){var _0x4dde63=_0x1705b9['user'][_0xdf8e('0x35')]({'plain':!![]});if(!_0x4dde63)throw new Error(_0xdf8e('0x5e'));if(_0x4dde63['role']===_0xdf8e('0x5f')){var _0x5e41f1=_0x1e3ba7[_0xdf8e('0x35')]({'plain':!![]});var _0x3fac15='FaxAccounts';return db[_0xdf8e('0x60')][_0xdf8e('0x5b')]({'where':{'name':_0x3fac15,'userProfileId':_0x4dde63[_0xdf8e('0x61')]},'raw':!![]})[_0xdf8e('0x22')](function(_0x5d7aef){if(_0x5d7aef&&_0x5d7aef['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5e41f1[_0xdf8e('0x39')],'resourceId':_0x5e41f1['id'],'type':_0x5d7aef[_0xdf8e('0x39')],'sectionId':_0x5d7aef['id']},{})[_0xdf8e('0x22')](function(){return _0x1e3ba7;});}else{return _0x1e3ba7;}})[_0xdf8e('0x2c')](function(_0x19ce79){logger[_0xdf8e('0x28')](_0xdf8e('0x62'),_0x19ce79);throw _0x19ce79;});}return _0x1e3ba7;})[_0xdf8e('0x22')](respondWithResult(_0x5c536f,0xc9))['catch'](handleError(_0x5c536f,null));};exports[_0xdf8e('0x33')]=function(_0x10a828,_0x23906f){if(_0x10a828['body']['id']){delete _0x10a828['body']['id'];}return db['FaxAccount'][_0xdf8e('0x5b')]({'where':{'id':_0x10a828[_0xdf8e('0x63')]['id']},'include':[{'model':db[_0xdf8e('0x3c')],'as':_0xdf8e('0x58')}]})[_0xdf8e('0x22')](handleEntityNotFound(_0x23906f,null))[_0xdf8e('0x22')](saveUpdates(_0x10a828[_0xdf8e('0x5d')],null))[_0xdf8e('0x22')](respondWithResult(_0x23906f,null))[_0xdf8e('0x2c')](handleError(_0x23906f,null));};exports[_0xdf8e('0x34')]=function(_0xc68363,_0x197610){return db[_0xdf8e('0x52')][_0xdf8e('0x5b')]({'where':{'id':_0xc68363[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x197610,null))[_0xdf8e('0x22')](removeEntity(_0x197610,null))[_0xdf8e('0x2c')](handleError(_0x197610,null));};exports[_0xdf8e('0x64')]=function(_0x124e26,_0x2839be){return db[_0xdf8e('0x52')][_0xdf8e('0x64')]()['then'](respondWithResult(_0x2839be,null))['catch'](handleError(_0x2839be,null));};exports[_0xdf8e('0x65')]=function(_0x8d3c4b,_0x3836f0,_0x11a773){if(_0x8d3c4b[_0xdf8e('0x5d')]['id']){delete _0x8d3c4b[_0xdf8e('0x5d')]['id'];}return db[_0xdf8e('0x52')][_0xdf8e('0x5b')]({'where':{'id':_0x8d3c4b['params']['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x3836f0,null))[_0xdf8e('0x22')](function(_0x33720c){if(_0x33720c){_0x8d3c4b[_0xdf8e('0x5d')][_0xdf8e('0x66')]=_0x33720c['id'];return db[_0xdf8e('0x67')][_0xdf8e('0x5c')](_0x8d3c4b[_0xdf8e('0x5d')]);}})[_0xdf8e('0x22')](respondWithResult(_0x3836f0,null))[_0xdf8e('0x2c')](handleError(_0x3836f0,null));};exports[_0xdf8e('0x68')]=function(_0x5cc4fc,_0x1ff14e,_0x721df7){var _0x519d98={'raw':![],'where':{}};var _0x4546e={};var _0x3e7a14={'count':0x0,'rows':[]};return db[_0xdf8e('0x52')][_0xdf8e('0x69')]({'where':{'id':_0x5cc4fc[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x1ff14e,null))[_0xdf8e('0x22')](function(_0x3b567b){if(_0x3b567b){_0x4546e[_0xdf8e('0x42')]=_[_0xdf8e('0x3f')](db['Disposition'][_0xdf8e('0x59')]);_0x4546e[_0xdf8e('0x40')]=_[_0xdf8e('0x3f')](_0x5cc4fc[_0xdf8e('0x40')]);_0x4546e[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0x4546e['model'],_0x4546e[_0xdf8e('0x40')]);_0x519d98[_0xdf8e('0x43')]=_['intersection'](_0x4546e[_0xdf8e('0x42')],qs[_0xdf8e('0x45')](_0x5cc4fc[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x519d98[_0xdf8e('0x43')]=_0x519d98['attributes'][_0xdf8e('0x46')]?_0x519d98['attributes']:_0x4546e['model'];if(!_0x5cc4fc['query'][_0xdf8e('0x47')](_0xdf8e('0x48'))){_0x519d98[_0xdf8e('0x49')]=qs['limit'](_0x5cc4fc[_0xdf8e('0x40')]['limit']);_0x519d98['offset']=qs[_0xdf8e('0x4a')](_0x5cc4fc[_0xdf8e('0x40')][_0xdf8e('0x4a')]);}_0x519d98[_0xdf8e('0x6a')]=qs[_0xdf8e('0x4b')](_0x5cc4fc[_0xdf8e('0x40')][_0xdf8e('0x4b')]);_0x519d98[_0xdf8e('0x4c')]=qs['filters'](_['pick'](_0x5cc4fc[_0xdf8e('0x40')],_0x4546e[_0xdf8e('0x41')]));_0x519d98[_0xdf8e('0x4c')][_0xdf8e('0x66')]=_0x3b567b['id'];if(_0x5cc4fc[_0xdf8e('0x40')][_0xdf8e('0x4e')]){_0x519d98['where']=_[_0xdf8e('0x4f')](_0x519d98[_0xdf8e('0x4c')],{'$or':_[_0xdf8e('0x3d')](_0x519d98['attributes'],function(_0x3727de){var _0x393410={};_0x393410[_0x3727de]={'$like':'%'+_0x5cc4fc['query'][_0xdf8e('0x4e')]+'%'};return _0x393410;})});}_0x519d98=_[_0xdf8e('0x4f')]({},_0x519d98,_0x5cc4fc[_0xdf8e('0x51')]);return db['Disposition']['count']({'where':_0x519d98[_0xdf8e('0x4c')]})[_0xdf8e('0x22')](function(_0x583840){_0x3e7a14[_0xdf8e('0x53')]=_0x583840;if(_0x5cc4fc[_0xdf8e('0x40')][_0xdf8e('0x54')]){_0x519d98[_0xdf8e('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0xdf8e('0x55')](_0x519d98);})['then'](function(_0x573ee9){_0x3e7a14[_0xdf8e('0x56')]=_0x573ee9;return _0x3e7a14;});}})[_0xdf8e('0x22')](respondWithFilteredResult(_0x1ff14e,_0x519d98))['catch'](handleError(_0x1ff14e,null));};exports[_0xdf8e('0x6b')]=function(_0x132068,_0x16139f,_0x581813){return db[_0xdf8e('0x52')]['find']({'where':{'id':_0x132068['params']['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x16139f,null))['then'](function(_0xe1921a){if(_0xe1921a){return _0xe1921a[_0xdf8e('0x6b')](_0x132068[_0xdf8e('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x16139f,null))['catch'](handleError(_0x16139f,null));};exports[_0xdf8e('0x6c')]=function(_0x4ee90b,_0x1e753c,_0x12b8ce){if(_0x4ee90b[_0xdf8e('0x5d')]['id']){delete _0x4ee90b['body']['id'];}return db[_0xdf8e('0x52')][_0xdf8e('0x5b')]({'where':{'id':_0x4ee90b['params']['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x1e753c,null))[_0xdf8e('0x22')](function(_0x5f1725){if(_0x5f1725){_0x4ee90b[_0xdf8e('0x5d')]['FaxAccountId']=_0x5f1725['id'];return db['CannedAnswer'][_0xdf8e('0x5c')](_0x4ee90b[_0xdf8e('0x5d')]);}})['then'](respondWithResult(_0x1e753c,null))[_0xdf8e('0x2c')](handleError(_0x1e753c,null));};exports[_0xdf8e('0x6d')]=function(_0x48f411,_0x3b2236,_0x451ff7){var _0x332558={'raw':![],'where':{}};var _0x27c335={};var _0x4b94e4={'count':0x0,'rows':[]};return db['FaxAccount'][_0xdf8e('0x69')]({'where':{'id':_0x48f411[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x3b2236,null))[_0xdf8e('0x22')](function(_0x3c7fae){if(_0x3c7fae){_0x27c335[_0xdf8e('0x42')]=_['keys'](db[_0xdf8e('0x6e')][_0xdf8e('0x59')]);_0x27c335['query']=_['keys'](_0x48f411[_0xdf8e('0x40')]);_0x27c335[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0x27c335[_0xdf8e('0x42')],_0x27c335[_0xdf8e('0x40')]);_0x332558[_0xdf8e('0x43')]=_['intersection'](_0x27c335[_0xdf8e('0x42')],qs[_0xdf8e('0x45')](_0x48f411[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x332558[_0xdf8e('0x43')]=_0x332558['attributes']['length']?_0x332558[_0xdf8e('0x43')]:_0x27c335[_0xdf8e('0x42')];if(!_0x48f411[_0xdf8e('0x40')][_0xdf8e('0x47')]('nolimit')){_0x332558['limit']=qs[_0xdf8e('0x49')](_0x48f411[_0xdf8e('0x40')]['limit']);_0x332558[_0xdf8e('0x4a')]=qs[_0xdf8e('0x4a')](_0x48f411[_0xdf8e('0x40')][_0xdf8e('0x4a')]);}_0x332558[_0xdf8e('0x6a')]=qs['sort'](_0x48f411[_0xdf8e('0x40')][_0xdf8e('0x4b')]);_0x332558[_0xdf8e('0x4c')]=qs[_0xdf8e('0x41')](_[_0xdf8e('0x4d')](_0x48f411['query'],_0x27c335['filters']));_0x332558[_0xdf8e('0x4c')]['FaxAccountId']=_0x3c7fae['id'];if(_0x48f411[_0xdf8e('0x40')][_0xdf8e('0x4e')]){_0x332558[_0xdf8e('0x4c')]=_[_0xdf8e('0x4f')](_0x332558['where'],{'$or':_['map'](_0x332558[_0xdf8e('0x43')],function(_0x41dcc8){var _0xe7dd84={};_0xe7dd84[_0x41dcc8]={'$like':'%'+_0x48f411[_0xdf8e('0x40')][_0xdf8e('0x4e')]+'%'};return _0xe7dd84;})});}_0x332558=_[_0xdf8e('0x4f')]({},_0x332558,_0x48f411['options']);return db['CannedAnswer'][_0xdf8e('0x53')]({'where':_0x332558[_0xdf8e('0x4c')]})[_0xdf8e('0x22')](function(_0x4cc1b6){_0x4b94e4['count']=_0x4cc1b6;if(_0x48f411['query']['includeAll']){_0x332558['include']=[{'all':!![]}];}return db[_0xdf8e('0x6e')][_0xdf8e('0x55')](_0x332558);})[_0xdf8e('0x22')](function(_0x354e98){_0x4b94e4[_0xdf8e('0x56')]=_0x354e98;return _0x4b94e4;});}})['then'](respondWithFilteredResult(_0x3b2236,_0x332558))[_0xdf8e('0x2c')](handleError(_0x3b2236,null));};exports[_0xdf8e('0x6f')]=function(_0x599f88,_0x169097,_0x9baf14){return db['FaxAccount'][_0xdf8e('0x5b')]({'where':{'id':_0x599f88[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x169097,null))[_0xdf8e('0x22')](function(_0x9a1655){if(_0x9a1655){return _0x9a1655[_0xdf8e('0x6f')](_0x599f88[_0xdf8e('0x40')][_0xdf8e('0x70')]);}})[_0xdf8e('0x22')](respondWithStatusCode(_0x169097,null))[_0xdf8e('0x2c')](handleError(_0x169097,null));};exports[_0xdf8e('0x71')]=function(_0x18b493,_0x48f9a1,_0x40b75e){return db[_0xdf8e('0x72')][_0xdf8e('0x5b')]({'where':{'id':_0x18b493[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x48f9a1,null))[_0xdf8e('0x22')](function(_0xad5911){if(_0xad5911){return _0xad5911[_0xdf8e('0x71')](_0x18b493[_0xdf8e('0x5d')]['ids'],_[_0xdf8e('0x73')](_0x18b493[_0xdf8e('0x5d')],[_0xdf8e('0x70'),'id'])||{});}})[_0xdf8e('0x22')](respondWithResult(_0x48f9a1,null))['catch'](handleError(_0x48f9a1,null));};exports[_0xdf8e('0x74')]=function(_0x20015e,_0x2ae09a,_0x1b84df){var _0xd1e1ec={'raw':![],'where':{}};var _0x783885={};var _0x3427be={'count':0x0,'rows':[]};return db[_0xdf8e('0x52')][_0xdf8e('0x69')]({'where':{'id':_0x20015e['params']['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x2ae09a,null))[_0xdf8e('0x22')](function(_0x2367bb){if(_0x2367bb){_0x783885[_0xdf8e('0x42')]=_[_0xdf8e('0x3f')](db[_0xdf8e('0x72')][_0xdf8e('0x59')]);_0x783885[_0xdf8e('0x40')]=_[_0xdf8e('0x3f')](_0x20015e['query']);_0x783885[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0x783885['model'],_0x783885[_0xdf8e('0x40')]);_0xd1e1ec[_0xdf8e('0x43')]=_[_0xdf8e('0x44')](_0x783885[_0xdf8e('0x42')],qs[_0xdf8e('0x45')](_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0xd1e1ec[_0xdf8e('0x43')]=_0xd1e1ec[_0xdf8e('0x43')]['length']?_0xd1e1ec['attributes']:_0x783885[_0xdf8e('0x42')];if(!_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x47')](_0xdf8e('0x48'))){_0xd1e1ec[_0xdf8e('0x49')]=qs[_0xdf8e('0x49')](_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x49')]);_0xd1e1ec['offset']=qs[_0xdf8e('0x4a')](_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x4a')]);}_0xd1e1ec[_0xdf8e('0x6a')]=qs['sort'](_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x4b')]);_0xd1e1ec[_0xdf8e('0x4c')]=qs['filters'](_[_0xdf8e('0x4d')](_0x20015e[_0xdf8e('0x40')],_0x783885[_0xdf8e('0x41')]));_0xd1e1ec[_0xdf8e('0x4c')][_0xdf8e('0x66')]=_0x2367bb['id'];if(_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x4e')]){_0xd1e1ec['where']=_[_0xdf8e('0x4f')](_0xd1e1ec[_0xdf8e('0x4c')],{'$or':_[_0xdf8e('0x3d')](_0xd1e1ec['attributes'],function(_0x19b48d){var _0x14756f={};_0x14756f[_0x19b48d]={'$like':'%'+_0x20015e['query']['filter']+'%'};return _0x14756f;})});}_0xd1e1ec=_[_0xdf8e('0x4f')]({},_0xd1e1ec,_0x20015e[_0xdf8e('0x51')]);return db[_0xdf8e('0x72')][_0xdf8e('0x53')]({'where':_0xd1e1ec[_0xdf8e('0x4c')]})[_0xdf8e('0x22')](function(_0x34a42d){_0x3427be[_0xdf8e('0x53')]=_0x34a42d;if(_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x54')]){_0xd1e1ec['include']=[{'model':db['CmContact'],'as':_0xdf8e('0x75'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xdf8e('0x39'),_0xdf8e('0x76'),'internal'],'required':![]},{'model':db[_0xdf8e('0x77')],'as':_0xdf8e('0x78'),'attributes':['id',_0xdf8e('0x39'),_0xdf8e('0x79')],'where':_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x7a')]?{'id':_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x7a')]}:undefined,'required':_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x7a')]?!![]:![]}];}return db[_0xdf8e('0x72')][_0xdf8e('0x55')](_0xd1e1ec);})[_0xdf8e('0x22')](function(_0x5d63f7){_0x3427be[_0xdf8e('0x56')]=_0x5d63f7;return _0x3427be;});}})['then'](respondWithFilteredResult(_0x2ae09a,_0xd1e1ec))[_0xdf8e('0x2c')](handleError(_0x2ae09a,null));};exports[_0xdf8e('0x7b')]=function(_0x539fe2,_0x22c4a9,_0x3bf74e){return db[_0xdf8e('0x52')][_0xdf8e('0x69')]({'where':{'id':_0x539fe2['params']['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x22c4a9,null))[_0xdf8e('0x22')](function(_0x3472d2){if(_0x3472d2){return db[_0xdf8e('0x7c')][_0xdf8e('0x7d')](function(_0x10b6f0){return db[_0xdf8e('0x7e')][_0xdf8e('0x34')]({'where':{'FaxAccountId':_0x539fe2[_0xdf8e('0x63')]['id']},'transaction':_0x10b6f0})[_0xdf8e('0x22')](function(_0x297b8b){var _0x20fd66=_[_0xdf8e('0x3d')](_0x539fe2[_0xdf8e('0x5d')],function(_0x6158b9){_0x6158b9[_0xdf8e('0x66')]=_0x539fe2[_0xdf8e('0x63')]['id'];return _0x6158b9;});return db[_0xdf8e('0x7e')][_0xdf8e('0x7f')](_0x20fd66,{'transaction':_0x10b6f0});});})['then'](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x539fe2[_0xdf8e('0x63')]['id']},'order':_0xdf8e('0x80')});});}})[_0xdf8e('0x22')](respondWithResult(_0x22c4a9,null))[_0xdf8e('0x2c')](handleError(_0x22c4a9,null));};exports[_0xdf8e('0x81')]=function(_0x27d0be,_0x485b3f,_0x5b6487){var _0x4ac98f={};var _0x51f9ea={};var _0x6add1f;var _0x362ae3;return db[_0xdf8e('0x52')]['findOne']({'where':{'id':_0x27d0be[_0xdf8e('0x63')]['id']}})['then'](handleEntityNotFound(_0x485b3f,null))[_0xdf8e('0x22')](function(_0x345dc1){if(_0x345dc1){_0x6add1f=_0x345dc1;_0x51f9ea[_0xdf8e('0x42')]=_['keys'](db[_0xdf8e('0x7e')]['rawAttributes']);_0x51f9ea['query']=_[_0xdf8e('0x3f')](_0x27d0be[_0xdf8e('0x40')]);_0x51f9ea[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0x51f9ea[_0xdf8e('0x42')],_0x51f9ea[_0xdf8e('0x40')]);_0x4ac98f[_0xdf8e('0x43')]=_[_0xdf8e('0x44')](_0x51f9ea[_0xdf8e('0x42')],qs[_0xdf8e('0x45')](_0x27d0be[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x4ac98f['attributes']=_0x4ac98f['attributes'][_0xdf8e('0x46')]?_0x4ac98f[_0xdf8e('0x43')]:_0x51f9ea[_0xdf8e('0x42')];_0x4ac98f[_0xdf8e('0x6a')]=qs[_0xdf8e('0x4b')](_0x27d0be['query']['sort']);_0x4ac98f[_0xdf8e('0x4c')]=qs[_0xdf8e('0x41')](_[_0xdf8e('0x4d')](_0x27d0be[_0xdf8e('0x40')],_0x51f9ea[_0xdf8e('0x41')]));if(_0x27d0be['query'][_0xdf8e('0x4e')]){_0x4ac98f['where']=_[_0xdf8e('0x4f')](_0x4ac98f['where'],{'$or':_[_0xdf8e('0x3d')](_0x4ac98f[_0xdf8e('0x43')],function(_0x5d634a){var _0x375657={};_0x375657[_0x5d634a]={'$like':'%'+_0x27d0be[_0xdf8e('0x40')][_0xdf8e('0x4e')]+'%'};return _0x375657;})});}_0x4ac98f=_[_0xdf8e('0x4f')]({},_0x4ac98f,_0x27d0be['options']);return _0x6add1f[_0xdf8e('0x81')](_0x4ac98f);}})['then'](function(_0x615780){if(_0x615780){_0x362ae3=_0x615780[_0xdf8e('0x46')];if(!_0x27d0be['query']['hasOwnProperty'](_0xdf8e('0x48'))){_0x4ac98f[_0xdf8e('0x49')]=qs['limit'](_0x27d0be[_0xdf8e('0x40')][_0xdf8e('0x49')]);_0x4ac98f[_0xdf8e('0x4a')]=qs[_0xdf8e('0x4a')](_0x27d0be[_0xdf8e('0x40')]['offset']);}return _0x6add1f[_0xdf8e('0x81')](_0x4ac98f);}})[_0xdf8e('0x22')](function(_0x3b1acf){if(_0x3b1acf){return _0x3b1acf?{'count':_0x362ae3,'rows':_0x3b1acf}:null;}})[_0xdf8e('0x22')](respondWithResult(_0x485b3f,null))['catch'](handleError(_0x485b3f,null));};function Extension(_0x1d3110,_0x34bcb6,_0x6966d6,_0x3bc8f2){this[_0xdf8e('0x82')]=_0xdf8e('0x83');this[_0xdf8e('0x84')]=_0x1d3110[_0xdf8e('0x85')];this[_0xdf8e('0x86')]=_0x3bc8f2;this[_0xdf8e('0x87')]=_0xdf8e('0x88');this[_0xdf8e('0x89')]='Fax\x20Extension';this[_0xdf8e('0x66')]=_0x1d3110['id'];this[_0xdf8e('0x80')]=_0x34bcb6;this[_0xdf8e('0x8a')]=_0x6966d6;}function createExtensionsReciveFax(_0x38aee2){var _0x2c8079=0x1;var _0x5c1abe=[];_0x5c1abe[_0xdf8e('0x8b')](new Extension(_0x38aee2,_0x2c8079,'',_0xdf8e('0x8c')));_0x2c8079+=0x1;_0x5c1abe[_0xdf8e('0x8b')](new Extension(_0x38aee2,_0x2c8079,_0xdf8e('0x8d'),_0xdf8e('0x8e')));_0x2c8079+=0x1;for(var _0x2d81f1 in _0x38aee2){if(_0x38aee2[_0xdf8e('0x47')](_0x2d81f1)&&(_0x2d81f1===_0xdf8e('0x8f')||_0x2d81f1===_0xdf8e('0x85')||_0x2d81f1==='gateway'||_0x2d81f1===_0xdf8e('0x90')||_0x2d81f1===_0xdf8e('0x91')||_0x2d81f1==='maxrate'||_0x2d81f1===_0xdf8e('0x92')||_0x2d81f1===_0xdf8e('0x93')||_0x2d81f1===_0xdf8e('0x94'))){_0x5c1abe['push'](new Extension(_0x38aee2,_0x2c8079,_0xdf8e('0x95')+_0x2d81f1+')='+_0x38aee2[_0x2d81f1],'Set'));_0x2c8079+=0x1;}}_0x5c1abe['push'](new Extension(_0x38aee2,_0x2c8079,'6',_0xdf8e('0x96')));_0x2c8079+=0x1;_0x5c1abe[_0xdf8e('0x8b')](new Extension(_0x38aee2,_0x2c8079,_0xdf8e('0x97'),'ReceiveFax'));_0x2c8079=0x0;return _0x5c1abe;}exports['addAccountApplications']=function(_0x298d72,_0x5be5b2,_0x22f04f){var _0x294f7e;return db[_0xdf8e('0x7c')][_0xdf8e('0x7d')](function(_0x33fad4){return db[_0xdf8e('0x52')][_0xdf8e('0x5c')](_0x298d72[_0xdf8e('0x5d')],{'transaction':_0x33fad4})['then'](function(_0x41e029){_0x294f7e=_0x41e029[_0xdf8e('0x35')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x294f7e),{'transaction':_0x33fad4});});})['then'](function(){return _0x294f7e;})[_0xdf8e('0x22')](respondWithResult(_0x5be5b2,null))[_0xdf8e('0x2c')](handleError(_0x5be5b2,null));};exports[_0xdf8e('0x98')]=function(_0x38bddc,_0x56c11b,_0x170d2b){var _0x4fa800;return db[_0xdf8e('0x7c')][_0xdf8e('0x7d')](function(_0x39f7a3){return db['FaxAccount'][_0xdf8e('0x33')](_0x38bddc[_0xdf8e('0x5d')],{'where':{'id':_0x38bddc[_0xdf8e('0x5d')]['id']},'transaction':_0x39f7a3})[_0xdf8e('0x22')](function(_0x249e3a){return db[_0xdf8e('0x99')][_0xdf8e('0x34')]({'where':{'FaxAccountId':_0x38bddc[_0xdf8e('0x5d')]['id']},'transaction':_0x39f7a3})[_0xdf8e('0x22')](function(_0x22a673){return db[_0xdf8e('0x99')][_0xdf8e('0x7f')](createExtensionsReciveFax(_['omit'](_0x38bddc[_0xdf8e('0x5d')],[_0xdf8e('0x9a'),_0xdf8e('0x9b'),_0xdf8e('0x9c'),_0xdf8e('0x9d'),_0xdf8e('0x9e'),'ListId'])),{'transaction':_0x39f7a3});});});})[_0xdf8e('0x22')](function(){return db['FaxAccount'][_0xdf8e('0x9f')](_0x38bddc['body']['id']);})[_0xdf8e('0x22')](respondWithResult(_0x56c11b,null))[_0xdf8e('0x2c')](handleError(_0x56c11b,null));};exports[_0xdf8e('0xa0')]=function(_0x5edb40,_0x13c6c7,_0x2684d2){var _0x502429={'raw':!![],'where':{}};var _0x3c90e4={};var _0x42fc9e={'count':0x0,'rows':[]};return db[_0xdf8e('0x52')][_0xdf8e('0x69')]({'where':{'id':_0x5edb40[_0xdf8e('0x63')]['id']}})['then'](handleEntityNotFound(_0x13c6c7,null))[_0xdf8e('0x22')](function(_0x5a1c86){if(_0x5a1c86){_0x3c90e4[_0xdf8e('0x42')]=_['keys'](db[_0xdf8e('0xa1')]['rawAttributes']);_0x3c90e4[_0xdf8e('0x40')]=_[_0xdf8e('0x3f')](_0x5edb40[_0xdf8e('0x40')]);_0x3c90e4[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0x3c90e4[_0xdf8e('0x42')],_0x3c90e4[_0xdf8e('0x40')]);_0x502429[_0xdf8e('0x43')]=_[_0xdf8e('0x44')](_0x3c90e4[_0xdf8e('0x42')],qs['fields'](_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x502429[_0xdf8e('0x43')]=_0x502429[_0xdf8e('0x43')][_0xdf8e('0x46')]?_0x502429[_0xdf8e('0x43')]:_0x3c90e4['model'];if(!_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x47')]('nolimit')){_0x502429['limit']=qs[_0xdf8e('0x49')](_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x49')]);_0x502429[_0xdf8e('0x4a')]=qs[_0xdf8e('0x4a')](_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x4a')]);}_0x502429['order']=qs[_0xdf8e('0x4b')](_0x5edb40['query'][_0xdf8e('0x4b')]);_0x502429['where']=qs[_0xdf8e('0x41')](_[_0xdf8e('0x4d')](_0x5edb40[_0xdf8e('0x40')],_0x3c90e4[_0xdf8e('0x41')]));_0x502429['where'][_0xdf8e('0x66')]=_0x5a1c86['id'];if(_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x4e')]){_0x502429[_0xdf8e('0x4c')]=_[_0xdf8e('0x4f')](_0x502429[_0xdf8e('0x4c')],{'$or':_[_0xdf8e('0x3d')](_0x502429[_0xdf8e('0x43')],function(_0x32222a){var _0x15d7c1={};_0x15d7c1[_0x32222a]={'$like':'%'+_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x4e')]+'%'};return _0x15d7c1;})});}if(_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0xa2')]){var _0x2b295b=_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0xa2')]['split'](',');var _0x36f78f={};_0x36f78f[_0x2b295b[0x0]]={'$gte':moment(_0x2b295b[0x1])['format'](_0xdf8e('0xa3'))};_0x502429['where']=_[_0xdf8e('0x4f')](_0x502429['where'],_0x36f78f);}_0x502429=_[_0xdf8e('0x4f')]({},_0x502429,_0x5edb40['options']);return db['FaxMessage'][_0xdf8e('0x53')]({'where':_0x502429[_0xdf8e('0x4c')]})[_0xdf8e('0x22')](function(_0x3a41df){_0x42fc9e[_0xdf8e('0x53')]=_0x3a41df;if(_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x54')]){_0x502429[_0xdf8e('0x5a')]=[{'all':!![]}];}return db[_0xdf8e('0xa1')][_0xdf8e('0x55')](_0x502429);})[_0xdf8e('0x22')](function(_0x5c1eb3){_0x42fc9e[_0xdf8e('0x56')]=_0x5c1eb3;return _0x42fc9e;});}})[_0xdf8e('0x22')](respondWithFilteredResult(_0x13c6c7,_0x502429))[_0xdf8e('0x2c')](handleError(_0x13c6c7,null));};exports[_0xdf8e('0x3a')]=function(_0x1cd3b3,_0x1854c5,_0x61ea4e){var _0x2499cb,_0xa5a1c1={},_0x209a89;if(_0x1cd3b3[_0xdf8e('0x5d')]['to']){_0x209a89=_0x1cd3b3[_0xdf8e('0x5d')]['to'][0x0];}return db[_0xdf8e('0x52')]['find']({'where':{'id':_0x1cd3b3['params']['id']},'include':[{'model':db['CmList'],'as':_0xdf8e('0xa4'),'include':[{'model':db[_0xdf8e('0xa5')],'as':'Contacts','where':{'fax':_0x209a89},'limit':0x1,'order':[['updatedAt',_0xdf8e('0xa6')]]}]}]})['then'](handleEntityNotFound(_0x1854c5,null))['then'](function(_0x19c754){_0x2499cb=_0x19c754;if(_0x1cd3b3['body'][_0xdf8e('0xa7')]&&_0x1cd3b3['body'][_0xdf8e('0xa7')]['length']){for(var _0x353067=0x0;_0x353067<_0x1cd3b3[_0xdf8e('0x5d')]['attachments'][_0xdf8e('0x46')];_0x353067+=0x1){_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][_0x353067]={'filename':_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][_0x353067][_0xdf8e('0x39')],'id':_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][_0x353067]['id'],'path':path['join'](config[_0xdf8e('0xa8')],_0xdf8e('0xa9'),_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][_0x353067][_0xdf8e('0xaa')])};}}return respondWithRpcPromise(_0xdf8e('0xab'),'CheckAfterSend',{'FaxAccountId':_[_0xdf8e('0xac')](_0x1cd3b3[_0xdf8e('0x63')]['id'])?undefined:_0x1cd3b3[_0xdf8e('0x63')]['id'],'path':_[_0xdf8e('0xac')](_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][0x0]['path'])?undefined:_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][0x0]['path'],'fax':_[_0xdf8e('0xac')](_0x1cd3b3['body']['to'][0x0])?undefined:_0x1cd3b3[_0xdf8e('0x5d')]['to'][0x0]},client9002);})[_0xdf8e('0x22')](function(){if(_0x2499cb){if(_['isNil'](_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xad')])){_0x1cd3b3['body'][_0xdf8e('0xad')]=util[_0xdf8e('0xae')](_0xdf8e('0xaf'),_0x2499cb[_0xdf8e('0x39')],_0x2499cb[_0xdf8e('0xb0')]);}if(_0x2499cb[_0xdf8e('0xa4')]){if(_0x2499cb[_0xdf8e('0xa4')][_0xdf8e('0xb1')][_0xdf8e('0x46')]){return _0x2499cb[_0xdf8e('0xa4')][_0xdf8e('0xb1')][0x0];}else{return db[_0xdf8e('0xa5')][_0xdf8e('0x5c')](_['defaults'](_0x1cd3b3[_0xdf8e('0x5d')],{'firstName':_0x1cd3b3[_0xdf8e('0x5d')]['to'][0x0],'phone':_0x1cd3b3[_0xdf8e('0x5d')]['to'][0x0],'fax':_0x1cd3b3['body']['to'][0x0],'ListId':_0x2499cb[_0xdf8e('0xb2')]}));}}else{throw new Error(_0xdf8e('0xb3'));}}else{throw new Error(_0xdf8e('0xb4'));}})['then'](function(_0x555e78){if(_0x555e78){return db[_0xdf8e('0x72')][_0xdf8e('0x5b')]({'where':{'ContactId':_0x555e78['id'],'closed':![],'FaxAccountId':_0x2499cb['id']}})['then'](function(_0x5ee54d){if(_0x5ee54d){return[_0x5ee54d,![]];}return db[_0xdf8e('0x72')][_0xdf8e('0x5c')]({'UserId':_0x1cd3b3[_0xdf8e('0x5f')]['id'],'ContactId':_0x555e78['id'],'FaxAccountId':_0x2499cb['id'],'fax':_0x1cd3b3['body']['to'][0x0],'firstMsgDirection':_0xdf8e('0xb5'),'Messages':[_[_0xdf8e('0x4f')](_0x1cd3b3['body'],{'read':![],'body':_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][0x0][_0xdf8e('0xb6')],'FaxAccountId':_0x2499cb['id'],'UserId':_0x1cd3b3[_0xdf8e('0x5f')]['id'],'ContactId':_0x555e78['id'],'AttachmentId':_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xdf8e('0xa1')],'as':_0xdf8e('0xb7')}]})[_0xdf8e('0x22')](function(_0x4f45ff){return[_0x4f45ff,!![]];});});}else{throw new Error(_0xdf8e('0xb8'));}})[_0xdf8e('0xb9')](function(_0x3f76a5,_0x4b4455){if(_0x4b4455){return _0x3f76a5;}return db[_0xdf8e('0xa1')][_0xdf8e('0x5c')]({'direction':_0xdf8e('0xb5'),'read':![],'body':_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][0x0][_0xdf8e('0xb6')],'FaxAccountId':_0x2499cb['id'],'FaxInteractionId':_0x3f76a5['id'],'UserId':_0x1cd3b3[_0xdf8e('0x5f')]['id'],'ContactId':_0x3f76a5['ContactId'],'AttachmentId':_0x1cd3b3[_0xdf8e('0x5d')]['attachments'][0x0]['id']})[_0xdf8e('0x22')](function(_0x2633a9){_0x3f76a5[_0xdf8e('0xba')][_0xdf8e('0xb7')]=[];_0x3f76a5[_0xdf8e('0xba')][_0xdf8e('0xb7')]['push'](_0x2633a9[_0xdf8e('0xba')]);return _0x3f76a5;});})[_0xdf8e('0x22')](function(_0x105290){respondWithRpcPromise(_0xdf8e('0xbb'),_0xdf8e('0xbb'),{'FaxAccountId':_['isNil'](_0x1cd3b3[_0xdf8e('0x63')]['id'])?undefined:_0x1cd3b3[_0xdf8e('0x63')]['id'],'path':_[_0xdf8e('0xac')](_0x1cd3b3['body']['attachments'][0x0][_0xdf8e('0x7')])?undefined:_0x1cd3b3[_0xdf8e('0x5d')]['attachments'][0x0][_0xdf8e('0x7')],'fax':_[_0xdf8e('0xac')](_0x1cd3b3[_0xdf8e('0x5d')]['to'][0x0])?undefined:_0x1cd3b3[_0xdf8e('0x5d')]['to'][0x0],'AttachmentId':_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][0x0]['id']},client9002)['then'](function(_0x463247){logger['info'](_0xdf8e('0xbc'),_0x463247);})[_0xdf8e('0x2c')](function(_0x3a9996){logger[_0xdf8e('0x23')](_0xdf8e('0xbc'),_0x3a9996);});return _0x105290;})[_0xdf8e('0x22')](respondWithResult(_0x1854c5,null))[_0xdf8e('0x2c')](handleError(_0x1854c5,null));};exports[_0xdf8e('0xbd')]=function(_0x1c4986,_0x3ef965,_0x57e869){return db[_0xdf8e('0x52')][_0xdf8e('0x5b')]({'where':{'id':_0x1c4986[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x3ef965,null))[_0xdf8e('0x22')](function(_0x56c497){if(_0x56c497){return _0x56c497[_0xdf8e('0xbd')](_0x1c4986['body'][_0xdf8e('0x70')],_[_0xdf8e('0x73')](_0x1c4986[_0xdf8e('0x5d')],[_0xdf8e('0x70'),'id'])||{})['spread'](function(_0x1c7a72){for(var _0x480539=0x0;_0x480539<_0x1c4986['body'][_0xdf8e('0x70')]['length'];_0x480539+=0x1){socket[_0xdf8e('0xbe')](_0xdf8e('0xbf'),{'UserId':_0x1c4986[_0xdf8e('0x5d')][_0xdf8e('0x70')][_0x480539],'FaxAccountId':_0x1c4986['params']['id']});}return _0x1c7a72;});}})[_0xdf8e('0x22')](respondWithResult(_0x3ef965,null))[_0xdf8e('0x2c')](handleError(_0x3ef965,null));};exports[_0xdf8e('0xc0')]=function(_0x283336,_0xa5c62,_0x5f1a4f){return db['FaxAccount']['find']({'where':{'id':_0x283336[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0xa5c62,null))['then'](function(_0x194fdf){if(_0x194fdf){return _0x194fdf[_0xdf8e('0xc0')](_0x283336[_0xdf8e('0x40')][_0xdf8e('0x70')])['then'](function(){if(_[_0xdf8e('0xc1')](_0x283336[_0xdf8e('0x40')][_0xdf8e('0x70')])){for(var _0x37ec49=0x0;_0x37ec49<_0x283336[_0xdf8e('0x40')][_0xdf8e('0x70')][_0xdf8e('0x46')];_0x37ec49+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x283336[_0xdf8e('0x40')]['ids'][_0x37ec49]),'FaxAccountId':Number(_0x283336[_0xdf8e('0x63')]['id'])});}}else{socket['emit'](_0xdf8e('0xc2'),{'UserId':Number(_0x283336[_0xdf8e('0x40')][_0xdf8e('0x70')]),'FaxAccountId':Number(_0x283336[_0xdf8e('0x63')]['id'])});}});}})[_0xdf8e('0x22')](respondWithStatusCode(_0xa5c62,null))[_0xdf8e('0x2c')](handleError(_0xa5c62,null));};exports['getAgents']=function(_0x1346c1,_0x5ee15b,_0x47f3bc){var _0x476d62={};var _0x101269={};var _0x21c276;var _0x349151;return db[_0xdf8e('0x52')][_0xdf8e('0x69')]({'where':{'id':_0x1346c1[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x5ee15b,null))[_0xdf8e('0x22')](function(_0x337db6){if(_0x337db6){_0x21c276=_0x337db6;_0x101269[_0xdf8e('0x42')]=_['keys'](db[_0xdf8e('0xc3')][_0xdf8e('0x59')]);_0x101269[_0xdf8e('0x40')]=_['keys'](_0x1346c1[_0xdf8e('0x40')]);_0x101269[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0x101269[_0xdf8e('0x42')],_0x101269['query']);_0x476d62['attributes']=_[_0xdf8e('0x44')](_0x101269[_0xdf8e('0x42')],qs[_0xdf8e('0x45')](_0x1346c1[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x476d62[_0xdf8e('0x43')]=_0x476d62[_0xdf8e('0x43')][_0xdf8e('0x46')]?_0x476d62['attributes']:_0x101269[_0xdf8e('0x42')];_0x476d62[_0xdf8e('0x6a')]=qs[_0xdf8e('0x4b')](_0x1346c1[_0xdf8e('0x40')]['sort']);_0x476d62[_0xdf8e('0x4c')]=qs[_0xdf8e('0x41')](_[_0xdf8e('0x4d')](_0x1346c1[_0xdf8e('0x40')],_0x101269[_0xdf8e('0x41')]));if(_0x1346c1[_0xdf8e('0x40')][_0xdf8e('0x4e')]){_0x476d62[_0xdf8e('0x4c')]=_[_0xdf8e('0x4f')](_0x476d62[_0xdf8e('0x4c')],{'$or':_[_0xdf8e('0x3d')](_0x476d62[_0xdf8e('0x43')],function(_0x2e0919){var _0x56f111={};_0x56f111[_0x2e0919]={'$like':'%'+_0x1346c1[_0xdf8e('0x40')][_0xdf8e('0x4e')]+'%'};return _0x56f111;})});}_0x476d62=_[_0xdf8e('0x4f')]({},_0x476d62,_0x1346c1[_0xdf8e('0x51')]);return _0x21c276[_0xdf8e('0xc4')](_0x476d62);}})[_0xdf8e('0x22')](function(_0x3ddd02){if(_0x3ddd02){_0x349151=_0x3ddd02[_0xdf8e('0x46')];if(!_0x1346c1[_0xdf8e('0x40')]['hasOwnProperty'](_0xdf8e('0x48'))){_0x476d62['limit']=qs[_0xdf8e('0x49')](_0x1346c1[_0xdf8e('0x40')][_0xdf8e('0x49')]);_0x476d62['offset']=qs[_0xdf8e('0x4a')](_0x1346c1[_0xdf8e('0x40')][_0xdf8e('0x4a')]);}return _0x21c276[_0xdf8e('0xc4')](_0x476d62);}})['then'](function(_0x4adaa2){if(_0x4adaa2){return _0x4adaa2?{'count':_0x349151,'rows':_0x4adaa2}:null;}})[_0xdf8e('0x22')](respondWithResult(_0x5ee15b,null))[_0xdf8e('0x2c')](handleError(_0x5ee15b,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 39840e9..4596c05 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 _0xacc1=['remove','emit','hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xacc1,0x194));var _0x1acc=function(_0x322e55,_0x5dd59b){_0x322e55=_0x322e55-0x0;var _0x1dbc5c=_0xacc1[_0x322e55];return _0x1dbc5c;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x1acc('0x0'))['db'][_0x1acc('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x1acc('0x2')](0x0);var events={'afterCreate':_0x1acc('0x3'),'afterUpdate':'update','afterDestroy':_0x1acc('0x4')};function emitEvent(_0x288503){return function(_0x4b6877,_0x30e356,_0x14a5e3){FaxAccountEvents[_0x1acc('0x5')](_0x288503+':'+_0x4b6877['id'],_0x4b6877);FaxAccountEvents[_0x1acc('0x5')](_0x288503,_0x4b6877);_0x14a5e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x1acc('0x6')](e,emitEvent(event));}}module[_0x1acc('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x8bc8=['update','emit','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x5506ac,_0x2254ee){var _0x2ae1c7=function(_0x99c9f9){while(--_0x99c9f9){_0x5506ac['push'](_0x5506ac['shift']());}};_0x2ae1c7(++_0x2254ee);}(_0x8bc8,0xc4));var _0x88bc=function(_0x418c3a,_0xafc508){_0x418c3a=_0x418c3a-0x0;var _0x5ebf73=_0x8bc8[_0x418c3a];return _0x5ebf73;};'use strict';var EventEmitter=require(_0x88bc('0x0'));var FaxAccount=require(_0x88bc('0x1'))['db'][_0x88bc('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x88bc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x88bc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4d3509){return function(_0x5141d6,_0x49057f,_0x6a6b59){FaxAccountEvents['emit'](_0x4d3509+':'+_0x5141d6['id'],_0x5141d6);FaxAccountEvents[_0x88bc('0x5')](_0x4d3509,_0x5141d6);_0x6a6b59(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x88bc('0x6')](e,emitEvent(event));}}module[_0x88bc('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 0132361..3c805d1 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 _0x9ff2=['path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x47e036,_0x2cd6da){var _0xfc6cf1=function(_0x514612){while(--_0x514612){_0x47e036['push'](_0x47e036['shift']());}};_0xfc6cf1(++_0x2cd6da);}(_0x9ff2,0x73));var _0x29ff=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x9ff2[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x29ff('0x0'));var util=require('util');var logger=require(_0x29ff('0x1'))(_0x29ff('0x2'));var moment=require(_0x29ff('0x3'));var BPromise=require(_0x29ff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29ff('0x5'));var rimraf=require(_0x29ff('0x6'));var config=require(_0x29ff('0x7'));var attributes=require(_0x29ff('0x8'));module[_0x29ff('0x9')]=function(_0x383822,_0x525d32){return _0x383822[_0x29ff('0xa')]('FaxAccount',attributes,{'tableName':_0x29ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a87=['path','rimraf','./faxAccount.attributes','exports','FaxAccount','fax_accounts','util','../../config/logger','api','request-promise'];(function(_0x2ab50a,_0x1184bf){var _0x4e54b0=function(_0x508e66){while(--_0x508e66){_0x2ab50a['push'](_0x2ab50a['shift']());}};_0x4e54b0(++_0x1184bf);}(_0x7a87,0xe2));var _0x77a8=function(_0x276076,_0x4d9d3a){_0x276076=_0x276076-0x0;var _0x385642=_0x7a87[_0x276076];return _0x385642;};'use strict';var _=require('lodash');var util=require(_0x77a8('0x0'));var logger=require(_0x77a8('0x1'))(_0x77a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x77a8('0x3'));var fs=require('fs');var path=require(_0x77a8('0x4'));var rimraf=require(_0x77a8('0x5'));var config=require('../../config/environment');var attributes=require(_0x77a8('0x6'));module[_0x77a8('0x7')]=function(_0x78a3d,_0x10aad3){return _0x78a3d['define'](_0x77a8('0x8'),attributes,{'tableName':_0x77a8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 8e07297..f72609c 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 _0xabf5=['keys','createdAt','updatedAt','ListId','body','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','DESC','FaxApplication','get','applications','Applications','list','orderBy','priority','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','unmanaged','*,*,*,*','FaxMessage','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference'];(function(_0x1376e7,_0x5e4644){var _0x1917d2=function(_0x28ccd5){while(--_0x28ccd5){_0x1376e7['push'](_0x1376e7['shift']());}};_0x1917d2(++_0x5e4644);}(_0xabf5,0x88));var _0x5abf=function(_0x261369,_0x525896){_0x261369=_0x261369-0x0;var _0xb03456=_0xabf5[_0x261369];return _0xb03456;};'use strict';var _=require('lodash');var util=require(_0x5abf('0x0'));var moment=require(_0x5abf('0x1'));var BPromise=require(_0x5abf('0x2'));var rs=require(_0x5abf('0x3'));var fs=require('fs');var Redis=require(_0x5abf('0x4'));var db=require(_0x5abf('0x5'))['db'];var utils=require(_0x5abf('0x6'));var logger=require(_0x5abf('0x7'))(_0x5abf('0x8'));var config=require(_0x5abf('0x9'));var jayson=require(_0x5abf('0xa'));var client=jayson[_0x5abf('0xb')][_0x5abf('0xc')]({'port':0x232c});config[_0x5abf('0xd')]=_[_0x5abf('0xe')](config[_0x5abf('0xd')],{'host':_0x5abf('0xf'),'port':0x18eb});var socket=require(_0x5abf('0x10'))(new Redis(config['redis']));require(_0x5abf('0x11'))['register'](socket);function respondWithRpcPromise(_0x568d4c,_0x316fa0,_0x3a4c0a){return new BPromise(function(_0x170cb7,_0xa42018){return client[_0x5abf('0x12')](_0x568d4c,_0x3a4c0a)[_0x5abf('0x13')](function(_0x37dc39){logger['info'](_0x5abf('0x14'),_0x316fa0,_0x5abf('0x15'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x316fa0,_0x5abf('0x15'),JSON['stringify'](_0x37dc39));if(_0x37dc39[_0x5abf('0x16')]){if(_0x37dc39['error'][_0x5abf('0x17')]===0x1f4){logger['error'](_0x5abf('0x14'),_0x316fa0,_0x37dc39[_0x5abf('0x16')]['message']);return _0xa42018(_0x37dc39[_0x5abf('0x16')]['message']);}logger[_0x5abf('0x16')](_0x5abf('0x14'),_0x316fa0,_0x37dc39[_0x5abf('0x16')]['message']);return _0x170cb7(_0x37dc39[_0x5abf('0x16')][_0x5abf('0x18')]);}else{logger[_0x5abf('0x19')](_0x5abf('0x14'),_0x316fa0,_0x5abf('0x15'));_0x170cb7(_0x37dc39[_0x5abf('0x1a')][_0x5abf('0x18')]);}})[_0x5abf('0x1b')](function(_0x5dedba){logger[_0x5abf('0x16')](_0x5abf('0x14'),_0x316fa0,_0x5dedba);_0xa42018(_0x5dedba);});});}exports[_0x5abf('0x1c')]=function(_0x2aad99){var _0x31df97=this;return new Promise(function(_0xf28d6a,_0x48dad7){return db[_0x5abf('0x1d')][_0x5abf('0x1e')]({'raw':_0x2aad99[_0x5abf('0x1f')]?_0x2aad99[_0x5abf('0x1f')][_0x5abf('0x20')]===undefined?!![]:![]:!![],'where':_0x2aad99['options']?_0x2aad99[_0x5abf('0x1f')]['where']||null:null,'attributes':_0x2aad99['options']?_0x2aad99[_0x5abf('0x1f')][_0x5abf('0x21')]||null:null,'limit':_0x2aad99['options']?_0x2aad99[_0x5abf('0x1f')][_0x5abf('0x22')]||null:null,'include':_0x2aad99[_0x5abf('0x1f')]?_0x2aad99[_0x5abf('0x1f')][_0x5abf('0x23')]?_[_0x5abf('0x24')](_0x2aad99['options'][_0x5abf('0x23')],function(_0x3a83a9){return{'model':db[_0x3a83a9[_0x5abf('0x25')]],'as':_0x3a83a9['as'],'attributes':_0x3a83a9[_0x5abf('0x21')],'include':_0x3a83a9['include']?_['map'](_0x3a83a9['include'],function(_0x23dc4b){return{'model':db[_0x23dc4b[_0x5abf('0x25')]],'as':_0x23dc4b['as'],'attributes':_0x23dc4b[_0x5abf('0x21')],'include':_0x23dc4b['include']?_[_0x5abf('0x24')](_0x23dc4b['include'],function(_0x2a95cf){return{'model':db[_0x2a95cf[_0x5abf('0x25')]],'as':_0x2a95cf['as'],'attributes':_0x2a95cf[_0x5abf('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c63c1){logger[_0x5abf('0x19')](_0x5abf('0x1c'),_0x2aad99);logger[_0x5abf('0x26')](_0x5abf('0x1c'),_0x2aad99,JSON[_0x5abf('0x27')](_0x4c63c1));_0xf28d6a(_0x4c63c1);})[_0x5abf('0x1b')](function(_0x5d0eb7){logger[_0x5abf('0x16')]('GetFaxAccount',_0x5d0eb7[_0x5abf('0x18')],_0x2aad99);_0x48dad7(_0x31df97[_0x5abf('0x16')](0x1f4,_0x5d0eb7[_0x5abf('0x18')]));});});};exports[_0x5abf('0x28')]=function(_0x4e4b5f,_0x550710,_0xecd507){var _0x245afb=this;return new Promise(function(_0x43a50a,_0x552e7c){var _0x346ebb={'body':_0x4e4b5f['body'],'channel':_0x5abf('0x29')};var _0x4b551e=[];var _0x1af3e0=[];var _0x4a81f7={};return db[_0x5abf('0x2a')][_0x5abf('0x2b')]()[_0x5abf('0x13')](function(_0x11730e){if(!_0x11730e){throw new db[(_0x5abf('0x2c'))][(_0x5abf('0x2d'))](_0x5abf('0x2e'));}_0x4b551e=_[_0x5abf('0x2f')](_[_0x5abf('0x30')](_0x11730e),[_0x5abf('0x31'),_0x5abf('0x32')]);_0x1af3e0=_[_0x5abf('0x2f')](_[_0x5abf('0x30')](_0x11730e),[_0x5abf('0x31'),'updatedAt','CompanyId',_0x5abf('0x33')]);if(_0x4e4b5f[_0x5abf('0x34')]['id']){delete _0x4e4b5f['body']['id'];}if(_['isNil'](_0x4e4b5f['body'][_0x5abf('0x35')])){throw new db[(_0x5abf('0x2c'))][(_0x5abf('0x2d'))]('from\x20is\x20mandatory');}if(_[_0x5abf('0x36')](_0x4e4b5f['body'][_0x5abf('0x34')])||_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x34')]===''){throw new db[(_0x5abf('0x2c'))][(_0x5abf('0x2d'))](_0x5abf('0x37'));}if(_[_0x5abf('0x36')](_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x38')])){throw new db[(_0x5abf('0x2c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1af3e0);}if(!_['includes'](_0x1af3e0,_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x38')])){throw new db[(_0x5abf('0x2c'))][(_0x5abf('0x2d'))](_0x5abf('0x39')+_0x1af3e0);}_0x4a81f7[_0x4e4b5f[_0x5abf('0x34')]['mapKey']]=_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x35')];})['then'](function(){return db[_0x5abf('0x1d')][_0x5abf('0x3a')]({'where':{'id':_0x4e4b5f[_0x5abf('0x3b')]['id']},'include':[{'model':db['CmList'],'as':_0x5abf('0x3c'),'include':[{'model':db[_0x5abf('0x2a')],'as':_0x5abf('0x3d'),'where':_0x4a81f7,'limit':0x1,'order':[[_0x5abf('0x32'),_0x5abf('0x3e')]]}]},{'model':db[_0x5abf('0x3f')],'as':'Applications'}]});})[_0x5abf('0x13')](function(_0x4825cd){if(_0x4825cd&&_0x4825cd[_0x5abf('0x3c')]){var _0x38d82c=_0x4825cd[_0x5abf('0x40')]({'plain':!![]});_0x346ebb[_0x5abf('0x3b')]=_0x38d82c;_0x346ebb[_0x5abf('0x41')]=_0x38d82c[_0x5abf('0x42')];_0x346ebb[_0x5abf('0x43')]=_0x38d82c['List'];_0x346ebb[_0x5abf('0x41')]=_[_0x5abf('0x44')](_0x346ebb[_0x5abf('0x41')],[_0x5abf('0x45')],['asc']);if(_0x346ebb[_0x5abf('0x3b')]['Applications']){delete _0x346ebb['account']['Applications'];}if(_0x346ebb[_0x5abf('0x3b')][_0x5abf('0x3c')]&&_0x346ebb[_0x5abf('0x3b')][_0x5abf('0x3c')]['Contacts']['length']){return _0x346ebb[_0x5abf('0x3b')][_0x5abf('0x3c')][_0x5abf('0x3d')][0x0];}var _0x4d1635=_[_0x5abf('0xe')](_0x4e4b5f['body'],{'firstName':_0x4e4b5f[_0x5abf('0x34')]['from'],'ListId':_0x38d82c[_0x5abf('0x33')]});_0x4d1635[_0x4e4b5f['body'][_0x5abf('0x38')]]=_0x4e4b5f[_0x5abf('0x34')]['from'];return db[_0x5abf('0x2a')][_0x5abf('0x46')](_0x4d1635,{'fields':_0x4b551e,'raw':!![]});}})[_0x5abf('0x13')](function(_0x1a7033){_0x346ebb[_0x5abf('0x47')]=_0x1a7033;if(_0x1a7033){var _0x23e686={'ContactId':_0x1a7033['id'],'FaxAccountId':_0x4e4b5f[_0x5abf('0x3b')]['id'],'fax':_0x1a7033[_0x5abf('0x29')]};return db[_0x5abf('0x48')][_0x5abf('0x3a')]({'where':{'ContactId':_0x1a7033['id'],'closed':![],'FaxAccountId':_0x4e4b5f[_0x5abf('0x3b')]['id']}})[_0x5abf('0x13')](function(_0x1f5d2a){if(_0x1f5d2a){return[_0x1f5d2a,![]];}return db[_0x5abf('0x48')]['create'](_0x23e686)[_0x5abf('0x13')](function(_0x1bbf81){return[_0x1bbf81,!![]];});});}else{throw new Error(_0x5abf('0x49'));}})[_0x5abf('0x4a')](function(_0x538a99,_0x4b5011){var _0x1529bd=_0x538a99['get']({'plain':!![]});if(_0x4b5011){if(_0x346ebb[_0x5abf('0x3b')][_0x5abf('0x4b')]){_0x346ebb[_0x5abf('0x41')][_0x5abf('0x4c')]({'id':0x0,'priority':_0x346ebb[_0x5abf('0x41')][_0x5abf('0x4d')]+0x1,'app':_0x5abf('0x4e'),'appdata':_0x5abf('0x4f'),'interval':_0x5abf('0x50')});}_0x1529bd['created']=!![];}else{_0x1529bd['created']=![];}_0x346ebb['interaction']=_0x1529bd;return db[_0x5abf('0x51')][_0x5abf('0x46')]({'body':_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x34')],'FaxAccountId':_0x4e4b5f[_0x5abf('0x3b')]['id'],'FaxInteractionId':_0x538a99['id'],'direction':'in','ContactId':_0x538a99['ContactId'],'AttachmentId':_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x52')]});})[_0x5abf('0x13')](function(_0x3bcaac){_0x346ebb[_0x5abf('0x18')]=_0x3bcaac;if(_0x346ebb[_0x5abf('0x53')][_0x5abf('0x54')]){return db[_0x5abf('0x55')][_0x5abf('0x3a')]({'attributes':['id',_0x5abf('0x56')],'where':{'id':_0x346ebb['interaction'][_0x5abf('0x54')]}})[_0x5abf('0x13')](function(_0x232c88){if(_0x232c88){_0x346ebb[_0x5abf('0x41')][_0x5abf('0x57')]({'id':0x0,'priority':0x0,'app':_0x5abf('0x58'),'appdata':_0x232c88[_0x5abf('0x56')]+','+(_0x346ebb['account'][_0x5abf('0x59')]||0xa),'interval':_0x5abf('0x50')});}return respondWithRpcPromise(_0x5abf('0x5a'),_0x5abf('0x5b'),_0x346ebb);});}return respondWithRpcPromise(_0x5abf('0x5a'),_0x5abf('0x5b'),_0x346ebb);})[_0x5abf('0x13')](function(_0x3979df){_0x43a50a(_0x3979df);})[_0x5abf('0x1b')](function(_0x4816e1){_0x552e7c(_0x245afb[_0x5abf('0x16')](0x1f4,_0x4816e1[_0x5abf('0x18')]));});});}; \ No newline at end of file +var _0xc196=['../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxAccount','options','raw','attributes','include','map','model','then','debug','GetFaxAccount','catch','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','FaxApplication','Applications','get','applications','list','List','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','created','ContactId','AttachmentId','UserId','name','interaction','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x451a2a,_0x1266c5){var _0x3a9b24=function(_0x41e7e8){while(--_0x41e7e8){_0x451a2a['push'](_0x451a2a['shift']());}};_0x3a9b24(++_0x1266c5);}(_0xc196,0x15d));var _0x6c19=function(_0x5589cb,_0x2a71e9){_0x5589cb=_0x5589cb-0x0;var _0x2399b0=_0xc196[_0x5589cb];return _0x2399b0;};'use strict';var _=require(_0x6c19('0x0'));var util=require(_0x6c19('0x1'));var moment=require(_0x6c19('0x2'));var BPromise=require(_0x6c19('0x3'));var rs=require(_0x6c19('0x4'));var fs=require('fs');var Redis=require(_0x6c19('0x5'));var db=require(_0x6c19('0x6'))['db'];var utils=require(_0x6c19('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6c19('0x8'));var jayson=require(_0x6c19('0x9'));var client=jayson[_0x6c19('0xa')][_0x6c19('0xb')]({'port':0x232c});config[_0x6c19('0xc')]=_[_0x6c19('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6c19('0xe'))(new Redis(config['redis']));require(_0x6c19('0xf'))['register'](socket);function respondWithRpcPromise(_0x534896,_0x17c3ba,_0x1c60c4){return new BPromise(function(_0x47ec2a,_0x194267){return client[_0x6c19('0x10')](_0x534896,_0x1c60c4)['then'](function(_0x207ea6){logger[_0x6c19('0x11')](_0x6c19('0x12'),_0x17c3ba,'request\x20sent');logger['debug'](_0x6c19('0x13'),_0x17c3ba,_0x6c19('0x14'),JSON[_0x6c19('0x15')](_0x207ea6));if(_0x207ea6[_0x6c19('0x16')]){if(_0x207ea6[_0x6c19('0x16')][_0x6c19('0x17')]===0x1f4){logger[_0x6c19('0x16')]('FaxAccount,\x20%s,\x20%s',_0x17c3ba,_0x207ea6[_0x6c19('0x16')][_0x6c19('0x18')]);return _0x194267(_0x207ea6[_0x6c19('0x16')][_0x6c19('0x18')]);}logger[_0x6c19('0x16')](_0x6c19('0x12'),_0x17c3ba,_0x207ea6[_0x6c19('0x16')][_0x6c19('0x18')]);return _0x47ec2a(_0x207ea6[_0x6c19('0x16')]['message']);}else{logger['info'](_0x6c19('0x12'),_0x17c3ba,_0x6c19('0x14'));_0x47ec2a(_0x207ea6['result'][_0x6c19('0x18')]);}})['catch'](function(_0x40beb9){logger[_0x6c19('0x16')](_0x6c19('0x12'),_0x17c3ba,_0x40beb9);_0x194267(_0x40beb9);});});}exports['GetFaxAccount']=function(_0x1a2650){var _0x5e63b5=this;return new Promise(function(_0x19e647,_0x82f413){return db[_0x6c19('0x19')]['findAll']({'raw':_0x1a2650[_0x6c19('0x1a')]?_0x1a2650['options'][_0x6c19('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a2650[_0x6c19('0x1a')]?_0x1a2650[_0x6c19('0x1a')]['where']||null:null,'attributes':_0x1a2650[_0x6c19('0x1a')]?_0x1a2650[_0x6c19('0x1a')][_0x6c19('0x1c')]||null:null,'limit':_0x1a2650['options']?_0x1a2650['options']['limit']||null:null,'include':_0x1a2650['options']?_0x1a2650[_0x6c19('0x1a')][_0x6c19('0x1d')]?_[_0x6c19('0x1e')](_0x1a2650[_0x6c19('0x1a')][_0x6c19('0x1d')],function(_0x38cf7e){return{'model':db[_0x38cf7e['model']],'as':_0x38cf7e['as'],'attributes':_0x38cf7e[_0x6c19('0x1c')],'include':_0x38cf7e[_0x6c19('0x1d')]?_[_0x6c19('0x1e')](_0x38cf7e[_0x6c19('0x1d')],function(_0x591eb3){return{'model':db[_0x591eb3['model']],'as':_0x591eb3['as'],'attributes':_0x591eb3[_0x6c19('0x1c')],'include':_0x591eb3[_0x6c19('0x1d')]?_[_0x6c19('0x1e')](_0x591eb3['include'],function(_0x2a8d22){return{'model':db[_0x2a8d22[_0x6c19('0x1f')]],'as':_0x2a8d22['as'],'attributes':_0x2a8d22[_0x6c19('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6c19('0x20')](function(_0x17c42e){logger['info']('GetFaxAccount',_0x1a2650);logger[_0x6c19('0x21')](_0x6c19('0x22'),_0x1a2650,JSON['stringify'](_0x17c42e));_0x19e647(_0x17c42e);})[_0x6c19('0x23')](function(_0x45e02d){logger[_0x6c19('0x16')](_0x6c19('0x22'),_0x45e02d[_0x6c19('0x18')],_0x1a2650);_0x82f413(_0x5e63b5[_0x6c19('0x16')](0x1f4,_0x45e02d[_0x6c19('0x18')]));});});};exports[_0x6c19('0x24')]=function(_0x3d2a2d,_0x5f065f,_0x34d14c){var _0xe66d2=this;return new Promise(function(_0x2f42f8,_0x2be580){var _0x2d20f5={'body':_0x3d2a2d[_0x6c19('0x25')],'channel':_0x6c19('0x26')};var _0x584a5d=[];var _0x507f8e=[];var _0x584608={};return db['CmContact'][_0x6c19('0x27')]()[_0x6c19('0x20')](function(_0x36ce4a){if(!_0x36ce4a){throw new db[(_0x6c19('0x28'))][(_0x6c19('0x29'))]('no\x20available\x20attributes');}_0x584a5d=_[_0x6c19('0x2a')](_[_0x6c19('0x2b')](_0x36ce4a),[_0x6c19('0x2c'),_0x6c19('0x2d')]);_0x507f8e=_['difference'](_[_0x6c19('0x2b')](_0x36ce4a),['createdAt',_0x6c19('0x2d'),_0x6c19('0x2e'),_0x6c19('0x2f')]);if(_0x3d2a2d['body']['id']){delete _0x3d2a2d[_0x6c19('0x25')]['id'];}if(_[_0x6c19('0x30')](_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x31')])){throw new db[(_0x6c19('0x28'))][(_0x6c19('0x29'))]('from\x20is\x20mandatory');}if(_[_0x6c19('0x30')](_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x25')])||_0x3d2a2d['body']['body']===''){throw new db[(_0x6c19('0x28'))]['ValidationError'](_0x6c19('0x32'));}if(_[_0x6c19('0x30')](_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x33')])){throw new db[(_0x6c19('0x28'))][(_0x6c19('0x29'))](_0x6c19('0x34')+_0x507f8e);}if(!_['includes'](_0x507f8e,_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x33')])){throw new db[(_0x6c19('0x28'))][(_0x6c19('0x29'))](_0x6c19('0x35')+_0x507f8e);}_0x584608[_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x33')]]=_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x31')];})[_0x6c19('0x20')](function(){return db[_0x6c19('0x19')][_0x6c19('0x36')]({'where':{'id':_0x3d2a2d[_0x6c19('0x37')]['id']},'include':[{'model':db[_0x6c19('0x38')],'as':'List','include':[{'model':db['CmContact'],'as':_0x6c19('0x39'),'where':_0x584608,'limit':0x1,'order':[[_0x6c19('0x2d'),_0x6c19('0x3a')]]}]},{'model':db[_0x6c19('0x3b')],'as':_0x6c19('0x3c')}]});})[_0x6c19('0x20')](function(_0x3d9278){if(_0x3d9278&&_0x3d9278['List']){var _0x4101c=_0x3d9278[_0x6c19('0x3d')]({'plain':!![]});_0x2d20f5[_0x6c19('0x37')]=_0x4101c;_0x2d20f5[_0x6c19('0x3e')]=_0x4101c[_0x6c19('0x3c')];_0x2d20f5[_0x6c19('0x3f')]=_0x4101c[_0x6c19('0x40')];_0x2d20f5[_0x6c19('0x3e')]=_[_0x6c19('0x41')](_0x2d20f5[_0x6c19('0x3e')],[_0x6c19('0x42')],[_0x6c19('0x43')]);if(_0x2d20f5[_0x6c19('0x37')][_0x6c19('0x3c')]){delete _0x2d20f5[_0x6c19('0x37')][_0x6c19('0x3c')];}if(_0x2d20f5[_0x6c19('0x37')][_0x6c19('0x40')]&&_0x2d20f5['account'][_0x6c19('0x40')]['Contacts'][_0x6c19('0x44')]){return _0x2d20f5['account'][_0x6c19('0x40')]['Contacts'][0x0];}var _0x44099d=_['defaults'](_0x3d2a2d[_0x6c19('0x25')],{'firstName':_0x3d2a2d['body'][_0x6c19('0x31')],'ListId':_0x4101c[_0x6c19('0x2f')]});_0x44099d[_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x33')]]=_0x3d2a2d['body'][_0x6c19('0x31')];return db['CmContact'][_0x6c19('0x45')](_0x44099d,{'fields':_0x584a5d,'raw':!![]});}})['then'](function(_0x15576c){_0x2d20f5[_0x6c19('0x46')]=_0x15576c;if(_0x15576c){var _0x32c6e4={'ContactId':_0x15576c['id'],'FaxAccountId':_0x3d2a2d[_0x6c19('0x37')]['id'],'fax':_0x15576c['fax']};return db[_0x6c19('0x47')][_0x6c19('0x36')]({'where':{'ContactId':_0x15576c['id'],'closed':![],'FaxAccountId':_0x3d2a2d[_0x6c19('0x37')]['id']}})[_0x6c19('0x20')](function(_0x77e9b2){if(_0x77e9b2){return[_0x77e9b2,![]];}return db[_0x6c19('0x47')]['create'](_0x32c6e4)[_0x6c19('0x20')](function(_0x269346){return[_0x269346,!![]];});});}else{throw new Error(_0x6c19('0x48'));}})[_0x6c19('0x49')](function(_0x5c54ef,_0x3b0018){var _0x33d1d2=_0x5c54ef[_0x6c19('0x3d')]({'plain':!![]});if(_0x3b0018){if(_0x2d20f5[_0x6c19('0x37')][_0x6c19('0x4a')]){_0x2d20f5[_0x6c19('0x3e')][_0x6c19('0x4b')]({'id':0x0,'priority':_0x2d20f5[_0x6c19('0x3e')][_0x6c19('0x44')]+0x1,'app':_0x6c19('0x4c'),'appdata':_0x6c19('0x4d'),'interval':'*,*,*,*'});}_0x33d1d2[_0x6c19('0x4e')]=!![];}else{_0x33d1d2['created']=![];}_0x2d20f5['interaction']=_0x33d1d2;return db['FaxMessage'][_0x6c19('0x45')]({'body':_0x3d2a2d[_0x6c19('0x25')]['body'],'FaxAccountId':_0x3d2a2d[_0x6c19('0x37')]['id'],'FaxInteractionId':_0x5c54ef['id'],'direction':'in','ContactId':_0x5c54ef[_0x6c19('0x4f')],'AttachmentId':_0x3d2a2d['body'][_0x6c19('0x50')]});})[_0x6c19('0x20')](function(_0x13aed0){_0x2d20f5[_0x6c19('0x18')]=_0x13aed0;if(_0x2d20f5['interaction'][_0x6c19('0x51')]){return db['User'][_0x6c19('0x36')]({'attributes':['id',_0x6c19('0x52')],'where':{'id':_0x2d20f5[_0x6c19('0x53')][_0x6c19('0x51')]}})['then'](function(_0x482911){if(_0x482911){_0x2d20f5[_0x6c19('0x3e')][_0x6c19('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x482911[_0x6c19('0x52')]+','+(_0x2d20f5[_0x6c19('0x37')][_0x6c19('0x55')]||0xa),'interval':_0x6c19('0x56')});}return respondWithRpcPromise(_0x6c19('0x57'),_0x6c19('0x58'),_0x2d20f5);});}return respondWithRpcPromise(_0x6c19('0x57'),_0x6c19('0x58'),_0x2d20f5);})[_0x6c19('0x20')](function(_0xd59fc2){_0x2f42f8(_0xd59fc2);})[_0x6c19('0x23')](function(_0x32e72a){_0x2be580(_0xe66d2[_0x6c19('0x16')](0x1f4,_0x32e72a[_0x6c19('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 2e3b893..cad25c4 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 _0x77d4=['save','update','removeListener','register'];(function(_0x30d05c,_0x5e3d55){var _0x16eca7=function(_0x50d495){while(--_0x50d495){_0x30d05c['push'](_0x30d05c['shift']());}};_0x16eca7(++_0x5e3d55);}(_0x77d4,0x108));var _0x477d=function(_0xde634,_0xbcee9b){_0xde634=_0xde634-0x0;var _0x232588=_0x77d4[_0xde634];return _0x232588;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x477d('0x0'),'remove',_0x477d('0x1')];function createListener(_0x59945b,_0x41bcf1){return function(_0x13ad75){_0x41bcf1['emit'](_0x59945b,_0x13ad75);};}function removeListener(_0x53e1b8,_0x16213f){return function(){FaxAccountEvents[_0x477d('0x2')](_0x53e1b8,_0x16213f);};}exports[_0x477d('0x3')]=function(_0x471fca){for(var _0x2545e5=0x0,_0x45ca2d=events['length'];_0x2545e5<_0x45ca2d;_0x2545e5++){var _0x4f4fb4=events[_0x2545e5];var _0x2dd5d2=createListener('faxAccount:'+_0x4f4fb4,_0x471fca);FaxAccountEvents['on'](_0x4f4fb4,_0x2dd5d2);}}; \ No newline at end of file +var _0xe5af=['faxAccount:','save','remove','register','length'];(function(_0x423b90,_0x2db6fd){var _0x789911=function(_0x1294ff){while(--_0x1294ff){_0x423b90['push'](_0x423b90['shift']());}};_0x789911(++_0x2db6fd);}(_0xe5af,0x9c));var _0xfe5a=function(_0x27fe26,_0x3b8ca7){_0x27fe26=_0x27fe26-0x0;var _0x4fcb35=_0xe5af[_0x27fe26];return _0x4fcb35;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xfe5a('0x0'),_0xfe5a('0x1'),'update'];function createListener(_0x9a3743,_0x1bad12){return function(_0x23b7f0){_0x1bad12['emit'](_0x9a3743,_0x23b7f0);};}function removeListener(_0x1165e3,_0x48e3a7){return function(){FaxAccountEvents['removeListener'](_0x1165e3,_0x48e3a7);};}exports[_0xfe5a('0x2')]=function(_0x2039cd){for(var _0x4e418f=0x0,_0x5eea2e=events[_0xfe5a('0x3')];_0x4e418f<_0x5eea2e;_0x4e418f++){var _0x106492=events[_0x4e418f];var _0xfb4357=createListener(_0xfe5a('0x4')+_0x106492,_0x2039cd);FaxAccountEvents['on'](_0x106492,_0xfb4357);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 5a674cb..bb791eb 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 _0x7cf5=['addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction'];(function(_0x403d12,_0x193238){var _0x67be85=function(_0x3360c8){while(--_0x3360c8){_0x403d12['push'](_0x403d12['shift']());}};_0x67be85(++_0x193238);}(_0x7cf5,0xbf));var _0x57cf=function(_0x1e561f,_0x478648){_0x1e561f=_0x1e561f-0x0;var _0x13b05b=_0x7cf5[_0x1e561f];return _0x13b05b;};'use strict';var multer=require(_0x57cf('0x0'));var util=require(_0x57cf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x57cf('0x2'));var router=express[_0x57cf('0x3')]();var auth=require(_0x57cf('0x4'));var interaction=require(_0x57cf('0x5'));var config=require(_0x57cf('0x6'));var controller=require(_0x57cf('0x7'));router[_0x57cf('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x57cf('0x8')](_0x57cf('0x9'),auth[_0x57cf('0xa')](),controller[_0x57cf('0xb')]);router['get'](_0x57cf('0xc'),auth['isAuthenticated'](),controller[_0x57cf('0xd')]);router[_0x57cf('0x8')](_0x57cf('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x57cf('0x8')]('/:id/canned_answers',auth[_0x57cf('0xa')](),controller[_0x57cf('0xf')]);router['get'](_0x57cf('0x10'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x11')]);router[_0x57cf('0x8')](_0x57cf('0x12'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x13')]);router['get'](_0x57cf('0x14'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x15')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x57cf('0x16')]);router['post']('/',auth[_0x57cf('0xa')](),controller[_0x57cf('0x17')]);router[_0x57cf('0x18')](_0x57cf('0xe'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x19')]);router[_0x57cf('0x18')](_0x57cf('0x1a'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x1b')]);router['post'](_0x57cf('0x10'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x1c')]);router[_0x57cf('0x18')](_0x57cf('0x12'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x1d')]);router['post'](_0x57cf('0x1e'),auth[_0x57cf('0xa')](),controller['addAccountApplications']);router['post'](_0x57cf('0x1f'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x20')]);router['post'](_0x57cf('0x21'),auth[_0x57cf('0xa')](),controller['send']);router['post'](_0x57cf('0x22'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x23')]);router[_0x57cf('0x24')](_0x57cf('0xc'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x25')]);router[_0x57cf('0x26')](_0x57cf('0xc'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x27')]);router[_0x57cf('0x26')](_0x57cf('0xe'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x28')]);router[_0x57cf('0x26')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x57cf('0x29')]);router['delete'](_0x57cf('0x22'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x2a')]);module[_0x57cf('0x2b')]=router; \ No newline at end of file +var _0xf0bf=['/:id/messages','getMessages','/:id/users','post','create','addDisposition','addInteraction','/addaccountapplications','/updateaccountapplications','/:id/send','send','addAgents','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications'];(function(_0x140688,_0x362b7d){var _0x4a3d28=function(_0x489506){while(--_0x489506){_0x140688['push'](_0x140688['shift']());}};_0x4a3d28(++_0x362b7d);}(_0xf0bf,0x88));var _0xff0b=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xf0bf[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0xff0b('0x0'));var util=require(_0xff0b('0x1'));var path=require(_0xff0b('0x2'));var timeout=require(_0xff0b('0x3'));var express=require(_0xff0b('0x4'));var router=express[_0xff0b('0x5')]();var auth=require(_0xff0b('0x6'));var interaction=require(_0xff0b('0x7'));var config=require(_0xff0b('0x8'));var controller=require(_0xff0b('0x9'));router[_0xff0b('0xa')]('/',auth[_0xff0b('0xb')](),controller[_0xff0b('0xc')]);router['get'](_0xff0b('0xd'),auth['isAuthenticated'](),controller[_0xff0b('0xe')]);router[_0xff0b('0xa')](_0xff0b('0xf'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x10')]);router[_0xff0b('0xa')](_0xff0b('0x11'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x12')]);router[_0xff0b('0xa')](_0xff0b('0x13'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x14')]);router[_0xff0b('0xa')](_0xff0b('0x15'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x16')]);router['get'](_0xff0b('0x17'),auth[_0xff0b('0xb')](),controller['getApplications']);router['get'](_0xff0b('0x18'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x19')]);router['get'](_0xff0b('0x1a'),auth[_0xff0b('0xb')](),controller['getAgents']);router[_0xff0b('0x1b')]('/',auth[_0xff0b('0xb')](),controller[_0xff0b('0x1c')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xff0b('0x1d')]);router[_0xff0b('0x1b')](_0xff0b('0x13'),auth[_0xff0b('0xb')](),controller['addAnswer']);router[_0xff0b('0x1b')](_0xff0b('0x15'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x1e')]);router[_0xff0b('0x1b')](_0xff0b('0x17'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0xff0b('0x1f'),auth[_0xff0b('0xb')](),controller['addAccountApplications']);router[_0xff0b('0x1b')](_0xff0b('0x20'),auth[_0xff0b('0xb')](),controller['updateAccountApplications']);router[_0xff0b('0x1b')](_0xff0b('0x21'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x22')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xff0b('0x23')]);router['put'](_0xff0b('0xf'),auth[_0xff0b('0xb')](),controller['update']);router[_0xff0b('0x24')](_0xff0b('0xf'),auth[_0xff0b('0xb')](),controller['destroy']);router[_0xff0b('0x24')](_0xff0b('0x11'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x25')]);router[_0xff0b('0x24')](_0xff0b('0x13'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x26')]);router['delete'](_0xff0b('0x1a'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 95252c0..1d3f2c1 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 _0xcf2e=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x20f084,_0xbedc94){var _0x28afb8=function(_0x5bc83e){while(--_0x5bc83e){_0x20f084['push'](_0x20f084['shift']());}};_0x28afb8(++_0xbedc94);}(_0xcf2e,0x197));var _0xecf2=function(_0x93b411,_0x4263ca){_0x93b411=_0x93b411-0x0;var _0x14ce11=_0xcf2e[_0x93b411];return _0x14ce11;};'use strict';var Sequelize=require(_0xecf2('0x0'));module[_0xecf2('0x1')]={'priority':{'type':Sequelize[_0xecf2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xecf2('0x3')],'allowNull':![],'defaultValue':_0xecf2('0x4')},'appdata':{'type':Sequelize[_0xecf2('0x5')]()},'description':{'type':Sequelize[_0xecf2('0x3')]},'interval':{'type':Sequelize[_0xecf2('0x3')],'defaultValue':_0xecf2('0x6')}}; \ No newline at end of file +var _0xada4=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x5ef4f8,_0x3be741){var _0x555a8b=function(_0x2327b9){while(--_0x2327b9){_0x5ef4f8['push'](_0x5ef4f8['shift']());}};_0x555a8b(++_0x3be741);}(_0xada4,0x1bc));var _0x4ada=function(_0x156be3,_0x4793e1){_0x156be3=_0x156be3-0x0;var _0x146bd0=_0xada4[_0x156be3];return _0x146bd0;};'use strict';var Sequelize=require('sequelize');module[_0x4ada('0x0')]={'priority':{'type':Sequelize[_0x4ada('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4ada('0x2')],'allowNull':![],'defaultValue':_0x4ada('0x3')},'appdata':{'type':Sequelize[_0x4ada('0x4')]()},'description':{'type':Sequelize[_0x4ada('0x2')]},'interval':{'type':Sequelize[_0x4ada('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 2da7804..390e604 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 _0x8ef6=['sort','filters','filter','where','merge','options','count','then','includeAll','include','rows','catch','show','params','keys','length','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','end','error','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','limit','order'];(function(_0x5a4a2e,_0x229265){var _0x312a18=function(_0x12c664){while(--_0x12c664){_0x5a4a2e['push'](_0x5a4a2e['shift']());}};_0x312a18(++_0x229265);}(_0x8ef6,0xf2));var _0x68ef=function(_0x21c721,_0x528197){_0x21c721=_0x21c721-0x0;var _0x4922b1=_0x8ef6[_0x21c721];return _0x4922b1;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x46356f,_0x1e117a){_0x1e117a=_0x1e117a||0xcc;return function(_0x454ef4){if(_0x454ef4){return _0x46356f[_0x68ef('0x1b')](_0x1e117a);}return _0x46356f[_0x68ef('0x1c')](_0x1e117a)['end']();};}function respondWithResult(_0x3b48dd,_0xc50cce){_0xc50cce=_0xc50cce||0xc8;return function(_0x2657c5){if(_0x2657c5){return _0x3b48dd['status'](_0xc50cce)[_0x68ef('0x1d')](_0x2657c5);}};}function respondWithFilteredResult(_0x1764de,_0x24682d){return function(_0x5005ba){if(_0x5005ba){var _0x35493d=_0x5005ba['count'],_0x37c4cc=_0x24682d[_0x68ef('0x1e')],_0x3d1e90=_0x24682d['offset']+_0x24682d['limit'],_0x3780a4;if(_0x3d1e90>=_0x35493d){_0x3d1e90=_0x35493d;_0x3780a4=0xc8;}else{_0x3780a4=0xce;}_0x1764de[_0x68ef('0x1c')](_0x3780a4);return _0x1764de[_0x68ef('0x1f')]('Content-Range',_0x37c4cc+'-'+_0x3d1e90+'/'+_0x35493d)['json'](_0x5005ba);}return null;};}function patchUpdates(_0x3c4c1f){return function(_0x2cd92c){try{jsonpatch[_0x68ef('0x20')](_0x2cd92c,_0x3c4c1f,!![]);}catch(_0x4fad1c){return BPromise[_0x68ef('0x21')](_0x4fad1c);}return _0x2cd92c[_0x68ef('0x22')]();};}function saveUpdates(_0x183f5f,_0x5b246b){return function(_0x3c46d4){if(_0x3c46d4){return _0x3c46d4[_0x68ef('0x23')](_0x183f5f)['then'](function(_0x399da4){return _0x399da4;});}return null;};}function removeEntity(_0xf4760f,_0x19aa3d){return function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7['destroy']()['then'](function(){_0xf4760f[_0x68ef('0x1c')](0xcc)[_0x68ef('0x24')]();});}};}function handleEntityNotFound(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(!_0x438b4c){_0x312cc9[_0x68ef('0x1b')](0x194);}return _0x438b4c;};}function handleError(_0x258cd5,_0x49374f){_0x49374f=_0x49374f||0x1f4;return function(_0x65fd09){logger[_0x68ef('0x25')](_0x65fd09['stack']);if(_0x65fd09[_0x68ef('0x26')]){delete _0x65fd09['name'];}_0x258cd5['status'](_0x49374f)['send'](_0x65fd09);};}exports[_0x68ef('0x27')]=function(_0x268f32,_0x123041){var _0x29518e={},_0x52e67e={},_0x4a0550={'count':0x0,'rows':[]};var _0x1cbe4f=_[_0x68ef('0x28')](db[_0x68ef('0x29')][_0x68ef('0x2a')],function(_0x22ef25){return{'name':_0x22ef25[_0x68ef('0x2b')],'type':_0x22ef25[_0x68ef('0x2c')][_0x68ef('0x2d')]};});_0x52e67e['model']=_[_0x68ef('0x28')](_0x1cbe4f,_0x68ef('0x26'));_0x52e67e[_0x68ef('0x2e')]=_['keys'](_0x268f32[_0x68ef('0x2e')]);_0x52e67e['filters']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],_0x52e67e['query']);_0x29518e['attributes']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],qs['fields'](_0x268f32[_0x68ef('0x2e')][_0x68ef('0x31')]));_0x29518e[_0x68ef('0x32')]=_0x29518e[_0x68ef('0x32')]['length']?_0x29518e[_0x68ef('0x32')]:_0x52e67e[_0x68ef('0x30')];if(!_0x268f32['query'][_0x68ef('0x33')]('nolimit')){_0x29518e[_0x68ef('0x34')]=qs[_0x68ef('0x34')](_0x268f32['query'][_0x68ef('0x34')]);_0x29518e['offset']=qs[_0x68ef('0x1e')](_0x268f32['query'][_0x68ef('0x1e')]);}_0x29518e[_0x68ef('0x35')]=qs[_0x68ef('0x36')](_0x268f32['query'][_0x68ef('0x36')]);_0x29518e['where']=qs[_0x68ef('0x37')](_['pick'](_0x268f32[_0x68ef('0x2e')],_0x52e67e[_0x68ef('0x37')]),_0x1cbe4f);if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x38')]){_0x29518e[_0x68ef('0x39')]=_[_0x68ef('0x3a')](_0x29518e['where'],{'$or':_[_0x68ef('0x28')](_0x1cbe4f,function(_0x15a6ab){if(_0x15a6ab[_0x68ef('0x2c')]!=='VIRTUAL'){var _0x32eddd={};_0x32eddd[_0x15a6ab[_0x68ef('0x26')]]={'$like':'%'+_0x268f32[_0x68ef('0x2e')]['filter']+'%'};return _0x32eddd;}})});}_0x29518e=_['merge']({},_0x29518e,_0x268f32[_0x68ef('0x3b')]);var _0xec7de3={'where':_0x29518e[_0x68ef('0x39')]};return db[_0x68ef('0x29')][_0x68ef('0x3c')](_0xec7de3)[_0x68ef('0x3d')](function(_0x41ffe0){_0x4a0550['count']=_0x41ffe0;if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x3e')]){_0x29518e[_0x68ef('0x3f')]=[{'all':!![]}];}return db[_0x68ef('0x29')]['findAll'](_0x29518e);})[_0x68ef('0x3d')](function(_0x3a2f53){_0x4a0550[_0x68ef('0x40')]=_0x3a2f53;return _0x4a0550;})[_0x68ef('0x3d')](respondWithFilteredResult(_0x123041,_0x29518e))[_0x68ef('0x41')](handleError(_0x123041,null));};exports[_0x68ef('0x42')]=function(_0x558efb,_0x3f000f){var _0x3f7699={'raw':!![],'where':{'id':_0x558efb[_0x68ef('0x43')]['id']}},_0xf5010c={};_0xf5010c[_0x68ef('0x30')]=_[_0x68ef('0x44')](db[_0x68ef('0x29')][_0x68ef('0x2a')]);_0xf5010c[_0x68ef('0x2e')]=_['keys'](_0x558efb[_0x68ef('0x2e')]);_0xf5010c[_0x68ef('0x37')]=_[_0x68ef('0x2f')](_0xf5010c[_0x68ef('0x30')],_0xf5010c[_0x68ef('0x2e')]);_0x3f7699[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0xf5010c['model'],qs[_0x68ef('0x31')](_0x558efb['query'][_0x68ef('0x31')]));_0x3f7699[_0x68ef('0x32')]=_0x3f7699[_0x68ef('0x32')][_0x68ef('0x45')]?_0x3f7699['attributes']:_0xf5010c[_0x68ef('0x30')];if(_0x558efb['query'][_0x68ef('0x3e')]){_0x3f7699['include']=[{'all':!![]}];}_0x3f7699=_[_0x68ef('0x3a')]({},_0x3f7699,_0x558efb[_0x68ef('0x3b')]);return db[_0x68ef('0x29')]['find'](_0x3f7699)['then'](handleEntityNotFound(_0x3f000f,null))[_0x68ef('0x3d')](respondWithResult(_0x3f000f,null))[_0x68ef('0x41')](handleError(_0x3f000f,null));};exports['create']=function(_0x589688,_0x4b4d6b){return db[_0x68ef('0x29')][_0x68ef('0x46')](_0x589688[_0x68ef('0x47')],{})[_0x68ef('0x3d')](respondWithResult(_0x4b4d6b,0xc9))[_0x68ef('0x41')](handleError(_0x4b4d6b,null));};exports['update']=function(_0x55f385,_0xc39f5b){if(_0x55f385[_0x68ef('0x47')]['id']){delete _0x55f385[_0x68ef('0x47')]['id'];}return db[_0x68ef('0x29')]['find']({'where':{'id':_0x55f385[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0xc39f5b,null))[_0x68ef('0x3d')](saveUpdates(_0x55f385[_0x68ef('0x47')],null))['then'](respondWithResult(_0xc39f5b,null))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x48')]=function(_0x3c3074,_0x566e7c){return db[_0x68ef('0x29')][_0x68ef('0x49')]({'where':{'id':_0x3c3074[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x3d')](removeEntity(_0x566e7c,null))['catch'](handleError(_0x566e7c,null));}; \ No newline at end of file +var _0x8ef6=['sort','filters','filter','where','merge','options','count','then','includeAll','include','rows','catch','show','params','keys','length','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','end','error','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','limit','order'];(function(_0x130d59,_0x22ee62){var _0x2ffd14=function(_0x19a194){while(--_0x19a194){_0x130d59['push'](_0x130d59['shift']());}};_0x2ffd14(++_0x22ee62);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3b2826,_0x53270e){_0x3b2826=_0x3b2826-0x0;var _0x5dcd12=_0x8ef6[_0x3b2826];return _0x5dcd12;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x46356f,_0x1e117a){_0x1e117a=_0x1e117a||0xcc;return function(_0x454ef4){if(_0x454ef4){return _0x46356f[_0x68ef('0x1b')](_0x1e117a);}return _0x46356f[_0x68ef('0x1c')](_0x1e117a)['end']();};}function respondWithResult(_0x3b48dd,_0xc50cce){_0xc50cce=_0xc50cce||0xc8;return function(_0x2657c5){if(_0x2657c5){return _0x3b48dd['status'](_0xc50cce)[_0x68ef('0x1d')](_0x2657c5);}};}function respondWithFilteredResult(_0x1764de,_0x24682d){return function(_0x5005ba){if(_0x5005ba){var _0x35493d=_0x5005ba['count'],_0x37c4cc=_0x24682d[_0x68ef('0x1e')],_0x3d1e90=_0x24682d['offset']+_0x24682d['limit'],_0x3780a4;if(_0x3d1e90>=_0x35493d){_0x3d1e90=_0x35493d;_0x3780a4=0xc8;}else{_0x3780a4=0xce;}_0x1764de[_0x68ef('0x1c')](_0x3780a4);return _0x1764de[_0x68ef('0x1f')]('Content-Range',_0x37c4cc+'-'+_0x3d1e90+'/'+_0x35493d)['json'](_0x5005ba);}return null;};}function patchUpdates(_0x3c4c1f){return function(_0x2cd92c){try{jsonpatch[_0x68ef('0x20')](_0x2cd92c,_0x3c4c1f,!![]);}catch(_0x4fad1c){return BPromise[_0x68ef('0x21')](_0x4fad1c);}return _0x2cd92c[_0x68ef('0x22')]();};}function saveUpdates(_0x183f5f,_0x5b246b){return function(_0x3c46d4){if(_0x3c46d4){return _0x3c46d4[_0x68ef('0x23')](_0x183f5f)['then'](function(_0x399da4){return _0x399da4;});}return null;};}function removeEntity(_0xf4760f,_0x19aa3d){return function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7['destroy']()['then'](function(){_0xf4760f[_0x68ef('0x1c')](0xcc)[_0x68ef('0x24')]();});}};}function handleEntityNotFound(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(!_0x438b4c){_0x312cc9[_0x68ef('0x1b')](0x194);}return _0x438b4c;};}function handleError(_0x258cd5,_0x49374f){_0x49374f=_0x49374f||0x1f4;return function(_0x65fd09){logger[_0x68ef('0x25')](_0x65fd09['stack']);if(_0x65fd09[_0x68ef('0x26')]){delete _0x65fd09['name'];}_0x258cd5['status'](_0x49374f)['send'](_0x65fd09);};}exports[_0x68ef('0x27')]=function(_0x268f32,_0x123041){var _0x29518e={},_0x52e67e={},_0x4a0550={'count':0x0,'rows':[]};var _0x1cbe4f=_[_0x68ef('0x28')](db[_0x68ef('0x29')][_0x68ef('0x2a')],function(_0x22ef25){return{'name':_0x22ef25[_0x68ef('0x2b')],'type':_0x22ef25[_0x68ef('0x2c')][_0x68ef('0x2d')]};});_0x52e67e['model']=_[_0x68ef('0x28')](_0x1cbe4f,_0x68ef('0x26'));_0x52e67e[_0x68ef('0x2e')]=_['keys'](_0x268f32[_0x68ef('0x2e')]);_0x52e67e['filters']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],_0x52e67e['query']);_0x29518e['attributes']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],qs['fields'](_0x268f32[_0x68ef('0x2e')][_0x68ef('0x31')]));_0x29518e[_0x68ef('0x32')]=_0x29518e[_0x68ef('0x32')]['length']?_0x29518e[_0x68ef('0x32')]:_0x52e67e[_0x68ef('0x30')];if(!_0x268f32['query'][_0x68ef('0x33')]('nolimit')){_0x29518e[_0x68ef('0x34')]=qs[_0x68ef('0x34')](_0x268f32['query'][_0x68ef('0x34')]);_0x29518e['offset']=qs[_0x68ef('0x1e')](_0x268f32['query'][_0x68ef('0x1e')]);}_0x29518e[_0x68ef('0x35')]=qs[_0x68ef('0x36')](_0x268f32['query'][_0x68ef('0x36')]);_0x29518e['where']=qs[_0x68ef('0x37')](_['pick'](_0x268f32[_0x68ef('0x2e')],_0x52e67e[_0x68ef('0x37')]),_0x1cbe4f);if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x38')]){_0x29518e[_0x68ef('0x39')]=_[_0x68ef('0x3a')](_0x29518e['where'],{'$or':_[_0x68ef('0x28')](_0x1cbe4f,function(_0x15a6ab){if(_0x15a6ab[_0x68ef('0x2c')]!=='VIRTUAL'){var _0x32eddd={};_0x32eddd[_0x15a6ab[_0x68ef('0x26')]]={'$like':'%'+_0x268f32[_0x68ef('0x2e')]['filter']+'%'};return _0x32eddd;}})});}_0x29518e=_['merge']({},_0x29518e,_0x268f32[_0x68ef('0x3b')]);var _0xec7de3={'where':_0x29518e[_0x68ef('0x39')]};return db[_0x68ef('0x29')][_0x68ef('0x3c')](_0xec7de3)[_0x68ef('0x3d')](function(_0x41ffe0){_0x4a0550['count']=_0x41ffe0;if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x3e')]){_0x29518e[_0x68ef('0x3f')]=[{'all':!![]}];}return db[_0x68ef('0x29')]['findAll'](_0x29518e);})[_0x68ef('0x3d')](function(_0x3a2f53){_0x4a0550[_0x68ef('0x40')]=_0x3a2f53;return _0x4a0550;})[_0x68ef('0x3d')](respondWithFilteredResult(_0x123041,_0x29518e))[_0x68ef('0x41')](handleError(_0x123041,null));};exports[_0x68ef('0x42')]=function(_0x558efb,_0x3f000f){var _0x3f7699={'raw':!![],'where':{'id':_0x558efb[_0x68ef('0x43')]['id']}},_0xf5010c={};_0xf5010c[_0x68ef('0x30')]=_[_0x68ef('0x44')](db[_0x68ef('0x29')][_0x68ef('0x2a')]);_0xf5010c[_0x68ef('0x2e')]=_['keys'](_0x558efb[_0x68ef('0x2e')]);_0xf5010c[_0x68ef('0x37')]=_[_0x68ef('0x2f')](_0xf5010c[_0x68ef('0x30')],_0xf5010c[_0x68ef('0x2e')]);_0x3f7699[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0xf5010c['model'],qs[_0x68ef('0x31')](_0x558efb['query'][_0x68ef('0x31')]));_0x3f7699[_0x68ef('0x32')]=_0x3f7699[_0x68ef('0x32')][_0x68ef('0x45')]?_0x3f7699['attributes']:_0xf5010c[_0x68ef('0x30')];if(_0x558efb['query'][_0x68ef('0x3e')]){_0x3f7699['include']=[{'all':!![]}];}_0x3f7699=_[_0x68ef('0x3a')]({},_0x3f7699,_0x558efb[_0x68ef('0x3b')]);return db[_0x68ef('0x29')]['find'](_0x3f7699)['then'](handleEntityNotFound(_0x3f000f,null))[_0x68ef('0x3d')](respondWithResult(_0x3f000f,null))[_0x68ef('0x41')](handleError(_0x3f000f,null));};exports['create']=function(_0x589688,_0x4b4d6b){return db[_0x68ef('0x29')][_0x68ef('0x46')](_0x589688[_0x68ef('0x47')],{})[_0x68ef('0x3d')](respondWithResult(_0x4b4d6b,0xc9))[_0x68ef('0x41')](handleError(_0x4b4d6b,null));};exports['update']=function(_0x55f385,_0xc39f5b){if(_0x55f385[_0x68ef('0x47')]['id']){delete _0x55f385[_0x68ef('0x47')]['id'];}return db[_0x68ef('0x29')]['find']({'where':{'id':_0x55f385[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0xc39f5b,null))[_0x68ef('0x3d')](saveUpdates(_0x55f385[_0x68ef('0x47')],null))['then'](respondWithResult(_0xc39f5b,null))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x48')]=function(_0x3c3074,_0x566e7c){return db[_0x68ef('0x29')][_0x68ef('0x49')]({'where':{'id':_0x3c3074[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x3d')](removeEntity(_0x566e7c,null))['catch'](handleError(_0x566e7c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 90d1f8d..be8a325 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 _0x6ec2=['fax_applications','lodash','../../config/logger','bluebird','path','../../config/environment','exports','define','FaxApplication'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0x6ec2,0x121));var _0x26ec=function(_0x4d1c8f,_0x1c13cf){_0x4d1c8f=_0x4d1c8f-0x0;var _0x4175aa=_0x6ec2[_0x4d1c8f];return _0x4175aa;};'use strict';var _=require(_0x26ec('0x0'));var util=require('util');var logger=require(_0x26ec('0x1'))('api');var moment=require('moment');var BPromise=require(_0x26ec('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26ec('0x3'));var rimraf=require('rimraf');var config=require(_0x26ec('0x4'));var attributes=require('./faxApplication.attributes');module[_0x26ec('0x5')]=function(_0x11b3b3,_0x1a73c9){return _0x11b3b3[_0x26ec('0x6')](_0x26ec('0x7'),attributes,{'tableName':_0x26ec('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x01cd=['rimraf','./faxApplication.attributes','exports','define','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x14943c,_0x267e04){var _0x1f061a=function(_0x54f0e5){while(--_0x54f0e5){_0x14943c['push'](_0x14943c['shift']());}};_0x1f061a(++_0x267e04);}(_0x01cd,0x1c0));var _0xd01c=function(_0xd2e386,_0x3801ef){_0xd2e386=_0xd2e386-0x0;var _0x1272d9=_0x01cd[_0xd2e386];return _0x1272d9;};'use strict';var _=require(_0xd01c('0x0'));var util=require(_0xd01c('0x1'));var logger=require(_0xd01c('0x2'))(_0xd01c('0x3'));var moment=require('moment');var BPromise=require(_0xd01c('0x4'));var rp=require(_0xd01c('0x5'));var fs=require('fs');var path=require(_0xd01c('0x6'));var rimraf=require(_0xd01c('0x7'));var config=require('../../config/environment');var attributes=require(_0xd01c('0x8'));module[_0xd01c('0x9')]=function(_0x20bdab,_0x2dff00){return _0x20bdab[_0xd01c('0xa')]('FaxApplication',attributes,{'tableName':_0xd01c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd01c('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 389f3f5..1b71c08 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 _0xb894=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxApplication','update','options','where','limit','then','lodash','util','bluebird'];(function(_0x47c549,_0x23473b){var _0x2cc386=function(_0x4baab3){while(--_0x4baab3){_0x47c549['push'](_0x47c549['shift']());}};_0x2cc386(++_0x23473b);}(_0xb894,0xb3));var _0x4b89=function(_0x35d1c2,_0x25acb0){_0x35d1c2=_0x35d1c2-0x0;var _0x17a007=_0xb894[_0x35d1c2];return _0x17a007;};'use strict';var _=require(_0x4b89('0x0'));var util=require(_0x4b89('0x1'));var moment=require('moment');var BPromise=require(_0x4b89('0x2'));var rs=require(_0x4b89('0x3'));var fs=require('fs');var Redis=require(_0x4b89('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4b89('0x5'))(_0x4b89('0x6'));var config=require(_0x4b89('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4b89('0x8')][_0x4b89('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x126b8a,_0x4ed61b,_0x1160f0){return new BPromise(function(_0x428319,_0x43f530){return client['request'](_0x126b8a,_0x1160f0)['then'](function(_0xfe4715){logger[_0x4b89('0xa')](_0x4b89('0xb'),_0x4ed61b,_0x4b89('0xc'));logger[_0x4b89('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4ed61b,'request\x20sent',JSON[_0x4b89('0xe')](_0xfe4715));if(_0xfe4715['error']){if(_0xfe4715[_0x4b89('0xf')][_0x4b89('0x10')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4ed61b,_0xfe4715[_0x4b89('0xf')][_0x4b89('0x11')]);return _0x43f530(_0xfe4715['error'][_0x4b89('0x11')]);}logger[_0x4b89('0xf')]('FaxApplication,\x20%s,\x20%s',_0x4ed61b,_0xfe4715['error'][_0x4b89('0x11')]);return _0x428319(_0xfe4715[_0x4b89('0xf')][_0x4b89('0x11')]);}else{logger[_0x4b89('0xa')](_0x4b89('0xb'),_0x4ed61b,'request\x20sent');_0x428319(_0xfe4715[_0x4b89('0x12')]['message']);}})[_0x4b89('0x13')](function(_0xefdc0f){logger['error'](_0x4b89('0xb'),_0x4ed61b,_0xefdc0f);_0x43f530(_0xefdc0f);});});}exports[_0x4b89('0x14')]=function(_0x400b7c){var _0x55aa4b=this;return new Promise(function(_0x33db77,_0x30bf66){return db['FaxApplication'][_0x4b89('0x15')](_0x400b7c['body'],{'raw':_0x400b7c['options']?_0x400b7c[_0x4b89('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x400b7c[_0x4b89('0x16')]?_0x400b7c['options'][_0x4b89('0x17')]||null:null,'attributes':_0x400b7c[_0x4b89('0x16')]?_0x400b7c[_0x4b89('0x16')]['attributes']||null:null,'limit':_0x400b7c['options']?_0x400b7c[_0x4b89('0x16')][_0x4b89('0x18')]||null:null})[_0x4b89('0x19')](function(_0x1b46fe){logger[_0x4b89('0xa')](_0x4b89('0x14'),_0x400b7c);logger[_0x4b89('0xd')](_0x4b89('0x14'),_0x400b7c,JSON['stringify'](_0x1b46fe));_0x33db77(_0x1b46fe);})[_0x4b89('0x13')](function(_0x21ad53){logger['error'](_0x4b89('0x14'),_0x21ad53[_0x4b89('0x11')],_0x400b7c);_0x30bf66(_0x55aa4b['error'](0x1f4,_0x21ad53[_0x4b89('0x11')]));});});}; \ No newline at end of file +var _0x6320=['code','message','request\x20sent','result','catch','UpdateFaxApplication','update','body','options','raw','where','info','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x147b96,_0x329d31){var _0xa43fa=function(_0x3c15d3){while(--_0x3c15d3){_0x147b96['push'](_0x147b96['shift']());}};_0xa43fa(++_0x329d31);}(_0x6320,0x1e8));var _0x0632=function(_0x25cf06,_0x3de40a){_0x25cf06=_0x25cf06-0x0;var _0x312b23=_0x6320[_0x25cf06];return _0x312b23;};'use strict';var _=require('lodash');var util=require(_0x0632('0x0'));var moment=require(_0x0632('0x1'));var BPromise=require('bluebird');var rs=require(_0x0632('0x2'));var fs=require('fs');var Redis=require(_0x0632('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0632('0x4'))(_0x0632('0x5'));var config=require(_0x0632('0x6'));var jayson=require(_0x0632('0x7'));var client=jayson[_0x0632('0x8')][_0x0632('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43ffb6,_0xa87afc,_0x39d861){return new BPromise(function(_0x333eb7,_0x3a834a){return client[_0x0632('0xa')](_0x43ffb6,_0x39d861)[_0x0632('0xb')](function(_0x481b62){logger['info'](_0x0632('0xc'),_0xa87afc,'request\x20sent');logger['debug'](_0x0632('0xd'),_0xa87afc,'request\x20sent',JSON[_0x0632('0xe')](_0x481b62));if(_0x481b62['error']){if(_0x481b62[_0x0632('0xf')][_0x0632('0x10')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0xa87afc,_0x481b62[_0x0632('0xf')][_0x0632('0x11')]);return _0x3a834a(_0x481b62[_0x0632('0xf')][_0x0632('0x11')]);}logger[_0x0632('0xf')]('FaxApplication,\x20%s,\x20%s',_0xa87afc,_0x481b62[_0x0632('0xf')][_0x0632('0x11')]);return _0x333eb7(_0x481b62['error'][_0x0632('0x11')]);}else{logger['info'](_0x0632('0xc'),_0xa87afc,_0x0632('0x12'));_0x333eb7(_0x481b62[_0x0632('0x13')][_0x0632('0x11')]);}})[_0x0632('0x14')](function(_0x1554c1){logger['error'](_0x0632('0xc'),_0xa87afc,_0x1554c1);_0x3a834a(_0x1554c1);});});}exports[_0x0632('0x15')]=function(_0x519fb9){var _0x190d6d=this;return new Promise(function(_0x3a69c0,_0x35f8ea){return db['FaxApplication'][_0x0632('0x16')](_0x519fb9[_0x0632('0x17')],{'raw':_0x519fb9[_0x0632('0x18')]?_0x519fb9[_0x0632('0x18')][_0x0632('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x519fb9[_0x0632('0x18')]?_0x519fb9[_0x0632('0x18')][_0x0632('0x1a')]||null:null,'attributes':_0x519fb9[_0x0632('0x18')]?_0x519fb9[_0x0632('0x18')]['attributes']||null:null,'limit':_0x519fb9[_0x0632('0x18')]?_0x519fb9[_0x0632('0x18')]['limit']||null:null})[_0x0632('0xb')](function(_0x39bd7e){logger[_0x0632('0x1b')]('UpdateFaxApplication',_0x519fb9);logger['debug']('UpdateFaxApplication',_0x519fb9,JSON[_0x0632('0xe')](_0x39bd7e));_0x3a69c0(_0x39bd7e);})[_0x0632('0x14')](function(_0x218fbe){logger['error']('UpdateFaxApplication',_0x218fbe['message'],_0x519fb9);_0x35f8ea(_0x190d6d['error'](0x1f4,_0x218fbe[_0x0632('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index fb839df..e3442d6 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 _0xf2ca=['update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x58f28d,_0x34642e){var _0x685d1a=function(_0xc18e3b){while(--_0xc18e3b){_0x58f28d['push'](_0x58f28d['shift']());}};_0x685d1a(++_0x34642e);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0xf2ca[_0x223461];return _0x4dbe0a;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get']('/',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xa')]);router[_0xaf2c('0xb')](_0xaf2c('0xc'),auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xf')]);router['put'](_0xaf2c('0xc'),auth['isAuthenticated'](),controller[_0xaf2c('0x10')]);router[_0xaf2c('0x11')](_0xaf2c('0xc'),auth[_0xaf2c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x24ca=['show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x24ca,0x1bc));var _0xa24c=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0x24ca[_0x30f5bb];return _0x1cfc00;};'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['post']('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xd')]);router[_0xa24c('0xe')]('/:id',auth[_0xa24c('0x9')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x11')]);module[_0xa24c('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index c66a17b..a3e966b 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 _0x790a=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x790a,0x7f));var _0xa790=function(_0x9e19f7,_0x5ee087){_0x9e19f7=_0x9e19f7-0x0;var _0x5aa6f3=_0x790a[_0x9e19f7];return _0x5aa6f3;};'use strict';var Sequelize=require(_0xa790('0x0'));module['exports']={'closed':{'type':Sequelize[_0xa790('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa790('0x2')]},'disposition':{'type':Sequelize[_0xa790('0x3')]},'note':{'type':Sequelize[_0xa790('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xa790('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa790('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa790('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa790('0x4')]('in',_0xa790('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xceb0=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x650d37,_0x170e7b){var _0x214298=function(_0xd51168){while(--_0xd51168){_0x650d37['push'](_0x650d37['shift']());}};_0x214298(++_0x170e7b);}(_0xceb0,0x1d7));var _0x0ceb=function(_0x548a19,_0x4d6d65){_0x548a19=_0x548a19-0x0;var _0x46e33e=_0xceb0[_0x548a19];return _0x46e33e;};'use strict';var Sequelize=require(_0x0ceb('0x0'));module[_0x0ceb('0x1')]={'closed':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0ceb('0x3')]},'disposition':{'type':Sequelize[_0x0ceb('0x4')]},'note':{'type':Sequelize[_0x0ceb('0x4')]},'read1stAt':{'type':Sequelize[_0x0ceb('0x3')]},'fax':{'type':Sequelize[_0x0ceb('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0ceb('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0ceb('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0ceb('0x6')),'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 338690a..4059d61 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 _0x4227=['u.id\x20=\x20ui.UserId','fax_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','body','some','compact','isEmpty','FaxAccountId','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','catch','show','rawAttributes','include','options','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','pipe','basename','log','unlinkSync','html-pdf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','./faxInteraction.socket','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','FaxInteraction','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_fax_interactions','users'];(function(_0x494376,_0x1c77a2){var _0x9fd443=function(_0xea6c32){while(--_0xea6c32){_0x494376['push'](_0x494376['shift']());}};_0x9fd443(++_0x1c77a2);}(_0x4227,0x89));var _0x7422=function(_0x521019,_0x371e24){_0x521019=_0x521019-0x0;var _0x3b496e=_0x4227[_0x521019];return _0x3b496e;};'use strict';var pdf=require(_0x7422('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7422('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7422('0x2'));var moment=require(_0x7422('0x3'));var BPromise=require(_0x7422('0x4'));var Mustache=require('mustache');var util=require(_0x7422('0x5'));var path=require(_0x7422('0x6'));var sox=require(_0x7422('0x7'));var csv=require(_0x7422('0x8'));var ejs=require(_0x7422('0x9'));var fs=require('fs');var _=require(_0x7422('0xa'));var squel=require(_0x7422('0xb'));var crypto=require(_0x7422('0xc'));var jsforce=require(_0x7422('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7422('0x8'));var querystring=require(_0x7422('0xe'));var Papa=require(_0x7422('0xf'));var Redis=require('ioredis');var authService=require(_0x7422('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7422('0x11'));var hardwareService=require(_0x7422('0x12'));var logger=require(_0x7422('0x13'))(_0x7422('0x14'));var utils=require(_0x7422('0x15'));var config=require('../../config/environment');var db=require(_0x7422('0x16'))['db'];config[_0x7422('0x17')]=_['defaults'](config[_0x7422('0x17')],{'host':_0x7422('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7422('0x17')]));require(_0x7422('0x19'))['register'](socket);function respondWithStatusCode(_0x4d3f91,_0xeafd58){_0xeafd58=_0xeafd58||0xcc;return function(_0x4ca0e4){if(_0x4ca0e4){return _0x4d3f91[_0x7422('0x1a')](_0xeafd58);}return _0x4d3f91[_0x7422('0x1b')](_0xeafd58)['end']();};}function respondWithResult(_0x149c50,_0x39c31c){_0x39c31c=_0x39c31c||0xc8;return function(_0x31c3ec){if(_0x31c3ec){return _0x149c50[_0x7422('0x1b')](_0x39c31c)[_0x7422('0x1c')](_0x31c3ec);}};}function respondWithFilteredResult(_0x25401d,_0x4e2b60){return function(_0x21d4b9){if(_0x21d4b9){var _0xa7ff41=_0x21d4b9[_0x7422('0x1d')],_0x493f59=_0x4e2b60['offset'],_0x30656d=_0x4e2b60[_0x7422('0x1e')]+_0x4e2b60[_0x7422('0x1f')],_0x57b8bf;if(_0x30656d>=_0xa7ff41){_0x30656d=_0xa7ff41;_0x57b8bf=0xc8;}else{_0x57b8bf=0xce;}_0x25401d[_0x7422('0x1b')](_0x57b8bf);return _0x25401d['set'](_0x7422('0x20'),_0x493f59+'-'+_0x30656d+'/'+_0xa7ff41)[_0x7422('0x1c')](_0x21d4b9);}return null;};}function patchUpdates(_0x368e96){return function(_0x3eb555){try{jsonpatch['apply'](_0x3eb555,_0x368e96,!![]);}catch(_0x58e617){return BPromise[_0x7422('0x21')](_0x58e617);}return _0x3eb555[_0x7422('0x22')]();};}function saveUpdates(_0x20c1e3,_0x7d34f2){return function(_0x71d28c){if(_0x71d28c){return _0x71d28c[_0x7422('0x23')](_0x20c1e3)[_0x7422('0x24')](function(_0x596b89){return _0x596b89;});}return null;};}function removeEntity(_0x24ce62,_0x46b927){return function(_0x4fc200){if(_0x4fc200){return _0x4fc200[_0x7422('0x25')]()[_0x7422('0x24')](function(){_0x24ce62[_0x7422('0x1b')](0xcc)[_0x7422('0x26')]();});}};}function handleEntityNotFound(_0x5436a4,_0x3f579a){return function(_0x2eed9f){if(!_0x2eed9f){_0x5436a4[_0x7422('0x1a')](0x194);}return _0x2eed9f;};}function handleError(_0x2dd10f,_0x3438d1){_0x3438d1=_0x3438d1||0x1f4;return function(_0x5e997b){logger[_0x7422('0x27')](_0x5e997b[_0x7422('0x28')]);if(_0x5e997b[_0x7422('0x29')]){delete _0x5e997b[_0x7422('0x29')];}_0x2dd10f['status'](_0x3438d1)[_0x7422('0x2a')](_0x5e997b);};}function getInteractionUsers(_0x20f71e,_0x9b0144){return new BPromise(function(_0x702aef,_0x59bc52){try{if(_0x9b0144[_0x20f71e['id']]){_0x20f71e[_0x7422('0x2b')]=_[_0x7422('0x2c')](_0x9b0144[_0x20f71e['id']],function(_0x5be605){return{'id':_0x5be605['id'],'fullname':_0x5be605['fullname']};});}}catch(_0x2baac6){_0x59bc52(_0x2baac6);}_0x702aef(_0x20f71e);});}function getInteractionTags(_0x2fb125,_0x5e08f7){return new BPromise(function(_0x1d5ae5,_0x194a5e){try{if(_0x2fb125[_0x7422('0x2d')]){_0x2fb125[_0x7422('0x2e')]=[];_0x2fb125[_0x7422('0x2d')][_0x7422('0x2f')](',')[_0x7422('0x30')](function(_0xa9d41){_0x2fb125[_0x7422('0x2e')][_0x7422('0x31')](_0x5e08f7[_0xa9d41]);});}delete _0x2fb125[_0x7422('0x2d')];}catch(_0x47e57b){_0x194a5e(_0x47e57b);}_0x1d5ae5(_0x2fb125);});}function updateFaxInteraction(_0x50c794,_0x3d0fb9,_0x22327f){return new BPromise(function(_0x1eff48,_0x4c4984){return getInteractionUsers(_0x50c794,_0x22327f)[_0x7422('0x24')](function(_0x339b85){return getInteractionTags(_0x339b85,_0x3d0fb9);})[_0x7422('0x24')](function(_0x58d9fe){_0x1eff48(_0x58d9fe);})['catch'](function(_0x1fe00d){_0x4c4984(_0x1fe00d);});});}exports['index']=function(_0x234c12,_0x55c622){var _0x18b594={},_0x57d732={},_0x45e26d={'count':0x0,'rows':[]};var _0x566d99=_['map'](db[_0x7422('0x32')]['rawAttributes'],function(_0x37da42){return{'name':_0x37da42[_0x7422('0x33')],'type':_0x37da42[_0x7422('0x34')][_0x7422('0x35')]};});_0x57d732[_0x7422('0x36')]=_[_0x7422('0x2c')](_0x566d99,_0x7422('0x29'));_0x57d732['query']=_[_0x7422('0x37')](_0x234c12[_0x7422('0x38')]);_0x57d732[_0x7422('0x39')]=_[_0x7422('0x3a')](_0x57d732[_0x7422('0x36')],_0x57d732['query']);_0x18b594[_0x7422('0x3b')]=_[_0x7422('0x3a')](_0x57d732['model'],qs[_0x7422('0x3c')](_0x234c12['query'][_0x7422('0x3c')]));_0x18b594['attributes']=_0x18b594['attributes'][_0x7422('0x3d')]?_0x18b594[_0x7422('0x3b')]:_0x57d732[_0x7422('0x36')];if(!_0x234c12['query'][_0x7422('0x3e')](_0x7422('0x3f'))){_0x18b594['limit']=qs[_0x7422('0x1f')](_0x234c12['query'][_0x7422('0x1f')]);_0x18b594[_0x7422('0x1e')]=qs[_0x7422('0x1e')](_0x234c12[_0x7422('0x38')][_0x7422('0x1e')]);}_0x18b594[_0x7422('0x40')]=qs[_0x7422('0x41')](_0x234c12['query'][_0x7422('0x41')]);_0x18b594[_0x7422('0x42')]=qs['filters'](_[_0x7422('0x43')](_0x234c12[_0x7422('0x38')],_0x57d732['filters']),_0x566d99);var _0xca1546=[];var _0x4e2cd4=squel[_0x7422('0x44')]()['field']('id')[_0x7422('0x45')](_0x7422('0x29'))[_0x7422('0x45')](_0x7422('0x46'))[_0x7422('0x47')](_0x7422('0x48'));var _0x40c1dd=squel[_0x7422('0x44')]()[_0x7422('0x45')](_0x7422('0x49'))['field'](_0x7422('0x4a'))['field']('ui.FaxInteractionId')[_0x7422('0x47')](_0x7422('0x4b'),'ui')['left_join'](_0x7422('0x4c'),'u',_0x7422('0x4d'));var _0x1d09e9=squel[_0x7422('0x44')]()[_0x7422('0x47')](_0x7422('0x4e'),'i')[_0x7422('0x4f')]('cm_contacts','c',_0x7422('0x50'))[_0x7422('0x4f')](_0x7422('0x4c'),'o',_0x7422('0x51'))['left_join'](_0x7422('0x52'),'a',_0x7422('0x53'))[_0x7422('0x4f')]('fax_messages','me',_0x7422('0x54'))[_0x7422('0x4f')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0x7422('0x48'),'t',_0x7422('0x55'));var _0x5b4694=squel[_0x7422('0x56')]();var _0x50e9bb=[];var _0x546828=squel[_0x7422('0x56')]();var _0x2986ec;if(_0x234c12[_0x7422('0x38')]['search']){_0x2986ec=as['parseSearch'](_0x234c12[_0x7422('0x38')][_0x7422('0x57')]);var _0x58e670=_0x2986ec[_0x7422('0x58')];for(var _0x2fbe91=0x0;_0x2fbe91<_0x2986ec['conditions'][_0x7422('0x3d')];_0x2fbe91++){var _0x17de3f=_0x2986ec[_0x7422('0x59')][_0x2fbe91];var _0x3c738c='i';var _0x3dbe87=_[_0x7422('0x5a')](_0x566d99,[_0x7422('0x29'),_0x17de3f[_0x7422('0x45')]]);if(!_0x3dbe87){switch(_0x17de3f[_0x7422('0x45')]){case _0x7422('0x5b'):if(_0x17de3f['value']==0x1){_0x1d09e9[_0x7422('0x5c')]('`'+_0x17de3f[_0x7422('0x45')]+_0x7422('0x5d'));}else{_0x1d09e9['having']('`'+_0x17de3f[_0x7422('0x45')]+_0x7422('0x5e'));}break;case _0x7422('0x5f'):if(_0x17de3f[_0x7422('0x60')]===_0x7422('0x61')){if(_0x17de3f[_0x7422('0x62')]['split']('\x20')[_0x7422('0x3d')]>0x1){_0x5b4694[_0x58e670](_0x7422('0x63'),qs[_0x7422('0x64')](_0x17de3f[_0x7422('0x62')]),null);}else{var _0x309daf='%'+_0x17de3f[_0x7422('0x62')]+'%';_0x5b4694[_0x58e670](_0x7422('0x65'),_0x309daf,_0x309daf,_0x309daf);}}else{_0x3dbe87=_['find'](_0x566d99,[_0x7422('0x29'),'ContactId']);_0x17de3f['field']=_0x7422('0x66');_0x529c48=as['buildExpression'](_0x3c738c,_0x3dbe87[_0x7422('0x34')],_0x17de3f);_0x5b4694[_0x58e670](_0x529c48[_0x7422('0x67')],_0x529c48[_0x7422('0x62')]['start'],_0x529c48[_0x7422('0x62')][_0x7422('0x26')]);}break;case _0x7422('0x68'):var _0x1e5475=_0x17de3f['value']['split'](',')[_0x7422('0x2c')](function(_0x2162f6){return Number(_0x2162f6);});_0x1e5475['forEach'](function(_0x5e8802){_0x546828['or'](_0x7422('0x69'),'%,'+_0x5e8802+',%');});_0x50e9bb=_[_0x7422('0x6a')](_0x50e9bb,_0x1e5475);break;case _0x7422('0x6b'):if(_0x17de3f[_0x7422('0x60')]===_0x7422('0x61')){_0x5b4694[_0x58e670](_0x7422('0x6c'),'%'+_0x17de3f[_0x7422('0x62')]+'%',null);}else{_0x3dbe87=_[_0x7422('0x5a')](_0x566d99,[_0x7422('0x29'),_0x7422('0x6d')]);_0x17de3f['field']=_0x7422('0x6d');_0x529c48=as[_0x7422('0x6e')](_0x3c738c,_0x3dbe87[_0x7422('0x34')],_0x17de3f);_0x5b4694[_0x58e670](_0x529c48[_0x7422('0x67')],_0x529c48[_0x7422('0x62')][_0x7422('0x6f')],_0x529c48['value'][_0x7422('0x26')]);}break;case _0x7422('0x70'):_0x529c48=as[_0x7422('0x6e')]('me',null,_0x17de3f);_0x5b4694[_0x58e670](_0x529c48[_0x7422('0x67')],_0x529c48[_0x7422('0x62')][_0x7422('0x6f')],_0x529c48[_0x7422('0x62')][_0x7422('0x26')]);break;}}else{var _0x529c48=as['buildExpression'](_0x3c738c,_0x3dbe87[_0x7422('0x34')],_0x17de3f);_0x5b4694[_0x58e670](_0x529c48[_0x7422('0x67')],_0x529c48[_0x7422('0x62')]['start'],_0x529c48[_0x7422('0x62')]['end']);}}}else{var _0x502711=_(_0x234c12[_0x7422('0x38')])['keys']()[_0x7422('0x2c')](function(_0x216869){return _[_0x7422('0x71')](_0x566d99,[_0x7422('0x29'),_0x216869])?_0x216869:undefined;})[_0x7422('0x72')]()[_0x7422('0x62')]();if(!_[_0x7422('0x73')](_0x502711)){_0x502711[_0x7422('0x30')](function(_0x20d329){if(_0x20d329===_0x7422('0x74')){_0x1d09e9[_0x7422('0x42')]('i.FaxAccountId\x20IN\x20?',[][_0x7422('0x75')](_0x234c12[_0x7422('0x38')][_0x20d329]));}else if(_0x20d329===_0x7422('0x76')){var _0x2ff7c7=JSON['parse'](_0x234c12[_0x7422('0x38')][_0x20d329])['$gte'];var _0x4450ec=JSON['parse'](_0x234c12[_0x7422('0x38')][_0x20d329])[_0x7422('0x77')];_0x1d09e9['where'](_0x7422('0x78'),_0x2ff7c7,_0x4450ec);}else{if(_0x234c12[_0x7422('0x38')][_0x20d329]===_0x7422('0x79')){_0x1d09e9[_0x7422('0x42')]('i.'+_0x20d329+_0x7422('0x7a'));}else{_0x1d09e9[_0x7422('0x42')]('i.'+_0x20d329+'\x20=\x20?',_0x234c12[_0x7422('0x38')][_0x20d329]);}}});}if(_0x234c12[_0x7422('0x38')]['read']){if(_0x234c12[_0x7422('0x38')][_0x7422('0x7b')]==0x1){_0x1d09e9['having'](_0x7422('0x7c'));}else{_0x1d09e9['having'](_0x7422('0x7d'));}}if(_0x234c12[_0x7422('0x38')][_0x7422('0x7e')]){_0x50e9bb=_[_0x7422('0x7f')](_0x234c12[_0x7422('0x38')][_0x7422('0x7e')])?_0x234c12[_0x7422('0x38')]['tag']:new Array(_0x234c12[_0x7422('0x38')]['tag']);_0x50e9bb[_0x7422('0x30')](function(_0x140d4a){_0x546828['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x140d4a+',%');});}if(_0x234c12[_0x7422('0x38')][_0x7422('0x80')]){var _0x1a728d=_0x234c12[_0x7422('0x38')]['filter']['replace']('\x5c','\x5c\x5c')[_0x7422('0x81')]('\x27\x27',_0x7422('0x82'));if(qs[_0x7422('0x83')](_0x1a728d)){_0x5b4694['or'](_0x7422('0x84'),_0x1a728d+'%')['or'](_0x7422('0x85'),_0x1a728d+'%');}_0x5b4694['or'](_0x7422('0x86'),_0x1a728d+'%');}}_0x1d09e9[_0x7422('0x42')](_0x5b4694);_0x1d09e9[_0x7422('0x87')](_0x7422('0x88'));var _0x4f04be={'type':db[_0x7422('0x89')]['QueryTypes']['SELECT'],'raw':!![]};var _0x110b3f=_0x1d09e9['clone']();_0x110b3f['field'](_0x7422('0x88'));_0x110b3f[_0x7422('0x45')](_0x7422('0x8a'),_0x7422('0x5b'));if(_0x18b594[_0x7422('0x40')]){_0x18b594[_0x7422('0x40')][_0x7422('0x30')](function(_0x1b01ff){_0x1d09e9['order']('i.'+_0x1b01ff[0x0],_0x1b01ff[0x1]===_0x7422('0x8b')?![]:!![]);});}if(!_[_0x7422('0x73')](_0x50e9bb)){_0x1d09e9[_0x7422('0x5c')](_0x546828);_0x110b3f[_0x7422('0x42')]('t.id\x20IN\x20?',_0x50e9bb);}BPromise[_0x7422('0x8c')]()[_0x7422('0x24')](function(){if(!_0x2986ec){if(_0x234c12[_0x7422('0x38')][_0x7422('0x74')]||_0x234c12['query'][_0x7422('0x8d')])return;_0x110b3f[_0x7422('0x42')](_0x7422('0x8e'));_0x1d09e9['where'](_0x7422('0x8e'));return;}return _0x234c12[_0x7422('0x8f')][_0x7422('0x90')]({'attributes':['id'],'raw':!![]})[_0x7422('0x24')](function(_0x73988){if(_[_0x7422('0x73')](_0x73988)){_0x110b3f[_0x7422('0x42')]('i.FaxAccountId\x20IS\x20NULL');_0x1d09e9[_0x7422('0x42')](_0x7422('0x91'));}else{_0x110b3f[_0x7422('0x42')](_0x7422('0x92'),_['map'](_0x73988,'id'));_0x1d09e9[_0x7422('0x42')]('i.FaxAccountId\x20IN\x20?',_[_0x7422('0x2c')](_0x73988,'id'));}});})[_0x7422('0x24')](function(){db[_0x7422('0x93')]['query'](_0x110b3f[_0x7422('0x94')](),_0x4f04be)[_0x7422('0x24')](function(_0xd69503){_0x45e26d['count']=_0xd69503[_0x7422('0x3d')];if(_0x45e26d[_0x7422('0x1d')]===0x0)return[];return db[_0x7422('0x93')]['query'](_0x4e2cd4[_0x7422('0x94')](),_0x4f04be)[_0x7422('0x24')](function(_0x3fe673){_0xca1546=_[_0x7422('0x95')](_0x3fe673,'id');_0x4f04be=_[_0x7422('0x96')](_0x4f04be,{'model':db[_0x7422('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x234c12[_0x7422('0x38')]['fields']){_0x18b594[_0x7422('0x3b')][_0x7422('0x30')](function(_0x1210f7){_0x1d09e9[_0x7422('0x45')]('i.'+_0x1210f7);});}else{_0x1d09e9[_0x7422('0x45')](_0x7422('0x8a'),_0x7422('0x5b'));_0x1d09e9[_0x7422('0x45')](_0x7422('0x97'),_0x7422('0x98'));_0x1d09e9[_0x7422('0x45')](_0x7422('0x99'),_0x7422('0x9a'));_0x1d09e9[_0x7422('0x45')](_0x7422('0x9b'));_0x1d09e9[_0x7422('0x45')]('c.firstName',_0x7422('0x9c'));_0x1d09e9[_0x7422('0x45')](_0x7422('0x9d'),_0x7422('0x9e'));_0x1d09e9['field'](_0x7422('0x9f'),_0x7422('0xa0'));_0x1d09e9['field'](_0x7422('0xa1'),_0x7422('0xa2'));_0x1d09e9['field'](_0x7422('0xa3'),_0x7422('0xa4'));_0x1d09e9[_0x7422('0x45')](_0x7422('0xa5'),'Contact.fax');_0x1d09e9[_0x7422('0x45')](_0x7422('0xa6'),_0x7422('0xa7'));_0x1d09e9['field'](_0x7422('0xa8'),_0x7422('0xa9'));_0x1d09e9[_0x7422('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x7422('0x2d'));}if(_0x18b594[_0x7422('0x1f')])_0x1d09e9[_0x7422('0x1f')](_0x18b594[_0x7422('0x1f')]);if(_0x18b594[_0x7422('0x1e')])_0x1d09e9['offset'](_0x18b594[_0x7422('0x1e')]);return db[_0x7422('0x93')][_0x7422('0x38')](_0x1d09e9['toString'](),_0x4f04be);})[_0x7422('0x24')](function(_0x326463){_0x40c1dd[_0x7422('0x42')](_0x7422('0xaa'),_['map'](_0x326463,'id'));return db[_0x7422('0x93')][_0x7422('0x38')](_0x40c1dd['toString'](),_0x4f04be)[_0x7422('0x24')](function(_0x380de9){var _0x1bd2b8=_[_0x7422('0xab')](_0x380de9,_0x7422('0xac'));var _0x267a86=[];_0x326463[_0x7422('0x30')](function(_0x2961d8){_0x267a86['push'](updateFaxInteraction(_0x2961d8,_0xca1546,_0x1bd2b8));});return BPromise[_0x7422('0xad')](_0x267a86);});});})[_0x7422('0x24')](function(_0x659249){_0x45e26d['rows']=_0x659249;return _0x45e26d;})[_0x7422('0x24')](respondWithFilteredResult(_0x55c622,_0x18b594));})[_0x7422('0xae')](handleError(_0x55c622,null));};exports[_0x7422('0xaf')]=function(_0x2402fb,_0x368554){var _0x326c72={'raw':![],'where':{'id':_0x2402fb['params']['id']}},_0x21232a={};_0x21232a[_0x7422('0x36')]=_[_0x7422('0x37')](db[_0x7422('0x32')][_0x7422('0xb0')]);_0x21232a[_0x7422('0x38')]=_[_0x7422('0x37')](_0x2402fb[_0x7422('0x38')]);_0x21232a[_0x7422('0x39')]=_[_0x7422('0x3a')](_0x21232a['model'],_0x21232a['query']);_0x326c72[_0x7422('0x3b')]=_['intersection'](_0x21232a[_0x7422('0x36')],qs[_0x7422('0x3c')](_0x2402fb[_0x7422('0x38')][_0x7422('0x3c')]));_0x326c72[_0x7422('0x3b')]=_0x326c72[_0x7422('0x3b')][_0x7422('0x3d')]?_0x326c72[_0x7422('0x3b')]:_0x21232a[_0x7422('0x36')];if(_0x2402fb[_0x7422('0x38')]['includeAll']){_0x326c72[_0x7422('0xb1')]=[{'all':!![]}];}_0x326c72=_[_0x7422('0x96')]({},_0x326c72,_0x2402fb[_0x7422('0xb2')]);return db['FaxInteraction'][_0x7422('0x5a')](_0x326c72)['then'](handleEntityNotFound(_0x368554,null))[_0x7422('0x24')](respondWithResult(_0x368554,null))[_0x7422('0xae')](handleError(_0x368554,null));};exports[_0x7422('0xb3')]=function(_0x55f775,_0x110443){return db[_0x7422('0x32')][_0x7422('0xb3')](_0x55f775[_0x7422('0x70')],{})[_0x7422('0x24')](respondWithResult(_0x110443,0xc9))[_0x7422('0xae')](handleError(_0x110443,null));};exports[_0x7422('0x23')]=function(_0x425937,_0x2f9ceb){if(_0x425937['body']['id']){delete _0x425937['body']['id'];}return db[_0x7422('0x32')][_0x7422('0x5a')]({'where':{'id':_0x425937[_0x7422('0xb4')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x2f9ceb,null))[_0x7422('0x24')](saveUpdates(_0x425937[_0x7422('0x70')],null))['then'](respondWithResult(_0x2f9ceb,null))[_0x7422('0xae')](handleError(_0x2f9ceb,null));};exports['destroy']=function(_0x410c97,_0x424e06){return db[_0x7422('0x32')]['find']({'where':{'id':_0x410c97[_0x7422('0xb4')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x424e06,null))[_0x7422('0x24')](removeEntity(_0x424e06,null))['catch'](handleError(_0x424e06,null));};exports['describe']=function(_0x102986,_0x5ad29c){return db['FaxInteraction'][_0x7422('0xb5')]()[_0x7422('0x24')](respondWithResult(_0x5ad29c,null))[_0x7422('0xae')](handleError(_0x5ad29c,null));};exports[_0x7422('0xb6')]=function(_0x1b9b0d,_0x2f8eda,_0x19a3fb){return db[_0x7422('0xb7')][_0x7422('0x5a')]({'where':{'id':_0x1b9b0d[_0x7422('0xb4')]['id']}})['then'](handleEntityNotFound(_0x2f8eda,null))[_0x7422('0x24')](function(_0x4ebc0c){if(_0x4ebc0c){return _0x4ebc0c[_0x7422('0xb6')](_0x1b9b0d['body'][_0x7422('0xb8')],_[_0x7422('0xb9')](_0x1b9b0d['body'],[_0x7422('0xb8'),'id'])||{});}})[_0x7422('0x24')](respondWithResult(_0x2f8eda,null))[_0x7422('0xae')](handleError(_0x2f8eda,null));};exports[_0x7422('0xba')]=function(_0x414197,_0x3a1f22,_0x5cc169){var _0xe8b729={'raw':![],'where':{}};var _0x1eddb5={};var _0x5c1bab={'count':0x0,'rows':[]};return db[_0x7422('0x32')]['findOne']({'where':{'id':_0x414197[_0x7422('0xb4')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x3a1f22,null))[_0x7422('0x24')](function(_0x503601){if(_0x503601){_0x1eddb5[_0x7422('0x36')]=_['keys'](db[_0x7422('0xb7')][_0x7422('0xb0')]);_0x1eddb5[_0x7422('0x38')]=_[_0x7422('0x37')](_0x414197['query']);_0x1eddb5['filters']=_[_0x7422('0x3a')](_0x1eddb5[_0x7422('0x36')],_0x1eddb5[_0x7422('0x38')]);_0xe8b729[_0x7422('0x3b')]=_[_0x7422('0x3a')](_0x1eddb5[_0x7422('0x36')],qs[_0x7422('0x3c')](_0x414197[_0x7422('0x38')][_0x7422('0x3c')]));_0xe8b729[_0x7422('0x3b')]=_0xe8b729[_0x7422('0x3b')]['length']?_0xe8b729[_0x7422('0x3b')]:_0x1eddb5['model'];if(!_0x414197[_0x7422('0x38')][_0x7422('0x3e')](_0x7422('0x3f'))){_0xe8b729[_0x7422('0x1f')]=qs[_0x7422('0x1f')](_0x414197['query'][_0x7422('0x1f')]);_0xe8b729[_0x7422('0x1e')]=qs[_0x7422('0x1e')](_0x414197[_0x7422('0x38')][_0x7422('0x1e')]);}_0xe8b729['order']=qs[_0x7422('0x41')](_0x414197[_0x7422('0x38')][_0x7422('0x41')]);_0xe8b729[_0x7422('0x42')]=qs[_0x7422('0x39')](_[_0x7422('0x43')](_0x414197[_0x7422('0x38')],_0x1eddb5['filters']));_0xe8b729['where']['FaxInteractionId']=_0x503601['id'];if(_0x414197[_0x7422('0x38')][_0x7422('0x80')]){_0xe8b729[_0x7422('0x42')]=_[_0x7422('0x96')](_0xe8b729[_0x7422('0x42')],{'$or':_[_0x7422('0x2c')](_0xe8b729[_0x7422('0x3b')],function(_0x5c068b){var _0xc037b7={};_0xc037b7[_0x5c068b]={'$like':'%'+_0x414197[_0x7422('0x38')][_0x7422('0x80')]+'%'};return _0xc037b7;})});}if(_0x414197[_0x7422('0x38')][_0x7422('0xbb')]){var _0x59a1c0=_0x414197[_0x7422('0x38')][_0x7422('0xbb')][_0x7422('0x2f')](',');var _0x34e480={};_0x34e480[_0x59a1c0[0x0]]={'$gte':moment(_0x59a1c0[0x1])['format'](_0x7422('0xbc'))};_0xe8b729['where']=_[_0x7422('0x96')](_0xe8b729[_0x7422('0x42')],_0x34e480);}_0xe8b729=_['merge']({},_0xe8b729,_0x414197[_0x7422('0xb2')]);return db[_0x7422('0xb7')][_0x7422('0x1d')]({'where':_0xe8b729['where']})[_0x7422('0x24')](function(_0x2b7afc){_0x5c1bab[_0x7422('0x1d')]=_0x2b7afc;if(_0x414197['query']['includeAll']){_0xe8b729[_0x7422('0xb1')]=[{'all':!![]}];}return db[_0x7422('0xb7')]['findAll'](_0xe8b729);})[_0x7422('0x24')](function(_0x25c130){_0x5c1bab[_0x7422('0xbd')]=_0x25c130;return _0x5c1bab;});}})[_0x7422('0x24')](respondWithFilteredResult(_0x3a1f22,_0xe8b729))[_0x7422('0xae')](handleError(_0x3a1f22,null));};exports[_0x7422('0xbe')]=function(_0x109ece,_0x1e139a,_0x100f46){return db['FaxInteraction'][_0x7422('0x5a')]({'where':{'id':_0x109ece[_0x7422('0xb4')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x1e139a,null))[_0x7422('0x24')](function(_0x2d85c0){if(_0x2d85c0){return _0x2d85c0[_0x7422('0xbf')](_0x109ece[_0x7422('0x70')][_0x7422('0xb8')],_[_0x7422('0xb9')](_0x109ece[_0x7422('0x70')],[_0x7422('0xb8'),'id'])||{})[_0x7422('0xc0')](function(){return db[_0x7422('0x68')]['findAll']({'attributes':['id','name',_0x7422('0x46')],'where':{'id':_0x109ece[_0x7422('0x70')][_0x7422('0xb8')]}});})[_0x7422('0x24')](function(_0x1f23ad){socket[_0x7422('0xc1')]('faxInteractionTags:save',{'id':Number(_0x109ece[_0x7422('0xb4')]['id']),'tags':_0x1f23ad||[]});return{'id':Number(_0x109ece[_0x7422('0xb4')]['id']),'tags':_0x1f23ad||[]};});}})[_0x7422('0x24')](respondWithResult(_0x1e139a,null))[_0x7422('0xae')](handleError(_0x1e139a,null));};exports[_0x7422('0xc2')]=function(_0x3b6f96,_0x394da5,_0x52f49b){return db[_0x7422('0x32')][_0x7422('0x5a')]({'where':{'id':_0x3b6f96['params']['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x394da5,null))[_0x7422('0x24')](function(_0x47b455){if(_0x47b455){return _0x47b455['removeTags'](_0x3b6f96[_0x7422('0x38')][_0x7422('0xb8')]);}})['then'](respondWithStatusCode(_0x394da5,null))[_0x7422('0xae')](handleError(_0x394da5,null));};exports[_0x7422('0xc3')]=function(_0x4baf72,_0x1fc8a5){var _0x46b819=moment()[_0x7422('0xc4')]()[_0x7422('0x94')]();var _0x2ee967=path[_0x7422('0xc5')](config[_0x7422('0xc6')],_0x7422('0xc7'),_0x7422('0xc8'),_0x7422('0xc9'));var _0xb08d5a=path[_0x7422('0xc5')](config['root'],_0x7422('0xc7'),_0x7422('0xc8'),_0x7422('0xca'));var _0x193515=path[_0x7422('0xc5')](_0x2ee967,_0x46b819);var _0x4e31cd=util['format'](_0x7422('0xcb'),_0x4baf72['params']['id'],_0x46b819);var _0x11e767=path[_0x7422('0xc5')](_0x2ee967,_0x4e31cd);var _0x21acd9=[];_0x21acd9['push']({'model':db[_0x7422('0xcc')],'as':_0x7422('0xcc'),'raw':!![]});var _0x4e8222=[{'model':db[_0x7422('0xb7')],'as':_0x7422('0xcd'),'attributes':['id','body',_0x7422('0x76')],'include':_0x21acd9}];return db[_0x7422('0x32')][_0x7422('0x5a')]({'where':{'id':_0x4baf72[_0x7422('0xb4')]['id']},'include':_0x4e8222})[_0x7422('0x24')](handleEntityNotFound(_0x1fc8a5,null))[_0x7422('0x24')](function(_0x12a28a){if(_0x12a28a&&_0x12a28a[_0x7422('0xcd')]){var _0xbd18f2=_0x12a28a[_0x7422('0xce')]({'plain':!![]});fs[_0x7422('0xcf')](_0x193515);for(var _0x14ae26=0x0;_0x14ae26<_0xbd18f2['Messages'][_0x7422('0x3d')];_0x14ae26++){var _0x5a120c=_0xbd18f2[_0x7422('0xcd')][_0x14ae26][_0x7422('0xcc')];if(_0x5a120c){var _0x591af2=path[_0x7422('0xc5')](_0xb08d5a,_0x5a120c['basename']);if(fs[_0x7422('0xd0')](_0x591af2)){fs[_0x7422('0xd1')](_0x591af2)[_0x7422('0xd2')](fs['createWriteStream'](path[_0x7422('0xc5')](_0x193515,_0x5a120c[_0x7422('0xd3')])));}}}return BPromise[_0x7422('0x8c')]()['then'](function(){return new BPromise(function(_0x36b780,_0x558b78){zipdir(_0x193515,{'saveTo':_0x11e767},function(_0x14461c,_0x248b0f){if(_0x14461c)return _0x558b78(_0x14461c);return _0x36b780(_0x248b0f);});})[_0x7422('0x24')](function(){return new BPromise(function(_0x4fce11,_0xb0fd85){rimraf(_0x193515,function(_0x1f82d6){if(_0x1f82d6)_0xb0fd85(_0x1f82d6);return _0x4fce11();});});})[_0x7422('0x24')](function(){return _0x1fc8a5[_0x7422('0xc3')](_0x11e767,_0x4e31cd,function(_0x3c17bb){if(_0x3c17bb){console[_0x7422('0xd4')]('err',_0x3c17bb);}else{fs[_0x7422('0xd5')](_0x11e767);}});});});}else{return _0x1fc8a5[_0x7422('0x1a')](0xc8);}})['catch'](handleError(_0x1fc8a5,null));}; \ No newline at end of file +var _0x574d=['../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','name','fullname','Tags','TagIds','split','forEach','push','catch','index','map','FaxInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','i.*','c.lastName','c.email','c.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','params','options','create','describe','ids','omit','getMessages','findOne','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','faxInteractionTags:save','removeTags','unix','join','server','files','tmp','attachments','Attachment','Messages','get','mkdirSync','createReadStream','pipe','createWriteStream','basename','resolve','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5acea7,_0x1d0d1f){var _0x1cddda=function(_0x3c3221){while(--_0x3c3221){_0x5acea7['push'](_0x5acea7['shift']());}};_0x1cddda(++_0x1d0d1f);}(_0x574d,0xc0));var _0xd574=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x574d[_0x3b0731];return _0x4204d7;};'use strict';var pdf=require(_0xd574('0x0'));var emlformat=require(_0xd574('0x1'));var rimraf=require(_0xd574('0x2'));var zipdir=require(_0xd574('0x3'));var jsonpatch=require(_0xd574('0x4'));var rp=require(_0xd574('0x5'));var moment=require(_0xd574('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd574('0x7'));var util=require(_0xd574('0x8'));var path=require(_0xd574('0x9'));var sox=require(_0xd574('0xa'));var csv=require('to-csv');var ejs=require(_0xd574('0xb'));var fs=require('fs');var _=require(_0xd574('0xc'));var squel=require(_0xd574('0xd'));var crypto=require(_0xd574('0xe'));var jsforce=require(_0xd574('0xf'));var deskjs=require(_0xd574('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd574('0x11'));var Redis=require(_0xd574('0x12'));var authService=require(_0xd574('0x13'));var qs=require(_0xd574('0x14'));var as=require(_0xd574('0x15'));var hardwareService=require(_0xd574('0x16'));var logger=require(_0xd574('0x17'))('api');var utils=require(_0xd574('0x18'));var config=require(_0xd574('0x19'));var db=require(_0xd574('0x1a'))['db'];config[_0xd574('0x1b')]=_[_0xd574('0x1c')](config[_0xd574('0x1b')],{'host':_0xd574('0x1d'),'port':0x18eb});var socket=require(_0xd574('0x1e'))(new Redis(config[_0xd574('0x1b')]));require(_0xd574('0x1f'))[_0xd574('0x20')](socket);function respondWithStatusCode(_0x2cc660,_0x564b36){_0x564b36=_0x564b36||0xcc;return function(_0xb44f5d){if(_0xb44f5d){return _0x2cc660[_0xd574('0x21')](_0x564b36);}return _0x2cc660[_0xd574('0x22')](_0x564b36)[_0xd574('0x23')]();};}function respondWithResult(_0x46fb4c,_0x341463){_0x341463=_0x341463||0xc8;return function(_0x137917){if(_0x137917){return _0x46fb4c[_0xd574('0x22')](_0x341463)['json'](_0x137917);}};}function respondWithFilteredResult(_0x5e3a20,_0x1486c7){return function(_0x343aa9){if(_0x343aa9){var _0x2ac01d=_0x343aa9[_0xd574('0x24')],_0x48fd46=_0x1486c7[_0xd574('0x25')],_0x58a74b=_0x1486c7[_0xd574('0x25')]+_0x1486c7[_0xd574('0x26')],_0x91c627;if(_0x58a74b>=_0x2ac01d){_0x58a74b=_0x2ac01d;_0x91c627=0xc8;}else{_0x91c627=0xce;}_0x5e3a20[_0xd574('0x22')](_0x91c627);return _0x5e3a20[_0xd574('0x27')](_0xd574('0x28'),_0x48fd46+'-'+_0x58a74b+'/'+_0x2ac01d)[_0xd574('0x29')](_0x343aa9);}return null;};}function patchUpdates(_0x9f980d){return function(_0x35c2bb){try{jsonpatch['apply'](_0x35c2bb,_0x9f980d,!![]);}catch(_0x2b6647){return BPromise[_0xd574('0x2a')](_0x2b6647);}return _0x35c2bb['save']();};}function saveUpdates(_0x39c39d,_0x5e5b9f){return function(_0x22d451){if(_0x22d451){return _0x22d451[_0xd574('0x2b')](_0x39c39d)[_0xd574('0x2c')](function(_0x3f85cf){return _0x3f85cf;});}return null;};}function removeEntity(_0x1aec00,_0x72d2b8){return function(_0x25751e){if(_0x25751e){return _0x25751e[_0xd574('0x2d')]()[_0xd574('0x2c')](function(){_0x1aec00[_0xd574('0x22')](0xcc)[_0xd574('0x23')]();});}};}function handleEntityNotFound(_0x44ddae,_0x3e0501){return function(_0x39f5be){if(!_0x39f5be){_0x44ddae['sendStatus'](0x194);}return _0x39f5be;};}function handleError(_0x441f13,_0x53142f){_0x53142f=_0x53142f||0x1f4;return function(_0x1dcd2f){logger['error'](_0x1dcd2f['stack']);if(_0x1dcd2f[_0xd574('0x2e')]){delete _0x1dcd2f[_0xd574('0x2e')];}_0x441f13[_0xd574('0x22')](_0x53142f)['send'](_0x1dcd2f);};}function getInteractionUsers(_0x2a8e86,_0x30e49e){return new BPromise(function(_0x8eefda,_0x9761f5){try{if(_0x30e49e[_0x2a8e86['id']]){_0x2a8e86['Users']=_['map'](_0x30e49e[_0x2a8e86['id']],function(_0x130b6d){return{'id':_0x130b6d['id'],'fullname':_0x130b6d[_0xd574('0x2f')]};});}}catch(_0x203bcb){_0x9761f5(_0x203bcb);}_0x8eefda(_0x2a8e86);});}function getInteractionTags(_0x23a495,_0x1e65b5){return new BPromise(function(_0x1c01f0,_0x5b66eb){try{if(_0x23a495['TagIds']){_0x23a495[_0xd574('0x30')]=[];_0x23a495[_0xd574('0x31')][_0xd574('0x32')](',')[_0xd574('0x33')](function(_0xd6d9c0){_0x23a495[_0xd574('0x30')][_0xd574('0x34')](_0x1e65b5[_0xd6d9c0]);});}delete _0x23a495[_0xd574('0x31')];}catch(_0x5d23f2){_0x5b66eb(_0x5d23f2);}_0x1c01f0(_0x23a495);});}function updateFaxInteraction(_0x535b49,_0x189946,_0x601382){return new BPromise(function(_0xd4b730,_0x43e402){return getInteractionUsers(_0x535b49,_0x601382)[_0xd574('0x2c')](function(_0x5d787e){return getInteractionTags(_0x5d787e,_0x189946);})[_0xd574('0x2c')](function(_0x1421d6){_0xd4b730(_0x1421d6);})[_0xd574('0x35')](function(_0x1a841a){_0x43e402(_0x1a841a);});});}exports[_0xd574('0x36')]=function(_0x2f1a1e,_0x27498e){var _0x4d1576={},_0x3ecc05={},_0x5dc0cf={'count':0x0,'rows':[]};var _0x35594e=_[_0xd574('0x37')](db[_0xd574('0x38')][_0xd574('0x39')],function(_0x45e3d0){return{'name':_0x45e3d0[_0xd574('0x3a')],'type':_0x45e3d0[_0xd574('0x3b')][_0xd574('0x3c')]};});_0x3ecc05[_0xd574('0x3d')]=_[_0xd574('0x37')](_0x35594e,_0xd574('0x2e'));_0x3ecc05['query']=_[_0xd574('0x3e')](_0x2f1a1e[_0xd574('0x3f')]);_0x3ecc05[_0xd574('0x40')]=_['intersection'](_0x3ecc05[_0xd574('0x3d')],_0x3ecc05[_0xd574('0x3f')]);_0x4d1576[_0xd574('0x41')]=_[_0xd574('0x42')](_0x3ecc05[_0xd574('0x3d')],qs[_0xd574('0x43')](_0x2f1a1e['query'][_0xd574('0x43')]));_0x4d1576[_0xd574('0x41')]=_0x4d1576[_0xd574('0x41')][_0xd574('0x44')]?_0x4d1576[_0xd574('0x41')]:_0x3ecc05['model'];if(!_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x45')](_0xd574('0x46'))){_0x4d1576['limit']=qs['limit'](_0x2f1a1e['query'][_0xd574('0x26')]);_0x4d1576['offset']=qs['offset'](_0x2f1a1e['query'][_0xd574('0x25')]);}_0x4d1576[_0xd574('0x47')]=qs[_0xd574('0x48')](_0x2f1a1e[_0xd574('0x3f')]['sort']);_0x4d1576[_0xd574('0x49')]=qs[_0xd574('0x40')](_[_0xd574('0x4a')](_0x2f1a1e[_0xd574('0x3f')],_0x3ecc05['filters']),_0x35594e);var _0x1bf7c5=[];var _0x4caf06=squel[_0xd574('0x4b')]()[_0xd574('0x4c')]('id')[_0xd574('0x4c')](_0xd574('0x2e'))[_0xd574('0x4c')](_0xd574('0x4d'))[_0xd574('0x4e')](_0xd574('0x4f'));var _0x1857bb=squel[_0xd574('0x4b')]()[_0xd574('0x4c')](_0xd574('0x50'))[_0xd574('0x4c')]('u.fullname')[_0xd574('0x4c')]('ui.FaxInteractionId')['from'](_0xd574('0x51'),'ui')[_0xd574('0x52')]('users','u',_0xd574('0x53'));var _0x2e4e53=squel[_0xd574('0x4b')]()['from'](_0xd574('0x54'),'i')[_0xd574('0x52')](_0xd574('0x55'),'c',_0xd574('0x56'))[_0xd574('0x52')](_0xd574('0x57'),'o','o.id\x20=\x20i.UserId')[_0xd574('0x52')](_0xd574('0x58'),'a',_0xd574('0x59'))[_0xd574('0x52')](_0xd574('0x5a'),'me',_0xd574('0x5b'))[_0xd574('0x52')](_0xd574('0x5c'),'it',_0xd574('0x5d'))[_0xd574('0x52')](_0xd574('0x4f'),'t',_0xd574('0x5e'));var _0x1cad77=squel[_0xd574('0x5f')]();var _0x2ee2d7=[];var _0x15f9cd=squel['expr']();var _0x3dbfdc;if(_0x2f1a1e[_0xd574('0x3f')]['search']){_0x3dbfdc=as[_0xd574('0x60')](_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x61')]);var _0x26c88c=_0x3dbfdc[_0xd574('0x62')];for(var _0x1426fb=0x0;_0x1426fb<_0x3dbfdc[_0xd574('0x63')][_0xd574('0x44')];_0x1426fb++){var _0x4168b2=_0x3dbfdc[_0xd574('0x63')][_0x1426fb];var _0x4e1344='i';var _0x3397a8=_[_0xd574('0x64')](_0x35594e,[_0xd574('0x2e'),_0x4168b2[_0xd574('0x4c')]]);if(!_0x3397a8){switch(_0x4168b2[_0xd574('0x4c')]){case _0xd574('0x65'):if(_0x4168b2[_0xd574('0x66')]==0x1){_0x2e4e53[_0xd574('0x67')]('`'+_0x4168b2[_0xd574('0x4c')]+_0xd574('0x68'));}else{_0x2e4e53[_0xd574('0x67')]('`'+_0x4168b2[_0xd574('0x4c')]+_0xd574('0x69'));}break;case _0xd574('0x6a'):if(_0x4168b2[_0xd574('0x6b')]===_0xd574('0x6c')){if(_0x4168b2[_0xd574('0x66')][_0xd574('0x32')]('\x20')[_0xd574('0x44')]>0x1){_0x1cad77[_0x26c88c](_0xd574('0x6d'),qs[_0xd574('0x6e')](_0x4168b2[_0xd574('0x66')]),null);}else{var _0x2f77f9='%'+_0x4168b2[_0xd574('0x66')]+'%';_0x1cad77[_0x26c88c](_0xd574('0x6f'),_0x2f77f9,_0x2f77f9,_0x2f77f9);}}else{_0x3397a8=_['find'](_0x35594e,[_0xd574('0x2e'),_0xd574('0x70')]);_0x4168b2[_0xd574('0x4c')]=_0xd574('0x70');_0x495213=as[_0xd574('0x71')](_0x4e1344,_0x3397a8[_0xd574('0x3b')],_0x4168b2);_0x1cad77[_0x26c88c](_0x495213[_0xd574('0x72')],_0x495213[_0xd574('0x66')][_0xd574('0x73')],_0x495213['value']['end']);}break;case _0xd574('0x74'):var _0x2cd5e5=_0x4168b2['value'][_0xd574('0x32')](',')[_0xd574('0x37')](function(_0x310f27){return Number(_0x310f27);});_0x2cd5e5[_0xd574('0x33')](function(_0x4d2a9c){_0x15f9cd['or'](_0xd574('0x75'),'%,'+_0x4d2a9c+',%');});_0x2ee2d7=_[_0xd574('0x76')](_0x2ee2d7,_0x2cd5e5);break;case _0xd574('0x77'):if(_0x4168b2[_0xd574('0x6b')]===_0xd574('0x6c')){_0x1cad77[_0x26c88c](_0xd574('0x78'),'%'+_0x4168b2['value']+'%',null);}else{_0x3397a8=_['find'](_0x35594e,[_0xd574('0x2e'),_0xd574('0x79')]);_0x4168b2['field']=_0xd574('0x79');_0x495213=as['buildExpression'](_0x4e1344,_0x3397a8['type'],_0x4168b2);_0x1cad77[_0x26c88c](_0x495213[_0xd574('0x72')],_0x495213[_0xd574('0x66')]['start'],_0x495213['value'][_0xd574('0x23')]);}break;case _0xd574('0x7a'):_0x495213=as[_0xd574('0x71')]('me',null,_0x4168b2);_0x1cad77[_0x26c88c](_0x495213[_0xd574('0x72')],_0x495213[_0xd574('0x66')]['start'],_0x495213[_0xd574('0x66')][_0xd574('0x23')]);break;}}else{var _0x495213=as[_0xd574('0x71')](_0x4e1344,_0x3397a8[_0xd574('0x3b')],_0x4168b2);_0x1cad77[_0x26c88c](_0x495213[_0xd574('0x72')],_0x495213[_0xd574('0x66')]['start'],_0x495213[_0xd574('0x66')][_0xd574('0x23')]);}}}else{var _0x4fc35d=_(_0x2f1a1e[_0xd574('0x3f')])[_0xd574('0x3e')]()[_0xd574('0x37')](function(_0x5b1ba1){return _[_0xd574('0x7b')](_0x35594e,['name',_0x5b1ba1])?_0x5b1ba1:undefined;})[_0xd574('0x7c')]()[_0xd574('0x66')]();if(!_['isEmpty'](_0x4fc35d)){_0x4fc35d['forEach'](function(_0x59f2bb){if(_0x59f2bb===_0xd574('0x7d')){_0x2e4e53[_0xd574('0x49')](_0xd574('0x7e'),[][_0xd574('0x7f')](_0x2f1a1e['query'][_0x59f2bb]));}else if(_0x59f2bb===_0xd574('0x80')){var _0xc38aae=JSON[_0xd574('0x81')](_0x2f1a1e[_0xd574('0x3f')][_0x59f2bb])[_0xd574('0x82')];var _0x446f4d=JSON[_0xd574('0x81')](_0x2f1a1e[_0xd574('0x3f')][_0x59f2bb])[_0xd574('0x83')];_0x2e4e53['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xc38aae,_0x446f4d);}else{if(_0x2f1a1e[_0xd574('0x3f')][_0x59f2bb]===_0xd574('0x84')){_0x2e4e53[_0xd574('0x49')]('i.'+_0x59f2bb+'\x20IS\x20NULL');}else{_0x2e4e53['where']('i.'+_0x59f2bb+'\x20=\x20?',_0x2f1a1e[_0xd574('0x3f')][_0x59f2bb]);}}});}if(_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x85')]){if(_0x2f1a1e['query'][_0xd574('0x85')]==0x1){_0x2e4e53[_0xd574('0x67')](_0xd574('0x86'));}else{_0x2e4e53[_0xd574('0x67')](_0xd574('0x87'));}}if(_0x2f1a1e['query'][_0xd574('0x88')]){_0x2ee2d7=_[_0xd574('0x89')](_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x88')])?_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x88')]:new Array(_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x88')]);_0x2ee2d7[_0xd574('0x33')](function(_0xc20ad){_0x15f9cd['or'](_0xd574('0x75'),'%,'+_0xc20ad+',%');});}if(_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x8a')]){var _0x43d981=_0x2f1a1e['query']['filter'][_0xd574('0x8b')]('\x5c','\x5c\x5c')[_0xd574('0x8b')]('\x27\x27',_0xd574('0x8c'));if(qs[_0xd574('0x8d')](_0x43d981)){_0x1cad77['or'](_0xd574('0x8e'),_0x43d981+'%')['or']('i.fax\x20LIKE\x20?',_0x43d981+'%');}_0x1cad77['or'](_0xd574('0x8f'),_0x43d981+'%');}}_0x2e4e53[_0xd574('0x49')](_0x1cad77);_0x2e4e53[_0xd574('0x90')]('i.id');var _0x17feb3={'type':db[_0xd574('0x91')]['QueryTypes'][_0xd574('0x92')],'raw':!![]};var _0x287dda=_0x2e4e53[_0xd574('0x93')]();_0x287dda[_0xd574('0x4c')](_0xd574('0x94'));_0x287dda[_0xd574('0x4c')](_0xd574('0x95'),_0xd574('0x65'));if(_0x4d1576[_0xd574('0x47')]){_0x4d1576[_0xd574('0x47')]['forEach'](function(_0x57c878){_0x2e4e53[_0xd574('0x47')]('i.'+_0x57c878[0x0],_0x57c878[0x1]===_0xd574('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x2ee2d7)){_0x2e4e53[_0xd574('0x67')](_0x15f9cd);_0x287dda['where'](_0xd574('0x97'),_0x2ee2d7);}BPromise['resolve']()[_0xd574('0x2c')](function(){if(!_0x3dbfdc){if(_0x2f1a1e[_0xd574('0x3f')]['FaxAccountId']||_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x98')])return;_0x287dda[_0xd574('0x49')](_0xd574('0x99'));_0x2e4e53['where'](_0xd574('0x99'));return;}return _0x2f1a1e[_0xd574('0x9a')][_0xd574('0x9b')]({'attributes':['id'],'raw':!![]})[_0xd574('0x2c')](function(_0x150c7a){if(_[_0xd574('0x9c')](_0x150c7a)){_0x287dda[_0xd574('0x49')](_0xd574('0x9d'));_0x2e4e53[_0xd574('0x49')](_0xd574('0x9d'));}else{_0x287dda['where'](_0xd574('0x7e'),_[_0xd574('0x37')](_0x150c7a,'id'));_0x2e4e53[_0xd574('0x49')](_0xd574('0x7e'),_['map'](_0x150c7a,'id'));}});})[_0xd574('0x2c')](function(){db['sequelize'][_0xd574('0x3f')](_0x287dda[_0xd574('0x9e')](),_0x17feb3)['then'](function(_0x33e256){_0x5dc0cf['count']=_0x33e256[_0xd574('0x44')];if(_0x5dc0cf['count']===0x0)return[];return db[_0xd574('0x9f')][_0xd574('0x3f')](_0x4caf06['toString'](),_0x17feb3)[_0xd574('0x2c')](function(_0x2dfc7a){_0x1bf7c5=_[_0xd574('0xa0')](_0x2dfc7a,'id');_0x17feb3=_[_0xd574('0xa1')](_0x17feb3,{'model':db[_0xd574('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f1a1e['query'][_0xd574('0x43')]){_0x4d1576[_0xd574('0x41')][_0xd574('0x33')](function(_0x427539){_0x2e4e53[_0xd574('0x4c')]('i.'+_0x427539);});}else{_0x2e4e53[_0xd574('0x4c')](_0xd574('0x95'),_0xd574('0x65'));_0x2e4e53[_0xd574('0x4c')](_0xd574('0xa2'),_0xd574('0xa3'));_0x2e4e53[_0xd574('0x4c')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x2e4e53['field'](_0xd574('0xa4'));_0x2e4e53['field']('c.firstName','Contact.firstName');_0x2e4e53[_0xd574('0x4c')](_0xd574('0xa5'),'Contact.lastName');_0x2e4e53[_0xd574('0x4c')](_0xd574('0xa6'),'Contact.email');_0x2e4e53[_0xd574('0x4c')](_0xd574('0xa7'),'Contact.phone');_0x2e4e53['field'](_0xd574('0xa8'),'Contact.mobile');_0x2e4e53[_0xd574('0x4c')]('c.fax',_0xd574('0xa9'));_0x2e4e53[_0xd574('0x4c')](_0xd574('0xaa'),_0xd574('0xab'));_0x2e4e53['field'](_0xd574('0xac'),_0xd574('0xad'));_0x2e4e53['field'](_0xd574('0xae'),_0xd574('0x31'));}if(_0x4d1576['limit'])_0x2e4e53[_0xd574('0x26')](_0x4d1576[_0xd574('0x26')]);if(_0x4d1576[_0xd574('0x25')])_0x2e4e53[_0xd574('0x25')](_0x4d1576[_0xd574('0x25')]);return db['sequelize'][_0xd574('0x3f')](_0x2e4e53[_0xd574('0x9e')](),_0x17feb3);})[_0xd574('0x2c')](function(_0x3bde9b){_0x1857bb[_0xd574('0x49')](_0xd574('0xaf'),_[_0xd574('0x37')](_0x3bde9b,'id'));return db[_0xd574('0x9f')][_0xd574('0x3f')](_0x1857bb[_0xd574('0x9e')](),_0x17feb3)['then'](function(_0x14dbb4){var _0x145673=_[_0xd574('0xb0')](_0x14dbb4,_0xd574('0xb1'));var _0x412702=[];_0x3bde9b['forEach'](function(_0x21eb39){_0x412702['push'](updateFaxInteraction(_0x21eb39,_0x1bf7c5,_0x145673));});return BPromise[_0xd574('0xb2')](_0x412702);});});})['then'](function(_0x2bcc71){_0x5dc0cf[_0xd574('0xb3')]=_0x2bcc71;return _0x5dc0cf;})[_0xd574('0x2c')](respondWithFilteredResult(_0x27498e,_0x4d1576));})[_0xd574('0x35')](handleError(_0x27498e,null));};exports['show']=function(_0x514cfa,_0x9433be){var _0x24f973={'raw':![],'where':{'id':_0x514cfa[_0xd574('0xb4')]['id']}},_0x5f17f6={};_0x5f17f6[_0xd574('0x3d')]=_['keys'](db['FaxInteraction'][_0xd574('0x39')]);_0x5f17f6[_0xd574('0x3f')]=_[_0xd574('0x3e')](_0x514cfa['query']);_0x5f17f6[_0xd574('0x40')]=_['intersection'](_0x5f17f6[_0xd574('0x3d')],_0x5f17f6['query']);_0x24f973['attributes']=_['intersection'](_0x5f17f6[_0xd574('0x3d')],qs[_0xd574('0x43')](_0x514cfa[_0xd574('0x3f')]['fields']));_0x24f973[_0xd574('0x41')]=_0x24f973[_0xd574('0x41')]['length']?_0x24f973[_0xd574('0x41')]:_0x5f17f6[_0xd574('0x3d')];if(_0x514cfa[_0xd574('0x3f')]['includeAll']){_0x24f973['include']=[{'all':!![]}];}_0x24f973=_['merge']({},_0x24f973,_0x514cfa[_0xd574('0xb5')]);return db[_0xd574('0x38')][_0xd574('0x64')](_0x24f973)[_0xd574('0x2c')](handleEntityNotFound(_0x9433be,null))['then'](respondWithResult(_0x9433be,null))[_0xd574('0x35')](handleError(_0x9433be,null));};exports['create']=function(_0x54f482,_0x6d1c7f){return db['FaxInteraction'][_0xd574('0xb6')](_0x54f482['body'],{})[_0xd574('0x2c')](respondWithResult(_0x6d1c7f,0xc9))[_0xd574('0x35')](handleError(_0x6d1c7f,null));};exports[_0xd574('0x2b')]=function(_0x56f698,_0x579faf){if(_0x56f698['body']['id']){delete _0x56f698[_0xd574('0x7a')]['id'];}return db[_0xd574('0x38')][_0xd574('0x64')]({'where':{'id':_0x56f698[_0xd574('0xb4')]['id']}})[_0xd574('0x2c')](handleEntityNotFound(_0x579faf,null))[_0xd574('0x2c')](saveUpdates(_0x56f698[_0xd574('0x7a')],null))['then'](respondWithResult(_0x579faf,null))[_0xd574('0x35')](handleError(_0x579faf,null));};exports[_0xd574('0x2d')]=function(_0x59eb04,_0x257f99){return db[_0xd574('0x38')][_0xd574('0x64')]({'where':{'id':_0x59eb04['params']['id']}})[_0xd574('0x2c')](handleEntityNotFound(_0x257f99,null))[_0xd574('0x2c')](removeEntity(_0x257f99,null))[_0xd574('0x35')](handleError(_0x257f99,null));};exports[_0xd574('0xb7')]=function(_0x18f71c,_0x328a9d){return db[_0xd574('0x38')][_0xd574('0xb7')]()[_0xd574('0x2c')](respondWithResult(_0x328a9d,null))[_0xd574('0x35')](handleError(_0x328a9d,null));};exports['addMessage']=function(_0x3d278e,_0x40492c,_0x270591){return db['FaxMessage'][_0xd574('0x64')]({'where':{'id':_0x3d278e[_0xd574('0xb4')]['id']}})['then'](handleEntityNotFound(_0x40492c,null))[_0xd574('0x2c')](function(_0x333147){if(_0x333147){return _0x333147['addMessage'](_0x3d278e['body'][_0xd574('0xb8')],_[_0xd574('0xb9')](_0x3d278e[_0xd574('0x7a')],[_0xd574('0xb8'),'id'])||{});}})[_0xd574('0x2c')](respondWithResult(_0x40492c,null))[_0xd574('0x35')](handleError(_0x40492c,null));};exports[_0xd574('0xba')]=function(_0x529c9c,_0x3eb79,_0x1a7492){var _0x1791a7={'raw':![],'where':{}};var _0x296f92={};var _0x3ef7c1={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xd574('0xbb')]({'where':{'id':_0x529c9c[_0xd574('0xb4')]['id']}})[_0xd574('0x2c')](handleEntityNotFound(_0x3eb79,null))[_0xd574('0x2c')](function(_0x552e38){if(_0x552e38){_0x296f92[_0xd574('0x3d')]=_[_0xd574('0x3e')](db[_0xd574('0xbc')]['rawAttributes']);_0x296f92['query']=_[_0xd574('0x3e')](_0x529c9c[_0xd574('0x3f')]);_0x296f92[_0xd574('0x40')]=_['intersection'](_0x296f92['model'],_0x296f92['query']);_0x1791a7['attributes']=_[_0xd574('0x42')](_0x296f92[_0xd574('0x3d')],qs[_0xd574('0x43')](_0x529c9c[_0xd574('0x3f')][_0xd574('0x43')]));_0x1791a7[_0xd574('0x41')]=_0x1791a7[_0xd574('0x41')][_0xd574('0x44')]?_0x1791a7[_0xd574('0x41')]:_0x296f92[_0xd574('0x3d')];if(!_0x529c9c[_0xd574('0x3f')][_0xd574('0x45')]('nolimit')){_0x1791a7[_0xd574('0x26')]=qs[_0xd574('0x26')](_0x529c9c['query']['limit']);_0x1791a7['offset']=qs[_0xd574('0x25')](_0x529c9c[_0xd574('0x3f')]['offset']);}_0x1791a7[_0xd574('0x47')]=qs[_0xd574('0x48')](_0x529c9c['query']['sort']);_0x1791a7[_0xd574('0x49')]=qs[_0xd574('0x40')](_['pick'](_0x529c9c[_0xd574('0x3f')],_0x296f92[_0xd574('0x40')]));_0x1791a7[_0xd574('0x49')][_0xd574('0xb1')]=_0x552e38['id'];if(_0x529c9c[_0xd574('0x3f')]['filter']){_0x1791a7[_0xd574('0x49')]=_[_0xd574('0xa1')](_0x1791a7[_0xd574('0x49')],{'$or':_[_0xd574('0x37')](_0x1791a7[_0xd574('0x41')],function(_0x350aa2){var _0x34e67a={};_0x34e67a[_0x350aa2]={'$like':'%'+_0x529c9c['query'][_0xd574('0x8a')]+'%'};return _0x34e67a;})});}if(_0x529c9c[_0xd574('0x3f')][_0xd574('0x82')]){var _0x4292b7=_0x529c9c[_0xd574('0x3f')][_0xd574('0x82')][_0xd574('0x32')](',');var _0x1d3542={};_0x1d3542[_0x4292b7[0x0]]={'$gte':moment(_0x4292b7[0x1])[_0xd574('0xbd')](_0xd574('0xbe'))};_0x1791a7[_0xd574('0x49')]=_[_0xd574('0xa1')](_0x1791a7[_0xd574('0x49')],_0x1d3542);}_0x1791a7=_[_0xd574('0xa1')]({},_0x1791a7,_0x529c9c[_0xd574('0xb5')]);return db[_0xd574('0xbc')][_0xd574('0x24')]({'where':_0x1791a7[_0xd574('0x49')]})['then'](function(_0x2c79ca){_0x3ef7c1[_0xd574('0x24')]=_0x2c79ca;if(_0x529c9c[_0xd574('0x3f')]['includeAll']){_0x1791a7[_0xd574('0xbf')]=[{'all':!![]}];}return db[_0xd574('0xbc')][_0xd574('0xc0')](_0x1791a7);})[_0xd574('0x2c')](function(_0x5e21a3){_0x3ef7c1[_0xd574('0xb3')]=_0x5e21a3;return _0x3ef7c1;});}})[_0xd574('0x2c')](respondWithFilteredResult(_0x3eb79,_0x1791a7))[_0xd574('0x35')](handleError(_0x3eb79,null));};exports[_0xd574('0xc1')]=function(_0x4e28f6,_0x41a9b6,_0x58df8c){return db['FaxInteraction'][_0xd574('0x64')]({'where':{'id':_0x4e28f6[_0xd574('0xb4')]['id']}})[_0xd574('0x2c')](handleEntityNotFound(_0x41a9b6,null))['then'](function(_0x48e83d){if(_0x48e83d){return _0x48e83d[_0xd574('0xc2')](_0x4e28f6['body'][_0xd574('0xb8')],_['omit'](_0x4e28f6[_0xd574('0x7a')],['ids','id'])||{})['spread'](function(){return db[_0xd574('0x74')][_0xd574('0xc0')]({'attributes':['id',_0xd574('0x2e'),_0xd574('0x4d')],'where':{'id':_0x4e28f6['body']['ids']}});})[_0xd574('0x2c')](function(_0x29905e){socket['emit'](_0xd574('0xc3'),{'id':Number(_0x4e28f6['params']['id']),'tags':_0x29905e||[]});return{'id':Number(_0x4e28f6['params']['id']),'tags':_0x29905e||[]};});}})[_0xd574('0x2c')](respondWithResult(_0x41a9b6,null))['catch'](handleError(_0x41a9b6,null));};exports[_0xd574('0xc4')]=function(_0x2f8982,_0x15916f,_0x57f401){return db[_0xd574('0x38')]['find']({'where':{'id':_0x2f8982[_0xd574('0xb4')]['id']}})['then'](handleEntityNotFound(_0x15916f,null))[_0xd574('0x2c')](function(_0x52fe98){if(_0x52fe98){return _0x52fe98['removeTags'](_0x2f8982[_0xd574('0x3f')][_0xd574('0xb8')]);}})[_0xd574('0x2c')](respondWithStatusCode(_0x15916f,null))[_0xd574('0x35')](handleError(_0x15916f,null));};exports['download']=function(_0x4ee1ad,_0x1b11f5){var _0x106bec=moment()[_0xd574('0xc5')]()[_0xd574('0x9e')]();var _0x57aff7=path[_0xd574('0xc6')](config['root'],_0xd574('0xc7'),_0xd574('0xc8'),_0xd574('0xc9'));var _0x1b44ce=path[_0xd574('0xc6')](config['root'],_0xd574('0xc7'),_0xd574('0xc8'),_0xd574('0xca'));var _0x193bb1=path[_0xd574('0xc6')](_0x57aff7,_0x106bec);var _0x12343d=util[_0xd574('0xbd')]('transcript-%d-%s.zip',_0x4ee1ad['params']['id'],_0x106bec);var _0x2deb08=path[_0xd574('0xc6')](_0x57aff7,_0x12343d);var _0x39bbfe=[];_0x39bbfe[_0xd574('0x34')]({'model':db[_0xd574('0xcb')],'as':_0xd574('0xcb'),'raw':!![]});var _0x24c010=[{'model':db[_0xd574('0xbc')],'as':_0xd574('0xcc'),'attributes':['id','body',_0xd574('0x80')],'include':_0x39bbfe}];return db['FaxInteraction'][_0xd574('0x64')]({'where':{'id':_0x4ee1ad[_0xd574('0xb4')]['id']},'include':_0x24c010})[_0xd574('0x2c')](handleEntityNotFound(_0x1b11f5,null))[_0xd574('0x2c')](function(_0x20d92c){if(_0x20d92c&&_0x20d92c[_0xd574('0xcc')]){var _0x46205e=_0x20d92c[_0xd574('0xcd')]({'plain':!![]});fs[_0xd574('0xce')](_0x193bb1);for(var _0x53eb07=0x0;_0x53eb07<_0x46205e[_0xd574('0xcc')]['length'];_0x53eb07++){var _0x3d69fa=_0x46205e[_0xd574('0xcc')][_0x53eb07]['Attachment'];if(_0x3d69fa){var _0x32bc6d=path['join'](_0x1b44ce,_0x3d69fa['basename']);if(fs['existsSync'](_0x32bc6d)){fs[_0xd574('0xcf')](_0x32bc6d)[_0xd574('0xd0')](fs[_0xd574('0xd1')](path[_0xd574('0xc6')](_0x193bb1,_0x3d69fa[_0xd574('0xd2')])));}}}return BPromise[_0xd574('0xd3')]()[_0xd574('0x2c')](function(){return new BPromise(function(_0x3d1c27,_0x5b47ee){zipdir(_0x193bb1,{'saveTo':_0x2deb08},function(_0x2bc9de,_0x103648){if(_0x2bc9de)return _0x5b47ee(_0x2bc9de);return _0x3d1c27(_0x103648);});})[_0xd574('0x2c')](function(){return new BPromise(function(_0x227593,_0x561b59){rimraf(_0x193bb1,function(_0x52ebb5){if(_0x52ebb5)_0x561b59(_0x52ebb5);return _0x227593();});});})[_0xd574('0x2c')](function(){return _0x1b11f5[_0xd574('0xd4')](_0x2deb08,_0x12343d,function(_0x430c89){if(_0x430c89){console[_0xd574('0xd5')](_0xd574('0xd6'),_0x430c89);}else{fs[_0xd574('0xd7')](_0x2deb08);}});});});}else{return _0x1b11f5[_0xd574('0x21')](0xc8);}})[_0xd574('0x35')](handleError(_0x1b11f5,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 912f65d..c70dfc9 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 _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x5dee2a,_0x47d02a){var _0x31e98e=function(_0x48b1e9){while(--_0x48b1e9){_0x5dee2a['push'](_0x5dee2a['shift']());}};_0x31e98e(++_0x47d02a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file +var _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x49ae6f,_0x409142){var _0x2a48c7=function(_0x35911c){while(--_0x35911c){_0x49ae6f['push'](_0x49ae6f['shift']());}};_0x2a48c7(++_0x409142);}(_0x814b,0x1a2));var _0xb814=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x814b[_0x380307];return _0x9ea14b;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index da31baa..e75e9db 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 _0x91a7=['bluebird','path','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x5c221b,_0x2ffc5d){var _0x136355=function(_0x5c37ec){while(--_0x5c37ec){_0x5c221b['push'](_0x5c221b['shift']());}};_0x136355(++_0x2ffc5d);}(_0x91a7,0xe7));var _0x791a=function(_0x506b83,_0x5f5b01){_0x506b83=_0x506b83-0x0;var _0x1b04f2=_0x91a7[_0x506b83];return _0x1b04f2;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5aa10a,_0x1a32b4,_0x12884d){if(_0x5aa10a[_0x791a('0x9')](_0x791a('0xa'))){_0x5aa10a[_0x791a('0xb')]=moment()['format'](_0x791a('0xc'));}_0x12884d(null,_0x5aa10a);}}});}; \ No newline at end of file +var _0x750a=['FaxInteraction','fax_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x414d86,_0x32abf3){var _0x4170d6=function(_0x5abcb2){while(--_0x5abcb2){_0x414d86['push'](_0x414d86['shift']());}};_0x4170d6(++_0x32abf3);}(_0x750a,0x140));var _0xa750=function(_0x5d5fd6,_0x22dbb8){_0x5d5fd6=_0x5d5fd6-0x0;var _0x2c93e7=_0x750a[_0x5d5fd6];return _0x2c93e7;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var fs=require('fs');var path=require(_0xa750('0x4'));var rimraf=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var attributes=require(_0xa750('0x7'));module[_0xa750('0x8')]=function(_0x10b4d9,_0x2497df){return _0x10b4d9[_0xa750('0x9')](_0xa750('0xa'),attributes,{'tableName':_0xa750('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47a4dd,_0x53f2cb,_0x2678ff){if(_0x47a4dd['changed'](_0xa750('0xc'))){_0x47a4dd[_0xa750('0xd')]=moment()['format'](_0xa750('0xe'));}_0x2678ff(null,_0x47a4dd);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 28e437d..bde325d 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 _0xd740=['util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','FaxInteraction,\x20%s,\x20%s','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','debug','AddTagsToFaxInteraction','find','where','ids','omit','AddTags','stringify','lodash'];(function(_0x35888b,_0x8e1cf3){var _0x3487d4=function(_0x1c08a5){while(--_0x1c08a5){_0x35888b['push'](_0x35888b['shift']());}};_0x3487d4(++_0x8e1cf3);}(_0xd740,0xcc));var _0x0d74=function(_0x530db1,_0x2b9531){_0x530db1=_0x530db1-0x0;var _0x31c1f2=_0xd740[_0x530db1];return _0x31c1f2;};'use strict';var _=require(_0x0d74('0x0'));var util=require(_0x0d74('0x1'));var moment=require('moment');var BPromise=require(_0x0d74('0x2'));var rs=require(_0x0d74('0x3'));var fs=require('fs');var Redis=require(_0x0d74('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0d74('0x5'));var jayson=require(_0x0d74('0x6'));var client=jayson[_0x0d74('0x7')][_0x0d74('0x8')]({'port':0x232a});config[_0x0d74('0x9')]=_[_0x0d74('0xa')](config[_0x0d74('0x9')],{'host':_0x0d74('0xb'),'port':0x18eb});var socket=require(_0x0d74('0xc'))(new Redis(config[_0x0d74('0x9')]));require('./faxInteraction.socket')[_0x0d74('0xd')](socket);function respondWithRpcPromise(_0x255c46,_0xb0de7c,_0xa2f28f){return new BPromise(function(_0x580c3b,_0x47467c){return client[_0x0d74('0xe')](_0x255c46,_0xa2f28f)[_0x0d74('0xf')](function(_0x532aab){logger[_0x0d74('0x10')]('FaxInteraction,\x20%s,\x20%s',_0xb0de7c,_0x0d74('0x11'));logger['debug'](_0x0d74('0x12'),_0xb0de7c,'request\x20sent',JSON['stringify'](_0x532aab));if(_0x532aab['error']){if(_0x532aab[_0x0d74('0x13')][_0x0d74('0x14')]===0x1f4){logger[_0x0d74('0x13')]('FaxInteraction,\x20%s,\x20%s',_0xb0de7c,_0x532aab[_0x0d74('0x13')][_0x0d74('0x15')]);return _0x47467c(_0x532aab[_0x0d74('0x13')][_0x0d74('0x15')]);}logger[_0x0d74('0x13')]('FaxInteraction,\x20%s,\x20%s',_0xb0de7c,_0x532aab['error'][_0x0d74('0x15')]);return _0x580c3b(_0x532aab[_0x0d74('0x13')][_0x0d74('0x15')]);}else{logger[_0x0d74('0x10')](_0x0d74('0x16'),_0xb0de7c,_0x0d74('0x11'));_0x580c3b(_0x532aab[_0x0d74('0x17')]['message']);}})[_0x0d74('0x18')](function(_0x10c62d){logger[_0x0d74('0x13')](_0x0d74('0x16'),_0xb0de7c,_0x10c62d);_0x47467c(_0x10c62d);});});}exports[_0x0d74('0x19')]=function(_0x49c912){var _0x254e76=this;return new Promise(function(_0x108eaf,_0x2ec720){return db[_0x0d74('0x1a')][_0x0d74('0x1b')](_0x49c912[_0x0d74('0x1c')],{'raw':_0x49c912[_0x0d74('0x1d')]?_0x49c912[_0x0d74('0x1d')][_0x0d74('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49c912[_0x0d74('0x1d')]?_0x49c912[_0x0d74('0x1d')]['where']||null:null,'attributes':_0x49c912['options']?_0x49c912['options'][_0x0d74('0x1f')]||null:null,'limit':_0x49c912[_0x0d74('0x1d')]?_0x49c912[_0x0d74('0x1d')][_0x0d74('0x20')]||null:null})[_0x0d74('0xf')](function(_0xba82ea){logger[_0x0d74('0x10')](_0x0d74('0x19'),_0x49c912);logger[_0x0d74('0x21')](_0x0d74('0x19'),_0x49c912,JSON['stringify'](_0xba82ea));_0x108eaf(_0xba82ea);})[_0x0d74('0x18')](function(_0x198a79){logger[_0x0d74('0x13')](_0x0d74('0x19'),_0x198a79[_0x0d74('0x15')],_0x49c912);_0x2ec720(_0x254e76[_0x0d74('0x13')](0x1f4,_0x198a79[_0x0d74('0x15')]));});});};exports[_0x0d74('0x22')]=function(_0x1c06ba){return new Promise(function(_0xd5e4d3,_0x102bf7){return db['FaxInteraction'][_0x0d74('0x23')]({'where':_0x1c06ba[_0x0d74('0x1d')]?_0x1c06ba['options'][_0x0d74('0x24')]||null:null})[_0x0d74('0xf')](function(_0x20c725){if(_0x20c725){return _0x20c725['addTags'](_0x1c06ba['body'][_0x0d74('0x25')],_[_0x0d74('0x26')](_0x1c06ba[_0x0d74('0x1c')],[_0x0d74('0x25'),'id'])||{});}})['spread'](function(_0x552f62){logger[_0x0d74('0x10')](_0x0d74('0x27'),_0x1c06ba);logger[_0x0d74('0x21')]('AddTags',_0x1c06ba,JSON[_0x0d74('0x28')](_0x552f62));_0xd5e4d3(_0x552f62);})[_0x0d74('0x18')](function(_0x54dd2c){logger[_0x0d74('0x13')](_0x0d74('0x27'),_0x54dd2c[_0x0d74('0x15')],_0x1c06ba);_0x102bf7(_this[_0x0d74('0x13')](0x1f4,_0x54dd2c[_0x0d74('0x15')]));});});}; \ No newline at end of file +var _0xdbd6=['request','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','raw','options','where','limit','then','AddTagsToFaxInteraction','find','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register'];(function(_0x28765c,_0x12a2bd){var _0x57a6e7=function(_0x36eeae){while(--_0x36eeae){_0x28765c['push'](_0x28765c['shift']());}};_0x57a6e7(++_0x12a2bd);}(_0xdbd6,0x12e));var _0x6dbd=function(_0x3e3f61,_0x506633){_0x3e3f61=_0x3e3f61-0x0;var _0xae7de4=_0xdbd6[_0x3e3f61];return _0xae7de4;};'use strict';var _=require(_0x6dbd('0x0'));var util=require(_0x6dbd('0x1'));var moment=require(_0x6dbd('0x2'));var BPromise=require(_0x6dbd('0x3'));var rs=require(_0x6dbd('0x4'));var fs=require('fs');var Redis=require(_0x6dbd('0x5'));var db=require(_0x6dbd('0x6'))['db'];var utils=require(_0x6dbd('0x7'));var logger=require(_0x6dbd('0x8'))(_0x6dbd('0x9'));var config=require(_0x6dbd('0xa'));var jayson=require(_0x6dbd('0xb'));var client=jayson[_0x6dbd('0xc')][_0x6dbd('0xd')]({'port':0x232a});config[_0x6dbd('0xe')]=_[_0x6dbd('0xf')](config[_0x6dbd('0xe')],{'host':_0x6dbd('0x10'),'port':0x18eb});var socket=require(_0x6dbd('0x11'))(new Redis(config[_0x6dbd('0xe')]));require(_0x6dbd('0x12'))[_0x6dbd('0x13')](socket);function respondWithRpcPromise(_0x373e46,_0x53bc0e,_0x5dd56a){return new BPromise(function(_0x317973,_0x1f166a){return client[_0x6dbd('0x14')](_0x373e46,_0x5dd56a)['then'](function(_0x352e97){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x53bc0e,_0x6dbd('0x15'));logger[_0x6dbd('0x16')](_0x6dbd('0x17'),_0x53bc0e,_0x6dbd('0x15'),JSON[_0x6dbd('0x18')](_0x352e97));if(_0x352e97[_0x6dbd('0x19')]){if(_0x352e97[_0x6dbd('0x19')][_0x6dbd('0x1a')]===0x1f4){logger[_0x6dbd('0x19')](_0x6dbd('0x1b'),_0x53bc0e,_0x352e97[_0x6dbd('0x19')][_0x6dbd('0x1c')]);return _0x1f166a(_0x352e97['error'][_0x6dbd('0x1c')]);}logger[_0x6dbd('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x53bc0e,_0x352e97['error'][_0x6dbd('0x1c')]);return _0x317973(_0x352e97[_0x6dbd('0x19')]['message']);}else{logger[_0x6dbd('0x1d')](_0x6dbd('0x1b'),_0x53bc0e,_0x6dbd('0x15'));_0x317973(_0x352e97[_0x6dbd('0x1e')][_0x6dbd('0x1c')]);}})[_0x6dbd('0x1f')](function(_0x5d9fd2){logger[_0x6dbd('0x19')](_0x6dbd('0x1b'),_0x53bc0e,_0x5d9fd2);_0x1f166a(_0x5d9fd2);});});}exports[_0x6dbd('0x20')]=function(_0x4b01c3){var _0x58ddcb=this;return new Promise(function(_0x284a37,_0x5c9e90){return db[_0x6dbd('0x21')][_0x6dbd('0x22')](_0x4b01c3[_0x6dbd('0x23')],{'raw':_0x4b01c3['options']?_0x4b01c3['options'][_0x6dbd('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b01c3[_0x6dbd('0x25')]?_0x4b01c3[_0x6dbd('0x25')][_0x6dbd('0x26')]||null:null,'attributes':_0x4b01c3[_0x6dbd('0x25')]?_0x4b01c3[_0x6dbd('0x25')]['attributes']||null:null,'limit':_0x4b01c3[_0x6dbd('0x25')]?_0x4b01c3[_0x6dbd('0x25')][_0x6dbd('0x27')]||null:null})[_0x6dbd('0x28')](function(_0x3ad54e){logger[_0x6dbd('0x1d')](_0x6dbd('0x20'),_0x4b01c3);logger[_0x6dbd('0x16')](_0x6dbd('0x20'),_0x4b01c3,JSON['stringify'](_0x3ad54e));_0x284a37(_0x3ad54e);})[_0x6dbd('0x1f')](function(_0x33e3e9){logger['error'](_0x6dbd('0x20'),_0x33e3e9[_0x6dbd('0x1c')],_0x4b01c3);_0x5c9e90(_0x58ddcb['error'](0x1f4,_0x33e3e9[_0x6dbd('0x1c')]));});});};exports[_0x6dbd('0x29')]=function(_0x25c104){return new Promise(function(_0x4c6aaa,_0x48101b){return db[_0x6dbd('0x21')][_0x6dbd('0x2a')]({'where':_0x25c104['options']?_0x25c104[_0x6dbd('0x25')][_0x6dbd('0x26')]||null:null})['then'](function(_0x3267e7){if(_0x3267e7){return _0x3267e7['addTags'](_0x25c104[_0x6dbd('0x23')][_0x6dbd('0x2b')],_['omit'](_0x25c104[_0x6dbd('0x23')],[_0x6dbd('0x2b'),'id'])||{});}})[_0x6dbd('0x2c')](function(_0x3ba30b){logger[_0x6dbd('0x1d')]('AddTags',_0x25c104);logger[_0x6dbd('0x16')](_0x6dbd('0x2d'),_0x25c104,JSON[_0x6dbd('0x18')](_0x3ba30b));_0x4c6aaa(_0x3ba30b);})[_0x6dbd('0x1f')](function(_0x5f4304){logger[_0x6dbd('0x19')]('AddTags',_0x5f4304[_0x6dbd('0x1c')],_0x25c104);_0x48101b(_this[_0x6dbd('0x19')](0x1f4,_0x5f4304[_0x6dbd('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index fc8dffc..50cf0dd 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 _0x40f0=['removeListener','register','faxInteraction:','remove','update','emit'];(function(_0x382d66,_0x2f5271){var _0xa3c411=function(_0x22810d){while(--_0x22810d){_0x382d66['push'](_0x382d66['shift']());}};_0xa3c411(++_0x2f5271);}(_0x40f0,0x6f));var _0x040f=function(_0x2db756,_0x30f837){_0x2db756=_0x2db756-0x0;var _0x27baa6=_0x40f0[_0x2db756];return _0x27baa6;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x040f('0x0'),_0x040f('0x1')];function createListener(_0x2073d7,_0x5a8406){return function(_0x364fe0){_0x5a8406[_0x040f('0x2')](_0x2073d7,_0x364fe0);};}function removeListener(_0x748177,_0x5a5f64){return function(){FaxInteractionEvents[_0x040f('0x3')](_0x748177,_0x5a5f64);};}exports[_0x040f('0x4')]=function(_0x300268){for(var _0x3c57a7=0x0,_0x4de01c=events['length'];_0x3c57a7<_0x4de01c;_0x3c57a7++){var _0x3c46e6=events[_0x3c57a7];var _0x43a65f=createListener(_0x040f('0x5')+_0x3c46e6,_0x300268);FaxInteractionEvents['on'](_0x3c46e6,_0x43a65f);}}; \ No newline at end of file +var _0x98e9=['update','emit','removeListener','register','./faxInteraction.events','save','remove'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x98e9,0x19a));var _0x998e=function(_0x26fadc,_0xf81575){_0x26fadc=_0x26fadc-0x0;var _0x49921a=_0x98e9[_0x26fadc];return _0x49921a;};'use strict';var FaxInteractionEvents=require(_0x998e('0x0'));var events=[_0x998e('0x1'),_0x998e('0x2'),_0x998e('0x3')];function createListener(_0x61d244,_0x23e29e){return function(_0x48bfdc){_0x23e29e[_0x998e('0x4')](_0x61d244,_0x48bfdc);};}function removeListener(_0x397859,_0x2a422e){return function(){FaxInteractionEvents[_0x998e('0x5')](_0x397859,_0x2a422e);};}exports[_0x998e('0x6')]=function(_0x8a2f8d){for(var _0x22c748=0x0,_0x45f0c6=events['length'];_0x22c748<_0x45f0c6;_0x22c748++){var _0x51da67=events[_0x22c748];var _0x2841b6=createListener('faxInteraction:'+_0x51da67,_0x8a2f8d);FaxInteractionEvents['on'](_0x51da67,_0x2841b6);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 039f71a..97fada9 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 _0xbff9=['isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxInteraction.controller','get'];(function(_0x519145,_0x2b854c){var _0x33de12=function(_0xf78e8b){while(--_0xf78e8b){_0x519145['push'](_0x519145['shift']());}};_0x33de12(++_0x2b854c);}(_0xbff9,0x197));var _0x9bff=function(_0x2cbfa5,_0x369a91){_0x2cbfa5=_0x2cbfa5-0x0;var _0x53c11c=_0xbff9[_0x2cbfa5];return _0x53c11c;};'use strict';var multer=require(_0x9bff('0x0'));var util=require(_0x9bff('0x1'));var path=require(_0x9bff('0x2'));var timeout=require(_0x9bff('0x3'));var express=require(_0x9bff('0x4'));var router=express[_0x9bff('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9bff('0x6'));var config=require('../../config/environment');var controller=require(_0x9bff('0x7'));router[_0x9bff('0x8')]('/',auth[_0x9bff('0x9')](),controller[_0x9bff('0xa')]);router['get'](_0x9bff('0xb'),auth[_0x9bff('0x9')](),controller[_0x9bff('0xc')]);router[_0x9bff('0x8')](_0x9bff('0xd'),auth[_0x9bff('0x9')](),controller['show']);router['get'](_0x9bff('0xe'),auth[_0x9bff('0x9')](),controller['getMessages']);router[_0x9bff('0x8')](_0x9bff('0xf'),auth[_0x9bff('0x9')](),controller[_0x9bff('0x10')]);router[_0x9bff('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9bff('0x11')]('/:id/messages',auth[_0x9bff('0x9')](),controller[_0x9bff('0x12')]);router[_0x9bff('0x11')](_0x9bff('0x13'),auth[_0x9bff('0x9')](),interaction[_0x9bff('0x14')](_0x9bff('0x15'),_0x9bff('0x16')),controller[_0x9bff('0x17')]);router[_0x9bff('0x18')]('/:id',auth[_0x9bff('0x9')](),interaction[_0x9bff('0x14')](_0x9bff('0x15'),_0x9bff('0x19')),controller[_0x9bff('0x1a')]);router[_0x9bff('0x1b')]('/:id',auth[_0x9bff('0x9')](),interaction[_0x9bff('0x14')](_0x9bff('0x15'),_0x9bff('0x1c')),controller[_0x9bff('0x1d')]);router['delete'](_0x9bff('0x13'),auth[_0x9bff('0x9')](),controller[_0x9bff('0x1e')]);module[_0x9bff('0x1f')]=router; \ No newline at end of file +var _0xf13e=['put','/:id','tracked','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','fax','faxinteraction:addtags','addTags'];(function(_0x434010,_0x591dd5){var _0x37cab1=function(_0x4fab0b){while(--_0x4fab0b){_0x434010['push'](_0x434010['shift']());}};_0x37cab1(++_0x591dd5);}(_0xf13e,0x6a));var _0xef13=function(_0x2c5476,_0x3f9a0){_0x2c5476=_0x2c5476-0x0;var _0x493e1d=_0xf13e[_0x2c5476];return _0x493e1d;};'use strict';var multer=require(_0xef13('0x0'));var util=require(_0xef13('0x1'));var path=require(_0xef13('0x2'));var timeout=require(_0xef13('0x3'));var express=require(_0xef13('0x4'));var router=express[_0xef13('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xef13('0x6'));var controller=require(_0xef13('0x7'));router[_0xef13('0x8')]('/',auth[_0xef13('0x9')](),controller['index']);router[_0xef13('0x8')](_0xef13('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xef13('0x8')]('/:id',auth[_0xef13('0x9')](),controller[_0xef13('0xb')]);router[_0xef13('0x8')](_0xef13('0xc'),auth[_0xef13('0x9')](),controller[_0xef13('0xd')]);router['get'](_0xef13('0xe'),auth[_0xef13('0x9')](),controller[_0xef13('0xf')]);router[_0xef13('0x10')]('/',auth[_0xef13('0x9')](),controller[_0xef13('0x11')]);router[_0xef13('0x10')]('/:id/messages',auth[_0xef13('0x9')](),controller[_0xef13('0x12')]);router[_0xef13('0x10')]('/:id/tags',auth[_0xef13('0x9')](),interaction['tracked'](_0xef13('0x13'),_0xef13('0x14')),controller[_0xef13('0x15')]);router[_0xef13('0x16')](_0xef13('0x17'),auth[_0xef13('0x9')](),interaction[_0xef13('0x18')](_0xef13('0x13'),_0xef13('0x19')),controller[_0xef13('0x1a')]);router['delete'](_0xef13('0x17'),auth['isAuthenticated'](),interaction[_0xef13('0x18')](_0xef13('0x13'),_0xef13('0x1b')),controller[_0xef13('0x1c')]);router[_0xef13('0x1d')]('/:id/tags',auth[_0xef13('0x9')](),controller[_0xef13('0x1e')]);module[_0xef13('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 85baa31..7e385bf 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 _0xeeda=['BOOLEAN','ENUM','out','TEXT','medium'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xeeda,0x8a));var _0xaeed=function(_0x46c92f,_0x56039e){_0x46c92f=_0x46c92f-0x0;var _0x70777c=_0xeeda[_0x46c92f];return _0x70777c;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xaeed('0x0')](_0xaeed('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xaeed('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaeed('0x3')]('in',_0xaeed('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xaeed('0x0')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x0a50=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x479550,_0x237af1){var _0x424527=function(_0x3108bd){while(--_0x3108bd){_0x479550['push'](_0x479550['shift']());}};_0x424527(++_0x237af1);}(_0x0a50,0x158));var _0x00a5=function(_0x8f0755,_0x9b2637){_0x8f0755=_0x8f0755-0x0;var _0x2b2997=_0x0a50[_0x8f0755];return _0x2b2997;};'use strict';var Sequelize=require(_0x00a5('0x0'));module[_0x00a5('0x1')]={'body':{'type':Sequelize[_0x00a5('0x2')](_0x00a5('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x00a5('0x4')]('in',_0x00a5('0x5')),'defaultValue':_0x00a5('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x00a5('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 302b389..00adc2d 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 _0xd06b=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','find','body','params','describe','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','findOne','ContactId','fax','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','attachments','basename','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xd06b,0x79));var _0xbd06=function(_0x54b0d9,_0x17f415){_0x54b0d9=_0x54b0d9-0x0;var _0x1bef29=_0xd06b[_0x54b0d9];return _0x1bef29;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xbd06('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd06('0x1'));var rp=require(_0xbd06('0x2'));var moment=require(_0xbd06('0x3'));var BPromise=require(_0xbd06('0x4'));var Mustache=require(_0xbd06('0x5'));var util=require(_0xbd06('0x6'));var path=require(_0xbd06('0x7'));var sox=require(_0xbd06('0x8'));var csv=require(_0xbd06('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbd06('0xa'));var squel=require(_0xbd06('0xb'));var crypto=require(_0xbd06('0xc'));var jsforce=require(_0xbd06('0xd'));var deskjs=require(_0xbd06('0xe'));var toCsv=require(_0xbd06('0x9'));var querystring=require(_0xbd06('0xf'));var Papa=require(_0xbd06('0x10'));var Redis=require('ioredis');var authService=require(_0xbd06('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbd06('0x12'));var hardwareService=require(_0xbd06('0x13'));var logger=require(_0xbd06('0x14'))(_0xbd06('0x15'));var utils=require('../../config/utils');var config=require(_0xbd06('0x16'));var db=require(_0xbd06('0x17'))['db'];config[_0xbd06('0x18')]=_[_0xbd06('0x19')](config[_0xbd06('0x18')],{'host':_0xbd06('0x1a'),'port':0x18eb});var socket=require(_0xbd06('0x1b'))(new Redis(config['redis']));require(_0xbd06('0x1c'))[_0xbd06('0x1d')](socket);var jayson=require(_0xbd06('0x1e'));var client=jayson['client'][_0xbd06('0x1f')]({'port':0x232c});var client9002=jayson[_0xbd06('0x20')][_0xbd06('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x278d54,_0x2d2532,_0x391b72){if(_0x391b72){var _0x1c60af=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c60af[_0xbd06('0x21')](_0x2d2532)){return _0x278d54;}else{throw new db[(_0xbd06('0x22'))][(_0xbd06('0x23'))](_0xbd06('0x24'));}}else{return _0x278d54;}}function respondWithRpcPromise(_0x425d15,_0x3566a3,_0x4dfc81,_0x693dcc){return new BPromise(function(_0x2e3d58,_0x2720ff){var _0x23883b=_0x693dcc||client;return _0x23883b[_0xbd06('0x25')](_0x425d15,_0x4dfc81)[_0xbd06('0x26')](function(_0x27b147){logger['info'](_0xbd06('0x27'),_0x3566a3,'request\x20sent');logger[_0xbd06('0x28')](_0xbd06('0x29'),_0x3566a3,'request\x20sent',JSON[_0xbd06('0x2a')](_0x27b147));if(_0x27b147[_0xbd06('0x2b')]){if(_0x27b147[_0xbd06('0x2b')]['code']===0x1f4){logger[_0xbd06('0x2b')](_0xbd06('0x27'),_0x3566a3,_0x27b147[_0xbd06('0x2b')]['message']);return _0x2720ff(_0x27b147[_0xbd06('0x2b')][_0xbd06('0x2c')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x3566a3,_0x27b147[_0xbd06('0x2b')][_0xbd06('0x2c')]);return _0x2e3d58(_0x27b147[_0xbd06('0x2b')][_0xbd06('0x2c')]);}else{logger['info'](_0xbd06('0x27'),_0x3566a3,'request\x20sent');_0x2e3d58(_0x27b147[_0xbd06('0x2d')][_0xbd06('0x2c')]);}})[_0xbd06('0x2e')](function(_0x2e536d){logger[_0xbd06('0x2b')](_0xbd06('0x27'),_0x3566a3,_0x2e536d);_0x2720ff(_0x2e536d);});});}function respondWithStatusCode(_0xb77a71,_0x512726){_0x512726=_0x512726||0xcc;return function(_0x400ded){if(_0x400ded){return _0xb77a71[_0xbd06('0x2f')](_0x512726);}return _0xb77a71['status'](_0x512726)['end']();};}function respondWithResult(_0x1d8c62,_0x572df4){_0x572df4=_0x572df4||0xc8;return function(_0xb4f97){if(_0xb4f97){return _0x1d8c62[_0xbd06('0x30')](_0x572df4)[_0xbd06('0x31')](_0xb4f97);}};}function respondWithFilteredResult(_0x197372,_0x538dd7){return function(_0x15629a){if(_0x15629a){var _0x357de1=_0x15629a[_0xbd06('0x32')],_0x44019d=_0x538dd7[_0xbd06('0x33')],_0x292fce=_0x538dd7[_0xbd06('0x33')]+_0x538dd7[_0xbd06('0x34')],_0x38f85b;if(_0x292fce>=_0x357de1){_0x292fce=_0x357de1;_0x38f85b=0xc8;}else{_0x38f85b=0xce;}_0x197372[_0xbd06('0x30')](_0x38f85b);return _0x197372[_0xbd06('0x35')](_0xbd06('0x36'),_0x44019d+'-'+_0x292fce+'/'+_0x357de1)['json'](_0x15629a);}return null;};}function patchUpdates(_0x2b75a4){return function(_0x344acb){try{jsonpatch['apply'](_0x344acb,_0x2b75a4,!![]);}catch(_0x19d5c8){return BPromise[_0xbd06('0x37')](_0x19d5c8);}return _0x344acb['save']();};}function saveUpdates(_0x39f276,_0xdc9f6e){return function(_0x234165){if(_0x234165){return _0x234165[_0xbd06('0x38')](_0x39f276)[_0xbd06('0x26')](function(_0x2c83dc){return _0x2c83dc;});}return null;};}function removeEntity(_0x57a2da,_0x5b3851){return function(_0x5e6de7){if(_0x5e6de7){return _0x5e6de7[_0xbd06('0x39')]()[_0xbd06('0x26')](function(){_0x57a2da[_0xbd06('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20f3da,_0x4050e6){return function(_0x234722){if(!_0x234722){_0x20f3da[_0xbd06('0x2f')](0x194);}return _0x234722;};}function handleError(_0x14cdc4,_0xf497f){_0xf497f=_0xf497f||0x1f4;return function(_0x2b523d){logger[_0xbd06('0x2b')](_0x2b523d[_0xbd06('0x3a')]);if(_0x2b523d[_0xbd06('0x3b')]){delete _0x2b523d[_0xbd06('0x3b')];}_0x14cdc4[_0xbd06('0x30')](_0xf497f)['send'](_0x2b523d);};}exports[_0xbd06('0x3c')]=function(_0x45eeeb,_0x4503d9){var _0x319ca0={},_0x18c8dd={},_0x3a703c={'count':0x0,'rows':[]};var _0x827436=_[_0xbd06('0x3d')](db[_0xbd06('0x3e')][_0xbd06('0x3f')],function(_0x2c6ed6){return{'name':_0x2c6ed6[_0xbd06('0x40')],'type':_0x2c6ed6[_0xbd06('0x41')]['key']};});_0x18c8dd['model']=_['map'](_0x827436,_0xbd06('0x3b'));_0x18c8dd['query']=_[_0xbd06('0x42')](_0x45eeeb[_0xbd06('0x43')]);_0x18c8dd[_0xbd06('0x44')]=_[_0xbd06('0x45')](_0x18c8dd[_0xbd06('0x46')],_0x18c8dd[_0xbd06('0x43')]);_0x319ca0[_0xbd06('0x47')]=_['intersection'](_0x18c8dd[_0xbd06('0x46')],qs[_0xbd06('0x48')](_0x45eeeb['query'][_0xbd06('0x48')]));_0x319ca0['attributes']=_0x319ca0['attributes'][_0xbd06('0x49')]?_0x319ca0[_0xbd06('0x47')]:_0x18c8dd[_0xbd06('0x46')];if(!_0x45eeeb[_0xbd06('0x43')][_0xbd06('0x4a')](_0xbd06('0x4b'))){_0x319ca0[_0xbd06('0x34')]=qs[_0xbd06('0x34')](_0x45eeeb['query'][_0xbd06('0x34')]);_0x319ca0[_0xbd06('0x33')]=qs['offset'](_0x45eeeb[_0xbd06('0x43')][_0xbd06('0x33')]);}_0x319ca0[_0xbd06('0x4c')]=qs[_0xbd06('0x4d')](_0x45eeeb[_0xbd06('0x43')][_0xbd06('0x4d')]);_0x319ca0[_0xbd06('0x4e')]=qs['filters'](_['pick'](_0x45eeeb[_0xbd06('0x43')],_0x18c8dd[_0xbd06('0x44')]),_0x827436);if(_0x45eeeb[_0xbd06('0x43')][_0xbd06('0x4f')]){_0x319ca0['where']=_[_0xbd06('0x50')](_0x319ca0[_0xbd06('0x4e')],{'$or':_[_0xbd06('0x3d')](_0x827436,function(_0x8fb499){if(_0x8fb499[_0xbd06('0x41')]!=='VIRTUAL'){var _0x362d45={};_0x362d45[_0x8fb499[_0xbd06('0x3b')]]={'$like':'%'+_0x45eeeb[_0xbd06('0x43')]['filter']+'%'};return _0x362d45;}})});}_0x319ca0=_['merge']({},_0x319ca0,_0x45eeeb[_0xbd06('0x51')]);var _0x48b348={'where':_0x319ca0[_0xbd06('0x4e')]};return db[_0xbd06('0x3e')][_0xbd06('0x32')](_0x48b348)[_0xbd06('0x26')](function(_0x2e6615){_0x3a703c[_0xbd06('0x32')]=_0x2e6615;if(_0x45eeeb[_0xbd06('0x43')][_0xbd06('0x52')]){_0x319ca0[_0xbd06('0x53')]=[{'all':!![]}];}return db[_0xbd06('0x3e')][_0xbd06('0x54')](_0x319ca0);})[_0xbd06('0x26')](function(_0x3f7474){_0x3a703c[_0xbd06('0x55')]=_0x3f7474;return _0x3a703c;})['then'](respondWithFilteredResult(_0x4503d9,_0x319ca0))[_0xbd06('0x2e')](handleError(_0x4503d9,null));};exports['show']=function(_0x26c76f,_0x1bcd83){var _0x8405d7={'raw':!![],'where':{'id':_0x26c76f['params']['id']}},_0x40c123={};_0x40c123[_0xbd06('0x46')]=_[_0xbd06('0x42')](db['FaxMessage'][_0xbd06('0x3f')]);_0x40c123['query']=_[_0xbd06('0x42')](_0x26c76f[_0xbd06('0x43')]);_0x40c123[_0xbd06('0x44')]=_[_0xbd06('0x45')](_0x40c123[_0xbd06('0x46')],_0x40c123[_0xbd06('0x43')]);_0x8405d7[_0xbd06('0x47')]=_[_0xbd06('0x45')](_0x40c123[_0xbd06('0x46')],qs[_0xbd06('0x48')](_0x26c76f[_0xbd06('0x43')][_0xbd06('0x48')]));_0x8405d7[_0xbd06('0x47')]=_0x8405d7[_0xbd06('0x47')][_0xbd06('0x49')]?_0x8405d7[_0xbd06('0x47')]:_0x40c123[_0xbd06('0x46')];if(_0x26c76f[_0xbd06('0x43')][_0xbd06('0x52')]){_0x8405d7[_0xbd06('0x53')]=[{'all':!![]}];}_0x8405d7=_['merge']({},_0x8405d7,_0x26c76f[_0xbd06('0x51')]);return db['FaxMessage'][_0xbd06('0x56')](_0x8405d7)[_0xbd06('0x26')](handleEntityNotFound(_0x1bcd83,null))[_0xbd06('0x26')](respondWithResult(_0x1bcd83,null))[_0xbd06('0x2e')](handleError(_0x1bcd83,null));};exports[_0xbd06('0x38')]=function(_0x520652,_0x38a980){if(_0x520652[_0xbd06('0x57')]['id']){delete _0x520652['body']['id'];}return db['FaxMessage']['find']({'where':{'id':_0x520652[_0xbd06('0x58')]['id']}})[_0xbd06('0x26')](handleEntityNotFound(_0x38a980,null))[_0xbd06('0x26')](saveUpdates(_0x520652['body'],null))[_0xbd06('0x26')](respondWithResult(_0x38a980,null))['catch'](handleError(_0x38a980,null));};exports[_0xbd06('0x39')]=function(_0x156dfe,_0x32d48f){return db['FaxMessage'][_0xbd06('0x56')]({'where':{'id':_0x156dfe[_0xbd06('0x58')]['id']}})['then'](handleEntityNotFound(_0x32d48f,null))[_0xbd06('0x26')](removeEntity(_0x32d48f,null))[_0xbd06('0x2e')](handleError(_0x32d48f,null));};exports[_0xbd06('0x59')]=function(_0x1a9de4,_0x260613){return db[_0xbd06('0x3e')]['describe']()['then'](respondWithResult(_0x260613,null))['catch'](handleError(_0x260613,null));};var interaction_log=require(_0xbd06('0x14'))(_0xbd06('0x5a'));exports['accept']=function(_0x41fe1a,_0x35e9b9,_0xb06f89){var _0x354615={'channel':'fax'};if(_0x41fe1a[_0xbd06('0x57')]['id']){delete _0x41fe1a[_0xbd06('0x57')]['id'];}_0x41fe1a[_0xbd06('0x57')][_0xbd06('0x5b')]=!![];_0x41fe1a[_0xbd06('0x57')][_0xbd06('0x5c')]=moment()[_0xbd06('0x5d')](_0xbd06('0x5e'));_0x41fe1a[_0xbd06('0x57')][_0xbd06('0x5f')]=_0x41fe1a[_0xbd06('0x57')][_0xbd06('0x5f')]||_0x41fe1a[_0xbd06('0x60')]['id'];return db[_0xbd06('0x3e')][_0xbd06('0x56')]({'where':{'id':_0x41fe1a[_0xbd06('0x58')]['id'],'UserId':null},'include':[{'model':db[_0xbd06('0x61')],'as':'Contact'}]})[_0xbd06('0x26')](handleEntityNotFound(_0x35e9b9,null))[_0xbd06('0x26')](saveUpdates(_0x41fe1a[_0xbd06('0x57')],null))[_0xbd06('0x26')](function(_0xa866ee){if(_0xa866ee){_0x354615['message']=_0xa866ee[_0xbd06('0x62')]({'plain':!![]});return db[_0xbd06('0x63')][_0xbd06('0x56')]({'where':{'id':_0xa866ee[_0xbd06('0x64')]}});}return null;})[_0xbd06('0x26')](handleEntityNotFound(_0x35e9b9,null))['then'](function(_0x5947f3){if(_0x5947f3){return _0x5947f3[_0xbd06('0x38')]({'UserId':_0x41fe1a[_0xbd06('0x57')][_0xbd06('0x5f')],'read1stAt':_[_0xbd06('0x65')](_0x5947f3[_0xbd06('0x66')])?moment()[_0xbd06('0x5d')](_0xbd06('0x5e')):undefined});}return null;})[_0xbd06('0x26')](function(_0x2dd7c0){if(_0x2dd7c0){_0x354615[_0xbd06('0x67')]=_0x2dd7c0[_0xbd06('0x62')]({'plain':!![]});interaction_log[_0xbd06('0x68')](_0xbd06('0x69'),_0x41fe1a['user']['id'],_0x41fe1a[_0xbd06('0x60')][_0xbd06('0x3b')],_0x41fe1a[_0xbd06('0x60')][_0xbd06('0x6a')],_0x354615['interaction']['id'],_0x41fe1a[_0xbd06('0x57')]?JSON[_0xbd06('0x2a')](_0x41fe1a[_0xbd06('0x57')]):_0xbd06('0x6b'));return respondWithRpcPromise(_0xbd06('0x6c'),_0xbd06('0x6d'),_0x354615);}return null;})[_0xbd06('0x26')](function(_0x3031ef){if(_0x3031ef){if(_0x41fe1a[_0xbd06('0x57')]['manual']){_0x354615[_0xbd06('0x2c')][_0xbd06('0x6e')]=util['format'](_0xbd06('0x6f'),_0x41fe1a['user'][_0xbd06('0x3b')]);_0x354615[_0xbd06('0x2c')][_0xbd06('0x70')]=_0x354615[_0xbd06('0x70')];_0x354615['message'][_0xbd06('0x71')]='accept';return respondWithRpcPromise(_0xbd06('0x72'),'EventManager',{'event':'acceptmessage','message':_0x354615[_0xbd06('0x2c')]},client9002)[_0xbd06('0x26')](function(){return _0x354615;});}return _0x354615;}return null;})['then'](respondWithResult(_0x35e9b9,null))[_0xbd06('0x2e')](handleError(_0x35e9b9,null));};var interaction_log=require(_0xbd06('0x14'))(_0xbd06('0x5a'));exports[_0xbd06('0x37')]=function(_0x18bc01,_0x1ce439,_0x45f7c5){var _0x2ff98b={'agent':{},'channel':'fax'};if(_0x18bc01[_0xbd06('0x57')]['id']){delete _0x18bc01[_0xbd06('0x57')]['id'];}_0x18bc01['body'][_0xbd06('0x5f')]=_0x18bc01[_0xbd06('0x57')]['UserId']||_0x18bc01[_0xbd06('0x60')]['id'];_0x2ff98b[_0xbd06('0x73')]['id']=_0x18bc01['body'][_0xbd06('0x5f')];return db[_0xbd06('0x3e')][_0xbd06('0x56')]({'where':{'id':_0x18bc01[_0xbd06('0x58')]['id'],'UserId':null}})[_0xbd06('0x26')](handleEntityNotFound(_0x1ce439,null))[_0xbd06('0x26')](function(_0x32f69a){if(_0x32f69a){_0x2ff98b[_0xbd06('0x2c')]=_0x32f69a[_0xbd06('0x62')]({'plain':!![]});return db[_0xbd06('0x63')][_0xbd06('0x56')]({'where':{'id':_0x32f69a[_0xbd06('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1ce439,null))[_0xbd06('0x26')](function(_0x55ccab){if(_0x55ccab){_0x2ff98b['interaction']=_0x55ccab['get']({'plain':!![]});interaction_log[_0xbd06('0x68')](_0xbd06('0x74'),_0x18bc01[_0xbd06('0x60')]['id'],_0x18bc01[_0xbd06('0x60')][_0xbd06('0x3b')],_0x18bc01[_0xbd06('0x60')][_0xbd06('0x6a')],_0x2ff98b[_0xbd06('0x67')]['id'],_0x18bc01[_0xbd06('0x57')]?JSON[_0xbd06('0x2a')](_0x18bc01[_0xbd06('0x57')]):_0xbd06('0x6b'));return respondWithRpcPromise(_0xbd06('0x75'),_0xbd06('0x76'),_0x2ff98b);}return null;})[_0xbd06('0x26')](function(_0x5e83c1){if(_0x5e83c1){_0x5e83c1[_0xbd06('0x2c')][_0xbd06('0x6e')]=util[_0xbd06('0x5d')](_0xbd06('0x6f'),_0x18bc01[_0xbd06('0x60')]['name']);_0x5e83c1[_0xbd06('0x2c')][_0xbd06('0x70')]=_0x2ff98b['channel'];_0x5e83c1[_0xbd06('0x2c')][_0xbd06('0x71')]='reject';respondWithRpcPromise('EventManager',_0xbd06('0x72'),{'event':_0xbd06('0x77'),'message':_0x5e83c1['message']},client9002);return _0x2ff98b;}return null;})[_0xbd06('0x26')](respondWithResult(_0x1ce439,null))['catch'](handleError(_0x1ce439,null));};exports[_0xbd06('0x78')]=function(_0x1ae0df,_0x3afc00){var _0x302588;return db[_0xbd06('0x3e')]['create'](_0x1ae0df[_0xbd06('0x57')],{})[_0xbd06('0x26')](function(_0x102674){_0x302588=_0x102674;return db['CmContact'][_0xbd06('0x79')]({'where':{'id':_0x302588[_0xbd06('0x7a')]}});})[_0xbd06('0x26')](function(_0x10d849){if(_['isNil'](_0x10d849)){return;}else{_0x302588[_0xbd06('0x7b')]=_0x10d849[_0xbd06('0x7b')];return db[_0xbd06('0x7c')]['findOne']({'where':{'id':_0x302588[_0xbd06('0x7d')]}});}})[_0xbd06('0x26')](function(_0x4e7b61){return respondWithRpcPromise(_0xbd06('0x7e'),'SendFax',{'FaxAccountId':_[_0xbd06('0x65')](_0x1ae0df[_0xbd06('0x57')])?undefined:_0x1ae0df[_0xbd06('0x57')][_0xbd06('0x7f')],'path':_[_0xbd06('0x65')](_0x4e7b61)?undefined:util[_0xbd06('0x5d')](_0xbd06('0x80'),_0x4e7b61['basename']),'fax':_[_0xbd06('0x65')](_0x302588[_0xbd06('0x7b')])?undefined:_0x302588[_0xbd06('0x7b')],'AttachmentId':_0x302588[_0xbd06('0x7d')]},client9002);})[_0xbd06('0x26')](respondWithResult(_0x3afc00,0xc9))[_0xbd06('0x2e')](handleError(_0x3afc00,null));};exports[_0xbd06('0x81')]=function(_0x42de20,_0x5658c7){var _0x5afa08=path[_0xbd06('0x82')](config[_0xbd06('0x83')],_0xbd06('0x84'),'files',_0xbd06('0x85'));return db['FaxMessage'][_0xbd06('0x56')]({'where':{'id':_0x42de20['params']['id']},'include':[{'model':db[_0xbd06('0x7c')],'as':_0xbd06('0x7c')}]})[_0xbd06('0x26')](handleEntityNotFound(_0x5658c7,null))[_0xbd06('0x26')](function(_0x36f835){if(_0x36f835){return _0x5658c7[_0xbd06('0x81')](path['join'](_0x5afa08,_0x36f835[_0xbd06('0x7c')][_0xbd06('0x86')]));}})[_0xbd06('0x2e')](handleError(_0x5658c7,null));}; \ No newline at end of file +var _0x1630=['include','params','find','body','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','FaxInteraction','FaxInteractionId','isNil','read1stAt','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','acceptMessage','SIP/%s','channel','event','EventManager','fax-interactions','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','findOne','ContactId','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','Attachment','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','FaxMessage','includeAll'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x1630,0x1c1));var _0x0163=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x1630[_0x1e4360];return _0x31e6b4;};'use strict';var pdf=require(_0x0163('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0163('0x1'));var zipdir=require(_0x0163('0x2'));var jsonpatch=require(_0x0163('0x3'));var rp=require(_0x0163('0x4'));var moment=require(_0x0163('0x5'));var BPromise=require(_0x0163('0x6'));var Mustache=require(_0x0163('0x7'));var util=require(_0x0163('0x8'));var path=require('path');var sox=require(_0x0163('0x9'));var csv=require(_0x0163('0xa'));var ejs=require(_0x0163('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0163('0xc'));var crypto=require(_0x0163('0xd'));var jsforce=require(_0x0163('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0163('0xf'));var Redis=require(_0x0163('0x10'));var authService=require(_0x0163('0x11'));var qs=require(_0x0163('0x12'));var as=require(_0x0163('0x13'));var hardwareService=require(_0x0163('0x14'));var logger=require(_0x0163('0x15'))(_0x0163('0x16'));var utils=require(_0x0163('0x17'));var config=require(_0x0163('0x18'));var db=require(_0x0163('0x19'))['db'];config[_0x0163('0x1a')]=_[_0x0163('0x1b')](config['redis'],{'host':_0x0163('0x1c'),'port':0x18eb});var socket=require(_0x0163('0x1d'))(new Redis(config[_0x0163('0x1a')]));require('./faxMessage.socket')[_0x0163('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0163('0x1f')][_0x0163('0x20')]({'port':0x232c});var client9002=jayson[_0x0163('0x1f')][_0x0163('0x20')]({'port':0x232a});function checkPasswordPattern(_0x1233f0,_0x490595,_0x26c4d4){if(_0x26c4d4){var _0x43b4d5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x43b4d5[_0x0163('0x21')](_0x490595)){return _0x1233f0;}else{throw new db['Sequelize'][(_0x0163('0x22'))](_0x0163('0x23'));}}else{return _0x1233f0;}}function respondWithRpcPromise(_0x4eec11,_0x24701e,_0x493bfc,_0x18c700){return new BPromise(function(_0x134c01,_0x2352d6){var _0x1e4ffe=_0x18c700||client;return _0x1e4ffe['request'](_0x4eec11,_0x493bfc)['then'](function(_0x39eb30){logger[_0x0163('0x24')](_0x0163('0x25'),_0x24701e,'request\x20sent');logger[_0x0163('0x26')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x24701e,_0x0163('0x27'),JSON[_0x0163('0x28')](_0x39eb30));if(_0x39eb30[_0x0163('0x29')]){if(_0x39eb30[_0x0163('0x29')][_0x0163('0x2a')]===0x1f4){logger[_0x0163('0x29')](_0x0163('0x25'),_0x24701e,_0x39eb30[_0x0163('0x29')][_0x0163('0x2b')]);return _0x2352d6(_0x39eb30[_0x0163('0x29')][_0x0163('0x2b')]);}logger[_0x0163('0x29')](_0x0163('0x25'),_0x24701e,_0x39eb30[_0x0163('0x29')]['message']);return _0x134c01(_0x39eb30[_0x0163('0x29')][_0x0163('0x2b')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x24701e,'request\x20sent');_0x134c01(_0x39eb30[_0x0163('0x2c')][_0x0163('0x2b')]);}})[_0x0163('0x2d')](function(_0x43324c){logger['error'](_0x0163('0x25'),_0x24701e,_0x43324c);_0x2352d6(_0x43324c);});});}function respondWithStatusCode(_0x28be90,_0x463f0c){_0x463f0c=_0x463f0c||0xcc;return function(_0x485b8f){if(_0x485b8f){return _0x28be90[_0x0163('0x2e')](_0x463f0c);}return _0x28be90[_0x0163('0x2f')](_0x463f0c)[_0x0163('0x30')]();};}function respondWithResult(_0x52593b,_0x1f21ad){_0x1f21ad=_0x1f21ad||0xc8;return function(_0x280afb){if(_0x280afb){return _0x52593b[_0x0163('0x2f')](_0x1f21ad)[_0x0163('0x31')](_0x280afb);}};}function respondWithFilteredResult(_0x4f29fb,_0x2496e2){return function(_0x45e40a){if(_0x45e40a){var _0x3d6054=_0x45e40a[_0x0163('0x32')],_0x125a59=_0x2496e2[_0x0163('0x33')],_0x1e2cd2=_0x2496e2[_0x0163('0x33')]+_0x2496e2[_0x0163('0x34')],_0x120a31;if(_0x1e2cd2>=_0x3d6054){_0x1e2cd2=_0x3d6054;_0x120a31=0xc8;}else{_0x120a31=0xce;}_0x4f29fb[_0x0163('0x2f')](_0x120a31);return _0x4f29fb[_0x0163('0x35')](_0x0163('0x36'),_0x125a59+'-'+_0x1e2cd2+'/'+_0x3d6054)[_0x0163('0x31')](_0x45e40a);}return null;};}function patchUpdates(_0xbcf440){return function(_0x59adc3){try{jsonpatch[_0x0163('0x37')](_0x59adc3,_0xbcf440,!![]);}catch(_0x4b36cc){return BPromise['reject'](_0x4b36cc);}return _0x59adc3[_0x0163('0x38')]();};}function saveUpdates(_0x258dd6,_0x39db80){return function(_0x5d4374){if(_0x5d4374){return _0x5d4374[_0x0163('0x39')](_0x258dd6)[_0x0163('0x3a')](function(_0x2a3e0d){return _0x2a3e0d;});}return null;};}function removeEntity(_0x250cc6,_0x125091){return function(_0x104bb3){if(_0x104bb3){return _0x104bb3[_0x0163('0x3b')]()[_0x0163('0x3a')](function(){_0x250cc6[_0x0163('0x2f')](0xcc)[_0x0163('0x30')]();});}};}function handleEntityNotFound(_0x5b5ae4,_0x353725){return function(_0x304a53){if(!_0x304a53){_0x5b5ae4['sendStatus'](0x194);}return _0x304a53;};}function handleError(_0x567b9d,_0xca2c1c){_0xca2c1c=_0xca2c1c||0x1f4;return function(_0x53d859){logger['error'](_0x53d859[_0x0163('0x3c')]);if(_0x53d859[_0x0163('0x3d')]){delete _0x53d859['name'];}_0x567b9d[_0x0163('0x2f')](_0xca2c1c)['send'](_0x53d859);};}exports[_0x0163('0x3e')]=function(_0x21fbac,_0x46874d){var _0x3ac366={},_0x3901d0={},_0x514726={'count':0x0,'rows':[]};var _0xd4e265=_[_0x0163('0x3f')](db['FaxMessage'][_0x0163('0x40')],function(_0x7325a5){return{'name':_0x7325a5[_0x0163('0x41')],'type':_0x7325a5[_0x0163('0x42')][_0x0163('0x43')]};});_0x3901d0[_0x0163('0x44')]=_[_0x0163('0x3f')](_0xd4e265,_0x0163('0x3d'));_0x3901d0[_0x0163('0x45')]=_[_0x0163('0x46')](_0x21fbac[_0x0163('0x45')]);_0x3901d0['filters']=_[_0x0163('0x47')](_0x3901d0[_0x0163('0x44')],_0x3901d0[_0x0163('0x45')]);_0x3ac366[_0x0163('0x48')]=_[_0x0163('0x47')](_0x3901d0['model'],qs[_0x0163('0x49')](_0x21fbac[_0x0163('0x45')][_0x0163('0x49')]));_0x3ac366['attributes']=_0x3ac366[_0x0163('0x48')][_0x0163('0x4a')]?_0x3ac366[_0x0163('0x48')]:_0x3901d0['model'];if(!_0x21fbac[_0x0163('0x45')][_0x0163('0x4b')](_0x0163('0x4c'))){_0x3ac366[_0x0163('0x34')]=qs[_0x0163('0x34')](_0x21fbac[_0x0163('0x45')][_0x0163('0x34')]);_0x3ac366[_0x0163('0x33')]=qs[_0x0163('0x33')](_0x21fbac[_0x0163('0x45')]['offset']);}_0x3ac366['order']=qs[_0x0163('0x4d')](_0x21fbac[_0x0163('0x45')][_0x0163('0x4d')]);_0x3ac366[_0x0163('0x4e')]=qs[_0x0163('0x4f')](_[_0x0163('0x50')](_0x21fbac[_0x0163('0x45')],_0x3901d0[_0x0163('0x4f')]),_0xd4e265);if(_0x21fbac[_0x0163('0x45')]['filter']){_0x3ac366[_0x0163('0x4e')]=_['merge'](_0x3ac366[_0x0163('0x4e')],{'$or':_['map'](_0xd4e265,function(_0x588260){if(_0x588260[_0x0163('0x42')]!==_0x0163('0x51')){var _0x3d3ea0={};_0x3d3ea0[_0x588260[_0x0163('0x3d')]]={'$like':'%'+_0x21fbac['query'][_0x0163('0x52')]+'%'};return _0x3d3ea0;}})});}_0x3ac366=_[_0x0163('0x53')]({},_0x3ac366,_0x21fbac[_0x0163('0x54')]);var _0x1b56a9={'where':_0x3ac366[_0x0163('0x4e')]};return db[_0x0163('0x55')][_0x0163('0x32')](_0x1b56a9)[_0x0163('0x3a')](function(_0x72078e){_0x514726['count']=_0x72078e;if(_0x21fbac[_0x0163('0x45')][_0x0163('0x56')]){_0x3ac366[_0x0163('0x57')]=[{'all':!![]}];}return db[_0x0163('0x55')]['findAll'](_0x3ac366);})[_0x0163('0x3a')](function(_0x5af884){_0x514726['rows']=_0x5af884;return _0x514726;})[_0x0163('0x3a')](respondWithFilteredResult(_0x46874d,_0x3ac366))['catch'](handleError(_0x46874d,null));};exports['show']=function(_0x3b6b89,_0xda65fd){var _0x5807eb={'raw':!![],'where':{'id':_0x3b6b89[_0x0163('0x58')]['id']}},_0x58123b={};_0x58123b[_0x0163('0x44')]=_[_0x0163('0x46')](db[_0x0163('0x55')][_0x0163('0x40')]);_0x58123b[_0x0163('0x45')]=_[_0x0163('0x46')](_0x3b6b89[_0x0163('0x45')]);_0x58123b[_0x0163('0x4f')]=_['intersection'](_0x58123b[_0x0163('0x44')],_0x58123b[_0x0163('0x45')]);_0x5807eb['attributes']=_[_0x0163('0x47')](_0x58123b[_0x0163('0x44')],qs[_0x0163('0x49')](_0x3b6b89[_0x0163('0x45')][_0x0163('0x49')]));_0x5807eb['attributes']=_0x5807eb[_0x0163('0x48')][_0x0163('0x4a')]?_0x5807eb[_0x0163('0x48')]:_0x58123b[_0x0163('0x44')];if(_0x3b6b89[_0x0163('0x45')][_0x0163('0x56')]){_0x5807eb[_0x0163('0x57')]=[{'all':!![]}];}_0x5807eb=_[_0x0163('0x53')]({},_0x5807eb,_0x3b6b89[_0x0163('0x54')]);return db[_0x0163('0x55')][_0x0163('0x59')](_0x5807eb)['then'](handleEntityNotFound(_0xda65fd,null))[_0x0163('0x3a')](respondWithResult(_0xda65fd,null))[_0x0163('0x2d')](handleError(_0xda65fd,null));};exports[_0x0163('0x39')]=function(_0x482c48,_0x49699d){if(_0x482c48[_0x0163('0x5a')]['id']){delete _0x482c48[_0x0163('0x5a')]['id'];}return db['FaxMessage'][_0x0163('0x59')]({'where':{'id':_0x482c48[_0x0163('0x58')]['id']}})[_0x0163('0x3a')](handleEntityNotFound(_0x49699d,null))[_0x0163('0x3a')](saveUpdates(_0x482c48[_0x0163('0x5a')],null))[_0x0163('0x3a')](respondWithResult(_0x49699d,null))[_0x0163('0x2d')](handleError(_0x49699d,null));};exports[_0x0163('0x3b')]=function(_0x1152fb,_0x1801cf){return db[_0x0163('0x55')][_0x0163('0x59')]({'where':{'id':_0x1152fb[_0x0163('0x58')]['id']}})[_0x0163('0x3a')](handleEntityNotFound(_0x1801cf,null))['then'](removeEntity(_0x1801cf,null))[_0x0163('0x2d')](handleError(_0x1801cf,null));};exports['describe']=function(_0x3d886b,_0x4cd682){return db[_0x0163('0x55')][_0x0163('0x5b')]()[_0x0163('0x3a')](respondWithResult(_0x4cd682,null))[_0x0163('0x2d')](handleError(_0x4cd682,null));};var interaction_log=require(_0x0163('0x15'))('fax-interactions');exports[_0x0163('0x5c')]=function(_0x398a44,_0x2f1ab2,_0x319031){var _0x186485={'channel':_0x0163('0x5d')};if(_0x398a44[_0x0163('0x5a')]['id']){delete _0x398a44[_0x0163('0x5a')]['id'];}_0x398a44[_0x0163('0x5a')][_0x0163('0x5e')]=!![];_0x398a44[_0x0163('0x5a')][_0x0163('0x5f')]=moment()[_0x0163('0x60')](_0x0163('0x61'));_0x398a44['body']['UserId']=_0x398a44[_0x0163('0x5a')][_0x0163('0x62')]||_0x398a44['user']['id'];return db['FaxMessage'][_0x0163('0x59')]({'where':{'id':_0x398a44[_0x0163('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x0163('0x63')],'as':_0x0163('0x64')}]})[_0x0163('0x3a')](handleEntityNotFound(_0x2f1ab2,null))[_0x0163('0x3a')](saveUpdates(_0x398a44[_0x0163('0x5a')],null))[_0x0163('0x3a')](function(_0x59f9fd){if(_0x59f9fd){_0x186485[_0x0163('0x2b')]=_0x59f9fd['get']({'plain':!![]});return db[_0x0163('0x65')][_0x0163('0x59')]({'where':{'id':_0x59f9fd[_0x0163('0x66')]}});}return null;})[_0x0163('0x3a')](handleEntityNotFound(_0x2f1ab2,null))[_0x0163('0x3a')](function(_0x3cf8fa){if(_0x3cf8fa){return _0x3cf8fa[_0x0163('0x39')]({'UserId':_0x398a44[_0x0163('0x5a')][_0x0163('0x62')],'read1stAt':_[_0x0163('0x67')](_0x3cf8fa[_0x0163('0x68')])?moment()[_0x0163('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0163('0x3a')](function(_0x535ab9){if(_0x535ab9){_0x186485['interaction']=_0x535ab9[_0x0163('0x69')]({'plain':!![]});interaction_log[_0x0163('0x24')](_0x0163('0x6a'),_0x398a44[_0x0163('0x6b')]['id'],_0x398a44['user']['name'],_0x398a44['user'][_0x0163('0x6c')],_0x186485[_0x0163('0x6d')]['id'],_0x398a44[_0x0163('0x5a')]?JSON[_0x0163('0x28')](_0x398a44[_0x0163('0x5a')]):_0x0163('0x6e'));return respondWithRpcPromise('AcceptMessage',_0x0163('0x6f'),_0x186485);}return null;})[_0x0163('0x3a')](function(_0x5f4490){if(_0x5f4490){if(_0x398a44[_0x0163('0x5a')]['manual']){_0x186485['message']['interface']=util['format'](_0x0163('0x70'),_0x398a44[_0x0163('0x6b')][_0x0163('0x3d')]);_0x186485[_0x0163('0x2b')]['channel']=_0x186485[_0x0163('0x71')];_0x186485[_0x0163('0x2b')][_0x0163('0x72')]=_0x0163('0x5c');return respondWithRpcPromise(_0x0163('0x73'),'EventManager',{'event':'acceptmessage','message':_0x186485[_0x0163('0x2b')]},client9002)[_0x0163('0x3a')](function(){return _0x186485;});}return _0x186485;}return null;})[_0x0163('0x3a')](respondWithResult(_0x2f1ab2,null))[_0x0163('0x2d')](handleError(_0x2f1ab2,null));};var interaction_log=require(_0x0163('0x15'))(_0x0163('0x74'));exports[_0x0163('0x75')]=function(_0x3c2e91,_0x268c61,_0x1c9286){var _0x46f9ad={'agent':{},'channel':_0x0163('0x5d')};if(_0x3c2e91[_0x0163('0x5a')]['id']){delete _0x3c2e91[_0x0163('0x5a')]['id'];}_0x3c2e91['body'][_0x0163('0x62')]=_0x3c2e91['body'][_0x0163('0x62')]||_0x3c2e91[_0x0163('0x6b')]['id'];_0x46f9ad['agent']['id']=_0x3c2e91[_0x0163('0x5a')][_0x0163('0x62')];return db['FaxMessage'][_0x0163('0x59')]({'where':{'id':_0x3c2e91[_0x0163('0x58')]['id'],'UserId':null}})[_0x0163('0x3a')](handleEntityNotFound(_0x268c61,null))['then'](function(_0x4055f6){if(_0x4055f6){_0x46f9ad['message']=_0x4055f6[_0x0163('0x69')]({'plain':!![]});return db[_0x0163('0x65')][_0x0163('0x59')]({'where':{'id':_0x4055f6[_0x0163('0x66')]}});}return null;})[_0x0163('0x3a')](handleEntityNotFound(_0x268c61,null))[_0x0163('0x3a')](function(_0x10ffad){if(_0x10ffad){_0x46f9ad[_0x0163('0x6d')]=_0x10ffad[_0x0163('0x69')]({'plain':!![]});interaction_log['info'](_0x0163('0x76'),_0x3c2e91[_0x0163('0x6b')]['id'],_0x3c2e91[_0x0163('0x6b')][_0x0163('0x3d')],_0x3c2e91[_0x0163('0x6b')][_0x0163('0x6c')],_0x46f9ad[_0x0163('0x6d')]['id'],_0x3c2e91[_0x0163('0x5a')]?JSON[_0x0163('0x28')](_0x3c2e91[_0x0163('0x5a')]):_0x0163('0x6e'));return respondWithRpcPromise('RejectMessage',_0x0163('0x77'),_0x46f9ad);}return null;})['then'](function(_0x41ac71){if(_0x41ac71){_0x41ac71[_0x0163('0x2b')][_0x0163('0x78')]=util[_0x0163('0x60')]('SIP/%s',_0x3c2e91[_0x0163('0x6b')][_0x0163('0x3d')]);_0x41ac71['message']['channel']=_0x46f9ad['channel'];_0x41ac71[_0x0163('0x2b')][_0x0163('0x72')]='reject';respondWithRpcPromise('EventManager',_0x0163('0x73'),{'event':'rejectmessage','message':_0x41ac71['message']},client9002);return _0x46f9ad;}return null;})['then'](respondWithResult(_0x268c61,null))[_0x0163('0x2d')](handleError(_0x268c61,null));};exports['create']=function(_0x594c4,_0x92c3b8){var _0x48ff25;return db['FaxMessage']['create'](_0x594c4[_0x0163('0x5a')],{})[_0x0163('0x3a')](function(_0xf26146){_0x48ff25=_0xf26146;return db['CmContact'][_0x0163('0x79')]({'where':{'id':_0x48ff25[_0x0163('0x7a')]}});})[_0x0163('0x3a')](function(_0x3764b6){if(_[_0x0163('0x67')](_0x3764b6)){return;}else{_0x48ff25[_0x0163('0x5d')]=_0x3764b6[_0x0163('0x5d')];return db['Attachment'][_0x0163('0x79')]({'where':{'id':_0x48ff25[_0x0163('0x7b')]}});}})[_0x0163('0x3a')](function(_0x2f2ca3){return respondWithRpcPromise(_0x0163('0x7c'),_0x0163('0x7c'),{'FaxAccountId':_[_0x0163('0x67')](_0x594c4[_0x0163('0x5a')])?undefined:_0x594c4['body'][_0x0163('0x7d')],'path':_[_0x0163('0x67')](_0x2f2ca3)?undefined:util[_0x0163('0x60')](_0x0163('0x7e'),_0x2f2ca3[_0x0163('0x7f')]),'fax':_['isNil'](_0x48ff25[_0x0163('0x5d')])?undefined:_0x48ff25['fax'],'AttachmentId':_0x48ff25[_0x0163('0x7b')]},client9002);})[_0x0163('0x3a')](respondWithResult(_0x92c3b8,0xc9))[_0x0163('0x2d')](handleError(_0x92c3b8,null));};exports[_0x0163('0x80')]=function(_0x2c5ca8,_0x2a4540){var _0x46e06b=path[_0x0163('0x81')](config['root'],_0x0163('0x82'),_0x0163('0x83'),_0x0163('0x84'));return db[_0x0163('0x55')][_0x0163('0x59')]({'where':{'id':_0x2c5ca8['params']['id']},'include':[{'model':db['Attachment'],'as':_0x0163('0x85')}]})[_0x0163('0x3a')](handleEntityNotFound(_0x2a4540,null))[_0x0163('0x3a')](function(_0x1d78ad){if(_0x1d78ad){return _0x2a4540[_0x0163('0x80')](path[_0x0163('0x81')](_0x46e06b,_0x1d78ad[_0x0163('0x85')][_0x0163('0x7f')]));}})[_0x0163('0x2d')](handleError(_0x2a4540,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e3b76ca..7c54ce4 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x1b5ee0,_0x390506){var _0x3e4c55=function(_0x2adceb){while(--_0x2adceb){_0x1b5ee0['push'](_0x1b5ee0['shift']());}};_0x3e4c55(++_0x390506);}(_0x008c,0x188));var _0xc008=function(_0xc81f5f,_0x181205){_0xc81f5f=_0xc81f5f-0x0;var _0x4410dc=_0x008c[_0xc81f5f];return _0x4410dc;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x5c2d78,_0x2dc65f){_0x5c2d78=_0x5c2d78-0x0;var _0x50b883=_0x3e74[_0x5c2d78];return _0x50b883;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 35e8c99..b2427d3 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 _0xddca=['out','secret','isNil','UserId','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxMessage','fax_messages','fti_fax_messages','body','get','toLowerCase'];(function(_0x4b935f,_0x2a6cb5){var _0x2e4202=function(_0x3bf6f4){while(--_0x3bf6f4){_0x4b935f['push'](_0x4b935f['shift']());}};_0x2e4202(++_0x2a6cb5);}(_0xddca,0x1a0));var _0xaddc=function(_0x8f095e,_0x25bccb){_0x8f095e=_0x8f095e-0x0;var _0x29d39c=_0xddca[_0x8f095e];return _0x29d39c;};'use strict';var _=require(_0xaddc('0x0'));var util=require('util');var logger=require(_0xaddc('0x1'))(_0xaddc('0x2'));var moment=require(_0xaddc('0x3'));var BPromise=require(_0xaddc('0x4'));var rp=require(_0xaddc('0x5'));var fs=require('fs');var path=require(_0xaddc('0x6'));var rimraf=require(_0xaddc('0x7'));var config=require(_0xaddc('0x8'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0xa970d6,_0x5910dc){return _0xa970d6[_0xaddc('0x9')](_0xaddc('0xa'),attributes,{'tableName':_0xaddc('0xb'),'paranoid':![],'indexes':[{'name':_0xaddc('0xc'),'fields':[_0xaddc('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d69ab,_0xf3af45,_0x57a526){var _0x4e6a88=_0xa970d6['models'];var _0x4071ab=_0x3d69ab[_0xaddc('0xe')]({'plain':!![]});if(_0x4071ab['direction']['toLowerCase']()==='in'||_0x4071ab['direction'][_0xaddc('0xf')]()===_0xaddc('0x10')&&!_0x4071ab[_0xaddc('0x11')]&&!_[_0xaddc('0x12')](_0x4071ab[_0xaddc('0x13')])){_0x4e6a88['FaxInteraction'][_0xaddc('0x14')]({'where':{'id':_0x4071ab['FaxInteractionId']}})['then'](function(_0x2f35b4){if(_0x2f35b4){_0x2f35b4[_0xaddc('0x15')]({'lastMsgAt':_0x4071ab[_0xaddc('0x16')],'lastMsgDirection':_0x4071ab['direction'][_0xaddc('0xf')]()});}})[_0xaddc('0x17')](function(_0x538249){console[_0xaddc('0x18')](_0x538249);});}_0x57a526();}},'charset':_0xaddc('0x19'),'collate':_0xaddc('0x1a')});}; \ No newline at end of file +var _0x3e66=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','./faxMessage.attributes','exports','define','fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt'];(function(_0xa9ccb9,_0x18d0c7){var _0x4fde26=function(_0x39e3ed){while(--_0x39e3ed){_0xa9ccb9['push'](_0xa9ccb9['shift']());}};_0x4fde26(++_0x18d0c7);}(_0x3e66,0x112));var _0x63e6=function(_0x5eb6b7,_0xa7c1a1){_0x5eb6b7=_0x5eb6b7-0x0;var _0xa4ca93=_0x3e66[_0x5eb6b7];return _0xa4ca93;};'use strict';var _=require(_0x63e6('0x0'));var util=require(_0x63e6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x63e6('0x2'));var BPromise=require('bluebird');var rp=require(_0x63e6('0x3'));var fs=require('fs');var path=require(_0x63e6('0x4'));var rimraf=require(_0x63e6('0x5'));var config=require('../../config/environment');var attributes=require(_0x63e6('0x6'));module[_0x63e6('0x7')]=function(_0x345a8a,_0x50fa33){return _0x345a8a[_0x63e6('0x8')]('FaxMessage',attributes,{'tableName':_0x63e6('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x63e6('0xa')],'type':_0x63e6('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22984a,_0xe110ea,_0x5b84da){var _0x32fa87=_0x345a8a[_0x63e6('0xc')];var _0xc23ad1=_0x22984a['get']({'plain':!![]});if(_0xc23ad1[_0x63e6('0xd')][_0x63e6('0xe')]()==='in'||_0xc23ad1[_0x63e6('0xd')][_0x63e6('0xe')]()===_0x63e6('0xf')&&!_0xc23ad1[_0x63e6('0x10')]&&!_['isNil'](_0xc23ad1['UserId'])){_0x32fa87[_0x63e6('0x11')][_0x63e6('0x12')]({'where':{'id':_0xc23ad1[_0x63e6('0x13')]}})[_0x63e6('0x14')](function(_0x157bc7){if(_0x157bc7){_0x157bc7[_0x63e6('0x15')]({'lastMsgAt':_0xc23ad1[_0x63e6('0x16')],'lastMsgDirection':_0xc23ad1[_0x63e6('0xd')][_0x63e6('0xe')]()});}})[_0x63e6('0x17')](function(_0x590acf){console[_0x63e6('0x18')](_0x590acf);});}_0x5b84da();}},'charset':_0x63e6('0x19'),'collate':_0x63e6('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index f6e159a..2578644 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 _0xb95e=['options','raw','then','CreateFaxMessage','catch','update','where','UpdateFaxMessage','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxMessage','create','body'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xb95e,0x128));var _0xeb95=function(_0x224fbf,_0x6ecead){_0x224fbf=_0x224fbf-0x0;var _0x18a98f=_0xb95e[_0x224fbf];return _0x18a98f;};'use strict';var _=require(_0xeb95('0x0'));var util=require('util');var moment=require(_0xeb95('0x1'));var BPromise=require(_0xeb95('0x2'));var rs=require(_0xeb95('0x3'));var fs=require('fs');var Redis=require(_0xeb95('0x4'));var db=require(_0xeb95('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb95('0x6'))(_0xeb95('0x7'));var config=require(_0xeb95('0x8'));var jayson=require(_0xeb95('0x9'));var client=jayson['client'][_0xeb95('0xa')]({'port':0x232a});config[_0xeb95('0xb')]=_[_0xeb95('0xc')](config['redis'],{'host':_0xeb95('0xd'),'port':0x18eb});var socket=require(_0xeb95('0xe'))(new Redis(config[_0xeb95('0xb')]));require(_0xeb95('0xf'))[_0xeb95('0x10')](socket);function respondWithRpcPromise(_0x58b459,_0xf9e219,_0xc0a5c0){return new BPromise(function(_0x1fa1ca,_0x5178e3){return client['request'](_0x58b459,_0xc0a5c0)['then'](function(_0x3d2fb7){logger[_0xeb95('0x11')](_0xeb95('0x12'),_0xf9e219,_0xeb95('0x13'));logger[_0xeb95('0x14')](_0xeb95('0x15'),_0xf9e219,_0xeb95('0x13'),JSON[_0xeb95('0x16')](_0x3d2fb7));if(_0x3d2fb7[_0xeb95('0x17')]){if(_0x3d2fb7[_0xeb95('0x17')]['code']===0x1f4){logger['error'](_0xeb95('0x12'),_0xf9e219,_0x3d2fb7[_0xeb95('0x17')][_0xeb95('0x18')]);return _0x5178e3(_0x3d2fb7[_0xeb95('0x17')]['message']);}logger[_0xeb95('0x17')]('FaxMessage,\x20%s,\x20%s',_0xf9e219,_0x3d2fb7[_0xeb95('0x17')][_0xeb95('0x18')]);return _0x1fa1ca(_0x3d2fb7['error'][_0xeb95('0x18')]);}else{logger[_0xeb95('0x11')](_0xeb95('0x12'),_0xf9e219,_0xeb95('0x13'));_0x1fa1ca(_0x3d2fb7['result'][_0xeb95('0x18')]);}})['catch'](function(_0x395f5c){logger['error'](_0xeb95('0x12'),_0xf9e219,_0x395f5c);_0x5178e3(_0x395f5c);});});}exports['CreateFaxMessage']=function(_0x1a874c){var _0x3ae8e9=this;return new Promise(function(_0x449238,_0x21e0e6){return db[_0xeb95('0x19')][_0xeb95('0x1a')](_0x1a874c[_0xeb95('0x1b')],{'raw':_0x1a874c['options']?_0x1a874c[_0xeb95('0x1c')][_0xeb95('0x1d')]===undefined?!![]:![]:!![]})[_0xeb95('0x1e')](function(_0x41ee85){logger['info'](_0xeb95('0x1f'),_0x1a874c);logger[_0xeb95('0x14')](_0xeb95('0x1f'),_0x1a874c,JSON['stringify'](_0x41ee85));_0x449238(_0x41ee85);})[_0xeb95('0x20')](function(_0xa50a8d){logger[_0xeb95('0x17')](_0xeb95('0x1f'),_0xa50a8d[_0xeb95('0x18')],_0x1a874c);_0x21e0e6(_0x3ae8e9[_0xeb95('0x17')](0x1f4,_0xa50a8d[_0xeb95('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x2056d5){var _0x6f2caf=this;return new Promise(function(_0x11fafc,_0x2230b0){return db['FaxMessage'][_0xeb95('0x21')](_0x2056d5[_0xeb95('0x1b')],{'raw':_0x2056d5[_0xeb95('0x1c')]?_0x2056d5[_0xeb95('0x1c')][_0xeb95('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2056d5['options']?_0x2056d5[_0xeb95('0x1c')][_0xeb95('0x22')]||null:null,'attributes':_0x2056d5[_0xeb95('0x1c')]?_0x2056d5[_0xeb95('0x1c')]['attributes']||null:null,'limit':_0x2056d5[_0xeb95('0x1c')]?_0x2056d5[_0xeb95('0x1c')]['limit']||null:null})[_0xeb95('0x1e')](function(_0x4fa215){logger[_0xeb95('0x11')](_0xeb95('0x23'),_0x2056d5);logger['debug'](_0xeb95('0x23'),_0x2056d5,JSON['stringify'](_0x4fa215));_0x11fafc(_0x4fa215);})[_0xeb95('0x20')](function(_0x5cf992){logger[_0xeb95('0x17')](_0xeb95('0x23'),_0x5cf992[_0xeb95('0x18')],_0x2056d5);_0x2230b0(_0x6f2caf[_0xeb95('0x17')](0x1f4,_0x5cf992[_0xeb95('0x18')]));});});}; \ No newline at end of file +var _0x7b63=['then','stringify','UpdateFaxMessage','FaxMessage','where','attributes','limit','lodash','bluebird','randomstring','../../config/logger','rpc','jayson/promise','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxMessage','create','body','options','raw'];(function(_0x349863,_0x53437f){var _0x2a57cf=function(_0x28db6f){while(--_0x28db6f){_0x349863['push'](_0x349863['shift']());}};_0x2a57cf(++_0x53437f);}(_0x7b63,0xac));var _0x37b6=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0x7b63[_0x4b2cc6];return _0x3e0b08;};'use strict';var _=require(_0x37b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x37b6('0x1'));var rs=require(_0x37b6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x37b6('0x3'))(_0x37b6('0x4'));var config=require('../../config/environment');var jayson=require(_0x37b6('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x37b6('0x6')](config[_0x37b6('0x7')],{'host':_0x37b6('0x8'),'port':0x18eb});var socket=require(_0x37b6('0x9'))(new Redis(config[_0x37b6('0x7')]));require(_0x37b6('0xa'))['register'](socket);function respondWithRpcPromise(_0x3383d8,_0x559194,_0x304efd){return new BPromise(function(_0x25e6b8,_0x20b368){return client['request'](_0x3383d8,_0x304efd)['then'](function(_0x1b3c75){logger[_0x37b6('0xb')](_0x37b6('0xc'),_0x559194,_0x37b6('0xd'));logger[_0x37b6('0xe')](_0x37b6('0xf'),_0x559194,_0x37b6('0xd'),JSON['stringify'](_0x1b3c75));if(_0x1b3c75[_0x37b6('0x10')]){if(_0x1b3c75[_0x37b6('0x10')][_0x37b6('0x11')]===0x1f4){logger['error'](_0x37b6('0xc'),_0x559194,_0x1b3c75['error'][_0x37b6('0x12')]);return _0x20b368(_0x1b3c75[_0x37b6('0x10')][_0x37b6('0x12')]);}logger[_0x37b6('0x10')](_0x37b6('0xc'),_0x559194,_0x1b3c75[_0x37b6('0x10')][_0x37b6('0x12')]);return _0x25e6b8(_0x1b3c75[_0x37b6('0x10')][_0x37b6('0x12')]);}else{logger[_0x37b6('0xb')]('FaxMessage,\x20%s,\x20%s',_0x559194,'request\x20sent');_0x25e6b8(_0x1b3c75[_0x37b6('0x13')][_0x37b6('0x12')]);}})[_0x37b6('0x14')](function(_0x4ba1b0){logger[_0x37b6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x559194,_0x4ba1b0);_0x20b368(_0x4ba1b0);});});}exports[_0x37b6('0x15')]=function(_0x1d6cc5){var _0xa2688d=this;return new Promise(function(_0x2a87c8,_0x14732f){return db['FaxMessage'][_0x37b6('0x16')](_0x1d6cc5[_0x37b6('0x17')],{'raw':_0x1d6cc5['options']?_0x1d6cc5[_0x37b6('0x18')][_0x37b6('0x19')]===undefined?!![]:![]:!![]})[_0x37b6('0x1a')](function(_0x303496){logger[_0x37b6('0xb')](_0x37b6('0x15'),_0x1d6cc5);logger['debug']('CreateFaxMessage',_0x1d6cc5,JSON[_0x37b6('0x1b')](_0x303496));_0x2a87c8(_0x303496);})[_0x37b6('0x14')](function(_0x1d7ac0){logger['error'](_0x37b6('0x15'),_0x1d7ac0[_0x37b6('0x12')],_0x1d6cc5);_0x14732f(_0xa2688d[_0x37b6('0x10')](0x1f4,_0x1d7ac0[_0x37b6('0x12')]));});});};exports[_0x37b6('0x1c')]=function(_0x35f935){var _0x50f051=this;return new Promise(function(_0x924a9c,_0x31e143){return db[_0x37b6('0x1d')]['update'](_0x35f935['body'],{'raw':_0x35f935[_0x37b6('0x18')]?_0x35f935[_0x37b6('0x18')][_0x37b6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35f935[_0x37b6('0x18')]?_0x35f935[_0x37b6('0x18')][_0x37b6('0x1e')]||null:null,'attributes':_0x35f935[_0x37b6('0x18')]?_0x35f935[_0x37b6('0x18')][_0x37b6('0x1f')]||null:null,'limit':_0x35f935['options']?_0x35f935['options'][_0x37b6('0x20')]||null:null})['then'](function(_0xaf81b8){logger[_0x37b6('0xb')](_0x37b6('0x1c'),_0x35f935);logger[_0x37b6('0xe')]('UpdateFaxMessage',_0x35f935,JSON[_0x37b6('0x1b')](_0xaf81b8));_0x924a9c(_0xaf81b8);})[_0x37b6('0x14')](function(_0xab63ee){logger['error'](_0x37b6('0x1c'),_0xab63ee[_0x37b6('0x12')],_0x35f935);_0x31e143(_0x50f051['error'](0x1f4,_0xab63ee[_0x37b6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index d89a029..b08b08d 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index e77c22d..359256b 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 _0x7c5e=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','tracked','fax','faxmessage:create','put','/:id/accept','accept','/:id/reject','exports','multer'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x7c5e,0x11d));var _0xe7c5=function(_0x4779d6,_0x51a72b){_0x4779d6=_0x4779d6-0x0;var _0x10139f=_0x7c5e[_0x4779d6];return _0x10139f;};'use strict';var multer=require(_0xe7c5('0x0'));var util=require(_0xe7c5('0x1'));var path=require(_0xe7c5('0x2'));var timeout=require(_0xe7c5('0x3'));var express=require(_0xe7c5('0x4'));var router=express[_0xe7c5('0x5')]();var auth=require(_0xe7c5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe7c5('0x7'));var controller=require(_0xe7c5('0x8'));router[_0xe7c5('0x9')]('/',auth[_0xe7c5('0xa')](),controller[_0xe7c5('0xb')]);router[_0xe7c5('0x9')](_0xe7c5('0xc'),auth[_0xe7c5('0xa')](),controller[_0xe7c5('0xd')]);router[_0xe7c5('0x9')](_0xe7c5('0xe'),auth[_0xe7c5('0xa')](),controller[_0xe7c5('0xf')]);router[_0xe7c5('0x9')](_0xe7c5('0x10'),auth['isAuthenticated'](),controller[_0xe7c5('0x11')]);router['post']('/',auth[_0xe7c5('0xa')](),interaction[_0xe7c5('0x12')](_0xe7c5('0x13'),_0xe7c5('0x14')),controller['create']);router[_0xe7c5('0x15')](_0xe7c5('0xe'),auth[_0xe7c5('0xa')](),controller['update']);router['put'](_0xe7c5('0x16'),auth['isAuthenticated'](),controller[_0xe7c5('0x17')]);router[_0xe7c5('0x15')](_0xe7c5('0x18'),auth[_0xe7c5('0xa')](),controller['reject']);router['delete'](_0xe7c5('0xe'),auth[_0xe7c5('0xa')](),controller['destroy']);module[_0xe7c5('0x19')]=router; \ No newline at end of file +var _0x6dcb=['/:id/reject','reject','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','update','/:id/accept','accept','put'];(function(_0x52598d,_0x10fb73){var _0x170309=function(_0x30c9f7){while(--_0x30c9f7){_0x52598d['push'](_0x52598d['shift']());}};_0x170309(++_0x10fb73);}(_0x6dcb,0x170));var _0xb6dc=function(_0x237fe4,_0x57eecf){_0x237fe4=_0x237fe4-0x0;var _0x35cc3e=_0x6dcb[_0x237fe4];return _0x35cc3e;};'use strict';var multer=require(_0xb6dc('0x0'));var util=require(_0xb6dc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb6dc('0x2')]();var auth=require(_0xb6dc('0x3'));var interaction=require(_0xb6dc('0x4'));var config=require(_0xb6dc('0x5'));var controller=require(_0xb6dc('0x6'));router[_0xb6dc('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb6dc('0x7')](_0xb6dc('0x8'),auth['isAuthenticated'](),controller[_0xb6dc('0x9')]);router[_0xb6dc('0x7')](_0xb6dc('0xa'),auth[_0xb6dc('0xb')](),controller[_0xb6dc('0xc')]);router[_0xb6dc('0x7')](_0xb6dc('0xd'),auth[_0xb6dc('0xb')](),controller[_0xb6dc('0xe')]);router[_0xb6dc('0xf')]('/',auth['isAuthenticated'](),interaction[_0xb6dc('0x10')](_0xb6dc('0x11'),_0xb6dc('0x12')),controller[_0xb6dc('0x13')]);router['put'](_0xb6dc('0xa'),auth['isAuthenticated'](),controller[_0xb6dc('0x14')]);router['put'](_0xb6dc('0x15'),auth[_0xb6dc('0xb')](),controller[_0xb6dc('0x16')]);router[_0xb6dc('0x17')](_0xb6dc('0x18'),auth[_0xb6dc('0xb')](),controller[_0xb6dc('0x19')]);router[_0xb6dc('0x1a')](_0xb6dc('0xa'),auth[_0xb6dc('0xb')](),controller['destroy']);module[_0xb6dc('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index c537828..7e4e773 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 _0x1032=['exports','name','STRING','INTEGER','ENUM','rrmemory','sequelize'];(function(_0x39d73a,_0x2f8047){var _0x1ad707=function(_0x8a7fd){while(--_0x8a7fd){_0x39d73a['push'](_0x39d73a['shift']());}};_0x1ad707(++_0x2f8047);}(_0x1032,0x1cd));var _0x2103=function(_0x53ed48,_0xf76bb7){_0x53ed48=_0x53ed48-0x0;var _0x6129d0=_0x1032[_0x53ed48];return _0x6129d0;};'use strict';var Sequelize=require(_0x2103('0x0'));module[_0x2103('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2103('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2103('0x3')]},'timeout':{'type':Sequelize[_0x2103('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2103('0x5')](_0x2103('0x6'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2103('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7a28=['rrmemory','beepall','roundrobin','exports','name','INTEGER','ENUM'];(function(_0x5e1acf,_0x5463b1){var _0x389639=function(_0x173905){while(--_0x173905){_0x5e1acf['push'](_0x5e1acf['shift']());}};_0x389639(++_0x5463b1);}(_0x7a28,0x176));var _0x87a2=function(_0x31a8bf,_0x4b09a4){_0x31a8bf=_0x31a8bf-0x0;var _0x26a9a0=_0x7a28[_0x31a8bf];return _0x26a9a0;};'use strict';var Sequelize=require('sequelize');module[_0x87a2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x87a2('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x87a2('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x87a2('0x3')](_0x87a2('0x4'),_0x87a2('0x5'),_0x87a2('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x87a2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 498f236..eb1044c 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 _0x3dcc=['socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','then','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','FaxQueues','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','FaxQueueId','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','User','Agents','online','voicePause','flatMap','sequelize','each','UserFaxQueue','findOrCreate','forEach','emit','removeTeams','select','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','every','TeamId','union','compact','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','ids','spread','userFaxQueue:save','isArray','getAgents','html-pdf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3dcc,0xf5));var _0xc3dc=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0x3dcc[_0x476b00];return _0x44ec8e;};'use strict';var pdf=require(_0xc3dc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc3dc('0x1'));var moment=require(_0xc3dc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc3dc('0x3'));var util=require(_0xc3dc('0x4'));var path=require(_0xc3dc('0x5'));var sox=require('sox');var csv=require(_0xc3dc('0x6'));var ejs=require(_0xc3dc('0x7'));var fs=require('fs');var _=require(_0xc3dc('0x8'));var squel=require(_0xc3dc('0x9'));var crypto=require(_0xc3dc('0xa'));var jsforce=require(_0xc3dc('0xb'));var deskjs=require(_0xc3dc('0xc'));var toCsv=require(_0xc3dc('0x6'));var querystring=require(_0xc3dc('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc3dc('0xe'));var qs=require(_0xc3dc('0xf'));var as=require(_0xc3dc('0x10'));var hardwareService=require(_0xc3dc('0x11'));var logger=require(_0xc3dc('0x12'))(_0xc3dc('0x13'));var utils=require('../../config/utils');var config=require(_0xc3dc('0x14'));var db=require(_0xc3dc('0x15'))['db'];config[_0xc3dc('0x16')]=_[_0xc3dc('0x17')](config['redis'],{'host':_0xc3dc('0x18'),'port':0x18eb});var socket=require(_0xc3dc('0x19'))(new Redis(config[_0xc3dc('0x16')]));require(_0xc3dc('0x1a'))[_0xc3dc('0x1b')](socket);function respondWithStatusCode(_0x4f9126,_0x3b421e){_0x3b421e=_0x3b421e||0xcc;return function(_0x52aa3a){if(_0x52aa3a){return _0x4f9126[_0xc3dc('0x1c')](_0x3b421e);}return _0x4f9126[_0xc3dc('0x1d')](_0x3b421e)[_0xc3dc('0x1e')]();};}function respondWithResult(_0x28acd8,_0x3b8964){_0x3b8964=_0x3b8964||0xc8;return function(_0x336993){if(_0x336993){return _0x28acd8[_0xc3dc('0x1d')](_0x3b8964)[_0xc3dc('0x1f')](_0x336993);}};}function respondWithFilteredResult(_0x57edc6,_0xc46e77){return function(_0x3a23a2){if(_0x3a23a2){var _0x367bea=_0x3a23a2[_0xc3dc('0x20')],_0x52290c=_0xc46e77['offset'],_0x5cabbf=_0xc46e77[_0xc3dc('0x21')]+_0xc46e77[_0xc3dc('0x22')],_0x12832a;if(_0x5cabbf>=_0x367bea){_0x5cabbf=_0x367bea;_0x12832a=0xc8;}else{_0x12832a=0xce;}_0x57edc6[_0xc3dc('0x1d')](_0x12832a);return _0x57edc6[_0xc3dc('0x23')](_0xc3dc('0x24'),_0x52290c+'-'+_0x5cabbf+'/'+_0x367bea)[_0xc3dc('0x1f')](_0x3a23a2);}return null;};}function patchUpdates(_0x3822f8){return function(_0x2cffe5){try{jsonpatch[_0xc3dc('0x25')](_0x2cffe5,_0x3822f8,!![]);}catch(_0x45878c){return BPromise['reject'](_0x45878c);}return _0x2cffe5[_0xc3dc('0x26')]();};}function saveUpdates(_0x2c4cce,_0xbb7299){return function(_0x1ef2ab){if(_0x1ef2ab){return _0x1ef2ab['update'](_0x2c4cce)['then'](function(_0x516f77){return _0x516f77;});}return null;};}function removeEntity(_0x2efbe5,_0xd22f4){return function(_0x27848f){if(_0x27848f){return _0x27848f[_0xc3dc('0x27')]()[_0xc3dc('0x28')](function(){var _0x511169=_0x27848f['get']({'plain':!![]});var _0x459280='FaxQueues';return db['UserProfileResource'][_0xc3dc('0x27')]({'where':{'type':_0x459280,'resourceId':_0x511169['id']}})['then'](function(){return _0x27848f;});})[_0xc3dc('0x28')](function(){_0x2efbe5[_0xc3dc('0x1d')](0xcc)[_0xc3dc('0x1e')]();});}};}function handleEntityNotFound(_0x32d04e,_0x53312d){return function(_0x16c862){if(!_0x16c862){_0x32d04e[_0xc3dc('0x1c')](0x194);}return _0x16c862;};}function handleError(_0x3ccc05,_0x219393){_0x219393=_0x219393||0x1f4;return function(_0x5f1ddb){logger[_0xc3dc('0x29')](_0x5f1ddb['stack']);if(_0x5f1ddb[_0xc3dc('0x2a')]){delete _0x5f1ddb[_0xc3dc('0x2a')];}_0x3ccc05[_0xc3dc('0x1d')](_0x219393)[_0xc3dc('0x2b')](_0x5f1ddb);};}exports[_0xc3dc('0x2c')]=function(_0x2e5fc9,_0x1b01c1){var _0x1c7f37={},_0x35490f={},_0x18c4d4={'count':0x0,'rows':[]};var _0x439aef=_[_0xc3dc('0x2d')](db[_0xc3dc('0x2e')][_0xc3dc('0x2f')],function(_0x2b8953){return{'name':_0x2b8953[_0xc3dc('0x30')],'type':_0x2b8953['type'][_0xc3dc('0x31')]};});_0x35490f[_0xc3dc('0x32')]=_[_0xc3dc('0x2d')](_0x439aef,_0xc3dc('0x2a'));_0x35490f['query']=_[_0xc3dc('0x33')](_0x2e5fc9[_0xc3dc('0x34')]);_0x35490f[_0xc3dc('0x35')]=_['intersection'](_0x35490f[_0xc3dc('0x32')],_0x35490f['query']);_0x1c7f37['attributes']=_[_0xc3dc('0x36')](_0x35490f[_0xc3dc('0x32')],qs[_0xc3dc('0x37')](_0x2e5fc9[_0xc3dc('0x34')][_0xc3dc('0x37')]));_0x1c7f37[_0xc3dc('0x38')]=_0x1c7f37[_0xc3dc('0x38')][_0xc3dc('0x39')]?_0x1c7f37[_0xc3dc('0x38')]:_0x35490f[_0xc3dc('0x32')];if(!_0x2e5fc9[_0xc3dc('0x34')][_0xc3dc('0x3a')](_0xc3dc('0x3b'))){_0x1c7f37[_0xc3dc('0x22')]=qs['limit'](_0x2e5fc9[_0xc3dc('0x34')]['limit']);_0x1c7f37['offset']=qs[_0xc3dc('0x21')](_0x2e5fc9[_0xc3dc('0x34')][_0xc3dc('0x21')]);}_0x1c7f37[_0xc3dc('0x3c')]=qs[_0xc3dc('0x3d')](_0x2e5fc9[_0xc3dc('0x34')]['sort']);_0x1c7f37['where']=qs['filters'](_[_0xc3dc('0x3e')](_0x2e5fc9['query'],_0x35490f[_0xc3dc('0x35')]),_0x439aef);if(_0x2e5fc9['query']['filter']){_0x1c7f37[_0xc3dc('0x3f')]=_['merge'](_0x1c7f37['where'],{'$or':_['map'](_0x439aef,function(_0x1759a1){if(_0x1759a1[_0xc3dc('0x40')]!==_0xc3dc('0x41')){var _0x8f24bb={};_0x8f24bb[_0x1759a1[_0xc3dc('0x2a')]]={'$like':'%'+_0x2e5fc9['query'][_0xc3dc('0x42')]+'%'};return _0x8f24bb;}})});}_0x1c7f37=_[_0xc3dc('0x43')]({},_0x1c7f37,_0x2e5fc9[_0xc3dc('0x44')]);var _0x1b60ad={'where':_0x1c7f37[_0xc3dc('0x3f')]};return db[_0xc3dc('0x2e')]['count'](_0x1b60ad)[_0xc3dc('0x28')](function(_0x14e49a){_0x18c4d4[_0xc3dc('0x20')]=_0x14e49a;if(_0x2e5fc9['query'][_0xc3dc('0x45')]){_0x1c7f37['include']=[{'all':!![]}];}return db[_0xc3dc('0x2e')][_0xc3dc('0x46')](_0x1c7f37);})[_0xc3dc('0x28')](function(_0xd73d04){_0x18c4d4[_0xc3dc('0x47')]=_0xd73d04;return _0x18c4d4;})['then'](respondWithFilteredResult(_0x1b01c1,_0x1c7f37))['catch'](handleError(_0x1b01c1,null));};exports[_0xc3dc('0x48')]=function(_0xf3bd33,_0x29195e){var _0x28b774={'raw':!![],'where':{'id':_0xf3bd33[_0xc3dc('0x49')]['id']}},_0x4b39eb={};_0x4b39eb['model']=_['keys'](db[_0xc3dc('0x2e')][_0xc3dc('0x2f')]);_0x4b39eb[_0xc3dc('0x34')]=_[_0xc3dc('0x33')](_0xf3bd33[_0xc3dc('0x34')]);_0x4b39eb['filters']=_[_0xc3dc('0x36')](_0x4b39eb[_0xc3dc('0x32')],_0x4b39eb[_0xc3dc('0x34')]);_0x28b774[_0xc3dc('0x38')]=_['intersection'](_0x4b39eb[_0xc3dc('0x32')],qs[_0xc3dc('0x37')](_0xf3bd33[_0xc3dc('0x34')][_0xc3dc('0x37')]));_0x28b774[_0xc3dc('0x38')]=_0x28b774[_0xc3dc('0x38')][_0xc3dc('0x39')]?_0x28b774[_0xc3dc('0x38')]:_0x4b39eb[_0xc3dc('0x32')];if(_0xf3bd33[_0xc3dc('0x34')]['includeAll']){_0x28b774['include']=[{'all':!![]}];}_0x28b774=_[_0xc3dc('0x43')]({},_0x28b774,_0xf3bd33[_0xc3dc('0x44')]);return db[_0xc3dc('0x2e')]['find'](_0x28b774)[_0xc3dc('0x28')](handleEntityNotFound(_0x29195e,null))[_0xc3dc('0x28')](respondWithResult(_0x29195e,null))[_0xc3dc('0x4a')](handleError(_0x29195e,null));};exports[_0xc3dc('0x4b')]=function(_0x177754,_0x3b6836){return db['FaxQueue'][_0xc3dc('0x4b')](_0x177754['body'],{})['then'](function(_0x21a2f5){var _0x3dc563=_0x177754['user'][_0xc3dc('0x4c')]({'plain':!![]});if(!_0x3dc563)throw new Error(_0xc3dc('0x4d'));if(_0x3dc563['role']===_0xc3dc('0x4e')){var _0x34696d=_0x21a2f5[_0xc3dc('0x4c')]({'plain':!![]});var _0x49047e=_0xc3dc('0x4f');return db[_0xc3dc('0x50')][_0xc3dc('0x51')]({'where':{'name':_0x49047e,'userProfileId':_0x3dc563['userProfileId']},'raw':!![]})[_0xc3dc('0x28')](function(_0x3fd7cd){if(_0x3fd7cd&&_0x3fd7cd[_0xc3dc('0x52')]===0x0){return db[_0xc3dc('0x53')][_0xc3dc('0x4b')]({'name':_0x34696d[_0xc3dc('0x2a')],'resourceId':_0x34696d['id'],'type':_0x3fd7cd[_0xc3dc('0x2a')],'sectionId':_0x3fd7cd['id']},{})[_0xc3dc('0x28')](function(){return _0x21a2f5;});}else{return _0x21a2f5;}})[_0xc3dc('0x4a')](function(_0x323780){logger[_0xc3dc('0x29')](_0xc3dc('0x54'),_0x323780);throw _0x323780;});}return _0x21a2f5;})[_0xc3dc('0x28')](respondWithResult(_0x3b6836,0xc9))[_0xc3dc('0x4a')](handleError(_0x3b6836,null));};exports[_0xc3dc('0x55')]=function(_0x1c796a,_0x1b5582){if(_0x1c796a[_0xc3dc('0x56')]['id']){delete _0x1c796a[_0xc3dc('0x56')]['id'];}return db[_0xc3dc('0x2e')]['find']({'where':{'id':_0x1c796a[_0xc3dc('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b5582,null))[_0xc3dc('0x28')](saveUpdates(_0x1c796a['body'],null))[_0xc3dc('0x28')](respondWithResult(_0x1b5582,null))[_0xc3dc('0x4a')](handleError(_0x1b5582,null));};exports[_0xc3dc('0x27')]=function(_0x5665bd,_0x1a19b3){return db[_0xc3dc('0x2e')][_0xc3dc('0x51')]({'where':{'id':_0x5665bd[_0xc3dc('0x49')]['id']}})[_0xc3dc('0x28')](handleEntityNotFound(_0x1a19b3,null))[_0xc3dc('0x28')](removeEntity(_0x1a19b3,null))[_0xc3dc('0x4a')](handleError(_0x1a19b3,null));};exports[_0xc3dc('0x57')]=function(_0x21960a,_0x30d5c9){return db['FaxQueue']['describe']()[_0xc3dc('0x28')](respondWithResult(_0x30d5c9,null))['catch'](handleError(_0x30d5c9,null));};exports['getMembers']=function(_0x5e165e,_0x26ca38,_0xe28781){var _0x2583df={'raw':!![],'where':{}},_0xf433b7={},_0x3ecc85;return db[_0xc3dc('0x2e')]['findOne']({'where':{'id':_0x5e165e[_0xc3dc('0x49')]['id']}})[_0xc3dc('0x28')](handleEntityNotFound(_0x26ca38,null))['then'](function(_0x5c486f){if(_0x5c486f){_0x3ecc85=_0x5c486f[_0xc3dc('0x4c')]({'plain':!![]});_0xf433b7[_0xc3dc('0x32')]=_[_0xc3dc('0x33')](db['UserFaxQueue'][_0xc3dc('0x2f')]);_0xf433b7[_0xc3dc('0x34')]=_[_0xc3dc('0x33')](_0x5e165e[_0xc3dc('0x34')]);_0xf433b7['filters']=_[_0xc3dc('0x36')](_0xf433b7[_0xc3dc('0x32')],_0xf433b7[_0xc3dc('0x34')]);_0x2583df['attributes']=_[_0xc3dc('0x36')](_0xf433b7[_0xc3dc('0x32')],qs['fields'](_0x5e165e[_0xc3dc('0x34')][_0xc3dc('0x37')]));_0x2583df[_0xc3dc('0x38')]=_0x2583df['attributes'][_0xc3dc('0x39')]?_0x2583df[_0xc3dc('0x38')]:_0xf433b7[_0xc3dc('0x32')];if(!_0x5e165e[_0xc3dc('0x34')][_0xc3dc('0x3a')](_0xc3dc('0x3b'))){_0x2583df[_0xc3dc('0x22')]=qs[_0xc3dc('0x22')](_0x5e165e[_0xc3dc('0x34')][_0xc3dc('0x22')]);_0x2583df[_0xc3dc('0x21')]=qs[_0xc3dc('0x21')](_0x5e165e[_0xc3dc('0x34')][_0xc3dc('0x21')]);}_0x2583df[_0xc3dc('0x3c')]=qs[_0xc3dc('0x3d')](_0x5e165e[_0xc3dc('0x34')][_0xc3dc('0x3d')]);_0x2583df[_0xc3dc('0x3f')]=qs[_0xc3dc('0x35')](_[_0xc3dc('0x3e')](_0x5e165e['query'],_0xf433b7[_0xc3dc('0x35')]));_0x2583df[_0xc3dc('0x3f')][_0xc3dc('0x58')]=_0x5c486f['id'];if(_0x5e165e[_0xc3dc('0x34')]['filter']){_0x2583df[_0xc3dc('0x3f')]=_[_0xc3dc('0x43')](_0x2583df['where'],{'$or':_[_0xc3dc('0x2d')](_0x2583df['attributes'],function(_0x895c44){var _0x5c9017={};_0x5c9017[_0x895c44]={'$like':'%'+_0x5e165e[_0xc3dc('0x34')][_0xc3dc('0x42')]+'%'};return _0x5c9017;})});}_0x2583df=_[_0xc3dc('0x43')]({},_0x2583df,_0x5e165e[_0xc3dc('0x44')]);return db['UserFaxQueue'][_0xc3dc('0x46')](_0x2583df);}})[_0xc3dc('0x28')](function(_0x477150){if(_0x477150){return db['User']['findAndCountAll']({'where':{'id':_[_0xc3dc('0x2d')](_0x477150,_0xc3dc('0x59')),'role':_0xc3dc('0x5a')},'attributes':['id','name',_0xc3dc('0x5b'),_0xc3dc('0x5c'),_0xc3dc('0x5d')]});}})[_0xc3dc('0x28')](function(_0xc16f5d){if(_0xc16f5d){return{'count':_0xc16f5d['count'],'rows':_[_0xc3dc('0x2d')](_0xc16f5d[_0xc3dc('0x47')],function(_0x1c6571){return{'membername':_0x1c6571[_0xc3dc('0x2a')],'UserId':_0x1c6571['id'],'queue_name':_0x3ecc85['name'],'FaxQueueId':_0x3ecc85['id'],'interface':util[_0xc3dc('0x5e')]('%s/%s',_0xc3dc('0x5f'),_0x1c6571[_0xc3dc('0x2a')]),'penalty':0x0,'paused':_0x1c6571[_0xc3dc('0x5b')],'createdAt':_0x1c6571[_0xc3dc('0x5d')],'updatedAt':_0x1c6571[_0xc3dc('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x26ca38,_0x2583df))[_0xc3dc('0x4a')](handleError(_0x26ca38,null));};exports[_0xc3dc('0x60')]=function(_0xff9900,_0x4f9998,_0x1810fc){var _0x19d2a7={};var _0x464764={};var _0x35afd6;var _0x464060;return db['FaxQueue'][_0xc3dc('0x61')]({'where':{'id':_0xff9900[_0xc3dc('0x49')]['id']}})[_0xc3dc('0x28')](handleEntityNotFound(_0x4f9998,null))['then'](function(_0xdd0705){if(_0xdd0705){_0x35afd6=_0xdd0705;_0x464764[_0xc3dc('0x32')]=_[_0xc3dc('0x33')](db[_0xc3dc('0x62')]['rawAttributes']);_0x464764[_0xc3dc('0x34')]=_[_0xc3dc('0x33')](_0xff9900[_0xc3dc('0x34')]);_0x464764[_0xc3dc('0x35')]=_['intersection'](_0x464764[_0xc3dc('0x32')],_0x464764[_0xc3dc('0x34')]);_0x19d2a7[_0xc3dc('0x38')]=_[_0xc3dc('0x36')](_0x464764['model'],qs[_0xc3dc('0x37')](_0xff9900[_0xc3dc('0x34')][_0xc3dc('0x37')]));_0x19d2a7[_0xc3dc('0x38')]=_0x19d2a7[_0xc3dc('0x38')][_0xc3dc('0x39')]?_0x19d2a7[_0xc3dc('0x38')]:_0x464764['model'];_0x19d2a7[_0xc3dc('0x3c')]=qs[_0xc3dc('0x3d')](_0xff9900[_0xc3dc('0x34')][_0xc3dc('0x3d')]);_0x19d2a7[_0xc3dc('0x3f')]=qs[_0xc3dc('0x35')](_[_0xc3dc('0x3e')](_0xff9900[_0xc3dc('0x34')],_0x464764['filters']));if(_0xff9900[_0xc3dc('0x34')][_0xc3dc('0x42')]){_0x19d2a7[_0xc3dc('0x3f')]=_[_0xc3dc('0x43')](_0x19d2a7[_0xc3dc('0x3f')],{'$or':_[_0xc3dc('0x2d')](_0x19d2a7['attributes'],function(_0x2c9774){var _0x1856f0={};_0x1856f0[_0x2c9774]={'$like':'%'+_0xff9900[_0xc3dc('0x34')][_0xc3dc('0x42')]+'%'};return _0x1856f0;})});}_0x19d2a7=_[_0xc3dc('0x43')]({},_0x19d2a7,_0xff9900['options']);return _0x35afd6[_0xc3dc('0x60')](_0x19d2a7);}})['then'](function(_0x1e1ff6){if(_0x1e1ff6){_0x464060=_0x1e1ff6[_0xc3dc('0x39')];if(!_0xff9900[_0xc3dc('0x34')][_0xc3dc('0x3a')](_0xc3dc('0x3b'))){_0x19d2a7['limit']=qs[_0xc3dc('0x22')](_0xff9900[_0xc3dc('0x34')][_0xc3dc('0x22')]);_0x19d2a7['offset']=qs[_0xc3dc('0x21')](_0xff9900['query'][_0xc3dc('0x21')]);}return _0x35afd6[_0xc3dc('0x60')](_0x19d2a7);}})[_0xc3dc('0x28')](function(_0x3c8931){if(_0x3c8931){return _0x3c8931?{'count':_0x464060,'rows':_0x3c8931}:null;}})['then'](respondWithResult(_0x4f9998,null))['catch'](handleError(_0x4f9998,null));};exports[_0xc3dc('0x63')]=function(_0x5303a2,_0x1842be,_0x40eb3f){var _0x32ad9e=_0x5303a2[_0xc3dc('0x56')]['ids'];return db[_0xc3dc('0x62')][_0xc3dc('0x46')]({'where':{'id':_0x32ad9e},'attributes':['id'],'include':[{'model':db[_0xc3dc('0x64')],'as':_0xc3dc('0x65'),'attributes':['id',_0xc3dc('0x2a'),_0xc3dc('0x66'),_0xc3dc('0x67'),'interface'],'raw':!![]}]})[_0xc3dc('0x28')](function(_0x2a8a47){if(_0x2a8a47){var _0x52f8d3=_[_0xc3dc('0x68')](_0x2a8a47,function(_0xac2d19){var _0x4510d1=_0xac2d19[_0xc3dc('0x4c')]({'plain':!![]});return _0x4510d1['Agents'];});return db[_0xc3dc('0x2e')]['find']({'where':{'id':_0x5303a2['params']['id']}})[_0xc3dc('0x28')](function(_0x88d5aa){return db[_0xc3dc('0x69')]['transaction'](function(_0x4586ef){return _0x88d5aa[_0xc3dc('0x63')](_0x32ad9e,{'transaction':_0x4586ef})[_0xc3dc('0x28')](function(){return BPromise[_0xc3dc('0x6a')](_0x52f8d3,function(_0x3f44dd){return db[_0xc3dc('0x6b')][_0xc3dc('0x6c')]({'where':{'UserId':_0x3f44dd['id'],'FaxQueueId':_0x5303a2['params']['id']},'transaction':_0x4586ef});});})[_0xc3dc('0x28')](function(){_0x52f8d3[_0xc3dc('0x6d')](function(_0x3f3a63){socket[_0xc3dc('0x6e')]('userFaxQueue:save',{'UserId':_0x3f3a63['id'],'FaxQueueId':_0x88d5aa['id']});});});});});}})[_0xc3dc('0x28')](respondWithStatusCode(_0x1842be,null))['catch'](handleError(_0x1842be,null));};exports[_0xc3dc('0x6f')]=function(_0x3b48a5,_0x4929fc,_0x3766d8){return db[_0xc3dc('0x62')][_0xc3dc('0x46')]({'where':{'id':_0x3b48a5[_0xc3dc('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc3dc('0x64')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc3dc('0x28')](handleEntityNotFound(_0x4929fc,null))['then'](function(_0x18bf78){var _0x56d052=_['map'](_0x18bf78,'id');var _0x519869=[];var _0x40cc4b=[];var _0x1eb231=squel[_0xc3dc('0x70')]();_0x1eb231['field']('tq.TeamId')['from']('team_has_fax_queues','tq')[_0xc3dc('0x71')](_0xc3dc('0x72'),'ut',_0xc3dc('0x73'))[_0xc3dc('0x3f')]('FaxQueueId\x20=\x20?',_0x3b48a5[_0xc3dc('0x49')]['id']);for(var _0x573b6b=0x0;_0x573b6b<_0x18bf78[_0xc3dc('0x39')];_0x573b6b+=0x1){let _0x4fe547=_0x18bf78[_0x573b6b];for(var _0x5c19d0=0x0;_0x5c19d0<_0x4fe547['Agents'][_0xc3dc('0x39')];_0x5c19d0+=0x1){let _0xcac977=_0x4fe547[_0xc3dc('0x65')][_0x5c19d0];var _0x5d1db4=_0x1eb231[_0xc3dc('0x74')]();_0x5d1db4[_0xc3dc('0x3f')]('ut.UserId\x20=\x20?',_0xcac977['id']);_0x40cc4b['push'](db[_0xc3dc('0x69')][_0xc3dc('0x34')](_0x5d1db4[_0xc3dc('0x75')](),{'type':db[_0xc3dc('0x69')][_0xc3dc('0x76')][_0xc3dc('0x77')]})[_0xc3dc('0x28')](function(_0x351907){if(_0x351907[_0xc3dc('0x39')]===0x1){return _0xcac977['id'];}else{var _0x2fbd0c=_[_0xc3dc('0x78')](_[_0xc3dc('0x2d')](_0x351907,_0xc3dc('0x79')),function(_0x1a701a){return _['includes'](_0x56d052,_0x1a701a);});if(_0x2fbd0c){return _0xcac977['id'];}}}));}}return BPromise['all'](_0x40cc4b)['then'](function(_0x39619){_0x519869=_(_0x519869)[_0xc3dc('0x7a')](_0x39619)[_0xc3dc('0x7b')]()['value']();return db[_0xc3dc('0x2e')][_0xc3dc('0x51')]({'where':{'id':_0x3b48a5[_0xc3dc('0x49')]['id']}})[_0xc3dc('0x28')](function(_0x1e5539){return db[_0xc3dc('0x69')][_0xc3dc('0x7c')](function(_0x305cc5){return _0x1e5539[_0xc3dc('0x6f')](_0x3b48a5['query']['ids'],{'transaction':_0x305cc5})[_0xc3dc('0x28')](function(){if(!_[_0xc3dc('0x7d')](_0x519869)){return _0x1e5539[_0xc3dc('0x7e')](_0x519869,{'transaction':_0x305cc5});}})[_0xc3dc('0x28')](function(){_0x519869['forEach'](function(_0x26cbe4){socket[_0xc3dc('0x6e')](_0xc3dc('0x7f'),{'UserId':_0x26cbe4,'FaxQueueId':_0x1e5539['id']});});});});});});})[_0xc3dc('0x28')](respondWithStatusCode(_0x4929fc,null))[_0xc3dc('0x4a')](handleError(_0x4929fc,null));};exports[_0xc3dc('0x80')]=function(_0xe0fdbc,_0x583e9e,_0x46f08b){return db[_0xc3dc('0x2e')]['find']({'where':{'id':_0xe0fdbc['params']['id']}})['then'](handleEntityNotFound(_0x583e9e,null))['then'](function(_0x3c247a){if(_0x3c247a){return _0x3c247a['addAgents'](_0xe0fdbc[_0xc3dc('0x56')]['ids'],_[_0xc3dc('0x81')](_0xe0fdbc[_0xc3dc('0x56')],[_0xc3dc('0x82'),'id'])||{})[_0xc3dc('0x83')](function(_0x12ac82){for(var _0x79fdd8=0x0;_0x79fdd8<_0xe0fdbc[_0xc3dc('0x56')][_0xc3dc('0x82')][_0xc3dc('0x39')];_0x79fdd8+=0x1){socket[_0xc3dc('0x6e')](_0xc3dc('0x84'),{'UserId':_0xe0fdbc[_0xc3dc('0x56')][_0xc3dc('0x82')][_0x79fdd8],'FaxQueueId':_0xe0fdbc[_0xc3dc('0x49')]['id']});}return _0x12ac82;});}})['then'](respondWithResult(_0x583e9e,null))[_0xc3dc('0x4a')](handleError(_0x583e9e,null));};exports[_0xc3dc('0x7e')]=function(_0x49bd33,_0x2bd4ec,_0x55aca2){return db[_0xc3dc('0x2e')][_0xc3dc('0x51')]({'where':{'id':_0x49bd33[_0xc3dc('0x49')]['id']}})[_0xc3dc('0x28')](handleEntityNotFound(_0x2bd4ec,null))['then'](function(_0x564d33){if(_0x564d33){return _0x564d33[_0xc3dc('0x7e')](_0x49bd33['query'][_0xc3dc('0x82')])['then'](function(){if(_[_0xc3dc('0x85')](_0x49bd33[_0xc3dc('0x34')][_0xc3dc('0x82')])){for(var _0x3ecb34=0x0;_0x3ecb34<_0x49bd33[_0xc3dc('0x34')][_0xc3dc('0x82')][_0xc3dc('0x39')];_0x3ecb34+=0x1){socket['emit'](_0xc3dc('0x7f'),{'UserId':Number(_0x49bd33[_0xc3dc('0x34')][_0xc3dc('0x82')][_0x3ecb34]),'FaxQueueId':Number(_0x49bd33[_0xc3dc('0x49')]['id'])});}}else{socket[_0xc3dc('0x6e')](_0xc3dc('0x7f'),{'UserId':Number(_0x49bd33[_0xc3dc('0x34')][_0xc3dc('0x82')]),'FaxQueueId':Number(_0x49bd33['params']['id'])});}});}})[_0xc3dc('0x28')](respondWithStatusCode(_0x2bd4ec,null))[_0xc3dc('0x4a')](handleError(_0x2bd4ec,null));};exports[_0xc3dc('0x86')]=function(_0x3eaeae,_0x5aebdf,_0x5caf7e){var _0xb8b880={};var _0x13021e={};var _0xf9e4b8;var _0x4b1b9c;return db['FaxQueue'][_0xc3dc('0x61')]({'where':{'id':_0x3eaeae[_0xc3dc('0x49')]['id']}})[_0xc3dc('0x28')](handleEntityNotFound(_0x5aebdf,null))[_0xc3dc('0x28')](function(_0x497658){if(_0x497658){_0xf9e4b8=_0x497658;_0x13021e[_0xc3dc('0x32')]=_[_0xc3dc('0x33')](db[_0xc3dc('0x64')]['rawAttributes']);_0x13021e[_0xc3dc('0x34')]=_[_0xc3dc('0x33')](_0x3eaeae[_0xc3dc('0x34')]);_0x13021e[_0xc3dc('0x35')]=_[_0xc3dc('0x36')](_0x13021e[_0xc3dc('0x32')],_0x13021e[_0xc3dc('0x34')]);_0xb8b880['attributes']=_['intersection'](_0x13021e[_0xc3dc('0x32')],qs['fields'](_0x3eaeae[_0xc3dc('0x34')][_0xc3dc('0x37')]));_0xb8b880[_0xc3dc('0x38')]=_0xb8b880[_0xc3dc('0x38')][_0xc3dc('0x39')]?_0xb8b880[_0xc3dc('0x38')]:_0x13021e[_0xc3dc('0x32')];_0xb8b880['order']=qs[_0xc3dc('0x3d')](_0x3eaeae['query']['sort']);_0xb8b880[_0xc3dc('0x3f')]=qs[_0xc3dc('0x35')](_['pick'](_0x3eaeae[_0xc3dc('0x34')],_0x13021e[_0xc3dc('0x35')]));if(_0x3eaeae[_0xc3dc('0x34')][_0xc3dc('0x42')]){_0xb8b880[_0xc3dc('0x3f')]=_[_0xc3dc('0x43')](_0xb8b880[_0xc3dc('0x3f')],{'$or':_[_0xc3dc('0x2d')](_0xb8b880[_0xc3dc('0x38')],function(_0xe86e5e){var _0x3e41c2={};_0x3e41c2[_0xe86e5e]={'$like':'%'+_0x3eaeae['query'][_0xc3dc('0x42')]+'%'};return _0x3e41c2;})});}_0xb8b880=_['merge']({},_0xb8b880,_0x3eaeae[_0xc3dc('0x44')]);return _0xf9e4b8[_0xc3dc('0x86')](_0xb8b880);}})['then'](function(_0x3be03c){if(_0x3be03c){_0x4b1b9c=_0x3be03c['length'];if(!_0x3eaeae[_0xc3dc('0x34')]['hasOwnProperty']('nolimit')){_0xb8b880[_0xc3dc('0x22')]=qs['limit'](_0x3eaeae[_0xc3dc('0x34')][_0xc3dc('0x22')]);_0xb8b880[_0xc3dc('0x21')]=qs['offset'](_0x3eaeae[_0xc3dc('0x34')][_0xc3dc('0x21')]);}return _0xf9e4b8[_0xc3dc('0x86')](_0xb8b880);}})[_0xc3dc('0x28')](function(_0x5837f7){if(_0x5837f7){return _0x5837f7?{'count':_0x4b1b9c,'rows':_0x5837f7}:null;}})[_0xc3dc('0x28')](respondWithResult(_0x5aebdf,null))['catch'](handleError(_0x5aebdf,null));}; \ No newline at end of file +var _0x225b=['ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userFaxQueue:save','removeTeams','Team','select','field','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','get','error','name','send','index','FaxQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','include','findAll','rows','catch','params','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserFaxQueue','FaxQueueId','options','User','findAndCountAll','UserId','agent','format','SIP','faxPause','createdAt','getTeams','addTeams'];(function(_0x51c938,_0x7b322){var _0x4bb8b2=function(_0x148119){while(--_0x148119){_0x51c938['push'](_0x51c938['shift']());}};_0x4bb8b2(++_0x7b322);}(_0x225b,0xb1));var _0xb225=function(_0x1a60f6,_0x224970){_0x1a60f6=_0x1a60f6-0x0;var _0x2e9b02=_0x225b[_0x1a60f6];return _0x2e9b02;};'use strict';var pdf=require(_0xb225('0x0'));var emlformat=require(_0xb225('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb225('0x2'));var jsonpatch=require(_0xb225('0x3'));var rp=require('request-promise');var moment=require(_0xb225('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb225('0x5'));var util=require('util');var path=require(_0xb225('0x6'));var sox=require(_0xb225('0x7'));var csv=require(_0xb225('0x8'));var ejs=require(_0xb225('0x9'));var fs=require('fs');var _=require(_0xb225('0xa'));var squel=require(_0xb225('0xb'));var crypto=require(_0xb225('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb225('0xd'));var toCsv=require(_0xb225('0x8'));var querystring=require(_0xb225('0xe'));var Papa=require(_0xb225('0xf'));var Redis=require('ioredis');var authService=require(_0xb225('0x10'));var qs=require(_0xb225('0x11'));var as=require(_0xb225('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb225('0x13'))(_0xb225('0x14'));var utils=require(_0xb225('0x15'));var config=require(_0xb225('0x16'));var db=require(_0xb225('0x17'))['db'];config['redis']=_[_0xb225('0x18')](config[_0xb225('0x19')],{'host':_0xb225('0x1a'),'port':0x18eb});var socket=require(_0xb225('0x1b'))(new Redis(config[_0xb225('0x19')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x28f330,_0x897e1c){_0x897e1c=_0x897e1c||0xcc;return function(_0x2f163d){if(_0x2f163d){return _0x28f330[_0xb225('0x1c')](_0x897e1c);}return _0x28f330[_0xb225('0x1d')](_0x897e1c)[_0xb225('0x1e')]();};}function respondWithResult(_0x44d32d,_0x2be9b4){_0x2be9b4=_0x2be9b4||0xc8;return function(_0x41b06c){if(_0x41b06c){return _0x44d32d[_0xb225('0x1d')](_0x2be9b4)[_0xb225('0x1f')](_0x41b06c);}};}function respondWithFilteredResult(_0x42441a,_0x5ccb06){return function(_0x1ec9fe){if(_0x1ec9fe){var _0x5bd9e8=_0x1ec9fe[_0xb225('0x20')],_0x3df5f0=_0x5ccb06[_0xb225('0x21')],_0x10a0b6=_0x5ccb06[_0xb225('0x21')]+_0x5ccb06[_0xb225('0x22')],_0x400086;if(_0x10a0b6>=_0x5bd9e8){_0x10a0b6=_0x5bd9e8;_0x400086=0xc8;}else{_0x400086=0xce;}_0x42441a['status'](_0x400086);return _0x42441a['set'](_0xb225('0x23'),_0x3df5f0+'-'+_0x10a0b6+'/'+_0x5bd9e8)[_0xb225('0x1f')](_0x1ec9fe);}return null;};}function patchUpdates(_0x24c854){return function(_0x5df49c){try{jsonpatch['apply'](_0x5df49c,_0x24c854,!![]);}catch(_0x246f42){return BPromise[_0xb225('0x24')](_0x246f42);}return _0x5df49c[_0xb225('0x25')]();};}function saveUpdates(_0x12f00a,_0x8e76be){return function(_0x3d5a8d){if(_0x3d5a8d){return _0x3d5a8d['update'](_0x12f00a)[_0xb225('0x26')](function(_0x556ebf){return _0x556ebf;});}return null;};}function removeEntity(_0x535522,_0x3c323b){return function(_0x12a631){if(_0x12a631){return _0x12a631[_0xb225('0x27')]()[_0xb225('0x26')](function(){var _0xc8e76b=_0x12a631[_0xb225('0x28')]({'plain':!![]});var _0xf90a8b='FaxQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0xf90a8b,'resourceId':_0xc8e76b['id']}})[_0xb225('0x26')](function(){return _0x12a631;});})[_0xb225('0x26')](function(){_0x535522[_0xb225('0x1d')](0xcc)[_0xb225('0x1e')]();});}};}function handleEntityNotFound(_0x13e8e6,_0x5f4d74){return function(_0x8dad16){if(!_0x8dad16){_0x13e8e6[_0xb225('0x1c')](0x194);}return _0x8dad16;};}function handleError(_0x281e0f,_0x41bf0d){_0x41bf0d=_0x41bf0d||0x1f4;return function(_0x4200f9){logger[_0xb225('0x29')](_0x4200f9['stack']);if(_0x4200f9[_0xb225('0x2a')]){delete _0x4200f9[_0xb225('0x2a')];}_0x281e0f[_0xb225('0x1d')](_0x41bf0d)[_0xb225('0x2b')](_0x4200f9);};}exports[_0xb225('0x2c')]=function(_0x378724,_0xbd1a5d){var _0x396fa1={},_0x32dbda={},_0x3a1537={'count':0x0,'rows':[]};var _0x23dcdc=_['map'](db[_0xb225('0x2d')][_0xb225('0x2e')],function(_0x48e0d7){return{'name':_0x48e0d7[_0xb225('0x2f')],'type':_0x48e0d7['type'][_0xb225('0x30')]};});_0x32dbda[_0xb225('0x31')]=_[_0xb225('0x32')](_0x23dcdc,_0xb225('0x2a'));_0x32dbda[_0xb225('0x33')]=_[_0xb225('0x34')](_0x378724[_0xb225('0x33')]);_0x32dbda[_0xb225('0x35')]=_[_0xb225('0x36')](_0x32dbda['model'],_0x32dbda[_0xb225('0x33')]);_0x396fa1['attributes']=_[_0xb225('0x36')](_0x32dbda['model'],qs['fields'](_0x378724[_0xb225('0x33')][_0xb225('0x37')]));_0x396fa1[_0xb225('0x38')]=_0x396fa1[_0xb225('0x38')]['length']?_0x396fa1[_0xb225('0x38')]:_0x32dbda[_0xb225('0x31')];if(!_0x378724[_0xb225('0x33')][_0xb225('0x39')](_0xb225('0x3a'))){_0x396fa1[_0xb225('0x22')]=qs[_0xb225('0x22')](_0x378724[_0xb225('0x33')]['limit']);_0x396fa1['offset']=qs[_0xb225('0x21')](_0x378724['query'][_0xb225('0x21')]);}_0x396fa1[_0xb225('0x3b')]=qs['sort'](_0x378724[_0xb225('0x33')][_0xb225('0x3c')]);_0x396fa1['where']=qs[_0xb225('0x35')](_[_0xb225('0x3d')](_0x378724[_0xb225('0x33')],_0x32dbda[_0xb225('0x35')]),_0x23dcdc);if(_0x378724[_0xb225('0x33')]['filter']){_0x396fa1[_0xb225('0x3e')]=_[_0xb225('0x3f')](_0x396fa1['where'],{'$or':_[_0xb225('0x32')](_0x23dcdc,function(_0x26078a){if(_0x26078a[_0xb225('0x40')]!=='VIRTUAL'){var _0x507d45={};_0x507d45[_0x26078a['name']]={'$like':'%'+_0x378724['query'][_0xb225('0x41')]+'%'};return _0x507d45;}})});}_0x396fa1=_[_0xb225('0x3f')]({},_0x396fa1,_0x378724['options']);var _0x4d98fc={'where':_0x396fa1[_0xb225('0x3e')]};return db['FaxQueue'][_0xb225('0x20')](_0x4d98fc)[_0xb225('0x26')](function(_0x63f828){_0x3a1537['count']=_0x63f828;if(_0x378724[_0xb225('0x33')]['includeAll']){_0x396fa1[_0xb225('0x42')]=[{'all':!![]}];}return db[_0xb225('0x2d')][_0xb225('0x43')](_0x396fa1);})[_0xb225('0x26')](function(_0x383974){_0x3a1537[_0xb225('0x44')]=_0x383974;return _0x3a1537;})[_0xb225('0x26')](respondWithFilteredResult(_0xbd1a5d,_0x396fa1))[_0xb225('0x45')](handleError(_0xbd1a5d,null));};exports['show']=function(_0x3034ec,_0x1691ce){var _0x35b1f7={'raw':!![],'where':{'id':_0x3034ec[_0xb225('0x46')]['id']}},_0xec2af7={};_0xec2af7['model']=_[_0xb225('0x34')](db[_0xb225('0x2d')][_0xb225('0x2e')]);_0xec2af7[_0xb225('0x33')]=_[_0xb225('0x34')](_0x3034ec[_0xb225('0x33')]);_0xec2af7['filters']=_[_0xb225('0x36')](_0xec2af7[_0xb225('0x31')],_0xec2af7[_0xb225('0x33')]);_0x35b1f7[_0xb225('0x38')]=_['intersection'](_0xec2af7[_0xb225('0x31')],qs[_0xb225('0x37')](_0x3034ec['query'][_0xb225('0x37')]));_0x35b1f7[_0xb225('0x38')]=_0x35b1f7[_0xb225('0x38')][_0xb225('0x47')]?_0x35b1f7['attributes']:_0xec2af7['model'];if(_0x3034ec['query'][_0xb225('0x48')]){_0x35b1f7[_0xb225('0x42')]=[{'all':!![]}];}_0x35b1f7=_[_0xb225('0x3f')]({},_0x35b1f7,_0x3034ec['options']);return db[_0xb225('0x2d')]['find'](_0x35b1f7)[_0xb225('0x26')](handleEntityNotFound(_0x1691ce,null))[_0xb225('0x26')](respondWithResult(_0x1691ce,null))[_0xb225('0x45')](handleError(_0x1691ce,null));};exports['create']=function(_0x512c7e,_0x1a5397){return db[_0xb225('0x2d')][_0xb225('0x49')](_0x512c7e[_0xb225('0x4a')],{})[_0xb225('0x26')](function(_0x50b3d7){var _0xd87bbb=_0x512c7e['user']['get']({'plain':!![]});if(!_0xd87bbb)throw new Error(_0xb225('0x4b'));if(_0xd87bbb[_0xb225('0x4c')]==='user'){var _0x54cd0e=_0x50b3d7[_0xb225('0x28')]({'plain':!![]});var _0x5ad591=_0xb225('0x4d');return db[_0xb225('0x4e')][_0xb225('0x4f')]({'where':{'name':_0x5ad591,'userProfileId':_0xd87bbb[_0xb225('0x50')]},'raw':!![]})['then'](function(_0x332a1a){if(_0x332a1a&&_0x332a1a['autoAssociation']===0x0){return db[_0xb225('0x51')][_0xb225('0x49')]({'name':_0x54cd0e[_0xb225('0x2a')],'resourceId':_0x54cd0e['id'],'type':_0x332a1a[_0xb225('0x2a')],'sectionId':_0x332a1a['id']},{})['then'](function(){return _0x50b3d7;});}else{return _0x50b3d7;}})['catch'](function(_0x18a371){logger[_0xb225('0x29')](_0xb225('0x52'),_0x18a371);throw _0x18a371;});}return _0x50b3d7;})['then'](respondWithResult(_0x1a5397,0xc9))[_0xb225('0x45')](handleError(_0x1a5397,null));};exports[_0xb225('0x53')]=function(_0x230820,_0x17a920){if(_0x230820[_0xb225('0x4a')]['id']){delete _0x230820[_0xb225('0x4a')]['id'];}return db[_0xb225('0x2d')][_0xb225('0x4f')]({'where':{'id':_0x230820['params']['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x17a920,null))[_0xb225('0x26')](saveUpdates(_0x230820[_0xb225('0x4a')],null))[_0xb225('0x26')](respondWithResult(_0x17a920,null))[_0xb225('0x45')](handleError(_0x17a920,null));};exports['destroy']=function(_0x49345e,_0x556cb1){return db[_0xb225('0x2d')]['find']({'where':{'id':_0x49345e['params']['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x556cb1,null))[_0xb225('0x26')](removeEntity(_0x556cb1,null))[_0xb225('0x45')](handleError(_0x556cb1,null));};exports[_0xb225('0x54')]=function(_0x1e0dcf,_0x4c7a5e){return db[_0xb225('0x2d')][_0xb225('0x54')]()[_0xb225('0x26')](respondWithResult(_0x4c7a5e,null))['catch'](handleError(_0x4c7a5e,null));};exports['getMembers']=function(_0x4666b4,_0x553b06,_0x12073e){var _0x2678e8={'raw':!![],'where':{}},_0x5b687e={},_0x3653f8;return db[_0xb225('0x2d')][_0xb225('0x55')]({'where':{'id':_0x4666b4[_0xb225('0x46')]['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x553b06,null))['then'](function(_0x1d3ad9){if(_0x1d3ad9){_0x3653f8=_0x1d3ad9[_0xb225('0x28')]({'plain':!![]});_0x5b687e[_0xb225('0x31')]=_[_0xb225('0x34')](db[_0xb225('0x56')][_0xb225('0x2e')]);_0x5b687e[_0xb225('0x33')]=_[_0xb225('0x34')](_0x4666b4[_0xb225('0x33')]);_0x5b687e[_0xb225('0x35')]=_[_0xb225('0x36')](_0x5b687e[_0xb225('0x31')],_0x5b687e[_0xb225('0x33')]);_0x2678e8[_0xb225('0x38')]=_[_0xb225('0x36')](_0x5b687e['model'],qs[_0xb225('0x37')](_0x4666b4[_0xb225('0x33')]['fields']));_0x2678e8[_0xb225('0x38')]=_0x2678e8[_0xb225('0x38')][_0xb225('0x47')]?_0x2678e8['attributes']:_0x5b687e['model'];if(!_0x4666b4['query'][_0xb225('0x39')]('nolimit')){_0x2678e8[_0xb225('0x22')]=qs[_0xb225('0x22')](_0x4666b4[_0xb225('0x33')]['limit']);_0x2678e8[_0xb225('0x21')]=qs[_0xb225('0x21')](_0x4666b4[_0xb225('0x33')][_0xb225('0x21')]);}_0x2678e8[_0xb225('0x3b')]=qs['sort'](_0x4666b4['query'][_0xb225('0x3c')]);_0x2678e8['where']=qs[_0xb225('0x35')](_[_0xb225('0x3d')](_0x4666b4[_0xb225('0x33')],_0x5b687e[_0xb225('0x35')]));_0x2678e8[_0xb225('0x3e')][_0xb225('0x57')]=_0x1d3ad9['id'];if(_0x4666b4[_0xb225('0x33')][_0xb225('0x41')]){_0x2678e8[_0xb225('0x3e')]=_[_0xb225('0x3f')](_0x2678e8[_0xb225('0x3e')],{'$or':_['map'](_0x2678e8[_0xb225('0x38')],function(_0x10573d){var _0x1b58ed={};_0x1b58ed[_0x10573d]={'$like':'%'+_0x4666b4[_0xb225('0x33')][_0xb225('0x41')]+'%'};return _0x1b58ed;})});}_0x2678e8=_[_0xb225('0x3f')]({},_0x2678e8,_0x4666b4[_0xb225('0x58')]);return db[_0xb225('0x56')]['findAll'](_0x2678e8);}})[_0xb225('0x26')](function(_0x2d91a9){if(_0x2d91a9){return db[_0xb225('0x59')][_0xb225('0x5a')]({'where':{'id':_[_0xb225('0x32')](_0x2d91a9,_0xb225('0x5b')),'role':_0xb225('0x5c')},'attributes':['id',_0xb225('0x2a'),'faxPause','updatedAt','createdAt']});}})[_0xb225('0x26')](function(_0x6f404b){if(_0x6f404b){return{'count':_0x6f404b['count'],'rows':_['map'](_0x6f404b[_0xb225('0x44')],function(_0x26ede2){return{'membername':_0x26ede2[_0xb225('0x2a')],'UserId':_0x26ede2['id'],'queue_name':_0x3653f8['name'],'FaxQueueId':_0x3653f8['id'],'interface':util[_0xb225('0x5d')]('%s/%s',_0xb225('0x5e'),_0x26ede2[_0xb225('0x2a')]),'penalty':0x0,'paused':_0x26ede2[_0xb225('0x5f')],'createdAt':_0x26ede2[_0xb225('0x60')],'updatedAt':_0x26ede2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x553b06,_0x2678e8))[_0xb225('0x45')](handleError(_0x553b06,null));};exports[_0xb225('0x61')]=function(_0x5d18ba,_0x31f719,_0x2f5bd9){var _0x92f508={};var _0x1c2e75={};var _0x289245;var _0x4aaee7;return db[_0xb225('0x2d')]['findOne']({'where':{'id':_0x5d18ba['params']['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x31f719,null))[_0xb225('0x26')](function(_0x10bf86){if(_0x10bf86){_0x289245=_0x10bf86;_0x1c2e75[_0xb225('0x31')]=_[_0xb225('0x34')](db['Team'][_0xb225('0x2e')]);_0x1c2e75[_0xb225('0x33')]=_[_0xb225('0x34')](_0x5d18ba[_0xb225('0x33')]);_0x1c2e75[_0xb225('0x35')]=_[_0xb225('0x36')](_0x1c2e75[_0xb225('0x31')],_0x1c2e75[_0xb225('0x33')]);_0x92f508[_0xb225('0x38')]=_[_0xb225('0x36')](_0x1c2e75[_0xb225('0x31')],qs[_0xb225('0x37')](_0x5d18ba[_0xb225('0x33')]['fields']));_0x92f508[_0xb225('0x38')]=_0x92f508['attributes']['length']?_0x92f508[_0xb225('0x38')]:_0x1c2e75['model'];_0x92f508[_0xb225('0x3b')]=qs['sort'](_0x5d18ba[_0xb225('0x33')][_0xb225('0x3c')]);_0x92f508['where']=qs['filters'](_['pick'](_0x5d18ba[_0xb225('0x33')],_0x1c2e75[_0xb225('0x35')]));if(_0x5d18ba[_0xb225('0x33')][_0xb225('0x41')]){_0x92f508[_0xb225('0x3e')]=_[_0xb225('0x3f')](_0x92f508[_0xb225('0x3e')],{'$or':_[_0xb225('0x32')](_0x92f508[_0xb225('0x38')],function(_0x2ac4fe){var _0x1a9a7c={};_0x1a9a7c[_0x2ac4fe]={'$like':'%'+_0x5d18ba[_0xb225('0x33')][_0xb225('0x41')]+'%'};return _0x1a9a7c;})});}_0x92f508=_['merge']({},_0x92f508,_0x5d18ba[_0xb225('0x58')]);return _0x289245[_0xb225('0x61')](_0x92f508);}})['then'](function(_0x4b5241){if(_0x4b5241){_0x4aaee7=_0x4b5241[_0xb225('0x47')];if(!_0x5d18ba[_0xb225('0x33')]['hasOwnProperty'](_0xb225('0x3a'))){_0x92f508[_0xb225('0x22')]=qs['limit'](_0x5d18ba[_0xb225('0x33')]['limit']);_0x92f508['offset']=qs[_0xb225('0x21')](_0x5d18ba['query'][_0xb225('0x21')]);}return _0x289245[_0xb225('0x61')](_0x92f508);}})[_0xb225('0x26')](function(_0x494d9d){if(_0x494d9d){return _0x494d9d?{'count':_0x4aaee7,'rows':_0x494d9d}:null;}})[_0xb225('0x26')](respondWithResult(_0x31f719,null))[_0xb225('0x45')](handleError(_0x31f719,null));};exports[_0xb225('0x62')]=function(_0x483aed,_0x224fb5,_0x4fa2d9){var _0x46423e=_0x483aed[_0xb225('0x4a')][_0xb225('0x63')];return db['Team'][_0xb225('0x43')]({'where':{'id':_0x46423e},'attributes':['id'],'include':[{'model':db[_0xb225('0x59')],'as':_0xb225('0x64'),'attributes':['id',_0xb225('0x2a'),_0xb225('0x65'),_0xb225('0x66'),_0xb225('0x67')],'raw':!![]}]})[_0xb225('0x26')](function(_0x2544bb){if(_0x2544bb){var _0x2213f6=_[_0xb225('0x68')](_0x2544bb,function(_0x13304e){var _0x409284=_0x13304e[_0xb225('0x28')]({'plain':!![]});return _0x409284[_0xb225('0x64')];});return db[_0xb225('0x2d')]['find']({'where':{'id':_0x483aed['params']['id']}})['then'](function(_0x169470){return db[_0xb225('0x69')][_0xb225('0x6a')](function(_0x133fa8){return _0x169470[_0xb225('0x62')](_0x46423e,{'transaction':_0x133fa8})[_0xb225('0x26')](function(){return BPromise[_0xb225('0x6b')](_0x2213f6,function(_0x24c5fa){return db[_0xb225('0x56')]['findOrCreate']({'where':{'UserId':_0x24c5fa['id'],'FaxQueueId':_0x483aed['params']['id']},'transaction':_0x133fa8});});})[_0xb225('0x26')](function(){_0x2213f6[_0xb225('0x6c')](function(_0x578006){socket['emit'](_0xb225('0x6d'),{'UserId':_0x578006['id'],'FaxQueueId':_0x169470['id']});});});});});}})[_0xb225('0x26')](respondWithStatusCode(_0x224fb5,null))[_0xb225('0x45')](handleError(_0x224fb5,null));};exports[_0xb225('0x6e')]=function(_0x3c6cab,_0x358928,_0x291395){return db[_0xb225('0x6f')][_0xb225('0x43')]({'where':{'id':_0x3c6cab['query'][_0xb225('0x63')]},'attributes':['id'],'include':[{'model':db[_0xb225('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb225('0x26')](handleEntityNotFound(_0x358928,null))[_0xb225('0x26')](function(_0x4494f1){var _0x42cdc9=_[_0xb225('0x32')](_0x4494f1,'id');var _0x2ba0fd=[];var _0x421919=[];var _0x4f8e82=squel[_0xb225('0x70')]();_0x4f8e82[_0xb225('0x71')](_0xb225('0x72'))['from'](_0xb225('0x73'),'tq')[_0xb225('0x74')]('user_has_teams','ut',_0xb225('0x75'))['where'](_0xb225('0x76'),_0x3c6cab['params']['id']);for(var _0x35dd3a=0x0;_0x35dd3a<_0x4494f1[_0xb225('0x47')];_0x35dd3a+=0x1){let _0x52420a=_0x4494f1[_0x35dd3a];for(var _0x3c11a3=0x0;_0x3c11a3<_0x52420a[_0xb225('0x64')][_0xb225('0x47')];_0x3c11a3+=0x1){let _0x47c39a=_0x52420a[_0xb225('0x64')][_0x3c11a3];var _0x522c2a=_0x4f8e82[_0xb225('0x77')]();_0x522c2a[_0xb225('0x3e')]('ut.UserId\x20=\x20?',_0x47c39a['id']);_0x421919[_0xb225('0x78')](db[_0xb225('0x69')][_0xb225('0x33')](_0x522c2a[_0xb225('0x79')](),{'type':db['sequelize'][_0xb225('0x7a')][_0xb225('0x7b')]})[_0xb225('0x26')](function(_0x5a1f26){if(_0x5a1f26[_0xb225('0x47')]===0x1){return _0x47c39a['id'];}else{var _0xba8e0d=_[_0xb225('0x7c')](_[_0xb225('0x32')](_0x5a1f26,_0xb225('0x7d')),function(_0x31497b){return _[_0xb225('0x7e')](_0x42cdc9,_0x31497b);});if(_0xba8e0d){return _0x47c39a['id'];}}}));}}return BPromise[_0xb225('0x7f')](_0x421919)[_0xb225('0x26')](function(_0xfd2de1){_0x2ba0fd=_(_0x2ba0fd)['union'](_0xfd2de1)[_0xb225('0x80')]()[_0xb225('0x81')]();return db[_0xb225('0x2d')]['find']({'where':{'id':_0x3c6cab[_0xb225('0x46')]['id']}})[_0xb225('0x26')](function(_0xfe66c9){return db[_0xb225('0x69')][_0xb225('0x6a')](function(_0x21b5cc){return _0xfe66c9['removeTeams'](_0x3c6cab[_0xb225('0x33')][_0xb225('0x63')],{'transaction':_0x21b5cc})[_0xb225('0x26')](function(){if(!_[_0xb225('0x82')](_0x2ba0fd)){return _0xfe66c9[_0xb225('0x83')](_0x2ba0fd,{'transaction':_0x21b5cc});}})[_0xb225('0x26')](function(){_0x2ba0fd[_0xb225('0x6c')](function(_0x5070d5){socket[_0xb225('0x84')](_0xb225('0x85'),{'UserId':_0x5070d5,'FaxQueueId':_0xfe66c9['id']});});});});});});})[_0xb225('0x26')](respondWithStatusCode(_0x358928,null))['catch'](handleError(_0x358928,null));};exports[_0xb225('0x86')]=function(_0x27e0d5,_0x32c730,_0x2c4542){return db[_0xb225('0x2d')][_0xb225('0x4f')]({'where':{'id':_0x27e0d5[_0xb225('0x46')]['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x32c730,null))[_0xb225('0x26')](function(_0x5ea762){if(_0x5ea762){return _0x5ea762[_0xb225('0x86')](_0x27e0d5[_0xb225('0x4a')][_0xb225('0x63')],_[_0xb225('0x87')](_0x27e0d5[_0xb225('0x4a')],['ids','id'])||{})['spread'](function(_0x41633c){for(var _0x8a7e0a=0x0;_0x8a7e0a<_0x27e0d5[_0xb225('0x4a')]['ids']['length'];_0x8a7e0a+=0x1){socket[_0xb225('0x84')](_0xb225('0x6d'),{'UserId':_0x27e0d5[_0xb225('0x4a')][_0xb225('0x63')][_0x8a7e0a],'FaxQueueId':_0x27e0d5[_0xb225('0x46')]['id']});}return _0x41633c;});}})[_0xb225('0x26')](respondWithResult(_0x32c730,null))['catch'](handleError(_0x32c730,null));};exports[_0xb225('0x83')]=function(_0x2b43d2,_0x566016,_0x3479a5){return db[_0xb225('0x2d')][_0xb225('0x4f')]({'where':{'id':_0x2b43d2[_0xb225('0x46')]['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x566016,null))[_0xb225('0x26')](function(_0x50fa9c){if(_0x50fa9c){return _0x50fa9c['removeAgents'](_0x2b43d2['query'][_0xb225('0x63')])[_0xb225('0x26')](function(){if(_[_0xb225('0x88')](_0x2b43d2['query'][_0xb225('0x63')])){for(var _0xa88ef0=0x0;_0xa88ef0<_0x2b43d2[_0xb225('0x33')][_0xb225('0x63')][_0xb225('0x47')];_0xa88ef0+=0x1){socket[_0xb225('0x84')]('userFaxQueue:remove',{'UserId':Number(_0x2b43d2['query'][_0xb225('0x63')][_0xa88ef0]),'FaxQueueId':Number(_0x2b43d2[_0xb225('0x46')]['id'])});}}else{socket[_0xb225('0x84')](_0xb225('0x85'),{'UserId':Number(_0x2b43d2[_0xb225('0x33')][_0xb225('0x63')]),'FaxQueueId':Number(_0x2b43d2[_0xb225('0x46')]['id'])});}});}})[_0xb225('0x26')](respondWithStatusCode(_0x566016,null))[_0xb225('0x45')](handleError(_0x566016,null));};exports[_0xb225('0x89')]=function(_0x76716d,_0x3cf10a,_0x4ef85e){var _0x45f592={};var _0xe3533b={};var _0x204b67;var _0x2dd1bf;return db[_0xb225('0x2d')][_0xb225('0x55')]({'where':{'id':_0x76716d[_0xb225('0x46')]['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x3cf10a,null))[_0xb225('0x26')](function(_0x475381){if(_0x475381){_0x204b67=_0x475381;_0xe3533b[_0xb225('0x31')]=_['keys'](db['User'][_0xb225('0x2e')]);_0xe3533b[_0xb225('0x33')]=_[_0xb225('0x34')](_0x76716d[_0xb225('0x33')]);_0xe3533b[_0xb225('0x35')]=_[_0xb225('0x36')](_0xe3533b[_0xb225('0x31')],_0xe3533b[_0xb225('0x33')]);_0x45f592[_0xb225('0x38')]=_[_0xb225('0x36')](_0xe3533b['model'],qs[_0xb225('0x37')](_0x76716d[_0xb225('0x33')]['fields']));_0x45f592[_0xb225('0x38')]=_0x45f592[_0xb225('0x38')][_0xb225('0x47')]?_0x45f592[_0xb225('0x38')]:_0xe3533b[_0xb225('0x31')];_0x45f592['order']=qs[_0xb225('0x3c')](_0x76716d['query'][_0xb225('0x3c')]);_0x45f592['where']=qs[_0xb225('0x35')](_[_0xb225('0x3d')](_0x76716d[_0xb225('0x33')],_0xe3533b[_0xb225('0x35')]));if(_0x76716d[_0xb225('0x33')][_0xb225('0x41')]){_0x45f592[_0xb225('0x3e')]=_[_0xb225('0x3f')](_0x45f592[_0xb225('0x3e')],{'$or':_['map'](_0x45f592[_0xb225('0x38')],function(_0x1bad17){var _0x50843a={};_0x50843a[_0x1bad17]={'$like':'%'+_0x76716d[_0xb225('0x33')][_0xb225('0x41')]+'%'};return _0x50843a;})});}_0x45f592=_[_0xb225('0x3f')]({},_0x45f592,_0x76716d[_0xb225('0x58')]);return _0x204b67[_0xb225('0x89')](_0x45f592);}})['then'](function(_0x39e03a){if(_0x39e03a){_0x2dd1bf=_0x39e03a[_0xb225('0x47')];if(!_0x76716d[_0xb225('0x33')][_0xb225('0x39')]('nolimit')){_0x45f592[_0xb225('0x22')]=qs[_0xb225('0x22')](_0x76716d[_0xb225('0x33')]['limit']);_0x45f592['offset']=qs[_0xb225('0x21')](_0x76716d[_0xb225('0x33')][_0xb225('0x21')]);}return _0x204b67[_0xb225('0x89')](_0x45f592);}})[_0xb225('0x26')](function(_0x1db9a5){if(_0x1db9a5){return _0x1db9a5?{'count':_0x2dd1bf,'rows':_0x1db9a5}:null;}})[_0xb225('0x26')](respondWithResult(_0x3cf10a,null))[_0xb225('0x45')](handleError(_0x3cf10a,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index c87f7c0..a12fa6a 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 _0x27f3=['hasOwnProperty','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit'];(function(_0x495229,_0xc68730){var _0x37ae6d=function(_0x4d5498){while(--_0x4d5498){_0x495229['push'](_0x495229['shift']());}};_0x37ae6d(++_0xc68730);}(_0x27f3,0x6e));var _0x327f=function(_0x405385,_0x56f573){_0x405385=_0x405385-0x0;var _0x43837b=_0x27f3[_0x405385];return _0x43837b;};'use strict';var EventEmitter=require(_0x327f('0x0'));var FaxQueue=require(_0x327f('0x1'))['db'][_0x327f('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x327f('0x3')](0x0);var events={'afterCreate':_0x327f('0x4'),'afterUpdate':'update','afterDestroy':_0x327f('0x5')};function emitEvent(_0x3f0dea){return function(_0x69eafc,_0x2e23c8,_0x45a58c){FaxQueueEvents[_0x327f('0x6')](_0x3f0dea+':'+_0x69eafc['id'],_0x69eafc);FaxQueueEvents['emit'](_0x3f0dea,_0x69eafc);_0x45a58c(null);};}for(var e in events){if(events[_0x327f('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x327f('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xe2f9=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit'];(function(_0xbb58c2,_0x56bfb7){var _0x3db3c3=function(_0x3e4c71){while(--_0x3e4c71){_0xbb58c2['push'](_0xbb58c2['shift']());}};_0x3db3c3(++_0x56bfb7);}(_0xe2f9,0x1ed));var _0x9e2f=function(_0x32f0ab,_0x1b4009){_0x32f0ab=_0x32f0ab-0x0;var _0x32a53e=_0xe2f9[_0x32f0ab];return _0x32a53e;};'use strict';var EventEmitter=require(_0x9e2f('0x0'));var FaxQueue=require(_0x9e2f('0x1'))['db'][_0x9e2f('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9e2f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9e2f('0x4'),'afterDestroy':_0x9e2f('0x5')};function emitEvent(_0x1ca494){return function(_0xc68352,_0x55e4df,_0x1fcf76){FaxQueueEvents[_0x9e2f('0x6')](_0x1ca494+':'+_0xc68352['id'],_0xc68352);FaxQueueEvents['emit'](_0x1ca494,_0xc68352);_0x1fcf76(null);};}for(var e in events){if(events[_0x9e2f('0x7')](e)){var event=events[e];FaxQueue[_0x9e2f('0x8')](e,emitEvent(event));}}module[_0x9e2f('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 02be5ea..8cb4e45 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 _0x91ad=['fax_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxQueue'];(function(_0x296754,_0x5befe9){var _0x1d9f1d=function(_0x3f033e){while(--_0x3f033e){_0x296754['push'](_0x296754['shift']());}};_0x1d9f1d(++_0x5befe9);}(_0x91ad,0xfd));var _0xd91a=function(_0x36b46a,_0x23b060){_0x36b46a=_0x36b46a-0x0;var _0x3fef23=_0x91ad[_0x36b46a];return _0x3fef23;};'use strict';var _=require(_0xd91a('0x0'));var util=require(_0xd91a('0x1'));var logger=require('../../config/logger')(_0xd91a('0x2'));var moment=require(_0xd91a('0x3'));var BPromise=require(_0xd91a('0x4'));var rp=require(_0xd91a('0x5'));var fs=require('fs');var path=require(_0xd91a('0x6'));var rimraf=require(_0xd91a('0x7'));var config=require(_0xd91a('0x8'));var attributes=require('./faxQueue.attributes');module[_0xd91a('0x9')]=function(_0x35fd2e,_0xcfe847){return _0x35fd2e['define'](_0xd91a('0xa'),attributes,{'tableName':_0xd91a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb699=['exports','define','FaxQueue','fax_queues','lodash','api','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x21dd98,_0x52877c){var _0x45799a=function(_0x574afb){while(--_0x574afb){_0x21dd98['push'](_0x21dd98['shift']());}};_0x45799a(++_0x52877c);}(_0xb699,0x101));var _0x9b69=function(_0x3947e5,_0x3cf8ce){_0x3947e5=_0x3947e5-0x0;var _0x3e64c1=_0xb699[_0x3947e5];return _0x3e64c1;};'use strict';var _=require(_0x9b69('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9b69('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9b69('0x2'));var fs=require('fs');var path=require(_0x9b69('0x3'));var rimraf=require(_0x9b69('0x4'));var config=require(_0x9b69('0x5'));var attributes=require(_0x9b69('0x6'));module[_0x9b69('0x7')]=function(_0x2809ee,_0x3c1083){return _0x2809ee[_0x9b69('0x8')](_0x9b69('0x9'),attributes,{'tableName':_0x9b69('0xa'),'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 ea57f39..4744668 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 _0x2458=['jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','where','limit','include','map','model','attributes','debug','ShowFaxQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5c4ce5,_0x216a3c){var _0x2729d5=function(_0xfcbc2e){while(--_0xfcbc2e){_0x5c4ce5['push'](_0x5c4ce5['shift']());}};_0x2729d5(++_0x216a3c);}(_0x2458,0x10e));var _0x8245=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2458[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x8245('0x0'));var util=require(_0x8245('0x1'));var moment=require(_0x8245('0x2'));var BPromise=require(_0x8245('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8245('0x4'));var db=require(_0x8245('0x5'))['db'];var utils=require(_0x8245('0x6'));var logger=require(_0x8245('0x7'))(_0x8245('0x8'));var config=require(_0x8245('0x9'));var jayson=require(_0x8245('0xa'));var client=jayson[_0x8245('0xb')]['http']({'port':0x232a});config['redis']=_[_0x8245('0xc')](config[_0x8245('0xd')],{'host':_0x8245('0xe'),'port':0x18eb});var socket=require(_0x8245('0xf'))(new Redis(config[_0x8245('0xd')]));require('./faxQueue.socket')[_0x8245('0x10')](socket);function respondWithRpcPromise(_0x273ad1,_0x233623,_0x409c78){return new BPromise(function(_0x1bf51c,_0x51ca3e){return client['request'](_0x273ad1,_0x409c78)[_0x8245('0x11')](function(_0x5148d9){logger[_0x8245('0x12')](_0x8245('0x13'),_0x233623,_0x8245('0x14'));logger['debug'](_0x8245('0x15'),_0x233623,_0x8245('0x14'),JSON[_0x8245('0x16')](_0x5148d9));if(_0x5148d9['error']){if(_0x5148d9[_0x8245('0x17')]['code']===0x1f4){logger['error'](_0x8245('0x13'),_0x233623,_0x5148d9['error'][_0x8245('0x18')]);return _0x51ca3e(_0x5148d9['error']['message']);}logger[_0x8245('0x17')](_0x8245('0x13'),_0x233623,_0x5148d9[_0x8245('0x17')][_0x8245('0x18')]);return _0x1bf51c(_0x5148d9[_0x8245('0x17')][_0x8245('0x18')]);}else{logger[_0x8245('0x12')](_0x8245('0x13'),_0x233623,'request\x20sent');_0x1bf51c(_0x5148d9['result']['message']);}})[_0x8245('0x19')](function(_0x5552c0){logger[_0x8245('0x17')]('FaxQueue,\x20%s,\x20%s',_0x233623,_0x5552c0);_0x51ca3e(_0x5552c0);});});}exports[_0x8245('0x1a')]=function(_0x63d619){var _0xa7f914=this;return new Promise(function(_0x148888,_0x27b72f){return db[_0x8245('0x1b')][_0x8245('0x1c')]({'raw':_0x63d619[_0x8245('0x1d')]?_0x63d619['options']['raw']===undefined?!![]:![]:!![],'where':_0x63d619[_0x8245('0x1d')]?_0x63d619[_0x8245('0x1d')][_0x8245('0x1e')]||null:null,'attributes':_0x63d619[_0x8245('0x1d')]?_0x63d619[_0x8245('0x1d')]['attributes']||null:null,'limit':_0x63d619[_0x8245('0x1d')]?_0x63d619[_0x8245('0x1d')][_0x8245('0x1f')]||null:null,'include':_0x63d619[_0x8245('0x1d')]?_0x63d619[_0x8245('0x1d')][_0x8245('0x20')]?_[_0x8245('0x21')](_0x63d619['options'][_0x8245('0x20')],function(_0x4466a8){return{'model':db[_0x4466a8[_0x8245('0x22')]],'as':_0x4466a8['as'],'attributes':_0x4466a8['attributes'],'include':_0x4466a8['include']?_[_0x8245('0x21')](_0x4466a8[_0x8245('0x20')],function(_0x3cf644){return{'model':db[_0x3cf644[_0x8245('0x22')]],'as':_0x3cf644['as'],'attributes':_0x3cf644['attributes'],'include':_0x3cf644[_0x8245('0x20')]?_['map'](_0x3cf644[_0x8245('0x20')],function(_0x83ef49){return{'model':db[_0x83ef49[_0x8245('0x22')]],'as':_0x83ef49['as'],'attributes':_0x83ef49[_0x8245('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9f0545){logger['info'](_0x8245('0x1a'),_0x63d619);logger[_0x8245('0x24')](_0x8245('0x1a'),_0x63d619,JSON[_0x8245('0x16')](_0x9f0545));_0x148888(_0x9f0545);})['catch'](function(_0xf4fbc9){logger[_0x8245('0x17')](_0x8245('0x1a'),_0xf4fbc9[_0x8245('0x18')],_0x63d619);_0x27b72f(_0xa7f914['error'](0x1f4,_0xf4fbc9[_0x8245('0x18')]));});});};exports[_0x8245('0x25')]=function(_0xc0322c){var _0x7f4a6b=this;return new Promise(function(_0x348f76,_0x22d9a5){return db['FaxQueue'][_0x8245('0x26')]({'raw':_0xc0322c[_0x8245('0x1d')]?_0xc0322c[_0x8245('0x1d')][_0x8245('0x27')]===undefined?!![]:![]:!![],'where':_0xc0322c[_0x8245('0x1d')]?_0xc0322c['options'][_0x8245('0x1e')]||null:null,'attributes':_0xc0322c['options']?_0xc0322c[_0x8245('0x1d')]['attributes']||null:null,'include':_0xc0322c[_0x8245('0x1d')]?_0xc0322c[_0x8245('0x1d')][_0x8245('0x20')]?_[_0x8245('0x21')](_0xc0322c['options'][_0x8245('0x20')],function(_0x5f2dcb){return{'model':db[_0x5f2dcb[_0x8245('0x22')]],'as':_0x5f2dcb['as'],'attributes':_0x5f2dcb[_0x8245('0x23')],'include':_0x5f2dcb[_0x8245('0x20')]?_[_0x8245('0x21')](_0x5f2dcb[_0x8245('0x20')],function(_0x5cdcb5){return{'model':db[_0x5cdcb5[_0x8245('0x22')]],'as':_0x5cdcb5['as'],'attributes':_0x5cdcb5[_0x8245('0x23')],'include':_0x5cdcb5[_0x8245('0x20')]?_[_0x8245('0x21')](_0x5cdcb5[_0x8245('0x20')],function(_0x1b8f24){return{'model':db[_0x1b8f24['model']],'as':_0x1b8f24['as'],'attributes':_0x1b8f24[_0x8245('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8245('0x11')](function(_0x579ca2){logger[_0x8245('0x12')](_0x8245('0x25'),_0xc0322c);logger[_0x8245('0x24')](_0x8245('0x25'),_0xc0322c,JSON[_0x8245('0x16')](_0x579ca2));_0x348f76(_0x579ca2);})['catch'](function(_0xab2e68){logger[_0x8245('0x17')](_0x8245('0x25'),_0xab2e68['message'],_0xc0322c);_0x22d9a5(_0x7f4a6b[_0x8245('0x17')](0x1f4,_0xab2e68['message']));});});}; \ No newline at end of file +var _0x8ca3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','include','map','model','ShowFaxQueue','moment'];(function(_0xb1c2ef,_0x146cda){var _0x9f520=function(_0x3a7386){while(--_0x3a7386){_0xb1c2ef['push'](_0xb1c2ef['shift']());}};_0x9f520(++_0x146cda);}(_0x8ca3,0x1b7));var _0x38ca=function(_0x47dcb1,_0x2e7067){_0x47dcb1=_0x47dcb1-0x0;var _0x532b9f=_0x8ca3[_0x47dcb1];return _0x532b9f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x38ca('0x0'));var BPromise=require(_0x38ca('0x1'));var rs=require(_0x38ca('0x2'));var fs=require('fs');var Redis=require(_0x38ca('0x3'));var db=require(_0x38ca('0x4'))['db'];var utils=require(_0x38ca('0x5'));var logger=require(_0x38ca('0x6'))(_0x38ca('0x7'));var config=require(_0x38ca('0x8'));var jayson=require(_0x38ca('0x9'));var client=jayson[_0x38ca('0xa')][_0x38ca('0xb')]({'port':0x232a});config[_0x38ca('0xc')]=_[_0x38ca('0xd')](config[_0x38ca('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x38ca('0xe'))(new Redis(config[_0x38ca('0xc')]));require(_0x38ca('0xf'))[_0x38ca('0x10')](socket);function respondWithRpcPromise(_0x3a033a,_0x457dc2,_0x234539){return new BPromise(function(_0xd99985,_0x49a7c2){return client[_0x38ca('0x11')](_0x3a033a,_0x234539)[_0x38ca('0x12')](function(_0x11db54){logger['info'](_0x38ca('0x13'),_0x457dc2,_0x38ca('0x14'));logger[_0x38ca('0x15')](_0x38ca('0x16'),_0x457dc2,_0x38ca('0x14'),JSON[_0x38ca('0x17')](_0x11db54));if(_0x11db54[_0x38ca('0x18')]){if(_0x11db54['error'][_0x38ca('0x19')]===0x1f4){logger[_0x38ca('0x18')](_0x38ca('0x13'),_0x457dc2,_0x11db54[_0x38ca('0x18')][_0x38ca('0x1a')]);return _0x49a7c2(_0x11db54[_0x38ca('0x18')][_0x38ca('0x1a')]);}logger[_0x38ca('0x18')](_0x38ca('0x13'),_0x457dc2,_0x11db54[_0x38ca('0x18')]['message']);return _0xd99985(_0x11db54[_0x38ca('0x18')][_0x38ca('0x1a')]);}else{logger[_0x38ca('0x1b')](_0x38ca('0x13'),_0x457dc2,_0x38ca('0x14'));_0xd99985(_0x11db54[_0x38ca('0x1c')][_0x38ca('0x1a')]);}})[_0x38ca('0x1d')](function(_0x346c4a){logger[_0x38ca('0x18')](_0x38ca('0x13'),_0x457dc2,_0x346c4a);_0x49a7c2(_0x346c4a);});});}exports[_0x38ca('0x1e')]=function(_0x10efbb){var _0x28db93=this;return new Promise(function(_0x5e9179,_0x2c29b5){return db[_0x38ca('0x1f')][_0x38ca('0x20')]({'raw':_0x10efbb[_0x38ca('0x21')]?_0x10efbb[_0x38ca('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x10efbb[_0x38ca('0x21')]?_0x10efbb['options'][_0x38ca('0x22')]||null:null,'attributes':_0x10efbb[_0x38ca('0x21')]?_0x10efbb['options'][_0x38ca('0x23')]||null:null,'limit':_0x10efbb[_0x38ca('0x21')]?_0x10efbb['options']['limit']||null:null,'include':_0x10efbb[_0x38ca('0x21')]?_0x10efbb[_0x38ca('0x21')][_0x38ca('0x24')]?_[_0x38ca('0x25')](_0x10efbb[_0x38ca('0x21')]['include'],function(_0xb2525c){return{'model':db[_0xb2525c[_0x38ca('0x26')]],'as':_0xb2525c['as'],'attributes':_0xb2525c[_0x38ca('0x23')],'include':_0xb2525c[_0x38ca('0x24')]?_[_0x38ca('0x25')](_0xb2525c[_0x38ca('0x24')],function(_0x4161fe){return{'model':db[_0x4161fe[_0x38ca('0x26')]],'as':_0x4161fe['as'],'attributes':_0x4161fe['attributes'],'include':_0x4161fe[_0x38ca('0x24')]?_[_0x38ca('0x25')](_0x4161fe[_0x38ca('0x24')],function(_0x57f2dc){return{'model':db[_0x57f2dc['model']],'as':_0x57f2dc['as'],'attributes':_0x57f2dc[_0x38ca('0x23')]};}):[]};}):[]};}):[]:[]})[_0x38ca('0x12')](function(_0x4a37a2){logger[_0x38ca('0x1b')](_0x38ca('0x1e'),_0x10efbb);logger[_0x38ca('0x15')](_0x38ca('0x1e'),_0x10efbb,JSON[_0x38ca('0x17')](_0x4a37a2));_0x5e9179(_0x4a37a2);})[_0x38ca('0x1d')](function(_0xf1d604){logger['error'](_0x38ca('0x1e'),_0xf1d604[_0x38ca('0x1a')],_0x10efbb);_0x2c29b5(_0x28db93[_0x38ca('0x18')](0x1f4,_0xf1d604[_0x38ca('0x1a')]));});});};exports[_0x38ca('0x27')]=function(_0x5561be){var _0x592597=this;return new Promise(function(_0x4f7366,_0x4c7ff2){return db['FaxQueue']['find']({'raw':_0x5561be['options']?_0x5561be[_0x38ca('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x5561be[_0x38ca('0x21')]?_0x5561be[_0x38ca('0x21')]['where']||null:null,'attributes':_0x5561be[_0x38ca('0x21')]?_0x5561be[_0x38ca('0x21')][_0x38ca('0x23')]||null:null,'include':_0x5561be[_0x38ca('0x21')]?_0x5561be[_0x38ca('0x21')][_0x38ca('0x24')]?_['map'](_0x5561be[_0x38ca('0x21')][_0x38ca('0x24')],function(_0x4a097a){return{'model':db[_0x4a097a[_0x38ca('0x26')]],'as':_0x4a097a['as'],'attributes':_0x4a097a[_0x38ca('0x23')],'include':_0x4a097a[_0x38ca('0x24')]?_[_0x38ca('0x25')](_0x4a097a[_0x38ca('0x24')],function(_0x270d70){return{'model':db[_0x270d70[_0x38ca('0x26')]],'as':_0x270d70['as'],'attributes':_0x270d70['attributes'],'include':_0x270d70['include']?_[_0x38ca('0x25')](_0x270d70[_0x38ca('0x24')],function(_0x34bb9b){return{'model':db[_0x34bb9b[_0x38ca('0x26')]],'as':_0x34bb9b['as'],'attributes':_0x34bb9b[_0x38ca('0x23')]};}):[]};}):[]};}):[]:[]})[_0x38ca('0x12')](function(_0x353562){logger[_0x38ca('0x1b')]('ShowFaxQueue',_0x5561be);logger[_0x38ca('0x15')](_0x38ca('0x27'),_0x5561be,JSON[_0x38ca('0x17')](_0x353562));_0x4f7366(_0x353562);})['catch'](function(_0x2ae7b3){logger[_0x38ca('0x18')]('ShowFaxQueue',_0x2ae7b3[_0x38ca('0x1a')],_0x5561be);_0x4c7ff2(_0x592597[_0x38ca('0x18')](0x1f4,_0x2ae7b3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 5657749..87d2947 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 _0xee05=['remove','update','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x1c1955,_0x347c1b){var _0xed061a=function(_0x5ec4dc){while(--_0x5ec4dc){_0x1c1955['push'](_0x1c1955['shift']());}};_0xed061a(++_0x347c1b);}(_0xee05,0x110));var _0x5ee0=function(_0x551a64,_0x4407e0){_0x551a64=_0x551a64-0x0;var _0x3452c3=_0xee05[_0x551a64];return _0x3452c3;};'use strict';var FaxQueueEvents=require(_0x5ee0('0x0'));var events=['save',_0x5ee0('0x1'),_0x5ee0('0x2')];function createListener(_0xaca72d,_0x57dca3){return function(_0x114723){_0x57dca3['emit'](_0xaca72d,_0x114723);};}function removeListener(_0x36203c,_0x39917a){return function(){FaxQueueEvents[_0x5ee0('0x3')](_0x36203c,_0x39917a);};}exports[_0x5ee0('0x4')]=function(_0x324c3){for(var _0x2ec17e=0x0,_0x121c54=events[_0x5ee0('0x5')];_0x2ec17e<_0x121c54;_0x2ec17e++){var _0x56f90c=events[_0x2ec17e];var _0x282e48=createListener(_0x5ee0('0x6')+_0x56f90c,_0x324c3);FaxQueueEvents['on'](_0x56f90c,_0x282e48);}}; \ No newline at end of file +var _0xfdf6=['removeListener','register','./faxQueue.events','save','update','emit'];(function(_0x3fbc6a,_0x1f1133){var _0x524a7c=function(_0x5d25c8){while(--_0x5d25c8){_0x3fbc6a['push'](_0x3fbc6a['shift']());}};_0x524a7c(++_0x1f1133);}(_0xfdf6,0xfe));var _0x6fdf=function(_0x2f2f70,_0x4d0a75){_0x2f2f70=_0x2f2f70-0x0;var _0x4c1c88=_0xfdf6[_0x2f2f70];return _0x4c1c88;};'use strict';var FaxQueueEvents=require(_0x6fdf('0x0'));var events=[_0x6fdf('0x1'),'remove',_0x6fdf('0x2')];function createListener(_0x17114f,_0x1e9442){return function(_0x3a5631){_0x1e9442[_0x6fdf('0x3')](_0x17114f,_0x3a5631);};}function removeListener(_0x2ebb1f,_0x501102){return function(){FaxQueueEvents[_0x6fdf('0x4')](_0x2ebb1f,_0x501102);};}exports[_0x6fdf('0x5')]=function(_0x25bbb3){for(var _0x3c180a=0x0,_0x54b9a9=events['length'];_0x3c180a<_0x54b9a9;_0x3c180a++){var _0x2d7c50=events[_0x3c180a];var _0xc36829=createListener('faxQueue:'+_0x2d7c50,_0x25bbb3);FaxQueueEvents['on'](_0x2d7c50,_0xc36829);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 072c268..1dba6c6 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 _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x4b2fb5,_0x4d4120){var _0x2fd394=function(_0x4da0c9){while(--_0x4da0c9){_0x4b2fb5['push'](_0x4b2fb5['shift']());}};_0x2fd394(++_0x4d4120);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file +var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x2b76dc,_0x3ddb93){var _0x4ee7eb=function(_0x199bcd){while(--_0x199bcd){_0x2b76dc['push'](_0x2b76dc['shift']());}};_0x4ee7eb(++_0x3ddb93);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index a02725d..212020c 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 _0xbd8e=['STRING','DATE','moment','exports'];(function(_0x1ac6e5,_0x40f47f){var _0x5877dc=function(_0x99caea){while(--_0x99caea){_0x1ac6e5['push'](_0x1ac6e5['shift']());}};_0x5877dc(++_0x40f47f);}(_0xbd8e,0x15a));var _0xebd8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbd8e[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require(_0xebd8('0x0'));var Sequelize=require('sequelize');module[_0xebd8('0x1')]={'uniqueid':{'type':Sequelize[_0xebd8('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xebd8('0x3')]},'acceptAt':{'type':Sequelize[_0xebd8('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8c93=['exports','STRING','DATE','sequelize'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x8c93,0x6b));var _0x38c9=function(_0x332dca,_0x2f5ce5){_0x332dca=_0x332dca-0x0;var _0x40fcae=_0x8c93[_0x332dca];return _0x40fcae;};'use strict';var moment=require('moment');var Sequelize=require(_0x38c9('0x0'));module[_0x38c9('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x38c9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x38c9('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x38c9('0x3')]},'reason':{'type':Sequelize[_0x38c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index dd1f357..e8b520e 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 _0xa5d6=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','FaxQueueReport','findAll','rows','catch','create','body','find','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection'];(function(_0x2f3dc4,_0x3b81fe){var _0x6588fb=function(_0x5bed64){while(--_0x5bed64){_0x2f3dc4['push'](_0x2f3dc4['shift']());}};_0x6588fb(++_0x3b81fe);}(_0xa5d6,0x1d5));var _0x6a5d=function(_0x3865e4,_0x6a1cd7){_0x3865e4=_0x3865e4-0x0;var _0x1ec05e=_0xa5d6[_0x3865e4];return _0x1ec05e;};'use strict';var pdf=require(_0x6a5d('0x0'));var emlformat=require(_0x6a5d('0x1'));var rimraf=require(_0x6a5d('0x2'));var zipdir=require(_0x6a5d('0x3'));var jsonpatch=require(_0x6a5d('0x4'));var rp=require(_0x6a5d('0x5'));var moment=require('moment');var BPromise=require(_0x6a5d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6a5d('0x7'));var sox=require('sox');var csv=require(_0x6a5d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6a5d('0x9'));var crypto=require(_0x6a5d('0xa'));var jsforce=require(_0x6a5d('0xb'));var deskjs=require(_0x6a5d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6a5d('0xd'));var Redis=require(_0x6a5d('0xe'));var authService=require(_0x6a5d('0xf'));var qs=require(_0x6a5d('0x10'));var as=require(_0x6a5d('0x11'));var hardwareService=require(_0x6a5d('0x12'));var logger=require(_0x6a5d('0x13'))(_0x6a5d('0x14'));var utils=require(_0x6a5d('0x15'));var config=require('../../config/environment');var db=require(_0x6a5d('0x16'))['db'];function respondWithStatusCode(_0x2256d2,_0x460af2){_0x460af2=_0x460af2||0xcc;return function(_0x172748){if(_0x172748){return _0x2256d2[_0x6a5d('0x17')](_0x460af2);}return _0x2256d2[_0x6a5d('0x18')](_0x460af2)['end']();};}function respondWithResult(_0x454bbf,_0x22ed55){_0x22ed55=_0x22ed55||0xc8;return function(_0x58a4b3){if(_0x58a4b3){return _0x454bbf[_0x6a5d('0x18')](_0x22ed55)['json'](_0x58a4b3);}};}function respondWithFilteredResult(_0xa0479,_0x29547d){return function(_0x4d3991){if(_0x4d3991){var _0x5bfa26=_0x4d3991[_0x6a5d('0x19')],_0x470d31=_0x29547d[_0x6a5d('0x1a')],_0x566333=_0x29547d['offset']+_0x29547d[_0x6a5d('0x1b')],_0x43f0e8;if(_0x566333>=_0x5bfa26){_0x566333=_0x5bfa26;_0x43f0e8=0xc8;}else{_0x43f0e8=0xce;}_0xa0479[_0x6a5d('0x18')](_0x43f0e8);return _0xa0479[_0x6a5d('0x1c')](_0x6a5d('0x1d'),_0x470d31+'-'+_0x566333+'/'+_0x5bfa26)[_0x6a5d('0x1e')](_0x4d3991);}return null;};}function patchUpdates(_0x111ebf){return function(_0x421302){try{jsonpatch[_0x6a5d('0x1f')](_0x421302,_0x111ebf,!![]);}catch(_0x36bb5e){return BPromise['reject'](_0x36bb5e);}return _0x421302[_0x6a5d('0x20')]();};}function saveUpdates(_0x2a35d2,_0x2fe5c7){return function(_0x2771ef){if(_0x2771ef){return _0x2771ef[_0x6a5d('0x21')](_0x2a35d2)[_0x6a5d('0x22')](function(_0x271b51){return _0x271b51;});}return null;};}function removeEntity(_0x21a5a1,_0x4675b9){return function(_0x3b12c4){if(_0x3b12c4){return _0x3b12c4['destroy']()[_0x6a5d('0x22')](function(){_0x21a5a1[_0x6a5d('0x18')](0xcc)[_0x6a5d('0x23')]();});}};}function handleEntityNotFound(_0x493796,_0x3ba965){return function(_0x3ca973){if(!_0x3ca973){_0x493796[_0x6a5d('0x17')](0x194);}return _0x3ca973;};}function handleError(_0xb84604,_0x58eaab){_0x58eaab=_0x58eaab||0x1f4;return function(_0x173522){logger['error'](_0x173522[_0x6a5d('0x24')]);if(_0x173522['name']){delete _0x173522[_0x6a5d('0x25')];}_0xb84604[_0x6a5d('0x18')](_0x58eaab)[_0x6a5d('0x26')](_0x173522);};}exports[_0x6a5d('0x27')]=function(_0x123827,_0x6f1a09){var _0x47b4b5={},_0x2de4c5={},_0x500563={'count':0x0,'rows':[]};var _0x25b9d1=_[_0x6a5d('0x28')](db['FaxQueueReport'][_0x6a5d('0x29')],function(_0x39f970){return{'name':_0x39f970[_0x6a5d('0x2a')],'type':_0x39f970[_0x6a5d('0x2b')][_0x6a5d('0x2c')]};});_0x2de4c5[_0x6a5d('0x2d')]=_[_0x6a5d('0x28')](_0x25b9d1,_0x6a5d('0x25'));_0x2de4c5[_0x6a5d('0x2e')]=_[_0x6a5d('0x2f')](_0x123827[_0x6a5d('0x2e')]);_0x2de4c5['filters']=_[_0x6a5d('0x30')](_0x2de4c5[_0x6a5d('0x2d')],_0x2de4c5[_0x6a5d('0x2e')]);_0x47b4b5[_0x6a5d('0x31')]=_[_0x6a5d('0x30')](_0x2de4c5[_0x6a5d('0x2d')],qs[_0x6a5d('0x32')](_0x123827[_0x6a5d('0x2e')]['fields']));_0x47b4b5[_0x6a5d('0x31')]=_0x47b4b5[_0x6a5d('0x31')][_0x6a5d('0x33')]?_0x47b4b5[_0x6a5d('0x31')]:_0x2de4c5['model'];if(!_0x123827['query'][_0x6a5d('0x34')](_0x6a5d('0x35'))){_0x47b4b5[_0x6a5d('0x1b')]=qs[_0x6a5d('0x1b')](_0x123827['query'][_0x6a5d('0x1b')]);_0x47b4b5[_0x6a5d('0x1a')]=qs['offset'](_0x123827[_0x6a5d('0x2e')][_0x6a5d('0x1a')]);}_0x47b4b5['order']=qs[_0x6a5d('0x36')](_0x123827[_0x6a5d('0x2e')][_0x6a5d('0x36')]);_0x47b4b5[_0x6a5d('0x37')]=qs['filters'](_[_0x6a5d('0x38')](_0x123827[_0x6a5d('0x2e')],_0x2de4c5[_0x6a5d('0x39')]),_0x25b9d1);if(_0x123827[_0x6a5d('0x2e')][_0x6a5d('0x3a')]){_0x47b4b5[_0x6a5d('0x37')]=_['merge'](_0x47b4b5[_0x6a5d('0x37')],{'$or':_[_0x6a5d('0x28')](_0x25b9d1,function(_0x588fec){if(_0x588fec[_0x6a5d('0x2b')]!==_0x6a5d('0x3b')){var _0x2ad7ab={};_0x2ad7ab[_0x588fec[_0x6a5d('0x25')]]={'$like':'%'+_0x123827[_0x6a5d('0x2e')][_0x6a5d('0x3a')]+'%'};return _0x2ad7ab;}})});}_0x47b4b5=_[_0x6a5d('0x3c')]({},_0x47b4b5,_0x123827[_0x6a5d('0x3d')]);var _0x2be23b={'where':_0x47b4b5[_0x6a5d('0x37')]};return db['FaxQueueReport'][_0x6a5d('0x19')](_0x2be23b)['then'](function(_0x305af8){_0x500563[_0x6a5d('0x19')]=_0x305af8;if(_0x123827[_0x6a5d('0x2e')][_0x6a5d('0x3e')]){_0x47b4b5[_0x6a5d('0x3f')]=[{'all':!![]}];}return db[_0x6a5d('0x40')][_0x6a5d('0x41')](_0x47b4b5);})[_0x6a5d('0x22')](function(_0x401ae7){_0x500563[_0x6a5d('0x42')]=_0x401ae7;return _0x500563;})['then'](respondWithFilteredResult(_0x6f1a09,_0x47b4b5))[_0x6a5d('0x43')](handleError(_0x6f1a09,null));};exports['show']=function(_0x2778b7,_0x26c446){var _0x75d62c={'raw':!![],'where':{'id':_0x2778b7['params']['id']}},_0x2289be={};_0x2289be[_0x6a5d('0x2d')]=_['keys'](db[_0x6a5d('0x40')]['rawAttributes']);_0x2289be[_0x6a5d('0x2e')]=_[_0x6a5d('0x2f')](_0x2778b7[_0x6a5d('0x2e')]);_0x2289be[_0x6a5d('0x39')]=_[_0x6a5d('0x30')](_0x2289be['model'],_0x2289be[_0x6a5d('0x2e')]);_0x75d62c[_0x6a5d('0x31')]=_[_0x6a5d('0x30')](_0x2289be[_0x6a5d('0x2d')],qs[_0x6a5d('0x32')](_0x2778b7[_0x6a5d('0x2e')]['fields']));_0x75d62c[_0x6a5d('0x31')]=_0x75d62c[_0x6a5d('0x31')][_0x6a5d('0x33')]?_0x75d62c[_0x6a5d('0x31')]:_0x2289be[_0x6a5d('0x2d')];if(_0x2778b7[_0x6a5d('0x2e')][_0x6a5d('0x3e')]){_0x75d62c['include']=[{'all':!![]}];}_0x75d62c=_[_0x6a5d('0x3c')]({},_0x75d62c,_0x2778b7[_0x6a5d('0x3d')]);return db[_0x6a5d('0x40')]['find'](_0x75d62c)[_0x6a5d('0x22')](handleEntityNotFound(_0x26c446,null))[_0x6a5d('0x22')](respondWithResult(_0x26c446,null))[_0x6a5d('0x43')](handleError(_0x26c446,null));};exports[_0x6a5d('0x44')]=function(_0x4afa59,_0x1cfe64){return db[_0x6a5d('0x40')][_0x6a5d('0x44')](_0x4afa59[_0x6a5d('0x45')],{})[_0x6a5d('0x22')](respondWithResult(_0x1cfe64,0xc9))[_0x6a5d('0x43')](handleError(_0x1cfe64,null));};exports[_0x6a5d('0x21')]=function(_0x36af03,_0x255260){if(_0x36af03['body']['id']){delete _0x36af03[_0x6a5d('0x45')]['id'];}return db['FaxQueueReport'][_0x6a5d('0x46')]({'where':{'id':_0x36af03[_0x6a5d('0x47')]['id']}})[_0x6a5d('0x22')](handleEntityNotFound(_0x255260,null))['then'](saveUpdates(_0x36af03[_0x6a5d('0x45')],null))[_0x6a5d('0x22')](respondWithResult(_0x255260,null))[_0x6a5d('0x43')](handleError(_0x255260,null));};exports[_0x6a5d('0x48')]=function(_0x23d296,_0x58d883){return db[_0x6a5d('0x40')][_0x6a5d('0x46')]({'where':{'id':_0x23d296[_0x6a5d('0x47')]['id']}})['then'](handleEntityNotFound(_0x58d883,null))[_0x6a5d('0x22')](removeEntity(_0x58d883,null))[_0x6a5d('0x43')](handleError(_0x58d883,null));};exports[_0x6a5d('0x49')]=function(_0x5dcd6e,_0x4690d7){return db['FaxQueueReport'][_0x6a5d('0x49')]()[_0x6a5d('0x22')](respondWithResult(_0x4690d7,null))[_0x6a5d('0x43')](handleError(_0x4690d7,null));}; \ No newline at end of file +var _0x3b78=['rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueueReport','rows','show','params','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b78,0xb4));var _0x83b7=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0x3b78[_0x1e5068];return _0x2230b6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x83b7('0x0'));var rimraf=require(_0x83b7('0x1'));var zipdir=require(_0x83b7('0x2'));var jsonpatch=require(_0x83b7('0x3'));var rp=require(_0x83b7('0x4'));var moment=require('moment');var BPromise=require(_0x83b7('0x5'));var Mustache=require(_0x83b7('0x6'));var util=require('util');var path=require(_0x83b7('0x7'));var sox=require(_0x83b7('0x8'));var csv=require('to-csv');var ejs=require(_0x83b7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x83b7('0xa'));var crypto=require(_0x83b7('0xb'));var jsforce=require(_0x83b7('0xc'));var deskjs=require(_0x83b7('0xd'));var toCsv=require(_0x83b7('0xe'));var querystring=require(_0x83b7('0xf'));var Papa=require('papaparse');var Redis=require(_0x83b7('0x10'));var authService=require(_0x83b7('0x11'));var qs=require(_0x83b7('0x12'));var as=require(_0x83b7('0x13'));var hardwareService=require(_0x83b7('0x14'));var logger=require(_0x83b7('0x15'))(_0x83b7('0x16'));var utils=require(_0x83b7('0x17'));var config=require(_0x83b7('0x18'));var db=require(_0x83b7('0x19'))['db'];function respondWithStatusCode(_0x39ddb4,_0x12c91e){_0x12c91e=_0x12c91e||0xcc;return function(_0x488f18){if(_0x488f18){return _0x39ddb4[_0x83b7('0x1a')](_0x12c91e);}return _0x39ddb4['status'](_0x12c91e)[_0x83b7('0x1b')]();};}function respondWithResult(_0x13f5e5,_0x1aa694){_0x1aa694=_0x1aa694||0xc8;return function(_0x2afe83){if(_0x2afe83){return _0x13f5e5[_0x83b7('0x1c')](_0x1aa694)['json'](_0x2afe83);}};}function respondWithFilteredResult(_0x357a7a,_0x4852e1){return function(_0x412450){if(_0x412450){var _0x4eade7=_0x412450[_0x83b7('0x1d')],_0x4ae525=_0x4852e1[_0x83b7('0x1e')],_0x9595e4=_0x4852e1[_0x83b7('0x1e')]+_0x4852e1[_0x83b7('0x1f')],_0x3af149;if(_0x9595e4>=_0x4eade7){_0x9595e4=_0x4eade7;_0x3af149=0xc8;}else{_0x3af149=0xce;}_0x357a7a[_0x83b7('0x1c')](_0x3af149);return _0x357a7a[_0x83b7('0x20')](_0x83b7('0x21'),_0x4ae525+'-'+_0x9595e4+'/'+_0x4eade7)['json'](_0x412450);}return null;};}function patchUpdates(_0x5620f7){return function(_0xf9df09){try{jsonpatch[_0x83b7('0x22')](_0xf9df09,_0x5620f7,!![]);}catch(_0x4a23ac){return BPromise[_0x83b7('0x23')](_0x4a23ac);}return _0xf9df09['save']();};}function saveUpdates(_0x384fde,_0x5e0557){return function(_0x1ddcce){if(_0x1ddcce){return _0x1ddcce[_0x83b7('0x24')](_0x384fde)[_0x83b7('0x25')](function(_0x410b83){return _0x410b83;});}return null;};}function removeEntity(_0x4439c8,_0x332944){return function(_0x397a23){if(_0x397a23){return _0x397a23['destroy']()[_0x83b7('0x25')](function(){_0x4439c8[_0x83b7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f37a9,_0x4453b5){return function(_0x44a853){if(!_0x44a853){_0x1f37a9['sendStatus'](0x194);}return _0x44a853;};}function handleError(_0x312bbd,_0x79d732){_0x79d732=_0x79d732||0x1f4;return function(_0xa94d25){logger[_0x83b7('0x26')](_0xa94d25[_0x83b7('0x27')]);if(_0xa94d25[_0x83b7('0x28')]){delete _0xa94d25['name'];}_0x312bbd[_0x83b7('0x1c')](_0x79d732)['send'](_0xa94d25);};}exports['index']=function(_0x2ac00f,_0x238f53){var _0x46f0b0={},_0x37f8ab={},_0x4615cc={'count':0x0,'rows':[]};var _0x48c088=_[_0x83b7('0x29')](db['FaxQueueReport'][_0x83b7('0x2a')],function(_0x5bbfe6){return{'name':_0x5bbfe6['fieldName'],'type':_0x5bbfe6[_0x83b7('0x2b')][_0x83b7('0x2c')]};});_0x37f8ab[_0x83b7('0x2d')]=_[_0x83b7('0x29')](_0x48c088,_0x83b7('0x28'));_0x37f8ab['query']=_[_0x83b7('0x2e')](_0x2ac00f[_0x83b7('0x2f')]);_0x37f8ab[_0x83b7('0x30')]=_[_0x83b7('0x31')](_0x37f8ab[_0x83b7('0x2d')],_0x37f8ab[_0x83b7('0x2f')]);_0x46f0b0[_0x83b7('0x32')]=_[_0x83b7('0x31')](_0x37f8ab[_0x83b7('0x2d')],qs[_0x83b7('0x33')](_0x2ac00f[_0x83b7('0x2f')][_0x83b7('0x33')]));_0x46f0b0['attributes']=_0x46f0b0[_0x83b7('0x32')][_0x83b7('0x34')]?_0x46f0b0[_0x83b7('0x32')]:_0x37f8ab[_0x83b7('0x2d')];if(!_0x2ac00f[_0x83b7('0x2f')][_0x83b7('0x35')](_0x83b7('0x36'))){_0x46f0b0[_0x83b7('0x1f')]=qs[_0x83b7('0x1f')](_0x2ac00f[_0x83b7('0x2f')][_0x83b7('0x1f')]);_0x46f0b0['offset']=qs[_0x83b7('0x1e')](_0x2ac00f[_0x83b7('0x2f')]['offset']);}_0x46f0b0[_0x83b7('0x37')]=qs['sort'](_0x2ac00f[_0x83b7('0x2f')][_0x83b7('0x38')]);_0x46f0b0[_0x83b7('0x39')]=qs[_0x83b7('0x30')](_[_0x83b7('0x3a')](_0x2ac00f[_0x83b7('0x2f')],_0x37f8ab[_0x83b7('0x30')]),_0x48c088);if(_0x2ac00f[_0x83b7('0x2f')][_0x83b7('0x3b')]){_0x46f0b0[_0x83b7('0x39')]=_[_0x83b7('0x3c')](_0x46f0b0[_0x83b7('0x39')],{'$or':_[_0x83b7('0x29')](_0x48c088,function(_0x4ae1ff){if(_0x4ae1ff[_0x83b7('0x2b')]!==_0x83b7('0x3d')){var _0x3b839f={};_0x3b839f[_0x4ae1ff['name']]={'$like':'%'+_0x2ac00f[_0x83b7('0x2f')][_0x83b7('0x3b')]+'%'};return _0x3b839f;}})});}_0x46f0b0=_[_0x83b7('0x3c')]({},_0x46f0b0,_0x2ac00f[_0x83b7('0x3e')]);var _0x1a0da8={'where':_0x46f0b0[_0x83b7('0x39')]};return db[_0x83b7('0x3f')][_0x83b7('0x1d')](_0x1a0da8)[_0x83b7('0x25')](function(_0x438e6a){_0x4615cc[_0x83b7('0x1d')]=_0x438e6a;if(_0x2ac00f['query']['includeAll']){_0x46f0b0['include']=[{'all':!![]}];}return db[_0x83b7('0x3f')]['findAll'](_0x46f0b0);})[_0x83b7('0x25')](function(_0x5c9181){_0x4615cc[_0x83b7('0x40')]=_0x5c9181;return _0x4615cc;})[_0x83b7('0x25')](respondWithFilteredResult(_0x238f53,_0x46f0b0))['catch'](handleError(_0x238f53,null));};exports[_0x83b7('0x41')]=function(_0xede644,_0x50951e){var _0x581870={'raw':!![],'where':{'id':_0xede644[_0x83b7('0x42')]['id']}},_0x1fdeb2={};_0x1fdeb2[_0x83b7('0x2d')]=_['keys'](db[_0x83b7('0x3f')][_0x83b7('0x2a')]);_0x1fdeb2[_0x83b7('0x2f')]=_[_0x83b7('0x2e')](_0xede644[_0x83b7('0x2f')]);_0x1fdeb2[_0x83b7('0x30')]=_[_0x83b7('0x31')](_0x1fdeb2['model'],_0x1fdeb2[_0x83b7('0x2f')]);_0x581870[_0x83b7('0x32')]=_[_0x83b7('0x31')](_0x1fdeb2[_0x83b7('0x2d')],qs['fields'](_0xede644[_0x83b7('0x2f')][_0x83b7('0x33')]));_0x581870['attributes']=_0x581870[_0x83b7('0x32')][_0x83b7('0x34')]?_0x581870[_0x83b7('0x32')]:_0x1fdeb2[_0x83b7('0x2d')];if(_0xede644[_0x83b7('0x2f')]['includeAll']){_0x581870[_0x83b7('0x43')]=[{'all':!![]}];}_0x581870=_['merge']({},_0x581870,_0xede644[_0x83b7('0x3e')]);return db['FaxQueueReport'][_0x83b7('0x44')](_0x581870)[_0x83b7('0x25')](handleEntityNotFound(_0x50951e,null))['then'](respondWithResult(_0x50951e,null))[_0x83b7('0x45')](handleError(_0x50951e,null));};exports[_0x83b7('0x46')]=function(_0x13020d,_0x5cd89a){return db[_0x83b7('0x3f')][_0x83b7('0x46')](_0x13020d[_0x83b7('0x47')],{})[_0x83b7('0x25')](respondWithResult(_0x5cd89a,0xc9))[_0x83b7('0x45')](handleError(_0x5cd89a,null));};exports[_0x83b7('0x24')]=function(_0x377ac4,_0x20f61e){if(_0x377ac4['body']['id']){delete _0x377ac4['body']['id'];}return db['FaxQueueReport'][_0x83b7('0x44')]({'where':{'id':_0x377ac4[_0x83b7('0x42')]['id']}})[_0x83b7('0x25')](handleEntityNotFound(_0x20f61e,null))[_0x83b7('0x25')](saveUpdates(_0x377ac4[_0x83b7('0x47')],null))[_0x83b7('0x25')](respondWithResult(_0x20f61e,null))[_0x83b7('0x45')](handleError(_0x20f61e,null));};exports[_0x83b7('0x48')]=function(_0x4e3165,_0x50e7f1){return db['FaxQueueReport'][_0x83b7('0x44')]({'where':{'id':_0x4e3165[_0x83b7('0x42')]['id']}})[_0x83b7('0x25')](handleEntityNotFound(_0x50e7f1,null))[_0x83b7('0x25')](removeEntity(_0x50e7f1,null))[_0x83b7('0x45')](handleError(_0x50e7f1,null));};exports[_0x83b7('0x49')]=function(_0x4a7cd4,_0x577815){return db[_0x83b7('0x3f')][_0x83b7('0x49')]()[_0x83b7('0x25')](respondWithResult(_0x577815,null))[_0x83b7('0x45')](handleError(_0x577815,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 6f47f41..c3918c3 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 _0x229c=['util','moment','path','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid'];(function(_0x367598,_0x234902){var _0xc85f35=function(_0x1d6e28){while(--_0x1d6e28){_0x367598['push'](_0x367598['shift']());}};_0xc85f35(++_0x234902);}(_0x229c,0xcf));var _0xc229=function(_0x3d44e7,_0x1b0cea){_0x3d44e7=_0x3d44e7-0x0;var _0x15e490=_0x229c[_0x3d44e7];return _0x15e490;};'use strict';var _=require('lodash');var util=require(_0xc229('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc229('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc229('0x2'));var rimraf=require('rimraf');var config=require(_0xc229('0x3'));var attributes=require(_0xc229('0x4'));module[_0xc229('0x5')]=function(_0x5a0d2c,_0x44aba3){return _0x5a0d2c['define'](_0xc229('0x6'),attributes,{'tableName':_0xc229('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc229('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50a5=['lodash','util','request-promise','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid'];(function(_0x545573,_0x17d098){var _0x47aed9=function(_0x339359){while(--_0x339359){_0x545573['push'](_0x545573['shift']());}};_0x47aed9(++_0x17d098);}(_0x50a5,0xd1));var _0x550a=function(_0x32d719,_0x49837a){_0x32d719=_0x32d719-0x0;var _0x7e45fd=_0x50a5[_0x32d719];return _0x7e45fd;};'use strict';var _=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x550a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x550a('0x3'));var config=require(_0x550a('0x4'));var attributes=require(_0x550a('0x5'));module[_0x550a('0x6')]=function(_0x402f66,_0x3b3c29){return _0x402f66[_0x550a('0x7')](_0x550a('0x8'),attributes,{'tableName':_0x550a('0x9'),'paranoid':![],'indexes':[{'name':_0x550a('0xa'),'fields':[_0x550a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index ed0dbf3..ff4ad53 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 _0x5ced=['UpdateFaxQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','FaxQueueReport,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateFaxQueueReport','FaxQueueReport','options','raw','debug'];(function(_0x415626,_0xf346d4){var _0x5c05a7=function(_0x250f02){while(--_0x250f02){_0x415626['push'](_0x415626['shift']());}};_0x5c05a7(++_0xf346d4);}(_0x5ced,0xb3));var _0xd5ce=function(_0xc74297,_0x246db4){_0xc74297=_0xc74297-0x0;var _0x1ea354=_0x5ced[_0xc74297];return _0x1ea354;};'use strict';var _=require('lodash');var util=require(_0xd5ce('0x0'));var moment=require(_0xd5ce('0x1'));var BPromise=require(_0xd5ce('0x2'));var rs=require(_0xd5ce('0x3'));var fs=require('fs');var Redis=require(_0xd5ce('0x4'));var db=require(_0xd5ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd5ce('0x6'))(_0xd5ce('0x7'));var config=require(_0xd5ce('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3acc20,_0x1b3a7c,_0x40633b){return new BPromise(function(_0x49f9eb,_0x4f58b0){return client[_0xd5ce('0x9')](_0x3acc20,_0x40633b)[_0xd5ce('0xa')](function(_0x3259eb){logger[_0xd5ce('0xb')](_0xd5ce('0xc'),_0x1b3a7c,'request\x20sent');logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1b3a7c,'request\x20sent',JSON[_0xd5ce('0xd')](_0x3259eb));if(_0x3259eb['error']){if(_0x3259eb[_0xd5ce('0xe')][_0xd5ce('0xf')]===0x1f4){logger[_0xd5ce('0xe')](_0xd5ce('0xc'),_0x1b3a7c,_0x3259eb[_0xd5ce('0xe')][_0xd5ce('0x10')]);return _0x4f58b0(_0x3259eb[_0xd5ce('0xe')][_0xd5ce('0x10')]);}logger[_0xd5ce('0xe')](_0xd5ce('0xc'),_0x1b3a7c,_0x3259eb['error']['message']);return _0x49f9eb(_0x3259eb[_0xd5ce('0xe')][_0xd5ce('0x10')]);}else{logger[_0xd5ce('0xb')](_0xd5ce('0xc'),_0x1b3a7c,_0xd5ce('0x11'));_0x49f9eb(_0x3259eb[_0xd5ce('0x12')][_0xd5ce('0x10')]);}})['catch'](function(_0x28afb9){logger[_0xd5ce('0xe')](_0xd5ce('0xc'),_0x1b3a7c,_0x28afb9);_0x4f58b0(_0x28afb9);});});}exports[_0xd5ce('0x13')]=function(_0x51c99c){var _0x223809=this;return new Promise(function(_0x1f1974,_0x159187){return db[_0xd5ce('0x14')]['create'](_0x51c99c['body'],{'raw':_0x51c99c[_0xd5ce('0x15')]?_0x51c99c['options'][_0xd5ce('0x16')]===undefined?!![]:![]:!![]})[_0xd5ce('0xa')](function(_0x5a088f){logger[_0xd5ce('0xb')](_0xd5ce('0x13'),_0x51c99c);logger[_0xd5ce('0x17')]('CreateFaxQueueReport',_0x51c99c,JSON[_0xd5ce('0xd')](_0x5a088f));_0x1f1974(_0x5a088f);})['catch'](function(_0x2d0c6c){logger[_0xd5ce('0xe')]('CreateFaxQueueReport',_0x2d0c6c[_0xd5ce('0x10')],_0x51c99c);_0x159187(_0x223809[_0xd5ce('0xe')](0x1f4,_0x2d0c6c[_0xd5ce('0x10')]));});});};exports[_0xd5ce('0x18')]=function(_0x14a5a4){var _0x57f46b=this;return new Promise(function(_0x2ef619,_0x3bbcff){return db[_0xd5ce('0x14')][_0xd5ce('0x19')](_0x14a5a4['body'],{'raw':_0x14a5a4[_0xd5ce('0x15')]?_0x14a5a4[_0xd5ce('0x15')][_0xd5ce('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14a5a4[_0xd5ce('0x15')]?_0x14a5a4['options'][_0xd5ce('0x1a')]||null:null,'attributes':_0x14a5a4[_0xd5ce('0x15')]?_0x14a5a4['options'][_0xd5ce('0x1b')]||null:null,'limit':_0x14a5a4[_0xd5ce('0x15')]?_0x14a5a4[_0xd5ce('0x15')][_0xd5ce('0x1c')]||null:null})[_0xd5ce('0xa')](function(_0x524ceb){logger[_0xd5ce('0xb')]('UpdateFaxQueueReport',_0x14a5a4);logger[_0xd5ce('0x17')]('UpdateFaxQueueReport',_0x14a5a4,JSON[_0xd5ce('0xd')](_0x524ceb));_0x2ef619(_0x524ceb);})['catch'](function(_0x26b9ec){logger[_0xd5ce('0xe')](_0xd5ce('0x18'),_0x26b9ec[_0xd5ce('0x10')],_0x14a5a4);_0x3bbcff(_0x57f46b['error'](0x1f4,_0x26b9ec['message']));});});}; \ No newline at end of file +var _0xf0d9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','create','body','then','UpdateFaxQueueReport','FaxQueueReport','options','raw','where','attributes','limit','util','moment','bluebird','randomstring'];(function(_0x38e1b3,_0x485a69){var _0x42cdcd=function(_0x362b64){while(--_0x362b64){_0x38e1b3['push'](_0x38e1b3['shift']());}};_0x42cdcd(++_0x485a69);}(_0xf0d9,0x1ae));var _0x9f0d=function(_0x504487,_0x2835f0){_0x504487=_0x504487-0x0;var _0x35f823=_0xf0d9[_0x504487];return _0x35f823;};'use strict';var _=require('lodash');var util=require(_0x9f0d('0x0'));var moment=require(_0x9f0d('0x1'));var BPromise=require(_0x9f0d('0x2'));var rs=require(_0x9f0d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f0d('0x4'))['db'];var utils=require(_0x9f0d('0x5'));var logger=require(_0x9f0d('0x6'))(_0x9f0d('0x7'));var config=require(_0x9f0d('0x8'));var jayson=require(_0x9f0d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dcfce,_0x117303,_0x107d83){return new BPromise(function(_0x2e7976,_0x25a8a1){return client['request'](_0x4dcfce,_0x107d83)['then'](function(_0x1d8eb7){logger[_0x9f0d('0xa')](_0x9f0d('0xb'),_0x117303,'request\x20sent');logger[_0x9f0d('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x117303,_0x9f0d('0xd'),JSON[_0x9f0d('0xe')](_0x1d8eb7));if(_0x1d8eb7['error']){if(_0x1d8eb7[_0x9f0d('0xf')][_0x9f0d('0x10')]===0x1f4){logger[_0x9f0d('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x117303,_0x1d8eb7[_0x9f0d('0xf')][_0x9f0d('0x11')]);return _0x25a8a1(_0x1d8eb7['error']['message']);}logger[_0x9f0d('0xf')](_0x9f0d('0xb'),_0x117303,_0x1d8eb7[_0x9f0d('0xf')][_0x9f0d('0x11')]);return _0x2e7976(_0x1d8eb7[_0x9f0d('0xf')]['message']);}else{logger['info'](_0x9f0d('0xb'),_0x117303,_0x9f0d('0xd'));_0x2e7976(_0x1d8eb7[_0x9f0d('0x12')][_0x9f0d('0x11')]);}})[_0x9f0d('0x13')](function(_0x28ee1b){logger['error'](_0x9f0d('0xb'),_0x117303,_0x28ee1b);_0x25a8a1(_0x28ee1b);});});}exports[_0x9f0d('0x14')]=function(_0x33933c){var _0xe8bca4=this;return new Promise(function(_0x3d680e,_0x3c19b7){return db['FaxQueueReport'][_0x9f0d('0x15')](_0x33933c[_0x9f0d('0x16')],{'raw':_0x33933c['options']?_0x33933c['options']['raw']===undefined?!![]:![]:!![]})[_0x9f0d('0x17')](function(_0x234ac4){logger['info'](_0x9f0d('0x14'),_0x33933c);logger[_0x9f0d('0xc')](_0x9f0d('0x14'),_0x33933c,JSON[_0x9f0d('0xe')](_0x234ac4));_0x3d680e(_0x234ac4);})[_0x9f0d('0x13')](function(_0xb67346){logger[_0x9f0d('0xf')](_0x9f0d('0x14'),_0xb67346[_0x9f0d('0x11')],_0x33933c);_0x3c19b7(_0xe8bca4[_0x9f0d('0xf')](0x1f4,_0xb67346['message']));});});};exports[_0x9f0d('0x18')]=function(_0x2087a8){var _0x355597=this;return new Promise(function(_0x4e0610,_0xf4e15c){return db[_0x9f0d('0x19')]['update'](_0x2087a8[_0x9f0d('0x16')],{'raw':_0x2087a8[_0x9f0d('0x1a')]?_0x2087a8['options'][_0x9f0d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2087a8[_0x9f0d('0x1a')]?_0x2087a8[_0x9f0d('0x1a')][_0x9f0d('0x1c')]||null:null,'attributes':_0x2087a8['options']?_0x2087a8[_0x9f0d('0x1a')][_0x9f0d('0x1d')]||null:null,'limit':_0x2087a8[_0x9f0d('0x1a')]?_0x2087a8[_0x9f0d('0x1a')][_0x9f0d('0x1e')]||null:null})[_0x9f0d('0x17')](function(_0x1fdef6){logger['info'](_0x9f0d('0x18'),_0x2087a8);logger[_0x9f0d('0xc')](_0x9f0d('0x18'),_0x2087a8,JSON['stringify'](_0x1fdef6));_0x4e0610(_0x1fdef6);})[_0x9f0d('0x13')](function(_0x3ebbe7){logger['error'](_0x9f0d('0x18'),_0x3ebbe7[_0x9f0d('0x11')],_0x2087a8);_0xf4e15c(_0x355597['error'](0x1f4,_0x3ebbe7['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 952a6bc..ccc6a05 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 _0xa824=['post','create','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show'];(function(_0x483351,_0xb26b44){var _0x2f9d65=function(_0x4b88eb){while(--_0x4b88eb){_0x483351['push'](_0x483351['shift']());}};_0x2f9d65(++_0xb26b44);}(_0xa824,0x16e));var _0x4a82=function(_0xc205a4,_0x36b067){_0xc205a4=_0xc205a4-0x0;var _0xab679a=_0xa824[_0xc205a4];return _0xab679a;};'use strict';var multer=require(_0x4a82('0x0'));var util=require(_0x4a82('0x1'));var path=require(_0x4a82('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4a82('0x3')]();var auth=require(_0x4a82('0x4'));var interaction=require(_0x4a82('0x5'));var config=require(_0x4a82('0x6'));var controller=require('./faxQueueReport.controller');router[_0x4a82('0x7')]('/',auth[_0x4a82('0x8')](),controller['index']);router[_0x4a82('0x7')](_0x4a82('0x9'),auth[_0x4a82('0x8')](),controller['describe']);router[_0x4a82('0x7')](_0x4a82('0xa'),auth[_0x4a82('0x8')](),controller[_0x4a82('0xb')]);router[_0x4a82('0xc')]('/',auth[_0x4a82('0x8')](),controller[_0x4a82('0xd')]);router[_0x4a82('0xe')]('/:id',auth[_0x4a82('0x8')](),controller[_0x4a82('0xf')]);router[_0x4a82('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x4a82('0x11')]=router; \ No newline at end of file +var _0x9241=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0x9241,0x182));var _0x1924=function(_0x4f7404,_0x3ee924){_0x4f7404=_0x4f7404-0x0;var _0x4c4b76=_0x9241[_0x4f7404];return _0x4c4b76;};'use strict';var multer=require(_0x1924('0x0'));var util=require(_0x1924('0x1'));var path=require(_0x1924('0x2'));var timeout=require(_0x1924('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x1924('0x4'));var interaction=require(_0x1924('0x5'));var config=require(_0x1924('0x6'));var controller=require(_0x1924('0x7'));router[_0x1924('0x8')]('/',auth[_0x1924('0x9')](),controller[_0x1924('0xa')]);router['get'](_0x1924('0xb'),auth[_0x1924('0x9')](),controller[_0x1924('0xc')]);router[_0x1924('0x8')](_0x1924('0xd'),auth[_0x1924('0x9')](),controller[_0x1924('0xe')]);router[_0x1924('0xf')]('/',auth[_0x1924('0x9')](),controller[_0x1924('0x10')]);router[_0x1924('0x11')](_0x1924('0xd'),auth[_0x1924('0x9')](),controller[_0x1924('0x12')]);router[_0x1924('0x13')](_0x1924('0xd'),auth[_0x1924('0x9')](),controller[_0x1924('0x14')]);module[_0x1924('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c76322f..92b2af4 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 _0x7d07=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x289a04,_0x1e923b){var _0x2064bf=function(_0x311380){while(--_0x311380){_0x289a04['push'](_0x289a04['shift']());}};_0x2064bf(++_0x1e923b);}(_0x7d07,0x8e));var _0x77d0=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x7d07[_0x28611e];return _0x530f69;};'use strict';var moment=require('moment');var Sequelize=require(_0x77d0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x77d0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x77d0('0x2')](_0x77d0('0x3'),'agent','queue'),'allowNull':![],'defaultValue':_0x77d0('0x4')},'transferredAt':{'type':Sequelize[_0x77d0('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf2fe=['sequelize','account','agent','queue','DATE','NOW','moment'];(function(_0x114b03,_0x279d0c){var _0x5a7b18=function(_0x486e52){while(--_0x486e52){_0x114b03['push'](_0x114b03['shift']());}};_0x5a7b18(++_0x279d0c);}(_0xf2fe,0xc3));var _0xef2f=function(_0x31e9eb,_0x588a45){_0x31e9eb=_0x31e9eb-0x0;var _0x2215ee=_0xf2fe[_0x31e9eb];return _0x2215ee;};'use strict';var moment=require(_0xef2f('0x0'));var Sequelize=require(_0xef2f('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xef2f('0x2'),_0xef2f('0x3'),_0xef2f('0x4')),'allowNull':![],'defaultValue':_0xef2f('0x4')},'transferredAt':{'type':Sequelize[_0xef2f('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xef2f('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index d0bd5c0..13ecf1c 100644 --- a/server/api/faxTransferReport/faxTransferReport.controller.js +++ b/server/api/faxTransferReport/faxTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FaxTransferReport','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x585f2f,_0x4c9e6e){var _0x251072=function(_0x5e769e){while(--_0x5e769e){_0x585f2f['push'](_0x585f2f['shift']());}};_0x251072(++_0x4c9e6e);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];function respondWithStatusCode(_0x576875,_0x419819){_0x419819=_0x419819||0xcc;return function(_0x4862a5){if(_0x4862a5){return _0x576875[_0x65f6('0x14')](_0x419819);}return _0x576875[_0x65f6('0x15')](_0x419819)[_0x65f6('0x16')]();};}function respondWithResult(_0x217570,_0x369f96){_0x369f96=_0x369f96||0xc8;return function(_0x1d29fd){if(_0x1d29fd){return _0x217570[_0x65f6('0x15')](_0x369f96)[_0x65f6('0x17')](_0x1d29fd);}};}function respondWithFilteredResult(_0x46dbc6,_0x3440af){return function(_0x59154e){if(_0x59154e){var _0x19b9ff=_0x59154e[_0x65f6('0x18')],_0x49a913=_0x3440af[_0x65f6('0x19')],_0x5dd324=_0x3440af[_0x65f6('0x19')]+_0x3440af[_0x65f6('0x1a')],_0x1693e6;if(_0x5dd324>=_0x19b9ff){_0x5dd324=_0x19b9ff;_0x1693e6=0xc8;}else{_0x1693e6=0xce;}_0x46dbc6[_0x65f6('0x15')](_0x1693e6);return _0x46dbc6[_0x65f6('0x1b')](_0x65f6('0x1c'),_0x49a913+'-'+_0x5dd324+'/'+_0x19b9ff)['json'](_0x59154e);}return null;};}function patchUpdates(_0x4d79a1){return function(_0x2d538c){try{jsonpatch['apply'](_0x2d538c,_0x4d79a1,!![]);}catch(_0x4c81f3){return BPromise['reject'](_0x4c81f3);}return _0x2d538c[_0x65f6('0x1d')]();};}function saveUpdates(_0x21ea88,_0x5114a4){return function(_0x39e19f){if(_0x39e19f){return _0x39e19f[_0x65f6('0x1e')](_0x21ea88)[_0x65f6('0x1f')](function(_0x3876ed){return _0x3876ed;});}return null;};}function removeEntity(_0x219ab2,_0xc139c2){return function(_0x581374){if(_0x581374){return _0x581374[_0x65f6('0x20')]()['then'](function(){_0x219ab2['status'](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(!_0x1eeaaa){_0xd173f4[_0x65f6('0x14')](0x194);}return _0x1eeaaa;};}function handleError(_0x2317ce,_0x2774a1){_0x2774a1=_0x2774a1||0x1f4;return function(_0x4f5a69){logger[_0x65f6('0x21')](_0x4f5a69[_0x65f6('0x22')]);if(_0x4f5a69[_0x65f6('0x23')]){delete _0x4f5a69['name'];}_0x2317ce['status'](_0x2774a1)['send'](_0x4f5a69);};}exports[_0x65f6('0x24')]=function(_0x16cde8,_0x4b2292){var _0x296cd9={},_0x28f710={},_0x52277c={'count':0x0,'rows':[]};var _0x325cb4=_[_0x65f6('0x25')](db[_0x65f6('0x26')]['rawAttributes'],function(_0x4ac04b){return{'name':_0x4ac04b['fieldName'],'type':_0x4ac04b[_0x65f6('0x27')][_0x65f6('0x28')]};});_0x28f710[_0x65f6('0x29')]=_[_0x65f6('0x25')](_0x325cb4,_0x65f6('0x23'));_0x28f710[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x16cde8['query']);_0x28f710['filters']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],_0x28f710['query']);_0x296cd9['attributes']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0x296cd9[_0x65f6('0x2e')]=_0x296cd9['attributes'][_0x65f6('0x2f')]?_0x296cd9[_0x65f6('0x2e')]:_0x28f710[_0x65f6('0x29')];if(!_0x16cde8['query'][_0x65f6('0x30')](_0x65f6('0x31'))){_0x296cd9[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x1a')]);_0x296cd9['offset']=qs[_0x65f6('0x19')](_0x16cde8[_0x65f6('0x2a')]['offset']);}_0x296cd9[_0x65f6('0x32')]=qs['sort'](_0x16cde8[_0x65f6('0x2a')]['sort']);_0x296cd9[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_['pick'](_0x16cde8[_0x65f6('0x2a')],_0x28f710[_0x65f6('0x34')]),_0x325cb4);if(_0x16cde8[_0x65f6('0x2a')]['filter']){_0x296cd9['where']=_[_0x65f6('0x35')](_0x296cd9['where'],{'$or':_[_0x65f6('0x25')](_0x325cb4,function(_0x4e6653){if(_0x4e6653[_0x65f6('0x27')]!==_0x65f6('0x36')){var _0x5e97f1={};_0x5e97f1[_0x4e6653[_0x65f6('0x23')]]={'$like':'%'+_0x16cde8['query']['filter']+'%'};return _0x5e97f1;}})});}_0x296cd9=_[_0x65f6('0x35')]({},_0x296cd9,_0x16cde8[_0x65f6('0x37')]);var _0x413956={'where':_0x296cd9[_0x65f6('0x33')]};return db[_0x65f6('0x26')][_0x65f6('0x18')](_0x413956)[_0x65f6('0x1f')](function(_0x1153f1){_0x52277c['count']=_0x1153f1;if(_0x16cde8[_0x65f6('0x2a')]['includeAll']){_0x296cd9[_0x65f6('0x38')]=[{'all':!![]}];}return db[_0x65f6('0x26')][_0x65f6('0x39')](_0x296cd9);})[_0x65f6('0x1f')](function(_0x5ef5c2){_0x52277c[_0x65f6('0x3a')]=_0x5ef5c2;return _0x52277c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x4b2292,_0x296cd9))[_0x65f6('0x3b')](handleError(_0x4b2292,null));};exports[_0x65f6('0x3c')]=function(_0x81fd69,_0x3f6103){var _0xed4c96={'raw':!![],'where':{'id':_0x81fd69[_0x65f6('0x3d')]['id']}},_0x2acca5={};_0x2acca5['model']=_[_0x65f6('0x2b')](db[_0x65f6('0x26')][_0x65f6('0x3e')]);_0x2acca5[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x81fd69[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x34')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],_0x2acca5[_0x65f6('0x2a')]);_0xed4c96[_0x65f6('0x2e')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x81fd69[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0xed4c96['attributes']=_0xed4c96[_0x65f6('0x2e')][_0x65f6('0x2f')]?_0xed4c96[_0x65f6('0x2e')]:_0x2acca5[_0x65f6('0x29')];if(_0x81fd69['query'][_0x65f6('0x3f')]){_0xed4c96[_0x65f6('0x38')]=[{'all':!![]}];}_0xed4c96=_[_0x65f6('0x35')]({},_0xed4c96,_0x81fd69['options']);return db[_0x65f6('0x26')][_0x65f6('0x40')](_0xed4c96)[_0x65f6('0x1f')](handleEntityNotFound(_0x3f6103,null))[_0x65f6('0x1f')](respondWithResult(_0x3f6103,null))['catch'](handleError(_0x3f6103,null));};exports[_0x65f6('0x41')]=function(_0x512527,_0x3f1baa){return db[_0x65f6('0x26')]['create'](_0x512527[_0x65f6('0x42')],{})['then'](respondWithResult(_0x3f1baa,0xc9))[_0x65f6('0x3b')](handleError(_0x3f1baa,null));};exports[_0x65f6('0x1e')]=function(_0x2d1706,_0xc0db01){if(_0x2d1706[_0x65f6('0x42')]['id']){delete _0x2d1706[_0x65f6('0x42')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x2d1706[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x1f')](saveUpdates(_0x2d1706[_0x65f6('0x42')],null))[_0x65f6('0x1f')](respondWithResult(_0xc0db01,null))[_0x65f6('0x3b')](handleError(_0xc0db01,null));};exports[_0x65f6('0x20')]=function(_0x41690c,_0x414f49){return db['FaxTransferReport'][_0x65f6('0x40')]({'where':{'id':_0x41690c[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x414f49,null))['then'](removeEntity(_0x414f49,null))[_0x65f6('0x3b')](handleError(_0x414f49,null));};exports[_0x65f6('0x43')]=function(_0x49ba5a,_0x22d745){return db[_0x65f6('0x26')]['describe']()[_0x65f6('0x1f')](respondWithResult(_0x22d745,null))['catch'](handleError(_0x22d745,null));}; \ No newline at end of file +var _0x5f2f=['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','FaxTransferReport','then','include','rows','catch','show','params','intersection','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5f2f,0x73));var _0xf5f2=function(_0x200915,_0x57da6e){_0x200915=_0x200915-0x0;var _0x589ac1=_0x5f2f[_0x200915];return _0x589ac1;};'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['FaxTransferReport']['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')]),_0x198c73);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));};exports[_0xf5f2('0x41')]=function(_0x462ea3,_0x2083b3){var _0x574f24={'raw':!![],'where':{'id':_0x462ea3[_0xf5f2('0x42')]['id']}},_0x31c3c={};_0x31c3c[_0xf5f2('0x2f')]=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x31c3c[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x462ea3['query']);_0x31c3c[_0xf5f2('0x38')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],_0x31c3c[_0xf5f2('0x2d')]);_0x574f24[_0xf5f2('0x30')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x462ea3[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x574f24[_0xf5f2('0x30')]=_0x574f24[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x574f24[_0xf5f2('0x30')]:_0x31c3c['model'];if(_0x462ea3[_0xf5f2('0x2d')]['includeAll']){_0x574f24[_0xf5f2('0x3e')]=[{'all':!![]}];}_0x574f24=_[_0xf5f2('0x3a')]({},_0x574f24,_0x462ea3[_0xf5f2('0x44')]);return db[_0xf5f2('0x3c')][_0xf5f2('0x45')](_0x574f24)[_0xf5f2('0x3d')](handleEntityNotFound(_0x2083b3,null))['then'](respondWithResult(_0x2083b3,null))[_0xf5f2('0x40')](handleError(_0x2083b3,null));};exports[_0xf5f2('0x46')]=function(_0x1c1497,_0x29b108){return db[_0xf5f2('0x3c')][_0xf5f2('0x46')](_0x1c1497[_0xf5f2('0x47')],{})[_0xf5f2('0x3d')](respondWithResult(_0x29b108,0xc9))['catch'](handleError(_0x29b108,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x47')]['id'];}return db[_0xf5f2('0x3c')][_0xf5f2('0x45')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x3d')](saveUpdates(_0x33ec29[_0xf5f2('0x47')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x40')](handleError(_0x45db9a,null));};exports['destroy']=function(_0x740321,_0x497eb8){return db[_0xf5f2('0x3c')]['find']({'where':{'id':_0x740321[_0xf5f2('0x42')]['id']}})[_0xf5f2('0x3d')](handleEntityNotFound(_0x497eb8,null))[_0xf5f2('0x3d')](removeEntity(_0x497eb8,null))[_0xf5f2('0x40')](handleError(_0x497eb8,null));};exports['describe']=function(_0x3154c1,_0x2b782f){return db['FaxTransferReport']['describe']()[_0xf5f2('0x3d')](respondWithResult(_0x2b782f,null))[_0xf5f2('0x40')](handleError(_0x2b782f,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 882150a..92efd95 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 _0xe50e=['path','rimraf','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x51e268,_0x4bb0eb){var _0x308e36=function(_0x3e1523){while(--_0x3e1523){_0x51e268['push'](_0x51e268['shift']());}};_0x308e36(++_0x4bb0eb);}(_0xe50e,0x7e));var _0xee50=function(_0xbb447b,_0x3aed8e){_0xbb447b=_0xbb447b-0x0;var _0x510ffc=_0xe50e[_0xbb447b];return _0x510ffc;};'use strict';var _=require(_0xee50('0x0'));var util=require(_0xee50('0x1'));var logger=require(_0xee50('0x2'))('api');var moment=require('moment');var BPromise=require(_0xee50('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee50('0x4'));var rimraf=require(_0xee50('0x5'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0xf35af1,_0x3b24f7){return _0xf35af1[_0xee50('0x6')](_0xee50('0x7'),attributes,{'tableName':_0xee50('0x8'),'paranoid':![],'indexes':[{'name':_0xee50('0x9'),'fields':[_0xee50('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8425=['uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x432e18,_0x4bf3a6){var _0xfbc0e5=function(_0xd9f625){while(--_0xd9f625){_0x432e18['push'](_0x432e18['shift']());}};_0xfbc0e5(++_0x4bf3a6);}(_0x8425,0x1a5));var _0x5842=function(_0x3ef1a6,_0x54f4dd){_0x3ef1a6=_0x3ef1a6-0x0;var _0x28d482=_0x8425[_0x3ef1a6];return _0x28d482;};'use strict';var _=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var logger=require('../../config/logger')(_0x5842('0x2'));var moment=require(_0x5842('0x3'));var BPromise=require(_0x5842('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5842('0x5'));var rimraf=require(_0x5842('0x6'));var config=require(_0x5842('0x7'));var attributes=require(_0x5842('0x8'));module[_0x5842('0x9')]=function(_0x24a672,_0x3db420){return _0x24a672[_0x5842('0xa')](_0x5842('0xb'),attributes,{'tableName':_0x5842('0xc'),'paranoid':![],'indexes':[{'name':_0x5842('0xd'),'fields':[_0x5842('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 3b3fb16..09a6997 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 _0xbd66=['request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x3c99df,_0x515ff9){var _0x539ef6=function(_0x155312){while(--_0x155312){_0x3c99df['push'](_0x3c99df['shift']());}};_0x539ef6(++_0x515ff9);}(_0xbd66,0x7a));var _0x6bd6=function(_0x3609db,_0x594ea2){_0x3609db=_0x3609db-0x0;var _0xda653a=_0xbd66[_0x3609db];return _0xda653a;};'use strict';var _=require(_0x6bd6('0x0'));var util=require(_0x6bd6('0x1'));var moment=require(_0x6bd6('0x2'));var BPromise=require(_0x6bd6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bd6('0x4'));var db=require(_0x6bd6('0x5'))['db'];var utils=require(_0x6bd6('0x6'));var logger=require(_0x6bd6('0x7'))(_0x6bd6('0x8'));var config=require('../../config/environment');var jayson=require(_0x6bd6('0x9'));var client=jayson['client'][_0x6bd6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x349010,_0x3f20d7,_0x346042){return new BPromise(function(_0xe4f556,_0x366f49){return client[_0x6bd6('0xb')](_0x349010,_0x346042)[_0x6bd6('0xc')](function(_0x19005b){logger['info'](_0x6bd6('0xd'),_0x3f20d7,_0x6bd6('0xe'));logger['debug'](_0x6bd6('0xf'),_0x3f20d7,_0x6bd6('0xe'),JSON['stringify'](_0x19005b));if(_0x19005b[_0x6bd6('0x10')]){if(_0x19005b[_0x6bd6('0x10')][_0x6bd6('0x11')]===0x1f4){logger[_0x6bd6('0x10')](_0x6bd6('0xd'),_0x3f20d7,_0x19005b['error'][_0x6bd6('0x12')]);return _0x366f49(_0x19005b[_0x6bd6('0x10')][_0x6bd6('0x12')]);}logger['error'](_0x6bd6('0xd'),_0x3f20d7,_0x19005b[_0x6bd6('0x10')][_0x6bd6('0x12')]);return _0xe4f556(_0x19005b['error'][_0x6bd6('0x12')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x3f20d7,_0x6bd6('0xe'));_0xe4f556(_0x19005b['result'][_0x6bd6('0x12')]);}})['catch'](function(_0x3fdd78){logger[_0x6bd6('0x10')](_0x6bd6('0xd'),_0x3f20d7,_0x3fdd78);_0x366f49(_0x3fdd78);});});} \ No newline at end of file +var _0xb002=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x31c4ba,_0x3c9d37){var _0x5a955f=function(_0x5ddcf3){while(--_0x5ddcf3){_0x31c4ba['push'](_0x31c4ba['shift']());}};_0x5a955f(++_0x3c9d37);}(_0xb002,0x78));var _0x2b00=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb002[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x2b00('0x0'));var moment=require(_0x2b00('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b00('0x2'));var fs=require('fs');var Redis=require(_0x2b00('0x3'));var db=require(_0x2b00('0x4'))['db'];var utils=require(_0x2b00('0x5'));var logger=require(_0x2b00('0x6'))(_0x2b00('0x7'));var config=require('../../config/environment');var jayson=require(_0x2b00('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13de2e,_0x51e53d,_0x3ec71f){return new BPromise(function(_0x3ee59c,_0x27ee8f){return client[_0x2b00('0x9')](_0x13de2e,_0x3ec71f)[_0x2b00('0xa')](function(_0x267a17){logger['info'](_0x2b00('0xb'),_0x51e53d,_0x2b00('0xc'));logger['debug'](_0x2b00('0xd'),_0x51e53d,_0x2b00('0xc'),JSON[_0x2b00('0xe')](_0x267a17));if(_0x267a17[_0x2b00('0xf')]){if(_0x267a17['error']['code']===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x51e53d,_0x267a17[_0x2b00('0xf')][_0x2b00('0x10')]);return _0x27ee8f(_0x267a17[_0x2b00('0xf')][_0x2b00('0x10')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x51e53d,_0x267a17[_0x2b00('0xf')][_0x2b00('0x10')]);return _0x3ee59c(_0x267a17[_0x2b00('0xf')][_0x2b00('0x10')]);}else{logger[_0x2b00('0x11')](_0x2b00('0xb'),_0x51e53d,_0x2b00('0xc'));_0x3ee59c(_0x267a17[_0x2b00('0x12')][_0x2b00('0x10')]);}})[_0x2b00('0x13')](function(_0x26892a){logger['error'](_0x2b00('0xb'),_0x51e53d,_0x26892a);_0x27ee8f(_0x26892a);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 6386a14..c6b695d 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 _0xf74d=['/describe','describe','/:id','show','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index'];(function(_0x346cb0,_0x47b7d2){var _0x5d554b=function(_0x52c55b){while(--_0x52c55b){_0x346cb0['push'](_0x346cb0['shift']());}};_0x5d554b(++_0x47b7d2);}(_0xf74d,0x1c9));var _0xdf74=function(_0x22d730,_0x3ebbe8){_0x22d730=_0x22d730-0x0;var _0x43d1a5=_0xf74d[_0x22d730];return _0x43d1a5;};'use strict';var multer=require(_0xdf74('0x0'));var util=require(_0xdf74('0x1'));var path=require(_0xdf74('0x2'));var timeout=require(_0xdf74('0x3'));var express=require(_0xdf74('0x4'));var router=express[_0xdf74('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf74('0x6'));var config=require('../../config/environment');var controller=require(_0xdf74('0x7'));router[_0xdf74('0x8')]('/',auth[_0xdf74('0x9')](),controller[_0xdf74('0xa')]);router['get'](_0xdf74('0xb'),auth['isAuthenticated'](),controller[_0xdf74('0xc')]);router[_0xdf74('0x8')](_0xdf74('0xd'),auth['isAuthenticated'](),controller[_0xdf74('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdf74('0xf')]('/:id',auth[_0xdf74('0x9')](),controller['update']);router[_0xdf74('0x10')](_0xdf74('0xd'),auth['isAuthenticated'](),controller[_0xdf74('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7723=['connect-timeout','Router','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x236b4a,_0x41a29b){var _0x3a9223=function(_0x3d9403){while(--_0x3d9403){_0x236b4a['push'](_0x236b4a['shift']());}};_0x3a9223(++_0x41a29b);}(_0x7723,0x140));var _0x3772=function(_0x21dbc1,_0x5adf23){_0x21dbc1=_0x21dbc1-0x0;var _0x4c3f79=_0x7723[_0x21dbc1];return _0x4c3f79;};'use strict';var multer=require(_0x3772('0x0'));var util=require(_0x3772('0x1'));var path=require(_0x3772('0x2'));var timeout=require(_0x3772('0x3'));var express=require('express');var router=express[_0x3772('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3772('0x5'));var controller=require(_0x3772('0x6'));router[_0x3772('0x7')]('/',auth[_0x3772('0x8')](),controller[_0x3772('0x9')]);router[_0x3772('0x7')](_0x3772('0xa'),auth[_0x3772('0x8')](),controller[_0x3772('0xb')]);router[_0x3772('0x7')](_0x3772('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x3772('0xd')]('/',auth[_0x3772('0x8')](),controller[_0x3772('0xe')]);router[_0x3772('0xf')](_0x3772('0xc'),auth[_0x3772('0x8')](),controller['update']);router[_0x3772('0x10')](_0x3772('0xc'),auth[_0x3772('0x8')](),controller[_0x3772('0x11')]);module[_0x3772('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index aaebb9a..aae8af0 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 _0xf725=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete'];(function(_0x1a03e2,_0x373c4d){var _0x36389e=function(_0x1796dc){while(--_0x1796dc){_0x1a03e2['push'](_0x1a03e2['shift']());}};_0x36389e(++_0x373c4d);}(_0xf725,0x7e));var _0x5f72=function(_0x56c342,_0x28d735){_0x56c342=_0x56c342-0x0;var _0x1cd10c=_0xf725[_0x56c342];return _0x1cd10c;};'use strict';var multer=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var path=require(_0x5f72('0x2'));var timeout=require(_0x5f72('0x3'));var express=require(_0x5f72('0x4'));var router=express[_0x5f72('0x5')]();var auth=require(_0x5f72('0x6'));var interaction=require(_0x5f72('0x7'));var config=require(_0x5f72('0x8'));var controller=require(_0x5f72('0x9'));router['get']('/',auth[_0x5f72('0xa')](),controller[_0x5f72('0xb')]);router[_0x5f72('0xc')](_0x5f72('0xd'),auth[_0x5f72('0xa')](),controller[_0x5f72('0xe')]);router[_0x5f72('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5f72('0xf')]);router[_0x5f72('0xc')]('/:id/fields',auth[_0x5f72('0xa')](),controller[_0x5f72('0x10')]);router['post']('/',auth[_0x5f72('0xa')](),controller[_0x5f72('0x11')]);router[_0x5f72('0x12')](_0x5f72('0x13'),auth[_0x5f72('0xa')](),controller[_0x5f72('0x14')]);router[_0x5f72('0x15')]('/:id',auth[_0x5f72('0xa')](),controller[_0x5f72('0x16')]);router[_0x5f72('0x17')](_0x5f72('0xd'),auth[_0x5f72('0xa')](),controller['destroy']);module[_0x5f72('0x18')]=router; \ No newline at end of file +var _0xbeea=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbeea,0xb1));var _0xabee=function(_0x4c6ee1,_0x3a9158){_0x4c6ee1=_0x4c6ee1-0x0;var _0x2f8c70=_0xbeea[_0x4c6ee1];return _0x2f8c70;};'use strict';var multer=require(_0xabee('0x0'));var util=require('util');var path=require(_0xabee('0x1'));var timeout=require(_0xabee('0x2'));var express=require(_0xabee('0x3'));var router=express['Router']();var auth=require(_0xabee('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xabee('0x5'));var controller=require(_0xabee('0x6'));router[_0xabee('0x7')]('/',auth[_0xabee('0x8')](),controller[_0xabee('0x9')]);router['get']('/:id',auth[_0xabee('0x8')](),controller[_0xabee('0xa')]);router['get'](_0xabee('0xb'),auth['isAuthenticated'](),controller[_0xabee('0xc')]);router[_0xabee('0x7')](_0xabee('0xd'),auth[_0xabee('0x8')](),controller[_0xabee('0xe')]);router[_0xabee('0xf')]('/',auth['isAuthenticated'](),controller[_0xabee('0x10')]);router[_0xabee('0xf')](_0xabee('0xb'),auth['isAuthenticated'](),controller[_0xabee('0x11')]);router[_0xabee('0x12')](_0xabee('0x13'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xabee('0x14')]);module[_0xabee('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ed3410d..5d4ffa7 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 _0x8bba=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x4a3612,_0x36e426){var _0x5e8e72=function(_0x3392be){while(--_0x3392be){_0x4a3612['push'](_0x4a3612['shift']());}};_0x5e8e72(++_0x36e426);}(_0x8bba,0x1c9));var _0xa8bb=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x8bba[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require(_0xa8bb('0x0'));module[_0xa8bb('0x1')]={'name':{'type':Sequelize[_0xa8bb('0x2')]},'description':{'type':Sequelize[_0xa8bb('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa8bb('0x2')]},'authType':{'type':Sequelize[_0xa8bb('0x3')](_0xa8bb('0x4')),'defaultValue':_0xa8bb('0x4')},'password':{'type':Sequelize[_0xa8bb('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xa8bb('0x2')]},'token':{'type':Sequelize[_0xa8bb('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa8bb('0x2')]},'type':{'type':Sequelize[_0xa8bb('0x3')](_0xa8bb('0x5'),_0xa8bb('0x6')),'defaultValue':_0xa8bb('0x5')}}; \ No newline at end of file +var _0x35bb=['integrationTab','exports','STRING','ENUM','basic'];(function(_0x26793a,_0x49cf51){var _0x575efb=function(_0x2f4db7){while(--_0x2f4db7){_0x26793a['push'](_0x26793a['shift']());}};_0x575efb(++_0x49cf51);}(_0x35bb,0x12d));var _0xb35b=function(_0x373c0f,_0x215273){_0x373c0f=_0x373c0f-0x0;var _0x501c01=_0x35bb[_0x373c0f];return _0x501c01;};'use strict';var Sequelize=require('sequelize');module[_0xb35b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb35b('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb35b('0x1')]},'authType':{'type':Sequelize[_0xb35b('0x2')](_0xb35b('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xb35b('0x1')]},'consumerSecret':{'type':Sequelize[_0xb35b('0x1')]},'token':{'type':Sequelize[_0xb35b('0x1')]},'tokenSecret':{'type':Sequelize[_0xb35b('0x1')]},'serverUrl':{'type':Sequelize[_0xb35b('0x1')]},'type':{'type':Sequelize[_0xb35b('0x2')](_0xb35b('0x4'),'newTab'),'defaultValue':_0xb35b('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1810543..0fcd23d 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 _0x0b4e=['create','update','body','find','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','DeskField','Descriptions','priority','authType','username','password','consumerKey','token','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../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~!@#$%^&-_=+[{]}.','request','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','limit','Content-Range','apply','reject','save','then','destroy','stack','name','map','DeskAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','params','keys'];(function(_0x30af93,_0x399a17){var _0x2ed31a=function(_0x19f1fc){while(--_0x19f1fc){_0x30af93['push'](_0x30af93['shift']());}};_0x2ed31a(++_0x399a17);}(_0x0b4e,0x117));var _0xe0b4=function(_0x3d820a,_0x4ab7e7){_0x3d820a=_0x3d820a-0x0;var _0x4da191=_0x0b4e[_0x3d820a];return _0x4da191;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe0b4('0x0'));var rimraf=require(_0xe0b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b4('0x2'));var rp=require(_0xe0b4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe0b4('0x4'));var util=require(_0xe0b4('0x5'));var path=require(_0xe0b4('0x6'));var sox=require('sox');var csv=require(_0xe0b4('0x7'));var ejs=require(_0xe0b4('0x8'));var fs=require('fs');var _=require(_0xe0b4('0x9'));var squel=require('squel');var crypto=require(_0xe0b4('0xa'));var jsforce=require(_0xe0b4('0xb'));var deskjs=require(_0xe0b4('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe0b4('0xd'));var Papa=require('papaparse');var Redis=require(_0xe0b4('0xe'));var authService=require(_0xe0b4('0xf'));var qs=require(_0xe0b4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0b4('0x11'));var logger=require(_0xe0b4('0x12'))('api');var utils=require(_0xe0b4('0x13'));var config=require(_0xe0b4('0x14'));var db=require(_0xe0b4('0x15'))['db'];var integrations=require(_0xe0b4('0x16'));var jayson=require(_0xe0b4('0x17'));var client=jayson[_0xe0b4('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x1a164b,_0x4ae588,_0x3bde9b){if(_0x3bde9b){var _0x491d92=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x491d92[_0xe0b4('0x19')](_0x4ae588)){return _0x1a164b;}else{throw new db[(_0xe0b4('0x1a'))][(_0xe0b4('0x1b'))](_0xe0b4('0x1c'));}}else{return _0x1a164b;}}function respondWithRpcPromise(_0x4d903b,_0x360dd3,_0x131780,_0x11fbb1){return new BPromise(function(_0x3adde9,_0x1b9e6f){var _0xb93012=_0x11fbb1||client;return _0xb93012[_0xe0b4('0x1d')](_0x4d903b,_0x131780)['then'](function(_0x33e1eb){logger[_0xe0b4('0x1e')](_0xe0b4('0x1f'),_0x360dd3,_0xe0b4('0x20'));logger[_0xe0b4('0x21')](_0xe0b4('0x22'),_0x360dd3,_0xe0b4('0x20'),JSON[_0xe0b4('0x23')](_0x33e1eb));if(_0x33e1eb['error']){if(_0x33e1eb[_0xe0b4('0x24')]['code']===0x1f4){logger[_0xe0b4('0x24')](_0xe0b4('0x1f'),_0x360dd3,_0x33e1eb[_0xe0b4('0x24')]['message']);return _0x1b9e6f(_0x33e1eb['error'][_0xe0b4('0x25')]);}logger[_0xe0b4('0x24')](_0xe0b4('0x1f'),_0x360dd3,_0x33e1eb[_0xe0b4('0x24')][_0xe0b4('0x25')]);return _0x3adde9(_0x33e1eb[_0xe0b4('0x24')][_0xe0b4('0x25')]);}else{logger[_0xe0b4('0x1e')](_0xe0b4('0x1f'),_0x360dd3,_0xe0b4('0x20'));_0x3adde9(_0x33e1eb[_0xe0b4('0x26')][_0xe0b4('0x25')]);}})[_0xe0b4('0x27')](function(_0x584eb8){logger[_0xe0b4('0x24')](_0xe0b4('0x1f'),_0x360dd3,_0x584eb8);_0x1b9e6f(_0x584eb8);});});}function respondWithStatusCode(_0x11ab5a,_0x31d3f1){_0x31d3f1=_0x31d3f1||0xcc;return function(_0x185594){if(_0x185594){return _0x11ab5a[_0xe0b4('0x28')](_0x31d3f1);}return _0x11ab5a[_0xe0b4('0x29')](_0x31d3f1)[_0xe0b4('0x2a')]();};}function respondWithResult(_0x3d7353,_0x2395a2){_0x2395a2=_0x2395a2||0xc8;return function(_0x210c8c){if(_0x210c8c){return _0x3d7353['status'](_0x2395a2)[_0xe0b4('0x2b')](_0x210c8c);}};}function respondWithFilteredResult(_0x1cace8,_0x3c4516){return function(_0x48fffb){if(_0x48fffb){var _0x46574e=_0x48fffb[_0xe0b4('0x2c')],_0x48d937=_0x3c4516[_0xe0b4('0x2d')],_0x45d32b=_0x3c4516['offset']+_0x3c4516[_0xe0b4('0x2e')],_0x41334c;if(_0x45d32b>=_0x46574e){_0x45d32b=_0x46574e;_0x41334c=0xc8;}else{_0x41334c=0xce;}_0x1cace8['status'](_0x41334c);return _0x1cace8['set'](_0xe0b4('0x2f'),_0x48d937+'-'+_0x45d32b+'/'+_0x46574e)[_0xe0b4('0x2b')](_0x48fffb);}return null;};}function patchUpdates(_0x72bc23){return function(_0x6b346){try{jsonpatch[_0xe0b4('0x30')](_0x6b346,_0x72bc23,!![]);}catch(_0x38dde3){return BPromise[_0xe0b4('0x31')](_0x38dde3);}return _0x6b346[_0xe0b4('0x32')]();};}function saveUpdates(_0x4504cf,_0x804f5a){return function(_0x31ee8d){if(_0x31ee8d){return _0x31ee8d['update'](_0x4504cf)[_0xe0b4('0x33')](function(_0x182148){return _0x182148;});}return null;};}function removeEntity(_0x5dadd9,_0x4fdd11){return function(_0xe75c0b){if(_0xe75c0b){return _0xe75c0b[_0xe0b4('0x34')]()[_0xe0b4('0x33')](function(){_0x5dadd9[_0xe0b4('0x29')](0xcc)[_0xe0b4('0x2a')]();});}};}function handleEntityNotFound(_0x3e108e,_0x31f432){return function(_0x5180e2){if(!_0x5180e2){_0x3e108e[_0xe0b4('0x28')](0x194);}return _0x5180e2;};}function handleError(_0x14ed1d,_0x3db756){_0x3db756=_0x3db756||0x1f4;return function(_0x44c512){logger['error'](_0x44c512[_0xe0b4('0x35')]);if(_0x44c512[_0xe0b4('0x36')]){delete _0x44c512['name'];}_0x14ed1d[_0xe0b4('0x29')](_0x3db756)['send'](_0x44c512);};}exports['index']=function(_0x3f6d3f,_0xc1a0c3){var _0x3f1170={},_0xc65335={},_0x53b942={'count':0x0,'rows':[]};var _0x768c73=_[_0xe0b4('0x37')](db[_0xe0b4('0x38')][_0xe0b4('0x39')],function(_0x5de258){return{'name':_0x5de258['fieldName'],'type':_0x5de258[_0xe0b4('0x3a')][_0xe0b4('0x3b')]};});_0xc65335[_0xe0b4('0x3c')]=_[_0xe0b4('0x37')](_0x768c73,_0xe0b4('0x36'));_0xc65335[_0xe0b4('0x3d')]=_['keys'](_0x3f6d3f[_0xe0b4('0x3d')]);_0xc65335[_0xe0b4('0x3e')]=_[_0xe0b4('0x3f')](_0xc65335[_0xe0b4('0x3c')],_0xc65335[_0xe0b4('0x3d')]);_0x3f1170[_0xe0b4('0x40')]=_['intersection'](_0xc65335['model'],qs[_0xe0b4('0x41')](_0x3f6d3f[_0xe0b4('0x3d')][_0xe0b4('0x41')]));_0x3f1170['attributes']=_0x3f1170[_0xe0b4('0x40')][_0xe0b4('0x42')]?_0x3f1170[_0xe0b4('0x40')]:_0xc65335['model'];if(!_0x3f6d3f[_0xe0b4('0x3d')][_0xe0b4('0x43')](_0xe0b4('0x44'))){_0x3f1170['limit']=qs['limit'](_0x3f6d3f[_0xe0b4('0x3d')]['limit']);_0x3f1170['offset']=qs['offset'](_0x3f6d3f['query'][_0xe0b4('0x2d')]);}_0x3f1170[_0xe0b4('0x45')]=qs[_0xe0b4('0x46')](_0x3f6d3f['query'][_0xe0b4('0x46')]);_0x3f1170['where']=qs[_0xe0b4('0x3e')](_[_0xe0b4('0x47')](_0x3f6d3f['query'],_0xc65335[_0xe0b4('0x3e')]),_0x768c73);if(_0x3f6d3f[_0xe0b4('0x3d')][_0xe0b4('0x48')]){_0x3f1170[_0xe0b4('0x49')]=_[_0xe0b4('0x4a')](_0x3f1170['where'],{'$or':_[_0xe0b4('0x37')](_0x768c73,function(_0x2e537f){if(_0x2e537f['type']!=='VIRTUAL'){var _0x4069c3={};_0x4069c3[_0x2e537f[_0xe0b4('0x36')]]={'$like':'%'+_0x3f6d3f[_0xe0b4('0x3d')]['filter']+'%'};return _0x4069c3;}})});}_0x3f1170=_[_0xe0b4('0x4a')]({},_0x3f1170,_0x3f6d3f[_0xe0b4('0x4b')]);var _0x4c4949={'where':_0x3f1170[_0xe0b4('0x49')]};return db['DeskAccount'][_0xe0b4('0x2c')](_0x4c4949)['then'](function(_0xb37c20){_0x53b942['count']=_0xb37c20;if(_0x3f6d3f[_0xe0b4('0x3d')][_0xe0b4('0x4c')]){_0x3f1170[_0xe0b4('0x4d')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x3f1170);})[_0xe0b4('0x33')](function(_0x51a539){_0x53b942[_0xe0b4('0x4e')]=_0x51a539;return _0x53b942;})['then'](respondWithFilteredResult(_0xc1a0c3,_0x3f1170))[_0xe0b4('0x27')](handleError(_0xc1a0c3,null));};exports['show']=function(_0x36061f,_0x551a61){var _0xab0603={'raw':![],'where':{'id':_0x36061f[_0xe0b4('0x4f')]['id']}},_0x2b73f9={};_0x2b73f9[_0xe0b4('0x3c')]=_[_0xe0b4('0x50')](db['DeskAccount'][_0xe0b4('0x39')]);_0x2b73f9[_0xe0b4('0x3d')]=_[_0xe0b4('0x50')](_0x36061f[_0xe0b4('0x3d')]);_0x2b73f9[_0xe0b4('0x3e')]=_['intersection'](_0x2b73f9[_0xe0b4('0x3c')],_0x2b73f9[_0xe0b4('0x3d')]);_0xab0603[_0xe0b4('0x40')]=_[_0xe0b4('0x3f')](_0x2b73f9[_0xe0b4('0x3c')],qs['fields'](_0x36061f[_0xe0b4('0x3d')][_0xe0b4('0x41')]));_0xab0603[_0xe0b4('0x40')]=_0xab0603[_0xe0b4('0x40')]['length']?_0xab0603[_0xe0b4('0x40')]:_0x2b73f9[_0xe0b4('0x3c')];if(_0x36061f[_0xe0b4('0x3d')][_0xe0b4('0x4c')]){_0xab0603[_0xe0b4('0x4d')]=[{'all':!![]}];}_0xab0603=_['merge']({},_0xab0603,_0x36061f[_0xe0b4('0x4b')]);return db[_0xe0b4('0x38')]['find'](_0xab0603)[_0xe0b4('0x33')](handleEntityNotFound(_0x551a61,null))[_0xe0b4('0x33')](respondWithResult(_0x551a61,null))[_0xe0b4('0x27')](handleError(_0x551a61,null));};exports['create']=function(_0x59b3b8,_0x1cc236){return db[_0xe0b4('0x38')][_0xe0b4('0x51')](_0x59b3b8['body'],{})['then'](respondWithResult(_0x1cc236,0xc9))[_0xe0b4('0x27')](handleError(_0x1cc236,null));};exports[_0xe0b4('0x52')]=function(_0x163baa,_0x217cf3){if(_0x163baa[_0xe0b4('0x53')]['id']){delete _0x163baa['body']['id'];}return db[_0xe0b4('0x38')][_0xe0b4('0x54')]({'where':{'id':_0x163baa[_0xe0b4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x217cf3,null))[_0xe0b4('0x33')](saveUpdates(_0x163baa[_0xe0b4('0x53')],null))[_0xe0b4('0x33')](respondWithResult(_0x217cf3,null))[_0xe0b4('0x27')](handleError(_0x217cf3,null));};exports[_0xe0b4('0x34')]=function(_0x93f934,_0x55f150){return db[_0xe0b4('0x38')]['find']({'where':{'id':_0x93f934['params']['id']}})['then'](handleEntityNotFound(_0x55f150,null))[_0xe0b4('0x33')](removeEntity(_0x55f150,null))[_0xe0b4('0x27')](handleError(_0x55f150,null));};exports[_0xe0b4('0x55')]=function(_0x222fce,_0x2c3598,_0x16c640){var _0x13badb={};var _0x551459={};var _0x4932fd;var _0x348465;return db[_0xe0b4('0x38')][_0xe0b4('0x56')]({'where':{'id':_0x222fce[_0xe0b4('0x4f')]['id']}})[_0xe0b4('0x33')](handleEntityNotFound(_0x2c3598,null))[_0xe0b4('0x33')](function(_0x4ed0e7){if(_0x4ed0e7){_0x4932fd=_0x4ed0e7;_0x551459[_0xe0b4('0x3c')]=_[_0xe0b4('0x50')](db[_0xe0b4('0x57')][_0xe0b4('0x39')]);_0x551459['query']=_[_0xe0b4('0x50')](_0x222fce[_0xe0b4('0x3d')]);_0x551459[_0xe0b4('0x3e')]=_['intersection'](_0x551459[_0xe0b4('0x3c')],_0x551459['query']);_0x13badb[_0xe0b4('0x40')]=_[_0xe0b4('0x3f')](_0x551459[_0xe0b4('0x3c')],qs['fields'](_0x222fce[_0xe0b4('0x3d')][_0xe0b4('0x41')]));_0x13badb[_0xe0b4('0x40')]=_0x13badb[_0xe0b4('0x40')][_0xe0b4('0x42')]?_0x13badb['attributes']:_0x551459[_0xe0b4('0x3c')];_0x13badb[_0xe0b4('0x45')]=qs['sort'](_0x222fce[_0xe0b4('0x3d')][_0xe0b4('0x46')]);_0x13badb[_0xe0b4('0x49')]=qs[_0xe0b4('0x3e')](_[_0xe0b4('0x47')](_0x222fce[_0xe0b4('0x3d')],_0x551459[_0xe0b4('0x3e')]));if(_0x222fce[_0xe0b4('0x3d')]['filter']){_0x13badb[_0xe0b4('0x49')]=_['merge'](_0x13badb['where'],{'$or':_['map'](_0x13badb[_0xe0b4('0x40')],function(_0x2254e3){var _0x3b5e94={};_0x3b5e94[_0x2254e3]={'$like':'%'+_0x222fce[_0xe0b4('0x3d')]['filter']+'%'};return _0x3b5e94;})});}_0x13badb=_[_0xe0b4('0x4a')]({},_0x13badb,_0x222fce['options']);return _0x4932fd[_0xe0b4('0x55')](_0x13badb);}})['then'](function(_0x244bb8){if(_0x244bb8){_0x348465=_0x244bb8[_0xe0b4('0x42')];if(!_0x222fce['query'][_0xe0b4('0x43')](_0xe0b4('0x44'))){_0x13badb[_0xe0b4('0x2e')]=qs[_0xe0b4('0x2e')](_0x222fce[_0xe0b4('0x3d')][_0xe0b4('0x2e')]);_0x13badb[_0xe0b4('0x2d')]=qs[_0xe0b4('0x2d')](_0x222fce[_0xe0b4('0x3d')]['offset']);}return _0x4932fd[_0xe0b4('0x55')](_0x13badb);}})[_0xe0b4('0x33')](function(_0x5468e3){if(_0x5468e3){return _0x5468e3?{'count':_0x348465,'rows':_0x5468e3}:null;}})[_0xe0b4('0x33')](respondWithResult(_0x2c3598,null))['catch'](handleError(_0x2c3598,null));};exports[_0xe0b4('0x58')]=function(_0x4f1b80,_0x42e526,_0x5334ab){if(_0x4f1b80[_0xe0b4('0x53')]['id']){delete _0x4f1b80[_0xe0b4('0x53')]['id'];}return db[_0xe0b4('0x38')][_0xe0b4('0x56')]({'where':{'id':_0x4f1b80[_0xe0b4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x42e526,null))[_0xe0b4('0x33')](function(_0x14393c){if(_0x14393c){_0x4f1b80[_0xe0b4('0x53')][_0xe0b4('0x59')]=_0x14393c['id'];_0x4f1b80[_0xe0b4('0x53')][_0xe0b4('0x5a')]=integrations[_0xe0b4('0x5b')](_0x4f1b80[_0xe0b4('0x53')]['channel'],_0x4f1b80['body'][_0xe0b4('0x3a')]);_0x4f1b80['body']['Descriptions']=integrations[_0xe0b4('0x5c')](_0x4f1b80['body'][_0xe0b4('0x5d')],_0x4f1b80[_0xe0b4('0x53')][_0xe0b4('0x3a')]);return db['DeskConfiguration'][_0xe0b4('0x51')](_0x4f1b80[_0xe0b4('0x53')],{'include':[{'model':db[_0xe0b4('0x5e')],'as':_0xe0b4('0x5a')},{'model':db['DeskField'],'as':_0xe0b4('0x5f')}]});}return null;})[_0xe0b4('0x33')](respondWithResult(_0x42e526,null))['catch'](handleError(_0x42e526,null));};exports['getFields']=function(_0x305451,_0x421ba2,_0x3e121a){var _0x4d9989=[{'name':_0xe0b4('0x60'),'label':_0xe0b4('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 _0x4acc81='';return db[_0xe0b4('0x38')]['findOne']({'where':{'id':_0x305451['params']['id']},'attributes':['id','remoteUri',_0xe0b4('0x61'),_0xe0b4('0x62'),_0xe0b4('0x63'),_0xe0b4('0x64'),'consumerSecret',_0xe0b4('0x65'),'tokenSecret']})[_0xe0b4('0x33')](handleEntityNotFound(_0x421ba2,null))[_0xe0b4('0x33')](function(_0x220e8b){if(_0x220e8b){_0x4acc81=_0x220e8b['remoteUri'];var _0x2b7377=_0x4acc81['slice'](-0x1);if(_0x2b7377==='/'){_0x4acc81=_0x4acc81[_0xe0b4('0x66')](0x0,_0x4acc81['lastIndexOf'](_0x2b7377));}var _0x1f00ef={'method':_0xe0b4('0x67'),'uri':util[_0xe0b4('0x68')](_0xe0b4('0x69'),_0x4acc81),'headers':{'Content-Type':'application/json','Accept':_0xe0b4('0x6a')},'json':!![]};if(_0x220e8b[_0xe0b4('0x61')]===_0xe0b4('0x6b')){_0x1f00ef[_0xe0b4('0x6c')][_0xe0b4('0x6d')]=util[_0xe0b4('0x68')]('Basic\x20%s',new Buffer(util[_0xe0b4('0x68')](_0xe0b4('0x6e'),_0x220e8b['username'],_0x220e8b['password']))['toString']('base64'));}return rp(_0x1f00ef)[_0xe0b4('0x33')](function(_0x4ae3a7){return _0x4d9989[_0xe0b4('0x6f')](_[_0xe0b4('0x37')](_0x4ae3a7[_0xe0b4('0x70')][_0xe0b4('0x71')],function(_0xd8076a){return{'id':_0xd8076a[_0xe0b4('0x36')],'name':_0xd8076a['name'],'type':_0xd8076a['type'],'active':_0xd8076a[_0xe0b4('0x72')],'label':_0xd8076a[_0xe0b4('0x73')],'custom':!![]};}));});}})[_0xe0b4('0x33')](function(_0x4e7b3a){return{'count':_0x4e7b3a[_0xe0b4('0x42')],'rows':_0x4e7b3a};})[_0xe0b4('0x33')](respondWithResult(_0x421ba2,null))[_0xe0b4('0x27')](function(_0x303bf3){var _0x3088c8=_0x305451[_0xe0b4('0x3d')][_0xe0b4('0x19')]?0x1f4:_0x303bf3[_0xe0b4('0x74')]||0x1f4;logger[_0xe0b4('0x24')](_0xe0b4('0x75'),_0xe0b4('0x76'),_0x3088c8,JSON[_0xe0b4('0x23')](_0x303bf3));delete _0x303bf3[_0xe0b4('0x36')];if(_0x3088c8===0x191){_0x3088c8=0x190;}_0x421ba2['status'](_0x3088c8)[_0xe0b4('0x77')](_0x305451[_0xe0b4('0x3d')][_0xe0b4('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x303bf3[_0xe0b4('0x74')]}:_0x303bf3);});}; \ No newline at end of file +var _0x9f38=['destroy','stack','name','send','DeskAccount','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','show','keys','create','body','find','params','getConfigurations','DeskConfiguration','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','username','toString','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','request','info','debug','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x4e31a7,_0x144a35){var _0x1a26e7=function(_0x5ad2e0){while(--_0x5ad2e0){_0x4e31a7['push'](_0x4e31a7['shift']());}};_0x1a26e7(++_0x144a35);}(_0x9f38,0x153));var _0x89f3=function(_0x801009,_0x4a2c66){_0x801009=_0x801009-0x0;var _0x1c8d3f=_0x9f38[_0x801009];return _0x1c8d3f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x89f3('0x0'));var zipdir=require(_0x89f3('0x1'));var jsonpatch=require(_0x89f3('0x2'));var rp=require('request-promise');var moment=require(_0x89f3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x89f3('0x4'));var path=require(_0x89f3('0x5'));var sox=require(_0x89f3('0x6'));var csv=require(_0x89f3('0x7'));var ejs=require(_0x89f3('0x8'));var fs=require('fs');var _=require(_0x89f3('0x9'));var squel=require(_0x89f3('0xa'));var crypto=require('crypto');var jsforce=require(_0x89f3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x89f3('0xc'));var Papa=require(_0x89f3('0xd'));var Redis=require(_0x89f3('0xe'));var authService=require(_0x89f3('0xf'));var qs=require(_0x89f3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89f3('0x11'));var logger=require(_0x89f3('0x12'))(_0x89f3('0x13'));var utils=require(_0x89f3('0x14'));var config=require(_0x89f3('0x15'));var db=require(_0x89f3('0x16'))['db'];var integrations=require(_0x89f3('0x17'));var jayson=require(_0x89f3('0x18'));var client=jayson[_0x89f3('0x19')][_0x89f3('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4f207e,_0x36c2f4,_0x4be279){if(_0x4be279){var _0x2133ab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2133ab[_0x89f3('0x1b')](_0x36c2f4)){return _0x4f207e;}else{throw new db[(_0x89f3('0x1c'))]['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 _0x4f207e;}}function respondWithRpcPromise(_0x3c9b7a,_0x3aa22e,_0x15059b,_0x525051){return new BPromise(function(_0x25f013,_0x3fa863){var _0x328342=_0x525051||client;return _0x328342[_0x89f3('0x1d')](_0x3c9b7a,_0x15059b)['then'](function(_0x47ab3f){logger[_0x89f3('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x3aa22e,'request\x20sent');logger[_0x89f3('0x1f')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3aa22e,_0x89f3('0x20'),JSON[_0x89f3('0x21')](_0x47ab3f));if(_0x47ab3f[_0x89f3('0x22')]){if(_0x47ab3f[_0x89f3('0x22')][_0x89f3('0x23')]===0x1f4){logger[_0x89f3('0x22')](_0x89f3('0x24'),_0x3aa22e,_0x47ab3f[_0x89f3('0x22')][_0x89f3('0x25')]);return _0x3fa863(_0x47ab3f[_0x89f3('0x22')][_0x89f3('0x25')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x3aa22e,_0x47ab3f[_0x89f3('0x22')][_0x89f3('0x25')]);return _0x25f013(_0x47ab3f[_0x89f3('0x22')][_0x89f3('0x25')]);}else{logger[_0x89f3('0x1e')](_0x89f3('0x24'),_0x3aa22e,'request\x20sent');_0x25f013(_0x47ab3f[_0x89f3('0x26')][_0x89f3('0x25')]);}})[_0x89f3('0x27')](function(_0x439bea){logger[_0x89f3('0x22')](_0x89f3('0x24'),_0x3aa22e,_0x439bea);_0x3fa863(_0x439bea);});});}function respondWithStatusCode(_0x1a75be,_0x16e7a5){_0x16e7a5=_0x16e7a5||0xcc;return function(_0x4ee1c9){if(_0x4ee1c9){return _0x1a75be[_0x89f3('0x28')](_0x16e7a5);}return _0x1a75be[_0x89f3('0x29')](_0x16e7a5)[_0x89f3('0x2a')]();};}function respondWithResult(_0x5d135d,_0x5dbda9){_0x5dbda9=_0x5dbda9||0xc8;return function(_0x309014){if(_0x309014){return _0x5d135d[_0x89f3('0x29')](_0x5dbda9)[_0x89f3('0x2b')](_0x309014);}};}function respondWithFilteredResult(_0x4b016e,_0x18a106){return function(_0x44cf17){if(_0x44cf17){var _0x33ee27=_0x44cf17[_0x89f3('0x2c')],_0x454ed3=_0x18a106[_0x89f3('0x2d')],_0xee92f2=_0x18a106[_0x89f3('0x2d')]+_0x18a106[_0x89f3('0x2e')],_0x3e4809;if(_0xee92f2>=_0x33ee27){_0xee92f2=_0x33ee27;_0x3e4809=0xc8;}else{_0x3e4809=0xce;}_0x4b016e[_0x89f3('0x29')](_0x3e4809);return _0x4b016e[_0x89f3('0x2f')](_0x89f3('0x30'),_0x454ed3+'-'+_0xee92f2+'/'+_0x33ee27)[_0x89f3('0x2b')](_0x44cf17);}return null;};}function patchUpdates(_0x3fb632){return function(_0x290a42){try{jsonpatch[_0x89f3('0x31')](_0x290a42,_0x3fb632,!![]);}catch(_0x5677f6){return BPromise[_0x89f3('0x32')](_0x5677f6);}return _0x290a42[_0x89f3('0x33')]();};}function saveUpdates(_0x30017f,_0x4366d2){return function(_0x229526){if(_0x229526){return _0x229526[_0x89f3('0x34')](_0x30017f)[_0x89f3('0x35')](function(_0x32b306){return _0x32b306;});}return null;};}function removeEntity(_0x2fe17c,_0x3e504f){return function(_0x1a0194){if(_0x1a0194){return _0x1a0194[_0x89f3('0x36')]()[_0x89f3('0x35')](function(){_0x2fe17c[_0x89f3('0x29')](0xcc)[_0x89f3('0x2a')]();});}};}function handleEntityNotFound(_0x204e1a,_0x1beca6){return function(_0x453cf9){if(!_0x453cf9){_0x204e1a[_0x89f3('0x28')](0x194);}return _0x453cf9;};}function handleError(_0x2e91df,_0x1e76d7){_0x1e76d7=_0x1e76d7||0x1f4;return function(_0x1ef65d){logger[_0x89f3('0x22')](_0x1ef65d[_0x89f3('0x37')]);if(_0x1ef65d[_0x89f3('0x38')]){delete _0x1ef65d[_0x89f3('0x38')];}_0x2e91df['status'](_0x1e76d7)[_0x89f3('0x39')](_0x1ef65d);};}exports['index']=function(_0x3fdd68,_0x4796d1){var _0x191c5e={},_0x1efa99={},_0x31e48e={'count':0x0,'rows':[]};var _0x266545=_['map'](db[_0x89f3('0x3a')][_0x89f3('0x3b')],function(_0x42f250){return{'name':_0x42f250['fieldName'],'type':_0x42f250[_0x89f3('0x3c')][_0x89f3('0x3d')]};});_0x1efa99[_0x89f3('0x3e')]=_['map'](_0x266545,_0x89f3('0x38'));_0x1efa99[_0x89f3('0x3f')]=_['keys'](_0x3fdd68[_0x89f3('0x3f')]);_0x1efa99['filters']=_['intersection'](_0x1efa99[_0x89f3('0x3e')],_0x1efa99[_0x89f3('0x3f')]);_0x191c5e[_0x89f3('0x40')]=_[_0x89f3('0x41')](_0x1efa99[_0x89f3('0x3e')],qs['fields'](_0x3fdd68[_0x89f3('0x3f')][_0x89f3('0x42')]));_0x191c5e[_0x89f3('0x40')]=_0x191c5e[_0x89f3('0x40')][_0x89f3('0x43')]?_0x191c5e[_0x89f3('0x40')]:_0x1efa99[_0x89f3('0x3e')];if(!_0x3fdd68[_0x89f3('0x3f')][_0x89f3('0x44')](_0x89f3('0x45'))){_0x191c5e[_0x89f3('0x2e')]=qs[_0x89f3('0x2e')](_0x3fdd68['query'][_0x89f3('0x2e')]);_0x191c5e[_0x89f3('0x2d')]=qs[_0x89f3('0x2d')](_0x3fdd68[_0x89f3('0x3f')][_0x89f3('0x2d')]);}_0x191c5e['order']=qs[_0x89f3('0x46')](_0x3fdd68[_0x89f3('0x3f')][_0x89f3('0x46')]);_0x191c5e[_0x89f3('0x47')]=qs[_0x89f3('0x48')](_[_0x89f3('0x49')](_0x3fdd68[_0x89f3('0x3f')],_0x1efa99[_0x89f3('0x48')]),_0x266545);if(_0x3fdd68[_0x89f3('0x3f')][_0x89f3('0x4a')]){_0x191c5e[_0x89f3('0x47')]=_[_0x89f3('0x4b')](_0x191c5e[_0x89f3('0x47')],{'$or':_[_0x89f3('0x4c')](_0x266545,function(_0xa160b7){if(_0xa160b7['type']!==_0x89f3('0x4d')){var _0x2ae5d4={};_0x2ae5d4[_0xa160b7[_0x89f3('0x38')]]={'$like':'%'+_0x3fdd68[_0x89f3('0x3f')][_0x89f3('0x4a')]+'%'};return _0x2ae5d4;}})});}_0x191c5e=_[_0x89f3('0x4b')]({},_0x191c5e,_0x3fdd68[_0x89f3('0x4e')]);var _0x4724ce={'where':_0x191c5e[_0x89f3('0x47')]};return db[_0x89f3('0x3a')]['count'](_0x4724ce)[_0x89f3('0x35')](function(_0x540179){_0x31e48e[_0x89f3('0x2c')]=_0x540179;if(_0x3fdd68[_0x89f3('0x3f')]['includeAll']){_0x191c5e[_0x89f3('0x4f')]=[{'all':!![]}];}return db[_0x89f3('0x3a')][_0x89f3('0x50')](_0x191c5e);})[_0x89f3('0x35')](function(_0x4d9a31){_0x31e48e[_0x89f3('0x51')]=_0x4d9a31;return _0x31e48e;})['then'](respondWithFilteredResult(_0x4796d1,_0x191c5e))[_0x89f3('0x27')](handleError(_0x4796d1,null));};exports[_0x89f3('0x52')]=function(_0x3ebebc,_0x410868){var _0x1a7581={'raw':![],'where':{'id':_0x3ebebc['params']['id']}},_0x29953d={};_0x29953d[_0x89f3('0x3e')]=_[_0x89f3('0x53')](db[_0x89f3('0x3a')][_0x89f3('0x3b')]);_0x29953d[_0x89f3('0x3f')]=_[_0x89f3('0x53')](_0x3ebebc[_0x89f3('0x3f')]);_0x29953d[_0x89f3('0x48')]=_[_0x89f3('0x41')](_0x29953d[_0x89f3('0x3e')],_0x29953d[_0x89f3('0x3f')]);_0x1a7581[_0x89f3('0x40')]=_['intersection'](_0x29953d[_0x89f3('0x3e')],qs[_0x89f3('0x42')](_0x3ebebc[_0x89f3('0x3f')][_0x89f3('0x42')]));_0x1a7581['attributes']=_0x1a7581[_0x89f3('0x40')][_0x89f3('0x43')]?_0x1a7581['attributes']:_0x29953d[_0x89f3('0x3e')];if(_0x3ebebc[_0x89f3('0x3f')]['includeAll']){_0x1a7581[_0x89f3('0x4f')]=[{'all':!![]}];}_0x1a7581=_['merge']({},_0x1a7581,_0x3ebebc[_0x89f3('0x4e')]);return db[_0x89f3('0x3a')]['find'](_0x1a7581)[_0x89f3('0x35')](handleEntityNotFound(_0x410868,null))[_0x89f3('0x35')](respondWithResult(_0x410868,null))[_0x89f3('0x27')](handleError(_0x410868,null));};exports[_0x89f3('0x54')]=function(_0x54d4d1,_0x3aab95){return db[_0x89f3('0x3a')][_0x89f3('0x54')](_0x54d4d1[_0x89f3('0x55')],{})['then'](respondWithResult(_0x3aab95,0xc9))[_0x89f3('0x27')](handleError(_0x3aab95,null));};exports[_0x89f3('0x34')]=function(_0x3cb786,_0x50e1dd){if(_0x3cb786[_0x89f3('0x55')]['id']){delete _0x3cb786[_0x89f3('0x55')]['id'];}return db[_0x89f3('0x3a')][_0x89f3('0x56')]({'where':{'id':_0x3cb786[_0x89f3('0x57')]['id']}})[_0x89f3('0x35')](handleEntityNotFound(_0x50e1dd,null))[_0x89f3('0x35')](saveUpdates(_0x3cb786[_0x89f3('0x55')],null))[_0x89f3('0x35')](respondWithResult(_0x50e1dd,null))[_0x89f3('0x27')](handleError(_0x50e1dd,null));};exports[_0x89f3('0x36')]=function(_0x2c9bc,_0x18c6fa){return db[_0x89f3('0x3a')]['find']({'where':{'id':_0x2c9bc[_0x89f3('0x57')]['id']}})[_0x89f3('0x35')](handleEntityNotFound(_0x18c6fa,null))['then'](removeEntity(_0x18c6fa,null))[_0x89f3('0x27')](handleError(_0x18c6fa,null));};exports[_0x89f3('0x58')]=function(_0x56bbde,_0x4de4f0,_0x398bc4){var _0x4adc85={};var _0x11c978={};var _0x4f9252;var _0x5680e3;return db['DeskAccount']['findOne']({'where':{'id':_0x56bbde[_0x89f3('0x57')]['id']}})['then'](handleEntityNotFound(_0x4de4f0,null))['then'](function(_0x2108db){if(_0x2108db){_0x4f9252=_0x2108db;_0x11c978[_0x89f3('0x3e')]=_[_0x89f3('0x53')](db[_0x89f3('0x59')]['rawAttributes']);_0x11c978[_0x89f3('0x3f')]=_[_0x89f3('0x53')](_0x56bbde['query']);_0x11c978[_0x89f3('0x48')]=_[_0x89f3('0x41')](_0x11c978[_0x89f3('0x3e')],_0x11c978[_0x89f3('0x3f')]);_0x4adc85[_0x89f3('0x40')]=_[_0x89f3('0x41')](_0x11c978['model'],qs['fields'](_0x56bbde['query'][_0x89f3('0x42')]));_0x4adc85['attributes']=_0x4adc85['attributes'][_0x89f3('0x43')]?_0x4adc85[_0x89f3('0x40')]:_0x11c978[_0x89f3('0x3e')];_0x4adc85[_0x89f3('0x5a')]=qs[_0x89f3('0x46')](_0x56bbde['query'][_0x89f3('0x46')]);_0x4adc85[_0x89f3('0x47')]=qs[_0x89f3('0x48')](_[_0x89f3('0x49')](_0x56bbde[_0x89f3('0x3f')],_0x11c978['filters']));if(_0x56bbde[_0x89f3('0x3f')][_0x89f3('0x4a')]){_0x4adc85[_0x89f3('0x47')]=_[_0x89f3('0x4b')](_0x4adc85['where'],{'$or':_[_0x89f3('0x4c')](_0x4adc85[_0x89f3('0x40')],function(_0x407022){var _0x14b790={};_0x14b790[_0x407022]={'$like':'%'+_0x56bbde[_0x89f3('0x3f')][_0x89f3('0x4a')]+'%'};return _0x14b790;})});}_0x4adc85=_[_0x89f3('0x4b')]({},_0x4adc85,_0x56bbde[_0x89f3('0x4e')]);return _0x4f9252['getConfigurations'](_0x4adc85);}})[_0x89f3('0x35')](function(_0x3acaee){if(_0x3acaee){_0x5680e3=_0x3acaee[_0x89f3('0x43')];if(!_0x56bbde[_0x89f3('0x3f')][_0x89f3('0x44')](_0x89f3('0x45'))){_0x4adc85['limit']=qs[_0x89f3('0x2e')](_0x56bbde[_0x89f3('0x3f')][_0x89f3('0x2e')]);_0x4adc85[_0x89f3('0x2d')]=qs['offset'](_0x56bbde[_0x89f3('0x3f')][_0x89f3('0x2d')]);}return _0x4f9252[_0x89f3('0x58')](_0x4adc85);}})['then'](function(_0xcd5a70){if(_0xcd5a70){return _0xcd5a70?{'count':_0x5680e3,'rows':_0xcd5a70}:null;}})[_0x89f3('0x35')](respondWithResult(_0x4de4f0,null))['catch'](handleError(_0x4de4f0,null));};exports[_0x89f3('0x5b')]=function(_0x1c30ca,_0x50b340,_0x2d3755){if(_0x1c30ca[_0x89f3('0x55')]['id']){delete _0x1c30ca[_0x89f3('0x55')]['id'];}return db['DeskAccount'][_0x89f3('0x5c')]({'where':{'id':_0x1c30ca['params']['id']}})['then'](handleEntityNotFound(_0x50b340,null))[_0x89f3('0x35')](function(_0x1db211){if(_0x1db211){_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x5d')]=_0x1db211['id'];_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x5e')]=integrations[_0x89f3('0x5f')](_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x60')],_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x3c')]);_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x61')]=integrations[_0x89f3('0x62')](_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x60')],_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x3c')]);return db['DeskConfiguration']['create'](_0x1c30ca[_0x89f3('0x55')],{'include':[{'model':db[_0x89f3('0x63')],'as':_0x89f3('0x5e')},{'model':db[_0x89f3('0x63')],'as':_0x89f3('0x61')}]});}return null;})[_0x89f3('0x35')](respondWithResult(_0x50b340,null))[_0x89f3('0x27')](handleError(_0x50b340,null));};exports[_0x89f3('0x64')]=function(_0x31e304,_0x3ebcfe,_0x3cd402){var _0x15dc58=[{'name':_0x89f3('0x65'),'label':_0x89f3('0x65'),'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 _0xc251e6='';return db[_0x89f3('0x3a')][_0x89f3('0x5c')]({'where':{'id':_0x31e304[_0x89f3('0x57')]['id']},'attributes':['id',_0x89f3('0x66'),_0x89f3('0x67'),'username',_0x89f3('0x68'),_0x89f3('0x69'),_0x89f3('0x6a'),_0x89f3('0x6b'),_0x89f3('0x6c')]})['then'](handleEntityNotFound(_0x3ebcfe,null))[_0x89f3('0x35')](function(_0x428757){if(_0x428757){_0xc251e6=_0x428757[_0x89f3('0x66')];var _0x25ac00=_0xc251e6[_0x89f3('0x6d')](-0x1);if(_0x25ac00==='/'){_0xc251e6=_0xc251e6[_0x89f3('0x6e')](0x0,_0xc251e6[_0x89f3('0x6f')](_0x25ac00));}var _0x338fcb={'method':_0x89f3('0x70'),'uri':util[_0x89f3('0x71')](_0x89f3('0x72'),_0xc251e6),'headers':{'Content-Type':'application/json','Accept':_0x89f3('0x73')},'json':!![]};if(_0x428757[_0x89f3('0x67')]===_0x89f3('0x74')){_0x338fcb[_0x89f3('0x75')][_0x89f3('0x76')]=util[_0x89f3('0x71')](_0x89f3('0x77'),new Buffer(util[_0x89f3('0x71')]('%s:%s',_0x428757[_0x89f3('0x78')],_0x428757[_0x89f3('0x68')]))[_0x89f3('0x79')](_0x89f3('0x7a')));}return rp(_0x338fcb)[_0x89f3('0x35')](function(_0x4c52a0){return _0x15dc58[_0x89f3('0x7b')](_[_0x89f3('0x4c')](_0x4c52a0[_0x89f3('0x7c')][_0x89f3('0x7d')],function(_0x296625){return{'id':_0x296625[_0x89f3('0x38')],'name':_0x296625[_0x89f3('0x38')],'type':_0x296625[_0x89f3('0x3c')],'active':_0x296625[_0x89f3('0x7e')],'label':_0x296625[_0x89f3('0x7f')],'custom':!![]};}));});}})['then'](function(_0x5b675f){return{'count':_0x5b675f[_0x89f3('0x43')],'rows':_0x5b675f};})[_0x89f3('0x35')](respondWithResult(_0x3ebcfe,null))['catch'](function(_0x42bd46){var _0x3f0047=_0x31e304[_0x89f3('0x3f')][_0x89f3('0x1b')]?0x1f4:_0x42bd46['statusCode']||0x1f4;logger['error'](_0x89f3('0x80'),_0x89f3('0x64'),_0x3f0047,JSON[_0x89f3('0x21')](_0x42bd46));delete _0x42bd46['name'];if(_0x3f0047===0x191){_0x3f0047=0x190;}_0x3ebcfe['status'](_0x3f0047)[_0x89f3('0x39')](_0x31e304[_0x89f3('0x3f')]['test']?{'message':_0x89f3('0x81'),'statusCode':_0x42bd46[_0x89f3('0x82')]}:_0x42bd46);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 0b5dccb..8920384 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 _0xd892=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x37bb49,_0x3bdfa){var _0x5cc827=function(_0x52ef57){while(--_0x52ef57){_0x37bb49['push'](_0x37bb49['shift']());}};_0x5cc827(++_0x3bdfa);}(_0xd892,0x103));var _0x2d89=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xd892[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x2d89('0x0'));var util=require('util');var logger=require(_0x2d89('0x1'))(_0x2d89('0x2'));var moment=require(_0x2d89('0x3'));var BPromise=require('bluebird');var rp=require(_0x2d89('0x4'));var fs=require('fs');var path=require(_0x2d89('0x5'));var rimraf=require(_0x2d89('0x6'));var config=require(_0x2d89('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x2d89('0x8'));module[_0x2d89('0x9')]=function(_0x4c51b9,_0x47d7b4){return _0x4c51b9[_0x2d89('0xa')](_0x2d89('0xb'),attributes,{'tableName':_0x2d89('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb48=['moment','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','api'];(function(_0x4b0c73,_0x81d8c9){var _0x2e8f0b=function(_0x31c8db){while(--_0x31c8db){_0x4b0c73['push'](_0x4b0c73['shift']());}};_0x2e8f0b(++_0x81d8c9);}(_0xeb48,0xfa));var _0x8eb4=function(_0x15d9aa,_0x2b4405){_0x15d9aa=_0x15d9aa-0x0;var _0x25f3de=_0xeb48[_0x15d9aa];return _0x25f3de;};'use strict';var _=require('lodash');var util=require(_0x8eb4('0x0'));var logger=require(_0x8eb4('0x1'))(_0x8eb4('0x2'));var moment=require(_0x8eb4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8eb4('0x4'));var config=require(_0x8eb4('0x5'));var attributes=require(_0x8eb4('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x8eb4('0x7')]=function(_0x17624e,_0x1ef212){return _0x17624e[_0x8eb4('0x8')](_0x8eb4('0x9'),attributes,{'tableName':_0x8eb4('0xa'),'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 7ba73ec..90d782b 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 _0xd76b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','include','map','model','attributes','then','stringify','ShowDeskAccount','find','where','catch','lodash','moment'];(function(_0x51d248,_0x208867){var _0x4cb400=function(_0x2942ec){while(--_0x2942ec){_0x51d248['push'](_0x51d248['shift']());}};_0x4cb400(++_0x208867);}(_0xd76b,0x1ba));var _0xbd76=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xd76b[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xbd76('0x0'));var util=require('util');var moment=require(_0xbd76('0x1'));var BPromise=require(_0xbd76('0x2'));var rs=require(_0xbd76('0x3'));var fs=require('fs');var Redis=require(_0xbd76('0x4'));var db=require(_0xbd76('0x5'))['db'];var utils=require(_0xbd76('0x6'));var logger=require(_0xbd76('0x7'))(_0xbd76('0x8'));var config=require(_0xbd76('0x9'));var jayson=require(_0xbd76('0xa'));var client=jayson['client'][_0xbd76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57ef01,_0x105ba6,_0x54a6ac){return new BPromise(function(_0x7501f9,_0x5a055d){return client[_0xbd76('0xc')](_0x57ef01,_0x54a6ac)['then'](function(_0x253bc4){logger[_0xbd76('0xd')](_0xbd76('0xe'),_0x105ba6,'request\x20sent');logger[_0xbd76('0xf')](_0xbd76('0x10'),_0x105ba6,_0xbd76('0x11'),JSON['stringify'](_0x253bc4));if(_0x253bc4[_0xbd76('0x12')]){if(_0x253bc4[_0xbd76('0x12')][_0xbd76('0x13')]===0x1f4){logger[_0xbd76('0x12')](_0xbd76('0xe'),_0x105ba6,_0x253bc4[_0xbd76('0x12')][_0xbd76('0x14')]);return _0x5a055d(_0x253bc4[_0xbd76('0x12')][_0xbd76('0x14')]);}logger[_0xbd76('0x12')](_0xbd76('0xe'),_0x105ba6,_0x253bc4['error']['message']);return _0x7501f9(_0x253bc4[_0xbd76('0x12')][_0xbd76('0x14')]);}else{logger[_0xbd76('0xd')](_0xbd76('0xe'),_0x105ba6,_0xbd76('0x11'));_0x7501f9(_0x253bc4[_0xbd76('0x15')]['message']);}})['catch'](function(_0x74e80f){logger[_0xbd76('0x12')](_0xbd76('0xe'),_0x105ba6,_0x74e80f);_0x5a055d(_0x74e80f);});});}exports[_0xbd76('0x16')]=function(_0x134591){var _0x1440ed=this;return new Promise(function(_0x2e4744,_0x4abce6){return db[_0xbd76('0x17')][_0xbd76('0x18')]({'raw':_0x134591[_0xbd76('0x19')]?_0x134591[_0xbd76('0x19')][_0xbd76('0x1a')]===undefined?!![]:![]:!![],'where':_0x134591[_0xbd76('0x19')]?_0x134591['options']['where']||null:null,'attributes':_0x134591[_0xbd76('0x19')]?_0x134591[_0xbd76('0x19')]['attributes']||null:null,'limit':_0x134591[_0xbd76('0x19')]?_0x134591[_0xbd76('0x19')]['limit']||null:null,'include':_0x134591[_0xbd76('0x19')]?_0x134591['options'][_0xbd76('0x1b')]?_[_0xbd76('0x1c')](_0x134591[_0xbd76('0x19')]['include'],function(_0x50081c){return{'model':db[_0x50081c[_0xbd76('0x1d')]],'as':_0x50081c['as'],'attributes':_0x50081c[_0xbd76('0x1e')],'include':_0x50081c[_0xbd76('0x1b')]?_['map'](_0x50081c[_0xbd76('0x1b')],function(_0x53d722){return{'model':db[_0x53d722[_0xbd76('0x1d')]],'as':_0x53d722['as'],'attributes':_0x53d722[_0xbd76('0x1e')],'include':_0x53d722[_0xbd76('0x1b')]?_[_0xbd76('0x1c')](_0x53d722[_0xbd76('0x1b')],function(_0x248226){return{'model':db[_0x248226[_0xbd76('0x1d')]],'as':_0x248226['as'],'attributes':_0x248226[_0xbd76('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbd76('0x1f')](function(_0x18f6ac){logger['info'](_0xbd76('0x16'),_0x134591);logger[_0xbd76('0xf')](_0xbd76('0x16'),_0x134591,JSON[_0xbd76('0x20')](_0x18f6ac));_0x2e4744(_0x18f6ac);})['catch'](function(_0x385819){logger[_0xbd76('0x12')](_0xbd76('0x16'),_0x385819['message'],_0x134591);_0x4abce6(_0x1440ed[_0xbd76('0x12')](0x1f4,_0x385819[_0xbd76('0x14')]));});});};exports[_0xbd76('0x21')]=function(_0x249cab){var _0x5e44e8=this;return new Promise(function(_0x6d6ed5,_0x2c55d2){return db[_0xbd76('0x17')][_0xbd76('0x22')]({'raw':_0x249cab[_0xbd76('0x19')]?_0x249cab[_0xbd76('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x249cab[_0xbd76('0x19')]?_0x249cab[_0xbd76('0x19')][_0xbd76('0x23')]||null:null,'attributes':_0x249cab[_0xbd76('0x19')]?_0x249cab['options'][_0xbd76('0x1e')]||null:null,'include':_0x249cab[_0xbd76('0x19')]?_0x249cab[_0xbd76('0x19')]['include']?_[_0xbd76('0x1c')](_0x249cab[_0xbd76('0x19')][_0xbd76('0x1b')],function(_0x3d4297){return{'model':db[_0x3d4297['model']],'as':_0x3d4297['as'],'attributes':_0x3d4297[_0xbd76('0x1e')],'include':_0x3d4297[_0xbd76('0x1b')]?_[_0xbd76('0x1c')](_0x3d4297['include'],function(_0x1d7f2c){return{'model':db[_0x1d7f2c[_0xbd76('0x1d')]],'as':_0x1d7f2c['as'],'attributes':_0x1d7f2c[_0xbd76('0x1e')],'include':_0x1d7f2c[_0xbd76('0x1b')]?_['map'](_0x1d7f2c[_0xbd76('0x1b')],function(_0x1c7145){return{'model':db[_0x1c7145['model']],'as':_0x1c7145['as'],'attributes':_0x1c7145[_0xbd76('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbd76('0x1f')](function(_0x963f41){logger[_0xbd76('0xd')](_0xbd76('0x21'),_0x249cab);logger[_0xbd76('0xf')](_0xbd76('0x21'),_0x249cab,JSON[_0xbd76('0x20')](_0x963f41));_0x6d6ed5(_0x963f41);})[_0xbd76('0x24')](function(_0xeb3669){logger['error'](_0xbd76('0x21'),_0xeb3669['message'],_0x249cab);_0x2c55d2(_0x5e44e8[_0xbd76('0x12')](0x1f4,_0xeb3669[_0xbd76('0x14')]));});});}; \ No newline at end of file +var _0x6a9d=['http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','result','catch','GetDeskAccount','findAll','options','raw','where','map','model','attributes','include','then','ShowDeskAccount','DeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5ee300,_0x59f054){var _0x15717b=function(_0x476c78){while(--_0x476c78){_0x5ee300['push'](_0x5ee300['shift']());}};_0x15717b(++_0x59f054);}(_0x6a9d,0x89));var _0xd6a9=function(_0x801e27,_0x322f08){_0x801e27=_0x801e27-0x0;var _0x24b258=_0x6a9d[_0x801e27];return _0x24b258;};'use strict';var _=require(_0xd6a9('0x0'));var util=require('util');var moment=require(_0xd6a9('0x1'));var BPromise=require(_0xd6a9('0x2'));var rs=require(_0xd6a9('0x3'));var fs=require('fs');var Redis=require(_0xd6a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6a9('0x5'));var logger=require(_0xd6a9('0x6'))(_0xd6a9('0x7'));var config=require(_0xd6a9('0x8'));var jayson=require(_0xd6a9('0x9'));var client=jayson[_0xd6a9('0xa')][_0xd6a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x472390,_0x21d866,_0x531d84){return new BPromise(function(_0xc5f81c,_0x1bacd6){return client[_0xd6a9('0xc')](_0x472390,_0x531d84)['then'](function(_0x8c4f4c){logger[_0xd6a9('0xd')]('DeskAccount,\x20%s,\x20%s',_0x21d866,_0xd6a9('0xe'));logger[_0xd6a9('0xf')](_0xd6a9('0x10'),_0x21d866,'request\x20sent',JSON[_0xd6a9('0x11')](_0x8c4f4c));if(_0x8c4f4c[_0xd6a9('0x12')]){if(_0x8c4f4c[_0xd6a9('0x12')][_0xd6a9('0x13')]===0x1f4){logger[_0xd6a9('0x12')]('DeskAccount,\x20%s,\x20%s',_0x21d866,_0x8c4f4c[_0xd6a9('0x12')]['message']);return _0x1bacd6(_0x8c4f4c[_0xd6a9('0x12')]['message']);}logger[_0xd6a9('0x12')]('DeskAccount,\x20%s,\x20%s',_0x21d866,_0x8c4f4c[_0xd6a9('0x12')][_0xd6a9('0x14')]);return _0xc5f81c(_0x8c4f4c[_0xd6a9('0x12')][_0xd6a9('0x14')]);}else{logger[_0xd6a9('0xd')](_0xd6a9('0x15'),_0x21d866,_0xd6a9('0xe'));_0xc5f81c(_0x8c4f4c[_0xd6a9('0x16')][_0xd6a9('0x14')]);}})[_0xd6a9('0x17')](function(_0x5e54ba){logger['error'](_0xd6a9('0x15'),_0x21d866,_0x5e54ba);_0x1bacd6(_0x5e54ba);});});}exports[_0xd6a9('0x18')]=function(_0x198ec5){var _0x1a3d2f=this;return new Promise(function(_0x2dbf23,_0x2c1b2b){return db['DeskAccount'][_0xd6a9('0x19')]({'raw':_0x198ec5[_0xd6a9('0x1a')]?_0x198ec5[_0xd6a9('0x1a')][_0xd6a9('0x1b')]===undefined?!![]:![]:!![],'where':_0x198ec5[_0xd6a9('0x1a')]?_0x198ec5['options'][_0xd6a9('0x1c')]||null:null,'attributes':_0x198ec5[_0xd6a9('0x1a')]?_0x198ec5[_0xd6a9('0x1a')]['attributes']||null:null,'limit':_0x198ec5[_0xd6a9('0x1a')]?_0x198ec5[_0xd6a9('0x1a')]['limit']||null:null,'include':_0x198ec5[_0xd6a9('0x1a')]?_0x198ec5[_0xd6a9('0x1a')]['include']?_[_0xd6a9('0x1d')](_0x198ec5[_0xd6a9('0x1a')]['include'],function(_0x2c4ff8){return{'model':db[_0x2c4ff8[_0xd6a9('0x1e')]],'as':_0x2c4ff8['as'],'attributes':_0x2c4ff8[_0xd6a9('0x1f')],'include':_0x2c4ff8[_0xd6a9('0x20')]?_[_0xd6a9('0x1d')](_0x2c4ff8[_0xd6a9('0x20')],function(_0x779fb6){return{'model':db[_0x779fb6[_0xd6a9('0x1e')]],'as':_0x779fb6['as'],'attributes':_0x779fb6[_0xd6a9('0x1f')],'include':_0x779fb6[_0xd6a9('0x20')]?_[_0xd6a9('0x1d')](_0x779fb6[_0xd6a9('0x20')],function(_0x1ae051){return{'model':db[_0x1ae051[_0xd6a9('0x1e')]],'as':_0x1ae051['as'],'attributes':_0x1ae051[_0xd6a9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd6a9('0x21')](function(_0x4f830f){logger[_0xd6a9('0xd')](_0xd6a9('0x18'),_0x198ec5);logger['debug'](_0xd6a9('0x18'),_0x198ec5,JSON[_0xd6a9('0x11')](_0x4f830f));_0x2dbf23(_0x4f830f);})[_0xd6a9('0x17')](function(_0x89e7db){logger['error'](_0xd6a9('0x18'),_0x89e7db['message'],_0x198ec5);_0x2c1b2b(_0x1a3d2f[_0xd6a9('0x12')](0x1f4,_0x89e7db[_0xd6a9('0x14')]));});});};exports[_0xd6a9('0x22')]=function(_0x584518){var _0x2e008f=this;return new Promise(function(_0x286cbb,_0x3b8f77){return db[_0xd6a9('0x23')][_0xd6a9('0x24')]({'raw':_0x584518[_0xd6a9('0x1a')]?_0x584518[_0xd6a9('0x1a')][_0xd6a9('0x1b')]===undefined?!![]:![]:!![],'where':_0x584518[_0xd6a9('0x1a')]?_0x584518[_0xd6a9('0x1a')][_0xd6a9('0x1c')]||null:null,'attributes':_0x584518[_0xd6a9('0x1a')]?_0x584518[_0xd6a9('0x1a')][_0xd6a9('0x1f')]||null:null,'include':_0x584518['options']?_0x584518[_0xd6a9('0x1a')][_0xd6a9('0x20')]?_[_0xd6a9('0x1d')](_0x584518[_0xd6a9('0x1a')][_0xd6a9('0x20')],function(_0x50bef7){return{'model':db[_0x50bef7['model']],'as':_0x50bef7['as'],'attributes':_0x50bef7[_0xd6a9('0x1f')],'include':_0x50bef7['include']?_[_0xd6a9('0x1d')](_0x50bef7[_0xd6a9('0x20')],function(_0x4615c7){return{'model':db[_0x4615c7[_0xd6a9('0x1e')]],'as':_0x4615c7['as'],'attributes':_0x4615c7['attributes'],'include':_0x4615c7['include']?_[_0xd6a9('0x1d')](_0x4615c7[_0xd6a9('0x20')],function(_0x1e64c2){return{'model':db[_0x1e64c2[_0xd6a9('0x1e')]],'as':_0x1e64c2['as'],'attributes':_0x1e64c2[_0xd6a9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd6a9('0x21')](function(_0x327da8){logger[_0xd6a9('0xd')](_0xd6a9('0x22'),_0x584518);logger[_0xd6a9('0xf')](_0xd6a9('0x22'),_0x584518,JSON[_0xd6a9('0x11')](_0x327da8));_0x286cbb(_0x327da8);})['catch'](function(_0xf7ba74){logger[_0xd6a9('0x12')](_0xd6a9('0x22'),_0xf7ba74[_0xd6a9('0x14')],_0x584518);_0x3b8f77(_0x2e008f[_0xd6a9('0x12')](0x1f4,_0xf7ba74[_0xd6a9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 0556afc..7ef6b62 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 _0x7374=['index','get','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller'];(function(_0x1a49fc,_0x527071){var _0x5589fc=function(_0x1bf972){while(--_0x1bf972){_0x1a49fc['push'](_0x1a49fc['shift']());}};_0x5589fc(++_0x527071);}(_0x7374,0x1b9));var _0x4737=function(_0x2a67dc,_0x59b6df){_0x2a67dc=_0x2a67dc-0x0;var _0x379fb3=_0x7374[_0x2a67dc];return _0x379fb3;};'use strict';var multer=require(_0x4737('0x0'));var util=require(_0x4737('0x1'));var path=require(_0x4737('0x2'));var timeout=require(_0x4737('0x3'));var express=require(_0x4737('0x4'));var router=express['Router']();var auth=require(_0x4737('0x5'));var interaction=require(_0x4737('0x6'));var config=require(_0x4737('0x7'));var controller=require(_0x4737('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4737('0x9')]);router[_0x4737('0xa')](_0x4737('0xb'),auth[_0x4737('0xc')](),controller['show']);router[_0x4737('0xa')](_0x4737('0xd'),auth[_0x4737('0xc')](),controller[_0x4737('0xe')]);router[_0x4737('0xa')]('/:id/subjects',auth[_0x4737('0xc')](),controller[_0x4737('0xf')]);router[_0x4737('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x4737('0x10')]);router[_0x4737('0xa')](_0x4737('0x11'),auth[_0x4737('0xc')](),controller[_0x4737('0x12')]);router[_0x4737('0x13')]('/',auth[_0x4737('0xc')](),controller[_0x4737('0x14')]);router[_0x4737('0x13')]('/:id/tags',auth[_0x4737('0xc')](),controller[_0x4737('0x15')]);router[_0x4737('0x16')](_0x4737('0xb'),auth[_0x4737('0xc')](),controller['update']);router['delete'](_0x4737('0xb'),auth['isAuthenticated'](),controller[_0x4737('0x17')]);module[_0x4737('0x18')]=router; \ No newline at end of file +var _0x4991=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','put','update','delete','destroy','exports','multer','path','express'];(function(_0xd3990b,_0x50c98e){var _0x3e4a44=function(_0x56a094){while(--_0x56a094){_0xd3990b['push'](_0xd3990b['shift']());}};_0x3e4a44(++_0x50c98e);}(_0x4991,0xf7));var _0x1499=function(_0x4dbf1c,_0x222da9){_0x4dbf1c=_0x4dbf1c-0x0;var _0x5d0cb3=_0x4991[_0x4dbf1c];return _0x5d0cb3;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var auth=require(_0x1499('0x4'));var interaction=require(_0x1499('0x5'));var config=require(_0x1499('0x6'));var controller=require(_0x1499('0x7'));router[_0x1499('0x8')]('/',auth[_0x1499('0x9')](),controller['index']);router[_0x1499('0x8')](_0x1499('0xa'),auth[_0x1499('0x9')](),controller[_0x1499('0xb')]);router[_0x1499('0x8')](_0x1499('0xc'),auth[_0x1499('0x9')](),controller[_0x1499('0xd')]);router['get'](_0x1499('0xe'),auth[_0x1499('0x9')](),controller['getSubjects']);router[_0x1499('0x8')](_0x1499('0xf'),auth['isAuthenticated'](),controller[_0x1499('0x10')]);router[_0x1499('0x8')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0x1499('0x11')]('/',auth[_0x1499('0x9')](),controller[_0x1499('0x12')]);router[_0x1499('0x11')](_0x1499('0x13'),auth['isAuthenticated'](),controller['setTags']);router[_0x1499('0x14')]('/:id',auth[_0x1499('0x9')](),controller[_0x1499('0x15')]);router[_0x1499('0x16')](_0x1499('0xa'),auth['isAuthenticated'](),controller[_0x1499('0x17')]);module[_0x1499('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 4100086..8d9ae76 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 _0x3b43=['exports','STRING','sequelize'];(function(_0x557beb,_0x1a4de9){var _0x5bb13c=function(_0x5d4ba3){while(--_0x5d4ba3){_0x557beb['push'](_0x557beb['shift']());}};_0x5bb13c(++_0x1a4de9);}(_0x3b43,0x1c1));var _0x33b4=function(_0x26e4ea,_0x436d35){_0x26e4ea=_0x26e4ea-0x0;var _0x483409=_0x3b43[_0x26e4ea];return _0x483409;};'use strict';var Sequelize=require(_0x33b4('0x0'));module[_0x33b4('0x1')]={'name':{'type':Sequelize[_0x33b4('0x2')]},'description':{'type':Sequelize[_0x33b4('0x2')]}}; \ No newline at end of file +var _0x5ed1=['exports','STRING','sequelize'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x5ed1,0xf5));var _0x15ed=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x5ed1[_0xce93c];return _0x230720;};'use strict';var Sequelize=require(_0x15ed('0x0'));module[_0x15ed('0x1')]={'name':{'type':Sequelize[_0x15ed('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 d48f329..8ce3b25 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 _0x0207=['info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result','catch','json','count','offset','limit','status','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','DeskConfiguration','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','params','getFields','DeskField','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then'];(function(_0x45e9d3,_0xa7eada){var _0x511220=function(_0x5c2c90){while(--_0x5c2c90){_0x45e9d3['push'](_0x45e9d3['shift']());}};_0x511220(++_0xa7eada);}(_0x0207,0x162));var _0x7020=function(_0x4fdc45,_0x2bd675){_0x4fdc45=_0x4fdc45-0x0;var _0x18230f=_0x0207[_0x4fdc45];return _0x18230f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7020('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7020('0x1'));var rp=require(_0x7020('0x2'));var moment=require(_0x7020('0x3'));var BPromise=require(_0x7020('0x4'));var Mustache=require(_0x7020('0x5'));var util=require(_0x7020('0x6'));var path=require(_0x7020('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7020('0x8'));var fs=require('fs');var _=require(_0x7020('0x9'));var squel=require(_0x7020('0xa'));var crypto=require(_0x7020('0xb'));var jsforce=require(_0x7020('0xc'));var deskjs=require(_0x7020('0xd'));var toCsv=require(_0x7020('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7020('0xf'));var authService=require(_0x7020('0x10'));var qs=require(_0x7020('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7020('0x12'));var logger=require(_0x7020('0x13'))('api');var utils=require(_0x7020('0x14'));var config=require(_0x7020('0x15'));var db=require(_0x7020('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7020('0x17')][_0x7020('0x18')]({'port':0x232a});function checkPasswordPattern(_0xd41aed,_0x1bedde,_0x3ae8f5){if(_0x3ae8f5){var _0x5e47f5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e47f5[_0x7020('0x19')](_0x1bedde)){return _0xd41aed;}else{throw new db['Sequelize'][(_0x7020('0x1a'))](_0x7020('0x1b'));}}else{return _0xd41aed;}}function respondWithRpcPromise(_0x12da12,_0x176190,_0x17260e,_0x308324){return new BPromise(function(_0x55c8b9,_0x36f895){var _0x5bcda5=_0x308324||client;return _0x5bcda5[_0x7020('0x1c')](_0x12da12,_0x17260e)[_0x7020('0x1d')](function(_0x1a3569){logger[_0x7020('0x1e')]('DeskConfiguration,\x20%s,\x20%s',_0x176190,_0x7020('0x1f'));logger[_0x7020('0x20')](_0x7020('0x21'),_0x176190,_0x7020('0x1f'),JSON[_0x7020('0x22')](_0x1a3569));if(_0x1a3569[_0x7020('0x23')]){if(_0x1a3569['error']['code']===0x1f4){logger[_0x7020('0x23')](_0x7020('0x24'),_0x176190,_0x1a3569[_0x7020('0x23')][_0x7020('0x25')]);return _0x36f895(_0x1a3569['error'][_0x7020('0x25')]);}logger[_0x7020('0x23')](_0x7020('0x24'),_0x176190,_0x1a3569[_0x7020('0x23')]['message']);return _0x55c8b9(_0x1a3569[_0x7020('0x23')][_0x7020('0x25')]);}else{logger[_0x7020('0x1e')](_0x7020('0x24'),_0x176190,_0x7020('0x1f'));_0x55c8b9(_0x1a3569[_0x7020('0x26')][_0x7020('0x25')]);}})[_0x7020('0x27')](function(_0x502923){logger[_0x7020('0x23')](_0x7020('0x24'),_0x176190,_0x502923);_0x36f895(_0x502923);});});}function respondWithStatusCode(_0x35b539,_0x5586f8){_0x5586f8=_0x5586f8||0xcc;return function(_0x28f9f0){if(_0x28f9f0){return _0x35b539['sendStatus'](_0x5586f8);}return _0x35b539['status'](_0x5586f8)['end']();};}function respondWithResult(_0x178cbd,_0x55957e){_0x55957e=_0x55957e||0xc8;return function(_0x46b379){if(_0x46b379){return _0x178cbd['status'](_0x55957e)[_0x7020('0x28')](_0x46b379);}};}function respondWithFilteredResult(_0x35103d,_0x32da40){return function(_0x2fd58e){if(_0x2fd58e){var _0xb03bd6=_0x2fd58e[_0x7020('0x29')],_0x1dff20=_0x32da40[_0x7020('0x2a')],_0x2ba734=_0x32da40[_0x7020('0x2a')]+_0x32da40[_0x7020('0x2b')],_0x15a1cc;if(_0x2ba734>=_0xb03bd6){_0x2ba734=_0xb03bd6;_0x15a1cc=0xc8;}else{_0x15a1cc=0xce;}_0x35103d[_0x7020('0x2c')](_0x15a1cc);return _0x35103d['set'](_0x7020('0x2d'),_0x1dff20+'-'+_0x2ba734+'/'+_0xb03bd6)[_0x7020('0x28')](_0x2fd58e);}return null;};}function patchUpdates(_0x351778){return function(_0x191eda){try{jsonpatch[_0x7020('0x2e')](_0x191eda,_0x351778,!![]);}catch(_0x3a4e3d){return BPromise[_0x7020('0x2f')](_0x3a4e3d);}return _0x191eda[_0x7020('0x30')]();};}function saveUpdates(_0x166b2d,_0x39a568){return function(_0x1646ed){if(_0x1646ed){return _0x1646ed[_0x7020('0x31')](_0x166b2d)[_0x7020('0x1d')](function(_0x1e45cd){return _0x1e45cd;});}return null;};}function removeEntity(_0x56b9b6,_0x451b57){return function(_0x978000){if(_0x978000){return _0x978000[_0x7020('0x32')]()[_0x7020('0x1d')](function(){_0x56b9b6[_0x7020('0x2c')](0xcc)[_0x7020('0x33')]();});}};}function handleEntityNotFound(_0x165c20,_0x37a6b5){return function(_0x11dc0e){if(!_0x11dc0e){_0x165c20[_0x7020('0x34')](0x194);}return _0x11dc0e;};}function handleError(_0x2bff37,_0x30191b){_0x30191b=_0x30191b||0x1f4;return function(_0x2294da){logger[_0x7020('0x23')](_0x2294da['stack']);if(_0x2294da[_0x7020('0x35')]){delete _0x2294da[_0x7020('0x35')];}_0x2bff37[_0x7020('0x2c')](_0x30191b)['send'](_0x2294da);};}exports[_0x7020('0x36')]=function(_0x1236ae,_0x3bf437){var _0x371b27={},_0x1f65a6={},_0x24160e={'count':0x0,'rows':[]};var _0x5ce36b=_[_0x7020('0x37')](db['DeskConfiguration']['rawAttributes'],function(_0x47a147){return{'name':_0x47a147[_0x7020('0x38')],'type':_0x47a147[_0x7020('0x39')][_0x7020('0x3a')]};});_0x1f65a6[_0x7020('0x3b')]=_[_0x7020('0x37')](_0x5ce36b,'name');_0x1f65a6['query']=_[_0x7020('0x3c')](_0x1236ae[_0x7020('0x3d')]);_0x1f65a6[_0x7020('0x3e')]=_[_0x7020('0x3f')](_0x1f65a6['model'],_0x1f65a6[_0x7020('0x3d')]);_0x371b27['attributes']=_[_0x7020('0x3f')](_0x1f65a6[_0x7020('0x3b')],qs[_0x7020('0x40')](_0x1236ae['query']['fields']));_0x371b27[_0x7020('0x41')]=_0x371b27['attributes'][_0x7020('0x42')]?_0x371b27[_0x7020('0x41')]:_0x1f65a6['model'];if(!_0x1236ae[_0x7020('0x3d')][_0x7020('0x43')](_0x7020('0x44'))){_0x371b27['limit']=qs[_0x7020('0x2b')](_0x1236ae['query'][_0x7020('0x2b')]);_0x371b27[_0x7020('0x2a')]=qs[_0x7020('0x2a')](_0x1236ae['query'][_0x7020('0x2a')]);}_0x371b27[_0x7020('0x45')]=qs[_0x7020('0x46')](_0x1236ae[_0x7020('0x3d')][_0x7020('0x46')]);_0x371b27['where']=qs[_0x7020('0x3e')](_[_0x7020('0x47')](_0x1236ae[_0x7020('0x3d')],_0x1f65a6[_0x7020('0x3e')]),_0x5ce36b);if(_0x1236ae['query'][_0x7020('0x48')]){_0x371b27['where']=_['merge'](_0x371b27['where'],{'$or':_[_0x7020('0x37')](_0x5ce36b,function(_0x569e94){if(_0x569e94[_0x7020('0x39')]!==_0x7020('0x49')){var _0x18037d={};_0x18037d[_0x569e94['name']]={'$like':'%'+_0x1236ae[_0x7020('0x3d')]['filter']+'%'};return _0x18037d;}})});}_0x371b27=_[_0x7020('0x4a')]({},_0x371b27,_0x1236ae[_0x7020('0x4b')]);var _0x19c9d4={'where':_0x371b27[_0x7020('0x4c')]};return db[_0x7020('0x4d')][_0x7020('0x29')](_0x19c9d4)[_0x7020('0x1d')](function(_0x364a84){_0x24160e[_0x7020('0x29')]=_0x364a84;if(_0x1236ae[_0x7020('0x3d')][_0x7020('0x4e')]){_0x371b27[_0x7020('0x4f')]=[{'all':!![]}];}return db[_0x7020('0x4d')][_0x7020('0x50')](_0x371b27);})[_0x7020('0x1d')](function(_0x241ff1){_0x24160e[_0x7020('0x51')]=_0x241ff1;return _0x24160e;})[_0x7020('0x1d')](respondWithFilteredResult(_0x3bf437,_0x371b27))['catch'](handleError(_0x3bf437,null));};exports[_0x7020('0x52')]=function(_0x1acda5,_0x1b8198){var _0x2a3344={'raw':![],'where':{'id':_0x1acda5['params']['id']}},_0x41f642={};_0x41f642['model']=_[_0x7020('0x3c')](db['DeskConfiguration'][_0x7020('0x53')]);_0x41f642[_0x7020('0x3d')]=_[_0x7020('0x3c')](_0x1acda5[_0x7020('0x3d')]);_0x41f642['filters']=_['intersection'](_0x41f642[_0x7020('0x3b')],_0x41f642[_0x7020('0x3d')]);_0x2a3344[_0x7020('0x41')]=_[_0x7020('0x3f')](_0x41f642[_0x7020('0x3b')],qs[_0x7020('0x40')](_0x1acda5[_0x7020('0x3d')][_0x7020('0x40')]));_0x2a3344[_0x7020('0x41')]=_0x2a3344[_0x7020('0x41')][_0x7020('0x42')]?_0x2a3344[_0x7020('0x41')]:_0x41f642['model'];if(_0x1acda5['query']['includeAll']){_0x2a3344[_0x7020('0x4f')]=[{'all':!![]}];}_0x2a3344=_['merge']({},_0x2a3344,_0x1acda5[_0x7020('0x4b')]);return db[_0x7020('0x4d')][_0x7020('0x54')](_0x2a3344)[_0x7020('0x1d')](handleEntityNotFound(_0x1b8198,null))[_0x7020('0x1d')](respondWithResult(_0x1b8198,null))[_0x7020('0x27')](handleError(_0x1b8198,null));};exports[_0x7020('0x55')]=function(_0x5bf6b5,_0x1dc476){return db['DeskConfiguration'][_0x7020('0x55')](_0x5bf6b5[_0x7020('0x56')],{})[_0x7020('0x1d')](respondWithResult(_0x1dc476,0xc9))[_0x7020('0x27')](handleError(_0x1dc476,null));};exports[_0x7020('0x31')]=function(_0x381a95,_0x440f7e){if(_0x381a95['body']['id']){delete _0x381a95[_0x7020('0x56')]['id'];}return db[_0x7020('0x4d')][_0x7020('0x54')]({'where':{'id':_0x381a95[_0x7020('0x57')]['id']}})['then'](handleEntityNotFound(_0x440f7e,null))['then'](saveUpdates(_0x381a95['body'],null))[_0x7020('0x1d')](respondWithResult(_0x440f7e,null))[_0x7020('0x27')](handleError(_0x440f7e,null));};exports[_0x7020('0x32')]=function(_0x40b31c,_0x45ee73){return db[_0x7020('0x4d')]['find']({'where':{'id':_0x40b31c[_0x7020('0x57')]['id']}})[_0x7020('0x1d')](handleEntityNotFound(_0x45ee73,null))[_0x7020('0x1d')](removeEntity(_0x45ee73,null))[_0x7020('0x27')](handleError(_0x45ee73,null));};exports[_0x7020('0x58')]=function(_0x29732c,_0xe23a08,_0x1bdcc7){var _0x3644d5={};var _0x5b7a18={};var _0x265d18;var _0x54b65e;return db[_0x7020('0x4d')]['findOne']({'where':{'id':_0x29732c['params']['id']}})[_0x7020('0x1d')](handleEntityNotFound(_0xe23a08,null))[_0x7020('0x1d')](function(_0xf4a3e4){if(_0xf4a3e4){_0x265d18=_0xf4a3e4;_0x5b7a18['model']=_[_0x7020('0x3c')](db[_0x7020('0x59')][_0x7020('0x53')]);_0x5b7a18[_0x7020('0x3d')]=_[_0x7020('0x3c')](_0x29732c[_0x7020('0x3d')]);_0x5b7a18[_0x7020('0x3e')]=_[_0x7020('0x3f')](_0x5b7a18[_0x7020('0x3b')],_0x5b7a18['query']);_0x3644d5[_0x7020('0x41')]=_[_0x7020('0x3f')](_0x5b7a18[_0x7020('0x3b')],qs[_0x7020('0x40')](_0x29732c[_0x7020('0x3d')]['fields']));_0x3644d5[_0x7020('0x41')]=_0x3644d5[_0x7020('0x41')]['length']?_0x3644d5[_0x7020('0x41')]:_0x5b7a18[_0x7020('0x3b')];_0x3644d5[_0x7020('0x45')]=qs['sort'](_0x29732c['query'][_0x7020('0x46')]);_0x3644d5[_0x7020('0x4c')]=qs[_0x7020('0x3e')](_[_0x7020('0x47')](_0x29732c[_0x7020('0x3d')],_0x5b7a18[_0x7020('0x3e')]));if(_0x29732c[_0x7020('0x3d')][_0x7020('0x48')]){_0x3644d5[_0x7020('0x4c')]=_[_0x7020('0x4a')](_0x3644d5['where'],{'$or':_['map'](_0x3644d5['attributes'],function(_0xc54b44){var _0x26a7ae={};_0x26a7ae[_0xc54b44]={'$like':'%'+_0x29732c[_0x7020('0x3d')]['filter']+'%'};return _0x26a7ae;})});}_0x3644d5=_[_0x7020('0x4a')]({},_0x3644d5,_0x29732c[_0x7020('0x4b')]);return _0x265d18[_0x7020('0x58')](_0x3644d5);}})[_0x7020('0x1d')](function(_0x27d1b3){if(_0x27d1b3){_0x54b65e=_0x27d1b3[_0x7020('0x42')];if(!_0x29732c[_0x7020('0x3d')][_0x7020('0x43')](_0x7020('0x44'))){_0x3644d5['limit']=qs['limit'](_0x29732c[_0x7020('0x3d')]['limit']);_0x3644d5['offset']=qs[_0x7020('0x2a')](_0x29732c['query']['offset']);}return _0x265d18[_0x7020('0x58')](_0x3644d5);}})[_0x7020('0x1d')](function(_0x2672d2){if(_0x2672d2){return _0x2672d2?{'count':_0x54b65e,'rows':_0x2672d2}:null;}})[_0x7020('0x1d')](respondWithResult(_0xe23a08,null))[_0x7020('0x27')](handleError(_0xe23a08,null));};exports['getSubjects']=function(_0x47c9b5,_0x4eafc0,_0xe4241c){var _0x426c50={};var _0x122c37={};var _0x77d041;var _0x2f4aaf;return db['DeskConfiguration']['findOne']({'where':{'id':_0x47c9b5[_0x7020('0x57')]['id']}})['then'](handleEntityNotFound(_0x4eafc0,null))[_0x7020('0x1d')](function(_0x13c064){if(_0x13c064){_0x77d041=_0x13c064;_0x122c37[_0x7020('0x3b')]=_['keys'](db[_0x7020('0x59')]['rawAttributes']);_0x122c37[_0x7020('0x3d')]=_['keys'](_0x47c9b5['query']);_0x122c37[_0x7020('0x3e')]=_[_0x7020('0x3f')](_0x122c37[_0x7020('0x3b')],_0x122c37[_0x7020('0x3d')]);_0x426c50[_0x7020('0x41')]=_[_0x7020('0x3f')](_0x122c37[_0x7020('0x3b')],qs[_0x7020('0x40')](_0x47c9b5[_0x7020('0x3d')]['fields']));_0x426c50['attributes']=_0x426c50[_0x7020('0x41')]['length']?_0x426c50[_0x7020('0x41')]:_0x122c37['model'];_0x426c50[_0x7020('0x45')]=qs[_0x7020('0x46')](_0x47c9b5[_0x7020('0x3d')][_0x7020('0x46')]);_0x426c50[_0x7020('0x4c')]=qs[_0x7020('0x3e')](_[_0x7020('0x47')](_0x47c9b5[_0x7020('0x3d')],_0x122c37['filters']));if(_0x47c9b5[_0x7020('0x3d')][_0x7020('0x48')]){_0x426c50[_0x7020('0x4c')]=_[_0x7020('0x4a')](_0x426c50[_0x7020('0x4c')],{'$or':_[_0x7020('0x37')](_0x426c50['attributes'],function(_0x1f3176){var _0x2f5851={};_0x2f5851[_0x1f3176]={'$like':'%'+_0x47c9b5[_0x7020('0x3d')][_0x7020('0x48')]+'%'};return _0x2f5851;})});}_0x426c50=_[_0x7020('0x4a')]({},_0x426c50,_0x47c9b5['options']);return _0x77d041[_0x7020('0x5a')](_0x426c50);}})[_0x7020('0x1d')](function(_0x4488a6){if(_0x4488a6){_0x2f4aaf=_0x4488a6[_0x7020('0x42')];if(!_0x47c9b5['query'][_0x7020('0x43')](_0x7020('0x44'))){_0x426c50['limit']=qs[_0x7020('0x2b')](_0x47c9b5[_0x7020('0x3d')]['limit']);_0x426c50['offset']=qs['offset'](_0x47c9b5[_0x7020('0x3d')][_0x7020('0x2a')]);}return _0x77d041[_0x7020('0x5a')](_0x426c50);}})[_0x7020('0x1d')](function(_0x314d4d){if(_0x314d4d){return _0x314d4d?{'count':_0x2f4aaf,'rows':_0x314d4d}:null;}})[_0x7020('0x1d')](respondWithResult(_0x4eafc0,null))[_0x7020('0x27')](handleError(_0x4eafc0,null));};exports[_0x7020('0x5b')]=function(_0x2b0d0f,_0x4bc838,_0x4a9048){var _0x35ff2f={};var _0x46419b={};var _0x30df99;var _0x5e8ec4;return db[_0x7020('0x4d')][_0x7020('0x5c')]({'where':{'id':_0x2b0d0f['params']['id']}})['then'](handleEntityNotFound(_0x4bc838,null))['then'](function(_0x476547){if(_0x476547){_0x30df99=_0x476547;_0x46419b[_0x7020('0x3b')]=_['keys'](db['DeskField'][_0x7020('0x53')]);_0x46419b['query']=_[_0x7020('0x3c')](_0x2b0d0f['query']);_0x46419b['filters']=_[_0x7020('0x3f')](_0x46419b[_0x7020('0x3b')],_0x46419b[_0x7020('0x3d')]);_0x35ff2f[_0x7020('0x41')]=_[_0x7020('0x3f')](_0x46419b[_0x7020('0x3b')],qs['fields'](_0x2b0d0f[_0x7020('0x3d')]['fields']));_0x35ff2f[_0x7020('0x41')]=_0x35ff2f[_0x7020('0x41')][_0x7020('0x42')]?_0x35ff2f[_0x7020('0x41')]:_0x46419b[_0x7020('0x3b')];_0x35ff2f[_0x7020('0x45')]=qs[_0x7020('0x46')](_0x2b0d0f[_0x7020('0x3d')]['sort']);_0x35ff2f[_0x7020('0x4c')]=qs[_0x7020('0x3e')](_[_0x7020('0x47')](_0x2b0d0f[_0x7020('0x3d')],_0x46419b[_0x7020('0x3e')]));if(_0x2b0d0f[_0x7020('0x3d')][_0x7020('0x48')]){_0x35ff2f[_0x7020('0x4c')]=_['merge'](_0x35ff2f['where'],{'$or':_[_0x7020('0x37')](_0x35ff2f[_0x7020('0x41')],function(_0x250541){var _0x2d9850={};_0x2d9850[_0x250541]={'$like':'%'+_0x2b0d0f[_0x7020('0x3d')]['filter']+'%'};return _0x2d9850;})});}_0x35ff2f=_[_0x7020('0x4a')]({},_0x35ff2f,_0x2b0d0f['options']);return _0x30df99['getDescriptions'](_0x35ff2f);}})[_0x7020('0x1d')](function(_0x4238c6){if(_0x4238c6){_0x5e8ec4=_0x4238c6['length'];if(!_0x2b0d0f[_0x7020('0x3d')][_0x7020('0x43')]('nolimit')){_0x35ff2f[_0x7020('0x2b')]=qs[_0x7020('0x2b')](_0x2b0d0f[_0x7020('0x3d')][_0x7020('0x2b')]);_0x35ff2f[_0x7020('0x2a')]=qs[_0x7020('0x2a')](_0x2b0d0f[_0x7020('0x3d')][_0x7020('0x2a')]);}return _0x30df99[_0x7020('0x5b')](_0x35ff2f);}})[_0x7020('0x1d')](function(_0x380038){if(_0x380038){return _0x380038?{'count':_0x5e8ec4,'rows':_0x380038}:null;}})[_0x7020('0x1d')](respondWithResult(_0x4bc838,null))[_0x7020('0x27')](handleError(_0x4bc838,null));};exports[_0x7020('0x5d')]=function(_0x26e00d,_0x1e22a5,_0x4e996b){var _0x1decb3={};var _0x155cd9={};var _0x26b2e8;var _0xf9be9f;return db[_0x7020('0x4d')][_0x7020('0x5c')]({'where':{'id':_0x26e00d[_0x7020('0x57')]['id']}})['then'](handleEntityNotFound(_0x1e22a5,null))['then'](function(_0x259ead){if(_0x259ead){_0x26b2e8=_0x259ead;_0x155cd9['model']=_[_0x7020('0x3c')](db[_0x7020('0x5e')][_0x7020('0x53')]);_0x155cd9[_0x7020('0x3d')]=_['keys'](_0x26e00d[_0x7020('0x3d')]);_0x155cd9[_0x7020('0x3e')]=_[_0x7020('0x3f')](_0x155cd9[_0x7020('0x3b')],_0x155cd9['query']);_0x1decb3['attributes']=_[_0x7020('0x3f')](_0x155cd9[_0x7020('0x3b')],qs[_0x7020('0x40')](_0x26e00d[_0x7020('0x3d')][_0x7020('0x40')]));_0x1decb3[_0x7020('0x41')]=_0x1decb3[_0x7020('0x41')]['length']?_0x1decb3['attributes']:_0x155cd9['model'];_0x1decb3[_0x7020('0x45')]=qs[_0x7020('0x46')](_0x26e00d[_0x7020('0x3d')][_0x7020('0x46')]);_0x1decb3['where']=qs[_0x7020('0x3e')](_[_0x7020('0x47')](_0x26e00d['query'],_0x155cd9[_0x7020('0x3e')]));if(_0x26e00d[_0x7020('0x3d')][_0x7020('0x48')]){_0x1decb3[_0x7020('0x4c')]=_[_0x7020('0x4a')](_0x1decb3['where'],{'$or':_[_0x7020('0x37')](_0x1decb3['attributes'],function(_0x238da4){var _0x1a553a={};_0x1a553a[_0x238da4]={'$like':'%'+_0x26e00d[_0x7020('0x3d')]['filter']+'%'};return _0x1a553a;})});}_0x1decb3=_[_0x7020('0x4a')]({},_0x1decb3,_0x26e00d[_0x7020('0x4b')]);return _0x26b2e8['getTags'](_0x1decb3);}})[_0x7020('0x1d')](function(_0x510738){if(_0x510738){_0xf9be9f=_0x510738[_0x7020('0x42')];if(!_0x26e00d[_0x7020('0x3d')][_0x7020('0x43')](_0x7020('0x44'))){_0x1decb3[_0x7020('0x2b')]=qs['limit'](_0x26e00d['query']['limit']);_0x1decb3[_0x7020('0x2a')]=qs['offset'](_0x26e00d[_0x7020('0x3d')][_0x7020('0x2a')]);}return _0x26b2e8[_0x7020('0x5d')](_0x1decb3);}})[_0x7020('0x1d')](function(_0x46f053){if(_0x46f053){return _0x46f053?{'count':_0xf9be9f,'rows':_0x46f053}:null;}})[_0x7020('0x1d')](respondWithResult(_0x1e22a5,null))[_0x7020('0x27')](handleError(_0x1e22a5,null));};exports[_0x7020('0x5f')]=function(_0x2507e8,_0x12e63c,_0x370460){if(_0x2507e8[_0x7020('0x56')]['id']){delete _0x2507e8[_0x7020('0x56')]['id'];}return db[_0x7020('0x4d')]['findOne']({'where':{'id':_0x2507e8[_0x7020('0x57')]['id']}})[_0x7020('0x1d')](handleEntityNotFound(_0x12e63c,null))[_0x7020('0x1d')](function(_0x4dd4f6){if(_0x4dd4f6){return _0x4dd4f6[_0x7020('0x5f')](_0x2507e8[_0x7020('0x56')]['ids']||[]);}return null;})['then'](respondWithResult(_0x12e63c,null))['catch'](handleError(_0x12e63c,null));}; \ No newline at end of file +var _0x177a=['VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','getFields','findOne','DeskField','order','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','sendStatus','name','send','index','DeskConfiguration','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x177a,0xdd));var _0xa177=function(_0x3f4a6b,_0x3dacec){_0x3f4a6b=_0x3f4a6b-0x0;var _0x1c8abc=_0x177a[_0x3f4a6b];return _0x1c8abc;};'use strict';var pdf=require(_0xa177('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa177('0x1'));var jsonpatch=require(_0xa177('0x2'));var rp=require(_0xa177('0x3'));var moment=require(_0xa177('0x4'));var BPromise=require(_0xa177('0x5'));var Mustache=require(_0xa177('0x6'));var util=require('util');var path=require(_0xa177('0x7'));var sox=require(_0xa177('0x8'));var csv=require(_0xa177('0x9'));var ejs=require(_0xa177('0xa'));var fs=require('fs');var _=require(_0xa177('0xb'));var squel=require(_0xa177('0xc'));var crypto=require(_0xa177('0xd'));var jsforce=require(_0xa177('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa177('0x9'));var querystring=require('querystring');var Papa=require(_0xa177('0xf'));var Redis=require(_0xa177('0x10'));var authService=require(_0xa177('0x11'));var qs=require(_0xa177('0x12'));var as=require(_0xa177('0x13'));var hardwareService=require(_0xa177('0x14'));var logger=require(_0xa177('0x15'))('api');var utils=require(_0xa177('0x16'));var config=require(_0xa177('0x17'));var db=require(_0xa177('0x18'))['db'];var jayson=require(_0xa177('0x19'));var client=jayson[_0xa177('0x1a')][_0xa177('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x26c738,_0x548bbf,_0x4e4d95){if(_0x4e4d95){var _0xca78d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xca78d4[_0xa177('0x1c')](_0x548bbf)){return _0x26c738;}else{throw new db[(_0xa177('0x1d'))][(_0xa177('0x1e'))](_0xa177('0x1f'));}}else{return _0x26c738;}}function respondWithRpcPromise(_0x1beaa0,_0x258985,_0xbc9fa4,_0x278633){return new BPromise(function(_0x3c1443,_0x26be7a){var _0x24a35e=_0x278633||client;return _0x24a35e['request'](_0x1beaa0,_0xbc9fa4)[_0xa177('0x20')](function(_0x43fc77){logger['info'](_0xa177('0x21'),_0x258985,_0xa177('0x22'));logger[_0xa177('0x23')](_0xa177('0x24'),_0x258985,'request\x20sent',JSON['stringify'](_0x43fc77));if(_0x43fc77['error']){if(_0x43fc77[_0xa177('0x25')][_0xa177('0x26')]===0x1f4){logger[_0xa177('0x25')](_0xa177('0x21'),_0x258985,_0x43fc77['error'][_0xa177('0x27')]);return _0x26be7a(_0x43fc77['error'][_0xa177('0x27')]);}logger['error'](_0xa177('0x21'),_0x258985,_0x43fc77[_0xa177('0x25')][_0xa177('0x27')]);return _0x3c1443(_0x43fc77[_0xa177('0x25')]['message']);}else{logger[_0xa177('0x28')](_0xa177('0x21'),_0x258985,_0xa177('0x22'));_0x3c1443(_0x43fc77['result']['message']);}})['catch'](function(_0x5c57f2){logger[_0xa177('0x25')](_0xa177('0x21'),_0x258985,_0x5c57f2);_0x26be7a(_0x5c57f2);});});}function respondWithStatusCode(_0x1cf775,_0x1b7cec){_0x1b7cec=_0x1b7cec||0xcc;return function(_0xf5d168){if(_0xf5d168){return _0x1cf775['sendStatus'](_0x1b7cec);}return _0x1cf775[_0xa177('0x29')](_0x1b7cec)[_0xa177('0x2a')]();};}function respondWithResult(_0x479587,_0x4c61b1){_0x4c61b1=_0x4c61b1||0xc8;return function(_0x182160){if(_0x182160){return _0x479587['status'](_0x4c61b1)['json'](_0x182160);}};}function respondWithFilteredResult(_0x59d40d,_0x45c513){return function(_0x4c8a61){if(_0x4c8a61){var _0x216cab=_0x4c8a61[_0xa177('0x2b')],_0x3ae38f=_0x45c513[_0xa177('0x2c')],_0x320cce=_0x45c513['offset']+_0x45c513[_0xa177('0x2d')],_0x5f20d4;if(_0x320cce>=_0x216cab){_0x320cce=_0x216cab;_0x5f20d4=0xc8;}else{_0x5f20d4=0xce;}_0x59d40d[_0xa177('0x29')](_0x5f20d4);return _0x59d40d[_0xa177('0x2e')](_0xa177('0x2f'),_0x3ae38f+'-'+_0x320cce+'/'+_0x216cab)[_0xa177('0x30')](_0x4c8a61);}return null;};}function patchUpdates(_0xe7a886){return function(_0x435e56){try{jsonpatch[_0xa177('0x31')](_0x435e56,_0xe7a886,!![]);}catch(_0x592139){return BPromise[_0xa177('0x32')](_0x592139);}return _0x435e56[_0xa177('0x33')]();};}function saveUpdates(_0x4c4ce4,_0x5b8f10){return function(_0x40cd9d){if(_0x40cd9d){return _0x40cd9d['update'](_0x4c4ce4)[_0xa177('0x20')](function(_0x1b7d71){return _0x1b7d71;});}return null;};}function removeEntity(_0x558c8c,_0x26dfd5){return function(_0x3c003a){if(_0x3c003a){return _0x3c003a[_0xa177('0x34')]()['then'](function(){_0x558c8c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cf7fd,_0x54bce7){return function(_0x280acd){if(!_0x280acd){_0x4cf7fd[_0xa177('0x35')](0x194);}return _0x280acd;};}function handleError(_0x1efed3,_0x2b9bd0){_0x2b9bd0=_0x2b9bd0||0x1f4;return function(_0x27c2ae){logger[_0xa177('0x25')](_0x27c2ae['stack']);if(_0x27c2ae[_0xa177('0x36')]){delete _0x27c2ae[_0xa177('0x36')];}_0x1efed3[_0xa177('0x29')](_0x2b9bd0)[_0xa177('0x37')](_0x27c2ae);};}exports[_0xa177('0x38')]=function(_0x33aecc,_0x3d2350){var _0x3d141c={},_0x5ca2a2={},_0x2b92c8={'count':0x0,'rows':[]};var _0x23a1a7=_['map'](db[_0xa177('0x39')]['rawAttributes'],function(_0x319c9c){return{'name':_0x319c9c[_0xa177('0x3a')],'type':_0x319c9c['type'][_0xa177('0x3b')]};});_0x5ca2a2[_0xa177('0x3c')]=_[_0xa177('0x3d')](_0x23a1a7,_0xa177('0x36'));_0x5ca2a2[_0xa177('0x3e')]=_[_0xa177('0x3f')](_0x33aecc[_0xa177('0x3e')]);_0x5ca2a2[_0xa177('0x40')]=_[_0xa177('0x41')](_0x5ca2a2[_0xa177('0x3c')],_0x5ca2a2[_0xa177('0x3e')]);_0x3d141c[_0xa177('0x42')]=_['intersection'](_0x5ca2a2['model'],qs[_0xa177('0x43')](_0x33aecc[_0xa177('0x3e')][_0xa177('0x43')]));_0x3d141c[_0xa177('0x42')]=_0x3d141c[_0xa177('0x42')][_0xa177('0x44')]?_0x3d141c[_0xa177('0x42')]:_0x5ca2a2[_0xa177('0x3c')];if(!_0x33aecc['query']['hasOwnProperty'](_0xa177('0x45'))){_0x3d141c[_0xa177('0x2d')]=qs[_0xa177('0x2d')](_0x33aecc[_0xa177('0x3e')][_0xa177('0x2d')]);_0x3d141c[_0xa177('0x2c')]=qs[_0xa177('0x2c')](_0x33aecc['query'][_0xa177('0x2c')]);}_0x3d141c['order']=qs[_0xa177('0x46')](_0x33aecc[_0xa177('0x3e')][_0xa177('0x46')]);_0x3d141c[_0xa177('0x47')]=qs[_0xa177('0x40')](_[_0xa177('0x48')](_0x33aecc['query'],_0x5ca2a2[_0xa177('0x40')]),_0x23a1a7);if(_0x33aecc[_0xa177('0x3e')][_0xa177('0x49')]){_0x3d141c[_0xa177('0x47')]=_[_0xa177('0x4a')](_0x3d141c[_0xa177('0x47')],{'$or':_['map'](_0x23a1a7,function(_0x368f53){if(_0x368f53[_0xa177('0x4b')]!==_0xa177('0x4c')){var _0x304070={};_0x304070[_0x368f53[_0xa177('0x36')]]={'$like':'%'+_0x33aecc[_0xa177('0x3e')]['filter']+'%'};return _0x304070;}})});}_0x3d141c=_[_0xa177('0x4a')]({},_0x3d141c,_0x33aecc[_0xa177('0x4d')]);var _0x26afd7={'where':_0x3d141c[_0xa177('0x47')]};return db[_0xa177('0x39')][_0xa177('0x2b')](_0x26afd7)[_0xa177('0x20')](function(_0x280d40){_0x2b92c8[_0xa177('0x2b')]=_0x280d40;if(_0x33aecc[_0xa177('0x3e')][_0xa177('0x4e')]){_0x3d141c[_0xa177('0x4f')]=[{'all':!![]}];}return db[_0xa177('0x39')][_0xa177('0x50')](_0x3d141c);})[_0xa177('0x20')](function(_0x14a2c6){_0x2b92c8['rows']=_0x14a2c6;return _0x2b92c8;})[_0xa177('0x20')](respondWithFilteredResult(_0x3d2350,_0x3d141c))[_0xa177('0x51')](handleError(_0x3d2350,null));};exports[_0xa177('0x52')]=function(_0x423817,_0x34d9c4){var _0x54d596={'raw':![],'where':{'id':_0x423817[_0xa177('0x53')]['id']}},_0x2b7ed6={};_0x2b7ed6['model']=_[_0xa177('0x3f')](db[_0xa177('0x39')][_0xa177('0x54')]);_0x2b7ed6[_0xa177('0x3e')]=_[_0xa177('0x3f')](_0x423817[_0xa177('0x3e')]);_0x2b7ed6['filters']=_[_0xa177('0x41')](_0x2b7ed6[_0xa177('0x3c')],_0x2b7ed6[_0xa177('0x3e')]);_0x54d596['attributes']=_[_0xa177('0x41')](_0x2b7ed6[_0xa177('0x3c')],qs[_0xa177('0x43')](_0x423817[_0xa177('0x3e')][_0xa177('0x43')]));_0x54d596[_0xa177('0x42')]=_0x54d596[_0xa177('0x42')]['length']?_0x54d596[_0xa177('0x42')]:_0x2b7ed6[_0xa177('0x3c')];if(_0x423817['query'][_0xa177('0x4e')]){_0x54d596['include']=[{'all':!![]}];}_0x54d596=_[_0xa177('0x4a')]({},_0x54d596,_0x423817['options']);return db[_0xa177('0x39')][_0xa177('0x55')](_0x54d596)[_0xa177('0x20')](handleEntityNotFound(_0x34d9c4,null))[_0xa177('0x20')](respondWithResult(_0x34d9c4,null))[_0xa177('0x51')](handleError(_0x34d9c4,null));};exports[_0xa177('0x56')]=function(_0x1bc494,_0x207bfc){return db[_0xa177('0x39')][_0xa177('0x56')](_0x1bc494[_0xa177('0x57')],{})[_0xa177('0x20')](respondWithResult(_0x207bfc,0xc9))[_0xa177('0x51')](handleError(_0x207bfc,null));};exports['update']=function(_0x442c07,_0xb9359d){if(_0x442c07[_0xa177('0x57')]['id']){delete _0x442c07['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x442c07[_0xa177('0x53')]['id']}})[_0xa177('0x20')](handleEntityNotFound(_0xb9359d,null))[_0xa177('0x20')](saveUpdates(_0x442c07['body'],null))[_0xa177('0x20')](respondWithResult(_0xb9359d,null))[_0xa177('0x51')](handleError(_0xb9359d,null));};exports[_0xa177('0x34')]=function(_0x4306f5,_0x1febe3){return db[_0xa177('0x39')][_0xa177('0x55')]({'where':{'id':_0x4306f5[_0xa177('0x53')]['id']}})[_0xa177('0x20')](handleEntityNotFound(_0x1febe3,null))[_0xa177('0x20')](removeEntity(_0x1febe3,null))[_0xa177('0x51')](handleError(_0x1febe3,null));};exports[_0xa177('0x58')]=function(_0x1f19d3,_0x5f0c57,_0x52be95){var _0x126261={};var _0x2421d8={};var _0x381afc;var _0x2c08e5;return db[_0xa177('0x39')][_0xa177('0x59')]({'where':{'id':_0x1f19d3[_0xa177('0x53')]['id']}})['then'](handleEntityNotFound(_0x5f0c57,null))[_0xa177('0x20')](function(_0x42e7e8){if(_0x42e7e8){_0x381afc=_0x42e7e8;_0x2421d8['model']=_[_0xa177('0x3f')](db[_0xa177('0x5a')][_0xa177('0x54')]);_0x2421d8['query']=_['keys'](_0x1f19d3[_0xa177('0x3e')]);_0x2421d8[_0xa177('0x40')]=_[_0xa177('0x41')](_0x2421d8[_0xa177('0x3c')],_0x2421d8[_0xa177('0x3e')]);_0x126261[_0xa177('0x42')]=_[_0xa177('0x41')](_0x2421d8['model'],qs[_0xa177('0x43')](_0x1f19d3[_0xa177('0x3e')][_0xa177('0x43')]));_0x126261[_0xa177('0x42')]=_0x126261[_0xa177('0x42')][_0xa177('0x44')]?_0x126261['attributes']:_0x2421d8['model'];_0x126261[_0xa177('0x5b')]=qs[_0xa177('0x46')](_0x1f19d3['query']['sort']);_0x126261[_0xa177('0x47')]=qs[_0xa177('0x40')](_[_0xa177('0x48')](_0x1f19d3[_0xa177('0x3e')],_0x2421d8[_0xa177('0x40')]));if(_0x1f19d3[_0xa177('0x3e')][_0xa177('0x49')]){_0x126261[_0xa177('0x47')]=_['merge'](_0x126261[_0xa177('0x47')],{'$or':_[_0xa177('0x3d')](_0x126261['attributes'],function(_0x407d1f){var _0x5e936a={};_0x5e936a[_0x407d1f]={'$like':'%'+_0x1f19d3['query'][_0xa177('0x49')]+'%'};return _0x5e936a;})});}_0x126261=_['merge']({},_0x126261,_0x1f19d3['options']);return _0x381afc['getFields'](_0x126261);}})[_0xa177('0x20')](function(_0x45b0cc){if(_0x45b0cc){_0x2c08e5=_0x45b0cc[_0xa177('0x44')];if(!_0x1f19d3['query']['hasOwnProperty']('nolimit')){_0x126261[_0xa177('0x2d')]=qs[_0xa177('0x2d')](_0x1f19d3[_0xa177('0x3e')][_0xa177('0x2d')]);_0x126261['offset']=qs['offset'](_0x1f19d3[_0xa177('0x3e')][_0xa177('0x2c')]);}return _0x381afc['getFields'](_0x126261);}})[_0xa177('0x20')](function(_0x54a4fb){if(_0x54a4fb){return _0x54a4fb?{'count':_0x2c08e5,'rows':_0x54a4fb}:null;}})[_0xa177('0x20')](respondWithResult(_0x5f0c57,null))['catch'](handleError(_0x5f0c57,null));};exports['getSubjects']=function(_0x4bd3eb,_0x1b8d26,_0x128623){var _0x128b5f={};var _0x12bdb1={};var _0x23311d;var _0x1e7981;return db[_0xa177('0x39')][_0xa177('0x59')]({'where':{'id':_0x4bd3eb[_0xa177('0x53')]['id']}})[_0xa177('0x20')](handleEntityNotFound(_0x1b8d26,null))[_0xa177('0x20')](function(_0x2411b3){if(_0x2411b3){_0x23311d=_0x2411b3;_0x12bdb1[_0xa177('0x3c')]=_[_0xa177('0x3f')](db[_0xa177('0x5a')][_0xa177('0x54')]);_0x12bdb1[_0xa177('0x3e')]=_[_0xa177('0x3f')](_0x4bd3eb['query']);_0x12bdb1[_0xa177('0x40')]=_[_0xa177('0x41')](_0x12bdb1['model'],_0x12bdb1[_0xa177('0x3e')]);_0x128b5f[_0xa177('0x42')]=_['intersection'](_0x12bdb1[_0xa177('0x3c')],qs[_0xa177('0x43')](_0x4bd3eb[_0xa177('0x3e')][_0xa177('0x43')]));_0x128b5f[_0xa177('0x42')]=_0x128b5f['attributes'][_0xa177('0x44')]?_0x128b5f['attributes']:_0x12bdb1[_0xa177('0x3c')];_0x128b5f[_0xa177('0x5b')]=qs[_0xa177('0x46')](_0x4bd3eb['query'][_0xa177('0x46')]);_0x128b5f[_0xa177('0x47')]=qs[_0xa177('0x40')](_[_0xa177('0x48')](_0x4bd3eb['query'],_0x12bdb1[_0xa177('0x40')]));if(_0x4bd3eb[_0xa177('0x3e')]['filter']){_0x128b5f['where']=_[_0xa177('0x4a')](_0x128b5f[_0xa177('0x47')],{'$or':_[_0xa177('0x3d')](_0x128b5f[_0xa177('0x42')],function(_0x30bb63){var _0x5ce02c={};_0x5ce02c[_0x30bb63]={'$like':'%'+_0x4bd3eb['query'][_0xa177('0x49')]+'%'};return _0x5ce02c;})});}_0x128b5f=_[_0xa177('0x4a')]({},_0x128b5f,_0x4bd3eb[_0xa177('0x4d')]);return _0x23311d['getSubjects'](_0x128b5f);}})[_0xa177('0x20')](function(_0xa81d26){if(_0xa81d26){_0x1e7981=_0xa81d26['length'];if(!_0x4bd3eb['query'][_0xa177('0x5c')]('nolimit')){_0x128b5f[_0xa177('0x2d')]=qs[_0xa177('0x2d')](_0x4bd3eb[_0xa177('0x3e')]['limit']);_0x128b5f[_0xa177('0x2c')]=qs['offset'](_0x4bd3eb[_0xa177('0x3e')]['offset']);}return _0x23311d[_0xa177('0x5d')](_0x128b5f);}})['then'](function(_0x301e01){if(_0x301e01){return _0x301e01?{'count':_0x1e7981,'rows':_0x301e01}:null;}})[_0xa177('0x20')](respondWithResult(_0x1b8d26,null))[_0xa177('0x51')](handleError(_0x1b8d26,null));};exports[_0xa177('0x5e')]=function(_0x546152,_0x22b4b3,_0x3097a8){var _0x12cfe9={};var _0x42d760={};var _0x14da8a;var _0x464e6b;return db[_0xa177('0x39')][_0xa177('0x59')]({'where':{'id':_0x546152[_0xa177('0x53')]['id']}})[_0xa177('0x20')](handleEntityNotFound(_0x22b4b3,null))[_0xa177('0x20')](function(_0x25f897){if(_0x25f897){_0x14da8a=_0x25f897;_0x42d760[_0xa177('0x3c')]=_[_0xa177('0x3f')](db[_0xa177('0x5a')][_0xa177('0x54')]);_0x42d760[_0xa177('0x3e')]=_[_0xa177('0x3f')](_0x546152[_0xa177('0x3e')]);_0x42d760[_0xa177('0x40')]=_[_0xa177('0x41')](_0x42d760[_0xa177('0x3c')],_0x42d760[_0xa177('0x3e')]);_0x12cfe9[_0xa177('0x42')]=_['intersection'](_0x42d760[_0xa177('0x3c')],qs[_0xa177('0x43')](_0x546152[_0xa177('0x3e')][_0xa177('0x43')]));_0x12cfe9[_0xa177('0x42')]=_0x12cfe9[_0xa177('0x42')]['length']?_0x12cfe9[_0xa177('0x42')]:_0x42d760['model'];_0x12cfe9[_0xa177('0x5b')]=qs[_0xa177('0x46')](_0x546152[_0xa177('0x3e')][_0xa177('0x46')]);_0x12cfe9['where']=qs['filters'](_[_0xa177('0x48')](_0x546152[_0xa177('0x3e')],_0x42d760[_0xa177('0x40')]));if(_0x546152[_0xa177('0x3e')][_0xa177('0x49')]){_0x12cfe9[_0xa177('0x47')]=_['merge'](_0x12cfe9[_0xa177('0x47')],{'$or':_[_0xa177('0x3d')](_0x12cfe9[_0xa177('0x42')],function(_0x48dc4d){var _0x49186b={};_0x49186b[_0x48dc4d]={'$like':'%'+_0x546152[_0xa177('0x3e')]['filter']+'%'};return _0x49186b;})});}_0x12cfe9=_['merge']({},_0x12cfe9,_0x546152[_0xa177('0x4d')]);return _0x14da8a[_0xa177('0x5e')](_0x12cfe9);}})['then'](function(_0x1ca046){if(_0x1ca046){_0x464e6b=_0x1ca046['length'];if(!_0x546152[_0xa177('0x3e')]['hasOwnProperty'](_0xa177('0x45'))){_0x12cfe9[_0xa177('0x2d')]=qs[_0xa177('0x2d')](_0x546152[_0xa177('0x3e')][_0xa177('0x2d')]);_0x12cfe9[_0xa177('0x2c')]=qs['offset'](_0x546152['query'][_0xa177('0x2c')]);}return _0x14da8a[_0xa177('0x5e')](_0x12cfe9);}})[_0xa177('0x20')](function(_0x530d76){if(_0x530d76){return _0x530d76?{'count':_0x464e6b,'rows':_0x530d76}:null;}})[_0xa177('0x20')](respondWithResult(_0x22b4b3,null))[_0xa177('0x51')](handleError(_0x22b4b3,null));};exports[_0xa177('0x5f')]=function(_0x9a13a1,_0x4ec0b7,_0x485c97){var _0x43681a={};var _0x224a86={};var _0x230ed5;var _0x5d7157;return db[_0xa177('0x39')][_0xa177('0x59')]({'where':{'id':_0x9a13a1[_0xa177('0x53')]['id']}})['then'](handleEntityNotFound(_0x4ec0b7,null))[_0xa177('0x20')](function(_0x15073e){if(_0x15073e){_0x230ed5=_0x15073e;_0x224a86[_0xa177('0x3c')]=_[_0xa177('0x3f')](db[_0xa177('0x60')]['rawAttributes']);_0x224a86[_0xa177('0x3e')]=_[_0xa177('0x3f')](_0x9a13a1[_0xa177('0x3e')]);_0x224a86[_0xa177('0x40')]=_[_0xa177('0x41')](_0x224a86[_0xa177('0x3c')],_0x224a86[_0xa177('0x3e')]);_0x43681a[_0xa177('0x42')]=_[_0xa177('0x41')](_0x224a86[_0xa177('0x3c')],qs[_0xa177('0x43')](_0x9a13a1[_0xa177('0x3e')][_0xa177('0x43')]));_0x43681a[_0xa177('0x42')]=_0x43681a[_0xa177('0x42')][_0xa177('0x44')]?_0x43681a[_0xa177('0x42')]:_0x224a86[_0xa177('0x3c')];_0x43681a[_0xa177('0x5b')]=qs[_0xa177('0x46')](_0x9a13a1['query'][_0xa177('0x46')]);_0x43681a['where']=qs['filters'](_[_0xa177('0x48')](_0x9a13a1[_0xa177('0x3e')],_0x224a86[_0xa177('0x40')]));if(_0x9a13a1[_0xa177('0x3e')][_0xa177('0x49')]){_0x43681a['where']=_[_0xa177('0x4a')](_0x43681a[_0xa177('0x47')],{'$or':_[_0xa177('0x3d')](_0x43681a['attributes'],function(_0x53ef06){var _0x5df8f4={};_0x5df8f4[_0x53ef06]={'$like':'%'+_0x9a13a1[_0xa177('0x3e')][_0xa177('0x49')]+'%'};return _0x5df8f4;})});}_0x43681a=_['merge']({},_0x43681a,_0x9a13a1[_0xa177('0x4d')]);return _0x230ed5[_0xa177('0x5f')](_0x43681a);}})[_0xa177('0x20')](function(_0x4599e7){if(_0x4599e7){_0x5d7157=_0x4599e7['length'];if(!_0x9a13a1[_0xa177('0x3e')][_0xa177('0x5c')](_0xa177('0x45'))){_0x43681a['limit']=qs['limit'](_0x9a13a1['query'][_0xa177('0x2d')]);_0x43681a['offset']=qs[_0xa177('0x2c')](_0x9a13a1[_0xa177('0x3e')][_0xa177('0x2c')]);}return _0x230ed5[_0xa177('0x5f')](_0x43681a);}})['then'](function(_0x10b3cf){if(_0x10b3cf){return _0x10b3cf?{'count':_0x5d7157,'rows':_0x10b3cf}:null;}})['then'](respondWithResult(_0x4ec0b7,null))['catch'](handleError(_0x4ec0b7,null));};exports[_0xa177('0x61')]=function(_0x48a75a,_0x4a410b,_0x47ee8d){if(_0x48a75a[_0xa177('0x57')]['id']){delete _0x48a75a[_0xa177('0x57')]['id'];}return db[_0xa177('0x39')][_0xa177('0x59')]({'where':{'id':_0x48a75a['params']['id']}})[_0xa177('0x20')](handleEntityNotFound(_0x4a410b,null))['then'](function(_0x499be5){if(_0x499be5){return _0x499be5[_0xa177('0x61')](_0x48a75a[_0xa177('0x57')][_0xa177('0x62')]||[]);}return null;})['then'](respondWithResult(_0x4a410b,null))[_0xa177('0x51')](handleError(_0x4a410b,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 8e5d0ed..553b50a 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 _0x9b55=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','DeskConfiguration','lodash'];(function(_0x3ebd14,_0x3f3e59){var _0x5b4757=function(_0x7e274d){while(--_0x7e274d){_0x3ebd14['push'](_0x3ebd14['shift']());}};_0x5b4757(++_0x3f3e59);}(_0x9b55,0x78));var _0x59b5=function(_0x2918c4,_0x110da0){_0x2918c4=_0x2918c4-0x0;var _0x38bfe7=_0x9b55[_0x2918c4];return _0x38bfe7;};'use strict';var _=require(_0x59b5('0x0'));var util=require(_0x59b5('0x1'));var logger=require(_0x59b5('0x2'))(_0x59b5('0x3'));var moment=require(_0x59b5('0x4'));var BPromise=require(_0x59b5('0x5'));var rp=require(_0x59b5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x59b5('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0x59b5('0x8')]=function(_0x2467a3,_0x250a69){return _0x2467a3[_0x59b5('0x9')](_0x59b5('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98a6=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x47d351,_0x549ba3){var _0x3b9fe8=function(_0x277e2e){while(--_0x277e2e){_0x47d351['push'](_0x47d351['shift']());}};_0x3b9fe8(++_0x549ba3);}(_0x98a6,0x13e));var _0x698a=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x98a6[_0x11946c];return _0x383935;};'use strict';var _=require(_0x698a('0x0'));var util=require(_0x698a('0x1'));var logger=require(_0x698a('0x2'))('api');var moment=require(_0x698a('0x3'));var BPromise=require(_0x698a('0x4'));var rp=require(_0x698a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x698a('0x6'));var config=require('../../config/environment');var attributes=require(_0x698a('0x7'));module[_0x698a('0x8')]=function(_0x4e15ea,_0x5b4181){return _0x4e15ea['define'](_0x698a('0x9'),attributes,{'tableName':_0x698a('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 8341f0c..2ab4d3c 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 _0x4e34=['error','code','message','DeskConfiguration,\x20%s,\x20%s','request\x20sent','catch','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4e34,0x19e));var _0x44e3=function(_0x5d900a,_0x54c3ed){_0x5d900a=_0x5d900a-0x0;var _0x3b5c14=_0x4e34[_0x5d900a];return _0x3b5c14;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x44e3('0x0'));var BPromise=require(_0x44e3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44e3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x44e3('0x3'))(_0x44e3('0x4'));var config=require(_0x44e3('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x44e3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x19e7de,_0x163879,_0x1ca56e){return new BPromise(function(_0x37b7d4,_0x196941){return client[_0x44e3('0x7')](_0x19e7de,_0x1ca56e)['then'](function(_0xf7e448){logger[_0x44e3('0x8')]('DeskConfiguration,\x20%s,\x20%s',_0x163879,'request\x20sent');logger[_0x44e3('0x9')](_0x44e3('0xa'),_0x163879,'request\x20sent',JSON['stringify'](_0xf7e448));if(_0xf7e448[_0x44e3('0xb')]){if(_0xf7e448[_0x44e3('0xb')][_0x44e3('0xc')]===0x1f4){logger[_0x44e3('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x163879,_0xf7e448[_0x44e3('0xb')][_0x44e3('0xd')]);return _0x196941(_0xf7e448[_0x44e3('0xb')][_0x44e3('0xd')]);}logger[_0x44e3('0xb')](_0x44e3('0xe'),_0x163879,_0xf7e448[_0x44e3('0xb')][_0x44e3('0xd')]);return _0x37b7d4(_0xf7e448['error'][_0x44e3('0xd')]);}else{logger['info'](_0x44e3('0xe'),_0x163879,_0x44e3('0xf'));_0x37b7d4(_0xf7e448['result'][_0x44e3('0xd')]);}})[_0x44e3('0x10')](function(_0x103eb0){logger[_0x44e3('0xb')](_0x44e3('0xe'),_0x163879,_0x103eb0);_0x196941(_0x103eb0);});});} \ No newline at end of file +var _0x915a=['error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x1ae410,_0x5abb3b){var _0x39da71=function(_0x468589){while(--_0x468589){_0x1ae410['push'](_0x1ae410['shift']());}};_0x39da71(++_0x5abb3b);}(_0x915a,0x1d2));var _0xa915=function(_0x1202f5,_0x5c96aa){_0x1202f5=_0x1202f5-0x0;var _0x74571f=_0x915a[_0x1202f5];return _0x74571f;};'use strict';var _=require(_0xa915('0x0'));var util=require(_0xa915('0x1'));var moment=require(_0xa915('0x2'));var BPromise=require(_0xa915('0x3'));var rs=require(_0xa915('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa915('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa915('0x6'));var config=require(_0xa915('0x7'));var jayson=require(_0xa915('0x8'));var client=jayson[_0xa915('0x9')][_0xa915('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f5e00,_0x4e4368,_0x483a83){return new BPromise(function(_0x3f5b1b,_0x43bfc9){return client[_0xa915('0xb')](_0x3f5e00,_0x483a83)[_0xa915('0xc')](function(_0x5cfcec){logger['info'](_0xa915('0xd'),_0x4e4368,'request\x20sent');logger[_0xa915('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4e4368,_0xa915('0xf'),JSON[_0xa915('0x10')](_0x5cfcec));if(_0x5cfcec[_0xa915('0x11')]){if(_0x5cfcec[_0xa915('0x11')]['code']===0x1f4){logger['error'](_0xa915('0xd'),_0x4e4368,_0x5cfcec['error'][_0xa915('0x12')]);return _0x43bfc9(_0x5cfcec['error'][_0xa915('0x12')]);}logger[_0xa915('0x11')](_0xa915('0xd'),_0x4e4368,_0x5cfcec[_0xa915('0x11')][_0xa915('0x12')]);return _0x3f5b1b(_0x5cfcec[_0xa915('0x11')]['message']);}else{logger[_0xa915('0x13')](_0xa915('0xd'),_0x4e4368,_0xa915('0xf'));_0x3f5b1b(_0x5cfcec['result'][_0xa915('0x12')]);}})[_0xa915('0x14')](function(_0x24609e){logger[_0xa915('0x11')](_0xa915('0xd'),_0x4e4368,_0x24609e);_0x43bfc9(_0x24609e);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 34ece2a..b2a5a73 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 _0x4c97=['index','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x4abb5a,_0x500456){var _0x5572e6=function(_0x47f1d1){while(--_0x47f1d1){_0x4abb5a['push'](_0x4abb5a['shift']());}};_0x5572e6(++_0x500456);}(_0x4c97,0x14b));var _0x74c9=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x4c97[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0x74c9('0x0'));var util=require(_0x74c9('0x1'));var path=require('path');var timeout=require(_0x74c9('0x2'));var express=require(_0x74c9('0x3'));var router=express['Router']();var auth=require(_0x74c9('0x4'));var interaction=require(_0x74c9('0x5'));var config=require(_0x74c9('0x6'));var controller=require(_0x74c9('0x7'));router[_0x74c9('0x8')]('/',auth['isAuthenticated'](),controller[_0x74c9('0x9')]);router[_0x74c9('0x8')](_0x74c9('0xa'),auth[_0x74c9('0xb')](),controller[_0x74c9('0xc')]);router['post']('/',auth[_0x74c9('0xb')](),controller[_0x74c9('0xd')]);router[_0x74c9('0xe')]('/:id',auth[_0x74c9('0xb')](),controller['update']);router['delete'](_0x74c9('0xa'),auth['isAuthenticated'](),controller[_0x74c9('0xf')]);module[_0x74c9('0x10')]=router; \ No newline at end of file +var _0x2ff9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','show','post','put','/:id','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x1007c6,_0x1c38ee){var _0x4cb083=function(_0x544e75){while(--_0x544e75){_0x1007c6['push'](_0x1007c6['shift']());}};_0x4cb083(++_0x1c38ee);}(_0x2ff9,0xc7));var _0x92ff=function(_0x2c0f01,_0x4e3d78){_0x2c0f01=_0x2c0f01-0x0;var _0x1aa1f5=_0x2ff9[_0x2c0f01];return _0x1aa1f5;};'use strict';var multer=require('multer');var util=require(_0x92ff('0x0'));var path=require(_0x92ff('0x1'));var timeout=require(_0x92ff('0x2'));var express=require(_0x92ff('0x3'));var router=express[_0x92ff('0x4')]();var auth=require(_0x92ff('0x5'));var interaction=require(_0x92ff('0x6'));var config=require(_0x92ff('0x7'));var controller=require(_0x92ff('0x8'));router['get']('/',auth[_0x92ff('0x9')](),controller['index']);router[_0x92ff('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x92ff('0xb')]);router[_0x92ff('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x92ff('0xd')](_0x92ff('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x92ff('0xf')](_0x92ff('0xe'),auth[_0x92ff('0x9')](),controller[_0x92ff('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 6d9a271..0885c20 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 _0x4840=['ENUM','string','variable','customVariable','keyValue','STRING','exports'];(function(_0x2d502d,_0x14cf66){var _0x2d2c3f=function(_0x208d36){while(--_0x208d36){_0x2d502d['push'](_0x2d502d['shift']());}};_0x2d2c3f(++_0x14cf66);}(_0x4840,0x6f));var _0x0484=function(_0x45f575,_0x3ae51c){_0x45f575=_0x45f575-0x0;var _0xd8e1a1=_0x4840[_0x45f575];return _0xd8e1a1;};'use strict';var Sequelize=require('sequelize');module[_0x0484('0x0')]={'type':{'type':Sequelize[_0x0484('0x1')](_0x0484('0x2'),_0x0484('0x3'),_0x0484('0x4'),_0x0484('0x5')),'defaultValue':_0x0484('0x2')},'content':{'type':Sequelize[_0x0484('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0484('0x1')](_0x0484('0x2'),_0x0484('0x3'),_0x0484('0x4'))},'keyContent':{'type':Sequelize[_0x0484('0x6')]},'idField':{'type':Sequelize[_0x0484('0x6')]},'nameField':{'type':Sequelize[_0x0484('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0484('0x6')]}}; \ No newline at end of file +var _0xb1ca=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x17a21b,_0x54a005){var _0x506e52=function(_0x4139a9){while(--_0x4139a9){_0x17a21b['push'](_0x17a21b['shift']());}};_0x506e52(++_0x54a005);}(_0xb1ca,0xa5));var _0xab1c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xb1ca[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xab1c('0x0'));module[_0xab1c('0x1')]={'type':{'type':Sequelize[_0xab1c('0x2')](_0xab1c('0x3'),'variable',_0xab1c('0x4'),_0xab1c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xab1c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xab1c('0x2')](_0xab1c('0x3'),_0xab1c('0x7'),_0xab1c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xab1c('0x6')]},'nameField':{'type':Sequelize[_0xab1c('0x6')]},'customField':{'type':Sequelize[_0xab1c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab1c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 7c92333..f1821e1 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 _0x6469=['../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','DeskField','fieldName','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','params','rawAttributes','keys','include','find','catch','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x46a8e,_0x493b90){var _0xeb06e1=function(_0x482636){while(--_0x482636){_0x46a8e['push'](_0x46a8e['shift']());}};_0xeb06e1(++_0x493b90);}(_0x6469,0x7f));var _0x9646=function(_0x2a9ecf,_0x465b06){_0x2a9ecf=_0x2a9ecf-0x0;var _0x853928=_0x6469[_0x2a9ecf];return _0x853928;};'use strict';var pdf=require(_0x9646('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9646('0x1'));var jsonpatch=require(_0x9646('0x2'));var rp=require(_0x9646('0x3'));var moment=require(_0x9646('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9646('0x5'));var util=require('util');var path=require(_0x9646('0x6'));var sox=require(_0x9646('0x7'));var csv=require(_0x9646('0x8'));var ejs=require(_0x9646('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9646('0xa'));var crypto=require(_0x9646('0xb'));var jsforce=require(_0x9646('0xc'));var deskjs=require(_0x9646('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9646('0xe'));var Papa=require(_0x9646('0xf'));var Redis=require(_0x9646('0x10'));var authService=require(_0x9646('0x11'));var qs=require(_0x9646('0x12'));var as=require(_0x9646('0x13'));var hardwareService=require(_0x9646('0x14'));var logger=require(_0x9646('0x15'))('api');var utils=require(_0x9646('0x16'));var config=require(_0x9646('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x220811,_0x54fe97){_0x54fe97=_0x54fe97||0xcc;return function(_0x3059ae){if(_0x3059ae){return _0x220811[_0x9646('0x18')](_0x54fe97);}return _0x220811[_0x9646('0x19')](_0x54fe97)[_0x9646('0x1a')]();};}function respondWithResult(_0x26cf2f,_0xb9b7e4){_0xb9b7e4=_0xb9b7e4||0xc8;return function(_0x33ad0c){if(_0x33ad0c){return _0x26cf2f[_0x9646('0x19')](_0xb9b7e4)[_0x9646('0x1b')](_0x33ad0c);}};}function respondWithFilteredResult(_0x2ba92f,_0x3520ce){return function(_0x44dbc6){if(_0x44dbc6){var _0x259e55=_0x44dbc6[_0x9646('0x1c')],_0x5d2e20=_0x3520ce[_0x9646('0x1d')],_0x5db985=_0x3520ce[_0x9646('0x1d')]+_0x3520ce[_0x9646('0x1e')],_0x233311;if(_0x5db985>=_0x259e55){_0x5db985=_0x259e55;_0x233311=0xc8;}else{_0x233311=0xce;}_0x2ba92f[_0x9646('0x19')](_0x233311);return _0x2ba92f[_0x9646('0x1f')](_0x9646('0x20'),_0x5d2e20+'-'+_0x5db985+'/'+_0x259e55)[_0x9646('0x1b')](_0x44dbc6);}return null;};}function patchUpdates(_0x5d8b64){return function(_0x28bb72){try{jsonpatch[_0x9646('0x21')](_0x28bb72,_0x5d8b64,!![]);}catch(_0x3a3691){return BPromise[_0x9646('0x22')](_0x3a3691);}return _0x28bb72[_0x9646('0x23')]();};}function saveUpdates(_0x21d6e0,_0x1c18d5){return function(_0x1cf92d){if(_0x1cf92d){return _0x1cf92d[_0x9646('0x24')](_0x21d6e0)[_0x9646('0x25')](function(_0x1d3dad){return _0x1d3dad;});}return null;};}function removeEntity(_0x3fd37e,_0x2d78d0){return function(_0x2c801a){if(_0x2c801a){return _0x2c801a[_0x9646('0x26')]()['then'](function(){_0x3fd37e[_0x9646('0x19')](0xcc)[_0x9646('0x1a')]();});}};}function handleEntityNotFound(_0x32a21a,_0x794d9e){return function(_0x3f824d){if(!_0x3f824d){_0x32a21a[_0x9646('0x18')](0x194);}return _0x3f824d;};}function handleError(_0x648348,_0x708f71){_0x708f71=_0x708f71||0x1f4;return function(_0x5e0f51){logger[_0x9646('0x27')](_0x5e0f51[_0x9646('0x28')]);if(_0x5e0f51[_0x9646('0x29')]){delete _0x5e0f51[_0x9646('0x29')];}_0x648348[_0x9646('0x19')](_0x708f71)[_0x9646('0x2a')](_0x5e0f51);};}exports['index']=function(_0x4f55bf,_0x534d3b){var _0x46d3a7={},_0x30bd60={},_0x1918ec={'count':0x0,'rows':[]};var _0x2ac99a=_[_0x9646('0x2b')](db[_0x9646('0x2c')]['rawAttributes'],function(_0x5906c2){return{'name':_0x5906c2[_0x9646('0x2d')],'type':_0x5906c2['type'][_0x9646('0x2e')]};});_0x30bd60['model']=_[_0x9646('0x2b')](_0x2ac99a,_0x9646('0x29'));_0x30bd60['query']=_['keys'](_0x4f55bf[_0x9646('0x2f')]);_0x30bd60[_0x9646('0x30')]=_['intersection'](_0x30bd60[_0x9646('0x31')],_0x30bd60['query']);_0x46d3a7['attributes']=_[_0x9646('0x32')](_0x30bd60['model'],qs[_0x9646('0x33')](_0x4f55bf[_0x9646('0x2f')][_0x9646('0x33')]));_0x46d3a7[_0x9646('0x34')]=_0x46d3a7[_0x9646('0x34')][_0x9646('0x35')]?_0x46d3a7[_0x9646('0x34')]:_0x30bd60[_0x9646('0x31')];if(!_0x4f55bf[_0x9646('0x2f')][_0x9646('0x36')](_0x9646('0x37'))){_0x46d3a7[_0x9646('0x1e')]=qs[_0x9646('0x1e')](_0x4f55bf[_0x9646('0x2f')][_0x9646('0x1e')]);_0x46d3a7['offset']=qs[_0x9646('0x1d')](_0x4f55bf['query'][_0x9646('0x1d')]);}_0x46d3a7['order']=qs[_0x9646('0x38')](_0x4f55bf[_0x9646('0x2f')]['sort']);_0x46d3a7[_0x9646('0x39')]=qs[_0x9646('0x30')](_[_0x9646('0x3a')](_0x4f55bf[_0x9646('0x2f')],_0x30bd60[_0x9646('0x30')]),_0x2ac99a);if(_0x4f55bf['query'][_0x9646('0x3b')]){_0x46d3a7[_0x9646('0x39')]=_[_0x9646('0x3c')](_0x46d3a7['where'],{'$or':_[_0x9646('0x2b')](_0x2ac99a,function(_0xfb6b94){if(_0xfb6b94[_0x9646('0x3d')]!=='VIRTUAL'){var _0x1f1185={};_0x1f1185[_0xfb6b94[_0x9646('0x29')]]={'$like':'%'+_0x4f55bf[_0x9646('0x2f')]['filter']+'%'};return _0x1f1185;}})});}_0x46d3a7=_[_0x9646('0x3c')]({},_0x46d3a7,_0x4f55bf[_0x9646('0x3e')]);var _0x2cd33e={'where':_0x46d3a7[_0x9646('0x39')]};return db[_0x9646('0x2c')][_0x9646('0x1c')](_0x2cd33e)[_0x9646('0x25')](function(_0x13026e){_0x1918ec[_0x9646('0x1c')]=_0x13026e;if(_0x4f55bf['query'][_0x9646('0x3f')]){_0x46d3a7['include']=[{'all':!![]}];}return db[_0x9646('0x2c')][_0x9646('0x40')](_0x46d3a7);})[_0x9646('0x25')](function(_0x1cbce4){_0x1918ec[_0x9646('0x41')]=_0x1cbce4;return _0x1918ec;})[_0x9646('0x25')](respondWithFilteredResult(_0x534d3b,_0x46d3a7))['catch'](handleError(_0x534d3b,null));};exports['show']=function(_0x5dd406,_0x770bdf){var _0x42e878={'raw':!![],'where':{'id':_0x5dd406[_0x9646('0x42')]['id']}},_0x1f17af={};_0x1f17af[_0x9646('0x31')]=_['keys'](db[_0x9646('0x2c')][_0x9646('0x43')]);_0x1f17af[_0x9646('0x2f')]=_[_0x9646('0x44')](_0x5dd406[_0x9646('0x2f')]);_0x1f17af[_0x9646('0x30')]=_[_0x9646('0x32')](_0x1f17af[_0x9646('0x31')],_0x1f17af[_0x9646('0x2f')]);_0x42e878[_0x9646('0x34')]=_[_0x9646('0x32')](_0x1f17af[_0x9646('0x31')],qs[_0x9646('0x33')](_0x5dd406[_0x9646('0x2f')][_0x9646('0x33')]));_0x42e878['attributes']=_0x42e878['attributes'][_0x9646('0x35')]?_0x42e878[_0x9646('0x34')]:_0x1f17af[_0x9646('0x31')];if(_0x5dd406[_0x9646('0x2f')][_0x9646('0x3f')]){_0x42e878[_0x9646('0x45')]=[{'all':!![]}];}_0x42e878=_[_0x9646('0x3c')]({},_0x42e878,_0x5dd406[_0x9646('0x3e')]);return db['DeskField'][_0x9646('0x46')](_0x42e878)['then'](handleEntityNotFound(_0x770bdf,null))[_0x9646('0x25')](respondWithResult(_0x770bdf,null))[_0x9646('0x47')](handleError(_0x770bdf,null));};exports['create']=function(_0x32678a,_0x12d412){return db['DeskField'][_0x9646('0x48')](_0x32678a['body'],{})[_0x9646('0x25')](respondWithResult(_0x12d412,0xc9))['catch'](handleError(_0x12d412,null));};exports[_0x9646('0x24')]=function(_0x5a3797,_0x96c1d5){if(_0x5a3797[_0x9646('0x49')]['id']){delete _0x5a3797['body']['id'];}return db[_0x9646('0x2c')][_0x9646('0x46')]({'where':{'id':_0x5a3797[_0x9646('0x42')]['id']}})['then'](handleEntityNotFound(_0x96c1d5,null))[_0x9646('0x25')](saveUpdates(_0x5a3797[_0x9646('0x49')],null))['then'](respondWithResult(_0x96c1d5,null))[_0x9646('0x47')](handleError(_0x96c1d5,null));};exports[_0x9646('0x26')]=function(_0x39221d,_0x1f1300){return db[_0x9646('0x2c')][_0x9646('0x46')]({'where':{'id':_0x39221d['params']['id']}})[_0x9646('0x25')](handleEntityNotFound(_0x1f1300,null))[_0x9646('0x25')](removeEntity(_0x1f1300,null))[_0x9646('0x47')](handleError(_0x1f1300,null));}; \ No newline at end of file +var _0x922b=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','DeskField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','count','offset'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x922b,0x1ef));var _0xb922=function(_0x2f7066,_0x918fd8){_0x2f7066=_0x2f7066-0x0;var _0x4fd176=_0x922b[_0x2f7066];return _0x4fd176;};'use strict';var pdf=require(_0xb922('0x0'));var emlformat=require(_0xb922('0x1'));var rimraf=require(_0xb922('0x2'));var zipdir=require(_0xb922('0x3'));var jsonpatch=require(_0xb922('0x4'));var rp=require('request-promise');var moment=require(_0xb922('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb922('0x6'));var util=require(_0xb922('0x7'));var path=require('path');var sox=require(_0xb922('0x8'));var csv=require(_0xb922('0x9'));var ejs=require(_0xb922('0xa'));var fs=require('fs');var _=require(_0xb922('0xb'));var squel=require('squel');var crypto=require(_0xb922('0xc'));var jsforce=require(_0xb922('0xd'));var deskjs=require(_0xb922('0xe'));var toCsv=require(_0xb922('0x9'));var querystring=require(_0xb922('0xf'));var Papa=require(_0xb922('0x10'));var Redis=require(_0xb922('0x11'));var authService=require(_0xb922('0x12'));var qs=require(_0xb922('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb922('0x14'));var logger=require(_0xb922('0x15'))(_0xb922('0x16'));var utils=require(_0xb922('0x17'));var config=require('../../config/environment');var db=require(_0xb922('0x18'))['db'];function respondWithStatusCode(_0x71732d,_0x3b518c){_0x3b518c=_0x3b518c||0xcc;return function(_0x4a94eb){if(_0x4a94eb){return _0x71732d['sendStatus'](_0x3b518c);}return _0x71732d['status'](_0x3b518c)[_0xb922('0x19')]();};}function respondWithResult(_0x50c874,_0x2eb468){_0x2eb468=_0x2eb468||0xc8;return function(_0x2456d2){if(_0x2456d2){return _0x50c874[_0xb922('0x1a')](_0x2eb468)[_0xb922('0x1b')](_0x2456d2);}};}function respondWithFilteredResult(_0x49e6f1,_0x5df952){return function(_0x2fac0a){if(_0x2fac0a){var _0x13daf7=_0x2fac0a[_0xb922('0x1c')],_0x3c8130=_0x5df952[_0xb922('0x1d')],_0x140e4d=_0x5df952[_0xb922('0x1d')]+_0x5df952['limit'],_0x1c387b;if(_0x140e4d>=_0x13daf7){_0x140e4d=_0x13daf7;_0x1c387b=0xc8;}else{_0x1c387b=0xce;}_0x49e6f1[_0xb922('0x1a')](_0x1c387b);return _0x49e6f1[_0xb922('0x1e')](_0xb922('0x1f'),_0x3c8130+'-'+_0x140e4d+'/'+_0x13daf7)[_0xb922('0x1b')](_0x2fac0a);}return null;};}function patchUpdates(_0x3fbe97){return function(_0x10becb){try{jsonpatch[_0xb922('0x20')](_0x10becb,_0x3fbe97,!![]);}catch(_0xeff9d0){return BPromise[_0xb922('0x21')](_0xeff9d0);}return _0x10becb[_0xb922('0x22')]();};}function saveUpdates(_0x4c453e,_0xd76130){return function(_0x5bc570){if(_0x5bc570){return _0x5bc570[_0xb922('0x23')](_0x4c453e)[_0xb922('0x24')](function(_0x5aef44){return _0x5aef44;});}return null;};}function removeEntity(_0x55aee1,_0xecf4d7){return function(_0x162771){if(_0x162771){return _0x162771[_0xb922('0x25')]()[_0xb922('0x24')](function(){_0x55aee1[_0xb922('0x1a')](0xcc)[_0xb922('0x19')]();});}};}function handleEntityNotFound(_0x242ba2,_0x545a86){return function(_0xb8459c){if(!_0xb8459c){_0x242ba2['sendStatus'](0x194);}return _0xb8459c;};}function handleError(_0x281b78,_0x5196bd){_0x5196bd=_0x5196bd||0x1f4;return function(_0x2db338){logger[_0xb922('0x26')](_0x2db338[_0xb922('0x27')]);if(_0x2db338[_0xb922('0x28')]){delete _0x2db338['name'];}_0x281b78[_0xb922('0x1a')](_0x5196bd)['send'](_0x2db338);};}exports[_0xb922('0x29')]=function(_0x2aa219,_0x4b71d4){var _0x4a03ac={},_0x1a7b59={},_0x106648={'count':0x0,'rows':[]};var _0x4cb190=_[_0xb922('0x2a')](db[_0xb922('0x2b')][_0xb922('0x2c')],function(_0x505c56){return{'name':_0x505c56[_0xb922('0x2d')],'type':_0x505c56['type'][_0xb922('0x2e')]};});_0x1a7b59[_0xb922('0x2f')]=_[_0xb922('0x2a')](_0x4cb190,'name');_0x1a7b59[_0xb922('0x30')]=_[_0xb922('0x31')](_0x2aa219[_0xb922('0x30')]);_0x1a7b59['filters']=_[_0xb922('0x32')](_0x1a7b59[_0xb922('0x2f')],_0x1a7b59[_0xb922('0x30')]);_0x4a03ac[_0xb922('0x33')]=_['intersection'](_0x1a7b59['model'],qs['fields'](_0x2aa219[_0xb922('0x30')][_0xb922('0x34')]));_0x4a03ac[_0xb922('0x33')]=_0x4a03ac['attributes'][_0xb922('0x35')]?_0x4a03ac[_0xb922('0x33')]:_0x1a7b59[_0xb922('0x2f')];if(!_0x2aa219[_0xb922('0x30')][_0xb922('0x36')]('nolimit')){_0x4a03ac[_0xb922('0x37')]=qs[_0xb922('0x37')](_0x2aa219[_0xb922('0x30')][_0xb922('0x37')]);_0x4a03ac[_0xb922('0x1d')]=qs[_0xb922('0x1d')](_0x2aa219[_0xb922('0x30')][_0xb922('0x1d')]);}_0x4a03ac[_0xb922('0x38')]=qs[_0xb922('0x39')](_0x2aa219[_0xb922('0x30')][_0xb922('0x39')]);_0x4a03ac['where']=qs[_0xb922('0x3a')](_[_0xb922('0x3b')](_0x2aa219[_0xb922('0x30')],_0x1a7b59[_0xb922('0x3a')]),_0x4cb190);if(_0x2aa219['query'][_0xb922('0x3c')]){_0x4a03ac[_0xb922('0x3d')]=_[_0xb922('0x3e')](_0x4a03ac[_0xb922('0x3d')],{'$or':_[_0xb922('0x2a')](_0x4cb190,function(_0x106856){if(_0x106856['type']!==_0xb922('0x3f')){var _0x595480={};_0x595480[_0x106856[_0xb922('0x28')]]={'$like':'%'+_0x2aa219[_0xb922('0x30')][_0xb922('0x3c')]+'%'};return _0x595480;}})});}_0x4a03ac=_[_0xb922('0x3e')]({},_0x4a03ac,_0x2aa219[_0xb922('0x40')]);var _0xe212df={'where':_0x4a03ac[_0xb922('0x3d')]};return db['DeskField'][_0xb922('0x1c')](_0xe212df)[_0xb922('0x24')](function(_0x556354){_0x106648[_0xb922('0x1c')]=_0x556354;if(_0x2aa219[_0xb922('0x30')][_0xb922('0x41')]){_0x4a03ac[_0xb922('0x42')]=[{'all':!![]}];}return db['DeskField'][_0xb922('0x43')](_0x4a03ac);})['then'](function(_0x1376af){_0x106648[_0xb922('0x44')]=_0x1376af;return _0x106648;})[_0xb922('0x24')](respondWithFilteredResult(_0x4b71d4,_0x4a03ac))[_0xb922('0x45')](handleError(_0x4b71d4,null));};exports[_0xb922('0x46')]=function(_0x14542d,_0x3a7a9a){var _0x4a7a5d={'raw':!![],'where':{'id':_0x14542d[_0xb922('0x47')]['id']}},_0x2f9ea1={};_0x2f9ea1[_0xb922('0x2f')]=_['keys'](db[_0xb922('0x2b')]['rawAttributes']);_0x2f9ea1['query']=_['keys'](_0x14542d['query']);_0x2f9ea1['filters']=_[_0xb922('0x32')](_0x2f9ea1[_0xb922('0x2f')],_0x2f9ea1[_0xb922('0x30')]);_0x4a7a5d[_0xb922('0x33')]=_[_0xb922('0x32')](_0x2f9ea1[_0xb922('0x2f')],qs[_0xb922('0x34')](_0x14542d[_0xb922('0x30')]['fields']));_0x4a7a5d['attributes']=_0x4a7a5d[_0xb922('0x33')][_0xb922('0x35')]?_0x4a7a5d[_0xb922('0x33')]:_0x2f9ea1[_0xb922('0x2f')];if(_0x14542d[_0xb922('0x30')][_0xb922('0x41')]){_0x4a7a5d[_0xb922('0x42')]=[{'all':!![]}];}_0x4a7a5d=_[_0xb922('0x3e')]({},_0x4a7a5d,_0x14542d['options']);return db[_0xb922('0x2b')]['find'](_0x4a7a5d)[_0xb922('0x24')](handleEntityNotFound(_0x3a7a9a,null))[_0xb922('0x24')](respondWithResult(_0x3a7a9a,null))[_0xb922('0x45')](handleError(_0x3a7a9a,null));};exports[_0xb922('0x48')]=function(_0x255631,_0x2622cd){return db[_0xb922('0x2b')]['create'](_0x255631[_0xb922('0x49')],{})[_0xb922('0x24')](respondWithResult(_0x2622cd,0xc9))[_0xb922('0x45')](handleError(_0x2622cd,null));};exports[_0xb922('0x23')]=function(_0x2ef4b0,_0x4ea4db){if(_0x2ef4b0[_0xb922('0x49')]['id']){delete _0x2ef4b0[_0xb922('0x49')]['id'];}return db[_0xb922('0x2b')][_0xb922('0x4a')]({'where':{'id':_0x2ef4b0[_0xb922('0x47')]['id']}})[_0xb922('0x24')](handleEntityNotFound(_0x4ea4db,null))['then'](saveUpdates(_0x2ef4b0['body'],null))['then'](respondWithResult(_0x4ea4db,null))[_0xb922('0x45')](handleError(_0x4ea4db,null));};exports['destroy']=function(_0x525c64,_0x2d1cab){return db['DeskField']['find']({'where':{'id':_0x525c64[_0xb922('0x47')]['id']}})[_0xb922('0x24')](handleEntityNotFound(_0x2d1cab,null))[_0xb922('0x24')](removeEntity(_0x2d1cab,null))['catch'](handleError(_0x2d1cab,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 9fd389a..4cb2c24 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 _0x9fa4=['bluebird','path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','lodash','util','../../config/logger','moment'];(function(_0x56f6f6,_0x15c619){var _0x21c082=function(_0x26637f){while(--_0x26637f){_0x56f6f6['push'](_0x56f6f6['shift']());}};_0x21c082(++_0x15c619);}(_0x9fa4,0x1ac));var _0x49fa=function(_0xf58b88,_0x4219dc){_0xf58b88=_0xf58b88-0x0;var _0x544e6d=_0x9fa4[_0xf58b88];return _0x544e6d;};'use strict';var _=require(_0x49fa('0x0'));var util=require(_0x49fa('0x1'));var logger=require(_0x49fa('0x2'))('api');var moment=require(_0x49fa('0x3'));var BPromise=require(_0x49fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49fa('0x5'));var rimraf=require(_0x49fa('0x6'));var config=require('../../config/environment');var attributes=require(_0x49fa('0x7'));module[_0x49fa('0x8')]=function(_0x3d669f,_0x2f95d9){return _0x3d669f[_0x49fa('0x9')](_0x49fa('0xa'),attributes,{'tableName':_0x49fa('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcfa5=['path','rimraf','../../config/environment','exports','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4494a5,_0x18ff0c){var _0x120b9b=function(_0x2554cc){while(--_0x2554cc){_0x4494a5['push'](_0x4494a5['shift']());}};_0x120b9b(++_0x18ff0c);}(_0xcfa5,0x112));var _0x5cfa=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xcfa5[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x5cfa('0x0'));var util=require(_0x5cfa('0x1'));var logger=require(_0x5cfa('0x2'))(_0x5cfa('0x3'));var moment=require(_0x5cfa('0x4'));var BPromise=require(_0x5cfa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cfa('0x6'));var rimraf=require(_0x5cfa('0x7'));var config=require(_0x5cfa('0x8'));var attributes=require('./intDeskField.attributes');module[_0x5cfa('0x9')]=function(_0xeb80a6,_0x2feb73){return _0xeb80a6['define']('DeskField',attributes,{'tableName':_0x5cfa('0xa'),'paranoid':![],'indexes':[{'name':_0x5cfa('0xb'),'fields':[_0x5cfa('0xc'),_0x5cfa('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index c833ce4..8da51bd 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 _0xd886=['debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x35597c,_0x166c9f){var _0x5e9c3e=function(_0x31562c){while(--_0x31562c){_0x35597c['push'](_0x35597c['shift']());}};_0x5e9c3e(++_0x166c9f);}(_0xd886,0x1bd));var _0x6d88=function(_0x576532,_0x151467){_0x576532=_0x576532-0x0;var _0x1678e4=_0xd886[_0x576532];return _0x1678e4;};'use strict';var _=require(_0x6d88('0x0'));var util=require(_0x6d88('0x1'));var moment=require(_0x6d88('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d88('0x3'));var db=require(_0x6d88('0x4'))['db'];var utils=require(_0x6d88('0x5'));var logger=require('../../config/logger')(_0x6d88('0x6'));var config=require(_0x6d88('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16988c,_0x3c8388,_0x294c88){return new BPromise(function(_0x24071c,_0x57ffaa){return client[_0x6d88('0x8')](_0x16988c,_0x294c88)['then'](function(_0x1b54e9){logger['info'](_0x6d88('0x9'),_0x3c8388,_0x6d88('0xa'));logger[_0x6d88('0xb')](_0x6d88('0xc'),_0x3c8388,_0x6d88('0xa'),JSON[_0x6d88('0xd')](_0x1b54e9));if(_0x1b54e9[_0x6d88('0xe')]){if(_0x1b54e9[_0x6d88('0xe')][_0x6d88('0xf')]===0x1f4){logger[_0x6d88('0xe')](_0x6d88('0x9'),_0x3c8388,_0x1b54e9[_0x6d88('0xe')][_0x6d88('0x10')]);return _0x57ffaa(_0x1b54e9[_0x6d88('0xe')][_0x6d88('0x10')]);}logger['error'](_0x6d88('0x9'),_0x3c8388,_0x1b54e9['error'][_0x6d88('0x10')]);return _0x24071c(_0x1b54e9[_0x6d88('0xe')][_0x6d88('0x10')]);}else{logger[_0x6d88('0x11')]('DeskField,\x20%s,\x20%s',_0x3c8388,_0x6d88('0xa'));_0x24071c(_0x1b54e9['result'][_0x6d88('0x10')]);}})[_0x6d88('0x12')](function(_0xbd535a){logger[_0x6d88('0xe')](_0x6d88('0x9'),_0x3c8388,_0xbd535a);_0x57ffaa(_0xbd535a);});});} \ No newline at end of file +var _0xbf1e=['../../config/environment','jayson/promise','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x36f842,_0x49dd51){var _0x133d87=function(_0x3591a0){while(--_0x3591a0){_0x36f842['push'](_0x36f842['shift']());}};_0x133d87(++_0x49dd51);}(_0xbf1e,0x12f));var _0xebf1=function(_0x12ed98,_0x161baa){_0x12ed98=_0x12ed98-0x0;var _0x43e787=_0xbf1e[_0x12ed98];return _0x43e787;};'use strict';var _=require(_0xebf1('0x0'));var util=require('util');var moment=require(_0xebf1('0x1'));var BPromise=require(_0xebf1('0x2'));var rs=require(_0xebf1('0x3'));var fs=require('fs');var Redis=require(_0xebf1('0x4'));var db=require(_0xebf1('0x5'))['db'];var utils=require(_0xebf1('0x6'));var logger=require(_0xebf1('0x7'))(_0xebf1('0x8'));var config=require(_0xebf1('0x9'));var jayson=require(_0xebf1('0xa'));var client=jayson['client'][_0xebf1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2439f7,_0x531416,_0x138767){return new BPromise(function(_0x10f396,_0x4026dd){return client[_0xebf1('0xc')](_0x2439f7,_0x138767)['then'](function(_0x49e2ff){logger[_0xebf1('0xd')](_0xebf1('0xe'),_0x531416,_0xebf1('0xf'));logger[_0xebf1('0x10')](_0xebf1('0x11'),_0x531416,_0xebf1('0xf'),JSON[_0xebf1('0x12')](_0x49e2ff));if(_0x49e2ff[_0xebf1('0x13')]){if(_0x49e2ff[_0xebf1('0x13')][_0xebf1('0x14')]===0x1f4){logger[_0xebf1('0x13')]('DeskField,\x20%s,\x20%s',_0x531416,_0x49e2ff['error'][_0xebf1('0x15')]);return _0x4026dd(_0x49e2ff[_0xebf1('0x13')]['message']);}logger['error'](_0xebf1('0xe'),_0x531416,_0x49e2ff['error']['message']);return _0x10f396(_0x49e2ff[_0xebf1('0x13')][_0xebf1('0x15')]);}else{logger[_0xebf1('0xd')](_0xebf1('0xe'),_0x531416,'request\x20sent');_0x10f396(_0x49e2ff[_0xebf1('0x16')][_0xebf1('0x15')]);}})[_0xebf1('0x17')](function(_0x9f7b4){logger[_0xebf1('0x13')](_0xebf1('0xe'),_0x531416,_0x9f7b4);_0x4026dd(_0x9f7b4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 8414a8d..b6a98f0 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 _0xe7eb=['index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe7eb,0x8b));var _0xbe7e=function(_0x506a9c,_0x3b1539){_0x506a9c=_0x506a9c-0x0;var _0x2b7829=_0xe7eb[_0x506a9c];return _0x2b7829;};'use strict';var multer=require(_0xbe7e('0x0'));var util=require(_0xbe7e('0x1'));var path=require(_0xbe7e('0x2'));var timeout=require(_0xbe7e('0x3'));var express=require('express');var router=express[_0xbe7e('0x4')]();var auth=require(_0xbe7e('0x5'));var interaction=require(_0xbe7e('0x6'));var config=require(_0xbe7e('0x7'));var controller=require(_0xbe7e('0x8'));router[_0xbe7e('0x9')]('/',auth[_0xbe7e('0xa')](),controller[_0xbe7e('0xb')]);router[_0xbe7e('0x9')](_0xbe7e('0xc'),auth[_0xbe7e('0xa')](),controller[_0xbe7e('0xd')]);router[_0xbe7e('0x9')](_0xbe7e('0xe'),auth[_0xbe7e('0xa')](),controller['getConfigurations']);router[_0xbe7e('0x9')](_0xbe7e('0xf'),auth[_0xbe7e('0xa')](),controller[_0xbe7e('0x10')]);router[_0xbe7e('0x11')]('/',auth[_0xbe7e('0xa')](),controller[_0xbe7e('0x12')]);router[_0xbe7e('0x11')](_0xbe7e('0xe'),auth[_0xbe7e('0xa')](),controller[_0xbe7e('0x13')]);router[_0xbe7e('0x14')](_0xbe7e('0xc'),auth['isAuthenticated'](),controller[_0xbe7e('0x15')]);router[_0xbe7e('0x16')](_0xbe7e('0xc'),auth['isAuthenticated'](),controller[_0xbe7e('0x17')]);module[_0xbe7e('0x18')]=router; \ No newline at end of file +var _0xdea9=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','create','post','addConfiguration','put','update','delete'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xdea9,0x17b));var _0x9dea=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xdea9[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x9dea('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9dea('0x1'));var express=require(_0x9dea('0x2'));var router=express[_0x9dea('0x3')]();var auth=require(_0x9dea('0x4'));var interaction=require(_0x9dea('0x5'));var config=require('../../config/environment');var controller=require(_0x9dea('0x6'));router[_0x9dea('0x7')]('/',auth['isAuthenticated'](),controller[_0x9dea('0x8')]);router[_0x9dea('0x7')](_0x9dea('0x9'),auth['isAuthenticated'](),controller[_0x9dea('0xa')]);router[_0x9dea('0x7')](_0x9dea('0xb'),auth[_0x9dea('0xc')](),controller[_0x9dea('0xd')]);router['get']('/:id/fields',auth[_0x9dea('0xc')](),controller['getFields']);router['post']('/',auth[_0x9dea('0xc')](),controller[_0x9dea('0xe')]);router[_0x9dea('0xf')](_0x9dea('0xb'),auth['isAuthenticated'](),controller[_0x9dea('0x10')]);router[_0x9dea('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9dea('0x12')]);router[_0x9dea('0x13')]('/:id',auth[_0x9dea('0xc')](),controller['destroy']);module[_0x9dea('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 96e9d01..96e2d7d 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 _0xc1a6=['STRING','exports'];(function(_0x4b89f1,_0x590c84){var _0x3530fd=function(_0x4b8582){while(--_0x4b8582){_0x4b89f1['push'](_0x4b89f1['shift']());}};_0x3530fd(++_0x590c84);}(_0xc1a6,0x109));var _0x6c1a=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xc1a6[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require('sequelize');module[_0x6c1a('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6c1a('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6c1a('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6c1a('0x1')]},'clientSecret':{'type':Sequelize[_0x6c1a('0x1')]},'serverUrl':{'type':Sequelize[_0x6c1a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeef5=['STRING','sequelize','exports'];(function(_0x5d54d7,_0x433211){var _0x130451=function(_0x2e28df){while(--_0x2e28df){_0x5d54d7['push'](_0x5d54d7['shift']());}};_0x130451(++_0x433211);}(_0xeef5,0x64));var _0x5eef=function(_0x42743f,_0x32aa21){_0x42743f=_0x42743f-0x0;var _0x28eaee=_0xeef5[_0x42743f];return _0x28eaee;};'use strict';var Sequelize=require(_0x5eef('0x0'));module[_0x5eef('0x1')]={'name':{'type':Sequelize[_0x5eef('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5eef('0x2')]},'tenantId':{'type':Sequelize[_0x5eef('0x2')]},'clientId':{'type':Sequelize[_0x5eef('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'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 6975a13..ca30ea3 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 _0x6607=['then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','fields','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','title','customerid','subject','phonenumber','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','traversedpath','utcconversiontimezonecode','concat','username','remoteUri','tenantId','clientId','clientSecret','slice','%s/api/data/v9.0/','POST','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','@odata.type','substring','lastIndexOf','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request'];(function(_0x100bb5,_0x478230){var _0x550073=function(_0x195a20){while(--_0x195a20){_0x100bb5['push'](_0x100bb5['shift']());}};_0x550073(++_0x478230);}(_0x6607,0xbe));var _0x7660=function(_0x294127,_0x27641f){_0x294127=_0x294127-0x0;var _0x2c269e=_0x6607[_0x294127];return _0x2c269e;};'use strict';var pdf=require(_0x7660('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7660('0x1'));var zipdir=require(_0x7660('0x2'));var jsonpatch=require(_0x7660('0x3'));var rp=require('request-promise');var moment=require(_0x7660('0x4'));var BPromise=require(_0x7660('0x5'));var Mustache=require('mustache');var util=require(_0x7660('0x6'));var path=require(_0x7660('0x7'));var sox=require('sox');var csv=require(_0x7660('0x8'));var ejs=require(_0x7660('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7660('0xa'));var crypto=require(_0x7660('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7660('0x8'));var querystring=require(_0x7660('0xc'));var Papa=require(_0x7660('0xd'));var Redis=require(_0x7660('0xe'));var authService=require(_0x7660('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7660('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7660('0x11'))('api');var utils=require(_0x7660('0x12'));var config=require('../../config/environment');var db=require(_0x7660('0x13'))['db'];var integrations=require(_0x7660('0x14'));var jayson=require('jayson/promise');var client=jayson[_0x7660('0x15')][_0x7660('0x16')]({'port':0x232a});function checkPasswordPattern(_0x39ceec,_0x2dddc3,_0x52e8f6){if(_0x52e8f6){var _0x41b986=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41b986[_0x7660('0x17')](_0x2dddc3)){return _0x39ceec;}else{throw new db[(_0x7660('0x18'))][(_0x7660('0x19'))](_0x7660('0x1a'));}}else{return _0x39ceec;}}function respondWithRpcPromise(_0x29ae1a,_0x3b1c52,_0x329101,_0x1afd85){return new BPromise(function(_0x47cead,_0x200727){var _0x4f1848=_0x1afd85||client;return _0x4f1848[_0x7660('0x1b')](_0x29ae1a,_0x329101)[_0x7660('0x1c')](function(_0x1d3930){logger[_0x7660('0x1d')]('Dynamics365Account,\x20%s,\x20%s',_0x3b1c52,_0x7660('0x1e'));logger['debug'](_0x7660('0x1f'),_0x3b1c52,_0x7660('0x1e'),JSON[_0x7660('0x20')](_0x1d3930));if(_0x1d3930['error']){if(_0x1d3930['error']['code']===0x1f4){logger[_0x7660('0x21')](_0x7660('0x22'),_0x3b1c52,_0x1d3930[_0x7660('0x21')][_0x7660('0x23')]);return _0x200727(_0x1d3930[_0x7660('0x21')][_0x7660('0x23')]);}logger[_0x7660('0x21')](_0x7660('0x22'),_0x3b1c52,_0x1d3930[_0x7660('0x21')]['message']);return _0x47cead(_0x1d3930['error'][_0x7660('0x23')]);}else{logger[_0x7660('0x1d')](_0x7660('0x22'),_0x3b1c52,_0x7660('0x1e'));_0x47cead(_0x1d3930['result'][_0x7660('0x23')]);}})[_0x7660('0x24')](function(_0x1481cf){logger[_0x7660('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x3b1c52,_0x1481cf);_0x200727(_0x1481cf);});});}function respondWithStatusCode(_0x68562a,_0x175ed9){_0x175ed9=_0x175ed9||0xcc;return function(_0x454a87){if(_0x454a87){return _0x68562a[_0x7660('0x25')](_0x175ed9);}return _0x68562a['status'](_0x175ed9)[_0x7660('0x26')]();};}function respondWithResult(_0x59cdeb,_0x3ea3d8){_0x3ea3d8=_0x3ea3d8||0xc8;return function(_0x4f3987){if(_0x4f3987){return _0x59cdeb[_0x7660('0x27')](_0x3ea3d8)[_0x7660('0x28')](_0x4f3987);}};}function respondWithFilteredResult(_0x14ba76,_0x5bffa3){return function(_0x4df67b){if(_0x4df67b){var _0x32eeab=_0x4df67b[_0x7660('0x29')],_0x1dd394=_0x5bffa3[_0x7660('0x2a')],_0xb6cbdc=_0x5bffa3[_0x7660('0x2a')]+_0x5bffa3[_0x7660('0x2b')],_0x19a75f;if(_0xb6cbdc>=_0x32eeab){_0xb6cbdc=_0x32eeab;_0x19a75f=0xc8;}else{_0x19a75f=0xce;}_0x14ba76[_0x7660('0x27')](_0x19a75f);return _0x14ba76['set'](_0x7660('0x2c'),_0x1dd394+'-'+_0xb6cbdc+'/'+_0x32eeab)[_0x7660('0x28')](_0x4df67b);}return null;};}function patchUpdates(_0x51d184){return function(_0x18518a){try{jsonpatch[_0x7660('0x2d')](_0x18518a,_0x51d184,!![]);}catch(_0x21e50a){return BPromise[_0x7660('0x2e')](_0x21e50a);}return _0x18518a[_0x7660('0x2f')]();};}function saveUpdates(_0xa8db67,_0x12b6c8){return function(_0x4196c3){if(_0x4196c3){return _0x4196c3[_0x7660('0x30')](_0xa8db67)[_0x7660('0x1c')](function(_0x14b98e){return _0x14b98e;});}return null;};}function removeEntity(_0x189e5c,_0x25271d){return function(_0xf85be7){if(_0xf85be7){return _0xf85be7[_0x7660('0x31')]()['then'](function(){_0x189e5c[_0x7660('0x27')](0xcc)[_0x7660('0x26')]();});}};}function handleEntityNotFound(_0x2330c4,_0x44d2be){return function(_0x2ea42e){if(!_0x2ea42e){_0x2330c4[_0x7660('0x25')](0x194);}return _0x2ea42e;};}function handleError(_0x319121,_0x216ddf){_0x216ddf=_0x216ddf||0x1f4;return function(_0x5b7259){logger['error'](_0x5b7259[_0x7660('0x32')]);if(_0x5b7259[_0x7660('0x33')]){delete _0x5b7259[_0x7660('0x33')];}_0x319121['status'](_0x216ddf)[_0x7660('0x34')](_0x5b7259);};}exports[_0x7660('0x35')]=function(_0x4f41c8,_0x5cfa9d){var _0x3088c6={},_0x341fce={},_0x320747={'count':0x0,'rows':[]};var _0x1228f2=_[_0x7660('0x36')](db[_0x7660('0x37')][_0x7660('0x38')],function(_0x6b23f8){return{'name':_0x6b23f8[_0x7660('0x39')],'type':_0x6b23f8[_0x7660('0x3a')]['key']};});_0x341fce[_0x7660('0x3b')]=_['map'](_0x1228f2,_0x7660('0x33'));_0x341fce[_0x7660('0x3c')]=_[_0x7660('0x3d')](_0x4f41c8[_0x7660('0x3c')]);_0x341fce[_0x7660('0x3e')]=_[_0x7660('0x3f')](_0x341fce[_0x7660('0x3b')],_0x341fce[_0x7660('0x3c')]);_0x3088c6[_0x7660('0x40')]=_[_0x7660('0x3f')](_0x341fce['model'],qs['fields'](_0x4f41c8[_0x7660('0x3c')]['fields']));_0x3088c6[_0x7660('0x40')]=_0x3088c6[_0x7660('0x40')][_0x7660('0x41')]?_0x3088c6['attributes']:_0x341fce[_0x7660('0x3b')];if(!_0x4f41c8['query'][_0x7660('0x42')](_0x7660('0x43'))){_0x3088c6[_0x7660('0x2b')]=qs[_0x7660('0x2b')](_0x4f41c8[_0x7660('0x3c')]['limit']);_0x3088c6[_0x7660('0x2a')]=qs[_0x7660('0x2a')](_0x4f41c8[_0x7660('0x3c')]['offset']);}_0x3088c6['order']=qs[_0x7660('0x44')](_0x4f41c8['query']['sort']);_0x3088c6[_0x7660('0x45')]=qs[_0x7660('0x3e')](_['pick'](_0x4f41c8[_0x7660('0x3c')],_0x341fce[_0x7660('0x3e')]),_0x1228f2);if(_0x4f41c8[_0x7660('0x3c')][_0x7660('0x46')]){_0x3088c6[_0x7660('0x45')]=_[_0x7660('0x47')](_0x3088c6[_0x7660('0x45')],{'$or':_[_0x7660('0x36')](_0x1228f2,function(_0x785b90){if(_0x785b90[_0x7660('0x3a')]!==_0x7660('0x48')){var _0x508ca0={};_0x508ca0[_0x785b90[_0x7660('0x33')]]={'$like':'%'+_0x4f41c8['query']['filter']+'%'};return _0x508ca0;}})});}_0x3088c6=_[_0x7660('0x47')]({},_0x3088c6,_0x4f41c8[_0x7660('0x49')]);var _0x401b9b={'where':_0x3088c6['where']};return db[_0x7660('0x37')][_0x7660('0x29')](_0x401b9b)[_0x7660('0x1c')](function(_0x340a8f){_0x320747['count']=_0x340a8f;if(_0x4f41c8[_0x7660('0x3c')][_0x7660('0x4a')]){_0x3088c6['include']=[{'all':!![]}];}return db[_0x7660('0x37')][_0x7660('0x4b')](_0x3088c6);})[_0x7660('0x1c')](function(_0x336460){_0x320747[_0x7660('0x4c')]=_0x336460;return _0x320747;})[_0x7660('0x1c')](respondWithFilteredResult(_0x5cfa9d,_0x3088c6))[_0x7660('0x24')](handleError(_0x5cfa9d,null));};exports[_0x7660('0x4d')]=function(_0x534ff4,_0x1fbc14){var _0x49e260={'raw':![],'where':{'id':_0x534ff4[_0x7660('0x4e')]['id']}},_0x20023d={};_0x20023d[_0x7660('0x3b')]=_[_0x7660('0x3d')](db[_0x7660('0x37')]['rawAttributes']);_0x20023d[_0x7660('0x3c')]=_[_0x7660('0x3d')](_0x534ff4[_0x7660('0x3c')]);_0x20023d[_0x7660('0x3e')]=_['intersection'](_0x20023d[_0x7660('0x3b')],_0x20023d[_0x7660('0x3c')]);_0x49e260['attributes']=_[_0x7660('0x3f')](_0x20023d[_0x7660('0x3b')],qs[_0x7660('0x4f')](_0x534ff4['query']['fields']));_0x49e260['attributes']=_0x49e260[_0x7660('0x40')][_0x7660('0x41')]?_0x49e260[_0x7660('0x40')]:_0x20023d[_0x7660('0x3b')];if(_0x534ff4[_0x7660('0x3c')][_0x7660('0x4a')]){_0x49e260[_0x7660('0x50')]=[{'all':!![]}];}_0x49e260=_[_0x7660('0x47')]({},_0x49e260,_0x534ff4[_0x7660('0x49')]);return db[_0x7660('0x37')][_0x7660('0x51')](_0x49e260)['then'](handleEntityNotFound(_0x1fbc14,null))[_0x7660('0x1c')](respondWithResult(_0x1fbc14,null))[_0x7660('0x24')](handleError(_0x1fbc14,null));};exports[_0x7660('0x52')]=function(_0x39fd91,_0x233389){return db['Dynamics365Account'][_0x7660('0x52')](_0x39fd91[_0x7660('0x53')],{})[_0x7660('0x1c')](respondWithResult(_0x233389,0xc9))[_0x7660('0x24')](handleError(_0x233389,null));};exports[_0x7660('0x30')]=function(_0xfdb634,_0x1d378f){if(_0xfdb634[_0x7660('0x53')]['id']){delete _0xfdb634[_0x7660('0x53')]['id'];}return db[_0x7660('0x37')][_0x7660('0x51')]({'where':{'id':_0xfdb634[_0x7660('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1d378f,null))[_0x7660('0x1c')](saveUpdates(_0xfdb634[_0x7660('0x53')],null))[_0x7660('0x1c')](respondWithResult(_0x1d378f,null))[_0x7660('0x24')](handleError(_0x1d378f,null));};exports[_0x7660('0x31')]=function(_0x17bc01,_0x1175db){return db[_0x7660('0x37')]['find']({'where':{'id':_0x17bc01[_0x7660('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1175db,null))['then'](removeEntity(_0x1175db,null))[_0x7660('0x24')](handleError(_0x1175db,null));};exports[_0x7660('0x54')]=function(_0x145402,_0x290550,_0x2730cc){var _0x29fb07={};var _0x58cf0d={};var _0x4afaa4;var _0x3291db;return db[_0x7660('0x37')][_0x7660('0x55')]({'where':{'id':_0x145402[_0x7660('0x4e')]['id']}})['then'](handleEntityNotFound(_0x290550,null))['then'](function(_0x556eb8){if(_0x556eb8){_0x4afaa4=_0x556eb8;_0x58cf0d[_0x7660('0x3b')]=_[_0x7660('0x3d')](db[_0x7660('0x56')][_0x7660('0x38')]);_0x58cf0d['query']=_[_0x7660('0x3d')](_0x145402[_0x7660('0x3c')]);_0x58cf0d[_0x7660('0x3e')]=_[_0x7660('0x3f')](_0x58cf0d[_0x7660('0x3b')],_0x58cf0d[_0x7660('0x3c')]);_0x29fb07[_0x7660('0x40')]=_['intersection'](_0x58cf0d[_0x7660('0x3b')],qs['fields'](_0x145402[_0x7660('0x3c')][_0x7660('0x4f')]));_0x29fb07['attributes']=_0x29fb07[_0x7660('0x40')][_0x7660('0x41')]?_0x29fb07[_0x7660('0x40')]:_0x58cf0d['model'];_0x29fb07[_0x7660('0x57')]=qs[_0x7660('0x44')](_0x145402[_0x7660('0x3c')][_0x7660('0x44')]);_0x29fb07[_0x7660('0x45')]=qs[_0x7660('0x3e')](_[_0x7660('0x58')](_0x145402[_0x7660('0x3c')],_0x58cf0d['filters']));if(_0x145402[_0x7660('0x3c')][_0x7660('0x46')]){_0x29fb07[_0x7660('0x45')]=_[_0x7660('0x47')](_0x29fb07['where'],{'$or':_[_0x7660('0x36')](_0x29fb07[_0x7660('0x40')],function(_0x16c199){var _0x1267e3={};_0x1267e3[_0x16c199]={'$like':'%'+_0x145402[_0x7660('0x3c')][_0x7660('0x46')]+'%'};return _0x1267e3;})});}_0x29fb07=_['merge']({},_0x29fb07,_0x145402[_0x7660('0x49')]);return _0x4afaa4[_0x7660('0x54')](_0x29fb07);}})['then'](function(_0x2c172f){if(_0x2c172f){_0x3291db=_0x2c172f[_0x7660('0x41')];if(!_0x145402[_0x7660('0x3c')][_0x7660('0x42')](_0x7660('0x43'))){_0x29fb07[_0x7660('0x2b')]=qs[_0x7660('0x2b')](_0x145402['query'][_0x7660('0x2b')]);_0x29fb07[_0x7660('0x2a')]=qs['offset'](_0x145402[_0x7660('0x3c')]['offset']);}return _0x4afaa4[_0x7660('0x54')](_0x29fb07);}})['then'](function(_0x2a5dac){if(_0x2a5dac){return _0x2a5dac?{'count':_0x3291db,'rows':_0x2a5dac}:null;}})[_0x7660('0x1c')](respondWithResult(_0x290550,null))[_0x7660('0x24')](handleError(_0x290550,null));};exports[_0x7660('0x59')]=function(_0x4dc216,_0x366848,_0x5dcf1f){if(_0x4dc216[_0x7660('0x53')]['id']){delete _0x4dc216[_0x7660('0x53')]['id'];}return db[_0x7660('0x37')][_0x7660('0x55')]({'where':{'id':_0x4dc216[_0x7660('0x4e')]['id']}})[_0x7660('0x1c')](handleEntityNotFound(_0x366848,null))[_0x7660('0x1c')](function(_0x36da42){if(_0x36da42){_0x4dc216[_0x7660('0x53')][_0x7660('0x5a')]=_0x36da42['id'];_0x4dc216[_0x7660('0x53')][_0x7660('0x5b')]=integrations[_0x7660('0x5c')](_0x4dc216[_0x7660('0x53')][_0x7660('0x5d')],_0x4dc216[_0x7660('0x53')][_0x7660('0x3a')]);_0x4dc216[_0x7660('0x53')][_0x7660('0x5e')]=integrations[_0x7660('0x5f')](_0x4dc216[_0x7660('0x53')][_0x7660('0x5d')],_0x4dc216[_0x7660('0x53')][_0x7660('0x3a')]);return db[_0x7660('0x56')][_0x7660('0x52')](_0x4dc216[_0x7660('0x53')],{'include':[{'model':db[_0x7660('0x60')],'as':_0x7660('0x5b')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x7660('0x1c')](respondWithResult(_0x366848,null))[_0x7660('0x24')](handleError(_0x366848,null));};exports[_0x7660('0x61')]=function(_0x1398d4,_0x4377ed,_0x2405f1){var _0x5debc6=_0x1398d4[_0x7660('0x3c')][_0x7660('0x62')];var _0x5a3f6b=_0x5debc6===_0x7660('0x63')?_0x7660('0x64'):'PhoneCall';var _0x30fb72='';var _0x59077d='';var _0x1016b6='';var _0x4e039b='';var _0x1345b9='';var _0x333d18='';var _0x25028b='';var _0x55d2be='';var _0x25f8ad=[_0x7660('0x65'),'description',_0x7660('0x66'),'ownerid','caseorigincode',_0x7660('0x67'),_0x7660('0x68'),'regardingobjectid','directioncode',_0x7660('0x69')];var _0x5998f8=[_0x7660('0x6a'),_0x7660('0x6b'),_0x7660('0x6c'),_0x7660('0x6d'),_0x7660('0x6e'),_0x7660('0x6f'),_0x7660('0x70'),_0x7660('0x71'),_0x7660('0x72'),_0x7660('0x73'),_0x7660('0x74'),'createdbyyominame',_0x7660('0x75'),_0x7660('0x76'),'createdonbehalfbyyominame',_0x7660('0x77'),_0x7660('0x78'),_0x7660('0x79'),'emailaddress',_0x7660('0x7a'),_0x7660('0x7b'),_0x7660('0x7c'),_0x7660('0x7d'),_0x7660('0x7e'),'firstresponsebykpiidname','followupby',_0x7660('0x7f'),_0x7660('0x80'),_0x7660('0x81'),_0x7660('0x82'),_0x7660('0x83'),_0x7660('0x84'),'modifiedbyexternalpartyyominame',_0x7660('0x85'),_0x7660('0x86'),_0x7660('0x87'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x7660('0x88'),'msdyn_iotalertname',_0x7660('0x89'),_0x7660('0x8a'),_0x7660('0x8b'),_0x7660('0x8c'),'owneridtype',_0x7660('0x8d'),'parentcaseidname',_0x7660('0x8e'),_0x7660('0x8f'),_0x7660('0x90'),_0x7660('0x91'),_0x7660('0x92'),_0x7660('0x93'),'resolvebykpiidname',_0x7660('0x94'),_0x7660('0x95'),_0x7660('0x96'),'sentimentvalue',_0x7660('0x97'),_0x7660('0x98'),_0x7660('0x99'),_0x7660('0x9a'),_0x7660('0x9b'),_0x7660('0x9c'),_0x7660('0x9d'),'timezoneruleversionnumber','transactioncurrencyidname',_0x7660('0x9e'),_0x7660('0x9f'),'versionnumber'];var _0x1528f7=_0x25f8ad[_0x7660('0xa0')](_0x5998f8);return db['Dynamics365Account'][_0x7660('0x55')]({'where':{'id':_0x1398d4['params']['id']},'attributes':['id',_0x7660('0xa1'),'password',_0x7660('0xa2'),_0x7660('0xa3'),_0x7660('0xa4'),_0x7660('0xa5')]})[_0x7660('0x1c')](handleEntityNotFound(_0x4377ed,null))[_0x7660('0x1c')](function(_0x5109c7){if(_0x5109c7){_0x55d2be=_0x5109c7[_0x7660('0xa2')];var _0x470493=_0x55d2be[_0x7660('0xa6')](-0x1);if(_0x470493==='/'){_0x55d2be=_0x55d2be['substring'](0x0,_0x55d2be['lastIndexOf'](_0x470493));}_0x25028b=util['format'](_0x7660('0xa7'),_0x55d2be);var _0x376e64={'method':_0x7660('0xa8'),'uri':'https://login.microsoftonline.com/'+_0x5109c7[_0x7660('0xa3')]+_0x7660('0xa9'),'form':{'client_id':_0x5109c7[_0x7660('0xa4')],'resource':_0x55d2be,'username':_0x5109c7['username'],'password':_0x5109c7['password'],'grant_type':_0x7660('0xaa'),'client_secret':_0x5109c7[_0x7660('0xa5')]},'json':!![]};return rp(_0x376e64);}})[_0x7660('0x1c')](function(_0x6b0a15){_0x333d18=_0x6b0a15[_0x7660('0xab')];var _0x29bfe6={'method':_0x7660('0xac'),'uri':encodeURI(_0x25028b+_0x7660('0xad')+_0x5a3f6b+'\x27'),'headers':{'Authorization':_0x7660('0xae')+_0x333d18,'If-None-Match':null,'OData-Version':_0x7660('0xaf')},'json':!![]};return rp(_0x29bfe6);})[_0x7660('0x1c')](function(_0x4c8561){var _0x13a615=_0x4c8561[_0x7660('0xb0')][0x0];var _0x5279b9=_0x13a615[_0x7660('0xb1')];var _0xe22be2={'method':_0x7660('0xac'),'uri':_0x25028b+_0x7660('0xb2')+_0x5279b9+_0x7660('0xb3'),'headers':{'Authorization':_0x7660('0xae')+_0x333d18,'If-None-Match':null,'OData-Version':_0x7660('0xaf')},'json':!![]};return rp(_0xe22be2);})[_0x7660('0x1c')](function(_0x700687){_0x30fb72=_0x700687;_0x59077d=_0x30fb72[_0x7660('0xb4')];_0x59077d=_[_0x7660('0xb5')](_0x59077d,function(_0x4f1880){return!_0x1528f7[_0x7660('0xb6')](_0x4f1880['LogicalName']);});var _0x2e3805=[];var _0x4c3030=[];_0x59077d['forEach'](function(_0x3f636b){if(_0x3f636b[_0x7660('0xb7')]){var _0x2823d4=_0x3f636b[_0x7660('0xb7')][_0x7660('0xb8')](_0x3f636b[_0x7660('0xb7')][_0x7660('0xb9')]('.')+0x1);if(_0x2823d4===_0x7660('0xba')){_0x2e3805[_0x7660('0xbb')](getSelectList(_0x25028b,_0x5debc6,_0x4c3030,_0x30fb72[_0x7660('0xb1')],_0x3f636b[_0x7660('0xb1')],_0x333d18));}}});return Promise[_0x7660('0xbc')](_0x2e3805);})[_0x7660('0x1c')](function(_0x12b847){_0x1016b6=_0x12b847[0x0];var _0x2ef770=[];var _0x4af824=[];_0x59077d[_0x7660('0xbd')](function(_0x4764d3){if(!_[_0x7660('0xbe')](_0x4764d3['@odata.type'])){var _0x4554ff=_0x4764d3[_0x7660('0xb7')][_0x7660('0xb8')](_0x4764d3[_0x7660('0xb7')][_0x7660('0xb9')]('.')+0x1);if(_0x4554ff===_0x7660('0xbf')){_0x2ef770['push'](getBooleanList(_0x25028b,_0x5debc6,_0x4af824,_0x30fb72['MetadataId'],_0x4764d3[_0x7660('0xb1')],_0x333d18));}}});return Promise[_0x7660('0xbc')](_0x2ef770);})[_0x7660('0x1c')](function(_0xc0e824){_0x4e039b=_0xc0e824[0x0];var _0x16db14=[];var _0x19c94a=[];_0x59077d[_0x7660('0xbd')](function(_0xe06de1){if(_0xe06de1['@odata.type']){var _0x542b77=_0xe06de1[_0x7660('0xb7')]['substring'](_0xe06de1[_0x7660('0xb7')]['lastIndexOf']('.')+0x1);if(_0x542b77===_0x7660('0xc0')||_0x542b77===_0x7660('0xc1')||_0x542b77==='BigIntAttributeMetadata'||_0x542b77===_0x7660('0xc2')||_0x542b77===_0x7660('0xc3')||_0x542b77===_0x7660('0xc4')||_0x542b77===_0x7660('0xc5')||_0x542b77===_0x7660('0xc6')||_0x542b77==='StateAttributeMetadata'||_0x542b77===_0x7660('0xc7')){_0x16db14[_0x7660('0xbb')](getInputList(_0x25028b,_0x5debc6,_0x542b77,_0x19c94a,_0x30fb72[_0x7660('0xb1')],_0xe06de1[_0x7660('0xb1')],_0x333d18));}}});return Promise[_0x7660('0xbc')](_0x16db14);})[_0x7660('0x1c')](function(_0x5ab491){_0x1345b9=_0x5ab491[0x0];var _0x247493=_0x1016b6[_0x7660('0xa0')](_0x4e039b)[_0x7660('0xa0')](_0x1345b9);var _0x54820={'count':_0x247493['length'],'rows':_0x247493};return _0x54820;})[_0x7660('0x1c')](respondWithResult(_0x4377ed,null))[_0x7660('0x24')](function(_0x3f78e3){var _0x437679=_0x1398d4['query'][_0x7660('0x17')]?0x1f4:_0x3f78e3[_0x7660('0xc8')]||0x1f4;logger[_0x7660('0x21')](_0x3f78e3[_0x7660('0x32')]);delete _0x3f78e3[_0x7660('0x33')];if(_0x437679===0x191){_0x437679=0x190;}_0x4377ed['status'](_0x437679)['send'](_0x1398d4[_0x7660('0x3c')][_0x7660('0x17')]?{'message':_0x7660('0xc9'),'statusCode':_0x3f78e3[_0x7660('0xc8')]}:_0x3f78e3);});};function getSelectList(_0x21ffa7,_0x576c82,_0x490417,_0x14a2d1,_0x5ab853,_0x21592c){var _0x18715b={'method':_0x7660('0xac'),'uri':_0x21ffa7+_0x7660('0xb2')+_0x14a2d1+_0x7660('0xca')+_0x5ab853+_0x7660('0xcb')+_0x7660('0xcc'),'headers':{'Authorization':_0x7660('0xae')+_0x21592c,'If-None-Match':null,'OData-Version':_0x7660('0xaf')},'json':!![]};return rp(_0x18715b)[_0x7660('0x1c')](function(_0x3872dd){var _0x35cf08=[];var _0x51b687=_0x3872dd[_0x7660('0xcd')][_0x7660('0xce')];_0x51b687[_0x7660('0xbd')](function(_0x577160){_0x35cf08[_0x7660('0xbb')]({'name':_0x577160[_0x7660('0xcf')][_0x7660('0xd0')]['Label'],'value':String(_0x577160[_0x7660('0xd1')])});});var _0x4e4f5d={'id':_0x576c82+'_'+_0x3872dd[_0x7660('0xd2')],'name':_0x3872dd[_0x7660('0xd3')]['UserLocalizedLabel'][_0x7660('0xcf')],'custom':![],'options':_0x35cf08};_0x490417['push'](_0x4e4f5d);return _0x490417;});}function getBooleanList(_0x53894a,_0x3db016,_0x24764d,_0x1e634f,_0x526311,_0x350b91){var _0x92593c={'method':_0x7660('0xac'),'uri':_0x53894a+_0x7660('0xb2')+_0x1e634f+_0x7660('0xca')+_0x526311+_0x7660('0xd4'),'headers':{'Authorization':'Bearer\x20'+_0x350b91,'If-None-Match':null,'OData-Version':_0x7660('0xaf')},'json':!![]};return rp(_0x92593c)[_0x7660('0x1c')](function(_0x5e6d36){var _0x1a356b=[];_0x1a356b[_0x7660('0xbb')]({'name':_0x5e6d36['OptionSet'][_0x7660('0xd5')][_0x7660('0xcf')]['UserLocalizedLabel'][_0x7660('0xcf')],'value':_0x7660('0xd6')},{'name':_0x5e6d36[_0x7660('0xcd')][_0x7660('0xd7')][_0x7660('0xcf')][_0x7660('0xd0')]['Label'],'value':_0x7660('0xd8')});var _0x473d99={'id':_0x3db016+'_'+_0x5e6d36[_0x7660('0xd2')],'name':_0x5e6d36[_0x7660('0xd3')][_0x7660('0xd0')][_0x7660('0xcf')],'custom':![],'options':_0x1a356b};_0x24764d['push'](_0x473d99);return _0x24764d;});}function getInputList(_0x5d6dde,_0x568dee,_0x5dec9c,_0x4ee4b1,_0x4fceeb,_0xadd8ea,_0x42be41){var _0x32fd96={'method':'GET','uri':_0x5d6dde+_0x7660('0xb2')+_0x4fceeb+_0x7660('0xca')+_0xadd8ea+')/Microsoft.Dynamics.CRM.'+_0x5dec9c+_0x7660('0xd9'),'headers':{'Authorization':'Bearer\x20'+_0x42be41,'If-None-Match':null,'OData-Version':_0x7660('0xaf')},'json':!![]};return rp(_0x32fd96)['then'](function(_0x43978e){var _0x290875={'id':_0x568dee+'_'+_0x43978e['LogicalName'],'name':_0x43978e[_0x7660('0xd3')][_0x7660('0xd0')]?_0x43978e[_0x7660('0xd3')]['UserLocalizedLabel'][_0x7660('0xcf')]:_0x43978e[_0x7660('0xd2')],'custom':![],'options':[]};_0x4ee4b1[_0x7660('0xbb')](_0x290875);return _0x4ee4b1;});} \ No newline at end of file +var _0x048c=['Bearer\x20','4.0','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','params','getConfigurations','findOne','rawAttributes','order','pick','AccountId','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','Subjects','getFields','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','slice','substring','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','clientSecret','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'];(function(_0x180147,_0x4b2ee9){var _0x4e3768=function(_0x3fccbf){while(--_0x3fccbf){_0x180147['push'](_0x180147['shift']());}};_0x4e3768(++_0x4b2ee9);}(_0x048c,0x1e6));var _0xc048=function(_0x5441a3,_0x5e6fee){_0x5441a3=_0x5441a3-0x0;var _0x56bbf5=_0x048c[_0x5441a3];return _0x56bbf5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc048('0x0'));var rimraf=require(_0xc048('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc048('0x2'));var rp=require(_0xc048('0x3'));var moment=require(_0xc048('0x4'));var BPromise=require(_0xc048('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc048('0x6'));var sox=require('sox');var csv=require(_0xc048('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc048('0x8'));var squel=require(_0xc048('0x9'));var crypto=require(_0xc048('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc048('0xb'));var toCsv=require(_0xc048('0x7'));var querystring=require(_0xc048('0xc'));var Papa=require(_0xc048('0xd'));var Redis=require(_0xc048('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc048('0xf'));var as=require(_0xc048('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc048('0x11'));var config=require(_0xc048('0x12'));var db=require(_0xc048('0x13'))['db'];var integrations=require(_0xc048('0x14'));var jayson=require(_0xc048('0x15'));var client=jayson[_0xc048('0x16')][_0xc048('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2d3625,_0x59b250,_0x2f39ba){if(_0x2f39ba){var _0x2659a1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2659a1[_0xc048('0x18')](_0x59b250)){return _0x2d3625;}else{throw new db[(_0xc048('0x19'))][(_0xc048('0x1a'))](_0xc048('0x1b'));}}else{return _0x2d3625;}}function respondWithRpcPromise(_0x4ebcf5,_0x49f903,_0x5538ee,_0x10a2e4){return new BPromise(function(_0x3dfd45,_0x1cefbe){var _0x9559c5=_0x10a2e4||client;return _0x9559c5['request'](_0x4ebcf5,_0x5538ee)[_0xc048('0x1c')](function(_0x43fe14){logger[_0xc048('0x1d')](_0xc048('0x1e'),_0x49f903,_0xc048('0x1f'));logger[_0xc048('0x20')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x49f903,_0xc048('0x1f'),JSON[_0xc048('0x21')](_0x43fe14));if(_0x43fe14[_0xc048('0x22')]){if(_0x43fe14[_0xc048('0x22')]['code']===0x1f4){logger[_0xc048('0x22')](_0xc048('0x1e'),_0x49f903,_0x43fe14['error']['message']);return _0x1cefbe(_0x43fe14[_0xc048('0x22')][_0xc048('0x23')]);}logger[_0xc048('0x22')](_0xc048('0x1e'),_0x49f903,_0x43fe14[_0xc048('0x22')][_0xc048('0x23')]);return _0x3dfd45(_0x43fe14[_0xc048('0x22')][_0xc048('0x23')]);}else{logger['info'](_0xc048('0x1e'),_0x49f903,'request\x20sent');_0x3dfd45(_0x43fe14[_0xc048('0x24')][_0xc048('0x23')]);}})[_0xc048('0x25')](function(_0x3452da){logger['error'](_0xc048('0x1e'),_0x49f903,_0x3452da);_0x1cefbe(_0x3452da);});});}function respondWithStatusCode(_0x35f567,_0x5a6a80){_0x5a6a80=_0x5a6a80||0xcc;return function(_0x88fa95){if(_0x88fa95){return _0x35f567[_0xc048('0x26')](_0x5a6a80);}return _0x35f567['status'](_0x5a6a80)['end']();};}function respondWithResult(_0x220252,_0x2f4541){_0x2f4541=_0x2f4541||0xc8;return function(_0x58a154){if(_0x58a154){return _0x220252[_0xc048('0x27')](_0x2f4541)[_0xc048('0x28')](_0x58a154);}};}function respondWithFilteredResult(_0x51506e,_0xfe5dd2){return function(_0x593d61){if(_0x593d61){var _0x48b72d=_0x593d61[_0xc048('0x29')],_0x2d4f0c=_0xfe5dd2[_0xc048('0x2a')],_0xcb869b=_0xfe5dd2[_0xc048('0x2a')]+_0xfe5dd2['limit'],_0x530f5d;if(_0xcb869b>=_0x48b72d){_0xcb869b=_0x48b72d;_0x530f5d=0xc8;}else{_0x530f5d=0xce;}_0x51506e[_0xc048('0x27')](_0x530f5d);return _0x51506e[_0xc048('0x2b')](_0xc048('0x2c'),_0x2d4f0c+'-'+_0xcb869b+'/'+_0x48b72d)[_0xc048('0x28')](_0x593d61);}return null;};}function patchUpdates(_0x2892ff){return function(_0x5874c9){try{jsonpatch[_0xc048('0x2d')](_0x5874c9,_0x2892ff,!![]);}catch(_0x264a56){return BPromise[_0xc048('0x2e')](_0x264a56);}return _0x5874c9[_0xc048('0x2f')]();};}function saveUpdates(_0x10eeaa,_0x3635f5){return function(_0x5db209){if(_0x5db209){return _0x5db209[_0xc048('0x30')](_0x10eeaa)['then'](function(_0x530dbe){return _0x530dbe;});}return null;};}function removeEntity(_0x1f3af1,_0xca67cb){return function(_0x550359){if(_0x550359){return _0x550359[_0xc048('0x31')]()[_0xc048('0x1c')](function(){_0x1f3af1['status'](0xcc)[_0xc048('0x32')]();});}};}function handleEntityNotFound(_0x44ae12,_0x41bc3c){return function(_0x40e6e3){if(!_0x40e6e3){_0x44ae12['sendStatus'](0x194);}return _0x40e6e3;};}function handleError(_0xf67c99,_0x431bfb){_0x431bfb=_0x431bfb||0x1f4;return function(_0x33927a){logger[_0xc048('0x22')](_0x33927a[_0xc048('0x33')]);if(_0x33927a[_0xc048('0x34')]){delete _0x33927a[_0xc048('0x34')];}_0xf67c99[_0xc048('0x27')](_0x431bfb)[_0xc048('0x35')](_0x33927a);};}exports[_0xc048('0x36')]=function(_0x13f5ad,_0x4454c7){var _0xcb5c4f={},_0x12f02c={},_0x4cae63={'count':0x0,'rows':[]};var _0x1f2c47=_[_0xc048('0x37')](db[_0xc048('0x38')]['rawAttributes'],function(_0x1cf893){return{'name':_0x1cf893[_0xc048('0x39')],'type':_0x1cf893[_0xc048('0x3a')][_0xc048('0x3b')]};});_0x12f02c['model']=_['map'](_0x1f2c47,_0xc048('0x34'));_0x12f02c[_0xc048('0x3c')]=_[_0xc048('0x3d')](_0x13f5ad['query']);_0x12f02c[_0xc048('0x3e')]=_['intersection'](_0x12f02c[_0xc048('0x3f')],_0x12f02c[_0xc048('0x3c')]);_0xcb5c4f['attributes']=_[_0xc048('0x40')](_0x12f02c[_0xc048('0x3f')],qs['fields'](_0x13f5ad[_0xc048('0x3c')][_0xc048('0x41')]));_0xcb5c4f[_0xc048('0x42')]=_0xcb5c4f[_0xc048('0x42')][_0xc048('0x43')]?_0xcb5c4f[_0xc048('0x42')]:_0x12f02c[_0xc048('0x3f')];if(!_0x13f5ad[_0xc048('0x3c')][_0xc048('0x44')](_0xc048('0x45'))){_0xcb5c4f[_0xc048('0x46')]=qs[_0xc048('0x46')](_0x13f5ad['query'][_0xc048('0x46')]);_0xcb5c4f[_0xc048('0x2a')]=qs[_0xc048('0x2a')](_0x13f5ad['query']['offset']);}_0xcb5c4f['order']=qs[_0xc048('0x47')](_0x13f5ad[_0xc048('0x3c')][_0xc048('0x47')]);_0xcb5c4f[_0xc048('0x48')]=qs[_0xc048('0x3e')](_['pick'](_0x13f5ad[_0xc048('0x3c')],_0x12f02c[_0xc048('0x3e')]),_0x1f2c47);if(_0x13f5ad['query'][_0xc048('0x49')]){_0xcb5c4f[_0xc048('0x48')]=_[_0xc048('0x4a')](_0xcb5c4f[_0xc048('0x48')],{'$or':_[_0xc048('0x37')](_0x1f2c47,function(_0x2a466f){if(_0x2a466f[_0xc048('0x3a')]!==_0xc048('0x4b')){var _0xc82f73={};_0xc82f73[_0x2a466f['name']]={'$like':'%'+_0x13f5ad[_0xc048('0x3c')][_0xc048('0x49')]+'%'};return _0xc82f73;}})});}_0xcb5c4f=_[_0xc048('0x4a')]({},_0xcb5c4f,_0x13f5ad[_0xc048('0x4c')]);var _0x3061c5={'where':_0xcb5c4f[_0xc048('0x48')]};return db[_0xc048('0x38')][_0xc048('0x29')](_0x3061c5)[_0xc048('0x1c')](function(_0x4844e4){_0x4cae63[_0xc048('0x29')]=_0x4844e4;if(_0x13f5ad['query'][_0xc048('0x4d')]){_0xcb5c4f[_0xc048('0x4e')]=[{'all':!![]}];}return db[_0xc048('0x38')][_0xc048('0x4f')](_0xcb5c4f);})[_0xc048('0x1c')](function(_0x38d70e){_0x4cae63[_0xc048('0x50')]=_0x38d70e;return _0x4cae63;})[_0xc048('0x1c')](respondWithFilteredResult(_0x4454c7,_0xcb5c4f))[_0xc048('0x25')](handleError(_0x4454c7,null));};exports['show']=function(_0x473a5f,_0x58b865){var _0x124c45={'raw':![],'where':{'id':_0x473a5f['params']['id']}},_0xaad50={};_0xaad50[_0xc048('0x3f')]=_[_0xc048('0x3d')](db[_0xc048('0x38')]['rawAttributes']);_0xaad50[_0xc048('0x3c')]=_[_0xc048('0x3d')](_0x473a5f[_0xc048('0x3c')]);_0xaad50[_0xc048('0x3e')]=_[_0xc048('0x40')](_0xaad50[_0xc048('0x3f')],_0xaad50[_0xc048('0x3c')]);_0x124c45[_0xc048('0x42')]=_[_0xc048('0x40')](_0xaad50[_0xc048('0x3f')],qs[_0xc048('0x41')](_0x473a5f[_0xc048('0x3c')]['fields']));_0x124c45[_0xc048('0x42')]=_0x124c45[_0xc048('0x42')][_0xc048('0x43')]?_0x124c45[_0xc048('0x42')]:_0xaad50[_0xc048('0x3f')];if(_0x473a5f['query'][_0xc048('0x4d')]){_0x124c45[_0xc048('0x4e')]=[{'all':!![]}];}_0x124c45=_[_0xc048('0x4a')]({},_0x124c45,_0x473a5f[_0xc048('0x4c')]);return db[_0xc048('0x38')][_0xc048('0x51')](_0x124c45)[_0xc048('0x1c')](handleEntityNotFound(_0x58b865,null))[_0xc048('0x1c')](respondWithResult(_0x58b865,null))[_0xc048('0x25')](handleError(_0x58b865,null));};exports[_0xc048('0x52')]=function(_0x4bc974,_0x425a6d){return db[_0xc048('0x38')][_0xc048('0x52')](_0x4bc974[_0xc048('0x53')],{})[_0xc048('0x1c')](respondWithResult(_0x425a6d,0xc9))[_0xc048('0x25')](handleError(_0x425a6d,null));};exports[_0xc048('0x30')]=function(_0x473e90,_0x4c029e){if(_0x473e90[_0xc048('0x53')]['id']){delete _0x473e90[_0xc048('0x53')]['id'];}return db[_0xc048('0x38')][_0xc048('0x51')]({'where':{'id':_0x473e90[_0xc048('0x54')]['id']}})[_0xc048('0x1c')](handleEntityNotFound(_0x4c029e,null))[_0xc048('0x1c')](saveUpdates(_0x473e90[_0xc048('0x53')],null))[_0xc048('0x1c')](respondWithResult(_0x4c029e,null))['catch'](handleError(_0x4c029e,null));};exports[_0xc048('0x31')]=function(_0x3a491d,_0x2596bb){return db['Dynamics365Account'][_0xc048('0x51')]({'where':{'id':_0x3a491d[_0xc048('0x54')]['id']}})['then'](handleEntityNotFound(_0x2596bb,null))[_0xc048('0x1c')](removeEntity(_0x2596bb,null))[_0xc048('0x25')](handleError(_0x2596bb,null));};exports[_0xc048('0x55')]=function(_0x4ae607,_0x41b335,_0x2e7f9f){var _0x123644={};var _0x43e8a6={};var _0x528dd6;var _0x41764c;return db[_0xc048('0x38')][_0xc048('0x56')]({'where':{'id':_0x4ae607['params']['id']}})[_0xc048('0x1c')](handleEntityNotFound(_0x41b335,null))[_0xc048('0x1c')](function(_0x1dc05c){if(_0x1dc05c){_0x528dd6=_0x1dc05c;_0x43e8a6[_0xc048('0x3f')]=_[_0xc048('0x3d')](db['Dynamics365Configuration'][_0xc048('0x57')]);_0x43e8a6['query']=_[_0xc048('0x3d')](_0x4ae607[_0xc048('0x3c')]);_0x43e8a6[_0xc048('0x3e')]=_[_0xc048('0x40')](_0x43e8a6[_0xc048('0x3f')],_0x43e8a6['query']);_0x123644['attributes']=_[_0xc048('0x40')](_0x43e8a6[_0xc048('0x3f')],qs['fields'](_0x4ae607[_0xc048('0x3c')][_0xc048('0x41')]));_0x123644[_0xc048('0x42')]=_0x123644[_0xc048('0x42')]['length']?_0x123644['attributes']:_0x43e8a6[_0xc048('0x3f')];_0x123644[_0xc048('0x58')]=qs['sort'](_0x4ae607[_0xc048('0x3c')][_0xc048('0x47')]);_0x123644[_0xc048('0x48')]=qs[_0xc048('0x3e')](_[_0xc048('0x59')](_0x4ae607[_0xc048('0x3c')],_0x43e8a6[_0xc048('0x3e')]));if(_0x4ae607[_0xc048('0x3c')][_0xc048('0x49')]){_0x123644[_0xc048('0x48')]=_[_0xc048('0x4a')](_0x123644[_0xc048('0x48')],{'$or':_[_0xc048('0x37')](_0x123644[_0xc048('0x42')],function(_0x522b76){var _0x482e08={};_0x482e08[_0x522b76]={'$like':'%'+_0x4ae607[_0xc048('0x3c')][_0xc048('0x49')]+'%'};return _0x482e08;})});}_0x123644=_[_0xc048('0x4a')]({},_0x123644,_0x4ae607[_0xc048('0x4c')]);return _0x528dd6[_0xc048('0x55')](_0x123644);}})[_0xc048('0x1c')](function(_0x44007e){if(_0x44007e){_0x41764c=_0x44007e[_0xc048('0x43')];if(!_0x4ae607[_0xc048('0x3c')][_0xc048('0x44')](_0xc048('0x45'))){_0x123644[_0xc048('0x46')]=qs['limit'](_0x4ae607['query'][_0xc048('0x46')]);_0x123644[_0xc048('0x2a')]=qs[_0xc048('0x2a')](_0x4ae607[_0xc048('0x3c')][_0xc048('0x2a')]);}return _0x528dd6[_0xc048('0x55')](_0x123644);}})[_0xc048('0x1c')](function(_0x19daf9){if(_0x19daf9){return _0x19daf9?{'count':_0x41764c,'rows':_0x19daf9}:null;}})[_0xc048('0x1c')](respondWithResult(_0x41b335,null))[_0xc048('0x25')](handleError(_0x41b335,null));};exports['addConfiguration']=function(_0x98979f,_0x3fdcf3,_0x22de82){if(_0x98979f['body']['id']){delete _0x98979f[_0xc048('0x53')]['id'];}return db[_0xc048('0x38')]['findOne']({'where':{'id':_0x98979f[_0xc048('0x54')]['id']}})['then'](handleEntityNotFound(_0x3fdcf3,null))[_0xc048('0x1c')](function(_0x4d6543){if(_0x4d6543){_0x98979f[_0xc048('0x53')][_0xc048('0x5a')]=_0x4d6543['id'];_0x98979f[_0xc048('0x53')]['Subjects']=integrations['getSubjects'](_0x98979f['body'][_0xc048('0x5b')],_0x98979f[_0xc048('0x53')][_0xc048('0x3a')]);_0x98979f['body'][_0xc048('0x5c')]=integrations[_0xc048('0x5d')](_0x98979f['body'][_0xc048('0x5b')],_0x98979f[_0xc048('0x53')][_0xc048('0x3a')]);return db[_0xc048('0x5e')]['create'](_0x98979f[_0xc048('0x53')],{'include':[{'model':db[_0xc048('0x5f')],'as':_0xc048('0x60')},{'model':db[_0xc048('0x5f')],'as':_0xc048('0x5c')}]});}return null;})[_0xc048('0x1c')](respondWithResult(_0x3fdcf3,null))[_0xc048('0x25')](handleError(_0x3fdcf3,null));};exports[_0xc048('0x61')]=function(_0x1e3d13,_0x4d089b,_0x2682b9){var _0xa2aced=_0x1e3d13[_0xc048('0x3c')][_0xc048('0x62')];var _0x15006a=_0xa2aced==='incident'?_0xc048('0x63'):_0xc048('0x64');var _0x5cc2a9='';var _0x41c200='';var _0xa166f6='';var _0x2fc31a='';var _0xb3d1c3='';var _0x40550a='';var _0x2cca9e='';var _0x1cacca='';var _0x3dd6fb=[_0xc048('0x65'),_0xc048('0x66'),_0xc048('0x67'),_0xc048('0x68'),'caseorigincode',_0xc048('0x69'),'phonenumber','regardingobjectid',_0xc048('0x6a'),_0xc048('0x6b')];var _0x1b95ff=[_0xc048('0x6c'),_0xc048('0x6d'),_0xc048('0x6e'),_0xc048('0x6f'),_0xc048('0x70'),_0xc048('0x71'),_0xc048('0x72'),_0xc048('0x73'),_0xc048('0x74'),_0xc048('0x75'),_0xc048('0x76'),_0xc048('0x77'),_0xc048('0x78'),'createdonbehalfbyname',_0xc048('0x79'),_0xc048('0x7a'),_0xc048('0x7b'),_0xc048('0x7c'),_0xc048('0x7d'),_0xc048('0x7e'),_0xc048('0x7f'),'entityimage_url',_0xc048('0x80'),'exchangerate','firstresponsebykpiidname',_0xc048('0x81'),_0xc048('0x82'),'influencescore',_0xc048('0x83'),_0xc048('0x84'),_0xc048('0x85'),_0xc048('0x86'),_0xc048('0x87'),_0xc048('0x88'),_0xc048('0x89'),_0xc048('0x8a'),_0xc048('0x8b'),'modifiedonbehalfbyyominame',_0xc048('0x8c'),'msdyn_iotalertname',_0xc048('0x8d'),_0xc048('0x8e'),_0xc048('0x8f'),_0xc048('0x90'),_0xc048('0x91'),_0xc048('0x92'),'parentcaseidname',_0xc048('0x93'),_0xc048('0x94'),_0xc048('0x95'),_0xc048('0x96'),_0xc048('0x97'),_0xc048('0x98'),_0xc048('0x99'),_0xc048('0x9a'),_0xc048('0x9b'),_0xc048('0x9c'),_0xc048('0x9d'),_0xc048('0x9e'),_0xc048('0x9f'),'socialprofileidname','statecode',_0xc048('0xa0'),'subjectidname','ticketnumber',_0xc048('0xa1'),_0xc048('0xa2'),_0xc048('0xa3'),_0xc048('0xa4'),_0xc048('0xa5')];var _0x4b675f=_0x3dd6fb['concat'](_0x1b95ff);return db[_0xc048('0x38')][_0xc048('0x56')]({'where':{'id':_0x1e3d13[_0xc048('0x54')]['id']},'attributes':['id',_0xc048('0xa6'),_0xc048('0xa7'),_0xc048('0xa8'),_0xc048('0xa9'),_0xc048('0xaa'),'clientSecret']})[_0xc048('0x1c')](handleEntityNotFound(_0x4d089b,null))[_0xc048('0x1c')](function(_0x4095ce){if(_0x4095ce){_0x1cacca=_0x4095ce['remoteUri'];var _0x2080f0=_0x1cacca[_0xc048('0xab')](-0x1);if(_0x2080f0==='/'){_0x1cacca=_0x1cacca[_0xc048('0xac')](0x0,_0x1cacca['lastIndexOf'](_0x2080f0));}_0x2cca9e=util[_0xc048('0xad')](_0xc048('0xae'),_0x1cacca);var _0x189409={'method':'POST','uri':_0xc048('0xaf')+_0x4095ce['tenantId']+_0xc048('0xb0'),'form':{'client_id':_0x4095ce[_0xc048('0xaa')],'resource':_0x1cacca,'username':_0x4095ce[_0xc048('0xa6')],'password':_0x4095ce[_0xc048('0xa7')],'grant_type':'password','client_secret':_0x4095ce[_0xc048('0xb1')]},'json':!![]};return rp(_0x189409);}})[_0xc048('0x1c')](function(_0x47df45){_0x40550a=_0x47df45[_0xc048('0xb2')];var _0x4442dc={'method':'GET','uri':encodeURI(_0x2cca9e+_0xc048('0xb3')+_0x15006a+'\x27'),'headers':{'Authorization':_0xc048('0xb4')+_0x40550a,'If-None-Match':null,'OData-Version':_0xc048('0xb5')},'json':!![]};return rp(_0x4442dc);})[_0xc048('0x1c')](function(_0x56d1dc){var _0x342d61=_0x56d1dc['value'][0x0];var _0x4f67f5=_0x342d61[_0xc048('0xb6')];var _0x2ad1f6={'method':_0xc048('0xb7'),'uri':_0x2cca9e+_0xc048('0xb8')+_0x4f67f5+_0xc048('0xb9'),'headers':{'Authorization':_0xc048('0xb4')+_0x40550a,'If-None-Match':null,'OData-Version':_0xc048('0xb5')},'json':!![]};return rp(_0x2ad1f6);})[_0xc048('0x1c')](function(_0x51efe7){_0x5cc2a9=_0x51efe7;_0x41c200=_0x5cc2a9[_0xc048('0xba')];_0x41c200=_[_0xc048('0xbb')](_0x41c200,function(_0x2a5d86){return!_0x4b675f[_0xc048('0xbc')](_0x2a5d86[_0xc048('0xbd')]);});var _0x467395=[];var _0x15f3fb=[];_0x41c200[_0xc048('0xbe')](function(_0x698f63){if(_0x698f63[_0xc048('0xbf')]){var _0x34d2d3=_0x698f63[_0xc048('0xbf')][_0xc048('0xac')](_0x698f63[_0xc048('0xbf')][_0xc048('0xc0')]('.')+0x1);if(_0x34d2d3===_0xc048('0xc1')){_0x467395[_0xc048('0xc2')](getSelectList(_0x2cca9e,_0xa2aced,_0x15f3fb,_0x5cc2a9[_0xc048('0xb6')],_0x698f63['MetadataId'],_0x40550a));}}});return Promise[_0xc048('0xc3')](_0x467395);})[_0xc048('0x1c')](function(_0x57e128){_0xa166f6=_0x57e128[0x0];var _0x323226=[];var _0xa1587c=[];_0x41c200['forEach'](function(_0x5494fa){if(!_[_0xc048('0xc4')](_0x5494fa[_0xc048('0xbf')])){var _0x26e693=_0x5494fa['@odata.type'][_0xc048('0xac')](_0x5494fa['@odata.type'][_0xc048('0xc0')]('.')+0x1);if(_0x26e693==='BooleanAttributeMetadata'){_0x323226['push'](getBooleanList(_0x2cca9e,_0xa2aced,_0xa1587c,_0x5cc2a9['MetadataId'],_0x5494fa[_0xc048('0xb6')],_0x40550a));}}});return Promise[_0xc048('0xc3')](_0x323226);})[_0xc048('0x1c')](function(_0x5a1633){_0x2fc31a=_0x5a1633[0x0];var _0x58babb=[];var _0x22525f=[];_0x41c200[_0xc048('0xbe')](function(_0x34bd49){if(_0x34bd49[_0xc048('0xbf')]){var _0x4a0dc5=_0x34bd49[_0xc048('0xbf')][_0xc048('0xac')](_0x34bd49[_0xc048('0xbf')]['lastIndexOf']('.')+0x1);if(_0x4a0dc5===_0xc048('0xc5')||_0x4a0dc5===_0xc048('0xc6')||_0x4a0dc5===_0xc048('0xc7')||_0x4a0dc5===_0xc048('0xc8')||_0x4a0dc5===_0xc048('0xc9')||_0x4a0dc5===_0xc048('0xca')||_0x4a0dc5===_0xc048('0xcb')||_0x4a0dc5===_0xc048('0xcc')||_0x4a0dc5===_0xc048('0xcd')||_0x4a0dc5===_0xc048('0xce')){_0x58babb[_0xc048('0xc2')](getInputList(_0x2cca9e,_0xa2aced,_0x4a0dc5,_0x22525f,_0x5cc2a9['MetadataId'],_0x34bd49[_0xc048('0xb6')],_0x40550a));}}});return Promise['all'](_0x58babb);})[_0xc048('0x1c')](function(_0x12d73e){_0xb3d1c3=_0x12d73e[0x0];var _0x1ab9fa=_0xa166f6['concat'](_0x2fc31a)[_0xc048('0xcf')](_0xb3d1c3);var _0x1cc5a4={'count':_0x1ab9fa['length'],'rows':_0x1ab9fa};return _0x1cc5a4;})[_0xc048('0x1c')](respondWithResult(_0x4d089b,null))[_0xc048('0x25')](function(_0x54226b){var _0x3bc5f9=_0x1e3d13[_0xc048('0x3c')]['test']?0x1f4:_0x54226b[_0xc048('0xd0')]||0x1f4;logger[_0xc048('0x22')](_0x54226b[_0xc048('0x33')]);delete _0x54226b[_0xc048('0x34')];if(_0x3bc5f9===0x191){_0x3bc5f9=0x190;}_0x4d089b[_0xc048('0x27')](_0x3bc5f9)['send'](_0x1e3d13[_0xc048('0x3c')][_0xc048('0x18')]?{'message':_0xc048('0xd1'),'statusCode':_0x54226b['statusCode']}:_0x54226b);});};function getSelectList(_0x3fcac8,_0x3a6dd5,_0xb0ae79,_0x48c02b,_0x353edb,_0xbfbc45){var _0x4659ba={'method':_0xc048('0xb7'),'uri':_0x3fcac8+'EntityDefinitions('+_0x48c02b+_0xc048('0xd2')+_0x353edb+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xc048('0xd3'),'headers':{'Authorization':_0xc048('0xb4')+_0xbfbc45,'If-None-Match':null,'OData-Version':_0xc048('0xb5')},'json':!![]};return rp(_0x4659ba)[_0xc048('0x1c')](function(_0x57d638){var _0x5db87f=[];var _0x36f18f=_0x57d638[_0xc048('0xd4')][_0xc048('0xd5')];_0x36f18f[_0xc048('0xbe')](function(_0x4ec2bf){_0x5db87f[_0xc048('0xc2')]({'name':_0x4ec2bf[_0xc048('0xd6')][_0xc048('0xd7')][_0xc048('0xd6')],'value':String(_0x4ec2bf[_0xc048('0xd8')])});});var _0x1bc7ea={'id':_0x3a6dd5+'_'+_0x57d638['LogicalName'],'name':_0x57d638[_0xc048('0xd9')][_0xc048('0xd7')][_0xc048('0xd6')],'custom':![],'options':_0x5db87f};_0xb0ae79['push'](_0x1bc7ea);return _0xb0ae79;});}function getBooleanList(_0x41a8c5,_0x2de11a,_0x547df5,_0x146d8b,_0x357b96,_0x3eaecd){var _0x22741d={'method':_0xc048('0xb7'),'uri':_0x41a8c5+_0xc048('0xb8')+_0x146d8b+_0xc048('0xd2')+_0x357b96+_0xc048('0xda'),'headers':{'Authorization':_0xc048('0xb4')+_0x3eaecd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x22741d)[_0xc048('0x1c')](function(_0xef51ec){var _0x4ed09b=[];_0x4ed09b[_0xc048('0xc2')]({'name':_0xef51ec[_0xc048('0xd4')]['TrueOption'][_0xc048('0xd6')][_0xc048('0xd7')][_0xc048('0xd6')],'value':_0xc048('0xdb')},{'name':_0xef51ec[_0xc048('0xd4')][_0xc048('0xdc')][_0xc048('0xd6')][_0xc048('0xd7')]['Label'],'value':'false'});var _0x537383={'id':_0x2de11a+'_'+_0xef51ec[_0xc048('0xbd')],'name':_0xef51ec[_0xc048('0xd9')][_0xc048('0xd7')][_0xc048('0xd6')],'custom':![],'options':_0x4ed09b};_0x547df5['push'](_0x537383);return _0x547df5;});}function getInputList(_0x26c319,_0x5df468,_0xe5525b,_0x2c8d30,_0x217e19,_0x531a7c,_0x28fcbe){var _0x1fd0b4={'method':_0xc048('0xb7'),'uri':_0x26c319+_0xc048('0xb8')+_0x217e19+_0xc048('0xd2')+_0x531a7c+_0xc048('0xdd')+_0xe5525b+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xc048('0xb4')+_0x28fcbe,'If-None-Match':null,'OData-Version':_0xc048('0xb5')},'json':!![]};return rp(_0x1fd0b4)['then'](function(_0x2c2769){var _0x5d6d5e={'id':_0x5df468+'_'+_0x2c2769[_0xc048('0xbd')],'name':_0x2c2769[_0xc048('0xd9')][_0xc048('0xd7')]?_0x2c2769[_0xc048('0xd9')]['UserLocalizedLabel']['Label']:_0x2c2769[_0xc048('0xbd')],'custom':![],'options':[]};_0x2c8d30[_0xc048('0xc2')](_0x5d6d5e);return _0x2c8d30;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f91f73e..b7bed01 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 _0xd3c8=['define','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0xa265ca,_0x2ff07c){var _0x3a50ef=function(_0x5255f1){while(--_0x5255f1){_0xa265ca['push'](_0xa265ca['shift']());}};_0x3a50ef(++_0x2ff07c);}(_0xd3c8,0x161));var _0x8d3c=function(_0x4998b3,_0x3cd673){_0x4998b3=_0x4998b3-0x0;var _0x225977=_0xd3c8[_0x4998b3];return _0x225977;};'use strict';var _=require(_0x8d3c('0x0'));var util=require(_0x8d3c('0x1'));var logger=require(_0x8d3c('0x2'))(_0x8d3c('0x3'));var moment=require(_0x8d3c('0x4'));var BPromise=require('bluebird');var rp=require(_0x8d3c('0x5'));var fs=require('fs');var path=require(_0x8d3c('0x6'));var rimraf=require(_0x8d3c('0x7'));var config=require(_0x8d3c('0x8'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x8d3c('0x9'));module[_0x8d3c('0xa')]=function(_0x103825,_0x37d7b4){return _0x103825[_0x8d3c('0xb')](_0x8d3c('0xc'),attributes,{'tableName':_0x8d3c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd786=['request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd786,0x1dc));var _0x6d78=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xd786[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x6d78('0x0'));var util=require(_0x6d78('0x1'));var logger=require(_0x6d78('0x2'))(_0x6d78('0x3'));var moment=require('moment');var BPromise=require(_0x6d78('0x4'));var rp=require(_0x6d78('0x5'));var fs=require('fs');var path=require(_0x6d78('0x6'));var rimraf=require(_0x6d78('0x7'));var config=require(_0x6d78('0x8'));var attributes=require(_0x6d78('0x9'));var integrations=require(_0x6d78('0xa'));module['exports']=function(_0x18c038,_0x30e9e5){return _0x18c038['define'](_0x6d78('0xb'),attributes,{'tableName':_0x6d78('0xc'),'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 4e05bd8..bb13120 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 _0x5c91=['include','map','model','debug','stringify','ShowDynamics365Account','find','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x5c91,0x1e9));var _0x15c9=function(_0x4f769a,_0x25b20e){_0x4f769a=_0x4f769a-0x0;var _0x5ef724=_0x5c91[_0x4f769a];return _0x5ef724;};'use strict';var _=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var moment=require(_0x15c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x15c9('0x3'));var fs=require('fs');var Redis=require(_0x15c9('0x4'));var db=require(_0x15c9('0x5'))['db'];var utils=require(_0x15c9('0x6'));var logger=require(_0x15c9('0x7'))(_0x15c9('0x8'));var config=require('../../config/environment');var jayson=require(_0x15c9('0x9'));var client=jayson[_0x15c9('0xa')][_0x15c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42bcb6,_0x2c213e,_0x51a779){return new BPromise(function(_0x191695,_0x114775){return client[_0x15c9('0xc')](_0x42bcb6,_0x51a779)['then'](function(_0x23adaf){logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x2c213e,'request\x20sent');logger['debug'](_0x15c9('0xf'),_0x2c213e,_0x15c9('0x10'),JSON['stringify'](_0x23adaf));if(_0x23adaf['error']){if(_0x23adaf['error'][_0x15c9('0x11')]===0x1f4){logger[_0x15c9('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x2c213e,_0x23adaf[_0x15c9('0x12')][_0x15c9('0x13')]);return _0x114775(_0x23adaf[_0x15c9('0x12')]['message']);}logger['error'](_0x15c9('0xe'),_0x2c213e,_0x23adaf[_0x15c9('0x12')]['message']);return _0x191695(_0x23adaf[_0x15c9('0x12')]['message']);}else{logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x2c213e,_0x15c9('0x10'));_0x191695(_0x23adaf[_0x15c9('0x14')][_0x15c9('0x13')]);}})[_0x15c9('0x15')](function(_0x5eb50e){logger[_0x15c9('0x12')](_0x15c9('0xe'),_0x2c213e,_0x5eb50e);_0x114775(_0x5eb50e);});});}exports[_0x15c9('0x16')]=function(_0x449f20){var _0x2390a4=this;return new Promise(function(_0x2d36e5,_0x1c4b1a){return db[_0x15c9('0x17')]['findAll']({'raw':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x19')]===undefined?!![]:![]:!![],'where':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x1a')]||null:null,'attributes':_0x449f20[_0x15c9('0x18')]?_0x449f20['options'][_0x15c9('0x1b')]||null:null,'limit':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x1c')]||null:null,'include':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x1d')]?_[_0x15c9('0x1e')](_0x449f20[_0x15c9('0x18')][_0x15c9('0x1d')],function(_0x499ae2){return{'model':db[_0x499ae2[_0x15c9('0x1f')]],'as':_0x499ae2['as'],'attributes':_0x499ae2['attributes'],'include':_0x499ae2[_0x15c9('0x1d')]?_[_0x15c9('0x1e')](_0x499ae2['include'],function(_0x229ae9){return{'model':db[_0x229ae9[_0x15c9('0x1f')]],'as':_0x229ae9['as'],'attributes':_0x229ae9[_0x15c9('0x1b')],'include':_0x229ae9['include']?_['map'](_0x229ae9[_0x15c9('0x1d')],function(_0x3f372b){return{'model':db[_0x3f372b[_0x15c9('0x1f')]],'as':_0x3f372b['as'],'attributes':_0x3f372b[_0x15c9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12f6ed){logger[_0x15c9('0xd')](_0x15c9('0x16'),_0x449f20);logger[_0x15c9('0x20')](_0x15c9('0x16'),_0x449f20,JSON[_0x15c9('0x21')](_0x12f6ed));_0x2d36e5(_0x12f6ed);})[_0x15c9('0x15')](function(_0x86fd2e){logger['error'](_0x15c9('0x16'),_0x86fd2e[_0x15c9('0x13')],_0x449f20);_0x1c4b1a(_0x2390a4[_0x15c9('0x12')](0x1f4,_0x86fd2e[_0x15c9('0x13')]));});});};exports[_0x15c9('0x22')]=function(_0x201e8b){var _0x411357=this;return new Promise(function(_0x7cf151,_0x32aba4){return db[_0x15c9('0x17')][_0x15c9('0x23')]({'raw':_0x201e8b[_0x15c9('0x18')]?_0x201e8b['options'][_0x15c9('0x19')]===undefined?!![]:![]:!![],'where':_0x201e8b['options']?_0x201e8b[_0x15c9('0x18')]['where']||null:null,'attributes':_0x201e8b[_0x15c9('0x18')]?_0x201e8b[_0x15c9('0x18')][_0x15c9('0x1b')]||null:null,'include':_0x201e8b['options']?_0x201e8b[_0x15c9('0x18')][_0x15c9('0x1d')]?_['map'](_0x201e8b['options'][_0x15c9('0x1d')],function(_0x1c0ad4){return{'model':db[_0x1c0ad4['model']],'as':_0x1c0ad4['as'],'attributes':_0x1c0ad4[_0x15c9('0x1b')],'include':_0x1c0ad4[_0x15c9('0x1d')]?_[_0x15c9('0x1e')](_0x1c0ad4[_0x15c9('0x1d')],function(_0x12649d){return{'model':db[_0x12649d[_0x15c9('0x1f')]],'as':_0x12649d['as'],'attributes':_0x12649d['attributes'],'include':_0x12649d[_0x15c9('0x1d')]?_['map'](_0x12649d[_0x15c9('0x1d')],function(_0x2cddaf){return{'model':db[_0x2cddaf['model']],'as':_0x2cddaf['as'],'attributes':_0x2cddaf[_0x15c9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x15c9('0x24')](function(_0x58e57e){logger[_0x15c9('0xd')](_0x15c9('0x22'),_0x201e8b);logger['debug']('ShowDynamics365Account',_0x201e8b,JSON[_0x15c9('0x21')](_0x58e57e));_0x7cf151(_0x58e57e);})[_0x15c9('0x15')](function(_0x4a81d5){logger['error']('ShowDynamics365Account',_0x4a81d5[_0x15c9('0x13')],_0x201e8b);_0x32aba4(_0x411357[_0x15c9('0x12')](0x1f4,_0x4a81d5['message']));});});}; \ No newline at end of file +var _0x0e4b=['rpc','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','include','model','attributes','map','find','ShowDynamics365Account','lodash','util','moment','randomstring'];(function(_0x1b28aa,_0x51bb80){var _0x249bde=function(_0x4649e4){while(--_0x4649e4){_0x1b28aa['push'](_0x1b28aa['shift']());}};_0x249bde(++_0x51bb80);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x1c6c41,_0x2022a3){_0x1c6c41=_0x1c6c41-0x0;var _0x273a14=_0x0e4b[_0x1c6c41];return _0x273a14;};'use strict';var _=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var moment=require(_0xb0e4('0x2'));var BPromise=require('bluebird');var rs=require(_0xb0e4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb0e4('0x4'));var config=require(_0xb0e4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0e4('0x6')][_0xb0e4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x78e4ed,_0x3dff2f,_0x35aa64){return new BPromise(function(_0x57f45d,_0x5192f0){return client[_0xb0e4('0x8')](_0x78e4ed,_0x35aa64)[_0xb0e4('0x9')](function(_0x1d6452){logger[_0xb0e4('0xa')](_0xb0e4('0xb'),_0x3dff2f,_0xb0e4('0xc'));logger[_0xb0e4('0xd')](_0xb0e4('0xe'),_0x3dff2f,_0xb0e4('0xc'),JSON[_0xb0e4('0xf')](_0x1d6452));if(_0x1d6452[_0xb0e4('0x10')]){if(_0x1d6452[_0xb0e4('0x10')][_0xb0e4('0x11')]===0x1f4){logger[_0xb0e4('0x10')](_0xb0e4('0xb'),_0x3dff2f,_0x1d6452['error'][_0xb0e4('0x12')]);return _0x5192f0(_0x1d6452[_0xb0e4('0x10')]['message']);}logger[_0xb0e4('0x10')](_0xb0e4('0xb'),_0x3dff2f,_0x1d6452[_0xb0e4('0x10')][_0xb0e4('0x12')]);return _0x57f45d(_0x1d6452[_0xb0e4('0x10')]['message']);}else{logger['info'](_0xb0e4('0xb'),_0x3dff2f,_0xb0e4('0xc'));_0x57f45d(_0x1d6452['result'][_0xb0e4('0x12')]);}})[_0xb0e4('0x13')](function(_0xc12df2){logger[_0xb0e4('0x10')](_0xb0e4('0xb'),_0x3dff2f,_0xc12df2);_0x5192f0(_0xc12df2);});});}exports[_0xb0e4('0x14')]=function(_0x570886){var _0x491a29=this;return new Promise(function(_0x4ba49e,_0x42e43d){return db[_0xb0e4('0x15')][_0xb0e4('0x16')]({'raw':_0x570886[_0xb0e4('0x17')]?_0x570886[_0xb0e4('0x17')][_0xb0e4('0x18')]===undefined?!![]:![]:!![],'where':_0x570886['options']?_0x570886[_0xb0e4('0x17')][_0xb0e4('0x19')]||null:null,'attributes':_0x570886[_0xb0e4('0x17')]?_0x570886[_0xb0e4('0x17')]['attributes']||null:null,'limit':_0x570886[_0xb0e4('0x17')]?_0x570886[_0xb0e4('0x17')]['limit']||null:null,'include':_0x570886[_0xb0e4('0x17')]?_0x570886[_0xb0e4('0x17')][_0xb0e4('0x1a')]?_['map'](_0x570886[_0xb0e4('0x17')]['include'],function(_0x4bc636){return{'model':db[_0x4bc636[_0xb0e4('0x1b')]],'as':_0x4bc636['as'],'attributes':_0x4bc636[_0xb0e4('0x1c')],'include':_0x4bc636[_0xb0e4('0x1a')]?_[_0xb0e4('0x1d')](_0x4bc636[_0xb0e4('0x1a')],function(_0x248aa5){return{'model':db[_0x248aa5[_0xb0e4('0x1b')]],'as':_0x248aa5['as'],'attributes':_0x248aa5['attributes'],'include':_0x248aa5[_0xb0e4('0x1a')]?_['map'](_0x248aa5[_0xb0e4('0x1a')],function(_0x22033f){return{'model':db[_0x22033f[_0xb0e4('0x1b')]],'as':_0x22033f['as'],'attributes':_0x22033f[_0xb0e4('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ed356){logger[_0xb0e4('0xa')](_0xb0e4('0x14'),_0x570886);logger[_0xb0e4('0xd')](_0xb0e4('0x14'),_0x570886,JSON[_0xb0e4('0xf')](_0x1ed356));_0x4ba49e(_0x1ed356);})[_0xb0e4('0x13')](function(_0x31a339){logger['error'](_0xb0e4('0x14'),_0x31a339['message'],_0x570886);_0x42e43d(_0x491a29[_0xb0e4('0x10')](0x1f4,_0x31a339[_0xb0e4('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x2c97aa){var _0xaa76d9=this;return new Promise(function(_0xbccf4b,_0x2694ea){return db[_0xb0e4('0x15')][_0xb0e4('0x1e')]({'raw':_0x2c97aa['options']?_0x2c97aa[_0xb0e4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2c97aa['options']?_0x2c97aa[_0xb0e4('0x17')]['where']||null:null,'attributes':_0x2c97aa[_0xb0e4('0x17')]?_0x2c97aa['options'][_0xb0e4('0x1c')]||null:null,'include':_0x2c97aa['options']?_0x2c97aa[_0xb0e4('0x17')][_0xb0e4('0x1a')]?_[_0xb0e4('0x1d')](_0x2c97aa['options'][_0xb0e4('0x1a')],function(_0x5eaeef){return{'model':db[_0x5eaeef[_0xb0e4('0x1b')]],'as':_0x5eaeef['as'],'attributes':_0x5eaeef[_0xb0e4('0x1c')],'include':_0x5eaeef[_0xb0e4('0x1a')]?_[_0xb0e4('0x1d')](_0x5eaeef[_0xb0e4('0x1a')],function(_0x59870f){return{'model':db[_0x59870f[_0xb0e4('0x1b')]],'as':_0x59870f['as'],'attributes':_0x59870f['attributes'],'include':_0x59870f[_0xb0e4('0x1a')]?_[_0xb0e4('0x1d')](_0x59870f[_0xb0e4('0x1a')],function(_0x5451f2){return{'model':db[_0x5451f2[_0xb0e4('0x1b')]],'as':_0x5451f2['as'],'attributes':_0x5451f2[_0xb0e4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb0e4('0x9')](function(_0x739afb){logger['info']('ShowDynamics365Account',_0x2c97aa);logger['debug']('ShowDynamics365Account',_0x2c97aa,JSON[_0xb0e4('0xf')](_0x739afb));_0xbccf4b(_0x739afb);})['catch'](function(_0x3beb07){logger['error'](_0xb0e4('0x1f'),_0x3beb07['message'],_0x2c97aa);_0x2694ea(_0xaa76d9[_0xb0e4('0x10')](0x1f4,_0x3beb07[_0xb0e4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 1f66894..f9c0f15 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 _0xdc31=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util'];(function(_0x32a979,_0x209a70){var _0x53c276=function(_0x5e7e6d){while(--_0x5e7e6d){_0x32a979['push'](_0x32a979['shift']());}};_0x53c276(++_0x209a70);}(_0xdc31,0xdf));var _0x1dc3=function(_0x26ad69,_0x5c1e3f){_0x26ad69=_0x26ad69-0x0;var _0x4a8fda=_0xdc31[_0x26ad69];return _0x4a8fda;};'use strict';var multer=require(_0x1dc3('0x0'));var util=require(_0x1dc3('0x1'));var path=require(_0x1dc3('0x2'));var timeout=require(_0x1dc3('0x3'));var express=require(_0x1dc3('0x4'));var router=express[_0x1dc3('0x5')]();var auth=require(_0x1dc3('0x6'));var interaction=require(_0x1dc3('0x7'));var config=require(_0x1dc3('0x8'));var controller=require(_0x1dc3('0x9'));router['get']('/',auth[_0x1dc3('0xa')](),controller['index']);router[_0x1dc3('0xb')]('/:id',auth[_0x1dc3('0xa')](),controller[_0x1dc3('0xc')]);router['get'](_0x1dc3('0xd'),auth[_0x1dc3('0xa')](),controller[_0x1dc3('0xe')]);router[_0x1dc3('0xb')](_0x1dc3('0xf'),auth[_0x1dc3('0xa')](),controller[_0x1dc3('0x10')]);router['get'](_0x1dc3('0x11'),auth[_0x1dc3('0xa')](),controller[_0x1dc3('0x12')]);router[_0x1dc3('0x13')]('/',auth[_0x1dc3('0xa')](),controller[_0x1dc3('0x14')]);router[_0x1dc3('0x15')]('/:id',auth[_0x1dc3('0xa')](),controller[_0x1dc3('0x16')]);router[_0x1dc3('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x1dc3('0x18')]);module['exports']=router; \ No newline at end of file +var _0x7c35=['show','/:id/fields','getSubjects','/:id/descriptions','post','put','delete','destroy','multer','path','connect-timeout','express','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c35,0x13a));var _0x57c3=function(_0xbb7f25,_0x2dece2){_0xbb7f25=_0xbb7f25-0x0;var _0x25f9e8=_0x7c35[_0xbb7f25];return _0x25f9e8;};'use strict';var multer=require(_0x57c3('0x0'));var util=require('util');var path=require(_0x57c3('0x1'));var timeout=require(_0x57c3('0x2'));var express=require(_0x57c3('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x57c3('0x4'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x57c3('0x5')]);router[_0x57c3('0x6')](_0x57c3('0x7'),auth[_0x57c3('0x8')](),controller[_0x57c3('0x9')]);router[_0x57c3('0x6')](_0x57c3('0xa'),auth[_0x57c3('0x8')](),controller['getFields']);router[_0x57c3('0x6')]('/:id/subjects',auth[_0x57c3('0x8')](),controller[_0x57c3('0xb')]);router['get'](_0x57c3('0xc'),auth[_0x57c3('0x8')](),controller['getDescriptions']);router[_0x57c3('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x57c3('0xe')](_0x57c3('0x7'),auth[_0x57c3('0x8')](),controller['update']);router[_0x57c3('0xf')](_0x57c3('0x7'),auth[_0x57c3('0x8')](),controller[_0x57c3('0x10')]);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 2be0566..965986e 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 _0xd126=['sequelize','exports','STRING','ENUM','incident','phonecall'];(function(_0x41ba03,_0x211771){var _0x180cae=function(_0x30a975){while(--_0x30a975){_0x41ba03['push'](_0x41ba03['shift']());}};_0x180cae(++_0x211771);}(_0xd126,0x162));var _0x6d12=function(_0x4eaa9c,_0x3a879a){_0x4eaa9c=_0x4eaa9c-0x0;var _0x46b796=_0xd126[_0x4eaa9c];return _0x46b796;};'use strict';var Sequelize=require(_0x6d12('0x0'));module[_0x6d12('0x1')]={'name':{'type':Sequelize[_0x6d12('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x6d12('0x3')](_0x6d12('0x4'),_0x6d12('0x5')),'defaultValue':_0x6d12('0x4')}}; \ No newline at end of file +var _0x9c3a=['incident','phonecall','sequelize','exports','STRING','ENUM'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x9c3a,0x128));var _0xa9c3=function(_0x49f012,_0x3c3bf6){_0x49f012=_0x49f012-0x0;var _0x28ae97=_0x9c3a[_0x49f012];return _0x28ae97;};'use strict';var Sequelize=require(_0xa9c3('0x0'));module[_0xa9c3('0x1')]={'name':{'type':Sequelize[_0xa9c3('0x2')]},'description':{'type':Sequelize[_0xa9c3('0x2')]},'ticketType':{'type':Sequelize[_0xa9c3('0x3')](_0xa9c3('0x4'),_0xa9c3('0x5')),'defaultValue':_0xa9c3('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 9420493..45bd491 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 _0x614c=['params','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','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','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','reject','update','destroy','stack','name','index','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','count','includeAll','rows','show'];(function(_0x52921b,_0x30928e){var _0x3a4ed3=function(_0x1c8004){while(--_0x1c8004){_0x52921b['push'](_0x52921b['shift']());}};_0x3a4ed3(++_0x30928e);}(_0x614c,0xbb));var _0xc614=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x614c[_0x462999];return _0x4b1366;};'use strict';var pdf=require(_0xc614('0x0'));var emlformat=require(_0xc614('0x1'));var rimraf=require(_0xc614('0x2'));var zipdir=require(_0xc614('0x3'));var jsonpatch=require(_0xc614('0x4'));var rp=require(_0xc614('0x5'));var moment=require(_0xc614('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc614('0x7'));var path=require('path');var sox=require(_0xc614('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc614('0x9'));var squel=require(_0xc614('0xa'));var crypto=require(_0xc614('0xb'));var jsforce=require(_0xc614('0xc'));var deskjs=require(_0xc614('0xd'));var toCsv=require(_0xc614('0xe'));var querystring=require(_0xc614('0xf'));var Papa=require(_0xc614('0x10'));var Redis=require(_0xc614('0x11'));var authService=require(_0xc614('0x12'));var qs=require(_0xc614('0x13'));var as=require(_0xc614('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc614('0x15'))(_0xc614('0x16'));var utils=require(_0xc614('0x17'));var config=require('../../config/environment');var db=require(_0xc614('0x18'))['db'];var jayson=require(_0xc614('0x19'));var client=jayson[_0xc614('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x5a4f8e,_0x367118,_0x3bf7ca){if(_0x3bf7ca){var _0x2024b1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2024b1['test'](_0x367118)){return _0x5a4f8e;}else{throw new db[(_0xc614('0x1b'))][(_0xc614('0x1c'))](_0xc614('0x1d'));}}else{return _0x5a4f8e;}}function respondWithRpcPromise(_0x16aa09,_0x1cb592,_0x3e491c,_0x47a8b6){return new BPromise(function(_0x25a1f0,_0x2f4ca8){var _0x1173f3=_0x47a8b6||client;return _0x1173f3[_0xc614('0x1e')](_0x16aa09,_0x3e491c)[_0xc614('0x1f')](function(_0x4fd890){logger['info'](_0xc614('0x20'),_0x1cb592,'request\x20sent');logger['debug'](_0xc614('0x21'),_0x1cb592,'request\x20sent',JSON[_0xc614('0x22')](_0x4fd890));if(_0x4fd890[_0xc614('0x23')]){if(_0x4fd890[_0xc614('0x23')][_0xc614('0x24')]===0x1f4){logger['error'](_0xc614('0x20'),_0x1cb592,_0x4fd890[_0xc614('0x23')]['message']);return _0x2f4ca8(_0x4fd890['error'][_0xc614('0x25')]);}logger[_0xc614('0x23')](_0xc614('0x20'),_0x1cb592,_0x4fd890[_0xc614('0x23')]['message']);return _0x25a1f0(_0x4fd890[_0xc614('0x23')][_0xc614('0x25')]);}else{logger[_0xc614('0x26')](_0xc614('0x20'),_0x1cb592,_0xc614('0x27'));_0x25a1f0(_0x4fd890[_0xc614('0x28')][_0xc614('0x25')]);}})[_0xc614('0x29')](function(_0x1a8e8a){logger[_0xc614('0x23')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1cb592,_0x1a8e8a);_0x2f4ca8(_0x1a8e8a);});});}function respondWithStatusCode(_0x3ab992,_0xffc179){_0xffc179=_0xffc179||0xcc;return function(_0x3f2148){if(_0x3f2148){return _0x3ab992[_0xc614('0x2a')](_0xffc179);}return _0x3ab992[_0xc614('0x2b')](_0xffc179)[_0xc614('0x2c')]();};}function respondWithResult(_0x1ad912,_0x2ea5cb){_0x2ea5cb=_0x2ea5cb||0xc8;return function(_0x4ff9bb){if(_0x4ff9bb){return _0x1ad912[_0xc614('0x2b')](_0x2ea5cb)[_0xc614('0x2d')](_0x4ff9bb);}};}function respondWithFilteredResult(_0x3fc99e,_0x5653f2){return function(_0x58be49){if(_0x58be49){var _0x49b63e=_0x58be49['count'],_0x123d5f=_0x5653f2[_0xc614('0x2e')],_0x911993=_0x5653f2[_0xc614('0x2e')]+_0x5653f2[_0xc614('0x2f')],_0x5ab8cf;if(_0x911993>=_0x49b63e){_0x911993=_0x49b63e;_0x5ab8cf=0xc8;}else{_0x5ab8cf=0xce;}_0x3fc99e[_0xc614('0x2b')](_0x5ab8cf);return _0x3fc99e['set']('Content-Range',_0x123d5f+'-'+_0x911993+'/'+_0x49b63e)[_0xc614('0x2d')](_0x58be49);}return null;};}function patchUpdates(_0x80b84f){return function(_0x535c15){try{jsonpatch['apply'](_0x535c15,_0x80b84f,!![]);}catch(_0xa3f99d){return BPromise[_0xc614('0x30')](_0xa3f99d);}return _0x535c15['save']();};}function saveUpdates(_0x1d15a7,_0x4700b1){return function(_0x4528f8){if(_0x4528f8){return _0x4528f8[_0xc614('0x31')](_0x1d15a7)[_0xc614('0x1f')](function(_0x1afda4){return _0x1afda4;});}return null;};}function removeEntity(_0x1980b4,_0x18c343){return function(_0x4c7fc6){if(_0x4c7fc6){return _0x4c7fc6[_0xc614('0x32')]()[_0xc614('0x1f')](function(){_0x1980b4[_0xc614('0x2b')](0xcc)[_0xc614('0x2c')]();});}};}function handleEntityNotFound(_0x50a9eb,_0x51a0e6){return function(_0x1c7e98){if(!_0x1c7e98){_0x50a9eb['sendStatus'](0x194);}return _0x1c7e98;};}function handleError(_0x11fd99,_0x573bdc){_0x573bdc=_0x573bdc||0x1f4;return function(_0x3c57a6){logger[_0xc614('0x23')](_0x3c57a6[_0xc614('0x33')]);if(_0x3c57a6[_0xc614('0x34')]){delete _0x3c57a6[_0xc614('0x34')];}_0x11fd99[_0xc614('0x2b')](_0x573bdc)['send'](_0x3c57a6);};}exports[_0xc614('0x35')]=function(_0xbb4660,_0x8761cd){var _0x2129b8={},_0x1ea82b={},_0x23b45b={'count':0x0,'rows':[]};var _0xe7fd6e=_['map'](db['Dynamics365Configuration'][_0xc614('0x36')],function(_0x301b74){return{'name':_0x301b74['fieldName'],'type':_0x301b74['type'][_0xc614('0x37')]};});_0x1ea82b[_0xc614('0x38')]=_[_0xc614('0x39')](_0xe7fd6e,_0xc614('0x34'));_0x1ea82b[_0xc614('0x3a')]=_[_0xc614('0x3b')](_0xbb4660[_0xc614('0x3a')]);_0x1ea82b[_0xc614('0x3c')]=_[_0xc614('0x3d')](_0x1ea82b[_0xc614('0x38')],_0x1ea82b['query']);_0x2129b8['attributes']=_[_0xc614('0x3d')](_0x1ea82b[_0xc614('0x38')],qs[_0xc614('0x3e')](_0xbb4660[_0xc614('0x3a')][_0xc614('0x3e')]));_0x2129b8[_0xc614('0x3f')]=_0x2129b8[_0xc614('0x3f')][_0xc614('0x40')]?_0x2129b8[_0xc614('0x3f')]:_0x1ea82b[_0xc614('0x38')];if(!_0xbb4660[_0xc614('0x3a')][_0xc614('0x41')](_0xc614('0x42'))){_0x2129b8[_0xc614('0x2f')]=qs[_0xc614('0x2f')](_0xbb4660[_0xc614('0x3a')][_0xc614('0x2f')]);_0x2129b8[_0xc614('0x2e')]=qs['offset'](_0xbb4660[_0xc614('0x3a')][_0xc614('0x2e')]);}_0x2129b8[_0xc614('0x43')]=qs[_0xc614('0x44')](_0xbb4660[_0xc614('0x3a')][_0xc614('0x44')]);_0x2129b8[_0xc614('0x45')]=qs[_0xc614('0x3c')](_[_0xc614('0x46')](_0xbb4660[_0xc614('0x3a')],_0x1ea82b['filters']),_0xe7fd6e);if(_0xbb4660[_0xc614('0x3a')][_0xc614('0x47')]){_0x2129b8[_0xc614('0x45')]=_[_0xc614('0x48')](_0x2129b8[_0xc614('0x45')],{'$or':_[_0xc614('0x39')](_0xe7fd6e,function(_0x4a0adb){if(_0x4a0adb['type']!==_0xc614('0x49')){var _0x3147ed={};_0x3147ed[_0x4a0adb[_0xc614('0x34')]]={'$like':'%'+_0xbb4660[_0xc614('0x3a')]['filter']+'%'};return _0x3147ed;}})});}_0x2129b8=_['merge']({},_0x2129b8,_0xbb4660[_0xc614('0x4a')]);var _0x27ec7f={'where':_0x2129b8[_0xc614('0x45')]};return db[_0xc614('0x4b')][_0xc614('0x4c')](_0x27ec7f)[_0xc614('0x1f')](function(_0x3d9c79){_0x23b45b['count']=_0x3d9c79;if(_0xbb4660[_0xc614('0x3a')][_0xc614('0x4d')]){_0x2129b8['include']=[{'all':!![]}];}return db[_0xc614('0x4b')]['findAll'](_0x2129b8);})['then'](function(_0x4365d2){_0x23b45b[_0xc614('0x4e')]=_0x4365d2;return _0x23b45b;})['then'](respondWithFilteredResult(_0x8761cd,_0x2129b8))['catch'](handleError(_0x8761cd,null));};exports[_0xc614('0x4f')]=function(_0x128c48,_0x2307f9){var _0xe1104b={'raw':![],'where':{'id':_0x128c48[_0xc614('0x50')]['id']}},_0xc91c1d={};_0xc91c1d[_0xc614('0x38')]=_['keys'](db[_0xc614('0x4b')][_0xc614('0x36')]);_0xc91c1d[_0xc614('0x3a')]=_['keys'](_0x128c48[_0xc614('0x3a')]);_0xc91c1d['filters']=_[_0xc614('0x3d')](_0xc91c1d[_0xc614('0x38')],_0xc91c1d[_0xc614('0x3a')]);_0xe1104b[_0xc614('0x3f')]=_[_0xc614('0x3d')](_0xc91c1d[_0xc614('0x38')],qs[_0xc614('0x3e')](_0x128c48[_0xc614('0x3a')][_0xc614('0x3e')]));_0xe1104b[_0xc614('0x3f')]=_0xe1104b[_0xc614('0x3f')]['length']?_0xe1104b[_0xc614('0x3f')]:_0xc91c1d['model'];if(_0x128c48[_0xc614('0x3a')]['includeAll']){_0xe1104b['include']=[{'all':!![]}];}_0xe1104b=_[_0xc614('0x48')]({},_0xe1104b,_0x128c48[_0xc614('0x4a')]);return db['Dynamics365Configuration'][_0xc614('0x51')](_0xe1104b)['then'](handleEntityNotFound(_0x2307f9,null))[_0xc614('0x1f')](respondWithResult(_0x2307f9,null))[_0xc614('0x29')](handleError(_0x2307f9,null));};exports[_0xc614('0x52')]=function(_0x4792ee,_0xc6e5d6){return db[_0xc614('0x4b')][_0xc614('0x52')](_0x4792ee[_0xc614('0x53')],{})[_0xc614('0x1f')](respondWithResult(_0xc6e5d6,0xc9))[_0xc614('0x29')](handleError(_0xc6e5d6,null));};exports[_0xc614('0x31')]=function(_0xa25cd9,_0x1504f6){if(_0xa25cd9[_0xc614('0x53')]['id']){delete _0xa25cd9[_0xc614('0x53')]['id'];}return db['Dynamics365Configuration'][_0xc614('0x51')]({'where':{'id':_0xa25cd9[_0xc614('0x50')]['id']}})['then'](handleEntityNotFound(_0x1504f6,null))[_0xc614('0x1f')](saveUpdates(_0xa25cd9[_0xc614('0x53')],null))[_0xc614('0x1f')](respondWithResult(_0x1504f6,null))[_0xc614('0x29')](handleError(_0x1504f6,null));};exports[_0xc614('0x32')]=function(_0x3e29aa,_0x4689ef){return db[_0xc614('0x4b')]['find']({'where':{'id':_0x3e29aa[_0xc614('0x50')]['id']}})['then'](handleEntityNotFound(_0x4689ef,null))[_0xc614('0x1f')](removeEntity(_0x4689ef,null))['catch'](handleError(_0x4689ef,null));};exports[_0xc614('0x54')]=function(_0x4d387f,_0x1b85ed,_0x5575b1){var _0x3723dc={};var _0x4f602c={};var _0x4df7c0;var _0x32a600;return db['Dynamics365Configuration'][_0xc614('0x55')]({'where':{'id':_0x4d387f[_0xc614('0x50')]['id']}})[_0xc614('0x1f')](handleEntityNotFound(_0x1b85ed,null))[_0xc614('0x1f')](function(_0x562f4d){if(_0x562f4d){_0x4df7c0=_0x562f4d;_0x4f602c['model']=_[_0xc614('0x3b')](db[_0xc614('0x56')][_0xc614('0x36')]);_0x4f602c[_0xc614('0x3a')]=_['keys'](_0x4d387f[_0xc614('0x3a')]);_0x4f602c[_0xc614('0x3c')]=_[_0xc614('0x3d')](_0x4f602c['model'],_0x4f602c['query']);_0x3723dc[_0xc614('0x3f')]=_[_0xc614('0x3d')](_0x4f602c[_0xc614('0x38')],qs['fields'](_0x4d387f[_0xc614('0x3a')][_0xc614('0x3e')]));_0x3723dc[_0xc614('0x3f')]=_0x3723dc[_0xc614('0x3f')][_0xc614('0x40')]?_0x3723dc[_0xc614('0x3f')]:_0x4f602c[_0xc614('0x38')];_0x3723dc['order']=qs[_0xc614('0x44')](_0x4d387f[_0xc614('0x3a')][_0xc614('0x44')]);_0x3723dc['where']=qs[_0xc614('0x3c')](_[_0xc614('0x46')](_0x4d387f[_0xc614('0x3a')],_0x4f602c['filters']));if(_0x4d387f['query']['filter']){_0x3723dc['where']=_[_0xc614('0x48')](_0x3723dc[_0xc614('0x45')],{'$or':_[_0xc614('0x39')](_0x3723dc[_0xc614('0x3f')],function(_0x436465){var _0x4d8da7={};_0x4d8da7[_0x436465]={'$like':'%'+_0x4d387f[_0xc614('0x3a')][_0xc614('0x47')]+'%'};return _0x4d8da7;})});}_0x3723dc=_['merge']({},_0x3723dc,_0x4d387f['options']);return _0x4df7c0[_0xc614('0x54')](_0x3723dc);}})['then'](function(_0x28835c){if(_0x28835c){_0x32a600=_0x28835c['length'];if(!_0x4d387f[_0xc614('0x3a')]['hasOwnProperty']('nolimit')){_0x3723dc['limit']=qs[_0xc614('0x2f')](_0x4d387f[_0xc614('0x3a')][_0xc614('0x2f')]);_0x3723dc['offset']=qs[_0xc614('0x2e')](_0x4d387f[_0xc614('0x3a')][_0xc614('0x2e')]);}return _0x4df7c0[_0xc614('0x54')](_0x3723dc);}})[_0xc614('0x1f')](function(_0x57038b){if(_0x57038b){return _0x57038b?{'count':_0x32a600,'rows':_0x57038b}:null;}})[_0xc614('0x1f')](respondWithResult(_0x1b85ed,null))[_0xc614('0x29')](handleError(_0x1b85ed,null));};exports[_0xc614('0x57')]=function(_0x3d2cdc,_0x4a09ac,_0xcc30b8){var _0x164af0={};var _0x5eae0d={};var _0x5ceb78;var _0x4a8ea2;return db[_0xc614('0x4b')][_0xc614('0x55')]({'where':{'id':_0x3d2cdc[_0xc614('0x50')]['id']}})[_0xc614('0x1f')](handleEntityNotFound(_0x4a09ac,null))[_0xc614('0x1f')](function(_0x2b960e){if(_0x2b960e){_0x5ceb78=_0x2b960e;_0x5eae0d['model']=_[_0xc614('0x3b')](db[_0xc614('0x56')][_0xc614('0x36')]);_0x5eae0d[_0xc614('0x3a')]=_[_0xc614('0x3b')](_0x3d2cdc[_0xc614('0x3a')]);_0x5eae0d[_0xc614('0x3c')]=_['intersection'](_0x5eae0d[_0xc614('0x38')],_0x5eae0d[_0xc614('0x3a')]);_0x164af0['attributes']=_[_0xc614('0x3d')](_0x5eae0d['model'],qs[_0xc614('0x3e')](_0x3d2cdc[_0xc614('0x3a')]['fields']));_0x164af0['attributes']=_0x164af0['attributes'][_0xc614('0x40')]?_0x164af0[_0xc614('0x3f')]:_0x5eae0d['model'];_0x164af0[_0xc614('0x43')]=qs[_0xc614('0x44')](_0x3d2cdc['query'][_0xc614('0x44')]);_0x164af0[_0xc614('0x45')]=qs[_0xc614('0x3c')](_[_0xc614('0x46')](_0x3d2cdc[_0xc614('0x3a')],_0x5eae0d[_0xc614('0x3c')]));if(_0x3d2cdc['query'][_0xc614('0x47')]){_0x164af0[_0xc614('0x45')]=_[_0xc614('0x48')](_0x164af0['where'],{'$or':_['map'](_0x164af0['attributes'],function(_0x2348ba){var _0x27146d={};_0x27146d[_0x2348ba]={'$like':'%'+_0x3d2cdc[_0xc614('0x3a')][_0xc614('0x47')]+'%'};return _0x27146d;})});}_0x164af0=_[_0xc614('0x48')]({},_0x164af0,_0x3d2cdc['options']);return _0x5ceb78['getSubjects'](_0x164af0);}})[_0xc614('0x1f')](function(_0x3bf1d2){if(_0x3bf1d2){_0x4a8ea2=_0x3bf1d2[_0xc614('0x40')];if(!_0x3d2cdc[_0xc614('0x3a')][_0xc614('0x41')](_0xc614('0x42'))){_0x164af0[_0xc614('0x2f')]=qs[_0xc614('0x2f')](_0x3d2cdc[_0xc614('0x3a')][_0xc614('0x2f')]);_0x164af0['offset']=qs[_0xc614('0x2e')](_0x3d2cdc['query'][_0xc614('0x2e')]);}return _0x5ceb78[_0xc614('0x57')](_0x164af0);}})[_0xc614('0x1f')](function(_0x242100){if(_0x242100){return _0x242100?{'count':_0x4a8ea2,'rows':_0x242100}:null;}})[_0xc614('0x1f')](respondWithResult(_0x4a09ac,null))[_0xc614('0x29')](handleError(_0x4a09ac,null));};exports[_0xc614('0x58')]=function(_0x3f6744,_0x2f4b37,_0x42d82d){var _0x6d8a02={};var _0x417034={};var _0x2c9fbd;var _0xae2c8e;return db[_0xc614('0x4b')][_0xc614('0x55')]({'where':{'id':_0x3f6744[_0xc614('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f4b37,null))['then'](function(_0x57833c){if(_0x57833c){_0x2c9fbd=_0x57833c;_0x417034['model']=_[_0xc614('0x3b')](db[_0xc614('0x56')][_0xc614('0x36')]);_0x417034[_0xc614('0x3a')]=_[_0xc614('0x3b')](_0x3f6744[_0xc614('0x3a')]);_0x417034[_0xc614('0x3c')]=_[_0xc614('0x3d')](_0x417034[_0xc614('0x38')],_0x417034[_0xc614('0x3a')]);_0x6d8a02[_0xc614('0x3f')]=_[_0xc614('0x3d')](_0x417034['model'],qs[_0xc614('0x3e')](_0x3f6744['query'][_0xc614('0x3e')]));_0x6d8a02[_0xc614('0x3f')]=_0x6d8a02[_0xc614('0x3f')][_0xc614('0x40')]?_0x6d8a02['attributes']:_0x417034[_0xc614('0x38')];_0x6d8a02[_0xc614('0x43')]=qs[_0xc614('0x44')](_0x3f6744[_0xc614('0x3a')][_0xc614('0x44')]);_0x6d8a02[_0xc614('0x45')]=qs[_0xc614('0x3c')](_[_0xc614('0x46')](_0x3f6744['query'],_0x417034[_0xc614('0x3c')]));if(_0x3f6744['query'][_0xc614('0x47')]){_0x6d8a02['where']=_[_0xc614('0x48')](_0x6d8a02[_0xc614('0x45')],{'$or':_['map'](_0x6d8a02[_0xc614('0x3f')],function(_0x5c77e6){var _0x15a093={};_0x15a093[_0x5c77e6]={'$like':'%'+_0x3f6744[_0xc614('0x3a')][_0xc614('0x47')]+'%'};return _0x15a093;})});}_0x6d8a02=_[_0xc614('0x48')]({},_0x6d8a02,_0x3f6744[_0xc614('0x4a')]);return _0x2c9fbd[_0xc614('0x58')](_0x6d8a02);}})[_0xc614('0x1f')](function(_0x499dac){if(_0x499dac){_0xae2c8e=_0x499dac[_0xc614('0x40')];if(!_0x3f6744[_0xc614('0x3a')][_0xc614('0x41')]('nolimit')){_0x6d8a02[_0xc614('0x2f')]=qs[_0xc614('0x2f')](_0x3f6744[_0xc614('0x3a')][_0xc614('0x2f')]);_0x6d8a02[_0xc614('0x2e')]=qs[_0xc614('0x2e')](_0x3f6744[_0xc614('0x3a')][_0xc614('0x2e')]);}return _0x2c9fbd[_0xc614('0x58')](_0x6d8a02);}})['then'](function(_0xff7f7e){if(_0xff7f7e){return _0xff7f7e?{'count':_0xae2c8e,'rows':_0xff7f7e}:null;}})[_0xc614('0x1f')](respondWithResult(_0x2f4b37,null))[_0xc614('0x29')](handleError(_0x2f4b37,null));}; \ No newline at end of file +var _0x9f5c=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','show','params','find','create','body','getFields','findOne','getSubjects','pick','getDescriptions','Dynamics365Field'];(function(_0xea2dc6,_0x4910c7){var _0x5e7a1e=function(_0x41e612){while(--_0x41e612){_0xea2dc6['push'](_0xea2dc6['shift']());}};_0x5e7a1e(++_0x4910c7);}(_0x9f5c,0x174));var _0xc9f5=function(_0x3c3c9d,_0x49cacc){_0x3c3c9d=_0x3c3c9d-0x0;var _0x3cf365=_0x9f5c[_0x3c3c9d];return _0x3cf365;};'use strict';var pdf=require(_0xc9f5('0x0'));var emlformat=require(_0xc9f5('0x1'));var rimraf=require(_0xc9f5('0x2'));var zipdir=require(_0xc9f5('0x3'));var jsonpatch=require(_0xc9f5('0x4'));var rp=require(_0xc9f5('0x5'));var moment=require(_0xc9f5('0x6'));var BPromise=require(_0xc9f5('0x7'));var Mustache=require(_0xc9f5('0x8'));var util=require(_0xc9f5('0x9'));var path=require(_0xc9f5('0xa'));var sox=require('sox');var csv=require(_0xc9f5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc9f5('0xc'));var deskjs=require(_0xc9f5('0xd'));var toCsv=require(_0xc9f5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc9f5('0xe'));var authService=require(_0xc9f5('0xf'));var qs=require(_0xc9f5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9f5('0x11'))(_0xc9f5('0x12'));var utils=require(_0xc9f5('0x13'));var config=require(_0xc9f5('0x14'));var db=require(_0xc9f5('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc9f5('0x16')][_0xc9f5('0x17')]({'port':0x232a});function checkPasswordPattern(_0x403853,_0x178332,_0x45b689){if(_0x45b689){var _0xd52526=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd52526[_0xc9f5('0x18')](_0x178332)){return _0x403853;}else{throw new db[(_0xc9f5('0x19'))][(_0xc9f5('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 _0x403853;}}function respondWithRpcPromise(_0x1a5194,_0x5cbb23,_0x16a04c,_0x2c8742){return new BPromise(function(_0x36d90c,_0x172dcc){var _0x362074=_0x2c8742||client;return _0x362074[_0xc9f5('0x1b')](_0x1a5194,_0x16a04c)[_0xc9f5('0x1c')](function(_0x109ae2){logger[_0xc9f5('0x1d')](_0xc9f5('0x1e'),_0x5cbb23,_0xc9f5('0x1f'));logger[_0xc9f5('0x20')](_0xc9f5('0x21'),_0x5cbb23,_0xc9f5('0x1f'),JSON[_0xc9f5('0x22')](_0x109ae2));if(_0x109ae2[_0xc9f5('0x23')]){if(_0x109ae2[_0xc9f5('0x23')][_0xc9f5('0x24')]===0x1f4){logger[_0xc9f5('0x23')](_0xc9f5('0x1e'),_0x5cbb23,_0x109ae2[_0xc9f5('0x23')][_0xc9f5('0x25')]);return _0x172dcc(_0x109ae2['error'][_0xc9f5('0x25')]);}logger['error'](_0xc9f5('0x1e'),_0x5cbb23,_0x109ae2[_0xc9f5('0x23')][_0xc9f5('0x25')]);return _0x36d90c(_0x109ae2['error']['message']);}else{logger[_0xc9f5('0x1d')](_0xc9f5('0x1e'),_0x5cbb23,'request\x20sent');_0x36d90c(_0x109ae2[_0xc9f5('0x26')]['message']);}})[_0xc9f5('0x27')](function(_0x22cd7d){logger[_0xc9f5('0x23')](_0xc9f5('0x1e'),_0x5cbb23,_0x22cd7d);_0x172dcc(_0x22cd7d);});});}function respondWithStatusCode(_0xd84c19,_0x289bf7){_0x289bf7=_0x289bf7||0xcc;return function(_0x2c37cd){if(_0x2c37cd){return _0xd84c19['sendStatus'](_0x289bf7);}return _0xd84c19[_0xc9f5('0x28')](_0x289bf7)[_0xc9f5('0x29')]();};}function respondWithResult(_0x4fb924,_0xbf918d){_0xbf918d=_0xbf918d||0xc8;return function(_0x5040fa){if(_0x5040fa){return _0x4fb924[_0xc9f5('0x28')](_0xbf918d)[_0xc9f5('0x2a')](_0x5040fa);}};}function respondWithFilteredResult(_0x2bc377,_0x93709a){return function(_0x2d154e){if(_0x2d154e){var _0x5e16fa=_0x2d154e[_0xc9f5('0x2b')],_0xa8a469=_0x93709a[_0xc9f5('0x2c')],_0x241524=_0x93709a[_0xc9f5('0x2c')]+_0x93709a[_0xc9f5('0x2d')],_0x53293e;if(_0x241524>=_0x5e16fa){_0x241524=_0x5e16fa;_0x53293e=0xc8;}else{_0x53293e=0xce;}_0x2bc377[_0xc9f5('0x28')](_0x53293e);return _0x2bc377[_0xc9f5('0x2e')](_0xc9f5('0x2f'),_0xa8a469+'-'+_0x241524+'/'+_0x5e16fa)['json'](_0x2d154e);}return null;};}function patchUpdates(_0x295d1f){return function(_0x3068c3){try{jsonpatch[_0xc9f5('0x30')](_0x3068c3,_0x295d1f,!![]);}catch(_0x3c6a57){return BPromise[_0xc9f5('0x31')](_0x3c6a57);}return _0x3068c3[_0xc9f5('0x32')]();};}function saveUpdates(_0x424d3f,_0x343fe9){return function(_0xec8026){if(_0xec8026){return _0xec8026[_0xc9f5('0x33')](_0x424d3f)[_0xc9f5('0x1c')](function(_0x50bada){return _0x50bada;});}return null;};}function removeEntity(_0x1c931d,_0x1ae595){return function(_0x174169){if(_0x174169){return _0x174169[_0xc9f5('0x34')]()[_0xc9f5('0x1c')](function(){_0x1c931d['status'](0xcc)[_0xc9f5('0x29')]();});}};}function handleEntityNotFound(_0x5cdf59,_0x795cfe){return function(_0x5a1491){if(!_0x5a1491){_0x5cdf59[_0xc9f5('0x35')](0x194);}return _0x5a1491;};}function handleError(_0x37cc96,_0x3c4fd9){_0x3c4fd9=_0x3c4fd9||0x1f4;return function(_0x375f51){logger[_0xc9f5('0x23')](_0x375f51[_0xc9f5('0x36')]);if(_0x375f51[_0xc9f5('0x37')]){delete _0x375f51[_0xc9f5('0x37')];}_0x37cc96[_0xc9f5('0x28')](_0x3c4fd9)['send'](_0x375f51);};}exports[_0xc9f5('0x38')]=function(_0x2baf72,_0x5df058){var _0x15cd69={},_0x2c6c83={},_0x3b514a={'count':0x0,'rows':[]};var _0xfa526f=_[_0xc9f5('0x39')](db[_0xc9f5('0x3a')][_0xc9f5('0x3b')],function(_0x30debc){return{'name':_0x30debc[_0xc9f5('0x3c')],'type':_0x30debc['type'][_0xc9f5('0x3d')]};});_0x2c6c83[_0xc9f5('0x3e')]=_[_0xc9f5('0x39')](_0xfa526f,_0xc9f5('0x37'));_0x2c6c83['query']=_[_0xc9f5('0x3f')](_0x2baf72[_0xc9f5('0x40')]);_0x2c6c83[_0xc9f5('0x41')]=_['intersection'](_0x2c6c83[_0xc9f5('0x3e')],_0x2c6c83[_0xc9f5('0x40')]);_0x15cd69[_0xc9f5('0x42')]=_[_0xc9f5('0x43')](_0x2c6c83[_0xc9f5('0x3e')],qs['fields'](_0x2baf72[_0xc9f5('0x40')][_0xc9f5('0x44')]));_0x15cd69[_0xc9f5('0x42')]=_0x15cd69[_0xc9f5('0x42')][_0xc9f5('0x45')]?_0x15cd69[_0xc9f5('0x42')]:_0x2c6c83['model'];if(!_0x2baf72['query'][_0xc9f5('0x46')](_0xc9f5('0x47'))){_0x15cd69['limit']=qs[_0xc9f5('0x2d')](_0x2baf72[_0xc9f5('0x40')][_0xc9f5('0x2d')]);_0x15cd69[_0xc9f5('0x2c')]=qs[_0xc9f5('0x2c')](_0x2baf72[_0xc9f5('0x40')][_0xc9f5('0x2c')]);}_0x15cd69[_0xc9f5('0x48')]=qs[_0xc9f5('0x49')](_0x2baf72[_0xc9f5('0x40')]['sort']);_0x15cd69[_0xc9f5('0x4a')]=qs['filters'](_['pick'](_0x2baf72[_0xc9f5('0x40')],_0x2c6c83[_0xc9f5('0x41')]),_0xfa526f);if(_0x2baf72['query'][_0xc9f5('0x4b')]){_0x15cd69[_0xc9f5('0x4a')]=_[_0xc9f5('0x4c')](_0x15cd69[_0xc9f5('0x4a')],{'$or':_[_0xc9f5('0x39')](_0xfa526f,function(_0x41ec0b){if(_0x41ec0b[_0xc9f5('0x4d')]!=='VIRTUAL'){var _0x16681b={};_0x16681b[_0x41ec0b[_0xc9f5('0x37')]]={'$like':'%'+_0x2baf72[_0xc9f5('0x40')][_0xc9f5('0x4b')]+'%'};return _0x16681b;}})});}_0x15cd69=_[_0xc9f5('0x4c')]({},_0x15cd69,_0x2baf72[_0xc9f5('0x4e')]);var _0x422145={'where':_0x15cd69[_0xc9f5('0x4a')]};return db[_0xc9f5('0x3a')][_0xc9f5('0x2b')](_0x422145)[_0xc9f5('0x1c')](function(_0x4b0a2d){_0x3b514a['count']=_0x4b0a2d;if(_0x2baf72[_0xc9f5('0x40')][_0xc9f5('0x4f')]){_0x15cd69[_0xc9f5('0x50')]=[{'all':!![]}];}return db[_0xc9f5('0x3a')][_0xc9f5('0x51')](_0x15cd69);})['then'](function(_0xc5cddc){_0x3b514a['rows']=_0xc5cddc;return _0x3b514a;})[_0xc9f5('0x1c')](respondWithFilteredResult(_0x5df058,_0x15cd69))[_0xc9f5('0x27')](handleError(_0x5df058,null));};exports[_0xc9f5('0x52')]=function(_0x4cf4f8,_0x1a2614){var _0x494296={'raw':![],'where':{'id':_0x4cf4f8[_0xc9f5('0x53')]['id']}},_0x2f8a4d={};_0x2f8a4d[_0xc9f5('0x3e')]=_[_0xc9f5('0x3f')](db[_0xc9f5('0x3a')][_0xc9f5('0x3b')]);_0x2f8a4d['query']=_[_0xc9f5('0x3f')](_0x4cf4f8[_0xc9f5('0x40')]);_0x2f8a4d[_0xc9f5('0x41')]=_[_0xc9f5('0x43')](_0x2f8a4d[_0xc9f5('0x3e')],_0x2f8a4d['query']);_0x494296[_0xc9f5('0x42')]=_[_0xc9f5('0x43')](_0x2f8a4d[_0xc9f5('0x3e')],qs[_0xc9f5('0x44')](_0x4cf4f8[_0xc9f5('0x40')][_0xc9f5('0x44')]));_0x494296[_0xc9f5('0x42')]=_0x494296[_0xc9f5('0x42')][_0xc9f5('0x45')]?_0x494296[_0xc9f5('0x42')]:_0x2f8a4d['model'];if(_0x4cf4f8['query']['includeAll']){_0x494296[_0xc9f5('0x50')]=[{'all':!![]}];}_0x494296=_[_0xc9f5('0x4c')]({},_0x494296,_0x4cf4f8[_0xc9f5('0x4e')]);return db[_0xc9f5('0x3a')][_0xc9f5('0x54')](_0x494296)[_0xc9f5('0x1c')](handleEntityNotFound(_0x1a2614,null))[_0xc9f5('0x1c')](respondWithResult(_0x1a2614,null))['catch'](handleError(_0x1a2614,null));};exports[_0xc9f5('0x55')]=function(_0x23a8bd,_0x24afc7){return db[_0xc9f5('0x3a')]['create'](_0x23a8bd[_0xc9f5('0x56')],{})['then'](respondWithResult(_0x24afc7,0xc9))[_0xc9f5('0x27')](handleError(_0x24afc7,null));};exports[_0xc9f5('0x33')]=function(_0x203906,_0x1922c6){if(_0x203906[_0xc9f5('0x56')]['id']){delete _0x203906[_0xc9f5('0x56')]['id'];}return db[_0xc9f5('0x3a')]['find']({'where':{'id':_0x203906[_0xc9f5('0x53')]['id']}})[_0xc9f5('0x1c')](handleEntityNotFound(_0x1922c6,null))[_0xc9f5('0x1c')](saveUpdates(_0x203906[_0xc9f5('0x56')],null))[_0xc9f5('0x1c')](respondWithResult(_0x1922c6,null))['catch'](handleError(_0x1922c6,null));};exports[_0xc9f5('0x34')]=function(_0x552fcf,_0xbadc16){return db[_0xc9f5('0x3a')][_0xc9f5('0x54')]({'where':{'id':_0x552fcf['params']['id']}})[_0xc9f5('0x1c')](handleEntityNotFound(_0xbadc16,null))[_0xc9f5('0x1c')](removeEntity(_0xbadc16,null))[_0xc9f5('0x27')](handleError(_0xbadc16,null));};exports[_0xc9f5('0x57')]=function(_0x1f6408,_0x21fe32,_0xf88ac6){var _0x44f092={};var _0x18ea20={};var _0x2442ca;var _0x2043a6;return db[_0xc9f5('0x3a')][_0xc9f5('0x58')]({'where':{'id':_0x1f6408[_0xc9f5('0x53')]['id']}})[_0xc9f5('0x1c')](handleEntityNotFound(_0x21fe32,null))[_0xc9f5('0x1c')](function(_0x4df951){if(_0x4df951){_0x2442ca=_0x4df951;_0x18ea20[_0xc9f5('0x3e')]=_[_0xc9f5('0x3f')](db['Dynamics365Field'][_0xc9f5('0x3b')]);_0x18ea20['query']=_[_0xc9f5('0x3f')](_0x1f6408[_0xc9f5('0x40')]);_0x18ea20['filters']=_[_0xc9f5('0x43')](_0x18ea20['model'],_0x18ea20[_0xc9f5('0x40')]);_0x44f092[_0xc9f5('0x42')]=_['intersection'](_0x18ea20[_0xc9f5('0x3e')],qs[_0xc9f5('0x44')](_0x1f6408[_0xc9f5('0x40')][_0xc9f5('0x44')]));_0x44f092[_0xc9f5('0x42')]=_0x44f092[_0xc9f5('0x42')]['length']?_0x44f092[_0xc9f5('0x42')]:_0x18ea20[_0xc9f5('0x3e')];_0x44f092[_0xc9f5('0x48')]=qs[_0xc9f5('0x49')](_0x1f6408[_0xc9f5('0x40')][_0xc9f5('0x49')]);_0x44f092[_0xc9f5('0x4a')]=qs[_0xc9f5('0x41')](_['pick'](_0x1f6408['query'],_0x18ea20[_0xc9f5('0x41')]));if(_0x1f6408[_0xc9f5('0x40')][_0xc9f5('0x4b')]){_0x44f092[_0xc9f5('0x4a')]=_['merge'](_0x44f092[_0xc9f5('0x4a')],{'$or':_['map'](_0x44f092[_0xc9f5('0x42')],function(_0x21e0a1){var _0x55ca8b={};_0x55ca8b[_0x21e0a1]={'$like':'%'+_0x1f6408[_0xc9f5('0x40')]['filter']+'%'};return _0x55ca8b;})});}_0x44f092=_[_0xc9f5('0x4c')]({},_0x44f092,_0x1f6408['options']);return _0x2442ca[_0xc9f5('0x57')](_0x44f092);}})[_0xc9f5('0x1c')](function(_0x513fbd){if(_0x513fbd){_0x2043a6=_0x513fbd[_0xc9f5('0x45')];if(!_0x1f6408['query'][_0xc9f5('0x46')](_0xc9f5('0x47'))){_0x44f092['limit']=qs[_0xc9f5('0x2d')](_0x1f6408['query'][_0xc9f5('0x2d')]);_0x44f092[_0xc9f5('0x2c')]=qs[_0xc9f5('0x2c')](_0x1f6408[_0xc9f5('0x40')][_0xc9f5('0x2c')]);}return _0x2442ca[_0xc9f5('0x57')](_0x44f092);}})['then'](function(_0x3bb6bf){if(_0x3bb6bf){return _0x3bb6bf?{'count':_0x2043a6,'rows':_0x3bb6bf}:null;}})[_0xc9f5('0x1c')](respondWithResult(_0x21fe32,null))[_0xc9f5('0x27')](handleError(_0x21fe32,null));};exports[_0xc9f5('0x59')]=function(_0x5253ec,_0x5dbe97,_0x7e81a){var _0x481b51={};var _0x5343c2={};var _0x2b0d03;var _0x9d792a;return db[_0xc9f5('0x3a')][_0xc9f5('0x58')]({'where':{'id':_0x5253ec['params']['id']}})['then'](handleEntityNotFound(_0x5dbe97,null))[_0xc9f5('0x1c')](function(_0x126eba){if(_0x126eba){_0x2b0d03=_0x126eba;_0x5343c2['model']=_[_0xc9f5('0x3f')](db['Dynamics365Field'][_0xc9f5('0x3b')]);_0x5343c2[_0xc9f5('0x40')]=_['keys'](_0x5253ec['query']);_0x5343c2[_0xc9f5('0x41')]=_['intersection'](_0x5343c2[_0xc9f5('0x3e')],_0x5343c2['query']);_0x481b51[_0xc9f5('0x42')]=_[_0xc9f5('0x43')](_0x5343c2[_0xc9f5('0x3e')],qs[_0xc9f5('0x44')](_0x5253ec[_0xc9f5('0x40')][_0xc9f5('0x44')]));_0x481b51[_0xc9f5('0x42')]=_0x481b51[_0xc9f5('0x42')][_0xc9f5('0x45')]?_0x481b51['attributes']:_0x5343c2[_0xc9f5('0x3e')];_0x481b51[_0xc9f5('0x48')]=qs[_0xc9f5('0x49')](_0x5253ec[_0xc9f5('0x40')][_0xc9f5('0x49')]);_0x481b51[_0xc9f5('0x4a')]=qs[_0xc9f5('0x41')](_[_0xc9f5('0x5a')](_0x5253ec['query'],_0x5343c2['filters']));if(_0x5253ec['query'][_0xc9f5('0x4b')]){_0x481b51[_0xc9f5('0x4a')]=_['merge'](_0x481b51[_0xc9f5('0x4a')],{'$or':_[_0xc9f5('0x39')](_0x481b51['attributes'],function(_0x5e9774){var _0x382523={};_0x382523[_0x5e9774]={'$like':'%'+_0x5253ec['query'][_0xc9f5('0x4b')]+'%'};return _0x382523;})});}_0x481b51=_[_0xc9f5('0x4c')]({},_0x481b51,_0x5253ec[_0xc9f5('0x4e')]);return _0x2b0d03[_0xc9f5('0x59')](_0x481b51);}})[_0xc9f5('0x1c')](function(_0x2dc441){if(_0x2dc441){_0x9d792a=_0x2dc441[_0xc9f5('0x45')];if(!_0x5253ec[_0xc9f5('0x40')]['hasOwnProperty'](_0xc9f5('0x47'))){_0x481b51[_0xc9f5('0x2d')]=qs[_0xc9f5('0x2d')](_0x5253ec[_0xc9f5('0x40')][_0xc9f5('0x2d')]);_0x481b51[_0xc9f5('0x2c')]=qs[_0xc9f5('0x2c')](_0x5253ec['query'][_0xc9f5('0x2c')]);}return _0x2b0d03[_0xc9f5('0x59')](_0x481b51);}})[_0xc9f5('0x1c')](function(_0x2165da){if(_0x2165da){return _0x2165da?{'count':_0x9d792a,'rows':_0x2165da}:null;}})['then'](respondWithResult(_0x5dbe97,null))[_0xc9f5('0x27')](handleError(_0x5dbe97,null));};exports[_0xc9f5('0x5b')]=function(_0x3bbf1d,_0x39a327,_0x11caca){var _0x5ba572={};var _0x5226cb={};var _0x2c49c8;var _0x165881;return db[_0xc9f5('0x3a')][_0xc9f5('0x58')]({'where':{'id':_0x3bbf1d['params']['id']}})[_0xc9f5('0x1c')](handleEntityNotFound(_0x39a327,null))[_0xc9f5('0x1c')](function(_0x5d920b){if(_0x5d920b){_0x2c49c8=_0x5d920b;_0x5226cb[_0xc9f5('0x3e')]=_[_0xc9f5('0x3f')](db[_0xc9f5('0x5c')]['rawAttributes']);_0x5226cb['query']=_['keys'](_0x3bbf1d['query']);_0x5226cb[_0xc9f5('0x41')]=_[_0xc9f5('0x43')](_0x5226cb[_0xc9f5('0x3e')],_0x5226cb[_0xc9f5('0x40')]);_0x5ba572[_0xc9f5('0x42')]=_[_0xc9f5('0x43')](_0x5226cb[_0xc9f5('0x3e')],qs[_0xc9f5('0x44')](_0x3bbf1d['query'][_0xc9f5('0x44')]));_0x5ba572[_0xc9f5('0x42')]=_0x5ba572['attributes']['length']?_0x5ba572[_0xc9f5('0x42')]:_0x5226cb['model'];_0x5ba572['order']=qs[_0xc9f5('0x49')](_0x3bbf1d[_0xc9f5('0x40')][_0xc9f5('0x49')]);_0x5ba572[_0xc9f5('0x4a')]=qs[_0xc9f5('0x41')](_[_0xc9f5('0x5a')](_0x3bbf1d[_0xc9f5('0x40')],_0x5226cb[_0xc9f5('0x41')]));if(_0x3bbf1d[_0xc9f5('0x40')][_0xc9f5('0x4b')]){_0x5ba572[_0xc9f5('0x4a')]=_[_0xc9f5('0x4c')](_0x5ba572[_0xc9f5('0x4a')],{'$or':_[_0xc9f5('0x39')](_0x5ba572[_0xc9f5('0x42')],function(_0x3a9ed5){var _0x427b36={};_0x427b36[_0x3a9ed5]={'$like':'%'+_0x3bbf1d['query']['filter']+'%'};return _0x427b36;})});}_0x5ba572=_[_0xc9f5('0x4c')]({},_0x5ba572,_0x3bbf1d[_0xc9f5('0x4e')]);return _0x2c49c8[_0xc9f5('0x5b')](_0x5ba572);}})[_0xc9f5('0x1c')](function(_0x53f5f2){if(_0x53f5f2){_0x165881=_0x53f5f2[_0xc9f5('0x45')];if(!_0x3bbf1d[_0xc9f5('0x40')][_0xc9f5('0x46')](_0xc9f5('0x47'))){_0x5ba572[_0xc9f5('0x2d')]=qs['limit'](_0x3bbf1d['query'][_0xc9f5('0x2d')]);_0x5ba572['offset']=qs[_0xc9f5('0x2c')](_0x3bbf1d[_0xc9f5('0x40')][_0xc9f5('0x2c')]);}return _0x2c49c8[_0xc9f5('0x5b')](_0x5ba572);}})[_0xc9f5('0x1c')](function(_0x33c4b4){if(_0x33c4b4){return _0x33c4b4?{'count':_0x165881,'rows':_0x33c4b4}:null;}})[_0xc9f5('0x1c')](respondWithResult(_0x39a327,null))[_0xc9f5('0x27')](handleError(_0x39a327,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 5969310..7723a07 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 _0x7a82=['./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3ae38e,_0x3aaa14){var _0x483595=function(_0x5c55ff){while(--_0x5c55ff){_0x3ae38e['push'](_0x3ae38e['shift']());}};_0x483595(++_0x3aaa14);}(_0x7a82,0x93));var _0x27a8=function(_0x33ce8f,_0x156c99){_0x33ce8f=_0x33ce8f-0x0;var _0x58605d=_0x7a82[_0x33ce8f];return _0x58605d;};'use strict';var _=require(_0x27a8('0x0'));var util=require(_0x27a8('0x1'));var logger=require('../../config/logger')(_0x27a8('0x2'));var moment=require(_0x27a8('0x3'));var BPromise=require('bluebird');var rp=require(_0x27a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27a8('0x5'));var config=require(_0x27a8('0x6'));var attributes=require(_0x27a8('0x7'));module[_0x27a8('0x8')]=function(_0x416edb,_0x3047aa){return _0x416edb[_0x27a8('0x9')](_0x27a8('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5105=['../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','lodash'];(function(_0x1cccf4,_0x74fe9b){var _0x4094df=function(_0x691508){while(--_0x691508){_0x1cccf4['push'](_0x1cccf4['shift']());}};_0x4094df(++_0x74fe9b);}(_0x5105,0x135));var _0x5510=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5105[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5510('0x0'));var util=require('util');var logger=require(_0x5510('0x1'))(_0x5510('0x2'));var moment=require(_0x5510('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5510('0x4'));var rimraf=require(_0x5510('0x5'));var config=require(_0x5510('0x6'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x5510('0x7')]=function(_0x24e4dc,_0x341f75){return _0x24e4dc[_0x5510('0x8')](_0x5510('0x9'),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 7d12297..006575c 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 _0xf362=['error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x417de2,_0x2898e0){var _0x4ff3cb=function(_0x37744a){while(--_0x37744a){_0x417de2['push'](_0x417de2['shift']());}};_0x4ff3cb(++_0x2898e0);}(_0xf362,0x1d2));var _0x2f36=function(_0x53bee0,_0x4561b5){_0x53bee0=_0x53bee0-0x0;var _0x1c94bd=_0xf362[_0x53bee0];return _0x1c94bd;};'use strict';var _=require('lodash');var util=require(_0x2f36('0x0'));var moment=require(_0x2f36('0x1'));var BPromise=require(_0x2f36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f36('0x3'));var db=require(_0x2f36('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f36('0x5'))(_0x2f36('0x6'));var config=require(_0x2f36('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2f36('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5eb12e,_0x48a0b5,_0x8018a2){return new BPromise(function(_0x3a983a,_0x4cd0fa){return client[_0x2f36('0x9')](_0x5eb12e,_0x8018a2)[_0x2f36('0xa')](function(_0x2cb84b){logger['info'](_0x2f36('0xb'),_0x48a0b5,'request\x20sent');logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x48a0b5,_0x2f36('0xc'),JSON[_0x2f36('0xd')](_0x2cb84b));if(_0x2cb84b['error']){if(_0x2cb84b[_0x2f36('0xe')][_0x2f36('0xf')]===0x1f4){logger[_0x2f36('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x48a0b5,_0x2cb84b[_0x2f36('0xe')][_0x2f36('0x10')]);return _0x4cd0fa(_0x2cb84b['error']['message']);}logger[_0x2f36('0xe')](_0x2f36('0xb'),_0x48a0b5,_0x2cb84b['error'][_0x2f36('0x10')]);return _0x3a983a(_0x2cb84b[_0x2f36('0xe')][_0x2f36('0x10')]);}else{logger[_0x2f36('0x11')](_0x2f36('0xb'),_0x48a0b5,_0x2f36('0xc'));_0x3a983a(_0x2cb84b[_0x2f36('0x12')][_0x2f36('0x10')]);}})[_0x2f36('0x13')](function(_0x18bc7b){logger['error'](_0x2f36('0xb'),_0x48a0b5,_0x18bc7b);_0x4cd0fa(_0x18bc7b);});});} \ No newline at end of file +var _0x6699=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','../../mysqldb'];(function(_0x3aad3b,_0x5623de){var _0x590bf5=function(_0x541eb2){while(--_0x541eb2){_0x3aad3b['push'](_0x3aad3b['shift']());}};_0x590bf5(++_0x5623de);}(_0x6699,0xf5));var _0x9669=function(_0x4c9fd3,_0x2aee60){_0x4c9fd3=_0x4c9fd3-0x0;var _0x2c3256=_0x6699[_0x4c9fd3];return _0x2c3256;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9669('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9669('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x9669('0x2'))('rpc');var config=require(_0x9669('0x3'));var jayson=require(_0x9669('0x4'));var client=jayson[_0x9669('0x5')][_0x9669('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x224c38,_0x280fc4,_0x318f0f){return new BPromise(function(_0x1c1e18,_0x17fb9e){return client[_0x9669('0x7')](_0x224c38,_0x318f0f)[_0x9669('0x8')](function(_0x2909e1){logger[_0x9669('0x9')](_0x9669('0xa'),_0x280fc4,_0x9669('0xb'));logger[_0x9669('0xc')](_0x9669('0xd'),_0x280fc4,'request\x20sent',JSON[_0x9669('0xe')](_0x2909e1));if(_0x2909e1[_0x9669('0xf')]){if(_0x2909e1['error'][_0x9669('0x10')]===0x1f4){logger[_0x9669('0xf')](_0x9669('0xa'),_0x280fc4,_0x2909e1[_0x9669('0xf')][_0x9669('0x11')]);return _0x17fb9e(_0x2909e1[_0x9669('0xf')][_0x9669('0x11')]);}logger[_0x9669('0xf')](_0x9669('0xa'),_0x280fc4,_0x2909e1[_0x9669('0xf')][_0x9669('0x11')]);return _0x1c1e18(_0x2909e1[_0x9669('0xf')][_0x9669('0x11')]);}else{logger['info'](_0x9669('0xa'),_0x280fc4,'request\x20sent');_0x1c1e18(_0x2909e1['result'][_0x9669('0x11')]);}})[_0x9669('0x12')](function(_0x2f928d){logger[_0x9669('0xf')](_0x9669('0xa'),_0x280fc4,_0x2f928d);_0x17fb9e(_0x2f928d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index babe344..d005f94 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 _0xe205=['create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe205,0xa7));var _0x5e20=function(_0x1220af,_0x4aa144){_0x1220af=_0x1220af-0x0;var _0x22beed=_0xe205[_0x1220af];return _0x22beed;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var auth=require(_0x5e20('0x6'));var interaction=require(_0x5e20('0x7'));var config=require(_0x5e20('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x5e20('0x9')]('/',auth[_0x5e20('0xa')](),controller[_0x5e20('0xb')]);router[_0x5e20('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5e20('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5e20('0xd')]);router[_0x5e20('0xe')]('/:id',auth[_0x5e20('0xa')](),controller[_0x5e20('0xf')]);router[_0x5e20('0x10')](_0x5e20('0x11'),auth['isAuthenticated'](),controller[_0x5e20('0x12')]);module[_0x5e20('0x13')]=router; \ No newline at end of file +var _0x8ce3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x402f91,_0x5190dc){var _0x174d42=function(_0x4f65e2){while(--_0x4f65e2){_0x402f91['push'](_0x402f91['shift']());}};_0x174d42(++_0x5190dc);}(_0x8ce3,0xc3));var _0x38ce=function(_0xe37cad,_0x9fcbdd){_0xe37cad=_0xe37cad-0x0;var _0x24593e=_0x8ce3[_0xe37cad];return _0x24593e;};'use strict';var multer=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var path=require('path');var timeout=require(_0x38ce('0x2'));var express=require(_0x38ce('0x3'));var router=express[_0x38ce('0x4')]();var auth=require(_0x38ce('0x5'));var interaction=require(_0x38ce('0x6'));var config=require(_0x38ce('0x7'));var controller=require(_0x38ce('0x8'));router[_0x38ce('0x9')]('/',auth['isAuthenticated'](),controller[_0x38ce('0xa')]);router[_0x38ce('0x9')]('/:id',auth[_0x38ce('0xb')](),controller[_0x38ce('0xc')]);router[_0x38ce('0xd')]('/',auth['isAuthenticated'](),controller[_0x38ce('0xe')]);router['put'](_0x38ce('0xf'),auth['isAuthenticated'](),controller[_0x38ce('0x10')]);router[_0x38ce('0x11')](_0x38ce('0xf'),auth[_0x38ce('0xb')](),controller[_0x38ce('0x12')]);module[_0x38ce('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 955d178..7363f91 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 _0x8d4c=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x2dd14a,_0x29255b){var _0x470162=function(_0x3040da){while(--_0x3040da){_0x2dd14a['push'](_0x2dd14a['shift']());}};_0x470162(++_0x29255b);}(_0x8d4c,0x133));var _0xc8d4=function(_0x149cf0,_0x3746f2){_0x149cf0=_0x149cf0-0x0;var _0x2ee2c8=_0x8d4c[_0x149cf0];return _0x2ee2c8;};'use strict';var Sequelize=require(_0xc8d4('0x0'));module[_0xc8d4('0x1')]={'type':{'type':Sequelize[_0xc8d4('0x2')](_0xc8d4('0x3'),'variable',_0xc8d4('0x4'),'keyValue'),'defaultValue':_0xc8d4('0x3')},'content':{'type':Sequelize[_0xc8d4('0x5')]},'key':{'type':Sequelize[_0xc8d4('0x5')]},'keyType':{'type':Sequelize[_0xc8d4('0x2')](_0xc8d4('0x3'),_0xc8d4('0x6'),_0xc8d4('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc8d4('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc8d4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc8d4('0x5')]}}; \ No newline at end of file +var _0xe524=['customVariable','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xe524,0x1d8));var _0x4e52=function(_0x4992dd,_0x37be50){_0x4992dd=_0x4992dd-0x0;var _0xa8973a=_0xe524[_0x4992dd];return _0xa8973a;};'use strict';var Sequelize=require('sequelize');module[_0x4e52('0x0')]={'type':{'type':Sequelize[_0x4e52('0x1')](_0x4e52('0x2'),_0x4e52('0x3'),_0x4e52('0x4'),'keyValue'),'defaultValue':_0x4e52('0x2')},'content':{'type':Sequelize[_0x4e52('0x5')]},'key':{'type':Sequelize[_0x4e52('0x5')]},'keyType':{'type':Sequelize[_0x4e52('0x1')](_0x4e52('0x2'),_0x4e52('0x3'),_0x4e52('0x4'))},'keyContent':{'type':Sequelize[_0x4e52('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4e52('0x5')]},'customField':{'type':Sequelize[_0x4e52('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4e52('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 4d61b7d..8df5ffd 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 _0x30dc=['apply','reject','save','destroy','then','sendStatus','error','stack','name','send','map','Dynamics365Field','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','params','keys','length','include','find','catch','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range'];(function(_0x5b4bd7,_0x32bf7f){var _0x41772a=function(_0x4f0666){while(--_0x4f0666){_0x5b4bd7['push'](_0x5b4bd7['shift']());}};_0x41772a(++_0x32bf7f);}(_0x30dc,0x14a));var _0xc30d=function(_0x3c13b1,_0x1c975a){_0x3c13b1=_0x3c13b1-0x0;var _0x48c4b5=_0x30dc[_0x3c13b1];return _0x48c4b5;};'use strict';var pdf=require(_0xc30d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc30d('0x1'));var zipdir=require(_0xc30d('0x2'));var jsonpatch=require(_0xc30d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc30d('0x4'));var Mustache=require(_0xc30d('0x5'));var util=require(_0xc30d('0x6'));var path=require(_0xc30d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc30d('0x8'));var crypto=require(_0xc30d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc30d('0xa'));var toCsv=require(_0xc30d('0xb'));var querystring=require(_0xc30d('0xc'));var Papa=require(_0xc30d('0xd'));var Redis=require(_0xc30d('0xe'));var authService=require(_0xc30d('0xf'));var qs=require(_0xc30d('0x10'));var as=require(_0xc30d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc30d('0x12'));var utils=require(_0xc30d('0x13'));var config=require(_0xc30d('0x14'));var db=require(_0xc30d('0x15'))['db'];function respondWithStatusCode(_0x4bebf1,_0x41dce2){_0x41dce2=_0x41dce2||0xcc;return function(_0x274c20){if(_0x274c20){return _0x4bebf1['sendStatus'](_0x41dce2);}return _0x4bebf1['status'](_0x41dce2)[_0xc30d('0x16')]();};}function respondWithResult(_0x297ee4,_0x53bac6){_0x53bac6=_0x53bac6||0xc8;return function(_0x2702a6){if(_0x2702a6){return _0x297ee4['status'](_0x53bac6)[_0xc30d('0x17')](_0x2702a6);}};}function respondWithFilteredResult(_0x251d79,_0xb844cd){return function(_0x14fe6e){if(_0x14fe6e){var _0x44b147=_0x14fe6e[_0xc30d('0x18')],_0xd1d4cb=_0xb844cd[_0xc30d('0x19')],_0x3f2140=_0xb844cd[_0xc30d('0x19')]+_0xb844cd[_0xc30d('0x1a')],_0x10c362;if(_0x3f2140>=_0x44b147){_0x3f2140=_0x44b147;_0x10c362=0xc8;}else{_0x10c362=0xce;}_0x251d79[_0xc30d('0x1b')](_0x10c362);return _0x251d79[_0xc30d('0x1c')](_0xc30d('0x1d'),_0xd1d4cb+'-'+_0x3f2140+'/'+_0x44b147)[_0xc30d('0x17')](_0x14fe6e);}return null;};}function patchUpdates(_0xed4abe){return function(_0x2e07f8){try{jsonpatch[_0xc30d('0x1e')](_0x2e07f8,_0xed4abe,!![]);}catch(_0x1503c6){return BPromise[_0xc30d('0x1f')](_0x1503c6);}return _0x2e07f8[_0xc30d('0x20')]();};}function saveUpdates(_0x514a25,_0x1c8355){return function(_0x3811df){if(_0x3811df){return _0x3811df['update'](_0x514a25)['then'](function(_0x344db1){return _0x344db1;});}return null;};}function removeEntity(_0x56faff,_0x12e980){return function(_0x3133b6){if(_0x3133b6){return _0x3133b6[_0xc30d('0x21')]()[_0xc30d('0x22')](function(){_0x56faff[_0xc30d('0x1b')](0xcc)[_0xc30d('0x16')]();});}};}function handleEntityNotFound(_0x23eeb1,_0x558428){return function(_0x14e2e1){if(!_0x14e2e1){_0x23eeb1[_0xc30d('0x23')](0x194);}return _0x14e2e1;};}function handleError(_0x52d430,_0x5bb4db){_0x5bb4db=_0x5bb4db||0x1f4;return function(_0x5d8178){logger[_0xc30d('0x24')](_0x5d8178[_0xc30d('0x25')]);if(_0x5d8178[_0xc30d('0x26')]){delete _0x5d8178[_0xc30d('0x26')];}_0x52d430[_0xc30d('0x1b')](_0x5bb4db)[_0xc30d('0x27')](_0x5d8178);};}exports['index']=function(_0x60c108,_0x13fb4e){var _0x3b3504={},_0x382587={},_0x2c3a6c={'count':0x0,'rows':[]};var _0x5b0aae=_[_0xc30d('0x28')](db[_0xc30d('0x29')]['rawAttributes'],function(_0x25265c){return{'name':_0x25265c[_0xc30d('0x2a')],'type':_0x25265c[_0xc30d('0x2b')][_0xc30d('0x2c')]};});_0x382587[_0xc30d('0x2d')]=_['map'](_0x5b0aae,_0xc30d('0x26'));_0x382587[_0xc30d('0x2e')]=_['keys'](_0x60c108[_0xc30d('0x2e')]);_0x382587['filters']=_[_0xc30d('0x2f')](_0x382587[_0xc30d('0x2d')],_0x382587[_0xc30d('0x2e')]);_0x3b3504['attributes']=_[_0xc30d('0x2f')](_0x382587[_0xc30d('0x2d')],qs['fields'](_0x60c108['query'][_0xc30d('0x30')]));_0x3b3504['attributes']=_0x3b3504[_0xc30d('0x31')]['length']?_0x3b3504['attributes']:_0x382587[_0xc30d('0x2d')];if(!_0x60c108['query'][_0xc30d('0x32')]('nolimit')){_0x3b3504[_0xc30d('0x1a')]=qs[_0xc30d('0x1a')](_0x60c108[_0xc30d('0x2e')][_0xc30d('0x1a')]);_0x3b3504[_0xc30d('0x19')]=qs[_0xc30d('0x19')](_0x60c108[_0xc30d('0x2e')][_0xc30d('0x19')]);}_0x3b3504[_0xc30d('0x33')]=qs['sort'](_0x60c108[_0xc30d('0x2e')][_0xc30d('0x34')]);_0x3b3504['where']=qs['filters'](_[_0xc30d('0x35')](_0x60c108[_0xc30d('0x2e')],_0x382587[_0xc30d('0x36')]),_0x5b0aae);if(_0x60c108[_0xc30d('0x2e')][_0xc30d('0x37')]){_0x3b3504['where']=_[_0xc30d('0x38')](_0x3b3504[_0xc30d('0x39')],{'$or':_[_0xc30d('0x28')](_0x5b0aae,function(_0x32f9d9){if(_0x32f9d9['type']!==_0xc30d('0x3a')){var _0x3f48f0={};_0x3f48f0[_0x32f9d9[_0xc30d('0x26')]]={'$like':'%'+_0x60c108[_0xc30d('0x2e')][_0xc30d('0x37')]+'%'};return _0x3f48f0;}})});}_0x3b3504=_['merge']({},_0x3b3504,_0x60c108[_0xc30d('0x3b')]);var _0x43d045={'where':_0x3b3504[_0xc30d('0x39')]};return db[_0xc30d('0x29')]['count'](_0x43d045)[_0xc30d('0x22')](function(_0x3495e9){_0x2c3a6c[_0xc30d('0x18')]=_0x3495e9;if(_0x60c108[_0xc30d('0x2e')][_0xc30d('0x3c')]){_0x3b3504['include']=[{'all':!![]}];}return db[_0xc30d('0x29')][_0xc30d('0x3d')](_0x3b3504);})[_0xc30d('0x22')](function(_0x70a2f0){_0x2c3a6c['rows']=_0x70a2f0;return _0x2c3a6c;})[_0xc30d('0x22')](respondWithFilteredResult(_0x13fb4e,_0x3b3504))['catch'](handleError(_0x13fb4e,null));};exports[_0xc30d('0x3e')]=function(_0x309dc2,_0x1b4b7b){var _0x5a82f8={'raw':!![],'where':{'id':_0x309dc2[_0xc30d('0x3f')]['id']}},_0x7d45ed={};_0x7d45ed[_0xc30d('0x2d')]=_[_0xc30d('0x40')](db[_0xc30d('0x29')]['rawAttributes']);_0x7d45ed[_0xc30d('0x2e')]=_[_0xc30d('0x40')](_0x309dc2['query']);_0x7d45ed[_0xc30d('0x36')]=_[_0xc30d('0x2f')](_0x7d45ed[_0xc30d('0x2d')],_0x7d45ed[_0xc30d('0x2e')]);_0x5a82f8[_0xc30d('0x31')]=_[_0xc30d('0x2f')](_0x7d45ed['model'],qs[_0xc30d('0x30')](_0x309dc2[_0xc30d('0x2e')][_0xc30d('0x30')]));_0x5a82f8[_0xc30d('0x31')]=_0x5a82f8[_0xc30d('0x31')][_0xc30d('0x41')]?_0x5a82f8[_0xc30d('0x31')]:_0x7d45ed['model'];if(_0x309dc2['query'][_0xc30d('0x3c')]){_0x5a82f8[_0xc30d('0x42')]=[{'all':!![]}];}_0x5a82f8=_[_0xc30d('0x38')]({},_0x5a82f8,_0x309dc2['options']);return db[_0xc30d('0x29')][_0xc30d('0x43')](_0x5a82f8)[_0xc30d('0x22')](handleEntityNotFound(_0x1b4b7b,null))[_0xc30d('0x22')](respondWithResult(_0x1b4b7b,null))[_0xc30d('0x44')](handleError(_0x1b4b7b,null));};exports[_0xc30d('0x45')]=function(_0x169fd9,_0x2b9173){return db[_0xc30d('0x29')][_0xc30d('0x45')](_0x169fd9[_0xc30d('0x46')],{})[_0xc30d('0x22')](respondWithResult(_0x2b9173,0xc9))[_0xc30d('0x44')](handleError(_0x2b9173,null));};exports[_0xc30d('0x47')]=function(_0x181793,_0x249370){if(_0x181793[_0xc30d('0x46')]['id']){delete _0x181793[_0xc30d('0x46')]['id'];}return db[_0xc30d('0x29')]['find']({'where':{'id':_0x181793['params']['id']}})[_0xc30d('0x22')](handleEntityNotFound(_0x249370,null))[_0xc30d('0x22')](saveUpdates(_0x181793[_0xc30d('0x46')],null))[_0xc30d('0x22')](respondWithResult(_0x249370,null))[_0xc30d('0x44')](handleError(_0x249370,null));};exports[_0xc30d('0x21')]=function(_0x597ad0,_0x3db716){return db[_0xc30d('0x29')][_0xc30d('0x43')]({'where':{'id':_0x597ad0[_0xc30d('0x3f')]['id']}})[_0xc30d('0x22')](handleEntityNotFound(_0x3db716,null))[_0xc30d('0x22')](removeEntity(_0x3db716,null))[_0xc30d('0x44')](handleError(_0x3db716,null));}; \ No newline at end of file +var _0x5dbc=['show','params','find','create','body','catch','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','json','count','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','offset','sort','pick','filter','where','merge','type','options','includeAll','include','Dynamics365Field','findAll','rows'];(function(_0x48df53,_0x281757){var _0x4e4080=function(_0x305d51){while(--_0x305d51){_0x48df53['push'](_0x48df53['shift']());}};_0x4e4080(++_0x281757);}(_0x5dbc,0x16a));var _0xc5db=function(_0x38b1cc,_0x4a73c1){_0x38b1cc=_0x38b1cc-0x0;var _0x11d1ba=_0x5dbc[_0x38b1cc];return _0x11d1ba;};'use strict';var pdf=require(_0xc5db('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc5db('0x1'));var zipdir=require(_0xc5db('0x2'));var jsonpatch=require(_0xc5db('0x3'));var rp=require(_0xc5db('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc5db('0x5'));var util=require(_0xc5db('0x6'));var path=require(_0xc5db('0x7'));var sox=require(_0xc5db('0x8'));var csv=require(_0xc5db('0x9'));var ejs=require(_0xc5db('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc5db('0xb'));var crypto=require(_0xc5db('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc5db('0x9'));var querystring=require(_0xc5db('0xd'));var Papa=require(_0xc5db('0xe'));var Redis=require(_0xc5db('0xf'));var authService=require(_0xc5db('0x10'));var qs=require(_0xc5db('0x11'));var as=require(_0xc5db('0x12'));var hardwareService=require(_0xc5db('0x13'));var logger=require(_0xc5db('0x14'))('api');var utils=require(_0xc5db('0x15'));var config=require(_0xc5db('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10afeb,_0x238db6){_0x238db6=_0x238db6||0xcc;return function(_0x2a6db7){if(_0x2a6db7){return _0x10afeb['sendStatus'](_0x238db6);}return _0x10afeb[_0xc5db('0x17')](_0x238db6)['end']();};}function respondWithResult(_0xc6dfc9,_0x4c3877){_0x4c3877=_0x4c3877||0xc8;return function(_0x5c536e){if(_0x5c536e){return _0xc6dfc9[_0xc5db('0x17')](_0x4c3877)[_0xc5db('0x18')](_0x5c536e);}};}function respondWithFilteredResult(_0x5f5c32,_0x913b40){return function(_0x4810c0){if(_0x4810c0){var _0xa8b9bd=_0x4810c0[_0xc5db('0x19')],_0x4f7df0=_0x913b40['offset'],_0x10f059=_0x913b40['offset']+_0x913b40[_0xc5db('0x1a')],_0x505c88;if(_0x10f059>=_0xa8b9bd){_0x10f059=_0xa8b9bd;_0x505c88=0xc8;}else{_0x505c88=0xce;}_0x5f5c32[_0xc5db('0x17')](_0x505c88);return _0x5f5c32[_0xc5db('0x1b')](_0xc5db('0x1c'),_0x4f7df0+'-'+_0x10f059+'/'+_0xa8b9bd)[_0xc5db('0x18')](_0x4810c0);}return null;};}function patchUpdates(_0x521f58){return function(_0x1e967e){try{jsonpatch[_0xc5db('0x1d')](_0x1e967e,_0x521f58,!![]);}catch(_0x41236a){return BPromise['reject'](_0x41236a);}return _0x1e967e[_0xc5db('0x1e')]();};}function saveUpdates(_0x46e87a,_0x3e1355){return function(_0xbc7e70){if(_0xbc7e70){return _0xbc7e70[_0xc5db('0x1f')](_0x46e87a)[_0xc5db('0x20')](function(_0xcca769){return _0xcca769;});}return null;};}function removeEntity(_0x332de3,_0x4ec214){return function(_0xe47b2c){if(_0xe47b2c){return _0xe47b2c['destroy']()['then'](function(){_0x332de3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39996e,_0x22fbb4){return function(_0x554d0f){if(!_0x554d0f){_0x39996e[_0xc5db('0x21')](0x194);}return _0x554d0f;};}function handleError(_0x890e3e,_0x26b508){_0x26b508=_0x26b508||0x1f4;return function(_0xc2134a){logger[_0xc5db('0x22')](_0xc2134a[_0xc5db('0x23')]);if(_0xc2134a['name']){delete _0xc2134a[_0xc5db('0x24')];}_0x890e3e['status'](_0x26b508)[_0xc5db('0x25')](_0xc2134a);};}exports[_0xc5db('0x26')]=function(_0x3b4058,_0x17f4a8){var _0x17f6f6={},_0xeaec0d={},_0x35d8af={'count':0x0,'rows':[]};var _0x21dfe2=_['map'](db['Dynamics365Field'][_0xc5db('0x27')],function(_0x5e6f03){return{'name':_0x5e6f03[_0xc5db('0x28')],'type':_0x5e6f03['type'][_0xc5db('0x29')]};});_0xeaec0d['model']=_[_0xc5db('0x2a')](_0x21dfe2,_0xc5db('0x24'));_0xeaec0d[_0xc5db('0x2b')]=_[_0xc5db('0x2c')](_0x3b4058['query']);_0xeaec0d[_0xc5db('0x2d')]=_[_0xc5db('0x2e')](_0xeaec0d['model'],_0xeaec0d[_0xc5db('0x2b')]);_0x17f6f6[_0xc5db('0x2f')]=_[_0xc5db('0x2e')](_0xeaec0d[_0xc5db('0x30')],qs[_0xc5db('0x31')](_0x3b4058[_0xc5db('0x2b')]['fields']));_0x17f6f6['attributes']=_0x17f6f6[_0xc5db('0x2f')][_0xc5db('0x32')]?_0x17f6f6['attributes']:_0xeaec0d['model'];if(!_0x3b4058['query']['hasOwnProperty']('nolimit')){_0x17f6f6['limit']=qs[_0xc5db('0x1a')](_0x3b4058[_0xc5db('0x2b')][_0xc5db('0x1a')]);_0x17f6f6[_0xc5db('0x33')]=qs['offset'](_0x3b4058[_0xc5db('0x2b')][_0xc5db('0x33')]);}_0x17f6f6['order']=qs[_0xc5db('0x34')](_0x3b4058[_0xc5db('0x2b')][_0xc5db('0x34')]);_0x17f6f6['where']=qs[_0xc5db('0x2d')](_[_0xc5db('0x35')](_0x3b4058[_0xc5db('0x2b')],_0xeaec0d[_0xc5db('0x2d')]),_0x21dfe2);if(_0x3b4058[_0xc5db('0x2b')][_0xc5db('0x36')]){_0x17f6f6[_0xc5db('0x37')]=_[_0xc5db('0x38')](_0x17f6f6[_0xc5db('0x37')],{'$or':_[_0xc5db('0x2a')](_0x21dfe2,function(_0x44f701){if(_0x44f701[_0xc5db('0x39')]!=='VIRTUAL'){var _0x54a48e={};_0x54a48e[_0x44f701[_0xc5db('0x24')]]={'$like':'%'+_0x3b4058[_0xc5db('0x2b')][_0xc5db('0x36')]+'%'};return _0x54a48e;}})});}_0x17f6f6=_[_0xc5db('0x38')]({},_0x17f6f6,_0x3b4058[_0xc5db('0x3a')]);var _0x269e0d={'where':_0x17f6f6[_0xc5db('0x37')]};return db['Dynamics365Field'][_0xc5db('0x19')](_0x269e0d)[_0xc5db('0x20')](function(_0x1c23d0){_0x35d8af[_0xc5db('0x19')]=_0x1c23d0;if(_0x3b4058['query'][_0xc5db('0x3b')]){_0x17f6f6[_0xc5db('0x3c')]=[{'all':!![]}];}return db[_0xc5db('0x3d')][_0xc5db('0x3e')](_0x17f6f6);})[_0xc5db('0x20')](function(_0x57757d){_0x35d8af[_0xc5db('0x3f')]=_0x57757d;return _0x35d8af;})[_0xc5db('0x20')](respondWithFilteredResult(_0x17f4a8,_0x17f6f6))['catch'](handleError(_0x17f4a8,null));};exports[_0xc5db('0x40')]=function(_0x119086,_0x41889d){var _0x1723d7={'raw':!![],'where':{'id':_0x119086[_0xc5db('0x41')]['id']}},_0x1e6319={};_0x1e6319['model']=_[_0xc5db('0x2c')](db[_0xc5db('0x3d')]['rawAttributes']);_0x1e6319[_0xc5db('0x2b')]=_[_0xc5db('0x2c')](_0x119086['query']);_0x1e6319[_0xc5db('0x2d')]=_['intersection'](_0x1e6319[_0xc5db('0x30')],_0x1e6319[_0xc5db('0x2b')]);_0x1723d7[_0xc5db('0x2f')]=_[_0xc5db('0x2e')](_0x1e6319[_0xc5db('0x30')],qs[_0xc5db('0x31')](_0x119086['query'][_0xc5db('0x31')]));_0x1723d7[_0xc5db('0x2f')]=_0x1723d7[_0xc5db('0x2f')][_0xc5db('0x32')]?_0x1723d7[_0xc5db('0x2f')]:_0x1e6319[_0xc5db('0x30')];if(_0x119086[_0xc5db('0x2b')][_0xc5db('0x3b')]){_0x1723d7[_0xc5db('0x3c')]=[{'all':!![]}];}_0x1723d7=_[_0xc5db('0x38')]({},_0x1723d7,_0x119086['options']);return db['Dynamics365Field'][_0xc5db('0x42')](_0x1723d7)[_0xc5db('0x20')](handleEntityNotFound(_0x41889d,null))[_0xc5db('0x20')](respondWithResult(_0x41889d,null))['catch'](handleError(_0x41889d,null));};exports['create']=function(_0x316117,_0xe7f00d){return db[_0xc5db('0x3d')][_0xc5db('0x43')](_0x316117[_0xc5db('0x44')],{})[_0xc5db('0x20')](respondWithResult(_0xe7f00d,0xc9))['catch'](handleError(_0xe7f00d,null));};exports[_0xc5db('0x1f')]=function(_0x52014d,_0x5a61fa){if(_0x52014d['body']['id']){delete _0x52014d['body']['id'];}return db['Dynamics365Field'][_0xc5db('0x42')]({'where':{'id':_0x52014d['params']['id']}})[_0xc5db('0x20')](handleEntityNotFound(_0x5a61fa,null))[_0xc5db('0x20')](saveUpdates(_0x52014d[_0xc5db('0x44')],null))[_0xc5db('0x20')](respondWithResult(_0x5a61fa,null))[_0xc5db('0x45')](handleError(_0x5a61fa,null));};exports[_0xc5db('0x46')]=function(_0x42bc17,_0x110bc9){return db[_0xc5db('0x3d')][_0xc5db('0x42')]({'where':{'id':_0x42bc17[_0xc5db('0x41')]['id']}})[_0xc5db('0x20')](handleEntityNotFound(_0x110bc9,null))[_0xc5db('0x20')](removeEntity(_0x110bc9,null))['catch'](handleError(_0x110bc9,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index adbaca5..7a44e3f 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 _0x4796=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1f7c53,_0x102af1){var _0x29cb0c=function(_0x269305){while(--_0x269305){_0x1f7c53['push'](_0x1f7c53['shift']());}};_0x29cb0c(++_0x102af1);}(_0x4796,0x107));var _0x6479=function(_0xd72523,_0xc35df7){_0xd72523=_0xd72523-0x0;var _0x28bb2e=_0x4796[_0xd72523];return _0x28bb2e;};'use strict';var _=require(_0x6479('0x0'));var util=require(_0x6479('0x1'));var logger=require(_0x6479('0x2'))(_0x6479('0x3'));var moment=require(_0x6479('0x4'));var BPromise=require(_0x6479('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6479('0x6'));var rimraf=require(_0x6479('0x7'));var config=require(_0x6479('0x8'));var attributes=require(_0x6479('0x9'));module[_0x6479('0xa')]=function(_0x45b09f,_0x537973){return _0x45b09f[_0x6479('0xb')]('Dynamics365Field',attributes,{'tableName':_0x6479('0xc'),'paranoid':![],'indexes':[{'name':_0x6479('0xd'),'fields':['idField',_0x6479('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa776=['Dynamics365Field','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','moment','path','../../config/environment','./intDynamics365Field.attributes','exports','define'];(function(_0x47c673,_0x372b71){var _0x5f7647=function(_0x1a9d03){while(--_0x1a9d03){_0x47c673['push'](_0x47c673['shift']());}};_0x5f7647(++_0x372b71);}(_0xa776,0x19b));var _0x6a77=function(_0xa76a95,_0x5ab7c7){_0xa76a95=_0xa76a95-0x0;var _0x3b2d32=_0xa776[_0xa76a95];return _0x3b2d32;};'use strict';var _=require(_0x6a77('0x0'));var util=require(_0x6a77('0x1'));var logger=require(_0x6a77('0x2'))('api');var moment=require(_0x6a77('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a77('0x4'));var rimraf=require('rimraf');var config=require(_0x6a77('0x5'));var attributes=require(_0x6a77('0x6'));module[_0x6a77('0x7')]=function(_0x39e9c2,_0x3cab2e){return _0x39e9c2[_0x6a77('0x8')](_0x6a77('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x6a77('0xa'),'fields':['idField',_0x6a77('0xb')],'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 3150328..b8edb25 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 _0xdbb1=['request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','../../config/utils','rpc','../../config/environment','http','request','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbb1,0x105));var _0x1dbb=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xdbb1[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x1dbb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1dbb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1dbb('0x2'));var logger=require('../../config/logger')(_0x1dbb('0x3'));var config=require(_0x1dbb('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1dbb('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x38259d,_0x2070a8,_0x7c2269){return new BPromise(function(_0x5e622c,_0x3ffb54){return client[_0x1dbb('0x6')](_0x38259d,_0x7c2269)['then'](function(_0x208220){logger[_0x1dbb('0x7')](_0x1dbb('0x8'),_0x2070a8,_0x1dbb('0x9'));logger[_0x1dbb('0xa')](_0x1dbb('0xb'),_0x2070a8,_0x1dbb('0x9'),JSON[_0x1dbb('0xc')](_0x208220));if(_0x208220[_0x1dbb('0xd')]){if(_0x208220[_0x1dbb('0xd')][_0x1dbb('0xe')]===0x1f4){logger['error'](_0x1dbb('0x8'),_0x2070a8,_0x208220[_0x1dbb('0xd')][_0x1dbb('0xf')]);return _0x3ffb54(_0x208220[_0x1dbb('0xd')]['message']);}logger['error'](_0x1dbb('0x8'),_0x2070a8,_0x208220[_0x1dbb('0xd')][_0x1dbb('0xf')]);return _0x5e622c(_0x208220[_0x1dbb('0xd')][_0x1dbb('0xf')]);}else{logger['info'](_0x1dbb('0x8'),_0x2070a8,_0x1dbb('0x9'));_0x5e622c(_0x208220[_0x1dbb('0x10')]['message']);}})[_0x1dbb('0x11')](function(_0x363224){logger['error'](_0x1dbb('0x8'),_0x2070a8,_0x363224);_0x3ffb54(_0x363224);});});} \ No newline at end of file +var _0xd2f5=['result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x5abd77,_0x4d351d){var _0x32b660=function(_0x3d0327){while(--_0x3d0327){_0x5abd77['push'](_0x5abd77['shift']());}};_0x32b660(++_0x4d351d);}(_0xd2f5,0x144));var _0x5d2f=function(_0xd43538,_0x364a33){_0xd43538=_0xd43538-0x0;var _0x34857b=_0xd2f5[_0xd43538];return _0x34857b;};'use strict';var _=require(_0x5d2f('0x0'));var util=require('util');var moment=require(_0x5d2f('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d2f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d2f('0x3'))['db'];var utils=require(_0x5d2f('0x4'));var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require(_0x5d2f('0x8'));var client=jayson[_0x5d2f('0x9')][_0x5d2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b2540,_0x443779,_0x908c6){return new BPromise(function(_0x1c8c59,_0x1670ea){return client[_0x5d2f('0xb')](_0x4b2540,_0x908c6)[_0x5d2f('0xc')](function(_0x58e637){logger[_0x5d2f('0xd')](_0x5d2f('0xe'),_0x443779,'request\x20sent');logger[_0x5d2f('0xf')](_0x5d2f('0x10'),_0x443779,_0x5d2f('0x11'),JSON['stringify'](_0x58e637));if(_0x58e637[_0x5d2f('0x12')]){if(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x13')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x443779,_0x58e637[_0x5d2f('0x12')]['message']);return _0x1670ea(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}logger['error'](_0x5d2f('0xe'),_0x443779,_0x58e637['error'][_0x5d2f('0x14')]);return _0x1c8c59(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}else{logger['info'](_0x5d2f('0xe'),_0x443779,_0x5d2f('0x11'));_0x1c8c59(_0x58e637[_0x5d2f('0x15')][_0x5d2f('0x14')]);}})[_0x5d2f('0x16')](function(_0x5796f6){logger[_0x5d2f('0x12')](_0x5d2f('0xe'),_0x443779,_0x5796f6);_0x1670ea(_0x5796f6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7760ff0..5b20127 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 _0x7514=['getFields','post','/:id/configurations','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show'];(function(_0x53bf11,_0x3acb5e){var _0x3a4f47=function(_0x5d215e){while(--_0x5d215e){_0x53bf11['push'](_0x53bf11['shift']());}};_0x3a4f47(++_0x3acb5e);}(_0x7514,0x1ea));var _0x4751=function(_0x672720,_0x4969da){_0x672720=_0x672720-0x0;var _0x376f9d=_0x7514[_0x672720];return _0x376f9d;};'use strict';var multer=require(_0x4751('0x0'));var util=require(_0x4751('0x1'));var path=require(_0x4751('0x2'));var timeout=require(_0x4751('0x3'));var express=require(_0x4751('0x4'));var router=express[_0x4751('0x5')]();var auth=require(_0x4751('0x6'));var interaction=require(_0x4751('0x7'));var config=require('../../config/environment');var controller=require(_0x4751('0x8'));router[_0x4751('0x9')]('/',auth['isAuthenticated'](),controller[_0x4751('0xa')]);router[_0x4751('0x9')](_0x4751('0xb'),auth[_0x4751('0xc')](),controller[_0x4751('0xd')]);router[_0x4751('0x9')]('/:id/configurations',auth[_0x4751('0xc')](),controller['getConfigurations']);router[_0x4751('0x9')]('/:id/fields',auth[_0x4751('0xc')](),controller[_0x4751('0xe')]);router[_0x4751('0xf')]('/',auth[_0x4751('0xc')](),controller['create']);router[_0x4751('0xf')](_0x4751('0x10'),auth[_0x4751('0xc')](),controller[_0x4751('0x11')]);router[_0x4751('0x12')](_0x4751('0xb'),auth[_0x4751('0xc')](),controller[_0x4751('0x13')]);router['delete'](_0x4751('0xb'),auth[_0x4751('0xc')](),controller['destroy']);module[_0x4751('0x14')]=router; \ No newline at end of file +var _0x50b9=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','exports'];(function(_0x148028,_0x8f4e9){var _0xb0ec6=function(_0x502efd){while(--_0x502efd){_0x148028['push'](_0x148028['shift']());}};_0xb0ec6(++_0x8f4e9);}(_0x50b9,0x138));var _0x950b=function(_0x4c94d1,_0x573a4f){_0x4c94d1=_0x4c94d1-0x0;var _0x48c2c3=_0x50b9[_0x4c94d1];return _0x48c2c3;};'use strict';var multer=require(_0x950b('0x0'));var util=require(_0x950b('0x1'));var path=require(_0x950b('0x2'));var timeout=require(_0x950b('0x3'));var express=require('express');var router=express[_0x950b('0x4')]();var auth=require(_0x950b('0x5'));var interaction=require(_0x950b('0x6'));var config=require(_0x950b('0x7'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x950b('0x8')](),controller[_0x950b('0x9')]);router[_0x950b('0xa')](_0x950b('0xb'),auth['isAuthenticated'](),controller[_0x950b('0xc')]);router['get'](_0x950b('0xd'),auth[_0x950b('0x8')](),controller[_0x950b('0xe')]);router['get'](_0x950b('0xf'),auth[_0x950b('0x8')](),controller[_0x950b('0x10')]);router['post']('/',auth[_0x950b('0x8')](),controller[_0x950b('0x11')]);router[_0x950b('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x950b('0x13')]);router[_0x950b('0x14')](_0x950b('0xb'),auth[_0x950b('0x8')](),controller[_0x950b('0x15')]);router[_0x950b('0x16')]('/:id',auth[_0x950b('0x8')](),controller['destroy']);module[_0x950b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 0d74984..56961a3 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 _0x8e3f=['STRING','username','remoteUri','sequelize','exports'];(function(_0xd5577a,_0x3bf904){var _0x2ad6e5=function(_0x4284a7){while(--_0x4284a7){_0xd5577a['push'](_0xd5577a['shift']());}};_0x2ad6e5(++_0x3bf904);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'name':{'type':Sequelize[_0xf8e3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf8e3('0x2')],'unique':_0xf8e3('0x3')},'apiKey':{'type':Sequelize[_0xf8e3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf8e3('0x4')},'serverUrl':{'type':Sequelize[_0xf8e3('0x2')]}}; \ No newline at end of file +var _0x94d4=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x94d4,0xa5));var _0x494d=function(_0x455ce1,_0xc2e5c9){_0x455ce1=_0x455ce1-0x0;var _0x25c86b=_0x94d4[_0x455ce1];return _0x25c86b;};'use strict';var Sequelize=require(_0x494d('0x0'));module[_0x494d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x494d('0x2')]},'username':{'type':Sequelize[_0x494d('0x2')],'unique':_0x494d('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x494d('0x2')],'unique':_0x494d('0x4')},'serverUrl':{'type':Sequelize[_0x494d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 47d5e67..571ca3f 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 _0xabce=['%s/%s','api/v2/ticket_fields','base64','requester','agent','priority','source','company','remove','includes','custom_text','custom_dropdown','label','default','choices','test','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','FreshdeskAccount','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','order','sort','pick','merge','VIRTUAL','filter','options','where','includeAll','include','rows','show','params','rawAttributes','fields','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','getSubjects','channel','getDescriptions','type','FreshdeskField','Subjects','Descriptions','getFields','remoteUri','slice','substring','GET','format'];(function(_0x2dd16b,_0x589ea5){var _0x832e78=function(_0x136f79){while(--_0x136f79){_0x2dd16b['push'](_0x2dd16b['shift']());}};_0x832e78(++_0x589ea5);}(_0xabce,0x103));var _0xeabc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xabce[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var db=require(_0xeabc('0x18'))['db'];var integrations=require(_0xeabc('0x19'));var jayson=require(_0xeabc('0x1a'));var client=jayson[_0xeabc('0x1b')][_0xeabc('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x53df9c,_0x235c2d,_0x1319f3){if(_0x1319f3){var _0x3251c6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3251c6['test'](_0x235c2d)){return _0x53df9c;}else{throw new db['Sequelize'][(_0xeabc('0x1d'))](_0xeabc('0x1e'));}}else{return _0x53df9c;}}function respondWithRpcPromise(_0x326bac,_0x53d5cb,_0xf913d7,_0x638976){return new BPromise(function(_0x49f2d8,_0x53fe28){var _0x10fa8e=_0x638976||client;return _0x10fa8e['request'](_0x326bac,_0xf913d7)[_0xeabc('0x1f')](function(_0x1b64b9){logger[_0xeabc('0x20')](_0xeabc('0x21'),_0x53d5cb,_0xeabc('0x22'));logger[_0xeabc('0x23')](_0xeabc('0x24'),_0x53d5cb,_0xeabc('0x22'),JSON['stringify'](_0x1b64b9));if(_0x1b64b9[_0xeabc('0x25')]){if(_0x1b64b9['error'][_0xeabc('0x26')]===0x1f4){logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);return _0x53fe28(_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);}logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);return _0x49f2d8(_0x1b64b9[_0xeabc('0x25')]['message']);}else{logger[_0xeabc('0x20')](_0xeabc('0x21'),_0x53d5cb,_0xeabc('0x22'));_0x49f2d8(_0x1b64b9[_0xeabc('0x28')]['message']);}})[_0xeabc('0x29')](function(_0x480440){logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x480440);_0x53fe28(_0x480440);});});}function respondWithStatusCode(_0x811f0d,_0x12acbd){_0x12acbd=_0x12acbd||0xcc;return function(_0x269621){if(_0x269621){return _0x811f0d[_0xeabc('0x2a')](_0x12acbd);}return _0x811f0d[_0xeabc('0x2b')](_0x12acbd)[_0xeabc('0x2c')]();};}function respondWithResult(_0x131722,_0x4c2693){_0x4c2693=_0x4c2693||0xc8;return function(_0x5b2934){if(_0x5b2934){return _0x131722[_0xeabc('0x2b')](_0x4c2693)['json'](_0x5b2934);}};}function respondWithFilteredResult(_0x3c1b5b,_0x2b342c){return function(_0x48fb52){if(_0x48fb52){var _0x2163e6=_0x48fb52[_0xeabc('0x2d')],_0x38572d=_0x2b342c[_0xeabc('0x2e')],_0x2b568f=_0x2b342c[_0xeabc('0x2e')]+_0x2b342c[_0xeabc('0x2f')],_0x2f8633;if(_0x2b568f>=_0x2163e6){_0x2b568f=_0x2163e6;_0x2f8633=0xc8;}else{_0x2f8633=0xce;}_0x3c1b5b[_0xeabc('0x2b')](_0x2f8633);return _0x3c1b5b['set'](_0xeabc('0x30'),_0x38572d+'-'+_0x2b568f+'/'+_0x2163e6)['json'](_0x48fb52);}return null;};}function patchUpdates(_0x2f03e8){return function(_0x2d027e){try{jsonpatch[_0xeabc('0x31')](_0x2d027e,_0x2f03e8,!![]);}catch(_0x3c606a){return BPromise[_0xeabc('0x32')](_0x3c606a);}return _0x2d027e[_0xeabc('0x33')]();};}function saveUpdates(_0x61c0af,_0x545d7f){return function(_0x78510a){if(_0x78510a){return _0x78510a[_0xeabc('0x34')](_0x61c0af)[_0xeabc('0x1f')](function(_0x4918e2){return _0x4918e2;});}return null;};}function removeEntity(_0x1e74ca,_0x3777c1){return function(_0x4492fd){if(_0x4492fd){return _0x4492fd['destroy']()[_0xeabc('0x1f')](function(){_0x1e74ca[_0xeabc('0x2b')](0xcc)[_0xeabc('0x2c')]();});}};}function handleEntityNotFound(_0x521091,_0xf98c7c){return function(_0x286203){if(!_0x286203){_0x521091['sendStatus'](0x194);}return _0x286203;};}function handleError(_0x50cca2,_0x254568){_0x254568=_0x254568||0x1f4;return function(_0x3829a9){logger['error'](_0x3829a9[_0xeabc('0x35')]);if(_0x3829a9[_0xeabc('0x36')]){delete _0x3829a9[_0xeabc('0x36')];}_0x50cca2[_0xeabc('0x2b')](_0x254568)[_0xeabc('0x37')](_0x3829a9);};}exports['index']=function(_0x353e48,_0x5b61fa){var _0x31ee7a={},_0x2bda29={},_0x311291={'count':0x0,'rows':[]};var _0x5b52c4=_['map'](db[_0xeabc('0x38')]['rawAttributes'],function(_0x113d5a){return{'name':_0x113d5a['fieldName'],'type':_0x113d5a['type']['key']};});_0x2bda29['model']=_[_0xeabc('0x39')](_0x5b52c4,'name');_0x2bda29[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x353e48['query']);_0x2bda29[_0xeabc('0x3c')]=_['intersection'](_0x2bda29[_0xeabc('0x3d')],_0x2bda29['query']);_0x31ee7a[_0xeabc('0x3e')]=_[_0xeabc('0x3f')](_0x2bda29[_0xeabc('0x3d')],qs['fields'](_0x353e48['query']['fields']));_0x31ee7a[_0xeabc('0x3e')]=_0x31ee7a[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x31ee7a['attributes']:_0x2bda29['model'];if(!_0x353e48[_0xeabc('0x3a')][_0xeabc('0x41')]('nolimit')){_0x31ee7a[_0xeabc('0x2f')]=qs['limit'](_0x353e48[_0xeabc('0x3a')]['limit']);_0x31ee7a['offset']=qs['offset'](_0x353e48[_0xeabc('0x3a')][_0xeabc('0x2e')]);}_0x31ee7a[_0xeabc('0x42')]=qs[_0xeabc('0x43')](_0x353e48['query'][_0xeabc('0x43')]);_0x31ee7a['where']=qs[_0xeabc('0x3c')](_[_0xeabc('0x44')](_0x353e48[_0xeabc('0x3a')],_0x2bda29[_0xeabc('0x3c')]),_0x5b52c4);if(_0x353e48[_0xeabc('0x3a')]['filter']){_0x31ee7a['where']=_[_0xeabc('0x45')](_0x31ee7a['where'],{'$or':_[_0xeabc('0x39')](_0x5b52c4,function(_0x2cdf59){if(_0x2cdf59['type']!==_0xeabc('0x46')){var _0x2b3c28={};_0x2b3c28[_0x2cdf59[_0xeabc('0x36')]]={'$like':'%'+_0x353e48[_0xeabc('0x3a')][_0xeabc('0x47')]+'%'};return _0x2b3c28;}})});}_0x31ee7a=_[_0xeabc('0x45')]({},_0x31ee7a,_0x353e48[_0xeabc('0x48')]);var _0x4b2fb6={'where':_0x31ee7a[_0xeabc('0x49')]};return db[_0xeabc('0x38')][_0xeabc('0x2d')](_0x4b2fb6)[_0xeabc('0x1f')](function(_0x271f8c){_0x311291[_0xeabc('0x2d')]=_0x271f8c;if(_0x353e48[_0xeabc('0x3a')][_0xeabc('0x4a')]){_0x31ee7a[_0xeabc('0x4b')]=[{'all':!![]}];}return db[_0xeabc('0x38')]['findAll'](_0x31ee7a);})[_0xeabc('0x1f')](function(_0x2e6efb){_0x311291[_0xeabc('0x4c')]=_0x2e6efb;return _0x311291;})[_0xeabc('0x1f')](respondWithFilteredResult(_0x5b61fa,_0x31ee7a))[_0xeabc('0x29')](handleError(_0x5b61fa,null));};exports[_0xeabc('0x4d')]=function(_0x268d95,_0x48df43){var _0x766743={'raw':![],'where':{'id':_0x268d95[_0xeabc('0x4e')]['id']}},_0x32e09b={};_0x32e09b[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](db['FreshdeskAccount'][_0xeabc('0x4f')]);_0x32e09b[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x268d95[_0xeabc('0x3a')]);_0x32e09b['filters']=_[_0xeabc('0x3f')](_0x32e09b[_0xeabc('0x3d')],_0x32e09b['query']);_0x766743[_0xeabc('0x3e')]=_['intersection'](_0x32e09b[_0xeabc('0x3d')],qs['fields'](_0x268d95[_0xeabc('0x3a')][_0xeabc('0x50')]));_0x766743[_0xeabc('0x3e')]=_0x766743[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x766743[_0xeabc('0x3e')]:_0x32e09b[_0xeabc('0x3d')];if(_0x268d95[_0xeabc('0x3a')][_0xeabc('0x4a')]){_0x766743[_0xeabc('0x4b')]=[{'all':!![]}];}_0x766743=_['merge']({},_0x766743,_0x268d95[_0xeabc('0x48')]);return db[_0xeabc('0x38')][_0xeabc('0x51')](_0x766743)[_0xeabc('0x1f')](handleEntityNotFound(_0x48df43,null))['then'](respondWithResult(_0x48df43,null))[_0xeabc('0x29')](handleError(_0x48df43,null));};exports[_0xeabc('0x52')]=function(_0x10d56f,_0x21f972){return db['FreshdeskAccount'][_0xeabc('0x52')](_0x10d56f[_0xeabc('0x53')],{})[_0xeabc('0x1f')](respondWithResult(_0x21f972,0xc9))[_0xeabc('0x29')](handleError(_0x21f972,null));};exports[_0xeabc('0x34')]=function(_0x3b5e94,_0x14c322){if(_0x3b5e94[_0xeabc('0x53')]['id']){delete _0x3b5e94[_0xeabc('0x53')]['id'];}return db['FreshdeskAccount'][_0xeabc('0x51')]({'where':{'id':_0x3b5e94['params']['id']}})['then'](handleEntityNotFound(_0x14c322,null))['then'](saveUpdates(_0x3b5e94[_0xeabc('0x53')],null))[_0xeabc('0x1f')](respondWithResult(_0x14c322,null))[_0xeabc('0x29')](handleError(_0x14c322,null));};exports[_0xeabc('0x54')]=function(_0xe89728,_0x2f78f3){return db['FreshdeskAccount'][_0xeabc('0x51')]({'where':{'id':_0xe89728[_0xeabc('0x4e')]['id']}})[_0xeabc('0x1f')](handleEntityNotFound(_0x2f78f3,null))[_0xeabc('0x1f')](removeEntity(_0x2f78f3,null))[_0xeabc('0x29')](handleError(_0x2f78f3,null));};exports[_0xeabc('0x55')]=function(_0x1750e9,_0x25c728,_0x5820ca){var _0x5b8370={};var _0x180e62={};var _0x340520;var _0x2c0894;return db['FreshdeskAccount'][_0xeabc('0x56')]({'where':{'id':_0x1750e9['params']['id']}})['then'](handleEntityNotFound(_0x25c728,null))[_0xeabc('0x1f')](function(_0x1fca99){if(_0x1fca99){_0x340520=_0x1fca99;_0x180e62[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](db[_0xeabc('0x57')][_0xeabc('0x4f')]);_0x180e62['query']=_[_0xeabc('0x3b')](_0x1750e9[_0xeabc('0x3a')]);_0x180e62[_0xeabc('0x3c')]=_[_0xeabc('0x3f')](_0x180e62[_0xeabc('0x3d')],_0x180e62[_0xeabc('0x3a')]);_0x5b8370['attributes']=_[_0xeabc('0x3f')](_0x180e62[_0xeabc('0x3d')],qs[_0xeabc('0x50')](_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x50')]));_0x5b8370[_0xeabc('0x3e')]=_0x5b8370[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x5b8370[_0xeabc('0x3e')]:_0x180e62['model'];_0x5b8370[_0xeabc('0x42')]=qs['sort'](_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x43')]);_0x5b8370[_0xeabc('0x49')]=qs[_0xeabc('0x3c')](_[_0xeabc('0x44')](_0x1750e9[_0xeabc('0x3a')],_0x180e62[_0xeabc('0x3c')]));if(_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x47')]){_0x5b8370[_0xeabc('0x49')]=_['merge'](_0x5b8370[_0xeabc('0x49')],{'$or':_[_0xeabc('0x39')](_0x5b8370[_0xeabc('0x3e')],function(_0x41cad5){var _0x5b4430={};_0x5b4430[_0x41cad5]={'$like':'%'+_0x1750e9[_0xeabc('0x3a')]['filter']+'%'};return _0x5b4430;})});}_0x5b8370=_['merge']({},_0x5b8370,_0x1750e9[_0xeabc('0x48')]);return _0x340520[_0xeabc('0x55')](_0x5b8370);}})[_0xeabc('0x1f')](function(_0x1c91e4){if(_0x1c91e4){_0x2c0894=_0x1c91e4['length'];if(!_0x1750e9['query'][_0xeabc('0x41')]('nolimit')){_0x5b8370['limit']=qs[_0xeabc('0x2f')](_0x1750e9['query']['limit']);_0x5b8370[_0xeabc('0x2e')]=qs[_0xeabc('0x2e')](_0x1750e9['query']['offset']);}return _0x340520[_0xeabc('0x55')](_0x5b8370);}})['then'](function(_0x238e2d){if(_0x238e2d){return _0x238e2d?{'count':_0x2c0894,'rows':_0x238e2d}:null;}})[_0xeabc('0x1f')](respondWithResult(_0x25c728,null))['catch'](handleError(_0x25c728,null));};exports['addConfiguration']=function(_0x24365a,_0x74f5ac,_0xd86ea7){if(_0x24365a[_0xeabc('0x53')]['id']){delete _0x24365a[_0xeabc('0x53')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x24365a[_0xeabc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x74f5ac,null))[_0xeabc('0x1f')](function(_0x5086c6){if(_0x5086c6){_0x24365a[_0xeabc('0x53')]['AccountId']=_0x5086c6['id'];_0x24365a[_0xeabc('0x53')]['Subjects']=integrations[_0xeabc('0x58')](_0x24365a[_0xeabc('0x53')][_0xeabc('0x59')],_0x24365a[_0xeabc('0x53')]['type']);_0x24365a[_0xeabc('0x53')]['Descriptions']=integrations[_0xeabc('0x5a')](_0x24365a[_0xeabc('0x53')][_0xeabc('0x59')],_0x24365a[_0xeabc('0x53')][_0xeabc('0x5b')]);return db['FreshdeskConfiguration'][_0xeabc('0x52')](_0x24365a[_0xeabc('0x53')],{'include':[{'model':db[_0xeabc('0x5c')],'as':_0xeabc('0x5d')},{'model':db['FreshdeskField'],'as':_0xeabc('0x5e')}]});}return null;})[_0xeabc('0x1f')](respondWithResult(_0x74f5ac,null))[_0xeabc('0x29')](handleError(_0x74f5ac,null));};exports[_0xeabc('0x5f')]=function(_0x5bacbb,_0xb9b460,_0x368cd4){var _0x287f88='';return db[_0xeabc('0x38')]['findOne']({'where':{'id':_0x5bacbb['params']['id']},'attributes':['id',_0xeabc('0x60'),'apiKey']})['then'](handleEntityNotFound(_0xb9b460,null))[_0xeabc('0x1f')](function(_0x460f07){if(_0x460f07){_0x287f88=_0x460f07[_0xeabc('0x60')];var _0x49679d=_0x287f88[_0xeabc('0x61')](-0x1);if(_0x49679d==='/'){_0x287f88=_0x287f88[_0xeabc('0x62')](0x0,_0x287f88['lastIndexOf'](_0x49679d));}return rp({'method':_0xeabc('0x63'),'uri':util[_0xeabc('0x64')](_0xeabc('0x65'),_0x287f88,_0xeabc('0x66')),'headers':{'Authorization':util[_0xeabc('0x64')]('Basic\x20%s',new Buffer(util[_0xeabc('0x64')]('%s:X',_0x460f07['apiKey']))['toString'](_0xeabc('0x67')))},'json':!![]});}})[_0xeabc('0x1f')](function(_0x1b6e9e){if(_0x1b6e9e){var _0x4424ce=[_0xeabc('0x68'),'subject',_0xeabc('0x69'),'description',_0xeabc('0x2b'),_0xeabc('0x6a'),'group',_0xeabc('0x6b'),'ticket_type','group',_0xeabc('0x6c')];_[_0xeabc('0x6d')](_0x1b6e9e,function(_0x439a48){return _0x4424ce[_0xeabc('0x6e')](_0x439a48[_0xeabc('0x36')])||!_0x439a48['default']&&_0x439a48[_0xeabc('0x5b')]!==_0xeabc('0x6f')&&_0x439a48[_0xeabc('0x5b')]!==_0xeabc('0x70');});return{'count':_0x1b6e9e[_0xeabc('0x40')],'rows':_[_0xeabc('0x39')](_0x1b6e9e,function(_0x2d05b4){return{'id':_0x2d05b4[_0xeabc('0x36')],'name':_0x2d05b4[_0xeabc('0x71')],'custom':!_0x2d05b4[_0xeabc('0x72')],'options':_0x2d05b4['choices']?_[_0xeabc('0x39')](_0x2d05b4[_0xeabc('0x73')],function(_0xba29f){return{'name':_['capitalize'](_0xba29f),'value':_0xba29f};}):[]};})};}})['then'](respondWithResult(_0xb9b460,null))[_0xeabc('0x29')](function(_0x273ca5){var _0xe90200=_0x5bacbb[_0xeabc('0x3a')][_0xeabc('0x74')]?0x1f4:_0x273ca5['statusCode']||0x1f4;logger[_0xeabc('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xe90200,JSON[_0xeabc('0x75')](_0x273ca5));delete _0x273ca5[_0xeabc('0x36')];if(_0xe90200===0x191){_0xe90200=0x190;}_0xb9b460['status'](_0xe90200)[_0xeabc('0x37')](_0x5bacbb[_0xeabc('0x3a')][_0xeabc('0x74')]?{'message':_0xeabc('0x76'),'statusCode':_0x273ca5[_0xeabc('0x77')]}:_0x273ca5);});}; \ No newline at end of file +var _0x1cb9=['reject','save','update','destroy','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','keys','include','find','create','body','params','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Descriptions','channel','FreshdeskConfiguration','Subjects','FreshdeskField','getFields','remoteUri','slice','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','Sequelize','ValidationError','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply'];(function(_0x59684c,_0x4f23bd){var _0x6e9beb=function(_0x316cde){while(--_0x316cde){_0x59684c['push'](_0x59684c['shift']());}};_0x6e9beb(++_0x4f23bd);}(_0x1cb9,0x14e));var _0x91cb=function(_0x411d3b,_0x4cdf9a){_0x411d3b=_0x411d3b-0x0;var _0x896ddb=_0x1cb9[_0x411d3b];return _0x896ddb;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x91cb('0x18'));var jayson=require(_0x91cb('0x19'));var client=jayson['client'][_0x91cb('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3ea707,_0x44f2e9,_0x2c7d40){if(_0x2c7d40){var _0x4a7d45=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a7d45['test'](_0x44f2e9)){return _0x3ea707;}else{throw new db[(_0x91cb('0x1b'))][(_0x91cb('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3ea707;}}function respondWithRpcPromise(_0x528f73,_0x576369,_0xc3629e,_0x347980){return new BPromise(function(_0x5ea796,_0x238f11){var _0x135890=_0x347980||client;return _0x135890['request'](_0x528f73,_0xc3629e)[_0x91cb('0x1d')](function(_0x139f4b){logger[_0x91cb('0x1e')](_0x91cb('0x1f'),_0x576369,'request\x20sent');logger[_0x91cb('0x20')](_0x91cb('0x21'),_0x576369,'request\x20sent',JSON[_0x91cb('0x22')](_0x139f4b));if(_0x139f4b['error']){if(_0x139f4b['error'][_0x91cb('0x23')]===0x1f4){logger[_0x91cb('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0x576369,_0x139f4b['error']['message']);return _0x238f11(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x139f4b['error'][_0x91cb('0x25')]);return _0x5ea796(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}else{logger['info'](_0x91cb('0x1f'),_0x576369,_0x91cb('0x26'));_0x5ea796(_0x139f4b[_0x91cb('0x27')][_0x91cb('0x25')]);}})[_0x91cb('0x28')](function(_0x7ad361){logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x7ad361);_0x238f11(_0x7ad361);});});}function respondWithStatusCode(_0x264e9b,_0x4c8438){_0x4c8438=_0x4c8438||0xcc;return function(_0x59bf3a){if(_0x59bf3a){return _0x264e9b[_0x91cb('0x29')](_0x4c8438);}return _0x264e9b['status'](_0x4c8438)[_0x91cb('0x2a')]();};}function respondWithResult(_0x34d372,_0x318031){_0x318031=_0x318031||0xc8;return function(_0x5595c5){if(_0x5595c5){return _0x34d372[_0x91cb('0x2b')](_0x318031)['json'](_0x5595c5);}};}function respondWithFilteredResult(_0x4572f6,_0x308e8c){return function(_0x3b3ee6){if(_0x3b3ee6){var _0x2fb473=_0x3b3ee6['count'],_0x468908=_0x308e8c[_0x91cb('0x2c')],_0x504275=_0x308e8c[_0x91cb('0x2c')]+_0x308e8c[_0x91cb('0x2d')],_0x2f04a3;if(_0x504275>=_0x2fb473){_0x504275=_0x2fb473;_0x2f04a3=0xc8;}else{_0x2f04a3=0xce;}_0x4572f6['status'](_0x2f04a3);return _0x4572f6[_0x91cb('0x2e')](_0x91cb('0x2f'),_0x468908+'-'+_0x504275+'/'+_0x2fb473)[_0x91cb('0x30')](_0x3b3ee6);}return null;};}function patchUpdates(_0x361e4c){return function(_0xf296bc){try{jsonpatch[_0x91cb('0x31')](_0xf296bc,_0x361e4c,!![]);}catch(_0x1e5bf1){return BPromise[_0x91cb('0x32')](_0x1e5bf1);}return _0xf296bc[_0x91cb('0x33')]();};}function saveUpdates(_0x5e6ed3,_0x2ccf6e){return function(_0x474a15){if(_0x474a15){return _0x474a15[_0x91cb('0x34')](_0x5e6ed3)[_0x91cb('0x1d')](function(_0x440060){return _0x440060;});}return null;};}function removeEntity(_0x4e70cd,_0x2409d3){return function(_0x74b443){if(_0x74b443){return _0x74b443[_0x91cb('0x35')]()[_0x91cb('0x1d')](function(){_0x4e70cd[_0x91cb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121c37,_0x5927cb){return function(_0x47fc17){if(!_0x47fc17){_0x121c37['sendStatus'](0x194);}return _0x47fc17;};}function handleError(_0x2011fc,_0x4bba88){_0x4bba88=_0x4bba88||0x1f4;return function(_0x341ebe){logger['error'](_0x341ebe['stack']);if(_0x341ebe[_0x91cb('0x36')]){delete _0x341ebe[_0x91cb('0x36')];}_0x2011fc[_0x91cb('0x2b')](_0x4bba88)[_0x91cb('0x37')](_0x341ebe);};}exports[_0x91cb('0x38')]=function(_0x4b0ca6,_0x8beb3a){var _0x3ddc0b={},_0x13a5ea={},_0x8496a3={'count':0x0,'rows':[]};var _0x486a89=_['map'](db[_0x91cb('0x39')][_0x91cb('0x3a')],function(_0x56d614){return{'name':_0x56d614[_0x91cb('0x3b')],'type':_0x56d614[_0x91cb('0x3c')]['key']};});_0x13a5ea[_0x91cb('0x3d')]=_[_0x91cb('0x3e')](_0x486a89,'name');_0x13a5ea[_0x91cb('0x3f')]=_['keys'](_0x4b0ca6[_0x91cb('0x3f')]);_0x13a5ea[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x13a5ea[_0x91cb('0x3d')],_0x13a5ea[_0x91cb('0x3f')]);_0x3ddc0b[_0x91cb('0x42')]=_['intersection'](_0x13a5ea[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x4b0ca6['query'][_0x91cb('0x43')]));_0x3ddc0b['attributes']=_0x3ddc0b[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3ddc0b[_0x91cb('0x42')]:_0x13a5ea[_0x91cb('0x3d')];if(!_0x4b0ca6['query'][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3ddc0b[_0x91cb('0x2d')]=qs[_0x91cb('0x2d')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3ddc0b[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2c')]);}_0x3ddc0b['order']=qs[_0x91cb('0x47')](_0x4b0ca6['query'][_0x91cb('0x47')]);_0x3ddc0b['where']=qs[_0x91cb('0x40')](_['pick'](_0x4b0ca6[_0x91cb('0x3f')],_0x13a5ea[_0x91cb('0x40')]),_0x486a89);if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3ddc0b['where']=_[_0x91cb('0x49')](_0x3ddc0b[_0x91cb('0x4a')],{'$or':_['map'](_0x486a89,function(_0x461e1e){if(_0x461e1e[_0x91cb('0x3c')]!==_0x91cb('0x4b')){var _0x32517d={};_0x32517d[_0x461e1e[_0x91cb('0x36')]]={'$like':'%'+_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x32517d;}})});}_0x3ddc0b=_[_0x91cb('0x49')]({},_0x3ddc0b,_0x4b0ca6[_0x91cb('0x4c')]);var _0x4b26f6={'where':_0x3ddc0b[_0x91cb('0x4a')]};return db[_0x91cb('0x39')][_0x91cb('0x4d')](_0x4b26f6)[_0x91cb('0x1d')](function(_0x3314cc){_0x8496a3[_0x91cb('0x4d')]=_0x3314cc;if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x3ddc0b['include']=[{'all':!![]}];}return db[_0x91cb('0x39')][_0x91cb('0x4f')](_0x3ddc0b);})[_0x91cb('0x1d')](function(_0x3b8cfd){_0x8496a3['rows']=_0x3b8cfd;return _0x8496a3;})[_0x91cb('0x1d')](respondWithFilteredResult(_0x8beb3a,_0x3ddc0b))[_0x91cb('0x28')](handleError(_0x8beb3a,null));};exports['show']=function(_0x212473,_0x47cdb7){var _0x2c419b={'raw':![],'where':{'id':_0x212473['params']['id']}},_0x4c0acd={};_0x4c0acd['model']=_[_0x91cb('0x50')](db[_0x91cb('0x39')][_0x91cb('0x3a')]);_0x4c0acd[_0x91cb('0x3f')]=_[_0x91cb('0x50')](_0x212473['query']);_0x4c0acd['filters']=_[_0x91cb('0x41')](_0x4c0acd[_0x91cb('0x3d')],_0x4c0acd[_0x91cb('0x3f')]);_0x2c419b[_0x91cb('0x42')]=_['intersection'](_0x4c0acd['model'],qs['fields'](_0x212473[_0x91cb('0x3f')]['fields']));_0x2c419b[_0x91cb('0x42')]=_0x2c419b['attributes'][_0x91cb('0x44')]?_0x2c419b[_0x91cb('0x42')]:_0x4c0acd[_0x91cb('0x3d')];if(_0x212473[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x2c419b[_0x91cb('0x51')]=[{'all':!![]}];}_0x2c419b=_[_0x91cb('0x49')]({},_0x2c419b,_0x212473[_0x91cb('0x4c')]);return db[_0x91cb('0x39')][_0x91cb('0x52')](_0x2c419b)[_0x91cb('0x1d')](handleEntityNotFound(_0x47cdb7,null))['then'](respondWithResult(_0x47cdb7,null))[_0x91cb('0x28')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x53')]=function(_0x4d7a34,_0x3f719b){return db[_0x91cb('0x39')]['create'](_0x4d7a34[_0x91cb('0x54')],{})[_0x91cb('0x1d')](respondWithResult(_0x3f719b,0xc9))[_0x91cb('0x28')](handleError(_0x3f719b,null));};exports[_0x91cb('0x34')]=function(_0x43ddee,_0x42a9ef){if(_0x43ddee[_0x91cb('0x54')]['id']){delete _0x43ddee[_0x91cb('0x54')]['id'];}return db[_0x91cb('0x39')][_0x91cb('0x52')]({'where':{'id':_0x43ddee[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x42a9ef,null))[_0x91cb('0x1d')](saveUpdates(_0x43ddee['body'],null))[_0x91cb('0x1d')](respondWithResult(_0x42a9ef,null))['catch'](handleError(_0x42a9ef,null));};exports[_0x91cb('0x35')]=function(_0x1b2fec,_0x1986d7){return db['FreshdeskAccount'][_0x91cb('0x52')]({'where':{'id':_0x1b2fec[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x1986d7,null))[_0x91cb('0x1d')](removeEntity(_0x1986d7,null))[_0x91cb('0x28')](handleError(_0x1986d7,null));};exports[_0x91cb('0x56')]=function(_0x25548b,_0x48e825,_0x2f5658){var _0x3854e9={};var _0x4250c2={};var _0x373076;var _0x55a0e3;return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x25548b['params']['id']}})['then'](handleEntityNotFound(_0x48e825,null))[_0x91cb('0x1d')](function(_0x525021){if(_0x525021){_0x373076=_0x525021;_0x4250c2[_0x91cb('0x3d')]=_[_0x91cb('0x50')](db['FreshdeskConfiguration']['rawAttributes']);_0x4250c2[_0x91cb('0x3f')]=_['keys'](_0x25548b[_0x91cb('0x3f')]);_0x4250c2[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x4250c2['model'],_0x4250c2[_0x91cb('0x3f')]);_0x3854e9['attributes']=_[_0x91cb('0x41')](_0x4250c2[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x25548b[_0x91cb('0x3f')]['fields']));_0x3854e9[_0x91cb('0x42')]=_0x3854e9[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3854e9[_0x91cb('0x42')]:_0x4250c2[_0x91cb('0x3d')];_0x3854e9[_0x91cb('0x58')]=qs[_0x91cb('0x47')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x47')]);_0x3854e9[_0x91cb('0x4a')]=qs[_0x91cb('0x40')](_[_0x91cb('0x59')](_0x25548b['query'],_0x4250c2[_0x91cb('0x40')]));if(_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3854e9[_0x91cb('0x4a')]=_[_0x91cb('0x49')](_0x3854e9[_0x91cb('0x4a')],{'$or':_[_0x91cb('0x3e')](_0x3854e9['attributes'],function(_0x325b2d){var _0x5a3c7d={};_0x5a3c7d[_0x325b2d]={'$like':'%'+_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x5a3c7d;})});}_0x3854e9=_[_0x91cb('0x49')]({},_0x3854e9,_0x25548b[_0x91cb('0x4c')]);return _0x373076['getConfigurations'](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x22ab40){if(_0x22ab40){_0x55a0e3=_0x22ab40[_0x91cb('0x44')];if(!_0x25548b[_0x91cb('0x3f')][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3854e9['limit']=qs[_0x91cb('0x2d')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3854e9[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2c')]);}return _0x373076[_0x91cb('0x56')](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x457f81){if(_0x457f81){return _0x457f81?{'count':_0x55a0e3,'rows':_0x457f81}:null;}})[_0x91cb('0x1d')](respondWithResult(_0x48e825,null))[_0x91cb('0x28')](handleError(_0x48e825,null));};exports[_0x91cb('0x5a')]=function(_0x3eead5,_0x2d2613,_0x2605c3){if(_0x3eead5[_0x91cb('0x54')]['id']){delete _0x3eead5['body']['id'];}return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x3eead5['params']['id']}})[_0x91cb('0x1d')](handleEntityNotFound(_0x2d2613,null))[_0x91cb('0x1d')](function(_0x1c3e0a){if(_0x1c3e0a){_0x3eead5['body'][_0x91cb('0x5b')]=_0x1c3e0a['id'];_0x3eead5[_0x91cb('0x54')]['Subjects']=integrations['getSubjects'](_0x3eead5[_0x91cb('0x54')]['channel'],_0x3eead5[_0x91cb('0x54')][_0x91cb('0x3c')]);_0x3eead5['body'][_0x91cb('0x5c')]=integrations['getDescriptions'](_0x3eead5[_0x91cb('0x54')][_0x91cb('0x5d')],_0x3eead5['body']['type']);return db[_0x91cb('0x5e')][_0x91cb('0x53')](_0x3eead5[_0x91cb('0x54')],{'include':[{'model':db['FreshdeskField'],'as':_0x91cb('0x5f')},{'model':db[_0x91cb('0x60')],'as':_0x91cb('0x5c')}]});}return null;})[_0x91cb('0x1d')](respondWithResult(_0x2d2613,null))['catch'](handleError(_0x2d2613,null));};exports[_0x91cb('0x61')]=function(_0x4ee1e3,_0x342587,_0x4118eb){var _0x30c607='';return db[_0x91cb('0x39')]['findOne']({'where':{'id':_0x4ee1e3['params']['id']},'attributes':['id',_0x91cb('0x62'),'apiKey']})[_0x91cb('0x1d')](handleEntityNotFound(_0x342587,null))[_0x91cb('0x1d')](function(_0x2ede77){if(_0x2ede77){_0x30c607=_0x2ede77[_0x91cb('0x62')];var _0x33d4ab=_0x30c607[_0x91cb('0x63')](-0x1);if(_0x33d4ab==='/'){_0x30c607=_0x30c607[_0x91cb('0x64')](0x0,_0x30c607['lastIndexOf'](_0x33d4ab));}return rp({'method':_0x91cb('0x65'),'uri':util[_0x91cb('0x66')]('%s/%s',_0x30c607,_0x91cb('0x67')),'headers':{'Authorization':util['format'](_0x91cb('0x68'),new Buffer(util[_0x91cb('0x66')](_0x91cb('0x69'),_0x2ede77[_0x91cb('0x6a')]))[_0x91cb('0x6b')](_0x91cb('0x6c')))},'json':!![]});}})[_0x91cb('0x1d')](function(_0x30259d){if(_0x30259d){var _0x23380a=[_0x91cb('0x6d'),_0x91cb('0x6e'),_0x91cb('0x6f'),_0x91cb('0x70'),_0x91cb('0x2b'),_0x91cb('0x71'),_0x91cb('0x72'),'source',_0x91cb('0x73'),'group',_0x91cb('0x74')];_[_0x91cb('0x75')](_0x30259d,function(_0x13f358){return _0x23380a[_0x91cb('0x76')](_0x13f358[_0x91cb('0x36')])||!_0x13f358[_0x91cb('0x77')]&&_0x13f358[_0x91cb('0x3c')]!==_0x91cb('0x78')&&_0x13f358['type']!==_0x91cb('0x79');});return{'count':_0x30259d[_0x91cb('0x44')],'rows':_['map'](_0x30259d,function(_0x4fb3c0){return{'id':_0x4fb3c0[_0x91cb('0x36')],'name':_0x4fb3c0['label'],'custom':!_0x4fb3c0['default'],'options':_0x4fb3c0[_0x91cb('0x7a')]?_['map'](_0x4fb3c0[_0x91cb('0x7a')],function(_0x498382){return{'name':_[_0x91cb('0x7b')](_0x498382),'value':_0x498382};}):[]};})};}})[_0x91cb('0x1d')](respondWithResult(_0x342587,null))[_0x91cb('0x28')](function(_0x443c01){var _0x4e899c=_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x7c')]?0x1f4:_0x443c01[_0x91cb('0x7d')]||0x1f4;logger[_0x91cb('0x24')](_0x91cb('0x7e'),_0x91cb('0x61'),_0x4e899c,JSON[_0x91cb('0x22')](_0x443c01));delete _0x443c01[_0x91cb('0x36')];if(_0x4e899c===0x191){_0x4e899c=0x190;}_0x342587[_0x91cb('0x2b')](_0x4e899c)[_0x91cb('0x37')](_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x7c')]?{'message':_0x91cb('0x7f'),'statusCode':_0x443c01[_0x91cb('0x7d')]}:_0x443c01);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e732c85..f9f773b 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 _0x6bfd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','util'];(function(_0x334651,_0x6e99f6){var _0x29657c=function(_0x420a94){while(--_0x420a94){_0x334651['push'](_0x334651['shift']());}};_0x29657c(++_0x6e99f6);}(_0x6bfd,0x113));var _0xd6bf=function(_0x34053b,_0x9098d6){_0x34053b=_0x34053b-0x0;var _0x18970d=_0x6bfd[_0x34053b];return _0x18970d;};'use strict';var _=require('lodash');var util=require(_0xd6bf('0x0'));var logger=require(_0xd6bf('0x1'))(_0xd6bf('0x2'));var moment=require(_0xd6bf('0x3'));var BPromise=require(_0xd6bf('0x4'));var rp=require(_0xd6bf('0x5'));var fs=require('fs');var path=require(_0xd6bf('0x6'));var rimraf=require(_0xd6bf('0x7'));var config=require(_0xd6bf('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xd6bf('0x9'));module[_0xd6bf('0xa')]=function(_0x26379f,_0x4b585d){return _0x26379f[_0xd6bf('0xb')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb951=['define','int_freshdesk_accounts','lodash','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xb951,0x17c));var _0x1b95=function(_0x57a1c9,_0xff0f89){_0x57a1c9=_0x57a1c9-0x0;var _0x3156c9=_0xb951[_0x57a1c9];return _0x3156c9;};'use strict';var _=require(_0x1b95('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1b95('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1b95('0x2'));var fs=require('fs');var path=require(_0x1b95('0x3'));var rimraf=require(_0x1b95('0x4'));var config=require(_0x1b95('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x1b95('0x6')]=function(_0xcb1612,_0x52d77b){return _0xcb1612[_0x1b95('0x7')]('FreshdeskAccount',attributes,{'tableName':_0x1b95('0x8'),'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 abb68dd..089a824 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 _0x6da2=['result','GetFreshdeskAccount','FreshdeskAccount','options','raw','limit','include','map','model','attributes','then','debug','catch','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3f9882,_0x4063bb){var _0x18b725=function(_0x8e5916){while(--_0x8e5916){_0x3f9882['push'](_0x3f9882['shift']());}};_0x18b725(++_0x4063bb);}(_0x6da2,0x112));var _0x26da=function(_0x4d0d2d,_0x4b4ca1){_0x4d0d2d=_0x4d0d2d-0x0;var _0x1e1a80=_0x6da2[_0x4d0d2d];return _0x1e1a80;};'use strict';var _=require(_0x26da('0x0'));var util=require(_0x26da('0x1'));var moment=require(_0x26da('0x2'));var BPromise=require(_0x26da('0x3'));var rs=require(_0x26da('0x4'));var fs=require('fs');var Redis=require(_0x26da('0x5'));var db=require(_0x26da('0x6'))['db'];var utils=require(_0x26da('0x7'));var logger=require(_0x26da('0x8'))(_0x26da('0x9'));var config=require(_0x26da('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x26da('0xb')][_0x26da('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a45bd,_0x3f5059,_0x4fed25){return new BPromise(function(_0x5e1bda,_0x51655c){return client[_0x26da('0xd')](_0x3a45bd,_0x4fed25)['then'](function(_0x2198f9){logger['info'](_0x26da('0xe'),_0x3f5059,_0x26da('0xf'));logger['debug'](_0x26da('0x10'),_0x3f5059,_0x26da('0xf'),JSON[_0x26da('0x11')](_0x2198f9));if(_0x2198f9[_0x26da('0x12')]){if(_0x2198f9['error'][_0x26da('0x13')]===0x1f4){logger[_0x26da('0x12')](_0x26da('0xe'),_0x3f5059,_0x2198f9['error'][_0x26da('0x14')]);return _0x51655c(_0x2198f9[_0x26da('0x12')][_0x26da('0x14')]);}logger['error'](_0x26da('0xe'),_0x3f5059,_0x2198f9[_0x26da('0x12')][_0x26da('0x14')]);return _0x5e1bda(_0x2198f9[_0x26da('0x12')][_0x26da('0x14')]);}else{logger[_0x26da('0x15')](_0x26da('0xe'),_0x3f5059,'request\x20sent');_0x5e1bda(_0x2198f9[_0x26da('0x16')][_0x26da('0x14')]);}})['catch'](function(_0x6685c5){logger['error'](_0x26da('0xe'),_0x3f5059,_0x6685c5);_0x51655c(_0x6685c5);});});}exports[_0x26da('0x17')]=function(_0x33d172){var _0x391371=this;return new Promise(function(_0x5e4d83,_0x4f0545){return db[_0x26da('0x18')]['findAll']({'raw':_0x33d172['options']?_0x33d172[_0x26da('0x19')][_0x26da('0x1a')]===undefined?!![]:![]:!![],'where':_0x33d172[_0x26da('0x19')]?_0x33d172[_0x26da('0x19')]['where']||null:null,'attributes':_0x33d172[_0x26da('0x19')]?_0x33d172['options']['attributes']||null:null,'limit':_0x33d172[_0x26da('0x19')]?_0x33d172[_0x26da('0x19')][_0x26da('0x1b')]||null:null,'include':_0x33d172[_0x26da('0x19')]?_0x33d172[_0x26da('0x19')][_0x26da('0x1c')]?_[_0x26da('0x1d')](_0x33d172[_0x26da('0x19')][_0x26da('0x1c')],function(_0x54c667){return{'model':db[_0x54c667[_0x26da('0x1e')]],'as':_0x54c667['as'],'attributes':_0x54c667[_0x26da('0x1f')],'include':_0x54c667[_0x26da('0x1c')]?_[_0x26da('0x1d')](_0x54c667[_0x26da('0x1c')],function(_0x46cb02){return{'model':db[_0x46cb02[_0x26da('0x1e')]],'as':_0x46cb02['as'],'attributes':_0x46cb02[_0x26da('0x1f')],'include':_0x46cb02[_0x26da('0x1c')]?_[_0x26da('0x1d')](_0x46cb02['include'],function(_0x393334){return{'model':db[_0x393334['model']],'as':_0x393334['as'],'attributes':_0x393334[_0x26da('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x26da('0x20')](function(_0x415556){logger[_0x26da('0x15')](_0x26da('0x17'),_0x33d172);logger[_0x26da('0x21')](_0x26da('0x17'),_0x33d172,JSON[_0x26da('0x11')](_0x415556));_0x5e4d83(_0x415556);})[_0x26da('0x22')](function(_0x21cb43){logger[_0x26da('0x12')]('GetFreshdeskAccount',_0x21cb43[_0x26da('0x14')],_0x33d172);_0x4f0545(_0x391371[_0x26da('0x12')](0x1f4,_0x21cb43[_0x26da('0x14')]));});});};exports[_0x26da('0x23')]=function(_0x31afc9){var _0x2e8e21=this;return new Promise(function(_0x34e183,_0x1ddf53){return db['FreshdeskAccount'][_0x26da('0x24')]({'raw':_0x31afc9[_0x26da('0x19')]?_0x31afc9[_0x26da('0x19')][_0x26da('0x1a')]===undefined?!![]:![]:!![],'where':_0x31afc9[_0x26da('0x19')]?_0x31afc9[_0x26da('0x19')]['where']||null:null,'attributes':_0x31afc9[_0x26da('0x19')]?_0x31afc9[_0x26da('0x19')][_0x26da('0x1f')]||null:null,'include':_0x31afc9['options']?_0x31afc9['options'][_0x26da('0x1c')]?_['map'](_0x31afc9[_0x26da('0x19')][_0x26da('0x1c')],function(_0x1ec2bd){return{'model':db[_0x1ec2bd[_0x26da('0x1e')]],'as':_0x1ec2bd['as'],'attributes':_0x1ec2bd[_0x26da('0x1f')],'include':_0x1ec2bd[_0x26da('0x1c')]?_[_0x26da('0x1d')](_0x1ec2bd['include'],function(_0x58aa5e){return{'model':db[_0x58aa5e[_0x26da('0x1e')]],'as':_0x58aa5e['as'],'attributes':_0x58aa5e[_0x26da('0x1f')],'include':_0x58aa5e[_0x26da('0x1c')]?_[_0x26da('0x1d')](_0x58aa5e[_0x26da('0x1c')],function(_0x2590f9){return{'model':db[_0x2590f9[_0x26da('0x1e')]],'as':_0x2590f9['as'],'attributes':_0x2590f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x26da('0x20')](function(_0x515502){logger[_0x26da('0x15')](_0x26da('0x23'),_0x31afc9);logger['debug'](_0x26da('0x23'),_0x31afc9,JSON[_0x26da('0x11')](_0x515502));_0x34e183(_0x515502);})[_0x26da('0x22')](function(_0x27a828){logger[_0x26da('0x12')](_0x26da('0x23'),_0x27a828['message'],_0x31afc9);_0x1ddf53(_0x2e8e21['error'](0x1f4,_0x27a828[_0x26da('0x14')]));});});}; \ No newline at end of file +var _0x2641=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','include','map','attributes','model','raw','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x201b7b,_0x166c79){var _0x5c2011=function(_0x35437e){while(--_0x35437e){_0x201b7b['push'](_0x201b7b['shift']());}};_0x5c2011(++_0x166c79);}(_0x2641,0xd7));var _0x1264=function(_0xaf60d2,_0x56cd4b){_0xaf60d2=_0xaf60d2-0x0;var _0x1d6cc5=_0x2641[_0xaf60d2];return _0x1d6cc5;};'use strict';var _=require(_0x1264('0x0'));var util=require(_0x1264('0x1'));var moment=require(_0x1264('0x2'));var BPromise=require(_0x1264('0x3'));var rs=require(_0x1264('0x4'));var fs=require('fs');var Redis=require(_0x1264('0x5'));var db=require(_0x1264('0x6'))['db'];var utils=require(_0x1264('0x7'));var logger=require(_0x1264('0x8'))(_0x1264('0x9'));var config=require(_0x1264('0xa'));var jayson=require(_0x1264('0xb'));var client=jayson[_0x1264('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e26c8,_0x539eb8,_0x558845){return new BPromise(function(_0x585b1a,_0x139b7a){return client[_0x1264('0xd')](_0x5e26c8,_0x558845)[_0x1264('0xe')](function(_0x5a0e6d){logger[_0x1264('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x539eb8,_0x1264('0x10'));logger[_0x1264('0x11')](_0x1264('0x12'),_0x539eb8,'request\x20sent',JSON[_0x1264('0x13')](_0x5a0e6d));if(_0x5a0e6d[_0x1264('0x14')]){if(_0x5a0e6d['error']['code']===0x1f4){logger[_0x1264('0x14')](_0x1264('0x15'),_0x539eb8,_0x5a0e6d[_0x1264('0x14')][_0x1264('0x16')]);return _0x139b7a(_0x5a0e6d['error'][_0x1264('0x16')]);}logger[_0x1264('0x14')](_0x1264('0x15'),_0x539eb8,_0x5a0e6d['error'][_0x1264('0x16')]);return _0x585b1a(_0x5a0e6d['error']['message']);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x539eb8,'request\x20sent');_0x585b1a(_0x5a0e6d[_0x1264('0x17')][_0x1264('0x16')]);}})[_0x1264('0x18')](function(_0x34544e){logger[_0x1264('0x14')](_0x1264('0x15'),_0x539eb8,_0x34544e);_0x139b7a(_0x34544e);});});}exports[_0x1264('0x19')]=function(_0x43bfc0){var _0x2cca3e=this;return new Promise(function(_0x365820,_0x3a7121){return db[_0x1264('0x1a')][_0x1264('0x1b')]({'raw':_0x43bfc0['options']?_0x43bfc0[_0x1264('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x43bfc0[_0x1264('0x1c')]?_0x43bfc0[_0x1264('0x1c')][_0x1264('0x1d')]||null:null,'attributes':_0x43bfc0[_0x1264('0x1c')]?_0x43bfc0['options']['attributes']||null:null,'limit':_0x43bfc0['options']?_0x43bfc0['options'][_0x1264('0x1e')]||null:null,'include':_0x43bfc0[_0x1264('0x1c')]?_0x43bfc0[_0x1264('0x1c')][_0x1264('0x1f')]?_[_0x1264('0x20')](_0x43bfc0[_0x1264('0x1c')][_0x1264('0x1f')],function(_0x366944){return{'model':db[_0x366944['model']],'as':_0x366944['as'],'attributes':_0x366944[_0x1264('0x21')],'include':_0x366944[_0x1264('0x1f')]?_[_0x1264('0x20')](_0x366944[_0x1264('0x1f')],function(_0x58c839){return{'model':db[_0x58c839[_0x1264('0x22')]],'as':_0x58c839['as'],'attributes':_0x58c839['attributes'],'include':_0x58c839[_0x1264('0x1f')]?_[_0x1264('0x20')](_0x58c839['include'],function(_0x2c8333){return{'model':db[_0x2c8333['model']],'as':_0x2c8333['as'],'attributes':_0x2c8333['attributes']};}):[]};}):[]};}):[]:[]})[_0x1264('0xe')](function(_0xa2b826){logger['info'](_0x1264('0x19'),_0x43bfc0);logger[_0x1264('0x11')]('GetFreshdeskAccount',_0x43bfc0,JSON[_0x1264('0x13')](_0xa2b826));_0x365820(_0xa2b826);})[_0x1264('0x18')](function(_0x1b690e){logger['error'](_0x1264('0x19'),_0x1b690e[_0x1264('0x16')],_0x43bfc0);_0x3a7121(_0x2cca3e[_0x1264('0x14')](0x1f4,_0x1b690e[_0x1264('0x16')]));});});};exports['ShowFreshdeskAccount']=function(_0x36725d){var _0x570cfd=this;return new Promise(function(_0x3ef1c3,_0x3afdf4){return db['FreshdeskAccount']['find']({'raw':_0x36725d[_0x1264('0x1c')]?_0x36725d['options'][_0x1264('0x23')]===undefined?!![]:![]:!![],'where':_0x36725d['options']?_0x36725d['options'][_0x1264('0x1d')]||null:null,'attributes':_0x36725d['options']?_0x36725d[_0x1264('0x1c')][_0x1264('0x21')]||null:null,'include':_0x36725d[_0x1264('0x1c')]?_0x36725d[_0x1264('0x1c')][_0x1264('0x1f')]?_[_0x1264('0x20')](_0x36725d[_0x1264('0x1c')][_0x1264('0x1f')],function(_0x529ee0){return{'model':db[_0x529ee0[_0x1264('0x22')]],'as':_0x529ee0['as'],'attributes':_0x529ee0[_0x1264('0x21')],'include':_0x529ee0[_0x1264('0x1f')]?_[_0x1264('0x20')](_0x529ee0['include'],function(_0x34057d){return{'model':db[_0x34057d['model']],'as':_0x34057d['as'],'attributes':_0x34057d['attributes'],'include':_0x34057d[_0x1264('0x1f')]?_[_0x1264('0x20')](_0x34057d[_0x1264('0x1f')],function(_0x49658e){return{'model':db[_0x49658e[_0x1264('0x22')]],'as':_0x49658e['as'],'attributes':_0x49658e[_0x1264('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2167d6){logger['info'](_0x1264('0x24'),_0x36725d);logger[_0x1264('0x11')](_0x1264('0x24'),_0x36725d,JSON[_0x1264('0x13')](_0x2167d6));_0x3ef1c3(_0x2167d6);})['catch'](function(_0x1cd8e4){logger[_0x1264('0x14')]('ShowFreshdeskAccount',_0x1cd8e4['message'],_0x36725d);_0x3afdf4(_0x570cfd['error'](0x1f4,_0x1cd8e4[_0x1264('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 0026f04..ca53b9e 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 _0xb630=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete'];(function(_0x301a9e,_0xae4efe){var _0x28e9ca=function(_0xb6f3a3){while(--_0xb6f3a3){_0x301a9e['push'](_0x301a9e['shift']());}};_0x28e9ca(++_0xae4efe);}(_0xb630,0x106));var _0x0b63=function(_0x1090f8,_0xd83a11){_0x1090f8=_0x1090f8-0x0;var _0x180524=_0xb630[_0x1090f8];return _0x180524;};'use strict';var multer=require(_0x0b63('0x0'));var util=require(_0x0b63('0x1'));var path=require(_0x0b63('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0b63('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0b63('0x4'));var config=require(_0x0b63('0x5'));var controller=require(_0x0b63('0x6'));router[_0x0b63('0x7')]('/',auth[_0x0b63('0x8')](),controller[_0x0b63('0x9')]);router['get'](_0x0b63('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0b63('0xb'),auth[_0x0b63('0x8')](),controller[_0x0b63('0xc')]);router[_0x0b63('0x7')]('/:id/subjects',auth[_0x0b63('0x8')](),controller[_0x0b63('0xd')]);router[_0x0b63('0x7')](_0x0b63('0xe'),auth[_0x0b63('0x8')](),controller[_0x0b63('0xf')]);router[_0x0b63('0x7')](_0x0b63('0x10'),auth[_0x0b63('0x8')](),controller[_0x0b63('0x11')]);router[_0x0b63('0x12')]('/',auth[_0x0b63('0x8')](),controller[_0x0b63('0x13')]);router[_0x0b63('0x12')](_0x0b63('0x10'),auth[_0x0b63('0x8')](),controller[_0x0b63('0x14')]);router[_0x0b63('0x15')](_0x0b63('0xa'),auth['isAuthenticated'](),controller[_0x0b63('0x16')]);router[_0x0b63('0x17')](_0x0b63('0xa'),auth[_0x0b63('0x8')](),controller[_0x0b63('0x18')]);module[_0x0b63('0x19')]=router; \ No newline at end of file +var _0xec33=['update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getTags','post','create','/:id/tags'];(function(_0x208589,_0x4ae466){var _0x13e8a7=function(_0x54fedb){while(--_0x54fedb){_0x208589['push'](_0x208589['shift']());}};_0x13e8a7(++_0x4ae466);}(_0xec33,0x1e6));var _0x3ec3=function(_0x3caca6,_0x21a8b7){_0x3caca6=_0x3caca6-0x0;var _0x17bc7d=_0xec33[_0x3caca6];return _0x17bc7d;};'use strict';var multer=require(_0x3ec3('0x0'));var util=require(_0x3ec3('0x1'));var path=require('path');var timeout=require(_0x3ec3('0x2'));var express=require(_0x3ec3('0x3'));var router=express['Router']();var auth=require(_0x3ec3('0x4'));var interaction=require(_0x3ec3('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x3ec3('0x6')]('/',auth[_0x3ec3('0x7')](),controller[_0x3ec3('0x8')]);router[_0x3ec3('0x6')](_0x3ec3('0x9'),auth[_0x3ec3('0x7')](),controller[_0x3ec3('0xa')]);router[_0x3ec3('0x6')](_0x3ec3('0xb'),auth[_0x3ec3('0x7')](),controller[_0x3ec3('0xc')]);router[_0x3ec3('0x6')](_0x3ec3('0xd'),auth[_0x3ec3('0x7')](),controller[_0x3ec3('0xe')]);router[_0x3ec3('0x6')](_0x3ec3('0xf'),auth[_0x3ec3('0x7')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x3ec3('0x7')](),controller[_0x3ec3('0x10')]);router[_0x3ec3('0x11')]('/',auth[_0x3ec3('0x7')](),controller[_0x3ec3('0x12')]);router['post'](_0x3ec3('0x13'),auth[_0x3ec3('0x7')](),controller['setTags']);router['put']('/:id',auth[_0x3ec3('0x7')](),controller[_0x3ec3('0x14')]);router['delete']('/:id',auth[_0x3ec3('0x7')](),controller['destroy']);module[_0x3ec3('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index a325098..37d8bfb 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 _0xb54d=['STRING','sequelize','exports'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xb54d,0x1de));var _0xdb54=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0xb54d[_0x500785];return _0x1f8bcc;};'use strict';var Sequelize=require(_0xdb54('0x0'));module[_0xdb54('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdb54('0x2')]}}; \ No newline at end of file +var _0x0ab8=['exports','STRING','sequelize'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0ab8,0x12e));var _0x80ab=function(_0x1cd565,_0x2b8b58){_0x1cd565=_0x1cd565-0x0;var _0x2a838c=_0x0ab8[_0x1cd565];return _0x2a838c;};'use strict';var Sequelize=require(_0x80ab('0x0'));module[_0x80ab('0x1')]={'name':{'type':Sequelize[_0x80ab('0x2')]},'description':{'type':Sequelize[_0x80ab('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 030d816..6566c2b 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 _0x2086=['find','create','body','getFields','findOne','order','sort','hasOwnProperty','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','catch','sendStatus','status','json','offset','apply','reject','save','update','then','destroy','stack','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params'];(function(_0x55a89d,_0x584ea7){var _0x1b0e5a=function(_0x2f9b88){while(--_0x2f9b88){_0x55a89d['push'](_0x55a89d['shift']());}};_0x1b0e5a(++_0x584ea7);}(_0x2086,0x124));var _0x6208=function(_0x39ca13,_0x1d9925){_0x39ca13=_0x39ca13-0x0;var _0x12d301=_0x2086[_0x39ca13];return _0x12d301;};'use strict';var pdf=require(_0x6208('0x0'));var emlformat=require(_0x6208('0x1'));var rimraf=require(_0x6208('0x2'));var zipdir=require(_0x6208('0x3'));var jsonpatch=require(_0x6208('0x4'));var rp=require(_0x6208('0x5'));var moment=require('moment');var BPromise=require(_0x6208('0x6'));var Mustache=require(_0x6208('0x7'));var util=require('util');var path=require(_0x6208('0x8'));var sox=require(_0x6208('0x9'));var csv=require(_0x6208('0xa'));var ejs=require(_0x6208('0xb'));var fs=require('fs');var _=require(_0x6208('0xc'));var squel=require('squel');var crypto=require(_0x6208('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6208('0xa'));var querystring=require(_0x6208('0xe'));var Papa=require(_0x6208('0xf'));var Redis=require(_0x6208('0x10'));var authService=require(_0x6208('0x11'));var qs=require(_0x6208('0x12'));var as=require(_0x6208('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6208('0x14'))(_0x6208('0x15'));var utils=require(_0x6208('0x16'));var config=require(_0x6208('0x17'));var db=require(_0x6208('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x6208('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x3b1cab,_0x1e1d2e,_0x3d95b4){if(_0x3d95b4){var _0x53962d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x53962d[_0x6208('0x1a')](_0x1e1d2e)){return _0x3b1cab;}else{throw new db[(_0x6208('0x1b'))][(_0x6208('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 _0x3b1cab;}}function respondWithRpcPromise(_0x307367,_0x32dda8,_0x1735e1,_0x582218){return new BPromise(function(_0x37db49,_0x11cd8b){var _0x2b4b44=_0x582218||client;return _0x2b4b44['request'](_0x307367,_0x1735e1)['then'](function(_0x43263a){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x32dda8,_0x6208('0x1d'));logger['debug'](_0x6208('0x1e'),_0x32dda8,_0x6208('0x1d'),JSON[_0x6208('0x1f')](_0x43263a));if(_0x43263a[_0x6208('0x20')]){if(_0x43263a[_0x6208('0x20')][_0x6208('0x21')]===0x1f4){logger[_0x6208('0x20')](_0x6208('0x22'),_0x32dda8,_0x43263a[_0x6208('0x20')][_0x6208('0x23')]);return _0x11cd8b(_0x43263a[_0x6208('0x20')][_0x6208('0x23')]);}logger['error'](_0x6208('0x22'),_0x32dda8,_0x43263a[_0x6208('0x20')][_0x6208('0x23')]);return _0x37db49(_0x43263a[_0x6208('0x20')][_0x6208('0x23')]);}else{logger[_0x6208('0x24')](_0x6208('0x22'),_0x32dda8,_0x6208('0x1d'));_0x37db49(_0x43263a['result'][_0x6208('0x23')]);}})[_0x6208('0x25')](function(_0x1ed151){logger[_0x6208('0x20')](_0x6208('0x22'),_0x32dda8,_0x1ed151);_0x11cd8b(_0x1ed151);});});}function respondWithStatusCode(_0x40bab6,_0x117fa7){_0x117fa7=_0x117fa7||0xcc;return function(_0x364b13){if(_0x364b13){return _0x40bab6[_0x6208('0x26')](_0x117fa7);}return _0x40bab6[_0x6208('0x27')](_0x117fa7)['end']();};}function respondWithResult(_0x2bb9df,_0x7a0478){_0x7a0478=_0x7a0478||0xc8;return function(_0x330ac9){if(_0x330ac9){return _0x2bb9df[_0x6208('0x27')](_0x7a0478)[_0x6208('0x28')](_0x330ac9);}};}function respondWithFilteredResult(_0x2bfc3a,_0x5d03d7){return function(_0x4f8cdd){if(_0x4f8cdd){var _0x76dcda=_0x4f8cdd['count'],_0x90d6c0=_0x5d03d7[_0x6208('0x29')],_0x18df12=_0x5d03d7[_0x6208('0x29')]+_0x5d03d7['limit'],_0x46f36d;if(_0x18df12>=_0x76dcda){_0x18df12=_0x76dcda;_0x46f36d=0xc8;}else{_0x46f36d=0xce;}_0x2bfc3a[_0x6208('0x27')](_0x46f36d);return _0x2bfc3a['set']('Content-Range',_0x90d6c0+'-'+_0x18df12+'/'+_0x76dcda)['json'](_0x4f8cdd);}return null;};}function patchUpdates(_0x3f5474){return function(_0x586af3){try{jsonpatch[_0x6208('0x2a')](_0x586af3,_0x3f5474,!![]);}catch(_0x494fa0){return BPromise[_0x6208('0x2b')](_0x494fa0);}return _0x586af3[_0x6208('0x2c')]();};}function saveUpdates(_0x482379,_0x7eadd7){return function(_0x531e1f){if(_0x531e1f){return _0x531e1f[_0x6208('0x2d')](_0x482379)[_0x6208('0x2e')](function(_0x1322d9){return _0x1322d9;});}return null;};}function removeEntity(_0x563d58,_0x35c781){return function(_0xd856b6){if(_0xd856b6){return _0xd856b6[_0x6208('0x2f')]()[_0x6208('0x2e')](function(){_0x563d58[_0x6208('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a8816,_0x1d77b2){return function(_0x3be3ca){if(!_0x3be3ca){_0x2a8816[_0x6208('0x26')](0x194);}return _0x3be3ca;};}function handleError(_0x1594f3,_0xff8668){_0xff8668=_0xff8668||0x1f4;return function(_0x5a5dd6){logger['error'](_0x5a5dd6[_0x6208('0x30')]);if(_0x5a5dd6['name']){delete _0x5a5dd6['name'];}_0x1594f3[_0x6208('0x27')](_0xff8668)[_0x6208('0x31')](_0x5a5dd6);};}exports[_0x6208('0x32')]=function(_0x49b7bb,_0x3829b8){var _0x27f70f={},_0x45e10f={},_0x361941={'count':0x0,'rows':[]};var _0x158e30=_[_0x6208('0x33')](db[_0x6208('0x34')][_0x6208('0x35')],function(_0x49c2e3){return{'name':_0x49c2e3[_0x6208('0x36')],'type':_0x49c2e3[_0x6208('0x37')]['key']};});_0x45e10f[_0x6208('0x38')]=_[_0x6208('0x33')](_0x158e30,_0x6208('0x39'));_0x45e10f[_0x6208('0x3a')]=_[_0x6208('0x3b')](_0x49b7bb[_0x6208('0x3a')]);_0x45e10f[_0x6208('0x3c')]=_[_0x6208('0x3d')](_0x45e10f[_0x6208('0x38')],_0x45e10f[_0x6208('0x3a')]);_0x27f70f[_0x6208('0x3e')]=_[_0x6208('0x3d')](_0x45e10f[_0x6208('0x38')],qs[_0x6208('0x3f')](_0x49b7bb[_0x6208('0x3a')][_0x6208('0x3f')]));_0x27f70f[_0x6208('0x3e')]=_0x27f70f[_0x6208('0x3e')][_0x6208('0x40')]?_0x27f70f[_0x6208('0x3e')]:_0x45e10f[_0x6208('0x38')];if(!_0x49b7bb['query']['hasOwnProperty'](_0x6208('0x41'))){_0x27f70f['limit']=qs[_0x6208('0x42')](_0x49b7bb[_0x6208('0x3a')]['limit']);_0x27f70f[_0x6208('0x29')]=qs[_0x6208('0x29')](_0x49b7bb['query'][_0x6208('0x29')]);}_0x27f70f['order']=qs['sort'](_0x49b7bb[_0x6208('0x3a')]['sort']);_0x27f70f[_0x6208('0x43')]=qs['filters'](_[_0x6208('0x44')](_0x49b7bb[_0x6208('0x3a')],_0x45e10f['filters']),_0x158e30);if(_0x49b7bb[_0x6208('0x3a')][_0x6208('0x45')]){_0x27f70f['where']=_[_0x6208('0x46')](_0x27f70f[_0x6208('0x43')],{'$or':_[_0x6208('0x33')](_0x158e30,function(_0x1ae348){if(_0x1ae348['type']!==_0x6208('0x47')){var _0x5e4b14={};_0x5e4b14[_0x1ae348[_0x6208('0x39')]]={'$like':'%'+_0x49b7bb['query'][_0x6208('0x45')]+'%'};return _0x5e4b14;}})});}_0x27f70f=_[_0x6208('0x46')]({},_0x27f70f,_0x49b7bb[_0x6208('0x48')]);var _0x3aa01e={'where':_0x27f70f[_0x6208('0x43')]};return db['FreshdeskConfiguration'][_0x6208('0x49')](_0x3aa01e)[_0x6208('0x2e')](function(_0x3692a2){_0x361941['count']=_0x3692a2;if(_0x49b7bb['query'][_0x6208('0x4a')]){_0x27f70f[_0x6208('0x4b')]=[{'all':!![]}];}return db[_0x6208('0x34')][_0x6208('0x4c')](_0x27f70f);})['then'](function(_0x200957){_0x361941[_0x6208('0x4d')]=_0x200957;return _0x361941;})[_0x6208('0x2e')](respondWithFilteredResult(_0x3829b8,_0x27f70f))[_0x6208('0x25')](handleError(_0x3829b8,null));};exports[_0x6208('0x4e')]=function(_0xc7e04e,_0x1aca58){var _0x2f8481={'raw':![],'where':{'id':_0xc7e04e[_0x6208('0x4f')]['id']}},_0x560566={};_0x560566[_0x6208('0x38')]=_[_0x6208('0x3b')](db[_0x6208('0x34')]['rawAttributes']);_0x560566[_0x6208('0x3a')]=_['keys'](_0xc7e04e[_0x6208('0x3a')]);_0x560566[_0x6208('0x3c')]=_[_0x6208('0x3d')](_0x560566['model'],_0x560566['query']);_0x2f8481[_0x6208('0x3e')]=_[_0x6208('0x3d')](_0x560566[_0x6208('0x38')],qs['fields'](_0xc7e04e[_0x6208('0x3a')][_0x6208('0x3f')]));_0x2f8481[_0x6208('0x3e')]=_0x2f8481[_0x6208('0x3e')]['length']?_0x2f8481['attributes']:_0x560566[_0x6208('0x38')];if(_0xc7e04e[_0x6208('0x3a')][_0x6208('0x4a')]){_0x2f8481[_0x6208('0x4b')]=[{'all':!![]}];}_0x2f8481=_[_0x6208('0x46')]({},_0x2f8481,_0xc7e04e['options']);return db[_0x6208('0x34')][_0x6208('0x50')](_0x2f8481)[_0x6208('0x2e')](handleEntityNotFound(_0x1aca58,null))[_0x6208('0x2e')](respondWithResult(_0x1aca58,null))[_0x6208('0x25')](handleError(_0x1aca58,null));};exports[_0x6208('0x51')]=function(_0x32b937,_0x53221f){return db[_0x6208('0x34')][_0x6208('0x51')](_0x32b937[_0x6208('0x52')],{})[_0x6208('0x2e')](respondWithResult(_0x53221f,0xc9))[_0x6208('0x25')](handleError(_0x53221f,null));};exports[_0x6208('0x2d')]=function(_0x119da9,_0x2720ae){if(_0x119da9['body']['id']){delete _0x119da9['body']['id'];}return db[_0x6208('0x34')]['find']({'where':{'id':_0x119da9[_0x6208('0x4f')]['id']}})[_0x6208('0x2e')](handleEntityNotFound(_0x2720ae,null))[_0x6208('0x2e')](saveUpdates(_0x119da9[_0x6208('0x52')],null))[_0x6208('0x2e')](respondWithResult(_0x2720ae,null))['catch'](handleError(_0x2720ae,null));};exports[_0x6208('0x2f')]=function(_0x56e6a5,_0x4c8aed){return db[_0x6208('0x34')][_0x6208('0x50')]({'where':{'id':_0x56e6a5[_0x6208('0x4f')]['id']}})[_0x6208('0x2e')](handleEntityNotFound(_0x4c8aed,null))[_0x6208('0x2e')](removeEntity(_0x4c8aed,null))[_0x6208('0x25')](handleError(_0x4c8aed,null));};exports[_0x6208('0x53')]=function(_0x58cceb,_0x24a701,_0x2a578b){var _0x45dfdf={};var _0x48a135={};var _0x243769;var _0x34dec6;return db[_0x6208('0x34')][_0x6208('0x54')]({'where':{'id':_0x58cceb['params']['id']}})[_0x6208('0x2e')](handleEntityNotFound(_0x24a701,null))[_0x6208('0x2e')](function(_0x479c8c){if(_0x479c8c){_0x243769=_0x479c8c;_0x48a135[_0x6208('0x38')]=_[_0x6208('0x3b')](db['FreshdeskField'][_0x6208('0x35')]);_0x48a135[_0x6208('0x3a')]=_[_0x6208('0x3b')](_0x58cceb[_0x6208('0x3a')]);_0x48a135[_0x6208('0x3c')]=_[_0x6208('0x3d')](_0x48a135['model'],_0x48a135[_0x6208('0x3a')]);_0x45dfdf[_0x6208('0x3e')]=_['intersection'](_0x48a135[_0x6208('0x38')],qs[_0x6208('0x3f')](_0x58cceb['query']['fields']));_0x45dfdf[_0x6208('0x3e')]=_0x45dfdf[_0x6208('0x3e')][_0x6208('0x40')]?_0x45dfdf[_0x6208('0x3e')]:_0x48a135[_0x6208('0x38')];_0x45dfdf[_0x6208('0x55')]=qs[_0x6208('0x56')](_0x58cceb[_0x6208('0x3a')][_0x6208('0x56')]);_0x45dfdf[_0x6208('0x43')]=qs['filters'](_['pick'](_0x58cceb['query'],_0x48a135['filters']));if(_0x58cceb[_0x6208('0x3a')][_0x6208('0x45')]){_0x45dfdf[_0x6208('0x43')]=_[_0x6208('0x46')](_0x45dfdf[_0x6208('0x43')],{'$or':_[_0x6208('0x33')](_0x45dfdf[_0x6208('0x3e')],function(_0x4c789f){var _0x4aa147={};_0x4aa147[_0x4c789f]={'$like':'%'+_0x58cceb[_0x6208('0x3a')][_0x6208('0x45')]+'%'};return _0x4aa147;})});}_0x45dfdf=_[_0x6208('0x46')]({},_0x45dfdf,_0x58cceb[_0x6208('0x48')]);return _0x243769[_0x6208('0x53')](_0x45dfdf);}})[_0x6208('0x2e')](function(_0x2e6e0a){if(_0x2e6e0a){_0x34dec6=_0x2e6e0a[_0x6208('0x40')];if(!_0x58cceb['query'][_0x6208('0x57')](_0x6208('0x41'))){_0x45dfdf[_0x6208('0x42')]=qs[_0x6208('0x42')](_0x58cceb[_0x6208('0x3a')][_0x6208('0x42')]);_0x45dfdf['offset']=qs[_0x6208('0x29')](_0x58cceb['query'][_0x6208('0x29')]);}return _0x243769[_0x6208('0x53')](_0x45dfdf);}})[_0x6208('0x2e')](function(_0x38efee){if(_0x38efee){return _0x38efee?{'count':_0x34dec6,'rows':_0x38efee}:null;}})[_0x6208('0x2e')](respondWithResult(_0x24a701,null))[_0x6208('0x25')](handleError(_0x24a701,null));};exports[_0x6208('0x58')]=function(_0x2da9b8,_0x3321ff,_0x200283){var _0x76d72={};var _0x44f818={};var _0x3b1e62;var _0x3dc6b1;return db[_0x6208('0x34')][_0x6208('0x54')]({'where':{'id':_0x2da9b8[_0x6208('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3321ff,null))[_0x6208('0x2e')](function(_0x13f605){if(_0x13f605){_0x3b1e62=_0x13f605;_0x44f818[_0x6208('0x38')]=_[_0x6208('0x3b')](db[_0x6208('0x59')][_0x6208('0x35')]);_0x44f818[_0x6208('0x3a')]=_[_0x6208('0x3b')](_0x2da9b8[_0x6208('0x3a')]);_0x44f818[_0x6208('0x3c')]=_[_0x6208('0x3d')](_0x44f818[_0x6208('0x38')],_0x44f818['query']);_0x76d72['attributes']=_[_0x6208('0x3d')](_0x44f818['model'],qs[_0x6208('0x3f')](_0x2da9b8[_0x6208('0x3a')][_0x6208('0x3f')]));_0x76d72[_0x6208('0x3e')]=_0x76d72['attributes'][_0x6208('0x40')]?_0x76d72[_0x6208('0x3e')]:_0x44f818['model'];_0x76d72[_0x6208('0x55')]=qs[_0x6208('0x56')](_0x2da9b8[_0x6208('0x3a')][_0x6208('0x56')]);_0x76d72['where']=qs[_0x6208('0x3c')](_[_0x6208('0x44')](_0x2da9b8[_0x6208('0x3a')],_0x44f818['filters']));if(_0x2da9b8[_0x6208('0x3a')][_0x6208('0x45')]){_0x76d72[_0x6208('0x43')]=_[_0x6208('0x46')](_0x76d72[_0x6208('0x43')],{'$or':_[_0x6208('0x33')](_0x76d72[_0x6208('0x3e')],function(_0xf0687e){var _0x2408a9={};_0x2408a9[_0xf0687e]={'$like':'%'+_0x2da9b8[_0x6208('0x3a')][_0x6208('0x45')]+'%'};return _0x2408a9;})});}_0x76d72=_[_0x6208('0x46')]({},_0x76d72,_0x2da9b8['options']);return _0x3b1e62[_0x6208('0x58')](_0x76d72);}})[_0x6208('0x2e')](function(_0x29066f){if(_0x29066f){_0x3dc6b1=_0x29066f[_0x6208('0x40')];if(!_0x2da9b8['query']['hasOwnProperty'](_0x6208('0x41'))){_0x76d72['limit']=qs[_0x6208('0x42')](_0x2da9b8[_0x6208('0x3a')]['limit']);_0x76d72['offset']=qs[_0x6208('0x29')](_0x2da9b8['query']['offset']);}return _0x3b1e62[_0x6208('0x58')](_0x76d72);}})[_0x6208('0x2e')](function(_0x28270d){if(_0x28270d){return _0x28270d?{'count':_0x3dc6b1,'rows':_0x28270d}:null;}})[_0x6208('0x2e')](respondWithResult(_0x3321ff,null))[_0x6208('0x25')](handleError(_0x3321ff,null));};exports[_0x6208('0x5a')]=function(_0x1c2f76,_0x74a33d,_0x4e9379){var _0x5c655f={};var _0x4301ca={};var _0x1dc52e;var _0x7ba321;return db['FreshdeskConfiguration'][_0x6208('0x54')]({'where':{'id':_0x1c2f76['params']['id']}})[_0x6208('0x2e')](handleEntityNotFound(_0x74a33d,null))['then'](function(_0x31bbb7){if(_0x31bbb7){_0x1dc52e=_0x31bbb7;_0x4301ca[_0x6208('0x38')]=_[_0x6208('0x3b')](db[_0x6208('0x59')][_0x6208('0x35')]);_0x4301ca[_0x6208('0x3a')]=_[_0x6208('0x3b')](_0x1c2f76['query']);_0x4301ca[_0x6208('0x3c')]=_['intersection'](_0x4301ca[_0x6208('0x38')],_0x4301ca[_0x6208('0x3a')]);_0x5c655f[_0x6208('0x3e')]=_[_0x6208('0x3d')](_0x4301ca['model'],qs['fields'](_0x1c2f76[_0x6208('0x3a')][_0x6208('0x3f')]));_0x5c655f['attributes']=_0x5c655f['attributes'][_0x6208('0x40')]?_0x5c655f[_0x6208('0x3e')]:_0x4301ca[_0x6208('0x38')];_0x5c655f[_0x6208('0x55')]=qs[_0x6208('0x56')](_0x1c2f76[_0x6208('0x3a')][_0x6208('0x56')]);_0x5c655f['where']=qs[_0x6208('0x3c')](_[_0x6208('0x44')](_0x1c2f76['query'],_0x4301ca[_0x6208('0x3c')]));if(_0x1c2f76[_0x6208('0x3a')][_0x6208('0x45')]){_0x5c655f[_0x6208('0x43')]=_[_0x6208('0x46')](_0x5c655f[_0x6208('0x43')],{'$or':_[_0x6208('0x33')](_0x5c655f[_0x6208('0x3e')],function(_0x2375da){var _0x8eae66={};_0x8eae66[_0x2375da]={'$like':'%'+_0x1c2f76[_0x6208('0x3a')][_0x6208('0x45')]+'%'};return _0x8eae66;})});}_0x5c655f=_[_0x6208('0x46')]({},_0x5c655f,_0x1c2f76[_0x6208('0x48')]);return _0x1dc52e[_0x6208('0x5a')](_0x5c655f);}})['then'](function(_0x473e13){if(_0x473e13){_0x7ba321=_0x473e13[_0x6208('0x40')];if(!_0x1c2f76['query'][_0x6208('0x57')](_0x6208('0x41'))){_0x5c655f['limit']=qs[_0x6208('0x42')](_0x1c2f76[_0x6208('0x3a')]['limit']);_0x5c655f[_0x6208('0x29')]=qs[_0x6208('0x29')](_0x1c2f76[_0x6208('0x3a')]['offset']);}return _0x1dc52e['getDescriptions'](_0x5c655f);}})['then'](function(_0x49b72d){if(_0x49b72d){return _0x49b72d?{'count':_0x7ba321,'rows':_0x49b72d}:null;}})[_0x6208('0x2e')](respondWithResult(_0x74a33d,null))['catch'](handleError(_0x74a33d,null));};exports[_0x6208('0x5b')]=function(_0x303620,_0x592954,_0x2623ae){var _0x5c5ca2={};var _0x30c391={};var _0x579bf3;var _0x2c5189;return db['FreshdeskConfiguration'][_0x6208('0x54')]({'where':{'id':_0x303620[_0x6208('0x4f')]['id']}})['then'](handleEntityNotFound(_0x592954,null))['then'](function(_0x33e1bc){if(_0x33e1bc){_0x579bf3=_0x33e1bc;_0x30c391['model']=_[_0x6208('0x3b')](db['Tag'][_0x6208('0x35')]);_0x30c391['query']=_['keys'](_0x303620[_0x6208('0x3a')]);_0x30c391[_0x6208('0x3c')]=_[_0x6208('0x3d')](_0x30c391['model'],_0x30c391[_0x6208('0x3a')]);_0x5c5ca2[_0x6208('0x3e')]=_[_0x6208('0x3d')](_0x30c391[_0x6208('0x38')],qs[_0x6208('0x3f')](_0x303620[_0x6208('0x3a')][_0x6208('0x3f')]));_0x5c5ca2['attributes']=_0x5c5ca2['attributes'][_0x6208('0x40')]?_0x5c5ca2[_0x6208('0x3e')]:_0x30c391[_0x6208('0x38')];_0x5c5ca2[_0x6208('0x55')]=qs[_0x6208('0x56')](_0x303620[_0x6208('0x3a')]['sort']);_0x5c5ca2[_0x6208('0x43')]=qs['filters'](_[_0x6208('0x44')](_0x303620[_0x6208('0x3a')],_0x30c391[_0x6208('0x3c')]));if(_0x303620[_0x6208('0x3a')][_0x6208('0x45')]){_0x5c5ca2[_0x6208('0x43')]=_[_0x6208('0x46')](_0x5c5ca2[_0x6208('0x43')],{'$or':_[_0x6208('0x33')](_0x5c5ca2['attributes'],function(_0x4e18b1){var _0x380d76={};_0x380d76[_0x4e18b1]={'$like':'%'+_0x303620[_0x6208('0x3a')][_0x6208('0x45')]+'%'};return _0x380d76;})});}_0x5c5ca2=_[_0x6208('0x46')]({},_0x5c5ca2,_0x303620['options']);return _0x579bf3[_0x6208('0x5b')](_0x5c5ca2);}})[_0x6208('0x2e')](function(_0x194e67){if(_0x194e67){_0x2c5189=_0x194e67[_0x6208('0x40')];if(!_0x303620[_0x6208('0x3a')][_0x6208('0x57')](_0x6208('0x41'))){_0x5c5ca2[_0x6208('0x42')]=qs[_0x6208('0x42')](_0x303620[_0x6208('0x3a')][_0x6208('0x42')]);_0x5c5ca2[_0x6208('0x29')]=qs[_0x6208('0x29')](_0x303620['query'][_0x6208('0x29')]);}return _0x579bf3[_0x6208('0x5b')](_0x5c5ca2);}})[_0x6208('0x2e')](function(_0x2d7f3b){if(_0x2d7f3b){return _0x2d7f3b?{'count':_0x2c5189,'rows':_0x2d7f3b}:null;}})[_0x6208('0x2e')](respondWithResult(_0x592954,null))[_0x6208('0x25')](handleError(_0x592954,null));};exports[_0x6208('0x5c')]=function(_0x1ab759,_0x3483ff,_0x175c92){if(_0x1ab759[_0x6208('0x52')]['id']){delete _0x1ab759[_0x6208('0x52')]['id'];}return db[_0x6208('0x34')][_0x6208('0x54')]({'where':{'id':_0x1ab759[_0x6208('0x4f')]['id']}})[_0x6208('0x2e')](handleEntityNotFound(_0x3483ff,null))[_0x6208('0x2e')](function(_0x2de53e){if(_0x2de53e){return _0x2de53e[_0x6208('0x5c')](_0x1ab759[_0x6208('0x52')]['ids']||[]);}return null;})['then'](respondWithResult(_0x3483ff,null))[_0x6208('0x25')](handleError(_0x3483ff,null));}; \ No newline at end of file +var _0x15ff=['include','show','params','rawAttributes','create','body','find','getFields','findOne','FreshdeskField','order','filter','getSubjects','getDescriptions','pick','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../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~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','end','count','offset','status','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','FreshdeskConfiguration','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','options','includeAll'];(function(_0x5a0751,_0xaebaaf){var _0x2d7663=function(_0x51845f){while(--_0x51845f){_0x5a0751['push'](_0x5a0751['shift']());}};_0x2d7663(++_0xaebaaf);}(_0x15ff,0x74));var _0xf15f=function(_0xcd5ff6,_0xafb336){_0xcd5ff6=_0xcd5ff6-0x0;var _0x55f6b1=_0x15ff[_0xcd5ff6];return _0x55f6b1;};'use strict';var pdf=require(_0xf15f('0x0'));var emlformat=require(_0xf15f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf15f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf15f('0x3'));var moment=require(_0xf15f('0x4'));var BPromise=require(_0xf15f('0x5'));var Mustache=require(_0xf15f('0x6'));var util=require(_0xf15f('0x7'));var path=require(_0xf15f('0x8'));var sox=require('sox');var csv=require(_0xf15f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf15f('0xa'));var squel=require(_0xf15f('0xb'));var crypto=require(_0xf15f('0xc'));var jsforce=require(_0xf15f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf15f('0x9'));var querystring=require(_0xf15f('0xe'));var Papa=require(_0xf15f('0xf'));var Redis=require('ioredis');var authService=require(_0xf15f('0x10'));var qs=require(_0xf15f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15f('0x12'));var logger=require(_0xf15f('0x13'))(_0xf15f('0x14'));var utils=require(_0xf15f('0x15'));var config=require(_0xf15f('0x16'));var db=require(_0xf15f('0x17'))['db'];var jayson=require(_0xf15f('0x18'));var client=jayson[_0xf15f('0x19')][_0xf15f('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x35767b,_0x3b5ea8,_0x3e47c5){if(_0x3e47c5){var _0x135111=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x135111[_0xf15f('0x1b')](_0x3b5ea8)){return _0x35767b;}else{throw new db[(_0xf15f('0x1c'))][(_0xf15f('0x1d'))](_0xf15f('0x1e'));}}else{return _0x35767b;}}function respondWithRpcPromise(_0x855fd4,_0x37cb43,_0x5331ff,_0x5f4479){return new BPromise(function(_0x34dd78,_0x3eb071){var _0x4b6eb8=_0x5f4479||client;return _0x4b6eb8['request'](_0x855fd4,_0x5331ff)[_0xf15f('0x1f')](function(_0x54c173){logger[_0xf15f('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x37cb43,_0xf15f('0x21'));logger[_0xf15f('0x22')](_0xf15f('0x23'),_0x37cb43,_0xf15f('0x21'),JSON[_0xf15f('0x24')](_0x54c173));if(_0x54c173[_0xf15f('0x25')]){if(_0x54c173[_0xf15f('0x25')]['code']===0x1f4){logger['error'](_0xf15f('0x26'),_0x37cb43,_0x54c173[_0xf15f('0x25')][_0xf15f('0x27')]);return _0x3eb071(_0x54c173[_0xf15f('0x25')][_0xf15f('0x27')]);}logger[_0xf15f('0x25')](_0xf15f('0x26'),_0x37cb43,_0x54c173['error'][_0xf15f('0x27')]);return _0x34dd78(_0x54c173[_0xf15f('0x25')][_0xf15f('0x27')]);}else{logger[_0xf15f('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x37cb43,_0xf15f('0x21'));_0x34dd78(_0x54c173[_0xf15f('0x28')]['message']);}})[_0xf15f('0x29')](function(_0x1cb871){logger[_0xf15f('0x25')](_0xf15f('0x26'),_0x37cb43,_0x1cb871);_0x3eb071(_0x1cb871);});});}function respondWithStatusCode(_0xe060d0,_0x506cd6){_0x506cd6=_0x506cd6||0xcc;return function(_0x5201b6){if(_0x5201b6){return _0xe060d0['sendStatus'](_0x506cd6);}return _0xe060d0['status'](_0x506cd6)[_0xf15f('0x2a')]();};}function respondWithResult(_0x34021d,_0x2dbee1){_0x2dbee1=_0x2dbee1||0xc8;return function(_0x24b92d){if(_0x24b92d){return _0x34021d['status'](_0x2dbee1)['json'](_0x24b92d);}};}function respondWithFilteredResult(_0x36c6ee,_0x22d065){return function(_0x46136e){if(_0x46136e){var _0x1b7dd6=_0x46136e[_0xf15f('0x2b')],_0x1bd85d=_0x22d065[_0xf15f('0x2c')],_0x20b41b=_0x22d065['offset']+_0x22d065['limit'],_0x3bd730;if(_0x20b41b>=_0x1b7dd6){_0x20b41b=_0x1b7dd6;_0x3bd730=0xc8;}else{_0x3bd730=0xce;}_0x36c6ee[_0xf15f('0x2d')](_0x3bd730);return _0x36c6ee['set'](_0xf15f('0x2e'),_0x1bd85d+'-'+_0x20b41b+'/'+_0x1b7dd6)['json'](_0x46136e);}return null;};}function patchUpdates(_0x3123ec){return function(_0x6a658c){try{jsonpatch[_0xf15f('0x2f')](_0x6a658c,_0x3123ec,!![]);}catch(_0x152492){return BPromise[_0xf15f('0x30')](_0x152492);}return _0x6a658c[_0xf15f('0x31')]();};}function saveUpdates(_0x971bc6,_0x45b73d){return function(_0x26d863){if(_0x26d863){return _0x26d863[_0xf15f('0x32')](_0x971bc6)[_0xf15f('0x1f')](function(_0x2bcc43){return _0x2bcc43;});}return null;};}function removeEntity(_0x50e182,_0x5a6c6e){return function(_0x580245){if(_0x580245){return _0x580245[_0xf15f('0x33')]()[_0xf15f('0x1f')](function(){_0x50e182['status'](0xcc)[_0xf15f('0x2a')]();});}};}function handleEntityNotFound(_0x2c3366,_0x219ab7){return function(_0xd58a1f){if(!_0xd58a1f){_0x2c3366[_0xf15f('0x34')](0x194);}return _0xd58a1f;};}function handleError(_0x1bc0f1,_0x16a384){_0x16a384=_0x16a384||0x1f4;return function(_0x183fc8){logger[_0xf15f('0x25')](_0x183fc8[_0xf15f('0x35')]);if(_0x183fc8[_0xf15f('0x36')]){delete _0x183fc8[_0xf15f('0x36')];}_0x1bc0f1[_0xf15f('0x2d')](_0x16a384)[_0xf15f('0x37')](_0x183fc8);};}exports[_0xf15f('0x38')]=function(_0xcb5d06,_0xc7894e){var _0x32ad55={},_0x557e94={},_0x4847de={'count':0x0,'rows':[]};var _0x5952b1=_[_0xf15f('0x39')](db[_0xf15f('0x3a')]['rawAttributes'],function(_0x1b4074){return{'name':_0x1b4074['fieldName'],'type':_0x1b4074[_0xf15f('0x3b')][_0xf15f('0x3c')]};});_0x557e94[_0xf15f('0x3d')]=_[_0xf15f('0x39')](_0x5952b1,_0xf15f('0x36'));_0x557e94[_0xf15f('0x3e')]=_[_0xf15f('0x3f')](_0xcb5d06[_0xf15f('0x3e')]);_0x557e94[_0xf15f('0x40')]=_[_0xf15f('0x41')](_0x557e94[_0xf15f('0x3d')],_0x557e94[_0xf15f('0x3e')]);_0x32ad55[_0xf15f('0x42')]=_[_0xf15f('0x41')](_0x557e94[_0xf15f('0x3d')],qs[_0xf15f('0x43')](_0xcb5d06[_0xf15f('0x3e')]['fields']));_0x32ad55[_0xf15f('0x42')]=_0x32ad55[_0xf15f('0x42')][_0xf15f('0x44')]?_0x32ad55[_0xf15f('0x42')]:_0x557e94[_0xf15f('0x3d')];if(!_0xcb5d06[_0xf15f('0x3e')][_0xf15f('0x45')](_0xf15f('0x46'))){_0x32ad55[_0xf15f('0x47')]=qs[_0xf15f('0x47')](_0xcb5d06[_0xf15f('0x3e')][_0xf15f('0x47')]);_0x32ad55[_0xf15f('0x2c')]=qs[_0xf15f('0x2c')](_0xcb5d06['query'][_0xf15f('0x2c')]);}_0x32ad55['order']=qs[_0xf15f('0x48')](_0xcb5d06[_0xf15f('0x3e')][_0xf15f('0x48')]);_0x32ad55[_0xf15f('0x49')]=qs[_0xf15f('0x40')](_['pick'](_0xcb5d06['query'],_0x557e94['filters']),_0x5952b1);if(_0xcb5d06[_0xf15f('0x3e')]['filter']){_0x32ad55[_0xf15f('0x49')]=_[_0xf15f('0x4a')](_0x32ad55['where'],{'$or':_[_0xf15f('0x39')](_0x5952b1,function(_0x352ce9){if(_0x352ce9[_0xf15f('0x3b')]!==_0xf15f('0x4b')){var _0x1eec10={};_0x1eec10[_0x352ce9[_0xf15f('0x36')]]={'$like':'%'+_0xcb5d06[_0xf15f('0x3e')]['filter']+'%'};return _0x1eec10;}})});}_0x32ad55=_[_0xf15f('0x4a')]({},_0x32ad55,_0xcb5d06[_0xf15f('0x4c')]);var _0x58a21d={'where':_0x32ad55[_0xf15f('0x49')]};return db['FreshdeskConfiguration']['count'](_0x58a21d)[_0xf15f('0x1f')](function(_0x5a3c98){_0x4847de['count']=_0x5a3c98;if(_0xcb5d06[_0xf15f('0x3e')][_0xf15f('0x4d')]){_0x32ad55[_0xf15f('0x4e')]=[{'all':!![]}];}return db[_0xf15f('0x3a')]['findAll'](_0x32ad55);})[_0xf15f('0x1f')](function(_0x2a2c16){_0x4847de['rows']=_0x2a2c16;return _0x4847de;})[_0xf15f('0x1f')](respondWithFilteredResult(_0xc7894e,_0x32ad55))['catch'](handleError(_0xc7894e,null));};exports[_0xf15f('0x4f')]=function(_0x3aa0be,_0x2150bf){var _0x684d95={'raw':![],'where':{'id':_0x3aa0be[_0xf15f('0x50')]['id']}},_0x295ec1={};_0x295ec1[_0xf15f('0x3d')]=_[_0xf15f('0x3f')](db[_0xf15f('0x3a')][_0xf15f('0x51')]);_0x295ec1[_0xf15f('0x3e')]=_[_0xf15f('0x3f')](_0x3aa0be[_0xf15f('0x3e')]);_0x295ec1[_0xf15f('0x40')]=_[_0xf15f('0x41')](_0x295ec1['model'],_0x295ec1['query']);_0x684d95['attributes']=_[_0xf15f('0x41')](_0x295ec1[_0xf15f('0x3d')],qs[_0xf15f('0x43')](_0x3aa0be[_0xf15f('0x3e')][_0xf15f('0x43')]));_0x684d95['attributes']=_0x684d95[_0xf15f('0x42')]['length']?_0x684d95[_0xf15f('0x42')]:_0x295ec1['model'];if(_0x3aa0be['query'][_0xf15f('0x4d')]){_0x684d95['include']=[{'all':!![]}];}_0x684d95=_[_0xf15f('0x4a')]({},_0x684d95,_0x3aa0be['options']);return db['FreshdeskConfiguration']['find'](_0x684d95)[_0xf15f('0x1f')](handleEntityNotFound(_0x2150bf,null))[_0xf15f('0x1f')](respondWithResult(_0x2150bf,null))[_0xf15f('0x29')](handleError(_0x2150bf,null));};exports[_0xf15f('0x52')]=function(_0x5a259c,_0x38720d){return db[_0xf15f('0x3a')][_0xf15f('0x52')](_0x5a259c[_0xf15f('0x53')],{})[_0xf15f('0x1f')](respondWithResult(_0x38720d,0xc9))['catch'](handleError(_0x38720d,null));};exports[_0xf15f('0x32')]=function(_0x17f802,_0x5c9815){if(_0x17f802[_0xf15f('0x53')]['id']){delete _0x17f802[_0xf15f('0x53')]['id'];}return db['FreshdeskConfiguration'][_0xf15f('0x54')]({'where':{'id':_0x17f802['params']['id']}})['then'](handleEntityNotFound(_0x5c9815,null))[_0xf15f('0x1f')](saveUpdates(_0x17f802[_0xf15f('0x53')],null))[_0xf15f('0x1f')](respondWithResult(_0x5c9815,null))['catch'](handleError(_0x5c9815,null));};exports['destroy']=function(_0x5eb3f2,_0x2a13ee){return db[_0xf15f('0x3a')][_0xf15f('0x54')]({'where':{'id':_0x5eb3f2[_0xf15f('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a13ee,null))[_0xf15f('0x1f')](removeEntity(_0x2a13ee,null))[_0xf15f('0x29')](handleError(_0x2a13ee,null));};exports[_0xf15f('0x55')]=function(_0x3b4c54,_0x39c424,_0x57fa58){var _0x1418f9={};var _0x31e3eb={};var _0x499550;var _0x561c53;return db[_0xf15f('0x3a')][_0xf15f('0x56')]({'where':{'id':_0x3b4c54[_0xf15f('0x50')]['id']}})['then'](handleEntityNotFound(_0x39c424,null))[_0xf15f('0x1f')](function(_0x4fc144){if(_0x4fc144){_0x499550=_0x4fc144;_0x31e3eb['model']=_[_0xf15f('0x3f')](db[_0xf15f('0x57')][_0xf15f('0x51')]);_0x31e3eb[_0xf15f('0x3e')]=_[_0xf15f('0x3f')](_0x3b4c54[_0xf15f('0x3e')]);_0x31e3eb[_0xf15f('0x40')]=_['intersection'](_0x31e3eb['model'],_0x31e3eb[_0xf15f('0x3e')]);_0x1418f9[_0xf15f('0x42')]=_[_0xf15f('0x41')](_0x31e3eb[_0xf15f('0x3d')],qs[_0xf15f('0x43')](_0x3b4c54[_0xf15f('0x3e')][_0xf15f('0x43')]));_0x1418f9[_0xf15f('0x42')]=_0x1418f9[_0xf15f('0x42')][_0xf15f('0x44')]?_0x1418f9['attributes']:_0x31e3eb[_0xf15f('0x3d')];_0x1418f9[_0xf15f('0x58')]=qs[_0xf15f('0x48')](_0x3b4c54[_0xf15f('0x3e')]['sort']);_0x1418f9[_0xf15f('0x49')]=qs['filters'](_['pick'](_0x3b4c54[_0xf15f('0x3e')],_0x31e3eb['filters']));if(_0x3b4c54['query'][_0xf15f('0x59')]){_0x1418f9[_0xf15f('0x49')]=_[_0xf15f('0x4a')](_0x1418f9[_0xf15f('0x49')],{'$or':_[_0xf15f('0x39')](_0x1418f9['attributes'],function(_0x18b182){var _0x1b0793={};_0x1b0793[_0x18b182]={'$like':'%'+_0x3b4c54[_0xf15f('0x3e')][_0xf15f('0x59')]+'%'};return _0x1b0793;})});}_0x1418f9=_[_0xf15f('0x4a')]({},_0x1418f9,_0x3b4c54[_0xf15f('0x4c')]);return _0x499550[_0xf15f('0x55')](_0x1418f9);}})[_0xf15f('0x1f')](function(_0x5ec013){if(_0x5ec013){_0x561c53=_0x5ec013[_0xf15f('0x44')];if(!_0x3b4c54[_0xf15f('0x3e')][_0xf15f('0x45')](_0xf15f('0x46'))){_0x1418f9[_0xf15f('0x47')]=qs[_0xf15f('0x47')](_0x3b4c54[_0xf15f('0x3e')][_0xf15f('0x47')]);_0x1418f9[_0xf15f('0x2c')]=qs['offset'](_0x3b4c54[_0xf15f('0x3e')][_0xf15f('0x2c')]);}return _0x499550['getFields'](_0x1418f9);}})[_0xf15f('0x1f')](function(_0x335b6e){if(_0x335b6e){return _0x335b6e?{'count':_0x561c53,'rows':_0x335b6e}:null;}})[_0xf15f('0x1f')](respondWithResult(_0x39c424,null))['catch'](handleError(_0x39c424,null));};exports[_0xf15f('0x5a')]=function(_0x116d6c,_0x2f59e6,_0x12f08a){var _0x7eda08={};var _0x2030c0={};var _0x2bbdfb;var _0x4b0c77;return db[_0xf15f('0x3a')]['findOne']({'where':{'id':_0x116d6c[_0xf15f('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f59e6,null))['then'](function(_0x5c0233){if(_0x5c0233){_0x2bbdfb=_0x5c0233;_0x2030c0[_0xf15f('0x3d')]=_[_0xf15f('0x3f')](db[_0xf15f('0x57')]['rawAttributes']);_0x2030c0[_0xf15f('0x3e')]=_[_0xf15f('0x3f')](_0x116d6c['query']);_0x2030c0[_0xf15f('0x40')]=_[_0xf15f('0x41')](_0x2030c0[_0xf15f('0x3d')],_0x2030c0[_0xf15f('0x3e')]);_0x7eda08[_0xf15f('0x42')]=_['intersection'](_0x2030c0[_0xf15f('0x3d')],qs[_0xf15f('0x43')](_0x116d6c[_0xf15f('0x3e')][_0xf15f('0x43')]));_0x7eda08[_0xf15f('0x42')]=_0x7eda08[_0xf15f('0x42')][_0xf15f('0x44')]?_0x7eda08[_0xf15f('0x42')]:_0x2030c0[_0xf15f('0x3d')];_0x7eda08['order']=qs[_0xf15f('0x48')](_0x116d6c['query'][_0xf15f('0x48')]);_0x7eda08[_0xf15f('0x49')]=qs[_0xf15f('0x40')](_['pick'](_0x116d6c['query'],_0x2030c0[_0xf15f('0x40')]));if(_0x116d6c[_0xf15f('0x3e')]['filter']){_0x7eda08[_0xf15f('0x49')]=_[_0xf15f('0x4a')](_0x7eda08[_0xf15f('0x49')],{'$or':_[_0xf15f('0x39')](_0x7eda08['attributes'],function(_0x26a8a6){var _0x5b2a07={};_0x5b2a07[_0x26a8a6]={'$like':'%'+_0x116d6c[_0xf15f('0x3e')][_0xf15f('0x59')]+'%'};return _0x5b2a07;})});}_0x7eda08=_[_0xf15f('0x4a')]({},_0x7eda08,_0x116d6c[_0xf15f('0x4c')]);return _0x2bbdfb[_0xf15f('0x5a')](_0x7eda08);}})['then'](function(_0x35657f){if(_0x35657f){_0x4b0c77=_0x35657f['length'];if(!_0x116d6c[_0xf15f('0x3e')]['hasOwnProperty'](_0xf15f('0x46'))){_0x7eda08[_0xf15f('0x47')]=qs[_0xf15f('0x47')](_0x116d6c[_0xf15f('0x3e')][_0xf15f('0x47')]);_0x7eda08[_0xf15f('0x2c')]=qs[_0xf15f('0x2c')](_0x116d6c[_0xf15f('0x3e')][_0xf15f('0x2c')]);}return _0x2bbdfb[_0xf15f('0x5a')](_0x7eda08);}})['then'](function(_0x3092ef){if(_0x3092ef){return _0x3092ef?{'count':_0x4b0c77,'rows':_0x3092ef}:null;}})['then'](respondWithResult(_0x2f59e6,null))['catch'](handleError(_0x2f59e6,null));};exports[_0xf15f('0x5b')]=function(_0x6541e5,_0x2d5082,_0xe031aa){var _0x12a724={};var _0x353334={};var _0x1656d7;var _0x4f8793;return db['FreshdeskConfiguration'][_0xf15f('0x56')]({'where':{'id':_0x6541e5[_0xf15f('0x50')]['id']}})[_0xf15f('0x1f')](handleEntityNotFound(_0x2d5082,null))['then'](function(_0x2e877b){if(_0x2e877b){_0x1656d7=_0x2e877b;_0x353334[_0xf15f('0x3d')]=_['keys'](db[_0xf15f('0x57')][_0xf15f('0x51')]);_0x353334[_0xf15f('0x3e')]=_[_0xf15f('0x3f')](_0x6541e5[_0xf15f('0x3e')]);_0x353334[_0xf15f('0x40')]=_[_0xf15f('0x41')](_0x353334['model'],_0x353334[_0xf15f('0x3e')]);_0x12a724[_0xf15f('0x42')]=_['intersection'](_0x353334['model'],qs['fields'](_0x6541e5[_0xf15f('0x3e')][_0xf15f('0x43')]));_0x12a724[_0xf15f('0x42')]=_0x12a724[_0xf15f('0x42')]['length']?_0x12a724[_0xf15f('0x42')]:_0x353334[_0xf15f('0x3d')];_0x12a724[_0xf15f('0x58')]=qs[_0xf15f('0x48')](_0x6541e5[_0xf15f('0x3e')]['sort']);_0x12a724[_0xf15f('0x49')]=qs['filters'](_[_0xf15f('0x5c')](_0x6541e5[_0xf15f('0x3e')],_0x353334[_0xf15f('0x40')]));if(_0x6541e5[_0xf15f('0x3e')][_0xf15f('0x59')]){_0x12a724['where']=_['merge'](_0x12a724[_0xf15f('0x49')],{'$or':_[_0xf15f('0x39')](_0x12a724[_0xf15f('0x42')],function(_0x2de89d){var _0x3f390a={};_0x3f390a[_0x2de89d]={'$like':'%'+_0x6541e5[_0xf15f('0x3e')][_0xf15f('0x59')]+'%'};return _0x3f390a;})});}_0x12a724=_['merge']({},_0x12a724,_0x6541e5['options']);return _0x1656d7[_0xf15f('0x5b')](_0x12a724);}})[_0xf15f('0x1f')](function(_0x4da982){if(_0x4da982){_0x4f8793=_0x4da982['length'];if(!_0x6541e5[_0xf15f('0x3e')][_0xf15f('0x45')](_0xf15f('0x46'))){_0x12a724['limit']=qs['limit'](_0x6541e5[_0xf15f('0x3e')]['limit']);_0x12a724['offset']=qs[_0xf15f('0x2c')](_0x6541e5['query'][_0xf15f('0x2c')]);}return _0x1656d7[_0xf15f('0x5b')](_0x12a724);}})[_0xf15f('0x1f')](function(_0x347189){if(_0x347189){return _0x347189?{'count':_0x4f8793,'rows':_0x347189}:null;}})[_0xf15f('0x1f')](respondWithResult(_0x2d5082,null))[_0xf15f('0x29')](handleError(_0x2d5082,null));};exports[_0xf15f('0x5d')]=function(_0x512c7b,_0x3c965e,_0x25ba9c){var _0x31e8ad={};var _0x2e5443={};var _0x1b885b;var _0x36fb1f;return db[_0xf15f('0x3a')][_0xf15f('0x56')]({'where':{'id':_0x512c7b[_0xf15f('0x50')]['id']}})[_0xf15f('0x1f')](handleEntityNotFound(_0x3c965e,null))[_0xf15f('0x1f')](function(_0x25779e){if(_0x25779e){_0x1b885b=_0x25779e;_0x2e5443[_0xf15f('0x3d')]=_[_0xf15f('0x3f')](db[_0xf15f('0x5e')][_0xf15f('0x51')]);_0x2e5443['query']=_[_0xf15f('0x3f')](_0x512c7b[_0xf15f('0x3e')]);_0x2e5443[_0xf15f('0x40')]=_[_0xf15f('0x41')](_0x2e5443[_0xf15f('0x3d')],_0x2e5443[_0xf15f('0x3e')]);_0x31e8ad['attributes']=_[_0xf15f('0x41')](_0x2e5443[_0xf15f('0x3d')],qs[_0xf15f('0x43')](_0x512c7b['query'][_0xf15f('0x43')]));_0x31e8ad[_0xf15f('0x42')]=_0x31e8ad[_0xf15f('0x42')][_0xf15f('0x44')]?_0x31e8ad[_0xf15f('0x42')]:_0x2e5443[_0xf15f('0x3d')];_0x31e8ad[_0xf15f('0x58')]=qs[_0xf15f('0x48')](_0x512c7b[_0xf15f('0x3e')]['sort']);_0x31e8ad['where']=qs[_0xf15f('0x40')](_[_0xf15f('0x5c')](_0x512c7b[_0xf15f('0x3e')],_0x2e5443['filters']));if(_0x512c7b[_0xf15f('0x3e')][_0xf15f('0x59')]){_0x31e8ad[_0xf15f('0x49')]=_[_0xf15f('0x4a')](_0x31e8ad[_0xf15f('0x49')],{'$or':_[_0xf15f('0x39')](_0x31e8ad['attributes'],function(_0x17ea07){var _0x16f104={};_0x16f104[_0x17ea07]={'$like':'%'+_0x512c7b[_0xf15f('0x3e')][_0xf15f('0x59')]+'%'};return _0x16f104;})});}_0x31e8ad=_[_0xf15f('0x4a')]({},_0x31e8ad,_0x512c7b[_0xf15f('0x4c')]);return _0x1b885b[_0xf15f('0x5d')](_0x31e8ad);}})[_0xf15f('0x1f')](function(_0x5cc9fc){if(_0x5cc9fc){_0x36fb1f=_0x5cc9fc[_0xf15f('0x44')];if(!_0x512c7b[_0xf15f('0x3e')][_0xf15f('0x45')](_0xf15f('0x46'))){_0x31e8ad[_0xf15f('0x47')]=qs['limit'](_0x512c7b[_0xf15f('0x3e')][_0xf15f('0x47')]);_0x31e8ad['offset']=qs['offset'](_0x512c7b['query']['offset']);}return _0x1b885b[_0xf15f('0x5d')](_0x31e8ad);}})[_0xf15f('0x1f')](function(_0x17e6c3){if(_0x17e6c3){return _0x17e6c3?{'count':_0x36fb1f,'rows':_0x17e6c3}:null;}})[_0xf15f('0x1f')](respondWithResult(_0x3c965e,null))[_0xf15f('0x29')](handleError(_0x3c965e,null));};exports[_0xf15f('0x5f')]=function(_0x5ebd9c,_0x1c39e0,_0x530139){if(_0x5ebd9c['body']['id']){delete _0x5ebd9c['body']['id'];}return db['FreshdeskConfiguration'][_0xf15f('0x56')]({'where':{'id':_0x5ebd9c[_0xf15f('0x50')]['id']}})[_0xf15f('0x1f')](handleEntityNotFound(_0x1c39e0,null))[_0xf15f('0x1f')](function(_0x430cd6){if(_0x430cd6){return _0x430cd6['setTags'](_0x5ebd9c[_0xf15f('0x53')][_0xf15f('0x60')]||[]);}return null;})[_0xf15f('0x1f')](respondWithResult(_0x1c39e0,null))[_0xf15f('0x29')](handleError(_0x1c39e0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index c59907d..f53f6a8 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x4fda14,_0x6ab4cb){var _0x570673=function(_0x13adc6){while(--_0x13adc6){_0x4fda14['push'](_0x4fda14['shift']());}};_0x570673(++_0x6ab4cb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x24f86c,_0x1e2cf2){_0x24f86c=_0x24f86c-0x0;var _0x2b58c4=_0x8ef6[_0x24f86c];return _0x2b58c4;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0x7217,0x19e));var _0x7721=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7217[_0x45e98e];return _0x374dba;};'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':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 36e98f2..759126c 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 _0xdd9c=['request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x12bb55,_0xd955e2){var _0x29ab1d=function(_0x49a56f){while(--_0x49a56f){_0x12bb55['push'](_0x12bb55['shift']());}};_0x29ab1d(++_0xd955e2);}(_0xdd9c,0x198));var _0xcdd9=function(_0x589c7f,_0x261d01){_0x589c7f=_0x589c7f-0x0;var _0xb37277=_0xdd9c[_0x589c7f];return _0xb37277;};'use strict';var _=require(_0xcdd9('0x0'));var util=require(_0xcdd9('0x1'));var moment=require(_0xcdd9('0x2'));var BPromise=require(_0xcdd9('0x3'));var rs=require(_0xcdd9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdd9('0x5'))['db'];var utils=require(_0xcdd9('0x6'));var logger=require(_0xcdd9('0x7'))(_0xcdd9('0x8'));var config=require('../../config/environment');var jayson=require(_0xcdd9('0x9'));var client=jayson[_0xcdd9('0xa')][_0xcdd9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x594435,_0x1a8d4f,_0x2c0cef){return new BPromise(function(_0x2aec9b,_0x1384af){return client[_0xcdd9('0xc')](_0x594435,_0x2c0cef)[_0xcdd9('0xd')](function(_0x161567){logger[_0xcdd9('0xe')](_0xcdd9('0xf'),_0x1a8d4f,'request\x20sent');logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1a8d4f,'request\x20sent',JSON['stringify'](_0x161567));if(_0x161567[_0xcdd9('0x10')]){if(_0x161567[_0xcdd9('0x10')]['code']===0x1f4){logger[_0xcdd9('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1a8d4f,_0x161567['error'][_0xcdd9('0x11')]);return _0x1384af(_0x161567['error']['message']);}logger[_0xcdd9('0x10')](_0xcdd9('0xf'),_0x1a8d4f,_0x161567[_0xcdd9('0x10')][_0xcdd9('0x11')]);return _0x2aec9b(_0x161567['error'][_0xcdd9('0x11')]);}else{logger[_0xcdd9('0xe')](_0xcdd9('0xf'),_0x1a8d4f,_0xcdd9('0x12'));_0x2aec9b(_0x161567[_0xcdd9('0x13')][_0xcdd9('0x11')]);}})[_0xcdd9('0x14')](function(_0x45a370){logger[_0xcdd9('0x10')](_0xcdd9('0xf'),_0x1a8d4f,_0x45a370);_0x1384af(_0x45a370);});});} \ No newline at end of file +var _0xf5d8=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x26793a,_0x49cf51){var _0x575efb=function(_0x2f4db7){while(--_0x2f4db7){_0x26793a['push'](_0x26793a['shift']());}};_0x575efb(++_0x49cf51);}(_0xf5d8,0xac));var _0x8f5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8f5d('0x0'));var util=require(_0x8f5d('0x1'));var moment=require(_0x8f5d('0x2'));var BPromise=require(_0x8f5d('0x3'));var rs=require(_0x8f5d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f5d('0x5'))['db'];var utils=require(_0x8f5d('0x6'));var logger=require(_0x8f5d('0x7'))(_0x8f5d('0x8'));var config=require(_0x8f5d('0x9'));var jayson=require(_0x8f5d('0xa'));var client=jayson[_0x8f5d('0xb')][_0x8f5d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2bc40e,_0x146cd4,_0xa20e9c){return new BPromise(function(_0x2c963b,_0x10b12d){return client['request'](_0x2bc40e,_0xa20e9c)[_0x8f5d('0xd')](function(_0x17a751){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x146cd4,_0x8f5d('0xe'));logger[_0x8f5d('0xf')](_0x8f5d('0x10'),_0x146cd4,_0x8f5d('0xe'),JSON[_0x8f5d('0x11')](_0x17a751));if(_0x17a751[_0x8f5d('0x12')]){if(_0x17a751['error']['code']===0x1f4){logger[_0x8f5d('0x12')](_0x8f5d('0x13'),_0x146cd4,_0x17a751[_0x8f5d('0x12')][_0x8f5d('0x14')]);return _0x10b12d(_0x17a751[_0x8f5d('0x12')][_0x8f5d('0x14')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x146cd4,_0x17a751[_0x8f5d('0x12')][_0x8f5d('0x14')]);return _0x2c963b(_0x17a751[_0x8f5d('0x12')][_0x8f5d('0x14')]);}else{logger[_0x8f5d('0x15')](_0x8f5d('0x13'),_0x146cd4,_0x8f5d('0xe'));_0x2c963b(_0x17a751[_0x8f5d('0x16')]['message']);}})[_0x8f5d('0x17')](function(_0x565f54){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x146cd4,_0x565f54);_0x10b12d(_0x565f54);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index aabdea7..e151991 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 _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xcb91[_0x3b0731];return _0x4204d7;};'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('./intFreshdeskField.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x34e8,0x12c));var _0x834e=function(_0x386f29,_0x2753ce){_0x386f29=_0x386f29-0x0;var _0x211c8d=_0x34e8[_0x386f29];return _0x211c8d;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);module[_0x834e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 51a9f0d..4d2d34b 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 _0x5c71=['sequelize','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x51c291,_0xbd12c3){var _0x3893ea=function(_0x53c16d){while(--_0x53c16d){_0x51c291['push'](_0x51c291['shift']());}};_0x3893ea(++_0xbd12c3);}(_0x5c71,0x188));var _0x15c7=function(_0x24a97b,_0x2feac0){_0x24a97b=_0x24a97b-0x0;var _0x186301=_0x5c71[_0x24a97b];return _0x186301;};'use strict';var Sequelize=require(_0x15c7('0x0'));module[_0x15c7('0x1')]={'type':{'type':Sequelize[_0x15c7('0x2')](_0x15c7('0x3'),_0x15c7('0x4'),_0x15c7('0x5'),'keyValue'),'defaultValue':_0x15c7('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x15c7('0x3'),'variable',_0x15c7('0x5'))},'keyContent':{'type':Sequelize[_0x15c7('0x6')]},'idField':{'type':Sequelize[_0x15c7('0x6')]},'nameField':{'type':Sequelize[_0x15c7('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x15c7('0x6')]}}; \ No newline at end of file +var _0x8828=['customVariable','keyValue','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8828,0x1d1));var _0x8882=function(_0x5ba7f2,_0x2bf130){_0x5ba7f2=_0x5ba7f2-0x0;var _0x33d3ee=_0x8828[_0x5ba7f2];return _0x33d3ee;};'use strict';var Sequelize=require(_0x8882('0x0'));module[_0x8882('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8882('0x2'),_0x8882('0x3'),_0x8882('0x4')),'defaultValue':_0x8882('0x5')},'content':{'type':Sequelize[_0x8882('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8882('0x7')](_0x8882('0x5'),'variable',_0x8882('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8882('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8882('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 52632ed..75b29dc 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 _0x3b1d=['error','stack','name','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','intersection','options','catch','create','body','find','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','status','set','Content-Range','reject','save','then','destroy'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0x3b1d,0x172));var _0xd3b1=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x3b1d[_0x18ab2a];return _0x16dcee;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd3b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3b1('0x2'));var moment=require(_0xd3b1('0x3'));var BPromise=require(_0xd3b1('0x4'));var Mustache=require(_0xd3b1('0x5'));var util=require(_0xd3b1('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd3b1('0x7'));var squel=require(_0xd3b1('0x8'));var crypto=require(_0xd3b1('0x9'));var jsforce=require(_0xd3b1('0xa'));var deskjs=require(_0xd3b1('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd3b1('0xc'));var Papa=require('papaparse');var Redis=require(_0xd3b1('0xd'));var authService=require(_0xd3b1('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3b1('0xf'));var logger=require(_0xd3b1('0x10'))(_0xd3b1('0x11'));var utils=require(_0xd3b1('0x12'));var config=require(_0xd3b1('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7d66e4,_0x47c796){_0x47c796=_0x47c796||0xcc;return function(_0x37de16){if(_0x37de16){return _0x7d66e4[_0xd3b1('0x14')](_0x47c796);}return _0x7d66e4['status'](_0x47c796)[_0xd3b1('0x15')]();};}function respondWithResult(_0x3efe54,_0x40a462){_0x40a462=_0x40a462||0xc8;return function(_0x2e955c){if(_0x2e955c){return _0x3efe54['status'](_0x40a462)[_0xd3b1('0x16')](_0x2e955c);}};}function respondWithFilteredResult(_0x596f9d,_0x1f8500){return function(_0x44cd74){if(_0x44cd74){var _0x4e2a6f=_0x44cd74[_0xd3b1('0x17')],_0x235ba3=_0x1f8500[_0xd3b1('0x18')],_0x38e6ef=_0x1f8500[_0xd3b1('0x18')]+_0x1f8500['limit'],_0x2e2fe9;if(_0x38e6ef>=_0x4e2a6f){_0x38e6ef=_0x4e2a6f;_0x2e2fe9=0xc8;}else{_0x2e2fe9=0xce;}_0x596f9d[_0xd3b1('0x19')](_0x2e2fe9);return _0x596f9d[_0xd3b1('0x1a')](_0xd3b1('0x1b'),_0x235ba3+'-'+_0x38e6ef+'/'+_0x4e2a6f)[_0xd3b1('0x16')](_0x44cd74);}return null;};}function patchUpdates(_0x3fc755){return function(_0x2e091b){try{jsonpatch['apply'](_0x2e091b,_0x3fc755,!![]);}catch(_0x4a50e3){return BPromise[_0xd3b1('0x1c')](_0x4a50e3);}return _0x2e091b[_0xd3b1('0x1d')]();};}function saveUpdates(_0x263de1,_0x5ab1a6){return function(_0x3ba193){if(_0x3ba193){return _0x3ba193['update'](_0x263de1)[_0xd3b1('0x1e')](function(_0x512618){return _0x512618;});}return null;};}function removeEntity(_0x2cb671,_0x3b5010){return function(_0x54469a){if(_0x54469a){return _0x54469a[_0xd3b1('0x1f')]()[_0xd3b1('0x1e')](function(){_0x2cb671['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7df5,_0x598991){return function(_0x5c403b){if(!_0x5c403b){_0x4a7df5[_0xd3b1('0x14')](0x194);}return _0x5c403b;};}function handleError(_0x455939,_0x274e01){_0x274e01=_0x274e01||0x1f4;return function(_0x4197a8){logger[_0xd3b1('0x20')](_0x4197a8[_0xd3b1('0x21')]);if(_0x4197a8[_0xd3b1('0x22')]){delete _0x4197a8[_0xd3b1('0x22')];}_0x455939['status'](_0x274e01)['send'](_0x4197a8);};}exports['index']=function(_0x2ff9bb,_0x25e3e4){var _0x4cd878={},_0x442b4d={},_0x27a29c={'count':0x0,'rows':[]};var _0x5dde2b=_[_0xd3b1('0x23')](db[_0xd3b1('0x24')][_0xd3b1('0x25')],function(_0x5838fe){return{'name':_0x5838fe[_0xd3b1('0x26')],'type':_0x5838fe['type'][_0xd3b1('0x27')]};});_0x442b4d[_0xd3b1('0x28')]=_[_0xd3b1('0x23')](_0x5dde2b,_0xd3b1('0x22'));_0x442b4d[_0xd3b1('0x29')]=_[_0xd3b1('0x2a')](_0x2ff9bb[_0xd3b1('0x29')]);_0x442b4d['filters']=_['intersection'](_0x442b4d[_0xd3b1('0x28')],_0x442b4d['query']);_0x4cd878[_0xd3b1('0x2b')]=_['intersection'](_0x442b4d[_0xd3b1('0x28')],qs['fields'](_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x2c')]));_0x4cd878['attributes']=_0x4cd878[_0xd3b1('0x2b')][_0xd3b1('0x2d')]?_0x4cd878[_0xd3b1('0x2b')]:_0x442b4d[_0xd3b1('0x28')];if(!_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x2e')](_0xd3b1('0x2f'))){_0x4cd878['limit']=qs[_0xd3b1('0x30')](_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x30')]);_0x4cd878[_0xd3b1('0x18')]=qs[_0xd3b1('0x18')](_0x2ff9bb['query'][_0xd3b1('0x18')]);}_0x4cd878['order']=qs[_0xd3b1('0x31')](_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x31')]);_0x4cd878[_0xd3b1('0x32')]=qs['filters'](_['pick'](_0x2ff9bb[_0xd3b1('0x29')],_0x442b4d[_0xd3b1('0x33')]),_0x5dde2b);if(_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x34')]){_0x4cd878[_0xd3b1('0x32')]=_['merge'](_0x4cd878['where'],{'$or':_[_0xd3b1('0x23')](_0x5dde2b,function(_0xb9a4cc){if(_0xb9a4cc[_0xd3b1('0x35')]!==_0xd3b1('0x36')){var _0x1d26ae={};_0x1d26ae[_0xb9a4cc[_0xd3b1('0x22')]]={'$like':'%'+_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x34')]+'%'};return _0x1d26ae;}})});}_0x4cd878=_[_0xd3b1('0x37')]({},_0x4cd878,_0x2ff9bb['options']);var _0x16a79e={'where':_0x4cd878[_0xd3b1('0x32')]};return db[_0xd3b1('0x24')][_0xd3b1('0x17')](_0x16a79e)[_0xd3b1('0x1e')](function(_0x3dbcc0){_0x27a29c['count']=_0x3dbcc0;if(_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x38')]){_0x4cd878[_0xd3b1('0x39')]=[{'all':!![]}];}return db[_0xd3b1('0x24')][_0xd3b1('0x3a')](_0x4cd878);})[_0xd3b1('0x1e')](function(_0x218d9e){_0x27a29c[_0xd3b1('0x3b')]=_0x218d9e;return _0x27a29c;})[_0xd3b1('0x1e')](respondWithFilteredResult(_0x25e3e4,_0x4cd878))['catch'](handleError(_0x25e3e4,null));};exports['show']=function(_0xcc70f1,_0x416317){var _0x50c7f8={'raw':!![],'where':{'id':_0xcc70f1['params']['id']}},_0x4ec85a={};_0x4ec85a['model']=_['keys'](db[_0xd3b1('0x24')][_0xd3b1('0x25')]);_0x4ec85a[_0xd3b1('0x29')]=_[_0xd3b1('0x2a')](_0xcc70f1[_0xd3b1('0x29')]);_0x4ec85a['filters']=_[_0xd3b1('0x3c')](_0x4ec85a[_0xd3b1('0x28')],_0x4ec85a['query']);_0x50c7f8[_0xd3b1('0x2b')]=_[_0xd3b1('0x3c')](_0x4ec85a['model'],qs[_0xd3b1('0x2c')](_0xcc70f1[_0xd3b1('0x29')][_0xd3b1('0x2c')]));_0x50c7f8[_0xd3b1('0x2b')]=_0x50c7f8[_0xd3b1('0x2b')][_0xd3b1('0x2d')]?_0x50c7f8[_0xd3b1('0x2b')]:_0x4ec85a[_0xd3b1('0x28')];if(_0xcc70f1['query'][_0xd3b1('0x38')]){_0x50c7f8[_0xd3b1('0x39')]=[{'all':!![]}];}_0x50c7f8=_[_0xd3b1('0x37')]({},_0x50c7f8,_0xcc70f1[_0xd3b1('0x3d')]);return db['FreshdeskField']['find'](_0x50c7f8)[_0xd3b1('0x1e')](handleEntityNotFound(_0x416317,null))[_0xd3b1('0x1e')](respondWithResult(_0x416317,null))[_0xd3b1('0x3e')](handleError(_0x416317,null));};exports['create']=function(_0x4c93e9,_0x59e5c7){return db[_0xd3b1('0x24')][_0xd3b1('0x3f')](_0x4c93e9['body'],{})[_0xd3b1('0x1e')](respondWithResult(_0x59e5c7,0xc9))[_0xd3b1('0x3e')](handleError(_0x59e5c7,null));};exports['update']=function(_0x35b2f2,_0x704fd0){if(_0x35b2f2[_0xd3b1('0x40')]['id']){delete _0x35b2f2[_0xd3b1('0x40')]['id'];}return db[_0xd3b1('0x24')][_0xd3b1('0x41')]({'where':{'id':_0x35b2f2[_0xd3b1('0x42')]['id']}})[_0xd3b1('0x1e')](handleEntityNotFound(_0x704fd0,null))[_0xd3b1('0x1e')](saveUpdates(_0x35b2f2[_0xd3b1('0x40')],null))['then'](respondWithResult(_0x704fd0,null))[_0xd3b1('0x3e')](handleError(_0x704fd0,null));};exports[_0xd3b1('0x1f')]=function(_0x322689,_0x27776d){return db['FreshdeskField']['find']({'where':{'id':_0x322689[_0xd3b1('0x42')]['id']}})[_0xd3b1('0x1e')](handleEntityNotFound(_0x27776d,null))['then'](removeEntity(_0x27776d,null))[_0xd3b1('0x3e')](handleError(_0x27776d,null));}; \ No newline at end of file +var _0x1566=['VIRTUAL','merge','options','count','include','findAll','rows','catch','params','includeAll','find','create','update','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','offset','limit','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter'];(function(_0x581adf,_0x37a1e5){var _0x3788c0=function(_0x49a427){while(--_0x49a427){_0x581adf['push'](_0x581adf['shift']());}};_0x3788c0(++_0x37a1e5);}(_0x1566,0xa0));var _0x6156=function(_0x2c4f3f,_0x266947){_0x2c4f3f=_0x2c4f3f-0x0;var _0x3d0234=_0x1566[_0x2c4f3f];return _0x3d0234;};'use strict';var pdf=require(_0x6156('0x0'));var emlformat=require(_0x6156('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6156('0x2'));var jsonpatch=require(_0x6156('0x3'));var rp=require(_0x6156('0x4'));var moment=require(_0x6156('0x5'));var BPromise=require(_0x6156('0x6'));var Mustache=require(_0x6156('0x7'));var util=require(_0x6156('0x8'));var path=require(_0x6156('0x9'));var sox=require(_0x6156('0xa'));var csv=require(_0x6156('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6156('0xc'));var squel=require('squel');var crypto=require(_0x6156('0xd'));var jsforce=require(_0x6156('0xe'));var deskjs=require(_0x6156('0xf'));var toCsv=require(_0x6156('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6156('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6156('0x11'));var as=require(_0x6156('0x12'));var hardwareService=require(_0x6156('0x13'));var logger=require(_0x6156('0x14'))(_0x6156('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6156('0x16'))['db'];function respondWithStatusCode(_0x3393fe,_0x119081){_0x119081=_0x119081||0xcc;return function(_0x7ab0a7){if(_0x7ab0a7){return _0x3393fe[_0x6156('0x17')](_0x119081);}return _0x3393fe['status'](_0x119081)[_0x6156('0x18')]();};}function respondWithResult(_0x589192,_0x43ea35){_0x43ea35=_0x43ea35||0xc8;return function(_0x8ce313){if(_0x8ce313){return _0x589192[_0x6156('0x19')](_0x43ea35)['json'](_0x8ce313);}};}function respondWithFilteredResult(_0x335238,_0x3429ad){return function(_0x1bf5c0){if(_0x1bf5c0){var _0x4b2680=_0x1bf5c0['count'],_0x28d3a9=_0x3429ad[_0x6156('0x1a')],_0xb476b1=_0x3429ad[_0x6156('0x1a')]+_0x3429ad[_0x6156('0x1b')],_0xeafa31;if(_0xb476b1>=_0x4b2680){_0xb476b1=_0x4b2680;_0xeafa31=0xc8;}else{_0xeafa31=0xce;}_0x335238[_0x6156('0x19')](_0xeafa31);return _0x335238['set'](_0x6156('0x1c'),_0x28d3a9+'-'+_0xb476b1+'/'+_0x4b2680)[_0x6156('0x1d')](_0x1bf5c0);}return null;};}function patchUpdates(_0x25964c){return function(_0x41b3a6){try{jsonpatch[_0x6156('0x1e')](_0x41b3a6,_0x25964c,!![]);}catch(_0x13b385){return BPromise[_0x6156('0x1f')](_0x13b385);}return _0x41b3a6[_0x6156('0x20')]();};}function saveUpdates(_0xa02515,_0x3fe3de){return function(_0x31f965){if(_0x31f965){return _0x31f965['update'](_0xa02515)[_0x6156('0x21')](function(_0x15bfe3){return _0x15bfe3;});}return null;};}function removeEntity(_0x17572b,_0x45addf){return function(_0x5aa419){if(_0x5aa419){return _0x5aa419[_0x6156('0x22')]()[_0x6156('0x21')](function(){_0x17572b[_0x6156('0x19')](0xcc)[_0x6156('0x18')]();});}};}function handleEntityNotFound(_0x1858e7,_0x8faae5){return function(_0x12b6c9){if(!_0x12b6c9){_0x1858e7[_0x6156('0x17')](0x194);}return _0x12b6c9;};}function handleError(_0x3c4895,_0x3c1dc5){_0x3c1dc5=_0x3c1dc5||0x1f4;return function(_0x91207b){logger[_0x6156('0x23')](_0x91207b['stack']);if(_0x91207b[_0x6156('0x24')]){delete _0x91207b[_0x6156('0x24')];}_0x3c4895[_0x6156('0x19')](_0x3c1dc5)[_0x6156('0x25')](_0x91207b);};}exports[_0x6156('0x26')]=function(_0xdd2541,_0x420e85){var _0x11af94={},_0x160a98={},_0x261b2d={'count':0x0,'rows':[]};var _0x4c05be=_[_0x6156('0x27')](db[_0x6156('0x28')][_0x6156('0x29')],function(_0x43f90e){return{'name':_0x43f90e[_0x6156('0x2a')],'type':_0x43f90e[_0x6156('0x2b')][_0x6156('0x2c')]};});_0x160a98[_0x6156('0x2d')]=_[_0x6156('0x27')](_0x4c05be,_0x6156('0x24'));_0x160a98[_0x6156('0x2e')]=_[_0x6156('0x2f')](_0xdd2541[_0x6156('0x2e')]);_0x160a98[_0x6156('0x30')]=_[_0x6156('0x31')](_0x160a98['model'],_0x160a98[_0x6156('0x2e')]);_0x11af94['attributes']=_[_0x6156('0x31')](_0x160a98['model'],qs[_0x6156('0x32')](_0xdd2541['query'][_0x6156('0x32')]));_0x11af94[_0x6156('0x33')]=_0x11af94[_0x6156('0x33')][_0x6156('0x34')]?_0x11af94['attributes']:_0x160a98[_0x6156('0x2d')];if(!_0xdd2541['query'][_0x6156('0x35')](_0x6156('0x36'))){_0x11af94[_0x6156('0x1b')]=qs[_0x6156('0x1b')](_0xdd2541['query'][_0x6156('0x1b')]);_0x11af94[_0x6156('0x1a')]=qs[_0x6156('0x1a')](_0xdd2541[_0x6156('0x2e')]['offset']);}_0x11af94[_0x6156('0x37')]=qs['sort'](_0xdd2541[_0x6156('0x2e')]['sort']);_0x11af94[_0x6156('0x38')]=qs[_0x6156('0x30')](_[_0x6156('0x39')](_0xdd2541[_0x6156('0x2e')],_0x160a98['filters']),_0x4c05be);if(_0xdd2541[_0x6156('0x2e')][_0x6156('0x3a')]){_0x11af94[_0x6156('0x38')]=_['merge'](_0x11af94[_0x6156('0x38')],{'$or':_[_0x6156('0x27')](_0x4c05be,function(_0xd8be52){if(_0xd8be52[_0x6156('0x2b')]!==_0x6156('0x3b')){var _0x250e10={};_0x250e10[_0xd8be52[_0x6156('0x24')]]={'$like':'%'+_0xdd2541[_0x6156('0x2e')][_0x6156('0x3a')]+'%'};return _0x250e10;}})});}_0x11af94=_[_0x6156('0x3c')]({},_0x11af94,_0xdd2541[_0x6156('0x3d')]);var _0x65ad0f={'where':_0x11af94[_0x6156('0x38')]};return db[_0x6156('0x28')]['count'](_0x65ad0f)['then'](function(_0x38516a){_0x261b2d[_0x6156('0x3e')]=_0x38516a;if(_0xdd2541[_0x6156('0x2e')]['includeAll']){_0x11af94[_0x6156('0x3f')]=[{'all':!![]}];}return db['FreshdeskField'][_0x6156('0x40')](_0x11af94);})[_0x6156('0x21')](function(_0x19331b){_0x261b2d[_0x6156('0x41')]=_0x19331b;return _0x261b2d;})[_0x6156('0x21')](respondWithFilteredResult(_0x420e85,_0x11af94))[_0x6156('0x42')](handleError(_0x420e85,null));};exports['show']=function(_0x1f5b3c,_0x30dc52){var _0x35115e={'raw':!![],'where':{'id':_0x1f5b3c[_0x6156('0x43')]['id']}},_0xf1d923={};_0xf1d923[_0x6156('0x2d')]=_[_0x6156('0x2f')](db[_0x6156('0x28')][_0x6156('0x29')]);_0xf1d923[_0x6156('0x2e')]=_['keys'](_0x1f5b3c['query']);_0xf1d923['filters']=_[_0x6156('0x31')](_0xf1d923[_0x6156('0x2d')],_0xf1d923['query']);_0x35115e['attributes']=_[_0x6156('0x31')](_0xf1d923[_0x6156('0x2d')],qs[_0x6156('0x32')](_0x1f5b3c[_0x6156('0x2e')][_0x6156('0x32')]));_0x35115e['attributes']=_0x35115e[_0x6156('0x33')][_0x6156('0x34')]?_0x35115e[_0x6156('0x33')]:_0xf1d923['model'];if(_0x1f5b3c[_0x6156('0x2e')][_0x6156('0x44')]){_0x35115e[_0x6156('0x3f')]=[{'all':!![]}];}_0x35115e=_[_0x6156('0x3c')]({},_0x35115e,_0x1f5b3c['options']);return db[_0x6156('0x28')][_0x6156('0x45')](_0x35115e)[_0x6156('0x21')](handleEntityNotFound(_0x30dc52,null))[_0x6156('0x21')](respondWithResult(_0x30dc52,null))[_0x6156('0x42')](handleError(_0x30dc52,null));};exports['create']=function(_0x492dac,_0x52ced3){return db['FreshdeskField'][_0x6156('0x46')](_0x492dac['body'],{})['then'](respondWithResult(_0x52ced3,0xc9))[_0x6156('0x42')](handleError(_0x52ced3,null));};exports[_0x6156('0x47')]=function(_0x300940,_0x142b48){if(_0x300940[_0x6156('0x48')]['id']){delete _0x300940[_0x6156('0x48')]['id'];}return db[_0x6156('0x28')]['find']({'where':{'id':_0x300940[_0x6156('0x43')]['id']}})['then'](handleEntityNotFound(_0x142b48,null))[_0x6156('0x21')](saveUpdates(_0x300940[_0x6156('0x48')],null))[_0x6156('0x21')](respondWithResult(_0x142b48,null))[_0x6156('0x42')](handleError(_0x142b48,null));};exports[_0x6156('0x22')]=function(_0x191d91,_0x40836f){return db[_0x6156('0x28')][_0x6156('0x45')]({'where':{'id':_0x191d91[_0x6156('0x43')]['id']}})[_0x6156('0x21')](handleEntityNotFound(_0x40836f,null))[_0x6156('0x21')](removeEntity(_0x40836f,null))[_0x6156('0x42')](handleError(_0x40836f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 27a3b18..3c34884 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 _0x69ee=['define','FreshdeskField','int_freshdesk_fields','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x411ac4,_0x32bca6){var _0x512c89=function(_0x549f3b){while(--_0x549f3b){_0x411ac4['push'](_0x411ac4['shift']());}};_0x512c89(++_0x32bca6);}(_0x69ee,0x1ee));var _0xe69e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x69ee[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xe69e('0x0'));var util=require(_0xe69e('0x1'));var logger=require(_0xe69e('0x2'))(_0xe69e('0x3'));var moment=require(_0xe69e('0x4'));var BPromise=require('bluebird');var rp=require(_0xe69e('0x5'));var fs=require('fs');var path=require(_0xe69e('0x6'));var rimraf=require(_0xe69e('0x7'));var config=require(_0xe69e('0x8'));var attributes=require(_0xe69e('0x9'));module['exports']=function(_0x1e271a,_0x19ae48){return _0x1e271a[_0xe69e('0xa')](_0xe69e('0xb'),attributes,{'tableName':_0xe69e('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0xe69e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd417=['int_freshdesk_fields','idField','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','define'];(function(_0x291276,_0x5870a5){var _0x459a79=function(_0x5f295e){while(--_0x5f295e){_0x291276['push'](_0x291276['shift']());}};_0x459a79(++_0x5870a5);}(_0xd417,0xaa));var _0x7d41=function(_0x129a18,_0x5b308a){_0x129a18=_0x129a18-0x0;var _0x3ed324=_0xd417[_0x129a18];return _0x3ed324;};'use strict';var _=require(_0x7d41('0x0'));var util=require(_0x7d41('0x1'));var logger=require(_0x7d41('0x2'))(_0x7d41('0x3'));var moment=require(_0x7d41('0x4'));var BPromise=require('bluebird');var rp=require(_0x7d41('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d41('0x6'));var config=require(_0x7d41('0x7'));var attributes=require(_0x7d41('0x8'));module['exports']=function(_0x295ee5,_0x2c0391){return _0x295ee5[_0x7d41('0x9')]('FreshdeskField',attributes,{'tableName':_0x7d41('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x7d41('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index f229ff1..063df97 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xd3e0cf,_0x4622c3){var _0x3ce84d=function(_0x37b1ce){while(--_0x37b1ce){_0xd3e0cf['push'](_0xd3e0cf['shift']());}};_0x3ce84d(++_0x4622c3);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f38c6,_0x428650){_0x1f38c6=_0x1f38c6-0x0;var _0x259367=_0xb10b[_0x1f38c6];return _0x259367;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xb94a2f,_0x3a5f50){var _0x45e3ee=function(_0x5d5a89){while(--_0x5d5a89){_0xb94a2f['push'](_0xb94a2f['shift']());}};_0x45e3ee(++_0x3a5f50);}(_0xb10b,0x12a));var _0xbb10=function(_0x13945b,_0x289c94){_0x13945b=_0x13945b-0x0;var _0x1b1643=_0xb10b[_0x13945b];return _0x1b1643;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 280178c..becf637 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 _0x0e4a=['delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update'];(function(_0x2ced60,_0xed0e58){var _0x32e8b7=function(_0x108656){while(--_0x108656){_0x2ced60['push'](_0x2ced60['shift']());}};_0x32e8b7(++_0xed0e58);}(_0x0e4a,0x113));var _0xa0e4=function(_0x4f0ee2,_0x4300ef){_0x4f0ee2=_0x4f0ee2-0x0;var _0x5ce564=_0x0e4a[_0x4f0ee2];return _0x5ce564;};'use strict';var multer=require(_0xa0e4('0x0'));var util=require(_0xa0e4('0x1'));var path=require('path');var timeout=require(_0xa0e4('0x2'));var express=require(_0xa0e4('0x3'));var router=express[_0xa0e4('0x4')]();var auth=require(_0xa0e4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa0e4('0x6'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0xa0e4('0x7')](),controller['index']);router[_0xa0e4('0x8')]('/:id',auth[_0xa0e4('0x7')](),controller['show']);router['get']('/:id/configurations',auth[_0xa0e4('0x7')](),controller[_0xa0e4('0x9')]);router[_0xa0e4('0x8')](_0xa0e4('0xa'),auth[_0xa0e4('0x7')](),controller[_0xa0e4('0xb')]);router[_0xa0e4('0xc')]('/',auth['isAuthenticated'](),controller[_0xa0e4('0xd')]);router['post'](_0xa0e4('0xe'),auth['isAuthenticated'](),controller[_0xa0e4('0xf')]);router[_0xa0e4('0x10')](_0xa0e4('0x11'),auth[_0xa0e4('0x7')](),controller[_0xa0e4('0x12')]);router[_0xa0e4('0x13')](_0xa0e4('0x11'),auth[_0xa0e4('0x7')](),controller['destroy']);module[_0xa0e4('0x14')]=router; \ No newline at end of file +var _0x52d2=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete'];(function(_0x22e5dc,_0x3d9c9e){var _0x28db29=function(_0x1abb82){while(--_0x1abb82){_0x22e5dc['push'](_0x22e5dc['shift']());}};_0x28db29(++_0x3d9c9e);}(_0x52d2,0x1e5));var _0x252d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x52d2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x252d('0x0'));var util=require(_0x252d('0x1'));var path=require(_0x252d('0x2'));var timeout=require(_0x252d('0x3'));var express=require(_0x252d('0x4'));var router=express['Router']();var auth=require(_0x252d('0x5'));var interaction=require(_0x252d('0x6'));var config=require(_0x252d('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x252d('0x8')]('/',auth[_0x252d('0x9')](),controller[_0x252d('0xa')]);router[_0x252d('0x8')]('/:id',auth[_0x252d('0x9')](),controller[_0x252d('0xb')]);router['get'](_0x252d('0xc'),auth[_0x252d('0x9')](),controller['getConfigurations']);router['get'](_0x252d('0xd'),auth[_0x252d('0x9')](),controller[_0x252d('0xe')]);router[_0x252d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x252d('0x9')](),controller[_0x252d('0x10')]);router[_0x252d('0x11')](_0x252d('0x12'),auth[_0x252d('0x9')](),controller[_0x252d('0x13')]);router[_0x252d('0x14')]('/:id',auth[_0x252d('0x9')](),controller[_0x252d('0x15')]);module[_0x252d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 0492071..c81c318 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 _0xcaaf=['username','remoteUri','sequelize','STRING'];(function(_0x49aec4,_0xcf2687){var _0x26be4e=function(_0x53f168){while(--_0x53f168){_0x49aec4['push'](_0x49aec4['shift']());}};_0x26be4e(++_0xcf2687);}(_0xcaaf,0x66));var _0xfcaa=function(_0x1dc4b6,_0x42d637){_0x1dc4b6=_0x1dc4b6-0x0;var _0x3c296f=_0xcaaf[_0x1dc4b6];return _0x3c296f;};'use strict';var Sequelize=require(_0xfcaa('0x0'));module['exports']={'name':{'type':Sequelize[_0xfcaa('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xfcaa('0x2')},'apiKey':{'type':Sequelize[_0xfcaa('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xfcaa('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x89fb=['STRING','username','remoteUri','exports'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x89fb,0x14b));var _0xb89f=function(_0x1c67df,_0x2b474d){_0x1c67df=_0x1c67df-0x0;var _0x5d038e=_0x89fb[_0x1c67df];return _0x5d038e;};'use strict';var Sequelize=require('sequelize');module[_0xb89f('0x0')]={'name':{'type':Sequelize[_0xb89f('0x1')]},'description':{'type':Sequelize[_0xb89f('0x1')]},'username':{'type':Sequelize[_0xb89f('0x1')],'unique':_0xb89f('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb89f('0x1')],'unique':_0xb89f('0x3')},'serverUrl':{'type':Sequelize[_0xb89f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index abc4af7..bdf9838 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 _0xa33f=['show','includeAll','merge','create','body','params','destroy','getConfigurations','findOne','keys','filter','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','format','%s%s','/api/selector/owners','Token\x20token=','users','email','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../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','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','limit','set','Content-Range','apply','save','stack','name','send','index','map','FreshsalesAccount','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','type','VIRTUAL','options','include','rows'];(function(_0x371c1b,_0x46e8c7){var _0x2ed0d7=function(_0x24dbf0){while(--_0x24dbf0){_0x371c1b['push'](_0x371c1b['shift']());}};_0x2ed0d7(++_0x46e8c7);}(_0xa33f,0x97));var _0xfa33=function(_0x4f6f8c,_0x5e2778){_0x4f6f8c=_0x4f6f8c-0x0;var _0x245dd9=_0xa33f[_0x4f6f8c];return _0x245dd9;};'use strict';var pdf=require(_0xfa33('0x0'));var emlformat=require(_0xfa33('0x1'));var rimraf=require(_0xfa33('0x2'));var zipdir=require(_0xfa33('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa33('0x4'));var moment=require(_0xfa33('0x5'));var BPromise=require(_0xfa33('0x6'));var Mustache=require(_0xfa33('0x7'));var util=require(_0xfa33('0x8'));var path=require(_0xfa33('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfa33('0xa'));var fs=require('fs');var _=require(_0xfa33('0xb'));var squel=require(_0xfa33('0xc'));var crypto=require(_0xfa33('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfa33('0xe'));var querystring=require(_0xfa33('0xf'));var Papa=require(_0xfa33('0x10'));var Redis=require(_0xfa33('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa33('0x12'));var hardwareService=require(_0xfa33('0x13'));var logger=require(_0xfa33('0x14'))(_0xfa33('0x15'));var utils=require(_0xfa33('0x16'));var config=require(_0xfa33('0x17'));var db=require(_0xfa33('0x18'))['db'];var integrations=require(_0xfa33('0x19'));var jayson=require(_0xfa33('0x1a'));var client=jayson[_0xfa33('0x1b')][_0xfa33('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4c869f,_0x3e0d24,_0x158e19){if(_0x158e19){var _0x5134ff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5134ff[_0xfa33('0x1d')](_0x3e0d24)){return _0x4c869f;}else{throw new db[(_0xfa33('0x1e'))]['ValidationError'](_0xfa33('0x1f'));}}else{return _0x4c869f;}}function respondWithRpcPromise(_0x4379b4,_0x1d2c29,_0x1c7219,_0x1843c8){return new BPromise(function(_0x521c0c,_0x292dbd){var _0x389f14=_0x1843c8||client;return _0x389f14[_0xfa33('0x20')](_0x4379b4,_0x1c7219)[_0xfa33('0x21')](function(_0x4b4265){logger[_0xfa33('0x22')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d2c29,_0xfa33('0x23'));logger[_0xfa33('0x24')](_0xfa33('0x25'),_0x1d2c29,'request\x20sent',JSON[_0xfa33('0x26')](_0x4b4265));if(_0x4b4265[_0xfa33('0x27')]){if(_0x4b4265['error'][_0xfa33('0x28')]===0x1f4){logger[_0xfa33('0x27')](_0xfa33('0x29'),_0x1d2c29,_0x4b4265[_0xfa33('0x27')][_0xfa33('0x2a')]);return _0x292dbd(_0x4b4265[_0xfa33('0x27')][_0xfa33('0x2a')]);}logger[_0xfa33('0x27')](_0xfa33('0x29'),_0x1d2c29,_0x4b4265['error'][_0xfa33('0x2a')]);return _0x521c0c(_0x4b4265[_0xfa33('0x27')][_0xfa33('0x2a')]);}else{logger[_0xfa33('0x22')](_0xfa33('0x29'),_0x1d2c29,_0xfa33('0x23'));_0x521c0c(_0x4b4265[_0xfa33('0x2b')][_0xfa33('0x2a')]);}})[_0xfa33('0x2c')](function(_0x26481c){logger[_0xfa33('0x27')](_0xfa33('0x29'),_0x1d2c29,_0x26481c);_0x292dbd(_0x26481c);});});}function respondWithStatusCode(_0x25e825,_0x11ed83){_0x11ed83=_0x11ed83||0xcc;return function(_0x580c5c){if(_0x580c5c){return _0x25e825[_0xfa33('0x2d')](_0x11ed83);}return _0x25e825['status'](_0x11ed83)[_0xfa33('0x2e')]();};}function respondWithResult(_0x3e3fb6,_0x1beab0){_0x1beab0=_0x1beab0||0xc8;return function(_0x10580b){if(_0x10580b){return _0x3e3fb6[_0xfa33('0x2f')](_0x1beab0)[_0xfa33('0x30')](_0x10580b);}};}function respondWithFilteredResult(_0x169e34,_0x47dc0e){return function(_0x4dcecc){if(_0x4dcecc){var _0x17db63=_0x4dcecc[_0xfa33('0x31')],_0x3a6f1c=_0x47dc0e['offset'],_0x2b3e9a=_0x47dc0e['offset']+_0x47dc0e[_0xfa33('0x32')],_0x3d0c74;if(_0x2b3e9a>=_0x17db63){_0x2b3e9a=_0x17db63;_0x3d0c74=0xc8;}else{_0x3d0c74=0xce;}_0x169e34[_0xfa33('0x2f')](_0x3d0c74);return _0x169e34[_0xfa33('0x33')](_0xfa33('0x34'),_0x3a6f1c+'-'+_0x2b3e9a+'/'+_0x17db63)[_0xfa33('0x30')](_0x4dcecc);}return null;};}function patchUpdates(_0x580f0a){return function(_0x1a04cd){try{jsonpatch[_0xfa33('0x35')](_0x1a04cd,_0x580f0a,!![]);}catch(_0x8d41a6){return BPromise['reject'](_0x8d41a6);}return _0x1a04cd[_0xfa33('0x36')]();};}function saveUpdates(_0x3a06d1,_0x491340){return function(_0x3e2a63){if(_0x3e2a63){return _0x3e2a63['update'](_0x3a06d1)[_0xfa33('0x21')](function(_0x45793e){return _0x45793e;});}return null;};}function removeEntity(_0x30aaa5,_0x30a5fe){return function(_0x3ff95a){if(_0x3ff95a){return _0x3ff95a['destroy']()[_0xfa33('0x21')](function(){_0x30aaa5[_0xfa33('0x2f')](0xcc)[_0xfa33('0x2e')]();});}};}function handleEntityNotFound(_0x5cd23e,_0x475eac){return function(_0x52974d){if(!_0x52974d){_0x5cd23e[_0xfa33('0x2d')](0x194);}return _0x52974d;};}function handleError(_0x5b04ff,_0x4fab5d){_0x4fab5d=_0x4fab5d||0x1f4;return function(_0x49a9f3){logger['error'](_0x49a9f3[_0xfa33('0x37')]);if(_0x49a9f3[_0xfa33('0x38')]){delete _0x49a9f3[_0xfa33('0x38')];}_0x5b04ff['status'](_0x4fab5d)[_0xfa33('0x39')](_0x49a9f3);};}exports[_0xfa33('0x3a')]=function(_0x429955,_0x7fd8c0){var _0x384575={},_0x24db24={},_0x25846a={'count':0x0,'rows':[]};var _0x3b149f=_[_0xfa33('0x3b')](db[_0xfa33('0x3c')][_0xfa33('0x3d')],function(_0x2bf410){return{'name':_0x2bf410['fieldName'],'type':_0x2bf410['type'][_0xfa33('0x3e')]};});_0x24db24[_0xfa33('0x3f')]=_['map'](_0x3b149f,_0xfa33('0x38'));_0x24db24[_0xfa33('0x40')]=_['keys'](_0x429955[_0xfa33('0x40')]);_0x24db24[_0xfa33('0x41')]=_['intersection'](_0x24db24['model'],_0x24db24[_0xfa33('0x40')]);_0x384575[_0xfa33('0x42')]=_[_0xfa33('0x43')](_0x24db24[_0xfa33('0x3f')],qs[_0xfa33('0x44')](_0x429955[_0xfa33('0x40')]['fields']));_0x384575[_0xfa33('0x42')]=_0x384575[_0xfa33('0x42')][_0xfa33('0x45')]?_0x384575[_0xfa33('0x42')]:_0x24db24['model'];if(!_0x429955[_0xfa33('0x40')][_0xfa33('0x46')]('nolimit')){_0x384575[_0xfa33('0x32')]=qs[_0xfa33('0x32')](_0x429955[_0xfa33('0x40')][_0xfa33('0x32')]);_0x384575['offset']=qs['offset'](_0x429955['query'][_0xfa33('0x47')]);}_0x384575[_0xfa33('0x48')]=qs[_0xfa33('0x49')](_0x429955[_0xfa33('0x40')][_0xfa33('0x49')]);_0x384575[_0xfa33('0x4a')]=qs[_0xfa33('0x41')](_[_0xfa33('0x4b')](_0x429955['query'],_0x24db24[_0xfa33('0x41')]),_0x3b149f);if(_0x429955['query']['filter']){_0x384575[_0xfa33('0x4a')]=_['merge'](_0x384575[_0xfa33('0x4a')],{'$or':_[_0xfa33('0x3b')](_0x3b149f,function(_0x2bec66){if(_0x2bec66[_0xfa33('0x4c')]!==_0xfa33('0x4d')){var _0x156258={};_0x156258[_0x2bec66['name']]={'$like':'%'+_0x429955['query']['filter']+'%'};return _0x156258;}})});}_0x384575=_['merge']({},_0x384575,_0x429955[_0xfa33('0x4e')]);var _0x5ceb60={'where':_0x384575['where']};return db[_0xfa33('0x3c')][_0xfa33('0x31')](_0x5ceb60)[_0xfa33('0x21')](function(_0x20d60d){_0x25846a[_0xfa33('0x31')]=_0x20d60d;if(_0x429955['query']['includeAll']){_0x384575[_0xfa33('0x4f')]=[{'all':!![]}];}return db[_0xfa33('0x3c')]['findAll'](_0x384575);})[_0xfa33('0x21')](function(_0x1e26ee){_0x25846a[_0xfa33('0x50')]=_0x1e26ee;return _0x25846a;})[_0xfa33('0x21')](respondWithFilteredResult(_0x7fd8c0,_0x384575))[_0xfa33('0x2c')](handleError(_0x7fd8c0,null));};exports[_0xfa33('0x51')]=function(_0x4b0cd2,_0x250fc9){var _0x28cd3f={'raw':![],'where':{'id':_0x4b0cd2['params']['id']}},_0x4e1f19={};_0x4e1f19[_0xfa33('0x3f')]=_['keys'](db[_0xfa33('0x3c')][_0xfa33('0x3d')]);_0x4e1f19[_0xfa33('0x40')]=_['keys'](_0x4b0cd2[_0xfa33('0x40')]);_0x4e1f19['filters']=_['intersection'](_0x4e1f19['model'],_0x4e1f19[_0xfa33('0x40')]);_0x28cd3f['attributes']=_[_0xfa33('0x43')](_0x4e1f19[_0xfa33('0x3f')],qs['fields'](_0x4b0cd2['query'][_0xfa33('0x44')]));_0x28cd3f[_0xfa33('0x42')]=_0x28cd3f[_0xfa33('0x42')]['length']?_0x28cd3f[_0xfa33('0x42')]:_0x4e1f19['model'];if(_0x4b0cd2[_0xfa33('0x40')][_0xfa33('0x52')]){_0x28cd3f[_0xfa33('0x4f')]=[{'all':!![]}];}_0x28cd3f=_[_0xfa33('0x53')]({},_0x28cd3f,_0x4b0cd2[_0xfa33('0x4e')]);return db[_0xfa33('0x3c')]['find'](_0x28cd3f)[_0xfa33('0x21')](handleEntityNotFound(_0x250fc9,null))[_0xfa33('0x21')](respondWithResult(_0x250fc9,null))[_0xfa33('0x2c')](handleError(_0x250fc9,null));};exports[_0xfa33('0x54')]=function(_0x489e19,_0x4b19ea){return db[_0xfa33('0x3c')][_0xfa33('0x54')](_0x489e19['body'],{})[_0xfa33('0x21')](respondWithResult(_0x4b19ea,0xc9))[_0xfa33('0x2c')](handleError(_0x4b19ea,null));};exports['update']=function(_0x4eb8f4,_0x2a4d41){if(_0x4eb8f4[_0xfa33('0x55')]['id']){delete _0x4eb8f4['body']['id'];}return db[_0xfa33('0x3c')]['find']({'where':{'id':_0x4eb8f4[_0xfa33('0x56')]['id']}})[_0xfa33('0x21')](handleEntityNotFound(_0x2a4d41,null))[_0xfa33('0x21')](saveUpdates(_0x4eb8f4['body'],null))[_0xfa33('0x21')](respondWithResult(_0x2a4d41,null))['catch'](handleError(_0x2a4d41,null));};exports[_0xfa33('0x57')]=function(_0x32beea,_0x4c6ae0){return db['FreshsalesAccount']['find']({'where':{'id':_0x32beea[_0xfa33('0x56')]['id']}})['then'](handleEntityNotFound(_0x4c6ae0,null))['then'](removeEntity(_0x4c6ae0,null))[_0xfa33('0x2c')](handleError(_0x4c6ae0,null));};exports[_0xfa33('0x58')]=function(_0x5a6db5,_0x32d363,_0x2a6a16){var _0x382dd8={};var _0x2106d4={};var _0x4cd239;var _0x5c5767;return db[_0xfa33('0x3c')][_0xfa33('0x59')]({'where':{'id':_0x5a6db5[_0xfa33('0x56')]['id']}})[_0xfa33('0x21')](handleEntityNotFound(_0x32d363,null))[_0xfa33('0x21')](function(_0x4b9aca){if(_0x4b9aca){_0x4cd239=_0x4b9aca;_0x2106d4[_0xfa33('0x3f')]=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x2106d4[_0xfa33('0x40')]=_[_0xfa33('0x5a')](_0x5a6db5['query']);_0x2106d4[_0xfa33('0x41')]=_['intersection'](_0x2106d4['model'],_0x2106d4[_0xfa33('0x40')]);_0x382dd8[_0xfa33('0x42')]=_[_0xfa33('0x43')](_0x2106d4[_0xfa33('0x3f')],qs[_0xfa33('0x44')](_0x5a6db5[_0xfa33('0x40')][_0xfa33('0x44')]));_0x382dd8[_0xfa33('0x42')]=_0x382dd8[_0xfa33('0x42')][_0xfa33('0x45')]?_0x382dd8[_0xfa33('0x42')]:_0x2106d4[_0xfa33('0x3f')];_0x382dd8[_0xfa33('0x48')]=qs['sort'](_0x5a6db5[_0xfa33('0x40')][_0xfa33('0x49')]);_0x382dd8[_0xfa33('0x4a')]=qs[_0xfa33('0x41')](_[_0xfa33('0x4b')](_0x5a6db5['query'],_0x2106d4[_0xfa33('0x41')]));if(_0x5a6db5[_0xfa33('0x40')][_0xfa33('0x5b')]){_0x382dd8['where']=_[_0xfa33('0x53')](_0x382dd8[_0xfa33('0x4a')],{'$or':_[_0xfa33('0x3b')](_0x382dd8[_0xfa33('0x42')],function(_0x14cd6f){var _0x13b67a={};_0x13b67a[_0x14cd6f]={'$like':'%'+_0x5a6db5['query'][_0xfa33('0x5b')]+'%'};return _0x13b67a;})});}_0x382dd8=_[_0xfa33('0x53')]({},_0x382dd8,_0x5a6db5['options']);return _0x4cd239[_0xfa33('0x58')](_0x382dd8);}})['then'](function(_0x4f8b3c){if(_0x4f8b3c){_0x5c5767=_0x4f8b3c[_0xfa33('0x45')];if(!_0x5a6db5['query'][_0xfa33('0x46')](_0xfa33('0x5c'))){_0x382dd8[_0xfa33('0x32')]=qs[_0xfa33('0x32')](_0x5a6db5['query']['limit']);_0x382dd8[_0xfa33('0x47')]=qs[_0xfa33('0x47')](_0x5a6db5[_0xfa33('0x40')][_0xfa33('0x47')]);}return _0x4cd239[_0xfa33('0x58')](_0x382dd8);}})[_0xfa33('0x21')](function(_0x2d82a4){if(_0x2d82a4){return _0x2d82a4?{'count':_0x5c5767,'rows':_0x2d82a4}:null;}})[_0xfa33('0x21')](respondWithResult(_0x32d363,null))[_0xfa33('0x2c')](handleError(_0x32d363,null));};exports[_0xfa33('0x5d')]=function(_0x3e27a7,_0x3905a3,_0x496952){if(_0x3e27a7[_0xfa33('0x55')]['id']){delete _0x3e27a7[_0xfa33('0x55')]['id'];}return db['FreshsalesAccount'][_0xfa33('0x59')]({'where':{'id':_0x3e27a7[_0xfa33('0x56')]['id']}})['then'](handleEntityNotFound(_0x3905a3,null))[_0xfa33('0x21')](function(_0x2450b8){if(_0x2450b8){_0x3e27a7[_0xfa33('0x55')][_0xfa33('0x5e')]=_0x2450b8['id'];_0x3e27a7[_0xfa33('0x55')][_0xfa33('0x5f')]=integrations[_0xfa33('0x60')](_0x3e27a7[_0xfa33('0x55')]['channel'],_0x3e27a7[_0xfa33('0x55')]['type']);_0x3e27a7[_0xfa33('0x55')][_0xfa33('0x61')]=integrations[_0xfa33('0x62')](_0x3e27a7[_0xfa33('0x55')][_0xfa33('0x63')],_0x3e27a7[_0xfa33('0x55')][_0xfa33('0x4c')]);return db[_0xfa33('0x64')]['create'](_0x3e27a7[_0xfa33('0x55')],{'include':[{'model':db[_0xfa33('0x65')],'as':'Subjects'},{'model':db[_0xfa33('0x65')],'as':'Descriptions'}]});}return null;})[_0xfa33('0x21')](respondWithResult(_0x3905a3,null))['catch'](handleError(_0x3905a3,null));};exports[_0xfa33('0x66')]=function(_0x450046,_0x563556,_0x2329a4){var _0x2dfb3f='';var _0x5bd02d='';return db['FreshsalesAccount'][_0xfa33('0x59')]({'where':{'id':_0x450046['params']['id']},'attributes':['id',_0xfa33('0x67'),_0xfa33('0x68'),_0xfa33('0x69')]})[_0xfa33('0x21')](handleEntityNotFound(_0x563556,null))['then'](function(_0x22c1c6){if(_0x22c1c6){_0x5bd02d=_0x22c1c6[_0xfa33('0x67')];_0x2dfb3f=_0x22c1c6[_0xfa33('0x68')];var _0x1e369f=_0x22c1c6['remoteUri'][_0xfa33('0x6a')](-0x1);if(_0x1e369f==='/'){_0x2dfb3f=_0x2dfb3f[_0xfa33('0x6b')](0x0,_0x2dfb3f['lastIndexOf'](_0x1e369f));}return rp({'method':'GET','uri':util[_0xfa33('0x6c')](_0xfa33('0x6d'),_0x2dfb3f,_0xfa33('0x6e')),'headers':{'Authorization':_0xfa33('0x6f')+_0x22c1c6['apiKey']},'json':!![]});}})[_0xfa33('0x21')](function(_0x14d2e7){if(_0x14d2e7){var _0x431887=_0x14d2e7[_0xfa33('0x70')];var _0x254b3d=![];var _0x42a527=null;for(_0x42a527=0x0;_0x42a527<_0x431887[_0xfa33('0x45')];_0x42a527++){if(_0x431887[_0x42a527][_0xfa33('0x71')]===_0x5bd02d){_0x254b3d=!![];}}if(_0x254b3d){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xfa33('0x21')](respondWithResult(_0x563556,null))[_0xfa33('0x2c')](function(_0x59138c){var _0x5ab87c=_0x450046[_0xfa33('0x40')][_0xfa33('0x1d')]?0x1f4:_0x59138c[_0xfa33('0x72')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xfa33('0x66'),_0x5ab87c,JSON[_0xfa33('0x26')](_0x59138c));delete _0x59138c[_0xfa33('0x38')];if(_0x5ab87c===0x191){_0x5ab87c=0x190;}_0x563556[_0xfa33('0x2f')](_0x5ab87c)[_0xfa33('0x39')](_0x450046[_0xfa33('0x40')][_0xfa33('0x1d')]?{'message':_0xfa33('0x73'),'statusCode':_0x59138c[_0xfa33('0x72')]}:_0x59138c);});}; \ No newline at end of file +var _0xd873=['VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','create','body','getConfigurations','findOne','pick','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields','Wrong\x20credentials','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','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','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xd873,0x9c));var _0x3d87=function(_0x4ebab3,_0x49e7c2){_0x4ebab3=_0x4ebab3-0x0;var _0x340fe7=_0xd873[_0x4ebab3];return _0x340fe7;};'use strict';var pdf=require(_0x3d87('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3d87('0x1'));var zipdir=require(_0x3d87('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d87('0x3'));var moment=require(_0x3d87('0x4'));var BPromise=require(_0x3d87('0x5'));var Mustache=require(_0x3d87('0x6'));var util=require(_0x3d87('0x7'));var path=require(_0x3d87('0x8'));var sox=require('sox');var csv=require(_0x3d87('0x9'));var ejs=require(_0x3d87('0xa'));var fs=require('fs');var _=require(_0x3d87('0xb'));var squel=require(_0x3d87('0xc'));var crypto=require(_0x3d87('0xd'));var jsforce=require(_0x3d87('0xe'));var deskjs=require(_0x3d87('0xf'));var toCsv=require(_0x3d87('0x9'));var querystring=require(_0x3d87('0x10'));var Papa=require(_0x3d87('0x11'));var Redis=require(_0x3d87('0x12'));var authService=require(_0x3d87('0x13'));var qs=require(_0x3d87('0x14'));var as=require(_0x3d87('0x15'));var hardwareService=require(_0x3d87('0x16'));var logger=require('../../config/logger')(_0x3d87('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3d87('0x18'))['db'];var integrations=require(_0x3d87('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x3d87('0x1a')][_0x3d87('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1d7460,_0x30f1d5,_0x19f4d1){if(_0x19f4d1){var _0x4f87c1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f87c1['test'](_0x30f1d5)){return _0x1d7460;}else{throw new db[(_0x3d87('0x1c'))][(_0x3d87('0x1d'))](_0x3d87('0x1e'));}}else{return _0x1d7460;}}function respondWithRpcPromise(_0x43c14e,_0x2db352,_0x135274,_0x174f31){return new BPromise(function(_0x454629,_0x469bab){var _0x3c4a85=_0x174f31||client;return _0x3c4a85[_0x3d87('0x1f')](_0x43c14e,_0x135274)[_0x3d87('0x20')](function(_0x1c366e){logger[_0x3d87('0x21')](_0x3d87('0x22'),_0x2db352,_0x3d87('0x23'));logger[_0x3d87('0x24')](_0x3d87('0x25'),_0x2db352,_0x3d87('0x23'),JSON[_0x3d87('0x26')](_0x1c366e));if(_0x1c366e[_0x3d87('0x27')]){if(_0x1c366e['error'][_0x3d87('0x28')]===0x1f4){logger['error'](_0x3d87('0x22'),_0x2db352,_0x1c366e['error']['message']);return _0x469bab(_0x1c366e['error'][_0x3d87('0x29')]);}logger['error'](_0x3d87('0x22'),_0x2db352,_0x1c366e[_0x3d87('0x27')]['message']);return _0x454629(_0x1c366e[_0x3d87('0x27')]['message']);}else{logger[_0x3d87('0x21')](_0x3d87('0x22'),_0x2db352,_0x3d87('0x23'));_0x454629(_0x1c366e['result'][_0x3d87('0x29')]);}})[_0x3d87('0x2a')](function(_0xcf8929){logger[_0x3d87('0x27')]('FreshsalesAccount,\x20%s,\x20%s',_0x2db352,_0xcf8929);_0x469bab(_0xcf8929);});});}function respondWithStatusCode(_0x1c33f8,_0x21a12d){_0x21a12d=_0x21a12d||0xcc;return function(_0x847eca){if(_0x847eca){return _0x1c33f8['sendStatus'](_0x21a12d);}return _0x1c33f8[_0x3d87('0x2b')](_0x21a12d)['end']();};}function respondWithResult(_0x21a01a,_0x55f748){_0x55f748=_0x55f748||0xc8;return function(_0x1d381e){if(_0x1d381e){return _0x21a01a[_0x3d87('0x2b')](_0x55f748)['json'](_0x1d381e);}};}function respondWithFilteredResult(_0x5579fb,_0x1f18e9){return function(_0x2c6603){if(_0x2c6603){var _0x3f3007=_0x2c6603[_0x3d87('0x2c')],_0x3d31e9=_0x1f18e9[_0x3d87('0x2d')],_0x40db38=_0x1f18e9[_0x3d87('0x2d')]+_0x1f18e9[_0x3d87('0x2e')],_0x3981e7;if(_0x40db38>=_0x3f3007){_0x40db38=_0x3f3007;_0x3981e7=0xc8;}else{_0x3981e7=0xce;}_0x5579fb[_0x3d87('0x2b')](_0x3981e7);return _0x5579fb[_0x3d87('0x2f')](_0x3d87('0x30'),_0x3d31e9+'-'+_0x40db38+'/'+_0x3f3007)[_0x3d87('0x31')](_0x2c6603);}return null;};}function patchUpdates(_0x293b82){return function(_0x4f05e1){try{jsonpatch[_0x3d87('0x32')](_0x4f05e1,_0x293b82,!![]);}catch(_0x446525){return BPromise[_0x3d87('0x33')](_0x446525);}return _0x4f05e1[_0x3d87('0x34')]();};}function saveUpdates(_0x28f719,_0x7f61c1){return function(_0x44d4cc){if(_0x44d4cc){return _0x44d4cc[_0x3d87('0x35')](_0x28f719)[_0x3d87('0x20')](function(_0x5a2614){return _0x5a2614;});}return null;};}function removeEntity(_0x28fa4c,_0x63c4d1){return function(_0x31706c){if(_0x31706c){return _0x31706c[_0x3d87('0x36')]()[_0x3d87('0x20')](function(){_0x28fa4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x260d9f,_0xe556f){return function(_0xfd0aa6){if(!_0xfd0aa6){_0x260d9f[_0x3d87('0x37')](0x194);}return _0xfd0aa6;};}function handleError(_0x4e9a4b,_0x5284f9){_0x5284f9=_0x5284f9||0x1f4;return function(_0x2bbab7){logger[_0x3d87('0x27')](_0x2bbab7[_0x3d87('0x38')]);if(_0x2bbab7[_0x3d87('0x39')]){delete _0x2bbab7[_0x3d87('0x39')];}_0x4e9a4b['status'](_0x5284f9)[_0x3d87('0x3a')](_0x2bbab7);};}exports['index']=function(_0x1046d1,_0x455076){var _0x5e87aa={},_0x332b8e={},_0x580618={'count':0x0,'rows':[]};var _0x3994c7=_[_0x3d87('0x3b')](db[_0x3d87('0x3c')][_0x3d87('0x3d')],function(_0x482794){return{'name':_0x482794[_0x3d87('0x3e')],'type':_0x482794[_0x3d87('0x3f')][_0x3d87('0x40')]};});_0x332b8e[_0x3d87('0x41')]=_['map'](_0x3994c7,_0x3d87('0x39'));_0x332b8e[_0x3d87('0x42')]=_['keys'](_0x1046d1[_0x3d87('0x42')]);_0x332b8e['filters']=_[_0x3d87('0x43')](_0x332b8e[_0x3d87('0x41')],_0x332b8e[_0x3d87('0x42')]);_0x5e87aa['attributes']=_[_0x3d87('0x43')](_0x332b8e[_0x3d87('0x41')],qs[_0x3d87('0x44')](_0x1046d1[_0x3d87('0x42')][_0x3d87('0x44')]));_0x5e87aa['attributes']=_0x5e87aa[_0x3d87('0x45')][_0x3d87('0x46')]?_0x5e87aa[_0x3d87('0x45')]:_0x332b8e[_0x3d87('0x41')];if(!_0x1046d1[_0x3d87('0x42')][_0x3d87('0x47')]('nolimit')){_0x5e87aa[_0x3d87('0x2e')]=qs[_0x3d87('0x2e')](_0x1046d1[_0x3d87('0x42')][_0x3d87('0x2e')]);_0x5e87aa[_0x3d87('0x2d')]=qs[_0x3d87('0x2d')](_0x1046d1[_0x3d87('0x42')]['offset']);}_0x5e87aa[_0x3d87('0x48')]=qs[_0x3d87('0x49')](_0x1046d1[_0x3d87('0x42')][_0x3d87('0x49')]);_0x5e87aa[_0x3d87('0x4a')]=qs[_0x3d87('0x4b')](_['pick'](_0x1046d1[_0x3d87('0x42')],_0x332b8e[_0x3d87('0x4b')]),_0x3994c7);if(_0x1046d1[_0x3d87('0x42')][_0x3d87('0x4c')]){_0x5e87aa['where']=_[_0x3d87('0x4d')](_0x5e87aa[_0x3d87('0x4a')],{'$or':_['map'](_0x3994c7,function(_0x492ba5){if(_0x492ba5[_0x3d87('0x3f')]!==_0x3d87('0x4e')){var _0x152b8a={};_0x152b8a[_0x492ba5['name']]={'$like':'%'+_0x1046d1[_0x3d87('0x42')][_0x3d87('0x4c')]+'%'};return _0x152b8a;}})});}_0x5e87aa=_[_0x3d87('0x4d')]({},_0x5e87aa,_0x1046d1[_0x3d87('0x4f')]);var _0x14d751={'where':_0x5e87aa['where']};return db[_0x3d87('0x3c')][_0x3d87('0x2c')](_0x14d751)[_0x3d87('0x20')](function(_0x53eee6){_0x580618[_0x3d87('0x2c')]=_0x53eee6;if(_0x1046d1[_0x3d87('0x42')][_0x3d87('0x50')]){_0x5e87aa[_0x3d87('0x51')]=[{'all':!![]}];}return db[_0x3d87('0x3c')][_0x3d87('0x52')](_0x5e87aa);})[_0x3d87('0x20')](function(_0x1bb2de){_0x580618[_0x3d87('0x53')]=_0x1bb2de;return _0x580618;})[_0x3d87('0x20')](respondWithFilteredResult(_0x455076,_0x5e87aa))[_0x3d87('0x2a')](handleError(_0x455076,null));};exports['show']=function(_0x52a46d,_0xd7ab35){var _0x341283={'raw':![],'where':{'id':_0x52a46d[_0x3d87('0x54')]['id']}},_0x412bf0={};_0x412bf0[_0x3d87('0x41')]=_[_0x3d87('0x55')](db[_0x3d87('0x3c')][_0x3d87('0x3d')]);_0x412bf0[_0x3d87('0x42')]=_[_0x3d87('0x55')](_0x52a46d[_0x3d87('0x42')]);_0x412bf0[_0x3d87('0x4b')]=_['intersection'](_0x412bf0['model'],_0x412bf0[_0x3d87('0x42')]);_0x341283[_0x3d87('0x45')]=_['intersection'](_0x412bf0[_0x3d87('0x41')],qs[_0x3d87('0x44')](_0x52a46d[_0x3d87('0x42')][_0x3d87('0x44')]));_0x341283[_0x3d87('0x45')]=_0x341283[_0x3d87('0x45')][_0x3d87('0x46')]?_0x341283[_0x3d87('0x45')]:_0x412bf0[_0x3d87('0x41')];if(_0x52a46d[_0x3d87('0x42')]['includeAll']){_0x341283[_0x3d87('0x51')]=[{'all':!![]}];}_0x341283=_['merge']({},_0x341283,_0x52a46d[_0x3d87('0x4f')]);return db[_0x3d87('0x3c')][_0x3d87('0x56')](_0x341283)['then'](handleEntityNotFound(_0xd7ab35,null))[_0x3d87('0x20')](respondWithResult(_0xd7ab35,null))[_0x3d87('0x2a')](handleError(_0xd7ab35,null));};exports[_0x3d87('0x57')]=function(_0x4f182d,_0x244511){return db[_0x3d87('0x3c')]['create'](_0x4f182d['body'],{})['then'](respondWithResult(_0x244511,0xc9))['catch'](handleError(_0x244511,null));};exports[_0x3d87('0x35')]=function(_0x51a687,_0x3b762d){if(_0x51a687['body']['id']){delete _0x51a687[_0x3d87('0x58')]['id'];}return db['FreshsalesAccount'][_0x3d87('0x56')]({'where':{'id':_0x51a687[_0x3d87('0x54')]['id']}})[_0x3d87('0x20')](handleEntityNotFound(_0x3b762d,null))[_0x3d87('0x20')](saveUpdates(_0x51a687[_0x3d87('0x58')],null))['then'](respondWithResult(_0x3b762d,null))[_0x3d87('0x2a')](handleError(_0x3b762d,null));};exports[_0x3d87('0x36')]=function(_0x71ea1,_0x5a6b3f){return db['FreshsalesAccount'][_0x3d87('0x56')]({'where':{'id':_0x71ea1[_0x3d87('0x54')]['id']}})[_0x3d87('0x20')](handleEntityNotFound(_0x5a6b3f,null))[_0x3d87('0x20')](removeEntity(_0x5a6b3f,null))[_0x3d87('0x2a')](handleError(_0x5a6b3f,null));};exports[_0x3d87('0x59')]=function(_0x5c5af2,_0x3cc81f,_0x47fc0f){var _0x17900b={};var _0x5ee4ae={};var _0x4f1d03;var _0x2e5a4b;return db[_0x3d87('0x3c')][_0x3d87('0x5a')]({'where':{'id':_0x5c5af2['params']['id']}})[_0x3d87('0x20')](handleEntityNotFound(_0x3cc81f,null))[_0x3d87('0x20')](function(_0x581c1e){if(_0x581c1e){_0x4f1d03=_0x581c1e;_0x5ee4ae[_0x3d87('0x41')]=_[_0x3d87('0x55')](db['FreshsalesConfiguration'][_0x3d87('0x3d')]);_0x5ee4ae['query']=_[_0x3d87('0x55')](_0x5c5af2[_0x3d87('0x42')]);_0x5ee4ae['filters']=_[_0x3d87('0x43')](_0x5ee4ae[_0x3d87('0x41')],_0x5ee4ae[_0x3d87('0x42')]);_0x17900b['attributes']=_[_0x3d87('0x43')](_0x5ee4ae['model'],qs[_0x3d87('0x44')](_0x5c5af2[_0x3d87('0x42')][_0x3d87('0x44')]));_0x17900b['attributes']=_0x17900b[_0x3d87('0x45')]['length']?_0x17900b[_0x3d87('0x45')]:_0x5ee4ae[_0x3d87('0x41')];_0x17900b[_0x3d87('0x48')]=qs[_0x3d87('0x49')](_0x5c5af2['query'][_0x3d87('0x49')]);_0x17900b[_0x3d87('0x4a')]=qs[_0x3d87('0x4b')](_[_0x3d87('0x5b')](_0x5c5af2['query'],_0x5ee4ae['filters']));if(_0x5c5af2[_0x3d87('0x42')][_0x3d87('0x4c')]){_0x17900b[_0x3d87('0x4a')]=_[_0x3d87('0x4d')](_0x17900b[_0x3d87('0x4a')],{'$or':_['map'](_0x17900b[_0x3d87('0x45')],function(_0x313103){var _0x45b5b9={};_0x45b5b9[_0x313103]={'$like':'%'+_0x5c5af2[_0x3d87('0x42')]['filter']+'%'};return _0x45b5b9;})});}_0x17900b=_[_0x3d87('0x4d')]({},_0x17900b,_0x5c5af2['options']);return _0x4f1d03['getConfigurations'](_0x17900b);}})[_0x3d87('0x20')](function(_0x23ed0b){if(_0x23ed0b){_0x2e5a4b=_0x23ed0b[_0x3d87('0x46')];if(!_0x5c5af2[_0x3d87('0x42')][_0x3d87('0x47')](_0x3d87('0x5c'))){_0x17900b['limit']=qs['limit'](_0x5c5af2[_0x3d87('0x42')]['limit']);_0x17900b[_0x3d87('0x2d')]=qs[_0x3d87('0x2d')](_0x5c5af2[_0x3d87('0x42')][_0x3d87('0x2d')]);}return _0x4f1d03['getConfigurations'](_0x17900b);}})[_0x3d87('0x20')](function(_0x57f87e){if(_0x57f87e){return _0x57f87e?{'count':_0x2e5a4b,'rows':_0x57f87e}:null;}})[_0x3d87('0x20')](respondWithResult(_0x3cc81f,null))[_0x3d87('0x2a')](handleError(_0x3cc81f,null));};exports[_0x3d87('0x5d')]=function(_0x151a6a,_0x2f7fe4,_0x398591){if(_0x151a6a[_0x3d87('0x58')]['id']){delete _0x151a6a[_0x3d87('0x58')]['id'];}return db[_0x3d87('0x3c')]['findOne']({'where':{'id':_0x151a6a[_0x3d87('0x54')]['id']}})[_0x3d87('0x20')](handleEntityNotFound(_0x2f7fe4,null))[_0x3d87('0x20')](function(_0x5d5a26){if(_0x5d5a26){_0x151a6a['body']['AccountId']=_0x5d5a26['id'];_0x151a6a[_0x3d87('0x58')][_0x3d87('0x5e')]=integrations[_0x3d87('0x5f')](_0x151a6a[_0x3d87('0x58')]['channel'],_0x151a6a['body'][_0x3d87('0x3f')]);_0x151a6a['body'][_0x3d87('0x60')]=integrations[_0x3d87('0x61')](_0x151a6a['body'][_0x3d87('0x62')],_0x151a6a[_0x3d87('0x58')]['type']);return db[_0x3d87('0x63')][_0x3d87('0x57')](_0x151a6a[_0x3d87('0x58')],{'include':[{'model':db[_0x3d87('0x64')],'as':_0x3d87('0x5e')},{'model':db[_0x3d87('0x64')],'as':_0x3d87('0x60')}]});}return null;})[_0x3d87('0x20')](respondWithResult(_0x2f7fe4,null))[_0x3d87('0x2a')](handleError(_0x2f7fe4,null));};exports['getFields']=function(_0x261ed9,_0x45f4c1,_0x258983){var _0x5b8520='';var _0x4c7d91='';return db[_0x3d87('0x3c')][_0x3d87('0x5a')]({'where':{'id':_0x261ed9[_0x3d87('0x54')]['id']},'attributes':['id',_0x3d87('0x65'),_0x3d87('0x66'),_0x3d87('0x67')]})['then'](handleEntityNotFound(_0x45f4c1,null))[_0x3d87('0x20')](function(_0x11e15d){if(_0x11e15d){_0x4c7d91=_0x11e15d['username'];_0x5b8520=_0x11e15d['remoteUri'];var _0x767d5e=_0x11e15d[_0x3d87('0x66')][_0x3d87('0x68')](-0x1);if(_0x767d5e==='/'){_0x5b8520=_0x5b8520[_0x3d87('0x69')](0x0,_0x5b8520[_0x3d87('0x6a')](_0x767d5e));}return rp({'method':'GET','uri':util[_0x3d87('0x6b')](_0x3d87('0x6c'),_0x5b8520,_0x3d87('0x6d')),'headers':{'Authorization':_0x3d87('0x6e')+_0x11e15d[_0x3d87('0x67')]},'json':!![]});}})[_0x3d87('0x20')](function(_0x502b5c){if(_0x502b5c){var _0x2a1bca=_0x502b5c[_0x3d87('0x6f')];var _0xe2b3ce=![];var _0x3b66d3=null;for(_0x3b66d3=0x0;_0x3b66d3<_0x2a1bca[_0x3d87('0x46')];_0x3b66d3++){if(_0x2a1bca[_0x3b66d3]['email']===_0x4c7d91){_0xe2b3ce=!![];}}if(_0xe2b3ce){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3d87('0x70')});}}})[_0x3d87('0x20')](respondWithResult(_0x45f4c1,null))[_0x3d87('0x2a')](function(_0x2f450e){var _0x322910=_0x261ed9['query'][_0x3d87('0x71')]?0x1f4:_0x2f450e[_0x3d87('0x72')]||0x1f4;logger[_0x3d87('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x3d87('0x73'),_0x322910,JSON[_0x3d87('0x26')](_0x2f450e));delete _0x2f450e[_0x3d87('0x39')];if(_0x322910===0x191){_0x322910=0x190;}_0x45f4c1['status'](_0x322910)[_0x3d87('0x3a')](_0x261ed9[_0x3d87('0x42')][_0x3d87('0x71')]?{'message':_0x3d87('0x74'),'statusCode':_0x2f450e[_0x3d87('0x72')]}:_0x2f450e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index eef4e61..91dc8e2 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 _0xe14d=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts'];(function(_0x432432,_0x232f5c){var _0x554327=function(_0x1b1903){while(--_0x1b1903){_0x432432['push'](_0x432432['shift']());}};_0x554327(++_0x232f5c);}(_0xe14d,0x1ee));var _0xde14=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xe14d[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));var integrations=require(_0xde14('0x9'));module[_0xde14('0xa')]=function(_0xba1514,_0x4b1f6b){return _0xba1514['define'](_0xde14('0xb'),attributes,{'tableName':_0xde14('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd28=['moment','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','int_freshsales_accounts','util','../../config/logger'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xfd28,0x148));var _0x8fd2=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0xfd28[_0x5d30b4];return _0x1acfb8;};'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'));var integrations=require(_0x8fd2('0x7'));module[_0x8fd2('0x8')]=function(_0x36178a,_0x2f0afc){return _0x36178a['define']('FreshsalesAccount',attributes,{'tableName':_0x8fd2('0x9'),'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 9700734..5605023 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 _0x781d=['model','map','GetFreshsalesAccount','find','ShowFreshsalesAccount','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x781d,0x14a));var _0xd781=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x781d[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});}exports['GetFreshsalesAccount']=function(_0x1407fc){var _0x3f2922=this;return new Promise(function(_0x395d9c,_0x2f1273){return db[_0xd781('0x17')][_0xd781('0x18')]({'raw':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'limit':_0x1407fc[_0xd781('0x19')]?_0x1407fc['options'][_0xd781('0x1c')]||null:null,'include':_0x1407fc['options']?_0x1407fc['options'][_0xd781('0x1d')]?_['map'](_0x1407fc[_0xd781('0x19')][_0xd781('0x1d')],function(_0x395087){return{'model':db[_0x395087[_0xd781('0x1e')]],'as':_0x395087['as'],'attributes':_0x395087[_0xd781('0x1b')],'include':_0x395087[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x395087[_0xd781('0x1d')],function(_0x10940b){return{'model':db[_0x10940b['model']],'as':_0x10940b['as'],'attributes':_0x10940b['attributes'],'include':_0x10940b[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x10940b[_0xd781('0x1d')],function(_0x57b41e){return{'model':db[_0x57b41e[_0xd781('0x1e')]],'as':_0x57b41e['as'],'attributes':_0x57b41e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e29c8){logger['info'](_0xd781('0x20'),_0x1407fc);logger[_0xd781('0xf')]('GetFreshsalesAccount',_0x1407fc,JSON['stringify'](_0x1e29c8));_0x395d9c(_0x1e29c8);})[_0xd781('0x16')](function(_0x5b0464){logger[_0xd781('0x11')]('GetFreshsalesAccount',_0x5b0464[_0xd781('0x13')],_0x1407fc);_0x2f1273(_0x3f2922[_0xd781('0x11')](0x1f4,_0x5b0464['message']));});});};exports['ShowFreshsalesAccount']=function(_0x432d14){var _0x29e81a=this;return new Promise(function(_0x1c7d83,_0x5a389c){return db['FreshsalesAccount'][_0xd781('0x21')]({'raw':_0x432d14[_0xd781('0x19')]?_0x432d14[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'include':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x432d14[_0xd781('0x19')]['include'],function(_0x23dffb){return{'model':db[_0x23dffb[_0xd781('0x1e')]],'as':_0x23dffb['as'],'attributes':_0x23dffb[_0xd781('0x1b')],'include':_0x23dffb[_0xd781('0x1d')]?_['map'](_0x23dffb[_0xd781('0x1d')],function(_0x3f20e2){return{'model':db[_0x3f20e2['model']],'as':_0x3f20e2['as'],'attributes':_0x3f20e2[_0xd781('0x1b')],'include':_0x3f20e2['include']?_[_0xd781('0x1f')](_0x3f20e2[_0xd781('0x1d')],function(_0x57fdb6){return{'model':db[_0x57fdb6[_0xd781('0x1e')]],'as':_0x57fdb6['as'],'attributes':_0x57fdb6[_0xd781('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a29b7){logger['info'](_0xd781('0x22'),_0x432d14);logger[_0xd781('0xf')]('ShowFreshsalesAccount',_0x432d14,JSON[_0xd781('0x23')](_0x2a29b7));_0x1c7d83(_0x2a29b7);})[_0xd781('0x16')](function(_0x5651de){logger[_0xd781('0x11')](_0xd781('0x22'),_0x5651de[_0xd781('0x13')],_0x432d14);_0x5a389c(_0x29e81a['error'](0x1f4,_0x5651de[_0xd781('0x13')]));});});}; \ No newline at end of file +var _0x9a2a=['ShowFreshsalesAccount','find','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','map','include','model'];(function(_0x338ac9,_0x4dc1af){var _0x673548=function(_0x4bb20c){while(--_0x4bb20c){_0x338ac9['push'](_0x338ac9['shift']());}};_0x673548(++_0x4dc1af);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x1383af,_0x29d2c3){_0x1383af=_0x1383af-0x0;var _0xbc03df=_0x9a2a[_0x1383af];return _0xbc03df;};'use strict';var _=require(_0xa9a2('0x0'));var util=require(_0xa9a2('0x1'));var moment=require(_0xa9a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9a2('0x3'))['db'];var utils=require(_0xa9a2('0x4'));var logger=require(_0xa9a2('0x5'))(_0xa9a2('0x6'));var config=require(_0xa9a2('0x7'));var jayson=require(_0xa9a2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x388689,_0xb51739,_0xedae90){return new BPromise(function(_0x287343,_0xcd2750){return client[_0xa9a2('0x9')](_0x388689,_0xedae90)[_0xa9a2('0xa')](function(_0x26f1ce){logger[_0xa9a2('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0xb51739,_0xa9a2('0xc'));logger[_0xa9a2('0xd')](_0xa9a2('0xe'),_0xb51739,_0xa9a2('0xc'),JSON[_0xa9a2('0xf')](_0x26f1ce));if(_0x26f1ce[_0xa9a2('0x10')]){if(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x11')]===0x1f4){logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0x26f1ce['error'][_0xa9a2('0x13')]);return _0xcd2750(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);}logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);return _0x287343(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);}else{logger[_0xa9a2('0xb')](_0xa9a2('0x12'),_0xb51739,_0xa9a2('0xc'));_0x287343(_0x26f1ce[_0xa9a2('0x14')]['message']);}})[_0xa9a2('0x15')](function(_0xbb6546){logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0xbb6546);_0xcd2750(_0xbb6546);});});}exports[_0xa9a2('0x16')]=function(_0x22993f){var _0x4e3f13=this;return new Promise(function(_0x677249,_0x11ca21){return db[_0xa9a2('0x17')][_0xa9a2('0x18')]({'raw':_0x22993f[_0xa9a2('0x19')]?_0x22993f[_0xa9a2('0x19')][_0xa9a2('0x1a')]===undefined?!![]:![]:!![],'where':_0x22993f[_0xa9a2('0x19')]?_0x22993f[_0xa9a2('0x19')]['where']||null:null,'attributes':_0x22993f['options']?_0x22993f['options'][_0xa9a2('0x1b')]||null:null,'limit':_0x22993f[_0xa9a2('0x19')]?_0x22993f[_0xa9a2('0x19')]['limit']||null:null,'include':_0x22993f[_0xa9a2('0x19')]?_0x22993f['options']['include']?_[_0xa9a2('0x1c')](_0x22993f['options'][_0xa9a2('0x1d')],function(_0x273f55){return{'model':db[_0x273f55['model']],'as':_0x273f55['as'],'attributes':_0x273f55[_0xa9a2('0x1b')],'include':_0x273f55[_0xa9a2('0x1d')]?_[_0xa9a2('0x1c')](_0x273f55[_0xa9a2('0x1d')],function(_0x21078c){return{'model':db[_0x21078c['model']],'as':_0x21078c['as'],'attributes':_0x21078c[_0xa9a2('0x1b')],'include':_0x21078c[_0xa9a2('0x1d')]?_['map'](_0x21078c[_0xa9a2('0x1d')],function(_0x3cdcfe){return{'model':db[_0x3cdcfe[_0xa9a2('0x1e')]],'as':_0x3cdcfe['as'],'attributes':_0x3cdcfe[_0xa9a2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa9a2('0xa')](function(_0x52d7e3){logger[_0xa9a2('0xb')]('GetFreshsalesAccount',_0x22993f);logger[_0xa9a2('0xd')](_0xa9a2('0x16'),_0x22993f,JSON['stringify'](_0x52d7e3));_0x677249(_0x52d7e3);})['catch'](function(_0x4b2d65){logger['error'](_0xa9a2('0x16'),_0x4b2d65[_0xa9a2('0x13')],_0x22993f);_0x11ca21(_0x4e3f13[_0xa9a2('0x10')](0x1f4,_0x4b2d65[_0xa9a2('0x13')]));});});};exports[_0xa9a2('0x1f')]=function(_0x34e754){var _0x409b4f=this;return new Promise(function(_0x3c035c,_0x5b7e8a){return db[_0xa9a2('0x17')][_0xa9a2('0x20')]({'raw':_0x34e754[_0xa9a2('0x19')]?_0x34e754[_0xa9a2('0x19')][_0xa9a2('0x1a')]===undefined?!![]:![]:!![],'where':_0x34e754[_0xa9a2('0x19')]?_0x34e754[_0xa9a2('0x19')]['where']||null:null,'attributes':_0x34e754[_0xa9a2('0x19')]?_0x34e754[_0xa9a2('0x19')][_0xa9a2('0x1b')]||null:null,'include':_0x34e754[_0xa9a2('0x19')]?_0x34e754[_0xa9a2('0x19')]['include']?_[_0xa9a2('0x1c')](_0x34e754[_0xa9a2('0x19')]['include'],function(_0x4a3fc0){return{'model':db[_0x4a3fc0[_0xa9a2('0x1e')]],'as':_0x4a3fc0['as'],'attributes':_0x4a3fc0[_0xa9a2('0x1b')],'include':_0x4a3fc0[_0xa9a2('0x1d')]?_[_0xa9a2('0x1c')](_0x4a3fc0[_0xa9a2('0x1d')],function(_0x4af21b){return{'model':db[_0x4af21b[_0xa9a2('0x1e')]],'as':_0x4af21b['as'],'attributes':_0x4af21b[_0xa9a2('0x1b')],'include':_0x4af21b[_0xa9a2('0x1d')]?_['map'](_0x4af21b[_0xa9a2('0x1d')],function(_0x172ee7){return{'model':db[_0x172ee7[_0xa9a2('0x1e')]],'as':_0x172ee7['as'],'attributes':_0x172ee7['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9a2('0xa')](function(_0x155abc){logger[_0xa9a2('0xb')](_0xa9a2('0x1f'),_0x34e754);logger[_0xa9a2('0xd')](_0xa9a2('0x1f'),_0x34e754,JSON[_0xa9a2('0xf')](_0x155abc));_0x3c035c(_0x155abc);})[_0xa9a2('0x15')](function(_0x152c6f){logger[_0xa9a2('0x10')](_0xa9a2('0x1f'),_0x152c6f[_0xa9a2('0x13')],_0x34e754);_0x5b7e8a(_0x409b4f[_0xa9a2('0x10')](0x1f4,_0x152c6f[_0xa9a2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index f391f6c..66d72ea 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 _0x24ea=['index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','isAuthenticated','getDescriptions','/:id/fields','post','create','update','delete','multer','util','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x3b590f,_0x27ccfd){var _0x156132=function(_0x51d816){while(--_0x51d816){_0x3b590f['push'](_0x3b590f['shift']());}};_0x156132(++_0x27ccfd);}(_0x24ea,0xa1));var _0xa24e=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0x24ea[_0xbc1a4b];return _0x108b87;};'use strict';var multer=require(_0xa24e('0x0'));var util=require(_0xa24e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa24e('0x2'));var router=express[_0xa24e('0x3')]();var auth=require(_0xa24e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa24e('0x5'));var controller=require(_0xa24e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa24e('0x7')]);router[_0xa24e('0x8')](_0xa24e('0x9'),auth['isAuthenticated'](),controller[_0xa24e('0xa')]);router[_0xa24e('0x8')](_0xa24e('0xb'),auth['isAuthenticated'](),controller[_0xa24e('0xc')]);router[_0xa24e('0x8')](_0xa24e('0xd'),auth[_0xa24e('0xe')](),controller[_0xa24e('0xf')]);router[_0xa24e('0x8')](_0xa24e('0x10'),auth[_0xa24e('0xe')](),controller['getFields']);router[_0xa24e('0x11')]('/',auth[_0xa24e('0xe')](),controller[_0xa24e('0x12')]);router['put'](_0xa24e('0x9'),auth[_0xa24e('0xe')](),controller[_0xa24e('0x13')]);router[_0xa24e('0x14')](_0xa24e('0x9'),auth[_0xa24e('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5c09=['exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x5c09,0x143));var _0x95c0=function(_0x4b2092,_0x458854){_0x4b2092=_0x4b2092-0x0;var _0x2337c1=_0x5c09[_0x4b2092];return _0x2337c1;};'use strict';var multer=require('multer');var util=require(_0x95c0('0x0'));var path=require('path');var timeout=require(_0x95c0('0x1'));var express=require(_0x95c0('0x2'));var router=express['Router']();var auth=require(_0x95c0('0x3'));var interaction=require(_0x95c0('0x4'));var config=require(_0x95c0('0x5'));var controller=require(_0x95c0('0x6'));router['get']('/',auth[_0x95c0('0x7')](),controller[_0x95c0('0x8')]);router[_0x95c0('0x9')](_0x95c0('0xa'),auth[_0x95c0('0x7')](),controller['show']);router[_0x95c0('0x9')](_0x95c0('0xb'),auth[_0x95c0('0x7')](),controller[_0x95c0('0xc')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x95c0('0xd')]);router['get'](_0x95c0('0xe'),auth[_0x95c0('0x7')](),controller[_0x95c0('0xf')]);router[_0x95c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x95c0('0x11')]);router[_0x95c0('0x12')](_0x95c0('0xa'),auth[_0x95c0('0x7')](),controller[_0x95c0('0x13')]);router[_0x95c0('0x14')](_0x95c0('0xa'),auth['isAuthenticated'](),controller[_0x95c0('0x15')]);module[_0x95c0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 9720614..1b5c7d7 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 _0x42ce=['STRING','sequelize'];(function(_0x242df5,_0x263a0c){var _0x54475d=function(_0x259fad){while(--_0x259fad){_0x242df5['push'](_0x242df5['shift']());}};_0x54475d(++_0x263a0c);}(_0x42ce,0x1ed));var _0xe42c=function(_0x2929ac,_0x56a221){_0x2929ac=_0x2929ac-0x0;var _0x4e1633=_0x42ce[_0x2929ac];return _0x4e1633;};'use strict';var Sequelize=require(_0xe42c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe42c('0x1')]}}; \ No newline at end of file +var _0x1f35=['STRING','sequelize','exports'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0x1f35,0x121));var _0x51f3=function(_0x41a4bf,_0x514209){_0x41a4bf=_0x41a4bf-0x0;var _0x262d84=_0x1f35[_0x41a4bf];return _0x262d84;};'use strict';var Sequelize=require(_0x51f3('0x0'));module[_0x51f3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x51f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index d9fa52b..60be038 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 _0xd0a8=['merge','options','count','includeAll','include','findAll','show','params','create','body','find','FreshsalesField','pick','getSubjects','hasOwnProperty','findOne','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','save','update','destroy','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xd0a8,0x1e8));var _0x8d0a=function(_0x2e479f,_0x1bef04){_0x2e479f=_0x2e479f-0x0;var _0x23a61d=_0xd0a8[_0x2e479f];return _0x23a61d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8d0a('0x0'));var rimraf=require(_0x8d0a('0x1'));var zipdir=require(_0x8d0a('0x2'));var jsonpatch=require(_0x8d0a('0x3'));var rp=require(_0x8d0a('0x4'));var moment=require(_0x8d0a('0x5'));var BPromise=require(_0x8d0a('0x6'));var Mustache=require(_0x8d0a('0x7'));var util=require('util');var path=require(_0x8d0a('0x8'));var sox=require(_0x8d0a('0x9'));var csv=require(_0x8d0a('0xa'));var ejs=require(_0x8d0a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8d0a('0xc'));var crypto=require(_0x8d0a('0xd'));var jsforce=require(_0x8d0a('0xe'));var deskjs=require(_0x8d0a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8d0a('0x10'));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(_0x8d0a('0x11'));var logger=require(_0x8d0a('0x12'))(_0x8d0a('0x13'));var utils=require(_0x8d0a('0x14'));var config=require(_0x8d0a('0x15'));var db=require(_0x8d0a('0x16'))['db'];var jayson=require(_0x8d0a('0x17'));var client=jayson[_0x8d0a('0x18')][_0x8d0a('0x19')]({'port':0x232a});function checkPasswordPattern(_0x256721,_0x3ea97b,_0x26d00f){if(_0x26d00f){var _0x3d51e0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d51e0[_0x8d0a('0x1a')](_0x3ea97b)){return _0x256721;}else{throw new db[(_0x8d0a('0x1b'))][(_0x8d0a('0x1c'))](_0x8d0a('0x1d'));}}else{return _0x256721;}}function respondWithRpcPromise(_0x2ebb2e,_0x443780,_0x47a875,_0x2cac0f){return new BPromise(function(_0x459c9e,_0x2c97f2){var _0x18f1f1=_0x2cac0f||client;return _0x18f1f1[_0x8d0a('0x1e')](_0x2ebb2e,_0x47a875)[_0x8d0a('0x1f')](function(_0x175fbc){logger[_0x8d0a('0x20')](_0x8d0a('0x21'),_0x443780,_0x8d0a('0x22'));logger['debug'](_0x8d0a('0x23'),_0x443780,'request\x20sent',JSON[_0x8d0a('0x24')](_0x175fbc));if(_0x175fbc['error']){if(_0x175fbc['error'][_0x8d0a('0x25')]===0x1f4){logger[_0x8d0a('0x26')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x443780,_0x175fbc[_0x8d0a('0x26')][_0x8d0a('0x27')]);return _0x2c97f2(_0x175fbc[_0x8d0a('0x26')][_0x8d0a('0x27')]);}logger[_0x8d0a('0x26')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x443780,_0x175fbc[_0x8d0a('0x26')][_0x8d0a('0x27')]);return _0x459c9e(_0x175fbc['error'][_0x8d0a('0x27')]);}else{logger[_0x8d0a('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x443780,'request\x20sent');_0x459c9e(_0x175fbc[_0x8d0a('0x28')][_0x8d0a('0x27')]);}})[_0x8d0a('0x29')](function(_0x412788){logger[_0x8d0a('0x26')](_0x8d0a('0x21'),_0x443780,_0x412788);_0x2c97f2(_0x412788);});});}function respondWithStatusCode(_0x2397dd,_0x7ae2f5){_0x7ae2f5=_0x7ae2f5||0xcc;return function(_0x26d77b){if(_0x26d77b){return _0x2397dd[_0x8d0a('0x2a')](_0x7ae2f5);}return _0x2397dd['status'](_0x7ae2f5)[_0x8d0a('0x2b')]();};}function respondWithResult(_0xe75a22,_0x5791f9){_0x5791f9=_0x5791f9||0xc8;return function(_0xacbf11){if(_0xacbf11){return _0xe75a22['status'](_0x5791f9)[_0x8d0a('0x2c')](_0xacbf11);}};}function respondWithFilteredResult(_0x30f306,_0x5e9637){return function(_0x444424){if(_0x444424){var _0xac6e77=_0x444424['count'],_0x48a64f=_0x5e9637['offset'],_0x4fbfca=_0x5e9637[_0x8d0a('0x2d')]+_0x5e9637[_0x8d0a('0x2e')],_0x229bda;if(_0x4fbfca>=_0xac6e77){_0x4fbfca=_0xac6e77;_0x229bda=0xc8;}else{_0x229bda=0xce;}_0x30f306[_0x8d0a('0x2f')](_0x229bda);return _0x30f306[_0x8d0a('0x30')](_0x8d0a('0x31'),_0x48a64f+'-'+_0x4fbfca+'/'+_0xac6e77)[_0x8d0a('0x2c')](_0x444424);}return null;};}function patchUpdates(_0x5e217d){return function(_0x216626){try{jsonpatch[_0x8d0a('0x32')](_0x216626,_0x5e217d,!![]);}catch(_0x10d4cb){return BPromise['reject'](_0x10d4cb);}return _0x216626[_0x8d0a('0x33')]();};}function saveUpdates(_0x417249,_0x5c0ead){return function(_0x11755b){if(_0x11755b){return _0x11755b[_0x8d0a('0x34')](_0x417249)['then'](function(_0x5a376d){return _0x5a376d;});}return null;};}function removeEntity(_0xe61b39,_0x14dfca){return function(_0x3f73e7){if(_0x3f73e7){return _0x3f73e7[_0x8d0a('0x35')]()['then'](function(){_0xe61b39[_0x8d0a('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49dd95,_0x28300e){return function(_0x207ffa){if(!_0x207ffa){_0x49dd95[_0x8d0a('0x2a')](0x194);}return _0x207ffa;};}function handleError(_0x2e21ff,_0x1e58c3){_0x1e58c3=_0x1e58c3||0x1f4;return function(_0x1961e0){logger['error'](_0x1961e0[_0x8d0a('0x36')]);if(_0x1961e0[_0x8d0a('0x37')]){delete _0x1961e0['name'];}_0x2e21ff['status'](_0x1e58c3)[_0x8d0a('0x38')](_0x1961e0);};}exports['index']=function(_0x4825a0,_0x17fdc4){var _0x368bbe={},_0x41663b={},_0x465c0e={'count':0x0,'rows':[]};var _0x4e52d8=_[_0x8d0a('0x39')](db[_0x8d0a('0x3a')][_0x8d0a('0x3b')],function(_0x1b431f){return{'name':_0x1b431f[_0x8d0a('0x3c')],'type':_0x1b431f[_0x8d0a('0x3d')]['key']};});_0x41663b[_0x8d0a('0x3e')]=_[_0x8d0a('0x39')](_0x4e52d8,_0x8d0a('0x37'));_0x41663b[_0x8d0a('0x3f')]=_[_0x8d0a('0x40')](_0x4825a0['query']);_0x41663b[_0x8d0a('0x41')]=_[_0x8d0a('0x42')](_0x41663b[_0x8d0a('0x3e')],_0x41663b['query']);_0x368bbe[_0x8d0a('0x43')]=_[_0x8d0a('0x42')](_0x41663b['model'],qs[_0x8d0a('0x44')](_0x4825a0[_0x8d0a('0x3f')][_0x8d0a('0x44')]));_0x368bbe['attributes']=_0x368bbe[_0x8d0a('0x43')][_0x8d0a('0x45')]?_0x368bbe['attributes']:_0x41663b['model'];if(!_0x4825a0['query']['hasOwnProperty'](_0x8d0a('0x46'))){_0x368bbe[_0x8d0a('0x2e')]=qs[_0x8d0a('0x2e')](_0x4825a0[_0x8d0a('0x3f')][_0x8d0a('0x2e')]);_0x368bbe[_0x8d0a('0x2d')]=qs[_0x8d0a('0x2d')](_0x4825a0[_0x8d0a('0x3f')][_0x8d0a('0x2d')]);}_0x368bbe[_0x8d0a('0x47')]=qs[_0x8d0a('0x48')](_0x4825a0['query'][_0x8d0a('0x48')]);_0x368bbe[_0x8d0a('0x49')]=qs[_0x8d0a('0x41')](_['pick'](_0x4825a0[_0x8d0a('0x3f')],_0x41663b['filters']),_0x4e52d8);if(_0x4825a0[_0x8d0a('0x3f')][_0x8d0a('0x4a')]){_0x368bbe[_0x8d0a('0x49')]=_['merge'](_0x368bbe['where'],{'$or':_['map'](_0x4e52d8,function(_0x2b790c){if(_0x2b790c[_0x8d0a('0x3d')]!==_0x8d0a('0x4b')){var _0x5081dd={};_0x5081dd[_0x2b790c['name']]={'$like':'%'+_0x4825a0[_0x8d0a('0x3f')][_0x8d0a('0x4a')]+'%'};return _0x5081dd;}})});}_0x368bbe=_[_0x8d0a('0x4c')]({},_0x368bbe,_0x4825a0[_0x8d0a('0x4d')]);var _0x295a46={'where':_0x368bbe[_0x8d0a('0x49')]};return db['FreshsalesConfiguration'][_0x8d0a('0x4e')](_0x295a46)[_0x8d0a('0x1f')](function(_0x44ebef){_0x465c0e[_0x8d0a('0x4e')]=_0x44ebef;if(_0x4825a0[_0x8d0a('0x3f')][_0x8d0a('0x4f')]){_0x368bbe[_0x8d0a('0x50')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x8d0a('0x51')](_0x368bbe);})['then'](function(_0x2f26ac){_0x465c0e['rows']=_0x2f26ac;return _0x465c0e;})[_0x8d0a('0x1f')](respondWithFilteredResult(_0x17fdc4,_0x368bbe))[_0x8d0a('0x29')](handleError(_0x17fdc4,null));};exports[_0x8d0a('0x52')]=function(_0x3d9dba,_0x5971d3){var _0x17ddee={'raw':![],'where':{'id':_0x3d9dba[_0x8d0a('0x53')]['id']}},_0x229505={};_0x229505[_0x8d0a('0x3e')]=_[_0x8d0a('0x40')](db[_0x8d0a('0x3a')]['rawAttributes']);_0x229505[_0x8d0a('0x3f')]=_[_0x8d0a('0x40')](_0x3d9dba[_0x8d0a('0x3f')]);_0x229505['filters']=_[_0x8d0a('0x42')](_0x229505['model'],_0x229505[_0x8d0a('0x3f')]);_0x17ddee[_0x8d0a('0x43')]=_[_0x8d0a('0x42')](_0x229505[_0x8d0a('0x3e')],qs[_0x8d0a('0x44')](_0x3d9dba[_0x8d0a('0x3f')]['fields']));_0x17ddee['attributes']=_0x17ddee[_0x8d0a('0x43')][_0x8d0a('0x45')]?_0x17ddee['attributes']:_0x229505[_0x8d0a('0x3e')];if(_0x3d9dba[_0x8d0a('0x3f')]['includeAll']){_0x17ddee['include']=[{'all':!![]}];}_0x17ddee=_[_0x8d0a('0x4c')]({},_0x17ddee,_0x3d9dba[_0x8d0a('0x4d')]);return db[_0x8d0a('0x3a')]['find'](_0x17ddee)[_0x8d0a('0x1f')](handleEntityNotFound(_0x5971d3,null))['then'](respondWithResult(_0x5971d3,null))[_0x8d0a('0x29')](handleError(_0x5971d3,null));};exports[_0x8d0a('0x54')]=function(_0x893233,_0x3e84f7){return db[_0x8d0a('0x3a')][_0x8d0a('0x54')](_0x893233[_0x8d0a('0x55')],{})[_0x8d0a('0x1f')](respondWithResult(_0x3e84f7,0xc9))[_0x8d0a('0x29')](handleError(_0x3e84f7,null));};exports['update']=function(_0x40bbdc,_0x108dd6){if(_0x40bbdc[_0x8d0a('0x55')]['id']){delete _0x40bbdc['body']['id'];}return db[_0x8d0a('0x3a')][_0x8d0a('0x56')]({'where':{'id':_0x40bbdc[_0x8d0a('0x53')]['id']}})[_0x8d0a('0x1f')](handleEntityNotFound(_0x108dd6,null))[_0x8d0a('0x1f')](saveUpdates(_0x40bbdc['body'],null))['then'](respondWithResult(_0x108dd6,null))[_0x8d0a('0x29')](handleError(_0x108dd6,null));};exports[_0x8d0a('0x35')]=function(_0x3eebb9,_0x442a85){return db[_0x8d0a('0x3a')]['find']({'where':{'id':_0x3eebb9['params']['id']}})[_0x8d0a('0x1f')](handleEntityNotFound(_0x442a85,null))[_0x8d0a('0x1f')](removeEntity(_0x442a85,null))[_0x8d0a('0x29')](handleError(_0x442a85,null));};exports['getSubjects']=function(_0x15e30b,_0x4a3113,_0x435943){var _0x52ef7c={};var _0x2db769={};var _0x18deff;var _0x15ff88;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x15e30b[_0x8d0a('0x53')]['id']}})[_0x8d0a('0x1f')](handleEntityNotFound(_0x4a3113,null))['then'](function(_0xa5da09){if(_0xa5da09){_0x18deff=_0xa5da09;_0x2db769['model']=_['keys'](db[_0x8d0a('0x57')][_0x8d0a('0x3b')]);_0x2db769[_0x8d0a('0x3f')]=_[_0x8d0a('0x40')](_0x15e30b[_0x8d0a('0x3f')]);_0x2db769[_0x8d0a('0x41')]=_[_0x8d0a('0x42')](_0x2db769[_0x8d0a('0x3e')],_0x2db769['query']);_0x52ef7c[_0x8d0a('0x43')]=_['intersection'](_0x2db769[_0x8d0a('0x3e')],qs[_0x8d0a('0x44')](_0x15e30b[_0x8d0a('0x3f')][_0x8d0a('0x44')]));_0x52ef7c[_0x8d0a('0x43')]=_0x52ef7c['attributes']['length']?_0x52ef7c[_0x8d0a('0x43')]:_0x2db769[_0x8d0a('0x3e')];_0x52ef7c[_0x8d0a('0x47')]=qs['sort'](_0x15e30b[_0x8d0a('0x3f')]['sort']);_0x52ef7c['where']=qs['filters'](_[_0x8d0a('0x58')](_0x15e30b['query'],_0x2db769[_0x8d0a('0x41')]));if(_0x15e30b[_0x8d0a('0x3f')][_0x8d0a('0x4a')]){_0x52ef7c[_0x8d0a('0x49')]=_[_0x8d0a('0x4c')](_0x52ef7c['where'],{'$or':_[_0x8d0a('0x39')](_0x52ef7c[_0x8d0a('0x43')],function(_0xa41068){var _0x40fff7={};_0x40fff7[_0xa41068]={'$like':'%'+_0x15e30b[_0x8d0a('0x3f')][_0x8d0a('0x4a')]+'%'};return _0x40fff7;})});}_0x52ef7c=_['merge']({},_0x52ef7c,_0x15e30b[_0x8d0a('0x4d')]);return _0x18deff[_0x8d0a('0x59')](_0x52ef7c);}})['then'](function(_0x5d4b0f){if(_0x5d4b0f){_0x15ff88=_0x5d4b0f[_0x8d0a('0x45')];if(!_0x15e30b['query'][_0x8d0a('0x5a')]('nolimit')){_0x52ef7c['limit']=qs[_0x8d0a('0x2e')](_0x15e30b[_0x8d0a('0x3f')][_0x8d0a('0x2e')]);_0x52ef7c[_0x8d0a('0x2d')]=qs[_0x8d0a('0x2d')](_0x15e30b['query'][_0x8d0a('0x2d')]);}return _0x18deff[_0x8d0a('0x59')](_0x52ef7c);}})['then'](function(_0x3128e1){if(_0x3128e1){return _0x3128e1?{'count':_0x15ff88,'rows':_0x3128e1}:null;}})['then'](respondWithResult(_0x4a3113,null))[_0x8d0a('0x29')](handleError(_0x4a3113,null));};exports['getDescriptions']=function(_0x56413f,_0x3d55c3,_0x4c2fbc){var _0x142214={};var _0x39d01c={};var _0x4eeb9f;var _0x596340;return db[_0x8d0a('0x3a')][_0x8d0a('0x5b')]({'where':{'id':_0x56413f[_0x8d0a('0x53')]['id']}})[_0x8d0a('0x1f')](handleEntityNotFound(_0x3d55c3,null))[_0x8d0a('0x1f')](function(_0x6d54c1){if(_0x6d54c1){_0x4eeb9f=_0x6d54c1;_0x39d01c['model']=_[_0x8d0a('0x40')](db[_0x8d0a('0x57')][_0x8d0a('0x3b')]);_0x39d01c['query']=_['keys'](_0x56413f[_0x8d0a('0x3f')]);_0x39d01c[_0x8d0a('0x41')]=_[_0x8d0a('0x42')](_0x39d01c[_0x8d0a('0x3e')],_0x39d01c[_0x8d0a('0x3f')]);_0x142214['attributes']=_[_0x8d0a('0x42')](_0x39d01c['model'],qs['fields'](_0x56413f[_0x8d0a('0x3f')]['fields']));_0x142214['attributes']=_0x142214[_0x8d0a('0x43')][_0x8d0a('0x45')]?_0x142214[_0x8d0a('0x43')]:_0x39d01c[_0x8d0a('0x3e')];_0x142214['order']=qs['sort'](_0x56413f[_0x8d0a('0x3f')][_0x8d0a('0x48')]);_0x142214[_0x8d0a('0x49')]=qs[_0x8d0a('0x41')](_[_0x8d0a('0x58')](_0x56413f[_0x8d0a('0x3f')],_0x39d01c['filters']));if(_0x56413f[_0x8d0a('0x3f')]['filter']){_0x142214[_0x8d0a('0x49')]=_[_0x8d0a('0x4c')](_0x142214['where'],{'$or':_[_0x8d0a('0x39')](_0x142214['attributes'],function(_0x12e308){var _0xae2d2={};_0xae2d2[_0x12e308]={'$like':'%'+_0x56413f['query'][_0x8d0a('0x4a')]+'%'};return _0xae2d2;})});}_0x142214=_[_0x8d0a('0x4c')]({},_0x142214,_0x56413f[_0x8d0a('0x4d')]);return _0x4eeb9f[_0x8d0a('0x5c')](_0x142214);}})[_0x8d0a('0x1f')](function(_0x36ba55){if(_0x36ba55){_0x596340=_0x36ba55[_0x8d0a('0x45')];if(!_0x56413f['query']['hasOwnProperty'](_0x8d0a('0x46'))){_0x142214[_0x8d0a('0x2e')]=qs['limit'](_0x56413f[_0x8d0a('0x3f')]['limit']);_0x142214['offset']=qs[_0x8d0a('0x2d')](_0x56413f[_0x8d0a('0x3f')]['offset']);}return _0x4eeb9f['getDescriptions'](_0x142214);}})[_0x8d0a('0x1f')](function(_0x1af4f4){if(_0x1af4f4){return _0x1af4f4?{'count':_0x596340,'rows':_0x1af4f4}:null;}})[_0x8d0a('0x1f')](respondWithResult(_0x3d55c3,null))[_0x8d0a('0x29')](handleError(_0x3d55c3,null));};exports[_0x8d0a('0x5d')]=function(_0x12ac41,_0x104860,_0x5df927){var _0x593cea={};var _0x27a3c4={};var _0xfcc0e4;var _0x29320d;return db['FreshsalesConfiguration'][_0x8d0a('0x5b')]({'where':{'id':_0x12ac41[_0x8d0a('0x53')]['id']}})[_0x8d0a('0x1f')](handleEntityNotFound(_0x104860,null))['then'](function(_0x1f81f1){if(_0x1f81f1){_0xfcc0e4=_0x1f81f1;_0x27a3c4[_0x8d0a('0x3e')]=_[_0x8d0a('0x40')](db[_0x8d0a('0x57')]['rawAttributes']);_0x27a3c4['query']=_[_0x8d0a('0x40')](_0x12ac41[_0x8d0a('0x3f')]);_0x27a3c4[_0x8d0a('0x41')]=_[_0x8d0a('0x42')](_0x27a3c4[_0x8d0a('0x3e')],_0x27a3c4[_0x8d0a('0x3f')]);_0x593cea[_0x8d0a('0x43')]=_['intersection'](_0x27a3c4['model'],qs[_0x8d0a('0x44')](_0x12ac41[_0x8d0a('0x3f')][_0x8d0a('0x44')]));_0x593cea[_0x8d0a('0x43')]=_0x593cea[_0x8d0a('0x43')][_0x8d0a('0x45')]?_0x593cea['attributes']:_0x27a3c4['model'];_0x593cea[_0x8d0a('0x47')]=qs['sort'](_0x12ac41['query'][_0x8d0a('0x48')]);_0x593cea[_0x8d0a('0x49')]=qs['filters'](_['pick'](_0x12ac41[_0x8d0a('0x3f')],_0x27a3c4[_0x8d0a('0x41')]));if(_0x12ac41['query'][_0x8d0a('0x4a')]){_0x593cea['where']=_['merge'](_0x593cea['where'],{'$or':_[_0x8d0a('0x39')](_0x593cea[_0x8d0a('0x43')],function(_0x1aa1f6){var _0x232c2d={};_0x232c2d[_0x1aa1f6]={'$like':'%'+_0x12ac41[_0x8d0a('0x3f')][_0x8d0a('0x4a')]+'%'};return _0x232c2d;})});}_0x593cea=_[_0x8d0a('0x4c')]({},_0x593cea,_0x12ac41[_0x8d0a('0x4d')]);return _0xfcc0e4[_0x8d0a('0x5d')](_0x593cea);}})[_0x8d0a('0x1f')](function(_0x5b2b96){if(_0x5b2b96){_0x29320d=_0x5b2b96[_0x8d0a('0x45')];if(!_0x12ac41['query']['hasOwnProperty'](_0x8d0a('0x46'))){_0x593cea[_0x8d0a('0x2e')]=qs[_0x8d0a('0x2e')](_0x12ac41[_0x8d0a('0x3f')][_0x8d0a('0x2e')]);_0x593cea[_0x8d0a('0x2d')]=qs['offset'](_0x12ac41['query'][_0x8d0a('0x2d')]);}return _0xfcc0e4[_0x8d0a('0x5d')](_0x593cea);}})[_0x8d0a('0x1f')](function(_0x42e1b6){if(_0x42e1b6){return _0x42e1b6?{'count':_0x29320d,'rows':_0x42e1b6}:null;}})['then'](respondWithResult(_0x104860,null))[_0x8d0a('0x29')](handleError(_0x104860,null));}; \ No newline at end of file +var _0xb67e=['request-promise','bluebird','path','sox','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','request','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','status','end','count','offset','set','json','apply','save','then','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','update','body','find','getSubjects','getDescriptions','getFields','findOne','FreshsalesField','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x16bc50,_0x2cdca7){var _0x44ecdf=function(_0x4c7951){while(--_0x4c7951){_0x16bc50['push'](_0x16bc50['shift']());}};_0x44ecdf(++_0x2cdca7);}(_0xb67e,0x15c));var _0xeb67=function(_0x2e73bb,_0x5db782){_0x2e73bb=_0x2e73bb-0x0;var _0xe016c5=_0xb67e[_0x2e73bb];return _0xe016c5;};'use strict';var pdf=require(_0xeb67('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeb67('0x1'));var zipdir=require(_0xeb67('0x2'));var jsonpatch=require(_0xeb67('0x3'));var rp=require(_0xeb67('0x4'));var moment=require('moment');var BPromise=require(_0xeb67('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeb67('0x6'));var sox=require(_0xeb67('0x7'));var csv=require('to-csv');var ejs=require(_0xeb67('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xeb67('0x9'));var jsforce=require(_0xeb67('0xa'));var deskjs=require(_0xeb67('0xb'));var toCsv=require('to-csv');var querystring=require(_0xeb67('0xc'));var Papa=require('papaparse');var Redis=require(_0xeb67('0xd'));var authService=require(_0xeb67('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb67('0xf'));var logger=require(_0xeb67('0x10'))(_0xeb67('0x11'));var utils=require(_0xeb67('0x12'));var config=require(_0xeb67('0x13'));var db=require(_0xeb67('0x14'))['db'];var jayson=require(_0xeb67('0x15'));var client=jayson[_0xeb67('0x16')][_0xeb67('0x17')]({'port':0x232a});function checkPasswordPattern(_0x23db29,_0x49cdf0,_0x3e6bff){if(_0x3e6bff){var _0x4fb458=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4fb458[_0xeb67('0x18')](_0x49cdf0)){return _0x23db29;}else{throw new db[(_0xeb67('0x19'))]['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 _0x23db29;}}function respondWithRpcPromise(_0x39f042,_0x3808ab,_0x238536,_0x57ffd4){return new BPromise(function(_0x33dcf9,_0x2a596d){var _0x3793bc=_0x57ffd4||client;return _0x3793bc[_0xeb67('0x1a')](_0x39f042,_0x238536)['then'](function(_0x3fe37d){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3808ab,_0xeb67('0x1b'));logger[_0xeb67('0x1c')](_0xeb67('0x1d'),_0x3808ab,_0xeb67('0x1b'),JSON[_0xeb67('0x1e')](_0x3fe37d));if(_0x3fe37d['error']){if(_0x3fe37d[_0xeb67('0x1f')][_0xeb67('0x20')]===0x1f4){logger[_0xeb67('0x1f')](_0xeb67('0x21'),_0x3808ab,_0x3fe37d[_0xeb67('0x1f')][_0xeb67('0x22')]);return _0x2a596d(_0x3fe37d['error'][_0xeb67('0x22')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3808ab,_0x3fe37d[_0xeb67('0x1f')][_0xeb67('0x22')]);return _0x33dcf9(_0x3fe37d[_0xeb67('0x1f')][_0xeb67('0x22')]);}else{logger[_0xeb67('0x23')](_0xeb67('0x21'),_0x3808ab,_0xeb67('0x1b'));_0x33dcf9(_0x3fe37d['result'][_0xeb67('0x22')]);}})['catch'](function(_0x514c90){logger[_0xeb67('0x1f')](_0xeb67('0x21'),_0x3808ab,_0x514c90);_0x2a596d(_0x514c90);});});}function respondWithStatusCode(_0x2908fa,_0x524722){_0x524722=_0x524722||0xcc;return function(_0x5efba5){if(_0x5efba5){return _0x2908fa['sendStatus'](_0x524722);}return _0x2908fa[_0xeb67('0x24')](_0x524722)[_0xeb67('0x25')]();};}function respondWithResult(_0xd5a2c1,_0x5edac5){_0x5edac5=_0x5edac5||0xc8;return function(_0x5c26b1){if(_0x5c26b1){return _0xd5a2c1[_0xeb67('0x24')](_0x5edac5)['json'](_0x5c26b1);}};}function respondWithFilteredResult(_0x184ec3,_0xfc36ba){return function(_0x13a36e){if(_0x13a36e){var _0x36786e=_0x13a36e[_0xeb67('0x26')],_0x2adc7e=_0xfc36ba[_0xeb67('0x27')],_0x121145=_0xfc36ba[_0xeb67('0x27')]+_0xfc36ba['limit'],_0x12045a;if(_0x121145>=_0x36786e){_0x121145=_0x36786e;_0x12045a=0xc8;}else{_0x12045a=0xce;}_0x184ec3[_0xeb67('0x24')](_0x12045a);return _0x184ec3[_0xeb67('0x28')]('Content-Range',_0x2adc7e+'-'+_0x121145+'/'+_0x36786e)[_0xeb67('0x29')](_0x13a36e);}return null;};}function patchUpdates(_0x2a6037){return function(_0x13638a){try{jsonpatch[_0xeb67('0x2a')](_0x13638a,_0x2a6037,!![]);}catch(_0x36baf1){return BPromise['reject'](_0x36baf1);}return _0x13638a[_0xeb67('0x2b')]();};}function saveUpdates(_0x483a3f,_0x16b1b9){return function(_0x36781b){if(_0x36781b){return _0x36781b['update'](_0x483a3f)[_0xeb67('0x2c')](function(_0x21c2cb){return _0x21c2cb;});}return null;};}function removeEntity(_0x2ee5a8,_0x16c24b){return function(_0xfecd87){if(_0xfecd87){return _0xfecd87['destroy']()[_0xeb67('0x2c')](function(){_0x2ee5a8[_0xeb67('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b72b,_0x1be90d){return function(_0x85706f){if(!_0x85706f){_0x41b72b['sendStatus'](0x194);}return _0x85706f;};}function handleError(_0x531431,_0x59d1cb){_0x59d1cb=_0x59d1cb||0x1f4;return function(_0x36f9b1){logger['error'](_0x36f9b1['stack']);if(_0x36f9b1['name']){delete _0x36f9b1[_0xeb67('0x2d')];}_0x531431[_0xeb67('0x24')](_0x59d1cb)[_0xeb67('0x2e')](_0x36f9b1);};}exports[_0xeb67('0x2f')]=function(_0x25fff6,_0x23c009){var _0x1c618c={},_0x5c6353={},_0x297594={'count':0x0,'rows':[]};var _0x2af3af=_[_0xeb67('0x30')](db[_0xeb67('0x31')]['rawAttributes'],function(_0x3d9119){return{'name':_0x3d9119[_0xeb67('0x32')],'type':_0x3d9119[_0xeb67('0x33')][_0xeb67('0x34')]};});_0x5c6353[_0xeb67('0x35')]=_['map'](_0x2af3af,'name');_0x5c6353['query']=_[_0xeb67('0x36')](_0x25fff6['query']);_0x5c6353[_0xeb67('0x37')]=_[_0xeb67('0x38')](_0x5c6353[_0xeb67('0x35')],_0x5c6353[_0xeb67('0x39')]);_0x1c618c['attributes']=_[_0xeb67('0x38')](_0x5c6353[_0xeb67('0x35')],qs['fields'](_0x25fff6[_0xeb67('0x39')][_0xeb67('0x3a')]));_0x1c618c[_0xeb67('0x3b')]=_0x1c618c[_0xeb67('0x3b')][_0xeb67('0x3c')]?_0x1c618c['attributes']:_0x5c6353[_0xeb67('0x35')];if(!_0x25fff6[_0xeb67('0x39')][_0xeb67('0x3d')](_0xeb67('0x3e'))){_0x1c618c[_0xeb67('0x3f')]=qs[_0xeb67('0x3f')](_0x25fff6['query'][_0xeb67('0x3f')]);_0x1c618c[_0xeb67('0x27')]=qs[_0xeb67('0x27')](_0x25fff6[_0xeb67('0x39')][_0xeb67('0x27')]);}_0x1c618c[_0xeb67('0x40')]=qs[_0xeb67('0x41')](_0x25fff6[_0xeb67('0x39')][_0xeb67('0x41')]);_0x1c618c[_0xeb67('0x42')]=qs['filters'](_[_0xeb67('0x43')](_0x25fff6[_0xeb67('0x39')],_0x5c6353[_0xeb67('0x37')]),_0x2af3af);if(_0x25fff6[_0xeb67('0x39')]['filter']){_0x1c618c[_0xeb67('0x42')]=_['merge'](_0x1c618c[_0xeb67('0x42')],{'$or':_[_0xeb67('0x30')](_0x2af3af,function(_0x1c2023){if(_0x1c2023[_0xeb67('0x33')]!==_0xeb67('0x44')){var _0x11b558={};_0x11b558[_0x1c2023[_0xeb67('0x2d')]]={'$like':'%'+_0x25fff6[_0xeb67('0x39')][_0xeb67('0x45')]+'%'};return _0x11b558;}})});}_0x1c618c=_[_0xeb67('0x46')]({},_0x1c618c,_0x25fff6[_0xeb67('0x47')]);var _0x44bd6d={'where':_0x1c618c[_0xeb67('0x42')]};return db['FreshsalesConfiguration'][_0xeb67('0x26')](_0x44bd6d)['then'](function(_0x444fe0){_0x297594[_0xeb67('0x26')]=_0x444fe0;if(_0x25fff6[_0xeb67('0x39')][_0xeb67('0x48')]){_0x1c618c[_0xeb67('0x49')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1c618c);})['then'](function(_0x18f3bd){_0x297594[_0xeb67('0x4a')]=_0x18f3bd;return _0x297594;})[_0xeb67('0x2c')](respondWithFilteredResult(_0x23c009,_0x1c618c))[_0xeb67('0x4b')](handleError(_0x23c009,null));};exports[_0xeb67('0x4c')]=function(_0x2481ff,_0x2d2fce){var _0x44d6cc={'raw':![],'where':{'id':_0x2481ff[_0xeb67('0x4d')]['id']}},_0x2b1971={};_0x2b1971[_0xeb67('0x35')]=_[_0xeb67('0x36')](db[_0xeb67('0x31')][_0xeb67('0x4e')]);_0x2b1971[_0xeb67('0x39')]=_[_0xeb67('0x36')](_0x2481ff[_0xeb67('0x39')]);_0x2b1971[_0xeb67('0x37')]=_[_0xeb67('0x38')](_0x2b1971[_0xeb67('0x35')],_0x2b1971[_0xeb67('0x39')]);_0x44d6cc[_0xeb67('0x3b')]=_[_0xeb67('0x38')](_0x2b1971['model'],qs[_0xeb67('0x3a')](_0x2481ff[_0xeb67('0x39')][_0xeb67('0x3a')]));_0x44d6cc[_0xeb67('0x3b')]=_0x44d6cc[_0xeb67('0x3b')]['length']?_0x44d6cc[_0xeb67('0x3b')]:_0x2b1971['model'];if(_0x2481ff['query'][_0xeb67('0x48')]){_0x44d6cc[_0xeb67('0x49')]=[{'all':!![]}];}_0x44d6cc=_[_0xeb67('0x46')]({},_0x44d6cc,_0x2481ff[_0xeb67('0x47')]);return db[_0xeb67('0x31')]['find'](_0x44d6cc)[_0xeb67('0x2c')](handleEntityNotFound(_0x2d2fce,null))[_0xeb67('0x2c')](respondWithResult(_0x2d2fce,null))[_0xeb67('0x4b')](handleError(_0x2d2fce,null));};exports[_0xeb67('0x4f')]=function(_0x5747cd,_0x48f0f7){return db['FreshsalesConfiguration']['create'](_0x5747cd['body'],{})['then'](respondWithResult(_0x48f0f7,0xc9))['catch'](handleError(_0x48f0f7,null));};exports[_0xeb67('0x50')]=function(_0x336096,_0x4939a5){if(_0x336096[_0xeb67('0x51')]['id']){delete _0x336096[_0xeb67('0x51')]['id'];}return db[_0xeb67('0x31')][_0xeb67('0x52')]({'where':{'id':_0x336096[_0xeb67('0x4d')]['id']}})[_0xeb67('0x2c')](handleEntityNotFound(_0x4939a5,null))[_0xeb67('0x2c')](saveUpdates(_0x336096[_0xeb67('0x51')],null))[_0xeb67('0x2c')](respondWithResult(_0x4939a5,null))['catch'](handleError(_0x4939a5,null));};exports['destroy']=function(_0x217fcf,_0x1acf32){return db[_0xeb67('0x31')][_0xeb67('0x52')]({'where':{'id':_0x217fcf[_0xeb67('0x4d')]['id']}})[_0xeb67('0x2c')](handleEntityNotFound(_0x1acf32,null))[_0xeb67('0x2c')](removeEntity(_0x1acf32,null))[_0xeb67('0x4b')](handleError(_0x1acf32,null));};exports[_0xeb67('0x53')]=function(_0xda01d,_0x374217,_0x3512f2){var _0x4af6fd={};var _0x624cfc={};var _0x1f4112;var _0x2ec4cf;return db[_0xeb67('0x31')]['findOne']({'where':{'id':_0xda01d[_0xeb67('0x4d')]['id']}})[_0xeb67('0x2c')](handleEntityNotFound(_0x374217,null))[_0xeb67('0x2c')](function(_0x50a8c7){if(_0x50a8c7){_0x1f4112=_0x50a8c7;_0x624cfc['model']=_[_0xeb67('0x36')](db['FreshsalesField'][_0xeb67('0x4e')]);_0x624cfc[_0xeb67('0x39')]=_['keys'](_0xda01d[_0xeb67('0x39')]);_0x624cfc[_0xeb67('0x37')]=_[_0xeb67('0x38')](_0x624cfc[_0xeb67('0x35')],_0x624cfc[_0xeb67('0x39')]);_0x4af6fd[_0xeb67('0x3b')]=_['intersection'](_0x624cfc['model'],qs[_0xeb67('0x3a')](_0xda01d['query'][_0xeb67('0x3a')]));_0x4af6fd['attributes']=_0x4af6fd[_0xeb67('0x3b')][_0xeb67('0x3c')]?_0x4af6fd[_0xeb67('0x3b')]:_0x624cfc[_0xeb67('0x35')];_0x4af6fd[_0xeb67('0x40')]=qs['sort'](_0xda01d['query']['sort']);_0x4af6fd['where']=qs['filters'](_[_0xeb67('0x43')](_0xda01d[_0xeb67('0x39')],_0x624cfc['filters']));if(_0xda01d['query'][_0xeb67('0x45')]){_0x4af6fd[_0xeb67('0x42')]=_[_0xeb67('0x46')](_0x4af6fd['where'],{'$or':_['map'](_0x4af6fd[_0xeb67('0x3b')],function(_0x2e92fb){var _0x1c3547={};_0x1c3547[_0x2e92fb]={'$like':'%'+_0xda01d['query']['filter']+'%'};return _0x1c3547;})});}_0x4af6fd=_[_0xeb67('0x46')]({},_0x4af6fd,_0xda01d[_0xeb67('0x47')]);return _0x1f4112[_0xeb67('0x53')](_0x4af6fd);}})[_0xeb67('0x2c')](function(_0xf104d3){if(_0xf104d3){_0x2ec4cf=_0xf104d3[_0xeb67('0x3c')];if(!_0xda01d['query'][_0xeb67('0x3d')](_0xeb67('0x3e'))){_0x4af6fd[_0xeb67('0x3f')]=qs[_0xeb67('0x3f')](_0xda01d[_0xeb67('0x39')][_0xeb67('0x3f')]);_0x4af6fd[_0xeb67('0x27')]=qs['offset'](_0xda01d['query'][_0xeb67('0x27')]);}return _0x1f4112[_0xeb67('0x53')](_0x4af6fd);}})[_0xeb67('0x2c')](function(_0x747b8e){if(_0x747b8e){return _0x747b8e?{'count':_0x2ec4cf,'rows':_0x747b8e}:null;}})[_0xeb67('0x2c')](respondWithResult(_0x374217,null))[_0xeb67('0x4b')](handleError(_0x374217,null));};exports[_0xeb67('0x54')]=function(_0x5b7d95,_0x542138,_0x56777e){var _0x26104b={};var _0x5a1371={};var _0xf6cd5;var _0x281b52;return db[_0xeb67('0x31')]['findOne']({'where':{'id':_0x5b7d95[_0xeb67('0x4d')]['id']}})['then'](handleEntityNotFound(_0x542138,null))[_0xeb67('0x2c')](function(_0x9eff02){if(_0x9eff02){_0xf6cd5=_0x9eff02;_0x5a1371[_0xeb67('0x35')]=_[_0xeb67('0x36')](db['FreshsalesField'][_0xeb67('0x4e')]);_0x5a1371['query']=_[_0xeb67('0x36')](_0x5b7d95[_0xeb67('0x39')]);_0x5a1371['filters']=_[_0xeb67('0x38')](_0x5a1371[_0xeb67('0x35')],_0x5a1371[_0xeb67('0x39')]);_0x26104b[_0xeb67('0x3b')]=_[_0xeb67('0x38')](_0x5a1371['model'],qs[_0xeb67('0x3a')](_0x5b7d95[_0xeb67('0x39')][_0xeb67('0x3a')]));_0x26104b['attributes']=_0x26104b['attributes'][_0xeb67('0x3c')]?_0x26104b[_0xeb67('0x3b')]:_0x5a1371[_0xeb67('0x35')];_0x26104b['order']=qs[_0xeb67('0x41')](_0x5b7d95[_0xeb67('0x39')][_0xeb67('0x41')]);_0x26104b[_0xeb67('0x42')]=qs[_0xeb67('0x37')](_[_0xeb67('0x43')](_0x5b7d95[_0xeb67('0x39')],_0x5a1371[_0xeb67('0x37')]));if(_0x5b7d95[_0xeb67('0x39')][_0xeb67('0x45')]){_0x26104b[_0xeb67('0x42')]=_['merge'](_0x26104b[_0xeb67('0x42')],{'$or':_[_0xeb67('0x30')](_0x26104b[_0xeb67('0x3b')],function(_0xe8d320){var _0x559df2={};_0x559df2[_0xe8d320]={'$like':'%'+_0x5b7d95['query'][_0xeb67('0x45')]+'%'};return _0x559df2;})});}_0x26104b=_[_0xeb67('0x46')]({},_0x26104b,_0x5b7d95[_0xeb67('0x47')]);return _0xf6cd5[_0xeb67('0x54')](_0x26104b);}})[_0xeb67('0x2c')](function(_0x50a571){if(_0x50a571){_0x281b52=_0x50a571['length'];if(!_0x5b7d95[_0xeb67('0x39')][_0xeb67('0x3d')]('nolimit')){_0x26104b[_0xeb67('0x3f')]=qs[_0xeb67('0x3f')](_0x5b7d95['query'][_0xeb67('0x3f')]);_0x26104b['offset']=qs['offset'](_0x5b7d95[_0xeb67('0x39')][_0xeb67('0x27')]);}return _0xf6cd5[_0xeb67('0x54')](_0x26104b);}})[_0xeb67('0x2c')](function(_0x2c2cd3){if(_0x2c2cd3){return _0x2c2cd3?{'count':_0x281b52,'rows':_0x2c2cd3}:null;}})[_0xeb67('0x2c')](respondWithResult(_0x542138,null))[_0xeb67('0x4b')](handleError(_0x542138,null));};exports[_0xeb67('0x55')]=function(_0x4827c6,_0x2ab898,_0x33046c){var _0x6b3b46={};var _0x34eaed={};var _0xc95bf4;var _0x1bf0cf;return db[_0xeb67('0x31')][_0xeb67('0x56')]({'where':{'id':_0x4827c6[_0xeb67('0x4d')]['id']}})[_0xeb67('0x2c')](handleEntityNotFound(_0x2ab898,null))[_0xeb67('0x2c')](function(_0x5eae79){if(_0x5eae79){_0xc95bf4=_0x5eae79;_0x34eaed['model']=_[_0xeb67('0x36')](db[_0xeb67('0x57')][_0xeb67('0x4e')]);_0x34eaed[_0xeb67('0x39')]=_['keys'](_0x4827c6['query']);_0x34eaed[_0xeb67('0x37')]=_[_0xeb67('0x38')](_0x34eaed[_0xeb67('0x35')],_0x34eaed[_0xeb67('0x39')]);_0x6b3b46[_0xeb67('0x3b')]=_[_0xeb67('0x38')](_0x34eaed[_0xeb67('0x35')],qs[_0xeb67('0x3a')](_0x4827c6[_0xeb67('0x39')][_0xeb67('0x3a')]));_0x6b3b46[_0xeb67('0x3b')]=_0x6b3b46[_0xeb67('0x3b')][_0xeb67('0x3c')]?_0x6b3b46['attributes']:_0x34eaed[_0xeb67('0x35')];_0x6b3b46[_0xeb67('0x40')]=qs[_0xeb67('0x41')](_0x4827c6['query'][_0xeb67('0x41')]);_0x6b3b46[_0xeb67('0x42')]=qs[_0xeb67('0x37')](_['pick'](_0x4827c6[_0xeb67('0x39')],_0x34eaed[_0xeb67('0x37')]));if(_0x4827c6[_0xeb67('0x39')][_0xeb67('0x45')]){_0x6b3b46['where']=_[_0xeb67('0x46')](_0x6b3b46[_0xeb67('0x42')],{'$or':_[_0xeb67('0x30')](_0x6b3b46[_0xeb67('0x3b')],function(_0x1f6de5){var _0xb89e80={};_0xb89e80[_0x1f6de5]={'$like':'%'+_0x4827c6['query'][_0xeb67('0x45')]+'%'};return _0xb89e80;})});}_0x6b3b46=_[_0xeb67('0x46')]({},_0x6b3b46,_0x4827c6['options']);return _0xc95bf4[_0xeb67('0x55')](_0x6b3b46);}})[_0xeb67('0x2c')](function(_0x5dec8f){if(_0x5dec8f){_0x1bf0cf=_0x5dec8f[_0xeb67('0x3c')];if(!_0x4827c6[_0xeb67('0x39')][_0xeb67('0x3d')](_0xeb67('0x3e'))){_0x6b3b46[_0xeb67('0x3f')]=qs[_0xeb67('0x3f')](_0x4827c6[_0xeb67('0x39')]['limit']);_0x6b3b46[_0xeb67('0x27')]=qs[_0xeb67('0x27')](_0x4827c6['query'][_0xeb67('0x27')]);}return _0xc95bf4[_0xeb67('0x55')](_0x6b3b46);}})[_0xeb67('0x2c')](function(_0x7ae97){if(_0x7ae97){return _0x7ae97?{'count':_0x1bf0cf,'rows':_0x7ae97}:null;}})[_0xeb67('0x2c')](respondWithResult(_0x2ab898,null))[_0xeb67('0x4b')](handleError(_0x2ab898,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 43abc2d..599578c 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 _0xb951=['int_freshsales_configurations','lodash','util','api','moment','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x5004d5,_0x50ab11){var _0x33469a=function(_0x270937){while(--_0x270937){_0x5004d5['push'](_0x5004d5['shift']());}};_0x33469a(++_0x50ab11);}(_0xb951,0x139));var _0x1b95=function(_0x2bff01,_0x1d1396){_0x2bff01=_0x2bff01-0x0;var _0x9e6bef=_0xb951[_0x2bff01];return _0x9e6bef;};'use strict';var _=require(_0x1b95('0x0'));var util=require(_0x1b95('0x1'));var logger=require('../../config/logger')(_0x1b95('0x2'));var moment=require(_0x1b95('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b95('0x4'));var fs=require('fs');var path=require(_0x1b95('0x5'));var rimraf=require('rimraf');var config=require(_0x1b95('0x6'));var attributes=require(_0x1b95('0x7'));module[_0x1b95('0x8')]=function(_0x22a97a,_0x5babbb){return _0x22a97a[_0x1b95('0x9')](_0x1b95('0xa'),attributes,{'tableName':_0x1b95('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd9a=['FreshsalesConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./intFreshsalesConfiguration.attributes','exports'];(function(_0x46a38b,_0x16ffb5){var _0x346e75=function(_0x34f8d0){while(--_0x34f8d0){_0x46a38b['push'](_0x46a38b['shift']());}};_0x346e75(++_0x16ffb5);}(_0xfd9a,0x12d));var _0xafd9=function(_0x199e76,_0x442c6f){_0x199e76=_0x199e76-0x0;var _0x1a640a=_0xfd9a[_0x199e76];return _0x1a640a;};'use strict';var _=require(_0xafd9('0x0'));var util=require(_0xafd9('0x1'));var logger=require(_0xafd9('0x2'))('api');var moment=require(_0xafd9('0x3'));var BPromise=require(_0xafd9('0x4'));var rp=require(_0xafd9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafd9('0x6'));var config=require('../../config/environment');var attributes=require(_0xafd9('0x7'));module[_0xafd9('0x8')]=function(_0xd3c186,_0x393ad9){return _0xd3c186['define'](_0xafd9('0x9'),attributes,{'tableName':'int_freshsales_configurations','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 3401143..2eb8f2b 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 _0xfb71=['request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2fdbbb,_0x557b4e){var _0x2eac63=function(_0x56cf4d){while(--_0x56cf4d){_0x2fdbbb['push'](_0x2fdbbb['shift']());}};_0x2eac63(++_0x557b4e);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x2d558f,_0x30a473){_0x2d558f=_0x2d558f-0x0;var _0x398589=_0xfb71[_0x2d558f];return _0x398589;};'use strict';var _=require(_0x1fb7('0x0'));var util=require(_0x1fb7('0x1'));var moment=require(_0x1fb7('0x2'));var BPromise=require(_0x1fb7('0x3'));var rs=require(_0x1fb7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1fb7('0x5'));var logger=require(_0x1fb7('0x6'))(_0x1fb7('0x7'));var config=require('../../config/environment');var jayson=require(_0x1fb7('0x8'));var client=jayson[_0x1fb7('0x9')][_0x1fb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2112f8,_0x42fc30,_0x45742f){return new BPromise(function(_0x4abac2,_0x287b4a){return client[_0x1fb7('0xb')](_0x2112f8,_0x45742f)['then'](function(_0x968df9){logger[_0x1fb7('0xc')](_0x1fb7('0xd'),_0x42fc30,_0x1fb7('0xe'));logger[_0x1fb7('0xf')](_0x1fb7('0x10'),_0x42fc30,'request\x20sent',JSON['stringify'](_0x968df9));if(_0x968df9[_0x1fb7('0x11')]){if(_0x968df9[_0x1fb7('0x11')][_0x1fb7('0x12')]===0x1f4){logger['error'](_0x1fb7('0xd'),_0x42fc30,_0x968df9[_0x1fb7('0x11')][_0x1fb7('0x13')]);return _0x287b4a(_0x968df9['error']['message']);}logger[_0x1fb7('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x42fc30,_0x968df9['error'][_0x1fb7('0x13')]);return _0x4abac2(_0x968df9['error'][_0x1fb7('0x13')]);}else{logger[_0x1fb7('0xc')](_0x1fb7('0xd'),_0x42fc30,_0x1fb7('0xe'));_0x4abac2(_0x968df9[_0x1fb7('0x14')][_0x1fb7('0x13')]);}})[_0x1fb7('0x15')](function(_0x3126bf){logger[_0x1fb7('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x42fc30,_0x3126bf);_0x287b4a(_0x3126bf);});});} \ No newline at end of file +var _0x6822=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','FreshsalesConfiguration,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring'];(function(_0x45313f,_0x46caf4){var _0x402910=function(_0x4883d8){while(--_0x4883d8){_0x45313f['push'](_0x45313f['shift']());}};_0x402910(++_0x46caf4);}(_0x6822,0x18c));var _0x2682=function(_0x7e70b9,_0x4ac69e){_0x7e70b9=_0x7e70b9-0x0;var _0x25c261=_0x6822[_0x7e70b9];return _0x25c261;};'use strict';var _=require('lodash');var util=require(_0x2682('0x0'));var moment=require(_0x2682('0x1'));var BPromise=require(_0x2682('0x2'));var rs=require(_0x2682('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2682('0x4'))['db'];var utils=require(_0x2682('0x5'));var logger=require(_0x2682('0x6'))(_0x2682('0x7'));var config=require(_0x2682('0x8'));var jayson=require(_0x2682('0x9'));var client=jayson[_0x2682('0xa')][_0x2682('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35f55b,_0x3f706c,_0x4242c5){return new BPromise(function(_0x1a1307,_0x303fe4){return client[_0x2682('0xc')](_0x35f55b,_0x4242c5)['then'](function(_0x3e72bc){logger[_0x2682('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3f706c,'request\x20sent');logger['debug'](_0x2682('0xe'),_0x3f706c,_0x2682('0xf'),JSON['stringify'](_0x3e72bc));if(_0x3e72bc[_0x2682('0x10')]){if(_0x3e72bc[_0x2682('0x10')]['code']===0x1f4){logger[_0x2682('0x10')](_0x2682('0x11'),_0x3f706c,_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);return _0x303fe4(_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);}logger[_0x2682('0x10')](_0x2682('0x11'),_0x3f706c,_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);return _0x1a1307(_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);}else{logger[_0x2682('0xd')](_0x2682('0x11'),_0x3f706c,_0x2682('0xf'));_0x1a1307(_0x3e72bc['result']['message']);}})[_0x2682('0x13')](function(_0x2b1ed2){logger[_0x2682('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3f706c,_0x2b1ed2);_0x303fe4(_0x2b1ed2);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index bcbfee7..494eea8 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 _0x819d=['get','isAuthenticated','/:id','show','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x36087c,_0x34daad){var _0x24563e=function(_0x485aa8){while(--_0x485aa8){_0x36087c['push'](_0x36087c['shift']());}};_0x24563e(++_0x34daad);}(_0x819d,0x1a7));var _0xd819=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x819d[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0xd819('0x0'));var util=require(_0xd819('0x1'));var path=require(_0xd819('0x2'));var timeout=require('connect-timeout');var express=require(_0xd819('0x3'));var router=express[_0xd819('0x4')]();var auth=require(_0xd819('0x5'));var interaction=require(_0xd819('0x6'));var config=require(_0xd819('0x7'));var controller=require(_0xd819('0x8'));router[_0xd819('0x9')]('/',auth[_0xd819('0xa')](),controller['index']);router[_0xd819('0x9')](_0xd819('0xb'),auth['isAuthenticated'](),controller[_0xd819('0xc')]);router['post']('/',auth[_0xd819('0xa')](),controller[_0xd819('0xd')]);router[_0xd819('0xe')](_0xd819('0xb'),auth[_0xd819('0xa')](),controller[_0xd819('0xf')]);router[_0xd819('0x10')](_0xd819('0xb'),auth[_0xd819('0xa')](),controller['destroy']);module[_0xd819('0x11')]=router; \ No newline at end of file +var _0xfee5=['../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x45de5a,_0x2b42b1){var _0x5f40e7=function(_0x48a922){while(--_0x48a922){_0x45de5a['push'](_0x45de5a['shift']());}};_0x5f40e7(++_0x2b42b1);}(_0xfee5,0x11a));var _0x5fee=function(_0x71c287,_0x43426c){_0x71c287=_0x71c287-0x0;var _0x439987=_0xfee5[_0x71c287];return _0x439987;};'use strict';var multer=require('multer');var util=require(_0x5fee('0x0'));var path=require(_0x5fee('0x1'));var timeout=require(_0x5fee('0x2'));var express=require(_0x5fee('0x3'));var router=express['Router']();var auth=require(_0x5fee('0x4'));var interaction=require(_0x5fee('0x5'));var config=require(_0x5fee('0x6'));var controller=require(_0x5fee('0x7'));router[_0x5fee('0x8')]('/',auth[_0x5fee('0x9')](),controller['index']);router[_0x5fee('0x8')](_0x5fee('0xa'),auth[_0x5fee('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5fee('0xb')]);router[_0x5fee('0xc')](_0x5fee('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5fee('0xd')]('/:id',auth[_0x5fee('0x9')](),controller[_0x5fee('0xe')]);module[_0x5fee('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 64ea7b3..a3b65e2 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 _0x1c0a=['customVariable','BOOLEAN','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x2c2b58,_0x58e092){var _0x50c466=function(_0x4ee393){while(--_0x4ee393){_0x2c2b58['push'](_0x2c2b58['shift']());}};_0x50c466(++_0x58e092);}(_0x1c0a,0x14a));var _0xa1c0=function(_0x48ac3f,_0x5c612f){_0x48ac3f=_0x48ac3f-0x0;var _0x2bb971=_0x1c0a[_0x48ac3f];return _0x2bb971;};'use strict';var Sequelize=require('sequelize');module[_0xa1c0('0x0')]={'type':{'type':Sequelize[_0xa1c0('0x1')](_0xa1c0('0x2'),_0xa1c0('0x3'),'customVariable',_0xa1c0('0x4')),'defaultValue':_0xa1c0('0x2')},'content':{'type':Sequelize[_0xa1c0('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa1c0('0x1')](_0xa1c0('0x2'),_0xa1c0('0x3'),_0xa1c0('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa1c0('0x5')]},'nameField':{'type':Sequelize[_0xa1c0('0x5')]},'customField':{'type':Sequelize[_0xa1c0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2e01=['STRING','customVariable','exports','ENUM','string','variable','keyValue'];(function(_0x1f2ef9,_0x28dee6){var _0x5aa6c1=function(_0x28f4f0){while(--_0x28f4f0){_0x1f2ef9['push'](_0x1f2ef9['shift']());}};_0x5aa6c1(++_0x28dee6);}(_0x2e01,0x1d0));var _0x12e0=function(_0x202076,_0x9c9f87){_0x202076=_0x202076-0x0;var _0x35fca6=_0x2e01[_0x202076];return _0x35fca6;};'use strict';var Sequelize=require('sequelize');module[_0x12e0('0x0')]={'type':{'type':Sequelize[_0x12e0('0x1')](_0x12e0('0x2'),_0x12e0('0x3'),'customVariable',_0x12e0('0x4')),'defaultValue':_0x12e0('0x2')},'content':{'type':Sequelize[_0x12e0('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x12e0('0x2'),_0x12e0('0x3'),_0x12e0('0x6'))},'keyContent':{'type':Sequelize[_0x12e0('0x5')]},'idField':{'type':Sequelize[_0x12e0('0x5')]},'nameField':{'type':Sequelize[_0x12e0('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x12e0('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 5d08764..6e36520 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 _0xb27f=['bluebird','util','path','sox','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','length','include','create','update','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x4b2421,_0x47eab6){var _0x2be003=function(_0xf23bb3){while(--_0xf23bb3){_0x4b2421['push'](_0x4b2421['shift']());}};_0x2be003(++_0x47eab6);}(_0xb27f,0x158));var _0xfb27=function(_0x56536b,_0x3206b3){_0x56536b=_0x56536b-0x0;var _0x27066a=_0xb27f[_0x56536b];return _0x27066a;};'use strict';var pdf=require(_0xfb27('0x0'));var emlformat=require(_0xfb27('0x1'));var rimraf=require(_0xfb27('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb27('0x3'));var rp=require(_0xfb27('0x4'));var moment=require(_0xfb27('0x5'));var BPromise=require(_0xfb27('0x6'));var Mustache=require('mustache');var util=require(_0xfb27('0x7'));var path=require(_0xfb27('0x8'));var sox=require(_0xfb27('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb27('0xa'));var squel=require(_0xfb27('0xb'));var crypto=require('crypto');var jsforce=require(_0xfb27('0xc'));var deskjs=require(_0xfb27('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfb27('0xe'));var Redis=require(_0xfb27('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfb27('0x10'));var as=require(_0xfb27('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfb27('0x12'));var utils=require(_0xfb27('0x13'));var config=require('../../config/environment');var db=require(_0xfb27('0x14'))['db'];function respondWithStatusCode(_0x5b74a8,_0x5a6b2c){_0x5a6b2c=_0x5a6b2c||0xcc;return function(_0x22964c){if(_0x22964c){return _0x5b74a8[_0xfb27('0x15')](_0x5a6b2c);}return _0x5b74a8['status'](_0x5a6b2c)[_0xfb27('0x16')]();};}function respondWithResult(_0x23dfc8,_0x5ca2cd){_0x5ca2cd=_0x5ca2cd||0xc8;return function(_0x10476f){if(_0x10476f){return _0x23dfc8[_0xfb27('0x17')](_0x5ca2cd)[_0xfb27('0x18')](_0x10476f);}};}function respondWithFilteredResult(_0x4507be,_0x3a3799){return function(_0x2f02ec){if(_0x2f02ec){var _0xb956fe=_0x2f02ec[_0xfb27('0x19')],_0x130117=_0x3a3799[_0xfb27('0x1a')],_0x1cefbc=_0x3a3799[_0xfb27('0x1a')]+_0x3a3799[_0xfb27('0x1b')],_0x16a18f;if(_0x1cefbc>=_0xb956fe){_0x1cefbc=_0xb956fe;_0x16a18f=0xc8;}else{_0x16a18f=0xce;}_0x4507be[_0xfb27('0x17')](_0x16a18f);return _0x4507be[_0xfb27('0x1c')](_0xfb27('0x1d'),_0x130117+'-'+_0x1cefbc+'/'+_0xb956fe)[_0xfb27('0x18')](_0x2f02ec);}return null;};}function patchUpdates(_0x39bbba){return function(_0x427629){try{jsonpatch[_0xfb27('0x1e')](_0x427629,_0x39bbba,!![]);}catch(_0x4f84f8){return BPromise[_0xfb27('0x1f')](_0x4f84f8);}return _0x427629['save']();};}function saveUpdates(_0x560b81,_0x5c4cd3){return function(_0x3c853e){if(_0x3c853e){return _0x3c853e['update'](_0x560b81)[_0xfb27('0x20')](function(_0x15dd22){return _0x15dd22;});}return null;};}function removeEntity(_0x48f4ca,_0x3635a8){return function(_0x1a8924){if(_0x1a8924){return _0x1a8924[_0xfb27('0x21')]()[_0xfb27('0x20')](function(){_0x48f4ca[_0xfb27('0x17')](0xcc)[_0xfb27('0x16')]();});}};}function handleEntityNotFound(_0x4280e9,_0x38990e){return function(_0x4343fe){if(!_0x4343fe){_0x4280e9[_0xfb27('0x15')](0x194);}return _0x4343fe;};}function handleError(_0x4df60d,_0x36b57c){_0x36b57c=_0x36b57c||0x1f4;return function(_0x37f02f){logger['error'](_0x37f02f[_0xfb27('0x22')]);if(_0x37f02f[_0xfb27('0x23')]){delete _0x37f02f[_0xfb27('0x23')];}_0x4df60d['status'](_0x36b57c)[_0xfb27('0x24')](_0x37f02f);};}exports['index']=function(_0x533d17,_0x4030f8){var _0x272df1={},_0x400536={},_0x322af6={'count':0x0,'rows':[]};var _0x41280e=_[_0xfb27('0x25')](db[_0xfb27('0x26')][_0xfb27('0x27')],function(_0x5f11f6){return{'name':_0x5f11f6[_0xfb27('0x28')],'type':_0x5f11f6[_0xfb27('0x29')][_0xfb27('0x2a')]};});_0x400536['model']=_['map'](_0x41280e,_0xfb27('0x23'));_0x400536[_0xfb27('0x2b')]=_[_0xfb27('0x2c')](_0x533d17[_0xfb27('0x2b')]);_0x400536[_0xfb27('0x2d')]=_[_0xfb27('0x2e')](_0x400536[_0xfb27('0x2f')],_0x400536['query']);_0x272df1[_0xfb27('0x30')]=_['intersection'](_0x400536['model'],qs[_0xfb27('0x31')](_0x533d17['query'][_0xfb27('0x31')]));_0x272df1['attributes']=_0x272df1[_0xfb27('0x30')]['length']?_0x272df1[_0xfb27('0x30')]:_0x400536[_0xfb27('0x2f')];if(!_0x533d17[_0xfb27('0x2b')][_0xfb27('0x32')](_0xfb27('0x33'))){_0x272df1[_0xfb27('0x1b')]=qs[_0xfb27('0x1b')](_0x533d17[_0xfb27('0x2b')]['limit']);_0x272df1[_0xfb27('0x1a')]=qs['offset'](_0x533d17['query'][_0xfb27('0x1a')]);}_0x272df1[_0xfb27('0x34')]=qs['sort'](_0x533d17[_0xfb27('0x2b')][_0xfb27('0x35')]);_0x272df1['where']=qs[_0xfb27('0x2d')](_['pick'](_0x533d17[_0xfb27('0x2b')],_0x400536[_0xfb27('0x2d')]),_0x41280e);if(_0x533d17[_0xfb27('0x2b')]['filter']){_0x272df1[_0xfb27('0x36')]=_['merge'](_0x272df1['where'],{'$or':_[_0xfb27('0x25')](_0x41280e,function(_0x5a3739){if(_0x5a3739['type']!==_0xfb27('0x37')){var _0x33dff7={};_0x33dff7[_0x5a3739[_0xfb27('0x23')]]={'$like':'%'+_0x533d17[_0xfb27('0x2b')]['filter']+'%'};return _0x33dff7;}})});}_0x272df1=_[_0xfb27('0x38')]({},_0x272df1,_0x533d17[_0xfb27('0x39')]);var _0x58ebe0={'where':_0x272df1['where']};return db[_0xfb27('0x26')][_0xfb27('0x19')](_0x58ebe0)['then'](function(_0x5d0c39){_0x322af6[_0xfb27('0x19')]=_0x5d0c39;if(_0x533d17[_0xfb27('0x2b')][_0xfb27('0x3a')]){_0x272df1['include']=[{'all':!![]}];}return db[_0xfb27('0x26')][_0xfb27('0x3b')](_0x272df1);})[_0xfb27('0x20')](function(_0x1f1699){_0x322af6[_0xfb27('0x3c')]=_0x1f1699;return _0x322af6;})[_0xfb27('0x20')](respondWithFilteredResult(_0x4030f8,_0x272df1))[_0xfb27('0x3d')](handleError(_0x4030f8,null));};exports[_0xfb27('0x3e')]=function(_0x15a52c,_0x18cf47){var _0x3d1693={'raw':!![],'where':{'id':_0x15a52c[_0xfb27('0x3f')]['id']}},_0x46aa77={};_0x46aa77[_0xfb27('0x2f')]=_[_0xfb27('0x2c')](db[_0xfb27('0x26')][_0xfb27('0x27')]);_0x46aa77[_0xfb27('0x2b')]=_[_0xfb27('0x2c')](_0x15a52c[_0xfb27('0x2b')]);_0x46aa77['filters']=_[_0xfb27('0x2e')](_0x46aa77[_0xfb27('0x2f')],_0x46aa77['query']);_0x3d1693['attributes']=_['intersection'](_0x46aa77[_0xfb27('0x2f')],qs['fields'](_0x15a52c[_0xfb27('0x2b')]['fields']));_0x3d1693[_0xfb27('0x30')]=_0x3d1693['attributes'][_0xfb27('0x40')]?_0x3d1693[_0xfb27('0x30')]:_0x46aa77['model'];if(_0x15a52c['query'][_0xfb27('0x3a')]){_0x3d1693[_0xfb27('0x41')]=[{'all':!![]}];}_0x3d1693=_['merge']({},_0x3d1693,_0x15a52c['options']);return db[_0xfb27('0x26')]['find'](_0x3d1693)[_0xfb27('0x20')](handleEntityNotFound(_0x18cf47,null))[_0xfb27('0x20')](respondWithResult(_0x18cf47,null))[_0xfb27('0x3d')](handleError(_0x18cf47,null));};exports[_0xfb27('0x42')]=function(_0x564d07,_0x3b5767){return db[_0xfb27('0x26')][_0xfb27('0x42')](_0x564d07['body'],{})[_0xfb27('0x20')](respondWithResult(_0x3b5767,0xc9))[_0xfb27('0x3d')](handleError(_0x3b5767,null));};exports[_0xfb27('0x43')]=function(_0x113b06,_0x1725da){if(_0x113b06[_0xfb27('0x44')]['id']){delete _0x113b06[_0xfb27('0x44')]['id'];}return db['FreshsalesField'][_0xfb27('0x45')]({'where':{'id':_0x113b06[_0xfb27('0x3f')]['id']}})[_0xfb27('0x20')](handleEntityNotFound(_0x1725da,null))[_0xfb27('0x20')](saveUpdates(_0x113b06['body'],null))['then'](respondWithResult(_0x1725da,null))['catch'](handleError(_0x1725da,null));};exports['destroy']=function(_0x30459b,_0x5238f8){return db['FreshsalesField'][_0xfb27('0x45')]({'where':{'id':_0x30459b[_0xfb27('0x3f')]['id']}})[_0xfb27('0x20')](handleEntityNotFound(_0x5238f8,null))[_0xfb27('0x20')](removeEntity(_0x5238f8,null))[_0xfb27('0x3d')](handleError(_0x5238f8,null));}; \ No newline at end of file +var _0x9e2b=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x9e2b,0x15a));var _0xb9e2=function(_0x27b03c,_0x14e71a){_0x27b03c=_0x27b03c-0x0;var _0x3099ba=_0x9e2b[_0x27b03c];return _0x3099ba;};'use strict';var pdf=require(_0xb9e2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb9e2('0x1'));var zipdir=require(_0xb9e2('0x2'));var jsonpatch=require(_0xb9e2('0x3'));var rp=require(_0xb9e2('0x4'));var moment=require('moment');var BPromise=require(_0xb9e2('0x5'));var Mustache=require(_0xb9e2('0x6'));var util=require(_0xb9e2('0x7'));var path=require(_0xb9e2('0x8'));var sox=require(_0xb9e2('0x9'));var csv=require('to-csv');var ejs=require(_0xb9e2('0xa'));var fs=require('fs');var _=require(_0xb9e2('0xb'));var squel=require(_0xb9e2('0xc'));var crypto=require(_0xb9e2('0xd'));var jsforce=require(_0xb9e2('0xe'));var deskjs=require(_0xb9e2('0xf'));var toCsv=require(_0xb9e2('0x10'));var querystring=require('querystring');var Papa=require(_0xb9e2('0x11'));var Redis=require(_0xb9e2('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb9e2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9e2('0x14'))(_0xb9e2('0x15'));var utils=require(_0xb9e2('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42a369,_0xaad36f){_0xaad36f=_0xaad36f||0xcc;return function(_0x453a3b){if(_0x453a3b){return _0x42a369['sendStatus'](_0xaad36f);}return _0x42a369[_0xb9e2('0x17')](_0xaad36f)[_0xb9e2('0x18')]();};}function respondWithResult(_0x57ff73,_0x38a58b){_0x38a58b=_0x38a58b||0xc8;return function(_0x3eb458){if(_0x3eb458){return _0x57ff73['status'](_0x38a58b)['json'](_0x3eb458);}};}function respondWithFilteredResult(_0x5ff10b,_0x281f0c){return function(_0x1188e7){if(_0x1188e7){var _0x5e1f31=_0x1188e7[_0xb9e2('0x19')],_0x11ef77=_0x281f0c[_0xb9e2('0x1a')],_0x15fe51=_0x281f0c[_0xb9e2('0x1a')]+_0x281f0c[_0xb9e2('0x1b')],_0x35b64d;if(_0x15fe51>=_0x5e1f31){_0x15fe51=_0x5e1f31;_0x35b64d=0xc8;}else{_0x35b64d=0xce;}_0x5ff10b[_0xb9e2('0x17')](_0x35b64d);return _0x5ff10b[_0xb9e2('0x1c')](_0xb9e2('0x1d'),_0x11ef77+'-'+_0x15fe51+'/'+_0x5e1f31)[_0xb9e2('0x1e')](_0x1188e7);}return null;};}function patchUpdates(_0x3744b4){return function(_0x485cfa){try{jsonpatch[_0xb9e2('0x1f')](_0x485cfa,_0x3744b4,!![]);}catch(_0x558d49){return BPromise[_0xb9e2('0x20')](_0x558d49);}return _0x485cfa[_0xb9e2('0x21')]();};}function saveUpdates(_0xfa07cc,_0x320849){return function(_0x595c62){if(_0x595c62){return _0x595c62[_0xb9e2('0x22')](_0xfa07cc)[_0xb9e2('0x23')](function(_0x34f45f){return _0x34f45f;});}return null;};}function removeEntity(_0x6b34c8,_0x31ad71){return function(_0x374bf2){if(_0x374bf2){return _0x374bf2[_0xb9e2('0x24')]()[_0xb9e2('0x23')](function(){_0x6b34c8[_0xb9e2('0x17')](0xcc)[_0xb9e2('0x18')]();});}};}function handleEntityNotFound(_0x15ee75,_0x385322){return function(_0x28d9ab){if(!_0x28d9ab){_0x15ee75[_0xb9e2('0x25')](0x194);}return _0x28d9ab;};}function handleError(_0x4d73e9,_0x394caa){_0x394caa=_0x394caa||0x1f4;return function(_0x6be333){logger[_0xb9e2('0x26')](_0x6be333[_0xb9e2('0x27')]);if(_0x6be333[_0xb9e2('0x28')]){delete _0x6be333['name'];}_0x4d73e9['status'](_0x394caa)['send'](_0x6be333);};}exports[_0xb9e2('0x29')]=function(_0x2a5fbe,_0x497362){var _0x157f43={},_0x265153={},_0x4ea639={'count':0x0,'rows':[]};var _0x26cf8e=_[_0xb9e2('0x2a')](db[_0xb9e2('0x2b')][_0xb9e2('0x2c')],function(_0x28577d){return{'name':_0x28577d['fieldName'],'type':_0x28577d[_0xb9e2('0x2d')][_0xb9e2('0x2e')]};});_0x265153[_0xb9e2('0x2f')]=_[_0xb9e2('0x2a')](_0x26cf8e,_0xb9e2('0x28'));_0x265153[_0xb9e2('0x30')]=_[_0xb9e2('0x31')](_0x2a5fbe[_0xb9e2('0x30')]);_0x265153[_0xb9e2('0x32')]=_[_0xb9e2('0x33')](_0x265153[_0xb9e2('0x2f')],_0x265153[_0xb9e2('0x30')]);_0x157f43[_0xb9e2('0x34')]=_['intersection'](_0x265153[_0xb9e2('0x2f')],qs['fields'](_0x2a5fbe[_0xb9e2('0x30')][_0xb9e2('0x35')]));_0x157f43[_0xb9e2('0x34')]=_0x157f43[_0xb9e2('0x34')][_0xb9e2('0x36')]?_0x157f43[_0xb9e2('0x34')]:_0x265153['model'];if(!_0x2a5fbe['query']['hasOwnProperty'](_0xb9e2('0x37'))){_0x157f43[_0xb9e2('0x1b')]=qs['limit'](_0x2a5fbe[_0xb9e2('0x30')][_0xb9e2('0x1b')]);_0x157f43[_0xb9e2('0x1a')]=qs[_0xb9e2('0x1a')](_0x2a5fbe[_0xb9e2('0x30')][_0xb9e2('0x1a')]);}_0x157f43[_0xb9e2('0x38')]=qs[_0xb9e2('0x39')](_0x2a5fbe['query'][_0xb9e2('0x39')]);_0x157f43[_0xb9e2('0x3a')]=qs[_0xb9e2('0x32')](_[_0xb9e2('0x3b')](_0x2a5fbe[_0xb9e2('0x30')],_0x265153['filters']),_0x26cf8e);if(_0x2a5fbe[_0xb9e2('0x30')][_0xb9e2('0x3c')]){_0x157f43['where']=_[_0xb9e2('0x3d')](_0x157f43[_0xb9e2('0x3a')],{'$or':_[_0xb9e2('0x2a')](_0x26cf8e,function(_0x12d88c){if(_0x12d88c[_0xb9e2('0x2d')]!==_0xb9e2('0x3e')){var _0x25af49={};_0x25af49[_0x12d88c['name']]={'$like':'%'+_0x2a5fbe[_0xb9e2('0x30')]['filter']+'%'};return _0x25af49;}})});}_0x157f43=_[_0xb9e2('0x3d')]({},_0x157f43,_0x2a5fbe[_0xb9e2('0x3f')]);var _0x3f4c66={'where':_0x157f43[_0xb9e2('0x3a')]};return db[_0xb9e2('0x2b')][_0xb9e2('0x19')](_0x3f4c66)[_0xb9e2('0x23')](function(_0x597eac){_0x4ea639[_0xb9e2('0x19')]=_0x597eac;if(_0x2a5fbe[_0xb9e2('0x30')][_0xb9e2('0x40')]){_0x157f43['include']=[{'all':!![]}];}return db[_0xb9e2('0x2b')]['findAll'](_0x157f43);})[_0xb9e2('0x23')](function(_0x35e341){_0x4ea639[_0xb9e2('0x41')]=_0x35e341;return _0x4ea639;})[_0xb9e2('0x23')](respondWithFilteredResult(_0x497362,_0x157f43))[_0xb9e2('0x42')](handleError(_0x497362,null));};exports[_0xb9e2('0x43')]=function(_0x1b5fb6,_0x5ac546){var _0x4ffe90={'raw':!![],'where':{'id':_0x1b5fb6[_0xb9e2('0x44')]['id']}},_0x27ff29={};_0x27ff29['model']=_[_0xb9e2('0x31')](db[_0xb9e2('0x2b')]['rawAttributes']);_0x27ff29[_0xb9e2('0x30')]=_[_0xb9e2('0x31')](_0x1b5fb6['query']);_0x27ff29[_0xb9e2('0x32')]=_['intersection'](_0x27ff29[_0xb9e2('0x2f')],_0x27ff29['query']);_0x4ffe90[_0xb9e2('0x34')]=_['intersection'](_0x27ff29[_0xb9e2('0x2f')],qs['fields'](_0x1b5fb6[_0xb9e2('0x30')][_0xb9e2('0x35')]));_0x4ffe90[_0xb9e2('0x34')]=_0x4ffe90['attributes'][_0xb9e2('0x36')]?_0x4ffe90[_0xb9e2('0x34')]:_0x27ff29[_0xb9e2('0x2f')];if(_0x1b5fb6[_0xb9e2('0x30')][_0xb9e2('0x40')]){_0x4ffe90[_0xb9e2('0x45')]=[{'all':!![]}];}_0x4ffe90=_[_0xb9e2('0x3d')]({},_0x4ffe90,_0x1b5fb6[_0xb9e2('0x3f')]);return db[_0xb9e2('0x2b')][_0xb9e2('0x46')](_0x4ffe90)[_0xb9e2('0x23')](handleEntityNotFound(_0x5ac546,null))[_0xb9e2('0x23')](respondWithResult(_0x5ac546,null))[_0xb9e2('0x42')](handleError(_0x5ac546,null));};exports[_0xb9e2('0x47')]=function(_0x138e4a,_0x1797ef){return db[_0xb9e2('0x2b')]['create'](_0x138e4a[_0xb9e2('0x48')],{})['then'](respondWithResult(_0x1797ef,0xc9))[_0xb9e2('0x42')](handleError(_0x1797ef,null));};exports['update']=function(_0x52a586,_0x499a34){if(_0x52a586[_0xb9e2('0x48')]['id']){delete _0x52a586[_0xb9e2('0x48')]['id'];}return db[_0xb9e2('0x2b')][_0xb9e2('0x46')]({'where':{'id':_0x52a586[_0xb9e2('0x44')]['id']}})[_0xb9e2('0x23')](handleEntityNotFound(_0x499a34,null))[_0xb9e2('0x23')](saveUpdates(_0x52a586[_0xb9e2('0x48')],null))[_0xb9e2('0x23')](respondWithResult(_0x499a34,null))[_0xb9e2('0x42')](handleError(_0x499a34,null));};exports['destroy']=function(_0xfdc735,_0x556b73){return db[_0xb9e2('0x2b')]['find']({'where':{'id':_0xfdc735[_0xb9e2('0x44')]['id']}})[_0xb9e2('0x23')](handleEntityNotFound(_0x556b73,null))[_0xb9e2('0x23')](removeEntity(_0x556b73,null))['catch'](handleError(_0x556b73,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index c736f70..a6d4fac 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 _0xf3a1=['freshsales_unique_index','idField','FieldId','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshsalesField','int_freshsales_fields'];(function(_0x5bc453,_0x554c35){var _0x32966c=function(_0x291284){while(--_0x291284){_0x5bc453['push'](_0x5bc453['shift']());}};_0x32966c(++_0x554c35);}(_0xf3a1,0x114));var _0x1f3a=function(_0x4a4fb7,_0x565de7){_0x4a4fb7=_0x4a4fb7-0x0;var _0x5c9d10=_0xf3a1[_0x4a4fb7];return _0x5c9d10;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1f3a('0x0'));var moment=require(_0x1f3a('0x1'));var BPromise=require(_0x1f3a('0x2'));var rp=require(_0x1f3a('0x3'));var fs=require('fs');var path=require(_0x1f3a('0x4'));var rimraf=require(_0x1f3a('0x5'));var config=require(_0x1f3a('0x6'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x2c0964,_0x574d91){return _0x2c0964[_0x1f3a('0x7')](_0x1f3a('0x8'),attributes,{'tableName':_0x1f3a('0x9'),'paranoid':![],'indexes':[{'name':_0x1f3a('0xa'),'fields':[_0x1f3a('0xb'),_0x1f3a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee0a=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x462c07,_0x2ac424){var _0x324613=function(_0x59212b){while(--_0x59212b){_0x462c07['push'](_0x462c07['shift']());}};_0x324613(++_0x2ac424);}(_0xee0a,0x1f0));var _0xaee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee0a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaee0('0x0'));var util=require(_0xaee0('0x1'));var logger=require(_0xaee0('0x2'))(_0xaee0('0x3'));var moment=require(_0xaee0('0x4'));var BPromise=require(_0xaee0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaee0('0x6'));var config=require(_0xaee0('0x7'));var attributes=require(_0xaee0('0x8'));module[_0xaee0('0x9')]=function(_0x190561,_0x204c40){return _0x190561[_0xaee0('0xa')](_0xaee0('0xb'),attributes,{'tableName':_0xaee0('0xc'),'paranoid':![],'indexes':[{'name':_0xaee0('0xd'),'fields':['idField',_0xaee0('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 1b125f4..eae6a90 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 _0x94ed=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x192324,_0x369f3f){var _0x15ebdf=function(_0x19f208){while(--_0x19f208){_0x192324['push'](_0x192324['shift']());}};_0x15ebdf(++_0x369f3f);}(_0x94ed,0xbd));var _0xd94e=function(_0x17cdd6,_0x94ae6d){_0x17cdd6=_0x17cdd6-0x0;var _0x42970a=_0x94ed[_0x17cdd6];return _0x42970a;};'use strict';var _=require(_0xd94e('0x0'));var util=require(_0xd94e('0x1'));var moment=require(_0xd94e('0x2'));var BPromise=require(_0xd94e('0x3'));var rs=require(_0xd94e('0x4'));var fs=require('fs');var Redis=require(_0xd94e('0x5'));var db=require(_0xd94e('0x6'))['db'];var utils=require(_0xd94e('0x7'));var logger=require('../../config/logger')(_0xd94e('0x8'));var config=require(_0xd94e('0x9'));var jayson=require(_0xd94e('0xa'));var client=jayson[_0xd94e('0xb')][_0xd94e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dd48a,_0x12751f,_0x55350c){return new BPromise(function(_0x590bf0,_0x2165c4){return client[_0xd94e('0xd')](_0x5dd48a,_0x55350c)[_0xd94e('0xe')](function(_0x284739){logger[_0xd94e('0xf')](_0xd94e('0x10'),_0x12751f,'request\x20sent');logger['debug'](_0xd94e('0x11'),_0x12751f,_0xd94e('0x12'),JSON['stringify'](_0x284739));if(_0x284739[_0xd94e('0x13')]){if(_0x284739['error']['code']===0x1f4){logger[_0xd94e('0x13')](_0xd94e('0x10'),_0x12751f,_0x284739['error'][_0xd94e('0x14')]);return _0x2165c4(_0x284739[_0xd94e('0x13')]['message']);}logger[_0xd94e('0x13')](_0xd94e('0x10'),_0x12751f,_0x284739['error'][_0xd94e('0x14')]);return _0x590bf0(_0x284739[_0xd94e('0x13')]['message']);}else{logger[_0xd94e('0xf')](_0xd94e('0x10'),_0x12751f,_0xd94e('0x12'));_0x590bf0(_0x284739['result']['message']);}})['catch'](function(_0x9e0984){logger[_0xd94e('0x13')](_0xd94e('0x10'),_0x12751f,_0x9e0984);_0x2165c4(_0x9e0984);});});} \ No newline at end of file +var _0xd4ae=['moment','bluebird','ioredis','../../config/logger','rpc','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0xd4ae,0xfa));var _0xed4a=function(_0x2d9da3,_0x63174d){_0x2d9da3=_0x2d9da3-0x0;var _0x2a8d6a=_0xd4ae[_0x2d9da3];return _0x2a8d6a;};'use strict';var _=require(_0xed4a('0x0'));var util=require(_0xed4a('0x1'));var moment=require(_0xed4a('0x2'));var BPromise=require(_0xed4a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed4a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xed4a('0x5'))(_0xed4a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed4a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28e460,_0x49f2d0,_0x366a76){return new BPromise(function(_0x6e6fa8,_0x1f12c5){return client['request'](_0x28e460,_0x366a76)[_0xed4a('0x8')](function(_0x20e319){logger[_0xed4a('0x9')](_0xed4a('0xa'),_0x49f2d0,_0xed4a('0xb'));logger[_0xed4a('0xc')](_0xed4a('0xd'),_0x49f2d0,_0xed4a('0xb'),JSON[_0xed4a('0xe')](_0x20e319));if(_0x20e319[_0xed4a('0xf')]){if(_0x20e319[_0xed4a('0xf')][_0xed4a('0x10')]===0x1f4){logger[_0xed4a('0xf')](_0xed4a('0xa'),_0x49f2d0,_0x20e319['error']['message']);return _0x1f12c5(_0x20e319[_0xed4a('0xf')]['message']);}logger[_0xed4a('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x49f2d0,_0x20e319[_0xed4a('0xf')]['message']);return _0x6e6fa8(_0x20e319[_0xed4a('0xf')][_0xed4a('0x11')]);}else{logger['info'](_0xed4a('0xa'),_0x49f2d0,_0xed4a('0xb'));_0x6e6fa8(_0x20e319['result'][_0xed4a('0x11')]);}})['catch'](function(_0x1f8043){logger[_0xed4a('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x49f2d0,_0x1f8043);_0x1f12c5(_0x1f8043);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 9f6572a..e891065 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 _0xa8fb=['get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller'];(function(_0x3aa3a3,_0x30b6a2){var _0x15e179=function(_0x13645e){while(--_0x13645e){_0x3aa3a3['push'](_0x3aa3a3['shift']());}};_0x15e179(++_0x30b6a2);}(_0xa8fb,0x172));var _0xba8f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa8fb[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xba8f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba8f('0x1'));var express=require(_0xba8f('0x2'));var router=express[_0xba8f('0x3')]();var auth=require(_0xba8f('0x4'));var interaction=require(_0xba8f('0x5'));var config=require(_0xba8f('0x6'));var controller=require(_0xba8f('0x7'));router[_0xba8f('0x8')]('/',auth[_0xba8f('0x9')](),controller[_0xba8f('0xa')]);router[_0xba8f('0x8')](_0xba8f('0xb'),auth[_0xba8f('0x9')](),controller['show']);router[_0xba8f('0x8')](_0xba8f('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xba8f('0x8')](_0xba8f('0xd'),auth[_0xba8f('0x9')](),controller[_0xba8f('0xe')]);router[_0xba8f('0xf')]('/',auth[_0xba8f('0x9')](),controller[_0xba8f('0x10')]);router[_0xba8f('0xf')](_0xba8f('0xc'),auth[_0xba8f('0x9')](),controller['addConfiguration']);router[_0xba8f('0x11')](_0xba8f('0xb'),auth[_0xba8f('0x9')](),controller['update']);router[_0xba8f('0x12')](_0xba8f('0xb'),auth['isAuthenticated'](),controller[_0xba8f('0x13')]);module[_0xba8f('0x14')]=router; \ No newline at end of file +var _0x0f17=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x9d58e0,_0x5ee515){var _0x5eab07=function(_0x177eb4){while(--_0x177eb4){_0x9d58e0['push'](_0x9d58e0['shift']());}};_0x5eab07(++_0x5ee515);}(_0x0f17,0x8b));var _0x70f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f17[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x70f1('0x0'));var util=require(_0x70f1('0x1'));var path=require(_0x70f1('0x2'));var timeout=require(_0x70f1('0x3'));var express=require(_0x70f1('0x4'));var router=express[_0x70f1('0x5')]();var auth=require(_0x70f1('0x6'));var interaction=require(_0x70f1('0x7'));var config=require(_0x70f1('0x8'));var controller=require(_0x70f1('0x9'));router[_0x70f1('0xa')]('/',auth[_0x70f1('0xb')](),controller[_0x70f1('0xc')]);router[_0x70f1('0xa')](_0x70f1('0xd'),auth[_0x70f1('0xb')](),controller['show']);router[_0x70f1('0xa')]('/:id/configurations',auth[_0x70f1('0xb')](),controller[_0x70f1('0xe')]);router['get'](_0x70f1('0xf'),auth[_0x70f1('0xb')](),controller[_0x70f1('0x10')]);router['post']('/',auth[_0x70f1('0xb')](),controller[_0x70f1('0x11')]);router['post'](_0x70f1('0x12'),auth[_0x70f1('0xb')](),controller[_0x70f1('0x13')]);router[_0x70f1('0x14')](_0x70f1('0xd'),auth[_0x70f1('0xb')](),controller[_0x70f1('0x15')]);router[_0x70f1('0x16')]('/:id',auth[_0x70f1('0xb')](),controller['destroy']);module[_0x70f1('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 563f641..cdf062c 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 _0x4975=['username','integrationTab','sequelize','STRING'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0x4975,0x86));var _0x5497=function(_0x1be0d5,_0x33463d){_0x1be0d5=_0x1be0d5-0x0;var _0x1854a1=_0x4975[_0x1be0d5];return _0x1854a1;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'name':{'type':Sequelize[_0x5497('0x1')]},'description':{'type':Sequelize[_0x5497('0x1')]},'username':{'type':Sequelize[_0x5497('0x1')],'unique':_0x5497('0x2')},'remoteUri':{'type':Sequelize[_0x5497('0x1')]},'password':{'type':Sequelize[_0x5497('0x1')]},'clientId':{'type':Sequelize[_0x5497('0x1')]},'clientSecret':{'type':Sequelize[_0x5497('0x1')]},'securityToken':{'type':Sequelize[_0x5497('0x1')]},'serverUrl':{'type':Sequelize[_0x5497('0x1')]},'type':{'type':Sequelize['ENUM'](_0x5497('0x3'),'newTab'),'defaultValue':_0x5497('0x3')}}; \ No newline at end of file +var _0x814b=['STRING','username','ENUM','newTab','integrationTab','sequelize','exports'];(function(_0x166dcd,_0x1ba118){var _0x1731d4=function(_0xa31e02){while(--_0xa31e02){_0x166dcd['push'](_0x166dcd['shift']());}};_0x1731d4(++_0x1ba118);}(_0x814b,0x1a2));var _0xb814=function(_0x2be240,_0x1e119d){_0x2be240=_0x2be240-0x0;var _0x123543=_0x814b[_0x2be240];return _0x123543;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')]},'description':{'type':Sequelize[_0xb814('0x2')]},'username':{'type':Sequelize[_0xb814('0x2')],'unique':_0xb814('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb814('0x2')]},'clientId':{'type':Sequelize[_0xb814('0x2')]},'clientSecret':{'type':Sequelize[_0xb814('0x2')]},'securityToken':{'type':Sequelize[_0xb814('0x2')]},'serverUrl':{'type':Sequelize[_0xb814('0x2')]},'type':{'type':Sequelize[_0xb814('0x4')]('integrationTab',_0xb814('0x5')),'defaultValue':_0xb814('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 302f1de..9d8c773 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 _0xb3f8=['CallDisposition','CallDurationInSeconds','CallObject','IsArchived','Priority','Status','Type','Case','Origin','IsEscalated','SuppliedName','remove','custom','includes','label','picklistValues','value','boolean','True','true','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','request\x20sent','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','apply','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','create','SalesforceAccount','body','update','destroy','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','Task','remoteUri','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','password','isNil','ticketType','sobject','describe'];(function(_0x203311,_0x38b061){var _0x355de8=function(_0x411752){while(--_0x411752){_0x203311['push'](_0x203311['shift']());}};_0x355de8(++_0x38b061);}(_0xb3f8,0x1bd));var _0x8b3f=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0xb3f8[_0x4cee4b];return _0x4d891d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b3f('0x0'));var rimraf=require(_0x8b3f('0x1'));var zipdir=require(_0x8b3f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b3f('0x3'));var moment=require(_0x8b3f('0x4'));var BPromise=require(_0x8b3f('0x5'));var Mustache=require(_0x8b3f('0x6'));var util=require(_0x8b3f('0x7'));var path=require(_0x8b3f('0x8'));var sox=require(_0x8b3f('0x9'));var csv=require('to-csv');var ejs=require(_0x8b3f('0xa'));var fs=require('fs');var _=require(_0x8b3f('0xb'));var squel=require(_0x8b3f('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b3f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8b3f('0xe'));var querystring=require(_0x8b3f('0xf'));var Papa=require(_0x8b3f('0x10'));var Redis=require(_0x8b3f('0x11'));var authService=require(_0x8b3f('0x12'));var qs=require(_0x8b3f('0x13'));var as=require(_0x8b3f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b3f('0x15'))('api');var utils=require(_0x8b3f('0x16'));var config=require(_0x8b3f('0x17'));var db=require(_0x8b3f('0x18'))['db'];var integrations=require(_0x8b3f('0x19'));var jayson=require(_0x8b3f('0x1a'));var client=jayson[_0x8b3f('0x1b')][_0x8b3f('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x5dd896,_0x2514e5,_0x52d592){if(_0x52d592){var _0x519f09=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x519f09[_0x8b3f('0x1d')](_0x2514e5)){return _0x5dd896;}else{throw new db[(_0x8b3f('0x1e'))][(_0x8b3f('0x1f'))](_0x8b3f('0x20'));}}else{return _0x5dd896;}}function respondWithRpcPromise(_0x493de9,_0x5951f9,_0x17d530,_0x435b25){return new BPromise(function(_0x62fc93,_0x1d2231){var _0x1370a7=_0x435b25||client;return _0x1370a7[_0x8b3f('0x21')](_0x493de9,_0x17d530)[_0x8b3f('0x22')](function(_0x40acda){logger[_0x8b3f('0x23')]('SalesforceAccount,\x20%s,\x20%s',_0x5951f9,'request\x20sent');logger[_0x8b3f('0x24')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x5951f9,_0x8b3f('0x25'),JSON['stringify'](_0x40acda));if(_0x40acda[_0x8b3f('0x26')]){if(_0x40acda[_0x8b3f('0x26')]['code']===0x1f4){logger[_0x8b3f('0x26')](_0x8b3f('0x27'),_0x5951f9,_0x40acda[_0x8b3f('0x26')][_0x8b3f('0x28')]);return _0x1d2231(_0x40acda[_0x8b3f('0x26')]['message']);}logger[_0x8b3f('0x26')](_0x8b3f('0x27'),_0x5951f9,_0x40acda[_0x8b3f('0x26')][_0x8b3f('0x28')]);return _0x62fc93(_0x40acda[_0x8b3f('0x26')][_0x8b3f('0x28')]);}else{logger[_0x8b3f('0x23')](_0x8b3f('0x27'),_0x5951f9,'request\x20sent');_0x62fc93(_0x40acda[_0x8b3f('0x29')][_0x8b3f('0x28')]);}})[_0x8b3f('0x2a')](function(_0x2d19aa){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x5951f9,_0x2d19aa);_0x1d2231(_0x2d19aa);});});}function respondWithStatusCode(_0x811bd7,_0x55b4ec){_0x55b4ec=_0x55b4ec||0xcc;return function(_0xe7bc3d){if(_0xe7bc3d){return _0x811bd7['sendStatus'](_0x55b4ec);}return _0x811bd7[_0x8b3f('0x2b')](_0x55b4ec)[_0x8b3f('0x2c')]();};}function respondWithResult(_0x5e74fc,_0x1f033f){_0x1f033f=_0x1f033f||0xc8;return function(_0x3e987c){if(_0x3e987c){return _0x5e74fc[_0x8b3f('0x2b')](_0x1f033f)[_0x8b3f('0x2d')](_0x3e987c);}};}function respondWithFilteredResult(_0xc550b7,_0x26b789){return function(_0x528fe2){if(_0x528fe2){var _0x386b3e=_0x528fe2[_0x8b3f('0x2e')],_0x491827=_0x26b789[_0x8b3f('0x2f')],_0x59752c=_0x26b789[_0x8b3f('0x2f')]+_0x26b789[_0x8b3f('0x30')],_0x543c1b;if(_0x59752c>=_0x386b3e){_0x59752c=_0x386b3e;_0x543c1b=0xc8;}else{_0x543c1b=0xce;}_0xc550b7[_0x8b3f('0x2b')](_0x543c1b);return _0xc550b7[_0x8b3f('0x31')]('Content-Range',_0x491827+'-'+_0x59752c+'/'+_0x386b3e)[_0x8b3f('0x2d')](_0x528fe2);}return null;};}function patchUpdates(_0x1c5033){return function(_0x1353fb){try{jsonpatch[_0x8b3f('0x32')](_0x1353fb,_0x1c5033,!![]);}catch(_0x3828cc){return BPromise['reject'](_0x3828cc);}return _0x1353fb['save']();};}function saveUpdates(_0x7c927a,_0x2f811b){return function(_0x2ba0d9){if(_0x2ba0d9){return _0x2ba0d9['update'](_0x7c927a)[_0x8b3f('0x22')](function(_0x31ff36){return _0x31ff36;});}return null;};}function removeEntity(_0x27ef3a,_0x235f39){return function(_0x211aba){if(_0x211aba){return _0x211aba['destroy']()['then'](function(){_0x27ef3a[_0x8b3f('0x2b')](0xcc)[_0x8b3f('0x2c')]();});}};}function handleEntityNotFound(_0x1e5648,_0x3728da){return function(_0x51e78b){if(!_0x51e78b){_0x1e5648[_0x8b3f('0x33')](0x194);}return _0x51e78b;};}function handleError(_0xc99176,_0x4646b2){_0x4646b2=_0x4646b2||0x1f4;return function(_0x3f0797){logger[_0x8b3f('0x26')](_0x3f0797[_0x8b3f('0x34')]);if(_0x3f0797[_0x8b3f('0x35')]){delete _0x3f0797[_0x8b3f('0x35')];}_0xc99176[_0x8b3f('0x2b')](_0x4646b2)[_0x8b3f('0x36')](_0x3f0797);};}exports[_0x8b3f('0x37')]=function(_0x1654c2,_0x34e39e){var _0x32ff26={},_0x52e1af={},_0x5acde2={'count':0x0,'rows':[]};var _0x2181cd=_[_0x8b3f('0x38')](db['SalesforceAccount'][_0x8b3f('0x39')],function(_0x2e456b){return{'name':_0x2e456b[_0x8b3f('0x3a')],'type':_0x2e456b['type'][_0x8b3f('0x3b')]};});_0x52e1af[_0x8b3f('0x3c')]=_['map'](_0x2181cd,_0x8b3f('0x35'));_0x52e1af[_0x8b3f('0x3d')]=_['keys'](_0x1654c2[_0x8b3f('0x3d')]);_0x52e1af[_0x8b3f('0x3e')]=_[_0x8b3f('0x3f')](_0x52e1af[_0x8b3f('0x3c')],_0x52e1af[_0x8b3f('0x3d')]);_0x32ff26[_0x8b3f('0x40')]=_['intersection'](_0x52e1af[_0x8b3f('0x3c')],qs[_0x8b3f('0x41')](_0x1654c2[_0x8b3f('0x3d')]['fields']));_0x32ff26[_0x8b3f('0x40')]=_0x32ff26[_0x8b3f('0x40')][_0x8b3f('0x42')]?_0x32ff26[_0x8b3f('0x40')]:_0x52e1af[_0x8b3f('0x3c')];if(!_0x1654c2['query'][_0x8b3f('0x43')](_0x8b3f('0x44'))){_0x32ff26['limit']=qs[_0x8b3f('0x30')](_0x1654c2[_0x8b3f('0x3d')][_0x8b3f('0x30')]);_0x32ff26['offset']=qs[_0x8b3f('0x2f')](_0x1654c2['query']['offset']);}_0x32ff26[_0x8b3f('0x45')]=qs[_0x8b3f('0x46')](_0x1654c2[_0x8b3f('0x3d')][_0x8b3f('0x46')]);_0x32ff26[_0x8b3f('0x47')]=qs[_0x8b3f('0x3e')](_[_0x8b3f('0x48')](_0x1654c2['query'],_0x52e1af[_0x8b3f('0x3e')]),_0x2181cd);if(_0x1654c2['query'][_0x8b3f('0x49')]){_0x32ff26['where']=_[_0x8b3f('0x4a')](_0x32ff26[_0x8b3f('0x47')],{'$or':_[_0x8b3f('0x38')](_0x2181cd,function(_0x6f51fe){if(_0x6f51fe[_0x8b3f('0x4b')]!==_0x8b3f('0x4c')){var _0x47f00d={};_0x47f00d[_0x6f51fe[_0x8b3f('0x35')]]={'$like':'%'+_0x1654c2[_0x8b3f('0x3d')][_0x8b3f('0x49')]+'%'};return _0x47f00d;}})});}_0x32ff26=_[_0x8b3f('0x4a')]({},_0x32ff26,_0x1654c2[_0x8b3f('0x4d')]);var _0x597dd5={'where':_0x32ff26['where']};return db['SalesforceAccount']['count'](_0x597dd5)['then'](function(_0x4c08c7){_0x5acde2['count']=_0x4c08c7;if(_0x1654c2['query'][_0x8b3f('0x4e')]){_0x32ff26[_0x8b3f('0x4f')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x32ff26);})[_0x8b3f('0x22')](function(_0x39456d){_0x5acde2[_0x8b3f('0x50')]=_0x39456d;return _0x5acde2;})[_0x8b3f('0x22')](respondWithFilteredResult(_0x34e39e,_0x32ff26))[_0x8b3f('0x2a')](handleError(_0x34e39e,null));};exports[_0x8b3f('0x51')]=function(_0x2b8446,_0x2a7873){var _0x7aad02={'raw':![],'where':{'id':_0x2b8446[_0x8b3f('0x52')]['id']}},_0x38289a={};_0x38289a[_0x8b3f('0x3c')]=_[_0x8b3f('0x53')](db['SalesforceAccount'][_0x8b3f('0x39')]);_0x38289a[_0x8b3f('0x3d')]=_[_0x8b3f('0x53')](_0x2b8446['query']);_0x38289a[_0x8b3f('0x3e')]=_['intersection'](_0x38289a[_0x8b3f('0x3c')],_0x38289a['query']);_0x7aad02[_0x8b3f('0x40')]=_[_0x8b3f('0x3f')](_0x38289a[_0x8b3f('0x3c')],qs[_0x8b3f('0x41')](_0x2b8446[_0x8b3f('0x3d')][_0x8b3f('0x41')]));_0x7aad02['attributes']=_0x7aad02['attributes'][_0x8b3f('0x42')]?_0x7aad02[_0x8b3f('0x40')]:_0x38289a['model'];if(_0x2b8446['query']['includeAll']){_0x7aad02[_0x8b3f('0x4f')]=[{'all':!![]}];}_0x7aad02=_['merge']({},_0x7aad02,_0x2b8446[_0x8b3f('0x4d')]);return db['SalesforceAccount'][_0x8b3f('0x54')](_0x7aad02)[_0x8b3f('0x22')](handleEntityNotFound(_0x2a7873,null))[_0x8b3f('0x22')](respondWithResult(_0x2a7873,null))[_0x8b3f('0x2a')](handleError(_0x2a7873,null));};exports[_0x8b3f('0x55')]=function(_0x22ef56,_0x1f105a){return db[_0x8b3f('0x56')][_0x8b3f('0x55')](_0x22ef56[_0x8b3f('0x57')],{})[_0x8b3f('0x22')](respondWithResult(_0x1f105a,0xc9))[_0x8b3f('0x2a')](handleError(_0x1f105a,null));};exports[_0x8b3f('0x58')]=function(_0x330057,_0x566374){if(_0x330057[_0x8b3f('0x57')]['id']){delete _0x330057[_0x8b3f('0x57')]['id'];}return db[_0x8b3f('0x56')][_0x8b3f('0x54')]({'where':{'id':_0x330057[_0x8b3f('0x52')]['id']}})[_0x8b3f('0x22')](handleEntityNotFound(_0x566374,null))['then'](saveUpdates(_0x330057['body'],null))['then'](respondWithResult(_0x566374,null))['catch'](handleError(_0x566374,null));};exports[_0x8b3f('0x59')]=function(_0x27a83e,_0x4e0c75){return db[_0x8b3f('0x56')][_0x8b3f('0x54')]({'where':{'id':_0x27a83e[_0x8b3f('0x52')]['id']}})[_0x8b3f('0x22')](handleEntityNotFound(_0x4e0c75,null))['then'](removeEntity(_0x4e0c75,null))[_0x8b3f('0x2a')](handleError(_0x4e0c75,null));};exports[_0x8b3f('0x5a')]=function(_0x2cf5e1,_0x16924e,_0x5ba8bf){var _0x2c9f2d={};var _0xc015d3={};var _0x398fcb;var _0x3997f6;return db[_0x8b3f('0x56')][_0x8b3f('0x5b')]({'where':{'id':_0x2cf5e1[_0x8b3f('0x52')]['id']}})[_0x8b3f('0x22')](handleEntityNotFound(_0x16924e,null))[_0x8b3f('0x22')](function(_0x4d4482){if(_0x4d4482){_0x398fcb=_0x4d4482;_0xc015d3['model']=_[_0x8b3f('0x53')](db['SalesforceConfiguration'][_0x8b3f('0x39')]);_0xc015d3[_0x8b3f('0x3d')]=_[_0x8b3f('0x53')](_0x2cf5e1[_0x8b3f('0x3d')]);_0xc015d3[_0x8b3f('0x3e')]=_['intersection'](_0xc015d3['model'],_0xc015d3[_0x8b3f('0x3d')]);_0x2c9f2d['attributes']=_[_0x8b3f('0x3f')](_0xc015d3[_0x8b3f('0x3c')],qs[_0x8b3f('0x41')](_0x2cf5e1[_0x8b3f('0x3d')][_0x8b3f('0x41')]));_0x2c9f2d[_0x8b3f('0x40')]=_0x2c9f2d[_0x8b3f('0x40')]['length']?_0x2c9f2d[_0x8b3f('0x40')]:_0xc015d3[_0x8b3f('0x3c')];_0x2c9f2d[_0x8b3f('0x45')]=qs['sort'](_0x2cf5e1[_0x8b3f('0x3d')][_0x8b3f('0x46')]);_0x2c9f2d['where']=qs[_0x8b3f('0x3e')](_[_0x8b3f('0x48')](_0x2cf5e1[_0x8b3f('0x3d')],_0xc015d3[_0x8b3f('0x3e')]));if(_0x2cf5e1[_0x8b3f('0x3d')][_0x8b3f('0x49')]){_0x2c9f2d[_0x8b3f('0x47')]=_['merge'](_0x2c9f2d[_0x8b3f('0x47')],{'$or':_[_0x8b3f('0x38')](_0x2c9f2d[_0x8b3f('0x40')],function(_0x45c3e0){var _0x951a74={};_0x951a74[_0x45c3e0]={'$like':'%'+_0x2cf5e1['query'][_0x8b3f('0x49')]+'%'};return _0x951a74;})});}_0x2c9f2d=_[_0x8b3f('0x4a')]({},_0x2c9f2d,_0x2cf5e1[_0x8b3f('0x4d')]);return _0x398fcb[_0x8b3f('0x5a')](_0x2c9f2d);}})['then'](function(_0x5d19a3){if(_0x5d19a3){_0x3997f6=_0x5d19a3[_0x8b3f('0x42')];if(!_0x2cf5e1[_0x8b3f('0x3d')][_0x8b3f('0x43')](_0x8b3f('0x44'))){_0x2c9f2d[_0x8b3f('0x30')]=qs['limit'](_0x2cf5e1[_0x8b3f('0x3d')][_0x8b3f('0x30')]);_0x2c9f2d[_0x8b3f('0x2f')]=qs[_0x8b3f('0x2f')](_0x2cf5e1['query'][_0x8b3f('0x2f')]);}return _0x398fcb[_0x8b3f('0x5a')](_0x2c9f2d);}})[_0x8b3f('0x22')](function(_0x47ac5c){if(_0x47ac5c){return _0x47ac5c?{'count':_0x3997f6,'rows':_0x47ac5c}:null;}})[_0x8b3f('0x22')](respondWithResult(_0x16924e,null))[_0x8b3f('0x2a')](handleError(_0x16924e,null));};exports['addConfiguration']=function(_0xe6f2d3,_0x3ec76e,_0x5711f4){if(_0xe6f2d3[_0x8b3f('0x57')]['id']){delete _0xe6f2d3[_0x8b3f('0x57')]['id'];}return db['SalesforceAccount'][_0x8b3f('0x5b')]({'where':{'id':_0xe6f2d3[_0x8b3f('0x52')]['id']}})[_0x8b3f('0x22')](handleEntityNotFound(_0x3ec76e,null))[_0x8b3f('0x22')](function(_0x1f1087){if(_0x1f1087){_0xe6f2d3[_0x8b3f('0x57')][_0x8b3f('0x5c')]=_0x1f1087['id'];_0xe6f2d3['body'][_0x8b3f('0x5d')]=integrations[_0x8b3f('0x5e')](_0xe6f2d3['body'][_0x8b3f('0x5f')],_0xe6f2d3[_0x8b3f('0x57')][_0x8b3f('0x4b')]);_0xe6f2d3[_0x8b3f('0x57')]['Descriptions']=integrations['getDescriptions'](_0xe6f2d3[_0x8b3f('0x57')][_0x8b3f('0x5f')],_0xe6f2d3[_0x8b3f('0x57')][_0x8b3f('0x4b')]);return db['SalesforceConfiguration'][_0x8b3f('0x55')](_0xe6f2d3['body'],{'include':[{'model':db[_0x8b3f('0x60')],'as':_0x8b3f('0x5d')},{'model':db[_0x8b3f('0x60')],'as':_0x8b3f('0x61')}]});}return null;})[_0x8b3f('0x22')](respondWithResult(_0x3ec76e,null))[_0x8b3f('0x2a')](handleError(_0x3ec76e,null));};exports[_0x8b3f('0x62')]=function(_0x1ecb03,_0x4e34b6,_0x27a8c0){var _0x1cfa34;var _0x308548='';var _0x1fdc7e=_0x8b3f('0x63');return db[_0x8b3f('0x56')][_0x8b3f('0x5b')]({'where':{'id':_0x1ecb03[_0x8b3f('0x52')]['id']},'attributes':['id',_0x8b3f('0x64'),'clientId',_0x8b3f('0x65'),_0x8b3f('0x66'),'password',_0x8b3f('0x67')]})[_0x8b3f('0x22')](handleEntityNotFound(_0x4e34b6,null))[_0x8b3f('0x22')](function(_0x5830e6){if(_0x5830e6){_0x308548=_0x5830e6[_0x8b3f('0x64')];var _0x4655bd=_0x308548[_0x8b3f('0x68')](-0x1);if(_0x4655bd==='/'){_0x308548=_0x308548[_0x8b3f('0x69')](0x0,_0x308548[_0x8b3f('0x6a')](_0x4655bd));}_0x1cfa34=new jsforce[(_0x8b3f('0x6b'))]({'oauth2':{'loginUrl':_0x308548,'clientId':_0x5830e6[_0x8b3f('0x6c')],'clientSecret':_0x5830e6['clientSecret']}});return _0x1cfa34[_0x8b3f('0x6d')](_0x5830e6['username'],_0x5830e6[_0x8b3f('0x6e')]['concat'](_0x5830e6[_0x8b3f('0x67')]));}})[_0x8b3f('0x22')](function(_0xa2df4c){if(_0xa2df4c){if(!_[_0x8b3f('0x6f')](_0x1ecb03[_0x8b3f('0x3d')][_0x8b3f('0x70')])){_0x1fdc7e=_0x1ecb03[_0x8b3f('0x3d')][_0x8b3f('0x70')];}return _0x1cfa34[_0x8b3f('0x71')](_0x1fdc7e)[_0x8b3f('0x72')]();}})['then'](function(_0xda9785){var _0x1ca99e=[_0x8b3f('0x73'),_0x8b3f('0x74'),_0x8b3f('0x75'),'CallType',_0x8b3f('0x76'),_0x8b3f('0x77'),_0x8b3f('0x78'),_0x8b3f('0x79')];if(!_[_0x8b3f('0x6f')](_0x1ecb03['query'][_0x8b3f('0x70')])&&_0x1ecb03[_0x8b3f('0x3d')][_0x8b3f('0x70')]===_0x8b3f('0x7a')){_0x1ca99e=['Type',_0x8b3f('0x7b'),'Reason',_0x8b3f('0x78'),'Priority',_0x8b3f('0x7c'),_0x8b3f('0x7d'),'SuppliedCompany'];}if(_0xda9785){_[_0x8b3f('0x7e')](_0xda9785[_0x8b3f('0x41')],function(_0x388c5e){return _0x388c5e[_0x8b3f('0x7f')]===![]&&!_0x1ca99e[_0x8b3f('0x80')](_0x388c5e[_0x8b3f('0x35')]);});return{'count':_0xda9785['fields'][_0x8b3f('0x42')],'rows':_[_0x8b3f('0x38')](_0xda9785['fields'],function(_0x30e531){return{'id':_0x30e531[_0x8b3f('0x35')],'name':_0x30e531[_0x8b3f('0x81')],'custom':_0x30e531[_0x8b3f('0x7f')],'options':_0x30e531['picklistValues'][_0x8b3f('0x42')]>0x0?_['map'](_0x30e531[_0x8b3f('0x82')],function(_0x5eaec7){return{'name':_0x5eaec7['label'],'value':_0x5eaec7[_0x8b3f('0x83')]};}):_0x30e531['type']==_0x8b3f('0x84')?[{'name':_0x8b3f('0x85'),'value':_0x8b3f('0x86')},{'name':'False','value':_0x8b3f('0x87')}]:[]};})};}})[_0x8b3f('0x22')](respondWithResult(_0x4e34b6,null))[_0x8b3f('0x2a')](function(_0x29e92b){var _0x70739c=_0x1ecb03[_0x8b3f('0x3d')][_0x8b3f('0x1d')]?0x1f4:_0x29e92b[_0x8b3f('0x88')]||0x1f4;logger[_0x8b3f('0x26')](_0x8b3f('0x89'),_0x8b3f('0x62'),_0x70739c,JSON[_0x8b3f('0x8a')](_0x29e92b));delete _0x29e92b[_0x8b3f('0x35')];if(_0x70739c===0x191){_0x70739c=0x190;}_0x4e34b6['status'](_0x70739c)[_0x8b3f('0x36')](_0x1ecb03[_0x8b3f('0x3d')][_0x8b3f('0x1d')]?{'message':_0x8b3f('0x8b'),'statusCode':_0x29e92b[_0x8b3f('0x88')]}:_0x29e92b);});}; \ No newline at end of file +var _0x84c7=['attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','length','options','find','create','body','destroy','SalesforceConfiguration','nolimit','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','remoteUri','username','password','securityToken','slice','substring','clientSecret','login','isNil','ticketType','sobject','describe','CallDisposition','CallObject','IsArchived','Priority','Status','Type','Case','Origin','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','html-pdf','eml-format','rimraf','request-promise','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','../../config/logger','api','../../config/utils','../../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','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','count','offset','limit','apply','save','update','then','end','stack','name','send','SalesforceAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields'];(function(_0x1a4748,_0x40c46e){var _0x28ca99=function(_0x99232c){while(--_0x99232c){_0x1a4748['push'](_0x1a4748['shift']());}};_0x28ca99(++_0x40c46e);}(_0x84c7,0x1cd));var _0x784c=function(_0xde760f,_0x3d39ce){_0xde760f=_0xde760f-0x0;var _0x45e46d=_0x84c7[_0xde760f];return _0x45e46d;};'use strict';var pdf=require(_0x784c('0x0'));var emlformat=require(_0x784c('0x1'));var rimraf=require(_0x784c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x784c('0x3'));var moment=require('moment');var BPromise=require(_0x784c('0x4'));var Mustache=require(_0x784c('0x5'));var util=require('util');var path=require(_0x784c('0x6'));var sox=require(_0x784c('0x7'));var csv=require(_0x784c('0x8'));var ejs=require(_0x784c('0x9'));var fs=require('fs');var _=require(_0x784c('0xa'));var squel=require(_0x784c('0xb'));var crypto=require(_0x784c('0xc'));var jsforce=require(_0x784c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x784c('0xe'));var Papa=require(_0x784c('0xf'));var Redis=require(_0x784c('0x10'));var authService=require(_0x784c('0x11'));var qs=require(_0x784c('0x12'));var as=require(_0x784c('0x13'));var hardwareService=require(_0x784c('0x14'));var logger=require(_0x784c('0x15'))(_0x784c('0x16'));var utils=require(_0x784c('0x17'));var config=require(_0x784c('0x18'));var db=require(_0x784c('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x784c('0x1a'));var client=jayson[_0x784c('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x44b692,_0x4d1666,_0x5012d6){if(_0x5012d6){var _0x2619b2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2619b2[_0x784c('0x1c')](_0x4d1666)){return _0x44b692;}else{throw new db[(_0x784c('0x1d'))][(_0x784c('0x1e'))](_0x784c('0x1f'));}}else{return _0x44b692;}}function respondWithRpcPromise(_0x288801,_0x35bc74,_0x1f860b,_0xdbe9b4){return new BPromise(function(_0x9803fc,_0x177469){var _0x55923d=_0xdbe9b4||client;return _0x55923d[_0x784c('0x20')](_0x288801,_0x1f860b)['then'](function(_0x1dcc85){logger[_0x784c('0x21')](_0x784c('0x22'),_0x35bc74,_0x784c('0x23'));logger[_0x784c('0x24')](_0x784c('0x25'),_0x35bc74,_0x784c('0x23'),JSON['stringify'](_0x1dcc85));if(_0x1dcc85['error']){if(_0x1dcc85[_0x784c('0x26')][_0x784c('0x27')]===0x1f4){logger['error'](_0x784c('0x22'),_0x35bc74,_0x1dcc85[_0x784c('0x26')][_0x784c('0x28')]);return _0x177469(_0x1dcc85[_0x784c('0x26')]['message']);}logger[_0x784c('0x26')](_0x784c('0x22'),_0x35bc74,_0x1dcc85['error'][_0x784c('0x28')]);return _0x9803fc(_0x1dcc85[_0x784c('0x26')][_0x784c('0x28')]);}else{logger[_0x784c('0x21')](_0x784c('0x22'),_0x35bc74,'request\x20sent');_0x9803fc(_0x1dcc85['result'][_0x784c('0x28')]);}})[_0x784c('0x29')](function(_0x1258fc){logger['error'](_0x784c('0x22'),_0x35bc74,_0x1258fc);_0x177469(_0x1258fc);});});}function respondWithStatusCode(_0xaf8eec,_0x17f28b){_0x17f28b=_0x17f28b||0xcc;return function(_0x4aa6d8){if(_0x4aa6d8){return _0xaf8eec[_0x784c('0x2a')](_0x17f28b);}return _0xaf8eec[_0x784c('0x2b')](_0x17f28b)['end']();};}function respondWithResult(_0x40226d,_0x4f3176){_0x4f3176=_0x4f3176||0xc8;return function(_0x24ee88){if(_0x24ee88){return _0x40226d['status'](_0x4f3176)[_0x784c('0x2c')](_0x24ee88);}};}function respondWithFilteredResult(_0x33d355,_0x1d5ab7){return function(_0x11ff8b){if(_0x11ff8b){var _0x5ebe0a=_0x11ff8b[_0x784c('0x2d')],_0x54ce57=_0x1d5ab7[_0x784c('0x2e')],_0x14e70d=_0x1d5ab7['offset']+_0x1d5ab7[_0x784c('0x2f')],_0x5d982a;if(_0x14e70d>=_0x5ebe0a){_0x14e70d=_0x5ebe0a;_0x5d982a=0xc8;}else{_0x5d982a=0xce;}_0x33d355[_0x784c('0x2b')](_0x5d982a);return _0x33d355['set']('Content-Range',_0x54ce57+'-'+_0x14e70d+'/'+_0x5ebe0a)[_0x784c('0x2c')](_0x11ff8b);}return null;};}function patchUpdates(_0xe2e098){return function(_0x2b4d36){try{jsonpatch[_0x784c('0x30')](_0x2b4d36,_0xe2e098,!![]);}catch(_0x429a9c){return BPromise['reject'](_0x429a9c);}return _0x2b4d36[_0x784c('0x31')]();};}function saveUpdates(_0x476c12,_0x432536){return function(_0x267719){if(_0x267719){return _0x267719[_0x784c('0x32')](_0x476c12)[_0x784c('0x33')](function(_0x105540){return _0x105540;});}return null;};}function removeEntity(_0x5d55c7,_0x58cf4f){return function(_0x56a491){if(_0x56a491){return _0x56a491['destroy']()[_0x784c('0x33')](function(){_0x5d55c7[_0x784c('0x2b')](0xcc)[_0x784c('0x34')]();});}};}function handleEntityNotFound(_0x1d291a,_0x203b69){return function(_0x5bee36){if(!_0x5bee36){_0x1d291a[_0x784c('0x2a')](0x194);}return _0x5bee36;};}function handleError(_0x517c99,_0x1c7100){_0x1c7100=_0x1c7100||0x1f4;return function(_0x2c59f1){logger[_0x784c('0x26')](_0x2c59f1[_0x784c('0x35')]);if(_0x2c59f1[_0x784c('0x36')]){delete _0x2c59f1[_0x784c('0x36')];}_0x517c99['status'](_0x1c7100)[_0x784c('0x37')](_0x2c59f1);};}exports['index']=function(_0x3dd4f7,_0x56fb14){var _0x17ed5a={},_0xe892f5={},_0x505557={'count':0x0,'rows':[]};var _0x2a6aa2=_['map'](db[_0x784c('0x38')][_0x784c('0x39')],function(_0x5ae3fe){return{'name':_0x5ae3fe[_0x784c('0x3a')],'type':_0x5ae3fe[_0x784c('0x3b')]['key']};});_0xe892f5[_0x784c('0x3c')]=_[_0x784c('0x3d')](_0x2a6aa2,_0x784c('0x36'));_0xe892f5[_0x784c('0x3e')]=_[_0x784c('0x3f')](_0x3dd4f7[_0x784c('0x3e')]);_0xe892f5[_0x784c('0x40')]=_[_0x784c('0x41')](_0xe892f5['model'],_0xe892f5[_0x784c('0x3e')]);_0x17ed5a['attributes']=_[_0x784c('0x41')](_0xe892f5[_0x784c('0x3c')],qs[_0x784c('0x42')](_0x3dd4f7[_0x784c('0x3e')][_0x784c('0x42')]));_0x17ed5a[_0x784c('0x43')]=_0x17ed5a[_0x784c('0x43')]['length']?_0x17ed5a[_0x784c('0x43')]:_0xe892f5[_0x784c('0x3c')];if(!_0x3dd4f7['query'][_0x784c('0x44')]('nolimit')){_0x17ed5a[_0x784c('0x2f')]=qs[_0x784c('0x2f')](_0x3dd4f7[_0x784c('0x3e')][_0x784c('0x2f')]);_0x17ed5a['offset']=qs['offset'](_0x3dd4f7[_0x784c('0x3e')]['offset']);}_0x17ed5a[_0x784c('0x45')]=qs['sort'](_0x3dd4f7[_0x784c('0x3e')][_0x784c('0x46')]);_0x17ed5a[_0x784c('0x47')]=qs[_0x784c('0x40')](_[_0x784c('0x48')](_0x3dd4f7[_0x784c('0x3e')],_0xe892f5[_0x784c('0x40')]),_0x2a6aa2);if(_0x3dd4f7[_0x784c('0x3e')][_0x784c('0x49')]){_0x17ed5a[_0x784c('0x47')]=_[_0x784c('0x4a')](_0x17ed5a[_0x784c('0x47')],{'$or':_[_0x784c('0x3d')](_0x2a6aa2,function(_0x35c7d5){if(_0x35c7d5[_0x784c('0x3b')]!==_0x784c('0x4b')){var _0x3d966b={};_0x3d966b[_0x35c7d5[_0x784c('0x36')]]={'$like':'%'+_0x3dd4f7[_0x784c('0x3e')][_0x784c('0x49')]+'%'};return _0x3d966b;}})});}_0x17ed5a=_[_0x784c('0x4a')]({},_0x17ed5a,_0x3dd4f7['options']);var _0x57e4fb={'where':_0x17ed5a[_0x784c('0x47')]};return db[_0x784c('0x38')][_0x784c('0x2d')](_0x57e4fb)[_0x784c('0x33')](function(_0x6f7388){_0x505557[_0x784c('0x2d')]=_0x6f7388;if(_0x3dd4f7[_0x784c('0x3e')][_0x784c('0x4c')]){_0x17ed5a[_0x784c('0x4d')]=[{'all':!![]}];}return db[_0x784c('0x38')][_0x784c('0x4e')](_0x17ed5a);})[_0x784c('0x33')](function(_0x4e40f3){_0x505557['rows']=_0x4e40f3;return _0x505557;})[_0x784c('0x33')](respondWithFilteredResult(_0x56fb14,_0x17ed5a))[_0x784c('0x29')](handleError(_0x56fb14,null));};exports[_0x784c('0x4f')]=function(_0x2d8cde,_0x19ebcb){var _0x4e5aec={'raw':![],'where':{'id':_0x2d8cde[_0x784c('0x50')]['id']}},_0x447dcd={};_0x447dcd[_0x784c('0x3c')]=_[_0x784c('0x3f')](db[_0x784c('0x38')]['rawAttributes']);_0x447dcd[_0x784c('0x3e')]=_[_0x784c('0x3f')](_0x2d8cde[_0x784c('0x3e')]);_0x447dcd[_0x784c('0x40')]=_[_0x784c('0x41')](_0x447dcd[_0x784c('0x3c')],_0x447dcd[_0x784c('0x3e')]);_0x4e5aec['attributes']=_[_0x784c('0x41')](_0x447dcd[_0x784c('0x3c')],qs[_0x784c('0x42')](_0x2d8cde[_0x784c('0x3e')][_0x784c('0x42')]));_0x4e5aec[_0x784c('0x43')]=_0x4e5aec['attributes'][_0x784c('0x51')]?_0x4e5aec[_0x784c('0x43')]:_0x447dcd[_0x784c('0x3c')];if(_0x2d8cde[_0x784c('0x3e')][_0x784c('0x4c')]){_0x4e5aec[_0x784c('0x4d')]=[{'all':!![]}];}_0x4e5aec=_['merge']({},_0x4e5aec,_0x2d8cde[_0x784c('0x52')]);return db[_0x784c('0x38')][_0x784c('0x53')](_0x4e5aec)[_0x784c('0x33')](handleEntityNotFound(_0x19ebcb,null))['then'](respondWithResult(_0x19ebcb,null))['catch'](handleError(_0x19ebcb,null));};exports[_0x784c('0x54')]=function(_0xd9bf81,_0x144c77){return db[_0x784c('0x38')][_0x784c('0x54')](_0xd9bf81['body'],{})[_0x784c('0x33')](respondWithResult(_0x144c77,0xc9))[_0x784c('0x29')](handleError(_0x144c77,null));};exports[_0x784c('0x32')]=function(_0x42ec28,_0x384d5e){if(_0x42ec28[_0x784c('0x55')]['id']){delete _0x42ec28[_0x784c('0x55')]['id'];}return db[_0x784c('0x38')][_0x784c('0x53')]({'where':{'id':_0x42ec28[_0x784c('0x50')]['id']}})[_0x784c('0x33')](handleEntityNotFound(_0x384d5e,null))['then'](saveUpdates(_0x42ec28['body'],null))[_0x784c('0x33')](respondWithResult(_0x384d5e,null))[_0x784c('0x29')](handleError(_0x384d5e,null));};exports[_0x784c('0x56')]=function(_0x22037e,_0x4bfa5c){return db[_0x784c('0x38')][_0x784c('0x53')]({'where':{'id':_0x22037e[_0x784c('0x50')]['id']}})['then'](handleEntityNotFound(_0x4bfa5c,null))[_0x784c('0x33')](removeEntity(_0x4bfa5c,null))['catch'](handleError(_0x4bfa5c,null));};exports['getConfigurations']=function(_0x2a65e8,_0x1e8f21,_0x209bf0){var _0x35fd35={};var _0x6010b={};var _0x2c023e;var _0x4874df;return db[_0x784c('0x38')]['findOne']({'where':{'id':_0x2a65e8[_0x784c('0x50')]['id']}})['then'](handleEntityNotFound(_0x1e8f21,null))[_0x784c('0x33')](function(_0x586a29){if(_0x586a29){_0x2c023e=_0x586a29;_0x6010b[_0x784c('0x3c')]=_['keys'](db[_0x784c('0x57')]['rawAttributes']);_0x6010b['query']=_[_0x784c('0x3f')](_0x2a65e8[_0x784c('0x3e')]);_0x6010b[_0x784c('0x40')]=_['intersection'](_0x6010b[_0x784c('0x3c')],_0x6010b[_0x784c('0x3e')]);_0x35fd35[_0x784c('0x43')]=_['intersection'](_0x6010b[_0x784c('0x3c')],qs['fields'](_0x2a65e8['query']['fields']));_0x35fd35[_0x784c('0x43')]=_0x35fd35['attributes'][_0x784c('0x51')]?_0x35fd35[_0x784c('0x43')]:_0x6010b['model'];_0x35fd35['order']=qs[_0x784c('0x46')](_0x2a65e8[_0x784c('0x3e')][_0x784c('0x46')]);_0x35fd35['where']=qs[_0x784c('0x40')](_[_0x784c('0x48')](_0x2a65e8[_0x784c('0x3e')],_0x6010b[_0x784c('0x40')]));if(_0x2a65e8[_0x784c('0x3e')][_0x784c('0x49')]){_0x35fd35['where']=_[_0x784c('0x4a')](_0x35fd35[_0x784c('0x47')],{'$or':_[_0x784c('0x3d')](_0x35fd35[_0x784c('0x43')],function(_0x36fd0a){var _0x295e22={};_0x295e22[_0x36fd0a]={'$like':'%'+_0x2a65e8[_0x784c('0x3e')]['filter']+'%'};return _0x295e22;})});}_0x35fd35=_[_0x784c('0x4a')]({},_0x35fd35,_0x2a65e8[_0x784c('0x52')]);return _0x2c023e['getConfigurations'](_0x35fd35);}})['then'](function(_0xe144a5){if(_0xe144a5){_0x4874df=_0xe144a5['length'];if(!_0x2a65e8[_0x784c('0x3e')][_0x784c('0x44')](_0x784c('0x58'))){_0x35fd35[_0x784c('0x2f')]=qs[_0x784c('0x2f')](_0x2a65e8[_0x784c('0x3e')][_0x784c('0x2f')]);_0x35fd35['offset']=qs['offset'](_0x2a65e8[_0x784c('0x3e')]['offset']);}return _0x2c023e[_0x784c('0x59')](_0x35fd35);}})[_0x784c('0x33')](function(_0x282ebe){if(_0x282ebe){return _0x282ebe?{'count':_0x4874df,'rows':_0x282ebe}:null;}})[_0x784c('0x33')](respondWithResult(_0x1e8f21,null))[_0x784c('0x29')](handleError(_0x1e8f21,null));};exports[_0x784c('0x5a')]=function(_0x3984ce,_0x55b711,_0x14fcbb){if(_0x3984ce['body']['id']){delete _0x3984ce[_0x784c('0x55')]['id'];}return db['SalesforceAccount'][_0x784c('0x5b')]({'where':{'id':_0x3984ce[_0x784c('0x50')]['id']}})[_0x784c('0x33')](handleEntityNotFound(_0x55b711,null))[_0x784c('0x33')](function(_0x4c5c6b){if(_0x4c5c6b){_0x3984ce[_0x784c('0x55')]['AccountId']=_0x4c5c6b['id'];_0x3984ce[_0x784c('0x55')][_0x784c('0x5c')]=integrations[_0x784c('0x5d')](_0x3984ce['body'][_0x784c('0x5e')],_0x3984ce['body'][_0x784c('0x3b')]);_0x3984ce['body']['Descriptions']=integrations['getDescriptions'](_0x3984ce['body']['channel'],_0x3984ce['body']['type']);return db[_0x784c('0x57')][_0x784c('0x54')](_0x3984ce[_0x784c('0x55')],{'include':[{'model':db['SalesforceField'],'as':_0x784c('0x5c')},{'model':db[_0x784c('0x5f')],'as':_0x784c('0x60')}]});}return null;})[_0x784c('0x33')](respondWithResult(_0x55b711,null))[_0x784c('0x29')](handleError(_0x55b711,null));};exports[_0x784c('0x61')]=function(_0x2a11d5,_0x2272a7,_0x418858){var _0x3bf8e0;var _0x191471='';var _0x2911fc='Task';return db[_0x784c('0x38')]['findOne']({'where':{'id':_0x2a11d5[_0x784c('0x50')]['id']},'attributes':['id',_0x784c('0x62'),'clientId','clientSecret',_0x784c('0x63'),_0x784c('0x64'),_0x784c('0x65')]})[_0x784c('0x33')](handleEntityNotFound(_0x2272a7,null))['then'](function(_0x4303db){if(_0x4303db){_0x191471=_0x4303db[_0x784c('0x62')];var _0x500b29=_0x191471[_0x784c('0x66')](-0x1);if(_0x500b29==='/'){_0x191471=_0x191471[_0x784c('0x67')](0x0,_0x191471['lastIndexOf'](_0x500b29));}_0x3bf8e0=new jsforce['Connection']({'oauth2':{'loginUrl':_0x191471,'clientId':_0x4303db['clientId'],'clientSecret':_0x4303db[_0x784c('0x68')]}});return _0x3bf8e0[_0x784c('0x69')](_0x4303db['username'],_0x4303db[_0x784c('0x64')]['concat'](_0x4303db[_0x784c('0x65')]));}})['then'](function(_0x4c601e){if(_0x4c601e){if(!_[_0x784c('0x6a')](_0x2a11d5[_0x784c('0x3e')][_0x784c('0x6b')])){_0x2911fc=_0x2a11d5[_0x784c('0x3e')][_0x784c('0x6b')];}return _0x3bf8e0[_0x784c('0x6c')](_0x2911fc)[_0x784c('0x6d')]();}})[_0x784c('0x33')](function(_0x20fea0){var _0x3db47f=[_0x784c('0x6e'),'CallDurationInSeconds',_0x784c('0x6f'),'CallType',_0x784c('0x70'),_0x784c('0x71'),_0x784c('0x72'),_0x784c('0x73')];if(!_[_0x784c('0x6a')](_0x2a11d5[_0x784c('0x3e')][_0x784c('0x6b')])&&_0x2a11d5[_0x784c('0x3e')][_0x784c('0x6b')]===_0x784c('0x74')){_0x3db47f=[_0x784c('0x73'),_0x784c('0x75'),'Reason',_0x784c('0x72'),'Priority','IsEscalated',_0x784c('0x76'),_0x784c('0x77')];}if(_0x20fea0){_[_0x784c('0x78')](_0x20fea0[_0x784c('0x42')],function(_0x655b76){return _0x655b76[_0x784c('0x79')]===![]&&!_0x3db47f[_0x784c('0x7a')](_0x655b76[_0x784c('0x36')]);});return{'count':_0x20fea0[_0x784c('0x42')][_0x784c('0x51')],'rows':_[_0x784c('0x3d')](_0x20fea0[_0x784c('0x42')],function(_0x35c878){return{'id':_0x35c878[_0x784c('0x36')],'name':_0x35c878[_0x784c('0x7b')],'custom':_0x35c878[_0x784c('0x79')],'options':_0x35c878[_0x784c('0x7c')][_0x784c('0x51')]>0x0?_[_0x784c('0x3d')](_0x35c878[_0x784c('0x7c')],function(_0x4892ee){return{'name':_0x4892ee[_0x784c('0x7b')],'value':_0x4892ee['value']};}):_0x35c878['type']=='boolean'?[{'name':_0x784c('0x7d'),'value':_0x784c('0x7e')},{'name':_0x784c('0x7f'),'value':_0x784c('0x80')}]:[]};})};}})[_0x784c('0x33')](respondWithResult(_0x2272a7,null))[_0x784c('0x29')](function(_0x209a60){var _0x27c087=_0x2a11d5[_0x784c('0x3e')][_0x784c('0x1c')]?0x1f4:_0x209a60[_0x784c('0x81')]||0x1f4;logger[_0x784c('0x26')](_0x784c('0x82'),_0x784c('0x61'),_0x27c087,JSON[_0x784c('0x83')](_0x209a60));delete _0x209a60[_0x784c('0x36')];if(_0x27c087===0x191){_0x27c087=0x190;}_0x2272a7[_0x784c('0x2b')](_0x27c087)[_0x784c('0x37')](_0x2a11d5[_0x784c('0x3e')][_0x784c('0x1c')]?{'message':'Wrong\x20credentials','statusCode':_0x209a60[_0x784c('0x81')]}:_0x209a60);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 13506bf..86db5c3 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 _0x1712=['rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1f025f,_0x520449){var _0x21e427=function(_0x8e24a8){while(--_0x8e24a8){_0x1f025f['push'](_0x1f025f['shift']());}};_0x21e427(++_0x520449);}(_0x1712,0xc9));var _0x2171=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0x1712[_0x53ad58];return _0x554b03;};'use strict';var _=require(_0x2171('0x0'));var util=require(_0x2171('0x1'));var logger=require(_0x2171('0x2'))('api');var moment=require(_0x2171('0x3'));var BPromise=require(_0x2171('0x4'));var rp=require(_0x2171('0x5'));var fs=require('fs');var path=require(_0x2171('0x6'));var rimraf=require(_0x2171('0x7'));var config=require('../../config/environment');var attributes=require(_0x2171('0x8'));var integrations=require(_0x2171('0x9'));module[_0x2171('0xa')]=function(_0x59dc40,_0x559c78){return _0x59dc40['define'](_0x2171('0xb'),attributes,{'tableName':_0x2171('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf21f=['int_salesforce_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0xd81b64,_0x182b6d){var _0x2b72cb=function(_0x330a1d){while(--_0x330a1d){_0xd81b64['push'](_0xd81b64['shift']());}};_0x2b72cb(++_0x182b6d);}(_0xf21f,0x13c));var _0xff21=function(_0x312940,_0x27d5aa){_0x312940=_0x312940-0x0;var _0x4c2cc5=_0xf21f[_0x312940];return _0x4c2cc5;};'use strict';var _=require(_0xff21('0x0'));var util=require('util');var logger=require(_0xff21('0x1'))(_0xff21('0x2'));var moment=require(_0xff21('0x3'));var BPromise=require(_0xff21('0x4'));var rp=require(_0xff21('0x5'));var fs=require('fs');var path=require(_0xff21('0x6'));var rimraf=require(_0xff21('0x7'));var config=require(_0xff21('0x8'));var attributes=require(_0xff21('0x9'));var integrations=require(_0xff21('0xa'));module[_0xff21('0xb')]=function(_0x1e1555,_0x513581){return _0x1e1555[_0xff21('0xc')](_0xff21('0xd'),attributes,{'tableName':_0xff21('0xe'),'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 42d26c4..6d02bd2 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 _0x7a2c=['attributes','SalesforceAccount','find','then','ShowSalesforceAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetSalesforceAccount','findAll','options','limit','include','map','model'];(function(_0x11a962,_0x3cc338){var _0x55d423=function(_0xf4b236){while(--_0xf4b236){_0x11a962['push'](_0x11a962['shift']());}};_0x55d423(++_0x3cc338);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x14eda4,_0x2209eb){_0x14eda4=_0x14eda4-0x0;var _0x177773=_0x7a2c[_0x14eda4];return _0x177773;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var moment=require(_0xc7a2('0x1'));var BPromise=require(_0xc7a2('0x2'));var rs=require(_0xc7a2('0x3'));var fs=require('fs');var Redis=require(_0xc7a2('0x4'));var db=require(_0xc7a2('0x5'))['db'];var utils=require(_0xc7a2('0x6'));var logger=require(_0xc7a2('0x7'))(_0xc7a2('0x8'));var config=require('../../config/environment');var jayson=require(_0xc7a2('0x9'));var client=jayson[_0xc7a2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481430,_0x48773c,_0x1dd150){return new BPromise(function(_0x3de428,_0x3f0573){return client[_0xc7a2('0xb')](_0x481430,_0x1dd150)['then'](function(_0x38518b){logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x48773c,'request\x20sent');logger[_0xc7a2('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x48773c,_0xc7a2('0xf'),JSON[_0xc7a2('0x10')](_0x38518b));if(_0x38518b[_0xc7a2('0x11')]){if(_0x38518b['error'][_0xc7a2('0x12')]===0x1f4){logger[_0xc7a2('0x11')](_0xc7a2('0xd'),_0x48773c,_0x38518b['error'][_0xc7a2('0x13')]);return _0x3f0573(_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);}logger[_0xc7a2('0x11')](_0xc7a2('0xd'),_0x48773c,_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);return _0x3de428(_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);}else{logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x48773c,_0xc7a2('0xf'));_0x3de428(_0x38518b[_0xc7a2('0x14')][_0xc7a2('0x13')]);}})[_0xc7a2('0x15')](function(_0x506396){logger[_0xc7a2('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x48773c,_0x506396);_0x3f0573(_0x506396);});});}exports[_0xc7a2('0x16')]=function(_0x302d54){var _0x293343=this;return new Promise(function(_0x3da373,_0x4e50fb){return db['SalesforceAccount'][_0xc7a2('0x17')]({'raw':_0x302d54[_0xc7a2('0x18')]?_0x302d54['options']['raw']===undefined?!![]:![]:!![],'where':_0x302d54['options']?_0x302d54[_0xc7a2('0x18')]['where']||null:null,'attributes':_0x302d54[_0xc7a2('0x18')]?_0x302d54[_0xc7a2('0x18')]['attributes']||null:null,'limit':_0x302d54[_0xc7a2('0x18')]?_0x302d54[_0xc7a2('0x18')][_0xc7a2('0x19')]||null:null,'include':_0x302d54[_0xc7a2('0x18')]?_0x302d54[_0xc7a2('0x18')][_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x302d54['options']['include'],function(_0x194ca4){return{'model':db[_0x194ca4[_0xc7a2('0x1c')]],'as':_0x194ca4['as'],'attributes':_0x194ca4['attributes'],'include':_0x194ca4[_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x194ca4[_0xc7a2('0x1a')],function(_0x2c2281){return{'model':db[_0x2c2281[_0xc7a2('0x1c')]],'as':_0x2c2281['as'],'attributes':_0x2c2281[_0xc7a2('0x1d')],'include':_0x2c2281[_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x2c2281['include'],function(_0x35a6e0){return{'model':db[_0x35a6e0['model']],'as':_0x35a6e0['as'],'attributes':_0x35a6e0[_0xc7a2('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20404b){logger[_0xc7a2('0xc')](_0xc7a2('0x16'),_0x302d54);logger[_0xc7a2('0xe')]('GetSalesforceAccount',_0x302d54,JSON['stringify'](_0x20404b));_0x3da373(_0x20404b);})[_0xc7a2('0x15')](function(_0x2f3097){logger[_0xc7a2('0x11')](_0xc7a2('0x16'),_0x2f3097[_0xc7a2('0x13')],_0x302d54);_0x4e50fb(_0x293343[_0xc7a2('0x11')](0x1f4,_0x2f3097[_0xc7a2('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x8cb6bf){var _0x926b6c=this;return new Promise(function(_0x496386,_0xe8c061){return db[_0xc7a2('0x1e')][_0xc7a2('0x1f')]({'raw':_0x8cb6bf['options']?_0x8cb6bf[_0xc7a2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x8cb6bf[_0xc7a2('0x18')]?_0x8cb6bf['options']['where']||null:null,'attributes':_0x8cb6bf[_0xc7a2('0x18')]?_0x8cb6bf['options']['attributes']||null:null,'include':_0x8cb6bf[_0xc7a2('0x18')]?_0x8cb6bf['options'][_0xc7a2('0x1a')]?_['map'](_0x8cb6bf[_0xc7a2('0x18')][_0xc7a2('0x1a')],function(_0x13ee53){return{'model':db[_0x13ee53[_0xc7a2('0x1c')]],'as':_0x13ee53['as'],'attributes':_0x13ee53[_0xc7a2('0x1d')],'include':_0x13ee53[_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x13ee53[_0xc7a2('0x1a')],function(_0x29771b){return{'model':db[_0x29771b[_0xc7a2('0x1c')]],'as':_0x29771b['as'],'attributes':_0x29771b['attributes'],'include':_0x29771b[_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x29771b['include'],function(_0x31a8d2){return{'model':db[_0x31a8d2[_0xc7a2('0x1c')]],'as':_0x31a8d2['as'],'attributes':_0x31a8d2[_0xc7a2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc7a2('0x20')](function(_0x178c3e){logger[_0xc7a2('0xc')](_0xc7a2('0x21'),_0x8cb6bf);logger['debug'](_0xc7a2('0x21'),_0x8cb6bf,JSON[_0xc7a2('0x10')](_0x178c3e));_0x496386(_0x178c3e);})[_0xc7a2('0x15')](function(_0x49ad1f){logger[_0xc7a2('0x11')](_0xc7a2('0x21'),_0x49ad1f['message'],_0x8cb6bf);_0xe8c061(_0x926b6c[_0xc7a2('0x11')](0x1f4,_0x49ad1f[_0xc7a2('0x13')]));});});}; \ No newline at end of file +var _0xbec5=['jayson/promise','http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','GetSalesforceAccount','findAll','options','raw','attributes','include','map','model','SalesforceAccount','find','where','ShowSalesforceAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0xbec5,0xe5));var _0x5bec=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0xbec5[_0x3d4ef1];return _0x409423;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a427,_0x38456e,_0x406e65){return new BPromise(function(_0x43d96e,_0x302aae){return client[_0x5bec('0xb')](_0x28a427,_0x406e65)[_0x5bec('0xc')](function(_0x4d0d29){logger[_0x5bec('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x38456e,_0x5bec('0xe'));logger[_0x5bec('0xf')](_0x5bec('0x10'),_0x38456e,'request\x20sent',JSON[_0x5bec('0x11')](_0x4d0d29));if(_0x4d0d29[_0x5bec('0x12')]){if(_0x4d0d29[_0x5bec('0x12')]['code']===0x1f4){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29['error'][_0x5bec('0x14')]);return _0x302aae(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);return _0x43d96e(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}else{logger[_0x5bec('0xd')](_0x5bec('0x13'),_0x38456e,_0x5bec('0xe'));_0x43d96e(_0x4d0d29[_0x5bec('0x15')]['message']);}})['catch'](function(_0x15af9b){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x15af9b);_0x302aae(_0x15af9b);});});}exports[_0x5bec('0x16')]=function(_0x5cd7ae){var _0x5295f0=this;return new Promise(function(_0x3cd354,_0x6c0d35){return db['SalesforceAccount'][_0x5bec('0x17')]({'raw':_0x5cd7ae[_0x5bec('0x18')]?_0x5cd7ae[_0x5bec('0x18')][_0x5bec('0x19')]===undefined?!![]:![]:!![],'where':_0x5cd7ae['options']?_0x5cd7ae[_0x5bec('0x18')]['where']||null:null,'attributes':_0x5cd7ae[_0x5bec('0x18')]?_0x5cd7ae[_0x5bec('0x18')][_0x5bec('0x1a')]||null:null,'limit':_0x5cd7ae[_0x5bec('0x18')]?_0x5cd7ae[_0x5bec('0x18')]['limit']||null:null,'include':_0x5cd7ae[_0x5bec('0x18')]?_0x5cd7ae['options'][_0x5bec('0x1b')]?_[_0x5bec('0x1c')](_0x5cd7ae['options'][_0x5bec('0x1b')],function(_0xbef70b){return{'model':db[_0xbef70b['model']],'as':_0xbef70b['as'],'attributes':_0xbef70b[_0x5bec('0x1a')],'include':_0xbef70b[_0x5bec('0x1b')]?_[_0x5bec('0x1c')](_0xbef70b[_0x5bec('0x1b')],function(_0x226d55){return{'model':db[_0x226d55[_0x5bec('0x1d')]],'as':_0x226d55['as'],'attributes':_0x226d55[_0x5bec('0x1a')],'include':_0x226d55['include']?_['map'](_0x226d55['include'],function(_0x2961bd){return{'model':db[_0x2961bd[_0x5bec('0x1d')]],'as':_0x2961bd['as'],'attributes':_0x2961bd[_0x5bec('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b3b2c){logger[_0x5bec('0xd')]('GetSalesforceAccount',_0x5cd7ae);logger[_0x5bec('0xf')](_0x5bec('0x16'),_0x5cd7ae,JSON['stringify'](_0x2b3b2c));_0x3cd354(_0x2b3b2c);})['catch'](function(_0x3575e7){logger[_0x5bec('0x12')](_0x5bec('0x16'),_0x3575e7[_0x5bec('0x14')],_0x5cd7ae);_0x6c0d35(_0x5295f0[_0x5bec('0x12')](0x1f4,_0x3575e7[_0x5bec('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x2987ca){var _0x59b5b6=this;return new Promise(function(_0x45863b,_0xafbd94){return db[_0x5bec('0x1e')][_0x5bec('0x1f')]({'raw':_0x2987ca['options']?_0x2987ca[_0x5bec('0x18')][_0x5bec('0x19')]===undefined?!![]:![]:!![],'where':_0x2987ca[_0x5bec('0x18')]?_0x2987ca['options'][_0x5bec('0x20')]||null:null,'attributes':_0x2987ca['options']?_0x2987ca[_0x5bec('0x18')][_0x5bec('0x1a')]||null:null,'include':_0x2987ca[_0x5bec('0x18')]?_0x2987ca['options'][_0x5bec('0x1b')]?_[_0x5bec('0x1c')](_0x2987ca['options'][_0x5bec('0x1b')],function(_0x2e5efc){return{'model':db[_0x2e5efc[_0x5bec('0x1d')]],'as':_0x2e5efc['as'],'attributes':_0x2e5efc[_0x5bec('0x1a')],'include':_0x2e5efc[_0x5bec('0x1b')]?_['map'](_0x2e5efc[_0x5bec('0x1b')],function(_0x583b96){return{'model':db[_0x583b96[_0x5bec('0x1d')]],'as':_0x583b96['as'],'attributes':_0x583b96[_0x5bec('0x1a')],'include':_0x583b96[_0x5bec('0x1b')]?_[_0x5bec('0x1c')](_0x583b96[_0x5bec('0x1b')],function(_0x1923fc){return{'model':db[_0x1923fc['model']],'as':_0x1923fc['as'],'attributes':_0x1923fc[_0x5bec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5bec('0xc')](function(_0x1d42b0){logger['info'](_0x5bec('0x21'),_0x2987ca);logger[_0x5bec('0xf')]('ShowSalesforceAccount',_0x2987ca,JSON[_0x5bec('0x11')](_0x1d42b0));_0x45863b(_0x1d42b0);})['catch'](function(_0x400e22){logger[_0x5bec('0x12')](_0x5bec('0x21'),_0x400e22['message'],_0x2987ca);_0xafbd94(_0x59b5b6[_0x5bec('0x12')](0x1f4,_0x400e22[_0x5bec('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 7ede1e8..9f8ddff 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 _0x5268=['/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects'];(function(_0x36579e,_0x475f2b){var _0x38b983=function(_0x4958aa){while(--_0x4958aa){_0x36579e['push'](_0x36579e['shift']());}};_0x38b983(++_0x475f2b);}(_0x5268,0x1a6));var _0x8526=function(_0xcb8b0f,_0x51adf9){_0xcb8b0f=_0xcb8b0f-0x0;var _0x24c5be=_0x5268[_0xcb8b0f];return _0x24c5be;};'use strict';var multer=require('multer');var util=require(_0x8526('0x0'));var path=require(_0x8526('0x1'));var timeout=require(_0x8526('0x2'));var express=require(_0x8526('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8526('0x4'));var config=require(_0x8526('0x5'));var controller=require(_0x8526('0x6'));router[_0x8526('0x7')]('/',auth['isAuthenticated'](),controller[_0x8526('0x8')]);router['get'](_0x8526('0x9'),auth[_0x8526('0xa')](),controller[_0x8526('0xb')]);router['get'](_0x8526('0xc'),auth[_0x8526('0xa')](),controller[_0x8526('0xd')]);router[_0x8526('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x8526('0xe')]);router[_0x8526('0x7')](_0x8526('0xf'),auth[_0x8526('0xa')](),controller[_0x8526('0x10')]);router[_0x8526('0x11')]('/',auth[_0x8526('0xa')](),controller[_0x8526('0x12')]);router[_0x8526('0x13')](_0x8526('0x9'),auth[_0x8526('0xa')](),controller[_0x8526('0x14')]);router['delete'](_0x8526('0x9'),auth['isAuthenticated'](),controller[_0x8526('0x15')]);module[_0x8526('0x16')]=router; \ No newline at end of file +var _0xd912=['../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getDescriptions','post','create','put','destroy','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x41c99a,_0x12414d){var _0x303bf9=function(_0x219646){while(--_0x219646){_0x41c99a['push'](_0x41c99a['shift']());}};_0x303bf9(++_0x12414d);}(_0xd912,0x12b));var _0x2d91=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd912[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x2d91('0x0'));var util=require('util');var path=require(_0x2d91('0x1'));var timeout=require(_0x2d91('0x2'));var express=require(_0x2d91('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2d91('0x4'));var config=require(_0x2d91('0x5'));var controller=require(_0x2d91('0x6'));router[_0x2d91('0x7')]('/',auth[_0x2d91('0x8')](),controller[_0x2d91('0x9')]);router['get'](_0x2d91('0xa'),auth[_0x2d91('0x8')](),controller[_0x2d91('0xb')]);router[_0x2d91('0x7')](_0x2d91('0xc'),auth[_0x2d91('0x8')](),controller['getFields']);router[_0x2d91('0x7')](_0x2d91('0xd'),auth[_0x2d91('0x8')](),controller['getSubjects']);router[_0x2d91('0x7')]('/:id/descriptions',auth[_0x2d91('0x8')](),controller[_0x2d91('0xe')]);router[_0x2d91('0xf')]('/',auth['isAuthenticated'](),controller[_0x2d91('0x10')]);router[_0x2d91('0x11')]('/:id',auth[_0x2d91('0x8')](),controller['update']);router['delete'](_0x2d91('0xa'),auth[_0x2d91('0x8')](),controller[_0x2d91('0x12')]);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 3cca14f..97a030f 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 _0xd4df=['contact_lead','contact','lead','ENUM','nothing','exports','STRING','Case'];(function(_0x3eee56,_0x176daf){var _0x506bcd=function(_0x3cfe8b){while(--_0x3cfe8b){_0x3eee56['push'](_0x3eee56['shift']());}};_0x506bcd(++_0x176daf);}(_0xd4df,0x6d));var _0xfd4d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4df[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xfd4d('0x0')]={'name':{'type':Sequelize[_0xfd4d('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('Task',_0xfd4d('0x2')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0xfd4d('0x3'),_0xfd4d('0x4'),_0xfd4d('0x5')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xfd4d('0x6')](_0xfd4d('0x7'),_0xfd4d('0x4'),_0xfd4d('0x5')),'defaultValue':_0xfd4d('0x5')}}; \ No newline at end of file +var _0x7642=['lead','nothing','exports','STRING','ENUM','Case','Task','contact_lead','contact'];(function(_0x1c699d,_0x4473cf){var _0x1dccf2=function(_0x8090ba){while(--_0x8090ba){_0x1c699d['push'](_0x1c699d['shift']());}};_0x1dccf2(++_0x4473cf);}(_0x7642,0x1e8));var _0x2764=function(_0x122d7a,_0xb5feaf){_0x122d7a=_0x122d7a-0x0;var _0x28a542=_0x7642[_0x122d7a];return _0x28a542;};'use strict';var Sequelize=require('sequelize');module[_0x2764('0x0')]={'name':{'type':Sequelize[_0x2764('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x2764('0x2')]('Task',_0x2764('0x3')),'defaultValue':_0x2764('0x4')},'moduleSearch':{'type':Sequelize[_0x2764('0x2')](_0x2764('0x5'),_0x2764('0x6'),_0x2764('0x7')),'defaultValue':_0x2764('0x5')},'moduleCreate':{'type':Sequelize[_0x2764('0x2')](_0x2764('0x8'),_0x2764('0x6'),'lead'),'defaultValue':_0x2764('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index d4d62ee..272bd8c 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 _0x5096=['length','include','find','create','body','findOne','SalesforceField','getFields','getSubjects','pick','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','json','count','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0x5096,0x6c));var _0x6509=function(_0x25cb87,_0xc2d352){_0x25cb87=_0x25cb87-0x0;var _0x3a7537=_0x5096[_0x25cb87];return _0x3a7537;};'use strict';var pdf=require(_0x6509('0x0'));var emlformat=require(_0x6509('0x1'));var rimraf=require(_0x6509('0x2'));var zipdir=require(_0x6509('0x3'));var jsonpatch=require(_0x6509('0x4'));var rp=require('request-promise');var moment=require(_0x6509('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6509('0x6'));var util=require(_0x6509('0x7'));var path=require(_0x6509('0x8'));var sox=require(_0x6509('0x9'));var csv=require(_0x6509('0xa'));var ejs=require(_0x6509('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6509('0xc'));var crypto=require(_0x6509('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6509('0xe'));var toCsv=require(_0x6509('0xa'));var querystring=require(_0x6509('0xf'));var Papa=require(_0x6509('0x10'));var Redis=require(_0x6509('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6509('0x12'));var as=require(_0x6509('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6509('0x14'));var utils=require(_0x6509('0x15'));var config=require(_0x6509('0x16'));var db=require(_0x6509('0x17'))['db'];var jayson=require(_0x6509('0x18'));var client=jayson[_0x6509('0x19')][_0x6509('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x444488,_0x39b39f,_0x178977){if(_0x178977){var _0x580098=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x580098[_0x6509('0x1b')](_0x39b39f)){return _0x444488;}else{throw new db[(_0x6509('0x1c'))][(_0x6509('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 _0x444488;}}function respondWithRpcPromise(_0x42bc70,_0x466af3,_0x392511,_0x395b15){return new BPromise(function(_0x3e0478,_0x23da13){var _0x56f514=_0x395b15||client;return _0x56f514[_0x6509('0x1e')](_0x42bc70,_0x392511)[_0x6509('0x1f')](function(_0x1c9909){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x466af3,_0x6509('0x20'));logger[_0x6509('0x21')](_0x6509('0x22'),_0x466af3,'request\x20sent',JSON[_0x6509('0x23')](_0x1c9909));if(_0x1c9909[_0x6509('0x24')]){if(_0x1c9909['error'][_0x6509('0x25')]===0x1f4){logger[_0x6509('0x24')](_0x6509('0x26'),_0x466af3,_0x1c9909['error'][_0x6509('0x27')]);return _0x23da13(_0x1c9909[_0x6509('0x24')][_0x6509('0x27')]);}logger[_0x6509('0x24')](_0x6509('0x26'),_0x466af3,_0x1c9909[_0x6509('0x24')][_0x6509('0x27')]);return _0x3e0478(_0x1c9909[_0x6509('0x24')]['message']);}else{logger['info'](_0x6509('0x26'),_0x466af3,_0x6509('0x20'));_0x3e0478(_0x1c9909[_0x6509('0x28')][_0x6509('0x27')]);}})['catch'](function(_0x4052e6){logger[_0x6509('0x24')](_0x6509('0x26'),_0x466af3,_0x4052e6);_0x23da13(_0x4052e6);});});}function respondWithStatusCode(_0x8ef38c,_0x1abf30){_0x1abf30=_0x1abf30||0xcc;return function(_0x296c49){if(_0x296c49){return _0x8ef38c[_0x6509('0x29')](_0x1abf30);}return _0x8ef38c[_0x6509('0x2a')](_0x1abf30)['end']();};}function respondWithResult(_0x36294d,_0x681de4){_0x681de4=_0x681de4||0xc8;return function(_0x36dba3){if(_0x36dba3){return _0x36294d[_0x6509('0x2a')](_0x681de4)[_0x6509('0x2b')](_0x36dba3);}};}function respondWithFilteredResult(_0x10d08d,_0x8f63d0){return function(_0x3977b3){if(_0x3977b3){var _0x3d98fb=_0x3977b3[_0x6509('0x2c')],_0x55d210=_0x8f63d0['offset'],_0x4e0cf6=_0x8f63d0['offset']+_0x8f63d0['limit'],_0x9f73bb;if(_0x4e0cf6>=_0x3d98fb){_0x4e0cf6=_0x3d98fb;_0x9f73bb=0xc8;}else{_0x9f73bb=0xce;}_0x10d08d[_0x6509('0x2a')](_0x9f73bb);return _0x10d08d[_0x6509('0x2d')]('Content-Range',_0x55d210+'-'+_0x4e0cf6+'/'+_0x3d98fb)[_0x6509('0x2b')](_0x3977b3);}return null;};}function patchUpdates(_0x36fba1){return function(_0x796de){try{jsonpatch[_0x6509('0x2e')](_0x796de,_0x36fba1,!![]);}catch(_0x287e79){return BPromise[_0x6509('0x2f')](_0x287e79);}return _0x796de[_0x6509('0x30')]();};}function saveUpdates(_0x1a8999,_0x4a7ff4){return function(_0x647d27){if(_0x647d27){return _0x647d27[_0x6509('0x31')](_0x1a8999)[_0x6509('0x1f')](function(_0x3862da){return _0x3862da;});}return null;};}function removeEntity(_0xfabbe6,_0x2e144c){return function(_0x4c53bb){if(_0x4c53bb){return _0x4c53bb[_0x6509('0x32')]()['then'](function(){_0xfabbe6[_0x6509('0x2a')](0xcc)[_0x6509('0x33')]();});}};}function handleEntityNotFound(_0xd30706,_0x5b3c88){return function(_0xad386c){if(!_0xad386c){_0xd30706['sendStatus'](0x194);}return _0xad386c;};}function handleError(_0x20dc14,_0xf1be96){_0xf1be96=_0xf1be96||0x1f4;return function(_0x288f18){logger['error'](_0x288f18[_0x6509('0x34')]);if(_0x288f18[_0x6509('0x35')]){delete _0x288f18[_0x6509('0x35')];}_0x20dc14['status'](_0xf1be96)[_0x6509('0x36')](_0x288f18);};}exports[_0x6509('0x37')]=function(_0x1aaa1e,_0xaff3fb){var _0xe29775={},_0x1cccbd={},_0x340998={'count':0x0,'rows':[]};var _0x2f4496=_[_0x6509('0x38')](db[_0x6509('0x39')][_0x6509('0x3a')],function(_0x44e9c1){return{'name':_0x44e9c1[_0x6509('0x3b')],'type':_0x44e9c1['type'][_0x6509('0x3c')]};});_0x1cccbd[_0x6509('0x3d')]=_[_0x6509('0x38')](_0x2f4496,_0x6509('0x35'));_0x1cccbd[_0x6509('0x3e')]=_['keys'](_0x1aaa1e[_0x6509('0x3e')]);_0x1cccbd[_0x6509('0x3f')]=_[_0x6509('0x40')](_0x1cccbd[_0x6509('0x3d')],_0x1cccbd[_0x6509('0x3e')]);_0xe29775[_0x6509('0x41')]=_[_0x6509('0x40')](_0x1cccbd[_0x6509('0x3d')],qs[_0x6509('0x42')](_0x1aaa1e[_0x6509('0x3e')]['fields']));_0xe29775['attributes']=_0xe29775['attributes']['length']?_0xe29775['attributes']:_0x1cccbd[_0x6509('0x3d')];if(!_0x1aaa1e[_0x6509('0x3e')][_0x6509('0x43')](_0x6509('0x44'))){_0xe29775[_0x6509('0x45')]=qs[_0x6509('0x45')](_0x1aaa1e[_0x6509('0x3e')][_0x6509('0x45')]);_0xe29775['offset']=qs['offset'](_0x1aaa1e['query'][_0x6509('0x46')]);}_0xe29775[_0x6509('0x47')]=qs['sort'](_0x1aaa1e['query'][_0x6509('0x48')]);_0xe29775[_0x6509('0x49')]=qs[_0x6509('0x3f')](_['pick'](_0x1aaa1e[_0x6509('0x3e')],_0x1cccbd[_0x6509('0x3f')]),_0x2f4496);if(_0x1aaa1e[_0x6509('0x3e')]['filter']){_0xe29775[_0x6509('0x49')]=_[_0x6509('0x4a')](_0xe29775[_0x6509('0x49')],{'$or':_['map'](_0x2f4496,function(_0x2a3da4){if(_0x2a3da4[_0x6509('0x4b')]!==_0x6509('0x4c')){var _0x21172f={};_0x21172f[_0x2a3da4['name']]={'$like':'%'+_0x1aaa1e[_0x6509('0x3e')][_0x6509('0x4d')]+'%'};return _0x21172f;}})});}_0xe29775=_[_0x6509('0x4a')]({},_0xe29775,_0x1aaa1e[_0x6509('0x4e')]);var _0x306a95={'where':_0xe29775[_0x6509('0x49')]};return db['SalesforceConfiguration'][_0x6509('0x2c')](_0x306a95)[_0x6509('0x1f')](function(_0x137275){_0x340998[_0x6509('0x2c')]=_0x137275;if(_0x1aaa1e[_0x6509('0x3e')][_0x6509('0x4f')]){_0xe29775['include']=[{'all':!![]}];}return db[_0x6509('0x39')][_0x6509('0x50')](_0xe29775);})[_0x6509('0x1f')](function(_0x49e9ae){_0x340998[_0x6509('0x51')]=_0x49e9ae;return _0x340998;})[_0x6509('0x1f')](respondWithFilteredResult(_0xaff3fb,_0xe29775))[_0x6509('0x52')](handleError(_0xaff3fb,null));};exports[_0x6509('0x53')]=function(_0x256f53,_0x272d6c){var _0x1af1c5={'raw':![],'where':{'id':_0x256f53[_0x6509('0x54')]['id']}},_0x33bc61={};_0x33bc61[_0x6509('0x3d')]=_[_0x6509('0x55')](db[_0x6509('0x39')][_0x6509('0x3a')]);_0x33bc61['query']=_[_0x6509('0x55')](_0x256f53[_0x6509('0x3e')]);_0x33bc61[_0x6509('0x3f')]=_[_0x6509('0x40')](_0x33bc61[_0x6509('0x3d')],_0x33bc61[_0x6509('0x3e')]);_0x1af1c5[_0x6509('0x41')]=_['intersection'](_0x33bc61[_0x6509('0x3d')],qs[_0x6509('0x42')](_0x256f53[_0x6509('0x3e')]['fields']));_0x1af1c5['attributes']=_0x1af1c5[_0x6509('0x41')][_0x6509('0x56')]?_0x1af1c5[_0x6509('0x41')]:_0x33bc61[_0x6509('0x3d')];if(_0x256f53[_0x6509('0x3e')][_0x6509('0x4f')]){_0x1af1c5[_0x6509('0x57')]=[{'all':!![]}];}_0x1af1c5=_[_0x6509('0x4a')]({},_0x1af1c5,_0x256f53[_0x6509('0x4e')]);return db['SalesforceConfiguration'][_0x6509('0x58')](_0x1af1c5)[_0x6509('0x1f')](handleEntityNotFound(_0x272d6c,null))[_0x6509('0x1f')](respondWithResult(_0x272d6c,null))['catch'](handleError(_0x272d6c,null));};exports[_0x6509('0x59')]=function(_0x14cd04,_0x112821){return db[_0x6509('0x39')][_0x6509('0x59')](_0x14cd04[_0x6509('0x5a')],{})[_0x6509('0x1f')](respondWithResult(_0x112821,0xc9))[_0x6509('0x52')](handleError(_0x112821,null));};exports['update']=function(_0x2bdd46,_0x2d5e6c){if(_0x2bdd46[_0x6509('0x5a')]['id']){delete _0x2bdd46[_0x6509('0x5a')]['id'];}return db[_0x6509('0x39')][_0x6509('0x58')]({'where':{'id':_0x2bdd46[_0x6509('0x54')]['id']}})[_0x6509('0x1f')](handleEntityNotFound(_0x2d5e6c,null))[_0x6509('0x1f')](saveUpdates(_0x2bdd46[_0x6509('0x5a')],null))[_0x6509('0x1f')](respondWithResult(_0x2d5e6c,null))['catch'](handleError(_0x2d5e6c,null));};exports[_0x6509('0x32')]=function(_0x5aebf1,_0x5d0ed0){return db['SalesforceConfiguration'][_0x6509('0x58')]({'where':{'id':_0x5aebf1[_0x6509('0x54')]['id']}})[_0x6509('0x1f')](handleEntityNotFound(_0x5d0ed0,null))[_0x6509('0x1f')](removeEntity(_0x5d0ed0,null))[_0x6509('0x52')](handleError(_0x5d0ed0,null));};exports['getFields']=function(_0x12a765,_0x10b49f,_0x4d4c71){var _0x4d0435={};var _0x1633cf={};var _0x297ba3;var _0x1e0e9a;return db[_0x6509('0x39')][_0x6509('0x5b')]({'where':{'id':_0x12a765[_0x6509('0x54')]['id']}})[_0x6509('0x1f')](handleEntityNotFound(_0x10b49f,null))[_0x6509('0x1f')](function(_0x3c9eeb){if(_0x3c9eeb){_0x297ba3=_0x3c9eeb;_0x1633cf['model']=_[_0x6509('0x55')](db[_0x6509('0x5c')]['rawAttributes']);_0x1633cf[_0x6509('0x3e')]=_[_0x6509('0x55')](_0x12a765[_0x6509('0x3e')]);_0x1633cf[_0x6509('0x3f')]=_[_0x6509('0x40')](_0x1633cf[_0x6509('0x3d')],_0x1633cf[_0x6509('0x3e')]);_0x4d0435[_0x6509('0x41')]=_[_0x6509('0x40')](_0x1633cf['model'],qs[_0x6509('0x42')](_0x12a765[_0x6509('0x3e')]['fields']));_0x4d0435[_0x6509('0x41')]=_0x4d0435['attributes'][_0x6509('0x56')]?_0x4d0435[_0x6509('0x41')]:_0x1633cf['model'];_0x4d0435[_0x6509('0x47')]=qs[_0x6509('0x48')](_0x12a765['query']['sort']);_0x4d0435[_0x6509('0x49')]=qs[_0x6509('0x3f')](_['pick'](_0x12a765[_0x6509('0x3e')],_0x1633cf[_0x6509('0x3f')]));if(_0x12a765[_0x6509('0x3e')][_0x6509('0x4d')]){_0x4d0435[_0x6509('0x49')]=_[_0x6509('0x4a')](_0x4d0435[_0x6509('0x49')],{'$or':_[_0x6509('0x38')](_0x4d0435[_0x6509('0x41')],function(_0xb8144b){var _0x31c0ca={};_0x31c0ca[_0xb8144b]={'$like':'%'+_0x12a765[_0x6509('0x3e')]['filter']+'%'};return _0x31c0ca;})});}_0x4d0435=_[_0x6509('0x4a')]({},_0x4d0435,_0x12a765[_0x6509('0x4e')]);return _0x297ba3[_0x6509('0x5d')](_0x4d0435);}})[_0x6509('0x1f')](function(_0x3d200e){if(_0x3d200e){_0x1e0e9a=_0x3d200e['length'];if(!_0x12a765[_0x6509('0x3e')][_0x6509('0x43')](_0x6509('0x44'))){_0x4d0435['limit']=qs[_0x6509('0x45')](_0x12a765['query']['limit']);_0x4d0435['offset']=qs[_0x6509('0x46')](_0x12a765[_0x6509('0x3e')][_0x6509('0x46')]);}return _0x297ba3[_0x6509('0x5d')](_0x4d0435);}})['then'](function(_0x518122){if(_0x518122){return _0x518122?{'count':_0x1e0e9a,'rows':_0x518122}:null;}})[_0x6509('0x1f')](respondWithResult(_0x10b49f,null))[_0x6509('0x52')](handleError(_0x10b49f,null));};exports[_0x6509('0x5e')]=function(_0x2c927a,_0x59d19d,_0x5706eb){var _0x14be52={};var _0x3c8e53={};var _0x2a10e1;var _0x278b2c;return db[_0x6509('0x39')][_0x6509('0x5b')]({'where':{'id':_0x2c927a['params']['id']}})[_0x6509('0x1f')](handleEntityNotFound(_0x59d19d,null))[_0x6509('0x1f')](function(_0xda3f29){if(_0xda3f29){_0x2a10e1=_0xda3f29;_0x3c8e53[_0x6509('0x3d')]=_[_0x6509('0x55')](db['SalesforceField'][_0x6509('0x3a')]);_0x3c8e53['query']=_[_0x6509('0x55')](_0x2c927a[_0x6509('0x3e')]);_0x3c8e53['filters']=_[_0x6509('0x40')](_0x3c8e53[_0x6509('0x3d')],_0x3c8e53[_0x6509('0x3e')]);_0x14be52[_0x6509('0x41')]=_['intersection'](_0x3c8e53[_0x6509('0x3d')],qs[_0x6509('0x42')](_0x2c927a[_0x6509('0x3e')]['fields']));_0x14be52[_0x6509('0x41')]=_0x14be52[_0x6509('0x41')][_0x6509('0x56')]?_0x14be52[_0x6509('0x41')]:_0x3c8e53['model'];_0x14be52[_0x6509('0x47')]=qs[_0x6509('0x48')](_0x2c927a['query'][_0x6509('0x48')]);_0x14be52[_0x6509('0x49')]=qs[_0x6509('0x3f')](_[_0x6509('0x5f')](_0x2c927a[_0x6509('0x3e')],_0x3c8e53[_0x6509('0x3f')]));if(_0x2c927a[_0x6509('0x3e')][_0x6509('0x4d')]){_0x14be52['where']=_['merge'](_0x14be52[_0x6509('0x49')],{'$or':_['map'](_0x14be52[_0x6509('0x41')],function(_0x25e9cc){var _0x1784b1={};_0x1784b1[_0x25e9cc]={'$like':'%'+_0x2c927a[_0x6509('0x3e')]['filter']+'%'};return _0x1784b1;})});}_0x14be52=_['merge']({},_0x14be52,_0x2c927a[_0x6509('0x4e')]);return _0x2a10e1[_0x6509('0x5e')](_0x14be52);}})['then'](function(_0x400967){if(_0x400967){_0x278b2c=_0x400967[_0x6509('0x56')];if(!_0x2c927a['query'][_0x6509('0x43')](_0x6509('0x44'))){_0x14be52[_0x6509('0x45')]=qs[_0x6509('0x45')](_0x2c927a[_0x6509('0x3e')]['limit']);_0x14be52['offset']=qs[_0x6509('0x46')](_0x2c927a[_0x6509('0x3e')][_0x6509('0x46')]);}return _0x2a10e1[_0x6509('0x5e')](_0x14be52);}})[_0x6509('0x1f')](function(_0x42fc45){if(_0x42fc45){return _0x42fc45?{'count':_0x278b2c,'rows':_0x42fc45}:null;}})[_0x6509('0x1f')](respondWithResult(_0x59d19d,null))['catch'](handleError(_0x59d19d,null));};exports[_0x6509('0x60')]=function(_0x452ad6,_0x3f8668,_0x1bbbb8){var _0x377e7e={};var _0x185ef7={};var _0x427445;var _0x43d619;return db['SalesforceConfiguration'][_0x6509('0x5b')]({'where':{'id':_0x452ad6['params']['id']}})['then'](handleEntityNotFound(_0x3f8668,null))[_0x6509('0x1f')](function(_0x15cbb7){if(_0x15cbb7){_0x427445=_0x15cbb7;_0x185ef7[_0x6509('0x3d')]=_[_0x6509('0x55')](db[_0x6509('0x5c')][_0x6509('0x3a')]);_0x185ef7[_0x6509('0x3e')]=_[_0x6509('0x55')](_0x452ad6[_0x6509('0x3e')]);_0x185ef7[_0x6509('0x3f')]=_[_0x6509('0x40')](_0x185ef7[_0x6509('0x3d')],_0x185ef7[_0x6509('0x3e')]);_0x377e7e['attributes']=_['intersection'](_0x185ef7[_0x6509('0x3d')],qs[_0x6509('0x42')](_0x452ad6['query'][_0x6509('0x42')]));_0x377e7e['attributes']=_0x377e7e[_0x6509('0x41')][_0x6509('0x56')]?_0x377e7e['attributes']:_0x185ef7[_0x6509('0x3d')];_0x377e7e[_0x6509('0x47')]=qs[_0x6509('0x48')](_0x452ad6['query'][_0x6509('0x48')]);_0x377e7e['where']=qs['filters'](_[_0x6509('0x5f')](_0x452ad6[_0x6509('0x3e')],_0x185ef7[_0x6509('0x3f')]));if(_0x452ad6[_0x6509('0x3e')][_0x6509('0x4d')]){_0x377e7e[_0x6509('0x49')]=_['merge'](_0x377e7e['where'],{'$or':_[_0x6509('0x38')](_0x377e7e['attributes'],function(_0xcd6d42){var _0x257d3c={};_0x257d3c[_0xcd6d42]={'$like':'%'+_0x452ad6[_0x6509('0x3e')][_0x6509('0x4d')]+'%'};return _0x257d3c;})});}_0x377e7e=_[_0x6509('0x4a')]({},_0x377e7e,_0x452ad6['options']);return _0x427445[_0x6509('0x60')](_0x377e7e);}})[_0x6509('0x1f')](function(_0x280da7){if(_0x280da7){_0x43d619=_0x280da7[_0x6509('0x56')];if(!_0x452ad6['query'][_0x6509('0x43')]('nolimit')){_0x377e7e['limit']=qs[_0x6509('0x45')](_0x452ad6[_0x6509('0x3e')][_0x6509('0x45')]);_0x377e7e['offset']=qs[_0x6509('0x46')](_0x452ad6['query'][_0x6509('0x46')]);}return _0x427445[_0x6509('0x60')](_0x377e7e);}})[_0x6509('0x1f')](function(_0x28f24c){if(_0x28f24c){return _0x28f24c?{'count':_0x43d619,'rows':_0x28f24c}:null;}})[_0x6509('0x1f')](respondWithResult(_0x3f8668,null))[_0x6509('0x52')](handleError(_0x3f8668,null));}; \ No newline at end of file +var _0xaaea=['rawAttributes','options','create','body','find','getFields','SalesforceField','getSubjects','findOne','order','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','SalesforceConfiguration','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xaaea,0x183));var _0xaaae=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xaaea[_0x465028];return _0xb783d4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaaae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaaae('0x1'));var jsonpatch=require(_0xaaae('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaaae('0x3'));var Mustache=require(_0xaaae('0x4'));var util=require(_0xaaae('0x5'));var path=require(_0xaaae('0x6'));var sox=require('sox');var csv=require(_0xaaae('0x7'));var ejs=require(_0xaaae('0x8'));var fs=require('fs');var _=require(_0xaaae('0x9'));var squel=require(_0xaaae('0xa'));var crypto=require('crypto');var jsforce=require(_0xaaae('0xb'));var deskjs=require(_0xaaae('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaaae('0xd'));var Papa=require(_0xaaae('0xe'));var Redis=require('ioredis');var authService=require(_0xaaae('0xf'));var qs=require(_0xaaae('0x10'));var as=require(_0xaaae('0x11'));var hardwareService=require(_0xaaae('0x12'));var logger=require(_0xaaae('0x13'))(_0xaaae('0x14'));var utils=require(_0xaaae('0x15'));var config=require(_0xaaae('0x16'));var db=require(_0xaaae('0x17'))['db'];var jayson=require(_0xaaae('0x18'));var client=jayson['client'][_0xaaae('0x19')]({'port':0x232a});function checkPasswordPattern(_0x53c6b8,_0x33be02,_0x1e2938){if(_0x1e2938){var _0x422da2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x422da2[_0xaaae('0x1a')](_0x33be02)){return _0x53c6b8;}else{throw new db[(_0xaaae('0x1b'))]['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 _0x53c6b8;}}function respondWithRpcPromise(_0x494def,_0x4d80ed,_0x389218,_0x2eab92){return new BPromise(function(_0x358e10,_0x191bfb){var _0xb3d5ed=_0x2eab92||client;return _0xb3d5ed[_0xaaae('0x1c')](_0x494def,_0x389218)[_0xaaae('0x1d')](function(_0x29da48){logger['info'](_0xaaae('0x1e'),_0x4d80ed,_0xaaae('0x1f'));logger['debug'](_0xaaae('0x20'),_0x4d80ed,_0xaaae('0x1f'),JSON[_0xaaae('0x21')](_0x29da48));if(_0x29da48[_0xaaae('0x22')]){if(_0x29da48[_0xaaae('0x22')]['code']===0x1f4){logger[_0xaaae('0x22')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4d80ed,_0x29da48[_0xaaae('0x22')]['message']);return _0x191bfb(_0x29da48[_0xaaae('0x22')][_0xaaae('0x23')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4d80ed,_0x29da48[_0xaaae('0x22')]['message']);return _0x358e10(_0x29da48[_0xaaae('0x22')][_0xaaae('0x23')]);}else{logger[_0xaaae('0x24')](_0xaaae('0x1e'),_0x4d80ed,_0xaaae('0x1f'));_0x358e10(_0x29da48[_0xaaae('0x25')][_0xaaae('0x23')]);}})[_0xaaae('0x26')](function(_0x531e28){logger[_0xaaae('0x22')](_0xaaae('0x1e'),_0x4d80ed,_0x531e28);_0x191bfb(_0x531e28);});});}function respondWithStatusCode(_0x3fcf65,_0x24a448){_0x24a448=_0x24a448||0xcc;return function(_0x3a0907){if(_0x3a0907){return _0x3fcf65[_0xaaae('0x27')](_0x24a448);}return _0x3fcf65[_0xaaae('0x28')](_0x24a448)[_0xaaae('0x29')]();};}function respondWithResult(_0x11ff12,_0xbe3e28){_0xbe3e28=_0xbe3e28||0xc8;return function(_0x9e717b){if(_0x9e717b){return _0x11ff12[_0xaaae('0x28')](_0xbe3e28)[_0xaaae('0x2a')](_0x9e717b);}};}function respondWithFilteredResult(_0x2c87b0,_0x526bff){return function(_0x2b9004){if(_0x2b9004){var _0x3c9da1=_0x2b9004[_0xaaae('0x2b')],_0xb2b67a=_0x526bff['offset'],_0x43776a=_0x526bff[_0xaaae('0x2c')]+_0x526bff['limit'],_0x4c89b0;if(_0x43776a>=_0x3c9da1){_0x43776a=_0x3c9da1;_0x4c89b0=0xc8;}else{_0x4c89b0=0xce;}_0x2c87b0[_0xaaae('0x28')](_0x4c89b0);return _0x2c87b0['set'](_0xaaae('0x2d'),_0xb2b67a+'-'+_0x43776a+'/'+_0x3c9da1)[_0xaaae('0x2a')](_0x2b9004);}return null;};}function patchUpdates(_0x39ab24){return function(_0x301c6a){try{jsonpatch[_0xaaae('0x2e')](_0x301c6a,_0x39ab24,!![]);}catch(_0x99f0bc){return BPromise[_0xaaae('0x2f')](_0x99f0bc);}return _0x301c6a[_0xaaae('0x30')]();};}function saveUpdates(_0x4c9717,_0x19d568){return function(_0x4a830d){if(_0x4a830d){return _0x4a830d[_0xaaae('0x31')](_0x4c9717)['then'](function(_0x317f1d){return _0x317f1d;});}return null;};}function removeEntity(_0x171d17,_0x238f01){return function(_0x56000f){if(_0x56000f){return _0x56000f[_0xaaae('0x32')]()['then'](function(){_0x171d17[_0xaaae('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e0ae9,_0x565500){return function(_0xf04729){if(!_0xf04729){_0x3e0ae9['sendStatus'](0x194);}return _0xf04729;};}function handleError(_0x46dc27,_0x71c1a6){_0x71c1a6=_0x71c1a6||0x1f4;return function(_0x10e1fd){logger[_0xaaae('0x22')](_0x10e1fd[_0xaaae('0x33')]);if(_0x10e1fd[_0xaaae('0x34')]){delete _0x10e1fd['name'];}_0x46dc27[_0xaaae('0x28')](_0x71c1a6)[_0xaaae('0x35')](_0x10e1fd);};}exports[_0xaaae('0x36')]=function(_0x5dfe3f,_0x1789c7){var _0x372efc={},_0xeb8b={},_0x39c6f6={'count':0x0,'rows':[]};var _0xf097de=_['map'](db[_0xaaae('0x37')]['rawAttributes'],function(_0x2854af){return{'name':_0x2854af[_0xaaae('0x38')],'type':_0x2854af[_0xaaae('0x39')][_0xaaae('0x3a')]};});_0xeb8b[_0xaaae('0x3b')]=_[_0xaaae('0x3c')](_0xf097de,'name');_0xeb8b['query']=_[_0xaaae('0x3d')](_0x5dfe3f[_0xaaae('0x3e')]);_0xeb8b[_0xaaae('0x3f')]=_[_0xaaae('0x40')](_0xeb8b['model'],_0xeb8b['query']);_0x372efc['attributes']=_['intersection'](_0xeb8b[_0xaaae('0x3b')],qs[_0xaaae('0x41')](_0x5dfe3f[_0xaaae('0x3e')]['fields']));_0x372efc['attributes']=_0x372efc[_0xaaae('0x42')][_0xaaae('0x43')]?_0x372efc[_0xaaae('0x42')]:_0xeb8b['model'];if(!_0x5dfe3f[_0xaaae('0x3e')][_0xaaae('0x44')](_0xaaae('0x45'))){_0x372efc[_0xaaae('0x46')]=qs[_0xaaae('0x46')](_0x5dfe3f[_0xaaae('0x3e')][_0xaaae('0x46')]);_0x372efc[_0xaaae('0x2c')]=qs[_0xaaae('0x2c')](_0x5dfe3f[_0xaaae('0x3e')][_0xaaae('0x2c')]);}_0x372efc['order']=qs['sort'](_0x5dfe3f[_0xaaae('0x3e')][_0xaaae('0x47')]);_0x372efc[_0xaaae('0x48')]=qs['filters'](_[_0xaaae('0x49')](_0x5dfe3f[_0xaaae('0x3e')],_0xeb8b['filters']),_0xf097de);if(_0x5dfe3f[_0xaaae('0x3e')][_0xaaae('0x4a')]){_0x372efc[_0xaaae('0x48')]=_[_0xaaae('0x4b')](_0x372efc['where'],{'$or':_['map'](_0xf097de,function(_0x4a32bd){if(_0x4a32bd[_0xaaae('0x39')]!==_0xaaae('0x4c')){var _0x50b01f={};_0x50b01f[_0x4a32bd[_0xaaae('0x34')]]={'$like':'%'+_0x5dfe3f[_0xaaae('0x3e')][_0xaaae('0x4a')]+'%'};return _0x50b01f;}})});}_0x372efc=_[_0xaaae('0x4b')]({},_0x372efc,_0x5dfe3f['options']);var _0xb6c96e={'where':_0x372efc[_0xaaae('0x48')]};return db[_0xaaae('0x37')][_0xaaae('0x2b')](_0xb6c96e)[_0xaaae('0x1d')](function(_0x5aa38f){_0x39c6f6['count']=_0x5aa38f;if(_0x5dfe3f['query'][_0xaaae('0x4d')]){_0x372efc[_0xaaae('0x4e')]=[{'all':!![]}];}return db[_0xaaae('0x37')][_0xaaae('0x4f')](_0x372efc);})['then'](function(_0x1389e8){_0x39c6f6[_0xaaae('0x50')]=_0x1389e8;return _0x39c6f6;})[_0xaaae('0x1d')](respondWithFilteredResult(_0x1789c7,_0x372efc))[_0xaaae('0x26')](handleError(_0x1789c7,null));};exports[_0xaaae('0x51')]=function(_0x336d72,_0x38ad6d){var _0x1d2c5f={'raw':![],'where':{'id':_0x336d72[_0xaaae('0x52')]['id']}},_0x23b915={};_0x23b915[_0xaaae('0x3b')]=_[_0xaaae('0x3d')](db[_0xaaae('0x37')][_0xaaae('0x53')]);_0x23b915[_0xaaae('0x3e')]=_['keys'](_0x336d72['query']);_0x23b915[_0xaaae('0x3f')]=_[_0xaaae('0x40')](_0x23b915[_0xaaae('0x3b')],_0x23b915[_0xaaae('0x3e')]);_0x1d2c5f[_0xaaae('0x42')]=_[_0xaaae('0x40')](_0x23b915[_0xaaae('0x3b')],qs[_0xaaae('0x41')](_0x336d72[_0xaaae('0x3e')]['fields']));_0x1d2c5f[_0xaaae('0x42')]=_0x1d2c5f[_0xaaae('0x42')][_0xaaae('0x43')]?_0x1d2c5f[_0xaaae('0x42')]:_0x23b915[_0xaaae('0x3b')];if(_0x336d72[_0xaaae('0x3e')][_0xaaae('0x4d')]){_0x1d2c5f[_0xaaae('0x4e')]=[{'all':!![]}];}_0x1d2c5f=_['merge']({},_0x1d2c5f,_0x336d72[_0xaaae('0x54')]);return db[_0xaaae('0x37')]['find'](_0x1d2c5f)[_0xaaae('0x1d')](handleEntityNotFound(_0x38ad6d,null))[_0xaaae('0x1d')](respondWithResult(_0x38ad6d,null))['catch'](handleError(_0x38ad6d,null));};exports[_0xaaae('0x55')]=function(_0x20dee5,_0x51c061){return db['SalesforceConfiguration'][_0xaaae('0x55')](_0x20dee5[_0xaaae('0x56')],{})[_0xaaae('0x1d')](respondWithResult(_0x51c061,0xc9))[_0xaaae('0x26')](handleError(_0x51c061,null));};exports[_0xaaae('0x31')]=function(_0x5da5ff,_0x32963b){if(_0x5da5ff[_0xaaae('0x56')]['id']){delete _0x5da5ff['body']['id'];}return db[_0xaaae('0x37')]['find']({'where':{'id':_0x5da5ff[_0xaaae('0x52')]['id']}})[_0xaaae('0x1d')](handleEntityNotFound(_0x32963b,null))[_0xaaae('0x1d')](saveUpdates(_0x5da5ff['body'],null))[_0xaaae('0x1d')](respondWithResult(_0x32963b,null))[_0xaaae('0x26')](handleError(_0x32963b,null));};exports[_0xaaae('0x32')]=function(_0x3baa62,_0x30fedd){return db[_0xaaae('0x37')][_0xaaae('0x57')]({'where':{'id':_0x3baa62['params']['id']}})[_0xaaae('0x1d')](handleEntityNotFound(_0x30fedd,null))[_0xaaae('0x1d')](removeEntity(_0x30fedd,null))[_0xaaae('0x26')](handleError(_0x30fedd,null));};exports[_0xaaae('0x58')]=function(_0x70fe71,_0x28918a,_0x8571f4){var _0x5d777b={};var _0x86bc0a={};var _0x58fc5e;var _0x37fb9e;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x70fe71[_0xaaae('0x52')]['id']}})[_0xaaae('0x1d')](handleEntityNotFound(_0x28918a,null))['then'](function(_0x565008){if(_0x565008){_0x58fc5e=_0x565008;_0x86bc0a['model']=_[_0xaaae('0x3d')](db[_0xaaae('0x59')][_0xaaae('0x53')]);_0x86bc0a[_0xaaae('0x3e')]=_[_0xaaae('0x3d')](_0x70fe71['query']);_0x86bc0a[_0xaaae('0x3f')]=_[_0xaaae('0x40')](_0x86bc0a[_0xaaae('0x3b')],_0x86bc0a[_0xaaae('0x3e')]);_0x5d777b[_0xaaae('0x42')]=_[_0xaaae('0x40')](_0x86bc0a[_0xaaae('0x3b')],qs[_0xaaae('0x41')](_0x70fe71['query']['fields']));_0x5d777b[_0xaaae('0x42')]=_0x5d777b['attributes'][_0xaaae('0x43')]?_0x5d777b[_0xaaae('0x42')]:_0x86bc0a[_0xaaae('0x3b')];_0x5d777b['order']=qs['sort'](_0x70fe71['query'][_0xaaae('0x47')]);_0x5d777b['where']=qs[_0xaaae('0x3f')](_['pick'](_0x70fe71['query'],_0x86bc0a['filters']));if(_0x70fe71[_0xaaae('0x3e')][_0xaaae('0x4a')]){_0x5d777b[_0xaaae('0x48')]=_[_0xaaae('0x4b')](_0x5d777b['where'],{'$or':_[_0xaaae('0x3c')](_0x5d777b['attributes'],function(_0x33142a){var _0x1738c7={};_0x1738c7[_0x33142a]={'$like':'%'+_0x70fe71[_0xaaae('0x3e')]['filter']+'%'};return _0x1738c7;})});}_0x5d777b=_['merge']({},_0x5d777b,_0x70fe71[_0xaaae('0x54')]);return _0x58fc5e[_0xaaae('0x58')](_0x5d777b);}})[_0xaaae('0x1d')](function(_0x27d28c){if(_0x27d28c){_0x37fb9e=_0x27d28c[_0xaaae('0x43')];if(!_0x70fe71[_0xaaae('0x3e')][_0xaaae('0x44')](_0xaaae('0x45'))){_0x5d777b[_0xaaae('0x46')]=qs[_0xaaae('0x46')](_0x70fe71['query'][_0xaaae('0x46')]);_0x5d777b[_0xaaae('0x2c')]=qs[_0xaaae('0x2c')](_0x70fe71[_0xaaae('0x3e')][_0xaaae('0x2c')]);}return _0x58fc5e['getFields'](_0x5d777b);}})[_0xaaae('0x1d')](function(_0x540074){if(_0x540074){return _0x540074?{'count':_0x37fb9e,'rows':_0x540074}:null;}})[_0xaaae('0x1d')](respondWithResult(_0x28918a,null))[_0xaaae('0x26')](handleError(_0x28918a,null));};exports[_0xaaae('0x5a')]=function(_0x33e0c6,_0x238859,_0x41bef1){var _0x277ecb={};var _0x26e1cc={};var _0x16ca51;var _0x149095;return db['SalesforceConfiguration'][_0xaaae('0x5b')]({'where':{'id':_0x33e0c6[_0xaaae('0x52')]['id']}})['then'](handleEntityNotFound(_0x238859,null))[_0xaaae('0x1d')](function(_0x39efa5){if(_0x39efa5){_0x16ca51=_0x39efa5;_0x26e1cc[_0xaaae('0x3b')]=_[_0xaaae('0x3d')](db[_0xaaae('0x59')]['rawAttributes']);_0x26e1cc['query']=_[_0xaaae('0x3d')](_0x33e0c6[_0xaaae('0x3e')]);_0x26e1cc[_0xaaae('0x3f')]=_['intersection'](_0x26e1cc[_0xaaae('0x3b')],_0x26e1cc[_0xaaae('0x3e')]);_0x277ecb[_0xaaae('0x42')]=_[_0xaaae('0x40')](_0x26e1cc[_0xaaae('0x3b')],qs[_0xaaae('0x41')](_0x33e0c6[_0xaaae('0x3e')][_0xaaae('0x41')]));_0x277ecb[_0xaaae('0x42')]=_0x277ecb[_0xaaae('0x42')][_0xaaae('0x43')]?_0x277ecb[_0xaaae('0x42')]:_0x26e1cc[_0xaaae('0x3b')];_0x277ecb[_0xaaae('0x5c')]=qs['sort'](_0x33e0c6[_0xaaae('0x3e')][_0xaaae('0x47')]);_0x277ecb[_0xaaae('0x48')]=qs['filters'](_[_0xaaae('0x49')](_0x33e0c6[_0xaaae('0x3e')],_0x26e1cc[_0xaaae('0x3f')]));if(_0x33e0c6[_0xaaae('0x3e')][_0xaaae('0x4a')]){_0x277ecb[_0xaaae('0x48')]=_[_0xaaae('0x4b')](_0x277ecb[_0xaaae('0x48')],{'$or':_[_0xaaae('0x3c')](_0x277ecb[_0xaaae('0x42')],function(_0xe425b){var _0x45e400={};_0x45e400[_0xe425b]={'$like':'%'+_0x33e0c6[_0xaaae('0x3e')]['filter']+'%'};return _0x45e400;})});}_0x277ecb=_[_0xaaae('0x4b')]({},_0x277ecb,_0x33e0c6[_0xaaae('0x54')]);return _0x16ca51['getSubjects'](_0x277ecb);}})[_0xaaae('0x1d')](function(_0x2258bf){if(_0x2258bf){_0x149095=_0x2258bf[_0xaaae('0x43')];if(!_0x33e0c6['query']['hasOwnProperty'](_0xaaae('0x45'))){_0x277ecb[_0xaaae('0x46')]=qs[_0xaaae('0x46')](_0x33e0c6['query'][_0xaaae('0x46')]);_0x277ecb[_0xaaae('0x2c')]=qs[_0xaaae('0x2c')](_0x33e0c6[_0xaaae('0x3e')]['offset']);}return _0x16ca51[_0xaaae('0x5a')](_0x277ecb);}})[_0xaaae('0x1d')](function(_0xacbbb1){if(_0xacbbb1){return _0xacbbb1?{'count':_0x149095,'rows':_0xacbbb1}:null;}})[_0xaaae('0x1d')](respondWithResult(_0x238859,null))[_0xaaae('0x26')](handleError(_0x238859,null));};exports[_0xaaae('0x5d')]=function(_0x5d9e4b,_0x5b800c,_0xc97ee1){var _0x5949a2={};var _0x75b0de={};var _0x1a62f6;var _0x3d2f50;return db[_0xaaae('0x37')][_0xaaae('0x5b')]({'where':{'id':_0x5d9e4b[_0xaaae('0x52')]['id']}})[_0xaaae('0x1d')](handleEntityNotFound(_0x5b800c,null))['then'](function(_0x32f7f0){if(_0x32f7f0){_0x1a62f6=_0x32f7f0;_0x75b0de[_0xaaae('0x3b')]=_[_0xaaae('0x3d')](db[_0xaaae('0x59')][_0xaaae('0x53')]);_0x75b0de[_0xaaae('0x3e')]=_[_0xaaae('0x3d')](_0x5d9e4b[_0xaaae('0x3e')]);_0x75b0de[_0xaaae('0x3f')]=_[_0xaaae('0x40')](_0x75b0de['model'],_0x75b0de['query']);_0x5949a2[_0xaaae('0x42')]=_[_0xaaae('0x40')](_0x75b0de[_0xaaae('0x3b')],qs[_0xaaae('0x41')](_0x5d9e4b[_0xaaae('0x3e')][_0xaaae('0x41')]));_0x5949a2[_0xaaae('0x42')]=_0x5949a2[_0xaaae('0x42')][_0xaaae('0x43')]?_0x5949a2['attributes']:_0x75b0de['model'];_0x5949a2[_0xaaae('0x5c')]=qs[_0xaaae('0x47')](_0x5d9e4b['query'][_0xaaae('0x47')]);_0x5949a2[_0xaaae('0x48')]=qs['filters'](_[_0xaaae('0x49')](_0x5d9e4b['query'],_0x75b0de[_0xaaae('0x3f')]));if(_0x5d9e4b[_0xaaae('0x3e')][_0xaaae('0x4a')]){_0x5949a2[_0xaaae('0x48')]=_[_0xaaae('0x4b')](_0x5949a2[_0xaaae('0x48')],{'$or':_[_0xaaae('0x3c')](_0x5949a2[_0xaaae('0x42')],function(_0x5ad0c7){var _0x5f4422={};_0x5f4422[_0x5ad0c7]={'$like':'%'+_0x5d9e4b[_0xaaae('0x3e')]['filter']+'%'};return _0x5f4422;})});}_0x5949a2=_[_0xaaae('0x4b')]({},_0x5949a2,_0x5d9e4b[_0xaaae('0x54')]);return _0x1a62f6[_0xaaae('0x5d')](_0x5949a2);}})[_0xaaae('0x1d')](function(_0x4aeb61){if(_0x4aeb61){_0x3d2f50=_0x4aeb61[_0xaaae('0x43')];if(!_0x5d9e4b[_0xaaae('0x3e')][_0xaaae('0x44')](_0xaaae('0x45'))){_0x5949a2['limit']=qs[_0xaaae('0x46')](_0x5d9e4b[_0xaaae('0x3e')][_0xaaae('0x46')]);_0x5949a2[_0xaaae('0x2c')]=qs[_0xaaae('0x2c')](_0x5d9e4b[_0xaaae('0x3e')][_0xaaae('0x2c')]);}return _0x1a62f6['getDescriptions'](_0x5949a2);}})[_0xaaae('0x1d')](function(_0x2436da){if(_0x2436da){return _0x2436da?{'count':_0x3d2f50,'rows':_0x2436da}:null;}})[_0xaaae('0x1d')](respondWithResult(_0x5b800c,null))[_0xaaae('0x26')](handleError(_0x5b800c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7e4a35e..ef87a3b 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 _0x101e=['bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x101e,0x141));var _0xe101=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x101e[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xe101('0x0'));var util=require(_0xe101('0x1'));var logger=require(_0xe101('0x2'))('api');var moment=require(_0xe101('0x3'));var BPromise=require(_0xe101('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe101('0x5'));var rimraf=require(_0xe101('0x6'));var config=require(_0xe101('0x7'));var attributes=require(_0xe101('0x8'));module[_0xe101('0x9')]=function(_0x4e311e,_0x42bbaa){return _0x4e311e[_0xe101('0xa')](_0xe101('0xb'),attributes,{'tableName':_0xe101('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9b3=['moment','request-promise','path','rimraf','../../config/environment','exports','int_salesforce_configurations','util','../../config/logger','api'];(function(_0x1d90ca,_0x3bab16){var _0x28872b=function(_0x3ea71b){while(--_0x3ea71b){_0x1d90ca['push'](_0x1d90ca['shift']());}};_0x28872b(++_0x3bab16);}(_0xb9b3,0x15b));var _0x3b9b=function(_0xba9332,_0x4b4a65){_0xba9332=_0xba9332-0x0;var _0x4ef1ba=_0xb9b3[_0xba9332];return _0x4ef1ba;};'use strict';var _=require('lodash');var util=require(_0x3b9b('0x0'));var logger=require(_0x3b9b('0x1'))(_0x3b9b('0x2'));var moment=require(_0x3b9b('0x3'));var BPromise=require('bluebird');var rp=require(_0x3b9b('0x4'));var fs=require('fs');var path=require(_0x3b9b('0x5'));var rimraf=require(_0x3b9b('0x6'));var config=require(_0x3b9b('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x3b9b('0x8')]=function(_0xebfe1d,_0x29795f){return _0xebfe1d['define']('SalesforceConfiguration',attributes,{'tableName':_0x3b9b('0x9'),'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 290d511..f0b03d9 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 _0xf7c4=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xf7c4,0xd1));var _0x4f7c=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xf7c4[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x4f7c('0x0'));var moment=require(_0x4f7c('0x1'));var BPromise=require('bluebird');var rs=require(_0x4f7c('0x2'));var fs=require('fs');var Redis=require(_0x4f7c('0x3'));var db=require(_0x4f7c('0x4'))['db'];var utils=require(_0x4f7c('0x5'));var logger=require('../../config/logger')(_0x4f7c('0x6'));var config=require('../../config/environment');var jayson=require(_0x4f7c('0x7'));var client=jayson[_0x4f7c('0x8')][_0x4f7c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58a088,_0x4175d5,_0x79c873){return new BPromise(function(_0x533aff,_0x4e293f){return client[_0x4f7c('0xa')](_0x58a088,_0x79c873)[_0x4f7c('0xb')](function(_0x26f690){logger[_0x4f7c('0xc')](_0x4f7c('0xd'),_0x4175d5,_0x4f7c('0xe'));logger[_0x4f7c('0xf')](_0x4f7c('0x10'),_0x4175d5,_0x4f7c('0xe'),JSON[_0x4f7c('0x11')](_0x26f690));if(_0x26f690[_0x4f7c('0x12')]){if(_0x26f690[_0x4f7c('0x12')][_0x4f7c('0x13')]===0x1f4){logger[_0x4f7c('0x12')](_0x4f7c('0xd'),_0x4175d5,_0x26f690[_0x4f7c('0x12')][_0x4f7c('0x14')]);return _0x4e293f(_0x26f690[_0x4f7c('0x12')]['message']);}logger[_0x4f7c('0x12')](_0x4f7c('0xd'),_0x4175d5,_0x26f690[_0x4f7c('0x12')]['message']);return _0x533aff(_0x26f690[_0x4f7c('0x12')][_0x4f7c('0x14')]);}else{logger['info'](_0x4f7c('0xd'),_0x4175d5,_0x4f7c('0xe'));_0x533aff(_0x26f690[_0x4f7c('0x15')][_0x4f7c('0x14')]);}})[_0x4f7c('0x16')](function(_0x4740ae){logger[_0x4f7c('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4175d5,_0x4740ae);_0x4e293f(_0x4740ae);});});} \ No newline at end of file +var _0x4858=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','moment','bluebird','randomstring','ioredis'];(function(_0x4e0e9b,_0x45999e){var _0x4790b2=function(_0x3e2419){while(--_0x3e2419){_0x4e0e9b['push'](_0x4e0e9b['shift']());}};_0x4790b2(++_0x45999e);}(_0x4858,0x146));var _0x8485=function(_0x5cde01,_0x398a50){_0x5cde01=_0x5cde01-0x0;var _0x1a46de=_0x4858[_0x5cde01];return _0x1a46de;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8485('0x0'));var BPromise=require(_0x8485('0x1'));var rs=require(_0x8485('0x2'));var fs=require('fs');var Redis=require(_0x8485('0x3'));var db=require(_0x8485('0x4'))['db'];var utils=require(_0x8485('0x5'));var logger=require(_0x8485('0x6'))(_0x8485('0x7'));var config=require(_0x8485('0x8'));var jayson=require(_0x8485('0x9'));var client=jayson['client'][_0x8485('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c08b6,_0x25b97d,_0xa71a82){return new BPromise(function(_0x38c3ad,_0x1105d3){return client[_0x8485('0xb')](_0x4c08b6,_0xa71a82)[_0x8485('0xc')](function(_0x145519){logger[_0x8485('0xd')](_0x8485('0xe'),_0x25b97d,_0x8485('0xf'));logger[_0x8485('0x10')](_0x8485('0x11'),_0x25b97d,_0x8485('0xf'),JSON['stringify'](_0x145519));if(_0x145519[_0x8485('0x12')]){if(_0x145519[_0x8485('0x12')][_0x8485('0x13')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x25b97d,_0x145519[_0x8485('0x12')][_0x8485('0x14')]);return _0x1105d3(_0x145519['error'][_0x8485('0x14')]);}logger[_0x8485('0x12')](_0x8485('0xe'),_0x25b97d,_0x145519[_0x8485('0x12')][_0x8485('0x14')]);return _0x38c3ad(_0x145519['error'][_0x8485('0x14')]);}else{logger[_0x8485('0xd')](_0x8485('0xe'),_0x25b97d,_0x8485('0xf'));_0x38c3ad(_0x145519[_0x8485('0x15')][_0x8485('0x14')]);}})['catch'](function(_0x212e67){logger[_0x8485('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x25b97d,_0x212e67);_0x1105d3(_0x212e67);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index ddaf1f9..8fee08f 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 _0x3f8a=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x17636e,_0x38ce15){var _0xafd088=function(_0xf20682){while(--_0xf20682){_0x17636e['push'](_0x17636e['shift']());}};_0xafd088(++_0x38ce15);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x110870,_0x3a552a){_0x110870=_0x110870-0x0;var _0x480097=_0x3f8a[_0x110870];return _0x480097;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xc'),auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['destroy']);module[_0xa3f8('0x13')]=router; \ No newline at end of file +var _0x1261=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x1261,0x144));var _0x1126=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x1261[_0x20d54d];return _0x516e8b;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0xc')]('/',auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router[_0x1126('0xf')]('/:id',auth[_0x1126('0xd')](),controller[_0x1126('0x10')]);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index cdb1de1..6b46042 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 _0x8557=['string','variable','keyValue','STRING','sequelize','exports'];(function(_0x1119c8,_0x87303e){var _0x3f3071=function(_0x27a847){while(--_0x27a847){_0x1119c8['push'](_0x1119c8['shift']());}};_0x3f3071(++_0x87303e);}(_0x8557,0xd6));var _0x7855=function(_0x16aa70,_0x5b1f73){_0x16aa70=_0x16aa70-0x0;var _0x11875f=_0x8557[_0x16aa70];return _0x11875f;};'use strict';var Sequelize=require(_0x7855('0x0'));module[_0x7855('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7855('0x2'),_0x7855('0x3'),'customVariable',_0x7855('0x4')),'defaultValue':_0x7855('0x2')},'content':{'type':Sequelize[_0x7855('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7855('0x2'),_0x7855('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7855('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7714=['variable','customVariable','keyValue','STRING','string','exports','ENUM'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x7714,0x163));var _0x4771=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x7714[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require('sequelize');module[_0x4771('0x0')]={'type':{'type':Sequelize[_0x4771('0x1')]('string',_0x4771('0x2'),_0x4771('0x3'),_0x4771('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4771('0x5')]},'key':{'type':Sequelize[_0x4771('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x4771('0x6'),_0x4771('0x2'),_0x4771('0x3'))},'keyContent':{'type':Sequelize[_0x4771('0x5')]},'idField':{'type':Sequelize[_0x4771('0x5')]},'variableName':{'type':Sequelize[_0x4771('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 5219a8e..d874298 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 _0xa44c=['stack','name','send','index','map','SalesforceField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa44c,0x13f));var _0xca44=function(_0xe62d0d,_0xae1934){_0xe62d0d=_0xe62d0d-0x0;var _0x28d151=_0xa44c[_0xe62d0d];return _0x28d151;};'use strict';var pdf=require(_0xca44('0x0'));var emlformat=require(_0xca44('0x1'));var rimraf=require(_0xca44('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca44('0x3'));var rp=require(_0xca44('0x4'));var moment=require(_0xca44('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xca44('0x6'));var util=require('util');var path=require('path');var sox=require(_0xca44('0x7'));var csv=require(_0xca44('0x8'));var ejs=require(_0xca44('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xca44('0xa'));var crypto=require('crypto');var jsforce=require(_0xca44('0xb'));var deskjs=require(_0xca44('0xc'));var toCsv=require(_0xca44('0x8'));var querystring=require(_0xca44('0xd'));var Papa=require(_0xca44('0xe'));var Redis=require(_0xca44('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca44('0x10'));var as=require(_0xca44('0x11'));var hardwareService=require(_0xca44('0x12'));var logger=require(_0xca44('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xca44('0x14'))['db'];function respondWithStatusCode(_0x37627e,_0x289c84){_0x289c84=_0x289c84||0xcc;return function(_0x52d139){if(_0x52d139){return _0x37627e[_0xca44('0x15')](_0x289c84);}return _0x37627e[_0xca44('0x16')](_0x289c84)[_0xca44('0x17')]();};}function respondWithResult(_0x15dc01,_0x48017d){_0x48017d=_0x48017d||0xc8;return function(_0x278860){if(_0x278860){return _0x15dc01['status'](_0x48017d)[_0xca44('0x18')](_0x278860);}};}function respondWithFilteredResult(_0x53aac5,_0x3a3b8f){return function(_0x3c909b){if(_0x3c909b){var _0x213943=_0x3c909b[_0xca44('0x19')],_0x3176f6=_0x3a3b8f['offset'],_0x26852f=_0x3a3b8f[_0xca44('0x1a')]+_0x3a3b8f[_0xca44('0x1b')],_0x36d9d2;if(_0x26852f>=_0x213943){_0x26852f=_0x213943;_0x36d9d2=0xc8;}else{_0x36d9d2=0xce;}_0x53aac5['status'](_0x36d9d2);return _0x53aac5[_0xca44('0x1c')](_0xca44('0x1d'),_0x3176f6+'-'+_0x26852f+'/'+_0x213943)['json'](_0x3c909b);}return null;};}function patchUpdates(_0x32983b){return function(_0x22784c){try{jsonpatch['apply'](_0x22784c,_0x32983b,!![]);}catch(_0x4016ad){return BPromise[_0xca44('0x1e')](_0x4016ad);}return _0x22784c[_0xca44('0x1f')]();};}function saveUpdates(_0x205061,_0x148880){return function(_0x2f5dad){if(_0x2f5dad){return _0x2f5dad[_0xca44('0x20')](_0x205061)[_0xca44('0x21')](function(_0x474fe8){return _0x474fe8;});}return null;};}function removeEntity(_0x47437b,_0x26b297){return function(_0xb81ee5){if(_0xb81ee5){return _0xb81ee5[_0xca44('0x22')]()[_0xca44('0x21')](function(){_0x47437b['status'](0xcc)[_0xca44('0x17')]();});}};}function handleEntityNotFound(_0x1b14db,_0x41ae5c){return function(_0xe6c520){if(!_0xe6c520){_0x1b14db[_0xca44('0x15')](0x194);}return _0xe6c520;};}function handleError(_0x3eaa47,_0x1375c0){_0x1375c0=_0x1375c0||0x1f4;return function(_0x437c5e){logger[_0xca44('0x23')](_0x437c5e[_0xca44('0x24')]);if(_0x437c5e['name']){delete _0x437c5e[_0xca44('0x25')];}_0x3eaa47[_0xca44('0x16')](_0x1375c0)[_0xca44('0x26')](_0x437c5e);};}exports[_0xca44('0x27')]=function(_0x3ce68d,_0x5b49d0){var _0x20d374={},_0xe972e3={},_0x3cb116={'count':0x0,'rows':[]};var _0x55df18=_[_0xca44('0x28')](db[_0xca44('0x29')][_0xca44('0x2a')],function(_0x28e3c8){return{'name':_0x28e3c8['fieldName'],'type':_0x28e3c8['type'][_0xca44('0x2b')]};});_0xe972e3[_0xca44('0x2c')]=_[_0xca44('0x28')](_0x55df18,'name');_0xe972e3[_0xca44('0x2d')]=_[_0xca44('0x2e')](_0x3ce68d[_0xca44('0x2d')]);_0xe972e3[_0xca44('0x2f')]=_[_0xca44('0x30')](_0xe972e3[_0xca44('0x2c')],_0xe972e3[_0xca44('0x2d')]);_0x20d374[_0xca44('0x31')]=_[_0xca44('0x30')](_0xe972e3[_0xca44('0x2c')],qs[_0xca44('0x32')](_0x3ce68d[_0xca44('0x2d')][_0xca44('0x32')]));_0x20d374['attributes']=_0x20d374[_0xca44('0x31')][_0xca44('0x33')]?_0x20d374[_0xca44('0x31')]:_0xe972e3['model'];if(!_0x3ce68d['query'][_0xca44('0x34')](_0xca44('0x35'))){_0x20d374[_0xca44('0x1b')]=qs[_0xca44('0x1b')](_0x3ce68d[_0xca44('0x2d')][_0xca44('0x1b')]);_0x20d374['offset']=qs[_0xca44('0x1a')](_0x3ce68d[_0xca44('0x2d')]['offset']);}_0x20d374[_0xca44('0x36')]=qs[_0xca44('0x37')](_0x3ce68d[_0xca44('0x2d')]['sort']);_0x20d374[_0xca44('0x38')]=qs['filters'](_[_0xca44('0x39')](_0x3ce68d[_0xca44('0x2d')],_0xe972e3[_0xca44('0x2f')]),_0x55df18);if(_0x3ce68d[_0xca44('0x2d')][_0xca44('0x3a')]){_0x20d374[_0xca44('0x38')]=_[_0xca44('0x3b')](_0x20d374[_0xca44('0x38')],{'$or':_['map'](_0x55df18,function(_0x570063){if(_0x570063[_0xca44('0x3c')]!==_0xca44('0x3d')){var _0x493161={};_0x493161[_0x570063[_0xca44('0x25')]]={'$like':'%'+_0x3ce68d[_0xca44('0x2d')][_0xca44('0x3a')]+'%'};return _0x493161;}})});}_0x20d374=_[_0xca44('0x3b')]({},_0x20d374,_0x3ce68d[_0xca44('0x3e')]);var _0x124032={'where':_0x20d374[_0xca44('0x38')]};return db[_0xca44('0x29')][_0xca44('0x19')](_0x124032)[_0xca44('0x21')](function(_0x2ba1df){_0x3cb116['count']=_0x2ba1df;if(_0x3ce68d[_0xca44('0x2d')][_0xca44('0x3f')]){_0x20d374[_0xca44('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0xca44('0x41')](_0x20d374);})[_0xca44('0x21')](function(_0x48743c){_0x3cb116[_0xca44('0x42')]=_0x48743c;return _0x3cb116;})[_0xca44('0x21')](respondWithFilteredResult(_0x5b49d0,_0x20d374))['catch'](handleError(_0x5b49d0,null));};exports['show']=function(_0x315677,_0x40d15d){var _0xc5ed44={'raw':!![],'where':{'id':_0x315677[_0xca44('0x43')]['id']}},_0x5d354e={};_0x5d354e['model']=_['keys'](db['SalesforceField']['rawAttributes']);_0x5d354e[_0xca44('0x2d')]=_[_0xca44('0x2e')](_0x315677[_0xca44('0x2d')]);_0x5d354e[_0xca44('0x2f')]=_[_0xca44('0x30')](_0x5d354e[_0xca44('0x2c')],_0x5d354e[_0xca44('0x2d')]);_0xc5ed44[_0xca44('0x31')]=_[_0xca44('0x30')](_0x5d354e['model'],qs[_0xca44('0x32')](_0x315677[_0xca44('0x2d')][_0xca44('0x32')]));_0xc5ed44[_0xca44('0x31')]=_0xc5ed44[_0xca44('0x31')][_0xca44('0x33')]?_0xc5ed44['attributes']:_0x5d354e['model'];if(_0x315677[_0xca44('0x2d')]['includeAll']){_0xc5ed44[_0xca44('0x40')]=[{'all':!![]}];}_0xc5ed44=_[_0xca44('0x3b')]({},_0xc5ed44,_0x315677[_0xca44('0x3e')]);return db['SalesforceField'][_0xca44('0x44')](_0xc5ed44)[_0xca44('0x21')](handleEntityNotFound(_0x40d15d,null))['then'](respondWithResult(_0x40d15d,null))[_0xca44('0x45')](handleError(_0x40d15d,null));};exports['create']=function(_0x980172,_0x43abce){return db[_0xca44('0x29')]['create'](_0x980172[_0xca44('0x46')],{})[_0xca44('0x21')](respondWithResult(_0x43abce,0xc9))['catch'](handleError(_0x43abce,null));};exports[_0xca44('0x20')]=function(_0x37dc70,_0x58ab5c){if(_0x37dc70[_0xca44('0x46')]['id']){delete _0x37dc70[_0xca44('0x46')]['id'];}return db[_0xca44('0x29')][_0xca44('0x44')]({'where':{'id':_0x37dc70[_0xca44('0x43')]['id']}})[_0xca44('0x21')](handleEntityNotFound(_0x58ab5c,null))[_0xca44('0x21')](saveUpdates(_0x37dc70['body'],null))[_0xca44('0x21')](respondWithResult(_0x58ab5c,null))['catch'](handleError(_0x58ab5c,null));};exports[_0xca44('0x22')]=function(_0xf7b48b,_0x44e0a3){return db[_0xca44('0x29')][_0xca44('0x44')]({'where':{'id':_0xf7b48b[_0xca44('0x43')]['id']}})[_0xca44('0x21')](handleEntityNotFound(_0x44e0a3,null))[_0xca44('0x21')](removeEntity(_0x44e0a3,null))['catch'](handleError(_0x44e0a3,null));}; \ No newline at end of file +var _0xf5a6=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0xf5a6,0x110));var _0x6f5a=function(_0x517eae,_0x3cea0f){_0x517eae=_0x517eae-0x0;var _0x14c8c4=_0xf5a6[_0x517eae];return _0x14c8c4;};'use strict';var pdf=require(_0x6f5a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6f5a('0x1'));var zipdir=require(_0x6f5a('0x2'));var jsonpatch=require(_0x6f5a('0x3'));var rp=require('request-promise');var moment=require(_0x6f5a('0x4'));var BPromise=require(_0x6f5a('0x5'));var Mustache=require(_0x6f5a('0x6'));var util=require(_0x6f5a('0x7'));var path=require(_0x6f5a('0x8'));var sox=require(_0x6f5a('0x9'));var csv=require(_0x6f5a('0xa'));var ejs=require(_0x6f5a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6f5a('0xc'));var crypto=require('crypto');var jsforce=require(_0x6f5a('0xd'));var deskjs=require(_0x6f5a('0xe'));var toCsv=require(_0x6f5a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f5a('0xf'));var authService=require(_0x6f5a('0x10'));var qs=require(_0x6f5a('0x11'));var as=require(_0x6f5a('0x12'));var hardwareService=require(_0x6f5a('0x13'));var logger=require(_0x6f5a('0x14'))(_0x6f5a('0x15'));var utils=require(_0x6f5a('0x16'));var config=require(_0x6f5a('0x17'));var db=require(_0x6f5a('0x18'))['db'];function respondWithStatusCode(_0x7439cd,_0x23394f){_0x23394f=_0x23394f||0xcc;return function(_0x2b283f){if(_0x2b283f){return _0x7439cd[_0x6f5a('0x19')](_0x23394f);}return _0x7439cd[_0x6f5a('0x1a')](_0x23394f)[_0x6f5a('0x1b')]();};}function respondWithResult(_0x316d66,_0x10092f){_0x10092f=_0x10092f||0xc8;return function(_0x32f22d){if(_0x32f22d){return _0x316d66[_0x6f5a('0x1a')](_0x10092f)[_0x6f5a('0x1c')](_0x32f22d);}};}function respondWithFilteredResult(_0x38ce35,_0x479c8d){return function(_0x59ad78){if(_0x59ad78){var _0x428854=_0x59ad78[_0x6f5a('0x1d')],_0x3cbbd0=_0x479c8d[_0x6f5a('0x1e')],_0x4c036b=_0x479c8d[_0x6f5a('0x1e')]+_0x479c8d[_0x6f5a('0x1f')],_0x42ee34;if(_0x4c036b>=_0x428854){_0x4c036b=_0x428854;_0x42ee34=0xc8;}else{_0x42ee34=0xce;}_0x38ce35[_0x6f5a('0x1a')](_0x42ee34);return _0x38ce35['set'](_0x6f5a('0x20'),_0x3cbbd0+'-'+_0x4c036b+'/'+_0x428854)['json'](_0x59ad78);}return null;};}function patchUpdates(_0x23af1e){return function(_0x5c5c1a){try{jsonpatch[_0x6f5a('0x21')](_0x5c5c1a,_0x23af1e,!![]);}catch(_0x9f45a9){return BPromise[_0x6f5a('0x22')](_0x9f45a9);}return _0x5c5c1a['save']();};}function saveUpdates(_0x1036f0,_0x2ccaeb){return function(_0x37b21b){if(_0x37b21b){return _0x37b21b[_0x6f5a('0x23')](_0x1036f0)[_0x6f5a('0x24')](function(_0xdcd46a){return _0xdcd46a;});}return null;};}function removeEntity(_0x230379,_0x397c70){return function(_0x10d32c){if(_0x10d32c){return _0x10d32c[_0x6f5a('0x25')]()['then'](function(){_0x230379[_0x6f5a('0x1a')](0xcc)[_0x6f5a('0x1b')]();});}};}function handleEntityNotFound(_0x3ec384,_0x4fca4d){return function(_0x59029f){if(!_0x59029f){_0x3ec384[_0x6f5a('0x19')](0x194);}return _0x59029f;};}function handleError(_0xe15b99,_0xda931d){_0xda931d=_0xda931d||0x1f4;return function(_0x3889c4){logger[_0x6f5a('0x26')](_0x3889c4[_0x6f5a('0x27')]);if(_0x3889c4[_0x6f5a('0x28')]){delete _0x3889c4[_0x6f5a('0x28')];}_0xe15b99[_0x6f5a('0x1a')](_0xda931d)[_0x6f5a('0x29')](_0x3889c4);};}exports[_0x6f5a('0x2a')]=function(_0x60f485,_0x1fd599){var _0x477413={},_0x5d531b={},_0x45013e={'count':0x0,'rows':[]};var _0x21ec3b=_[_0x6f5a('0x2b')](db[_0x6f5a('0x2c')][_0x6f5a('0x2d')],function(_0x19d110){return{'name':_0x19d110['fieldName'],'type':_0x19d110[_0x6f5a('0x2e')][_0x6f5a('0x2f')]};});_0x5d531b[_0x6f5a('0x30')]=_[_0x6f5a('0x2b')](_0x21ec3b,_0x6f5a('0x28'));_0x5d531b[_0x6f5a('0x31')]=_[_0x6f5a('0x32')](_0x60f485['query']);_0x5d531b['filters']=_[_0x6f5a('0x33')](_0x5d531b[_0x6f5a('0x30')],_0x5d531b['query']);_0x477413[_0x6f5a('0x34')]=_['intersection'](_0x5d531b[_0x6f5a('0x30')],qs[_0x6f5a('0x35')](_0x60f485[_0x6f5a('0x31')]['fields']));_0x477413[_0x6f5a('0x34')]=_0x477413[_0x6f5a('0x34')][_0x6f5a('0x36')]?_0x477413[_0x6f5a('0x34')]:_0x5d531b[_0x6f5a('0x30')];if(!_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x37')](_0x6f5a('0x38'))){_0x477413[_0x6f5a('0x1f')]=qs[_0x6f5a('0x1f')](_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x1f')]);_0x477413['offset']=qs[_0x6f5a('0x1e')](_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x1e')]);}_0x477413[_0x6f5a('0x39')]=qs[_0x6f5a('0x3a')](_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x3a')]);_0x477413[_0x6f5a('0x3b')]=qs[_0x6f5a('0x3c')](_[_0x6f5a('0x3d')](_0x60f485[_0x6f5a('0x31')],_0x5d531b[_0x6f5a('0x3c')]),_0x21ec3b);if(_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x3e')]){_0x477413[_0x6f5a('0x3b')]=_[_0x6f5a('0x3f')](_0x477413[_0x6f5a('0x3b')],{'$or':_[_0x6f5a('0x2b')](_0x21ec3b,function(_0x2a0c17){if(_0x2a0c17[_0x6f5a('0x2e')]!==_0x6f5a('0x40')){var _0x4a1314={};_0x4a1314[_0x2a0c17[_0x6f5a('0x28')]]={'$like':'%'+_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x3e')]+'%'};return _0x4a1314;}})});}_0x477413=_[_0x6f5a('0x3f')]({},_0x477413,_0x60f485[_0x6f5a('0x41')]);var _0x37def1={'where':_0x477413['where']};return db[_0x6f5a('0x2c')][_0x6f5a('0x1d')](_0x37def1)['then'](function(_0x148431){_0x45013e['count']=_0x148431;if(_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x42')]){_0x477413[_0x6f5a('0x43')]=[{'all':!![]}];}return db[_0x6f5a('0x2c')][_0x6f5a('0x44')](_0x477413);})['then'](function(_0x4b2cbf){_0x45013e['rows']=_0x4b2cbf;return _0x45013e;})[_0x6f5a('0x24')](respondWithFilteredResult(_0x1fd599,_0x477413))[_0x6f5a('0x45')](handleError(_0x1fd599,null));};exports[_0x6f5a('0x46')]=function(_0x45aaeb,_0x55be84){var _0x254fbf={'raw':!![],'where':{'id':_0x45aaeb[_0x6f5a('0x47')]['id']}},_0x214cbb={};_0x214cbb['model']=_['keys'](db['SalesforceField'][_0x6f5a('0x2d')]);_0x214cbb[_0x6f5a('0x31')]=_[_0x6f5a('0x32')](_0x45aaeb[_0x6f5a('0x31')]);_0x214cbb[_0x6f5a('0x3c')]=_[_0x6f5a('0x33')](_0x214cbb['model'],_0x214cbb[_0x6f5a('0x31')]);_0x254fbf['attributes']=_[_0x6f5a('0x33')](_0x214cbb[_0x6f5a('0x30')],qs[_0x6f5a('0x35')](_0x45aaeb[_0x6f5a('0x31')][_0x6f5a('0x35')]));_0x254fbf[_0x6f5a('0x34')]=_0x254fbf[_0x6f5a('0x34')]['length']?_0x254fbf[_0x6f5a('0x34')]:_0x214cbb[_0x6f5a('0x30')];if(_0x45aaeb[_0x6f5a('0x31')]['includeAll']){_0x254fbf[_0x6f5a('0x43')]=[{'all':!![]}];}_0x254fbf=_['merge']({},_0x254fbf,_0x45aaeb['options']);return db['SalesforceField']['find'](_0x254fbf)[_0x6f5a('0x24')](handleEntityNotFound(_0x55be84,null))[_0x6f5a('0x24')](respondWithResult(_0x55be84,null))[_0x6f5a('0x45')](handleError(_0x55be84,null));};exports[_0x6f5a('0x48')]=function(_0x1d2e98,_0x2d811e){return db[_0x6f5a('0x2c')][_0x6f5a('0x48')](_0x1d2e98[_0x6f5a('0x49')],{})[_0x6f5a('0x24')](respondWithResult(_0x2d811e,0xc9))[_0x6f5a('0x45')](handleError(_0x2d811e,null));};exports[_0x6f5a('0x23')]=function(_0x1de436,_0x3b161b){if(_0x1de436[_0x6f5a('0x49')]['id']){delete _0x1de436[_0x6f5a('0x49')]['id'];}return db[_0x6f5a('0x2c')]['find']({'where':{'id':_0x1de436[_0x6f5a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b161b,null))[_0x6f5a('0x24')](saveUpdates(_0x1de436[_0x6f5a('0x49')],null))['then'](respondWithResult(_0x3b161b,null))[_0x6f5a('0x45')](handleError(_0x3b161b,null));};exports[_0x6f5a('0x25')]=function(_0x200ea6,_0x408342){return db['SalesforceField']['find']({'where':{'id':_0x200ea6['params']['id']}})[_0x6f5a('0x24')](handleEntityNotFound(_0x408342,null))[_0x6f5a('0x24')](removeEntity(_0x408342,null))['catch'](handleError(_0x408342,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index e25de21..1625aa3 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 _0x4966=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x5b278c,_0x59c94e){var _0x1afb84=function(_0x3c2e38){while(--_0x3c2e38){_0x5b278c['push'](_0x5b278c['shift']());}};_0x1afb84(++_0x59c94e);}(_0x4966,0x82));var _0x6496=function(_0x2ae444,_0x5e9881){_0x2ae444=_0x2ae444-0x0;var _0x4d8790=_0x4966[_0x2ae444];return _0x4d8790;};'use strict';var _=require(_0x6496('0x0'));var util=require(_0x6496('0x1'));var logger=require(_0x6496('0x2'))(_0x6496('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6496('0x4'));var fs=require('fs');var path=require(_0x6496('0x5'));var rimraf=require(_0x6496('0x6'));var config=require(_0x6496('0x7'));var attributes=require(_0x6496('0x8'));module['exports']=function(_0x1ffafc,_0x3db579){return _0x1ffafc[_0x6496('0x9')]('SalesforceField',attributes,{'tableName':_0x6496('0xa'),'paranoid':![],'indexes':[{'name':_0x6496('0xb'),'fields':[_0x6496('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67e1=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d76b7,_0x419b41){var _0x57e41b=function(_0x2c443c){while(--_0x2c443c){_0x4d76b7['push'](_0x4d76b7['shift']());}};_0x57e41b(++_0x419b41);}(_0x67e1,0x17d));var _0x167e=function(_0x2d79c2,_0x37b25e){_0x2d79c2=_0x2d79c2-0x0;var _0x36e40d=_0x67e1[_0x2d79c2];return _0x36e40d;};'use strict';var _=require(_0x167e('0x0'));var util=require(_0x167e('0x1'));var logger=require(_0x167e('0x2'))('api');var moment=require(_0x167e('0x3'));var BPromise=require(_0x167e('0x4'));var rp=require(_0x167e('0x5'));var fs=require('fs');var path=require(_0x167e('0x6'));var rimraf=require(_0x167e('0x7'));var config=require(_0x167e('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0x167e('0x9')]=function(_0xa1a950,_0x3ff52b){return _0xa1a950[_0x167e('0xa')](_0x167e('0xb'),attributes,{'tableName':_0x167e('0xc'),'paranoid':![],'indexes':[{'name':_0x167e('0xd'),'fields':[_0x167e('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index f6f1a0c..40fa4fa 100644 --- a/server/api/intSalesforceField/intSalesforceField.rpc.js +++ b/server/api/intSalesforceField/intSalesforceField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2d866f,_0x4ab197){var _0x592669=function(_0x3ecf07){while(--_0x3ecf07){_0x2d866f['push'](_0x2d866f['shift']());}};_0x592669(++_0x4ab197);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5106f5,_0x54fc3c){_0x5106f5=_0x5106f5-0x0;var _0x3e4fd6=_0xb43b[_0x5106f5];return _0x3e4fd6;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xa9e0=['http','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xdd5da3,_0x23f91c){var _0x1ad238=function(_0x14d729){while(--_0x14d729){_0xdd5da3['push'](_0xdd5da3['shift']());}};_0x1ad238(++_0x23f91c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 9965d39..3e96c14 100644 --- a/server/api/intServicenowAccount/index.js +++ b/server/api/intServicenowAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9901=['/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9901,0x15e));var _0x1990=function(_0x4d973c,_0x36153f){_0x4d973c=_0x4d973c-0x0;var _0x33d408=_0x9901[_0x4d973c];return _0x33d408;};'use strict';var multer=require('multer');var util=require(_0x1990('0x0'));var path=require('path');var timeout=require(_0x1990('0x1'));var express=require(_0x1990('0x2'));var router=express[_0x1990('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1990('0x4'));var config=require(_0x1990('0x5'));var controller=require(_0x1990('0x6'));router[_0x1990('0x7')]('/',auth[_0x1990('0x8')](),controller[_0x1990('0x9')]);router[_0x1990('0x7')](_0x1990('0xa'),auth[_0x1990('0x8')](),controller[_0x1990('0xb')]);router[_0x1990('0x7')]('/:id/configurations',auth[_0x1990('0x8')](),controller[_0x1990('0xc')]);router[_0x1990('0x7')](_0x1990('0xd'),auth[_0x1990('0x8')](),controller[_0x1990('0xe')]);router[_0x1990('0xf')]('/',auth[_0x1990('0x8')](),controller[_0x1990('0x10')]);router[_0x1990('0xf')](_0x1990('0x11'),auth[_0x1990('0x8')](),controller['addConfiguration']);router[_0x1990('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1990('0x13')]);router['delete'](_0x1990('0xa'),auth[_0x1990('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x046e=['/:id/configurations','addConfiguration','delete','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','/:id','show','get','getConfigurations','/:id/fields','getFields','post'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x046e,0x1b4));var _0xe046=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0x046e[_0x2b45b5];return _0x1d9c06;};'use strict';var multer=require(_0xe046('0x0'));var util=require('util');var path=require(_0xe046('0x1'));var timeout=require('connect-timeout');var express=require(_0xe046('0x2'));var router=express[_0xe046('0x3')]();var auth=require(_0xe046('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe046('0x5'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0xe046('0x6')](),controller['index']);router['get'](_0xe046('0x7'),auth['isAuthenticated'](),controller[_0xe046('0x8')]);router[_0xe046('0x9')]('/:id/configurations',auth[_0xe046('0x6')](),controller[_0xe046('0xa')]);router[_0xe046('0x9')](_0xe046('0xb'),auth[_0xe046('0x6')](),controller[_0xe046('0xc')]);router[_0xe046('0xd')]('/',auth[_0xe046('0x6')](),controller['create']);router[_0xe046('0xd')](_0xe046('0xe'),auth[_0xe046('0x6')](),controller[_0xe046('0xf')]);router['put'](_0xe046('0x7'),auth[_0xe046('0x6')](),controller['update']);router[_0xe046('0x10')](_0xe046('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xe046('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 6ea604b..619ccae 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 _0xbc86=['sequelize','exports','STRING','username','remoteUri'];(function(_0x480eca,_0x2167d2){var _0x4c3917=function(_0x5cee39){while(--_0x5cee39){_0x480eca['push'](_0x480eca['shift']());}};_0x4c3917(++_0x2167d2);}(_0xbc86,0x1e0));var _0x6bc8=function(_0x30bc19,_0xfcd0f1){_0x30bc19=_0x30bc19-0x0;var _0x331b0c=_0xbc86[_0x30bc19];return _0x331b0c;};'use strict';var Sequelize=require(_0x6bc8('0x0'));module[_0x6bc8('0x1')]={'name':{'type':Sequelize[_0x6bc8('0x2')]},'description':{'type':Sequelize[_0x6bc8('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6bc8('0x3')},'password':{'type':Sequelize[_0x6bc8('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6bc8('0x2')],'unique':_0x6bc8('0x4')},'serverUrl':{'type':Sequelize[_0x6bc8('0x2')]}}; \ No newline at end of file +var _0x0017=['username','remoteUri','exports','STRING'];(function(_0xc4dc1c,_0x47a3ce){var _0xdb10ea=function(_0x3f32f7){while(--_0x3f32f7){_0xc4dc1c['push'](_0xc4dc1c['shift']());}};_0xdb10ea(++_0x47a3ce);}(_0x0017,0x96));var _0x7001=function(_0x26f866,_0x1900bc){_0x26f866=_0x26f866-0x0;var _0x1abef3=_0x0017[_0x26f866];return _0x1abef3;};'use strict';var Sequelize=require('sequelize');module[_0x7001('0x0')]={'name':{'type':Sequelize[_0x7001('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7001('0x1')],'unique':_0x7001('0x2')},'password':{'type':Sequelize[_0x7001('0x1')]},'email':{'type':Sequelize[_0x7001('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x7001('0x3')},'serverUrl':{'type':Sequelize[_0x7001('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 1381a13..b4b5c26 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 _0x13d1=['debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','catch','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','ServicenowAccount','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','channel','getDescriptions','Subjects','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','urgency','company','activity_due','assigned_to','comments','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','category','email','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','incident?sysparm_display_value=all','result','log','assign','remove','includes','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','internalType','concat','statusCode','Wrong\x20credentials','True','true','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent'];(function(_0x3e2b13,_0x240522){var _0x38bcb4=function(_0x34c27e){while(--_0x34c27e){_0x3e2b13['push'](_0x3e2b13['shift']());}};_0x38bcb4(++_0x240522);}(_0x13d1,0xa3));var _0x113d=function(_0x473806,_0xcd4d75){_0x473806=_0x473806-0x0;var _0x4aca29=_0x13d1[_0x473806];return _0x4aca29;};'use strict';var pdf=require(_0x113d('0x0'));var emlformat=require(_0x113d('0x1'));var rimraf=require(_0x113d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x113d('0x3'));var rp=require(_0x113d('0x4'));var moment=require(_0x113d('0x5'));var BPromise=require(_0x113d('0x6'));var Mustache=require('mustache');var util=require(_0x113d('0x7'));var path=require(_0x113d('0x8'));var sox=require(_0x113d('0x9'));var csv=require(_0x113d('0xa'));var ejs=require(_0x113d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x113d('0xc'));var crypto=require(_0x113d('0xd'));var jsforce=require(_0x113d('0xe'));var deskjs=require(_0x113d('0xf'));var toCsv=require(_0x113d('0xa'));var querystring=require('querystring');var Papa=require(_0x113d('0x10'));var Redis=require(_0x113d('0x11'));var authService=require(_0x113d('0x12'));var qs=require(_0x113d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x113d('0x14'))(_0x113d('0x15'));var utils=require(_0x113d('0x16'));var config=require(_0x113d('0x17'));var db=require(_0x113d('0x18'))['db'];var integrations=require(_0x113d('0x19'));var jayson=require(_0x113d('0x1a'));var client=jayson[_0x113d('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x1feede,_0x3e56bc,_0x305055){if(_0x305055){var _0x1e37ed=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e37ed[_0x113d('0x1c')](_0x3e56bc)){return _0x1feede;}else{throw new db[(_0x113d('0x1d'))][(_0x113d('0x1e'))](_0x113d('0x1f'));}}else{return _0x1feede;}}function respondWithRpcPromise(_0x36c9d4,_0x519f8c,_0x4b85e3,_0xf79b27){return new BPromise(function(_0x1ab4af,_0x1bba84){var _0x54a740=_0xf79b27||client;return _0x54a740[_0x113d('0x20')](_0x36c9d4,_0x4b85e3)[_0x113d('0x21')](function(_0x339470){logger[_0x113d('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x519f8c,_0x113d('0x23'));logger[_0x113d('0x24')](_0x113d('0x25'),_0x519f8c,_0x113d('0x23'),JSON[_0x113d('0x26')](_0x339470));if(_0x339470[_0x113d('0x27')]){if(_0x339470[_0x113d('0x27')]['code']===0x1f4){logger[_0x113d('0x27')](_0x113d('0x28'),_0x519f8c,_0x339470['error'][_0x113d('0x29')]);return _0x1bba84(_0x339470[_0x113d('0x27')][_0x113d('0x29')]);}logger[_0x113d('0x27')](_0x113d('0x28'),_0x519f8c,_0x339470[_0x113d('0x27')][_0x113d('0x29')]);return _0x1ab4af(_0x339470[_0x113d('0x27')]['message']);}else{logger[_0x113d('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x519f8c,_0x113d('0x23'));_0x1ab4af(_0x339470['result']['message']);}})[_0x113d('0x2a')](function(_0x40649e){logger[_0x113d('0x27')](_0x113d('0x28'),_0x519f8c,_0x40649e);_0x1bba84(_0x40649e);});});}function respondWithStatusCode(_0x66a3f2,_0x4fa5b1){_0x4fa5b1=_0x4fa5b1||0xcc;return function(_0x1f6f6e){if(_0x1f6f6e){return _0x66a3f2['sendStatus'](_0x4fa5b1);}return _0x66a3f2[_0x113d('0x2b')](_0x4fa5b1)[_0x113d('0x2c')]();};}function respondWithResult(_0xdf6aff,_0x3789cf){_0x3789cf=_0x3789cf||0xc8;return function(_0x4a8030){if(_0x4a8030){return _0xdf6aff[_0x113d('0x2b')](_0x3789cf)[_0x113d('0x2d')](_0x4a8030);}};}function respondWithFilteredResult(_0xc66328,_0xf5eef1){return function(_0x18e7a9){if(_0x18e7a9){var _0x24b58f=_0x18e7a9[_0x113d('0x2e')],_0x78b58c=_0xf5eef1[_0x113d('0x2f')],_0x46fbad=_0xf5eef1['offset']+_0xf5eef1[_0x113d('0x30')],_0x4200ac;if(_0x46fbad>=_0x24b58f){_0x46fbad=_0x24b58f;_0x4200ac=0xc8;}else{_0x4200ac=0xce;}_0xc66328[_0x113d('0x2b')](_0x4200ac);return _0xc66328[_0x113d('0x31')]('Content-Range',_0x78b58c+'-'+_0x46fbad+'/'+_0x24b58f)[_0x113d('0x2d')](_0x18e7a9);}return null;};}function patchUpdates(_0x1d6380){return function(_0x2ca8ef){try{jsonpatch[_0x113d('0x32')](_0x2ca8ef,_0x1d6380,!![]);}catch(_0x454003){return BPromise[_0x113d('0x33')](_0x454003);}return _0x2ca8ef[_0x113d('0x34')]();};}function saveUpdates(_0x2db53c,_0x14b196){return function(_0x1dc78e){if(_0x1dc78e){return _0x1dc78e[_0x113d('0x35')](_0x2db53c)[_0x113d('0x21')](function(_0x57f7ae){return _0x57f7ae;});}return null;};}function removeEntity(_0x1842b6,_0x32fe5e){return function(_0x5c9048){if(_0x5c9048){return _0x5c9048[_0x113d('0x36')]()['then'](function(){_0x1842b6[_0x113d('0x2b')](0xcc)[_0x113d('0x2c')]();});}};}function handleEntityNotFound(_0x34e9e4,_0x3c80e3){return function(_0x50e5a1){if(!_0x50e5a1){_0x34e9e4[_0x113d('0x37')](0x194);}return _0x50e5a1;};}function handleError(_0x3a84d9,_0x4a7aa0){_0x4a7aa0=_0x4a7aa0||0x1f4;return function(_0x36d69e){logger[_0x113d('0x27')](_0x36d69e[_0x113d('0x38')]);if(_0x36d69e[_0x113d('0x39')]){delete _0x36d69e[_0x113d('0x39')];}_0x3a84d9['status'](_0x4a7aa0)[_0x113d('0x3a')](_0x36d69e);};}exports[_0x113d('0x3b')]=function(_0x1395a7,_0x29e89a){var _0x1e2651={},_0x12a781={},_0x28e108={'count':0x0,'rows':[]};var _0x45214c=_[_0x113d('0x3c')](db[_0x113d('0x3d')]['rawAttributes'],function(_0x2973e6){return{'name':_0x2973e6['fieldName'],'type':_0x2973e6[_0x113d('0x3e')][_0x113d('0x3f')]};});_0x12a781[_0x113d('0x40')]=_[_0x113d('0x3c')](_0x45214c,_0x113d('0x39'));_0x12a781['query']=_[_0x113d('0x41')](_0x1395a7[_0x113d('0x42')]);_0x12a781[_0x113d('0x43')]=_[_0x113d('0x44')](_0x12a781[_0x113d('0x40')],_0x12a781[_0x113d('0x42')]);_0x1e2651[_0x113d('0x45')]=_['intersection'](_0x12a781['model'],qs[_0x113d('0x46')](_0x1395a7['query'][_0x113d('0x46')]));_0x1e2651[_0x113d('0x45')]=_0x1e2651['attributes'][_0x113d('0x47')]?_0x1e2651[_0x113d('0x45')]:_0x12a781[_0x113d('0x40')];if(!_0x1395a7[_0x113d('0x42')][_0x113d('0x48')](_0x113d('0x49'))){_0x1e2651[_0x113d('0x30')]=qs[_0x113d('0x30')](_0x1395a7['query'][_0x113d('0x30')]);_0x1e2651[_0x113d('0x2f')]=qs['offset'](_0x1395a7['query']['offset']);}_0x1e2651[_0x113d('0x4a')]=qs[_0x113d('0x4b')](_0x1395a7[_0x113d('0x42')][_0x113d('0x4b')]);_0x1e2651['where']=qs[_0x113d('0x43')](_[_0x113d('0x4c')](_0x1395a7[_0x113d('0x42')],_0x12a781['filters']),_0x45214c);if(_0x1395a7['query'][_0x113d('0x4d')]){_0x1e2651[_0x113d('0x4e')]=_[_0x113d('0x4f')](_0x1e2651[_0x113d('0x4e')],{'$or':_[_0x113d('0x3c')](_0x45214c,function(_0x2f8a3b){if(_0x2f8a3b['type']!==_0x113d('0x50')){var _0x46186a={};_0x46186a[_0x2f8a3b['name']]={'$like':'%'+_0x1395a7[_0x113d('0x42')][_0x113d('0x4d')]+'%'};return _0x46186a;}})});}_0x1e2651=_[_0x113d('0x4f')]({},_0x1e2651,_0x1395a7[_0x113d('0x51')]);var _0x8b558e={'where':_0x1e2651['where']};return db[_0x113d('0x3d')]['count'](_0x8b558e)[_0x113d('0x21')](function(_0x5e2551){_0x28e108[_0x113d('0x2e')]=_0x5e2551;if(_0x1395a7[_0x113d('0x42')][_0x113d('0x52')]){_0x1e2651['include']=[{'all':!![]}];}return db[_0x113d('0x3d')][_0x113d('0x53')](_0x1e2651);})['then'](function(_0x4de7aa){_0x28e108[_0x113d('0x54')]=_0x4de7aa;return _0x28e108;})[_0x113d('0x21')](respondWithFilteredResult(_0x29e89a,_0x1e2651))['catch'](handleError(_0x29e89a,null));};exports[_0x113d('0x55')]=function(_0x3072e3,_0x4bad4e){var _0x1a3b0e={'raw':![],'where':{'id':_0x3072e3[_0x113d('0x56')]['id']}},_0x2f6595={};_0x2f6595[_0x113d('0x40')]=_['keys'](db[_0x113d('0x3d')][_0x113d('0x57')]);_0x2f6595[_0x113d('0x42')]=_[_0x113d('0x41')](_0x3072e3[_0x113d('0x42')]);_0x2f6595[_0x113d('0x43')]=_[_0x113d('0x44')](_0x2f6595['model'],_0x2f6595[_0x113d('0x42')]);_0x1a3b0e[_0x113d('0x45')]=_[_0x113d('0x44')](_0x2f6595[_0x113d('0x40')],qs[_0x113d('0x46')](_0x3072e3[_0x113d('0x42')][_0x113d('0x46')]));_0x1a3b0e[_0x113d('0x45')]=_0x1a3b0e[_0x113d('0x45')]['length']?_0x1a3b0e[_0x113d('0x45')]:_0x2f6595['model'];if(_0x3072e3[_0x113d('0x42')][_0x113d('0x52')]){_0x1a3b0e[_0x113d('0x58')]=[{'all':!![]}];}_0x1a3b0e=_[_0x113d('0x4f')]({},_0x1a3b0e,_0x3072e3[_0x113d('0x51')]);return db[_0x113d('0x3d')][_0x113d('0x59')](_0x1a3b0e)[_0x113d('0x21')](handleEntityNotFound(_0x4bad4e,null))[_0x113d('0x21')](respondWithResult(_0x4bad4e,null))['catch'](handleError(_0x4bad4e,null));};exports['create']=function(_0x57200e,_0x4444f6){return db[_0x113d('0x3d')][_0x113d('0x5a')](_0x57200e[_0x113d('0x5b')],{})[_0x113d('0x21')](respondWithResult(_0x4444f6,0xc9))[_0x113d('0x2a')](handleError(_0x4444f6,null));};exports[_0x113d('0x35')]=function(_0x5e7502,_0x4c272e){if(_0x5e7502[_0x113d('0x5b')]['id']){delete _0x5e7502[_0x113d('0x5b')]['id'];}return db[_0x113d('0x3d')][_0x113d('0x59')]({'where':{'id':_0x5e7502['params']['id']}})['then'](handleEntityNotFound(_0x4c272e,null))[_0x113d('0x21')](saveUpdates(_0x5e7502[_0x113d('0x5b')],null))[_0x113d('0x21')](respondWithResult(_0x4c272e,null))[_0x113d('0x2a')](handleError(_0x4c272e,null));};exports[_0x113d('0x36')]=function(_0x4cac62,_0x17e6fa){return db[_0x113d('0x3d')]['find']({'where':{'id':_0x4cac62['params']['id']}})[_0x113d('0x21')](handleEntityNotFound(_0x17e6fa,null))[_0x113d('0x21')](removeEntity(_0x17e6fa,null))[_0x113d('0x2a')](handleError(_0x17e6fa,null));};exports[_0x113d('0x5c')]=function(_0xf34c52,_0x3ca167,_0x27c395){var _0x211a64={};var _0x1cc166={};var _0x4b51e5;var _0x3aedf5;return db[_0x113d('0x3d')][_0x113d('0x5d')]({'where':{'id':_0xf34c52[_0x113d('0x56')]['id']}})[_0x113d('0x21')](handleEntityNotFound(_0x3ca167,null))['then'](function(_0x25bbed){if(_0x25bbed){_0x4b51e5=_0x25bbed;_0x1cc166[_0x113d('0x40')]=_[_0x113d('0x41')](db[_0x113d('0x5e')][_0x113d('0x57')]);_0x1cc166['query']=_['keys'](_0xf34c52['query']);_0x1cc166[_0x113d('0x43')]=_[_0x113d('0x44')](_0x1cc166[_0x113d('0x40')],_0x1cc166[_0x113d('0x42')]);_0x211a64[_0x113d('0x45')]=_[_0x113d('0x44')](_0x1cc166['model'],qs[_0x113d('0x46')](_0xf34c52[_0x113d('0x42')][_0x113d('0x46')]));_0x211a64[_0x113d('0x45')]=_0x211a64[_0x113d('0x45')][_0x113d('0x47')]?_0x211a64[_0x113d('0x45')]:_0x1cc166[_0x113d('0x40')];_0x211a64['order']=qs[_0x113d('0x4b')](_0xf34c52[_0x113d('0x42')][_0x113d('0x4b')]);_0x211a64[_0x113d('0x4e')]=qs[_0x113d('0x43')](_['pick'](_0xf34c52['query'],_0x1cc166[_0x113d('0x43')]));if(_0xf34c52[_0x113d('0x42')][_0x113d('0x4d')]){_0x211a64[_0x113d('0x4e')]=_[_0x113d('0x4f')](_0x211a64[_0x113d('0x4e')],{'$or':_[_0x113d('0x3c')](_0x211a64[_0x113d('0x45')],function(_0x51fc3c){var _0x45c1ee={};_0x45c1ee[_0x51fc3c]={'$like':'%'+_0xf34c52[_0x113d('0x42')][_0x113d('0x4d')]+'%'};return _0x45c1ee;})});}_0x211a64=_[_0x113d('0x4f')]({},_0x211a64,_0xf34c52['options']);return _0x4b51e5['getConfigurations'](_0x211a64);}})[_0x113d('0x21')](function(_0x2ef8d4){if(_0x2ef8d4){_0x3aedf5=_0x2ef8d4['length'];if(!_0xf34c52[_0x113d('0x42')][_0x113d('0x48')]('nolimit')){_0x211a64[_0x113d('0x30')]=qs[_0x113d('0x30')](_0xf34c52['query'][_0x113d('0x30')]);_0x211a64[_0x113d('0x2f')]=qs[_0x113d('0x2f')](_0xf34c52[_0x113d('0x42')][_0x113d('0x2f')]);}return _0x4b51e5[_0x113d('0x5c')](_0x211a64);}})['then'](function(_0x1545f9){if(_0x1545f9){return _0x1545f9?{'count':_0x3aedf5,'rows':_0x1545f9}:null;}})[_0x113d('0x21')](respondWithResult(_0x3ca167,null))[_0x113d('0x2a')](handleError(_0x3ca167,null));};exports[_0x113d('0x5f')]=function(_0x368441,_0xa0b66,_0xd7b621){if(_0x368441['body']['id']){delete _0x368441[_0x113d('0x5b')]['id'];}return db[_0x113d('0x3d')][_0x113d('0x5d')]({'where':{'id':_0x368441[_0x113d('0x56')]['id']}})[_0x113d('0x21')](handleEntityNotFound(_0xa0b66,null))[_0x113d('0x21')](function(_0x276950){if(_0x276950){_0x368441[_0x113d('0x5b')][_0x113d('0x60')]=_0x276950['id'];_0x368441[_0x113d('0x5b')]['Subjects']=integrations['getSubjects'](_0x368441[_0x113d('0x5b')][_0x113d('0x61')],_0x368441[_0x113d('0x5b')][_0x113d('0x3e')]);_0x368441[_0x113d('0x5b')]['Descriptions']=integrations[_0x113d('0x62')](_0x368441[_0x113d('0x5b')][_0x113d('0x61')],_0x368441['body'][_0x113d('0x3e')]);return db[_0x113d('0x5e')][_0x113d('0x5a')](_0x368441[_0x113d('0x5b')],{'include':[{'model':db['ServicenowField'],'as':_0x113d('0x63')},{'model':db[_0x113d('0x64')],'as':_0x113d('0x65')}]});}return null;})[_0x113d('0x21')](respondWithResult(_0xa0b66,null))[_0x113d('0x2a')](handleError(_0xa0b66,null));};exports[_0x113d('0x66')]=function(_0x35af26,_0x30573c,_0xea5da4){var _0x54f49c=[_0x113d('0x67'),_0x113d('0x68'),_0x113d('0x69'),_0x113d('0x6a'),_0x113d('0x6b'),_0x113d('0x6c'),_0x113d('0x6d'),_0x113d('0x6e'),'category'];var _0x21cc0c=[_0x113d('0x6f'),_0x113d('0x67'),'caused_by','watch_list',_0x113d('0x70'),_0x113d('0x71'),'child_incidents',_0x113d('0x68'),'approval_history',_0x113d('0x72'),_0x113d('0x73'),_0x113d('0x74'),_0x113d('0x75'),_0x113d('0x76'),_0x113d('0x77'),_0x113d('0x78'),_0x113d('0x79'),'sys_created_by',_0x113d('0x69'),_0x113d('0x4a'),'calendar_stc','closed_at',_0x113d('0x7a'),_0x113d('0x7b'),_0x113d('0x7c'),_0x113d('0x7d'),_0x113d('0x7e'),_0x113d('0x7f'),_0x113d('0x80'),_0x113d('0x81'),_0x113d('0x82'),_0x113d('0x83'),'expected_start',_0x113d('0x84'),_0x113d('0x85'),_0x113d('0x86'),_0x113d('0x87'),_0x113d('0x88'),_0x113d('0x89'),'caller_id',_0x113d('0x8a'),'subcategory',_0x113d('0x8b'),_0x113d('0x8c'),_0x113d('0x6b'),_0x113d('0x8d'),_0x113d('0x8e'),_0x113d('0x8f'),_0x113d('0x90'),_0x113d('0x91'),'additional_assignee_list','description',_0x113d('0x92'),_0x113d('0x6c'),_0x113d('0x93'),_0x113d('0x94'),_0x113d('0x95'),_0x113d('0x96'),_0x113d('0x97'),'sys_id',_0x113d('0x98'),'reopened_by',_0x113d('0x6d'),_0x113d('0x99'),'problem_id',_0x113d('0x9a'),'reassignment_count',_0x113d('0x9b'),_0x113d('0x9c'),_0x113d('0x6e'),_0x113d('0x9d'),'sla_due',_0x113d('0x9e'),'comments_and_work_notes',_0x113d('0x9f'),_0x113d('0xa0'),_0x113d('0xa1'),_0x113d('0xa2'),_0x113d('0xa3'),'upon_approval',_0x113d('0xa4'),_0x113d('0xa5'),_0x113d('0xa6')];var _0x5571ed='';var _0x299bbc='';var _0x5a83f8=[];var _0x3bd7b1='';var _0x4192bd='';var _0x38f4f8=[];var _0x4d6c4e='';var _0x23d4d9='';var _0x55e513={};var _0x267ab3='';return db[_0x113d('0x3d')]['findOne']({'where':{'id':_0x35af26[_0x113d('0x56')]['id']},'attributes':['id','username','password',_0x113d('0xa7'),'remoteUri',_0x113d('0xa8')]})[_0x113d('0x21')](handleEntityNotFound(_0x30573c,null))[_0x113d('0x21')](function(_0x3604f6){if(_0x3604f6){_0x267ab3=_0x3604f6[_0x113d('0xa9')];var _0x5776b6=_0x267ab3[_0x113d('0xaa')](-0x1);if(_0x5776b6==='/'){_0x267ab3=_0x267ab3[_0x113d('0xab')](0x0,_0x267ab3[_0x113d('0xac')](_0x5776b6));}_0x23d4d9=util[_0x113d('0xad')](_0x113d('0xae'),_0x267ab3);_0x4d6c4e=util['format'](_0x113d('0xaf'),_0x267ab3);_0x55e513={'user':_0x3604f6[_0x113d('0xb0')],'pass':_0x3604f6['password']};var _0x344674={'method':'GET','uri':_0x23d4d9+_0x113d('0xb1'),'auth':_0x55e513,'json':!![]};return rp(_0x344674);}})[_0x113d('0x21')](function(_0x1987ef){if(_0x1987ef[_0x113d('0xb2')][_0x113d('0x47')]>0x0){_0x5571ed=_0x1987ef[_0x113d('0xb2')];}console[_0x113d('0xb3')]('incident\x20table\x20objects',_0x5571ed);_0x38f4f8=[];_0x299bbc=Object[_0x113d('0xb4')]([],_0x5571ed);_[_0x113d('0xb5')](_0x299bbc,function(_0x1b4fc9){return!_0x54f49c[_0x113d('0xb6')](_0x1b4fc9[_0x113d('0x39')]);});_0x299bbc['forEach'](function(_0x475e30){var _0x104868=createFieldObject(_0x4d6c4e,_0x55e513,_0x475e30['internalType'],_0x475e30['name'],_0x475e30[_0x113d('0xb7')],![]);_0x38f4f8[_0x113d('0xb8')](_0x104868);});return Promise['all'](_0x38f4f8);})[_0x113d('0x21')](function(_0x58ccdf){_0x5a83f8=_0x58ccdf;_0x3bd7b1=Object[_0x113d('0xb4')]([],_0x5571ed);console[_0x113d('0xb3')](_0x113d('0xb9'),_0x5571ed);_['remove'](_0x3bd7b1,function(_0x28eaf4){return _0x21cc0c['includes'](_0x28eaf4[_0x113d('0x39')]);});console[_0x113d('0xb3')](_0x113d('0xba'),_0x3bd7b1);_0x38f4f8=[];_0x3bd7b1[_0x113d('0xbb')](function(_0x56c0a2){var _0x24b26b=createFieldObject(_0x4d6c4e,_0x55e513,_0x56c0a2[_0x113d('0xbc')],_0x56c0a2[_0x113d('0x39')],_0x56c0a2[_0x113d('0xb7')],!![]);_0x38f4f8[_0x113d('0xb8')](_0x24b26b);});return Promise['all'](_0x38f4f8);})[_0x113d('0x21')](function(_0x5bac1e){_0x4192bd=_0x5bac1e;var _0x4bc034=_0x5a83f8[_0x113d('0xbd')](_0x4192bd);return{'count':_0x4bc034[_0x113d('0x47')],'rows':_0x4bc034};})[_0x113d('0x21')](respondWithResult(_0x30573c,null))[_0x113d('0x2a')](function(_0x3e638f){console['log']('ServiceNow\x20error:\x20'+_0x3e638f);var _0x824d64=_0x35af26[_0x113d('0x42')][_0x113d('0x1c')]?0x1f4:_0x3e638f[_0x113d('0xbe')]||0x1f4;logger['error'](_0x3e638f[_0x113d('0x38')]);delete _0x3e638f[_0x113d('0x39')];if(_0x824d64===0x191){_0x824d64=0x190;}_0x30573c['status'](_0x824d64)[_0x113d('0x3a')](_0x35af26[_0x113d('0x42')]['test']?{'message':_0x113d('0xbf'),'statusCode':_0x3e638f[_0x113d('0xbe')]}:_0x3e638f);});};function createFieldObject(_0x3e75de,_0x516220,_0x2c0981,_0x3b3024,_0x1b8fb3,_0x533c17){return new Promise(function(_0x316061,_0x49ee81){var _0x36030f={'id':_0x3b3024,'name':_0x1b8fb3,'custom':_0x533c17};if(_0x2c0981==='boolean'){_0x36030f[_0x113d('0x51')]=[{'name':_0x113d('0xc0'),'value':_0x113d('0xc1')},{'name':'False','value':_0x113d('0xc2')}];_0x316061(_0x36030f);}else{var _0x1bbfee={'method':_0x113d('0xc3'),'uri':_0x3e75de+_0x113d('0xc4')+_0x3b3024,'auth':_0x516220,'json':!![]};return rp(_0x1bbfee)[_0x113d('0x21')](function(_0x320938){var _0x3f118b=[];if(_0x320938[_0x113d('0xb2')]['length']>0x0){_0x320938[_0x113d('0xb2')][_0x113d('0xbb')](function(_0x2fee4d){if(_0x2fee4d[_0x113d('0xc5')]===_0x113d('0xc2')){var _0x307db3={'name':_0x2fee4d[_0x113d('0xb7')],'value':_0x2fee4d[_0x113d('0xc6')]};_0x3f118b[_0x113d('0xb8')](_0x307db3);}});}_0x36030f['options']=_0x3f118b;if(_0x36030f[_0x113d('0x51')][_0x113d('0x47')]>0x0){_0x316061(_0x36030f);}else{if(_0x533c17==![]){_0x316061();}else{_0x316061(_0x36030f);}}});}});} \ No newline at end of file +var _0xbeb0=['code','message','info','result','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','save','destroy','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','show','params','keys','rawAttributes','length','include','find','create','update','body','findOne','ServicenowConfiguration','getConfigurations','AccountId','Descriptions','getDescriptions','channel','ServicenowField','Subjects','made_sla','hold_reason','close_code','notify','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','opened_by','sys_created_on','sys_domain','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','short_description','delivery_task','work_start','business_stc','description','close_notes','closed_by','contact_type','reopened_by','incident_state','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','statusCode','boolean','True','true','False','false','GET','inactive','html-pdf','eml-format','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','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','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3bf98a,_0x2b1625){var _0x2db380=function(_0x20a469){while(--_0x20a469){_0x3bf98a['push'](_0x3bf98a['shift']());}};_0x2db380(++_0x2b1625);}(_0xbeb0,0x15b));var _0x0beb=function(_0x5926b6,_0x73e2b0){_0x5926b6=_0x5926b6-0x0;var _0x26d589=_0xbeb0[_0x5926b6];return _0x26d589;};'use strict';var pdf=require(_0x0beb('0x0'));var emlformat=require(_0x0beb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0beb('0x2'));var moment=require(_0x0beb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0beb('0x4'));var util=require('util');var path=require(_0x0beb('0x5'));var sox=require(_0x0beb('0x6'));var csv=require(_0x0beb('0x7'));var ejs=require(_0x0beb('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0beb('0x9'));var crypto=require('crypto');var jsforce=require(_0x0beb('0xa'));var deskjs=require(_0x0beb('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0beb('0xc'));var Papa=require(_0x0beb('0xd'));var Redis=require('ioredis');var authService=require(_0x0beb('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0beb('0xf'))('api');var utils=require(_0x0beb('0x10'));var config=require('../../config/environment');var db=require(_0x0beb('0x11'))['db'];var integrations=require(_0x0beb('0x12'));var jayson=require('jayson/promise');var client=jayson[_0x0beb('0x13')]['http']({'port':0x232a});function checkPasswordPattern(_0x333553,_0x3f69b6,_0x7cb6d1){if(_0x7cb6d1){var _0x7bc623=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x7bc623[_0x0beb('0x14')](_0x3f69b6)){return _0x333553;}else{throw new db[(_0x0beb('0x15'))][(_0x0beb('0x16'))](_0x0beb('0x17'));}}else{return _0x333553;}}function respondWithRpcPromise(_0x1c4b9b,_0x3c7b11,_0x7cb79b,_0x478760){return new BPromise(function(_0x1460a2,_0x4e2179){var _0x61f213=_0x478760||client;return _0x61f213[_0x0beb('0x18')](_0x1c4b9b,_0x7cb79b)[_0x0beb('0x19')](function(_0x296f79){logger['info'](_0x0beb('0x1a'),_0x3c7b11,_0x0beb('0x1b'));logger[_0x0beb('0x1c')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3c7b11,'request\x20sent',JSON[_0x0beb('0x1d')](_0x296f79));if(_0x296f79['error']){if(_0x296f79[_0x0beb('0x1e')][_0x0beb('0x1f')]===0x1f4){logger['error'](_0x0beb('0x1a'),_0x3c7b11,_0x296f79[_0x0beb('0x1e')][_0x0beb('0x20')]);return _0x4e2179(_0x296f79[_0x0beb('0x1e')]['message']);}logger[_0x0beb('0x1e')](_0x0beb('0x1a'),_0x3c7b11,_0x296f79[_0x0beb('0x1e')]['message']);return _0x1460a2(_0x296f79[_0x0beb('0x1e')][_0x0beb('0x20')]);}else{logger[_0x0beb('0x21')](_0x0beb('0x1a'),_0x3c7b11,_0x0beb('0x1b'));_0x1460a2(_0x296f79[_0x0beb('0x22')]['message']);}})[_0x0beb('0x23')](function(_0x2dbf2e){logger['error'](_0x0beb('0x1a'),_0x3c7b11,_0x2dbf2e);_0x4e2179(_0x2dbf2e);});});}function respondWithStatusCode(_0x1868b8,_0x39bea5){_0x39bea5=_0x39bea5||0xcc;return function(_0x211be5){if(_0x211be5){return _0x1868b8[_0x0beb('0x24')](_0x39bea5);}return _0x1868b8['status'](_0x39bea5)[_0x0beb('0x25')]();};}function respondWithResult(_0xcff12d,_0x5dd1cb){_0x5dd1cb=_0x5dd1cb||0xc8;return function(_0x21a328){if(_0x21a328){return _0xcff12d[_0x0beb('0x26')](_0x5dd1cb)[_0x0beb('0x27')](_0x21a328);}};}function respondWithFilteredResult(_0x422acb,_0x92170c){return function(_0x591989){if(_0x591989){var _0x10a99f=_0x591989['count'],_0x5221f7=_0x92170c['offset'],_0x37c055=_0x92170c[_0x0beb('0x28')]+_0x92170c['limit'],_0x12a7f3;if(_0x37c055>=_0x10a99f){_0x37c055=_0x10a99f;_0x12a7f3=0xc8;}else{_0x12a7f3=0xce;}_0x422acb[_0x0beb('0x26')](_0x12a7f3);return _0x422acb[_0x0beb('0x29')](_0x0beb('0x2a'),_0x5221f7+'-'+_0x37c055+'/'+_0x10a99f)['json'](_0x591989);}return null;};}function patchUpdates(_0x66b468){return function(_0x5b67ca){try{jsonpatch[_0x0beb('0x2b')](_0x5b67ca,_0x66b468,!![]);}catch(_0x4749e0){return BPromise['reject'](_0x4749e0);}return _0x5b67ca[_0x0beb('0x2c')]();};}function saveUpdates(_0x174c25,_0xacbf60){return function(_0x51607c){if(_0x51607c){return _0x51607c['update'](_0x174c25)[_0x0beb('0x19')](function(_0x58f84d){return _0x58f84d;});}return null;};}function removeEntity(_0x49f40a,_0x45206b){return function(_0x2a3a62){if(_0x2a3a62){return _0x2a3a62[_0x0beb('0x2d')]()[_0x0beb('0x19')](function(){_0x49f40a[_0x0beb('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dd752,_0x1653a5){return function(_0x4a521c){if(!_0x4a521c){_0x1dd752[_0x0beb('0x24')](0x194);}return _0x4a521c;};}function handleError(_0x216e56,_0x1c9e0e){_0x1c9e0e=_0x1c9e0e||0x1f4;return function(_0xed2292){logger['error'](_0xed2292[_0x0beb('0x2e')]);if(_0xed2292[_0x0beb('0x2f')]){delete _0xed2292['name'];}_0x216e56[_0x0beb('0x26')](_0x1c9e0e)[_0x0beb('0x30')](_0xed2292);};}exports[_0x0beb('0x31')]=function(_0x1a4664,_0x3d65ce){var _0x511e0e={},_0x44c8b7={},_0x5b5698={'count':0x0,'rows':[]};var _0xd8c799=_[_0x0beb('0x32')](db[_0x0beb('0x33')]['rawAttributes'],function(_0x369ff1){return{'name':_0x369ff1[_0x0beb('0x34')],'type':_0x369ff1[_0x0beb('0x35')][_0x0beb('0x36')]};});_0x44c8b7[_0x0beb('0x37')]=_[_0x0beb('0x32')](_0xd8c799,_0x0beb('0x2f'));_0x44c8b7[_0x0beb('0x38')]=_['keys'](_0x1a4664[_0x0beb('0x38')]);_0x44c8b7[_0x0beb('0x39')]=_[_0x0beb('0x3a')](_0x44c8b7['model'],_0x44c8b7['query']);_0x511e0e[_0x0beb('0x3b')]=_[_0x0beb('0x3a')](_0x44c8b7[_0x0beb('0x37')],qs[_0x0beb('0x3c')](_0x1a4664[_0x0beb('0x38')][_0x0beb('0x3c')]));_0x511e0e[_0x0beb('0x3b')]=_0x511e0e[_0x0beb('0x3b')]['length']?_0x511e0e['attributes']:_0x44c8b7[_0x0beb('0x37')];if(!_0x1a4664['query'][_0x0beb('0x3d')](_0x0beb('0x3e'))){_0x511e0e[_0x0beb('0x3f')]=qs[_0x0beb('0x3f')](_0x1a4664['query']['limit']);_0x511e0e[_0x0beb('0x28')]=qs[_0x0beb('0x28')](_0x1a4664[_0x0beb('0x38')]['offset']);}_0x511e0e[_0x0beb('0x40')]=qs[_0x0beb('0x41')](_0x1a4664['query'][_0x0beb('0x41')]);_0x511e0e[_0x0beb('0x42')]=qs[_0x0beb('0x39')](_[_0x0beb('0x43')](_0x1a4664['query'],_0x44c8b7['filters']),_0xd8c799);if(_0x1a4664[_0x0beb('0x38')][_0x0beb('0x44')]){_0x511e0e['where']=_[_0x0beb('0x45')](_0x511e0e[_0x0beb('0x42')],{'$or':_[_0x0beb('0x32')](_0xd8c799,function(_0x5db1b4){if(_0x5db1b4[_0x0beb('0x35')]!=='VIRTUAL'){var _0x4e9d18={};_0x4e9d18[_0x5db1b4[_0x0beb('0x2f')]]={'$like':'%'+_0x1a4664[_0x0beb('0x38')][_0x0beb('0x44')]+'%'};return _0x4e9d18;}})});}_0x511e0e=_[_0x0beb('0x45')]({},_0x511e0e,_0x1a4664[_0x0beb('0x46')]);var _0x4ffdc5={'where':_0x511e0e[_0x0beb('0x42')]};return db[_0x0beb('0x33')][_0x0beb('0x47')](_0x4ffdc5)['then'](function(_0x1ee736){_0x5b5698[_0x0beb('0x47')]=_0x1ee736;if(_0x1a4664[_0x0beb('0x38')][_0x0beb('0x48')]){_0x511e0e['include']=[{'all':!![]}];}return db[_0x0beb('0x33')][_0x0beb('0x49')](_0x511e0e);})[_0x0beb('0x19')](function(_0x284283){_0x5b5698[_0x0beb('0x4a')]=_0x284283;return _0x5b5698;})[_0x0beb('0x19')](respondWithFilteredResult(_0x3d65ce,_0x511e0e))[_0x0beb('0x23')](handleError(_0x3d65ce,null));};exports[_0x0beb('0x4b')]=function(_0x366d64,_0x4f245e){var _0xaca1ff={'raw':![],'where':{'id':_0x366d64[_0x0beb('0x4c')]['id']}},_0x2a48f0={};_0x2a48f0['model']=_[_0x0beb('0x4d')](db[_0x0beb('0x33')][_0x0beb('0x4e')]);_0x2a48f0[_0x0beb('0x38')]=_[_0x0beb('0x4d')](_0x366d64[_0x0beb('0x38')]);_0x2a48f0[_0x0beb('0x39')]=_['intersection'](_0x2a48f0[_0x0beb('0x37')],_0x2a48f0[_0x0beb('0x38')]);_0xaca1ff[_0x0beb('0x3b')]=_['intersection'](_0x2a48f0[_0x0beb('0x37')],qs[_0x0beb('0x3c')](_0x366d64[_0x0beb('0x38')][_0x0beb('0x3c')]));_0xaca1ff[_0x0beb('0x3b')]=_0xaca1ff[_0x0beb('0x3b')][_0x0beb('0x4f')]?_0xaca1ff[_0x0beb('0x3b')]:_0x2a48f0['model'];if(_0x366d64[_0x0beb('0x38')]['includeAll']){_0xaca1ff[_0x0beb('0x50')]=[{'all':!![]}];}_0xaca1ff=_[_0x0beb('0x45')]({},_0xaca1ff,_0x366d64[_0x0beb('0x46')]);return db[_0x0beb('0x33')][_0x0beb('0x51')](_0xaca1ff)[_0x0beb('0x19')](handleEntityNotFound(_0x4f245e,null))[_0x0beb('0x19')](respondWithResult(_0x4f245e,null))[_0x0beb('0x23')](handleError(_0x4f245e,null));};exports[_0x0beb('0x52')]=function(_0x23b240,_0x1eabd3){return db['ServicenowAccount']['create'](_0x23b240['body'],{})[_0x0beb('0x19')](respondWithResult(_0x1eabd3,0xc9))['catch'](handleError(_0x1eabd3,null));};exports[_0x0beb('0x53')]=function(_0x5b6474,_0x56493c){if(_0x5b6474['body']['id']){delete _0x5b6474[_0x0beb('0x54')]['id'];}return db[_0x0beb('0x33')][_0x0beb('0x51')]({'where':{'id':_0x5b6474['params']['id']}})[_0x0beb('0x19')](handleEntityNotFound(_0x56493c,null))['then'](saveUpdates(_0x5b6474['body'],null))[_0x0beb('0x19')](respondWithResult(_0x56493c,null))[_0x0beb('0x23')](handleError(_0x56493c,null));};exports['destroy']=function(_0x9bed24,_0x7bcca3){return db['ServicenowAccount'][_0x0beb('0x51')]({'where':{'id':_0x9bed24[_0x0beb('0x4c')]['id']}})[_0x0beb('0x19')](handleEntityNotFound(_0x7bcca3,null))[_0x0beb('0x19')](removeEntity(_0x7bcca3,null))['catch'](handleError(_0x7bcca3,null));};exports['getConfigurations']=function(_0x2cdf73,_0x32b291,_0x4ed347){var _0x5a01b4={};var _0x176353={};var _0x1d555b;var _0x271a5f;return db[_0x0beb('0x33')][_0x0beb('0x55')]({'where':{'id':_0x2cdf73['params']['id']}})[_0x0beb('0x19')](handleEntityNotFound(_0x32b291,null))['then'](function(_0x461682){if(_0x461682){_0x1d555b=_0x461682;_0x176353[_0x0beb('0x37')]=_[_0x0beb('0x4d')](db[_0x0beb('0x56')][_0x0beb('0x4e')]);_0x176353[_0x0beb('0x38')]=_[_0x0beb('0x4d')](_0x2cdf73[_0x0beb('0x38')]);_0x176353[_0x0beb('0x39')]=_[_0x0beb('0x3a')](_0x176353[_0x0beb('0x37')],_0x176353[_0x0beb('0x38')]);_0x5a01b4[_0x0beb('0x3b')]=_[_0x0beb('0x3a')](_0x176353[_0x0beb('0x37')],qs[_0x0beb('0x3c')](_0x2cdf73[_0x0beb('0x38')]['fields']));_0x5a01b4[_0x0beb('0x3b')]=_0x5a01b4[_0x0beb('0x3b')][_0x0beb('0x4f')]?_0x5a01b4[_0x0beb('0x3b')]:_0x176353['model'];_0x5a01b4[_0x0beb('0x40')]=qs['sort'](_0x2cdf73[_0x0beb('0x38')][_0x0beb('0x41')]);_0x5a01b4[_0x0beb('0x42')]=qs['filters'](_['pick'](_0x2cdf73[_0x0beb('0x38')],_0x176353['filters']));if(_0x2cdf73[_0x0beb('0x38')][_0x0beb('0x44')]){_0x5a01b4['where']=_['merge'](_0x5a01b4[_0x0beb('0x42')],{'$or':_[_0x0beb('0x32')](_0x5a01b4[_0x0beb('0x3b')],function(_0x5d1b0b){var _0x3685fa={};_0x3685fa[_0x5d1b0b]={'$like':'%'+_0x2cdf73['query'][_0x0beb('0x44')]+'%'};return _0x3685fa;})});}_0x5a01b4=_[_0x0beb('0x45')]({},_0x5a01b4,_0x2cdf73[_0x0beb('0x46')]);return _0x1d555b[_0x0beb('0x57')](_0x5a01b4);}})['then'](function(_0x7a088){if(_0x7a088){_0x271a5f=_0x7a088[_0x0beb('0x4f')];if(!_0x2cdf73[_0x0beb('0x38')]['hasOwnProperty']('nolimit')){_0x5a01b4[_0x0beb('0x3f')]=qs[_0x0beb('0x3f')](_0x2cdf73['query'][_0x0beb('0x3f')]);_0x5a01b4[_0x0beb('0x28')]=qs[_0x0beb('0x28')](_0x2cdf73[_0x0beb('0x38')][_0x0beb('0x28')]);}return _0x1d555b[_0x0beb('0x57')](_0x5a01b4);}})['then'](function(_0x3ae3a4){if(_0x3ae3a4){return _0x3ae3a4?{'count':_0x271a5f,'rows':_0x3ae3a4}:null;}})[_0x0beb('0x19')](respondWithResult(_0x32b291,null))[_0x0beb('0x23')](handleError(_0x32b291,null));};exports['addConfiguration']=function(_0x10ae76,_0x4333dd,_0x3f44c4){if(_0x10ae76['body']['id']){delete _0x10ae76[_0x0beb('0x54')]['id'];}return db['ServicenowAccount'][_0x0beb('0x55')]({'where':{'id':_0x10ae76[_0x0beb('0x4c')]['id']}})[_0x0beb('0x19')](handleEntityNotFound(_0x4333dd,null))[_0x0beb('0x19')](function(_0x3e275e){if(_0x3e275e){_0x10ae76[_0x0beb('0x54')][_0x0beb('0x58')]=_0x3e275e['id'];_0x10ae76[_0x0beb('0x54')]['Subjects']=integrations['getSubjects'](_0x10ae76[_0x0beb('0x54')]['channel'],_0x10ae76[_0x0beb('0x54')][_0x0beb('0x35')]);_0x10ae76[_0x0beb('0x54')][_0x0beb('0x59')]=integrations[_0x0beb('0x5a')](_0x10ae76[_0x0beb('0x54')][_0x0beb('0x5b')],_0x10ae76['body'][_0x0beb('0x35')]);return db[_0x0beb('0x56')]['create'](_0x10ae76[_0x0beb('0x54')],{'include':[{'model':db[_0x0beb('0x5c')],'as':_0x0beb('0x5d')},{'model':db[_0x0beb('0x5c')],'as':_0x0beb('0x59')}]});}return null;})[_0x0beb('0x19')](respondWithResult(_0x4333dd,null))['catch'](handleError(_0x4333dd,null));};exports['getFields']=function(_0xa0d7ae,_0x5f276a,_0x5f5c6f){var _0x31e00a=[_0x0beb('0x5e'),_0x0beb('0x5f'),'knowledge','subcategory',_0x0beb('0x60'),_0x0beb('0x61'),'incident_state',_0x0beb('0x62'),_0x0beb('0x63')];var _0x31d9b9=['parent',_0x0beb('0x5e'),_0x0beb('0x64'),_0x0beb('0x65'),_0x0beb('0x66'),_0x0beb('0x67'),_0x0beb('0x68'),_0x0beb('0x5f'),'approval_history',_0x0beb('0x69'),_0x0beb('0x6a'),'sys_updated_by',_0x0beb('0x6b'),'user_input',_0x0beb('0x6c'),_0x0beb('0x6d'),'state','sys_created_by',_0x0beb('0x6e'),_0x0beb('0x40'),_0x0beb('0x6f'),_0x0beb('0x70'),_0x0beb('0x71'),_0x0beb('0x72'),_0x0beb('0x73'),_0x0beb('0x74'),_0x0beb('0x75'),_0x0beb('0x76'),'priority',_0x0beb('0x77'),'rfc',_0x0beb('0x78'),_0x0beb('0x79'),'opened_at',_0x0beb('0x7a'),_0x0beb('0x7b'),_0x0beb('0x7c'),_0x0beb('0x7d'),_0x0beb('0x7e'),_0x0beb('0x7f'),_0x0beb('0x80'),_0x0beb('0x81'),'work_notes',_0x0beb('0x82'),_0x0beb('0x60'),'correlation_display',_0x0beb('0x83'),_0x0beb('0x84'),'assignment_group',_0x0beb('0x85'),'additional_assignee_list',_0x0beb('0x86'),'calendar_duration',_0x0beb('0x61'),'sys_class_name',_0x0beb('0x87'),_0x0beb('0x88'),'follow_up','parent_incident','sys_id',_0x0beb('0x89'),_0x0beb('0x8a'),_0x0beb('0x8b'),_0x0beb('0x8c'),_0x0beb('0x8d'),'company',_0x0beb('0x8e'),_0x0beb('0x8f'),_0x0beb('0x90'),_0x0beb('0x62'),_0x0beb('0x91'),_0x0beb('0x92'),'approval',_0x0beb('0x93'),_0x0beb('0x94'),_0x0beb('0x95'),_0x0beb('0x96'),_0x0beb('0x97'),_0x0beb('0x98'),_0x0beb('0x99'),_0x0beb('0x9a'),_0x0beb('0x9b'),_0x0beb('0x63')];var _0x2f4b7c='';var _0x27a520='';var _0x54451e=[];var _0x5332ae='';var _0x31087e='';var _0xf4efe1=[];var _0x4d8e28='';var _0x5bca6a='';var _0x2a6c0f={};var _0xeed04='';return db['ServicenowAccount'][_0x0beb('0x55')]({'where':{'id':_0xa0d7ae['params']['id']},'attributes':['id','username',_0x0beb('0x9c'),_0x0beb('0x9d'),_0x0beb('0x9e'),_0x0beb('0x9f')]})[_0x0beb('0x19')](handleEntityNotFound(_0x5f276a,null))[_0x0beb('0x19')](function(_0x596fd5){if(_0x596fd5){_0xeed04=_0x596fd5['remoteUri'];var _0x1951c1=_0xeed04[_0x0beb('0xa0')](-0x1);if(_0x1951c1==='/'){_0xeed04=_0xeed04[_0x0beb('0xa1')](0x0,_0xeed04[_0x0beb('0xa2')](_0x1951c1));}_0x5bca6a=util[_0x0beb('0xa3')](_0x0beb('0xa4'),_0xeed04);_0x4d8e28=util[_0x0beb('0xa3')](_0x0beb('0xa5'),_0xeed04);_0x2a6c0f={'user':_0x596fd5[_0x0beb('0xa6')],'pass':_0x596fd5[_0x0beb('0x9c')]};var _0x187da2={'method':'GET','uri':_0x5bca6a+_0x0beb('0xa7'),'auth':_0x2a6c0f,'json':!![]};return rp(_0x187da2);}})[_0x0beb('0x19')](function(_0x369fbc){if(_0x369fbc[_0x0beb('0x22')][_0x0beb('0x4f')]>0x0){_0x2f4b7c=_0x369fbc[_0x0beb('0x22')];}console[_0x0beb('0xa8')](_0x0beb('0xa9'),_0x2f4b7c);_0xf4efe1=[];_0x27a520=Object[_0x0beb('0xaa')]([],_0x2f4b7c);_[_0x0beb('0xab')](_0x27a520,function(_0x5b77d7){return!_0x31e00a[_0x0beb('0xac')](_0x5b77d7[_0x0beb('0x2f')]);});_0x27a520[_0x0beb('0xad')](function(_0x33ffa2){var _0x305939=createFieldObject(_0x4d8e28,_0x2a6c0f,_0x33ffa2['internalType'],_0x33ffa2[_0x0beb('0x2f')],_0x33ffa2[_0x0beb('0xae')],![]);_0xf4efe1[_0x0beb('0xaf')](_0x305939);});return Promise['all'](_0xf4efe1);})[_0x0beb('0x19')](function(_0x402d3a){_0x54451e=_0x402d3a;_0x5332ae=Object[_0x0beb('0xaa')]([],_0x2f4b7c);console[_0x0beb('0xa8')](_0x0beb('0xb0'),_0x2f4b7c);_[_0x0beb('0xab')](_0x5332ae,function(_0x2a2da3){return _0x31d9b9['includes'](_0x2a2da3[_0x0beb('0x2f')]);});console[_0x0beb('0xa8')](_0x0beb('0xb1'),_0x5332ae);_0xf4efe1=[];_0x5332ae[_0x0beb('0xad')](function(_0x3756a0){var _0x4f3594=createFieldObject(_0x4d8e28,_0x2a6c0f,_0x3756a0['internalType'],_0x3756a0['name'],_0x3756a0['label'],!![]);_0xf4efe1[_0x0beb('0xaf')](_0x4f3594);});return Promise[_0x0beb('0xb2')](_0xf4efe1);})['then'](function(_0x242148){_0x31087e=_0x242148;var _0x1b1fbd=_0x54451e[_0x0beb('0xb3')](_0x31087e);return{'count':_0x1b1fbd[_0x0beb('0x4f')],'rows':_0x1b1fbd};})[_0x0beb('0x19')](respondWithResult(_0x5f276a,null))[_0x0beb('0x23')](function(_0x56818a){console['log'](_0x0beb('0xb4')+_0x56818a);var _0x10a371=_0xa0d7ae[_0x0beb('0x38')][_0x0beb('0x14')]?0x1f4:_0x56818a[_0x0beb('0xb5')]||0x1f4;logger[_0x0beb('0x1e')](_0x56818a['stack']);delete _0x56818a[_0x0beb('0x2f')];if(_0x10a371===0x191){_0x10a371=0x190;}_0x5f276a[_0x0beb('0x26')](_0x10a371)[_0x0beb('0x30')](_0xa0d7ae['query'][_0x0beb('0x14')]?{'message':'Wrong\x20credentials','statusCode':_0x56818a[_0x0beb('0xb5')]}:_0x56818a);});};function createFieldObject(_0x2f030f,_0x5569b1,_0x23f6f4,_0x30db07,_0x46889c,_0x3d6ef6){return new Promise(function(_0x4706b2,_0x5f3b25){var _0x30d807={'id':_0x30db07,'name':_0x46889c,'custom':_0x3d6ef6};if(_0x23f6f4===_0x0beb('0xb6')){_0x30d807['options']=[{'name':_0x0beb('0xb7'),'value':_0x0beb('0xb8')},{'name':_0x0beb('0xb9'),'value':_0x0beb('0xba')}];_0x4706b2(_0x30d807);}else{var _0xd7b44d={'method':_0x0beb('0xbb'),'uri':_0x2f030f+'sys_choice?sysparm_query=name=incident^element='+_0x30db07,'auth':_0x5569b1,'json':!![]};return rp(_0xd7b44d)[_0x0beb('0x19')](function(_0x30a105){var _0x5b788c=[];if(_0x30a105[_0x0beb('0x22')][_0x0beb('0x4f')]>0x0){_0x30a105[_0x0beb('0x22')][_0x0beb('0xad')](function(_0x1b86a8){if(_0x1b86a8[_0x0beb('0xbc')]===_0x0beb('0xba')){var _0x40d447={'name':_0x1b86a8[_0x0beb('0xae')],'value':_0x1b86a8['value']};_0x5b788c[_0x0beb('0xaf')](_0x40d447);}});}_0x30d807[_0x0beb('0x46')]=_0x5b788c;if(_0x30d807['options'][_0x0beb('0x4f')]>0x0){_0x4706b2(_0x30d807);}else{if(_0x3d6ef6==![]){_0x4706b2();}else{_0x4706b2(_0x30d807);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7a8bcb0..92104a2 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 _0xc0dc=['ServicenowAccount','lodash','util','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc0dc,0xb1));var _0xcc0d=function(_0x1dc8dc,_0x24ba3f){_0x1dc8dc=_0x1dc8dc-0x0;var _0x34053e=_0xc0dc[_0x1dc8dc];return _0x34053e;};'use strict';var _=require(_0xcc0d('0x0'));var util=require(_0xcc0d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc0d('0x2'));var BPromise=require(_0xcc0d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc0d('0x4'));var rimraf=require(_0xcc0d('0x5'));var config=require(_0xcc0d('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xcc0d('0x7'));module[_0xcc0d('0x8')]=function(_0x59b3a1,_0x39299b){return _0x59b3a1[_0xcc0d('0x9')](_0xcc0d('0xa'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6a8=['define','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x52ec59,_0x401f6b){var _0x3085f0=function(_0x136de2){while(--_0x136de2){_0x52ec59['push'](_0x52ec59['shift']());}};_0x3085f0(++_0x401f6b);}(_0xb6a8,0xe7));var _0x8b6a=function(_0xc2cb69,_0x1d9101){_0xc2cb69=_0xc2cb69-0x0;var _0x19eeea=_0xb6a8[_0xc2cb69];return _0x19eeea;};'use strict';var _=require(_0x8b6a('0x0'));var util=require(_0x8b6a('0x1'));var logger=require(_0x8b6a('0x2'))('api');var moment=require(_0x8b6a('0x3'));var BPromise=require('bluebird');var rp=require(_0x8b6a('0x4'));var fs=require('fs');var path=require(_0x8b6a('0x5'));var rimraf=require('rimraf');var config=require(_0x8b6a('0x6'));var attributes=require(_0x8b6a('0x7'));var integrations=require(_0x8b6a('0x8'));module['exports']=function(_0x511e85,_0x4b33f5){return _0x511e85[_0x8b6a('0x9')]('ServicenowAccount',attributes,{'tableName':'int_servicenow_accounts','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 1d1a3b4..f27fd37 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 _0x5850=['client','http','request','then','info','request\x20sent','debug','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','options','raw','where','limit','include','map','attributes','model','stringify','ShowServicenowAccount','ServicenowAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x5850,0xbd));var _0x0585=function(_0x41a12a,_0x2a3f9b){_0x41a12a=_0x41a12a-0x0;var _0x5a9a72=_0x5850[_0x41a12a];return _0x5a9a72;};'use strict';var _=require(_0x0585('0x0'));var util=require('util');var moment=require(_0x0585('0x1'));var BPromise=require(_0x0585('0x2'));var rs=require(_0x0585('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0585('0x4'))['db'];var utils=require(_0x0585('0x5'));var logger=require(_0x0585('0x6'))(_0x0585('0x7'));var config=require(_0x0585('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0585('0x9')][_0x0585('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23ad62,_0x2651c4,_0x21c3eb){return new BPromise(function(_0x298c7e,_0x46624f){return client[_0x0585('0xb')](_0x23ad62,_0x21c3eb)[_0x0585('0xc')](function(_0x4a42fd){logger[_0x0585('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x2651c4,_0x0585('0xe'));logger[_0x0585('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2651c4,_0x0585('0xe'),JSON['stringify'](_0x4a42fd));if(_0x4a42fd[_0x0585('0x10')]){if(_0x4a42fd[_0x0585('0x10')]['code']===0x1f4){logger[_0x0585('0x10')](_0x0585('0x11'),_0x2651c4,_0x4a42fd[_0x0585('0x10')][_0x0585('0x12')]);return _0x46624f(_0x4a42fd[_0x0585('0x10')]['message']);}logger[_0x0585('0x10')](_0x0585('0x11'),_0x2651c4,_0x4a42fd['error'][_0x0585('0x12')]);return _0x298c7e(_0x4a42fd[_0x0585('0x10')][_0x0585('0x12')]);}else{logger[_0x0585('0xd')](_0x0585('0x11'),_0x2651c4,_0x0585('0xe'));_0x298c7e(_0x4a42fd[_0x0585('0x13')][_0x0585('0x12')]);}})[_0x0585('0x14')](function(_0x54b19c){logger['error'](_0x0585('0x11'),_0x2651c4,_0x54b19c);_0x46624f(_0x54b19c);});});}exports[_0x0585('0x15')]=function(_0x1f4df2){var _0x208c88=this;return new Promise(function(_0x2feefc,_0x131895){return db['ServicenowAccount']['findAll']({'raw':_0x1f4df2[_0x0585('0x16')]?_0x1f4df2[_0x0585('0x16')][_0x0585('0x17')]===undefined?!![]:![]:!![],'where':_0x1f4df2[_0x0585('0x16')]?_0x1f4df2[_0x0585('0x16')][_0x0585('0x18')]||null:null,'attributes':_0x1f4df2[_0x0585('0x16')]?_0x1f4df2[_0x0585('0x16')]['attributes']||null:null,'limit':_0x1f4df2[_0x0585('0x16')]?_0x1f4df2[_0x0585('0x16')][_0x0585('0x19')]||null:null,'include':_0x1f4df2[_0x0585('0x16')]?_0x1f4df2[_0x0585('0x16')][_0x0585('0x1a')]?_[_0x0585('0x1b')](_0x1f4df2[_0x0585('0x16')][_0x0585('0x1a')],function(_0x4109d0){return{'model':db[_0x4109d0['model']],'as':_0x4109d0['as'],'attributes':_0x4109d0[_0x0585('0x1c')],'include':_0x4109d0[_0x0585('0x1a')]?_['map'](_0x4109d0[_0x0585('0x1a')],function(_0xf2b43c){return{'model':db[_0xf2b43c['model']],'as':_0xf2b43c['as'],'attributes':_0xf2b43c[_0x0585('0x1c')],'include':_0xf2b43c[_0x0585('0x1a')]?_[_0x0585('0x1b')](_0xf2b43c[_0x0585('0x1a')],function(_0x33dfcc){return{'model':db[_0x33dfcc[_0x0585('0x1d')]],'as':_0x33dfcc['as'],'attributes':_0x33dfcc[_0x0585('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0585('0xc')](function(_0x420f9e){logger['info'](_0x0585('0x15'),_0x1f4df2);logger[_0x0585('0xf')](_0x0585('0x15'),_0x1f4df2,JSON[_0x0585('0x1e')](_0x420f9e));_0x2feefc(_0x420f9e);})[_0x0585('0x14')](function(_0x558d3a){logger['error']('GetServicenowAccount',_0x558d3a[_0x0585('0x12')],_0x1f4df2);_0x131895(_0x208c88[_0x0585('0x10')](0x1f4,_0x558d3a[_0x0585('0x12')]));});});};exports[_0x0585('0x1f')]=function(_0x588ef8){var _0x328077=this;return new Promise(function(_0x582b6f,_0x2dd0c0){return db[_0x0585('0x20')]['find']({'raw':_0x588ef8[_0x0585('0x16')]?_0x588ef8[_0x0585('0x16')][_0x0585('0x17')]===undefined?!![]:![]:!![],'where':_0x588ef8[_0x0585('0x16')]?_0x588ef8[_0x0585('0x16')][_0x0585('0x18')]||null:null,'attributes':_0x588ef8[_0x0585('0x16')]?_0x588ef8[_0x0585('0x16')]['attributes']||null:null,'include':_0x588ef8['options']?_0x588ef8[_0x0585('0x16')][_0x0585('0x1a')]?_[_0x0585('0x1b')](_0x588ef8[_0x0585('0x16')][_0x0585('0x1a')],function(_0x1da59d){return{'model':db[_0x1da59d[_0x0585('0x1d')]],'as':_0x1da59d['as'],'attributes':_0x1da59d[_0x0585('0x1c')],'include':_0x1da59d[_0x0585('0x1a')]?_[_0x0585('0x1b')](_0x1da59d[_0x0585('0x1a')],function(_0x18aa16){return{'model':db[_0x18aa16['model']],'as':_0x18aa16['as'],'attributes':_0x18aa16['attributes'],'include':_0x18aa16['include']?_['map'](_0x18aa16['include'],function(_0x11755d){return{'model':db[_0x11755d[_0x0585('0x1d')]],'as':_0x11755d['as'],'attributes':_0x11755d[_0x0585('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0585('0xc')](function(_0x3b584b){logger[_0x0585('0xd')](_0x0585('0x1f'),_0x588ef8);logger['debug'](_0x0585('0x1f'),_0x588ef8,JSON[_0x0585('0x1e')](_0x3b584b));_0x582b6f(_0x3b584b);})[_0x0585('0x14')](function(_0xaad9e3){logger[_0x0585('0x10')](_0x0585('0x1f'),_0xaad9e3[_0x0585('0x12')],_0x588ef8);_0x2dd0c0(_0x328077[_0x0585('0x10')](0x1f4,_0xaad9e3[_0x0585('0x12')]));});});}; \ No newline at end of file +var _0x06cd=['find','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','limit','include','model','attributes','map','ShowServicenowAccount'];(function(_0x7d1996,_0x54c85b){var _0x38f3ad=function(_0x1ea531){while(--_0x1ea531){_0x7d1996['push'](_0x7d1996['shift']());}};_0x38f3ad(++_0x54c85b);}(_0x06cd,0x18d));var _0xd06c=function(_0x114b0e,_0x1956db){_0x114b0e=_0x114b0e-0x0;var _0x124c90=_0x06cd[_0x114b0e];return _0x124c90;};'use strict';var _=require(_0xd06c('0x0'));var util=require(_0xd06c('0x1'));var moment=require(_0xd06c('0x2'));var BPromise=require(_0xd06c('0x3'));var rs=require(_0xd06c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd06c('0x5'))('rpc');var config=require(_0xd06c('0x6'));var jayson=require(_0xd06c('0x7'));var client=jayson[_0xd06c('0x8')][_0xd06c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38205d,_0x2bc8b7,_0x12ef25){return new BPromise(function(_0x2f2158,_0xd27410){return client['request'](_0x38205d,_0x12ef25)[_0xd06c('0xa')](function(_0x31c52b){logger[_0xd06c('0xb')](_0xd06c('0xc'),_0x2bc8b7,_0xd06c('0xd'));logger[_0xd06c('0xe')](_0xd06c('0xf'),_0x2bc8b7,_0xd06c('0xd'),JSON[_0xd06c('0x10')](_0x31c52b));if(_0x31c52b[_0xd06c('0x11')]){if(_0x31c52b['error'][_0xd06c('0x12')]===0x1f4){logger[_0xd06c('0x11')](_0xd06c('0xc'),_0x2bc8b7,_0x31c52b[_0xd06c('0x11')][_0xd06c('0x13')]);return _0xd27410(_0x31c52b[_0xd06c('0x11')][_0xd06c('0x13')]);}logger['error'](_0xd06c('0xc'),_0x2bc8b7,_0x31c52b[_0xd06c('0x11')][_0xd06c('0x13')]);return _0x2f2158(_0x31c52b[_0xd06c('0x11')]['message']);}else{logger[_0xd06c('0xb')](_0xd06c('0xc'),_0x2bc8b7,_0xd06c('0xd'));_0x2f2158(_0x31c52b['result'][_0xd06c('0x13')]);}})[_0xd06c('0x14')](function(_0x298ea5){logger[_0xd06c('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x2bc8b7,_0x298ea5);_0xd27410(_0x298ea5);});});}exports[_0xd06c('0x15')]=function(_0x41e60c){var _0x3e7464=this;return new Promise(function(_0x358a43,_0x17b37d){return db[_0xd06c('0x16')]['findAll']({'raw':_0x41e60c[_0xd06c('0x17')]?_0x41e60c[_0xd06c('0x17')][_0xd06c('0x18')]===undefined?!![]:![]:!![],'where':_0x41e60c['options']?_0x41e60c[_0xd06c('0x17')][_0xd06c('0x19')]||null:null,'attributes':_0x41e60c[_0xd06c('0x17')]?_0x41e60c[_0xd06c('0x17')]['attributes']||null:null,'limit':_0x41e60c[_0xd06c('0x17')]?_0x41e60c[_0xd06c('0x17')][_0xd06c('0x1a')]||null:null,'include':_0x41e60c[_0xd06c('0x17')]?_0x41e60c[_0xd06c('0x17')][_0xd06c('0x1b')]?_['map'](_0x41e60c[_0xd06c('0x17')]['include'],function(_0x249b19){return{'model':db[_0x249b19[_0xd06c('0x1c')]],'as':_0x249b19['as'],'attributes':_0x249b19[_0xd06c('0x1d')],'include':_0x249b19[_0xd06c('0x1b')]?_[_0xd06c('0x1e')](_0x249b19[_0xd06c('0x1b')],function(_0x8c0926){return{'model':db[_0x8c0926[_0xd06c('0x1c')]],'as':_0x8c0926['as'],'attributes':_0x8c0926[_0xd06c('0x1d')],'include':_0x8c0926[_0xd06c('0x1b')]?_[_0xd06c('0x1e')](_0x8c0926[_0xd06c('0x1b')],function(_0x17071a){return{'model':db[_0x17071a['model']],'as':_0x17071a['as'],'attributes':_0x17071a[_0xd06c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd06c('0xa')](function(_0x5f4dca){logger[_0xd06c('0xb')](_0xd06c('0x15'),_0x41e60c);logger['debug'](_0xd06c('0x15'),_0x41e60c,JSON[_0xd06c('0x10')](_0x5f4dca));_0x358a43(_0x5f4dca);})[_0xd06c('0x14')](function(_0x10b0bc){logger[_0xd06c('0x11')](_0xd06c('0x15'),_0x10b0bc[_0xd06c('0x13')],_0x41e60c);_0x17b37d(_0x3e7464['error'](0x1f4,_0x10b0bc[_0xd06c('0x13')]));});});};exports[_0xd06c('0x1f')]=function(_0x28c7fb){var _0x109941=this;return new Promise(function(_0xa13699,_0x2893ba){return db['ServicenowAccount'][_0xd06c('0x20')]({'raw':_0x28c7fb[_0xd06c('0x17')]?_0x28c7fb[_0xd06c('0x17')][_0xd06c('0x18')]===undefined?!![]:![]:!![],'where':_0x28c7fb['options']?_0x28c7fb[_0xd06c('0x17')]['where']||null:null,'attributes':_0x28c7fb[_0xd06c('0x17')]?_0x28c7fb[_0xd06c('0x17')][_0xd06c('0x1d')]||null:null,'include':_0x28c7fb['options']?_0x28c7fb[_0xd06c('0x17')]['include']?_[_0xd06c('0x1e')](_0x28c7fb[_0xd06c('0x17')]['include'],function(_0x28b272){return{'model':db[_0x28b272[_0xd06c('0x1c')]],'as':_0x28b272['as'],'attributes':_0x28b272[_0xd06c('0x1d')],'include':_0x28b272[_0xd06c('0x1b')]?_[_0xd06c('0x1e')](_0x28b272[_0xd06c('0x1b')],function(_0x1315d4){return{'model':db[_0x1315d4['model']],'as':_0x1315d4['as'],'attributes':_0x1315d4['attributes'],'include':_0x1315d4[_0xd06c('0x1b')]?_['map'](_0x1315d4[_0xd06c('0x1b')],function(_0x5b8cf9){return{'model':db[_0x5b8cf9['model']],'as':_0x5b8cf9['as'],'attributes':_0x5b8cf9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd06c('0xa')](function(_0x262397){logger['info'](_0xd06c('0x1f'),_0x28c7fb);logger['debug'](_0xd06c('0x1f'),_0x28c7fb,JSON[_0xd06c('0x10')](_0x262397));_0xa13699(_0x262397);})[_0xd06c('0x14')](function(_0xa2904c){logger[_0xd06c('0x11')](_0xd06c('0x1f'),_0xa2904c[_0xd06c('0x13')],_0x28c7fb);_0x2893ba(_0x109941[_0xd06c('0x11')](0x1f4,_0xa2904c[_0xd06c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 4812447..fa2837f 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 _0x351a=['getSubjects','getDescriptions','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x358357,_0x346319){var _0x5c1a89=function(_0x5b394b){while(--_0x5b394b){_0x358357['push'](_0x358357['shift']());}};_0x5c1a89(++_0x346319);}(_0x351a,0x68));var _0xa351=function(_0x5906cc,_0xcbbb0c){_0x5906cc=_0x5906cc-0x0;var _0x3cb49a=_0x351a[_0x5906cc];return _0x3cb49a;};'use strict';var multer=require(_0xa351('0x0'));var util=require('util');var path=require(_0xa351('0x1'));var timeout=require(_0xa351('0x2'));var express=require(_0xa351('0x3'));var router=express[_0xa351('0x4')]();var auth=require(_0xa351('0x5'));var interaction=require(_0xa351('0x6'));var config=require('../../config/environment');var controller=require(_0xa351('0x7'));router[_0xa351('0x8')]('/',auth[_0xa351('0x9')](),controller[_0xa351('0xa')]);router[_0xa351('0x8')](_0xa351('0xb'),auth['isAuthenticated'](),controller[_0xa351('0xc')]);router[_0xa351('0x8')](_0xa351('0xd'),auth[_0xa351('0x9')](),controller[_0xa351('0xe')]);router[_0xa351('0x8')](_0xa351('0xf'),auth['isAuthenticated'](),controller[_0xa351('0x10')]);router[_0xa351('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xa351('0x11')]);router[_0xa351('0x12')]('/',auth[_0xa351('0x9')](),controller[_0xa351('0x13')]);router['put'](_0xa351('0xb'),auth[_0xa351('0x9')](),controller[_0xa351('0x14')]);router[_0xa351('0x15')](_0xa351('0xb'),auth[_0xa351('0x9')](),controller[_0xa351('0x16')]);module[_0xa351('0x17')]=router; \ No newline at end of file +var _0xc449=['create','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5d880e,_0x52fb62){var _0x2dc29d=function(_0x31c082){while(--_0x31c082){_0x5d880e['push'](_0x5d880e['shift']());}};_0x2dc29d(++_0x52fb62);}(_0xc449,0x1cf));var _0x9c44=function(_0x2d1111,_0x28957e){_0x2d1111=_0x2d1111-0x0;var _0x4c2935=_0xc449[_0x2d1111];return _0x4c2935;};'use strict';var multer=require(_0x9c44('0x0'));var util=require('util');var path=require(_0x9c44('0x1'));var timeout=require(_0x9c44('0x2'));var express=require(_0x9c44('0x3'));var router=express[_0x9c44('0x4')]();var auth=require(_0x9c44('0x5'));var interaction=require(_0x9c44('0x6'));var config=require('../../config/environment');var controller=require(_0x9c44('0x7'));router[_0x9c44('0x8')]('/',auth[_0x9c44('0x9')](),controller[_0x9c44('0xa')]);router[_0x9c44('0x8')](_0x9c44('0xb'),auth[_0x9c44('0x9')](),controller[_0x9c44('0xc')]);router[_0x9c44('0x8')]('/:id/fields',auth[_0x9c44('0x9')](),controller['getFields']);router['get'](_0x9c44('0xd'),auth['isAuthenticated'](),controller[_0x9c44('0xe')]);router[_0x9c44('0x8')](_0x9c44('0xf'),auth['isAuthenticated'](),controller[_0x9c44('0x10')]);router['post']('/',auth[_0x9c44('0x9')](),controller[_0x9c44('0x11')]);router['put'](_0x9c44('0xb'),auth[_0x9c44('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9c44('0x12')]);module[_0x9c44('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 6948d9b..bf64d72 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 _0xe56a=['sequelize','exports','STRING'];(function(_0x19da09,_0x2275e3){var _0xe4b545=function(_0x4836ae){while(--_0x4836ae){_0x19da09['push'](_0x19da09['shift']());}};_0xe4b545(++_0x2275e3);}(_0xe56a,0x1ef));var _0xae56=function(_0x244bc4,_0x2b463d){_0x244bc4=_0x244bc4-0x0;var _0x33a9a6=_0xe56a[_0x244bc4];return _0x33a9a6;};'use strict';var Sequelize=require(_0xae56('0x0'));module[_0xae56('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xae56('0x2')]}}; \ No newline at end of file +var _0x9e82=['sequelize','exports','STRING'];(function(_0x7edac9,_0x4cae54){var _0x1236df=function(_0x5ce173){while(--_0x5ce173){_0x7edac9['push'](_0x7edac9['shift']());}};_0x1236df(++_0x4cae54);}(_0x9e82,0x159));var _0x29e8=function(_0x3c7cea,_0xbe550c){_0x3c7cea=_0x3c7cea-0x0;var _0x3d4442=_0x9e82[_0x3c7cea];return _0x3d4442;};'use strict';var Sequelize=require(_0x29e8('0x0'));module[_0x29e8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x29e8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 617ffa7..40e4ef6 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 _0x757a=['save','update','destroy','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','includeAll','rows','show','params','include','options','catch','create','body','find','findOne','getFields','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','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','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ServicenowConfiguration,\x20%s,\x20%s','result','sendStatus','end','json','count','offset','status','set','apply','reject'];(function(_0x1b10b6,_0x2be625){var _0x397078=function(_0xe3dd06){while(--_0xe3dd06){_0x1b10b6['push'](_0x1b10b6['shift']());}};_0x397078(++_0x2be625);}(_0x757a,0xde));var _0xa757=function(_0x10ab5d,_0x2fc31a){_0x10ab5d=_0x10ab5d-0x0;var _0x3e5352=_0x757a[_0x10ab5d];return _0x3e5352;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var Mustache=require(_0xa757('0x4'));var util=require(_0xa757('0x5'));var path=require(_0xa757('0x6'));var sox=require(_0xa757('0x7'));var csv=require('to-csv');var ejs=require(_0xa757('0x8'));var fs=require('fs');var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0xd'));var querystring=require(_0xa757('0xe'));var Papa=require('papaparse');var Redis=require(_0xa757('0xf'));var authService=require(_0xa757('0x10'));var qs=require(_0xa757('0x11'));var as=require(_0xa757('0x12'));var hardwareService=require(_0xa757('0x13'));var logger=require(_0xa757('0x14'))(_0xa757('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa757('0x16')]({'port':0x232a});function checkPasswordPattern(_0x544b45,_0x564187,_0x2ed0d2){if(_0x2ed0d2){var _0x513b1f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x513b1f['test'](_0x564187)){return _0x544b45;}else{throw new db[(_0xa757('0x17'))][(_0xa757('0x18'))](_0xa757('0x19'));}}else{return _0x544b45;}}function respondWithRpcPromise(_0x4a0c38,_0x86abd,_0x31cfd2,_0xf12b68){return new BPromise(function(_0x2f7947,_0x185011){var _0x3df1f9=_0xf12b68||client;return _0x3df1f9['request'](_0x4a0c38,_0x31cfd2)[_0xa757('0x1a')](function(_0x44eab8){logger[_0xa757('0x1b')]('ServicenowConfiguration,\x20%s,\x20%s',_0x86abd,'request\x20sent');logger[_0xa757('0x1c')](_0xa757('0x1d'),_0x86abd,_0xa757('0x1e'),JSON[_0xa757('0x1f')](_0x44eab8));if(_0x44eab8[_0xa757('0x20')]){if(_0x44eab8[_0xa757('0x20')]['code']===0x1f4){logger[_0xa757('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x86abd,_0x44eab8[_0xa757('0x20')][_0xa757('0x21')]);return _0x185011(_0x44eab8[_0xa757('0x20')][_0xa757('0x21')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x86abd,_0x44eab8[_0xa757('0x20')][_0xa757('0x21')]);return _0x2f7947(_0x44eab8[_0xa757('0x20')][_0xa757('0x21')]);}else{logger[_0xa757('0x1b')](_0xa757('0x22'),_0x86abd,_0xa757('0x1e'));_0x2f7947(_0x44eab8[_0xa757('0x23')][_0xa757('0x21')]);}})['catch'](function(_0x3707c1){logger['error'](_0xa757('0x22'),_0x86abd,_0x3707c1);_0x185011(_0x3707c1);});});}function respondWithStatusCode(_0x47903b,_0x40551d){_0x40551d=_0x40551d||0xcc;return function(_0x3859ce){if(_0x3859ce){return _0x47903b[_0xa757('0x24')](_0x40551d);}return _0x47903b['status'](_0x40551d)[_0xa757('0x25')]();};}function respondWithResult(_0xcd98bd,_0x471e84){_0x471e84=_0x471e84||0xc8;return function(_0x3bf7f3){if(_0x3bf7f3){return _0xcd98bd['status'](_0x471e84)[_0xa757('0x26')](_0x3bf7f3);}};}function respondWithFilteredResult(_0x54263b,_0x5a5664){return function(_0x54b75e){if(_0x54b75e){var _0x4f8de2=_0x54b75e[_0xa757('0x27')],_0xfdf69d=_0x5a5664['offset'],_0x596ae2=_0x5a5664[_0xa757('0x28')]+_0x5a5664['limit'],_0x2208f9;if(_0x596ae2>=_0x4f8de2){_0x596ae2=_0x4f8de2;_0x2208f9=0xc8;}else{_0x2208f9=0xce;}_0x54263b[_0xa757('0x29')](_0x2208f9);return _0x54263b[_0xa757('0x2a')]('Content-Range',_0xfdf69d+'-'+_0x596ae2+'/'+_0x4f8de2)[_0xa757('0x26')](_0x54b75e);}return null;};}function patchUpdates(_0x5ade7b){return function(_0x3a4a66){try{jsonpatch[_0xa757('0x2b')](_0x3a4a66,_0x5ade7b,!![]);}catch(_0x458974){return BPromise[_0xa757('0x2c')](_0x458974);}return _0x3a4a66[_0xa757('0x2d')]();};}function saveUpdates(_0x2c1885,_0x1a44a9){return function(_0x2220df){if(_0x2220df){return _0x2220df[_0xa757('0x2e')](_0x2c1885)[_0xa757('0x1a')](function(_0x1f5d5a){return _0x1f5d5a;});}return null;};}function removeEntity(_0x20735f,_0x25dfbb){return function(_0x2dfb33){if(_0x2dfb33){return _0x2dfb33[_0xa757('0x2f')]()[_0xa757('0x1a')](function(){_0x20735f[_0xa757('0x29')](0xcc)[_0xa757('0x25')]();});}};}function handleEntityNotFound(_0x1eacde,_0x29a5ba){return function(_0x3de18f){if(!_0x3de18f){_0x1eacde[_0xa757('0x24')](0x194);}return _0x3de18f;};}function handleError(_0x379de7,_0x3aae1e){_0x3aae1e=_0x3aae1e||0x1f4;return function(_0x59700d){logger[_0xa757('0x20')](_0x59700d[_0xa757('0x30')]);if(_0x59700d[_0xa757('0x31')]){delete _0x59700d[_0xa757('0x31')];}_0x379de7[_0xa757('0x29')](_0x3aae1e)['send'](_0x59700d);};}exports[_0xa757('0x32')]=function(_0x2af470,_0x37b1a3){var _0x2c34b1={},_0xd54446={},_0xc97cb8={'count':0x0,'rows':[]};var _0x499390=_[_0xa757('0x33')](db[_0xa757('0x34')][_0xa757('0x35')],function(_0xc34409){return{'name':_0xc34409[_0xa757('0x36')],'type':_0xc34409[_0xa757('0x37')][_0xa757('0x38')]};});_0xd54446[_0xa757('0x39')]=_[_0xa757('0x33')](_0x499390,'name');_0xd54446[_0xa757('0x3a')]=_[_0xa757('0x3b')](_0x2af470[_0xa757('0x3a')]);_0xd54446[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0xd54446[_0xa757('0x39')],_0xd54446['query']);_0x2c34b1[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0xd54446['model'],qs['fields'](_0x2af470[_0xa757('0x3a')][_0xa757('0x3f')]));_0x2c34b1['attributes']=_0x2c34b1['attributes'][_0xa757('0x40')]?_0x2c34b1[_0xa757('0x3e')]:_0xd54446[_0xa757('0x39')];if(!_0x2af470['query'][_0xa757('0x41')](_0xa757('0x42'))){_0x2c34b1[_0xa757('0x43')]=qs[_0xa757('0x43')](_0x2af470[_0xa757('0x3a')]['limit']);_0x2c34b1[_0xa757('0x28')]=qs['offset'](_0x2af470['query'][_0xa757('0x28')]);}_0x2c34b1[_0xa757('0x44')]=qs[_0xa757('0x45')](_0x2af470[_0xa757('0x3a')][_0xa757('0x45')]);_0x2c34b1['where']=qs['filters'](_[_0xa757('0x46')](_0x2af470[_0xa757('0x3a')],_0xd54446[_0xa757('0x3c')]),_0x499390);if(_0x2af470[_0xa757('0x3a')][_0xa757('0x47')]){_0x2c34b1[_0xa757('0x48')]=_['merge'](_0x2c34b1[_0xa757('0x48')],{'$or':_[_0xa757('0x33')](_0x499390,function(_0x4d66d4){if(_0x4d66d4[_0xa757('0x37')]!=='VIRTUAL'){var _0x2d111e={};_0x2d111e[_0x4d66d4[_0xa757('0x31')]]={'$like':'%'+_0x2af470['query'][_0xa757('0x47')]+'%'};return _0x2d111e;}})});}_0x2c34b1=_[_0xa757('0x49')]({},_0x2c34b1,_0x2af470['options']);var _0x2f4709={'where':_0x2c34b1[_0xa757('0x48')]};return db[_0xa757('0x34')][_0xa757('0x27')](_0x2f4709)['then'](function(_0x199dc9){_0xc97cb8[_0xa757('0x27')]=_0x199dc9;if(_0x2af470[_0xa757('0x3a')][_0xa757('0x4a')]){_0x2c34b1['include']=[{'all':!![]}];}return db[_0xa757('0x34')]['findAll'](_0x2c34b1);})['then'](function(_0x2acf88){_0xc97cb8[_0xa757('0x4b')]=_0x2acf88;return _0xc97cb8;})[_0xa757('0x1a')](respondWithFilteredResult(_0x37b1a3,_0x2c34b1))['catch'](handleError(_0x37b1a3,null));};exports[_0xa757('0x4c')]=function(_0x560c6c,_0x2ed63f){var _0x151cc3={'raw':![],'where':{'id':_0x560c6c[_0xa757('0x4d')]['id']}},_0x265793={};_0x265793[_0xa757('0x39')]=_[_0xa757('0x3b')](db[_0xa757('0x34')][_0xa757('0x35')]);_0x265793['query']=_[_0xa757('0x3b')](_0x560c6c[_0xa757('0x3a')]);_0x265793[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0x265793[_0xa757('0x39')],_0x265793[_0xa757('0x3a')]);_0x151cc3[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0x265793[_0xa757('0x39')],qs[_0xa757('0x3f')](_0x560c6c[_0xa757('0x3a')][_0xa757('0x3f')]));_0x151cc3[_0xa757('0x3e')]=_0x151cc3[_0xa757('0x3e')][_0xa757('0x40')]?_0x151cc3[_0xa757('0x3e')]:_0x265793['model'];if(_0x560c6c[_0xa757('0x3a')]['includeAll']){_0x151cc3[_0xa757('0x4e')]=[{'all':!![]}];}_0x151cc3=_[_0xa757('0x49')]({},_0x151cc3,_0x560c6c[_0xa757('0x4f')]);return db[_0xa757('0x34')]['find'](_0x151cc3)[_0xa757('0x1a')](handleEntityNotFound(_0x2ed63f,null))[_0xa757('0x1a')](respondWithResult(_0x2ed63f,null))[_0xa757('0x50')](handleError(_0x2ed63f,null));};exports[_0xa757('0x51')]=function(_0x595f16,_0x383674){return db[_0xa757('0x34')][_0xa757('0x51')](_0x595f16[_0xa757('0x52')],{})[_0xa757('0x1a')](respondWithResult(_0x383674,0xc9))[_0xa757('0x50')](handleError(_0x383674,null));};exports['update']=function(_0x485100,_0x5d21c1){if(_0x485100['body']['id']){delete _0x485100[_0xa757('0x52')]['id'];}return db[_0xa757('0x34')][_0xa757('0x53')]({'where':{'id':_0x485100[_0xa757('0x4d')]['id']}})[_0xa757('0x1a')](handleEntityNotFound(_0x5d21c1,null))[_0xa757('0x1a')](saveUpdates(_0x485100['body'],null))[_0xa757('0x1a')](respondWithResult(_0x5d21c1,null))[_0xa757('0x50')](handleError(_0x5d21c1,null));};exports[_0xa757('0x2f')]=function(_0x29b2f5,_0x48b578){return db[_0xa757('0x34')][_0xa757('0x53')]({'where':{'id':_0x29b2f5['params']['id']}})[_0xa757('0x1a')](handleEntityNotFound(_0x48b578,null))['then'](removeEntity(_0x48b578,null))[_0xa757('0x50')](handleError(_0x48b578,null));};exports['getFields']=function(_0x51be6e,_0x58633a,_0x4badee){var _0x367b48={};var _0x235c1e={};var _0x1b6058;var _0x1b5db5;return db[_0xa757('0x34')][_0xa757('0x54')]({'where':{'id':_0x51be6e['params']['id']}})['then'](handleEntityNotFound(_0x58633a,null))[_0xa757('0x1a')](function(_0x3afa56){if(_0x3afa56){_0x1b6058=_0x3afa56;_0x235c1e[_0xa757('0x39')]=_['keys'](db['ServicenowField'][_0xa757('0x35')]);_0x235c1e[_0xa757('0x3a')]=_[_0xa757('0x3b')](_0x51be6e[_0xa757('0x3a')]);_0x235c1e[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0x235c1e['model'],_0x235c1e[_0xa757('0x3a')]);_0x367b48[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0x235c1e[_0xa757('0x39')],qs[_0xa757('0x3f')](_0x51be6e[_0xa757('0x3a')][_0xa757('0x3f')]));_0x367b48[_0xa757('0x3e')]=_0x367b48[_0xa757('0x3e')][_0xa757('0x40')]?_0x367b48['attributes']:_0x235c1e[_0xa757('0x39')];_0x367b48['order']=qs['sort'](_0x51be6e[_0xa757('0x3a')][_0xa757('0x45')]);_0x367b48[_0xa757('0x48')]=qs[_0xa757('0x3c')](_[_0xa757('0x46')](_0x51be6e[_0xa757('0x3a')],_0x235c1e[_0xa757('0x3c')]));if(_0x51be6e[_0xa757('0x3a')][_0xa757('0x47')]){_0x367b48[_0xa757('0x48')]=_[_0xa757('0x49')](_0x367b48['where'],{'$or':_[_0xa757('0x33')](_0x367b48[_0xa757('0x3e')],function(_0x5f0b71){var _0x11ebb3={};_0x11ebb3[_0x5f0b71]={'$like':'%'+_0x51be6e[_0xa757('0x3a')][_0xa757('0x47')]+'%'};return _0x11ebb3;})});}_0x367b48=_[_0xa757('0x49')]({},_0x367b48,_0x51be6e[_0xa757('0x4f')]);return _0x1b6058[_0xa757('0x55')](_0x367b48);}})['then'](function(_0x413217){if(_0x413217){_0x1b5db5=_0x413217['length'];if(!_0x51be6e[_0xa757('0x3a')][_0xa757('0x41')](_0xa757('0x42'))){_0x367b48[_0xa757('0x43')]=qs[_0xa757('0x43')](_0x51be6e['query']['limit']);_0x367b48[_0xa757('0x28')]=qs[_0xa757('0x28')](_0x51be6e[_0xa757('0x3a')]['offset']);}return _0x1b6058[_0xa757('0x55')](_0x367b48);}})['then'](function(_0x34982a){if(_0x34982a){return _0x34982a?{'count':_0x1b5db5,'rows':_0x34982a}:null;}})[_0xa757('0x1a')](respondWithResult(_0x58633a,null))[_0xa757('0x50')](handleError(_0x58633a,null));};exports[_0xa757('0x56')]=function(_0x10cb5e,_0x40a79b,_0x54730c){var _0xa28144={};var _0x193233={};var _0x1e15ee;var _0x125bda;return db[_0xa757('0x34')]['findOne']({'where':{'id':_0x10cb5e[_0xa757('0x4d')]['id']}})[_0xa757('0x1a')](handleEntityNotFound(_0x40a79b,null))[_0xa757('0x1a')](function(_0x38724c){if(_0x38724c){_0x1e15ee=_0x38724c;_0x193233[_0xa757('0x39')]=_['keys'](db[_0xa757('0x57')][_0xa757('0x35')]);_0x193233[_0xa757('0x3a')]=_['keys'](_0x10cb5e[_0xa757('0x3a')]);_0x193233[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0x193233[_0xa757('0x39')],_0x193233[_0xa757('0x3a')]);_0xa28144[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0x193233[_0xa757('0x39')],qs[_0xa757('0x3f')](_0x10cb5e[_0xa757('0x3a')][_0xa757('0x3f')]));_0xa28144[_0xa757('0x3e')]=_0xa28144[_0xa757('0x3e')][_0xa757('0x40')]?_0xa28144['attributes']:_0x193233[_0xa757('0x39')];_0xa28144[_0xa757('0x44')]=qs['sort'](_0x10cb5e[_0xa757('0x3a')][_0xa757('0x45')]);_0xa28144['where']=qs[_0xa757('0x3c')](_[_0xa757('0x46')](_0x10cb5e[_0xa757('0x3a')],_0x193233[_0xa757('0x3c')]));if(_0x10cb5e[_0xa757('0x3a')][_0xa757('0x47')]){_0xa28144[_0xa757('0x48')]=_[_0xa757('0x49')](_0xa28144[_0xa757('0x48')],{'$or':_[_0xa757('0x33')](_0xa28144[_0xa757('0x3e')],function(_0x189195){var _0x2c2b40={};_0x2c2b40[_0x189195]={'$like':'%'+_0x10cb5e[_0xa757('0x3a')][_0xa757('0x47')]+'%'};return _0x2c2b40;})});}_0xa28144=_[_0xa757('0x49')]({},_0xa28144,_0x10cb5e['options']);return _0x1e15ee[_0xa757('0x56')](_0xa28144);}})['then'](function(_0x39357f){if(_0x39357f){_0x125bda=_0x39357f[_0xa757('0x40')];if(!_0x10cb5e[_0xa757('0x3a')][_0xa757('0x41')](_0xa757('0x42'))){_0xa28144['limit']=qs[_0xa757('0x43')](_0x10cb5e[_0xa757('0x3a')][_0xa757('0x43')]);_0xa28144['offset']=qs[_0xa757('0x28')](_0x10cb5e[_0xa757('0x3a')][_0xa757('0x28')]);}return _0x1e15ee['getSubjects'](_0xa28144);}})['then'](function(_0x1f437d){if(_0x1f437d){return _0x1f437d?{'count':_0x125bda,'rows':_0x1f437d}:null;}})[_0xa757('0x1a')](respondWithResult(_0x40a79b,null))[_0xa757('0x50')](handleError(_0x40a79b,null));};exports['getDescriptions']=function(_0x5dcd35,_0x4cc1ad,_0x4cfc69){var _0x45b424={};var _0x1adf5a={};var _0x476297;var _0x5bf64b;return db[_0xa757('0x34')][_0xa757('0x54')]({'where':{'id':_0x5dcd35[_0xa757('0x4d')]['id']}})[_0xa757('0x1a')](handleEntityNotFound(_0x4cc1ad,null))[_0xa757('0x1a')](function(_0x2d0ce0){if(_0x2d0ce0){_0x476297=_0x2d0ce0;_0x1adf5a[_0xa757('0x39')]=_[_0xa757('0x3b')](db[_0xa757('0x57')][_0xa757('0x35')]);_0x1adf5a[_0xa757('0x3a')]=_[_0xa757('0x3b')](_0x5dcd35['query']);_0x1adf5a[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0x1adf5a[_0xa757('0x39')],_0x1adf5a[_0xa757('0x3a')]);_0x45b424[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0x1adf5a[_0xa757('0x39')],qs[_0xa757('0x3f')](_0x5dcd35[_0xa757('0x3a')][_0xa757('0x3f')]));_0x45b424[_0xa757('0x3e')]=_0x45b424[_0xa757('0x3e')][_0xa757('0x40')]?_0x45b424[_0xa757('0x3e')]:_0x1adf5a[_0xa757('0x39')];_0x45b424[_0xa757('0x44')]=qs[_0xa757('0x45')](_0x5dcd35[_0xa757('0x3a')][_0xa757('0x45')]);_0x45b424[_0xa757('0x48')]=qs[_0xa757('0x3c')](_[_0xa757('0x46')](_0x5dcd35['query'],_0x1adf5a[_0xa757('0x3c')]));if(_0x5dcd35[_0xa757('0x3a')]['filter']){_0x45b424[_0xa757('0x48')]=_['merge'](_0x45b424[_0xa757('0x48')],{'$or':_[_0xa757('0x33')](_0x45b424['attributes'],function(_0x33a613){var _0x2eac20={};_0x2eac20[_0x33a613]={'$like':'%'+_0x5dcd35[_0xa757('0x3a')][_0xa757('0x47')]+'%'};return _0x2eac20;})});}_0x45b424=_['merge']({},_0x45b424,_0x5dcd35[_0xa757('0x4f')]);return _0x476297[_0xa757('0x58')](_0x45b424);}})['then'](function(_0x30716a){if(_0x30716a){_0x5bf64b=_0x30716a[_0xa757('0x40')];if(!_0x5dcd35['query'][_0xa757('0x41')](_0xa757('0x42'))){_0x45b424[_0xa757('0x43')]=qs[_0xa757('0x43')](_0x5dcd35[_0xa757('0x3a')][_0xa757('0x43')]);_0x45b424[_0xa757('0x28')]=qs[_0xa757('0x28')](_0x5dcd35[_0xa757('0x3a')]['offset']);}return _0x476297['getDescriptions'](_0x45b424);}})[_0xa757('0x1a')](function(_0x770298){if(_0x770298){return _0x770298?{'count':_0x5bf64b,'rows':_0x770298}:null;}})[_0xa757('0x1a')](respondWithResult(_0x4cc1ad,null))[_0xa757('0x50')](handleError(_0x4cc1ad,null));}; \ No newline at end of file +var _0x6f7a=['../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','test','ValidationError','request','then','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','stack','name','send','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','destroy','getFields','findOne','getSubjects','ServicenowField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x362eac,_0x4c6703){_0x362eac=_0x362eac-0x0;var _0x593567=_0x6f7a[_0x362eac];return _0x593567;};'use strict';var pdf=require(_0xa6f7('0x0'));var emlformat=require(_0xa6f7('0x1'));var rimraf=require(_0xa6f7('0x2'));var zipdir=require(_0xa6f7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6f7('0x4'));var moment=require(_0xa6f7('0x5'));var BPromise=require(_0xa6f7('0x6'));var Mustache=require(_0xa6f7('0x7'));var util=require(_0xa6f7('0x8'));var path=require(_0xa6f7('0x9'));var sox=require(_0xa6f7('0xa'));var csv=require(_0xa6f7('0xb'));var ejs=require(_0xa6f7('0xc'));var fs=require('fs');var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xb'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var db=require(_0xa6f7('0x17'))['db'];var jayson=require(_0xa6f7('0x18'));var client=jayson[_0xa6f7('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x3fc7f1,_0x532352,_0x25b48f){if(_0x25b48f){var _0x68fd8a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x68fd8a[_0xa6f7('0x1a')](_0x532352)){return _0x3fc7f1;}else{throw new db['Sequelize'][(_0xa6f7('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 _0x3fc7f1;}}function respondWithRpcPromise(_0x41bc4d,_0x57308a,_0x17b814,_0x17f9c5){return new BPromise(function(_0x6efd38,_0x47e664){var _0xdb37e2=_0x17f9c5||client;return _0xdb37e2[_0xa6f7('0x1c')](_0x41bc4d,_0x17b814)[_0xa6f7('0x1d')](function(_0x2401b9){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x57308a,_0xa6f7('0x1e'));logger['debug'](_0xa6f7('0x1f'),_0x57308a,_0xa6f7('0x1e'),JSON['stringify'](_0x2401b9));if(_0x2401b9[_0xa6f7('0x20')]){if(_0x2401b9[_0xa6f7('0x20')][_0xa6f7('0x21')]===0x1f4){logger[_0xa6f7('0x20')](_0xa6f7('0x22'),_0x57308a,_0x2401b9[_0xa6f7('0x20')]['message']);return _0x47e664(_0x2401b9[_0xa6f7('0x20')][_0xa6f7('0x23')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x57308a,_0x2401b9['error'][_0xa6f7('0x23')]);return _0x6efd38(_0x2401b9[_0xa6f7('0x20')]['message']);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x57308a,_0xa6f7('0x1e'));_0x6efd38(_0x2401b9[_0xa6f7('0x24')][_0xa6f7('0x23')]);}})['catch'](function(_0x484874){logger[_0xa6f7('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x57308a,_0x484874);_0x47e664(_0x484874);});});}function respondWithStatusCode(_0x47ef97,_0x402d25){_0x402d25=_0x402d25||0xcc;return function(_0x5efdce){if(_0x5efdce){return _0x47ef97[_0xa6f7('0x25')](_0x402d25);}return _0x47ef97[_0xa6f7('0x26')](_0x402d25)[_0xa6f7('0x27')]();};}function respondWithResult(_0x2b4c6c,_0x3a3508){_0x3a3508=_0x3a3508||0xc8;return function(_0x4b8d2b){if(_0x4b8d2b){return _0x2b4c6c['status'](_0x3a3508)[_0xa6f7('0x28')](_0x4b8d2b);}};}function respondWithFilteredResult(_0x2ad0d9,_0x55d45a){return function(_0x267917){if(_0x267917){var _0x27babb=_0x267917[_0xa6f7('0x29')],_0x87bccc=_0x55d45a[_0xa6f7('0x2a')],_0x3a7ff9=_0x55d45a[_0xa6f7('0x2a')]+_0x55d45a[_0xa6f7('0x2b')],_0x224f5a;if(_0x3a7ff9>=_0x27babb){_0x3a7ff9=_0x27babb;_0x224f5a=0xc8;}else{_0x224f5a=0xce;}_0x2ad0d9[_0xa6f7('0x26')](_0x224f5a);return _0x2ad0d9[_0xa6f7('0x2c')](_0xa6f7('0x2d'),_0x87bccc+'-'+_0x3a7ff9+'/'+_0x27babb)['json'](_0x267917);}return null;};}function patchUpdates(_0x442ccf){return function(_0x42dc49){try{jsonpatch['apply'](_0x42dc49,_0x442ccf,!![]);}catch(_0xd6304f){return BPromise[_0xa6f7('0x2e')](_0xd6304f);}return _0x42dc49['save']();};}function saveUpdates(_0x55179e,_0x176378){return function(_0x25dcad){if(_0x25dcad){return _0x25dcad[_0xa6f7('0x2f')](_0x55179e)[_0xa6f7('0x1d')](function(_0x1e25e0){return _0x1e25e0;});}return null;};}function removeEntity(_0x4f33b3,_0x4dfd81){return function(_0x238e15){if(_0x238e15){return _0x238e15['destroy']()[_0xa6f7('0x1d')](function(){_0x4f33b3[_0xa6f7('0x26')](0xcc)[_0xa6f7('0x27')]();});}};}function handleEntityNotFound(_0x237e5d,_0x5b907d){return function(_0xbdfc5a){if(!_0xbdfc5a){_0x237e5d['sendStatus'](0x194);}return _0xbdfc5a;};}function handleError(_0x4576a7,_0xb1a7f8){_0xb1a7f8=_0xb1a7f8||0x1f4;return function(_0x1a5de5){logger['error'](_0x1a5de5[_0xa6f7('0x30')]);if(_0x1a5de5['name']){delete _0x1a5de5[_0xa6f7('0x31')];}_0x4576a7[_0xa6f7('0x26')](_0xb1a7f8)[_0xa6f7('0x32')](_0x1a5de5);};}exports['index']=function(_0x44a5f2,_0xfdf408){var _0x3b3bc2={},_0x37b833={},_0x14444c={'count':0x0,'rows':[]};var _0x28490e=_['map'](db[_0xa6f7('0x33')][_0xa6f7('0x34')],function(_0xc25a1b){return{'name':_0xc25a1b[_0xa6f7('0x35')],'type':_0xc25a1b[_0xa6f7('0x36')][_0xa6f7('0x37')]};});_0x37b833[_0xa6f7('0x38')]=_[_0xa6f7('0x39')](_0x28490e,'name');_0x37b833[_0xa6f7('0x3a')]=_[_0xa6f7('0x3b')](_0x44a5f2[_0xa6f7('0x3a')]);_0x37b833['filters']=_[_0xa6f7('0x3c')](_0x37b833[_0xa6f7('0x38')],_0x37b833['query']);_0x3b3bc2[_0xa6f7('0x3d')]=_[_0xa6f7('0x3c')](_0x37b833[_0xa6f7('0x38')],qs[_0xa6f7('0x3e')](_0x44a5f2[_0xa6f7('0x3a')]['fields']));_0x3b3bc2[_0xa6f7('0x3d')]=_0x3b3bc2[_0xa6f7('0x3d')][_0xa6f7('0x3f')]?_0x3b3bc2[_0xa6f7('0x3d')]:_0x37b833[_0xa6f7('0x38')];if(!_0x44a5f2[_0xa6f7('0x3a')][_0xa6f7('0x40')](_0xa6f7('0x41'))){_0x3b3bc2['limit']=qs['limit'](_0x44a5f2[_0xa6f7('0x3a')][_0xa6f7('0x2b')]);_0x3b3bc2[_0xa6f7('0x2a')]=qs[_0xa6f7('0x2a')](_0x44a5f2[_0xa6f7('0x3a')][_0xa6f7('0x2a')]);}_0x3b3bc2[_0xa6f7('0x42')]=qs[_0xa6f7('0x43')](_0x44a5f2[_0xa6f7('0x3a')][_0xa6f7('0x43')]);_0x3b3bc2['where']=qs[_0xa6f7('0x44')](_[_0xa6f7('0x45')](_0x44a5f2['query'],_0x37b833[_0xa6f7('0x44')]),_0x28490e);if(_0x44a5f2[_0xa6f7('0x3a')][_0xa6f7('0x46')]){_0x3b3bc2[_0xa6f7('0x47')]=_['merge'](_0x3b3bc2[_0xa6f7('0x47')],{'$or':_['map'](_0x28490e,function(_0x5cb909){if(_0x5cb909[_0xa6f7('0x36')]!==_0xa6f7('0x48')){var _0x3f5ef7={};_0x3f5ef7[_0x5cb909[_0xa6f7('0x31')]]={'$like':'%'+_0x44a5f2[_0xa6f7('0x3a')][_0xa6f7('0x46')]+'%'};return _0x3f5ef7;}})});}_0x3b3bc2=_[_0xa6f7('0x49')]({},_0x3b3bc2,_0x44a5f2['options']);var _0x17d934={'where':_0x3b3bc2[_0xa6f7('0x47')]};return db['ServicenowConfiguration'][_0xa6f7('0x29')](_0x17d934)[_0xa6f7('0x1d')](function(_0x36d6f4){_0x14444c['count']=_0x36d6f4;if(_0x44a5f2[_0xa6f7('0x3a')]['includeAll']){_0x3b3bc2[_0xa6f7('0x4a')]=[{'all':!![]}];}return db[_0xa6f7('0x33')][_0xa6f7('0x4b')](_0x3b3bc2);})['then'](function(_0x5df564){_0x14444c[_0xa6f7('0x4c')]=_0x5df564;return _0x14444c;})['then'](respondWithFilteredResult(_0xfdf408,_0x3b3bc2))[_0xa6f7('0x4d')](handleError(_0xfdf408,null));};exports['show']=function(_0x5700f3,_0x1e7089){var _0x2e3a04={'raw':![],'where':{'id':_0x5700f3[_0xa6f7('0x4e')]['id']}},_0x350071={};_0x350071[_0xa6f7('0x38')]=_[_0xa6f7('0x3b')](db['ServicenowConfiguration'][_0xa6f7('0x34')]);_0x350071[_0xa6f7('0x3a')]=_['keys'](_0x5700f3[_0xa6f7('0x3a')]);_0x350071['filters']=_[_0xa6f7('0x3c')](_0x350071['model'],_0x350071['query']);_0x2e3a04[_0xa6f7('0x3d')]=_[_0xa6f7('0x3c')](_0x350071[_0xa6f7('0x38')],qs[_0xa6f7('0x3e')](_0x5700f3[_0xa6f7('0x3a')]['fields']));_0x2e3a04[_0xa6f7('0x3d')]=_0x2e3a04[_0xa6f7('0x3d')]['length']?_0x2e3a04[_0xa6f7('0x3d')]:_0x350071['model'];if(_0x5700f3[_0xa6f7('0x3a')][_0xa6f7('0x4f')]){_0x2e3a04[_0xa6f7('0x4a')]=[{'all':!![]}];}_0x2e3a04=_['merge']({},_0x2e3a04,_0x5700f3[_0xa6f7('0x50')]);return db['ServicenowConfiguration'][_0xa6f7('0x51')](_0x2e3a04)[_0xa6f7('0x1d')](handleEntityNotFound(_0x1e7089,null))[_0xa6f7('0x1d')](respondWithResult(_0x1e7089,null))[_0xa6f7('0x4d')](handleError(_0x1e7089,null));};exports[_0xa6f7('0x52')]=function(_0x5628a0,_0x5d05d6){return db[_0xa6f7('0x33')][_0xa6f7('0x52')](_0x5628a0[_0xa6f7('0x53')],{})[_0xa6f7('0x1d')](respondWithResult(_0x5d05d6,0xc9))['catch'](handleError(_0x5d05d6,null));};exports[_0xa6f7('0x2f')]=function(_0x2105dd,_0x14d841){if(_0x2105dd[_0xa6f7('0x53')]['id']){delete _0x2105dd[_0xa6f7('0x53')]['id'];}return db[_0xa6f7('0x33')]['find']({'where':{'id':_0x2105dd[_0xa6f7('0x4e')]['id']}})[_0xa6f7('0x1d')](handleEntityNotFound(_0x14d841,null))[_0xa6f7('0x1d')](saveUpdates(_0x2105dd['body'],null))[_0xa6f7('0x1d')](respondWithResult(_0x14d841,null))[_0xa6f7('0x4d')](handleError(_0x14d841,null));};exports[_0xa6f7('0x54')]=function(_0x4496f1,_0x5908e3){return db['ServicenowConfiguration'][_0xa6f7('0x51')]({'where':{'id':_0x4496f1[_0xa6f7('0x4e')]['id']}})[_0xa6f7('0x1d')](handleEntityNotFound(_0x5908e3,null))[_0xa6f7('0x1d')](removeEntity(_0x5908e3,null))[_0xa6f7('0x4d')](handleError(_0x5908e3,null));};exports[_0xa6f7('0x55')]=function(_0x1fcb72,_0x5efd49,_0x169bbe){var _0xef3883={};var _0x2f131c={};var _0x3b03e6;var _0x41ec86;return db[_0xa6f7('0x33')][_0xa6f7('0x56')]({'where':{'id':_0x1fcb72[_0xa6f7('0x4e')]['id']}})[_0xa6f7('0x1d')](handleEntityNotFound(_0x5efd49,null))[_0xa6f7('0x1d')](function(_0x3ade42){if(_0x3ade42){_0x3b03e6=_0x3ade42;_0x2f131c['model']=_[_0xa6f7('0x3b')](db['ServicenowField'][_0xa6f7('0x34')]);_0x2f131c['query']=_[_0xa6f7('0x3b')](_0x1fcb72[_0xa6f7('0x3a')]);_0x2f131c['filters']=_[_0xa6f7('0x3c')](_0x2f131c[_0xa6f7('0x38')],_0x2f131c[_0xa6f7('0x3a')]);_0xef3883['attributes']=_[_0xa6f7('0x3c')](_0x2f131c['model'],qs[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')]['fields']));_0xef3883[_0xa6f7('0x3d')]=_0xef3883['attributes'][_0xa6f7('0x3f')]?_0xef3883['attributes']:_0x2f131c[_0xa6f7('0x38')];_0xef3883[_0xa6f7('0x42')]=qs[_0xa6f7('0x43')](_0x1fcb72[_0xa6f7('0x3a')][_0xa6f7('0x43')]);_0xef3883[_0xa6f7('0x47')]=qs[_0xa6f7('0x44')](_[_0xa6f7('0x45')](_0x1fcb72[_0xa6f7('0x3a')],_0x2f131c[_0xa6f7('0x44')]));if(_0x1fcb72[_0xa6f7('0x3a')][_0xa6f7('0x46')]){_0xef3883['where']=_[_0xa6f7('0x49')](_0xef3883[_0xa6f7('0x47')],{'$or':_[_0xa6f7('0x39')](_0xef3883[_0xa6f7('0x3d')],function(_0x154c78){var _0x3a464e={};_0x3a464e[_0x154c78]={'$like':'%'+_0x1fcb72[_0xa6f7('0x3a')][_0xa6f7('0x46')]+'%'};return _0x3a464e;})});}_0xef3883=_['merge']({},_0xef3883,_0x1fcb72[_0xa6f7('0x50')]);return _0x3b03e6[_0xa6f7('0x55')](_0xef3883);}})[_0xa6f7('0x1d')](function(_0x522caf){if(_0x522caf){_0x41ec86=_0x522caf[_0xa6f7('0x3f')];if(!_0x1fcb72[_0xa6f7('0x3a')][_0xa6f7('0x40')](_0xa6f7('0x41'))){_0xef3883[_0xa6f7('0x2b')]=qs[_0xa6f7('0x2b')](_0x1fcb72[_0xa6f7('0x3a')][_0xa6f7('0x2b')]);_0xef3883['offset']=qs['offset'](_0x1fcb72[_0xa6f7('0x3a')][_0xa6f7('0x2a')]);}return _0x3b03e6['getFields'](_0xef3883);}})[_0xa6f7('0x1d')](function(_0x18ff29){if(_0x18ff29){return _0x18ff29?{'count':_0x41ec86,'rows':_0x18ff29}:null;}})[_0xa6f7('0x1d')](respondWithResult(_0x5efd49,null))['catch'](handleError(_0x5efd49,null));};exports[_0xa6f7('0x57')]=function(_0x48d5ad,_0x4f156e,_0x59ed13){var _0x5321d4={};var _0x522e5d={};var _0x39ba3d;var _0x3502b3;return db[_0xa6f7('0x33')]['findOne']({'where':{'id':_0x48d5ad[_0xa6f7('0x4e')]['id']}})[_0xa6f7('0x1d')](handleEntityNotFound(_0x4f156e,null))[_0xa6f7('0x1d')](function(_0x69c173){if(_0x69c173){_0x39ba3d=_0x69c173;_0x522e5d[_0xa6f7('0x38')]=_[_0xa6f7('0x3b')](db[_0xa6f7('0x58')][_0xa6f7('0x34')]);_0x522e5d[_0xa6f7('0x3a')]=_[_0xa6f7('0x3b')](_0x48d5ad['query']);_0x522e5d[_0xa6f7('0x44')]=_[_0xa6f7('0x3c')](_0x522e5d[_0xa6f7('0x38')],_0x522e5d[_0xa6f7('0x3a')]);_0x5321d4[_0xa6f7('0x3d')]=_[_0xa6f7('0x3c')](_0x522e5d[_0xa6f7('0x38')],qs[_0xa6f7('0x3e')](_0x48d5ad[_0xa6f7('0x3a')][_0xa6f7('0x3e')]));_0x5321d4[_0xa6f7('0x3d')]=_0x5321d4['attributes']['length']?_0x5321d4[_0xa6f7('0x3d')]:_0x522e5d[_0xa6f7('0x38')];_0x5321d4[_0xa6f7('0x42')]=qs['sort'](_0x48d5ad[_0xa6f7('0x3a')][_0xa6f7('0x43')]);_0x5321d4['where']=qs[_0xa6f7('0x44')](_[_0xa6f7('0x45')](_0x48d5ad['query'],_0x522e5d['filters']));if(_0x48d5ad[_0xa6f7('0x3a')]['filter']){_0x5321d4[_0xa6f7('0x47')]=_[_0xa6f7('0x49')](_0x5321d4['where'],{'$or':_['map'](_0x5321d4[_0xa6f7('0x3d')],function(_0x1da89a){var _0x122608={};_0x122608[_0x1da89a]={'$like':'%'+_0x48d5ad['query'][_0xa6f7('0x46')]+'%'};return _0x122608;})});}_0x5321d4=_[_0xa6f7('0x49')]({},_0x5321d4,_0x48d5ad[_0xa6f7('0x50')]);return _0x39ba3d[_0xa6f7('0x57')](_0x5321d4);}})[_0xa6f7('0x1d')](function(_0x282e79){if(_0x282e79){_0x3502b3=_0x282e79[_0xa6f7('0x3f')];if(!_0x48d5ad[_0xa6f7('0x3a')][_0xa6f7('0x40')](_0xa6f7('0x41'))){_0x5321d4[_0xa6f7('0x2b')]=qs['limit'](_0x48d5ad[_0xa6f7('0x3a')][_0xa6f7('0x2b')]);_0x5321d4[_0xa6f7('0x2a')]=qs[_0xa6f7('0x2a')](_0x48d5ad[_0xa6f7('0x3a')][_0xa6f7('0x2a')]);}return _0x39ba3d['getSubjects'](_0x5321d4);}})[_0xa6f7('0x1d')](function(_0x1f0c90){if(_0x1f0c90){return _0x1f0c90?{'count':_0x3502b3,'rows':_0x1f0c90}:null;}})[_0xa6f7('0x1d')](respondWithResult(_0x4f156e,null))[_0xa6f7('0x4d')](handleError(_0x4f156e,null));};exports[_0xa6f7('0x59')]=function(_0x1d98a2,_0x54c4e6,_0x5d5894){var _0x7ff027={};var _0x373ae3={};var _0x3ae028;var _0x4698b5;return db[_0xa6f7('0x33')]['findOne']({'where':{'id':_0x1d98a2[_0xa6f7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x54c4e6,null))[_0xa6f7('0x1d')](function(_0x4b6acb){if(_0x4b6acb){_0x3ae028=_0x4b6acb;_0x373ae3['model']=_['keys'](db[_0xa6f7('0x58')]['rawAttributes']);_0x373ae3['query']=_[_0xa6f7('0x3b')](_0x1d98a2[_0xa6f7('0x3a')]);_0x373ae3[_0xa6f7('0x44')]=_[_0xa6f7('0x3c')](_0x373ae3['model'],_0x373ae3[_0xa6f7('0x3a')]);_0x7ff027[_0xa6f7('0x3d')]=_[_0xa6f7('0x3c')](_0x373ae3[_0xa6f7('0x38')],qs[_0xa6f7('0x3e')](_0x1d98a2[_0xa6f7('0x3a')]['fields']));_0x7ff027[_0xa6f7('0x3d')]=_0x7ff027['attributes']['length']?_0x7ff027[_0xa6f7('0x3d')]:_0x373ae3[_0xa6f7('0x38')];_0x7ff027['order']=qs[_0xa6f7('0x43')](_0x1d98a2[_0xa6f7('0x3a')][_0xa6f7('0x43')]);_0x7ff027['where']=qs[_0xa6f7('0x44')](_['pick'](_0x1d98a2[_0xa6f7('0x3a')],_0x373ae3[_0xa6f7('0x44')]));if(_0x1d98a2['query'][_0xa6f7('0x46')]){_0x7ff027['where']=_[_0xa6f7('0x49')](_0x7ff027[_0xa6f7('0x47')],{'$or':_['map'](_0x7ff027[_0xa6f7('0x3d')],function(_0x473d17){var _0x1afd68={};_0x1afd68[_0x473d17]={'$like':'%'+_0x1d98a2[_0xa6f7('0x3a')][_0xa6f7('0x46')]+'%'};return _0x1afd68;})});}_0x7ff027=_['merge']({},_0x7ff027,_0x1d98a2[_0xa6f7('0x50')]);return _0x3ae028[_0xa6f7('0x59')](_0x7ff027);}})[_0xa6f7('0x1d')](function(_0x13219e){if(_0x13219e){_0x4698b5=_0x13219e['length'];if(!_0x1d98a2[_0xa6f7('0x3a')][_0xa6f7('0x40')](_0xa6f7('0x41'))){_0x7ff027[_0xa6f7('0x2b')]=qs[_0xa6f7('0x2b')](_0x1d98a2[_0xa6f7('0x3a')][_0xa6f7('0x2b')]);_0x7ff027[_0xa6f7('0x2a')]=qs['offset'](_0x1d98a2[_0xa6f7('0x3a')][_0xa6f7('0x2a')]);}return _0x3ae028['getDescriptions'](_0x7ff027);}})[_0xa6f7('0x1d')](function(_0x5485ac){if(_0x5485ac){return _0x5485ac?{'count':_0x4698b5,'rows':_0x5485ac}:null;}})[_0xa6f7('0x1d')](respondWithResult(_0x54c4e6,null))[_0xa6f7('0x4d')](handleError(_0x54c4e6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 623d3c7..cd6aa75 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 _0xb258=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0xc83032,_0x45a177){var _0x43f1f5=function(_0x401e12){while(--_0x401e12){_0xc83032['push'](_0xc83032['shift']());}};_0x43f1f5(++_0x45a177);}(_0xb258,0x19c));var _0x8b25=function(_0x205b9e,_0x2426bc){_0x205b9e=_0x205b9e-0x0;var _0x338aa8=_0xb258[_0x205b9e];return _0x338aa8;};'use strict';var _=require('lodash');var util=require(_0x8b25('0x0'));var logger=require(_0x8b25('0x1'))('api');var moment=require(_0x8b25('0x2'));var BPromise=require(_0x8b25('0x3'));var rp=require(_0x8b25('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b25('0x5'));var config=require(_0x8b25('0x6'));var attributes=require(_0x8b25('0x7'));module[_0x8b25('0x8')]=function(_0x20c7d9,_0x489b6f){return _0x20c7d9[_0x8b25('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x8b25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbff=['define','ServicenowConfiguration','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x210b24,_0x11eea6){var _0x267fad=function(_0x185643){while(--_0x185643){_0x210b24['push'](_0x210b24['shift']());}};_0x267fad(++_0x11eea6);}(_0xfbff,0x18e));var _0xffbf=function(_0x4e9f29,_0x1bbcbf){_0x4e9f29=_0x4e9f29-0x0;var _0x8e1ab3=_0xfbff[_0x4e9f29];return _0x8e1ab3;};'use strict';var _=require(_0xffbf('0x0'));var util=require(_0xffbf('0x1'));var logger=require(_0xffbf('0x2'))('api');var moment=require('moment');var BPromise=require(_0xffbf('0x3'));var rp=require(_0xffbf('0x4'));var fs=require('fs');var path=require(_0xffbf('0x5'));var rimraf=require(_0xffbf('0x6'));var config=require(_0xffbf('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xffbf('0x8')]=function(_0x4cccb3,_0x3c5ed6){return _0x4cccb3[_0xffbf('0x9')](_0xffbf('0xa'),attributes,{'tableName':'int_servicenow_configurations','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 f8965c8..f3f8fed 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 _0xd065=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xd065,0x8f));var _0x5d06=function(_0x62208,_0x23b8ae){_0x62208=_0x62208-0x0;var _0x5a174e=_0xd065[_0x62208];return _0x5a174e;};'use strict';var _=require(_0x5d06('0x0'));var util=require(_0x5d06('0x1'));var moment=require(_0x5d06('0x2'));var BPromise=require(_0x5d06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d06('0x4'));var db=require(_0x5d06('0x5'))['db'];var utils=require(_0x5d06('0x6'));var logger=require(_0x5d06('0x7'))(_0x5d06('0x8'));var config=require('../../config/environment');var jayson=require(_0x5d06('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30c037,_0xaa0ef,_0x314272){return new BPromise(function(_0x3e7a59,_0x3e4875){return client[_0x5d06('0xa')](_0x30c037,_0x314272)[_0x5d06('0xb')](function(_0x1e6f34){logger[_0x5d06('0xc')](_0x5d06('0xd'),_0xaa0ef,_0x5d06('0xe'));logger[_0x5d06('0xf')](_0x5d06('0x10'),_0xaa0ef,_0x5d06('0xe'),JSON['stringify'](_0x1e6f34));if(_0x1e6f34[_0x5d06('0x11')]){if(_0x1e6f34[_0x5d06('0x11')]['code']===0x1f4){logger[_0x5d06('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0xaa0ef,_0x1e6f34['error'][_0x5d06('0x12')]);return _0x3e4875(_0x1e6f34[_0x5d06('0x11')]['message']);}logger[_0x5d06('0x11')](_0x5d06('0xd'),_0xaa0ef,_0x1e6f34[_0x5d06('0x11')][_0x5d06('0x12')]);return _0x3e7a59(_0x1e6f34['error'][_0x5d06('0x12')]);}else{logger[_0x5d06('0xc')](_0x5d06('0xd'),_0xaa0ef,'request\x20sent');_0x3e7a59(_0x1e6f34[_0x5d06('0x13')][_0x5d06('0x12')]);}})[_0x5d06('0x14')](function(_0x5b6613){logger[_0x5d06('0x11')](_0x5d06('0xd'),_0xaa0ef,_0x5b6613);_0x3e4875(_0x5b6613);});});} \ No newline at end of file +var _0xde2d=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x138270,_0x632ed4){var _0x5c769f=function(_0x49956b){while(--_0x49956b){_0x138270['push'](_0x138270['shift']());}};_0x5c769f(++_0x632ed4);}(_0xde2d,0xa3));var _0xdde2=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0xde2d[_0x1e5068];return _0x2230b6;};'use strict';var _=require(_0xdde2('0x0'));var util=require(_0xdde2('0x1'));var moment=require(_0xdde2('0x2'));var BPromise=require(_0xdde2('0x3'));var rs=require(_0xdde2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdde2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdde2('0x6')][_0xdde2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e6453,_0x3b6e6a,_0x18d91a){return new BPromise(function(_0x4b9719,_0x51ceb1){return client[_0xdde2('0x8')](_0x3e6453,_0x18d91a)['then'](function(_0x3d698){logger[_0xdde2('0x9')](_0xdde2('0xa'),_0x3b6e6a,'request\x20sent');logger[_0xdde2('0xb')](_0xdde2('0xc'),_0x3b6e6a,_0xdde2('0xd'),JSON[_0xdde2('0xe')](_0x3d698));if(_0x3d698['error']){if(_0x3d698[_0xdde2('0xf')][_0xdde2('0x10')]===0x1f4){logger[_0xdde2('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3b6e6a,_0x3d698[_0xdde2('0xf')]['message']);return _0x51ceb1(_0x3d698[_0xdde2('0xf')][_0xdde2('0x11')]);}logger[_0xdde2('0xf')](_0xdde2('0xa'),_0x3b6e6a,_0x3d698[_0xdde2('0xf')][_0xdde2('0x11')]);return _0x4b9719(_0x3d698['error']['message']);}else{logger[_0xdde2('0x9')](_0xdde2('0xa'),_0x3b6e6a,_0xdde2('0xd'));_0x4b9719(_0x3d698[_0xdde2('0x12')][_0xdde2('0x11')]);}})[_0xdde2('0x13')](function(_0x2ee8b8){logger['error'](_0xdde2('0xa'),_0x3b6e6a,_0x2ee8b8);_0x51ceb1(_0x2ee8b8);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 5575ef6..e29d543 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 _0x710c=['../../config/environment','isAuthenticated','index','get','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3763f9,_0x37866b){var _0x27a104=function(_0x59862c){while(--_0x59862c){_0x3763f9['push'](_0x3763f9['shift']());}};_0x27a104(++_0x37866b);}(_0x710c,0xf8));var _0xc710=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x710c[_0x265aa2];return _0x447a3a;};'use strict';var multer=require(_0xc710('0x0'));var util=require(_0xc710('0x1'));var path=require(_0xc710('0x2'));var timeout=require(_0xc710('0x3'));var express=require('express');var router=express[_0xc710('0x4')]();var auth=require(_0xc710('0x5'));var interaction=require(_0xc710('0x6'));var config=require(_0xc710('0x7'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xc710('0x8')](),controller[_0xc710('0x9')]);router[_0xc710('0xa')]('/:id',auth[_0xc710('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc710('0xb')]);router[_0xc710('0xc')](_0xc710('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xc710('0xe')](_0xc710('0xd'),auth[_0xc710('0x8')](),controller[_0xc710('0xf')]);module[_0xc710('0x10')]=router; \ No newline at end of file +var _0xfae0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','create','isAuthenticated','update','multer','util','path','connect-timeout','express'];(function(_0x5a4efe,_0x346f9f){var _0x3cd68d=function(_0x46102e){while(--_0x46102e){_0x5a4efe['push'](_0x5a4efe['shift']());}};_0x3cd68d(++_0x346f9f);}(_0xfae0,0xdb));var _0x0fae=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0xfae0[_0x1428d9];return _0x438019;};'use strict';var multer=require(_0x0fae('0x0'));var util=require(_0x0fae('0x1'));var path=require(_0x0fae('0x2'));var timeout=require(_0x0fae('0x3'));var express=require(_0x0fae('0x4'));var router=express[_0x0fae('0x5')]();var auth=require(_0x0fae('0x6'));var interaction=require(_0x0fae('0x7'));var config=require(_0x0fae('0x8'));var controller=require('./intServicenowField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0fae('0x9')]);router[_0x0fae('0xa')](_0x0fae('0xb'),auth['isAuthenticated'](),controller[_0x0fae('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0fae('0xd')]);router['put'](_0x0fae('0xb'),auth[_0x0fae('0xe')](),controller[_0x0fae('0xf')]);router['delete'](_0x0fae('0xb'),auth[_0x0fae('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 033f769..6d64f13 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 _0x0404=['ENUM','string','variable','customVariable','keyValue','STRING','exports'];(function(_0x4ddc7a,_0x5b6cb8){var _0x4547c1=function(_0x3739e7){while(--_0x3739e7){_0x4ddc7a['push'](_0x4ddc7a['shift']());}};_0x4547c1(++_0x5b6cb8);}(_0x0404,0xf4));var _0x4040=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0x0404[_0x1428d9];return _0x438019;};'use strict';var Sequelize=require('sequelize');module[_0x4040('0x0')]={'type':{'type':Sequelize[_0x4040('0x1')](_0x4040('0x2'),_0x4040('0x3'),_0x4040('0x4'),_0x4040('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4040('0x6')]},'key':{'type':Sequelize[_0x4040('0x6')]},'keyType':{'type':Sequelize[_0x4040('0x1')](_0x4040('0x2'),'variable',_0x4040('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4040('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4040('0x6')]}}; \ No newline at end of file +var _0x2794=['BOOLEAN','sequelize','ENUM','customVariable','keyValue','string','STRING','variable'];(function(_0x337d93,_0x7908a5){var _0x52a98b=function(_0x1d03d5){while(--_0x1d03d5){_0x337d93['push'](_0x337d93['shift']());}};_0x52a98b(++_0x7908a5);}(_0x2794,0x1b9));var _0x4279=function(_0x566888,_0x17c03f){_0x566888=_0x566888-0x0;var _0x567631=_0x2794[_0x566888];return _0x567631;};'use strict';var Sequelize=require(_0x4279('0x0'));module['exports']={'type':{'type':Sequelize[_0x4279('0x1')]('string','variable',_0x4279('0x2'),_0x4279('0x3')),'defaultValue':_0x4279('0x4')},'content':{'type':Sequelize[_0x4279('0x5')]},'key':{'type':Sequelize[_0x4279('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x4279('0x4'),_0x4279('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x4279('0x5')]},'idField':{'type':Sequelize[_0x4279('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4279('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4279('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 5760d91..8a865ac 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x268267,_0x2f2d79){var _0x54815e=function(_0x54f8cb){while(--_0x54f8cb){_0x268267['push'](_0x268267['shift']());}};_0x54815e(++_0x2f2d79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x4f57e6,_0x5dbcad){var _0x23f04b=function(_0x47523c){while(--_0x47523c){_0x4f57e6['push'](_0x4f57e6['shift']());}};_0x23f04b(++_0x5dbcad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index bead9fd..18014da 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 _0x47b8=['moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','int_servicenow_fields','FieldId','lodash','../../config/logger','api'];(function(_0xad295a,_0x1d20eb){var _0x3df315=function(_0x5883fd){while(--_0x5883fd){_0xad295a['push'](_0xad295a['shift']());}};_0x3df315(++_0x1d20eb);}(_0x47b8,0x111));var _0x847b=function(_0x44051e,_0xfdce41){_0x44051e=_0x44051e-0x0;var _0x57a6d0=_0x47b8[_0x44051e];return _0x57a6d0;};'use strict';var _=require(_0x847b('0x0'));var util=require('util');var logger=require(_0x847b('0x1'))(_0x847b('0x2'));var moment=require(_0x847b('0x3'));var BPromise=require('bluebird');var rp=require(_0x847b('0x4'));var fs=require('fs');var path=require(_0x847b('0x5'));var rimraf=require(_0x847b('0x6'));var config=require(_0x847b('0x7'));var attributes=require(_0x847b('0x8'));module[_0x847b('0x9')]=function(_0x591175,_0x440ac4){return _0x591175['define']('ServicenowField',attributes,{'tableName':_0x847b('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0x847b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9acd=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','util','api','bluebird','request-promise','path','rimraf'];(function(_0x54bb1b,_0x260925){var _0x50cf03=function(_0x5e1a43){while(--_0x5e1a43){_0x54bb1b['push'](_0x54bb1b['shift']());}};_0x50cf03(++_0x260925);}(_0x9acd,0x166));var _0xd9ac=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9acd[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0xd9ac('0x0'));var logger=require('../../config/logger')(_0xd9ac('0x1'));var moment=require('moment');var BPromise=require(_0xd9ac('0x2'));var rp=require(_0xd9ac('0x3'));var fs=require('fs');var path=require(_0xd9ac('0x4'));var rimraf=require(_0xd9ac('0x5'));var config=require('../../config/environment');var attributes=require(_0xd9ac('0x6'));module[_0xd9ac('0x7')]=function(_0x37a7fa,_0x52065a){return _0x37a7fa[_0xd9ac('0x8')](_0xd9ac('0x9'),attributes,{'tableName':_0xd9ac('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xd9ac('0xb'),_0xd9ac('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 4586cee..99e87a4 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 _0x9c9f=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x9c9f,0xde));var _0xf9c9=function(_0x4a5292,_0x5deee0){_0x4a5292=_0x4a5292-0x0;var _0x31c72d=_0x9c9f[_0x4a5292];return _0x31c72d;};'use strict';var _=require('lodash');var util=require(_0xf9c9('0x0'));var moment=require(_0xf9c9('0x1'));var BPromise=require(_0xf9c9('0x2'));var rs=require(_0xf9c9('0x3'));var fs=require('fs');var Redis=require(_0xf9c9('0x4'));var db=require(_0xf9c9('0x5'))['db'];var utils=require(_0xf9c9('0x6'));var logger=require('../../config/logger')(_0xf9c9('0x7'));var config=require('../../config/environment');var jayson=require(_0xf9c9('0x8'));var client=jayson[_0xf9c9('0x9')][_0xf9c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x540c27,_0x93cdb4,_0x36076b){return new BPromise(function(_0x50765b,_0x51ca64){return client[_0xf9c9('0xb')](_0x540c27,_0x36076b)[_0xf9c9('0xc')](function(_0x597b68){logger[_0xf9c9('0xd')](_0xf9c9('0xe'),_0x93cdb4,_0xf9c9('0xf'));logger[_0xf9c9('0x10')](_0xf9c9('0x11'),_0x93cdb4,'request\x20sent',JSON[_0xf9c9('0x12')](_0x597b68));if(_0x597b68['error']){if(_0x597b68[_0xf9c9('0x13')][_0xf9c9('0x14')]===0x1f4){logger['error']('ServicenowField,\x20%s,\x20%s',_0x93cdb4,_0x597b68[_0xf9c9('0x13')][_0xf9c9('0x15')]);return _0x51ca64(_0x597b68['error']['message']);}logger['error'](_0xf9c9('0xe'),_0x93cdb4,_0x597b68[_0xf9c9('0x13')][_0xf9c9('0x15')]);return _0x50765b(_0x597b68['error'][_0xf9c9('0x15')]);}else{logger[_0xf9c9('0xd')](_0xf9c9('0xe'),_0x93cdb4,_0xf9c9('0xf'));_0x50765b(_0x597b68[_0xf9c9('0x16')]['message']);}})[_0xf9c9('0x17')](function(_0xbdc13){logger[_0xf9c9('0x13')](_0xf9c9('0xe'),_0x93cdb4,_0xbdc13);_0x51ca64(_0xbdc13);});});} \ No newline at end of file +var _0xb57f=['ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent'];(function(_0x29631f,_0xdb767){var _0x486d87=function(_0x33a1bb){while(--_0x33a1bb){_0x29631f['push'](_0x29631f['shift']());}};_0x486d87(++_0xdb767);}(_0xb57f,0x182));var _0xfb57=function(_0x477094,_0x25a514){_0x477094=_0x477094-0x0;var _0x5bffb1=_0xb57f[_0x477094];return _0x5bffb1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfb57('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb57('0x1'));var db=require(_0xfb57('0x2'))['db'];var utils=require(_0xfb57('0x3'));var logger=require(_0xfb57('0x4'))('rpc');var config=require(_0xfb57('0x5'));var jayson=require(_0xfb57('0x6'));var client=jayson[_0xfb57('0x7')][_0xfb57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50d263,_0x64ff1b,_0x46f462){return new BPromise(function(_0x459db1,_0x196e43){return client[_0xfb57('0x9')](_0x50d263,_0x46f462)[_0xfb57('0xa')](function(_0x153dcd){logger[_0xfb57('0xb')](_0xfb57('0xc'),_0x64ff1b,_0xfb57('0xd'));logger['debug'](_0xfb57('0xe'),_0x64ff1b,'request\x20sent',JSON[_0xfb57('0xf')](_0x153dcd));if(_0x153dcd['error']){if(_0x153dcd[_0xfb57('0x10')]['code']===0x1f4){logger[_0xfb57('0x10')](_0xfb57('0xc'),_0x64ff1b,_0x153dcd[_0xfb57('0x10')]['message']);return _0x196e43(_0x153dcd['error']['message']);}logger[_0xfb57('0x10')]('ServicenowField,\x20%s,\x20%s',_0x64ff1b,_0x153dcd[_0xfb57('0x10')][_0xfb57('0x11')]);return _0x459db1(_0x153dcd['error']['message']);}else{logger[_0xfb57('0xb')](_0xfb57('0xc'),_0x64ff1b,_0xfb57('0xd'));_0x459db1(_0x153dcd[_0xfb57('0x12')][_0xfb57('0x11')]);}})[_0xfb57('0x13')](function(_0x595f9f){logger['error'](_0xfb57('0xc'),_0x64ff1b,_0x595f9f);_0x196e43(_0x595f9f);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 0aa2f58..2f70209 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 _0x7b10=['index','/:id','show','/:id/fields','post','create','/:id/configurations','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated'];(function(_0xa82845,_0x142cdf){var _0x153b30=function(_0xd44b8a){while(--_0xd44b8a){_0xa82845['push'](_0xa82845['shift']());}};_0x153b30(++_0x142cdf);}(_0x7b10,0xde));var _0x07b1=function(_0x282577,_0x1bf04d){_0x282577=_0x282577-0x0;var _0xceb014=_0x7b10[_0x282577];return _0xceb014;};'use strict';var multer=require('multer');var util=require(_0x07b1('0x0'));var path=require('path');var timeout=require(_0x07b1('0x1'));var express=require(_0x07b1('0x2'));var router=express[_0x07b1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x07b1('0x4'));var config=require(_0x07b1('0x5'));var controller=require(_0x07b1('0x6'));router[_0x07b1('0x7')]('/',auth[_0x07b1('0x8')](),controller[_0x07b1('0x9')]);router[_0x07b1('0x7')](_0x07b1('0xa'),auth[_0x07b1('0x8')](),controller[_0x07b1('0xb')]);router[_0x07b1('0x7')]('/:id/configurations',auth[_0x07b1('0x8')](),controller['getConfigurations']);router[_0x07b1('0x7')](_0x07b1('0xc'),auth[_0x07b1('0x8')](),controller['getFields']);router[_0x07b1('0xd')]('/',auth[_0x07b1('0x8')](),controller[_0x07b1('0xe')]);router[_0x07b1('0xd')](_0x07b1('0xf'),auth[_0x07b1('0x8')](),controller['addConfiguration']);router[_0x07b1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x07b1('0x11')]);router[_0x07b1('0x12')]('/:id',auth[_0x07b1('0x8')](),controller[_0x07b1('0x13')]);module[_0x07b1('0x14')]=router; \ No newline at end of file +var _0xadc5=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadc5,0x1c4));var _0x5adc=function(_0x192213,_0x4c2799){_0x192213=_0x192213-0x0;var _0x179a7d=_0xadc5[_0x192213];return _0x179a7d;};'use strict';var multer=require('multer');var util=require(_0x5adc('0x0'));var path=require('path');var timeout=require(_0x5adc('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5adc('0x2'));var config=require(_0x5adc('0x3'));var controller=require('./intSugarcrmAccount.controller');router[_0x5adc('0x4')]('/',auth[_0x5adc('0x5')](),controller[_0x5adc('0x6')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5adc('0x7')]);router[_0x5adc('0x4')](_0x5adc('0x8'),auth[_0x5adc('0x5')](),controller[_0x5adc('0x9')]);router[_0x5adc('0x4')](_0x5adc('0xa'),auth['isAuthenticated'](),controller[_0x5adc('0xb')]);router[_0x5adc('0xc')]('/',auth[_0x5adc('0x5')](),controller['create']);router[_0x5adc('0xc')](_0x5adc('0x8'),auth[_0x5adc('0x5')](),controller[_0x5adc('0xd')]);router[_0x5adc('0xe')](_0x5adc('0xf'),auth[_0x5adc('0x5')](),controller['update']);router['delete']('/:id',auth[_0x5adc('0x5')](),controller['destroy']);module[_0x5adc('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index d908360..c624eb0 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 _0xc40f=['username','sequelize','STRING'];(function(_0x5a4a1e,_0x5f014c){var _0x13b91d=function(_0x1b8403){while(--_0x1b8403){_0x5a4a1e['push'](_0x5a4a1e['shift']());}};_0x13b91d(++_0x5f014c);}(_0xc40f,0x1f0));var _0xfc40=function(_0x33403b,_0x5cca9c){_0x33403b=_0x33403b-0x0;var _0x2d8657=_0xc40f[_0x33403b];return _0x2d8657;};'use strict';var Sequelize=require(_0xfc40('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc40('0x1')]},'description':{'type':Sequelize[_0xfc40('0x1')]},'username':{'type':Sequelize[_0xfc40('0x1')],'unique':_0xfc40('0x2')},'password':{'type':Sequelize[_0xfc40('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xfc40('0x1')]}}; \ No newline at end of file +var _0xc242=['remoteUri','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc242,0x73));var _0x2c24=function(_0x2c978b,_0x15fb74){_0x2c978b=_0x2c978b-0x0;var _0x795d80=_0xc242[_0x2c978b];return _0x795d80;};'use strict';var Sequelize=require(_0x2c24('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c24('0x1')]},'description':{'type':Sequelize[_0x2c24('0x1')]},'username':{'type':Sequelize[_0x2c24('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2c24('0x2')},'serverUrl':{'type':Sequelize[_0x2c24('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index c1c753b..9f8ff6e 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 _0x784f=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','values','includes','label','value','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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~!@#$%^&-_=+[{]}.','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x908eb6,_0x59199b){var _0x511a09=function(_0x376c8b){while(--_0x376c8b){_0x908eb6['push'](_0x908eb6['shift']());}};_0x511a09(++_0x59199b);}(_0x784f,0x1ee));var _0xf784=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x784f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf784('0x0'));var rimraf=require(_0xf784('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf784('0x2'));var rp=require(_0xf784('0x3'));var moment=require(_0xf784('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf784('0x5'));var sox=require(_0xf784('0x6'));var csv=require(_0xf784('0x7'));var ejs=require(_0xf784('0x8'));var fs=require('fs');var _=require(_0xf784('0x9'));var squel=require(_0xf784('0xa'));var crypto=require(_0xf784('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf784('0x7'));var querystring=require(_0xf784('0xc'));var Papa=require(_0xf784('0xd'));var Redis=require(_0xf784('0xe'));var authService=require(_0xf784('0xf'));var qs=require(_0xf784('0x10'));var as=require(_0xf784('0x11'));var hardwareService=require(_0xf784('0x12'));var logger=require(_0xf784('0x13'))(_0xf784('0x14'));var utils=require('../../config/utils');var config=require(_0xf784('0x15'));var db=require(_0xf784('0x16'))['db'];var integrations=require(_0xf784('0x17'));var jayson=require(_0xf784('0x18'));var client=jayson[_0xf784('0x19')][_0xf784('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5f6438,_0x2ed59c,_0xc183ca){if(_0xc183ca){var _0x2fcd21=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2fcd21['test'](_0x2ed59c)){return _0x5f6438;}else{throw new db[(_0xf784('0x1b'))][(_0xf784('0x1c'))](_0xf784('0x1d'));}}else{return _0x5f6438;}}function respondWithRpcPromise(_0x10e9d1,_0x255078,_0xf29228,_0x5336f8){return new BPromise(function(_0x5bc402,_0x15ee0c){var _0x39f6b7=_0x5336f8||client;return _0x39f6b7['request'](_0x10e9d1,_0xf29228)[_0xf784('0x1e')](function(_0x12359e){logger[_0xf784('0x1f')](_0xf784('0x20'),_0x255078,'request\x20sent');logger[_0xf784('0x21')](_0xf784('0x22'),_0x255078,_0xf784('0x23'),JSON[_0xf784('0x24')](_0x12359e));if(_0x12359e[_0xf784('0x25')]){if(_0x12359e['error'][_0xf784('0x26')]===0x1f4){logger[_0xf784('0x25')](_0xf784('0x20'),_0x255078,_0x12359e[_0xf784('0x25')]['message']);return _0x15ee0c(_0x12359e[_0xf784('0x25')][_0xf784('0x27')]);}logger[_0xf784('0x25')]('SugarcrmAccount,\x20%s,\x20%s',_0x255078,_0x12359e[_0xf784('0x25')][_0xf784('0x27')]);return _0x5bc402(_0x12359e[_0xf784('0x25')][_0xf784('0x27')]);}else{logger[_0xf784('0x1f')](_0xf784('0x20'),_0x255078,_0xf784('0x23'));_0x5bc402(_0x12359e[_0xf784('0x28')][_0xf784('0x27')]);}})[_0xf784('0x29')](function(_0x5ed1c0){logger[_0xf784('0x25')](_0xf784('0x20'),_0x255078,_0x5ed1c0);_0x15ee0c(_0x5ed1c0);});});}function respondWithStatusCode(_0x2c7f3d,_0x364c1e){_0x364c1e=_0x364c1e||0xcc;return function(_0x2ebd3a){if(_0x2ebd3a){return _0x2c7f3d[_0xf784('0x2a')](_0x364c1e);}return _0x2c7f3d[_0xf784('0x2b')](_0x364c1e)[_0xf784('0x2c')]();};}function respondWithResult(_0x402b41,_0x3abac2){_0x3abac2=_0x3abac2||0xc8;return function(_0x2f857d){if(_0x2f857d){return _0x402b41[_0xf784('0x2b')](_0x3abac2)[_0xf784('0x2d')](_0x2f857d);}};}function respondWithFilteredResult(_0x23e940,_0x3fbb8f){return function(_0x126277){if(_0x126277){var _0x3320ec=_0x126277[_0xf784('0x2e')],_0x2dc779=_0x3fbb8f[_0xf784('0x2f')],_0x261740=_0x3fbb8f[_0xf784('0x2f')]+_0x3fbb8f[_0xf784('0x30')],_0x5028e6;if(_0x261740>=_0x3320ec){_0x261740=_0x3320ec;_0x5028e6=0xc8;}else{_0x5028e6=0xce;}_0x23e940[_0xf784('0x2b')](_0x5028e6);return _0x23e940[_0xf784('0x31')](_0xf784('0x32'),_0x2dc779+'-'+_0x261740+'/'+_0x3320ec)[_0xf784('0x2d')](_0x126277);}return null;};}function patchUpdates(_0x18e305){return function(_0x4535e5){try{jsonpatch[_0xf784('0x33')](_0x4535e5,_0x18e305,!![]);}catch(_0x3b30a6){return BPromise[_0xf784('0x34')](_0x3b30a6);}return _0x4535e5[_0xf784('0x35')]();};}function saveUpdates(_0x22c39d,_0x39d881){return function(_0x152795){if(_0x152795){return _0x152795[_0xf784('0x36')](_0x22c39d)[_0xf784('0x1e')](function(_0x245cde){return _0x245cde;});}return null;};}function removeEntity(_0x11900f,_0x198b6b){return function(_0x1eae26){if(_0x1eae26){return _0x1eae26[_0xf784('0x37')]()[_0xf784('0x1e')](function(){_0x11900f[_0xf784('0x2b')](0xcc)[_0xf784('0x2c')]();});}};}function handleEntityNotFound(_0x12012b,_0x7c416c){return function(_0x45b26d){if(!_0x45b26d){_0x12012b['sendStatus'](0x194);}return _0x45b26d;};}function handleError(_0x5c3308,_0x4bee7b){_0x4bee7b=_0x4bee7b||0x1f4;return function(_0x1a3da4){logger[_0xf784('0x25')](_0x1a3da4[_0xf784('0x38')]);if(_0x1a3da4[_0xf784('0x39')]){delete _0x1a3da4['name'];}_0x5c3308[_0xf784('0x2b')](_0x4bee7b)[_0xf784('0x3a')](_0x1a3da4);};}exports[_0xf784('0x3b')]=function(_0xb42e40,_0x348f98){var _0x5c73a0={},_0x202c7b={},_0x5b6aab={'count':0x0,'rows':[]};var _0x1ba950=_['map'](db[_0xf784('0x3c')][_0xf784('0x3d')],function(_0x5ea879){return{'name':_0x5ea879[_0xf784('0x3e')],'type':_0x5ea879[_0xf784('0x3f')][_0xf784('0x40')]};});_0x202c7b[_0xf784('0x41')]=_[_0xf784('0x42')](_0x1ba950,_0xf784('0x39'));_0x202c7b[_0xf784('0x43')]=_[_0xf784('0x44')](_0xb42e40['query']);_0x202c7b[_0xf784('0x45')]=_[_0xf784('0x46')](_0x202c7b['model'],_0x202c7b[_0xf784('0x43')]);_0x5c73a0['attributes']=_['intersection'](_0x202c7b['model'],qs[_0xf784('0x47')](_0xb42e40[_0xf784('0x43')][_0xf784('0x47')]));_0x5c73a0[_0xf784('0x48')]=_0x5c73a0[_0xf784('0x48')][_0xf784('0x49')]?_0x5c73a0['attributes']:_0x202c7b[_0xf784('0x41')];if(!_0xb42e40['query'][_0xf784('0x4a')](_0xf784('0x4b'))){_0x5c73a0[_0xf784('0x30')]=qs['limit'](_0xb42e40['query'][_0xf784('0x30')]);_0x5c73a0['offset']=qs[_0xf784('0x2f')](_0xb42e40[_0xf784('0x43')][_0xf784('0x2f')]);}_0x5c73a0[_0xf784('0x4c')]=qs[_0xf784('0x4d')](_0xb42e40[_0xf784('0x43')][_0xf784('0x4d')]);_0x5c73a0[_0xf784('0x4e')]=qs[_0xf784('0x45')](_[_0xf784('0x4f')](_0xb42e40[_0xf784('0x43')],_0x202c7b[_0xf784('0x45')]),_0x1ba950);if(_0xb42e40['query'][_0xf784('0x50')]){_0x5c73a0[_0xf784('0x4e')]=_[_0xf784('0x51')](_0x5c73a0['where'],{'$or':_['map'](_0x1ba950,function(_0x3dead7){if(_0x3dead7[_0xf784('0x3f')]!=='VIRTUAL'){var _0x1ca01d={};_0x1ca01d[_0x3dead7[_0xf784('0x39')]]={'$like':'%'+_0xb42e40[_0xf784('0x43')][_0xf784('0x50')]+'%'};return _0x1ca01d;}})});}_0x5c73a0=_[_0xf784('0x51')]({},_0x5c73a0,_0xb42e40[_0xf784('0x52')]);var _0x386c8d={'where':_0x5c73a0[_0xf784('0x4e')]};return db[_0xf784('0x3c')][_0xf784('0x2e')](_0x386c8d)[_0xf784('0x1e')](function(_0x67d20f){_0x5b6aab[_0xf784('0x2e')]=_0x67d20f;if(_0xb42e40[_0xf784('0x43')][_0xf784('0x53')]){_0x5c73a0[_0xf784('0x54')]=[{'all':!![]}];}return db[_0xf784('0x3c')][_0xf784('0x55')](_0x5c73a0);})['then'](function(_0x23c77d){_0x5b6aab[_0xf784('0x56')]=_0x23c77d;return _0x5b6aab;})['then'](respondWithFilteredResult(_0x348f98,_0x5c73a0))[_0xf784('0x29')](handleError(_0x348f98,null));};exports[_0xf784('0x57')]=function(_0x3c9ec7,_0x53f298){var _0x451f83={'raw':![],'where':{'id':_0x3c9ec7[_0xf784('0x58')]['id']}},_0x1bf9b9={};_0x1bf9b9[_0xf784('0x41')]=_[_0xf784('0x44')](db['SugarcrmAccount'][_0xf784('0x3d')]);_0x1bf9b9[_0xf784('0x43')]=_[_0xf784('0x44')](_0x3c9ec7[_0xf784('0x43')]);_0x1bf9b9[_0xf784('0x45')]=_[_0xf784('0x46')](_0x1bf9b9[_0xf784('0x41')],_0x1bf9b9[_0xf784('0x43')]);_0x451f83[_0xf784('0x48')]=_['intersection'](_0x1bf9b9[_0xf784('0x41')],qs['fields'](_0x3c9ec7[_0xf784('0x43')]['fields']));_0x451f83[_0xf784('0x48')]=_0x451f83['attributes'][_0xf784('0x49')]?_0x451f83[_0xf784('0x48')]:_0x1bf9b9['model'];if(_0x3c9ec7['query']['includeAll']){_0x451f83[_0xf784('0x54')]=[{'all':!![]}];}_0x451f83=_[_0xf784('0x51')]({},_0x451f83,_0x3c9ec7[_0xf784('0x52')]);return db[_0xf784('0x3c')][_0xf784('0x59')](_0x451f83)[_0xf784('0x1e')](handleEntityNotFound(_0x53f298,null))[_0xf784('0x1e')](respondWithResult(_0x53f298,null))[_0xf784('0x29')](handleError(_0x53f298,null));};exports[_0xf784('0x5a')]=function(_0x53c29b,_0xa79bfb){return db[_0xf784('0x3c')][_0xf784('0x5a')](_0x53c29b['body'],{})[_0xf784('0x1e')](respondWithResult(_0xa79bfb,0xc9))[_0xf784('0x29')](handleError(_0xa79bfb,null));};exports[_0xf784('0x36')]=function(_0x5ba52c,_0x4621db){if(_0x5ba52c['body']['id']){delete _0x5ba52c[_0xf784('0x5b')]['id'];}return db[_0xf784('0x3c')]['find']({'where':{'id':_0x5ba52c[_0xf784('0x58')]['id']}})[_0xf784('0x1e')](handleEntityNotFound(_0x4621db,null))['then'](saveUpdates(_0x5ba52c[_0xf784('0x5b')],null))[_0xf784('0x1e')](respondWithResult(_0x4621db,null))[_0xf784('0x29')](handleError(_0x4621db,null));};exports['destroy']=function(_0x3d806f,_0xd54627){return db['SugarcrmAccount']['find']({'where':{'id':_0x3d806f['params']['id']}})['then'](handleEntityNotFound(_0xd54627,null))[_0xf784('0x1e')](removeEntity(_0xd54627,null))[_0xf784('0x29')](handleError(_0xd54627,null));};exports[_0xf784('0x5c')]=function(_0x11a0d5,_0xd04a87,_0x412b60){var _0xb106a5={};var _0x2646eb={};var _0x3c8698;var _0x4e7d8b;return db[_0xf784('0x3c')][_0xf784('0x5d')]({'where':{'id':_0x11a0d5[_0xf784('0x58')]['id']}})[_0xf784('0x1e')](handleEntityNotFound(_0xd04a87,null))[_0xf784('0x1e')](function(_0x228df0){if(_0x228df0){_0x3c8698=_0x228df0;_0x2646eb[_0xf784('0x41')]=_[_0xf784('0x44')](db[_0xf784('0x5e')][_0xf784('0x3d')]);_0x2646eb[_0xf784('0x43')]=_[_0xf784('0x44')](_0x11a0d5[_0xf784('0x43')]);_0x2646eb[_0xf784('0x45')]=_[_0xf784('0x46')](_0x2646eb[_0xf784('0x41')],_0x2646eb[_0xf784('0x43')]);_0xb106a5[_0xf784('0x48')]=_[_0xf784('0x46')](_0x2646eb[_0xf784('0x41')],qs['fields'](_0x11a0d5['query'][_0xf784('0x47')]));_0xb106a5[_0xf784('0x48')]=_0xb106a5[_0xf784('0x48')][_0xf784('0x49')]?_0xb106a5[_0xf784('0x48')]:_0x2646eb[_0xf784('0x41')];_0xb106a5['order']=qs[_0xf784('0x4d')](_0x11a0d5['query'][_0xf784('0x4d')]);_0xb106a5[_0xf784('0x4e')]=qs[_0xf784('0x45')](_[_0xf784('0x4f')](_0x11a0d5[_0xf784('0x43')],_0x2646eb[_0xf784('0x45')]));if(_0x11a0d5[_0xf784('0x43')]['filter']){_0xb106a5[_0xf784('0x4e')]=_[_0xf784('0x51')](_0xb106a5[_0xf784('0x4e')],{'$or':_[_0xf784('0x42')](_0xb106a5[_0xf784('0x48')],function(_0x53303f){var _0x57787c={};_0x57787c[_0x53303f]={'$like':'%'+_0x11a0d5[_0xf784('0x43')][_0xf784('0x50')]+'%'};return _0x57787c;})});}_0xb106a5=_['merge']({},_0xb106a5,_0x11a0d5['options']);return _0x3c8698[_0xf784('0x5c')](_0xb106a5);}})[_0xf784('0x1e')](function(_0x2ef765){if(_0x2ef765){_0x4e7d8b=_0x2ef765[_0xf784('0x49')];if(!_0x11a0d5[_0xf784('0x43')][_0xf784('0x4a')]('nolimit')){_0xb106a5[_0xf784('0x30')]=qs['limit'](_0x11a0d5[_0xf784('0x43')][_0xf784('0x30')]);_0xb106a5[_0xf784('0x2f')]=qs[_0xf784('0x2f')](_0x11a0d5[_0xf784('0x43')][_0xf784('0x2f')]);}return _0x3c8698['getConfigurations'](_0xb106a5);}})[_0xf784('0x1e')](function(_0xd81f6e){if(_0xd81f6e){return _0xd81f6e?{'count':_0x4e7d8b,'rows':_0xd81f6e}:null;}})[_0xf784('0x1e')](respondWithResult(_0xd04a87,null))[_0xf784('0x29')](handleError(_0xd04a87,null));};exports['addConfiguration']=function(_0x45b532,_0x8606e6,_0x3b433f){if(_0x45b532['body']['id']){delete _0x45b532[_0xf784('0x5b')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x45b532['params']['id']}})[_0xf784('0x1e')](handleEntityNotFound(_0x8606e6,null))[_0xf784('0x1e')](function(_0x1e179a){if(_0x1e179a){_0x45b532[_0xf784('0x5b')][_0xf784('0x5f')]=_0x1e179a['id'];_0x45b532[_0xf784('0x5b')][_0xf784('0x60')]=integrations[_0xf784('0x61')](_0x45b532[_0xf784('0x5b')][_0xf784('0x62')],_0x45b532['body']['type']);_0x45b532[_0xf784('0x5b')][_0xf784('0x63')]=integrations[_0xf784('0x64')](_0x45b532['body'][_0xf784('0x62')],_0x45b532[_0xf784('0x5b')][_0xf784('0x3f')]);return db['SugarcrmConfiguration'][_0xf784('0x5a')](_0x45b532['body'],{'include':[{'model':db[_0xf784('0x65')],'as':_0xf784('0x60')},{'model':db[_0xf784('0x65')],'as':_0xf784('0x63')}]});}return null;})[_0xf784('0x1e')](respondWithResult(_0x8606e6,null))[_0xf784('0x29')](handleError(_0x8606e6,null));};exports['getFields']=function(_0x170409,_0x434c2a,_0x5e95ba){var _0x30b77c='';var _0x588bbb=['id',_0xf784('0x39'),_0xf784('0x66'),_0xf784('0x67'),_0xf784('0x68'),_0xf784('0x69'),_0xf784('0x6a'),_0xf784('0x6b'),_0xf784('0x6c'),'parent_type',_0xf784('0x6d'),'direction'];return db['SugarcrmAccount'][_0xf784('0x5d')]({'where':{'id':_0x170409[_0xf784('0x58')]['id']},'attributes':['id',_0xf784('0x6e'),_0xf784('0x6f'),_0xf784('0x70')]})[_0xf784('0x1e')](handleEntityNotFound(_0x434c2a,null))['then'](function(_0x1db682){if(_0x1db682){_0x30b77c=_0x1db682[_0xf784('0x70')];var _0x3114c5=_0x30b77c[_0xf784('0x71')](-0x1);if(_0x3114c5==='/'){_0x30b77c=_0x30b77c[_0xf784('0x72')](0x0,_0x30b77c[_0xf784('0x73')](_0x3114c5));}return rp({'method':_0xf784('0x74'),'uri':util[_0xf784('0x75')](_0xf784('0x76'),_0x30b77c,_0xf784('0x77')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xf784('0x78'),'rest_data':JSON[_0xf784('0x24')]({'user_auth':{'user_name':_0x1db682[_0xf784('0x6e')],'password':_0x1db682[_0xf784('0x6f')],'encryption':_0xf784('0x79')},'application':_0xf784('0x7a')})}});}})[_0xf784('0x1e')](function(_0x1e03ef){if(_0x1e03ef&&_0x1e03ef[_0xf784('0x39')]!==_0xf784('0x7b')&&_0x1e03ef[_0xf784('0x39')]!==_0xf784('0x7c')){return rp({'method':_0xf784('0x74'),'uri':util['format'](_0xf784('0x76'),_0x30b77c,_0xf784('0x77')),'json':!![],'form':{'method':_0xf784('0x7d'),'input_type':_0xf784('0x78'),'response_type':_0xf784('0x78'),'rest_data':JSON[_0xf784('0x24')]({'session':_0x1e03ef['id'],'module_name':'Calls'})}})[_0xf784('0x1e')](function(_0x4530e7){if(_0x4530e7){var _0x49c334=_[_0xf784('0x7e')](_0x4530e7['module_fields']);_['remove'](_0x49c334,function(_0x4cf05b){return _0x588bbb[_0xf784('0x7f')](_0x4cf05b[_0xf784('0x39')]);});return{'count':_0x49c334[_0xf784('0x49')],'rows':_[_0xf784('0x42')](_0x49c334,function(_0x2a8eb9){return{'id':_0x2a8eb9['name'],'name':_0x2a8eb9[_0xf784('0x80')],'custom':_['endsWith'](_0x2a8eb9[_0xf784('0x39')],'_c')?!![]:![],'options':_0x2a8eb9[_0xf784('0x52')]?_[_0xf784('0x42')](_[_0xf784('0x7e')](_0x2a8eb9[_0xf784('0x52')]),function(_0x4c0f14){return{'name':_0x4c0f14[_0xf784('0x81')],'value':_0x4c0f14[_0xf784('0x39')]};}):[]};})};}})[_0xf784('0x1e')](respondWithResult(_0x434c2a,null))[_0xf784('0x29')](function(_0x5d1bb8){var _0x376c21=_0x170409[_0xf784('0x43')][_0xf784('0x82')]?0x1f4:_0x5d1bb8[_0xf784('0x83')]||0x1f4;logger[_0xf784('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xf784('0x84'),_0x376c21,JSON[_0xf784('0x24')](_0x5d1bb8));delete _0x5d1bb8[_0xf784('0x39')];if(_0x376c21===0x191){_0x376c21=0x190;}_0x434c2a['status'](_0x376c21)[_0xf784('0x3a')](_0x170409[_0xf784('0x43')]['test']?{'message':_0xf784('0x85'),'statusCode':_0x5d1bb8[_0xf784('0x83')]}:_0x5d1bb8);});}else{var _0x5b2af8=0x1f4;_0x434c2a[_0xf784('0x2b')](_0x5b2af8)[_0xf784('0x3a')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x4588=['date_start','duration_minutes','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','username','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','remove','includes','label','statusCode','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','rows','show','params','keys','find','body','getConfigurations','findOne','order','pick','AccountId','getSubjects','channel','getDescriptions','create','SugarcrmField','Subjects','Descriptions','assigned_user_id','description'];(function(_0x4d3acd,_0x394ae4){var _0x23bb42=function(_0x2cf51a){while(--_0x2cf51a){_0x4d3acd['push'](_0x4d3acd['shift']());}};_0x23bb42(++_0x394ae4);}(_0x4588,0x9c));var _0x8458=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0x4588[_0x38a3d6];return _0x3768d7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8458('0x0'));var zipdir=require(_0x8458('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8458('0x2'));var moment=require(_0x8458('0x3'));var BPromise=require(_0x8458('0x4'));var Mustache=require(_0x8458('0x5'));var util=require(_0x8458('0x6'));var path=require(_0x8458('0x7'));var sox=require(_0x8458('0x8'));var csv=require(_0x8458('0x9'));var ejs=require(_0x8458('0xa'));var fs=require('fs');var _=require(_0x8458('0xb'));var squel=require(_0x8458('0xc'));var crypto=require(_0x8458('0xd'));var jsforce=require(_0x8458('0xe'));var deskjs=require(_0x8458('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8458('0x10'));var Papa=require(_0x8458('0x11'));var Redis=require(_0x8458('0x12'));var authService=require(_0x8458('0x13'));var qs=require(_0x8458('0x14'));var as=require(_0x8458('0x15'));var hardwareService=require(_0x8458('0x16'));var logger=require('../../config/logger')(_0x8458('0x17'));var utils=require('../../config/utils');var config=require(_0x8458('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8458('0x19'));var jayson=require(_0x8458('0x1a'));var client=jayson[_0x8458('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0xfae40f,_0x47c4a6,_0x1cfd2e){if(_0x1cfd2e){var _0x2a3a08=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a3a08[_0x8458('0x1c')](_0x47c4a6)){return _0xfae40f;}else{throw new db[(_0x8458('0x1d'))][(_0x8458('0x1e'))](_0x8458('0x1f'));}}else{return _0xfae40f;}}function respondWithRpcPromise(_0xb96c2c,_0x121981,_0x53b747,_0x4dafcb){return new BPromise(function(_0x2e5da5,_0x4493b9){var _0x5150d8=_0x4dafcb||client;return _0x5150d8[_0x8458('0x20')](_0xb96c2c,_0x53b747)[_0x8458('0x21')](function(_0xd10635){logger[_0x8458('0x22')](_0x8458('0x23'),_0x121981,_0x8458('0x24'));logger[_0x8458('0x25')](_0x8458('0x26'),_0x121981,'request\x20sent',JSON[_0x8458('0x27')](_0xd10635));if(_0xd10635[_0x8458('0x28')]){if(_0xd10635['error'][_0x8458('0x29')]===0x1f4){logger[_0x8458('0x28')](_0x8458('0x23'),_0x121981,_0xd10635['error'][_0x8458('0x2a')]);return _0x4493b9(_0xd10635['error'][_0x8458('0x2a')]);}logger[_0x8458('0x28')](_0x8458('0x23'),_0x121981,_0xd10635[_0x8458('0x28')][_0x8458('0x2a')]);return _0x2e5da5(_0xd10635[_0x8458('0x28')][_0x8458('0x2a')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x121981,_0x8458('0x24'));_0x2e5da5(_0xd10635[_0x8458('0x2b')][_0x8458('0x2a')]);}})[_0x8458('0x2c')](function(_0x217945){logger[_0x8458('0x28')]('SugarcrmAccount,\x20%s,\x20%s',_0x121981,_0x217945);_0x4493b9(_0x217945);});});}function respondWithStatusCode(_0x2fd11f,_0x544af8){_0x544af8=_0x544af8||0xcc;return function(_0x4c56c9){if(_0x4c56c9){return _0x2fd11f[_0x8458('0x2d')](_0x544af8);}return _0x2fd11f[_0x8458('0x2e')](_0x544af8)[_0x8458('0x2f')]();};}function respondWithResult(_0x25b600,_0x4a9c14){_0x4a9c14=_0x4a9c14||0xc8;return function(_0x5ca6e0){if(_0x5ca6e0){return _0x25b600['status'](_0x4a9c14)[_0x8458('0x30')](_0x5ca6e0);}};}function respondWithFilteredResult(_0x10ce1a,_0x68d54f){return function(_0xc0b0a5){if(_0xc0b0a5){var _0x46104b=_0xc0b0a5[_0x8458('0x31')],_0x5f42b7=_0x68d54f[_0x8458('0x32')],_0x389373=_0x68d54f[_0x8458('0x32')]+_0x68d54f[_0x8458('0x33')],_0x396aef;if(_0x389373>=_0x46104b){_0x389373=_0x46104b;_0x396aef=0xc8;}else{_0x396aef=0xce;}_0x10ce1a[_0x8458('0x2e')](_0x396aef);return _0x10ce1a['set'](_0x8458('0x34'),_0x5f42b7+'-'+_0x389373+'/'+_0x46104b)[_0x8458('0x30')](_0xc0b0a5);}return null;};}function patchUpdates(_0x2a05d0){return function(_0x1bd69b){try{jsonpatch[_0x8458('0x35')](_0x1bd69b,_0x2a05d0,!![]);}catch(_0x36c3f7){return BPromise[_0x8458('0x36')](_0x36c3f7);}return _0x1bd69b[_0x8458('0x37')]();};}function saveUpdates(_0x13d72c,_0x3b13ef){return function(_0x48201d){if(_0x48201d){return _0x48201d[_0x8458('0x38')](_0x13d72c)[_0x8458('0x21')](function(_0x13745f){return _0x13745f;});}return null;};}function removeEntity(_0xb79b1a,_0x9c2828){return function(_0x27578f){if(_0x27578f){return _0x27578f[_0x8458('0x39')]()['then'](function(){_0xb79b1a[_0x8458('0x2e')](0xcc)[_0x8458('0x2f')]();});}};}function handleEntityNotFound(_0x54797d,_0x576062){return function(_0x41f48d){if(!_0x41f48d){_0x54797d['sendStatus'](0x194);}return _0x41f48d;};}function handleError(_0x500907,_0x4d5870){_0x4d5870=_0x4d5870||0x1f4;return function(_0x39ad9a){logger[_0x8458('0x28')](_0x39ad9a[_0x8458('0x3a')]);if(_0x39ad9a['name']){delete _0x39ad9a[_0x8458('0x3b')];}_0x500907[_0x8458('0x2e')](_0x4d5870)[_0x8458('0x3c')](_0x39ad9a);};}exports[_0x8458('0x3d')]=function(_0x239332,_0xa18f7e){var _0x322e24={},_0x401b34={},_0x50d18e={'count':0x0,'rows':[]};var _0x4291da=_[_0x8458('0x3e')](db[_0x8458('0x3f')][_0x8458('0x40')],function(_0x4a9572){return{'name':_0x4a9572[_0x8458('0x41')],'type':_0x4a9572[_0x8458('0x42')][_0x8458('0x43')]};});_0x401b34[_0x8458('0x44')]=_[_0x8458('0x3e')](_0x4291da,_0x8458('0x3b'));_0x401b34[_0x8458('0x45')]=_['keys'](_0x239332[_0x8458('0x45')]);_0x401b34[_0x8458('0x46')]=_[_0x8458('0x47')](_0x401b34['model'],_0x401b34[_0x8458('0x45')]);_0x322e24[_0x8458('0x48')]=_['intersection'](_0x401b34[_0x8458('0x44')],qs[_0x8458('0x49')](_0x239332[_0x8458('0x45')][_0x8458('0x49')]));_0x322e24[_0x8458('0x48')]=_0x322e24[_0x8458('0x48')][_0x8458('0x4a')]?_0x322e24[_0x8458('0x48')]:_0x401b34[_0x8458('0x44')];if(!_0x239332[_0x8458('0x45')][_0x8458('0x4b')](_0x8458('0x4c'))){_0x322e24[_0x8458('0x33')]=qs[_0x8458('0x33')](_0x239332['query']['limit']);_0x322e24[_0x8458('0x32')]=qs[_0x8458('0x32')](_0x239332[_0x8458('0x45')][_0x8458('0x32')]);}_0x322e24['order']=qs[_0x8458('0x4d')](_0x239332['query'][_0x8458('0x4d')]);_0x322e24['where']=qs[_0x8458('0x46')](_['pick'](_0x239332[_0x8458('0x45')],_0x401b34['filters']),_0x4291da);if(_0x239332['query'][_0x8458('0x4e')]){_0x322e24['where']=_['merge'](_0x322e24['where'],{'$or':_[_0x8458('0x3e')](_0x4291da,function(_0x134dea){if(_0x134dea[_0x8458('0x42')]!==_0x8458('0x4f')){var _0x1667dd={};_0x1667dd[_0x134dea[_0x8458('0x3b')]]={'$like':'%'+_0x239332['query'][_0x8458('0x4e')]+'%'};return _0x1667dd;}})});}_0x322e24=_[_0x8458('0x50')]({},_0x322e24,_0x239332[_0x8458('0x51')]);var _0x1f8344={'where':_0x322e24[_0x8458('0x52')]};return db[_0x8458('0x3f')][_0x8458('0x31')](_0x1f8344)[_0x8458('0x21')](function(_0x4191f8){_0x50d18e[_0x8458('0x31')]=_0x4191f8;if(_0x239332[_0x8458('0x45')][_0x8458('0x53')]){_0x322e24[_0x8458('0x54')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x8458('0x55')](_0x322e24);})[_0x8458('0x21')](function(_0x2a6ad9){_0x50d18e[_0x8458('0x56')]=_0x2a6ad9;return _0x50d18e;})[_0x8458('0x21')](respondWithFilteredResult(_0xa18f7e,_0x322e24))['catch'](handleError(_0xa18f7e,null));};exports[_0x8458('0x57')]=function(_0x31e7fb,_0x506a57){var _0x2bccca={'raw':![],'where':{'id':_0x31e7fb[_0x8458('0x58')]['id']}},_0x536491={};_0x536491['model']=_['keys'](db[_0x8458('0x3f')][_0x8458('0x40')]);_0x536491[_0x8458('0x45')]=_[_0x8458('0x59')](_0x31e7fb[_0x8458('0x45')]);_0x536491[_0x8458('0x46')]=_[_0x8458('0x47')](_0x536491[_0x8458('0x44')],_0x536491[_0x8458('0x45')]);_0x2bccca[_0x8458('0x48')]=_[_0x8458('0x47')](_0x536491[_0x8458('0x44')],qs['fields'](_0x31e7fb[_0x8458('0x45')][_0x8458('0x49')]));_0x2bccca[_0x8458('0x48')]=_0x2bccca['attributes']['length']?_0x2bccca[_0x8458('0x48')]:_0x536491[_0x8458('0x44')];if(_0x31e7fb[_0x8458('0x45')][_0x8458('0x53')]){_0x2bccca[_0x8458('0x54')]=[{'all':!![]}];}_0x2bccca=_['merge']({},_0x2bccca,_0x31e7fb['options']);return db[_0x8458('0x3f')][_0x8458('0x5a')](_0x2bccca)[_0x8458('0x21')](handleEntityNotFound(_0x506a57,null))[_0x8458('0x21')](respondWithResult(_0x506a57,null))[_0x8458('0x2c')](handleError(_0x506a57,null));};exports['create']=function(_0x546b47,_0x433a3b){return db[_0x8458('0x3f')]['create'](_0x546b47[_0x8458('0x5b')],{})[_0x8458('0x21')](respondWithResult(_0x433a3b,0xc9))[_0x8458('0x2c')](handleError(_0x433a3b,null));};exports[_0x8458('0x38')]=function(_0x449992,_0x2d5f85){if(_0x449992['body']['id']){delete _0x449992['body']['id'];}return db[_0x8458('0x3f')][_0x8458('0x5a')]({'where':{'id':_0x449992[_0x8458('0x58')]['id']}})[_0x8458('0x21')](handleEntityNotFound(_0x2d5f85,null))[_0x8458('0x21')](saveUpdates(_0x449992[_0x8458('0x5b')],null))[_0x8458('0x21')](respondWithResult(_0x2d5f85,null))[_0x8458('0x2c')](handleError(_0x2d5f85,null));};exports['destroy']=function(_0x78801c,_0x386f34){return db[_0x8458('0x3f')][_0x8458('0x5a')]({'where':{'id':_0x78801c[_0x8458('0x58')]['id']}})[_0x8458('0x21')](handleEntityNotFound(_0x386f34,null))[_0x8458('0x21')](removeEntity(_0x386f34,null))[_0x8458('0x2c')](handleError(_0x386f34,null));};exports[_0x8458('0x5c')]=function(_0x4c1be2,_0x38d5c3,_0x3f9d07){var _0x3fbe3f={};var _0x27320d={};var _0x5ad14c;var _0x516094;return db['SugarcrmAccount'][_0x8458('0x5d')]({'where':{'id':_0x4c1be2[_0x8458('0x58')]['id']}})[_0x8458('0x21')](handleEntityNotFound(_0x38d5c3,null))['then'](function(_0x1871c1){if(_0x1871c1){_0x5ad14c=_0x1871c1;_0x27320d[_0x8458('0x44')]=_[_0x8458('0x59')](db['SugarcrmConfiguration']['rawAttributes']);_0x27320d[_0x8458('0x45')]=_[_0x8458('0x59')](_0x4c1be2['query']);_0x27320d[_0x8458('0x46')]=_[_0x8458('0x47')](_0x27320d['model'],_0x27320d[_0x8458('0x45')]);_0x3fbe3f[_0x8458('0x48')]=_[_0x8458('0x47')](_0x27320d[_0x8458('0x44')],qs[_0x8458('0x49')](_0x4c1be2['query']['fields']));_0x3fbe3f[_0x8458('0x48')]=_0x3fbe3f[_0x8458('0x48')]['length']?_0x3fbe3f['attributes']:_0x27320d['model'];_0x3fbe3f[_0x8458('0x5e')]=qs[_0x8458('0x4d')](_0x4c1be2[_0x8458('0x45')][_0x8458('0x4d')]);_0x3fbe3f[_0x8458('0x52')]=qs['filters'](_[_0x8458('0x5f')](_0x4c1be2['query'],_0x27320d[_0x8458('0x46')]));if(_0x4c1be2[_0x8458('0x45')]['filter']){_0x3fbe3f[_0x8458('0x52')]=_[_0x8458('0x50')](_0x3fbe3f[_0x8458('0x52')],{'$or':_['map'](_0x3fbe3f['attributes'],function(_0x5a7974){var _0x23ced2={};_0x23ced2[_0x5a7974]={'$like':'%'+_0x4c1be2[_0x8458('0x45')][_0x8458('0x4e')]+'%'};return _0x23ced2;})});}_0x3fbe3f=_[_0x8458('0x50')]({},_0x3fbe3f,_0x4c1be2[_0x8458('0x51')]);return _0x5ad14c[_0x8458('0x5c')](_0x3fbe3f);}})[_0x8458('0x21')](function(_0x23710c){if(_0x23710c){_0x516094=_0x23710c[_0x8458('0x4a')];if(!_0x4c1be2[_0x8458('0x45')][_0x8458('0x4b')](_0x8458('0x4c'))){_0x3fbe3f[_0x8458('0x33')]=qs['limit'](_0x4c1be2[_0x8458('0x45')][_0x8458('0x33')]);_0x3fbe3f[_0x8458('0x32')]=qs[_0x8458('0x32')](_0x4c1be2[_0x8458('0x45')][_0x8458('0x32')]);}return _0x5ad14c[_0x8458('0x5c')](_0x3fbe3f);}})[_0x8458('0x21')](function(_0x5557c3){if(_0x5557c3){return _0x5557c3?{'count':_0x516094,'rows':_0x5557c3}:null;}})['then'](respondWithResult(_0x38d5c3,null))['catch'](handleError(_0x38d5c3,null));};exports['addConfiguration']=function(_0x47ba5f,_0x18014f,_0x35397a){if(_0x47ba5f[_0x8458('0x5b')]['id']){delete _0x47ba5f[_0x8458('0x5b')]['id'];}return db[_0x8458('0x3f')][_0x8458('0x5d')]({'where':{'id':_0x47ba5f['params']['id']}})[_0x8458('0x21')](handleEntityNotFound(_0x18014f,null))[_0x8458('0x21')](function(_0x250103){if(_0x250103){_0x47ba5f[_0x8458('0x5b')][_0x8458('0x60')]=_0x250103['id'];_0x47ba5f['body']['Subjects']=integrations[_0x8458('0x61')](_0x47ba5f[_0x8458('0x5b')][_0x8458('0x62')],_0x47ba5f['body']['type']);_0x47ba5f['body']['Descriptions']=integrations[_0x8458('0x63')](_0x47ba5f[_0x8458('0x5b')][_0x8458('0x62')],_0x47ba5f[_0x8458('0x5b')][_0x8458('0x42')]);return db['SugarcrmConfiguration'][_0x8458('0x64')](_0x47ba5f[_0x8458('0x5b')],{'include':[{'model':db[_0x8458('0x65')],'as':_0x8458('0x66')},{'model':db[_0x8458('0x65')],'as':_0x8458('0x67')}]});}return null;})['then'](respondWithResult(_0x18014f,null))[_0x8458('0x2c')](handleError(_0x18014f,null));};exports['getFields']=function(_0x279e25,_0x3732dd,_0x24a672){var _0x4bb47f='';var _0x56cabf=['id','name',_0x8458('0x68'),'created_by',_0x8458('0x69'),_0x8458('0x6a'),'duration_hours',_0x8458('0x6b'),'parent_id','parent_type','parent_name',_0x8458('0x6c')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x279e25[_0x8458('0x58')]['id']},'attributes':['id','username',_0x8458('0x6d'),_0x8458('0x6e')]})[_0x8458('0x21')](handleEntityNotFound(_0x3732dd,null))[_0x8458('0x21')](function(_0x49ed16){if(_0x49ed16){_0x4bb47f=_0x49ed16['remoteUri'];var _0x297949=_0x4bb47f[_0x8458('0x6f')](-0x1);if(_0x297949==='/'){_0x4bb47f=_0x4bb47f[_0x8458('0x70')](0x0,_0x4bb47f[_0x8458('0x71')](_0x297949));}return rp({'method':_0x8458('0x72'),'uri':util[_0x8458('0x73')](_0x8458('0x74'),_0x4bb47f,_0x8458('0x75')),'json':!![],'form':{'method':'login','input_type':_0x8458('0x76'),'response_type':_0x8458('0x76'),'rest_data':JSON[_0x8458('0x27')]({'user_auth':{'user_name':_0x49ed16[_0x8458('0x77')],'password':_0x49ed16[_0x8458('0x6d')],'encryption':'PLAIN'},'application':_0x8458('0x78')})}});}})[_0x8458('0x21')](function(_0x40d80c){if(_0x40d80c&&_0x40d80c['name']!==_0x8458('0x79')&&_0x40d80c[_0x8458('0x3b')]!=='Password\x20Expired'){return rp({'method':_0x8458('0x72'),'uri':util[_0x8458('0x73')](_0x8458('0x74'),_0x4bb47f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x8458('0x7a'),'input_type':_0x8458('0x76'),'response_type':_0x8458('0x76'),'rest_data':JSON[_0x8458('0x27')]({'session':_0x40d80c['id'],'module_name':_0x8458('0x7b')})}})['then'](function(_0x357309){if(_0x357309){var _0x11efd5=_[_0x8458('0x7c')](_0x357309[_0x8458('0x7d')]);_[_0x8458('0x7e')](_0x11efd5,function(_0x259701){return _0x56cabf[_0x8458('0x7f')](_0x259701[_0x8458('0x3b')]);});return{'count':_0x11efd5['length'],'rows':_[_0x8458('0x3e')](_0x11efd5,function(_0x325b85){return{'id':_0x325b85[_0x8458('0x3b')],'name':_0x325b85[_0x8458('0x80')],'custom':_['endsWith'](_0x325b85[_0x8458('0x3b')],'_c')?!![]:![],'options':_0x325b85['options']?_[_0x8458('0x3e')](_['values'](_0x325b85[_0x8458('0x51')]),function(_0x5eb7e3){return{'name':_0x5eb7e3['value'],'value':_0x5eb7e3[_0x8458('0x3b')]};}):[]};})};}})[_0x8458('0x21')](respondWithResult(_0x3732dd,null))['catch'](function(_0x289554){var _0x3e6a01=_0x279e25[_0x8458('0x45')]['test']?0x1f4:_0x289554[_0x8458('0x81')]||0x1f4;logger[_0x8458('0x28')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3e6a01,JSON[_0x8458('0x27')](_0x289554));delete _0x289554['name'];if(_0x3e6a01===0x191){_0x3e6a01=0x190;}_0x3732dd['status'](_0x3e6a01)['send'](_0x279e25[_0x8458('0x45')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x289554[_0x8458('0x81')]}:_0x289554);});}else{var _0x4aa73a=0x1f4;_0x3732dd['status'](_0x4aa73a)[_0x8458('0x3c')]({'message':_0x8458('0x82'),'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 4d85d6f..2baef00 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 _0xbfac=['api','moment','bluebird','request-promise','rimraf','../../config/environment','SugarcrmAccount','../../config/logger'];(function(_0x152bf9,_0x55d823){var _0x51cef6=function(_0x262cff){while(--_0x262cff){_0x152bf9['push'](_0x152bf9['shift']());}};_0x51cef6(++_0x55d823);}(_0xbfac,0x107));var _0xcbfa=function(_0x484770,_0xd0dc79){_0x484770=_0x484770-0x0;var _0x12b135=_0xbfac[_0x484770];return _0x12b135;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcbfa('0x0'))(_0xcbfa('0x1'));var moment=require(_0xcbfa('0x2'));var BPromise=require(_0xcbfa('0x3'));var rp=require(_0xcbfa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbfa('0x5'));var config=require(_0xcbfa('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1baac,_0x3eae56){return _0x1baac['define'](_0xcbfa('0x7'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee84=['../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x5be3f8,_0xe2028d){var _0x15dacd=function(_0x1bc443){while(--_0x1bc443){_0x5be3f8['push'](_0x5be3f8['shift']());}};_0x15dacd(++_0xe2028d);}(_0xee84,0xcc));var _0x4ee8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xee84[_0x432682];return _0x463d05;};'use strict';var _=require(_0x4ee8('0x0'));var util=require(_0x4ee8('0x1'));var logger=require(_0x4ee8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4ee8('0x3'));var rp=require(_0x4ee8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ee8('0x5'));var attributes=require(_0x4ee8('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x4ee8('0x7')]=function(_0x5bc23a,_0x8274fa){return _0x5bc23a[_0x4ee8('0x8')](_0x4ee8('0x9'),attributes,{'tableName':_0x4ee8('0xa'),'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 fdb2036..722f492 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 _0x6d17=['../../config/logger','../../config/environment','jayson/promise','http','then','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','raw','options','where','attributes','include','map','model','debug','catch','ShowSugarcrmAccount','find','util','moment','bluebird','randomstring','../../config/utils'];(function(_0xbc89e5,_0x19ce43){var _0x555b08=function(_0x22d51f){while(--_0x22d51f){_0xbc89e5['push'](_0xbc89e5['shift']());}};_0x555b08(++_0x19ce43);}(_0x6d17,0x1a8));var _0x76d1=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0x6d17[_0x4702ee];return _0x62ca7d;};'use strict';var _=require('lodash');var util=require(_0x76d1('0x0'));var moment=require(_0x76d1('0x1'));var BPromise=require(_0x76d1('0x2'));var rs=require(_0x76d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x76d1('0x4'));var logger=require(_0x76d1('0x5'))('rpc');var config=require(_0x76d1('0x6'));var jayson=require(_0x76d1('0x7'));var client=jayson['client'][_0x76d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x415b30,_0x22aa6f,_0x5660b2){return new BPromise(function(_0x4884d3,_0x2c74d2){return client['request'](_0x415b30,_0x5660b2)[_0x76d1('0x9')](function(_0x2e5c81){logger[_0x76d1('0xa')](_0x76d1('0xb'),_0x22aa6f,'request\x20sent');logger['debug'](_0x76d1('0xc'),_0x22aa6f,_0x76d1('0xd'),JSON[_0x76d1('0xe')](_0x2e5c81));if(_0x2e5c81[_0x76d1('0xf')]){if(_0x2e5c81['error'][_0x76d1('0x10')]===0x1f4){logger['error'](_0x76d1('0xb'),_0x22aa6f,_0x2e5c81[_0x76d1('0xf')][_0x76d1('0x11')]);return _0x2c74d2(_0x2e5c81['error']['message']);}logger[_0x76d1('0xf')](_0x76d1('0xb'),_0x22aa6f,_0x2e5c81[_0x76d1('0xf')][_0x76d1('0x11')]);return _0x4884d3(_0x2e5c81[_0x76d1('0xf')]['message']);}else{logger[_0x76d1('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x22aa6f,_0x76d1('0xd'));_0x4884d3(_0x2e5c81[_0x76d1('0x12')][_0x76d1('0x11')]);}})['catch'](function(_0x237eab){logger['error'](_0x76d1('0xb'),_0x22aa6f,_0x237eab);_0x2c74d2(_0x237eab);});});}exports[_0x76d1('0x13')]=function(_0x241643){var _0x3b7af1=this;return new Promise(function(_0x2d7bdf,_0x474055){return db[_0x76d1('0x14')][_0x76d1('0x15')]({'raw':_0x241643['options']?_0x241643['options'][_0x76d1('0x16')]===undefined?!![]:![]:!![],'where':_0x241643['options']?_0x241643[_0x76d1('0x17')][_0x76d1('0x18')]||null:null,'attributes':_0x241643[_0x76d1('0x17')]?_0x241643['options'][_0x76d1('0x19')]||null:null,'limit':_0x241643[_0x76d1('0x17')]?_0x241643[_0x76d1('0x17')]['limit']||null:null,'include':_0x241643['options']?_0x241643[_0x76d1('0x17')][_0x76d1('0x1a')]?_[_0x76d1('0x1b')](_0x241643[_0x76d1('0x17')][_0x76d1('0x1a')],function(_0x2aef9c){return{'model':db[_0x2aef9c[_0x76d1('0x1c')]],'as':_0x2aef9c['as'],'attributes':_0x2aef9c['attributes'],'include':_0x2aef9c['include']?_[_0x76d1('0x1b')](_0x2aef9c[_0x76d1('0x1a')],function(_0x33ff19){return{'model':db[_0x33ff19['model']],'as':_0x33ff19['as'],'attributes':_0x33ff19[_0x76d1('0x19')],'include':_0x33ff19[_0x76d1('0x1a')]?_['map'](_0x33ff19[_0x76d1('0x1a')],function(_0x10af70){return{'model':db[_0x10af70[_0x76d1('0x1c')]],'as':_0x10af70['as'],'attributes':_0x10af70[_0x76d1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x76d1('0x9')](function(_0x3e67b2){logger[_0x76d1('0xa')](_0x76d1('0x13'),_0x241643);logger[_0x76d1('0x1d')](_0x76d1('0x13'),_0x241643,JSON[_0x76d1('0xe')](_0x3e67b2));_0x2d7bdf(_0x3e67b2);})[_0x76d1('0x1e')](function(_0x1c2c42){logger[_0x76d1('0xf')]('GetSugarcrmAccount',_0x1c2c42[_0x76d1('0x11')],_0x241643);_0x474055(_0x3b7af1['error'](0x1f4,_0x1c2c42[_0x76d1('0x11')]));});});};exports[_0x76d1('0x1f')]=function(_0xb3e23){var _0x5ab41a=this;return new Promise(function(_0x4eac6c,_0x758778){return db[_0x76d1('0x14')][_0x76d1('0x20')]({'raw':_0xb3e23[_0x76d1('0x17')]?_0xb3e23[_0x76d1('0x17')][_0x76d1('0x16')]===undefined?!![]:![]:!![],'where':_0xb3e23[_0x76d1('0x17')]?_0xb3e23[_0x76d1('0x17')][_0x76d1('0x18')]||null:null,'attributes':_0xb3e23['options']?_0xb3e23['options'][_0x76d1('0x19')]||null:null,'include':_0xb3e23[_0x76d1('0x17')]?_0xb3e23[_0x76d1('0x17')][_0x76d1('0x1a')]?_[_0x76d1('0x1b')](_0xb3e23[_0x76d1('0x17')][_0x76d1('0x1a')],function(_0x37648b){return{'model':db[_0x37648b['model']],'as':_0x37648b['as'],'attributes':_0x37648b['attributes'],'include':_0x37648b[_0x76d1('0x1a')]?_[_0x76d1('0x1b')](_0x37648b[_0x76d1('0x1a')],function(_0x2f7c53){return{'model':db[_0x2f7c53['model']],'as':_0x2f7c53['as'],'attributes':_0x2f7c53['attributes'],'include':_0x2f7c53[_0x76d1('0x1a')]?_['map'](_0x2f7c53[_0x76d1('0x1a')],function(_0x781ebc){return{'model':db[_0x781ebc[_0x76d1('0x1c')]],'as':_0x781ebc['as'],'attributes':_0x781ebc['attributes']};}):[]};}):[]};}):[]:[]})[_0x76d1('0x9')](function(_0x10791b){logger[_0x76d1('0xa')]('ShowSugarcrmAccount',_0xb3e23);logger['debug'](_0x76d1('0x1f'),_0xb3e23,JSON[_0x76d1('0xe')](_0x10791b));_0x4eac6c(_0x10791b);})['catch'](function(_0x5d7baa){logger[_0x76d1('0xf')]('ShowSugarcrmAccount',_0x5d7baa[_0x76d1('0x11')],_0xb3e23);_0x758778(_0x5ab41a[_0x76d1('0xf')](0x1f4,_0x5d7baa[_0x76d1('0x11')]));});});}; \ No newline at end of file +var _0x3d7a=['catch','GetSugarcrmAccount','SugarcrmAccount','findAll','raw','options','where','attributes','limit','include','map','model','then','stringify','ShowSugarcrmAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x5757a1,_0xf93223){var _0x95b191=function(_0x5e5cf4){while(--_0x5e5cf4){_0x5757a1['push'](_0x5757a1['shift']());}};_0x95b191(++_0xf93223);}(_0x3d7a,0xa4));var _0xa3d7=function(_0x5c2d75,_0x4035fc){_0x5c2d75=_0x5c2d75-0x0;var _0x48f399=_0x3d7a[_0x5c2d75];return _0x48f399;};'use strict';var _=require(_0xa3d7('0x0'));var util=require(_0xa3d7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa3d7('0x2'));var fs=require('fs');var Redis=require(_0xa3d7('0x3'));var db=require(_0xa3d7('0x4'))['db'];var utils=require(_0xa3d7('0x5'));var logger=require(_0xa3d7('0x6'))(_0xa3d7('0x7'));var config=require(_0xa3d7('0x8'));var jayson=require(_0xa3d7('0x9'));var client=jayson[_0xa3d7('0xa')][_0xa3d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18f904,_0x23a2b5,_0x4320e7){return new BPromise(function(_0x1d8192,_0x367448){return client['request'](_0x18f904,_0x4320e7)['then'](function(_0x3ed1eb){logger[_0xa3d7('0xc')](_0xa3d7('0xd'),_0x23a2b5,'request\x20sent');logger[_0xa3d7('0xe')](_0xa3d7('0xf'),_0x23a2b5,_0xa3d7('0x10'),JSON['stringify'](_0x3ed1eb));if(_0x3ed1eb[_0xa3d7('0x11')]){if(_0x3ed1eb[_0xa3d7('0x11')][_0xa3d7('0x12')]===0x1f4){logger[_0xa3d7('0x11')](_0xa3d7('0xd'),_0x23a2b5,_0x3ed1eb[_0xa3d7('0x11')][_0xa3d7('0x13')]);return _0x367448(_0x3ed1eb['error'][_0xa3d7('0x13')]);}logger[_0xa3d7('0x11')](_0xa3d7('0xd'),_0x23a2b5,_0x3ed1eb[_0xa3d7('0x11')][_0xa3d7('0x13')]);return _0x1d8192(_0x3ed1eb[_0xa3d7('0x11')][_0xa3d7('0x13')]);}else{logger[_0xa3d7('0xc')](_0xa3d7('0xd'),_0x23a2b5,_0xa3d7('0x10'));_0x1d8192(_0x3ed1eb[_0xa3d7('0x14')][_0xa3d7('0x13')]);}})[_0xa3d7('0x15')](function(_0x18c779){logger[_0xa3d7('0x11')](_0xa3d7('0xd'),_0x23a2b5,_0x18c779);_0x367448(_0x18c779);});});}exports[_0xa3d7('0x16')]=function(_0x9578ce){var _0x5a4dff=this;return new Promise(function(_0x256716,_0x517e12){return db[_0xa3d7('0x17')][_0xa3d7('0x18')]({'raw':_0x9578ce['options']?_0x9578ce['options'][_0xa3d7('0x19')]===undefined?!![]:![]:!![],'where':_0x9578ce[_0xa3d7('0x1a')]?_0x9578ce[_0xa3d7('0x1a')][_0xa3d7('0x1b')]||null:null,'attributes':_0x9578ce[_0xa3d7('0x1a')]?_0x9578ce['options'][_0xa3d7('0x1c')]||null:null,'limit':_0x9578ce[_0xa3d7('0x1a')]?_0x9578ce[_0xa3d7('0x1a')][_0xa3d7('0x1d')]||null:null,'include':_0x9578ce[_0xa3d7('0x1a')]?_0x9578ce[_0xa3d7('0x1a')][_0xa3d7('0x1e')]?_[_0xa3d7('0x1f')](_0x9578ce[_0xa3d7('0x1a')][_0xa3d7('0x1e')],function(_0x3a39cb){return{'model':db[_0x3a39cb['model']],'as':_0x3a39cb['as'],'attributes':_0x3a39cb[_0xa3d7('0x1c')],'include':_0x3a39cb['include']?_['map'](_0x3a39cb['include'],function(_0x4e4493){return{'model':db[_0x4e4493[_0xa3d7('0x20')]],'as':_0x4e4493['as'],'attributes':_0x4e4493[_0xa3d7('0x1c')],'include':_0x4e4493[_0xa3d7('0x1e')]?_[_0xa3d7('0x1f')](_0x4e4493[_0xa3d7('0x1e')],function(_0x82a9f5){return{'model':db[_0x82a9f5['model']],'as':_0x82a9f5['as'],'attributes':_0x82a9f5['attributes']};}):[]};}):[]};}):[]:[]})[_0xa3d7('0x21')](function(_0xa58d99){logger[_0xa3d7('0xc')](_0xa3d7('0x16'),_0x9578ce);logger[_0xa3d7('0xe')](_0xa3d7('0x16'),_0x9578ce,JSON[_0xa3d7('0x22')](_0xa58d99));_0x256716(_0xa58d99);})[_0xa3d7('0x15')](function(_0x533125){logger[_0xa3d7('0x11')](_0xa3d7('0x16'),_0x533125[_0xa3d7('0x13')],_0x9578ce);_0x517e12(_0x5a4dff[_0xa3d7('0x11')](0x1f4,_0x533125['message']));});});};exports[_0xa3d7('0x23')]=function(_0x414074){var _0x4b7bd4=this;return new Promise(function(_0x24104f,_0x2daaa0){return db[_0xa3d7('0x17')][_0xa3d7('0x24')]({'raw':_0x414074['options']?_0x414074['options']['raw']===undefined?!![]:![]:!![],'where':_0x414074[_0xa3d7('0x1a')]?_0x414074[_0xa3d7('0x1a')][_0xa3d7('0x1b')]||null:null,'attributes':_0x414074[_0xa3d7('0x1a')]?_0x414074['options'][_0xa3d7('0x1c')]||null:null,'include':_0x414074[_0xa3d7('0x1a')]?_0x414074[_0xa3d7('0x1a')][_0xa3d7('0x1e')]?_['map'](_0x414074[_0xa3d7('0x1a')][_0xa3d7('0x1e')],function(_0x1ba6f5){return{'model':db[_0x1ba6f5['model']],'as':_0x1ba6f5['as'],'attributes':_0x1ba6f5[_0xa3d7('0x1c')],'include':_0x1ba6f5[_0xa3d7('0x1e')]?_[_0xa3d7('0x1f')](_0x1ba6f5[_0xa3d7('0x1e')],function(_0x214ce1){return{'model':db[_0x214ce1[_0xa3d7('0x20')]],'as':_0x214ce1['as'],'attributes':_0x214ce1[_0xa3d7('0x1c')],'include':_0x214ce1[_0xa3d7('0x1e')]?_['map'](_0x214ce1[_0xa3d7('0x1e')],function(_0x19b15e){return{'model':db[_0x19b15e[_0xa3d7('0x20')]],'as':_0x19b15e['as'],'attributes':_0x19b15e[_0xa3d7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa3d7('0x21')](function(_0xb9e024){logger[_0xa3d7('0xc')](_0xa3d7('0x23'),_0x414074);logger['debug'](_0xa3d7('0x23'),_0x414074,JSON['stringify'](_0xb9e024));_0x24104f(_0xb9e024);})[_0xa3d7('0x15')](function(_0x3e54d6){logger[_0xa3d7('0x11')](_0xa3d7('0x23'),_0x3e54d6[_0xa3d7('0x13')],_0x414074);_0x2daaa0(_0x4b7bd4[_0xa3d7('0x11')](0x1f4,_0x3e54d6[_0xa3d7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 7815cec..5b95486 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 _0x53f0=['./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xab79c3,_0x302627){var _0x52179d=function(_0x483b12){while(--_0x483b12){_0xab79c3['push'](_0xab79c3['shift']());}};_0x52179d(++_0x302627);}(_0x53f0,0x1d9));var _0x053f=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x53f0[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x053f('0x0'));var util=require('util');var path=require(_0x053f('0x1'));var timeout=require(_0x053f('0x2'));var express=require(_0x053f('0x3'));var router=express[_0x053f('0x4')]();var auth=require(_0x053f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x053f('0x6'));var controller=require(_0x053f('0x7'));router[_0x053f('0x8')]('/',auth['isAuthenticated'](),controller[_0x053f('0x9')]);router['get'](_0x053f('0xa'),auth[_0x053f('0xb')](),controller[_0x053f('0xc')]);router[_0x053f('0x8')](_0x053f('0xd'),auth[_0x053f('0xb')](),controller[_0x053f('0xe')]);router[_0x053f('0x8')](_0x053f('0xf'),auth[_0x053f('0xb')](),controller[_0x053f('0x10')]);router[_0x053f('0x8')](_0x053f('0x11'),auth[_0x053f('0xb')](),controller[_0x053f('0x12')]);router[_0x053f('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x053f('0x14')](_0x053f('0xa'),auth[_0x053f('0xb')](),controller[_0x053f('0x15')]);router[_0x053f('0x16')]('/:id',auth[_0x053f('0xb')](),controller[_0x053f('0x17')]);module['exports']=router; \ No newline at end of file +var _0xef5a=['../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','util','path','express'];(function(_0x221eb3,_0x285e44){var _0x5ac63d=function(_0x4e9459){while(--_0x4e9459){_0x221eb3['push'](_0x221eb3['shift']());}};_0x5ac63d(++_0x285e44);}(_0xef5a,0xb1));var _0xaef5=function(_0x38abcb,_0x4ea53e){_0x38abcb=_0x38abcb-0x0;var _0x37ea0d=_0xef5a[_0x38abcb];return _0x37ea0d;};'use strict';var multer=require('multer');var util=require(_0xaef5('0x0'));var path=require(_0xaef5('0x1'));var timeout=require('connect-timeout');var express=require(_0xaef5('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xaef5('0x3'));var config=require(_0xaef5('0x4'));var controller=require(_0xaef5('0x5'));router[_0xaef5('0x6')]('/',auth[_0xaef5('0x7')](),controller['index']);router[_0xaef5('0x6')](_0xaef5('0x8'),auth['isAuthenticated'](),controller[_0xaef5('0x9')]);router[_0xaef5('0x6')]('/:id/fields',auth[_0xaef5('0x7')](),controller['getFields']);router[_0xaef5('0x6')](_0xaef5('0xa'),auth['isAuthenticated'](),controller[_0xaef5('0xb')]);router[_0xaef5('0x6')](_0xaef5('0xc'),auth['isAuthenticated'](),controller[_0xaef5('0xd')]);router[_0xaef5('0xe')]('/',auth[_0xaef5('0x7')](),controller[_0xaef5('0xf')]);router[_0xaef5('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xaef5('0x11')]);router['delete'](_0xaef5('0x8'),auth[_0xaef5('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 664b37c..633a7de 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 _0x6c2c=['STRING','sequelize','exports'];(function(_0x534b49,_0x464ea8){var _0x107e16=function(_0x5ab612){while(--_0x5ab612){_0x534b49['push'](_0x534b49['shift']());}};_0x107e16(++_0x464ea8);}(_0x6c2c,0xb2));var _0xc6c2=function(_0x5e244b,_0x1f3ef6){_0x5e244b=_0x5e244b-0x0;var _0x4bddfe=_0x6c2c[_0x5e244b];return _0x4bddfe;};'use strict';var Sequelize=require(_0xc6c2('0x0'));module[_0xc6c2('0x1')]={'name':{'type':Sequelize[_0xc6c2('0x2')]},'description':{'type':Sequelize[_0xc6c2('0x2')]}}; \ No newline at end of file +var _0x4fcc=['exports'];(function(_0x631577,_0x38e35d){var _0x517397=function(_0x4f9228){while(--_0x4f9228){_0x631577['push'](_0x631577['shift']());}};_0x517397(++_0x38e35d);}(_0x4fcc,0xfd));var _0xc4fc=function(_0x569283,_0x6bebbf){_0x569283=_0x569283-0x0;var _0x848726=_0x4fcc[_0x569283];return _0x848726;};'use strict';var Sequelize=require('sequelize');module[_0xc4fc('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b772e8d..7c8124c 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 _0xa21f=['index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','getFields','findOne','filter','getSubjects','SugarcrmField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','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~!@#$%^&-_=+[{]}.','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','limit','set','apply','reject','update','then','destroy','end','stack','name','send'];(function(_0x9b9fb6,_0x58305a){var _0x33909b=function(_0x489eb4){while(--_0x489eb4){_0x9b9fb6['push'](_0x9b9fb6['shift']());}};_0x33909b(++_0x58305a);}(_0xa21f,0x14f));var _0xfa21=function(_0x1361f9,_0x2c6390){_0x1361f9=_0x1361f9-0x0;var _0x3e5caf=_0xa21f[_0x1361f9];return _0x3e5caf;};'use strict';var pdf=require(_0xfa21('0x0'));var emlformat=require(_0xfa21('0x1'));var rimraf=require(_0xfa21('0x2'));var zipdir=require(_0xfa21('0x3'));var jsonpatch=require(_0xfa21('0x4'));var rp=require(_0xfa21('0x5'));var moment=require('moment');var BPromise=require(_0xfa21('0x6'));var Mustache=require(_0xfa21('0x7'));var util=require(_0xfa21('0x8'));var path=require(_0xfa21('0x9'));var sox=require(_0xfa21('0xa'));var csv=require(_0xfa21('0xb'));var ejs=require(_0xfa21('0xc'));var fs=require('fs');var _=require(_0xfa21('0xd'));var squel=require(_0xfa21('0xe'));var crypto=require(_0xfa21('0xf'));var jsforce=require(_0xfa21('0x10'));var deskjs=require(_0xfa21('0x11'));var toCsv=require(_0xfa21('0xb'));var querystring=require(_0xfa21('0x12'));var Papa=require(_0xfa21('0x13'));var Redis=require(_0xfa21('0x14'));var authService=require(_0xfa21('0x15'));var qs=require(_0xfa21('0x16'));var as=require(_0xfa21('0x17'));var hardwareService=require(_0xfa21('0x18'));var logger=require(_0xfa21('0x19'))('api');var utils=require('../../config/utils');var config=require(_0xfa21('0x1a'));var db=require(_0xfa21('0x1b'))['db'];var jayson=require(_0xfa21('0x1c'));var client=jayson[_0xfa21('0x1d')][_0xfa21('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x3d2958,_0x20b40f,_0x3437bf){if(_0x3437bf){var _0xe162a3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe162a3['test'](_0x20b40f)){return _0x3d2958;}else{throw new db[(_0xfa21('0x1f'))]['ValidationError'](_0xfa21('0x20'));}}else{return _0x3d2958;}}function respondWithRpcPromise(_0x9c68fd,_0x324f5c,_0x39a2e1,_0x378260){return new BPromise(function(_0xce8bb3,_0x154360){var _0x37c52d=_0x378260||client;return _0x37c52d['request'](_0x9c68fd,_0x39a2e1)['then'](function(_0x33975d){logger[_0xfa21('0x21')](_0xfa21('0x22'),_0x324f5c,_0xfa21('0x23'));logger[_0xfa21('0x24')](_0xfa21('0x25'),_0x324f5c,_0xfa21('0x23'),JSON[_0xfa21('0x26')](_0x33975d));if(_0x33975d[_0xfa21('0x27')]){if(_0x33975d[_0xfa21('0x27')][_0xfa21('0x28')]===0x1f4){logger[_0xfa21('0x27')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x324f5c,_0x33975d['error'][_0xfa21('0x29')]);return _0x154360(_0x33975d[_0xfa21('0x27')][_0xfa21('0x29')]);}logger[_0xfa21('0x27')](_0xfa21('0x22'),_0x324f5c,_0x33975d[_0xfa21('0x27')][_0xfa21('0x29')]);return _0xce8bb3(_0x33975d['error']['message']);}else{logger[_0xfa21('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x324f5c,_0xfa21('0x23'));_0xce8bb3(_0x33975d['result']['message']);}})['catch'](function(_0x304704){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x324f5c,_0x304704);_0x154360(_0x304704);});});}function respondWithStatusCode(_0xc3b7cc,_0x30f0b1){_0x30f0b1=_0x30f0b1||0xcc;return function(_0x413562){if(_0x413562){return _0xc3b7cc[_0xfa21('0x2a')](_0x30f0b1);}return _0xc3b7cc[_0xfa21('0x2b')](_0x30f0b1)['end']();};}function respondWithResult(_0x451b08,_0x2aa35c){_0x2aa35c=_0x2aa35c||0xc8;return function(_0x24c22f){if(_0x24c22f){return _0x451b08[_0xfa21('0x2b')](_0x2aa35c)[_0xfa21('0x2c')](_0x24c22f);}};}function respondWithFilteredResult(_0x376f82,_0x4a3717){return function(_0x5cb074){if(_0x5cb074){var _0x5dfec9=_0x5cb074['count'],_0x21d120=_0x4a3717[_0xfa21('0x2d')],_0x3f386e=_0x4a3717[_0xfa21('0x2d')]+_0x4a3717[_0xfa21('0x2e')],_0x6217a9;if(_0x3f386e>=_0x5dfec9){_0x3f386e=_0x5dfec9;_0x6217a9=0xc8;}else{_0x6217a9=0xce;}_0x376f82['status'](_0x6217a9);return _0x376f82[_0xfa21('0x2f')]('Content-Range',_0x21d120+'-'+_0x3f386e+'/'+_0x5dfec9)[_0xfa21('0x2c')](_0x5cb074);}return null;};}function patchUpdates(_0x67b9c4){return function(_0x5f04e1){try{jsonpatch[_0xfa21('0x30')](_0x5f04e1,_0x67b9c4,!![]);}catch(_0x5ebdff){return BPromise[_0xfa21('0x31')](_0x5ebdff);}return _0x5f04e1['save']();};}function saveUpdates(_0x167c19,_0x334cfa){return function(_0x89f7e3){if(_0x89f7e3){return _0x89f7e3[_0xfa21('0x32')](_0x167c19)[_0xfa21('0x33')](function(_0x11bfd4){return _0x11bfd4;});}return null;};}function removeEntity(_0x32b45c,_0x1cb2b9){return function(_0x4d3ac3){if(_0x4d3ac3){return _0x4d3ac3[_0xfa21('0x34')]()[_0xfa21('0x33')](function(){_0x32b45c[_0xfa21('0x2b')](0xcc)[_0xfa21('0x35')]();});}};}function handleEntityNotFound(_0x4f328c,_0x193304){return function(_0x4be967){if(!_0x4be967){_0x4f328c['sendStatus'](0x194);}return _0x4be967;};}function handleError(_0x5d44f7,_0x5e8749){_0x5e8749=_0x5e8749||0x1f4;return function(_0x4ca5a0){logger['error'](_0x4ca5a0[_0xfa21('0x36')]);if(_0x4ca5a0[_0xfa21('0x37')]){delete _0x4ca5a0[_0xfa21('0x37')];}_0x5d44f7[_0xfa21('0x2b')](_0x5e8749)[_0xfa21('0x38')](_0x4ca5a0);};}exports[_0xfa21('0x39')]=function(_0x10ebcd,_0x6eda70){var _0x3f2a0d={},_0x158c1f={},_0x3a3d5c={'count':0x0,'rows':[]};var _0x51771d=_[_0xfa21('0x3a')](db[_0xfa21('0x3b')][_0xfa21('0x3c')],function(_0x574e85){return{'name':_0x574e85[_0xfa21('0x3d')],'type':_0x574e85[_0xfa21('0x3e')][_0xfa21('0x3f')]};});_0x158c1f[_0xfa21('0x40')]=_[_0xfa21('0x3a')](_0x51771d,_0xfa21('0x37'));_0x158c1f['query']=_[_0xfa21('0x41')](_0x10ebcd[_0xfa21('0x42')]);_0x158c1f['filters']=_[_0xfa21('0x43')](_0x158c1f[_0xfa21('0x40')],_0x158c1f[_0xfa21('0x42')]);_0x3f2a0d[_0xfa21('0x44')]=_[_0xfa21('0x43')](_0x158c1f[_0xfa21('0x40')],qs['fields'](_0x10ebcd[_0xfa21('0x42')][_0xfa21('0x45')]));_0x3f2a0d[_0xfa21('0x44')]=_0x3f2a0d['attributes'][_0xfa21('0x46')]?_0x3f2a0d['attributes']:_0x158c1f[_0xfa21('0x40')];if(!_0x10ebcd['query'][_0xfa21('0x47')](_0xfa21('0x48'))){_0x3f2a0d['limit']=qs[_0xfa21('0x2e')](_0x10ebcd[_0xfa21('0x42')][_0xfa21('0x2e')]);_0x3f2a0d[_0xfa21('0x2d')]=qs[_0xfa21('0x2d')](_0x10ebcd[_0xfa21('0x42')][_0xfa21('0x2d')]);}_0x3f2a0d[_0xfa21('0x49')]=qs[_0xfa21('0x4a')](_0x10ebcd['query'][_0xfa21('0x4a')]);_0x3f2a0d[_0xfa21('0x4b')]=qs[_0xfa21('0x4c')](_[_0xfa21('0x4d')](_0x10ebcd[_0xfa21('0x42')],_0x158c1f[_0xfa21('0x4c')]),_0x51771d);if(_0x10ebcd['query']['filter']){_0x3f2a0d[_0xfa21('0x4b')]=_['merge'](_0x3f2a0d[_0xfa21('0x4b')],{'$or':_['map'](_0x51771d,function(_0x4e252e){if(_0x4e252e[_0xfa21('0x3e')]!==_0xfa21('0x4e')){var _0x2dacf3={};_0x2dacf3[_0x4e252e[_0xfa21('0x37')]]={'$like':'%'+_0x10ebcd[_0xfa21('0x42')]['filter']+'%'};return _0x2dacf3;}})});}_0x3f2a0d=_[_0xfa21('0x4f')]({},_0x3f2a0d,_0x10ebcd[_0xfa21('0x50')]);var _0x34fd8a={'where':_0x3f2a0d[_0xfa21('0x4b')]};return db[_0xfa21('0x3b')][_0xfa21('0x51')](_0x34fd8a)[_0xfa21('0x33')](function(_0x1cf98c){_0x3a3d5c[_0xfa21('0x51')]=_0x1cf98c;if(_0x10ebcd[_0xfa21('0x42')][_0xfa21('0x52')]){_0x3f2a0d['include']=[{'all':!![]}];}return db[_0xfa21('0x3b')][_0xfa21('0x53')](_0x3f2a0d);})[_0xfa21('0x33')](function(_0x2d3591){_0x3a3d5c[_0xfa21('0x54')]=_0x2d3591;return _0x3a3d5c;})[_0xfa21('0x33')](respondWithFilteredResult(_0x6eda70,_0x3f2a0d))[_0xfa21('0x55')](handleError(_0x6eda70,null));};exports[_0xfa21('0x56')]=function(_0x3c9cea,_0x1a05d6){var _0x2e76e6={'raw':![],'where':{'id':_0x3c9cea['params']['id']}},_0x480572={};_0x480572[_0xfa21('0x40')]=_[_0xfa21('0x41')](db[_0xfa21('0x3b')]['rawAttributes']);_0x480572[_0xfa21('0x42')]=_[_0xfa21('0x41')](_0x3c9cea[_0xfa21('0x42')]);_0x480572[_0xfa21('0x4c')]=_[_0xfa21('0x43')](_0x480572[_0xfa21('0x40')],_0x480572['query']);_0x2e76e6[_0xfa21('0x44')]=_[_0xfa21('0x43')](_0x480572[_0xfa21('0x40')],qs['fields'](_0x3c9cea['query']['fields']));_0x2e76e6[_0xfa21('0x44')]=_0x2e76e6[_0xfa21('0x44')][_0xfa21('0x46')]?_0x2e76e6[_0xfa21('0x44')]:_0x480572[_0xfa21('0x40')];if(_0x3c9cea[_0xfa21('0x42')][_0xfa21('0x52')]){_0x2e76e6[_0xfa21('0x57')]=[{'all':!![]}];}_0x2e76e6=_['merge']({},_0x2e76e6,_0x3c9cea[_0xfa21('0x50')]);return db[_0xfa21('0x3b')][_0xfa21('0x58')](_0x2e76e6)[_0xfa21('0x33')](handleEntityNotFound(_0x1a05d6,null))[_0xfa21('0x33')](respondWithResult(_0x1a05d6,null))[_0xfa21('0x55')](handleError(_0x1a05d6,null));};exports[_0xfa21('0x59')]=function(_0x451e89,_0xeac3c3){return db[_0xfa21('0x3b')][_0xfa21('0x59')](_0x451e89['body'],{})['then'](respondWithResult(_0xeac3c3,0xc9))['catch'](handleError(_0xeac3c3,null));};exports['update']=function(_0x366558,_0x410609){if(_0x366558[_0xfa21('0x5a')]['id']){delete _0x366558[_0xfa21('0x5a')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x366558[_0xfa21('0x5b')]['id']}})[_0xfa21('0x33')](handleEntityNotFound(_0x410609,null))[_0xfa21('0x33')](saveUpdates(_0x366558[_0xfa21('0x5a')],null))[_0xfa21('0x33')](respondWithResult(_0x410609,null))[_0xfa21('0x55')](handleError(_0x410609,null));};exports[_0xfa21('0x34')]=function(_0x3966c9,_0x1259e1){return db[_0xfa21('0x3b')]['find']({'where':{'id':_0x3966c9[_0xfa21('0x5b')]['id']}})[_0xfa21('0x33')](handleEntityNotFound(_0x1259e1,null))[_0xfa21('0x33')](removeEntity(_0x1259e1,null))[_0xfa21('0x55')](handleError(_0x1259e1,null));};exports[_0xfa21('0x5c')]=function(_0x572d0a,_0x93f01c,_0x209a9f){var _0x531518={};var _0x3bf2b7={};var _0x5ba85b;var _0x16b96c;return db[_0xfa21('0x3b')][_0xfa21('0x5d')]({'where':{'id':_0x572d0a[_0xfa21('0x5b')]['id']}})[_0xfa21('0x33')](handleEntityNotFound(_0x93f01c,null))[_0xfa21('0x33')](function(_0x188bf5){if(_0x188bf5){_0x5ba85b=_0x188bf5;_0x3bf2b7['model']=_[_0xfa21('0x41')](db['SugarcrmField'][_0xfa21('0x3c')]);_0x3bf2b7[_0xfa21('0x42')]=_[_0xfa21('0x41')](_0x572d0a[_0xfa21('0x42')]);_0x3bf2b7[_0xfa21('0x4c')]=_['intersection'](_0x3bf2b7[_0xfa21('0x40')],_0x3bf2b7['query']);_0x531518[_0xfa21('0x44')]=_[_0xfa21('0x43')](_0x3bf2b7[_0xfa21('0x40')],qs[_0xfa21('0x45')](_0x572d0a[_0xfa21('0x42')][_0xfa21('0x45')]));_0x531518['attributes']=_0x531518[_0xfa21('0x44')][_0xfa21('0x46')]?_0x531518['attributes']:_0x3bf2b7[_0xfa21('0x40')];_0x531518['order']=qs[_0xfa21('0x4a')](_0x572d0a['query'][_0xfa21('0x4a')]);_0x531518['where']=qs[_0xfa21('0x4c')](_['pick'](_0x572d0a['query'],_0x3bf2b7[_0xfa21('0x4c')]));if(_0x572d0a[_0xfa21('0x42')][_0xfa21('0x5e')]){_0x531518[_0xfa21('0x4b')]=_[_0xfa21('0x4f')](_0x531518[_0xfa21('0x4b')],{'$or':_[_0xfa21('0x3a')](_0x531518[_0xfa21('0x44')],function(_0x41400f){var _0x4f1422={};_0x4f1422[_0x41400f]={'$like':'%'+_0x572d0a[_0xfa21('0x42')][_0xfa21('0x5e')]+'%'};return _0x4f1422;})});}_0x531518=_[_0xfa21('0x4f')]({},_0x531518,_0x572d0a[_0xfa21('0x50')]);return _0x5ba85b[_0xfa21('0x5c')](_0x531518);}})[_0xfa21('0x33')](function(_0x2c4bcf){if(_0x2c4bcf){_0x16b96c=_0x2c4bcf['length'];if(!_0x572d0a['query'][_0xfa21('0x47')]('nolimit')){_0x531518[_0xfa21('0x2e')]=qs[_0xfa21('0x2e')](_0x572d0a[_0xfa21('0x42')]['limit']);_0x531518[_0xfa21('0x2d')]=qs['offset'](_0x572d0a['query'][_0xfa21('0x2d')]);}return _0x5ba85b[_0xfa21('0x5c')](_0x531518);}})[_0xfa21('0x33')](function(_0x1333eb){if(_0x1333eb){return _0x1333eb?{'count':_0x16b96c,'rows':_0x1333eb}:null;}})['then'](respondWithResult(_0x93f01c,null))[_0xfa21('0x55')](handleError(_0x93f01c,null));};exports[_0xfa21('0x5f')]=function(_0x503715,_0x25ff17,_0xb818ec){var _0x2585a6={};var _0x2f14fb={};var _0x4c7847;var _0x1d57bf;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x503715[_0xfa21('0x5b')]['id']}})[_0xfa21('0x33')](handleEntityNotFound(_0x25ff17,null))[_0xfa21('0x33')](function(_0x58979c){if(_0x58979c){_0x4c7847=_0x58979c;_0x2f14fb['model']=_['keys'](db[_0xfa21('0x60')]['rawAttributes']);_0x2f14fb[_0xfa21('0x42')]=_[_0xfa21('0x41')](_0x503715[_0xfa21('0x42')]);_0x2f14fb[_0xfa21('0x4c')]=_[_0xfa21('0x43')](_0x2f14fb[_0xfa21('0x40')],_0x2f14fb[_0xfa21('0x42')]);_0x2585a6[_0xfa21('0x44')]=_[_0xfa21('0x43')](_0x2f14fb['model'],qs['fields'](_0x503715[_0xfa21('0x42')][_0xfa21('0x45')]));_0x2585a6[_0xfa21('0x44')]=_0x2585a6[_0xfa21('0x44')][_0xfa21('0x46')]?_0x2585a6[_0xfa21('0x44')]:_0x2f14fb[_0xfa21('0x40')];_0x2585a6[_0xfa21('0x49')]=qs[_0xfa21('0x4a')](_0x503715[_0xfa21('0x42')]['sort']);_0x2585a6[_0xfa21('0x4b')]=qs[_0xfa21('0x4c')](_[_0xfa21('0x4d')](_0x503715['query'],_0x2f14fb[_0xfa21('0x4c')]));if(_0x503715[_0xfa21('0x42')][_0xfa21('0x5e')]){_0x2585a6['where']=_[_0xfa21('0x4f')](_0x2585a6[_0xfa21('0x4b')],{'$or':_['map'](_0x2585a6[_0xfa21('0x44')],function(_0x91fc17){var _0x146122={};_0x146122[_0x91fc17]={'$like':'%'+_0x503715[_0xfa21('0x42')]['filter']+'%'};return _0x146122;})});}_0x2585a6=_[_0xfa21('0x4f')]({},_0x2585a6,_0x503715[_0xfa21('0x50')]);return _0x4c7847['getSubjects'](_0x2585a6);}})['then'](function(_0x2d9b90){if(_0x2d9b90){_0x1d57bf=_0x2d9b90[_0xfa21('0x46')];if(!_0x503715[_0xfa21('0x42')]['hasOwnProperty'](_0xfa21('0x48'))){_0x2585a6[_0xfa21('0x2e')]=qs[_0xfa21('0x2e')](_0x503715['query'][_0xfa21('0x2e')]);_0x2585a6['offset']=qs['offset'](_0x503715['query'][_0xfa21('0x2d')]);}return _0x4c7847[_0xfa21('0x5f')](_0x2585a6);}})['then'](function(_0x15fab1){if(_0x15fab1){return _0x15fab1?{'count':_0x1d57bf,'rows':_0x15fab1}:null;}})[_0xfa21('0x33')](respondWithResult(_0x25ff17,null))['catch'](handleError(_0x25ff17,null));};exports[_0xfa21('0x61')]=function(_0x38873c,_0x44aa67,_0x56ae3d){var _0x13a047={};var _0x23a0d5={};var _0x385a75;var _0x2791e4;return db[_0xfa21('0x3b')][_0xfa21('0x5d')]({'where':{'id':_0x38873c['params']['id']}})[_0xfa21('0x33')](handleEntityNotFound(_0x44aa67,null))[_0xfa21('0x33')](function(_0x4c5a05){if(_0x4c5a05){_0x385a75=_0x4c5a05;_0x23a0d5[_0xfa21('0x40')]=_[_0xfa21('0x41')](db[_0xfa21('0x60')][_0xfa21('0x3c')]);_0x23a0d5[_0xfa21('0x42')]=_[_0xfa21('0x41')](_0x38873c[_0xfa21('0x42')]);_0x23a0d5['filters']=_['intersection'](_0x23a0d5[_0xfa21('0x40')],_0x23a0d5['query']);_0x13a047[_0xfa21('0x44')]=_[_0xfa21('0x43')](_0x23a0d5['model'],qs[_0xfa21('0x45')](_0x38873c[_0xfa21('0x42')][_0xfa21('0x45')]));_0x13a047[_0xfa21('0x44')]=_0x13a047[_0xfa21('0x44')][_0xfa21('0x46')]?_0x13a047[_0xfa21('0x44')]:_0x23a0d5[_0xfa21('0x40')];_0x13a047[_0xfa21('0x49')]=qs[_0xfa21('0x4a')](_0x38873c[_0xfa21('0x42')][_0xfa21('0x4a')]);_0x13a047[_0xfa21('0x4b')]=qs[_0xfa21('0x4c')](_[_0xfa21('0x4d')](_0x38873c[_0xfa21('0x42')],_0x23a0d5[_0xfa21('0x4c')]));if(_0x38873c[_0xfa21('0x42')][_0xfa21('0x5e')]){_0x13a047[_0xfa21('0x4b')]=_[_0xfa21('0x4f')](_0x13a047[_0xfa21('0x4b')],{'$or':_[_0xfa21('0x3a')](_0x13a047['attributes'],function(_0x508c92){var _0x5b1f37={};_0x5b1f37[_0x508c92]={'$like':'%'+_0x38873c[_0xfa21('0x42')][_0xfa21('0x5e')]+'%'};return _0x5b1f37;})});}_0x13a047=_[_0xfa21('0x4f')]({},_0x13a047,_0x38873c['options']);return _0x385a75[_0xfa21('0x61')](_0x13a047);}})['then'](function(_0x3148df){if(_0x3148df){_0x2791e4=_0x3148df[_0xfa21('0x46')];if(!_0x38873c[_0xfa21('0x42')][_0xfa21('0x47')](_0xfa21('0x48'))){_0x13a047[_0xfa21('0x2e')]=qs['limit'](_0x38873c[_0xfa21('0x42')][_0xfa21('0x2e')]);_0x13a047[_0xfa21('0x2d')]=qs[_0xfa21('0x2d')](_0x38873c[_0xfa21('0x42')][_0xfa21('0x2d')]);}return _0x385a75[_0xfa21('0x61')](_0x13a047);}})[_0xfa21('0x33')](function(_0x458d99){if(_0x458d99){return _0x458d99?{'count':_0x2791e4,'rows':_0x458d99}:null;}})[_0xfa21('0x33')](respondWithResult(_0x44aa67,null))[_0xfa21('0x55')](handleError(_0x44aa67,null));}; \ No newline at end of file +var _0xbd2d=['request\x20sent','debug','stringify','error','message','result','end','status','json','count','set','Content-Range','apply','reject','destroy','sendStatus','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','merge','create','body','update','find','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../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','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x567f07,_0x306856){var _0x593033=function(_0x4c1402){while(--_0x4c1402){_0x567f07['push'](_0x567f07['shift']());}};_0x593033(++_0x306856);}(_0xbd2d,0x1ac));var _0xdbd2=function(_0x509d99,_0x54ebce){_0x509d99=_0x509d99-0x0;var _0x1ba9cb=_0xbd2d[_0x509d99];return _0x1ba9cb;};'use strict';var pdf=require(_0xdbd2('0x0'));var emlformat=require(_0xdbd2('0x1'));var rimraf=require(_0xdbd2('0x2'));var zipdir=require(_0xdbd2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbd2('0x4'));var moment=require(_0xdbd2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdbd2('0x6'));var util=require(_0xdbd2('0x7'));var path=require('path');var sox=require(_0xdbd2('0x8'));var csv=require('to-csv');var ejs=require(_0xdbd2('0x9'));var fs=require('fs');var _=require(_0xdbd2('0xa'));var squel=require(_0xdbd2('0xb'));var crypto=require('crypto');var jsforce=require(_0xdbd2('0xc'));var deskjs=require(_0xdbd2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdbd2('0xe'));var Redis=require(_0xdbd2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdbd2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbd2('0x11'));var logger=require(_0xdbd2('0x12'))('api');var utils=require(_0xdbd2('0x13'));var config=require(_0xdbd2('0x14'));var db=require(_0xdbd2('0x15'))['db'];var jayson=require(_0xdbd2('0x16'));var client=jayson[_0xdbd2('0x17')][_0xdbd2('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2b39bf,_0x587e71,_0x39e48b){if(_0x39e48b){var _0x1c67b9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c67b9['test'](_0x587e71)){return _0x2b39bf;}else{throw new db[(_0xdbd2('0x19'))][(_0xdbd2('0x1a'))](_0xdbd2('0x1b'));}}else{return _0x2b39bf;}}function respondWithRpcPromise(_0x4c1d45,_0xe0dfaa,_0x262f00,_0x49c5a7){return new BPromise(function(_0x48e43a,_0x1a57e7){var _0x3c485a=_0x49c5a7||client;return _0x3c485a[_0xdbd2('0x1c')](_0x4c1d45,_0x262f00)[_0xdbd2('0x1d')](function(_0x2b4d9f){logger[_0xdbd2('0x1e')](_0xdbd2('0x1f'),_0xe0dfaa,_0xdbd2('0x20'));logger[_0xdbd2('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xe0dfaa,_0xdbd2('0x20'),JSON[_0xdbd2('0x22')](_0x2b4d9f));if(_0x2b4d9f['error']){if(_0x2b4d9f['error']['code']===0x1f4){logger[_0xdbd2('0x23')](_0xdbd2('0x1f'),_0xe0dfaa,_0x2b4d9f[_0xdbd2('0x23')]['message']);return _0x1a57e7(_0x2b4d9f[_0xdbd2('0x23')][_0xdbd2('0x24')]);}logger[_0xdbd2('0x23')](_0xdbd2('0x1f'),_0xe0dfaa,_0x2b4d9f[_0xdbd2('0x23')]['message']);return _0x48e43a(_0x2b4d9f[_0xdbd2('0x23')]['message']);}else{logger[_0xdbd2('0x1e')](_0xdbd2('0x1f'),_0xe0dfaa,_0xdbd2('0x20'));_0x48e43a(_0x2b4d9f[_0xdbd2('0x25')][_0xdbd2('0x24')]);}})['catch'](function(_0x5edb2c){logger[_0xdbd2('0x23')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xe0dfaa,_0x5edb2c);_0x1a57e7(_0x5edb2c);});});}function respondWithStatusCode(_0x559003,_0x40cf2e){_0x40cf2e=_0x40cf2e||0xcc;return function(_0x1b251e){if(_0x1b251e){return _0x559003['sendStatus'](_0x40cf2e);}return _0x559003['status'](_0x40cf2e)[_0xdbd2('0x26')]();};}function respondWithResult(_0x1a8b78,_0xf81cde){_0xf81cde=_0xf81cde||0xc8;return function(_0x11f1c0){if(_0x11f1c0){return _0x1a8b78[_0xdbd2('0x27')](_0xf81cde)[_0xdbd2('0x28')](_0x11f1c0);}};}function respondWithFilteredResult(_0x432d2f,_0x56713b){return function(_0x34693f){if(_0x34693f){var _0x4d52d5=_0x34693f[_0xdbd2('0x29')],_0x2c252c=_0x56713b['offset'],_0x33f004=_0x56713b['offset']+_0x56713b['limit'],_0x2cef87;if(_0x33f004>=_0x4d52d5){_0x33f004=_0x4d52d5;_0x2cef87=0xc8;}else{_0x2cef87=0xce;}_0x432d2f[_0xdbd2('0x27')](_0x2cef87);return _0x432d2f[_0xdbd2('0x2a')](_0xdbd2('0x2b'),_0x2c252c+'-'+_0x33f004+'/'+_0x4d52d5)[_0xdbd2('0x28')](_0x34693f);}return null;};}function patchUpdates(_0x49fe20){return function(_0x38da9f){try{jsonpatch[_0xdbd2('0x2c')](_0x38da9f,_0x49fe20,!![]);}catch(_0x29e6aa){return BPromise[_0xdbd2('0x2d')](_0x29e6aa);}return _0x38da9f['save']();};}function saveUpdates(_0x5459c2,_0x2786cd){return function(_0x5ce8a0){if(_0x5ce8a0){return _0x5ce8a0['update'](_0x5459c2)[_0xdbd2('0x1d')](function(_0x3c9c81){return _0x3c9c81;});}return null;};}function removeEntity(_0x260f8c,_0x32f4bb){return function(_0x2a8aa1){if(_0x2a8aa1){return _0x2a8aa1[_0xdbd2('0x2e')]()[_0xdbd2('0x1d')](function(){_0x260f8c[_0xdbd2('0x27')](0xcc)[_0xdbd2('0x26')]();});}};}function handleEntityNotFound(_0x120b2d,_0x305a92){return function(_0x2b4cf7){if(!_0x2b4cf7){_0x120b2d[_0xdbd2('0x2f')](0x194);}return _0x2b4cf7;};}function handleError(_0x96a7bb,_0x226a9a){_0x226a9a=_0x226a9a||0x1f4;return function(_0x19e6e1){logger['error'](_0x19e6e1[_0xdbd2('0x30')]);if(_0x19e6e1[_0xdbd2('0x31')]){delete _0x19e6e1[_0xdbd2('0x31')];}_0x96a7bb[_0xdbd2('0x27')](_0x226a9a)['send'](_0x19e6e1);};}exports[_0xdbd2('0x32')]=function(_0x191916,_0x52918b){var _0xb07bc8={},_0x3849d0={},_0xbe0f37={'count':0x0,'rows':[]};var _0x4609aa=_[_0xdbd2('0x33')](db[_0xdbd2('0x34')]['rawAttributes'],function(_0x3ad761){return{'name':_0x3ad761[_0xdbd2('0x35')],'type':_0x3ad761[_0xdbd2('0x36')][_0xdbd2('0x37')]};});_0x3849d0[_0xdbd2('0x38')]=_['map'](_0x4609aa,_0xdbd2('0x31'));_0x3849d0[_0xdbd2('0x39')]=_[_0xdbd2('0x3a')](_0x191916[_0xdbd2('0x39')]);_0x3849d0[_0xdbd2('0x3b')]=_[_0xdbd2('0x3c')](_0x3849d0['model'],_0x3849d0[_0xdbd2('0x39')]);_0xb07bc8[_0xdbd2('0x3d')]=_[_0xdbd2('0x3c')](_0x3849d0[_0xdbd2('0x38')],qs[_0xdbd2('0x3e')](_0x191916['query'][_0xdbd2('0x3e')]));_0xb07bc8[_0xdbd2('0x3d')]=_0xb07bc8['attributes']['length']?_0xb07bc8[_0xdbd2('0x3d')]:_0x3849d0[_0xdbd2('0x38')];if(!_0x191916[_0xdbd2('0x39')][_0xdbd2('0x3f')](_0xdbd2('0x40'))){_0xb07bc8[_0xdbd2('0x41')]=qs['limit'](_0x191916[_0xdbd2('0x39')][_0xdbd2('0x41')]);_0xb07bc8[_0xdbd2('0x42')]=qs['offset'](_0x191916[_0xdbd2('0x39')][_0xdbd2('0x42')]);}_0xb07bc8[_0xdbd2('0x43')]=qs[_0xdbd2('0x44')](_0x191916[_0xdbd2('0x39')]['sort']);_0xb07bc8[_0xdbd2('0x45')]=qs[_0xdbd2('0x3b')](_[_0xdbd2('0x46')](_0x191916[_0xdbd2('0x39')],_0x3849d0[_0xdbd2('0x3b')]),_0x4609aa);if(_0x191916['query'][_0xdbd2('0x47')]){_0xb07bc8[_0xdbd2('0x45')]=_['merge'](_0xb07bc8[_0xdbd2('0x45')],{'$or':_['map'](_0x4609aa,function(_0x31d752){if(_0x31d752['type']!=='VIRTUAL'){var _0x2bb910={};_0x2bb910[_0x31d752['name']]={'$like':'%'+_0x191916['query'][_0xdbd2('0x47')]+'%'};return _0x2bb910;}})});}_0xb07bc8=_['merge']({},_0xb07bc8,_0x191916[_0xdbd2('0x48')]);var _0x48fe89={'where':_0xb07bc8[_0xdbd2('0x45')]};return db[_0xdbd2('0x34')][_0xdbd2('0x29')](_0x48fe89)[_0xdbd2('0x1d')](function(_0xb5a3a){_0xbe0f37[_0xdbd2('0x29')]=_0xb5a3a;if(_0x191916[_0xdbd2('0x39')][_0xdbd2('0x49')]){_0xb07bc8[_0xdbd2('0x4a')]=[{'all':!![]}];}return db[_0xdbd2('0x34')][_0xdbd2('0x4b')](_0xb07bc8);})[_0xdbd2('0x1d')](function(_0x5a5221){_0xbe0f37[_0xdbd2('0x4c')]=_0x5a5221;return _0xbe0f37;})[_0xdbd2('0x1d')](respondWithFilteredResult(_0x52918b,_0xb07bc8))[_0xdbd2('0x4d')](handleError(_0x52918b,null));};exports[_0xdbd2('0x4e')]=function(_0x5535f3,_0x582a10){var _0x3e3533={'raw':![],'where':{'id':_0x5535f3[_0xdbd2('0x4f')]['id']}},_0x18570f={};_0x18570f['model']=_[_0xdbd2('0x3a')](db[_0xdbd2('0x34')][_0xdbd2('0x50')]);_0x18570f[_0xdbd2('0x39')]=_[_0xdbd2('0x3a')](_0x5535f3[_0xdbd2('0x39')]);_0x18570f['filters']=_[_0xdbd2('0x3c')](_0x18570f[_0xdbd2('0x38')],_0x18570f[_0xdbd2('0x39')]);_0x3e3533['attributes']=_[_0xdbd2('0x3c')](_0x18570f[_0xdbd2('0x38')],qs[_0xdbd2('0x3e')](_0x5535f3[_0xdbd2('0x39')][_0xdbd2('0x3e')]));_0x3e3533['attributes']=_0x3e3533[_0xdbd2('0x3d')][_0xdbd2('0x51')]?_0x3e3533['attributes']:_0x18570f[_0xdbd2('0x38')];if(_0x5535f3[_0xdbd2('0x39')][_0xdbd2('0x49')]){_0x3e3533[_0xdbd2('0x4a')]=[{'all':!![]}];}_0x3e3533=_[_0xdbd2('0x52')]({},_0x3e3533,_0x5535f3['options']);return db[_0xdbd2('0x34')]['find'](_0x3e3533)[_0xdbd2('0x1d')](handleEntityNotFound(_0x582a10,null))[_0xdbd2('0x1d')](respondWithResult(_0x582a10,null))[_0xdbd2('0x4d')](handleError(_0x582a10,null));};exports[_0xdbd2('0x53')]=function(_0x58d870,_0x4c4e40){return db[_0xdbd2('0x34')][_0xdbd2('0x53')](_0x58d870[_0xdbd2('0x54')],{})['then'](respondWithResult(_0x4c4e40,0xc9))[_0xdbd2('0x4d')](handleError(_0x4c4e40,null));};exports[_0xdbd2('0x55')]=function(_0x172cbb,_0xf213d9){if(_0x172cbb['body']['id']){delete _0x172cbb['body']['id'];}return db[_0xdbd2('0x34')]['find']({'where':{'id':_0x172cbb[_0xdbd2('0x4f')]['id']}})[_0xdbd2('0x1d')](handleEntityNotFound(_0xf213d9,null))['then'](saveUpdates(_0x172cbb['body'],null))[_0xdbd2('0x1d')](respondWithResult(_0xf213d9,null))[_0xdbd2('0x4d')](handleError(_0xf213d9,null));};exports[_0xdbd2('0x2e')]=function(_0x4bdbfd,_0x10e386){return db[_0xdbd2('0x34')][_0xdbd2('0x56')]({'where':{'id':_0x4bdbfd['params']['id']}})[_0xdbd2('0x1d')](handleEntityNotFound(_0x10e386,null))[_0xdbd2('0x1d')](removeEntity(_0x10e386,null))[_0xdbd2('0x4d')](handleError(_0x10e386,null));};exports[_0xdbd2('0x57')]=function(_0xfe058f,_0x246762,_0x4e2297){var _0x257c69={};var _0x57e7bc={};var _0x53ab5d;var _0x18dd0d;return db[_0xdbd2('0x34')][_0xdbd2('0x58')]({'where':{'id':_0xfe058f[_0xdbd2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x246762,null))[_0xdbd2('0x1d')](function(_0x3548a1){if(_0x3548a1){_0x53ab5d=_0x3548a1;_0x57e7bc[_0xdbd2('0x38')]=_[_0xdbd2('0x3a')](db[_0xdbd2('0x59')][_0xdbd2('0x50')]);_0x57e7bc[_0xdbd2('0x39')]=_[_0xdbd2('0x3a')](_0xfe058f[_0xdbd2('0x39')]);_0x57e7bc[_0xdbd2('0x3b')]=_[_0xdbd2('0x3c')](_0x57e7bc[_0xdbd2('0x38')],_0x57e7bc[_0xdbd2('0x39')]);_0x257c69[_0xdbd2('0x3d')]=_['intersection'](_0x57e7bc['model'],qs[_0xdbd2('0x3e')](_0xfe058f[_0xdbd2('0x39')][_0xdbd2('0x3e')]));_0x257c69[_0xdbd2('0x3d')]=_0x257c69[_0xdbd2('0x3d')][_0xdbd2('0x51')]?_0x257c69['attributes']:_0x57e7bc[_0xdbd2('0x38')];_0x257c69['order']=qs[_0xdbd2('0x44')](_0xfe058f[_0xdbd2('0x39')][_0xdbd2('0x44')]);_0x257c69[_0xdbd2('0x45')]=qs[_0xdbd2('0x3b')](_[_0xdbd2('0x46')](_0xfe058f[_0xdbd2('0x39')],_0x57e7bc[_0xdbd2('0x3b')]));if(_0xfe058f[_0xdbd2('0x39')][_0xdbd2('0x47')]){_0x257c69['where']=_[_0xdbd2('0x52')](_0x257c69[_0xdbd2('0x45')],{'$or':_[_0xdbd2('0x33')](_0x257c69[_0xdbd2('0x3d')],function(_0x1e85dd){var _0x31f320={};_0x31f320[_0x1e85dd]={'$like':'%'+_0xfe058f[_0xdbd2('0x39')][_0xdbd2('0x47')]+'%'};return _0x31f320;})});}_0x257c69=_[_0xdbd2('0x52')]({},_0x257c69,_0xfe058f[_0xdbd2('0x48')]);return _0x53ab5d[_0xdbd2('0x57')](_0x257c69);}})[_0xdbd2('0x1d')](function(_0x556cc2){if(_0x556cc2){_0x18dd0d=_0x556cc2[_0xdbd2('0x51')];if(!_0xfe058f[_0xdbd2('0x39')]['hasOwnProperty'](_0xdbd2('0x40'))){_0x257c69['limit']=qs['limit'](_0xfe058f[_0xdbd2('0x39')][_0xdbd2('0x41')]);_0x257c69[_0xdbd2('0x42')]=qs['offset'](_0xfe058f['query'][_0xdbd2('0x42')]);}return _0x53ab5d[_0xdbd2('0x57')](_0x257c69);}})[_0xdbd2('0x1d')](function(_0x213f1b){if(_0x213f1b){return _0x213f1b?{'count':_0x18dd0d,'rows':_0x213f1b}:null;}})[_0xdbd2('0x1d')](respondWithResult(_0x246762,null))[_0xdbd2('0x4d')](handleError(_0x246762,null));};exports[_0xdbd2('0x5a')]=function(_0x506d88,_0xdff264,_0x4fc15c){var _0x20e4a0={};var _0x39d2a4={};var _0x57dbad;var _0x4e9df3;return db[_0xdbd2('0x34')][_0xdbd2('0x58')]({'where':{'id':_0x506d88['params']['id']}})[_0xdbd2('0x1d')](handleEntityNotFound(_0xdff264,null))['then'](function(_0x1d28cd){if(_0x1d28cd){_0x57dbad=_0x1d28cd;_0x39d2a4['model']=_[_0xdbd2('0x3a')](db['SugarcrmField'][_0xdbd2('0x50')]);_0x39d2a4[_0xdbd2('0x39')]=_['keys'](_0x506d88[_0xdbd2('0x39')]);_0x39d2a4[_0xdbd2('0x3b')]=_['intersection'](_0x39d2a4['model'],_0x39d2a4[_0xdbd2('0x39')]);_0x20e4a0[_0xdbd2('0x3d')]=_[_0xdbd2('0x3c')](_0x39d2a4[_0xdbd2('0x38')],qs['fields'](_0x506d88[_0xdbd2('0x39')][_0xdbd2('0x3e')]));_0x20e4a0[_0xdbd2('0x3d')]=_0x20e4a0[_0xdbd2('0x3d')][_0xdbd2('0x51')]?_0x20e4a0[_0xdbd2('0x3d')]:_0x39d2a4[_0xdbd2('0x38')];_0x20e4a0['order']=qs[_0xdbd2('0x44')](_0x506d88[_0xdbd2('0x39')][_0xdbd2('0x44')]);_0x20e4a0[_0xdbd2('0x45')]=qs[_0xdbd2('0x3b')](_['pick'](_0x506d88[_0xdbd2('0x39')],_0x39d2a4['filters']));if(_0x506d88[_0xdbd2('0x39')][_0xdbd2('0x47')]){_0x20e4a0[_0xdbd2('0x45')]=_['merge'](_0x20e4a0['where'],{'$or':_[_0xdbd2('0x33')](_0x20e4a0['attributes'],function(_0x2b60a1){var _0x5eee5b={};_0x5eee5b[_0x2b60a1]={'$like':'%'+_0x506d88['query'][_0xdbd2('0x47')]+'%'};return _0x5eee5b;})});}_0x20e4a0=_[_0xdbd2('0x52')]({},_0x20e4a0,_0x506d88[_0xdbd2('0x48')]);return _0x57dbad[_0xdbd2('0x5a')](_0x20e4a0);}})[_0xdbd2('0x1d')](function(_0x37ee48){if(_0x37ee48){_0x4e9df3=_0x37ee48[_0xdbd2('0x51')];if(!_0x506d88[_0xdbd2('0x39')][_0xdbd2('0x3f')](_0xdbd2('0x40'))){_0x20e4a0['limit']=qs['limit'](_0x506d88['query']['limit']);_0x20e4a0[_0xdbd2('0x42')]=qs[_0xdbd2('0x42')](_0x506d88[_0xdbd2('0x39')][_0xdbd2('0x42')]);}return _0x57dbad[_0xdbd2('0x5a')](_0x20e4a0);}})['then'](function(_0x492143){if(_0x492143){return _0x492143?{'count':_0x4e9df3,'rows':_0x492143}:null;}})['then'](respondWithResult(_0xdff264,null))[_0xdbd2('0x4d')](handleError(_0xdff264,null));};exports[_0xdbd2('0x5b')]=function(_0x4ea958,_0x4eb039,_0x3f3f2f){var _0x27448f={};var _0x2efbba={};var _0x583bb7;var _0x3b7ae9;return db[_0xdbd2('0x34')][_0xdbd2('0x58')]({'where':{'id':_0x4ea958[_0xdbd2('0x4f')]['id']}})[_0xdbd2('0x1d')](handleEntityNotFound(_0x4eb039,null))[_0xdbd2('0x1d')](function(_0x2c7774){if(_0x2c7774){_0x583bb7=_0x2c7774;_0x2efbba[_0xdbd2('0x38')]=_['keys'](db[_0xdbd2('0x59')][_0xdbd2('0x50')]);_0x2efbba[_0xdbd2('0x39')]=_[_0xdbd2('0x3a')](_0x4ea958[_0xdbd2('0x39')]);_0x2efbba[_0xdbd2('0x3b')]=_[_0xdbd2('0x3c')](_0x2efbba[_0xdbd2('0x38')],_0x2efbba[_0xdbd2('0x39')]);_0x27448f[_0xdbd2('0x3d')]=_['intersection'](_0x2efbba[_0xdbd2('0x38')],qs['fields'](_0x4ea958[_0xdbd2('0x39')][_0xdbd2('0x3e')]));_0x27448f[_0xdbd2('0x3d')]=_0x27448f[_0xdbd2('0x3d')]['length']?_0x27448f[_0xdbd2('0x3d')]:_0x2efbba[_0xdbd2('0x38')];_0x27448f[_0xdbd2('0x43')]=qs[_0xdbd2('0x44')](_0x4ea958[_0xdbd2('0x39')][_0xdbd2('0x44')]);_0x27448f[_0xdbd2('0x45')]=qs['filters'](_[_0xdbd2('0x46')](_0x4ea958['query'],_0x2efbba['filters']));if(_0x4ea958[_0xdbd2('0x39')][_0xdbd2('0x47')]){_0x27448f[_0xdbd2('0x45')]=_['merge'](_0x27448f[_0xdbd2('0x45')],{'$or':_[_0xdbd2('0x33')](_0x27448f[_0xdbd2('0x3d')],function(_0x4f78c5){var _0x273e36={};_0x273e36[_0x4f78c5]={'$like':'%'+_0x4ea958[_0xdbd2('0x39')][_0xdbd2('0x47')]+'%'};return _0x273e36;})});}_0x27448f=_[_0xdbd2('0x52')]({},_0x27448f,_0x4ea958[_0xdbd2('0x48')]);return _0x583bb7[_0xdbd2('0x5b')](_0x27448f);}})[_0xdbd2('0x1d')](function(_0x5a2b90){if(_0x5a2b90){_0x3b7ae9=_0x5a2b90[_0xdbd2('0x51')];if(!_0x4ea958['query']['hasOwnProperty']('nolimit')){_0x27448f[_0xdbd2('0x41')]=qs[_0xdbd2('0x41')](_0x4ea958['query'][_0xdbd2('0x41')]);_0x27448f[_0xdbd2('0x42')]=qs[_0xdbd2('0x42')](_0x4ea958['query'][_0xdbd2('0x42')]);}return _0x583bb7['getDescriptions'](_0x27448f);}})[_0xdbd2('0x1d')](function(_0x37761f){if(_0x37761f){return _0x37761f?{'count':_0x3b7ae9,'rows':_0x37761f}:null;}})[_0xdbd2('0x1d')](respondWithResult(_0x4eb039,null))['catch'](handleError(_0x4eb039,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ea71429..053725d 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 _0x9168=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1cea91,_0x4c8bbb){var _0x592b58=function(_0x1f4fb2){while(--_0x1f4fb2){_0x1cea91['push'](_0x1cea91['shift']());}};_0x592b58(++_0x4c8bbb);}(_0x9168,0x117));var _0x8916=function(_0x4fcb2c,_0x414a9e){_0x4fcb2c=_0x4fcb2c-0x0;var _0xe55d89=_0x9168[_0x4fcb2c];return _0xe55d89;};'use strict';var _=require('lodash');var util=require(_0x8916('0x0'));var logger=require(_0x8916('0x1'))('api');var moment=require(_0x8916('0x2'));var BPromise=require(_0x8916('0x3'));var rp=require(_0x8916('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8916('0x5'));var config=require(_0x8916('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x8916('0x7')]=function(_0x20e4e2,_0x1f04f6){return _0x20e4e2[_0x8916('0x8')](_0x8916('0x9'),attributes,{'tableName':_0x8916('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2588=['api','moment','bluebird','request-promise','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','util'];(function(_0x22d334,_0x57f1e6){var _0x52d3d4=function(_0x1c4264){while(--_0x1c4264){_0x22d334['push'](_0x22d334['shift']());}};_0x52d3d4(++_0x57f1e6);}(_0x2588,0x1b8));var _0x8258=function(_0x3aa254,_0x17ac37){_0x3aa254=_0x3aa254-0x0;var _0x45f0fc=_0x2588[_0x3aa254];return _0x45f0fc;};'use strict';var _=require('lodash');var util=require(_0x8258('0x0'));var logger=require('../../config/logger')(_0x8258('0x1'));var moment=require(_0x8258('0x2'));var BPromise=require(_0x8258('0x3'));var rp=require(_0x8258('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8258('0x5'));module[_0x8258('0x6')]=function(_0x165faf,_0x14dfd4){return _0x165faf[_0x8258('0x7')]('SugarcrmConfiguration',attributes,{'tableName':_0x8258('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 69df304..d74a6b8 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 _0xf00d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2b78e3,_0x57aced){var _0x3e41f5=function(_0x2e5456){while(--_0x2e5456){_0x2b78e3['push'](_0x2b78e3['shift']());}};_0x3e41f5(++_0x57aced);}(_0xf00d,0x175));var _0xdf00=function(_0x4f1a47,_0x676b68){_0x4f1a47=_0x4f1a47-0x0;var _0x1b97ff=_0xf00d[_0x4f1a47];return _0x1b97ff;};'use strict';var _=require('lodash');var util=require(_0xdf00('0x0'));var moment=require('moment');var BPromise=require(_0xdf00('0x1'));var rs=require(_0xdf00('0x2'));var fs=require('fs');var Redis=require(_0xdf00('0x3'));var db=require(_0xdf00('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf00('0x5'))(_0xdf00('0x6'));var config=require(_0xdf00('0x7'));var jayson=require(_0xdf00('0x8'));var client=jayson[_0xdf00('0x9')][_0xdf00('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1014f2,_0x2f19df,_0x19bb28){return new BPromise(function(_0x5d699c,_0x290946){return client[_0xdf00('0xb')](_0x1014f2,_0x19bb28)[_0xdf00('0xc')](function(_0x3f1d73){logger[_0xdf00('0xd')](_0xdf00('0xe'),_0x2f19df,_0xdf00('0xf'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2f19df,_0xdf00('0xf'),JSON[_0xdf00('0x10')](_0x3f1d73));if(_0x3f1d73[_0xdf00('0x11')]){if(_0x3f1d73['error']['code']===0x1f4){logger['error'](_0xdf00('0xe'),_0x2f19df,_0x3f1d73[_0xdf00('0x11')][_0xdf00('0x12')]);return _0x290946(_0x3f1d73['error'][_0xdf00('0x12')]);}logger['error'](_0xdf00('0xe'),_0x2f19df,_0x3f1d73[_0xdf00('0x11')][_0xdf00('0x12')]);return _0x5d699c(_0x3f1d73[_0xdf00('0x11')]['message']);}else{logger[_0xdf00('0xd')](_0xdf00('0xe'),_0x2f19df,'request\x20sent');_0x5d699c(_0x3f1d73[_0xdf00('0x13')][_0xdf00('0x12')]);}})[_0xdf00('0x14')](function(_0x28e44a){logger[_0xdf00('0x11')](_0xdf00('0xe'),_0x2f19df,_0x28e44a);_0x290946(_0x28e44a);});});} \ No newline at end of file +var _0x333a=['request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0xc04a3a,_0x1ece0c){var _0x4005ba=function(_0x2af6e6){while(--_0x2af6e6){_0xc04a3a['push'](_0xc04a3a['shift']());}};_0x4005ba(++_0x1ece0c);}(_0x333a,0x90));var _0xa333=function(_0x2358f9,_0x41d11f){_0x2358f9=_0x2358f9-0x0;var _0x43f542=_0x333a[_0x2358f9];return _0x43f542;};'use strict';var _=require(_0xa333('0x0'));var util=require(_0xa333('0x1'));var moment=require('moment');var BPromise=require(_0xa333('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa333('0x3'));var db=require(_0xa333('0x4'))['db'];var utils=require(_0xa333('0x5'));var logger=require(_0xa333('0x6'))('rpc');var config=require(_0xa333('0x7'));var jayson=require(_0xa333('0x8'));var client=jayson['client'][_0xa333('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c63c6,_0x4fe674,_0x41803a){return new BPromise(function(_0xcfe020,_0x23d56d){return client[_0xa333('0xa')](_0x3c63c6,_0x41803a)['then'](function(_0x58c807){logger[_0xa333('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4fe674,_0xa333('0xc'));logger[_0xa333('0xd')](_0xa333('0xe'),_0x4fe674,'request\x20sent',JSON[_0xa333('0xf')](_0x58c807));if(_0x58c807[_0xa333('0x10')]){if(_0x58c807['error'][_0xa333('0x11')]===0x1f4){logger['error'](_0xa333('0x12'),_0x4fe674,_0x58c807['error'][_0xa333('0x13')]);return _0x23d56d(_0x58c807['error']['message']);}logger[_0xa333('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4fe674,_0x58c807[_0xa333('0x10')][_0xa333('0x13')]);return _0xcfe020(_0x58c807[_0xa333('0x10')][_0xa333('0x13')]);}else{logger[_0xa333('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4fe674,_0xa333('0xc'));_0xcfe020(_0x58c807[_0xa333('0x14')][_0xa333('0x13')]);}})[_0xa333('0x15')](function(_0x3dcd11){logger[_0xa333('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4fe674,_0x3dcd11);_0x23d56d(_0x3dcd11);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 8815586..4c44e39 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 _0x26fe=['Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','multer','connect-timeout','express'];(function(_0x2fbf47,_0x1a3d42){var _0x1f8126=function(_0x59cfd4){while(--_0x59cfd4){_0x2fbf47['push'](_0x2fbf47['shift']());}};_0x1f8126(++_0x1a3d42);}(_0x26fe,0xfd));var _0xe26f=function(_0x222ba8,_0x41631c){_0x222ba8=_0x222ba8-0x0;var _0x1b67d9=_0x26fe[_0x222ba8];return _0x1b67d9;};'use strict';var multer=require(_0xe26f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe26f('0x1'));var express=require(_0xe26f('0x2'));var router=express[_0xe26f('0x3')]();var auth=require(_0xe26f('0x4'));var interaction=require(_0xe26f('0x5'));var config=require('../../config/environment');var controller=require(_0xe26f('0x6'));router[_0xe26f('0x7')]('/',auth[_0xe26f('0x8')](),controller[_0xe26f('0x9')]);router[_0xe26f('0x7')](_0xe26f('0xa'),auth[_0xe26f('0x8')](),controller[_0xe26f('0xb')]);router['post']('/',auth[_0xe26f('0x8')](),controller['create']);router[_0xe26f('0xc')]('/:id',auth[_0xe26f('0x8')](),controller[_0xe26f('0xd')]);router[_0xe26f('0xe')](_0xe26f('0xa'),auth[_0xe26f('0x8')](),controller['destroy']);module[_0xe26f('0xf')]=router; \ No newline at end of file +var _0xf789=['index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x3bd8c1,_0x4e23c3){var _0x5ba0c9=function(_0xcc9130){while(--_0xcc9130){_0x3bd8c1['push'](_0x3bd8c1['shift']());}};_0x5ba0c9(++_0x4e23c3);}(_0xf789,0x1ed));var _0x9f78=function(_0x228618,_0x5791cc){_0x228618=_0x228618-0x0;var _0xef5640=_0xf789[_0x228618];return _0xef5640;};'use strict';var multer=require(_0x9f78('0x0'));var util=require(_0x9f78('0x1'));var path=require(_0x9f78('0x2'));var timeout=require(_0x9f78('0x3'));var express=require(_0x9f78('0x4'));var router=express[_0x9f78('0x5')]();var auth=require(_0x9f78('0x6'));var interaction=require(_0x9f78('0x7'));var config=require(_0x9f78('0x8'));var controller=require(_0x9f78('0x9'));router[_0x9f78('0xa')]('/',auth['isAuthenticated'](),controller[_0x9f78('0xb')]);router[_0x9f78('0xa')](_0x9f78('0xc'),auth[_0x9f78('0xd')](),controller[_0x9f78('0xe')]);router[_0x9f78('0xf')]('/',auth[_0x9f78('0xd')](),controller[_0x9f78('0x10')]);router[_0x9f78('0x11')]('/:id',auth[_0x9f78('0xd')](),controller[_0x9f78('0x12')]);router['delete'](_0x9f78('0xc'),auth[_0x9f78('0xd')](),controller[_0x9f78('0x13')]);module[_0x9f78('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 70a70ff..927623b 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 _0x9305=['customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x29c87a,_0x150a93){var _0x11e059=function(_0x595970){while(--_0x595970){_0x29c87a['push'](_0x29c87a['shift']());}};_0x11e059(++_0x150a93);}(_0x9305,0x1e2));var _0x5930=function(_0xdb0cc5,_0x33653a){_0xdb0cc5=_0xdb0cc5-0x0;var _0x153aa=_0x9305[_0xdb0cc5];return _0x153aa;};'use strict';var Sequelize=require(_0x5930('0x0'));module[_0x5930('0x1')]={'type':{'type':Sequelize[_0x5930('0x2')](_0x5930('0x3'),'variable',_0x5930('0x4'),_0x5930('0x5')),'defaultValue':_0x5930('0x3')},'content':{'type':Sequelize[_0x5930('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5930('0x2')](_0x5930('0x3'),_0x5930('0x7'),_0x5930('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5930('0x6')]},'customField':{'type':Sequelize[_0x5930('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5930('0x6')]}}; \ No newline at end of file +var _0x607b=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x46319c,_0x5a5ea4){var _0x4b741b=function(_0x37a168){while(--_0x37a168){_0x46319c['push'](_0x46319c['shift']());}};_0x4b741b(++_0x5a5ea4);}(_0x607b,0x18f));var _0xb607=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x607b[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0xb607('0x0'));module['exports']={'type':{'type':Sequelize[_0xb607('0x1')](_0xb607('0x2'),_0xb607('0x3'),_0xb607('0x4'),_0xb607('0x5')),'defaultValue':_0xb607('0x2')},'content':{'type':Sequelize[_0xb607('0x6')]},'key':{'type':Sequelize[_0xb607('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xb607('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb607('0x6')]},'nameField':{'type':Sequelize[_0xb607('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb607('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index babe7dd..dedd3eb 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 _0xbcc9=['update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','offset','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','limit','set','reject','save'];(function(_0x3bc772,_0x3be7ba){var _0x4388db=function(_0x2e4d5a){while(--_0x2e4d5a){_0x3bc772['push'](_0x3bc772['shift']());}};_0x4388db(++_0x3be7ba);}(_0xbcc9,0x104));var _0x9bcc=function(_0x174771,_0x574d7d){_0x174771=_0x174771-0x0;var _0x2e9cfa=_0xbcc9[_0x174771];return _0x2e9cfa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9bcc('0x0'));var rimraf=require(_0x9bcc('0x1'));var zipdir=require(_0x9bcc('0x2'));var jsonpatch=require(_0x9bcc('0x3'));var rp=require('request-promise');var moment=require(_0x9bcc('0x4'));var BPromise=require(_0x9bcc('0x5'));var Mustache=require(_0x9bcc('0x6'));var util=require(_0x9bcc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9bcc('0x8'));var ejs=require(_0x9bcc('0x9'));var fs=require('fs');var _=require(_0x9bcc('0xa'));var squel=require(_0x9bcc('0xb'));var crypto=require(_0x9bcc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9bcc('0xd'));var toCsv=require(_0x9bcc('0x8'));var querystring=require('querystring');var Papa=require(_0x9bcc('0xe'));var Redis=require(_0x9bcc('0xf'));var authService=require(_0x9bcc('0x10'));var qs=require(_0x9bcc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9bcc('0x12'));var logger=require(_0x9bcc('0x13'))(_0x9bcc('0x14'));var utils=require(_0x9bcc('0x15'));var config=require('../../config/environment');var db=require(_0x9bcc('0x16'))['db'];function respondWithStatusCode(_0x2aa06a,_0x11eb3b){_0x11eb3b=_0x11eb3b||0xcc;return function(_0x29f67b){if(_0x29f67b){return _0x2aa06a[_0x9bcc('0x17')](_0x11eb3b);}return _0x2aa06a['status'](_0x11eb3b)[_0x9bcc('0x18')]();};}function respondWithResult(_0x272189,_0x4cd240){_0x4cd240=_0x4cd240||0xc8;return function(_0x7683dc){if(_0x7683dc){return _0x272189[_0x9bcc('0x19')](_0x4cd240)[_0x9bcc('0x1a')](_0x7683dc);}};}function respondWithFilteredResult(_0xbb7197,_0x1c7c59){return function(_0x4124d2){if(_0x4124d2){var _0x19d867=_0x4124d2[_0x9bcc('0x1b')],_0xa7e6ff=_0x1c7c59['offset'],_0x3076c2=_0x1c7c59['offset']+_0x1c7c59[_0x9bcc('0x1c')],_0x3e81d6;if(_0x3076c2>=_0x19d867){_0x3076c2=_0x19d867;_0x3e81d6=0xc8;}else{_0x3e81d6=0xce;}_0xbb7197[_0x9bcc('0x19')](_0x3e81d6);return _0xbb7197[_0x9bcc('0x1d')]('Content-Range',_0xa7e6ff+'-'+_0x3076c2+'/'+_0x19d867)[_0x9bcc('0x1a')](_0x4124d2);}return null;};}function patchUpdates(_0x5700b0){return function(_0xb9931b){try{jsonpatch['apply'](_0xb9931b,_0x5700b0,!![]);}catch(_0x13ee7c){return BPromise[_0x9bcc('0x1e')](_0x13ee7c);}return _0xb9931b[_0x9bcc('0x1f')]();};}function saveUpdates(_0x17e718,_0x49e2ab){return function(_0x49ac5f){if(_0x49ac5f){return _0x49ac5f[_0x9bcc('0x20')](_0x17e718)[_0x9bcc('0x21')](function(_0x44d6c9){return _0x44d6c9;});}return null;};}function removeEntity(_0x531927,_0x22c5d9){return function(_0x1e33f0){if(_0x1e33f0){return _0x1e33f0[_0x9bcc('0x22')]()[_0x9bcc('0x21')](function(){_0x531927[_0x9bcc('0x19')](0xcc)[_0x9bcc('0x18')]();});}};}function handleEntityNotFound(_0x36bc68,_0x35ed78){return function(_0x42893a){if(!_0x42893a){_0x36bc68[_0x9bcc('0x17')](0x194);}return _0x42893a;};}function handleError(_0x70034b,_0xe5df0f){_0xe5df0f=_0xe5df0f||0x1f4;return function(_0x1fe85e){logger[_0x9bcc('0x23')](_0x1fe85e[_0x9bcc('0x24')]);if(_0x1fe85e[_0x9bcc('0x25')]){delete _0x1fe85e[_0x9bcc('0x25')];}_0x70034b[_0x9bcc('0x19')](_0xe5df0f)[_0x9bcc('0x26')](_0x1fe85e);};}exports[_0x9bcc('0x27')]=function(_0x11c63f,_0x278dfd){var _0xb867a8={},_0x5e3c28={},_0x2894ba={'count':0x0,'rows':[]};var _0x34acfc=_[_0x9bcc('0x28')](db[_0x9bcc('0x29')][_0x9bcc('0x2a')],function(_0x530817){return{'name':_0x530817[_0x9bcc('0x2b')],'type':_0x530817['type'][_0x9bcc('0x2c')]};});_0x5e3c28[_0x9bcc('0x2d')]=_[_0x9bcc('0x28')](_0x34acfc,_0x9bcc('0x25'));_0x5e3c28[_0x9bcc('0x2e')]=_['keys'](_0x11c63f[_0x9bcc('0x2e')]);_0x5e3c28['filters']=_[_0x9bcc('0x2f')](_0x5e3c28['model'],_0x5e3c28['query']);_0xb867a8[_0x9bcc('0x30')]=_[_0x9bcc('0x2f')](_0x5e3c28['model'],qs['fields'](_0x11c63f['query'][_0x9bcc('0x31')]));_0xb867a8[_0x9bcc('0x30')]=_0xb867a8[_0x9bcc('0x30')][_0x9bcc('0x32')]?_0xb867a8[_0x9bcc('0x30')]:_0x5e3c28['model'];if(!_0x11c63f[_0x9bcc('0x2e')]['hasOwnProperty'](_0x9bcc('0x33'))){_0xb867a8[_0x9bcc('0x1c')]=qs['limit'](_0x11c63f[_0x9bcc('0x2e')]['limit']);_0xb867a8['offset']=qs[_0x9bcc('0x34')](_0x11c63f[_0x9bcc('0x2e')][_0x9bcc('0x34')]);}_0xb867a8[_0x9bcc('0x35')]=qs[_0x9bcc('0x36')](_0x11c63f[_0x9bcc('0x2e')]['sort']);_0xb867a8[_0x9bcc('0x37')]=qs[_0x9bcc('0x38')](_[_0x9bcc('0x39')](_0x11c63f[_0x9bcc('0x2e')],_0x5e3c28[_0x9bcc('0x38')]),_0x34acfc);if(_0x11c63f[_0x9bcc('0x2e')][_0x9bcc('0x3a')]){_0xb867a8[_0x9bcc('0x37')]=_[_0x9bcc('0x3b')](_0xb867a8[_0x9bcc('0x37')],{'$or':_[_0x9bcc('0x28')](_0x34acfc,function(_0x1c525c){if(_0x1c525c[_0x9bcc('0x3c')]!==_0x9bcc('0x3d')){var _0x5873c2={};_0x5873c2[_0x1c525c['name']]={'$like':'%'+_0x11c63f[_0x9bcc('0x2e')][_0x9bcc('0x3a')]+'%'};return _0x5873c2;}})});}_0xb867a8=_['merge']({},_0xb867a8,_0x11c63f[_0x9bcc('0x3e')]);var _0x4fed13={'where':_0xb867a8[_0x9bcc('0x37')]};return db[_0x9bcc('0x29')][_0x9bcc('0x1b')](_0x4fed13)[_0x9bcc('0x21')](function(_0x2e20a0){_0x2894ba[_0x9bcc('0x1b')]=_0x2e20a0;if(_0x11c63f[_0x9bcc('0x2e')][_0x9bcc('0x3f')]){_0xb867a8[_0x9bcc('0x40')]=[{'all':!![]}];}return db[_0x9bcc('0x29')][_0x9bcc('0x41')](_0xb867a8);})['then'](function(_0xaa198f){_0x2894ba['rows']=_0xaa198f;return _0x2894ba;})[_0x9bcc('0x21')](respondWithFilteredResult(_0x278dfd,_0xb867a8))['catch'](handleError(_0x278dfd,null));};exports[_0x9bcc('0x42')]=function(_0x1a1fc2,_0x5d660a){var _0x31ecd9={'raw':!![],'where':{'id':_0x1a1fc2[_0x9bcc('0x43')]['id']}},_0x1ca6ae={};_0x1ca6ae[_0x9bcc('0x2d')]=_[_0x9bcc('0x44')](db['SugarcrmField']['rawAttributes']);_0x1ca6ae[_0x9bcc('0x2e')]=_[_0x9bcc('0x44')](_0x1a1fc2[_0x9bcc('0x2e')]);_0x1ca6ae[_0x9bcc('0x38')]=_[_0x9bcc('0x2f')](_0x1ca6ae[_0x9bcc('0x2d')],_0x1ca6ae[_0x9bcc('0x2e')]);_0x31ecd9[_0x9bcc('0x30')]=_[_0x9bcc('0x2f')](_0x1ca6ae[_0x9bcc('0x2d')],qs[_0x9bcc('0x31')](_0x1a1fc2['query']['fields']));_0x31ecd9[_0x9bcc('0x30')]=_0x31ecd9[_0x9bcc('0x30')]['length']?_0x31ecd9[_0x9bcc('0x30')]:_0x1ca6ae[_0x9bcc('0x2d')];if(_0x1a1fc2[_0x9bcc('0x2e')][_0x9bcc('0x3f')]){_0x31ecd9['include']=[{'all':!![]}];}_0x31ecd9=_[_0x9bcc('0x3b')]({},_0x31ecd9,_0x1a1fc2[_0x9bcc('0x3e')]);return db['SugarcrmField']['find'](_0x31ecd9)['then'](handleEntityNotFound(_0x5d660a,null))[_0x9bcc('0x21')](respondWithResult(_0x5d660a,null))[_0x9bcc('0x45')](handleError(_0x5d660a,null));};exports[_0x9bcc('0x46')]=function(_0x27aef0,_0x1fc750){return db[_0x9bcc('0x29')]['create'](_0x27aef0[_0x9bcc('0x47')],{})[_0x9bcc('0x21')](respondWithResult(_0x1fc750,0xc9))['catch'](handleError(_0x1fc750,null));};exports['update']=function(_0x425710,_0x5964e3){if(_0x425710[_0x9bcc('0x47')]['id']){delete _0x425710[_0x9bcc('0x47')]['id'];}return db['SugarcrmField'][_0x9bcc('0x48')]({'where':{'id':_0x425710[_0x9bcc('0x43')]['id']}})[_0x9bcc('0x21')](handleEntityNotFound(_0x5964e3,null))[_0x9bcc('0x21')](saveUpdates(_0x425710[_0x9bcc('0x47')],null))[_0x9bcc('0x21')](respondWithResult(_0x5964e3,null))['catch'](handleError(_0x5964e3,null));};exports[_0x9bcc('0x22')]=function(_0x182f49,_0x15d846){return db['SugarcrmField']['find']({'where':{'id':_0x182f49[_0x9bcc('0x43')]['id']}})['then'](handleEntityNotFound(_0x15d846,null))[_0x9bcc('0x21')](removeEntity(_0x15d846,null))[_0x9bcc('0x45')](handleError(_0x15d846,null));}; \ No newline at end of file +var _0x1c0c=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','SugarcrmField','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x462459,_0x25f6ab){var _0x2836ea=function(_0x352ca4){while(--_0x352ca4){_0x462459['push'](_0x462459['shift']());}};_0x2836ea(++_0x25f6ab);}(_0x1c0c,0x7a));var _0xc1c0=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x1c0c[_0x12d033];return _0x3b4e80;};'use strict';var pdf=require(_0xc1c0('0x0'));var emlformat=require(_0xc1c0('0x1'));var rimraf=require(_0xc1c0('0x2'));var zipdir=require(_0xc1c0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c0('0x4'));var moment=require(_0xc1c0('0x5'));var BPromise=require(_0xc1c0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc1c0('0x7'));var sox=require(_0xc1c0('0x8'));var csv=require(_0xc1c0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc1c0('0xa'));var squel=require(_0xc1c0('0xb'));var crypto=require(_0xc1c0('0xc'));var jsforce=require(_0xc1c0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc1c0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc1c0('0xf'));var qs=require(_0xc1c0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1c0('0x11'));var logger=require(_0xc1c0('0x12'))(_0xc1c0('0x13'));var utils=require(_0xc1c0('0x14'));var config=require(_0xc1c0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12f62b,_0x5246f7){_0x5246f7=_0x5246f7||0xcc;return function(_0x39fc11){if(_0x39fc11){return _0x12f62b['sendStatus'](_0x5246f7);}return _0x12f62b[_0xc1c0('0x16')](_0x5246f7)[_0xc1c0('0x17')]();};}function respondWithResult(_0x2e7b54,_0x53afc4){_0x53afc4=_0x53afc4||0xc8;return function(_0x4ff2e7){if(_0x4ff2e7){return _0x2e7b54[_0xc1c0('0x16')](_0x53afc4)[_0xc1c0('0x18')](_0x4ff2e7);}};}function respondWithFilteredResult(_0x3b8567,_0x3fe550){return function(_0x53794b){if(_0x53794b){var _0x5ecb6a=_0x53794b[_0xc1c0('0x19')],_0x4ccf0e=_0x3fe550[_0xc1c0('0x1a')],_0x2cdffc=_0x3fe550[_0xc1c0('0x1a')]+_0x3fe550[_0xc1c0('0x1b')],_0x53833b;if(_0x2cdffc>=_0x5ecb6a){_0x2cdffc=_0x5ecb6a;_0x53833b=0xc8;}else{_0x53833b=0xce;}_0x3b8567[_0xc1c0('0x16')](_0x53833b);return _0x3b8567[_0xc1c0('0x1c')](_0xc1c0('0x1d'),_0x4ccf0e+'-'+_0x2cdffc+'/'+_0x5ecb6a)[_0xc1c0('0x18')](_0x53794b);}return null;};}function patchUpdates(_0x278f0f){return function(_0x21d18a){try{jsonpatch[_0xc1c0('0x1e')](_0x21d18a,_0x278f0f,!![]);}catch(_0x39877e){return BPromise[_0xc1c0('0x1f')](_0x39877e);}return _0x21d18a['save']();};}function saveUpdates(_0x227a35,_0x593b82){return function(_0x2296a1){if(_0x2296a1){return _0x2296a1[_0xc1c0('0x20')](_0x227a35)[_0xc1c0('0x21')](function(_0x410262){return _0x410262;});}return null;};}function removeEntity(_0x53366e,_0xae1da0){return function(_0x42f7ed){if(_0x42f7ed){return _0x42f7ed[_0xc1c0('0x22')]()[_0xc1c0('0x21')](function(){_0x53366e['status'](0xcc)[_0xc1c0('0x17')]();});}};}function handleEntityNotFound(_0x23264f,_0x67aefd){return function(_0x3bef15){if(!_0x3bef15){_0x23264f[_0xc1c0('0x23')](0x194);}return _0x3bef15;};}function handleError(_0x779539,_0x2df421){_0x2df421=_0x2df421||0x1f4;return function(_0x1dd069){logger[_0xc1c0('0x24')](_0x1dd069[_0xc1c0('0x25')]);if(_0x1dd069[_0xc1c0('0x26')]){delete _0x1dd069[_0xc1c0('0x26')];}_0x779539[_0xc1c0('0x16')](_0x2df421)[_0xc1c0('0x27')](_0x1dd069);};}exports['index']=function(_0x101cb1,_0x264e5e){var _0x3a8fa9={},_0x8f91d7={},_0x1670e3={'count':0x0,'rows':[]};var _0x89e6e1=_[_0xc1c0('0x28')](db[_0xc1c0('0x29')]['rawAttributes'],function(_0x43d37d){return{'name':_0x43d37d[_0xc1c0('0x2a')],'type':_0x43d37d[_0xc1c0('0x2b')]['key']};});_0x8f91d7[_0xc1c0('0x2c')]=_[_0xc1c0('0x28')](_0x89e6e1,_0xc1c0('0x26'));_0x8f91d7[_0xc1c0('0x2d')]=_['keys'](_0x101cb1[_0xc1c0('0x2d')]);_0x8f91d7[_0xc1c0('0x2e')]=_['intersection'](_0x8f91d7[_0xc1c0('0x2c')],_0x8f91d7['query']);_0x3a8fa9[_0xc1c0('0x2f')]=_[_0xc1c0('0x30')](_0x8f91d7[_0xc1c0('0x2c')],qs[_0xc1c0('0x31')](_0x101cb1[_0xc1c0('0x2d')][_0xc1c0('0x31')]));_0x3a8fa9[_0xc1c0('0x2f')]=_0x3a8fa9['attributes'][_0xc1c0('0x32')]?_0x3a8fa9[_0xc1c0('0x2f')]:_0x8f91d7[_0xc1c0('0x2c')];if(!_0x101cb1[_0xc1c0('0x2d')][_0xc1c0('0x33')]('nolimit')){_0x3a8fa9[_0xc1c0('0x1b')]=qs['limit'](_0x101cb1['query'][_0xc1c0('0x1b')]);_0x3a8fa9[_0xc1c0('0x1a')]=qs[_0xc1c0('0x1a')](_0x101cb1[_0xc1c0('0x2d')][_0xc1c0('0x1a')]);}_0x3a8fa9[_0xc1c0('0x34')]=qs[_0xc1c0('0x35')](_0x101cb1[_0xc1c0('0x2d')][_0xc1c0('0x35')]);_0x3a8fa9[_0xc1c0('0x36')]=qs[_0xc1c0('0x2e')](_[_0xc1c0('0x37')](_0x101cb1[_0xc1c0('0x2d')],_0x8f91d7['filters']),_0x89e6e1);if(_0x101cb1['query'][_0xc1c0('0x38')]){_0x3a8fa9[_0xc1c0('0x36')]=_[_0xc1c0('0x39')](_0x3a8fa9['where'],{'$or':_[_0xc1c0('0x28')](_0x89e6e1,function(_0x42e509){if(_0x42e509[_0xc1c0('0x2b')]!==_0xc1c0('0x3a')){var _0x202936={};_0x202936[_0x42e509[_0xc1c0('0x26')]]={'$like':'%'+_0x101cb1[_0xc1c0('0x2d')]['filter']+'%'};return _0x202936;}})});}_0x3a8fa9=_[_0xc1c0('0x39')]({},_0x3a8fa9,_0x101cb1[_0xc1c0('0x3b')]);var _0x190545={'where':_0x3a8fa9[_0xc1c0('0x36')]};return db[_0xc1c0('0x29')][_0xc1c0('0x19')](_0x190545)[_0xc1c0('0x21')](function(_0x5ce49b){_0x1670e3[_0xc1c0('0x19')]=_0x5ce49b;if(_0x101cb1[_0xc1c0('0x2d')][_0xc1c0('0x3c')]){_0x3a8fa9[_0xc1c0('0x3d')]=[{'all':!![]}];}return db['SugarcrmField'][_0xc1c0('0x3e')](_0x3a8fa9);})[_0xc1c0('0x21')](function(_0x1152dc){_0x1670e3[_0xc1c0('0x3f')]=_0x1152dc;return _0x1670e3;})[_0xc1c0('0x21')](respondWithFilteredResult(_0x264e5e,_0x3a8fa9))[_0xc1c0('0x40')](handleError(_0x264e5e,null));};exports[_0xc1c0('0x41')]=function(_0x814afc,_0xca60b1){var _0x467e91={'raw':!![],'where':{'id':_0x814afc[_0xc1c0('0x42')]['id']}},_0x2d7cbd={};_0x2d7cbd['model']=_[_0xc1c0('0x43')](db[_0xc1c0('0x29')][_0xc1c0('0x44')]);_0x2d7cbd[_0xc1c0('0x2d')]=_[_0xc1c0('0x43')](_0x814afc['query']);_0x2d7cbd[_0xc1c0('0x2e')]=_[_0xc1c0('0x30')](_0x2d7cbd[_0xc1c0('0x2c')],_0x2d7cbd['query']);_0x467e91['attributes']=_[_0xc1c0('0x30')](_0x2d7cbd[_0xc1c0('0x2c')],qs[_0xc1c0('0x31')](_0x814afc['query']['fields']));_0x467e91['attributes']=_0x467e91[_0xc1c0('0x2f')][_0xc1c0('0x32')]?_0x467e91[_0xc1c0('0x2f')]:_0x2d7cbd['model'];if(_0x814afc[_0xc1c0('0x2d')]['includeAll']){_0x467e91[_0xc1c0('0x3d')]=[{'all':!![]}];}_0x467e91=_[_0xc1c0('0x39')]({},_0x467e91,_0x814afc[_0xc1c0('0x3b')]);return db[_0xc1c0('0x29')]['find'](_0x467e91)[_0xc1c0('0x21')](handleEntityNotFound(_0xca60b1,null))['then'](respondWithResult(_0xca60b1,null))[_0xc1c0('0x40')](handleError(_0xca60b1,null));};exports['create']=function(_0x5b6b61,_0x225f51){return db['SugarcrmField'][_0xc1c0('0x45')](_0x5b6b61[_0xc1c0('0x46')],{})['then'](respondWithResult(_0x225f51,0xc9))[_0xc1c0('0x40')](handleError(_0x225f51,null));};exports[_0xc1c0('0x20')]=function(_0x3d09b5,_0x567cf3){if(_0x3d09b5[_0xc1c0('0x46')]['id']){delete _0x3d09b5[_0xc1c0('0x46')]['id'];}return db[_0xc1c0('0x29')][_0xc1c0('0x47')]({'where':{'id':_0x3d09b5[_0xc1c0('0x42')]['id']}})[_0xc1c0('0x21')](handleEntityNotFound(_0x567cf3,null))[_0xc1c0('0x21')](saveUpdates(_0x3d09b5[_0xc1c0('0x46')],null))[_0xc1c0('0x21')](respondWithResult(_0x567cf3,null))[_0xc1c0('0x40')](handleError(_0x567cf3,null));};exports[_0xc1c0('0x22')]=function(_0x87d258,_0xae024){return db[_0xc1c0('0x29')][_0xc1c0('0x47')]({'where':{'id':_0x87d258[_0xc1c0('0x42')]['id']}})['then'](handleEntityNotFound(_0xae024,null))[_0xc1c0('0x21')](removeEntity(_0xae024,null))[_0xc1c0('0x40')](handleError(_0xae024,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index feadd00..4be2b56 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 _0x9d11=['request-promise','../../config/environment','define','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0x9d11,0x19a));var _0x19d1=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0x9d11[_0x20ebb5];return _0x487182;};'use strict';var _=require(_0x19d1('0x0'));var util=require('util');var logger=require(_0x19d1('0x1'))(_0x19d1('0x2'));var moment=require(_0x19d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x19d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x19d1('0x5'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x3ebc98,_0x5dcf89){return _0x3ebc98[_0x19d1('0x6')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x19d1('0x7'),_0x19d1('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0224=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x315878,_0x502f7e){var _0x4f4148=function(_0x13387e){while(--_0x13387e){_0x315878['push'](_0x315878['shift']());}};_0x4f4148(++_0x502f7e);}(_0x0224,0x1ee));var _0x4022=function(_0x2a1338,_0x29f7aa){_0x2a1338=_0x2a1338-0x0;var _0xc02469=_0x0224[_0x2a1338];return _0xc02469;};'use strict';var _=require(_0x4022('0x0'));var util=require(_0x4022('0x1'));var logger=require(_0x4022('0x2'))(_0x4022('0x3'));var moment=require(_0x4022('0x4'));var BPromise=require(_0x4022('0x5'));var rp=require(_0x4022('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4022('0x7'));var config=require(_0x4022('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0x4022('0x9')]=function(_0x4d379b,_0x5ebdf0){return _0x4d379b['define'](_0x4022('0xa'),attributes,{'tableName':_0x4022('0xb'),'paranoid':![],'indexes':[{'name':_0x4022('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 1e9500e..b29d9a3 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x255840,_0x411b6e){var _0x40dad5=function(_0x258d8d){while(--_0x258d8d){_0x255840['push'](_0x255840['shift']());}};_0x40dad5(++_0x411b6e);}(_0xda2d,0x102));var _0xdda2=function(_0x13b848,_0x5bfb6b){_0x13b848=_0x13b848-0x0;var _0x587d77=_0xda2d[_0x13b848];return _0x587d77;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x4f1498,_0x1bb62d){var _0x534891=function(_0x467c10){while(--_0x467c10){_0x4f1498['push'](_0x4f1498['shift']());}};_0x534891(++_0x1bb62d);}(_0x1a85,0x178));var _0x51a8=function(_0x488818,_0x17c6de){_0x488818=_0x488818-0x0;var _0x30783c=_0x1a85[_0x488818];return _0x30783c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 8ca6083..07b9288 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 _0xc21a=['index','get','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated'];(function(_0x38d2a5,_0x3e4915){var _0x4d0941=function(_0x20f1f3){while(--_0x20f1f3){_0x38d2a5['push'](_0x38d2a5['shift']());}};_0x4d0941(++_0x3e4915);}(_0xc21a,0x1b0));var _0xac21=function(_0x48c38b,_0x978045){_0x48c38b=_0x48c38b-0x0;var _0x47cefd=_0xc21a[_0x48c38b];return _0x47cefd;};'use strict';var multer=require(_0xac21('0x0'));var util=require('util');var path=require(_0xac21('0x1'));var timeout=require(_0xac21('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xac21('0x3'));var interaction=require(_0xac21('0x4'));var config=require(_0xac21('0x5'));var controller=require(_0xac21('0x6'));router['get']('/',auth[_0xac21('0x7')](),controller[_0xac21('0x8')]);router[_0xac21('0x9')](_0xac21('0xa'),auth[_0xac21('0x7')](),controller[_0xac21('0xb')]);router[_0xac21('0x9')](_0xac21('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xac21('0x9')](_0xac21('0xd'),auth[_0xac21('0x7')](),controller['getFields']);router[_0xac21('0xe')]('/',auth[_0xac21('0x7')](),controller[_0xac21('0xf')]);router[_0xac21('0xe')](_0xac21('0xc'),auth['isAuthenticated'](),controller[_0xac21('0x10')]);router['put'](_0xac21('0xa'),auth[_0xac21('0x7')](),controller[_0xac21('0x11')]);router[_0xac21('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xac21('0x13')]=router; \ No newline at end of file +var _0x2f33=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','/:id','update','delete','destroy'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2f33,0x109));var _0x32f3=function(_0x22b7ad,_0x5a93f8){_0x22b7ad=_0x22b7ad-0x0;var _0x1a526a=_0x2f33[_0x22b7ad];return _0x1a526a;};'use strict';var multer=require(_0x32f3('0x0'));var util=require(_0x32f3('0x1'));var path=require(_0x32f3('0x2'));var timeout=require(_0x32f3('0x3'));var express=require(_0x32f3('0x4'));var router=express['Router']();var auth=require(_0x32f3('0x5'));var interaction=require(_0x32f3('0x6'));var config=require(_0x32f3('0x7'));var controller=require('./intVtigerAccount.controller');router[_0x32f3('0x8')]('/',auth[_0x32f3('0x9')](),controller[_0x32f3('0xa')]);router['get']('/:id',auth[_0x32f3('0x9')](),controller['show']);router[_0x32f3('0x8')](_0x32f3('0xb'),auth[_0x32f3('0x9')](),controller[_0x32f3('0xc')]);router[_0x32f3('0x8')](_0x32f3('0xd'),auth[_0x32f3('0x9')](),controller['getFields']);router['post']('/',auth[_0x32f3('0x9')](),controller['create']);router[_0x32f3('0xe')](_0x32f3('0xb'),auth['isAuthenticated'](),controller[_0x32f3('0xf')]);router[_0x32f3('0x10')](_0x32f3('0x11'),auth['isAuthenticated'](),controller[_0x32f3('0x12')]);router[_0x32f3('0x13')](_0x32f3('0x11'),auth[_0x32f3('0x9')](),controller[_0x32f3('0x14')]);module[_0x32f3('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index d52099f..1c9f180 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 _0x547f=['STRING','HelpDesk','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x547f,0x1be));var _0xf547=function(_0x486359,_0x3aa5e6){_0x486359=_0x486359-0x0;var _0x598887=_0x547f[_0x486359];return _0x598887;};'use strict';var Sequelize=require(_0xf547('0x0'));module[_0xf547('0x1')]={'name':{'type':Sequelize[_0xf547('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf547('0x2')]},'username':{'type':Sequelize[_0xf547('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf547('0x2')],'allowNull':![],'defaultValue':_0xf547('0x3')},'remoteUri':{'type':Sequelize[_0xf547('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf547('0x2')]},'accessKey':{'type':Sequelize[_0xf547('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0b68=['exports','STRING','HelpDesk'];(function(_0x16d004,_0x4d0ce7){var _0x28aa7a=function(_0x4882e8){while(--_0x4882e8){_0x16d004['push'](_0x16d004['shift']());}};_0x28aa7a(++_0x4d0ce7);}(_0x0b68,0x147));var _0x80b6=function(_0x2813fd,_0x3136ad){_0x2813fd=_0x2813fd-0x0;var _0x4f0cd9=_0x0b68[_0x2813fd];return _0x4f0cd9;};'use strict';var Sequelize=require('sequelize');module[_0x80b6('0x0')]={'name':{'type':Sequelize[_0x80b6('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x80b6('0x1')]},'username':{'type':Sequelize[_0x80b6('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x80b6('0x1')],'allowNull':![],'defaultValue':_0x80b6('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x80b6('0x1')]},'accessKey':{'type':Sequelize[_0x80b6('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 9119b05..0a720d7 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 _0xffcc=['where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','create','VtigerField','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','format','%s/webservice.php','GET','getchallenge','POST','login','token','success','result','sessionName','autogenerated','reference','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xffcc,0x147));var _0xcffc=function(_0x212a70,_0x4f289e){_0x212a70=_0x212a70-0x0;var _0x48ae7c=_0xffcc[_0x212a70];return _0x48ae7c;};'use strict';var pdf=require(_0xcffc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcffc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcffc('0x2'));var rp=require(_0xcffc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcffc('0x4'));var util=require(_0xcffc('0x5'));var path=require(_0xcffc('0x6'));var sox=require(_0xcffc('0x7'));var csv=require(_0xcffc('0x8'));var ejs=require(_0xcffc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcffc('0xa'));var jsforce=require(_0xcffc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcffc('0xc'));var Papa=require(_0xcffc('0xd'));var Redis=require(_0xcffc('0xe'));var authService=require(_0xcffc('0xf'));var qs=require(_0xcffc('0x10'));var as=require(_0xcffc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcffc('0x12'))('api');var utils=require(_0xcffc('0x13'));var config=require(_0xcffc('0x14'));var db=require(_0xcffc('0x15'))['db'];var integrations=require(_0xcffc('0x16'));var jayson=require(_0xcffc('0x17'));var client=jayson[_0xcffc('0x18')][_0xcffc('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4afd07,_0x452c53,_0x5cb199){if(_0x5cb199){var _0x2aea39=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2aea39[_0xcffc('0x1a')](_0x452c53)){return _0x4afd07;}else{throw new db['Sequelize']['ValidationError'](_0xcffc('0x1b'));}}else{return _0x4afd07;}}function respondWithRpcPromise(_0x2d613e,_0x5a9cb3,_0x4e2700,_0x5dc71b){return new BPromise(function(_0x201e23,_0x2d724b){var _0x3437f1=_0x5dc71b||client;return _0x3437f1[_0xcffc('0x1c')](_0x2d613e,_0x4e2700)[_0xcffc('0x1d')](function(_0x2cd0b7){logger[_0xcffc('0x1e')](_0xcffc('0x1f'),_0x5a9cb3,_0xcffc('0x20'));logger[_0xcffc('0x21')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x5a9cb3,_0xcffc('0x20'),JSON[_0xcffc('0x22')](_0x2cd0b7));if(_0x2cd0b7[_0xcffc('0x23')]){if(_0x2cd0b7['error']['code']===0x1f4){logger[_0xcffc('0x23')](_0xcffc('0x1f'),_0x5a9cb3,_0x2cd0b7['error'][_0xcffc('0x24')]);return _0x2d724b(_0x2cd0b7['error'][_0xcffc('0x24')]);}logger[_0xcffc('0x23')](_0xcffc('0x1f'),_0x5a9cb3,_0x2cd0b7[_0xcffc('0x23')][_0xcffc('0x24')]);return _0x201e23(_0x2cd0b7[_0xcffc('0x23')][_0xcffc('0x24')]);}else{logger['info'](_0xcffc('0x1f'),_0x5a9cb3,_0xcffc('0x20'));_0x201e23(_0x2cd0b7['result'][_0xcffc('0x24')]);}})[_0xcffc('0x25')](function(_0x1dae91){logger[_0xcffc('0x23')](_0xcffc('0x1f'),_0x5a9cb3,_0x1dae91);_0x2d724b(_0x1dae91);});});}function respondWithStatusCode(_0xfe69c4,_0x318711){_0x318711=_0x318711||0xcc;return function(_0x3c5223){if(_0x3c5223){return _0xfe69c4['sendStatus'](_0x318711);}return _0xfe69c4['status'](_0x318711)['end']();};}function respondWithResult(_0x54bef1,_0x4a922f){_0x4a922f=_0x4a922f||0xc8;return function(_0x5a8fd5){if(_0x5a8fd5){return _0x54bef1[_0xcffc('0x26')](_0x4a922f)['json'](_0x5a8fd5);}};}function respondWithFilteredResult(_0x2496ea,_0x3cc16f){return function(_0x106903){if(_0x106903){var _0x223c6f=_0x106903[_0xcffc('0x27')],_0x2479a7=_0x3cc16f[_0xcffc('0x28')],_0x3fba22=_0x3cc16f['offset']+_0x3cc16f[_0xcffc('0x29')],_0x3dc8f1;if(_0x3fba22>=_0x223c6f){_0x3fba22=_0x223c6f;_0x3dc8f1=0xc8;}else{_0x3dc8f1=0xce;}_0x2496ea['status'](_0x3dc8f1);return _0x2496ea[_0xcffc('0x2a')](_0xcffc('0x2b'),_0x2479a7+'-'+_0x3fba22+'/'+_0x223c6f)[_0xcffc('0x2c')](_0x106903);}return null;};}function patchUpdates(_0x5e39c2){return function(_0x226835){try{jsonpatch[_0xcffc('0x2d')](_0x226835,_0x5e39c2,!![]);}catch(_0x3e00ed){return BPromise[_0xcffc('0x2e')](_0x3e00ed);}return _0x226835[_0xcffc('0x2f')]();};}function saveUpdates(_0x5d0cd8,_0x137662){return function(_0x320c13){if(_0x320c13){return _0x320c13[_0xcffc('0x30')](_0x5d0cd8)['then'](function(_0x435128){return _0x435128;});}return null;};}function removeEntity(_0x5cf9cf,_0x1c974d){return function(_0x3e96a2){if(_0x3e96a2){return _0x3e96a2[_0xcffc('0x31')]()['then'](function(){_0x5cf9cf[_0xcffc('0x26')](0xcc)[_0xcffc('0x32')]();});}};}function handleEntityNotFound(_0xd81784,_0x4ed928){return function(_0x297ac4){if(!_0x297ac4){_0xd81784[_0xcffc('0x33')](0x194);}return _0x297ac4;};}function handleError(_0x37c122,_0x3aae95){_0x3aae95=_0x3aae95||0x1f4;return function(_0x523cb7){logger[_0xcffc('0x23')](_0x523cb7[_0xcffc('0x34')]);if(_0x523cb7[_0xcffc('0x35')]){delete _0x523cb7[_0xcffc('0x35')];}_0x37c122[_0xcffc('0x26')](_0x3aae95)[_0xcffc('0x36')](_0x523cb7);};}exports[_0xcffc('0x37')]=function(_0x332e42,_0x4adf43){var _0x4b56c4={},_0x373db8={},_0x138cfd={'count':0x0,'rows':[]};var _0x1382fd=_[_0xcffc('0x38')](db[_0xcffc('0x39')][_0xcffc('0x3a')],function(_0x28f6c2){return{'name':_0x28f6c2[_0xcffc('0x3b')],'type':_0x28f6c2['type'][_0xcffc('0x3c')]};});_0x373db8['model']=_['map'](_0x1382fd,'name');_0x373db8[_0xcffc('0x3d')]=_[_0xcffc('0x3e')](_0x332e42[_0xcffc('0x3d')]);_0x373db8[_0xcffc('0x3f')]=_[_0xcffc('0x40')](_0x373db8['model'],_0x373db8[_0xcffc('0x3d')]);_0x4b56c4[_0xcffc('0x41')]=_[_0xcffc('0x40')](_0x373db8[_0xcffc('0x42')],qs[_0xcffc('0x43')](_0x332e42[_0xcffc('0x3d')]['fields']));_0x4b56c4[_0xcffc('0x41')]=_0x4b56c4[_0xcffc('0x41')][_0xcffc('0x44')]?_0x4b56c4['attributes']:_0x373db8[_0xcffc('0x42')];if(!_0x332e42[_0xcffc('0x3d')][_0xcffc('0x45')](_0xcffc('0x46'))){_0x4b56c4['limit']=qs[_0xcffc('0x29')](_0x332e42['query'][_0xcffc('0x29')]);_0x4b56c4[_0xcffc('0x28')]=qs[_0xcffc('0x28')](_0x332e42[_0xcffc('0x3d')][_0xcffc('0x28')]);}_0x4b56c4[_0xcffc('0x47')]=qs['sort'](_0x332e42[_0xcffc('0x3d')][_0xcffc('0x48')]);_0x4b56c4['where']=qs[_0xcffc('0x3f')](_[_0xcffc('0x49')](_0x332e42[_0xcffc('0x3d')],_0x373db8[_0xcffc('0x3f')]),_0x1382fd);if(_0x332e42[_0xcffc('0x3d')][_0xcffc('0x4a')]){_0x4b56c4[_0xcffc('0x4b')]=_[_0xcffc('0x4c')](_0x4b56c4[_0xcffc('0x4b')],{'$or':_[_0xcffc('0x38')](_0x1382fd,function(_0x3c3d88){if(_0x3c3d88[_0xcffc('0x4d')]!==_0xcffc('0x4e')){var _0x26b647={};_0x26b647[_0x3c3d88[_0xcffc('0x35')]]={'$like':'%'+_0x332e42['query'][_0xcffc('0x4a')]+'%'};return _0x26b647;}})});}_0x4b56c4=_[_0xcffc('0x4c')]({},_0x4b56c4,_0x332e42['options']);var _0xfca253={'where':_0x4b56c4[_0xcffc('0x4b')]};return db[_0xcffc('0x39')]['count'](_0xfca253)['then'](function(_0xd745c0){_0x138cfd[_0xcffc('0x27')]=_0xd745c0;if(_0x332e42['query'][_0xcffc('0x4f')]){_0x4b56c4[_0xcffc('0x50')]=[{'all':!![]}];}return db['VtigerAccount'][_0xcffc('0x51')](_0x4b56c4);})[_0xcffc('0x1d')](function(_0x223e85){_0x138cfd[_0xcffc('0x52')]=_0x223e85;return _0x138cfd;})[_0xcffc('0x1d')](respondWithFilteredResult(_0x4adf43,_0x4b56c4))[_0xcffc('0x25')](handleError(_0x4adf43,null));};exports[_0xcffc('0x53')]=function(_0x18aefa,_0x27e5de){var _0x1f470d={'raw':![],'where':{'id':_0x18aefa[_0xcffc('0x54')]['id']}},_0x310861={};_0x310861[_0xcffc('0x42')]=_['keys'](db[_0xcffc('0x39')][_0xcffc('0x3a')]);_0x310861['query']=_['keys'](_0x18aefa['query']);_0x310861[_0xcffc('0x3f')]=_[_0xcffc('0x40')](_0x310861['model'],_0x310861['query']);_0x1f470d[_0xcffc('0x41')]=_[_0xcffc('0x40')](_0x310861[_0xcffc('0x42')],qs[_0xcffc('0x43')](_0x18aefa[_0xcffc('0x3d')][_0xcffc('0x43')]));_0x1f470d[_0xcffc('0x41')]=_0x1f470d[_0xcffc('0x41')]['length']?_0x1f470d[_0xcffc('0x41')]:_0x310861[_0xcffc('0x42')];if(_0x18aefa[_0xcffc('0x3d')][_0xcffc('0x4f')]){_0x1f470d[_0xcffc('0x50')]=[{'all':!![]}];}_0x1f470d=_[_0xcffc('0x4c')]({},_0x1f470d,_0x18aefa[_0xcffc('0x55')]);return db[_0xcffc('0x39')][_0xcffc('0x56')](_0x1f470d)[_0xcffc('0x1d')](handleEntityNotFound(_0x27e5de,null))[_0xcffc('0x1d')](respondWithResult(_0x27e5de,null))[_0xcffc('0x25')](handleError(_0x27e5de,null));};exports['create']=function(_0x1fd5b5,_0x572534){return db[_0xcffc('0x39')]['create'](_0x1fd5b5[_0xcffc('0x57')],{})[_0xcffc('0x1d')](respondWithResult(_0x572534,0xc9))['catch'](handleError(_0x572534,null));};exports[_0xcffc('0x30')]=function(_0x4ed807,_0x47dd8d){if(_0x4ed807[_0xcffc('0x57')]['id']){delete _0x4ed807[_0xcffc('0x57')]['id'];}return db[_0xcffc('0x39')][_0xcffc('0x56')]({'where':{'id':_0x4ed807[_0xcffc('0x54')]['id']}})[_0xcffc('0x1d')](handleEntityNotFound(_0x47dd8d,null))['then'](saveUpdates(_0x4ed807[_0xcffc('0x57')],null))[_0xcffc('0x1d')](respondWithResult(_0x47dd8d,null))['catch'](handleError(_0x47dd8d,null));};exports[_0xcffc('0x31')]=function(_0x332081,_0x12f30c){return db[_0xcffc('0x39')][_0xcffc('0x56')]({'where':{'id':_0x332081[_0xcffc('0x54')]['id']}})[_0xcffc('0x1d')](handleEntityNotFound(_0x12f30c,null))[_0xcffc('0x1d')](removeEntity(_0x12f30c,null))[_0xcffc('0x25')](handleError(_0x12f30c,null));};exports[_0xcffc('0x58')]=function(_0x2d6a7e,_0x1c2065,_0x5c929a){var _0x2a710f={};var _0x1aad70={};var _0x1e510c;var _0x8ec63a;return db[_0xcffc('0x39')]['findOne']({'where':{'id':_0x2d6a7e[_0xcffc('0x54')]['id']}})[_0xcffc('0x1d')](handleEntityNotFound(_0x1c2065,null))[_0xcffc('0x1d')](function(_0x3faf20){if(_0x3faf20){_0x1e510c=_0x3faf20;_0x1aad70[_0xcffc('0x42')]=_[_0xcffc('0x3e')](db['VtigerConfiguration'][_0xcffc('0x3a')]);_0x1aad70[_0xcffc('0x3d')]=_['keys'](_0x2d6a7e[_0xcffc('0x3d')]);_0x1aad70[_0xcffc('0x3f')]=_[_0xcffc('0x40')](_0x1aad70['model'],_0x1aad70['query']);_0x2a710f['attributes']=_[_0xcffc('0x40')](_0x1aad70[_0xcffc('0x42')],qs['fields'](_0x2d6a7e['query'][_0xcffc('0x43')]));_0x2a710f[_0xcffc('0x41')]=_0x2a710f['attributes'][_0xcffc('0x44')]?_0x2a710f['attributes']:_0x1aad70[_0xcffc('0x42')];_0x2a710f[_0xcffc('0x47')]=qs['sort'](_0x2d6a7e[_0xcffc('0x3d')]['sort']);_0x2a710f['where']=qs[_0xcffc('0x3f')](_[_0xcffc('0x49')](_0x2d6a7e['query'],_0x1aad70[_0xcffc('0x3f')]));if(_0x2d6a7e[_0xcffc('0x3d')][_0xcffc('0x4a')]){_0x2a710f[_0xcffc('0x4b')]=_[_0xcffc('0x4c')](_0x2a710f[_0xcffc('0x4b')],{'$or':_[_0xcffc('0x38')](_0x2a710f[_0xcffc('0x41')],function(_0x52e050){var _0x3fdda5={};_0x3fdda5[_0x52e050]={'$like':'%'+_0x2d6a7e['query'][_0xcffc('0x4a')]+'%'};return _0x3fdda5;})});}_0x2a710f=_['merge']({},_0x2a710f,_0x2d6a7e[_0xcffc('0x55')]);return _0x1e510c[_0xcffc('0x58')](_0x2a710f);}})['then'](function(_0x5c3f72){if(_0x5c3f72){_0x8ec63a=_0x5c3f72[_0xcffc('0x44')];if(!_0x2d6a7e[_0xcffc('0x3d')]['hasOwnProperty'](_0xcffc('0x46'))){_0x2a710f['limit']=qs[_0xcffc('0x29')](_0x2d6a7e[_0xcffc('0x3d')][_0xcffc('0x29')]);_0x2a710f[_0xcffc('0x28')]=qs['offset'](_0x2d6a7e[_0xcffc('0x3d')][_0xcffc('0x28')]);}return _0x1e510c[_0xcffc('0x58')](_0x2a710f);}})[_0xcffc('0x1d')](function(_0x388a01){if(_0x388a01){return _0x388a01?{'count':_0x8ec63a,'rows':_0x388a01}:null;}})[_0xcffc('0x1d')](respondWithResult(_0x1c2065,null))[_0xcffc('0x25')](handleError(_0x1c2065,null));};exports[_0xcffc('0x59')]=function(_0x16093c,_0x553558,_0x314fe3){if(_0x16093c[_0xcffc('0x57')]['id']){delete _0x16093c[_0xcffc('0x57')]['id'];}return db['VtigerAccount'][_0xcffc('0x5a')]({'where':{'id':_0x16093c['params']['id']}})[_0xcffc('0x1d')](handleEntityNotFound(_0x553558,null))[_0xcffc('0x1d')](function(_0x5c9a8b){if(_0x5c9a8b){_0x16093c[_0xcffc('0x57')][_0xcffc('0x5b')]=_0x5c9a8b['id'];_0x16093c[_0xcffc('0x57')][_0xcffc('0x5c')]=integrations['getSubjects'](_0x16093c[_0xcffc('0x57')][_0xcffc('0x5d')],_0x16093c[_0xcffc('0x57')][_0xcffc('0x4d')]);_0x16093c[_0xcffc('0x57')][_0xcffc('0x5e')]=integrations[_0xcffc('0x5f')](_0x16093c[_0xcffc('0x57')][_0xcffc('0x5d')],_0x16093c[_0xcffc('0x57')][_0xcffc('0x4d')]);return db[_0xcffc('0x60')][_0xcffc('0x61')](_0x16093c[_0xcffc('0x57')],{'include':[{'model':db[_0xcffc('0x62')],'as':_0xcffc('0x5c')},{'model':db['VtigerField'],'as':_0xcffc('0x5e')}]});}return null;})[_0xcffc('0x1d')](respondWithResult(_0x553558,null))[_0xcffc('0x25')](handleError(_0x553558,null));};var md5=require('md5');exports['getFields']=function(_0x178a7c,_0x4db6bb,_0x1551f9){var _0x40ca80=null;var _0x51527f=null;var _0x2f84ff=null;var _0xc11552=null;var _0xf45843='';return db[_0xcffc('0x39')][_0xcffc('0x5a')]({'where':{'id':_0x178a7c[_0xcffc('0x54')]['id']},'attributes':['id',_0xcffc('0x35'),_0xcffc('0x63'),_0xcffc('0x64'),'moduleName',_0xcffc('0x65'),_0xcffc('0x66'),_0xcffc('0x67')]})[_0xcffc('0x1d')](handleEntityNotFound(_0x4db6bb,null))[_0xcffc('0x1d')](function(_0x4f30af){if(_0x4f30af){_0x40ca80=_0x4f30af[_0xcffc('0x63')];_0x51527f=_0x4f30af[_0xcffc('0x67')];_0x2f84ff=_0x4f30af[_0xcffc('0x68')];_0xf45843=_0x4f30af[_0xcffc('0x65')];var _0x542ea3=_0xf45843[_0xcffc('0x69')](-0x1);if(_0x542ea3==='/'){_0xf45843=_0xf45843['substring'](0x0,_0xf45843['lastIndexOf'](_0x542ea3));}_0xc11552=util[_0xcffc('0x6a')](_0xcffc('0x6b'),_0xf45843);var _0x40598a={'method':_0xcffc('0x6c'),'uri':_0xc11552,'qs':{'operation':_0xcffc('0x6d'),'username':_0x4f30af['username']},'json':!![]};return rp(_0x40598a);}})[_0xcffc('0x1d')](function(_0x31930b){if(_0x31930b['success']){var _0x1331b1={'method':_0xcffc('0x6e'),'uri':_0xc11552,'form':{'operation':_0xcffc('0x6f'),'username':_0x40ca80,'accessKey':md5(_0x31930b['result'][_0xcffc('0x70')]+_0x51527f)},'json':!![]};return rp(_0x1331b1);}})[_0xcffc('0x1d')](function(_0x306c4b){if(_0x306c4b[_0xcffc('0x71')]){var _0x39dfc1={'method':_0xcffc('0x6c'),'uri':_0xc11552,'qs':{'operation':'describe','username':_0x40ca80,'sessionName':_0x306c4b[_0xcffc('0x72')][_0xcffc('0x73')],'elementType':_0x2f84ff},'json':!![]};return rp(_0x39dfc1);}})['then'](function(_0x30ea30){if(_0x30ea30['success']){var _0x524d47=[_0xcffc('0x74'),_0xcffc('0x75'),_0xcffc('0x76')];_[_0xcffc('0x77')](_0x30ea30['result']['fields'],function(_0x321ff5){return _0x524d47['includes'](_0x321ff5[_0xcffc('0x4d')][_0xcffc('0x35')]);});_['remove'](_0x30ea30[_0xcffc('0x72')][_0xcffc('0x43')],function(_0x4c0846){return _0x4c0846[_0xcffc('0x78')]===_0xcffc('0x79');});return{'count':_0x30ea30[_0xcffc('0x72')][_0xcffc('0x43')][_0xcffc('0x44')],'rows':_[_0xcffc('0x38')](_0x30ea30[_0xcffc('0x72')]['fields'],function(_0x2f8bb9){return{'id':_0x2f8bb9[_0xcffc('0x35')],'name':_0x2f8bb9[_0xcffc('0x7a')],'custom':_[_0xcffc('0x7b')](_0x2f8bb9[_0xcffc('0x35')],_0xcffc('0x7c'))?!![]:![],'options':_0x2f8bb9['type'][_0xcffc('0x35')]===_0xcffc('0x7d')&&_0x2f8bb9[_0xcffc('0x4d')]['picklistValues']['length']>0x0?_[_0xcffc('0x38')](_0x2f8bb9['type'][_0xcffc('0x7e')],function(_0xdc276f){return{'name':_0xdc276f[_0xcffc('0x7a')],'value':_0xdc276f[_0xcffc('0x7f')]};}):[]};})};}})[_0xcffc('0x1d')](respondWithResult(_0x4db6bb,null))[_0xcffc('0x25')](function(_0x799509){console[_0xcffc('0x80')](_0xcffc('0x81')+_0x799509);var _0x56034d=_0x178a7c['query'][_0xcffc('0x1a')]?0x1f4:_0x799509[_0xcffc('0x82')]||0x1f4;logger[_0xcffc('0x23')](_0xcffc('0x83'),_0xcffc('0x84'),_0x56034d,JSON[_0xcffc('0x22')](_0x799509));delete _0x799509[_0xcffc('0x35')];if(_0x56034d===0x191){_0x56034d=0x190;}_0x4db6bb['status'](_0x56034d)[_0xcffc('0x36')](_0x178a7c[_0xcffc('0x3d')][_0xcffc('0x1a')]?{'message':_0xcffc('0x85'),'statusCode':_0x799509['statusCode']}:_0x799509);});}; \ No newline at end of file +var _0x5f5c=['owner','remove','includes','editable','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../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~!@#$%^&-_=+[{]}.','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','VtigerAccount','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','VtigerField','getFields','username','description','moduleName','accessKey','remoteUri','slice','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','describe','sessionName','autogenerated','reference'];(function(_0x27c295,_0x9df280){var _0x33fb47=function(_0x3978b4){while(--_0x3978b4){_0x27c295['push'](_0x27c295['shift']());}};_0x33fb47(++_0x9df280);}(_0x5f5c,0x110));var _0xc5f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f5c[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xc5f5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc5f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5f5('0x2'));var rp=require(_0xc5f5('0x3'));var moment=require(_0xc5f5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc5f5('0x5'));var util=require(_0xc5f5('0x6'));var path=require(_0xc5f5('0x7'));var sox=require(_0xc5f5('0x8'));var csv=require(_0xc5f5('0x9'));var ejs=require(_0xc5f5('0xa'));var fs=require('fs');var _=require(_0xc5f5('0xb'));var squel=require(_0xc5f5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc5f5('0xd'));var toCsv=require(_0xc5f5('0x9'));var querystring=require(_0xc5f5('0xe'));var Papa=require(_0xc5f5('0xf'));var Redis=require(_0xc5f5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc5f5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5f5('0x12'))(_0xc5f5('0x13'));var utils=require('../../config/utils');var config=require(_0xc5f5('0x14'));var db=require(_0xc5f5('0x15'))['db'];var integrations=require(_0xc5f5('0x16'));var jayson=require('jayson/promise');var client=jayson[_0xc5f5('0x17')][_0xc5f5('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5d293e,_0x28494e,_0x546083){if(_0x546083){var _0xa4905d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa4905d[_0xc5f5('0x19')](_0x28494e)){return _0x5d293e;}else{throw new db[(_0xc5f5('0x1a'))][(_0xc5f5('0x1b'))](_0xc5f5('0x1c'));}}else{return _0x5d293e;}}function respondWithRpcPromise(_0x312937,_0x47bfd3,_0x3cc6a6,_0x3a2058){return new BPromise(function(_0x547c3a,_0x118f57){var _0x1c61b3=_0x3a2058||client;return _0x1c61b3[_0xc5f5('0x1d')](_0x312937,_0x3cc6a6)[_0xc5f5('0x1e')](function(_0x49a0bb){logger[_0xc5f5('0x1f')](_0xc5f5('0x20'),_0x47bfd3,'request\x20sent');logger[_0xc5f5('0x21')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x47bfd3,_0xc5f5('0x22'),JSON[_0xc5f5('0x23')](_0x49a0bb));if(_0x49a0bb[_0xc5f5('0x24')]){if(_0x49a0bb[_0xc5f5('0x24')]['code']===0x1f4){logger[_0xc5f5('0x24')](_0xc5f5('0x20'),_0x47bfd3,_0x49a0bb[_0xc5f5('0x24')][_0xc5f5('0x25')]);return _0x118f57(_0x49a0bb[_0xc5f5('0x24')][_0xc5f5('0x25')]);}logger[_0xc5f5('0x24')](_0xc5f5('0x20'),_0x47bfd3,_0x49a0bb[_0xc5f5('0x24')][_0xc5f5('0x25')]);return _0x547c3a(_0x49a0bb['error']['message']);}else{logger[_0xc5f5('0x1f')](_0xc5f5('0x20'),_0x47bfd3,_0xc5f5('0x22'));_0x547c3a(_0x49a0bb[_0xc5f5('0x26')]['message']);}})['catch'](function(_0x489796){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x47bfd3,_0x489796);_0x118f57(_0x489796);});});}function respondWithStatusCode(_0x2721de,_0x2f2c4d){_0x2f2c4d=_0x2f2c4d||0xcc;return function(_0x48ac47){if(_0x48ac47){return _0x2721de[_0xc5f5('0x27')](_0x2f2c4d);}return _0x2721de[_0xc5f5('0x28')](_0x2f2c4d)[_0xc5f5('0x29')]();};}function respondWithResult(_0x4593dd,_0x6e849b){_0x6e849b=_0x6e849b||0xc8;return function(_0x534d0d){if(_0x534d0d){return _0x4593dd[_0xc5f5('0x28')](_0x6e849b)[_0xc5f5('0x2a')](_0x534d0d);}};}function respondWithFilteredResult(_0x50b568,_0x2d96e9){return function(_0xc6f984){if(_0xc6f984){var _0x15ff17=_0xc6f984[_0xc5f5('0x2b')],_0x95da52=_0x2d96e9[_0xc5f5('0x2c')],_0x3405b5=_0x2d96e9[_0xc5f5('0x2c')]+_0x2d96e9['limit'],_0x26af92;if(_0x3405b5>=_0x15ff17){_0x3405b5=_0x15ff17;_0x26af92=0xc8;}else{_0x26af92=0xce;}_0x50b568['status'](_0x26af92);return _0x50b568[_0xc5f5('0x2d')](_0xc5f5('0x2e'),_0x95da52+'-'+_0x3405b5+'/'+_0x15ff17)[_0xc5f5('0x2a')](_0xc6f984);}return null;};}function patchUpdates(_0x590bdc){return function(_0x5b2dc9){try{jsonpatch[_0xc5f5('0x2f')](_0x5b2dc9,_0x590bdc,!![]);}catch(_0x687f8f){return BPromise[_0xc5f5('0x30')](_0x687f8f);}return _0x5b2dc9[_0xc5f5('0x31')]();};}function saveUpdates(_0x5e19d7,_0x4b707c){return function(_0x5e53ee){if(_0x5e53ee){return _0x5e53ee[_0xc5f5('0x32')](_0x5e19d7)[_0xc5f5('0x1e')](function(_0x313678){return _0x313678;});}return null;};}function removeEntity(_0x4e14fb,_0x97a8e4){return function(_0x265926){if(_0x265926){return _0x265926[_0xc5f5('0x33')]()[_0xc5f5('0x1e')](function(){_0x4e14fb[_0xc5f5('0x28')](0xcc)[_0xc5f5('0x29')]();});}};}function handleEntityNotFound(_0x5029bd,_0x38b952){return function(_0xad0ad6){if(!_0xad0ad6){_0x5029bd[_0xc5f5('0x27')](0x194);}return _0xad0ad6;};}function handleError(_0x7b1d67,_0x4ea2d2){_0x4ea2d2=_0x4ea2d2||0x1f4;return function(_0x4cfd47){logger[_0xc5f5('0x24')](_0x4cfd47['stack']);if(_0x4cfd47[_0xc5f5('0x34')]){delete _0x4cfd47[_0xc5f5('0x34')];}_0x7b1d67[_0xc5f5('0x28')](_0x4ea2d2)[_0xc5f5('0x35')](_0x4cfd47);};}exports[_0xc5f5('0x36')]=function(_0x3d95f3,_0x36d7ef){var _0x4ed5ee={},_0x5e3b7c={},_0x3f122a={'count':0x0,'rows':[]};var _0x3931cb=_[_0xc5f5('0x37')](db[_0xc5f5('0x38')]['rawAttributes'],function(_0x358b6f){return{'name':_0x358b6f['fieldName'],'type':_0x358b6f['type']['key']};});_0x5e3b7c[_0xc5f5('0x39')]=_['map'](_0x3931cb,'name');_0x5e3b7c[_0xc5f5('0x3a')]=_[_0xc5f5('0x3b')](_0x3d95f3[_0xc5f5('0x3a')]);_0x5e3b7c[_0xc5f5('0x3c')]=_[_0xc5f5('0x3d')](_0x5e3b7c[_0xc5f5('0x39')],_0x5e3b7c[_0xc5f5('0x3a')]);_0x4ed5ee[_0xc5f5('0x3e')]=_['intersection'](_0x5e3b7c[_0xc5f5('0x39')],qs[_0xc5f5('0x3f')](_0x3d95f3['query'][_0xc5f5('0x3f')]));_0x4ed5ee[_0xc5f5('0x3e')]=_0x4ed5ee[_0xc5f5('0x3e')][_0xc5f5('0x40')]?_0x4ed5ee[_0xc5f5('0x3e')]:_0x5e3b7c[_0xc5f5('0x39')];if(!_0x3d95f3[_0xc5f5('0x3a')][_0xc5f5('0x41')](_0xc5f5('0x42'))){_0x4ed5ee[_0xc5f5('0x43')]=qs['limit'](_0x3d95f3[_0xc5f5('0x3a')][_0xc5f5('0x43')]);_0x4ed5ee[_0xc5f5('0x2c')]=qs[_0xc5f5('0x2c')](_0x3d95f3[_0xc5f5('0x3a')][_0xc5f5('0x2c')]);}_0x4ed5ee[_0xc5f5('0x44')]=qs['sort'](_0x3d95f3[_0xc5f5('0x3a')][_0xc5f5('0x45')]);_0x4ed5ee[_0xc5f5('0x46')]=qs[_0xc5f5('0x3c')](_[_0xc5f5('0x47')](_0x3d95f3[_0xc5f5('0x3a')],_0x5e3b7c['filters']),_0x3931cb);if(_0x3d95f3[_0xc5f5('0x3a')][_0xc5f5('0x48')]){_0x4ed5ee[_0xc5f5('0x46')]=_[_0xc5f5('0x49')](_0x4ed5ee['where'],{'$or':_[_0xc5f5('0x37')](_0x3931cb,function(_0x1ec5a0){if(_0x1ec5a0[_0xc5f5('0x4a')]!==_0xc5f5('0x4b')){var _0x549a99={};_0x549a99[_0x1ec5a0[_0xc5f5('0x34')]]={'$like':'%'+_0x3d95f3['query'][_0xc5f5('0x48')]+'%'};return _0x549a99;}})});}_0x4ed5ee=_['merge']({},_0x4ed5ee,_0x3d95f3[_0xc5f5('0x4c')]);var _0x3d3d31={'where':_0x4ed5ee[_0xc5f5('0x46')]};return db[_0xc5f5('0x38')][_0xc5f5('0x2b')](_0x3d3d31)[_0xc5f5('0x1e')](function(_0xcb5cc3){_0x3f122a[_0xc5f5('0x2b')]=_0xcb5cc3;if(_0x3d95f3[_0xc5f5('0x3a')][_0xc5f5('0x4d')]){_0x4ed5ee[_0xc5f5('0x4e')]=[{'all':!![]}];}return db[_0xc5f5('0x38')][_0xc5f5('0x4f')](_0x4ed5ee);})[_0xc5f5('0x1e')](function(_0x3953ea){_0x3f122a[_0xc5f5('0x50')]=_0x3953ea;return _0x3f122a;})[_0xc5f5('0x1e')](respondWithFilteredResult(_0x36d7ef,_0x4ed5ee))[_0xc5f5('0x51')](handleError(_0x36d7ef,null));};exports[_0xc5f5('0x52')]=function(_0x2ddfce,_0x3a52be){var _0x560435={'raw':![],'where':{'id':_0x2ddfce[_0xc5f5('0x53')]['id']}},_0x53ed13={};_0x53ed13[_0xc5f5('0x39')]=_['keys'](db[_0xc5f5('0x38')][_0xc5f5('0x54')]);_0x53ed13[_0xc5f5('0x3a')]=_['keys'](_0x2ddfce['query']);_0x53ed13[_0xc5f5('0x3c')]=_['intersection'](_0x53ed13[_0xc5f5('0x39')],_0x53ed13['query']);_0x560435[_0xc5f5('0x3e')]=_[_0xc5f5('0x3d')](_0x53ed13['model'],qs[_0xc5f5('0x3f')](_0x2ddfce['query'][_0xc5f5('0x3f')]));_0x560435[_0xc5f5('0x3e')]=_0x560435[_0xc5f5('0x3e')][_0xc5f5('0x40')]?_0x560435[_0xc5f5('0x3e')]:_0x53ed13[_0xc5f5('0x39')];if(_0x2ddfce['query'][_0xc5f5('0x4d')]){_0x560435['include']=[{'all':!![]}];}_0x560435=_[_0xc5f5('0x49')]({},_0x560435,_0x2ddfce[_0xc5f5('0x4c')]);return db[_0xc5f5('0x38')]['find'](_0x560435)[_0xc5f5('0x1e')](handleEntityNotFound(_0x3a52be,null))[_0xc5f5('0x1e')](respondWithResult(_0x3a52be,null))[_0xc5f5('0x51')](handleError(_0x3a52be,null));};exports[_0xc5f5('0x55')]=function(_0x55e115,_0x352940){return db[_0xc5f5('0x38')][_0xc5f5('0x55')](_0x55e115['body'],{})[_0xc5f5('0x1e')](respondWithResult(_0x352940,0xc9))['catch'](handleError(_0x352940,null));};exports[_0xc5f5('0x32')]=function(_0x1623fe,_0x10173d){if(_0x1623fe[_0xc5f5('0x56')]['id']){delete _0x1623fe[_0xc5f5('0x56')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x1623fe[_0xc5f5('0x53')]['id']}})[_0xc5f5('0x1e')](handleEntityNotFound(_0x10173d,null))[_0xc5f5('0x1e')](saveUpdates(_0x1623fe['body'],null))['then'](respondWithResult(_0x10173d,null))[_0xc5f5('0x51')](handleError(_0x10173d,null));};exports[_0xc5f5('0x33')]=function(_0x811daa,_0xab3350){return db['VtigerAccount'][_0xc5f5('0x57')]({'where':{'id':_0x811daa[_0xc5f5('0x53')]['id']}})[_0xc5f5('0x1e')](handleEntityNotFound(_0xab3350,null))[_0xc5f5('0x1e')](removeEntity(_0xab3350,null))[_0xc5f5('0x51')](handleError(_0xab3350,null));};exports[_0xc5f5('0x58')]=function(_0x50b7cc,_0x58859f,_0x955e46){var _0x5bb09c={};var _0x492efa={};var _0x68917f;var _0x99d22c;return db[_0xc5f5('0x38')][_0xc5f5('0x59')]({'where':{'id':_0x50b7cc['params']['id']}})[_0xc5f5('0x1e')](handleEntityNotFound(_0x58859f,null))[_0xc5f5('0x1e')](function(_0x45a7e3){if(_0x45a7e3){_0x68917f=_0x45a7e3;_0x492efa[_0xc5f5('0x39')]=_[_0xc5f5('0x3b')](db[_0xc5f5('0x5a')][_0xc5f5('0x54')]);_0x492efa[_0xc5f5('0x3a')]=_[_0xc5f5('0x3b')](_0x50b7cc[_0xc5f5('0x3a')]);_0x492efa[_0xc5f5('0x3c')]=_['intersection'](_0x492efa['model'],_0x492efa[_0xc5f5('0x3a')]);_0x5bb09c[_0xc5f5('0x3e')]=_[_0xc5f5('0x3d')](_0x492efa[_0xc5f5('0x39')],qs[_0xc5f5('0x3f')](_0x50b7cc[_0xc5f5('0x3a')][_0xc5f5('0x3f')]));_0x5bb09c['attributes']=_0x5bb09c['attributes']['length']?_0x5bb09c[_0xc5f5('0x3e')]:_0x492efa[_0xc5f5('0x39')];_0x5bb09c[_0xc5f5('0x44')]=qs[_0xc5f5('0x45')](_0x50b7cc[_0xc5f5('0x3a')][_0xc5f5('0x45')]);_0x5bb09c['where']=qs[_0xc5f5('0x3c')](_['pick'](_0x50b7cc[_0xc5f5('0x3a')],_0x492efa[_0xc5f5('0x3c')]));if(_0x50b7cc[_0xc5f5('0x3a')]['filter']){_0x5bb09c['where']=_[_0xc5f5('0x49')](_0x5bb09c[_0xc5f5('0x46')],{'$or':_['map'](_0x5bb09c[_0xc5f5('0x3e')],function(_0xbdc44e){var _0x3fa641={};_0x3fa641[_0xbdc44e]={'$like':'%'+_0x50b7cc[_0xc5f5('0x3a')][_0xc5f5('0x48')]+'%'};return _0x3fa641;})});}_0x5bb09c=_[_0xc5f5('0x49')]({},_0x5bb09c,_0x50b7cc[_0xc5f5('0x4c')]);return _0x68917f[_0xc5f5('0x58')](_0x5bb09c);}})['then'](function(_0x3107df){if(_0x3107df){_0x99d22c=_0x3107df[_0xc5f5('0x40')];if(!_0x50b7cc['query'][_0xc5f5('0x41')](_0xc5f5('0x42'))){_0x5bb09c['limit']=qs[_0xc5f5('0x43')](_0x50b7cc[_0xc5f5('0x3a')][_0xc5f5('0x43')]);_0x5bb09c['offset']=qs[_0xc5f5('0x2c')](_0x50b7cc[_0xc5f5('0x3a')][_0xc5f5('0x2c')]);}return _0x68917f[_0xc5f5('0x58')](_0x5bb09c);}})[_0xc5f5('0x1e')](function(_0x14fd1a){if(_0x14fd1a){return _0x14fd1a?{'count':_0x99d22c,'rows':_0x14fd1a}:null;}})[_0xc5f5('0x1e')](respondWithResult(_0x58859f,null))[_0xc5f5('0x51')](handleError(_0x58859f,null));};exports['addConfiguration']=function(_0x3ea93a,_0x399e6a,_0x2d1503){if(_0x3ea93a[_0xc5f5('0x56')]['id']){delete _0x3ea93a[_0xc5f5('0x56')]['id'];}return db['VtigerAccount'][_0xc5f5('0x59')]({'where':{'id':_0x3ea93a[_0xc5f5('0x53')]['id']}})[_0xc5f5('0x1e')](handleEntityNotFound(_0x399e6a,null))[_0xc5f5('0x1e')](function(_0x26962d){if(_0x26962d){_0x3ea93a[_0xc5f5('0x56')][_0xc5f5('0x5b')]=_0x26962d['id'];_0x3ea93a[_0xc5f5('0x56')][_0xc5f5('0x5c')]=integrations['getSubjects'](_0x3ea93a[_0xc5f5('0x56')]['channel'],_0x3ea93a[_0xc5f5('0x56')][_0xc5f5('0x4a')]);_0x3ea93a['body'][_0xc5f5('0x5d')]=integrations[_0xc5f5('0x5e')](_0x3ea93a[_0xc5f5('0x56')][_0xc5f5('0x5f')],_0x3ea93a[_0xc5f5('0x56')][_0xc5f5('0x4a')]);return db[_0xc5f5('0x5a')][_0xc5f5('0x55')](_0x3ea93a[_0xc5f5('0x56')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xc5f5('0x60')],'as':_0xc5f5('0x5d')}]});}return null;})['then'](respondWithResult(_0x399e6a,null))['catch'](handleError(_0x399e6a,null));};var md5=require('md5');exports[_0xc5f5('0x61')]=function(_0x10132a,_0x2131b7,_0x482cb5){var _0x12ce49=null;var _0xb3dafb=null;var _0x76d071=null;var _0x12c975=null;var _0xe33284='';return db[_0xc5f5('0x38')][_0xc5f5('0x59')]({'where':{'id':_0x10132a[_0xc5f5('0x53')]['id']},'attributes':['id','name',_0xc5f5('0x62'),_0xc5f5('0x63'),_0xc5f5('0x64'),'remoteUri','serverUrl',_0xc5f5('0x65')]})[_0xc5f5('0x1e')](handleEntityNotFound(_0x2131b7,null))['then'](function(_0x444966){if(_0x444966){_0x12ce49=_0x444966[_0xc5f5('0x62')];_0xb3dafb=_0x444966[_0xc5f5('0x65')];_0x76d071=_0x444966[_0xc5f5('0x64')];_0xe33284=_0x444966[_0xc5f5('0x66')];var _0x31e9fd=_0xe33284[_0xc5f5('0x67')](-0x1);if(_0x31e9fd==='/'){_0xe33284=_0xe33284['substring'](0x0,_0xe33284[_0xc5f5('0x68')](_0x31e9fd));}_0x12c975=util[_0xc5f5('0x69')](_0xc5f5('0x6a'),_0xe33284);var _0x1302c8={'method':'GET','uri':_0x12c975,'qs':{'operation':_0xc5f5('0x6b'),'username':_0x444966[_0xc5f5('0x62')]},'json':!![]};return rp(_0x1302c8);}})[_0xc5f5('0x1e')](function(_0x3de9d0){if(_0x3de9d0[_0xc5f5('0x6c')]){var _0x5b5314={'method':_0xc5f5('0x6d'),'uri':_0x12c975,'form':{'operation':_0xc5f5('0x6e'),'username':_0x12ce49,'accessKey':md5(_0x3de9d0[_0xc5f5('0x26')]['token']+_0xb3dafb)},'json':!![]};return rp(_0x5b5314);}})[_0xc5f5('0x1e')](function(_0x274af8){if(_0x274af8[_0xc5f5('0x6c')]){var _0x42f1fc={'method':'GET','uri':_0x12c975,'qs':{'operation':_0xc5f5('0x6f'),'username':_0x12ce49,'sessionName':_0x274af8[_0xc5f5('0x26')][_0xc5f5('0x70')],'elementType':_0x76d071},'json':!![]};return rp(_0x42f1fc);}})[_0xc5f5('0x1e')](function(_0x551295){if(_0x551295[_0xc5f5('0x6c')]){var _0x2d5605=[_0xc5f5('0x71'),_0xc5f5('0x72'),_0xc5f5('0x73')];_[_0xc5f5('0x74')](_0x551295['result'][_0xc5f5('0x3f')],function(_0x2cb9ac){return _0x2d5605[_0xc5f5('0x75')](_0x2cb9ac[_0xc5f5('0x4a')]['name']);});_[_0xc5f5('0x74')](_0x551295[_0xc5f5('0x26')][_0xc5f5('0x3f')],function(_0x3bb96f){return _0x3bb96f[_0xc5f5('0x76')]==='false';});return{'count':_0x551295['result'][_0xc5f5('0x3f')][_0xc5f5('0x40')],'rows':_[_0xc5f5('0x37')](_0x551295['result'][_0xc5f5('0x3f')],function(_0x4a3353){return{'id':_0x4a3353[_0xc5f5('0x34')],'name':_0x4a3353[_0xc5f5('0x77')],'custom':_[_0xc5f5('0x78')](_0x4a3353['name'],'cf_')?!![]:![],'options':_0x4a3353['type'][_0xc5f5('0x34')]===_0xc5f5('0x79')&&_0x4a3353['type'][_0xc5f5('0x7a')][_0xc5f5('0x40')]>0x0?_[_0xc5f5('0x37')](_0x4a3353['type'][_0xc5f5('0x7a')],function(_0x17440b){return{'name':_0x17440b[_0xc5f5('0x77')],'value':_0x17440b[_0xc5f5('0x7b')]};}):[]};})};}})[_0xc5f5('0x1e')](respondWithResult(_0x2131b7,null))[_0xc5f5('0x51')](function(_0x46c8c4){console[_0xc5f5('0x7c')](_0xc5f5('0x7d')+_0x46c8c4);var _0x39a147=_0x10132a[_0xc5f5('0x3a')][_0xc5f5('0x19')]?0x1f4:_0x46c8c4[_0xc5f5('0x7e')]||0x1f4;logger[_0xc5f5('0x24')](_0xc5f5('0x7f'),_0xc5f5('0x61'),_0x39a147,JSON['stringify'](_0x46c8c4));delete _0x46c8c4[_0xc5f5('0x34')];if(_0x39a147===0x191){_0x39a147=0x190;}_0x2131b7['status'](_0x39a147)[_0xc5f5('0x35')](_0x10132a['query']['test']?{'message':_0xc5f5('0x80'),'statusCode':_0x46c8c4[_0xc5f5('0x7e')]}:_0x46c8c4);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 99b91d1..f94ef67 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 _0xab53=['../../components/integrations/configuration','define','int_vtiger_accounts','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./intVtigerAccount.attributes'];(function(_0x2e2549,_0x3f04da){var _0xf099ff=function(_0x34e06f){while(--_0x34e06f){_0x2e2549['push'](_0x2e2549['shift']());}};_0xf099ff(++_0x3f04da);}(_0xab53,0x193));var _0x3ab5=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xab53[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x3ab5('0x0'));var util=require('util');var logger=require(_0x3ab5('0x1'))('api');var moment=require(_0x3ab5('0x2'));var BPromise=require(_0x3ab5('0x3'));var rp=require(_0x3ab5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ab5('0x5'));var config=require('../../config/environment');var attributes=require(_0x3ab5('0x6'));var integrations=require(_0x3ab5('0x7'));module['exports']=function(_0x217ac8,_0x55a1d3){return _0x217ac8[_0x3ab5('0x8')]('VtigerAccount',attributes,{'tableName':_0x3ab5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ec=['define','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x1f191b,_0x3ed8a3){var _0x4000f3=function(_0x318141){while(--_0x318141){_0x1f191b['push'](_0x1f191b['shift']());}};_0x4000f3(++_0x3ed8a3);}(_0x55ec,0x1c9));var _0xc55e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x55ec[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xc55e('0x0'));var util=require(_0xc55e('0x1'));var logger=require(_0xc55e('0x2'))(_0xc55e('0x3'));var moment=require(_0xc55e('0x4'));var BPromise=require(_0xc55e('0x5'));var rp=require(_0xc55e('0x6'));var fs=require('fs');var path=require(_0xc55e('0x7'));var rimraf=require(_0xc55e('0x8'));var config=require(_0xc55e('0x9'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xc55e('0xa'));module['exports']=function(_0x42a51b,_0x56f796){return _0x42a51b[_0xc55e('0xb')]('VtigerAccount',attributes,{'tableName':_0xc55e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 6e699f8..2eab4d0 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 _0xa51b=['map','model','GetVtigerAccount','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','VtigerAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x441474,_0x3c518b){var _0x2ce240=function(_0x397ea3){while(--_0x397ea3){_0x441474['push'](_0x441474['shift']());}};_0x2ce240(++_0x3c518b);}(_0xa51b,0x73));var _0xba51=function(_0x3b14e4,_0x277d5c){_0x3b14e4=_0x3b14e4-0x0;var _0x3e8616=_0xa51b[_0x3b14e4];return _0x3e8616;};'use strict';var _=require(_0xba51('0x0'));var util=require(_0xba51('0x1'));var moment=require(_0xba51('0x2'));var BPromise=require(_0xba51('0x3'));var rs=require(_0xba51('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba51('0x5'))['db'];var utils=require(_0xba51('0x6'));var logger=require(_0xba51('0x7'))(_0xba51('0x8'));var config=require(_0xba51('0x9'));var jayson=require(_0xba51('0xa'));var client=jayson[_0xba51('0xb')][_0xba51('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33fc90,_0xd6ef3,_0x249e6e){return new BPromise(function(_0x2d22fa,_0xe6f7c7){return client[_0xba51('0xd')](_0x33fc90,_0x249e6e)[_0xba51('0xe')](function(_0x211677){logger[_0xba51('0xf')](_0xba51('0x10'),_0xd6ef3,'request\x20sent');logger[_0xba51('0x11')](_0xba51('0x12'),_0xd6ef3,'request\x20sent',JSON[_0xba51('0x13')](_0x211677));if(_0x211677['error']){if(_0x211677[_0xba51('0x14')]['code']===0x1f4){logger[_0xba51('0x14')](_0xba51('0x10'),_0xd6ef3,_0x211677[_0xba51('0x14')]['message']);return _0xe6f7c7(_0x211677[_0xba51('0x14')]['message']);}logger[_0xba51('0x14')](_0xba51('0x10'),_0xd6ef3,_0x211677[_0xba51('0x14')][_0xba51('0x15')]);return _0x2d22fa(_0x211677['error'][_0xba51('0x15')]);}else{logger[_0xba51('0xf')](_0xba51('0x10'),_0xd6ef3,_0xba51('0x16'));_0x2d22fa(_0x211677[_0xba51('0x17')]['message']);}})[_0xba51('0x18')](function(_0x525d76){logger[_0xba51('0x14')](_0xba51('0x10'),_0xd6ef3,_0x525d76);_0xe6f7c7(_0x525d76);});});}exports['GetVtigerAccount']=function(_0x4627cb){var _0x2731eb=this;return new Promise(function(_0x15f21a,_0x3aae76){return db[_0xba51('0x19')][_0xba51('0x1a')]({'raw':_0x4627cb[_0xba51('0x1b')]?_0x4627cb[_0xba51('0x1b')][_0xba51('0x1c')]===undefined?!![]:![]:!![],'where':_0x4627cb[_0xba51('0x1b')]?_0x4627cb[_0xba51('0x1b')][_0xba51('0x1d')]||null:null,'attributes':_0x4627cb[_0xba51('0x1b')]?_0x4627cb[_0xba51('0x1b')][_0xba51('0x1e')]||null:null,'limit':_0x4627cb['options']?_0x4627cb[_0xba51('0x1b')][_0xba51('0x1f')]||null:null,'include':_0x4627cb['options']?_0x4627cb[_0xba51('0x1b')][_0xba51('0x20')]?_[_0xba51('0x21')](_0x4627cb[_0xba51('0x1b')][_0xba51('0x20')],function(_0x2b85d3){return{'model':db[_0x2b85d3['model']],'as':_0x2b85d3['as'],'attributes':_0x2b85d3[_0xba51('0x1e')],'include':_0x2b85d3[_0xba51('0x20')]?_[_0xba51('0x21')](_0x2b85d3[_0xba51('0x20')],function(_0x264668){return{'model':db[_0x264668[_0xba51('0x22')]],'as':_0x264668['as'],'attributes':_0x264668[_0xba51('0x1e')],'include':_0x264668[_0xba51('0x20')]?_[_0xba51('0x21')](_0x264668[_0xba51('0x20')],function(_0x1af57d){return{'model':db[_0x1af57d[_0xba51('0x22')]],'as':_0x1af57d['as'],'attributes':_0x1af57d[_0xba51('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xba51('0xe')](function(_0x114a15){logger[_0xba51('0xf')](_0xba51('0x23'),_0x4627cb);logger[_0xba51('0x11')](_0xba51('0x23'),_0x4627cb,JSON['stringify'](_0x114a15));_0x15f21a(_0x114a15);})[_0xba51('0x18')](function(_0x341293){logger[_0xba51('0x14')](_0xba51('0x23'),_0x341293[_0xba51('0x15')],_0x4627cb);_0x3aae76(_0x2731eb[_0xba51('0x14')](0x1f4,_0x341293[_0xba51('0x15')]));});});};exports[_0xba51('0x24')]=function(_0x48bd58){var _0x4c10be=this;return new Promise(function(_0x2df366,_0x521c3c){return db[_0xba51('0x19')]['find']({'raw':_0x48bd58['options']?_0x48bd58['options'][_0xba51('0x1c')]===undefined?!![]:![]:!![],'where':_0x48bd58[_0xba51('0x1b')]?_0x48bd58[_0xba51('0x1b')][_0xba51('0x1d')]||null:null,'attributes':_0x48bd58[_0xba51('0x1b')]?_0x48bd58[_0xba51('0x1b')][_0xba51('0x1e')]||null:null,'include':_0x48bd58[_0xba51('0x1b')]?_0x48bd58[_0xba51('0x1b')][_0xba51('0x20')]?_[_0xba51('0x21')](_0x48bd58['options'][_0xba51('0x20')],function(_0x3ce27c){return{'model':db[_0x3ce27c[_0xba51('0x22')]],'as':_0x3ce27c['as'],'attributes':_0x3ce27c[_0xba51('0x1e')],'include':_0x3ce27c[_0xba51('0x20')]?_['map'](_0x3ce27c['include'],function(_0x364b9a){return{'model':db[_0x364b9a['model']],'as':_0x364b9a['as'],'attributes':_0x364b9a['attributes'],'include':_0x364b9a['include']?_[_0xba51('0x21')](_0x364b9a[_0xba51('0x20')],function(_0xdc787e){return{'model':db[_0xdc787e[_0xba51('0x22')]],'as':_0xdc787e['as'],'attributes':_0xdc787e[_0xba51('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xba51('0xe')](function(_0x354e08){logger[_0xba51('0xf')]('ShowVtigerAccount',_0x48bd58);logger[_0xba51('0x11')](_0xba51('0x24'),_0x48bd58,JSON[_0xba51('0x13')](_0x354e08));_0x2df366(_0x354e08);})[_0xba51('0x18')](function(_0x1765ab){logger[_0xba51('0x14')](_0xba51('0x24'),_0x1765ab[_0xba51('0x15')],_0x48bd58);_0x521c3c(_0x4c10be[_0xba51('0x14')](0x1f4,_0x1765ab[_0xba51('0x15')]));});});}; \ No newline at end of file +var _0x0e53=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options','attributes','limit','include','model','map','then','debug','raw','where','ShowVtigerAccount','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf9ede0,_0x4b6018){var _0x5c0553=function(_0x46439f){while(--_0x46439f){_0xf9ede0['push'](_0xf9ede0['shift']());}};_0x5c0553(++_0x4b6018);}(_0x0e53,0xc7));var _0x30e5=function(_0x30d012,_0x1493e8){_0x30d012=_0x30d012-0x0;var _0x1943ef=_0x0e53[_0x30d012];return _0x1943ef;};'use strict';var _=require('lodash');var util=require(_0x30e5('0x0'));var moment=require('moment');var BPromise=require(_0x30e5('0x1'));var rs=require(_0x30e5('0x2'));var fs=require('fs');var Redis=require(_0x30e5('0x3'));var db=require(_0x30e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x30e5('0x5'))(_0x30e5('0x6'));var config=require(_0x30e5('0x7'));var jayson=require(_0x30e5('0x8'));var client=jayson['client'][_0x30e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x224e81,_0x2b849a,_0x56f6d0){return new BPromise(function(_0x281899,_0x12403f){return client[_0x30e5('0xa')](_0x224e81,_0x56f6d0)['then'](function(_0x4986d6){logger[_0x30e5('0xb')](_0x30e5('0xc'),_0x2b849a,_0x30e5('0xd'));logger['debug'](_0x30e5('0xe'),_0x2b849a,_0x30e5('0xd'),JSON[_0x30e5('0xf')](_0x4986d6));if(_0x4986d6[_0x30e5('0x10')]){if(_0x4986d6[_0x30e5('0x10')][_0x30e5('0x11')]===0x1f4){logger[_0x30e5('0x10')](_0x30e5('0xc'),_0x2b849a,_0x4986d6[_0x30e5('0x10')][_0x30e5('0x12')]);return _0x12403f(_0x4986d6[_0x30e5('0x10')][_0x30e5('0x12')]);}logger[_0x30e5('0x10')](_0x30e5('0xc'),_0x2b849a,_0x4986d6['error']['message']);return _0x281899(_0x4986d6['error']['message']);}else{logger[_0x30e5('0xb')](_0x30e5('0xc'),_0x2b849a,_0x30e5('0xd'));_0x281899(_0x4986d6[_0x30e5('0x13')][_0x30e5('0x12')]);}})[_0x30e5('0x14')](function(_0x55d83b){logger[_0x30e5('0x10')](_0x30e5('0xc'),_0x2b849a,_0x55d83b);_0x12403f(_0x55d83b);});});}exports[_0x30e5('0x15')]=function(_0x27002e){var _0x3d9e9b=this;return new Promise(function(_0x5d5b27,_0x4aac21){return db[_0x30e5('0x16')]['findAll']({'raw':_0x27002e['options']?_0x27002e[_0x30e5('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x27002e[_0x30e5('0x17')]?_0x27002e[_0x30e5('0x17')]['where']||null:null,'attributes':_0x27002e[_0x30e5('0x17')]?_0x27002e['options'][_0x30e5('0x18')]||null:null,'limit':_0x27002e[_0x30e5('0x17')]?_0x27002e[_0x30e5('0x17')][_0x30e5('0x19')]||null:null,'include':_0x27002e[_0x30e5('0x17')]?_0x27002e[_0x30e5('0x17')][_0x30e5('0x1a')]?_['map'](_0x27002e[_0x30e5('0x17')]['include'],function(_0x5a5ec6){return{'model':db[_0x5a5ec6[_0x30e5('0x1b')]],'as':_0x5a5ec6['as'],'attributes':_0x5a5ec6[_0x30e5('0x18')],'include':_0x5a5ec6[_0x30e5('0x1a')]?_[_0x30e5('0x1c')](_0x5a5ec6[_0x30e5('0x1a')],function(_0x2139c3){return{'model':db[_0x2139c3['model']],'as':_0x2139c3['as'],'attributes':_0x2139c3['attributes'],'include':_0x2139c3['include']?_[_0x30e5('0x1c')](_0x2139c3[_0x30e5('0x1a')],function(_0x12e7a4){return{'model':db[_0x12e7a4[_0x30e5('0x1b')]],'as':_0x12e7a4['as'],'attributes':_0x12e7a4[_0x30e5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x30e5('0x1d')](function(_0x2b0a70){logger[_0x30e5('0xb')](_0x30e5('0x15'),_0x27002e);logger[_0x30e5('0x1e')]('GetVtigerAccount',_0x27002e,JSON[_0x30e5('0xf')](_0x2b0a70));_0x5d5b27(_0x2b0a70);})[_0x30e5('0x14')](function(_0x5affb6){logger[_0x30e5('0x10')](_0x30e5('0x15'),_0x5affb6[_0x30e5('0x12')],_0x27002e);_0x4aac21(_0x3d9e9b[_0x30e5('0x10')](0x1f4,_0x5affb6[_0x30e5('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x5f3977){var _0x3ff6ad=this;return new Promise(function(_0x333495,_0x3d465b){return db['VtigerAccount']['find']({'raw':_0x5f3977['options']?_0x5f3977['options'][_0x30e5('0x1f')]===undefined?!![]:![]:!![],'where':_0x5f3977[_0x30e5('0x17')]?_0x5f3977['options'][_0x30e5('0x20')]||null:null,'attributes':_0x5f3977[_0x30e5('0x17')]?_0x5f3977['options'][_0x30e5('0x18')]||null:null,'include':_0x5f3977[_0x30e5('0x17')]?_0x5f3977['options'][_0x30e5('0x1a')]?_['map'](_0x5f3977['options'][_0x30e5('0x1a')],function(_0x4691c1){return{'model':db[_0x4691c1[_0x30e5('0x1b')]],'as':_0x4691c1['as'],'attributes':_0x4691c1[_0x30e5('0x18')],'include':_0x4691c1[_0x30e5('0x1a')]?_[_0x30e5('0x1c')](_0x4691c1[_0x30e5('0x1a')],function(_0x20e7d1){return{'model':db[_0x20e7d1[_0x30e5('0x1b')]],'as':_0x20e7d1['as'],'attributes':_0x20e7d1[_0x30e5('0x18')],'include':_0x20e7d1['include']?_[_0x30e5('0x1c')](_0x20e7d1[_0x30e5('0x1a')],function(_0x26a058){return{'model':db[_0x26a058['model']],'as':_0x26a058['as'],'attributes':_0x26a058[_0x30e5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x30e5('0x1d')](function(_0x5a4c9c){logger['info'](_0x30e5('0x21'),_0x5f3977);logger['debug'](_0x30e5('0x21'),_0x5f3977,JSON[_0x30e5('0xf')](_0x5a4c9c));_0x333495(_0x5a4c9c);})[_0x30e5('0x14')](function(_0x219e25){logger[_0x30e5('0x10')](_0x30e5('0x21'),_0x219e25[_0x30e5('0x12')],_0x5f3977);_0x3d465b(_0x3ff6ad[_0x30e5('0x10')](0x1f4,_0x219e25['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 01fab0d..d7855cc 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(_0x450eee,_0xda8c7a){var _0x45f228=function(_0x385ebb){while(--_0x385ebb){_0x450eee['push'](_0x450eee['shift']());}};_0x45f228(++_0xda8c7a);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c3281,_0x5c69a0){_0x1c3281=_0x1c3281-0x0;var _0x27588d=_0xb10b[_0x1c3281];return _0x27588d;};'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 _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(_0x2b7919,_0x21afcc){var _0x390d11=function(_0x44d9f2){while(--_0x44d9f2){_0x2b7919['push'](_0x2b7919['shift']());}};_0x390d11(++_0x21afcc);}(_0xb10b,0x12a));var _0xbb10=function(_0x38c0b2,_0x6a67a5){_0x38c0b2=_0x38c0b2-0x0;var _0x283c00=_0xb10b[_0x38c0b2];return _0x283c00;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index cc52a0f..7a19b88 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 _0x1169=['sequelize','exports','STRING'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x1169,0x9c));var _0x9116=function(_0x45ef67,_0x5294c6){_0x45ef67=_0x45ef67-0x0;var _0x4ade37=_0x1169[_0x45ef67];return _0x4ade37;};'use strict';var Sequelize=require(_0x9116('0x0'));module[_0x9116('0x1')]={'name':{'type':Sequelize[_0x9116('0x2')]},'description':{'type':Sequelize[_0x9116('0x2')]}}; \ No newline at end of file +var _0xc4b4=['sequelize','STRING'];(function(_0x89bddd,_0x5c50e8){var _0x3a10e6=function(_0x2c887f){while(--_0x2c887f){_0x89bddd['push'](_0x89bddd['shift']());}};_0x3a10e6(++_0x5c50e8);}(_0xc4b4,0x76));var _0x4c4b=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xc4b4[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require(_0x4c4b('0x0'));module['exports']={'name':{'type':Sequelize[_0x4c4b('0x1')]},'description':{'type':Sequelize[_0x4c4b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 14e3177..8b8d4ed 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 _0x4760=['jayson/promise','client','http','test','Sequelize','ValidationError','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','end','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','pick','filter','merge','where','type','options','count','includeAll','findAll','rows','catch','show','length','create','body','update','find','params','destroy','findOne','VtigerField','order','sort','getFields','nolimit','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x2fba7d,_0x33ffa0){var _0x4e60a3=function(_0x421b35){while(--_0x421b35){_0x2fba7d['push'](_0x2fba7d['shift']());}};_0x4e60a3(++_0x33ffa0);}(_0x4760,0x1b4));var _0x0476=function(_0x3070d5,_0x1e44e8){_0x3070d5=_0x3070d5-0x0;var _0x23521a=_0x4760[_0x3070d5];return _0x23521a;};'use strict';var pdf=require(_0x0476('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0476('0x1'));var zipdir=require(_0x0476('0x2'));var jsonpatch=require(_0x0476('0x3'));var rp=require(_0x0476('0x4'));var moment=require(_0x0476('0x5'));var BPromise=require(_0x0476('0x6'));var Mustache=require('mustache');var util=require(_0x0476('0x7'));var path=require(_0x0476('0x8'));var sox=require(_0x0476('0x9'));var csv=require(_0x0476('0xa'));var ejs=require(_0x0476('0xb'));var fs=require('fs');var _=require(_0x0476('0xc'));var squel=require(_0x0476('0xd'));var crypto=require(_0x0476('0xe'));var jsforce=require(_0x0476('0xf'));var deskjs=require(_0x0476('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0476('0x11'));var qs=require(_0x0476('0x12'));var as=require(_0x0476('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0476('0x14'))(_0x0476('0x15'));var utils=require('../../config/utils');var config=require(_0x0476('0x16'));var db=require(_0x0476('0x17'))['db'];var jayson=require(_0x0476('0x18'));var client=jayson[_0x0476('0x19')][_0x0476('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2afd62,_0x5568c8,_0x3013f5){if(_0x3013f5){var _0x32933b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32933b[_0x0476('0x1b')](_0x5568c8)){return _0x2afd62;}else{throw new db[(_0x0476('0x1c'))][(_0x0476('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 _0x2afd62;}}function respondWithRpcPromise(_0x121469,_0x3fc829,_0x82564c,_0x17c0d1){return new BPromise(function(_0x4646e6,_0x3c5dbe){var _0x1d860f=_0x17c0d1||client;return _0x1d860f['request'](_0x121469,_0x82564c)[_0x0476('0x1e')](function(_0x294e4d){logger[_0x0476('0x1f')](_0x0476('0x20'),_0x3fc829,_0x0476('0x21'));logger['debug'](_0x0476('0x22'),_0x3fc829,_0x0476('0x21'),JSON[_0x0476('0x23')](_0x294e4d));if(_0x294e4d[_0x0476('0x24')]){if(_0x294e4d[_0x0476('0x24')]['code']===0x1f4){logger[_0x0476('0x24')](_0x0476('0x20'),_0x3fc829,_0x294e4d[_0x0476('0x24')][_0x0476('0x25')]);return _0x3c5dbe(_0x294e4d[_0x0476('0x24')][_0x0476('0x25')]);}logger[_0x0476('0x24')](_0x0476('0x20'),_0x3fc829,_0x294e4d['error']['message']);return _0x4646e6(_0x294e4d['error'][_0x0476('0x25')]);}else{logger[_0x0476('0x1f')]('VtigerConfiguration,\x20%s,\x20%s',_0x3fc829,_0x0476('0x21'));_0x4646e6(_0x294e4d[_0x0476('0x26')]['message']);}})['catch'](function(_0x1e4dc7){logger['error'](_0x0476('0x20'),_0x3fc829,_0x1e4dc7);_0x3c5dbe(_0x1e4dc7);});});}function respondWithStatusCode(_0x1d93c6,_0x21653e){_0x21653e=_0x21653e||0xcc;return function(_0x192d27){if(_0x192d27){return _0x1d93c6[_0x0476('0x27')](_0x21653e);}return _0x1d93c6['status'](_0x21653e)['end']();};}function respondWithResult(_0x43be2e,_0x160612){_0x160612=_0x160612||0xc8;return function(_0x27ef0){if(_0x27ef0){return _0x43be2e['status'](_0x160612)[_0x0476('0x28')](_0x27ef0);}};}function respondWithFilteredResult(_0x2b7a40,_0x18e92c){return function(_0x56519d){if(_0x56519d){var _0xf7d72f=_0x56519d['count'],_0x365531=_0x18e92c[_0x0476('0x29')],_0x5833d6=_0x18e92c[_0x0476('0x29')]+_0x18e92c[_0x0476('0x2a')],_0x3fb8e5;if(_0x5833d6>=_0xf7d72f){_0x5833d6=_0xf7d72f;_0x3fb8e5=0xc8;}else{_0x3fb8e5=0xce;}_0x2b7a40[_0x0476('0x2b')](_0x3fb8e5);return _0x2b7a40[_0x0476('0x2c')](_0x0476('0x2d'),_0x365531+'-'+_0x5833d6+'/'+_0xf7d72f)[_0x0476('0x28')](_0x56519d);}return null;};}function patchUpdates(_0x27dbc8){return function(_0x493215){try{jsonpatch[_0x0476('0x2e')](_0x493215,_0x27dbc8,!![]);}catch(_0x292b88){return BPromise[_0x0476('0x2f')](_0x292b88);}return _0x493215['save']();};}function saveUpdates(_0x252028,_0x217f4d){return function(_0x316512){if(_0x316512){return _0x316512['update'](_0x252028)[_0x0476('0x1e')](function(_0x16003b){return _0x16003b;});}return null;};}function removeEntity(_0xfd9cc1,_0x476103){return function(_0x52f33a){if(_0x52f33a){return _0x52f33a['destroy']()[_0x0476('0x1e')](function(){_0xfd9cc1['status'](0xcc)[_0x0476('0x30')]();});}};}function handleEntityNotFound(_0x5ce731,_0x4e5d45){return function(_0x141c37){if(!_0x141c37){_0x5ce731[_0x0476('0x27')](0x194);}return _0x141c37;};}function handleError(_0x576a7f,_0x3f4058){_0x3f4058=_0x3f4058||0x1f4;return function(_0x5aad38){logger[_0x0476('0x24')](_0x5aad38[_0x0476('0x31')]);if(_0x5aad38[_0x0476('0x32')]){delete _0x5aad38[_0x0476('0x32')];}_0x576a7f['status'](_0x3f4058)[_0x0476('0x33')](_0x5aad38);};}exports['index']=function(_0x3288b7,_0x1e91dc){var _0x3cca13={},_0x2eb9c4={},_0x2d920e={'count':0x0,'rows':[]};var _0xd74123=_[_0x0476('0x34')](db[_0x0476('0x35')][_0x0476('0x36')],function(_0x292677){return{'name':_0x292677[_0x0476('0x37')],'type':_0x292677['type'][_0x0476('0x38')]};});_0x2eb9c4['model']=_[_0x0476('0x34')](_0xd74123,_0x0476('0x32'));_0x2eb9c4[_0x0476('0x39')]=_[_0x0476('0x3a')](_0x3288b7[_0x0476('0x39')]);_0x2eb9c4[_0x0476('0x3b')]=_[_0x0476('0x3c')](_0x2eb9c4[_0x0476('0x3d')],_0x2eb9c4[_0x0476('0x39')]);_0x3cca13[_0x0476('0x3e')]=_[_0x0476('0x3c')](_0x2eb9c4['model'],qs[_0x0476('0x3f')](_0x3288b7[_0x0476('0x39')][_0x0476('0x3f')]));_0x3cca13[_0x0476('0x3e')]=_0x3cca13[_0x0476('0x3e')]['length']?_0x3cca13[_0x0476('0x3e')]:_0x2eb9c4['model'];if(!_0x3288b7[_0x0476('0x39')][_0x0476('0x40')]('nolimit')){_0x3cca13[_0x0476('0x2a')]=qs[_0x0476('0x2a')](_0x3288b7[_0x0476('0x39')][_0x0476('0x2a')]);_0x3cca13[_0x0476('0x29')]=qs['offset'](_0x3288b7[_0x0476('0x39')]['offset']);}_0x3cca13['order']=qs['sort'](_0x3288b7[_0x0476('0x39')]['sort']);_0x3cca13['where']=qs[_0x0476('0x3b')](_[_0x0476('0x41')](_0x3288b7[_0x0476('0x39')],_0x2eb9c4[_0x0476('0x3b')]),_0xd74123);if(_0x3288b7[_0x0476('0x39')][_0x0476('0x42')]){_0x3cca13['where']=_[_0x0476('0x43')](_0x3cca13[_0x0476('0x44')],{'$or':_[_0x0476('0x34')](_0xd74123,function(_0x129c40){if(_0x129c40[_0x0476('0x45')]!=='VIRTUAL'){var _0x52c9bb={};_0x52c9bb[_0x129c40[_0x0476('0x32')]]={'$like':'%'+_0x3288b7['query']['filter']+'%'};return _0x52c9bb;}})});}_0x3cca13=_[_0x0476('0x43')]({},_0x3cca13,_0x3288b7[_0x0476('0x46')]);var _0x455623={'where':_0x3cca13[_0x0476('0x44')]};return db[_0x0476('0x35')][_0x0476('0x47')](_0x455623)[_0x0476('0x1e')](function(_0x4e119e){_0x2d920e[_0x0476('0x47')]=_0x4e119e;if(_0x3288b7[_0x0476('0x39')][_0x0476('0x48')]){_0x3cca13['include']=[{'all':!![]}];}return db[_0x0476('0x35')][_0x0476('0x49')](_0x3cca13);})[_0x0476('0x1e')](function(_0x5efbf7){_0x2d920e[_0x0476('0x4a')]=_0x5efbf7;return _0x2d920e;})['then'](respondWithFilteredResult(_0x1e91dc,_0x3cca13))[_0x0476('0x4b')](handleError(_0x1e91dc,null));};exports[_0x0476('0x4c')]=function(_0xa53399,_0x433eff){var _0x177224={'raw':![],'where':{'id':_0xa53399['params']['id']}},_0x31d68e={};_0x31d68e[_0x0476('0x3d')]=_['keys'](db[_0x0476('0x35')][_0x0476('0x36')]);_0x31d68e[_0x0476('0x39')]=_[_0x0476('0x3a')](_0xa53399[_0x0476('0x39')]);_0x31d68e[_0x0476('0x3b')]=_[_0x0476('0x3c')](_0x31d68e[_0x0476('0x3d')],_0x31d68e[_0x0476('0x39')]);_0x177224[_0x0476('0x3e')]=_[_0x0476('0x3c')](_0x31d68e[_0x0476('0x3d')],qs[_0x0476('0x3f')](_0xa53399[_0x0476('0x39')][_0x0476('0x3f')]));_0x177224[_0x0476('0x3e')]=_0x177224[_0x0476('0x3e')][_0x0476('0x4d')]?_0x177224['attributes']:_0x31d68e[_0x0476('0x3d')];if(_0xa53399[_0x0476('0x39')][_0x0476('0x48')]){_0x177224['include']=[{'all':!![]}];}_0x177224=_[_0x0476('0x43')]({},_0x177224,_0xa53399[_0x0476('0x46')]);return db['VtigerConfiguration']['find'](_0x177224)[_0x0476('0x1e')](handleEntityNotFound(_0x433eff,null))[_0x0476('0x1e')](respondWithResult(_0x433eff,null))['catch'](handleError(_0x433eff,null));};exports['create']=function(_0x3f871e,_0x1fdcb5){return db[_0x0476('0x35')][_0x0476('0x4e')](_0x3f871e[_0x0476('0x4f')],{})[_0x0476('0x1e')](respondWithResult(_0x1fdcb5,0xc9))[_0x0476('0x4b')](handleError(_0x1fdcb5,null));};exports[_0x0476('0x50')]=function(_0x159730,_0x34a536){if(_0x159730[_0x0476('0x4f')]['id']){delete _0x159730['body']['id'];}return db[_0x0476('0x35')][_0x0476('0x51')]({'where':{'id':_0x159730[_0x0476('0x52')]['id']}})[_0x0476('0x1e')](handleEntityNotFound(_0x34a536,null))[_0x0476('0x1e')](saveUpdates(_0x159730[_0x0476('0x4f')],null))['then'](respondWithResult(_0x34a536,null))[_0x0476('0x4b')](handleError(_0x34a536,null));};exports[_0x0476('0x53')]=function(_0x5d3edd,_0x10e521){return db[_0x0476('0x35')][_0x0476('0x51')]({'where':{'id':_0x5d3edd['params']['id']}})[_0x0476('0x1e')](handleEntityNotFound(_0x10e521,null))[_0x0476('0x1e')](removeEntity(_0x10e521,null))[_0x0476('0x4b')](handleError(_0x10e521,null));};exports['getFields']=function(_0x57acb2,_0x2ade7a,_0x50774a){var _0x3a0ec1={};var _0x5c9f45={};var _0x29cdf8;var _0x46d757;return db['VtigerConfiguration'][_0x0476('0x54')]({'where':{'id':_0x57acb2[_0x0476('0x52')]['id']}})[_0x0476('0x1e')](handleEntityNotFound(_0x2ade7a,null))['then'](function(_0x18f081){if(_0x18f081){_0x29cdf8=_0x18f081;_0x5c9f45[_0x0476('0x3d')]=_[_0x0476('0x3a')](db[_0x0476('0x55')][_0x0476('0x36')]);_0x5c9f45[_0x0476('0x39')]=_['keys'](_0x57acb2[_0x0476('0x39')]);_0x5c9f45[_0x0476('0x3b')]=_[_0x0476('0x3c')](_0x5c9f45[_0x0476('0x3d')],_0x5c9f45['query']);_0x3a0ec1[_0x0476('0x3e')]=_[_0x0476('0x3c')](_0x5c9f45[_0x0476('0x3d')],qs[_0x0476('0x3f')](_0x57acb2[_0x0476('0x39')][_0x0476('0x3f')]));_0x3a0ec1['attributes']=_0x3a0ec1[_0x0476('0x3e')][_0x0476('0x4d')]?_0x3a0ec1[_0x0476('0x3e')]:_0x5c9f45[_0x0476('0x3d')];_0x3a0ec1[_0x0476('0x56')]=qs[_0x0476('0x57')](_0x57acb2[_0x0476('0x39')][_0x0476('0x57')]);_0x3a0ec1[_0x0476('0x44')]=qs['filters'](_[_0x0476('0x41')](_0x57acb2['query'],_0x5c9f45[_0x0476('0x3b')]));if(_0x57acb2[_0x0476('0x39')][_0x0476('0x42')]){_0x3a0ec1[_0x0476('0x44')]=_[_0x0476('0x43')](_0x3a0ec1[_0x0476('0x44')],{'$or':_[_0x0476('0x34')](_0x3a0ec1[_0x0476('0x3e')],function(_0x2258d3){var _0xc57794={};_0xc57794[_0x2258d3]={'$like':'%'+_0x57acb2[_0x0476('0x39')][_0x0476('0x42')]+'%'};return _0xc57794;})});}_0x3a0ec1=_[_0x0476('0x43')]({},_0x3a0ec1,_0x57acb2['options']);return _0x29cdf8[_0x0476('0x58')](_0x3a0ec1);}})[_0x0476('0x1e')](function(_0x431904){if(_0x431904){_0x46d757=_0x431904[_0x0476('0x4d')];if(!_0x57acb2['query'][_0x0476('0x40')](_0x0476('0x59'))){_0x3a0ec1['limit']=qs[_0x0476('0x2a')](_0x57acb2['query'][_0x0476('0x2a')]);_0x3a0ec1[_0x0476('0x29')]=qs[_0x0476('0x29')](_0x57acb2['query']['offset']);}return _0x29cdf8[_0x0476('0x58')](_0x3a0ec1);}})[_0x0476('0x1e')](function(_0x7639cd){if(_0x7639cd){return _0x7639cd?{'count':_0x46d757,'rows':_0x7639cd}:null;}})[_0x0476('0x1e')](respondWithResult(_0x2ade7a,null))['catch'](handleError(_0x2ade7a,null));};exports[_0x0476('0x5a')]=function(_0x367ae3,_0x59567b,_0x484ae6){var _0x323d3c={};var _0x20e409={};var _0x25ce78;var _0x2dfb21;return db[_0x0476('0x35')][_0x0476('0x54')]({'where':{'id':_0x367ae3['params']['id']}})['then'](handleEntityNotFound(_0x59567b,null))[_0x0476('0x1e')](function(_0x314b5d){if(_0x314b5d){_0x25ce78=_0x314b5d;_0x20e409[_0x0476('0x3d')]=_[_0x0476('0x3a')](db[_0x0476('0x55')][_0x0476('0x36')]);_0x20e409[_0x0476('0x39')]=_[_0x0476('0x3a')](_0x367ae3[_0x0476('0x39')]);_0x20e409[_0x0476('0x3b')]=_[_0x0476('0x3c')](_0x20e409[_0x0476('0x3d')],_0x20e409[_0x0476('0x39')]);_0x323d3c['attributes']=_[_0x0476('0x3c')](_0x20e409['model'],qs[_0x0476('0x3f')](_0x367ae3[_0x0476('0x39')][_0x0476('0x3f')]));_0x323d3c[_0x0476('0x3e')]=_0x323d3c[_0x0476('0x3e')][_0x0476('0x4d')]?_0x323d3c[_0x0476('0x3e')]:_0x20e409['model'];_0x323d3c['order']=qs[_0x0476('0x57')](_0x367ae3[_0x0476('0x39')][_0x0476('0x57')]);_0x323d3c[_0x0476('0x44')]=qs[_0x0476('0x3b')](_[_0x0476('0x41')](_0x367ae3[_0x0476('0x39')],_0x20e409['filters']));if(_0x367ae3['query']['filter']){_0x323d3c[_0x0476('0x44')]=_[_0x0476('0x43')](_0x323d3c[_0x0476('0x44')],{'$or':_['map'](_0x323d3c[_0x0476('0x3e')],function(_0x5ee197){var _0x362bf4={};_0x362bf4[_0x5ee197]={'$like':'%'+_0x367ae3[_0x0476('0x39')]['filter']+'%'};return _0x362bf4;})});}_0x323d3c=_[_0x0476('0x43')]({},_0x323d3c,_0x367ae3[_0x0476('0x46')]);return _0x25ce78[_0x0476('0x5a')](_0x323d3c);}})[_0x0476('0x1e')](function(_0xe2bfcc){if(_0xe2bfcc){_0x2dfb21=_0xe2bfcc[_0x0476('0x4d')];if(!_0x367ae3[_0x0476('0x39')]['hasOwnProperty'](_0x0476('0x59'))){_0x323d3c[_0x0476('0x2a')]=qs[_0x0476('0x2a')](_0x367ae3[_0x0476('0x39')][_0x0476('0x2a')]);_0x323d3c[_0x0476('0x29')]=qs[_0x0476('0x29')](_0x367ae3['query'][_0x0476('0x29')]);}return _0x25ce78['getSubjects'](_0x323d3c);}})[_0x0476('0x1e')](function(_0x1e2a60){if(_0x1e2a60){return _0x1e2a60?{'count':_0x2dfb21,'rows':_0x1e2a60}:null;}})['then'](respondWithResult(_0x59567b,null))[_0x0476('0x4b')](handleError(_0x59567b,null));};exports[_0x0476('0x5b')]=function(_0xfd3309,_0x4dde89,_0xab6a4e){var _0x4c3fdb={};var _0x4785f1={};var _0x58248b;var _0x40f796;return db[_0x0476('0x35')][_0x0476('0x54')]({'where':{'id':_0xfd3309[_0x0476('0x52')]['id']}})[_0x0476('0x1e')](handleEntityNotFound(_0x4dde89,null))['then'](function(_0x539236){if(_0x539236){_0x58248b=_0x539236;_0x4785f1[_0x0476('0x3d')]=_[_0x0476('0x3a')](db[_0x0476('0x55')][_0x0476('0x36')]);_0x4785f1[_0x0476('0x39')]=_[_0x0476('0x3a')](_0xfd3309[_0x0476('0x39')]);_0x4785f1['filters']=_[_0x0476('0x3c')](_0x4785f1[_0x0476('0x3d')],_0x4785f1[_0x0476('0x39')]);_0x4c3fdb[_0x0476('0x3e')]=_[_0x0476('0x3c')](_0x4785f1['model'],qs[_0x0476('0x3f')](_0xfd3309[_0x0476('0x39')][_0x0476('0x3f')]));_0x4c3fdb[_0x0476('0x3e')]=_0x4c3fdb[_0x0476('0x3e')][_0x0476('0x4d')]?_0x4c3fdb['attributes']:_0x4785f1[_0x0476('0x3d')];_0x4c3fdb['order']=qs[_0x0476('0x57')](_0xfd3309[_0x0476('0x39')][_0x0476('0x57')]);_0x4c3fdb[_0x0476('0x44')]=qs[_0x0476('0x3b')](_[_0x0476('0x41')](_0xfd3309[_0x0476('0x39')],_0x4785f1[_0x0476('0x3b')]));if(_0xfd3309[_0x0476('0x39')][_0x0476('0x42')]){_0x4c3fdb[_0x0476('0x44')]=_[_0x0476('0x43')](_0x4c3fdb[_0x0476('0x44')],{'$or':_[_0x0476('0x34')](_0x4c3fdb[_0x0476('0x3e')],function(_0x41ddf9){var _0x30a039={};_0x30a039[_0x41ddf9]={'$like':'%'+_0xfd3309[_0x0476('0x39')][_0x0476('0x42')]+'%'};return _0x30a039;})});}_0x4c3fdb=_['merge']({},_0x4c3fdb,_0xfd3309[_0x0476('0x46')]);return _0x58248b['getDescriptions'](_0x4c3fdb);}})[_0x0476('0x1e')](function(_0x180b6f){if(_0x180b6f){_0x40f796=_0x180b6f[_0x0476('0x4d')];if(!_0xfd3309['query'][_0x0476('0x40')]('nolimit')){_0x4c3fdb[_0x0476('0x2a')]=qs[_0x0476('0x2a')](_0xfd3309[_0x0476('0x39')][_0x0476('0x2a')]);_0x4c3fdb[_0x0476('0x29')]=qs['offset'](_0xfd3309['query'][_0x0476('0x29')]);}return _0x58248b['getDescriptions'](_0x4c3fdb);}})[_0x0476('0x1e')](function(_0x206608){if(_0x206608){return _0x206608?{'count':_0x40f796,'rows':_0x206608}:null;}})[_0x0476('0x1e')](respondWithResult(_0x4dde89,null))[_0x0476('0x4b')](handleError(_0x4dde89,null));}; \ No newline at end of file +var _0xf16c=['jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','stack','name','send','index','map','VtigerConfiguration','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','include','rows','show','params','rawAttributes','includeAll','create','body','find','getFields','findOne','VtigerField','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto'];(function(_0x6cb701,_0x6e56db){var _0x28259e=function(_0x556354){while(--_0x556354){_0x6cb701['push'](_0x6cb701['shift']());}};_0x28259e(++_0x6e56db);}(_0xf16c,0xad));var _0xcf16=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf16c[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xcf16('0x0'));var emlformat=require(_0xcf16('0x1'));var rimraf=require(_0xcf16('0x2'));var zipdir=require(_0xcf16('0x3'));var jsonpatch=require(_0xcf16('0x4'));var rp=require(_0xcf16('0x5'));var moment=require(_0xcf16('0x6'));var BPromise=require(_0xcf16('0x7'));var Mustache=require(_0xcf16('0x8'));var util=require(_0xcf16('0x9'));var path=require(_0xcf16('0xa'));var sox=require('sox');var csv=require(_0xcf16('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcf16('0xc'));var squel=require(_0xcf16('0xd'));var crypto=require(_0xcf16('0xe'));var jsforce=require(_0xcf16('0xf'));var deskjs=require(_0xcf16('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcf16('0x11'));var Papa=require(_0xcf16('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcf16('0x13'));var hardwareService=require(_0xcf16('0x14'));var logger=require(_0xcf16('0x15'))(_0xcf16('0x16'));var utils=require('../../config/utils');var config=require(_0xcf16('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xcf16('0x18'));var client=jayson[_0xcf16('0x19')][_0xcf16('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x221fa4,_0x5b8f47,_0x168b12){if(_0x168b12){var _0x27348e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27348e['test'](_0x5b8f47)){return _0x221fa4;}else{throw new db[(_0xcf16('0x1b'))][(_0xcf16('0x1c'))](_0xcf16('0x1d'));}}else{return _0x221fa4;}}function respondWithRpcPromise(_0x4d60d1,_0x53d6e7,_0x2bf22b,_0x5775d3){return new BPromise(function(_0x117753,_0x381b86){var _0x588b33=_0x5775d3||client;return _0x588b33[_0xcf16('0x1e')](_0x4d60d1,_0x2bf22b)[_0xcf16('0x1f')](function(_0xdedc0e){logger['info'](_0xcf16('0x20'),_0x53d6e7,_0xcf16('0x21'));logger[_0xcf16('0x22')](_0xcf16('0x23'),_0x53d6e7,_0xcf16('0x21'),JSON[_0xcf16('0x24')](_0xdedc0e));if(_0xdedc0e[_0xcf16('0x25')]){if(_0xdedc0e[_0xcf16('0x25')][_0xcf16('0x26')]===0x1f4){logger['error'](_0xcf16('0x20'),_0x53d6e7,_0xdedc0e[_0xcf16('0x25')][_0xcf16('0x27')]);return _0x381b86(_0xdedc0e[_0xcf16('0x25')]['message']);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x53d6e7,_0xdedc0e[_0xcf16('0x25')][_0xcf16('0x27')]);return _0x117753(_0xdedc0e[_0xcf16('0x25')][_0xcf16('0x27')]);}else{logger[_0xcf16('0x28')]('VtigerConfiguration,\x20%s,\x20%s',_0x53d6e7,_0xcf16('0x21'));_0x117753(_0xdedc0e[_0xcf16('0x29')]['message']);}})[_0xcf16('0x2a')](function(_0x58ef7c){logger[_0xcf16('0x25')](_0xcf16('0x20'),_0x53d6e7,_0x58ef7c);_0x381b86(_0x58ef7c);});});}function respondWithStatusCode(_0x36695b,_0x352e3e){_0x352e3e=_0x352e3e||0xcc;return function(_0xeec219){if(_0xeec219){return _0x36695b[_0xcf16('0x2b')](_0x352e3e);}return _0x36695b[_0xcf16('0x2c')](_0x352e3e)[_0xcf16('0x2d')]();};}function respondWithResult(_0x375558,_0x56401b){_0x56401b=_0x56401b||0xc8;return function(_0x14c44d){if(_0x14c44d){return _0x375558[_0xcf16('0x2c')](_0x56401b)[_0xcf16('0x2e')](_0x14c44d);}};}function respondWithFilteredResult(_0x42fcbb,_0x48038f){return function(_0x3ccc83){if(_0x3ccc83){var _0x39b394=_0x3ccc83[_0xcf16('0x2f')],_0x1c9ebc=_0x48038f[_0xcf16('0x30')],_0x2795a3=_0x48038f[_0xcf16('0x30')]+_0x48038f[_0xcf16('0x31')],_0x17519c;if(_0x2795a3>=_0x39b394){_0x2795a3=_0x39b394;_0x17519c=0xc8;}else{_0x17519c=0xce;}_0x42fcbb[_0xcf16('0x2c')](_0x17519c);return _0x42fcbb['set'](_0xcf16('0x32'),_0x1c9ebc+'-'+_0x2795a3+'/'+_0x39b394)[_0xcf16('0x2e')](_0x3ccc83);}return null;};}function patchUpdates(_0x3206f6){return function(_0x35f23e){try{jsonpatch['apply'](_0x35f23e,_0x3206f6,!![]);}catch(_0x41ef3b){return BPromise[_0xcf16('0x33')](_0x41ef3b);}return _0x35f23e[_0xcf16('0x34')]();};}function saveUpdates(_0x35991e,_0x58e2c0){return function(_0x231920){if(_0x231920){return _0x231920[_0xcf16('0x35')](_0x35991e)['then'](function(_0x1a23e5){return _0x1a23e5;});}return null;};}function removeEntity(_0x26ee92,_0x444cee){return function(_0x3ec0cb){if(_0x3ec0cb){return _0x3ec0cb[_0xcf16('0x36')]()['then'](function(){_0x26ee92['status'](0xcc)[_0xcf16('0x2d')]();});}};}function handleEntityNotFound(_0x20e8a1,_0x2d8e2e){return function(_0x1f6626){if(!_0x1f6626){_0x20e8a1[_0xcf16('0x2b')](0x194);}return _0x1f6626;};}function handleError(_0x4be872,_0x3c6847){_0x3c6847=_0x3c6847||0x1f4;return function(_0x35974c){logger['error'](_0x35974c[_0xcf16('0x37')]);if(_0x35974c[_0xcf16('0x38')]){delete _0x35974c['name'];}_0x4be872[_0xcf16('0x2c')](_0x3c6847)[_0xcf16('0x39')](_0x35974c);};}exports[_0xcf16('0x3a')]=function(_0xb1c4af,_0x36e879){var _0x4edf6d={},_0x4da321={},_0x28c0c6={'count':0x0,'rows':[]};var _0x599660=_[_0xcf16('0x3b')](db[_0xcf16('0x3c')]['rawAttributes'],function(_0x3e45ef){return{'name':_0x3e45ef['fieldName'],'type':_0x3e45ef[_0xcf16('0x3d')][_0xcf16('0x3e')]};});_0x4da321['model']=_['map'](_0x599660,_0xcf16('0x38'));_0x4da321[_0xcf16('0x3f')]=_[_0xcf16('0x40')](_0xb1c4af[_0xcf16('0x3f')]);_0x4da321['filters']=_['intersection'](_0x4da321[_0xcf16('0x41')],_0x4da321[_0xcf16('0x3f')]);_0x4edf6d['attributes']=_[_0xcf16('0x42')](_0x4da321[_0xcf16('0x41')],qs[_0xcf16('0x43')](_0xb1c4af['query'][_0xcf16('0x43')]));_0x4edf6d['attributes']=_0x4edf6d[_0xcf16('0x44')][_0xcf16('0x45')]?_0x4edf6d['attributes']:_0x4da321['model'];if(!_0xb1c4af[_0xcf16('0x3f')][_0xcf16('0x46')]('nolimit')){_0x4edf6d[_0xcf16('0x31')]=qs[_0xcf16('0x31')](_0xb1c4af[_0xcf16('0x3f')][_0xcf16('0x31')]);_0x4edf6d[_0xcf16('0x30')]=qs[_0xcf16('0x30')](_0xb1c4af[_0xcf16('0x3f')]['offset']);}_0x4edf6d[_0xcf16('0x47')]=qs[_0xcf16('0x48')](_0xb1c4af['query'][_0xcf16('0x48')]);_0x4edf6d[_0xcf16('0x49')]=qs[_0xcf16('0x4a')](_[_0xcf16('0x4b')](_0xb1c4af[_0xcf16('0x3f')],_0x4da321[_0xcf16('0x4a')]),_0x599660);if(_0xb1c4af[_0xcf16('0x3f')]['filter']){_0x4edf6d[_0xcf16('0x49')]=_[_0xcf16('0x4c')](_0x4edf6d[_0xcf16('0x49')],{'$or':_[_0xcf16('0x3b')](_0x599660,function(_0x4d15f0){if(_0x4d15f0[_0xcf16('0x3d')]!=='VIRTUAL'){var _0x20e49f={};_0x20e49f[_0x4d15f0[_0xcf16('0x38')]]={'$like':'%'+_0xb1c4af[_0xcf16('0x3f')][_0xcf16('0x4d')]+'%'};return _0x20e49f;}})});}_0x4edf6d=_[_0xcf16('0x4c')]({},_0x4edf6d,_0xb1c4af[_0xcf16('0x4e')]);var _0x2415c1={'where':_0x4edf6d['where']};return db[_0xcf16('0x3c')][_0xcf16('0x2f')](_0x2415c1)[_0xcf16('0x1f')](function(_0x3937fb){_0x28c0c6['count']=_0x3937fb;if(_0xb1c4af[_0xcf16('0x3f')]['includeAll']){_0x4edf6d[_0xcf16('0x4f')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x4edf6d);})[_0xcf16('0x1f')](function(_0x5aab63){_0x28c0c6[_0xcf16('0x50')]=_0x5aab63;return _0x28c0c6;})[_0xcf16('0x1f')](respondWithFilteredResult(_0x36e879,_0x4edf6d))[_0xcf16('0x2a')](handleError(_0x36e879,null));};exports[_0xcf16('0x51')]=function(_0x31505d,_0x44b373){var _0x2a022a={'raw':![],'where':{'id':_0x31505d[_0xcf16('0x52')]['id']}},_0xad175c={};_0xad175c['model']=_[_0xcf16('0x40')](db[_0xcf16('0x3c')][_0xcf16('0x53')]);_0xad175c[_0xcf16('0x3f')]=_['keys'](_0x31505d[_0xcf16('0x3f')]);_0xad175c[_0xcf16('0x4a')]=_[_0xcf16('0x42')](_0xad175c[_0xcf16('0x41')],_0xad175c[_0xcf16('0x3f')]);_0x2a022a[_0xcf16('0x44')]=_[_0xcf16('0x42')](_0xad175c[_0xcf16('0x41')],qs['fields'](_0x31505d[_0xcf16('0x3f')][_0xcf16('0x43')]));_0x2a022a[_0xcf16('0x44')]=_0x2a022a[_0xcf16('0x44')]['length']?_0x2a022a[_0xcf16('0x44')]:_0xad175c[_0xcf16('0x41')];if(_0x31505d[_0xcf16('0x3f')][_0xcf16('0x54')]){_0x2a022a[_0xcf16('0x4f')]=[{'all':!![]}];}_0x2a022a=_[_0xcf16('0x4c')]({},_0x2a022a,_0x31505d[_0xcf16('0x4e')]);return db[_0xcf16('0x3c')]['find'](_0x2a022a)['then'](handleEntityNotFound(_0x44b373,null))[_0xcf16('0x1f')](respondWithResult(_0x44b373,null))[_0xcf16('0x2a')](handleError(_0x44b373,null));};exports[_0xcf16('0x55')]=function(_0x220532,_0x45a13d){return db['VtigerConfiguration'][_0xcf16('0x55')](_0x220532[_0xcf16('0x56')],{})['then'](respondWithResult(_0x45a13d,0xc9))['catch'](handleError(_0x45a13d,null));};exports[_0xcf16('0x35')]=function(_0x422414,_0x28637d){if(_0x422414[_0xcf16('0x56')]['id']){delete _0x422414['body']['id'];}return db['VtigerConfiguration'][_0xcf16('0x57')]({'where':{'id':_0x422414[_0xcf16('0x52')]['id']}})[_0xcf16('0x1f')](handleEntityNotFound(_0x28637d,null))[_0xcf16('0x1f')](saveUpdates(_0x422414[_0xcf16('0x56')],null))[_0xcf16('0x1f')](respondWithResult(_0x28637d,null))[_0xcf16('0x2a')](handleError(_0x28637d,null));};exports['destroy']=function(_0x1bb6a8,_0x174e34){return db[_0xcf16('0x3c')]['find']({'where':{'id':_0x1bb6a8['params']['id']}})[_0xcf16('0x1f')](handleEntityNotFound(_0x174e34,null))[_0xcf16('0x1f')](removeEntity(_0x174e34,null))[_0xcf16('0x2a')](handleError(_0x174e34,null));};exports[_0xcf16('0x58')]=function(_0x18d972,_0x2319d0,_0x89597b){var _0x3f25e4={};var _0x316390={};var _0x315e55;var _0x22d32d;return db['VtigerConfiguration'][_0xcf16('0x59')]({'where':{'id':_0x18d972['params']['id']}})[_0xcf16('0x1f')](handleEntityNotFound(_0x2319d0,null))['then'](function(_0x56d7a6){if(_0x56d7a6){_0x315e55=_0x56d7a6;_0x316390[_0xcf16('0x41')]=_[_0xcf16('0x40')](db[_0xcf16('0x5a')][_0xcf16('0x53')]);_0x316390['query']=_[_0xcf16('0x40')](_0x18d972[_0xcf16('0x3f')]);_0x316390[_0xcf16('0x4a')]=_['intersection'](_0x316390[_0xcf16('0x41')],_0x316390[_0xcf16('0x3f')]);_0x3f25e4['attributes']=_[_0xcf16('0x42')](_0x316390[_0xcf16('0x41')],qs['fields'](_0x18d972[_0xcf16('0x3f')][_0xcf16('0x43')]));_0x3f25e4[_0xcf16('0x44')]=_0x3f25e4[_0xcf16('0x44')][_0xcf16('0x45')]?_0x3f25e4['attributes']:_0x316390[_0xcf16('0x41')];_0x3f25e4['order']=qs[_0xcf16('0x48')](_0x18d972['query'][_0xcf16('0x48')]);_0x3f25e4[_0xcf16('0x49')]=qs[_0xcf16('0x4a')](_[_0xcf16('0x4b')](_0x18d972['query'],_0x316390[_0xcf16('0x4a')]));if(_0x18d972['query'][_0xcf16('0x4d')]){_0x3f25e4[_0xcf16('0x49')]=_[_0xcf16('0x4c')](_0x3f25e4[_0xcf16('0x49')],{'$or':_[_0xcf16('0x3b')](_0x3f25e4[_0xcf16('0x44')],function(_0x562a89){var _0x3363db={};_0x3363db[_0x562a89]={'$like':'%'+_0x18d972[_0xcf16('0x3f')][_0xcf16('0x4d')]+'%'};return _0x3363db;})});}_0x3f25e4=_[_0xcf16('0x4c')]({},_0x3f25e4,_0x18d972['options']);return _0x315e55[_0xcf16('0x58')](_0x3f25e4);}})['then'](function(_0x4fa9af){if(_0x4fa9af){_0x22d32d=_0x4fa9af[_0xcf16('0x45')];if(!_0x18d972[_0xcf16('0x3f')]['hasOwnProperty'](_0xcf16('0x5b'))){_0x3f25e4['limit']=qs[_0xcf16('0x31')](_0x18d972['query'][_0xcf16('0x31')]);_0x3f25e4['offset']=qs[_0xcf16('0x30')](_0x18d972[_0xcf16('0x3f')]['offset']);}return _0x315e55[_0xcf16('0x58')](_0x3f25e4);}})[_0xcf16('0x1f')](function(_0x310944){if(_0x310944){return _0x310944?{'count':_0x22d32d,'rows':_0x310944}:null;}})['then'](respondWithResult(_0x2319d0,null))['catch'](handleError(_0x2319d0,null));};exports[_0xcf16('0x5c')]=function(_0x4dca0e,_0x19259a,_0x417f08){var _0x2894d6={};var _0x212e49={};var _0x3200ba;var _0x1d0877;return db[_0xcf16('0x3c')][_0xcf16('0x59')]({'where':{'id':_0x4dca0e[_0xcf16('0x52')]['id']}})[_0xcf16('0x1f')](handleEntityNotFound(_0x19259a,null))[_0xcf16('0x1f')](function(_0x392065){if(_0x392065){_0x3200ba=_0x392065;_0x212e49[_0xcf16('0x41')]=_[_0xcf16('0x40')](db[_0xcf16('0x5a')][_0xcf16('0x53')]);_0x212e49[_0xcf16('0x3f')]=_[_0xcf16('0x40')](_0x4dca0e[_0xcf16('0x3f')]);_0x212e49[_0xcf16('0x4a')]=_[_0xcf16('0x42')](_0x212e49['model'],_0x212e49[_0xcf16('0x3f')]);_0x2894d6[_0xcf16('0x44')]=_[_0xcf16('0x42')](_0x212e49['model'],qs['fields'](_0x4dca0e[_0xcf16('0x3f')]['fields']));_0x2894d6[_0xcf16('0x44')]=_0x2894d6['attributes'][_0xcf16('0x45')]?_0x2894d6['attributes']:_0x212e49[_0xcf16('0x41')];_0x2894d6[_0xcf16('0x47')]=qs[_0xcf16('0x48')](_0x4dca0e[_0xcf16('0x3f')][_0xcf16('0x48')]);_0x2894d6[_0xcf16('0x49')]=qs[_0xcf16('0x4a')](_[_0xcf16('0x4b')](_0x4dca0e[_0xcf16('0x3f')],_0x212e49[_0xcf16('0x4a')]));if(_0x4dca0e[_0xcf16('0x3f')][_0xcf16('0x4d')]){_0x2894d6[_0xcf16('0x49')]=_[_0xcf16('0x4c')](_0x2894d6[_0xcf16('0x49')],{'$or':_[_0xcf16('0x3b')](_0x2894d6['attributes'],function(_0x2378e1){var _0x34edaa={};_0x34edaa[_0x2378e1]={'$like':'%'+_0x4dca0e[_0xcf16('0x3f')]['filter']+'%'};return _0x34edaa;})});}_0x2894d6=_[_0xcf16('0x4c')]({},_0x2894d6,_0x4dca0e[_0xcf16('0x4e')]);return _0x3200ba[_0xcf16('0x5c')](_0x2894d6);}})[_0xcf16('0x1f')](function(_0x35ff8a){if(_0x35ff8a){_0x1d0877=_0x35ff8a[_0xcf16('0x45')];if(!_0x4dca0e['query'][_0xcf16('0x46')](_0xcf16('0x5b'))){_0x2894d6[_0xcf16('0x31')]=qs[_0xcf16('0x31')](_0x4dca0e[_0xcf16('0x3f')][_0xcf16('0x31')]);_0x2894d6[_0xcf16('0x30')]=qs[_0xcf16('0x30')](_0x4dca0e[_0xcf16('0x3f')]['offset']);}return _0x3200ba[_0xcf16('0x5c')](_0x2894d6);}})['then'](function(_0x305b30){if(_0x305b30){return _0x305b30?{'count':_0x1d0877,'rows':_0x305b30}:null;}})[_0xcf16('0x1f')](respondWithResult(_0x19259a,null))[_0xcf16('0x2a')](handleError(_0x19259a,null));};exports[_0xcf16('0x5d')]=function(_0x39304a,_0x5dea15,_0x463035){var _0x50f968={};var _0x5cbcca={};var _0x4a9103;var _0x1d6747;return db[_0xcf16('0x3c')][_0xcf16('0x59')]({'where':{'id':_0x39304a[_0xcf16('0x52')]['id']}})[_0xcf16('0x1f')](handleEntityNotFound(_0x5dea15,null))['then'](function(_0x1ca748){if(_0x1ca748){_0x4a9103=_0x1ca748;_0x5cbcca[_0xcf16('0x41')]=_[_0xcf16('0x40')](db[_0xcf16('0x5a')][_0xcf16('0x53')]);_0x5cbcca[_0xcf16('0x3f')]=_[_0xcf16('0x40')](_0x39304a[_0xcf16('0x3f')]);_0x5cbcca[_0xcf16('0x4a')]=_[_0xcf16('0x42')](_0x5cbcca[_0xcf16('0x41')],_0x5cbcca[_0xcf16('0x3f')]);_0x50f968['attributes']=_[_0xcf16('0x42')](_0x5cbcca[_0xcf16('0x41')],qs['fields'](_0x39304a['query']['fields']));_0x50f968[_0xcf16('0x44')]=_0x50f968[_0xcf16('0x44')][_0xcf16('0x45')]?_0x50f968[_0xcf16('0x44')]:_0x5cbcca[_0xcf16('0x41')];_0x50f968[_0xcf16('0x47')]=qs['sort'](_0x39304a[_0xcf16('0x3f')][_0xcf16('0x48')]);_0x50f968['where']=qs[_0xcf16('0x4a')](_['pick'](_0x39304a[_0xcf16('0x3f')],_0x5cbcca['filters']));if(_0x39304a[_0xcf16('0x3f')]['filter']){_0x50f968[_0xcf16('0x49')]=_[_0xcf16('0x4c')](_0x50f968[_0xcf16('0x49')],{'$or':_[_0xcf16('0x3b')](_0x50f968['attributes'],function(_0x56842d){var _0x1518f1={};_0x1518f1[_0x56842d]={'$like':'%'+_0x39304a[_0xcf16('0x3f')]['filter']+'%'};return _0x1518f1;})});}_0x50f968=_['merge']({},_0x50f968,_0x39304a['options']);return _0x4a9103['getDescriptions'](_0x50f968);}})['then'](function(_0x2ea657){if(_0x2ea657){_0x1d6747=_0x2ea657[_0xcf16('0x45')];if(!_0x39304a['query']['hasOwnProperty']('nolimit')){_0x50f968[_0xcf16('0x31')]=qs[_0xcf16('0x31')](_0x39304a[_0xcf16('0x3f')]['limit']);_0x50f968[_0xcf16('0x30')]=qs[_0xcf16('0x30')](_0x39304a[_0xcf16('0x3f')][_0xcf16('0x30')]);}return _0x4a9103[_0xcf16('0x5d')](_0x50f968);}})[_0xcf16('0x1f')](function(_0x11cc95){if(_0x11cc95){return _0x11cc95?{'count':_0x1d6747,'rows':_0x11cc95}:null;}})[_0xcf16('0x1f')](respondWithResult(_0x5dea15,null))[_0xcf16('0x2a')](handleError(_0x5dea15,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 17afa32..0790df5 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 _0xd967=['bluebird','request-promise','rimraf','../../config/environment','exports','define','VtigerConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x44251,_0x1b9d97){var _0x3b26e7=function(_0x589541){while(--_0x589541){_0x44251['push'](_0x44251['shift']());}};_0x3b26e7(++_0x1b9d97);}(_0xd967,0x16f));var _0x7d96=function(_0x4ffa03,_0x363a82){_0x4ffa03=_0x4ffa03-0x0;var _0x30d661=_0xd967[_0x4ffa03];return _0x30d661;};'use strict';var _=require(_0x7d96('0x0'));var util=require(_0x7d96('0x1'));var logger=require(_0x7d96('0x2'))(_0x7d96('0x3'));var moment=require(_0x7d96('0x4'));var BPromise=require(_0x7d96('0x5'));var rp=require(_0x7d96('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d96('0x7'));var config=require(_0x7d96('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x7d96('0x9')]=function(_0x343fdc,_0x132cbd){return _0x343fdc[_0x7d96('0xa')](_0x7d96('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7971=['int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','define'];(function(_0x4e5379,_0x421571){var _0xde535b=function(_0xa0df4f){while(--_0xa0df4f){_0x4e5379['push'](_0x4e5379['shift']());}};_0xde535b(++_0x421571);}(_0x7971,0x12d));var _0x1797=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x7971[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require(_0x1797('0x0'));var logger=require(_0x1797('0x1'))(_0x1797('0x2'));var moment=require(_0x1797('0x3'));var BPromise=require(_0x1797('0x4'));var rp=require(_0x1797('0x5'));var fs=require('fs');var path=require(_0x1797('0x6'));var rimraf=require(_0x1797('0x7'));var config=require('../../config/environment');var attributes=require(_0x1797('0x8'));module[_0x1797('0x9')]=function(_0x56dd42,_0x4bc203){return _0x56dd42[_0x1797('0xa')]('VtigerConfiguration',attributes,{'tableName':_0x1797('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 69f2aa9..fb05080 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 _0x65b4=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3ed4ad,_0xc112b5){var _0x5d2947=function(_0x2a1916){while(--_0x2a1916){_0x3ed4ad['push'](_0x3ed4ad['shift']());}};_0x5d2947(++_0xc112b5);}(_0x65b4,0xa4));var _0x465b=function(_0x2d4610,_0x2a038e){_0x2d4610=_0x2d4610-0x0;var _0x2a50b0=_0x65b4[_0x2d4610];return _0x2a50b0;};'use strict';var _=require('lodash');var util=require(_0x465b('0x0'));var moment=require(_0x465b('0x1'));var BPromise=require(_0x465b('0x2'));var rs=require(_0x465b('0x3'));var fs=require('fs');var Redis=require(_0x465b('0x4'));var db=require(_0x465b('0x5'))['db'];var utils=require(_0x465b('0x6'));var logger=require(_0x465b('0x7'))(_0x465b('0x8'));var config=require(_0x465b('0x9'));var jayson=require(_0x465b('0xa'));var client=jayson['client'][_0x465b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x217082,_0x184a02,_0x278375){return new BPromise(function(_0x2af17c,_0x102fdd){return client[_0x465b('0xc')](_0x217082,_0x278375)[_0x465b('0xd')](function(_0x140b02){logger[_0x465b('0xe')](_0x465b('0xf'),_0x184a02,_0x465b('0x10'));logger[_0x465b('0x11')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x184a02,_0x465b('0x10'),JSON[_0x465b('0x12')](_0x140b02));if(_0x140b02[_0x465b('0x13')]){if(_0x140b02[_0x465b('0x13')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x184a02,_0x140b02[_0x465b('0x13')]['message']);return _0x102fdd(_0x140b02[_0x465b('0x13')][_0x465b('0x14')]);}logger[_0x465b('0x13')](_0x465b('0xf'),_0x184a02,_0x140b02[_0x465b('0x13')][_0x465b('0x14')]);return _0x2af17c(_0x140b02[_0x465b('0x13')][_0x465b('0x14')]);}else{logger[_0x465b('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x184a02,_0x465b('0x10'));_0x2af17c(_0x140b02[_0x465b('0x15')][_0x465b('0x14')]);}})[_0x465b('0x16')](function(_0x43bc3c){logger[_0x465b('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x184a02,_0x43bc3c);_0x102fdd(_0x43bc3c);});});} \ No newline at end of file +var _0xeba4=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x25d3bf,_0x3391c0){var _0xd75b39=function(_0x2d5d43){while(--_0x2d5d43){_0x25d3bf['push'](_0x25d3bf['shift']());}};_0xd75b39(++_0x3391c0);}(_0xeba4,0x18c));var _0x4eba=function(_0x42a134,_0x1ec016){_0x42a134=_0x42a134-0x0;var _0x4d4fde=_0xeba4[_0x42a134];return _0x4d4fde;};'use strict';var _=require(_0x4eba('0x0'));var util=require(_0x4eba('0x1'));var moment=require('moment');var BPromise=require(_0x4eba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4eba('0x3'));var db=require(_0x4eba('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eba('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4eba('0x6'));var client=jayson[_0x4eba('0x7')][_0x4eba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b6c03,_0x22aaa1,_0xa20d57){return new BPromise(function(_0x6fc03a,_0x4c7d72){return client[_0x4eba('0x9')](_0x1b6c03,_0xa20d57)[_0x4eba('0xa')](function(_0x463a01){logger[_0x4eba('0xb')](_0x4eba('0xc'),_0x22aaa1,_0x4eba('0xd'));logger[_0x4eba('0xe')](_0x4eba('0xf'),_0x22aaa1,'request\x20sent',JSON[_0x4eba('0x10')](_0x463a01));if(_0x463a01[_0x4eba('0x11')]){if(_0x463a01['error'][_0x4eba('0x12')]===0x1f4){logger[_0x4eba('0x11')](_0x4eba('0xc'),_0x22aaa1,_0x463a01['error'][_0x4eba('0x13')]);return _0x4c7d72(_0x463a01[_0x4eba('0x11')][_0x4eba('0x13')]);}logger['error'](_0x4eba('0xc'),_0x22aaa1,_0x463a01[_0x4eba('0x11')]['message']);return _0x6fc03a(_0x463a01[_0x4eba('0x11')]['message']);}else{logger[_0x4eba('0xb')](_0x4eba('0xc'),_0x22aaa1,_0x4eba('0xd'));_0x6fc03a(_0x463a01[_0x4eba('0x14')][_0x4eba('0x13')]);}})[_0x4eba('0x15')](function(_0xed0313){logger[_0x4eba('0x11')](_0x4eba('0xc'),_0x22aaa1,_0xed0313);_0x4c7d72(_0xed0313);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 9e5ae6f..581ca7b 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 _0x2bfa=['express','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','update','delete','exports','multer','path','connect-timeout'];(function(_0x409e4f,_0x1bfc92){var _0x10af63=function(_0xac7b42){while(--_0xac7b42){_0x409e4f['push'](_0x409e4f['shift']());}};_0x10af63(++_0x1bfc92);}(_0x2bfa,0x15c));var _0xa2bf=function(_0x106315,_0x447952){_0x106315=_0x106315-0x0;var _0xbe2f49=_0x2bfa[_0x106315];return _0xbe2f49;};'use strict';var multer=require(_0xa2bf('0x0'));var util=require('util');var path=require(_0xa2bf('0x1'));var timeout=require(_0xa2bf('0x2'));var express=require(_0xa2bf('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa2bf('0x4'));var config=require(_0xa2bf('0x5'));var controller=require(_0xa2bf('0x6'));router[_0xa2bf('0x7')]('/',auth[_0xa2bf('0x8')](),controller['index']);router[_0xa2bf('0x7')](_0xa2bf('0x9'),auth[_0xa2bf('0x8')](),controller['show']);router['post']('/',auth[_0xa2bf('0x8')](),controller['create']);router['put'](_0xa2bf('0x9'),auth['isAuthenticated'](),controller[_0xa2bf('0xa')]);router[_0xa2bf('0xb')](_0xa2bf('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xa2bf('0xc')]=router; \ No newline at end of file +var _0x4c4a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x1e97a5,_0x37a2e9){var _0x42915d=function(_0x63f93b){while(--_0x63f93b){_0x1e97a5['push'](_0x1e97a5['shift']());}};_0x42915d(++_0x37a2e9);}(_0x4c4a,0xf6));var _0xa4c4=function(_0x54d5ba,_0x1f1ba9){_0x54d5ba=_0x54d5ba-0x0;var _0x6a592e=_0x4c4a[_0x54d5ba];return _0x6a592e;};'use strict';var multer=require('multer');var util=require(_0xa4c4('0x0'));var path=require('path');var timeout=require(_0xa4c4('0x1'));var express=require(_0xa4c4('0x2'));var router=express[_0xa4c4('0x3')]();var auth=require(_0xa4c4('0x4'));var interaction=require(_0xa4c4('0x5'));var config=require(_0xa4c4('0x6'));var controller=require(_0xa4c4('0x7'));router[_0xa4c4('0x8')]('/',auth[_0xa4c4('0x9')](),controller['index']);router[_0xa4c4('0x8')](_0xa4c4('0xa'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0xb')]);router[_0xa4c4('0xc')]('/',auth[_0xa4c4('0x9')](),controller[_0xa4c4('0xd')]);router[_0xa4c4('0xe')](_0xa4c4('0xa'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0xf')]);router[_0xa4c4('0x10')]('/:id',auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x11')]);module[_0xa4c4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3f2e95b..8903553 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 _0xabe8=['customVariable','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xabe8,0x8c));var _0x8abe=function(_0x47b2b8,_0x1ad11b){_0x47b2b8=_0x47b2b8-0x0;var _0x4bdf28=_0xabe8[_0x47b2b8];return _0x4bdf28;};'use strict';var Sequelize=require(_0x8abe('0x0'));module[_0x8abe('0x1')]={'type':{'type':Sequelize[_0x8abe('0x2')]('string',_0x8abe('0x3'),_0x8abe('0x4'),'keyValue'),'defaultValue':_0x8abe('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8abe('0x6')]},'keyType':{'type':Sequelize[_0x8abe('0x2')](_0x8abe('0x5'),_0x8abe('0x3'),_0x8abe('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8abe('0x6')]},'customField':{'type':Sequelize[_0x8abe('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8abe('0x6')]}}; \ No newline at end of file +var _0xcef4=['customVariable','keyValue','string','STRING','ENUM','variable','sequelize'];(function(_0x1867e3,_0x589b2d){var _0x4b22aa=function(_0x36a685){while(--_0x36a685){_0x1867e3['push'](_0x1867e3['shift']());}};_0x4b22aa(++_0x589b2d);}(_0xcef4,0x1e9));var _0x4cef=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0xcef4[_0x166e96];return _0x553d73;};'use strict';var Sequelize=require(_0x4cef('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x4cef('0x1'),_0x4cef('0x2')),'defaultValue':_0x4cef('0x3')},'content':{'type':Sequelize[_0x4cef('0x4')]},'key':{'type':Sequelize[_0x4cef('0x4')]},'keyType':{'type':Sequelize[_0x4cef('0x5')](_0x4cef('0x3'),_0x4cef('0x6'),_0x4cef('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4cef('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4cef('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 858eac8..a56e9f4 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 _0x1c6a=['bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','then','destroy','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','VtigerField','include','rows','catch','show','params','find','create','body','update','html-pdf','rimraf','zip-dir','request-promise','moment'];(function(_0x249ed2,_0x1f25d3){var _0x5a7127=function(_0x278315){while(--_0x278315){_0x249ed2['push'](_0x249ed2['shift']());}};_0x5a7127(++_0x1f25d3);}(_0x1c6a,0x154));var _0xa1c6=function(_0x4ea1b4,_0x4f21c3){_0x4ea1b4=_0x4ea1b4-0x0;var _0x440fd7=_0x1c6a[_0x4ea1b4];return _0x440fd7;};'use strict';var pdf=require(_0xa1c6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa1c6('0x1'));var zipdir=require(_0xa1c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c6('0x3'));var moment=require(_0xa1c6('0x4'));var BPromise=require(_0xa1c6('0x5'));var Mustache=require(_0xa1c6('0x6'));var util=require(_0xa1c6('0x7'));var path=require(_0xa1c6('0x8'));var sox=require('sox');var csv=require(_0xa1c6('0x9'));var ejs=require(_0xa1c6('0xa'));var fs=require('fs');var _=require(_0xa1c6('0xb'));var squel=require('squel');var crypto=require(_0xa1c6('0xc'));var jsforce=require(_0xa1c6('0xd'));var deskjs=require(_0xa1c6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa1c6('0xf'));var Papa=require(_0xa1c6('0x10'));var Redis=require(_0xa1c6('0x11'));var authService=require(_0xa1c6('0x12'));var qs=require(_0xa1c6('0x13'));var as=require(_0xa1c6('0x14'));var hardwareService=require(_0xa1c6('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa1c6('0x16'));var config=require(_0xa1c6('0x17'));var db=require(_0xa1c6('0x18'))['db'];function respondWithStatusCode(_0x1b5858,_0x51c92f){_0x51c92f=_0x51c92f||0xcc;return function(_0x41d289){if(_0x41d289){return _0x1b5858[_0xa1c6('0x19')](_0x51c92f);}return _0x1b5858['status'](_0x51c92f)[_0xa1c6('0x1a')]();};}function respondWithResult(_0x13c129,_0x5f1dbe){_0x5f1dbe=_0x5f1dbe||0xc8;return function(_0x524e3e){if(_0x524e3e){return _0x13c129[_0xa1c6('0x1b')](_0x5f1dbe)[_0xa1c6('0x1c')](_0x524e3e);}};}function respondWithFilteredResult(_0x106d80,_0x1a334e){return function(_0x261ae3){if(_0x261ae3){var _0x5e17f9=_0x261ae3[_0xa1c6('0x1d')],_0x11e9dd=_0x1a334e[_0xa1c6('0x1e')],_0x23efa3=_0x1a334e['offset']+_0x1a334e[_0xa1c6('0x1f')],_0x9ac511;if(_0x23efa3>=_0x5e17f9){_0x23efa3=_0x5e17f9;_0x9ac511=0xc8;}else{_0x9ac511=0xce;}_0x106d80[_0xa1c6('0x1b')](_0x9ac511);return _0x106d80['set']('Content-Range',_0x11e9dd+'-'+_0x23efa3+'/'+_0x5e17f9)[_0xa1c6('0x1c')](_0x261ae3);}return null;};}function patchUpdates(_0x19561d){return function(_0x2ac972){try{jsonpatch[_0xa1c6('0x20')](_0x2ac972,_0x19561d,!![]);}catch(_0x439388){return BPromise[_0xa1c6('0x21')](_0x439388);}return _0x2ac972['save']();};}function saveUpdates(_0x3ce3e3,_0xc532b8){return function(_0x39f6d9){if(_0x39f6d9){return _0x39f6d9['update'](_0x3ce3e3)[_0xa1c6('0x22')](function(_0x4c4723){return _0x4c4723;});}return null;};}function removeEntity(_0xab22a5,_0x2acb2c){return function(_0xeed334){if(_0xeed334){return _0xeed334[_0xa1c6('0x23')]()[_0xa1c6('0x22')](function(){_0xab22a5[_0xa1c6('0x1b')](0xcc)[_0xa1c6('0x1a')]();});}};}function handleEntityNotFound(_0x4ff952,_0x33dffb){return function(_0x471dcd){if(!_0x471dcd){_0x4ff952['sendStatus'](0x194);}return _0x471dcd;};}function handleError(_0x2f95cb,_0x54c642){_0x54c642=_0x54c642||0x1f4;return function(_0x33aa43){logger['error'](_0x33aa43[_0xa1c6('0x24')]);if(_0x33aa43[_0xa1c6('0x25')]){delete _0x33aa43['name'];}_0x2f95cb[_0xa1c6('0x1b')](_0x54c642)[_0xa1c6('0x26')](_0x33aa43);};}exports['index']=function(_0x34a863,_0x460c16){var _0xc8b39a={},_0x5c6644={},_0x5ce45d={'count':0x0,'rows':[]};var _0x1c3e8f=_[_0xa1c6('0x27')](db['VtigerField'][_0xa1c6('0x28')],function(_0x1fc2a5){return{'name':_0x1fc2a5[_0xa1c6('0x29')],'type':_0x1fc2a5['type'][_0xa1c6('0x2a')]};});_0x5c6644[_0xa1c6('0x2b')]=_[_0xa1c6('0x27')](_0x1c3e8f,_0xa1c6('0x25'));_0x5c6644[_0xa1c6('0x2c')]=_[_0xa1c6('0x2d')](_0x34a863['query']);_0x5c6644['filters']=_[_0xa1c6('0x2e')](_0x5c6644[_0xa1c6('0x2b')],_0x5c6644['query']);_0xc8b39a[_0xa1c6('0x2f')]=_['intersection'](_0x5c6644[_0xa1c6('0x2b')],qs[_0xa1c6('0x30')](_0x34a863[_0xa1c6('0x2c')][_0xa1c6('0x30')]));_0xc8b39a['attributes']=_0xc8b39a[_0xa1c6('0x2f')][_0xa1c6('0x31')]?_0xc8b39a['attributes']:_0x5c6644[_0xa1c6('0x2b')];if(!_0x34a863[_0xa1c6('0x2c')][_0xa1c6('0x32')](_0xa1c6('0x33'))){_0xc8b39a[_0xa1c6('0x1f')]=qs[_0xa1c6('0x1f')](_0x34a863[_0xa1c6('0x2c')][_0xa1c6('0x1f')]);_0xc8b39a['offset']=qs[_0xa1c6('0x1e')](_0x34a863[_0xa1c6('0x2c')][_0xa1c6('0x1e')]);}_0xc8b39a['order']=qs[_0xa1c6('0x34')](_0x34a863[_0xa1c6('0x2c')][_0xa1c6('0x34')]);_0xc8b39a[_0xa1c6('0x35')]=qs[_0xa1c6('0x36')](_[_0xa1c6('0x37')](_0x34a863[_0xa1c6('0x2c')],_0x5c6644[_0xa1c6('0x36')]),_0x1c3e8f);if(_0x34a863['query'][_0xa1c6('0x38')]){_0xc8b39a[_0xa1c6('0x35')]=_['merge'](_0xc8b39a[_0xa1c6('0x35')],{'$or':_['map'](_0x1c3e8f,function(_0x3a6739){if(_0x3a6739['type']!=='VIRTUAL'){var _0x19de2d={};_0x19de2d[_0x3a6739[_0xa1c6('0x25')]]={'$like':'%'+_0x34a863[_0xa1c6('0x2c')]['filter']+'%'};return _0x19de2d;}})});}_0xc8b39a=_[_0xa1c6('0x39')]({},_0xc8b39a,_0x34a863[_0xa1c6('0x3a')]);var _0x3d2848={'where':_0xc8b39a[_0xa1c6('0x35')]};return db[_0xa1c6('0x3b')][_0xa1c6('0x1d')](_0x3d2848)[_0xa1c6('0x22')](function(_0x5ce5fb){_0x5ce45d[_0xa1c6('0x1d')]=_0x5ce5fb;if(_0x34a863['query']['includeAll']){_0xc8b39a[_0xa1c6('0x3c')]=[{'all':!![]}];}return db[_0xa1c6('0x3b')]['findAll'](_0xc8b39a);})['then'](function(_0x1928d8){_0x5ce45d[_0xa1c6('0x3d')]=_0x1928d8;return _0x5ce45d;})[_0xa1c6('0x22')](respondWithFilteredResult(_0x460c16,_0xc8b39a))[_0xa1c6('0x3e')](handleError(_0x460c16,null));};exports[_0xa1c6('0x3f')]=function(_0x19feb6,_0x2ae05b){var _0x4d91c8={'raw':!![],'where':{'id':_0x19feb6[_0xa1c6('0x40')]['id']}},_0x53fbc2={};_0x53fbc2[_0xa1c6('0x2b')]=_[_0xa1c6('0x2d')](db['VtigerField'][_0xa1c6('0x28')]);_0x53fbc2[_0xa1c6('0x2c')]=_['keys'](_0x19feb6[_0xa1c6('0x2c')]);_0x53fbc2[_0xa1c6('0x36')]=_['intersection'](_0x53fbc2[_0xa1c6('0x2b')],_0x53fbc2[_0xa1c6('0x2c')]);_0x4d91c8[_0xa1c6('0x2f')]=_[_0xa1c6('0x2e')](_0x53fbc2[_0xa1c6('0x2b')],qs[_0xa1c6('0x30')](_0x19feb6[_0xa1c6('0x2c')][_0xa1c6('0x30')]));_0x4d91c8[_0xa1c6('0x2f')]=_0x4d91c8[_0xa1c6('0x2f')][_0xa1c6('0x31')]?_0x4d91c8[_0xa1c6('0x2f')]:_0x53fbc2[_0xa1c6('0x2b')];if(_0x19feb6[_0xa1c6('0x2c')]['includeAll']){_0x4d91c8[_0xa1c6('0x3c')]=[{'all':!![]}];}_0x4d91c8=_['merge']({},_0x4d91c8,_0x19feb6[_0xa1c6('0x3a')]);return db[_0xa1c6('0x3b')][_0xa1c6('0x41')](_0x4d91c8)[_0xa1c6('0x22')](handleEntityNotFound(_0x2ae05b,null))[_0xa1c6('0x22')](respondWithResult(_0x2ae05b,null))['catch'](handleError(_0x2ae05b,null));};exports[_0xa1c6('0x42')]=function(_0x572128,_0x4b330b){return db[_0xa1c6('0x3b')]['create'](_0x572128[_0xa1c6('0x43')],{})[_0xa1c6('0x22')](respondWithResult(_0x4b330b,0xc9))[_0xa1c6('0x3e')](handleError(_0x4b330b,null));};exports[_0xa1c6('0x44')]=function(_0x54fd71,_0x139833){if(_0x54fd71['body']['id']){delete _0x54fd71[_0xa1c6('0x43')]['id'];}return db[_0xa1c6('0x3b')][_0xa1c6('0x41')]({'where':{'id':_0x54fd71['params']['id']}})[_0xa1c6('0x22')](handleEntityNotFound(_0x139833,null))[_0xa1c6('0x22')](saveUpdates(_0x54fd71['body'],null))[_0xa1c6('0x22')](respondWithResult(_0x139833,null))[_0xa1c6('0x3e')](handleError(_0x139833,null));};exports['destroy']=function(_0x49f418,_0x17a7a3){return db[_0xa1c6('0x3b')][_0xa1c6('0x41')]({'where':{'id':_0x49f418[_0xa1c6('0x40')]['id']}})['then'](handleEntityNotFound(_0x17a7a3,null))[_0xa1c6('0x22')](removeEntity(_0x17a7a3,null))[_0xa1c6('0x3e')](handleError(_0x17a7a3,null));}; \ No newline at end of file +var _0x15ec=['keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','count','includeAll','rows','catch','show','params'];(function(_0x23867a,_0x2b39a4){var _0x591a7e=function(_0x1ec2ad){while(--_0x1ec2ad){_0x23867a['push'](_0x23867a['shift']());}};_0x591a7e(++_0x2b39a4);}(_0x15ec,0x16c));var _0xc15e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x15ec[_0x433a86];return _0x23000c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc15e('0x0'));var rimraf=require(_0xc15e('0x1'));var zipdir=require(_0xc15e('0x2'));var jsonpatch=require(_0xc15e('0x3'));var rp=require(_0xc15e('0x4'));var moment=require(_0xc15e('0x5'));var BPromise=require(_0xc15e('0x6'));var Mustache=require(_0xc15e('0x7'));var util=require(_0xc15e('0x8'));var path=require(_0xc15e('0x9'));var sox=require(_0xc15e('0xa'));var csv=require('to-csv');var ejs=require(_0xc15e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc15e('0xc'));var crypto=require(_0xc15e('0xd'));var jsforce=require(_0xc15e('0xe'));var deskjs=require(_0xc15e('0xf'));var toCsv=require(_0xc15e('0x10'));var querystring=require('querystring');var Papa=require(_0xc15e('0x11'));var Redis=require(_0xc15e('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc15e('0x13'));var hardwareService=require(_0xc15e('0x14'));var logger=require(_0xc15e('0x15'))('api');var utils=require(_0xc15e('0x16'));var config=require(_0xc15e('0x17'));var db=require(_0xc15e('0x18'))['db'];function respondWithStatusCode(_0x5107ff,_0x19ab2f){_0x19ab2f=_0x19ab2f||0xcc;return function(_0x16da50){if(_0x16da50){return _0x5107ff[_0xc15e('0x19')](_0x19ab2f);}return _0x5107ff[_0xc15e('0x1a')](_0x19ab2f)['end']();};}function respondWithResult(_0x4b61e3,_0x407dd7){_0x407dd7=_0x407dd7||0xc8;return function(_0x4e7b9d){if(_0x4e7b9d){return _0x4b61e3[_0xc15e('0x1a')](_0x407dd7)[_0xc15e('0x1b')](_0x4e7b9d);}};}function respondWithFilteredResult(_0x1cc037,_0x4b98dd){return function(_0x7d4735){if(_0x7d4735){var _0x37bf50=_0x7d4735['count'],_0x1eb040=_0x4b98dd[_0xc15e('0x1c')],_0x3401bf=_0x4b98dd[_0xc15e('0x1c')]+_0x4b98dd[_0xc15e('0x1d')],_0x27dda5;if(_0x3401bf>=_0x37bf50){_0x3401bf=_0x37bf50;_0x27dda5=0xc8;}else{_0x27dda5=0xce;}_0x1cc037['status'](_0x27dda5);return _0x1cc037[_0xc15e('0x1e')](_0xc15e('0x1f'),_0x1eb040+'-'+_0x3401bf+'/'+_0x37bf50)['json'](_0x7d4735);}return null;};}function patchUpdates(_0x11d1ce){return function(_0x5083f2){try{jsonpatch['apply'](_0x5083f2,_0x11d1ce,!![]);}catch(_0x1dd2f2){return BPromise[_0xc15e('0x20')](_0x1dd2f2);}return _0x5083f2['save']();};}function saveUpdates(_0x31581d,_0x76c281){return function(_0x37d2d1){if(_0x37d2d1){return _0x37d2d1[_0xc15e('0x21')](_0x31581d)['then'](function(_0xe83efa){return _0xe83efa;});}return null;};}function removeEntity(_0x663f8,_0x2e4ef6){return function(_0xa2527){if(_0xa2527){return _0xa2527[_0xc15e('0x22')]()[_0xc15e('0x23')](function(){_0x663f8[_0xc15e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15beb7,_0x49e7ee){return function(_0x4e03c8){if(!_0x4e03c8){_0x15beb7[_0xc15e('0x19')](0x194);}return _0x4e03c8;};}function handleError(_0x55a424,_0x427a41){_0x427a41=_0x427a41||0x1f4;return function(_0x1c83b9){logger[_0xc15e('0x24')](_0x1c83b9[_0xc15e('0x25')]);if(_0x1c83b9[_0xc15e('0x26')]){delete _0x1c83b9[_0xc15e('0x26')];}_0x55a424[_0xc15e('0x1a')](_0x427a41)[_0xc15e('0x27')](_0x1c83b9);};}exports[_0xc15e('0x28')]=function(_0x58961c,_0x2c0377){var _0x5b04c6={},_0x29f6c7={},_0x152454={'count':0x0,'rows':[]};var _0x32010b=_[_0xc15e('0x29')](db[_0xc15e('0x2a')][_0xc15e('0x2b')],function(_0x39c470){return{'name':_0x39c470[_0xc15e('0x2c')],'type':_0x39c470['type'][_0xc15e('0x2d')]};});_0x29f6c7['model']=_['map'](_0x32010b,_0xc15e('0x26'));_0x29f6c7[_0xc15e('0x2e')]=_['keys'](_0x58961c[_0xc15e('0x2e')]);_0x29f6c7[_0xc15e('0x2f')]=_[_0xc15e('0x30')](_0x29f6c7[_0xc15e('0x31')],_0x29f6c7[_0xc15e('0x2e')]);_0x5b04c6['attributes']=_[_0xc15e('0x30')](_0x29f6c7[_0xc15e('0x31')],qs[_0xc15e('0x32')](_0x58961c['query'][_0xc15e('0x32')]));_0x5b04c6[_0xc15e('0x33')]=_0x5b04c6[_0xc15e('0x33')][_0xc15e('0x34')]?_0x5b04c6[_0xc15e('0x33')]:_0x29f6c7[_0xc15e('0x31')];if(!_0x58961c['query'][_0xc15e('0x35')]('nolimit')){_0x5b04c6[_0xc15e('0x1d')]=qs['limit'](_0x58961c[_0xc15e('0x2e')]['limit']);_0x5b04c6[_0xc15e('0x1c')]=qs[_0xc15e('0x1c')](_0x58961c['query'][_0xc15e('0x1c')]);}_0x5b04c6[_0xc15e('0x36')]=qs['sort'](_0x58961c[_0xc15e('0x2e')][_0xc15e('0x37')]);_0x5b04c6[_0xc15e('0x38')]=qs[_0xc15e('0x2f')](_[_0xc15e('0x39')](_0x58961c[_0xc15e('0x2e')],_0x29f6c7['filters']),_0x32010b);if(_0x58961c[_0xc15e('0x2e')]['filter']){_0x5b04c6[_0xc15e('0x38')]=_['merge'](_0x5b04c6[_0xc15e('0x38')],{'$or':_[_0xc15e('0x29')](_0x32010b,function(_0x26785b){if(_0x26785b[_0xc15e('0x3a')]!==_0xc15e('0x3b')){var _0x20f988={};_0x20f988[_0x26785b[_0xc15e('0x26')]]={'$like':'%'+_0x58961c[_0xc15e('0x2e')]['filter']+'%'};return _0x20f988;}})});}_0x5b04c6=_[_0xc15e('0x3c')]({},_0x5b04c6,_0x58961c[_0xc15e('0x3d')]);var _0x2d3087={'where':_0x5b04c6[_0xc15e('0x38')]};return db[_0xc15e('0x2a')][_0xc15e('0x3e')](_0x2d3087)[_0xc15e('0x23')](function(_0x1c432b){_0x152454[_0xc15e('0x3e')]=_0x1c432b;if(_0x58961c[_0xc15e('0x2e')][_0xc15e('0x3f')]){_0x5b04c6['include']=[{'all':!![]}];}return db[_0xc15e('0x2a')]['findAll'](_0x5b04c6);})[_0xc15e('0x23')](function(_0x349162){_0x152454[_0xc15e('0x40')]=_0x349162;return _0x152454;})[_0xc15e('0x23')](respondWithFilteredResult(_0x2c0377,_0x5b04c6))[_0xc15e('0x41')](handleError(_0x2c0377,null));};exports[_0xc15e('0x42')]=function(_0xb96a5e,_0x5205df){var _0x1b319d={'raw':!![],'where':{'id':_0xb96a5e[_0xc15e('0x43')]['id']}},_0x12ae24={};_0x12ae24[_0xc15e('0x31')]=_[_0xc15e('0x44')](db['VtigerField'][_0xc15e('0x2b')]);_0x12ae24[_0xc15e('0x2e')]=_['keys'](_0xb96a5e[_0xc15e('0x2e')]);_0x12ae24['filters']=_['intersection'](_0x12ae24[_0xc15e('0x31')],_0x12ae24[_0xc15e('0x2e')]);_0x1b319d[_0xc15e('0x33')]=_[_0xc15e('0x30')](_0x12ae24[_0xc15e('0x31')],qs[_0xc15e('0x32')](_0xb96a5e[_0xc15e('0x2e')][_0xc15e('0x32')]));_0x1b319d['attributes']=_0x1b319d[_0xc15e('0x33')][_0xc15e('0x34')]?_0x1b319d['attributes']:_0x12ae24[_0xc15e('0x31')];if(_0xb96a5e[_0xc15e('0x2e')][_0xc15e('0x3f')]){_0x1b319d['include']=[{'all':!![]}];}_0x1b319d=_[_0xc15e('0x3c')]({},_0x1b319d,_0xb96a5e[_0xc15e('0x3d')]);return db['VtigerField'][_0xc15e('0x45')](_0x1b319d)[_0xc15e('0x23')](handleEntityNotFound(_0x5205df,null))[_0xc15e('0x23')](respondWithResult(_0x5205df,null))[_0xc15e('0x41')](handleError(_0x5205df,null));};exports[_0xc15e('0x46')]=function(_0x4f22b7,_0x324bbd){return db[_0xc15e('0x2a')][_0xc15e('0x46')](_0x4f22b7['body'],{})[_0xc15e('0x23')](respondWithResult(_0x324bbd,0xc9))[_0xc15e('0x41')](handleError(_0x324bbd,null));};exports['update']=function(_0x3750c9,_0xf51063){if(_0x3750c9[_0xc15e('0x47')]['id']){delete _0x3750c9[_0xc15e('0x47')]['id'];}return db[_0xc15e('0x2a')]['find']({'where':{'id':_0x3750c9[_0xc15e('0x43')]['id']}})[_0xc15e('0x23')](handleEntityNotFound(_0xf51063,null))[_0xc15e('0x23')](saveUpdates(_0x3750c9[_0xc15e('0x47')],null))[_0xc15e('0x23')](respondWithResult(_0xf51063,null))[_0xc15e('0x41')](handleError(_0xf51063,null));};exports[_0xc15e('0x22')]=function(_0xeeda6,_0x5b752f){return db[_0xc15e('0x2a')][_0xc15e('0x45')]({'where':{'id':_0xeeda6[_0xc15e('0x43')]['id']}})['then'](handleEntityNotFound(_0x5b752f,null))[_0xc15e('0x23')](removeEntity(_0x5b752f,null))['catch'](handleError(_0x5b752f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 3362d21..ae987ed 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 _0x9c44=['VtigerField','int_vtiger_fields','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerField.attributes','define'];(function(_0x3ed367,_0x36ecef){var _0x38ef61=function(_0x206705){while(--_0x206705){_0x3ed367['push'](_0x3ed367['shift']());}};_0x38ef61(++_0x36ecef);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x49c4('0xa'),_0x49c4('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','VtigerField','idField','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports'];(function(_0x14384f,_0x1797fe){var _0x409b8e=function(_0xb4e11c){while(--_0xb4e11c){_0x14384f['push'](_0x14384f['shift']());}};_0x409b8e(++_0x1797fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x0a9e('0xb'),'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 1f3c62f..4398eff 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 _0x7633=['request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x7633,0x1c4));var _0x3763=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7633[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x3763('0x0'));var util=require(_0x3763('0x1'));var moment=require(_0x3763('0x2'));var BPromise=require(_0x3763('0x3'));var rs=require(_0x3763('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3763('0x5'))['db'];var utils=require(_0x3763('0x6'));var logger=require('../../config/logger')(_0x3763('0x7'));var config=require(_0x3763('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3763('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8a2d3e,_0x28f9b0,_0x335382){return new BPromise(function(_0x50b634,_0x550b39){return client[_0x3763('0xa')](_0x8a2d3e,_0x335382)[_0x3763('0xb')](function(_0x4aa292){logger[_0x3763('0xc')](_0x3763('0xd'),_0x28f9b0,_0x3763('0xe'));logger[_0x3763('0xf')](_0x3763('0x10'),_0x28f9b0,_0x3763('0xe'),JSON[_0x3763('0x11')](_0x4aa292));if(_0x4aa292[_0x3763('0x12')]){if(_0x4aa292['error'][_0x3763('0x13')]===0x1f4){logger[_0x3763('0x12')](_0x3763('0xd'),_0x28f9b0,_0x4aa292['error']['message']);return _0x550b39(_0x4aa292[_0x3763('0x12')]['message']);}logger[_0x3763('0x12')](_0x3763('0xd'),_0x28f9b0,_0x4aa292[_0x3763('0x12')][_0x3763('0x14')]);return _0x50b634(_0x4aa292[_0x3763('0x12')][_0x3763('0x14')]);}else{logger[_0x3763('0xc')]('VtigerField,\x20%s,\x20%s',_0x28f9b0,_0x3763('0xe'));_0x50b634(_0x4aa292[_0x3763('0x15')][_0x3763('0x14')]);}})['catch'](function(_0x4dde36){logger['error'](_0x3763('0xd'),_0x28f9b0,_0x4dde36);_0x550b39(_0x4dde36);});});} \ No newline at end of file +var _0xf12a=['info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xf12a,0x8e));var _0xaf12=function(_0x4883cb,_0x3df63c){_0x4883cb=_0x4883cb-0x0;var _0x33aad7=_0xf12a[_0x4883cb];return _0x33aad7;};'use strict';var _=require(_0xaf12('0x0'));var util=require(_0xaf12('0x1'));var moment=require(_0xaf12('0x2'));var BPromise=require(_0xaf12('0x3'));var rs=require(_0xaf12('0x4'));var fs=require('fs');var Redis=require(_0xaf12('0x5'));var db=require(_0xaf12('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf12('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf12('0x8'));var client=jayson['client'][_0xaf12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x581819,_0x38389d,_0x418c64){return new BPromise(function(_0x3b6626,_0xff1952){return client[_0xaf12('0xa')](_0x581819,_0x418c64)[_0xaf12('0xb')](function(_0x3d733d){logger[_0xaf12('0xc')]('VtigerField,\x20%s,\x20%s',_0x38389d,_0xaf12('0xd'));logger['debug'](_0xaf12('0xe'),_0x38389d,'request\x20sent',JSON[_0xaf12('0xf')](_0x3d733d));if(_0x3d733d['error']){if(_0x3d733d['error'][_0xaf12('0x10')]===0x1f4){logger[_0xaf12('0x11')](_0xaf12('0x12'),_0x38389d,_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);return _0xff1952(_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);}logger[_0xaf12('0x11')](_0xaf12('0x12'),_0x38389d,_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);return _0x3b6626(_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);}else{logger[_0xaf12('0xc')](_0xaf12('0x12'),_0x38389d,_0xaf12('0xd'));_0x3b6626(_0x3d733d[_0xaf12('0x14')]['message']);}})[_0xaf12('0x15')](function(_0x31a420){logger['error']('VtigerField,\x20%s,\x20%s',_0x38389d,_0x31a420);_0xff1952(_0x31a420);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 88f588c..bd4e2bb 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 _0xcbc7=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x206ec3,_0x18cda4){var _0x1c57fa=function(_0xf653a0){while(--_0xf653a0){_0x206ec3['push'](_0x206ec3['shift']());}};_0x1c57fa(++_0x18cda4);}(_0xcbc7,0x13f));var _0x7cbc=function(_0x3b5a4a,_0x4096e5){_0x3b5a4a=_0x3b5a4a-0x0;var _0xaaec44=_0xcbc7[_0x3b5a4a];return _0xaaec44;};'use strict';var multer=require('multer');var util=require(_0x7cbc('0x0'));var path=require(_0x7cbc('0x1'));var timeout=require(_0x7cbc('0x2'));var express=require(_0x7cbc('0x3'));var router=express[_0x7cbc('0x4')]();var auth=require(_0x7cbc('0x5'));var interaction=require(_0x7cbc('0x6'));var config=require(_0x7cbc('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x7cbc('0x8')]('/',auth[_0x7cbc('0x9')](),controller[_0x7cbc('0xa')]);router[_0x7cbc('0x8')](_0x7cbc('0xb'),auth[_0x7cbc('0x9')](),controller['show']);router[_0x7cbc('0x8')](_0x7cbc('0xc'),auth[_0x7cbc('0x9')](),controller[_0x7cbc('0xd')]);router[_0x7cbc('0x8')](_0x7cbc('0xe'),auth['isAuthenticated'](),controller[_0x7cbc('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7cbc('0x10')]);router[_0x7cbc('0x11')](_0x7cbc('0xc'),auth['isAuthenticated'](),controller[_0x7cbc('0x12')]);router[_0x7cbc('0x13')](_0x7cbc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x7cbc('0x14')](_0x7cbc('0xb'),auth[_0x7cbc('0x9')](),controller[_0x7cbc('0x15')]);module[_0x7cbc('0x16')]=router; \ No newline at end of file +var _0x4572=['create','addConfiguration','/:id','update','destroy','util','path','connect-timeout','Router','../../components/auth/service','./intZendeskAccount.controller','isAuthenticated','index','show','/:id/configurations','getConfigurations','get','/:id/fields','getFields','post'];(function(_0x164ef5,_0xba6238){var _0x2d60c5=function(_0x34deca){while(--_0x34deca){_0x164ef5['push'](_0x164ef5['shift']());}};_0x2d60c5(++_0xba6238);}(_0x4572,0xe1));var _0x2457=function(_0x71cd05,_0x36ac11){_0x71cd05=_0x71cd05-0x0;var _0x59c9e7=_0x4572[_0x71cd05];return _0x59c9e7;};'use strict';var multer=require('multer');var util=require(_0x2457('0x0'));var path=require(_0x2457('0x1'));var timeout=require(_0x2457('0x2'));var express=require('express');var router=express[_0x2457('0x3')]();var auth=require(_0x2457('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2457('0x5'));router['get']('/',auth[_0x2457('0x6')](),controller[_0x2457('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2457('0x8')]);router['get'](_0x2457('0x9'),auth[_0x2457('0x6')](),controller[_0x2457('0xa')]);router[_0x2457('0xb')](_0x2457('0xc'),auth[_0x2457('0x6')](),controller[_0x2457('0xd')]);router[_0x2457('0xe')]('/',auth['isAuthenticated'](),controller[_0x2457('0xf')]);router[_0x2457('0xe')](_0x2457('0x9'),auth[_0x2457('0x6')](),controller[_0x2457('0x10')]);router['put'](_0x2457('0x11'),auth[_0x2457('0x6')](),controller[_0x2457('0x12')]);router['delete'](_0x2457('0x11'),auth[_0x2457('0x6')](),controller[_0x2457('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index f886786..43cac86 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 _0x7657=['STRING','remoteUri','ENUM','token','integrationTab','newTab','exports'];(function(_0x4b5409,_0x472b71){var _0x90b623=function(_0x596445){while(--_0x596445){_0x4b5409['push'](_0x4b5409['shift']());}};_0x90b623(++_0x472b71);}(_0x7657,0x179));var _0x7765=function(_0x160c10,_0x1aa3d5){_0x160c10=_0x160c10-0x0;var _0x592b83=_0x7657[_0x160c10];return _0x592b83;};'use strict';var Sequelize=require('sequelize');module[_0x7765('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7765('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x7765('0x1')]},'remoteUri':{'type':Sequelize[_0x7765('0x1')],'unique':_0x7765('0x2')},'authType':{'type':Sequelize[_0x7765('0x3')]('password',_0x7765('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7765('0x3')](_0x7765('0x5'),_0x7765('0x6')),'defaultValue':_0x7765('0x5')}}; \ No newline at end of file +var _0xb7cf=['integrationTab','sequelize','exports','STRING','username','ENUM','password','newTab'];(function(_0x1aa4ae,_0x199535){var _0x1671bf=function(_0x419312){while(--_0x419312){_0x1aa4ae['push'](_0x1aa4ae['shift']());}};_0x1671bf(++_0x199535);}(_0xb7cf,0x151));var _0xfb7c=function(_0x89100d,_0x59c43d){_0x89100d=_0x89100d-0x0;var _0x15974a=_0xb7cf[_0x89100d];return _0x15974a;};'use strict';var Sequelize=require(_0xfb7c('0x0'));module[_0xfb7c('0x1')]={'name':{'type':Sequelize[_0xfb7c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfb7c('0x2')],'unique':_0xfb7c('0x3')},'password':{'type':Sequelize[_0xfb7c('0x2')]},'token':{'type':Sequelize[_0xfb7c('0x2')]},'remoteUri':{'type':Sequelize[_0xfb7c('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xfb7c('0x4')](_0xfb7c('0x5'),'token'),'defaultValue':_0xfb7c('0x5')},'serverUrl':{'type':Sequelize[_0xfb7c('0x2')]},'type':{'type':Sequelize[_0xfb7c('0x4')]('integrationTab',_0xfb7c('0x6')),'defaultValue':_0xfb7c('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 9bc0fc6..c25eedd 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 _0xca74=['map','ZendeskAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','getConfigurations','pick','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','includes','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','name','send'];(function(_0x5934e1,_0x53e2f3){var _0x40d296=function(_0x29208a){while(--_0x29208a){_0x5934e1['push'](_0x5934e1['shift']());}};_0x40d296(++_0x53e2f3);}(_0xca74,0xca));var _0x4ca7=function(_0x32be74,_0x1c6d78){_0x32be74=_0x32be74-0x0;var _0x59407f=_0xca74[_0x32be74];return _0x59407f;};'use strict';var pdf=require(_0x4ca7('0x0'));var emlformat=require(_0x4ca7('0x1'));var rimraf=require(_0x4ca7('0x2'));var zipdir=require(_0x4ca7('0x3'));var jsonpatch=require(_0x4ca7('0x4'));var rp=require('request-promise');var moment=require(_0x4ca7('0x5'));var BPromise=require(_0x4ca7('0x6'));var Mustache=require(_0x4ca7('0x7'));var util=require(_0x4ca7('0x8'));var path=require(_0x4ca7('0x9'));var sox=require(_0x4ca7('0xa'));var csv=require(_0x4ca7('0xb'));var ejs=require(_0x4ca7('0xc'));var fs=require('fs');var _=require(_0x4ca7('0xd'));var squel=require(_0x4ca7('0xe'));var crypto=require(_0x4ca7('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4ca7('0x10'));var toCsv=require(_0x4ca7('0xb'));var querystring=require(_0x4ca7('0x11'));var Papa=require(_0x4ca7('0x12'));var Redis=require('ioredis');var authService=require(_0x4ca7('0x13'));var qs=require(_0x4ca7('0x14'));var as=require(_0x4ca7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ca7('0x16'))(_0x4ca7('0x17'));var utils=require('../../config/utils');var config=require(_0x4ca7('0x18'));var db=require(_0x4ca7('0x19'))['db'];var integrations=require(_0x4ca7('0x1a'));var jayson=require(_0x4ca7('0x1b'));var client=jayson[_0x4ca7('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x296ebf,_0x4812d3,_0x3da19c){if(_0x3da19c){var _0x1cfbde=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1cfbde['test'](_0x4812d3)){return _0x296ebf;}else{throw new db[(_0x4ca7('0x1d'))][(_0x4ca7('0x1e'))](_0x4ca7('0x1f'));}}else{return _0x296ebf;}}function respondWithRpcPromise(_0x13acce,_0x420711,_0x18d85,_0x40bfac){return new BPromise(function(_0x568357,_0x6781e9){var _0x2242d3=_0x40bfac||client;return _0x2242d3['request'](_0x13acce,_0x18d85)['then'](function(_0x3cdfd9){logger['info'](_0x4ca7('0x20'),_0x420711,_0x4ca7('0x21'));logger[_0x4ca7('0x22')](_0x4ca7('0x23'),_0x420711,_0x4ca7('0x21'),JSON[_0x4ca7('0x24')](_0x3cdfd9));if(_0x3cdfd9[_0x4ca7('0x25')]){if(_0x3cdfd9[_0x4ca7('0x25')]['code']===0x1f4){logger[_0x4ca7('0x25')]('ZendeskAccount,\x20%s,\x20%s',_0x420711,_0x3cdfd9['error'][_0x4ca7('0x26')]);return _0x6781e9(_0x3cdfd9['error']['message']);}logger[_0x4ca7('0x25')](_0x4ca7('0x20'),_0x420711,_0x3cdfd9[_0x4ca7('0x25')][_0x4ca7('0x26')]);return _0x568357(_0x3cdfd9[_0x4ca7('0x25')]['message']);}else{logger[_0x4ca7('0x27')]('ZendeskAccount,\x20%s,\x20%s',_0x420711,'request\x20sent');_0x568357(_0x3cdfd9[_0x4ca7('0x28')][_0x4ca7('0x26')]);}})['catch'](function(_0x10ef28){logger[_0x4ca7('0x25')](_0x4ca7('0x20'),_0x420711,_0x10ef28);_0x6781e9(_0x10ef28);});});}function respondWithStatusCode(_0x2fa382,_0x22fc29){_0x22fc29=_0x22fc29||0xcc;return function(_0x2e163a){if(_0x2e163a){return _0x2fa382[_0x4ca7('0x29')](_0x22fc29);}return _0x2fa382['status'](_0x22fc29)['end']();};}function respondWithResult(_0x32c228,_0x96913e){_0x96913e=_0x96913e||0xc8;return function(_0x13db51){if(_0x13db51){return _0x32c228[_0x4ca7('0x2a')](_0x96913e)[_0x4ca7('0x2b')](_0x13db51);}};}function respondWithFilteredResult(_0x5a8296,_0x4de5f2){return function(_0x177506){if(_0x177506){var _0x153391=_0x177506[_0x4ca7('0x2c')],_0x2fb99d=_0x4de5f2[_0x4ca7('0x2d')],_0xcb0d96=_0x4de5f2[_0x4ca7('0x2d')]+_0x4de5f2[_0x4ca7('0x2e')],_0x3bc6ca;if(_0xcb0d96>=_0x153391){_0xcb0d96=_0x153391;_0x3bc6ca=0xc8;}else{_0x3bc6ca=0xce;}_0x5a8296[_0x4ca7('0x2a')](_0x3bc6ca);return _0x5a8296[_0x4ca7('0x2f')](_0x4ca7('0x30'),_0x2fb99d+'-'+_0xcb0d96+'/'+_0x153391)[_0x4ca7('0x2b')](_0x177506);}return null;};}function patchUpdates(_0xa3a313){return function(_0x5a273b){try{jsonpatch[_0x4ca7('0x31')](_0x5a273b,_0xa3a313,!![]);}catch(_0x58d639){return BPromise['reject'](_0x58d639);}return _0x5a273b[_0x4ca7('0x32')]();};}function saveUpdates(_0x458636,_0x2de525){return function(_0x42d757){if(_0x42d757){return _0x42d757[_0x4ca7('0x33')](_0x458636)[_0x4ca7('0x34')](function(_0x2baede){return _0x2baede;});}return null;};}function removeEntity(_0x4a2a77,_0x41d40b){return function(_0x571d18){if(_0x571d18){return _0x571d18[_0x4ca7('0x35')]()[_0x4ca7('0x34')](function(){_0x4a2a77[_0x4ca7('0x2a')](0xcc)[_0x4ca7('0x36')]();});}};}function handleEntityNotFound(_0x5fc3fa,_0x381ce1){return function(_0x333a0c){if(!_0x333a0c){_0x5fc3fa['sendStatus'](0x194);}return _0x333a0c;};}function handleError(_0x211c9a,_0x2cc8e3){_0x2cc8e3=_0x2cc8e3||0x1f4;return function(_0x3d385a){logger['error'](_0x3d385a[_0x4ca7('0x37')]);if(_0x3d385a[_0x4ca7('0x38')]){delete _0x3d385a[_0x4ca7('0x38')];}_0x211c9a['status'](_0x2cc8e3)[_0x4ca7('0x39')](_0x3d385a);};}exports['index']=function(_0x1f8f90,_0x238444){var _0x293abe={},_0x3abf1a={},_0x361dc2={'count':0x0,'rows':[]};var _0x492fba=_[_0x4ca7('0x3a')](db[_0x4ca7('0x3b')][_0x4ca7('0x3c')],function(_0x5d2578){return{'name':_0x5d2578[_0x4ca7('0x3d')],'type':_0x5d2578['type']['key']};});_0x3abf1a[_0x4ca7('0x3e')]=_[_0x4ca7('0x3a')](_0x492fba,'name');_0x3abf1a[_0x4ca7('0x3f')]=_[_0x4ca7('0x40')](_0x1f8f90[_0x4ca7('0x3f')]);_0x3abf1a[_0x4ca7('0x41')]=_[_0x4ca7('0x42')](_0x3abf1a[_0x4ca7('0x3e')],_0x3abf1a[_0x4ca7('0x3f')]);_0x293abe['attributes']=_[_0x4ca7('0x42')](_0x3abf1a[_0x4ca7('0x3e')],qs[_0x4ca7('0x43')](_0x1f8f90[_0x4ca7('0x3f')][_0x4ca7('0x43')]));_0x293abe[_0x4ca7('0x44')]=_0x293abe[_0x4ca7('0x44')][_0x4ca7('0x45')]?_0x293abe[_0x4ca7('0x44')]:_0x3abf1a[_0x4ca7('0x3e')];if(!_0x1f8f90[_0x4ca7('0x3f')][_0x4ca7('0x46')](_0x4ca7('0x47'))){_0x293abe[_0x4ca7('0x2e')]=qs[_0x4ca7('0x2e')](_0x1f8f90[_0x4ca7('0x3f')][_0x4ca7('0x2e')]);_0x293abe['offset']=qs[_0x4ca7('0x2d')](_0x1f8f90[_0x4ca7('0x3f')][_0x4ca7('0x2d')]);}_0x293abe[_0x4ca7('0x48')]=qs[_0x4ca7('0x49')](_0x1f8f90[_0x4ca7('0x3f')]['sort']);_0x293abe['where']=qs[_0x4ca7('0x41')](_['pick'](_0x1f8f90[_0x4ca7('0x3f')],_0x3abf1a[_0x4ca7('0x41')]),_0x492fba);if(_0x1f8f90[_0x4ca7('0x3f')][_0x4ca7('0x4a')]){_0x293abe[_0x4ca7('0x4b')]=_[_0x4ca7('0x4c')](_0x293abe['where'],{'$or':_[_0x4ca7('0x3a')](_0x492fba,function(_0x157684){if(_0x157684[_0x4ca7('0x4d')]!=='VIRTUAL'){var _0x2bec8e={};_0x2bec8e[_0x157684[_0x4ca7('0x38')]]={'$like':'%'+_0x1f8f90['query'][_0x4ca7('0x4a')]+'%'};return _0x2bec8e;}})});}_0x293abe=_[_0x4ca7('0x4c')]({},_0x293abe,_0x1f8f90['options']);var _0x1a9896={'where':_0x293abe[_0x4ca7('0x4b')]};return db['ZendeskAccount'][_0x4ca7('0x2c')](_0x1a9896)[_0x4ca7('0x34')](function(_0x49ce2b){_0x361dc2[_0x4ca7('0x2c')]=_0x49ce2b;if(_0x1f8f90[_0x4ca7('0x3f')]['includeAll']){_0x293abe[_0x4ca7('0x4e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4ca7('0x4f')](_0x293abe);})[_0x4ca7('0x34')](function(_0x4b0f72){_0x361dc2[_0x4ca7('0x50')]=_0x4b0f72;return _0x361dc2;})[_0x4ca7('0x34')](respondWithFilteredResult(_0x238444,_0x293abe))[_0x4ca7('0x51')](handleError(_0x238444,null));};exports[_0x4ca7('0x52')]=function(_0x52a33a,_0x4ee596){var _0x1997bb={'raw':![],'where':{'id':_0x52a33a[_0x4ca7('0x53')]['id']}},_0x9c67b6={};_0x9c67b6[_0x4ca7('0x3e')]=_[_0x4ca7('0x40')](db['ZendeskAccount']['rawAttributes']);_0x9c67b6[_0x4ca7('0x3f')]=_[_0x4ca7('0x40')](_0x52a33a[_0x4ca7('0x3f')]);_0x9c67b6['filters']=_[_0x4ca7('0x42')](_0x9c67b6[_0x4ca7('0x3e')],_0x9c67b6[_0x4ca7('0x3f')]);_0x1997bb[_0x4ca7('0x44')]=_[_0x4ca7('0x42')](_0x9c67b6[_0x4ca7('0x3e')],qs['fields'](_0x52a33a[_0x4ca7('0x3f')][_0x4ca7('0x43')]));_0x1997bb[_0x4ca7('0x44')]=_0x1997bb['attributes']['length']?_0x1997bb[_0x4ca7('0x44')]:_0x9c67b6[_0x4ca7('0x3e')];if(_0x52a33a[_0x4ca7('0x3f')][_0x4ca7('0x54')]){_0x1997bb[_0x4ca7('0x4e')]=[{'all':!![]}];}_0x1997bb=_['merge']({},_0x1997bb,_0x52a33a[_0x4ca7('0x55')]);return db['ZendeskAccount']['find'](_0x1997bb)[_0x4ca7('0x34')](handleEntityNotFound(_0x4ee596,null))['then'](respondWithResult(_0x4ee596,null))[_0x4ca7('0x51')](handleError(_0x4ee596,null));};exports[_0x4ca7('0x56')]=function(_0x44e1bc,_0x3b3c49){return db['ZendeskAccount'][_0x4ca7('0x56')](_0x44e1bc[_0x4ca7('0x57')],{})[_0x4ca7('0x34')](respondWithResult(_0x3b3c49,0xc9))['catch'](handleError(_0x3b3c49,null));};exports['update']=function(_0x21c942,_0x51adb2){if(_0x21c942['body']['id']){delete _0x21c942['body']['id'];}return db['ZendeskAccount'][_0x4ca7('0x58')]({'where':{'id':_0x21c942[_0x4ca7('0x53')]['id']}})[_0x4ca7('0x34')](handleEntityNotFound(_0x51adb2,null))[_0x4ca7('0x34')](saveUpdates(_0x21c942[_0x4ca7('0x57')],null))[_0x4ca7('0x34')](respondWithResult(_0x51adb2,null))[_0x4ca7('0x51')](handleError(_0x51adb2,null));};exports[_0x4ca7('0x35')]=function(_0x15e03c,_0x172fbe){return db[_0x4ca7('0x3b')][_0x4ca7('0x58')]({'where':{'id':_0x15e03c[_0x4ca7('0x53')]['id']}})[_0x4ca7('0x34')](handleEntityNotFound(_0x172fbe,null))[_0x4ca7('0x34')](removeEntity(_0x172fbe,null))[_0x4ca7('0x51')](handleError(_0x172fbe,null));};exports[_0x4ca7('0x59')]=function(_0x2285bc,_0x43574c,_0x21319a){var _0x3b7f44={};var _0x1404cc={};var _0x4ff382;var _0x4278e7;return db[_0x4ca7('0x3b')]['findOne']({'where':{'id':_0x2285bc[_0x4ca7('0x53')]['id']}})[_0x4ca7('0x34')](handleEntityNotFound(_0x43574c,null))[_0x4ca7('0x34')](function(_0x2cde0d){if(_0x2cde0d){_0x4ff382=_0x2cde0d;_0x1404cc[_0x4ca7('0x3e')]=_[_0x4ca7('0x40')](db['ZendeskConfiguration'][_0x4ca7('0x3c')]);_0x1404cc[_0x4ca7('0x3f')]=_[_0x4ca7('0x40')](_0x2285bc[_0x4ca7('0x3f')]);_0x1404cc[_0x4ca7('0x41')]=_[_0x4ca7('0x42')](_0x1404cc['model'],_0x1404cc[_0x4ca7('0x3f')]);_0x3b7f44[_0x4ca7('0x44')]=_['intersection'](_0x1404cc[_0x4ca7('0x3e')],qs[_0x4ca7('0x43')](_0x2285bc[_0x4ca7('0x3f')][_0x4ca7('0x43')]));_0x3b7f44['attributes']=_0x3b7f44[_0x4ca7('0x44')][_0x4ca7('0x45')]?_0x3b7f44[_0x4ca7('0x44')]:_0x1404cc[_0x4ca7('0x3e')];_0x3b7f44['order']=qs[_0x4ca7('0x49')](_0x2285bc['query'][_0x4ca7('0x49')]);_0x3b7f44[_0x4ca7('0x4b')]=qs[_0x4ca7('0x41')](_[_0x4ca7('0x5a')](_0x2285bc['query'],_0x1404cc[_0x4ca7('0x41')]));if(_0x2285bc[_0x4ca7('0x3f')]['filter']){_0x3b7f44['where']=_[_0x4ca7('0x4c')](_0x3b7f44['where'],{'$or':_[_0x4ca7('0x3a')](_0x3b7f44[_0x4ca7('0x44')],function(_0x270b99){var _0x15344d={};_0x15344d[_0x270b99]={'$like':'%'+_0x2285bc[_0x4ca7('0x3f')]['filter']+'%'};return _0x15344d;})});}_0x3b7f44=_[_0x4ca7('0x4c')]({},_0x3b7f44,_0x2285bc[_0x4ca7('0x55')]);return _0x4ff382[_0x4ca7('0x59')](_0x3b7f44);}})[_0x4ca7('0x34')](function(_0x435242){if(_0x435242){_0x4278e7=_0x435242['length'];if(!_0x2285bc[_0x4ca7('0x3f')]['hasOwnProperty'](_0x4ca7('0x47'))){_0x3b7f44[_0x4ca7('0x2e')]=qs[_0x4ca7('0x2e')](_0x2285bc[_0x4ca7('0x3f')]['limit']);_0x3b7f44[_0x4ca7('0x2d')]=qs[_0x4ca7('0x2d')](_0x2285bc[_0x4ca7('0x3f')][_0x4ca7('0x2d')]);}return _0x4ff382[_0x4ca7('0x59')](_0x3b7f44);}})[_0x4ca7('0x34')](function(_0x11cde9){if(_0x11cde9){return _0x11cde9?{'count':_0x4278e7,'rows':_0x11cde9}:null;}})['then'](respondWithResult(_0x43574c,null))[_0x4ca7('0x51')](handleError(_0x43574c,null));};exports[_0x4ca7('0x5b')]=function(_0x401300,_0x295d74,_0x27e68f){if(_0x401300[_0x4ca7('0x57')]['id']){delete _0x401300[_0x4ca7('0x57')]['id'];}return db[_0x4ca7('0x3b')][_0x4ca7('0x5c')]({'where':{'id':_0x401300[_0x4ca7('0x53')]['id']}})['then'](handleEntityNotFound(_0x295d74,null))[_0x4ca7('0x34')](function(_0x42955c){if(_0x42955c){_0x401300[_0x4ca7('0x57')][_0x4ca7('0x5d')]=_0x42955c['id'];_0x401300[_0x4ca7('0x57')][_0x4ca7('0x5e')]=integrations['getSubjects'](_0x401300['body'][_0x4ca7('0x5f')],_0x401300[_0x4ca7('0x57')]['type']);_0x401300[_0x4ca7('0x57')][_0x4ca7('0x60')]=integrations[_0x4ca7('0x61')](_0x401300[_0x4ca7('0x57')][_0x4ca7('0x5f')],_0x401300[_0x4ca7('0x57')][_0x4ca7('0x4d')]);return db[_0x4ca7('0x62')][_0x4ca7('0x56')](_0x401300[_0x4ca7('0x57')],{'include':[{'model':db[_0x4ca7('0x63')],'as':'Subjects'},{'model':db[_0x4ca7('0x63')],'as':_0x4ca7('0x60')}]});}return null;})[_0x4ca7('0x34')](respondWithResult(_0x295d74,null))[_0x4ca7('0x51')](handleError(_0x295d74,null));};exports[_0x4ca7('0x64')]=function(_0x48af6b,_0x4c0ac4,_0x18c0c6){var _0x2560a3='';return db[_0x4ca7('0x3b')][_0x4ca7('0x5c')]({'where':{'id':_0x48af6b[_0x4ca7('0x53')]['id']},'attributes':['id',_0x4ca7('0x65'),'password',_0x4ca7('0x66'),_0x4ca7('0x67'),_0x4ca7('0x68')]})[_0x4ca7('0x34')](handleEntityNotFound(_0x4c0ac4,null))[_0x4ca7('0x34')](function(_0x4b33d9){if(_0x4b33d9){_0x2560a3=_0x4b33d9[_0x4ca7('0x68')];var _0x14c1d1=_0x2560a3[_0x4ca7('0x69')](-0x1);if(_0x14c1d1==='/'){_0x2560a3=_0x2560a3[_0x4ca7('0x6a')](0x0,_0x2560a3[_0x4ca7('0x6b')](_0x14c1d1));}var _0x448e70={'method':_0x4ca7('0x6c'),'uri':util[_0x4ca7('0x6d')](_0x4ca7('0x6e'),_0x2560a3,_0x4ca7('0x6f')),'json':!![]};switch(_0x4b33d9['authType']){case _0x4ca7('0x70'):_0x448e70[_0x4ca7('0x71')]={'Authorization':util[_0x4ca7('0x6d')](_0x4ca7('0x72'),new Buffer(util['format'](_0x4ca7('0x73'),_0x4b33d9[_0x4ca7('0x65')],_0x4b33d9[_0x4ca7('0x70')]))['toString'](_0x4ca7('0x74')))};break;case'token':_0x448e70[_0x4ca7('0x71')]={'Authorization':util[_0x4ca7('0x6d')]('Basic\x20%s',new Buffer(util['format'](_0x4ca7('0x75'),_0x4b33d9[_0x4ca7('0x65')],_0x4b33d9[_0x4ca7('0x66')]))['toString'](_0x4ca7('0x74')))};break;default:throw new db[(_0x4ca7('0x1d'))][(_0x4ca7('0x1e'))](_0x4ca7('0x76'));}return rp(_0x448e70);}})['then'](function(_0x44fdbf){if(_0x44fdbf){var _0x1884a4=[_0x4ca7('0x77'),_0x4ca7('0x78'),_0x4ca7('0x79'),_0x4ca7('0x7a')];_['remove'](_0x44fdbf['ticket_fields'],function(_0x17ff58){return _0x1884a4[_0x4ca7('0x7b')](_0x17ff58[_0x4ca7('0x4d')]);});return{'count':_0x44fdbf['ticket_fields'][_0x4ca7('0x45')],'rows':_[_0x4ca7('0x3a')](_0x44fdbf[_0x4ca7('0x6f')],function(_0x378cf2){return{'id':_0x378cf2['id'],'name':_0x378cf2[_0x4ca7('0x7c')]>0x7?_0x378cf2['title']:_0x378cf2[_0x4ca7('0x4d')],'custom':_0x378cf2[_0x4ca7('0x7c')]>0x7?!![]:![],'options':_0x378cf2[_0x4ca7('0x7d')]?_0x378cf2[_0x4ca7('0x7d')]:_0x378cf2[_0x4ca7('0x7e')]?_0x378cf2[_0x4ca7('0x7e')]:[]};})};}})[_0x4ca7('0x34')](respondWithResult(_0x4c0ac4,null))[_0x4ca7('0x51')](function(_0x37d3bd){var _0x53ce09=_0x48af6b[_0x4ca7('0x3f')]['test']?0x1f4:_0x37d3bd[_0x4ca7('0x7f')]||0x1f4;logger[_0x4ca7('0x25')](_0x4ca7('0x80'),_0x4ca7('0x64'),_0x53ce09,JSON[_0x4ca7('0x24')](_0x37d3bd));delete _0x37d3bd['name'];if(_0x53ce09===0x191){_0x53ce09=0x190;}_0x4c0ac4[_0x4ca7('0x2a')](_0x53ce09)[_0x4ca7('0x39')](_0x48af6b[_0x4ca7('0x3f')][_0x4ca7('0x81')]?{'message':'Wrong\x20credentials','statusCode':_0x37d3bd[_0x4ca7('0x7f')]}:_0x37d3bd);});}; \ No newline at end of file +var _0xd340=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','jayson/promise','client','http','Sequelize','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','destroy','stack','name','send','rawAttributes','fieldName','type','map','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','rows','show','params','length','includeAll','include','find','create','update','body','getConfigurations','findOne','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','username','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','password','headers','%s:%s','toString','base64','token','Basic\x20%s','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','ticket_fields','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','html-pdf','eml-format','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x460400,_0x475f20){var _0x50b500=function(_0x125b1b){while(--_0x125b1b){_0x460400['push'](_0x460400['shift']());}};_0x50b500(++_0x475f20);}(_0xd340,0x1e5));var _0x0d34=function(_0x2d5f85,_0x48f855){_0x2d5f85=_0x2d5f85-0x0;var _0x3d7eb8=_0xd340[_0x2d5f85];return _0x3d7eb8;};'use strict';var pdf=require(_0x0d34('0x0'));var emlformat=require(_0x0d34('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d34('0x2'));var moment=require('moment');var BPromise=require(_0x0d34('0x3'));var Mustache=require('mustache');var util=require(_0x0d34('0x4'));var path=require(_0x0d34('0x5'));var sox=require(_0x0d34('0x6'));var csv=require(_0x0d34('0x7'));var ejs=require(_0x0d34('0x8'));var fs=require('fs');var _=require(_0x0d34('0x9'));var squel=require(_0x0d34('0xa'));var crypto=require(_0x0d34('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0d34('0xc'));var toCsv=require(_0x0d34('0x7'));var querystring=require(_0x0d34('0xd'));var Papa=require(_0x0d34('0xe'));var Redis=require(_0x0d34('0xf'));var authService=require(_0x0d34('0x10'));var qs=require(_0x0d34('0x11'));var as=require(_0x0d34('0x12'));var hardwareService=require(_0x0d34('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0d34('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0d34('0x15'));var client=jayson[_0x0d34('0x16')][_0x0d34('0x17')]({'port':0x232a});function checkPasswordPattern(_0x4d48f8,_0x116101,_0x152ba6){if(_0x152ba6){var _0x4524f5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4524f5['test'](_0x116101)){return _0x4d48f8;}else{throw new db[(_0x0d34('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 _0x4d48f8;}}function respondWithRpcPromise(_0x151543,_0x314d8d,_0x22fe53,_0x14730e){return new BPromise(function(_0x355d68,_0x4519da){var _0x130788=_0x14730e||client;return _0x130788[_0x0d34('0x19')](_0x151543,_0x22fe53)[_0x0d34('0x1a')](function(_0xd51701){logger[_0x0d34('0x1b')](_0x0d34('0x1c'),_0x314d8d,_0x0d34('0x1d'));logger['debug'](_0x0d34('0x1e'),_0x314d8d,_0x0d34('0x1d'),JSON[_0x0d34('0x1f')](_0xd51701));if(_0xd51701[_0x0d34('0x20')]){if(_0xd51701['error'][_0x0d34('0x21')]===0x1f4){logger['error'](_0x0d34('0x1c'),_0x314d8d,_0xd51701[_0x0d34('0x20')][_0x0d34('0x22')]);return _0x4519da(_0xd51701[_0x0d34('0x20')][_0x0d34('0x22')]);}logger[_0x0d34('0x20')]('ZendeskAccount,\x20%s,\x20%s',_0x314d8d,_0xd51701['error'][_0x0d34('0x22')]);return _0x355d68(_0xd51701['error'][_0x0d34('0x22')]);}else{logger[_0x0d34('0x1b')]('ZendeskAccount,\x20%s,\x20%s',_0x314d8d,_0x0d34('0x1d'));_0x355d68(_0xd51701[_0x0d34('0x23')][_0x0d34('0x22')]);}})[_0x0d34('0x24')](function(_0x1f412c){logger['error'](_0x0d34('0x1c'),_0x314d8d,_0x1f412c);_0x4519da(_0x1f412c);});});}function respondWithStatusCode(_0x52e2d9,_0xcc4975){_0xcc4975=_0xcc4975||0xcc;return function(_0xaca19e){if(_0xaca19e){return _0x52e2d9[_0x0d34('0x25')](_0xcc4975);}return _0x52e2d9[_0x0d34('0x26')](_0xcc4975)[_0x0d34('0x27')]();};}function respondWithResult(_0x177a14,_0x23cbf2){_0x23cbf2=_0x23cbf2||0xc8;return function(_0x17c9e2){if(_0x17c9e2){return _0x177a14[_0x0d34('0x26')](_0x23cbf2)[_0x0d34('0x28')](_0x17c9e2);}};}function respondWithFilteredResult(_0x4925ad,_0x1baae6){return function(_0x2a670a){if(_0x2a670a){var _0x2b8e4e=_0x2a670a[_0x0d34('0x29')],_0x350066=_0x1baae6['offset'],_0x1e69b2=_0x1baae6['offset']+_0x1baae6[_0x0d34('0x2a')],_0x27961c;if(_0x1e69b2>=_0x2b8e4e){_0x1e69b2=_0x2b8e4e;_0x27961c=0xc8;}else{_0x27961c=0xce;}_0x4925ad[_0x0d34('0x26')](_0x27961c);return _0x4925ad[_0x0d34('0x2b')](_0x0d34('0x2c'),_0x350066+'-'+_0x1e69b2+'/'+_0x2b8e4e)['json'](_0x2a670a);}return null;};}function patchUpdates(_0x186b35){return function(_0x168662){try{jsonpatch[_0x0d34('0x2d')](_0x168662,_0x186b35,!![]);}catch(_0x1b3922){return BPromise[_0x0d34('0x2e')](_0x1b3922);}return _0x168662['save']();};}function saveUpdates(_0x34ece9,_0x2b63de){return function(_0x3dcabd){if(_0x3dcabd){return _0x3dcabd['update'](_0x34ece9)[_0x0d34('0x1a')](function(_0x213ddc){return _0x213ddc;});}return null;};}function removeEntity(_0x57699b,_0x117d94){return function(_0x5d4665){if(_0x5d4665){return _0x5d4665[_0x0d34('0x2f')]()[_0x0d34('0x1a')](function(){_0x57699b[_0x0d34('0x26')](0xcc)[_0x0d34('0x27')]();});}};}function handleEntityNotFound(_0x312f89,_0x4682bf){return function(_0x382b83){if(!_0x382b83){_0x312f89['sendStatus'](0x194);}return _0x382b83;};}function handleError(_0x47c1be,_0x98388a){_0x98388a=_0x98388a||0x1f4;return function(_0x5e819c){logger[_0x0d34('0x20')](_0x5e819c[_0x0d34('0x30')]);if(_0x5e819c[_0x0d34('0x31')]){delete _0x5e819c[_0x0d34('0x31')];}_0x47c1be[_0x0d34('0x26')](_0x98388a)[_0x0d34('0x32')](_0x5e819c);};}exports['index']=function(_0x5bac20,_0x3bd61a){var _0x4b990d={},_0x1820b2={},_0x2aba89={'count':0x0,'rows':[]};var _0x565500=_['map'](db['ZendeskAccount'][_0x0d34('0x33')],function(_0x25f2fa){return{'name':_0x25f2fa[_0x0d34('0x34')],'type':_0x25f2fa[_0x0d34('0x35')]['key']};});_0x1820b2['model']=_[_0x0d34('0x36')](_0x565500,'name');_0x1820b2['query']=_[_0x0d34('0x37')](_0x5bac20[_0x0d34('0x38')]);_0x1820b2[_0x0d34('0x39')]=_['intersection'](_0x1820b2[_0x0d34('0x3a')],_0x1820b2[_0x0d34('0x38')]);_0x4b990d[_0x0d34('0x3b')]=_[_0x0d34('0x3c')](_0x1820b2['model'],qs[_0x0d34('0x3d')](_0x5bac20['query'][_0x0d34('0x3d')]));_0x4b990d[_0x0d34('0x3b')]=_0x4b990d[_0x0d34('0x3b')]['length']?_0x4b990d['attributes']:_0x1820b2[_0x0d34('0x3a')];if(!_0x5bac20['query'][_0x0d34('0x3e')]('nolimit')){_0x4b990d[_0x0d34('0x2a')]=qs[_0x0d34('0x2a')](_0x5bac20[_0x0d34('0x38')]['limit']);_0x4b990d[_0x0d34('0x3f')]=qs[_0x0d34('0x3f')](_0x5bac20['query'][_0x0d34('0x3f')]);}_0x4b990d[_0x0d34('0x40')]=qs[_0x0d34('0x41')](_0x5bac20[_0x0d34('0x38')][_0x0d34('0x41')]);_0x4b990d[_0x0d34('0x42')]=qs['filters'](_[_0x0d34('0x43')](_0x5bac20[_0x0d34('0x38')],_0x1820b2[_0x0d34('0x39')]),_0x565500);if(_0x5bac20[_0x0d34('0x38')][_0x0d34('0x44')]){_0x4b990d[_0x0d34('0x42')]=_[_0x0d34('0x45')](_0x4b990d['where'],{'$or':_['map'](_0x565500,function(_0x5eeaf0){if(_0x5eeaf0[_0x0d34('0x35')]!==_0x0d34('0x46')){var _0x415260={};_0x415260[_0x5eeaf0['name']]={'$like':'%'+_0x5bac20[_0x0d34('0x38')][_0x0d34('0x44')]+'%'};return _0x415260;}})});}_0x4b990d=_[_0x0d34('0x45')]({},_0x4b990d,_0x5bac20[_0x0d34('0x47')]);var _0x4c4ce5={'where':_0x4b990d[_0x0d34('0x42')]};return db[_0x0d34('0x48')][_0x0d34('0x29')](_0x4c4ce5)[_0x0d34('0x1a')](function(_0x22d156){_0x2aba89[_0x0d34('0x29')]=_0x22d156;if(_0x5bac20[_0x0d34('0x38')]['includeAll']){_0x4b990d['include']=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x4b990d);})[_0x0d34('0x1a')](function(_0x4df514){_0x2aba89[_0x0d34('0x49')]=_0x4df514;return _0x2aba89;})[_0x0d34('0x1a')](respondWithFilteredResult(_0x3bd61a,_0x4b990d))[_0x0d34('0x24')](handleError(_0x3bd61a,null));};exports[_0x0d34('0x4a')]=function(_0x59b993,_0x1eda30){var _0xc0bfe7={'raw':![],'where':{'id':_0x59b993[_0x0d34('0x4b')]['id']}},_0x2a303e={};_0x2a303e[_0x0d34('0x3a')]=_[_0x0d34('0x37')](db[_0x0d34('0x48')][_0x0d34('0x33')]);_0x2a303e[_0x0d34('0x38')]=_[_0x0d34('0x37')](_0x59b993[_0x0d34('0x38')]);_0x2a303e['filters']=_['intersection'](_0x2a303e[_0x0d34('0x3a')],_0x2a303e[_0x0d34('0x38')]);_0xc0bfe7[_0x0d34('0x3b')]=_[_0x0d34('0x3c')](_0x2a303e['model'],qs[_0x0d34('0x3d')](_0x59b993[_0x0d34('0x38')][_0x0d34('0x3d')]));_0xc0bfe7[_0x0d34('0x3b')]=_0xc0bfe7['attributes'][_0x0d34('0x4c')]?_0xc0bfe7['attributes']:_0x2a303e['model'];if(_0x59b993[_0x0d34('0x38')][_0x0d34('0x4d')]){_0xc0bfe7[_0x0d34('0x4e')]=[{'all':!![]}];}_0xc0bfe7=_['merge']({},_0xc0bfe7,_0x59b993[_0x0d34('0x47')]);return db[_0x0d34('0x48')][_0x0d34('0x4f')](_0xc0bfe7)[_0x0d34('0x1a')](handleEntityNotFound(_0x1eda30,null))[_0x0d34('0x1a')](respondWithResult(_0x1eda30,null))[_0x0d34('0x24')](handleError(_0x1eda30,null));};exports['create']=function(_0x26a28b,_0x2df0ff){return db[_0x0d34('0x48')][_0x0d34('0x50')](_0x26a28b['body'],{})[_0x0d34('0x1a')](respondWithResult(_0x2df0ff,0xc9))[_0x0d34('0x24')](handleError(_0x2df0ff,null));};exports[_0x0d34('0x51')]=function(_0x41c1b9,_0x29d9a6){if(_0x41c1b9[_0x0d34('0x52')]['id']){delete _0x41c1b9['body']['id'];}return db[_0x0d34('0x48')][_0x0d34('0x4f')]({'where':{'id':_0x41c1b9[_0x0d34('0x4b')]['id']}})[_0x0d34('0x1a')](handleEntityNotFound(_0x29d9a6,null))[_0x0d34('0x1a')](saveUpdates(_0x41c1b9[_0x0d34('0x52')],null))[_0x0d34('0x1a')](respondWithResult(_0x29d9a6,null))['catch'](handleError(_0x29d9a6,null));};exports[_0x0d34('0x2f')]=function(_0x396cd5,_0x8c8fc7){return db[_0x0d34('0x48')][_0x0d34('0x4f')]({'where':{'id':_0x396cd5[_0x0d34('0x4b')]['id']}})[_0x0d34('0x1a')](handleEntityNotFound(_0x8c8fc7,null))['then'](removeEntity(_0x8c8fc7,null))[_0x0d34('0x24')](handleError(_0x8c8fc7,null));};exports[_0x0d34('0x53')]=function(_0x5d0420,_0x4a6b69,_0x7647c6){var _0x2ec04c={};var _0x4af660={};var _0x353c08;var _0x53007f;return db[_0x0d34('0x48')][_0x0d34('0x54')]({'where':{'id':_0x5d0420[_0x0d34('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a6b69,null))[_0x0d34('0x1a')](function(_0xa9f944){if(_0xa9f944){_0x353c08=_0xa9f944;_0x4af660[_0x0d34('0x3a')]=_[_0x0d34('0x37')](db['ZendeskConfiguration'][_0x0d34('0x33')]);_0x4af660[_0x0d34('0x38')]=_[_0x0d34('0x37')](_0x5d0420[_0x0d34('0x38')]);_0x4af660[_0x0d34('0x39')]=_[_0x0d34('0x3c')](_0x4af660[_0x0d34('0x3a')],_0x4af660[_0x0d34('0x38')]);_0x2ec04c['attributes']=_[_0x0d34('0x3c')](_0x4af660[_0x0d34('0x3a')],qs[_0x0d34('0x3d')](_0x5d0420[_0x0d34('0x38')][_0x0d34('0x3d')]));_0x2ec04c[_0x0d34('0x3b')]=_0x2ec04c[_0x0d34('0x3b')]['length']?_0x2ec04c['attributes']:_0x4af660[_0x0d34('0x3a')];_0x2ec04c[_0x0d34('0x40')]=qs['sort'](_0x5d0420['query'][_0x0d34('0x41')]);_0x2ec04c[_0x0d34('0x42')]=qs[_0x0d34('0x39')](_[_0x0d34('0x43')](_0x5d0420[_0x0d34('0x38')],_0x4af660['filters']));if(_0x5d0420[_0x0d34('0x38')][_0x0d34('0x44')]){_0x2ec04c[_0x0d34('0x42')]=_[_0x0d34('0x45')](_0x2ec04c['where'],{'$or':_[_0x0d34('0x36')](_0x2ec04c[_0x0d34('0x3b')],function(_0x4b9eca){var _0xf976f5={};_0xf976f5[_0x4b9eca]={'$like':'%'+_0x5d0420[_0x0d34('0x38')][_0x0d34('0x44')]+'%'};return _0xf976f5;})});}_0x2ec04c=_['merge']({},_0x2ec04c,_0x5d0420[_0x0d34('0x47')]);return _0x353c08['getConfigurations'](_0x2ec04c);}})[_0x0d34('0x1a')](function(_0x249f5c){if(_0x249f5c){_0x53007f=_0x249f5c[_0x0d34('0x4c')];if(!_0x5d0420[_0x0d34('0x38')][_0x0d34('0x3e')](_0x0d34('0x55'))){_0x2ec04c['limit']=qs[_0x0d34('0x2a')](_0x5d0420[_0x0d34('0x38')][_0x0d34('0x2a')]);_0x2ec04c[_0x0d34('0x3f')]=qs['offset'](_0x5d0420[_0x0d34('0x38')][_0x0d34('0x3f')]);}return _0x353c08[_0x0d34('0x53')](_0x2ec04c);}})['then'](function(_0x3e6bc5){if(_0x3e6bc5){return _0x3e6bc5?{'count':_0x53007f,'rows':_0x3e6bc5}:null;}})[_0x0d34('0x1a')](respondWithResult(_0x4a6b69,null))[_0x0d34('0x24')](handleError(_0x4a6b69,null));};exports[_0x0d34('0x56')]=function(_0x11bb18,_0x633e05,_0x1d84b5){if(_0x11bb18[_0x0d34('0x52')]['id']){delete _0x11bb18['body']['id'];}return db[_0x0d34('0x48')]['findOne']({'where':{'id':_0x11bb18[_0x0d34('0x4b')]['id']}})[_0x0d34('0x1a')](handleEntityNotFound(_0x633e05,null))[_0x0d34('0x1a')](function(_0x133996){if(_0x133996){_0x11bb18['body']['AccountId']=_0x133996['id'];_0x11bb18[_0x0d34('0x52')][_0x0d34('0x57')]=integrations[_0x0d34('0x58')](_0x11bb18[_0x0d34('0x52')][_0x0d34('0x59')],_0x11bb18[_0x0d34('0x52')][_0x0d34('0x35')]);_0x11bb18[_0x0d34('0x52')]['Descriptions']=integrations[_0x0d34('0x5a')](_0x11bb18['body'][_0x0d34('0x59')],_0x11bb18['body'][_0x0d34('0x35')]);return db['ZendeskConfiguration']['create'](_0x11bb18[_0x0d34('0x52')],{'include':[{'model':db['ZendeskField'],'as':_0x0d34('0x57')},{'model':db[_0x0d34('0x5b')],'as':_0x0d34('0x5c')}]});}return null;})[_0x0d34('0x1a')](respondWithResult(_0x633e05,null))[_0x0d34('0x24')](handleError(_0x633e05,null));};exports['getFields']=function(_0x550b1a,_0x3d9e66,_0x143d33){var _0x2dc9bf='';return db[_0x0d34('0x48')][_0x0d34('0x54')]({'where':{'id':_0x550b1a[_0x0d34('0x4b')]['id']},'attributes':['id',_0x0d34('0x5d'),'password','token',_0x0d34('0x5e'),_0x0d34('0x5f')]})['then'](handleEntityNotFound(_0x3d9e66,null))[_0x0d34('0x1a')](function(_0x4daab0){if(_0x4daab0){_0x2dc9bf=_0x4daab0[_0x0d34('0x5f')];var _0x35c007=_0x2dc9bf[_0x0d34('0x60')](-0x1);if(_0x35c007==='/'){_0x2dc9bf=_0x2dc9bf[_0x0d34('0x61')](0x0,_0x2dc9bf[_0x0d34('0x62')](_0x35c007));}var _0x33707e={'method':'GET','uri':util[_0x0d34('0x63')](_0x0d34('0x64'),_0x2dc9bf,'ticket_fields'),'json':!![]};switch(_0x4daab0[_0x0d34('0x5e')]){case _0x0d34('0x65'):_0x33707e[_0x0d34('0x66')]={'Authorization':util[_0x0d34('0x63')]('Basic\x20%s',new Buffer(util[_0x0d34('0x63')](_0x0d34('0x67'),_0x4daab0[_0x0d34('0x5d')],_0x4daab0[_0x0d34('0x65')]))[_0x0d34('0x68')](_0x0d34('0x69')))};break;case _0x0d34('0x6a'):_0x33707e[_0x0d34('0x66')]={'Authorization':util[_0x0d34('0x63')](_0x0d34('0x6b'),new Buffer(util[_0x0d34('0x63')](_0x0d34('0x6c'),_0x4daab0[_0x0d34('0x5d')],_0x4daab0['token']))[_0x0d34('0x68')]('base64'))};break;default:throw new db[(_0x0d34('0x18'))][(_0x0d34('0x6d'))](_0x0d34('0x6e'));}return rp(_0x33707e);}})[_0x0d34('0x1a')](function(_0x527c08){if(_0x527c08){var _0xcbdbe5=[_0x0d34('0x6f'),_0x0d34('0x70'),_0x0d34('0x71'),'assignee'];_['remove'](_0x527c08[_0x0d34('0x72')],function(_0x5763bc){return _0xcbdbe5[_0x0d34('0x73')](_0x5763bc[_0x0d34('0x35')]);});return{'count':_0x527c08[_0x0d34('0x72')]['length'],'rows':_[_0x0d34('0x36')](_0x527c08[_0x0d34('0x72')],function(_0xf5106f){return{'id':_0xf5106f['id'],'name':_0xf5106f[_0x0d34('0x74')]>0x7?_0xf5106f[_0x0d34('0x75')]:_0xf5106f['type'],'custom':_0xf5106f[_0x0d34('0x74')]>0x7?!![]:![],'options':_0xf5106f[_0x0d34('0x76')]?_0xf5106f[_0x0d34('0x76')]:_0xf5106f[_0x0d34('0x77')]?_0xf5106f['custom_field_options']:[]};})};}})[_0x0d34('0x1a')](respondWithResult(_0x3d9e66,null))[_0x0d34('0x24')](function(_0x35db4e){var _0x54cbce=_0x550b1a[_0x0d34('0x38')]['test']?0x1f4:_0x35db4e[_0x0d34('0x78')]||0x1f4;logger[_0x0d34('0x20')](_0x0d34('0x79'),_0x0d34('0x7a'),_0x54cbce,JSON[_0x0d34('0x1f')](_0x35db4e));delete _0x35db4e[_0x0d34('0x31')];if(_0x54cbce===0x191){_0x54cbce=0x190;}_0x3d9e66[_0x0d34('0x26')](_0x54cbce)[_0x0d34('0x32')](_0x550b1a[_0x0d34('0x38')][_0x0d34('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x35db4e[_0x0d34('0x78')]}:_0x35db4e);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index b77cb7d..5863963 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 _0x8643=['lodash','util','api','moment','bluebird','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x510875,_0x45af7d){var _0x243c42=function(_0x2c1eff){while(--_0x2c1eff){_0x510875['push'](_0x510875['shift']());}};_0x243c42(++_0x45af7d);}(_0x8643,0xb0));var _0x3864=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8643[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x3864('0x0'));var util=require(_0x3864('0x1'));var logger=require('../../config/logger')(_0x3864('0x2'));var moment=require(_0x3864('0x3'));var BPromise=require(_0x3864('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3864('0x5'));var integrations=require(_0x3864('0x6'));module[_0x3864('0x7')]=function(_0x41d3bc,_0x3a8ced){return _0x41d3bc[_0x3864('0x8')](_0x3864('0x9'),attributes,{'tableName':_0x3864('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadaa=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','int_zendesk_accounts','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x45ded2,_0x395fbc){var _0x42875b=function(_0x3becd3){while(--_0x3becd3){_0x45ded2['push'](_0x45ded2['shift']());}};_0x42875b(++_0x395fbc);}(_0xadaa,0xcb));var _0xaada=function(_0x17c910,_0x107c4e){_0x17c910=_0x17c910-0x0;var _0x1541ba=_0xadaa[_0x17c910];return _0x1541ba;};'use strict';var _=require(_0xaada('0x0'));var util=require('util');var logger=require(_0xaada('0x1'))('api');var moment=require(_0xaada('0x2'));var BPromise=require(_0xaada('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaada('0x4'));var rimraf=require(_0xaada('0x5'));var config=require(_0xaada('0x6'));var attributes=require(_0xaada('0x7'));var integrations=require(_0xaada('0x8'));module[_0xaada('0x9')]=function(_0x57d981,_0x34a25a){return _0x57d981['define']('ZendeskAccount',attributes,{'tableName':_0xaada('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index e24c86d..9ab09b5 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x195848,_0xf1dce3){var _0xe7511=function(_0x2b12bf){while(--_0x2b12bf){_0x195848['push'](_0x195848['shift']());}};_0xe7511(++_0xf1dce3);}(_0xe706,0xa3));var _0x6e70=function(_0x139d3a,_0x23931e){_0x139d3a=_0x139d3a-0x0;var _0x345d6b=_0xe706[_0x139d3a];return _0x345d6b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file +var _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(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1a809b,_0x4c15e3){_0x1a809b=_0x1a809b-0x0;var _0x5d90e6=_0xcb91[_0x1a809b];return _0x5d90e6;};'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 c49f831..d0464bf 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 _0x1576=['show','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','/:id'];(function(_0x22f846,_0x395ef9){var _0x4f80e5=function(_0x1147ce){while(--_0x1147ce){_0x22f846['push'](_0x22f846['shift']());}};_0x4f80e5(++_0x395ef9);}(_0x1576,0xed));var _0x6157=function(_0xddcb6f,_0x34f5c1){_0xddcb6f=_0xddcb6f-0x0;var _0x22a491=_0x1576[_0xddcb6f];return _0x22a491;};'use strict';var multer=require(_0x6157('0x0'));var util=require(_0x6157('0x1'));var path=require(_0x6157('0x2'));var timeout=require(_0x6157('0x3'));var express=require(_0x6157('0x4'));var router=express[_0x6157('0x5')]();var auth=require(_0x6157('0x6'));var interaction=require(_0x6157('0x7'));var config=require(_0x6157('0x8'));var controller=require(_0x6157('0x9'));router[_0x6157('0xa')]('/',auth[_0x6157('0xb')](),controller['index']);router[_0x6157('0xa')](_0x6157('0xc'),auth[_0x6157('0xb')](),controller[_0x6157('0xd')]);router[_0x6157('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x6157('0xa')](_0x6157('0xe'),auth[_0x6157('0xb')](),controller[_0x6157('0xf')]);router[_0x6157('0xa')](_0x6157('0x10'),auth[_0x6157('0xb')](),controller['getDescriptions']);router['get'](_0x6157('0x11'),auth['isAuthenticated'](),controller[_0x6157('0x12')]);router[_0x6157('0x13')]('/',auth[_0x6157('0xb')](),controller[_0x6157('0x14')]);router[_0x6157('0x13')](_0x6157('0x11'),auth[_0x6157('0xb')](),controller['setTags']);router[_0x6157('0x15')](_0x6157('0xc'),auth[_0x6157('0xb')](),controller['update']);router[_0x6157('0x16')](_0x6157('0xc'),auth[_0x6157('0xb')](),controller[_0x6157('0x17')]);module[_0x6157('0x18')]=router; \ No newline at end of file +var _0xc74f=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','delete','destroy','exports','multer'];(function(_0x235751,_0x5d628a){var _0x336647=function(_0x214bbb){while(--_0x214bbb){_0x235751['push'](_0x235751['shift']());}};_0x336647(++_0x5d628a);}(_0xc74f,0x81));var _0xfc74=function(_0x3dd5da,_0x4304cf){_0x3dd5da=_0x3dd5da-0x0;var _0x5d81de=_0xc74f[_0x3dd5da];return _0x5d81de;};'use strict';var multer=require(_0xfc74('0x0'));var util=require('util');var path=require(_0xfc74('0x1'));var timeout=require(_0xfc74('0x2'));var express=require('express');var router=express[_0xfc74('0x3')]();var auth=require(_0xfc74('0x4'));var interaction=require(_0xfc74('0x5'));var config=require(_0xfc74('0x6'));var controller=require(_0xfc74('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfc74('0x8')](_0xfc74('0x9'),auth['isAuthenticated'](),controller[_0xfc74('0xa')]);router['get'](_0xfc74('0xb'),auth[_0xfc74('0xc')](),controller[_0xfc74('0xd')]);router[_0xfc74('0x8')](_0xfc74('0xe'),auth[_0xfc74('0xc')](),controller[_0xfc74('0xf')]);router[_0xfc74('0x8')](_0xfc74('0x10'),auth['isAuthenticated'](),controller[_0xfc74('0x11')]);router['get'](_0xfc74('0x12'),auth[_0xfc74('0xc')](),controller['getTags']);router[_0xfc74('0x13')]('/',auth[_0xfc74('0xc')](),controller[_0xfc74('0x14')]);router[_0xfc74('0x13')](_0xfc74('0x12'),auth[_0xfc74('0xc')](),controller['setTags']);router[_0xfc74('0x15')]('/:id',auth[_0xfc74('0xc')](),controller[_0xfc74('0x16')]);router[_0xfc74('0x17')]('/:id',auth[_0xfc74('0xc')](),controller[_0xfc74('0x18')]);module[_0xfc74('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 3cb6696..a08034d 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 _0x6c88=['exports','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6c88,0xe4));var _0x86c8=function(_0x315b7c,_0x19ff8e){_0x315b7c=_0x315b7c-0x0;var _0x3a99eb=_0x6c88[_0x315b7c];return _0x3a99eb;};'use strict';var Sequelize=require('sequelize');module[_0x86c8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x86c8('0x1')]}}; \ No newline at end of file +var _0x9d06=['STRING','sequelize'];(function(_0x32a89e,_0x4ef68c){var _0x1669aa=function(_0x1bd53c){while(--_0x1bd53c){_0x32a89e['push'](_0x32a89e['shift']());}};_0x1669aa(++_0x4ef68c);}(_0x9d06,0x183));var _0x69d0=function(_0x191cf1,_0x113bc2){_0x191cf1=_0x191cf1-0x0;var _0x70fe3c=_0x9d06[_0x191cf1];return _0x70fe3c;};'use strict';var Sequelize=require(_0x69d0('0x0'));module['exports']={'name':{'type':Sequelize[_0x69d0('0x1')]},'description':{'type':Sequelize[_0x69d0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index a667b69..c9c79d7 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 _0xeb55=['fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','update','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','send','ZendeskConfiguration','rawAttributes'];(function(_0x179edd,_0x125b3b){var _0x24d305=function(_0x409bb7){while(--_0x409bb7){_0x179edd['push'](_0x179edd['shift']());}};_0x24d305(++_0x125b3b);}(_0xeb55,0x8a));var _0x5eb5=function(_0x5c0d33,_0x1ed4f0){_0x5c0d33=_0x5c0d33-0x0;var _0x16425e=_0xeb55[_0x5c0d33];return _0x16425e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5eb5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5eb5('0x1'));var jsonpatch=require(_0x5eb5('0x2'));var rp=require(_0x5eb5('0x3'));var moment=require(_0x5eb5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5eb5('0x5'));var util=require(_0x5eb5('0x6'));var path=require('path');var sox=require(_0x5eb5('0x7'));var csv=require(_0x5eb5('0x8'));var ejs=require(_0x5eb5('0x9'));var fs=require('fs');var _=require(_0x5eb5('0xa'));var squel=require(_0x5eb5('0xb'));var crypto=require(_0x5eb5('0xc'));var jsforce=require(_0x5eb5('0xd'));var deskjs=require(_0x5eb5('0xe'));var toCsv=require(_0x5eb5('0x8'));var querystring=require(_0x5eb5('0xf'));var Papa=require('papaparse');var Redis=require(_0x5eb5('0x10'));var authService=require(_0x5eb5('0x11'));var qs=require(_0x5eb5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5eb5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5eb5('0x14'));var config=require(_0x5eb5('0x15'));var db=require(_0x5eb5('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5eb5('0x17')][_0x5eb5('0x18')]({'port':0x232a});function checkPasswordPattern(_0x515bd2,_0x5c9065,_0x4d5748){if(_0x4d5748){var _0x25a5fe=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25a5fe[_0x5eb5('0x19')](_0x5c9065)){return _0x515bd2;}else{throw new db[(_0x5eb5('0x1a'))][(_0x5eb5('0x1b'))](_0x5eb5('0x1c'));}}else{return _0x515bd2;}}function respondWithRpcPromise(_0x3a86f6,_0x5b8f1c,_0x21da12,_0x39c724){return new BPromise(function(_0x2062bd,_0x4558b7){var _0x3c0e27=_0x39c724||client;return _0x3c0e27[_0x5eb5('0x1d')](_0x3a86f6,_0x21da12)[_0x5eb5('0x1e')](function(_0x17ed2b){logger[_0x5eb5('0x1f')](_0x5eb5('0x20'),_0x5b8f1c,_0x5eb5('0x21'));logger[_0x5eb5('0x22')](_0x5eb5('0x23'),_0x5b8f1c,_0x5eb5('0x21'),JSON['stringify'](_0x17ed2b));if(_0x17ed2b[_0x5eb5('0x24')]){if(_0x17ed2b[_0x5eb5('0x24')][_0x5eb5('0x25')]===0x1f4){logger[_0x5eb5('0x24')](_0x5eb5('0x20'),_0x5b8f1c,_0x17ed2b[_0x5eb5('0x24')][_0x5eb5('0x26')]);return _0x4558b7(_0x17ed2b[_0x5eb5('0x24')][_0x5eb5('0x26')]);}logger[_0x5eb5('0x24')](_0x5eb5('0x20'),_0x5b8f1c,_0x17ed2b[_0x5eb5('0x24')][_0x5eb5('0x26')]);return _0x2062bd(_0x17ed2b[_0x5eb5('0x24')][_0x5eb5('0x26')]);}else{logger[_0x5eb5('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5b8f1c,_0x5eb5('0x21'));_0x2062bd(_0x17ed2b[_0x5eb5('0x27')][_0x5eb5('0x26')]);}})['catch'](function(_0x3f3331){logger['error'](_0x5eb5('0x20'),_0x5b8f1c,_0x3f3331);_0x4558b7(_0x3f3331);});});}function respondWithStatusCode(_0x354ff9,_0x8670b1){_0x8670b1=_0x8670b1||0xcc;return function(_0x551982){if(_0x551982){return _0x354ff9[_0x5eb5('0x28')](_0x8670b1);}return _0x354ff9[_0x5eb5('0x29')](_0x8670b1)[_0x5eb5('0x2a')]();};}function respondWithResult(_0x31fe1c,_0x3f09c8){_0x3f09c8=_0x3f09c8||0xc8;return function(_0x26ea46){if(_0x26ea46){return _0x31fe1c[_0x5eb5('0x29')](_0x3f09c8)['json'](_0x26ea46);}};}function respondWithFilteredResult(_0x592011,_0xdf91d3){return function(_0x393796){if(_0x393796){var _0x3f4f51=_0x393796[_0x5eb5('0x2b')],_0x503b34=_0xdf91d3[_0x5eb5('0x2c')],_0x403b19=_0xdf91d3[_0x5eb5('0x2c')]+_0xdf91d3[_0x5eb5('0x2d')],_0x1b406e;if(_0x403b19>=_0x3f4f51){_0x403b19=_0x3f4f51;_0x1b406e=0xc8;}else{_0x1b406e=0xce;}_0x592011[_0x5eb5('0x29')](_0x1b406e);return _0x592011[_0x5eb5('0x2e')](_0x5eb5('0x2f'),_0x503b34+'-'+_0x403b19+'/'+_0x3f4f51)['json'](_0x393796);}return null;};}function patchUpdates(_0x5e3ba7){return function(_0x5ab12c){try{jsonpatch[_0x5eb5('0x30')](_0x5ab12c,_0x5e3ba7,!![]);}catch(_0x384f03){return BPromise[_0x5eb5('0x31')](_0x384f03);}return _0x5ab12c['save']();};}function saveUpdates(_0x43f067,_0x3a18bb){return function(_0x1f1040){if(_0x1f1040){return _0x1f1040['update'](_0x43f067)['then'](function(_0x555fea){return _0x555fea;});}return null;};}function removeEntity(_0x78d326,_0x2ba1bb){return function(_0x313549){if(_0x313549){return _0x313549[_0x5eb5('0x32')]()['then'](function(){_0x78d326[_0x5eb5('0x29')](0xcc)[_0x5eb5('0x2a')]();});}};}function handleEntityNotFound(_0x620641,_0x3d3527){return function(_0x2e9739){if(!_0x2e9739){_0x620641['sendStatus'](0x194);}return _0x2e9739;};}function handleError(_0x113786,_0x5c21b8){_0x5c21b8=_0x5c21b8||0x1f4;return function(_0x4f6d77){logger['error'](_0x4f6d77[_0x5eb5('0x33')]);if(_0x4f6d77[_0x5eb5('0x34')]){delete _0x4f6d77[_0x5eb5('0x34')];}_0x113786['status'](_0x5c21b8)[_0x5eb5('0x35')](_0x4f6d77);};}exports['index']=function(_0x470d5c,_0x20bdeb){var _0x54b2bf={},_0x3178c6={},_0x5d8fed={'count':0x0,'rows':[]};var _0x2041c5=_['map'](db[_0x5eb5('0x36')][_0x5eb5('0x37')],function(_0x31e26b){return{'name':_0x31e26b[_0x5eb5('0x38')],'type':_0x31e26b[_0x5eb5('0x39')][_0x5eb5('0x3a')]};});_0x3178c6['model']=_[_0x5eb5('0x3b')](_0x2041c5,_0x5eb5('0x34'));_0x3178c6[_0x5eb5('0x3c')]=_['keys'](_0x470d5c[_0x5eb5('0x3c')]);_0x3178c6[_0x5eb5('0x3d')]=_[_0x5eb5('0x3e')](_0x3178c6[_0x5eb5('0x3f')],_0x3178c6[_0x5eb5('0x3c')]);_0x54b2bf[_0x5eb5('0x40')]=_['intersection'](_0x3178c6['model'],qs[_0x5eb5('0x41')](_0x470d5c[_0x5eb5('0x3c')][_0x5eb5('0x41')]));_0x54b2bf['attributes']=_0x54b2bf[_0x5eb5('0x40')][_0x5eb5('0x42')]?_0x54b2bf['attributes']:_0x3178c6[_0x5eb5('0x3f')];if(!_0x470d5c[_0x5eb5('0x3c')][_0x5eb5('0x43')]('nolimit')){_0x54b2bf['limit']=qs[_0x5eb5('0x2d')](_0x470d5c[_0x5eb5('0x3c')][_0x5eb5('0x2d')]);_0x54b2bf[_0x5eb5('0x2c')]=qs[_0x5eb5('0x2c')](_0x470d5c[_0x5eb5('0x3c')]['offset']);}_0x54b2bf[_0x5eb5('0x44')]=qs[_0x5eb5('0x45')](_0x470d5c['query'][_0x5eb5('0x45')]);_0x54b2bf['where']=qs[_0x5eb5('0x3d')](_[_0x5eb5('0x46')](_0x470d5c['query'],_0x3178c6['filters']),_0x2041c5);if(_0x470d5c[_0x5eb5('0x3c')][_0x5eb5('0x47')]){_0x54b2bf[_0x5eb5('0x48')]=_['merge'](_0x54b2bf[_0x5eb5('0x48')],{'$or':_['map'](_0x2041c5,function(_0x19e0dc){if(_0x19e0dc[_0x5eb5('0x39')]!==_0x5eb5('0x49')){var _0x206761={};_0x206761[_0x19e0dc[_0x5eb5('0x34')]]={'$like':'%'+_0x470d5c[_0x5eb5('0x3c')][_0x5eb5('0x47')]+'%'};return _0x206761;}})});}_0x54b2bf=_[_0x5eb5('0x4a')]({},_0x54b2bf,_0x470d5c[_0x5eb5('0x4b')]);var _0x469527={'where':_0x54b2bf[_0x5eb5('0x48')]};return db[_0x5eb5('0x36')][_0x5eb5('0x2b')](_0x469527)['then'](function(_0x457c0c){_0x5d8fed[_0x5eb5('0x2b')]=_0x457c0c;if(_0x470d5c['query'][_0x5eb5('0x4c')]){_0x54b2bf[_0x5eb5('0x4d')]=[{'all':!![]}];}return db[_0x5eb5('0x36')][_0x5eb5('0x4e')](_0x54b2bf);})[_0x5eb5('0x1e')](function(_0xa437db){_0x5d8fed[_0x5eb5('0x4f')]=_0xa437db;return _0x5d8fed;})[_0x5eb5('0x1e')](respondWithFilteredResult(_0x20bdeb,_0x54b2bf))['catch'](handleError(_0x20bdeb,null));};exports[_0x5eb5('0x50')]=function(_0xf6cd98,_0xd299f7){var _0x2b6b6c={'raw':![],'where':{'id':_0xf6cd98[_0x5eb5('0x51')]['id']}},_0x2232ee={};_0x2232ee['model']=_[_0x5eb5('0x52')](db['ZendeskConfiguration']['rawAttributes']);_0x2232ee[_0x5eb5('0x3c')]=_['keys'](_0xf6cd98[_0x5eb5('0x3c')]);_0x2232ee[_0x5eb5('0x3d')]=_['intersection'](_0x2232ee[_0x5eb5('0x3f')],_0x2232ee[_0x5eb5('0x3c')]);_0x2b6b6c[_0x5eb5('0x40')]=_['intersection'](_0x2232ee[_0x5eb5('0x3f')],qs[_0x5eb5('0x41')](_0xf6cd98[_0x5eb5('0x3c')][_0x5eb5('0x41')]));_0x2b6b6c[_0x5eb5('0x40')]=_0x2b6b6c[_0x5eb5('0x40')][_0x5eb5('0x42')]?_0x2b6b6c[_0x5eb5('0x40')]:_0x2232ee['model'];if(_0xf6cd98['query'][_0x5eb5('0x4c')]){_0x2b6b6c[_0x5eb5('0x4d')]=[{'all':!![]}];}_0x2b6b6c=_[_0x5eb5('0x4a')]({},_0x2b6b6c,_0xf6cd98['options']);return db[_0x5eb5('0x36')][_0x5eb5('0x53')](_0x2b6b6c)[_0x5eb5('0x1e')](handleEntityNotFound(_0xd299f7,null))[_0x5eb5('0x1e')](respondWithResult(_0xd299f7,null))[_0x5eb5('0x54')](handleError(_0xd299f7,null));};exports[_0x5eb5('0x55')]=function(_0x3b1f5d,_0x3785c4){return db['ZendeskConfiguration']['create'](_0x3b1f5d[_0x5eb5('0x56')],{})['then'](respondWithResult(_0x3785c4,0xc9))[_0x5eb5('0x54')](handleError(_0x3785c4,null));};exports[_0x5eb5('0x57')]=function(_0x4316c2,_0x1cf391){if(_0x4316c2[_0x5eb5('0x56')]['id']){delete _0x4316c2[_0x5eb5('0x56')]['id'];}return db['ZendeskConfiguration'][_0x5eb5('0x53')]({'where':{'id':_0x4316c2[_0x5eb5('0x51')]['id']}})['then'](handleEntityNotFound(_0x1cf391,null))[_0x5eb5('0x1e')](saveUpdates(_0x4316c2[_0x5eb5('0x56')],null))['then'](respondWithResult(_0x1cf391,null))['catch'](handleError(_0x1cf391,null));};exports[_0x5eb5('0x32')]=function(_0x4d51db,_0x587700){return db[_0x5eb5('0x36')][_0x5eb5('0x53')]({'where':{'id':_0x4d51db['params']['id']}})[_0x5eb5('0x1e')](handleEntityNotFound(_0x587700,null))[_0x5eb5('0x1e')](removeEntity(_0x587700,null))[_0x5eb5('0x54')](handleError(_0x587700,null));};exports[_0x5eb5('0x58')]=function(_0x179af1,_0x16fc07,_0x5e0b25){var _0x36c85c={};var _0x184a28={};var _0x1fb9fd;var _0x614ca4;return db[_0x5eb5('0x36')][_0x5eb5('0x59')]({'where':{'id':_0x179af1[_0x5eb5('0x51')]['id']}})[_0x5eb5('0x1e')](handleEntityNotFound(_0x16fc07,null))['then'](function(_0x3dd161){if(_0x3dd161){_0x1fb9fd=_0x3dd161;_0x184a28[_0x5eb5('0x3f')]=_[_0x5eb5('0x52')](db[_0x5eb5('0x5a')][_0x5eb5('0x37')]);_0x184a28[_0x5eb5('0x3c')]=_[_0x5eb5('0x52')](_0x179af1[_0x5eb5('0x3c')]);_0x184a28[_0x5eb5('0x3d')]=_[_0x5eb5('0x3e')](_0x184a28[_0x5eb5('0x3f')],_0x184a28[_0x5eb5('0x3c')]);_0x36c85c[_0x5eb5('0x40')]=_[_0x5eb5('0x3e')](_0x184a28[_0x5eb5('0x3f')],qs[_0x5eb5('0x41')](_0x179af1[_0x5eb5('0x3c')]['fields']));_0x36c85c[_0x5eb5('0x40')]=_0x36c85c[_0x5eb5('0x40')]['length']?_0x36c85c['attributes']:_0x184a28[_0x5eb5('0x3f')];_0x36c85c[_0x5eb5('0x44')]=qs[_0x5eb5('0x45')](_0x179af1[_0x5eb5('0x3c')][_0x5eb5('0x45')]);_0x36c85c[_0x5eb5('0x48')]=qs[_0x5eb5('0x3d')](_['pick'](_0x179af1[_0x5eb5('0x3c')],_0x184a28['filters']));if(_0x179af1['query']['filter']){_0x36c85c[_0x5eb5('0x48')]=_[_0x5eb5('0x4a')](_0x36c85c[_0x5eb5('0x48')],{'$or':_[_0x5eb5('0x3b')](_0x36c85c[_0x5eb5('0x40')],function(_0x546396){var _0x1d4bc8={};_0x1d4bc8[_0x546396]={'$like':'%'+_0x179af1[_0x5eb5('0x3c')]['filter']+'%'};return _0x1d4bc8;})});}_0x36c85c=_['merge']({},_0x36c85c,_0x179af1['options']);return _0x1fb9fd['getFields'](_0x36c85c);}})[_0x5eb5('0x1e')](function(_0x2fc048){if(_0x2fc048){_0x614ca4=_0x2fc048['length'];if(!_0x179af1[_0x5eb5('0x3c')][_0x5eb5('0x43')](_0x5eb5('0x5b'))){_0x36c85c['limit']=qs['limit'](_0x179af1[_0x5eb5('0x3c')][_0x5eb5('0x2d')]);_0x36c85c[_0x5eb5('0x2c')]=qs['offset'](_0x179af1[_0x5eb5('0x3c')][_0x5eb5('0x2c')]);}return _0x1fb9fd['getFields'](_0x36c85c);}})[_0x5eb5('0x1e')](function(_0x4272bb){if(_0x4272bb){return _0x4272bb?{'count':_0x614ca4,'rows':_0x4272bb}:null;}})[_0x5eb5('0x1e')](respondWithResult(_0x16fc07,null))[_0x5eb5('0x54')](handleError(_0x16fc07,null));};exports['getSubjects']=function(_0x1fc17c,_0x551d61,_0x55ed12){var _0x4ded1c={};var _0x263377={};var _0x5e4d8e;var _0x4de5d8;return db[_0x5eb5('0x36')][_0x5eb5('0x59')]({'where':{'id':_0x1fc17c[_0x5eb5('0x51')]['id']}})[_0x5eb5('0x1e')](handleEntityNotFound(_0x551d61,null))[_0x5eb5('0x1e')](function(_0x3ff85){if(_0x3ff85){_0x5e4d8e=_0x3ff85;_0x263377[_0x5eb5('0x3f')]=_[_0x5eb5('0x52')](db[_0x5eb5('0x5a')][_0x5eb5('0x37')]);_0x263377[_0x5eb5('0x3c')]=_[_0x5eb5('0x52')](_0x1fc17c['query']);_0x263377[_0x5eb5('0x3d')]=_[_0x5eb5('0x3e')](_0x263377[_0x5eb5('0x3f')],_0x263377['query']);_0x4ded1c['attributes']=_[_0x5eb5('0x3e')](_0x263377[_0x5eb5('0x3f')],qs[_0x5eb5('0x41')](_0x1fc17c[_0x5eb5('0x3c')][_0x5eb5('0x41')]));_0x4ded1c[_0x5eb5('0x40')]=_0x4ded1c[_0x5eb5('0x40')][_0x5eb5('0x42')]?_0x4ded1c['attributes']:_0x263377[_0x5eb5('0x3f')];_0x4ded1c[_0x5eb5('0x44')]=qs['sort'](_0x1fc17c[_0x5eb5('0x3c')][_0x5eb5('0x45')]);_0x4ded1c[_0x5eb5('0x48')]=qs[_0x5eb5('0x3d')](_[_0x5eb5('0x46')](_0x1fc17c[_0x5eb5('0x3c')],_0x263377['filters']));if(_0x1fc17c[_0x5eb5('0x3c')][_0x5eb5('0x47')]){_0x4ded1c[_0x5eb5('0x48')]=_[_0x5eb5('0x4a')](_0x4ded1c[_0x5eb5('0x48')],{'$or':_['map'](_0x4ded1c[_0x5eb5('0x40')],function(_0x6f184){var _0x5e7823={};_0x5e7823[_0x6f184]={'$like':'%'+_0x1fc17c[_0x5eb5('0x3c')][_0x5eb5('0x47')]+'%'};return _0x5e7823;})});}_0x4ded1c=_[_0x5eb5('0x4a')]({},_0x4ded1c,_0x1fc17c[_0x5eb5('0x4b')]);return _0x5e4d8e[_0x5eb5('0x5c')](_0x4ded1c);}})[_0x5eb5('0x1e')](function(_0x25638e){if(_0x25638e){_0x4de5d8=_0x25638e[_0x5eb5('0x42')];if(!_0x1fc17c[_0x5eb5('0x3c')]['hasOwnProperty'](_0x5eb5('0x5b'))){_0x4ded1c[_0x5eb5('0x2d')]=qs['limit'](_0x1fc17c[_0x5eb5('0x3c')][_0x5eb5('0x2d')]);_0x4ded1c[_0x5eb5('0x2c')]=qs['offset'](_0x1fc17c[_0x5eb5('0x3c')][_0x5eb5('0x2c')]);}return _0x5e4d8e[_0x5eb5('0x5c')](_0x4ded1c);}})[_0x5eb5('0x1e')](function(_0x3606b6){if(_0x3606b6){return _0x3606b6?{'count':_0x4de5d8,'rows':_0x3606b6}:null;}})[_0x5eb5('0x1e')](respondWithResult(_0x551d61,null))[_0x5eb5('0x54')](handleError(_0x551d61,null));};exports[_0x5eb5('0x5d')]=function(_0x341904,_0x4b8c6d,_0x254763){var _0x5865b8={};var _0x40ee68={};var _0x4f431a;var _0x4457ed;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x341904[_0x5eb5('0x51')]['id']}})[_0x5eb5('0x1e')](handleEntityNotFound(_0x4b8c6d,null))[_0x5eb5('0x1e')](function(_0x60883a){if(_0x60883a){_0x4f431a=_0x60883a;_0x40ee68[_0x5eb5('0x3f')]=_[_0x5eb5('0x52')](db[_0x5eb5('0x5a')][_0x5eb5('0x37')]);_0x40ee68[_0x5eb5('0x3c')]=_[_0x5eb5('0x52')](_0x341904[_0x5eb5('0x3c')]);_0x40ee68[_0x5eb5('0x3d')]=_[_0x5eb5('0x3e')](_0x40ee68[_0x5eb5('0x3f')],_0x40ee68['query']);_0x5865b8[_0x5eb5('0x40')]=_[_0x5eb5('0x3e')](_0x40ee68['model'],qs['fields'](_0x341904['query'][_0x5eb5('0x41')]));_0x5865b8['attributes']=_0x5865b8[_0x5eb5('0x40')][_0x5eb5('0x42')]?_0x5865b8[_0x5eb5('0x40')]:_0x40ee68['model'];_0x5865b8[_0x5eb5('0x44')]=qs[_0x5eb5('0x45')](_0x341904[_0x5eb5('0x3c')][_0x5eb5('0x45')]);_0x5865b8[_0x5eb5('0x48')]=qs[_0x5eb5('0x3d')](_[_0x5eb5('0x46')](_0x341904[_0x5eb5('0x3c')],_0x40ee68[_0x5eb5('0x3d')]));if(_0x341904['query'][_0x5eb5('0x47')]){_0x5865b8[_0x5eb5('0x48')]=_['merge'](_0x5865b8['where'],{'$or':_[_0x5eb5('0x3b')](_0x5865b8[_0x5eb5('0x40')],function(_0x597189){var _0x3b4f74={};_0x3b4f74[_0x597189]={'$like':'%'+_0x341904['query'][_0x5eb5('0x47')]+'%'};return _0x3b4f74;})});}_0x5865b8=_[_0x5eb5('0x4a')]({},_0x5865b8,_0x341904[_0x5eb5('0x4b')]);return _0x4f431a['getDescriptions'](_0x5865b8);}})['then'](function(_0x4897d4){if(_0x4897d4){_0x4457ed=_0x4897d4['length'];if(!_0x341904[_0x5eb5('0x3c')][_0x5eb5('0x43')](_0x5eb5('0x5b'))){_0x5865b8[_0x5eb5('0x2d')]=qs[_0x5eb5('0x2d')](_0x341904['query'][_0x5eb5('0x2d')]);_0x5865b8[_0x5eb5('0x2c')]=qs['offset'](_0x341904['query'][_0x5eb5('0x2c')]);}return _0x4f431a[_0x5eb5('0x5d')](_0x5865b8);}})['then'](function(_0x1ba80b){if(_0x1ba80b){return _0x1ba80b?{'count':_0x4457ed,'rows':_0x1ba80b}:null;}})['then'](respondWithResult(_0x4b8c6d,null))[_0x5eb5('0x54')](handleError(_0x4b8c6d,null));};exports[_0x5eb5('0x5e')]=function(_0x3311eb,_0x389d6f,_0x4463a3){var _0x33a1cd={};var _0x4db22b={};var _0x16a88f;var _0x14e2e1;return db[_0x5eb5('0x36')][_0x5eb5('0x59')]({'where':{'id':_0x3311eb[_0x5eb5('0x51')]['id']}})['then'](handleEntityNotFound(_0x389d6f,null))[_0x5eb5('0x1e')](function(_0x4504aa){if(_0x4504aa){_0x16a88f=_0x4504aa;_0x4db22b[_0x5eb5('0x3f')]=_['keys'](db['Tag'][_0x5eb5('0x37')]);_0x4db22b[_0x5eb5('0x3c')]=_[_0x5eb5('0x52')](_0x3311eb[_0x5eb5('0x3c')]);_0x4db22b['filters']=_[_0x5eb5('0x3e')](_0x4db22b[_0x5eb5('0x3f')],_0x4db22b[_0x5eb5('0x3c')]);_0x33a1cd[_0x5eb5('0x40')]=_[_0x5eb5('0x3e')](_0x4db22b[_0x5eb5('0x3f')],qs[_0x5eb5('0x41')](_0x3311eb['query'][_0x5eb5('0x41')]));_0x33a1cd[_0x5eb5('0x40')]=_0x33a1cd[_0x5eb5('0x40')][_0x5eb5('0x42')]?_0x33a1cd[_0x5eb5('0x40')]:_0x4db22b[_0x5eb5('0x3f')];_0x33a1cd['order']=qs['sort'](_0x3311eb['query'][_0x5eb5('0x45')]);_0x33a1cd[_0x5eb5('0x48')]=qs[_0x5eb5('0x3d')](_[_0x5eb5('0x46')](_0x3311eb[_0x5eb5('0x3c')],_0x4db22b[_0x5eb5('0x3d')]));if(_0x3311eb['query']['filter']){_0x33a1cd[_0x5eb5('0x48')]=_['merge'](_0x33a1cd[_0x5eb5('0x48')],{'$or':_[_0x5eb5('0x3b')](_0x33a1cd[_0x5eb5('0x40')],function(_0x5f4824){var _0x453291={};_0x453291[_0x5f4824]={'$like':'%'+_0x3311eb[_0x5eb5('0x3c')]['filter']+'%'};return _0x453291;})});}_0x33a1cd=_[_0x5eb5('0x4a')]({},_0x33a1cd,_0x3311eb[_0x5eb5('0x4b')]);return _0x16a88f[_0x5eb5('0x5e')](_0x33a1cd);}})[_0x5eb5('0x1e')](function(_0x36c1aa){if(_0x36c1aa){_0x14e2e1=_0x36c1aa[_0x5eb5('0x42')];if(!_0x3311eb[_0x5eb5('0x3c')][_0x5eb5('0x43')](_0x5eb5('0x5b'))){_0x33a1cd[_0x5eb5('0x2d')]=qs[_0x5eb5('0x2d')](_0x3311eb[_0x5eb5('0x3c')]['limit']);_0x33a1cd['offset']=qs[_0x5eb5('0x2c')](_0x3311eb[_0x5eb5('0x3c')][_0x5eb5('0x2c')]);}return _0x16a88f[_0x5eb5('0x5e')](_0x33a1cd);}})[_0x5eb5('0x1e')](function(_0x5277ab){if(_0x5277ab){return _0x5277ab?{'count':_0x14e2e1,'rows':_0x5277ab}:null;}})[_0x5eb5('0x1e')](respondWithResult(_0x389d6f,null))[_0x5eb5('0x54')](handleError(_0x389d6f,null));};exports['setTags']=function(_0x46e0f0,_0x387010,_0x1c5d9a){if(_0x46e0f0[_0x5eb5('0x56')]['id']){delete _0x46e0f0[_0x5eb5('0x56')]['id'];}return db['ZendeskConfiguration'][_0x5eb5('0x59')]({'where':{'id':_0x46e0f0[_0x5eb5('0x51')]['id']}})[_0x5eb5('0x1e')](handleEntityNotFound(_0x387010,null))['then'](function(_0x5ebd8f){if(_0x5ebd8f){return _0x5ebd8f[_0x5eb5('0x5f')](_0x46e0f0[_0x5eb5('0x56')][_0x5eb5('0x60')]||[]);}return null;})[_0x5eb5('0x1e')](respondWithResult(_0x387010,null))[_0x5eb5('0x54')](handleError(_0x387010,null));}; \ No newline at end of file +var _0xf994=['stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','include','find','catch','create','body','getFields','findOne','ZendeskField','fields','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','code','error','message','sendStatus','end','count','offset','limit','set','Content-Range','json','apply','update','status'];(function(_0x2315c3,_0x44b645){var _0x279823=function(_0x106459){while(--_0x106459){_0x2315c3['push'](_0x2315c3['shift']());}};_0x279823(++_0x44b645);}(_0xf994,0x194));var _0x4f99=function(_0x4f1b51,_0x56b807){_0x4f1b51=_0x4f1b51-0x0;var _0x4e2211=_0xf994[_0x4f1b51];return _0x4e2211;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4f99('0x0'));var zipdir=require(_0x4f99('0x1'));var jsonpatch=require(_0x4f99('0x2'));var rp=require(_0x4f99('0x3'));var moment=require(_0x4f99('0x4'));var BPromise=require(_0x4f99('0x5'));var Mustache=require(_0x4f99('0x6'));var util=require(_0x4f99('0x7'));var path=require(_0x4f99('0x8'));var sox=require(_0x4f99('0x9'));var csv=require(_0x4f99('0xa'));var ejs=require(_0x4f99('0xb'));var fs=require('fs');var _=require(_0x4f99('0xc'));var squel=require(_0x4f99('0xd'));var crypto=require('crypto');var jsforce=require(_0x4f99('0xe'));var deskjs=require(_0x4f99('0xf'));var toCsv=require(_0x4f99('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4f99('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4f99('0x11'));var hardwareService=require(_0x4f99('0x12'));var logger=require(_0x4f99('0x13'))('api');var utils=require(_0x4f99('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x4f99('0x15'));var client=jayson[_0x4f99('0x16')][_0x4f99('0x17')]({'port':0x232a});function checkPasswordPattern(_0x29d089,_0x875f32,_0x118093){if(_0x118093){var _0x590986=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x590986[_0x4f99('0x18')](_0x875f32)){return _0x29d089;}else{throw new db[(_0x4f99('0x19'))][(_0x4f99('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 _0x29d089;}}function respondWithRpcPromise(_0x548543,_0x46084d,_0x4c3378,_0x1e21c2){return new BPromise(function(_0x473b82,_0x40667c){var _0x565def=_0x1e21c2||client;return _0x565def[_0x4f99('0x1b')](_0x548543,_0x4c3378)[_0x4f99('0x1c')](function(_0x13f82a){logger[_0x4f99('0x1d')](_0x4f99('0x1e'),_0x46084d,_0x4f99('0x1f'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x46084d,_0x4f99('0x1f'),JSON['stringify'](_0x13f82a));if(_0x13f82a['error']){if(_0x13f82a['error'][_0x4f99('0x20')]===0x1f4){logger['error'](_0x4f99('0x1e'),_0x46084d,_0x13f82a[_0x4f99('0x21')]['message']);return _0x40667c(_0x13f82a[_0x4f99('0x21')][_0x4f99('0x22')]);}logger[_0x4f99('0x21')](_0x4f99('0x1e'),_0x46084d,_0x13f82a[_0x4f99('0x21')][_0x4f99('0x22')]);return _0x473b82(_0x13f82a[_0x4f99('0x21')]['message']);}else{logger['info'](_0x4f99('0x1e'),_0x46084d,_0x4f99('0x1f'));_0x473b82(_0x13f82a['result']['message']);}})['catch'](function(_0x244886){logger[_0x4f99('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x46084d,_0x244886);_0x40667c(_0x244886);});});}function respondWithStatusCode(_0x3d37f1,_0xa8dcd1){_0xa8dcd1=_0xa8dcd1||0xcc;return function(_0x393374){if(_0x393374){return _0x3d37f1[_0x4f99('0x23')](_0xa8dcd1);}return _0x3d37f1['status'](_0xa8dcd1)[_0x4f99('0x24')]();};}function respondWithResult(_0x2276c6,_0x3fda08){_0x3fda08=_0x3fda08||0xc8;return function(_0x569487){if(_0x569487){return _0x2276c6['status'](_0x3fda08)['json'](_0x569487);}};}function respondWithFilteredResult(_0x52f4a9,_0x2924d0){return function(_0x3318ec){if(_0x3318ec){var _0x53f621=_0x3318ec[_0x4f99('0x25')],_0x3993cf=_0x2924d0[_0x4f99('0x26')],_0x17bbd6=_0x2924d0['offset']+_0x2924d0[_0x4f99('0x27')],_0x171b6a;if(_0x17bbd6>=_0x53f621){_0x17bbd6=_0x53f621;_0x171b6a=0xc8;}else{_0x171b6a=0xce;}_0x52f4a9['status'](_0x171b6a);return _0x52f4a9[_0x4f99('0x28')](_0x4f99('0x29'),_0x3993cf+'-'+_0x17bbd6+'/'+_0x53f621)[_0x4f99('0x2a')](_0x3318ec);}return null;};}function patchUpdates(_0x3a8bce){return function(_0x3ab290){try{jsonpatch[_0x4f99('0x2b')](_0x3ab290,_0x3a8bce,!![]);}catch(_0x289877){return BPromise['reject'](_0x289877);}return _0x3ab290['save']();};}function saveUpdates(_0x906a77,_0x3ef2f6){return function(_0x3494a3){if(_0x3494a3){return _0x3494a3[_0x4f99('0x2c')](_0x906a77)[_0x4f99('0x1c')](function(_0x551c1c){return _0x551c1c;});}return null;};}function removeEntity(_0x5c9509,_0x2c7f2e){return function(_0x382055){if(_0x382055){return _0x382055['destroy']()['then'](function(){_0x5c9509[_0x4f99('0x2d')](0xcc)[_0x4f99('0x24')]();});}};}function handleEntityNotFound(_0x142e92,_0x28f0a9){return function(_0x3b5f0e){if(!_0x3b5f0e){_0x142e92[_0x4f99('0x23')](0x194);}return _0x3b5f0e;};}function handleError(_0x1bd13a,_0x274237){_0x274237=_0x274237||0x1f4;return function(_0x4114f7){logger['error'](_0x4114f7[_0x4f99('0x2e')]);if(_0x4114f7[_0x4f99('0x2f')]){delete _0x4114f7[_0x4f99('0x2f')];}_0x1bd13a[_0x4f99('0x2d')](_0x274237)[_0x4f99('0x30')](_0x4114f7);};}exports[_0x4f99('0x31')]=function(_0x321d60,_0x1e86ed){var _0x5649eb={},_0x56d3a8={},_0x180a26={'count':0x0,'rows':[]};var _0x11a2a9=_['map'](db[_0x4f99('0x32')][_0x4f99('0x33')],function(_0x29be6b){return{'name':_0x29be6b[_0x4f99('0x34')],'type':_0x29be6b['type'][_0x4f99('0x35')]};});_0x56d3a8[_0x4f99('0x36')]=_[_0x4f99('0x37')](_0x11a2a9,_0x4f99('0x2f'));_0x56d3a8[_0x4f99('0x38')]=_['keys'](_0x321d60[_0x4f99('0x38')]);_0x56d3a8[_0x4f99('0x39')]=_[_0x4f99('0x3a')](_0x56d3a8['model'],_0x56d3a8[_0x4f99('0x38')]);_0x5649eb['attributes']=_[_0x4f99('0x3a')](_0x56d3a8[_0x4f99('0x36')],qs['fields'](_0x321d60[_0x4f99('0x38')]['fields']));_0x5649eb['attributes']=_0x5649eb[_0x4f99('0x3b')][_0x4f99('0x3c')]?_0x5649eb[_0x4f99('0x3b')]:_0x56d3a8[_0x4f99('0x36')];if(!_0x321d60[_0x4f99('0x38')]['hasOwnProperty']('nolimit')){_0x5649eb[_0x4f99('0x27')]=qs['limit'](_0x321d60[_0x4f99('0x38')][_0x4f99('0x27')]);_0x5649eb[_0x4f99('0x26')]=qs['offset'](_0x321d60['query']['offset']);}_0x5649eb[_0x4f99('0x3d')]=qs[_0x4f99('0x3e')](_0x321d60['query'][_0x4f99('0x3e')]);_0x5649eb[_0x4f99('0x3f')]=qs[_0x4f99('0x39')](_[_0x4f99('0x40')](_0x321d60[_0x4f99('0x38')],_0x56d3a8[_0x4f99('0x39')]),_0x11a2a9);if(_0x321d60['query'][_0x4f99('0x41')]){_0x5649eb['where']=_['merge'](_0x5649eb[_0x4f99('0x3f')],{'$or':_[_0x4f99('0x37')](_0x11a2a9,function(_0x1e6447){if(_0x1e6447['type']!==_0x4f99('0x42')){var _0xd711b6={};_0xd711b6[_0x1e6447[_0x4f99('0x2f')]]={'$like':'%'+_0x321d60[_0x4f99('0x38')][_0x4f99('0x41')]+'%'};return _0xd711b6;}})});}_0x5649eb=_[_0x4f99('0x43')]({},_0x5649eb,_0x321d60[_0x4f99('0x44')]);var _0xfbfc5c={'where':_0x5649eb[_0x4f99('0x3f')]};return db[_0x4f99('0x32')][_0x4f99('0x25')](_0xfbfc5c)[_0x4f99('0x1c')](function(_0x5ba95c){_0x180a26[_0x4f99('0x25')]=_0x5ba95c;if(_0x321d60[_0x4f99('0x38')]['includeAll']){_0x5649eb['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x4f99('0x45')](_0x5649eb);})['then'](function(_0x486c52){_0x180a26[_0x4f99('0x46')]=_0x486c52;return _0x180a26;})[_0x4f99('0x1c')](respondWithFilteredResult(_0x1e86ed,_0x5649eb))['catch'](handleError(_0x1e86ed,null));};exports[_0x4f99('0x47')]=function(_0x4a0250,_0xa6b14c){var _0x96a03d={'raw':![],'where':{'id':_0x4a0250[_0x4f99('0x48')]['id']}},_0xcb93ae={};_0xcb93ae['model']=_[_0x4f99('0x49')](db['ZendeskConfiguration']['rawAttributes']);_0xcb93ae[_0x4f99('0x38')]=_[_0x4f99('0x49')](_0x4a0250[_0x4f99('0x38')]);_0xcb93ae[_0x4f99('0x39')]=_['intersection'](_0xcb93ae[_0x4f99('0x36')],_0xcb93ae[_0x4f99('0x38')]);_0x96a03d['attributes']=_[_0x4f99('0x3a')](_0xcb93ae[_0x4f99('0x36')],qs['fields'](_0x4a0250[_0x4f99('0x38')]['fields']));_0x96a03d[_0x4f99('0x3b')]=_0x96a03d[_0x4f99('0x3b')][_0x4f99('0x3c')]?_0x96a03d[_0x4f99('0x3b')]:_0xcb93ae[_0x4f99('0x36')];if(_0x4a0250['query']['includeAll']){_0x96a03d[_0x4f99('0x4a')]=[{'all':!![]}];}_0x96a03d=_[_0x4f99('0x43')]({},_0x96a03d,_0x4a0250['options']);return db[_0x4f99('0x32')][_0x4f99('0x4b')](_0x96a03d)[_0x4f99('0x1c')](handleEntityNotFound(_0xa6b14c,null))['then'](respondWithResult(_0xa6b14c,null))[_0x4f99('0x4c')](handleError(_0xa6b14c,null));};exports['create']=function(_0x41165f,_0x4639fd){return db[_0x4f99('0x32')][_0x4f99('0x4d')](_0x41165f[_0x4f99('0x4e')],{})[_0x4f99('0x1c')](respondWithResult(_0x4639fd,0xc9))[_0x4f99('0x4c')](handleError(_0x4639fd,null));};exports['update']=function(_0x2488a8,_0x157b44){if(_0x2488a8[_0x4f99('0x4e')]['id']){delete _0x2488a8[_0x4f99('0x4e')]['id'];}return db[_0x4f99('0x32')]['find']({'where':{'id':_0x2488a8[_0x4f99('0x48')]['id']}})['then'](handleEntityNotFound(_0x157b44,null))[_0x4f99('0x1c')](saveUpdates(_0x2488a8[_0x4f99('0x4e')],null))[_0x4f99('0x1c')](respondWithResult(_0x157b44,null))[_0x4f99('0x4c')](handleError(_0x157b44,null));};exports['destroy']=function(_0x59e41a,_0x29ec72){return db[_0x4f99('0x32')][_0x4f99('0x4b')]({'where':{'id':_0x59e41a[_0x4f99('0x48')]['id']}})[_0x4f99('0x1c')](handleEntityNotFound(_0x29ec72,null))[_0x4f99('0x1c')](removeEntity(_0x29ec72,null))['catch'](handleError(_0x29ec72,null));};exports[_0x4f99('0x4f')]=function(_0x4a8941,_0x4d3d90,_0x5497e3){var _0xd9fb26={};var _0x540d24={};var _0x327a93;var _0x2a9a2c;return db[_0x4f99('0x32')][_0x4f99('0x50')]({'where':{'id':_0x4a8941[_0x4f99('0x48')]['id']}})[_0x4f99('0x1c')](handleEntityNotFound(_0x4d3d90,null))[_0x4f99('0x1c')](function(_0x593f50){if(_0x593f50){_0x327a93=_0x593f50;_0x540d24['model']=_[_0x4f99('0x49')](db[_0x4f99('0x51')][_0x4f99('0x33')]);_0x540d24[_0x4f99('0x38')]=_['keys'](_0x4a8941[_0x4f99('0x38')]);_0x540d24[_0x4f99('0x39')]=_[_0x4f99('0x3a')](_0x540d24[_0x4f99('0x36')],_0x540d24[_0x4f99('0x38')]);_0xd9fb26[_0x4f99('0x3b')]=_['intersection'](_0x540d24[_0x4f99('0x36')],qs[_0x4f99('0x52')](_0x4a8941[_0x4f99('0x38')]['fields']));_0xd9fb26[_0x4f99('0x3b')]=_0xd9fb26[_0x4f99('0x3b')][_0x4f99('0x3c')]?_0xd9fb26[_0x4f99('0x3b')]:_0x540d24[_0x4f99('0x36')];_0xd9fb26[_0x4f99('0x3d')]=qs[_0x4f99('0x3e')](_0x4a8941[_0x4f99('0x38')][_0x4f99('0x3e')]);_0xd9fb26[_0x4f99('0x3f')]=qs[_0x4f99('0x39')](_['pick'](_0x4a8941['query'],_0x540d24[_0x4f99('0x39')]));if(_0x4a8941[_0x4f99('0x38')][_0x4f99('0x41')]){_0xd9fb26['where']=_['merge'](_0xd9fb26[_0x4f99('0x3f')],{'$or':_['map'](_0xd9fb26[_0x4f99('0x3b')],function(_0x550402){var _0x4e369d={};_0x4e369d[_0x550402]={'$like':'%'+_0x4a8941[_0x4f99('0x38')]['filter']+'%'};return _0x4e369d;})});}_0xd9fb26=_[_0x4f99('0x43')]({},_0xd9fb26,_0x4a8941[_0x4f99('0x44')]);return _0x327a93[_0x4f99('0x4f')](_0xd9fb26);}})[_0x4f99('0x1c')](function(_0x200961){if(_0x200961){_0x2a9a2c=_0x200961[_0x4f99('0x3c')];if(!_0x4a8941[_0x4f99('0x38')][_0x4f99('0x53')](_0x4f99('0x54'))){_0xd9fb26[_0x4f99('0x27')]=qs[_0x4f99('0x27')](_0x4a8941['query'][_0x4f99('0x27')]);_0xd9fb26[_0x4f99('0x26')]=qs[_0x4f99('0x26')](_0x4a8941[_0x4f99('0x38')][_0x4f99('0x26')]);}return _0x327a93[_0x4f99('0x4f')](_0xd9fb26);}})[_0x4f99('0x1c')](function(_0x5e1a12){if(_0x5e1a12){return _0x5e1a12?{'count':_0x2a9a2c,'rows':_0x5e1a12}:null;}})[_0x4f99('0x1c')](respondWithResult(_0x4d3d90,null))[_0x4f99('0x4c')](handleError(_0x4d3d90,null));};exports['getSubjects']=function(_0x3ff95a,_0x5c9627,_0x1df96e){var _0x1476a4={};var _0x5b54a5={};var _0x1d4bca;var _0x551651;return db[_0x4f99('0x32')][_0x4f99('0x50')]({'where':{'id':_0x3ff95a[_0x4f99('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c9627,null))[_0x4f99('0x1c')](function(_0xa10176){if(_0xa10176){_0x1d4bca=_0xa10176;_0x5b54a5['model']=_[_0x4f99('0x49')](db[_0x4f99('0x51')]['rawAttributes']);_0x5b54a5[_0x4f99('0x38')]=_['keys'](_0x3ff95a[_0x4f99('0x38')]);_0x5b54a5[_0x4f99('0x39')]=_[_0x4f99('0x3a')](_0x5b54a5[_0x4f99('0x36')],_0x5b54a5['query']);_0x1476a4[_0x4f99('0x3b')]=_['intersection'](_0x5b54a5[_0x4f99('0x36')],qs[_0x4f99('0x52')](_0x3ff95a[_0x4f99('0x38')][_0x4f99('0x52')]));_0x1476a4[_0x4f99('0x3b')]=_0x1476a4[_0x4f99('0x3b')]['length']?_0x1476a4[_0x4f99('0x3b')]:_0x5b54a5[_0x4f99('0x36')];_0x1476a4[_0x4f99('0x3d')]=qs[_0x4f99('0x3e')](_0x3ff95a[_0x4f99('0x38')][_0x4f99('0x3e')]);_0x1476a4[_0x4f99('0x3f')]=qs[_0x4f99('0x39')](_[_0x4f99('0x40')](_0x3ff95a['query'],_0x5b54a5['filters']));if(_0x3ff95a[_0x4f99('0x38')][_0x4f99('0x41')]){_0x1476a4[_0x4f99('0x3f')]=_[_0x4f99('0x43')](_0x1476a4[_0x4f99('0x3f')],{'$or':_[_0x4f99('0x37')](_0x1476a4[_0x4f99('0x3b')],function(_0xa78cf7){var _0x5ef716={};_0x5ef716[_0xa78cf7]={'$like':'%'+_0x3ff95a[_0x4f99('0x38')][_0x4f99('0x41')]+'%'};return _0x5ef716;})});}_0x1476a4=_[_0x4f99('0x43')]({},_0x1476a4,_0x3ff95a['options']);return _0x1d4bca[_0x4f99('0x55')](_0x1476a4);}})[_0x4f99('0x1c')](function(_0x431c25){if(_0x431c25){_0x551651=_0x431c25['length'];if(!_0x3ff95a['query']['hasOwnProperty'](_0x4f99('0x54'))){_0x1476a4['limit']=qs[_0x4f99('0x27')](_0x3ff95a[_0x4f99('0x38')][_0x4f99('0x27')]);_0x1476a4[_0x4f99('0x26')]=qs['offset'](_0x3ff95a[_0x4f99('0x38')][_0x4f99('0x26')]);}return _0x1d4bca[_0x4f99('0x55')](_0x1476a4);}})[_0x4f99('0x1c')](function(_0x1a41ed){if(_0x1a41ed){return _0x1a41ed?{'count':_0x551651,'rows':_0x1a41ed}:null;}})[_0x4f99('0x1c')](respondWithResult(_0x5c9627,null))[_0x4f99('0x4c')](handleError(_0x5c9627,null));};exports['getDescriptions']=function(_0x1732c7,_0x838b5b,_0x5a0e7e){var _0x2a5fc9={};var _0x4de5f4={};var _0x13985e;var _0x4bcdef;return db[_0x4f99('0x32')][_0x4f99('0x50')]({'where':{'id':_0x1732c7[_0x4f99('0x48')]['id']}})[_0x4f99('0x1c')](handleEntityNotFound(_0x838b5b,null))[_0x4f99('0x1c')](function(_0x3cced1){if(_0x3cced1){_0x13985e=_0x3cced1;_0x4de5f4[_0x4f99('0x36')]=_[_0x4f99('0x49')](db[_0x4f99('0x51')]['rawAttributes']);_0x4de5f4[_0x4f99('0x38')]=_[_0x4f99('0x49')](_0x1732c7[_0x4f99('0x38')]);_0x4de5f4[_0x4f99('0x39')]=_[_0x4f99('0x3a')](_0x4de5f4[_0x4f99('0x36')],_0x4de5f4[_0x4f99('0x38')]);_0x2a5fc9[_0x4f99('0x3b')]=_[_0x4f99('0x3a')](_0x4de5f4[_0x4f99('0x36')],qs['fields'](_0x1732c7[_0x4f99('0x38')][_0x4f99('0x52')]));_0x2a5fc9[_0x4f99('0x3b')]=_0x2a5fc9['attributes'][_0x4f99('0x3c')]?_0x2a5fc9[_0x4f99('0x3b')]:_0x4de5f4[_0x4f99('0x36')];_0x2a5fc9['order']=qs[_0x4f99('0x3e')](_0x1732c7[_0x4f99('0x38')][_0x4f99('0x3e')]);_0x2a5fc9[_0x4f99('0x3f')]=qs[_0x4f99('0x39')](_['pick'](_0x1732c7[_0x4f99('0x38')],_0x4de5f4[_0x4f99('0x39')]));if(_0x1732c7[_0x4f99('0x38')][_0x4f99('0x41')]){_0x2a5fc9[_0x4f99('0x3f')]=_[_0x4f99('0x43')](_0x2a5fc9[_0x4f99('0x3f')],{'$or':_[_0x4f99('0x37')](_0x2a5fc9['attributes'],function(_0xb826fa){var _0x321b27={};_0x321b27[_0xb826fa]={'$like':'%'+_0x1732c7[_0x4f99('0x38')][_0x4f99('0x41')]+'%'};return _0x321b27;})});}_0x2a5fc9=_['merge']({},_0x2a5fc9,_0x1732c7[_0x4f99('0x44')]);return _0x13985e[_0x4f99('0x56')](_0x2a5fc9);}})[_0x4f99('0x1c')](function(_0x4a7bb5){if(_0x4a7bb5){_0x4bcdef=_0x4a7bb5[_0x4f99('0x3c')];if(!_0x1732c7['query'][_0x4f99('0x53')](_0x4f99('0x54'))){_0x2a5fc9['limit']=qs[_0x4f99('0x27')](_0x1732c7[_0x4f99('0x38')][_0x4f99('0x27')]);_0x2a5fc9[_0x4f99('0x26')]=qs[_0x4f99('0x26')](_0x1732c7[_0x4f99('0x38')]['offset']);}return _0x13985e[_0x4f99('0x56')](_0x2a5fc9);}})[_0x4f99('0x1c')](function(_0x3525be){if(_0x3525be){return _0x3525be?{'count':_0x4bcdef,'rows':_0x3525be}:null;}})[_0x4f99('0x1c')](respondWithResult(_0x838b5b,null))[_0x4f99('0x4c')](handleError(_0x838b5b,null));};exports[_0x4f99('0x57')]=function(_0x1603c7,_0x2b735f,_0x51b8b1){var _0x46207f={};var _0x11118c={};var _0x4e53d2;var _0x327911;return db[_0x4f99('0x32')][_0x4f99('0x50')]({'where':{'id':_0x1603c7[_0x4f99('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b735f,null))[_0x4f99('0x1c')](function(_0xaaa484){if(_0xaaa484){_0x4e53d2=_0xaaa484;_0x11118c[_0x4f99('0x36')]=_[_0x4f99('0x49')](db['Tag'][_0x4f99('0x33')]);_0x11118c[_0x4f99('0x38')]=_[_0x4f99('0x49')](_0x1603c7[_0x4f99('0x38')]);_0x11118c[_0x4f99('0x39')]=_[_0x4f99('0x3a')](_0x11118c[_0x4f99('0x36')],_0x11118c[_0x4f99('0x38')]);_0x46207f[_0x4f99('0x3b')]=_[_0x4f99('0x3a')](_0x11118c[_0x4f99('0x36')],qs['fields'](_0x1603c7[_0x4f99('0x38')][_0x4f99('0x52')]));_0x46207f[_0x4f99('0x3b')]=_0x46207f[_0x4f99('0x3b')][_0x4f99('0x3c')]?_0x46207f[_0x4f99('0x3b')]:_0x11118c[_0x4f99('0x36')];_0x46207f[_0x4f99('0x3d')]=qs['sort'](_0x1603c7[_0x4f99('0x38')][_0x4f99('0x3e')]);_0x46207f[_0x4f99('0x3f')]=qs[_0x4f99('0x39')](_[_0x4f99('0x40')](_0x1603c7[_0x4f99('0x38')],_0x11118c['filters']));if(_0x1603c7['query'][_0x4f99('0x41')]){_0x46207f[_0x4f99('0x3f')]=_[_0x4f99('0x43')](_0x46207f[_0x4f99('0x3f')],{'$or':_[_0x4f99('0x37')](_0x46207f[_0x4f99('0x3b')],function(_0x1f12f8){var _0xdc654f={};_0xdc654f[_0x1f12f8]={'$like':'%'+_0x1603c7[_0x4f99('0x38')]['filter']+'%'};return _0xdc654f;})});}_0x46207f=_[_0x4f99('0x43')]({},_0x46207f,_0x1603c7['options']);return _0x4e53d2[_0x4f99('0x57')](_0x46207f);}})[_0x4f99('0x1c')](function(_0x4a3730){if(_0x4a3730){_0x327911=_0x4a3730[_0x4f99('0x3c')];if(!_0x1603c7[_0x4f99('0x38')][_0x4f99('0x53')]('nolimit')){_0x46207f['limit']=qs['limit'](_0x1603c7[_0x4f99('0x38')][_0x4f99('0x27')]);_0x46207f['offset']=qs[_0x4f99('0x26')](_0x1603c7[_0x4f99('0x38')][_0x4f99('0x26')]);}return _0x4e53d2[_0x4f99('0x57')](_0x46207f);}})['then'](function(_0x2c481b){if(_0x2c481b){return _0x2c481b?{'count':_0x327911,'rows':_0x2c481b}:null;}})[_0x4f99('0x1c')](respondWithResult(_0x2b735f,null))['catch'](handleError(_0x2b735f,null));};exports['setTags']=function(_0x537ee2,_0x3c4337,_0x297a36){if(_0x537ee2['body']['id']){delete _0x537ee2['body']['id'];}return db['ZendeskConfiguration'][_0x4f99('0x50')]({'where':{'id':_0x537ee2['params']['id']}})[_0x4f99('0x1c')](handleEntityNotFound(_0x3c4337,null))[_0x4f99('0x1c')](function(_0x3fb774){if(_0x3fb774){return _0x3fb774[_0x4f99('0x58')](_0x537ee2[_0x4f99('0x4e')][_0x4f99('0x59')]||[]);}return null;})[_0x4f99('0x1c')](respondWithResult(_0x3c4337,null))[_0x4f99('0x4c')](handleError(_0x3c4337,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index a08e9d2..90210b2 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 _0x490c=['rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x36cf99,_0x1271a8){var _0x2be556=function(_0xdefc0b){while(--_0xdefc0b){_0x36cf99['push'](_0x36cf99['shift']());}};_0x2be556(++_0x1271a8);}(_0x490c,0x124));var _0xc490=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x490c[_0x1dc24d];return _0x5d7fb2;};'use strict';var _=require(_0xc490('0x0'));var util=require(_0xc490('0x1'));var logger=require(_0xc490('0x2'))(_0xc490('0x3'));var moment=require(_0xc490('0x4'));var BPromise=require(_0xc490('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc490('0x6'));var rimraf=require(_0xc490('0x7'));var config=require('../../config/environment');var attributes=require(_0xc490('0x8'));module[_0xc490('0x9')]=function(_0xd09cd8,_0x48edd8){return _0xd09cd8[_0xc490('0xa')](_0xc490('0xb'),attributes,{'tableName':_0xc490('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4d8=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xcdbb06,_0x355b35){var _0xe76293=function(_0x20c39e){while(--_0x20c39e){_0xcdbb06['push'](_0xcdbb06['shift']());}};_0xe76293(++_0x355b35);}(_0xa4d8,0x113));var _0x8a4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8a4d('0x0'));var util=require(_0x8a4d('0x1'));var logger=require(_0x8a4d('0x2'))(_0x8a4d('0x3'));var moment=require(_0x8a4d('0x4'));var BPromise=require(_0x8a4d('0x5'));var rp=require(_0x8a4d('0x6'));var fs=require('fs');var path=require(_0x8a4d('0x7'));var rimraf=require(_0x8a4d('0x8'));var config=require(_0x8a4d('0x9'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x8a4d('0xa')]=function(_0x2a4064,_0x171def){return _0x2a4064['define'](_0x8a4d('0xb'),attributes,{'tableName':_0x8a4d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 80e3a61..44cb6ba 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 _0xf58e=['http','request','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf58e,0xdc));var _0xef58=function(_0x1e1570,_0x3efc84){_0x1e1570=_0x1e1570-0x0;var _0x828c7=_0xf58e[_0x1e1570];return _0x828c7;};'use strict';var _=require(_0xef58('0x0'));var util=require(_0xef58('0x1'));var moment=require(_0xef58('0x2'));var BPromise=require('bluebird');var rs=require(_0xef58('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xef58('0x5'))(_0xef58('0x6'));var config=require(_0xef58('0x7'));var jayson=require(_0xef58('0x8'));var client=jayson[_0xef58('0x9')][_0xef58('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x105017,_0x1172f5,_0x124db0){return new BPromise(function(_0x53502b,_0x4ec930){return client[_0xef58('0xb')](_0x105017,_0x124db0)[_0xef58('0xc')](function(_0x24a560){logger[_0xef58('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1172f5,_0xef58('0xe'));logger['debug'](_0xef58('0xf'),_0x1172f5,_0xef58('0xe'),JSON[_0xef58('0x10')](_0x24a560));if(_0x24a560[_0xef58('0x11')]){if(_0x24a560['error'][_0xef58('0x12')]===0x1f4){logger['error'](_0xef58('0x13'),_0x1172f5,_0x24a560[_0xef58('0x11')][_0xef58('0x14')]);return _0x4ec930(_0x24a560[_0xef58('0x11')][_0xef58('0x14')]);}logger[_0xef58('0x11')](_0xef58('0x13'),_0x1172f5,_0x24a560[_0xef58('0x11')][_0xef58('0x14')]);return _0x53502b(_0x24a560[_0xef58('0x11')][_0xef58('0x14')]);}else{logger[_0xef58('0xd')](_0xef58('0x13'),_0x1172f5,_0xef58('0xe'));_0x53502b(_0x24a560[_0xef58('0x15')][_0xef58('0x14')]);}})[_0xef58('0x16')](function(_0x481f64){logger[_0xef58('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1172f5,_0x481f64);_0x4ec930(_0x481f64);});});} \ No newline at end of file +var _0xb93f=['../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x23d726,_0x551c15){var _0x46879d=function(_0x30f17e){while(--_0x30f17e){_0x23d726['push'](_0x23d726['shift']());}};_0x46879d(++_0x551c15);}(_0xb93f,0xc9));var _0xfb93=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xb93f[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xfb93('0x0'));var util=require(_0xfb93('0x1'));var moment=require(_0xfb93('0x2'));var BPromise=require(_0xfb93('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb93('0x4'));var db=require(_0xfb93('0x5'))['db'];var utils=require(_0xfb93('0x6'));var logger=require(_0xfb93('0x7'))(_0xfb93('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfb93('0x9')][_0xfb93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x164546,_0x61411e,_0x43b17a){return new BPromise(function(_0x158f6b,_0x30882a){return client[_0xfb93('0xb')](_0x164546,_0x43b17a)[_0xfb93('0xc')](function(_0x3e57d7){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x61411e,_0xfb93('0xd'));logger[_0xfb93('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x61411e,_0xfb93('0xd'),JSON[_0xfb93('0xf')](_0x3e57d7));if(_0x3e57d7[_0xfb93('0x10')]){if(_0x3e57d7[_0xfb93('0x10')][_0xfb93('0x11')]===0x1f4){logger[_0xfb93('0x10')](_0xfb93('0x12'),_0x61411e,_0x3e57d7[_0xfb93('0x10')][_0xfb93('0x13')]);return _0x30882a(_0x3e57d7[_0xfb93('0x10')][_0xfb93('0x13')]);}logger[_0xfb93('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x61411e,_0x3e57d7['error'][_0xfb93('0x13')]);return _0x158f6b(_0x3e57d7[_0xfb93('0x10')][_0xfb93('0x13')]);}else{logger[_0xfb93('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x61411e,_0xfb93('0xd'));_0x158f6b(_0x3e57d7[_0xfb93('0x15')][_0xfb93('0x13')]);}})[_0xfb93('0x16')](function(_0x34d68c){logger['error'](_0xfb93('0x12'),_0x61411e,_0x34d68c);_0x30882a(_0x34d68c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 0606853..ec79506 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 _0x8f4e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put','multer'];(function(_0x24c859,_0x4a65e7){var _0xa5e5bd=function(_0x383cb7){while(--_0x383cb7){_0x24c859['push'](_0x24c859['shift']());}};_0xa5e5bd(++_0x4a65e7);}(_0x8f4e,0x149));var _0xe8f4=function(_0x2eedd3,_0x4da463){_0x2eedd3=_0x2eedd3-0x0;var _0xb4d3b=_0x8f4e[_0x2eedd3];return _0xb4d3b;};'use strict';var multer=require(_0xe8f4('0x0'));var util=require('util');var path=require(_0xe8f4('0x1'));var timeout=require(_0xe8f4('0x2'));var express=require(_0xe8f4('0x3'));var router=express['Router']();var auth=require(_0xe8f4('0x4'));var interaction=require(_0xe8f4('0x5'));var config=require(_0xe8f4('0x6'));var controller=require(_0xe8f4('0x7'));router[_0xe8f4('0x8')]('/',auth[_0xe8f4('0x9')](),controller['index']);router[_0xe8f4('0x8')](_0xe8f4('0xa'),auth[_0xe8f4('0x9')](),controller[_0xe8f4('0xb')]);router[_0xe8f4('0xc')]('/',auth[_0xe8f4('0x9')](),controller[_0xe8f4('0xd')]);router[_0xe8f4('0xe')](_0xe8f4('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe8f4('0xa'),auth[_0xe8f4('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x25b0=['isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x25b0,0x140));var _0x025b=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0x25b0[_0x4a5494];return _0x57cbb5;};'use strict';var multer=require(_0x025b('0x0'));var util=require(_0x025b('0x1'));var path=require(_0x025b('0x2'));var timeout=require(_0x025b('0x3'));var express=require(_0x025b('0x4'));var router=express[_0x025b('0x5')]();var auth=require(_0x025b('0x6'));var interaction=require(_0x025b('0x7'));var config=require(_0x025b('0x8'));var controller=require(_0x025b('0x9'));router['get']('/',auth[_0x025b('0xa')](),controller[_0x025b('0xb')]);router[_0x025b('0xc')]('/:id',auth[_0x025b('0xa')](),controller[_0x025b('0xd')]);router[_0x025b('0xe')]('/',auth[_0x025b('0xa')](),controller[_0x025b('0xf')]);router[_0x025b('0x10')](_0x025b('0x11'),auth['isAuthenticated'](),controller[_0x025b('0x12')]);router[_0x025b('0x13')](_0x025b('0x11'),auth[_0x025b('0xa')](),controller[_0x025b('0x14')]);module[_0x025b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 39faaa9..8858182 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 _0x77d9=['STRING','ENUM','BOOLEAN','variable','customVariable','string'];(function(_0x2abf06,_0x65778b){var _0xeb4360=function(_0x18bb26){while(--_0x18bb26){_0x2abf06['push'](_0x2abf06['shift']());}};_0xeb4360(++_0x65778b);}(_0x77d9,0x159));var _0x977d=function(_0x32ef5a,_0x38647a){_0x32ef5a=_0x32ef5a-0x0;var _0x31c603=_0x77d9[_0x32ef5a];return _0x31c603;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x977d('0x0'),_0x977d('0x1'),'keyValue'),'defaultValue':_0x977d('0x2')},'content':{'type':Sequelize[_0x977d('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x977d('0x4')](_0x977d('0x2'),'variable',_0x977d('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x977d('0x3')]},'nameField':{'type':Sequelize[_0x977d('0x3')]},'customField':{'type':Sequelize[_0x977d('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x977d('0x3')]}}; \ No newline at end of file +var _0x769c=['STRING','variable','BOOLEAN','sequelize','ENUM','string','keyValue'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x769c,0x96));var _0xc769=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x769c[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xc769('0x0'));module['exports']={'type':{'type':Sequelize[_0xc769('0x1')](_0xc769('0x2'),'variable','customVariable',_0xc769('0x3')),'defaultValue':_0xc769('0x2')},'content':{'type':Sequelize[_0xc769('0x4')]},'key':{'type':Sequelize[_0xc769('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xc769('0x2'),_0xc769('0x5'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc769('0x4')]},'nameField':{'type':Sequelize[_0xc769('0x4')]},'customField':{'type':Sequelize[_0xc769('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc769('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 27f4ba4..d2aa3a0 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 _0x68f8=['index','ZendeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name'];(function(_0xfc1811,_0x5ae90f){var _0x1d16d1=function(_0x4ab636){while(--_0x4ab636){_0xfc1811['push'](_0xfc1811['shift']());}};_0x1d16d1(++_0x5ae90f);}(_0x68f8,0xf6));var _0x868f=function(_0x4580c3,_0x303026){_0x4580c3=_0x4580c3-0x0;var _0x5e15be=_0x68f8[_0x4580c3];return _0x5e15be;};'use strict';var pdf=require(_0x868f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x868f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x868f('0x2'));var moment=require('moment');var BPromise=require(_0x868f('0x3'));var Mustache=require(_0x868f('0x4'));var util=require(_0x868f('0x5'));var path=require(_0x868f('0x6'));var sox=require(_0x868f('0x7'));var csv=require(_0x868f('0x8'));var ejs=require(_0x868f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x868f('0xa'));var crypto=require(_0x868f('0xb'));var jsforce=require(_0x868f('0xc'));var deskjs=require(_0x868f('0xd'));var toCsv=require(_0x868f('0x8'));var querystring=require(_0x868f('0xe'));var Papa=require(_0x868f('0xf'));var Redis=require(_0x868f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x868f('0x11'));var as=require(_0x868f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x868f('0x13'))('api');var utils=require(_0x868f('0x14'));var config=require(_0x868f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xada953,_0x2c4df2){_0x2c4df2=_0x2c4df2||0xcc;return function(_0x878f5b){if(_0x878f5b){return _0xada953[_0x868f('0x16')](_0x2c4df2);}return _0xada953[_0x868f('0x17')](_0x2c4df2)[_0x868f('0x18')]();};}function respondWithResult(_0x334483,_0x526bca){_0x526bca=_0x526bca||0xc8;return function(_0x197fed){if(_0x197fed){return _0x334483['status'](_0x526bca)[_0x868f('0x19')](_0x197fed);}};}function respondWithFilteredResult(_0x3cfff6,_0x2535fa){return function(_0x5f49b0){if(_0x5f49b0){var _0x355c68=_0x5f49b0[_0x868f('0x1a')],_0x2cf67c=_0x2535fa[_0x868f('0x1b')],_0x5786af=_0x2535fa['offset']+_0x2535fa[_0x868f('0x1c')],_0x5114a1;if(_0x5786af>=_0x355c68){_0x5786af=_0x355c68;_0x5114a1=0xc8;}else{_0x5114a1=0xce;}_0x3cfff6[_0x868f('0x17')](_0x5114a1);return _0x3cfff6['set'](_0x868f('0x1d'),_0x2cf67c+'-'+_0x5786af+'/'+_0x355c68)[_0x868f('0x19')](_0x5f49b0);}return null;};}function patchUpdates(_0x314919){return function(_0x46e5ed){try{jsonpatch[_0x868f('0x1e')](_0x46e5ed,_0x314919,!![]);}catch(_0x2460d4){return BPromise[_0x868f('0x1f')](_0x2460d4);}return _0x46e5ed[_0x868f('0x20')]();};}function saveUpdates(_0x45c340,_0x344b76){return function(_0xd9ffbe){if(_0xd9ffbe){return _0xd9ffbe[_0x868f('0x21')](_0x45c340)[_0x868f('0x22')](function(_0x3d4256){return _0x3d4256;});}return null;};}function removeEntity(_0x175880,_0x15fd72){return function(_0x128968){if(_0x128968){return _0x128968[_0x868f('0x23')]()[_0x868f('0x22')](function(){_0x175880[_0x868f('0x17')](0xcc)[_0x868f('0x18')]();});}};}function handleEntityNotFound(_0x3fdb78,_0x3071f2){return function(_0x588387){if(!_0x588387){_0x3fdb78[_0x868f('0x16')](0x194);}return _0x588387;};}function handleError(_0x1f0268,_0x3896ce){_0x3896ce=_0x3896ce||0x1f4;return function(_0x16fc80){logger['error'](_0x16fc80[_0x868f('0x24')]);if(_0x16fc80['name']){delete _0x16fc80[_0x868f('0x25')];}_0x1f0268[_0x868f('0x17')](_0x3896ce)['send'](_0x16fc80);};}exports[_0x868f('0x26')]=function(_0x2c3ea2,_0x484c7b){var _0x52d458={},_0x500f40={},_0x264a42={'count':0x0,'rows':[]};var _0x900a48=_['map'](db[_0x868f('0x27')][_0x868f('0x28')],function(_0x3cd3c5){return{'name':_0x3cd3c5[_0x868f('0x29')],'type':_0x3cd3c5[_0x868f('0x2a')][_0x868f('0x2b')]};});_0x500f40[_0x868f('0x2c')]=_[_0x868f('0x2d')](_0x900a48,_0x868f('0x25'));_0x500f40[_0x868f('0x2e')]=_[_0x868f('0x2f')](_0x2c3ea2['query']);_0x500f40[_0x868f('0x30')]=_[_0x868f('0x31')](_0x500f40[_0x868f('0x2c')],_0x500f40[_0x868f('0x2e')]);_0x52d458['attributes']=_[_0x868f('0x31')](_0x500f40[_0x868f('0x2c')],qs[_0x868f('0x32')](_0x2c3ea2[_0x868f('0x2e')][_0x868f('0x32')]));_0x52d458['attributes']=_0x52d458[_0x868f('0x33')][_0x868f('0x34')]?_0x52d458['attributes']:_0x500f40[_0x868f('0x2c')];if(!_0x2c3ea2[_0x868f('0x2e')][_0x868f('0x35')](_0x868f('0x36'))){_0x52d458[_0x868f('0x1c')]=qs[_0x868f('0x1c')](_0x2c3ea2[_0x868f('0x2e')][_0x868f('0x1c')]);_0x52d458[_0x868f('0x1b')]=qs[_0x868f('0x1b')](_0x2c3ea2[_0x868f('0x2e')][_0x868f('0x1b')]);}_0x52d458[_0x868f('0x37')]=qs[_0x868f('0x38')](_0x2c3ea2['query']['sort']);_0x52d458[_0x868f('0x39')]=qs[_0x868f('0x30')](_[_0x868f('0x3a')](_0x2c3ea2['query'],_0x500f40[_0x868f('0x30')]),_0x900a48);if(_0x2c3ea2[_0x868f('0x2e')]['filter']){_0x52d458[_0x868f('0x39')]=_[_0x868f('0x3b')](_0x52d458['where'],{'$or':_[_0x868f('0x2d')](_0x900a48,function(_0xa9e5f3){if(_0xa9e5f3[_0x868f('0x2a')]!==_0x868f('0x3c')){var _0x3f71c6={};_0x3f71c6[_0xa9e5f3[_0x868f('0x25')]]={'$like':'%'+_0x2c3ea2[_0x868f('0x2e')]['filter']+'%'};return _0x3f71c6;}})});}_0x52d458=_[_0x868f('0x3b')]({},_0x52d458,_0x2c3ea2[_0x868f('0x3d')]);var _0x29742d={'where':_0x52d458[_0x868f('0x39')]};return db['ZendeskField'][_0x868f('0x1a')](_0x29742d)[_0x868f('0x22')](function(_0x2fedca){_0x264a42['count']=_0x2fedca;if(_0x2c3ea2[_0x868f('0x2e')][_0x868f('0x3e')]){_0x52d458[_0x868f('0x3f')]=[{'all':!![]}];}return db[_0x868f('0x27')][_0x868f('0x40')](_0x52d458);})['then'](function(_0x2b4f6f){_0x264a42['rows']=_0x2b4f6f;return _0x264a42;})[_0x868f('0x22')](respondWithFilteredResult(_0x484c7b,_0x52d458))[_0x868f('0x41')](handleError(_0x484c7b,null));};exports[_0x868f('0x42')]=function(_0x5609cc,_0x168f1f){var _0x143ab7={'raw':!![],'where':{'id':_0x5609cc['params']['id']}},_0x4333d1={};_0x4333d1[_0x868f('0x2c')]=_[_0x868f('0x2f')](db['ZendeskField']['rawAttributes']);_0x4333d1[_0x868f('0x2e')]=_[_0x868f('0x2f')](_0x5609cc[_0x868f('0x2e')]);_0x4333d1[_0x868f('0x30')]=_[_0x868f('0x31')](_0x4333d1[_0x868f('0x2c')],_0x4333d1['query']);_0x143ab7['attributes']=_['intersection'](_0x4333d1[_0x868f('0x2c')],qs[_0x868f('0x32')](_0x5609cc[_0x868f('0x2e')]['fields']));_0x143ab7[_0x868f('0x33')]=_0x143ab7['attributes'][_0x868f('0x34')]?_0x143ab7['attributes']:_0x4333d1['model'];if(_0x5609cc[_0x868f('0x2e')][_0x868f('0x3e')]){_0x143ab7['include']=[{'all':!![]}];}_0x143ab7=_[_0x868f('0x3b')]({},_0x143ab7,_0x5609cc[_0x868f('0x3d')]);return db[_0x868f('0x27')][_0x868f('0x43')](_0x143ab7)[_0x868f('0x22')](handleEntityNotFound(_0x168f1f,null))['then'](respondWithResult(_0x168f1f,null))[_0x868f('0x41')](handleError(_0x168f1f,null));};exports[_0x868f('0x44')]=function(_0x121023,_0x306ca3){return db['ZendeskField']['create'](_0x121023[_0x868f('0x45')],{})[_0x868f('0x22')](respondWithResult(_0x306ca3,0xc9))[_0x868f('0x41')](handleError(_0x306ca3,null));};exports['update']=function(_0x399ff4,_0x1f5039){if(_0x399ff4[_0x868f('0x45')]['id']){delete _0x399ff4[_0x868f('0x45')]['id'];}return db[_0x868f('0x27')]['find']({'where':{'id':_0x399ff4[_0x868f('0x46')]['id']}})[_0x868f('0x22')](handleEntityNotFound(_0x1f5039,null))[_0x868f('0x22')](saveUpdates(_0x399ff4[_0x868f('0x45')],null))[_0x868f('0x22')](respondWithResult(_0x1f5039,null))[_0x868f('0x41')](handleError(_0x1f5039,null));};exports['destroy']=function(_0x1981bd,_0x4928ab){return db[_0x868f('0x27')]['find']({'where':{'id':_0x1981bd[_0x868f('0x46')]['id']}})['then'](handleEntityNotFound(_0x4928ab,null))[_0x868f('0x22')](removeEntity(_0x4928ab,null))[_0x868f('0x41')](handleError(_0x4928ab,null));}; \ No newline at end of file +var _0x5fae=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','then','destroy','error','stack','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash'];(function(_0xcf0e7b,_0x311b1f){var _0x3781ce=function(_0x13ba35){while(--_0x13ba35){_0xcf0e7b['push'](_0xcf0e7b['shift']());}};_0x3781ce(++_0x311b1f);}(_0x5fae,0x82));var _0xe5fa=function(_0x473333,_0x5bfad4){_0x473333=_0x473333-0x0;var _0xb33117=_0x5fae[_0x473333];return _0xb33117;};'use strict';var pdf=require(_0xe5fa('0x0'));var emlformat=require(_0xe5fa('0x1'));var rimraf=require(_0xe5fa('0x2'));var zipdir=require(_0xe5fa('0x3'));var jsonpatch=require(_0xe5fa('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe5fa('0x5'));var Mustache=require(_0xe5fa('0x6'));var util=require(_0xe5fa('0x7'));var path=require(_0xe5fa('0x8'));var sox=require('sox');var csv=require(_0xe5fa('0x9'));var ejs=require(_0xe5fa('0xa'));var fs=require('fs');var _=require(_0xe5fa('0xb'));var squel=require(_0xe5fa('0xc'));var crypto=require(_0xe5fa('0xd'));var jsforce=require(_0xe5fa('0xe'));var deskjs=require(_0xe5fa('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe5fa('0x10'));var Redis=require(_0xe5fa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe5fa('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5fa('0x13'));var logger=require(_0xe5fa('0x14'))('api');var utils=require(_0xe5fa('0x15'));var config=require('../../config/environment');var db=require(_0xe5fa('0x16'))['db'];function respondWithStatusCode(_0x160505,_0x133c66){_0x133c66=_0x133c66||0xcc;return function(_0x13cde2){if(_0x13cde2){return _0x160505['sendStatus'](_0x133c66);}return _0x160505[_0xe5fa('0x17')](_0x133c66)[_0xe5fa('0x18')]();};}function respondWithResult(_0x25a4b4,_0x56c98b){_0x56c98b=_0x56c98b||0xc8;return function(_0x3924a3){if(_0x3924a3){return _0x25a4b4[_0xe5fa('0x17')](_0x56c98b)[_0xe5fa('0x19')](_0x3924a3);}};}function respondWithFilteredResult(_0x4fe29d,_0x238047){return function(_0x5f069d){if(_0x5f069d){var _0x4cce07=_0x5f069d[_0xe5fa('0x1a')],_0x30412b=_0x238047['offset'],_0xa36a5e=_0x238047[_0xe5fa('0x1b')]+_0x238047[_0xe5fa('0x1c')],_0x5ab861;if(_0xa36a5e>=_0x4cce07){_0xa36a5e=_0x4cce07;_0x5ab861=0xc8;}else{_0x5ab861=0xce;}_0x4fe29d[_0xe5fa('0x17')](_0x5ab861);return _0x4fe29d[_0xe5fa('0x1d')](_0xe5fa('0x1e'),_0x30412b+'-'+_0xa36a5e+'/'+_0x4cce07)[_0xe5fa('0x19')](_0x5f069d);}return null;};}function patchUpdates(_0x29e2b3){return function(_0x2ce4df){try{jsonpatch['apply'](_0x2ce4df,_0x29e2b3,!![]);}catch(_0x38fc7c){return BPromise[_0xe5fa('0x1f')](_0x38fc7c);}return _0x2ce4df['save']();};}function saveUpdates(_0x5ce393,_0x7c7e69){return function(_0x702355){if(_0x702355){return _0x702355['update'](_0x5ce393)[_0xe5fa('0x20')](function(_0xd5f389){return _0xd5f389;});}return null;};}function removeEntity(_0x29b0be,_0x465e41){return function(_0x4b7ffe){if(_0x4b7ffe){return _0x4b7ffe[_0xe5fa('0x21')]()['then'](function(){_0x29b0be[_0xe5fa('0x17')](0xcc)[_0xe5fa('0x18')]();});}};}function handleEntityNotFound(_0x3963f6,_0x1ac647){return function(_0x35f30f){if(!_0x35f30f){_0x3963f6['sendStatus'](0x194);}return _0x35f30f;};}function handleError(_0xa4a176,_0x19eb80){_0x19eb80=_0x19eb80||0x1f4;return function(_0x47c404){logger[_0xe5fa('0x22')](_0x47c404[_0xe5fa('0x23')]);if(_0x47c404[_0xe5fa('0x24')]){delete _0x47c404['name'];}_0xa4a176[_0xe5fa('0x17')](_0x19eb80)[_0xe5fa('0x25')](_0x47c404);};}exports[_0xe5fa('0x26')]=function(_0x32f802,_0x848d85){var _0x3a3801={},_0x495afe={},_0x15a008={'count':0x0,'rows':[]};var _0x3a3414=_['map'](db[_0xe5fa('0x27')][_0xe5fa('0x28')],function(_0x39a64a){return{'name':_0x39a64a[_0xe5fa('0x29')],'type':_0x39a64a[_0xe5fa('0x2a')][_0xe5fa('0x2b')]};});_0x495afe['model']=_[_0xe5fa('0x2c')](_0x3a3414,_0xe5fa('0x24'));_0x495afe[_0xe5fa('0x2d')]=_[_0xe5fa('0x2e')](_0x32f802[_0xe5fa('0x2d')]);_0x495afe[_0xe5fa('0x2f')]=_[_0xe5fa('0x30')](_0x495afe[_0xe5fa('0x31')],_0x495afe[_0xe5fa('0x2d')]);_0x3a3801['attributes']=_[_0xe5fa('0x30')](_0x495afe['model'],qs['fields'](_0x32f802[_0xe5fa('0x2d')][_0xe5fa('0x32')]));_0x3a3801['attributes']=_0x3a3801[_0xe5fa('0x33')]['length']?_0x3a3801[_0xe5fa('0x33')]:_0x495afe['model'];if(!_0x32f802[_0xe5fa('0x2d')][_0xe5fa('0x34')]('nolimit')){_0x3a3801['limit']=qs['limit'](_0x32f802[_0xe5fa('0x2d')][_0xe5fa('0x1c')]);_0x3a3801[_0xe5fa('0x1b')]=qs['offset'](_0x32f802['query'][_0xe5fa('0x1b')]);}_0x3a3801['order']=qs[_0xe5fa('0x35')](_0x32f802[_0xe5fa('0x2d')][_0xe5fa('0x35')]);_0x3a3801['where']=qs[_0xe5fa('0x2f')](_[_0xe5fa('0x36')](_0x32f802[_0xe5fa('0x2d')],_0x495afe[_0xe5fa('0x2f')]),_0x3a3414);if(_0x32f802[_0xe5fa('0x2d')][_0xe5fa('0x37')]){_0x3a3801[_0xe5fa('0x38')]=_[_0xe5fa('0x39')](_0x3a3801[_0xe5fa('0x38')],{'$or':_['map'](_0x3a3414,function(_0x49ff42){if(_0x49ff42[_0xe5fa('0x2a')]!=='VIRTUAL'){var _0x4f3c85={};_0x4f3c85[_0x49ff42['name']]={'$like':'%'+_0x32f802['query'][_0xe5fa('0x37')]+'%'};return _0x4f3c85;}})});}_0x3a3801=_[_0xe5fa('0x39')]({},_0x3a3801,_0x32f802[_0xe5fa('0x3a')]);var _0xdc8674={'where':_0x3a3801['where']};return db['ZendeskField'][_0xe5fa('0x1a')](_0xdc8674)[_0xe5fa('0x20')](function(_0x46f127){_0x15a008[_0xe5fa('0x1a')]=_0x46f127;if(_0x32f802[_0xe5fa('0x2d')][_0xe5fa('0x3b')]){_0x3a3801[_0xe5fa('0x3c')]=[{'all':!![]}];}return db[_0xe5fa('0x27')][_0xe5fa('0x3d')](_0x3a3801);})[_0xe5fa('0x20')](function(_0x50f001){_0x15a008[_0xe5fa('0x3e')]=_0x50f001;return _0x15a008;})[_0xe5fa('0x20')](respondWithFilteredResult(_0x848d85,_0x3a3801))[_0xe5fa('0x3f')](handleError(_0x848d85,null));};exports[_0xe5fa('0x40')]=function(_0x5a66d9,_0x1c5003){var _0x46543a={'raw':!![],'where':{'id':_0x5a66d9[_0xe5fa('0x41')]['id']}},_0x1d8b2e={};_0x1d8b2e[_0xe5fa('0x31')]=_['keys'](db[_0xe5fa('0x27')][_0xe5fa('0x28')]);_0x1d8b2e[_0xe5fa('0x2d')]=_[_0xe5fa('0x2e')](_0x5a66d9[_0xe5fa('0x2d')]);_0x1d8b2e[_0xe5fa('0x2f')]=_[_0xe5fa('0x30')](_0x1d8b2e['model'],_0x1d8b2e[_0xe5fa('0x2d')]);_0x46543a['attributes']=_[_0xe5fa('0x30')](_0x1d8b2e['model'],qs['fields'](_0x5a66d9[_0xe5fa('0x2d')][_0xe5fa('0x32')]));_0x46543a[_0xe5fa('0x33')]=_0x46543a[_0xe5fa('0x33')][_0xe5fa('0x42')]?_0x46543a[_0xe5fa('0x33')]:_0x1d8b2e['model'];if(_0x5a66d9[_0xe5fa('0x2d')][_0xe5fa('0x3b')]){_0x46543a[_0xe5fa('0x3c')]=[{'all':!![]}];}_0x46543a=_[_0xe5fa('0x39')]({},_0x46543a,_0x5a66d9[_0xe5fa('0x3a')]);return db[_0xe5fa('0x27')][_0xe5fa('0x43')](_0x46543a)['then'](handleEntityNotFound(_0x1c5003,null))[_0xe5fa('0x20')](respondWithResult(_0x1c5003,null))[_0xe5fa('0x3f')](handleError(_0x1c5003,null));};exports[_0xe5fa('0x44')]=function(_0x11510c,_0x5c0778){return db['ZendeskField'][_0xe5fa('0x44')](_0x11510c['body'],{})['then'](respondWithResult(_0x5c0778,0xc9))[_0xe5fa('0x3f')](handleError(_0x5c0778,null));};exports[_0xe5fa('0x45')]=function(_0x2f6cc5,_0x34d2ea){if(_0x2f6cc5[_0xe5fa('0x46')]['id']){delete _0x2f6cc5[_0xe5fa('0x46')]['id'];}return db[_0xe5fa('0x27')][_0xe5fa('0x43')]({'where':{'id':_0x2f6cc5[_0xe5fa('0x41')]['id']}})['then'](handleEntityNotFound(_0x34d2ea,null))[_0xe5fa('0x20')](saveUpdates(_0x2f6cc5[_0xe5fa('0x46')],null))[_0xe5fa('0x20')](respondWithResult(_0x34d2ea,null))['catch'](handleError(_0x34d2ea,null));};exports['destroy']=function(_0x2b4c2d,_0xaebf3){return db[_0xe5fa('0x27')][_0xe5fa('0x43')]({'where':{'id':_0x2b4c2d[_0xe5fa('0x41')]['id']}})[_0xe5fa('0x20')](handleEntityNotFound(_0xaebf3,null))[_0xe5fa('0x20')](removeEntity(_0xaebf3,null))['catch'](handleError(_0xaebf3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 112c84f..a492dd3 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 _0xed3c=['exports','zendesk_unique_index','lodash','util','../../config/logger','api','bluebird','request-promise','path','./intZendeskField.attributes'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xed3c,0x1a6));var _0xced3=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0xed3c[_0x2906e6];return _0x12517a;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var logger=require(_0xced3('0x2'))(_0xced3('0x3'));var moment=require('moment');var BPromise=require(_0xced3('0x4'));var rp=require(_0xced3('0x5'));var fs=require('fs');var path=require(_0xced3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xced3('0x7'));module[_0xced3('0x8')]=function(_0x2f92f8,_0x1cd694){return _0x2f92f8['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xced3('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42f4=['moment','bluebird','request-promise','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','../../config/logger','api'];(function(_0x1e3bc9,_0x26f07a){var _0x5ed15f=function(_0x50c132){while(--_0x50c132){_0x1e3bc9['push'](_0x1e3bc9['shift']());}};_0x5ed15f(++_0x26f07a);}(_0x42f4,0x19d));var _0x442f=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x42f4[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var logger=require(_0x442f('0x1'))(_0x442f('0x2'));var moment=require(_0x442f('0x3'));var BPromise=require(_0x442f('0x4'));var rp=require(_0x442f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x442f('0x6'));module[_0x442f('0x7')]=function(_0x545b7b,_0x3ed622){return _0x545b7b[_0x442f('0x8')](_0x442f('0x9'),attributes,{'tableName':_0x442f('0xa'),'paranoid':![],'indexes':[{'name':_0x442f('0xb'),'fields':[_0x442f('0xc'),'FieldId'],'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 ef58dd9..4b7f875 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 _0xe1fb=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskField,\x20%s,\x20%s','result'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0xe1fb,0xc9));var _0xbe1f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe1fb[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xbe1f('0x0'));var util=require(_0xbe1f('0x1'));var moment=require(_0xbe1f('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe1f('0x3'));var fs=require('fs');var Redis=require(_0xbe1f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe1f('0x5'));var logger=require(_0xbe1f('0x6'))(_0xbe1f('0x7'));var config=require(_0xbe1f('0x8'));var jayson=require(_0xbe1f('0x9'));var client=jayson[_0xbe1f('0xa')][_0xbe1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x456b42,_0x4f71ec,_0x5249a1){return new BPromise(function(_0x1e99e3,_0x24c4bc){return client[_0xbe1f('0xc')](_0x456b42,_0x5249a1)[_0xbe1f('0xd')](function(_0x1613d3){logger[_0xbe1f('0xe')]('ZendeskField,\x20%s,\x20%s',_0x4f71ec,_0xbe1f('0xf'));logger[_0xbe1f('0x10')](_0xbe1f('0x11'),_0x4f71ec,_0xbe1f('0xf'),JSON[_0xbe1f('0x12')](_0x1613d3));if(_0x1613d3[_0xbe1f('0x13')]){if(_0x1613d3[_0xbe1f('0x13')][_0xbe1f('0x14')]===0x1f4){logger[_0xbe1f('0x13')]('ZendeskField,\x20%s,\x20%s',_0x4f71ec,_0x1613d3['error'][_0xbe1f('0x15')]);return _0x24c4bc(_0x1613d3[_0xbe1f('0x13')][_0xbe1f('0x15')]);}logger['error'](_0xbe1f('0x16'),_0x4f71ec,_0x1613d3['error']['message']);return _0x1e99e3(_0x1613d3['error'][_0xbe1f('0x15')]);}else{logger[_0xbe1f('0xe')](_0xbe1f('0x16'),_0x4f71ec,'request\x20sent');_0x1e99e3(_0x1613d3[_0xbe1f('0x17')][_0xbe1f('0x15')]);}})[_0xbe1f('0x18')](function(_0x406c74){logger[_0xbe1f('0x13')]('ZendeskField,\x20%s,\x20%s',_0x4f71ec,_0x406c74);_0x24c4bc(_0x406c74);});});} \ No newline at end of file +var _0x196e=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x1c4622,_0x276630){var _0x2a0bd1=function(_0x5de1b6){while(--_0x5de1b6){_0x1c4622['push'](_0x1c4622['shift']());}};_0x2a0bd1(++_0x276630);}(_0x196e,0xe1));var _0xe196=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x196e[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0xe196('0x0'));var util=require(_0xe196('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe196('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe196('0x3'))['db'];var utils=require(_0xe196('0x4'));var logger=require(_0xe196('0x5'))(_0xe196('0x6'));var config=require(_0xe196('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe196('0x8')][_0xe196('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19046f,_0x4bf924,_0x12b4fd){return new BPromise(function(_0x1fd464,_0x770701){return client[_0xe196('0xa')](_0x19046f,_0x12b4fd)[_0xe196('0xb')](function(_0x26d6b9){logger[_0xe196('0xc')](_0xe196('0xd'),_0x4bf924,_0xe196('0xe'));logger[_0xe196('0xf')](_0xe196('0x10'),_0x4bf924,_0xe196('0xe'),JSON[_0xe196('0x11')](_0x26d6b9));if(_0x26d6b9[_0xe196('0x12')]){if(_0x26d6b9[_0xe196('0x12')][_0xe196('0x13')]===0x1f4){logger[_0xe196('0x12')](_0xe196('0xd'),_0x4bf924,_0x26d6b9[_0xe196('0x12')][_0xe196('0x14')]);return _0x770701(_0x26d6b9[_0xe196('0x12')][_0xe196('0x14')]);}logger[_0xe196('0x12')]('ZendeskField,\x20%s,\x20%s',_0x4bf924,_0x26d6b9[_0xe196('0x12')][_0xe196('0x14')]);return _0x1fd464(_0x26d6b9[_0xe196('0x12')]['message']);}else{logger[_0xe196('0xc')](_0xe196('0xd'),_0x4bf924,'request\x20sent');_0x1fd464(_0x26d6b9[_0xe196('0x15')][_0xe196('0x14')]);}})[_0xe196('0x16')](function(_0x293090){logger[_0xe196('0x12')](_0xe196('0xd'),_0x4bf924,_0x293090);_0x770701(_0x293090);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 68e1c9f..5e9ab8b 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 _0xff34=['express','Router','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x13b8a6,_0x461a63){var _0x59a844=function(_0x573536){while(--_0x573536){_0x13b8a6['push'](_0x13b8a6['shift']());}};_0x59a844(++_0x461a63);}(_0xff34,0x178));var _0x4ff3=function(_0x4911ed,_0x476941){_0x4911ed=_0x4911ed-0x0;var _0x230288=_0xff34[_0x4911ed];return _0x230288;};'use strict';var multer=require(_0x4ff3('0x0'));var util=require(_0x4ff3('0x1'));var path=require(_0x4ff3('0x2'));var timeout=require(_0x4ff3('0x3'));var express=require(_0x4ff3('0x4'));var router=express[_0x4ff3('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4ff3('0x6'));var config=require(_0x4ff3('0x7'));var controller=require('./intZohoAccount.controller');router[_0x4ff3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4ff3('0x8')](_0x4ff3('0x9'),auth['isAuthenticated'](),controller[_0x4ff3('0xa')]);router[_0x4ff3('0x8')](_0x4ff3('0xb'),auth[_0x4ff3('0xc')](),controller[_0x4ff3('0xd')]);router[_0x4ff3('0x8')]('/:id/fields',auth[_0x4ff3('0xc')](),controller[_0x4ff3('0xe')]);router[_0x4ff3('0xf')]('/',auth[_0x4ff3('0xc')](),controller[_0x4ff3('0x10')]);router[_0x4ff3('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0x4ff3('0xc')](),controller['update']);router[_0x4ff3('0x11')](_0x4ff3('0x9'),auth[_0x4ff3('0xc')](),controller[_0x4ff3('0x12')]);module[_0x4ff3('0x13')]=router; \ No newline at end of file +var _0xe822=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2c84c1,_0x49ba6a){var _0xd91ee8=function(_0x3c641a){while(--_0x3c641a){_0x2c84c1['push'](_0x2c84c1['shift']());}};_0xd91ee8(++_0x49ba6a);}(_0xe822,0xfd));var _0x2e82=function(_0x3e40bd,_0x12b79e){_0x3e40bd=_0x3e40bd-0x0;var _0x200a86=_0xe822[_0x3e40bd];return _0x200a86;};'use strict';var multer=require(_0x2e82('0x0'));var util=require(_0x2e82('0x1'));var path=require(_0x2e82('0x2'));var timeout=require(_0x2e82('0x3'));var express=require(_0x2e82('0x4'));var router=express[_0x2e82('0x5')]();var auth=require(_0x2e82('0x6'));var interaction=require(_0x2e82('0x7'));var config=require(_0x2e82('0x8'));var controller=require(_0x2e82('0x9'));router[_0x2e82('0xa')]('/',auth[_0x2e82('0xb')](),controller[_0x2e82('0xc')]);router[_0x2e82('0xa')]('/:id',auth[_0x2e82('0xb')](),controller[_0x2e82('0xd')]);router[_0x2e82('0xa')]('/:id/configurations',auth[_0x2e82('0xb')](),controller[_0x2e82('0xe')]);router[_0x2e82('0xa')](_0x2e82('0xf'),auth[_0x2e82('0xb')](),controller['getFields']);router[_0x2e82('0x10')]('/',auth[_0x2e82('0xb')](),controller[_0x2e82('0x11')]);router[_0x2e82('0x10')](_0x2e82('0x12'),auth[_0x2e82('0xb')](),controller[_0x2e82('0x13')]);router[_0x2e82('0x14')](_0x2e82('0x15'),auth['isAuthenticated'](),controller[_0x2e82('0x16')]);router[_0x2e82('0x17')](_0x2e82('0x15'),auth[_0x2e82('0xb')](),controller[_0x2e82('0x18')]);module[_0x2e82('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a2c5863..b3bc125 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 _0x682e=['sequelize','exports','STRING'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x682e,0x1ce));var _0xe682=function(_0x4b1a6f,_0x2a7e3d){_0x4b1a6f=_0x4b1a6f-0x0;var _0x5d9378=_0x682e[_0x4b1a6f];return _0x5d9378;};'use strict';var Sequelize=require(_0xe682('0x0'));module[_0xe682('0x1')]={'name':{'type':Sequelize[_0xe682('0x2')]},'description':{'type':Sequelize[_0xe682('0x2')]},'host':{'type':Sequelize[_0xe682('0x2')]},'zone':{'type':Sequelize[_0xe682('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe682('0x2')]},'serverUrl':{'type':Sequelize[_0xe682('0x2')]},'code':{'type':Sequelize[_0xe682('0x2')]},'refreshToken':{'type':Sequelize[_0xe682('0x2')]}}; \ No newline at end of file +var _0x0fe2=['sequelize','STRING'];(function(_0x10fdef,_0x8a8aff){var _0x545bfc=function(_0x30f43d){while(--_0x30f43d){_0x10fdef['push'](_0x10fdef['shift']());}};_0x545bfc(++_0x8a8aff);}(_0x0fe2,0x9e));var _0x20fe=function(_0x3192e3,_0x3639b7){_0x3192e3=_0x3192e3-0x0;var _0x234915=_0x0fe2[_0x3192e3];return _0x234915;};'use strict';var Sequelize=require(_0x20fe('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x20fe('0x1')]},'zone':{'type':Sequelize[_0x20fe('0x1')]},'clientId':{'type':Sequelize[_0x20fe('0x1')]},'clientSecret':{'type':Sequelize[_0x20fe('0x1')]},'serverUrl':{'type':Sequelize[_0x20fe('0x1')]},'code':{'type':Sequelize[_0x20fe('0x1')]},'refreshToken':{'type':Sequelize[_0x20fe('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c5371a3..2c6f0f8 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 _0x221b=['ZohoConfiguration','ZohoField','zone','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','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Call_Duration','Call_Result','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x221b,0x13a));var _0xb221=function(_0x4925d2,_0x33dd4a){_0x4925d2=_0x4925d2-0x0;var _0x164d3e=_0x221b[_0x4925d2];return _0x164d3e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb221('0x0'));var rimraf=require(_0xb221('0x1'));var zipdir=require(_0xb221('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb221('0x3'));var moment=require(_0xb221('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb221('0x5'));var util=require(_0xb221('0x6'));var path=require(_0xb221('0x7'));var sox=require(_0xb221('0x8'));var csv=require(_0xb221('0x9'));var ejs=require(_0xb221('0xa'));var fs=require('fs');var _=require(_0xb221('0xb'));var squel=require('squel');var crypto=require(_0xb221('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb221('0xd'));var toCsv=require(_0xb221('0x9'));var querystring=require(_0xb221('0xe'));var Papa=require('papaparse');var Redis=require(_0xb221('0xf'));var authService=require(_0xb221('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb221('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb221('0x12'));var utils=require(_0xb221('0x13'));var config=require(_0xb221('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb221('0x15'));var jayson=require(_0xb221('0x16'));var client=jayson['client'][_0xb221('0x17')]({'port':0x232a});function checkPasswordPattern(_0x5e18e9,_0x2064a5,_0x4c8cc5){if(_0x4c8cc5){var _0x288f24=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x288f24['test'](_0x2064a5)){return _0x5e18e9;}else{throw new db['Sequelize'][(_0xb221('0x18'))](_0xb221('0x19'));}}else{return _0x5e18e9;}}function respondWithRpcPromise(_0x8bdc20,_0x5d4a82,_0x48eb4f,_0x22b7b7){return new BPromise(function(_0x1b2e2d,_0x54a58b){var _0x38f297=_0x22b7b7||client;return _0x38f297['request'](_0x8bdc20,_0x48eb4f)[_0xb221('0x1a')](function(_0x3c74b1){logger[_0xb221('0x1b')](_0xb221('0x1c'),_0x5d4a82,'request\x20sent');logger[_0xb221('0x1d')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5d4a82,_0xb221('0x1e'),JSON['stringify'](_0x3c74b1));if(_0x3c74b1[_0xb221('0x1f')]){if(_0x3c74b1[_0xb221('0x1f')][_0xb221('0x20')]===0x1f4){logger[_0xb221('0x1f')]('ZohoAccount,\x20%s,\x20%s',_0x5d4a82,_0x3c74b1[_0xb221('0x1f')]['message']);return _0x54a58b(_0x3c74b1[_0xb221('0x1f')][_0xb221('0x21')]);}logger['error'](_0xb221('0x1c'),_0x5d4a82,_0x3c74b1['error'][_0xb221('0x21')]);return _0x1b2e2d(_0x3c74b1[_0xb221('0x1f')]['message']);}else{logger[_0xb221('0x1b')](_0xb221('0x1c'),_0x5d4a82,'request\x20sent');_0x1b2e2d(_0x3c74b1['result'][_0xb221('0x21')]);}})[_0xb221('0x22')](function(_0x3a5786){logger[_0xb221('0x1f')](_0xb221('0x1c'),_0x5d4a82,_0x3a5786);_0x54a58b(_0x3a5786);});});}function respondWithStatusCode(_0x2bfb9b,_0x968272){_0x968272=_0x968272||0xcc;return function(_0x3570b8){if(_0x3570b8){return _0x2bfb9b[_0xb221('0x23')](_0x968272);}return _0x2bfb9b['status'](_0x968272)[_0xb221('0x24')]();};}function respondWithResult(_0x498c7c,_0x1390ed){_0x1390ed=_0x1390ed||0xc8;return function(_0x4edd75){if(_0x4edd75){return _0x498c7c[_0xb221('0x25')](_0x1390ed)['json'](_0x4edd75);}};}function respondWithFilteredResult(_0x125356,_0x3a1a0f){return function(_0xcb38b1){if(_0xcb38b1){var _0x2fa87f=_0xcb38b1[_0xb221('0x26')],_0x392c27=_0x3a1a0f[_0xb221('0x27')],_0x12ae52=_0x3a1a0f['offset']+_0x3a1a0f['limit'],_0x666e8c;if(_0x12ae52>=_0x2fa87f){_0x12ae52=_0x2fa87f;_0x666e8c=0xc8;}else{_0x666e8c=0xce;}_0x125356[_0xb221('0x25')](_0x666e8c);return _0x125356[_0xb221('0x28')](_0xb221('0x29'),_0x392c27+'-'+_0x12ae52+'/'+_0x2fa87f)[_0xb221('0x2a')](_0xcb38b1);}return null;};}function patchUpdates(_0x1cad1d){return function(_0x1fd765){try{jsonpatch[_0xb221('0x2b')](_0x1fd765,_0x1cad1d,!![]);}catch(_0x6a78ee){return BPromise[_0xb221('0x2c')](_0x6a78ee);}return _0x1fd765[_0xb221('0x2d')]();};}function saveUpdates(_0x24e4c6,_0x3adc25){return function(_0x3ec456){if(_0x3ec456){return _0x3ec456[_0xb221('0x2e')](_0x24e4c6)['then'](function(_0x46afc1){return _0x46afc1;});}return null;};}function removeEntity(_0x4147af,_0x527b13){return function(_0x3b59c6){if(_0x3b59c6){return _0x3b59c6[_0xb221('0x2f')]()['then'](function(){_0x4147af[_0xb221('0x25')](0xcc)[_0xb221('0x24')]();});}};}function handleEntityNotFound(_0x5d5853,_0x418b83){return function(_0x353cc5){if(!_0x353cc5){_0x5d5853[_0xb221('0x23')](0x194);}return _0x353cc5;};}function handleError(_0x37fce1,_0x17e309){_0x17e309=_0x17e309||0x1f4;return function(_0x58c38a){logger[_0xb221('0x1f')](_0x58c38a[_0xb221('0x30')]);if(_0x58c38a[_0xb221('0x31')]){delete _0x58c38a[_0xb221('0x31')];}_0x37fce1[_0xb221('0x25')](_0x17e309)['send'](_0x58c38a);};}exports[_0xb221('0x32')]=function(_0x58bd79,_0x236c8a){var _0x2d285f={},_0x4ffc22={},_0x442e61={'count':0x0,'rows':[]};var _0x34b9d3=_['map'](db[_0xb221('0x33')][_0xb221('0x34')],function(_0x2ecf95){return{'name':_0x2ecf95[_0xb221('0x35')],'type':_0x2ecf95[_0xb221('0x36')][_0xb221('0x37')]};});_0x4ffc22[_0xb221('0x38')]=_[_0xb221('0x39')](_0x34b9d3,_0xb221('0x31'));_0x4ffc22[_0xb221('0x3a')]=_[_0xb221('0x3b')](_0x58bd79[_0xb221('0x3a')]);_0x4ffc22[_0xb221('0x3c')]=_[_0xb221('0x3d')](_0x4ffc22[_0xb221('0x38')],_0x4ffc22[_0xb221('0x3a')]);_0x2d285f[_0xb221('0x3e')]=_[_0xb221('0x3d')](_0x4ffc22[_0xb221('0x38')],qs[_0xb221('0x3f')](_0x58bd79[_0xb221('0x3a')][_0xb221('0x3f')]));_0x2d285f[_0xb221('0x3e')]=_0x2d285f['attributes'][_0xb221('0x40')]?_0x2d285f[_0xb221('0x3e')]:_0x4ffc22['model'];if(!_0x58bd79['query'][_0xb221('0x41')](_0xb221('0x42'))){_0x2d285f[_0xb221('0x43')]=qs['limit'](_0x58bd79['query'][_0xb221('0x43')]);_0x2d285f['offset']=qs[_0xb221('0x27')](_0x58bd79[_0xb221('0x3a')][_0xb221('0x27')]);}_0x2d285f[_0xb221('0x44')]=qs[_0xb221('0x45')](_0x58bd79['query'][_0xb221('0x45')]);_0x2d285f[_0xb221('0x46')]=qs[_0xb221('0x3c')](_[_0xb221('0x47')](_0x58bd79[_0xb221('0x3a')],_0x4ffc22[_0xb221('0x3c')]),_0x34b9d3);if(_0x58bd79[_0xb221('0x3a')][_0xb221('0x48')]){_0x2d285f[_0xb221('0x46')]=_[_0xb221('0x49')](_0x2d285f[_0xb221('0x46')],{'$or':_[_0xb221('0x39')](_0x34b9d3,function(_0x20fbbc){if(_0x20fbbc[_0xb221('0x36')]!=='VIRTUAL'){var _0x4086d2={};_0x4086d2[_0x20fbbc[_0xb221('0x31')]]={'$like':'%'+_0x58bd79[_0xb221('0x3a')][_0xb221('0x48')]+'%'};return _0x4086d2;}})});}_0x2d285f=_[_0xb221('0x49')]({},_0x2d285f,_0x58bd79[_0xb221('0x4a')]);var _0x148878={'where':_0x2d285f[_0xb221('0x46')]};return db[_0xb221('0x33')]['count'](_0x148878)['then'](function(_0x41f314){_0x442e61[_0xb221('0x26')]=_0x41f314;if(_0x58bd79[_0xb221('0x3a')][_0xb221('0x4b')]){_0x2d285f[_0xb221('0x4c')]=[{'all':!![]}];}return db[_0xb221('0x33')]['findAll'](_0x2d285f);})['then'](function(_0x22394d){_0x442e61[_0xb221('0x4d')]=_0x22394d;return _0x442e61;})[_0xb221('0x1a')](respondWithFilteredResult(_0x236c8a,_0x2d285f))[_0xb221('0x22')](handleError(_0x236c8a,null));};exports[_0xb221('0x4e')]=function(_0x156abd,_0xb26ffe){var _0x20f16b={'raw':![],'where':{'id':_0x156abd[_0xb221('0x4f')]['id']}},_0xde2086={};_0xde2086['model']=_['keys'](db[_0xb221('0x33')][_0xb221('0x34')]);_0xde2086['query']=_[_0xb221('0x3b')](_0x156abd[_0xb221('0x3a')]);_0xde2086[_0xb221('0x3c')]=_['intersection'](_0xde2086[_0xb221('0x38')],_0xde2086['query']);_0x20f16b[_0xb221('0x3e')]=_[_0xb221('0x3d')](_0xde2086[_0xb221('0x38')],qs[_0xb221('0x3f')](_0x156abd[_0xb221('0x3a')][_0xb221('0x3f')]));_0x20f16b['attributes']=_0x20f16b[_0xb221('0x3e')][_0xb221('0x40')]?_0x20f16b[_0xb221('0x3e')]:_0xde2086['model'];if(_0x156abd[_0xb221('0x3a')][_0xb221('0x4b')]){_0x20f16b[_0xb221('0x4c')]=[{'all':!![]}];}_0x20f16b=_[_0xb221('0x49')]({},_0x20f16b,_0x156abd[_0xb221('0x4a')]);return db['ZohoAccount'][_0xb221('0x50')](_0x20f16b)[_0xb221('0x1a')](handleEntityNotFound(_0xb26ffe,null))[_0xb221('0x1a')](respondWithResult(_0xb26ffe,null))['catch'](handleError(_0xb26ffe,null));};exports[_0xb221('0x51')]=function(_0x2ba8d2,_0x5d879a){return db[_0xb221('0x33')][_0xb221('0x51')](_0x2ba8d2[_0xb221('0x52')],{})[_0xb221('0x1a')](respondWithResult(_0x5d879a,0xc9))[_0xb221('0x22')](handleError(_0x5d879a,null));};exports['update']=function(_0x5e9270,_0x4786eb){if(_0x5e9270[_0xb221('0x52')]['id']){delete _0x5e9270['body']['id'];}return db['ZohoAccount'][_0xb221('0x50')]({'where':{'id':_0x5e9270[_0xb221('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4786eb,null))['then'](saveUpdates(_0x5e9270[_0xb221('0x52')],null))[_0xb221('0x1a')](respondWithResult(_0x4786eb,null))[_0xb221('0x22')](handleError(_0x4786eb,null));};exports[_0xb221('0x2f')]=function(_0x26dbb0,_0xf71dc1){return db[_0xb221('0x33')][_0xb221('0x50')]({'where':{'id':_0x26dbb0[_0xb221('0x4f')]['id']}})[_0xb221('0x1a')](handleEntityNotFound(_0xf71dc1,null))[_0xb221('0x1a')](removeEntity(_0xf71dc1,null))[_0xb221('0x22')](handleError(_0xf71dc1,null));};exports[_0xb221('0x53')]=function(_0x3665da,_0x46b41b,_0x5d6ff8){var _0x5903fa={};var _0x4256e8={};var _0x25409a;var _0x3cd6e0;return db['ZohoAccount'][_0xb221('0x54')]({'where':{'id':_0x3665da[_0xb221('0x4f')]['id']}})['then'](handleEntityNotFound(_0x46b41b,null))[_0xb221('0x1a')](function(_0x166ff5){if(_0x166ff5){_0x25409a=_0x166ff5;_0x4256e8[_0xb221('0x38')]=_[_0xb221('0x3b')](db['ZohoConfiguration'][_0xb221('0x34')]);_0x4256e8[_0xb221('0x3a')]=_[_0xb221('0x3b')](_0x3665da[_0xb221('0x3a')]);_0x4256e8[_0xb221('0x3c')]=_[_0xb221('0x3d')](_0x4256e8[_0xb221('0x38')],_0x4256e8['query']);_0x5903fa[_0xb221('0x3e')]=_[_0xb221('0x3d')](_0x4256e8[_0xb221('0x38')],qs['fields'](_0x3665da[_0xb221('0x3a')][_0xb221('0x3f')]));_0x5903fa[_0xb221('0x3e')]=_0x5903fa[_0xb221('0x3e')][_0xb221('0x40')]?_0x5903fa[_0xb221('0x3e')]:_0x4256e8['model'];_0x5903fa[_0xb221('0x44')]=qs[_0xb221('0x45')](_0x3665da[_0xb221('0x3a')][_0xb221('0x45')]);_0x5903fa[_0xb221('0x46')]=qs['filters'](_[_0xb221('0x47')](_0x3665da[_0xb221('0x3a')],_0x4256e8[_0xb221('0x3c')]));if(_0x3665da[_0xb221('0x3a')][_0xb221('0x48')]){_0x5903fa['where']=_['merge'](_0x5903fa[_0xb221('0x46')],{'$or':_['map'](_0x5903fa['attributes'],function(_0x49f292){var _0x268e81={};_0x268e81[_0x49f292]={'$like':'%'+_0x3665da[_0xb221('0x3a')]['filter']+'%'};return _0x268e81;})});}_0x5903fa=_[_0xb221('0x49')]({},_0x5903fa,_0x3665da[_0xb221('0x4a')]);return _0x25409a[_0xb221('0x53')](_0x5903fa);}})[_0xb221('0x1a')](function(_0xaaaf62){if(_0xaaaf62){_0x3cd6e0=_0xaaaf62[_0xb221('0x40')];if(!_0x3665da['query'][_0xb221('0x41')](_0xb221('0x42'))){_0x5903fa[_0xb221('0x43')]=qs['limit'](_0x3665da[_0xb221('0x3a')]['limit']);_0x5903fa['offset']=qs[_0xb221('0x27')](_0x3665da['query'][_0xb221('0x27')]);}return _0x25409a['getConfigurations'](_0x5903fa);}})['then'](function(_0x1b0c8c){if(_0x1b0c8c){return _0x1b0c8c?{'count':_0x3cd6e0,'rows':_0x1b0c8c}:null;}})['then'](respondWithResult(_0x46b41b,null))['catch'](handleError(_0x46b41b,null));};exports[_0xb221('0x55')]=function(_0x58966c,_0x3b2b91,_0x2882f0){if(_0x58966c['body']['id']){delete _0x58966c[_0xb221('0x52')]['id'];}return db['ZohoAccount'][_0xb221('0x54')]({'where':{'id':_0x58966c['params']['id']}})[_0xb221('0x1a')](handleEntityNotFound(_0x3b2b91,null))[_0xb221('0x1a')](function(_0x368fe5){if(_0x368fe5){_0x58966c[_0xb221('0x52')][_0xb221('0x56')]=_0x368fe5['id'];_0x58966c['body'][_0xb221('0x57')]=integrations[_0xb221('0x58')](_0x58966c[_0xb221('0x52')][_0xb221('0x59')],_0x58966c['body'][_0xb221('0x36')]);_0x58966c[_0xb221('0x52')]['Descriptions']=integrations[_0xb221('0x5a')](_0x58966c[_0xb221('0x52')]['channel'],_0x58966c[_0xb221('0x52')][_0xb221('0x36')]);return db[_0xb221('0x5b')][_0xb221('0x51')](_0x58966c['body'],{'include':[{'model':db[_0xb221('0x5c')],'as':'Subjects'},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xb221('0x1a')](respondWithResult(_0x3b2b91,null))[_0xb221('0x22')](handleError(_0x3b2b91,null));};function getAccessToken(_0x4f50a2){return new Promise(function(_0x2af749,_0x147231){var _0x2bbee6;switch(_0x4f50a2[_0xb221('0x5d')]){case'US':_0x2bbee6='https://accounts.zoho.com';break;case'AU':_0x2bbee6='https://accounts.zoho.com.au';break;case'EU':_0x2bbee6=_0xb221('0x5e');break;case'IN':_0x2bbee6=_0xb221('0x5f');break;case'CN':_0x2bbee6=_0xb221('0x60');break;default:_0x2bbee6=_0xb221('0x5e');break;}var _0x2f3a1a={'method':_0xb221('0x61'),'uri':_0x2bbee6+_0xb221('0x62'),'qs':{'refresh_token':_0x4f50a2[_0xb221('0x63')],'client_id':_0x4f50a2[_0xb221('0x64')],'client_secret':_0x4f50a2[_0xb221('0x65')],'grant_type':_0xb221('0x66')},'json':!![]};return rp(_0x2f3a1a)[_0xb221('0x1a')](function(_0x3d7303){if(_0x3d7303['access_token']){_0x2af749(_0x3d7303[_0xb221('0x67')]);}else{_0x147231('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xb221('0x22')](function(_0xe6006e){_0x147231(_0xe6006e);});});}exports[_0xb221('0x68')]=function(_0x5335db,_0x543001,_0x53772a){var _0x58b5f1,_0x3a903d,_0xd286b3,_0xcee362,_0x5f507c;return db[_0xb221('0x33')][_0xb221('0x54')]({'where':{'id':_0x5335db[_0xb221('0x4f')]['id']},'attributes':['id',_0xb221('0x69'),'zone',_0xb221('0x64'),_0xb221('0x65'),_0xb221('0x6a'),_0xb221('0x20'),_0xb221('0x63')]})['then'](handleEntityNotFound(_0x543001,null))[_0xb221('0x1a')](function(_0x2a6706){_0x5f507c=_0x2a6706;_0x58b5f1=_0x5f507c[_0xb221('0x69')];_0x3a903d=_0x58b5f1==='zoho.eu'?'eu':_0xb221('0x6b');_0xd286b3=_0x5f507c[_0xb221('0x6a')];var _0x23cda5=_0xd286b3[_0xb221('0x6c')](-0x1);if(_0x23cda5==='/'||_0x23cda5==='\x5c'||_0x23cda5===':'){_0xd286b3=_0xd286b3[_0xb221('0x6d')](0x0,_0xd286b3[_0xb221('0x6e')](_0x23cda5));}if(!_0x5f507c['refreshToken']){throw new Error(_0xb221('0x6f'));}return getAccessToken(_0x5f507c);})['then'](function(_0x2a4b31){if(_0x2a4b31){return rp({'method':_0xb221('0x70'),'uri':util[_0xb221('0x71')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3a903d),'qs':{'module':_0xb221('0x72')},'headers':{'Authorization':_0xb221('0x73')+_0x2a4b31},'json':!![]});}})[_0xb221('0x1a')](function(_0xb11e07){if(_0xb11e07){if(_0xb11e07[_0xb221('0x74')]&&_0xb11e07[_0xb221('0x74')]['error']){throw new Error(_0xb11e07['response'][_0xb221('0x1f')][_0xb221('0x21')]);}var _0x29d960=[];var _0x481298=[];var _0x2b2e5a=[_0xb221('0x75'),'Subject','Description','WhoId',_0xb221('0x76'),_0xb221('0x77'),'Call_Start_Time',_0xb221('0x78')];_0x481298=_[_0xb221('0x79')](_0xb11e07[_0xb221('0x3f')],function(_0x3b2fce){return _0x2b2e5a[_0xb221('0x7a')](_0x3b2fce['api_name']);});for(var _0x5df8db=0x0;_0x5df8db<_0x481298[_0xb221('0x40')];_0x5df8db++){if(_0x481298[_0x5df8db][_0xb221('0x7b')]===![]){_0x29d960[_0xb221('0x7c')]({'id':_0x481298[_0x5df8db]['id'],'name':_0x481298[_0x5df8db][_0xb221('0x7d')],'custom':_0x481298[_0x5df8db][_0xb221('0x7e')],'options':_0x481298[_0x5df8db][_0xb221('0x7f')]===_0xb221('0x80')&&_0x481298[_0x5df8db][_0xb221('0x81')][_0xb221('0x40')]>-0x1?_[_0xb221('0x39')](_0x481298[_0x5df8db][_0xb221('0x81')],function(_0x3286a2){return{'name':_0x3286a2,'value':_0x3286a2};}):[]});}}return{'count':_0x29d960['length'],'rows':_0x29d960};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x543001,null))['catch'](function(_0x2e1ce4){var _0x22aa36=_0x5335db['query'][_0xb221('0x82')]?0x1f4:_0x2e1ce4[_0xb221('0x83')]||0x1f4;logger[_0xb221('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0xb221('0x68'),_0x22aa36,JSON[_0xb221('0x84')](_0x2e1ce4));delete _0x2e1ce4['name'];if(_0x22aa36===0x191){_0x22aa36=0x190;}_0x543001[_0xb221('0x25')](_0x22aa36)[_0xb221('0x85')](_0x5335db[_0xb221('0x3a')][_0xb221('0x82')]?{'message':_0xb221('0x86'),'statusCode':_0x2e1ce4[_0xb221('0x83')]}:_0x2e1ce4);});}; \ No newline at end of file +var _0x7932=['https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','host','serverUrl','code','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Description','WhoId','Call_Duration','api_name','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZohoAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','stack','name','send','index','map','ZohoAccount','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','show','rawAttributes','keys','includeAll','find','create','body','params','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x4591ee,_0x3a1daf){var _0x4cdb81=function(_0x22b5cf){while(--_0x22b5cf){_0x4591ee['push'](_0x4591ee['shift']());}};_0x4cdb81(++_0x3a1daf);}(_0x7932,0xa8));var _0x2793=function(_0x2100b8,_0x205963){_0x2100b8=_0x2100b8-0x0;var _0x4f2732=_0x7932[_0x2100b8];return _0x4f2732;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2793('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2793('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2793('0x2'));var moment=require(_0x2793('0x3'));var BPromise=require(_0x2793('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2793('0x5'));var csv=require(_0x2793('0x6'));var ejs=require(_0x2793('0x7'));var fs=require('fs');var _=require(_0x2793('0x8'));var squel=require(_0x2793('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2793('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2793('0xb'));var Papa=require(_0x2793('0xc'));var Redis=require(_0x2793('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2793('0xe'));var as=require(_0x2793('0xf'));var hardwareService=require(_0x2793('0x10'));var logger=require('../../config/logger')(_0x2793('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2793('0x12'))['db'];var integrations=require(_0x2793('0x13'));var jayson=require('jayson/promise');var client=jayson[_0x2793('0x14')][_0x2793('0x15')]({'port':0x232a});function checkPasswordPattern(_0x243820,_0x22009e,_0x54571a){if(_0x54571a){var _0x5b9367=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b9367[_0x2793('0x16')](_0x22009e)){return _0x243820;}else{throw new db[(_0x2793('0x17'))][(_0x2793('0x18'))](_0x2793('0x19'));}}else{return _0x243820;}}function respondWithRpcPromise(_0x1ec94e,_0x68f351,_0x347c64,_0x1d6526){return new BPromise(function(_0x38dab1,_0x2a1f12){var _0x4bd038=_0x1d6526||client;return _0x4bd038[_0x2793('0x1a')](_0x1ec94e,_0x347c64)[_0x2793('0x1b')](function(_0x15f14d){logger[_0x2793('0x1c')]('ZohoAccount,\x20%s,\x20%s',_0x68f351,_0x2793('0x1d'));logger[_0x2793('0x1e')](_0x2793('0x1f'),_0x68f351,_0x2793('0x1d'),JSON[_0x2793('0x20')](_0x15f14d));if(_0x15f14d[_0x2793('0x21')]){if(_0x15f14d[_0x2793('0x21')]['code']===0x1f4){logger[_0x2793('0x21')](_0x2793('0x22'),_0x68f351,_0x15f14d['error'][_0x2793('0x23')]);return _0x2a1f12(_0x15f14d['error'][_0x2793('0x23')]);}logger[_0x2793('0x21')](_0x2793('0x22'),_0x68f351,_0x15f14d['error'][_0x2793('0x23')]);return _0x38dab1(_0x15f14d[_0x2793('0x21')][_0x2793('0x23')]);}else{logger[_0x2793('0x1c')](_0x2793('0x22'),_0x68f351,'request\x20sent');_0x38dab1(_0x15f14d[_0x2793('0x24')]['message']);}})[_0x2793('0x25')](function(_0x18dd61){logger['error'](_0x2793('0x22'),_0x68f351,_0x18dd61);_0x2a1f12(_0x18dd61);});});}function respondWithStatusCode(_0x40f637,_0x1e2046){_0x1e2046=_0x1e2046||0xcc;return function(_0x545155){if(_0x545155){return _0x40f637[_0x2793('0x26')](_0x1e2046);}return _0x40f637[_0x2793('0x27')](_0x1e2046)[_0x2793('0x28')]();};}function respondWithResult(_0x242e2b,_0x45a189){_0x45a189=_0x45a189||0xc8;return function(_0x196f32){if(_0x196f32){return _0x242e2b[_0x2793('0x27')](_0x45a189)[_0x2793('0x29')](_0x196f32);}};}function respondWithFilteredResult(_0x5c1ac2,_0x3f4cfe){return function(_0x346a84){if(_0x346a84){var _0x40899b=_0x346a84[_0x2793('0x2a')],_0x33d420=_0x3f4cfe[_0x2793('0x2b')],_0x34b170=_0x3f4cfe[_0x2793('0x2b')]+_0x3f4cfe[_0x2793('0x2c')],_0x2f11b8;if(_0x34b170>=_0x40899b){_0x34b170=_0x40899b;_0x2f11b8=0xc8;}else{_0x2f11b8=0xce;}_0x5c1ac2['status'](_0x2f11b8);return _0x5c1ac2['set'](_0x2793('0x2d'),_0x33d420+'-'+_0x34b170+'/'+_0x40899b)[_0x2793('0x29')](_0x346a84);}return null;};}function patchUpdates(_0x237115){return function(_0x34f1a5){try{jsonpatch['apply'](_0x34f1a5,_0x237115,!![]);}catch(_0x21734d){return BPromise[_0x2793('0x2e')](_0x21734d);}return _0x34f1a5[_0x2793('0x2f')]();};}function saveUpdates(_0x139884,_0xa062b7){return function(_0x5b2f86){if(_0x5b2f86){return _0x5b2f86[_0x2793('0x30')](_0x139884)[_0x2793('0x1b')](function(_0x30680d){return _0x30680d;});}return null;};}function removeEntity(_0xb0523,_0x57d375){return function(_0x27680f){if(_0x27680f){return _0x27680f[_0x2793('0x31')]()[_0x2793('0x1b')](function(){_0xb0523[_0x2793('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4642b1,_0x59d596){return function(_0x376627){if(!_0x376627){_0x4642b1[_0x2793('0x26')](0x194);}return _0x376627;};}function handleError(_0x611788,_0x2cdf2a){_0x2cdf2a=_0x2cdf2a||0x1f4;return function(_0x41d221){logger[_0x2793('0x21')](_0x41d221[_0x2793('0x32')]);if(_0x41d221[_0x2793('0x33')]){delete _0x41d221[_0x2793('0x33')];}_0x611788['status'](_0x2cdf2a)[_0x2793('0x34')](_0x41d221);};}exports[_0x2793('0x35')]=function(_0x1c100d,_0x48ac29){var _0x4915a5={},_0x1ab22f={},_0x3601f0={'count':0x0,'rows':[]};var _0x1999c1=_[_0x2793('0x36')](db[_0x2793('0x37')]['rawAttributes'],function(_0x3af4da){return{'name':_0x3af4da[_0x2793('0x38')],'type':_0x3af4da[_0x2793('0x39')]['key']};});_0x1ab22f[_0x2793('0x3a')]=_[_0x2793('0x36')](_0x1999c1,'name');_0x1ab22f['query']=_['keys'](_0x1c100d[_0x2793('0x3b')]);_0x1ab22f[_0x2793('0x3c')]=_[_0x2793('0x3d')](_0x1ab22f[_0x2793('0x3a')],_0x1ab22f['query']);_0x4915a5[_0x2793('0x3e')]=_[_0x2793('0x3d')](_0x1ab22f[_0x2793('0x3a')],qs[_0x2793('0x3f')](_0x1c100d[_0x2793('0x3b')][_0x2793('0x3f')]));_0x4915a5['attributes']=_0x4915a5[_0x2793('0x3e')][_0x2793('0x40')]?_0x4915a5['attributes']:_0x1ab22f[_0x2793('0x3a')];if(!_0x1c100d[_0x2793('0x3b')][_0x2793('0x41')](_0x2793('0x42'))){_0x4915a5[_0x2793('0x2c')]=qs[_0x2793('0x2c')](_0x1c100d[_0x2793('0x3b')][_0x2793('0x2c')]);_0x4915a5[_0x2793('0x2b')]=qs[_0x2793('0x2b')](_0x1c100d['query'][_0x2793('0x2b')]);}_0x4915a5[_0x2793('0x43')]=qs['sort'](_0x1c100d[_0x2793('0x3b')][_0x2793('0x44')]);_0x4915a5[_0x2793('0x45')]=qs['filters'](_[_0x2793('0x46')](_0x1c100d[_0x2793('0x3b')],_0x1ab22f['filters']),_0x1999c1);if(_0x1c100d['query']['filter']){_0x4915a5[_0x2793('0x45')]=_['merge'](_0x4915a5[_0x2793('0x45')],{'$or':_[_0x2793('0x36')](_0x1999c1,function(_0x3878ae){if(_0x3878ae[_0x2793('0x39')]!==_0x2793('0x47')){var _0x4def5c={};_0x4def5c[_0x3878ae['name']]={'$like':'%'+_0x1c100d['query'][_0x2793('0x48')]+'%'};return _0x4def5c;}})});}_0x4915a5=_[_0x2793('0x49')]({},_0x4915a5,_0x1c100d[_0x2793('0x4a')]);var _0x44a32a={'where':_0x4915a5[_0x2793('0x45')]};return db[_0x2793('0x37')][_0x2793('0x2a')](_0x44a32a)[_0x2793('0x1b')](function(_0x3e2bef){_0x3601f0[_0x2793('0x2a')]=_0x3e2bef;if(_0x1c100d[_0x2793('0x3b')]['includeAll']){_0x4915a5[_0x2793('0x4b')]=[{'all':!![]}];}return db['ZohoAccount'][_0x2793('0x4c')](_0x4915a5);})[_0x2793('0x1b')](function(_0x493de2){_0x3601f0[_0x2793('0x4d')]=_0x493de2;return _0x3601f0;})[_0x2793('0x1b')](respondWithFilteredResult(_0x48ac29,_0x4915a5))[_0x2793('0x25')](handleError(_0x48ac29,null));};exports[_0x2793('0x4e')]=function(_0x53a1ea,_0x43944d){var _0x613e4b={'raw':![],'where':{'id':_0x53a1ea['params']['id']}},_0x13d246={};_0x13d246['model']=_['keys'](db[_0x2793('0x37')][_0x2793('0x4f')]);_0x13d246[_0x2793('0x3b')]=_[_0x2793('0x50')](_0x53a1ea[_0x2793('0x3b')]);_0x13d246[_0x2793('0x3c')]=_['intersection'](_0x13d246[_0x2793('0x3a')],_0x13d246['query']);_0x613e4b['attributes']=_[_0x2793('0x3d')](_0x13d246[_0x2793('0x3a')],qs[_0x2793('0x3f')](_0x53a1ea[_0x2793('0x3b')][_0x2793('0x3f')]));_0x613e4b[_0x2793('0x3e')]=_0x613e4b['attributes'][_0x2793('0x40')]?_0x613e4b[_0x2793('0x3e')]:_0x13d246[_0x2793('0x3a')];if(_0x53a1ea['query'][_0x2793('0x51')]){_0x613e4b[_0x2793('0x4b')]=[{'all':!![]}];}_0x613e4b=_['merge']({},_0x613e4b,_0x53a1ea['options']);return db['ZohoAccount'][_0x2793('0x52')](_0x613e4b)[_0x2793('0x1b')](handleEntityNotFound(_0x43944d,null))[_0x2793('0x1b')](respondWithResult(_0x43944d,null))[_0x2793('0x25')](handleError(_0x43944d,null));};exports[_0x2793('0x53')]=function(_0xa0cd34,_0xe5ccb9){return db['ZohoAccount'][_0x2793('0x53')](_0xa0cd34[_0x2793('0x54')],{})[_0x2793('0x1b')](respondWithResult(_0xe5ccb9,0xc9))['catch'](handleError(_0xe5ccb9,null));};exports['update']=function(_0x522dd3,_0x276e67){if(_0x522dd3[_0x2793('0x54')]['id']){delete _0x522dd3[_0x2793('0x54')]['id'];}return db[_0x2793('0x37')][_0x2793('0x52')]({'where':{'id':_0x522dd3[_0x2793('0x55')]['id']}})[_0x2793('0x1b')](handleEntityNotFound(_0x276e67,null))[_0x2793('0x1b')](saveUpdates(_0x522dd3['body'],null))[_0x2793('0x1b')](respondWithResult(_0x276e67,null))['catch'](handleError(_0x276e67,null));};exports[_0x2793('0x31')]=function(_0x5624c4,_0x2a960f){return db[_0x2793('0x37')][_0x2793('0x52')]({'where':{'id':_0x5624c4[_0x2793('0x55')]['id']}})['then'](handleEntityNotFound(_0x2a960f,null))['then'](removeEntity(_0x2a960f,null))[_0x2793('0x25')](handleError(_0x2a960f,null));};exports['getConfigurations']=function(_0x19f7df,_0x27bba5,_0x1c27a6){var _0x188e23={};var _0xabe9a0={};var _0x549b8c;var _0x49e389;return db[_0x2793('0x37')][_0x2793('0x56')]({'where':{'id':_0x19f7df[_0x2793('0x55')]['id']}})[_0x2793('0x1b')](handleEntityNotFound(_0x27bba5,null))[_0x2793('0x1b')](function(_0x56292d){if(_0x56292d){_0x549b8c=_0x56292d;_0xabe9a0['model']=_[_0x2793('0x50')](db[_0x2793('0x57')][_0x2793('0x4f')]);_0xabe9a0['query']=_[_0x2793('0x50')](_0x19f7df[_0x2793('0x3b')]);_0xabe9a0[_0x2793('0x3c')]=_[_0x2793('0x3d')](_0xabe9a0[_0x2793('0x3a')],_0xabe9a0['query']);_0x188e23['attributes']=_[_0x2793('0x3d')](_0xabe9a0['model'],qs[_0x2793('0x3f')](_0x19f7df[_0x2793('0x3b')][_0x2793('0x3f')]));_0x188e23['attributes']=_0x188e23['attributes'][_0x2793('0x40')]?_0x188e23[_0x2793('0x3e')]:_0xabe9a0[_0x2793('0x3a')];_0x188e23[_0x2793('0x43')]=qs[_0x2793('0x44')](_0x19f7df[_0x2793('0x3b')][_0x2793('0x44')]);_0x188e23[_0x2793('0x45')]=qs[_0x2793('0x3c')](_[_0x2793('0x46')](_0x19f7df['query'],_0xabe9a0[_0x2793('0x3c')]));if(_0x19f7df['query'][_0x2793('0x48')]){_0x188e23[_0x2793('0x45')]=_[_0x2793('0x49')](_0x188e23[_0x2793('0x45')],{'$or':_[_0x2793('0x36')](_0x188e23['attributes'],function(_0x37857d){var _0x4b228f={};_0x4b228f[_0x37857d]={'$like':'%'+_0x19f7df[_0x2793('0x3b')]['filter']+'%'};return _0x4b228f;})});}_0x188e23=_[_0x2793('0x49')]({},_0x188e23,_0x19f7df['options']);return _0x549b8c[_0x2793('0x58')](_0x188e23);}})[_0x2793('0x1b')](function(_0x54a967){if(_0x54a967){_0x49e389=_0x54a967[_0x2793('0x40')];if(!_0x19f7df['query']['hasOwnProperty'](_0x2793('0x42'))){_0x188e23[_0x2793('0x2c')]=qs[_0x2793('0x2c')](_0x19f7df[_0x2793('0x3b')][_0x2793('0x2c')]);_0x188e23['offset']=qs[_0x2793('0x2b')](_0x19f7df['query'][_0x2793('0x2b')]);}return _0x549b8c['getConfigurations'](_0x188e23);}})[_0x2793('0x1b')](function(_0x124932){if(_0x124932){return _0x124932?{'count':_0x49e389,'rows':_0x124932}:null;}})[_0x2793('0x1b')](respondWithResult(_0x27bba5,null))[_0x2793('0x25')](handleError(_0x27bba5,null));};exports[_0x2793('0x59')]=function(_0x307896,_0x4950c2,_0x42868c){if(_0x307896[_0x2793('0x54')]['id']){delete _0x307896[_0x2793('0x54')]['id'];}return db['ZohoAccount'][_0x2793('0x56')]({'where':{'id':_0x307896[_0x2793('0x55')]['id']}})['then'](handleEntityNotFound(_0x4950c2,null))[_0x2793('0x1b')](function(_0x106fb3){if(_0x106fb3){_0x307896[_0x2793('0x54')][_0x2793('0x5a')]=_0x106fb3['id'];_0x307896[_0x2793('0x54')][_0x2793('0x5b')]=integrations[_0x2793('0x5c')](_0x307896[_0x2793('0x54')][_0x2793('0x5d')],_0x307896[_0x2793('0x54')][_0x2793('0x39')]);_0x307896['body'][_0x2793('0x5e')]=integrations[_0x2793('0x5f')](_0x307896[_0x2793('0x54')][_0x2793('0x5d')],_0x307896[_0x2793('0x54')][_0x2793('0x39')]);return db[_0x2793('0x57')][_0x2793('0x53')](_0x307896[_0x2793('0x54')],{'include':[{'model':db[_0x2793('0x60')],'as':_0x2793('0x5b')},{'model':db[_0x2793('0x60')],'as':_0x2793('0x5e')}]});}return null;})[_0x2793('0x1b')](respondWithResult(_0x4950c2,null))[_0x2793('0x25')](handleError(_0x4950c2,null));};function getAccessToken(_0x29c83e){return new Promise(function(_0x57ec77,_0x4a6a6a){var _0x1d491e;switch(_0x29c83e[_0x2793('0x61')]){case'US':_0x1d491e=_0x2793('0x62');break;case'AU':_0x1d491e=_0x2793('0x63');break;case'EU':_0x1d491e='https://accounts.zoho.eu';break;case'IN':_0x1d491e=_0x2793('0x64');break;case'CN':_0x1d491e=_0x2793('0x65');break;default:_0x1d491e='https://accounts.zoho.eu';break;}var _0x4da4b5={'method':_0x2793('0x66'),'uri':_0x1d491e+'/oauth/v2/token','qs':{'refresh_token':_0x29c83e[_0x2793('0x67')],'client_id':_0x29c83e[_0x2793('0x68')],'client_secret':_0x29c83e[_0x2793('0x69')],'grant_type':_0x2793('0x6a')},'json':!![]};return rp(_0x4da4b5)[_0x2793('0x1b')](function(_0x1b5104){if(_0x1b5104[_0x2793('0x6b')]){_0x57ec77(_0x1b5104[_0x2793('0x6b')]);}else{_0x4a6a6a('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x2793('0x25')](function(_0x130d30){_0x4a6a6a(_0x130d30);});});}exports['getFields']=function(_0x58992e,_0x57ea68,_0x46505d){var _0x52e18a,_0x5058fe,_0xfd35cb,_0x293911,_0x164bad;return db[_0x2793('0x37')]['findOne']({'where':{'id':_0x58992e[_0x2793('0x55')]['id']},'attributes':['id',_0x2793('0x6c'),_0x2793('0x61'),'clientId','clientSecret',_0x2793('0x6d'),_0x2793('0x6e'),_0x2793('0x67')]})[_0x2793('0x1b')](handleEntityNotFound(_0x57ea68,null))[_0x2793('0x1b')](function(_0x56ab12){_0x164bad=_0x56ab12;_0x52e18a=_0x164bad[_0x2793('0x6c')];_0x5058fe=_0x52e18a==='zoho.eu'?'eu':'com';_0xfd35cb=_0x164bad[_0x2793('0x6d')];var _0xd6a7f3=_0xfd35cb[_0x2793('0x6f')](-0x1);if(_0xd6a7f3==='/'||_0xd6a7f3==='\x5c'||_0xd6a7f3===':'){_0xfd35cb=_0xfd35cb[_0x2793('0x70')](0x0,_0xfd35cb[_0x2793('0x71')](_0xd6a7f3));}if(!_0x164bad[_0x2793('0x67')]){throw new Error(_0x2793('0x72'));}return getAccessToken(_0x164bad);})[_0x2793('0x1b')](function(_0x4d91dc){if(_0x4d91dc){return rp({'method':_0x2793('0x73'),'uri':util['format'](_0x2793('0x74'),_0x5058fe),'qs':{'module':_0x2793('0x75')},'headers':{'Authorization':_0x2793('0x76')+_0x4d91dc},'json':!![]});}})['then'](function(_0x18b572){if(_0x18b572){if(_0x18b572[_0x2793('0x77')]&&_0x18b572['response']['error']){throw new Error(_0x18b572['response'][_0x2793('0x21')]['message']);}var _0x40b19f=[];var _0x3e5acb=[];var _0x4f63db=[_0x2793('0x78'),'Subject',_0x2793('0x79'),_0x2793('0x7a'),_0x2793('0x7b'),'Call_Result','Call_Start_Time','Call_Type'];_0x3e5acb=_['remove'](_0x18b572[_0x2793('0x3f')],function(_0xdce85c){return _0x4f63db['includes'](_0xdce85c[_0x2793('0x7c')]);});for(var _0xc565a6=0x0;_0xc565a6<_0x3e5acb[_0x2793('0x40')];_0xc565a6++){if(_0x3e5acb[_0xc565a6]['system_mandatory']===![]){_0x40b19f[_0x2793('0x7d')]({'id':_0x3e5acb[_0xc565a6]['id'],'name':_0x3e5acb[_0xc565a6][_0x2793('0x7e')],'custom':_0x3e5acb[_0xc565a6][_0x2793('0x7f')],'options':_0x3e5acb[_0xc565a6][_0x2793('0x80')]==='picklist'&&_0x3e5acb[_0xc565a6][_0x2793('0x81')][_0x2793('0x40')]>-0x1?_['map'](_0x3e5acb[_0xc565a6][_0x2793('0x81')],function(_0x124039){return{'name':_0x124039,'value':_0x124039};}):[]});}}return{'count':_0x40b19f['length'],'rows':_0x40b19f};}else{return{'count':0x0,'rows':[]};}})[_0x2793('0x1b')](respondWithResult(_0x57ea68,null))[_0x2793('0x25')](function(_0x281817){var _0x164ff3=_0x58992e[_0x2793('0x3b')][_0x2793('0x16')]?0x1f4:_0x281817[_0x2793('0x82')]||0x1f4;logger[_0x2793('0x21')](_0x2793('0x83'),_0x2793('0x84'),_0x164ff3,JSON[_0x2793('0x20')](_0x281817));delete _0x281817[_0x2793('0x33')];if(_0x164ff3===0x191){_0x164ff3=0x190;}_0x57ea68[_0x2793('0x27')](_0x164ff3)[_0x2793('0x34')](_0x58992e['query'][_0x2793('0x16')]?{'message':_0x2793('0x85'),'statusCode':_0x281817[_0x2793('0x82')]}:_0x281817);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index f090475..2738110 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 _0x3797=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientSecret','code','slice','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','format','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','substring','lodash','util','../../config/logger','api'];(function(_0x25486e,_0x819fc5){var _0x4fa77b=function(_0x368bcd){while(--_0x368bcd){_0x25486e['push'](_0x25486e['shift']());}};_0x4fa77b(++_0x819fc5);}(_0x3797,0x196));var _0x7379=function(_0x344d91,_0x16e5f5){_0x344d91=_0x344d91-0x0;var _0x30507f=_0x3797[_0x344d91];return _0x30507f;};'use strict';var _=require(_0x7379('0x0'));var util=require(_0x7379('0x1'));var logger=require(_0x7379('0x2'))(_0x7379('0x3'));var moment=require('moment');var BPromise=require(_0x7379('0x4'));var rp=require(_0x7379('0x5'));var fs=require('fs');var path=require(_0x7379('0x6'));var rimraf=require(_0x7379('0x7'));var config=require(_0x7379('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x7379('0x9'));module[_0x7379('0xa')]=function(_0x3c9341,_0x115938){return _0x3c9341[_0x7379('0xb')](_0x7379('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2cf7b5,_0x3682b8,_0x4a1598){if(_0x2cf7b5[_0x7379('0xd')](_0x7379('0xe'))||_0x2cf7b5[_0x7379('0xd')](_0x7379('0xf'))||_0x2cf7b5[_0x7379('0xd')]('clientId')||_0x2cf7b5[_0x7379('0xd')](_0x7379('0x10'))||_0x2cf7b5[_0x7379('0xd')](_0x7379('0x11'))||_0x2cf7b5[_0x7379('0xd')]('host')){var _0x511f1f,_0x5f562a;_0x511f1f=_0x2cf7b5['serverUrl'];var _0x235772=_0x511f1f[_0x7379('0x12')](-0x1);if(_0x235772==='/'||_0x235772==='\x5c'||_0x235772===':'){_0x511f1f=_0x511f1f['substring'](0x0,_0x511f1f[_0x7379('0x13')](_0x235772));}switch(_0x2cf7b5[_0x7379('0xe')]){case'US':_0x5f562a='https://accounts.zoho.com';break;case'AU':_0x5f562a=_0x7379('0x14');break;case'IN':_0x5f562a=_0x7379('0x15');break;case'CN':_0x5f562a=_0x7379('0x16');break;default:_0x5f562a='https://accounts.zoho.eu';break;}var _0x4b813e={'method':_0x7379('0x17'),'uri':_0x5f562a+_0x7379('0x18'),'form':{'grant_type':_0x7379('0x19'),'client_id':_0x2cf7b5[_0x7379('0x1a')],'client_secret':_0x2cf7b5['clientSecret'],'redirect_uri':_0x2cf7b5[_0x7379('0xf')],'code':_0x2cf7b5['code']},'headers':{'Content-Type':_0x7379('0x1b')}};return rp(_0x4b813e)[_0x7379('0x1c')](function(_0x105725){var _0x2a155f=JSON[_0x7379('0x1d')](_0x105725);if(_0x2a155f[_0x7379('0x1e')]){_0x2cf7b5[_0x7379('0x1f')]=_0x2a155f[_0x7379('0x1e')];logger[_0x7379('0x20')](util['format'](_0x7379('0x21'),_0x2cf7b5['name'],_0x2cf7b5['id']));}else{logger[_0x7379('0x22')](util[_0x7379('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2cf7b5['name'],_0x2cf7b5['id']),util[_0x7379('0x24')](_0x2a155f,{'showHidden':![],'depth':null}));}return _0x4a1598(null,_0x3682b8);})[_0x7379('0x25')](function(_0x5a390e){logger[_0x7379('0x22')](util['format'](_0x7379('0x26'),_0x2cf7b5[_0x7379('0x27')],_0x2cf7b5['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4a1598(_0x5a390e);});}else{return _0x4a1598(null,_0x3682b8);}},'beforeUpdate':function(_0x18bcef,_0x1fd68c,_0x3857bd){if(_0x18bcef[_0x7379('0xd')](_0x7379('0xe'))||_0x18bcef[_0x7379('0xd')](_0x7379('0xf'))||_0x18bcef['changed'](_0x7379('0x1a'))||_0x18bcef[_0x7379('0xd')](_0x7379('0x10'))||_0x18bcef['changed'](_0x7379('0x11'))||_0x18bcef[_0x7379('0xd')]('host')){var _0x14cec3,_0x5f3a49;_0x14cec3=_0x18bcef[_0x7379('0xf')];var _0x38ca30=_0x14cec3[_0x7379('0x12')](-0x1);if(_0x38ca30==='/'||_0x38ca30==='\x5c'||_0x38ca30===':'){_0x14cec3=_0x14cec3[_0x7379('0x28')](0x0,_0x14cec3[_0x7379('0x13')](_0x38ca30));}switch(_0x18bcef[_0x7379('0xe')]){case'US':_0x5f3a49='https://accounts.zoho.com';break;case'AU':_0x5f3a49=_0x7379('0x14');break;case'IN':_0x5f3a49='https://accounts.zoho.in';break;case'CN':_0x5f3a49=_0x7379('0x16');break;default:_0x5f3a49='https://accounts.zoho.eu';break;}var _0x6b53d2={'method':'POST','uri':_0x5f3a49+_0x7379('0x18'),'form':{'grant_type':_0x7379('0x19'),'client_id':_0x18bcef[_0x7379('0x1a')],'client_secret':_0x18bcef[_0x7379('0x10')],'redirect_uri':_0x18bcef[_0x7379('0xf')],'code':_0x18bcef[_0x7379('0x11')]},'headers':{'Content-Type':_0x7379('0x1b')}};return rp(_0x6b53d2)[_0x7379('0x1c')](function(_0x529d72){var _0x60c79=JSON[_0x7379('0x1d')](_0x529d72);if(_0x60c79[_0x7379('0x1e')]){_0x18bcef[_0x7379('0x1f')]=_0x60c79[_0x7379('0x1e')];logger['info'](util[_0x7379('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x18bcef['name'],_0x18bcef['id']));}else{logger[_0x7379('0x22')](util['format'](_0x7379('0x26'),_0x18bcef[_0x7379('0x27')],_0x18bcef['id']),util[_0x7379('0x24')](_0x60c79,{'showHidden':![],'depth':null}));}return _0x3857bd(null,_0x1fd68c);})[_0x7379('0x25')](function(_0xbd7311){logger[_0x7379('0x22')](util[_0x7379('0x23')](_0x7379('0x26'),_0x18bcef[_0x7379('0x27')],_0x18bcef['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3857bd(_0xbd7311);});}else{return _0x3857bd(null,_0x1fd68c);}}}});}; \ No newline at end of file +var _0x94f7=['serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','then','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','format','POST','/oauth/v2/token','application/x-www-form-urlencoded','parse','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','ZohoAccount','int_zoho_accounts','zone','changed'];(function(_0x104a7a,_0x19bd5c){var _0x2070bb=function(_0x1d279b){while(--_0x1d279b){_0x104a7a['push'](_0x104a7a['shift']());}};_0x2070bb(++_0x19bd5c);}(_0x94f7,0x97));var _0x794f=function(_0x48a2ec,_0xf91663){_0x48a2ec=_0x48a2ec-0x0;var _0x4c6cbf=_0x94f7[_0x48a2ec];return _0x4c6cbf;};'use strict';var _=require('lodash');var util=require(_0x794f('0x0'));var logger=require(_0x794f('0x1'))(_0x794f('0x2'));var moment=require(_0x794f('0x3'));var BPromise=require(_0x794f('0x4'));var rp=require(_0x794f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x794f('0x6'));var config=require(_0x794f('0x7'));var attributes=require(_0x794f('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x39a08c,_0x32f886){return _0x39a08c['define'](_0x794f('0x9'),attributes,{'tableName':_0x794f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b4ee8,_0x40c74a,_0x3bbee3){if(_0x1b4ee8['changed'](_0x794f('0xb'))||_0x1b4ee8[_0x794f('0xc')](_0x794f('0xd'))||_0x1b4ee8[_0x794f('0xc')](_0x794f('0xe'))||_0x1b4ee8[_0x794f('0xc')](_0x794f('0xf'))||_0x1b4ee8['changed'](_0x794f('0x10'))||_0x1b4ee8[_0x794f('0xc')](_0x794f('0x11'))){var _0x585c70,_0x1831fe;_0x585c70=_0x1b4ee8[_0x794f('0xd')];var _0x5a77b4=_0x585c70[_0x794f('0x12')](-0x1);if(_0x5a77b4==='/'||_0x5a77b4==='\x5c'||_0x5a77b4===':'){_0x585c70=_0x585c70[_0x794f('0x13')](0x0,_0x585c70[_0x794f('0x14')](_0x5a77b4));}switch(_0x1b4ee8[_0x794f('0xb')]){case'US':_0x1831fe=_0x794f('0x15');break;case'AU':_0x1831fe='https://accounts.zoho.com.au';break;case'IN':_0x1831fe=_0x794f('0x16');break;case'CN':_0x1831fe=_0x794f('0x17');break;default:_0x1831fe=_0x794f('0x18');break;}var _0x20e244={'method':'POST','uri':_0x1831fe+'/oauth/v2/token','form':{'grant_type':_0x794f('0x19'),'client_id':_0x1b4ee8['clientId'],'client_secret':_0x1b4ee8[_0x794f('0xf')],'redirect_uri':_0x1b4ee8['serverUrl'],'code':_0x1b4ee8[_0x794f('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x20e244)[_0x794f('0x1a')](function(_0x32d8a6){var _0x45629a=JSON['parse'](_0x32d8a6);if(_0x45629a[_0x794f('0x1b')]){_0x1b4ee8[_0x794f('0x1c')]=_0x45629a[_0x794f('0x1b')];logger[_0x794f('0x1d')](util['format'](_0x794f('0x1e'),_0x1b4ee8[_0x794f('0x1f')],_0x1b4ee8['id']));}else{logger[_0x794f('0x20')](util['format'](_0x794f('0x21'),_0x1b4ee8[_0x794f('0x1f')],_0x1b4ee8['id']),util[_0x794f('0x22')](_0x45629a,{'showHidden':![],'depth':null}));}return _0x3bbee3(null,_0x40c74a);})[_0x794f('0x23')](function(_0x498932){logger[_0x794f('0x20')](util[_0x794f('0x24')](_0x794f('0x21'),_0x1b4ee8[_0x794f('0x1f')],_0x1b4ee8['id']),util[_0x794f('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x3bbee3(_0x498932);});}else{return _0x3bbee3(null,_0x40c74a);}},'beforeUpdate':function(_0x20d500,_0x1cb369,_0x1c7ca0){if(_0x20d500[_0x794f('0xc')](_0x794f('0xb'))||_0x20d500[_0x794f('0xc')](_0x794f('0xd'))||_0x20d500['changed'](_0x794f('0xe'))||_0x20d500[_0x794f('0xc')]('clientSecret')||_0x20d500[_0x794f('0xc')](_0x794f('0x10'))||_0x20d500[_0x794f('0xc')](_0x794f('0x11'))){var _0x13d126,_0x1f7b81;_0x13d126=_0x20d500[_0x794f('0xd')];var _0x17eb43=_0x13d126[_0x794f('0x12')](-0x1);if(_0x17eb43==='/'||_0x17eb43==='\x5c'||_0x17eb43===':'){_0x13d126=_0x13d126[_0x794f('0x13')](0x0,_0x13d126[_0x794f('0x14')](_0x17eb43));}switch(_0x20d500[_0x794f('0xb')]){case'US':_0x1f7b81=_0x794f('0x15');break;case'AU':_0x1f7b81='https://accounts.zoho.com.au';break;case'IN':_0x1f7b81=_0x794f('0x16');break;case'CN':_0x1f7b81='https://accounts.zoho.com.cn';break;default:_0x1f7b81=_0x794f('0x18');break;}var _0x35d9fc={'method':_0x794f('0x25'),'uri':_0x1f7b81+_0x794f('0x26'),'form':{'grant_type':'authorization_code','client_id':_0x20d500[_0x794f('0xe')],'client_secret':_0x20d500[_0x794f('0xf')],'redirect_uri':_0x20d500[_0x794f('0xd')],'code':_0x20d500[_0x794f('0x10')]},'headers':{'Content-Type':_0x794f('0x27')}};return rp(_0x35d9fc)[_0x794f('0x1a')](function(_0x269f89){var _0x106b4f=JSON[_0x794f('0x28')](_0x269f89);if(_0x106b4f[_0x794f('0x1b')]){_0x20d500[_0x794f('0x1c')]=_0x106b4f[_0x794f('0x1b')];logger[_0x794f('0x1d')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x20d500[_0x794f('0x1f')],_0x20d500['id']));}else{logger[_0x794f('0x20')](util['format'](_0x794f('0x21'),_0x20d500[_0x794f('0x1f')],_0x20d500['id']),util[_0x794f('0x22')](_0x106b4f,{'showHidden':![],'depth':null}));}return _0x1c7ca0(null,_0x1cb369);})[_0x794f('0x23')](function(_0x33c75e){logger[_0x794f('0x20')](util[_0x794f('0x24')](_0x794f('0x21'),_0x20d500['name'],_0x20d500['id']),util[_0x794f('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x1c7ca0(_0x33c75e);});}else{return _0x1c7ca0(null,_0x1cb369);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 529d7dd..5ba2189 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 _0x9e35=['limit','map','include','model','then','debug','ShowZohoAccount','ZohoAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','options','raw','where','attributes'];(function(_0x424c0f,_0x31a27d){var _0x265bf4=function(_0x419f69){while(--_0x419f69){_0x424c0f['push'](_0x424c0f['shift']());}};_0x265bf4(++_0x31a27d);}(_0x9e35,0x1f3));var _0x59e3=function(_0xa073d1,_0x521d5b){_0xa073d1=_0xa073d1-0x0;var _0x2a94d4=_0x9e35[_0xa073d1];return _0x2a94d4;};'use strict';var _=require('lodash');var util=require(_0x59e3('0x0'));var moment=require('moment');var BPromise=require(_0x59e3('0x1'));var rs=require(_0x59e3('0x2'));var fs=require('fs');var Redis=require(_0x59e3('0x3'));var db=require(_0x59e3('0x4'))['db'];var utils=require(_0x59e3('0x5'));var logger=require('../../config/logger')(_0x59e3('0x6'));var config=require(_0x59e3('0x7'));var jayson=require(_0x59e3('0x8'));var client=jayson['client'][_0x59e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e83d2,_0x281deb,_0x139b44){return new BPromise(function(_0x5b9ca5,_0x235822){return client[_0x59e3('0xa')](_0x2e83d2,_0x139b44)['then'](function(_0x5782bd){logger[_0x59e3('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x281deb,_0x59e3('0xc'));logger['debug'](_0x59e3('0xd'),_0x281deb,_0x59e3('0xc'),JSON[_0x59e3('0xe')](_0x5782bd));if(_0x5782bd[_0x59e3('0xf')]){if(_0x5782bd[_0x59e3('0xf')][_0x59e3('0x10')]===0x1f4){logger[_0x59e3('0xf')](_0x59e3('0x11'),_0x281deb,_0x5782bd[_0x59e3('0xf')][_0x59e3('0x12')]);return _0x235822(_0x5782bd['error'][_0x59e3('0x12')]);}logger[_0x59e3('0xf')](_0x59e3('0x11'),_0x281deb,_0x5782bd[_0x59e3('0xf')][_0x59e3('0x12')]);return _0x5b9ca5(_0x5782bd[_0x59e3('0xf')][_0x59e3('0x12')]);}else{logger['info'](_0x59e3('0x11'),_0x281deb,_0x59e3('0xc'));_0x5b9ca5(_0x5782bd[_0x59e3('0x13')][_0x59e3('0x12')]);}})[_0x59e3('0x14')](function(_0x54b57b){logger[_0x59e3('0xf')](_0x59e3('0x11'),_0x281deb,_0x54b57b);_0x235822(_0x54b57b);});});}exports[_0x59e3('0x15')]=function(_0x2be6f4){var _0x42685e=this;return new Promise(function(_0x203e1b,_0x1f75d1){return db['ZohoAccount']['findAll']({'raw':_0x2be6f4[_0x59e3('0x16')]?_0x2be6f4[_0x59e3('0x16')][_0x59e3('0x17')]===undefined?!![]:![]:!![],'where':_0x2be6f4[_0x59e3('0x16')]?_0x2be6f4[_0x59e3('0x16')][_0x59e3('0x18')]||null:null,'attributes':_0x2be6f4[_0x59e3('0x16')]?_0x2be6f4[_0x59e3('0x16')][_0x59e3('0x19')]||null:null,'limit':_0x2be6f4[_0x59e3('0x16')]?_0x2be6f4[_0x59e3('0x16')][_0x59e3('0x1a')]||null:null,'include':_0x2be6f4[_0x59e3('0x16')]?_0x2be6f4['options']['include']?_[_0x59e3('0x1b')](_0x2be6f4['options'][_0x59e3('0x1c')],function(_0x49337f){return{'model':db[_0x49337f[_0x59e3('0x1d')]],'as':_0x49337f['as'],'attributes':_0x49337f[_0x59e3('0x19')],'include':_0x49337f[_0x59e3('0x1c')]?_[_0x59e3('0x1b')](_0x49337f['include'],function(_0xe78e8c){return{'model':db[_0xe78e8c[_0x59e3('0x1d')]],'as':_0xe78e8c['as'],'attributes':_0xe78e8c['attributes'],'include':_0xe78e8c[_0x59e3('0x1c')]?_['map'](_0xe78e8c['include'],function(_0x3b5cf9){return{'model':db[_0x3b5cf9[_0x59e3('0x1d')]],'as':_0x3b5cf9['as'],'attributes':_0x3b5cf9[_0x59e3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x59e3('0x1e')](function(_0xf43ac8){logger[_0x59e3('0xb')](_0x59e3('0x15'),_0x2be6f4);logger[_0x59e3('0x1f')]('GetZohoAccount',_0x2be6f4,JSON['stringify'](_0xf43ac8));_0x203e1b(_0xf43ac8);})[_0x59e3('0x14')](function(_0x43a9b4){logger[_0x59e3('0xf')]('GetZohoAccount',_0x43a9b4['message'],_0x2be6f4);_0x1f75d1(_0x42685e['error'](0x1f4,_0x43a9b4[_0x59e3('0x12')]));});});};exports[_0x59e3('0x20')]=function(_0xc32152){var _0x20b4e6=this;return new Promise(function(_0x5a4aa9,_0x51fb65){return db[_0x59e3('0x21')][_0x59e3('0x22')]({'raw':_0xc32152[_0x59e3('0x16')]?_0xc32152['options']['raw']===undefined?!![]:![]:!![],'where':_0xc32152['options']?_0xc32152[_0x59e3('0x16')][_0x59e3('0x18')]||null:null,'attributes':_0xc32152[_0x59e3('0x16')]?_0xc32152[_0x59e3('0x16')]['attributes']||null:null,'include':_0xc32152[_0x59e3('0x16')]?_0xc32152[_0x59e3('0x16')][_0x59e3('0x1c')]?_[_0x59e3('0x1b')](_0xc32152[_0x59e3('0x16')][_0x59e3('0x1c')],function(_0x597f48){return{'model':db[_0x597f48[_0x59e3('0x1d')]],'as':_0x597f48['as'],'attributes':_0x597f48[_0x59e3('0x19')],'include':_0x597f48[_0x59e3('0x1c')]?_['map'](_0x597f48['include'],function(_0x32f7a8){return{'model':db[_0x32f7a8[_0x59e3('0x1d')]],'as':_0x32f7a8['as'],'attributes':_0x32f7a8[_0x59e3('0x19')],'include':_0x32f7a8[_0x59e3('0x1c')]?_['map'](_0x32f7a8[_0x59e3('0x1c')],function(_0x40e253){return{'model':db[_0x40e253[_0x59e3('0x1d')]],'as':_0x40e253['as'],'attributes':_0x40e253[_0x59e3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x59e3('0x1e')](function(_0x1747c8){logger[_0x59e3('0xb')](_0x59e3('0x20'),_0xc32152);logger[_0x59e3('0x1f')](_0x59e3('0x20'),_0xc32152,JSON[_0x59e3('0xe')](_0x1747c8));_0x5a4aa9(_0x1747c8);})[_0x59e3('0x14')](function(_0x5ce44b){logger[_0x59e3('0xf')](_0x59e3('0x20'),_0x5ce44b[_0x59e3('0x12')],_0xc32152);_0x51fb65(_0x20b4e6['error'](0x1f4,_0x5ce44b[_0x59e3('0x12')]));});});}; \ No newline at end of file +var _0x0d49=['ZohoAccount','options','raw','attributes','limit','include','map','model','ShowZohoAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetZohoAccount'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0x0d49,0x19c));var _0x90d4=function(_0x5c0dc5,_0x5cfe64){_0x5c0dc5=_0x5c0dc5-0x0;var _0x254c85=_0x0d49[_0x5c0dc5];return _0x254c85;};'use strict';var _=require('lodash');var util=require(_0x90d4('0x0'));var moment=require('moment');var BPromise=require(_0x90d4('0x1'));var rs=require(_0x90d4('0x2'));var fs=require('fs');var Redis=require(_0x90d4('0x3'));var db=require(_0x90d4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x90d4('0x5'))(_0x90d4('0x6'));var config=require(_0x90d4('0x7'));var jayson=require(_0x90d4('0x8'));var client=jayson[_0x90d4('0x9')][_0x90d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d5761,_0x43fb54,_0xff38a7){return new BPromise(function(_0x3f7aab,_0x43ebd1){return client['request'](_0x2d5761,_0xff38a7)[_0x90d4('0xb')](function(_0x294015){logger['info'](_0x90d4('0xc'),_0x43fb54,'request\x20sent');logger[_0x90d4('0xd')](_0x90d4('0xe'),_0x43fb54,_0x90d4('0xf'),JSON[_0x90d4('0x10')](_0x294015));if(_0x294015[_0x90d4('0x11')]){if(_0x294015[_0x90d4('0x11')][_0x90d4('0x12')]===0x1f4){logger[_0x90d4('0x11')](_0x90d4('0xc'),_0x43fb54,_0x294015[_0x90d4('0x11')][_0x90d4('0x13')]);return _0x43ebd1(_0x294015[_0x90d4('0x11')][_0x90d4('0x13')]);}logger[_0x90d4('0x11')](_0x90d4('0xc'),_0x43fb54,_0x294015[_0x90d4('0x11')][_0x90d4('0x13')]);return _0x3f7aab(_0x294015[_0x90d4('0x11')][_0x90d4('0x13')]);}else{logger[_0x90d4('0x14')](_0x90d4('0xc'),_0x43fb54,_0x90d4('0xf'));_0x3f7aab(_0x294015['result'][_0x90d4('0x13')]);}})['catch'](function(_0x492085){logger[_0x90d4('0x11')](_0x90d4('0xc'),_0x43fb54,_0x492085);_0x43ebd1(_0x492085);});});}exports[_0x90d4('0x15')]=function(_0x39ddcc){var _0x327bbc=this;return new Promise(function(_0x2d88a1,_0x3be119){return db[_0x90d4('0x16')]['findAll']({'raw':_0x39ddcc[_0x90d4('0x17')]?_0x39ddcc[_0x90d4('0x17')][_0x90d4('0x18')]===undefined?!![]:![]:!![],'where':_0x39ddcc[_0x90d4('0x17')]?_0x39ddcc[_0x90d4('0x17')]['where']||null:null,'attributes':_0x39ddcc[_0x90d4('0x17')]?_0x39ddcc[_0x90d4('0x17')][_0x90d4('0x19')]||null:null,'limit':_0x39ddcc[_0x90d4('0x17')]?_0x39ddcc[_0x90d4('0x17')][_0x90d4('0x1a')]||null:null,'include':_0x39ddcc['options']?_0x39ddcc[_0x90d4('0x17')][_0x90d4('0x1b')]?_[_0x90d4('0x1c')](_0x39ddcc[_0x90d4('0x17')]['include'],function(_0x42d39c){return{'model':db[_0x42d39c[_0x90d4('0x1d')]],'as':_0x42d39c['as'],'attributes':_0x42d39c[_0x90d4('0x19')],'include':_0x42d39c[_0x90d4('0x1b')]?_[_0x90d4('0x1c')](_0x42d39c['include'],function(_0xa7e465){return{'model':db[_0xa7e465['model']],'as':_0xa7e465['as'],'attributes':_0xa7e465[_0x90d4('0x19')],'include':_0xa7e465['include']?_[_0x90d4('0x1c')](_0xa7e465[_0x90d4('0x1b')],function(_0x10a808){return{'model':db[_0x10a808[_0x90d4('0x1d')]],'as':_0x10a808['as'],'attributes':_0x10a808[_0x90d4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48b4c7){logger['info'](_0x90d4('0x15'),_0x39ddcc);logger[_0x90d4('0xd')](_0x90d4('0x15'),_0x39ddcc,JSON[_0x90d4('0x10')](_0x48b4c7));_0x2d88a1(_0x48b4c7);})['catch'](function(_0x271a92){logger['error'](_0x90d4('0x15'),_0x271a92[_0x90d4('0x13')],_0x39ddcc);_0x3be119(_0x327bbc[_0x90d4('0x11')](0x1f4,_0x271a92['message']));});});};exports[_0x90d4('0x1e')]=function(_0x354f55){var _0x460186=this;return new Promise(function(_0x3f2c99,_0x1b75f2){return db[_0x90d4('0x16')]['find']({'raw':_0x354f55[_0x90d4('0x17')]?_0x354f55[_0x90d4('0x17')][_0x90d4('0x18')]===undefined?!![]:![]:!![],'where':_0x354f55[_0x90d4('0x17')]?_0x354f55[_0x90d4('0x17')]['where']||null:null,'attributes':_0x354f55['options']?_0x354f55[_0x90d4('0x17')]['attributes']||null:null,'include':_0x354f55[_0x90d4('0x17')]?_0x354f55['options'][_0x90d4('0x1b')]?_['map'](_0x354f55[_0x90d4('0x17')][_0x90d4('0x1b')],function(_0x4fb942){return{'model':db[_0x4fb942[_0x90d4('0x1d')]],'as':_0x4fb942['as'],'attributes':_0x4fb942['attributes'],'include':_0x4fb942[_0x90d4('0x1b')]?_[_0x90d4('0x1c')](_0x4fb942[_0x90d4('0x1b')],function(_0x93e702){return{'model':db[_0x93e702[_0x90d4('0x1d')]],'as':_0x93e702['as'],'attributes':_0x93e702[_0x90d4('0x19')],'include':_0x93e702[_0x90d4('0x1b')]?_[_0x90d4('0x1c')](_0x93e702['include'],function(_0x5c8451){return{'model':db[_0x5c8451['model']],'as':_0x5c8451['as'],'attributes':_0x5c8451[_0x90d4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x90d4('0xb')](function(_0x31aee8){logger[_0x90d4('0x14')](_0x90d4('0x1e'),_0x354f55);logger[_0x90d4('0xd')](_0x90d4('0x1e'),_0x354f55,JSON[_0x90d4('0x10')](_0x31aee8));_0x3f2c99(_0x31aee8);})['catch'](function(_0x538034){logger[_0x90d4('0x11')](_0x90d4('0x1e'),_0x538034[_0x90d4('0x13')],_0x354f55);_0x1b75f2(_0x460186[_0x90d4('0x11')](0x1f4,_0x538034[_0x90d4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index da5abc8..554f765 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 _0xa1aa=['get','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index'];(function(_0xd5169b,_0x5ab446){var _0x50fe84=function(_0x3ad28c){while(--_0x3ad28c){_0xd5169b['push'](_0xd5169b['shift']());}};_0x50fe84(++_0x5ab446);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x4ece06,_0x3d82ef){_0x4ece06=_0x4ece06-0x0;var _0x41f9bd=_0xa1aa[_0x4ece06];return _0x41f9bd;};'use strict';var multer=require('multer');var util=require(_0xaa1a('0x0'));var path=require(_0xaa1a('0x1'));var timeout=require(_0xaa1a('0x2'));var express=require(_0xaa1a('0x3'));var router=express[_0xaa1a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaa1a('0x5'));var controller=require(_0xaa1a('0x6'));router['get']('/',auth[_0xaa1a('0x7')](),controller[_0xaa1a('0x8')]);router[_0xaa1a('0x9')]('/:id',auth[_0xaa1a('0x7')](),controller['show']);router[_0xaa1a('0x9')]('/:id/fields',auth[_0xaa1a('0x7')](),controller[_0xaa1a('0xa')]);router['get']('/:id/subjects',auth[_0xaa1a('0x7')](),controller[_0xaa1a('0xb')]);router[_0xaa1a('0x9')](_0xaa1a('0xc'),auth['isAuthenticated'](),controller[_0xaa1a('0xd')]);router[_0xaa1a('0xe')]('/',auth[_0xaa1a('0x7')](),controller[_0xaa1a('0xf')]);router[_0xaa1a('0x10')](_0xaa1a('0x11'),auth[_0xaa1a('0x7')](),controller[_0xaa1a('0x12')]);router[_0xaa1a('0x13')](_0xaa1a('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xaa1a('0x14')]=router; \ No newline at end of file +var _0x68b7=['/:id/subjects','getSubjects','getDescriptions','create','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x38409e,_0x48b289){var _0x200265=function(_0x63243c){while(--_0x63243c){_0x38409e['push'](_0x38409e['shift']());}};_0x200265(++_0x48b289);}(_0x68b7,0x8c));var _0x768b=function(_0x133ad1,_0xad51d3){_0x133ad1=_0x133ad1-0x0;var _0x4de3a0=_0x68b7[_0x133ad1];return _0x4de3a0;};'use strict';var multer=require(_0x768b('0x0'));var util=require('util');var path=require(_0x768b('0x1'));var timeout=require(_0x768b('0x2'));var express=require(_0x768b('0x3'));var router=express['Router']();var auth=require(_0x768b('0x4'));var interaction=require(_0x768b('0x5'));var config=require(_0x768b('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0x768b('0x7')]('/',auth[_0x768b('0x8')](),controller[_0x768b('0x9')]);router[_0x768b('0x7')](_0x768b('0xa'),auth[_0x768b('0x8')](),controller[_0x768b('0xb')]);router['get'](_0x768b('0xc'),auth['isAuthenticated'](),controller[_0x768b('0xd')]);router[_0x768b('0x7')](_0x768b('0xe'),auth[_0x768b('0x8')](),controller[_0x768b('0xf')]);router[_0x768b('0x7')]('/:id/descriptions',auth[_0x768b('0x8')](),controller[_0x768b('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x768b('0x11')]);router[_0x768b('0x12')](_0x768b('0xa'),auth[_0x768b('0x8')](),controller[_0x768b('0x13')]);router[_0x768b('0x14')](_0x768b('0xa'),auth[_0x768b('0x8')](),controller[_0x768b('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 42f96e9..e4d4fa2 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 _0x0cee=['contact_lead','STRING','exports','ENUM','lead','contact','nothing'];(function(_0x74b46c,_0x2b79d6){var _0x38cc40=function(_0x2cc73d){while(--_0x2cc73d){_0x74b46c['push'](_0x74b46c['shift']());}};_0x38cc40(++_0x2b79d6);}(_0x0cee,0x1c2));var _0xe0ce=function(_0x2e953b,_0x4fab53){_0x2e953b=_0x2e953b-0x0;var _0x15a756=_0x0cee[_0x2e953b];return _0x15a756;};'use strict';var Sequelize=require('sequelize');module[_0xe0ce('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xe0ce('0x1')](_0xe0ce('0x2'),_0xe0ce('0x3'),_0xe0ce('0x4')),'defaultValue':_0xe0ce('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xe0ce('0x3'),_0xe0ce('0x2')),'defaultValue':_0xe0ce('0x5')},'description':{'type':Sequelize[_0xe0ce('0x6')]}}; \ No newline at end of file +var _0x8f0e=['ENUM','lead','contact','nothing','contact_lead','exports','STRING'];(function(_0x5654c0,_0x151b1b){var _0x5b2c8e=function(_0x1e5a95){while(--_0x1e5a95){_0x5654c0['push'](_0x5654c0['shift']());}};_0x5b2c8e(++_0x151b1b);}(_0x8f0e,0x171));var _0xe8f0=function(_0x4e84d7,_0x3b317d){_0x4e84d7=_0x4e84d7-0x0;var _0x5c99fa=_0x8f0e[_0x4e84d7];return _0x5c99fa;};'use strict';var Sequelize=require('sequelize');module[_0xe8f0('0x0')]={'name':{'type':Sequelize[_0xe8f0('0x1')]},'moduleCreate':{'type':Sequelize[_0xe8f0('0x2')](_0xe8f0('0x3'),_0xe8f0('0x4'),_0xe8f0('0x5')),'defaultValue':_0xe8f0('0x3')},'moduleSearch':{'type':Sequelize[_0xe8f0('0x2')](_0xe8f0('0x6'),_0xe8f0('0x4'),_0xe8f0('0x3')),'defaultValue':_0xe8f0('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 2007959..079593f 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 _0x88fd=['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','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','getFields','findOne','getSubjects','ZohoField','hasOwnProperty','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','Sequelize','ValidationError'];(function(_0x5c5fb4,_0x2cb903){var _0x4c0813=function(_0x13d311){while(--_0x13d311){_0x5c5fb4['push'](_0x5c5fb4['shift']());}};_0x4c0813(++_0x2cb903);}(_0x88fd,0x150));var _0xd88f=function(_0x2529bb,_0x25854b){_0x2529bb=_0x2529bb-0x0;var _0x56c1bd=_0x88fd[_0x2529bb];return _0x56c1bd;};'use strict';var pdf=require(_0xd88f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd88f('0x1'));var zipdir=require(_0xd88f('0x2'));var jsonpatch=require(_0xd88f('0x3'));var rp=require(_0xd88f('0x4'));var moment=require('moment');var BPromise=require(_0xd88f('0x5'));var Mustache=require(_0xd88f('0x6'));var util=require(_0xd88f('0x7'));var path=require('path');var sox=require(_0xd88f('0x8'));var csv=require(_0xd88f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd88f('0xa'));var squel=require('squel');var crypto=require(_0xd88f('0xb'));var jsforce=require(_0xd88f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd88f('0x9'));var querystring=require(_0xd88f('0xd'));var Papa=require(_0xd88f('0xe'));var Redis=require('ioredis');var authService=require(_0xd88f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd88f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd88f('0x11'));var utils=require(_0xd88f('0x12'));var config=require(_0xd88f('0x13'));var db=require(_0xd88f('0x14'))['db'];var jayson=require(_0xd88f('0x15'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2f49f3,_0xfb7ba9,_0x24254c){if(_0x24254c){var _0x33ebc4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33ebc4['test'](_0xfb7ba9)){return _0x2f49f3;}else{throw new db[(_0xd88f('0x16'))][(_0xd88f('0x17'))](_0xd88f('0x18'));}}else{return _0x2f49f3;}}function respondWithRpcPromise(_0x3a077f,_0x44a85b,_0x209de8,_0x42db08){return new BPromise(function(_0x1a58e3,_0x537e52){var _0x2939c4=_0x42db08||client;return _0x2939c4[_0xd88f('0x19')](_0x3a077f,_0x209de8)[_0xd88f('0x1a')](function(_0x9e5a4c){logger['info'](_0xd88f('0x1b'),_0x44a85b,_0xd88f('0x1c'));logger[_0xd88f('0x1d')](_0xd88f('0x1e'),_0x44a85b,_0xd88f('0x1c'),JSON['stringify'](_0x9e5a4c));if(_0x9e5a4c[_0xd88f('0x1f')]){if(_0x9e5a4c[_0xd88f('0x1f')][_0xd88f('0x20')]===0x1f4){logger[_0xd88f('0x1f')]('ZohoConfiguration,\x20%s,\x20%s',_0x44a85b,_0x9e5a4c[_0xd88f('0x1f')][_0xd88f('0x21')]);return _0x537e52(_0x9e5a4c[_0xd88f('0x1f')][_0xd88f('0x21')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x44a85b,_0x9e5a4c[_0xd88f('0x1f')][_0xd88f('0x21')]);return _0x1a58e3(_0x9e5a4c[_0xd88f('0x1f')][_0xd88f('0x21')]);}else{logger[_0xd88f('0x22')](_0xd88f('0x1b'),_0x44a85b,'request\x20sent');_0x1a58e3(_0x9e5a4c[_0xd88f('0x23')]['message']);}})[_0xd88f('0x24')](function(_0x4d528b){logger[_0xd88f('0x1f')](_0xd88f('0x1b'),_0x44a85b,_0x4d528b);_0x537e52(_0x4d528b);});});}function respondWithStatusCode(_0xf926f9,_0x3f1ecb){_0x3f1ecb=_0x3f1ecb||0xcc;return function(_0x213410){if(_0x213410){return _0xf926f9[_0xd88f('0x25')](_0x3f1ecb);}return _0xf926f9[_0xd88f('0x26')](_0x3f1ecb)[_0xd88f('0x27')]();};}function respondWithResult(_0x4a762c,_0x14b025){_0x14b025=_0x14b025||0xc8;return function(_0x52cbae){if(_0x52cbae){return _0x4a762c[_0xd88f('0x26')](_0x14b025)[_0xd88f('0x28')](_0x52cbae);}};}function respondWithFilteredResult(_0x12f545,_0x5175c6){return function(_0x2aa453){if(_0x2aa453){var _0x3f0f03=_0x2aa453[_0xd88f('0x29')],_0x7305d=_0x5175c6[_0xd88f('0x2a')],_0x2a0ddf=_0x5175c6[_0xd88f('0x2a')]+_0x5175c6[_0xd88f('0x2b')],_0x501a4e;if(_0x2a0ddf>=_0x3f0f03){_0x2a0ddf=_0x3f0f03;_0x501a4e=0xc8;}else{_0x501a4e=0xce;}_0x12f545['status'](_0x501a4e);return _0x12f545[_0xd88f('0x2c')](_0xd88f('0x2d'),_0x7305d+'-'+_0x2a0ddf+'/'+_0x3f0f03)[_0xd88f('0x28')](_0x2aa453);}return null;};}function patchUpdates(_0x320895){return function(_0x399368){try{jsonpatch[_0xd88f('0x2e')](_0x399368,_0x320895,!![]);}catch(_0x11d47d){return BPromise['reject'](_0x11d47d);}return _0x399368[_0xd88f('0x2f')]();};}function saveUpdates(_0x472736,_0x34cda2){return function(_0x4cfe4d){if(_0x4cfe4d){return _0x4cfe4d[_0xd88f('0x30')](_0x472736)['then'](function(_0x3a0465){return _0x3a0465;});}return null;};}function removeEntity(_0x278ff8,_0x4f8133){return function(_0x3d64c5){if(_0x3d64c5){return _0x3d64c5[_0xd88f('0x31')]()['then'](function(){_0x278ff8[_0xd88f('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34c755,_0x2197fd){return function(_0x602b0c){if(!_0x602b0c){_0x34c755['sendStatus'](0x194);}return _0x602b0c;};}function handleError(_0x410528,_0x37d4db){_0x37d4db=_0x37d4db||0x1f4;return function(_0x390ba4){logger['error'](_0x390ba4[_0xd88f('0x32')]);if(_0x390ba4[_0xd88f('0x33')]){delete _0x390ba4[_0xd88f('0x33')];}_0x410528['status'](_0x37d4db)[_0xd88f('0x34')](_0x390ba4);};}exports[_0xd88f('0x35')]=function(_0x379b11,_0x270281){var _0x5d5183={},_0x342515={},_0x1da402={'count':0x0,'rows':[]};var _0x38910b=_[_0xd88f('0x36')](db[_0xd88f('0x37')][_0xd88f('0x38')],function(_0x4cda57){return{'name':_0x4cda57[_0xd88f('0x39')],'type':_0x4cda57[_0xd88f('0x3a')]['key']};});_0x342515[_0xd88f('0x3b')]=_[_0xd88f('0x36')](_0x38910b,'name');_0x342515[_0xd88f('0x3c')]=_['keys'](_0x379b11[_0xd88f('0x3c')]);_0x342515[_0xd88f('0x3d')]=_[_0xd88f('0x3e')](_0x342515[_0xd88f('0x3b')],_0x342515[_0xd88f('0x3c')]);_0x5d5183[_0xd88f('0x3f')]=_[_0xd88f('0x3e')](_0x342515[_0xd88f('0x3b')],qs[_0xd88f('0x40')](_0x379b11[_0xd88f('0x3c')]['fields']));_0x5d5183[_0xd88f('0x3f')]=_0x5d5183[_0xd88f('0x3f')][_0xd88f('0x41')]?_0x5d5183[_0xd88f('0x3f')]:_0x342515[_0xd88f('0x3b')];if(!_0x379b11[_0xd88f('0x3c')]['hasOwnProperty'](_0xd88f('0x42'))){_0x5d5183[_0xd88f('0x2b')]=qs[_0xd88f('0x2b')](_0x379b11[_0xd88f('0x3c')][_0xd88f('0x2b')]);_0x5d5183[_0xd88f('0x2a')]=qs['offset'](_0x379b11[_0xd88f('0x3c')][_0xd88f('0x2a')]);}_0x5d5183[_0xd88f('0x43')]=qs['sort'](_0x379b11[_0xd88f('0x3c')][_0xd88f('0x44')]);_0x5d5183[_0xd88f('0x45')]=qs['filters'](_[_0xd88f('0x46')](_0x379b11[_0xd88f('0x3c')],_0x342515[_0xd88f('0x3d')]),_0x38910b);if(_0x379b11[_0xd88f('0x3c')]['filter']){_0x5d5183['where']=_[_0xd88f('0x47')](_0x5d5183[_0xd88f('0x45')],{'$or':_[_0xd88f('0x36')](_0x38910b,function(_0x8f372){if(_0x8f372['type']!=='VIRTUAL'){var _0x43e698={};_0x43e698[_0x8f372['name']]={'$like':'%'+_0x379b11[_0xd88f('0x3c')][_0xd88f('0x48')]+'%'};return _0x43e698;}})});}_0x5d5183=_[_0xd88f('0x47')]({},_0x5d5183,_0x379b11[_0xd88f('0x49')]);var _0x346afb={'where':_0x5d5183[_0xd88f('0x45')]};return db[_0xd88f('0x37')][_0xd88f('0x29')](_0x346afb)[_0xd88f('0x1a')](function(_0x7319e0){_0x1da402[_0xd88f('0x29')]=_0x7319e0;if(_0x379b11[_0xd88f('0x3c')][_0xd88f('0x4a')]){_0x5d5183['include']=[{'all':!![]}];}return db[_0xd88f('0x37')][_0xd88f('0x4b')](_0x5d5183);})[_0xd88f('0x1a')](function(_0x2e8153){_0x1da402[_0xd88f('0x4c')]=_0x2e8153;return _0x1da402;})[_0xd88f('0x1a')](respondWithFilteredResult(_0x270281,_0x5d5183))[_0xd88f('0x24')](handleError(_0x270281,null));};exports[_0xd88f('0x4d')]=function(_0x463497,_0x9a014){var _0x39cea4={'raw':![],'where':{'id':_0x463497[_0xd88f('0x4e')]['id']}},_0x2cb164={};_0x2cb164[_0xd88f('0x3b')]=_['keys'](db[_0xd88f('0x37')][_0xd88f('0x38')]);_0x2cb164[_0xd88f('0x3c')]=_[_0xd88f('0x4f')](_0x463497[_0xd88f('0x3c')]);_0x2cb164[_0xd88f('0x3d')]=_[_0xd88f('0x3e')](_0x2cb164[_0xd88f('0x3b')],_0x2cb164[_0xd88f('0x3c')]);_0x39cea4['attributes']=_[_0xd88f('0x3e')](_0x2cb164[_0xd88f('0x3b')],qs[_0xd88f('0x40')](_0x463497[_0xd88f('0x3c')][_0xd88f('0x40')]));_0x39cea4[_0xd88f('0x3f')]=_0x39cea4[_0xd88f('0x3f')]['length']?_0x39cea4['attributes']:_0x2cb164['model'];if(_0x463497[_0xd88f('0x3c')][_0xd88f('0x4a')]){_0x39cea4[_0xd88f('0x50')]=[{'all':!![]}];}_0x39cea4=_[_0xd88f('0x47')]({},_0x39cea4,_0x463497[_0xd88f('0x49')]);return db[_0xd88f('0x37')][_0xd88f('0x51')](_0x39cea4)[_0xd88f('0x1a')](handleEntityNotFound(_0x9a014,null))[_0xd88f('0x1a')](respondWithResult(_0x9a014,null))[_0xd88f('0x24')](handleError(_0x9a014,null));};exports['create']=function(_0x5f00a3,_0x5f1d16){return db[_0xd88f('0x37')][_0xd88f('0x52')](_0x5f00a3['body'],{})['then'](respondWithResult(_0x5f1d16,0xc9))['catch'](handleError(_0x5f1d16,null));};exports[_0xd88f('0x30')]=function(_0x148fd1,_0x31749a){if(_0x148fd1['body']['id']){delete _0x148fd1[_0xd88f('0x53')]['id'];}return db['ZohoConfiguration'][_0xd88f('0x51')]({'where':{'id':_0x148fd1[_0xd88f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x31749a,null))[_0xd88f('0x1a')](saveUpdates(_0x148fd1['body'],null))[_0xd88f('0x1a')](respondWithResult(_0x31749a,null))[_0xd88f('0x24')](handleError(_0x31749a,null));};exports[_0xd88f('0x31')]=function(_0x32eb40,_0x56cb54){return db[_0xd88f('0x37')][_0xd88f('0x51')]({'where':{'id':_0x32eb40[_0xd88f('0x4e')]['id']}})[_0xd88f('0x1a')](handleEntityNotFound(_0x56cb54,null))[_0xd88f('0x1a')](removeEntity(_0x56cb54,null))['catch'](handleError(_0x56cb54,null));};exports[_0xd88f('0x54')]=function(_0x45a34b,_0x31f0ef,_0x2f9df7){var _0x37f9eb={};var _0x5f3eba={};var _0x458cb9;var _0x51a8c9;return db['ZohoConfiguration'][_0xd88f('0x55')]({'where':{'id':_0x45a34b['params']['id']}})[_0xd88f('0x1a')](handleEntityNotFound(_0x31f0ef,null))[_0xd88f('0x1a')](function(_0x227af6){if(_0x227af6){_0x458cb9=_0x227af6;_0x5f3eba[_0xd88f('0x3b')]=_[_0xd88f('0x4f')](db['ZohoField'][_0xd88f('0x38')]);_0x5f3eba[_0xd88f('0x3c')]=_['keys'](_0x45a34b[_0xd88f('0x3c')]);_0x5f3eba[_0xd88f('0x3d')]=_[_0xd88f('0x3e')](_0x5f3eba[_0xd88f('0x3b')],_0x5f3eba[_0xd88f('0x3c')]);_0x37f9eb[_0xd88f('0x3f')]=_['intersection'](_0x5f3eba['model'],qs[_0xd88f('0x40')](_0x45a34b[_0xd88f('0x3c')][_0xd88f('0x40')]));_0x37f9eb[_0xd88f('0x3f')]=_0x37f9eb[_0xd88f('0x3f')][_0xd88f('0x41')]?_0x37f9eb[_0xd88f('0x3f')]:_0x5f3eba[_0xd88f('0x3b')];_0x37f9eb[_0xd88f('0x43')]=qs[_0xd88f('0x44')](_0x45a34b[_0xd88f('0x3c')][_0xd88f('0x44')]);_0x37f9eb['where']=qs['filters'](_[_0xd88f('0x46')](_0x45a34b[_0xd88f('0x3c')],_0x5f3eba[_0xd88f('0x3d')]));if(_0x45a34b[_0xd88f('0x3c')][_0xd88f('0x48')]){_0x37f9eb[_0xd88f('0x45')]=_['merge'](_0x37f9eb[_0xd88f('0x45')],{'$or':_['map'](_0x37f9eb['attributes'],function(_0x2e3879){var _0x3288ce={};_0x3288ce[_0x2e3879]={'$like':'%'+_0x45a34b[_0xd88f('0x3c')][_0xd88f('0x48')]+'%'};return _0x3288ce;})});}_0x37f9eb=_[_0xd88f('0x47')]({},_0x37f9eb,_0x45a34b[_0xd88f('0x49')]);return _0x458cb9[_0xd88f('0x54')](_0x37f9eb);}})[_0xd88f('0x1a')](function(_0x594681){if(_0x594681){_0x51a8c9=_0x594681[_0xd88f('0x41')];if(!_0x45a34b[_0xd88f('0x3c')]['hasOwnProperty'](_0xd88f('0x42'))){_0x37f9eb[_0xd88f('0x2b')]=qs['limit'](_0x45a34b['query'][_0xd88f('0x2b')]);_0x37f9eb[_0xd88f('0x2a')]=qs[_0xd88f('0x2a')](_0x45a34b[_0xd88f('0x3c')][_0xd88f('0x2a')]);}return _0x458cb9[_0xd88f('0x54')](_0x37f9eb);}})[_0xd88f('0x1a')](function(_0x4c368d){if(_0x4c368d){return _0x4c368d?{'count':_0x51a8c9,'rows':_0x4c368d}:null;}})[_0xd88f('0x1a')](respondWithResult(_0x31f0ef,null))[_0xd88f('0x24')](handleError(_0x31f0ef,null));};exports[_0xd88f('0x56')]=function(_0x444202,_0x3ba4b8,_0x4ad06c){var _0x6ac955={};var _0x1512fb={};var _0x2eaeea;var _0x5917b0;return db['ZohoConfiguration'][_0xd88f('0x55')]({'where':{'id':_0x444202['params']['id']}})['then'](handleEntityNotFound(_0x3ba4b8,null))[_0xd88f('0x1a')](function(_0x586a02){if(_0x586a02){_0x2eaeea=_0x586a02;_0x1512fb['model']=_[_0xd88f('0x4f')](db[_0xd88f('0x57')][_0xd88f('0x38')]);_0x1512fb[_0xd88f('0x3c')]=_[_0xd88f('0x4f')](_0x444202[_0xd88f('0x3c')]);_0x1512fb[_0xd88f('0x3d')]=_[_0xd88f('0x3e')](_0x1512fb[_0xd88f('0x3b')],_0x1512fb[_0xd88f('0x3c')]);_0x6ac955['attributes']=_[_0xd88f('0x3e')](_0x1512fb['model'],qs[_0xd88f('0x40')](_0x444202[_0xd88f('0x3c')]['fields']));_0x6ac955[_0xd88f('0x3f')]=_0x6ac955['attributes'][_0xd88f('0x41')]?_0x6ac955['attributes']:_0x1512fb[_0xd88f('0x3b')];_0x6ac955[_0xd88f('0x43')]=qs['sort'](_0x444202[_0xd88f('0x3c')][_0xd88f('0x44')]);_0x6ac955[_0xd88f('0x45')]=qs['filters'](_[_0xd88f('0x46')](_0x444202['query'],_0x1512fb['filters']));if(_0x444202['query'][_0xd88f('0x48')]){_0x6ac955[_0xd88f('0x45')]=_[_0xd88f('0x47')](_0x6ac955['where'],{'$or':_['map'](_0x6ac955[_0xd88f('0x3f')],function(_0x53a767){var _0x150c5a={};_0x150c5a[_0x53a767]={'$like':'%'+_0x444202[_0xd88f('0x3c')][_0xd88f('0x48')]+'%'};return _0x150c5a;})});}_0x6ac955=_['merge']({},_0x6ac955,_0x444202['options']);return _0x2eaeea['getSubjects'](_0x6ac955);}})['then'](function(_0x2f205d){if(_0x2f205d){_0x5917b0=_0x2f205d['length'];if(!_0x444202[_0xd88f('0x3c')][_0xd88f('0x58')](_0xd88f('0x42'))){_0x6ac955[_0xd88f('0x2b')]=qs[_0xd88f('0x2b')](_0x444202[_0xd88f('0x3c')][_0xd88f('0x2b')]);_0x6ac955[_0xd88f('0x2a')]=qs[_0xd88f('0x2a')](_0x444202[_0xd88f('0x3c')][_0xd88f('0x2a')]);}return _0x2eaeea[_0xd88f('0x56')](_0x6ac955);}})[_0xd88f('0x1a')](function(_0x428343){if(_0x428343){return _0x428343?{'count':_0x5917b0,'rows':_0x428343}:null;}})[_0xd88f('0x1a')](respondWithResult(_0x3ba4b8,null))[_0xd88f('0x24')](handleError(_0x3ba4b8,null));};exports[_0xd88f('0x59')]=function(_0x29b029,_0x16b43c,_0x2ecd5b){var _0x5a9f37={};var _0x8761df={};var _0x35e65d;var _0x38ddee;return db[_0xd88f('0x37')][_0xd88f('0x55')]({'where':{'id':_0x29b029[_0xd88f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16b43c,null))[_0xd88f('0x1a')](function(_0x280cab){if(_0x280cab){_0x35e65d=_0x280cab;_0x8761df['model']=_[_0xd88f('0x4f')](db[_0xd88f('0x57')][_0xd88f('0x38')]);_0x8761df['query']=_[_0xd88f('0x4f')](_0x29b029[_0xd88f('0x3c')]);_0x8761df['filters']=_[_0xd88f('0x3e')](_0x8761df[_0xd88f('0x3b')],_0x8761df[_0xd88f('0x3c')]);_0x5a9f37['attributes']=_[_0xd88f('0x3e')](_0x8761df[_0xd88f('0x3b')],qs[_0xd88f('0x40')](_0x29b029['query'][_0xd88f('0x40')]));_0x5a9f37['attributes']=_0x5a9f37[_0xd88f('0x3f')][_0xd88f('0x41')]?_0x5a9f37[_0xd88f('0x3f')]:_0x8761df[_0xd88f('0x3b')];_0x5a9f37[_0xd88f('0x43')]=qs[_0xd88f('0x44')](_0x29b029[_0xd88f('0x3c')][_0xd88f('0x44')]);_0x5a9f37[_0xd88f('0x45')]=qs[_0xd88f('0x3d')](_[_0xd88f('0x46')](_0x29b029[_0xd88f('0x3c')],_0x8761df[_0xd88f('0x3d')]));if(_0x29b029['query'][_0xd88f('0x48')]){_0x5a9f37[_0xd88f('0x45')]=_[_0xd88f('0x47')](_0x5a9f37[_0xd88f('0x45')],{'$or':_['map'](_0x5a9f37[_0xd88f('0x3f')],function(_0x2bc46a){var _0x2e7bd7={};_0x2e7bd7[_0x2bc46a]={'$like':'%'+_0x29b029[_0xd88f('0x3c')][_0xd88f('0x48')]+'%'};return _0x2e7bd7;})});}_0x5a9f37=_[_0xd88f('0x47')]({},_0x5a9f37,_0x29b029[_0xd88f('0x49')]);return _0x35e65d[_0xd88f('0x59')](_0x5a9f37);}})['then'](function(_0x5040f2){if(_0x5040f2){_0x38ddee=_0x5040f2['length'];if(!_0x29b029[_0xd88f('0x3c')][_0xd88f('0x58')](_0xd88f('0x42'))){_0x5a9f37['limit']=qs[_0xd88f('0x2b')](_0x29b029[_0xd88f('0x3c')][_0xd88f('0x2b')]);_0x5a9f37['offset']=qs[_0xd88f('0x2a')](_0x29b029['query'][_0xd88f('0x2a')]);}return _0x35e65d[_0xd88f('0x59')](_0x5a9f37);}})[_0xd88f('0x1a')](function(_0x57d549){if(_0x57d549){return _0x57d549?{'count':_0x38ddee,'rows':_0x57d549}:null;}})[_0xd88f('0x1a')](respondWithResult(_0x16b43c,null))[_0xd88f('0x24')](handleError(_0x16b43c,null));}; \ No newline at end of file +var _0x0693=['order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','destroy','findOne','pick','getFields','ZohoField','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','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','../../config/utils','../../config/environment','jayson/promise','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','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','json','count','offset','limit','status','set','Content-Range','apply','reject','update','end','sendStatus','stack','name','send','ZohoConfiguration','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0x0693,0xce));var _0x3069=function(_0x4278e0,_0x520733){_0x4278e0=_0x4278e0-0x0;var _0x53d653=_0x0693[_0x4278e0];return _0x53d653;};'use strict';var pdf=require(_0x3069('0x0'));var emlformat=require(_0x3069('0x1'));var rimraf=require(_0x3069('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3069('0x3'));var rp=require(_0x3069('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3069('0x5'));var util=require('util');var path=require(_0x3069('0x6'));var sox=require(_0x3069('0x7'));var csv=require(_0x3069('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3069('0x9'));var squel=require(_0x3069('0xa'));var crypto=require(_0x3069('0xb'));var jsforce=require(_0x3069('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3069('0x8'));var querystring=require(_0x3069('0xd'));var Papa=require(_0x3069('0xe'));var Redis=require('ioredis');var authService=require(_0x3069('0xf'));var qs=require(_0x3069('0x10'));var as=require(_0x3069('0x11'));var hardwareService=require(_0x3069('0x12'));var logger=require(_0x3069('0x13'))('api');var utils=require(_0x3069('0x14'));var config=require(_0x3069('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3069('0x16'));var client=jayson[_0x3069('0x17')][_0x3069('0x18')]({'port':0x232a});function checkPasswordPattern(_0x62ecb0,_0x40ab2e,_0x5d3c6f){if(_0x5d3c6f){var _0x8682d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8682d4['test'](_0x40ab2e)){return _0x62ecb0;}else{throw new db[(_0x3069('0x19'))]['ValidationError'](_0x3069('0x1a'));}}else{return _0x62ecb0;}}function respondWithRpcPromise(_0x391661,_0x43813f,_0x3a94f5,_0x467def){return new BPromise(function(_0x46f89a,_0x1368a5){var _0x18c37e=_0x467def||client;return _0x18c37e[_0x3069('0x1b')](_0x391661,_0x3a94f5)[_0x3069('0x1c')](function(_0x4e660b){logger[_0x3069('0x1d')](_0x3069('0x1e'),_0x43813f,_0x3069('0x1f'));logger[_0x3069('0x20')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x43813f,_0x3069('0x1f'),JSON['stringify'](_0x4e660b));if(_0x4e660b[_0x3069('0x21')]){if(_0x4e660b[_0x3069('0x21')][_0x3069('0x22')]===0x1f4){logger[_0x3069('0x21')](_0x3069('0x1e'),_0x43813f,_0x4e660b['error'][_0x3069('0x23')]);return _0x1368a5(_0x4e660b['error'][_0x3069('0x23')]);}logger[_0x3069('0x21')](_0x3069('0x1e'),_0x43813f,_0x4e660b[_0x3069('0x21')][_0x3069('0x23')]);return _0x46f89a(_0x4e660b['error'][_0x3069('0x23')]);}else{logger[_0x3069('0x1d')](_0x3069('0x1e'),_0x43813f,_0x3069('0x1f'));_0x46f89a(_0x4e660b['result'][_0x3069('0x23')]);}})[_0x3069('0x24')](function(_0x566933){logger['error'](_0x3069('0x1e'),_0x43813f,_0x566933);_0x1368a5(_0x566933);});});}function respondWithStatusCode(_0x435385,_0xbe067){_0xbe067=_0xbe067||0xcc;return function(_0x1aa64e){if(_0x1aa64e){return _0x435385['sendStatus'](_0xbe067);}return _0x435385['status'](_0xbe067)['end']();};}function respondWithResult(_0x1e4e9f,_0x16b15){_0x16b15=_0x16b15||0xc8;return function(_0x74e04){if(_0x74e04){return _0x1e4e9f['status'](_0x16b15)[_0x3069('0x25')](_0x74e04);}};}function respondWithFilteredResult(_0x5d0671,_0x17faa1){return function(_0x4f9243){if(_0x4f9243){var _0xf7526f=_0x4f9243[_0x3069('0x26')],_0x4393f0=_0x17faa1[_0x3069('0x27')],_0x1875ca=_0x17faa1[_0x3069('0x27')]+_0x17faa1[_0x3069('0x28')],_0x225590;if(_0x1875ca>=_0xf7526f){_0x1875ca=_0xf7526f;_0x225590=0xc8;}else{_0x225590=0xce;}_0x5d0671[_0x3069('0x29')](_0x225590);return _0x5d0671[_0x3069('0x2a')](_0x3069('0x2b'),_0x4393f0+'-'+_0x1875ca+'/'+_0xf7526f)['json'](_0x4f9243);}return null;};}function patchUpdates(_0x270472){return function(_0x3a4eaa){try{jsonpatch[_0x3069('0x2c')](_0x3a4eaa,_0x270472,!![]);}catch(_0x1d021c){return BPromise[_0x3069('0x2d')](_0x1d021c);}return _0x3a4eaa['save']();};}function saveUpdates(_0x221436,_0x53c304){return function(_0x47226e){if(_0x47226e){return _0x47226e[_0x3069('0x2e')](_0x221436)[_0x3069('0x1c')](function(_0x304d65){return _0x304d65;});}return null;};}function removeEntity(_0x4970ea,_0x5c0109){return function(_0x26324a){if(_0x26324a){return _0x26324a['destroy']()[_0x3069('0x1c')](function(){_0x4970ea['status'](0xcc)[_0x3069('0x2f')]();});}};}function handleEntityNotFound(_0x5cc30f,_0x294b95){return function(_0x1291bd){if(!_0x1291bd){_0x5cc30f[_0x3069('0x30')](0x194);}return _0x1291bd;};}function handleError(_0x469f42,_0x3306a8){_0x3306a8=_0x3306a8||0x1f4;return function(_0x2e6851){logger[_0x3069('0x21')](_0x2e6851[_0x3069('0x31')]);if(_0x2e6851['name']){delete _0x2e6851[_0x3069('0x32')];}_0x469f42[_0x3069('0x29')](_0x3306a8)[_0x3069('0x33')](_0x2e6851);};}exports['index']=function(_0x43c853,_0x401ad5){var _0x12b755={},_0x1fe0b6={},_0x3e941c={'count':0x0,'rows':[]};var _0x1e990a=_['map'](db[_0x3069('0x34')]['rawAttributes'],function(_0x3d5862){return{'name':_0x3d5862[_0x3069('0x35')],'type':_0x3d5862[_0x3069('0x36')]['key']};});_0x1fe0b6[_0x3069('0x37')]=_[_0x3069('0x38')](_0x1e990a,'name');_0x1fe0b6[_0x3069('0x39')]=_[_0x3069('0x3a')](_0x43c853[_0x3069('0x39')]);_0x1fe0b6['filters']=_[_0x3069('0x3b')](_0x1fe0b6['model'],_0x1fe0b6[_0x3069('0x39')]);_0x12b755[_0x3069('0x3c')]=_[_0x3069('0x3b')](_0x1fe0b6[_0x3069('0x37')],qs[_0x3069('0x3d')](_0x43c853[_0x3069('0x39')][_0x3069('0x3d')]));_0x12b755['attributes']=_0x12b755[_0x3069('0x3c')][_0x3069('0x3e')]?_0x12b755[_0x3069('0x3c')]:_0x1fe0b6[_0x3069('0x37')];if(!_0x43c853[_0x3069('0x39')][_0x3069('0x3f')]('nolimit')){_0x12b755['limit']=qs[_0x3069('0x28')](_0x43c853[_0x3069('0x39')]['limit']);_0x12b755['offset']=qs['offset'](_0x43c853[_0x3069('0x39')][_0x3069('0x27')]);}_0x12b755[_0x3069('0x40')]=qs['sort'](_0x43c853[_0x3069('0x39')][_0x3069('0x41')]);_0x12b755[_0x3069('0x42')]=qs[_0x3069('0x43')](_['pick'](_0x43c853[_0x3069('0x39')],_0x1fe0b6[_0x3069('0x43')]),_0x1e990a);if(_0x43c853[_0x3069('0x39')]['filter']){_0x12b755[_0x3069('0x42')]=_[_0x3069('0x44')](_0x12b755[_0x3069('0x42')],{'$or':_['map'](_0x1e990a,function(_0x4df24a){if(_0x4df24a[_0x3069('0x36')]!==_0x3069('0x45')){var _0x4ede98={};_0x4ede98[_0x4df24a[_0x3069('0x32')]]={'$like':'%'+_0x43c853[_0x3069('0x39')][_0x3069('0x46')]+'%'};return _0x4ede98;}})});}_0x12b755=_[_0x3069('0x44')]({},_0x12b755,_0x43c853[_0x3069('0x47')]);var _0x1b7acc={'where':_0x12b755[_0x3069('0x42')]};return db[_0x3069('0x34')]['count'](_0x1b7acc)[_0x3069('0x1c')](function(_0xc60351){_0x3e941c['count']=_0xc60351;if(_0x43c853[_0x3069('0x39')][_0x3069('0x48')]){_0x12b755[_0x3069('0x49')]=[{'all':!![]}];}return db[_0x3069('0x34')][_0x3069('0x4a')](_0x12b755);})[_0x3069('0x1c')](function(_0x2c830f){_0x3e941c[_0x3069('0x4b')]=_0x2c830f;return _0x3e941c;})[_0x3069('0x1c')](respondWithFilteredResult(_0x401ad5,_0x12b755))['catch'](handleError(_0x401ad5,null));};exports[_0x3069('0x4c')]=function(_0x36fc51,_0x1d8508){var _0x23c948={'raw':![],'where':{'id':_0x36fc51[_0x3069('0x4d')]['id']}},_0x51f321={};_0x51f321[_0x3069('0x37')]=_[_0x3069('0x3a')](db[_0x3069('0x34')][_0x3069('0x4e')]);_0x51f321[_0x3069('0x39')]=_['keys'](_0x36fc51[_0x3069('0x39')]);_0x51f321[_0x3069('0x43')]=_[_0x3069('0x3b')](_0x51f321[_0x3069('0x37')],_0x51f321[_0x3069('0x39')]);_0x23c948[_0x3069('0x3c')]=_[_0x3069('0x3b')](_0x51f321[_0x3069('0x37')],qs[_0x3069('0x3d')](_0x36fc51[_0x3069('0x39')]['fields']));_0x23c948[_0x3069('0x3c')]=_0x23c948[_0x3069('0x3c')]['length']?_0x23c948[_0x3069('0x3c')]:_0x51f321[_0x3069('0x37')];if(_0x36fc51[_0x3069('0x39')][_0x3069('0x48')]){_0x23c948[_0x3069('0x49')]=[{'all':!![]}];}_0x23c948=_[_0x3069('0x44')]({},_0x23c948,_0x36fc51[_0x3069('0x47')]);return db[_0x3069('0x34')]['find'](_0x23c948)[_0x3069('0x1c')](handleEntityNotFound(_0x1d8508,null))[_0x3069('0x1c')](respondWithResult(_0x1d8508,null))[_0x3069('0x24')](handleError(_0x1d8508,null));};exports['create']=function(_0x2d923a,_0x4efb1d){return db[_0x3069('0x34')][_0x3069('0x4f')](_0x2d923a[_0x3069('0x50')],{})[_0x3069('0x1c')](respondWithResult(_0x4efb1d,0xc9))[_0x3069('0x24')](handleError(_0x4efb1d,null));};exports[_0x3069('0x2e')]=function(_0x566172,_0xc69a42){if(_0x566172['body']['id']){delete _0x566172[_0x3069('0x50')]['id'];}return db['ZohoConfiguration'][_0x3069('0x51')]({'where':{'id':_0x566172[_0x3069('0x4d')]['id']}})[_0x3069('0x1c')](handleEntityNotFound(_0xc69a42,null))[_0x3069('0x1c')](saveUpdates(_0x566172[_0x3069('0x50')],null))[_0x3069('0x1c')](respondWithResult(_0xc69a42,null))[_0x3069('0x24')](handleError(_0xc69a42,null));};exports[_0x3069('0x52')]=function(_0x3a18b7,_0x10603e){return db[_0x3069('0x34')]['find']({'where':{'id':_0x3a18b7[_0x3069('0x4d')]['id']}})[_0x3069('0x1c')](handleEntityNotFound(_0x10603e,null))['then'](removeEntity(_0x10603e,null))['catch'](handleError(_0x10603e,null));};exports['getFields']=function(_0x4d8312,_0x2046e2,_0xf630d3){var _0x535371={};var _0x74ef07={};var _0xa30959;var _0x32a38f;return db['ZohoConfiguration'][_0x3069('0x53')]({'where':{'id':_0x4d8312[_0x3069('0x4d')]['id']}})[_0x3069('0x1c')](handleEntityNotFound(_0x2046e2,null))[_0x3069('0x1c')](function(_0x30512c){if(_0x30512c){_0xa30959=_0x30512c;_0x74ef07[_0x3069('0x37')]=_[_0x3069('0x3a')](db['ZohoField']['rawAttributes']);_0x74ef07[_0x3069('0x39')]=_[_0x3069('0x3a')](_0x4d8312['query']);_0x74ef07[_0x3069('0x43')]=_[_0x3069('0x3b')](_0x74ef07[_0x3069('0x37')],_0x74ef07['query']);_0x535371[_0x3069('0x3c')]=_['intersection'](_0x74ef07['model'],qs[_0x3069('0x3d')](_0x4d8312[_0x3069('0x39')][_0x3069('0x3d')]));_0x535371[_0x3069('0x3c')]=_0x535371[_0x3069('0x3c')][_0x3069('0x3e')]?_0x535371[_0x3069('0x3c')]:_0x74ef07[_0x3069('0x37')];_0x535371[_0x3069('0x40')]=qs['sort'](_0x4d8312[_0x3069('0x39')][_0x3069('0x41')]);_0x535371[_0x3069('0x42')]=qs[_0x3069('0x43')](_[_0x3069('0x54')](_0x4d8312[_0x3069('0x39')],_0x74ef07[_0x3069('0x43')]));if(_0x4d8312['query'][_0x3069('0x46')]){_0x535371[_0x3069('0x42')]=_[_0x3069('0x44')](_0x535371['where'],{'$or':_[_0x3069('0x38')](_0x535371['attributes'],function(_0x82a658){var _0x44493d={};_0x44493d[_0x82a658]={'$like':'%'+_0x4d8312[_0x3069('0x39')][_0x3069('0x46')]+'%'};return _0x44493d;})});}_0x535371=_[_0x3069('0x44')]({},_0x535371,_0x4d8312[_0x3069('0x47')]);return _0xa30959['getFields'](_0x535371);}})[_0x3069('0x1c')](function(_0xe3aa12){if(_0xe3aa12){_0x32a38f=_0xe3aa12[_0x3069('0x3e')];if(!_0x4d8312['query'][_0x3069('0x3f')]('nolimit')){_0x535371[_0x3069('0x28')]=qs['limit'](_0x4d8312['query'][_0x3069('0x28')]);_0x535371['offset']=qs[_0x3069('0x27')](_0x4d8312[_0x3069('0x39')][_0x3069('0x27')]);}return _0xa30959[_0x3069('0x55')](_0x535371);}})['then'](function(_0x573cd3){if(_0x573cd3){return _0x573cd3?{'count':_0x32a38f,'rows':_0x573cd3}:null;}})['then'](respondWithResult(_0x2046e2,null))['catch'](handleError(_0x2046e2,null));};exports['getSubjects']=function(_0x7262a8,_0x16e9f5,_0x8179f6){var _0x1228e9={};var _0x1b553d={};var _0x53e8a2;var _0x2e491f;return db[_0x3069('0x34')][_0x3069('0x53')]({'where':{'id':_0x7262a8[_0x3069('0x4d')]['id']}})[_0x3069('0x1c')](handleEntityNotFound(_0x16e9f5,null))[_0x3069('0x1c')](function(_0x351328){if(_0x351328){_0x53e8a2=_0x351328;_0x1b553d[_0x3069('0x37')]=_[_0x3069('0x3a')](db[_0x3069('0x56')]['rawAttributes']);_0x1b553d[_0x3069('0x39')]=_[_0x3069('0x3a')](_0x7262a8['query']);_0x1b553d[_0x3069('0x43')]=_[_0x3069('0x3b')](_0x1b553d[_0x3069('0x37')],_0x1b553d['query']);_0x1228e9[_0x3069('0x3c')]=_[_0x3069('0x3b')](_0x1b553d[_0x3069('0x37')],qs[_0x3069('0x3d')](_0x7262a8[_0x3069('0x39')][_0x3069('0x3d')]));_0x1228e9[_0x3069('0x3c')]=_0x1228e9[_0x3069('0x3c')][_0x3069('0x3e')]?_0x1228e9[_0x3069('0x3c')]:_0x1b553d['model'];_0x1228e9[_0x3069('0x40')]=qs[_0x3069('0x41')](_0x7262a8[_0x3069('0x39')][_0x3069('0x41')]);_0x1228e9['where']=qs[_0x3069('0x43')](_[_0x3069('0x54')](_0x7262a8[_0x3069('0x39')],_0x1b553d['filters']));if(_0x7262a8[_0x3069('0x39')][_0x3069('0x46')]){_0x1228e9[_0x3069('0x42')]=_['merge'](_0x1228e9[_0x3069('0x42')],{'$or':_[_0x3069('0x38')](_0x1228e9['attributes'],function(_0x413bae){var _0xac383f={};_0xac383f[_0x413bae]={'$like':'%'+_0x7262a8[_0x3069('0x39')][_0x3069('0x46')]+'%'};return _0xac383f;})});}_0x1228e9=_[_0x3069('0x44')]({},_0x1228e9,_0x7262a8['options']);return _0x53e8a2['getSubjects'](_0x1228e9);}})[_0x3069('0x1c')](function(_0x1a1ecc){if(_0x1a1ecc){_0x2e491f=_0x1a1ecc[_0x3069('0x3e')];if(!_0x7262a8[_0x3069('0x39')][_0x3069('0x3f')](_0x3069('0x57'))){_0x1228e9['limit']=qs[_0x3069('0x28')](_0x7262a8[_0x3069('0x39')][_0x3069('0x28')]);_0x1228e9[_0x3069('0x27')]=qs[_0x3069('0x27')](_0x7262a8['query'][_0x3069('0x27')]);}return _0x53e8a2[_0x3069('0x58')](_0x1228e9);}})[_0x3069('0x1c')](function(_0x4cf6f3){if(_0x4cf6f3){return _0x4cf6f3?{'count':_0x2e491f,'rows':_0x4cf6f3}:null;}})[_0x3069('0x1c')](respondWithResult(_0x16e9f5,null))['catch'](handleError(_0x16e9f5,null));};exports['getDescriptions']=function(_0x122c35,_0x51ec54,_0x55fce9){var _0x3587f9={};var _0x25c421={};var _0x5f4a80;var _0x26c334;return db[_0x3069('0x34')][_0x3069('0x53')]({'where':{'id':_0x122c35[_0x3069('0x4d')]['id']}})[_0x3069('0x1c')](handleEntityNotFound(_0x51ec54,null))[_0x3069('0x1c')](function(_0x68a78f){if(_0x68a78f){_0x5f4a80=_0x68a78f;_0x25c421[_0x3069('0x37')]=_['keys'](db['ZohoField'][_0x3069('0x4e')]);_0x25c421[_0x3069('0x39')]=_[_0x3069('0x3a')](_0x122c35[_0x3069('0x39')]);_0x25c421[_0x3069('0x43')]=_['intersection'](_0x25c421[_0x3069('0x37')],_0x25c421[_0x3069('0x39')]);_0x3587f9['attributes']=_[_0x3069('0x3b')](_0x25c421['model'],qs[_0x3069('0x3d')](_0x122c35[_0x3069('0x39')][_0x3069('0x3d')]));_0x3587f9[_0x3069('0x3c')]=_0x3587f9[_0x3069('0x3c')][_0x3069('0x3e')]?_0x3587f9[_0x3069('0x3c')]:_0x25c421['model'];_0x3587f9['order']=qs[_0x3069('0x41')](_0x122c35[_0x3069('0x39')][_0x3069('0x41')]);_0x3587f9['where']=qs['filters'](_[_0x3069('0x54')](_0x122c35['query'],_0x25c421['filters']));if(_0x122c35[_0x3069('0x39')][_0x3069('0x46')]){_0x3587f9[_0x3069('0x42')]=_[_0x3069('0x44')](_0x3587f9[_0x3069('0x42')],{'$or':_[_0x3069('0x38')](_0x3587f9['attributes'],function(_0x5b797e){var _0x16ef2d={};_0x16ef2d[_0x5b797e]={'$like':'%'+_0x122c35['query']['filter']+'%'};return _0x16ef2d;})});}_0x3587f9=_[_0x3069('0x44')]({},_0x3587f9,_0x122c35[_0x3069('0x47')]);return _0x5f4a80[_0x3069('0x59')](_0x3587f9);}})['then'](function(_0x52858c){if(_0x52858c){_0x26c334=_0x52858c['length'];if(!_0x122c35[_0x3069('0x39')][_0x3069('0x3f')](_0x3069('0x57'))){_0x3587f9[_0x3069('0x28')]=qs[_0x3069('0x28')](_0x122c35[_0x3069('0x39')]['limit']);_0x3587f9['offset']=qs[_0x3069('0x27')](_0x122c35[_0x3069('0x39')]['offset']);}return _0x5f4a80[_0x3069('0x59')](_0x3587f9);}})['then'](function(_0x27acc1){if(_0x27acc1){return _0x27acc1?{'count':_0x26c334,'rows':_0x27acc1}:null;}})['then'](respondWithResult(_0x51ec54,null))[_0x3069('0x24')](handleError(_0x51ec54,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c3f3405..96fcc35 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 _0xb365=['api','path','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0xb365,0x10f));var _0x5b36=function(_0x247de6,_0x36bc2e){_0x247de6=_0x247de6-0x0;var _0x515420=_0xb365[_0x247de6];return _0x515420;};'use strict';var _=require(_0x5b36('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5b36('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b36('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5b36('0x3'));module[_0x5b36('0x4')]=function(_0x1123ba,_0x361567){return _0x1123ba[_0x5b36('0x5')](_0x5b36('0x6'),attributes,{'tableName':_0x5b36('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2d7=['define','ZohoConfiguration','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x420a11,_0xe6a72b){var _0x2da685=function(_0xc136ae){while(--_0xc136ae){_0x420a11['push'](_0x420a11['shift']());}};_0x2da685(++_0xe6a72b);}(_0xc2d7,0x9e));var _0x7c2d=function(_0x11f110,_0x30e39c){_0x11f110=_0x11f110-0x0;var _0x4b95fd=_0xc2d7[_0x11f110];return _0x4b95fd;};'use strict';var _=require(_0x7c2d('0x0'));var util=require('util');var logger=require(_0x7c2d('0x1'))(_0x7c2d('0x2'));var moment=require(_0x7c2d('0x3'));var BPromise=require(_0x7c2d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c2d('0x5'));var rimraf=require(_0x7c2d('0x6'));var config=require(_0x7c2d('0x7'));var attributes=require(_0x7c2d('0x8'));module[_0x7c2d('0x9')]=function(_0x5a5fca,_0x524e3d){return _0x5a5fca[_0x7c2d('0xa')](_0x7c2d('0xb'),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 956e6dd..e3d0c1d 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 _0xbdc8=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x533290,_0x31e3ae){var _0x23f13d=function(_0x3473fb){while(--_0x3473fb){_0x533290['push'](_0x533290['shift']());}};_0x23f13d(++_0x31e3ae);}(_0xbdc8,0x10e));var _0x8bdc=function(_0x333cfa,_0x74e10b){_0x333cfa=_0x333cfa-0x0;var _0x592349=_0xbdc8[_0x333cfa];return _0x592349;};'use strict';var _=require(_0x8bdc('0x0'));var util=require(_0x8bdc('0x1'));var moment=require(_0x8bdc('0x2'));var BPromise=require(_0x8bdc('0x3'));var rs=require(_0x8bdc('0x4'));var fs=require('fs');var Redis=require(_0x8bdc('0x5'));var db=require(_0x8bdc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bdc('0x7'))('rpc');var config=require(_0x8bdc('0x8'));var jayson=require(_0x8bdc('0x9'));var client=jayson[_0x8bdc('0xa')][_0x8bdc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x479371,_0x5cd9a1,_0x53f52a){return new BPromise(function(_0x442183,_0x45c349){return client[_0x8bdc('0xc')](_0x479371,_0x53f52a)[_0x8bdc('0xd')](function(_0x3a4274){logger[_0x8bdc('0xe')](_0x8bdc('0xf'),_0x5cd9a1,_0x8bdc('0x10'));logger[_0x8bdc('0x11')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x5cd9a1,_0x8bdc('0x10'),JSON[_0x8bdc('0x12')](_0x3a4274));if(_0x3a4274[_0x8bdc('0x13')]){if(_0x3a4274[_0x8bdc('0x13')][_0x8bdc('0x14')]===0x1f4){logger[_0x8bdc('0x13')](_0x8bdc('0xf'),_0x5cd9a1,_0x3a4274[_0x8bdc('0x13')][_0x8bdc('0x15')]);return _0x45c349(_0x3a4274[_0x8bdc('0x13')][_0x8bdc('0x15')]);}logger[_0x8bdc('0x13')](_0x8bdc('0xf'),_0x5cd9a1,_0x3a4274[_0x8bdc('0x13')][_0x8bdc('0x15')]);return _0x442183(_0x3a4274[_0x8bdc('0x13')]['message']);}else{logger[_0x8bdc('0xe')](_0x8bdc('0xf'),_0x5cd9a1,_0x8bdc('0x10'));_0x442183(_0x3a4274[_0x8bdc('0x16')][_0x8bdc('0x15')]);}})['catch'](function(_0x31419e){logger['error'](_0x8bdc('0xf'),_0x5cd9a1,_0x31419e);_0x45c349(_0x31419e);});});} \ No newline at end of file +var _0x529d=['stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x523baa,_0x3fab0f){var _0x288f43=function(_0x3889e8){while(--_0x3889e8){_0x523baa['push'](_0x523baa['shift']());}};_0x288f43(++_0x3fab0f);}(_0x529d,0xfd));var _0xd529=function(_0x1bcf49,_0x41a42c){_0x1bcf49=_0x1bcf49-0x0;var _0x364505=_0x529d[_0x1bcf49];return _0x364505;};'use strict';var _=require(_0xd529('0x0'));var util=require(_0xd529('0x1'));var moment=require('moment');var BPromise=require(_0xd529('0x2'));var rs=require(_0xd529('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd529('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd529('0x5'))(_0xd529('0x6'));var config=require('../../config/environment');var jayson=require(_0xd529('0x7'));var client=jayson[_0xd529('0x8')][_0xd529('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f59d8,_0x1e8f52,_0x451a18){return new BPromise(function(_0x57bbff,_0x5a9c11){return client['request'](_0x2f59d8,_0x451a18)[_0xd529('0xa')](function(_0x4a2495){logger[_0xd529('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x1e8f52,'request\x20sent');logger['debug'](_0xd529('0xc'),_0x1e8f52,'request\x20sent',JSON[_0xd529('0xd')](_0x4a2495));if(_0x4a2495['error']){if(_0x4a2495[_0xd529('0xe')]['code']===0x1f4){logger[_0xd529('0xe')](_0xd529('0xf'),_0x1e8f52,_0x4a2495[_0xd529('0xe')]['message']);return _0x5a9c11(_0x4a2495[_0xd529('0xe')][_0xd529('0x10')]);}logger['error'](_0xd529('0xf'),_0x1e8f52,_0x4a2495[_0xd529('0xe')][_0xd529('0x10')]);return _0x57bbff(_0x4a2495[_0xd529('0xe')]['message']);}else{logger[_0xd529('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x1e8f52,_0xd529('0x11'));_0x57bbff(_0x4a2495[_0xd529('0x12')][_0xd529('0x10')]);}})['catch'](function(_0x2ececd){logger[_0xd529('0xe')](_0xd529('0xf'),_0x1e8f52,_0x2ececd);_0x5a9c11(_0x2ececd);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 3924908..42c6179 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 _0x4e2e=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x1e90b8,_0x31e660){var _0x36fdd6=function(_0x37f7dc){while(--_0x37f7dc){_0x1e90b8['push'](_0x1e90b8['shift']());}};_0x36fdd6(++_0x31e660);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x2f2eb8,_0x52b0f0){_0x2f2eb8=_0x2f2eb8-0x0;var _0x3f8e1f=_0x4e2e[_0x2f2eb8];return _0x3f8e1f;};'use strict';var multer=require('multer');var util=require(_0xe4e2('0x0'));var path=require(_0xe4e2('0x1'));var timeout=require(_0xe4e2('0x2'));var express=require(_0xe4e2('0x3'));var router=express[_0xe4e2('0x4')]();var auth=require(_0xe4e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe4e2('0x6'));var controller=require(_0xe4e2('0x7'));router[_0xe4e2('0x8')]('/',auth[_0xe4e2('0x9')](),controller['index']);router[_0xe4e2('0x8')](_0xe4e2('0xa'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xb')]);router[_0xe4e2('0xc')]('/',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xd')]);router[_0xe4e2('0xe')]('/:id',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xf')]);router[_0xe4e2('0x10')]('/:id',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x11')]);module[_0xe4e2('0x12')]=router; \ No newline at end of file +var _0x32b6=['exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','put','destroy'];(function(_0x17560b,_0x223f54){var _0x4b5e9b=function(_0x1373a4){while(--_0x1373a4){_0x17560b['push'](_0x17560b['shift']());}};_0x4b5e9b(++_0x223f54);}(_0x32b6,0x1d1));var _0x632b=function(_0x263c07,_0x48546c){_0x263c07=_0x263c07-0x0;var _0x5891b0=_0x32b6[_0x263c07];return _0x5891b0;};'use strict';var multer=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var path=require('path');var timeout=require(_0x632b('0x2'));var express=require(_0x632b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x632b('0x4'));var config=require(_0x632b('0x5'));var controller=require(_0x632b('0x6'));router[_0x632b('0x7')]('/',auth[_0x632b('0x8')](),controller[_0x632b('0x9')]);router[_0x632b('0x7')](_0x632b('0xa'),auth[_0x632b('0x8')](),controller[_0x632b('0xb')]);router['post']('/',auth[_0x632b('0x8')](),controller[_0x632b('0xc')]);router[_0x632b('0xd')](_0x632b('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x632b('0xa'),auth['isAuthenticated'](),controller[_0x632b('0xe')]);module[_0x632b('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index b1cd1c1..0db49a4 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 _0x374f=['keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x74e8d3,_0x123707){var _0x56a804=function(_0x2e2362){while(--_0x2e2362){_0x74e8d3['push'](_0x74e8d3['shift']());}};_0x56a804(++_0x123707);}(_0x374f,0x13f));var _0xf374=function(_0x24c84f,_0x42550e){_0x24c84f=_0x24c84f-0x0;var _0x579499=_0x374f[_0x24c84f];return _0x579499;};'use strict';var Sequelize=require(_0xf374('0x0'));module[_0xf374('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf374('0x2'),_0xf374('0x3'),_0xf374('0x4'),_0xf374('0x5')),'defaultValue':_0xf374('0x2')},'content':{'type':Sequelize[_0xf374('0x6')]},'key':{'type':Sequelize[_0xf374('0x6')]},'keyType':{'type':Sequelize[_0xf374('0x7')](_0xf374('0x2'),_0xf374('0x3'),_0xf374('0x4'))},'keyContent':{'type':Sequelize[_0xf374('0x6')]},'idField':{'type':Sequelize[_0xf374('0x6')]},'nameField':{'type':Sequelize[_0xf374('0x6')]},'customField':{'type':Sequelize[_0xf374('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf374('0x6')]}}; \ No newline at end of file +var _0x9d3e=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x5561c8,_0xa85337){var _0x579f85=function(_0x51383c){while(--_0x51383c){_0x5561c8['push'](_0x5561c8['shift']());}};_0x579f85(++_0xa85337);}(_0x9d3e,0xd5));var _0xe9d3=function(_0x44aa52,_0x4bc38d){_0x44aa52=_0x44aa52-0x0;var _0x43e51d=_0x9d3e[_0x44aa52];return _0x43e51d;};'use strict';var Sequelize=require(_0xe9d3('0x0'));module['exports']={'type':{'type':Sequelize[_0xe9d3('0x1')]('string',_0xe9d3('0x2'),_0xe9d3('0x3'),_0xe9d3('0x4')),'defaultValue':_0xe9d3('0x5')},'content':{'type':Sequelize[_0xe9d3('0x6')]},'key':{'type':Sequelize[_0xe9d3('0x6')]},'keyType':{'type':Sequelize[_0xe9d3('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xe9d3('0x6')]},'idField':{'type':Sequelize[_0xe9d3('0x6')]},'nameField':{'type':Sequelize[_0xe9d3('0x6')]},'customField':{'type':Sequelize[_0xe9d3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe9d3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 55c0411..67c8020 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x5484cf,_0x153f52){var _0x5b7de7=function(_0x56c53a){while(--_0x56c53a){_0x5484cf['push'](_0x5484cf['shift']());}};_0x5b7de7(++_0x153f52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0xe0ba74,_0x5dcbac){var _0x5efbef=function(_0x607401){while(--_0x607401){_0xe0ba74['push'](_0xe0ba74['shift']());}};_0x5efbef(++_0x5dcbac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 0a5c0ba..b92de16 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 _0xad6b=['int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','define','ZohoField'];(function(_0x11bb0f,_0x208efb){var _0x371e38=function(_0x38699e){while(--_0x38699e){_0x11bb0f['push'](_0x11bb0f['shift']());}};_0x371e38(++_0x208efb);}(_0xad6b,0xd4));var _0xbad6=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xad6b[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xbad6('0x0'));var util=require(_0xbad6('0x1'));var logger=require(_0xbad6('0x2'))(_0xbad6('0x3'));var moment=require(_0xbad6('0x4'));var BPromise=require(_0xbad6('0x5'));var rp=require(_0xbad6('0x6'));var fs=require('fs');var path=require(_0xbad6('0x7'));var rimraf=require(_0xbad6('0x8'));var config=require('../../config/environment');var attributes=require(_0xbad6('0x9'));module['exports']=function(_0x1a603a,_0x4ddc47){return _0x1a603a[_0xbad6('0xa')](_0xbad6('0xb'),attributes,{'tableName':_0xbad6('0xc'),'paranoid':![],'indexes':[{'name':_0xbad6('0xd'),'fields':[_0xbad6('0xe'),_0xbad6('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d5f=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','api'];(function(_0x1ba426,_0xfc02ea){var _0x329bcc=function(_0x4b0f7d){while(--_0x4b0f7d){_0x1ba426['push'](_0x1ba426['shift']());}};_0x329bcc(++_0xfc02ea);}(_0x0d5f,0x138));var _0xf0d5=function(_0x3510c5,_0x5517ee){_0x3510c5=_0x3510c5-0x0;var _0x373f21=_0x0d5f[_0x3510c5];return _0x373f21;};'use strict';var _=require(_0xf0d5('0x0'));var util=require(_0xf0d5('0x1'));var logger=require('../../config/logger')(_0xf0d5('0x2'));var moment=require(_0xf0d5('0x3'));var BPromise=require(_0xf0d5('0x4'));var rp=require(_0xf0d5('0x5'));var fs=require('fs');var path=require(_0xf0d5('0x6'));var rimraf=require('rimraf');var config=require(_0xf0d5('0x7'));var attributes=require(_0xf0d5('0x8'));module[_0xf0d5('0x9')]=function(_0x1e1ac,_0x44deef){return _0x1e1ac[_0xf0d5('0xa')](_0xf0d5('0xb'),attributes,{'tableName':_0xf0d5('0xc'),'paranoid':![],'indexes':[{'name':_0xf0d5('0xd'),'fields':['idField',_0xf0d5('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 9b80d4f..d5848b3 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 _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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7bae,0x13b));var _0xe7ba=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x7bae[_0x3826ad];return _0x17b900;};'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 +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x7217,0x19e));var _0x7721=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x7217[_0x521929];return _0x632436;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('ZohoField,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 318ddd7..c74333a 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 _0x48ac=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x48ac,0x157));var _0xc48a=function(_0x1875f8,_0x29fcfc){_0x1875f8=_0x1875f8-0x0;var _0x1465cf=_0x48ac[_0x1875f8];return _0x1465cf;};'use strict';var multer=require(_0xc48a('0x0'));var util=require(_0xc48a('0x1'));var path=require(_0xc48a('0x2'));var timeout=require(_0xc48a('0x3'));var express=require(_0xc48a('0x4'));var router=express[_0xc48a('0x5')]();var auth=require(_0xc48a('0x6'));var interaction=require(_0xc48a('0x7'));var config=require(_0xc48a('0x8'));module[_0xc48a('0x9')]=router; \ No newline at end of file +var _0x89c9=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path'];(function(_0x1fcd54,_0x52ed54){var _0x5e5fb2=function(_0x3ebe23){while(--_0x3ebe23){_0x1fcd54['push'](_0x1fcd54['shift']());}};_0x5e5fb2(++_0x52ed54);}(_0x89c9,0x1de));var _0x989c=function(_0x49bdc4,_0x1e2507){_0x49bdc4=_0x49bdc4-0x0;var _0x1f7437=_0x89c9[_0x49bdc4];return _0x1f7437;};'use strict';var multer=require(_0x989c('0x0'));var util=require('util');var path=require(_0x989c('0x1'));var timeout=require(_0x989c('0x2'));var express=require(_0x989c('0x3'));var router=express['Router']();var auth=require(_0x989c('0x4'));var interaction=require(_0x989c('0x5'));var config=require(_0x989c('0x6'));module[_0x989c('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 2dda7ed..7fada5d 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 _0xec63=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xec63,0x129));var _0x3ec6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec63[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3ec6('0x0'));module[_0x3ec6('0x1')]={'name':{'type':Sequelize[_0x3ec6('0x2')],'allowNull':![],'unique':_0x3ec6('0x3')},'version':{'type':Sequelize[_0x3ec6('0x2')],'allowNull':![],'unique':_0x3ec6('0x3')},'main':{'type':Sequelize[_0x3ec6('0x2')],'defaultValue':_0x3ec6('0x4')},'filename':{'type':Sequelize[_0x3ec6('0x2')]},'path':{'type':Sequelize[_0x3ec6('0x2')]},'type':{'type':Sequelize[_0x3ec6('0x2')]},'size':{'type':Sequelize[_0x3ec6('0x5')]},'active':{'type':Sequelize[_0x3ec6('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x3ec6('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x3ec6('0x2')],'unique':_0x3ec6('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x3ec6('0x2')]},'remoteUri':{'type':Sequelize[_0x3ec6('0x2')]},'link':{'type':Sequelize[_0x3ec6('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xef5b=['STRING','unique_name_and_version','INTEGER','state','sequelize','exports'];(function(_0x30dfa4,_0x1a6275){var _0x185b37=function(_0x1a8025){while(--_0x1a8025){_0x30dfa4['push'](_0x30dfa4['shift']());}};_0x185b37(++_0x1a6275);}(_0xef5b,0x154));var _0xbef5=function(_0x34bf68,_0x23be3e){_0x34bf68=_0x34bf68-0x0;var _0x8ae855=_0xef5b[_0x34bf68];return _0x8ae855;};'use strict';var Sequelize=require(_0xbef5('0x0'));module[_0xbef5('0x1')]={'name':{'type':Sequelize[_0xbef5('0x2')],'allowNull':![],'unique':_0xbef5('0x3')},'version':{'type':Sequelize[_0xbef5('0x2')],'allowNull':![],'unique':_0xbef5('0x3')},'main':{'type':Sequelize[_0xbef5('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xbef5('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbef5('0x2')]},'size':{'type':Sequelize[_0xbef5('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xbef5('0x2')]},'logo':{'type':Sequelize[_0xbef5('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xbef5('0x5')},'description':{'type':Sequelize[_0xbef5('0x2')]},'title':{'type':Sequelize[_0xbef5('0x2')]},'remoteUri':{'type':Sequelize[_0xbef5('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 9816488..3040cb5 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 _0xead5=['stack','name','send','index','Integration','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end'];(function(_0x4e8288,_0x4ffcb2){var _0xc551f7=function(_0xd402de){while(--_0xd402de){_0x4e8288['push'](_0x4e8288['shift']());}};_0xc551f7(++_0x4ffcb2);}(_0xead5,0xbc));var _0x5ead=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xead5[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require(_0x5ead('0x0'));var emlformat=require(_0x5ead('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5ead('0x2'));var jsonpatch=require(_0x5ead('0x3'));var rp=require(_0x5ead('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5ead('0x5'));var util=require(_0x5ead('0x6'));var path=require(_0x5ead('0x7'));var sox=require(_0x5ead('0x8'));var csv=require('to-csv');var ejs=require(_0x5ead('0x9'));var fs=require('fs');var _=require(_0x5ead('0xa'));var squel=require(_0x5ead('0xb'));var crypto=require(_0x5ead('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5ead('0xd'));var toCsv=require(_0x5ead('0xe'));var querystring=require(_0x5ead('0xf'));var Papa=require('papaparse');var Redis=require(_0x5ead('0x10'));var authService=require(_0x5ead('0x11'));var qs=require(_0x5ead('0x12'));var as=require(_0x5ead('0x13'));var hardwareService=require(_0x5ead('0x14'));var logger=require('../../config/logger')(_0x5ead('0x15'));var utils=require(_0x5ead('0x16'));var config=require(_0x5ead('0x17'));var db=require(_0x5ead('0x18'))['db'];function respondWithStatusCode(_0x443527,_0x16984b){_0x16984b=_0x16984b||0xcc;return function(_0x3c78d0){if(_0x3c78d0){return _0x443527[_0x5ead('0x19')](_0x16984b);}return _0x443527[_0x5ead('0x1a')](_0x16984b)['end']();};}function respondWithResult(_0x1e8118,_0x19ed5b){_0x19ed5b=_0x19ed5b||0xc8;return function(_0x4a2496){if(_0x4a2496){return _0x1e8118['status'](_0x19ed5b)['json'](_0x4a2496);}};}function respondWithFilteredResult(_0x2c39b0,_0x19e5fe){return function(_0x2819f1){if(_0x2819f1){var _0x2867e2=_0x2819f1[_0x5ead('0x1b')],_0x98fe34=_0x19e5fe[_0x5ead('0x1c')],_0x19a5d7=_0x19e5fe[_0x5ead('0x1c')]+_0x19e5fe[_0x5ead('0x1d')],_0xe8e6b0;if(_0x19a5d7>=_0x2867e2){_0x19a5d7=_0x2867e2;_0xe8e6b0=0xc8;}else{_0xe8e6b0=0xce;}_0x2c39b0[_0x5ead('0x1a')](_0xe8e6b0);return _0x2c39b0[_0x5ead('0x1e')](_0x5ead('0x1f'),_0x98fe34+'-'+_0x19a5d7+'/'+_0x2867e2)[_0x5ead('0x20')](_0x2819f1);}return null;};}function patchUpdates(_0x467023){return function(_0x119b3e){try{jsonpatch[_0x5ead('0x21')](_0x119b3e,_0x467023,!![]);}catch(_0x4a2556){return BPromise[_0x5ead('0x22')](_0x4a2556);}return _0x119b3e[_0x5ead('0x23')]();};}function saveUpdates(_0x5d6cd1,_0x1ee8fb){return function(_0x45c3d1){if(_0x45c3d1){return _0x45c3d1[_0x5ead('0x24')](_0x5d6cd1)[_0x5ead('0x25')](function(_0x55eb39){return _0x55eb39;});}return null;};}function removeEntity(_0x39174c,_0x305e22){return function(_0x5bc714){if(_0x5bc714){return _0x5bc714[_0x5ead('0x26')]()[_0x5ead('0x25')](function(){_0x39174c[_0x5ead('0x1a')](0xcc)[_0x5ead('0x27')]();});}};}function handleEntityNotFound(_0x2ab4f9,_0x40c4a1){return function(_0x1a616a){if(!_0x1a616a){_0x2ab4f9['sendStatus'](0x194);}return _0x1a616a;};}function handleError(_0x2e3e55,_0x4ec8a1){_0x4ec8a1=_0x4ec8a1||0x1f4;return function(_0x39aca2){logger['error'](_0x39aca2[_0x5ead('0x28')]);if(_0x39aca2[_0x5ead('0x29')]){delete _0x39aca2[_0x5ead('0x29')];}_0x2e3e55['status'](_0x4ec8a1)[_0x5ead('0x2a')](_0x39aca2);};}exports[_0x5ead('0x2b')]=function(_0x29736b,_0x3ff832){var _0x443ec5={},_0x1f9690={},_0x2a9116={'count':0x0,'rows':[]};var _0x297f5d=_['map'](db[_0x5ead('0x2c')][_0x5ead('0x2d')],function(_0x258792){return{'name':_0x258792[_0x5ead('0x2e')],'type':_0x258792[_0x5ead('0x2f')]['key']};});_0x1f9690['model']=_[_0x5ead('0x30')](_0x297f5d,'name');_0x1f9690[_0x5ead('0x31')]=_[_0x5ead('0x32')](_0x29736b[_0x5ead('0x31')]);_0x1f9690[_0x5ead('0x33')]=_['intersection'](_0x1f9690[_0x5ead('0x34')],_0x1f9690[_0x5ead('0x31')]);_0x443ec5[_0x5ead('0x35')]=_[_0x5ead('0x36')](_0x1f9690['model'],qs[_0x5ead('0x37')](_0x29736b[_0x5ead('0x31')][_0x5ead('0x37')]));_0x443ec5[_0x5ead('0x35')]=_0x443ec5[_0x5ead('0x35')][_0x5ead('0x38')]?_0x443ec5[_0x5ead('0x35')]:_0x1f9690['model'];if(!_0x29736b[_0x5ead('0x31')][_0x5ead('0x39')]('nolimit')){_0x443ec5[_0x5ead('0x1d')]=qs[_0x5ead('0x1d')](_0x29736b[_0x5ead('0x31')][_0x5ead('0x1d')]);_0x443ec5['offset']=qs[_0x5ead('0x1c')](_0x29736b[_0x5ead('0x31')][_0x5ead('0x1c')]);}_0x443ec5[_0x5ead('0x3a')]=qs[_0x5ead('0x3b')](_0x29736b['query'][_0x5ead('0x3b')]);_0x443ec5[_0x5ead('0x3c')]=qs[_0x5ead('0x33')](_[_0x5ead('0x3d')](_0x29736b[_0x5ead('0x31')],_0x1f9690['filters']),_0x297f5d);if(_0x29736b[_0x5ead('0x31')][_0x5ead('0x3e')]){_0x443ec5[_0x5ead('0x3c')]=_['merge'](_0x443ec5[_0x5ead('0x3c')],{'$or':_[_0x5ead('0x30')](_0x297f5d,function(_0x58247){if(_0x58247[_0x5ead('0x2f')]!==_0x5ead('0x3f')){var _0x5b8b6c={};_0x5b8b6c[_0x58247[_0x5ead('0x29')]]={'$like':'%'+_0x29736b['query']['filter']+'%'};return _0x5b8b6c;}})});}_0x443ec5=_[_0x5ead('0x40')]({},_0x443ec5,_0x29736b[_0x5ead('0x41')]);var _0xbbb5f0={'where':_0x443ec5[_0x5ead('0x3c')]};return db[_0x5ead('0x2c')][_0x5ead('0x1b')](_0xbbb5f0)[_0x5ead('0x25')](function(_0x283176){_0x2a9116[_0x5ead('0x1b')]=_0x283176;if(_0x29736b[_0x5ead('0x31')]['includeAll']){_0x443ec5['include']=[{'all':!![]}];}return db[_0x5ead('0x2c')][_0x5ead('0x42')](_0x443ec5);})[_0x5ead('0x25')](function(_0x136766){_0x2a9116[_0x5ead('0x43')]=_0x136766;return _0x2a9116;})[_0x5ead('0x25')](respondWithFilteredResult(_0x3ff832,_0x443ec5))[_0x5ead('0x44')](handleError(_0x3ff832,null));};exports[_0x5ead('0x45')]=function(_0x162a64,_0x52c337){var _0x235687={'raw':![],'where':{'id':_0x162a64[_0x5ead('0x46')]['id']}},_0x34e06d={};_0x34e06d[_0x5ead('0x34')]=_['keys'](db['Integration'][_0x5ead('0x2d')]);_0x34e06d[_0x5ead('0x31')]=_[_0x5ead('0x32')](_0x162a64[_0x5ead('0x31')]);_0x34e06d[_0x5ead('0x33')]=_[_0x5ead('0x36')](_0x34e06d[_0x5ead('0x34')],_0x34e06d[_0x5ead('0x31')]);_0x235687[_0x5ead('0x35')]=_[_0x5ead('0x36')](_0x34e06d[_0x5ead('0x34')],qs[_0x5ead('0x37')](_0x162a64[_0x5ead('0x31')][_0x5ead('0x37')]));_0x235687[_0x5ead('0x35')]=_0x235687[_0x5ead('0x35')][_0x5ead('0x38')]?_0x235687[_0x5ead('0x35')]:_0x34e06d[_0x5ead('0x34')];if(_0x162a64[_0x5ead('0x31')][_0x5ead('0x47')]){_0x235687[_0x5ead('0x48')]=[{'all':!![]}];}_0x235687=_['merge']({},_0x235687,_0x162a64[_0x5ead('0x41')]);return db['Integration'][_0x5ead('0x49')](_0x235687)[_0x5ead('0x25')](handleEntityNotFound(_0x52c337,null))['then'](respondWithResult(_0x52c337,null))[_0x5ead('0x44')](handleError(_0x52c337,null));};exports[_0x5ead('0x4a')]=function(_0x19dbce,_0x43a8c2){return db[_0x5ead('0x2c')][_0x5ead('0x4a')](_0x19dbce[_0x5ead('0x4b')],{})['then'](respondWithResult(_0x43a8c2,0xc9))[_0x5ead('0x44')](handleError(_0x43a8c2,null));};exports[_0x5ead('0x24')]=function(_0x322fdc,_0x2bd7ee){if(_0x322fdc['body']['id']){delete _0x322fdc[_0x5ead('0x4b')]['id'];}return db[_0x5ead('0x2c')][_0x5ead('0x49')]({'where':{'id':_0x322fdc[_0x5ead('0x46')]['id']}})[_0x5ead('0x25')](handleEntityNotFound(_0x2bd7ee,null))[_0x5ead('0x25')](saveUpdates(_0x322fdc[_0x5ead('0x4b')],null))[_0x5ead('0x25')](respondWithResult(_0x2bd7ee,null))[_0x5ead('0x44')](handleError(_0x2bd7ee,null));};exports[_0x5ead('0x26')]=function(_0x326372,_0x2cad2a){return db['Integration']['find']({'where':{'id':_0x326372[_0x5ead('0x46')]['id']}})['then'](handleEntityNotFound(_0x2cad2a,null))[_0x5ead('0x25')](removeEntity(_0x2cad2a,null))[_0x5ead('0x44')](handleError(_0x2cad2a,null));}; \ No newline at end of file +var _0xb692=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','Integration','includeAll','findAll','catch','show','params','include','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0xf08c14,_0x3fffc1){var _0x5cfc14=function(_0x214ec9){while(--_0x214ec9){_0xf08c14['push'](_0xf08c14['shift']());}};_0x5cfc14(++_0x3fffc1);}(_0xb692,0x1ea));var _0x2b69=function(_0x20e5e2,_0x57c3b1){_0x20e5e2=_0x20e5e2-0x0;var _0x803951=_0xb692[_0x20e5e2];return _0x803951;};'use strict';var pdf=require(_0x2b69('0x0'));var emlformat=require(_0x2b69('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2b69('0x2'));var jsonpatch=require(_0x2b69('0x3'));var rp=require(_0x2b69('0x4'));var moment=require('moment');var BPromise=require(_0x2b69('0x5'));var Mustache=require(_0x2b69('0x6'));var util=require(_0x2b69('0x7'));var path=require(_0x2b69('0x8'));var sox=require(_0x2b69('0x9'));var csv=require(_0x2b69('0xa'));var ejs=require(_0x2b69('0xb'));var fs=require('fs');var _=require(_0x2b69('0xc'));var squel=require('squel');var crypto=require(_0x2b69('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2b69('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2b69('0xf'));var Papa=require(_0x2b69('0x10'));var Redis=require('ioredis');var authService=require(_0x2b69('0x11'));var qs=require(_0x2b69('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b69('0x13'));var logger=require(_0x2b69('0x14'))('api');var utils=require(_0x2b69('0x15'));var config=require(_0x2b69('0x16'));var db=require(_0x2b69('0x17'))['db'];function respondWithStatusCode(_0x1548eb,_0x35aebe){_0x35aebe=_0x35aebe||0xcc;return function(_0x237fb6){if(_0x237fb6){return _0x1548eb[_0x2b69('0x18')](_0x35aebe);}return _0x1548eb[_0x2b69('0x19')](_0x35aebe)[_0x2b69('0x1a')]();};}function respondWithResult(_0x216ca8,_0x2c3b67){_0x2c3b67=_0x2c3b67||0xc8;return function(_0x311655){if(_0x311655){return _0x216ca8['status'](_0x2c3b67)[_0x2b69('0x1b')](_0x311655);}};}function respondWithFilteredResult(_0x20512b,_0x17be53){return function(_0xfb4c56){if(_0xfb4c56){var _0x336ebf=_0xfb4c56[_0x2b69('0x1c')],_0x15bbfb=_0x17be53[_0x2b69('0x1d')],_0x2f807a=_0x17be53['offset']+_0x17be53['limit'],_0x24413c;if(_0x2f807a>=_0x336ebf){_0x2f807a=_0x336ebf;_0x24413c=0xc8;}else{_0x24413c=0xce;}_0x20512b[_0x2b69('0x19')](_0x24413c);return _0x20512b[_0x2b69('0x1e')]('Content-Range',_0x15bbfb+'-'+_0x2f807a+'/'+_0x336ebf)[_0x2b69('0x1b')](_0xfb4c56);}return null;};}function patchUpdates(_0x2951da){return function(_0x206d2f){try{jsonpatch[_0x2b69('0x1f')](_0x206d2f,_0x2951da,!![]);}catch(_0x3f02a1){return BPromise[_0x2b69('0x20')](_0x3f02a1);}return _0x206d2f['save']();};}function saveUpdates(_0x340893,_0x57ea08){return function(_0x2e8293){if(_0x2e8293){return _0x2e8293[_0x2b69('0x21')](_0x340893)[_0x2b69('0x22')](function(_0x14c859){return _0x14c859;});}return null;};}function removeEntity(_0x3542f6,_0x56b1f9){return function(_0x4aa819){if(_0x4aa819){return _0x4aa819[_0x2b69('0x23')]()[_0x2b69('0x22')](function(){_0x3542f6[_0x2b69('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x160e26,_0x322b0d){return function(_0x438c90){if(!_0x438c90){_0x160e26['sendStatus'](0x194);}return _0x438c90;};}function handleError(_0xdaaa66,_0x350dc3){_0x350dc3=_0x350dc3||0x1f4;return function(_0x37f209){logger['error'](_0x37f209[_0x2b69('0x24')]);if(_0x37f209[_0x2b69('0x25')]){delete _0x37f209[_0x2b69('0x25')];}_0xdaaa66[_0x2b69('0x19')](_0x350dc3)[_0x2b69('0x26')](_0x37f209);};}exports[_0x2b69('0x27')]=function(_0x495269,_0x510cb2){var _0x4b5734={},_0x1e93eb={},_0x48cdb8={'count':0x0,'rows':[]};var _0x808126=_[_0x2b69('0x28')](db['Integration'][_0x2b69('0x29')],function(_0x283b52){return{'name':_0x283b52[_0x2b69('0x2a')],'type':_0x283b52[_0x2b69('0x2b')][_0x2b69('0x2c')]};});_0x1e93eb[_0x2b69('0x2d')]=_['map'](_0x808126,_0x2b69('0x25'));_0x1e93eb[_0x2b69('0x2e')]=_[_0x2b69('0x2f')](_0x495269[_0x2b69('0x2e')]);_0x1e93eb[_0x2b69('0x30')]=_['intersection'](_0x1e93eb[_0x2b69('0x2d')],_0x1e93eb[_0x2b69('0x2e')]);_0x4b5734[_0x2b69('0x31')]=_[_0x2b69('0x32')](_0x1e93eb[_0x2b69('0x2d')],qs[_0x2b69('0x33')](_0x495269[_0x2b69('0x2e')][_0x2b69('0x33')]));_0x4b5734['attributes']=_0x4b5734[_0x2b69('0x31')][_0x2b69('0x34')]?_0x4b5734[_0x2b69('0x31')]:_0x1e93eb['model'];if(!_0x495269[_0x2b69('0x2e')][_0x2b69('0x35')](_0x2b69('0x36'))){_0x4b5734['limit']=qs[_0x2b69('0x37')](_0x495269[_0x2b69('0x2e')][_0x2b69('0x37')]);_0x4b5734[_0x2b69('0x1d')]=qs[_0x2b69('0x1d')](_0x495269[_0x2b69('0x2e')][_0x2b69('0x1d')]);}_0x4b5734['order']=qs[_0x2b69('0x38')](_0x495269[_0x2b69('0x2e')]['sort']);_0x4b5734['where']=qs[_0x2b69('0x30')](_[_0x2b69('0x39')](_0x495269['query'],_0x1e93eb[_0x2b69('0x30')]),_0x808126);if(_0x495269[_0x2b69('0x2e')]['filter']){_0x4b5734[_0x2b69('0x3a')]=_[_0x2b69('0x3b')](_0x4b5734[_0x2b69('0x3a')],{'$or':_[_0x2b69('0x28')](_0x808126,function(_0x2c98a2){if(_0x2c98a2[_0x2b69('0x2b')]!==_0x2b69('0x3c')){var _0x4e97ef={};_0x4e97ef[_0x2c98a2[_0x2b69('0x25')]]={'$like':'%'+_0x495269[_0x2b69('0x2e')][_0x2b69('0x3d')]+'%'};return _0x4e97ef;}})});}_0x4b5734=_[_0x2b69('0x3b')]({},_0x4b5734,_0x495269[_0x2b69('0x3e')]);var _0x825c05={'where':_0x4b5734[_0x2b69('0x3a')]};return db[_0x2b69('0x3f')][_0x2b69('0x1c')](_0x825c05)[_0x2b69('0x22')](function(_0x585027){_0x48cdb8[_0x2b69('0x1c')]=_0x585027;if(_0x495269[_0x2b69('0x2e')][_0x2b69('0x40')]){_0x4b5734['include']=[{'all':!![]}];}return db['Integration'][_0x2b69('0x41')](_0x4b5734);})['then'](function(_0x3fa996){_0x48cdb8['rows']=_0x3fa996;return _0x48cdb8;})[_0x2b69('0x22')](respondWithFilteredResult(_0x510cb2,_0x4b5734))[_0x2b69('0x42')](handleError(_0x510cb2,null));};exports[_0x2b69('0x43')]=function(_0x10f23a,_0x55f0cb){var _0x46c543={'raw':![],'where':{'id':_0x10f23a[_0x2b69('0x44')]['id']}},_0x203393={};_0x203393[_0x2b69('0x2d')]=_[_0x2b69('0x2f')](db[_0x2b69('0x3f')][_0x2b69('0x29')]);_0x203393['query']=_[_0x2b69('0x2f')](_0x10f23a['query']);_0x203393[_0x2b69('0x30')]=_['intersection'](_0x203393['model'],_0x203393[_0x2b69('0x2e')]);_0x46c543[_0x2b69('0x31')]=_[_0x2b69('0x32')](_0x203393[_0x2b69('0x2d')],qs['fields'](_0x10f23a['query']['fields']));_0x46c543[_0x2b69('0x31')]=_0x46c543['attributes']['length']?_0x46c543[_0x2b69('0x31')]:_0x203393[_0x2b69('0x2d')];if(_0x10f23a['query'][_0x2b69('0x40')]){_0x46c543[_0x2b69('0x45')]=[{'all':!![]}];}_0x46c543=_[_0x2b69('0x3b')]({},_0x46c543,_0x10f23a['options']);return db[_0x2b69('0x3f')]['find'](_0x46c543)[_0x2b69('0x22')](handleEntityNotFound(_0x55f0cb,null))['then'](respondWithResult(_0x55f0cb,null))['catch'](handleError(_0x55f0cb,null));};exports[_0x2b69('0x46')]=function(_0x494413,_0x4cbcab){return db[_0x2b69('0x3f')][_0x2b69('0x46')](_0x494413['body'],{})[_0x2b69('0x22')](respondWithResult(_0x4cbcab,0xc9))[_0x2b69('0x42')](handleError(_0x4cbcab,null));};exports['update']=function(_0x5e31cf,_0x461465){if(_0x5e31cf[_0x2b69('0x47')]['id']){delete _0x5e31cf[_0x2b69('0x47')]['id'];}return db['Integration'][_0x2b69('0x48')]({'where':{'id':_0x5e31cf[_0x2b69('0x44')]['id']}})[_0x2b69('0x22')](handleEntityNotFound(_0x461465,null))['then'](saveUpdates(_0x5e31cf[_0x2b69('0x47')],null))['then'](respondWithResult(_0x461465,null))['catch'](handleError(_0x461465,null));};exports[_0x2b69('0x23')]=function(_0x2c46fa,_0x33efb3){return db[_0x2b69('0x3f')]['find']({'where':{'id':_0x2c46fa[_0x2b69('0x44')]['id']}})[_0x2b69('0x22')](handleEntityNotFound(_0x33efb3,null))[_0x2b69('0x22')](removeEntity(_0x33efb3,null))[_0x2b69('0x42')](handleError(_0x33efb3,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 5a91ba6..df72b1d 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 _0x30ba=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash'];(function(_0x524d60,_0x36663c){var _0x2caaf3=function(_0x237d5d){while(--_0x237d5d){_0x524d60['push'](_0x524d60['shift']());}};_0x2caaf3(++_0x36663c);}(_0x30ba,0x18b));var _0xa30b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x30ba[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xa30b('0x0'));var util=require(_0xa30b('0x1'));var logger=require('../../config/logger')(_0xa30b('0x2'));var moment=require('moment');var BPromise=require(_0xa30b('0x3'));var rp=require(_0xa30b('0x4'));var fs=require('fs');var path=require(_0xa30b('0x5'));var rimraf=require(_0xa30b('0x6'));var config=require(_0xa30b('0x7'));var attributes=require(_0xa30b('0x8'));module[_0xa30b('0x9')]=function(_0x1d5ab3,_0x55934c){return _0x1d5ab3['define'](_0xa30b('0xa'),attributes,{'tableName':_0xa30b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc81b=['integrations','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0xc81b,0xc9));var _0xbc81=function(_0x589bab,_0x46a0bf){_0x589bab=_0x589bab-0x0;var _0x50c677=_0xc81b[_0x589bab];return _0x50c677;};'use strict';var _=require('lodash');var util=require(_0xbc81('0x0'));var logger=require(_0xbc81('0x1'))(_0xbc81('0x2'));var moment=require(_0xbc81('0x3'));var BPromise=require(_0xbc81('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc81('0x5'));var config=require(_0xbc81('0x6'));var attributes=require('./integration.attributes');module[_0xbc81('0x7')]=function(_0xe21b5a,_0x4593de){return _0xe21b5a[_0xbc81('0x8')]('Integration',attributes,{'tableName':_0xbc81('0x9'),'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 85f217e..9b97a2d 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 _0x482d=['request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x49a276,_0x2c73d6){var _0x33dbb9=function(_0x4c0130){while(--_0x4c0130){_0x49a276['push'](_0x49a276['shift']());}};_0x33dbb9(++_0x2c73d6);}(_0x482d,0x16c));var _0xd482=function(_0x19a6b7,_0x488c30){_0x19a6b7=_0x19a6b7-0x0;var _0x42a703=_0x482d[_0x19a6b7];return _0x42a703;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd482('0x0'));var BPromise=require(_0xd482('0x1'));var rs=require(_0xd482('0x2'));var fs=require('fs');var Redis=require(_0xd482('0x3'));var db=require(_0xd482('0x4'))['db'];var utils=require(_0xd482('0x5'));var logger=require('../../config/logger')(_0xd482('0x6'));var config=require(_0xd482('0x7'));var jayson=require(_0xd482('0x8'));var client=jayson['client'][_0xd482('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d6b47,_0x5bfc0f,_0x478af5){return new BPromise(function(_0x144d7d,_0x74f369){return client[_0xd482('0xa')](_0x5d6b47,_0x478af5)['then'](function(_0x144d5b){logger[_0xd482('0xb')](_0xd482('0xc'),_0x5bfc0f,_0xd482('0xd'));logger[_0xd482('0xe')](_0xd482('0xf'),_0x5bfc0f,_0xd482('0xd'),JSON[_0xd482('0x10')](_0x144d5b));if(_0x144d5b['error']){if(_0x144d5b[_0xd482('0x11')][_0xd482('0x12')]===0x1f4){logger[_0xd482('0x11')](_0xd482('0xc'),_0x5bfc0f,_0x144d5b['error'][_0xd482('0x13')]);return _0x74f369(_0x144d5b[_0xd482('0x11')][_0xd482('0x13')]);}logger['error'](_0xd482('0xc'),_0x5bfc0f,_0x144d5b['error']['message']);return _0x144d7d(_0x144d5b[_0xd482('0x11')]['message']);}else{logger[_0xd482('0xb')](_0xd482('0xc'),_0x5bfc0f,'request\x20sent');_0x144d7d(_0x144d5b[_0xd482('0x14')][_0xd482('0x13')]);}})[_0xd482('0x15')](function(_0x2cc6e1){logger[_0xd482('0x11')]('Integration,\x20%s,\x20%s',_0x5bfc0f,_0x2cc6e1);_0x74f369(_0x2cc6e1);});});} \ No newline at end of file +var _0xec82=['jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x252f2a,_0x550648){var _0x3ff9f2=function(_0x4c2c48){while(--_0x4c2c48){_0x252f2a['push'](_0x252f2a['shift']());}};_0x3ff9f2(++_0x550648);}(_0xec82,0x184));var _0x2ec8=function(_0xdb77b9,_0x472ad7){_0xdb77b9=_0xdb77b9-0x0;var _0x4ea885=_0xec82[_0xdb77b9];return _0x4ea885;};'use strict';var _=require(_0x2ec8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ec8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ec8('0x2'));var db=require(_0x2ec8('0x3'))['db'];var utils=require(_0x2ec8('0x4'));var logger=require(_0x2ec8('0x5'))(_0x2ec8('0x6'));var config=require(_0x2ec8('0x7'));var jayson=require(_0x2ec8('0x8'));var client=jayson[_0x2ec8('0x9')][_0x2ec8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38a971,_0x34be0a,_0x10bd09){return new BPromise(function(_0x180c63,_0x57dd82){return client[_0x2ec8('0xb')](_0x38a971,_0x10bd09)[_0x2ec8('0xc')](function(_0x24b423){logger[_0x2ec8('0xd')](_0x2ec8('0xe'),_0x34be0a,_0x2ec8('0xf'));logger[_0x2ec8('0x10')](_0x2ec8('0x11'),_0x34be0a,'request\x20sent',JSON['stringify'](_0x24b423));if(_0x24b423[_0x2ec8('0x12')]){if(_0x24b423[_0x2ec8('0x12')][_0x2ec8('0x13')]===0x1f4){logger[_0x2ec8('0x12')]('Integration,\x20%s,\x20%s',_0x34be0a,_0x24b423[_0x2ec8('0x12')][_0x2ec8('0x14')]);return _0x57dd82(_0x24b423['error'][_0x2ec8('0x14')]);}logger['error'](_0x2ec8('0xe'),_0x34be0a,_0x24b423[_0x2ec8('0x12')]['message']);return _0x180c63(_0x24b423['error']['message']);}else{logger[_0x2ec8('0xd')](_0x2ec8('0xe'),_0x34be0a,_0x2ec8('0xf'));_0x180c63(_0x24b423[_0x2ec8('0x15')][_0x2ec8('0x14')]);}})['catch'](function(_0x2ccabd){logger[_0x2ec8('0x12')](_0x2ec8('0xe'),_0x34be0a,_0x2ccabd);_0x57dd82(_0x2ccabd);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 52328dc..9e73b0f 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 _0x0a2c=['get','/describe','describe','/:id','show','post','isAuthenticated','create','put','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./integrationReport.controller'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0a2c,0x1df));var _0xc0a2=function(_0x7acf4f,_0x3e7f15){_0x7acf4f=_0x7acf4f-0x0;var _0x2c911c=_0x0a2c[_0x7acf4f];return _0x2c911c;};'use strict';var multer=require(_0xc0a2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc0a2('0x1'));var express=require(_0xc0a2('0x2'));var router=express[_0xc0a2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc0a2('0x4'));var config=require(_0xc0a2('0x5'));var controller=require(_0xc0a2('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc0a2('0x7')](_0xc0a2('0x8'),auth['isAuthenticated'](),controller[_0xc0a2('0x9')]);router[_0xc0a2('0x7')](_0xc0a2('0xa'),auth['isAuthenticated'](),controller[_0xc0a2('0xb')]);router[_0xc0a2('0xc')]('/',auth[_0xc0a2('0xd')](),controller[_0xc0a2('0xe')]);router[_0xc0a2('0xf')](_0xc0a2('0xa'),auth[_0xc0a2('0xd')](),controller['update']);router['delete'](_0xc0a2('0xa'),auth[_0xc0a2('0xd')](),controller[_0xc0a2('0x10')]);module[_0xc0a2('0x11')]=router; \ No newline at end of file +var _0x8d7b=['isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./integrationReport.controller','get'];(function(_0x4c7d23,_0x1eed42){var _0x4bd04c=function(_0x3409cf){while(--_0x3409cf){_0x4c7d23['push'](_0x4c7d23['shift']());}};_0x4bd04c(++_0x1eed42);}(_0x8d7b,0x70));var _0xb8d7=function(_0x4ef343,_0x124611){_0x4ef343=_0x4ef343-0x0;var _0x14f697=_0x8d7b[_0x4ef343];return _0x14f697;};'use strict';var multer=require(_0xb8d7('0x0'));var util=require(_0xb8d7('0x1'));var path=require(_0xb8d7('0x2'));var timeout=require(_0xb8d7('0x3'));var express=require('express');var router=express[_0xb8d7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb8d7('0x5'));var config=require('../../config/environment');var controller=require(_0xb8d7('0x6'));router[_0xb8d7('0x7')]('/',auth[_0xb8d7('0x8')](),controller[_0xb8d7('0x9')]);router[_0xb8d7('0x7')]('/describe',auth[_0xb8d7('0x8')](),controller[_0xb8d7('0xa')]);router[_0xb8d7('0x7')](_0xb8d7('0xb'),auth[_0xb8d7('0x8')](),controller[_0xb8d7('0xc')]);router[_0xb8d7('0xd')]('/',auth[_0xb8d7('0x8')](),controller[_0xb8d7('0xe')]);router[_0xb8d7('0xf')](_0xb8d7('0xb'),auth[_0xb8d7('0x8')](),controller[_0xb8d7('0x10')]);router[_0xb8d7('0x11')](_0xb8d7('0xb'),auth[_0xb8d7('0x8')](),controller[_0xb8d7('0x12')]);module[_0xb8d7('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 53d5c4d..ecdb5bd 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 _0xccc8=['DATE','BOOLEAN','TEXT','ENUM','SENDING','FAILED','sequelize','exports','STRING','INTEGER'];(function(_0x1c14be,_0xf01911){var _0x4db556=function(_0xd755c9){while(--_0xd755c9){_0x1c14be['push'](_0x1c14be['shift']());}};_0x4db556(++_0xf01911);}(_0xccc8,0x178));var _0x8ccc=function(_0x3f940e,_0x140c3b){_0x3f940e=_0x3f940e-0x0;var _0x424b2e=_0xccc8[_0x3f940e];return _0x424b2e;};'use strict';var Sequelize=require(_0x8ccc('0x0'));module[_0x8ccc('0x1')]={'integration':{'type':Sequelize[_0x8ccc('0x2')]},'eventChannel':{'type':Sequelize[_0x8ccc('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x8ccc('0x2')]},'integrationId':{'type':Sequelize[_0x8ccc('0x3')]},'contacts':{'type':Sequelize[_0x8ccc('0x2')]},'uniqueid':{'type':Sequelize[_0x8ccc('0x2')]},'calleridnum':{'type':Sequelize[_0x8ccc('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8ccc('0x2')]},'interface':{'type':Sequelize[_0x8ccc('0x2')]},'membername':{'type':Sequelize[_0x8ccc('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8ccc('0x4')]},'agentconnectAt':{'type':Sequelize[_0x8ccc('0x4')]},'holdtime':{'type':Sequelize[_0x8ccc('0x3')]},'agentcomplete':{'type':Sequelize[_0x8ccc('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x8ccc('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x8ccc('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x8ccc('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8ccc('0x4')]},'agentdump':{'type':Sequelize[_0x8ccc('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8ccc('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8ccc('0x2')]},'channelstate':{'type':Sequelize[_0x8ccc('0x3')]},'channelstatedesc':{'type':Sequelize[_0x8ccc('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8ccc('0x2')]},'connectedlinename':{'type':Sequelize[_0x8ccc('0x2')]},'language':{'type':Sequelize[_0x8ccc('0x2')]},'accountcode':{'type':Sequelize[_0x8ccc('0x2')]},'context':{'type':Sequelize[_0x8ccc('0x2')]},'exten':{'type':Sequelize[_0x8ccc('0x2')]},'priority':{'type':Sequelize[_0x8ccc('0x2')]},'destchannel':{'type':Sequelize[_0x8ccc('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x8ccc('0x2')]},'destcalleridname':{'type':Sequelize[_0x8ccc('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x8ccc('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8ccc('0x2')]},'destcontext':{'type':Sequelize[_0x8ccc('0x2')]},'destexten':{'type':Sequelize[_0x8ccc('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x8ccc('0x2')]},'inReplyTo':{'type':Sequelize[_0x8ccc('0x2')]},'subject':{'type':Sequelize[_0x8ccc('0x2')]},'from':{'type':Sequelize[_0x8ccc('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8ccc('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x8ccc('0x6')]},'text':{'type':Sequelize[_0x8ccc('0x6')]},'status':{'type':Sequelize[_0x8ccc('0x7')]('SENT',_0x8ccc('0x8'),'RECEIVED',_0x8ccc('0x9'))},'url':{'type':Sequelize[_0x8ccc('0x2')]},'app':{'type':Sequelize[_0x8ccc('0x2')]},'appdata':{'type':Sequelize[_0x8ccc('0x2')]},'projectId':{'type':Sequelize[_0x8ccc('0x3')]}}; \ No newline at end of file +var _0x98d6=['BOOLEAN','TEXT','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x98d6,0xb9));var _0x698d=function(_0x139b3b,_0x593058){_0x139b3b=_0x139b3b-0x0;var _0x55cc2a=_0x98d6[_0x139b3b];return _0x55cc2a;};'use strict';var Sequelize=require(_0x698d('0x0'));module[_0x698d('0x1')]={'integration':{'type':Sequelize[_0x698d('0x2')]},'eventChannel':{'type':Sequelize[_0x698d('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x698d('0x2')]},'integrationId':{'type':Sequelize[_0x698d('0x3')]},'contacts':{'type':Sequelize[_0x698d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x698d('0x2')]},'calleridname':{'type':Sequelize[_0x698d('0x2')]},'queue':{'type':Sequelize[_0x698d('0x2')]},'interface':{'type':Sequelize[_0x698d('0x2')]},'membername':{'type':Sequelize[_0x698d('0x2')]},'agentcalledAt':{'type':Sequelize[_0x698d('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x698d('0x3')]},'agentcomplete':{'type':Sequelize[_0x698d('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x698d('0x4')]},'talktime':{'type':Sequelize[_0x698d('0x3')]},'agentacw':{'type':Sequelize[_0x698d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x698d('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x698d('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x698d('0x4')]},'agentdump':{'type':Sequelize[_0x698d('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x698d('0x4')]},'lastevent':{'type':Sequelize[_0x698d('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x698d('0x3')]},'channelstatedesc':{'type':Sequelize[_0x698d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x698d('0x2')]},'connectedlinename':{'type':Sequelize[_0x698d('0x2')]},'language':{'type':Sequelize[_0x698d('0x2')]},'accountcode':{'type':Sequelize[_0x698d('0x2')]},'context':{'type':Sequelize[_0x698d('0x2')]},'exten':{'type':Sequelize[_0x698d('0x2')]},'priority':{'type':Sequelize[_0x698d('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x698d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x698d('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x698d('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x698d('0x2')]},'destaccountcode':{'type':Sequelize[_0x698d('0x2')]},'destcontext':{'type':Sequelize[_0x698d('0x2')]},'destexten':{'type':Sequelize[_0x698d('0x2')]},'destpriority':{'type':Sequelize[_0x698d('0x2')]},'destuniqueid':{'type':Sequelize[_0x698d('0x2')]},'messageId':{'type':Sequelize[_0x698d('0x2')]},'inReplyTo':{'type':Sequelize[_0x698d('0x2')]},'subject':{'type':Sequelize[_0x698d('0x2')]},'from':{'type':Sequelize[_0x698d('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x698d('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x698d('0x6')]},'status':{'type':Sequelize['ENUM'](_0x698d('0x7'),'SENDING',_0x698d('0x8'),_0x698d('0x9'))},'url':{'type':Sequelize[_0x698d('0x2')]},'app':{'type':Sequelize[_0x698d('0x2')]},'appdata':{'type':Sequelize[_0x698d('0x2')]},'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 e6492dd..bda13af 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 _0x7b88=['hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','end','error','stack','name','send','index','map','IntegrationReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length'];(function(_0x2b4c94,_0x1bff38){var _0x4efce6=function(_0x525a43){while(--_0x525a43){_0x2b4c94['push'](_0x2b4c94['shift']());}};_0x4efce6(++_0x1bff38);}(_0x7b88,0x194));var _0x87b8=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x7b88[_0xaa1b3e];return _0x454d7d;};'use strict';var pdf=require(_0x87b8('0x0'));var emlformat=require(_0x87b8('0x1'));var rimraf=require(_0x87b8('0x2'));var zipdir=require(_0x87b8('0x3'));var jsonpatch=require(_0x87b8('0x4'));var rp=require(_0x87b8('0x5'));var moment=require('moment');var BPromise=require(_0x87b8('0x6'));var Mustache=require('mustache');var util=require(_0x87b8('0x7'));var path=require(_0x87b8('0x8'));var sox=require(_0x87b8('0x9'));var csv=require(_0x87b8('0xa'));var ejs=require(_0x87b8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x87b8('0xc'));var crypto=require(_0x87b8('0xd'));var jsforce=require(_0x87b8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x87b8('0xa'));var querystring=require(_0x87b8('0xf'));var Papa=require('papaparse');var Redis=require(_0x87b8('0x10'));var authService=require(_0x87b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x87b8('0x12'));var hardwareService=require(_0x87b8('0x13'));var logger=require(_0x87b8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x87b8('0x15'));var db=require(_0x87b8('0x16'))['db'];function respondWithStatusCode(_0x21c1eb,_0x5947ea){_0x5947ea=_0x5947ea||0xcc;return function(_0x55d2eb){if(_0x55d2eb){return _0x21c1eb[_0x87b8('0x17')](_0x5947ea);}return _0x21c1eb[_0x87b8('0x18')](_0x5947ea)['end']();};}function respondWithResult(_0x197201,_0x4fe9fb){_0x4fe9fb=_0x4fe9fb||0xc8;return function(_0x3b943f){if(_0x3b943f){return _0x197201['status'](_0x4fe9fb)[_0x87b8('0x19')](_0x3b943f);}};}function respondWithFilteredResult(_0x16409f,_0x25a327){return function(_0x13032f){if(_0x13032f){var _0x2b703f=_0x13032f[_0x87b8('0x1a')],_0x5e9de4=_0x25a327['offset'],_0x380410=_0x25a327[_0x87b8('0x1b')]+_0x25a327['limit'],_0x3ee2a3;if(_0x380410>=_0x2b703f){_0x380410=_0x2b703f;_0x3ee2a3=0xc8;}else{_0x3ee2a3=0xce;}_0x16409f[_0x87b8('0x18')](_0x3ee2a3);return _0x16409f[_0x87b8('0x1c')]('Content-Range',_0x5e9de4+'-'+_0x380410+'/'+_0x2b703f)[_0x87b8('0x19')](_0x13032f);}return null;};}function patchUpdates(_0x5dbbf8){return function(_0x2d384e){try{jsonpatch[_0x87b8('0x1d')](_0x2d384e,_0x5dbbf8,!![]);}catch(_0x4ae199){return BPromise[_0x87b8('0x1e')](_0x4ae199);}return _0x2d384e[_0x87b8('0x1f')]();};}function saveUpdates(_0x3d054e,_0x5ce28e){return function(_0x34ad0b){if(_0x34ad0b){return _0x34ad0b[_0x87b8('0x20')](_0x3d054e)[_0x87b8('0x21')](function(_0x2e3b00){return _0x2e3b00;});}return null;};}function removeEntity(_0xf3f21,_0x20d8af){return function(_0x368230){if(_0x368230){return _0x368230['destroy']()[_0x87b8('0x21')](function(){_0xf3f21['status'](0xcc)[_0x87b8('0x22')]();});}};}function handleEntityNotFound(_0x596bb0,_0x2e7911){return function(_0x2a1443){if(!_0x2a1443){_0x596bb0['sendStatus'](0x194);}return _0x2a1443;};}function handleError(_0x425267,_0x43e63f){_0x43e63f=_0x43e63f||0x1f4;return function(_0x3840b0){logger[_0x87b8('0x23')](_0x3840b0[_0x87b8('0x24')]);if(_0x3840b0['name']){delete _0x3840b0[_0x87b8('0x25')];}_0x425267['status'](_0x43e63f)[_0x87b8('0x26')](_0x3840b0);};}exports[_0x87b8('0x27')]=function(_0x549135,_0x368594){var _0x3f80e5={},_0x1d071f={},_0x162941={'count':0x0,'rows':[]};var _0x431f52=_[_0x87b8('0x28')](db[_0x87b8('0x29')][_0x87b8('0x2a')],function(_0x3ff5e3){return{'name':_0x3ff5e3['fieldName'],'type':_0x3ff5e3[_0x87b8('0x2b')][_0x87b8('0x2c')]};});_0x1d071f[_0x87b8('0x2d')]=_[_0x87b8('0x28')](_0x431f52,_0x87b8('0x25'));_0x1d071f[_0x87b8('0x2e')]=_[_0x87b8('0x2f')](_0x549135['query']);_0x1d071f['filters']=_[_0x87b8('0x30')](_0x1d071f['model'],_0x1d071f[_0x87b8('0x2e')]);_0x3f80e5['attributes']=_[_0x87b8('0x30')](_0x1d071f[_0x87b8('0x2d')],qs[_0x87b8('0x31')](_0x549135[_0x87b8('0x2e')]['fields']));_0x3f80e5[_0x87b8('0x32')]=_0x3f80e5[_0x87b8('0x32')][_0x87b8('0x33')]?_0x3f80e5[_0x87b8('0x32')]:_0x1d071f['model'];if(!_0x549135['query'][_0x87b8('0x34')](_0x87b8('0x35'))){_0x3f80e5[_0x87b8('0x36')]=qs[_0x87b8('0x36')](_0x549135[_0x87b8('0x2e')][_0x87b8('0x36')]);_0x3f80e5['offset']=qs[_0x87b8('0x1b')](_0x549135[_0x87b8('0x2e')][_0x87b8('0x1b')]);}_0x3f80e5[_0x87b8('0x37')]=qs['sort'](_0x549135[_0x87b8('0x2e')][_0x87b8('0x38')]);_0x3f80e5[_0x87b8('0x39')]=qs[_0x87b8('0x3a')](_[_0x87b8('0x3b')](_0x549135['query'],_0x1d071f[_0x87b8('0x3a')]),_0x431f52);if(_0x549135['query'][_0x87b8('0x3c')]){_0x3f80e5['where']=_[_0x87b8('0x3d')](_0x3f80e5['where'],{'$or':_[_0x87b8('0x28')](_0x431f52,function(_0x3ee7b5){if(_0x3ee7b5[_0x87b8('0x2b')]!==_0x87b8('0x3e')){var _0x22d034={};_0x22d034[_0x3ee7b5[_0x87b8('0x25')]]={'$like':'%'+_0x549135['query']['filter']+'%'};return _0x22d034;}})});}_0x3f80e5=_[_0x87b8('0x3d')]({},_0x3f80e5,_0x549135['options']);var _0x2003f1={'where':_0x3f80e5[_0x87b8('0x39')]};return db[_0x87b8('0x29')][_0x87b8('0x1a')](_0x2003f1)[_0x87b8('0x21')](function(_0x27b5ed){_0x162941[_0x87b8('0x1a')]=_0x27b5ed;if(_0x549135[_0x87b8('0x2e')][_0x87b8('0x3f')]){_0x3f80e5['include']=[{'all':!![]}];}return db[_0x87b8('0x29')][_0x87b8('0x40')](_0x3f80e5);})[_0x87b8('0x21')](function(_0x4d2221){_0x162941[_0x87b8('0x41')]=_0x4d2221;return _0x162941;})[_0x87b8('0x21')](respondWithFilteredResult(_0x368594,_0x3f80e5))[_0x87b8('0x42')](handleError(_0x368594,null));};exports[_0x87b8('0x43')]=function(_0x3ac372,_0x276308){var _0x28feb0={'raw':![],'where':{'id':_0x3ac372[_0x87b8('0x44')]['id']}},_0x3ecf8f={};_0x3ecf8f[_0x87b8('0x2d')]=_[_0x87b8('0x2f')](db[_0x87b8('0x29')][_0x87b8('0x2a')]);_0x3ecf8f[_0x87b8('0x2e')]=_[_0x87b8('0x2f')](_0x3ac372[_0x87b8('0x2e')]);_0x3ecf8f[_0x87b8('0x3a')]=_[_0x87b8('0x30')](_0x3ecf8f[_0x87b8('0x2d')],_0x3ecf8f[_0x87b8('0x2e')]);_0x28feb0['attributes']=_[_0x87b8('0x30')](_0x3ecf8f['model'],qs[_0x87b8('0x31')](_0x3ac372[_0x87b8('0x2e')]['fields']));_0x28feb0[_0x87b8('0x32')]=_0x28feb0[_0x87b8('0x32')]['length']?_0x28feb0[_0x87b8('0x32')]:_0x3ecf8f[_0x87b8('0x2d')];if(_0x3ac372[_0x87b8('0x2e')][_0x87b8('0x3f')]){_0x28feb0[_0x87b8('0x45')]=[{'all':!![]}];}_0x28feb0=_[_0x87b8('0x3d')]({},_0x28feb0,_0x3ac372[_0x87b8('0x46')]);return db[_0x87b8('0x29')][_0x87b8('0x47')](_0x28feb0)[_0x87b8('0x21')](handleEntityNotFound(_0x276308,null))[_0x87b8('0x21')](respondWithResult(_0x276308,null))['catch'](handleError(_0x276308,null));};exports['create']=function(_0x38ee57,_0x5b72cc){return db[_0x87b8('0x29')][_0x87b8('0x48')](_0x38ee57[_0x87b8('0x49')],{})[_0x87b8('0x21')](respondWithResult(_0x5b72cc,0xc9))[_0x87b8('0x42')](handleError(_0x5b72cc,null));};exports['update']=function(_0x265658,_0x54ca09){if(_0x265658[_0x87b8('0x49')]['id']){delete _0x265658['body']['id'];}return db[_0x87b8('0x29')][_0x87b8('0x47')]({'where':{'id':_0x265658[_0x87b8('0x44')]['id']}})[_0x87b8('0x21')](handleEntityNotFound(_0x54ca09,null))[_0x87b8('0x21')](saveUpdates(_0x265658[_0x87b8('0x49')],null))[_0x87b8('0x21')](respondWithResult(_0x54ca09,null))['catch'](handleError(_0x54ca09,null));};exports[_0x87b8('0x4a')]=function(_0x5ca072,_0x487853){return db[_0x87b8('0x29')]['find']({'where':{'id':_0x5ca072[_0x87b8('0x44')]['id']}})[_0x87b8('0x21')](handleEntityNotFound(_0x487853,null))[_0x87b8('0x21')](removeEntity(_0x487853,null))['catch'](handleError(_0x487853,null));};exports[_0x87b8('0x4b')]=function(_0x2d8edd,_0x5d3378){return db[_0x87b8('0x29')]['describe']()['then'](respondWithResult(_0x5d3378,null))['catch'](handleError(_0x5d3378,null));}; \ No newline at end of file +var _0x969b=['to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','include','findAll','then','rows','params','IntegrationReport','length','options','find','catch','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x969b,0x172));var _0xb969=function(_0xe21519,_0x45c9f3){_0xe21519=_0xe21519-0x0;var _0x506a2e=_0x969b[_0xe21519];return _0x506a2e;};'use strict';var pdf=require(_0xb969('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb969('0x1'));var zipdir=require(_0xb969('0x2'));var jsonpatch=require(_0xb969('0x3'));var rp=require(_0xb969('0x4'));var moment=require(_0xb969('0x5'));var BPromise=require(_0xb969('0x6'));var Mustache=require(_0xb969('0x7'));var util=require('util');var path=require(_0xb969('0x8'));var sox=require(_0xb969('0x9'));var csv=require(_0xb969('0xa'));var ejs=require(_0xb969('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb969('0xc'));var crypto=require(_0xb969('0xd'));var jsforce=require(_0xb969('0xe'));var deskjs=require(_0xb969('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb969('0x10'));var Papa=require(_0xb969('0x11'));var Redis=require(_0xb969('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb969('0x13'));var as=require(_0xb969('0x14'));var hardwareService=require(_0xb969('0x15'));var logger=require(_0xb969('0x16'))(_0xb969('0x17'));var utils=require(_0xb969('0x18'));var config=require(_0xb969('0x19'));var db=require(_0xb969('0x1a'))['db'];function respondWithStatusCode(_0x4d7faf,_0x39caa4){_0x39caa4=_0x39caa4||0xcc;return function(_0x62a2b9){if(_0x62a2b9){return _0x4d7faf[_0xb969('0x1b')](_0x39caa4);}return _0x4d7faf[_0xb969('0x1c')](_0x39caa4)[_0xb969('0x1d')]();};}function respondWithResult(_0x4d4437,_0x550367){_0x550367=_0x550367||0xc8;return function(_0x2096d1){if(_0x2096d1){return _0x4d4437['status'](_0x550367)[_0xb969('0x1e')](_0x2096d1);}};}function respondWithFilteredResult(_0x51e768,_0x16e117){return function(_0xe4e712){if(_0xe4e712){var _0x98dd60=_0xe4e712[_0xb969('0x1f')],_0x1f6902=_0x16e117['offset'],_0x1034b2=_0x16e117[_0xb969('0x20')]+_0x16e117['limit'],_0x57665a;if(_0x1034b2>=_0x98dd60){_0x1034b2=_0x98dd60;_0x57665a=0xc8;}else{_0x57665a=0xce;}_0x51e768[_0xb969('0x1c')](_0x57665a);return _0x51e768[_0xb969('0x21')](_0xb969('0x22'),_0x1f6902+'-'+_0x1034b2+'/'+_0x98dd60)[_0xb969('0x1e')](_0xe4e712);}return null;};}function patchUpdates(_0x4a948f){return function(_0x57963b){try{jsonpatch['apply'](_0x57963b,_0x4a948f,!![]);}catch(_0x4056ce){return BPromise['reject'](_0x4056ce);}return _0x57963b[_0xb969('0x23')]();};}function saveUpdates(_0x26f81d,_0x6180d){return function(_0x1612f8){if(_0x1612f8){return _0x1612f8[_0xb969('0x24')](_0x26f81d)['then'](function(_0x18b5f4){return _0x18b5f4;});}return null;};}function removeEntity(_0x4b1c41,_0x52fd5b){return function(_0x1a88ad){if(_0x1a88ad){return _0x1a88ad['destroy']()['then'](function(){_0x4b1c41['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46cd04,_0x2369d2){return function(_0x66149e){if(!_0x66149e){_0x46cd04['sendStatus'](0x194);}return _0x66149e;};}function handleError(_0x3c2e04,_0x55d5d1){_0x55d5d1=_0x55d5d1||0x1f4;return function(_0x41d0ab){logger[_0xb969('0x25')](_0x41d0ab[_0xb969('0x26')]);if(_0x41d0ab[_0xb969('0x27')]){delete _0x41d0ab[_0xb969('0x27')];}_0x3c2e04[_0xb969('0x1c')](_0x55d5d1)['send'](_0x41d0ab);};}exports[_0xb969('0x28')]=function(_0x4a4186,_0x54fcd9){var _0x5b6eea={},_0x3c4d13={},_0x19ce81={'count':0x0,'rows':[]};var _0x5d4973=_['map'](db['IntegrationReport'][_0xb969('0x29')],function(_0x41e848){return{'name':_0x41e848[_0xb969('0x2a')],'type':_0x41e848[_0xb969('0x2b')][_0xb969('0x2c')]};});_0x3c4d13[_0xb969('0x2d')]=_['map'](_0x5d4973,_0xb969('0x27'));_0x3c4d13[_0xb969('0x2e')]=_[_0xb969('0x2f')](_0x4a4186['query']);_0x3c4d13['filters']=_[_0xb969('0x30')](_0x3c4d13['model'],_0x3c4d13['query']);_0x5b6eea['attributes']=_[_0xb969('0x30')](_0x3c4d13[_0xb969('0x2d')],qs['fields'](_0x4a4186[_0xb969('0x2e')][_0xb969('0x31')]));_0x5b6eea[_0xb969('0x32')]=_0x5b6eea[_0xb969('0x32')]['length']?_0x5b6eea[_0xb969('0x32')]:_0x3c4d13[_0xb969('0x2d')];if(!_0x4a4186[_0xb969('0x2e')][_0xb969('0x33')](_0xb969('0x34'))){_0x5b6eea['limit']=qs[_0xb969('0x35')](_0x4a4186[_0xb969('0x2e')][_0xb969('0x35')]);_0x5b6eea['offset']=qs[_0xb969('0x20')](_0x4a4186[_0xb969('0x2e')]['offset']);}_0x5b6eea[_0xb969('0x36')]=qs['sort'](_0x4a4186[_0xb969('0x2e')][_0xb969('0x37')]);_0x5b6eea[_0xb969('0x38')]=qs[_0xb969('0x39')](_[_0xb969('0x3a')](_0x4a4186[_0xb969('0x2e')],_0x3c4d13[_0xb969('0x39')]),_0x5d4973);if(_0x4a4186['query']['filter']){_0x5b6eea[_0xb969('0x38')]=_[_0xb969('0x3b')](_0x5b6eea['where'],{'$or':_[_0xb969('0x3c')](_0x5d4973,function(_0x1c3eb0){if(_0x1c3eb0['type']!==_0xb969('0x3d')){var _0x155fd7={};_0x155fd7[_0x1c3eb0[_0xb969('0x27')]]={'$like':'%'+_0x4a4186[_0xb969('0x2e')][_0xb969('0x3e')]+'%'};return _0x155fd7;}})});}_0x5b6eea=_[_0xb969('0x3b')]({},_0x5b6eea,_0x4a4186['options']);var _0x2c1534={'where':_0x5b6eea[_0xb969('0x38')]};return db['IntegrationReport'][_0xb969('0x1f')](_0x2c1534)['then'](function(_0x235664){_0x19ce81['count']=_0x235664;if(_0x4a4186[_0xb969('0x2e')]['includeAll']){_0x5b6eea[_0xb969('0x3f')]=[{'all':!![]}];}return db['IntegrationReport'][_0xb969('0x40')](_0x5b6eea);})[_0xb969('0x41')](function(_0x4915c6){_0x19ce81[_0xb969('0x42')]=_0x4915c6;return _0x19ce81;})[_0xb969('0x41')](respondWithFilteredResult(_0x54fcd9,_0x5b6eea))['catch'](handleError(_0x54fcd9,null));};exports['show']=function(_0x2856cf,_0x5a5a06){var _0x14f221={'raw':![],'where':{'id':_0x2856cf[_0xb969('0x43')]['id']}},_0x44a43d={};_0x44a43d['model']=_['keys'](db[_0xb969('0x44')][_0xb969('0x29')]);_0x44a43d[_0xb969('0x2e')]=_[_0xb969('0x2f')](_0x2856cf[_0xb969('0x2e')]);_0x44a43d[_0xb969('0x39')]=_[_0xb969('0x30')](_0x44a43d[_0xb969('0x2d')],_0x44a43d[_0xb969('0x2e')]);_0x14f221[_0xb969('0x32')]=_['intersection'](_0x44a43d['model'],qs[_0xb969('0x31')](_0x2856cf['query']['fields']));_0x14f221[_0xb969('0x32')]=_0x14f221[_0xb969('0x32')][_0xb969('0x45')]?_0x14f221[_0xb969('0x32')]:_0x44a43d['model'];if(_0x2856cf[_0xb969('0x2e')]['includeAll']){_0x14f221[_0xb969('0x3f')]=[{'all':!![]}];}_0x14f221=_['merge']({},_0x14f221,_0x2856cf[_0xb969('0x46')]);return db[_0xb969('0x44')][_0xb969('0x47')](_0x14f221)[_0xb969('0x41')](handleEntityNotFound(_0x5a5a06,null))['then'](respondWithResult(_0x5a5a06,null))[_0xb969('0x48')](handleError(_0x5a5a06,null));};exports['create']=function(_0x160b90,_0x1d42e1){return db['IntegrationReport']['create'](_0x160b90['body'],{})[_0xb969('0x41')](respondWithResult(_0x1d42e1,0xc9))[_0xb969('0x48')](handleError(_0x1d42e1,null));};exports[_0xb969('0x24')]=function(_0x449c5f,_0x31ddde){if(_0x449c5f[_0xb969('0x49')]['id']){delete _0x449c5f['body']['id'];}return db[_0xb969('0x44')][_0xb969('0x47')]({'where':{'id':_0x449c5f[_0xb969('0x43')]['id']}})[_0xb969('0x41')](handleEntityNotFound(_0x31ddde,null))[_0xb969('0x41')](saveUpdates(_0x449c5f['body'],null))['then'](respondWithResult(_0x31ddde,null))['catch'](handleError(_0x31ddde,null));};exports[_0xb969('0x4a')]=function(_0x5ac940,_0x4932d4){return db['IntegrationReport']['find']({'where':{'id':_0x5ac940['params']['id']}})[_0xb969('0x41')](handleEntityNotFound(_0x4932d4,null))['then'](removeEntity(_0x4932d4,null))['catch'](handleError(_0x4932d4,null));};exports[_0xb969('0x4b')]=function(_0x27da33,_0x5a82e0){return db['IntegrationReport']['describe']()[_0xb969('0x41')](respondWithResult(_0x5a82e0,null))[_0xb969('0x48')](handleError(_0x5a82e0,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index a618b35..2471776 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 _0x6398=['../../config/environment','exports','define','report_integration','util','api','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6398,0x90));var _0x8639=function(_0x540311,_0x53ca8b){_0x540311=_0x540311-0x0;var _0x56beef=_0x6398[_0x540311];return _0x56beef;};'use strict';var _=require('lodash');var util=require(_0x8639('0x0'));var logger=require('../../config/logger')(_0x8639('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8639('0x2'));var rimraf=require('rimraf');var config=require(_0x8639('0x3'));var attributes=require('./integrationReport.attributes');module[_0x8639('0x4')]=function(_0x3f056a,_0x37b7d5){return _0x3f056a[_0x8639('0x5')]('IntegrationReport',attributes,{'tableName':_0x8639('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9b1=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x572e51,_0x4a2cb7){var _0x550bc6=function(_0x2daa4b){while(--_0x2daa4b){_0x572e51['push'](_0x572e51['shift']());}};_0x550bc6(++_0x4a2cb7);}(_0xe9b1,0x170));var _0x1e9b=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0xe9b1[_0x3457b4];return _0xaa8fa9;};'use strict';var _=require(_0x1e9b('0x0'));var util=require(_0x1e9b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1e9b('0x2'));var rp=require(_0x1e9b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e9b('0x4'));var config=require(_0x1e9b('0x5'));var attributes=require(_0x1e9b('0x6'));module[_0x1e9b('0x7')]=function(_0x44ac5f,_0x3da4da){return _0x44ac5f[_0x1e9b('0x8')](_0x1e9b('0x9'),attributes,{'tableName':_0x1e9b('0xa'),'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 43f160c..ad0d32b 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 _0x9ffd=['IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x586f85,_0x57e85e){var _0x5ffa49=function(_0x3ab859){while(--_0x3ab859){_0x586f85['push'](_0x586f85['shift']());}};_0x5ffa49(++_0x57e85e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x48fb90,_0x45f6f3){_0x48fb90=_0x48fb90-0x0;var _0x192ead=_0x9ffd[_0x48fb90];return _0x192ead;};'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']('IntegrationReport,\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')]('IntegrationReport,\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')]('IntegrationReport,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x5cb367,_0x27ec9d){var _0x279365=function(_0x1d9d85){while(--_0x1d9d85){_0x5cb367['push'](_0x5cb367['shift']());}};_0x279365(++_0x27ec9d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index dece33b..9f469b6 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 _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(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 +var _0xedd9=['getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sub_intervals'];(function(_0x1353c9,_0x314a5b){var _0x1a4ec3=function(_0x245e06){while(--_0x245e06){_0x1353c9['push'](_0x1353c9['shift']());}};_0x1a4ec3(++_0x314a5b);}(_0xedd9,0xfc));var _0x9edd=function(_0x4b755a,_0x5b5ac7){_0x4b755a=_0x4b755a-0x0;var _0x11727e=_0xedd9[_0x4b755a];return _0x11727e;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./interval.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xd')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xd')]('/:id/sub_intervals/create_many',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router[_0x9edd('0x10')](_0x9edd('0x11'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0x11'),auth['isAuthenticated'](),controller[_0x9edd('0x14')]);module[_0x9edd('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index dab6f6f..62cd38a 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 _0xe8cc=['STRING','exports'];(function(_0x23189e,_0x3c013e){var _0x752182=function(_0x4b678c){while(--_0x4b678c){_0x23189e['push'](_0x23189e['shift']());}};_0x752182(++_0x3c013e);}(_0xe8cc,0xfd));var _0xce8c=function(_0x584bcc,_0x117ee6){_0x584bcc=_0x584bcc-0x0;var _0x39dc0a=_0xe8cc[_0x584bcc];return _0x39dc0a;};'use strict';var Sequelize=require('sequelize');module[_0xce8c('0x0')]={'name':{'type':Sequelize[_0xce8c('0x1')]},'description':{'type':Sequelize[_0xce8c('0x1')]},'interval':{'type':Sequelize[_0xce8c('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xd1bb=['exports','STRING','sequelize'];(function(_0x586580,_0x51cafb){var _0x18bfab=function(_0x31d69e){while(--_0x31d69e){_0x586580['push'](_0x586580['shift']());}};_0x18bfab(++_0x51cafb);}(_0xd1bb,0x125));var _0xbd1b=function(_0x53d8f2,_0x5cceb8){_0x53d8f2=_0x53d8f2-0x0;var _0x23b89c=_0xd1bb[_0x53d8f2];return _0x23b89c;};'use strict';var Sequelize=require(_0xbd1b('0x0'));module[_0xbd1b('0x1')]={'name':{'type':Sequelize[_0xbd1b('0x2')]},'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 4b17c7c..efb0667 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 _0x7385=['show','params','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','body','addInterval','IntervalId','getIntervals','findOne','pick','nolimit','addIntervals','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','merge','filter','options','Interval','includeAll','include','findAll','rows','catch'];(function(_0x5eb83e,_0x386039){var _0x2ba972=function(_0x324087){while(--_0x324087){_0x5eb83e['push'](_0x5eb83e['shift']());}};_0x2ba972(++_0x386039);}(_0x7385,0x1ca));var _0x5738=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7385[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require(_0x5738('0x0'));var emlformat=require(_0x5738('0x1'));var rimraf=require(_0x5738('0x2'));var zipdir=require(_0x5738('0x3'));var jsonpatch=require(_0x5738('0x4'));var rp=require(_0x5738('0x5'));var moment=require(_0x5738('0x6'));var BPromise=require(_0x5738('0x7'));var Mustache=require(_0x5738('0x8'));var util=require('util');var path=require(_0x5738('0x9'));var sox=require('sox');var csv=require(_0x5738('0xa'));var ejs=require(_0x5738('0xb'));var fs=require('fs');var _=require(_0x5738('0xc'));var squel=require('squel');var crypto=require(_0x5738('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5738('0xe'));var toCsv=require(_0x5738('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5738('0xf'));var qs=require(_0x5738('0x10'));var as=require(_0x5738('0x11'));var hardwareService=require(_0x5738('0x12'));var logger=require(_0x5738('0x13'))(_0x5738('0x14'));var utils=require(_0x5738('0x15'));var config=require(_0x5738('0x16'));var db=require('../../mysqldb')['db'];var extensions=require(_0x5738('0x17'));function respondWithStatusCode(_0x126d9b,_0x3d46ef){_0x3d46ef=_0x3d46ef||0xcc;return function(_0x4a358b){if(_0x4a358b){return _0x126d9b[_0x5738('0x18')](_0x3d46ef);}return _0x126d9b[_0x5738('0x19')](_0x3d46ef)['end']();};}function respondWithResult(_0x29253f,_0x57f7be){_0x57f7be=_0x57f7be||0xc8;return function(_0x40533c){if(_0x40533c){return _0x29253f['status'](_0x57f7be)[_0x5738('0x1a')](_0x40533c);}};}function respondWithFilteredResult(_0x318350,_0x5d5440){return function(_0x54b1c5){if(_0x54b1c5){var _0x42d552=_0x54b1c5[_0x5738('0x1b')],_0x557acf=_0x5d5440[_0x5738('0x1c')],_0x31d7cb=_0x5d5440['offset']+_0x5d5440[_0x5738('0x1d')],_0x88fd0a;if(_0x31d7cb>=_0x42d552){_0x31d7cb=_0x42d552;_0x88fd0a=0xc8;}else{_0x88fd0a=0xce;}_0x318350[_0x5738('0x19')](_0x88fd0a);return _0x318350[_0x5738('0x1e')](_0x5738('0x1f'),_0x557acf+'-'+_0x31d7cb+'/'+_0x42d552)[_0x5738('0x1a')](_0x54b1c5);}return null;};}function patchUpdates(_0x526c3b){return function(_0x2de36e){try{jsonpatch['apply'](_0x2de36e,_0x526c3b,!![]);}catch(_0x32ad19){return BPromise[_0x5738('0x20')](_0x32ad19);}return _0x2de36e[_0x5738('0x21')]();};}function saveUpdates(_0x4db63c,_0x5f4179){return function(_0x42a14f){if(_0x42a14f){return _0x42a14f[_0x5738('0x22')](_0x4db63c)[_0x5738('0x23')](function(_0x31ccc4){return _0x31ccc4;});}return null;};}function removeEntity(_0x58a719,_0x539892){return function(_0x510065){if(_0x510065){return _0x510065[_0x5738('0x24')]()[_0x5738('0x23')](function(){var _0x4e4cbd=_0x510065[_0x5738('0x25')]({'plain':!![]});var _0x451304=_0x5738('0x26');return db[_0x5738('0x27')][_0x5738('0x24')]({'where':{'type':_0x451304,'resourceId':_0x4e4cbd['id']}})[_0x5738('0x23')](function(){return _0x510065;});})['then'](function(){_0x58a719[_0x5738('0x19')](0xcc)[_0x5738('0x28')]();});}};}function handleEntityNotFound(_0x56b66b,_0x557a5b){return function(_0x173c4c){if(!_0x173c4c){_0x56b66b['sendStatus'](0x194);}return _0x173c4c;};}function handleError(_0x53b58d,_0x20f2d5){_0x20f2d5=_0x20f2d5||0x1f4;return function(_0x459b5e){logger[_0x5738('0x29')](_0x459b5e[_0x5738('0x2a')]);if(_0x459b5e[_0x5738('0x2b')]){delete _0x459b5e[_0x5738('0x2b')];}_0x53b58d[_0x5738('0x19')](_0x20f2d5)[_0x5738('0x2c')](_0x459b5e);};}exports[_0x5738('0x2d')]=function(_0x2707fa,_0x105d0f){var _0x29a7a2={},_0x236f1d={},_0x2a3c79={'count':0x0,'rows':[]};var _0x37b3ff=_[_0x5738('0x2e')](db['Interval'][_0x5738('0x2f')],function(_0x47f4b0){return{'name':_0x47f4b0[_0x5738('0x30')],'type':_0x47f4b0[_0x5738('0x31')]['key']};});_0x236f1d['model']=_['map'](_0x37b3ff,_0x5738('0x2b'));_0x236f1d['query']=_[_0x5738('0x32')](_0x2707fa[_0x5738('0x33')]);_0x236f1d[_0x5738('0x34')]=_[_0x5738('0x35')](_0x236f1d[_0x5738('0x36')],_0x236f1d[_0x5738('0x33')]);_0x29a7a2[_0x5738('0x37')]=_[_0x5738('0x35')](_0x236f1d[_0x5738('0x36')],qs['fields'](_0x2707fa[_0x5738('0x33')][_0x5738('0x38')]));_0x29a7a2['attributes']=_0x29a7a2[_0x5738('0x37')][_0x5738('0x39')]?_0x29a7a2[_0x5738('0x37')]:_0x236f1d['model'];if(!_0x2707fa['query'][_0x5738('0x3a')]('nolimit')){_0x29a7a2['limit']=qs[_0x5738('0x1d')](_0x2707fa['query'][_0x5738('0x1d')]);_0x29a7a2[_0x5738('0x1c')]=qs[_0x5738('0x1c')](_0x2707fa[_0x5738('0x33')][_0x5738('0x1c')]);}_0x29a7a2['order']=qs[_0x5738('0x3b')](_0x2707fa[_0x5738('0x33')]['sort']);_0x29a7a2['where']=qs[_0x5738('0x34')](_['pick'](_0x2707fa[_0x5738('0x33')],_0x236f1d[_0x5738('0x34')]),_0x37b3ff);if(_0x2707fa[_0x5738('0x33')]['filter']){_0x29a7a2[_0x5738('0x3c')]=_[_0x5738('0x3d')](_0x29a7a2['where'],{'$or':_[_0x5738('0x2e')](_0x37b3ff,function(_0x150d5a){if(_0x150d5a[_0x5738('0x31')]!=='VIRTUAL'){var _0x5c274b={};_0x5c274b[_0x150d5a[_0x5738('0x2b')]]={'$like':'%'+_0x2707fa['query'][_0x5738('0x3e')]+'%'};return _0x5c274b;}})});}_0x29a7a2=_[_0x5738('0x3d')]({},_0x29a7a2,_0x2707fa[_0x5738('0x3f')]);var _0x3f38e1={'where':_0x29a7a2['where']};return db[_0x5738('0x40')]['count'](_0x3f38e1)['then'](function(_0x52bb35){_0x2a3c79['count']=_0x52bb35;if(_0x2707fa['query'][_0x5738('0x41')]){_0x29a7a2[_0x5738('0x42')]=[{'all':!![]}];}return db['Interval'][_0x5738('0x43')](_0x29a7a2);})['then'](function(_0x1f861d){_0x2a3c79[_0x5738('0x44')]=_0x1f861d;return _0x2a3c79;})[_0x5738('0x23')](respondWithFilteredResult(_0x105d0f,_0x29a7a2))[_0x5738('0x45')](handleError(_0x105d0f,null));};exports[_0x5738('0x46')]=function(_0x153239,_0x4d5159){var _0x5c28c4={'raw':!![],'where':{'id':_0x153239[_0x5738('0x47')]['id']}},_0x4d1031={};_0x4d1031[_0x5738('0x36')]=_[_0x5738('0x32')](db['Interval']['rawAttributes']);_0x4d1031[_0x5738('0x33')]=_['keys'](_0x153239[_0x5738('0x33')]);_0x4d1031[_0x5738('0x34')]=_[_0x5738('0x35')](_0x4d1031[_0x5738('0x36')],_0x4d1031[_0x5738('0x33')]);_0x5c28c4[_0x5738('0x37')]=_[_0x5738('0x35')](_0x4d1031[_0x5738('0x36')],qs['fields'](_0x153239[_0x5738('0x33')][_0x5738('0x38')]));_0x5c28c4[_0x5738('0x37')]=_0x5c28c4[_0x5738('0x37')][_0x5738('0x39')]?_0x5c28c4['attributes']:_0x4d1031['model'];if(_0x153239[_0x5738('0x33')][_0x5738('0x41')]){_0x5c28c4[_0x5738('0x42')]=[{'all':!![]}];}_0x5c28c4=_['merge']({},_0x5c28c4,_0x153239[_0x5738('0x3f')]);return db['Interval']['find'](_0x5c28c4)[_0x5738('0x23')](handleEntityNotFound(_0x4d5159,null))[_0x5738('0x23')](respondWithResult(_0x4d5159,null))[_0x5738('0x45')](handleError(_0x4d5159,null));};exports[_0x5738('0x48')]=function(_0x24f06b,_0x4a9443){return db['Interval'][_0x5738('0x48')](_0x24f06b['body'],{})[_0x5738('0x23')](function(_0x27f637){var _0x4af419=_0x24f06b[_0x5738('0x49')]['get']({'plain':!![]});if(!_0x4af419)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4af419[_0x5738('0x4a')]===_0x5738('0x49')){var _0xed003d=_0x27f637[_0x5738('0x25')]({'plain':!![]});var _0x2e0064=_0x5738('0x26');return db[_0x5738('0x4b')][_0x5738('0x4c')]({'where':{'name':_0x2e0064,'userProfileId':_0x4af419[_0x5738('0x4d')]},'raw':!![]})[_0x5738('0x23')](function(_0x16f2d2){if(_0x16f2d2&&_0x16f2d2[_0x5738('0x4e')]===0x0){return db['UserProfileResource'][_0x5738('0x48')]({'name':_0xed003d['name'],'resourceId':_0xed003d['id'],'type':_0x16f2d2['name'],'sectionId':_0x16f2d2['id']},{})[_0x5738('0x23')](function(){return _0x27f637;});}else{return _0x27f637;}})[_0x5738('0x45')](function(_0x36672d){logger[_0x5738('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36672d);throw _0x36672d;});}return _0x27f637;})[_0x5738('0x23')](respondWithResult(_0x4a9443,0xc9))[_0x5738('0x45')](handleError(_0x4a9443,null));};exports[_0x5738('0x22')]=function(_0x32abf2,_0x32e64e){if(_0x32abf2[_0x5738('0x4f')]['id']){delete _0x32abf2[_0x5738('0x4f')]['id'];}return db[_0x5738('0x40')][_0x5738('0x4c')]({'where':{'id':_0x32abf2[_0x5738('0x47')]['id']}})[_0x5738('0x23')](handleEntityNotFound(_0x32e64e,null))[_0x5738('0x23')](saveUpdates(_0x32abf2['body'],null))[_0x5738('0x23')](respondWithResult(_0x32e64e,null))['catch'](handleError(_0x32e64e,null));};exports[_0x5738('0x24')]=function(_0x575ea8,_0xeeca4e){return db[_0x5738('0x40')][_0x5738('0x4c')]({'where':{'id':_0x575ea8[_0x5738('0x47')]['id']}})['then'](handleEntityNotFound(_0xeeca4e,null))[_0x5738('0x23')](removeEntity(_0xeeca4e,null))['catch'](handleError(_0xeeca4e,null));};exports[_0x5738('0x50')]=function(_0x55a8d9,_0x4dc03f,_0x755ee4){if(_0x55a8d9['body']['id']){delete _0x55a8d9['body']['id'];}return db['Interval']['find']({'where':{'id':_0x55a8d9[_0x5738('0x47')]['id']}})['then'](handleEntityNotFound(_0x4dc03f,null))['then'](function(_0x4df2c3){if(_0x4df2c3){_0x55a8d9[_0x5738('0x4f')][_0x5738('0x51')]=_0x4df2c3['id'];return db[_0x5738('0x40')][_0x5738('0x48')](_0x55a8d9['body']);}})[_0x5738('0x23')](respondWithResult(_0x4dc03f,null))[_0x5738('0x45')](handleError(_0x4dc03f,null));};exports[_0x5738('0x52')]=function(_0x359e80,_0x12fbf9,_0x3b0e56){var _0x4d5c6a={};var _0x28f4d4={};var _0x5df6c4;var _0x25a836;return db[_0x5738('0x40')][_0x5738('0x53')]({'where':{'id':_0x359e80[_0x5738('0x47')]['id']}})[_0x5738('0x23')](handleEntityNotFound(_0x12fbf9,null))[_0x5738('0x23')](function(_0x472488){if(_0x472488){_0x5df6c4=_0x472488;_0x28f4d4[_0x5738('0x36')]=_[_0x5738('0x32')](db['Interval'][_0x5738('0x2f')]);_0x28f4d4[_0x5738('0x33')]=_['keys'](_0x359e80[_0x5738('0x33')]);_0x28f4d4[_0x5738('0x34')]=_[_0x5738('0x35')](_0x28f4d4['model'],_0x28f4d4[_0x5738('0x33')]);_0x4d5c6a['attributes']=_['intersection'](_0x28f4d4[_0x5738('0x36')],qs[_0x5738('0x38')](_0x359e80[_0x5738('0x33')][_0x5738('0x38')]));_0x4d5c6a[_0x5738('0x37')]=_0x4d5c6a[_0x5738('0x37')][_0x5738('0x39')]?_0x4d5c6a[_0x5738('0x37')]:_0x28f4d4[_0x5738('0x36')];_0x4d5c6a['order']=qs['sort'](_0x359e80['query'][_0x5738('0x3b')]);_0x4d5c6a[_0x5738('0x3c')]=qs['filters'](_[_0x5738('0x54')](_0x359e80['query'],_0x28f4d4[_0x5738('0x34')]));if(_0x359e80[_0x5738('0x33')]['filter']){_0x4d5c6a['where']=_['merge'](_0x4d5c6a['where'],{'$or':_[_0x5738('0x2e')](_0x4d5c6a[_0x5738('0x37')],function(_0x2ad8cf){var _0x4ffd16={};_0x4ffd16[_0x2ad8cf]={'$like':'%'+_0x359e80[_0x5738('0x33')][_0x5738('0x3e')]+'%'};return _0x4ffd16;})});}_0x4d5c6a=_[_0x5738('0x3d')]({},_0x4d5c6a,_0x359e80[_0x5738('0x3f')]);return _0x5df6c4[_0x5738('0x52')](_0x4d5c6a);}})[_0x5738('0x23')](function(_0x2a74ce){if(_0x2a74ce){_0x25a836=_0x2a74ce[_0x5738('0x39')];if(!_0x359e80[_0x5738('0x33')][_0x5738('0x3a')](_0x5738('0x55'))){_0x4d5c6a['limit']=qs[_0x5738('0x1d')](_0x359e80[_0x5738('0x33')][_0x5738('0x1d')]);_0x4d5c6a[_0x5738('0x1c')]=qs['offset'](_0x359e80[_0x5738('0x33')]['offset']);}return _0x5df6c4['getIntervals'](_0x4d5c6a);}})['then'](function(_0x415479){if(_0x415479){return _0x415479?{'count':_0x25a836,'rows':_0x415479}:null;}})[_0x5738('0x23')](respondWithResult(_0x12fbf9,null))[_0x5738('0x45')](handleError(_0x12fbf9,null));};exports[_0x5738('0x56')]=function(_0x635fb8,_0x46ca21,_0x3259a0){return db[_0x5738('0x40')][_0x5738('0x53')]({'where':{'id':_0x635fb8[_0x5738('0x47')]['id']}})['then'](handleEntityNotFound(_0x46ca21,null))[_0x5738('0x23')](function(_0x1af777){if(_0x1af777){return db['sequelize']['transaction'](function(_0x1d4a4a){return db[_0x5738('0x40')]['destroy']({'where':{'IntervalId':_0x635fb8['params']['id']},'transaction':_0x1d4a4a})[_0x5738('0x23')](function(_0x1ccefa){var _0x192a33=_[_0x5738('0x2e')](_0x635fb8[_0x5738('0x4f')],function(_0x288a42){delete _0x288a42['id'];_0x288a42[_0x5738('0x51')]=_0x635fb8['params']['id'];return _0x288a42;});return db[_0x5738('0x40')][_0x5738('0x57')](_0x192a33,{'transaction':_0x1d4a4a});});})['then'](function(){return db['Interval'][_0x5738('0x43')]({'where':{'IntervalId':_0x635fb8[_0x5738('0x47')]['id']}});});}})[_0x5738('0x23')](respondWithResult(_0x46ca21,null))[_0x5738('0x45')](handleError(_0x46ca21,null));}; \ No newline at end of file +var _0x959d=['options','Interval','catch','show','params','includeAll','include','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','pick','addIntervals','sequelize','transaction','bulkCreate','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/extensions/rewrite','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','destroy','then','get','Intervals','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge'];(function(_0x4ed37d,_0x1a84c9){var _0x4fb2c5=function(_0x5c9013){while(--_0x5c9013){_0x4ed37d['push'](_0x4ed37d['shift']());}};_0x4fb2c5(++_0x1a84c9);}(_0x959d,0x71));var _0xd959=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x959d[_0x23ec06];return _0x2831d4;};'use strict';var pdf=require(_0xd959('0x0'));var emlformat=require(_0xd959('0x1'));var rimraf=require(_0xd959('0x2'));var zipdir=require(_0xd959('0x3'));var jsonpatch=require(_0xd959('0x4'));var rp=require(_0xd959('0x5'));var moment=require(_0xd959('0x6'));var BPromise=require(_0xd959('0x7'));var Mustache=require('mustache');var util=require(_0xd959('0x8'));var path=require(_0xd959('0x9'));var sox=require(_0xd959('0xa'));var csv=require(_0xd959('0xb'));var ejs=require(_0xd959('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd959('0xd'));var jsforce=require(_0xd959('0xe'));var deskjs=require(_0xd959('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd959('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd959('0x11'));var as=require(_0xd959('0x12'));var hardwareService=require(_0xd959('0x13'));var logger=require(_0xd959('0x14'))(_0xd959('0x15'));var utils=require(_0xd959('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var extensions=require(_0xd959('0x17'));function respondWithStatusCode(_0x43db49,_0x34eae8){_0x34eae8=_0x34eae8||0xcc;return function(_0x3a98c2){if(_0x3a98c2){return _0x43db49[_0xd959('0x18')](_0x34eae8);}return _0x43db49[_0xd959('0x19')](_0x34eae8)[_0xd959('0x1a')]();};}function respondWithResult(_0xaeb770,_0x4f7bc2){_0x4f7bc2=_0x4f7bc2||0xc8;return function(_0x156462){if(_0x156462){return _0xaeb770[_0xd959('0x19')](_0x4f7bc2)['json'](_0x156462);}};}function respondWithFilteredResult(_0x350aa8,_0x8fa14a){return function(_0x4a3976){if(_0x4a3976){var _0x4de89f=_0x4a3976[_0xd959('0x1b')],_0x542801=_0x8fa14a[_0xd959('0x1c')],_0x3693c0=_0x8fa14a[_0xd959('0x1c')]+_0x8fa14a[_0xd959('0x1d')],_0x277d4a;if(_0x3693c0>=_0x4de89f){_0x3693c0=_0x4de89f;_0x277d4a=0xc8;}else{_0x277d4a=0xce;}_0x350aa8['status'](_0x277d4a);return _0x350aa8[_0xd959('0x1e')]('Content-Range',_0x542801+'-'+_0x3693c0+'/'+_0x4de89f)[_0xd959('0x1f')](_0x4a3976);}return null;};}function patchUpdates(_0x1bdb37){return function(_0x45485e){try{jsonpatch[_0xd959('0x20')](_0x45485e,_0x1bdb37,!![]);}catch(_0xe3f2ab){return BPromise[_0xd959('0x21')](_0xe3f2ab);}return _0x45485e['save']();};}function saveUpdates(_0x45c40d,_0x361dc2){return function(_0x6cae2){if(_0x6cae2){return _0x6cae2[_0xd959('0x22')](_0x45c40d)['then'](function(_0x333a33){return _0x333a33;});}return null;};}function removeEntity(_0x4c9950,_0x1d36b2){return function(_0x458c1f){if(_0x458c1f){return _0x458c1f[_0xd959('0x23')]()[_0xd959('0x24')](function(){var _0x2575a8=_0x458c1f[_0xd959('0x25')]({'plain':!![]});var _0x58d73a=_0xd959('0x26');return db['UserProfileResource'][_0xd959('0x23')]({'where':{'type':_0x58d73a,'resourceId':_0x2575a8['id']}})['then'](function(){return _0x458c1f;});})[_0xd959('0x24')](function(){_0x4c9950['status'](0xcc)[_0xd959('0x1a')]();});}};}function handleEntityNotFound(_0x3822cc,_0x48623c){return function(_0x3301bd){if(!_0x3301bd){_0x3822cc['sendStatus'](0x194);}return _0x3301bd;};}function handleError(_0x9d666c,_0x3b230e){_0x3b230e=_0x3b230e||0x1f4;return function(_0x22d454){logger[_0xd959('0x27')](_0x22d454[_0xd959('0x28')]);if(_0x22d454[_0xd959('0x29')]){delete _0x22d454[_0xd959('0x29')];}_0x9d666c[_0xd959('0x19')](_0x3b230e)['send'](_0x22d454);};}exports[_0xd959('0x2a')]=function(_0x45e63a,_0x4759d8){var _0x4d679b={},_0x23c50c={},_0x4df297={'count':0x0,'rows':[]};var _0x15c3b7=_['map'](db['Interval'][_0xd959('0x2b')],function(_0xa638d6){return{'name':_0xa638d6[_0xd959('0x2c')],'type':_0xa638d6[_0xd959('0x2d')][_0xd959('0x2e')]};});_0x23c50c[_0xd959('0x2f')]=_[_0xd959('0x30')](_0x15c3b7,_0xd959('0x29'));_0x23c50c[_0xd959('0x31')]=_[_0xd959('0x32')](_0x45e63a[_0xd959('0x31')]);_0x23c50c['filters']=_[_0xd959('0x33')](_0x23c50c['model'],_0x23c50c['query']);_0x4d679b[_0xd959('0x34')]=_[_0xd959('0x33')](_0x23c50c[_0xd959('0x2f')],qs[_0xd959('0x35')](_0x45e63a[_0xd959('0x31')]['fields']));_0x4d679b[_0xd959('0x34')]=_0x4d679b[_0xd959('0x34')][_0xd959('0x36')]?_0x4d679b[_0xd959('0x34')]:_0x23c50c[_0xd959('0x2f')];if(!_0x45e63a['query'][_0xd959('0x37')](_0xd959('0x38'))){_0x4d679b[_0xd959('0x1d')]=qs[_0xd959('0x1d')](_0x45e63a[_0xd959('0x31')][_0xd959('0x1d')]);_0x4d679b[_0xd959('0x1c')]=qs[_0xd959('0x1c')](_0x45e63a[_0xd959('0x31')][_0xd959('0x1c')]);}_0x4d679b[_0xd959('0x39')]=qs[_0xd959('0x3a')](_0x45e63a['query'][_0xd959('0x3a')]);_0x4d679b[_0xd959('0x3b')]=qs[_0xd959('0x3c')](_['pick'](_0x45e63a[_0xd959('0x31')],_0x23c50c[_0xd959('0x3c')]),_0x15c3b7);if(_0x45e63a['query'][_0xd959('0x3d')]){_0x4d679b[_0xd959('0x3b')]=_[_0xd959('0x3e')](_0x4d679b[_0xd959('0x3b')],{'$or':_[_0xd959('0x30')](_0x15c3b7,function(_0x49702f){if(_0x49702f['type']!=='VIRTUAL'){var _0x1838c5={};_0x1838c5[_0x49702f[_0xd959('0x29')]]={'$like':'%'+_0x45e63a['query'][_0xd959('0x3d')]+'%'};return _0x1838c5;}})});}_0x4d679b=_[_0xd959('0x3e')]({},_0x4d679b,_0x45e63a[_0xd959('0x3f')]);var _0x852758={'where':_0x4d679b[_0xd959('0x3b')]};return db[_0xd959('0x40')][_0xd959('0x1b')](_0x852758)[_0xd959('0x24')](function(_0x114701){_0x4df297[_0xd959('0x1b')]=_0x114701;if(_0x45e63a['query']['includeAll']){_0x4d679b['include']=[{'all':!![]}];}return db[_0xd959('0x40')]['findAll'](_0x4d679b);})['then'](function(_0x32ab15){_0x4df297['rows']=_0x32ab15;return _0x4df297;})['then'](respondWithFilteredResult(_0x4759d8,_0x4d679b))[_0xd959('0x41')](handleError(_0x4759d8,null));};exports[_0xd959('0x42')]=function(_0x44a27d,_0x6d9227){var _0x1647a5={'raw':!![],'where':{'id':_0x44a27d[_0xd959('0x43')]['id']}},_0x2da2b7={};_0x2da2b7[_0xd959('0x2f')]=_[_0xd959('0x32')](db['Interval'][_0xd959('0x2b')]);_0x2da2b7['query']=_[_0xd959('0x32')](_0x44a27d[_0xd959('0x31')]);_0x2da2b7[_0xd959('0x3c')]=_[_0xd959('0x33')](_0x2da2b7['model'],_0x2da2b7[_0xd959('0x31')]);_0x1647a5[_0xd959('0x34')]=_[_0xd959('0x33')](_0x2da2b7['model'],qs[_0xd959('0x35')](_0x44a27d[_0xd959('0x31')][_0xd959('0x35')]));_0x1647a5['attributes']=_0x1647a5[_0xd959('0x34')][_0xd959('0x36')]?_0x1647a5[_0xd959('0x34')]:_0x2da2b7['model'];if(_0x44a27d[_0xd959('0x31')][_0xd959('0x44')]){_0x1647a5[_0xd959('0x45')]=[{'all':!![]}];}_0x1647a5=_['merge']({},_0x1647a5,_0x44a27d[_0xd959('0x3f')]);return db[_0xd959('0x40')][_0xd959('0x46')](_0x1647a5)[_0xd959('0x24')](handleEntityNotFound(_0x6d9227,null))[_0xd959('0x24')](respondWithResult(_0x6d9227,null))['catch'](handleError(_0x6d9227,null));};exports[_0xd959('0x47')]=function(_0x4e9a04,_0x49bd31){return db[_0xd959('0x40')][_0xd959('0x47')](_0x4e9a04[_0xd959('0x48')],{})[_0xd959('0x24')](function(_0x4f42cd){var _0x54f6f5=_0x4e9a04[_0xd959('0x49')][_0xd959('0x25')]({'plain':!![]});if(!_0x54f6f5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54f6f5[_0xd959('0x4a')]==='user'){var _0x14e0ac=_0x4f42cd['get']({'plain':!![]});var _0x454426=_0xd959('0x26');return db[_0xd959('0x4b')]['find']({'where':{'name':_0x454426,'userProfileId':_0x54f6f5['userProfileId']},'raw':!![]})[_0xd959('0x24')](function(_0x4c5a3f){if(_0x4c5a3f&&_0x4c5a3f[_0xd959('0x4c')]===0x0){return db['UserProfileResource'][_0xd959('0x47')]({'name':_0x14e0ac[_0xd959('0x29')],'resourceId':_0x14e0ac['id'],'type':_0x4c5a3f[_0xd959('0x29')],'sectionId':_0x4c5a3f['id']},{})[_0xd959('0x24')](function(){return _0x4f42cd;});}else{return _0x4f42cd;}})[_0xd959('0x41')](function(_0x4608b3){logger[_0xd959('0x27')](_0xd959('0x4d'),_0x4608b3);throw _0x4608b3;});}return _0x4f42cd;})[_0xd959('0x24')](respondWithResult(_0x49bd31,0xc9))['catch'](handleError(_0x49bd31,null));};exports[_0xd959('0x22')]=function(_0x28590f,_0x5ea2fc){if(_0x28590f['body']['id']){delete _0x28590f[_0xd959('0x48')]['id'];}return db[_0xd959('0x40')][_0xd959('0x46')]({'where':{'id':_0x28590f[_0xd959('0x43')]['id']}})[_0xd959('0x24')](handleEntityNotFound(_0x5ea2fc,null))[_0xd959('0x24')](saveUpdates(_0x28590f[_0xd959('0x48')],null))[_0xd959('0x24')](respondWithResult(_0x5ea2fc,null))[_0xd959('0x41')](handleError(_0x5ea2fc,null));};exports[_0xd959('0x23')]=function(_0x5aed2d,_0x2586a5){return db[_0xd959('0x40')]['find']({'where':{'id':_0x5aed2d[_0xd959('0x43')]['id']}})['then'](handleEntityNotFound(_0x2586a5,null))['then'](removeEntity(_0x2586a5,null))['catch'](handleError(_0x2586a5,null));};exports[_0xd959('0x4e')]=function(_0x318090,_0x27a947,_0x134136){if(_0x318090[_0xd959('0x48')]['id']){delete _0x318090[_0xd959('0x48')]['id'];}return db[_0xd959('0x40')]['find']({'where':{'id':_0x318090[_0xd959('0x43')]['id']}})[_0xd959('0x24')](handleEntityNotFound(_0x27a947,null))[_0xd959('0x24')](function(_0x189e44){if(_0x189e44){_0x318090[_0xd959('0x48')][_0xd959('0x4f')]=_0x189e44['id'];return db['Interval'][_0xd959('0x47')](_0x318090[_0xd959('0x48')]);}})[_0xd959('0x24')](respondWithResult(_0x27a947,null))['catch'](handleError(_0x27a947,null));};exports[_0xd959('0x50')]=function(_0x2f377c,_0x145512,_0x23a7ee){var _0x4ecdcc={};var _0x57ca28={};var _0xbb9b5f;var _0x2f4751;return db[_0xd959('0x40')][_0xd959('0x51')]({'where':{'id':_0x2f377c[_0xd959('0x43')]['id']}})[_0xd959('0x24')](handleEntityNotFound(_0x145512,null))[_0xd959('0x24')](function(_0x237d23){if(_0x237d23){_0xbb9b5f=_0x237d23;_0x57ca28[_0xd959('0x2f')]=_[_0xd959('0x32')](db['Interval'][_0xd959('0x2b')]);_0x57ca28['query']=_[_0xd959('0x32')](_0x2f377c['query']);_0x57ca28[_0xd959('0x3c')]=_[_0xd959('0x33')](_0x57ca28[_0xd959('0x2f')],_0x57ca28['query']);_0x4ecdcc['attributes']=_[_0xd959('0x33')](_0x57ca28[_0xd959('0x2f')],qs[_0xd959('0x35')](_0x2f377c[_0xd959('0x31')][_0xd959('0x35')]));_0x4ecdcc[_0xd959('0x34')]=_0x4ecdcc[_0xd959('0x34')][_0xd959('0x36')]?_0x4ecdcc[_0xd959('0x34')]:_0x57ca28[_0xd959('0x2f')];_0x4ecdcc['order']=qs[_0xd959('0x3a')](_0x2f377c['query'][_0xd959('0x3a')]);_0x4ecdcc[_0xd959('0x3b')]=qs[_0xd959('0x3c')](_[_0xd959('0x52')](_0x2f377c[_0xd959('0x31')],_0x57ca28[_0xd959('0x3c')]));if(_0x2f377c[_0xd959('0x31')][_0xd959('0x3d')]){_0x4ecdcc['where']=_['merge'](_0x4ecdcc[_0xd959('0x3b')],{'$or':_[_0xd959('0x30')](_0x4ecdcc[_0xd959('0x34')],function(_0x2c6727){var _0xce3750={};_0xce3750[_0x2c6727]={'$like':'%'+_0x2f377c[_0xd959('0x31')]['filter']+'%'};return _0xce3750;})});}_0x4ecdcc=_[_0xd959('0x3e')]({},_0x4ecdcc,_0x2f377c['options']);return _0xbb9b5f[_0xd959('0x50')](_0x4ecdcc);}})[_0xd959('0x24')](function(_0x4821c5){if(_0x4821c5){_0x2f4751=_0x4821c5[_0xd959('0x36')];if(!_0x2f377c[_0xd959('0x31')][_0xd959('0x37')](_0xd959('0x38'))){_0x4ecdcc['limit']=qs[_0xd959('0x1d')](_0x2f377c[_0xd959('0x31')]['limit']);_0x4ecdcc[_0xd959('0x1c')]=qs[_0xd959('0x1c')](_0x2f377c[_0xd959('0x31')]['offset']);}return _0xbb9b5f[_0xd959('0x50')](_0x4ecdcc);}})['then'](function(_0x2f0f0b){if(_0x2f0f0b){return _0x2f0f0b?{'count':_0x2f4751,'rows':_0x2f0f0b}:null;}})[_0xd959('0x24')](respondWithResult(_0x145512,null))[_0xd959('0x41')](handleError(_0x145512,null));};exports[_0xd959('0x53')]=function(_0x5a47af,_0x14417d,_0x3ca6d3){return db[_0xd959('0x40')][_0xd959('0x51')]({'where':{'id':_0x5a47af[_0xd959('0x43')]['id']}})[_0xd959('0x24')](handleEntityNotFound(_0x14417d,null))[_0xd959('0x24')](function(_0xcf398a){if(_0xcf398a){return db[_0xd959('0x54')][_0xd959('0x55')](function(_0x42395a){return db[_0xd959('0x40')][_0xd959('0x23')]({'where':{'IntervalId':_0x5a47af[_0xd959('0x43')]['id']},'transaction':_0x42395a})[_0xd959('0x24')](function(_0x5532f3){var _0x506e75=_[_0xd959('0x30')](_0x5a47af[_0xd959('0x48')],function(_0x341cbe){delete _0x341cbe['id'];_0x341cbe['IntervalId']=_0x5a47af[_0xd959('0x43')]['id'];return _0x341cbe;});return db['Interval'][_0xd959('0x56')](_0x506e75,{'transaction':_0x42395a});});})['then'](function(){return db['Interval'][_0xd959('0x57')]({'where':{'IntervalId':_0x5a47af[_0xd959('0x43')]['id']}});});}})['then'](respondWithResult(_0x14417d,null))['catch'](handleError(_0x14417d,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ffd8a3a..1a07999 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 _0x3ae9=['Interval','tools_intervals','rewrite','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','define'];(function(_0x40b7c8,_0x184ab8){var _0x4c39a3=function(_0x2ccbe8){while(--_0x2ccbe8){_0x40b7c8['push'](_0x40b7c8['shift']());}};_0x4c39a3(++_0x184ab8);}(_0x3ae9,0xdb));var _0x93ae=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x3ae9[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x93ae('0x0'))(_0x93ae('0x1'));var moment=require(_0x93ae('0x2'));var BPromise=require('bluebird');var rp=require(_0x93ae('0x3'));var fs=require('fs');var path=require(_0x93ae('0x4'));var rimraf=require(_0x93ae('0x5'));var config=require(_0x93ae('0x6'));var attributes=require('./interval.attributes');var extensions=require(_0x93ae('0x7'));module['exports']=function(_0x3a9a9c,_0x32564c){return _0x3a9a9c[_0x93ae('0x8')](_0x93ae('0x9'),attributes,{'tableName':_0x93ae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x354bf9,_0x57d1f6){extensions[_0x93ae('0xb')](_0x3a9a9c,_0x354bf9);},'afterBulkCreate':function(_0x4ac4b0,_0x52fd48,_0x5a373a){_0x5a373a();extensions[_0x93ae('0xb')](_0x3a9a9c,_0x4ac4b0[0x0]);},'afterUpdate':function(_0x7eb772,_0x2d0afa){extensions[_0x93ae('0xb')](_0x3a9a9c,_0x7eb772);},'afterDestroy':function(_0x2d9be2,_0x3a5011){extensions['rewrite'](_0x3a9a9c,_0x2d9be2);}}});}; \ No newline at end of file +var _0xf9bc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','define','Interval','tools_intervals','rewrite'];(function(_0x967148,_0x2a8497){var _0x14e78d=function(_0x57f2fb){while(--_0x57f2fb){_0x967148['push'](_0x967148['shift']());}};_0x14e78d(++_0x2a8497);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x3c4b09,_0x51264d){_0x3c4b09=_0x3c4b09-0x0;var _0x5318c4=_0xf9bc[_0x3c4b09];return _0x5318c4;};'use strict';var _=require('lodash');var util=require(_0xcf9b('0x0'));var logger=require(_0xcf9b('0x1'))(_0xcf9b('0x2'));var moment=require(_0xcf9b('0x3'));var BPromise=require(_0xcf9b('0x4'));var rp=require(_0xcf9b('0x5'));var fs=require('fs');var path=require(_0xcf9b('0x6'));var rimraf=require(_0xcf9b('0x7'));var config=require(_0xcf9b('0x8'));var attributes=require(_0xcf9b('0x9'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x3595ac,_0x2ba407){return _0x3595ac[_0xcf9b('0xa')](_0xcf9b('0xb'),attributes,{'tableName':_0xcf9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c0e77,_0x182df7){extensions[_0xcf9b('0xd')](_0x3595ac,_0x2c0e77);},'afterBulkCreate':function(_0x3447ef,_0x5aec9b,_0x415d49){_0x415d49();extensions[_0xcf9b('0xd')](_0x3595ac,_0x3447ef[0x0]);},'afterUpdate':function(_0x5563d1,_0x31a5df){extensions['rewrite'](_0x3595ac,_0x5563d1);},'afterDestroy':function(_0x546d46,_0x56e384){extensions[_0xcf9b('0xd')](_0x3595ac,_0x546d46);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 88cafe2..00b8092 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 _0x58ca=['catch','ShowInterval','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Interval','findAll','options','raw','where','attributes','limit','include','map','model','GetInterval','debug'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x58ca,0x1a7));var _0xa58c=function(_0x394d87,_0x37c157){_0x394d87=_0x394d87-0x0;var _0x20bec8=_0x58ca[_0x394d87];return _0x20bec8;};'use strict';var _=require(_0xa58c('0x0'));var util=require(_0xa58c('0x1'));var moment=require(_0xa58c('0x2'));var BPromise=require(_0xa58c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa58c('0x4'));var db=require(_0xa58c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa58c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa58c('0x7'));var client=jayson[_0xa58c('0x8')][_0xa58c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44507e,_0x334878,_0xf8691b){return new BPromise(function(_0x535880,_0x120853){return client['request'](_0x44507e,_0xf8691b)[_0xa58c('0xa')](function(_0x406d39){logger[_0xa58c('0xb')](_0xa58c('0xc'),_0x334878,_0xa58c('0xd'));logger['debug'](_0xa58c('0xe'),_0x334878,_0xa58c('0xd'),JSON[_0xa58c('0xf')](_0x406d39));if(_0x406d39[_0xa58c('0x10')]){if(_0x406d39[_0xa58c('0x10')][_0xa58c('0x11')]===0x1f4){logger[_0xa58c('0x10')](_0xa58c('0xc'),_0x334878,_0x406d39[_0xa58c('0x10')][_0xa58c('0x12')]);return _0x120853(_0x406d39[_0xa58c('0x10')][_0xa58c('0x12')]);}logger[_0xa58c('0x10')](_0xa58c('0xc'),_0x334878,_0x406d39[_0xa58c('0x10')]['message']);return _0x535880(_0x406d39[_0xa58c('0x10')][_0xa58c('0x12')]);}else{logger[_0xa58c('0xb')]('Interval,\x20%s,\x20%s',_0x334878,_0xa58c('0xd'));_0x535880(_0x406d39[_0xa58c('0x13')][_0xa58c('0x12')]);}})['catch'](function(_0x1ba3b5){logger['error'](_0xa58c('0xc'),_0x334878,_0x1ba3b5);_0x120853(_0x1ba3b5);});});}exports['GetInterval']=function(_0x432960){var _0x12c624=this;return new Promise(function(_0x5048b6,_0x15f180){return db[_0xa58c('0x14')][_0xa58c('0x15')]({'raw':_0x432960[_0xa58c('0x16')]?_0x432960[_0xa58c('0x16')][_0xa58c('0x17')]===undefined?!![]:![]:!![],'where':_0x432960[_0xa58c('0x16')]?_0x432960[_0xa58c('0x16')][_0xa58c('0x18')]||null:null,'attributes':_0x432960[_0xa58c('0x16')]?_0x432960[_0xa58c('0x16')][_0xa58c('0x19')]||null:null,'limit':_0x432960['options']?_0x432960[_0xa58c('0x16')][_0xa58c('0x1a')]||null:null,'include':_0x432960[_0xa58c('0x16')]?_0x432960[_0xa58c('0x16')][_0xa58c('0x1b')]?_[_0xa58c('0x1c')](_0x432960[_0xa58c('0x16')][_0xa58c('0x1b')],function(_0x2ae956){return{'model':db[_0x2ae956['model']],'as':_0x2ae956['as'],'attributes':_0x2ae956[_0xa58c('0x19')],'include':_0x2ae956[_0xa58c('0x1b')]?_[_0xa58c('0x1c')](_0x2ae956[_0xa58c('0x1b')],function(_0x5d0abc){return{'model':db[_0x5d0abc[_0xa58c('0x1d')]],'as':_0x5d0abc['as'],'attributes':_0x5d0abc['attributes'],'include':_0x5d0abc['include']?_[_0xa58c('0x1c')](_0x5d0abc[_0xa58c('0x1b')],function(_0xf97143){return{'model':db[_0xf97143[_0xa58c('0x1d')]],'as':_0xf97143['as'],'attributes':_0xf97143[_0xa58c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa58c('0xa')](function(_0x3841e6){logger[_0xa58c('0xb')](_0xa58c('0x1e'),_0x432960);logger[_0xa58c('0x1f')](_0xa58c('0x1e'),_0x432960,JSON['stringify'](_0x3841e6));_0x5048b6(_0x3841e6);})[_0xa58c('0x20')](function(_0x1a2dd2){logger['error'](_0xa58c('0x1e'),_0x1a2dd2[_0xa58c('0x12')],_0x432960);_0x15f180(_0x12c624[_0xa58c('0x10')](0x1f4,_0x1a2dd2[_0xa58c('0x12')]));});});};exports[_0xa58c('0x21')]=function(_0x869a9c){var _0x354f69=this;return new Promise(function(_0x4da2d4,_0x50fda3){return db[_0xa58c('0x14')][_0xa58c('0x22')]({'raw':_0x869a9c[_0xa58c('0x16')]?_0x869a9c[_0xa58c('0x16')][_0xa58c('0x17')]===undefined?!![]:![]:!![],'where':_0x869a9c[_0xa58c('0x16')]?_0x869a9c[_0xa58c('0x16')]['where']||null:null,'attributes':_0x869a9c['options']?_0x869a9c[_0xa58c('0x16')][_0xa58c('0x19')]||null:null,'include':_0x869a9c['options']?_0x869a9c['options'][_0xa58c('0x1b')]?_[_0xa58c('0x1c')](_0x869a9c[_0xa58c('0x16')]['include'],function(_0x85edfe){return{'model':db[_0x85edfe['model']],'as':_0x85edfe['as'],'attributes':_0x85edfe[_0xa58c('0x19')],'include':_0x85edfe[_0xa58c('0x1b')]?_[_0xa58c('0x1c')](_0x85edfe[_0xa58c('0x1b')],function(_0xc389bd){return{'model':db[_0xc389bd[_0xa58c('0x1d')]],'as':_0xc389bd['as'],'attributes':_0xc389bd['attributes'],'include':_0xc389bd[_0xa58c('0x1b')]?_[_0xa58c('0x1c')](_0xc389bd[_0xa58c('0x1b')],function(_0x142ac3){return{'model':db[_0x142ac3[_0xa58c('0x1d')]],'as':_0x142ac3['as'],'attributes':_0x142ac3[_0xa58c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46b771){logger[_0xa58c('0xb')](_0xa58c('0x21'),_0x869a9c);logger[_0xa58c('0x1f')]('ShowInterval',_0x869a9c,JSON[_0xa58c('0xf')](_0x46b771));_0x4da2d4(_0x46b771);})[_0xa58c('0x20')](function(_0x2e27be){logger[_0xa58c('0x10')](_0xa58c('0x21'),_0x2e27be[_0xa58c('0x12')],_0x869a9c);_0x50fda3(_0x354f69[_0xa58c('0x10')](0x1f4,_0x2e27be[_0xa58c('0x12')]));});});}; \ No newline at end of file +var _0xebeb=['Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetInterval','Interval','findAll','options','raw','where','attributes','include','map','model','find','ShowInterval','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Interval,\x20%s,\x20%s','debug'];(function(_0x2df335,_0x58d4da){var _0x89db1b=function(_0x44b699){while(--_0x44b699){_0x2df335['push'](_0x2df335['shift']());}};_0x89db1b(++_0x58d4da);}(_0xebeb,0x1e8));var _0xbebe=function(_0x407fbb,_0x53d187){_0x407fbb=_0x407fbb-0x0;var _0x4580be=_0xebeb[_0x407fbb];return _0x4580be;};'use strict';var _=require(_0xbebe('0x0'));var util=require(_0xbebe('0x1'));var moment=require(_0xbebe('0x2'));var BPromise=require(_0xbebe('0x3'));var rs=require(_0xbebe('0x4'));var fs=require('fs');var Redis=require(_0xbebe('0x5'));var db=require(_0xbebe('0x6'))['db'];var utils=require(_0xbebe('0x7'));var logger=require('../../config/logger')(_0xbebe('0x8'));var config=require(_0xbebe('0x9'));var jayson=require(_0xbebe('0xa'));var client=jayson[_0xbebe('0xb')][_0xbebe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x436d95,_0x579402,_0x208ae0){return new BPromise(function(_0x38f6c9,_0x22ecb8){return client['request'](_0x436d95,_0x208ae0)[_0xbebe('0xd')](function(_0x1b6d41){logger['info'](_0xbebe('0xe'),_0x579402,'request\x20sent');logger[_0xbebe('0xf')](_0xbebe('0x10'),_0x579402,_0xbebe('0x11'),JSON[_0xbebe('0x12')](_0x1b6d41));if(_0x1b6d41[_0xbebe('0x13')]){if(_0x1b6d41['error']['code']===0x1f4){logger[_0xbebe('0x13')](_0xbebe('0xe'),_0x579402,_0x1b6d41[_0xbebe('0x13')][_0xbebe('0x14')]);return _0x22ecb8(_0x1b6d41['error']['message']);}logger[_0xbebe('0x13')]('Interval,\x20%s,\x20%s',_0x579402,_0x1b6d41[_0xbebe('0x13')][_0xbebe('0x14')]);return _0x38f6c9(_0x1b6d41['error'][_0xbebe('0x14')]);}else{logger[_0xbebe('0x15')]('Interval,\x20%s,\x20%s',_0x579402,_0xbebe('0x11'));_0x38f6c9(_0x1b6d41[_0xbebe('0x16')]['message']);}})['catch'](function(_0x105e23){logger[_0xbebe('0x13')](_0xbebe('0xe'),_0x579402,_0x105e23);_0x22ecb8(_0x105e23);});});}exports[_0xbebe('0x17')]=function(_0x18e73d){var _0x1e9b2b=this;return new Promise(function(_0xb8cd22,_0x51c8d8){return db[_0xbebe('0x18')][_0xbebe('0x19')]({'raw':_0x18e73d['options']?_0x18e73d[_0xbebe('0x1a')][_0xbebe('0x1b')]===undefined?!![]:![]:!![],'where':_0x18e73d[_0xbebe('0x1a')]?_0x18e73d[_0xbebe('0x1a')][_0xbebe('0x1c')]||null:null,'attributes':_0x18e73d[_0xbebe('0x1a')]?_0x18e73d['options'][_0xbebe('0x1d')]||null:null,'limit':_0x18e73d[_0xbebe('0x1a')]?_0x18e73d[_0xbebe('0x1a')]['limit']||null:null,'include':_0x18e73d['options']?_0x18e73d[_0xbebe('0x1a')][_0xbebe('0x1e')]?_[_0xbebe('0x1f')](_0x18e73d[_0xbebe('0x1a')][_0xbebe('0x1e')],function(_0x30588c){return{'model':db[_0x30588c[_0xbebe('0x20')]],'as':_0x30588c['as'],'attributes':_0x30588c['attributes'],'include':_0x30588c[_0xbebe('0x1e')]?_[_0xbebe('0x1f')](_0x30588c[_0xbebe('0x1e')],function(_0x37b673){return{'model':db[_0x37b673['model']],'as':_0x37b673['as'],'attributes':_0x37b673[_0xbebe('0x1d')],'include':_0x37b673[_0xbebe('0x1e')]?_['map'](_0x37b673[_0xbebe('0x1e')],function(_0x4d8057){return{'model':db[_0x4d8057['model']],'as':_0x4d8057['as'],'attributes':_0x4d8057['attributes']};}):[]};}):[]};}):[]:[]})[_0xbebe('0xd')](function(_0x25e14c){logger[_0xbebe('0x15')]('GetInterval',_0x18e73d);logger[_0xbebe('0xf')](_0xbebe('0x17'),_0x18e73d,JSON[_0xbebe('0x12')](_0x25e14c));_0xb8cd22(_0x25e14c);})['catch'](function(_0x52803b){logger[_0xbebe('0x13')](_0xbebe('0x17'),_0x52803b['message'],_0x18e73d);_0x51c8d8(_0x1e9b2b['error'](0x1f4,_0x52803b['message']));});});};exports['ShowInterval']=function(_0x4f5604){var _0x4cbd8f=this;return new Promise(function(_0x1819d5,_0x3e78dd){return db['Interval'][_0xbebe('0x21')]({'raw':_0x4f5604[_0xbebe('0x1a')]?_0x4f5604[_0xbebe('0x1a')][_0xbebe('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f5604[_0xbebe('0x1a')]?_0x4f5604[_0xbebe('0x1a')][_0xbebe('0x1c')]||null:null,'attributes':_0x4f5604['options']?_0x4f5604[_0xbebe('0x1a')][_0xbebe('0x1d')]||null:null,'include':_0x4f5604[_0xbebe('0x1a')]?_0x4f5604[_0xbebe('0x1a')][_0xbebe('0x1e')]?_[_0xbebe('0x1f')](_0x4f5604['options'][_0xbebe('0x1e')],function(_0x12dcbf){return{'model':db[_0x12dcbf[_0xbebe('0x20')]],'as':_0x12dcbf['as'],'attributes':_0x12dcbf['attributes'],'include':_0x12dcbf[_0xbebe('0x1e')]?_[_0xbebe('0x1f')](_0x12dcbf[_0xbebe('0x1e')],function(_0x15c59f){return{'model':db[_0x15c59f[_0xbebe('0x20')]],'as':_0x15c59f['as'],'attributes':_0x15c59f[_0xbebe('0x1d')],'include':_0x15c59f['include']?_[_0xbebe('0x1f')](_0x15c59f[_0xbebe('0x1e')],function(_0x1d6df2){return{'model':db[_0x1d6df2['model']],'as':_0x1d6df2['as'],'attributes':_0x1d6df2[_0xbebe('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbebe('0xd')](function(_0x3bb879){logger[_0xbebe('0x15')](_0xbebe('0x22'),_0x4f5604);logger[_0xbebe('0xf')](_0xbebe('0x22'),_0x4f5604,JSON[_0xbebe('0x12')](_0x3bb879));_0x1819d5(_0x3bb879);})[_0xbebe('0x23')](function(_0x5ddf5c){logger[_0xbebe('0x13')](_0xbebe('0x22'),_0x5ddf5c[_0xbebe('0x14')],_0x4f5604);_0x3e78dd(_0x4cbd8f[_0xbebe('0x13')](0x1f4,_0x5ddf5c[_0xbebe('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 0bffc59..092c546 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 _0xa23a=['post','send','exports','express','Router','./jira.controller'];(function(_0x4f3b17,_0xa7be64){var _0x10d5bb=function(_0x402d4c){while(--_0x402d4c){_0x4f3b17['push'](_0x4f3b17['shift']());}};_0x10d5bb(++_0xa7be64);}(_0xa23a,0xe1));var _0xaa23=function(_0x2ea680,_0x99a563){_0x2ea680=_0x2ea680-0x0;var _0x317396=_0xa23a[_0x2ea680];return _0x317396;};'use strict';var express=require(_0xaa23('0x0'));var router=express[_0xaa23('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xaa23('0x2'));router[_0xaa23('0x3')]('/',auth['isAuthenticated'](),controller[_0xaa23('0x4')]);module[_0xaa23('0x5')]=router; \ No newline at end of file +var _0x5139=['express','Router','./jira.controller','post','isAuthenticated','send','exports'];(function(_0x1ead91,_0x2d1bc2){var _0x33a8b3=function(_0x59b406){while(--_0x59b406){_0x1ead91['push'](_0x1ead91['shift']());}};_0x33a8b3(++_0x2d1bc2);}(_0x5139,0x8c));var _0x9513=function(_0x2bf903,_0x30b955){_0x2bf903=_0x2bf903-0x0;var _0x2d6fa1=_0x5139[_0x2bf903];return _0x2d6fa1;};'use strict';var express=require(_0x9513('0x0'));var router=express[_0x9513('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9513('0x2'));router[_0x9513('0x3')]('/',auth[_0x9513('0x4')](),controller[_0x9513('0x5')]);module[_0x9513('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index f254300..6fd9800 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 _0x5dbb=['email','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','utf8','data','end','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','description','stringify','issuetype','Bug','fields'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x5dbb,0x71));var _0xb5db=function(_0x27f5b0,_0x21cdef){_0x27f5b0=_0x27f5b0-0x0;var _0x4c3d1e=_0x5dbb[_0x27f5b0];return _0x4c3d1e;};'use strict';var BPromise=require(_0xb5db('0x0'));var https=require(_0xb5db('0x1'));var logger=require(_0xb5db('0x2'))(_0xb5db('0x3'));var USERNAME=_0xb5db('0x4');var PASSWORD=_0xb5db('0x5');function openIssue(_0x5b4296,_0x205b9c){var _0x14690d={'fields':{'project':{'key':_0x5b4296[_0xb5db('0x6')]||_0xb5db('0x7')},'summary':(_0x5b4296['summary']||'Report')+'\x20from\x20'+_0x5b4296['ip'],'description':_0x5b4296[_0xb5db('0x8')]||JSON[_0xb5db('0x9')](_0x5b4296),'issuetype':{'name':_0x5b4296[_0xb5db('0xa')]||_0xb5db('0xb')}}};_0x14690d[_0xb5db('0xc')]['customfield_11500']=_0x5b4296[_0xb5db('0xd')];_0x14690d[_0xb5db('0xc')]['customfield_11501']=_0x5b4296[_0xb5db('0xe')];_0x14690d[_0xb5db('0xc')][_0xb5db('0xf')]=_0x5b4296[_0xb5db('0x10')];_0x14690d[_0xb5db('0xc')][_0xb5db('0x11')]=_0x5b4296[_0xb5db('0x12')];_0x14690d[_0xb5db('0xc')][_0xb5db('0x13')]=_0x5b4296[_0xb5db('0x14')];_0x14690d[_0xb5db('0xc')]['customfield_10102']=_0x5b4296['ip'];var _0x451534={'host':_0xb5db('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xb5db('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xb5db('0x17'),'Authorization':_0xb5db('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xb5db('0x19')](_0xb5db('0x1a'))}};var _0x5e2a88=JSON[_0xb5db('0x9')](_0x14690d);var _0x438dc3=https[_0xb5db('0x1b')](_0x451534,function(_0x5535ee){_0x5535ee['setEncoding'](_0xb5db('0x1c'));var _0x5e7800='';_0x5535ee['on'](_0xb5db('0x1d'),function(_0x48c257){_0x5e7800+=_0x48c257;});_0x5535ee['on'](_0xb5db('0x1e'),function(){if(_0x205b9c){return _0x205b9c[_0xb5db('0x1f')](_0x5535ee['statusCode'])[_0xb5db('0x20')](JSON[_0xb5db('0x21')](_0x5e7800));}});});_0x438dc3['on']('error',function(_0xac9b6e){if(_0x205b9c){return _0x205b9c[_0xb5db('0x1f')](0x1f4)['json']({'errors':[{'message':_0xb5db('0x22'),'type':'api.jira'}]});}});_0x438dc3['write'](_0x5e2a88);_0x438dc3[_0xb5db('0x1e')]();}exports[_0xb5db('0x23')]=openIssue;exports[_0xb5db('0x24')]=function(_0x284cc2,_0x42799f){_0x284cc2[_0xb5db('0x25')]['ip']=_0x284cc2['headers'][_0xb5db('0x26')]||_0x284cc2[_0xb5db('0x27')][_0xb5db('0x28')]||_0x284cc2['socket'][_0xb5db('0x28')]||_0x284cc2['connection'][_0xb5db('0x29')]['remoteAddress'];return openIssue(_0x284cc2[_0xb5db('0x25')],_0x42799f);}; \ No newline at end of file +var _0xca87=['utf8','data','end','statusCode','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','api','support','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11501','oldToken','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','base64','request','setEncoding'];(function(_0x35980a,_0x45bd42){var _0x1c068f=function(_0x425dc0){while(--_0x425dc0){_0x35980a['push'](_0x35980a['shift']());}};_0x1c068f(++_0x45bd42);}(_0xca87,0x121));var _0x7ca8=function(_0x1ecb2b,_0x5d2346){_0x1ecb2b=_0x1ecb2b-0x0;var _0xafdb79=_0xca87[_0x1ecb2b];return _0xafdb79;};'use strict';var BPromise=require(_0x7ca8('0x0'));var https=require(_0x7ca8('0x1'));var logger=require('../../config/logger')(_0x7ca8('0x2'));var USERNAME=_0x7ca8('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x1b5a7e,_0x1b7195){var _0x5dce41={'fields':{'project':{'key':_0x1b5a7e[_0x7ca8('0x4')]||_0x7ca8('0x5')},'summary':(_0x1b5a7e['summary']||_0x7ca8('0x6'))+_0x7ca8('0x7')+_0x1b5a7e['ip'],'description':_0x1b5a7e[_0x7ca8('0x8')]||JSON[_0x7ca8('0x9')](_0x1b5a7e),'issuetype':{'name':_0x1b5a7e[_0x7ca8('0xa')]||'Bug'}}};_0x5dce41['fields']['customfield_11500']=_0x1b5a7e['email'];_0x5dce41[_0x7ca8('0xb')][_0x7ca8('0xc')]=_0x1b5a7e[_0x7ca8('0xd')];_0x5dce41[_0x7ca8('0xb')]['customfield_11502']=_0x1b5a7e[_0x7ca8('0xe')];_0x5dce41[_0x7ca8('0xb')][_0x7ca8('0xf')]=_0x1b5a7e['name'];_0x5dce41['fields'][_0x7ca8('0x10')]=_0x1b5a7e[_0x7ca8('0x11')];_0x5dce41[_0x7ca8('0xb')][_0x7ca8('0x12')]=_0x1b5a7e['ip'];var _0x72f4e={'host':_0x7ca8('0x13'),'port':0x1bb,'path':_0x7ca8('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x7ca8('0x15'),'Authorization':_0x7ca8('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x7ca8('0x17'))}};var _0xf48999=JSON[_0x7ca8('0x9')](_0x5dce41);var _0x117c7b=https[_0x7ca8('0x18')](_0x72f4e,function(_0x4e6595){_0x4e6595[_0x7ca8('0x19')](_0x7ca8('0x1a'));var _0x5273d5='';_0x4e6595['on'](_0x7ca8('0x1b'),function(_0x2c2ded){_0x5273d5+=_0x2c2ded;});_0x4e6595['on'](_0x7ca8('0x1c'),function(){if(_0x1b7195){return _0x1b7195['status'](_0x4e6595[_0x7ca8('0x1d')])[_0x7ca8('0x1e')](JSON[_0x7ca8('0x1f')](_0x5273d5));}});});_0x117c7b['on'](_0x7ca8('0x20'),function(_0x3e6258){if(_0x1b7195){return _0x1b7195[_0x7ca8('0x21')](0x1f4)['json']({'errors':[{'message':_0x7ca8('0x22'),'type':_0x7ca8('0x23')}]});}});_0x117c7b[_0x7ca8('0x24')](_0xf48999);_0x117c7b[_0x7ca8('0x1c')]();}exports[_0x7ca8('0x25')]=openIssue;exports[_0x7ca8('0x26')]=function(_0x22fe56,_0x207228){_0x22fe56['body']['ip']=_0x22fe56[_0x7ca8('0x27')][_0x7ca8('0x28')]||_0x22fe56[_0x7ca8('0x29')][_0x7ca8('0x2a')]||_0x22fe56[_0x7ca8('0x2b')]['remoteAddress']||_0x22fe56['connection'][_0x7ca8('0x2b')]['remoteAddress'];return openIssue(_0x22fe56[_0x7ca8('0x2c')],_0x207228);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 31b0bb3..0b50bd6 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 _0x34f2=['Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util','express'];(function(_0x5d1508,_0x3738cc){var _0x5ea529=function(_0x452f05){while(--_0x452f05){_0x5d1508['push'](_0x5d1508['shift']());}};_0x5ea529(++_0x3738cc);}(_0x34f2,0xbb));var _0x234f=function(_0x5cd0b0,_0x49f496){_0x5cd0b0=_0x5cd0b0-0x0;var _0x10b0e9=_0x34f2[_0x5cd0b0];return _0x10b0e9;};'use strict';var multer=require(_0x234f('0x0'));var util=require(_0x234f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x234f('0x2'));var router=express[_0x234f('0x3')]();var auth=require(_0x234f('0x4'));var interaction=require(_0x234f('0x5'));var config=require('../../config/environment');var controller=require(_0x234f('0x6'));router[_0x234f('0x7')]('/',auth[_0x234f('0x8')](),controller[_0x234f('0x9')]);router[_0x234f('0x7')](_0x234f('0xa'),auth[_0x234f('0x8')](),controller[_0x234f('0xb')]);router[_0x234f('0x7')](_0x234f('0xc'),auth['isAuthenticated'](),controller[_0x234f('0xd')]);router['post']('/',auth[_0x234f('0x8')](),controller['create']);router[_0x234f('0xe')](_0x234f('0xc'),auth[_0x234f('0x8')](),controller[_0x234f('0xf')]);router[_0x234f('0x10')](_0x234f('0xc'),auth[_0x234f('0x8')](),controller[_0x234f('0x11')]);module[_0x234f('0x12')]=router; \ No newline at end of file +var _0x98dd=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x564064,_0x3af5f8){var _0x319322=function(_0x3c6637){while(--_0x3c6637){_0x564064['push'](_0x564064['shift']());}};_0x319322(++_0x3af5f8);}(_0x98dd,0xa9));var _0xd98d=function(_0xd82416,_0x788ce0){_0xd82416=_0xd82416-0x0;var _0xd24347=_0x98dd[_0xd82416];return _0xd24347;};'use strict';var multer=require(_0xd98d('0x0'));var util=require(_0xd98d('0x1'));var path=require(_0xd98d('0x2'));var timeout=require(_0xd98d('0x3'));var express=require(_0xd98d('0x4'));var router=express[_0xd98d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd98d('0x6'));var config=require(_0xd98d('0x7'));var controller=require(_0xd98d('0x8'));router[_0xd98d('0x9')]('/',auth[_0xd98d('0xa')](),controller[_0xd98d('0xb')]);router[_0xd98d('0x9')](_0xd98d('0xc'),auth[_0xd98d('0xa')](),controller[_0xd98d('0xd')]);router[_0xd98d('0x9')](_0xd98d('0xe'),auth[_0xd98d('0xa')](),controller[_0xd98d('0xf')]);router[_0xd98d('0x10')]('/',auth[_0xd98d('0xa')](),controller[_0xd98d('0x11')]);router[_0xd98d('0x12')]('/:id',auth[_0xd98d('0xa')](),controller[_0xd98d('0x13')]);router[_0xd98d('0x14')](_0xd98d('0xe'),auth[_0xd98d('0xa')](),controller[_0xd98d('0x15')]);module[_0xd98d('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 94d4317..5b66a1f 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 _0x64f8=['TEXT','long','exports','STRING'];(function(_0x5c1548,_0x4a139c){var _0x319502=function(_0x3bd143){while(--_0x3bd143){_0x5c1548['push'](_0x5c1548['shift']());}};_0x319502(++_0x4a139c);}(_0x64f8,0x6e));var _0x864f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x64f8[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x864f('0x0')]={'question':{'type':Sequelize[_0x864f('0x1')]},'answer':{'type':Sequelize[_0x864f('0x2')](_0x864f('0x3'))},'membername':{'type':Sequelize[_0x864f('0x1')]},'projectname':{'type':Sequelize[_0x864f('0x1')]},'queue':{'type':Sequelize[_0x864f('0x1')]},'uniqueid':{'type':Sequelize[_0x864f('0x1')]},'calleridname':{'type':Sequelize[_0x864f('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x864f('0x1')]}}; \ No newline at end of file +var _0x57be=['STRING','TEXT','long','exports'];(function(_0x532378,_0x7501ca){var _0x311568=function(_0x2a4cb7){while(--_0x2a4cb7){_0x532378['push'](_0x532378['shift']());}};_0x311568(++_0x7501ca);}(_0x57be,0x67));var _0xe57b=function(_0x204e65,_0x4309fd){_0x204e65=_0x204e65-0x0;var _0x2057d8=_0x57be[_0x204e65];return _0x2057d8;};'use strict';var Sequelize=require('sequelize');module[_0xe57b('0x0')]={'question':{'type':Sequelize[_0xe57b('0x1')]},'answer':{'type':Sequelize[_0xe57b('0x2')](_0xe57b('0x3'))},'membername':{'type':Sequelize[_0xe57b('0x1')]},'projectname':{'type':Sequelize[_0xe57b('0x1')]},'queue':{'type':Sequelize[_0xe57b('0x1')]},'uniqueid':{'type':Sequelize[_0xe57b('0x1')]},'calleridname':{'type':Sequelize[_0xe57b('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xe57b('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 4cc2b55..ee9cf64 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 _0x7762=['destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','save','update','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','VIRTUAL','options','count','then','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find'];(function(_0x91fab6,_0x4bbc0d){var _0x6fcbe3=function(_0x321bf7){while(--_0x321bf7){_0x91fab6['push'](_0x91fab6['shift']());}};_0x6fcbe3(++_0x4bbc0d);}(_0x7762,0xda));var _0x2776=function(_0x31380a,_0x1fadd3){_0x31380a=_0x31380a-0x0;var _0x21c02e=_0x7762[_0x31380a];return _0x21c02e;};'use strict';var pdf=require(_0x2776('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2776('0x1'));var zipdir=require(_0x2776('0x2'));var jsonpatch=require(_0x2776('0x3'));var rp=require(_0x2776('0x4'));var moment=require(_0x2776('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2776('0x6'));var util=require('util');var path=require(_0x2776('0x7'));var sox=require('sox');var csv=require(_0x2776('0x8'));var ejs=require(_0x2776('0x9'));var fs=require('fs');var _=require(_0x2776('0xa'));var squel=require(_0x2776('0xb'));var crypto=require(_0x2776('0xc'));var jsforce=require(_0x2776('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2776('0x8'));var querystring=require(_0x2776('0xe'));var Papa=require(_0x2776('0xf'));var Redis=require(_0x2776('0x10'));var authService=require(_0x2776('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2776('0x12'));var hardwareService=require(_0x2776('0x13'));var logger=require(_0x2776('0x14'))(_0x2776('0x15'));var utils=require(_0x2776('0x16'));var config=require(_0x2776('0x17'));var db=require(_0x2776('0x18'))['db'];function respondWithStatusCode(_0x38f50b,_0x110a88){_0x110a88=_0x110a88||0xcc;return function(_0x121222){if(_0x121222){return _0x38f50b['sendStatus'](_0x110a88);}return _0x38f50b[_0x2776('0x19')](_0x110a88)[_0x2776('0x1a')]();};}function respondWithResult(_0x1811f6,_0x50fafd){_0x50fafd=_0x50fafd||0xc8;return function(_0x4d0233){if(_0x4d0233){return _0x1811f6[_0x2776('0x19')](_0x50fafd)[_0x2776('0x1b')](_0x4d0233);}};}function respondWithFilteredResult(_0xc9d825,_0xc4eceb){return function(_0x63a21){if(_0x63a21){var _0x4dfccb=_0x63a21['count'],_0x435ce9=_0xc4eceb[_0x2776('0x1c')],_0x3a8e83=_0xc4eceb[_0x2776('0x1c')]+_0xc4eceb[_0x2776('0x1d')],_0xb37b4f;if(_0x3a8e83>=_0x4dfccb){_0x3a8e83=_0x4dfccb;_0xb37b4f=0xc8;}else{_0xb37b4f=0xce;}_0xc9d825[_0x2776('0x19')](_0xb37b4f);return _0xc9d825['set'](_0x2776('0x1e'),_0x435ce9+'-'+_0x3a8e83+'/'+_0x4dfccb)['json'](_0x63a21);}return null;};}function patchUpdates(_0x4af633){return function(_0x2f21ad){try{jsonpatch[_0x2776('0x1f')](_0x2f21ad,_0x4af633,!![]);}catch(_0x469c01){return BPromise[_0x2776('0x20')](_0x469c01);}return _0x2f21ad[_0x2776('0x21')]();};}function saveUpdates(_0x52ad61,_0x394b70){return function(_0x2d7244){if(_0x2d7244){return _0x2d7244[_0x2776('0x22')](_0x52ad61)['then'](function(_0x1fa59c){return _0x1fa59c;});}return null;};}function removeEntity(_0xee760a,_0x16e833){return function(_0x554300){if(_0x554300){return _0x554300['destroy']()['then'](function(){_0xee760a[_0x2776('0x19')](0xcc)[_0x2776('0x1a')]();});}};}function handleEntityNotFound(_0xd67989,_0x227f40){return function(_0x477623){if(!_0x477623){_0xd67989['sendStatus'](0x194);}return _0x477623;};}function handleError(_0x1e6dfc,_0xa0fb15){_0xa0fb15=_0xa0fb15||0x1f4;return function(_0x2e5665){logger[_0x2776('0x23')](_0x2e5665[_0x2776('0x24')]);if(_0x2e5665['name']){delete _0x2e5665[_0x2776('0x25')];}_0x1e6dfc[_0x2776('0x19')](_0xa0fb15)[_0x2776('0x26')](_0x2e5665);};}exports[_0x2776('0x27')]=function(_0x5ef86b,_0x91267d){var _0xd8d6c7={},_0x386786={},_0x40a3dd={'count':0x0,'rows':[]};var _0x1c37aa=_['map'](db[_0x2776('0x28')][_0x2776('0x29')],function(_0x418fed){return{'name':_0x418fed['fieldName'],'type':_0x418fed[_0x2776('0x2a')]['key']};});_0x386786[_0x2776('0x2b')]=_[_0x2776('0x2c')](_0x1c37aa,'name');_0x386786[_0x2776('0x2d')]=_['keys'](_0x5ef86b['query']);_0x386786[_0x2776('0x2e')]=_[_0x2776('0x2f')](_0x386786[_0x2776('0x2b')],_0x386786[_0x2776('0x2d')]);_0xd8d6c7[_0x2776('0x30')]=_[_0x2776('0x2f')](_0x386786[_0x2776('0x2b')],qs[_0x2776('0x31')](_0x5ef86b[_0x2776('0x2d')][_0x2776('0x31')]));_0xd8d6c7[_0x2776('0x30')]=_0xd8d6c7[_0x2776('0x30')]['length']?_0xd8d6c7['attributes']:_0x386786[_0x2776('0x2b')];if(!_0x5ef86b['query'][_0x2776('0x32')]('nolimit')){_0xd8d6c7[_0x2776('0x1d')]=qs[_0x2776('0x1d')](_0x5ef86b[_0x2776('0x2d')][_0x2776('0x1d')]);_0xd8d6c7[_0x2776('0x1c')]=qs['offset'](_0x5ef86b[_0x2776('0x2d')][_0x2776('0x1c')]);}_0xd8d6c7['order']=qs[_0x2776('0x33')](_0x5ef86b['query'][_0x2776('0x33')]);_0xd8d6c7[_0x2776('0x34')]=qs['filters'](_['pick'](_0x5ef86b[_0x2776('0x2d')],_0x386786[_0x2776('0x2e')]),_0x1c37aa);if(_0x5ef86b[_0x2776('0x2d')][_0x2776('0x35')]){_0xd8d6c7['where']=_['merge'](_0xd8d6c7[_0x2776('0x34')],{'$or':_[_0x2776('0x2c')](_0x1c37aa,function(_0x7670f8){if(_0x7670f8[_0x2776('0x2a')]!==_0x2776('0x36')){var _0x280b64={};_0x280b64[_0x7670f8[_0x2776('0x25')]]={'$like':'%'+_0x5ef86b[_0x2776('0x2d')]['filter']+'%'};return _0x280b64;}})});}_0xd8d6c7=_['merge']({},_0xd8d6c7,_0x5ef86b[_0x2776('0x37')]);var _0x58d4db={'where':_0xd8d6c7[_0x2776('0x34')]};return db[_0x2776('0x28')][_0x2776('0x38')](_0x58d4db)[_0x2776('0x39')](function(_0x596251){_0x40a3dd['count']=_0x596251;if(_0x5ef86b[_0x2776('0x2d')][_0x2776('0x3a')]){_0xd8d6c7[_0x2776('0x3b')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x2776('0x3c')](_0xd8d6c7);})[_0x2776('0x39')](function(_0x28dbec){_0x40a3dd[_0x2776('0x3d')]=_0x28dbec;return _0x40a3dd;})[_0x2776('0x39')](respondWithFilteredResult(_0x91267d,_0xd8d6c7))[_0x2776('0x3e')](handleError(_0x91267d,null));};exports[_0x2776('0x3f')]=function(_0x3bacf3,_0x226cb3){var _0x3aad8e={'raw':!![],'where':{'id':_0x3bacf3[_0x2776('0x40')]['id']}},_0x409676={};_0x409676[_0x2776('0x2b')]=_[_0x2776('0x41')](db[_0x2776('0x28')][_0x2776('0x29')]);_0x409676['query']=_['keys'](_0x3bacf3['query']);_0x409676[_0x2776('0x2e')]=_[_0x2776('0x2f')](_0x409676[_0x2776('0x2b')],_0x409676[_0x2776('0x2d')]);_0x3aad8e[_0x2776('0x30')]=_[_0x2776('0x2f')](_0x409676['model'],qs[_0x2776('0x31')](_0x3bacf3['query']['fields']));_0x3aad8e[_0x2776('0x30')]=_0x3aad8e['attributes'][_0x2776('0x42')]?_0x3aad8e[_0x2776('0x30')]:_0x409676['model'];if(_0x3bacf3[_0x2776('0x2d')][_0x2776('0x3a')]){_0x3aad8e[_0x2776('0x3b')]=[{'all':!![]}];}_0x3aad8e=_['merge']({},_0x3aad8e,_0x3bacf3[_0x2776('0x37')]);return db[_0x2776('0x28')]['find'](_0x3aad8e)[_0x2776('0x39')](handleEntityNotFound(_0x226cb3,null))[_0x2776('0x39')](respondWithResult(_0x226cb3,null))[_0x2776('0x3e')](handleError(_0x226cb3,null));};exports[_0x2776('0x43')]=function(_0x505970,_0x217144){return db[_0x2776('0x28')]['create'](_0x505970['body'],{})[_0x2776('0x39')](respondWithResult(_0x217144,0xc9))[_0x2776('0x3e')](handleError(_0x217144,null));};exports['update']=function(_0x2b5e45,_0x487d6f){if(_0x2b5e45[_0x2776('0x44')]['id']){delete _0x2b5e45[_0x2776('0x44')]['id'];}return db['JscriptyAnswerReport'][_0x2776('0x45')]({'where':{'id':_0x2b5e45['params']['id']}})[_0x2776('0x39')](handleEntityNotFound(_0x487d6f,null))[_0x2776('0x39')](saveUpdates(_0x2b5e45[_0x2776('0x44')],null))[_0x2776('0x39')](respondWithResult(_0x487d6f,null))[_0x2776('0x3e')](handleError(_0x487d6f,null));};exports[_0x2776('0x46')]=function(_0x2f5481,_0xc317bb){return db[_0x2776('0x28')]['find']({'where':{'id':_0x2f5481[_0x2776('0x40')]['id']}})['then'](handleEntityNotFound(_0xc317bb,null))[_0x2776('0x39')](removeEntity(_0xc317bb,null))[_0x2776('0x3e')](handleError(_0xc317bb,null));};exports[_0x2776('0x47')]=function(_0x20d64a,_0x4eb103){return db[_0x2776('0x28')][_0x2776('0x47')]()[_0x2776('0x39')](respondWithResult(_0x4eb103,null))[_0x2776('0x3e')](handleError(_0x4eb103,null));}; \ No newline at end of file +var _0x52b7=['sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','keys','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','count','offset','limit','status','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x52b7,0x13a));var _0x752b=function(_0x81eb80,_0x2743d7){_0x81eb80=_0x81eb80-0x0;var _0x290cce=_0x52b7[_0x81eb80];return _0x290cce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x752b('0x0'));var rimraf=require(_0x752b('0x1'));var zipdir=require(_0x752b('0x2'));var jsonpatch=require(_0x752b('0x3'));var rp=require(_0x752b('0x4'));var moment=require(_0x752b('0x5'));var BPromise=require(_0x752b('0x6'));var Mustache=require(_0x752b('0x7'));var util=require(_0x752b('0x8'));var path=require(_0x752b('0x9'));var sox=require(_0x752b('0xa'));var csv=require(_0x752b('0xb'));var ejs=require(_0x752b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x752b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x752b('0xe'));var toCsv=require(_0x752b('0xb'));var querystring=require(_0x752b('0xf'));var Papa=require('papaparse');var Redis=require(_0x752b('0x10'));var authService=require(_0x752b('0x11'));var qs=require(_0x752b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x752b('0x13'));var logger=require(_0x752b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x752b('0x15'));var db=require(_0x752b('0x16'))['db'];function respondWithStatusCode(_0x4f7e65,_0x4e04dc){_0x4e04dc=_0x4e04dc||0xcc;return function(_0x52d092){if(_0x52d092){return _0x4f7e65['sendStatus'](_0x4e04dc);}return _0x4f7e65['status'](_0x4e04dc)[_0x752b('0x17')]();};}function respondWithResult(_0x229345,_0x373496){_0x373496=_0x373496||0xc8;return function(_0x4380ae){if(_0x4380ae){return _0x229345['status'](_0x373496)['json'](_0x4380ae);}};}function respondWithFilteredResult(_0x1a3d78,_0x315787){return function(_0x277592){if(_0x277592){var _0x4bbca0=_0x277592[_0x752b('0x18')],_0x3b3cd8=_0x315787[_0x752b('0x19')],_0x729f33=_0x315787[_0x752b('0x19')]+_0x315787[_0x752b('0x1a')],_0x269786;if(_0x729f33>=_0x4bbca0){_0x729f33=_0x4bbca0;_0x269786=0xc8;}else{_0x269786=0xce;}_0x1a3d78[_0x752b('0x1b')](_0x269786);return _0x1a3d78[_0x752b('0x1c')](_0x752b('0x1d'),_0x3b3cd8+'-'+_0x729f33+'/'+_0x4bbca0)[_0x752b('0x1e')](_0x277592);}return null;};}function patchUpdates(_0x57359d){return function(_0x3bf31b){try{jsonpatch['apply'](_0x3bf31b,_0x57359d,!![]);}catch(_0x3f8920){return BPromise[_0x752b('0x1f')](_0x3f8920);}return _0x3bf31b[_0x752b('0x20')]();};}function saveUpdates(_0xcf0835,_0x2a7672){return function(_0x4fc03e){if(_0x4fc03e){return _0x4fc03e[_0x752b('0x21')](_0xcf0835)[_0x752b('0x22')](function(_0x348bfc){return _0x348bfc;});}return null;};}function removeEntity(_0x2d91f8,_0x48abd8){return function(_0x118b10){if(_0x118b10){return _0x118b10[_0x752b('0x23')]()[_0x752b('0x22')](function(){_0x2d91f8[_0x752b('0x1b')](0xcc)[_0x752b('0x17')]();});}};}function handleEntityNotFound(_0x35d6e8,_0x451047){return function(_0x4c8330){if(!_0x4c8330){_0x35d6e8[_0x752b('0x24')](0x194);}return _0x4c8330;};}function handleError(_0x4862ee,_0x549ac1){_0x549ac1=_0x549ac1||0x1f4;return function(_0x11aa6e){logger[_0x752b('0x25')](_0x11aa6e[_0x752b('0x26')]);if(_0x11aa6e[_0x752b('0x27')]){delete _0x11aa6e[_0x752b('0x27')];}_0x4862ee[_0x752b('0x1b')](_0x549ac1)[_0x752b('0x28')](_0x11aa6e);};}exports[_0x752b('0x29')]=function(_0x461834,_0x46e79d){var _0x2c83e3={},_0x2918bb={},_0x6a3681={'count':0x0,'rows':[]};var _0x3adc8f=_[_0x752b('0x2a')](db[_0x752b('0x2b')][_0x752b('0x2c')],function(_0x5e5502){return{'name':_0x5e5502[_0x752b('0x2d')],'type':_0x5e5502[_0x752b('0x2e')][_0x752b('0x2f')]};});_0x2918bb[_0x752b('0x30')]=_[_0x752b('0x2a')](_0x3adc8f,_0x752b('0x27'));_0x2918bb['query']=_['keys'](_0x461834[_0x752b('0x31')]);_0x2918bb[_0x752b('0x32')]=_[_0x752b('0x33')](_0x2918bb['model'],_0x2918bb[_0x752b('0x31')]);_0x2c83e3[_0x752b('0x34')]=_[_0x752b('0x33')](_0x2918bb[_0x752b('0x30')],qs[_0x752b('0x35')](_0x461834['query'][_0x752b('0x35')]));_0x2c83e3['attributes']=_0x2c83e3[_0x752b('0x34')][_0x752b('0x36')]?_0x2c83e3[_0x752b('0x34')]:_0x2918bb['model'];if(!_0x461834[_0x752b('0x31')][_0x752b('0x37')]('nolimit')){_0x2c83e3[_0x752b('0x1a')]=qs['limit'](_0x461834[_0x752b('0x31')][_0x752b('0x1a')]);_0x2c83e3[_0x752b('0x19')]=qs['offset'](_0x461834['query']['offset']);}_0x2c83e3['order']=qs[_0x752b('0x38')](_0x461834[_0x752b('0x31')][_0x752b('0x38')]);_0x2c83e3[_0x752b('0x39')]=qs[_0x752b('0x32')](_[_0x752b('0x3a')](_0x461834['query'],_0x2918bb['filters']),_0x3adc8f);if(_0x461834[_0x752b('0x31')][_0x752b('0x3b')]){_0x2c83e3[_0x752b('0x39')]=_['merge'](_0x2c83e3[_0x752b('0x39')],{'$or':_['map'](_0x3adc8f,function(_0x1714e6){if(_0x1714e6[_0x752b('0x2e')]!==_0x752b('0x3c')){var _0x1f71a7={};_0x1f71a7[_0x1714e6[_0x752b('0x27')]]={'$like':'%'+_0x461834[_0x752b('0x31')][_0x752b('0x3b')]+'%'};return _0x1f71a7;}})});}_0x2c83e3=_[_0x752b('0x3d')]({},_0x2c83e3,_0x461834[_0x752b('0x3e')]);var _0x5f3d85={'where':_0x2c83e3[_0x752b('0x39')]};return db[_0x752b('0x2b')][_0x752b('0x18')](_0x5f3d85)[_0x752b('0x22')](function(_0x182711){_0x6a3681['count']=_0x182711;if(_0x461834[_0x752b('0x31')][_0x752b('0x3f')]){_0x2c83e3['include']=[{'all':!![]}];}return db[_0x752b('0x2b')][_0x752b('0x40')](_0x2c83e3);})[_0x752b('0x22')](function(_0x305816){_0x6a3681[_0x752b('0x41')]=_0x305816;return _0x6a3681;})[_0x752b('0x22')](respondWithFilteredResult(_0x46e79d,_0x2c83e3))['catch'](handleError(_0x46e79d,null));};exports['show']=function(_0xaae0ff,_0x169ff6){var _0xad180d={'raw':!![],'where':{'id':_0xaae0ff[_0x752b('0x42')]['id']}},_0x3b27bd={};_0x3b27bd[_0x752b('0x30')]=_[_0x752b('0x43')](db[_0x752b('0x2b')][_0x752b('0x2c')]);_0x3b27bd[_0x752b('0x31')]=_[_0x752b('0x43')](_0xaae0ff[_0x752b('0x31')]);_0x3b27bd['filters']=_[_0x752b('0x33')](_0x3b27bd[_0x752b('0x30')],_0x3b27bd[_0x752b('0x31')]);_0xad180d['attributes']=_['intersection'](_0x3b27bd['model'],qs[_0x752b('0x35')](_0xaae0ff['query'][_0x752b('0x35')]));_0xad180d[_0x752b('0x34')]=_0xad180d[_0x752b('0x34')][_0x752b('0x36')]?_0xad180d[_0x752b('0x34')]:_0x3b27bd[_0x752b('0x30')];if(_0xaae0ff[_0x752b('0x31')][_0x752b('0x3f')]){_0xad180d[_0x752b('0x44')]=[{'all':!![]}];}_0xad180d=_['merge']({},_0xad180d,_0xaae0ff[_0x752b('0x3e')]);return db[_0x752b('0x2b')][_0x752b('0x45')](_0xad180d)[_0x752b('0x22')](handleEntityNotFound(_0x169ff6,null))[_0x752b('0x22')](respondWithResult(_0x169ff6,null))[_0x752b('0x46')](handleError(_0x169ff6,null));};exports[_0x752b('0x47')]=function(_0x13554c,_0x531c72){return db[_0x752b('0x2b')][_0x752b('0x47')](_0x13554c[_0x752b('0x48')],{})[_0x752b('0x22')](respondWithResult(_0x531c72,0xc9))[_0x752b('0x46')](handleError(_0x531c72,null));};exports[_0x752b('0x21')]=function(_0x36bd12,_0x4c9c42){if(_0x36bd12['body']['id']){delete _0x36bd12[_0x752b('0x48')]['id'];}return db[_0x752b('0x2b')][_0x752b('0x45')]({'where':{'id':_0x36bd12[_0x752b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c9c42,null))[_0x752b('0x22')](saveUpdates(_0x36bd12[_0x752b('0x48')],null))[_0x752b('0x22')](respondWithResult(_0x4c9c42,null))['catch'](handleError(_0x4c9c42,null));};exports['destroy']=function(_0xd5ca13,_0x34effa){return db[_0x752b('0x2b')][_0x752b('0x45')]({'where':{'id':_0xd5ca13['params']['id']}})[_0x752b('0x22')](handleEntityNotFound(_0x34effa,null))[_0x752b('0x22')](removeEntity(_0x34effa,null))[_0x752b('0x46')](handleError(_0x34effa,null));};exports[_0x752b('0x49')]=function(_0x48b52b,_0x583fb8){return db[_0x752b('0x2b')]['describe']()[_0x752b('0x22')](respondWithResult(_0x583fb8,null))[_0x752b('0x46')](handleError(_0x583fb8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 4fb6ecc..8fe1763 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 _0xfbcb=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0xfbcb,0x1b4));var _0xbfbc=function(_0x22ecb6,_0xe9f768){_0x22ecb6=_0x22ecb6-0x0;var _0x32bacd=_0xfbcb[_0x22ecb6];return _0x32bacd;};'use strict';var _=require(_0xbfbc('0x0'));var util=require(_0xbfbc('0x1'));var logger=require(_0xbfbc('0x2'))('api');var moment=require(_0xbfbc('0x3'));var BPromise=require(_0xbfbc('0x4'));var rp=require(_0xbfbc('0x5'));var fs=require('fs');var path=require(_0xbfbc('0x6'));var rimraf=require(_0xbfbc('0x7'));var config=require(_0xbfbc('0x8'));var attributes=require(_0xbfbc('0x9'));module[_0xbfbc('0xa')]=function(_0x30ec27,_0x510da6){return _0x30ec27[_0xbfbc('0xb')]('JscriptyAnswerReport',attributes,{'tableName':_0xbfbc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9c7=['report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x2dd2b2,_0x14b504){var _0x5bdeb3=function(_0x139eb4){while(--_0x139eb4){_0x2dd2b2['push'](_0x2dd2b2['shift']());}};_0x5bdeb3(++_0x14b504);}(_0xe9c7,0xd9));var _0x7e9c=function(_0x16941a,_0x37bf83){_0x16941a=_0x16941a-0x0;var _0x30004e=_0xe9c7[_0x16941a];return _0x30004e;};'use strict';var _=require(_0x7e9c('0x0'));var util=require(_0x7e9c('0x1'));var logger=require('../../config/logger')(_0x7e9c('0x2'));var moment=require(_0x7e9c('0x3'));var BPromise=require(_0x7e9c('0x4'));var rp=require(_0x7e9c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e9c('0x6'));var config=require(_0x7e9c('0x7'));var attributes=require(_0x7e9c('0x8'));module[_0x7e9c('0x9')]=function(_0x7e558,_0x50b77c){return _0x7e558[_0x7e9c('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0x7e9c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 061c6e7..3075ec4 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 _0x1d6c=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x1018bb,_0x4518d2){var _0x569984=function(_0x4a97e6){while(--_0x4a97e6){_0x1018bb['push'](_0x1018bb['shift']());}};_0x569984(++_0x4518d2);}(_0x1d6c,0xc9));var _0xc1d6=function(_0xaa4f3,_0x37be20){_0xaa4f3=_0xaa4f3-0x0;var _0x163cc9=_0x1d6c[_0xaa4f3];return _0x163cc9;};'use strict';var _=require('lodash');var util=require(_0xc1d6('0x0'));var moment=require('moment');var BPromise=require(_0xc1d6('0x1'));var rs=require(_0xc1d6('0x2'));var fs=require('fs');var Redis=require(_0xc1d6('0x3'));var db=require(_0xc1d6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1d6('0x5'))(_0xc1d6('0x6'));var config=require(_0xc1d6('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56c950,_0x287b18,_0x4b6e19){return new BPromise(function(_0x2992f9,_0xb34cfb){return client[_0xc1d6('0x8')](_0x56c950,_0x4b6e19)[_0xc1d6('0x9')](function(_0x584f55){logger[_0xc1d6('0xa')](_0xc1d6('0xb'),_0x287b18,'request\x20sent');logger[_0xc1d6('0xc')](_0xc1d6('0xd'),_0x287b18,_0xc1d6('0xe'),JSON['stringify'](_0x584f55));if(_0x584f55['error']){if(_0x584f55[_0xc1d6('0xf')][_0xc1d6('0x10')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x287b18,_0x584f55[_0xc1d6('0xf')][_0xc1d6('0x11')]);return _0xb34cfb(_0x584f55['error'][_0xc1d6('0x11')]);}logger[_0xc1d6('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x287b18,_0x584f55[_0xc1d6('0xf')][_0xc1d6('0x11')]);return _0x2992f9(_0x584f55[_0xc1d6('0xf')]['message']);}else{logger[_0xc1d6('0xa')](_0xc1d6('0xb'),_0x287b18,_0xc1d6('0xe'));_0x2992f9(_0x584f55[_0xc1d6('0x12')][_0xc1d6('0x11')]);}})[_0xc1d6('0x13')](function(_0x18c3cb){logger['error'](_0xc1d6('0xb'),_0x287b18,_0x18c3cb);_0xb34cfb(_0x18c3cb);});});} \ No newline at end of file +var _0x28ea=['client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5b9abb,_0x242e16){var _0x30c6d6=function(_0x59cac9){while(--_0x59cac9){_0x5b9abb['push'](_0x5b9abb['shift']());}};_0x30c6d6(++_0x242e16);}(_0x28ea,0x109));var _0xa28e=function(_0x232459,_0x2001cf){_0x232459=_0x232459-0x0;var _0x25f607=_0x28ea[_0x232459];return _0x25f607;};'use strict';var _=require('lodash');var util=require(_0xa28e('0x0'));var moment=require(_0xa28e('0x1'));var BPromise=require(_0xa28e('0x2'));var rs=require(_0xa28e('0x3'));var fs=require('fs');var Redis=require(_0xa28e('0x4'));var db=require(_0xa28e('0x5'))['db'];var utils=require(_0xa28e('0x6'));var logger=require(_0xa28e('0x7'))(_0xa28e('0x8'));var config=require(_0xa28e('0x9'));var jayson=require(_0xa28e('0xa'));var client=jayson[_0xa28e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e23c1,_0xd19bf2,_0x2edf61){return new BPromise(function(_0x5e451b,_0x2b6e6b){return client[_0xa28e('0xc')](_0x4e23c1,_0x2edf61)[_0xa28e('0xd')](function(_0x1f22ae){logger[_0xa28e('0xe')](_0xa28e('0xf'),_0xd19bf2,_0xa28e('0x10'));logger[_0xa28e('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0xd19bf2,_0xa28e('0x10'),JSON[_0xa28e('0x12')](_0x1f22ae));if(_0x1f22ae[_0xa28e('0x13')]){if(_0x1f22ae[_0xa28e('0x13')]['code']===0x1f4){logger[_0xa28e('0x13')](_0xa28e('0xf'),_0xd19bf2,_0x1f22ae['error']['message']);return _0x2b6e6b(_0x1f22ae['error'][_0xa28e('0x14')]);}logger[_0xa28e('0x13')](_0xa28e('0xf'),_0xd19bf2,_0x1f22ae[_0xa28e('0x13')]['message']);return _0x5e451b(_0x1f22ae[_0xa28e('0x13')][_0xa28e('0x14')]);}else{logger['info'](_0xa28e('0xf'),_0xd19bf2,'request\x20sent');_0x5e451b(_0x1f22ae[_0xa28e('0x15')][_0xa28e('0x14')]);}})[_0xa28e('0x16')](function(_0x15884c){logger[_0xa28e('0x13')](_0xa28e('0xf'),_0xd19bf2,_0x15884c);_0x2b6e6b(_0x15884c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 78bc095..467dca1 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 _0x9b07=['get','isAuthenticated','index','/:id','/:id/sessions','getSessions','getAnswers','30s','getSummary','post','create','clone','put','update','delete','destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller'];(function(_0x32c4a5,_0xd7deca){var _0x5eae77=function(_0x242354){while(--_0x242354){_0x32c4a5['push'](_0x32c4a5['shift']());}};_0x5eae77(++_0xd7deca);}(_0x9b07,0x198));var _0x79b0=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9b07[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require(_0x79b0('0x0'));var path=require('path');var timeout=require(_0x79b0('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x79b0('0x2'));var interaction=require(_0x79b0('0x3'));var config=require(_0x79b0('0x4'));var controller=require(_0x79b0('0x5'));router[_0x79b0('0x6')]('/',auth[_0x79b0('0x7')](),controller[_0x79b0('0x8')]);router['get'](_0x79b0('0x9'),auth[_0x79b0('0x7')](),controller['show']);router[_0x79b0('0x6')](_0x79b0('0xa'),auth[_0x79b0('0x7')](),controller[_0x79b0('0xb')]);router[_0x79b0('0x6')]('/:id/answers',auth[_0x79b0('0x7')](),controller[_0x79b0('0xc')]);router[_0x79b0('0x6')]('/:id/summary',auth[_0x79b0('0x7')](),timeout(_0x79b0('0xd')),controller[_0x79b0('0xe')]);router[_0x79b0('0xf')]('/',auth[_0x79b0('0x7')](),controller[_0x79b0('0x10')]);router[_0x79b0('0xf')]('/:id/clone',auth[_0x79b0('0x7')](),controller[_0x79b0('0x11')]);router[_0x79b0('0x12')]('/:id',auth[_0x79b0('0x7')](),controller[_0x79b0('0x13')]);router[_0x79b0('0x14')]('/:id',auth[_0x79b0('0x7')](),controller[_0x79b0('0x15')]);module[_0x79b0('0x16')]=router; \ No newline at end of file +var _0x41a6=['multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','clone','update','delete','destroy','exports'];(function(_0x1e24b8,_0x333b2e){var _0x2122a3=function(_0x38883e){while(--_0x38883e){_0x1e24b8['push'](_0x1e24b8['shift']());}};_0x2122a3(++_0x333b2e);}(_0x41a6,0x1c8));var _0x641a=function(_0x16bae8,_0x548696){_0x16bae8=_0x16bae8-0x0;var _0x5b465f=_0x41a6[_0x16bae8];return _0x5b465f;};'use strict';var multer=require(_0x641a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x641a('0x1'));var express=require('express');var router=express[_0x641a('0x2')]();var auth=require(_0x641a('0x3'));var interaction=require(_0x641a('0x4'));var config=require(_0x641a('0x5'));var controller=require(_0x641a('0x6'));router['get']('/',auth[_0x641a('0x7')](),controller[_0x641a('0x8')]);router[_0x641a('0x9')](_0x641a('0xa'),auth[_0x641a('0x7')](),controller[_0x641a('0xb')]);router['get'](_0x641a('0xc'),auth['isAuthenticated'](),controller[_0x641a('0xd')]);router[_0x641a('0x9')](_0x641a('0xe'),auth[_0x641a('0x7')](),controller[_0x641a('0xf')]);router[_0x641a('0x9')](_0x641a('0x10'),auth[_0x641a('0x7')](),timeout('30s'),controller[_0x641a('0x11')]);router[_0x641a('0x12')]('/',auth[_0x641a('0x7')](),controller['create']);router[_0x641a('0x12')]('/:id/clone',auth['isAuthenticated'](),controller[_0x641a('0x13')]);router['put'](_0x641a('0xa'),auth[_0x641a('0x7')](),controller[_0x641a('0x14')]);router[_0x641a('0x15')]('/:id',auth[_0x641a('0x7')](),controller[_0x641a('0x16')]);module[_0x641a('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 7cce447..7d1a551 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 _0x7d5b=['formData','stringify','setDataValue','format','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','long'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x7d5b,0xa3));var _0xb7d5=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x7d5b[_0x243b59];return _0x3e1676;};'use strict';var Sequelize=require(_0xb7d5('0x0'));var _=require(_0xb7d5('0x1'));var util=require(_0xb7d5('0x2'));module['exports']={'name':{'type':Sequelize[_0xb7d5('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xb7d5('0x4')),'set':function(_0x43e547){if(_['isObjectLike'](_0x43e547)){this['setDataValue'](_0xb7d5('0x5'),JSON[_0xb7d5('0x6')](_0x43e547));}else if(_['isString'](_0x43e547)){this[_0xb7d5('0x7')]('formData',_0x43e547);}else{this[_0xb7d5('0x7')](_0xb7d5('0x5'),util[_0xb7d5('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xb7d5('0x9')]('name')||'',this['getDataValue'](_0xb7d5('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb7d5('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb7d5('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0xbf4b=['exports','STRING','name','TEXT','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xbf4b,0x12d));var _0xbbf4=function(_0x22a409,_0x1e7083){_0x22a409=_0x22a409-0x0;var _0x4ffcf0=_0xbf4b[_0x22a409];return _0x4ffcf0;};'use strict';var Sequelize=require(_0xbbf4('0x0'));var _=require(_0xbbf4('0x1'));var util=require(_0xbbf4('0x2'));module[_0xbbf4('0x3')]={'name':{'type':Sequelize[_0xbbf4('0x4')],'unique':_0xbbf4('0x5')},'description':{'type':Sequelize[_0xbbf4('0x4')]},'formData':{'type':Sequelize[_0xbbf4('0x6')]('long'),'set':function(_0x38efb1){if(_['isObjectLike'](_0x38efb1)){this['setDataValue'](_0xbbf4('0x7'),JSON[_0xbbf4('0x8')](_0x38efb1));}else if(_[_0xbbf4('0x9')](_0x38efb1)){this[_0xbbf4('0xa')]('formData',_0x38efb1);}else{this['setDataValue'](_0xbbf4('0x7'),util[_0xbbf4('0xb')](_0xbbf4('0xc'),this[_0xbbf4('0xd')]('name')||'',this['getDataValue'](_0xbbf4('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xbbf4('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 2d40ea7..4169662 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 _0x1917=['push','now','writeFileSync','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','sendStatus','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','Projects','UserProfileResource','end','stack','name','send','map','JscriptyProject','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','show','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','params','omit','updatedAt','createdAt','error','findOne','JscriptySessionReport','rows','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','getSummary','parse','startTime','JscriptyQuestionReport','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer'];(function(_0x5e1f0f,_0x45a0e7){var _0x99c34a=function(_0x66dbdb){while(--_0x66dbdb){_0x5e1f0f['push'](_0x5e1f0f['shift']());}};_0x99c34a(++_0x45a0e7);}(_0x1917,0xf2));var _0x7191=function(_0x29d0f0,_0x2282c0){_0x29d0f0=_0x29d0f0-0x0;var _0x1ae6f0=_0x1917[_0x29d0f0];return _0x1ae6f0;};'use strict';var pdf=require(_0x7191('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7191('0x1'));var zipdir=require(_0x7191('0x2'));var jsonpatch=require(_0x7191('0x3'));var rp=require(_0x7191('0x4'));var moment=require('moment');var BPromise=require(_0x7191('0x5'));var Mustache=require(_0x7191('0x6'));var util=require(_0x7191('0x7'));var path=require('path');var sox=require(_0x7191('0x8'));var csv=require(_0x7191('0x9'));var ejs=require(_0x7191('0xa'));var fs=require('fs');var _=require(_0x7191('0xb'));var squel=require('squel');var crypto=require(_0x7191('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7191('0xd'));var toCsv=require(_0x7191('0x9'));var querystring=require(_0x7191('0xe'));var Papa=require(_0x7191('0xf'));var Redis=require(_0x7191('0x10'));var authService=require(_0x7191('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7191('0x12'));var hardwareService=require(_0x7191('0x13'));var logger=require(_0x7191('0x14'))('api');var utils=require(_0x7191('0x15'));var config=require(_0x7191('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x325800,_0x5d6b15){_0x5d6b15=_0x5d6b15||0xcc;return function(_0x204561){if(_0x204561){return _0x325800['sendStatus'](_0x5d6b15);}return _0x325800[_0x7191('0x17')](_0x5d6b15)['end']();};}function respondWithResult(_0xd750f2,_0x35a44e){_0x35a44e=_0x35a44e||0xc8;return function(_0x28c3df){if(_0x28c3df){return _0xd750f2[_0x7191('0x17')](_0x35a44e)['json'](_0x28c3df);}};}function respondWithFilteredResult(_0x4aee55,_0x4eb8bf){return function(_0x5cbf24){if(_0x5cbf24){var _0xd21514=_0x5cbf24['count'],_0x162361=_0x4eb8bf['offset'],_0x169557=_0x4eb8bf[_0x7191('0x18')]+_0x4eb8bf[_0x7191('0x19')],_0x144db5;if(_0x169557>=_0xd21514){_0x169557=_0xd21514;_0x144db5=0xc8;}else{_0x144db5=0xce;}_0x4aee55[_0x7191('0x17')](_0x144db5);return _0x4aee55[_0x7191('0x1a')](_0x7191('0x1b'),_0x162361+'-'+_0x169557+'/'+_0xd21514)[_0x7191('0x1c')](_0x5cbf24);}return null;};}function patchUpdates(_0x381723){return function(_0x3e47cc){try{jsonpatch[_0x7191('0x1d')](_0x3e47cc,_0x381723,!![]);}catch(_0x30b108){return BPromise[_0x7191('0x1e')](_0x30b108);}return _0x3e47cc[_0x7191('0x1f')]();};}function saveUpdates(_0x20624c,_0x3ebff0){return function(_0x1a693d){if(_0x1a693d){return _0x1a693d[_0x7191('0x20')](_0x20624c)['then'](function(_0x3c24b9){return _0x3c24b9;});}return null;};}function removeEntity(_0xea45e2,_0x35ab0){return function(_0x1ca370){if(_0x1ca370){return _0x1ca370['destroy']()[_0x7191('0x21')](function(){var _0x549780=_0x1ca370[_0x7191('0x22')]({'plain':!![]});var _0x5a4962=_0x7191('0x23');return db[_0x7191('0x24')]['destroy']({'where':{'type':_0x5a4962,'resourceId':_0x549780['id']}})[_0x7191('0x21')](function(){return _0x1ca370;});})[_0x7191('0x21')](function(){_0xea45e2[_0x7191('0x17')](0xcc)[_0x7191('0x25')]();});}};}function handleEntityNotFound(_0x204a3a,_0x1d9d9d){return function(_0x320f47){if(!_0x320f47){_0x204a3a['sendStatus'](0x194);}return _0x320f47;};}function handleError(_0x584450,_0x5d5916){_0x5d5916=_0x5d5916||0x1f4;return function(_0x3ccaec){logger['error'](_0x3ccaec[_0x7191('0x26')]);if(_0x3ccaec[_0x7191('0x27')]){delete _0x3ccaec[_0x7191('0x27')];}_0x584450[_0x7191('0x17')](_0x5d5916)[_0x7191('0x28')](_0x3ccaec);};}exports['index']=function(_0x327c59,_0x1b9eea){var _0xad2a4b={},_0x5a9d21={},_0x2a09de={'count':0x0,'rows':[]};var _0x1d30dd=_[_0x7191('0x29')](db[_0x7191('0x2a')][_0x7191('0x2b')],function(_0x17b2e3){return{'name':_0x17b2e3['fieldName'],'type':_0x17b2e3[_0x7191('0x2c')][_0x7191('0x2d')]};});_0x5a9d21[_0x7191('0x2e')]=_[_0x7191('0x29')](_0x1d30dd,_0x7191('0x27'));_0x5a9d21[_0x7191('0x2f')]=_[_0x7191('0x30')](_0x327c59[_0x7191('0x2f')]);_0x5a9d21[_0x7191('0x31')]=_[_0x7191('0x32')](_0x5a9d21[_0x7191('0x2e')],_0x5a9d21[_0x7191('0x2f')]);_0xad2a4b['attributes']=_[_0x7191('0x32')](_0x5a9d21[_0x7191('0x2e')],qs[_0x7191('0x33')](_0x327c59[_0x7191('0x2f')][_0x7191('0x33')]));_0xad2a4b[_0x7191('0x34')]=_0xad2a4b['attributes'][_0x7191('0x35')]?_0xad2a4b['attributes']:_0x5a9d21[_0x7191('0x2e')];if(!_0x327c59[_0x7191('0x2f')][_0x7191('0x36')](_0x7191('0x37'))){_0xad2a4b['limit']=qs[_0x7191('0x19')](_0x327c59[_0x7191('0x2f')][_0x7191('0x19')]);_0xad2a4b['offset']=qs[_0x7191('0x18')](_0x327c59[_0x7191('0x2f')][_0x7191('0x18')]);}_0xad2a4b[_0x7191('0x38')]=qs[_0x7191('0x39')](_0x327c59[_0x7191('0x2f')][_0x7191('0x39')]);_0xad2a4b[_0x7191('0x3a')]=qs[_0x7191('0x31')](_[_0x7191('0x3b')](_0x327c59[_0x7191('0x2f')],_0x5a9d21[_0x7191('0x31')]),_0x1d30dd);if(_0x327c59[_0x7191('0x2f')][_0x7191('0x3c')]){_0xad2a4b[_0x7191('0x3a')]=_['merge'](_0xad2a4b[_0x7191('0x3a')],{'$or':_[_0x7191('0x29')](_0x1d30dd,function(_0x514820){if(_0x514820['type']!=='VIRTUAL'){var _0xb3fe1d={};_0xb3fe1d[_0x514820[_0x7191('0x27')]]={'$like':'%'+_0x327c59['query'][_0x7191('0x3c')]+'%'};return _0xb3fe1d;}})});}_0xad2a4b=_[_0x7191('0x3d')]({},_0xad2a4b,_0x327c59[_0x7191('0x3e')]);var _0x5e7f86={'where':_0xad2a4b[_0x7191('0x3a')]};return db[_0x7191('0x2a')][_0x7191('0x3f')](_0x5e7f86)['then'](function(_0x3f29b2){_0x2a09de[_0x7191('0x3f')]=_0x3f29b2;if(_0x327c59[_0x7191('0x2f')][_0x7191('0x40')]){_0xad2a4b['include']=[{'all':!![]}];}return db[_0x7191('0x2a')][_0x7191('0x41')](_0xad2a4b);})[_0x7191('0x21')](function(_0x278da3){_0x2a09de['rows']=_0x278da3;return _0x2a09de;})['then'](respondWithFilteredResult(_0x1b9eea,_0xad2a4b))['catch'](handleError(_0x1b9eea,null));};exports[_0x7191('0x42')]=function(_0x2a3794,_0x4d3edf){var _0x2dd0c3={'raw':![],'where':{'id':_0x2a3794['params']['id']}},_0x53665d={};_0x53665d[_0x7191('0x2e')]=_[_0x7191('0x30')](db[_0x7191('0x2a')][_0x7191('0x2b')]);_0x53665d['query']=_[_0x7191('0x30')](_0x2a3794[_0x7191('0x2f')]);_0x53665d[_0x7191('0x31')]=_[_0x7191('0x32')](_0x53665d[_0x7191('0x2e')],_0x53665d[_0x7191('0x2f')]);_0x2dd0c3['attributes']=_['intersection'](_0x53665d[_0x7191('0x2e')],qs[_0x7191('0x33')](_0x2a3794['query']['fields']));_0x2dd0c3['attributes']=_0x2dd0c3[_0x7191('0x34')]['length']?_0x2dd0c3[_0x7191('0x34')]:_0x53665d['model'];if(_0x2a3794[_0x7191('0x2f')][_0x7191('0x40')]){_0x2dd0c3[_0x7191('0x43')]=[{'all':!![]}];}_0x2dd0c3=_[_0x7191('0x3d')]({},_0x2dd0c3,_0x2a3794[_0x7191('0x3e')]);return db[_0x7191('0x2a')][_0x7191('0x44')](_0x2dd0c3)[_0x7191('0x21')](handleEntityNotFound(_0x4d3edf,null))[_0x7191('0x21')](respondWithResult(_0x4d3edf,null))[_0x7191('0x45')](handleError(_0x4d3edf,null));};exports[_0x7191('0x46')]=function(_0x21538a,_0x3e5c6d){return db['JscriptyProject'][_0x7191('0x46')](_0x21538a[_0x7191('0x47')],{})[_0x7191('0x21')](function(_0x236bff){var _0x5cbd86=_0x21538a[_0x7191('0x48')]['get']({'plain':!![]});if(!_0x5cbd86)throw new Error(_0x7191('0x49'));if(_0x5cbd86[_0x7191('0x4a')]==='user'){var _0x320667=_0x236bff[_0x7191('0x22')]({'plain':!![]});var _0x481e96=_0x7191('0x23');return db['UserProfileSection'][_0x7191('0x44')]({'where':{'name':_0x481e96,'userProfileId':_0x5cbd86[_0x7191('0x4b')]},'raw':!![]})[_0x7191('0x21')](function(_0x277301){if(_0x277301&&_0x277301[_0x7191('0x4c')]===0x0){return db[_0x7191('0x24')][_0x7191('0x46')]({'name':_0x320667[_0x7191('0x27')],'resourceId':_0x320667['id'],'type':_0x277301['name'],'sectionId':_0x277301['id']},{})[_0x7191('0x21')](function(){return _0x236bff;});}else{return _0x236bff;}})[_0x7191('0x45')](function(_0x29d844){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29d844);throw _0x29d844;});}return _0x236bff;})['then'](respondWithResult(_0x3e5c6d,0xc9))[_0x7191('0x45')](handleError(_0x3e5c6d,null));};exports[_0x7191('0x4d')]=function(_0x49d8ea,_0x2d015d){var _0x32e0c6={'where':{'id':_0x49d8ea[_0x7191('0x4e')]['id']}},_0x403947={};_0x403947['model']=_[_0x7191('0x30')](db[_0x7191('0x2a')][_0x7191('0x2b')]);_0x32e0c6[_0x7191('0x34')]=_[_0x7191('0x32')](_0x403947[_0x7191('0x2e')],qs[_0x7191('0x33')](_0x49d8ea[_0x7191('0x2f')][_0x7191('0x33')]));_0x32e0c6[_0x7191('0x34')]=_0x32e0c6['attributes'][_0x7191('0x35')]?_0x32e0c6['attributes']:_0x403947[_0x7191('0x2e')];if(_0x49d8ea[_0x7191('0x2f')][_0x7191('0x40')]){_0x32e0c6['include']=[{'all':!![]}];}_0x32e0c6=_[_0x7191('0x3d')]({},_0x32e0c6,_0x49d8ea['options']);return db[_0x7191('0x2a')][_0x7191('0x44')](_0x32e0c6)[_0x7191('0x21')](handleEntityNotFound(_0x2d015d,null))[_0x7191('0x21')](function(_0x4d6d40){if(_0x4d6d40){var _0x15afe8=_0x4d6d40[_0x7191('0x22')]({'plain':!![]});_0x15afe8=qs[_0x7191('0x4f')](_0x15afe8,['id','createdAt',_0x7191('0x50')]);_0x49d8ea[_0x7191('0x47')]=_[_0x7191('0x4f')](_0x49d8ea['body'],['id',_0x7191('0x51'),_0x7191('0x50')]);return db[_0x7191('0x2a')]['create'](_[_0x7191('0x3d')](_0x15afe8,_0x49d8ea['body']),{'include':_0x49d8ea[_0x7191('0x2f')][_0x7191('0x40')]?[{'all':!![]}]:undefined})[_0x7191('0x21')](function(_0x55c458){var _0x2dd03a=_0x49d8ea[_0x7191('0x48')][_0x7191('0x22')]({'plain':!![]});if(!_0x2dd03a)throw new Error(_0x7191('0x49'));if(_0x2dd03a[_0x7191('0x4a')]==='user'){var _0x5efe5e=_0x55c458[_0x7191('0x22')]({'plain':!![]});var _0x5a214f=_0x7191('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x5a214f,'userProfileId':_0x2dd03a['userProfileId']},'raw':!![]})['then'](function(_0x4daca3){if(_0x4daca3&&_0x4daca3[_0x7191('0x4c')]===0x0){return db[_0x7191('0x24')][_0x7191('0x46')]({'name':_0x5efe5e[_0x7191('0x27')],'resourceId':_0x5efe5e['id'],'type':_0x4daca3[_0x7191('0x27')],'sectionId':_0x4daca3['id']},{})['then'](function(){return _0x55c458;});}else{return _0x55c458;}})[_0x7191('0x45')](function(_0x247849){logger[_0x7191('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x247849);throw _0x247849;});}return _0x55c458;});}})[_0x7191('0x21')](respondWithResult(_0x2d015d,0xc9))['catch'](handleError(_0x2d015d,null));};exports[_0x7191('0x20')]=function(_0x95fe15,_0xe64828){if(_0x95fe15['body']['id']){delete _0x95fe15[_0x7191('0x47')]['id'];}return db[_0x7191('0x2a')]['find']({'where':{'id':_0x95fe15['params']['id']}})[_0x7191('0x21')](handleEntityNotFound(_0xe64828,null))[_0x7191('0x21')](saveUpdates(_0x95fe15['body'],null))[_0x7191('0x21')](respondWithResult(_0xe64828,null))[_0x7191('0x45')](handleError(_0xe64828,null));};exports['destroy']=function(_0x545c92,_0x3d41b3){return db[_0x7191('0x2a')]['find']({'where':{'id':_0x545c92[_0x7191('0x4e')]['id']}})[_0x7191('0x21')](handleEntityNotFound(_0x3d41b3,null))['then'](removeEntity(_0x3d41b3,null))[_0x7191('0x45')](handleError(_0x3d41b3,null));};exports['getSessions']=function(_0x4296a8,_0x55d62a,_0x2a4e4){var _0x11bbae={'raw':!![],'where':{}};var _0x504788={};var _0x39ac04={'count':0x0,'rows':[]};return db[_0x7191('0x2a')][_0x7191('0x53')]({'where':{'id':_0x4296a8[_0x7191('0x4e')]['id']}})[_0x7191('0x21')](handleEntityNotFound(_0x55d62a,null))[_0x7191('0x21')](function(_0x154d5d){if(_0x154d5d){_0x504788['model']=_[_0x7191('0x30')](db[_0x7191('0x54')][_0x7191('0x2b')]);_0x504788['query']=_[_0x7191('0x30')](_0x4296a8[_0x7191('0x2f')]);_0x504788['filters']=_[_0x7191('0x32')](_0x504788[_0x7191('0x2e')],_0x504788[_0x7191('0x2f')]);_0x11bbae[_0x7191('0x34')]=_[_0x7191('0x32')](_0x504788[_0x7191('0x2e')],qs[_0x7191('0x33')](_0x4296a8[_0x7191('0x2f')][_0x7191('0x33')]));_0x11bbae[_0x7191('0x34')]=_0x11bbae['attributes']['length']?_0x11bbae['attributes']:_0x504788[_0x7191('0x2e')];if(!_0x4296a8['query']['hasOwnProperty'](_0x7191('0x37'))){_0x11bbae[_0x7191('0x19')]=qs[_0x7191('0x19')](_0x4296a8[_0x7191('0x2f')][_0x7191('0x19')]);_0x11bbae['offset']=qs[_0x7191('0x18')](_0x4296a8['query'][_0x7191('0x18')]);}_0x11bbae[_0x7191('0x38')]=qs[_0x7191('0x39')](_0x4296a8['query'][_0x7191('0x39')]);_0x11bbae[_0x7191('0x3a')]=qs[_0x7191('0x31')](_[_0x7191('0x3b')](_0x4296a8[_0x7191('0x2f')],_0x504788[_0x7191('0x31')]));_0x11bbae[_0x7191('0x3a')]['ProjectId']=_0x154d5d['id'];if(_0x4296a8[_0x7191('0x2f')]['filter']){_0x11bbae[_0x7191('0x3a')]=_[_0x7191('0x3d')](_0x11bbae[_0x7191('0x3a')],{'$or':_[_0x7191('0x29')](_0x11bbae[_0x7191('0x34')],function(_0xd1aec2){var _0x12cc78={};_0x12cc78[_0xd1aec2]={'$like':'%'+_0x4296a8[_0x7191('0x2f')][_0x7191('0x3c')]+'%'};return _0x12cc78;})});}_0x11bbae=_[_0x7191('0x3d')]({},_0x11bbae,_0x4296a8['options']);return db[_0x7191('0x54')]['count']({'where':_0x11bbae['where']})[_0x7191('0x21')](function(_0x62ae9a){_0x39ac04['count']=_0x62ae9a;if(_0x4296a8[_0x7191('0x2f')]['includeAll']){_0x11bbae[_0x7191('0x43')]=[{'all':!![]}];}return db[_0x7191('0x54')][_0x7191('0x41')](_0x11bbae);})[_0x7191('0x21')](function(_0x4e33c8){_0x39ac04[_0x7191('0x55')]=_0x4e33c8;return _0x39ac04;});}})[_0x7191('0x21')](respondWithFilteredResult(_0x55d62a,_0x11bbae))[_0x7191('0x45')](handleError(_0x55d62a,null));};exports['getAnswers']=function(_0x504189,_0x112e01,_0x5301cb){var _0x1efec8={'raw':!![],'where':{}};var _0x52ed62={};var _0x40fc80={'count':0x0,'rows':[]};return db[_0x7191('0x2a')]['findOne']({'where':{'id':_0x504189[_0x7191('0x4e')]['id']}})[_0x7191('0x21')](handleEntityNotFound(_0x112e01,null))[_0x7191('0x21')](function(_0x314cb3){if(_0x314cb3){_0x52ed62[_0x7191('0x2e')]=_[_0x7191('0x30')](db[_0x7191('0x56')][_0x7191('0x2b')]);_0x52ed62['query']=_['keys'](_0x504189[_0x7191('0x2f')]);_0x52ed62[_0x7191('0x31')]=_[_0x7191('0x32')](_0x52ed62[_0x7191('0x2e')],_0x52ed62[_0x7191('0x2f')]);_0x1efec8[_0x7191('0x34')]=_[_0x7191('0x32')](_0x52ed62[_0x7191('0x2e')],qs['fields'](_0x504189['query'][_0x7191('0x33')]));_0x1efec8['attributes']=_0x1efec8[_0x7191('0x34')]['length']?_0x1efec8[_0x7191('0x34')]:_0x52ed62[_0x7191('0x2e')];if(!_0x504189[_0x7191('0x2f')]['hasOwnProperty'](_0x7191('0x37'))){_0x1efec8['limit']=qs[_0x7191('0x19')](_0x504189[_0x7191('0x2f')][_0x7191('0x19')]);_0x1efec8['offset']=qs[_0x7191('0x18')](_0x504189[_0x7191('0x2f')][_0x7191('0x18')]);}_0x1efec8[_0x7191('0x38')]=qs[_0x7191('0x39')](_0x504189['query'][_0x7191('0x39')]);_0x1efec8['where']=qs[_0x7191('0x31')](_['pick'](_0x504189['query'],_0x52ed62[_0x7191('0x31')]));_0x1efec8[_0x7191('0x3a')][_0x7191('0x57')]=_0x314cb3['id'];if(_0x504189[_0x7191('0x2f')][_0x7191('0x3c')]){_0x1efec8[_0x7191('0x3a')]=_[_0x7191('0x3d')](_0x1efec8[_0x7191('0x3a')],{'$or':_[_0x7191('0x29')](_0x1efec8[_0x7191('0x34')],function(_0x132960){var _0xe635da={};_0xe635da[_0x132960]={'$like':'%'+_0x504189['query'][_0x7191('0x3c')]+'%'};return _0xe635da;})});}_0x1efec8=_[_0x7191('0x3d')]({},_0x1efec8,_0x504189[_0x7191('0x3e')]);return db[_0x7191('0x56')][_0x7191('0x3f')]({'where':_0x1efec8[_0x7191('0x3a')]})[_0x7191('0x21')](function(_0x2dd198){_0x40fc80[_0x7191('0x3f')]=_0x2dd198;if(_0x504189[_0x7191('0x2f')][_0x7191('0x40')]){_0x1efec8[_0x7191('0x43')]=[{'all':!![]}];}return db[_0x7191('0x56')][_0x7191('0x41')](_0x1efec8);})[_0x7191('0x21')](function(_0x30c0e8){_0x40fc80[_0x7191('0x55')]=_0x30c0e8;return _0x40fc80;});}})[_0x7191('0x21')](respondWithFilteredResult(_0x112e01,_0x1efec8))[_0x7191('0x45')](handleError(_0x112e01,null));};function char(_0x581304){return _0x7191('0x58')===typeof _0x581304?String[_0x7191('0x59')]['apply'](null,arguments):_0x581304;}function needsEncapsulation(_0x247b09){return!!_0x247b09&&(_0x247b09[_0x7191('0x5a')]()[_0x7191('0x5b')](char(0xd))>=0x0||_0x247b09[_0x7191('0x5a')]()[_0x7191('0x5b')](char(0xa))>=0x0||_0x247b09[_0x7191('0x5a')]()[_0x7191('0x5b')](char(0x2c))>=0x0||_0x247b09[_0x7191('0x5a')]()[_0x7191('0x5b')](char(0x22))>=0x0);}function encapsulate(_0x8d276a){var _0x1ee345=char(0x22),_0x3e9c55='\x5c'+char(0x22),_0x139743=_0x8d276a[_0x7191('0x5a')]()['replace'](new RegExp(_0x1ee345,'g'),_0x3e9c55);return _0x1ee345+_0x139743+_0x1ee345;}exports[_0x7191('0x5c')]=function(_0x390a7a,_0x3fe870,_0x4bf439){var _0x343344,_0x382b93;var _0x340371={'where':{'ProjectId':_0x390a7a[_0x7191('0x4e')]['id']}};if(_0x390a7a[_0x7191('0x2f')]['startTime']){_0x340371['where']['starttime']=JSON[_0x7191('0x5d')](_0x390a7a[_0x7191('0x2f')][_0x7191('0x5e')]);}return db[_0x7191('0x54')]['findAll'](_0x340371)[_0x7191('0x21')](handleEntityNotFound(_0x3fe870,null))[_0x7191('0x21')](function(_0x5527e4){if(_0x5527e4){_0x343344=_0x5527e4;return db[_0x7191('0x5f')][_0x7191('0x41')]({'where':{'SessionId':{'$in':_[_0x7191('0x29')](_0x343344,'id')},'ProjectId':_0x390a7a[_0x7191('0x4e')]['id']},'order':'-createdAt'});}})[_0x7191('0x21')](handleEntityNotFound(_0x3fe870,null))['then'](function(_0x5781c9){if(_0x5781c9){_0x382b93=_0x5781c9;var _0x19df68={};for(var _0x11ed66=0x0,_0x399024=_0x382b93[_0x7191('0x35')];_0x11ed66<_0x399024;_0x11ed66++){if(!_0x19df68['hasOwnProperty'](_0x382b93[_0x11ed66]['questionId'])){_0x19df68[_0x382b93[_0x11ed66][_0x7191('0x60')]]=needsEncapsulation(_0x382b93[_0x11ed66][_0x7191('0x61')])?encapsulate(_0x382b93[_0x11ed66][_0x7191('0x61')]):_0x382b93[_0x11ed66][_0x7191('0x61')];}}var _0x486d71=[],_0x541f9a={};for(var _0x3df89f=0x0,_0x545051=_0x343344[_0x7191('0x35')];_0x3df89f<_0x545051;_0x3df89f++){_0x541f9a={'ProjectId':_0x390a7a[_0x7191('0x4e')]['id'],'SessionId':_0x343344[_0x3df89f]['id'],'StartTime':moment(_0x343344[_0x3df89f][_0x7191('0x62')])[_0x7191('0x63')](_0x7191('0x64'))};for(var _0x412679=0x0,_0x198d27=_0x382b93['length'];_0x412679<_0x198d27;_0x412679++){if(_0x382b93[_0x412679][_0x7191('0x65')]==_0x343344[_0x3df89f]['id']&&_0x19df68['hasOwnProperty'](_0x382b93[_0x412679][_0x7191('0x60')])){_0x541f9a[_0x19df68[_0x382b93[_0x412679][_0x7191('0x60')]]]=_0x382b93[_0x412679][_0x7191('0x66')];}}for(var _0x339ec5 in _0x19df68){if(!_0x541f9a[_0x7191('0x36')](_0x19df68[_0x339ec5])){_0x541f9a[_0x19df68[_0x339ec5]]=null;}}_0x486d71[_0x7191('0x67')](_0x541f9a);}return _0x486d71;}})[_0x7191('0x21')](function(_0x24e9b9){if(!_['isEmpty'](_0x24e9b9)){var _0x27ce2a=toCsv(_0x24e9b9);var _0x175d1a=Date[_0x7191('0x68')]();fs[_0x7191('0x69')](util[_0x7191('0x63')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x390a7a['params']['id'],_0x175d1a),_0x27ce2a);_0x3fe870['setHeader'](_0x7191('0x6a'),_0x7191('0x6b')+util[_0x7191('0x63')](_0x7191('0x6c'),_0x390a7a[_0x7191('0x4e')]['id'],_0x175d1a));_0x3fe870[_0x7191('0x6d')](_0x7191('0x6e'),_0x7191('0x6f'));return _0x3fe870[_0x7191('0x70')](util[_0x7191('0x63')](_0x7191('0x71'),_0x390a7a['params']['id'],_0x175d1a));}else{return _0x3fe870[_0x7191('0x72')](0xcc);}})[_0x7191('0x45')](handleError(_0x3fe870,null));}; \ No newline at end of file +var _0xbead=['includeAll','JscriptyProject','findAll','rows','show','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','error','clone','params','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','JscriptySessionReport','getAnswers','findOne','pick','ProjectId','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','Projects','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options'];(function(_0x424afb,_0x51dd5a){var _0x3f6ff9=function(_0x3085bc){while(--_0x3085bc){_0x424afb['push'](_0x424afb['shift']());}};_0x3f6ff9(++_0x51dd5a);}(_0xbead,0xac));var _0xdbea=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0xbead[_0x1b8e60];return _0x363363;};'use strict';var pdf=require(_0xdbea('0x0'));var emlformat=require(_0xdbea('0x1'));var rimraf=require(_0xdbea('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbea('0x3'));var rp=require(_0xdbea('0x4'));var moment=require(_0xdbea('0x5'));var BPromise=require(_0xdbea('0x6'));var Mustache=require(_0xdbea('0x7'));var util=require(_0xdbea('0x8'));var path=require(_0xdbea('0x9'));var sox=require('sox');var csv=require(_0xdbea('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdbea('0xb'));var squel=require('squel');var crypto=require(_0xdbea('0xc'));var jsforce=require(_0xdbea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdbea('0xa'));var querystring=require(_0xdbea('0xe'));var Papa=require(_0xdbea('0xf'));var Redis=require('ioredis');var authService=require(_0xdbea('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbea('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xdbea('0x12'));var config=require('../../config/environment');var db=require(_0xdbea('0x13'))['db'];function respondWithStatusCode(_0xbe98ff,_0x5d4d5e){_0x5d4d5e=_0x5d4d5e||0xcc;return function(_0x10543b){if(_0x10543b){return _0xbe98ff[_0xdbea('0x14')](_0x5d4d5e);}return _0xbe98ff['status'](_0x5d4d5e)[_0xdbea('0x15')]();};}function respondWithResult(_0x28ab7b,_0x299789){_0x299789=_0x299789||0xc8;return function(_0x14619f){if(_0x14619f){return _0x28ab7b[_0xdbea('0x16')](_0x299789)[_0xdbea('0x17')](_0x14619f);}};}function respondWithFilteredResult(_0x441dd6,_0x480a7d){return function(_0x206d34){if(_0x206d34){var _0x482ee7=_0x206d34[_0xdbea('0x18')],_0x58fc54=_0x480a7d[_0xdbea('0x19')],_0x40eef6=_0x480a7d[_0xdbea('0x19')]+_0x480a7d[_0xdbea('0x1a')],_0x2a0d62;if(_0x40eef6>=_0x482ee7){_0x40eef6=_0x482ee7;_0x2a0d62=0xc8;}else{_0x2a0d62=0xce;}_0x441dd6[_0xdbea('0x16')](_0x2a0d62);return _0x441dd6[_0xdbea('0x1b')](_0xdbea('0x1c'),_0x58fc54+'-'+_0x40eef6+'/'+_0x482ee7)['json'](_0x206d34);}return null;};}function patchUpdates(_0x1a5fb8){return function(_0x23afdf){try{jsonpatch[_0xdbea('0x1d')](_0x23afdf,_0x1a5fb8,!![]);}catch(_0x58abdd){return BPromise[_0xdbea('0x1e')](_0x58abdd);}return _0x23afdf['save']();};}function saveUpdates(_0x489924,_0xa42c4e){return function(_0x738348){if(_0x738348){return _0x738348[_0xdbea('0x1f')](_0x489924)['then'](function(_0x62225c){return _0x62225c;});}return null;};}function removeEntity(_0x551f60,_0x4736ff){return function(_0x29e985){if(_0x29e985){return _0x29e985[_0xdbea('0x20')]()[_0xdbea('0x21')](function(){var _0x51a396=_0x29e985[_0xdbea('0x22')]({'plain':!![]});var _0x1e7455=_0xdbea('0x23');return db['UserProfileResource'][_0xdbea('0x20')]({'where':{'type':_0x1e7455,'resourceId':_0x51a396['id']}})[_0xdbea('0x21')](function(){return _0x29e985;});})[_0xdbea('0x21')](function(){_0x551f60['status'](0xcc)[_0xdbea('0x15')]();});}};}function handleEntityNotFound(_0x1bbfb7,_0xd21e4c){return function(_0x36e5bb){if(!_0x36e5bb){_0x1bbfb7[_0xdbea('0x14')](0x194);}return _0x36e5bb;};}function handleError(_0x3d11be,_0x27d23f){_0x27d23f=_0x27d23f||0x1f4;return function(_0xbc04d9){logger['error'](_0xbc04d9[_0xdbea('0x24')]);if(_0xbc04d9[_0xdbea('0x25')]){delete _0xbc04d9[_0xdbea('0x25')];}_0x3d11be[_0xdbea('0x16')](_0x27d23f)[_0xdbea('0x26')](_0xbc04d9);};}exports[_0xdbea('0x27')]=function(_0x3e4958,_0x55eb90){var _0x257a27={},_0x1d9658={},_0x56b855={'count':0x0,'rows':[]};var _0x270314=_[_0xdbea('0x28')](db['JscriptyProject'][_0xdbea('0x29')],function(_0x1355ea){return{'name':_0x1355ea[_0xdbea('0x2a')],'type':_0x1355ea[_0xdbea('0x2b')][_0xdbea('0x2c')]};});_0x1d9658['model']=_['map'](_0x270314,_0xdbea('0x25'));_0x1d9658[_0xdbea('0x2d')]=_[_0xdbea('0x2e')](_0x3e4958[_0xdbea('0x2d')]);_0x1d9658[_0xdbea('0x2f')]=_[_0xdbea('0x30')](_0x1d9658['model'],_0x1d9658[_0xdbea('0x2d')]);_0x257a27[_0xdbea('0x31')]=_[_0xdbea('0x30')](_0x1d9658[_0xdbea('0x32')],qs[_0xdbea('0x33')](_0x3e4958[_0xdbea('0x2d')]['fields']));_0x257a27[_0xdbea('0x31')]=_0x257a27[_0xdbea('0x31')][_0xdbea('0x34')]?_0x257a27[_0xdbea('0x31')]:_0x1d9658[_0xdbea('0x32')];if(!_0x3e4958[_0xdbea('0x2d')][_0xdbea('0x35')](_0xdbea('0x36'))){_0x257a27[_0xdbea('0x1a')]=qs[_0xdbea('0x1a')](_0x3e4958[_0xdbea('0x2d')][_0xdbea('0x1a')]);_0x257a27[_0xdbea('0x19')]=qs[_0xdbea('0x19')](_0x3e4958[_0xdbea('0x2d')]['offset']);}_0x257a27[_0xdbea('0x37')]=qs[_0xdbea('0x38')](_0x3e4958[_0xdbea('0x2d')][_0xdbea('0x38')]);_0x257a27[_0xdbea('0x39')]=qs[_0xdbea('0x2f')](_['pick'](_0x3e4958[_0xdbea('0x2d')],_0x1d9658['filters']),_0x270314);if(_0x3e4958[_0xdbea('0x2d')][_0xdbea('0x3a')]){_0x257a27[_0xdbea('0x39')]=_['merge'](_0x257a27[_0xdbea('0x39')],{'$or':_[_0xdbea('0x28')](_0x270314,function(_0x1e54e5){if(_0x1e54e5[_0xdbea('0x2b')]!==_0xdbea('0x3b')){var _0x15535f={};_0x15535f[_0x1e54e5[_0xdbea('0x25')]]={'$like':'%'+_0x3e4958[_0xdbea('0x2d')]['filter']+'%'};return _0x15535f;}})});}_0x257a27=_[_0xdbea('0x3c')]({},_0x257a27,_0x3e4958[_0xdbea('0x3d')]);var _0x2dc646={'where':_0x257a27[_0xdbea('0x39')]};return db['JscriptyProject'][_0xdbea('0x18')](_0x2dc646)['then'](function(_0x5690d1){_0x56b855['count']=_0x5690d1;if(_0x3e4958[_0xdbea('0x2d')][_0xdbea('0x3e')]){_0x257a27['include']=[{'all':!![]}];}return db[_0xdbea('0x3f')][_0xdbea('0x40')](_0x257a27);})[_0xdbea('0x21')](function(_0x26bbc7){_0x56b855[_0xdbea('0x41')]=_0x26bbc7;return _0x56b855;})[_0xdbea('0x21')](respondWithFilteredResult(_0x55eb90,_0x257a27))['catch'](handleError(_0x55eb90,null));};exports[_0xdbea('0x42')]=function(_0x286ba1,_0x156da9){var _0xa49632={'raw':![],'where':{'id':_0x286ba1['params']['id']}},_0x4d09cf={};_0x4d09cf['model']=_[_0xdbea('0x2e')](db[_0xdbea('0x3f')][_0xdbea('0x29')]);_0x4d09cf[_0xdbea('0x2d')]=_[_0xdbea('0x2e')](_0x286ba1[_0xdbea('0x2d')]);_0x4d09cf[_0xdbea('0x2f')]=_[_0xdbea('0x30')](_0x4d09cf[_0xdbea('0x32')],_0x4d09cf[_0xdbea('0x2d')]);_0xa49632[_0xdbea('0x31')]=_['intersection'](_0x4d09cf[_0xdbea('0x32')],qs['fields'](_0x286ba1[_0xdbea('0x2d')][_0xdbea('0x33')]));_0xa49632[_0xdbea('0x31')]=_0xa49632[_0xdbea('0x31')][_0xdbea('0x34')]?_0xa49632[_0xdbea('0x31')]:_0x4d09cf[_0xdbea('0x32')];if(_0x286ba1[_0xdbea('0x2d')][_0xdbea('0x3e')]){_0xa49632[_0xdbea('0x43')]=[{'all':!![]}];}_0xa49632=_[_0xdbea('0x3c')]({},_0xa49632,_0x286ba1['options']);return db['JscriptyProject'][_0xdbea('0x44')](_0xa49632)[_0xdbea('0x21')](handleEntityNotFound(_0x156da9,null))[_0xdbea('0x21')](respondWithResult(_0x156da9,null))[_0xdbea('0x45')](handleError(_0x156da9,null));};exports[_0xdbea('0x46')]=function(_0x465e40,_0x5b70b5){return db[_0xdbea('0x3f')][_0xdbea('0x46')](_0x465e40[_0xdbea('0x47')],{})[_0xdbea('0x21')](function(_0x292b08){var _0x58b433=_0x465e40[_0xdbea('0x48')]['get']({'plain':!![]});if(!_0x58b433)throw new Error(_0xdbea('0x49'));if(_0x58b433[_0xdbea('0x4a')]===_0xdbea('0x48')){var _0x5ac6a8=_0x292b08[_0xdbea('0x22')]({'plain':!![]});var _0x4789e4=_0xdbea('0x23');return db['UserProfileSection'][_0xdbea('0x44')]({'where':{'name':_0x4789e4,'userProfileId':_0x58b433[_0xdbea('0x4b')]},'raw':!![]})[_0xdbea('0x21')](function(_0x93442e){if(_0x93442e&&_0x93442e['autoAssociation']===0x0){return db[_0xdbea('0x4c')]['create']({'name':_0x5ac6a8[_0xdbea('0x25')],'resourceId':_0x5ac6a8['id'],'type':_0x93442e[_0xdbea('0x25')],'sectionId':_0x93442e['id']},{})[_0xdbea('0x21')](function(){return _0x292b08;});}else{return _0x292b08;}})[_0xdbea('0x45')](function(_0xc2aa70){logger[_0xdbea('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc2aa70);throw _0xc2aa70;});}return _0x292b08;})[_0xdbea('0x21')](respondWithResult(_0x5b70b5,0xc9))[_0xdbea('0x45')](handleError(_0x5b70b5,null));};exports[_0xdbea('0x4e')]=function(_0x2016cc,_0x133f2c){var _0x8aad7f={'where':{'id':_0x2016cc[_0xdbea('0x4f')]['id']}},_0x161922={};_0x161922[_0xdbea('0x32')]=_[_0xdbea('0x2e')](db[_0xdbea('0x3f')][_0xdbea('0x29')]);_0x8aad7f[_0xdbea('0x31')]=_['intersection'](_0x161922['model'],qs[_0xdbea('0x33')](_0x2016cc[_0xdbea('0x2d')]['fields']));_0x8aad7f['attributes']=_0x8aad7f[_0xdbea('0x31')][_0xdbea('0x34')]?_0x8aad7f['attributes']:_0x161922['model'];if(_0x2016cc['query'][_0xdbea('0x3e')]){_0x8aad7f[_0xdbea('0x43')]=[{'all':!![]}];}_0x8aad7f=_[_0xdbea('0x3c')]({},_0x8aad7f,_0x2016cc[_0xdbea('0x3d')]);return db[_0xdbea('0x3f')][_0xdbea('0x44')](_0x8aad7f)[_0xdbea('0x21')](handleEntityNotFound(_0x133f2c,null))[_0xdbea('0x21')](function(_0x265a6f){if(_0x265a6f){var _0x32a997=_0x265a6f[_0xdbea('0x22')]({'plain':!![]});_0x32a997=qs[_0xdbea('0x50')](_0x32a997,['id',_0xdbea('0x51'),_0xdbea('0x52')]);_0x2016cc[_0xdbea('0x47')]=_[_0xdbea('0x50')](_0x2016cc[_0xdbea('0x47')],['id',_0xdbea('0x51'),_0xdbea('0x52')]);return db[_0xdbea('0x3f')][_0xdbea('0x46')](_['merge'](_0x32a997,_0x2016cc[_0xdbea('0x47')]),{'include':_0x2016cc['query'][_0xdbea('0x3e')]?[{'all':!![]}]:undefined})[_0xdbea('0x21')](function(_0x3b8aa6){var _0x3dbb10=_0x2016cc[_0xdbea('0x48')][_0xdbea('0x22')]({'plain':!![]});if(!_0x3dbb10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3dbb10[_0xdbea('0x4a')]==='user'){var _0x2bfb0a=_0x3b8aa6['get']({'plain':!![]});var _0x5e81c0='Projects';return db[_0xdbea('0x53')]['find']({'where':{'name':_0x5e81c0,'userProfileId':_0x3dbb10['userProfileId']},'raw':!![]})['then'](function(_0x15db52){if(_0x15db52&&_0x15db52['autoAssociation']===0x0){return db[_0xdbea('0x4c')][_0xdbea('0x46')]({'name':_0x2bfb0a[_0xdbea('0x25')],'resourceId':_0x2bfb0a['id'],'type':_0x15db52[_0xdbea('0x25')],'sectionId':_0x15db52['id']},{})['then'](function(){return _0x3b8aa6;});}else{return _0x3b8aa6;}})[_0xdbea('0x45')](function(_0x21d8c8){logger[_0xdbea('0x4d')](_0xdbea('0x54'),_0x21d8c8);throw _0x21d8c8;});}return _0x3b8aa6;});}})[_0xdbea('0x21')](respondWithResult(_0x133f2c,0xc9))['catch'](handleError(_0x133f2c,null));};exports[_0xdbea('0x1f')]=function(_0x373d50,_0x2fa61d){if(_0x373d50[_0xdbea('0x47')]['id']){delete _0x373d50[_0xdbea('0x47')]['id'];}return db['JscriptyProject'][_0xdbea('0x44')]({'where':{'id':_0x373d50['params']['id']}})[_0xdbea('0x21')](handleEntityNotFound(_0x2fa61d,null))[_0xdbea('0x21')](saveUpdates(_0x373d50['body'],null))['then'](respondWithResult(_0x2fa61d,null))[_0xdbea('0x45')](handleError(_0x2fa61d,null));};exports[_0xdbea('0x20')]=function(_0x3e1242,_0xd46a7b){return db['JscriptyProject']['find']({'where':{'id':_0x3e1242[_0xdbea('0x4f')]['id']}})[_0xdbea('0x21')](handleEntityNotFound(_0xd46a7b,null))[_0xdbea('0x21')](removeEntity(_0xd46a7b,null))[_0xdbea('0x45')](handleError(_0xd46a7b,null));};exports[_0xdbea('0x55')]=function(_0x2d94b9,_0x46c421,_0x225f0b){var _0x42c51e={'raw':!![],'where':{}};var _0xa81423={};var _0x5a65ef={'count':0x0,'rows':[]};return db[_0xdbea('0x3f')]['findOne']({'where':{'id':_0x2d94b9['params']['id']}})['then'](handleEntityNotFound(_0x46c421,null))['then'](function(_0x2831dd){if(_0x2831dd){_0xa81423['model']=_['keys'](db[_0xdbea('0x56')]['rawAttributes']);_0xa81423[_0xdbea('0x2d')]=_[_0xdbea('0x2e')](_0x2d94b9[_0xdbea('0x2d')]);_0xa81423[_0xdbea('0x2f')]=_[_0xdbea('0x30')](_0xa81423[_0xdbea('0x32')],_0xa81423[_0xdbea('0x2d')]);_0x42c51e[_0xdbea('0x31')]=_[_0xdbea('0x30')](_0xa81423[_0xdbea('0x32')],qs[_0xdbea('0x33')](_0x2d94b9[_0xdbea('0x2d')][_0xdbea('0x33')]));_0x42c51e[_0xdbea('0x31')]=_0x42c51e['attributes'][_0xdbea('0x34')]?_0x42c51e[_0xdbea('0x31')]:_0xa81423[_0xdbea('0x32')];if(!_0x2d94b9[_0xdbea('0x2d')][_0xdbea('0x35')](_0xdbea('0x36'))){_0x42c51e[_0xdbea('0x1a')]=qs['limit'](_0x2d94b9[_0xdbea('0x2d')]['limit']);_0x42c51e[_0xdbea('0x19')]=qs[_0xdbea('0x19')](_0x2d94b9[_0xdbea('0x2d')][_0xdbea('0x19')]);}_0x42c51e[_0xdbea('0x37')]=qs[_0xdbea('0x38')](_0x2d94b9[_0xdbea('0x2d')][_0xdbea('0x38')]);_0x42c51e[_0xdbea('0x39')]=qs[_0xdbea('0x2f')](_['pick'](_0x2d94b9[_0xdbea('0x2d')],_0xa81423[_0xdbea('0x2f')]));_0x42c51e[_0xdbea('0x39')]['ProjectId']=_0x2831dd['id'];if(_0x2d94b9[_0xdbea('0x2d')][_0xdbea('0x3a')]){_0x42c51e[_0xdbea('0x39')]=_[_0xdbea('0x3c')](_0x42c51e[_0xdbea('0x39')],{'$or':_[_0xdbea('0x28')](_0x42c51e['attributes'],function(_0x47705f){var _0x2d10fc={};_0x2d10fc[_0x47705f]={'$like':'%'+_0x2d94b9[_0xdbea('0x2d')]['filter']+'%'};return _0x2d10fc;})});}_0x42c51e=_[_0xdbea('0x3c')]({},_0x42c51e,_0x2d94b9['options']);return db[_0xdbea('0x56')][_0xdbea('0x18')]({'where':_0x42c51e[_0xdbea('0x39')]})['then'](function(_0x4fba27){_0x5a65ef['count']=_0x4fba27;if(_0x2d94b9[_0xdbea('0x2d')]['includeAll']){_0x42c51e[_0xdbea('0x43')]=[{'all':!![]}];}return db[_0xdbea('0x56')][_0xdbea('0x40')](_0x42c51e);})[_0xdbea('0x21')](function(_0x26452f){_0x5a65ef[_0xdbea('0x41')]=_0x26452f;return _0x5a65ef;});}})[_0xdbea('0x21')](respondWithFilteredResult(_0x46c421,_0x42c51e))[_0xdbea('0x45')](handleError(_0x46c421,null));};exports[_0xdbea('0x57')]=function(_0x15a96f,_0x1573da,_0x19aef6){var _0x53f808={'raw':!![],'where':{}};var _0x485aca={};var _0x1c6dc6={'count':0x0,'rows':[]};return db[_0xdbea('0x3f')][_0xdbea('0x58')]({'where':{'id':_0x15a96f[_0xdbea('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1573da,null))[_0xdbea('0x21')](function(_0x5a923a){if(_0x5a923a){_0x485aca[_0xdbea('0x32')]=_[_0xdbea('0x2e')](db['JscriptyAnswerReport']['rawAttributes']);_0x485aca[_0xdbea('0x2d')]=_[_0xdbea('0x2e')](_0x15a96f[_0xdbea('0x2d')]);_0x485aca['filters']=_[_0xdbea('0x30')](_0x485aca['model'],_0x485aca[_0xdbea('0x2d')]);_0x53f808[_0xdbea('0x31')]=_[_0xdbea('0x30')](_0x485aca[_0xdbea('0x32')],qs[_0xdbea('0x33')](_0x15a96f['query'][_0xdbea('0x33')]));_0x53f808[_0xdbea('0x31')]=_0x53f808['attributes'][_0xdbea('0x34')]?_0x53f808[_0xdbea('0x31')]:_0x485aca[_0xdbea('0x32')];if(!_0x15a96f[_0xdbea('0x2d')]['hasOwnProperty'](_0xdbea('0x36'))){_0x53f808[_0xdbea('0x1a')]=qs[_0xdbea('0x1a')](_0x15a96f['query'][_0xdbea('0x1a')]);_0x53f808[_0xdbea('0x19')]=qs[_0xdbea('0x19')](_0x15a96f[_0xdbea('0x2d')]['offset']);}_0x53f808[_0xdbea('0x37')]=qs[_0xdbea('0x38')](_0x15a96f['query']['sort']);_0x53f808['where']=qs[_0xdbea('0x2f')](_[_0xdbea('0x59')](_0x15a96f['query'],_0x485aca[_0xdbea('0x2f')]));_0x53f808[_0xdbea('0x39')][_0xdbea('0x5a')]=_0x5a923a['id'];if(_0x15a96f[_0xdbea('0x2d')][_0xdbea('0x3a')]){_0x53f808[_0xdbea('0x39')]=_[_0xdbea('0x3c')](_0x53f808[_0xdbea('0x39')],{'$or':_[_0xdbea('0x28')](_0x53f808[_0xdbea('0x31')],function(_0x28a92a){var _0xb03fe4={};_0xb03fe4[_0x28a92a]={'$like':'%'+_0x15a96f['query'][_0xdbea('0x3a')]+'%'};return _0xb03fe4;})});}_0x53f808=_[_0xdbea('0x3c')]({},_0x53f808,_0x15a96f['options']);return db[_0xdbea('0x5b')][_0xdbea('0x18')]({'where':_0x53f808[_0xdbea('0x39')]})[_0xdbea('0x21')](function(_0x36d43c){_0x1c6dc6[_0xdbea('0x18')]=_0x36d43c;if(_0x15a96f[_0xdbea('0x2d')]['includeAll']){_0x53f808[_0xdbea('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xdbea('0x40')](_0x53f808);})[_0xdbea('0x21')](function(_0x2092fc){_0x1c6dc6[_0xdbea('0x41')]=_0x2092fc;return _0x1c6dc6;});}})[_0xdbea('0x21')](respondWithFilteredResult(_0x1573da,_0x53f808))[_0xdbea('0x45')](handleError(_0x1573da,null));};function char(_0x141bde){return _0xdbea('0x5c')===typeof _0x141bde?String['fromCharCode'][_0xdbea('0x1d')](null,arguments):_0x141bde;}function needsEncapsulation(_0x331229){return!!_0x331229&&(_0x331229[_0xdbea('0x5d')]()[_0xdbea('0x5e')](char(0xd))>=0x0||_0x331229['toString']()[_0xdbea('0x5e')](char(0xa))>=0x0||_0x331229['toString']()['indexOf'](char(0x2c))>=0x0||_0x331229['toString']()[_0xdbea('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x4d6002){var _0xe74ca2=char(0x22),_0x39252d='\x5c'+char(0x22),_0x454a49=_0x4d6002['toString']()[_0xdbea('0x5f')](new RegExp(_0xe74ca2,'g'),_0x39252d);return _0xe74ca2+_0x454a49+_0xe74ca2;}exports[_0xdbea('0x60')]=function(_0x35ea68,_0x43d9d1,_0x29c298){var _0x1378db,_0xc610e4;var _0x50a018={'where':{'ProjectId':_0x35ea68['params']['id']}};if(_0x35ea68[_0xdbea('0x2d')][_0xdbea('0x61')]){_0x50a018['where'][_0xdbea('0x62')]=JSON['parse'](_0x35ea68[_0xdbea('0x2d')][_0xdbea('0x61')]);}return db['JscriptySessionReport']['findAll'](_0x50a018)[_0xdbea('0x21')](handleEntityNotFound(_0x43d9d1,null))[_0xdbea('0x21')](function(_0x57d252){if(_0x57d252){_0x1378db=_0x57d252;return db[_0xdbea('0x63')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x1378db,'id')},'ProjectId':_0x35ea68['params']['id']},'order':_0xdbea('0x64')});}})[_0xdbea('0x21')](handleEntityNotFound(_0x43d9d1,null))[_0xdbea('0x21')](function(_0x570bdb){if(_0x570bdb){_0xc610e4=_0x570bdb;var _0x3aa9dd={};for(var _0x2d36ef=0x0,_0x4020b0=_0xc610e4['length'];_0x2d36ef<_0x4020b0;_0x2d36ef++){if(!_0x3aa9dd[_0xdbea('0x35')](_0xc610e4[_0x2d36ef]['questionId'])){_0x3aa9dd[_0xc610e4[_0x2d36ef][_0xdbea('0x65')]]=needsEncapsulation(_0xc610e4[_0x2d36ef][_0xdbea('0x66')])?encapsulate(_0xc610e4[_0x2d36ef][_0xdbea('0x66')]):_0xc610e4[_0x2d36ef][_0xdbea('0x66')];}}var _0x110bb6=[],_0x2f645a={};for(var _0x2b3830=0x0,_0x3bf099=_0x1378db[_0xdbea('0x34')];_0x2b3830<_0x3bf099;_0x2b3830++){_0x2f645a={'ProjectId':_0x35ea68[_0xdbea('0x4f')]['id'],'SessionId':_0x1378db[_0x2b3830]['id'],'StartTime':moment(_0x1378db[_0x2b3830]['starttime'])[_0xdbea('0x67')](_0xdbea('0x68'))};for(var _0x53b79a=0x0,_0x4943e8=_0xc610e4['length'];_0x53b79a<_0x4943e8;_0x53b79a++){if(_0xc610e4[_0x53b79a][_0xdbea('0x69')]==_0x1378db[_0x2b3830]['id']&&_0x3aa9dd[_0xdbea('0x35')](_0xc610e4[_0x53b79a][_0xdbea('0x65')])){_0x2f645a[_0x3aa9dd[_0xc610e4[_0x53b79a][_0xdbea('0x65')]]]=_0xc610e4[_0x53b79a][_0xdbea('0x6a')];}}for(var _0x1f4e32 in _0x3aa9dd){if(!_0x2f645a['hasOwnProperty'](_0x3aa9dd[_0x1f4e32])){_0x2f645a[_0x3aa9dd[_0x1f4e32]]=null;}}_0x110bb6[_0xdbea('0x6b')](_0x2f645a);}return _0x110bb6;}})[_0xdbea('0x21')](function(_0x13affe){if(!_['isEmpty'](_0x13affe)){var _0x5a119a=toCsv(_0x13affe);var _0x19c731=Date['now']();fs[_0xdbea('0x6c')](util[_0xdbea('0x67')](_0xdbea('0x6d'),_0x35ea68[_0xdbea('0x4f')]['id'],_0x19c731),_0x5a119a);_0x43d9d1[_0xdbea('0x6e')](_0xdbea('0x6f'),_0xdbea('0x70')+util[_0xdbea('0x67')](_0xdbea('0x71'),_0x35ea68[_0xdbea('0x4f')]['id'],_0x19c731));_0x43d9d1[_0xdbea('0x6e')](_0xdbea('0x72'),_0xdbea('0x73'));return _0x43d9d1[_0xdbea('0x74')](util[_0xdbea('0x67')](_0xdbea('0x6d'),_0x35ea68['params']['id'],_0x19c731));}else{return _0x43d9d1[_0xdbea('0x14')](0xcc);}})['catch'](handleError(_0x43d9d1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 9f16c4e..dbbb108 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 _0x9e49=['exports','JscriptyProject','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyProject.attributes'];(function(_0x57dff9,_0x37bd67){var _0x346ae6=function(_0x14197b){while(--_0x14197b){_0x57dff9['push'](_0x57dff9['shift']());}};_0x346ae6(++_0x37bd67);}(_0x9e49,0x7a));var _0x99e4=function(_0xb7ccdb,_0x42e36b){_0xb7ccdb=_0xb7ccdb-0x0;var _0x4aa9c3=_0x9e49[_0xb7ccdb];return _0x4aa9c3;};'use strict';var _=require(_0x99e4('0x0'));var util=require(_0x99e4('0x1'));var logger=require(_0x99e4('0x2'))(_0x99e4('0x3'));var moment=require(_0x99e4('0x4'));var BPromise=require(_0x99e4('0x5'));var rp=require(_0x99e4('0x6'));var fs=require('fs');var path=require(_0x99e4('0x7'));var rimraf=require('rimraf');var config=require(_0x99e4('0x8'));var attributes=require(_0x99e4('0x9'));module[_0x99e4('0xa')]=function(_0x1510a8,_0x58b6ef){return _0x1510a8['define'](_0x99e4('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94d3=['../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x512808,_0x27dcbe){var _0x369835=function(_0x590645){while(--_0x590645){_0x512808['push'](_0x512808['shift']());}};_0x369835(++_0x27dcbe);}(_0x94d3,0x94));var _0x394d=function(_0x5326d1,_0x1ad65a){_0x5326d1=_0x5326d1-0x0;var _0x2b9817=_0x94d3[_0x5326d1];return _0x2b9817;};'use strict';var _=require(_0x394d('0x0'));var util=require(_0x394d('0x1'));var logger=require(_0x394d('0x2'))(_0x394d('0x3'));var moment=require(_0x394d('0x4'));var BPromise=require('bluebird');var rp=require(_0x394d('0x5'));var fs=require('fs');var path=require(_0x394d('0x6'));var rimraf=require(_0x394d('0x7'));var config=require(_0x394d('0x8'));var attributes=require(_0x394d('0x9'));module['exports']=function(_0x450012,_0x25cda1){return _0x450012[_0x394d('0xa')](_0x394d('0xb'),attributes,{'tableName':_0x394d('0xc'),'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 3e25dd9..6060381 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 _0x49e4=['message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyProject,\x20%s,\x20%s','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x49e4,0x1a5));var _0x449e=function(_0x19810e,_0x172a94){_0x19810e=_0x19810e-0x0;var _0x45eeb0=_0x49e4[_0x19810e];return _0x45eeb0;};'use strict';var _=require(_0x449e('0x0'));var util=require(_0x449e('0x1'));var moment=require(_0x449e('0x2'));var BPromise=require(_0x449e('0x3'));var rs=require(_0x449e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x449e('0x5'))['db'];var utils=require(_0x449e('0x6'));var logger=require(_0x449e('0x7'))(_0x449e('0x8'));var config=require(_0x449e('0x9'));var jayson=require(_0x449e('0xa'));var client=jayson[_0x449e('0xb')][_0x449e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b9b26,_0x10d529,_0x5d0a41){return new BPromise(function(_0x66fa64,_0x5d0f4a){return client['request'](_0x1b9b26,_0x5d0a41)[_0x449e('0xd')](function(_0x5c110a){logger[_0x449e('0xe')](_0x449e('0xf'),_0x10d529,'request\x20sent');logger['debug'](_0x449e('0x10'),_0x10d529,_0x449e('0x11'),JSON[_0x449e('0x12')](_0x5c110a));if(_0x5c110a[_0x449e('0x13')]){if(_0x5c110a[_0x449e('0x13')]['code']===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x10d529,_0x5c110a[_0x449e('0x13')][_0x449e('0x14')]);return _0x5d0f4a(_0x5c110a['error'][_0x449e('0x14')]);}logger[_0x449e('0x13')](_0x449e('0xf'),_0x10d529,_0x5c110a[_0x449e('0x13')][_0x449e('0x14')]);return _0x66fa64(_0x5c110a[_0x449e('0x13')][_0x449e('0x14')]);}else{logger[_0x449e('0xe')](_0x449e('0xf'),_0x10d529,_0x449e('0x11'));_0x66fa64(_0x5c110a['result'][_0x449e('0x14')]);}})['catch'](function(_0x2c0d5a){logger[_0x449e('0x13')](_0x449e('0xf'),_0x10d529,_0x2c0d5a);_0x5d0f4a(_0x2c0d5a);});});} \ No newline at end of file +var _0xbc1f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','result','catch'];(function(_0x32dc2f,_0x427b7e){var _0x59da9a=function(_0x4de4a5){while(--_0x4de4a5){_0x32dc2f['push'](_0x32dc2f['shift']());}};_0x59da9a(++_0x427b7e);}(_0xbc1f,0x18f));var _0xfbc1=function(_0x426ffd,_0x26644e){_0x426ffd=_0x426ffd-0x0;var _0x505173=_0xbc1f[_0x426ffd];return _0x505173;};'use strict';var _=require('lodash');var util=require(_0xfbc1('0x0'));var moment=require(_0xfbc1('0x1'));var BPromise=require(_0xfbc1('0x2'));var rs=require(_0xfbc1('0x3'));var fs=require('fs');var Redis=require(_0xfbc1('0x4'));var db=require(_0xfbc1('0x5'))['db'];var utils=require(_0xfbc1('0x6'));var logger=require(_0xfbc1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfbc1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a28e0,_0x4cf0f7,_0x1603b8){return new BPromise(function(_0x5fcda8,_0x404de0){return client[_0xfbc1('0x9')](_0x4a28e0,_0x1603b8)[_0xfbc1('0xa')](function(_0x2a8369){logger[_0xfbc1('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x4cf0f7,_0xfbc1('0xc'));logger['debug'](_0xfbc1('0xd'),_0x4cf0f7,'request\x20sent',JSON[_0xfbc1('0xe')](_0x2a8369));if(_0x2a8369['error']){if(_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x10')]===0x1f4){logger[_0xfbc1('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x4cf0f7,_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x11')]);return _0x404de0(_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x11')]);}logger[_0xfbc1('0xf')](_0xfbc1('0x12'),_0x4cf0f7,_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x11')]);return _0x5fcda8(_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x11')]);}else{logger[_0xfbc1('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x4cf0f7,_0xfbc1('0xc'));_0x5fcda8(_0x2a8369[_0xfbc1('0x13')][_0xfbc1('0x11')]);}})[_0xfbc1('0x14')](function(_0x23a7fb){logger[_0xfbc1('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x4cf0f7,_0x23a7fb);_0x404de0(_0x23a7fb);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 1efa902..64c1408 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 _0x2bcd=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','/describe','describe','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','util'];(function(_0x105f4b,_0x174182){var _0x3bd088=function(_0x5e82f9){while(--_0x5e82f9){_0x105f4b['push'](_0x105f4b['shift']());}};_0x3bd088(++_0x174182);}(_0x2bcd,0x76));var _0xd2bc=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x2bcd[_0x1bfe2b];return _0x1477d4;};'use strict';var multer=require(_0xd2bc('0x0'));var util=require(_0xd2bc('0x1'));var path=require(_0xd2bc('0x2'));var timeout=require(_0xd2bc('0x3'));var express=require(_0xd2bc('0x4'));var router=express[_0xd2bc('0x5')]();var auth=require(_0xd2bc('0x6'));var interaction=require(_0xd2bc('0x7'));var config=require('../../config/environment');var controller=require(_0xd2bc('0x8'));router[_0xd2bc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd2bc('0x9')](_0xd2bc('0xa'),auth['isAuthenticated'](),controller[_0xd2bc('0xb')]);router['get'](_0xd2bc('0xc'),auth['isAuthenticated'](),controller[_0xd2bc('0xd')]);router['post']('/',auth[_0xd2bc('0xe')](),controller['create']);router[_0xd2bc('0xf')](_0xd2bc('0xc'),auth[_0xd2bc('0xe')](),controller[_0xd2bc('0x10')]);router[_0xd2bc('0x11')](_0xd2bc('0xc'),auth['isAuthenticated'](),controller[_0xd2bc('0x12')]);module[_0xd2bc('0x13')]=router; \ No newline at end of file +var _0x8e8b=['/:id','post','create','put','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','isAuthenticated'];(function(_0x2fe5b9,_0x127e48){var _0x6f874=function(_0x23f8e7){while(--_0x23f8e7){_0x2fe5b9['push'](_0x2fe5b9['shift']());}};_0x6f874(++_0x127e48);}(_0x8e8b,0x1a5));var _0xb8e8=function(_0x2e3b71,_0x30094a){_0x2e3b71=_0x2e3b71-0x0;var _0x19bfc8=_0x8e8b[_0x2e3b71];return _0x19bfc8;};'use strict';var multer=require(_0xb8e8('0x0'));var util=require(_0xb8e8('0x1'));var path=require(_0xb8e8('0x2'));var timeout=require('connect-timeout');var express=require(_0xb8e8('0x3'));var router=express[_0xb8e8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb8e8('0x5'));var config=require(_0xb8e8('0x6'));var controller=require(_0xb8e8('0x7'));router[_0xb8e8('0x8')]('/',auth['isAuthenticated'](),controller[_0xb8e8('0x9')]);router['get']('/describe',auth[_0xb8e8('0xa')](),controller['describe']);router[_0xb8e8('0x8')](_0xb8e8('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb8e8('0xc')]('/',auth[_0xb8e8('0xa')](),controller[_0xb8e8('0xd')]);router[_0xb8e8('0xe')](_0xb8e8('0xb'),auth[_0xb8e8('0xa')](),controller[_0xb8e8('0xf')]);router[_0xb8e8('0x10')](_0xb8e8('0xb'),auth[_0xb8e8('0xa')](),controller['destroy']);module[_0xb8e8('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 4d5cf77..389de2a 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 _0x001c=['TEXT','long','STRING','sequelize','exports'];(function(_0xf16ae3,_0x2170a9){var _0x3a6126=function(_0x2a6f9d){while(--_0x2a6f9d){_0xf16ae3['push'](_0xf16ae3['shift']());}};_0x3a6126(++_0x2170a9);}(_0x001c,0x175));var _0xc001=function(_0x2eaaf0,_0x48c592){_0x2eaaf0=_0x2eaaf0-0x0;var _0x467812=_0x001c[_0x2eaaf0];return _0x467812;};'use strict';var Sequelize=require(_0xc001('0x0'));module[_0xc001('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0xc001('0x2')](_0xc001('0x3'))},'membername':{'type':Sequelize[_0xc001('0x4')]},'projectname':{'type':Sequelize[_0xc001('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc001('0x4')]},'calleridname':{'type':Sequelize[_0xc001('0x4')]},'calleridnum':{'type':Sequelize[_0xc001('0x4')]},'questionId':{'type':Sequelize[_0xc001('0x4')]}}; \ No newline at end of file +var _0xe6e9=['TEXT','exports','STRING'];(function(_0x198445,_0xc6c075){var _0x5efc34=function(_0x4902c8){while(--_0x4902c8){_0x198445['push'](_0x198445['shift']());}};_0x5efc34(++_0xc6c075);}(_0xe6e9,0x16c));var _0x9e6e=function(_0x2f4467,_0x5f2175){_0x2f4467=_0x2f4467-0x0;var _0x3a60c3=_0xe6e9[_0x2f4467];return _0x3a60c3;};'use strict';var Sequelize=require('sequelize');module[_0x9e6e('0x0')]={'question':{'type':Sequelize[_0x9e6e('0x1')]},'answer':{'type':Sequelize[_0x9e6e('0x2')]('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x9e6e('0x1')]},'queue':{'type':Sequelize[_0x9e6e('0x1')]},'uniqueid':{'type':Sequelize[_0x9e6e('0x1')]},'calleridname':{'type':Sequelize[_0x9e6e('0x1')]},'calleridnum':{'type':Sequelize[_0x9e6e('0x1')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 2d8615d..00c6a3e 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 _0x40d1=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','util','ejs','lodash','jsforce','desk.js'];(function(_0x1c62f5,_0x260f11){var _0x161c5d=function(_0x492393){while(--_0x492393){_0x1c62f5['push'](_0x1c62f5['shift']());}};_0x161c5d(++_0x260f11);}(_0x40d1,0x1a7));var _0x140d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x40d1[_0x6c993a];return _0x27f547;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x140d('0x0'));var rimraf=require(_0x140d('0x1'));var zipdir=require(_0x140d('0x2'));var jsonpatch=require(_0x140d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x140d('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x140d('0x5'));var fs=require('fs');var _=require(_0x140d('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x140d('0x7'));var deskjs=require(_0x140d('0x8'));var toCsv=require(_0x140d('0x9'));var querystring=require(_0x140d('0xa'));var Papa=require(_0x140d('0xb'));var Redis=require(_0x140d('0xc'));var authService=require(_0x140d('0xd'));var qs=require(_0x140d('0xe'));var as=require(_0x140d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x140d('0x10'))(_0x140d('0x11'));var utils=require('../../config/utils');var config=require(_0x140d('0x12'));var db=require(_0x140d('0x13'))['db'];function respondWithStatusCode(_0x3a0388,_0x580e9d){_0x580e9d=_0x580e9d||0xcc;return function(_0x5ebd15){if(_0x5ebd15){return _0x3a0388[_0x140d('0x14')](_0x580e9d);}return _0x3a0388[_0x140d('0x15')](_0x580e9d)[_0x140d('0x16')]();};}function respondWithResult(_0x51240d,_0x20116a){_0x20116a=_0x20116a||0xc8;return function(_0x2f7139){if(_0x2f7139){return _0x51240d['status'](_0x20116a)[_0x140d('0x17')](_0x2f7139);}};}function respondWithFilteredResult(_0x5a64ec,_0x2e2e79){return function(_0x1fafcd){if(_0x1fafcd){var _0x3eaea4=_0x1fafcd[_0x140d('0x18')],_0x5420e4=_0x2e2e79[_0x140d('0x19')],_0x664c3e=_0x2e2e79[_0x140d('0x19')]+_0x2e2e79[_0x140d('0x1a')],_0x36f9df;if(_0x664c3e>=_0x3eaea4){_0x664c3e=_0x3eaea4;_0x36f9df=0xc8;}else{_0x36f9df=0xce;}_0x5a64ec[_0x140d('0x15')](_0x36f9df);return _0x5a64ec[_0x140d('0x1b')](_0x140d('0x1c'),_0x5420e4+'-'+_0x664c3e+'/'+_0x3eaea4)['json'](_0x1fafcd);}return null;};}function patchUpdates(_0x4c37af){return function(_0x38f810){try{jsonpatch['apply'](_0x38f810,_0x4c37af,!![]);}catch(_0x5a80ea){return BPromise['reject'](_0x5a80ea);}return _0x38f810[_0x140d('0x1d')]();};}function saveUpdates(_0x3d3704,_0xe31801){return function(_0x495b5e){if(_0x495b5e){return _0x495b5e['update'](_0x3d3704)[_0x140d('0x1e')](function(_0x4f9e6b){return _0x4f9e6b;});}return null;};}function removeEntity(_0x483f44,_0x1c5e1a){return function(_0x57e8d5){if(_0x57e8d5){return _0x57e8d5[_0x140d('0x1f')]()[_0x140d('0x1e')](function(){_0x483f44[_0x140d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b7329,_0x1e78c9){return function(_0x5aa91d){if(!_0x5aa91d){_0x4b7329['sendStatus'](0x194);}return _0x5aa91d;};}function handleError(_0x1285f7,_0x46367d){_0x46367d=_0x46367d||0x1f4;return function(_0x2ce070){logger[_0x140d('0x20')](_0x2ce070[_0x140d('0x21')]);if(_0x2ce070[_0x140d('0x22')]){delete _0x2ce070[_0x140d('0x22')];}_0x1285f7['status'](_0x46367d)[_0x140d('0x23')](_0x2ce070);};}exports[_0x140d('0x24')]=function(_0x49293d,_0x5c7ca6){var _0x5d690a={},_0x1419fd={},_0xb2d7ab={'count':0x0,'rows':[]};var _0x48b550=_[_0x140d('0x25')](db[_0x140d('0x26')]['rawAttributes'],function(_0x1d6bab){return{'name':_0x1d6bab[_0x140d('0x27')],'type':_0x1d6bab[_0x140d('0x28')][_0x140d('0x29')]};});_0x1419fd[_0x140d('0x2a')]=_[_0x140d('0x25')](_0x48b550,_0x140d('0x22'));_0x1419fd[_0x140d('0x2b')]=_[_0x140d('0x2c')](_0x49293d[_0x140d('0x2b')]);_0x1419fd[_0x140d('0x2d')]=_[_0x140d('0x2e')](_0x1419fd['model'],_0x1419fd[_0x140d('0x2b')]);_0x5d690a['attributes']=_[_0x140d('0x2e')](_0x1419fd[_0x140d('0x2a')],qs[_0x140d('0x2f')](_0x49293d[_0x140d('0x2b')]['fields']));_0x5d690a[_0x140d('0x30')]=_0x5d690a['attributes'][_0x140d('0x31')]?_0x5d690a['attributes']:_0x1419fd[_0x140d('0x2a')];if(!_0x49293d[_0x140d('0x2b')][_0x140d('0x32')]('nolimit')){_0x5d690a[_0x140d('0x1a')]=qs[_0x140d('0x1a')](_0x49293d['query'][_0x140d('0x1a')]);_0x5d690a[_0x140d('0x19')]=qs['offset'](_0x49293d[_0x140d('0x2b')][_0x140d('0x19')]);}_0x5d690a[_0x140d('0x33')]=qs[_0x140d('0x34')](_0x49293d[_0x140d('0x2b')][_0x140d('0x34')]);_0x5d690a[_0x140d('0x35')]=qs[_0x140d('0x2d')](_[_0x140d('0x36')](_0x49293d[_0x140d('0x2b')],_0x1419fd[_0x140d('0x2d')]),_0x48b550);if(_0x49293d[_0x140d('0x2b')]['filter']){_0x5d690a[_0x140d('0x35')]=_[_0x140d('0x37')](_0x5d690a[_0x140d('0x35')],{'$or':_[_0x140d('0x25')](_0x48b550,function(_0x207607){if(_0x207607[_0x140d('0x28')]!==_0x140d('0x38')){var _0x3a94d6={};_0x3a94d6[_0x207607['name']]={'$like':'%'+_0x49293d[_0x140d('0x2b')][_0x140d('0x39')]+'%'};return _0x3a94d6;}})});}_0x5d690a=_[_0x140d('0x37')]({},_0x5d690a,_0x49293d[_0x140d('0x3a')]);var _0x1ae3bf={'where':_0x5d690a['where']};return db[_0x140d('0x26')]['count'](_0x1ae3bf)['then'](function(_0x135e3d){_0xb2d7ab[_0x140d('0x18')]=_0x135e3d;if(_0x49293d[_0x140d('0x2b')]['includeAll']){_0x5d690a[_0x140d('0x3b')]=[{'all':!![]}];}return db[_0x140d('0x26')][_0x140d('0x3c')](_0x5d690a);})[_0x140d('0x1e')](function(_0x1cd312){_0xb2d7ab[_0x140d('0x3d')]=_0x1cd312;return _0xb2d7ab;})[_0x140d('0x1e')](respondWithFilteredResult(_0x5c7ca6,_0x5d690a))[_0x140d('0x3e')](handleError(_0x5c7ca6,null));};exports[_0x140d('0x3f')]=function(_0x810acd,_0x26de63){var _0x3196ee={'raw':!![],'where':{'id':_0x810acd['params']['id']}},_0x2296cb={};_0x2296cb[_0x140d('0x2a')]=_[_0x140d('0x2c')](db[_0x140d('0x26')][_0x140d('0x40')]);_0x2296cb[_0x140d('0x2b')]=_['keys'](_0x810acd[_0x140d('0x2b')]);_0x2296cb['filters']=_[_0x140d('0x2e')](_0x2296cb[_0x140d('0x2a')],_0x2296cb['query']);_0x3196ee[_0x140d('0x30')]=_[_0x140d('0x2e')](_0x2296cb[_0x140d('0x2a')],qs[_0x140d('0x2f')](_0x810acd['query'][_0x140d('0x2f')]));_0x3196ee['attributes']=_0x3196ee[_0x140d('0x30')][_0x140d('0x31')]?_0x3196ee[_0x140d('0x30')]:_0x2296cb['model'];if(_0x810acd[_0x140d('0x2b')][_0x140d('0x41')]){_0x3196ee[_0x140d('0x3b')]=[{'all':!![]}];}_0x3196ee=_[_0x140d('0x37')]({},_0x3196ee,_0x810acd['options']);return db[_0x140d('0x26')][_0x140d('0x42')](_0x3196ee)['then'](handleEntityNotFound(_0x26de63,null))[_0x140d('0x1e')](respondWithResult(_0x26de63,null))['catch'](handleError(_0x26de63,null));};exports[_0x140d('0x43')]=function(_0x2f78ed,_0x214c5a){return db[_0x140d('0x26')][_0x140d('0x43')](_0x2f78ed[_0x140d('0x44')],{})['then'](respondWithResult(_0x214c5a,0xc9))[_0x140d('0x3e')](handleError(_0x214c5a,null));};exports[_0x140d('0x45')]=function(_0x599cd0,_0x1a0ead){if(_0x599cd0[_0x140d('0x44')]['id']){delete _0x599cd0[_0x140d('0x44')]['id'];}return db['JscriptyQuestionReport'][_0x140d('0x42')]({'where':{'id':_0x599cd0[_0x140d('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a0ead,null))['then'](saveUpdates(_0x599cd0[_0x140d('0x44')],null))[_0x140d('0x1e')](respondWithResult(_0x1a0ead,null))[_0x140d('0x3e')](handleError(_0x1a0ead,null));};exports[_0x140d('0x1f')]=function(_0x2f761f,_0x52e083){return db[_0x140d('0x26')][_0x140d('0x42')]({'where':{'id':_0x2f761f['params']['id']}})[_0x140d('0x1e')](handleEntityNotFound(_0x52e083,null))[_0x140d('0x1e')](removeEntity(_0x52e083,null))[_0x140d('0x3e')](handleError(_0x52e083,null));};exports[_0x140d('0x47')]=function(_0x50485f,_0x4adf58){return db[_0x140d('0x26')][_0x140d('0x47')]()['then'](respondWithResult(_0x4adf58,null))[_0x140d('0x3e')](handleError(_0x4adf58,null));}; \ No newline at end of file +var _0x7c6c=['options','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x1ab90b,_0x1cfd37){var _0x127584=function(_0x56c734){while(--_0x56c734){_0x1ab90b['push'](_0x1ab90b['shift']());}};_0x127584(++_0x1cfd37);}(_0x7c6c,0xb5));var _0xc7c6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7c6c[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0xc7c6('0x0'));var emlformat=require(_0xc7c6('0x1'));var rimraf=require(_0xc7c6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7c6('0x3'));var rp=require(_0xc7c6('0x4'));var moment=require(_0xc7c6('0x5'));var BPromise=require(_0xc7c6('0x6'));var Mustache=require(_0xc7c6('0x7'));var util=require(_0xc7c6('0x8'));var path=require(_0xc7c6('0x9'));var sox=require(_0xc7c6('0xa'));var csv=require(_0xc7c6('0xb'));var ejs=require(_0xc7c6('0xc'));var fs=require('fs');var _=require(_0xc7c6('0xd'));var squel=require(_0xc7c6('0xe'));var crypto=require('crypto');var jsforce=require(_0xc7c6('0xf'));var deskjs=require(_0xc7c6('0x10'));var toCsv=require(_0xc7c6('0xb'));var querystring=require(_0xc7c6('0x11'));var Papa=require(_0xc7c6('0x12'));var Redis=require(_0xc7c6('0x13'));var authService=require(_0xc7c6('0x14'));var qs=require(_0xc7c6('0x15'));var as=require(_0xc7c6('0x16'));var hardwareService=require(_0xc7c6('0x17'));var logger=require(_0xc7c6('0x18'))(_0xc7c6('0x19'));var utils=require(_0xc7c6('0x1a'));var config=require(_0xc7c6('0x1b'));var db=require(_0xc7c6('0x1c'))['db'];function respondWithStatusCode(_0x19a6dd,_0x52cf52){_0x52cf52=_0x52cf52||0xcc;return function(_0x4543e6){if(_0x4543e6){return _0x19a6dd[_0xc7c6('0x1d')](_0x52cf52);}return _0x19a6dd[_0xc7c6('0x1e')](_0x52cf52)['end']();};}function respondWithResult(_0x2b3802,_0x442c26){_0x442c26=_0x442c26||0xc8;return function(_0x388d56){if(_0x388d56){return _0x2b3802[_0xc7c6('0x1e')](_0x442c26)[_0xc7c6('0x1f')](_0x388d56);}};}function respondWithFilteredResult(_0x41154,_0x5ccc7a){return function(_0x4e7c2f){if(_0x4e7c2f){var _0x516aee=_0x4e7c2f[_0xc7c6('0x20')],_0x37e18d=_0x5ccc7a[_0xc7c6('0x21')],_0x2d820f=_0x5ccc7a[_0xc7c6('0x21')]+_0x5ccc7a[_0xc7c6('0x22')],_0x2f5fdf;if(_0x2d820f>=_0x516aee){_0x2d820f=_0x516aee;_0x2f5fdf=0xc8;}else{_0x2f5fdf=0xce;}_0x41154[_0xc7c6('0x1e')](_0x2f5fdf);return _0x41154[_0xc7c6('0x23')](_0xc7c6('0x24'),_0x37e18d+'-'+_0x2d820f+'/'+_0x516aee)[_0xc7c6('0x1f')](_0x4e7c2f);}return null;};}function patchUpdates(_0x245514){return function(_0x215d15){try{jsonpatch[_0xc7c6('0x25')](_0x215d15,_0x245514,!![]);}catch(_0x2c76ea){return BPromise[_0xc7c6('0x26')](_0x2c76ea);}return _0x215d15[_0xc7c6('0x27')]();};}function saveUpdates(_0x447e40,_0x3219e9){return function(_0x5048c6){if(_0x5048c6){return _0x5048c6['update'](_0x447e40)['then'](function(_0x4f3457){return _0x4f3457;});}return null;};}function removeEntity(_0x50b95d,_0x531b47){return function(_0x2397c2){if(_0x2397c2){return _0x2397c2[_0xc7c6('0x28')]()[_0xc7c6('0x29')](function(){_0x50b95d['status'](0xcc)[_0xc7c6('0x2a')]();});}};}function handleEntityNotFound(_0x54f5cc,_0x48775c){return function(_0x1135c0){if(!_0x1135c0){_0x54f5cc[_0xc7c6('0x1d')](0x194);}return _0x1135c0;};}function handleError(_0x1a6873,_0x3eed10){_0x3eed10=_0x3eed10||0x1f4;return function(_0x3f243c){logger[_0xc7c6('0x2b')](_0x3f243c[_0xc7c6('0x2c')]);if(_0x3f243c[_0xc7c6('0x2d')]){delete _0x3f243c['name'];}_0x1a6873[_0xc7c6('0x1e')](_0x3eed10)[_0xc7c6('0x2e')](_0x3f243c);};}exports[_0xc7c6('0x2f')]=function(_0x49ff2d,_0x5b1a05){var _0x129ff7={},_0xab1914={},_0x2df848={'count':0x0,'rows':[]};var _0xd62d7a=_[_0xc7c6('0x30')](db[_0xc7c6('0x31')][_0xc7c6('0x32')],function(_0x57aa64){return{'name':_0x57aa64[_0xc7c6('0x33')],'type':_0x57aa64[_0xc7c6('0x34')][_0xc7c6('0x35')]};});_0xab1914[_0xc7c6('0x36')]=_[_0xc7c6('0x30')](_0xd62d7a,_0xc7c6('0x2d'));_0xab1914['query']=_[_0xc7c6('0x37')](_0x49ff2d['query']);_0xab1914[_0xc7c6('0x38')]=_['intersection'](_0xab1914['model'],_0xab1914[_0xc7c6('0x39')]);_0x129ff7['attributes']=_[_0xc7c6('0x3a')](_0xab1914[_0xc7c6('0x36')],qs[_0xc7c6('0x3b')](_0x49ff2d['query']['fields']));_0x129ff7[_0xc7c6('0x3c')]=_0x129ff7['attributes'][_0xc7c6('0x3d')]?_0x129ff7['attributes']:_0xab1914[_0xc7c6('0x36')];if(!_0x49ff2d[_0xc7c6('0x39')][_0xc7c6('0x3e')](_0xc7c6('0x3f'))){_0x129ff7[_0xc7c6('0x22')]=qs[_0xc7c6('0x22')](_0x49ff2d[_0xc7c6('0x39')][_0xc7c6('0x22')]);_0x129ff7['offset']=qs[_0xc7c6('0x21')](_0x49ff2d[_0xc7c6('0x39')][_0xc7c6('0x21')]);}_0x129ff7[_0xc7c6('0x40')]=qs[_0xc7c6('0x41')](_0x49ff2d['query'][_0xc7c6('0x41')]);_0x129ff7[_0xc7c6('0x42')]=qs[_0xc7c6('0x38')](_[_0xc7c6('0x43')](_0x49ff2d[_0xc7c6('0x39')],_0xab1914[_0xc7c6('0x38')]),_0xd62d7a);if(_0x49ff2d[_0xc7c6('0x39')][_0xc7c6('0x44')]){_0x129ff7[_0xc7c6('0x42')]=_[_0xc7c6('0x45')](_0x129ff7[_0xc7c6('0x42')],{'$or':_['map'](_0xd62d7a,function(_0xa670bf){if(_0xa670bf[_0xc7c6('0x34')]!==_0xc7c6('0x46')){var _0x5a2253={};_0x5a2253[_0xa670bf[_0xc7c6('0x2d')]]={'$like':'%'+_0x49ff2d['query']['filter']+'%'};return _0x5a2253;}})});}_0x129ff7=_[_0xc7c6('0x45')]({},_0x129ff7,_0x49ff2d[_0xc7c6('0x47')]);var _0x37a27d={'where':_0x129ff7['where']};return db[_0xc7c6('0x31')]['count'](_0x37a27d)['then'](function(_0x2d6208){_0x2df848[_0xc7c6('0x20')]=_0x2d6208;if(_0x49ff2d[_0xc7c6('0x39')]['includeAll']){_0x129ff7[_0xc7c6('0x48')]=[{'all':!![]}];}return db[_0xc7c6('0x31')][_0xc7c6('0x49')](_0x129ff7);})[_0xc7c6('0x29')](function(_0x2b60aa){_0x2df848[_0xc7c6('0x4a')]=_0x2b60aa;return _0x2df848;})['then'](respondWithFilteredResult(_0x5b1a05,_0x129ff7))[_0xc7c6('0x4b')](handleError(_0x5b1a05,null));};exports[_0xc7c6('0x4c')]=function(_0x222cff,_0xccbd26){var _0x23df16={'raw':!![],'where':{'id':_0x222cff['params']['id']}},_0x4d0356={};_0x4d0356['model']=_['keys'](db['JscriptyQuestionReport'][_0xc7c6('0x32')]);_0x4d0356['query']=_[_0xc7c6('0x37')](_0x222cff[_0xc7c6('0x39')]);_0x4d0356[_0xc7c6('0x38')]=_[_0xc7c6('0x3a')](_0x4d0356[_0xc7c6('0x36')],_0x4d0356[_0xc7c6('0x39')]);_0x23df16[_0xc7c6('0x3c')]=_[_0xc7c6('0x3a')](_0x4d0356[_0xc7c6('0x36')],qs[_0xc7c6('0x3b')](_0x222cff['query']['fields']));_0x23df16[_0xc7c6('0x3c')]=_0x23df16[_0xc7c6('0x3c')][_0xc7c6('0x3d')]?_0x23df16[_0xc7c6('0x3c')]:_0x4d0356['model'];if(_0x222cff[_0xc7c6('0x39')][_0xc7c6('0x4d')]){_0x23df16[_0xc7c6('0x48')]=[{'all':!![]}];}_0x23df16=_['merge']({},_0x23df16,_0x222cff[_0xc7c6('0x47')]);return db[_0xc7c6('0x31')][_0xc7c6('0x4e')](_0x23df16)['then'](handleEntityNotFound(_0xccbd26,null))[_0xc7c6('0x29')](respondWithResult(_0xccbd26,null))[_0xc7c6('0x4b')](handleError(_0xccbd26,null));};exports[_0xc7c6('0x4f')]=function(_0x1eaf4d,_0xb63937){return db['JscriptyQuestionReport'][_0xc7c6('0x4f')](_0x1eaf4d[_0xc7c6('0x50')],{})[_0xc7c6('0x29')](respondWithResult(_0xb63937,0xc9))[_0xc7c6('0x4b')](handleError(_0xb63937,null));};exports[_0xc7c6('0x51')]=function(_0x41cb1f,_0x340852){if(_0x41cb1f[_0xc7c6('0x50')]['id']){delete _0x41cb1f[_0xc7c6('0x50')]['id'];}return db['JscriptyQuestionReport'][_0xc7c6('0x4e')]({'where':{'id':_0x41cb1f[_0xc7c6('0x52')]['id']}})[_0xc7c6('0x29')](handleEntityNotFound(_0x340852,null))[_0xc7c6('0x29')](saveUpdates(_0x41cb1f[_0xc7c6('0x50')],null))['then'](respondWithResult(_0x340852,null))[_0xc7c6('0x4b')](handleError(_0x340852,null));};exports['destroy']=function(_0x535831,_0x5e3c11){return db[_0xc7c6('0x31')][_0xc7c6('0x4e')]({'where':{'id':_0x535831[_0xc7c6('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e3c11,null))[_0xc7c6('0x29')](removeEntity(_0x5e3c11,null))[_0xc7c6('0x4b')](handleError(_0x5e3c11,null));};exports[_0xc7c6('0x53')]=function(_0x38806d,_0x11f7f2){return db['JscriptyQuestionReport'][_0xc7c6('0x53')]()['then'](respondWithResult(_0x11f7f2,null))[_0xc7c6('0x4b')](handleError(_0x11f7f2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 912c3bc..c4b4302 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 _0x3418=['bluebird','path','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3418,0x72));var _0x8341=function(_0x3a0bcc,_0xa9dc0c){_0x3a0bcc=_0x3a0bcc-0x0;var _0x38f258=_0x3418[_0x3a0bcc];return _0x38f258;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8341('0x0'))(_0x8341('0x1'));var moment=require(_0x8341('0x2'));var BPromise=require(_0x8341('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8341('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8341('0x5'));module[_0x8341('0x6')]=function(_0x13a322,_0x58c02e){return _0x13a322[_0x8341('0x7')]('JscriptyQuestionReport',attributes,{'tableName':_0x8341('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x975d=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14e82f,_0x412d71){var _0x3cbfbe=function(_0x56371b){while(--_0x56371b){_0x14e82f['push'](_0x14e82f['shift']());}};_0x3cbfbe(++_0x412d71);}(_0x975d,0x86));var _0xd975=function(_0x4b0662,_0x4fc4f6){_0x4b0662=_0x4b0662-0x0;var _0x267685=_0x975d[_0x4b0662];return _0x267685;};'use strict';var _=require('lodash');var util=require(_0xd975('0x0'));var logger=require(_0xd975('0x1'))(_0xd975('0x2'));var moment=require(_0xd975('0x3'));var BPromise=require(_0xd975('0x4'));var rp=require(_0xd975('0x5'));var fs=require('fs');var path=require(_0xd975('0x6'));var rimraf=require(_0xd975('0x7'));var config=require(_0xd975('0x8'));var attributes=require(_0xd975('0x9'));module[_0xd975('0xa')]=function(_0x52df8b,_0x56efc9){return _0x52df8b[_0xd975('0xb')](_0xd975('0xc'),attributes,{'tableName':'report_jscripty_questions','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 f000f5d..baa7de7 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 _0x13b5=['http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x484e47,_0x155a54){var _0x5c6ea5=function(_0x312683){while(--_0x312683){_0x484e47['push'](_0x484e47['shift']());}};_0x5c6ea5(++_0x155a54);}(_0x13b5,0x1e4));var _0x513b=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x13b5[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x513b('0x0'));var util=require('util');var moment=require(_0x513b('0x1'));var BPromise=require(_0x513b('0x2'));var rs=require(_0x513b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x513b('0x4'))['db'];var utils=require(_0x513b('0x5'));var logger=require(_0x513b('0x6'))(_0x513b('0x7'));var config=require(_0x513b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x513b('0x9')][_0x513b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288b6b,_0x7edce3,_0x42559c){return new BPromise(function(_0x4e5e99,_0x5b3620){return client['request'](_0x288b6b,_0x42559c)[_0x513b('0xb')](function(_0x51a8bd){logger[_0x513b('0xc')](_0x513b('0xd'),_0x7edce3,_0x513b('0xe'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x7edce3,_0x513b('0xe'),JSON['stringify'](_0x51a8bd));if(_0x51a8bd[_0x513b('0xf')]){if(_0x51a8bd['error'][_0x513b('0x10')]===0x1f4){logger[_0x513b('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x7edce3,_0x51a8bd[_0x513b('0xf')]['message']);return _0x5b3620(_0x51a8bd[_0x513b('0xf')][_0x513b('0x11')]);}logger[_0x513b('0xf')](_0x513b('0xd'),_0x7edce3,_0x51a8bd['error'][_0x513b('0x11')]);return _0x4e5e99(_0x51a8bd[_0x513b('0xf')][_0x513b('0x11')]);}else{logger['info'](_0x513b('0xd'),_0x7edce3,_0x513b('0xe'));_0x4e5e99(_0x51a8bd[_0x513b('0x12')]['message']);}})['catch'](function(_0x2cdd8c){logger['error'](_0x513b('0xd'),_0x7edce3,_0x2cdd8c);_0x5b3620(_0x2cdd8c);});});} \ No newline at end of file +var _0x3341=['bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x3341,0x12e));var _0x1334=function(_0x4e3af4,_0x250f05){_0x4e3af4=_0x4e3af4-0x0;var _0x48e43a=_0x3341[_0x4e3af4];return _0x48e43a;};'use strict';var _=require(_0x1334('0x0'));var util=require('util');var moment=require(_0x1334('0x1'));var BPromise=require(_0x1334('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1334('0x3'))['db'];var utils=require(_0x1334('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1334('0x5'));var jayson=require(_0x1334('0x6'));var client=jayson['client'][_0x1334('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5bb527,_0x38f889,_0x32b62b){return new BPromise(function(_0x1a91f8,_0x44d5ee){return client['request'](_0x5bb527,_0x32b62b)[_0x1334('0x8')](function(_0x188b48){logger['info'](_0x1334('0x9'),_0x38f889,_0x1334('0xa'));logger[_0x1334('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x38f889,'request\x20sent',JSON[_0x1334('0xc')](_0x188b48));if(_0x188b48[_0x1334('0xd')]){if(_0x188b48[_0x1334('0xd')][_0x1334('0xe')]===0x1f4){logger[_0x1334('0xd')](_0x1334('0x9'),_0x38f889,_0x188b48['error'][_0x1334('0xf')]);return _0x44d5ee(_0x188b48[_0x1334('0xd')][_0x1334('0xf')]);}logger[_0x1334('0xd')](_0x1334('0x9'),_0x38f889,_0x188b48[_0x1334('0xd')][_0x1334('0xf')]);return _0x1a91f8(_0x188b48[_0x1334('0xd')][_0x1334('0xf')]);}else{logger[_0x1334('0x10')](_0x1334('0x9'),_0x38f889,_0x1334('0xa'));_0x1a91f8(_0x188b48[_0x1334('0x11')][_0x1334('0xf')]);}})[_0x1334('0x12')](function(_0x535c15){logger[_0x1334('0xd')](_0x1334('0x9'),_0x38f889,_0x535c15);_0x44d5ee(_0x535c15);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index b489410..5b03b22 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 _0xde64=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','show','/:id/questions','getQuestions','create','put','delete','exports'];(function(_0x5b5ffe,_0xa8bf6e){var _0x4c2fb0=function(_0x48ca31){while(--_0x48ca31){_0x5b5ffe['push'](_0x5b5ffe['shift']());}};_0x4c2fb0(++_0xa8bf6e);}(_0xde64,0x17c));var _0x4de6=function(_0x55e725,_0x2499e1){_0x55e725=_0x55e725-0x0;var _0x571836=_0xde64[_0x55e725];return _0x571836;};'use strict';var multer=require(_0x4de6('0x0'));var util=require(_0x4de6('0x1'));var path=require(_0x4de6('0x2'));var timeout=require(_0x4de6('0x3'));var express=require(_0x4de6('0x4'));var router=express[_0x4de6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4de6('0x6'));var config=require(_0x4de6('0x7'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x4de6('0x8')](),controller[_0x4de6('0x9')]);router['get']('/describe',auth[_0x4de6('0x8')](),controller[_0x4de6('0xa')]);router[_0x4de6('0xb')](_0x4de6('0xc'),auth[_0x4de6('0x8')](),controller[_0x4de6('0xd')]);router['get'](_0x4de6('0xe'),auth[_0x4de6('0x8')](),controller[_0x4de6('0xf')]);router['post']('/',auth[_0x4de6('0x8')](),controller[_0x4de6('0x10')]);router[_0x4de6('0x11')](_0x4de6('0xc'),auth[_0x4de6('0x8')](),controller['update']);router[_0x4de6('0x12')](_0x4de6('0xc'),auth[_0x4de6('0x8')](),controller['destroy']);module[_0x4de6('0x13')]=router; \ No newline at end of file +var _0x3ee5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','update','delete','util','path','express'];(function(_0x31868c,_0x27d5bd){var _0x3e6fc4=function(_0x29f5dc){while(--_0x29f5dc){_0x31868c['push'](_0x31868c['shift']());}};_0x3e6fc4(++_0x27d5bd);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x5736e2,_0x4f5ae4){_0x5736e2=_0x5736e2-0x0;var _0x37cdab=_0x3ee5[_0x5736e2];return _0x37cdab;};'use strict';var multer=require('multer');var util=require(_0x53ee('0x0'));var path=require(_0x53ee('0x1'));var timeout=require('connect-timeout');var express=require(_0x53ee('0x2'));var router=express[_0x53ee('0x3')]();var auth=require(_0x53ee('0x4'));var interaction=require(_0x53ee('0x5'));var config=require(_0x53ee('0x6'));var controller=require(_0x53ee('0x7'));router[_0x53ee('0x8')]('/',auth[_0x53ee('0x9')](),controller[_0x53ee('0xa')]);router[_0x53ee('0x8')](_0x53ee('0xb'),auth['isAuthenticated'](),controller[_0x53ee('0xc')]);router[_0x53ee('0x8')](_0x53ee('0xd'),auth[_0x53ee('0x9')](),controller[_0x53ee('0xe')]);router[_0x53ee('0x8')](_0x53ee('0xf'),auth[_0x53ee('0x9')](),controller[_0x53ee('0x10')]);router[_0x53ee('0x11')]('/',auth[_0x53ee('0x9')](),controller[_0x53ee('0x12')]);router['put']('/:id',auth[_0x53ee('0x9')](),controller[_0x53ee('0x13')]);router[_0x53ee('0x14')](_0x53ee('0xd'),auth[_0x53ee('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 7d682ef..cb352a8 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 _0x6903=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','exports','DATE'];(function(_0x3f6dd7,_0x484b9f){var _0x482ee6=function(_0x445f80){while(--_0x445f80){_0x3f6dd7['push'](_0x3f6dd7['shift']());}};_0x482ee6(++_0x484b9f);}(_0x6903,0x7b));var _0x3690=function(_0x4f779d,_0x26729d){_0x4f779d=_0x4f779d-0x0;var _0x1130be=_0x6903[_0x4f779d];return _0x1130be;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3690('0x0')]={'starttime':{'type':Sequelize[_0x3690('0x1')],'set':function(_0x5a7b8a){this['setDataValue']('starttime',_0x5a7b8a);this['setDataValue']('endtime',moment()[_0x3690('0x2')](_0x3690('0x3')));}},'endtime':{'type':Sequelize[_0x3690('0x1')]},'membername':{'type':Sequelize[_0x3690('0x4')]},'projectname':{'type':Sequelize[_0x3690('0x4')]},'queue':{'type':Sequelize[_0x3690('0x4')]},'uniqueid':{'type':Sequelize[_0x3690('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4dba=['setDataValue','STRING','BOOLEAN','moment','sequelize','exports','DATE'];(function(_0x3c7541,_0x4534cd){var _0x3beb7a=function(_0x4d9ff7){while(--_0x4d9ff7){_0x3c7541['push'](_0x3c7541['shift']());}};_0x3beb7a(++_0x4534cd);}(_0x4dba,0x14c));var _0xa4db=function(_0x172114,_0x53889f){_0x172114=_0x172114-0x0;var _0x46aa=_0x4dba[_0x172114];return _0x46aa;};'use strict';var moment=require(_0xa4db('0x0'));var Sequelize=require(_0xa4db('0x1'));module[_0xa4db('0x2')]={'starttime':{'type':Sequelize[_0xa4db('0x3')],'set':function(_0x44e9fb){this[_0xa4db('0x4')]('starttime',_0x44e9fb);this[_0xa4db('0x4')]('endtime',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xa4db('0x5')]},'projectname':{'type':Sequelize[_0xa4db('0x5')]},'queue':{'type':Sequelize[_0xa4db('0x5')]},'uniqueid':{'type':Sequelize[_0xa4db('0x5')]},'calleridname':{'type':Sequelize[_0xa4db('0x5')]},'calleridnum':{'type':Sequelize[_0xa4db('0x5')]},'completed':{'type':Sequelize[_0xa4db('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6f8a45b..fda5da6 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 _0x753d=['options','JscriptySessionReport','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','create','body','find','destroy','describe','JscriptyQuestionReport','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','end','error','stack','name','send','index','fieldName','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type'];(function(_0x1a425a,_0x2b8620){var _0x2506d7=function(_0x41833f){while(--_0x41833f){_0x1a425a['push'](_0x1a425a['shift']());}};_0x2506d7(++_0x2b8620);}(_0x753d,0x141));var _0xd753=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x753d[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xd753('0x0'));var emlformat=require(_0xd753('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd753('0x2'));var rp=require('request-promise');var moment=require(_0xd753('0x3'));var BPromise=require(_0xd753('0x4'));var Mustache=require(_0xd753('0x5'));var util=require(_0xd753('0x6'));var path=require(_0xd753('0x7'));var sox=require('sox');var csv=require(_0xd753('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd753('0x9'));var squel=require('squel');var crypto=require(_0xd753('0xa'));var jsforce=require(_0xd753('0xb'));var deskjs=require(_0xd753('0xc'));var toCsv=require(_0xd753('0x8'));var querystring=require(_0xd753('0xd'));var Papa=require(_0xd753('0xe'));var Redis=require(_0xd753('0xf'));var authService=require(_0xd753('0x10'));var qs=require(_0xd753('0x11'));var as=require(_0xd753('0x12'));var hardwareService=require(_0xd753('0x13'));var logger=require(_0xd753('0x14'))(_0xd753('0x15'));var utils=require(_0xd753('0x16'));var config=require('../../config/environment');var db=require(_0xd753('0x17'))['db'];function respondWithStatusCode(_0x3658ad,_0xde6216){_0xde6216=_0xde6216||0xcc;return function(_0xc6eff6){if(_0xc6eff6){return _0x3658ad[_0xd753('0x18')](_0xde6216);}return _0x3658ad[_0xd753('0x19')](_0xde6216)['end']();};}function respondWithResult(_0x586083,_0x33b514){_0x33b514=_0x33b514||0xc8;return function(_0x5c80fa){if(_0x5c80fa){return _0x586083['status'](_0x33b514)[_0xd753('0x1a')](_0x5c80fa);}};}function respondWithFilteredResult(_0x236156,_0x3e2eb0){return function(_0x373919){if(_0x373919){var _0x511f67=_0x373919[_0xd753('0x1b')],_0x4e8813=_0x3e2eb0[_0xd753('0x1c')],_0x380d6a=_0x3e2eb0[_0xd753('0x1c')]+_0x3e2eb0[_0xd753('0x1d')],_0x76d644;if(_0x380d6a>=_0x511f67){_0x380d6a=_0x511f67;_0x76d644=0xc8;}else{_0x76d644=0xce;}_0x236156[_0xd753('0x19')](_0x76d644);return _0x236156[_0xd753('0x1e')](_0xd753('0x1f'),_0x4e8813+'-'+_0x380d6a+'/'+_0x511f67)[_0xd753('0x1a')](_0x373919);}return null;};}function patchUpdates(_0x16aa49){return function(_0x145e5e){try{jsonpatch['apply'](_0x145e5e,_0x16aa49,!![]);}catch(_0x3f7f07){return BPromise[_0xd753('0x20')](_0x3f7f07);}return _0x145e5e['save']();};}function saveUpdates(_0x2a94c5,_0x569f13){return function(_0x18159f){if(_0x18159f){return _0x18159f[_0xd753('0x21')](_0x2a94c5)['then'](function(_0x12bccf){return _0x12bccf;});}return null;};}function removeEntity(_0x700fc5,_0x3a58e4){return function(_0x1b116b){if(_0x1b116b){return _0x1b116b['destroy']()[_0xd753('0x22')](function(){_0x700fc5[_0xd753('0x19')](0xcc)[_0xd753('0x23')]();});}};}function handleEntityNotFound(_0x2ea128,_0x2b9df3){return function(_0x220c63){if(!_0x220c63){_0x2ea128['sendStatus'](0x194);}return _0x220c63;};}function handleError(_0x14e0be,_0x1a2f19){_0x1a2f19=_0x1a2f19||0x1f4;return function(_0x13b20f){logger[_0xd753('0x24')](_0x13b20f[_0xd753('0x25')]);if(_0x13b20f[_0xd753('0x26')]){delete _0x13b20f[_0xd753('0x26')];}_0x14e0be[_0xd753('0x19')](_0x1a2f19)[_0xd753('0x27')](_0x13b20f);};}exports[_0xd753('0x28')]=function(_0x35a5f4,_0x524fbb){var _0x22818c={},_0x4b6c28={},_0x42b0f8={'count':0x0,'rows':[]};var _0x1bc8f8=_['map'](db['JscriptySessionReport']['rawAttributes'],function(_0x3cbd59){return{'name':_0x3cbd59[_0xd753('0x29')],'type':_0x3cbd59['type'][_0xd753('0x2a')]};});_0x4b6c28[_0xd753('0x2b')]=_[_0xd753('0x2c')](_0x1bc8f8,_0xd753('0x26'));_0x4b6c28['query']=_['keys'](_0x35a5f4[_0xd753('0x2d')]);_0x4b6c28[_0xd753('0x2e')]=_['intersection'](_0x4b6c28['model'],_0x4b6c28[_0xd753('0x2d')]);_0x22818c[_0xd753('0x2f')]=_[_0xd753('0x30')](_0x4b6c28[_0xd753('0x2b')],qs[_0xd753('0x31')](_0x35a5f4[_0xd753('0x2d')][_0xd753('0x31')]));_0x22818c['attributes']=_0x22818c[_0xd753('0x2f')]['length']?_0x22818c['attributes']:_0x4b6c28[_0xd753('0x2b')];if(!_0x35a5f4[_0xd753('0x2d')][_0xd753('0x32')](_0xd753('0x33'))){_0x22818c['limit']=qs[_0xd753('0x1d')](_0x35a5f4[_0xd753('0x2d')][_0xd753('0x1d')]);_0x22818c[_0xd753('0x1c')]=qs['offset'](_0x35a5f4[_0xd753('0x2d')][_0xd753('0x1c')]);}_0x22818c[_0xd753('0x34')]=qs[_0xd753('0x35')](_0x35a5f4[_0xd753('0x2d')]['sort']);_0x22818c[_0xd753('0x36')]=qs['filters'](_[_0xd753('0x37')](_0x35a5f4[_0xd753('0x2d')],_0x4b6c28[_0xd753('0x2e')]),_0x1bc8f8);if(_0x35a5f4[_0xd753('0x2d')][_0xd753('0x38')]){_0x22818c[_0xd753('0x36')]=_[_0xd753('0x39')](_0x22818c[_0xd753('0x36')],{'$or':_['map'](_0x1bc8f8,function(_0x1c3e84){if(_0x1c3e84[_0xd753('0x3a')]!=='VIRTUAL'){var _0x12a30c={};_0x12a30c[_0x1c3e84[_0xd753('0x26')]]={'$like':'%'+_0x35a5f4['query'][_0xd753('0x38')]+'%'};return _0x12a30c;}})});}_0x22818c=_[_0xd753('0x39')]({},_0x22818c,_0x35a5f4[_0xd753('0x3b')]);var _0x59cb8c={'where':_0x22818c['where']};return db[_0xd753('0x3c')][_0xd753('0x1b')](_0x59cb8c)[_0xd753('0x22')](function(_0x156fb4){_0x42b0f8[_0xd753('0x1b')]=_0x156fb4;if(_0x35a5f4[_0xd753('0x2d')][_0xd753('0x3d')]){_0x22818c[_0xd753('0x3e')]=[{'all':!![]}];}return db[_0xd753('0x3c')][_0xd753('0x3f')](_0x22818c);})[_0xd753('0x22')](function(_0x2980d3){_0x42b0f8[_0xd753('0x40')]=_0x2980d3;return _0x42b0f8;})[_0xd753('0x22')](respondWithFilteredResult(_0x524fbb,_0x22818c))[_0xd753('0x41')](handleError(_0x524fbb,null));};exports['show']=function(_0x4e3c94,_0x5b6767){var _0x3ad7c0={'raw':!![],'where':{'id':_0x4e3c94[_0xd753('0x42')]['id']}},_0x3fab0e={};_0x3fab0e['model']=_[_0xd753('0x43')](db[_0xd753('0x3c')][_0xd753('0x44')]);_0x3fab0e[_0xd753('0x2d')]=_['keys'](_0x4e3c94[_0xd753('0x2d')]);_0x3fab0e[_0xd753('0x2e')]=_[_0xd753('0x30')](_0x3fab0e[_0xd753('0x2b')],_0x3fab0e[_0xd753('0x2d')]);_0x3ad7c0[_0xd753('0x2f')]=_[_0xd753('0x30')](_0x3fab0e[_0xd753('0x2b')],qs[_0xd753('0x31')](_0x4e3c94[_0xd753('0x2d')][_0xd753('0x31')]));_0x3ad7c0[_0xd753('0x2f')]=_0x3ad7c0['attributes'][_0xd753('0x45')]?_0x3ad7c0[_0xd753('0x2f')]:_0x3fab0e['model'];if(_0x4e3c94['query'][_0xd753('0x3d')]){_0x3ad7c0[_0xd753('0x3e')]=[{'all':!![]}];}_0x3ad7c0=_['merge']({},_0x3ad7c0,_0x4e3c94[_0xd753('0x3b')]);return db[_0xd753('0x3c')]['find'](_0x3ad7c0)['then'](handleEntityNotFound(_0x5b6767,null))[_0xd753('0x22')](respondWithResult(_0x5b6767,null))['catch'](handleError(_0x5b6767,null));};exports[_0xd753('0x46')]=function(_0x1ea922,_0x3e165a){return db[_0xd753('0x3c')][_0xd753('0x46')](_0x1ea922[_0xd753('0x47')],{})[_0xd753('0x22')](respondWithResult(_0x3e165a,0xc9))['catch'](handleError(_0x3e165a,null));};exports[_0xd753('0x21')]=function(_0x515940,_0x194e47){if(_0x515940[_0xd753('0x47')]['id']){delete _0x515940[_0xd753('0x47')]['id'];}return db[_0xd753('0x3c')][_0xd753('0x48')]({'where':{'id':_0x515940[_0xd753('0x42')]['id']}})[_0xd753('0x22')](handleEntityNotFound(_0x194e47,null))[_0xd753('0x22')](saveUpdates(_0x515940[_0xd753('0x47')],null))[_0xd753('0x22')](respondWithResult(_0x194e47,null))['catch'](handleError(_0x194e47,null));};exports[_0xd753('0x49')]=function(_0x3af6fc,_0x2acacb){return db[_0xd753('0x3c')][_0xd753('0x48')]({'where':{'id':_0x3af6fc[_0xd753('0x42')]['id']}})['then'](handleEntityNotFound(_0x2acacb,null))[_0xd753('0x22')](removeEntity(_0x2acacb,null))[_0xd753('0x41')](handleError(_0x2acacb,null));};exports['describe']=function(_0x2ec7c3,_0x45a0f3){return db[_0xd753('0x3c')][_0xd753('0x4a')]()[_0xd753('0x22')](respondWithResult(_0x45a0f3,null))[_0xd753('0x41')](handleError(_0x45a0f3,null));};exports['getQuestions']=function(_0x318199,_0x496d3d,_0x594c89){var _0x53ffb5={'raw':!![],'where':{}};var _0x147d13={};var _0x5b26b7={'count':0x0,'rows':[]};return db[_0xd753('0x3c')]['findOne']({'where':{'id':_0x318199['params']['id']}})[_0xd753('0x22')](handleEntityNotFound(_0x496d3d,null))[_0xd753('0x22')](function(_0x56652e){if(_0x56652e){_0x147d13[_0xd753('0x2b')]=_[_0xd753('0x43')](db[_0xd753('0x4b')]['rawAttributes']);_0x147d13[_0xd753('0x2d')]=_[_0xd753('0x43')](_0x318199[_0xd753('0x2d')]);_0x147d13[_0xd753('0x2e')]=_['intersection'](_0x147d13[_0xd753('0x2b')],_0x147d13[_0xd753('0x2d')]);_0x53ffb5[_0xd753('0x2f')]=_[_0xd753('0x30')](_0x147d13[_0xd753('0x2b')],qs[_0xd753('0x31')](_0x318199[_0xd753('0x2d')][_0xd753('0x31')]));_0x53ffb5['attributes']=_0x53ffb5[_0xd753('0x2f')][_0xd753('0x45')]?_0x53ffb5['attributes']:_0x147d13[_0xd753('0x2b')];if(!_0x318199['query'][_0xd753('0x32')](_0xd753('0x33'))){_0x53ffb5[_0xd753('0x1d')]=qs[_0xd753('0x1d')](_0x318199['query'][_0xd753('0x1d')]);_0x53ffb5['offset']=qs[_0xd753('0x1c')](_0x318199[_0xd753('0x2d')][_0xd753('0x1c')]);}_0x53ffb5[_0xd753('0x34')]=qs[_0xd753('0x35')](_0x318199[_0xd753('0x2d')][_0xd753('0x35')]);_0x53ffb5[_0xd753('0x36')]=qs['filters'](_[_0xd753('0x37')](_0x318199['query'],_0x147d13['filters']));_0x53ffb5['where']['SessionId']=_0x56652e['id'];if(_0x318199['query'][_0xd753('0x38')]){_0x53ffb5[_0xd753('0x36')]=_[_0xd753('0x39')](_0x53ffb5[_0xd753('0x36')],{'$or':_[_0xd753('0x2c')](_0x53ffb5[_0xd753('0x2f')],function(_0x500885){var _0x2af92f={};_0x2af92f[_0x500885]={'$like':'%'+_0x318199[_0xd753('0x2d')][_0xd753('0x38')]+'%'};return _0x2af92f;})});}_0x53ffb5=_['merge']({},_0x53ffb5,_0x318199[_0xd753('0x3b')]);return db[_0xd753('0x4b')][_0xd753('0x1b')]({'where':_0x53ffb5[_0xd753('0x36')]})['then'](function(_0x41c0a0){_0x5b26b7[_0xd753('0x1b')]=_0x41c0a0;if(_0x318199['query'][_0xd753('0x3d')]){_0x53ffb5[_0xd753('0x3e')]=[{'all':!![]}];}return db[_0xd753('0x4b')]['findAll'](_0x53ffb5);})['then'](function(_0x5789fc){_0x5b26b7[_0xd753('0x40')]=_0x5789fc;return _0x5b26b7;});}})[_0xd753('0x22')](respondWithFilteredResult(_0x496d3d,_0x53ffb5))[_0xd753('0x41')](handleError(_0x496d3d,null));}; \ No newline at end of file +var _0x5742=['describe','getQuestions','findOne','JscriptyQuestionReport','length','nolimit','rimraf','zip-dir','moment','util','path','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','apply','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params'];(function(_0x36ef37,_0x2008b3){var _0x2a9a38=function(_0x6314d8){while(--_0x6314d8){_0x36ef37['push'](_0x36ef37['shift']());}};_0x2a9a38(++_0x2008b3);}(_0x5742,0x1cd));var _0x2574=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x5742[_0x500419];return _0x241c1a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2574('0x0'));var zipdir=require(_0x2574('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2574('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2574('0x3'));var path=require(_0x2574('0x4'));var sox=require('sox');var csv=require(_0x2574('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2574('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2574('0x7'));var deskjs=require(_0x2574('0x8'));var toCsv=require(_0x2574('0x5'));var querystring=require('querystring');var Papa=require(_0x2574('0x9'));var Redis=require(_0x2574('0xa'));var authService=require(_0x2574('0xb'));var qs=require(_0x2574('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2574('0xd'))(_0x2574('0xe'));var utils=require('../../config/utils');var config=require(_0x2574('0xf'));var db=require(_0x2574('0x10'))['db'];function respondWithStatusCode(_0x138908,_0x247042){_0x247042=_0x247042||0xcc;return function(_0x44ec43){if(_0x44ec43){return _0x138908['sendStatus'](_0x247042);}return _0x138908[_0x2574('0x11')](_0x247042)[_0x2574('0x12')]();};}function respondWithResult(_0x179df8,_0xcb5147){_0xcb5147=_0xcb5147||0xc8;return function(_0x4b85b9){if(_0x4b85b9){return _0x179df8[_0x2574('0x11')](_0xcb5147)['json'](_0x4b85b9);}};}function respondWithFilteredResult(_0x3a5b57,_0x5a6d45){return function(_0x52dfe0){if(_0x52dfe0){var _0x282fd8=_0x52dfe0[_0x2574('0x13')],_0xf136d4=_0x5a6d45[_0x2574('0x14')],_0x57a206=_0x5a6d45['offset']+_0x5a6d45[_0x2574('0x15')],_0x13aff6;if(_0x57a206>=_0x282fd8){_0x57a206=_0x282fd8;_0x13aff6=0xc8;}else{_0x13aff6=0xce;}_0x3a5b57[_0x2574('0x11')](_0x13aff6);return _0x3a5b57['set'](_0x2574('0x16'),_0xf136d4+'-'+_0x57a206+'/'+_0x282fd8)['json'](_0x52dfe0);}return null;};}function patchUpdates(_0x1d8ee9){return function(_0x1a26d1){try{jsonpatch[_0x2574('0x17')](_0x1a26d1,_0x1d8ee9,!![]);}catch(_0x379415){return BPromise['reject'](_0x379415);}return _0x1a26d1['save']();};}function saveUpdates(_0x17b94d,_0x43a70c){return function(_0x592b22){if(_0x592b22){return _0x592b22['update'](_0x17b94d)[_0x2574('0x18')](function(_0x38ed81){return _0x38ed81;});}return null;};}function removeEntity(_0xd6d5c,_0xe5a95){return function(_0x2017d4){if(_0x2017d4){return _0x2017d4[_0x2574('0x19')]()['then'](function(){_0xd6d5c[_0x2574('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x218408,_0x44768b){return function(_0xa7b57a){if(!_0xa7b57a){_0x218408['sendStatus'](0x194);}return _0xa7b57a;};}function handleError(_0x3a3d15,_0x31eaf9){_0x31eaf9=_0x31eaf9||0x1f4;return function(_0x34b9bf){logger[_0x2574('0x1a')](_0x34b9bf[_0x2574('0x1b')]);if(_0x34b9bf[_0x2574('0x1c')]){delete _0x34b9bf['name'];}_0x3a3d15[_0x2574('0x11')](_0x31eaf9)['send'](_0x34b9bf);};}exports['index']=function(_0x21216f,_0x123da5){var _0x5b0f44={},_0x3245ed={},_0xca4777={'count':0x0,'rows':[]};var _0xce7411=_[_0x2574('0x1d')](db['JscriptySessionReport'][_0x2574('0x1e')],function(_0x1f3a1e){return{'name':_0x1f3a1e[_0x2574('0x1f')],'type':_0x1f3a1e[_0x2574('0x20')]['key']};});_0x3245ed[_0x2574('0x21')]=_['map'](_0xce7411,_0x2574('0x1c'));_0x3245ed['query']=_['keys'](_0x21216f[_0x2574('0x22')]);_0x3245ed[_0x2574('0x23')]=_['intersection'](_0x3245ed[_0x2574('0x21')],_0x3245ed[_0x2574('0x22')]);_0x5b0f44[_0x2574('0x24')]=_[_0x2574('0x25')](_0x3245ed[_0x2574('0x21')],qs[_0x2574('0x26')](_0x21216f[_0x2574('0x22')][_0x2574('0x26')]));_0x5b0f44[_0x2574('0x24')]=_0x5b0f44['attributes']['length']?_0x5b0f44[_0x2574('0x24')]:_0x3245ed[_0x2574('0x21')];if(!_0x21216f[_0x2574('0x22')][_0x2574('0x27')]('nolimit')){_0x5b0f44[_0x2574('0x15')]=qs[_0x2574('0x15')](_0x21216f['query'][_0x2574('0x15')]);_0x5b0f44[_0x2574('0x14')]=qs[_0x2574('0x14')](_0x21216f[_0x2574('0x22')]['offset']);}_0x5b0f44[_0x2574('0x28')]=qs[_0x2574('0x29')](_0x21216f[_0x2574('0x22')]['sort']);_0x5b0f44[_0x2574('0x2a')]=qs[_0x2574('0x23')](_[_0x2574('0x2b')](_0x21216f[_0x2574('0x22')],_0x3245ed[_0x2574('0x23')]),_0xce7411);if(_0x21216f[_0x2574('0x22')][_0x2574('0x2c')]){_0x5b0f44['where']=_[_0x2574('0x2d')](_0x5b0f44[_0x2574('0x2a')],{'$or':_['map'](_0xce7411,function(_0x2ad197){if(_0x2ad197[_0x2574('0x20')]!=='VIRTUAL'){var _0x2aad39={};_0x2aad39[_0x2ad197[_0x2574('0x1c')]]={'$like':'%'+_0x21216f[_0x2574('0x22')][_0x2574('0x2c')]+'%'};return _0x2aad39;}})});}_0x5b0f44=_[_0x2574('0x2d')]({},_0x5b0f44,_0x21216f[_0x2574('0x2e')]);var _0x5d07da={'where':_0x5b0f44['where']};return db[_0x2574('0x2f')][_0x2574('0x13')](_0x5d07da)[_0x2574('0x18')](function(_0x594c30){_0xca4777[_0x2574('0x13')]=_0x594c30;if(_0x21216f[_0x2574('0x22')][_0x2574('0x30')]){_0x5b0f44[_0x2574('0x31')]=[{'all':!![]}];}return db[_0x2574('0x2f')][_0x2574('0x32')](_0x5b0f44);})[_0x2574('0x18')](function(_0xdb1aa4){_0xca4777[_0x2574('0x33')]=_0xdb1aa4;return _0xca4777;})[_0x2574('0x18')](respondWithFilteredResult(_0x123da5,_0x5b0f44))[_0x2574('0x34')](handleError(_0x123da5,null));};exports[_0x2574('0x35')]=function(_0x2111e8,_0x1015e0){var _0x51fb9a={'raw':!![],'where':{'id':_0x2111e8['params']['id']}},_0x215a16={};_0x215a16['model']=_[_0x2574('0x36')](db['JscriptySessionReport'][_0x2574('0x1e')]);_0x215a16[_0x2574('0x22')]=_[_0x2574('0x36')](_0x2111e8['query']);_0x215a16[_0x2574('0x23')]=_[_0x2574('0x25')](_0x215a16['model'],_0x215a16['query']);_0x51fb9a[_0x2574('0x24')]=_[_0x2574('0x25')](_0x215a16[_0x2574('0x21')],qs['fields'](_0x2111e8[_0x2574('0x22')][_0x2574('0x26')]));_0x51fb9a[_0x2574('0x24')]=_0x51fb9a[_0x2574('0x24')]['length']?_0x51fb9a[_0x2574('0x24')]:_0x215a16[_0x2574('0x21')];if(_0x2111e8[_0x2574('0x22')]['includeAll']){_0x51fb9a['include']=[{'all':!![]}];}_0x51fb9a=_[_0x2574('0x2d')]({},_0x51fb9a,_0x2111e8[_0x2574('0x2e')]);return db[_0x2574('0x2f')][_0x2574('0x37')](_0x51fb9a)[_0x2574('0x18')](handleEntityNotFound(_0x1015e0,null))[_0x2574('0x18')](respondWithResult(_0x1015e0,null))[_0x2574('0x34')](handleError(_0x1015e0,null));};exports['create']=function(_0x4a9f01,_0x3366c8){return db[_0x2574('0x2f')][_0x2574('0x38')](_0x4a9f01[_0x2574('0x39')],{})['then'](respondWithResult(_0x3366c8,0xc9))[_0x2574('0x34')](handleError(_0x3366c8,null));};exports['update']=function(_0x9c690d,_0x4f1a42){if(_0x9c690d[_0x2574('0x39')]['id']){delete _0x9c690d['body']['id'];}return db[_0x2574('0x2f')][_0x2574('0x37')]({'where':{'id':_0x9c690d['params']['id']}})[_0x2574('0x18')](handleEntityNotFound(_0x4f1a42,null))[_0x2574('0x18')](saveUpdates(_0x9c690d[_0x2574('0x39')],null))[_0x2574('0x18')](respondWithResult(_0x4f1a42,null))[_0x2574('0x34')](handleError(_0x4f1a42,null));};exports[_0x2574('0x19')]=function(_0x34c6cc,_0x1cb37a){return db[_0x2574('0x2f')][_0x2574('0x37')]({'where':{'id':_0x34c6cc[_0x2574('0x3a')]['id']}})[_0x2574('0x18')](handleEntityNotFound(_0x1cb37a,null))[_0x2574('0x18')](removeEntity(_0x1cb37a,null))[_0x2574('0x34')](handleError(_0x1cb37a,null));};exports['describe']=function(_0x3cbfcd,_0x23775f){return db[_0x2574('0x2f')][_0x2574('0x3b')]()[_0x2574('0x18')](respondWithResult(_0x23775f,null))[_0x2574('0x34')](handleError(_0x23775f,null));};exports[_0x2574('0x3c')]=function(_0x4349ca,_0x3cb776,_0x23816e){var _0x595495={'raw':!![],'where':{}};var _0x46eb7a={};var _0x1cfbac={'count':0x0,'rows':[]};return db[_0x2574('0x2f')][_0x2574('0x3d')]({'where':{'id':_0x4349ca[_0x2574('0x3a')]['id']}})[_0x2574('0x18')](handleEntityNotFound(_0x3cb776,null))[_0x2574('0x18')](function(_0x5d46c5){if(_0x5d46c5){_0x46eb7a[_0x2574('0x21')]=_['keys'](db[_0x2574('0x3e')]['rawAttributes']);_0x46eb7a[_0x2574('0x22')]=_['keys'](_0x4349ca[_0x2574('0x22')]);_0x46eb7a[_0x2574('0x23')]=_[_0x2574('0x25')](_0x46eb7a[_0x2574('0x21')],_0x46eb7a[_0x2574('0x22')]);_0x595495[_0x2574('0x24')]=_['intersection'](_0x46eb7a[_0x2574('0x21')],qs[_0x2574('0x26')](_0x4349ca[_0x2574('0x22')][_0x2574('0x26')]));_0x595495[_0x2574('0x24')]=_0x595495[_0x2574('0x24')][_0x2574('0x3f')]?_0x595495[_0x2574('0x24')]:_0x46eb7a[_0x2574('0x21')];if(!_0x4349ca[_0x2574('0x22')][_0x2574('0x27')](_0x2574('0x40'))){_0x595495[_0x2574('0x15')]=qs[_0x2574('0x15')](_0x4349ca['query'][_0x2574('0x15')]);_0x595495['offset']=qs[_0x2574('0x14')](_0x4349ca['query'][_0x2574('0x14')]);}_0x595495[_0x2574('0x28')]=qs[_0x2574('0x29')](_0x4349ca[_0x2574('0x22')][_0x2574('0x29')]);_0x595495[_0x2574('0x2a')]=qs['filters'](_['pick'](_0x4349ca[_0x2574('0x22')],_0x46eb7a[_0x2574('0x23')]));_0x595495[_0x2574('0x2a')]['SessionId']=_0x5d46c5['id'];if(_0x4349ca['query'][_0x2574('0x2c')]){_0x595495['where']=_[_0x2574('0x2d')](_0x595495[_0x2574('0x2a')],{'$or':_['map'](_0x595495['attributes'],function(_0x52224a){var _0xb42dcc={};_0xb42dcc[_0x52224a]={'$like':'%'+_0x4349ca[_0x2574('0x22')]['filter']+'%'};return _0xb42dcc;})});}_0x595495=_[_0x2574('0x2d')]({},_0x595495,_0x4349ca['options']);return db[_0x2574('0x3e')]['count']({'where':_0x595495[_0x2574('0x2a')]})[_0x2574('0x18')](function(_0x33b044){_0x1cfbac[_0x2574('0x13')]=_0x33b044;if(_0x4349ca[_0x2574('0x22')][_0x2574('0x30')]){_0x595495['include']=[{'all':!![]}];}return db[_0x2574('0x3e')][_0x2574('0x32')](_0x595495);})['then'](function(_0x107b4f){_0x1cfbac[_0x2574('0x33')]=_0x107b4f;return _0x1cfbac;});}})[_0x2574('0x18')](respondWithFilteredResult(_0x3cb776,_0x595495))['catch'](handleError(_0x3cb776,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 3ad67d4..4f4d8c0 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 _0x0120=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x0120,0x6f));var _0x0012=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x0120[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var fs=require('fs');var path=require(_0x0012('0x7'));var rimraf=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var attributes=require(_0x0012('0xa'));module[_0x0012('0xb')]=function(_0x4eaa5b,_0x4b396c){return _0x4eaa5b['define'](_0x0012('0xc'),attributes,{'tableName':_0x0012('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eba=['report_jscripty_sessions','util','../../config/logger','api','moment','path','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x4b3d12,_0x1d4133){var _0x104e8c=function(_0x55db69){while(--_0x55db69){_0x4b3d12['push'](_0x4b3d12['shift']());}};_0x104e8c(++_0x1d4133);}(_0x2eba,0xc7));var _0xa2eb=function(_0x1651fe,_0x385d3f){_0x1651fe=_0x1651fe-0x0;var _0x2b85ce=_0x2eba[_0x1651fe];return _0x2b85ce;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var logger=require(_0xa2eb('0x1'))(_0xa2eb('0x2'));var moment=require(_0xa2eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2eb('0x4'));var rimraf=require('rimraf');var config=require(_0xa2eb('0x5'));var attributes=require(_0xa2eb('0x6'));module[_0xa2eb('0x7')]=function(_0x1e6fa2,_0x575a5c){return _0x1e6fa2['define']('JscriptySessionReport',attributes,{'tableName':_0xa2eb('0x8'),'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 4b8aee7..e4a6514 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 _0xfde8=['rpc','../../config/environment','jayson/promise','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x29486f,_0x23a728){var _0x2893c7=function(_0x494d70){while(--_0x494d70){_0x29486f['push'](_0x29486f['shift']());}};_0x2893c7(++_0x23a728);}(_0xfde8,0x111));var _0x8fde=function(_0x3d22ac,_0x2f2663){_0x3d22ac=_0x3d22ac-0x0;var _0x1d8f78=_0xfde8[_0x3d22ac];return _0x1d8f78;};'use strict';var _=require('lodash');var util=require(_0x8fde('0x0'));var moment=require(_0x8fde('0x1'));var BPromise=require(_0x8fde('0x2'));var rs=require(_0x8fde('0x3'));var fs=require('fs');var Redis=require(_0x8fde('0x4'));var db=require(_0x8fde('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fde('0x6'))(_0x8fde('0x7'));var config=require(_0x8fde('0x8'));var jayson=require(_0x8fde('0x9'));var client=jayson[_0x8fde('0xa')][_0x8fde('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47d8b9,_0x2f7e6b,_0x217453){return new BPromise(function(_0x38e62c,_0x24cca5){return client['request'](_0x47d8b9,_0x217453)['then'](function(_0x37aea8){logger[_0x8fde('0xc')](_0x8fde('0xd'),_0x2f7e6b,_0x8fde('0xe'));logger['debug'](_0x8fde('0xf'),_0x2f7e6b,'request\x20sent',JSON['stringify'](_0x37aea8));if(_0x37aea8[_0x8fde('0x10')]){if(_0x37aea8['error'][_0x8fde('0x11')]===0x1f4){logger[_0x8fde('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x2f7e6b,_0x37aea8[_0x8fde('0x10')][_0x8fde('0x12')]);return _0x24cca5(_0x37aea8[_0x8fde('0x10')]['message']);}logger['error'](_0x8fde('0xd'),_0x2f7e6b,_0x37aea8['error']['message']);return _0x38e62c(_0x37aea8['error'][_0x8fde('0x12')]);}else{logger[_0x8fde('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x2f7e6b,'request\x20sent');_0x38e62c(_0x37aea8['result'][_0x8fde('0x12')]);}})[_0x8fde('0x13')](function(_0x33398b){logger[_0x8fde('0x10')](_0x8fde('0xd'),_0x2f7e6b,_0x33398b);_0x24cca5(_0x33398b);});});} \ No newline at end of file +var _0x6427=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','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'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x6427,0xbe));var _0x7642=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x6427[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0x7642('0x0'));var moment=require(_0x7642('0x1'));var BPromise=require(_0x7642('0x2'));var rs=require(_0x7642('0x3'));var fs=require('fs');var Redis=require(_0x7642('0x4'));var db=require(_0x7642('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7642('0x6'))(_0x7642('0x7'));var config=require(_0x7642('0x8'));var jayson=require(_0x7642('0x9'));var client=jayson[_0x7642('0xa')][_0x7642('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cd5f4,_0x266b9b,_0xd37092){return new BPromise(function(_0x30946f,_0x5e4b1f){return client['request'](_0x1cd5f4,_0xd37092)[_0x7642('0xc')](function(_0x17527f){logger[_0x7642('0xd')](_0x7642('0xe'),_0x266b9b,_0x7642('0xf'));logger[_0x7642('0x10')](_0x7642('0x11'),_0x266b9b,_0x7642('0xf'),JSON[_0x7642('0x12')](_0x17527f));if(_0x17527f[_0x7642('0x13')]){if(_0x17527f[_0x7642('0x13')][_0x7642('0x14')]===0x1f4){logger[_0x7642('0x13')](_0x7642('0xe'),_0x266b9b,_0x17527f[_0x7642('0x13')][_0x7642('0x15')]);return _0x5e4b1f(_0x17527f[_0x7642('0x13')]['message']);}logger[_0x7642('0x13')](_0x7642('0xe'),_0x266b9b,_0x17527f['error'][_0x7642('0x15')]);return _0x30946f(_0x17527f['error'][_0x7642('0x15')]);}else{logger['info'](_0x7642('0xe'),_0x266b9b,_0x7642('0xf'));_0x30946f(_0x17527f[_0x7642('0x16')][_0x7642('0x15')]);}})[_0x7642('0x17')](function(_0x2febf8){logger[_0x7642('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x266b9b,_0x2febf8);_0x5e4b1f(_0x2febf8);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 6e07c7c..6b901df 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 _0x50b6=['index','/:id','isAuthenticated','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x50b6,0x64));var _0x650b=function(_0x14ab74,_0x770feb){_0x14ab74=_0x14ab74-0x0;var _0x27858b=_0x50b6[_0x14ab74];return _0x27858b;};'use strict';var multer=require(_0x650b('0x0'));var util=require(_0x650b('0x1'));var path=require(_0x650b('0x2'));var timeout=require(_0x650b('0x3'));var express=require(_0x650b('0x4'));var router=express['Router']();var auth=require(_0x650b('0x5'));var interaction=require(_0x650b('0x6'));var config=require(_0x650b('0x7'));var controller=require('./license.controller');router['get']('/',controller[_0x650b('0x8')]);router['put'](_0x650b('0x9'),auth[_0x650b('0xa')](),controller['update']);module[_0x650b('0xb')]=router; \ No newline at end of file +var _0x7f43=['./license.controller','index','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4a778a,_0x42fc80){var _0x29a3d3=function(_0x5ce5cf){while(--_0x5ce5cf){_0x4a778a['push'](_0x4a778a['shift']());}};_0x29a3d3(++_0x42fc80);}(_0x7f43,0xdd));var _0x37f4=function(_0x35a153,_0x36047f){_0x35a153=_0x35a153-0x0;var _0x2b000a=_0x7f43[_0x35a153];return _0x2b000a;};'use strict';var multer=require(_0x37f4('0x0'));var util=require(_0x37f4('0x1'));var path=require('path');var timeout=require(_0x37f4('0x2'));var express=require(_0x37f4('0x3'));var router=express[_0x37f4('0x4')]();var auth=require(_0x37f4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x37f4('0x6'));var controller=require(_0x37f4('0x7'));router['get']('/',controller[_0x37f4('0x8')]);router[_0x37f4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x37f4('0xa')]);module[_0x37f4('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 462bc07..9b9af28 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(_0x2a8e60,_0xd4fd67){var _0x35371c=function(_0x386dd6){while(--_0x386dd6){_0x2a8e60['push'](_0x2a8e60['shift']());}};_0x35371c(++_0xd4fd67);}(_0xda19,0xd5));var _0x9da1=function(_0x35d8d5,_0x53b9fa){_0x35d8d5=_0x35d8d5-0x0;var _0x540655=_0xda19[_0x35d8d5];return _0x540655;};'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 _0xdbf5=['exports','STRING','INTEGER'];(function(_0x4b630,_0x151f86){var _0x24f855=function(_0x2ead2a){while(--_0x2ead2a){_0x4b630['push'](_0x4b630['shift']());}};_0x24f855(++_0x151f86);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x444996,_0x57805b){_0x444996=_0x444996-0x0;var _0x380e17=_0xdbf5[_0x444996];return _0x380e17;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5dbf('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5dbf('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 38c34bf..345c5da 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 _0x50d9=['keys','filters','intersection','model','attributes','fields','length','merge','getLicense','catch','body','find','params','get','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','send','License','rawAttributes','query'];(function(_0x17141f,_0x4d7c4b){var _0x3ee900=function(_0x5ec0f4){while(--_0x5ec0f4){_0x17141f['push'](_0x17141f['shift']());}};_0x3ee900(++_0x4d7c4b);}(_0x50d9,0x7b));var _0x950d=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x50d9[_0xae7c2f];return _0x5d7001;};'use strict';var pdf=require(_0x950d('0x0'));var emlformat=require(_0x950d('0x1'));var rimraf=require(_0x950d('0x2'));var zipdir=require(_0x950d('0x3'));var jsonpatch=require(_0x950d('0x4'));var rp=require(_0x950d('0x5'));var moment=require(_0x950d('0x6'));var BPromise=require(_0x950d('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x950d('0x8'));var sox=require(_0x950d('0x9'));var csv=require(_0x950d('0xa'));var ejs=require(_0x950d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x950d('0xc'));var crypto=require(_0x950d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x950d('0xa'));var querystring=require('querystring');var Papa=require(_0x950d('0xe'));var Redis=require(_0x950d('0xf'));var authService=require(_0x950d('0x10'));var qs=require(_0x950d('0x11'));var as=require(_0x950d('0x12'));var hardwareService=require(_0x950d('0x13'));var logger=require('../../config/logger')(_0x950d('0x14'));var utils=require('../../config/utils');var config=require(_0x950d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52e0a6,_0x2312dc){_0x2312dc=_0x2312dc||0xcc;return function(_0xcebead){if(_0xcebead){return _0x52e0a6[_0x950d('0x16')](_0x2312dc);}return _0x52e0a6[_0x950d('0x17')](_0x2312dc)['end']();};}function respondWithResult(_0x57ecdb,_0x38f01c){_0x38f01c=_0x38f01c||0xc8;return function(_0xfbd76c){if(_0xfbd76c){return _0x57ecdb[_0x950d('0x17')](_0x38f01c)[_0x950d('0x18')](_0xfbd76c);}};}function respondWithFilteredResult(_0x516413,_0x31772f){return function(_0x238a74){if(_0x238a74){var _0x561d61=_0x238a74[_0x950d('0x19')],_0x34be3f=_0x31772f[_0x950d('0x1a')],_0x1f002a=_0x31772f['offset']+_0x31772f['limit'],_0x5c5d53;if(_0x1f002a>=_0x561d61){_0x1f002a=_0x561d61;_0x5c5d53=0xc8;}else{_0x5c5d53=0xce;}_0x516413[_0x950d('0x17')](_0x5c5d53);return _0x516413['set'](_0x950d('0x1b'),_0x34be3f+'-'+_0x1f002a+'/'+_0x561d61)['json'](_0x238a74);}return null;};}function patchUpdates(_0x53b79b){return function(_0x9cf092){try{jsonpatch[_0x950d('0x1c')](_0x9cf092,_0x53b79b,!![]);}catch(_0x564cdb){return BPromise[_0x950d('0x1d')](_0x564cdb);}return _0x9cf092[_0x950d('0x1e')]();};}function saveUpdates(_0x2883f4,_0x51a0a1){return function(_0x1830c6){if(_0x1830c6){return _0x1830c6[_0x950d('0x1f')](_0x2883f4)[_0x950d('0x20')](function(_0x2a3d36){return _0x2a3d36;});}return null;};}function removeEntity(_0x24fb4c,_0x9b18bb){return function(_0x206995){if(_0x206995){return _0x206995[_0x950d('0x21')]()['then'](function(){_0x24fb4c['status'](0xcc)[_0x950d('0x22')]();});}};}function handleEntityNotFound(_0x7a9faa,_0x9de99f){return function(_0x6a6271){if(!_0x6a6271){_0x7a9faa[_0x950d('0x16')](0x194);}return _0x6a6271;};}function handleError(_0x1292a4,_0x3ac7e7){_0x3ac7e7=_0x3ac7e7||0x1f4;return function(_0x20dbd5){logger['error'](_0x20dbd5['stack']);if(_0x20dbd5['name']){delete _0x20dbd5['name'];}_0x1292a4[_0x950d('0x17')](_0x3ac7e7)[_0x950d('0x23')](_0x20dbd5);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x517a53,_0x27ac2e){var _0x405848={'raw':!![],'where':{'id':0x1}},_0x8763f7={};_0x8763f7['model']=_['keys'](db[_0x950d('0x24')][_0x950d('0x25')]);_0x8763f7[_0x950d('0x26')]=_[_0x950d('0x27')](_0x517a53[_0x950d('0x26')]);_0x8763f7[_0x950d('0x28')]=_[_0x950d('0x29')](_0x8763f7[_0x950d('0x2a')],_0x8763f7[_0x950d('0x26')]);_0x405848[_0x950d('0x2b')]=_[_0x950d('0x29')](_0x8763f7[_0x950d('0x2a')],qs[_0x950d('0x2c')](_0x517a53[_0x950d('0x26')][_0x950d('0x2c')]));_0x405848[_0x950d('0x2b')]=_0x405848[_0x950d('0x2b')][_0x950d('0x2d')]?_0x405848[_0x950d('0x2b')]:_0x8763f7[_0x950d('0x2a')];_0x405848=_[_0x950d('0x2e')]({},_0x405848,_0x517a53['options']);return utilLicense[_0x950d('0x2f')](_0x405848)[_0x950d('0x20')](respondWithResult(_0x27ac2e,null))[_0x950d('0x30')](handleError(_0x27ac2e,null));};exports['update']=function(_0x1e7175,_0x19bad2){if(_0x1e7175[_0x950d('0x31')]['id']){delete _0x1e7175['body']['id'];}return db[_0x950d('0x24')][_0x950d('0x32')]({'where':{'id':_0x1e7175[_0x950d('0x33')]['id']}})[_0x950d('0x20')](handleEntityNotFound(_0x19bad2,null))[_0x950d('0x20')](function(_0x4b32a7){var _0x5b8296=_0x4b32a7[_0x950d('0x34')]({'plain':!![]});return utilLicense['checkLicense'](_0x5b8296,_0x1e7175['body']['key']);})['then'](function(_0x3a6c18){if(!_0x3a6c18[_0x950d('0x35')]){return saveUpdates(_0x1e7175[_0x950d('0x31')],null);}return _0x3a6c18;})[_0x950d('0x20')](respondWithResult(_0x19bad2,null))[_0x950d('0x30')](handleError(_0x19bad2,null));}; \ No newline at end of file +var _0x8091=['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','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','length','options','catch','body','get','checkLicense','key','demo','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','squel','crypto'];(function(_0x3d5d0d,_0x1e9398){var _0x4ba730=function(_0x1624db){while(--_0x1624db){_0x3d5d0d['push'](_0x3d5d0d['shift']());}};_0x4ba730(++_0x1e9398);}(_0x8091,0xe2));var _0x1809=function(_0x10234f,_0x334f96){_0x10234f=_0x10234f-0x0;var _0x162065=_0x8091[_0x10234f];return _0x162065;};'use strict';var pdf=require(_0x1809('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1809('0x1'));var jsonpatch=require(_0x1809('0x2'));var rp=require(_0x1809('0x3'));var moment=require('moment');var BPromise=require(_0x1809('0x4'));var Mustache=require('mustache');var util=require(_0x1809('0x5'));var path=require(_0x1809('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1809('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1809('0x8'));var crypto=require(_0x1809('0x9'));var jsforce=require(_0x1809('0xa'));var deskjs=require(_0x1809('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1809('0xc'));var Papa=require(_0x1809('0xd'));var Redis=require(_0x1809('0xe'));var authService=require(_0x1809('0xf'));var qs=require(_0x1809('0x10'));var as=require(_0x1809('0x11'));var hardwareService=require(_0x1809('0x12'));var logger=require(_0x1809('0x13'))('api');var utils=require(_0x1809('0x14'));var config=require(_0x1809('0x15'));var db=require(_0x1809('0x16'))['db'];function respondWithStatusCode(_0x481a2f,_0x10e380){_0x10e380=_0x10e380||0xcc;return function(_0x3a6964){if(_0x3a6964){return _0x481a2f[_0x1809('0x17')](_0x10e380);}return _0x481a2f[_0x1809('0x18')](_0x10e380)[_0x1809('0x19')]();};}function respondWithResult(_0x70704b,_0xf73170){_0xf73170=_0xf73170||0xc8;return function(_0x3e3ece){if(_0x3e3ece){return _0x70704b[_0x1809('0x18')](_0xf73170)[_0x1809('0x1a')](_0x3e3ece);}};}function respondWithFilteredResult(_0x254375,_0x31fda6){return function(_0x13d299){if(_0x13d299){var _0x21d695=_0x13d299[_0x1809('0x1b')],_0xdb1ca=_0x31fda6[_0x1809('0x1c')],_0x20add6=_0x31fda6[_0x1809('0x1c')]+_0x31fda6[_0x1809('0x1d')],_0x46f97b;if(_0x20add6>=_0x21d695){_0x20add6=_0x21d695;_0x46f97b=0xc8;}else{_0x46f97b=0xce;}_0x254375[_0x1809('0x18')](_0x46f97b);return _0x254375[_0x1809('0x1e')](_0x1809('0x1f'),_0xdb1ca+'-'+_0x20add6+'/'+_0x21d695)[_0x1809('0x1a')](_0x13d299);}return null;};}function patchUpdates(_0x1175c8){return function(_0x37529c){try{jsonpatch[_0x1809('0x20')](_0x37529c,_0x1175c8,!![]);}catch(_0x2143da){return BPromise[_0x1809('0x21')](_0x2143da);}return _0x37529c['save']();};}function saveUpdates(_0x26b46a,_0x3c836a){return function(_0x705c5f){if(_0x705c5f){return _0x705c5f[_0x1809('0x22')](_0x26b46a)[_0x1809('0x23')](function(_0x3fe57a){return _0x3fe57a;});}return null;};}function removeEntity(_0x196f2b,_0x55a5c4){return function(_0x262436){if(_0x262436){return _0x262436[_0x1809('0x24')]()[_0x1809('0x23')](function(){_0x196f2b['status'](0xcc)[_0x1809('0x19')]();});}};}function handleEntityNotFound(_0x2b67af,_0x33da55){return function(_0x2f2ea0){if(!_0x2f2ea0){_0x2b67af[_0x1809('0x17')](0x194);}return _0x2f2ea0;};}function handleError(_0x5732b3,_0x3803d0){_0x3803d0=_0x3803d0||0x1f4;return function(_0x1c41f9){logger['error'](_0x1c41f9[_0x1809('0x25')]);if(_0x1c41f9['name']){delete _0x1c41f9[_0x1809('0x26')];}_0x5732b3[_0x1809('0x18')](_0x3803d0)[_0x1809('0x27')](_0x1c41f9);};}var utilLicense=require(_0x1809('0x28'));exports[_0x1809('0x29')]=function(_0x847baf,_0x3708b0){var _0x2e818d={'raw':!![],'where':{'id':0x1}},_0x5af8d3={};_0x5af8d3[_0x1809('0x2a')]=_[_0x1809('0x2b')](db[_0x1809('0x2c')][_0x1809('0x2d')]);_0x5af8d3[_0x1809('0x2e')]=_['keys'](_0x847baf['query']);_0x5af8d3[_0x1809('0x2f')]=_['intersection'](_0x5af8d3[_0x1809('0x2a')],_0x5af8d3[_0x1809('0x2e')]);_0x2e818d[_0x1809('0x30')]=_[_0x1809('0x31')](_0x5af8d3[_0x1809('0x2a')],qs[_0x1809('0x32')](_0x847baf[_0x1809('0x2e')][_0x1809('0x32')]));_0x2e818d[_0x1809('0x30')]=_0x2e818d[_0x1809('0x30')][_0x1809('0x33')]?_0x2e818d[_0x1809('0x30')]:_0x5af8d3['model'];_0x2e818d=_['merge']({},_0x2e818d,_0x847baf[_0x1809('0x34')]);return utilLicense['getLicense'](_0x2e818d)['then'](respondWithResult(_0x3708b0,null))[_0x1809('0x35')](handleError(_0x3708b0,null));};exports['update']=function(_0x415768,_0x5697){if(_0x415768[_0x1809('0x36')]['id']){delete _0x415768[_0x1809('0x36')]['id'];}return db[_0x1809('0x2c')]['find']({'where':{'id':_0x415768['params']['id']}})[_0x1809('0x23')](handleEntityNotFound(_0x5697,null))[_0x1809('0x23')](function(_0x53232a){var _0x19e4e6=_0x53232a[_0x1809('0x37')]({'plain':!![]});return utilLicense[_0x1809('0x38')](_0x19e4e6,_0x415768['body'][_0x1809('0x39')]);})['then'](function(_0x32e336){if(!_0x32e336[_0x1809('0x3a')]){return saveUpdates(_0x415768[_0x1809('0x36')],null);}return _0x32e336;})[_0x1809('0x23')](respondWithResult(_0x5697,null))[_0x1809('0x35')](handleError(_0x5697,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 7ee11ae..e956a11 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 _0x5f2f=['bluebird','request-promise','path','./license.attributes','exports','define','License','lodash','util','../../config/logger','api','moment'];(function(_0x471760,_0x51d47e){var _0x18b91d=function(_0x4dcc94){while(--_0x4dcc94){_0x471760['push'](_0x471760['shift']());}};_0x18b91d(++_0x51d47e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x5f2f[_0x412e27];return _0x53da42;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','license','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x369a0d,_0x3f8019){var _0x2a4244=function(_0x42a7da){while(--_0x42a7da){_0x369a0d['push'](_0x369a0d['shift']());}};_0x2a4244(++_0x3f8019);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('License',attributes,{'tableName':_0x0d8b('0x8'),'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 a15cf2b..df429e5 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 _0xa75b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2ff055,_0x43cb6f){var _0x3c579b=function(_0x2d98b1){while(--_0x2d98b1){_0x2ff055['push'](_0x2ff055['shift']());}};_0x3c579b(++_0x43cb6f);}(_0xa75b,0x170));var _0xba75=function(_0x2f2846,_0x4bb408){_0x2f2846=_0x2f2846-0x0;var _0x1175b2=_0xa75b[_0x2f2846];return _0x1175b2;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});} \ No newline at end of file +var _0x9173=['client','http','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3ab47f,_0x441b32){var _0x1221fe=function(_0x5176b6){while(--_0x5176b6){_0x3ab47f['push'](_0x3ab47f['shift']());}};_0x1221fe(++_0x441b32);}(_0x9173,0xb4));var _0x3917=function(_0x57dae3,_0x10f468){_0x57dae3=_0x57dae3-0x0;var _0x1c98de=_0x9173[_0x57dae3];return _0x1c98de;};'use strict';var _=require(_0x3917('0x0'));var util=require(_0x3917('0x1'));var moment=require('moment');var BPromise=require(_0x3917('0x2'));var rs=require(_0x3917('0x3'));var fs=require('fs');var Redis=require(_0x3917('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3917('0x5'));var logger=require('../../config/logger')(_0x3917('0x6'));var config=require(_0x3917('0x7'));var jayson=require(_0x3917('0x8'));var client=jayson[_0x3917('0x9')][_0x3917('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48d592,_0x181918,_0x27f513){return new BPromise(function(_0x11267b,_0x44d50e){return client[_0x3917('0xb')](_0x48d592,_0x27f513)[_0x3917('0xc')](function(_0x58282f){logger[_0x3917('0xd')](_0x3917('0xe'),_0x181918,'request\x20sent');logger[_0x3917('0xf')](_0x3917('0x10'),_0x181918,'request\x20sent',JSON['stringify'](_0x58282f));if(_0x58282f['error']){if(_0x58282f[_0x3917('0x11')][_0x3917('0x12')]===0x1f4){logger[_0x3917('0x11')](_0x3917('0xe'),_0x181918,_0x58282f[_0x3917('0x11')][_0x3917('0x13')]);return _0x44d50e(_0x58282f['error'][_0x3917('0x13')]);}logger[_0x3917('0x11')](_0x3917('0xe'),_0x181918,_0x58282f[_0x3917('0x11')]['message']);return _0x11267b(_0x58282f[_0x3917('0x11')][_0x3917('0x13')]);}else{logger[_0x3917('0xd')](_0x3917('0xe'),_0x181918,_0x3917('0x14'));_0x11267b(_0x58282f['result'][_0x3917('0x13')]);}})['catch'](function(_0x4912cd){logger[_0x3917('0x11')](_0x3917('0xe'),_0x181918,_0x4912cd);_0x44d50e(_0x4912cd);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 2160ae1..53f5d25 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 _0x12b9=['/:id/dispositions','getDispositions','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','update','delete','/:id/canned_answers','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x121886,_0x8cd8e5){var _0x20ca01=function(_0x15e144){while(--_0x15e144){_0x121886['push'](_0x121886['shift']());}};_0x20ca01(++_0x8cd8e5);}(_0x12b9,0x17a));var _0x912b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12b9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x912b('0x0'));var express=require(_0x912b('0x1'));var router=express[_0x912b('0x2')]();var auth=require(_0x912b('0x3'));var interaction=require(_0x912b('0x4'));var config=require(_0x912b('0x5'));var controller=require(_0x912b('0x6'));router[_0x912b('0x7')]('/',auth[_0x912b('0x8')](),controller[_0x912b('0x9')]);router['get'](_0x912b('0xa'),auth['isAuthenticated'](),controller[_0x912b('0xb')]);router[_0x912b('0x7')](_0x912b('0xc'),auth['isAuthenticated'](),controller[_0x912b('0xd')]);router[_0x912b('0x7')](_0x912b('0xe'),auth[_0x912b('0x8')](),controller[_0x912b('0xf')]);router[_0x912b('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0x912b('0x7')](_0x912b('0x10'),auth[_0x912b('0x8')](),controller[_0x912b('0x11')]);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x912b('0x12')]);router[_0x912b('0x7')](_0x912b('0x13'),auth[_0x912b('0x8')](),controller[_0x912b('0x14')]);router[_0x912b('0x7')](_0x912b('0x15'),auth['isAuthenticated'](),controller[_0x912b('0x16')]);router[_0x912b('0x7')](_0x912b('0x17'),auth['isAuthenticated'](),controller[_0x912b('0x18')]);router[_0x912b('0x7')](_0x912b('0x19'),auth[_0x912b('0x8')](),controller[_0x912b('0x1a')]);router[_0x912b('0x7')](_0x912b('0x1b'),auth[_0x912b('0x8')](),controller[_0x912b('0x1c')]);router[_0x912b('0x1d')](_0x912b('0xe'),auth[_0x912b('0x8')](),controller[_0x912b('0x1e')]);router['post']('/:id/canned_answers',auth[_0x912b('0x8')](),controller['addAnswer']);router[_0x912b('0x1d')]('/',auth['isAuthenticated'](),controller[_0x912b('0x1f')]);router[_0x912b('0x1d')](_0x912b('0x10'),auth['isAuthenticated'](),controller[_0x912b('0x20')]);router[_0x912b('0x1d')](_0x912b('0x21'),auth[_0x912b('0x8')](),controller[_0x912b('0x22')]);router[_0x912b('0x1d')](_0x912b('0x13'),auth[_0x912b('0x8')](),controller[_0x912b('0x23')]);router[_0x912b('0x1d')](_0x912b('0x15'),auth[_0x912b('0x8')](),controller[_0x912b('0x24')]);router['post'](_0x912b('0x25'),auth[_0x912b('0x8')](),controller[_0x912b('0x26')]);router['post'](_0x912b('0x1b'),auth[_0x912b('0x8')](),controller[_0x912b('0x27')]);router['put'](_0x912b('0xc'),auth[_0x912b('0x8')](),controller[_0x912b('0x28')]);router['delete'](_0x912b('0xe'),auth[_0x912b('0x8')](),controller['removeDispositions']);router[_0x912b('0x29')](_0x912b('0x2a'),auth[_0x912b('0x8')](),controller[_0x912b('0x2b')]);router['delete'](_0x912b('0x10'),auth[_0x912b('0x8')](),controller[_0x912b('0x2c')]);router['delete'](_0x912b('0x21'),auth[_0x912b('0x8')](),controller[_0x912b('0x2d')]);router['delete'](_0x912b('0xc'),auth['isAuthenticated'](),controller[_0x912b('0x2e')]);router[_0x912b('0x29')](_0x912b('0x1b'),auth[_0x912b('0x8')](),controller[_0x912b('0x2f')]);module[_0x912b('0x30')]=router; \ No newline at end of file +var _0x4fd5=['describe','/:id','show','getAnswers','/:id/in_servers','getImap','getSmtp','getInteractions','getApplications','getMessages','verifySmtp','/:id/users','getAgents','/:id/dispositions','addDisposition','post','/:id/canned_answers','addAnswer','addImap','/:id/out_servers','addSmtp','/:id/interactions','addInteraction','/:id/applications','/:id/send','send','addAgents','put','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x4fd5,0x193));var _0x54fd=function(_0x116478,_0x34ecc9){_0x116478=_0x116478-0x0;var _0x1b3b6b=_0x4fd5[_0x116478];return _0x1b3b6b;};'use strict';var multer=require(_0x54fd('0x0'));var util=require(_0x54fd('0x1'));var path=require(_0x54fd('0x2'));var timeout=require(_0x54fd('0x3'));var express=require(_0x54fd('0x4'));var router=express[_0x54fd('0x5')]();var auth=require(_0x54fd('0x6'));var interaction=require(_0x54fd('0x7'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router['get']('/',auth[_0x54fd('0x8')](),controller['index']);router[_0x54fd('0x9')](_0x54fd('0xa'),auth[_0x54fd('0x8')](),controller[_0x54fd('0xb')]);router[_0x54fd('0x9')](_0x54fd('0xc'),auth[_0x54fd('0x8')](),controller[_0x54fd('0xd')]);router[_0x54fd('0x9')]('/:id/dispositions',auth[_0x54fd('0x8')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x54fd('0x8')](),controller[_0x54fd('0xe')]);router['get'](_0x54fd('0xf'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x10')]);router[_0x54fd('0x9')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x54fd('0x11')]);router[_0x54fd('0x9')]('/:id/interactions',auth[_0x54fd('0x8')](),controller[_0x54fd('0x12')]);router[_0x54fd('0x9')]('/:id/applications',auth[_0x54fd('0x8')](),controller[_0x54fd('0x13')]);router[_0x54fd('0x9')]('/:id/messages',auth[_0x54fd('0x8')](),controller[_0x54fd('0x14')]);router['get']('/:id/verify',auth[_0x54fd('0x8')](),controller[_0x54fd('0x15')]);router[_0x54fd('0x9')](_0x54fd('0x16'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x17')]);router['post'](_0x54fd('0x18'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x19')]);router[_0x54fd('0x1a')](_0x54fd('0x1b'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x1c')]);router[_0x54fd('0x1a')]('/',auth[_0x54fd('0x8')](),controller['create']);router['post']('/:id/in_servers',auth[_0x54fd('0x8')](),controller[_0x54fd('0x1d')]);router['post'](_0x54fd('0x1e'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x1f')]);router['post'](_0x54fd('0x20'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x21')]);router[_0x54fd('0x1a')](_0x54fd('0x22'),auth[_0x54fd('0x8')](),controller['addApplications']);router[_0x54fd('0x1a')](_0x54fd('0x23'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x24')]);router['post'](_0x54fd('0x16'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x25')]);router[_0x54fd('0x26')](_0x54fd('0xc'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x27')]);router['delete'](_0x54fd('0x18'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x28')]);router[_0x54fd('0x29')]('/:id/canned_answers',auth[_0x54fd('0x8')](),controller[_0x54fd('0x2a')]);router['delete']('/:id/in_servers',auth[_0x54fd('0x8')](),controller[_0x54fd('0x2b')]);router[_0x54fd('0x29')](_0x54fd('0x1e'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x2c')]);router[_0x54fd('0x29')]('/:id',auth[_0x54fd('0x8')](),controller['destroy']);router[_0x54fd('0x29')]('/:id/users',auth[_0x54fd('0x8')](),controller[_0x54fd('0x2d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 48075c1..ecb49d5 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 _0x491c=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','TEXT','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'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x491c,0xe8));var _0xc491=function(_0x197e18,_0x137888){_0x197e18=_0x197e18-0x0;var _0x58064e=_0x491c[_0x197e18];return _0x58064e;};'use strict';var Sequelize=require('sequelize');module[_0xc491('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xc491('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc491('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xc491('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xc491('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc491('0x1')],'allowNull':![],'defaultValue':_0xc491('0x3')},'fontSize':{'type':Sequelize[_0xc491('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc491('0x5')],'defaultValue':function(){return _0xc491('0x6');}},'notificationSound':{'type':Sequelize[_0xc491('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc491('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc491('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc491('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc491('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc491('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc491('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xc491('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc491('0x8'),'set':function(_0x33286e){if(!_0x33286e)this[_0xc491('0x9')](_0xc491('0xa'),null);this[_0xc491('0x9')](_0xc491('0xb'),_0x33286e);}}}; \ No newline at end of file +var _0x63d4=['UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x3dad4a,_0x13525a){var _0x4398dc=function(_0x278cc8){while(--_0x278cc8){_0x3dad4a['push'](_0x3dad4a['shift']());}};_0x4398dc(++_0x13525a);}(_0x63d4,0x1e4));var _0x463d=function(_0xfe4948,_0x5259ae){_0xfe4948=_0xfe4948-0x0;var _0x3c752c=_0x63d4[_0xfe4948];return _0x3c752c;};'use strict';var Sequelize=require(_0x463d('0x0'));module[_0x463d('0x1')]={'description':{'type':Sequelize[_0x463d('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x463d('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x463d('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x463d('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x463d('0x4')]},'markAsUnread':{'type':Sequelize[_0x463d('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x463d('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x463d('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x463d('0x4')],'defaultValue':function(){return _0x463d('0x7');}},'notificationSound':{'type':Sequelize[_0x463d('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x463d('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x463d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x463d('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x463d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x463d('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x463d('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x463d('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x463d('0x3')],'defaultValue':![],'comment':_0x463d('0xa'),'set':function(_0x2e876d){if(!_0x2e876d)this[_0x463d('0xb')](_0x463d('0xc'),null);this[_0x463d('0xb')](_0x463d('0xd'),_0x2e876d);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 21afb47..5ef8d17 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 _0xef32=['destroy','get','MailAccounts','UserProfileResource','name','MailServerIn','Imap','Smtp','Pause','MailAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','count','includeAll','rows','catch','params','MailServerOut','mandatoryDispositionPause','length','body','find','describe','addDisposition','MailAccountId','Disposition','create','order','include','findAll','removeDispositions','ids','CannedAnswer','findOne','removeAnswers','key','email','ListId','active','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','service','password','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','omit','CmContact','User','Owner','internal','Tag','Tags','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','format','split','List','Contacts','updatedAt','isNil','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','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','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','sendStatus','status','end','offset','limit','set','Content-Range','apply','save','update'];(function(_0x23a981,_0xdcdb57){var _0x3af34b=function(_0x2f13ff){while(--_0x2f13ff){_0x23a981['push'](_0x23a981['shift']());}};_0x3af34b(++_0xdcdb57);}(_0xef32,0x83));var _0x2ef3=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0xef32[_0x368bba];return _0x409f8f;};'use strict';var pdf=require(_0x2ef3('0x0'));var emlformat=require(_0x2ef3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2ef3('0x2'));var jsonpatch=require(_0x2ef3('0x3'));var rp=require(_0x2ef3('0x4'));var moment=require('moment');var BPromise=require(_0x2ef3('0x5'));var Mustache=require(_0x2ef3('0x6'));var util=require(_0x2ef3('0x7'));var path=require(_0x2ef3('0x8'));var sox=require(_0x2ef3('0x9'));var csv=require(_0x2ef3('0xa'));var ejs=require(_0x2ef3('0xb'));var fs=require('fs');var _=require(_0x2ef3('0xc'));var squel=require(_0x2ef3('0xd'));var crypto=require(_0x2ef3('0xe'));var jsforce=require(_0x2ef3('0xf'));var deskjs=require(_0x2ef3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2ef3('0x11'));var Papa=require(_0x2ef3('0x12'));var Redis=require(_0x2ef3('0x13'));var authService=require(_0x2ef3('0x14'));var qs=require(_0x2ef3('0x15'));var as=require(_0x2ef3('0x16'));var hardwareService=require(_0x2ef3('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x2ef3('0x18'));var config=require('../../config/environment');var db=require(_0x2ef3('0x19'))['db'];config[_0x2ef3('0x1a')]=_[_0x2ef3('0x1b')](config['redis'],{'host':_0x2ef3('0x1c'),'port':0x18eb});var socket=require(_0x2ef3('0x1d'))(new Redis(config[_0x2ef3('0x1a')]));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x2ef3('0x1e'));var client=jayson[_0x2ef3('0x1f')][_0x2ef3('0x20')]({'port':0x232b});function checkPasswordPattern(_0x4aada,_0x50ca6c,_0x30baa8){if(_0x30baa8){var _0x1163b1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1163b1[_0x2ef3('0x21')](_0x50ca6c)){return _0x4aada;}else{throw new db[(_0x2ef3('0x22'))][(_0x2ef3('0x23'))](_0x2ef3('0x24'));}}else{return _0x4aada;}}function respondWithRpcPromise(_0x49cff4,_0x236dfd,_0x1ad8fa,_0x1d345f){return new BPromise(function(_0x3b5ac0,_0x2a5112){var _0x352f4d=_0x1d345f||client;return _0x352f4d['request'](_0x49cff4,_0x1ad8fa)[_0x2ef3('0x25')](function(_0x1293af){logger['info']('MailAccount,\x20%s,\x20%s',_0x236dfd,_0x2ef3('0x26'));logger[_0x2ef3('0x27')](_0x2ef3('0x28'),_0x236dfd,_0x2ef3('0x26'),JSON[_0x2ef3('0x29')](_0x1293af));if(_0x1293af[_0x2ef3('0x2a')]){if(_0x1293af['error']['code']===0x1f4){logger[_0x2ef3('0x2a')](_0x2ef3('0x2b'),_0x236dfd,_0x1293af[_0x2ef3('0x2a')][_0x2ef3('0x2c')]);return _0x2a5112(_0x1293af[_0x2ef3('0x2a')][_0x2ef3('0x2c')]);}logger[_0x2ef3('0x2a')]('MailAccount,\x20%s,\x20%s',_0x236dfd,_0x1293af[_0x2ef3('0x2a')]['message']);return _0x3b5ac0(_0x1293af[_0x2ef3('0x2a')][_0x2ef3('0x2c')]);}else{logger['info'](_0x2ef3('0x2b'),_0x236dfd,'request\x20sent');_0x3b5ac0(_0x1293af['result']['message']);}})['catch'](function(_0x23c400){logger[_0x2ef3('0x2a')]('MailAccount,\x20%s,\x20%s',_0x236dfd,_0x23c400);_0x2a5112(_0x23c400);});});}function respondWithStatusCode(_0x321708,_0x37e9ca){_0x37e9ca=_0x37e9ca||0xcc;return function(_0x58513c){if(_0x58513c){return _0x321708[_0x2ef3('0x2d')](_0x37e9ca);}return _0x321708[_0x2ef3('0x2e')](_0x37e9ca)[_0x2ef3('0x2f')]();};}function respondWithResult(_0x1e5351,_0xe60c51){_0xe60c51=_0xe60c51||0xc8;return function(_0x4de060){if(_0x4de060){return _0x1e5351[_0x2ef3('0x2e')](_0xe60c51)['json'](_0x4de060);}};}function respondWithFilteredResult(_0x5ac752,_0xc9ab5e){return function(_0x1b964a){if(_0x1b964a){var _0x376ad2=_0x1b964a['count'],_0x534c86=_0xc9ab5e[_0x2ef3('0x30')],_0x4d54bd=_0xc9ab5e[_0x2ef3('0x30')]+_0xc9ab5e[_0x2ef3('0x31')],_0x7a6fa7;if(_0x4d54bd>=_0x376ad2){_0x4d54bd=_0x376ad2;_0x7a6fa7=0xc8;}else{_0x7a6fa7=0xce;}_0x5ac752[_0x2ef3('0x2e')](_0x7a6fa7);return _0x5ac752[_0x2ef3('0x32')](_0x2ef3('0x33'),_0x534c86+'-'+_0x4d54bd+'/'+_0x376ad2)['json'](_0x1b964a);}return null;};}function patchUpdates(_0x25abe1){return function(_0x4a39b5){try{jsonpatch[_0x2ef3('0x34')](_0x4a39b5,_0x25abe1,!![]);}catch(_0x147466){return BPromise['reject'](_0x147466);}return _0x4a39b5[_0x2ef3('0x35')]();};}function saveUpdates(_0x5766fa,_0x4842e6){return function(_0x5b98d9){if(_0x5b98d9){return _0x5b98d9[_0x2ef3('0x36')](_0x5766fa)['then'](function(_0xd5a5){return _0xd5a5;});}return null;};}function removeEntity(_0x6f5b4c,_0x113dff){return function(_0x290b46){if(_0x290b46){return _0x290b46[_0x2ef3('0x37')]()[_0x2ef3('0x25')](function(){var _0x233f52=_0x290b46[_0x2ef3('0x38')]({'plain':!![]});var _0x630d77=_0x2ef3('0x39');return db[_0x2ef3('0x3a')][_0x2ef3('0x37')]({'where':{'type':_0x630d77,'resourceId':_0x233f52['id']}})[_0x2ef3('0x25')](function(){return _0x290b46;});})[_0x2ef3('0x25')](function(){_0x6f5b4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x407055,_0x56c155){return function(_0x16c872){if(!_0x16c872){_0x407055[_0x2ef3('0x2d')](0x194);}return _0x16c872;};}function handleError(_0x3d5057,_0xee53f7){_0xee53f7=_0xee53f7||0x1f4;return function(_0x48b245){logger['error'](_0x48b245['stack']);if(_0x48b245[_0x2ef3('0x3b')]){delete _0x48b245[_0x2ef3('0x3b')];}_0x3d5057[_0x2ef3('0x2e')](_0xee53f7)['send'](_0x48b245);};}exports['index']=function(_0x2c9f9b,_0x398e65){var _0x31fbf1={'include':[{'model':db[_0x2ef3('0x3c')],'as':_0x2ef3('0x3d')},{'model':db['MailServerOut'],'as':_0x2ef3('0x3e')},{'model':db[_0x2ef3('0x3f')],'as':'mandatoryDispositionPause'}]},_0x41935d={},_0x5d3339={'count':0x0,'rows':[]};var _0x157268=_['map'](db[_0x2ef3('0x40')][_0x2ef3('0x41')],function(_0x5cd5ef){return{'name':_0x5cd5ef[_0x2ef3('0x42')],'type':_0x5cd5ef[_0x2ef3('0x43')]['key']};});_0x41935d[_0x2ef3('0x44')]=_[_0x2ef3('0x45')](_0x157268,_0x2ef3('0x3b'));_0x41935d[_0x2ef3('0x46')]=_[_0x2ef3('0x47')](_0x2c9f9b[_0x2ef3('0x46')]);_0x41935d[_0x2ef3('0x48')]=_[_0x2ef3('0x49')](_0x41935d[_0x2ef3('0x44')],_0x41935d[_0x2ef3('0x46')]);_0x31fbf1[_0x2ef3('0x4a')]=_[_0x2ef3('0x49')](_0x41935d[_0x2ef3('0x44')],qs[_0x2ef3('0x4b')](_0x2c9f9b[_0x2ef3('0x46')][_0x2ef3('0x4b')]));_0x31fbf1[_0x2ef3('0x4a')]=_0x31fbf1[_0x2ef3('0x4a')]['length']?_0x31fbf1[_0x2ef3('0x4a')]:_0x41935d[_0x2ef3('0x44')];if(!_0x2c9f9b[_0x2ef3('0x46')][_0x2ef3('0x4c')](_0x2ef3('0x4d'))){_0x31fbf1[_0x2ef3('0x31')]=qs[_0x2ef3('0x31')](_0x2c9f9b[_0x2ef3('0x46')][_0x2ef3('0x31')]);_0x31fbf1['offset']=qs['offset'](_0x2c9f9b[_0x2ef3('0x46')][_0x2ef3('0x30')]);}_0x31fbf1['order']=qs[_0x2ef3('0x4e')](_0x2c9f9b[_0x2ef3('0x46')][_0x2ef3('0x4e')]);_0x31fbf1[_0x2ef3('0x4f')]=qs['filters'](_[_0x2ef3('0x50')](_0x2c9f9b[_0x2ef3('0x46')],_0x41935d[_0x2ef3('0x48')]),_0x157268);if(_0x2c9f9b['query']['filter']){_0x31fbf1[_0x2ef3('0x4f')]=_[_0x2ef3('0x51')](_0x31fbf1['where'],{'$or':_[_0x2ef3('0x45')](_0x157268,function(_0x12dbf8){if(_0x12dbf8[_0x2ef3('0x43')]!=='VIRTUAL'){var _0x35eb0c={};_0x35eb0c[_0x12dbf8[_0x2ef3('0x3b')]]={'$like':'%'+_0x2c9f9b['query'][_0x2ef3('0x52')]+'%'};return _0x35eb0c;}})});}_0x31fbf1=_[_0x2ef3('0x51')]({},_0x31fbf1,_0x2c9f9b[_0x2ef3('0x53')]);var _0x4afc3e={'where':_0x31fbf1[_0x2ef3('0x4f')]};return db[_0x2ef3('0x40')]['count'](_0x4afc3e)[_0x2ef3('0x25')](function(_0x548041){_0x5d3339[_0x2ef3('0x54')]=_0x548041;if(_0x2c9f9b[_0x2ef3('0x46')][_0x2ef3('0x55')]){_0x31fbf1['include']=[{'all':!![]}];}return db[_0x2ef3('0x40')]['findAll'](_0x31fbf1);})[_0x2ef3('0x25')](function(_0x47f463){_0x5d3339[_0x2ef3('0x56')]=_0x47f463;return _0x5d3339;})['then'](respondWithFilteredResult(_0x398e65,_0x31fbf1))[_0x2ef3('0x57')](handleError(_0x398e65,null));};exports['show']=function(_0x47383d,_0x297afe){var _0x582c28={'raw':![],'where':{'id':_0x47383d[_0x2ef3('0x58')]['id']},'include':[{'model':db[_0x2ef3('0x3c')],'as':_0x2ef3('0x3d')},{'model':db[_0x2ef3('0x59')],'as':_0x2ef3('0x3e')},{'model':db[_0x2ef3('0x3f')],'as':_0x2ef3('0x5a')}]},_0x32607b={};_0x32607b[_0x2ef3('0x44')]=_[_0x2ef3('0x47')](db[_0x2ef3('0x40')][_0x2ef3('0x41')]);_0x32607b[_0x2ef3('0x46')]=_['keys'](_0x47383d[_0x2ef3('0x46')]);_0x32607b[_0x2ef3('0x48')]=_['intersection'](_0x32607b['model'],_0x32607b['query']);_0x582c28[_0x2ef3('0x4a')]=_[_0x2ef3('0x49')](_0x32607b[_0x2ef3('0x44')],qs['fields'](_0x47383d[_0x2ef3('0x46')][_0x2ef3('0x4b')]));_0x582c28[_0x2ef3('0x4a')]=_0x582c28[_0x2ef3('0x4a')][_0x2ef3('0x5b')]?_0x582c28['attributes']:_0x32607b['model'];if(_0x47383d[_0x2ef3('0x46')][_0x2ef3('0x55')]){_0x582c28['include']=[{'all':!![]}];}_0x582c28=_[_0x2ef3('0x51')]({},_0x582c28,_0x47383d[_0x2ef3('0x53')]);return db['MailAccount']['find'](_0x582c28)[_0x2ef3('0x25')](handleEntityNotFound(_0x297afe,null))[_0x2ef3('0x25')](respondWithResult(_0x297afe,null))[_0x2ef3('0x57')](handleError(_0x297afe,null));};exports['update']=function(_0x16aafb,_0xb71a53){if(_0x16aafb['body']['id']){delete _0x16aafb[_0x2ef3('0x5c')]['id'];}return db[_0x2ef3('0x40')][_0x2ef3('0x5d')]({'where':{'id':_0x16aafb['params']['id']},'include':[{'model':db[_0x2ef3('0x3c')],'as':'Imap'},{'model':db[_0x2ef3('0x59')],'as':_0x2ef3('0x3e')},{'model':db[_0x2ef3('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x2ef3('0x25')](handleEntityNotFound(_0xb71a53,null))[_0x2ef3('0x25')](saveUpdates(_0x16aafb[_0x2ef3('0x5c')],null))[_0x2ef3('0x25')](function(_0x5de4a4){if(_0x5de4a4&&_0x16aafb['body'][_0x2ef3('0x3d')]){return db[_0x2ef3('0x3c')]['update'](_0x16aafb[_0x2ef3('0x5c')]['Imap'],{'where':{'MailAccountId':_0x5de4a4['id']}})['then'](function(){return _0x5de4a4;});}return _0x5de4a4;})['then'](function(_0x4fa819){if(_0x4fa819&&_0x16aafb[_0x2ef3('0x5c')][_0x2ef3('0x3e')]){return db[_0x2ef3('0x59')][_0x2ef3('0x36')](_0x16aafb[_0x2ef3('0x5c')][_0x2ef3('0x3e')],{'where':{'MailAccountId':_0x4fa819['id']}})['then'](function(){return _0x4fa819;});}return _0x4fa819;})[_0x2ef3('0x25')](respondWithResult(_0xb71a53,null))['catch'](handleError(_0xb71a53,null));};exports[_0x2ef3('0x5e')]=function(_0x105a81,_0x161049){return db[_0x2ef3('0x40')][_0x2ef3('0x5e')]()[_0x2ef3('0x25')](respondWithResult(_0x161049,null))[_0x2ef3('0x57')](handleError(_0x161049,null));};exports[_0x2ef3('0x5f')]=function(_0x519bf8,_0x1e6f6e,_0x14693f){if(_0x519bf8[_0x2ef3('0x5c')]['id']){delete _0x519bf8[_0x2ef3('0x5c')]['id'];}return db[_0x2ef3('0x40')][_0x2ef3('0x5d')]({'where':{'id':_0x519bf8['params']['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x1e6f6e,null))['then'](function(_0x707950){if(_0x707950){_0x519bf8[_0x2ef3('0x5c')][_0x2ef3('0x60')]=_0x707950['id'];return db[_0x2ef3('0x61')][_0x2ef3('0x62')](_0x519bf8[_0x2ef3('0x5c')]);}})['then'](respondWithResult(_0x1e6f6e,null))['catch'](handleError(_0x1e6f6e,null));};exports['getDispositions']=function(_0x4ab6a2,_0x50fa7b,_0xedc4a7){var _0x499c7d={'raw':![],'where':{}};var _0x5d0c76={};var _0xf0ba57={'count':0x0,'rows':[]};return db[_0x2ef3('0x40')]['findOne']({'where':{'id':_0x4ab6a2[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x50fa7b,null))[_0x2ef3('0x25')](function(_0xba60b2){if(_0xba60b2){_0x5d0c76[_0x2ef3('0x44')]=_[_0x2ef3('0x47')](db[_0x2ef3('0x61')][_0x2ef3('0x41')]);_0x5d0c76[_0x2ef3('0x46')]=_['keys'](_0x4ab6a2['query']);_0x5d0c76['filters']=_[_0x2ef3('0x49')](_0x5d0c76['model'],_0x5d0c76[_0x2ef3('0x46')]);_0x499c7d[_0x2ef3('0x4a')]=_[_0x2ef3('0x49')](_0x5d0c76[_0x2ef3('0x44')],qs['fields'](_0x4ab6a2['query'][_0x2ef3('0x4b')]));_0x499c7d[_0x2ef3('0x4a')]=_0x499c7d[_0x2ef3('0x4a')][_0x2ef3('0x5b')]?_0x499c7d[_0x2ef3('0x4a')]:_0x5d0c76[_0x2ef3('0x44')];if(!_0x4ab6a2[_0x2ef3('0x46')][_0x2ef3('0x4c')]('nolimit')){_0x499c7d[_0x2ef3('0x31')]=qs[_0x2ef3('0x31')](_0x4ab6a2[_0x2ef3('0x46')][_0x2ef3('0x31')]);_0x499c7d[_0x2ef3('0x30')]=qs[_0x2ef3('0x30')](_0x4ab6a2[_0x2ef3('0x46')][_0x2ef3('0x30')]);}_0x499c7d[_0x2ef3('0x63')]=qs['sort'](_0x4ab6a2[_0x2ef3('0x46')][_0x2ef3('0x4e')]);_0x499c7d[_0x2ef3('0x4f')]=qs['filters'](_['pick'](_0x4ab6a2['query'],_0x5d0c76[_0x2ef3('0x48')]));_0x499c7d['where'][_0x2ef3('0x60')]=_0xba60b2['id'];if(_0x4ab6a2[_0x2ef3('0x46')]['filter']){_0x499c7d[_0x2ef3('0x4f')]=_[_0x2ef3('0x51')](_0x499c7d[_0x2ef3('0x4f')],{'$or':_[_0x2ef3('0x45')](_0x499c7d[_0x2ef3('0x4a')],function(_0x5d4fa5){var _0x59623c={};_0x59623c[_0x5d4fa5]={'$like':'%'+_0x4ab6a2[_0x2ef3('0x46')][_0x2ef3('0x52')]+'%'};return _0x59623c;})});}_0x499c7d=_[_0x2ef3('0x51')]({},_0x499c7d,_0x4ab6a2[_0x2ef3('0x53')]);return db['Disposition'][_0x2ef3('0x54')]({'where':_0x499c7d[_0x2ef3('0x4f')]})[_0x2ef3('0x25')](function(_0x18e667){_0xf0ba57[_0x2ef3('0x54')]=_0x18e667;if(_0x4ab6a2[_0x2ef3('0x46')]['includeAll']){_0x499c7d[_0x2ef3('0x64')]=[{'all':!![]}];}return db[_0x2ef3('0x61')][_0x2ef3('0x65')](_0x499c7d);})[_0x2ef3('0x25')](function(_0x4fcaa4){_0xf0ba57[_0x2ef3('0x56')]=_0x4fcaa4;return _0xf0ba57;});}})['then'](respondWithFilteredResult(_0x50fa7b,_0x499c7d))[_0x2ef3('0x57')](handleError(_0x50fa7b,null));};exports[_0x2ef3('0x66')]=function(_0x351e50,_0x6ad5b7,_0x550a01){return db['MailAccount']['find']({'where':{'id':_0x351e50[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x6ad5b7,null))[_0x2ef3('0x25')](function(_0x4f8013){if(_0x4f8013){return _0x4f8013[_0x2ef3('0x66')](_0x351e50[_0x2ef3('0x46')][_0x2ef3('0x67')]);}})[_0x2ef3('0x25')](respondWithStatusCode(_0x6ad5b7,null))[_0x2ef3('0x57')](handleError(_0x6ad5b7,null));};exports['addAnswer']=function(_0x7fc4eb,_0x534ec3,_0x291418){if(_0x7fc4eb[_0x2ef3('0x5c')]['id']){delete _0x7fc4eb[_0x2ef3('0x5c')]['id'];}return db[_0x2ef3('0x40')][_0x2ef3('0x5d')]({'where':{'id':_0x7fc4eb[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x534ec3,null))[_0x2ef3('0x25')](function(_0x4b116a){if(_0x4b116a){_0x7fc4eb[_0x2ef3('0x5c')]['MailAccountId']=_0x4b116a['id'];return db[_0x2ef3('0x68')]['create'](_0x7fc4eb[_0x2ef3('0x5c')]);}})[_0x2ef3('0x25')](respondWithResult(_0x534ec3,null))[_0x2ef3('0x57')](handleError(_0x534ec3,null));};exports['getAnswers']=function(_0xb17e24,_0x1724fb,_0x4bcd50){var _0x14ea61={'raw':![],'where':{}};var _0x57867e={};var _0x1320ae={'count':0x0,'rows':[]};return db[_0x2ef3('0x40')][_0x2ef3('0x69')]({'where':{'id':_0xb17e24[_0x2ef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x1724fb,null))[_0x2ef3('0x25')](function(_0x3d2d7d){if(_0x3d2d7d){_0x57867e[_0x2ef3('0x44')]=_[_0x2ef3('0x47')](db[_0x2ef3('0x68')]['rawAttributes']);_0x57867e[_0x2ef3('0x46')]=_[_0x2ef3('0x47')](_0xb17e24[_0x2ef3('0x46')]);_0x57867e[_0x2ef3('0x48')]=_[_0x2ef3('0x49')](_0x57867e['model'],_0x57867e[_0x2ef3('0x46')]);_0x14ea61[_0x2ef3('0x4a')]=_[_0x2ef3('0x49')](_0x57867e[_0x2ef3('0x44')],qs[_0x2ef3('0x4b')](_0xb17e24[_0x2ef3('0x46')][_0x2ef3('0x4b')]));_0x14ea61['attributes']=_0x14ea61[_0x2ef3('0x4a')]['length']?_0x14ea61['attributes']:_0x57867e[_0x2ef3('0x44')];if(!_0xb17e24[_0x2ef3('0x46')][_0x2ef3('0x4c')]('nolimit')){_0x14ea61[_0x2ef3('0x31')]=qs['limit'](_0xb17e24[_0x2ef3('0x46')][_0x2ef3('0x31')]);_0x14ea61[_0x2ef3('0x30')]=qs['offset'](_0xb17e24[_0x2ef3('0x46')][_0x2ef3('0x30')]);}_0x14ea61[_0x2ef3('0x63')]=qs[_0x2ef3('0x4e')](_0xb17e24['query'][_0x2ef3('0x4e')]);_0x14ea61['where']=qs['filters'](_[_0x2ef3('0x50')](_0xb17e24[_0x2ef3('0x46')],_0x57867e[_0x2ef3('0x48')]));_0x14ea61[_0x2ef3('0x4f')][_0x2ef3('0x60')]=_0x3d2d7d['id'];if(_0xb17e24['query'][_0x2ef3('0x52')]){_0x14ea61['where']=_[_0x2ef3('0x51')](_0x14ea61[_0x2ef3('0x4f')],{'$or':_[_0x2ef3('0x45')](_0x14ea61['attributes'],function(_0x529644){var _0x19f0fd={};_0x19f0fd[_0x529644]={'$like':'%'+_0xb17e24[_0x2ef3('0x46')][_0x2ef3('0x52')]+'%'};return _0x19f0fd;})});}_0x14ea61=_[_0x2ef3('0x51')]({},_0x14ea61,_0xb17e24[_0x2ef3('0x53')]);return db[_0x2ef3('0x68')][_0x2ef3('0x54')]({'where':_0x14ea61['where']})[_0x2ef3('0x25')](function(_0x377838){_0x1320ae[_0x2ef3('0x54')]=_0x377838;if(_0xb17e24[_0x2ef3('0x46')][_0x2ef3('0x55')]){_0x14ea61['include']=[{'all':!![]}];}return db[_0x2ef3('0x68')][_0x2ef3('0x65')](_0x14ea61);})[_0x2ef3('0x25')](function(_0x3bd685){_0x1320ae['rows']=_0x3bd685;return _0x1320ae;});}})['then'](respondWithFilteredResult(_0x1724fb,_0x14ea61))[_0x2ef3('0x57')](handleError(_0x1724fb,null));};exports[_0x2ef3('0x6a')]=function(_0x3afc33,_0x4cf6dc,_0x172124){return db[_0x2ef3('0x40')]['find']({'where':{'id':_0x3afc33['params']['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x4cf6dc,null))[_0x2ef3('0x25')](function(_0x2c3ec8){if(_0x2c3ec8){return _0x2c3ec8[_0x2ef3('0x6a')](_0x3afc33[_0x2ef3('0x46')]['ids']);}})[_0x2ef3('0x25')](respondWithStatusCode(_0x4cf6dc,null))[_0x2ef3('0x57')](handleError(_0x4cf6dc,null));};exports[_0x2ef3('0x62')]=function(_0x125abc,_0x2c7192){var _0x47d0ce={'name':_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x3b')],'key':_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6b')],'email':_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6c')],'ListId':_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6d')],'active':!_['isNil'](_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6e')])?_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6e')]:!![],'description':_0x125abc['body']['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6f')])){if(_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x70')]){_0x47d0ce[_0x2ef3('0x3d')][_0x2ef3('0x71')]=_0x47d0ce[_0x2ef3('0x3e')][_0x2ef3('0x71')]=_0x125abc['body'][_0x2ef3('0x72')];_0x47d0ce[_0x2ef3('0x3d')]['password']=_0x47d0ce[_0x2ef3('0x3e')]['pass']=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x73')];}else{_0x47d0ce[_0x2ef3('0x3d')][_0x2ef3('0x74')]=_0x47d0ce['Smtp'][_0x2ef3('0x74')]=![];}_0x47d0ce[_0x2ef3('0x3d')]['host']=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x3d')][_0x2ef3('0x75')];_0x47d0ce[_0x2ef3('0x3d')][_0x2ef3('0x76')]=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x3d')][_0x2ef3('0x76')];_0x47d0ce[_0x2ef3('0x3e')][_0x2ef3('0x75')]=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x3e')][_0x2ef3('0x75')];_0x47d0ce[_0x2ef3('0x3e')][_0x2ef3('0x76')]=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x3e')][_0x2ef3('0x76')];}else{_0x47d0ce['Imap'][_0x2ef3('0x77')]=_0x47d0ce[_0x2ef3('0x3e')][_0x2ef3('0x77')]=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6f')];_0x47d0ce[_0x2ef3('0x3d')][_0x2ef3('0x71')]=_0x47d0ce[_0x2ef3('0x3e')]['user']=_0x125abc[_0x2ef3('0x5c')]['cuser'];_0x47d0ce['Imap'][_0x2ef3('0x78')]=_0x47d0ce[_0x2ef3('0x3e')][_0x2ef3('0x79')]=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x73')];}return db[_0x2ef3('0x40')][_0x2ef3('0x62')](_0x47d0ce,{'include':[{'model':db[_0x2ef3('0x59')],'as':'Smtp'},{'model':db[_0x2ef3('0x3c')],'as':_0x2ef3('0x3d')}]})[_0x2ef3('0x25')](function(_0x3a904b){var _0x3d0c4b=_0x125abc[_0x2ef3('0x71')][_0x2ef3('0x38')]({'plain':!![]});if(!_0x3d0c4b)throw new Error(_0x2ef3('0x7a'));if(_0x3d0c4b[_0x2ef3('0x7b')]===_0x2ef3('0x71')){var _0x5a17cb=_0x3a904b[_0x2ef3('0x38')]({'plain':!![]});return db[_0x2ef3('0x7c')][_0x2ef3('0x5d')]({'where':{'name':'MailAccounts','userProfileId':_0x3d0c4b[_0x2ef3('0x7d')]},'raw':!![]})[_0x2ef3('0x25')](function(_0x26838c){if(_0x26838c&&_0x26838c[_0x2ef3('0x7e')]===0x0){return db['UserProfileResource'][_0x2ef3('0x62')]({'name':_0x5a17cb[_0x2ef3('0x3b')],'resourceId':_0x5a17cb['id'],'type':_0x26838c[_0x2ef3('0x3b')],'sectionId':_0x26838c['id']},{})['then'](function(){return _0x3a904b;});}else{return _0x3a904b;}})[_0x2ef3('0x57')](function(_0x18b204){logger[_0x2ef3('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18b204);throw _0x18b204;});}return _0x3a904b;})[_0x2ef3('0x25')](respondWithResult(_0x2c7192,0xc9))[_0x2ef3('0x57')](handleError(_0x2c7192,null));};exports[_0x2ef3('0x7f')]=function(_0x3a5a15,_0x2aad12,_0xaeab6e){return db[_0x2ef3('0x40')][_0x2ef3('0x69')]({'where':{'id':_0x3a5a15['params']['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x2aad12,null))[_0x2ef3('0x25')](function(_0x255ba5){if(_0x255ba5){return _0x255ba5[_0x2ef3('0x7f')]();}return null;})[_0x2ef3('0x25')](respondWithResult(_0x2aad12,null))[_0x2ef3('0x57')](handleError(_0x2aad12,null));};exports[_0x2ef3('0x80')]=function(_0x462c75,_0x5c323f,_0x40c87c){if(_0x462c75['body']['id']){delete _0x462c75[_0x2ef3('0x5c')]['id'];}return db[_0x2ef3('0x40')][_0x2ef3('0x5d')]({'where':{'id':_0x462c75[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x5c323f,null))[_0x2ef3('0x25')](function(_0x13d7b3){if(_0x13d7b3){_0x462c75[_0x2ef3('0x5c')][_0x2ef3('0x60')]=_0x13d7b3['id'];return db[_0x2ef3('0x3c')][_0x2ef3('0x62')](_0x462c75[_0x2ef3('0x5c')]);}})['then'](respondWithResult(_0x5c323f,null))['catch'](handleError(_0x5c323f,null));};exports[_0x2ef3('0x81')]=function(_0x5bd470,_0x4ca164,_0x4ecd12){return db[_0x2ef3('0x40')]['findOne']({'where':{'id':_0x5bd470[_0x2ef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ca164,null))[_0x2ef3('0x25')](function(_0x154cbf){if(_0x154cbf){return _0x154cbf[_0x2ef3('0x82')](null);}return null;})['then'](respondWithStatusCode(_0x4ca164,null))[_0x2ef3('0x57')](handleError(_0x4ca164,null));};exports[_0x2ef3('0x83')]=function(_0x32d2e5,_0x57b2dd,_0x43bfb5){return db[_0x2ef3('0x40')][_0x2ef3('0x69')]({'where':{'id':_0x32d2e5[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x57b2dd,null))['then'](function(_0x500cf5){if(_0x500cf5){return _0x500cf5[_0x2ef3('0x83')]();}return null;})['then'](respondWithResult(_0x57b2dd,null))[_0x2ef3('0x57')](handleError(_0x57b2dd,null));};exports[_0x2ef3('0x84')]=function(_0x59d3b9,_0x29fde2,_0x4848d7){if(_0x59d3b9['body']['id']){delete _0x59d3b9[_0x2ef3('0x5c')]['id'];}return db['MailAccount'][_0x2ef3('0x5d')]({'where':{'id':_0x59d3b9[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x29fde2,null))[_0x2ef3('0x25')](function(_0x2747d2){if(_0x2747d2){_0x59d3b9[_0x2ef3('0x5c')][_0x2ef3('0x60')]=_0x2747d2['id'];return db[_0x2ef3('0x59')][_0x2ef3('0x62')](_0x59d3b9[_0x2ef3('0x5c')]);}})[_0x2ef3('0x25')](respondWithResult(_0x29fde2,null))['catch'](handleError(_0x29fde2,null));};exports[_0x2ef3('0x85')]=function(_0x445f38,_0x305d44,_0x28f1d1){return db['MailAccount']['findOne']({'where':{'id':_0x445f38[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x305d44,null))[_0x2ef3('0x25')](function(_0xf4ce92){if(_0xf4ce92){return _0xf4ce92['setSmtp'](null);}return null;})[_0x2ef3('0x25')](respondWithStatusCode(_0x305d44,null))[_0x2ef3('0x57')](handleError(_0x305d44,null));};exports['addInteraction']=function(_0x353705,_0x3d9f72,_0x5b6585){return db[_0x2ef3('0x86')]['find']({'where':{'id':_0x353705[_0x2ef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x3d9f72,null))[_0x2ef3('0x25')](function(_0x4501ce){if(_0x4501ce){return _0x4501ce[_0x2ef3('0x87')](_0x353705[_0x2ef3('0x5c')][_0x2ef3('0x67')],_[_0x2ef3('0x88')](_0x353705['body'],['ids','id'])||{});}})[_0x2ef3('0x25')](respondWithResult(_0x3d9f72,null))[_0x2ef3('0x57')](handleError(_0x3d9f72,null));};exports['getInteractions']=function(_0x3b5673,_0x47684e,_0x46f22c){var _0x382482={'raw':![],'where':{}};var _0x506c82={};var _0xa586d6={'count':0x0,'rows':[]};return db[_0x2ef3('0x40')][_0x2ef3('0x69')]({'where':{'id':_0x3b5673[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x47684e,null))[_0x2ef3('0x25')](function(_0x3bf33f){if(_0x3bf33f){_0x506c82[_0x2ef3('0x44')]=_[_0x2ef3('0x47')](db[_0x2ef3('0x86')][_0x2ef3('0x41')]);_0x506c82[_0x2ef3('0x46')]=_[_0x2ef3('0x47')](_0x3b5673['query']);_0x506c82['filters']=_[_0x2ef3('0x49')](_0x506c82['model'],_0x506c82[_0x2ef3('0x46')]);_0x382482[_0x2ef3('0x4a')]=_['intersection'](_0x506c82['model'],qs[_0x2ef3('0x4b')](_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x4b')]));_0x382482['attributes']=_0x382482['attributes'][_0x2ef3('0x5b')]?_0x382482['attributes']:_0x506c82['model'];if(!_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x4c')]('nolimit')){_0x382482[_0x2ef3('0x31')]=qs[_0x2ef3('0x31')](_0x3b5673[_0x2ef3('0x46')]['limit']);_0x382482['offset']=qs[_0x2ef3('0x30')](_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x30')]);}_0x382482[_0x2ef3('0x63')]=qs[_0x2ef3('0x4e')](_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x4e')]);_0x382482[_0x2ef3('0x4f')]=qs[_0x2ef3('0x48')](_[_0x2ef3('0x50')](_0x3b5673[_0x2ef3('0x46')],_0x506c82[_0x2ef3('0x48')]));_0x382482['where']['MailAccountId']=_0x3bf33f['id'];if(_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x52')]){_0x382482['where']=_[_0x2ef3('0x51')](_0x382482[_0x2ef3('0x4f')],{'$or':_['map'](_0x382482[_0x2ef3('0x4a')],function(_0x2caff2){var _0xf6ab48={};_0xf6ab48[_0x2caff2]={'$like':'%'+_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x52')]+'%'};return _0xf6ab48;})});}_0x382482=_['merge']({},_0x382482,_0x3b5673[_0x2ef3('0x53')]);return db['MailInteraction'][_0x2ef3('0x54')]({'where':_0x382482[_0x2ef3('0x4f')]})[_0x2ef3('0x25')](function(_0x554422){_0xa586d6['count']=_0x554422;if(_0x3b5673[_0x2ef3('0x46')]['includeAll']){_0x382482[_0x2ef3('0x64')]=[{'model':db[_0x2ef3('0x89')],'as':'Contact','required':![]},{'model':db[_0x2ef3('0x8a')],'as':_0x2ef3('0x8b'),'attributes':[_0x2ef3('0x3b'),'fullname',_0x2ef3('0x8c')],'required':![]},{'model':db[_0x2ef3('0x8d')],'as':_0x2ef3('0x8e'),'attributes':['id',_0x2ef3('0x3b'),'color'],'where':_0x3b5673['query'][_0x2ef3('0x8f')]?{'id':_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x8f')]}:undefined,'required':_0x3b5673[_0x2ef3('0x46')]['tag']?!![]:![]}];}return db['MailInteraction'][_0x2ef3('0x65')](_0x382482);})[_0x2ef3('0x25')](function(_0x98c462){_0xa586d6[_0x2ef3('0x56')]=_0x98c462;return _0xa586d6;});}})[_0x2ef3('0x25')](respondWithFilteredResult(_0x47684e,_0x382482))[_0x2ef3('0x57')](handleError(_0x47684e,null));};exports['addApplications']=function(_0x104edd,_0x4969d5,_0x1342c0){return db['MailAccount']['findOne']({'where':{'id':_0x104edd[_0x2ef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x4969d5,null))[_0x2ef3('0x25')](function(_0x4d9918){if(_0x4d9918){return db[_0x2ef3('0x90')][_0x2ef3('0x91')](function(_0x192220){return db[_0x2ef3('0x92')]['destroy']({'where':{'MailAccountId':_0x104edd['params']['id']},'transaction':_0x192220})[_0x2ef3('0x25')](function(_0x21ef2a){var _0xbb6853=_[_0x2ef3('0x45')](_0x104edd[_0x2ef3('0x5c')],function(_0x5d464a){_0x5d464a['MailAccountId']=_0x104edd[_0x2ef3('0x58')]['id'];return _0x5d464a;});return db[_0x2ef3('0x92')][_0x2ef3('0x93')](_0xbb6853,{'transaction':_0x192220});});})[_0x2ef3('0x25')](function(){return db['MailApplication'][_0x2ef3('0x94')]({'where':{'MailAccountId':_0x104edd[_0x2ef3('0x58')]['id']},'order':_0x2ef3('0x95')});});}})[_0x2ef3('0x25')](respondWithResult(_0x4969d5,null))['catch'](handleError(_0x4969d5,null));};exports[_0x2ef3('0x96')]=function(_0x15225c,_0x3ede96,_0x1d970b){var _0x49c11b={};var _0xcdcd80={};var _0xcc5a00;var _0x457d9d;return db[_0x2ef3('0x40')][_0x2ef3('0x69')]({'where':{'id':_0x15225c[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x3ede96,null))[_0x2ef3('0x25')](function(_0x2c1cdf){if(_0x2c1cdf){_0xcc5a00=_0x2c1cdf;_0xcdcd80[_0x2ef3('0x44')]=_[_0x2ef3('0x47')](db['MailApplication'][_0x2ef3('0x41')]);_0xcdcd80['query']=_[_0x2ef3('0x47')](_0x15225c[_0x2ef3('0x46')]);_0xcdcd80[_0x2ef3('0x48')]=_[_0x2ef3('0x49')](_0xcdcd80[_0x2ef3('0x44')],_0xcdcd80['query']);_0x49c11b[_0x2ef3('0x4a')]=_['intersection'](_0xcdcd80[_0x2ef3('0x44')],qs['fields'](_0x15225c[_0x2ef3('0x46')][_0x2ef3('0x4b')]));_0x49c11b[_0x2ef3('0x4a')]=_0x49c11b[_0x2ef3('0x4a')][_0x2ef3('0x5b')]?_0x49c11b['attributes']:_0xcdcd80[_0x2ef3('0x44')];_0x49c11b[_0x2ef3('0x63')]=qs['sort'](_0x15225c[_0x2ef3('0x46')]['sort']);_0x49c11b['where']=qs[_0x2ef3('0x48')](_[_0x2ef3('0x50')](_0x15225c[_0x2ef3('0x46')],_0xcdcd80['filters']));if(_0x15225c[_0x2ef3('0x46')][_0x2ef3('0x52')]){_0x49c11b['where']=_[_0x2ef3('0x51')](_0x49c11b['where'],{'$or':_[_0x2ef3('0x45')](_0x49c11b['attributes'],function(_0x50f8a6){var _0x40221f={};_0x40221f[_0x50f8a6]={'$like':'%'+_0x15225c[_0x2ef3('0x46')][_0x2ef3('0x52')]+'%'};return _0x40221f;})});}_0x49c11b=_['merge']({},_0x49c11b,_0x15225c[_0x2ef3('0x53')]);return _0xcc5a00[_0x2ef3('0x96')](_0x49c11b);}})[_0x2ef3('0x25')](function(_0x3d0983){if(_0x3d0983){_0x457d9d=_0x3d0983[_0x2ef3('0x5b')];if(!_0x15225c[_0x2ef3('0x46')][_0x2ef3('0x4c')](_0x2ef3('0x4d'))){_0x49c11b[_0x2ef3('0x31')]=qs[_0x2ef3('0x31')](_0x15225c[_0x2ef3('0x46')]['limit']);_0x49c11b[_0x2ef3('0x30')]=qs[_0x2ef3('0x30')](_0x15225c[_0x2ef3('0x46')][_0x2ef3('0x30')]);}return _0xcc5a00[_0x2ef3('0x96')](_0x49c11b);}})[_0x2ef3('0x25')](function(_0xbe7a5d){if(_0xbe7a5d){return _0xbe7a5d?{'count':_0x457d9d,'rows':_0xbe7a5d}:null;}})[_0x2ef3('0x25')](respondWithResult(_0x3ede96,null))['catch'](handleError(_0x3ede96,null));};exports['getMessages']=function(_0x3c9333,_0x106902,_0x2cafed){var _0x4710ca={'raw':!![],'where':{}};var _0x48647d={};var _0x547ada={'count':0x0,'rows':[]};return db['MailAccount'][_0x2ef3('0x69')]({'where':{'id':_0x3c9333[_0x2ef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x106902,null))[_0x2ef3('0x25')](function(_0x322446){if(_0x322446){_0x48647d['model']=_[_0x2ef3('0x47')](db[_0x2ef3('0x97')]['rawAttributes']);_0x48647d[_0x2ef3('0x46')]=_['keys'](_0x3c9333[_0x2ef3('0x46')]);_0x48647d['filters']=_[_0x2ef3('0x49')](_0x48647d[_0x2ef3('0x44')],_0x48647d[_0x2ef3('0x46')]);_0x4710ca[_0x2ef3('0x4a')]=_[_0x2ef3('0x49')](_0x48647d[_0x2ef3('0x44')],qs[_0x2ef3('0x4b')](_0x3c9333[_0x2ef3('0x46')][_0x2ef3('0x4b')]));_0x4710ca[_0x2ef3('0x4a')]=_0x4710ca['attributes'][_0x2ef3('0x5b')]?_0x4710ca['attributes']:_0x48647d[_0x2ef3('0x44')];if(!_0x3c9333[_0x2ef3('0x46')][_0x2ef3('0x4c')](_0x2ef3('0x4d'))){_0x4710ca['limit']=qs['limit'](_0x3c9333['query'][_0x2ef3('0x31')]);_0x4710ca[_0x2ef3('0x30')]=qs[_0x2ef3('0x30')](_0x3c9333[_0x2ef3('0x46')][_0x2ef3('0x30')]);}_0x4710ca[_0x2ef3('0x63')]=qs[_0x2ef3('0x4e')](_0x3c9333[_0x2ef3('0x46')]['sort']);_0x4710ca[_0x2ef3('0x4f')]=qs[_0x2ef3('0x48')](_[_0x2ef3('0x50')](_0x3c9333[_0x2ef3('0x46')],_0x48647d[_0x2ef3('0x48')]));_0x4710ca[_0x2ef3('0x4f')][_0x2ef3('0x60')]=_0x322446['id'];if(_0x3c9333[_0x2ef3('0x46')]['filter']){_0x4710ca['where']=_[_0x2ef3('0x51')](_0x4710ca[_0x2ef3('0x4f')],{'$or':_[_0x2ef3('0x45')](_0x4710ca['attributes'],function(_0x596a6d){var _0xda34f7={};_0xda34f7[_0x596a6d]={'$like':'%'+_0x3c9333[_0x2ef3('0x46')]['filter']+'%'};return _0xda34f7;})});}if(_0x3c9333['query']['$gte']){var _0x5432f7=_0x3c9333[_0x2ef3('0x46')]['$gte']['split'](',');var _0x4992ed={};_0x4992ed[_0x5432f7[0x0]]={'$gte':moment(_0x5432f7[0x1])[_0x2ef3('0x98')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4710ca[_0x2ef3('0x4f')]=_[_0x2ef3('0x51')](_0x4710ca[_0x2ef3('0x4f')],_0x4992ed);}_0x4710ca=_[_0x2ef3('0x51')]({},_0x4710ca,_0x3c9333[_0x2ef3('0x53')]);return db[_0x2ef3('0x97')][_0x2ef3('0x54')]({'where':_0x4710ca[_0x2ef3('0x4f')]})[_0x2ef3('0x25')](function(_0x4c00d8){_0x547ada[_0x2ef3('0x54')]=_0x4c00d8;if(_0x3c9333[_0x2ef3('0x46')][_0x2ef3('0x55')]){_0x4710ca[_0x2ef3('0x64')]=[{'all':!![]}];}return db[_0x2ef3('0x97')][_0x2ef3('0x65')](_0x4710ca);})[_0x2ef3('0x25')](function(_0x522ff4){_0x547ada[_0x2ef3('0x56')]=_0x522ff4;return _0x547ada;});}})[_0x2ef3('0x25')](respondWithFilteredResult(_0x106902,_0x4710ca))['catch'](handleError(_0x106902,null));};exports['send']=function(_0x2d6293,_0xc3dcc4,_0x227bb4){var _0x22caa6,_0x457872={},_0x222c09;if(_0x2d6293['body']['to']){_0x222c09=_0x2d6293[_0x2ef3('0x5c')]['to'][_0x2ef3('0x99')](',')[0x0];}return db['MailAccount'][_0x2ef3('0x5d')]({'where':{'id':_0x2d6293[_0x2ef3('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x2ef3('0x9a'),'include':[{'model':db[_0x2ef3('0x89')],'as':_0x2ef3('0x9b'),'where':{'email':_0x222c09},'limit':0x1,'order':[[_0x2ef3('0x9c'),'DESC']]}]},{'model':db[_0x2ef3('0x59')],'as':'Smtp','raw':!![]}]})[_0x2ef3('0x25')](handleEntityNotFound(_0xc3dcc4,null))[_0x2ef3('0x25')](function(_0x8a5f07){if(_0x8a5f07){_0x22caa6=_0x8a5f07;if(_0x8a5f07[_0x2ef3('0x3e')]){if(_[_0x2ef3('0x9d')](_0x2d6293['body']['from'])){_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0x9e')]=util[_0x2ef3('0x98')](_0x2ef3('0x9f'),_0x8a5f07[_0x2ef3('0x3b')],_0x8a5f07['email']||_0x8a5f07[_0x2ef3('0x3e')]['user']);}if(_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0xa0')]&&_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0xa0')]['length']){for(var _0x214fa7=0x0;_0x214fa7<_0x2d6293['body'][_0x2ef3('0xa0')][_0x2ef3('0x5b')];_0x214fa7+=0x1){_0x2d6293['body'][_0x2ef3('0xa0')][_0x214fa7]={'filename':_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0xa0')][_0x214fa7][_0x2ef3('0x3b')],'path':path[_0x2ef3('0xa1')](config[_0x2ef3('0xa2')],_0x2ef3('0xa3'),_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0xa0')][_0x214fa7][_0x2ef3('0xa4')])};}}var _0x59c12a={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x8a5f07[_0x2ef3('0x3e')][_0x2ef3('0x77')])){if(_0x8a5f07[_0x2ef3('0x3e')][_0x2ef3('0x74')]){_0x59c12a[_0x2ef3('0xa5')]={'user':_0x8a5f07[_0x2ef3('0x3e')][_0x2ef3('0x71')],'pass':_0x8a5f07[_0x2ef3('0x3e')]['pass']};}_0x59c12a[_0x2ef3('0x75')]=_0x8a5f07['Smtp'][_0x2ef3('0x75')];_0x59c12a[_0x2ef3('0x76')]=_0x8a5f07[_0x2ef3('0x3e')]['port'];_0x59c12a['secure']=_0x8a5f07[_0x2ef3('0x3e')][_0x2ef3('0xa6')];}else{_0x59c12a[_0x2ef3('0x77')]=_0x8a5f07[_0x2ef3('0x3e')]['service'];_0x59c12a[_0x2ef3('0xa5')]={'user':_0x8a5f07[_0x2ef3('0x3e')][_0x2ef3('0x71')],'pass':_0x8a5f07[_0x2ef3('0x3e')][_0x2ef3('0x79')]};}return respondWithRpcPromise(_0x2ef3('0xa7'),_0x2ef3('0xa8'),{'account':_0x59c12a,'message':_0x2d6293[_0x2ef3('0x5c')]});}else{throw new Error(_0x2ef3('0xa9'));}}})[_0x2ef3('0x25')](function(_0x1ceaf4){if(_0x1ceaf4){_0x457872=_0x1ceaf4;if(_0x22caa6[_0x2ef3('0x9a')]){if(_0x22caa6[_0x2ef3('0x9a')][_0x2ef3('0x9b')][_0x2ef3('0x5b')]){return _0x22caa6[_0x2ef3('0x9a')]['Contacts'][0x0];}else{return db[_0x2ef3('0x89')]['create'](_['defaults'](_0x2d6293[_0x2ef3('0x5c')],{'firstName':_0x2d6293[_0x2ef3('0x5c')]['to'],'email':_0x2d6293['body']['to'],'phone':_0x2d6293[_0x2ef3('0x5c')]['to'],'ListId':_0x22caa6[_0x2ef3('0x6d')]}));}}else{throw new Error(_0x2ef3('0xa9'));}}})['then'](function(_0x4f1875){if(_0x4f1875){var _0x3a16f4={'UserId':_0x2d6293[_0x2ef3('0x71')]['id'],'ContactId':_0x4f1875['id'],'MailAccountId':_0x22caa6['id'],'inReplyTo':_0x457872[_0x2ef3('0xaa')],'to':_0x2d6293['body']['from'],'cc':_0x2d6293['body']['cc'],'subject':_0x2d6293['body']['subject'],'attach':_0x2d6293['body'][_0x2ef3('0xab')],'firstMsgDirection':_0x2ef3('0xac'),'lastMsgAt':moment()[_0x2ef3('0x98')](_0x2ef3('0xad')),'lastMsgDirection':_0x2ef3('0xac'),'lastMsgBody':_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0x5c')],'Messages':[_[_0x2ef3('0x51')](_0x2d6293['body'],{'messageId':_0x457872[_0x2ef3('0xaa')],'sentAt':moment()[_0x2ef3('0x98')](_0x2ef3('0xad')),'read':!![],'MailAccountId':_0x22caa6['id'],'UserId':_0x2d6293['user']['id'],'ContactId':_0x4f1875['id']})]};if(_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0xae')]){_0x3a16f4=_[_0x2ef3('0x51')](_0x3a16f4,_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0xae')]);}return db['MailInteraction'][_0x2ef3('0x62')](_0x3a16f4,{'include':[{'model':db[_0x2ef3('0x97')],'as':'Messages'}]});}})[_0x2ef3('0x25')](respondWithResult(_0xc3dcc4,null))[_0x2ef3('0x57')](handleError(_0xc3dcc4,null));};exports[_0x2ef3('0xaf')]=function(_0x4a9d2b,_0x1c8ede,_0x516084){return db[_0x2ef3('0x40')][_0x2ef3('0x5d')]({'where':{'id':_0x4a9d2b[_0x2ef3('0x58')]['id']},'include':[{'model':db[_0x2ef3('0x59')],'as':_0x2ef3('0x3e'),'raw':!![]}]})[_0x2ef3('0x25')](handleEntityNotFound(_0x1c8ede,null))[_0x2ef3('0x25')](function(_0x2dc4e1){if(_0x2dc4e1&&_0x2dc4e1['Smtp']){var _0x2b3237={'id':_0x2dc4e1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2dc4e1['Smtp'][_0x2ef3('0x77')]){_0x2b3237[_0x2ef3('0x77')]=_0x2dc4e1[_0x2ef3('0x3e')][_0x2ef3('0x77')];}else{_0x2b3237['host']=_0x2dc4e1[_0x2ef3('0x3e')][_0x2ef3('0x75')];_0x2b3237[_0x2ef3('0x76')]=_0x2dc4e1[_0x2ef3('0x3e')]['port'];_0x2b3237[_0x2ef3('0xa6')]=_0x2dc4e1[_0x2ef3('0x3e')][_0x2ef3('0xa6')];}if(_0x2dc4e1[_0x2ef3('0x3e')][_0x2ef3('0x74')]){_0x2b3237[_0x2ef3('0xa5')]={'user':_0x2dc4e1[_0x2ef3('0x3e')][_0x2ef3('0x71')],'pass':_0x2dc4e1[_0x2ef3('0x3e')][_0x2ef3('0x79')]};}return respondWithRpcPromise(_0x2ef3('0xb0'),_0x2ef3('0xaf'),{'account':_0x2b3237});}})[_0x2ef3('0x25')](respondWithResult(_0x1c8ede,null))['catch'](handleError(_0x1c8ede,null));};exports[_0x2ef3('0x37')]=function(_0x3808c9,_0x10483a){return db[_0x2ef3('0x40')][_0x2ef3('0x5d')]({'where':{'id':_0x3808c9[_0x2ef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x10483a,null))[_0x2ef3('0x25')](function(_0x842bea){if(_0x842bea&&_0x842bea[_0x2ef3('0x77')]){throw new db[(_0x2ef3('0x22'))][(_0x2ef3('0x23'))](_0x2ef3('0xb1'));}return _0x842bea;})[_0x2ef3('0x25')](removeEntity(_0x10483a,null))[_0x2ef3('0x57')](handleError(_0x10483a,null));};exports[_0x2ef3('0xb2')]=function(_0x537da6,_0x25454f,_0x12fa8f){return db['MailAccount'][_0x2ef3('0x5d')]({'where':{'id':_0x537da6[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x25454f,null))[_0x2ef3('0x25')](function(_0x59b8d2){if(_0x59b8d2){return _0x59b8d2[_0x2ef3('0xb2')](_0x537da6[_0x2ef3('0x5c')][_0x2ef3('0x67')],_[_0x2ef3('0x88')](_0x537da6[_0x2ef3('0x5c')],[_0x2ef3('0x67'),'id'])||{})[_0x2ef3('0xb3')](function(_0x413489){for(var _0x1a9c32=0x0;_0x1a9c32<_0x537da6[_0x2ef3('0x5c')]['ids'][_0x2ef3('0x5b')];_0x1a9c32+=0x1){socket[_0x2ef3('0xb4')](_0x2ef3('0xb5'),{'UserId':_0x537da6[_0x2ef3('0x5c')]['ids'][_0x1a9c32],'MailAccountId':_0x537da6[_0x2ef3('0x58')]['id']});}return _0x413489;});}})[_0x2ef3('0x25')](respondWithResult(_0x25454f,null))['catch'](handleError(_0x25454f,null));};exports[_0x2ef3('0xb6')]=function(_0x5ac0a3,_0x2bc017,_0x57c13b){return db[_0x2ef3('0x40')]['find']({'where':{'id':_0x5ac0a3[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x2bc017,null))[_0x2ef3('0x25')](function(_0x194858){if(_0x194858){return _0x194858[_0x2ef3('0xb6')](_0x5ac0a3[_0x2ef3('0x46')][_0x2ef3('0x67')])['then'](function(){if(_[_0x2ef3('0xb7')](_0x5ac0a3[_0x2ef3('0x46')][_0x2ef3('0x67')])){for(var _0x15f58c=0x0;_0x15f58c<_0x5ac0a3[_0x2ef3('0x46')][_0x2ef3('0x67')][_0x2ef3('0x5b')];_0x15f58c+=0x1){socket[_0x2ef3('0xb4')](_0x2ef3('0xb8'),{'UserId':Number(_0x5ac0a3[_0x2ef3('0x46')][_0x2ef3('0x67')][_0x15f58c]),'MailAccountId':Number(_0x5ac0a3[_0x2ef3('0x58')]['id'])});}}else{socket[_0x2ef3('0xb4')](_0x2ef3('0xb8'),{'UserId':Number(_0x5ac0a3['query'][_0x2ef3('0x67')]),'MailAccountId':Number(_0x5ac0a3['params']['id'])});}});}})[_0x2ef3('0x25')](respondWithStatusCode(_0x2bc017,null))[_0x2ef3('0x57')](handleError(_0x2bc017,null));};exports[_0x2ef3('0xb9')]=function(_0x33c7b4,_0x17ba1,_0x5c40a6){var _0x15e8e2={};var _0x581066={};var _0x43f685;var _0x26e780;return db[_0x2ef3('0x40')]['findOne']({'where':{'id':_0x33c7b4[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x17ba1,null))[_0x2ef3('0x25')](function(_0x5d8ff7){if(_0x5d8ff7){_0x43f685=_0x5d8ff7;_0x581066['model']=_[_0x2ef3('0x47')](db[_0x2ef3('0x8a')][_0x2ef3('0x41')]);_0x581066[_0x2ef3('0x46')]=_[_0x2ef3('0x47')](_0x33c7b4[_0x2ef3('0x46')]);_0x581066['filters']=_[_0x2ef3('0x49')](_0x581066[_0x2ef3('0x44')],_0x581066[_0x2ef3('0x46')]);_0x15e8e2[_0x2ef3('0x4a')]=_['intersection'](_0x581066[_0x2ef3('0x44')],qs[_0x2ef3('0x4b')](_0x33c7b4['query'][_0x2ef3('0x4b')]));_0x15e8e2['attributes']=_0x15e8e2[_0x2ef3('0x4a')][_0x2ef3('0x5b')]?_0x15e8e2['attributes']:_0x581066['model'];_0x15e8e2[_0x2ef3('0x63')]=qs[_0x2ef3('0x4e')](_0x33c7b4[_0x2ef3('0x46')]['sort']);_0x15e8e2[_0x2ef3('0x4f')]=qs['filters'](_['pick'](_0x33c7b4[_0x2ef3('0x46')],_0x581066['filters']));if(_0x33c7b4[_0x2ef3('0x46')][_0x2ef3('0x52')]){_0x15e8e2[_0x2ef3('0x4f')]=_[_0x2ef3('0x51')](_0x15e8e2[_0x2ef3('0x4f')],{'$or':_[_0x2ef3('0x45')](_0x15e8e2[_0x2ef3('0x4a')],function(_0x5e698b){var _0x2c3ce5={};_0x2c3ce5[_0x5e698b]={'$like':'%'+_0x33c7b4[_0x2ef3('0x46')][_0x2ef3('0x52')]+'%'};return _0x2c3ce5;})});}_0x15e8e2=_['merge']({},_0x15e8e2,_0x33c7b4[_0x2ef3('0x53')]);return _0x43f685[_0x2ef3('0xb9')](_0x15e8e2);}})[_0x2ef3('0x25')](function(_0x2e6750){if(_0x2e6750){_0x26e780=_0x2e6750['length'];if(!_0x33c7b4[_0x2ef3('0x46')][_0x2ef3('0x4c')](_0x2ef3('0x4d'))){_0x15e8e2[_0x2ef3('0x31')]=qs[_0x2ef3('0x31')](_0x33c7b4['query'][_0x2ef3('0x31')]);_0x15e8e2[_0x2ef3('0x30')]=qs[_0x2ef3('0x30')](_0x33c7b4[_0x2ef3('0x46')]['offset']);}return _0x43f685[_0x2ef3('0xb9')](_0x15e8e2);}})['then'](function(_0x571144){if(_0x571144){return _0x571144?{'count':_0x26e780,'rows':_0x571144}:null;}})[_0x2ef3('0x25')](respondWithResult(_0x17ba1,null))['catch'](handleError(_0x17ba1,null));}; \ No newline at end of file +var _0x7429=['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','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','MailAccounts','UserProfileResource','stack','name','index','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Smtp','body','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','rawAttributes','merge','find','removeDispositions','CannedAnswer','create','getAnswers','sort','removeAnswers','ids','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','transaction','MailApplication','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','server/files/attachments','basename','auth','secure','SendMail','defaults','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','./mailAccount.socket','register','jayson/promise','client','http'];(function(_0x33fdec,_0x12834e){var _0x296c6a=function(_0x3bdb9f){while(--_0x3bdb9f){_0x33fdec['push'](_0x33fdec['shift']());}};_0x296c6a(++_0x12834e);}(_0x7429,0x9e));var _0x9742=function(_0x5ca712,_0x33115c){_0x5ca712=_0x5ca712-0x0;var _0x32cbe4=_0x7429[_0x5ca712];return _0x32cbe4;};'use strict';var pdf=require(_0x9742('0x0'));var emlformat=require(_0x9742('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9742('0x2'));var jsonpatch=require(_0x9742('0x3'));var rp=require(_0x9742('0x4'));var moment=require(_0x9742('0x5'));var BPromise=require(_0x9742('0x6'));var Mustache=require(_0x9742('0x7'));var util=require(_0x9742('0x8'));var path=require('path');var sox=require(_0x9742('0x9'));var csv=require('to-csv');var ejs=require(_0x9742('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9742('0xb'));var crypto=require('crypto');var jsforce=require(_0x9742('0xc'));var deskjs=require(_0x9742('0xd'));var toCsv=require(_0x9742('0xe'));var querystring=require(_0x9742('0xf'));var Papa=require(_0x9742('0x10'));var Redis=require(_0x9742('0x11'));var authService=require(_0x9742('0x12'));var qs=require(_0x9742('0x13'));var as=require(_0x9742('0x14'));var hardwareService=require(_0x9742('0x15'));var logger=require(_0x9742('0x16'))('api');var utils=require(_0x9742('0x17'));var config=require(_0x9742('0x18'));var db=require(_0x9742('0x19'))['db'];config['redis']=_['defaults'](config[_0x9742('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9742('0x1b'))[_0x9742('0x1c')](socket);var jayson=require(_0x9742('0x1d'));var client=jayson[_0x9742('0x1e')][_0x9742('0x1f')]({'port':0x232b});function checkPasswordPattern(_0x453f20,_0x5f1ca7,_0x512b72){if(_0x512b72){var _0xeb34fa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xeb34fa[_0x9742('0x20')](_0x5f1ca7)){return _0x453f20;}else{throw new db['Sequelize'][(_0x9742('0x21'))](_0x9742('0x22'));}}else{return _0x453f20;}}function respondWithRpcPromise(_0x127e39,_0x52fb39,_0x37d3e9,_0x3cfdf8){return new BPromise(function(_0x2e60c3,_0xabe6e5){var _0x64d3db=_0x3cfdf8||client;return _0x64d3db[_0x9742('0x23')](_0x127e39,_0x37d3e9)['then'](function(_0x272808){logger[_0x9742('0x24')](_0x9742('0x25'),_0x52fb39,'request\x20sent');logger[_0x9742('0x26')](_0x9742('0x27'),_0x52fb39,_0x9742('0x28'),JSON[_0x9742('0x29')](_0x272808));if(_0x272808[_0x9742('0x2a')]){if(_0x272808[_0x9742('0x2a')][_0x9742('0x2b')]===0x1f4){logger['error'](_0x9742('0x25'),_0x52fb39,_0x272808[_0x9742('0x2a')][_0x9742('0x2c')]);return _0xabe6e5(_0x272808[_0x9742('0x2a')][_0x9742('0x2c')]);}logger['error'](_0x9742('0x25'),_0x52fb39,_0x272808[_0x9742('0x2a')][_0x9742('0x2c')]);return _0x2e60c3(_0x272808[_0x9742('0x2a')][_0x9742('0x2c')]);}else{logger[_0x9742('0x24')](_0x9742('0x25'),_0x52fb39,_0x9742('0x28'));_0x2e60c3(_0x272808['result'][_0x9742('0x2c')]);}})[_0x9742('0x2d')](function(_0x26ddbe){logger[_0x9742('0x2a')](_0x9742('0x25'),_0x52fb39,_0x26ddbe);_0xabe6e5(_0x26ddbe);});});}function respondWithStatusCode(_0x4d384,_0x2fa858){_0x2fa858=_0x2fa858||0xcc;return function(_0x16d237){if(_0x16d237){return _0x4d384[_0x9742('0x2e')](_0x2fa858);}return _0x4d384[_0x9742('0x2f')](_0x2fa858)[_0x9742('0x30')]();};}function respondWithResult(_0x2a100d,_0x3a5835){_0x3a5835=_0x3a5835||0xc8;return function(_0x1775e5){if(_0x1775e5){return _0x2a100d[_0x9742('0x2f')](_0x3a5835)[_0x9742('0x31')](_0x1775e5);}};}function respondWithFilteredResult(_0x45ea1a,_0x3de2ed){return function(_0x50a269){if(_0x50a269){var _0xbbe135=_0x50a269[_0x9742('0x32')],_0x8bbd2d=_0x3de2ed[_0x9742('0x33')],_0x13c696=_0x3de2ed[_0x9742('0x33')]+_0x3de2ed[_0x9742('0x34')],_0xaaccdf;if(_0x13c696>=_0xbbe135){_0x13c696=_0xbbe135;_0xaaccdf=0xc8;}else{_0xaaccdf=0xce;}_0x45ea1a[_0x9742('0x2f')](_0xaaccdf);return _0x45ea1a['set'](_0x9742('0x35'),_0x8bbd2d+'-'+_0x13c696+'/'+_0xbbe135)[_0x9742('0x31')](_0x50a269);}return null;};}function patchUpdates(_0x1d9e85){return function(_0x3b86d8){try{jsonpatch[_0x9742('0x36')](_0x3b86d8,_0x1d9e85,!![]);}catch(_0xba31c8){return BPromise['reject'](_0xba31c8);}return _0x3b86d8[_0x9742('0x37')]();};}function saveUpdates(_0x1fe52f,_0x3aafaa){return function(_0x11f16e){if(_0x11f16e){return _0x11f16e[_0x9742('0x38')](_0x1fe52f)[_0x9742('0x39')](function(_0x4ce66d){return _0x4ce66d;});}return null;};}function removeEntity(_0x5a4b0a,_0x411d77){return function(_0x22af73){if(_0x22af73){return _0x22af73[_0x9742('0x3a')]()[_0x9742('0x39')](function(){var _0x17a154=_0x22af73['get']({'plain':!![]});var _0x3eaa6b=_0x9742('0x3b');return db[_0x9742('0x3c')][_0x9742('0x3a')]({'where':{'type':_0x3eaa6b,'resourceId':_0x17a154['id']}})[_0x9742('0x39')](function(){return _0x22af73;});})['then'](function(){_0x5a4b0a[_0x9742('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f7f64,_0x19532e){return function(_0x23d1cb){if(!_0x23d1cb){_0x4f7f64[_0x9742('0x2e')](0x194);}return _0x23d1cb;};}function handleError(_0x3f3642,_0x1fdf0e){_0x1fdf0e=_0x1fdf0e||0x1f4;return function(_0x1a1240){logger[_0x9742('0x2a')](_0x1a1240[_0x9742('0x3d')]);if(_0x1a1240['name']){delete _0x1a1240[_0x9742('0x3e')];}_0x3f3642[_0x9742('0x2f')](_0x1fdf0e)['send'](_0x1a1240);};}exports[_0x9742('0x3f')]=function(_0x5ee213,_0x592322){var _0xfcae41={'include':[{'model':db[_0x9742('0x40')],'as':_0x9742('0x41')},{'model':db[_0x9742('0x42')],'as':'Smtp'},{'model':db[_0x9742('0x43')],'as':_0x9742('0x44')}]},_0x5ce67a={},_0x5922dc={'count':0x0,'rows':[]};var _0x46c61b=_[_0x9742('0x45')](db[_0x9742('0x46')]['rawAttributes'],function(_0x57dcce){return{'name':_0x57dcce['fieldName'],'type':_0x57dcce[_0x9742('0x47')][_0x9742('0x48')]};});_0x5ce67a[_0x9742('0x49')]=_[_0x9742('0x45')](_0x46c61b,'name');_0x5ce67a['query']=_[_0x9742('0x4a')](_0x5ee213[_0x9742('0x4b')]);_0x5ce67a[_0x9742('0x4c')]=_[_0x9742('0x4d')](_0x5ce67a[_0x9742('0x49')],_0x5ce67a[_0x9742('0x4b')]);_0xfcae41[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x5ce67a[_0x9742('0x49')],qs[_0x9742('0x4f')](_0x5ee213[_0x9742('0x4b')][_0x9742('0x4f')]));_0xfcae41[_0x9742('0x4e')]=_0xfcae41[_0x9742('0x4e')][_0x9742('0x50')]?_0xfcae41[_0x9742('0x4e')]:_0x5ce67a[_0x9742('0x49')];if(!_0x5ee213['query'][_0x9742('0x51')](_0x9742('0x52'))){_0xfcae41[_0x9742('0x34')]=qs['limit'](_0x5ee213['query']['limit']);_0xfcae41[_0x9742('0x33')]=qs['offset'](_0x5ee213[_0x9742('0x4b')]['offset']);}_0xfcae41[_0x9742('0x53')]=qs['sort'](_0x5ee213[_0x9742('0x4b')]['sort']);_0xfcae41[_0x9742('0x54')]=qs['filters'](_[_0x9742('0x55')](_0x5ee213[_0x9742('0x4b')],_0x5ce67a['filters']),_0x46c61b);if(_0x5ee213[_0x9742('0x4b')][_0x9742('0x56')]){_0xfcae41['where']=_['merge'](_0xfcae41['where'],{'$or':_[_0x9742('0x45')](_0x46c61b,function(_0x437260){if(_0x437260[_0x9742('0x47')]!==_0x9742('0x57')){var _0x5ad17a={};_0x5ad17a[_0x437260[_0x9742('0x3e')]]={'$like':'%'+_0x5ee213['query'][_0x9742('0x56')]+'%'};return _0x5ad17a;}})});}_0xfcae41=_['merge']({},_0xfcae41,_0x5ee213[_0x9742('0x58')]);var _0xd2b8ed={'where':_0xfcae41['where']};return db[_0x9742('0x46')][_0x9742('0x32')](_0xd2b8ed)[_0x9742('0x39')](function(_0x48e007){_0x5922dc[_0x9742('0x32')]=_0x48e007;if(_0x5ee213[_0x9742('0x4b')][_0x9742('0x59')]){_0xfcae41[_0x9742('0x5a')]=[{'all':!![]}];}return db[_0x9742('0x46')][_0x9742('0x5b')](_0xfcae41);})[_0x9742('0x39')](function(_0x34e364){_0x5922dc[_0x9742('0x5c')]=_0x34e364;return _0x5922dc;})[_0x9742('0x39')](respondWithFilteredResult(_0x592322,_0xfcae41))[_0x9742('0x2d')](handleError(_0x592322,null));};exports[_0x9742('0x5d')]=function(_0x2f3c68,_0x263ef1){var _0xb9c391={'raw':![],'where':{'id':_0x2f3c68[_0x9742('0x5e')]['id']},'include':[{'model':db[_0x9742('0x40')],'as':'Imap'},{'model':db[_0x9742('0x42')],'as':_0x9742('0x5f')},{'model':db[_0x9742('0x43')],'as':_0x9742('0x44')}]},_0x50c286={};_0x50c286[_0x9742('0x49')]=_[_0x9742('0x4a')](db[_0x9742('0x46')]['rawAttributes']);_0x50c286['query']=_['keys'](_0x2f3c68[_0x9742('0x4b')]);_0x50c286['filters']=_[_0x9742('0x4d')](_0x50c286[_0x9742('0x49')],_0x50c286[_0x9742('0x4b')]);_0xb9c391['attributes']=_[_0x9742('0x4d')](_0x50c286[_0x9742('0x49')],qs[_0x9742('0x4f')](_0x2f3c68['query']['fields']));_0xb9c391[_0x9742('0x4e')]=_0xb9c391[_0x9742('0x4e')][_0x9742('0x50')]?_0xb9c391[_0x9742('0x4e')]:_0x50c286['model'];if(_0x2f3c68[_0x9742('0x4b')][_0x9742('0x59')]){_0xb9c391[_0x9742('0x5a')]=[{'all':!![]}];}_0xb9c391=_['merge']({},_0xb9c391,_0x2f3c68[_0x9742('0x58')]);return db[_0x9742('0x46')]['find'](_0xb9c391)[_0x9742('0x39')](handleEntityNotFound(_0x263ef1,null))[_0x9742('0x39')](respondWithResult(_0x263ef1,null))[_0x9742('0x2d')](handleError(_0x263ef1,null));};exports[_0x9742('0x38')]=function(_0x2d9dc9,_0x1963d7){if(_0x2d9dc9[_0x9742('0x60')]['id']){delete _0x2d9dc9['body']['id'];}return db[_0x9742('0x46')]['find']({'where':{'id':_0x2d9dc9[_0x9742('0x5e')]['id']},'include':[{'model':db[_0x9742('0x40')],'as':_0x9742('0x41')},{'model':db[_0x9742('0x42')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x9742('0x39')](handleEntityNotFound(_0x1963d7,null))[_0x9742('0x39')](saveUpdates(_0x2d9dc9[_0x9742('0x60')],null))[_0x9742('0x39')](function(_0x515610){if(_0x515610&&_0x2d9dc9['body'][_0x9742('0x41')]){return db[_0x9742('0x40')]['update'](_0x2d9dc9['body']['Imap'],{'where':{'MailAccountId':_0x515610['id']}})[_0x9742('0x39')](function(){return _0x515610;});}return _0x515610;})[_0x9742('0x39')](function(_0x313ca4){if(_0x313ca4&&_0x2d9dc9[_0x9742('0x60')][_0x9742('0x5f')]){return db[_0x9742('0x42')][_0x9742('0x38')](_0x2d9dc9[_0x9742('0x60')]['Smtp'],{'where':{'MailAccountId':_0x313ca4['id']}})[_0x9742('0x39')](function(){return _0x313ca4;});}return _0x313ca4;})['then'](respondWithResult(_0x1963d7,null))[_0x9742('0x2d')](handleError(_0x1963d7,null));};exports[_0x9742('0x61')]=function(_0xcb6a46,_0x3c6b2c){return db[_0x9742('0x46')][_0x9742('0x61')]()[_0x9742('0x39')](respondWithResult(_0x3c6b2c,null))[_0x9742('0x2d')](handleError(_0x3c6b2c,null));};exports[_0x9742('0x62')]=function(_0x112370,_0x1ba965,_0x20c103){if(_0x112370[_0x9742('0x60')]['id']){delete _0x112370['body']['id'];}return db[_0x9742('0x46')]['find']({'where':{'id':_0x112370['params']['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x1ba965,null))[_0x9742('0x39')](function(_0x29e1d4){if(_0x29e1d4){_0x112370[_0x9742('0x60')][_0x9742('0x63')]=_0x29e1d4['id'];return db[_0x9742('0x64')]['create'](_0x112370['body']);}})[_0x9742('0x39')](respondWithResult(_0x1ba965,null))[_0x9742('0x2d')](handleError(_0x1ba965,null));};exports[_0x9742('0x65')]=function(_0x31ccc6,_0x2cdf78,_0x3b55c3){var _0x28f7ab={'raw':![],'where':{}};var _0x292c40={};var _0xef88d7={'count':0x0,'rows':[]};return db[_0x9742('0x46')][_0x9742('0x66')]({'where':{'id':_0x31ccc6[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x2cdf78,null))['then'](function(_0x1243ef){if(_0x1243ef){_0x292c40[_0x9742('0x49')]=_[_0x9742('0x4a')](db[_0x9742('0x64')][_0x9742('0x67')]);_0x292c40[_0x9742('0x4b')]=_['keys'](_0x31ccc6[_0x9742('0x4b')]);_0x292c40[_0x9742('0x4c')]=_[_0x9742('0x4d')](_0x292c40[_0x9742('0x49')],_0x292c40[_0x9742('0x4b')]);_0x28f7ab[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x292c40['model'],qs[_0x9742('0x4f')](_0x31ccc6[_0x9742('0x4b')]['fields']));_0x28f7ab['attributes']=_0x28f7ab[_0x9742('0x4e')][_0x9742('0x50')]?_0x28f7ab[_0x9742('0x4e')]:_0x292c40[_0x9742('0x49')];if(!_0x31ccc6['query']['hasOwnProperty']('nolimit')){_0x28f7ab[_0x9742('0x34')]=qs[_0x9742('0x34')](_0x31ccc6[_0x9742('0x4b')]['limit']);_0x28f7ab[_0x9742('0x33')]=qs[_0x9742('0x33')](_0x31ccc6[_0x9742('0x4b')]['offset']);}_0x28f7ab[_0x9742('0x53')]=qs['sort'](_0x31ccc6['query']['sort']);_0x28f7ab['where']=qs[_0x9742('0x4c')](_['pick'](_0x31ccc6[_0x9742('0x4b')],_0x292c40[_0x9742('0x4c')]));_0x28f7ab['where'][_0x9742('0x63')]=_0x1243ef['id'];if(_0x31ccc6[_0x9742('0x4b')][_0x9742('0x56')]){_0x28f7ab[_0x9742('0x54')]=_[_0x9742('0x68')](_0x28f7ab['where'],{'$or':_[_0x9742('0x45')](_0x28f7ab[_0x9742('0x4e')],function(_0x5144aa){var _0x4932c6={};_0x4932c6[_0x5144aa]={'$like':'%'+_0x31ccc6[_0x9742('0x4b')][_0x9742('0x56')]+'%'};return _0x4932c6;})});}_0x28f7ab=_[_0x9742('0x68')]({},_0x28f7ab,_0x31ccc6[_0x9742('0x58')]);return db['Disposition']['count']({'where':_0x28f7ab[_0x9742('0x54')]})[_0x9742('0x39')](function(_0x5dc66b){_0xef88d7[_0x9742('0x32')]=_0x5dc66b;if(_0x31ccc6[_0x9742('0x4b')][_0x9742('0x59')]){_0x28f7ab['include']=[{'all':!![]}];}return db['Disposition'][_0x9742('0x5b')](_0x28f7ab);})[_0x9742('0x39')](function(_0x1bbbe8){_0xef88d7[_0x9742('0x5c')]=_0x1bbbe8;return _0xef88d7;});}})[_0x9742('0x39')](respondWithFilteredResult(_0x2cdf78,_0x28f7ab))['catch'](handleError(_0x2cdf78,null));};exports['removeDispositions']=function(_0x57384c,_0x328296,_0x21b9d6){return db['MailAccount'][_0x9742('0x69')]({'where':{'id':_0x57384c[_0x9742('0x5e')]['id']}})['then'](handleEntityNotFound(_0x328296,null))[_0x9742('0x39')](function(_0xd52bc7){if(_0xd52bc7){return _0xd52bc7[_0x9742('0x6a')](_0x57384c[_0x9742('0x4b')]['ids']);}})[_0x9742('0x39')](respondWithStatusCode(_0x328296,null))['catch'](handleError(_0x328296,null));};exports['addAnswer']=function(_0x30e8c8,_0x46dab3,_0x4ec997){if(_0x30e8c8['body']['id']){delete _0x30e8c8[_0x9742('0x60')]['id'];}return db[_0x9742('0x46')]['find']({'where':{'id':_0x30e8c8[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x46dab3,null))[_0x9742('0x39')](function(_0x457362){if(_0x457362){_0x30e8c8[_0x9742('0x60')][_0x9742('0x63')]=_0x457362['id'];return db[_0x9742('0x6b')][_0x9742('0x6c')](_0x30e8c8[_0x9742('0x60')]);}})['then'](respondWithResult(_0x46dab3,null))[_0x9742('0x2d')](handleError(_0x46dab3,null));};exports[_0x9742('0x6d')]=function(_0x89814e,_0x75f778,_0x5e0c1c){var _0x24bc5f={'raw':![],'where':{}};var _0x15e8eb={};var _0x594256={'count':0x0,'rows':[]};return db[_0x9742('0x46')]['findOne']({'where':{'id':_0x89814e[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x75f778,null))[_0x9742('0x39')](function(_0x3e211b){if(_0x3e211b){_0x15e8eb['model']=_[_0x9742('0x4a')](db['CannedAnswer'][_0x9742('0x67')]);_0x15e8eb[_0x9742('0x4b')]=_[_0x9742('0x4a')](_0x89814e[_0x9742('0x4b')]);_0x15e8eb[_0x9742('0x4c')]=_['intersection'](_0x15e8eb[_0x9742('0x49')],_0x15e8eb['query']);_0x24bc5f[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x15e8eb[_0x9742('0x49')],qs['fields'](_0x89814e[_0x9742('0x4b')][_0x9742('0x4f')]));_0x24bc5f[_0x9742('0x4e')]=_0x24bc5f[_0x9742('0x4e')][_0x9742('0x50')]?_0x24bc5f[_0x9742('0x4e')]:_0x15e8eb[_0x9742('0x49')];if(!_0x89814e[_0x9742('0x4b')]['hasOwnProperty'](_0x9742('0x52'))){_0x24bc5f[_0x9742('0x34')]=qs[_0x9742('0x34')](_0x89814e['query'][_0x9742('0x34')]);_0x24bc5f[_0x9742('0x33')]=qs[_0x9742('0x33')](_0x89814e[_0x9742('0x4b')][_0x9742('0x33')]);}_0x24bc5f[_0x9742('0x53')]=qs[_0x9742('0x6e')](_0x89814e[_0x9742('0x4b')][_0x9742('0x6e')]);_0x24bc5f[_0x9742('0x54')]=qs[_0x9742('0x4c')](_[_0x9742('0x55')](_0x89814e[_0x9742('0x4b')],_0x15e8eb[_0x9742('0x4c')]));_0x24bc5f['where'][_0x9742('0x63')]=_0x3e211b['id'];if(_0x89814e[_0x9742('0x4b')][_0x9742('0x56')]){_0x24bc5f[_0x9742('0x54')]=_[_0x9742('0x68')](_0x24bc5f[_0x9742('0x54')],{'$or':_[_0x9742('0x45')](_0x24bc5f['attributes'],function(_0x2dd3e6){var _0x2ae243={};_0x2ae243[_0x2dd3e6]={'$like':'%'+_0x89814e[_0x9742('0x4b')]['filter']+'%'};return _0x2ae243;})});}_0x24bc5f=_[_0x9742('0x68')]({},_0x24bc5f,_0x89814e[_0x9742('0x58')]);return db[_0x9742('0x6b')]['count']({'where':_0x24bc5f[_0x9742('0x54')]})[_0x9742('0x39')](function(_0xe729e7){_0x594256[_0x9742('0x32')]=_0xe729e7;if(_0x89814e[_0x9742('0x4b')][_0x9742('0x59')]){_0x24bc5f[_0x9742('0x5a')]=[{'all':!![]}];}return db[_0x9742('0x6b')][_0x9742('0x5b')](_0x24bc5f);})[_0x9742('0x39')](function(_0x491725){_0x594256[_0x9742('0x5c')]=_0x491725;return _0x594256;});}})[_0x9742('0x39')](respondWithFilteredResult(_0x75f778,_0x24bc5f))[_0x9742('0x2d')](handleError(_0x75f778,null));};exports[_0x9742('0x6f')]=function(_0x3d0309,_0x5d6641,_0x4ff8dd){return db['MailAccount']['find']({'where':{'id':_0x3d0309[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x5d6641,null))[_0x9742('0x39')](function(_0x3ba496){if(_0x3ba496){return _0x3ba496[_0x9742('0x6f')](_0x3d0309[_0x9742('0x4b')][_0x9742('0x70')]);}})[_0x9742('0x39')](respondWithStatusCode(_0x5d6641,null))[_0x9742('0x2d')](handleError(_0x5d6641,null));};exports[_0x9742('0x6c')]=function(_0x17da78,_0x5d790c){var _0x5c8eb2={'name':_0x17da78[_0x9742('0x60')][_0x9742('0x3e')],'key':_0x17da78[_0x9742('0x60')][_0x9742('0x48')],'email':_0x17da78[_0x9742('0x60')][_0x9742('0x71')],'ListId':_0x17da78['body'][_0x9742('0x72')],'active':!_[_0x9742('0x73')](_0x17da78['body'][_0x9742('0x74')])?_0x17da78[_0x9742('0x60')][_0x9742('0x74')]:!![],'description':_0x17da78[_0x9742('0x60')][_0x9742('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0x9742('0x73')](_0x17da78[_0x9742('0x60')][_0x9742('0x76')])){if(_0x17da78['body'][_0x9742('0x77')]){_0x5c8eb2['Imap']['user']=_0x5c8eb2['Smtp'][_0x9742('0x78')]=_0x17da78[_0x9742('0x60')][_0x9742('0x79')];_0x5c8eb2['Imap'][_0x9742('0x7a')]=_0x5c8eb2['Smtp'][_0x9742('0x7b')]=_0x17da78[_0x9742('0x60')]['cpassword'];}else{_0x5c8eb2[_0x9742('0x41')][_0x9742('0x7c')]=_0x5c8eb2[_0x9742('0x5f')][_0x9742('0x7c')]=![];}_0x5c8eb2[_0x9742('0x41')][_0x9742('0x7d')]=_0x17da78[_0x9742('0x60')][_0x9742('0x41')][_0x9742('0x7d')];_0x5c8eb2['Imap'][_0x9742('0x7e')]=_0x17da78['body'][_0x9742('0x41')][_0x9742('0x7e')];_0x5c8eb2['Smtp'][_0x9742('0x7d')]=_0x17da78[_0x9742('0x60')][_0x9742('0x5f')]['host'];_0x5c8eb2[_0x9742('0x5f')]['port']=_0x17da78[_0x9742('0x60')][_0x9742('0x5f')][_0x9742('0x7e')];}else{_0x5c8eb2[_0x9742('0x41')][_0x9742('0x7f')]=_0x5c8eb2[_0x9742('0x5f')][_0x9742('0x7f')]=_0x17da78[_0x9742('0x60')][_0x9742('0x76')];_0x5c8eb2[_0x9742('0x41')]['user']=_0x5c8eb2['Smtp'][_0x9742('0x78')]=_0x17da78['body'][_0x9742('0x79')];_0x5c8eb2[_0x9742('0x41')][_0x9742('0x7a')]=_0x5c8eb2['Smtp']['pass']=_0x17da78[_0x9742('0x60')]['cpassword'];}return db[_0x9742('0x46')][_0x9742('0x6c')](_0x5c8eb2,{'include':[{'model':db[_0x9742('0x42')],'as':_0x9742('0x5f')},{'model':db[_0x9742('0x40')],'as':_0x9742('0x41')}]})[_0x9742('0x39')](function(_0x2c7121){var _0xae0f2a=_0x17da78[_0x9742('0x78')][_0x9742('0x80')]({'plain':!![]});if(!_0xae0f2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xae0f2a[_0x9742('0x81')]==='user'){var _0x649d88=_0x2c7121[_0x9742('0x80')]({'plain':!![]});return db[_0x9742('0x82')][_0x9742('0x69')]({'where':{'name':_0x9742('0x3b'),'userProfileId':_0xae0f2a['userProfileId']},'raw':!![]})[_0x9742('0x39')](function(_0x199402){if(_0x199402&&_0x199402[_0x9742('0x83')]===0x0){return db['UserProfileResource'][_0x9742('0x6c')]({'name':_0x649d88[_0x9742('0x3e')],'resourceId':_0x649d88['id'],'type':_0x199402[_0x9742('0x3e')],'sectionId':_0x199402['id']},{})['then'](function(){return _0x2c7121;});}else{return _0x2c7121;}})[_0x9742('0x2d')](function(_0x445da3){logger['error'](_0x9742('0x84'),_0x445da3);throw _0x445da3;});}return _0x2c7121;})[_0x9742('0x39')](respondWithResult(_0x5d790c,0xc9))['catch'](handleError(_0x5d790c,null));};exports[_0x9742('0x85')]=function(_0x5556d3,_0x47312f,_0x17def4){return db[_0x9742('0x46')]['findOne']({'where':{'id':_0x5556d3[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x47312f,null))[_0x9742('0x39')](function(_0x5b9463){if(_0x5b9463){return _0x5b9463[_0x9742('0x85')]();}return null;})['then'](respondWithResult(_0x47312f,null))[_0x9742('0x2d')](handleError(_0x47312f,null));};exports['addImap']=function(_0x23ab91,_0x2cbe36,_0x3f9ec3){if(_0x23ab91[_0x9742('0x60')]['id']){delete _0x23ab91[_0x9742('0x60')]['id'];}return db[_0x9742('0x46')]['find']({'where':{'id':_0x23ab91['params']['id']}})['then'](handleEntityNotFound(_0x2cbe36,null))['then'](function(_0x17ee95){if(_0x17ee95){_0x23ab91[_0x9742('0x60')]['MailAccountId']=_0x17ee95['id'];return db['MailServerIn'][_0x9742('0x6c')](_0x23ab91['body']);}})[_0x9742('0x39')](respondWithResult(_0x2cbe36,null))[_0x9742('0x2d')](handleError(_0x2cbe36,null));};exports['removeImap']=function(_0x51c45b,_0xd5ca00,_0xc8b263){return db[_0x9742('0x46')]['findOne']({'where':{'id':_0x51c45b[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0xd5ca00,null))['then'](function(_0x384e43){if(_0x384e43){return _0x384e43[_0x9742('0x86')](null);}return null;})[_0x9742('0x39')](respondWithStatusCode(_0xd5ca00,null))['catch'](handleError(_0xd5ca00,null));};exports['getSmtp']=function(_0x58d4b8,_0xea70f2,_0x4947cb){return db[_0x9742('0x46')][_0x9742('0x66')]({'where':{'id':_0x58d4b8['params']['id']}})[_0x9742('0x39')](handleEntityNotFound(_0xea70f2,null))[_0x9742('0x39')](function(_0x1f938b){if(_0x1f938b){return _0x1f938b[_0x9742('0x87')]();}return null;})[_0x9742('0x39')](respondWithResult(_0xea70f2,null))[_0x9742('0x2d')](handleError(_0xea70f2,null));};exports[_0x9742('0x88')]=function(_0x27e148,_0x49b21a,_0x20da43){if(_0x27e148['body']['id']){delete _0x27e148['body']['id'];}return db[_0x9742('0x46')][_0x9742('0x69')]({'where':{'id':_0x27e148[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x49b21a,null))[_0x9742('0x39')](function(_0x33a56a){if(_0x33a56a){_0x27e148[_0x9742('0x60')]['MailAccountId']=_0x33a56a['id'];return db['MailServerOut']['create'](_0x27e148[_0x9742('0x60')]);}})[_0x9742('0x39')](respondWithResult(_0x49b21a,null))['catch'](handleError(_0x49b21a,null));};exports['removeSmtp']=function(_0x2c6dab,_0x23be54,_0xfc6d67){return db[_0x9742('0x46')][_0x9742('0x66')]({'where':{'id':_0x2c6dab[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x23be54,null))[_0x9742('0x39')](function(_0x542c9b){if(_0x542c9b){return _0x542c9b[_0x9742('0x89')](null);}return null;})['then'](respondWithStatusCode(_0x23be54,null))[_0x9742('0x2d')](handleError(_0x23be54,null));};exports[_0x9742('0x8a')]=function(_0x3c7e51,_0x484882,_0x3af749){return db[_0x9742('0x8b')][_0x9742('0x69')]({'where':{'id':_0x3c7e51[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x484882,null))[_0x9742('0x39')](function(_0x5c3a39){if(_0x5c3a39){return _0x5c3a39[_0x9742('0x8a')](_0x3c7e51[_0x9742('0x60')][_0x9742('0x70')],_[_0x9742('0x8c')](_0x3c7e51[_0x9742('0x60')],[_0x9742('0x70'),'id'])||{});}})[_0x9742('0x39')](respondWithResult(_0x484882,null))[_0x9742('0x2d')](handleError(_0x484882,null));};exports[_0x9742('0x8d')]=function(_0x1c4a7c,_0xdf501c,_0x57b899){var _0x1b2a00={'raw':![],'where':{}};var _0x4308eb={};var _0x10ee20={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1c4a7c['params']['id']}})[_0x9742('0x39')](handleEntityNotFound(_0xdf501c,null))[_0x9742('0x39')](function(_0x508642){if(_0x508642){_0x4308eb[_0x9742('0x49')]=_[_0x9742('0x4a')](db[_0x9742('0x8b')][_0x9742('0x67')]);_0x4308eb['query']=_[_0x9742('0x4a')](_0x1c4a7c['query']);_0x4308eb[_0x9742('0x4c')]=_[_0x9742('0x4d')](_0x4308eb[_0x9742('0x49')],_0x4308eb['query']);_0x1b2a00[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x4308eb[_0x9742('0x49')],qs[_0x9742('0x4f')](_0x1c4a7c['query'][_0x9742('0x4f')]));_0x1b2a00[_0x9742('0x4e')]=_0x1b2a00[_0x9742('0x4e')][_0x9742('0x50')]?_0x1b2a00['attributes']:_0x4308eb['model'];if(!_0x1c4a7c[_0x9742('0x4b')][_0x9742('0x51')](_0x9742('0x52'))){_0x1b2a00['limit']=qs[_0x9742('0x34')](_0x1c4a7c[_0x9742('0x4b')][_0x9742('0x34')]);_0x1b2a00[_0x9742('0x33')]=qs[_0x9742('0x33')](_0x1c4a7c['query'][_0x9742('0x33')]);}_0x1b2a00[_0x9742('0x53')]=qs[_0x9742('0x6e')](_0x1c4a7c['query'][_0x9742('0x6e')]);_0x1b2a00[_0x9742('0x54')]=qs[_0x9742('0x4c')](_[_0x9742('0x55')](_0x1c4a7c[_0x9742('0x4b')],_0x4308eb[_0x9742('0x4c')]));_0x1b2a00['where'][_0x9742('0x63')]=_0x508642['id'];if(_0x1c4a7c[_0x9742('0x4b')][_0x9742('0x56')]){_0x1b2a00[_0x9742('0x54')]=_[_0x9742('0x68')](_0x1b2a00[_0x9742('0x54')],{'$or':_[_0x9742('0x45')](_0x1b2a00[_0x9742('0x4e')],function(_0xccd8fe){var _0x321996={};_0x321996[_0xccd8fe]={'$like':'%'+_0x1c4a7c[_0x9742('0x4b')][_0x9742('0x56')]+'%'};return _0x321996;})});}_0x1b2a00=_[_0x9742('0x68')]({},_0x1b2a00,_0x1c4a7c[_0x9742('0x58')]);return db[_0x9742('0x8b')]['count']({'where':_0x1b2a00['where']})[_0x9742('0x39')](function(_0xa75ebd){_0x10ee20[_0x9742('0x32')]=_0xa75ebd;if(_0x1c4a7c[_0x9742('0x4b')][_0x9742('0x59')]){_0x1b2a00[_0x9742('0x5a')]=[{'model':db[_0x9742('0x8e')],'as':_0x9742('0x8f'),'required':![]},{'model':db[_0x9742('0x90')],'as':_0x9742('0x91'),'attributes':[_0x9742('0x3e'),_0x9742('0x92'),'internal'],'required':![]},{'model':db[_0x9742('0x93')],'as':_0x9742('0x94'),'attributes':['id','name',_0x9742('0x95')],'where':_0x1c4a7c[_0x9742('0x4b')][_0x9742('0x96')]?{'id':_0x1c4a7c['query']['tag']}:undefined,'required':_0x1c4a7c[_0x9742('0x4b')]['tag']?!![]:![]}];}return db[_0x9742('0x8b')]['findAll'](_0x1b2a00);})['then'](function(_0x33c53e){_0x10ee20['rows']=_0x33c53e;return _0x10ee20;});}})[_0x9742('0x39')](respondWithFilteredResult(_0xdf501c,_0x1b2a00))[_0x9742('0x2d')](handleError(_0xdf501c,null));};exports['addApplications']=function(_0xfac9d0,_0x28b556,_0x16fb8b){return db[_0x9742('0x46')][_0x9742('0x66')]({'where':{'id':_0xfac9d0[_0x9742('0x5e')]['id']}})['then'](handleEntityNotFound(_0x28b556,null))[_0x9742('0x39')](function(_0x525136){if(_0x525136){return db['sequelize'][_0x9742('0x97')](function(_0x5bc4e1){return db[_0x9742('0x98')][_0x9742('0x3a')]({'where':{'MailAccountId':_0xfac9d0['params']['id']},'transaction':_0x5bc4e1})[_0x9742('0x39')](function(_0x338c5a){var _0x486355=_['map'](_0xfac9d0[_0x9742('0x60')],function(_0x140978){_0x140978[_0x9742('0x63')]=_0xfac9d0['params']['id'];return _0x140978;});return db[_0x9742('0x98')]['bulkCreate'](_0x486355,{'transaction':_0x5bc4e1});});})[_0x9742('0x39')](function(){return db['MailApplication'][_0x9742('0x99')]({'where':{'MailAccountId':_0xfac9d0[_0x9742('0x5e')]['id']},'order':_0x9742('0x9a')});});}})[_0x9742('0x39')](respondWithResult(_0x28b556,null))[_0x9742('0x2d')](handleError(_0x28b556,null));};exports[_0x9742('0x9b')]=function(_0x2862af,_0x39dc04,_0x18720a){var _0x4f20b4={};var _0x4b0daf={};var _0x4b4a2c;var _0x989ba8;return db[_0x9742('0x46')][_0x9742('0x66')]({'where':{'id':_0x2862af[_0x9742('0x5e')]['id']}})['then'](handleEntityNotFound(_0x39dc04,null))[_0x9742('0x39')](function(_0x4f4819){if(_0x4f4819){_0x4b4a2c=_0x4f4819;_0x4b0daf['model']=_[_0x9742('0x4a')](db[_0x9742('0x98')]['rawAttributes']);_0x4b0daf['query']=_[_0x9742('0x4a')](_0x2862af[_0x9742('0x4b')]);_0x4b0daf['filters']=_[_0x9742('0x4d')](_0x4b0daf['model'],_0x4b0daf[_0x9742('0x4b')]);_0x4f20b4[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x4b0daf[_0x9742('0x49')],qs[_0x9742('0x4f')](_0x2862af[_0x9742('0x4b')][_0x9742('0x4f')]));_0x4f20b4[_0x9742('0x4e')]=_0x4f20b4[_0x9742('0x4e')][_0x9742('0x50')]?_0x4f20b4[_0x9742('0x4e')]:_0x4b0daf['model'];_0x4f20b4[_0x9742('0x53')]=qs['sort'](_0x2862af[_0x9742('0x4b')][_0x9742('0x6e')]);_0x4f20b4[_0x9742('0x54')]=qs[_0x9742('0x4c')](_[_0x9742('0x55')](_0x2862af[_0x9742('0x4b')],_0x4b0daf['filters']));if(_0x2862af['query']['filter']){_0x4f20b4[_0x9742('0x54')]=_[_0x9742('0x68')](_0x4f20b4[_0x9742('0x54')],{'$or':_['map'](_0x4f20b4[_0x9742('0x4e')],function(_0x3467fc){var _0x262eba={};_0x262eba[_0x3467fc]={'$like':'%'+_0x2862af['query'][_0x9742('0x56')]+'%'};return _0x262eba;})});}_0x4f20b4=_['merge']({},_0x4f20b4,_0x2862af['options']);return _0x4b4a2c[_0x9742('0x9b')](_0x4f20b4);}})[_0x9742('0x39')](function(_0x140dc9){if(_0x140dc9){_0x989ba8=_0x140dc9['length'];if(!_0x2862af[_0x9742('0x4b')][_0x9742('0x51')](_0x9742('0x52'))){_0x4f20b4[_0x9742('0x34')]=qs[_0x9742('0x34')](_0x2862af['query'][_0x9742('0x34')]);_0x4f20b4[_0x9742('0x33')]=qs[_0x9742('0x33')](_0x2862af[_0x9742('0x4b')][_0x9742('0x33')]);}return _0x4b4a2c[_0x9742('0x9b')](_0x4f20b4);}})[_0x9742('0x39')](function(_0xab2242){if(_0xab2242){return _0xab2242?{'count':_0x989ba8,'rows':_0xab2242}:null;}})[_0x9742('0x39')](respondWithResult(_0x39dc04,null))['catch'](handleError(_0x39dc04,null));};exports['getMessages']=function(_0x25fdb5,_0x49fb5b,_0x294573){var _0x438edd={'raw':!![],'where':{}};var _0x4512d9={};var _0x56f332={'count':0x0,'rows':[]};return db['MailAccount'][_0x9742('0x66')]({'where':{'id':_0x25fdb5[_0x9742('0x5e')]['id']}})['then'](handleEntityNotFound(_0x49fb5b,null))[_0x9742('0x39')](function(_0x3ddd4d){if(_0x3ddd4d){_0x4512d9['model']=_[_0x9742('0x4a')](db[_0x9742('0x9c')][_0x9742('0x67')]);_0x4512d9[_0x9742('0x4b')]=_[_0x9742('0x4a')](_0x25fdb5[_0x9742('0x4b')]);_0x4512d9[_0x9742('0x4c')]=_[_0x9742('0x4d')](_0x4512d9[_0x9742('0x49')],_0x4512d9[_0x9742('0x4b')]);_0x438edd[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x4512d9['model'],qs[_0x9742('0x4f')](_0x25fdb5[_0x9742('0x4b')][_0x9742('0x4f')]));_0x438edd[_0x9742('0x4e')]=_0x438edd[_0x9742('0x4e')][_0x9742('0x50')]?_0x438edd[_0x9742('0x4e')]:_0x4512d9[_0x9742('0x49')];if(!_0x25fdb5['query'][_0x9742('0x51')](_0x9742('0x52'))){_0x438edd[_0x9742('0x34')]=qs[_0x9742('0x34')](_0x25fdb5[_0x9742('0x4b')][_0x9742('0x34')]);_0x438edd[_0x9742('0x33')]=qs[_0x9742('0x33')](_0x25fdb5['query'][_0x9742('0x33')]);}_0x438edd[_0x9742('0x53')]=qs[_0x9742('0x6e')](_0x25fdb5['query'][_0x9742('0x6e')]);_0x438edd[_0x9742('0x54')]=qs[_0x9742('0x4c')](_[_0x9742('0x55')](_0x25fdb5[_0x9742('0x4b')],_0x4512d9['filters']));_0x438edd['where'][_0x9742('0x63')]=_0x3ddd4d['id'];if(_0x25fdb5[_0x9742('0x4b')][_0x9742('0x56')]){_0x438edd[_0x9742('0x54')]=_[_0x9742('0x68')](_0x438edd['where'],{'$or':_[_0x9742('0x45')](_0x438edd[_0x9742('0x4e')],function(_0x5d4c8a){var _0x481015={};_0x481015[_0x5d4c8a]={'$like':'%'+_0x25fdb5['query'][_0x9742('0x56')]+'%'};return _0x481015;})});}if(_0x25fdb5[_0x9742('0x4b')]['$gte']){var _0x42f3f0=_0x25fdb5['query'][_0x9742('0x9d')][_0x9742('0x9e')](',');var _0x71e558={};_0x71e558[_0x42f3f0[0x0]]={'$gte':moment(_0x42f3f0[0x1])[_0x9742('0x9f')](_0x9742('0xa0'))};_0x438edd[_0x9742('0x54')]=_[_0x9742('0x68')](_0x438edd[_0x9742('0x54')],_0x71e558);}_0x438edd=_[_0x9742('0x68')]({},_0x438edd,_0x25fdb5['options']);return db[_0x9742('0x9c')][_0x9742('0x32')]({'where':_0x438edd[_0x9742('0x54')]})[_0x9742('0x39')](function(_0x2da0a6){_0x56f332[_0x9742('0x32')]=_0x2da0a6;if(_0x25fdb5['query'][_0x9742('0x59')]){_0x438edd[_0x9742('0x5a')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x438edd);})[_0x9742('0x39')](function(_0x294cce){_0x56f332[_0x9742('0x5c')]=_0x294cce;return _0x56f332;});}})[_0x9742('0x39')](respondWithFilteredResult(_0x49fb5b,_0x438edd))[_0x9742('0x2d')](handleError(_0x49fb5b,null));};exports['send']=function(_0x1a0a2b,_0x5f3867,_0x3d3efc){var _0x243f0e,_0x18cceb={},_0x559554;if(_0x1a0a2b[_0x9742('0x60')]['to']){_0x559554=_0x1a0a2b[_0x9742('0x60')]['to'][_0x9742('0x9e')](',')[0x0];}return db[_0x9742('0x46')][_0x9742('0x69')]({'where':{'id':_0x1a0a2b[_0x9742('0x5e')]['id']},'include':[{'model':db[_0x9742('0xa1')],'as':_0x9742('0xa2'),'include':[{'model':db[_0x9742('0x8e')],'as':_0x9742('0xa3'),'where':{'email':_0x559554},'limit':0x1,'order':[[_0x9742('0xa4'),_0x9742('0xa5')]]}]},{'model':db[_0x9742('0x42')],'as':_0x9742('0x5f'),'raw':!![]}]})[_0x9742('0x39')](handleEntityNotFound(_0x5f3867,null))[_0x9742('0x39')](function(_0x20b337){if(_0x20b337){_0x243f0e=_0x20b337;if(_0x20b337['Smtp']){if(_[_0x9742('0x73')](_0x1a0a2b[_0x9742('0x60')]['from'])){_0x1a0a2b[_0x9742('0x60')][_0x9742('0xa6')]=util[_0x9742('0x9f')](_0x9742('0xa7'),_0x20b337[_0x9742('0x3e')],_0x20b337[_0x9742('0x71')]||_0x20b337[_0x9742('0x5f')][_0x9742('0x78')]);}if(_0x1a0a2b[_0x9742('0x60')]['attachments']&&_0x1a0a2b['body'][_0x9742('0xa8')][_0x9742('0x50')]){for(var _0x22ee39=0x0;_0x22ee39<_0x1a0a2b['body'][_0x9742('0xa8')][_0x9742('0x50')];_0x22ee39+=0x1){_0x1a0a2b[_0x9742('0x60')][_0x9742('0xa8')][_0x22ee39]={'filename':_0x1a0a2b['body'][_0x9742('0xa8')][_0x22ee39][_0x9742('0x3e')],'path':path['join'](config['root'],_0x9742('0xa9'),_0x1a0a2b[_0x9742('0x60')][_0x9742('0xa8')][_0x22ee39][_0x9742('0xaa')])};}}var _0x2a4978={'tls':{'rejectUnauthorized':![]}};if(_[_0x9742('0x73')](_0x20b337['Smtp'][_0x9742('0x7f')])){if(_0x20b337['Smtp'][_0x9742('0x7c')]){_0x2a4978[_0x9742('0xab')]={'user':_0x20b337['Smtp'][_0x9742('0x78')],'pass':_0x20b337['Smtp'][_0x9742('0x7b')]};}_0x2a4978[_0x9742('0x7d')]=_0x20b337['Smtp'][_0x9742('0x7d')];_0x2a4978['port']=_0x20b337['Smtp'][_0x9742('0x7e')];_0x2a4978[_0x9742('0xac')]=_0x20b337[_0x9742('0x5f')][_0x9742('0xac')];}else{_0x2a4978[_0x9742('0x7f')]=_0x20b337[_0x9742('0x5f')][_0x9742('0x7f')];_0x2a4978[_0x9742('0xab')]={'user':_0x20b337['Smtp'][_0x9742('0x78')],'pass':_0x20b337['Smtp'][_0x9742('0x7b')]};}return respondWithRpcPromise(_0x9742('0xad'),'sendMail',{'account':_0x2a4978,'message':_0x1a0a2b[_0x9742('0x60')]});}else{throw new Error('List\x20not\x20found');}}})[_0x9742('0x39')](function(_0x57700f){if(_0x57700f){_0x18cceb=_0x57700f;if(_0x243f0e[_0x9742('0xa2')]){if(_0x243f0e['List'][_0x9742('0xa3')][_0x9742('0x50')]){return _0x243f0e[_0x9742('0xa2')][_0x9742('0xa3')][0x0];}else{return db[_0x9742('0x8e')][_0x9742('0x6c')](_[_0x9742('0xae')](_0x1a0a2b[_0x9742('0x60')],{'firstName':_0x1a0a2b[_0x9742('0x60')]['to'],'email':_0x1a0a2b[_0x9742('0x60')]['to'],'phone':_0x1a0a2b[_0x9742('0x60')]['to'],'ListId':_0x243f0e[_0x9742('0x72')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x9742('0x39')](function(_0x1e5a40){if(_0x1e5a40){var _0x4e3ea9={'UserId':_0x1a0a2b[_0x9742('0x78')]['id'],'ContactId':_0x1e5a40['id'],'MailAccountId':_0x243f0e['id'],'inReplyTo':_0x18cceb[_0x9742('0xaf')],'to':_0x1a0a2b[_0x9742('0x60')]['from'],'cc':_0x1a0a2b['body']['cc'],'subject':_0x1a0a2b['body'][_0x9742('0xb0')],'attach':_0x1a0a2b[_0x9742('0x60')][_0x9742('0xb1')],'firstMsgDirection':_0x9742('0xb2'),'lastMsgAt':moment()['format'](_0x9742('0xa0')),'lastMsgDirection':_0x9742('0xb2'),'lastMsgBody':_0x1a0a2b[_0x9742('0x60')][_0x9742('0x60')],'Messages':[_['merge'](_0x1a0a2b[_0x9742('0x60')],{'messageId':_0x18cceb['messageId'],'sentAt':moment()[_0x9742('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x243f0e['id'],'UserId':_0x1a0a2b[_0x9742('0x78')]['id'],'ContactId':_0x1e5a40['id']})]};if(_0x1a0a2b[_0x9742('0x60')]['Interaction']){_0x4e3ea9=_[_0x9742('0x68')](_0x4e3ea9,_0x1a0a2b[_0x9742('0x60')][_0x9742('0xb3')]);}return db[_0x9742('0x8b')][_0x9742('0x6c')](_0x4e3ea9,{'include':[{'model':db[_0x9742('0x9c')],'as':'Messages'}]});}})['then'](respondWithResult(_0x5f3867,null))[_0x9742('0x2d')](handleError(_0x5f3867,null));};exports[_0x9742('0xb4')]=function(_0x22a1a3,_0x299a4a,_0x484efc){return db['MailAccount']['find']({'where':{'id':_0x22a1a3[_0x9742('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x9742('0x5f'),'raw':!![]}]})[_0x9742('0x39')](handleEntityNotFound(_0x299a4a,null))[_0x9742('0x39')](function(_0x276797){if(_0x276797&&_0x276797[_0x9742('0x5f')]){var _0x5a0d5f={'id':_0x276797['id'],'tls':{'rejectUnauthorized':![]}};if(_0x276797[_0x9742('0x5f')][_0x9742('0x7f')]){_0x5a0d5f[_0x9742('0x7f')]=_0x276797[_0x9742('0x5f')]['service'];}else{_0x5a0d5f['host']=_0x276797[_0x9742('0x5f')][_0x9742('0x7d')];_0x5a0d5f[_0x9742('0x7e')]=_0x276797[_0x9742('0x5f')][_0x9742('0x7e')];_0x5a0d5f[_0x9742('0xac')]=_0x276797['Smtp'][_0x9742('0xac')];}if(_0x276797['Smtp'][_0x9742('0x7c')]){_0x5a0d5f[_0x9742('0xab')]={'user':_0x276797[_0x9742('0x5f')][_0x9742('0x78')],'pass':_0x276797[_0x9742('0x5f')][_0x9742('0x7b')]};}return respondWithRpcPromise(_0x9742('0xb5'),_0x9742('0xb4'),{'account':_0x5a0d5f});}})['then'](respondWithResult(_0x299a4a,null))[_0x9742('0x2d')](handleError(_0x299a4a,null));};exports['destroy']=function(_0x1f16ef,_0x36847b){return db['MailAccount'][_0x9742('0x69')]({'where':{'id':_0x1f16ef[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x36847b,null))['then'](function(_0x5f1a51){if(_0x5f1a51&&_0x5f1a51[_0x9742('0x7f')]){throw new db['Sequelize']['ValidationError'](_0x9742('0xb6'));}return _0x5f1a51;})[_0x9742('0x39')](removeEntity(_0x36847b,null))[_0x9742('0x2d')](handleError(_0x36847b,null));};exports[_0x9742('0xb7')]=function(_0x3a9c84,_0x39f3a3,_0x5448d4){return db[_0x9742('0x46')]['find']({'where':{'id':_0x3a9c84[_0x9742('0x5e')]['id']}})['then'](handleEntityNotFound(_0x39f3a3,null))['then'](function(_0x4d45e8){if(_0x4d45e8){return _0x4d45e8[_0x9742('0xb7')](_0x3a9c84['body'][_0x9742('0x70')],_['omit'](_0x3a9c84['body'],[_0x9742('0x70'),'id'])||{})[_0x9742('0xb8')](function(_0x41ea2e){for(var _0x5b5728=0x0;_0x5b5728<_0x3a9c84['body'][_0x9742('0x70')][_0x9742('0x50')];_0x5b5728+=0x1){socket[_0x9742('0xb9')](_0x9742('0xba'),{'UserId':_0x3a9c84['body'][_0x9742('0x70')][_0x5b5728],'MailAccountId':_0x3a9c84[_0x9742('0x5e')]['id']});}return _0x41ea2e;});}})[_0x9742('0x39')](respondWithResult(_0x39f3a3,null))[_0x9742('0x2d')](handleError(_0x39f3a3,null));};exports[_0x9742('0xbb')]=function(_0x484a24,_0x258848,_0x2a3a9d){return db['MailAccount']['find']({'where':{'id':_0x484a24['params']['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x258848,null))[_0x9742('0x39')](function(_0x40b09a){if(_0x40b09a){return _0x40b09a[_0x9742('0xbb')](_0x484a24['query'][_0x9742('0x70')])[_0x9742('0x39')](function(){if(_['isArray'](_0x484a24['query'][_0x9742('0x70')])){for(var _0x17e86a=0x0;_0x17e86a<_0x484a24[_0x9742('0x4b')][_0x9742('0x70')]['length'];_0x17e86a+=0x1){socket[_0x9742('0xb9')](_0x9742('0xbc'),{'UserId':Number(_0x484a24['query'][_0x9742('0x70')][_0x17e86a]),'MailAccountId':Number(_0x484a24[_0x9742('0x5e')]['id'])});}}else{socket[_0x9742('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x484a24[_0x9742('0x4b')][_0x9742('0x70')]),'MailAccountId':Number(_0x484a24[_0x9742('0x5e')]['id'])});}});}})[_0x9742('0x39')](respondWithStatusCode(_0x258848,null))[_0x9742('0x2d')](handleError(_0x258848,null));};exports[_0x9742('0xbd')]=function(_0x510419,_0x5f1d20,_0x13470e){var _0x542e0e={};var _0x288ccc={};var _0x7d5653;var _0x2fd264;return db[_0x9742('0x46')][_0x9742('0x66')]({'where':{'id':_0x510419[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x5f1d20,null))[_0x9742('0x39')](function(_0x39de9d){if(_0x39de9d){_0x7d5653=_0x39de9d;_0x288ccc['model']=_[_0x9742('0x4a')](db[_0x9742('0x90')]['rawAttributes']);_0x288ccc[_0x9742('0x4b')]=_['keys'](_0x510419[_0x9742('0x4b')]);_0x288ccc['filters']=_['intersection'](_0x288ccc['model'],_0x288ccc[_0x9742('0x4b')]);_0x542e0e[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x288ccc['model'],qs[_0x9742('0x4f')](_0x510419[_0x9742('0x4b')][_0x9742('0x4f')]));_0x542e0e[_0x9742('0x4e')]=_0x542e0e['attributes'][_0x9742('0x50')]?_0x542e0e[_0x9742('0x4e')]:_0x288ccc[_0x9742('0x49')];_0x542e0e[_0x9742('0x53')]=qs[_0x9742('0x6e')](_0x510419['query'][_0x9742('0x6e')]);_0x542e0e['where']=qs['filters'](_[_0x9742('0x55')](_0x510419['query'],_0x288ccc[_0x9742('0x4c')]));if(_0x510419['query'][_0x9742('0x56')]){_0x542e0e['where']=_[_0x9742('0x68')](_0x542e0e[_0x9742('0x54')],{'$or':_['map'](_0x542e0e[_0x9742('0x4e')],function(_0x191d25){var _0xa1508b={};_0xa1508b[_0x191d25]={'$like':'%'+_0x510419[_0x9742('0x4b')][_0x9742('0x56')]+'%'};return _0xa1508b;})});}_0x542e0e=_[_0x9742('0x68')]({},_0x542e0e,_0x510419['options']);return _0x7d5653[_0x9742('0xbd')](_0x542e0e);}})[_0x9742('0x39')](function(_0x2837b5){if(_0x2837b5){_0x2fd264=_0x2837b5[_0x9742('0x50')];if(!_0x510419[_0x9742('0x4b')][_0x9742('0x51')](_0x9742('0x52'))){_0x542e0e[_0x9742('0x34')]=qs[_0x9742('0x34')](_0x510419['query']['limit']);_0x542e0e[_0x9742('0x33')]=qs[_0x9742('0x33')](_0x510419['query'][_0x9742('0x33')]);}return _0x7d5653[_0x9742('0xbd')](_0x542e0e);}})[_0x9742('0x39')](function(_0x5748b2){if(_0x5748b2){return _0x5748b2?{'count':_0x2fd264,'rows':_0x5748b2}:null;}})[_0x9742('0x39')](respondWithResult(_0x5f1d20,null))[_0x9742('0x2d')](handleError(_0x5f1d20,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 6168892..740b815 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 _0xdfa0=['../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x53db29,_0x345447){var _0x3e854a=function(_0x26d8db){while(--_0x26d8db){_0x53db29['push'](_0x53db29['shift']());}};_0x3e854a(++_0x345447);}(_0xdfa0,0x11d));var _0x0dfa=function(_0xbc3ff3,_0x1f866a){_0xbc3ff3=_0xbc3ff3-0x0;var _0x2f375b=_0xdfa0[_0xbc3ff3];return _0x2f375b;};'use strict';var EventEmitter=require(_0x0dfa('0x0'));var MailAccount=require(_0x0dfa('0x1'))['db'][_0x0dfa('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x0dfa('0x3')](0x0);var events={'afterCreate':_0x0dfa('0x4'),'afterUpdate':_0x0dfa('0x5'),'afterDestroy':_0x0dfa('0x6')};function emitEvent(_0x3e08e0){return function(_0x44fac9,_0x50bf0b,_0x24183d){MailAccountEvents[_0x0dfa('0x7')](_0x3e08e0+':'+_0x44fac9['id'],_0x44fac9);MailAccountEvents['emit'](_0x3e08e0,_0x44fac9);_0x24183d(null);};}for(var e in events){if(events[_0x0dfa('0x8')](e)){var event=events[e];MailAccount[_0x0dfa('0x9')](e,emitEvent(event));}}module[_0x0dfa('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x8965=['save','update','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x208c06,_0x309350){var _0x46efef=function(_0xddcb87){while(--_0xddcb87){_0x208c06['push'](_0x208c06['shift']());}};_0x46efef(++_0x309350);}(_0x8965,0x1e8));var _0x5896=function(_0x346ff6,_0x5b525a){_0x346ff6=_0x346ff6-0x0;var _0x4ef56b=_0x8965[_0x346ff6];return _0x4ef56b;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x5896('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5896('0x1')](0x0);var events={'afterCreate':_0x5896('0x2'),'afterUpdate':_0x5896('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3743db){return function(_0x3dbc11,_0x3879bd,_0xca0c36){MailAccountEvents[_0x5896('0x4')](_0x3743db+':'+_0x3dbc11['id'],_0x3dbc11);MailAccountEvents[_0x5896('0x4')](_0x3743db,_0x3dbc11);_0xca0c36(null);};}for(var e in events){if(events[_0x5896('0x5')](e)){var event=events[e];MailAccount[_0x5896('0x6')](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 077110c..3473be1 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 _0x9386=['MailAccount','mail_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports'];(function(_0x52f481,_0x42861c){var _0xe9cfc2=function(_0x2c27cf){while(--_0x2c27cf){_0x52f481['push'](_0x52f481['shift']());}};_0xe9cfc2(++_0x42861c);}(_0x9386,0x17b));var _0x6938=function(_0x1409f9,_0x4e7dbc){_0x1409f9=_0x1409f9-0x0;var _0x17d0a8=_0x9386[_0x1409f9];return _0x17d0a8;};'use strict';var _=require(_0x6938('0x0'));var util=require('util');var logger=require(_0x6938('0x1'))(_0x6938('0x2'));var moment=require(_0x6938('0x3'));var BPromise=require(_0x6938('0x4'));var rp=require(_0x6938('0x5'));var fs=require('fs');var path=require(_0x6938('0x6'));var rimraf=require(_0x6938('0x7'));var config=require(_0x6938('0x8'));var attributes=require(_0x6938('0x9'));module[_0x6938('0xa')]=function(_0x1512b0,_0x1f8944){return _0x1512b0['define'](_0x6938('0xb'),attributes,{'tableName':_0x6938('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14b2=['request-promise','path','rimraf','../../config/environment','exports','MailAccount','lodash','../../config/logger'];(function(_0x50a45f,_0x428399){var _0x5279ef=function(_0x5c2bb3){while(--_0x5c2bb3){_0x50a45f['push'](_0x50a45f['shift']());}};_0x5279ef(++_0x428399);}(_0x14b2,0x9e));var _0x214b=function(_0x5c4100,_0x1c72be){_0x5c4100=_0x5c4100-0x0;var _0x3c6b06=_0x14b2[_0x5c4100];return _0x3c6b06;};'use strict';var _=require(_0x214b('0x0'));var util=require('util');var logger=require(_0x214b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x214b('0x2'));var fs=require('fs');var path=require(_0x214b('0x3'));var rimraf=require(_0x214b('0x4'));var config=require(_0x214b('0x5'));var attributes=require('./mailAccount.attributes');module[_0x214b('0x6')]=function(_0x2eb489,_0x5e1461){return _0x2eb489['define'](_0x214b('0x7'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 0f8171a..0aa1e86 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 _0x5bc5=['MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','raw','options','attributes','limit','include','map','model','debug','ShowMailAccount','find','where','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','get','omit','applications','list','orderBy','priority','asc','autoclose','length','close','Contacts','create','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','interaction','created','attachments','bcc','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailAccount.socket','register','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x5bc5,0xb2));var _0x55bc=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x5bc5[_0x540dcb];return _0x49353c;};'use strict';var _=require(_0x55bc('0x0'));var util=require(_0x55bc('0x1'));var moment=require(_0x55bc('0x2'));var BPromise=require(_0x55bc('0x3'));var rs=require(_0x55bc('0x4'));var fs=require('fs');var Redis=require(_0x55bc('0x5'));var db=require(_0x55bc('0x6'))['db'];var utils=require(_0x55bc('0x7'));var logger=require(_0x55bc('0x8'))(_0x55bc('0x9'));var config=require(_0x55bc('0xa'));var jayson=require(_0x55bc('0xb'));var client=jayson[_0x55bc('0xc')]['http']({'port':0x232c});config[_0x55bc('0xd')]=_[_0x55bc('0xe')](config[_0x55bc('0xd')],{'host':_0x55bc('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55bc('0xd')]));require(_0x55bc('0x10'))[_0x55bc('0x11')](socket);function respondWithRpcPromise(_0x3114d0,_0x3548fb,_0xe07566){return new BPromise(function(_0x72a619,_0x718891){return client['request'](_0x3114d0,_0xe07566)[_0x55bc('0x12')](function(_0xbae62d){logger[_0x55bc('0x13')]('MailAccount,\x20%s,\x20%s',_0x3548fb,_0x55bc('0x14'));logger['debug'](_0x55bc('0x15'),_0x3548fb,_0x55bc('0x14'),JSON[_0x55bc('0x16')](_0xbae62d));if(_0xbae62d['error']){if(_0xbae62d[_0x55bc('0x17')]['code']===0x1f4){logger[_0x55bc('0x17')](_0x55bc('0x18'),_0x3548fb,_0xbae62d[_0x55bc('0x17')]['message']);return _0x718891(_0xbae62d[_0x55bc('0x17')][_0x55bc('0x19')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x3548fb,_0xbae62d[_0x55bc('0x17')]['message']);return _0x72a619(_0xbae62d['error'][_0x55bc('0x19')]);}else{logger[_0x55bc('0x13')](_0x55bc('0x18'),_0x3548fb,'request\x20sent');_0x72a619(_0xbae62d[_0x55bc('0x1a')][_0x55bc('0x19')]);}})[_0x55bc('0x1b')](function(_0x5714f5){logger[_0x55bc('0x17')]('MailAccount,\x20%s,\x20%s',_0x3548fb,_0x5714f5);_0x718891(_0x5714f5);});});}exports[_0x55bc('0x1c')]=function(_0x4a4d0d){var _0x53f103=this;return new Promise(function(_0x1cf770,_0x390af6){return db[_0x55bc('0x1d')]['findAll']({'raw':_0x4a4d0d['options']?_0x4a4d0d['options'][_0x55bc('0x1e')]===undefined?!![]:![]:!![],'where':_0x4a4d0d[_0x55bc('0x1f')]?_0x4a4d0d['options']['where']||null:null,'attributes':_0x4a4d0d[_0x55bc('0x1f')]?_0x4a4d0d[_0x55bc('0x1f')][_0x55bc('0x20')]||null:null,'limit':_0x4a4d0d[_0x55bc('0x1f')]?_0x4a4d0d['options'][_0x55bc('0x21')]||null:null,'include':_0x4a4d0d['options']?_0x4a4d0d['options'][_0x55bc('0x22')]?_[_0x55bc('0x23')](_0x4a4d0d[_0x55bc('0x1f')][_0x55bc('0x22')],function(_0x293bee){return{'model':db[_0x293bee['model']],'as':_0x293bee['as'],'attributes':_0x293bee[_0x55bc('0x20')],'include':_0x293bee[_0x55bc('0x22')]?_[_0x55bc('0x23')](_0x293bee[_0x55bc('0x22')],function(_0x2d1735){return{'model':db[_0x2d1735[_0x55bc('0x24')]],'as':_0x2d1735['as'],'attributes':_0x2d1735['attributes'],'include':_0x2d1735[_0x55bc('0x22')]?_[_0x55bc('0x23')](_0x2d1735[_0x55bc('0x22')],function(_0x2ddee7){return{'model':db[_0x2ddee7[_0x55bc('0x24')]],'as':_0x2ddee7['as'],'attributes':_0x2ddee7[_0x55bc('0x20')]};}):[]};}):[]};}):[]:[]})[_0x55bc('0x12')](function(_0x29cf97){logger[_0x55bc('0x13')](_0x55bc('0x1c'),_0x4a4d0d);logger[_0x55bc('0x25')](_0x55bc('0x1c'),_0x4a4d0d,JSON['stringify'](_0x29cf97));_0x1cf770(_0x29cf97);})[_0x55bc('0x1b')](function(_0x1a6f6a){logger[_0x55bc('0x17')](_0x55bc('0x1c'),_0x1a6f6a[_0x55bc('0x19')],_0x4a4d0d);_0x390af6(_0x53f103['error'](0x1f4,_0x1a6f6a[_0x55bc('0x19')]));});});};exports[_0x55bc('0x26')]=function(_0x3e4c8d){var _0x206b54=this;return new Promise(function(_0x419bc7,_0x3e35e7){return db[_0x55bc('0x1d')][_0x55bc('0x27')]({'raw':_0x3e4c8d[_0x55bc('0x1f')]?_0x3e4c8d['options'][_0x55bc('0x1e')]===undefined?!![]:![]:!![],'where':_0x3e4c8d[_0x55bc('0x1f')]?_0x3e4c8d[_0x55bc('0x1f')][_0x55bc('0x28')]||null:null,'attributes':_0x3e4c8d[_0x55bc('0x1f')]?_0x3e4c8d[_0x55bc('0x1f')][_0x55bc('0x20')]||null:null,'include':_0x3e4c8d['options']?_0x3e4c8d[_0x55bc('0x1f')][_0x55bc('0x22')]?_['map'](_0x3e4c8d[_0x55bc('0x1f')][_0x55bc('0x22')],function(_0x366378){return{'model':db[_0x366378[_0x55bc('0x24')]],'as':_0x366378['as'],'attributes':_0x366378[_0x55bc('0x20')],'include':_0x366378['include']?_['map'](_0x366378[_0x55bc('0x22')],function(_0xe5e90c){return{'model':db[_0xe5e90c[_0x55bc('0x24')]],'as':_0xe5e90c['as'],'attributes':_0xe5e90c[_0x55bc('0x20')],'include':_0xe5e90c[_0x55bc('0x22')]?_[_0x55bc('0x23')](_0xe5e90c[_0x55bc('0x22')],function(_0x38d0f9){return{'model':db[_0x38d0f9['model']],'as':_0x38d0f9['as'],'attributes':_0x38d0f9[_0x55bc('0x20')]};}):[]};}):[]};}):[]:[]})[_0x55bc('0x12')](function(_0x397b77){logger['info']('ShowMailAccount',_0x3e4c8d);logger[_0x55bc('0x25')](_0x55bc('0x26'),_0x3e4c8d,JSON[_0x55bc('0x16')](_0x397b77));_0x419bc7(_0x397b77);})[_0x55bc('0x1b')](function(_0x4c1e8e){logger[_0x55bc('0x17')](_0x55bc('0x26'),_0x4c1e8e[_0x55bc('0x19')],_0x3e4c8d);_0x3e35e7(_0x206b54[_0x55bc('0x17')](0x1f4,_0x4c1e8e[_0x55bc('0x19')]));});});};exports[_0x55bc('0x29')]=function(_0x334e24){var _0x3e5b7c=this;return new Promise(function(_0x5ebce8,_0x339704){var _0xc3be10={'body':_0x334e24[_0x55bc('0x2a')],'channel':_0x55bc('0x2b')};var _0x488b7b=_[_0x55bc('0x2c')](_[_0x55bc('0x2d')](db[_0x55bc('0x2e')]['rawAttributes']),[_0x55bc('0x2f'),_0x55bc('0x30'),'CompanyId',_0x55bc('0x31')]);var _0x464f05=![];if(_0x334e24[_0x55bc('0x2a')]['id']){delete _0x334e24[_0x55bc('0x2a')]['id'];}if(_[_0x55bc('0x32')](_0x334e24[_0x55bc('0x2a')][_0x55bc('0x33')])){return _0x339704(_0x3e5b7c['error'](0x1f4,_0x55bc('0x34')));}if(_[_0x55bc('0x32')](_0x334e24[_0x55bc('0x2a')]['body'])||_0x334e24[_0x55bc('0x2a')][_0x55bc('0x2a')]===''){return _0x339704(_0x3e5b7c[_0x55bc('0x17')](0x1f4,_0x55bc('0x35')));}if(_['isNil'](_0x334e24[_0x55bc('0x2a')]['mapKey'])){return _0x339704(_0x3e5b7c['error'](0x1f4,_0x55bc('0x36')+_0x488b7b));}if(!_['includes'](_0x488b7b,_0x334e24[_0x55bc('0x2a')][_0x55bc('0x37')])){return _0x339704(_0x3e5b7c[_0x55bc('0x17')](0x1f4,_0x55bc('0x38')+_0x488b7b));}var _0x5f361d={};_0x5f361d[_0x334e24['body']['mapKey']]=_0x334e24['body'][_0x55bc('0x33')];return db[_0x55bc('0x1d')]['find']({'where':{'id':_0x334e24[_0x55bc('0x39')]['id']},'include':[{'model':db[_0x55bc('0x3a')],'as':_0x55bc('0x3b'),'include':[{'model':db[_0x55bc('0x2e')],'as':'Contacts','where':_0x5f361d,'limit':0x1,'order':[[_0x55bc('0x30'),_0x55bc('0x3c')]]}]},{'model':db[_0x55bc('0x3d')],'as':_0x55bc('0x3e')},{'model':db[_0x55bc('0x3f')],'as':'Smtp'}]})[_0x55bc('0x12')](function(_0x25ee24){if(_0x25ee24&&_0x25ee24[_0x55bc('0x3b')]){var _0x308f2c=_0x25ee24[_0x55bc('0x40')]({'plain':!![]});_0xc3be10[_0x55bc('0x39')]=_[_0x55bc('0x41')](_0x308f2c,['Applications',_0x55bc('0x3b')]);_0xc3be10[_0x55bc('0x42')]=_0x308f2c[_0x55bc('0x3e')];_0xc3be10[_0x55bc('0x43')]=_0x308f2c[_0x55bc('0x3b')];_0xc3be10[_0x55bc('0x42')]=_[_0x55bc('0x44')](_0xc3be10[_0x55bc('0x42')],[_0x55bc('0x45')],[_0x55bc('0x46')]);if(_0xc3be10[_0x55bc('0x39')]&&_0xc3be10[_0x55bc('0x39')][_0x55bc('0x47')]){_0xc3be10[_0x55bc('0x42')]['push']({'id':0x0,'priority':_0xc3be10['applications'][_0x55bc('0x48')]+0x1,'app':_0x55bc('0x49'),'appdata':_0x55bc('0x47'),'interval':'*,*,*,*'});}if(_0xc3be10[_0x55bc('0x39')]['Applications']){delete _0xc3be10[_0x55bc('0x39')]['Applications'];}if(_0xc3be10[_0x55bc('0x39')]['List']){delete _0xc3be10[_0x55bc('0x39')][_0x55bc('0x3b')];}if(_0x308f2c[_0x55bc('0x3b')]['Contacts'][_0x55bc('0x48')]){return _0x308f2c[_0x55bc('0x3b')][_0x55bc('0x4a')][0x0];}var _0x38c402=_[_0x55bc('0xe')](_0x334e24['body'],{'firstName':_0x334e24[_0x55bc('0x2a')]['from'],'ListId':_0x308f2c[_0x55bc('0x31')]});_0x38c402[_0x334e24[_0x55bc('0x2a')][_0x55bc('0x37')]]=_0x334e24[_0x55bc('0x2a')][_0x55bc('0x33')];return db[_0x55bc('0x2e')][_0x55bc('0x4b')](_0x38c402);}else{throw new Error(_0x55bc('0x4c'));}})[_0x55bc('0x12')](function(_0x189635){_0xc3be10[_0x55bc('0x4d')]=_0x189635;if(_0x189635){if(!_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x4e')]){_0x334e24[_0x55bc('0x2a')]['message'][_0x55bc('0x4e')]=rs['generate']()+'\x20'+_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x33')];}var _0x40899c={'ContactId':_0x189635['id'],'MailAccountId':_0x334e24[_0x55bc('0x39')]['id'],'inReplyTo':_0x334e24[_0x55bc('0x2a')]['message']['messageId'],'to':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x33')],'cc':_0x334e24['body'][_0x55bc('0x19')]['cc'],'subject':_0x334e24[_0x55bc('0x2a')]['message'][_0x55bc('0x4f')],'attach':_0x334e24[_0x55bc('0x2a')]['message'][_0x55bc('0x50')],'lastMsgAt':moment()[_0x55bc('0x51')](_0x55bc('0x52')),'lastMsgDirection':'in','lastMsgBody':_0x334e24['body'][_0x55bc('0x2a')]};return db[_0x55bc('0x53')][_0x55bc('0x27')]({'where':{'closed':![],'MailAccountId':_0x334e24[_0x55bc('0x39')]['id']},'include':[{'model':db[_0x55bc('0x54')],'as':_0x55bc('0x55'),'attributes':[_0x55bc('0x4e')],'where':{'messageId':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x56')]}}]})[_0x55bc('0x12')](function(_0x3ba01e){if(_0x3ba01e){return[_0x3ba01e,![]];}return db['MailInteraction'][_0x55bc('0x4b')](_0x40899c)['then'](function(_0x55b8e1){return[_0x55b8e1,!![]];});});}else{throw new Error(_0x55bc('0x57'));}})['spread'](function(_0x500838,_0x2e962e){if(_0x500838){_0x464f05=_0x2e962e;if(!_0x2e962e){return _0x500838[_0x55bc('0x58')]({'inReplyTo':_0x334e24['body'][_0x55bc('0x19')][_0x55bc('0x4e')],'to':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x33')],'cc':_0x334e24[_0x55bc('0x2a')]['message']['cc'],'subject':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x4f')],'attach':_0x500838[_0x55bc('0x50')]?_0x500838[_0x55bc('0x50')]:_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x50')],'substatus':null,'substatusAt':moment()['format'](_0x55bc('0x52')),'lastMsgAt':moment()[_0x55bc('0x51')](_0x55bc('0x52')),'lastMsgDirection':'in','lastMsgBody':_0x334e24[_0x55bc('0x2a')]['body']});}else{return _0x500838;}}})[_0x55bc('0x12')](function(_0x3794c7){_0xc3be10[_0x55bc('0x59')]=_0x3794c7[_0x55bc('0x40')]({'plain':!![]});_0xc3be10[_0x55bc('0x59')][_0x55bc('0x5a')]=_0x464f05;return db[_0x55bc('0x54')]['create']({'body':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x2a')],'MailAccountId':_0x334e24['account']['id'],'MailInteractionId':_0x3794c7['id'],'direction':'in','ContactId':_0xc3be10[_0x55bc('0x4d')]['id'],'messageId':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x4e')],'from':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x33')],'to':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')]['to'],'cc':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')]['cc'],'subject':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x4f')],'attach':_0x334e24[_0x55bc('0x2a')]['message'][_0x55bc('0x50')],'Attachments':_0x334e24[_0x55bc('0x2a')]['message'][_0x55bc('0x5b')],'originTo':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')]['originTo'],'originCc':_0x334e24['body']['message']['originCc'],'bcc':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x5c')]},{'include':[{'model':db['Attachment'],'as':_0x55bc('0x5d')}]});})[_0x55bc('0x12')](function(_0x21511c){_0xc3be10[_0x55bc('0x19')]=_0x21511c;if(_0xc3be10[_0x55bc('0x59')][_0x55bc('0x5e')]){return db['User']['find']({'attributes':['id',_0x55bc('0x5f')],'where':{'id':_0xc3be10['interaction'][_0x55bc('0x5e')]}})[_0x55bc('0x12')](function(_0x4e1fbc){if(_0x4e1fbc){_0xc3be10[_0x55bc('0x42')][_0x55bc('0x60')]({'id':0x0,'priority':0x0,'app':_0x55bc('0x61'),'appdata':_0x4e1fbc[_0x55bc('0x5f')]+','+(_0xc3be10[_0x55bc('0x39')][_0x55bc('0x62')]||0xa),'interval':_0x55bc('0x63')});}return respondWithRpcPromise('Start',_0x55bc('0x64'),_0xc3be10);});}return respondWithRpcPromise('Start','startRouting',_0xc3be10);})['then'](function(_0x19e417){_0x5ebce8(_0x19e417);})['catch'](function(_0x9a802b){_0x339704(_0x3e5b7c[_0x55bc('0x17')](0x1f4,_0x9a802b['message']));});});}; \ No newline at end of file +var _0x6324=['created','attachments','originTo','originCc','bcc','Attachment','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowMailAccount','NotifyMailAccount','body','difference','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','list','applications','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','Contacts','defaults','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','spread','update','subject','interaction'];(function(_0x70db11,_0x3cdc8c){var _0x2155d9=function(_0x16a116){while(--_0x16a116){_0x70db11['push'](_0x70db11['shift']());}};_0x2155d9(++_0x3cdc8c);}(_0x6324,0x142));var _0x4632=function(_0x479f6f,_0x1c26c4){_0x479f6f=_0x479f6f-0x0;var _0x24e701=_0x6324[_0x479f6f];return _0x24e701;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var BPromise=require(_0x4632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4632('0x5'));var logger=require('../../config/logger')(_0x4632('0x6'));var config=require('../../config/environment');var jayson=require(_0x4632('0x7'));var client=jayson[_0x4632('0x8')][_0x4632('0x9')]({'port':0x232c});config[_0x4632('0xa')]=_['defaults'](config[_0x4632('0xa')],{'host':_0x4632('0xb'),'port':0x18eb});var socket=require(_0x4632('0xc'))(new Redis(config['redis']));require(_0x4632('0xd'))[_0x4632('0xe')](socket);function respondWithRpcPromise(_0x47a518,_0x556bbc,_0xcdefa2){return new BPromise(function(_0x21999d,_0x30a7cf){return client[_0x4632('0xf')](_0x47a518,_0xcdefa2)[_0x4632('0x10')](function(_0xe28f38){logger[_0x4632('0x11')](_0x4632('0x12'),_0x556bbc,'request\x20sent');logger[_0x4632('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x556bbc,_0x4632('0x14'),JSON[_0x4632('0x15')](_0xe28f38));if(_0xe28f38[_0x4632('0x16')]){if(_0xe28f38[_0x4632('0x16')]['code']===0x1f4){logger[_0x4632('0x16')](_0x4632('0x12'),_0x556bbc,_0xe28f38[_0x4632('0x16')][_0x4632('0x17')]);return _0x30a7cf(_0xe28f38[_0x4632('0x16')]['message']);}logger['error'](_0x4632('0x12'),_0x556bbc,_0xe28f38[_0x4632('0x16')][_0x4632('0x17')]);return _0x21999d(_0xe28f38[_0x4632('0x16')]['message']);}else{logger[_0x4632('0x11')](_0x4632('0x12'),_0x556bbc,_0x4632('0x14'));_0x21999d(_0xe28f38['result'][_0x4632('0x17')]);}})[_0x4632('0x18')](function(_0x58e193){logger['error'](_0x4632('0x12'),_0x556bbc,_0x58e193);_0x30a7cf(_0x58e193);});});}exports[_0x4632('0x19')]=function(_0x3bdced){var _0x3e3766=this;return new Promise(function(_0x2d63b1,_0x3d2d23){return db[_0x4632('0x1a')][_0x4632('0x1b')]({'raw':_0x3bdced[_0x4632('0x1c')]?_0x3bdced[_0x4632('0x1c')][_0x4632('0x1d')]===undefined?!![]:![]:!![],'where':_0x3bdced[_0x4632('0x1c')]?_0x3bdced[_0x4632('0x1c')][_0x4632('0x1e')]||null:null,'attributes':_0x3bdced[_0x4632('0x1c')]?_0x3bdced[_0x4632('0x1c')][_0x4632('0x1f')]||null:null,'limit':_0x3bdced[_0x4632('0x1c')]?_0x3bdced[_0x4632('0x1c')][_0x4632('0x20')]||null:null,'include':_0x3bdced[_0x4632('0x1c')]?_0x3bdced[_0x4632('0x1c')][_0x4632('0x21')]?_[_0x4632('0x22')](_0x3bdced[_0x4632('0x1c')][_0x4632('0x21')],function(_0x4af026){return{'model':db[_0x4af026[_0x4632('0x23')]],'as':_0x4af026['as'],'attributes':_0x4af026[_0x4632('0x1f')],'include':_0x4af026[_0x4632('0x21')]?_[_0x4632('0x22')](_0x4af026[_0x4632('0x21')],function(_0x438354){return{'model':db[_0x438354['model']],'as':_0x438354['as'],'attributes':_0x438354['attributes'],'include':_0x438354[_0x4632('0x21')]?_[_0x4632('0x22')](_0x438354[_0x4632('0x21')],function(_0x35a533){return{'model':db[_0x35a533[_0x4632('0x23')]],'as':_0x35a533['as'],'attributes':_0x35a533[_0x4632('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4632('0x10')](function(_0x5e2ee4){logger[_0x4632('0x11')](_0x4632('0x19'),_0x3bdced);logger['debug'](_0x4632('0x19'),_0x3bdced,JSON['stringify'](_0x5e2ee4));_0x2d63b1(_0x5e2ee4);})[_0x4632('0x18')](function(_0x4cb661){logger['error'](_0x4632('0x19'),_0x4cb661[_0x4632('0x17')],_0x3bdced);_0x3d2d23(_0x3e3766[_0x4632('0x16')](0x1f4,_0x4cb661['message']));});});};exports['ShowMailAccount']=function(_0x395f4e){var _0x7671ab=this;return new Promise(function(_0x596586,_0x4aab76){return db[_0x4632('0x1a')][_0x4632('0x24')]({'raw':_0x395f4e['options']?_0x395f4e[_0x4632('0x1c')][_0x4632('0x1d')]===undefined?!![]:![]:!![],'where':_0x395f4e[_0x4632('0x1c')]?_0x395f4e[_0x4632('0x1c')][_0x4632('0x1e')]||null:null,'attributes':_0x395f4e['options']?_0x395f4e[_0x4632('0x1c')][_0x4632('0x1f')]||null:null,'include':_0x395f4e['options']?_0x395f4e['options'][_0x4632('0x21')]?_['map'](_0x395f4e['options'][_0x4632('0x21')],function(_0x5d34ac){return{'model':db[_0x5d34ac[_0x4632('0x23')]],'as':_0x5d34ac['as'],'attributes':_0x5d34ac[_0x4632('0x1f')],'include':_0x5d34ac[_0x4632('0x21')]?_['map'](_0x5d34ac[_0x4632('0x21')],function(_0xf37b63){return{'model':db[_0xf37b63[_0x4632('0x23')]],'as':_0xf37b63['as'],'attributes':_0xf37b63[_0x4632('0x1f')],'include':_0xf37b63[_0x4632('0x21')]?_['map'](_0xf37b63['include'],function(_0x3114c4){return{'model':db[_0x3114c4[_0x4632('0x23')]],'as':_0x3114c4['as'],'attributes':_0x3114c4[_0x4632('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a3fb4){logger['info'](_0x4632('0x25'),_0x395f4e);logger[_0x4632('0x13')]('ShowMailAccount',_0x395f4e,JSON[_0x4632('0x15')](_0x5a3fb4));_0x596586(_0x5a3fb4);})[_0x4632('0x18')](function(_0x40452e){logger[_0x4632('0x16')](_0x4632('0x25'),_0x40452e[_0x4632('0x17')],_0x395f4e);_0x4aab76(_0x7671ab[_0x4632('0x16')](0x1f4,_0x40452e[_0x4632('0x17')]));});});};exports[_0x4632('0x26')]=function(_0x2c04a8){var _0x1fd3f1=this;return new Promise(function(_0x3b6258,_0x47f206){var _0x1c1418={'body':_0x2c04a8[_0x4632('0x27')],'channel':'mail'};var _0x19fdd0=_[_0x4632('0x28')](_['keys'](db[_0x4632('0x29')]['rawAttributes']),[_0x4632('0x2a'),_0x4632('0x2b'),_0x4632('0x2c'),_0x4632('0x2d')]);var _0x5b630a=![];if(_0x2c04a8[_0x4632('0x27')]['id']){delete _0x2c04a8[_0x4632('0x27')]['id'];}if(_[_0x4632('0x2e')](_0x2c04a8[_0x4632('0x27')]['from'])){return _0x47f206(_0x1fd3f1['error'](0x1f4,_0x4632('0x2f')));}if(_[_0x4632('0x2e')](_0x2c04a8[_0x4632('0x27')]['body'])||_0x2c04a8[_0x4632('0x27')][_0x4632('0x27')]===''){return _0x47f206(_0x1fd3f1[_0x4632('0x16')](0x1f4,_0x4632('0x30')));}if(_[_0x4632('0x2e')](_0x2c04a8[_0x4632('0x27')][_0x4632('0x31')])){return _0x47f206(_0x1fd3f1['error'](0x1f4,_0x4632('0x32')+_0x19fdd0));}if(!_[_0x4632('0x33')](_0x19fdd0,_0x2c04a8[_0x4632('0x27')][_0x4632('0x31')])){return _0x47f206(_0x1fd3f1[_0x4632('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x19fdd0));}var _0x579ed2={};_0x579ed2[_0x2c04a8[_0x4632('0x27')][_0x4632('0x31')]]=_0x2c04a8[_0x4632('0x27')][_0x4632('0x34')];return db['MailAccount'][_0x4632('0x24')]({'where':{'id':_0x2c04a8[_0x4632('0x35')]['id']},'include':[{'model':db[_0x4632('0x36')],'as':_0x4632('0x37'),'include':[{'model':db[_0x4632('0x29')],'as':'Contacts','where':_0x579ed2,'limit':0x1,'order':[[_0x4632('0x2b'),_0x4632('0x38')]]}]},{'model':db[_0x4632('0x39')],'as':_0x4632('0x3a')},{'model':db[_0x4632('0x3b')],'as':_0x4632('0x3c')}]})[_0x4632('0x10')](function(_0x1f02d5){if(_0x1f02d5&&_0x1f02d5[_0x4632('0x37')]){var _0x225bd2=_0x1f02d5[_0x4632('0x3d')]({'plain':!![]});_0x1c1418['account']=_[_0x4632('0x3e')](_0x225bd2,[_0x4632('0x3a'),_0x4632('0x37')]);_0x1c1418['applications']=_0x225bd2[_0x4632('0x3a')];_0x1c1418[_0x4632('0x3f')]=_0x225bd2[_0x4632('0x37')];_0x1c1418[_0x4632('0x40')]=_[_0x4632('0x41')](_0x1c1418[_0x4632('0x40')],[_0x4632('0x42')],[_0x4632('0x43')]);if(_0x1c1418[_0x4632('0x35')]&&_0x1c1418[_0x4632('0x35')]['autoclose']){_0x1c1418[_0x4632('0x40')][_0x4632('0x44')]({'id':0x0,'priority':_0x1c1418['applications'][_0x4632('0x45')]+0x1,'app':_0x4632('0x46'),'appdata':_0x4632('0x47'),'interval':_0x4632('0x48')});}if(_0x1c1418[_0x4632('0x35')][_0x4632('0x3a')]){delete _0x1c1418[_0x4632('0x35')][_0x4632('0x3a')];}if(_0x1c1418[_0x4632('0x35')][_0x4632('0x37')]){delete _0x1c1418[_0x4632('0x35')][_0x4632('0x37')];}if(_0x225bd2[_0x4632('0x37')][_0x4632('0x49')][_0x4632('0x45')]){return _0x225bd2[_0x4632('0x37')][_0x4632('0x49')][0x0];}var _0x6c2864=_[_0x4632('0x4a')](_0x2c04a8[_0x4632('0x27')],{'firstName':_0x2c04a8['body'][_0x4632('0x34')],'ListId':_0x225bd2[_0x4632('0x2d')]});_0x6c2864[_0x2c04a8[_0x4632('0x27')][_0x4632('0x31')]]=_0x2c04a8[_0x4632('0x27')][_0x4632('0x34')];return db['CmContact'][_0x4632('0x4b')](_0x6c2864);}else{throw new Error(_0x4632('0x4c'));}})[_0x4632('0x10')](function(_0x5877b9){_0x1c1418[_0x4632('0x4d')]=_0x5877b9;if(_0x5877b9){if(!_0x2c04a8[_0x4632('0x27')]['message'][_0x4632('0x4e')]){_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')]['messageId']=rs[_0x4632('0x4f')]()+'\x20'+_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x34')];}var _0x3e0811={'ContactId':_0x5877b9['id'],'MailAccountId':_0x2c04a8[_0x4632('0x35')]['id'],'inReplyTo':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x4e')],'to':_0x2c04a8[_0x4632('0x27')]['message'][_0x4632('0x34')],'cc':_0x2c04a8[_0x4632('0x27')]['message']['cc'],'subject':_0x2c04a8[_0x4632('0x27')]['message']['subject'],'attach':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x50')],'lastMsgAt':moment()[_0x4632('0x51')](_0x4632('0x52')),'lastMsgDirection':'in','lastMsgBody':_0x2c04a8[_0x4632('0x27')][_0x4632('0x27')]};return db[_0x4632('0x53')][_0x4632('0x24')]({'where':{'closed':![],'MailAccountId':_0x2c04a8[_0x4632('0x35')]['id']},'include':[{'model':db[_0x4632('0x54')],'as':_0x4632('0x55'),'attributes':[_0x4632('0x4e')],'where':{'messageId':_0x2c04a8[_0x4632('0x27')]['message']['inReplyTo']}}]})[_0x4632('0x10')](function(_0x313dcd){if(_0x313dcd){return[_0x313dcd,![]];}return db[_0x4632('0x53')][_0x4632('0x4b')](_0x3e0811)[_0x4632('0x10')](function(_0x29321c){return[_0x29321c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4632('0x56')](function(_0x211c9d,_0x4217ea){if(_0x211c9d){_0x5b630a=_0x4217ea;if(!_0x4217ea){return _0x211c9d[_0x4632('0x57')]({'inReplyTo':_0x2c04a8['body']['message'][_0x4632('0x4e')],'to':_0x2c04a8['body'][_0x4632('0x17')][_0x4632('0x34')],'cc':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')]['cc'],'subject':_0x2c04a8[_0x4632('0x27')]['message'][_0x4632('0x58')],'attach':_0x211c9d[_0x4632('0x50')]?_0x211c9d['attach']:_0x2c04a8['body'][_0x4632('0x17')][_0x4632('0x50')],'substatus':null,'substatusAt':moment()[_0x4632('0x51')](_0x4632('0x52')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x2c04a8['body'][_0x4632('0x27')]});}else{return _0x211c9d;}}})['then'](function(_0x3af9ec){_0x1c1418[_0x4632('0x59')]=_0x3af9ec[_0x4632('0x3d')]({'plain':!![]});_0x1c1418[_0x4632('0x59')][_0x4632('0x5a')]=_0x5b630a;return db[_0x4632('0x54')][_0x4632('0x4b')]({'body':_0x2c04a8[_0x4632('0x27')][_0x4632('0x27')],'MailAccountId':_0x2c04a8[_0x4632('0x35')]['id'],'MailInteractionId':_0x3af9ec['id'],'direction':'in','ContactId':_0x1c1418[_0x4632('0x4d')]['id'],'messageId':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x4e')],'from':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')]['from'],'to':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')]['to'],'cc':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')]['cc'],'subject':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x58')],'attach':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x50')],'Attachments':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x5b')],'originTo':_0x2c04a8['body'][_0x4632('0x17')][_0x4632('0x5c')],'originCc':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x5d')],'bcc':_0x2c04a8[_0x4632('0x27')]['message'][_0x4632('0x5e')]},{'include':[{'model':db[_0x4632('0x5f')],'as':'Attachments'}]});})[_0x4632('0x10')](function(_0x458688){_0x1c1418[_0x4632('0x17')]=_0x458688;if(_0x1c1418[_0x4632('0x59')][_0x4632('0x60')]){return db['User'][_0x4632('0x24')]({'attributes':['id',_0x4632('0x61')],'where':{'id':_0x1c1418[_0x4632('0x59')]['UserId']}})[_0x4632('0x10')](function(_0x400a95){if(_0x400a95){_0x1c1418[_0x4632('0x40')][_0x4632('0x62')]({'id':0x0,'priority':0x0,'app':_0x4632('0x63'),'appdata':_0x400a95[_0x4632('0x61')]+','+(_0x1c1418[_0x4632('0x35')][_0x4632('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4632('0x65'),_0x4632('0x66'),_0x1c1418);});}return respondWithRpcPromise(_0x4632('0x65'),'startRouting',_0x1c1418);})[_0x4632('0x10')](function(_0x2cadac){_0x3b6258(_0x2cadac);})['catch'](function(_0x4a4ae2){_0x47f206(_0x1fd3f1[_0x4632('0x16')](0x1f4,_0x4a4ae2[_0x4632('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 16a44e1..0be4400 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 _0x4ce6=['./mailAccount.events','remove','update','emit','length','mailAccount:'];(function(_0x2e1d9d,_0x486f05){var _0x443d25=function(_0x1e4bc0){while(--_0x1e4bc0){_0x2e1d9d['push'](_0x2e1d9d['shift']());}};_0x443d25(++_0x486f05);}(_0x4ce6,0x108));var _0x64ce=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x4ce6[_0x2c3255];return _0x282aba;};'use strict';var MailAccountEvents=require(_0x64ce('0x0'));var events=['save',_0x64ce('0x1'),_0x64ce('0x2')];function createListener(_0x3f9718,_0x11bca6){return function(_0x3f0983){_0x11bca6[_0x64ce('0x3')](_0x3f9718,_0x3f0983);};}function removeListener(_0x4a8899,_0x469aa){return function(){MailAccountEvents['removeListener'](_0x4a8899,_0x469aa);};}exports['register']=function(_0x31bc0f){for(var _0x262751=0x0,_0x5b8f2d=events[_0x64ce('0x4')];_0x262751<_0x5b8f2d;_0x262751++){var _0x3c279f=events[_0x262751];var _0x134230=createListener(_0x64ce('0x5')+_0x3c279f,_0x31bc0f);MailAccountEvents['on'](_0x3c279f,_0x134230);}}; \ No newline at end of file +var _0x5697=['remove','update','removeListener','length','mailAccount:','./mailAccount.events'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0x5697,0x1b5));var _0x7569=function(_0x4dc0c8,_0x48d51f){_0x4dc0c8=_0x4dc0c8-0x0;var _0x26bf81=_0x5697[_0x4dc0c8];return _0x26bf81;};'use strict';var MailAccountEvents=require(_0x7569('0x0'));var events=['save',_0x7569('0x1'),_0x7569('0x2')];function createListener(_0x14218a,_0x5c6bbc){return function(_0x5a06a6){_0x5c6bbc['emit'](_0x14218a,_0x5a06a6);};}function removeListener(_0x499e06,_0x48340f){return function(){MailAccountEvents[_0x7569('0x3')](_0x499e06,_0x48340f);};}exports['register']=function(_0x5705bd){for(var _0x5afe12=0x0,_0x149fa1=events[_0x7569('0x4')];_0x5afe12<_0x149fa1;_0x5afe12++){var _0x30b7e2=events[_0x5afe12];var _0xee5a4=createListener(_0x7569('0x5')+_0x30b7e2,_0x5705bd);MailAccountEvents['on'](_0x30b7e2,_0xee5a4);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 1c33415..855cac1 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 _0xb7e7=['delete','isAuthenticated','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','./mailApplication.controller','get','show','put','/:id','update'];(function(_0xee122e,_0x58ef2e){var _0x34f98a=function(_0x18163e){while(--_0x18163e){_0xee122e['push'](_0xee122e['shift']());}};_0x34f98a(++_0x58ef2e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xb7e7[_0x3305de];return _0x3b5a84;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);module[_0x7b7e('0xe')]=router; \ No newline at end of file +var _0xf45e=['put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x2b03ff,_0x4fcd84){var _0xa7d7a=function(_0x1bb2ca){while(--_0x1bb2ca){_0x2b03ff['push'](_0x2b03ff['shift']());}};_0xa7d7a(++_0x4fcd84);}(_0xf45e,0x115));var _0xef45=function(_0x20e84a,_0x495a8a){_0x20e84a=_0x20e84a-0x0;var _0x231de1=_0xf45e[_0x20e84a];return _0x231de1;};'use strict';var multer=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var timeout=require('connect-timeout');var express=require(_0xef45('0x2'));var router=express[_0xef45('0x3')]();var auth=require(_0xef45('0x4'));var interaction=require(_0xef45('0x5'));var config=require(_0xef45('0x6'));var controller=require(_0xef45('0x7'));router[_0xef45('0x8')](_0xef45('0x9'),auth[_0xef45('0xa')](),controller[_0xef45('0xb')]);router[_0xef45('0xc')](_0xef45('0x9'),auth[_0xef45('0xa')](),controller[_0xef45('0xd')]);router[_0xef45('0xe')](_0xef45('0x9'),auth[_0xef45('0xa')](),controller[_0xef45('0xf')]);module[_0xef45('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index cf5d83c..404a551 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 _0xad8c=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x338102,_0x1662d9){var _0xc22587=function(_0x5eaa97){while(--_0x5eaa97){_0x338102['push'](_0x338102['shift']());}};_0xc22587(++_0x1662d9);}(_0xad8c,0x1de));var _0xcad8=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0xad8c[_0x48c4ef];return _0x435715;};'use strict';var Sequelize=require(_0xcad8('0x0'));module[_0xcad8('0x1')]={'priority':{'type':Sequelize[_0xcad8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcad8('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xcad8('0x4')]()},'description':{'type':Sequelize[_0xcad8('0x3')]},'interval':{'type':Sequelize[_0xcad8('0x3')],'defaultValue':_0xcad8('0x5')}}; \ No newline at end of file +var _0x0b69=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x41c28f,_0x168c22){var _0xa6f925=function(_0x54ca66){while(--_0x54ca66){_0x41c28f['push'](_0x41c28f['shift']());}};_0xa6f925(++_0x168c22);}(_0x0b69,0x1d2));var _0x90b6=function(_0x28b3c8,_0x499ca8){_0x28b3c8=_0x28b3c8-0x0;var _0x1f6322=_0x0b69[_0x28b3c8];return _0x1f6322;};'use strict';var Sequelize=require(_0x90b6('0x0'));module[_0x90b6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x90b6('0x2')],'allowNull':![],'defaultValue':_0x90b6('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x90b6('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7e1e595..026fdf0 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 _0x697f=['name','send','show','model','keys','MailApplication','query','intersection','attributes','fields','length','includeAll','include','options','catch','body','find','params','html-pdf','rimraf','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','apply','reject','save','update','then','destroy','sendStatus','stack'];(function(_0x5659f4,_0x3a072a){var _0x18e9a5=function(_0x4816e1){while(--_0x4816e1){_0x5659f4['push'](_0x5659f4['shift']());}};_0x18e9a5(++_0x3a072a);}(_0x697f,0x1a2));var _0xf697=function(_0x15bacf,_0x24253f){_0x15bacf=_0x15bacf-0x0;var _0x576d15=_0x697f[_0x15bacf];return _0x576d15;};'use strict';var pdf=require(_0xf697('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf697('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf697('0x2'));var moment=require(_0xf697('0x3'));var BPromise=require(_0xf697('0x4'));var Mustache=require('mustache');var util=require(_0xf697('0x5'));var path=require('path');var sox=require(_0xf697('0x6'));var csv=require('to-csv');var ejs=require(_0xf697('0x7'));var fs=require('fs');var _=require(_0xf697('0x8'));var squel=require(_0xf697('0x9'));var crypto=require(_0xf697('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf697('0xb'));var toCsv=require(_0xf697('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf697('0xd'));var authService=require(_0xf697('0xe'));var qs=require(_0xf697('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf697('0x10'));var utils=require(_0xf697('0x11'));var config=require(_0xf697('0x12'));var db=require(_0xf697('0x13'))['db'];function respondWithStatusCode(_0x296155,_0x1f4c1d){_0x1f4c1d=_0x1f4c1d||0xcc;return function(_0xd0c065){if(_0xd0c065){return _0x296155['sendStatus'](_0x1f4c1d);}return _0x296155[_0xf697('0x14')](_0x1f4c1d)['end']();};}function respondWithResult(_0x5a5478,_0x2a7ae8){_0x2a7ae8=_0x2a7ae8||0xc8;return function(_0x25dd2e){if(_0x25dd2e){return _0x5a5478[_0xf697('0x14')](_0x2a7ae8)[_0xf697('0x15')](_0x25dd2e);}};}function respondWithFilteredResult(_0x5acfcd,_0x33bdb5){return function(_0x580668){if(_0x580668){var _0x33bd0e=_0x580668[_0xf697('0x16')],_0x3646c1=_0x33bdb5[_0xf697('0x17')],_0x4d33b9=_0x33bdb5['offset']+_0x33bdb5['limit'],_0x27304f;if(_0x4d33b9>=_0x33bd0e){_0x4d33b9=_0x33bd0e;_0x27304f=0xc8;}else{_0x27304f=0xce;}_0x5acfcd[_0xf697('0x14')](_0x27304f);return _0x5acfcd['set']('Content-Range',_0x3646c1+'-'+_0x4d33b9+'/'+_0x33bd0e)[_0xf697('0x15')](_0x580668);}return null;};}function patchUpdates(_0x1ff24c){return function(_0xee2fe6){try{jsonpatch[_0xf697('0x18')](_0xee2fe6,_0x1ff24c,!![]);}catch(_0x3bf246){return BPromise[_0xf697('0x19')](_0x3bf246);}return _0xee2fe6[_0xf697('0x1a')]();};}function saveUpdates(_0x385729,_0x348e26){return function(_0x3eccd1){if(_0x3eccd1){return _0x3eccd1[_0xf697('0x1b')](_0x385729)[_0xf697('0x1c')](function(_0x30cbf2){return _0x30cbf2;});}return null;};}function removeEntity(_0xd1eb06,_0xd92aca){return function(_0x50e37c){if(_0x50e37c){return _0x50e37c[_0xf697('0x1d')]()[_0xf697('0x1c')](function(){_0xd1eb06[_0xf697('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4da714,_0x2a7936){return function(_0x2b64a6){if(!_0x2b64a6){_0x4da714[_0xf697('0x1e')](0x194);}return _0x2b64a6;};}function handleError(_0x4ed358,_0x42c781){_0x42c781=_0x42c781||0x1f4;return function(_0x509f1c){logger['error'](_0x509f1c[_0xf697('0x1f')]);if(_0x509f1c[_0xf697('0x20')]){delete _0x509f1c[_0xf697('0x20')];}_0x4ed358[_0xf697('0x14')](_0x42c781)[_0xf697('0x21')](_0x509f1c);};}exports[_0xf697('0x22')]=function(_0x45ec1b,_0x59c581){var _0x321d88={'raw':!![],'where':{'id':_0x45ec1b['params']['id']}},_0x1690d5={};_0x1690d5[_0xf697('0x23')]=_[_0xf697('0x24')](db[_0xf697('0x25')]['rawAttributes']);_0x1690d5[_0xf697('0x26')]=_['keys'](_0x45ec1b[_0xf697('0x26')]);_0x1690d5['filters']=_[_0xf697('0x27')](_0x1690d5[_0xf697('0x23')],_0x1690d5[_0xf697('0x26')]);_0x321d88[_0xf697('0x28')]=_[_0xf697('0x27')](_0x1690d5[_0xf697('0x23')],qs[_0xf697('0x29')](_0x45ec1b[_0xf697('0x26')][_0xf697('0x29')]));_0x321d88[_0xf697('0x28')]=_0x321d88[_0xf697('0x28')][_0xf697('0x2a')]?_0x321d88['attributes']:_0x1690d5[_0xf697('0x23')];if(_0x45ec1b['query'][_0xf697('0x2b')]){_0x321d88[_0xf697('0x2c')]=[{'all':!![]}];}_0x321d88=_['merge']({},_0x321d88,_0x45ec1b[_0xf697('0x2d')]);return db[_0xf697('0x25')]['find'](_0x321d88)[_0xf697('0x1c')](handleEntityNotFound(_0x59c581,null))[_0xf697('0x1c')](respondWithResult(_0x59c581,null))[_0xf697('0x2e')](handleError(_0x59c581,null));};exports[_0xf697('0x1b')]=function(_0x237ecf,_0x408860){if(_0x237ecf[_0xf697('0x2f')]['id']){delete _0x237ecf[_0xf697('0x2f')]['id'];}return db['MailApplication'][_0xf697('0x30')]({'where':{'id':_0x237ecf[_0xf697('0x31')]['id']}})[_0xf697('0x1c')](handleEntityNotFound(_0x408860,null))[_0xf697('0x1c')](saveUpdates(_0x237ecf[_0xf697('0x2f')],null))[_0xf697('0x1c')](respondWithResult(_0x408860,null))['catch'](handleError(_0x408860,null));};exports[_0xf697('0x1d')]=function(_0x4a0f44,_0x4c3b4f){return db[_0xf697('0x25')][_0xf697('0x30')]({'where':{'id':_0x4a0f44[_0xf697('0x31')]['id']}})[_0xf697('0x1c')](handleEntityNotFound(_0x4c3b4f,null))[_0xf697('0x1c')](removeEntity(_0x4c3b4f,null))[_0xf697('0x2e')](handleError(_0x4c3b4f,null));}; \ No newline at end of file +var _0x8435=['model','MailApplication','rawAttributes','query','keys','filters','fields','length','attributes','merge','options','catch','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','show','params'];(function(_0x4608ac,_0x340cd9){var _0x318daa=function(_0x58c895){while(--_0x58c895){_0x4608ac['push'](_0x4608ac['shift']());}};_0x318daa(++_0x340cd9);}(_0x8435,0xf6));var _0x5843=function(_0x522416,_0x11b844){_0x522416=_0x522416-0x0;var _0x3ff1ba=_0x8435[_0x522416];return _0x3ff1ba;};'use strict';var pdf=require(_0x5843('0x0'));var emlformat=require(_0x5843('0x1'));var rimraf=require(_0x5843('0x2'));var zipdir=require(_0x5843('0x3'));var jsonpatch=require(_0x5843('0x4'));var rp=require(_0x5843('0x5'));var moment=require(_0x5843('0x6'));var BPromise=require(_0x5843('0x7'));var Mustache=require(_0x5843('0x8'));var util=require(_0x5843('0x9'));var path=require(_0x5843('0xa'));var sox=require(_0x5843('0xb'));var csv=require(_0x5843('0xc'));var ejs=require(_0x5843('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5843('0xe'));var crypto=require('crypto');var jsforce=require(_0x5843('0xf'));var deskjs=require(_0x5843('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5843('0x11'));var Papa=require(_0x5843('0x12'));var Redis=require(_0x5843('0x13'));var authService=require(_0x5843('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5843('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5843('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5843('0x17'));var db=require(_0x5843('0x18'))['db'];function respondWithStatusCode(_0x448a90,_0x19372a){_0x19372a=_0x19372a||0xcc;return function(_0x411586){if(_0x411586){return _0x448a90['sendStatus'](_0x19372a);}return _0x448a90[_0x5843('0x19')](_0x19372a)[_0x5843('0x1a')]();};}function respondWithResult(_0x25397a,_0x404c0a){_0x404c0a=_0x404c0a||0xc8;return function(_0x9587db){if(_0x9587db){return _0x25397a['status'](_0x404c0a)['json'](_0x9587db);}};}function respondWithFilteredResult(_0x53e0a8,_0x47e933){return function(_0x1b010c){if(_0x1b010c){var _0x7c7e59=_0x1b010c['count'],_0x14497a=_0x47e933[_0x5843('0x1b')],_0x464d6a=_0x47e933[_0x5843('0x1b')]+_0x47e933[_0x5843('0x1c')],_0x9376a7;if(_0x464d6a>=_0x7c7e59){_0x464d6a=_0x7c7e59;_0x9376a7=0xc8;}else{_0x9376a7=0xce;}_0x53e0a8['status'](_0x9376a7);return _0x53e0a8[_0x5843('0x1d')](_0x5843('0x1e'),_0x14497a+'-'+_0x464d6a+'/'+_0x7c7e59)[_0x5843('0x1f')](_0x1b010c);}return null;};}function patchUpdates(_0x3eca12){return function(_0x1625c7){try{jsonpatch[_0x5843('0x20')](_0x1625c7,_0x3eca12,!![]);}catch(_0x1b8006){return BPromise[_0x5843('0x21')](_0x1b8006);}return _0x1625c7[_0x5843('0x22')]();};}function saveUpdates(_0x5c0391,_0x21f0eb){return function(_0x1133fd){if(_0x1133fd){return _0x1133fd[_0x5843('0x23')](_0x5c0391)[_0x5843('0x24')](function(_0x3469fb){return _0x3469fb;});}return null;};}function removeEntity(_0x31f5ce,_0x54af41){return function(_0x5075f7){if(_0x5075f7){return _0x5075f7[_0x5843('0x25')]()[_0x5843('0x24')](function(){_0x31f5ce[_0x5843('0x19')](0xcc)[_0x5843('0x1a')]();});}};}function handleEntityNotFound(_0x56fb14,_0x188e90){return function(_0x243d40){if(!_0x243d40){_0x56fb14[_0x5843('0x26')](0x194);}return _0x243d40;};}function handleError(_0x1c078b,_0x509822){_0x509822=_0x509822||0x1f4;return function(_0x125e1b){logger['error'](_0x125e1b[_0x5843('0x27')]);if(_0x125e1b[_0x5843('0x28')]){delete _0x125e1b[_0x5843('0x28')];}_0x1c078b[_0x5843('0x19')](_0x509822)[_0x5843('0x29')](_0x125e1b);};}exports[_0x5843('0x2a')]=function(_0x2bfb73,_0x9ca66c){var _0x16814d={'raw':!![],'where':{'id':_0x2bfb73[_0x5843('0x2b')]['id']}},_0x23478a={};_0x23478a[_0x5843('0x2c')]=_['keys'](db[_0x5843('0x2d')][_0x5843('0x2e')]);_0x23478a[_0x5843('0x2f')]=_[_0x5843('0x30')](_0x2bfb73[_0x5843('0x2f')]);_0x23478a[_0x5843('0x31')]=_['intersection'](_0x23478a[_0x5843('0x2c')],_0x23478a[_0x5843('0x2f')]);_0x16814d['attributes']=_['intersection'](_0x23478a[_0x5843('0x2c')],qs[_0x5843('0x32')](_0x2bfb73[_0x5843('0x2f')][_0x5843('0x32')]));_0x16814d['attributes']=_0x16814d['attributes'][_0x5843('0x33')]?_0x16814d[_0x5843('0x34')]:_0x23478a['model'];if(_0x2bfb73[_0x5843('0x2f')]['includeAll']){_0x16814d['include']=[{'all':!![]}];}_0x16814d=_[_0x5843('0x35')]({},_0x16814d,_0x2bfb73[_0x5843('0x36')]);return db['MailApplication']['find'](_0x16814d)[_0x5843('0x24')](handleEntityNotFound(_0x9ca66c,null))[_0x5843('0x24')](respondWithResult(_0x9ca66c,null))[_0x5843('0x37')](handleError(_0x9ca66c,null));};exports[_0x5843('0x23')]=function(_0x295bf3,_0x46603f){if(_0x295bf3['body']['id']){delete _0x295bf3['body']['id'];}return db[_0x5843('0x2d')][_0x5843('0x38')]({'where':{'id':_0x295bf3[_0x5843('0x2b')]['id']}})[_0x5843('0x24')](handleEntityNotFound(_0x46603f,null))['then'](saveUpdates(_0x295bf3[_0x5843('0x39')],null))['then'](respondWithResult(_0x46603f,null))[_0x5843('0x37')](handleError(_0x46603f,null));};exports[_0x5843('0x25')]=function(_0x53d945,_0x429c9b){return db[_0x5843('0x2d')][_0x5843('0x38')]({'where':{'id':_0x53d945[_0x5843('0x2b')]['id']}})[_0x5843('0x24')](handleEntityNotFound(_0x429c9b,null))[_0x5843('0x24')](removeEntity(_0x429c9b,null))[_0x5843('0x37')](handleError(_0x429c9b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index fb3d669..c84c53f 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 _0x348e=['bluebird','request-promise','path','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x6ed469,_0x4b92b8){var _0x5f22d6=function(_0x161ffb){while(--_0x161ffb){_0x6ed469['push'](_0x6ed469['shift']());}};_0x5f22d6(++_0x4b92b8);}(_0x348e,0xdb));var _0xe348=function(_0x17d900,_0x5d1514){_0x17d900=_0x17d900-0x0;var _0x355db8=_0x348e[_0x17d900];return _0x355db8;};'use strict';var _=require(_0xe348('0x0'));var util=require(_0xe348('0x1'));var logger=require(_0xe348('0x2'))(_0xe348('0x3'));var moment=require(_0xe348('0x4'));var BPromise=require(_0xe348('0x5'));var rp=require(_0xe348('0x6'));var fs=require('fs');var path=require(_0xe348('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe348('0x8'));module['exports']=function(_0x1249bf,_0x514ee9){return _0x1249bf[_0xe348('0x9')](_0xe348('0xa'),attributes,{'tableName':_0xe348('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe348('0xc'),'collate':_0xe348('0xd')});}; \ No newline at end of file +var _0x8410=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','mail_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x2e6dd7,_0x27e160){var _0x584987=function(_0x4abc27){while(--_0x4abc27){_0x2e6dd7['push'](_0x2e6dd7['shift']());}};_0x584987(++_0x27e160);}(_0x8410,0xba));var _0x0841=function(_0x2f70de,_0xb36df7){_0x2f70de=_0x2f70de-0x0;var _0x3cdf30=_0x8410[_0x2f70de];return _0x3cdf30;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0841('0x0'))('api');var moment=require(_0x0841('0x1'));var BPromise=require(_0x0841('0x2'));var rp=require(_0x0841('0x3'));var fs=require('fs');var path=require(_0x0841('0x4'));var rimraf=require(_0x0841('0x5'));var config=require(_0x0841('0x6'));var attributes=require(_0x0841('0x7'));module['exports']=function(_0x2544cb,_0x271e9f){return _0x2544cb['define']('MailApplication',attributes,{'tableName':_0x0841('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0841('0x9'),'collate':_0x0841('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 8ba2ff5..62df53f 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 _0xec80=['update','options','where','attributes','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','UpdateMailApplication','MailApplication'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xec80,0x8c));var _0x0ec8=function(_0x300768,_0x515b0c){_0x300768=_0x300768-0x0;var _0x27bb75=_0xec80[_0x300768];return _0x27bb75;};'use strict';var _=require(_0x0ec8('0x0'));var util=require(_0x0ec8('0x1'));var moment=require(_0x0ec8('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ec8('0x3'));var fs=require('fs');var Redis=require(_0x0ec8('0x4'));var db=require(_0x0ec8('0x5'))['db'];var utils=require(_0x0ec8('0x6'));var logger=require('../../config/logger')(_0x0ec8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ec8('0x8')][_0x0ec8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38cd4f,_0x1e6ad3,_0x2173c3){return new BPromise(function(_0x796557,_0x5ccde8){return client[_0x0ec8('0xa')](_0x38cd4f,_0x2173c3)[_0x0ec8('0xb')](function(_0xec37f4){logger[_0x0ec8('0xc')](_0x0ec8('0xd'),_0x1e6ad3,'request\x20sent');logger[_0x0ec8('0xe')](_0x0ec8('0xf'),_0x1e6ad3,'request\x20sent',JSON['stringify'](_0xec37f4));if(_0xec37f4[_0x0ec8('0x10')]){if(_0xec37f4[_0x0ec8('0x10')]['code']===0x1f4){logger[_0x0ec8('0x10')](_0x0ec8('0xd'),_0x1e6ad3,_0xec37f4['error'][_0x0ec8('0x11')]);return _0x5ccde8(_0xec37f4['error'][_0x0ec8('0x11')]);}logger[_0x0ec8('0x10')](_0x0ec8('0xd'),_0x1e6ad3,_0xec37f4[_0x0ec8('0x10')][_0x0ec8('0x11')]);return _0x796557(_0xec37f4[_0x0ec8('0x10')][_0x0ec8('0x11')]);}else{logger[_0x0ec8('0xc')](_0x0ec8('0xd'),_0x1e6ad3,_0x0ec8('0x12'));_0x796557(_0xec37f4[_0x0ec8('0x13')]['message']);}})['catch'](function(_0x4a85ee){logger[_0x0ec8('0x10')](_0x0ec8('0xd'),_0x1e6ad3,_0x4a85ee);_0x5ccde8(_0x4a85ee);});});}exports[_0x0ec8('0x14')]=function(_0x2d7cc3){var _0x4f4b08=this;return new Promise(function(_0x234aa9,_0x565641){return db[_0x0ec8('0x15')][_0x0ec8('0x16')](_0x2d7cc3['body'],{'raw':_0x2d7cc3[_0x0ec8('0x17')]?_0x2d7cc3[_0x0ec8('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d7cc3['options']?_0x2d7cc3[_0x0ec8('0x17')][_0x0ec8('0x18')]||null:null,'attributes':_0x2d7cc3['options']?_0x2d7cc3[_0x0ec8('0x17')][_0x0ec8('0x19')]||null:null,'limit':_0x2d7cc3[_0x0ec8('0x17')]?_0x2d7cc3['options']['limit']||null:null})[_0x0ec8('0xb')](function(_0x578f92){logger[_0x0ec8('0xc')](_0x0ec8('0x14'),_0x2d7cc3);logger[_0x0ec8('0xe')](_0x0ec8('0x14'),_0x2d7cc3,JSON[_0x0ec8('0x1a')](_0x578f92));_0x234aa9(_0x578f92);})['catch'](function(_0x3de495){logger[_0x0ec8('0x10')]('UpdateMailApplication',_0x3de495[_0x0ec8('0x11')],_0x2d7cc3);_0x565641(_0x4f4b08[_0x0ec8('0x10')](0x1f4,_0x3de495['message']));});});}; \ No newline at end of file +var _0xe028=['UpdateMailApplication','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','update','body','options','raw','where','attributes','limit'];(function(_0x24d560,_0x2e0e7b){var _0x18f7b3=function(_0x564a93){while(--_0x564a93){_0x24d560['push'](_0x24d560['shift']());}};_0x18f7b3(++_0x2e0e7b);}(_0xe028,0x1f1));var _0x8e02=function(_0x319f82,_0x388a6f){_0x319f82=_0x319f82-0x0;var _0x22065d=_0xe028[_0x319f82];return _0x22065d;};'use strict';var _=require(_0x8e02('0x0'));var util=require(_0x8e02('0x1'));var moment=require(_0x8e02('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e02('0x3'));var fs=require('fs');var Redis=require(_0x8e02('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e02('0x5'));var logger=require(_0x8e02('0x6'))(_0x8e02('0x7'));var config=require(_0x8e02('0x8'));var jayson=require(_0x8e02('0x9'));var client=jayson[_0x8e02('0xa')][_0x8e02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x65aa85,_0x11b945,_0x4aa556){return new BPromise(function(_0x2ffed9,_0x3c2d36){return client['request'](_0x65aa85,_0x4aa556)[_0x8e02('0xc')](function(_0x380b4c){logger[_0x8e02('0xd')](_0x8e02('0xe'),_0x11b945,'request\x20sent');logger[_0x8e02('0xf')](_0x8e02('0x10'),_0x11b945,_0x8e02('0x11'),JSON[_0x8e02('0x12')](_0x380b4c));if(_0x380b4c[_0x8e02('0x13')]){if(_0x380b4c[_0x8e02('0x13')][_0x8e02('0x14')]===0x1f4){logger[_0x8e02('0x13')](_0x8e02('0xe'),_0x11b945,_0x380b4c[_0x8e02('0x13')]['message']);return _0x3c2d36(_0x380b4c[_0x8e02('0x13')][_0x8e02('0x15')]);}logger[_0x8e02('0x13')](_0x8e02('0xe'),_0x11b945,_0x380b4c[_0x8e02('0x13')]['message']);return _0x2ffed9(_0x380b4c[_0x8e02('0x13')][_0x8e02('0x15')]);}else{logger[_0x8e02('0xd')](_0x8e02('0xe'),_0x11b945,_0x8e02('0x11'));_0x2ffed9(_0x380b4c['result'][_0x8e02('0x15')]);}})[_0x8e02('0x16')](function(_0x51ce47){logger[_0x8e02('0x13')](_0x8e02('0xe'),_0x11b945,_0x51ce47);_0x3c2d36(_0x51ce47);});});}exports['UpdateMailApplication']=function(_0x330aa8){var _0xf1ea63=this;return new Promise(function(_0x2b1f91,_0x352ad5){return db['MailApplication'][_0x8e02('0x17')](_0x330aa8[_0x8e02('0x18')],{'raw':_0x330aa8[_0x8e02('0x19')]?_0x330aa8['options'][_0x8e02('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x330aa8[_0x8e02('0x19')]?_0x330aa8['options'][_0x8e02('0x1b')]||null:null,'attributes':_0x330aa8['options']?_0x330aa8[_0x8e02('0x19')][_0x8e02('0x1c')]||null:null,'limit':_0x330aa8[_0x8e02('0x19')]?_0x330aa8[_0x8e02('0x19')][_0x8e02('0x1d')]||null:null})[_0x8e02('0xc')](function(_0x452578){logger['info'](_0x8e02('0x1e'),_0x330aa8);logger[_0x8e02('0xf')](_0x8e02('0x1e'),_0x330aa8,JSON[_0x8e02('0x12')](_0x452578));_0x2b1f91(_0x452578);})['catch'](function(_0x232695){logger[_0x8e02('0x13')](_0x8e02('0x1e'),_0x232695[_0x8e02('0x15')],_0x330aa8);_0x352ad5(_0xf1ea63[_0x8e02('0x13')](0x1f4,_0x232695[_0x8e02('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 3029236..923fdac 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 _0xa17b=['../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','put','mailinteraction:update','update','delete','/:id','mailinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0xe2d875,_0x447ae5){var _0x1030ad=function(_0x5368af){while(--_0x5368af){_0xe2d875['push'](_0xe2d875['shift']());}};_0x1030ad(++_0x447ae5);}(_0xa17b,0xbf));var _0xba17=function(_0x59c93e,_0x16b91c){_0x59c93e=_0x59c93e-0x0;var _0x487f72=_0xa17b[_0x59c93e];return _0x487f72;};'use strict';var multer=require(_0xba17('0x0'));var util=require(_0xba17('0x1'));var path=require(_0xba17('0x2'));var timeout=require(_0xba17('0x3'));var express=require(_0xba17('0x4'));var router=express['Router']();var auth=require(_0xba17('0x5'));var interaction=require(_0xba17('0x6'));var config=require(_0xba17('0x7'));var controller=require(_0xba17('0x8'));router[_0xba17('0x9')]('/',auth[_0xba17('0xa')](),controller[_0xba17('0xb')]);router[_0xba17('0x9')](_0xba17('0xc'),auth[_0xba17('0xa')](),controller[_0xba17('0xd')]);router[_0xba17('0x9')]('/:id',auth[_0xba17('0xa')](),controller['show']);router[_0xba17('0x9')](_0xba17('0xe'),auth[_0xba17('0xa')](),controller[_0xba17('0xf')]);router['get'](_0xba17('0x10'),auth[_0xba17('0xa')](),controller[_0xba17('0x11')]);router[_0xba17('0x12')]('/',auth[_0xba17('0xa')](),controller[_0xba17('0x13')]);router['post'](_0xba17('0xe'),auth[_0xba17('0xa')](),controller[_0xba17('0x14')]);router[_0xba17('0x12')](_0xba17('0x15'),auth['isAuthenticated'](),interaction[_0xba17('0x16')](_0xba17('0x17'),'mailinteraction:addtags'),controller['addTags']);router[_0xba17('0x18')]('/:id',auth[_0xba17('0xa')](),interaction[_0xba17('0x16')](_0xba17('0x17'),_0xba17('0x19')),controller[_0xba17('0x1a')]);router[_0xba17('0x1b')](_0xba17('0x1c'),auth[_0xba17('0xa')](),interaction[_0xba17('0x16')](_0xba17('0x17'),_0xba17('0x1d')),controller[_0xba17('0x1e')]);router[_0xba17('0x1b')](_0xba17('0x15'),auth[_0xba17('0xa')](),controller[_0xba17('0x1f')]);module[_0xba17('0x20')]=router; \ No newline at end of file +var _0x4af3=['describe','show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','mail','mailinteraction:addtags','addTags','/:id','tracked','update','delete','mailinteraction:destroy','removeTags','exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x2cb6d3,_0xad38c5){var _0x276b6f=function(_0x1ecfb7){while(--_0x1ecfb7){_0x2cb6d3['push'](_0x2cb6d3['shift']());}};_0x276b6f(++_0xad38c5);}(_0x4af3,0x118));var _0x34af=function(_0x44b249,_0x5b4811){_0x44b249=_0x44b249-0x0;var _0x23b853=_0x4af3[_0x44b249];return _0x23b853;};'use strict';var multer=require('multer');var util=require(_0x34af('0x0'));var path=require(_0x34af('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x34af('0x2'));var interaction=require(_0x34af('0x3'));var config=require(_0x34af('0x4'));var controller=require(_0x34af('0x5'));router[_0x34af('0x6')]('/',auth[_0x34af('0x7')](),controller[_0x34af('0x8')]);router['get'](_0x34af('0x9'),auth[_0x34af('0x7')](),controller[_0x34af('0xa')]);router[_0x34af('0x6')]('/:id',auth[_0x34af('0x7')](),controller[_0x34af('0xb')]);router[_0x34af('0x6')]('/:id/messages',auth['isAuthenticated'](),controller[_0x34af('0xc')]);router[_0x34af('0x6')](_0x34af('0xd'),auth['isAuthenticated'](),controller[_0x34af('0xe')]);router[_0x34af('0xf')]('/',auth[_0x34af('0x7')](),controller[_0x34af('0x10')]);router[_0x34af('0xf')](_0x34af('0x11'),auth[_0x34af('0x7')](),controller['addMessage']);router[_0x34af('0xf')](_0x34af('0x12'),auth['isAuthenticated'](),interaction['tracked'](_0x34af('0x13'),_0x34af('0x14')),controller[_0x34af('0x15')]);router['put'](_0x34af('0x16'),auth[_0x34af('0x7')](),interaction[_0x34af('0x17')](_0x34af('0x13'),'mailinteraction:update'),controller[_0x34af('0x18')]);router[_0x34af('0x19')]('/:id',auth[_0x34af('0x7')](),interaction['tracked'](_0x34af('0x13'),_0x34af('0x1a')),controller['destroy']);router[_0x34af('0x19')](_0x34af('0x12'),auth[_0x34af('0x7')](),controller[_0x34af('0x1b')]);module[_0x34af('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 31a9fa0..8e9860c 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 _0x6fbd=['BOOLEAN','DATE','STRING','TEXT','long','out','ENUM','sequelize','iconv','exports'];(function(_0x289fd4,_0xd34ba6){var _0x3d4a88=function(_0x2a3726){while(--_0x2a3726){_0x289fd4['push'](_0x289fd4['shift']());}};_0x3d4a88(++_0xd34ba6);}(_0x6fbd,0x1f1));var _0xd6fb=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x6fbd[_0x2c0be1];return _0x3d4bd2;};'use strict';var Sequelize=require(_0xd6fb('0x0'));var iconv=require(_0xd6fb('0x1'));module[_0xd6fb('0x2')]={'closed':{'type':Sequelize[_0xd6fb('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd6fb('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd6fb('0x5')]},'inReplyTo':{'type':Sequelize[_0xd6fb('0x5')](0x1fe)},'to':{'type':Sequelize[_0xd6fb('0x5')]},'cc':{'type':Sequelize[_0xd6fb('0x6')](_0xd6fb('0x7'))},'subject':{'type':Sequelize[_0xd6fb('0x6')]()},'attach':{'type':Sequelize[_0xd6fb('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd6fb('0x4')]},'substatus':{'type':Sequelize[_0xd6fb('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xd6fb('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd6fb('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd6fb('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd6fb('0x9')]('in',_0xd6fb('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xd6fb('0x6')](_0xd6fb('0x7'))},'lastMsgText':{'type':Sequelize['TEXT'](_0xd6fb('0x7'))}}; \ No newline at end of file +var _0xec9f=['DATE','STRING','TEXT','long','out','sequelize','iconv','exports','BOOLEAN'];(function(_0x302345,_0x5c1151){var _0x57c7fd=function(_0x4ddb7a){while(--_0x4ddb7a){_0x302345['push'](_0x302345['shift']());}};_0x57c7fd(++_0x5c1151);}(_0xec9f,0xf8));var _0xfec9=function(_0x4a19ba,_0x3db590){_0x4a19ba=_0x4a19ba-0x0;var _0x3b72d6=_0xec9f[_0x4a19ba];return _0x3b72d6;};'use strict';var Sequelize=require(_0xfec9('0x0'));var iconv=require(_0xfec9('0x1'));module[_0xfec9('0x2')]={'closed':{'type':Sequelize[_0xfec9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfec9('0x4')]},'disposition':{'type':Sequelize[_0xfec9('0x5')]},'note':{'type':Sequelize[_0xfec9('0x5')]},'inReplyTo':{'type':Sequelize[_0xfec9('0x5')](0x1fe)},'to':{'type':Sequelize[_0xfec9('0x5')]},'cc':{'type':Sequelize[_0xfec9('0x6')](_0xfec9('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xfec9('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xfec9('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xfec9('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xfec9('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xfec9('0x6')](_0xfec9('0x7'))},'lastMsgText':{'type':Sequelize[_0xfec9('0x6')](_0xfec9('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 3cc1249..b39cc1a 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x1365b9,_0x582215){var _0x385dce=function(_0x6e3361){while(--_0x6e3361){_0x1365b9['push'](_0x1365b9['shift']());}};_0x385dce(++_0x582215);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file +var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x2a3146,_0xfc02bd){var _0x368b73=function(_0x1006c7){while(--_0x1006c7){_0x2a3146['push'](_0x2a3146['shift']());}};_0x368b73(++_0xfc02bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index ef64082..7cb80ac 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 _0x1dff=['MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x397f34,_0x3ac328){var _0x272cda=function(_0x2c9756){while(--_0x2c9756){_0x397f34['push'](_0x397f34['shift']());}};_0x272cda(++_0x3ac328);}(_0x1dff,0x1b9));var _0xf1df=function(_0x80544e,_0x37a3f3){_0x80544e=_0x80544e-0x0;var _0x4f9b90=_0x1dff[_0x80544e];return _0x4f9b90;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xf1df('0x0'))['db'][_0xf1df('0x1')];var MailMessage=require(_0xf1df('0x0'))['db'][_0xf1df('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf1df('0x3')](0x0);var events={'afterCreate':_0xf1df('0x4'),'afterUpdate':_0xf1df('0x5'),'afterDestroy':_0xf1df('0x6')};function emitEvent(_0x431113){return function(_0x1833cf,_0xd41bf3,_0xdf4a77){_0x1833cf[_0xf1df('0x7')]({'attributes':['id'],'raw':!![]})[_0xf1df('0x8')](function(_0x121c5c){_0x1833cf[_0xf1df('0x9')]('Users',_0x121c5c[_0xf1df('0xa')](function(_0x19f6d4){return{'id':_0x19f6d4['id']};}));return MailMessage[_0xf1df('0xb')]({'where':{'MailInteractionId':_0x1833cf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf1df('0x8')](function(_0x2316ce){_0x1833cf['setDataValue'](_0xf1df('0xc'),_0x2316ce['length']);MailInteractionEvents[_0xf1df('0xd')](_0x431113+':'+_0x1833cf['id'],_0x1833cf);MailInteractionEvents[_0xf1df('0xd')](_0x431113,_0x1833cf);_0xdf4a77(null);})['catch'](_0xdf4a77(null));};}for(var e in events){if(events[_0xf1df('0xe')](e)){var event=events[e];MailInteraction[_0xf1df('0xf')](e,emitEvent(event));}}module[_0xf1df('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x524d=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hook','../../mysqldb','MailMessage','setMaxListeners','update'];(function(_0x448f23,_0x62556f){var _0x545300=function(_0x24e4af){while(--_0x24e4af){_0x448f23['push'](_0x448f23['shift']());}};_0x545300(++_0x62556f);}(_0x524d,0x6c));var _0xd524=function(_0x381cef,_0x129a87){_0x381cef=_0x381cef-0x0;var _0x256226=_0x524d[_0x381cef];return _0x256226;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xd524('0x0'))['db'][_0xd524('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd524('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd524('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5b0d0c){return function(_0x5b71dd,_0x112622,_0x384fec){_0x5b71dd[_0xd524('0x4')]({'attributes':['id'],'raw':!![]})[_0xd524('0x5')](function(_0x2d61fd){_0x5b71dd[_0xd524('0x6')](_0xd524('0x7'),_0x2d61fd[_0xd524('0x8')](function(_0x27461f){return{'id':_0x27461f['id']};}));return MailMessage[_0xd524('0x9')]({'where':{'MailInteractionId':_0x5b71dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd524('0x5')](function(_0x4fbb00){_0x5b71dd[_0xd524('0x6')](_0xd524('0xa'),_0x4fbb00['length']);MailInteractionEvents[_0xd524('0xb')](_0x5b0d0c+':'+_0x5b71dd['id'],_0x5b71dd);MailInteractionEvents['emit'](_0x5b0d0c,_0x5b71dd);_0x384fec(null);})[_0xd524('0xc')](_0x384fec(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xd524('0xd')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index a5109d2..5afb0e5 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 _0x008c=['then','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','subject','YYYY-MM-DD\x20HH:mm:ss','closed','format','changed','substatus','closedAt','models','update'];(function(_0x42dd25,_0x2da102){var _0x3a7854=function(_0x4bbbc6){while(--_0x4bbbc6){_0x42dd25['push'](_0x42dd25['shift']());}};_0x3a7854(++_0x2da102);}(_0x008c,0x188));var _0xc008=function(_0x27a45e,_0x556bb4){_0x27a45e=_0x27a45e-0x0;var _0x1fca64=_0x008c[_0x27a45e];return _0x1fca64;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('MailInteraction',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xc008('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x52041f,_0x27830d,_0x7231b4){if(_0x52041f['substatus']){_0x52041f['substatusAt']=moment()['format'](_0xc008('0xe'));}if(_0x52041f[_0xc008('0xf')]){_0x52041f['closedAt']=moment()[_0xc008('0x10')](_0xc008('0xe'));}_0x7231b4(null,_0x27830d);},'beforeUpdate':function(_0x2ea200,_0x2a5b4e,_0x9ffa93){if(_0x2ea200[_0xc008('0x11')](_0xc008('0x12'))){_0x2ea200['substatusAt']=_0x2ea200['substatus']?moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2ea200[_0xc008('0x11')](_0xc008('0xf'))){_0x2ea200[_0xc008('0x13')]=moment()[_0xc008('0x10')](_0xc008('0xe'));_0x2ea200['substatus']=null;_0x2ea200['substatusAt']=null;}_0x9ffa93(null,_0x2ea200);},'afterUpdate':function(_0x4bd0f4,_0x11ef38,_0x15a6ad){var _0x3cafe3=_0x13aa7[_0xc008('0x14')];var _0x4fe771=_0x4bd0f4['get']({'plain':!![]});if(_0x4fe771['closed']){return _0x3cafe3['MailMessage'][_0xc008('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x4fe771['id']}})[_0xc008('0x16')](function(){_0x15a6ad();})['catch'](function(_0x813397){_0x15a6ad(_0x813397);});}else{_0x15a6ad();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3e74=['changed','substatus','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','closed','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3e74,0x175));var _0x43e7=function(_0x2ce1ac,_0x4246bd){_0x2ce1ac=_0x2ce1ac-0x0;var _0xe4b4ed=_0x3e74[_0x2ce1ac];return _0xe4b4ed;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[{'name':_0x43e7('0xa'),'fields':[_0x43e7('0xb'),'to'],'type':_0x43e7('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x516b4d,_0x212c6c,_0x554d44){if(_0x516b4d['substatus']){_0x516b4d[_0x43e7('0xd')]=moment()[_0x43e7('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x516b4d[_0x43e7('0xf')]){_0x516b4d['closedAt']=moment()[_0x43e7('0xe')](_0x43e7('0x10'));}_0x554d44(null,_0x212c6c);},'beforeUpdate':function(_0x4ebc8e,_0x3eb206,_0xc960ea){if(_0x4ebc8e[_0x43e7('0x11')](_0x43e7('0x12'))){_0x4ebc8e['substatusAt']=_0x4ebc8e['substatus']?moment()[_0x43e7('0xe')](_0x43e7('0x10')):null;}if(_0x4ebc8e[_0x43e7('0x11')]('closed')){_0x4ebc8e['closedAt']=moment()[_0x43e7('0xe')](_0x43e7('0x10'));_0x4ebc8e[_0x43e7('0x12')]=null;_0x4ebc8e[_0x43e7('0xd')]=null;}_0xc960ea(null,_0x4ebc8e);},'afterUpdate':function(_0x4de324,_0x5c4eaa,_0xdf16c){var _0x264575=_0x1c503b[_0x43e7('0x13')];var _0x5d346f=_0x4de324['get']({'plain':!![]});if(_0x5d346f[_0x43e7('0xf')]){return _0x264575[_0x43e7('0x14')][_0x43e7('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x5d346f['id']}})[_0x43e7('0x16')](function(){_0xdf16c();})[_0x43e7('0x17')](function(_0x1f24fb){_0xdf16c(_0x1f24fb);});}else{_0xdf16c();}}},'charset':_0x43e7('0x18'),'collate':_0x43e7('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 1155229..58299ef 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 _0xffe1=['omit','body','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','options','raw','attributes','limit','stringify','find','where','addTags','ids'];(function(_0xa1dcbd,_0x39a535){var _0x5a20dc=function(_0x33c40f){while(--_0x33c40f){_0xa1dcbd['push'](_0xa1dcbd['shift']());}};_0x5a20dc(++_0x39a535);}(_0xffe1,0x175));var _0x1ffe=function(_0x39cf6a,_0x35314c){_0x39cf6a=_0x39cf6a-0x0;var _0x1249c9=_0xffe1[_0x39cf6a];return _0x1249c9;};'use strict';var _=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1ffe('0x2'));var fs=require('fs');var Redis=require(_0x1ffe('0x3'));var db=require(_0x1ffe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ffe('0x5'))(_0x1ffe('0x6'));var config=require(_0x1ffe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1ffe('0x8')][_0x1ffe('0x9')]({'port':0x232a});config[_0x1ffe('0xa')]=_[_0x1ffe('0xb')](config[_0x1ffe('0xa')],{'host':_0x1ffe('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1ffe('0xd'))[_0x1ffe('0xe')](socket);function respondWithRpcPromise(_0x4774a8,_0x1cc54d,_0x558992){return new BPromise(function(_0x415a78,_0x29ef39){return client[_0x1ffe('0xf')](_0x4774a8,_0x558992)[_0x1ffe('0x10')](function(_0x2c48c3){logger[_0x1ffe('0x11')](_0x1ffe('0x12'),_0x1cc54d,_0x1ffe('0x13'));logger['debug'](_0x1ffe('0x14'),_0x1cc54d,_0x1ffe('0x13'),JSON['stringify'](_0x2c48c3));if(_0x2c48c3[_0x1ffe('0x15')]){if(_0x2c48c3[_0x1ffe('0x15')][_0x1ffe('0x16')]===0x1f4){logger[_0x1ffe('0x15')](_0x1ffe('0x12'),_0x1cc54d,_0x2c48c3['error'][_0x1ffe('0x17')]);return _0x29ef39(_0x2c48c3[_0x1ffe('0x15')][_0x1ffe('0x17')]);}logger['error'](_0x1ffe('0x12'),_0x1cc54d,_0x2c48c3['error'][_0x1ffe('0x17')]);return _0x415a78(_0x2c48c3['error'][_0x1ffe('0x17')]);}else{logger[_0x1ffe('0x11')]('MailInteraction,\x20%s,\x20%s',_0x1cc54d,'request\x20sent');_0x415a78(_0x2c48c3['result'][_0x1ffe('0x17')]);}})[_0x1ffe('0x18')](function(_0x129865){logger[_0x1ffe('0x15')](_0x1ffe('0x12'),_0x1cc54d,_0x129865);_0x29ef39(_0x129865);});});}exports[_0x1ffe('0x19')]=function(_0x3b23b1){var _0x1c87f7=this;return new Promise(function(_0x399106,_0x38f189){return db[_0x1ffe('0x1a')][_0x1ffe('0x1b')](_0x3b23b1['body'],{'raw':_0x3b23b1['options']?_0x3b23b1[_0x1ffe('0x1c')][_0x1ffe('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b23b1[_0x1ffe('0x1c')]?_0x3b23b1['options']['where']||null:null,'attributes':_0x3b23b1[_0x1ffe('0x1c')]?_0x3b23b1[_0x1ffe('0x1c')][_0x1ffe('0x1e')]||null:null,'limit':_0x3b23b1['options']?_0x3b23b1[_0x1ffe('0x1c')][_0x1ffe('0x1f')]||null:null})[_0x1ffe('0x10')](function(_0x3df636){logger[_0x1ffe('0x11')](_0x1ffe('0x19'),_0x3b23b1);logger['debug'](_0x1ffe('0x19'),_0x3b23b1,JSON[_0x1ffe('0x20')](_0x3df636));_0x399106(_0x3df636);})[_0x1ffe('0x18')](function(_0x34e9e6){logger[_0x1ffe('0x15')](_0x1ffe('0x19'),_0x34e9e6[_0x1ffe('0x17')],_0x3b23b1);_0x38f189(_0x1c87f7['error'](0x1f4,_0x34e9e6['message']));});});};exports['AddTagsToMailInteraction']=function(_0x2550e5){return new Promise(function(_0x56ef11,_0x33b011){return db[_0x1ffe('0x1a')][_0x1ffe('0x21')]({'where':_0x2550e5['options']?_0x2550e5[_0x1ffe('0x1c')][_0x1ffe('0x22')]||null:null})[_0x1ffe('0x10')](function(_0x3c95a0){if(_0x3c95a0){return _0x3c95a0[_0x1ffe('0x23')](_0x2550e5['body'][_0x1ffe('0x24')],_[_0x1ffe('0x25')](_0x2550e5[_0x1ffe('0x26')],[_0x1ffe('0x24'),'id'])||{});}})[_0x1ffe('0x27')](function(_0x1c369a){logger['info'](_0x1ffe('0x28'),_0x2550e5);logger['debug'](_0x1ffe('0x28'),_0x2550e5,JSON[_0x1ffe('0x20')](_0x1c369a));_0x56ef11(_0x1c369a);})[_0x1ffe('0x18')](function(_0x22e814){logger[_0x1ffe('0x15')]('AddTags',_0x22e814['message'],_0x2550e5);_0x33b011(_this[_0x1ffe('0x15')](0x1f4,_0x22e814['message']));});});}; \ No newline at end of file +var _0xd5b6=['./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x5ad820,_0x955136){var _0x1969d3=function(_0x156309){while(--_0x156309){_0x5ad820['push'](_0x5ad820['shift']());}};_0x1969d3(++_0x955136);}(_0xd5b6,0x73));var _0x6d5b=function(_0x5371a3,_0x3eb5b7){_0x5371a3=_0x5371a3-0x0;var _0x444f23=_0xd5b6[_0x5371a3];return _0x444f23;};'use strict';var _=require(_0x6d5b('0x0'));var util=require(_0x6d5b('0x1'));var moment=require(_0x6d5b('0x2'));var BPromise=require(_0x6d5b('0x3'));var rs=require(_0x6d5b('0x4'));var fs=require('fs');var Redis=require(_0x6d5b('0x5'));var db=require(_0x6d5b('0x6'))['db'];var utils=require(_0x6d5b('0x7'));var logger=require('../../config/logger')(_0x6d5b('0x8'));var config=require(_0x6d5b('0x9'));var jayson=require(_0x6d5b('0xa'));var client=jayson['client'][_0x6d5b('0xb')]({'port':0x232a});config[_0x6d5b('0xc')]=_[_0x6d5b('0xd')](config[_0x6d5b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d5b('0xc')]));require(_0x6d5b('0xe'))[_0x6d5b('0xf')](socket);function respondWithRpcPromise(_0xee20ae,_0x79d24,_0x3c4e93){return new BPromise(function(_0x47314e,_0x391450){return client[_0x6d5b('0x10')](_0xee20ae,_0x3c4e93)[_0x6d5b('0x11')](function(_0x354f5c){logger[_0x6d5b('0x12')](_0x6d5b('0x13'),_0x79d24,_0x6d5b('0x14'));logger[_0x6d5b('0x15')](_0x6d5b('0x16'),_0x79d24,_0x6d5b('0x14'),JSON[_0x6d5b('0x17')](_0x354f5c));if(_0x354f5c['error']){if(_0x354f5c[_0x6d5b('0x18')][_0x6d5b('0x19')]===0x1f4){logger[_0x6d5b('0x18')](_0x6d5b('0x13'),_0x79d24,_0x354f5c[_0x6d5b('0x18')]['message']);return _0x391450(_0x354f5c[_0x6d5b('0x18')][_0x6d5b('0x1a')]);}logger['error'](_0x6d5b('0x13'),_0x79d24,_0x354f5c['error'][_0x6d5b('0x1a')]);return _0x47314e(_0x354f5c['error']['message']);}else{logger['info'](_0x6d5b('0x13'),_0x79d24,_0x6d5b('0x14'));_0x47314e(_0x354f5c[_0x6d5b('0x1b')]['message']);}})[_0x6d5b('0x1c')](function(_0x25f8cc){logger[_0x6d5b('0x18')]('MailInteraction,\x20%s,\x20%s',_0x79d24,_0x25f8cc);_0x391450(_0x25f8cc);});});}exports[_0x6d5b('0x1d')]=function(_0x485c2d){var _0x40348a=this;return new Promise(function(_0x2e1ecf,_0x26b175){return db['MailInteraction'][_0x6d5b('0x1e')](_0x485c2d[_0x6d5b('0x1f')],{'raw':_0x485c2d[_0x6d5b('0x20')]?_0x485c2d[_0x6d5b('0x20')][_0x6d5b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x485c2d[_0x6d5b('0x20')]?_0x485c2d[_0x6d5b('0x20')][_0x6d5b('0x22')]||null:null,'attributes':_0x485c2d[_0x6d5b('0x20')]?_0x485c2d[_0x6d5b('0x20')][_0x6d5b('0x23')]||null:null,'limit':_0x485c2d[_0x6d5b('0x20')]?_0x485c2d[_0x6d5b('0x20')][_0x6d5b('0x24')]||null:null})['then'](function(_0x38efa7){logger['info'](_0x6d5b('0x1d'),_0x485c2d);logger[_0x6d5b('0x15')](_0x6d5b('0x1d'),_0x485c2d,JSON[_0x6d5b('0x17')](_0x38efa7));_0x2e1ecf(_0x38efa7);})[_0x6d5b('0x1c')](function(_0x161c12){logger[_0x6d5b('0x18')](_0x6d5b('0x1d'),_0x161c12[_0x6d5b('0x1a')],_0x485c2d);_0x26b175(_0x40348a[_0x6d5b('0x18')](0x1f4,_0x161c12[_0x6d5b('0x1a')]));});});};exports[_0x6d5b('0x25')]=function(_0x202ec2){return new Promise(function(_0x5dd460,_0x597e06){return db['MailInteraction'][_0x6d5b('0x26')]({'where':_0x202ec2[_0x6d5b('0x20')]?_0x202ec2[_0x6d5b('0x20')]['where']||null:null})[_0x6d5b('0x11')](function(_0x3e2ecc){if(_0x3e2ecc){return _0x3e2ecc['addTags'](_0x202ec2['body'][_0x6d5b('0x27')],_[_0x6d5b('0x28')](_0x202ec2[_0x6d5b('0x1f')],[_0x6d5b('0x27'),'id'])||{});}})[_0x6d5b('0x29')](function(_0x555317){logger['info'](_0x6d5b('0x2a'),_0x202ec2);logger['debug'](_0x6d5b('0x2a'),_0x202ec2,JSON[_0x6d5b('0x17')](_0x555317));_0x5dd460(_0x555317);})[_0x6d5b('0x1c')](function(_0x2185b4){logger[_0x6d5b('0x18')](_0x6d5b('0x2a'),_0x2185b4[_0x6d5b('0x1a')],_0x202ec2);_0x597e06(_this[_0x6d5b('0x18')](0x1f4,_0x2185b4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 4eb14dc..2cec376 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 _0xfc91=['register','length','mailInteraction:','./mailInteraction.events','save','remove','emit'];(function(_0x42a17b,_0x4d0b45){var _0x6d4203=function(_0x2be00d){while(--_0x2be00d){_0x42a17b['push'](_0x42a17b['shift']());}};_0x6d4203(++_0x4d0b45);}(_0xfc91,0xc7));var _0x1fc9=function(_0x5725c7,_0x263d29){_0x5725c7=_0x5725c7-0x0;var _0x4bb926=_0xfc91[_0x5725c7];return _0x4bb926;};'use strict';var MailInteractionEvents=require(_0x1fc9('0x0'));var events=[_0x1fc9('0x1'),_0x1fc9('0x2'),'update'];function createListener(_0x78ab14,_0x5c94e9){return function(_0x28328f){_0x5c94e9[_0x1fc9('0x3')](_0x78ab14,_0x28328f);};}function removeListener(_0x40bab1,_0x26251c){return function(){MailInteractionEvents['removeListener'](_0x40bab1,_0x26251c);};}exports[_0x1fc9('0x4')]=function(_0x2f7d26){for(var _0x4d379e=0x0,_0x4f0aa3=events[_0x1fc9('0x5')];_0x4d379e<_0x4f0aa3;_0x4d379e++){var _0x2e33ae=events[_0x4d379e];var _0x2450ef=createListener(_0x1fc9('0x6')+_0x2e33ae,_0x2f7d26);MailInteractionEvents['on'](_0x2e33ae,_0x2450ef);}}; \ No newline at end of file +var _0x1680=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','remove'];(function(_0xbf9ef4,_0x575b09){var _0x28dcec=function(_0x4cb117){while(--_0x4cb117){_0xbf9ef4['push'](_0xbf9ef4['shift']());}};_0x28dcec(++_0x575b09);}(_0x1680,0x76));var _0x0168=function(_0x54d5ba,_0x1f1ba9){_0x54d5ba=_0x54d5ba-0x0;var _0x6a592e=_0x1680[_0x54d5ba];return _0x6a592e;};'use strict';var MailInteractionEvents=require(_0x0168('0x0'));var events=['save',_0x0168('0x1'),_0x0168('0x2')];function createListener(_0x3fcf69,_0x468b0d){return function(_0x398108){_0x468b0d[_0x0168('0x3')](_0x3fcf69,_0x398108);};}function removeListener(_0x71c03f,_0x4307f8){return function(){MailInteractionEvents[_0x0168('0x4')](_0x71c03f,_0x4307f8);};}exports[_0x0168('0x5')]=function(_0x45cabd){for(var _0x4ba76a=0x0,_0x37159c=events[_0x0168('0x6')];_0x4ba76a<_0x37159c;_0x4ba76a++){var _0x5abf59=events[_0x4ba76a];var _0x33d329=createListener(_0x0168('0x7')+_0x5abf59,_0x45cabd);MailInteractionEvents['on'](_0x5abf59,_0x33d329);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 783d6dd..8caf19c 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 _0x84ab=['reject','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x42fbdd,_0xbb21a3){var _0x525b95=function(_0x330481){while(--_0x330481){_0x42fbdd['push'](_0x42fbdd['shift']());}};_0x525b95(++_0xbb21a3);}(_0x84ab,0x12f));var _0xb84a=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x84ab[_0x489b87];return _0x1823b6;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var auth=require(_0xb84a('0x5'));var interaction=require(_0xb84a('0x6'));var config=require('../../config/environment');var controller=require(_0xb84a('0x7'));router[_0xb84a('0x8')]('/',auth[_0xb84a('0x9')](),controller['index']);router['get']('/describe',auth[_0xb84a('0x9')](),controller['describe']);router[_0xb84a('0x8')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router['get'](_0xb84a('0xc'),auth[_0xb84a('0x9')](),controller[_0xb84a('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xb84a('0xe'),_0xb84a('0xf')),controller[_0xb84a('0x10')]);router[_0xb84a('0x11')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0x12')]);router[_0xb84a('0x11')](_0xb84a('0x13'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x14')]);router[_0xb84a('0x11')](_0xb84a('0x15'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x16')]);router[_0xb84a('0x17')](_0xb84a('0xa'),auth[_0xb84a('0x9')](),controller['destroy']);module[_0xb84a('0x18')]=router; \ No newline at end of file +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(_0x240107,_0x4cb5ed){var _0x161508=function(_0x3b9dbd){while(--_0x3b9dbd){_0x240107['push'](_0x240107['shift']());}};_0x161508(++_0x4cb5ed);}(_0xbec5,0xe5));var _0x5bec=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0xbec5[_0x213518];return _0x1baf75;};'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 diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index f6899a4..c1fb013 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 _0xa848=['long','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','sequelize','lodash','exports'];(function(_0xf9cc69,_0x2163ba){var _0x8d9bc7=function(_0x3e080a){while(--_0x3e080a){_0xf9cc69['push'](_0xf9cc69['shift']());}};_0x8d9bc7(++_0x2163ba);}(_0xa848,0x99));var _0x8a84=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa848[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x8a84('0x0'));var _=require(_0x8a84('0x1'));module[_0x8a84('0x2')]={'body':{'type':Sequelize['TEXT'](_0x8a84('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8a84('0x4')](_0x8a84('0x5'))},'read':{'type':Sequelize[_0x8a84('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8a84('0x7')]('in',_0x8a84('0x8')),'defaultValue':_0x8a84('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8a84('0x9')](0x1fe)},'from':{'type':Sequelize[_0x8a84('0x9')]},'to':{'type':Sequelize[_0x8a84('0x4')](_0x8a84('0x3'))},'cc':{'type':Sequelize[_0x8a84('0x4')](_0x8a84('0x3'))},'bcc':{'type':Sequelize[_0x8a84('0x4')]('long')},'subject':{'type':Sequelize[_0x8a84('0x4')]},'sentAt':{'type':Sequelize[_0x8a84('0xa')]},'attach':{'type':Sequelize[_0x8a84('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x8a84('0xa')]},'originTo':{'type':Sequelize[_0x8a84('0x4')](_0x8a84('0x3'))},'originCc':{'type':Sequelize[_0x8a84('0x4')](_0x8a84('0x3'))}}; \ No newline at end of file +var _0x28f2=['long','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','lodash','exports','TEXT'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x28f2,0x193));var _0x228f=function(_0x1179ed,_0x3be897){_0x1179ed=_0x1179ed-0x0;var _0x281b79=_0x28f2[_0x1179ed];return _0x281b79;};'use strict';var Sequelize=require(_0x228f('0x0'));var _=require(_0x228f('0x1'));module[_0x228f('0x2')]={'body':{'type':Sequelize[_0x228f('0x3')](_0x228f('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x228f('0x5'))},'read':{'type':Sequelize[_0x228f('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x228f('0x7')]('in',_0x228f('0x8')),'defaultValue':_0x228f('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x228f('0x9')](0x1fe)},'from':{'type':Sequelize[_0x228f('0x9')]},'to':{'type':Sequelize['TEXT'](_0x228f('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x228f('0x4'))},'bcc':{'type':Sequelize[_0x228f('0x3')](_0x228f('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x228f('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x228f('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x228f('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0x228f('0x4'))},'originCc':{'type':Sequelize[_0x228f('0x3')](_0x228f('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index cd1cd89..b0c3c04 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 _0x6dd1=['type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','merge','where','count','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','options','update','body','params','find','describe','direction','out','secret','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','host','port','secure','authentication','user','pass','service','auth','attachments','root','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','mail','read','readAt','format','UserId','MailInteraction','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','manual','interface','event','accept','EventManager','acceptmessage','../../config/logger','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','SIP/%s','channel','rejectmessage','download','unix','toString','server','files','message-%s.eml','from','bcc','subject','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','join','existsSync','push','readFileSync','writeFileSync','log','err','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','http','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','offset','limit','set','json','apply','reject','save','end','stack','name','send','index','MailMessage'];(function(_0x24783e,_0x48f578){var _0x143b90=function(_0x28daac){while(--_0x28daac){_0x24783e['push'](_0x24783e['shift']());}};_0x143b90(++_0x48f578);}(_0x6dd1,0x111));var _0x16dd=function(_0x577f1a,_0x400939){_0x577f1a=_0x577f1a-0x0;var _0x3ef82f=_0x6dd1[_0x577f1a];return _0x3ef82f;};'use strict';var pdf=require(_0x16dd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x16dd('0x1'));var zipdir=require(_0x16dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16dd('0x3'));var moment=require(_0x16dd('0x4'));var BPromise=require(_0x16dd('0x5'));var Mustache=require(_0x16dd('0x6'));var util=require(_0x16dd('0x7'));var path=require(_0x16dd('0x8'));var sox=require(_0x16dd('0x9'));var csv=require(_0x16dd('0xa'));var ejs=require(_0x16dd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x16dd('0xc'));var toCsv=require(_0x16dd('0xa'));var querystring=require(_0x16dd('0xd'));var Papa=require(_0x16dd('0xe'));var Redis=require('ioredis');var authService=require(_0x16dd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x16dd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x16dd('0x11'));var utils=require(_0x16dd('0x12'));var config=require('../../config/environment');var db=require(_0x16dd('0x13'))['db'];config[_0x16dd('0x14')]=_[_0x16dd('0x15')](config['redis'],{'host':_0x16dd('0x16'),'port':0x18eb});var socket=require(_0x16dd('0x17'))(new Redis(config[_0x16dd('0x14')]));require(_0x16dd('0x18'))[_0x16dd('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x16dd('0x1a')]({'port':0x232c});var client9003=jayson['client'][_0x16dd('0x1a')]({'port':0x232b});var client9002=jayson[_0x16dd('0x1b')][_0x16dd('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1719ba,_0x3add51,_0x25817d){if(_0x25817d){var _0x17a646=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x17a646[_0x16dd('0x1c')](_0x3add51)){return _0x1719ba;}else{throw new db['Sequelize'][(_0x16dd('0x1d'))](_0x16dd('0x1e'));}}else{return _0x1719ba;}}function respondWithRpcPromise(_0x15b012,_0x1f171a,_0x3e9236,_0x59fab3){return new BPromise(function(_0x1dcb48,_0x2fb27c){var _0x3f36c0=_0x59fab3||client;return _0x3f36c0[_0x16dd('0x1f')](_0x15b012,_0x3e9236)[_0x16dd('0x20')](function(_0x2c0bd8){logger[_0x16dd('0x21')](_0x16dd('0x22'),_0x1f171a,_0x16dd('0x23'));logger[_0x16dd('0x24')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x1f171a,_0x16dd('0x23'),JSON[_0x16dd('0x25')](_0x2c0bd8));if(_0x2c0bd8[_0x16dd('0x26')]){if(_0x2c0bd8[_0x16dd('0x26')][_0x16dd('0x27')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x1f171a,_0x2c0bd8[_0x16dd('0x26')][_0x16dd('0x28')]);return _0x2fb27c(_0x2c0bd8['error'][_0x16dd('0x28')]);}logger[_0x16dd('0x26')](_0x16dd('0x22'),_0x1f171a,_0x2c0bd8['error'][_0x16dd('0x28')]);return _0x1dcb48(_0x2c0bd8[_0x16dd('0x26')][_0x16dd('0x28')]);}else{logger['info'](_0x16dd('0x22'),_0x1f171a,_0x16dd('0x23'));_0x1dcb48(_0x2c0bd8[_0x16dd('0x29')]['message']);}})['catch'](function(_0x2dace6){logger[_0x16dd('0x26')]('MailMessage,\x20%s,\x20%s',_0x1f171a,_0x2dace6);_0x2fb27c(_0x2dace6);});});}function respondWithStatusCode(_0x4ab0fb,_0x511816){_0x511816=_0x511816||0xcc;return function(_0x2329fe){if(_0x2329fe){return _0x4ab0fb[_0x16dd('0x2a')](_0x511816);}return _0x4ab0fb[_0x16dd('0x2b')](_0x511816)['end']();};}function respondWithResult(_0x455b1d,_0xb5e868){_0xb5e868=_0xb5e868||0xc8;return function(_0x33af6f){if(_0x33af6f){return _0x455b1d[_0x16dd('0x2b')](_0xb5e868)['json'](_0x33af6f);}};}function respondWithFilteredResult(_0x134d7e,_0x2057e4){return function(_0x4ca886){if(_0x4ca886){var _0x1d9e3e=_0x4ca886['count'],_0x28f033=_0x2057e4[_0x16dd('0x2c')],_0x4ba4a1=_0x2057e4['offset']+_0x2057e4[_0x16dd('0x2d')],_0x46ff2e;if(_0x4ba4a1>=_0x1d9e3e){_0x4ba4a1=_0x1d9e3e;_0x46ff2e=0xc8;}else{_0x46ff2e=0xce;}_0x134d7e[_0x16dd('0x2b')](_0x46ff2e);return _0x134d7e[_0x16dd('0x2e')]('Content-Range',_0x28f033+'-'+_0x4ba4a1+'/'+_0x1d9e3e)[_0x16dd('0x2f')](_0x4ca886);}return null;};}function patchUpdates(_0x2bbcb4){return function(_0x49bc0c){try{jsonpatch[_0x16dd('0x30')](_0x49bc0c,_0x2bbcb4,!![]);}catch(_0x3fe7f1){return BPromise[_0x16dd('0x31')](_0x3fe7f1);}return _0x49bc0c[_0x16dd('0x32')]();};}function saveUpdates(_0x51d8fa,_0x361f40){return function(_0x101916){if(_0x101916){return _0x101916['update'](_0x51d8fa)[_0x16dd('0x20')](function(_0x53694d){return _0x53694d;});}return null;};}function removeEntity(_0xa04fee,_0x3128b1){return function(_0x4af652){if(_0x4af652){return _0x4af652['destroy']()[_0x16dd('0x20')](function(){_0xa04fee[_0x16dd('0x2b')](0xcc)[_0x16dd('0x33')]();});}};}function handleEntityNotFound(_0x2a09ec,_0x2134d2){return function(_0x7edb3f){if(!_0x7edb3f){_0x2a09ec[_0x16dd('0x2a')](0x194);}return _0x7edb3f;};}function handleError(_0x2bbed9,_0x12c14e){_0x12c14e=_0x12c14e||0x1f4;return function(_0x58ce74){logger[_0x16dd('0x26')](_0x58ce74[_0x16dd('0x34')]);if(_0x58ce74[_0x16dd('0x35')]){delete _0x58ce74['name'];}_0x2bbed9[_0x16dd('0x2b')](_0x12c14e)[_0x16dd('0x36')](_0x58ce74);};}exports[_0x16dd('0x37')]=function(_0x1f19bb,_0x4f1465){var _0x4e34a4={},_0x58a2cd={},_0x4c4788={'count':0x0,'rows':[]};var _0x11b826=_['map'](db[_0x16dd('0x38')]['rawAttributes'],function(_0x43dbdc){return{'name':_0x43dbdc['fieldName'],'type':_0x43dbdc[_0x16dd('0x39')][_0x16dd('0x3a')]};});_0x58a2cd[_0x16dd('0x3b')]=_[_0x16dd('0x3c')](_0x11b826,_0x16dd('0x35'));_0x58a2cd[_0x16dd('0x3d')]=_['keys'](_0x1f19bb[_0x16dd('0x3d')]);_0x58a2cd[_0x16dd('0x3e')]=_[_0x16dd('0x3f')](_0x58a2cd[_0x16dd('0x3b')],_0x58a2cd[_0x16dd('0x3d')]);_0x4e34a4[_0x16dd('0x40')]=_['intersection'](_0x58a2cd['model'],qs[_0x16dd('0x41')](_0x1f19bb['query']['fields']));_0x4e34a4[_0x16dd('0x40')]=_0x4e34a4[_0x16dd('0x40')][_0x16dd('0x42')]?_0x4e34a4[_0x16dd('0x40')]:_0x58a2cd[_0x16dd('0x3b')];if(!_0x1f19bb['query']['hasOwnProperty'](_0x16dd('0x43'))){_0x4e34a4[_0x16dd('0x2d')]=qs[_0x16dd('0x2d')](_0x1f19bb[_0x16dd('0x3d')][_0x16dd('0x2d')]);_0x4e34a4[_0x16dd('0x2c')]=qs[_0x16dd('0x2c')](_0x1f19bb[_0x16dd('0x3d')][_0x16dd('0x2c')]);}_0x4e34a4[_0x16dd('0x44')]=qs[_0x16dd('0x45')](_0x1f19bb[_0x16dd('0x3d')][_0x16dd('0x45')]);_0x4e34a4['where']=qs['filters'](_['pick'](_0x1f19bb[_0x16dd('0x3d')],_0x58a2cd[_0x16dd('0x3e')]),_0x11b826);if(_0x1f19bb[_0x16dd('0x3d')][_0x16dd('0x46')]){_0x4e34a4['where']=_[_0x16dd('0x47')](_0x4e34a4[_0x16dd('0x48')],{'$or':_[_0x16dd('0x3c')](_0x11b826,function(_0x1694ce){if(_0x1694ce[_0x16dd('0x39')]!=='VIRTUAL'){var _0x1ff461={};_0x1ff461[_0x1694ce[_0x16dd('0x35')]]={'$like':'%'+_0x1f19bb[_0x16dd('0x3d')][_0x16dd('0x46')]+'%'};return _0x1ff461;}})});}_0x4e34a4=_[_0x16dd('0x47')]({},_0x4e34a4,_0x1f19bb['options']);var _0x53258b={'where':_0x4e34a4[_0x16dd('0x48')]};return db['MailMessage']['count'](_0x53258b)[_0x16dd('0x20')](function(_0x305cb5){_0x4c4788[_0x16dd('0x49')]=_0x305cb5;if(_0x1f19bb['query'][_0x16dd('0x4a')]){_0x4e34a4[_0x16dd('0x4b')]=[{'all':!![]}];}return db[_0x16dd('0x38')][_0x16dd('0x4c')](_0x4e34a4);})[_0x16dd('0x20')](function(_0x6a6b5e){_0x4c4788[_0x16dd('0x4d')]=_0x6a6b5e;return _0x4c4788;})[_0x16dd('0x20')](respondWithFilteredResult(_0x4f1465,_0x4e34a4))[_0x16dd('0x4e')](handleError(_0x4f1465,null));};exports[_0x16dd('0x4f')]=function(_0x14c6e5,_0x316d85){var _0x33f878={'raw':!![],'where':{'id':_0x14c6e5['params']['id']}},_0x454aae={};_0x454aae[_0x16dd('0x3b')]=_['keys'](db['MailMessage'][_0x16dd('0x50')]);_0x454aae[_0x16dd('0x3d')]=_[_0x16dd('0x51')](_0x14c6e5[_0x16dd('0x3d')]);_0x454aae['filters']=_[_0x16dd('0x3f')](_0x454aae[_0x16dd('0x3b')],_0x454aae[_0x16dd('0x3d')]);_0x33f878[_0x16dd('0x40')]=_['intersection'](_0x454aae[_0x16dd('0x3b')],qs['fields'](_0x14c6e5[_0x16dd('0x3d')][_0x16dd('0x41')]));_0x33f878[_0x16dd('0x40')]=_0x33f878[_0x16dd('0x40')]['length']?_0x33f878[_0x16dd('0x40')]:_0x454aae[_0x16dd('0x3b')];if(_0x14c6e5[_0x16dd('0x3d')]['includeAll']){_0x33f878[_0x16dd('0x4b')]=[{'all':!![]}];}_0x33f878=_['merge']({},_0x33f878,_0x14c6e5[_0x16dd('0x52')]);return db[_0x16dd('0x38')]['find'](_0x33f878)[_0x16dd('0x20')](handleEntityNotFound(_0x316d85,null))[_0x16dd('0x20')](respondWithResult(_0x316d85,null))[_0x16dd('0x4e')](handleError(_0x316d85,null));};exports[_0x16dd('0x53')]=function(_0x2f6f0c,_0x39df48){if(_0x2f6f0c['body']['id']){delete _0x2f6f0c[_0x16dd('0x54')]['id'];}return db[_0x16dd('0x38')]['find']({'where':{'id':_0x2f6f0c[_0x16dd('0x55')]['id']}})['then'](handleEntityNotFound(_0x39df48,null))['then'](saveUpdates(_0x2f6f0c[_0x16dd('0x54')],null))[_0x16dd('0x20')](respondWithResult(_0x39df48,null))[_0x16dd('0x4e')](handleError(_0x39df48,null));};exports['destroy']=function(_0x450f39,_0x9b195c){return db[_0x16dd('0x38')][_0x16dd('0x56')]({'where':{'id':_0x450f39[_0x16dd('0x55')]['id']}})['then'](handleEntityNotFound(_0x9b195c,null))[_0x16dd('0x20')](removeEntity(_0x9b195c,null))['catch'](handleError(_0x9b195c,null));};exports['describe']=function(_0x40865b,_0x10be1b){return db[_0x16dd('0x38')][_0x16dd('0x57')]()[_0x16dd('0x20')](respondWithResult(_0x10be1b,null))[_0x16dd('0x4e')](handleError(_0x10be1b,null));};exports['create']=function(_0x5845eb,_0x582acf){return db[_0x16dd('0x38')]['create'](_0x5845eb[_0x16dd('0x54')])['then'](function(_0xece166){if(_0xece166){if(_0xece166[_0x16dd('0x58')]===_0x16dd('0x59')&&!_0xece166[_0x16dd('0x5a')]){var _0x78ebef,_0x48d552,_0x5c6317;if(_0x5845eb[_0x16dd('0x54')]['to']){_0x48d552=_0x5845eb[_0x16dd('0x54')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x16dd('0x5b')]({'where':{'id':_0xece166[_0x16dd('0x5c')]},'include':[{'model':db[_0x16dd('0x5d')],'as':_0x16dd('0x5e'),'include':[{'model':db[_0x16dd('0x5f')],'as':_0x16dd('0x60'),'where':{'email':_0x48d552},'limit':0x1,'order':[[_0x16dd('0x61'),_0x16dd('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x16dd('0x63'),'raw':!![]}]})[_0x16dd('0x20')](function(_0x3e5a05){_0x78ebef=_0x3e5a05;if(_0x78ebef&&_0x78ebef[_0x16dd('0x63')]){var _0x24e79f={'tls':{'rejectUnauthorized':![]}};if(_[_0x16dd('0x64')](_0x78ebef[_0x16dd('0x63')]['service'])){_0x24e79f[_0x16dd('0x65')]=_0x78ebef[_0x16dd('0x63')][_0x16dd('0x65')];_0x24e79f[_0x16dd('0x66')]=_0x78ebef[_0x16dd('0x63')][_0x16dd('0x66')];_0x24e79f[_0x16dd('0x67')]=_0x78ebef['Smtp'][_0x16dd('0x67')];if(_0x78ebef[_0x16dd('0x63')][_0x16dd('0x68')]){_0x24e79f['auth']={'user':_0x78ebef[_0x16dd('0x63')][_0x16dd('0x69')],'pass':_0x78ebef['Smtp'][_0x16dd('0x6a')]};}}else{_0x24e79f[_0x16dd('0x6b')]=_0x78ebef[_0x16dd('0x63')][_0x16dd('0x6b')];_0x24e79f[_0x16dd('0x6c')]={'user':_0x78ebef[_0x16dd('0x63')][_0x16dd('0x69')],'pass':_0x78ebef[_0x16dd('0x63')][_0x16dd('0x6a')]};_0x24e79f[_0x16dd('0x67')]=_0x78ebef['Smtp'][_0x16dd('0x67')];}if(_0x5845eb[_0x16dd('0x54')]['attachments']&&_0x5845eb[_0x16dd('0x54')][_0x16dd('0x6d')][_0x16dd('0x42')]){for(var _0x177c6=0x0;_0x177c6<_0x5845eb[_0x16dd('0x54')][_0x16dd('0x6d')]['length'];_0x177c6+=0x1){_0x5845eb[_0x16dd('0x54')][_0x16dd('0x6d')][_0x177c6]={'filename':_0x5845eb[_0x16dd('0x54')][_0x16dd('0x6d')][_0x177c6][_0x16dd('0x35')],'path':path['join'](config[_0x16dd('0x6e')],_0x16dd('0x6f'),_0x5845eb[_0x16dd('0x54')][_0x16dd('0x6d')][_0x177c6][_0x16dd('0x70')])};}}_0x5c6317={'account':_0x24e79f,'message':_0x5845eb['body']};return;}})[_0x16dd('0x20')](function(){if(_0x78ebef[_0x16dd('0x5e')]){if(_0x78ebef[_0x16dd('0x5e')][_0x16dd('0x60')]['length']){return _0x78ebef[_0x16dd('0x5e')][_0x16dd('0x60')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x5845eb[_0x16dd('0x54')],{'firstName':_0x5845eb['body']['to'],'email':_0x5845eb['body']['to'],'phone':_0x5845eb['body']['to'],'ListId':_0x78ebef['ListId']}));}}else{throw new Error(_0x16dd('0x71'));}})[_0x16dd('0x20')](function(){if(_0x5c6317){return respondWithRpcPromise(_0x16dd('0x72'),_0x16dd('0x73'),_0x5c6317,client9003)[_0x16dd('0x20')](function(_0x173e02){return _0xece166['update']({'read':!![],'messageId':_0x173e02[_0x16dd('0x74')],'sentAt':moment()['format'](_0x16dd('0x75'))});})['catch'](function(_0x1f1a87){logger[_0x16dd('0x26')]('%s',JSON[_0x16dd('0x25')](_0x1f1a87));return _0xece166;});}return _0xece166;});}return _0xece166;}})['then'](respondWithResult(_0x582acf,0xc9))['catch'](handleError(_0x582acf,null));};var interaction_log=require('../../config/logger')(_0x16dd('0x76'));exports['accept']=function(_0x3b09e8,_0x574d1a,_0x45779a){var _0x5a5473={'channel':_0x16dd('0x77')};if(_0x3b09e8['body']['id']){delete _0x3b09e8['body']['id'];}_0x3b09e8['body'][_0x16dd('0x78')]=!![];_0x3b09e8['body'][_0x16dd('0x79')]=moment()[_0x16dd('0x7a')](_0x16dd('0x75'));_0x3b09e8[_0x16dd('0x54')][_0x16dd('0x7b')]=_0x3b09e8[_0x16dd('0x54')][_0x16dd('0x7b')]||_0x3b09e8[_0x16dd('0x69')]['id'];return db[_0x16dd('0x38')][_0x16dd('0x56')]({'where':{'id':_0x3b09e8[_0x16dd('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x16dd('0x5f')],'as':'Contact'}]})[_0x16dd('0x20')](handleEntityNotFound(_0x574d1a,null))['then'](saveUpdates(_0x3b09e8[_0x16dd('0x54')],null))[_0x16dd('0x20')](function(_0x2b670a){if(_0x2b670a){_0x5a5473[_0x16dd('0x28')]=_0x2b670a['get']({'plain':!![]});return db[_0x16dd('0x7c')]['find']({'where':{'id':_0x2b670a['MailInteractionId']}});}return null;})[_0x16dd('0x20')](handleEntityNotFound(_0x574d1a,null))['then'](function(_0x5c6fef){if(_0x5c6fef){return _0x5c6fef[_0x16dd('0x53')]({'UserId':_0x3b09e8[_0x16dd('0x54')]['UserId'],'read1stAt':_[_0x16dd('0x64')](_0x5c6fef[_0x16dd('0x7d')])?moment()[_0x16dd('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x16dd('0x20')](function(_0x5a468e){if(_0x5a468e){_0x5a5473[_0x16dd('0x7e')]=_0x5a468e[_0x16dd('0x7f')]({'plain':!![]});interaction_log[_0x16dd('0x21')](_0x16dd('0x80'),_0x3b09e8[_0x16dd('0x69')]['id'],_0x3b09e8[_0x16dd('0x69')][_0x16dd('0x35')],_0x3b09e8[_0x16dd('0x69')]['role'],_0x5a5473[_0x16dd('0x7e')]['id'],_0x3b09e8[_0x16dd('0x54')]?JSON[_0x16dd('0x25')](_0x3b09e8[_0x16dd('0x54')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5a5473);}return null;})['then'](function(_0x10bfcd){if(_0x10bfcd){if(_0x3b09e8[_0x16dd('0x54')][_0x16dd('0x81')]){_0x5a5473[_0x16dd('0x28')][_0x16dd('0x82')]=util[_0x16dd('0x7a')]('SIP/%s',_0x3b09e8[_0x16dd('0x69')][_0x16dd('0x35')]);_0x5a5473[_0x16dd('0x28')]['channel']=_0x5a5473['channel'];_0x5a5473['message'][_0x16dd('0x83')]=_0x16dd('0x84');return respondWithRpcPromise(_0x16dd('0x85'),_0x16dd('0x85'),{'event':_0x16dd('0x86'),'message':_0x5a5473['message']},client9002)[_0x16dd('0x20')](function(){return _0x5a5473;});}return _0x5a5473;}return null;})[_0x16dd('0x20')](respondWithResult(_0x574d1a,null))['catch'](handleError(_0x574d1a,null));};var interaction_log=require(_0x16dd('0x87'))(_0x16dd('0x76'));exports[_0x16dd('0x31')]=function(_0x29e5fe,_0x1bda75,_0x47fcd3){var _0x4d1983={'agent':{},'channel':'mail'};if(_0x29e5fe[_0x16dd('0x54')]['id']){delete _0x29e5fe[_0x16dd('0x54')]['id'];}_0x29e5fe[_0x16dd('0x54')][_0x16dd('0x7b')]=_0x29e5fe['body'][_0x16dd('0x7b')]||_0x29e5fe[_0x16dd('0x69')]['id'];_0x4d1983[_0x16dd('0x88')]['id']=_0x29e5fe[_0x16dd('0x54')][_0x16dd('0x7b')];return db[_0x16dd('0x38')]['find']({'where':{'id':_0x29e5fe[_0x16dd('0x55')]['id'],'UserId':null}})[_0x16dd('0x20')](handleEntityNotFound(_0x1bda75,null))[_0x16dd('0x20')](function(_0x2dc670){if(_0x2dc670){_0x4d1983[_0x16dd('0x28')]=_0x2dc670[_0x16dd('0x7f')]({'plain':!![]});return db[_0x16dd('0x7c')][_0x16dd('0x56')]({'where':{'id':_0x2dc670['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1bda75,null))['then'](function(_0x5d5d39){if(_0x5d5d39){_0x4d1983[_0x16dd('0x7e')]=_0x5d5d39[_0x16dd('0x7f')]({'plain':!![]});interaction_log[_0x16dd('0x21')](_0x16dd('0x89'),_0x29e5fe[_0x16dd('0x69')]['id'],_0x29e5fe[_0x16dd('0x69')]['name'],_0x29e5fe[_0x16dd('0x69')][_0x16dd('0x8a')],_0x4d1983['interaction']['id'],_0x29e5fe[_0x16dd('0x54')]?JSON[_0x16dd('0x25')](_0x29e5fe['body']):_0x16dd('0x8b'));return respondWithRpcPromise('RejectMessage',_0x16dd('0x8c'),_0x4d1983);}return null;})[_0x16dd('0x20')](function(_0xf2b994){if(_0xf2b994){_0xf2b994[_0x16dd('0x28')][_0x16dd('0x82')]=util['format'](_0x16dd('0x8d'),_0x29e5fe[_0x16dd('0x69')][_0x16dd('0x35')]);_0xf2b994['message']['channel']=_0x4d1983[_0x16dd('0x8e')];_0xf2b994[_0x16dd('0x28')][_0x16dd('0x83')]=_0x16dd('0x31');respondWithRpcPromise('EventManager',_0x16dd('0x85'),{'event':_0x16dd('0x8f'),'message':_0xf2b994[_0x16dd('0x28')]},client9002);return _0x4d1983;}return null;})[_0x16dd('0x20')](respondWithResult(_0x1bda75,null))[_0x16dd('0x4e')](handleError(_0x1bda75,null));};exports[_0x16dd('0x90')]=function(_0x24a069,_0x1e1002){var _0x3858de=moment()[_0x16dd('0x91')]()[_0x16dd('0x92')]();var _0x1b4af4=path['join'](config[_0x16dd('0x6e')],'server','files','tmp');var _0x54050f=path['join'](config['root'],_0x16dd('0x93'),_0x16dd('0x94'),'attachments');var _0x208d33=util['format'](_0x16dd('0x95'),_0x3858de);return db['MailMessage'][_0x16dd('0x56')]({'where':{'id':_0x24a069[_0x16dd('0x55')]['id']},'attributes':['id','body',_0x16dd('0x96'),'to','cc',_0x16dd('0x97'),_0x16dd('0x98'),'createdAt'],'include':_0x24a069[_0x16dd('0x3d')]['attachments']?[{'model':db['Attachment'],'as':_0x16dd('0x99')}]:undefined})['then'](handleEntityNotFound(_0x1e1002,null))[_0x16dd('0x20')](function(_0x4a1c1c){if(_0x4a1c1c){var _0x402250=_0x4a1c1c;var _0x38190a={'from':_0x402250[_0x16dd('0x96')],'to':_0x402250['to'],'subject':_0x402250[_0x16dd('0x98')],'html':_0x402250['body'],'headers':{'Date':moment(_0x402250[_0x16dd('0x9a')])[_0x16dd('0x7a')](_0x16dd('0x9b'))},'attachments':[]};if(_0x4a1c1c['cc']){_0x38190a[_0x16dd('0x9c')]['Cc']=_0x4a1c1c['cc'];}if(_0x4a1c1c[_0x16dd('0x97')]){_0x38190a['headers']['Bcc']=_0x4a1c1c[_0x16dd('0x97')];}return new BPromise(function(_0x252c4c,_0x405e49){if(_0x4a1c1c[_0x16dd('0x99')]){for(var _0x592fc4=0x0;_0x592fc4<_0x4a1c1c['Attachments'][_0x16dd('0x42')];_0x592fc4++){var _0x4e25be=_0x4a1c1c[_0x16dd('0x99')][_0x592fc4];var _0x356f36=path[_0x16dd('0x9d')](_0x54050f,_0x4e25be['basename']);if(fs[_0x16dd('0x9e')](_0x356f36)){_0x38190a[_0x16dd('0x6d')][_0x16dd('0x9f')]({'name':_0x4e25be[_0x16dd('0x35')],'contentType':_0x4e25be[_0x16dd('0x39')],'data':fs[_0x16dd('0xa0')](_0x356f36)});}}}emlformat['build'](_0x38190a,function(_0x2cd653,_0x35f536){if(_0x2cd653)return _0x405e49(_0x2cd653);fs[_0x16dd('0xa1')](path[_0x16dd('0x9d')](_0x1b4af4,_0x208d33),_0x35f536);return _0x252c4c(_0x35f536);});});}})[_0x16dd('0x20')](function(_0x3d59e2){if(_0x3d59e2){return _0x1e1002[_0x16dd('0x90')](path[_0x16dd('0x9d')](_0x1b4af4,_0x208d33),_0x208d33,function(_0x4ee4c3){if(_0x4ee4c3){console[_0x16dd('0xa2')](_0x16dd('0xa3'),_0x4ee4c3);}else{fs[_0x16dd('0xa4')](path['join'](_0x1b4af4,_0x208d33));}});}})[_0x16dd('0x4e')](handleError(_0x1e1002,null));}; \ No newline at end of file +var _0xa786=['debug','request\x20sent','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','apply','save','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','body','describe','create','out','secret','split','MailAccount','findOne','Contacts','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','pass','service','attachments','join','root','server/files/attachments','basename','List','defaults','ListId','List\x20not\x20found','SendMail','sendMail','update','format','mail-interactions','accept','read','UserId','user','CmContact','get','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail','MailInteraction','MailInteractionId','RejectMessage','rejectMessage','reject','download','unix','toString','files','tmp','server','bcc','subject','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','readFileSync','build','writeFileSync','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','MailMessage,\x20%s,\x20%s'];(function(_0x45806b,_0x53eeae){var _0x3e228e=function(_0x3ee031){while(--_0x3ee031){_0x45806b['push'](_0x45806b['shift']());}};_0x3e228e(++_0x53eeae);}(_0xa786,0x1d2));var _0x6a78=function(_0x224bc0,_0x15990c){_0x224bc0=_0x224bc0-0x0;var _0x33519a=_0xa786[_0x224bc0];return _0x33519a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6a78('0x0'));var zipdir=require(_0x6a78('0x1'));var jsonpatch=require(_0x6a78('0x2'));var rp=require(_0x6a78('0x3'));var moment=require(_0x6a78('0x4'));var BPromise=require(_0x6a78('0x5'));var Mustache=require(_0x6a78('0x6'));var util=require('util');var path=require(_0x6a78('0x7'));var sox=require(_0x6a78('0x8'));var csv=require(_0x6a78('0x9'));var ejs=require(_0x6a78('0xa'));var fs=require('fs');var _=require(_0x6a78('0xb'));var squel=require(_0x6a78('0xc'));var crypto=require(_0x6a78('0xd'));var jsforce=require(_0x6a78('0xe'));var deskjs=require(_0x6a78('0xf'));var toCsv=require(_0x6a78('0x9'));var querystring=require(_0x6a78('0x10'));var Papa=require(_0x6a78('0x11'));var Redis=require(_0x6a78('0x12'));var authService=require(_0x6a78('0x13'));var qs=require(_0x6a78('0x14'));var as=require(_0x6a78('0x15'));var hardwareService=require(_0x6a78('0x16'));var logger=require(_0x6a78('0x17'))(_0x6a78('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6a78('0x19'))['db'];config[_0x6a78('0x1a')]=_['defaults'](config[_0x6a78('0x1a')],{'host':_0x6a78('0x1b'),'port':0x18eb});var socket=require(_0x6a78('0x1c'))(new Redis(config[_0x6a78('0x1a')]));require(_0x6a78('0x1d'))[_0x6a78('0x1e')](socket);var jayson=require(_0x6a78('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client'][_0x6a78('0x20')]({'port':0x232b});var client9002=jayson[_0x6a78('0x21')][_0x6a78('0x20')]({'port':0x232a});function checkPasswordPattern(_0x535dc8,_0x1085ca,_0x428060){if(_0x428060){var _0x5b5a5d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b5a5d[_0x6a78('0x22')](_0x1085ca)){return _0x535dc8;}else{throw new db[(_0x6a78('0x23'))][(_0x6a78('0x24'))](_0x6a78('0x25'));}}else{return _0x535dc8;}}function respondWithRpcPromise(_0x3f24ac,_0xe0e5e6,_0x28b91f,_0x3c3e5d){return new BPromise(function(_0x5ec2fa,_0x2d6ef3){var _0x5292eb=_0x3c3e5d||client;return _0x5292eb[_0x6a78('0x26')](_0x3f24ac,_0x28b91f)[_0x6a78('0x27')](function(_0x2ae9c5){logger['info'](_0x6a78('0x28'),_0xe0e5e6,'request\x20sent');logger[_0x6a78('0x29')]('MailMessage,\x20%s,\x20%s,\x20%s',_0xe0e5e6,_0x6a78('0x2a'),JSON['stringify'](_0x2ae9c5));if(_0x2ae9c5[_0x6a78('0x2b')]){if(_0x2ae9c5['error']['code']===0x1f4){logger['error'](_0x6a78('0x28'),_0xe0e5e6,_0x2ae9c5[_0x6a78('0x2b')][_0x6a78('0x2c')]);return _0x2d6ef3(_0x2ae9c5['error'][_0x6a78('0x2c')]);}logger[_0x6a78('0x2b')](_0x6a78('0x28'),_0xe0e5e6,_0x2ae9c5[_0x6a78('0x2b')]['message']);return _0x5ec2fa(_0x2ae9c5[_0x6a78('0x2b')]['message']);}else{logger[_0x6a78('0x2d')](_0x6a78('0x28'),_0xe0e5e6,_0x6a78('0x2a'));_0x5ec2fa(_0x2ae9c5[_0x6a78('0x2e')]['message']);}})[_0x6a78('0x2f')](function(_0x2c1893){logger['error'](_0x6a78('0x28'),_0xe0e5e6,_0x2c1893);_0x2d6ef3(_0x2c1893);});});}function respondWithStatusCode(_0x526a94,_0x297708){_0x297708=_0x297708||0xcc;return function(_0x48c692){if(_0x48c692){return _0x526a94[_0x6a78('0x30')](_0x297708);}return _0x526a94[_0x6a78('0x31')](_0x297708)['end']();};}function respondWithResult(_0x31ca28,_0x231f1a){_0x231f1a=_0x231f1a||0xc8;return function(_0x50f6b1){if(_0x50f6b1){return _0x31ca28[_0x6a78('0x31')](_0x231f1a)[_0x6a78('0x32')](_0x50f6b1);}};}function respondWithFilteredResult(_0x5abf0b,_0x1e5cd4){return function(_0x86d08f){if(_0x86d08f){var _0x470ab2=_0x86d08f[_0x6a78('0x33')],_0xa40d44=_0x1e5cd4['offset'],_0x816c52=_0x1e5cd4[_0x6a78('0x34')]+_0x1e5cd4[_0x6a78('0x35')],_0x2c8074;if(_0x816c52>=_0x470ab2){_0x816c52=_0x470ab2;_0x2c8074=0xc8;}else{_0x2c8074=0xce;}_0x5abf0b['status'](_0x2c8074);return _0x5abf0b[_0x6a78('0x36')]('Content-Range',_0xa40d44+'-'+_0x816c52+'/'+_0x470ab2)[_0x6a78('0x32')](_0x86d08f);}return null;};}function patchUpdates(_0x22852c){return function(_0x4b76e7){try{jsonpatch[_0x6a78('0x37')](_0x4b76e7,_0x22852c,!![]);}catch(_0x784e39){return BPromise['reject'](_0x784e39);}return _0x4b76e7[_0x6a78('0x38')]();};}function saveUpdates(_0x58c8ed,_0x30fe15){return function(_0x2b9974){if(_0x2b9974){return _0x2b9974['update'](_0x58c8ed)['then'](function(_0x314775){return _0x314775;});}return null;};}function removeEntity(_0x6d1a66,_0x39dd29){return function(_0x725b9f){if(_0x725b9f){return _0x725b9f['destroy']()['then'](function(){_0x6d1a66[_0x6a78('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x210e0c,_0x16ff80){return function(_0x58cf10){if(!_0x58cf10){_0x210e0c[_0x6a78('0x30')](0x194);}return _0x58cf10;};}function handleError(_0x580aad,_0x14953c){_0x14953c=_0x14953c||0x1f4;return function(_0x29d375){logger['error'](_0x29d375[_0x6a78('0x39')]);if(_0x29d375['name']){delete _0x29d375[_0x6a78('0x3a')];}_0x580aad[_0x6a78('0x31')](_0x14953c)[_0x6a78('0x3b')](_0x29d375);};}exports[_0x6a78('0x3c')]=function(_0x2c5722,_0x3127d8){var _0x338a4e={},_0x24c9ac={},_0x1e0c52={'count':0x0,'rows':[]};var _0x5ab9aa=_[_0x6a78('0x3d')](db[_0x6a78('0x3e')][_0x6a78('0x3f')],function(_0x2987c8){return{'name':_0x2987c8[_0x6a78('0x40')],'type':_0x2987c8[_0x6a78('0x41')][_0x6a78('0x42')]};});_0x24c9ac[_0x6a78('0x43')]=_[_0x6a78('0x3d')](_0x5ab9aa,_0x6a78('0x3a'));_0x24c9ac[_0x6a78('0x44')]=_['keys'](_0x2c5722[_0x6a78('0x44')]);_0x24c9ac['filters']=_[_0x6a78('0x45')](_0x24c9ac[_0x6a78('0x43')],_0x24c9ac[_0x6a78('0x44')]);_0x338a4e['attributes']=_[_0x6a78('0x45')](_0x24c9ac[_0x6a78('0x43')],qs[_0x6a78('0x46')](_0x2c5722[_0x6a78('0x44')][_0x6a78('0x46')]));_0x338a4e[_0x6a78('0x47')]=_0x338a4e[_0x6a78('0x47')][_0x6a78('0x48')]?_0x338a4e[_0x6a78('0x47')]:_0x24c9ac[_0x6a78('0x43')];if(!_0x2c5722[_0x6a78('0x44')][_0x6a78('0x49')](_0x6a78('0x4a'))){_0x338a4e[_0x6a78('0x35')]=qs[_0x6a78('0x35')](_0x2c5722['query'][_0x6a78('0x35')]);_0x338a4e[_0x6a78('0x34')]=qs[_0x6a78('0x34')](_0x2c5722[_0x6a78('0x44')][_0x6a78('0x34')]);}_0x338a4e[_0x6a78('0x4b')]=qs[_0x6a78('0x4c')](_0x2c5722[_0x6a78('0x44')][_0x6a78('0x4c')]);_0x338a4e['where']=qs[_0x6a78('0x4d')](_[_0x6a78('0x4e')](_0x2c5722['query'],_0x24c9ac[_0x6a78('0x4d')]),_0x5ab9aa);if(_0x2c5722[_0x6a78('0x44')][_0x6a78('0x4f')]){_0x338a4e[_0x6a78('0x50')]=_[_0x6a78('0x51')](_0x338a4e['where'],{'$or':_[_0x6a78('0x3d')](_0x5ab9aa,function(_0x599550){if(_0x599550[_0x6a78('0x41')]!==_0x6a78('0x52')){var _0x1f42c7={};_0x1f42c7[_0x599550[_0x6a78('0x3a')]]={'$like':'%'+_0x2c5722[_0x6a78('0x44')][_0x6a78('0x4f')]+'%'};return _0x1f42c7;}})});}_0x338a4e=_[_0x6a78('0x51')]({},_0x338a4e,_0x2c5722[_0x6a78('0x53')]);var _0xede538={'where':_0x338a4e[_0x6a78('0x50')]};return db[_0x6a78('0x3e')]['count'](_0xede538)[_0x6a78('0x27')](function(_0xa4f975){_0x1e0c52[_0x6a78('0x33')]=_0xa4f975;if(_0x2c5722['query'][_0x6a78('0x54')]){_0x338a4e[_0x6a78('0x55')]=[{'all':!![]}];}return db[_0x6a78('0x3e')][_0x6a78('0x56')](_0x338a4e);})[_0x6a78('0x27')](function(_0x36bea3){_0x1e0c52['rows']=_0x36bea3;return _0x1e0c52;})['then'](respondWithFilteredResult(_0x3127d8,_0x338a4e))['catch'](handleError(_0x3127d8,null));};exports[_0x6a78('0x57')]=function(_0x24fe9b,_0x241270){var _0x253376={'raw':!![],'where':{'id':_0x24fe9b[_0x6a78('0x58')]['id']}},_0x2bcb06={};_0x2bcb06[_0x6a78('0x43')]=_[_0x6a78('0x59')](db[_0x6a78('0x3e')][_0x6a78('0x3f')]);_0x2bcb06[_0x6a78('0x44')]=_[_0x6a78('0x59')](_0x24fe9b[_0x6a78('0x44')]);_0x2bcb06[_0x6a78('0x4d')]=_[_0x6a78('0x45')](_0x2bcb06[_0x6a78('0x43')],_0x2bcb06[_0x6a78('0x44')]);_0x253376['attributes']=_[_0x6a78('0x45')](_0x2bcb06[_0x6a78('0x43')],qs['fields'](_0x24fe9b['query'][_0x6a78('0x46')]));_0x253376['attributes']=_0x253376['attributes'][_0x6a78('0x48')]?_0x253376[_0x6a78('0x47')]:_0x2bcb06[_0x6a78('0x43')];if(_0x24fe9b[_0x6a78('0x44')][_0x6a78('0x54')]){_0x253376[_0x6a78('0x55')]=[{'all':!![]}];}_0x253376=_['merge']({},_0x253376,_0x24fe9b[_0x6a78('0x53')]);return db[_0x6a78('0x3e')][_0x6a78('0x5a')](_0x253376)[_0x6a78('0x27')](handleEntityNotFound(_0x241270,null))[_0x6a78('0x27')](respondWithResult(_0x241270,null))['catch'](handleError(_0x241270,null));};exports['update']=function(_0x1f8483,_0x45cb10){if(_0x1f8483[_0x6a78('0x5b')]['id']){delete _0x1f8483['body']['id'];}return db[_0x6a78('0x3e')][_0x6a78('0x5a')]({'where':{'id':_0x1f8483[_0x6a78('0x58')]['id']}})[_0x6a78('0x27')](handleEntityNotFound(_0x45cb10,null))[_0x6a78('0x27')](saveUpdates(_0x1f8483[_0x6a78('0x5b')],null))['then'](respondWithResult(_0x45cb10,null))[_0x6a78('0x2f')](handleError(_0x45cb10,null));};exports['destroy']=function(_0x5795b7,_0x59bfae){return db[_0x6a78('0x3e')][_0x6a78('0x5a')]({'where':{'id':_0x5795b7[_0x6a78('0x58')]['id']}})[_0x6a78('0x27')](handleEntityNotFound(_0x59bfae,null))[_0x6a78('0x27')](removeEntity(_0x59bfae,null))[_0x6a78('0x2f')](handleError(_0x59bfae,null));};exports[_0x6a78('0x5c')]=function(_0x23de46,_0x38a6ab){return db['MailMessage'][_0x6a78('0x5c')]()[_0x6a78('0x27')](respondWithResult(_0x38a6ab,null))[_0x6a78('0x2f')](handleError(_0x38a6ab,null));};exports[_0x6a78('0x5d')]=function(_0x47feaa,_0x1bfadf){return db[_0x6a78('0x3e')][_0x6a78('0x5d')](_0x47feaa[_0x6a78('0x5b')])['then'](function(_0x227fa1){if(_0x227fa1){if(_0x227fa1['direction']===_0x6a78('0x5e')&&!_0x227fa1[_0x6a78('0x5f')]){var _0x2c9a1f,_0x199e06,_0x8da3ad;if(_0x47feaa['body']['to']){_0x199e06=_0x47feaa['body']['to'][_0x6a78('0x60')](',')[0x0];}return db[_0x6a78('0x61')][_0x6a78('0x62')]({'where':{'id':_0x227fa1['MailAccountId']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x6a78('0x63'),'where':{'email':_0x199e06},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x6a78('0x64')],'as':'Smtp','raw':!![]}]})[_0x6a78('0x27')](function(_0x1c0490){_0x2c9a1f=_0x1c0490;if(_0x2c9a1f&&_0x2c9a1f[_0x6a78('0x65')]){var _0x4bfde8={'tls':{'rejectUnauthorized':![]}};if(_[_0x6a78('0x66')](_0x2c9a1f[_0x6a78('0x65')]['service'])){_0x4bfde8[_0x6a78('0x67')]=_0x2c9a1f[_0x6a78('0x65')]['host'];_0x4bfde8[_0x6a78('0x68')]=_0x2c9a1f['Smtp'][_0x6a78('0x68')];_0x4bfde8[_0x6a78('0x69')]=_0x2c9a1f[_0x6a78('0x65')][_0x6a78('0x69')];if(_0x2c9a1f[_0x6a78('0x65')][_0x6a78('0x6a')]){_0x4bfde8[_0x6a78('0x6b')]={'user':_0x2c9a1f['Smtp']['user'],'pass':_0x2c9a1f[_0x6a78('0x65')][_0x6a78('0x6c')]};}}else{_0x4bfde8['service']=_0x2c9a1f[_0x6a78('0x65')][_0x6a78('0x6d')];_0x4bfde8[_0x6a78('0x6b')]={'user':_0x2c9a1f['Smtp']['user'],'pass':_0x2c9a1f[_0x6a78('0x65')][_0x6a78('0x6c')]};_0x4bfde8[_0x6a78('0x69')]=_0x2c9a1f[_0x6a78('0x65')][_0x6a78('0x69')];}if(_0x47feaa[_0x6a78('0x5b')][_0x6a78('0x6e')]&&_0x47feaa[_0x6a78('0x5b')]['attachments'][_0x6a78('0x48')]){for(var _0xc34195=0x0;_0xc34195<_0x47feaa['body'][_0x6a78('0x6e')]['length'];_0xc34195+=0x1){_0x47feaa[_0x6a78('0x5b')]['attachments'][_0xc34195]={'filename':_0x47feaa['body'][_0x6a78('0x6e')][_0xc34195][_0x6a78('0x3a')],'path':path[_0x6a78('0x6f')](config[_0x6a78('0x70')],_0x6a78('0x71'),_0x47feaa[_0x6a78('0x5b')]['attachments'][_0xc34195][_0x6a78('0x72')])};}}_0x8da3ad={'account':_0x4bfde8,'message':_0x47feaa[_0x6a78('0x5b')]};return;}})[_0x6a78('0x27')](function(){if(_0x2c9a1f[_0x6a78('0x73')]){if(_0x2c9a1f[_0x6a78('0x73')][_0x6a78('0x63')][_0x6a78('0x48')]){return _0x2c9a1f[_0x6a78('0x73')][_0x6a78('0x63')][0x0];}else{return db['CmContact'][_0x6a78('0x5d')](_[_0x6a78('0x74')](_0x47feaa[_0x6a78('0x5b')],{'firstName':_0x47feaa[_0x6a78('0x5b')]['to'],'email':_0x47feaa['body']['to'],'phone':_0x47feaa[_0x6a78('0x5b')]['to'],'ListId':_0x2c9a1f[_0x6a78('0x75')]}));}}else{throw new Error(_0x6a78('0x76'));}})[_0x6a78('0x27')](function(){if(_0x8da3ad){return respondWithRpcPromise(_0x6a78('0x77'),_0x6a78('0x78'),_0x8da3ad,client9003)['then'](function(_0x4a2181){return _0x227fa1[_0x6a78('0x79')]({'read':!![],'messageId':_0x4a2181['messageId'],'sentAt':moment()[_0x6a78('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x13c984){logger[_0x6a78('0x2b')]('%s',JSON['stringify'](_0x13c984));return _0x227fa1;});}return _0x227fa1;});}return _0x227fa1;}})[_0x6a78('0x27')](respondWithResult(_0x1bfadf,0xc9))[_0x6a78('0x2f')](handleError(_0x1bfadf,null));};var interaction_log=require('../../config/logger')(_0x6a78('0x7b'));exports[_0x6a78('0x7c')]=function(_0x333bc4,_0x474e35,_0x3044d9){var _0x52844a={'channel':'mail'};if(_0x333bc4[_0x6a78('0x5b')]['id']){delete _0x333bc4[_0x6a78('0x5b')]['id'];}_0x333bc4[_0x6a78('0x5b')][_0x6a78('0x7d')]=!![];_0x333bc4[_0x6a78('0x5b')]['readAt']=moment()[_0x6a78('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x333bc4[_0x6a78('0x5b')]['UserId']=_0x333bc4['body'][_0x6a78('0x7e')]||_0x333bc4[_0x6a78('0x7f')]['id'];return db['MailMessage']['find']({'where':{'id':_0x333bc4['params']['id'],'UserId':null},'include':[{'model':db[_0x6a78('0x80')],'as':'Contact'}]})[_0x6a78('0x27')](handleEntityNotFound(_0x474e35,null))[_0x6a78('0x27')](saveUpdates(_0x333bc4[_0x6a78('0x5b')],null))[_0x6a78('0x27')](function(_0x297cdf){if(_0x297cdf){_0x52844a[_0x6a78('0x2c')]=_0x297cdf[_0x6a78('0x81')]({'plain':!![]});return db['MailInteraction'][_0x6a78('0x5a')]({'where':{'id':_0x297cdf['MailInteractionId']}});}return null;})[_0x6a78('0x27')](handleEntityNotFound(_0x474e35,null))['then'](function(_0x3e93dd){if(_0x3e93dd){return _0x3e93dd[_0x6a78('0x79')]({'UserId':_0x333bc4[_0x6a78('0x5b')]['UserId'],'read1stAt':_[_0x6a78('0x66')](_0x3e93dd['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6a78('0x27')](function(_0x37e9ca){if(_0x37e9ca){_0x52844a[_0x6a78('0x82')]=_0x37e9ca[_0x6a78('0x81')]({'plain':!![]});interaction_log[_0x6a78('0x2d')](_0x6a78('0x83'),_0x333bc4[_0x6a78('0x7f')]['id'],_0x333bc4[_0x6a78('0x7f')][_0x6a78('0x3a')],_0x333bc4[_0x6a78('0x7f')][_0x6a78('0x84')],_0x52844a[_0x6a78('0x82')]['id'],_0x333bc4[_0x6a78('0x5b')]?JSON[_0x6a78('0x85')](_0x333bc4['body']):_0x6a78('0x86'));return respondWithRpcPromise(_0x6a78('0x87'),'acceptMessage',_0x52844a);}return null;})[_0x6a78('0x27')](function(_0xac5ca7){if(_0xac5ca7){if(_0x333bc4['body'][_0x6a78('0x88')]){_0x52844a[_0x6a78('0x2c')][_0x6a78('0x89')]=util['format'](_0x6a78('0x8a'),_0x333bc4['user']['name']);_0x52844a['message'][_0x6a78('0x8b')]=_0x52844a[_0x6a78('0x8b')];_0x52844a[_0x6a78('0x2c')][_0x6a78('0x8c')]='accept';return respondWithRpcPromise(_0x6a78('0x8d'),_0x6a78('0x8d'),{'event':_0x6a78('0x8e'),'message':_0x52844a['message']},client9002)[_0x6a78('0x27')](function(){return _0x52844a;});}return _0x52844a;}return null;})['then'](respondWithResult(_0x474e35,null))[_0x6a78('0x2f')](handleError(_0x474e35,null));};var interaction_log=require(_0x6a78('0x17'))(_0x6a78('0x7b'));exports['reject']=function(_0x4589f0,_0x2b5adc,_0x38773b){var _0x3b9b1e={'agent':{},'channel':_0x6a78('0x8f')};if(_0x4589f0['body']['id']){delete _0x4589f0[_0x6a78('0x5b')]['id'];}_0x4589f0[_0x6a78('0x5b')]['UserId']=_0x4589f0[_0x6a78('0x5b')]['UserId']||_0x4589f0[_0x6a78('0x7f')]['id'];_0x3b9b1e['agent']['id']=_0x4589f0[_0x6a78('0x5b')][_0x6a78('0x7e')];return db[_0x6a78('0x3e')][_0x6a78('0x5a')]({'where':{'id':_0x4589f0[_0x6a78('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b5adc,null))[_0x6a78('0x27')](function(_0x2233da){if(_0x2233da){_0x3b9b1e['message']=_0x2233da[_0x6a78('0x81')]({'plain':!![]});return db[_0x6a78('0x90')]['find']({'where':{'id':_0x2233da[_0x6a78('0x91')]}});}return null;})[_0x6a78('0x27')](handleEntityNotFound(_0x2b5adc,null))['then'](function(_0x3bee80){if(_0x3bee80){_0x3b9b1e['interaction']=_0x3bee80[_0x6a78('0x81')]({'plain':!![]});interaction_log[_0x6a78('0x2d')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4589f0['user']['id'],_0x4589f0[_0x6a78('0x7f')][_0x6a78('0x3a')],_0x4589f0[_0x6a78('0x7f')][_0x6a78('0x84')],_0x3b9b1e['interaction']['id'],_0x4589f0[_0x6a78('0x5b')]?JSON[_0x6a78('0x85')](_0x4589f0[_0x6a78('0x5b')]):'null');return respondWithRpcPromise(_0x6a78('0x92'),_0x6a78('0x93'),_0x3b9b1e);}return null;})[_0x6a78('0x27')](function(_0x343b4c){if(_0x343b4c){_0x343b4c[_0x6a78('0x2c')][_0x6a78('0x89')]=util[_0x6a78('0x7a')](_0x6a78('0x8a'),_0x4589f0[_0x6a78('0x7f')][_0x6a78('0x3a')]);_0x343b4c[_0x6a78('0x2c')][_0x6a78('0x8b')]=_0x3b9b1e[_0x6a78('0x8b')];_0x343b4c[_0x6a78('0x2c')][_0x6a78('0x8c')]=_0x6a78('0x94');respondWithRpcPromise(_0x6a78('0x8d'),_0x6a78('0x8d'),{'event':'rejectmessage','message':_0x343b4c[_0x6a78('0x2c')]},client9002);return _0x3b9b1e;}return null;})[_0x6a78('0x27')](respondWithResult(_0x2b5adc,null))['catch'](handleError(_0x2b5adc,null));};exports[_0x6a78('0x95')]=function(_0x54bd9f,_0x105e4d){var _0x4cb9e8=moment()[_0x6a78('0x96')]()[_0x6a78('0x97')]();var _0x46614e=path[_0x6a78('0x6f')](config[_0x6a78('0x70')],'server',_0x6a78('0x98'),_0x6a78('0x99'));var _0x3b603a=path['join'](config['root'],_0x6a78('0x9a'),_0x6a78('0x98'),_0x6a78('0x6e'));var _0x36b425=util['format']('message-%s.eml',_0x4cb9e8);return db['MailMessage'][_0x6a78('0x5a')]({'where':{'id':_0x54bd9f[_0x6a78('0x58')]['id']},'attributes':['id',_0x6a78('0x5b'),'from','to','cc',_0x6a78('0x9b'),_0x6a78('0x9c'),_0x6a78('0x9d')],'include':_0x54bd9f[_0x6a78('0x44')][_0x6a78('0x6e')]?[{'model':db[_0x6a78('0x9e')],'as':_0x6a78('0x9f')}]:undefined})[_0x6a78('0x27')](handleEntityNotFound(_0x105e4d,null))['then'](function(_0x499ce0){if(_0x499ce0){var _0x3bf269=_0x499ce0;var _0x41928a={'from':_0x3bf269[_0x6a78('0xa0')],'to':_0x3bf269['to'],'subject':_0x3bf269[_0x6a78('0x9c')],'html':_0x3bf269[_0x6a78('0x5b')],'headers':{'Date':moment(_0x3bf269[_0x6a78('0x9d')])[_0x6a78('0x7a')](_0x6a78('0xa1'))},'attachments':[]};if(_0x499ce0['cc']){_0x41928a[_0x6a78('0xa2')]['Cc']=_0x499ce0['cc'];}if(_0x499ce0[_0x6a78('0x9b')]){_0x41928a[_0x6a78('0xa2')]['Bcc']=_0x499ce0[_0x6a78('0x9b')];}return new BPromise(function(_0x4938b7,_0x336dd1){if(_0x499ce0[_0x6a78('0x9f')]){for(var _0x2b8ded=0x0;_0x2b8ded<_0x499ce0[_0x6a78('0x9f')][_0x6a78('0x48')];_0x2b8ded++){var _0x1c6cf2=_0x499ce0[_0x6a78('0x9f')][_0x2b8ded];var _0x22d373=path[_0x6a78('0x6f')](_0x3b603a,_0x1c6cf2[_0x6a78('0x72')]);if(fs[_0x6a78('0xa3')](_0x22d373)){_0x41928a[_0x6a78('0x6e')]['push']({'name':_0x1c6cf2[_0x6a78('0x3a')],'contentType':_0x1c6cf2[_0x6a78('0x41')],'data':fs[_0x6a78('0xa4')](_0x22d373)});}}}emlformat[_0x6a78('0xa5')](_0x41928a,function(_0x1c68f2,_0x2d19bb){if(_0x1c68f2)return _0x336dd1(_0x1c68f2);fs[_0x6a78('0xa6')](path[_0x6a78('0x6f')](_0x46614e,_0x36b425),_0x2d19bb);return _0x4938b7(_0x2d19bb);});});}})[_0x6a78('0x27')](function(_0x20ba48){if(_0x20ba48){return _0x105e4d[_0x6a78('0x95')](path[_0x6a78('0x6f')](_0x46614e,_0x36b425),_0x36b425,function(_0x2436dd){if(_0x2436dd){console['log'](_0x6a78('0xa7'),_0x2436dd);}else{fs[_0x6a78('0xa8')](path['join'](_0x46614e,_0x36b425));}});}})[_0x6a78('0x2f')](handleError(_0x105e4d,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 1a4f2a6..3467309 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 _0xb53a=['emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','save','update','remove'];(function(_0x12ae8c,_0x140092){var _0x4aeb1a=function(_0x488855){while(--_0x488855){_0x12ae8c['push'](_0x12ae8c['shift']());}};_0x4aeb1a(++_0x140092);}(_0xb53a,0x174));var _0xab53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb53a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xab53('0x0'));var MailMessage=require(_0xab53('0x1'))['db'][_0xab53('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xab53('0x3'),'afterUpdate':_0xab53('0x4'),'afterDestroy':_0xab53('0x5')};function emitEvent(_0x7af2e4){return function(_0x3c4139,_0x110cdf,_0x44d360){MailMessageEvents[_0xab53('0x6')](_0x7af2e4+':'+_0x3c4139['id'],_0x3c4139);MailMessageEvents['emit'](_0x7af2e4,_0x3c4139);_0x44d360(null);};}for(var e in events){if(events[_0xab53('0x7')](e)){var event=events[e];MailMessage[_0xab53('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x4aaa=['hook','exports','events','../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x13587e,_0x4e4afd){var _0x25d01d=function(_0x2d6226){while(--_0x2d6226){_0x13587e['push'](_0x13587e['shift']());}};_0x25d01d(++_0x4e4afd);}(_0x4aaa,0x70));var _0xa4aa=function(_0x2ee461,_0x292283){_0x2ee461=_0x2ee461-0x0;var _0x5bad40=_0x4aaa[_0x2ee461];return _0x5bad40;};'use strict';var EventEmitter=require(_0xa4aa('0x0'));var MailMessage=require(_0xa4aa('0x1'))['db'][_0xa4aa('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa4aa('0x3'),'afterUpdate':_0xa4aa('0x4'),'afterDestroy':_0xa4aa('0x5')};function emitEvent(_0x23169e){return function(_0x298da1,_0x4eae19,_0x246800){MailMessageEvents[_0xa4aa('0x6')](_0x23169e+':'+_0x298da1['id'],_0x298da1);MailMessageEvents[_0xa4aa('0x6')](_0x23169e,_0x298da1);_0x246800(null);};}for(var e in events){if(events[_0xa4aa('0x7')](e)){var event=events[e];MailMessage[_0xa4aa('0x8')](e,emitEvent(event));}}module[_0xa4aa('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index a8cb8ff..4e74f0f 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 _0x7cfe=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','exports','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','models','get','direction','out','secret','UserId','MailInteraction','findOne','then','update','createdAt','toLowerCase'];(function(_0x376205,_0x285b4b){var _0x2e867b=function(_0x3799c7){while(--_0x3799c7){_0x376205['push'](_0x376205['shift']());}};_0x2e867b(++_0x285b4b);}(_0x7cfe,0xca));var _0xe7cf=function(_0x4778f2,_0x4a3c46){_0x4778f2=_0x4778f2-0x0;var _0x3d138a=_0x7cfe[_0x4778f2];return _0x3d138a;};'use strict';var _=require(_0xe7cf('0x0'));var util=require(_0xe7cf('0x1'));var logger=require(_0xe7cf('0x2'))('api');var moment=require(_0xe7cf('0x3'));var BPromise=require(_0xe7cf('0x4'));var rp=require(_0xe7cf('0x5'));var htmlToText=require(_0xe7cf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7cf('0x7'));var config=require(_0xe7cf('0x8'));var attributes=require('./mailMessage.attributes');module[_0xe7cf('0x9')]=function(_0x32ad7a,_0x352608){return _0x32ad7a['define'](_0xe7cf('0xa'),attributes,{'tableName':_0xe7cf('0xb'),'paranoid':![],'indexes':[{'name':_0xe7cf('0xc'),'fields':[_0xe7cf('0xc')]},{'name':'fti_mail_messages','fields':[_0xe7cf('0xd'),_0xe7cf('0xe')],'type':_0xe7cf('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x7f7ef3,_0x670b4b,_0x289bf9){if(_0x7f7ef3[_0xe7cf('0x10')]){_0x7f7ef3[_0xe7cf('0xd')]=htmlToText['fromString'](_0x7f7ef3['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x289bf9(null,_0x670b4b);},'afterCreate':function(_0x1155da,_0x2ad7ef,_0x5089a4){var _0x435f0d=_0x32ad7a[_0xe7cf('0x11')];var _0x52f9e9=_0x1155da[_0xe7cf('0x12')]({'plain':!![]});if(_0x52f9e9['direction']['toLowerCase']()==='in'||_0x52f9e9[_0xe7cf('0x13')]['toLowerCase']()===_0xe7cf('0x14')&&!_0x52f9e9[_0xe7cf('0x15')]&&!_['isNil'](_0x52f9e9[_0xe7cf('0x16')])){_0x435f0d[_0xe7cf('0x17')][_0xe7cf('0x18')]({'where':{'id':_0x52f9e9['MailInteractionId']}})[_0xe7cf('0x19')](function(_0x111c90){if(_0x111c90){_0x111c90[_0xe7cf('0x1a')]({'lastMsgAt':_0x52f9e9[_0xe7cf('0x1b')],'lastMsgDirection':_0x52f9e9['direction'][_0xe7cf('0x1c')](),'lastMsgBody':_0x52f9e9[_0xe7cf('0x10')]});}})[_0xe7cf('0x1d')](function(_0x394068){console[_0xe7cf('0x1e')](_0x394068);});}_0x5089a4();}},'charset':_0xe7cf('0x1f'),'collate':_0xe7cf('0x20')});}; \ No newline at end of file +var _0x7b4d=['toLowerCase','direction','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','models'];(function(_0x29a08d,_0x551eca){var _0x10fc1a=function(_0x4a2117){while(--_0x4a2117){_0x29a08d['push'](_0x29a08d['shift']());}};_0x10fc1a(++_0x551eca);}(_0x7b4d,0x11c));var _0xd7b4=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0x7b4d[_0x367336];return _0x3423a7;};'use strict';var _=require(_0xd7b4('0x0'));var util=require(_0xd7b4('0x1'));var logger=require(_0xd7b4('0x2'))(_0xd7b4('0x3'));var moment=require(_0xd7b4('0x4'));var BPromise=require('bluebird');var rp=require(_0xd7b4('0x5'));var htmlToText=require(_0xd7b4('0x6'));var fs=require('fs');var path=require(_0xd7b4('0x7'));var rimraf=require(_0xd7b4('0x8'));var config=require(_0xd7b4('0x9'));var attributes=require(_0xd7b4('0xa'));module[_0xd7b4('0xb')]=function(_0x2c8156,_0x3f07b7){return _0x2c8156[_0xd7b4('0xc')](_0xd7b4('0xd'),attributes,{'tableName':_0xd7b4('0xe'),'paranoid':![],'indexes':[{'name':_0xd7b4('0xf'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0xd7b4('0x10'),_0xd7b4('0x11')],'type':_0xd7b4('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x44a4c7,_0xdf4992,_0xead0ec){if(_0x44a4c7[_0xd7b4('0x13')]){_0x44a4c7['plainBody']=htmlToText[_0xd7b4('0x14')](_0x44a4c7[_0xd7b4('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xead0ec(null,_0xdf4992);},'afterCreate':function(_0x32c8db,_0x1f5e3c,_0x505c5d){var _0x32b90d=_0x2c8156[_0xd7b4('0x15')];var _0x45f76b=_0x32c8db['get']({'plain':!![]});if(_0x45f76b['direction'][_0xd7b4('0x16')]()==='in'||_0x45f76b[_0xd7b4('0x17')][_0xd7b4('0x16')]()==='out'&&!_0x45f76b[_0xd7b4('0x18')]&&!_[_0xd7b4('0x19')](_0x45f76b[_0xd7b4('0x1a')])){_0x32b90d[_0xd7b4('0x1b')][_0xd7b4('0x1c')]({'where':{'id':_0x45f76b[_0xd7b4('0x1d')]}})['then'](function(_0x77352){if(_0x77352){_0x77352[_0xd7b4('0x1e')]({'lastMsgAt':_0x45f76b['createdAt'],'lastMsgDirection':_0x45f76b['direction'][_0xd7b4('0x16')](),'lastMsgBody':_0x45f76b[_0xd7b4('0x13')]});}})[_0xd7b4('0x1f')](function(_0x25444d){console[_0xd7b4('0x20')](_0x25444d);});}_0x505c5d();}},'charset':_0xd7b4('0x21'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 526abad..4218566 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 _0x0f9f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./mailMessage.socket','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateMailMessage','create','body','options','raw','lodash'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x0f9f,0xae));var _0xf0f9=function(_0x12e650,_0x33f29f){_0x12e650=_0x12e650-0x0;var _0x5b56b1=_0x0f9f[_0x12e650];return _0x5b56b1;};'use strict';var _=require(_0xf0f9('0x0'));var util=require(_0xf0f9('0x1'));var moment=require(_0xf0f9('0x2'));var BPromise=require(_0xf0f9('0x3'));var rs=require(_0xf0f9('0x4'));var fs=require('fs');var Redis=require(_0xf0f9('0x5'));var db=require(_0xf0f9('0x6'))['db'];var utils=require(_0xf0f9('0x7'));var logger=require(_0xf0f9('0x8'))(_0xf0f9('0x9'));var config=require(_0xf0f9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf0f9('0xb')][_0xf0f9('0xc')]({'port':0x232a});config['redis']=_[_0xf0f9('0xd')](config[_0xf0f9('0xe')],{'host':_0xf0f9('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf0f9('0xe')]));require(_0xf0f9('0x10'))['register'](socket);function respondWithRpcPromise(_0x3261bc,_0x3b3721,_0x3368ee){return new BPromise(function(_0x3be7af,_0x2f446e){return client[_0xf0f9('0x11')](_0x3261bc,_0x3368ee)[_0xf0f9('0x12')](function(_0x161816){logger['info'](_0xf0f9('0x13'),_0x3b3721,_0xf0f9('0x14'));logger[_0xf0f9('0x15')](_0xf0f9('0x16'),_0x3b3721,'request\x20sent',JSON[_0xf0f9('0x17')](_0x161816));if(_0x161816[_0xf0f9('0x18')]){if(_0x161816['error'][_0xf0f9('0x19')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x3b3721,_0x161816[_0xf0f9('0x18')]['message']);return _0x2f446e(_0x161816[_0xf0f9('0x18')]['message']);}logger[_0xf0f9('0x18')](_0xf0f9('0x13'),_0x3b3721,_0x161816[_0xf0f9('0x18')][_0xf0f9('0x1a')]);return _0x3be7af(_0x161816[_0xf0f9('0x18')][_0xf0f9('0x1a')]);}else{logger[_0xf0f9('0x1b')]('MailMessage,\x20%s,\x20%s',_0x3b3721,_0xf0f9('0x14'));_0x3be7af(_0x161816[_0xf0f9('0x1c')][_0xf0f9('0x1a')]);}})[_0xf0f9('0x1d')](function(_0x3dc0e3){logger[_0xf0f9('0x18')](_0xf0f9('0x13'),_0x3b3721,_0x3dc0e3);_0x2f446e(_0x3dc0e3);});});}exports[_0xf0f9('0x1e')]=function(_0x5ebbe9){var _0x1fb2de=this;return new Promise(function(_0x5c2ce0,_0x3664ff){return db['MailMessage'][_0xf0f9('0x1f')](_0x5ebbe9[_0xf0f9('0x20')],{'raw':_0x5ebbe9[_0xf0f9('0x21')]?_0x5ebbe9[_0xf0f9('0x21')][_0xf0f9('0x22')]===undefined?!![]:![]:!![]})[_0xf0f9('0x12')](function(_0x49bddc){logger[_0xf0f9('0x1b')]('CreateMailMessage',_0x5ebbe9);logger[_0xf0f9('0x15')](_0xf0f9('0x1e'),_0x5ebbe9,JSON['stringify'](_0x49bddc));_0x5c2ce0(_0x49bddc);})[_0xf0f9('0x1d')](function(_0x20b5dc){logger['error'](_0xf0f9('0x1e'),_0x20b5dc[_0xf0f9('0x1a')],_0x5ebbe9);_0x3664ff(_0x1fb2de[_0xf0f9('0x18')](0x1f4,_0x20b5dc[_0xf0f9('0x1a')]));});});}; \ No newline at end of file +var _0x78e0=['options','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body'];(function(_0x50d544,_0x578bad){var _0x510a38=function(_0x574e13){while(--_0x574e13){_0x50d544['push'](_0x50d544['shift']());}};_0x510a38(++_0x578bad);}(_0x78e0,0x13e));var _0x078e=function(_0x1c0028,_0x1ffe06){_0x1c0028=_0x1c0028-0x0;var _0x4c3b77=_0x78e0[_0x1c0028];return _0x4c3b77;};'use strict';var _=require(_0x078e('0x0'));var util=require(_0x078e('0x1'));var moment=require(_0x078e('0x2'));var BPromise=require(_0x078e('0x3'));var rs=require(_0x078e('0x4'));var fs=require('fs');var Redis=require(_0x078e('0x5'));var db=require(_0x078e('0x6'))['db'];var utils=require(_0x078e('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x078e('0x8'));var jayson=require(_0x078e('0x9'));var client=jayson[_0x078e('0xa')][_0x078e('0xb')]({'port':0x232a});config[_0x078e('0xc')]=_['defaults'](config[_0x078e('0xc')],{'host':_0x078e('0xd'),'port':0x18eb});var socket=require(_0x078e('0xe'))(new Redis(config[_0x078e('0xc')]));require(_0x078e('0xf'))[_0x078e('0x10')](socket);function respondWithRpcPromise(_0x1f6779,_0x507f38,_0x3c144e){return new BPromise(function(_0xb02b76,_0x121aca){return client[_0x078e('0x11')](_0x1f6779,_0x3c144e)[_0x078e('0x12')](function(_0x2cf01b){logger[_0x078e('0x13')](_0x078e('0x14'),_0x507f38,_0x078e('0x15'));logger['debug'](_0x078e('0x16'),_0x507f38,'request\x20sent',JSON['stringify'](_0x2cf01b));if(_0x2cf01b[_0x078e('0x17')]){if(_0x2cf01b['error'][_0x078e('0x18')]===0x1f4){logger[_0x078e('0x17')](_0x078e('0x14'),_0x507f38,_0x2cf01b[_0x078e('0x17')][_0x078e('0x19')]);return _0x121aca(_0x2cf01b[_0x078e('0x17')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x507f38,_0x2cf01b[_0x078e('0x17')][_0x078e('0x19')]);return _0xb02b76(_0x2cf01b['error'][_0x078e('0x19')]);}else{logger[_0x078e('0x13')](_0x078e('0x14'),_0x507f38,_0x078e('0x15'));_0xb02b76(_0x2cf01b[_0x078e('0x1a')][_0x078e('0x19')]);}})[_0x078e('0x1b')](function(_0x2900e3){logger[_0x078e('0x17')](_0x078e('0x14'),_0x507f38,_0x2900e3);_0x121aca(_0x2900e3);});});}exports[_0x078e('0x1c')]=function(_0x478f27){var _0x3bfcb5=this;return new Promise(function(_0x5a0681,_0x1d0b2b){return db[_0x078e('0x1d')][_0x078e('0x1e')](_0x478f27[_0x078e('0x1f')],{'raw':_0x478f27['options']?_0x478f27[_0x078e('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x078e('0x12')](function(_0x30b6b0){logger[_0x078e('0x13')]('CreateMailMessage',_0x478f27);logger[_0x078e('0x21')]('CreateMailMessage',_0x478f27,JSON[_0x078e('0x22')](_0x30b6b0));_0x5a0681(_0x30b6b0);})[_0x078e('0x1b')](function(_0x23173b){logger[_0x078e('0x17')](_0x078e('0x1c'),_0x23173b[_0x078e('0x19')],_0x478f27);_0x1d0b2b(_0x3bfcb5[_0x078e('0x17')](0x1f4,_0x23173b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a258896..24d093b 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 _0x8ccb=['removeListener','register','length','mailMessage:','./mailMessage.events','save','update'];(function(_0x3dec6e,_0x2187bc){var _0x3f6e9c=function(_0x374b20){while(--_0x374b20){_0x3dec6e['push'](_0x3dec6e['shift']());}};_0x3f6e9c(++_0x2187bc);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x8ccb[_0x4b91c4];return _0x25cb80;};'use strict';var MailMessageEvents=require(_0xb8cc('0x0'));var events=[_0xb8cc('0x1'),'remove',_0xb8cc('0x2')];function createListener(_0x101ec1,_0x2f49c3){return function(_0x673fa5){_0x2f49c3['emit'](_0x101ec1,_0x673fa5);};}function removeListener(_0x4e1ed7,_0x115fdc){return function(){MailMessageEvents[_0xb8cc('0x3')](_0x4e1ed7,_0x115fdc);};}exports[_0xb8cc('0x4')]=function(_0x4b6b5f){for(var _0x46ac6e=0x0,_0x349552=events[_0xb8cc('0x5')];_0x46ac6e<_0x349552;_0x46ac6e++){var _0x56951f=events[_0x46ac6e];var _0x35c86d=createListener(_0xb8cc('0x6')+_0x56951f,_0x4b6b5f);MailMessageEvents['on'](_0x56951f,_0x35c86d);}}; \ No newline at end of file +var _0xfd48=['save','remove','update','emit','removeListener','register','length','mailMessage:'];(function(_0x256d2e,_0x3a2009){var _0x197803=function(_0x507484){while(--_0x507484){_0x256d2e['push'](_0x256d2e['shift']());}};_0x197803(++_0x3a2009);}(_0xfd48,0x168));var _0x8fd4=function(_0x59f3c3,_0x46fe86){_0x59f3c3=_0x59f3c3-0x0;var _0x1c398a=_0xfd48[_0x59f3c3];return _0x1c398a;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x8fd4('0x0'),_0x8fd4('0x1'),_0x8fd4('0x2')];function createListener(_0x12ce6b,_0x42a50b){return function(_0x540e85){_0x42a50b[_0x8fd4('0x3')](_0x12ce6b,_0x540e85);};}function removeListener(_0x4a83e0,_0x2f6851){return function(){MailMessageEvents[_0x8fd4('0x4')](_0x4a83e0,_0x2f6851);};}exports[_0x8fd4('0x5')]=function(_0x2c480c){for(var _0x282b61=0x0,_0x533bec=events[_0x8fd4('0x6')];_0x282b61<_0x533bec;_0x282b61++){var _0x4546bb=events[_0x282b61];var _0x3ce49b=createListener(_0x8fd4('0x7')+_0x4546bb,_0x2c480c);MailMessageEvents['on'](_0x4546bb,_0x3ce49b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d671785..ea83de7 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 _0x2a0a=['/:id','update','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a0a,0x1c8));var _0xa2a0=function(_0xb442d3,_0x3f9cea){_0xb442d3=_0xb442d3-0x0;var _0x149673=_0x2a0a[_0xb442d3];return _0x149673;};'use strict';var multer=require(_0xa2a0('0x0'));var util=require(_0xa2a0('0x1'));var path=require(_0xa2a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xa2a0('0x3'));var router=express[_0xa2a0('0x4')]();var auth=require(_0xa2a0('0x5'));var interaction=require(_0xa2a0('0x6'));var config=require(_0xa2a0('0x7'));var controller=require(_0xa2a0('0x8'));router[_0xa2a0('0x9')]('/',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0xb')]);router['get'](_0xa2a0('0xc'),auth[_0xa2a0('0xa')](),controller[_0xa2a0('0xd')]);router[_0xa2a0('0x9')]('/:id',auth[_0xa2a0('0xa')](),controller['show']);router[_0xa2a0('0x9')](_0xa2a0('0xe'),auth[_0xa2a0('0xa')](),controller[_0xa2a0('0xf')]);router[_0xa2a0('0x9')](_0xa2a0('0x10'),auth['isAuthenticated'](),controller[_0xa2a0('0x11')]);router['get']('/:id/users',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x12')]);router[_0xa2a0('0x13')]('/',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x14')]);router[_0xa2a0('0x13')](_0xa2a0('0x10'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xa2a0('0x15'),auth['isAuthenticated'](),controller[_0xa2a0('0x16')]);router[_0xa2a0('0x17')](_0xa2a0('0x18'),auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x19')]);router[_0xa2a0('0x1a')](_0xa2a0('0x18'),auth[_0xa2a0('0xa')](),controller['destroy']);router[_0xa2a0('0x1a')](_0xa2a0('0x10'),auth['isAuthenticated'](),controller[_0xa2a0('0x1b')]);router[_0xa2a0('0x1a')](_0xa2a0('0x15'),auth['isAuthenticated'](),controller[_0xa2a0('0x1c')]);module[_0xa2a0('0x1d')]=router; \ No newline at end of file +var _0xad97=['getTeams','/:id/users','create','post','/:id/teams','addTeams','addAgents','update','delete','removeTeams','exports','util','connect-timeout','Router','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0xad97,0x9e));var _0x7ad9=function(_0x418ea3,_0x32b726){_0x418ea3=_0x418ea3-0x0;var _0x186e85=_0xad97[_0x418ea3];return _0x186e85;};'use strict';var multer=require('multer');var util=require(_0x7ad9('0x0'));var path=require('path');var timeout=require(_0x7ad9('0x1'));var express=require('express');var router=express[_0x7ad9('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7ad9('0x3'));var controller=require(_0x7ad9('0x4'));router[_0x7ad9('0x5')]('/',auth[_0x7ad9('0x6')](),controller[_0x7ad9('0x7')]);router[_0x7ad9('0x5')]('/describe',auth[_0x7ad9('0x6')](),controller[_0x7ad9('0x8')]);router[_0x7ad9('0x5')](_0x7ad9('0x9'),auth[_0x7ad9('0x6')](),controller['show']);router[_0x7ad9('0x5')]('/:id/members',auth[_0x7ad9('0x6')](),controller['getMembers']);router[_0x7ad9('0x5')]('/:id/teams',auth[_0x7ad9('0x6')](),controller[_0x7ad9('0xa')]);router[_0x7ad9('0x5')](_0x7ad9('0xb'),auth[_0x7ad9('0x6')](),controller['getAgents']);router['post']('/',auth[_0x7ad9('0x6')](),controller[_0x7ad9('0xc')]);router[_0x7ad9('0xd')](_0x7ad9('0xe'),auth['isAuthenticated'](),controller[_0x7ad9('0xf')]);router[_0x7ad9('0xd')](_0x7ad9('0xb'),auth[_0x7ad9('0x6')](),controller[_0x7ad9('0x10')]);router['put'](_0x7ad9('0x9'),auth[_0x7ad9('0x6')](),controller[_0x7ad9('0x11')]);router[_0x7ad9('0x12')](_0x7ad9('0x9'),auth[_0x7ad9('0x6')](),controller['destroy']);router[_0x7ad9('0x12')]('/:id/teams',auth[_0x7ad9('0x6')](),controller[_0x7ad9('0x13')]);router[_0x7ad9('0x12')](_0x7ad9('0xb'),auth[_0x7ad9('0x6')](),controller['removeAgents']);module[_0x7ad9('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 138a6eb..146b3bf 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 _0xa3d4=['ENUM','sequelize','STRING','name'];(function(_0x214648,_0x542367){var _0x3ade0e=function(_0x61ad5b){while(--_0x61ad5b){_0x214648['push'](_0x214648['shift']());}};_0x3ade0e(++_0x542367);}(_0xa3d4,0x151));var _0x4a3d=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xa3d4[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0x4a3d('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a3d('0x1')],'unique':_0x4a3d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4a3d('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4a3d('0x3')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0x2168=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x2168,0x112));var _0x8216=function(_0x702d36,_0x11499c){_0x702d36=_0x702d36-0x0;var _0x19a734=_0x2168[_0x702d36];return _0x19a734;};'use strict';var Sequelize=require(_0x8216('0x0'));module[_0x8216('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8216('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8216('0x3')]},'timeout':{'type':Sequelize[_0x8216('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8216('0x5')](_0x8216('0x6'),_0x8216('0x7'),_0x8216('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 3d9d0fb..1721c0d 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 _0x31f8=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','error','name','index','map','MailQueue','fieldName','type','key','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','find','describe','findOne','pick','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','mailPause','getTeams','filter','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','all','compact','value','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','crypto','jsforce','desk.js','querystring'];(function(_0x3d2d96,_0x5a5649){var _0x339c9e=function(_0x164ad3){while(--_0x164ad3){_0x3d2d96['push'](_0x3d2d96['shift']());}};_0x339c9e(++_0x5a5649);}(_0x31f8,0x79));var _0x831f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x31f8[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x831f('0x0'));var rimraf=require(_0x831f('0x1'));var zipdir=require(_0x831f('0x2'));var jsonpatch=require(_0x831f('0x3'));var rp=require('request-promise');var moment=require(_0x831f('0x4'));var BPromise=require(_0x831f('0x5'));var Mustache=require(_0x831f('0x6'));var util=require('util');var path=require(_0x831f('0x7'));var sox=require(_0x831f('0x8'));var csv=require(_0x831f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x831f('0xa'));var jsforce=require(_0x831f('0xb'));var deskjs=require(_0x831f('0xc'));var toCsv=require(_0x831f('0x9'));var querystring=require(_0x831f('0xd'));var Papa=require(_0x831f('0xe'));var Redis=require(_0x831f('0xf'));var authService=require(_0x831f('0x10'));var qs=require(_0x831f('0x11'));var as=require(_0x831f('0x12'));var hardwareService=require(_0x831f('0x13'));var logger=require(_0x831f('0x14'))(_0x831f('0x15'));var utils=require(_0x831f('0x16'));var config=require(_0x831f('0x17'));var db=require(_0x831f('0x18'))['db'];config['redis']=_[_0x831f('0x19')](config[_0x831f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0x831f('0x1b')](socket);function respondWithStatusCode(_0x25cf5e,_0x675f04){_0x675f04=_0x675f04||0xcc;return function(_0x396d74){if(_0x396d74){return _0x25cf5e[_0x831f('0x1c')](_0x675f04);}return _0x25cf5e[_0x831f('0x1d')](_0x675f04)[_0x831f('0x1e')]();};}function respondWithResult(_0x54aa31,_0xcd86a3){_0xcd86a3=_0xcd86a3||0xc8;return function(_0x541149){if(_0x541149){return _0x54aa31[_0x831f('0x1d')](_0xcd86a3)['json'](_0x541149);}};}function respondWithFilteredResult(_0x227772,_0x26936b){return function(_0x4cbe1e){if(_0x4cbe1e){var _0xc6c80a=_0x4cbe1e[_0x831f('0x1f')],_0x39f019=_0x26936b[_0x831f('0x20')],_0xfc926e=_0x26936b[_0x831f('0x20')]+_0x26936b['limit'],_0xdc3253;if(_0xfc926e>=_0xc6c80a){_0xfc926e=_0xc6c80a;_0xdc3253=0xc8;}else{_0xdc3253=0xce;}_0x227772[_0x831f('0x1d')](_0xdc3253);return _0x227772[_0x831f('0x21')](_0x831f('0x22'),_0x39f019+'-'+_0xfc926e+'/'+_0xc6c80a)[_0x831f('0x23')](_0x4cbe1e);}return null;};}function patchUpdates(_0x2bd6bf){return function(_0x4c671d){try{jsonpatch[_0x831f('0x24')](_0x4c671d,_0x2bd6bf,!![]);}catch(_0x4f1ed7){return BPromise[_0x831f('0x25')](_0x4f1ed7);}return _0x4c671d['save']();};}function saveUpdates(_0x19a415,_0x4c4064){return function(_0x35ae8c){if(_0x35ae8c){return _0x35ae8c[_0x831f('0x26')](_0x19a415)[_0x831f('0x27')](function(_0x2fb336){return _0x2fb336;});}return null;};}function removeEntity(_0x4bbcf9,_0x1a2f4c){return function(_0x1be592){if(_0x1be592){return _0x1be592[_0x831f('0x28')]()[_0x831f('0x27')](function(){var _0x190a66=_0x1be592[_0x831f('0x29')]({'plain':!![]});var _0x2c9969='MailQueues';return db[_0x831f('0x2a')][_0x831f('0x28')]({'where':{'type':_0x2c9969,'resourceId':_0x190a66['id']}})[_0x831f('0x27')](function(){return _0x1be592;});})[_0x831f('0x27')](function(){_0x4bbcf9[_0x831f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a54a4,_0x454ef2){return function(_0xf0216d){if(!_0xf0216d){_0x3a54a4[_0x831f('0x1c')](0x194);}return _0xf0216d;};}function handleError(_0x2851c3,_0x55845c){_0x55845c=_0x55845c||0x1f4;return function(_0x4e4090){logger[_0x831f('0x2b')](_0x4e4090['stack']);if(_0x4e4090[_0x831f('0x2c')]){delete _0x4e4090[_0x831f('0x2c')];}_0x2851c3[_0x831f('0x1d')](_0x55845c)['send'](_0x4e4090);};}exports[_0x831f('0x2d')]=function(_0x483371,_0x2f1cfa){var _0x20d9a2={},_0x5034f0={},_0x291992={'count':0x0,'rows':[]};var _0x2e147f=_[_0x831f('0x2e')](db[_0x831f('0x2f')]['rawAttributes'],function(_0x13ddce){return{'name':_0x13ddce[_0x831f('0x30')],'type':_0x13ddce[_0x831f('0x31')][_0x831f('0x32')]};});_0x5034f0['model']=_[_0x831f('0x2e')](_0x2e147f,_0x831f('0x2c'));_0x5034f0['query']=_[_0x831f('0x33')](_0x483371[_0x831f('0x34')]);_0x5034f0['filters']=_['intersection'](_0x5034f0['model'],_0x5034f0[_0x831f('0x34')]);_0x20d9a2[_0x831f('0x35')]=_[_0x831f('0x36')](_0x5034f0[_0x831f('0x37')],qs['fields'](_0x483371[_0x831f('0x34')][_0x831f('0x38')]));_0x20d9a2[_0x831f('0x35')]=_0x20d9a2[_0x831f('0x35')][_0x831f('0x39')]?_0x20d9a2[_0x831f('0x35')]:_0x5034f0[_0x831f('0x37')];if(!_0x483371[_0x831f('0x34')][_0x831f('0x3a')](_0x831f('0x3b'))){_0x20d9a2[_0x831f('0x3c')]=qs[_0x831f('0x3c')](_0x483371['query'][_0x831f('0x3c')]);_0x20d9a2['offset']=qs[_0x831f('0x20')](_0x483371[_0x831f('0x34')]['offset']);}_0x20d9a2[_0x831f('0x3d')]=qs[_0x831f('0x3e')](_0x483371[_0x831f('0x34')][_0x831f('0x3e')]);_0x20d9a2[_0x831f('0x3f')]=qs[_0x831f('0x40')](_['pick'](_0x483371['query'],_0x5034f0[_0x831f('0x40')]),_0x2e147f);if(_0x483371['query']['filter']){_0x20d9a2['where']=_[_0x831f('0x41')](_0x20d9a2['where'],{'$or':_[_0x831f('0x2e')](_0x2e147f,function(_0x199fd2){if(_0x199fd2['type']!=='VIRTUAL'){var _0x5eda89={};_0x5eda89[_0x199fd2[_0x831f('0x2c')]]={'$like':'%'+_0x483371[_0x831f('0x34')]['filter']+'%'};return _0x5eda89;}})});}_0x20d9a2=_[_0x831f('0x41')]({},_0x20d9a2,_0x483371[_0x831f('0x42')]);var _0x24dceb={'where':_0x20d9a2[_0x831f('0x3f')]};return db[_0x831f('0x2f')][_0x831f('0x1f')](_0x24dceb)['then'](function(_0x29e1ca){_0x291992[_0x831f('0x1f')]=_0x29e1ca;if(_0x483371['query'][_0x831f('0x43')]){_0x20d9a2[_0x831f('0x44')]=[{'all':!![]}];}return db['MailQueue'][_0x831f('0x45')](_0x20d9a2);})[_0x831f('0x27')](function(_0x725d6e){_0x291992[_0x831f('0x46')]=_0x725d6e;return _0x291992;})[_0x831f('0x27')](respondWithFilteredResult(_0x2f1cfa,_0x20d9a2))[_0x831f('0x47')](handleError(_0x2f1cfa,null));};exports['show']=function(_0x4d66a1,_0x5ec93a){var _0x90f193={'raw':!![],'where':{'id':_0x4d66a1[_0x831f('0x48')]['id']}},_0x514f4c={};_0x514f4c[_0x831f('0x37')]=_[_0x831f('0x33')](db[_0x831f('0x2f')][_0x831f('0x49')]);_0x514f4c[_0x831f('0x34')]=_[_0x831f('0x33')](_0x4d66a1['query']);_0x514f4c[_0x831f('0x40')]=_['intersection'](_0x514f4c[_0x831f('0x37')],_0x514f4c[_0x831f('0x34')]);_0x90f193[_0x831f('0x35')]=_['intersection'](_0x514f4c['model'],qs[_0x831f('0x38')](_0x4d66a1['query']['fields']));_0x90f193[_0x831f('0x35')]=_0x90f193['attributes'][_0x831f('0x39')]?_0x90f193[_0x831f('0x35')]:_0x514f4c['model'];if(_0x4d66a1[_0x831f('0x34')][_0x831f('0x43')]){_0x90f193[_0x831f('0x44')]=[{'all':!![]}];}_0x90f193=_[_0x831f('0x41')]({},_0x90f193,_0x4d66a1[_0x831f('0x42')]);return db['MailQueue']['find'](_0x90f193)[_0x831f('0x27')](handleEntityNotFound(_0x5ec93a,null))['then'](respondWithResult(_0x5ec93a,null))[_0x831f('0x47')](handleError(_0x5ec93a,null));};exports[_0x831f('0x4a')]=function(_0x5f203d,_0x1eb17f){return db['MailQueue'][_0x831f('0x4a')](_0x5f203d[_0x831f('0x4b')],{})['then'](function(_0x491692){var _0x3283cd=_0x5f203d[_0x831f('0x4c')][_0x831f('0x29')]({'plain':!![]});if(!_0x3283cd)throw new Error(_0x831f('0x4d'));if(_0x3283cd[_0x831f('0x4e')]===_0x831f('0x4c')){var _0xdbd17f=_0x491692[_0x831f('0x29')]({'plain':!![]});var _0x4bc9a3=_0x831f('0x4f');return db[_0x831f('0x50')]['find']({'where':{'name':_0x4bc9a3,'userProfileId':_0x3283cd[_0x831f('0x51')]},'raw':!![]})[_0x831f('0x27')](function(_0xc7afa4){if(_0xc7afa4&&_0xc7afa4[_0x831f('0x52')]===0x0){return db[_0x831f('0x2a')]['create']({'name':_0xdbd17f['name'],'resourceId':_0xdbd17f['id'],'type':_0xc7afa4[_0x831f('0x2c')],'sectionId':_0xc7afa4['id']},{})[_0x831f('0x27')](function(){return _0x491692;});}else{return _0x491692;}})[_0x831f('0x47')](function(_0xc89f3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc89f3);throw _0xc89f3;});}return _0x491692;})[_0x831f('0x27')](respondWithResult(_0x1eb17f,0xc9))[_0x831f('0x47')](handleError(_0x1eb17f,null));};exports['update']=function(_0x2cad99,_0x4489a0){if(_0x2cad99[_0x831f('0x4b')]['id']){delete _0x2cad99[_0x831f('0x4b')]['id'];}return db[_0x831f('0x2f')]['find']({'where':{'id':_0x2cad99['params']['id']}})[_0x831f('0x27')](handleEntityNotFound(_0x4489a0,null))[_0x831f('0x27')](saveUpdates(_0x2cad99['body'],null))['then'](respondWithResult(_0x4489a0,null))['catch'](handleError(_0x4489a0,null));};exports[_0x831f('0x28')]=function(_0x4ce5ee,_0x2ea48d){return db[_0x831f('0x2f')][_0x831f('0x53')]({'where':{'id':_0x4ce5ee[_0x831f('0x48')]['id']}})[_0x831f('0x27')](handleEntityNotFound(_0x2ea48d,null))[_0x831f('0x27')](removeEntity(_0x2ea48d,null))[_0x831f('0x47')](handleError(_0x2ea48d,null));};exports[_0x831f('0x54')]=function(_0x5de2a7,_0x2edf8a){return db[_0x831f('0x2f')][_0x831f('0x54')]()[_0x831f('0x27')](respondWithResult(_0x2edf8a,null))['catch'](handleError(_0x2edf8a,null));};exports['getMembers']=function(_0x1434cd,_0x60a42d,_0x2c6d2f){var _0x342171={'raw':!![],'where':{}},_0x160e2f={},_0x475fa8;return db['MailQueue'][_0x831f('0x55')]({'where':{'id':_0x1434cd[_0x831f('0x48')]['id']}})[_0x831f('0x27')](handleEntityNotFound(_0x60a42d,null))[_0x831f('0x27')](function(_0x324d7e){if(_0x324d7e){_0x475fa8=_0x324d7e[_0x831f('0x29')]({'plain':!![]});_0x160e2f['model']=_['keys'](db['UserMailQueue'][_0x831f('0x49')]);_0x160e2f[_0x831f('0x34')]=_[_0x831f('0x33')](_0x1434cd[_0x831f('0x34')]);_0x160e2f[_0x831f('0x40')]=_['intersection'](_0x160e2f[_0x831f('0x37')],_0x160e2f['query']);_0x342171['attributes']=_[_0x831f('0x36')](_0x160e2f[_0x831f('0x37')],qs[_0x831f('0x38')](_0x1434cd[_0x831f('0x34')][_0x831f('0x38')]));_0x342171[_0x831f('0x35')]=_0x342171[_0x831f('0x35')]['length']?_0x342171[_0x831f('0x35')]:_0x160e2f[_0x831f('0x37')];if(!_0x1434cd['query'][_0x831f('0x3a')](_0x831f('0x3b'))){_0x342171[_0x831f('0x3c')]=qs[_0x831f('0x3c')](_0x1434cd[_0x831f('0x34')][_0x831f('0x3c')]);_0x342171[_0x831f('0x20')]=qs[_0x831f('0x20')](_0x1434cd[_0x831f('0x34')]['offset']);}_0x342171[_0x831f('0x3d')]=qs[_0x831f('0x3e')](_0x1434cd['query'][_0x831f('0x3e')]);_0x342171['where']=qs[_0x831f('0x40')](_[_0x831f('0x56')](_0x1434cd[_0x831f('0x34')],_0x160e2f['filters']));_0x342171['where'][_0x831f('0x57')]=_0x324d7e['id'];if(_0x1434cd[_0x831f('0x34')]['filter']){_0x342171[_0x831f('0x3f')]=_[_0x831f('0x41')](_0x342171[_0x831f('0x3f')],{'$or':_[_0x831f('0x2e')](_0x342171[_0x831f('0x35')],function(_0x367542){var _0x62ed26={};_0x62ed26[_0x367542]={'$like':'%'+_0x1434cd[_0x831f('0x34')]['filter']+'%'};return _0x62ed26;})});}_0x342171=_[_0x831f('0x41')]({},_0x342171,_0x1434cd[_0x831f('0x42')]);return db[_0x831f('0x58')][_0x831f('0x45')](_0x342171);}})[_0x831f('0x27')](function(_0x37f255){if(_0x37f255){return db[_0x831f('0x59')][_0x831f('0x5a')]({'where':{'id':_[_0x831f('0x2e')](_0x37f255,_0x831f('0x5b')),'role':_0x831f('0x5c')},'attributes':['id','name','mailPause',_0x831f('0x5d'),_0x831f('0x5e')]});}})[_0x831f('0x27')](function(_0xc58a5e){if(_0xc58a5e){return{'count':_0xc58a5e[_0x831f('0x1f')],'rows':_[_0x831f('0x2e')](_0xc58a5e[_0x831f('0x46')],function(_0x3e0cc0){return{'membername':_0x3e0cc0[_0x831f('0x2c')],'UserId':_0x3e0cc0['id'],'queue_name':_0x475fa8[_0x831f('0x2c')],'MailQueueId':_0x475fa8['id'],'interface':util[_0x831f('0x5f')]('%s/%s',_0x831f('0x60'),_0x3e0cc0[_0x831f('0x2c')]),'penalty':0x0,'paused':_0x3e0cc0[_0x831f('0x61')],'createdAt':_0x3e0cc0[_0x831f('0x5e')],'updatedAt':_0x3e0cc0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x831f('0x27')](respondWithFilteredResult(_0x60a42d,_0x342171))[_0x831f('0x47')](handleError(_0x60a42d,null));};exports[_0x831f('0x62')]=function(_0xc720ff,_0xa2442c,_0x4cd469){var _0x24c0d7={};var _0x43902b={};var _0x15acc6;var _0x1c3d65;return db[_0x831f('0x2f')][_0x831f('0x55')]({'where':{'id':_0xc720ff['params']['id']}})[_0x831f('0x27')](handleEntityNotFound(_0xa2442c,null))[_0x831f('0x27')](function(_0x524b42){if(_0x524b42){_0x15acc6=_0x524b42;_0x43902b['model']=_[_0x831f('0x33')](db['Team'][_0x831f('0x49')]);_0x43902b[_0x831f('0x34')]=_['keys'](_0xc720ff[_0x831f('0x34')]);_0x43902b[_0x831f('0x40')]=_['intersection'](_0x43902b['model'],_0x43902b[_0x831f('0x34')]);_0x24c0d7[_0x831f('0x35')]=_[_0x831f('0x36')](_0x43902b[_0x831f('0x37')],qs[_0x831f('0x38')](_0xc720ff[_0x831f('0x34')][_0x831f('0x38')]));_0x24c0d7[_0x831f('0x35')]=_0x24c0d7['attributes'][_0x831f('0x39')]?_0x24c0d7[_0x831f('0x35')]:_0x43902b['model'];_0x24c0d7[_0x831f('0x3d')]=qs[_0x831f('0x3e')](_0xc720ff[_0x831f('0x34')]['sort']);_0x24c0d7[_0x831f('0x3f')]=qs[_0x831f('0x40')](_[_0x831f('0x56')](_0xc720ff[_0x831f('0x34')],_0x43902b[_0x831f('0x40')]));if(_0xc720ff[_0x831f('0x34')]['filter']){_0x24c0d7[_0x831f('0x3f')]=_['merge'](_0x24c0d7['where'],{'$or':_[_0x831f('0x2e')](_0x24c0d7[_0x831f('0x35')],function(_0x38b3b6){var _0x4918ed={};_0x4918ed[_0x38b3b6]={'$like':'%'+_0xc720ff[_0x831f('0x34')][_0x831f('0x63')]+'%'};return _0x4918ed;})});}_0x24c0d7=_['merge']({},_0x24c0d7,_0xc720ff[_0x831f('0x42')]);return _0x15acc6[_0x831f('0x62')](_0x24c0d7);}})[_0x831f('0x27')](function(_0x15110e){if(_0x15110e){_0x1c3d65=_0x15110e[_0x831f('0x39')];if(!_0xc720ff[_0x831f('0x34')][_0x831f('0x3a')]('nolimit')){_0x24c0d7[_0x831f('0x3c')]=qs[_0x831f('0x3c')](_0xc720ff[_0x831f('0x34')]['limit']);_0x24c0d7[_0x831f('0x20')]=qs[_0x831f('0x20')](_0xc720ff[_0x831f('0x34')][_0x831f('0x20')]);}return _0x15acc6['getTeams'](_0x24c0d7);}})[_0x831f('0x27')](function(_0x1cd639){if(_0x1cd639){return _0x1cd639?{'count':_0x1c3d65,'rows':_0x1cd639}:null;}})[_0x831f('0x27')](respondWithResult(_0xa2442c,null))[_0x831f('0x47')](handleError(_0xa2442c,null));};exports['addTeams']=function(_0x465d69,_0x58cc8a,_0x4ef596){var _0x2af1cd=_0x465d69[_0x831f('0x4b')][_0x831f('0x64')];return db[_0x831f('0x65')][_0x831f('0x45')]({'where':{'id':_0x2af1cd},'attributes':['id'],'include':[{'model':db[_0x831f('0x59')],'as':_0x831f('0x66'),'attributes':['id','name',_0x831f('0x67'),_0x831f('0x68'),_0x831f('0x69')],'raw':!![]}]})[_0x831f('0x27')](function(_0x4973fe){if(_0x4973fe){var _0x5c8437=_[_0x831f('0x6a')](_0x4973fe,function(_0x15fea0){var _0x756377=_0x15fea0[_0x831f('0x29')]({'plain':!![]});return _0x756377[_0x831f('0x66')];});return db[_0x831f('0x2f')]['find']({'where':{'id':_0x465d69['params']['id']}})[_0x831f('0x27')](function(_0x414f5b){return db['sequelize'][_0x831f('0x6b')](function(_0x5e56fc){return _0x414f5b[_0x831f('0x6c')](_0x2af1cd,{'transaction':_0x5e56fc})[_0x831f('0x27')](function(){return BPromise[_0x831f('0x6d')](_0x5c8437,function(_0x33ddd6){return db['UserMailQueue'][_0x831f('0x6e')]({'where':{'UserId':_0x33ddd6['id'],'MailQueueId':_0x465d69[_0x831f('0x48')]['id']},'transaction':_0x5e56fc});});})['then'](function(){_0x5c8437[_0x831f('0x6f')](function(_0x3662b8){socket[_0x831f('0x70')](_0x831f('0x71'),{'UserId':_0x3662b8['id'],'MailQueueId':_0x414f5b['id']});});});});});}})[_0x831f('0x27')](respondWithStatusCode(_0x58cc8a,null))[_0x831f('0x47')](handleError(_0x58cc8a,null));};exports[_0x831f('0x72')]=function(_0x23fd80,_0x4793f2,_0x15d1dd){return db[_0x831f('0x65')][_0x831f('0x45')]({'where':{'id':_0x23fd80[_0x831f('0x34')][_0x831f('0x64')]},'attributes':['id'],'include':[{'model':db[_0x831f('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x831f('0x27')](handleEntityNotFound(_0x4793f2,null))[_0x831f('0x27')](function(_0x4cbbe0){var _0x5de1d4=_[_0x831f('0x2e')](_0x4cbbe0,'id');var _0x2a8e0d=[];var _0x5c28d5=[];var _0x302b6e=squel['select']();_0x302b6e['field']('tq.TeamId')[_0x831f('0x73')]('team_has_mail_queues','tq')['join'](_0x831f('0x74'),'ut',_0x831f('0x75'))[_0x831f('0x3f')](_0x831f('0x76'),_0x23fd80['params']['id']);for(var _0x192319=0x0;_0x192319<_0x4cbbe0[_0x831f('0x39')];_0x192319+=0x1){let _0x3b8011=_0x4cbbe0[_0x192319];for(var _0x428f6e=0x0;_0x428f6e<_0x3b8011['Agents'][_0x831f('0x39')];_0x428f6e+=0x1){let _0x18d943=_0x3b8011[_0x831f('0x66')][_0x428f6e];var _0x3efbd6=_0x302b6e[_0x831f('0x77')]();_0x3efbd6['where'](_0x831f('0x78'),_0x18d943['id']);_0x5c28d5[_0x831f('0x79')](db[_0x831f('0x7a')]['query'](_0x3efbd6['toString'](),{'type':db['sequelize'][_0x831f('0x7b')][_0x831f('0x7c')]})[_0x831f('0x27')](function(_0x1f110a){if(_0x1f110a['length']===0x1){return _0x18d943['id'];}else{var _0x87d794=_[_0x831f('0x7d')](_[_0x831f('0x2e')](_0x1f110a,'TeamId'),function(_0x42fae8){return _[_0x831f('0x7e')](_0x5de1d4,_0x42fae8);});if(_0x87d794){return _0x18d943['id'];}}}));}}return BPromise[_0x831f('0x7f')](_0x5c28d5)[_0x831f('0x27')](function(_0x3222ef){_0x2a8e0d=_(_0x2a8e0d)['union'](_0x3222ef)[_0x831f('0x80')]()[_0x831f('0x81')]();return db['MailQueue'][_0x831f('0x53')]({'where':{'id':_0x23fd80['params']['id']}})[_0x831f('0x27')](function(_0x3dde9e){return db['sequelize'][_0x831f('0x6b')](function(_0x323a07){return _0x3dde9e[_0x831f('0x72')](_0x23fd80['query'][_0x831f('0x64')],{'transaction':_0x323a07})[_0x831f('0x27')](function(){if(!_['isEmpty'](_0x2a8e0d)){return _0x3dde9e[_0x831f('0x82')](_0x2a8e0d,{'transaction':_0x323a07});}})[_0x831f('0x27')](function(){_0x2a8e0d[_0x831f('0x6f')](function(_0x5356c7){socket[_0x831f('0x70')](_0x831f('0x83'),{'UserId':_0x5356c7,'MailQueueId':_0x3dde9e['id']});});});});});});})[_0x831f('0x27')](respondWithStatusCode(_0x4793f2,null))['catch'](handleError(_0x4793f2,null));};exports[_0x831f('0x84')]=function(_0x3551ac,_0x2f9d35,_0x54f8e0){return db['MailQueue'][_0x831f('0x53')]({'where':{'id':_0x3551ac[_0x831f('0x48')]['id']}})[_0x831f('0x27')](handleEntityNotFound(_0x2f9d35,null))[_0x831f('0x27')](function(_0x506d84){if(_0x506d84){return _0x506d84[_0x831f('0x84')](_0x3551ac[_0x831f('0x4b')][_0x831f('0x64')],_['omit'](_0x3551ac[_0x831f('0x4b')],[_0x831f('0x64'),'id'])||{})[_0x831f('0x85')](function(_0x24f413){for(var _0x309052=0x0;_0x309052<_0x3551ac['body'][_0x831f('0x64')][_0x831f('0x39')];_0x309052+=0x1){socket[_0x831f('0x70')](_0x831f('0x71'),{'UserId':_0x3551ac[_0x831f('0x4b')][_0x831f('0x64')][_0x309052],'MailQueueId':_0x3551ac[_0x831f('0x48')]['id']});}return _0x24f413;});}})['then'](respondWithResult(_0x2f9d35,null))[_0x831f('0x47')](handleError(_0x2f9d35,null));};exports['removeAgents']=function(_0x182842,_0x248887,_0x1d20e1){return db['MailQueue'][_0x831f('0x53')]({'where':{'id':_0x182842[_0x831f('0x48')]['id']}})[_0x831f('0x27')](handleEntityNotFound(_0x248887,null))[_0x831f('0x27')](function(_0x16a151){if(_0x16a151){return _0x16a151['removeAgents'](_0x182842[_0x831f('0x34')][_0x831f('0x64')])['then'](function(){if(_['isArray'](_0x182842[_0x831f('0x34')][_0x831f('0x64')])){for(var _0x2806da=0x0;_0x2806da<_0x182842[_0x831f('0x34')][_0x831f('0x64')][_0x831f('0x39')];_0x2806da+=0x1){socket[_0x831f('0x70')](_0x831f('0x83'),{'UserId':Number(_0x182842[_0x831f('0x34')][_0x831f('0x64')][_0x2806da]),'MailQueueId':Number(_0x182842[_0x831f('0x48')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x182842[_0x831f('0x34')][_0x831f('0x64')]),'MailQueueId':Number(_0x182842[_0x831f('0x48')]['id'])});}});}})[_0x831f('0x27')](respondWithStatusCode(_0x248887,null))[_0x831f('0x47')](handleError(_0x248887,null));};exports[_0x831f('0x86')]=function(_0x24cb56,_0x5783be,_0x4e4fc1){var _0x971d03={};var _0x3ec0cb={};var _0x89374b;var _0x4c17c6;return db[_0x831f('0x2f')][_0x831f('0x55')]({'where':{'id':_0x24cb56[_0x831f('0x48')]['id']}})[_0x831f('0x27')](handleEntityNotFound(_0x5783be,null))[_0x831f('0x27')](function(_0xe441bb){if(_0xe441bb){_0x89374b=_0xe441bb;_0x3ec0cb[_0x831f('0x37')]=_[_0x831f('0x33')](db[_0x831f('0x59')][_0x831f('0x49')]);_0x3ec0cb[_0x831f('0x34')]=_['keys'](_0x24cb56[_0x831f('0x34')]);_0x3ec0cb[_0x831f('0x40')]=_['intersection'](_0x3ec0cb[_0x831f('0x37')],_0x3ec0cb['query']);_0x971d03['attributes']=_['intersection'](_0x3ec0cb[_0x831f('0x37')],qs[_0x831f('0x38')](_0x24cb56[_0x831f('0x34')][_0x831f('0x38')]));_0x971d03['attributes']=_0x971d03[_0x831f('0x35')][_0x831f('0x39')]?_0x971d03[_0x831f('0x35')]:_0x3ec0cb[_0x831f('0x37')];_0x971d03[_0x831f('0x3d')]=qs['sort'](_0x24cb56[_0x831f('0x34')]['sort']);_0x971d03['where']=qs[_0x831f('0x40')](_[_0x831f('0x56')](_0x24cb56['query'],_0x3ec0cb[_0x831f('0x40')]));if(_0x24cb56[_0x831f('0x34')][_0x831f('0x63')]){_0x971d03[_0x831f('0x3f')]=_['merge'](_0x971d03[_0x831f('0x3f')],{'$or':_['map'](_0x971d03[_0x831f('0x35')],function(_0x3e940a){var _0x1752f3={};_0x1752f3[_0x3e940a]={'$like':'%'+_0x24cb56[_0x831f('0x34')][_0x831f('0x63')]+'%'};return _0x1752f3;})});}_0x971d03=_[_0x831f('0x41')]({},_0x971d03,_0x24cb56[_0x831f('0x42')]);return _0x89374b[_0x831f('0x86')](_0x971d03);}})[_0x831f('0x27')](function(_0x3fb26f){if(_0x3fb26f){_0x4c17c6=_0x3fb26f[_0x831f('0x39')];if(!_0x24cb56['query']['hasOwnProperty']('nolimit')){_0x971d03['limit']=qs['limit'](_0x24cb56[_0x831f('0x34')][_0x831f('0x3c')]);_0x971d03[_0x831f('0x20')]=qs[_0x831f('0x20')](_0x24cb56[_0x831f('0x34')][_0x831f('0x20')]);}return _0x89374b[_0x831f('0x86')](_0x971d03);}})[_0x831f('0x27')](function(_0x365389){if(_0x365389){return _0x365389?{'count':_0x4c17c6,'rows':_0x365389}:null;}})[_0x831f('0x27')](respondWithResult(_0x5783be,null))[_0x831f('0x47')](handleError(_0x5783be,null));}; \ No newline at end of file +var _0x9607=['interface','flatMap','findOrCreate','forEach','emit','userMailQueue:save','Agents','select','field','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','value','sequelize','userMailQueue:remove','addAgents','ids','removeAgents','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','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','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','MailQueue','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserMailQueue','pick','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','getTeams','Team','addTeams','online','voicePause'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9607,0xa0));var _0x7960=function(_0x372145,_0x224563){_0x372145=_0x372145-0x0;var _0x15a7ff=_0x9607[_0x372145];return _0x15a7ff;};'use strict';var pdf=require(_0x7960('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7960('0x1'));var zipdir=require(_0x7960('0x2'));var jsonpatch=require(_0x7960('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7960('0x4'));var util=require(_0x7960('0x5'));var path=require(_0x7960('0x6'));var sox=require(_0x7960('0x7'));var csv=require(_0x7960('0x8'));var ejs=require(_0x7960('0x9'));var fs=require('fs');var _=require(_0x7960('0xa'));var squel=require(_0x7960('0xb'));var crypto=require(_0x7960('0xc'));var jsforce=require(_0x7960('0xd'));var deskjs=require(_0x7960('0xe'));var toCsv=require(_0x7960('0x8'));var querystring=require(_0x7960('0xf'));var Papa=require(_0x7960('0x10'));var Redis=require(_0x7960('0x11'));var authService=require(_0x7960('0x12'));var qs=require(_0x7960('0x13'));var as=require(_0x7960('0x14'));var hardwareService=require(_0x7960('0x15'));var logger=require('../../config/logger')(_0x7960('0x16'));var utils=require(_0x7960('0x17'));var config=require(_0x7960('0x18'));var db=require('../../mysqldb')['db'];config[_0x7960('0x19')]=_[_0x7960('0x1a')](config[_0x7960('0x19')],{'host':_0x7960('0x1b'),'port':0x18eb});var socket=require(_0x7960('0x1c'))(new Redis(config['redis']));require(_0x7960('0x1d'))['register'](socket);function respondWithStatusCode(_0x6362d5,_0x3759d1){_0x3759d1=_0x3759d1||0xcc;return function(_0x416a73){if(_0x416a73){return _0x6362d5[_0x7960('0x1e')](_0x3759d1);}return _0x6362d5['status'](_0x3759d1)[_0x7960('0x1f')]();};}function respondWithResult(_0x38a798,_0x16a828){_0x16a828=_0x16a828||0xc8;return function(_0xe7c682){if(_0xe7c682){return _0x38a798[_0x7960('0x20')](_0x16a828)[_0x7960('0x21')](_0xe7c682);}};}function respondWithFilteredResult(_0xafe2c8,_0x3eb0ab){return function(_0x50df8a){if(_0x50df8a){var _0x37c5ef=_0x50df8a['count'],_0x40ec34=_0x3eb0ab[_0x7960('0x22')],_0x1e83cd=_0x3eb0ab['offset']+_0x3eb0ab[_0x7960('0x23')],_0x1def7e;if(_0x1e83cd>=_0x37c5ef){_0x1e83cd=_0x37c5ef;_0x1def7e=0xc8;}else{_0x1def7e=0xce;}_0xafe2c8['status'](_0x1def7e);return _0xafe2c8[_0x7960('0x24')](_0x7960('0x25'),_0x40ec34+'-'+_0x1e83cd+'/'+_0x37c5ef)[_0x7960('0x21')](_0x50df8a);}return null;};}function patchUpdates(_0x3416fc){return function(_0x2cae65){try{jsonpatch[_0x7960('0x26')](_0x2cae65,_0x3416fc,!![]);}catch(_0x273d20){return BPromise['reject'](_0x273d20);}return _0x2cae65[_0x7960('0x27')]();};}function saveUpdates(_0x1d922d,_0x5d81b){return function(_0x2bf261){if(_0x2bf261){return _0x2bf261[_0x7960('0x28')](_0x1d922d)[_0x7960('0x29')](function(_0x357253){return _0x357253;});}return null;};}function removeEntity(_0x1abb03,_0x5c4e06){return function(_0xab6d69){if(_0xab6d69){return _0xab6d69[_0x7960('0x2a')]()[_0x7960('0x29')](function(){var _0x670967=_0xab6d69[_0x7960('0x2b')]({'plain':!![]});var _0x801693='MailQueues';return db['UserProfileResource'][_0x7960('0x2a')]({'where':{'type':_0x801693,'resourceId':_0x670967['id']}})[_0x7960('0x29')](function(){return _0xab6d69;});})['then'](function(){_0x1abb03[_0x7960('0x20')](0xcc)[_0x7960('0x1f')]();});}};}function handleEntityNotFound(_0x41267a,_0x3ab03f){return function(_0x36ac09){if(!_0x36ac09){_0x41267a[_0x7960('0x1e')](0x194);}return _0x36ac09;};}function handleError(_0x25b065,_0x45cbc8){_0x45cbc8=_0x45cbc8||0x1f4;return function(_0x3babc5){logger[_0x7960('0x2c')](_0x3babc5[_0x7960('0x2d')]);if(_0x3babc5[_0x7960('0x2e')]){delete _0x3babc5[_0x7960('0x2e')];}_0x25b065[_0x7960('0x20')](_0x45cbc8)['send'](_0x3babc5);};}exports['index']=function(_0x3f6f97,_0x565f29){var _0x2c085b={},_0x3c3aaf={},_0x2bc0b5={'count':0x0,'rows':[]};var _0x54adb4=_['map'](db[_0x7960('0x2f')]['rawAttributes'],function(_0xb33372){return{'name':_0xb33372['fieldName'],'type':_0xb33372[_0x7960('0x30')][_0x7960('0x31')]};});_0x3c3aaf[_0x7960('0x32')]=_[_0x7960('0x33')](_0x54adb4,_0x7960('0x2e'));_0x3c3aaf[_0x7960('0x34')]=_[_0x7960('0x35')](_0x3f6f97[_0x7960('0x34')]);_0x3c3aaf[_0x7960('0x36')]=_[_0x7960('0x37')](_0x3c3aaf[_0x7960('0x32')],_0x3c3aaf[_0x7960('0x34')]);_0x2c085b[_0x7960('0x38')]=_['intersection'](_0x3c3aaf[_0x7960('0x32')],qs[_0x7960('0x39')](_0x3f6f97[_0x7960('0x34')][_0x7960('0x39')]));_0x2c085b[_0x7960('0x38')]=_0x2c085b[_0x7960('0x38')]['length']?_0x2c085b[_0x7960('0x38')]:_0x3c3aaf[_0x7960('0x32')];if(!_0x3f6f97[_0x7960('0x34')][_0x7960('0x3a')](_0x7960('0x3b'))){_0x2c085b['limit']=qs[_0x7960('0x23')](_0x3f6f97[_0x7960('0x34')][_0x7960('0x23')]);_0x2c085b[_0x7960('0x22')]=qs[_0x7960('0x22')](_0x3f6f97['query']['offset']);}_0x2c085b[_0x7960('0x3c')]=qs[_0x7960('0x3d')](_0x3f6f97[_0x7960('0x34')][_0x7960('0x3d')]);_0x2c085b[_0x7960('0x3e')]=qs['filters'](_['pick'](_0x3f6f97[_0x7960('0x34')],_0x3c3aaf[_0x7960('0x36')]),_0x54adb4);if(_0x3f6f97['query'][_0x7960('0x3f')]){_0x2c085b[_0x7960('0x3e')]=_[_0x7960('0x40')](_0x2c085b[_0x7960('0x3e')],{'$or':_[_0x7960('0x33')](_0x54adb4,function(_0x480489){if(_0x480489[_0x7960('0x30')]!==_0x7960('0x41')){var _0x12ab58={};_0x12ab58[_0x480489[_0x7960('0x2e')]]={'$like':'%'+_0x3f6f97[_0x7960('0x34')][_0x7960('0x3f')]+'%'};return _0x12ab58;}})});}_0x2c085b=_[_0x7960('0x40')]({},_0x2c085b,_0x3f6f97[_0x7960('0x42')]);var _0x4e3090={'where':_0x2c085b[_0x7960('0x3e')]};return db['MailQueue']['count'](_0x4e3090)[_0x7960('0x29')](function(_0x1cd0ee){_0x2bc0b5[_0x7960('0x43')]=_0x1cd0ee;if(_0x3f6f97[_0x7960('0x34')][_0x7960('0x44')]){_0x2c085b[_0x7960('0x45')]=[{'all':!![]}];}return db[_0x7960('0x2f')][_0x7960('0x46')](_0x2c085b);})[_0x7960('0x29')](function(_0x31c58d){_0x2bc0b5[_0x7960('0x47')]=_0x31c58d;return _0x2bc0b5;})[_0x7960('0x29')](respondWithFilteredResult(_0x565f29,_0x2c085b))[_0x7960('0x48')](handleError(_0x565f29,null));};exports['show']=function(_0x25b626,_0x408e11){var _0x20f56e={'raw':!![],'where':{'id':_0x25b626['params']['id']}},_0x118636={};_0x118636[_0x7960('0x32')]=_['keys'](db[_0x7960('0x2f')][_0x7960('0x49')]);_0x118636[_0x7960('0x34')]=_[_0x7960('0x35')](_0x25b626[_0x7960('0x34')]);_0x118636['filters']=_[_0x7960('0x37')](_0x118636[_0x7960('0x32')],_0x118636[_0x7960('0x34')]);_0x20f56e[_0x7960('0x38')]=_[_0x7960('0x37')](_0x118636['model'],qs[_0x7960('0x39')](_0x25b626['query'][_0x7960('0x39')]));_0x20f56e[_0x7960('0x38')]=_0x20f56e[_0x7960('0x38')][_0x7960('0x4a')]?_0x20f56e[_0x7960('0x38')]:_0x118636[_0x7960('0x32')];if(_0x25b626[_0x7960('0x34')][_0x7960('0x44')]){_0x20f56e[_0x7960('0x45')]=[{'all':!![]}];}_0x20f56e=_[_0x7960('0x40')]({},_0x20f56e,_0x25b626[_0x7960('0x42')]);return db[_0x7960('0x2f')][_0x7960('0x4b')](_0x20f56e)['then'](handleEntityNotFound(_0x408e11,null))[_0x7960('0x29')](respondWithResult(_0x408e11,null))[_0x7960('0x48')](handleError(_0x408e11,null));};exports[_0x7960('0x4c')]=function(_0x4ec0ac,_0xa8b84d){return db['MailQueue'][_0x7960('0x4c')](_0x4ec0ac[_0x7960('0x4d')],{})[_0x7960('0x29')](function(_0x94de36){var _0x15acc0=_0x4ec0ac[_0x7960('0x4e')][_0x7960('0x2b')]({'plain':!![]});if(!_0x15acc0)throw new Error(_0x7960('0x4f'));if(_0x15acc0['role']==='user'){var _0x5c078e=_0x94de36[_0x7960('0x2b')]({'plain':!![]});var _0x147b49='MailQueues';return db[_0x7960('0x50')][_0x7960('0x4b')]({'where':{'name':_0x147b49,'userProfileId':_0x15acc0[_0x7960('0x51')]},'raw':!![]})[_0x7960('0x29')](function(_0x6766f4){if(_0x6766f4&&_0x6766f4['autoAssociation']===0x0){return db[_0x7960('0x52')][_0x7960('0x4c')]({'name':_0x5c078e[_0x7960('0x2e')],'resourceId':_0x5c078e['id'],'type':_0x6766f4[_0x7960('0x2e')],'sectionId':_0x6766f4['id']},{})[_0x7960('0x29')](function(){return _0x94de36;});}else{return _0x94de36;}})['catch'](function(_0x2ba77f){logger[_0x7960('0x2c')](_0x7960('0x53'),_0x2ba77f);throw _0x2ba77f;});}return _0x94de36;})[_0x7960('0x29')](respondWithResult(_0xa8b84d,0xc9))[_0x7960('0x48')](handleError(_0xa8b84d,null));};exports[_0x7960('0x28')]=function(_0x25809a,_0x535ae1){if(_0x25809a[_0x7960('0x4d')]['id']){delete _0x25809a[_0x7960('0x4d')]['id'];}return db[_0x7960('0x2f')][_0x7960('0x4b')]({'where':{'id':_0x25809a[_0x7960('0x54')]['id']}})['then'](handleEntityNotFound(_0x535ae1,null))[_0x7960('0x29')](saveUpdates(_0x25809a[_0x7960('0x4d')],null))[_0x7960('0x29')](respondWithResult(_0x535ae1,null))['catch'](handleError(_0x535ae1,null));};exports[_0x7960('0x2a')]=function(_0x471fb7,_0x4fa827){return db['MailQueue'][_0x7960('0x4b')]({'where':{'id':_0x471fb7[_0x7960('0x54')]['id']}})[_0x7960('0x29')](handleEntityNotFound(_0x4fa827,null))['then'](removeEntity(_0x4fa827,null))[_0x7960('0x48')](handleError(_0x4fa827,null));};exports[_0x7960('0x55')]=function(_0x1eefd3,_0x55a33e){return db['MailQueue'][_0x7960('0x55')]()['then'](respondWithResult(_0x55a33e,null))['catch'](handleError(_0x55a33e,null));};exports['getMembers']=function(_0x2b435c,_0x28500a,_0x1591c6){var _0x43d25b={'raw':!![],'where':{}},_0x90194={},_0xf95490;return db[_0x7960('0x2f')][_0x7960('0x56')]({'where':{'id':_0x2b435c['params']['id']}})[_0x7960('0x29')](handleEntityNotFound(_0x28500a,null))[_0x7960('0x29')](function(_0x2b0e03){if(_0x2b0e03){_0xf95490=_0x2b0e03[_0x7960('0x2b')]({'plain':!![]});_0x90194[_0x7960('0x32')]=_[_0x7960('0x35')](db[_0x7960('0x57')]['rawAttributes']);_0x90194[_0x7960('0x34')]=_['keys'](_0x2b435c[_0x7960('0x34')]);_0x90194[_0x7960('0x36')]=_[_0x7960('0x37')](_0x90194[_0x7960('0x32')],_0x90194[_0x7960('0x34')]);_0x43d25b[_0x7960('0x38')]=_[_0x7960('0x37')](_0x90194[_0x7960('0x32')],qs['fields'](_0x2b435c['query'][_0x7960('0x39')]));_0x43d25b[_0x7960('0x38')]=_0x43d25b[_0x7960('0x38')][_0x7960('0x4a')]?_0x43d25b[_0x7960('0x38')]:_0x90194[_0x7960('0x32')];if(!_0x2b435c[_0x7960('0x34')][_0x7960('0x3a')](_0x7960('0x3b'))){_0x43d25b[_0x7960('0x23')]=qs['limit'](_0x2b435c[_0x7960('0x34')][_0x7960('0x23')]);_0x43d25b[_0x7960('0x22')]=qs[_0x7960('0x22')](_0x2b435c[_0x7960('0x34')][_0x7960('0x22')]);}_0x43d25b[_0x7960('0x3c')]=qs['sort'](_0x2b435c['query']['sort']);_0x43d25b['where']=qs['filters'](_[_0x7960('0x58')](_0x2b435c[_0x7960('0x34')],_0x90194[_0x7960('0x36')]));_0x43d25b['where'][_0x7960('0x59')]=_0x2b0e03['id'];if(_0x2b435c[_0x7960('0x34')][_0x7960('0x3f')]){_0x43d25b[_0x7960('0x3e')]=_[_0x7960('0x40')](_0x43d25b['where'],{'$or':_['map'](_0x43d25b['attributes'],function(_0x3d6ef3){var _0x310d24={};_0x310d24[_0x3d6ef3]={'$like':'%'+_0x2b435c[_0x7960('0x34')][_0x7960('0x3f')]+'%'};return _0x310d24;})});}_0x43d25b=_[_0x7960('0x40')]({},_0x43d25b,_0x2b435c[_0x7960('0x42')]);return db[_0x7960('0x57')]['findAll'](_0x43d25b);}})['then'](function(_0x1637d3){if(_0x1637d3){return db[_0x7960('0x5a')][_0x7960('0x5b')]({'where':{'id':_[_0x7960('0x33')](_0x1637d3,_0x7960('0x5c')),'role':'agent'},'attributes':['id','name',_0x7960('0x5d'),_0x7960('0x5e'),_0x7960('0x5f')]});}})[_0x7960('0x29')](function(_0x523f48){if(_0x523f48){return{'count':_0x523f48[_0x7960('0x43')],'rows':_[_0x7960('0x33')](_0x523f48[_0x7960('0x47')],function(_0x27d3ad){return{'membername':_0x27d3ad[_0x7960('0x2e')],'UserId':_0x27d3ad['id'],'queue_name':_0xf95490[_0x7960('0x2e')],'MailQueueId':_0xf95490['id'],'interface':util[_0x7960('0x60')]('%s/%s','SIP',_0x27d3ad[_0x7960('0x2e')]),'penalty':0x0,'paused':_0x27d3ad[_0x7960('0x5d')],'createdAt':_0x27d3ad[_0x7960('0x5f')],'updatedAt':_0x27d3ad['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x28500a,_0x43d25b))['catch'](handleError(_0x28500a,null));};exports[_0x7960('0x61')]=function(_0x1d9649,_0x402c80,_0x524b89){var _0x1c9ac4={};var _0x27ce57={};var _0x2aa831;var _0x3c6076;return db['MailQueue'][_0x7960('0x56')]({'where':{'id':_0x1d9649['params']['id']}})[_0x7960('0x29')](handleEntityNotFound(_0x402c80,null))[_0x7960('0x29')](function(_0x25ee7a){if(_0x25ee7a){_0x2aa831=_0x25ee7a;_0x27ce57['model']=_[_0x7960('0x35')](db[_0x7960('0x62')][_0x7960('0x49')]);_0x27ce57[_0x7960('0x34')]=_[_0x7960('0x35')](_0x1d9649['query']);_0x27ce57[_0x7960('0x36')]=_['intersection'](_0x27ce57[_0x7960('0x32')],_0x27ce57[_0x7960('0x34')]);_0x1c9ac4[_0x7960('0x38')]=_[_0x7960('0x37')](_0x27ce57['model'],qs[_0x7960('0x39')](_0x1d9649[_0x7960('0x34')]['fields']));_0x1c9ac4[_0x7960('0x38')]=_0x1c9ac4['attributes']['length']?_0x1c9ac4[_0x7960('0x38')]:_0x27ce57['model'];_0x1c9ac4[_0x7960('0x3c')]=qs[_0x7960('0x3d')](_0x1d9649[_0x7960('0x34')][_0x7960('0x3d')]);_0x1c9ac4[_0x7960('0x3e')]=qs['filters'](_[_0x7960('0x58')](_0x1d9649[_0x7960('0x34')],_0x27ce57[_0x7960('0x36')]));if(_0x1d9649[_0x7960('0x34')][_0x7960('0x3f')]){_0x1c9ac4[_0x7960('0x3e')]=_[_0x7960('0x40')](_0x1c9ac4[_0x7960('0x3e')],{'$or':_[_0x7960('0x33')](_0x1c9ac4[_0x7960('0x38')],function(_0x44d670){var _0x578a06={};_0x578a06[_0x44d670]={'$like':'%'+_0x1d9649[_0x7960('0x34')][_0x7960('0x3f')]+'%'};return _0x578a06;})});}_0x1c9ac4=_[_0x7960('0x40')]({},_0x1c9ac4,_0x1d9649[_0x7960('0x42')]);return _0x2aa831[_0x7960('0x61')](_0x1c9ac4);}})['then'](function(_0x3056a1){if(_0x3056a1){_0x3c6076=_0x3056a1['length'];if(!_0x1d9649[_0x7960('0x34')][_0x7960('0x3a')]('nolimit')){_0x1c9ac4[_0x7960('0x23')]=qs[_0x7960('0x23')](_0x1d9649['query'][_0x7960('0x23')]);_0x1c9ac4[_0x7960('0x22')]=qs[_0x7960('0x22')](_0x1d9649[_0x7960('0x34')][_0x7960('0x22')]);}return _0x2aa831['getTeams'](_0x1c9ac4);}})[_0x7960('0x29')](function(_0x39d791){if(_0x39d791){return _0x39d791?{'count':_0x3c6076,'rows':_0x39d791}:null;}})[_0x7960('0x29')](respondWithResult(_0x402c80,null))[_0x7960('0x48')](handleError(_0x402c80,null));};exports[_0x7960('0x63')]=function(_0x2962f9,_0x238669,_0x5708b6){var _0x234086=_0x2962f9['body']['ids'];return db[_0x7960('0x62')]['findAll']({'where':{'id':_0x234086},'attributes':['id'],'include':[{'model':db[_0x7960('0x5a')],'as':'Agents','attributes':['id',_0x7960('0x2e'),_0x7960('0x64'),_0x7960('0x65'),_0x7960('0x66')],'raw':!![]}]})[_0x7960('0x29')](function(_0x32b667){if(_0x32b667){var _0x36174c=_[_0x7960('0x67')](_0x32b667,function(_0x579bf5){var _0x427550=_0x579bf5[_0x7960('0x2b')]({'plain':!![]});return _0x427550['Agents'];});return db[_0x7960('0x2f')][_0x7960('0x4b')]({'where':{'id':_0x2962f9['params']['id']}})[_0x7960('0x29')](function(_0xa06353){return db['sequelize']['transaction'](function(_0x187038){return _0xa06353[_0x7960('0x63')](_0x234086,{'transaction':_0x187038})['then'](function(){return BPromise['each'](_0x36174c,function(_0x54ca0c){return db[_0x7960('0x57')][_0x7960('0x68')]({'where':{'UserId':_0x54ca0c['id'],'MailQueueId':_0x2962f9[_0x7960('0x54')]['id']},'transaction':_0x187038});});})[_0x7960('0x29')](function(){_0x36174c[_0x7960('0x69')](function(_0x263f99){socket[_0x7960('0x6a')](_0x7960('0x6b'),{'UserId':_0x263f99['id'],'MailQueueId':_0xa06353['id']});});});});});}})['then'](respondWithStatusCode(_0x238669,null))['catch'](handleError(_0x238669,null));};exports['removeTeams']=function(_0x53ce70,_0x16f719,_0x345a1e){return db['Team']['findAll']({'where':{'id':_0x53ce70[_0x7960('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7960('0x5a')],'as':_0x7960('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x16f719,null))[_0x7960('0x29')](function(_0x1f24ed){var _0x305163=_[_0x7960('0x33')](_0x1f24ed,'id');var _0x333ca3=[];var _0x5092b4=[];var _0x5c56df=squel[_0x7960('0x6d')]();_0x5c56df[_0x7960('0x6e')]('tq.TeamId')['from'](_0x7960('0x6f'),'tq')[_0x7960('0x70')](_0x7960('0x71'),'ut',_0x7960('0x72'))['where']('MailQueueId\x20=\x20?',_0x53ce70[_0x7960('0x54')]['id']);for(var _0x46172c=0x0;_0x46172c<_0x1f24ed[_0x7960('0x4a')];_0x46172c+=0x1){let _0x507cc6=_0x1f24ed[_0x46172c];for(var _0x262584=0x0;_0x262584<_0x507cc6[_0x7960('0x6c')]['length'];_0x262584+=0x1){let _0x10cdc5=_0x507cc6[_0x7960('0x6c')][_0x262584];var _0x16e8ae=_0x5c56df[_0x7960('0x73')]();_0x16e8ae[_0x7960('0x3e')](_0x7960('0x74'),_0x10cdc5['id']);_0x5092b4[_0x7960('0x75')](db['sequelize']['query'](_0x16e8ae[_0x7960('0x76')](),{'type':db['sequelize']['QueryTypes'][_0x7960('0x77')]})[_0x7960('0x29')](function(_0x17a93a){if(_0x17a93a[_0x7960('0x4a')]===0x1){return _0x10cdc5['id'];}else{var _0x5e67c4=_[_0x7960('0x78')](_[_0x7960('0x33')](_0x17a93a,_0x7960('0x79')),function(_0x2eccbf){return _[_0x7960('0x7a')](_0x305163,_0x2eccbf);});if(_0x5e67c4){return _0x10cdc5['id'];}}}));}}return BPromise['all'](_0x5092b4)[_0x7960('0x29')](function(_0xb467d2){_0x333ca3=_(_0x333ca3)[_0x7960('0x7b')](_0xb467d2)['compact']()[_0x7960('0x7c')]();return db['MailQueue'][_0x7960('0x4b')]({'where':{'id':_0x53ce70[_0x7960('0x54')]['id']}})[_0x7960('0x29')](function(_0x498ea7){return db[_0x7960('0x7d')]['transaction'](function(_0x48e563){return _0x498ea7['removeTeams'](_0x53ce70[_0x7960('0x34')]['ids'],{'transaction':_0x48e563})[_0x7960('0x29')](function(){if(!_['isEmpty'](_0x333ca3)){return _0x498ea7['removeAgents'](_0x333ca3,{'transaction':_0x48e563});}})['then'](function(){_0x333ca3[_0x7960('0x69')](function(_0xd3b201){socket[_0x7960('0x6a')](_0x7960('0x7e'),{'UserId':_0xd3b201,'MailQueueId':_0x498ea7['id']});});});});});});})['then'](respondWithStatusCode(_0x16f719,null))[_0x7960('0x48')](handleError(_0x16f719,null));};exports[_0x7960('0x7f')]=function(_0x335122,_0x4ce6c5,_0x5dba64){return db['MailQueue']['find']({'where':{'id':_0x335122[_0x7960('0x54')]['id']}})['then'](handleEntityNotFound(_0x4ce6c5,null))['then'](function(_0x554d2b){if(_0x554d2b){return _0x554d2b[_0x7960('0x7f')](_0x335122[_0x7960('0x4d')][_0x7960('0x80')],_['omit'](_0x335122[_0x7960('0x4d')],['ids','id'])||{})['spread'](function(_0x1f8d1a){for(var _0x56a963=0x0;_0x56a963<_0x335122[_0x7960('0x4d')][_0x7960('0x80')]['length'];_0x56a963+=0x1){socket['emit'](_0x7960('0x6b'),{'UserId':_0x335122[_0x7960('0x4d')]['ids'][_0x56a963],'MailQueueId':_0x335122['params']['id']});}return _0x1f8d1a;});}})['then'](respondWithResult(_0x4ce6c5,null))[_0x7960('0x48')](handleError(_0x4ce6c5,null));};exports[_0x7960('0x81')]=function(_0x49fc3d,_0x58d333,_0x2d6f40){return db[_0x7960('0x2f')]['find']({'where':{'id':_0x49fc3d[_0x7960('0x54')]['id']}})[_0x7960('0x29')](handleEntityNotFound(_0x58d333,null))[_0x7960('0x29')](function(_0xe811d7){if(_0xe811d7){return _0xe811d7[_0x7960('0x81')](_0x49fc3d[_0x7960('0x34')][_0x7960('0x80')])[_0x7960('0x29')](function(){if(_['isArray'](_0x49fc3d[_0x7960('0x34')][_0x7960('0x80')])){for(var _0xecf19a=0x0;_0xecf19a<_0x49fc3d[_0x7960('0x34')][_0x7960('0x80')]['length'];_0xecf19a+=0x1){socket[_0x7960('0x6a')](_0x7960('0x7e'),{'UserId':Number(_0x49fc3d[_0x7960('0x34')][_0x7960('0x80')][_0xecf19a]),'MailQueueId':Number(_0x49fc3d['params']['id'])});}}else{socket[_0x7960('0x6a')](_0x7960('0x7e'),{'UserId':Number(_0x49fc3d[_0x7960('0x34')][_0x7960('0x80')]),'MailQueueId':Number(_0x49fc3d[_0x7960('0x54')]['id'])});}});}})[_0x7960('0x29')](respondWithStatusCode(_0x58d333,null))[_0x7960('0x48')](handleError(_0x58d333,null));};exports[_0x7960('0x82')]=function(_0x48ff94,_0x3daa10,_0x52f5e1){var _0x388660={};var _0x125850={};var _0x19e5e0;var _0x46fc2c;return db[_0x7960('0x2f')][_0x7960('0x56')]({'where':{'id':_0x48ff94[_0x7960('0x54')]['id']}})[_0x7960('0x29')](handleEntityNotFound(_0x3daa10,null))[_0x7960('0x29')](function(_0x2a97ef){if(_0x2a97ef){_0x19e5e0=_0x2a97ef;_0x125850[_0x7960('0x32')]=_['keys'](db[_0x7960('0x5a')][_0x7960('0x49')]);_0x125850[_0x7960('0x34')]=_[_0x7960('0x35')](_0x48ff94[_0x7960('0x34')]);_0x125850[_0x7960('0x36')]=_[_0x7960('0x37')](_0x125850[_0x7960('0x32')],_0x125850['query']);_0x388660['attributes']=_[_0x7960('0x37')](_0x125850[_0x7960('0x32')],qs[_0x7960('0x39')](_0x48ff94[_0x7960('0x34')]['fields']));_0x388660['attributes']=_0x388660[_0x7960('0x38')][_0x7960('0x4a')]?_0x388660['attributes']:_0x125850['model'];_0x388660[_0x7960('0x3c')]=qs[_0x7960('0x3d')](_0x48ff94[_0x7960('0x34')]['sort']);_0x388660[_0x7960('0x3e')]=qs[_0x7960('0x36')](_['pick'](_0x48ff94[_0x7960('0x34')],_0x125850[_0x7960('0x36')]));if(_0x48ff94[_0x7960('0x34')][_0x7960('0x3f')]){_0x388660['where']=_[_0x7960('0x40')](_0x388660[_0x7960('0x3e')],{'$or':_[_0x7960('0x33')](_0x388660['attributes'],function(_0x1f5a20){var _0x1526f8={};_0x1526f8[_0x1f5a20]={'$like':'%'+_0x48ff94[_0x7960('0x34')][_0x7960('0x3f')]+'%'};return _0x1526f8;})});}_0x388660=_[_0x7960('0x40')]({},_0x388660,_0x48ff94[_0x7960('0x42')]);return _0x19e5e0[_0x7960('0x82')](_0x388660);}})[_0x7960('0x29')](function(_0x43cf9a){if(_0x43cf9a){_0x46fc2c=_0x43cf9a[_0x7960('0x4a')];if(!_0x48ff94['query']['hasOwnProperty'](_0x7960('0x3b'))){_0x388660[_0x7960('0x23')]=qs[_0x7960('0x23')](_0x48ff94[_0x7960('0x34')]['limit']);_0x388660[_0x7960('0x22')]=qs[_0x7960('0x22')](_0x48ff94['query'][_0x7960('0x22')]);}return _0x19e5e0['getAgents'](_0x388660);}})[_0x7960('0x29')](function(_0x2ca55b){if(_0x2ca55b){return _0x2ca55b?{'count':_0x46fc2c,'rows':_0x2ca55b}:null;}})[_0x7960('0x29')](respondWithResult(_0x3daa10,null))[_0x7960('0x48')](handleError(_0x3daa10,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5d0c033..27180d1 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 _0x81ae=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x42f85f,_0x58e64e){var _0x4d1417=function(_0x2d98c5){while(--_0x2d98c5){_0x42f85f['push'](_0x42f85f['shift']());}};_0x4d1417(++_0x58e64e);}(_0x81ae,0x8c));var _0xe81a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x81ae[_0x53ccf2];return _0x5a2964;};'use strict';var EventEmitter=require(_0xe81a('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe81a('0x1')](0x0);var events={'afterCreate':_0xe81a('0x2'),'afterUpdate':_0xe81a('0x3'),'afterDestroy':_0xe81a('0x4')};function emitEvent(_0x1c4dc2){return function(_0x3d5151,_0x28a76b,_0x5b2abf){MailQueueEvents[_0xe81a('0x5')](_0x1c4dc2+':'+_0x3d5151['id'],_0x3d5151);MailQueueEvents[_0xe81a('0x5')](_0x1c4dc2,_0x3d5151);_0x5b2abf(null);};}for(var e in events){if(events[_0xe81a('0x6')](e)){var event=events[e];MailQueue[_0xe81a('0x7')](e,emitEvent(event));}}module[_0xe81a('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x07ca=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x2a63f3,_0x3caa75){var _0x46b4e6=function(_0xed1d41){while(--_0xed1d41){_0x2a63f3['push'](_0x2a63f3['shift']());}};_0x46b4e6(++_0x3caa75);}(_0x07ca,0x1a6));var _0xa07c=function(_0xdd9a5f,_0x3ced93){_0xdd9a5f=_0xdd9a5f-0x0;var _0x3464b7=_0x07ca[_0xdd9a5f];return _0x3464b7;};'use strict';var EventEmitter=require(_0xa07c('0x0'));var MailQueue=require(_0xa07c('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa07c('0x2')](0x0);var events={'afterCreate':_0xa07c('0x3'),'afterUpdate':_0xa07c('0x4'),'afterDestroy':_0xa07c('0x5')};function emitEvent(_0x482bfc){return function(_0x4d332d,_0xce5c1b,_0xccc097){MailQueueEvents['emit'](_0x482bfc+':'+_0x4d332d['id'],_0x4d332d);MailQueueEvents[_0xa07c('0x6')](_0x482bfc,_0x4d332d);_0xccc097(null);};}for(var e in events){if(events[_0xa07c('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xa07c('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index fc7a826..48b2c8e 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 _0x528f=['path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x528f,0x19e));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf528('0x0'));var util=require(_0xf528('0x1'));var logger=require('../../config/logger')(_0xf528('0x2'));var moment=require(_0xf528('0x3'));var BPromise=require(_0xf528('0x4'));var rp=require(_0xf528('0x5'));var fs=require('fs');var path=require(_0xf528('0x6'));var rimraf=require(_0xf528('0x7'));var config=require(_0xf528('0x8'));var attributes=require(_0xf528('0x9'));module[_0xf528('0xa')]=function(_0x322e4c,_0x1264b8){return _0x322e4c[_0xf528('0xb')](_0xf528('0xc'),attributes,{'tableName':_0xf528('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccfd=['exports','MailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x3d075a,_0x507f04){var _0x418be1=function(_0x19c75b){while(--_0x19c75b){_0x3d075a['push'](_0x3d075a['shift']());}};_0x418be1(++_0x507f04);}(_0xccfd,0x161));var _0xdccf=function(_0x8c8643,_0x2ddd9b){_0x8c8643=_0x8c8643-0x0;var _0x5bd91a=_0xccfd[_0x8c8643];return _0x5bd91a;};'use strict';var _=require(_0xdccf('0x0'));var util=require(_0xdccf('0x1'));var logger=require(_0xdccf('0x2'))(_0xdccf('0x3'));var moment=require(_0xdccf('0x4'));var BPromise=require(_0xdccf('0x5'));var rp=require(_0xdccf('0x6'));var fs=require('fs');var path=require(_0xdccf('0x7'));var rimraf=require(_0xdccf('0x8'));var config=require(_0xdccf('0x9'));var attributes=require(_0xdccf('0xa'));module[_0xdccf('0xb')]=function(_0xf58792,_0x43014c){return _0xf58792['define'](_0xdccf('0xc'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index fba5854..9dd3562 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 _0x132b=['request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetMailQueue','ShowMailQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x132b,0x8d));var _0xb132=function(_0x479f1e,_0x5c0dab){_0x479f1e=_0x479f1e-0x0;var _0xdf9172=_0x132b[_0x479f1e];return _0xdf9172;};'use strict';var _=require(_0xb132('0x0'));var util=require(_0xb132('0x1'));var moment=require('moment');var BPromise=require(_0xb132('0x2'));var rs=require(_0xb132('0x3'));var fs=require('fs');var Redis=require(_0xb132('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb132('0x5'));var logger=require(_0xb132('0x6'))('rpc');var config=require(_0xb132('0x7'));var jayson=require(_0xb132('0x8'));var client=jayson['client'][_0xb132('0x9')]({'port':0x232a});config[_0xb132('0xa')]=_[_0xb132('0xb')](config['redis'],{'host':_0xb132('0xc'),'port':0x18eb});var socket=require(_0xb132('0xd'))(new Redis(config[_0xb132('0xa')]));require('./mailQueue.socket')[_0xb132('0xe')](socket);function respondWithRpcPromise(_0x4741b7,_0x240c7c,_0x3c3c96){return new BPromise(function(_0x123f5b,_0x4a7934){return client[_0xb132('0xf')](_0x4741b7,_0x3c3c96)[_0xb132('0x10')](function(_0x3fa7ac){logger[_0xb132('0x11')](_0xb132('0x12'),_0x240c7c,_0xb132('0x13'));logger[_0xb132('0x14')](_0xb132('0x15'),_0x240c7c,_0xb132('0x13'),JSON[_0xb132('0x16')](_0x3fa7ac));if(_0x3fa7ac[_0xb132('0x17')]){if(_0x3fa7ac['error'][_0xb132('0x18')]===0x1f4){logger[_0xb132('0x17')]('MailQueue,\x20%s,\x20%s',_0x240c7c,_0x3fa7ac[_0xb132('0x17')][_0xb132('0x19')]);return _0x4a7934(_0x3fa7ac[_0xb132('0x17')][_0xb132('0x19')]);}logger[_0xb132('0x17')](_0xb132('0x12'),_0x240c7c,_0x3fa7ac['error'][_0xb132('0x19')]);return _0x123f5b(_0x3fa7ac[_0xb132('0x17')][_0xb132('0x19')]);}else{logger[_0xb132('0x11')](_0xb132('0x12'),_0x240c7c,_0xb132('0x13'));_0x123f5b(_0x3fa7ac['result'][_0xb132('0x19')]);}})[_0xb132('0x1a')](function(_0x4a08a4){logger[_0xb132('0x17')](_0xb132('0x12'),_0x240c7c,_0x4a08a4);_0x4a7934(_0x4a08a4);});});}exports['GetMailQueue']=function(_0x4f33a1){var _0x2f0360=this;return new Promise(function(_0x1521b0,_0x2cf9e7){return db[_0xb132('0x1b')][_0xb132('0x1c')]({'raw':_0x4f33a1['options']?_0x4f33a1[_0xb132('0x1d')][_0xb132('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f33a1[_0xb132('0x1d')]?_0x4f33a1[_0xb132('0x1d')][_0xb132('0x1f')]||null:null,'attributes':_0x4f33a1[_0xb132('0x1d')]?_0x4f33a1['options'][_0xb132('0x20')]||null:null,'limit':_0x4f33a1[_0xb132('0x1d')]?_0x4f33a1[_0xb132('0x1d')][_0xb132('0x21')]||null:null,'include':_0x4f33a1['options']?_0x4f33a1[_0xb132('0x1d')]['include']?_[_0xb132('0x22')](_0x4f33a1[_0xb132('0x1d')][_0xb132('0x23')],function(_0x4d8d96){return{'model':db[_0x4d8d96[_0xb132('0x24')]],'as':_0x4d8d96['as'],'attributes':_0x4d8d96[_0xb132('0x20')],'include':_0x4d8d96[_0xb132('0x23')]?_[_0xb132('0x22')](_0x4d8d96[_0xb132('0x23')],function(_0x191d4d){return{'model':db[_0x191d4d[_0xb132('0x24')]],'as':_0x191d4d['as'],'attributes':_0x191d4d[_0xb132('0x20')],'include':_0x191d4d['include']?_[_0xb132('0x22')](_0x191d4d[_0xb132('0x23')],function(_0xf4e443){return{'model':db[_0xf4e443[_0xb132('0x24')]],'as':_0xf4e443['as'],'attributes':_0xf4e443['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ec8d4){logger[_0xb132('0x11')](_0xb132('0x25'),_0x4f33a1);logger['debug']('GetMailQueue',_0x4f33a1,JSON[_0xb132('0x16')](_0x2ec8d4));_0x1521b0(_0x2ec8d4);})[_0xb132('0x1a')](function(_0x314bcc){logger[_0xb132('0x17')](_0xb132('0x25'),_0x314bcc[_0xb132('0x19')],_0x4f33a1);_0x2cf9e7(_0x2f0360[_0xb132('0x17')](0x1f4,_0x314bcc['message']));});});};exports[_0xb132('0x26')]=function(_0x169ea0){var _0x16b055=this;return new Promise(function(_0x30ee7d,_0x1b5c81){return db[_0xb132('0x1b')][_0xb132('0x27')]({'raw':_0x169ea0[_0xb132('0x1d')]?_0x169ea0[_0xb132('0x1d')][_0xb132('0x1e')]===undefined?!![]:![]:!![],'where':_0x169ea0[_0xb132('0x1d')]?_0x169ea0[_0xb132('0x1d')][_0xb132('0x1f')]||null:null,'attributes':_0x169ea0[_0xb132('0x1d')]?_0x169ea0['options'][_0xb132('0x20')]||null:null,'include':_0x169ea0[_0xb132('0x1d')]?_0x169ea0[_0xb132('0x1d')]['include']?_['map'](_0x169ea0[_0xb132('0x1d')][_0xb132('0x23')],function(_0x20725b){return{'model':db[_0x20725b[_0xb132('0x24')]],'as':_0x20725b['as'],'attributes':_0x20725b[_0xb132('0x20')],'include':_0x20725b[_0xb132('0x23')]?_[_0xb132('0x22')](_0x20725b[_0xb132('0x23')],function(_0x45f87f){return{'model':db[_0x45f87f['model']],'as':_0x45f87f['as'],'attributes':_0x45f87f[_0xb132('0x20')],'include':_0x45f87f[_0xb132('0x23')]?_['map'](_0x45f87f[_0xb132('0x23')],function(_0x4827a5){return{'model':db[_0x4827a5[_0xb132('0x24')]],'as':_0x4827a5['as'],'attributes':_0x4827a5[_0xb132('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb132('0x10')](function(_0x2836da){logger[_0xb132('0x11')](_0xb132('0x26'),_0x169ea0);logger[_0xb132('0x14')](_0xb132('0x26'),_0x169ea0,JSON[_0xb132('0x16')](_0x2836da));_0x30ee7d(_0x2836da);})['catch'](function(_0x10732c){logger['error'](_0xb132('0x26'),_0x10732c[_0xb132('0x19')],_0x169ea0);_0x1b5c81(_0x16b055[_0xb132('0x17')](0x1f4,_0x10732c[_0xb132('0x19')]));});});}; \ No newline at end of file +var _0x2f5a=['catch','ShowMailQueue','find','raw','where','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMailQueue','MailQueue','findAll','options','attributes','include','map','model'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x2f5a,0x1e6));var _0xa2f5=function(_0x402a43,_0x68abb5){_0x402a43=_0x402a43-0x0;var _0xe8bc0=_0x2f5a[_0x402a43];return _0xe8bc0;};'use strict';var _=require('lodash');var util=require(_0xa2f5('0x0'));var moment=require('moment');var BPromise=require(_0xa2f5('0x1'));var rs=require(_0xa2f5('0x2'));var fs=require('fs');var Redis=require(_0xa2f5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2f5('0x4'));var logger=require(_0xa2f5('0x5'))(_0xa2f5('0x6'));var config=require('../../config/environment');var jayson=require(_0xa2f5('0x7'));var client=jayson[_0xa2f5('0x8')]['http']({'port':0x232a});config[_0xa2f5('0x9')]=_[_0xa2f5('0xa')](config[_0xa2f5('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2f5('0xb'))(new Redis(config[_0xa2f5('0x9')]));require(_0xa2f5('0xc'))[_0xa2f5('0xd')](socket);function respondWithRpcPromise(_0x25e61e,_0x4cdd1d,_0x6f20b8){return new BPromise(function(_0x5683e2,_0x5ed0b0){return client['request'](_0x25e61e,_0x6f20b8)[_0xa2f5('0xe')](function(_0x5aed10){logger[_0xa2f5('0xf')](_0xa2f5('0x10'),_0x4cdd1d,_0xa2f5('0x11'));logger[_0xa2f5('0x12')](_0xa2f5('0x13'),_0x4cdd1d,_0xa2f5('0x11'),JSON[_0xa2f5('0x14')](_0x5aed10));if(_0x5aed10[_0xa2f5('0x15')]){if(_0x5aed10['error'][_0xa2f5('0x16')]===0x1f4){logger[_0xa2f5('0x15')](_0xa2f5('0x10'),_0x4cdd1d,_0x5aed10['error'][_0xa2f5('0x17')]);return _0x5ed0b0(_0x5aed10['error'][_0xa2f5('0x17')]);}logger[_0xa2f5('0x15')](_0xa2f5('0x10'),_0x4cdd1d,_0x5aed10['error'][_0xa2f5('0x17')]);return _0x5683e2(_0x5aed10['error'][_0xa2f5('0x17')]);}else{logger[_0xa2f5('0xf')](_0xa2f5('0x10'),_0x4cdd1d,'request\x20sent');_0x5683e2(_0x5aed10['result'][_0xa2f5('0x17')]);}})['catch'](function(_0x928c5b){logger[_0xa2f5('0x15')](_0xa2f5('0x10'),_0x4cdd1d,_0x928c5b);_0x5ed0b0(_0x928c5b);});});}exports[_0xa2f5('0x18')]=function(_0x2e78a4){var _0x1e58b8=this;return new Promise(function(_0x1cf655,_0x26ced1){return db[_0xa2f5('0x19')][_0xa2f5('0x1a')]({'raw':_0x2e78a4[_0xa2f5('0x1b')]?_0x2e78a4[_0xa2f5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2e78a4[_0xa2f5('0x1b')]?_0x2e78a4[_0xa2f5('0x1b')]['where']||null:null,'attributes':_0x2e78a4['options']?_0x2e78a4[_0xa2f5('0x1b')][_0xa2f5('0x1c')]||null:null,'limit':_0x2e78a4['options']?_0x2e78a4[_0xa2f5('0x1b')]['limit']||null:null,'include':_0x2e78a4[_0xa2f5('0x1b')]?_0x2e78a4[_0xa2f5('0x1b')][_0xa2f5('0x1d')]?_[_0xa2f5('0x1e')](_0x2e78a4[_0xa2f5('0x1b')]['include'],function(_0x41e38f){return{'model':db[_0x41e38f['model']],'as':_0x41e38f['as'],'attributes':_0x41e38f[_0xa2f5('0x1c')],'include':_0x41e38f['include']?_[_0xa2f5('0x1e')](_0x41e38f[_0xa2f5('0x1d')],function(_0x7e166){return{'model':db[_0x7e166[_0xa2f5('0x1f')]],'as':_0x7e166['as'],'attributes':_0x7e166[_0xa2f5('0x1c')],'include':_0x7e166['include']?_[_0xa2f5('0x1e')](_0x7e166[_0xa2f5('0x1d')],function(_0x4bf572){return{'model':db[_0x4bf572[_0xa2f5('0x1f')]],'as':_0x4bf572['as'],'attributes':_0x4bf572['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x871dce){logger[_0xa2f5('0xf')](_0xa2f5('0x18'),_0x2e78a4);logger[_0xa2f5('0x12')](_0xa2f5('0x18'),_0x2e78a4,JSON[_0xa2f5('0x14')](_0x871dce));_0x1cf655(_0x871dce);})[_0xa2f5('0x20')](function(_0x4054fa){logger[_0xa2f5('0x15')](_0xa2f5('0x18'),_0x4054fa[_0xa2f5('0x17')],_0x2e78a4);_0x26ced1(_0x1e58b8[_0xa2f5('0x15')](0x1f4,_0x4054fa[_0xa2f5('0x17')]));});});};exports[_0xa2f5('0x21')]=function(_0x4dce6a){var _0xbf7b9f=this;return new Promise(function(_0x371b68,_0x59e7cc){return db['MailQueue'][_0xa2f5('0x22')]({'raw':_0x4dce6a[_0xa2f5('0x1b')]?_0x4dce6a[_0xa2f5('0x1b')][_0xa2f5('0x23')]===undefined?!![]:![]:!![],'where':_0x4dce6a[_0xa2f5('0x1b')]?_0x4dce6a['options'][_0xa2f5('0x24')]||null:null,'attributes':_0x4dce6a[_0xa2f5('0x1b')]?_0x4dce6a[_0xa2f5('0x1b')][_0xa2f5('0x1c')]||null:null,'include':_0x4dce6a[_0xa2f5('0x1b')]?_0x4dce6a[_0xa2f5('0x1b')]['include']?_[_0xa2f5('0x1e')](_0x4dce6a[_0xa2f5('0x1b')][_0xa2f5('0x1d')],function(_0x1e58b7){return{'model':db[_0x1e58b7[_0xa2f5('0x1f')]],'as':_0x1e58b7['as'],'attributes':_0x1e58b7[_0xa2f5('0x1c')],'include':_0x1e58b7[_0xa2f5('0x1d')]?_[_0xa2f5('0x1e')](_0x1e58b7[_0xa2f5('0x1d')],function(_0xf3872){return{'model':db[_0xf3872[_0xa2f5('0x1f')]],'as':_0xf3872['as'],'attributes':_0xf3872[_0xa2f5('0x1c')],'include':_0xf3872[_0xa2f5('0x1d')]?_[_0xa2f5('0x1e')](_0xf3872[_0xa2f5('0x1d')],function(_0x4af6bf){return{'model':db[_0x4af6bf[_0xa2f5('0x1f')]],'as':_0x4af6bf['as'],'attributes':_0x4af6bf[_0xa2f5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa2f5('0xe')](function(_0x51eaba){logger[_0xa2f5('0xf')](_0xa2f5('0x21'),_0x4dce6a);logger['debug'](_0xa2f5('0x21'),_0x4dce6a,JSON[_0xa2f5('0x14')](_0x51eaba));_0x371b68(_0x51eaba);})[_0xa2f5('0x20')](function(_0x384add){logger[_0xa2f5('0x15')](_0xa2f5('0x21'),_0x384add['message'],_0x4dce6a);_0x59e7cc(_0xbf7b9f[_0xa2f5('0x15')](0x1f4,_0x384add['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 8ac8bab..7b38fd7 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 _0x20ca=['mailQueue:','save','remove','update','emit','removeListener','length'];(function(_0x383836,_0x109ca1){var _0x64eedb=function(_0x5da0cd){while(--_0x5da0cd){_0x383836['push'](_0x383836['shift']());}};_0x64eedb(++_0x109ca1);}(_0x20ca,0x166));var _0xa20c=function(_0x335223,_0x3f9e24){_0x335223=_0x335223-0x0;var _0x4b5390=_0x20ca[_0x335223];return _0x4b5390;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xa20c('0x0'),_0xa20c('0x1'),_0xa20c('0x2')];function createListener(_0x468833,_0x58256c){return function(_0x300d78){_0x58256c[_0xa20c('0x3')](_0x468833,_0x300d78);};}function removeListener(_0x4cc4d9,_0x2c1403){return function(){MailQueueEvents[_0xa20c('0x4')](_0x4cc4d9,_0x2c1403);};}exports['register']=function(_0x4da23d){for(var _0x27300f=0x0,_0x1fdb6e=events[_0xa20c('0x5')];_0x27300f<_0x1fdb6e;_0x27300f++){var _0x45b5e6=events[_0x27300f];var _0x53b324=createListener(_0xa20c('0x6')+_0x45b5e6,_0x4da23d);MailQueueEvents['on'](_0x45b5e6,_0x53b324);}}; \ No newline at end of file +var _0xb018=['save','remove','update','emit','removeListener','register','length'];(function(_0x14ad1b,_0x1a9fc4){var _0x23307f=function(_0x10c3d8){while(--_0x10c3d8){_0x14ad1b['push'](_0x14ad1b['shift']());}};_0x23307f(++_0x1a9fc4);}(_0xb018,0xcb));var _0x8b01=function(_0x5e781c,_0x25a011){_0x5e781c=_0x5e781c-0x0;var _0x277e54=_0xb018[_0x5e781c];return _0x277e54;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x8b01('0x0'),_0x8b01('0x1'),_0x8b01('0x2')];function createListener(_0x4215cf,_0x4c4278){return function(_0x161863){_0x4c4278[_0x8b01('0x3')](_0x4215cf,_0x161863);};}function removeListener(_0x33d476,_0x3884c7){return function(){MailQueueEvents[_0x8b01('0x4')](_0x33d476,_0x3884c7);};}exports[_0x8b01('0x5')]=function(_0x3c3dcc){for(var _0x2b7acc=0x0,_0x3eb637=events[_0x8b01('0x6')];_0x2b7acc<_0x3eb637;_0x2b7acc++){var _0x22e65e=events[_0x2b7acc];var _0x863a44=createListener('mailQueue:'+_0x22e65e,_0x3c3dcc);MailQueueEvents['on'](_0x22e65e,_0x863a44);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 2d2aafb..8e0dbd2 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 _0x0930=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x4d0e23,_0x4e03b7){var _0x4d2fc4=function(_0x26f074){while(--_0x26f074){_0x4d0e23['push'](_0x4d0e23['shift']());}};_0x4d2fc4(++_0x4e03b7);}(_0x0930,0x166));var _0x0093=function(_0x49bf38,_0x42c116){_0x49bf38=_0x49bf38-0x0;var _0xb76377=_0x0930[_0x49bf38];return _0xb76377;};'use strict';var multer=require(_0x0093('0x0'));var util=require(_0x0093('0x1'));var path=require('path');var timeout=require(_0x0093('0x2'));var express=require(_0x0093('0x3'));var router=express[_0x0093('0x4')]();var auth=require(_0x0093('0x5'));var interaction=require(_0x0093('0x6'));var config=require('../../config/environment');var controller=require(_0x0093('0x7'));router[_0x0093('0x8')]('/',auth[_0x0093('0x9')](),controller[_0x0093('0xa')]);router[_0x0093('0x8')](_0x0093('0xb'),auth[_0x0093('0x9')](),controller['describe']);router[_0x0093('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0093('0xc')]);router[_0x0093('0xd')]('/',auth[_0x0093('0x9')](),controller[_0x0093('0xe')]);router[_0x0093('0xf')](_0x0093('0x10'),auth[_0x0093('0x9')](),controller['update']);router[_0x0093('0x11')](_0x0093('0x10'),auth[_0x0093('0x9')](),controller[_0x0093('0x12')]);module[_0x0093('0x13')]=router; \ No newline at end of file +var _0xc16a=['update','delete','destroy','multer','path','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x17a6dd,_0x1543c1){var _0x4d1b6d=function(_0x47995c){while(--_0x47995c){_0x17a6dd['push'](_0x17a6dd['shift']());}};_0x4d1b6d(++_0x1543c1);}(_0xc16a,0x12f));var _0xac16=function(_0x4afb3b,_0x51614c){_0x4afb3b=_0x4afb3b-0x0;var _0x14cd9f=_0xc16a[_0x4afb3b];return _0x14cd9f;};'use strict';var multer=require(_0xac16('0x0'));var util=require('util');var path=require(_0xac16('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xac16('0x2'));var config=require('../../config/environment');var controller=require(_0xac16('0x3'));router[_0xac16('0x4')]('/',auth[_0xac16('0x5')](),controller[_0xac16('0x6')]);router[_0xac16('0x4')](_0xac16('0x7'),auth[_0xac16('0x5')](),controller[_0xac16('0x8')]);router[_0xac16('0x4')](_0xac16('0x9'),auth[_0xac16('0x5')](),controller[_0xac16('0xa')]);router['post']('/',auth[_0xac16('0x5')](),controller['create']);router[_0xac16('0xb')](_0xac16('0x9'),auth[_0xac16('0x5')](),controller[_0xac16('0xc')]);router[_0xac16('0xd')](_0xac16('0x9'),auth['isAuthenticated'](),controller[_0xac16('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index f270d7c..d9073e2 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 _0x9f8b=['sequelize','STRING','DATE','moment'];(function(_0x5b374e,_0x244e02){var _0x5da9a4=function(_0x39a98b){while(--_0x39a98b){_0x5b374e['push'](_0x5b374e['shift']());}};_0x5da9a4(++_0x244e02);}(_0x9f8b,0x1e7));var _0xb9f8=function(_0x281820,_0x47572b){_0x281820=_0x281820-0x0;var _0x2d05f6=_0x9f8b[_0x281820];return _0x2d05f6;};'use strict';var moment=require(_0xb9f8('0x0'));var Sequelize=require(_0xb9f8('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xb9f8('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb9f8('0x2')]},'joinAt':{'type':Sequelize[_0xb9f8('0x3')]},'leaveAt':{'type':Sequelize[_0xb9f8('0x3')]},'acceptAt':{'type':Sequelize[_0xb9f8('0x3')]},'exitAt':{'type':Sequelize[_0xb9f8('0x3')]},'reason':{'type':Sequelize[_0xb9f8('0x2')]}}; \ No newline at end of file +var _0xdf8b=['sequelize','STRING','DATE','moment'];(function(_0x5066c0,_0x24ce1a){var _0x5962f1=function(_0xbeeb40){while(--_0xbeeb40){_0x5066c0['push'](_0x5066c0['shift']());}};_0x5962f1(++_0x24ce1a);}(_0xdf8b,0x1cb));var _0xbdf8=function(_0x4d214f,_0x4a9d72){_0x4d214f=_0x4d214f-0x0;var _0x35d3e0=_0xdf8b[_0x4d214f];return _0x35d3e0;};'use strict';var moment=require(_0xbdf8('0x0'));var Sequelize=require(_0xbdf8('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbdf8('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbdf8('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbdf8('0x3')]},'acceptAt':{'type':Sequelize[_0xbdf8('0x3')]},'exitAt':{'type':Sequelize[_0xbdf8('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 78e6b4f..557ad44 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 _0x34d2=['status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','MailQueueReport','rawAttributes','fieldName','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','options','count','include','findAll','rows','show','params','includeAll','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x22d780,_0x5239a7){var _0x2c27cf=function(_0x5cc5cf){while(--_0x5cc5cf){_0x22d780['push'](_0x22d780['shift']());}};_0x2c27cf(++_0x5239a7);}(_0x34d2,0x7b));var _0x234d=function(_0x5e415d,_0x5797d5){_0x5e415d=_0x5e415d-0x0;var _0x4cc4b8=_0x34d2[_0x5e415d];return _0x4cc4b8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x234d('0x0'));var rimraf=require(_0x234d('0x1'));var zipdir=require(_0x234d('0x2'));var jsonpatch=require(_0x234d('0x3'));var rp=require(_0x234d('0x4'));var moment=require(_0x234d('0x5'));var BPromise=require(_0x234d('0x6'));var Mustache=require(_0x234d('0x7'));var util=require('util');var path=require(_0x234d('0x8'));var sox=require(_0x234d('0x9'));var csv=require('to-csv');var ejs=require(_0x234d('0xa'));var fs=require('fs');var _=require(_0x234d('0xb'));var squel=require(_0x234d('0xc'));var crypto=require(_0x234d('0xd'));var jsforce=require(_0x234d('0xe'));var deskjs=require(_0x234d('0xf'));var toCsv=require(_0x234d('0x10'));var querystring=require(_0x234d('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x234d('0x12'));var config=require(_0x234d('0x13'));var db=require(_0x234d('0x14'))['db'];function respondWithStatusCode(_0xd23bfb,_0x223657){_0x223657=_0x223657||0xcc;return function(_0x152dcc){if(_0x152dcc){return _0xd23bfb['sendStatus'](_0x223657);}return _0xd23bfb['status'](_0x223657)['end']();};}function respondWithResult(_0x5de751,_0x4a035b){_0x4a035b=_0x4a035b||0xc8;return function(_0x48a480){if(_0x48a480){return _0x5de751[_0x234d('0x15')](_0x4a035b)[_0x234d('0x16')](_0x48a480);}};}function respondWithFilteredResult(_0x4676aa,_0x4fc98a){return function(_0x46ed2e){if(_0x46ed2e){var _0x2094e5=_0x46ed2e['count'],_0x258b13=_0x4fc98a['offset'],_0x51de42=_0x4fc98a[_0x234d('0x17')]+_0x4fc98a[_0x234d('0x18')],_0x52b2a4;if(_0x51de42>=_0x2094e5){_0x51de42=_0x2094e5;_0x52b2a4=0xc8;}else{_0x52b2a4=0xce;}_0x4676aa[_0x234d('0x15')](_0x52b2a4);return _0x4676aa[_0x234d('0x19')](_0x234d('0x1a'),_0x258b13+'-'+_0x51de42+'/'+_0x2094e5)[_0x234d('0x16')](_0x46ed2e);}return null;};}function patchUpdates(_0x2b4ed2){return function(_0xc194ed){try{jsonpatch[_0x234d('0x1b')](_0xc194ed,_0x2b4ed2,!![]);}catch(_0x34ee4f){return BPromise[_0x234d('0x1c')](_0x34ee4f);}return _0xc194ed[_0x234d('0x1d')]();};}function saveUpdates(_0x213342,_0x2a5451){return function(_0x3e6e20){if(_0x3e6e20){return _0x3e6e20[_0x234d('0x1e')](_0x213342)[_0x234d('0x1f')](function(_0x49f04e){return _0x49f04e;});}return null;};}function removeEntity(_0x3da00d,_0x2a15e2){return function(_0x140a91){if(_0x140a91){return _0x140a91[_0x234d('0x20')]()['then'](function(){_0x3da00d[_0x234d('0x15')](0xcc)[_0x234d('0x21')]();});}};}function handleEntityNotFound(_0x44b77f,_0x36d378){return function(_0x5da4c2){if(!_0x5da4c2){_0x44b77f[_0x234d('0x22')](0x194);}return _0x5da4c2;};}function handleError(_0x59d66d,_0x1b373b){_0x1b373b=_0x1b373b||0x1f4;return function(_0x1cd419){logger['error'](_0x1cd419[_0x234d('0x23')]);if(_0x1cd419['name']){delete _0x1cd419[_0x234d('0x24')];}_0x59d66d['status'](_0x1b373b)[_0x234d('0x25')](_0x1cd419);};}exports['index']=function(_0x1f6c9a,_0x1df895){var _0x476d8a={},_0x1acab8={},_0x534c1e={'count':0x0,'rows':[]};var _0x91c9f3=_['map'](db[_0x234d('0x26')][_0x234d('0x27')],function(_0x3e98c8){return{'name':_0x3e98c8[_0x234d('0x28')],'type':_0x3e98c8['type'][_0x234d('0x29')]};});_0x1acab8[_0x234d('0x2a')]=_[_0x234d('0x2b')](_0x91c9f3,_0x234d('0x24'));_0x1acab8['query']=_[_0x234d('0x2c')](_0x1f6c9a[_0x234d('0x2d')]);_0x1acab8['filters']=_['intersection'](_0x1acab8[_0x234d('0x2a')],_0x1acab8[_0x234d('0x2d')]);_0x476d8a[_0x234d('0x2e')]=_[_0x234d('0x2f')](_0x1acab8['model'],qs[_0x234d('0x30')](_0x1f6c9a[_0x234d('0x2d')][_0x234d('0x30')]));_0x476d8a['attributes']=_0x476d8a[_0x234d('0x2e')][_0x234d('0x31')]?_0x476d8a[_0x234d('0x2e')]:_0x1acab8['model'];if(!_0x1f6c9a[_0x234d('0x2d')][_0x234d('0x32')](_0x234d('0x33'))){_0x476d8a['limit']=qs['limit'](_0x1f6c9a[_0x234d('0x2d')][_0x234d('0x18')]);_0x476d8a[_0x234d('0x17')]=qs[_0x234d('0x17')](_0x1f6c9a[_0x234d('0x2d')][_0x234d('0x17')]);}_0x476d8a['order']=qs[_0x234d('0x34')](_0x1f6c9a[_0x234d('0x2d')][_0x234d('0x34')]);_0x476d8a[_0x234d('0x35')]=qs[_0x234d('0x36')](_[_0x234d('0x37')](_0x1f6c9a['query'],_0x1acab8[_0x234d('0x36')]),_0x91c9f3);if(_0x1f6c9a['query']['filter']){_0x476d8a['where']=_[_0x234d('0x38')](_0x476d8a['where'],{'$or':_['map'](_0x91c9f3,function(_0x23bec7){if(_0x23bec7[_0x234d('0x39')]!==_0x234d('0x3a')){var _0x392219={};_0x392219[_0x23bec7['name']]={'$like':'%'+_0x1f6c9a[_0x234d('0x2d')]['filter']+'%'};return _0x392219;}})});}_0x476d8a=_['merge']({},_0x476d8a,_0x1f6c9a[_0x234d('0x3b')]);var _0x7f38d1={'where':_0x476d8a[_0x234d('0x35')]};return db['MailQueueReport'][_0x234d('0x3c')](_0x7f38d1)[_0x234d('0x1f')](function(_0x1aa720){_0x534c1e[_0x234d('0x3c')]=_0x1aa720;if(_0x1f6c9a[_0x234d('0x2d')]['includeAll']){_0x476d8a[_0x234d('0x3d')]=[{'all':!![]}];}return db[_0x234d('0x26')][_0x234d('0x3e')](_0x476d8a);})[_0x234d('0x1f')](function(_0x546e8b){_0x534c1e[_0x234d('0x3f')]=_0x546e8b;return _0x534c1e;})['then'](respondWithFilteredResult(_0x1df895,_0x476d8a))['catch'](handleError(_0x1df895,null));};exports[_0x234d('0x40')]=function(_0x28c15a,_0x30ecfc){var _0x26c47a={'raw':!![],'where':{'id':_0x28c15a[_0x234d('0x41')]['id']}},_0x16ab24={};_0x16ab24[_0x234d('0x2a')]=_[_0x234d('0x2c')](db[_0x234d('0x26')][_0x234d('0x27')]);_0x16ab24[_0x234d('0x2d')]=_[_0x234d('0x2c')](_0x28c15a[_0x234d('0x2d')]);_0x16ab24[_0x234d('0x36')]=_[_0x234d('0x2f')](_0x16ab24[_0x234d('0x2a')],_0x16ab24['query']);_0x26c47a[_0x234d('0x2e')]=_[_0x234d('0x2f')](_0x16ab24['model'],qs[_0x234d('0x30')](_0x28c15a[_0x234d('0x2d')]['fields']));_0x26c47a[_0x234d('0x2e')]=_0x26c47a[_0x234d('0x2e')][_0x234d('0x31')]?_0x26c47a['attributes']:_0x16ab24[_0x234d('0x2a')];if(_0x28c15a[_0x234d('0x2d')][_0x234d('0x42')]){_0x26c47a[_0x234d('0x3d')]=[{'all':!![]}];}_0x26c47a=_['merge']({},_0x26c47a,_0x28c15a[_0x234d('0x3b')]);return db[_0x234d('0x26')][_0x234d('0x43')](_0x26c47a)['then'](handleEntityNotFound(_0x30ecfc,null))['then'](respondWithResult(_0x30ecfc,null))['catch'](handleError(_0x30ecfc,null));};exports[_0x234d('0x44')]=function(_0x55599a,_0x22816a){return db[_0x234d('0x26')]['create'](_0x55599a[_0x234d('0x45')],{})[_0x234d('0x1f')](respondWithResult(_0x22816a,0xc9))[_0x234d('0x46')](handleError(_0x22816a,null));};exports['update']=function(_0x55239d,_0x25bc4b){if(_0x55239d['body']['id']){delete _0x55239d[_0x234d('0x45')]['id'];}return db[_0x234d('0x26')][_0x234d('0x43')]({'where':{'id':_0x55239d['params']['id']}})[_0x234d('0x1f')](handleEntityNotFound(_0x25bc4b,null))['then'](saveUpdates(_0x55239d[_0x234d('0x45')],null))['then'](respondWithResult(_0x25bc4b,null))[_0x234d('0x46')](handleError(_0x25bc4b,null));};exports[_0x234d('0x20')]=function(_0x53767d,_0x45b143){return db[_0x234d('0x26')][_0x234d('0x43')]({'where':{'id':_0x53767d[_0x234d('0x41')]['id']}})[_0x234d('0x1f')](handleEntityNotFound(_0x45b143,null))['then'](removeEntity(_0x45b143,null))['catch'](handleError(_0x45b143,null));};exports['describe']=function(_0x31ced6,_0x3f63f3){return db[_0x234d('0x26')][_0x234d('0x47')]()['then'](respondWithResult(_0x3f63f3,null))[_0x234d('0x46')](handleError(_0x3f63f3,null));}; \ No newline at end of file +var _0x372b=['merge','options','MailQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x372b,0x18a));var _0xb372=function(_0x2d844a,_0x15e969){_0x2d844a=_0x2d844a-0x0;var _0x24c3ed=_0x372b[_0x2d844a];return _0x24c3ed;};'use strict';var pdf=require(_0xb372('0x0'));var emlformat=require(_0xb372('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb372('0x2'));var jsonpatch=require(_0xb372('0x3'));var rp=require(_0xb372('0x4'));var moment=require(_0xb372('0x5'));var BPromise=require(_0xb372('0x6'));var Mustache=require(_0xb372('0x7'));var util=require('util');var path=require(_0xb372('0x8'));var sox=require(_0xb372('0x9'));var csv=require(_0xb372('0xa'));var ejs=require(_0xb372('0xb'));var fs=require('fs');var _=require(_0xb372('0xc'));var squel=require(_0xb372('0xd'));var crypto=require(_0xb372('0xe'));var jsforce=require(_0xb372('0xf'));var deskjs=require(_0xb372('0x10'));var toCsv=require(_0xb372('0xa'));var querystring=require(_0xb372('0x11'));var Papa=require(_0xb372('0x12'));var Redis=require('ioredis');var authService=require(_0xb372('0x13'));var qs=require(_0xb372('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb372('0x15'));var logger=require(_0xb372('0x16'))('api');var utils=require(_0xb372('0x17'));var config=require(_0xb372('0x18'));var db=require(_0xb372('0x19'))['db'];function respondWithStatusCode(_0x5b61c6,_0x1181ac){_0x1181ac=_0x1181ac||0xcc;return function(_0x1dbb6a){if(_0x1dbb6a){return _0x5b61c6[_0xb372('0x1a')](_0x1181ac);}return _0x5b61c6[_0xb372('0x1b')](_0x1181ac)[_0xb372('0x1c')]();};}function respondWithResult(_0x2894cc,_0x1b34a5){_0x1b34a5=_0x1b34a5||0xc8;return function(_0x47d45a){if(_0x47d45a){return _0x2894cc[_0xb372('0x1b')](_0x1b34a5)[_0xb372('0x1d')](_0x47d45a);}};}function respondWithFilteredResult(_0x4862b3,_0x1221cc){return function(_0x5be5b9){if(_0x5be5b9){var _0x452834=_0x5be5b9[_0xb372('0x1e')],_0x1eebee=_0x1221cc['offset'],_0xb45a2a=_0x1221cc[_0xb372('0x1f')]+_0x1221cc[_0xb372('0x20')],_0x197b7c;if(_0xb45a2a>=_0x452834){_0xb45a2a=_0x452834;_0x197b7c=0xc8;}else{_0x197b7c=0xce;}_0x4862b3[_0xb372('0x1b')](_0x197b7c);return _0x4862b3[_0xb372('0x21')](_0xb372('0x22'),_0x1eebee+'-'+_0xb45a2a+'/'+_0x452834)[_0xb372('0x1d')](_0x5be5b9);}return null;};}function patchUpdates(_0x476c89){return function(_0x5535a2){try{jsonpatch[_0xb372('0x23')](_0x5535a2,_0x476c89,!![]);}catch(_0x22c8c9){return BPromise[_0xb372('0x24')](_0x22c8c9);}return _0x5535a2['save']();};}function saveUpdates(_0x4f1a8b,_0x110d31){return function(_0x208389){if(_0x208389){return _0x208389[_0xb372('0x25')](_0x4f1a8b)[_0xb372('0x26')](function(_0x5d8ab3){return _0x5d8ab3;});}return null;};}function removeEntity(_0x270305,_0x18ba9f){return function(_0x1f9511){if(_0x1f9511){return _0x1f9511[_0xb372('0x27')]()['then'](function(){_0x270305[_0xb372('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10eea2,_0x1777e4){return function(_0x208fac){if(!_0x208fac){_0x10eea2[_0xb372('0x1a')](0x194);}return _0x208fac;};}function handleError(_0x267455,_0x20416d){_0x20416d=_0x20416d||0x1f4;return function(_0x355a1e){logger['error'](_0x355a1e[_0xb372('0x28')]);if(_0x355a1e[_0xb372('0x29')]){delete _0x355a1e[_0xb372('0x29')];}_0x267455[_0xb372('0x1b')](_0x20416d)[_0xb372('0x2a')](_0x355a1e);};}exports[_0xb372('0x2b')]=function(_0x2f9030,_0x306a4a){var _0x40ba78={},_0x2f5e61={},_0x4811d5={'count':0x0,'rows':[]};var _0x14187e=_[_0xb372('0x2c')](db['MailQueueReport'][_0xb372('0x2d')],function(_0x3819ce){return{'name':_0x3819ce['fieldName'],'type':_0x3819ce[_0xb372('0x2e')][_0xb372('0x2f')]};});_0x2f5e61[_0xb372('0x30')]=_[_0xb372('0x2c')](_0x14187e,'name');_0x2f5e61[_0xb372('0x31')]=_[_0xb372('0x32')](_0x2f9030[_0xb372('0x31')]);_0x2f5e61[_0xb372('0x33')]=_[_0xb372('0x34')](_0x2f5e61['model'],_0x2f5e61[_0xb372('0x31')]);_0x40ba78['attributes']=_[_0xb372('0x34')](_0x2f5e61[_0xb372('0x30')],qs[_0xb372('0x35')](_0x2f9030['query'][_0xb372('0x35')]));_0x40ba78[_0xb372('0x36')]=_0x40ba78[_0xb372('0x36')][_0xb372('0x37')]?_0x40ba78[_0xb372('0x36')]:_0x2f5e61[_0xb372('0x30')];if(!_0x2f9030[_0xb372('0x31')][_0xb372('0x38')]('nolimit')){_0x40ba78[_0xb372('0x20')]=qs['limit'](_0x2f9030['query'][_0xb372('0x20')]);_0x40ba78[_0xb372('0x1f')]=qs[_0xb372('0x1f')](_0x2f9030[_0xb372('0x31')][_0xb372('0x1f')]);}_0x40ba78[_0xb372('0x39')]=qs[_0xb372('0x3a')](_0x2f9030[_0xb372('0x31')][_0xb372('0x3a')]);_0x40ba78['where']=qs[_0xb372('0x33')](_[_0xb372('0x3b')](_0x2f9030[_0xb372('0x31')],_0x2f5e61[_0xb372('0x33')]),_0x14187e);if(_0x2f9030[_0xb372('0x31')][_0xb372('0x3c')]){_0x40ba78[_0xb372('0x3d')]=_[_0xb372('0x3e')](_0x40ba78[_0xb372('0x3d')],{'$or':_[_0xb372('0x2c')](_0x14187e,function(_0x7fe12a){if(_0x7fe12a[_0xb372('0x2e')]!=='VIRTUAL'){var _0x3af253={};_0x3af253[_0x7fe12a[_0xb372('0x29')]]={'$like':'%'+_0x2f9030['query'][_0xb372('0x3c')]+'%'};return _0x3af253;}})});}_0x40ba78=_['merge']({},_0x40ba78,_0x2f9030[_0xb372('0x3f')]);var _0x358c8d={'where':_0x40ba78['where']};return db[_0xb372('0x40')][_0xb372('0x1e')](_0x358c8d)[_0xb372('0x26')](function(_0xc1e63a){_0x4811d5[_0xb372('0x1e')]=_0xc1e63a;if(_0x2f9030[_0xb372('0x31')][_0xb372('0x41')]){_0x40ba78[_0xb372('0x42')]=[{'all':!![]}];}return db[_0xb372('0x40')][_0xb372('0x43')](_0x40ba78);})['then'](function(_0x1819ea){_0x4811d5[_0xb372('0x44')]=_0x1819ea;return _0x4811d5;})[_0xb372('0x26')](respondWithFilteredResult(_0x306a4a,_0x40ba78))[_0xb372('0x45')](handleError(_0x306a4a,null));};exports[_0xb372('0x46')]=function(_0x1541ff,_0x1a90d3){var _0x211ff5={'raw':!![],'where':{'id':_0x1541ff[_0xb372('0x47')]['id']}},_0x19dd7a={};_0x19dd7a[_0xb372('0x30')]=_[_0xb372('0x32')](db[_0xb372('0x40')][_0xb372('0x2d')]);_0x19dd7a[_0xb372('0x31')]=_['keys'](_0x1541ff[_0xb372('0x31')]);_0x19dd7a[_0xb372('0x33')]=_[_0xb372('0x34')](_0x19dd7a[_0xb372('0x30')],_0x19dd7a[_0xb372('0x31')]);_0x211ff5[_0xb372('0x36')]=_[_0xb372('0x34')](_0x19dd7a[_0xb372('0x30')],qs['fields'](_0x1541ff[_0xb372('0x31')][_0xb372('0x35')]));_0x211ff5['attributes']=_0x211ff5[_0xb372('0x36')][_0xb372('0x37')]?_0x211ff5[_0xb372('0x36')]:_0x19dd7a[_0xb372('0x30')];if(_0x1541ff[_0xb372('0x31')][_0xb372('0x41')]){_0x211ff5['include']=[{'all':!![]}];}_0x211ff5=_[_0xb372('0x3e')]({},_0x211ff5,_0x1541ff[_0xb372('0x3f')]);return db[_0xb372('0x40')][_0xb372('0x48')](_0x211ff5)[_0xb372('0x26')](handleEntityNotFound(_0x1a90d3,null))[_0xb372('0x26')](respondWithResult(_0x1a90d3,null))[_0xb372('0x45')](handleError(_0x1a90d3,null));};exports[_0xb372('0x49')]=function(_0x5ac25e,_0x28c0da){return db[_0xb372('0x40')][_0xb372('0x49')](_0x5ac25e[_0xb372('0x4a')],{})[_0xb372('0x26')](respondWithResult(_0x28c0da,0xc9))[_0xb372('0x45')](handleError(_0x28c0da,null));};exports[_0xb372('0x25')]=function(_0x3c46d2,_0xb256ac){if(_0x3c46d2[_0xb372('0x4a')]['id']){delete _0x3c46d2['body']['id'];}return db['MailQueueReport'][_0xb372('0x48')]({'where':{'id':_0x3c46d2[_0xb372('0x47')]['id']}})[_0xb372('0x26')](handleEntityNotFound(_0xb256ac,null))[_0xb372('0x26')](saveUpdates(_0x3c46d2[_0xb372('0x4a')],null))[_0xb372('0x26')](respondWithResult(_0xb256ac,null))[_0xb372('0x45')](handleError(_0xb256ac,null));};exports[_0xb372('0x27')]=function(_0x247fd6,_0x50e6fb){return db['MailQueueReport'][_0xb372('0x48')]({'where':{'id':_0x247fd6['params']['id']}})[_0xb372('0x26')](handleEntityNotFound(_0x50e6fb,null))[_0xb372('0x26')](removeEntity(_0x50e6fb,null))[_0xb372('0x45')](handleError(_0x50e6fb,null));};exports[_0xb372('0x4b')]=function(_0x589666,_0x232f59){return db[_0xb372('0x40')]['describe']()['then'](respondWithResult(_0x232f59,null))[_0xb372('0x45')](handleError(_0x232f59,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 4e4af22..3433684 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 _0x15b8=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x15b8,0xcd));var _0x815b=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x15b8[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var logger=require(_0x815b('0x1'))(_0x815b('0x2'));var moment=require(_0x815b('0x3'));var BPromise=require(_0x815b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x815b('0x5'));var rimraf=require(_0x815b('0x6'));var config=require(_0x815b('0x7'));var attributes=require(_0x815b('0x8'));module[_0x815b('0x9')]=function(_0x37a503,_0x581869){return _0x37a503[_0x815b('0xa')](_0x815b('0xb'),attributes,{'tableName':_0x815b('0xc'),'paranoid':![],'indexes':[{'name':_0x815b('0xd'),'fields':[_0x815b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8aad=['report_mail_queue','uniqueid','lodash','util','api','bluebird','request-promise','../../config/environment','define'];(function(_0x51ee42,_0x34e391){var _0x47a70d=function(_0x42f512){while(--_0x42f512){_0x51ee42['push'](_0x51ee42['shift']());}};_0x47a70d(++_0x34e391);}(_0x8aad,0x146));var _0xd8aa=function(_0x46e3e6,_0x93f105){_0x46e3e6=_0x46e3e6-0x0;var _0x5c5d7d=_0x8aad[_0x46e3e6];return _0x5c5d7d;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var logger=require('../../config/logger')(_0xd8aa('0x2'));var moment=require('moment');var BPromise=require(_0xd8aa('0x3'));var rp=require(_0xd8aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd8aa('0x5'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x16b648,_0x43ddeb){return _0x16b648[_0xd8aa('0x6')]('MailQueueReport',attributes,{'tableName':_0xd8aa('0x7'),'paranoid':![],'indexes':[{'name':_0xd8aa('0x8'),'fields':[_0xd8aa('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 58aa373..a3e9e92 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x28a8c2,_0x494d5){var _0x37ac3c=function(_0x2882b3){while(--_0x2882b3){_0x28a8c2['push'](_0x28a8c2['shift']());}};_0x37ac3c(++_0x494d5);}(_0xdb28,0x106));var _0x8db2=function(_0x220e4f,_0x42b51f){_0x220e4f=_0x220e4f-0x0;var _0x469368=_0xdb28[_0x220e4f];return _0x469368;};'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')]('MailQueueReport,\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);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0x1883=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateMailQueueReport','MailQueueReport','create','options','info','UpdateMailQueueReport','update','body','raw','limit','then','lodash','util','moment','bluebird'];(function(_0x41241b,_0xbfa517){var _0x12a5f4=function(_0x8868c7){while(--_0x8868c7){_0x41241b['push'](_0x41241b['shift']());}};_0x12a5f4(++_0xbfa517);}(_0x1883,0xab));var _0x3188=function(_0x12b1fd,_0x545887){_0x12b1fd=_0x12b1fd-0x0;var _0x4197fa=_0x1883[_0x12b1fd];return _0x4197fa;};'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);});});}exports[_0x3188('0x18')]=function(_0x3f5b35){var _0x37e646=this;return new Promise(function(_0x18a71a,_0x4f27b0){return db[_0x3188('0x19')][_0x3188('0x1a')](_0x3f5b35['body'],{'raw':_0x3f5b35[_0x3188('0x1b')]?_0x3f5b35[_0x3188('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5d8d62){logger[_0x3188('0x1c')](_0x3188('0x18'),_0x3f5b35);logger[_0x3188('0x11')]('CreateMailQueueReport',_0x3f5b35,JSON['stringify'](_0x5d8d62));_0x18a71a(_0x5d8d62);})[_0x3188('0x17')](function(_0x461286){logger[_0x3188('0x14')](_0x3188('0x18'),_0x461286[_0x3188('0x15')],_0x3f5b35);_0x4f27b0(_0x37e646['error'](0x1f4,_0x461286[_0x3188('0x15')]));});});};exports[_0x3188('0x1d')]=function(_0x5a2e67){var _0xcbaec9=this;return new Promise(function(_0x4be6c3,_0x5c69be){return db[_0x3188('0x19')][_0x3188('0x1e')](_0x5a2e67[_0x3188('0x1f')],{'raw':_0x5a2e67[_0x3188('0x1b')]?_0x5a2e67[_0x3188('0x1b')][_0x3188('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a2e67[_0x3188('0x1b')]?_0x5a2e67[_0x3188('0x1b')]['where']||null:null,'attributes':_0x5a2e67[_0x3188('0x1b')]?_0x5a2e67[_0x3188('0x1b')]['attributes']||null:null,'limit':_0x5a2e67[_0x3188('0x1b')]?_0x5a2e67[_0x3188('0x1b')][_0x3188('0x21')]||null:null})[_0x3188('0x22')](function(_0x20e6aa){logger[_0x3188('0x1c')](_0x3188('0x1d'),_0x5a2e67);logger[_0x3188('0x11')]('UpdateMailQueueReport',_0x5a2e67,JSON[_0x3188('0x13')](_0x20e6aa));_0x4be6c3(_0x20e6aa);})['catch'](function(_0xaead48){logger['error'](_0x3188('0x1d'),_0xaead48[_0x3188('0x15')],_0x5a2e67);_0x5c69be(_0xcbaec9[_0x3188('0x14')](0x1f4,_0xaead48[_0x3188('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index c13ca22..2e29619 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 _0x0d0e=['exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x15c070,_0x10012d){var _0x3f81bb=function(_0x237443){while(--_0x237443){_0x15c070['push'](_0x15c070['shift']());}};_0x3f81bb(++_0x10012d);}(_0x0d0e,0x17b));var _0xe0d0=function(_0x36c28a,_0x55c76c){_0x36c28a=_0x36c28a-0x0;var _0x2ee873=_0x0d0e[_0x36c28a];return _0x2ee873;};'use strict';var multer=require(_0xe0d0('0x0'));var util=require('util');var path=require(_0xe0d0('0x1'));var timeout=require(_0xe0d0('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe0d0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe0d0('0x4'));module[_0xe0d0('0x5')]=router; \ No newline at end of file +var _0xa234=['util','path','connect-timeout','express','Router','../../components/auth/service','multer'];(function(_0xf9ea9b,_0x193341){var _0xb13f63=function(_0x2d506a){while(--_0x2d506a){_0xf9ea9b['push'](_0xf9ea9b['shift']());}};_0xb13f63(++_0x193341);}(_0xa234,0x99));var _0x4a23=function(_0xd1bdb8,_0x20e405){_0xd1bdb8=_0xd1bdb8-0x0;var _0x43a500=_0xa234[_0xd1bdb8];return _0x43a500;};'use strict';var multer=require(_0x4a23('0x0'));var util=require(_0x4a23('0x1'));var path=require(_0x4a23('0x2'));var timeout=require(_0x4a23('0x3'));var express=require(_0x4a23('0x4'));var router=express[_0x4a23('0x5')]();var auth=require(_0x4a23('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a4bf9b7..1d6acfc 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 _0x02b7=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x10df87,_0x4e3dcb){var _0x22923d=function(_0x439738){while(--_0x439738){_0x10df87['push'](_0x10df87['shift']());}};_0x22923d(++_0x4e3dcb);}(_0x02b7,0x1ed));var _0x702b=function(_0x2a1cd3,_0x17a7cc){_0x2a1cd3=_0x2a1cd3-0x0;var _0x319831=_0x02b7[_0x2a1cd3];return _0x319831;};'use strict';var Sequelize=require(_0x702b('0x0'));module['exports']={'description':{'type':Sequelize[_0x702b('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x702b('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x702b('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x702b('0x1')]},'port':{'type':Sequelize[_0x702b('0x3')]},'tls':{'type':Sequelize[_0x702b('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x702b('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x702b('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x702b('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x702b('0x1')]}}; \ No newline at end of file +var _0x990f=['exports','STRING','username','INBOX','INTEGER'];(function(_0x162ca0,_0x2c23f6){var _0x27b4d0=function(_0x52df67){while(--_0x52df67){_0x162ca0['push'](_0x162ca0['shift']());}};_0x27b4d0(++_0x2c23f6);}(_0x990f,0x87));var _0xf990=function(_0x364caf,_0x487183){_0x364caf=_0x364caf-0x0;var _0x2f9296=_0x990f[_0x364caf];return _0x2f9296;};'use strict';var Sequelize=require('sequelize');module[_0xf990('0x0')]={'description':{'type':Sequelize[_0xf990('0x1')]},'host':{'type':Sequelize[_0xf990('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0xf990('0x2')},'password':{'type':Sequelize[_0xf990('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf990('0x1')],'defaultValue':_0xf990('0x3')},'connTimeout':{'type':Sequelize[_0xf990('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 434dd2c..b5ac2ff 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 _0x5a63=['exports','MailServerIn','lodash','util','moment','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x5a63,0xe3));var _0x35a6=function(_0x3d78f0,_0x300cef){_0x3d78f0=_0x3d78f0-0x0;var _0x467e11=_0x5a63[_0x3d78f0];return _0x467e11;};'use strict';var _=require(_0x35a6('0x0'));var util=require(_0x35a6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x35a6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x35a6('0x3'));var rimraf=require(_0x35a6('0x4'));var config=require(_0x35a6('0x5'));var attributes=require(_0x35a6('0x6'));module[_0x35a6('0x7')]=function(_0x489043,_0x25e5a6){return _0x489043['define'](_0x35a6('0x8'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d9f=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','define','mail_servers_in'];(function(_0x2b3dd6,_0xdee79f){var _0x49b2a3=function(_0x7c3020){while(--_0x7c3020){_0x2b3dd6['push'](_0x2b3dd6['shift']());}};_0x49b2a3(++_0xdee79f);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x47ad1a,_0x467d68){_0x47ad1a=_0x47ad1a-0x0;var _0x586211=_0x7d9f[_0x47ad1a];return _0x586211;};'use strict';var _=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var logger=require(_0xf7d9('0x2'))(_0xf7d9('0x3'));var moment=require(_0xf7d9('0x4'));var BPromise=require('bluebird');var rp=require(_0xf7d9('0x5'));var fs=require('fs');var path=require(_0xf7d9('0x6'));var rimraf=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var attributes=require(_0xf7d9('0x9'));module['exports']=function(_0x4b50c7,_0x2eb0f1){return _0x4b50c7[_0xf7d9('0xa')]('MailServerIn',attributes,{'tableName':_0xf7d9('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 7814d67..32332be 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 _0x484e=['request','then','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','MailServerIn','findAll','options','raw','attributes','include','map','model','GetMailServerIn','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x3e9862,_0xe1f9d2){var _0x48a164=function(_0x4c973a){while(--_0x4c973a){_0x3e9862['push'](_0x3e9862['shift']());}};_0x48a164(++_0xe1f9d2);}(_0x484e,0x124));var _0xe484=function(_0x5a6fbd,_0x53345d){_0x5a6fbd=_0x5a6fbd-0x0;var _0x83b915=_0x484e[_0x5a6fbd];return _0x83b915;};'use strict';var _=require('lodash');var util=require(_0xe484('0x0'));var moment=require('moment');var BPromise=require(_0xe484('0x1'));var rs=require(_0xe484('0x2'));var fs=require('fs');var Redis=require(_0xe484('0x3'));var db=require(_0xe484('0x4'))['db'];var utils=require(_0xe484('0x5'));var logger=require('../../config/logger')(_0xe484('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe484('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13e599,_0x35c5f3,_0x5c5c34){return new BPromise(function(_0x322708,_0x30bde0){return client[_0xe484('0x8')](_0x13e599,_0x5c5c34)[_0xe484('0x9')](function(_0x2bb112){logger[_0xe484('0xa')]('MailServerIn,\x20%s,\x20%s',_0x35c5f3,_0xe484('0xb'));logger['debug'](_0xe484('0xc'),_0x35c5f3,_0xe484('0xb'),JSON[_0xe484('0xd')](_0x2bb112));if(_0x2bb112['error']){if(_0x2bb112[_0xe484('0xe')][_0xe484('0xf')]===0x1f4){logger[_0xe484('0xe')](_0xe484('0x10'),_0x35c5f3,_0x2bb112['error']['message']);return _0x30bde0(_0x2bb112[_0xe484('0xe')][_0xe484('0x11')]);}logger[_0xe484('0xe')]('MailServerIn,\x20%s,\x20%s',_0x35c5f3,_0x2bb112['error'][_0xe484('0x11')]);return _0x322708(_0x2bb112[_0xe484('0xe')][_0xe484('0x11')]);}else{logger[_0xe484('0xa')]('MailServerIn,\x20%s,\x20%s',_0x35c5f3,'request\x20sent');_0x322708(_0x2bb112[_0xe484('0x12')][_0xe484('0x11')]);}})[_0xe484('0x13')](function(_0x457090){logger[_0xe484('0xe')]('MailServerIn,\x20%s,\x20%s',_0x35c5f3,_0x457090);_0x30bde0(_0x457090);});});}exports['GetMailServerIn']=function(_0x286a05){var _0x21f986=this;return new Promise(function(_0x1ecf8b,_0x123152){return db[_0xe484('0x14')][_0xe484('0x15')]({'raw':_0x286a05[_0xe484('0x16')]?_0x286a05[_0xe484('0x16')][_0xe484('0x17')]===undefined?!![]:![]:!![],'where':_0x286a05[_0xe484('0x16')]?_0x286a05[_0xe484('0x16')]['where']||null:null,'attributes':_0x286a05['options']?_0x286a05[_0xe484('0x16')][_0xe484('0x18')]||null:null,'limit':_0x286a05[_0xe484('0x16')]?_0x286a05['options']['limit']||null:null,'include':_0x286a05[_0xe484('0x16')]?_0x286a05[_0xe484('0x16')][_0xe484('0x19')]?_[_0xe484('0x1a')](_0x286a05[_0xe484('0x16')]['include'],function(_0x5d2cf1){return{'model':db[_0x5d2cf1[_0xe484('0x1b')]],'as':_0x5d2cf1['as'],'attributes':_0x5d2cf1[_0xe484('0x18')],'include':_0x5d2cf1[_0xe484('0x19')]?_['map'](_0x5d2cf1['include'],function(_0x185481){return{'model':db[_0x185481['model']],'as':_0x185481['as'],'attributes':_0x185481[_0xe484('0x18')],'include':_0x185481[_0xe484('0x19')]?_[_0xe484('0x1a')](_0x185481[_0xe484('0x19')],function(_0xfeda7f){return{'model':db[_0xfeda7f[_0xe484('0x1b')]],'as':_0xfeda7f['as'],'attributes':_0xfeda7f[_0xe484('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe484('0x9')](function(_0x7280b7){logger[_0xe484('0xa')](_0xe484('0x1c'),_0x286a05);logger[_0xe484('0x1d')](_0xe484('0x1c'),_0x286a05,JSON[_0xe484('0xd')](_0x7280b7));_0x1ecf8b(_0x7280b7);})[_0xe484('0x13')](function(_0x15286a){logger[_0xe484('0xe')](_0xe484('0x1c'),_0x15286a['message'],_0x286a05);_0x123152(_0x21f986[_0xe484('0xe')](0x1f4,_0x15286a[_0xe484('0x11')]));});});}; \ No newline at end of file +var _0xf19f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','MailServerIn,\x20%s,\x20%s','message','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','model','map','stringify','util','randomstring','ioredis','../../mysqldb'];(function(_0x746a11,_0x4abdca){var _0x33de7c=function(_0x212fda){while(--_0x212fda){_0x746a11['push'](_0x746a11['shift']());}};_0x33de7c(++_0x4abdca);}(_0xf19f,0xb6));var _0xff19=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xf19f[_0x1e4360];return _0x31e6b4;};'use strict';var _=require('lodash');var util=require(_0xff19('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xff19('0x1'));var fs=require('fs');var Redis=require(_0xff19('0x2'));var db=require(_0xff19('0x3'))['db'];var utils=require(_0xff19('0x4'));var logger=require(_0xff19('0x5'))(_0xff19('0x6'));var config=require(_0xff19('0x7'));var jayson=require(_0xff19('0x8'));var client=jayson['client'][_0xff19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4799f1,_0x5a569b,_0xf7ee30){return new BPromise(function(_0x463699,_0x307b3f){return client[_0xff19('0xa')](_0x4799f1,_0xf7ee30)[_0xff19('0xb')](function(_0x3b35a0){logger[_0xff19('0xc')]('MailServerIn,\x20%s,\x20%s',_0x5a569b,_0xff19('0xd'));logger[_0xff19('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x5a569b,'request\x20sent',JSON['stringify'](_0x3b35a0));if(_0x3b35a0['error']){if(_0x3b35a0[_0xff19('0xf')][_0xff19('0x10')]===0x1f4){logger['error'](_0xff19('0x11'),_0x5a569b,_0x3b35a0[_0xff19('0xf')][_0xff19('0x12')]);return _0x307b3f(_0x3b35a0[_0xff19('0xf')][_0xff19('0x12')]);}logger[_0xff19('0xf')](_0xff19('0x11'),_0x5a569b,_0x3b35a0[_0xff19('0xf')][_0xff19('0x12')]);return _0x463699(_0x3b35a0[_0xff19('0xf')][_0xff19('0x12')]);}else{logger['info'](_0xff19('0x11'),_0x5a569b,_0xff19('0xd'));_0x463699(_0x3b35a0['result']['message']);}})[_0xff19('0x13')](function(_0x40ecbf){logger['error']('MailServerIn,\x20%s,\x20%s',_0x5a569b,_0x40ecbf);_0x307b3f(_0x40ecbf);});});}exports[_0xff19('0x14')]=function(_0x444871){var _0x509acb=this;return new Promise(function(_0xf506dd,_0x503131){return db[_0xff19('0x15')]['findAll']({'raw':_0x444871['options']?_0x444871[_0xff19('0x16')][_0xff19('0x17')]===undefined?!![]:![]:!![],'where':_0x444871[_0xff19('0x16')]?_0x444871['options'][_0xff19('0x18')]||null:null,'attributes':_0x444871[_0xff19('0x16')]?_0x444871[_0xff19('0x16')][_0xff19('0x19')]||null:null,'limit':_0x444871[_0xff19('0x16')]?_0x444871[_0xff19('0x16')][_0xff19('0x1a')]||null:null,'include':_0x444871[_0xff19('0x16')]?_0x444871[_0xff19('0x16')][_0xff19('0x1b')]?_['map'](_0x444871[_0xff19('0x16')][_0xff19('0x1b')],function(_0x4ff555){return{'model':db[_0x4ff555[_0xff19('0x1c')]],'as':_0x4ff555['as'],'attributes':_0x4ff555[_0xff19('0x19')],'include':_0x4ff555[_0xff19('0x1b')]?_[_0xff19('0x1d')](_0x4ff555['include'],function(_0x58d388){return{'model':db[_0x58d388[_0xff19('0x1c')]],'as':_0x58d388['as'],'attributes':_0x58d388['attributes'],'include':_0x58d388[_0xff19('0x1b')]?_[_0xff19('0x1d')](_0x58d388[_0xff19('0x1b')],function(_0x11efc6){return{'model':db[_0x11efc6[_0xff19('0x1c')]],'as':_0x11efc6['as'],'attributes':_0x11efc6[_0xff19('0x19')]};}):[]};}):[]};}):[]:[]})[_0xff19('0xb')](function(_0x530509){logger[_0xff19('0xc')](_0xff19('0x14'),_0x444871);logger[_0xff19('0xe')](_0xff19('0x14'),_0x444871,JSON[_0xff19('0x1e')](_0x530509));_0xf506dd(_0x530509);})[_0xff19('0x13')](function(_0x19d349){logger['error'](_0xff19('0x14'),_0x19d349[_0xff19('0x12')],_0x444871);_0x503131(_0x509acb[_0xff19('0xf')](0x1f4,_0x19d349['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 5a0eec9..e2cd315 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 _0x2b81=['show','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','index','get','/:id'];(function(_0x138caa,_0x16baab){var _0x4d2be8=function(_0x3978bc){while(--_0x3978bc){_0x138caa['push'](_0x138caa['shift']());}};_0x4d2be8(++_0x16baab);}(_0x2b81,0x1b9));var _0x12b8=function(_0x1ad9a3,_0x56a1d){_0x1ad9a3=_0x1ad9a3-0x0;var _0x3dc656=_0x2b81[_0x1ad9a3];return _0x3dc656;};'use strict';var multer=require(_0x12b8('0x0'));var util=require(_0x12b8('0x1'));var path=require(_0x12b8('0x2'));var timeout=require(_0x12b8('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x12b8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x12b8('0x5'));var controller=require('./mailServerOut.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x12b8('0x6')]);router[_0x12b8('0x7')](_0x12b8('0x8'),auth['isAuthenticated'](),controller[_0x12b8('0x9')]);router['post']('/',auth[_0x12b8('0xa')](),controller['create']);router['put'](_0x12b8('0x8'),auth[_0x12b8('0xa')](),controller[_0x12b8('0xb')]);router[_0x12b8('0xc')](_0x12b8('0x8'),auth['isAuthenticated'](),controller[_0x12b8('0xd')]);module[_0x12b8('0xe')]=router; \ No newline at end of file +var _0x4cbb=['post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','Router','./mailServerOut.controller','get','index','/:id','show'];(function(_0x1a24f8,_0xf25039){var _0x232269=function(_0x437b18){while(--_0x437b18){_0x1a24f8['push'](_0x1a24f8['shift']());}};_0x232269(++_0xf25039);}(_0x4cbb,0xc8));var _0xb4cb=function(_0x17c487,_0x2b72f1){_0x17c487=_0x17c487-0x0;var _0x3feeb8=_0x4cbb[_0x17c487];return _0x3feeb8;};'use strict';var multer=require(_0xb4cb('0x0'));var util=require(_0xb4cb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb4cb('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb4cb('0x3'));router[_0xb4cb('0x4')]('/',auth['isAuthenticated'](),controller[_0xb4cb('0x5')]);router[_0xb4cb('0x4')](_0xb4cb('0x6'),auth['isAuthenticated'](),controller[_0xb4cb('0x7')]);router[_0xb4cb('0x8')]('/',auth[_0xb4cb('0x9')](),controller[_0xb4cb('0xa')]);router[_0xb4cb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb4cb('0xc')]);router[_0xb4cb('0xd')](_0xb4cb('0x6'),auth['isAuthenticated'](),controller[_0xb4cb('0xe')]);module[_0xb4cb('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 92e3482..739f4b6 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 _0x33ac=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x23e013,_0x5d060c){var _0x3cc945=function(_0x253331){while(--_0x253331){_0x23e013['push'](_0x23e013['shift']());}};_0x3cc945(++_0x5d060c);}(_0x33ac,0x1f2));var _0xc33a=function(_0x2fb3f5,_0x5a6374){_0x2fb3f5=_0x2fb3f5-0x0;var _0x1e23df=_0x33ac[_0x2fb3f5];return _0x1e23df;};'use strict';var Sequelize=require('sequelize');module[_0xc33a('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xc33a('0x1')]},'pass':{'type':Sequelize[_0xc33a('0x1')]},'port':{'type':Sequelize[_0xc33a('0x2')]},'secure':{'type':Sequelize[_0xc33a('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xc33a('0x1')]},'authentication':{'type':Sequelize[_0xc33a('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa456=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x293bcb,_0x163e4c){var _0x3dc9b4=function(_0x3dbdcf){while(--_0x3dbdcf){_0x293bcb['push'](_0x293bcb['shift']());}};_0x3dc9b4(++_0x163e4c);}(_0xa456,0x142));var _0x6a45=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xa456[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'description':{'type':Sequelize[_0x6a45('0x2')]},'host':{'type':Sequelize[_0x6a45('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x6a45('0x2')]},'port':{'type':Sequelize[_0x6a45('0x3')]},'secure':{'type':Sequelize[_0x6a45('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x6a45('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 51a0268..3550576 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 _0x616a=['MailServerOut','findAll','show','params','keys','length','merge','options','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','status','end','json','count','limit','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','nolimit','offset','order','sort','where','pick','filter','includeAll','include'];(function(_0x23320d,_0x11c192){var _0x23aaa4=function(_0x28037d){while(--_0x28037d){_0x23320d['push'](_0x23320d['shift']());}};_0x23aaa4(++_0x11c192);}(_0x616a,0x11d));var _0xa616=function(_0x1c10b4,_0x3bbb18){_0x1c10b4=_0x1c10b4-0x0;var _0x1f766c=_0x616a[_0x1c10b4];return _0x1f766c;};'use strict';var pdf=require(_0xa616('0x0'));var emlformat=require(_0xa616('0x1'));var rimraf=require(_0xa616('0x2'));var zipdir=require(_0xa616('0x3'));var jsonpatch=require(_0xa616('0x4'));var rp=require('request-promise');var moment=require(_0xa616('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa616('0x6'));var util=require(_0xa616('0x7'));var path=require(_0xa616('0x8'));var sox=require('sox');var csv=require(_0xa616('0x9'));var ejs=require(_0xa616('0xa'));var fs=require('fs');var _=require(_0xa616('0xb'));var squel=require('squel');var crypto=require(_0xa616('0xc'));var jsforce=require(_0xa616('0xd'));var deskjs=require(_0xa616('0xe'));var toCsv=require(_0xa616('0x9'));var querystring=require(_0xa616('0xf'));var Papa=require('papaparse');var Redis=require(_0xa616('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa616('0x11'));var as=require(_0xa616('0x12'));var hardwareService=require(_0xa616('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa616('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x408fe2,_0x59b289){_0x59b289=_0x59b289||0xcc;return function(_0x11da77){if(_0x11da77){return _0x408fe2['sendStatus'](_0x59b289);}return _0x408fe2[_0xa616('0x15')](_0x59b289)[_0xa616('0x16')]();};}function respondWithResult(_0x524df4,_0xa7c604){_0xa7c604=_0xa7c604||0xc8;return function(_0x4daba9){if(_0x4daba9){return _0x524df4[_0xa616('0x15')](_0xa7c604)[_0xa616('0x17')](_0x4daba9);}};}function respondWithFilteredResult(_0x27d5d6,_0x2cd0d5){return function(_0x5d3c01){if(_0x5d3c01){var _0x5bd270=_0x5d3c01[_0xa616('0x18')],_0xb830cf=_0x2cd0d5['offset'],_0x24e0ac=_0x2cd0d5['offset']+_0x2cd0d5[_0xa616('0x19')],_0x168c4a;if(_0x24e0ac>=_0x5bd270){_0x24e0ac=_0x5bd270;_0x168c4a=0xc8;}else{_0x168c4a=0xce;}_0x27d5d6[_0xa616('0x15')](_0x168c4a);return _0x27d5d6[_0xa616('0x1a')](_0xa616('0x1b'),_0xb830cf+'-'+_0x24e0ac+'/'+_0x5bd270)[_0xa616('0x17')](_0x5d3c01);}return null;};}function patchUpdates(_0x1b1f34){return function(_0xf6c28b){try{jsonpatch[_0xa616('0x1c')](_0xf6c28b,_0x1b1f34,!![]);}catch(_0xa68473){return BPromise['reject'](_0xa68473);}return _0xf6c28b['save']();};}function saveUpdates(_0x548dd7,_0x29bcf0){return function(_0x26adf5){if(_0x26adf5){return _0x26adf5[_0xa616('0x1d')](_0x548dd7)[_0xa616('0x1e')](function(_0x2d1c36){return _0x2d1c36;});}return null;};}function removeEntity(_0x3170ab,_0x4d1390){return function(_0x273dbb){if(_0x273dbb){return _0x273dbb['destroy']()[_0xa616('0x1e')](function(){_0x3170ab[_0xa616('0x15')](0xcc)[_0xa616('0x16')]();});}};}function handleEntityNotFound(_0x25c46f,_0xd1892f){return function(_0x11d300){if(!_0x11d300){_0x25c46f[_0xa616('0x1f')](0x194);}return _0x11d300;};}function handleError(_0x43b2a6,_0xa931a3){_0xa931a3=_0xa931a3||0x1f4;return function(_0x3be3fd){logger[_0xa616('0x20')](_0x3be3fd[_0xa616('0x21')]);if(_0x3be3fd[_0xa616('0x22')]){delete _0x3be3fd['name'];}_0x43b2a6[_0xa616('0x15')](_0xa931a3)[_0xa616('0x23')](_0x3be3fd);};}exports['index']=function(_0x5ba539,_0x27a335){var _0x5ccfdf={},_0x2636fe={},_0x10e367={'count':0x0,'rows':[]};var _0x36016f=_[_0xa616('0x24')](db['MailServerOut'][_0xa616('0x25')],function(_0x506024){return{'name':_0x506024['fieldName'],'type':_0x506024[_0xa616('0x26')][_0xa616('0x27')]};});_0x2636fe[_0xa616('0x28')]=_[_0xa616('0x24')](_0x36016f,_0xa616('0x22'));_0x2636fe[_0xa616('0x29')]=_['keys'](_0x5ba539[_0xa616('0x29')]);_0x2636fe[_0xa616('0x2a')]=_[_0xa616('0x2b')](_0x2636fe['model'],_0x2636fe[_0xa616('0x29')]);_0x5ccfdf['attributes']=_[_0xa616('0x2b')](_0x2636fe[_0xa616('0x28')],qs[_0xa616('0x2c')](_0x5ba539['query']['fields']));_0x5ccfdf[_0xa616('0x2d')]=_0x5ccfdf[_0xa616('0x2d')]['length']?_0x5ccfdf['attributes']:_0x2636fe['model'];if(!_0x5ba539['query']['hasOwnProperty'](_0xa616('0x2e'))){_0x5ccfdf['limit']=qs[_0xa616('0x19')](_0x5ba539[_0xa616('0x29')][_0xa616('0x19')]);_0x5ccfdf[_0xa616('0x2f')]=qs[_0xa616('0x2f')](_0x5ba539['query'][_0xa616('0x2f')]);}_0x5ccfdf[_0xa616('0x30')]=qs[_0xa616('0x31')](_0x5ba539[_0xa616('0x29')]['sort']);_0x5ccfdf[_0xa616('0x32')]=qs['filters'](_[_0xa616('0x33')](_0x5ba539[_0xa616('0x29')],_0x2636fe[_0xa616('0x2a')]),_0x36016f);if(_0x5ba539[_0xa616('0x29')][_0xa616('0x34')]){_0x5ccfdf[_0xa616('0x32')]=_['merge'](_0x5ccfdf[_0xa616('0x32')],{'$or':_[_0xa616('0x24')](_0x36016f,function(_0x3b542f){if(_0x3b542f['type']!=='VIRTUAL'){var _0x4c76ee={};_0x4c76ee[_0x3b542f[_0xa616('0x22')]]={'$like':'%'+_0x5ba539[_0xa616('0x29')][_0xa616('0x34')]+'%'};return _0x4c76ee;}})});}_0x5ccfdf=_['merge']({},_0x5ccfdf,_0x5ba539['options']);var _0x2dde6d={'where':_0x5ccfdf['where']};return db['MailServerOut'][_0xa616('0x18')](_0x2dde6d)[_0xa616('0x1e')](function(_0xb8b4af){_0x10e367[_0xa616('0x18')]=_0xb8b4af;if(_0x5ba539[_0xa616('0x29')][_0xa616('0x35')]){_0x5ccfdf[_0xa616('0x36')]=[{'all':!![]}];}return db[_0xa616('0x37')][_0xa616('0x38')](_0x5ccfdf);})['then'](function(_0x247ca5){_0x10e367['rows']=_0x247ca5;return _0x10e367;})[_0xa616('0x1e')](respondWithFilteredResult(_0x27a335,_0x5ccfdf))['catch'](handleError(_0x27a335,null));};exports[_0xa616('0x39')]=function(_0x593c26,_0x309752){var _0x2875ad={'raw':!![],'where':{'id':_0x593c26[_0xa616('0x3a')]['id']}},_0x5d8b2b={};_0x5d8b2b['model']=_[_0xa616('0x3b')](db['MailServerOut'][_0xa616('0x25')]);_0x5d8b2b[_0xa616('0x29')]=_['keys'](_0x593c26[_0xa616('0x29')]);_0x5d8b2b[_0xa616('0x2a')]=_[_0xa616('0x2b')](_0x5d8b2b[_0xa616('0x28')],_0x5d8b2b[_0xa616('0x29')]);_0x2875ad[_0xa616('0x2d')]=_[_0xa616('0x2b')](_0x5d8b2b['model'],qs[_0xa616('0x2c')](_0x593c26[_0xa616('0x29')]['fields']));_0x2875ad[_0xa616('0x2d')]=_0x2875ad[_0xa616('0x2d')][_0xa616('0x3c')]?_0x2875ad[_0xa616('0x2d')]:_0x5d8b2b[_0xa616('0x28')];if(_0x593c26[_0xa616('0x29')][_0xa616('0x35')]){_0x2875ad['include']=[{'all':!![]}];}_0x2875ad=_[_0xa616('0x3d')]({},_0x2875ad,_0x593c26[_0xa616('0x3e')]);return db['MailServerOut'][_0xa616('0x3f')](_0x2875ad)[_0xa616('0x1e')](handleEntityNotFound(_0x309752,null))[_0xa616('0x1e')](respondWithResult(_0x309752,null))[_0xa616('0x40')](handleError(_0x309752,null));};exports['create']=function(_0x3e4d95,_0x43dcae){return db['MailServerOut'][_0xa616('0x41')](_0x3e4d95['body'],{})[_0xa616('0x1e')](respondWithResult(_0x43dcae,0xc9))[_0xa616('0x40')](handleError(_0x43dcae,null));};exports[_0xa616('0x1d')]=function(_0x3e63d7,_0x791dd4){if(_0x3e63d7[_0xa616('0x42')]['id']){delete _0x3e63d7['body']['id'];}return db[_0xa616('0x37')][_0xa616('0x3f')]({'where':{'id':_0x3e63d7[_0xa616('0x3a')]['id']}})[_0xa616('0x1e')](handleEntityNotFound(_0x791dd4,null))[_0xa616('0x1e')](saveUpdates(_0x3e63d7[_0xa616('0x42')],null))[_0xa616('0x1e')](respondWithResult(_0x791dd4,null))[_0xa616('0x40')](handleError(_0x791dd4,null));};exports[_0xa616('0x43')]=function(_0x596c05,_0x5425f0){return db[_0xa616('0x37')][_0xa616('0x3f')]({'where':{'id':_0x596c05[_0xa616('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5425f0,null))['then'](removeEntity(_0x5425f0,null))[_0xa616('0x40')](handleError(_0x5425f0,null));}; \ No newline at end of file +var _0x1edf=['to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','Content-Range','json','apply','save','destroy','then','stack','name','send','index','map','MailServerOut','fieldName','key','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','sort','filters','pick','where','type','VIRTUAL','filter','merge','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0x1edf,0xcd));var _0xf1ed=function(_0x543b2c,_0xb73dd3){_0x543b2c=_0x543b2c-0x0;var _0x216472=_0x1edf[_0x543b2c];return _0x216472;};'use strict';var pdf=require(_0xf1ed('0x0'));var emlformat=require(_0xf1ed('0x1'));var rimraf=require(_0xf1ed('0x2'));var zipdir=require(_0xf1ed('0x3'));var jsonpatch=require(_0xf1ed('0x4'));var rp=require(_0xf1ed('0x5'));var moment=require(_0xf1ed('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf1ed('0x7'));var util=require(_0xf1ed('0x8'));var path=require(_0xf1ed('0x9'));var sox=require(_0xf1ed('0xa'));var csv=require(_0xf1ed('0xb'));var ejs=require(_0xf1ed('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf1ed('0xd'));var jsforce=require(_0xf1ed('0xe'));var deskjs=require(_0xf1ed('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf1ed('0x10'));var Papa=require(_0xf1ed('0x11'));var Redis=require('ioredis');var authService=require(_0xf1ed('0x12'));var qs=require(_0xf1ed('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1ed('0x14'));var logger=require(_0xf1ed('0x15'))(_0xf1ed('0x16'));var utils=require(_0xf1ed('0x17'));var config=require('../../config/environment');var db=require(_0xf1ed('0x18'))['db'];function respondWithStatusCode(_0x5b8127,_0x20aca8){_0x20aca8=_0x20aca8||0xcc;return function(_0x2bb9dc){if(_0x2bb9dc){return _0x5b8127[_0xf1ed('0x19')](_0x20aca8);}return _0x5b8127[_0xf1ed('0x1a')](_0x20aca8)[_0xf1ed('0x1b')]();};}function respondWithResult(_0x558f87,_0x5bf7a8){_0x5bf7a8=_0x5bf7a8||0xc8;return function(_0x1eefd5){if(_0x1eefd5){return _0x558f87['status'](_0x5bf7a8)['json'](_0x1eefd5);}};}function respondWithFilteredResult(_0x485c10,_0x3f6c06){return function(_0xbde09a){if(_0xbde09a){var _0x466964=_0xbde09a['count'],_0x36244a=_0x3f6c06[_0xf1ed('0x1c')],_0x30b635=_0x3f6c06['offset']+_0x3f6c06['limit'],_0x6eab82;if(_0x30b635>=_0x466964){_0x30b635=_0x466964;_0x6eab82=0xc8;}else{_0x6eab82=0xce;}_0x485c10[_0xf1ed('0x1a')](_0x6eab82);return _0x485c10['set'](_0xf1ed('0x1d'),_0x36244a+'-'+_0x30b635+'/'+_0x466964)[_0xf1ed('0x1e')](_0xbde09a);}return null;};}function patchUpdates(_0x52cc00){return function(_0x33e35b){try{jsonpatch[_0xf1ed('0x1f')](_0x33e35b,_0x52cc00,!![]);}catch(_0x4bdd52){return BPromise['reject'](_0x4bdd52);}return _0x33e35b[_0xf1ed('0x20')]();};}function saveUpdates(_0x354315,_0x1eb7d0){return function(_0x684dd6){if(_0x684dd6){return _0x684dd6['update'](_0x354315)['then'](function(_0x26748b){return _0x26748b;});}return null;};}function removeEntity(_0xd0012e,_0x559424){return function(_0x5e1c9e){if(_0x5e1c9e){return _0x5e1c9e[_0xf1ed('0x21')]()[_0xf1ed('0x22')](function(){_0xd0012e[_0xf1ed('0x1a')](0xcc)[_0xf1ed('0x1b')]();});}};}function handleEntityNotFound(_0x4b4104,_0x5b60be){return function(_0x17c523){if(!_0x17c523){_0x4b4104[_0xf1ed('0x19')](0x194);}return _0x17c523;};}function handleError(_0x3a2f97,_0x215188){_0x215188=_0x215188||0x1f4;return function(_0x45aa20){logger['error'](_0x45aa20[_0xf1ed('0x23')]);if(_0x45aa20[_0xf1ed('0x24')]){delete _0x45aa20[_0xf1ed('0x24')];}_0x3a2f97[_0xf1ed('0x1a')](_0x215188)[_0xf1ed('0x25')](_0x45aa20);};}exports[_0xf1ed('0x26')]=function(_0x317b59,_0x451d6a){var _0x3c2926={},_0x48819c={},_0x4e75ae={'count':0x0,'rows':[]};var _0x30a048=_[_0xf1ed('0x27')](db[_0xf1ed('0x28')]['rawAttributes'],function(_0x5e2602){return{'name':_0x5e2602[_0xf1ed('0x29')],'type':_0x5e2602['type'][_0xf1ed('0x2a')]};});_0x48819c['model']=_[_0xf1ed('0x27')](_0x30a048,_0xf1ed('0x24'));_0x48819c['query']=_['keys'](_0x317b59[_0xf1ed('0x2b')]);_0x48819c['filters']=_[_0xf1ed('0x2c')](_0x48819c['model'],_0x48819c[_0xf1ed('0x2b')]);_0x3c2926[_0xf1ed('0x2d')]=_['intersection'](_0x48819c['model'],qs[_0xf1ed('0x2e')](_0x317b59['query'][_0xf1ed('0x2e')]));_0x3c2926['attributes']=_0x3c2926[_0xf1ed('0x2d')][_0xf1ed('0x2f')]?_0x3c2926[_0xf1ed('0x2d')]:_0x48819c[_0xf1ed('0x30')];if(!_0x317b59[_0xf1ed('0x2b')][_0xf1ed('0x31')](_0xf1ed('0x32'))){_0x3c2926[_0xf1ed('0x33')]=qs[_0xf1ed('0x33')](_0x317b59[_0xf1ed('0x2b')][_0xf1ed('0x33')]);_0x3c2926[_0xf1ed('0x1c')]=qs[_0xf1ed('0x1c')](_0x317b59[_0xf1ed('0x2b')][_0xf1ed('0x1c')]);}_0x3c2926['order']=qs[_0xf1ed('0x34')](_0x317b59[_0xf1ed('0x2b')][_0xf1ed('0x34')]);_0x3c2926['where']=qs[_0xf1ed('0x35')](_[_0xf1ed('0x36')](_0x317b59[_0xf1ed('0x2b')],_0x48819c[_0xf1ed('0x35')]),_0x30a048);if(_0x317b59[_0xf1ed('0x2b')]['filter']){_0x3c2926[_0xf1ed('0x37')]=_['merge'](_0x3c2926[_0xf1ed('0x37')],{'$or':_[_0xf1ed('0x27')](_0x30a048,function(_0x30e89d){if(_0x30e89d[_0xf1ed('0x38')]!==_0xf1ed('0x39')){var _0x75b1c={};_0x75b1c[_0x30e89d[_0xf1ed('0x24')]]={'$like':'%'+_0x317b59[_0xf1ed('0x2b')][_0xf1ed('0x3a')]+'%'};return _0x75b1c;}})});}_0x3c2926=_[_0xf1ed('0x3b')]({},_0x3c2926,_0x317b59['options']);var _0x2ed301={'where':_0x3c2926[_0xf1ed('0x37')]};return db[_0xf1ed('0x28')][_0xf1ed('0x3c')](_0x2ed301)[_0xf1ed('0x22')](function(_0x12008a){_0x4e75ae['count']=_0x12008a;if(_0x317b59['query'][_0xf1ed('0x3d')]){_0x3c2926['include']=[{'all':!![]}];}return db[_0xf1ed('0x28')][_0xf1ed('0x3e')](_0x3c2926);})[_0xf1ed('0x22')](function(_0x49c011){_0x4e75ae[_0xf1ed('0x3f')]=_0x49c011;return _0x4e75ae;})['then'](respondWithFilteredResult(_0x451d6a,_0x3c2926))[_0xf1ed('0x40')](handleError(_0x451d6a,null));};exports[_0xf1ed('0x41')]=function(_0xae515,_0x5cc35a){var _0x30b6f2={'raw':!![],'where':{'id':_0xae515[_0xf1ed('0x42')]['id']}},_0x3f7a20={};_0x3f7a20['model']=_[_0xf1ed('0x43')](db[_0xf1ed('0x28')]['rawAttributes']);_0x3f7a20['query']=_[_0xf1ed('0x43')](_0xae515[_0xf1ed('0x2b')]);_0x3f7a20['filters']=_['intersection'](_0x3f7a20[_0xf1ed('0x30')],_0x3f7a20[_0xf1ed('0x2b')]);_0x30b6f2['attributes']=_['intersection'](_0x3f7a20['model'],qs[_0xf1ed('0x2e')](_0xae515[_0xf1ed('0x2b')]['fields']));_0x30b6f2[_0xf1ed('0x2d')]=_0x30b6f2[_0xf1ed('0x2d')]['length']?_0x30b6f2[_0xf1ed('0x2d')]:_0x3f7a20[_0xf1ed('0x30')];if(_0xae515[_0xf1ed('0x2b')][_0xf1ed('0x3d')]){_0x30b6f2[_0xf1ed('0x44')]=[{'all':!![]}];}_0x30b6f2=_[_0xf1ed('0x3b')]({},_0x30b6f2,_0xae515['options']);return db[_0xf1ed('0x28')][_0xf1ed('0x45')](_0x30b6f2)['then'](handleEntityNotFound(_0x5cc35a,null))[_0xf1ed('0x22')](respondWithResult(_0x5cc35a,null))[_0xf1ed('0x40')](handleError(_0x5cc35a,null));};exports['create']=function(_0x411dba,_0x3dfdbf){return db[_0xf1ed('0x28')][_0xf1ed('0x46')](_0x411dba[_0xf1ed('0x47')],{})[_0xf1ed('0x22')](respondWithResult(_0x3dfdbf,0xc9))[_0xf1ed('0x40')](handleError(_0x3dfdbf,null));};exports['update']=function(_0x5de9c5,_0x4ad18e){if(_0x5de9c5[_0xf1ed('0x47')]['id']){delete _0x5de9c5[_0xf1ed('0x47')]['id'];}return db[_0xf1ed('0x28')]['find']({'where':{'id':_0x5de9c5[_0xf1ed('0x42')]['id']}})[_0xf1ed('0x22')](handleEntityNotFound(_0x4ad18e,null))['then'](saveUpdates(_0x5de9c5[_0xf1ed('0x47')],null))['then'](respondWithResult(_0x4ad18e,null))[_0xf1ed('0x40')](handleError(_0x4ad18e,null));};exports[_0xf1ed('0x21')]=function(_0x1ca715,_0x4e80c5){return db[_0xf1ed('0x28')][_0xf1ed('0x45')]({'where':{'id':_0x1ca715[_0xf1ed('0x42')]['id']}})[_0xf1ed('0x22')](handleEntityNotFound(_0x4e80c5,null))[_0xf1ed('0x22')](removeEntity(_0x4e80c5,null))['catch'](handleError(_0x4e80c5,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index b6b6010..8629b87 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 _0xa076=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailServerOut'];(function(_0x56ca1c,_0x23b8f2){var _0xb74630=function(_0x432de7){while(--_0x432de7){_0x56ca1c['push'](_0x56ca1c['shift']());}};_0xb74630(++_0x23b8f2);}(_0xa076,0xfd));var _0x6a07=function(_0x311dba,_0xcf976){_0x311dba=_0x311dba-0x0;var _0x3ba537=_0xa076[_0x311dba];return _0x3ba537;};'use strict';var _=require('lodash');var util=require(_0x6a07('0x0'));var logger=require(_0x6a07('0x1'))(_0x6a07('0x2'));var moment=require(_0x6a07('0x3'));var BPromise=require(_0x6a07('0x4'));var rp=require(_0x6a07('0x5'));var fs=require('fs');var path=require(_0x6a07('0x6'));var rimraf=require(_0x6a07('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0x6a07('0x8')]=function(_0x29469a,_0x2a4e84){return _0x29469a[_0x6a07('0x9')](_0x6a07('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3259=['MailServerOut','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports'];(function(_0x35ec52,_0x16d639){var _0x2f38f5=function(_0x340e83){while(--_0x340e83){_0x35ec52['push'](_0x35ec52['shift']());}};_0x2f38f5(++_0x16d639);}(_0x3259,0xeb));var _0x9325=function(_0x487a10,_0xf06e9a){_0x487a10=_0x487a10-0x0;var _0x49a3b0=_0x3259[_0x487a10];return _0x49a3b0;};'use strict';var _=require(_0x9325('0x0'));var util=require(_0x9325('0x1'));var logger=require(_0x9325('0x2'))(_0x9325('0x3'));var moment=require(_0x9325('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9325('0x5'));var rimraf=require('rimraf');var config=require(_0x9325('0x6'));var attributes=require('./mailServerOut.attributes');module[_0x9325('0x7')]=function(_0x474e46,_0x58d817){return _0x474e46['define'](_0x9325('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index d3caa21..2e0c224 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 _0xff2c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird'];(function(_0x364450,_0xd81db8){var _0x3d9c5e=function(_0x447374){while(--_0x447374){_0x364450['push'](_0x364450['shift']());}};_0x3d9c5e(++_0xd81db8);}(_0xff2c,0xe4));var _0xcff2=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xff2c[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xcff2('0x0'));var util=require('util');var moment=require(_0xcff2('0x1'));var BPromise=require(_0xcff2('0x2'));var rs=require(_0xcff2('0x3'));var fs=require('fs');var Redis=require(_0xcff2('0x4'));var db=require(_0xcff2('0x5'))['db'];var utils=require(_0xcff2('0x6'));var logger=require(_0xcff2('0x7'))('rpc');var config=require(_0xcff2('0x8'));var jayson=require(_0xcff2('0x9'));var client=jayson['client'][_0xcff2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59537f,_0x291eb7,_0x2bbbfe){return new BPromise(function(_0x1f17a2,_0x28f5ed){return client[_0xcff2('0xb')](_0x59537f,_0x2bbbfe)['then'](function(_0x4d9810){logger[_0xcff2('0xc')](_0xcff2('0xd'),_0x291eb7,_0xcff2('0xe'));logger[_0xcff2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x291eb7,'request\x20sent',JSON[_0xcff2('0x10')](_0x4d9810));if(_0x4d9810[_0xcff2('0x11')]){if(_0x4d9810['error'][_0xcff2('0x12')]===0x1f4){logger[_0xcff2('0x11')](_0xcff2('0xd'),_0x291eb7,_0x4d9810[_0xcff2('0x11')][_0xcff2('0x13')]);return _0x28f5ed(_0x4d9810[_0xcff2('0x11')]['message']);}logger[_0xcff2('0x11')]('MailServerOut,\x20%s,\x20%s',_0x291eb7,_0x4d9810[_0xcff2('0x11')][_0xcff2('0x13')]);return _0x1f17a2(_0x4d9810[_0xcff2('0x11')][_0xcff2('0x13')]);}else{logger[_0xcff2('0xc')](_0xcff2('0xd'),_0x291eb7,_0xcff2('0xe'));_0x1f17a2(_0x4d9810['result'][_0xcff2('0x13')]);}})[_0xcff2('0x14')](function(_0x18f641){logger[_0xcff2('0x11')](_0xcff2('0xd'),_0x291eb7,_0x18f641);_0x28f5ed(_0x18f641);});});} \ No newline at end of file +var _0x0ad5=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','error','MailServerOut,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x1a8102,_0x513653){var _0x1333b4=function(_0x20fc71){while(--_0x20fc71){_0x1a8102['push'](_0x1a8102['shift']());}};_0x1333b4(++_0x513653);}(_0x0ad5,0x1e0));var _0x50ad=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0ad5[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x50ad('0x0'));var util=require(_0x50ad('0x1'));var moment=require(_0x50ad('0x2'));var BPromise=require('bluebird');var rs=require(_0x50ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50ad('0x4'))['db'];var utils=require(_0x50ad('0x5'));var logger=require(_0x50ad('0x6'))(_0x50ad('0x7'));var config=require(_0x50ad('0x8'));var jayson=require(_0x50ad('0x9'));var client=jayson[_0x50ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x373813,_0x52acfd,_0xdb9522){return new BPromise(function(_0x390381,_0x59add5){return client[_0x50ad('0xb')](_0x373813,_0xdb9522)[_0x50ad('0xc')](function(_0x5808b3){logger[_0x50ad('0xd')]('MailServerOut,\x20%s,\x20%s',_0x52acfd,_0x50ad('0xe'));logger[_0x50ad('0xf')](_0x50ad('0x10'),_0x52acfd,_0x50ad('0xe'),JSON['stringify'](_0x5808b3));if(_0x5808b3[_0x50ad('0x11')]){if(_0x5808b3[_0x50ad('0x11')]['code']===0x1f4){logger[_0x50ad('0x11')](_0x50ad('0x12'),_0x52acfd,_0x5808b3[_0x50ad('0x11')][_0x50ad('0x13')]);return _0x59add5(_0x5808b3['error'][_0x50ad('0x13')]);}logger[_0x50ad('0x11')](_0x50ad('0x12'),_0x52acfd,_0x5808b3[_0x50ad('0x11')][_0x50ad('0x13')]);return _0x390381(_0x5808b3['error'][_0x50ad('0x13')]);}else{logger['info']('MailServerOut,\x20%s,\x20%s',_0x52acfd,_0x50ad('0xe'));_0x390381(_0x5808b3['result'][_0x50ad('0x13')]);}})[_0x50ad('0x14')](function(_0x2b3734){logger[_0x50ad('0x11')]('MailServerOut,\x20%s,\x20%s',_0x52acfd,_0x2b3734);_0x59add5(_0x2b3734);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 71e0fcc..74f820f 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 _0x19ea=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put'];(function(_0x47aded,_0xb76625){var _0x505e9a=function(_0x68696d){while(--_0x68696d){_0x47aded['push'](_0x47aded['shift']());}};_0x505e9a(++_0xb76625);}(_0x19ea,0xe0));var _0xa19e=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x19ea[_0x424501];return _0xb719af;};'use strict';var multer=require('multer');var util=require(_0xa19e('0x0'));var path=require(_0xa19e('0x1'));var timeout=require(_0xa19e('0x2'));var express=require(_0xa19e('0x3'));var router=express[_0xa19e('0x4')]();var auth=require(_0xa19e('0x5'));var interaction=require(_0xa19e('0x6'));var config=require('../../config/environment');var controller=require(_0xa19e('0x7'));router[_0xa19e('0x8')]('/',auth[_0xa19e('0x9')](),controller[_0xa19e('0xa')]);router[_0xa19e('0x8')](_0xa19e('0xb'),auth[_0xa19e('0x9')](),controller[_0xa19e('0xc')]);router[_0xa19e('0x8')](_0xa19e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa19e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa19e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa19e('0x10')]);router[_0xa19e('0x11')](_0xa19e('0xd'),auth[_0xa19e('0x9')](),controller[_0xa19e('0x12')]);module[_0xa19e('0x13')]=router; \ No newline at end of file +var _0xf427=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','/:id','create','put','update','delete','destroy','path'];(function(_0x43028e,_0x33a648){var _0x2fed6d=function(_0x3d2598){while(--_0x3d2598){_0x43028e['push'](_0x43028e['shift']());}};_0x2fed6d(++_0x33a648);}(_0xf427,0x1ee));var _0x7f42=function(_0x321bf0,_0x879e7){_0x321bf0=_0x321bf0-0x0;var _0x39cfa3=_0xf427[_0x321bf0];return _0x39cfa3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f42('0x0'));var timeout=require(_0x7f42('0x1'));var express=require(_0x7f42('0x2'));var router=express[_0x7f42('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7f42('0x4'));var config=require(_0x7f42('0x5'));var controller=require('./mailSubstatus.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7f42('0x6')]);router[_0x7f42('0x7')]('/describe',auth[_0x7f42('0x8')](),controller['describe']);router[_0x7f42('0x7')](_0x7f42('0x9'),auth[_0x7f42('0x8')](),controller['show']);router['post']('/',auth[_0x7f42('0x8')](),controller[_0x7f42('0xa')]);router[_0x7f42('0xb')](_0x7f42('0x9'),auth[_0x7f42('0x8')](),controller[_0x7f42('0xc')]);router[_0x7f42('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7f42('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 53b5ddd..5a39806 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 _0x04cc=['STRING','name','sequelize','exports'];(function(_0x575524,_0x758dc4){var _0x54547f=function(_0x10f9dd){while(--_0x10f9dd){_0x575524['push'](_0x575524['shift']());}};_0x54547f(++_0x758dc4);}(_0x04cc,0x11a));var _0xc04c=function(_0x3937e7,_0x91712b){_0x3937e7=_0x3937e7-0x0;var _0x197ad7=_0x04cc[_0x3937e7];return _0x197ad7;};'use strict';var Sequelize=require(_0xc04c('0x0'));module[_0xc04c('0x1')]={'name':{'type':Sequelize[_0xc04c('0x2')],'unique':_0xc04c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf981=['STRING','name','sequelize','exports'];(function(_0x3449ed,_0x242e49){var _0x125128=function(_0x1cc7bc){while(--_0x1cc7bc){_0x3449ed['push'](_0x3449ed['shift']());}};_0x125128(++_0x242e49);}(_0xf981,0xe6));var _0x1f98=function(_0x451bf6,_0x437892){_0x451bf6=_0x451bf6-0x0;var _0x10a6a2=_0xf981[_0x451bf6];return _0x10a6a2;};'use strict';var Sequelize=require(_0x1f98('0x0'));module[_0x1f98('0x1')]={'name':{'type':Sequelize[_0x1f98('0x2')],'unique':_0x1f98('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1f98('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index a9fb33b..ffc1f6e 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 _0xdfe1=['squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','findAll','rows','catch','params','keys','include','find','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x3cfba1,_0x334ed0){var _0x403063=function(_0x4e2698){while(--_0x4e2698){_0x3cfba1['push'](_0x3cfba1['shift']());}};_0x403063(++_0x334ed0);}(_0xdfe1,0x166));var _0x1dfe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdfe1[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x1dfe('0x0'));var emlformat=require(_0x1dfe('0x1'));var rimraf=require(_0x1dfe('0x2'));var zipdir=require(_0x1dfe('0x3'));var jsonpatch=require(_0x1dfe('0x4'));var rp=require('request-promise');var moment=require(_0x1dfe('0x5'));var BPromise=require(_0x1dfe('0x6'));var Mustache=require(_0x1dfe('0x7'));var util=require(_0x1dfe('0x8'));var path=require('path');var sox=require(_0x1dfe('0x9'));var csv=require(_0x1dfe('0xa'));var ejs=require(_0x1dfe('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1dfe('0xc'));var crypto=require(_0x1dfe('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1dfe('0xe'));var toCsv=require(_0x1dfe('0xa'));var querystring=require(_0x1dfe('0xf'));var Papa=require('papaparse');var Redis=require(_0x1dfe('0x10'));var authService=require(_0x1dfe('0x11'));var qs=require(_0x1dfe('0x12'));var as=require(_0x1dfe('0x13'));var hardwareService=require(_0x1dfe('0x14'));var logger=require(_0x1dfe('0x15'))(_0x1dfe('0x16'));var utils=require(_0x1dfe('0x17'));var config=require(_0x1dfe('0x18'));var db=require(_0x1dfe('0x19'))['db'];function respondWithStatusCode(_0x5056fb,_0xb0e783){_0xb0e783=_0xb0e783||0xcc;return function(_0x1d6a6a){if(_0x1d6a6a){return _0x5056fb[_0x1dfe('0x1a')](_0xb0e783);}return _0x5056fb[_0x1dfe('0x1b')](_0xb0e783)[_0x1dfe('0x1c')]();};}function respondWithResult(_0x28fdfb,_0x20358b){_0x20358b=_0x20358b||0xc8;return function(_0x33a229){if(_0x33a229){return _0x28fdfb[_0x1dfe('0x1b')](_0x20358b)[_0x1dfe('0x1d')](_0x33a229);}};}function respondWithFilteredResult(_0x227606,_0x28d5f2){return function(_0x506e3c){if(_0x506e3c){var _0xc6f11=_0x506e3c[_0x1dfe('0x1e')],_0xc7791a=_0x28d5f2[_0x1dfe('0x1f')],_0x5e4a25=_0x28d5f2[_0x1dfe('0x1f')]+_0x28d5f2[_0x1dfe('0x20')],_0xc491ec;if(_0x5e4a25>=_0xc6f11){_0x5e4a25=_0xc6f11;_0xc491ec=0xc8;}else{_0xc491ec=0xce;}_0x227606[_0x1dfe('0x1b')](_0xc491ec);return _0x227606[_0x1dfe('0x21')](_0x1dfe('0x22'),_0xc7791a+'-'+_0x5e4a25+'/'+_0xc6f11)['json'](_0x506e3c);}return null;};}function patchUpdates(_0x51968c){return function(_0xa16f99){try{jsonpatch[_0x1dfe('0x23')](_0xa16f99,_0x51968c,!![]);}catch(_0x3a2563){return BPromise['reject'](_0x3a2563);}return _0xa16f99[_0x1dfe('0x24')]();};}function saveUpdates(_0x4b58dc,_0x156de9){return function(_0x4b065e){if(_0x4b065e){return _0x4b065e['update'](_0x4b58dc)[_0x1dfe('0x25')](function(_0x5f14bb){return _0x5f14bb;});}return null;};}function removeEntity(_0x47065f,_0x36b3ef){return function(_0x4aa631){if(_0x4aa631){return _0x4aa631[_0x1dfe('0x26')]()[_0x1dfe('0x25')](function(){_0x47065f[_0x1dfe('0x1b')](0xcc)[_0x1dfe('0x1c')]();});}};}function handleEntityNotFound(_0x459f74,_0x138ffd){return function(_0x1e0eda){if(!_0x1e0eda){_0x459f74['sendStatus'](0x194);}return _0x1e0eda;};}function handleError(_0x1960d1,_0xf675be){_0xf675be=_0xf675be||0x1f4;return function(_0x55141a){logger[_0x1dfe('0x27')](_0x55141a['stack']);if(_0x55141a[_0x1dfe('0x28')]){delete _0x55141a['name'];}_0x1960d1[_0x1dfe('0x1b')](_0xf675be)['send'](_0x55141a);};}exports[_0x1dfe('0x29')]=function(_0x324bc1,_0x44edc4){var _0x1cd6fd={},_0x33d15e={},_0x1dc761={'count':0x0,'rows':[]};var _0x2d6c51=_[_0x1dfe('0x2a')](db[_0x1dfe('0x2b')][_0x1dfe('0x2c')],function(_0x389367){return{'name':_0x389367[_0x1dfe('0x2d')],'type':_0x389367[_0x1dfe('0x2e')][_0x1dfe('0x2f')]};});_0x33d15e[_0x1dfe('0x30')]=_[_0x1dfe('0x2a')](_0x2d6c51,_0x1dfe('0x28'));_0x33d15e[_0x1dfe('0x31')]=_['keys'](_0x324bc1[_0x1dfe('0x31')]);_0x33d15e[_0x1dfe('0x32')]=_['intersection'](_0x33d15e[_0x1dfe('0x30')],_0x33d15e[_0x1dfe('0x31')]);_0x1cd6fd['attributes']=_[_0x1dfe('0x33')](_0x33d15e[_0x1dfe('0x30')],qs['fields'](_0x324bc1['query'][_0x1dfe('0x34')]));_0x1cd6fd[_0x1dfe('0x35')]=_0x1cd6fd['attributes'][_0x1dfe('0x36')]?_0x1cd6fd[_0x1dfe('0x35')]:_0x33d15e[_0x1dfe('0x30')];if(!_0x324bc1['query'][_0x1dfe('0x37')](_0x1dfe('0x38'))){_0x1cd6fd[_0x1dfe('0x20')]=qs[_0x1dfe('0x20')](_0x324bc1[_0x1dfe('0x31')][_0x1dfe('0x20')]);_0x1cd6fd[_0x1dfe('0x1f')]=qs['offset'](_0x324bc1[_0x1dfe('0x31')]['offset']);}_0x1cd6fd['order']=qs['sort'](_0x324bc1[_0x1dfe('0x31')][_0x1dfe('0x39')]);_0x1cd6fd['where']=qs[_0x1dfe('0x32')](_[_0x1dfe('0x3a')](_0x324bc1[_0x1dfe('0x31')],_0x33d15e[_0x1dfe('0x32')]),_0x2d6c51);if(_0x324bc1[_0x1dfe('0x31')][_0x1dfe('0x3b')]){_0x1cd6fd[_0x1dfe('0x3c')]=_[_0x1dfe('0x3d')](_0x1cd6fd[_0x1dfe('0x3c')],{'$or':_[_0x1dfe('0x2a')](_0x2d6c51,function(_0x3872ef){if(_0x3872ef[_0x1dfe('0x2e')]!=='VIRTUAL'){var _0x4214bc={};_0x4214bc[_0x3872ef['name']]={'$like':'%'+_0x324bc1[_0x1dfe('0x31')]['filter']+'%'};return _0x4214bc;}})});}_0x1cd6fd=_[_0x1dfe('0x3d')]({},_0x1cd6fd,_0x324bc1[_0x1dfe('0x3e')]);var _0x3ddb56={'where':_0x1cd6fd[_0x1dfe('0x3c')]};return db[_0x1dfe('0x2b')]['count'](_0x3ddb56)[_0x1dfe('0x25')](function(_0x132260){_0x1dc761[_0x1dfe('0x1e')]=_0x132260;if(_0x324bc1['query']['includeAll']){_0x1cd6fd['include']=[{'all':!![]}];}return db[_0x1dfe('0x2b')][_0x1dfe('0x3f')](_0x1cd6fd);})['then'](function(_0x49c734){_0x1dc761[_0x1dfe('0x40')]=_0x49c734;return _0x1dc761;})[_0x1dfe('0x25')](respondWithFilteredResult(_0x44edc4,_0x1cd6fd))[_0x1dfe('0x41')](handleError(_0x44edc4,null));};exports['show']=function(_0x4163bb,_0x58edb5){var _0xb785ed={'raw':!![],'where':{'id':_0x4163bb[_0x1dfe('0x42')]['id']}},_0x1fd7bc={};_0x1fd7bc[_0x1dfe('0x30')]=_[_0x1dfe('0x43')](db[_0x1dfe('0x2b')][_0x1dfe('0x2c')]);_0x1fd7bc[_0x1dfe('0x31')]=_[_0x1dfe('0x43')](_0x4163bb[_0x1dfe('0x31')]);_0x1fd7bc['filters']=_['intersection'](_0x1fd7bc[_0x1dfe('0x30')],_0x1fd7bc[_0x1dfe('0x31')]);_0xb785ed['attributes']=_[_0x1dfe('0x33')](_0x1fd7bc[_0x1dfe('0x30')],qs['fields'](_0x4163bb[_0x1dfe('0x31')][_0x1dfe('0x34')]));_0xb785ed['attributes']=_0xb785ed[_0x1dfe('0x35')][_0x1dfe('0x36')]?_0xb785ed[_0x1dfe('0x35')]:_0x1fd7bc['model'];if(_0x4163bb[_0x1dfe('0x31')]['includeAll']){_0xb785ed[_0x1dfe('0x44')]=[{'all':!![]}];}_0xb785ed=_['merge']({},_0xb785ed,_0x4163bb[_0x1dfe('0x3e')]);return db['MailSubstatus'][_0x1dfe('0x45')](_0xb785ed)[_0x1dfe('0x25')](handleEntityNotFound(_0x58edb5,null))['then'](respondWithResult(_0x58edb5,null))[_0x1dfe('0x41')](handleError(_0x58edb5,null));};exports[_0x1dfe('0x46')]=function(_0x496ac7,_0x7802ff){return db[_0x1dfe('0x2b')][_0x1dfe('0x46')](_0x496ac7['body'],{})['then'](respondWithResult(_0x7802ff,0xc9))[_0x1dfe('0x41')](handleError(_0x7802ff,null));};exports[_0x1dfe('0x47')]=function(_0x475cfc,_0x315b34){if(_0x475cfc[_0x1dfe('0x48')]['id']){delete _0x475cfc[_0x1dfe('0x48')]['id'];}return db[_0x1dfe('0x2b')][_0x1dfe('0x45')]({'where':{'id':_0x475cfc[_0x1dfe('0x42')]['id']}})['then'](handleEntityNotFound(_0x315b34,null))['then'](saveUpdates(_0x475cfc['body'],null))[_0x1dfe('0x25')](respondWithResult(_0x315b34,null))['catch'](handleError(_0x315b34,null));};exports[_0x1dfe('0x26')]=function(_0x33deb2,_0x27ab34){return db[_0x1dfe('0x2b')][_0x1dfe('0x45')]({'where':{'id':_0x33deb2[_0x1dfe('0x42')]['id']}})['then'](handleEntityNotFound(_0x27ab34,null))[_0x1dfe('0x25')](removeEntity(_0x27ab34,null))[_0x1dfe('0x41')](handleError(_0x27ab34,null));};exports[_0x1dfe('0x49')]=function(_0xa7b82b,_0x111c53){return db[_0x1dfe('0x2b')][_0x1dfe('0x49')]()['then'](respondWithResult(_0x111c53,null))['catch'](handleError(_0x111c53,null));}; \ No newline at end of file +var _0xb09f=['rawAttributes','find','catch','create','update','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','querystring','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','then','destroy','sendStatus','error','name','send','index','map','MailSubstatus','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show'];(function(_0xdb47d8,_0x933e5b){var _0x5cdfd9=function(_0x3b69a8){while(--_0x3b69a8){_0xdb47d8['push'](_0xdb47d8['shift']());}};_0x5cdfd9(++_0x933e5b);}(_0xb09f,0x130));var _0xfb09=function(_0x14dbdb,_0x87a2aa){_0x14dbdb=_0x14dbdb-0x0;var _0x20d83a=_0xb09f[_0x14dbdb];return _0x20d83a;};'use strict';var pdf=require(_0xfb09('0x0'));var emlformat=require(_0xfb09('0x1'));var rimraf=require(_0xfb09('0x2'));var zipdir=require(_0xfb09('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfb09('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfb09('0x5'));var util=require(_0xfb09('0x6'));var path=require(_0xfb09('0x7'));var sox=require(_0xfb09('0x8'));var csv=require(_0xfb09('0x9'));var ejs=require(_0xfb09('0xa'));var fs=require('fs');var _=require(_0xfb09('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb09('0x9'));var querystring=require(_0xfb09('0xc'));var Papa=require('papaparse');var Redis=require(_0xfb09('0xd'));var authService=require(_0xfb09('0xe'));var qs=require(_0xfb09('0xf'));var as=require(_0xfb09('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb09('0x11'))(_0xfb09('0x12'));var utils=require(_0xfb09('0x13'));var config=require(_0xfb09('0x14'));var db=require(_0xfb09('0x15'))['db'];function respondWithStatusCode(_0x59d496,_0x49febd){_0x49febd=_0x49febd||0xcc;return function(_0x246b90){if(_0x246b90){return _0x59d496['sendStatus'](_0x49febd);}return _0x59d496[_0xfb09('0x16')](_0x49febd)[_0xfb09('0x17')]();};}function respondWithResult(_0x17c665,_0xee7fb7){_0xee7fb7=_0xee7fb7||0xc8;return function(_0x20a679){if(_0x20a679){return _0x17c665[_0xfb09('0x16')](_0xee7fb7)[_0xfb09('0x18')](_0x20a679);}};}function respondWithFilteredResult(_0x333733,_0xad7936){return function(_0x103a03){if(_0x103a03){var _0x49da81=_0x103a03[_0xfb09('0x19')],_0x56c96a=_0xad7936[_0xfb09('0x1a')],_0x4f6f2b=_0xad7936[_0xfb09('0x1a')]+_0xad7936[_0xfb09('0x1b')],_0x5c155f;if(_0x4f6f2b>=_0x49da81){_0x4f6f2b=_0x49da81;_0x5c155f=0xc8;}else{_0x5c155f=0xce;}_0x333733['status'](_0x5c155f);return _0x333733['set'](_0xfb09('0x1c'),_0x56c96a+'-'+_0x4f6f2b+'/'+_0x49da81)['json'](_0x103a03);}return null;};}function patchUpdates(_0x394219){return function(_0x1bb3da){try{jsonpatch[_0xfb09('0x1d')](_0x1bb3da,_0x394219,!![]);}catch(_0x2274ed){return BPromise[_0xfb09('0x1e')](_0x2274ed);}return _0x1bb3da[_0xfb09('0x1f')]();};}function saveUpdates(_0x5cc0af,_0x52c079){return function(_0x5c173d){if(_0x5c173d){return _0x5c173d['update'](_0x5cc0af)[_0xfb09('0x20')](function(_0x3ec9f6){return _0x3ec9f6;});}return null;};}function removeEntity(_0x2eb9c9,_0x41a20d){return function(_0x37ee88){if(_0x37ee88){return _0x37ee88[_0xfb09('0x21')]()[_0xfb09('0x20')](function(){_0x2eb9c9[_0xfb09('0x16')](0xcc)[_0xfb09('0x17')]();});}};}function handleEntityNotFound(_0x534772,_0x45c1d9){return function(_0x2606bd){if(!_0x2606bd){_0x534772[_0xfb09('0x22')](0x194);}return _0x2606bd;};}function handleError(_0x18623b,_0x5ab9ae){_0x5ab9ae=_0x5ab9ae||0x1f4;return function(_0x2c3a8e){logger[_0xfb09('0x23')](_0x2c3a8e['stack']);if(_0x2c3a8e['name']){delete _0x2c3a8e[_0xfb09('0x24')];}_0x18623b['status'](_0x5ab9ae)[_0xfb09('0x25')](_0x2c3a8e);};}exports[_0xfb09('0x26')]=function(_0x12f6b8,_0x3dd9bf){var _0x19523c={},_0xee5d32={},_0x4996da={'count':0x0,'rows':[]};var _0x500fc4=_[_0xfb09('0x27')](db[_0xfb09('0x28')]['rawAttributes'],function(_0x17e032){return{'name':_0x17e032[_0xfb09('0x29')],'type':_0x17e032['type'][_0xfb09('0x2a')]};});_0xee5d32[_0xfb09('0x2b')]=_[_0xfb09('0x27')](_0x500fc4,_0xfb09('0x24'));_0xee5d32[_0xfb09('0x2c')]=_[_0xfb09('0x2d')](_0x12f6b8[_0xfb09('0x2c')]);_0xee5d32[_0xfb09('0x2e')]=_[_0xfb09('0x2f')](_0xee5d32[_0xfb09('0x2b')],_0xee5d32[_0xfb09('0x2c')]);_0x19523c[_0xfb09('0x30')]=_[_0xfb09('0x2f')](_0xee5d32[_0xfb09('0x2b')],qs[_0xfb09('0x31')](_0x12f6b8[_0xfb09('0x2c')][_0xfb09('0x31')]));_0x19523c[_0xfb09('0x30')]=_0x19523c['attributes'][_0xfb09('0x32')]?_0x19523c[_0xfb09('0x30')]:_0xee5d32[_0xfb09('0x2b')];if(!_0x12f6b8[_0xfb09('0x2c')][_0xfb09('0x33')](_0xfb09('0x34'))){_0x19523c['limit']=qs[_0xfb09('0x1b')](_0x12f6b8['query']['limit']);_0x19523c[_0xfb09('0x1a')]=qs['offset'](_0x12f6b8[_0xfb09('0x2c')][_0xfb09('0x1a')]);}_0x19523c[_0xfb09('0x35')]=qs[_0xfb09('0x36')](_0x12f6b8[_0xfb09('0x2c')][_0xfb09('0x36')]);_0x19523c['where']=qs['filters'](_[_0xfb09('0x37')](_0x12f6b8[_0xfb09('0x2c')],_0xee5d32['filters']),_0x500fc4);if(_0x12f6b8['query'][_0xfb09('0x38')]){_0x19523c['where']=_['merge'](_0x19523c[_0xfb09('0x39')],{'$or':_['map'](_0x500fc4,function(_0x4809da){if(_0x4809da['type']!==_0xfb09('0x3a')){var _0x5af2a5={};_0x5af2a5[_0x4809da[_0xfb09('0x24')]]={'$like':'%'+_0x12f6b8['query'][_0xfb09('0x38')]+'%'};return _0x5af2a5;}})});}_0x19523c=_[_0xfb09('0x3b')]({},_0x19523c,_0x12f6b8[_0xfb09('0x3c')]);var _0xcb7eb8={'where':_0x19523c[_0xfb09('0x39')]};return db[_0xfb09('0x28')][_0xfb09('0x19')](_0xcb7eb8)['then'](function(_0x96611a){_0x4996da[_0xfb09('0x19')]=_0x96611a;if(_0x12f6b8[_0xfb09('0x2c')][_0xfb09('0x3d')]){_0x19523c[_0xfb09('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0xfb09('0x3f')](_0x19523c);})[_0xfb09('0x20')](function(_0x42893d){_0x4996da[_0xfb09('0x40')]=_0x42893d;return _0x4996da;})[_0xfb09('0x20')](respondWithFilteredResult(_0x3dd9bf,_0x19523c))['catch'](handleError(_0x3dd9bf,null));};exports[_0xfb09('0x41')]=function(_0x582ebd,_0x1d1683){var _0x642cc={'raw':!![],'where':{'id':_0x582ebd['params']['id']}},_0x4f3316={};_0x4f3316['model']=_[_0xfb09('0x2d')](db['MailSubstatus'][_0xfb09('0x42')]);_0x4f3316[_0xfb09('0x2c')]=_['keys'](_0x582ebd[_0xfb09('0x2c')]);_0x4f3316['filters']=_[_0xfb09('0x2f')](_0x4f3316[_0xfb09('0x2b')],_0x4f3316[_0xfb09('0x2c')]);_0x642cc[_0xfb09('0x30')]=_[_0xfb09('0x2f')](_0x4f3316[_0xfb09('0x2b')],qs[_0xfb09('0x31')](_0x582ebd[_0xfb09('0x2c')][_0xfb09('0x31')]));_0x642cc[_0xfb09('0x30')]=_0x642cc['attributes']['length']?_0x642cc[_0xfb09('0x30')]:_0x4f3316[_0xfb09('0x2b')];if(_0x582ebd[_0xfb09('0x2c')]['includeAll']){_0x642cc['include']=[{'all':!![]}];}_0x642cc=_['merge']({},_0x642cc,_0x582ebd[_0xfb09('0x3c')]);return db['MailSubstatus'][_0xfb09('0x43')](_0x642cc)[_0xfb09('0x20')](handleEntityNotFound(_0x1d1683,null))[_0xfb09('0x20')](respondWithResult(_0x1d1683,null))[_0xfb09('0x44')](handleError(_0x1d1683,null));};exports[_0xfb09('0x45')]=function(_0x2f6749,_0x4974ed){return db[_0xfb09('0x28')]['create'](_0x2f6749['body'],{})[_0xfb09('0x20')](respondWithResult(_0x4974ed,0xc9))[_0xfb09('0x44')](handleError(_0x4974ed,null));};exports[_0xfb09('0x46')]=function(_0x172952,_0xaa18bb){if(_0x172952[_0xfb09('0x47')]['id']){delete _0x172952['body']['id'];}return db['MailSubstatus'][_0xfb09('0x43')]({'where':{'id':_0x172952[_0xfb09('0x48')]['id']}})[_0xfb09('0x20')](handleEntityNotFound(_0xaa18bb,null))[_0xfb09('0x20')](saveUpdates(_0x172952['body'],null))[_0xfb09('0x20')](respondWithResult(_0xaa18bb,null))['catch'](handleError(_0xaa18bb,null));};exports[_0xfb09('0x21')]=function(_0x39cc00,_0x171b19){return db[_0xfb09('0x28')][_0xfb09('0x43')]({'where':{'id':_0x39cc00[_0xfb09('0x48')]['id']}})[_0xfb09('0x20')](handleEntityNotFound(_0x171b19,null))[_0xfb09('0x20')](removeEntity(_0x171b19,null))[_0xfb09('0x44')](handleError(_0x171b19,null));};exports[_0xfb09('0x49')]=function(_0x4ce83e,_0x2a1e9a){return db[_0xfb09('0x28')][_0xfb09('0x49')]()['then'](respondWithResult(_0x2a1e9a,null))[_0xfb09('0x44')](handleError(_0x2a1e9a,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index c8d54d5..3aadb42 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 _0x9787=['./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x35858d,_0x1acd8d){var _0x1f6865=function(_0x6e9fc9){while(--_0x6e9fc9){_0x35858d['push'](_0x35858d['shift']());}};_0x1f6865(++_0x1acd8d);}(_0x9787,0xd4));var _0x7978=function(_0x372047,_0x7f5c2b){_0x372047=_0x372047-0x0;var _0x44f282=_0x9787[_0x372047];return _0x44f282;};'use strict';var _=require(_0x7978('0x0'));var util=require(_0x7978('0x1'));var logger=require('../../config/logger')(_0x7978('0x2'));var moment=require(_0x7978('0x3'));var BPromise=require(_0x7978('0x4'));var rp=require(_0x7978('0x5'));var fs=require('fs');var path=require(_0x7978('0x6'));var rimraf=require(_0x7978('0x7'));var config=require(_0x7978('0x8'));var attributes=require(_0x7978('0x9'));module[_0x7978('0xa')]=function(_0x11a076,_0x1847fb){return _0x11a076[_0x7978('0xb')](_0x7978('0xc'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ff9=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailSubstatus','mail_substatuses'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x7ff9,0xc6));var _0x97ff=function(_0x249a07,_0x4787c7){_0x249a07=_0x249a07-0x0;var _0xc75928=_0x7ff9[_0x249a07];return _0xc75928;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x97ff('0x0'))('api');var moment=require('moment');var BPromise=require(_0x97ff('0x1'));var rp=require(_0x97ff('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97ff('0x3'));var config=require(_0x97ff('0x4'));var attributes=require('./mailSubstatus.attributes');module[_0x97ff('0x5')]=function(_0x1333e0,_0x27e088){return _0x1333e0[_0x97ff('0x6')](_0x97ff('0x7'),attributes,{'tableName':_0x97ff('0x8'),'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 284c4f6..8647fec 100644 --- a/server/api/mailSubstatus/mailSubstatus.rpc.js +++ b/server/api/mailSubstatus/mailSubstatus.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a7c31,_0x30fc89){var _0x3ee630=function(_0xb873be){while(--_0xb873be){_0x4a7c31['push'](_0x4a7c31['shift']());}};_0x3ee630(++_0x30fc89);}(_0xe706,0xa3));var _0x6e70=function(_0x4c0998,_0x165050){_0x4c0998=_0x4c0998-0x0;var _0x1110e2=_0xe706[_0x4c0998];return _0x1110e2;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x6324=['client','http','then','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x23545c,_0x5991f5){var _0x1db75c=function(_0x110b0a){while(--_0x110b0a){_0x23545c['push'](_0x23545c['shift']());}};_0x1db75c(++_0x5991f5);}(_0x6324,0x142));var _0x4632=function(_0x174a7c,_0x163b97){_0x174a7c=_0x174a7c-0x0;var _0x2e35d6=_0x6324[_0x174a7c];return _0x2e35d6;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var BPromise=require(_0x4632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4632('0x5'));var logger=require('../../config/logger')(_0x4632('0x6'));var config=require('../../config/environment');var jayson=require(_0x4632('0x7'));var client=jayson[_0x4632('0x8')][_0x4632('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x126e9a,_0x4a15b2,_0x17e860){return new BPromise(function(_0x44dd6d,_0x390a46){return client['request'](_0x126e9a,_0x17e860)[_0x4632('0xa')](function(_0x47824c){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x4a15b2,_0x4632('0xb'));logger[_0x4632('0xc')](_0x4632('0xd'),_0x4a15b2,_0x4632('0xb'),JSON[_0x4632('0xe')](_0x47824c));if(_0x47824c[_0x4632('0xf')]){if(_0x47824c[_0x4632('0xf')][_0x4632('0x10')]===0x1f4){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x47824c['error'][_0x4632('0x12')]);return _0x390a46(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}logger[_0x4632('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x4a15b2,_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);return _0x44dd6d(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}else{logger[_0x4632('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x4a15b2,'request\x20sent');_0x44dd6d(_0x47824c[_0x4632('0x14')][_0x4632('0x12')]);}})[_0x4632('0x15')](function(_0x125eb9){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x125eb9);_0x390a46(_0x125eb9);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 3672389..b27d05c 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 _0xd370=['delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update'];(function(_0x8a304a,_0x2dd6fd){var _0x19292a=function(_0x3185b7){while(--_0x3185b7){_0x8a304a['push'](_0x8a304a['shift']());}};_0x19292a(++_0x2dd6fd);}(_0xd370,0xde));var _0x0d37=function(_0x15821d,_0x3d3029){_0x15821d=_0x15821d-0x0;var _0x5e443c=_0xd370[_0x15821d];return _0x5e443c;};'use strict';var multer=require('multer');var util=require(_0x0d37('0x0'));var path=require(_0x0d37('0x1'));var timeout=require(_0x0d37('0x2'));var express=require(_0x0d37('0x3'));var router=express[_0x0d37('0x4')]();var auth=require(_0x0d37('0x5'));var interaction=require(_0x0d37('0x6'));var config=require(_0x0d37('0x7'));var controller=require(_0x0d37('0x8'));router['get']('/',auth[_0x0d37('0x9')](),controller[_0x0d37('0xa')]);router[_0x0d37('0xb')](_0x0d37('0xc'),auth['isAuthenticated'](),controller[_0x0d37('0xd')]);router[_0x0d37('0xb')]('/:id',auth[_0x0d37('0x9')](),controller[_0x0d37('0xe')]);router[_0x0d37('0xf')]('/',auth[_0x0d37('0x9')](),controller[_0x0d37('0x10')]);router[_0x0d37('0x11')](_0x0d37('0x12'),auth[_0x0d37('0x9')](),controller[_0x0d37('0x13')]);router[_0x0d37('0x14')](_0x0d37('0x12'),auth['isAuthenticated'](),controller[_0x0d37('0x15')]);module['exports']=router; \ No newline at end of file +var _0xaf7b=['get','index','describe','/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaf7b,0x1c4));var _0xbaf7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaf7b[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xbaf7('0x0'));var util=require(_0xbaf7('0x1'));var path=require(_0xbaf7('0x2'));var timeout=require(_0xbaf7('0x3'));var express=require(_0xbaf7('0x4'));var router=express[_0xbaf7('0x5')]();var auth=require(_0xbaf7('0x6'));var interaction=require(_0xbaf7('0x7'));var config=require(_0xbaf7('0x8'));var controller=require(_0xbaf7('0x9'));router[_0xbaf7('0xa')]('/',auth['isAuthenticated'](),controller[_0xbaf7('0xb')]);router[_0xbaf7('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xbaf7('0xc')]);router[_0xbaf7('0xa')](_0xbaf7('0xd'),auth[_0xbaf7('0xe')](),controller[_0xbaf7('0xf')]);router[_0xbaf7('0x10')]('/',auth[_0xbaf7('0xe')](),controller[_0xbaf7('0x11')]);router['put'](_0xbaf7('0xd'),auth[_0xbaf7('0xe')](),controller['update']);router[_0xbaf7('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbaf7('0x13')]);module[_0xbaf7('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index a76fb58..f108d82 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 _0x6220=['ENUM','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x208af5,_0x16c9dd){var _0x134933=function(_0x16916f){while(--_0x16916f){_0x208af5['push'](_0x208af5['shift']());}};_0x134933(++_0x16c9dd);}(_0x6220,0x67));var _0x0622=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6220[_0x4b369d];return _0x571a98;};'use strict';var moment=require(_0x0622('0x0'));var Sequelize=require(_0x0622('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0622('0x2')]('account',_0x0622('0x3'),_0x0622('0x4')),'allowNull':![],'defaultValue':_0x0622('0x4')},'transferredAt':{'type':Sequelize[_0x0622('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0622('0x6')]}}; \ No newline at end of file +var _0x57e9=['NOW','sequelize','exports','STRING','ENUM','account','queue','DATE'];(function(_0x217110,_0x53e425){var _0x49d701=function(_0x3da120){while(--_0x3da120){_0x217110['push'](_0x217110['shift']());}};_0x49d701(++_0x53e425);}(_0x57e9,0xe1));var _0x957e=function(_0x52c5ea,_0x54f60e){_0x52c5ea=_0x52c5ea-0x0;var _0x1769e2=_0x57e9[_0x52c5ea];return _0x1769e2;};'use strict';var moment=require('moment');var Sequelize=require(_0x957e('0x0'));module[_0x957e('0x1')]={'uniqueid':{'type':Sequelize[_0x957e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x957e('0x3')](_0x957e('0x4'),'agent',_0x957e('0x5')),'allowNull':![],'defaultValue':_0x957e('0x5')},'transferredAt':{'type':Sequelize[_0x957e('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x957e('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index ba212a5..a1f068b 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 _0x0e37=['rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','keys','options','find','body','params','describe','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0e37,0xf4));var _0x70e3=function(_0x4896ac,_0x2c6df5){_0x4896ac=_0x4896ac-0x0;var _0x58fffc=_0x0e37[_0x4896ac];return _0x58fffc;};'use strict';var pdf=require(_0x70e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x70e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70e3('0x2'));var rp=require('request-promise');var moment=require(_0x70e3('0x3'));var BPromise=require(_0x70e3('0x4'));var Mustache=require(_0x70e3('0x5'));var util=require(_0x70e3('0x6'));var path=require('path');var sox=require(_0x70e3('0x7'));var csv=require(_0x70e3('0x8'));var ejs=require(_0x70e3('0x9'));var fs=require('fs');var _=require(_0x70e3('0xa'));var squel=require(_0x70e3('0xb'));var crypto=require(_0x70e3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x70e3('0xd'));var toCsv=require(_0x70e3('0x8'));var querystring=require(_0x70e3('0xe'));var Papa=require(_0x70e3('0xf'));var Redis=require(_0x70e3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x70e3('0x11'));var as=require(_0x70e3('0x12'));var hardwareService=require(_0x70e3('0x13'));var logger=require(_0x70e3('0x14'))(_0x70e3('0x15'));var utils=require(_0x70e3('0x16'));var config=require('../../config/environment');var db=require(_0x70e3('0x17'))['db'];function respondWithStatusCode(_0x2d9deb,_0x13bc77){_0x13bc77=_0x13bc77||0xcc;return function(_0x25172f){if(_0x25172f){return _0x2d9deb[_0x70e3('0x18')](_0x13bc77);}return _0x2d9deb[_0x70e3('0x19')](_0x13bc77)[_0x70e3('0x1a')]();};}function respondWithResult(_0x2b58b9,_0x331cf8){_0x331cf8=_0x331cf8||0xc8;return function(_0x169d81){if(_0x169d81){return _0x2b58b9[_0x70e3('0x19')](_0x331cf8)[_0x70e3('0x1b')](_0x169d81);}};}function respondWithFilteredResult(_0x3dd17c,_0x425adb){return function(_0x595b79){if(_0x595b79){var _0x22bca9=_0x595b79['count'],_0x2053e9=_0x425adb['offset'],_0x504b2e=_0x425adb[_0x70e3('0x1c')]+_0x425adb[_0x70e3('0x1d')],_0x4d0043;if(_0x504b2e>=_0x22bca9){_0x504b2e=_0x22bca9;_0x4d0043=0xc8;}else{_0x4d0043=0xce;}_0x3dd17c[_0x70e3('0x19')](_0x4d0043);return _0x3dd17c[_0x70e3('0x1e')]('Content-Range',_0x2053e9+'-'+_0x504b2e+'/'+_0x22bca9)['json'](_0x595b79);}return null;};}function patchUpdates(_0x1e74f7){return function(_0x1fa3df){try{jsonpatch[_0x70e3('0x1f')](_0x1fa3df,_0x1e74f7,!![]);}catch(_0x487320){return BPromise[_0x70e3('0x20')](_0x487320);}return _0x1fa3df[_0x70e3('0x21')]();};}function saveUpdates(_0x3109ca,_0x2f59fe){return function(_0x45a6f7){if(_0x45a6f7){return _0x45a6f7[_0x70e3('0x22')](_0x3109ca)[_0x70e3('0x23')](function(_0x39d664){return _0x39d664;});}return null;};}function removeEntity(_0x148ed7,_0x9f7744){return function(_0x36571e){if(_0x36571e){return _0x36571e[_0x70e3('0x24')]()[_0x70e3('0x23')](function(){_0x148ed7[_0x70e3('0x19')](0xcc)[_0x70e3('0x1a')]();});}};}function handleEntityNotFound(_0x5b771b,_0x1f18bc){return function(_0x382044){if(!_0x382044){_0x5b771b[_0x70e3('0x18')](0x194);}return _0x382044;};}function handleError(_0x5a7583,_0x17a879){_0x17a879=_0x17a879||0x1f4;return function(_0x3f1713){logger[_0x70e3('0x25')](_0x3f1713[_0x70e3('0x26')]);if(_0x3f1713['name']){delete _0x3f1713[_0x70e3('0x27')];}_0x5a7583['status'](_0x17a879)[_0x70e3('0x28')](_0x3f1713);};}exports[_0x70e3('0x29')]=function(_0x2dcb7e,_0x1483b2){var _0x3072e8={},_0x176951={},_0x54a961={'count':0x0,'rows':[]};var _0x35af92=_[_0x70e3('0x2a')](db[_0x70e3('0x2b')][_0x70e3('0x2c')],function(_0x2de260){return{'name':_0x2de260[_0x70e3('0x2d')],'type':_0x2de260[_0x70e3('0x2e')][_0x70e3('0x2f')]};});_0x176951[_0x70e3('0x30')]=_[_0x70e3('0x2a')](_0x35af92,_0x70e3('0x27'));_0x176951[_0x70e3('0x31')]=_['keys'](_0x2dcb7e['query']);_0x176951[_0x70e3('0x32')]=_[_0x70e3('0x33')](_0x176951[_0x70e3('0x30')],_0x176951[_0x70e3('0x31')]);_0x3072e8['attributes']=_[_0x70e3('0x33')](_0x176951['model'],qs['fields'](_0x2dcb7e[_0x70e3('0x31')][_0x70e3('0x34')]));_0x3072e8[_0x70e3('0x35')]=_0x3072e8['attributes'][_0x70e3('0x36')]?_0x3072e8[_0x70e3('0x35')]:_0x176951[_0x70e3('0x30')];if(!_0x2dcb7e[_0x70e3('0x31')]['hasOwnProperty'](_0x70e3('0x37'))){_0x3072e8['limit']=qs['limit'](_0x2dcb7e[_0x70e3('0x31')][_0x70e3('0x1d')]);_0x3072e8[_0x70e3('0x1c')]=qs[_0x70e3('0x1c')](_0x2dcb7e[_0x70e3('0x31')][_0x70e3('0x1c')]);}_0x3072e8['order']=qs[_0x70e3('0x38')](_0x2dcb7e['query']['sort']);_0x3072e8[_0x70e3('0x39')]=qs[_0x70e3('0x32')](_[_0x70e3('0x3a')](_0x2dcb7e['query'],_0x176951[_0x70e3('0x32')]),_0x35af92);if(_0x2dcb7e[_0x70e3('0x31')][_0x70e3('0x3b')]){_0x3072e8[_0x70e3('0x39')]=_[_0x70e3('0x3c')](_0x3072e8['where'],{'$or':_[_0x70e3('0x2a')](_0x35af92,function(_0x4a62bc){if(_0x4a62bc[_0x70e3('0x2e')]!=='VIRTUAL'){var _0x411979={};_0x411979[_0x4a62bc[_0x70e3('0x27')]]={'$like':'%'+_0x2dcb7e['query'][_0x70e3('0x3b')]+'%'};return _0x411979;}})});}_0x3072e8=_['merge']({},_0x3072e8,_0x2dcb7e['options']);var _0x5b472d={'where':_0x3072e8[_0x70e3('0x39')]};return db[_0x70e3('0x2b')]['count'](_0x5b472d)[_0x70e3('0x23')](function(_0x24e88c){_0x54a961['count']=_0x24e88c;if(_0x2dcb7e['query'][_0x70e3('0x3d')]){_0x3072e8[_0x70e3('0x3e')]=[{'all':!![]}];}return db[_0x70e3('0x2b')]['findAll'](_0x3072e8);})[_0x70e3('0x23')](function(_0x4359d9){_0x54a961[_0x70e3('0x3f')]=_0x4359d9;return _0x54a961;})[_0x70e3('0x23')](respondWithFilteredResult(_0x1483b2,_0x3072e8))[_0x70e3('0x40')](handleError(_0x1483b2,null));};exports[_0x70e3('0x41')]=function(_0x51acb9,_0x36da2d){var _0x448aee={'raw':!![],'where':{'id':_0x51acb9['params']['id']}},_0x377fea={};_0x377fea['model']=_['keys'](db[_0x70e3('0x2b')][_0x70e3('0x2c')]);_0x377fea[_0x70e3('0x31')]=_[_0x70e3('0x42')](_0x51acb9['query']);_0x377fea[_0x70e3('0x32')]=_[_0x70e3('0x33')](_0x377fea[_0x70e3('0x30')],_0x377fea[_0x70e3('0x31')]);_0x448aee[_0x70e3('0x35')]=_[_0x70e3('0x33')](_0x377fea[_0x70e3('0x30')],qs[_0x70e3('0x34')](_0x51acb9['query'][_0x70e3('0x34')]));_0x448aee['attributes']=_0x448aee[_0x70e3('0x35')][_0x70e3('0x36')]?_0x448aee[_0x70e3('0x35')]:_0x377fea['model'];if(_0x51acb9[_0x70e3('0x31')][_0x70e3('0x3d')]){_0x448aee[_0x70e3('0x3e')]=[{'all':!![]}];}_0x448aee=_[_0x70e3('0x3c')]({},_0x448aee,_0x51acb9[_0x70e3('0x43')]);return db[_0x70e3('0x2b')][_0x70e3('0x44')](_0x448aee)['then'](handleEntityNotFound(_0x36da2d,null))[_0x70e3('0x23')](respondWithResult(_0x36da2d,null))['catch'](handleError(_0x36da2d,null));};exports['create']=function(_0x251c0d,_0x3440bf){return db[_0x70e3('0x2b')]['create'](_0x251c0d[_0x70e3('0x45')],{})['then'](respondWithResult(_0x3440bf,0xc9))[_0x70e3('0x40')](handleError(_0x3440bf,null));};exports['update']=function(_0x3b7617,_0x1c3547){if(_0x3b7617[_0x70e3('0x45')]['id']){delete _0x3b7617[_0x70e3('0x45')]['id'];}return db[_0x70e3('0x2b')]['find']({'where':{'id':_0x3b7617[_0x70e3('0x46')]['id']}})[_0x70e3('0x23')](handleEntityNotFound(_0x1c3547,null))[_0x70e3('0x23')](saveUpdates(_0x3b7617['body'],null))[_0x70e3('0x23')](respondWithResult(_0x1c3547,null))['catch'](handleError(_0x1c3547,null));};exports[_0x70e3('0x24')]=function(_0x255bff,_0x2bcac7){return db[_0x70e3('0x2b')]['find']({'where':{'id':_0x255bff[_0x70e3('0x46')]['id']}})[_0x70e3('0x23')](handleEntityNotFound(_0x2bcac7,null))[_0x70e3('0x23')](removeEntity(_0x2bcac7,null))['catch'](handleError(_0x2bcac7,null));};exports[_0x70e3('0x47')]=function(_0x117e70,_0x5106df){return db[_0x70e3('0x2b')]['describe']()[_0x70e3('0x23')](respondWithResult(_0x5106df,null))[_0x70e3('0x40')](handleError(_0x5106df,null));}; \ No newline at end of file +var _0x7daf=['send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name'];(function(_0x303ab3,_0x25c2f4){var _0xd5171e=function(_0x3fe32b){while(--_0x3fe32b){_0x303ab3['push'](_0x303ab3['shift']());}};_0xd5171e(++_0x25c2f4);}(_0x7daf,0x19a));var _0xf7da=function(_0x3ef2d8,_0x4fdf2e){_0x3ef2d8=_0x3ef2d8-0x0;var _0x5c86a5=_0x7daf[_0x3ef2d8];return _0x5c86a5;};'use strict';var pdf=require(_0xf7da('0x0'));var emlformat=require(_0xf7da('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf7da('0x2'));var jsonpatch=require(_0xf7da('0x3'));var rp=require(_0xf7da('0x4'));var moment=require(_0xf7da('0x5'));var BPromise=require(_0xf7da('0x6'));var Mustache=require(_0xf7da('0x7'));var util=require(_0xf7da('0x8'));var path=require('path');var sox=require(_0xf7da('0x9'));var csv=require(_0xf7da('0xa'));var ejs=require(_0xf7da('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf7da('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf7da('0xd'));var toCsv=require(_0xf7da('0xa'));var querystring=require(_0xf7da('0xe'));var Papa=require(_0xf7da('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf7da('0x10'));var as=require(_0xf7da('0x11'));var hardwareService=require(_0xf7da('0x12'));var logger=require(_0xf7da('0x13'))('api');var utils=require(_0xf7da('0x14'));var config=require(_0xf7da('0x15'));var db=require(_0xf7da('0x16'))['db'];function respondWithStatusCode(_0x1791cd,_0x4009ef){_0x4009ef=_0x4009ef||0xcc;return function(_0x1aa6cd){if(_0x1aa6cd){return _0x1791cd[_0xf7da('0x17')](_0x4009ef);}return _0x1791cd[_0xf7da('0x18')](_0x4009ef)[_0xf7da('0x19')]();};}function respondWithResult(_0x30e0f0,_0x331712){_0x331712=_0x331712||0xc8;return function(_0x4e4d3c){if(_0x4e4d3c){return _0x30e0f0[_0xf7da('0x18')](_0x331712)[_0xf7da('0x1a')](_0x4e4d3c);}};}function respondWithFilteredResult(_0x2aab47,_0x59d0d2){return function(_0x5d30aa){if(_0x5d30aa){var _0x503d3b=_0x5d30aa[_0xf7da('0x1b')],_0x1732d8=_0x59d0d2['offset'],_0x560102=_0x59d0d2['offset']+_0x59d0d2[_0xf7da('0x1c')],_0x2a5fcf;if(_0x560102>=_0x503d3b){_0x560102=_0x503d3b;_0x2a5fcf=0xc8;}else{_0x2a5fcf=0xce;}_0x2aab47[_0xf7da('0x18')](_0x2a5fcf);return _0x2aab47[_0xf7da('0x1d')](_0xf7da('0x1e'),_0x1732d8+'-'+_0x560102+'/'+_0x503d3b)[_0xf7da('0x1a')](_0x5d30aa);}return null;};}function patchUpdates(_0x1a1d19){return function(_0xfdc6ba){try{jsonpatch[_0xf7da('0x1f')](_0xfdc6ba,_0x1a1d19,!![]);}catch(_0x48f8d8){return BPromise[_0xf7da('0x20')](_0x48f8d8);}return _0xfdc6ba[_0xf7da('0x21')]();};}function saveUpdates(_0x5139aa,_0x5f3c92){return function(_0xd08b4b){if(_0xd08b4b){return _0xd08b4b[_0xf7da('0x22')](_0x5139aa)['then'](function(_0x12d07e){return _0x12d07e;});}return null;};}function removeEntity(_0x11e9d7,_0x27a65c){return function(_0x149a5b){if(_0x149a5b){return _0x149a5b[_0xf7da('0x23')]()[_0xf7da('0x24')](function(){_0x11e9d7[_0xf7da('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2c03,_0x1de135){return function(_0x3b6851){if(!_0x3b6851){_0x4c2c03[_0xf7da('0x17')](0x194);}return _0x3b6851;};}function handleError(_0x408acd,_0x39154e){_0x39154e=_0x39154e||0x1f4;return function(_0x8563a9){logger[_0xf7da('0x25')](_0x8563a9[_0xf7da('0x26')]);if(_0x8563a9[_0xf7da('0x27')]){delete _0x8563a9['name'];}_0x408acd[_0xf7da('0x18')](_0x39154e)[_0xf7da('0x28')](_0x8563a9);};}exports[_0xf7da('0x29')]=function(_0xd26618,_0x2e610d){var _0x229792={},_0xc1591d={},_0x10001a={'count':0x0,'rows':[]};var _0x5006c8=_[_0xf7da('0x2a')](db[_0xf7da('0x2b')][_0xf7da('0x2c')],function(_0x58d026){return{'name':_0x58d026[_0xf7da('0x2d')],'type':_0x58d026[_0xf7da('0x2e')][_0xf7da('0x2f')]};});_0xc1591d[_0xf7da('0x30')]=_[_0xf7da('0x2a')](_0x5006c8,'name');_0xc1591d[_0xf7da('0x31')]=_['keys'](_0xd26618['query']);_0xc1591d[_0xf7da('0x32')]=_[_0xf7da('0x33')](_0xc1591d['model'],_0xc1591d['query']);_0x229792[_0xf7da('0x34')]=_['intersection'](_0xc1591d[_0xf7da('0x30')],qs[_0xf7da('0x35')](_0xd26618['query'][_0xf7da('0x35')]));_0x229792[_0xf7da('0x34')]=_0x229792['attributes'][_0xf7da('0x36')]?_0x229792[_0xf7da('0x34')]:_0xc1591d[_0xf7da('0x30')];if(!_0xd26618['query'][_0xf7da('0x37')]('nolimit')){_0x229792[_0xf7da('0x1c')]=qs[_0xf7da('0x1c')](_0xd26618['query'][_0xf7da('0x1c')]);_0x229792[_0xf7da('0x38')]=qs[_0xf7da('0x38')](_0xd26618['query'][_0xf7da('0x38')]);}_0x229792[_0xf7da('0x39')]=qs[_0xf7da('0x3a')](_0xd26618[_0xf7da('0x31')][_0xf7da('0x3a')]);_0x229792[_0xf7da('0x3b')]=qs['filters'](_[_0xf7da('0x3c')](_0xd26618['query'],_0xc1591d[_0xf7da('0x32')]),_0x5006c8);if(_0xd26618['query']['filter']){_0x229792[_0xf7da('0x3b')]=_['merge'](_0x229792[_0xf7da('0x3b')],{'$or':_[_0xf7da('0x2a')](_0x5006c8,function(_0x2518eb){if(_0x2518eb[_0xf7da('0x2e')]!=='VIRTUAL'){var _0x21760c={};_0x21760c[_0x2518eb['name']]={'$like':'%'+_0xd26618[_0xf7da('0x31')][_0xf7da('0x3d')]+'%'};return _0x21760c;}})});}_0x229792=_[_0xf7da('0x3e')]({},_0x229792,_0xd26618[_0xf7da('0x3f')]);var _0x4a411f={'where':_0x229792[_0xf7da('0x3b')]};return db[_0xf7da('0x2b')][_0xf7da('0x1b')](_0x4a411f)[_0xf7da('0x24')](function(_0x362dce){_0x10001a[_0xf7da('0x1b')]=_0x362dce;if(_0xd26618[_0xf7da('0x31')][_0xf7da('0x40')]){_0x229792[_0xf7da('0x41')]=[{'all':!![]}];}return db['MailTransferReport'][_0xf7da('0x42')](_0x229792);})[_0xf7da('0x24')](function(_0x1b4fde){_0x10001a['rows']=_0x1b4fde;return _0x10001a;})['then'](respondWithFilteredResult(_0x2e610d,_0x229792))[_0xf7da('0x43')](handleError(_0x2e610d,null));};exports[_0xf7da('0x44')]=function(_0x58124d,_0x2cdadf){var _0x58f3be={'raw':!![],'where':{'id':_0x58124d[_0xf7da('0x45')]['id']}},_0x5d5e17={};_0x5d5e17[_0xf7da('0x30')]=_[_0xf7da('0x46')](db[_0xf7da('0x2b')][_0xf7da('0x2c')]);_0x5d5e17[_0xf7da('0x31')]=_[_0xf7da('0x46')](_0x58124d['query']);_0x5d5e17[_0xf7da('0x32')]=_[_0xf7da('0x33')](_0x5d5e17[_0xf7da('0x30')],_0x5d5e17['query']);_0x58f3be[_0xf7da('0x34')]=_[_0xf7da('0x33')](_0x5d5e17[_0xf7da('0x30')],qs[_0xf7da('0x35')](_0x58124d[_0xf7da('0x31')]['fields']));_0x58f3be[_0xf7da('0x34')]=_0x58f3be[_0xf7da('0x34')]['length']?_0x58f3be[_0xf7da('0x34')]:_0x5d5e17['model'];if(_0x58124d[_0xf7da('0x31')][_0xf7da('0x40')]){_0x58f3be[_0xf7da('0x41')]=[{'all':!![]}];}_0x58f3be=_[_0xf7da('0x3e')]({},_0x58f3be,_0x58124d[_0xf7da('0x3f')]);return db['MailTransferReport']['find'](_0x58f3be)[_0xf7da('0x24')](handleEntityNotFound(_0x2cdadf,null))[_0xf7da('0x24')](respondWithResult(_0x2cdadf,null))[_0xf7da('0x43')](handleError(_0x2cdadf,null));};exports[_0xf7da('0x47')]=function(_0x52244c,_0x182f28){return db[_0xf7da('0x2b')][_0xf7da('0x47')](_0x52244c[_0xf7da('0x48')],{})[_0xf7da('0x24')](respondWithResult(_0x182f28,0xc9))[_0xf7da('0x43')](handleError(_0x182f28,null));};exports['update']=function(_0x4ca5cf,_0x3c434e){if(_0x4ca5cf[_0xf7da('0x48')]['id']){delete _0x4ca5cf[_0xf7da('0x48')]['id'];}return db[_0xf7da('0x2b')][_0xf7da('0x49')]({'where':{'id':_0x4ca5cf[_0xf7da('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c434e,null))[_0xf7da('0x24')](saveUpdates(_0x4ca5cf['body'],null))['then'](respondWithResult(_0x3c434e,null))[_0xf7da('0x43')](handleError(_0x3c434e,null));};exports['destroy']=function(_0x12689c,_0xe3d039){return db[_0xf7da('0x2b')][_0xf7da('0x49')]({'where':{'id':_0x12689c[_0xf7da('0x45')]['id']}})['then'](handleEntityNotFound(_0xe3d039,null))[_0xf7da('0x24')](removeEntity(_0xe3d039,null))[_0xf7da('0x43')](handleError(_0xe3d039,null));};exports[_0xf7da('0x4a')]=function(_0x233ffd,_0x1690e0){return db[_0xf7da('0x2b')][_0xf7da('0x4a')]()['then'](respondWithResult(_0x1690e0,null))[_0xf7da('0x43')](handleError(_0x1690e0,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index afe6574..6130093 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 _0x1ea4=['../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x407cf7,_0x2c36e1){var _0x177160=function(_0x1c131f){while(--_0x1c131f){_0x407cf7['push'](_0x407cf7['shift']());}};_0x177160(++_0x2c36e1);}(_0x1ea4,0x14b));var _0x41ea=function(_0x35228f,_0x44e0d8){_0x35228f=_0x35228f-0x0;var _0x8f0971=_0x1ea4[_0x35228f];return _0x8f0971;};'use strict';var _=require(_0x41ea('0x0'));var util=require('util');var logger=require(_0x41ea('0x1'))(_0x41ea('0x2'));var moment=require(_0x41ea('0x3'));var BPromise=require('bluebird');var rp=require(_0x41ea('0x4'));var fs=require('fs');var path=require(_0x41ea('0x5'));var rimraf=require(_0x41ea('0x6'));var config=require(_0x41ea('0x7'));var attributes=require(_0x41ea('0x8'));module['exports']=function(_0x62e4d9,_0x353445){return _0x62e4d9[_0x41ea('0x9')](_0x41ea('0xa'),attributes,{'tableName':_0x41ea('0xb'),'paranoid':![],'indexes':[{'name':_0x41ea('0xc'),'fields':[_0x41ea('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67c6=['../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment','request-promise','path'];(function(_0x2dbd8a,_0x14e373){var _0x53d100=function(_0x5b084b){while(--_0x5b084b){_0x2dbd8a['push'](_0x2dbd8a['shift']());}};_0x53d100(++_0x14e373);}(_0x67c6,0x1bd));var _0x667c=function(_0x38c7fb,_0x52c5d9){_0x38c7fb=_0x38c7fb-0x0;var _0x5b7f16=_0x67c6[_0x38c7fb];return _0x5b7f16;};'use strict';var _=require(_0x667c('0x0'));var util=require(_0x667c('0x1'));var logger=require('../../config/logger')(_0x667c('0x2'));var moment=require(_0x667c('0x3'));var BPromise=require('bluebird');var rp=require(_0x667c('0x4'));var fs=require('fs');var path=require(_0x667c('0x5'));var rimraf=require('rimraf');var config=require(_0x667c('0x6'));var attributes=require(_0x667c('0x7'));module['exports']=function(_0x5598e8,_0xaaef81){return _0x5598e8['define'](_0x667c('0x8'),attributes,{'tableName':_0x667c('0x9'),'paranoid':![],'indexes':[{'name':_0x667c('0xa'),'fields':[_0x667c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 3cacf34..18371bd 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 _0xbe91=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird'];(function(_0xb9470e,_0x1185b2){var _0x3db2d1=function(_0x572cdb){while(--_0x572cdb){_0xb9470e['push'](_0xb9470e['shift']());}};_0x3db2d1(++_0x1185b2);}(_0xbe91,0x1e0));var _0x1be9=function(_0x4982f6,_0x45ba31){_0x4982f6=_0x4982f6-0x0;var _0x3d8a48=_0xbe91[_0x4982f6];return _0x3d8a48;};'use strict';var _=require('lodash');var util=require(_0x1be9('0x0'));var moment=require(_0x1be9('0x1'));var BPromise=require(_0x1be9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1be9('0x3'));var db=require(_0x1be9('0x4'))['db'];var utils=require(_0x1be9('0x5'));var logger=require(_0x1be9('0x6'))(_0x1be9('0x7'));var config=require(_0x1be9('0x8'));var jayson=require(_0x1be9('0x9'));var client=jayson[_0x1be9('0xa')][_0x1be9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17d141,_0x28cf04,_0x237666){return new BPromise(function(_0x2a389e,_0x19d8a4){return client[_0x1be9('0xc')](_0x17d141,_0x237666)[_0x1be9('0xd')](function(_0x22cc5b){logger[_0x1be9('0xe')](_0x1be9('0xf'),_0x28cf04,_0x1be9('0x10'));logger[_0x1be9('0x11')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x28cf04,'request\x20sent',JSON['stringify'](_0x22cc5b));if(_0x22cc5b[_0x1be9('0x12')]){if(_0x22cc5b[_0x1be9('0x12')][_0x1be9('0x13')]===0x1f4){logger[_0x1be9('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x28cf04,_0x22cc5b[_0x1be9('0x12')][_0x1be9('0x14')]);return _0x19d8a4(_0x22cc5b[_0x1be9('0x12')][_0x1be9('0x14')]);}logger['error'](_0x1be9('0xf'),_0x28cf04,_0x22cc5b[_0x1be9('0x12')][_0x1be9('0x14')]);return _0x2a389e(_0x22cc5b['error']['message']);}else{logger[_0x1be9('0xe')](_0x1be9('0xf'),_0x28cf04,_0x1be9('0x10'));_0x2a389e(_0x22cc5b[_0x1be9('0x15')]['message']);}})[_0x1be9('0x16')](function(_0x1448e7){logger['error'](_0x1be9('0xf'),_0x28cf04,_0x1448e7);_0x19d8a4(_0x1448e7);});});} \ No newline at end of file +var _0x78b8=['MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x4544b2,_0x3202b6){var _0x347ac4=function(_0x1d6d17){while(--_0x1d6d17){_0x4544b2['push'](_0x4544b2['shift']());}};_0x347ac4(++_0x3202b6);}(_0x78b8,0xcc));var _0x878b=function(_0x54fe0f,_0x52bc9d){_0x54fe0f=_0x54fe0f-0x0;var _0x1647b9=_0x78b8[_0x54fe0f];return _0x1647b9;};'use strict';var _=require(_0x878b('0x0'));var util=require(_0x878b('0x1'));var moment=require(_0x878b('0x2'));var BPromise=require(_0x878b('0x3'));var rs=require(_0x878b('0x4'));var fs=require('fs');var Redis=require(_0x878b('0x5'));var db=require(_0x878b('0x6'))['db'];var utils=require(_0x878b('0x7'));var logger=require(_0x878b('0x8'))(_0x878b('0x9'));var config=require(_0x878b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x878b('0xb')][_0x878b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x229853,_0x429efe,_0x2b2707){return new BPromise(function(_0x15dfb5,_0x344980){return client[_0x878b('0xd')](_0x229853,_0x2b2707)[_0x878b('0xe')](function(_0x25cf2b){logger[_0x878b('0xf')](_0x878b('0x10'),_0x429efe,_0x878b('0x11'));logger['debug'](_0x878b('0x12'),_0x429efe,'request\x20sent',JSON['stringify'](_0x25cf2b));if(_0x25cf2b[_0x878b('0x13')]){if(_0x25cf2b[_0x878b('0x13')]['code']===0x1f4){logger[_0x878b('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x429efe,_0x25cf2b[_0x878b('0x13')]['message']);return _0x344980(_0x25cf2b['error'][_0x878b('0x14')]);}logger[_0x878b('0x13')](_0x878b('0x10'),_0x429efe,_0x25cf2b['error']['message']);return _0x15dfb5(_0x25cf2b[_0x878b('0x13')][_0x878b('0x14')]);}else{logger['info'](_0x878b('0x10'),_0x429efe,_0x878b('0x11'));_0x15dfb5(_0x25cf2b[_0x878b('0x15')]['message']);}})['catch'](function(_0x11c0ab){logger['error'](_0x878b('0x10'),_0x429efe,_0x11c0ab);_0x344980(_0x11c0ab);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index d8ecb36..8e92690 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 _0x9589=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9589,0xbc));var _0x9958=function(_0x28b5cf,_0x5824bd){_0x28b5cf=_0x28b5cf-0x0;var _0x9e1f2b=_0x9589[_0x28b5cf];return _0x9e1f2b;};'use strict';var multer=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var path=require(_0x9958('0x2'));var timeout=require(_0x9958('0x3'));var express=require(_0x9958('0x4'));var router=express['Router']();var auth=require(_0x9958('0x5'));var interaction=require(_0x9958('0x6'));var config=require(_0x9958('0x7'));var controller=require('./memberReport.controller');router[_0x9958('0x8')]('/',auth[_0x9958('0x9')](),controller[_0x9958('0xa')]);router[_0x9958('0x8')](_0x9958('0xb'),auth[_0x9958('0x9')](),controller['describe']);router[_0x9958('0x8')](_0x9958('0xc'),auth[_0x9958('0x9')](),controller[_0x9958('0xd')]);router[_0x9958('0xe')]('/',auth[_0x9958('0x9')](),controller[_0x9958('0xf')]);router[_0x9958('0x10')](_0x9958('0xc'),auth[_0x9958('0x9')](),controller[_0x9958('0x11')]);router[_0x9958('0x12')](_0x9958('0xc'),auth[_0x9958('0x9')](),controller[_0x9958('0x13')]);module[_0x9958('0x14')]=router; \ No newline at end of file +var _0x5105=['/:id','show','create','put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','index','/describe','isAuthenticated'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x5105,0x97));var _0x5510=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5105[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x5510('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5510('0x1'));var express=require(_0x5510('0x2'));var router=express[_0x5510('0x3')]();var auth=require(_0x5510('0x4'));var interaction=require(_0x5510('0x5'));var config=require('../../config/environment');var controller=require(_0x5510('0x6'));router[_0x5510('0x7')]('/',auth['isAuthenticated'](),controller[_0x5510('0x8')]);router[_0x5510('0x7')](_0x5510('0x9'),auth[_0x5510('0xa')](),controller['describe']);router[_0x5510('0x7')](_0x5510('0xb'),auth[_0x5510('0xa')](),controller[_0x5510('0xc')]);router['post']('/',auth[_0x5510('0xa')](),controller[_0x5510('0xd')]);router[_0x5510('0xe')]('/:id',auth[_0x5510('0xa')](),controller[_0x5510('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5510('0x10')]);module[_0x5510('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 11cbeb8..0d4464a 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 _0xb018=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','duration'];(function(_0x224166,_0x314ba8){var _0x7bd3d9=function(_0x2523ce){while(--_0x2523ce){_0x224166['push'](_0x224166['shift']());}};_0x7bd3d9(++_0x314ba8);}(_0xb018,0x173));var _0x8b01=function(_0x2ce345,_0x5ea50b){_0x2ce345=_0x2ce345-0x0;var _0x40bd2a=_0xb018[_0x2ce345];return _0x40bd2a;};'use strict';var Sequelize=require(_0x8b01('0x0'));var moment=require(_0x8b01('0x1'));module[_0x8b01('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8b01('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x8b01('0x4'),'comment':_0x8b01('0x5')},'duration':{'type':Sequelize[_0x8b01('0x6')]},'enterAt':{'type':Sequelize[_0x8b01('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x26f0fa){var _0x57c417=moment(_0x26f0fa);var _0x15214b=moment(this['getDataValue'](_0x8b01('0x8')));var _0x651536=_0x57c417[_0x8b01('0x9')](_0x15214b,_0x8b01('0xa'));this[_0x8b01('0xb')]('exitAt',_0x26f0fa);this[_0x8b01('0xb')](_0x8b01('0xc'),_0x651536||null);}},'data1':{'type':Sequelize[_0x8b01('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x8b01('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x8b01('0x3')],'comment':_0x8b01('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0x8b01('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0x8b01('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x8b01('0x6')]},'uniqueid':{'type':Sequelize[_0x8b01('0x3')]}}; \ No newline at end of file +var _0xace6=['STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','setDataValue','duration','talk:[queue]','sequelize','moment','exports'];(function(_0x3878b9,_0x781c48){var _0x16f76c=function(_0x505e98){while(--_0x505e98){_0x3878b9['push'](_0x3878b9['shift']());}};_0x16f76c(++_0x781c48);}(_0xace6,0x17d));var _0x6ace=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xace6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6ace('0x0'));var moment=require(_0x6ace('0x1'));module[_0x6ace('0x2')]={'channel':{'type':Sequelize[_0x6ace('0x3')]},'membername':{'type':Sequelize[_0x6ace('0x3')]},'interface':{'type':Sequelize[_0x6ace('0x3')]},'type':{'type':Sequelize[_0x6ace('0x3')],'defaultValue':_0x6ace('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x6ace('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6ace('0x6')],'set':function(_0x23c215){var _0x5b9031=moment(_0x23c215);var _0x232419=moment(this[_0x6ace('0x7')](_0x6ace('0x8')));var _0xcf851c=_0x5b9031['diff'](_0x232419,'seconds');this[_0x6ace('0x9')]('exitAt',_0x23c215);this['setDataValue'](_0x6ace('0xa'),_0xcf851c||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x6ace('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x6ace('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x6ace('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x6ace('0x3')],'comment':_0x6ace('0xb')},'role':{'type':Sequelize[_0x6ace('0x3')]},'internal':{'type':Sequelize[_0x6ace('0x5')]},'uniqueid':{'type':Sequelize[_0x6ace('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 15eaf2d..694603f 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 _0xa73a=['lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','index','map','MemberReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa73a,0x1e2));var _0xaa73=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0xa73a[_0x3b7b8a];return _0x441206;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaa73('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa73('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa73('0x2'));var moment=require(_0xaa73('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaa73('0x4'));var util=require('util');var path=require('path');var sox=require(_0xaa73('0x5'));var csv=require(_0xaa73('0x6'));var ejs=require(_0xaa73('0x7'));var fs=require('fs');var _=require(_0xaa73('0x8'));var squel=require(_0xaa73('0x9'));var crypto=require(_0xaa73('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xaa73('0xb'));var toCsv=require(_0xaa73('0x6'));var querystring=require('querystring');var Papa=require(_0xaa73('0xc'));var Redis=require(_0xaa73('0xd'));var authService=require(_0xaa73('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xaa73('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa73('0x10'));var utils=require('../../config/utils');var config=require(_0xaa73('0x11'));var db=require(_0xaa73('0x12'))['db'];function respondWithStatusCode(_0x3fc842,_0x34cf9f){_0x34cf9f=_0x34cf9f||0xcc;return function(_0x458f85){if(_0x458f85){return _0x3fc842['sendStatus'](_0x34cf9f);}return _0x3fc842[_0xaa73('0x13')](_0x34cf9f)[_0xaa73('0x14')]();};}function respondWithResult(_0x21d29f,_0x1cab5e){_0x1cab5e=_0x1cab5e||0xc8;return function(_0x4dc096){if(_0x4dc096){return _0x21d29f[_0xaa73('0x13')](_0x1cab5e)[_0xaa73('0x15')](_0x4dc096);}};}function respondWithFilteredResult(_0x4830a1,_0x8088e9){return function(_0x346d00){if(_0x346d00){var _0x4dc0f1=_0x346d00[_0xaa73('0x16')],_0x5f12a8=_0x8088e9[_0xaa73('0x17')],_0x1a6a05=_0x8088e9['offset']+_0x8088e9[_0xaa73('0x18')],_0x3227c7;if(_0x1a6a05>=_0x4dc0f1){_0x1a6a05=_0x4dc0f1;_0x3227c7=0xc8;}else{_0x3227c7=0xce;}_0x4830a1['status'](_0x3227c7);return _0x4830a1[_0xaa73('0x19')](_0xaa73('0x1a'),_0x5f12a8+'-'+_0x1a6a05+'/'+_0x4dc0f1)[_0xaa73('0x15')](_0x346d00);}return null;};}function patchUpdates(_0x3ac9c6){return function(_0x346a07){try{jsonpatch[_0xaa73('0x1b')](_0x346a07,_0x3ac9c6,!![]);}catch(_0x13a778){return BPromise[_0xaa73('0x1c')](_0x13a778);}return _0x346a07['save']();};}function saveUpdates(_0x20ff53,_0x35e6f4){return function(_0x2d227b){if(_0x2d227b){return _0x2d227b[_0xaa73('0x1d')](_0x20ff53)['then'](function(_0x950763){return _0x950763;});}return null;};}function removeEntity(_0x29de1c,_0x328c43){return function(_0x71ced8){if(_0x71ced8){return _0x71ced8[_0xaa73('0x1e')]()[_0xaa73('0x1f')](function(){_0x29de1c[_0xaa73('0x13')](0xcc)[_0xaa73('0x14')]();});}};}function handleEntityNotFound(_0xb8734f,_0x1b0088){return function(_0x155ff4){if(!_0x155ff4){_0xb8734f[_0xaa73('0x20')](0x194);}return _0x155ff4;};}function handleError(_0x5307f7,_0x2e697c){_0x2e697c=_0x2e697c||0x1f4;return function(_0x2ee3c1){logger['error'](_0x2ee3c1[_0xaa73('0x21')]);if(_0x2ee3c1[_0xaa73('0x22')]){delete _0x2ee3c1['name'];}_0x5307f7[_0xaa73('0x13')](_0x2e697c)['send'](_0x2ee3c1);};}exports[_0xaa73('0x23')]=function(_0x4f4c9,_0x3d6f46){var _0x451f6c={},_0x46dd8c={},_0x417b8d={'count':0x0,'rows':[]};var _0xf83f34=_[_0xaa73('0x24')](db[_0xaa73('0x25')][_0xaa73('0x26')],function(_0x603389){return{'name':_0x603389[_0xaa73('0x27')],'type':_0x603389['type'][_0xaa73('0x28')]};});_0x46dd8c[_0xaa73('0x29')]=_[_0xaa73('0x24')](_0xf83f34,_0xaa73('0x22'));_0x46dd8c['query']=_[_0xaa73('0x2a')](_0x4f4c9[_0xaa73('0x2b')]);_0x46dd8c[_0xaa73('0x2c')]=_['intersection'](_0x46dd8c['model'],_0x46dd8c[_0xaa73('0x2b')]);_0x451f6c[_0xaa73('0x2d')]=_[_0xaa73('0x2e')](_0x46dd8c[_0xaa73('0x29')],qs[_0xaa73('0x2f')](_0x4f4c9[_0xaa73('0x2b')][_0xaa73('0x2f')]));_0x451f6c['attributes']=_0x451f6c['attributes'][_0xaa73('0x30')]?_0x451f6c[_0xaa73('0x2d')]:_0x46dd8c[_0xaa73('0x29')];if(!_0x4f4c9[_0xaa73('0x2b')][_0xaa73('0x31')](_0xaa73('0x32'))){_0x451f6c['limit']=qs[_0xaa73('0x18')](_0x4f4c9['query'][_0xaa73('0x18')]);_0x451f6c[_0xaa73('0x17')]=qs[_0xaa73('0x17')](_0x4f4c9[_0xaa73('0x2b')][_0xaa73('0x17')]);}_0x451f6c[_0xaa73('0x33')]=qs[_0xaa73('0x34')](_0x4f4c9[_0xaa73('0x2b')]['sort']);_0x451f6c[_0xaa73('0x35')]=qs[_0xaa73('0x2c')](_[_0xaa73('0x36')](_0x4f4c9['query'],_0x46dd8c['filters']),_0xf83f34);if(_0x4f4c9[_0xaa73('0x2b')][_0xaa73('0x37')]){_0x451f6c[_0xaa73('0x35')]=_['merge'](_0x451f6c[_0xaa73('0x35')],{'$or':_[_0xaa73('0x24')](_0xf83f34,function(_0x546062){if(_0x546062[_0xaa73('0x38')]!==_0xaa73('0x39')){var _0x55a2a0={};_0x55a2a0[_0x546062['name']]={'$like':'%'+_0x4f4c9['query'][_0xaa73('0x37')]+'%'};return _0x55a2a0;}})});}_0x451f6c=_[_0xaa73('0x3a')]({},_0x451f6c,_0x4f4c9[_0xaa73('0x3b')]);var _0x46929a={'where':_0x451f6c['where']};return db[_0xaa73('0x25')]['count'](_0x46929a)[_0xaa73('0x1f')](function(_0x55c294){_0x417b8d['count']=_0x55c294;if(_0x4f4c9['query'][_0xaa73('0x3c')]){_0x451f6c[_0xaa73('0x3d')]=[{'all':!![]}];}return db[_0xaa73('0x25')][_0xaa73('0x3e')](_0x451f6c);})['then'](function(_0x104020){_0x417b8d[_0xaa73('0x3f')]=_0x104020;return _0x417b8d;})[_0xaa73('0x1f')](respondWithFilteredResult(_0x3d6f46,_0x451f6c))['catch'](handleError(_0x3d6f46,null));};exports[_0xaa73('0x40')]=function(_0x4bb8f4,_0x22f617){var _0x435301={'raw':!![],'where':{'id':_0x4bb8f4['params']['id']}},_0x28f0e2={};_0x28f0e2[_0xaa73('0x29')]=_[_0xaa73('0x2a')](db[_0xaa73('0x25')]['rawAttributes']);_0x28f0e2[_0xaa73('0x2b')]=_[_0xaa73('0x2a')](_0x4bb8f4[_0xaa73('0x2b')]);_0x28f0e2['filters']=_[_0xaa73('0x2e')](_0x28f0e2[_0xaa73('0x29')],_0x28f0e2[_0xaa73('0x2b')]);_0x435301[_0xaa73('0x2d')]=_[_0xaa73('0x2e')](_0x28f0e2[_0xaa73('0x29')],qs[_0xaa73('0x2f')](_0x4bb8f4['query'][_0xaa73('0x2f')]));_0x435301[_0xaa73('0x2d')]=_0x435301[_0xaa73('0x2d')]['length']?_0x435301['attributes']:_0x28f0e2['model'];if(_0x4bb8f4[_0xaa73('0x2b')]['includeAll']){_0x435301[_0xaa73('0x3d')]=[{'all':!![]}];}_0x435301=_[_0xaa73('0x3a')]({},_0x435301,_0x4bb8f4[_0xaa73('0x3b')]);return db[_0xaa73('0x25')][_0xaa73('0x41')](_0x435301)[_0xaa73('0x1f')](handleEntityNotFound(_0x22f617,null))[_0xaa73('0x1f')](respondWithResult(_0x22f617,null))[_0xaa73('0x42')](handleError(_0x22f617,null));};exports[_0xaa73('0x43')]=function(_0x54c31a,_0x133cf1){return db[_0xaa73('0x25')][_0xaa73('0x43')](_0x54c31a[_0xaa73('0x44')],{})['then'](respondWithResult(_0x133cf1,0xc9))[_0xaa73('0x42')](handleError(_0x133cf1,null));};exports['update']=function(_0x3dddf4,_0x31c6ba){if(_0x3dddf4[_0xaa73('0x44')]['id']){delete _0x3dddf4[_0xaa73('0x44')]['id'];}return db['MemberReport']['find']({'where':{'id':_0x3dddf4['params']['id']}})['then'](handleEntityNotFound(_0x31c6ba,null))[_0xaa73('0x1f')](saveUpdates(_0x3dddf4['body'],null))['then'](respondWithResult(_0x31c6ba,null))[_0xaa73('0x42')](handleError(_0x31c6ba,null));};exports['destroy']=function(_0xf96718,_0x98d846){return db[_0xaa73('0x25')][_0xaa73('0x41')]({'where':{'id':_0xf96718['params']['id']}})[_0xaa73('0x1f')](handleEntityNotFound(_0x98d846,null))['then'](removeEntity(_0x98d846,null))[_0xaa73('0x42')](handleError(_0x98d846,null));};exports[_0xaa73('0x45')]=function(_0x4c5ee4,_0x2303a6){return db['MemberReport']['describe']()[_0xaa73('0x1f')](respondWithResult(_0x2303a6,null))[_0xaa73('0x42')](handleError(_0x2303a6,null));}; \ No newline at end of file +var _0x923c=['sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','update','then','error','stack','name','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x1d8b60,_0xb6c036){var _0x108a1c=function(_0x2cb94a){while(--_0x2cb94a){_0x1d8b60['push'](_0x1d8b60['shift']());}};_0x108a1c(++_0xb6c036);}(_0x923c,0xe9));var _0xc923=function(_0x5d891e,_0xbec511){_0x5d891e=_0x5d891e-0x0;var _0x40d481=_0x923c[_0x5d891e];return _0x40d481;};'use strict';var pdf=require(_0xc923('0x0'));var emlformat=require(_0xc923('0x1'));var rimraf=require(_0xc923('0x2'));var zipdir=require(_0xc923('0x3'));var jsonpatch=require(_0xc923('0x4'));var rp=require('request-promise');var moment=require(_0xc923('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc923('0x6'));var path=require(_0xc923('0x7'));var sox=require(_0xc923('0x8'));var csv=require('to-csv');var ejs=require(_0xc923('0x9'));var fs=require('fs');var _=require(_0xc923('0xa'));var squel=require(_0xc923('0xb'));var crypto=require(_0xc923('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc923('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc923('0xe'));var Redis=require(_0xc923('0xf'));var authService=require(_0xc923('0x10'));var qs=require(_0xc923('0x11'));var as=require(_0xc923('0x12'));var hardwareService=require(_0xc923('0x13'));var logger=require(_0xc923('0x14'))(_0xc923('0x15'));var utils=require(_0xc923('0x16'));var config=require('../../config/environment');var db=require(_0xc923('0x17'))['db'];function respondWithStatusCode(_0x2786f2,_0x382ffa){_0x382ffa=_0x382ffa||0xcc;return function(_0x4d7cd0){if(_0x4d7cd0){return _0x2786f2[_0xc923('0x18')](_0x382ffa);}return _0x2786f2[_0xc923('0x19')](_0x382ffa)[_0xc923('0x1a')]();};}function respondWithResult(_0x5516ae,_0x4d41b9){_0x4d41b9=_0x4d41b9||0xc8;return function(_0x20dcbf){if(_0x20dcbf){return _0x5516ae['status'](_0x4d41b9)[_0xc923('0x1b')](_0x20dcbf);}};}function respondWithFilteredResult(_0x398eaf,_0xb73349){return function(_0x426026){if(_0x426026){var _0x155fac=_0x426026[_0xc923('0x1c')],_0xa5778a=_0xb73349[_0xc923('0x1d')],_0x2493f4=_0xb73349['offset']+_0xb73349[_0xc923('0x1e')],_0x2b8f18;if(_0x2493f4>=_0x155fac){_0x2493f4=_0x155fac;_0x2b8f18=0xc8;}else{_0x2b8f18=0xce;}_0x398eaf['status'](_0x2b8f18);return _0x398eaf[_0xc923('0x1f')]('Content-Range',_0xa5778a+'-'+_0x2493f4+'/'+_0x155fac)['json'](_0x426026);}return null;};}function patchUpdates(_0x24d796){return function(_0x2043fa){try{jsonpatch['apply'](_0x2043fa,_0x24d796,!![]);}catch(_0x25c0d8){return BPromise['reject'](_0x25c0d8);}return _0x2043fa[_0xc923('0x20')]();};}function saveUpdates(_0x43b828,_0x2dce23){return function(_0x14bb55){if(_0x14bb55){return _0x14bb55[_0xc923('0x21')](_0x43b828)['then'](function(_0x4a9bc2){return _0x4a9bc2;});}return null;};}function removeEntity(_0x1a4e16,_0x43dab5){return function(_0x21fe36){if(_0x21fe36){return _0x21fe36['destroy']()[_0xc923('0x22')](function(){_0x1a4e16[_0xc923('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x352ef4,_0x1de344){return function(_0x51cca1){if(!_0x51cca1){_0x352ef4[_0xc923('0x18')](0x194);}return _0x51cca1;};}function handleError(_0x2d4515,_0x434632){_0x434632=_0x434632||0x1f4;return function(_0x358629){logger[_0xc923('0x23')](_0x358629[_0xc923('0x24')]);if(_0x358629[_0xc923('0x25')]){delete _0x358629[_0xc923('0x25')];}_0x2d4515['status'](_0x434632)['send'](_0x358629);};}exports[_0xc923('0x26')]=function(_0x13627f,_0x1e09ec){var _0x3eb1f0={},_0x5eadc5={},_0x34aede={'count':0x0,'rows':[]};var _0x52c5f1=_[_0xc923('0x27')](db[_0xc923('0x28')][_0xc923('0x29')],function(_0x3fa3ca){return{'name':_0x3fa3ca[_0xc923('0x2a')],'type':_0x3fa3ca[_0xc923('0x2b')][_0xc923('0x2c')]};});_0x5eadc5[_0xc923('0x2d')]=_[_0xc923('0x27')](_0x52c5f1,_0xc923('0x25'));_0x5eadc5['query']=_[_0xc923('0x2e')](_0x13627f[_0xc923('0x2f')]);_0x5eadc5[_0xc923('0x30')]=_['intersection'](_0x5eadc5[_0xc923('0x2d')],_0x5eadc5['query']);_0x3eb1f0[_0xc923('0x31')]=_[_0xc923('0x32')](_0x5eadc5[_0xc923('0x2d')],qs[_0xc923('0x33')](_0x13627f[_0xc923('0x2f')][_0xc923('0x33')]));_0x3eb1f0[_0xc923('0x31')]=_0x3eb1f0[_0xc923('0x31')][_0xc923('0x34')]?_0x3eb1f0[_0xc923('0x31')]:_0x5eadc5[_0xc923('0x2d')];if(!_0x13627f[_0xc923('0x2f')][_0xc923('0x35')](_0xc923('0x36'))){_0x3eb1f0[_0xc923('0x1e')]=qs[_0xc923('0x1e')](_0x13627f['query'][_0xc923('0x1e')]);_0x3eb1f0['offset']=qs[_0xc923('0x1d')](_0x13627f[_0xc923('0x2f')][_0xc923('0x1d')]);}_0x3eb1f0['order']=qs[_0xc923('0x37')](_0x13627f[_0xc923('0x2f')][_0xc923('0x37')]);_0x3eb1f0['where']=qs['filters'](_[_0xc923('0x38')](_0x13627f[_0xc923('0x2f')],_0x5eadc5['filters']),_0x52c5f1);if(_0x13627f[_0xc923('0x2f')][_0xc923('0x39')]){_0x3eb1f0[_0xc923('0x3a')]=_[_0xc923('0x3b')](_0x3eb1f0[_0xc923('0x3a')],{'$or':_[_0xc923('0x27')](_0x52c5f1,function(_0xbbfbd3){if(_0xbbfbd3[_0xc923('0x2b')]!==_0xc923('0x3c')){var _0x5d4077={};_0x5d4077[_0xbbfbd3[_0xc923('0x25')]]={'$like':'%'+_0x13627f[_0xc923('0x2f')][_0xc923('0x39')]+'%'};return _0x5d4077;}})});}_0x3eb1f0=_[_0xc923('0x3b')]({},_0x3eb1f0,_0x13627f[_0xc923('0x3d')]);var _0x1b2852={'where':_0x3eb1f0[_0xc923('0x3a')]};return db[_0xc923('0x28')][_0xc923('0x1c')](_0x1b2852)['then'](function(_0x5c51dc){_0x34aede[_0xc923('0x1c')]=_0x5c51dc;if(_0x13627f['query'][_0xc923('0x3e')]){_0x3eb1f0[_0xc923('0x3f')]=[{'all':!![]}];}return db[_0xc923('0x28')]['findAll'](_0x3eb1f0);})[_0xc923('0x22')](function(_0x5f26e1){_0x34aede[_0xc923('0x40')]=_0x5f26e1;return _0x34aede;})[_0xc923('0x22')](respondWithFilteredResult(_0x1e09ec,_0x3eb1f0))[_0xc923('0x41')](handleError(_0x1e09ec,null));};exports[_0xc923('0x42')]=function(_0x28203d,_0x4bf585){var _0xca840c={'raw':!![],'where':{'id':_0x28203d[_0xc923('0x43')]['id']}},_0x349d85={};_0x349d85[_0xc923('0x2d')]=_[_0xc923('0x2e')](db[_0xc923('0x28')][_0xc923('0x29')]);_0x349d85[_0xc923('0x2f')]=_[_0xc923('0x2e')](_0x28203d['query']);_0x349d85[_0xc923('0x30')]=_['intersection'](_0x349d85[_0xc923('0x2d')],_0x349d85[_0xc923('0x2f')]);_0xca840c[_0xc923('0x31')]=_[_0xc923('0x32')](_0x349d85[_0xc923('0x2d')],qs[_0xc923('0x33')](_0x28203d[_0xc923('0x2f')][_0xc923('0x33')]));_0xca840c[_0xc923('0x31')]=_0xca840c[_0xc923('0x31')][_0xc923('0x34')]?_0xca840c[_0xc923('0x31')]:_0x349d85['model'];if(_0x28203d[_0xc923('0x2f')][_0xc923('0x3e')]){_0xca840c['include']=[{'all':!![]}];}_0xca840c=_[_0xc923('0x3b')]({},_0xca840c,_0x28203d[_0xc923('0x3d')]);return db[_0xc923('0x28')][_0xc923('0x44')](_0xca840c)[_0xc923('0x22')](handleEntityNotFound(_0x4bf585,null))[_0xc923('0x22')](respondWithResult(_0x4bf585,null))[_0xc923('0x41')](handleError(_0x4bf585,null));};exports['create']=function(_0x207539,_0x185e8c){return db['MemberReport'][_0xc923('0x45')](_0x207539[_0xc923('0x46')],{})[_0xc923('0x22')](respondWithResult(_0x185e8c,0xc9))[_0xc923('0x41')](handleError(_0x185e8c,null));};exports[_0xc923('0x21')]=function(_0x345c09,_0x1a35b0){if(_0x345c09[_0xc923('0x46')]['id']){delete _0x345c09[_0xc923('0x46')]['id'];}return db['MemberReport']['find']({'where':{'id':_0x345c09[_0xc923('0x43')]['id']}})[_0xc923('0x22')](handleEntityNotFound(_0x1a35b0,null))[_0xc923('0x22')](saveUpdates(_0x345c09['body'],null))[_0xc923('0x22')](respondWithResult(_0x1a35b0,null))[_0xc923('0x41')](handleError(_0x1a35b0,null));};exports['destroy']=function(_0x4bbf4b,_0x5a2629){return db[_0xc923('0x28')]['find']({'where':{'id':_0x4bbf4b[_0xc923('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a2629,null))[_0xc923('0x22')](removeEntity(_0x5a2629,null))['catch'](handleError(_0x5a2629,null));};exports['describe']=function(_0x1c5e87,_0x2c815b){return db['MemberReport'][_0xc923('0x47')]()[_0xc923('0x22')](respondWithResult(_0x2c815b,null))[_0xc923('0x41')](handleError(_0x2c815b,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 79e0cc1..3d30e9e 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 _0x56e7=['../../config/environment','./memberReport.attributes','define','MemberReport','membername_interface','interface','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56e7,0x7b));var _0x756e=function(_0x12b4c1,_0x19f034){_0x12b4c1=_0x12b4c1-0x0;var _0x1329da=_0x56e7[_0x12b4c1];return _0x1329da;};'use strict';var _=require('lodash');var util=require(_0x756e('0x0'));var logger=require(_0x756e('0x1'))('api');var moment=require(_0x756e('0x2'));var BPromise=require(_0x756e('0x3'));var rp=require(_0x756e('0x4'));var fs=require('fs');var path=require(_0x756e('0x5'));var rimraf=require(_0x756e('0x6'));var config=require(_0x756e('0x7'));var attributes=require(_0x756e('0x8'));module['exports']=function(_0x3b3b8f,_0x404189){return _0x3b3b8f[_0x756e('0x9')](_0x756e('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x756e('0xb'),'fields':['membername',_0x756e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member','membername'];(function(_0x14612f,_0x1c3389){var _0x3c41ad=function(_0x41043c){while(--_0x41043c){_0x14612f['push'](_0x14612f['shift']());}};_0x3c41ad(++_0x1c3389);}(_0x008c,0x188));var _0xc008=function(_0x2b8bbe,_0x37eb6a){_0x2b8bbe=_0x2b8bbe-0x0;var _0x1bb210=_0x008c[_0x2b8bbe];return _0x1bb210;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('MemberReport',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xc008('0xd'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 80c6055..4624d77 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 _0xad9f=['model','then','GetMemberReport','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','findAll','options','raw','attributes','limit','include','map'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0xad9f,0xed));var _0xfad9=function(_0x394a18,_0x27dc77){_0x394a18=_0x394a18-0x0;var _0x58a49c=_0xad9f[_0x394a18];return _0x58a49c;};'use strict';var _=require(_0xfad9('0x0'));var util=require(_0xfad9('0x1'));var moment=require('moment');var BPromise=require(_0xfad9('0x2'));var rs=require(_0xfad9('0x3'));var fs=require('fs');var Redis=require(_0xfad9('0x4'));var db=require(_0xfad9('0x5'))['db'];var utils=require(_0xfad9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfad9('0x7'));var jayson=require(_0xfad9('0x8'));var client=jayson[_0xfad9('0x9')][_0xfad9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ef2ff,_0x444a74,_0x55784b){return new BPromise(function(_0x538415,_0x4d6e93){return client[_0xfad9('0xb')](_0x5ef2ff,_0x55784b)['then'](function(_0x46ba05){logger[_0xfad9('0xc')](_0xfad9('0xd'),_0x444a74,'request\x20sent');logger[_0xfad9('0xe')](_0xfad9('0xf'),_0x444a74,'request\x20sent',JSON[_0xfad9('0x10')](_0x46ba05));if(_0x46ba05[_0xfad9('0x11')]){if(_0x46ba05['error']['code']===0x1f4){logger[_0xfad9('0x11')](_0xfad9('0xd'),_0x444a74,_0x46ba05['error'][_0xfad9('0x12')]);return _0x4d6e93(_0x46ba05[_0xfad9('0x11')][_0xfad9('0x12')]);}logger[_0xfad9('0x11')](_0xfad9('0xd'),_0x444a74,_0x46ba05[_0xfad9('0x11')][_0xfad9('0x12')]);return _0x538415(_0x46ba05[_0xfad9('0x11')][_0xfad9('0x12')]);}else{logger[_0xfad9('0xc')](_0xfad9('0xd'),_0x444a74,_0xfad9('0x13'));_0x538415(_0x46ba05[_0xfad9('0x14')][_0xfad9('0x12')]);}})[_0xfad9('0x15')](function(_0x246804){logger['error'](_0xfad9('0xd'),_0x444a74,_0x246804);_0x4d6e93(_0x246804);});});}exports['GetMemberReport']=function(_0x4545fb){var _0x305386=this;return new Promise(function(_0x4b1f6a,_0x39b674){return db['MemberReport'][_0xfad9('0x16')]({'raw':_0x4545fb[_0xfad9('0x17')]?_0x4545fb[_0xfad9('0x17')][_0xfad9('0x18')]===undefined?!![]:![]:!![],'where':_0x4545fb['options']?_0x4545fb[_0xfad9('0x17')]['where']||null:null,'attributes':_0x4545fb[_0xfad9('0x17')]?_0x4545fb['options'][_0xfad9('0x19')]||null:null,'limit':_0x4545fb['options']?_0x4545fb[_0xfad9('0x17')][_0xfad9('0x1a')]||null:null,'include':_0x4545fb[_0xfad9('0x17')]?_0x4545fb[_0xfad9('0x17')][_0xfad9('0x1b')]?_[_0xfad9('0x1c')](_0x4545fb[_0xfad9('0x17')][_0xfad9('0x1b')],function(_0x41aa78){return{'model':db[_0x41aa78[_0xfad9('0x1d')]],'as':_0x41aa78['as'],'attributes':_0x41aa78[_0xfad9('0x19')],'include':_0x41aa78[_0xfad9('0x1b')]?_['map'](_0x41aa78['include'],function(_0x5e5b65){return{'model':db[_0x5e5b65[_0xfad9('0x1d')]],'as':_0x5e5b65['as'],'attributes':_0x5e5b65[_0xfad9('0x19')],'include':_0x5e5b65[_0xfad9('0x1b')]?_['map'](_0x5e5b65[_0xfad9('0x1b')],function(_0x36c274){return{'model':db[_0x36c274['model']],'as':_0x36c274['as'],'attributes':_0x36c274[_0xfad9('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfad9('0x1e')](function(_0x3d3446){logger['info'](_0xfad9('0x1f'),_0x4545fb);logger[_0xfad9('0xe')](_0xfad9('0x1f'),_0x4545fb,JSON[_0xfad9('0x10')](_0x3d3446));_0x4b1f6a(_0x3d3446);})['catch'](function(_0x43d4d8){logger[_0xfad9('0x11')]('GetMemberReport',_0x43d4d8[_0xfad9('0x12')],_0x4545fb);_0x39b674(_0x305386[_0xfad9('0x11')](0x1f4,_0x43d4d8[_0xfad9('0x12')]));});});};exports[_0xfad9('0x20')]=function(_0x5ddbd7){var _0x376542=this;return new Promise(function(_0xb4ad82,_0x5df5ae){return db[_0xfad9('0x21')][_0xfad9('0x22')](_0x5ddbd7[_0xfad9('0x23')],{'raw':_0x5ddbd7[_0xfad9('0x17')]?_0x5ddbd7[_0xfad9('0x17')][_0xfad9('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5b7876){logger[_0xfad9('0xc')]('CreateMemberReport',_0x5ddbd7);logger[_0xfad9('0xe')](_0xfad9('0x20'),_0x5ddbd7,JSON['stringify'](_0x5b7876));_0xb4ad82(_0x5b7876);})[_0xfad9('0x15')](function(_0x2562e1){logger[_0xfad9('0x11')](_0xfad9('0x20'),_0x2562e1[_0xfad9('0x12')],_0x5ddbd7);_0x5df5ae(_0x376542[_0xfad9('0x11')](0x1f4,_0x2562e1[_0xfad9('0x12')]));});});};exports[_0xfad9('0x24')]=function(_0xd77d1){var _0x2f7e3c=this;return new Promise(function(_0x17c1c0,_0x4cadb4){return db[_0xfad9('0x21')][_0xfad9('0x25')](_0xd77d1[_0xfad9('0x23')],{'raw':_0xd77d1[_0xfad9('0x17')]?_0xd77d1['options'][_0xfad9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd77d1[_0xfad9('0x17')]?_0xd77d1[_0xfad9('0x17')]['where']||null:null,'attributes':_0xd77d1[_0xfad9('0x17')]?_0xd77d1['options']['attributes']||null:null,'limit':_0xd77d1['options']?_0xd77d1[_0xfad9('0x17')][_0xfad9('0x1a')]||null:null})[_0xfad9('0x1e')](function(_0x5cd79e){logger[_0xfad9('0xc')](_0xfad9('0x24'),_0xd77d1);logger[_0xfad9('0xe')](_0xfad9('0x24'),_0xd77d1,JSON['stringify'](_0x5cd79e));_0x17c1c0(_0x5cd79e);})[_0xfad9('0x15')](function(_0x75f08f){logger['error'](_0xfad9('0x24'),_0x75f08f['message'],_0xd77d1);_0x4cadb4(_0x2f7e3c[_0xfad9('0x11')](0x1f4,_0x75f08f[_0xfad9('0x12')]));});});}; \ No newline at end of file +var _0x0160=['create','body','raw','UpdateMemberReport','MemberReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','GetMemberReport','findAll','options','where','attributes','limit','include','model','map','stringify','catch','CreateMemberReport'];(function(_0xdb7442,_0x303f6f){var _0x478409=function(_0x3f5140){while(--_0x3f5140){_0xdb7442['push'](_0xdb7442['shift']());}};_0x478409(++_0x303f6f);}(_0x0160,0x117));var _0x0016=function(_0xf10840,_0xad3916){_0xf10840=_0xf10840-0x0;var _0x1fdf7e=_0x0160[_0xf10840];return _0x1fdf7e;};'use strict';var _=require(_0x0016('0x0'));var util=require(_0x0016('0x1'));var moment=require(_0x0016('0x2'));var BPromise=require(_0x0016('0x3'));var rs=require(_0x0016('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0016('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0016('0x6'));var config=require(_0x0016('0x7'));var jayson=require(_0x0016('0x8'));var client=jayson[_0x0016('0x9')][_0x0016('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7046e7,_0x260869,_0x342822){return new BPromise(function(_0x2357b4,_0x6221e6){return client[_0x0016('0xb')](_0x7046e7,_0x342822)[_0x0016('0xc')](function(_0x236d5d){logger[_0x0016('0xd')]('MemberReport,\x20%s,\x20%s',_0x260869,_0x0016('0xe'));logger[_0x0016('0xf')](_0x0016('0x10'),_0x260869,_0x0016('0xe'),JSON['stringify'](_0x236d5d));if(_0x236d5d[_0x0016('0x11')]){if(_0x236d5d[_0x0016('0x11')][_0x0016('0x12')]===0x1f4){logger[_0x0016('0x11')](_0x0016('0x13'),_0x260869,_0x236d5d[_0x0016('0x11')]['message']);return _0x6221e6(_0x236d5d[_0x0016('0x11')][_0x0016('0x14')]);}logger[_0x0016('0x11')](_0x0016('0x13'),_0x260869,_0x236d5d[_0x0016('0x11')]['message']);return _0x2357b4(_0x236d5d[_0x0016('0x11')][_0x0016('0x14')]);}else{logger['info'](_0x0016('0x13'),_0x260869,_0x0016('0xe'));_0x2357b4(_0x236d5d['result']['message']);}})['catch'](function(_0x1d6c6c){logger[_0x0016('0x11')](_0x0016('0x13'),_0x260869,_0x1d6c6c);_0x6221e6(_0x1d6c6c);});});}exports[_0x0016('0x15')]=function(_0x1b616f){var _0xbddcf2=this;return new Promise(function(_0x4f04ce,_0x185a3b){return db['MemberReport'][_0x0016('0x16')]({'raw':_0x1b616f['options']?_0x1b616f['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b616f[_0x0016('0x17')]?_0x1b616f[_0x0016('0x17')][_0x0016('0x18')]||null:null,'attributes':_0x1b616f[_0x0016('0x17')]?_0x1b616f[_0x0016('0x17')][_0x0016('0x19')]||null:null,'limit':_0x1b616f[_0x0016('0x17')]?_0x1b616f['options'][_0x0016('0x1a')]||null:null,'include':_0x1b616f[_0x0016('0x17')]?_0x1b616f[_0x0016('0x17')][_0x0016('0x1b')]?_['map'](_0x1b616f[_0x0016('0x17')][_0x0016('0x1b')],function(_0x1d4fec){return{'model':db[_0x1d4fec[_0x0016('0x1c')]],'as':_0x1d4fec['as'],'attributes':_0x1d4fec['attributes'],'include':_0x1d4fec['include']?_['map'](_0x1d4fec[_0x0016('0x1b')],function(_0x577634){return{'model':db[_0x577634[_0x0016('0x1c')]],'as':_0x577634['as'],'attributes':_0x577634[_0x0016('0x19')],'include':_0x577634[_0x0016('0x1b')]?_[_0x0016('0x1d')](_0x577634[_0x0016('0x1b')],function(_0x656ae7){return{'model':db[_0x656ae7[_0x0016('0x1c')]],'as':_0x656ae7['as'],'attributes':_0x656ae7[_0x0016('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0016('0xc')](function(_0x5980bf){logger['info'](_0x0016('0x15'),_0x1b616f);logger[_0x0016('0xf')](_0x0016('0x15'),_0x1b616f,JSON[_0x0016('0x1e')](_0x5980bf));_0x4f04ce(_0x5980bf);})[_0x0016('0x1f')](function(_0x2534af){logger[_0x0016('0x11')](_0x0016('0x15'),_0x2534af[_0x0016('0x14')],_0x1b616f);_0x185a3b(_0xbddcf2[_0x0016('0x11')](0x1f4,_0x2534af['message']));});});};exports[_0x0016('0x20')]=function(_0x306d1e){var _0x4cdfc4=this;return new Promise(function(_0x30948b,_0x45c2bc){return db['MemberReport'][_0x0016('0x21')](_0x306d1e[_0x0016('0x22')],{'raw':_0x306d1e[_0x0016('0x17')]?_0x306d1e[_0x0016('0x17')][_0x0016('0x23')]===undefined?!![]:![]:!![]})[_0x0016('0xc')](function(_0x5632b5){logger[_0x0016('0xd')]('CreateMemberReport',_0x306d1e);logger[_0x0016('0xf')]('CreateMemberReport',_0x306d1e,JSON[_0x0016('0x1e')](_0x5632b5));_0x30948b(_0x5632b5);})[_0x0016('0x1f')](function(_0x3b2018){logger[_0x0016('0x11')](_0x0016('0x20'),_0x3b2018['message'],_0x306d1e);_0x45c2bc(_0x4cdfc4[_0x0016('0x11')](0x1f4,_0x3b2018[_0x0016('0x14')]));});});};exports[_0x0016('0x24')]=function(_0x16bb23){var _0x36c792=this;return new Promise(function(_0x4a15ba,_0x2809d9){return db[_0x0016('0x25')][_0x0016('0x26')](_0x16bb23[_0x0016('0x22')],{'raw':_0x16bb23[_0x0016('0x17')]?_0x16bb23[_0x0016('0x17')][_0x0016('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16bb23[_0x0016('0x17')]?_0x16bb23[_0x0016('0x17')][_0x0016('0x18')]||null:null,'attributes':_0x16bb23[_0x0016('0x17')]?_0x16bb23['options'][_0x0016('0x19')]||null:null,'limit':_0x16bb23['options']?_0x16bb23[_0x0016('0x17')][_0x0016('0x1a')]||null:null})[_0x0016('0xc')](function(_0x39b46b){logger[_0x0016('0xd')](_0x0016('0x24'),_0x16bb23);logger[_0x0016('0xf')]('UpdateMemberReport',_0x16bb23,JSON[_0x0016('0x1e')](_0x39b46b));_0x4a15ba(_0x39b46b);})[_0x0016('0x1f')](function(_0x59a7f3){logger[_0x0016('0x11')](_0x0016('0x24'),_0x59a7f3[_0x0016('0x14')],_0x16bb23);_0x2809d9(_0x36c792['error'](0x1f4,_0x59a7f3['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 881c67c..0bfed82 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 _0x3c81=['index','exports','multer','util','connect-timeout','express','./migration.controller','get'];(function(_0xb34b55,_0x3c576a){var _0x48ef0e=function(_0x4fd5b5){while(--_0x4fd5b5){_0xb34b55['push'](_0xb34b55['shift']());}};_0x48ef0e(++_0x3c576a);}(_0x3c81,0x102));var _0x13c8=function(_0xa58432,_0x2e266e){_0xa58432=_0xa58432-0x0;var _0xeb10eb=_0x3c81[_0xa58432];return _0xeb10eb;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x13c8('0x4'));router[_0x13c8('0x5')]('/',controller[_0x13c8('0x6')]);module[_0x13c8('0x7')]=router; \ No newline at end of file +var _0x2e54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','multer','connect-timeout','express'];(function(_0x38323b,_0x5f79df){var _0x2b9af5=function(_0x576caa){while(--_0x576caa){_0x38323b['push'](_0x38323b['shift']());}};_0x2b9af5(++_0x5f79df);}(_0x2e54,0x1dd));var _0x42e5=function(_0x10ae4d,_0x574bc1){_0x10ae4d=_0x10ae4d-0x0;var _0x19c8b1=_0x2e54[_0x10ae4d];return _0x19c8b1;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var auth=require(_0x42e5('0x4'));var interaction=require(_0x42e5('0x5'));var config=require(_0x42e5('0x6'));var controller=require(_0x42e5('0x7'));router['get']('/',controller[_0x42e5('0x8')]);module[_0x42e5('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 a3bc617..7661d7e 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 _0x1956=['STRING','version','sequelize','exports'];(function(_0x5e7b6c,_0x4916d0){var _0x3afdbd=function(_0x648ee6){while(--_0x648ee6){_0x5e7b6c['push'](_0x5e7b6c['shift']());}};_0x3afdbd(++_0x4916d0);}(_0x1956,0xae));var _0x6195=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0x1956[_0x152121];return _0x592a85;};'use strict';var Sequelize=require(_0x6195('0x0'));module[_0x6195('0x1')]={'version':{'type':Sequelize[_0x6195('0x2')],'unique':_0x6195('0x3')}}; \ No newline at end of file +var _0x9c37=['sequelize','version'];(function(_0x3b4493,_0x106e71){var _0x28fc72=function(_0x1c6ec5){while(--_0x1c6ec5){_0x3b4493['push'](_0x3b4493['shift']());}};_0x28fc72(++_0x106e71);}(_0x9c37,0x166));var _0x79c3=function(_0xb273e5,_0x5d0762){_0xb273e5=_0xb273e5-0x0;var _0x5a18f6=_0x9c37[_0xb273e5];return _0x5a18f6;};'use strict';var Sequelize=require(_0x79c3('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x79c3('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index ee9310e..576d829 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 _0x008c=['../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','destroy','then','name','send','index','map','Migration','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x2ca171,_0x5e45e8){var _0x1d5d28=function(_0x2525d8){while(--_0x2525d8){_0x2ca171['push'](_0x2ca171['shift']());}};_0x1d5d28(++_0x5e45e8);}(_0x008c,0x188));var _0xc008=function(_0x4a5fa5,_0x51dadc){_0x4a5fa5=_0x4a5fa5-0x0;var _0x241266=_0x008c[_0x4a5fa5];return _0x241266;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];function respondWithStatusCode(_0x2a5b4e,_0x9ffa93){_0x9ffa93=_0x9ffa93||0xcc;return function(_0x1819c6){if(_0x1819c6){return _0x2a5b4e[_0xc008('0x17')](_0x9ffa93);}return _0x2a5b4e['status'](_0x9ffa93)['end']();};}function respondWithResult(_0x33f44c,_0x50c1ab){_0x50c1ab=_0x50c1ab||0xc8;return function(_0x25e13f){if(_0x25e13f){return _0x33f44c[_0xc008('0x18')](_0x50c1ab)[_0xc008('0x19')](_0x25e13f);}};}function respondWithFilteredResult(_0x339ffc,_0x3f0ecf){return function(_0x5ee00b){if(_0x5ee00b){var _0x5e894e=_0x5ee00b[_0xc008('0x1a')],_0x4bd0f4=_0x3f0ecf[_0xc008('0x1b')],_0x11ef38=_0x3f0ecf['offset']+_0x3f0ecf['limit'],_0x15a6ad;if(_0x11ef38>=_0x5e894e){_0x11ef38=_0x5e894e;_0x15a6ad=0xc8;}else{_0x15a6ad=0xce;}_0x339ffc['status'](_0x15a6ad);return _0x339ffc['set'](_0xc008('0x1c'),_0x4bd0f4+'-'+_0x11ef38+'/'+_0x5e894e)[_0xc008('0x19')](_0x5ee00b);}return null;};}function patchUpdates(_0x501137){return function(_0x813397){try{jsonpatch['apply'](_0x813397,_0x501137,!![]);}catch(_0x4bd611){return BPromise['reject'](_0x4bd611);}return _0x813397['save']();};}function saveUpdates(_0x5754a0,_0x4b9726){return function(_0x5560b1){if(_0x5560b1){return _0x5560b1['update'](_0x5754a0)['then'](function(_0x5a58bd){return _0x5a58bd;});}return null;};}function removeEntity(_0x13a263,_0x4777a6){return function(_0x251db2){if(_0x251db2){return _0x251db2[_0xc008('0x1d')]()[_0xc008('0x1e')](function(){_0x13a263[_0xc008('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(!_0x58a6ea){_0x459fd9[_0xc008('0x17')](0x194);}return _0x58a6ea;};}function handleError(_0x36f358,_0x2e3cfb){_0x2e3cfb=_0x2e3cfb||0x1f4;return function(_0x3cb28c){logger['error'](_0x3cb28c['stack']);if(_0x3cb28c['name']){delete _0x3cb28c[_0xc008('0x1f')];}_0x36f358[_0xc008('0x18')](_0x2e3cfb)[_0xc008('0x20')](_0x3cb28c);};}exports[_0xc008('0x21')]=function(_0x5bebd9,_0x5e2aca){var _0x4fce9c={},_0x4adbab={},_0x4caaf4={'count':0x0,'rows':[]};var _0x3865c0=_[_0xc008('0x22')](db[_0xc008('0x23')]['rawAttributes'],function(_0x24c14c){return{'name':_0x24c14c[_0xc008('0x24')],'type':_0x24c14c[_0xc008('0x25')][_0xc008('0x26')]};});_0x4adbab['model']=_[_0xc008('0x22')](_0x3865c0,_0xc008('0x1f'));_0x4adbab['query']=_['keys'](_0x5bebd9['query']);_0x4adbab[_0xc008('0x27')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],_0x4adbab[_0xc008('0x2a')]);_0x4fce9c[_0xc008('0x2b')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2c')]));_0x4fce9c[_0xc008('0x2b')]=_0x4fce9c[_0xc008('0x2b')]['length']?_0x4fce9c[_0xc008('0x2b')]:_0x4adbab[_0xc008('0x29')];if(!_0x5bebd9['query'][_0xc008('0x2d')](_0xc008('0x2e'))){_0x4fce9c[_0xc008('0x2f')]=qs[_0xc008('0x2f')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2f')]);_0x4fce9c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x5bebd9[_0xc008('0x2a')]['offset']);}_0x4fce9c[_0xc008('0x30')]=qs[_0xc008('0x31')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x31')]);_0x4fce9c[_0xc008('0x32')]=qs[_0xc008('0x27')](_[_0xc008('0x33')](_0x5bebd9['query'],_0x4adbab[_0xc008('0x27')]),_0x3865c0);if(_0x5bebd9[_0xc008('0x2a')]['filter']){_0x4fce9c[_0xc008('0x32')]=_[_0xc008('0x34')](_0x4fce9c['where'],{'$or':_[_0xc008('0x22')](_0x3865c0,function(_0x2e4ae1){if(_0x2e4ae1[_0xc008('0x25')]!=='VIRTUAL'){var _0x53b353={};_0x53b353[_0x2e4ae1['name']]={'$like':'%'+_0x5bebd9[_0xc008('0x2a')]['filter']+'%'};return _0x53b353;}})});}_0x4fce9c=_[_0xc008('0x34')]({},_0x4fce9c,_0x5bebd9[_0xc008('0x35')]);var _0x6a4ccb={'where':_0x4fce9c[_0xc008('0x32')]};return db[_0xc008('0x23')][_0xc008('0x1a')](_0x6a4ccb)[_0xc008('0x1e')](function(_0x35b496){_0x4caaf4[_0xc008('0x1a')]=_0x35b496;if(_0x5bebd9[_0xc008('0x2a')][_0xc008('0x36')]){_0x4fce9c[_0xc008('0x37')]=[{'all':!![]}];}return db[_0xc008('0x23')][_0xc008('0x38')](_0x4fce9c);})['then'](function(_0x3238b4){_0x4caaf4[_0xc008('0x39')]=_0x3238b4;return _0x4caaf4;})[_0xc008('0x1e')](respondWithFilteredResult(_0x5e2aca,_0x4fce9c))[_0xc008('0x3a')](handleError(_0x5e2aca,null));}; \ No newline at end of file +var _0xa9e0=['save','update','then','destroy','end','error','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','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'];(function(_0x481299,_0x43b7a1){var _0x380b8a=function(_0x21ca80){while(--_0x21ca80){_0x481299['push'](_0x481299['shift']());}};_0x380b8a(++_0x43b7a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 8430e30..90f96cd 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 _0xa4db=['define','Migration','migrations','api','moment','bluebird','request-promise','path','rimraf','./migration.attributes'];(function(_0x20b6d2,_0x541df9){var _0x3e35ca=function(_0x47fa83){while(--_0x47fa83){_0x20b6d2['push'](_0x20b6d2['shift']());}};_0x3e35ca(++_0x541df9);}(_0xa4db,0x139));var _0xba4d=function(_0x41fe21,_0xb18e78){_0x41fe21=_0x41fe21-0x0;var _0x5de22d=_0xa4db[_0x41fe21];return _0x5de22d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xba4d('0x0'));var moment=require(_0xba4d('0x1'));var BPromise=require(_0xba4d('0x2'));var rp=require(_0xba4d('0x3'));var fs=require('fs');var path=require(_0xba4d('0x4'));var rimraf=require(_0xba4d('0x5'));var config=require('../../config/environment');var attributes=require(_0xba4d('0x6'));module['exports']=function(_0x1c798c,_0x1b1d52){return _0x1c798c[_0xba4d('0x7')](_0xba4d('0x8'),attributes,{'tableName':_0xba4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe600=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','api','moment','bluebird','request-promise','path'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xe600,0x159));var _0x0e60=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe600[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x0e60('0x0'));var logger=require('../../config/logger')(_0x0e60('0x1'));var moment=require(_0x0e60('0x2'));var BPromise=require(_0x0e60('0x3'));var rp=require(_0x0e60('0x4'));var fs=require('fs');var path=require(_0x0e60('0x5'));var rimraf=require(_0x0e60('0x6'));var config=require(_0x0e60('0x7'));var attributes=require(_0x0e60('0x8'));module[_0x0e60('0x9')]=function(_0x2f9c33,_0x4c5738){return _0x2f9c33[_0x0e60('0xa')](_0x0e60('0xb'),attributes,{'tableName':_0x0e60('0xc'),'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 2a8f307..8a9abbb 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 _0x72e7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0xd4dc46,_0x1f2867){var _0x316a4d=function(_0xdfd722){while(--_0xdfd722){_0xd4dc46['push'](_0xd4dc46['shift']());}};_0x316a4d(++_0x1f2867);}(_0x72e7,0x102));var _0x772e=function(_0x5da475,_0x29b99e){_0x5da475=_0x5da475-0x0;var _0x4257b3=_0x72e7[_0x5da475];return _0x4257b3;};'use strict';var _=require(_0x772e('0x0'));var util=require(_0x772e('0x1'));var moment=require(_0x772e('0x2'));var BPromise=require(_0x772e('0x3'));var rs=require(_0x772e('0x4'));var fs=require('fs');var Redis=require(_0x772e('0x5'));var db=require(_0x772e('0x6'))['db'];var utils=require(_0x772e('0x7'));var logger=require(_0x772e('0x8'))(_0x772e('0x9'));var config=require(_0x772e('0xa'));var jayson=require(_0x772e('0xb'));var client=jayson[_0x772e('0xc')][_0x772e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x164602,_0x3defeb,_0x53e18e){return new BPromise(function(_0x427a24,_0x366b1d){return client[_0x772e('0xe')](_0x164602,_0x53e18e)[_0x772e('0xf')](function(_0x1c2c38){logger['info'](_0x772e('0x10'),_0x3defeb,_0x772e('0x11'));logger['debug'](_0x772e('0x12'),_0x3defeb,_0x772e('0x11'),JSON[_0x772e('0x13')](_0x1c2c38));if(_0x1c2c38[_0x772e('0x14')]){if(_0x1c2c38[_0x772e('0x14')][_0x772e('0x15')]===0x1f4){logger[_0x772e('0x14')](_0x772e('0x10'),_0x3defeb,_0x1c2c38[_0x772e('0x14')][_0x772e('0x16')]);return _0x366b1d(_0x1c2c38[_0x772e('0x14')]['message']);}logger[_0x772e('0x14')](_0x772e('0x10'),_0x3defeb,_0x1c2c38['error'][_0x772e('0x16')]);return _0x427a24(_0x1c2c38[_0x772e('0x14')]['message']);}else{logger[_0x772e('0x17')](_0x772e('0x10'),_0x3defeb,_0x772e('0x11'));_0x427a24(_0x1c2c38[_0x772e('0x18')][_0x772e('0x16')]);}})[_0x772e('0x19')](function(_0x2db24c){logger[_0x772e('0x14')](_0x772e('0x10'),_0x3defeb,_0x2db24c);_0x366b1d(_0x2db24c);});});} \ No newline at end of file +var _0x87d9=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x362fdf,_0x5bc6a8){var _0x458388=function(_0x8a6fe7){while(--_0x8a6fe7){_0x362fdf['push'](_0x362fdf['shift']());}};_0x458388(++_0x5bc6a8);}(_0x87d9,0x143));var _0x987d=function(_0x25de09,_0x96ed5a){_0x25de09=_0x25de09-0x0;var _0x3eda1e=_0x87d9[_0x25de09];return _0x3eda1e;};'use strict';var _=require(_0x987d('0x0'));var util=require('util');var moment=require(_0x987d('0x1'));var BPromise=require(_0x987d('0x2'));var rs=require(_0x987d('0x3'));var fs=require('fs');var Redis=require(_0x987d('0x4'));var db=require(_0x987d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x987d('0x6'))('rpc');var config=require(_0x987d('0x7'));var jayson=require(_0x987d('0x8'));var client=jayson['client'][_0x987d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ee510,_0x5bf349,_0x11d89e){return new BPromise(function(_0x1f97b6,_0x444273){return client[_0x987d('0xa')](_0x3ee510,_0x11d89e)[_0x987d('0xb')](function(_0x325c8b){logger[_0x987d('0xc')]('Migration,\x20%s,\x20%s',_0x5bf349,_0x987d('0xd'));logger[_0x987d('0xe')](_0x987d('0xf'),_0x5bf349,_0x987d('0xd'),JSON['stringify'](_0x325c8b));if(_0x325c8b[_0x987d('0x10')]){if(_0x325c8b[_0x987d('0x10')][_0x987d('0x11')]===0x1f4){logger[_0x987d('0x10')](_0x987d('0x12'),_0x5bf349,_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);return _0x444273(_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);}logger['error']('Migration,\x20%s,\x20%s',_0x5bf349,_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);return _0x1f97b6(_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);}else{logger[_0x987d('0xc')](_0x987d('0x12'),_0x5bf349,_0x987d('0xd'));_0x1f97b6(_0x325c8b[_0x987d('0x14')][_0x987d('0x13')]);}})[_0x987d('0x15')](function(_0x197e46){logger[_0x987d('0x10')](_0x987d('0x12'),_0x5bf349,_0x197e46);_0x444273(_0x197e46);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 0cfcdcd..bcf6a9f 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 _0xa5d5=['isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get'];(function(_0x2f92d8,_0x2ef7f4){var _0x200ef1=function(_0x24f52e){while(--_0x24f52e){_0x2f92d8['push'](_0x2f92d8['shift']());}};_0x200ef1(++_0x2ef7f4);}(_0xa5d5,0x100));var _0x5a5d=function(_0x5ea1b7,_0x4c935c){_0x5ea1b7=_0x5ea1b7-0x0;var _0x2f9b54=_0xa5d5[_0x5ea1b7];return _0x2f9b54;};'use strict';var multer=require(_0x5a5d('0x0'));var util=require(_0x5a5d('0x1'));var path=require(_0x5a5d('0x2'));var timeout=require(_0x5a5d('0x3'));var express=require('express');var router=express[_0x5a5d('0x4')]();var auth=require(_0x5a5d('0x5'));var interaction=require(_0x5a5d('0x6'));var config=require(_0x5a5d('0x7'));var controller=require(_0x5a5d('0x8'));router[_0x5a5d('0x9')]('/',auth[_0x5a5d('0xa')](),controller[_0x5a5d('0xb')]);router['get'](_0x5a5d('0xc'),auth[_0x5a5d('0xa')](),controller['show']);router[_0x5a5d('0xd')]('/',auth[_0x5a5d('0xa')](),controller[_0x5a5d('0xe')]);router['put'](_0x5a5d('0xc'),auth[_0x5a5d('0xa')](),controller[_0x5a5d('0xf')]);router[_0x5a5d('0x10')](_0x5a5d('0xc'),auth[_0x5a5d('0xa')](),controller[_0x5a5d('0x11')]);module[_0x5a5d('0x12')]=router; \ No newline at end of file +var _0xbedb=['destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','update'];(function(_0x55edaf,_0x4e1845){var _0x22d47b=function(_0x5a9cc0){while(--_0x5a9cc0){_0x55edaf['push'](_0x55edaf['shift']());}};_0x22d47b(++_0x4e1845);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbbed('0x0'));var util=require('util');var path=require(_0xbbed('0x1'));var timeout=require(_0xbbed('0x2'));var express=require(_0xbbed('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbbed('0x4'));var config=require(_0xbbed('0x5'));var controller=require(_0xbbed('0x6'));router[_0xbbed('0x7')]('/',auth[_0xbbed('0x8')](),controller[_0xbbed('0x9')]);router[_0xbbed('0x7')](_0xbbed('0xa'),auth[_0xbbed('0x8')](),controller[_0xbbed('0xb')]);router['post']('/',auth[_0xbbed('0x8')](),controller['create']);router['put'](_0xbbed('0xa'),auth[_0xbbed('0x8')](),controller[_0xbbed('0xc')]);router['delete']('/:id',auth[_0xbbed('0x8')](),controller[_0xbbed('0xd')]);module[_0xbbed('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index fe03025..df6eb05 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(_0x32a9e2,_0x520e67){var _0xc8f45a=function(_0x527463){while(--_0x527463){_0x32a9e2['push'](_0x32a9e2['shift']());}};_0xc8f45a(++_0x520e67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x1faf5c,_0x413b3f){var _0x52d857=function(_0x2753a4){while(--_0x2753a4){_0x1faf5c['push'](_0x1faf5c['shift']());}};_0x52d857(++_0x413b3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 b0871c5..a4c3294 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 _0xc200=['request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','length','include','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','root','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','TURN','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','destroy','server/files/templates/network.ejs','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Network,\x20%s,\x20%s'];(function(_0x25b2f3,_0x5edc9b){var _0x59eb14=function(_0x491e10){while(--_0x491e10){_0x25b2f3['push'](_0x25b2f3['shift']());}};_0x59eb14(++_0x5edc9b);}(_0xc200,0x19e));var _0x0c20=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xc200[_0x1beef3];return _0x5af964;};'use strict';var pdf=require(_0x0c20('0x0'));var emlformat=require(_0x0c20('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0c20('0x2'));var jsonpatch=require(_0x0c20('0x3'));var rp=require(_0x0c20('0x4'));var moment=require(_0x0c20('0x5'));var BPromise=require(_0x0c20('0x6'));var Mustache=require(_0x0c20('0x7'));var util=require(_0x0c20('0x8'));var path=require('path');var sox=require(_0x0c20('0x9'));var csv=require('to-csv');var ejs=require(_0x0c20('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0c20('0xb'));var crypto=require(_0x0c20('0xc'));var jsforce=require(_0x0c20('0xd'));var deskjs=require(_0x0c20('0xe'));var toCsv=require(_0x0c20('0xf'));var querystring=require(_0x0c20('0x10'));var Papa=require(_0x0c20('0x11'));var Redis=require(_0x0c20('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0c20('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c20('0x14'))(_0x0c20('0x15'));var utils=require(_0x0c20('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x0c20('0x17'));var client=jayson[_0x0c20('0x18')][_0x0c20('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2c796e,_0x9bdcb2,_0x2a034c){if(_0x2a034c){var _0x2e7812=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e7812[_0x0c20('0x1a')](_0x9bdcb2)){return _0x2c796e;}else{throw new db[(_0x0c20('0x1b'))][(_0x0c20('0x1c'))](_0x0c20('0x1d'));}}else{return _0x2c796e;}}function respondWithRpcPromise(_0x13bc39,_0x1126c9,_0x4f507a,_0x5f2b1e){return new BPromise(function(_0x26e276,_0x484b72){var _0xfed14f=_0x5f2b1e||client;return _0xfed14f[_0x0c20('0x1e')](_0x13bc39,_0x4f507a)[_0x0c20('0x1f')](function(_0x37cb5f){logger[_0x0c20('0x20')](_0x0c20('0x21'),_0x1126c9,_0x0c20('0x22'));logger[_0x0c20('0x23')](_0x0c20('0x24'),_0x1126c9,_0x0c20('0x22'),JSON[_0x0c20('0x25')](_0x37cb5f));if(_0x37cb5f[_0x0c20('0x26')]){if(_0x37cb5f[_0x0c20('0x26')][_0x0c20('0x27')]===0x1f4){logger[_0x0c20('0x26')](_0x0c20('0x21'),_0x1126c9,_0x37cb5f[_0x0c20('0x26')]['message']);return _0x484b72(_0x37cb5f['error'][_0x0c20('0x28')]);}logger['error'](_0x0c20('0x21'),_0x1126c9,_0x37cb5f[_0x0c20('0x26')][_0x0c20('0x28')]);return _0x26e276(_0x37cb5f['error'][_0x0c20('0x28')]);}else{logger[_0x0c20('0x20')](_0x0c20('0x21'),_0x1126c9,_0x0c20('0x22'));_0x26e276(_0x37cb5f[_0x0c20('0x29')][_0x0c20('0x28')]);}})[_0x0c20('0x2a')](function(_0x1b2ecb){logger[_0x0c20('0x26')]('Network,\x20%s,\x20%s',_0x1126c9,_0x1b2ecb);_0x484b72(_0x1b2ecb);});});}function respondWithStatusCode(_0x33261a,_0x29f5c0){_0x29f5c0=_0x29f5c0||0xcc;return function(_0x3e1d9e){if(_0x3e1d9e){return _0x33261a[_0x0c20('0x2b')](_0x29f5c0);}return _0x33261a[_0x0c20('0x2c')](_0x29f5c0)[_0x0c20('0x2d')]();};}function respondWithResult(_0x50f057,_0x26656e){_0x26656e=_0x26656e||0xc8;return function(_0x35a427){if(_0x35a427){return _0x50f057['status'](_0x26656e)[_0x0c20('0x2e')](_0x35a427);}};}function respondWithFilteredResult(_0x5016f8,_0x9a5e96){return function(_0x454eae){if(_0x454eae){var _0x23b6a1=_0x454eae[_0x0c20('0x2f')],_0x30e6df=_0x9a5e96[_0x0c20('0x30')],_0x4e024f=_0x9a5e96[_0x0c20('0x30')]+_0x9a5e96[_0x0c20('0x31')],_0x5b3f51;if(_0x4e024f>=_0x23b6a1){_0x4e024f=_0x23b6a1;_0x5b3f51=0xc8;}else{_0x5b3f51=0xce;}_0x5016f8[_0x0c20('0x2c')](_0x5b3f51);return _0x5016f8[_0x0c20('0x32')](_0x0c20('0x33'),_0x30e6df+'-'+_0x4e024f+'/'+_0x23b6a1)[_0x0c20('0x2e')](_0x454eae);}return null;};}function patchUpdates(_0x2f416d){return function(_0x244083){try{jsonpatch[_0x0c20('0x34')](_0x244083,_0x2f416d,!![]);}catch(_0x15c980){return BPromise['reject'](_0x15c980);}return _0x244083[_0x0c20('0x35')]();};}function saveUpdates(_0x566720,_0x1ad8ee){return function(_0x4be59f){if(_0x4be59f){return _0x4be59f[_0x0c20('0x36')](_0x566720)['then'](function(_0x5dc6d2){return _0x5dc6d2;});}return null;};}function removeEntity(_0x2fddae,_0x468d61){return function(_0x316aaa){if(_0x316aaa){return _0x316aaa['destroy']()[_0x0c20('0x1f')](function(){_0x2fddae[_0x0c20('0x2c')](0xcc)[_0x0c20('0x2d')]();});}};}function handleEntityNotFound(_0x3935b4,_0x345f6a){return function(_0x10aaa1){if(!_0x10aaa1){_0x3935b4[_0x0c20('0x2b')](0x194);}return _0x10aaa1;};}function handleError(_0x4d923c,_0x33e2f3){_0x33e2f3=_0x33e2f3||0x1f4;return function(_0x5dd0f1){logger[_0x0c20('0x26')](_0x5dd0f1[_0x0c20('0x37')]);if(_0x5dd0f1['name']){delete _0x5dd0f1[_0x0c20('0x38')];}_0x4d923c['status'](_0x33e2f3)[_0x0c20('0x39')](_0x5dd0f1);};}exports[_0x0c20('0x3a')]=function(_0x451217,_0x457710){var _0x580b48={},_0x4963a0={},_0x1a323c={'count':0x0,'rows':[]};var _0x39bbd4=_[_0x0c20('0x3b')](db[_0x0c20('0x3c')][_0x0c20('0x3d')],function(_0x189a36){return{'name':_0x189a36[_0x0c20('0x3e')],'type':_0x189a36[_0x0c20('0x3f')][_0x0c20('0x40')]};});_0x4963a0['model']=_[_0x0c20('0x3b')](_0x39bbd4,_0x0c20('0x38'));_0x4963a0[_0x0c20('0x41')]=_['keys'](_0x451217[_0x0c20('0x41')]);_0x4963a0[_0x0c20('0x42')]=_['intersection'](_0x4963a0[_0x0c20('0x43')],_0x4963a0[_0x0c20('0x41')]);_0x580b48[_0x0c20('0x44')]=_[_0x0c20('0x45')](_0x4963a0[_0x0c20('0x43')],qs[_0x0c20('0x46')](_0x451217['query'][_0x0c20('0x46')]));_0x580b48[_0x0c20('0x44')]=_0x580b48[_0x0c20('0x44')]['length']?_0x580b48[_0x0c20('0x44')]:_0x4963a0[_0x0c20('0x43')];if(!_0x451217['query'][_0x0c20('0x47')](_0x0c20('0x48'))){_0x580b48['limit']=qs['limit'](_0x451217['query']['limit']);_0x580b48[_0x0c20('0x30')]=qs[_0x0c20('0x30')](_0x451217[_0x0c20('0x41')][_0x0c20('0x30')]);}_0x580b48['order']=qs[_0x0c20('0x49')](_0x451217[_0x0c20('0x41')][_0x0c20('0x49')]);_0x580b48[_0x0c20('0x4a')]=qs[_0x0c20('0x42')](_['pick'](_0x451217[_0x0c20('0x41')],_0x4963a0[_0x0c20('0x42')]),_0x39bbd4);if(_0x451217['query'][_0x0c20('0x4b')]){_0x580b48[_0x0c20('0x4a')]=_[_0x0c20('0x4c')](_0x580b48['where'],{'$or':_[_0x0c20('0x3b')](_0x39bbd4,function(_0x40f11c){if(_0x40f11c[_0x0c20('0x3f')]!==_0x0c20('0x4d')){var _0x54ad89={};_0x54ad89[_0x40f11c[_0x0c20('0x38')]]={'$like':'%'+_0x451217[_0x0c20('0x41')][_0x0c20('0x4b')]+'%'};return _0x54ad89;}})});}_0x580b48=_['merge']({},_0x580b48,_0x451217[_0x0c20('0x4e')]);var _0x776321={'where':_0x580b48[_0x0c20('0x4a')]};return db[_0x0c20('0x3c')][_0x0c20('0x2f')](_0x776321)[_0x0c20('0x1f')](function(_0x262e73){_0x1a323c['count']=_0x262e73;if(_0x451217['query'][_0x0c20('0x4f')]){_0x580b48['include']=[{'all':!![]}];}return db['Network'][_0x0c20('0x50')](_0x580b48);})[_0x0c20('0x1f')](function(_0x377fda){_0x1a323c['rows']=_0x377fda;return _0x1a323c;})[_0x0c20('0x1f')](respondWithFilteredResult(_0x457710,_0x580b48))[_0x0c20('0x2a')](handleError(_0x457710,null));};exports[_0x0c20('0x51')]=function(_0x19ab8c,_0x4dd77c){var _0x3f7570={'raw':!![],'where':{'id':_0x19ab8c[_0x0c20('0x52')]['id']}},_0xf54b9={};_0xf54b9['model']=_['keys'](db[_0x0c20('0x3c')]['rawAttributes']);_0xf54b9[_0x0c20('0x41')]=_[_0x0c20('0x53')](_0x19ab8c[_0x0c20('0x41')]);_0xf54b9[_0x0c20('0x42')]=_[_0x0c20('0x45')](_0xf54b9[_0x0c20('0x43')],_0xf54b9['query']);_0x3f7570[_0x0c20('0x44')]=_[_0x0c20('0x45')](_0xf54b9[_0x0c20('0x43')],qs[_0x0c20('0x46')](_0x19ab8c[_0x0c20('0x41')][_0x0c20('0x46')]));_0x3f7570[_0x0c20('0x44')]=_0x3f7570['attributes'][_0x0c20('0x54')]?_0x3f7570['attributes']:_0xf54b9[_0x0c20('0x43')];if(_0x19ab8c['query'][_0x0c20('0x4f')]){_0x3f7570[_0x0c20('0x55')]=[{'all':!![]}];}_0x3f7570=_['merge']({},_0x3f7570,_0x19ab8c[_0x0c20('0x4e')]);return db['Network'][_0x0c20('0x56')](_0x3f7570)[_0x0c20('0x1f')](handleEntityNotFound(_0x4dd77c,null))['then'](respondWithResult(_0x4dd77c,null))[_0x0c20('0x2a')](handleError(_0x4dd77c,null));};exports[_0x0c20('0x57')]=function(_0x34b843,_0x7895af,_0x161588){var _0x5c6a87;return db[_0x0c20('0x58')][_0x0c20('0x59')](function(_0x5555c0){return db['Network']['create'](_0x34b843[_0x0c20('0x5a')],{'raw':!![]})[_0x0c20('0x1f')](function(_0x7d189a){_0x5c6a87=_0x7d189a;return db[_0x0c20('0x3c')][_0x0c20('0x50')]({'where':{'type':_0x34b843['body'][_0x0c20('0x3f')]},'raw':!![]});})[_0x0c20('0x1f')](function(_0x40c880){if(_0x5c6a87[_0x0c20('0x3f')][_0x0c20('0x5b')]()==_0x0c20('0x5c')){var _0x2f0c2c=fs[_0x0c20('0x5d')](path[_0x0c20('0x5e')](config['root'],_0x0c20('0x5f')),_0x0c20('0x60'));var _0x500ecb=ejs[_0x0c20('0x61')](_0x2f0c2c,{'networks':_0x40c880||[]});fs['writeFileSync'](_0x0c20('0x62'),_0x500ecb);return respondWithRpcPromise(_0x0c20('0x63'),_0x0c20('0x57'),{'module':_0x0c20('0x64')});}else if(_0x5c6a87['type']['toUpperCase']()=='TURN'){var _0x3a2a9e=fs[_0x0c20('0x5d')](path['join'](config[_0x0c20('0x65')],_0x0c20('0x66')),_0x0c20('0x60'));var _0xf0950b=ejs[_0x0c20('0x61')](_0x3a2a9e,{'networks':_0x40c880||[]});fs[_0x0c20('0x67')](_0x0c20('0x68'),_0xf0950b);return respondWithRpcPromise('Reload',_0x0c20('0x57'),{'module':_0x0c20('0x64')});}else{var _0x2aa52=fs['readFileSync'](path[_0x0c20('0x5e')](config['root'],'server/files/templates/network.ejs'),_0x0c20('0x60'));var _0x21c5fe=ejs[_0x0c20('0x61')](_0x2aa52,{'networks':_0x40c880||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x34b843['body'][_0x0c20('0x3f')]['toLowerCase']()),_0x21c5fe);return respondWithRpcPromise(_0x0c20('0x63'),_0x0c20('0x57'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x5c6a87;});})[_0x0c20('0x1f')](respondWithResult(_0x7895af,0xc9))['catch'](handleError(_0x7895af,null));};exports[_0x0c20('0x36')]=function(_0x1a65bb,_0x303baa,_0x5d2c69){var _0x27db98;return db[_0x0c20('0x58')][_0x0c20('0x59')](function(_0x4d5b06){return db[_0x0c20('0x3c')][_0x0c20('0x56')]({'where':{'id':_0x1a65bb[_0x0c20('0x52')]['id']}})['then'](handleEntityNotFound(_0x303baa,null))[_0x0c20('0x1f')](saveUpdates(_0x1a65bb[_0x0c20('0x5a')],null))[_0x0c20('0x1f')](function(_0x22bc4b){if(_0x22bc4b){_0x27db98=_0x22bc4b;return db['Network'][_0x0c20('0x50')]({'where':{'type':_0x27db98[_0x0c20('0x3f')]},'raw':!![]});}return null;})[_0x0c20('0x1f')](function(_0x8e29b2){if(_0x27db98[_0x0c20('0x3f')]['toUpperCase']()=='STUN'){var _0xc1dbee=fs[_0x0c20('0x5d')](path['join'](config[_0x0c20('0x65')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x257050=ejs[_0x0c20('0x61')](_0xc1dbee,{'networks':_0x8e29b2||[]});fs[_0x0c20('0x67')](_0x0c20('0x62'),_0x257050);return respondWithRpcPromise('Reload','update',{'module':_0x0c20('0x64')});}else if(_0x27db98[_0x0c20('0x3f')][_0x0c20('0x5b')]()==_0x0c20('0x69')){var _0x238078=fs[_0x0c20('0x5d')](path[_0x0c20('0x5e')](config[_0x0c20('0x65')],_0x0c20('0x66')),_0x0c20('0x60'));var _0xcffb4d=ejs['render'](_0x238078,{'networks':_0x8e29b2||[]});fs[_0x0c20('0x67')](_0x0c20('0x68'),_0xcffb4d);return respondWithRpcPromise(_0x0c20('0x63'),_0x0c20('0x36'),{'module':'res_stun_monitor.so'});}else{var _0x9b299c=fs[_0x0c20('0x5d')](path[_0x0c20('0x5e')](config['root'],'server/files/templates/network.ejs'),_0x0c20('0x60'));var _0x3c5998=ejs[_0x0c20('0x61')](_0x9b299c,{'networks':_0x8e29b2||[]});fs[_0x0c20('0x67')](util[_0x0c20('0x6a')](_0x0c20('0x6b'),_0x1a65bb[_0x0c20('0x5a')][_0x0c20('0x3f')][_0x0c20('0x6c')]()),_0x3c5998);return respondWithRpcPromise(_0x0c20('0x63'),_0x0c20('0x36'),{'module':_0x0c20('0x6d')});}return null;})['then'](function(_0x52d7ad){if(_0x52d7ad){return _0x27db98;}return null;});})['then'](respondWithResult(_0x303baa,null))[_0x0c20('0x2a')](handleError(_0x303baa,null));};exports[_0x0c20('0x6e')]=function(_0x22c422,_0x316ff8,_0x484e9d){var _0x43a984;return db[_0x0c20('0x3c')][_0x0c20('0x56')]({'where':{'id':_0x22c422[_0x0c20('0x52')]['id']}})['then'](function(_0x4e31b4){_0x43a984=_0x4e31b4;return _0x4e31b4;})[_0x0c20('0x1f')](handleEntityNotFound(_0x316ff8,null))[_0x0c20('0x1f')](removeEntity(_0x316ff8,null))['then'](function(){if(_0x43a984){return db['Network'][_0x0c20('0x50')]({'where':{'type':_0x43a984['type']},'raw':!![]});}})[_0x0c20('0x1f')](function(_0x7d8b4a){if(_0x43a984[_0x0c20('0x3f')][_0x0c20('0x5b')]()=='STUN'){var _0xdd75cc=fs[_0x0c20('0x5d')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x549741=ejs['render'](_0xdd75cc,{'networks':_0x7d8b4a||[]});fs[_0x0c20('0x67')](_0x0c20('0x62'),_0x549741);return respondWithRpcPromise(_0x0c20('0x63'),_0x0c20('0x6e'),{'module':_0x0c20('0x64')});}else if(_0x43a984[_0x0c20('0x3f')]['toUpperCase']()==_0x0c20('0x69')){var _0x5438ae=fs[_0x0c20('0x5d')](path[_0x0c20('0x5e')](config[_0x0c20('0x65')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x3c59cd=ejs[_0x0c20('0x61')](_0x5438ae,{'networks':_0x7d8b4a||[]});fs[_0x0c20('0x67')](_0x0c20('0x68'),_0x3c59cd);return respondWithRpcPromise(_0x0c20('0x63'),_0x0c20('0x6e'),{'module':_0x0c20('0x64')});}else{var _0x28710b=fs['readFileSync'](path[_0x0c20('0x5e')](config[_0x0c20('0x65')],_0x0c20('0x6f')),_0x0c20('0x60'));var _0x2c01dd=ejs[_0x0c20('0x61')](_0x28710b,{'networks':_0x7d8b4a||[]});fs[_0x0c20('0x67')](util[_0x0c20('0x6a')](_0x0c20('0x6b'),_0x22c422[_0x0c20('0x5a')]['type'][_0x0c20('0x6c')]()),_0x2c01dd);return respondWithRpcPromise('Reload',_0x0c20('0x6e'),{'module':'chan_sip.so'});}return null;})[_0x0c20('0x2a')](handleError(_0x316ff8,null));}; \ No newline at end of file +var _0x59dc=['limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','Network','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','toUpperCase','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','body','toLowerCase','chan_sip.so','transaction','STUN','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/utils','../../config/environment','../../mysqldb','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','json','count','offset'];(function(_0x37a822,_0x280ed8){var _0x17c56b=function(_0x34ef76){while(--_0x34ef76){_0x37a822['push'](_0x37a822['shift']());}};_0x17c56b(++_0x280ed8);}(_0x59dc,0x11b));var _0xc59d=function(_0x10a054,_0x4f1e1f){_0x10a054=_0x10a054-0x0;var _0x13f602=_0x59dc[_0x10a054];return _0x13f602;};'use strict';var pdf=require(_0xc59d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc59d('0x1'));var zipdir=require(_0xc59d('0x2'));var jsonpatch=require(_0xc59d('0x3'));var rp=require(_0xc59d('0x4'));var moment=require(_0xc59d('0x5'));var BPromise=require(_0xc59d('0x6'));var Mustache=require(_0xc59d('0x7'));var util=require(_0xc59d('0x8'));var path=require(_0xc59d('0x9'));var sox=require(_0xc59d('0xa'));var csv=require(_0xc59d('0xb'));var ejs=require(_0xc59d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc59d('0xd'));var jsforce=require(_0xc59d('0xe'));var deskjs=require(_0xc59d('0xf'));var toCsv=require(_0xc59d('0xb'));var querystring=require(_0xc59d('0x10'));var Papa=require(_0xc59d('0x11'));var Redis=require(_0xc59d('0x12'));var authService=require(_0xc59d('0x13'));var qs=require(_0xc59d('0x14'));var as=require(_0xc59d('0x15'));var hardwareService=require(_0xc59d('0x16'));var logger=require(_0xc59d('0x17'))('api');var utils=require(_0xc59d('0x18'));var config=require(_0xc59d('0x19'));var db=require(_0xc59d('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc59d('0x1b')][_0xc59d('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x49f99f,_0x3c0163,_0x291df6){if(_0x291df6){var _0x3912bd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3912bd[_0xc59d('0x1d')](_0x3c0163)){return _0x49f99f;}else{throw new db['Sequelize']['ValidationError'](_0xc59d('0x1e'));}}else{return _0x49f99f;}}function respondWithRpcPromise(_0x4e519a,_0x38fa96,_0x2c2a98,_0x24808a){return new BPromise(function(_0x13d3a3,_0x7fc570){var _0x32de35=_0x24808a||client;return _0x32de35['request'](_0x4e519a,_0x2c2a98)['then'](function(_0x26d8f2){logger[_0xc59d('0x1f')](_0xc59d('0x20'),_0x38fa96,_0xc59d('0x21'));logger[_0xc59d('0x22')](_0xc59d('0x23'),_0x38fa96,_0xc59d('0x21'),JSON['stringify'](_0x26d8f2));if(_0x26d8f2[_0xc59d('0x24')]){if(_0x26d8f2[_0xc59d('0x24')]['code']===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x38fa96,_0x26d8f2['error'][_0xc59d('0x25')]);return _0x7fc570(_0x26d8f2[_0xc59d('0x24')]['message']);}logger[_0xc59d('0x24')](_0xc59d('0x20'),_0x38fa96,_0x26d8f2[_0xc59d('0x24')][_0xc59d('0x25')]);return _0x13d3a3(_0x26d8f2[_0xc59d('0x24')][_0xc59d('0x25')]);}else{logger[_0xc59d('0x1f')](_0xc59d('0x20'),_0x38fa96,_0xc59d('0x21'));_0x13d3a3(_0x26d8f2['result']['message']);}})[_0xc59d('0x26')](function(_0x20b297){logger[_0xc59d('0x24')](_0xc59d('0x20'),_0x38fa96,_0x20b297);_0x7fc570(_0x20b297);});});}function respondWithStatusCode(_0xa6725f,_0x3b1d8d){_0x3b1d8d=_0x3b1d8d||0xcc;return function(_0xb61a0a){if(_0xb61a0a){return _0xa6725f[_0xc59d('0x27')](_0x3b1d8d);}return _0xa6725f[_0xc59d('0x28')](_0x3b1d8d)['end']();};}function respondWithResult(_0x5e1443,_0x41d466){_0x41d466=_0x41d466||0xc8;return function(_0x5e4a74){if(_0x5e4a74){return _0x5e1443[_0xc59d('0x28')](_0x41d466)[_0xc59d('0x29')](_0x5e4a74);}};}function respondWithFilteredResult(_0x4b2058,_0x38d4ae){return function(_0x2d58f0){if(_0x2d58f0){var _0x24ecb5=_0x2d58f0[_0xc59d('0x2a')],_0x5cbaa0=_0x38d4ae['offset'],_0x1a18d9=_0x38d4ae[_0xc59d('0x2b')]+_0x38d4ae[_0xc59d('0x2c')],_0x2d8d9b;if(_0x1a18d9>=_0x24ecb5){_0x1a18d9=_0x24ecb5;_0x2d8d9b=0xc8;}else{_0x2d8d9b=0xce;}_0x4b2058['status'](_0x2d8d9b);return _0x4b2058[_0xc59d('0x2d')](_0xc59d('0x2e'),_0x5cbaa0+'-'+_0x1a18d9+'/'+_0x24ecb5)['json'](_0x2d58f0);}return null;};}function patchUpdates(_0x1794ac){return function(_0x475561){try{jsonpatch[_0xc59d('0x2f')](_0x475561,_0x1794ac,!![]);}catch(_0x3c5db1){return BPromise[_0xc59d('0x30')](_0x3c5db1);}return _0x475561[_0xc59d('0x31')]();};}function saveUpdates(_0x17884b,_0x2706a3){return function(_0x55fecf){if(_0x55fecf){return _0x55fecf[_0xc59d('0x32')](_0x17884b)[_0xc59d('0x33')](function(_0x5373a6){return _0x5373a6;});}return null;};}function removeEntity(_0x11808a,_0x353ca0){return function(_0x25fc50){if(_0x25fc50){return _0x25fc50[_0xc59d('0x34')]()[_0xc59d('0x33')](function(){_0x11808a[_0xc59d('0x28')](0xcc)[_0xc59d('0x35')]();});}};}function handleEntityNotFound(_0x43865d,_0xc17f16){return function(_0x165344){if(!_0x165344){_0x43865d[_0xc59d('0x27')](0x194);}return _0x165344;};}function handleError(_0x55920e,_0x8cd5ff){_0x8cd5ff=_0x8cd5ff||0x1f4;return function(_0x25a4fc){logger[_0xc59d('0x24')](_0x25a4fc['stack']);if(_0x25a4fc['name']){delete _0x25a4fc[_0xc59d('0x36')];}_0x55920e[_0xc59d('0x28')](_0x8cd5ff)[_0xc59d('0x37')](_0x25a4fc);};}exports[_0xc59d('0x38')]=function(_0x44aac6,_0x10e5c9){var _0x5263f4={},_0x5a797a={},_0x1dd2e8={'count':0x0,'rows':[]};var _0x4bad6d=_[_0xc59d('0x39')](db[_0xc59d('0x3a')]['rawAttributes'],function(_0x184167){return{'name':_0x184167[_0xc59d('0x3b')],'type':_0x184167['type']['key']};});_0x5a797a[_0xc59d('0x3c')]=_[_0xc59d('0x39')](_0x4bad6d,'name');_0x5a797a['query']=_[_0xc59d('0x3d')](_0x44aac6[_0xc59d('0x3e')]);_0x5a797a[_0xc59d('0x3f')]=_[_0xc59d('0x40')](_0x5a797a[_0xc59d('0x3c')],_0x5a797a[_0xc59d('0x3e')]);_0x5263f4[_0xc59d('0x41')]=_[_0xc59d('0x40')](_0x5a797a[_0xc59d('0x3c')],qs[_0xc59d('0x42')](_0x44aac6['query'][_0xc59d('0x42')]));_0x5263f4[_0xc59d('0x41')]=_0x5263f4[_0xc59d('0x41')][_0xc59d('0x43')]?_0x5263f4[_0xc59d('0x41')]:_0x5a797a[_0xc59d('0x3c')];if(!_0x44aac6[_0xc59d('0x3e')][_0xc59d('0x44')](_0xc59d('0x45'))){_0x5263f4[_0xc59d('0x2c')]=qs[_0xc59d('0x2c')](_0x44aac6[_0xc59d('0x3e')][_0xc59d('0x2c')]);_0x5263f4[_0xc59d('0x2b')]=qs[_0xc59d('0x2b')](_0x44aac6[_0xc59d('0x3e')]['offset']);}_0x5263f4[_0xc59d('0x46')]=qs['sort'](_0x44aac6[_0xc59d('0x3e')][_0xc59d('0x47')]);_0x5263f4[_0xc59d('0x48')]=qs[_0xc59d('0x3f')](_[_0xc59d('0x49')](_0x44aac6[_0xc59d('0x3e')],_0x5a797a[_0xc59d('0x3f')]),_0x4bad6d);if(_0x44aac6[_0xc59d('0x3e')]['filter']){_0x5263f4[_0xc59d('0x48')]=_[_0xc59d('0x4a')](_0x5263f4['where'],{'$or':_[_0xc59d('0x39')](_0x4bad6d,function(_0x5d129f){if(_0x5d129f[_0xc59d('0x4b')]!=='VIRTUAL'){var _0x4b67db={};_0x4b67db[_0x5d129f[_0xc59d('0x36')]]={'$like':'%'+_0x44aac6[_0xc59d('0x3e')][_0xc59d('0x4c')]+'%'};return _0x4b67db;}})});}_0x5263f4=_[_0xc59d('0x4a')]({},_0x5263f4,_0x44aac6[_0xc59d('0x4d')]);var _0x51ebbe={'where':_0x5263f4[_0xc59d('0x48')]};return db['Network'][_0xc59d('0x2a')](_0x51ebbe)[_0xc59d('0x33')](function(_0x544c3e){_0x1dd2e8[_0xc59d('0x2a')]=_0x544c3e;if(_0x44aac6['query'][_0xc59d('0x4e')]){_0x5263f4[_0xc59d('0x4f')]=[{'all':!![]}];}return db[_0xc59d('0x3a')][_0xc59d('0x50')](_0x5263f4);})[_0xc59d('0x33')](function(_0x4cb2f0){_0x1dd2e8[_0xc59d('0x51')]=_0x4cb2f0;return _0x1dd2e8;})[_0xc59d('0x33')](respondWithFilteredResult(_0x10e5c9,_0x5263f4))[_0xc59d('0x26')](handleError(_0x10e5c9,null));};exports[_0xc59d('0x52')]=function(_0x5d77e3,_0x164546){var _0x52cd76={'raw':!![],'where':{'id':_0x5d77e3[_0xc59d('0x53')]['id']}},_0x33c078={};_0x33c078[_0xc59d('0x3c')]=_[_0xc59d('0x3d')](db['Network'][_0xc59d('0x54')]);_0x33c078[_0xc59d('0x3e')]=_[_0xc59d('0x3d')](_0x5d77e3['query']);_0x33c078[_0xc59d('0x3f')]=_[_0xc59d('0x40')](_0x33c078['model'],_0x33c078[_0xc59d('0x3e')]);_0x52cd76['attributes']=_[_0xc59d('0x40')](_0x33c078['model'],qs[_0xc59d('0x42')](_0x5d77e3[_0xc59d('0x3e')]['fields']));_0x52cd76[_0xc59d('0x41')]=_0x52cd76[_0xc59d('0x41')]['length']?_0x52cd76[_0xc59d('0x41')]:_0x33c078[_0xc59d('0x3c')];if(_0x5d77e3[_0xc59d('0x3e')][_0xc59d('0x4e')]){_0x52cd76[_0xc59d('0x4f')]=[{'all':!![]}];}_0x52cd76=_[_0xc59d('0x4a')]({},_0x52cd76,_0x5d77e3[_0xc59d('0x4d')]);return db[_0xc59d('0x3a')][_0xc59d('0x55')](_0x52cd76)[_0xc59d('0x33')](handleEntityNotFound(_0x164546,null))[_0xc59d('0x33')](respondWithResult(_0x164546,null))[_0xc59d('0x26')](handleError(_0x164546,null));};exports[_0xc59d('0x56')]=function(_0x3057b1,_0x23d7b1,_0x456e9b){var _0x1bf299;return db['sequelize']['transaction'](function(_0x1ad224){return db[_0xc59d('0x3a')][_0xc59d('0x56')](_0x3057b1['body'],{'raw':!![]})[_0xc59d('0x33')](function(_0x187009){_0x1bf299=_0x187009;return db[_0xc59d('0x3a')][_0xc59d('0x50')]({'where':{'type':_0x3057b1['body']['type']},'raw':!![]});})[_0xc59d('0x33')](function(_0x293792){if(_0x1bf299[_0xc59d('0x4b')][_0xc59d('0x57')]()=='STUN'){var _0x4fedd7=fs[_0xc59d('0x58')](path[_0xc59d('0x59')](config['root'],_0xc59d('0x5a')),_0xc59d('0x5b'));var _0x70c4af=ejs[_0xc59d('0x5c')](_0x4fedd7,{'networks':_0x293792||[]});fs[_0xc59d('0x5d')](_0xc59d('0x5e'),_0x70c4af);return respondWithRpcPromise(_0xc59d('0x5f'),_0xc59d('0x56'),{'module':_0xc59d('0x60')});}else if(_0x1bf299['type'][_0xc59d('0x57')]()==_0xc59d('0x61')){var _0x1d65f5=fs[_0xc59d('0x58')](path['join'](config[_0xc59d('0x62')],_0xc59d('0x63')),'utf8');var _0x4982ee=ejs['render'](_0x1d65f5,{'networks':_0x293792||[]});fs['writeFileSync'](_0xc59d('0x64'),_0x4982ee);return respondWithRpcPromise('Reload',_0xc59d('0x56'),{'module':_0xc59d('0x60')});}else{var _0x2c7b5d=fs[_0xc59d('0x58')](path['join'](config[_0xc59d('0x62')],'server/files/templates/network.ejs'),'utf8');var _0x27d84c=ejs[_0xc59d('0x5c')](_0x2c7b5d,{'networks':_0x293792||[]});fs[_0xc59d('0x5d')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3057b1[_0xc59d('0x65')][_0xc59d('0x4b')][_0xc59d('0x66')]()),_0x27d84c);return respondWithRpcPromise('Reload',_0xc59d('0x56'),{'module':_0xc59d('0x67')});}return null;})[_0xc59d('0x33')](function(){return _0x1bf299;});})[_0xc59d('0x33')](respondWithResult(_0x23d7b1,0xc9))[_0xc59d('0x26')](handleError(_0x23d7b1,null));};exports[_0xc59d('0x32')]=function(_0x2be5ac,_0x26eff8,_0x27de5f){var _0x533367;return db['sequelize'][_0xc59d('0x68')](function(_0x13eadd){return db[_0xc59d('0x3a')]['find']({'where':{'id':_0x2be5ac['params']['id']}})[_0xc59d('0x33')](handleEntityNotFound(_0x26eff8,null))[_0xc59d('0x33')](saveUpdates(_0x2be5ac[_0xc59d('0x65')],null))[_0xc59d('0x33')](function(_0x234192){if(_0x234192){_0x533367=_0x234192;return db[_0xc59d('0x3a')]['findAll']({'where':{'type':_0x533367[_0xc59d('0x4b')]},'raw':!![]});}return null;})[_0xc59d('0x33')](function(_0x274802){if(_0x533367[_0xc59d('0x4b')][_0xc59d('0x57')]()==_0xc59d('0x69')){var _0x2499cd=fs['readFileSync'](path[_0xc59d('0x59')](config[_0xc59d('0x62')],_0xc59d('0x5a')),_0xc59d('0x5b'));var _0x1fbcbc=ejs['render'](_0x2499cd,{'networks':_0x274802||[]});fs[_0xc59d('0x5d')]('/etc/asterisk/stun_xcally.conf',_0x1fbcbc);return respondWithRpcPromise(_0xc59d('0x5f'),_0xc59d('0x32'),{'module':_0xc59d('0x60')});}else if(_0x533367[_0xc59d('0x4b')][_0xc59d('0x57')]()==_0xc59d('0x61')){var _0x3926a3=fs[_0xc59d('0x58')](path[_0xc59d('0x59')](config[_0xc59d('0x62')],_0xc59d('0x63')),'utf8');var _0xd4ef3a=ejs[_0xc59d('0x5c')](_0x3926a3,{'networks':_0x274802||[]});fs[_0xc59d('0x5d')](_0xc59d('0x64'),_0xd4ef3a);return respondWithRpcPromise('Reload',_0xc59d('0x32'),{'module':_0xc59d('0x60')});}else{var _0x5571bf=fs['readFileSync'](path[_0xc59d('0x59')](config['root'],_0xc59d('0x6a')),_0xc59d('0x5b'));var _0xf618be=ejs[_0xc59d('0x5c')](_0x5571bf,{'networks':_0x274802||[]});fs['writeFileSync'](util[_0xc59d('0x6b')](_0xc59d('0x6c'),_0x2be5ac[_0xc59d('0x65')][_0xc59d('0x4b')][_0xc59d('0x66')]()),_0xf618be);return respondWithRpcPromise('Reload','update',{'module':_0xc59d('0x67')});}return null;})[_0xc59d('0x33')](function(_0x43b21f){if(_0x43b21f){return _0x533367;}return null;});})[_0xc59d('0x33')](respondWithResult(_0x26eff8,null))['catch'](handleError(_0x26eff8,null));};exports['destroy']=function(_0x348f72,_0x59dab1,_0x1627fc){var _0x2709d3;return db['Network'][_0xc59d('0x55')]({'where':{'id':_0x348f72[_0xc59d('0x53')]['id']}})[_0xc59d('0x33')](function(_0xf6a876){_0x2709d3=_0xf6a876;return _0xf6a876;})['then'](handleEntityNotFound(_0x59dab1,null))[_0xc59d('0x33')](removeEntity(_0x59dab1,null))[_0xc59d('0x33')](function(){if(_0x2709d3){return db[_0xc59d('0x3a')]['findAll']({'where':{'type':_0x2709d3[_0xc59d('0x4b')]},'raw':!![]});}})[_0xc59d('0x33')](function(_0x50238c){if(_0x2709d3['type'][_0xc59d('0x57')]()==_0xc59d('0x69')){var _0x4c7f52=fs[_0xc59d('0x58')](path[_0xc59d('0x59')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xc59d('0x5b'));var _0x450730=ejs['render'](_0x4c7f52,{'networks':_0x50238c||[]});fs[_0xc59d('0x5d')](_0xc59d('0x5e'),_0x450730);return respondWithRpcPromise(_0xc59d('0x5f'),_0xc59d('0x34'),{'module':_0xc59d('0x60')});}else if(_0x2709d3[_0xc59d('0x4b')][_0xc59d('0x57')]()==_0xc59d('0x61')){var _0x391736=fs[_0xc59d('0x58')](path[_0xc59d('0x59')](config[_0xc59d('0x62')],_0xc59d('0x63')),_0xc59d('0x5b'));var _0x57306f=ejs[_0xc59d('0x5c')](_0x391736,{'networks':_0x50238c||[]});fs['writeFileSync'](_0xc59d('0x64'),_0x57306f);return respondWithRpcPromise(_0xc59d('0x5f'),_0xc59d('0x34'),{'module':_0xc59d('0x60')});}else{var _0x4641e4=fs[_0xc59d('0x58')](path[_0xc59d('0x59')](config[_0xc59d('0x62')],_0xc59d('0x6a')),'utf8');var _0x19997f=ejs[_0xc59d('0x5c')](_0x4641e4,{'networks':_0x50238c||[]});fs[_0xc59d('0x5d')](util[_0xc59d('0x6b')](_0xc59d('0x6c'),_0x348f72[_0xc59d('0x65')][_0xc59d('0x4b')][_0xc59d('0x66')]()),_0x19997f);return respondWithRpcPromise('Reload',_0xc59d('0x34'),{'module':_0xc59d('0x67')});}return null;})[_0xc59d('0x26')](handleError(_0x59dab1,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 9fdb21a..5d0a202 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Network','network','lodash'];(function(_0x4ba438,_0x5c5650){var _0x476ebe=function(_0x27587b){while(--_0x27587b){_0x4ba438['push'](_0x4ba438['shift']());}};_0x476ebe(++_0x5c5650);}(_0xdace,0xc5));var _0xedac=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xdace[_0x365e54];return _0x13317a;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./network.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fdb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./network.attributes','Network','network'];(function(_0xd87161,_0xe6dd6a){var _0x31d7ea=function(_0x1d7ad9){while(--_0x1d7ad9){_0xd87161['push'](_0xd87161['shift']());}};_0x31d7ea(++_0xe6dd6a);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x3ede97,_0x5a1016){_0x3ede97=_0x3ede97-0x0;var _0x547ef2=_0x4fdb[_0x3ede97];return _0x547ef2;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var rp=require(_0xb4fd('0x6'));var fs=require('fs');var path=require(_0xb4fd('0x7'));var rimraf=require(_0xb4fd('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4fd('0x9'));module['exports']=function(_0x14052b,_0x5d8b39){return _0x14052b['define'](_0xb4fd('0xa'),attributes,{'tableName':_0xb4fd('0xb'),'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 570e827..d0e47ac 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 _0x0640=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x1f2461,_0xefc187){var _0x38ad6a=function(_0x74eb9f){while(--_0x74eb9f){_0x1f2461['push'](_0x1f2461['shift']());}};_0x38ad6a(++_0xefc187);}(_0x0640,0x81));var _0x0064=function(_0x25b3b7,_0x50d5f1){_0x25b3b7=_0x25b3b7-0x0;var _0x31662e=_0x0640[_0x25b3b7];return _0x31662e;};'use strict';var _=require(_0x0064('0x0'));var util=require(_0x0064('0x1'));var moment=require(_0x0064('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0064('0x3'));var db=require(_0x0064('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0064('0x5'))(_0x0064('0x6'));var config=require(_0x0064('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0064('0x8')][_0x0064('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2190ed,_0x359ad1,_0x22b718){return new BPromise(function(_0x273159,_0x3b8d7a){return client[_0x0064('0xa')](_0x2190ed,_0x22b718)[_0x0064('0xb')](function(_0x2c96d8){logger[_0x0064('0xc')](_0x0064('0xd'),_0x359ad1,_0x0064('0xe'));logger[_0x0064('0xf')](_0x0064('0x10'),_0x359ad1,_0x0064('0xe'),JSON[_0x0064('0x11')](_0x2c96d8));if(_0x2c96d8['error']){if(_0x2c96d8[_0x0064('0x12')]['code']===0x1f4){logger['error'](_0x0064('0xd'),_0x359ad1,_0x2c96d8[_0x0064('0x12')][_0x0064('0x13')]);return _0x3b8d7a(_0x2c96d8['error'][_0x0064('0x13')]);}logger['error'](_0x0064('0xd'),_0x359ad1,_0x2c96d8['error'][_0x0064('0x13')]);return _0x273159(_0x2c96d8[_0x0064('0x12')][_0x0064('0x13')]);}else{logger[_0x0064('0xc')](_0x0064('0xd'),_0x359ad1,'request\x20sent');_0x273159(_0x2c96d8[_0x0064('0x14')][_0x0064('0x13')]);}})[_0x0064('0x15')](function(_0x247069){logger[_0x0064('0x12')](_0x0064('0xd'),_0x359ad1,_0x247069);_0x3b8d7a(_0x247069);});});} \ No newline at end of file +var _0xa8bb=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x5d00c0,_0x2cf1ec){var _0x4e068c=function(_0x3d562e){while(--_0x3d562e){_0x5d00c0['push'](_0x5d00c0['shift']());}};_0x4e068c(++_0x2cf1ec);}(_0xa8bb,0xea));var _0xba8b=function(_0x432d92,_0x3a0b3f){_0x432d92=_0x432d92-0x0;var _0x573b32=_0xa8bb[_0x432d92];return _0x573b32;};'use strict';var _=require(_0xba8b('0x0'));var util=require('util');var moment=require(_0xba8b('0x1'));var BPromise=require(_0xba8b('0x2'));var rs=require(_0xba8b('0x3'));var fs=require('fs');var Redis=require(_0xba8b('0x4'));var db=require(_0xba8b('0x5'))['db'];var utils=require(_0xba8b('0x6'));var logger=require(_0xba8b('0x7'))(_0xba8b('0x8'));var config=require(_0xba8b('0x9'));var jayson=require(_0xba8b('0xa'));var client=jayson[_0xba8b('0xb')][_0xba8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x385a0b,_0x1c812f,_0x3cc736){return new BPromise(function(_0x16e7c5,_0x32c9a0){return client[_0xba8b('0xd')](_0x385a0b,_0x3cc736)[_0xba8b('0xe')](function(_0x4a9261){logger[_0xba8b('0xf')](_0xba8b('0x10'),_0x1c812f,_0xba8b('0x11'));logger[_0xba8b('0x12')](_0xba8b('0x13'),_0x1c812f,_0xba8b('0x11'),JSON[_0xba8b('0x14')](_0x4a9261));if(_0x4a9261['error']){if(_0x4a9261['error'][_0xba8b('0x15')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x1c812f,_0x4a9261[_0xba8b('0x16')][_0xba8b('0x17')]);return _0x32c9a0(_0x4a9261[_0xba8b('0x16')]['message']);}logger['error'](_0xba8b('0x10'),_0x1c812f,_0x4a9261['error'][_0xba8b('0x17')]);return _0x16e7c5(_0x4a9261[_0xba8b('0x16')]['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0x1c812f,_0xba8b('0x11'));_0x16e7c5(_0x4a9261[_0xba8b('0x18')][_0xba8b('0x17')]);}})[_0xba8b('0x19')](function(_0xa94307){logger[_0xba8b('0x16')](_0xba8b('0x10'),_0x1c812f,_0xa94307);_0x32c9a0(_0xa94307);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 2697508..ee73e83 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 _0x18d2=['../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x57d20a,_0x1cce7b){var _0x4dc9ef=function(_0x35652a){while(--_0x35652a){_0x57d20a['push'](_0x57d20a['shift']());}};_0x4dc9ef(++_0x1cce7b);}(_0x18d2,0xa3));var _0x218d=function(_0x3f239d,_0xcd5030){_0x3f239d=_0x3f239d-0x0;var _0x4215e9=_0x18d2[_0x3f239d];return _0x4215e9;};'use strict';var multer=require(_0x218d('0x0'));var util=require('util');var path=require(_0x218d('0x1'));var timeout=require(_0x218d('0x2'));var express=require(_0x218d('0x3'));var router=express['Router']();var auth=require(_0x218d('0x4'));var interaction=require(_0x218d('0x5'));var config=require(_0x218d('0x6'));var controller=require(_0x218d('0x7'));router[_0x218d('0x8')]('/',auth[_0x218d('0x9')](),controller[_0x218d('0xa')]);module[_0x218d('0xb')]=router; \ No newline at end of file +var _0xeb65=['isAuthenticated','sendNotification','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xeb65,0x77));var _0x5eb6=function(_0x562f26,_0x9062ab){_0x562f26=_0x562f26-0x0;var _0x10a648=_0xeb65[_0x562f26];return _0x10a648;};'use strict';var multer=require(_0x5eb6('0x0'));var util=require(_0x5eb6('0x1'));var path=require(_0x5eb6('0x2'));var timeout=require(_0x5eb6('0x3'));var express=require(_0x5eb6('0x4'));var router=express['Router']();var auth=require(_0x5eb6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5eb6('0x6'));var controller=require('./notification.controller');router['post']('/',auth[_0x5eb6('0x7')](),controller[_0x5eb6('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 6e62137..ffa08bf 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 _0xae9f=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2141a9,_0x46da91){var _0x563d3c=function(_0x44aad0){while(--_0x44aad0){_0x2141a9['push'](_0x2141a9['shift']());}};_0x563d3c(++_0x46da91);}(_0xae9f,0x17c));var _0xfae9=function(_0x219813,_0x189806){_0x219813=_0x219813-0x0;var _0x8e1f78=_0xae9f[_0x219813];return _0x8e1f78;};'use strict';var Sequelize=require(_0xfae9('0x0'));module[_0xfae9('0x1')]={'body':{'type':Sequelize[_0xfae9('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xfae9('0x2')]},'recipientsDescription':{'type':Sequelize[_0xfae9('0x3')]},'beep':{'type':Sequelize[_0xfae9('0x4')]}}; \ No newline at end of file +var _0x609a=['exports','TEXT','STRING','BOOLEAN'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x609a,0x88));var _0xa609=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x609a[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xa609('0x0')]={'body':{'type':Sequelize[_0xa609('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xa609('0x1')]},'recipientsDescription':{'type':Sequelize[_0xa609('0x2')]},'beep':{'type':Sequelize[_0xa609('0x3')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index a0b6f51..35d909d 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 _0xf7d2=['voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','replace','queue','Queue','ids','all','union','flatten','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','./notification.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','sendNotification','hasOwnProperty','body','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue'];(function(_0x44fb02,_0x16bdbc){var _0x4d3aaa=function(_0xa5ccfd){while(--_0xa5ccfd){_0x44fb02['push'](_0x44fb02['shift']());}};_0x4d3aaa(++_0x16bdbc);}(_0xf7d2,0x8b));var _0x2f7d=function(_0x73076a,_0x42571a){_0x73076a=_0x73076a-0x0;var _0x1d7abd=_0xf7d2[_0x73076a];return _0x1d7abd;};'use strict';var pdf=require(_0x2f7d('0x0'));var emlformat=require(_0x2f7d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f7d('0x2'));var rp=require(_0x2f7d('0x3'));var moment=require(_0x2f7d('0x4'));var BPromise=require(_0x2f7d('0x5'));var Mustache=require(_0x2f7d('0x6'));var util=require(_0x2f7d('0x7'));var path=require(_0x2f7d('0x8'));var sox=require(_0x2f7d('0x9'));var csv=require(_0x2f7d('0xa'));var ejs=require(_0x2f7d('0xb'));var fs=require('fs');var _=require(_0x2f7d('0xc'));var squel=require('squel');var crypto=require(_0x2f7d('0xd'));var jsforce=require(_0x2f7d('0xe'));var deskjs=require(_0x2f7d('0xf'));var toCsv=require(_0x2f7d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2f7d('0x10'));var authService=require(_0x2f7d('0x11'));var qs=require(_0x2f7d('0x12'));var as=require(_0x2f7d('0x13'));var hardwareService=require(_0x2f7d('0x14'));var logger=require('../../config/logger')(_0x2f7d('0x15'));var utils=require('../../config/utils');var config=require(_0x2f7d('0x16'));var db=require(_0x2f7d('0x17'))['db'];config[_0x2f7d('0x18')]=_[_0x2f7d('0x19')](config[_0x2f7d('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f7d('0x18')]));require(_0x2f7d('0x1a'))[_0x2f7d('0x1b')](socket);function respondWithStatusCode(_0x246236,_0x2ee732){_0x2ee732=_0x2ee732||0xcc;return function(_0x33aecc){if(_0x33aecc){return _0x246236[_0x2f7d('0x1c')](_0x2ee732);}return _0x246236[_0x2f7d('0x1d')](_0x2ee732)[_0x2f7d('0x1e')]();};}function respondWithResult(_0x2673a6,_0x43a63c){_0x43a63c=_0x43a63c||0xc8;return function(_0x14068a){if(_0x14068a){return _0x2673a6[_0x2f7d('0x1d')](_0x43a63c)[_0x2f7d('0x1f')](_0x14068a);}};}function respondWithFilteredResult(_0x17da85,_0x449372){return function(_0x4c6f1e){if(_0x4c6f1e){var _0x4e373b=_0x4c6f1e[_0x2f7d('0x20')],_0x1da46a=_0x449372[_0x2f7d('0x21')],_0x4dc1a1=_0x449372['offset']+_0x449372[_0x2f7d('0x22')],_0x162f57;if(_0x4dc1a1>=_0x4e373b){_0x4dc1a1=_0x4e373b;_0x162f57=0xc8;}else{_0x162f57=0xce;}_0x17da85[_0x2f7d('0x1d')](_0x162f57);return _0x17da85[_0x2f7d('0x23')]('Content-Range',_0x1da46a+'-'+_0x4dc1a1+'/'+_0x4e373b)[_0x2f7d('0x1f')](_0x4c6f1e);}return null;};}function patchUpdates(_0x5763c6){return function(_0x5be982){try{jsonpatch[_0x2f7d('0x24')](_0x5be982,_0x5763c6,!![]);}catch(_0x2a9a8b){return BPromise['reject'](_0x2a9a8b);}return _0x5be982[_0x2f7d('0x25')]();};}function saveUpdates(_0x598d5b,_0x1e90f3){return function(_0x41ad88){if(_0x41ad88){return _0x41ad88[_0x2f7d('0x26')](_0x598d5b)[_0x2f7d('0x27')](function(_0x19aaa5){return _0x19aaa5;});}return null;};}function removeEntity(_0x2d8268,_0x3a8ab6){return function(_0x457766){if(_0x457766){return _0x457766[_0x2f7d('0x28')]()[_0x2f7d('0x27')](function(){_0x2d8268[_0x2f7d('0x1d')](0xcc)[_0x2f7d('0x1e')]();});}};}function handleEntityNotFound(_0x1a9a90,_0x245753){return function(_0x432745){if(!_0x432745){_0x1a9a90[_0x2f7d('0x1c')](0x194);}return _0x432745;};}function handleError(_0x513397,_0x1be1c3){_0x1be1c3=_0x1be1c3||0x1f4;return function(_0x1e80b8){logger[_0x2f7d('0x29')](_0x1e80b8[_0x2f7d('0x2a')]);if(_0x1e80b8[_0x2f7d('0x2b')]){delete _0x1e80b8[_0x2f7d('0x2b')];}_0x513397[_0x2f7d('0x1d')](_0x1be1c3)['send'](_0x1e80b8);};}exports[_0x2f7d('0x2c')]=function(_0x57c87f,_0x3682f8,_0x22d421){if(!_0x57c87f['body'][_0x2f7d('0x2d')]('text')&&!_0x57c87f[_0x2f7d('0x2e')][_0x2f7d('0x2d')](_0x2f7d('0x2f'))){throw new db[(_0x2f7d('0x30'))][(_0x2f7d('0x31'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x57c87f['body'][_0x2f7d('0x2d')](_0x2f7d('0x2f'))&&!_0x57c87f[_0x2f7d('0x2e')][_0x2f7d('0x2d')](_0x2f7d('0x32'))){throw new db[(_0x2f7d('0x30'))][(_0x2f7d('0x31'))](_0x2f7d('0x33'));}if(!_0x57c87f['body'][_0x2f7d('0x2d')](_0x2f7d('0x34'))){throw new db[(_0x2f7d('0x30'))][(_0x2f7d('0x31'))](_0x2f7d('0x35'));}else{try{var _0x4deb51=JSON[_0x2f7d('0x36')](_0x57c87f[_0x2f7d('0x2e')][_0x2f7d('0x34')]);}catch(_0x11c9d1){logger[_0x2f7d('0x29')](_0x11c9d1);throw new db[(_0x2f7d('0x30'))][(_0x2f7d('0x31'))](_0x2f7d('0x37'));}var _0x3566a1=[_0x2f7d('0x38'),_0x2f7d('0x39'),_0x2f7d('0x3a'),_0x2f7d('0x3b'),_0x2f7d('0x3c'),_0x2f7d('0x3d'),_0x2f7d('0x3e'),_0x2f7d('0x3f'),_0x2f7d('0x40')];if(_[_0x2f7d('0x41')](_0x4deb51,function(_0x4a4221){return!_[_0x2f7d('0x42')](_0x3566a1,_0x4a4221['model'][_0x2f7d('0x43')]());})){throw new db['Sequelize'][(_0x2f7d('0x31'))](_0x2f7d('0x44'));}}}var _0x1db4c1={};_0x1db4c1[_0x2f7d('0x45')]=_0x57c87f[_0x2f7d('0x2e')][_0x2f7d('0x2d')]('senderName')?_0x57c87f[_0x2f7d('0x2e')][_0x2f7d('0x45')]:_0x57c87f[_0x2f7d('0x40')][_0x2f7d('0x46')];_0x1db4c1['recipientsDescription']=_[_0x2f7d('0x47')](_0x57c87f['body'][_0x2f7d('0x48')])?null:_0x57c87f[_0x2f7d('0x2e')][_0x2f7d('0x48')];_0x1db4c1[_0x2f7d('0x49')]=_0x57c87f['body'][_0x2f7d('0x49')]||![];_0x1db4c1[_0x2f7d('0x4a')]=_0x57c87f[_0x2f7d('0x40')]['id'];return getContent(_0x57c87f[_0x2f7d('0x2e')])[_0x2f7d('0x27')](function(_0x3545c3){_0x1db4c1['body']=_0x3545c3;return getRecipients(_0x4deb51);})['then'](function(_0x20c025){_0x1db4c1['recipientsId']=_['sortBy'](_0x20c025)['join'](',');return db[_0x2f7d('0x4b')][_0x2f7d('0x4c')](function(_0x291171){return db[_0x2f7d('0x4d')][_0x2f7d('0x4e')](_0x1db4c1,{'raw':!![],'transaction':_0x291171})[_0x2f7d('0x27')](function(_0x3d7647){var _0x12eb3f={'sender':_0x1db4c1[_0x2f7d('0x45')],'description':_0x1db4c1[_0x2f7d('0x48')],'content':_0x1db4c1['body'],'beep':_0x1db4c1['beep']};_0x20c025[_0x2f7d('0x4f')](function(_0x4b52e7){_0x12eb3f[_0x2f7d('0x50')]=_0x4b52e7;socket[_0x2f7d('0x51')](_0x2f7d('0x52'),_0x12eb3f);});return _0x3d7647;});});})[_0x2f7d('0x27')](respondWithResult(_0x3682f8,0xc9))[_0x2f7d('0x53')](handleError(_0x3682f8,null));};function getContent(_0x43acb8){return new BPromise(function(_0x57ccf7,_0x17dfb6){if(_0x43acb8[_0x2f7d('0x54')]){_0x57ccf7(_0x43acb8[_0x2f7d('0x54')]);return;}return db[_0x2f7d('0x55')][_0x2f7d('0x56')]({'attributes':[_0x2f7d('0x57')],'where':{'id':_0x43acb8[_0x2f7d('0x2f')]},'raw':!![]})['then'](function(_0x6c1e8a){if(!_0x6c1e8a)throw new db[(_0x2f7d('0x30'))][(_0x2f7d('0x31'))](_0x2f7d('0x58'));var _0x2c938e=Mustache[_0x2f7d('0x59')](_0x6c1e8a[_0x2f7d('0x57')],_0x43acb8[_0x2f7d('0x32')]);_0x57ccf7(_0x2c938e);})[_0x2f7d('0x53')](function(_0x4dfcdf){_0x17dfb6(_0x4dfcdf);});});}function getRecipients(_0x5988f7){return new BPromise(function(_0x5a88ba,_0x120772){var _0x2d1126=[];var _0x33175c=[];_0x5988f7['forEach'](function(_0x407675){var _0x15218d=_[_0x2f7d('0x5a')](_0x407675[_0x2f7d('0x5b')][_0x2f7d('0x43')]());if(_0x15218d==='User'){_0x2d1126=_['union'](_0x2d1126,_0x407675['ids']);}else{if(_[_0x2f7d('0x42')](_0x15218d,'queue'))_0x15218d=_0x15218d[_0x2f7d('0x5c')](_0x2f7d('0x5d'),_0x2f7d('0x5e'));_0x407675[_0x2f7d('0x5f')][_0x2f7d('0x4f')](function(_0x2bdcb5){_0x33175c['push'](getAgents(_0x15218d,_0x2bdcb5));});}});return BPromise[_0x2f7d('0x60')](_0x33175c)[_0x2f7d('0x27')](function(_0x8c21b5){_0x2d1126=_[_0x2f7d('0x61')](_0x2d1126,_[_0x2f7d('0x62')](_0x8c21b5));_0x5a88ba(_0x2d1126);})['catch'](function(_0x368198){_0x120772(_0x368198);});});}function getAgents(_0x50d929,_0x24355b){return new BPromise(function(_0x286240,_0x3c8751){return db[_0x50d929][_0x2f7d('0x56')]({'where':{'id':_0x24355b}})[_0x2f7d('0x27')](function(_0x19e56a){return _0x19e56a[_0x2f7d('0x63')]({'attributes':['id'],'raw':!![]})[_0x2f7d('0x27')](function(_0x54ac2a){var _0x12441d=_['map'](_0x54ac2a,'id');_0x286240(_0x12441d);});})[_0x2f7d('0x53')](function(_0x4b246a){_0x3c8751(_0x4b246a);});});} \ No newline at end of file +var _0x8e51=['Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','join','sequelize','transaction','Notification','forEach','recipient','notification:send','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','union','ids','queue','replace','push','all','catch','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','./notification.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','sendNotification','body','hasOwnProperty','ValidationError'];(function(_0x1d90ca,_0x3bab16){var _0x28872b=function(_0x3ea71b){while(--_0x3ea71b){_0x1d90ca['push'](_0x1d90ca['shift']());}};_0x28872b(++_0x3bab16);}(_0x8e51,0xde));var _0x18e5=function(_0x40f17f,_0x34c8c0){_0x40f17f=_0x40f17f-0x0;var _0x543aea=_0x8e51[_0x40f17f];return _0x543aea;};'use strict';var pdf=require(_0x18e5('0x0'));var emlformat=require(_0x18e5('0x1'));var rimraf=require(_0x18e5('0x2'));var zipdir=require(_0x18e5('0x3'));var jsonpatch=require(_0x18e5('0x4'));var rp=require('request-promise');var moment=require(_0x18e5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x18e5('0x6'));var path=require('path');var sox=require(_0x18e5('0x7'));var csv=require(_0x18e5('0x8'));var ejs=require(_0x18e5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x18e5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x18e5('0x8'));var querystring=require(_0x18e5('0xb'));var Papa=require('papaparse');var Redis=require(_0x18e5('0xc'));var authService=require(_0x18e5('0xd'));var qs=require(_0x18e5('0xe'));var as=require(_0x18e5('0xf'));var hardwareService=require(_0x18e5('0x10'));var logger=require(_0x18e5('0x11'))('api');var utils=require(_0x18e5('0x12'));var config=require(_0x18e5('0x13'));var db=require('../../mysqldb')['db'];config[_0x18e5('0x14')]=_['defaults'](config[_0x18e5('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18e5('0x14')]));require(_0x18e5('0x15'))[_0x18e5('0x16')](socket);function respondWithStatusCode(_0x39f493,_0x5efd4e){_0x5efd4e=_0x5efd4e||0xcc;return function(_0x3f5a7c){if(_0x3f5a7c){return _0x39f493['sendStatus'](_0x5efd4e);}return _0x39f493[_0x18e5('0x17')](_0x5efd4e)[_0x18e5('0x18')]();};}function respondWithResult(_0x25ca86,_0x135606){_0x135606=_0x135606||0xc8;return function(_0x262bbc){if(_0x262bbc){return _0x25ca86[_0x18e5('0x17')](_0x135606)[_0x18e5('0x19')](_0x262bbc);}};}function respondWithFilteredResult(_0x138a7a,_0x2a8c9d){return function(_0x286c29){if(_0x286c29){var _0x226c1d=_0x286c29[_0x18e5('0x1a')],_0x4127a7=_0x2a8c9d[_0x18e5('0x1b')],_0x3c68e8=_0x2a8c9d[_0x18e5('0x1b')]+_0x2a8c9d['limit'],_0x3f0d87;if(_0x3c68e8>=_0x226c1d){_0x3c68e8=_0x226c1d;_0x3f0d87=0xc8;}else{_0x3f0d87=0xce;}_0x138a7a['status'](_0x3f0d87);return _0x138a7a[_0x18e5('0x1c')](_0x18e5('0x1d'),_0x4127a7+'-'+_0x3c68e8+'/'+_0x226c1d)['json'](_0x286c29);}return null;};}function patchUpdates(_0x1b6b44){return function(_0x496a8b){try{jsonpatch[_0x18e5('0x1e')](_0x496a8b,_0x1b6b44,!![]);}catch(_0x4cdf08){return BPromise[_0x18e5('0x1f')](_0x4cdf08);}return _0x496a8b[_0x18e5('0x20')]();};}function saveUpdates(_0xdf4986,_0x216be5){return function(_0x33da69){if(_0x33da69){return _0x33da69[_0x18e5('0x21')](_0xdf4986)[_0x18e5('0x22')](function(_0x5d5b66){return _0x5d5b66;});}return null;};}function removeEntity(_0x505baa,_0x50a314){return function(_0x199a23){if(_0x199a23){return _0x199a23[_0x18e5('0x23')]()[_0x18e5('0x22')](function(){_0x505baa[_0x18e5('0x17')](0xcc)[_0x18e5('0x18')]();});}};}function handleEntityNotFound(_0x449339,_0x27d3d3){return function(_0x487a85){if(!_0x487a85){_0x449339[_0x18e5('0x24')](0x194);}return _0x487a85;};}function handleError(_0x1da146,_0x48d2af){_0x48d2af=_0x48d2af||0x1f4;return function(_0x948d70){logger['error'](_0x948d70[_0x18e5('0x25')]);if(_0x948d70['name']){delete _0x948d70['name'];}_0x1da146[_0x18e5('0x17')](_0x48d2af)['send'](_0x948d70);};}exports[_0x18e5('0x26')]=function(_0x9fbc94,_0x59d41a,_0x414f4e){if(!_0x9fbc94[_0x18e5('0x27')][_0x18e5('0x28')]('text')&&!_0x9fbc94['body'][_0x18e5('0x28')]('TemplateId')){throw new db['Sequelize'][(_0x18e5('0x29'))](_0x18e5('0x2a'));}else{if(_0x9fbc94[_0x18e5('0x27')][_0x18e5('0x28')](_0x18e5('0x2b'))&&!_0x9fbc94[_0x18e5('0x27')][_0x18e5('0x28')](_0x18e5('0x2c'))){throw new db['Sequelize'][(_0x18e5('0x29'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x9fbc94['body'][_0x18e5('0x28')](_0x18e5('0x2d'))){throw new db[(_0x18e5('0x2e'))][(_0x18e5('0x29'))](_0x18e5('0x2f'));}else{try{var _0x1bc5a8=JSON[_0x18e5('0x30')](_0x9fbc94[_0x18e5('0x27')][_0x18e5('0x2d')]);}catch(_0x1e8603){logger[_0x18e5('0x31')](_0x1e8603);throw new db[(_0x18e5('0x2e'))][(_0x18e5('0x29'))](_0x18e5('0x32'));}var _0xcd41b5=[_0x18e5('0x33'),_0x18e5('0x34'),_0x18e5('0x35'),_0x18e5('0x36'),_0x18e5('0x37'),_0x18e5('0x38'),_0x18e5('0x39'),_0x18e5('0x3a'),_0x18e5('0x3b')];if(_['some'](_0x1bc5a8,function(_0x5d6409){return!_[_0x18e5('0x3c')](_0xcd41b5,_0x5d6409[_0x18e5('0x3d')][_0x18e5('0x3e')]());})){throw new db[(_0x18e5('0x2e'))][(_0x18e5('0x29'))](_0x18e5('0x3f'));}}}var _0x2b1e46={};_0x2b1e46[_0x18e5('0x40')]=_0x9fbc94[_0x18e5('0x27')][_0x18e5('0x28')](_0x18e5('0x40'))?_0x9fbc94['body'][_0x18e5('0x40')]:_0x9fbc94[_0x18e5('0x3b')]['fullname'];_0x2b1e46[_0x18e5('0x41')]=_[_0x18e5('0x42')](_0x9fbc94['body'][_0x18e5('0x41')])?null:_0x9fbc94['body']['recipientsDescription'];_0x2b1e46['beep']=_0x9fbc94[_0x18e5('0x27')][_0x18e5('0x43')]||![];_0x2b1e46['SenderId']=_0x9fbc94['user']['id'];return getContent(_0x9fbc94[_0x18e5('0x27')])[_0x18e5('0x22')](function(_0x581341){_0x2b1e46[_0x18e5('0x27')]=_0x581341;return getRecipients(_0x1bc5a8);})[_0x18e5('0x22')](function(_0x54ba80){_0x2b1e46['recipientsId']=_['sortBy'](_0x54ba80)[_0x18e5('0x44')](',');return db[_0x18e5('0x45')][_0x18e5('0x46')](function(_0x1df39c){return db[_0x18e5('0x47')]['create'](_0x2b1e46,{'raw':!![],'transaction':_0x1df39c})['then'](function(_0x18bace){var _0x224b8a={'sender':_0x2b1e46[_0x18e5('0x40')],'description':_0x2b1e46[_0x18e5('0x41')],'content':_0x2b1e46[_0x18e5('0x27')],'beep':_0x2b1e46[_0x18e5('0x43')]};_0x54ba80[_0x18e5('0x48')](function(_0x53675c){_0x224b8a[_0x18e5('0x49')]=_0x53675c;socket['emit'](_0x18e5('0x4a'),_0x224b8a);});return _0x18bace;});});})['then'](respondWithResult(_0x59d41a,0xc9))['catch'](handleError(_0x59d41a,null));};function getContent(_0x350cf4){return new BPromise(function(_0x5d805f,_0x496463){if(_0x350cf4['text']){_0x5d805f(_0x350cf4['text']);return;}return db['Template'][_0x18e5('0x4b')]({'attributes':[_0x18e5('0x4c')],'where':{'id':_0x350cf4[_0x18e5('0x2b')]},'raw':!![]})[_0x18e5('0x22')](function(_0x50fa60){if(!_0x50fa60)throw new db[(_0x18e5('0x2e'))]['ValidationError'](_0x18e5('0x4d'));var _0x12ff4e=Mustache[_0x18e5('0x4e')](_0x50fa60[_0x18e5('0x4c')],_0x350cf4['view']);_0x5d805f(_0x12ff4e);})['catch'](function(_0x25c1b0){_0x496463(_0x25c1b0);});});}function getRecipients(_0x46b1a8){return new BPromise(function(_0x500fb7,_0x245de8){var _0x214969=[];var _0x9a98c3=[];_0x46b1a8[_0x18e5('0x48')](function(_0x4870b0){var _0x4d2693=_[_0x18e5('0x4f')](_0x4870b0['model'][_0x18e5('0x3e')]());if(_0x4d2693==='User'){_0x214969=_[_0x18e5('0x50')](_0x214969,_0x4870b0[_0x18e5('0x51')]);}else{if(_[_0x18e5('0x3c')](_0x4d2693,_0x18e5('0x52')))_0x4d2693=_0x4d2693[_0x18e5('0x53')]('queue','Queue');_0x4870b0[_0x18e5('0x51')][_0x18e5('0x48')](function(_0x149a17){_0x9a98c3[_0x18e5('0x54')](getAgents(_0x4d2693,_0x149a17));});}});return BPromise[_0x18e5('0x55')](_0x9a98c3)[_0x18e5('0x22')](function(_0x390bed){_0x214969=_[_0x18e5('0x50')](_0x214969,_['flatten'](_0x390bed));_0x500fb7(_0x214969);})[_0x18e5('0x56')](function(_0x5219c6){_0x245de8(_0x5219c6);});});}function getAgents(_0x5b6cbe,_0x1f6aa0){return new BPromise(function(_0x253eb5,_0x1c37e1){return db[_0x5b6cbe]['findOne']({'where':{'id':_0x1f6aa0}})[_0x18e5('0x22')](function(_0x477416){return _0x477416[_0x18e5('0x57')]({'attributes':['id'],'raw':!![]})[_0x18e5('0x22')](function(_0x876e18){var _0x1367ab=_['map'](_0x876e18,'id');_0x253eb5(_0x1367ab);});})[_0x18e5('0x56')](function(_0x507950){_0x1c37e1(_0x507950);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 762573f..c93119b 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Notification','setMaxListeners','save','update'];(function(_0x51d6df,_0x23bf79){var _0x3284a8=function(_0x2e4f86){while(--_0x2e4f86){_0x51d6df['push'](_0x51d6df['shift']());}};_0x3284a8(++_0x23bf79);}(_0x5f2f,0x73));var _0xf5f2=function(_0x236a4a,_0x1bf351){_0x236a4a=_0x236a4a-0x0;var _0x5a2b58=_0x5f2f[_0x236a4a];return _0x5a2b58;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Notification=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){NotificationEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);NotificationEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Notification[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=NotificationEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x2032,0xd9));var _0x2203=function(_0x5e8d5f,_0x514c55){_0x5e8d5f=_0x5e8d5f-0x0;var _0x5493ba=_0x2032[_0x5e8d5f];return _0x5493ba;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index d81d424..9a02769 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 _0xb7e7=['Notification','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./notification.attributes','define'];(function(_0x566c9d,_0x5d357a){var _0x12dbff=function(_0x52d41d){while(--_0x52d41d){_0x566c9d['push'](_0x566c9d['shift']());}};_0x12dbff(++_0x5d357a);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb7e7[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b7e('0x9'),'collate':_0x7b7e('0xa')});}; \ No newline at end of file +var _0xb62e=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./notification.attributes','define','notifications'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var logger=require(_0xeb62('0x2'))(_0xeb62('0x3'));var moment=require('moment');var BPromise=require(_0xeb62('0x4'));var rp=require(_0xeb62('0x5'));var fs=require('fs');var path=require(_0xeb62('0x6'));var rimraf=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var attributes=require(_0xeb62('0x9'));module['exports']=function(_0x3ec879,_0x455e1a){return _0x3ec879[_0xeb62('0xa')]('Notification',attributes,{'tableName':_0xeb62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb62('0xc'),'collate':_0xeb62('0xd')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 8c93176..fbdbf94 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 _0x94c5=['../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./notification.socket','register','request','then','info','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Notification,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x27ee98,_0x3bd543){var _0x5f00d1=function(_0x12d9ed){while(--_0x12d9ed){_0x27ee98['push'](_0x27ee98['shift']());}};_0x5f00d1(++_0x3bd543);}(_0x94c5,0x14c));var _0x594c=function(_0x33c77e,_0x5bbe5d){_0x33c77e=_0x33c77e-0x0;var _0x4793e5=_0x94c5[_0x33c77e];return _0x4793e5;};'use strict';var _=require('lodash');var util=require(_0x594c('0x0'));var moment=require('moment');var BPromise=require(_0x594c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x594c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x594c('0x3'));var logger=require(_0x594c('0x4'))(_0x594c('0x5'));var config=require(_0x594c('0x6'));var jayson=require(_0x594c('0x7'));var client=jayson[_0x594c('0x8')][_0x594c('0x9')]({'port':0x232a});config[_0x594c('0xa')]=_['defaults'](config[_0x594c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x594c('0xb'))(new Redis(config[_0x594c('0xa')]));require(_0x594c('0xc'))[_0x594c('0xd')](socket);function respondWithRpcPromise(_0x37c9b2,_0x199437,_0x59e136){return new BPromise(function(_0x4538c,_0x5540ec){return client[_0x594c('0xe')](_0x37c9b2,_0x59e136)[_0x594c('0xf')](function(_0x58df0d){logger[_0x594c('0x10')]('Notification,\x20%s,\x20%s',_0x199437,'request\x20sent');logger[_0x594c('0x11')](_0x594c('0x12'),_0x199437,_0x594c('0x13'),JSON[_0x594c('0x14')](_0x58df0d));if(_0x58df0d[_0x594c('0x15')]){if(_0x58df0d[_0x594c('0x15')]['code']===0x1f4){logger['error'](_0x594c('0x16'),_0x199437,_0x58df0d[_0x594c('0x15')]['message']);return _0x5540ec(_0x58df0d['error'][_0x594c('0x17')]);}logger[_0x594c('0x15')](_0x594c('0x16'),_0x199437,_0x58df0d[_0x594c('0x15')][_0x594c('0x17')]);return _0x4538c(_0x58df0d[_0x594c('0x15')][_0x594c('0x17')]);}else{logger[_0x594c('0x10')](_0x594c('0x16'),_0x199437,'request\x20sent');_0x4538c(_0x58df0d[_0x594c('0x18')]['message']);}})[_0x594c('0x19')](function(_0x17c5cf){logger['error']('Notification,\x20%s,\x20%s',_0x199437,_0x17c5cf);_0x5540ec(_0x17c5cf);});});} \ No newline at end of file +var _0x9e41=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','error','code','message','Notification,\x20%s,\x20%s','catch'];(function(_0x1e65e5,_0x28bd82){var _0x438caf=function(_0x2ce5d2){while(--_0x2ce5d2){_0x1e65e5['push'](_0x1e65e5['shift']());}};_0x438caf(++_0x28bd82);}(_0x9e41,0x150));var _0x19e4=function(_0xa4d6ae,_0x516961){_0xa4d6ae=_0xa4d6ae-0x0;var _0x5e7673=_0x9e41[_0xa4d6ae];return _0x5e7673;};'use strict';var _=require(_0x19e4('0x0'));var util=require(_0x19e4('0x1'));var moment=require(_0x19e4('0x2'));var BPromise=require(_0x19e4('0x3'));var rs=require(_0x19e4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19e4('0x5'))['db'];var utils=require(_0x19e4('0x6'));var logger=require(_0x19e4('0x7'))(_0x19e4('0x8'));var config=require(_0x19e4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x19e4('0xa')]['http']({'port':0x232a});config[_0x19e4('0xb')]=_[_0x19e4('0xc')](config[_0x19e4('0xb')],{'host':_0x19e4('0xd'),'port':0x18eb});var socket=require(_0x19e4('0xe'))(new Redis(config[_0x19e4('0xb')]));require('./notification.socket')['register'](socket);function respondWithRpcPromise(_0x1f3fd5,_0x3449c1,_0x36e0e4){return new BPromise(function(_0x5047de,_0x4f345e){return client['request'](_0x1f3fd5,_0x36e0e4)[_0x19e4('0xf')](function(_0x21ba6c){logger[_0x19e4('0x10')]('Notification,\x20%s,\x20%s',_0x3449c1,_0x19e4('0x11'));logger['debug'](_0x19e4('0x12'),_0x3449c1,_0x19e4('0x11'),JSON['stringify'](_0x21ba6c));if(_0x21ba6c[_0x19e4('0x13')]){if(_0x21ba6c['error'][_0x19e4('0x14')]===0x1f4){logger['error']('Notification,\x20%s,\x20%s',_0x3449c1,_0x21ba6c[_0x19e4('0x13')][_0x19e4('0x15')]);return _0x4f345e(_0x21ba6c[_0x19e4('0x13')][_0x19e4('0x15')]);}logger[_0x19e4('0x13')](_0x19e4('0x16'),_0x3449c1,_0x21ba6c[_0x19e4('0x13')][_0x19e4('0x15')]);return _0x5047de(_0x21ba6c['error']['message']);}else{logger[_0x19e4('0x10')]('Notification,\x20%s,\x20%s',_0x3449c1,_0x19e4('0x11'));_0x5047de(_0x21ba6c['result'][_0x19e4('0x15')]);}})[_0x19e4('0x17')](function(_0x206980){logger[_0x19e4('0x13')]('Notification,\x20%s,\x20%s',_0x3449c1,_0x206980);_0x4f345e(_0x206980);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 9475688..2cdcd1a 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 _0x53bc=['removeListener','register','length','notification:','save','remove','update','emit'];(function(_0x211ba8,_0x323ffa){var _0x367e96=function(_0x50f459){while(--_0x50f459){_0x211ba8['push'](_0x211ba8['shift']());}};_0x367e96(++_0x323ffa);}(_0x53bc,0x1ec));var _0xc53b=function(_0x7f72c6,_0x57444d){_0x7f72c6=_0x7f72c6-0x0;var _0x1d8755=_0x53bc[_0x7f72c6];return _0x1d8755;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0xc53b('0x0'),_0xc53b('0x1'),_0xc53b('0x2')];function createListener(_0x332c53,_0x2ffab8){return function(_0x1a36f0){_0x2ffab8[_0xc53b('0x3')](_0x332c53,_0x1a36f0);};}function removeListener(_0x21e0c7,_0x5d6079){return function(){NotificationEvents[_0xc53b('0x4')](_0x21e0c7,_0x5d6079);};}exports[_0xc53b('0x5')]=function(_0x598ca7){for(var _0x11f299=0x0,_0x422997=events[_0xc53b('0x6')];_0x11f299<_0x422997;_0x11f299++){var _0x372e33=events[_0x11f299];var _0x5a9e0f=createListener(_0xc53b('0x7')+_0x372e33,_0x598ca7);NotificationEvents['on'](_0x372e33,_0x5a9e0f);}}; \ No newline at end of file +var _0xe490=['remove','emit','removeListener','register','length','notification:','./notification.events','save'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe490,0xae));var _0x0e49=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xe490[_0x33032e];return _0x13316b;};'use strict';var NotificationEvents=require(_0x0e49('0x0'));var events=[_0x0e49('0x1'),_0x0e49('0x2'),'update'];function createListener(_0x5e9149,_0x336188){return function(_0x4e103f){_0x336188[_0x0e49('0x3')](_0x5e9149,_0x4e103f);};}function removeListener(_0xd5405a,_0x19048a){return function(){NotificationEvents[_0x0e49('0x4')](_0xd5405a,_0x19048a);};}exports[_0x0e49('0x5')]=function(_0x35d310){for(var _0x3481e7=0x0,_0x80f2c7=events[_0x0e49('0x6')];_0x3481e7<_0x80f2c7;_0x3481e7++){var _0x5e8a4c=events[_0x3481e7];var _0x307600=createListener(_0x0e49('0x7')+_0x5e8a4c,_0x35d310);NotificationEvents['on'](_0x5e8a4c,_0x307600);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index a29a797..779d5b2 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 _0xed4f=['delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./openchannelAccount.controller','isAuthenticated','index','get','/describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','update'];(function(_0x178fd8,_0x29024b){var _0x4c41eb=function(_0x692e4e){while(--_0x692e4e){_0x178fd8['push'](_0x178fd8['shift']());}};_0x4c41eb(++_0x29024b);}(_0xed4f,0x79));var _0xfed4=function(_0x2453b4,_0x2203ac){_0x2453b4=_0x2453b4-0x0;var _0x343772=_0xed4f[_0x2453b4];return _0x343772;};'use strict';var multer=require(_0xfed4('0x0'));var util=require(_0xfed4('0x1'));var path=require(_0xfed4('0x2'));var timeout=require(_0xfed4('0x3'));var express=require(_0xfed4('0x4'));var router=express[_0xfed4('0x5')]();var auth=require(_0xfed4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfed4('0x7'));router['get']('/',auth[_0xfed4('0x8')](),controller[_0xfed4('0x9')]);router[_0xfed4('0xa')](_0xfed4('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xfed4('0xa')](_0xfed4('0xc'),auth[_0xfed4('0x8')](),controller['show']);router['get'](_0xfed4('0xd'),auth[_0xfed4('0x8')](),controller[_0xfed4('0xe')]);router[_0xfed4('0xa')]('/:id/canned_answers',auth[_0xfed4('0x8')](),controller[_0xfed4('0xf')]);router['get'](_0xfed4('0x10'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x11')]);router[_0xfed4('0xa')](_0xfed4('0x12'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x13')]);router[_0xfed4('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xfed4('0x14')]);router[_0xfed4('0x15')]('/',auth[_0xfed4('0x8')](),controller[_0xfed4('0x16')]);router[_0xfed4('0x15')](_0xfed4('0xd'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x17')]);router[_0xfed4('0x15')](_0xfed4('0x18'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x19')]);router['post'](_0xfed4('0x1a'),controller[_0xfed4('0x1b')]);router[_0xfed4('0x15')](_0xfed4('0x10'),auth['isAuthenticated'](),controller[_0xfed4('0x1c')]);router['post'](_0xfed4('0x1d'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x1e')]);router[_0xfed4('0x15')](_0xfed4('0x1f'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x20')]);router[_0xfed4('0x21')](_0xfed4('0xc'),auth['isAuthenticated'](),controller[_0xfed4('0x22')]);router[_0xfed4('0x23')](_0xfed4('0xc'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x24')]);router[_0xfed4('0x23')](_0xfed4('0xd'),auth[_0xfed4('0x8')](),controller['removeDispositions']);router['delete'](_0xfed4('0x18'),auth[_0xfed4('0x8')](),controller['removeAnswers']);router[_0xfed4('0x23')](_0xfed4('0x1d'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x25')]);module[_0xfed4('0x26')]=router; \ No newline at end of file +var _0x2852=['getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','post','addAnswer','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2852,0x1f0));var _0x2285=function(_0x47a4f6,_0x3030bf){_0x47a4f6=_0x47a4f6-0x0;var _0x29f3a7=_0x2852[_0x47a4f6];return _0x29f3a7;};'use strict';var multer=require(_0x2285('0x0'));var util=require(_0x2285('0x1'));var path=require(_0x2285('0x2'));var timeout=require('connect-timeout');var express=require(_0x2285('0x3'));var router=express[_0x2285('0x4')]();var auth=require(_0x2285('0x5'));var interaction=require(_0x2285('0x6'));var config=require(_0x2285('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2285('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2285('0x8')](_0x2285('0x9'),auth[_0x2285('0xa')](),controller['show']);router[_0x2285('0x8')](_0x2285('0xb'),auth[_0x2285('0xa')](),controller[_0x2285('0xc')]);router[_0x2285('0x8')](_0x2285('0xd'),auth[_0x2285('0xa')](),controller[_0x2285('0xe')]);router[_0x2285('0x8')](_0x2285('0xf'),auth['isAuthenticated'](),controller[_0x2285('0x10')]);router['get'](_0x2285('0x11'),auth[_0x2285('0xa')](),controller[_0x2285('0x12')]);router['get']('/:id/users',auth[_0x2285('0xa')](),controller['getAgents']);router[_0x2285('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2285('0x13')](_0x2285('0xb'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x2285('0xd'),auth[_0x2285('0xa')](),controller[_0x2285('0x14')]);router['post']('/:id/notify',controller[_0x2285('0x15')]);router['post'](_0x2285('0xf'),auth[_0x2285('0xa')](),controller[_0x2285('0x16')]);router[_0x2285('0x13')](_0x2285('0x17'),auth[_0x2285('0xa')](),controller[_0x2285('0x18')]);router['post'](_0x2285('0x19'),auth[_0x2285('0xa')](),controller[_0x2285('0x1a')]);router[_0x2285('0x1b')](_0x2285('0x9'),auth[_0x2285('0xa')](),controller[_0x2285('0x1c')]);router[_0x2285('0x1d')](_0x2285('0x9'),auth[_0x2285('0xa')](),controller[_0x2285('0x1e')]);router['delete'](_0x2285('0xb'),auth['isAuthenticated'](),controller[_0x2285('0x1f')]);router[_0x2285('0x1d')](_0x2285('0xd'),auth[_0x2285('0xa')](),controller[_0x2285('0x20')]);router[_0x2285('0x1d')](_0x2285('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x2285('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 469ff07..e75be4e 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 _0xc62a=['STRING','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','sequelize','exports','name'];(function(_0x38c3fc,_0x45612f){var _0x494073=function(_0x30c868){while(--_0x30c868){_0x38c3fc['push'](_0x38c3fc['shift']());}};_0x494073(++_0x45612f);}(_0xc62a,0xc9));var _0xac62=function(_0x13dfc0,_0x576169){_0x13dfc0=_0x13dfc0-0x0;var _0xb56571=_0xc62a[_0x13dfc0];return _0xb56571;};'use strict';var Sequelize=require(_0xac62('0x0'));var rs=require('randomstring');module[_0xac62('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xac62('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xac62('0x3')]},'token':{'type':Sequelize[_0xac62('0x3')],'defaultValue':function(){return rs[_0xac62('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xac62('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xac62('0x5')],'defaultValue':function(){return _0xac62('0x6');}},'notificationSound':{'type':Sequelize[_0xac62('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xac62('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xac62('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xac62('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xac62('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xac62('0x9'),'set':function(_0x3439d1){if(!_0x3439d1)this['setDataValue'](_0xac62('0xa'),null);this[_0xac62('0xb')]('mandatoryDisposition',_0x3439d1);}}}; \ No newline at end of file +var _0x7ead=['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','randomstring','exports','STRING','name'];(function(_0x97d527,_0x198ff0){var _0x502ae0=function(_0x4e78fe){while(--_0x4e78fe){_0x97d527['push'](_0x97d527['shift']());}};_0x502ae0(++_0x198ff0);}(_0x7ead,0x79));var _0xd7ea=function(_0x1a4966,_0x4bf333){_0x1a4966=_0x1a4966-0x0;var _0x11cba6=_0x7ead[_0x1a4966];return _0x11cba6;};'use strict';var Sequelize=require(_0xd7ea('0x0'));var rs=require(_0xd7ea('0x1'));module[_0xd7ea('0x2')]={'name':{'type':Sequelize[_0xd7ea('0x3')],'unique':_0xd7ea('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xd7ea('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd7ea('0x5')]();}},'replyUri':{'type':Sequelize[_0xd7ea('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xd7ea('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd7ea('0x6')],'defaultValue':function(){return _0xd7ea('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd7ea('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd7ea('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd7ea('0x3')]},'queueTransfer':{'type':Sequelize[_0xd7ea('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd7ea('0x9')],'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[_0xd7ea('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd7ea('0xa'),'set':function(_0x47b289){if(!_0x47b289)this[_0xd7ea('0xb')](_0xd7ea('0xc'),null);this[_0xd7ea('0xb')](_0xd7ea('0xd'),_0x47b289);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 05e8262..33d38c7 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 _0xb106=['json','count','offset','limit','set','apply','reject','save','destroy','get','OpenchannelAccounts','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','ids','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','Applications','List','account','applications','orderBy','priority','defaults','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','findAndCountAll','getApplications','getInteractions','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','send','Contacts','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','./openchannelAccount.socket','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end'];(function(_0x3d017e,_0x4bd1bb){var _0x300160=function(_0x54b05a){while(--_0x54b05a){_0x3d017e['push'](_0x3d017e['shift']());}};_0x300160(++_0x4bd1bb);}(_0xb106,0x144));var _0x6b10=function(_0x528342,_0x17a981){_0x528342=_0x528342-0x0;var _0x27dd91=_0xb106[_0x528342];return _0x27dd91;};'use strict';var pdf=require(_0x6b10('0x0'));var emlformat=require(_0x6b10('0x1'));var rimraf=require(_0x6b10('0x2'));var zipdir=require(_0x6b10('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b10('0x4'));var moment=require('moment');var BPromise=require(_0x6b10('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6b10('0x6'));var sox=require(_0x6b10('0x7'));var csv=require(_0x6b10('0x8'));var ejs=require(_0x6b10('0x9'));var fs=require('fs');var _=require(_0x6b10('0xa'));var squel=require(_0x6b10('0xb'));var crypto=require(_0x6b10('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b10('0xd'));var Papa=require(_0x6b10('0xe'));var Redis=require(_0x6b10('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6b10('0x10'));var as=require(_0x6b10('0x11'));var hardwareService=require(_0x6b10('0x12'));var logger=require(_0x6b10('0x13'))(_0x6b10('0x14'));var utils=require(_0x6b10('0x15'));var config=require(_0x6b10('0x16'));var db=require('../../mysqldb')['db'];config[_0x6b10('0x17')]=_['defaults'](config[_0x6b10('0x17')],{'host':_0x6b10('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b10('0x17')]));require(_0x6b10('0x19'))['register'](socket);var jayson=require(_0x6b10('0x1a'));var client=jayson[_0x6b10('0x1b')][_0x6b10('0x1c')]({'port':0x232c});var client9002=jayson[_0x6b10('0x1b')][_0x6b10('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x304bd1,_0x3fe4a4,_0x4f5c3d){if(_0x4f5c3d){var _0x5c5c56=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c5c56[_0x6b10('0x1d')](_0x3fe4a4)){return _0x304bd1;}else{throw new db[(_0x6b10('0x1e'))]['ValidationError'](_0x6b10('0x1f'));}}else{return _0x304bd1;}}function respondWithRpcPromise(_0x34a1a5,_0x8d3581,_0x48d40f,_0x404c6f){return new BPromise(function(_0x1813b4,_0xbfd954){var _0x1f7aed=_0x404c6f||client;return _0x1f7aed['request'](_0x34a1a5,_0x48d40f)[_0x6b10('0x20')](function(_0x57c688){logger[_0x6b10('0x21')](_0x6b10('0x22'),_0x8d3581,'request\x20sent');logger[_0x6b10('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x8d3581,_0x6b10('0x24'),JSON[_0x6b10('0x25')](_0x57c688));if(_0x57c688[_0x6b10('0x26')]){if(_0x57c688[_0x6b10('0x26')][_0x6b10('0x27')]===0x1f4){logger[_0x6b10('0x26')](_0x6b10('0x22'),_0x8d3581,_0x57c688[_0x6b10('0x26')][_0x6b10('0x28')]);return _0xbfd954(_0x57c688[_0x6b10('0x26')]['message']);}logger[_0x6b10('0x26')](_0x6b10('0x22'),_0x8d3581,_0x57c688[_0x6b10('0x26')][_0x6b10('0x28')]);return _0x1813b4(_0x57c688['error'][_0x6b10('0x28')]);}else{logger[_0x6b10('0x21')](_0x6b10('0x22'),_0x8d3581,_0x6b10('0x24'));_0x1813b4(_0x57c688[_0x6b10('0x29')][_0x6b10('0x28')]);}})[_0x6b10('0x2a')](function(_0xfafe02){logger['error'](_0x6b10('0x22'),_0x8d3581,_0xfafe02);_0xbfd954(_0xfafe02);});});}function respondWithStatusCode(_0x1552ba,_0xac6d8e){_0xac6d8e=_0xac6d8e||0xcc;return function(_0x3af19d){if(_0x3af19d){return _0x1552ba[_0x6b10('0x2b')](_0xac6d8e);}return _0x1552ba[_0x6b10('0x2c')](_0xac6d8e)[_0x6b10('0x2d')]();};}function respondWithResult(_0x23329a,_0x17d798){_0x17d798=_0x17d798||0xc8;return function(_0x33421e){if(_0x33421e){return _0x23329a[_0x6b10('0x2c')](_0x17d798)[_0x6b10('0x2e')](_0x33421e);}};}function respondWithFilteredResult(_0x49e2f5,_0x3f0304){return function(_0x255dff){if(_0x255dff){var _0x59b560=_0x255dff[_0x6b10('0x2f')],_0x43096a=_0x3f0304[_0x6b10('0x30')],_0x2a9de1=_0x3f0304[_0x6b10('0x30')]+_0x3f0304[_0x6b10('0x31')],_0x4500aa;if(_0x2a9de1>=_0x59b560){_0x2a9de1=_0x59b560;_0x4500aa=0xc8;}else{_0x4500aa=0xce;}_0x49e2f5[_0x6b10('0x2c')](_0x4500aa);return _0x49e2f5[_0x6b10('0x32')]('Content-Range',_0x43096a+'-'+_0x2a9de1+'/'+_0x59b560)[_0x6b10('0x2e')](_0x255dff);}return null;};}function patchUpdates(_0x49fcd3){return function(_0x2fb452){try{jsonpatch[_0x6b10('0x33')](_0x2fb452,_0x49fcd3,!![]);}catch(_0x17dbe5){return BPromise[_0x6b10('0x34')](_0x17dbe5);}return _0x2fb452[_0x6b10('0x35')]();};}function saveUpdates(_0x3add4c,_0x3e6b1a){return function(_0x547b21){if(_0x547b21){return _0x547b21['update'](_0x3add4c)['then'](function(_0x207b8c){return _0x207b8c;});}return null;};}function removeEntity(_0x2900bb,_0x45e8be){return function(_0x6a40ec){if(_0x6a40ec){return _0x6a40ec[_0x6b10('0x36')]()[_0x6b10('0x20')](function(){var _0x345298=_0x6a40ec[_0x6b10('0x37')]({'plain':!![]});var _0x285669=_0x6b10('0x38');return db['UserProfileResource'][_0x6b10('0x36')]({'where':{'type':_0x285669,'resourceId':_0x345298['id']}})[_0x6b10('0x20')](function(){return _0x6a40ec;});})['then'](function(){_0x2900bb[_0x6b10('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26a2b8,_0x4b8510){return function(_0x1fbbfb){if(!_0x1fbbfb){_0x26a2b8[_0x6b10('0x2b')](0x194);}return _0x1fbbfb;};}function handleError(_0x92c5e9,_0x2e3088){_0x2e3088=_0x2e3088||0x1f4;return function(_0x2d5c3a){logger['error'](_0x2d5c3a['stack']);if(_0x2d5c3a[_0x6b10('0x39')]){delete _0x2d5c3a[_0x6b10('0x39')];}_0x92c5e9[_0x6b10('0x2c')](_0x2e3088)['send'](_0x2d5c3a);};}exports[_0x6b10('0x3a')]=function(_0x502c17,_0x2b50b6){var _0x31fd2c={'include':[{'model':db[_0x6b10('0x3b')],'as':_0x6b10('0x3c')}]},_0x32b4cd={},_0x46359d={'count':0x0,'rows':[]};var _0x53ef2e=_[_0x6b10('0x3d')](db[_0x6b10('0x3e')][_0x6b10('0x3f')],function(_0xc05c7b){return{'name':_0xc05c7b[_0x6b10('0x40')],'type':_0xc05c7b[_0x6b10('0x41')][_0x6b10('0x42')]};});_0x32b4cd['model']=_[_0x6b10('0x3d')](_0x53ef2e,_0x6b10('0x39'));_0x32b4cd[_0x6b10('0x43')]=_[_0x6b10('0x44')](_0x502c17[_0x6b10('0x43')]);_0x32b4cd[_0x6b10('0x45')]=_[_0x6b10('0x46')](_0x32b4cd[_0x6b10('0x47')],_0x32b4cd['query']);_0x31fd2c['attributes']=_['intersection'](_0x32b4cd[_0x6b10('0x47')],qs[_0x6b10('0x48')](_0x502c17[_0x6b10('0x43')][_0x6b10('0x48')]));_0x31fd2c['attributes']=_0x31fd2c[_0x6b10('0x49')][_0x6b10('0x4a')]?_0x31fd2c['attributes']:_0x32b4cd[_0x6b10('0x47')];if(!_0x502c17['query'][_0x6b10('0x4b')](_0x6b10('0x4c'))){_0x31fd2c[_0x6b10('0x31')]=qs[_0x6b10('0x31')](_0x502c17[_0x6b10('0x43')][_0x6b10('0x31')]);_0x31fd2c['offset']=qs[_0x6b10('0x30')](_0x502c17[_0x6b10('0x43')]['offset']);}_0x31fd2c[_0x6b10('0x4d')]=qs[_0x6b10('0x4e')](_0x502c17[_0x6b10('0x43')][_0x6b10('0x4e')]);_0x31fd2c[_0x6b10('0x4f')]=qs[_0x6b10('0x45')](_['pick'](_0x502c17[_0x6b10('0x43')],_0x32b4cd[_0x6b10('0x45')]),_0x53ef2e);if(_0x502c17[_0x6b10('0x43')]['filter']){_0x31fd2c[_0x6b10('0x4f')]=_[_0x6b10('0x50')](_0x31fd2c[_0x6b10('0x4f')],{'$or':_[_0x6b10('0x3d')](_0x53ef2e,function(_0xf4ae95){if(_0xf4ae95[_0x6b10('0x41')]!=='VIRTUAL'){var _0x25fce3={};_0x25fce3[_0xf4ae95[_0x6b10('0x39')]]={'$like':'%'+_0x502c17['query'][_0x6b10('0x51')]+'%'};return _0x25fce3;}})});}_0x31fd2c=_[_0x6b10('0x50')]({},_0x31fd2c,_0x502c17[_0x6b10('0x52')]);var _0x22446d={'where':_0x31fd2c[_0x6b10('0x4f')]};return db[_0x6b10('0x3e')][_0x6b10('0x2f')](_0x22446d)['then'](function(_0x57ea6b){_0x46359d[_0x6b10('0x2f')]=_0x57ea6b;if(_0x502c17[_0x6b10('0x43')][_0x6b10('0x53')]){_0x31fd2c[_0x6b10('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x6b10('0x55')](_0x31fd2c);})[_0x6b10('0x20')](function(_0x92268a){_0x46359d[_0x6b10('0x56')]=_0x92268a;return _0x46359d;})[_0x6b10('0x20')](respondWithFilteredResult(_0x2b50b6,_0x31fd2c))['catch'](handleError(_0x2b50b6,null));};exports[_0x6b10('0x57')]=function(_0x3c572b,_0x2c4276){var _0x4d67e4={'raw':![],'where':{'id':_0x3c572b['params']['id']},'include':[{'model':db[_0x6b10('0x3b')],'as':'mandatoryDispositionPause'}]},_0x28ca69={};_0x28ca69[_0x6b10('0x47')]=_[_0x6b10('0x44')](db[_0x6b10('0x3e')][_0x6b10('0x3f')]);_0x28ca69[_0x6b10('0x43')]=_[_0x6b10('0x44')](_0x3c572b[_0x6b10('0x43')]);_0x28ca69['filters']=_[_0x6b10('0x46')](_0x28ca69['model'],_0x28ca69[_0x6b10('0x43')]);_0x4d67e4[_0x6b10('0x49')]=_[_0x6b10('0x46')](_0x28ca69['model'],qs[_0x6b10('0x48')](_0x3c572b[_0x6b10('0x43')][_0x6b10('0x48')]));_0x4d67e4[_0x6b10('0x49')]=_0x4d67e4[_0x6b10('0x49')]['length']?_0x4d67e4[_0x6b10('0x49')]:_0x28ca69[_0x6b10('0x47')];if(_0x3c572b[_0x6b10('0x43')][_0x6b10('0x53')]){_0x4d67e4[_0x6b10('0x54')]=[{'all':!![]}];}_0x4d67e4=_['merge']({},_0x4d67e4,_0x3c572b['options']);return db[_0x6b10('0x3e')]['find'](_0x4d67e4)['then'](handleEntityNotFound(_0x2c4276,null))[_0x6b10('0x20')](respondWithResult(_0x2c4276,null))[_0x6b10('0x2a')](handleError(_0x2c4276,null));};exports[_0x6b10('0x58')]=function(_0x558a7b,_0x1aa148){return db['OpenchannelAccount'][_0x6b10('0x58')](_0x558a7b[_0x6b10('0x59')],{})[_0x6b10('0x20')](function(_0x37ded7){var _0x4235d3=_0x558a7b[_0x6b10('0x5a')][_0x6b10('0x37')]({'plain':!![]});if(!_0x4235d3)throw new Error(_0x6b10('0x5b'));if(_0x4235d3[_0x6b10('0x5c')]===_0x6b10('0x5a')){var _0x51fa7e=_0x37ded7['get']({'plain':!![]});var _0x51c04d='OpenchannelAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x51c04d,'userProfileId':_0x4235d3[_0x6b10('0x5d')]},'raw':!![]})[_0x6b10('0x20')](function(_0x3fcbe6){if(_0x3fcbe6&&_0x3fcbe6[_0x6b10('0x5e')]===0x0){return db['UserProfileResource'][_0x6b10('0x58')]({'name':_0x51fa7e['name'],'resourceId':_0x51fa7e['id'],'type':_0x3fcbe6[_0x6b10('0x39')],'sectionId':_0x3fcbe6['id']},{})[_0x6b10('0x20')](function(){return _0x37ded7;});}else{return _0x37ded7;}})[_0x6b10('0x2a')](function(_0xe6c3ec){logger['error'](_0x6b10('0x5f'),_0xe6c3ec);throw _0xe6c3ec;});}return _0x37ded7;})['then'](respondWithResult(_0x1aa148,0xc9))[_0x6b10('0x2a')](handleError(_0x1aa148,null));};exports['update']=function(_0x446794,_0x5e0f95){if(_0x446794[_0x6b10('0x59')]['id']){delete _0x446794[_0x6b10('0x59')]['id'];}return db[_0x6b10('0x3e')][_0x6b10('0x60')]({'where':{'id':_0x446794[_0x6b10('0x61')]['id']},'include':[{'model':db[_0x6b10('0x3b')],'as':_0x6b10('0x3c')}]})[_0x6b10('0x20')](handleEntityNotFound(_0x5e0f95,null))[_0x6b10('0x20')](saveUpdates(_0x446794[_0x6b10('0x59')],null))[_0x6b10('0x20')](respondWithResult(_0x5e0f95,null))[_0x6b10('0x2a')](handleError(_0x5e0f95,null));};exports['destroy']=function(_0x148b9b,_0x5b0242){return db['OpenchannelAccount'][_0x6b10('0x60')]({'where':{'id':_0x148b9b[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x5b0242,null))[_0x6b10('0x20')](removeEntity(_0x5b0242,null))['catch'](handleError(_0x5b0242,null));};exports['describe']=function(_0x2eee98,_0x3fa8f1){return db[_0x6b10('0x3e')]['describe']()[_0x6b10('0x20')](respondWithResult(_0x3fa8f1,null))[_0x6b10('0x2a')](handleError(_0x3fa8f1,null));};exports[_0x6b10('0x62')]=function(_0x5acf52,_0x276629,_0x3f5145){if(_0x5acf52[_0x6b10('0x59')]['id']){delete _0x5acf52[_0x6b10('0x59')]['id'];}return db[_0x6b10('0x3e')][_0x6b10('0x60')]({'where':{'id':_0x5acf52[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x276629,null))['then'](function(_0x57fa24){if(_0x57fa24){_0x5acf52[_0x6b10('0x59')]['OpnechannelAccountId']=_0x57fa24['id'];return db[_0x6b10('0x63')][_0x6b10('0x58')](_0x5acf52[_0x6b10('0x59')]);}})[_0x6b10('0x20')](respondWithResult(_0x276629,null))[_0x6b10('0x2a')](handleError(_0x276629,null));};exports[_0x6b10('0x64')]=function(_0x4f730b,_0x49520a,_0x4f08af){var _0x49bb92={'raw':![],'where':{}};var _0x4c7d22={};var _0x476707={'count':0x0,'rows':[]};return db[_0x6b10('0x3e')][_0x6b10('0x65')]({'where':{'id':_0x4f730b['params']['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x49520a,null))[_0x6b10('0x20')](function(_0x1dc190){if(_0x1dc190){_0x4c7d22['model']=_['keys'](db[_0x6b10('0x63')][_0x6b10('0x3f')]);_0x4c7d22['query']=_[_0x6b10('0x44')](_0x4f730b[_0x6b10('0x43')]);_0x4c7d22[_0x6b10('0x45')]=_[_0x6b10('0x46')](_0x4c7d22[_0x6b10('0x47')],_0x4c7d22['query']);_0x49bb92['attributes']=_[_0x6b10('0x46')](_0x4c7d22[_0x6b10('0x47')],qs[_0x6b10('0x48')](_0x4f730b[_0x6b10('0x43')][_0x6b10('0x48')]));_0x49bb92[_0x6b10('0x49')]=_0x49bb92['attributes'][_0x6b10('0x4a')]?_0x49bb92[_0x6b10('0x49')]:_0x4c7d22[_0x6b10('0x47')];if(!_0x4f730b[_0x6b10('0x43')][_0x6b10('0x4b')](_0x6b10('0x4c'))){_0x49bb92[_0x6b10('0x31')]=qs[_0x6b10('0x31')](_0x4f730b[_0x6b10('0x43')][_0x6b10('0x31')]);_0x49bb92[_0x6b10('0x30')]=qs[_0x6b10('0x30')](_0x4f730b[_0x6b10('0x43')]['offset']);}_0x49bb92[_0x6b10('0x4d')]=qs[_0x6b10('0x4e')](_0x4f730b[_0x6b10('0x43')][_0x6b10('0x4e')]);_0x49bb92[_0x6b10('0x4f')]=qs[_0x6b10('0x45')](_['pick'](_0x4f730b[_0x6b10('0x43')],_0x4c7d22['filters']));_0x49bb92['where'][_0x6b10('0x66')]=_0x1dc190['id'];if(_0x4f730b[_0x6b10('0x43')][_0x6b10('0x51')]){_0x49bb92[_0x6b10('0x4f')]=_['merge'](_0x49bb92[_0x6b10('0x4f')],{'$or':_[_0x6b10('0x3d')](_0x49bb92[_0x6b10('0x49')],function(_0x264b7a){var _0x27d52c={};_0x27d52c[_0x264b7a]={'$like':'%'+_0x4f730b[_0x6b10('0x43')]['filter']+'%'};return _0x27d52c;})});}_0x49bb92=_[_0x6b10('0x50')]({},_0x49bb92,_0x4f730b[_0x6b10('0x52')]);return db[_0x6b10('0x63')]['count']({'where':_0x49bb92['where']})['then'](function(_0x387549){_0x476707[_0x6b10('0x2f')]=_0x387549;if(_0x4f730b[_0x6b10('0x43')][_0x6b10('0x53')]){_0x49bb92[_0x6b10('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x6b10('0x55')](_0x49bb92);})['then'](function(_0x14d9f6){_0x476707[_0x6b10('0x56')]=_0x14d9f6;return _0x476707;});}})[_0x6b10('0x20')](respondWithFilteredResult(_0x49520a,_0x49bb92))['catch'](handleError(_0x49520a,null));};exports[_0x6b10('0x67')]=function(_0xaf4197,_0x2352dc,_0x4e71b3){return db[_0x6b10('0x3e')]['find']({'where':{'id':_0xaf4197[_0x6b10('0x61')]['id']}})['then'](handleEntityNotFound(_0x2352dc,null))['then'](function(_0x356304){if(_0x356304){return _0x356304['removeDispositions'](_0xaf4197[_0x6b10('0x43')]['ids']);}})[_0x6b10('0x20')](respondWithStatusCode(_0x2352dc,null))[_0x6b10('0x2a')](handleError(_0x2352dc,null));};exports[_0x6b10('0x68')]=function(_0xeb3df5,_0x5de896,_0xaf59ab){if(_0xeb3df5[_0x6b10('0x59')]['id']){delete _0xeb3df5['body']['id'];}return db[_0x6b10('0x3e')][_0x6b10('0x60')]({'where':{'id':_0xeb3df5[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x5de896,null))['then'](function(_0xe8c89){if(_0xe8c89){_0xeb3df5['body'][_0x6b10('0x66')]=_0xe8c89['id'];return db[_0x6b10('0x69')][_0x6b10('0x58')](_0xeb3df5[_0x6b10('0x59')]);}})['then'](respondWithResult(_0x5de896,null))[_0x6b10('0x2a')](handleError(_0x5de896,null));};exports[_0x6b10('0x6a')]=function(_0x451451,_0x57049e,_0x3f6113){var _0x279603={'raw':![],'where':{}};var _0x565614={};var _0x5ebf97={'count':0x0,'rows':[]};return db[_0x6b10('0x3e')][_0x6b10('0x65')]({'where':{'id':_0x451451[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x57049e,null))[_0x6b10('0x20')](function(_0x1efeac){if(_0x1efeac){_0x565614[_0x6b10('0x47')]=_['keys'](db[_0x6b10('0x69')][_0x6b10('0x3f')]);_0x565614[_0x6b10('0x43')]=_['keys'](_0x451451['query']);_0x565614[_0x6b10('0x45')]=_[_0x6b10('0x46')](_0x565614[_0x6b10('0x47')],_0x565614[_0x6b10('0x43')]);_0x279603[_0x6b10('0x49')]=_[_0x6b10('0x46')](_0x565614[_0x6b10('0x47')],qs['fields'](_0x451451[_0x6b10('0x43')][_0x6b10('0x48')]));_0x279603[_0x6b10('0x49')]=_0x279603[_0x6b10('0x49')][_0x6b10('0x4a')]?_0x279603['attributes']:_0x565614[_0x6b10('0x47')];if(!_0x451451[_0x6b10('0x43')][_0x6b10('0x4b')](_0x6b10('0x4c'))){_0x279603[_0x6b10('0x31')]=qs[_0x6b10('0x31')](_0x451451[_0x6b10('0x43')]['limit']);_0x279603['offset']=qs[_0x6b10('0x30')](_0x451451[_0x6b10('0x43')][_0x6b10('0x30')]);}_0x279603[_0x6b10('0x4d')]=qs[_0x6b10('0x4e')](_0x451451[_0x6b10('0x43')]['sort']);_0x279603[_0x6b10('0x4f')]=qs[_0x6b10('0x45')](_[_0x6b10('0x6b')](_0x451451[_0x6b10('0x43')],_0x565614[_0x6b10('0x45')]));_0x279603[_0x6b10('0x4f')][_0x6b10('0x66')]=_0x1efeac['id'];if(_0x451451[_0x6b10('0x43')][_0x6b10('0x51')]){_0x279603['where']=_[_0x6b10('0x50')](_0x279603['where'],{'$or':_[_0x6b10('0x3d')](_0x279603[_0x6b10('0x49')],function(_0x288cbd){var _0x1171b9={};_0x1171b9[_0x288cbd]={'$like':'%'+_0x451451[_0x6b10('0x43')][_0x6b10('0x51')]+'%'};return _0x1171b9;})});}_0x279603=_[_0x6b10('0x50')]({},_0x279603,_0x451451['options']);return db[_0x6b10('0x69')][_0x6b10('0x2f')]({'where':_0x279603[_0x6b10('0x4f')]})[_0x6b10('0x20')](function(_0xd09f9a){_0x5ebf97[_0x6b10('0x2f')]=_0xd09f9a;if(_0x451451[_0x6b10('0x43')][_0x6b10('0x53')]){_0x279603[_0x6b10('0x54')]=[{'all':!![]}];}return db[_0x6b10('0x69')][_0x6b10('0x55')](_0x279603);})[_0x6b10('0x20')](function(_0x2af676){_0x5ebf97[_0x6b10('0x56')]=_0x2af676;return _0x5ebf97;});}})[_0x6b10('0x20')](respondWithFilteredResult(_0x57049e,_0x279603))[_0x6b10('0x2a')](handleError(_0x57049e,null));};exports[_0x6b10('0x6c')]=function(_0x22c3b5,_0x40c972,_0xc72632){return db['OpenchannelAccount']['find']({'where':{'id':_0x22c3b5[_0x6b10('0x61')]['id']}})['then'](handleEntityNotFound(_0x40c972,null))[_0x6b10('0x20')](function(_0xa8a4aa){if(_0xa8a4aa){return _0xa8a4aa[_0x6b10('0x6c')](_0x22c3b5[_0x6b10('0x43')][_0x6b10('0x6d')]);}})['then'](respondWithStatusCode(_0x40c972,null))[_0x6b10('0x2a')](handleError(_0x40c972,null));};exports[_0x6b10('0x6e')]=function(_0x1bdfdf,_0x3c24e9,_0x92bd99){var _0x2c4a13={'body':_0x1bdfdf[_0x6b10('0x59')],'channel':_0x6b10('0x6f')};var _0x3a9c11=[];var _0x5aa522=[];var _0x4db4ca={};var _0x3c97aa=![];return db[_0x6b10('0x70')]['describe']()[_0x6b10('0x20')](function(_0x4d7083){if(!_0x4d7083){throw new db['Sequelize'][(_0x6b10('0x71'))](_0x6b10('0x72'));}_0x3a9c11=_[_0x6b10('0x73')](_[_0x6b10('0x44')](_0x4d7083),[_0x6b10('0x74'),_0x6b10('0x75')]);_0x5aa522=_[_0x6b10('0x73')](_[_0x6b10('0x44')](_0x4d7083),[_0x6b10('0x74'),_0x6b10('0x75'),_0x6b10('0x76'),_0x6b10('0x77')]);if(_0x1bdfdf['body']['id']){delete _0x1bdfdf[_0x6b10('0x59')]['id'];}if(_[_0x6b10('0x78')](_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x79')])){throw new db['Sequelize'][(_0x6b10('0x71'))](_0x6b10('0x7a'));}if(_[_0x6b10('0x78')](_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x59')])||_0x1bdfdf['body'][_0x6b10('0x59')]===''){throw new db[(_0x6b10('0x1e'))][(_0x6b10('0x71'))](_0x6b10('0x7b'));}if(_[_0x6b10('0x78')](_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x7c')])){throw new db[(_0x6b10('0x1e'))][(_0x6b10('0x71'))](_0x6b10('0x7d')+_0x5aa522);}if(!_[_0x6b10('0x7e')](_0x5aa522,_0x1bdfdf['body'][_0x6b10('0x7c')])){throw new db[(_0x6b10('0x1e'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5aa522);}_0x4db4ca[_0x1bdfdf[_0x6b10('0x59')]['mapKey']]=_0x1bdfdf[_0x6b10('0x59')]['from'];})[_0x6b10('0x20')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x1bdfdf['params']['id']},'include':[{'model':db[_0x6b10('0x7f')],'as':'List','include':[{'model':db[_0x6b10('0x70')],'as':'Contacts','where':_0x4db4ca,'limit':0x1,'order':[[_0x6b10('0x75'),_0x6b10('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x6b10('0x81')}]});})[_0x6b10('0x20')](handleEntityNotFound(_0x3c24e9,null))[_0x6b10('0x20')](function(_0x54ee48){if(_0x54ee48&&_0x54ee48[_0x6b10('0x82')]){_0x2c4a13[_0x6b10('0x83')]=_0x54ee48;_0x2c4a13[_0x6b10('0x84')]=_0x54ee48['Applications'];_0x2c4a13['list']=_0x54ee48[_0x6b10('0x82')];_0x2c4a13[_0x6b10('0x84')]=_[_0x6b10('0x85')](_0x2c4a13[_0x6b10('0x84')],[_0x6b10('0x86')],['asc']);if(_0x2c4a13['account'][_0x6b10('0x81')]){delete _0x2c4a13['account'][_0x6b10('0x81')];}if(_0x2c4a13[_0x6b10('0x83')]['List']&&_0x2c4a13[_0x6b10('0x83')][_0x6b10('0x82')]['Contacts']['length']){return _0x2c4a13[_0x6b10('0x83')][_0x6b10('0x82')]['Contacts'][0x0];}var _0x4419ec=_[_0x6b10('0x87')](_0x1bdfdf[_0x6b10('0x59')],{'firstName':_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x79')],'ListId':_0x54ee48['ListId']});_0x4419ec[_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x7c')]]=_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x79')];return db[_0x6b10('0x70')][_0x6b10('0x58')](_0x4419ec,{'fields':_0x3a9c11,'raw':!![]});}})[_0x6b10('0x20')](handleEntityNotFound(_0x3c24e9,null))[_0x6b10('0x20')](function(_0x272009){_0x2c4a13[_0x6b10('0x88')]=_0x272009;if(_0x272009){var _0x51f1eb={'ContactId':_0x272009['id'],'OpenchannelAccountId':_0x1bdfdf[_0x6b10('0x61')]['id'],'from':(_0x272009[_0x6b10('0x89')]||'')+'\x20'+(_0x272009['lastName']||'')};var _0x1e9374={'OpenchannelAccountId':_0x1bdfdf[_0x6b10('0x61')]['id'],'closed':![]};if(_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x8a')]){_0x1e9374[_0x6b10('0x8a')]=_0x1bdfdf['body'][_0x6b10('0x8a')];return db[_0x6b10('0x8b')][_0x6b10('0x60')]({'where':_0x1e9374})[_0x6b10('0x20')](function(_0x5337e7){if(_0x5337e7){return[_0x5337e7,![]];}_0x51f1eb[_0x6b10('0x8a')]=_0x1bdfdf['body'][_0x6b10('0x8a')];_0x51f1eb[_0x6b10('0x8c')]=_0x1bdfdf['body']['externalUrl'];return db['OpenchannelInteraction'][_0x6b10('0x58')](_0x51f1eb)[_0x6b10('0x20')](function(_0x31cda5){return[_0x31cda5,!![]];});});}else{_0x1e9374['threadId']=null;}_0x1e9374[_0x6b10('0x8d')]=_0x272009['id'];return db[_0x6b10('0x8b')][_0x6b10('0x60')]({'where':_0x1e9374})[_0x6b10('0x20')](function(_0x33ac0a){if(_0x33ac0a){return[_0x33ac0a,![]];}return db[_0x6b10('0x8b')][_0x6b10('0x58')](_0x51f1eb)['then'](function(_0x494fbe){return[_0x494fbe,!![]];});});}})[_0x6b10('0x8e')](function(_0x4feb29,_0x156add){if(_0x4feb29){_0x3c97aa=_0x156add;if(!_0x156add){var _0x10fe7b={'from':(_0x2c4a13[_0x6b10('0x88')]['firstName']||'')+'\x20'+(_0x2c4a13[_0x6b10('0x88')][_0x6b10('0x8f')]||'')};if(_0x1bdfdf['body'][_0x6b10('0x8a')]&&_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x90')]&&_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x8a')]!=_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x90')]){_0x10fe7b[_0x6b10('0x8a')]=_0x1bdfdf['body'][_0x6b10('0x90')];}return _0x4feb29['update'](_0x10fe7b);}else{return _0x4feb29;}}})[_0x6b10('0x20')](function(_0x5a2ac5){_0x2c4a13[_0x6b10('0x91')]=_0x5a2ac5[_0x6b10('0x37')]({'plain':!![]});_0x2c4a13[_0x6b10('0x91')][_0x6b10('0x92')]=_0x3c97aa;if(_0x2c4a13[_0x6b10('0x91')][_0x6b10('0x92')]){if(_0x2c4a13['account']['autoclose']){_0x2c4a13[_0x6b10('0x84')][_0x6b10('0x93')]({'id':0x0,'priority':_0x2c4a13[_0x6b10('0x84')][_0x6b10('0x4a')]+0x1,'app':_0x6b10('0x94'),'appdata':_0x6b10('0x95'),'interval':_0x6b10('0x96')});}}return db[_0x6b10('0x97')][_0x6b10('0x58')]({'body':_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x59')],'OpenchannelAccountId':_0x1bdfdf['params']['id'],'OpenchannelInteractionId':_0x5a2ac5['id'],'direction':'in','ContactId':_0x2c4a13[_0x6b10('0x88')]['id'],'AttachmentId':_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x98')]});})[_0x6b10('0x20')](function(_0x416106){_0x2c4a13[_0x6b10('0x28')]=_0x416106;if(_0x2c4a13[_0x6b10('0x91')][_0x6b10('0x99')]){return db[_0x6b10('0x9a')][_0x6b10('0x60')]({'attributes':['id',_0x6b10('0x39')],'where':{'id':_0x2c4a13[_0x6b10('0x91')]['UserId']}})[_0x6b10('0x20')](function(_0xc5721b){if(_0xc5721b){_0x2c4a13[_0x6b10('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xc5721b[_0x6b10('0x39')]+','+(_0x2c4a13[_0x6b10('0x83')][_0x6b10('0x9b')]||0xa),'interval':_0x6b10('0x96')});_0x2c4a13[_0x6b10('0x9c')]=![];}return respondWithRpcPromise(_0x6b10('0x9d'),_0x6b10('0x9e'),_0x2c4a13);});}return respondWithRpcPromise('Start',_0x6b10('0x9e'),_0x2c4a13);})['then'](function(_0x4db836){respondWithRpcPromise(_0x6b10('0x9f'),_0x6b10('0x9f'),{'event':'notify','message':_0x4db836},client9002);return _0x4db836;})[_0x6b10('0x20')](respondWithResult(_0x3c24e9,null))[_0x6b10('0x2a')](handleError(_0x3c24e9,null));};exports[_0x6b10('0xa0')]=function(_0x277d1e,_0x1100fb,_0x365f38){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x277d1e[_0x6b10('0x61')]['id']}})['then'](handleEntityNotFound(_0x1100fb,null))[_0x6b10('0x20')](function(_0x3697d9){if(_0x3697d9){return db[_0x6b10('0xa1')][_0x6b10('0xa2')](function(_0x328b83){return db[_0x6b10('0xa3')][_0x6b10('0x36')]({'where':{'OpenchannelAccountId':_0x277d1e[_0x6b10('0x61')]['id']},'transaction':_0x328b83})[_0x6b10('0x20')](function(_0x1d202f){var _0x31a87c=_[_0x6b10('0x3d')](_0x277d1e[_0x6b10('0x59')],function(_0x5ac84d){_0x5ac84d['OpenchannelAccountId']=_0x277d1e['params']['id'];return _0x5ac84d;});return db[_0x6b10('0xa3')]['bulkCreate'](_0x31a87c,{'transaction':_0x328b83});});})[_0x6b10('0x20')](function(){return db[_0x6b10('0xa3')][_0x6b10('0xa4')]({'where':{'OpenchannelAccountId':_0x277d1e[_0x6b10('0x61')]['id']},'order':_0x6b10('0x86')});});}})['then'](respondWithResult(_0x1100fb,null))[_0x6b10('0x2a')](handleError(_0x1100fb,null));};exports['getApplications']=function(_0x4e448b,_0x2f095c,_0x8ed536){var _0xbb418e={};var _0xb99ec={};var _0x3d2fab;var _0x10d2ca;return db[_0x6b10('0x3e')]['findOne']({'where':{'id':_0x4e448b[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x2f095c,null))[_0x6b10('0x20')](function(_0x3c6442){if(_0x3c6442){_0x3d2fab=_0x3c6442;_0xb99ec[_0x6b10('0x47')]=_[_0x6b10('0x44')](db[_0x6b10('0xa3')][_0x6b10('0x3f')]);_0xb99ec[_0x6b10('0x43')]=_[_0x6b10('0x44')](_0x4e448b[_0x6b10('0x43')]);_0xb99ec[_0x6b10('0x45')]=_[_0x6b10('0x46')](_0xb99ec[_0x6b10('0x47')],_0xb99ec[_0x6b10('0x43')]);_0xbb418e[_0x6b10('0x49')]=_[_0x6b10('0x46')](_0xb99ec[_0x6b10('0x47')],qs[_0x6b10('0x48')](_0x4e448b[_0x6b10('0x43')]['fields']));_0xbb418e[_0x6b10('0x49')]=_0xbb418e[_0x6b10('0x49')][_0x6b10('0x4a')]?_0xbb418e[_0x6b10('0x49')]:_0xb99ec[_0x6b10('0x47')];_0xbb418e[_0x6b10('0x4d')]=qs[_0x6b10('0x4e')](_0x4e448b[_0x6b10('0x43')][_0x6b10('0x4e')]);_0xbb418e['where']=qs[_0x6b10('0x45')](_[_0x6b10('0x6b')](_0x4e448b[_0x6b10('0x43')],_0xb99ec[_0x6b10('0x45')]));if(_0x4e448b[_0x6b10('0x43')][_0x6b10('0x51')]){_0xbb418e[_0x6b10('0x4f')]=_[_0x6b10('0x50')](_0xbb418e[_0x6b10('0x4f')],{'$or':_[_0x6b10('0x3d')](_0xbb418e[_0x6b10('0x49')],function(_0x4c7bcd){var _0x11471d={};_0x11471d[_0x4c7bcd]={'$like':'%'+_0x4e448b[_0x6b10('0x43')]['filter']+'%'};return _0x11471d;})});}_0xbb418e=_[_0x6b10('0x50')]({},_0xbb418e,_0x4e448b[_0x6b10('0x52')]);return _0x3d2fab[_0x6b10('0xa5')](_0xbb418e);}})[_0x6b10('0x20')](function(_0x23022b){if(_0x23022b){_0x10d2ca=_0x23022b['length'];if(!_0x4e448b[_0x6b10('0x43')][_0x6b10('0x4b')](_0x6b10('0x4c'))){_0xbb418e[_0x6b10('0x31')]=qs[_0x6b10('0x31')](_0x4e448b[_0x6b10('0x43')][_0x6b10('0x31')]);_0xbb418e[_0x6b10('0x30')]=qs[_0x6b10('0x30')](_0x4e448b[_0x6b10('0x43')][_0x6b10('0x30')]);}return _0x3d2fab[_0x6b10('0xa5')](_0xbb418e);}})['then'](function(_0x59b26e){if(_0x59b26e){return _0x59b26e?{'count':_0x10d2ca,'rows':_0x59b26e}:null;}})['then'](respondWithResult(_0x2f095c,null))[_0x6b10('0x2a')](handleError(_0x2f095c,null));};exports[_0x6b10('0xa6')]=function(_0x5ea574,_0x58d4dd,_0x2185d5){var _0x42a8ee={'raw':![],'where':{}};var _0x93256c={};var _0xdcce7={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6b10('0x65')]({'where':{'id':_0x5ea574['params']['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x58d4dd,null))[_0x6b10('0x20')](function(_0x2bfa17){if(_0x2bfa17){_0x93256c[_0x6b10('0x47')]=_[_0x6b10('0x44')](db['OpenchannelInteraction']['rawAttributes']);_0x93256c[_0x6b10('0x43')]=_[_0x6b10('0x44')](_0x5ea574[_0x6b10('0x43')]);_0x93256c['filters']=_[_0x6b10('0x46')](_0x93256c[_0x6b10('0x47')],_0x93256c[_0x6b10('0x43')]);_0x42a8ee[_0x6b10('0x49')]=_['intersection'](_0x93256c['model'],qs[_0x6b10('0x48')](_0x5ea574[_0x6b10('0x43')][_0x6b10('0x48')]));_0x42a8ee[_0x6b10('0x49')]=_0x42a8ee[_0x6b10('0x49')][_0x6b10('0x4a')]?_0x42a8ee[_0x6b10('0x49')]:_0x93256c[_0x6b10('0x47')];if(!_0x5ea574[_0x6b10('0x43')][_0x6b10('0x4b')](_0x6b10('0x4c'))){_0x42a8ee[_0x6b10('0x31')]=qs[_0x6b10('0x31')](_0x5ea574[_0x6b10('0x43')][_0x6b10('0x31')]);_0x42a8ee[_0x6b10('0x30')]=qs[_0x6b10('0x30')](_0x5ea574['query'][_0x6b10('0x30')]);}_0x42a8ee[_0x6b10('0x4d')]=qs[_0x6b10('0x4e')](_0x5ea574[_0x6b10('0x43')][_0x6b10('0x4e')]);_0x42a8ee['where']=qs['filters'](_[_0x6b10('0x6b')](_0x5ea574[_0x6b10('0x43')],_0x93256c[_0x6b10('0x45')]));_0x42a8ee[_0x6b10('0x4f')][_0x6b10('0x66')]=_0x2bfa17['id'];if(_0x5ea574[_0x6b10('0x43')][_0x6b10('0x51')]){_0x42a8ee['where']=_['merge'](_0x42a8ee['where'],{'$or':_[_0x6b10('0x3d')](_0x42a8ee['attributes'],function(_0x29d086){var _0x137ffb={};_0x137ffb[_0x29d086]={'$like':'%'+_0x5ea574[_0x6b10('0x43')]['filter']+'%'};return _0x137ffb;})});}_0x42a8ee=_[_0x6b10('0x50')]({},_0x42a8ee,_0x5ea574[_0x6b10('0x52')]);return db[_0x6b10('0x8b')][_0x6b10('0x2f')]({'where':_0x42a8ee['where']})[_0x6b10('0x20')](function(_0x2f8290){_0xdcce7[_0x6b10('0x2f')]=_0x2f8290;if(_0x5ea574[_0x6b10('0x43')][_0x6b10('0x53')]){_0x42a8ee[_0x6b10('0x54')]=[{'model':db[_0x6b10('0x70')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x6b10('0xa7'),'attributes':[_0x6b10('0x39'),_0x6b10('0xa8'),_0x6b10('0xa9')],'required':![]},{'model':db['Tag'],'as':_0x6b10('0xaa'),'attributes':['id',_0x6b10('0x39'),_0x6b10('0xab')],'where':_0x5ea574['query'][_0x6b10('0xac')]?{'id':_0x5ea574[_0x6b10('0x43')][_0x6b10('0xac')]}:undefined,'required':_0x5ea574[_0x6b10('0x43')][_0x6b10('0xac')]?!![]:![]}];}return db[_0x6b10('0x8b')][_0x6b10('0x55')](_0x42a8ee);})[_0x6b10('0x20')](function(_0x54e688){_0xdcce7['rows']=_0x54e688;return _0xdcce7;});}})[_0x6b10('0x20')](respondWithFilteredResult(_0x58d4dd,_0x42a8ee))[_0x6b10('0x2a')](handleError(_0x58d4dd,null));};exports['addAgents']=function(_0x71b5ed,_0x1987f5,_0x134e6e){return db[_0x6b10('0x3e')][_0x6b10('0x60')]({'where':{'id':_0x71b5ed['params']['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x1987f5,null))[_0x6b10('0x20')](function(_0x49dd7c){if(_0x49dd7c){return _0x49dd7c[_0x6b10('0xad')](_0x71b5ed['body']['ids'],_[_0x6b10('0xae')](_0x71b5ed['body'],[_0x6b10('0x6d'),'id'])||{})[_0x6b10('0x8e')](function(_0x4e6a29){for(var _0x2f7cd8=0x0;_0x2f7cd8<_0x71b5ed[_0x6b10('0x59')]['ids'][_0x6b10('0x4a')];_0x2f7cd8+=0x1){socket[_0x6b10('0xaf')](_0x6b10('0xb0'),{'UserId':_0x71b5ed['body'][_0x6b10('0x6d')][_0x2f7cd8],'OpenchannelAccountId':_0x71b5ed['params']['id']});}return _0x4e6a29;});}})[_0x6b10('0x20')](respondWithResult(_0x1987f5,null))[_0x6b10('0x2a')](handleError(_0x1987f5,null));};exports[_0x6b10('0xb1')]=function(_0x112685,_0x381041,_0xa227fd){return db['OpenchannelAccount'][_0x6b10('0x60')]({'where':{'id':_0x112685[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x381041,null))['then'](function(_0x4c3d78){if(_0x4c3d78){return _0x4c3d78[_0x6b10('0xb1')](_0x112685[_0x6b10('0x43')][_0x6b10('0x6d')])[_0x6b10('0x20')](function(){if(_['isArray'](_0x112685[_0x6b10('0x43')][_0x6b10('0x6d')])){for(var _0x51d1d9=0x0;_0x51d1d9<_0x112685[_0x6b10('0x43')][_0x6b10('0x6d')][_0x6b10('0x4a')];_0x51d1d9+=0x1){socket[_0x6b10('0xaf')](_0x6b10('0xb2'),{'UserId':Number(_0x112685[_0x6b10('0x43')][_0x6b10('0x6d')][_0x51d1d9]),'OpenchannelAccountId':Number(_0x112685[_0x6b10('0x61')]['id'])});}}else{socket[_0x6b10('0xaf')](_0x6b10('0xb2'),{'UserId':Number(_0x112685[_0x6b10('0x43')][_0x6b10('0x6d')]),'OpenchannelAccountId':Number(_0x112685[_0x6b10('0x61')]['id'])});}});}})[_0x6b10('0x20')](respondWithStatusCode(_0x381041,null))[_0x6b10('0x2a')](handleError(_0x381041,null));};exports[_0x6b10('0xb3')]=function(_0x238784,_0x58b916,_0x510ccf){var _0x59126e={};var _0x1f748f={};var _0x144504;var _0x13fbba;return db['OpenchannelAccount'][_0x6b10('0x65')]({'where':{'id':_0x238784[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x58b916,null))[_0x6b10('0x20')](function(_0x3baa59){if(_0x3baa59){_0x144504=_0x3baa59;_0x1f748f[_0x6b10('0x47')]=_[_0x6b10('0x44')](db[_0x6b10('0x9a')]['rawAttributes']);_0x1f748f['query']=_['keys'](_0x238784[_0x6b10('0x43')]);_0x1f748f[_0x6b10('0x45')]=_['intersection'](_0x1f748f['model'],_0x1f748f[_0x6b10('0x43')]);_0x59126e[_0x6b10('0x49')]=_[_0x6b10('0x46')](_0x1f748f[_0x6b10('0x47')],qs[_0x6b10('0x48')](_0x238784['query'][_0x6b10('0x48')]));_0x59126e[_0x6b10('0x49')]=_0x59126e[_0x6b10('0x49')][_0x6b10('0x4a')]?_0x59126e[_0x6b10('0x49')]:_0x1f748f[_0x6b10('0x47')];_0x59126e[_0x6b10('0x4d')]=qs[_0x6b10('0x4e')](_0x238784['query'][_0x6b10('0x4e')]);_0x59126e[_0x6b10('0x4f')]=qs[_0x6b10('0x45')](_[_0x6b10('0x6b')](_0x238784['query'],_0x1f748f[_0x6b10('0x45')]));if(_0x238784[_0x6b10('0x43')][_0x6b10('0x51')]){_0x59126e[_0x6b10('0x4f')]=_[_0x6b10('0x50')](_0x59126e[_0x6b10('0x4f')],{'$or':_[_0x6b10('0x3d')](_0x59126e[_0x6b10('0x49')],function(_0x4d4470){var _0x184496={};_0x184496[_0x4d4470]={'$like':'%'+_0x238784[_0x6b10('0x43')]['filter']+'%'};return _0x184496;})});}_0x59126e=_['merge']({},_0x59126e,_0x238784[_0x6b10('0x52')]);return _0x144504[_0x6b10('0xb3')](_0x59126e);}})['then'](function(_0x1319df){if(_0x1319df){_0x13fbba=_0x1319df[_0x6b10('0x4a')];if(!_0x238784[_0x6b10('0x43')][_0x6b10('0x4b')](_0x6b10('0x4c'))){_0x59126e['limit']=qs[_0x6b10('0x31')](_0x238784[_0x6b10('0x43')][_0x6b10('0x31')]);_0x59126e[_0x6b10('0x30')]=qs[_0x6b10('0x30')](_0x238784[_0x6b10('0x43')][_0x6b10('0x30')]);}return _0x144504[_0x6b10('0xb3')](_0x59126e);}})[_0x6b10('0x20')](function(_0x281cda){if(_0x281cda){return _0x281cda?{'count':_0x13fbba,'rows':_0x281cda}:null;}})[_0x6b10('0x20')](respondWithResult(_0x58b916,null))['catch'](handleError(_0x58b916,null));};exports[_0x6b10('0xb4')]=function(_0x3ed240,_0x128310,_0x3badca){var _0x4567aa,_0x3f03e1,_0x52e205;if(_[_0x6b10('0x78')](_0x3ed240[_0x6b10('0x59')][_0x6b10('0x59')])||_0x3ed240[_0x6b10('0x59')][_0x6b10('0x59')]===''){throw new db[(_0x6b10('0x1e'))][(_0x6b10('0x71'))](_0x6b10('0x7b'));}if(_[_0x6b10('0x78')](_0x3ed240['body']['to'])){}_0x4567aa=_0x3ed240[_0x6b10('0x59')]['to'];return db[_0x6b10('0x3e')][_0x6b10('0x65')]({'where':{'id':_0x3ed240[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x128310,null))[_0x6b10('0x20')](function(_0x33d734){if(_0x33d734){return db[_0x6b10('0x3e')]['find']({'where':{'id':_0x33d734['id']},'include':[{'model':db[_0x6b10('0x7f')],'as':_0x6b10('0x82'),'include':[{'model':db[_0x6b10('0x70')],'as':_0x6b10('0xb5'),'where':{[_0x33d734[_0x6b10('0x7c')]]:_0x4567aa},'limit':0x1,'order':[[_0x6b10('0x75'),'DESC']]}]}]})[_0x6b10('0x20')](handleEntityNotFound(_0x128310,null))['then'](function(_0x324c29){if(_0x324c29&&_0x324c29[_0x6b10('0x82')]){_0x3f03e1=_0x324c29[_0x6b10('0x37')]({'plain':!![]});if(_0x3f03e1['List']&&_0x3f03e1[_0x6b10('0x82')][_0x6b10('0xb5')]['length']){return _0x3f03e1[_0x6b10('0x82')]['Contacts'][0x0];}return db[_0x6b10('0x70')]['create'](_[_0x6b10('0x87')](_0x3ed240['body'],{'firstName':_0x4567aa,[_0x324c29['mapKey']]:_0x4567aa,'phone':_0x4567aa,'ListId':_0x3f03e1[_0x6b10('0x77')]}));}})['then'](handleEntityNotFound(_0x128310,null))[_0x6b10('0x20')](function(_0x2d4e45){if(_0x2d4e45){_0x52e205=_0x2d4e45;return db[_0x6b10('0x8b')][_0x6b10('0x60')]({'where':{'ContactId':_0x52e205['id'],'closed':![],'OpenchannelAccountId':_0x3f03e1['id']}})['then'](function(_0x2a88be){if(_0x2a88be){return[_0x2a88be,![]];}return db[_0x6b10('0x8b')][_0x6b10('0x58')]({'UserId':_0x3ed240[_0x6b10('0x5a')]['id'],'ContactId':_0x52e205['id'],'OpenchannelAccountId':_0x3f03e1['id'],'lastMsgDirection':_0x6b10('0xb6'),'Messages':[_['merge'](_0x3ed240[_0x6b10('0x59')],{'read':![],'body':_0x3ed240[_0x6b10('0x59')]['body'],'OpenchannelAccountId':_0x3f03e1['id'],'UserId':_0x3ed240[_0x6b10('0x5a')]['id'],'ContactId':_0x52e205['id']})]},{'include':[{'model':db[_0x6b10('0x97')],'as':_0x6b10('0xb7')}]})[_0x6b10('0x20')](function(_0xc656cc){return[_0xc656cc,!![]];});});}})[_0x6b10('0x8e')](function(_0x374ced,_0x466ea5){if(_0x466ea5){return _0x374ced;}return db[_0x6b10('0x97')]['create'](_['merge'](_0x3ed240['body'],{'read':![],'body':_0x3ed240['body'][_0x6b10('0x59')],'OpenchannelAccountId':_0x3f03e1['id'],'OpenchannelInteractionId':_0x374ced['id'],'UserId':_0x3ed240[_0x6b10('0x5a')]['id'],'ContactId':_0x52e205['id']}))[_0x6b10('0x20')](function(_0x5584ca){_0x374ced[_0x6b10('0xb8')][_0x6b10('0xb7')]=[];_0x374ced[_0x6b10('0xb8')]['Messages'][_0x6b10('0x93')](_0x5584ca['dataValues']);return _0x374ced;});});}})[_0x6b10('0x20')](respondWithResult(_0x128310,null))[_0x6b10('0x2a')](handleError(_0x128310,null));}; \ No newline at end of file +var _0xb1e2=['list','asc','ListId','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','Start','startRouting','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','priority','getApplications','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','send','dataValues','Messages','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','util','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','socket.io-emitter','redis','./openchannelAccount.socket','register','client','http','test','ValidationError','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','reject','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','update','describe','addDisposition','OpnechannelAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','order','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xb1e2,0xe6));var _0x2b1e=function(_0x273398,_0x5c77f1){_0x273398=_0x273398-0x0;var _0x410683=_0xb1e2[_0x273398];return _0x410683;};'use strict';var pdf=require(_0x2b1e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2b1e('0x1'));var zipdir=require(_0x2b1e('0x2'));var jsonpatch=require(_0x2b1e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b1e('0x4'));var util=require(_0x2b1e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2b1e('0x6'));var ejs=require(_0x2b1e('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2b1e('0x8'));var toCsv=require(_0x2b1e('0x6'));var querystring=require(_0x2b1e('0x9'));var Papa=require(_0x2b1e('0xa'));var Redis=require(_0x2b1e('0xb'));var authService=require(_0x2b1e('0xc'));var qs=require(_0x2b1e('0xd'));var as=require(_0x2b1e('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b1e('0xf'))(_0x2b1e('0x10'));var utils=require(_0x2b1e('0x11'));var config=require(_0x2b1e('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2b1e('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2b1e('0x14'))(new Redis(config[_0x2b1e('0x15')]));require(_0x2b1e('0x16'))[_0x2b1e('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2b1e('0x18')][_0x2b1e('0x19')]({'port':0x232c});var client9002=jayson['client'][_0x2b1e('0x19')]({'port':0x232a});function checkPasswordPattern(_0x481455,_0x202167,_0x1d6759){if(_0x1d6759){var _0x454e38=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x454e38[_0x2b1e('0x1a')](_0x202167)){return _0x481455;}else{throw new db['Sequelize'][(_0x2b1e('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 _0x481455;}}function respondWithRpcPromise(_0x49f796,_0x2cd606,_0x55fcee,_0x19a2c4){return new BPromise(function(_0x187fb3,_0x412c86){var _0x317fe2=_0x19a2c4||client;return _0x317fe2[_0x2b1e('0x1c')](_0x49f796,_0x55fcee)[_0x2b1e('0x1d')](function(_0x25c02a){logger[_0x2b1e('0x1e')](_0x2b1e('0x1f'),_0x2cd606,_0x2b1e('0x20'));logger[_0x2b1e('0x21')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2cd606,'request\x20sent',JSON[_0x2b1e('0x22')](_0x25c02a));if(_0x25c02a[_0x2b1e('0x23')]){if(_0x25c02a['error'][_0x2b1e('0x24')]===0x1f4){logger[_0x2b1e('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x2cd606,_0x25c02a['error'][_0x2b1e('0x25')]);return _0x412c86(_0x25c02a[_0x2b1e('0x23')]['message']);}logger[_0x2b1e('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x2cd606,_0x25c02a['error'][_0x2b1e('0x25')]);return _0x187fb3(_0x25c02a[_0x2b1e('0x23')]['message']);}else{logger['info'](_0x2b1e('0x1f'),_0x2cd606,_0x2b1e('0x20'));_0x187fb3(_0x25c02a[_0x2b1e('0x26')][_0x2b1e('0x25')]);}})[_0x2b1e('0x27')](function(_0x6dd8b){logger[_0x2b1e('0x23')](_0x2b1e('0x1f'),_0x2cd606,_0x6dd8b);_0x412c86(_0x6dd8b);});});}function respondWithStatusCode(_0x5170e7,_0x532fc3){_0x532fc3=_0x532fc3||0xcc;return function(_0x476527){if(_0x476527){return _0x5170e7['sendStatus'](_0x532fc3);}return _0x5170e7[_0x2b1e('0x28')](_0x532fc3)[_0x2b1e('0x29')]();};}function respondWithResult(_0x32f9b5,_0x4a0eb9){_0x4a0eb9=_0x4a0eb9||0xc8;return function(_0xe5b85a){if(_0xe5b85a){return _0x32f9b5[_0x2b1e('0x28')](_0x4a0eb9)[_0x2b1e('0x2a')](_0xe5b85a);}};}function respondWithFilteredResult(_0xd74cc5,_0x47f407){return function(_0x627d7){if(_0x627d7){var _0x157742=_0x627d7[_0x2b1e('0x2b')],_0x72a76=_0x47f407[_0x2b1e('0x2c')],_0x43bca9=_0x47f407[_0x2b1e('0x2c')]+_0x47f407[_0x2b1e('0x2d')],_0x25a8f2;if(_0x43bca9>=_0x157742){_0x43bca9=_0x157742;_0x25a8f2=0xc8;}else{_0x25a8f2=0xce;}_0xd74cc5[_0x2b1e('0x28')](_0x25a8f2);return _0xd74cc5['set'](_0x2b1e('0x2e'),_0x72a76+'-'+_0x43bca9+'/'+_0x157742)[_0x2b1e('0x2a')](_0x627d7);}return null;};}function patchUpdates(_0x29e3b3){return function(_0x856433){try{jsonpatch['apply'](_0x856433,_0x29e3b3,!![]);}catch(_0x38a714){return BPromise[_0x2b1e('0x2f')](_0x38a714);}return _0x856433['save']();};}function saveUpdates(_0x1e7176,_0x548b57){return function(_0xf24b19){if(_0xf24b19){return _0xf24b19['update'](_0x1e7176)['then'](function(_0x1b65da){return _0x1b65da;});}return null;};}function removeEntity(_0x3a8116,_0x4f7b14){return function(_0x4c1707){if(_0x4c1707){return _0x4c1707[_0x2b1e('0x30')]()[_0x2b1e('0x1d')](function(){var _0x563189=_0x4c1707[_0x2b1e('0x31')]({'plain':!![]});var _0x3715b2=_0x2b1e('0x32');return db[_0x2b1e('0x33')][_0x2b1e('0x30')]({'where':{'type':_0x3715b2,'resourceId':_0x563189['id']}})[_0x2b1e('0x1d')](function(){return _0x4c1707;});})['then'](function(){_0x3a8116[_0x2b1e('0x28')](0xcc)[_0x2b1e('0x29')]();});}};}function handleEntityNotFound(_0xf5d18a,_0x53cfff){return function(_0x1e3ff4){if(!_0x1e3ff4){_0xf5d18a[_0x2b1e('0x34')](0x194);}return _0x1e3ff4;};}function handleError(_0x4e3d4d,_0x132c1f){_0x132c1f=_0x132c1f||0x1f4;return function(_0x213c9d){logger['error'](_0x213c9d[_0x2b1e('0x35')]);if(_0x213c9d[_0x2b1e('0x36')]){delete _0x213c9d[_0x2b1e('0x36')];}_0x4e3d4d[_0x2b1e('0x28')](_0x132c1f)['send'](_0x213c9d);};}exports[_0x2b1e('0x37')]=function(_0x4c80ac,_0x3c4219){var _0x5815d6={'include':[{'model':db[_0x2b1e('0x38')],'as':_0x2b1e('0x39')}]},_0x47aaaa={},_0x2952c4={'count':0x0,'rows':[]};var _0xa1b68f=_[_0x2b1e('0x3a')](db[_0x2b1e('0x3b')][_0x2b1e('0x3c')],function(_0x5aa1ae){return{'name':_0x5aa1ae[_0x2b1e('0x3d')],'type':_0x5aa1ae[_0x2b1e('0x3e')][_0x2b1e('0x3f')]};});_0x47aaaa[_0x2b1e('0x40')]=_[_0x2b1e('0x3a')](_0xa1b68f,_0x2b1e('0x36'));_0x47aaaa['query']=_[_0x2b1e('0x41')](_0x4c80ac['query']);_0x47aaaa[_0x2b1e('0x42')]=_[_0x2b1e('0x43')](_0x47aaaa[_0x2b1e('0x40')],_0x47aaaa['query']);_0x5815d6['attributes']=_['intersection'](_0x47aaaa[_0x2b1e('0x40')],qs[_0x2b1e('0x44')](_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x44')]));_0x5815d6[_0x2b1e('0x46')]=_0x5815d6['attributes'][_0x2b1e('0x47')]?_0x5815d6['attributes']:_0x47aaaa[_0x2b1e('0x40')];if(!_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x48')](_0x2b1e('0x49'))){_0x5815d6[_0x2b1e('0x2d')]=qs['limit'](_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x2d')]);_0x5815d6[_0x2b1e('0x2c')]=qs['offset'](_0x4c80ac['query'][_0x2b1e('0x2c')]);}_0x5815d6['order']=qs[_0x2b1e('0x4a')](_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x4a')]);_0x5815d6[_0x2b1e('0x4b')]=qs[_0x2b1e('0x42')](_[_0x2b1e('0x4c')](_0x4c80ac[_0x2b1e('0x45')],_0x47aaaa[_0x2b1e('0x42')]),_0xa1b68f);if(_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x4d')]){_0x5815d6['where']=_[_0x2b1e('0x4e')](_0x5815d6['where'],{'$or':_['map'](_0xa1b68f,function(_0x3766dd){if(_0x3766dd[_0x2b1e('0x3e')]!==_0x2b1e('0x4f')){var _0x3892f7={};_0x3892f7[_0x3766dd['name']]={'$like':'%'+_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x4d')]+'%'};return _0x3892f7;}})});}_0x5815d6=_['merge']({},_0x5815d6,_0x4c80ac[_0x2b1e('0x50')]);var _0x1995f9={'where':_0x5815d6[_0x2b1e('0x4b')]};return db[_0x2b1e('0x3b')]['count'](_0x1995f9)[_0x2b1e('0x1d')](function(_0x30d21e){_0x2952c4[_0x2b1e('0x2b')]=_0x30d21e;if(_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x51')]){_0x5815d6[_0x2b1e('0x52')]=[{'all':!![]}];}return db[_0x2b1e('0x3b')][_0x2b1e('0x53')](_0x5815d6);})[_0x2b1e('0x1d')](function(_0xfbe75a){_0x2952c4[_0x2b1e('0x54')]=_0xfbe75a;return _0x2952c4;})[_0x2b1e('0x1d')](respondWithFilteredResult(_0x3c4219,_0x5815d6))[_0x2b1e('0x27')](handleError(_0x3c4219,null));};exports['show']=function(_0xb8da24,_0x287215){var _0x56f196={'raw':![],'where':{'id':_0xb8da24[_0x2b1e('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x2b1e('0x39')}]},_0x1bde88={};_0x1bde88[_0x2b1e('0x40')]=_[_0x2b1e('0x41')](db[_0x2b1e('0x3b')][_0x2b1e('0x3c')]);_0x1bde88['query']=_[_0x2b1e('0x41')](_0xb8da24[_0x2b1e('0x45')]);_0x1bde88[_0x2b1e('0x42')]=_[_0x2b1e('0x43')](_0x1bde88[_0x2b1e('0x40')],_0x1bde88[_0x2b1e('0x45')]);_0x56f196[_0x2b1e('0x46')]=_[_0x2b1e('0x43')](_0x1bde88['model'],qs[_0x2b1e('0x44')](_0xb8da24['query']['fields']));_0x56f196[_0x2b1e('0x46')]=_0x56f196[_0x2b1e('0x46')][_0x2b1e('0x47')]?_0x56f196[_0x2b1e('0x46')]:_0x1bde88[_0x2b1e('0x40')];if(_0xb8da24[_0x2b1e('0x45')][_0x2b1e('0x51')]){_0x56f196[_0x2b1e('0x52')]=[{'all':!![]}];}_0x56f196=_[_0x2b1e('0x4e')]({},_0x56f196,_0xb8da24[_0x2b1e('0x50')]);return db['OpenchannelAccount'][_0x2b1e('0x56')](_0x56f196)['then'](handleEntityNotFound(_0x287215,null))[_0x2b1e('0x1d')](respondWithResult(_0x287215,null))[_0x2b1e('0x27')](handleError(_0x287215,null));};exports['create']=function(_0x4dc4b8,_0x38034d){return db[_0x2b1e('0x3b')][_0x2b1e('0x57')](_0x4dc4b8[_0x2b1e('0x58')],{})[_0x2b1e('0x1d')](function(_0x1fa9fb){var _0x1b1577=_0x4dc4b8['user']['get']({'plain':!![]});if(!_0x1b1577)throw new Error(_0x2b1e('0x59'));if(_0x1b1577[_0x2b1e('0x5a')]===_0x2b1e('0x5b')){var _0x4bf5a8=_0x1fa9fb[_0x2b1e('0x31')]({'plain':!![]});var _0x221939=_0x2b1e('0x32');return db[_0x2b1e('0x5c')][_0x2b1e('0x56')]({'where':{'name':_0x221939,'userProfileId':_0x1b1577['userProfileId']},'raw':!![]})[_0x2b1e('0x1d')](function(_0x595f0a){if(_0x595f0a&&_0x595f0a['autoAssociation']===0x0){return db[_0x2b1e('0x33')][_0x2b1e('0x57')]({'name':_0x4bf5a8[_0x2b1e('0x36')],'resourceId':_0x4bf5a8['id'],'type':_0x595f0a['name'],'sectionId':_0x595f0a['id']},{})[_0x2b1e('0x1d')](function(){return _0x1fa9fb;});}else{return _0x1fa9fb;}})[_0x2b1e('0x27')](function(_0x79e7b3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x79e7b3);throw _0x79e7b3;});}return _0x1fa9fb;})[_0x2b1e('0x1d')](respondWithResult(_0x38034d,0xc9))['catch'](handleError(_0x38034d,null));};exports[_0x2b1e('0x5d')]=function(_0x5ddc5c,_0x1c736d){if(_0x5ddc5c[_0x2b1e('0x58')]['id']){delete _0x5ddc5c[_0x2b1e('0x58')]['id'];}return db[_0x2b1e('0x3b')]['find']({'where':{'id':_0x5ddc5c[_0x2b1e('0x55')]['id']},'include':[{'model':db[_0x2b1e('0x38')],'as':_0x2b1e('0x39')}]})[_0x2b1e('0x1d')](handleEntityNotFound(_0x1c736d,null))[_0x2b1e('0x1d')](saveUpdates(_0x5ddc5c[_0x2b1e('0x58')],null))['then'](respondWithResult(_0x1c736d,null))[_0x2b1e('0x27')](handleError(_0x1c736d,null));};exports[_0x2b1e('0x30')]=function(_0x4562c1,_0x421359){return db['OpenchannelAccount'][_0x2b1e('0x56')]({'where':{'id':_0x4562c1[_0x2b1e('0x55')]['id']}})['then'](handleEntityNotFound(_0x421359,null))[_0x2b1e('0x1d')](removeEntity(_0x421359,null))['catch'](handleError(_0x421359,null));};exports[_0x2b1e('0x5e')]=function(_0x4ebf4f,_0x2ad5b9){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0x2ad5b9,null))[_0x2b1e('0x27')](handleError(_0x2ad5b9,null));};exports[_0x2b1e('0x5f')]=function(_0x553624,_0x4ff76a,_0x2e7de2){if(_0x553624[_0x2b1e('0x58')]['id']){delete _0x553624[_0x2b1e('0x58')]['id'];}return db[_0x2b1e('0x3b')][_0x2b1e('0x56')]({'where':{'id':_0x553624[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x4ff76a,null))[_0x2b1e('0x1d')](function(_0x58d443){if(_0x58d443){_0x553624[_0x2b1e('0x58')][_0x2b1e('0x60')]=_0x58d443['id'];return db['Disposition'][_0x2b1e('0x57')](_0x553624[_0x2b1e('0x58')]);}})[_0x2b1e('0x1d')](respondWithResult(_0x4ff76a,null))['catch'](handleError(_0x4ff76a,null));};exports[_0x2b1e('0x61')]=function(_0x4222f1,_0x50111f,_0x46ef6e){var _0x4d95c4={'raw':![],'where':{}};var _0x156b14={};var _0x405412={'count':0x0,'rows':[]};return db[_0x2b1e('0x3b')][_0x2b1e('0x62')]({'where':{'id':_0x4222f1[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x50111f,null))[_0x2b1e('0x1d')](function(_0x18bd5d){if(_0x18bd5d){_0x156b14['model']=_[_0x2b1e('0x41')](db[_0x2b1e('0x63')][_0x2b1e('0x3c')]);_0x156b14[_0x2b1e('0x45')]=_[_0x2b1e('0x41')](_0x4222f1['query']);_0x156b14[_0x2b1e('0x42')]=_[_0x2b1e('0x43')](_0x156b14[_0x2b1e('0x40')],_0x156b14[_0x2b1e('0x45')]);_0x4d95c4['attributes']=_[_0x2b1e('0x43')](_0x156b14[_0x2b1e('0x40')],qs[_0x2b1e('0x44')](_0x4222f1['query'][_0x2b1e('0x44')]));_0x4d95c4[_0x2b1e('0x46')]=_0x4d95c4['attributes'][_0x2b1e('0x47')]?_0x4d95c4[_0x2b1e('0x46')]:_0x156b14[_0x2b1e('0x40')];if(!_0x4222f1[_0x2b1e('0x45')][_0x2b1e('0x48')](_0x2b1e('0x49'))){_0x4d95c4[_0x2b1e('0x2d')]=qs[_0x2b1e('0x2d')](_0x4222f1[_0x2b1e('0x45')]['limit']);_0x4d95c4[_0x2b1e('0x2c')]=qs[_0x2b1e('0x2c')](_0x4222f1[_0x2b1e('0x45')]['offset']);}_0x4d95c4['order']=qs[_0x2b1e('0x4a')](_0x4222f1['query'][_0x2b1e('0x4a')]);_0x4d95c4[_0x2b1e('0x4b')]=qs[_0x2b1e('0x42')](_['pick'](_0x4222f1['query'],_0x156b14[_0x2b1e('0x42')]));_0x4d95c4[_0x2b1e('0x4b')]['OpenchannelAccountId']=_0x18bd5d['id'];if(_0x4222f1[_0x2b1e('0x45')][_0x2b1e('0x4d')]){_0x4d95c4[_0x2b1e('0x4b')]=_[_0x2b1e('0x4e')](_0x4d95c4[_0x2b1e('0x4b')],{'$or':_[_0x2b1e('0x3a')](_0x4d95c4[_0x2b1e('0x46')],function(_0x11f8d0){var _0x518ee3={};_0x518ee3[_0x11f8d0]={'$like':'%'+_0x4222f1[_0x2b1e('0x45')]['filter']+'%'};return _0x518ee3;})});}_0x4d95c4=_[_0x2b1e('0x4e')]({},_0x4d95c4,_0x4222f1[_0x2b1e('0x50')]);return db[_0x2b1e('0x63')][_0x2b1e('0x2b')]({'where':_0x4d95c4[_0x2b1e('0x4b')]})[_0x2b1e('0x1d')](function(_0x2735e2){_0x405412[_0x2b1e('0x2b')]=_0x2735e2;if(_0x4222f1[_0x2b1e('0x45')]['includeAll']){_0x4d95c4['include']=[{'all':!![]}];}return db['Disposition'][_0x2b1e('0x53')](_0x4d95c4);})[_0x2b1e('0x1d')](function(_0x4762bd){_0x405412['rows']=_0x4762bd;return _0x405412;});}})[_0x2b1e('0x1d')](respondWithFilteredResult(_0x50111f,_0x4d95c4))['catch'](handleError(_0x50111f,null));};exports['removeDispositions']=function(_0x1bc579,_0x20eb22,_0x3cf9bd){return db[_0x2b1e('0x3b')][_0x2b1e('0x56')]({'where':{'id':_0x1bc579[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x20eb22,null))[_0x2b1e('0x1d')](function(_0xa187eb){if(_0xa187eb){return _0xa187eb[_0x2b1e('0x64')](_0x1bc579['query'][_0x2b1e('0x65')]);}})[_0x2b1e('0x1d')](respondWithStatusCode(_0x20eb22,null))[_0x2b1e('0x27')](handleError(_0x20eb22,null));};exports[_0x2b1e('0x66')]=function(_0x251d11,_0x492cdf,_0xb67af8){if(_0x251d11[_0x2b1e('0x58')]['id']){delete _0x251d11['body']['id'];}return db[_0x2b1e('0x3b')][_0x2b1e('0x56')]({'where':{'id':_0x251d11[_0x2b1e('0x55')]['id']}})['then'](handleEntityNotFound(_0x492cdf,null))[_0x2b1e('0x1d')](function(_0x460e7f){if(_0x460e7f){_0x251d11[_0x2b1e('0x58')][_0x2b1e('0x67')]=_0x460e7f['id'];return db[_0x2b1e('0x68')][_0x2b1e('0x57')](_0x251d11[_0x2b1e('0x58')]);}})[_0x2b1e('0x1d')](respondWithResult(_0x492cdf,null))[_0x2b1e('0x27')](handleError(_0x492cdf,null));};exports[_0x2b1e('0x69')]=function(_0x4dc159,_0x4426b9,_0x47763b){var _0x33fee3={'raw':![],'where':{}};var _0x566f50={};var _0x59cee1={'count':0x0,'rows':[]};return db[_0x2b1e('0x3b')][_0x2b1e('0x62')]({'where':{'id':_0x4dc159[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x4426b9,null))[_0x2b1e('0x1d')](function(_0x24cb38){if(_0x24cb38){_0x566f50[_0x2b1e('0x40')]=_[_0x2b1e('0x41')](db[_0x2b1e('0x68')][_0x2b1e('0x3c')]);_0x566f50[_0x2b1e('0x45')]=_['keys'](_0x4dc159['query']);_0x566f50[_0x2b1e('0x42')]=_[_0x2b1e('0x43')](_0x566f50[_0x2b1e('0x40')],_0x566f50[_0x2b1e('0x45')]);_0x33fee3['attributes']=_[_0x2b1e('0x43')](_0x566f50['model'],qs[_0x2b1e('0x44')](_0x4dc159['query'][_0x2b1e('0x44')]));_0x33fee3[_0x2b1e('0x46')]=_0x33fee3[_0x2b1e('0x46')][_0x2b1e('0x47')]?_0x33fee3[_0x2b1e('0x46')]:_0x566f50[_0x2b1e('0x40')];if(!_0x4dc159[_0x2b1e('0x45')][_0x2b1e('0x48')](_0x2b1e('0x49'))){_0x33fee3['limit']=qs['limit'](_0x4dc159['query'][_0x2b1e('0x2d')]);_0x33fee3[_0x2b1e('0x2c')]=qs[_0x2b1e('0x2c')](_0x4dc159['query'][_0x2b1e('0x2c')]);}_0x33fee3[_0x2b1e('0x6a')]=qs[_0x2b1e('0x4a')](_0x4dc159[_0x2b1e('0x45')][_0x2b1e('0x4a')]);_0x33fee3[_0x2b1e('0x4b')]=qs[_0x2b1e('0x42')](_['pick'](_0x4dc159[_0x2b1e('0x45')],_0x566f50[_0x2b1e('0x42')]));_0x33fee3[_0x2b1e('0x4b')]['OpenchannelAccountId']=_0x24cb38['id'];if(_0x4dc159['query'][_0x2b1e('0x4d')]){_0x33fee3[_0x2b1e('0x4b')]=_['merge'](_0x33fee3[_0x2b1e('0x4b')],{'$or':_['map'](_0x33fee3['attributes'],function(_0x471135){var _0x46d3ed={};_0x46d3ed[_0x471135]={'$like':'%'+_0x4dc159[_0x2b1e('0x45')][_0x2b1e('0x4d')]+'%'};return _0x46d3ed;})});}_0x33fee3=_['merge']({},_0x33fee3,_0x4dc159[_0x2b1e('0x50')]);return db['CannedAnswer'][_0x2b1e('0x2b')]({'where':_0x33fee3[_0x2b1e('0x4b')]})[_0x2b1e('0x1d')](function(_0x3f30fe){_0x59cee1[_0x2b1e('0x2b')]=_0x3f30fe;if(_0x4dc159[_0x2b1e('0x45')][_0x2b1e('0x51')]){_0x33fee3['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x2b1e('0x53')](_0x33fee3);})['then'](function(_0x5c763e){_0x59cee1[_0x2b1e('0x54')]=_0x5c763e;return _0x59cee1;});}})[_0x2b1e('0x1d')](respondWithFilteredResult(_0x4426b9,_0x33fee3))[_0x2b1e('0x27')](handleError(_0x4426b9,null));};exports[_0x2b1e('0x6b')]=function(_0x21f484,_0xacf2b7,_0x21e8a3){return db[_0x2b1e('0x3b')][_0x2b1e('0x56')]({'where':{'id':_0x21f484[_0x2b1e('0x55')]['id']}})['then'](handleEntityNotFound(_0xacf2b7,null))[_0x2b1e('0x1d')](function(_0x50ae1b){if(_0x50ae1b){return _0x50ae1b[_0x2b1e('0x6b')](_0x21f484[_0x2b1e('0x45')][_0x2b1e('0x65')]);}})[_0x2b1e('0x1d')](respondWithStatusCode(_0xacf2b7,null))[_0x2b1e('0x27')](handleError(_0xacf2b7,null));};exports[_0x2b1e('0x6c')]=function(_0x4bfbf8,_0x375420,_0x1c9f2a){var _0x59c372={'body':_0x4bfbf8[_0x2b1e('0x58')],'channel':_0x2b1e('0x6d')};var _0x521510=[];var _0x4f2e30=[];var _0x30bf2a={};var _0x5da88d=![];return db[_0x2b1e('0x6e')][_0x2b1e('0x5e')]()[_0x2b1e('0x1d')](function(_0x49a5e4){if(!_0x49a5e4){throw new db[(_0x2b1e('0x6f'))][(_0x2b1e('0x1b'))](_0x2b1e('0x70'));}_0x521510=_[_0x2b1e('0x71')](_['keys'](_0x49a5e4),[_0x2b1e('0x72'),_0x2b1e('0x73')]);_0x4f2e30=_[_0x2b1e('0x71')](_[_0x2b1e('0x41')](_0x49a5e4),[_0x2b1e('0x72'),_0x2b1e('0x73'),_0x2b1e('0x74'),'ListId']);if(_0x4bfbf8[_0x2b1e('0x58')]['id']){delete _0x4bfbf8[_0x2b1e('0x58')]['id'];}if(_[_0x2b1e('0x75')](_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x76')])){throw new db[(_0x2b1e('0x6f'))][(_0x2b1e('0x1b'))](_0x2b1e('0x77'));}if(_[_0x2b1e('0x75')](_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x58')])||_0x4bfbf8[_0x2b1e('0x58')]['body']===''){throw new db[(_0x2b1e('0x6f'))][(_0x2b1e('0x1b'))](_0x2b1e('0x78'));}if(_[_0x2b1e('0x75')](_0x4bfbf8['body'][_0x2b1e('0x79')])){throw new db[(_0x2b1e('0x6f'))][(_0x2b1e('0x1b'))](_0x2b1e('0x7a')+_0x4f2e30);}if(!_['includes'](_0x4f2e30,_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x79')])){throw new db[(_0x2b1e('0x6f'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4f2e30);}_0x30bf2a[_0x4bfbf8['body'][_0x2b1e('0x79')]]=_0x4bfbf8['body'][_0x2b1e('0x76')];})[_0x2b1e('0x1d')](function(){return db['OpenchannelAccount'][_0x2b1e('0x56')]({'where':{'id':_0x4bfbf8[_0x2b1e('0x55')]['id']},'include':[{'model':db[_0x2b1e('0x7b')],'as':_0x2b1e('0x7c'),'include':[{'model':db[_0x2b1e('0x6e')],'as':_0x2b1e('0x7d'),'where':_0x30bf2a,'limit':0x1,'order':[[_0x2b1e('0x73'),_0x2b1e('0x7e')]]}]},{'model':db['OpenchannelApplication'],'as':_0x2b1e('0x7f')}]});})[_0x2b1e('0x1d')](handleEntityNotFound(_0x375420,null))[_0x2b1e('0x1d')](function(_0x26c14a){if(_0x26c14a&&_0x26c14a[_0x2b1e('0x7c')]){_0x59c372[_0x2b1e('0x80')]=_0x26c14a;_0x59c372[_0x2b1e('0x81')]=_0x26c14a[_0x2b1e('0x7f')];_0x59c372[_0x2b1e('0x82')]=_0x26c14a['List'];_0x59c372[_0x2b1e('0x81')]=_['orderBy'](_0x59c372['applications'],['priority'],[_0x2b1e('0x83')]);if(_0x59c372[_0x2b1e('0x80')]['Applications']){delete _0x59c372[_0x2b1e('0x80')][_0x2b1e('0x7f')];}if(_0x59c372[_0x2b1e('0x80')]['List']&&_0x59c372[_0x2b1e('0x80')][_0x2b1e('0x7c')][_0x2b1e('0x7d')][_0x2b1e('0x47')]){return _0x59c372[_0x2b1e('0x80')][_0x2b1e('0x7c')][_0x2b1e('0x7d')][0x0];}var _0x130353=_['defaults'](_0x4bfbf8['body'],{'firstName':_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x76')],'ListId':_0x26c14a[_0x2b1e('0x84')]});_0x130353[_0x4bfbf8['body'][_0x2b1e('0x79')]]=_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x76')];return db[_0x2b1e('0x6e')][_0x2b1e('0x57')](_0x130353,{'fields':_0x521510,'raw':!![]});}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x375420,null))['then'](function(_0x37eddf){_0x59c372['contact']=_0x37eddf;if(_0x37eddf){var _0x5e5338={'ContactId':_0x37eddf['id'],'OpenchannelAccountId':_0x4bfbf8['params']['id'],'from':(_0x37eddf[_0x2b1e('0x85')]||'')+'\x20'+(_0x37eddf[_0x2b1e('0x86')]||'')};var _0x2b966d={'OpenchannelAccountId':_0x4bfbf8['params']['id'],'closed':![]};if(_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x87')]){_0x2b966d[_0x2b1e('0x87')]=_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x87')];return db['OpenchannelInteraction']['find']({'where':_0x2b966d})[_0x2b1e('0x1d')](function(_0x52e258){if(_0x52e258){return[_0x52e258,![]];}_0x5e5338[_0x2b1e('0x87')]=_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x87')];_0x5e5338['externalUrl']=_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x88')];return db[_0x2b1e('0x89')]['create'](_0x5e5338)['then'](function(_0x16e0c2){return[_0x16e0c2,!![]];});});}else{_0x2b966d[_0x2b1e('0x87')]=null;}_0x2b966d[_0x2b1e('0x8a')]=_0x37eddf['id'];return db[_0x2b1e('0x89')][_0x2b1e('0x56')]({'where':_0x2b966d})[_0x2b1e('0x1d')](function(_0x1db778){if(_0x1db778){return[_0x1db778,![]];}return db[_0x2b1e('0x89')][_0x2b1e('0x57')](_0x5e5338)[_0x2b1e('0x1d')](function(_0x4cc62b){return[_0x4cc62b,!![]];});});}})[_0x2b1e('0x8b')](function(_0x5c8acb,_0x32d4ce){if(_0x5c8acb){_0x5da88d=_0x32d4ce;if(!_0x32d4ce){var _0x14dfee={'from':(_0x59c372[_0x2b1e('0x8c')][_0x2b1e('0x85')]||'')+'\x20'+(_0x59c372['contact'][_0x2b1e('0x86')]||'')};if(_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x87')]&&_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x8d')]&&_0x4bfbf8[_0x2b1e('0x58')]['threadId']!=_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x8d')]){_0x14dfee[_0x2b1e('0x87')]=_0x4bfbf8['body'][_0x2b1e('0x8d')];}return _0x5c8acb['update'](_0x14dfee);}else{return _0x5c8acb;}}})['then'](function(_0x3cc5fe){_0x59c372['interaction']=_0x3cc5fe[_0x2b1e('0x31')]({'plain':!![]});_0x59c372[_0x2b1e('0x8e')][_0x2b1e('0x8f')]=_0x5da88d;if(_0x59c372[_0x2b1e('0x8e')]['created']){if(_0x59c372[_0x2b1e('0x80')][_0x2b1e('0x90')]){_0x59c372[_0x2b1e('0x81')][_0x2b1e('0x91')]({'id':0x0,'priority':_0x59c372[_0x2b1e('0x81')][_0x2b1e('0x47')]+0x1,'app':_0x2b1e('0x92'),'appdata':_0x2b1e('0x93'),'interval':_0x2b1e('0x94')});}}return db[_0x2b1e('0x95')][_0x2b1e('0x57')]({'body':_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x58')],'OpenchannelAccountId':_0x4bfbf8[_0x2b1e('0x55')]['id'],'OpenchannelInteractionId':_0x3cc5fe['id'],'direction':'in','ContactId':_0x59c372['contact']['id'],'AttachmentId':_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x96')]});})[_0x2b1e('0x1d')](function(_0x3e9ae0){_0x59c372['message']=_0x3e9ae0;if(_0x59c372[_0x2b1e('0x8e')][_0x2b1e('0x97')]){return db[_0x2b1e('0x98')][_0x2b1e('0x56')]({'attributes':['id','name'],'where':{'id':_0x59c372[_0x2b1e('0x8e')][_0x2b1e('0x97')]}})[_0x2b1e('0x1d')](function(_0x3aa490){if(_0x3aa490){_0x59c372[_0x2b1e('0x81')][_0x2b1e('0x99')]({'id':0x0,'priority':0x0,'app':_0x2b1e('0x9a'),'appdata':_0x3aa490[_0x2b1e('0x36')]+','+(_0x59c372[_0x2b1e('0x80')]['waitForTheAssignedAgent']||0xa),'interval':_0x2b1e('0x94')});_0x59c372['forcedOwnership']=![];}return respondWithRpcPromise(_0x2b1e('0x9b'),'startRouting',_0x59c372);});}return respondWithRpcPromise(_0x2b1e('0x9b'),_0x2b1e('0x9c'),_0x59c372);})[_0x2b1e('0x1d')](function(_0x1666af){respondWithRpcPromise('EventManager','EventManager',{'event':_0x2b1e('0x6c'),'message':_0x1666af},client9002);return _0x1666af;})[_0x2b1e('0x1d')](respondWithResult(_0x375420,null))[_0x2b1e('0x27')](handleError(_0x375420,null));};exports[_0x2b1e('0x9d')]=function(_0x2782c1,_0x477402,_0x497a68){return db[_0x2b1e('0x3b')][_0x2b1e('0x62')]({'where':{'id':_0x2782c1['params']['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x477402,null))[_0x2b1e('0x1d')](function(_0x244d7c){if(_0x244d7c){return db[_0x2b1e('0x9e')][_0x2b1e('0x9f')](function(_0x2a5318){return db[_0x2b1e('0xa0')][_0x2b1e('0x30')]({'where':{'OpenchannelAccountId':_0x2782c1['params']['id']},'transaction':_0x2a5318})[_0x2b1e('0x1d')](function(_0x5666c2){var _0x4c396c=_[_0x2b1e('0x3a')](_0x2782c1[_0x2b1e('0x58')],function(_0xb547a){_0xb547a[_0x2b1e('0x67')]=_0x2782c1['params']['id'];return _0xb547a;});return db['OpenchannelApplication'][_0x2b1e('0xa1')](_0x4c396c,{'transaction':_0x2a5318});});})[_0x2b1e('0x1d')](function(){return db['OpenchannelApplication'][_0x2b1e('0xa2')]({'where':{'OpenchannelAccountId':_0x2782c1[_0x2b1e('0x55')]['id']},'order':_0x2b1e('0xa3')});});}})['then'](respondWithResult(_0x477402,null))[_0x2b1e('0x27')](handleError(_0x477402,null));};exports[_0x2b1e('0xa4')]=function(_0x440d3b,_0x2bd056,_0x4c8e0a){var _0x337df1={};var _0x25582f={};var _0x51a535;var _0x51f9b7;return db['OpenchannelAccount'][_0x2b1e('0x62')]({'where':{'id':_0x440d3b[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x2bd056,null))['then'](function(_0x44be1d){if(_0x44be1d){_0x51a535=_0x44be1d;_0x25582f['model']=_['keys'](db[_0x2b1e('0xa0')][_0x2b1e('0x3c')]);_0x25582f[_0x2b1e('0x45')]=_['keys'](_0x440d3b[_0x2b1e('0x45')]);_0x25582f[_0x2b1e('0x42')]=_[_0x2b1e('0x43')](_0x25582f[_0x2b1e('0x40')],_0x25582f['query']);_0x337df1['attributes']=_[_0x2b1e('0x43')](_0x25582f[_0x2b1e('0x40')],qs[_0x2b1e('0x44')](_0x440d3b[_0x2b1e('0x45')]['fields']));_0x337df1['attributes']=_0x337df1[_0x2b1e('0x46')][_0x2b1e('0x47')]?_0x337df1[_0x2b1e('0x46')]:_0x25582f['model'];_0x337df1['order']=qs[_0x2b1e('0x4a')](_0x440d3b[_0x2b1e('0x45')]['sort']);_0x337df1[_0x2b1e('0x4b')]=qs['filters'](_[_0x2b1e('0x4c')](_0x440d3b[_0x2b1e('0x45')],_0x25582f['filters']));if(_0x440d3b[_0x2b1e('0x45')][_0x2b1e('0x4d')]){_0x337df1[_0x2b1e('0x4b')]=_[_0x2b1e('0x4e')](_0x337df1[_0x2b1e('0x4b')],{'$or':_['map'](_0x337df1['attributes'],function(_0x1a0874){var _0x3f8d06={};_0x3f8d06[_0x1a0874]={'$like':'%'+_0x440d3b[_0x2b1e('0x45')][_0x2b1e('0x4d')]+'%'};return _0x3f8d06;})});}_0x337df1=_[_0x2b1e('0x4e')]({},_0x337df1,_0x440d3b['options']);return _0x51a535[_0x2b1e('0xa4')](_0x337df1);}})[_0x2b1e('0x1d')](function(_0x182ecc){if(_0x182ecc){_0x51f9b7=_0x182ecc[_0x2b1e('0x47')];if(!_0x440d3b[_0x2b1e('0x45')][_0x2b1e('0x48')](_0x2b1e('0x49'))){_0x337df1[_0x2b1e('0x2d')]=qs[_0x2b1e('0x2d')](_0x440d3b['query'][_0x2b1e('0x2d')]);_0x337df1[_0x2b1e('0x2c')]=qs[_0x2b1e('0x2c')](_0x440d3b[_0x2b1e('0x45')][_0x2b1e('0x2c')]);}return _0x51a535['getApplications'](_0x337df1);}})[_0x2b1e('0x1d')](function(_0x20e6e0){if(_0x20e6e0){return _0x20e6e0?{'count':_0x51f9b7,'rows':_0x20e6e0}:null;}})[_0x2b1e('0x1d')](respondWithResult(_0x2bd056,null))['catch'](handleError(_0x2bd056,null));};exports['getInteractions']=function(_0x100dc4,_0x4e9ac8,_0x16c626){var _0x174ac4={'raw':![],'where':{}};var _0x3c39cd={};var _0x5ec85a={'count':0x0,'rows':[]};return db[_0x2b1e('0x3b')]['findOne']({'where':{'id':_0x100dc4['params']['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x4e9ac8,null))['then'](function(_0x84d91f){if(_0x84d91f){_0x3c39cd[_0x2b1e('0x40')]=_[_0x2b1e('0x41')](db['OpenchannelInteraction'][_0x2b1e('0x3c')]);_0x3c39cd[_0x2b1e('0x45')]=_[_0x2b1e('0x41')](_0x100dc4['query']);_0x3c39cd[_0x2b1e('0x42')]=_[_0x2b1e('0x43')](_0x3c39cd[_0x2b1e('0x40')],_0x3c39cd['query']);_0x174ac4[_0x2b1e('0x46')]=_[_0x2b1e('0x43')](_0x3c39cd['model'],qs['fields'](_0x100dc4[_0x2b1e('0x45')][_0x2b1e('0x44')]));_0x174ac4[_0x2b1e('0x46')]=_0x174ac4[_0x2b1e('0x46')][_0x2b1e('0x47')]?_0x174ac4[_0x2b1e('0x46')]:_0x3c39cd[_0x2b1e('0x40')];if(!_0x100dc4[_0x2b1e('0x45')][_0x2b1e('0x48')](_0x2b1e('0x49'))){_0x174ac4['limit']=qs['limit'](_0x100dc4[_0x2b1e('0x45')]['limit']);_0x174ac4['offset']=qs[_0x2b1e('0x2c')](_0x100dc4[_0x2b1e('0x45')]['offset']);}_0x174ac4[_0x2b1e('0x6a')]=qs[_0x2b1e('0x4a')](_0x100dc4[_0x2b1e('0x45')][_0x2b1e('0x4a')]);_0x174ac4[_0x2b1e('0x4b')]=qs['filters'](_['pick'](_0x100dc4[_0x2b1e('0x45')],_0x3c39cd[_0x2b1e('0x42')]));_0x174ac4[_0x2b1e('0x4b')][_0x2b1e('0x67')]=_0x84d91f['id'];if(_0x100dc4[_0x2b1e('0x45')]['filter']){_0x174ac4[_0x2b1e('0x4b')]=_[_0x2b1e('0x4e')](_0x174ac4[_0x2b1e('0x4b')],{'$or':_[_0x2b1e('0x3a')](_0x174ac4[_0x2b1e('0x46')],function(_0x209d58){var _0x2c05dd={};_0x2c05dd[_0x209d58]={'$like':'%'+_0x100dc4[_0x2b1e('0x45')]['filter']+'%'};return _0x2c05dd;})});}_0x174ac4=_[_0x2b1e('0x4e')]({},_0x174ac4,_0x100dc4['options']);return db[_0x2b1e('0x89')][_0x2b1e('0x2b')]({'where':_0x174ac4[_0x2b1e('0x4b')]})[_0x2b1e('0x1d')](function(_0x1e9864){_0x5ec85a[_0x2b1e('0x2b')]=_0x1e9864;if(_0x100dc4[_0x2b1e('0x45')][_0x2b1e('0x51')]){_0x174ac4[_0x2b1e('0x52')]=[{'model':db[_0x2b1e('0x6e')],'as':'Contact','required':![]},{'model':db[_0x2b1e('0x98')],'as':_0x2b1e('0xa5'),'attributes':[_0x2b1e('0x36'),_0x2b1e('0xa6'),'internal'],'required':![]},{'model':db[_0x2b1e('0xa7')],'as':_0x2b1e('0xa8'),'attributes':['id',_0x2b1e('0x36'),_0x2b1e('0xa9')],'where':_0x100dc4[_0x2b1e('0x45')][_0x2b1e('0xaa')]?{'id':_0x100dc4[_0x2b1e('0x45')][_0x2b1e('0xaa')]}:undefined,'required':_0x100dc4['query'][_0x2b1e('0xaa')]?!![]:![]}];}return db[_0x2b1e('0x89')][_0x2b1e('0x53')](_0x174ac4);})[_0x2b1e('0x1d')](function(_0x12f42c){_0x5ec85a[_0x2b1e('0x54')]=_0x12f42c;return _0x5ec85a;});}})['then'](respondWithFilteredResult(_0x4e9ac8,_0x174ac4))[_0x2b1e('0x27')](handleError(_0x4e9ac8,null));};exports[_0x2b1e('0xab')]=function(_0x329967,_0x33e07e,_0x44c529){return db['OpenchannelAccount']['find']({'where':{'id':_0x329967[_0x2b1e('0x55')]['id']}})['then'](handleEntityNotFound(_0x33e07e,null))[_0x2b1e('0x1d')](function(_0x266f1){if(_0x266f1){return _0x266f1[_0x2b1e('0xab')](_0x329967[_0x2b1e('0x58')][_0x2b1e('0x65')],_[_0x2b1e('0xac')](_0x329967[_0x2b1e('0x58')],[_0x2b1e('0x65'),'id'])||{})[_0x2b1e('0x8b')](function(_0x20c2dc){for(var _0x469b5e=0x0;_0x469b5e<_0x329967[_0x2b1e('0x58')][_0x2b1e('0x65')][_0x2b1e('0x47')];_0x469b5e+=0x1){socket[_0x2b1e('0xad')]('userOpenchannelAccount:save',{'UserId':_0x329967[_0x2b1e('0x58')][_0x2b1e('0x65')][_0x469b5e],'OpenchannelAccountId':_0x329967[_0x2b1e('0x55')]['id']});}return _0x20c2dc;});}})[_0x2b1e('0x1d')](respondWithResult(_0x33e07e,null))[_0x2b1e('0x27')](handleError(_0x33e07e,null));};exports['removeAgents']=function(_0x4ddded,_0x389aa3,_0xf42304){return db[_0x2b1e('0x3b')]['find']({'where':{'id':_0x4ddded[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x389aa3,null))['then'](function(_0x3f7a52){if(_0x3f7a52){return _0x3f7a52[_0x2b1e('0xae')](_0x4ddded[_0x2b1e('0x45')][_0x2b1e('0x65')])[_0x2b1e('0x1d')](function(){if(_['isArray'](_0x4ddded['query'][_0x2b1e('0x65')])){for(var _0x10d9f3=0x0;_0x10d9f3<_0x4ddded['query']['ids'][_0x2b1e('0x47')];_0x10d9f3+=0x1){socket['emit'](_0x2b1e('0xaf'),{'UserId':Number(_0x4ddded[_0x2b1e('0x45')][_0x2b1e('0x65')][_0x10d9f3]),'OpenchannelAccountId':Number(_0x4ddded[_0x2b1e('0x55')]['id'])});}}else{socket[_0x2b1e('0xad')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4ddded['query']['ids']),'OpenchannelAccountId':Number(_0x4ddded['params']['id'])});}});}})[_0x2b1e('0x1d')](respondWithStatusCode(_0x389aa3,null))[_0x2b1e('0x27')](handleError(_0x389aa3,null));};exports[_0x2b1e('0xb0')]=function(_0x20d7d2,_0x4ddf5c,_0x42de9c){var _0x4198b6={};var _0x482ae4={};var _0x28c6af;var _0x3bba75;return db[_0x2b1e('0x3b')]['findOne']({'where':{'id':_0x20d7d2[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x4ddf5c,null))[_0x2b1e('0x1d')](function(_0x8b092a){if(_0x8b092a){_0x28c6af=_0x8b092a;_0x482ae4[_0x2b1e('0x40')]=_[_0x2b1e('0x41')](db['User'][_0x2b1e('0x3c')]);_0x482ae4['query']=_['keys'](_0x20d7d2[_0x2b1e('0x45')]);_0x482ae4[_0x2b1e('0x42')]=_['intersection'](_0x482ae4['model'],_0x482ae4['query']);_0x4198b6[_0x2b1e('0x46')]=_[_0x2b1e('0x43')](_0x482ae4[_0x2b1e('0x40')],qs[_0x2b1e('0x44')](_0x20d7d2['query'][_0x2b1e('0x44')]));_0x4198b6[_0x2b1e('0x46')]=_0x4198b6[_0x2b1e('0x46')][_0x2b1e('0x47')]?_0x4198b6['attributes']:_0x482ae4[_0x2b1e('0x40')];_0x4198b6[_0x2b1e('0x6a')]=qs[_0x2b1e('0x4a')](_0x20d7d2[_0x2b1e('0x45')][_0x2b1e('0x4a')]);_0x4198b6['where']=qs[_0x2b1e('0x42')](_[_0x2b1e('0x4c')](_0x20d7d2['query'],_0x482ae4[_0x2b1e('0x42')]));if(_0x20d7d2['query'][_0x2b1e('0x4d')]){_0x4198b6['where']=_[_0x2b1e('0x4e')](_0x4198b6[_0x2b1e('0x4b')],{'$or':_[_0x2b1e('0x3a')](_0x4198b6['attributes'],function(_0x407ab4){var _0x16f7bb={};_0x16f7bb[_0x407ab4]={'$like':'%'+_0x20d7d2[_0x2b1e('0x45')][_0x2b1e('0x4d')]+'%'};return _0x16f7bb;})});}_0x4198b6=_['merge']({},_0x4198b6,_0x20d7d2[_0x2b1e('0x50')]);return _0x28c6af['getAgents'](_0x4198b6);}})[_0x2b1e('0x1d')](function(_0xe075db){if(_0xe075db){_0x3bba75=_0xe075db[_0x2b1e('0x47')];if(!_0x20d7d2['query']['hasOwnProperty'](_0x2b1e('0x49'))){_0x4198b6[_0x2b1e('0x2d')]=qs[_0x2b1e('0x2d')](_0x20d7d2['query'][_0x2b1e('0x2d')]);_0x4198b6['offset']=qs[_0x2b1e('0x2c')](_0x20d7d2['query'][_0x2b1e('0x2c')]);}return _0x28c6af[_0x2b1e('0xb0')](_0x4198b6);}})[_0x2b1e('0x1d')](function(_0x63802e){if(_0x63802e){return _0x63802e?{'count':_0x3bba75,'rows':_0x63802e}:null;}})['then'](respondWithResult(_0x4ddf5c,null))[_0x2b1e('0x27')](handleError(_0x4ddf5c,null));};exports[_0x2b1e('0xb1')]=function(_0x24fcf9,_0x2a3922,_0x27a2f7){var _0x322005,_0x310d2c,_0x4ea25d;if(_['isNil'](_0x24fcf9[_0x2b1e('0x58')]['body'])||_0x24fcf9['body'][_0x2b1e('0x58')]===''){throw new db[(_0x2b1e('0x6f'))]['ValidationError'](_0x2b1e('0x78'));}if(_[_0x2b1e('0x75')](_0x24fcf9[_0x2b1e('0x58')]['to'])){}_0x322005=_0x24fcf9[_0x2b1e('0x58')]['to'];return db[_0x2b1e('0x3b')]['findOne']({'where':{'id':_0x24fcf9[_0x2b1e('0x55')]['id']}})['then'](handleEntityNotFound(_0x2a3922,null))['then'](function(_0x1d5826){if(_0x1d5826){return db['OpenchannelAccount'][_0x2b1e('0x56')]({'where':{'id':_0x1d5826['id']},'include':[{'model':db[_0x2b1e('0x7b')],'as':'List','include':[{'model':db[_0x2b1e('0x6e')],'as':_0x2b1e('0x7d'),'where':{[_0x1d5826['mapKey']]:_0x322005},'limit':0x1,'order':[[_0x2b1e('0x73'),_0x2b1e('0x7e')]]}]}]})['then'](handleEntityNotFound(_0x2a3922,null))[_0x2b1e('0x1d')](function(_0x508fd8){if(_0x508fd8&&_0x508fd8[_0x2b1e('0x7c')]){_0x310d2c=_0x508fd8[_0x2b1e('0x31')]({'plain':!![]});if(_0x310d2c[_0x2b1e('0x7c')]&&_0x310d2c['List'][_0x2b1e('0x7d')][_0x2b1e('0x47')]){return _0x310d2c['List'][_0x2b1e('0x7d')][0x0];}return db[_0x2b1e('0x6e')][_0x2b1e('0x57')](_[_0x2b1e('0x13')](_0x24fcf9[_0x2b1e('0x58')],{'firstName':_0x322005,[_0x508fd8[_0x2b1e('0x79')]]:_0x322005,'phone':_0x322005,'ListId':_0x310d2c[_0x2b1e('0x84')]}));}})['then'](handleEntityNotFound(_0x2a3922,null))[_0x2b1e('0x1d')](function(_0x50cd3b){if(_0x50cd3b){_0x4ea25d=_0x50cd3b;return db['OpenchannelInteraction'][_0x2b1e('0x56')]({'where':{'ContactId':_0x4ea25d['id'],'closed':![],'OpenchannelAccountId':_0x310d2c['id']}})[_0x2b1e('0x1d')](function(_0x3115d2){if(_0x3115d2){return[_0x3115d2,![]];}return db[_0x2b1e('0x89')][_0x2b1e('0x57')]({'UserId':_0x24fcf9[_0x2b1e('0x5b')]['id'],'ContactId':_0x4ea25d['id'],'OpenchannelAccountId':_0x310d2c['id'],'lastMsgDirection':'out','Messages':[_[_0x2b1e('0x4e')](_0x24fcf9[_0x2b1e('0x58')],{'read':![],'body':_0x24fcf9[_0x2b1e('0x58')][_0x2b1e('0x58')],'OpenchannelAccountId':_0x310d2c['id'],'UserId':_0x24fcf9[_0x2b1e('0x5b')]['id'],'ContactId':_0x4ea25d['id']})]},{'include':[{'model':db[_0x2b1e('0x95')],'as':'Messages'}]})[_0x2b1e('0x1d')](function(_0x45ff15){return[_0x45ff15,!![]];});});}})[_0x2b1e('0x8b')](function(_0x54831a,_0x3c218d){if(_0x3c218d){return _0x54831a;}return db[_0x2b1e('0x95')][_0x2b1e('0x57')](_[_0x2b1e('0x4e')](_0x24fcf9[_0x2b1e('0x58')],{'read':![],'body':_0x24fcf9[_0x2b1e('0x58')]['body'],'OpenchannelAccountId':_0x310d2c['id'],'OpenchannelInteractionId':_0x54831a['id'],'UserId':_0x24fcf9[_0x2b1e('0x5b')]['id'],'ContactId':_0x4ea25d['id']}))[_0x2b1e('0x1d')](function(_0x4b36d3){_0x54831a[_0x2b1e('0xb2')][_0x2b1e('0xb3')]=[];_0x54831a[_0x2b1e('0xb2')][_0x2b1e('0xb3')]['push'](_0x4b36d3['dataValues']);return _0x54831a;});});}})[_0x2b1e('0x1d')](respondWithResult(_0x2a3922,null))[_0x2b1e('0x27')](handleError(_0x2a3922,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 0dbf59d..a587623 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 _0xec0b=['setMaxListeners','update','emit','hasOwnProperty','events','OpenchannelAccount'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xec0b,0x17e));var _0xbec0=function(_0x13bd0e,_0x226c7){_0x13bd0e=_0x13bd0e-0x0;var _0xc082d7=_0xec0b[_0x13bd0e];return _0xc082d7;};'use strict';var EventEmitter=require(_0xbec0('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xbec0('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbec0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbec0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x568438){return function(_0x8fb331,_0x500465,_0x2c395e){OpenchannelAccountEvents[_0xbec0('0x4')](_0x568438+':'+_0x8fb331['id'],_0x8fb331);OpenchannelAccountEvents[_0xbec0('0x4')](_0x568438,_0x8fb331);_0x2c395e(null);};}for(var e in events){if(events[_0xbec0('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x677a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0x677a,0x7d));var _0xa677=function(_0x4932e3,_0x3bcbec){_0x4932e3=_0x4932e3-0x0;var _0xfccb07=_0x677a[_0x4932e3];return _0xfccb07;};'use strict';var EventEmitter=require(_0xa677('0x0'));var OpenchannelAccount=require(_0xa677('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xa677('0x2')](0x0);var events={'afterCreate':_0xa677('0x3'),'afterUpdate':_0xa677('0x4'),'afterDestroy':_0xa677('0x5')};function emitEvent(_0xe7cbc2){return function(_0x3546e8,_0xb9acae,_0x1309b3){OpenchannelAccountEvents[_0xa677('0x6')](_0xe7cbc2+':'+_0x3546e8['id'],_0x3546e8);OpenchannelAccountEvents['emit'](_0xe7cbc2,_0x3546e8);_0x1309b3(null);};}for(var e in events){if(events[_0xa677('0x7')](e)){var event=events[e];OpenchannelAccount[_0xa677('0x8')](e,emitEvent(event));}}module[_0xa677('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 9f89f87..2e8eef8 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 _0x9df0=['define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelAccount.attributes','exports'];(function(_0x55c00d,_0x520cb6){var _0x254a8f=function(_0x2b3378){while(--_0x2b3378){_0x55c00d['push'](_0x55c00d['shift']());}};_0x254a8f(++_0x520cb6);}(_0x9df0,0x92));var _0x09df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9df0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x09df('0x0'));var util=require(_0x09df('0x1'));var logger=require(_0x09df('0x2'))(_0x09df('0x3'));var moment=require(_0x09df('0x4'));var BPromise=require(_0x09df('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09df('0x6'));var rimraf=require(_0x09df('0x7'));var config=require('../../config/environment');var attributes=require(_0x09df('0x8'));module[_0x09df('0x9')]=function(_0x1796b4,_0x44ef36){return _0x1796b4[_0x09df('0xa')](_0x09df('0xb'),attributes,{'tableName':_0x09df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38a5=['path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','util','../../config/logger','request-promise'];(function(_0x4e33c0,_0x555fda){var _0x1f7aa3=function(_0x2b688b){while(--_0x2b688b){_0x4e33c0['push'](_0x4e33c0['shift']());}};_0x1f7aa3(++_0x555fda);}(_0x38a5,0x1aa));var _0x538a=function(_0x458d59,_0x201d8d){_0x458d59=_0x458d59-0x0;var _0x213c63=_0x38a5[_0x458d59];return _0x213c63;};'use strict';var _=require('lodash');var util=require(_0x538a('0x0'));var logger=require(_0x538a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x538a('0x2'));var fs=require('fs');var path=require(_0x538a('0x3'));var rimraf=require(_0x538a('0x4'));var config=require(_0x538a('0x5'));var attributes=require(_0x538a('0x6'));module[_0x538a('0x7')]=function(_0x46b81a,_0x3e816a){return _0x46b81a[_0x538a('0x8')](_0x538a('0x9'),attributes,{'tableName':_0x538a('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 274d0ba..fdb9361 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 _0x6175=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x6175,0x71));var _0x5617=function(_0x232b51,_0x3da839){_0x232b51=_0x232b51-0x0;var _0x5b7777=_0x6175[_0x232b51];return _0x5b7777;};'use strict';var _=require('lodash');var util=require(_0x5617('0x0'));var moment=require(_0x5617('0x1'));var BPromise=require(_0x5617('0x2'));var rs=require(_0x5617('0x3'));var fs=require('fs');var Redis=require(_0x5617('0x4'));var db=require(_0x5617('0x5'))['db'];var utils=require(_0x5617('0x6'));var logger=require('../../config/logger')(_0x5617('0x7'));var config=require(_0x5617('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5617('0x9')][_0x5617('0xa')]({'port':0x232a});config[_0x5617('0xb')]=_['defaults'](config[_0x5617('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5617('0xc'))(new Redis(config['redis']));require(_0x5617('0xd'))[_0x5617('0xe')](socket);function respondWithRpcPromise(_0x249434,_0x5ab852,_0x3c111c){return new BPromise(function(_0x191f2c,_0x524fda){return client[_0x5617('0xf')](_0x249434,_0x3c111c)[_0x5617('0x10')](function(_0x4f6ac9){logger[_0x5617('0x11')](_0x5617('0x12'),_0x5ab852,_0x5617('0x13'));logger[_0x5617('0x14')](_0x5617('0x15'),_0x5ab852,'request\x20sent',JSON[_0x5617('0x16')](_0x4f6ac9));if(_0x4f6ac9['error']){if(_0x4f6ac9['error'][_0x5617('0x17')]===0x1f4){logger[_0x5617('0x18')](_0x5617('0x12'),_0x5ab852,_0x4f6ac9['error'][_0x5617('0x19')]);return _0x524fda(_0x4f6ac9[_0x5617('0x18')][_0x5617('0x19')]);}logger['error'](_0x5617('0x12'),_0x5ab852,_0x4f6ac9[_0x5617('0x18')][_0x5617('0x19')]);return _0x191f2c(_0x4f6ac9['error'][_0x5617('0x19')]);}else{logger[_0x5617('0x11')](_0x5617('0x12'),_0x5ab852,'request\x20sent');_0x191f2c(_0x4f6ac9[_0x5617('0x1a')][_0x5617('0x19')]);}})[_0x5617('0x1b')](function(_0x4affff){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5ab852,_0x4affff);_0x524fda(_0x4affff);});});} \ No newline at end of file +var _0x658b=['redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0xe004a9,_0x29eab9){var _0x3c097b=function(_0x2098f6){while(--_0x2098f6){_0xe004a9['push'](_0xe004a9['shift']());}};_0x3c097b(++_0x29eab9);}(_0x658b,0x11f));var _0xb658=function(_0xa25ebf,_0x5393f0){_0xa25ebf=_0xa25ebf-0x0;var _0x3d033d=_0x658b[_0xa25ebf];return _0x3d033d;};'use strict';var _=require(_0xb658('0x0'));var util=require(_0xb658('0x1'));var moment=require(_0xb658('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb658('0x3'));var db=require(_0xb658('0x4'))['db'];var utils=require(_0xb658('0x5'));var logger=require(_0xb658('0x6'))(_0xb658('0x7'));var config=require('../../config/environment');var jayson=require(_0xb658('0x8'));var client=jayson['client'][_0xb658('0x9')]({'port':0x232a});config[_0xb658('0xa')]=_[_0xb658('0xb')](config[_0xb658('0xa')],{'host':_0xb658('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb658('0xa')]));require(_0xb658('0xd'))[_0xb658('0xe')](socket);function respondWithRpcPromise(_0x2116d6,_0x1a728f,_0x4de14a){return new BPromise(function(_0x59a7f1,_0x2247e3){return client[_0xb658('0xf')](_0x2116d6,_0x4de14a)[_0xb658('0x10')](function(_0x52739e){logger[_0xb658('0x11')](_0xb658('0x12'),_0x1a728f,'request\x20sent');logger[_0xb658('0x13')](_0xb658('0x14'),_0x1a728f,_0xb658('0x15'),JSON[_0xb658('0x16')](_0x52739e));if(_0x52739e[_0xb658('0x17')]){if(_0x52739e[_0xb658('0x17')][_0xb658('0x18')]===0x1f4){logger[_0xb658('0x17')](_0xb658('0x12'),_0x1a728f,_0x52739e[_0xb658('0x17')][_0xb658('0x19')]);return _0x2247e3(_0x52739e['error'][_0xb658('0x19')]);}logger['error'](_0xb658('0x12'),_0x1a728f,_0x52739e[_0xb658('0x17')][_0xb658('0x19')]);return _0x59a7f1(_0x52739e[_0xb658('0x17')][_0xb658('0x19')]);}else{logger[_0xb658('0x11')](_0xb658('0x12'),_0x1a728f,_0xb658('0x15'));_0x59a7f1(_0x52739e[_0xb658('0x1a')][_0xb658('0x19')]);}})['catch'](function(_0x1ece11){logger[_0xb658('0x17')](_0xb658('0x12'),_0x1a728f,_0x1ece11);_0x2247e3(_0x1ece11);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 61c61dd..e2d384f 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 _0xff4f=['update','emit','removeListener','length','./openchannelAccount.events','remove'];(function(_0x5b3309,_0xee99e9){var _0x3d373e=function(_0x421bfe){while(--_0x421bfe){_0x5b3309['push'](_0x5b3309['shift']());}};_0x3d373e(++_0xee99e9);}(_0xff4f,0xa0));var _0xfff4=function(_0x271f2f,_0x3d01b5){_0x271f2f=_0x271f2f-0x0;var _0x116945=_0xff4f[_0x271f2f];return _0x116945;};'use strict';var OpenchannelAccountEvents=require(_0xfff4('0x0'));var events=['save',_0xfff4('0x1'),_0xfff4('0x2')];function createListener(_0x2a0fc9,_0x2df78b){return function(_0x60cbf){_0x2df78b[_0xfff4('0x3')](_0x2a0fc9,_0x60cbf);};}function removeListener(_0x1686fc,_0x3acddb){return function(){OpenchannelAccountEvents[_0xfff4('0x4')](_0x1686fc,_0x3acddb);};}exports['register']=function(_0x1de03d){for(var _0x37eb11=0x0,_0xeb1bc6=events[_0xfff4('0x5')];_0x37eb11<_0xeb1bc6;_0x37eb11++){var _0x131f5e=events[_0x37eb11];var _0x2ae5a8=createListener('openchannelAccount:'+_0x131f5e,_0x1de03d);OpenchannelAccountEvents['on'](_0x131f5e,_0x2ae5a8);}}; \ No newline at end of file +var _0x93bb=['length','./openchannelAccount.events','save','remove','emit','removeListener','register'];(function(_0x6552e9,_0x232ad2){var _0x30d56b=function(_0x2d346f){while(--_0x2d346f){_0x6552e9['push'](_0x6552e9['shift']());}};_0x30d56b(++_0x232ad2);}(_0x93bb,0xe8));var _0xb93b=function(_0x394b59,_0x17eff0){_0x394b59=_0x394b59-0x0;var _0x10ccf7=_0x93bb[_0x394b59];return _0x10ccf7;};'use strict';var OpenchannelAccountEvents=require(_0xb93b('0x0'));var events=[_0xb93b('0x1'),_0xb93b('0x2'),'update'];function createListener(_0x5d641d,_0xfca273){return function(_0x4450c8){_0xfca273[_0xb93b('0x3')](_0x5d641d,_0x4450c8);};}function removeListener(_0x56f4b3,_0x540f91){return function(){OpenchannelAccountEvents[_0xb93b('0x4')](_0x56f4b3,_0x540f91);};}exports[_0xb93b('0x5')]=function(_0x3d0c6a){for(var _0x89406=0x0,_0x26fa91=events[_0xb93b('0x6')];_0x89406<_0x26fa91;_0x89406++){var _0x405c6a=events[_0x89406];var _0xc1290e=createListener('openchannelAccount:'+_0x405c6a,_0x3d0c6a);OpenchannelAccountEvents['on'](_0x405c6a,_0xc1290e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index c46c61c..3d43d95 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 _0x42bc=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','update','destroy','multer','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x42bc,0xa8));var _0xc42b=function(_0x2236dc,_0x43c7f9){_0x2236dc=_0x2236dc-0x0;var _0x20583f=_0x42bc[_0x2236dc];return _0x20583f;};'use strict';var multer=require(_0xc42b('0x0'));var util=require(_0xc42b('0x1'));var path=require('path');var timeout=require(_0xc42b('0x2'));var express=require(_0xc42b('0x3'));var router=express[_0xc42b('0x4')]();var auth=require(_0xc42b('0x5'));var interaction=require(_0xc42b('0x6'));var config=require(_0xc42b('0x7'));var controller=require('./openchannelApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc42b('0x8')]);router[_0xc42b('0x9')](_0xc42b('0xa'),auth[_0xc42b('0xb')](),controller[_0xc42b('0xc')]);router[_0xc42b('0xd')]('/',auth[_0xc42b('0xb')](),controller[_0xc42b('0xe')]);router['put'](_0xc42b('0xa'),auth['isAuthenticated'](),controller[_0xc42b('0xf')]);router['delete']('/:id',auth[_0xc42b('0xb')](),controller[_0xc42b('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb434=['post','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x4e2adf,_0x2c273){var _0x113d4f=function(_0x43c686){while(--_0x43c686){_0x4e2adf['push'](_0x4e2adf['shift']());}};_0x113d4f(++_0x2c273);}(_0xb434,0xe4));var _0x4b43=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0xb434[_0x6dfbaa];return _0xfbe02;};'use strict';var multer=require(_0x4b43('0x0'));var util=require(_0x4b43('0x1'));var path=require(_0x4b43('0x2'));var timeout=require('connect-timeout');var express=require(_0x4b43('0x3'));var router=express['Router']();var auth=require(_0x4b43('0x4'));var interaction=require(_0x4b43('0x5'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x4b43('0x6')]('/',auth[_0x4b43('0x7')](),controller[_0x4b43('0x8')]);router[_0x4b43('0x6')](_0x4b43('0x9'),auth[_0x4b43('0x7')](),controller['show']);router[_0x4b43('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4b43('0x9'),auth[_0x4b43('0x7')](),controller['update']);router[_0x4b43('0xb')](_0x4b43('0x9'),auth[_0x4b43('0x7')](),controller[_0x4b43('0xc')]);module[_0x4b43('0xd')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index ffb3789..1ddb1e9 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 _0xd3c5=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd3c5,0x1a1));var _0x5d3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3c5[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5d3c('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5d3c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5d3c('0x2')],'allowNull':![],'defaultValue':_0x5d3c('0x3')},'appdata':{'type':Sequelize[_0x5d3c('0x4')]()},'description':{'type':Sequelize[_0x5d3c('0x2')]},'interval':{'type':Sequelize[_0x5d3c('0x2')],'defaultValue':_0x5d3c('0x5')}}; \ No newline at end of file +var _0xc988=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x4005e8,_0x52a3b5){var _0x2d2903=function(_0x21bac7){while(--_0x21bac7){_0x4005e8['push'](_0x4005e8['shift']());}};_0x2d2903(++_0x52a3b5);}(_0xc988,0x12f));var _0x8c98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc988[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x8c98('0x0'));module[_0x8c98('0x1')]={'priority':{'type':Sequelize[_0x8c98('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8c98('0x3')],'allowNull':![],'defaultValue':_0x8c98('0x4')},'appdata':{'type':Sequelize[_0x8c98('0x5')]()},'description':{'type':Sequelize[_0x8c98('0x3')]},'interval':{'type':Sequelize[_0x8c98('0x3')],'defaultValue':_0x8c98('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index acf41ee..047edaa 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 _0x3626=['to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','update','then','destroy','end','stack','name','send','index','OpenchannelApplication','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','options','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x423453,_0x47fbd0){var _0x2da39d=function(_0x4999d2){while(--_0x4999d2){_0x423453['push'](_0x423453['shift']());}};_0x2da39d(++_0x47fbd0);}(_0x3626,0x1ac));var _0x6362=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3626[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x6362('0x0'));var emlformat=require(_0x6362('0x1'));var rimraf=require(_0x6362('0x2'));var zipdir=require(_0x6362('0x3'));var jsonpatch=require(_0x6362('0x4'));var rp=require('request-promise');var moment=require(_0x6362('0x5'));var BPromise=require(_0x6362('0x6'));var Mustache=require(_0x6362('0x7'));var util=require(_0x6362('0x8'));var path=require(_0x6362('0x9'));var sox=require('sox');var csv=require(_0x6362('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6362('0xb'));var crypto=require(_0x6362('0xc'));var jsforce=require(_0x6362('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6362('0xa'));var querystring=require(_0x6362('0xe'));var Papa=require(_0x6362('0xf'));var Redis=require(_0x6362('0x10'));var authService=require(_0x6362('0x11'));var qs=require(_0x6362('0x12'));var as=require(_0x6362('0x13'));var hardwareService=require(_0x6362('0x14'));var logger=require(_0x6362('0x15'))(_0x6362('0x16'));var utils=require(_0x6362('0x17'));var config=require(_0x6362('0x18'));var db=require(_0x6362('0x19'))['db'];function respondWithStatusCode(_0xb1d99,_0x22881f){_0x22881f=_0x22881f||0xcc;return function(_0x11ea5a){if(_0x11ea5a){return _0xb1d99[_0x6362('0x1a')](_0x22881f);}return _0xb1d99[_0x6362('0x1b')](_0x22881f)['end']();};}function respondWithResult(_0x5a4b3b,_0x1d2a55){_0x1d2a55=_0x1d2a55||0xc8;return function(_0x44952d){if(_0x44952d){return _0x5a4b3b[_0x6362('0x1b')](_0x1d2a55)[_0x6362('0x1c')](_0x44952d);}};}function respondWithFilteredResult(_0x54ae23,_0x13e64d){return function(_0x2664a5){if(_0x2664a5){var _0x426d3a=_0x2664a5[_0x6362('0x1d')],_0xeb4839=_0x13e64d['offset'],_0x14dad6=_0x13e64d[_0x6362('0x1e')]+_0x13e64d['limit'],_0x40c4fe;if(_0x14dad6>=_0x426d3a){_0x14dad6=_0x426d3a;_0x40c4fe=0xc8;}else{_0x40c4fe=0xce;}_0x54ae23[_0x6362('0x1b')](_0x40c4fe);return _0x54ae23['set'](_0x6362('0x1f'),_0xeb4839+'-'+_0x14dad6+'/'+_0x426d3a)[_0x6362('0x1c')](_0x2664a5);}return null;};}function patchUpdates(_0x4564f6){return function(_0x2b6073){try{jsonpatch['apply'](_0x2b6073,_0x4564f6,!![]);}catch(_0x3b4aaa){return BPromise['reject'](_0x3b4aaa);}return _0x2b6073['save']();};}function saveUpdates(_0x3091af,_0x54d0d2){return function(_0xadec31){if(_0xadec31){return _0xadec31[_0x6362('0x20')](_0x3091af)[_0x6362('0x21')](function(_0x3066db){return _0x3066db;});}return null;};}function removeEntity(_0x5543ab,_0x376af7){return function(_0x3e28d9){if(_0x3e28d9){return _0x3e28d9[_0x6362('0x22')]()[_0x6362('0x21')](function(){_0x5543ab[_0x6362('0x1b')](0xcc)[_0x6362('0x23')]();});}};}function handleEntityNotFound(_0x3a3a04,_0x2ae2d2){return function(_0x51ea12){if(!_0x51ea12){_0x3a3a04[_0x6362('0x1a')](0x194);}return _0x51ea12;};}function handleError(_0x8b64d,_0x5f5d62){_0x5f5d62=_0x5f5d62||0x1f4;return function(_0x1631f6){logger['error'](_0x1631f6[_0x6362('0x24')]);if(_0x1631f6[_0x6362('0x25')]){delete _0x1631f6[_0x6362('0x25')];}_0x8b64d[_0x6362('0x1b')](_0x5f5d62)[_0x6362('0x26')](_0x1631f6);};}exports[_0x6362('0x27')]=function(_0x3a00cd,_0x1a87ba){var _0x2cced7={},_0x5079ce={},_0x37b98f={'count':0x0,'rows':[]};var _0x867586=_['map'](db[_0x6362('0x28')]['rawAttributes'],function(_0x25a48c){return{'name':_0x25a48c[_0x6362('0x29')],'type':_0x25a48c[_0x6362('0x2a')][_0x6362('0x2b')]};});_0x5079ce['model']=_[_0x6362('0x2c')](_0x867586,_0x6362('0x25'));_0x5079ce['query']=_[_0x6362('0x2d')](_0x3a00cd[_0x6362('0x2e')]);_0x5079ce[_0x6362('0x2f')]=_[_0x6362('0x30')](_0x5079ce[_0x6362('0x31')],_0x5079ce[_0x6362('0x2e')]);_0x2cced7[_0x6362('0x32')]=_[_0x6362('0x30')](_0x5079ce[_0x6362('0x31')],qs[_0x6362('0x33')](_0x3a00cd[_0x6362('0x2e')][_0x6362('0x33')]));_0x2cced7[_0x6362('0x32')]=_0x2cced7[_0x6362('0x32')][_0x6362('0x34')]?_0x2cced7[_0x6362('0x32')]:_0x5079ce[_0x6362('0x31')];if(!_0x3a00cd[_0x6362('0x2e')][_0x6362('0x35')](_0x6362('0x36'))){_0x2cced7[_0x6362('0x37')]=qs[_0x6362('0x37')](_0x3a00cd['query']['limit']);_0x2cced7['offset']=qs[_0x6362('0x1e')](_0x3a00cd[_0x6362('0x2e')][_0x6362('0x1e')]);}_0x2cced7[_0x6362('0x38')]=qs[_0x6362('0x39')](_0x3a00cd['query'][_0x6362('0x39')]);_0x2cced7['where']=qs[_0x6362('0x2f')](_[_0x6362('0x3a')](_0x3a00cd['query'],_0x5079ce[_0x6362('0x2f')]),_0x867586);if(_0x3a00cd[_0x6362('0x2e')]['filter']){_0x2cced7[_0x6362('0x3b')]=_[_0x6362('0x3c')](_0x2cced7[_0x6362('0x3b')],{'$or':_['map'](_0x867586,function(_0x531a00){if(_0x531a00[_0x6362('0x2a')]!==_0x6362('0x3d')){var _0x1ad53f={};_0x1ad53f[_0x531a00[_0x6362('0x25')]]={'$like':'%'+_0x3a00cd[_0x6362('0x2e')]['filter']+'%'};return _0x1ad53f;}})});}_0x2cced7=_[_0x6362('0x3c')]({},_0x2cced7,_0x3a00cd[_0x6362('0x3e')]);var _0x228725={'where':_0x2cced7[_0x6362('0x3b')]};return db[_0x6362('0x28')][_0x6362('0x1d')](_0x228725)[_0x6362('0x21')](function(_0x557591){_0x37b98f[_0x6362('0x1d')]=_0x557591;if(_0x3a00cd[_0x6362('0x2e')]['includeAll']){_0x2cced7['include']=[{'all':!![]}];}return db[_0x6362('0x28')][_0x6362('0x3f')](_0x2cced7);})[_0x6362('0x21')](function(_0x2a84dc){_0x37b98f['rows']=_0x2a84dc;return _0x37b98f;})[_0x6362('0x21')](respondWithFilteredResult(_0x1a87ba,_0x2cced7))[_0x6362('0x40')](handleError(_0x1a87ba,null));};exports[_0x6362('0x41')]=function(_0x7c93e1,_0x842e0f){var _0x28939a={'raw':!![],'where':{'id':_0x7c93e1[_0x6362('0x42')]['id']}},_0x3f9704={};_0x3f9704['model']=_[_0x6362('0x2d')](db[_0x6362('0x28')][_0x6362('0x43')]);_0x3f9704[_0x6362('0x2e')]=_[_0x6362('0x2d')](_0x7c93e1[_0x6362('0x2e')]);_0x3f9704[_0x6362('0x2f')]=_[_0x6362('0x30')](_0x3f9704[_0x6362('0x31')],_0x3f9704[_0x6362('0x2e')]);_0x28939a[_0x6362('0x32')]=_['intersection'](_0x3f9704[_0x6362('0x31')],qs['fields'](_0x7c93e1['query'][_0x6362('0x33')]));_0x28939a[_0x6362('0x32')]=_0x28939a['attributes'][_0x6362('0x34')]?_0x28939a[_0x6362('0x32')]:_0x3f9704['model'];if(_0x7c93e1['query'][_0x6362('0x44')]){_0x28939a[_0x6362('0x45')]=[{'all':!![]}];}_0x28939a=_['merge']({},_0x28939a,_0x7c93e1[_0x6362('0x3e')]);return db['OpenchannelApplication'][_0x6362('0x46')](_0x28939a)[_0x6362('0x21')](handleEntityNotFound(_0x842e0f,null))['then'](respondWithResult(_0x842e0f,null))[_0x6362('0x40')](handleError(_0x842e0f,null));};exports[_0x6362('0x47')]=function(_0x5ba432,_0x1d5abb){return db[_0x6362('0x28')]['create'](_0x5ba432[_0x6362('0x48')],{})[_0x6362('0x21')](respondWithResult(_0x1d5abb,0xc9))[_0x6362('0x40')](handleError(_0x1d5abb,null));};exports[_0x6362('0x20')]=function(_0x441152,_0x4407b5){if(_0x441152['body']['id']){delete _0x441152[_0x6362('0x48')]['id'];}return db[_0x6362('0x28')]['find']({'where':{'id':_0x441152['params']['id']}})[_0x6362('0x21')](handleEntityNotFound(_0x4407b5,null))[_0x6362('0x21')](saveUpdates(_0x441152[_0x6362('0x48')],null))[_0x6362('0x21')](respondWithResult(_0x4407b5,null))[_0x6362('0x40')](handleError(_0x4407b5,null));};exports[_0x6362('0x22')]=function(_0x336f11,_0x3fe93f){return db[_0x6362('0x28')]['find']({'where':{'id':_0x336f11[_0x6362('0x42')]['id']}})['then'](handleEntityNotFound(_0x3fe93f,null))[_0x6362('0x21')](removeEntity(_0x3fe93f,null))[_0x6362('0x40')](handleError(_0x3fe93f,null));}; \ No newline at end of file +var _0x7f1d=['sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','end','status','json','count','offset','limit','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x3990e6,_0x1091bc){var _0x12ed6d=function(_0x14e260){while(--_0x14e260){_0x3990e6['push'](_0x3990e6['shift']());}};_0x12ed6d(++_0x1091bc);}(_0x7f1d,0x8e));var _0xd7f1=function(_0x4454b2,_0x3f408b){_0x4454b2=_0x4454b2-0x0;var _0x50b8f1=_0x7f1d[_0x4454b2];return _0x50b8f1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd7f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd7f1('0x1'));var jsonpatch=require(_0xd7f1('0x2'));var rp=require(_0xd7f1('0x3'));var moment=require(_0xd7f1('0x4'));var BPromise=require(_0xd7f1('0x5'));var Mustache=require('mustache');var util=require(_0xd7f1('0x6'));var path=require(_0xd7f1('0x7'));var sox=require(_0xd7f1('0x8'));var csv=require(_0xd7f1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd7f1('0xa'));var crypto=require(_0xd7f1('0xb'));var jsforce=require(_0xd7f1('0xc'));var deskjs=require(_0xd7f1('0xd'));var toCsv=require(_0xd7f1('0x9'));var querystring=require('querystring');var Papa=require(_0xd7f1('0xe'));var Redis=require(_0xd7f1('0xf'));var authService=require(_0xd7f1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd7f1('0x11'));var hardwareService=require(_0xd7f1('0x12'));var logger=require(_0xd7f1('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd7f1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e531c,_0x3bce4){_0x3bce4=_0x3bce4||0xcc;return function(_0x4993e0){if(_0x4993e0){return _0x2e531c['sendStatus'](_0x3bce4);}return _0x2e531c['status'](_0x3bce4)[_0xd7f1('0x15')]();};}function respondWithResult(_0x5224b1,_0x3f8994){_0x3f8994=_0x3f8994||0xc8;return function(_0x266297){if(_0x266297){return _0x5224b1[_0xd7f1('0x16')](_0x3f8994)[_0xd7f1('0x17')](_0x266297);}};}function respondWithFilteredResult(_0x24357b,_0x38e426){return function(_0x77de72){if(_0x77de72){var _0x9598e4=_0x77de72[_0xd7f1('0x18')],_0x40b99c=_0x38e426['offset'],_0xac5031=_0x38e426[_0xd7f1('0x19')]+_0x38e426[_0xd7f1('0x1a')],_0xb3932c;if(_0xac5031>=_0x9598e4){_0xac5031=_0x9598e4;_0xb3932c=0xc8;}else{_0xb3932c=0xce;}_0x24357b[_0xd7f1('0x16')](_0xb3932c);return _0x24357b['set']('Content-Range',_0x40b99c+'-'+_0xac5031+'/'+_0x9598e4)[_0xd7f1('0x17')](_0x77de72);}return null;};}function patchUpdates(_0x2b4bbe){return function(_0x5b1876){try{jsonpatch['apply'](_0x5b1876,_0x2b4bbe,!![]);}catch(_0x200c44){return BPromise[_0xd7f1('0x1b')](_0x200c44);}return _0x5b1876['save']();};}function saveUpdates(_0x39ec66,_0x46cb26){return function(_0x255ad8){if(_0x255ad8){return _0x255ad8[_0xd7f1('0x1c')](_0x39ec66)[_0xd7f1('0x1d')](function(_0x39787){return _0x39787;});}return null;};}function removeEntity(_0x2af644,_0x544f31){return function(_0x2af486){if(_0x2af486){return _0x2af486[_0xd7f1('0x1e')]()[_0xd7f1('0x1d')](function(){_0x2af644['status'](0xcc)[_0xd7f1('0x15')]();});}};}function handleEntityNotFound(_0x3d0496,_0x5d0f11){return function(_0x50b90e){if(!_0x50b90e){_0x3d0496[_0xd7f1('0x1f')](0x194);}return _0x50b90e;};}function handleError(_0x880681,_0x47ab4b){_0x47ab4b=_0x47ab4b||0x1f4;return function(_0x4f4c94){logger[_0xd7f1('0x20')](_0x4f4c94[_0xd7f1('0x21')]);if(_0x4f4c94[_0xd7f1('0x22')]){delete _0x4f4c94['name'];}_0x880681[_0xd7f1('0x16')](_0x47ab4b)[_0xd7f1('0x23')](_0x4f4c94);};}exports[_0xd7f1('0x24')]=function(_0x19a1c4,_0x734062){var _0x116335={},_0x1fc2df={},_0x60a768={'count':0x0,'rows':[]};var _0x48a1ab=_[_0xd7f1('0x25')](db[_0xd7f1('0x26')][_0xd7f1('0x27')],function(_0x44b226){return{'name':_0x44b226['fieldName'],'type':_0x44b226[_0xd7f1('0x28')][_0xd7f1('0x29')]};});_0x1fc2df[_0xd7f1('0x2a')]=_['map'](_0x48a1ab,_0xd7f1('0x22'));_0x1fc2df['query']=_[_0xd7f1('0x2b')](_0x19a1c4[_0xd7f1('0x2c')]);_0x1fc2df[_0xd7f1('0x2d')]=_[_0xd7f1('0x2e')](_0x1fc2df[_0xd7f1('0x2a')],_0x1fc2df[_0xd7f1('0x2c')]);_0x116335['attributes']=_[_0xd7f1('0x2e')](_0x1fc2df[_0xd7f1('0x2a')],qs[_0xd7f1('0x2f')](_0x19a1c4['query']['fields']));_0x116335[_0xd7f1('0x30')]=_0x116335['attributes']['length']?_0x116335[_0xd7f1('0x30')]:_0x1fc2df['model'];if(!_0x19a1c4[_0xd7f1('0x2c')][_0xd7f1('0x31')]('nolimit')){_0x116335[_0xd7f1('0x1a')]=qs['limit'](_0x19a1c4[_0xd7f1('0x2c')]['limit']);_0x116335[_0xd7f1('0x19')]=qs[_0xd7f1('0x19')](_0x19a1c4[_0xd7f1('0x2c')][_0xd7f1('0x19')]);}_0x116335['order']=qs[_0xd7f1('0x32')](_0x19a1c4[_0xd7f1('0x2c')][_0xd7f1('0x32')]);_0x116335[_0xd7f1('0x33')]=qs['filters'](_['pick'](_0x19a1c4[_0xd7f1('0x2c')],_0x1fc2df[_0xd7f1('0x2d')]),_0x48a1ab);if(_0x19a1c4[_0xd7f1('0x2c')][_0xd7f1('0x34')]){_0x116335[_0xd7f1('0x33')]=_[_0xd7f1('0x35')](_0x116335[_0xd7f1('0x33')],{'$or':_[_0xd7f1('0x25')](_0x48a1ab,function(_0x4d4a1f){if(_0x4d4a1f[_0xd7f1('0x28')]!==_0xd7f1('0x36')){var _0x518884={};_0x518884[_0x4d4a1f[_0xd7f1('0x22')]]={'$like':'%'+_0x19a1c4[_0xd7f1('0x2c')][_0xd7f1('0x34')]+'%'};return _0x518884;}})});}_0x116335=_[_0xd7f1('0x35')]({},_0x116335,_0x19a1c4[_0xd7f1('0x37')]);var _0x39cb34={'where':_0x116335[_0xd7f1('0x33')]};return db[_0xd7f1('0x26')][_0xd7f1('0x18')](_0x39cb34)['then'](function(_0x285250){_0x60a768[_0xd7f1('0x18')]=_0x285250;if(_0x19a1c4[_0xd7f1('0x2c')]['includeAll']){_0x116335[_0xd7f1('0x38')]=[{'all':!![]}];}return db[_0xd7f1('0x26')][_0xd7f1('0x39')](_0x116335);})['then'](function(_0xc390cf){_0x60a768[_0xd7f1('0x3a')]=_0xc390cf;return _0x60a768;})[_0xd7f1('0x1d')](respondWithFilteredResult(_0x734062,_0x116335))[_0xd7f1('0x3b')](handleError(_0x734062,null));};exports['show']=function(_0x52cba3,_0x5c0d7a){var _0xd2a423={'raw':!![],'where':{'id':_0x52cba3[_0xd7f1('0x3c')]['id']}},_0x478797={};_0x478797[_0xd7f1('0x2a')]=_[_0xd7f1('0x2b')](db['OpenchannelApplication'][_0xd7f1('0x27')]);_0x478797[_0xd7f1('0x2c')]=_['keys'](_0x52cba3[_0xd7f1('0x2c')]);_0x478797['filters']=_['intersection'](_0x478797[_0xd7f1('0x2a')],_0x478797[_0xd7f1('0x2c')]);_0xd2a423[_0xd7f1('0x30')]=_['intersection'](_0x478797[_0xd7f1('0x2a')],qs[_0xd7f1('0x2f')](_0x52cba3[_0xd7f1('0x2c')][_0xd7f1('0x2f')]));_0xd2a423[_0xd7f1('0x30')]=_0xd2a423['attributes']['length']?_0xd2a423[_0xd7f1('0x30')]:_0x478797[_0xd7f1('0x2a')];if(_0x52cba3[_0xd7f1('0x2c')][_0xd7f1('0x3d')]){_0xd2a423[_0xd7f1('0x38')]=[{'all':!![]}];}_0xd2a423=_['merge']({},_0xd2a423,_0x52cba3[_0xd7f1('0x37')]);return db['OpenchannelApplication'][_0xd7f1('0x3e')](_0xd2a423)[_0xd7f1('0x1d')](handleEntityNotFound(_0x5c0d7a,null))[_0xd7f1('0x1d')](respondWithResult(_0x5c0d7a,null))['catch'](handleError(_0x5c0d7a,null));};exports['create']=function(_0x5a36f9,_0x2146c3){return db[_0xd7f1('0x26')]['create'](_0x5a36f9[_0xd7f1('0x3f')],{})[_0xd7f1('0x1d')](respondWithResult(_0x2146c3,0xc9))[_0xd7f1('0x3b')](handleError(_0x2146c3,null));};exports[_0xd7f1('0x1c')]=function(_0x299fea,_0x14e570){if(_0x299fea[_0xd7f1('0x3f')]['id']){delete _0x299fea['body']['id'];}return db[_0xd7f1('0x26')][_0xd7f1('0x3e')]({'where':{'id':_0x299fea[_0xd7f1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x14e570,null))['then'](saveUpdates(_0x299fea[_0xd7f1('0x3f')],null))[_0xd7f1('0x1d')](respondWithResult(_0x14e570,null))[_0xd7f1('0x3b')](handleError(_0x14e570,null));};exports[_0xd7f1('0x1e')]=function(_0x4cd53d,_0x4d5aaf){return db[_0xd7f1('0x26')][_0xd7f1('0x3e')]({'where':{'id':_0x4cd53d[_0xd7f1('0x3c')]['id']}})[_0xd7f1('0x1d')](handleEntityNotFound(_0x4d5aaf,null))['then'](removeEntity(_0x4d5aaf,null))[_0xd7f1('0x3b')](handleError(_0x4d5aaf,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 28637d0..0db8c0b 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 _0xe51a=['./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','rimraf'];(function(_0x531e72,_0x571e05){var _0x2329fa=function(_0x51f69c){while(--_0x51f69c){_0x531e72['push'](_0x531e72['shift']());}};_0x2329fa(++_0x571e05);}(_0xe51a,0xaf));var _0xae51=function(_0x1ba264,_0x2dd506){_0x1ba264=_0x1ba264-0x0;var _0x4464aa=_0xe51a[_0x1ba264];return _0x4464aa;};'use strict';var _=require(_0xae51('0x0'));var util=require(_0xae51('0x1'));var logger=require(_0xae51('0x2'))('api');var moment=require('moment');var BPromise=require(_0xae51('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xae51('0x4'));var config=require('../../config/environment');var attributes=require(_0xae51('0x5'));module['exports']=function(_0x1f3a93,_0x415fa8){return _0x1f3a93[_0xae51('0x6')](_0xae51('0x7'),attributes,{'tableName':_0xae51('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xae51('0x9')});}; \ No newline at end of file +var _0x8b3c=['util','../../config/logger','api','moment','bluebird','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x6f89d4,_0xd0ce56){var _0x362e06=function(_0x5c0a82){while(--_0x5c0a82){_0x6f89d4['push'](_0x6f89d4['shift']());}};_0x362e06(++_0xd0ce56);}(_0x8b3c,0x1df));var _0xc8b3=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x8b3c[_0x3f5dca];return _0x5b833a;};'use strict';var _=require(_0xc8b3('0x0'));var util=require(_0xc8b3('0x1'));var logger=require(_0xc8b3('0x2'))(_0xc8b3('0x3'));var moment=require(_0xc8b3('0x4'));var BPromise=require(_0xc8b3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc8b3('0x6'));module[_0xc8b3('0x7')]=function(_0x3cdee3,_0xd926d6){return _0x3cdee3[_0xc8b3('0x8')](_0xc8b3('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8b3('0xa'),'collate':_0xc8b3('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index ac4d45e..1453e94 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x131916,_0x8eb089){var _0x283e61=function(_0x285d52){while(--_0x285d52){_0x131916['push'](_0x131916['shift']());}};_0x283e61(++_0x8eb089);}(_0xb10b,0x12a));var _0xbb10=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0xb10b[_0x27beea];return _0x122645;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x4cb086,_0x4cc048){var _0x10d1af=function(_0x296e16){while(--_0x296e16){_0x4cb086['push'](_0x4cb086['shift']());}};_0x10d1af(++_0x4cc048);}(_0x5f2f,0x73));var _0xf5f2=function(_0xf6d992,_0x376473){_0xf6d992=_0xf6d992-0x0;var _0x5605b9=_0x5f2f[_0xf6d992];return _0x5605b9;};'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 ee44461..0da5e33 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 _0x6c87=['path','connect-timeout','express','Router','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','update','openchannelinteraction:destroy','destroy','exports','multer'];(function(_0x1280a1,_0x5967cd){var _0x240d6f=function(_0x480ee9){while(--_0x480ee9){_0x1280a1['push'](_0x1280a1['shift']());}};_0x240d6f(++_0x5967cd);}(_0x6c87,0x1df));var _0x76c8=function(_0x2a7579,_0x1456c6){_0x2a7579=_0x2a7579-0x0;var _0x3b02ef=_0x6c87[_0x2a7579];return _0x3b02ef;};'use strict';var multer=require(_0x76c8('0x0'));var util=require('util');var path=require(_0x76c8('0x1'));var timeout=require(_0x76c8('0x2'));var express=require(_0x76c8('0x3'));var router=express[_0x76c8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76c8('0x5'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x76c8('0x6')]('/',auth['isAuthenticated'](),controller[_0x76c8('0x7')]);router[_0x76c8('0x6')](_0x76c8('0x8'),auth[_0x76c8('0x9')](),controller[_0x76c8('0xa')]);router[_0x76c8('0x6')](_0x76c8('0xb'),auth['isAuthenticated'](),controller[_0x76c8('0xc')]);router['get']('/:id/messages',auth[_0x76c8('0x9')](),controller[_0x76c8('0xd')]);router[_0x76c8('0x6')](_0x76c8('0xe'),auth[_0x76c8('0x9')](),controller[_0x76c8('0xf')]);router[_0x76c8('0x10')]('/',auth[_0x76c8('0x9')](),controller[_0x76c8('0x11')]);router[_0x76c8('0x10')](_0x76c8('0x12'),auth[_0x76c8('0x9')](),controller[_0x76c8('0x13')]);router[_0x76c8('0x10')](_0x76c8('0x14'),auth['isAuthenticated'](),interaction[_0x76c8('0x15')]('openchannel',_0x76c8('0x16')),controller[_0x76c8('0x17')]);router[_0x76c8('0x18')](_0x76c8('0xb'),auth[_0x76c8('0x9')](),interaction['tracked'](_0x76c8('0x19'),'openchannelinteraction:update'),controller[_0x76c8('0x1a')]);router['delete'](_0x76c8('0xb'),auth[_0x76c8('0x9')](),interaction[_0x76c8('0x15')](_0x76c8('0x19'),_0x76c8('0x1b')),controller[_0x76c8('0x1c')]);router['delete'](_0x76c8('0x14'),auth[_0x76c8('0x9')](),controller['removeTags']);module[_0x76c8('0x1d')]=router; \ No newline at end of file +var _0x99d3=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags'];(function(_0x18852b,_0x12967e){var _0x32d48f=function(_0x276437){while(--_0x276437){_0x18852b['push'](_0x18852b['shift']());}};_0x32d48f(++_0x12967e);}(_0x99d3,0x133));var _0x399d=function(_0x3e53a7,_0x6e5223){_0x3e53a7=_0x3e53a7-0x0;var _0x8f86e0=_0x99d3[_0x3e53a7];return _0x8f86e0;};'use strict';var multer=require(_0x399d('0x0'));var util=require(_0x399d('0x1'));var path=require(_0x399d('0x2'));var timeout=require(_0x399d('0x3'));var express=require(_0x399d('0x4'));var router=express[_0x399d('0x5')]();var auth=require(_0x399d('0x6'));var interaction=require(_0x399d('0x7'));var config=require('../../config/environment');var controller=require(_0x399d('0x8'));router[_0x399d('0x9')]('/',auth[_0x399d('0xa')](),controller['index']);router[_0x399d('0x9')](_0x399d('0xb'),auth[_0x399d('0xa')](),controller[_0x399d('0xc')]);router[_0x399d('0x9')](_0x399d('0xd'),auth['isAuthenticated'](),controller[_0x399d('0xe')]);router[_0x399d('0x9')](_0x399d('0xf'),auth[_0x399d('0xa')](),controller[_0x399d('0x10')]);router[_0x399d('0x9')](_0x399d('0x11'),auth[_0x399d('0xa')](),controller[_0x399d('0x12')]);router['post']('/',auth[_0x399d('0xa')](),controller[_0x399d('0x13')]);router[_0x399d('0x14')]('/:id/messages',auth[_0x399d('0xa')](),controller[_0x399d('0x15')]);router[_0x399d('0x14')](_0x399d('0x16'),auth[_0x399d('0xa')](),interaction[_0x399d('0x17')](_0x399d('0x18'),_0x399d('0x19')),controller[_0x399d('0x1a')]);router['put'](_0x399d('0xd'),auth['isAuthenticated'](),interaction[_0x399d('0x17')](_0x399d('0x18'),_0x399d('0x1b')),controller[_0x399d('0x1c')]);router[_0x399d('0x1d')]('/:id',auth[_0x399d('0xa')](),interaction[_0x399d('0x17')](_0x399d('0x18'),_0x399d('0x1e')),controller[_0x399d('0x1f')]);router[_0x399d('0x1d')](_0x399d('0x16'),auth[_0x399d('0xa')](),controller[_0x399d('0x20')]);module[_0x399d('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index e29fa6f..7e93ffd 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 _0x6937=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x26dfbf,_0x48ae23){var _0x148404=function(_0x368fd3){while(--_0x368fd3){_0x26dfbf['push'](_0x26dfbf['shift']());}};_0x148404(++_0x48ae23);}(_0x6937,0xc6));var _0x7693=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x6937[_0x74892f];return _0x10ee61;};'use strict';var Sequelize=require(_0x7693('0x0'));module[_0x7693('0x1')]={'closed':{'type':Sequelize[_0x7693('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7693('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7693('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x7693('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7693('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7693('0x4')]}}; \ No newline at end of file +var _0xe38c=['exports','BOOLEAN','DATE','STRING','ENUM','sequelize'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xe38c,0xd7));var _0xce38=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe38c[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xce38('0x0'));module[_0xce38('0x1')]={'closed':{'type':Sequelize[_0xce38('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xce38('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xce38('0x4')]},'read1stAt':{'type':Sequelize[_0xce38('0x3')]},'threadId':{'type':Sequelize[_0xce38('0x4')]},'externalUrl':{'type':Sequelize[_0xce38('0x4')]},'lastMsgAt':{'type':Sequelize[_0xce38('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xce38('0x5')]('in','out'),'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 2362401..1015e30 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 _0x5697=['apply','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','OpenchannelInteraction','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','field','color','from','tools_tags','u.fullname','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','select','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','Contact','$substring','value','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','some','compact','OpenchannelAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','OpenchannelInteractionId','all','rows','show','params','includeAll','include','options','create','body','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','lastName','Attachment','Messages','secret','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','System','direction','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','rimraf','zip-dir','fast-json-patch','path','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','end','status','json','count','offset','limit'];(function(_0x43cba8,_0x1d9748){var _0x89176b=function(_0x15d25d){while(--_0x15d25d){_0x43cba8['push'](_0x43cba8['shift']());}};_0x89176b(++_0x1d9748);}(_0x5697,0x1b5));var _0x7569=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0x5697[_0x4a9beb];return _0x2d4c58;};'use strict';var pdf=require(_0x7569('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7569('0x1'));var zipdir=require(_0x7569('0x2'));var jsonpatch=require(_0x7569('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7569('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7569('0x5'));var squel=require(_0x7569('0x6'));var crypto=require(_0x7569('0x7'));var jsforce=require(_0x7569('0x8'));var deskjs=require(_0x7569('0x9'));var toCsv=require(_0x7569('0xa'));var querystring=require('querystring');var Papa=require(_0x7569('0xb'));var Redis=require('ioredis');var authService=require(_0x7569('0xc'));var qs=require(_0x7569('0xd'));var as=require(_0x7569('0xe'));var hardwareService=require(_0x7569('0xf'));var logger=require(_0x7569('0x10'))(_0x7569('0x11'));var utils=require(_0x7569('0x12'));var config=require(_0x7569('0x13'));var db=require(_0x7569('0x14'))['db'];config['redis']=_[_0x7569('0x15')](config[_0x7569('0x16')],{'host':_0x7569('0x17'),'port':0x18eb});var socket=require(_0x7569('0x18'))(new Redis(config[_0x7569('0x16')]));require(_0x7569('0x19'))['register'](socket);function respondWithStatusCode(_0x1ac382,_0x3d6e8c){_0x3d6e8c=_0x3d6e8c||0xcc;return function(_0x10af23){if(_0x10af23){return _0x1ac382[_0x7569('0x1a')](_0x3d6e8c);}return _0x1ac382['status'](_0x3d6e8c)[_0x7569('0x1b')]();};}function respondWithResult(_0x25299a,_0x507670){_0x507670=_0x507670||0xc8;return function(_0x4936e3){if(_0x4936e3){return _0x25299a[_0x7569('0x1c')](_0x507670)[_0x7569('0x1d')](_0x4936e3);}};}function respondWithFilteredResult(_0x533333,_0x30050f){return function(_0xf382ad){if(_0xf382ad){var _0x5c9875=_0xf382ad[_0x7569('0x1e')],_0x39a02d=_0x30050f[_0x7569('0x1f')],_0x12d83e=_0x30050f[_0x7569('0x1f')]+_0x30050f[_0x7569('0x20')],_0x2fee4d;if(_0x12d83e>=_0x5c9875){_0x12d83e=_0x5c9875;_0x2fee4d=0xc8;}else{_0x2fee4d=0xce;}_0x533333['status'](_0x2fee4d);return _0x533333['set']('Content-Range',_0x39a02d+'-'+_0x12d83e+'/'+_0x5c9875)[_0x7569('0x1d')](_0xf382ad);}return null;};}function patchUpdates(_0x4c36c9){return function(_0x303c22){try{jsonpatch[_0x7569('0x21')](_0x303c22,_0x4c36c9,!![]);}catch(_0x58aa33){return BPromise['reject'](_0x58aa33);}return _0x303c22[_0x7569('0x22')]();};}function saveUpdates(_0x5ea4f8,_0x4278d1){return function(_0x58a59f){if(_0x58a59f){return _0x58a59f[_0x7569('0x23')](_0x5ea4f8)[_0x7569('0x24')](function(_0xf2d6c0){return _0xf2d6c0;});}return null;};}function removeEntity(_0x2e1df7,_0x76e4b2){return function(_0x34af47){if(_0x34af47){return _0x34af47['destroy']()[_0x7569('0x24')](function(){_0x2e1df7[_0x7569('0x1c')](0xcc)[_0x7569('0x1b')]();});}};}function handleEntityNotFound(_0x3b8346,_0x34147b){return function(_0x37539d){if(!_0x37539d){_0x3b8346[_0x7569('0x1a')](0x194);}return _0x37539d;};}function handleError(_0x1820bd,_0x101702){_0x101702=_0x101702||0x1f4;return function(_0x1134b4){logger[_0x7569('0x25')](_0x1134b4[_0x7569('0x26')]);if(_0x1134b4[_0x7569('0x27')]){delete _0x1134b4[_0x7569('0x27')];}_0x1820bd['status'](_0x101702)[_0x7569('0x28')](_0x1134b4);};}function getInteractionUsers(_0x194349,_0x5d5e1e){return new BPromise(function(_0xdf5df9,_0x1c2a57){try{if(_0x5d5e1e[_0x194349['id']]){_0x194349[_0x7569('0x29')]=_[_0x7569('0x2a')](_0x5d5e1e[_0x194349['id']],function(_0x7ac8f9){return{'id':_0x7ac8f9['id'],'fullname':_0x7ac8f9[_0x7569('0x2b')]};});}}catch(_0x47c383){_0x1c2a57(_0x47c383);}_0xdf5df9(_0x194349);});}function getInteractionTags(_0x490441,_0x5f1ce4){return new BPromise(function(_0x196cd9,_0x1220a1){try{if(_0x490441[_0x7569('0x2c')]){_0x490441[_0x7569('0x2d')]=[];_0x490441[_0x7569('0x2c')][_0x7569('0x2e')](',')[_0x7569('0x2f')](function(_0x1ed915){_0x490441['Tags'][_0x7569('0x30')](_0x5f1ce4[_0x1ed915]);});}delete _0x490441[_0x7569('0x2c')];}catch(_0x5a4b24){_0x1220a1(_0x5a4b24);}_0x196cd9(_0x490441);});}function updateOpenchannelInteraction(_0x2f5310,_0x45bd57,_0xf92ff9){return new BPromise(function(_0x3994c9,_0x52cd1a){return getInteractionUsers(_0x2f5310,_0xf92ff9)[_0x7569('0x24')](function(_0x8e1d0c){return getInteractionTags(_0x8e1d0c,_0x45bd57);})[_0x7569('0x24')](function(_0x45037e){_0x3994c9(_0x45037e);})[_0x7569('0x31')](function(_0x452a74){_0x52cd1a(_0x452a74);});});}exports['index']=function(_0x4922d6,_0x4d1074){var _0x1ea1a5={},_0x2cee69={},_0x4e4181={'count':0x0,'rows':[]};var _0x4e8401=_[_0x7569('0x2a')](db[_0x7569('0x32')][_0x7569('0x33')],function(_0x47c24a){return{'name':_0x47c24a['fieldName'],'type':_0x47c24a[_0x7569('0x34')][_0x7569('0x35')]};});_0x2cee69[_0x7569('0x36')]=_[_0x7569('0x2a')](_0x4e8401,_0x7569('0x27'));_0x2cee69['query']=_[_0x7569('0x37')](_0x4922d6[_0x7569('0x38')]);_0x2cee69[_0x7569('0x39')]=_[_0x7569('0x3a')](_0x2cee69['model'],_0x2cee69[_0x7569('0x38')]);_0x1ea1a5[_0x7569('0x3b')]=_['intersection'](_0x2cee69['model'],qs['fields'](_0x4922d6[_0x7569('0x38')][_0x7569('0x3c')]));_0x1ea1a5[_0x7569('0x3b')]=_0x1ea1a5[_0x7569('0x3b')][_0x7569('0x3d')]?_0x1ea1a5[_0x7569('0x3b')]:_0x2cee69[_0x7569('0x36')];if(!_0x4922d6[_0x7569('0x38')][_0x7569('0x3e')]('nolimit')){_0x1ea1a5[_0x7569('0x20')]=qs['limit'](_0x4922d6[_0x7569('0x38')][_0x7569('0x20')]);_0x1ea1a5[_0x7569('0x1f')]=qs[_0x7569('0x1f')](_0x4922d6[_0x7569('0x38')][_0x7569('0x1f')]);}_0x1ea1a5[_0x7569('0x3f')]=qs[_0x7569('0x40')](_0x4922d6[_0x7569('0x38')]['sort']);_0x1ea1a5[_0x7569('0x41')]=qs[_0x7569('0x39')](_[_0x7569('0x42')](_0x4922d6[_0x7569('0x38')],_0x2cee69[_0x7569('0x39')]),_0x4e8401);var _0x3655e0=[];var _0x4013e1=squel['select']()[_0x7569('0x43')]('id')[_0x7569('0x43')]('name')['field'](_0x7569('0x44'))[_0x7569('0x45')](_0x7569('0x46'));var _0x15102d=squel['select']()[_0x7569('0x43')]('u.id')[_0x7569('0x43')](_0x7569('0x47'))[_0x7569('0x43')]('ui.OpenchannelInteractionId')['from'](_0x7569('0x48'),'ui')[_0x7569('0x49')]('users','u',_0x7569('0x4a'));var _0x440a00=squel[_0x7569('0x4b')]()['from']('openchannel_interactions','i')[_0x7569('0x49')]('cm_contacts','c',_0x7569('0x4c'))[_0x7569('0x49')](_0x7569('0x4d'),'o',_0x7569('0x4e'))[_0x7569('0x49')](_0x7569('0x4f'),'a',_0x7569('0x50'))[_0x7569('0x49')]('openchannel_messages','me',_0x7569('0x51'))[_0x7569('0x49')](_0x7569('0x52'),'it',_0x7569('0x53'))[_0x7569('0x49')](_0x7569('0x46'),'t',_0x7569('0x54'));var _0x2ef4d2=squel[_0x7569('0x55')]();var _0x1e6d93=[];var _0x5ddec=squel[_0x7569('0x55')]();var _0x562dad;if(_0x4922d6['query'][_0x7569('0x56')]){_0x562dad=as['parseSearch'](_0x4922d6['query']['search']);var _0x5ada5f=_0x562dad[_0x7569('0x57')];for(var _0x38db7c=0x0;_0x38db7c<_0x562dad['conditions']['length'];_0x38db7c++){var _0x3b3f4d=_0x562dad[_0x7569('0x58')][_0x38db7c];var _0x503811='i';var _0x3bb889=_['find'](_0x4e8401,[_0x7569('0x27'),_0x3b3f4d[_0x7569('0x43')]]);if(!_0x3bb889){switch(_0x3b3f4d[_0x7569('0x43')]){case _0x7569('0x59'):if(_0x3b3f4d['value']==0x1){_0x440a00[_0x7569('0x5a')]('`'+_0x3b3f4d[_0x7569('0x43')]+'`\x20=\x200');}else{_0x440a00[_0x7569('0x5a')]('`'+_0x3b3f4d['field']+_0x7569('0x5b'));}break;case _0x7569('0x5c'):if(_0x3b3f4d['operator']===_0x7569('0x5d')){if(_0x3b3f4d[_0x7569('0x5e')][_0x7569('0x2e')]('\x20')[_0x7569('0x3d')]>0x1){_0x2ef4d2[_0x5ada5f]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3b3f4d['value']),null);}else{var _0x415e70='%'+_0x3b3f4d[_0x7569('0x5e')]+'%';_0x2ef4d2[_0x5ada5f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x415e70,_0x415e70,_0x415e70);}}else{_0x3bb889=_['find'](_0x4e8401,[_0x7569('0x27'),_0x7569('0x5f')]);_0x3b3f4d[_0x7569('0x43')]=_0x7569('0x5f');_0x18b03a=as['buildExpression'](_0x503811,_0x3bb889[_0x7569('0x34')],_0x3b3f4d);_0x2ef4d2[_0x5ada5f](_0x18b03a[_0x7569('0x60')],_0x18b03a[_0x7569('0x5e')][_0x7569('0x61')],_0x18b03a[_0x7569('0x5e')][_0x7569('0x1b')]);}break;case _0x7569('0x62'):var _0x2b407b=_0x3b3f4d['value']['split'](',')['map'](function(_0x30d57d){return Number(_0x30d57d);});_0x2b407b[_0x7569('0x2f')](function(_0x2d8579){_0x5ddec['or'](_0x7569('0x63'),'%,'+_0x2d8579+',%');});_0x1e6d93=_[_0x7569('0x64')](_0x1e6d93,_0x2b407b);break;case _0x7569('0x65'):if(_0x3b3f4d[_0x7569('0x66')]===_0x7569('0x5d')){_0x2ef4d2[_0x5ada5f](_0x7569('0x67'),'%'+_0x3b3f4d['value']+'%',null);}else{_0x3bb889=_[_0x7569('0x68')](_0x4e8401,['name','UserId']);_0x3b3f4d[_0x7569('0x43')]=_0x7569('0x69');_0x18b03a=as['buildExpression'](_0x503811,_0x3bb889[_0x7569('0x34')],_0x3b3f4d);_0x2ef4d2[_0x5ada5f](_0x18b03a['text'],_0x18b03a[_0x7569('0x5e')][_0x7569('0x61')],_0x18b03a[_0x7569('0x5e')][_0x7569('0x1b')]);}break;case'body':_0x18b03a=as[_0x7569('0x6a')]('me',null,_0x3b3f4d);_0x2ef4d2[_0x5ada5f](_0x18b03a['text'],_0x18b03a[_0x7569('0x5e')][_0x7569('0x61')],_0x18b03a[_0x7569('0x5e')][_0x7569('0x1b')]);break;}}else{var _0x18b03a=as['buildExpression'](_0x503811,_0x3bb889['type'],_0x3b3f4d);_0x2ef4d2[_0x5ada5f](_0x18b03a[_0x7569('0x60')],_0x18b03a['value']['start'],_0x18b03a[_0x7569('0x5e')]['end']);}}}else{var _0x5ebf7f=_(_0x4922d6[_0x7569('0x38')])[_0x7569('0x37')]()[_0x7569('0x2a')](function(_0x11649d){return _[_0x7569('0x6b')](_0x4e8401,['name',_0x11649d])?_0x11649d:undefined;})[_0x7569('0x6c')]()['value']();if(!_['isEmpty'](_0x5ebf7f)){_0x5ebf7f[_0x7569('0x2f')](function(_0x1d46f0){if(_0x1d46f0===_0x7569('0x6d')){_0x440a00['where']('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x4922d6['query'][_0x1d46f0]));}else if(_0x1d46f0===_0x7569('0x6e')){var _0x42bde6=JSON[_0x7569('0x6f')](_0x4922d6[_0x7569('0x38')][_0x1d46f0])[_0x7569('0x70')];var _0xe22771=JSON['parse'](_0x4922d6[_0x7569('0x38')][_0x1d46f0])[_0x7569('0x71')];_0x440a00[_0x7569('0x41')](_0x7569('0x72'),_0x42bde6,_0xe22771);}else{if(_0x4922d6[_0x7569('0x38')][_0x1d46f0]===_0x7569('0x73')){_0x440a00['where']('i.'+_0x1d46f0+'\x20IS\x20NULL');}else{_0x440a00[_0x7569('0x41')]('i.'+_0x1d46f0+_0x7569('0x74'),_0x4922d6['query'][_0x1d46f0]);}}});}if(_0x4922d6[_0x7569('0x38')][_0x7569('0x75')]){if(_0x4922d6[_0x7569('0x38')]['read']==0x1){_0x440a00[_0x7569('0x5a')]('`unreadMessages`\x20=\x200');}else{_0x440a00[_0x7569('0x5a')](_0x7569('0x76'));}}if(_0x4922d6[_0x7569('0x38')][_0x7569('0x77')]){_0x1e6d93=_['isArray'](_0x4922d6[_0x7569('0x38')][_0x7569('0x77')])?_0x4922d6[_0x7569('0x38')][_0x7569('0x77')]:new Array(_0x4922d6['query'][_0x7569('0x77')]);_0x1e6d93[_0x7569('0x2f')](function(_0x488da9){_0x5ddec['or'](_0x7569('0x63'),'%,'+_0x488da9+',%');});}if(_0x4922d6[_0x7569('0x38')][_0x7569('0x78')]){var _0x5061a2=_0x4922d6[_0x7569('0x38')][_0x7569('0x78')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x7569('0x79'));if(qs[_0x7569('0x7a')](_0x5061a2)){_0x2ef4d2['or'](_0x7569('0x7b'),_0x5061a2+'%');}else{_0x2ef4d2['or'](_0x7569('0x7c'),qs[_0x7569('0x7d')](_0x5061a2))['or'](_0x7569('0x7e'),_0x5061a2+'%')['or'](_0x7569('0x7f'),_0x5061a2+'%');}}}_0x440a00['where'](_0x2ef4d2);_0x440a00[_0x7569('0x80')](_0x7569('0x81'));var _0x439013={'type':db[_0x7569('0x82')][_0x7569('0x83')]['SELECT'],'raw':!![]};var _0x1c2f7a=_0x440a00['clone']();_0x1c2f7a['field']('i.id');_0x1c2f7a[_0x7569('0x43')](_0x7569('0x84'),_0x7569('0x59'));if(_0x1ea1a5[_0x7569('0x3f')]){_0x1ea1a5[_0x7569('0x3f')][_0x7569('0x2f')](function(_0x2ef8b2){_0x440a00[_0x7569('0x3f')]('i.'+_0x2ef8b2[0x0],_0x2ef8b2[0x1]===_0x7569('0x85')?![]:!![]);});}if(!_[_0x7569('0x86')](_0x1e6d93)){_0x440a00[_0x7569('0x5a')](_0x5ddec);_0x1c2f7a['where']('t.id\x20IN\x20?',_0x1e6d93);}BPromise['resolve']()[_0x7569('0x24')](function(){if(!_0x562dad){if(_0x4922d6[_0x7569('0x38')][_0x7569('0x6d')]||_0x4922d6[_0x7569('0x38')][_0x7569('0x87')])return;_0x1c2f7a['where'](_0x7569('0x88'));_0x440a00[_0x7569('0x41')](_0x7569('0x88'));return;}return _0x4922d6[_0x7569('0x89')][_0x7569('0x8a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x462656){if(_[_0x7569('0x86')](_0x462656)){_0x1c2f7a['where'](_0x7569('0x8b'));_0x440a00[_0x7569('0x41')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x1c2f7a[_0x7569('0x41')](_0x7569('0x8c'),_[_0x7569('0x2a')](_0x462656,'id'));_0x440a00[_0x7569('0x41')](_0x7569('0x8c'),_['map'](_0x462656,'id'));}});})[_0x7569('0x24')](function(){db[_0x7569('0x8d')]['query'](_0x1c2f7a[_0x7569('0x8e')](),_0x439013)['then'](function(_0x47b610){_0x4e4181[_0x7569('0x1e')]=_0x47b610[_0x7569('0x3d')];if(_0x4e4181['count']===0x0)return[];return db['sequelize'][_0x7569('0x38')](_0x4013e1[_0x7569('0x8e')](),_0x439013)[_0x7569('0x24')](function(_0x12e3af){_0x3655e0=_[_0x7569('0x8f')](_0x12e3af,'id');_0x439013=_[_0x7569('0x90')](_0x439013,{'model':db[_0x7569('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4922d6[_0x7569('0x38')][_0x7569('0x3c')]){_0x1ea1a5['attributes'][_0x7569('0x2f')](function(_0x4a3490){_0x440a00['field']('i.'+_0x4a3490);});}else{_0x440a00[_0x7569('0x43')](_0x7569('0x84'),_0x7569('0x59'));_0x440a00[_0x7569('0x43')](_0x7569('0x91'),_0x7569('0x92'));_0x440a00[_0x7569('0x43')](_0x7569('0x93'),_0x7569('0x94'));_0x440a00[_0x7569('0x43')](_0x7569('0x95'));_0x440a00['field'](_0x7569('0x96'),_0x7569('0x97'));_0x440a00[_0x7569('0x43')]('c.lastName',_0x7569('0x98'));_0x440a00[_0x7569('0x43')](_0x7569('0x99'),_0x7569('0x9a'));_0x440a00[_0x7569('0x43')]('c.phone',_0x7569('0x9b'));_0x440a00[_0x7569('0x43')](_0x7569('0x9c'),'Contact.mobile');_0x440a00[_0x7569('0x43')]('c.fax',_0x7569('0x9d'));_0x440a00['field'](_0x7569('0x9e'),_0x7569('0x9f'));_0x440a00[_0x7569('0x43')]('o.internal',_0x7569('0xa0'));_0x440a00['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1ea1a5['limit'])_0x440a00[_0x7569('0x20')](_0x1ea1a5['limit']);if(_0x1ea1a5['offset'])_0x440a00[_0x7569('0x1f')](_0x1ea1a5[_0x7569('0x1f')]);return db[_0x7569('0x8d')][_0x7569('0x38')](_0x440a00[_0x7569('0x8e')](),_0x439013);})[_0x7569('0x24')](function(_0x3e6c11){_0x15102d[_0x7569('0x41')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x7569('0x2a')](_0x3e6c11,'id'));return db[_0x7569('0x8d')][_0x7569('0x38')](_0x15102d[_0x7569('0x8e')](),_0x439013)[_0x7569('0x24')](function(_0x4165a3){var _0x418b6a=_['groupBy'](_0x4165a3,_0x7569('0xa1'));var _0x32f7d8=[];_0x3e6c11['forEach'](function(_0x2a7d8e){_0x32f7d8[_0x7569('0x30')](updateOpenchannelInteraction(_0x2a7d8e,_0x3655e0,_0x418b6a));});return BPromise[_0x7569('0xa2')](_0x32f7d8);});});})[_0x7569('0x24')](function(_0x38da78){_0x4e4181[_0x7569('0xa3')]=_0x38da78;return _0x4e4181;})[_0x7569('0x24')](respondWithFilteredResult(_0x4d1074,_0x1ea1a5));})[_0x7569('0x31')](handleError(_0x4d1074,null));};exports[_0x7569('0xa4')]=function(_0xab41a6,_0x44f4a0){var _0x327e70={'raw':![],'where':{'id':_0xab41a6[_0x7569('0xa5')]['id']}},_0x4d4bcb={};_0x4d4bcb[_0x7569('0x36')]=_['keys'](db[_0x7569('0x32')][_0x7569('0x33')]);_0x4d4bcb[_0x7569('0x38')]=_[_0x7569('0x37')](_0xab41a6[_0x7569('0x38')]);_0x4d4bcb[_0x7569('0x39')]=_[_0x7569('0x3a')](_0x4d4bcb[_0x7569('0x36')],_0x4d4bcb[_0x7569('0x38')]);_0x327e70[_0x7569('0x3b')]=_[_0x7569('0x3a')](_0x4d4bcb[_0x7569('0x36')],qs[_0x7569('0x3c')](_0xab41a6['query'][_0x7569('0x3c')]));_0x327e70[_0x7569('0x3b')]=_0x327e70['attributes'][_0x7569('0x3d')]?_0x327e70[_0x7569('0x3b')]:_0x4d4bcb[_0x7569('0x36')];if(_0xab41a6['query'][_0x7569('0xa6')]){_0x327e70[_0x7569('0xa7')]=[{'all':!![]}];}_0x327e70=_[_0x7569('0x90')]({},_0x327e70,_0xab41a6[_0x7569('0xa8')]);return db[_0x7569('0x32')][_0x7569('0x68')](_0x327e70)[_0x7569('0x24')](handleEntityNotFound(_0x44f4a0,null))[_0x7569('0x24')](respondWithResult(_0x44f4a0,null))[_0x7569('0x31')](handleError(_0x44f4a0,null));};exports[_0x7569('0xa9')]=function(_0x2673a7,_0x3d3f36){return db['OpenchannelInteraction'][_0x7569('0xa9')](_0x2673a7[_0x7569('0xaa')],{})[_0x7569('0x24')](respondWithResult(_0x3d3f36,0xc9))[_0x7569('0x31')](handleError(_0x3d3f36,null));};exports[_0x7569('0x23')]=function(_0x2f67a2,_0x4e5383){if(_0x2f67a2[_0x7569('0xaa')]['id']){delete _0x2f67a2['body']['id'];}return db[_0x7569('0x32')][_0x7569('0x68')]({'where':{'id':_0x2f67a2[_0x7569('0xa5')]['id']}})[_0x7569('0x24')](handleEntityNotFound(_0x4e5383,null))[_0x7569('0x24')](saveUpdates(_0x2f67a2[_0x7569('0xaa')],null))['then'](respondWithResult(_0x4e5383,null))['catch'](handleError(_0x4e5383,null));};exports[_0x7569('0xab')]=function(_0x22d6ab,_0x35027f){return db['OpenchannelInteraction'][_0x7569('0x68')]({'where':{'id':_0x22d6ab[_0x7569('0xa5')]['id']}})['then'](handleEntityNotFound(_0x35027f,null))['then'](removeEntity(_0x35027f,null))[_0x7569('0x31')](handleError(_0x35027f,null));};exports[_0x7569('0xac')]=function(_0x36ce26,_0x766cad){return db[_0x7569('0x32')][_0x7569('0xac')]()[_0x7569('0x24')](respondWithResult(_0x766cad,null))['catch'](handleError(_0x766cad,null));};exports[_0x7569('0xad')]=function(_0x11a7a0,_0x2b32ed,_0xd7839c){return db[_0x7569('0xae')][_0x7569('0x68')]({'where':{'id':_0x11a7a0[_0x7569('0xa5')]['id']}})[_0x7569('0x24')](handleEntityNotFound(_0x2b32ed,null))[_0x7569('0x24')](function(_0x30360e){if(_0x30360e){return _0x30360e[_0x7569('0xad')](_0x11a7a0['body'][_0x7569('0xaf')],_[_0x7569('0xb0')](_0x11a7a0[_0x7569('0xaa')],[_0x7569('0xaf'),'id'])||{});}})['then'](respondWithResult(_0x2b32ed,null))[_0x7569('0x31')](handleError(_0x2b32ed,null));};exports[_0x7569('0xb1')]=function(_0x1158ab,_0x160ee7,_0x236f60){var _0x391d2f={'raw':![],'where':{}};var _0x473ebd={};var _0x5aab7a={'count':0x0,'rows':[]};return db[_0x7569('0x32')][_0x7569('0xb2')]({'where':{'id':_0x1158ab[_0x7569('0xa5')]['id']}})[_0x7569('0x24')](handleEntityNotFound(_0x160ee7,null))[_0x7569('0x24')](function(_0x538fe8){if(_0x538fe8){_0x473ebd[_0x7569('0x36')]=_['keys'](db[_0x7569('0xae')][_0x7569('0x33')]);_0x473ebd['query']=_[_0x7569('0x37')](_0x1158ab[_0x7569('0x38')]);_0x473ebd[_0x7569('0x39')]=_[_0x7569('0x3a')](_0x473ebd[_0x7569('0x36')],_0x473ebd[_0x7569('0x38')]);_0x391d2f[_0x7569('0x3b')]=_[_0x7569('0x3a')](_0x473ebd[_0x7569('0x36')],qs[_0x7569('0x3c')](_0x1158ab['query'][_0x7569('0x3c')]));_0x391d2f[_0x7569('0x3b')]=_0x391d2f[_0x7569('0x3b')]['length']?_0x391d2f[_0x7569('0x3b')]:_0x473ebd[_0x7569('0x36')];if(!_0x1158ab['query'][_0x7569('0x3e')]('nolimit')){_0x391d2f[_0x7569('0x20')]=qs[_0x7569('0x20')](_0x1158ab[_0x7569('0x38')]['limit']);_0x391d2f[_0x7569('0x1f')]=qs[_0x7569('0x1f')](_0x1158ab[_0x7569('0x38')][_0x7569('0x1f')]);}_0x391d2f[_0x7569('0x3f')]=qs[_0x7569('0x40')](_0x1158ab['query'][_0x7569('0x40')]);_0x391d2f[_0x7569('0x41')]=qs[_0x7569('0x39')](_[_0x7569('0x42')](_0x1158ab[_0x7569('0x38')],_0x473ebd['filters']));_0x391d2f['where'][_0x7569('0xa1')]=_0x538fe8['id'];if(_0x1158ab['query'][_0x7569('0x78')]){_0x391d2f['where']=_[_0x7569('0x90')](_0x391d2f[_0x7569('0x41')],{'$or':_[_0x7569('0x2a')](_0x391d2f[_0x7569('0x3b')],function(_0x215faf){var _0x40b960={};_0x40b960[_0x215faf]={'$like':'%'+_0x1158ab[_0x7569('0x38')][_0x7569('0x78')]+'%'};return _0x40b960;})});}if(_0x1158ab['query'][_0x7569('0x70')]){var _0x2aef43=_0x1158ab['query'][_0x7569('0x70')]['split'](',');var _0x4f22e6={};_0x4f22e6[_0x2aef43[0x0]]={'$gte':moment(_0x2aef43[0x1])[_0x7569('0xb3')](_0x7569('0xb4'))};_0x391d2f[_0x7569('0x41')]=_[_0x7569('0x90')](_0x391d2f[_0x7569('0x41')],_0x4f22e6);}_0x391d2f=_[_0x7569('0x90')]({},_0x391d2f,_0x1158ab[_0x7569('0xa8')]);return db[_0x7569('0xae')][_0x7569('0x1e')]({'where':_0x391d2f[_0x7569('0x41')]})[_0x7569('0x24')](function(_0x29c111){_0x5aab7a[_0x7569('0x1e')]=_0x29c111;if(_0x1158ab[_0x7569('0x38')][_0x7569('0xa6')]){_0x391d2f[_0x7569('0xa7')]=[{'all':!![]}];}return db[_0x7569('0xae')]['findAll'](_0x391d2f);})['then'](function(_0x386a72){_0x5aab7a[_0x7569('0xa3')]=_0x386a72;return _0x5aab7a;});}})[_0x7569('0x24')](respondWithFilteredResult(_0x160ee7,_0x391d2f))[_0x7569('0x31')](handleError(_0x160ee7,null));};exports[_0x7569('0xb5')]=function(_0x1614e,_0x6ede32,_0x5a4166){return db['OpenchannelInteraction'][_0x7569('0x68')]({'where':{'id':_0x1614e[_0x7569('0xa5')]['id']}})['then'](handleEntityNotFound(_0x6ede32,null))['then'](function(_0x4efc70){if(_0x4efc70){return _0x4efc70[_0x7569('0xb6')](_0x1614e[_0x7569('0xaa')]['ids'],_[_0x7569('0xb0')](_0x1614e[_0x7569('0xaa')],[_0x7569('0xaf'),'id'])||{})[_0x7569('0xb7')](function(){return db['Tag'][_0x7569('0xb8')]({'attributes':['id',_0x7569('0x27'),'color'],'where':{'id':_0x1614e['body'][_0x7569('0xaf')]}});})['then'](function(_0x3146d8){socket[_0x7569('0xb9')](_0x7569('0xba'),{'id':Number(_0x1614e[_0x7569('0xa5')]['id']),'tags':_0x3146d8||[]});return{'id':Number(_0x1614e[_0x7569('0xa5')]['id']),'tags':_0x3146d8||[]};});}})[_0x7569('0x24')](respondWithResult(_0x6ede32,null))[_0x7569('0x31')](handleError(_0x6ede32,null));};exports[_0x7569('0xbb')]=function(_0x58fd15,_0x511182,_0x5ebc89){return db[_0x7569('0x32')]['find']({'where':{'id':_0x58fd15['params']['id']}})[_0x7569('0x24')](handleEntityNotFound(_0x511182,null))[_0x7569('0x24')](function(_0x488c26){if(_0x488c26){return _0x488c26[_0x7569('0xbb')](_0x58fd15[_0x7569('0x38')][_0x7569('0xaf')]);}})[_0x7569('0x24')](respondWithStatusCode(_0x511182,null))[_0x7569('0x31')](handleError(_0x511182,null));};exports[_0x7569('0xbc')]=function(_0x180e72,_0x229f7b){var _0x37de31=moment()[_0x7569('0xbd')]()['toString']();var _0x4ca76f=path[_0x7569('0xbe')](config[_0x7569('0xbf')],_0x7569('0xc0'),_0x7569('0xc1'),_0x7569('0xc2'));var _0x1ebfb7=path[_0x7569('0xbe')](config[_0x7569('0xbf')],_0x7569('0xc0'),_0x7569('0xc1'),_0x7569('0xc3'));var _0x3d0f26=path[_0x7569('0xbe')](_0x4ca76f,_0x37de31);var _0x11f408=util[_0x7569('0xb3')]('transcript-%d-%s.zip',_0x180e72[_0x7569('0xa5')]['id'],_0x37de31);var _0x865bc1=path[_0x7569('0xbe')](_0x4ca76f,_0x11f408);var _0x3212c9=[];_0x3212c9[_0x7569('0x30')]({'model':db[_0x7569('0x65')],'as':_0x7569('0x65'),'attributes':['id',_0x7569('0x2b')],'raw':!![]});_0x3212c9[_0x7569('0x30')]({'model':db[_0x7569('0xc4')],'as':_0x7569('0x5c'),'attributes':['id',_0x7569('0xc5'),_0x7569('0xc6')],'raw':!![]});if(_0x180e72['query'][_0x7569('0xc3')]){_0x3212c9[_0x7569('0x30')]({'model':db[_0x7569('0xc7')],'as':_0x7569('0xc7'),'raw':!![]});}var _0x4bb1c4=[{'model':db[_0x7569('0xae')],'as':_0x7569('0xc8'),'attributes':['id',_0x7569('0xaa'),'createdAt','direction',_0x7569('0xc9'),_0x7569('0x75')],'include':_0x3212c9}];_0x4bb1c4[_0x7569('0x30')]({'model':db['OpenchannelAccount'],'as':_0x7569('0xca'),'attributes':['id',_0x7569('0x27')]});_0x4bb1c4[_0x7569('0x30')]({'model':db[_0x7569('0x65')],'as':_0x7569('0xcb'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x7569('0x68')]({'where':{'id':_0x180e72[_0x7569('0xa5')]['id']},'include':_0x4bb1c4})[_0x7569('0x24')](handleEntityNotFound(_0x229f7b,null))[_0x7569('0x24')](function(_0x2579a3){if(_0x2579a3){var _0x34df92=_0x2579a3[_0x7569('0xcc')]({'plain':!![]});fs[_0x7569('0xcd')](_0x3d0f26);var _0x232b39={'format':'A4','border':_0x7569('0xce'),'header':{'height':_0x7569('0xcf'),'contents':{'first':_0x7569('0xd0')}},'footer':{'height':_0x7569('0xd1'),'contents':{'default':util[_0x7569('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['format'](_0x7569('0xd2'),_0x7569('0xd3'),_0x34df92['id']),moment()['format'](_0x7569('0xd4'))[_0x7569('0x8e')]())}}};var _0x21db38={'channel':_0x7569('0xd3'),'account':_0x34df92[_0x7569('0xca')][_0x7569('0x27')],'agent':_0x34df92[_0x7569('0xcb')]?_0x34df92[_0x7569('0xcb')]['fullname']:_0x7569('0xd5'),'createdAt':moment(_0x34df92[_0x7569('0x6e')])['format'](_0x7569('0xb4'))[_0x7569('0x8e')](),'closedAt':_0x34df92[_0x7569('0xd6')]?moment(_0x34df92[_0x7569('0xd7')])[_0x7569('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7569('0x8e')]():'','disposition':_0x34df92[_0x7569('0xd8')],'visibility':_0x34df92[_0x7569('0xd9')]?_0x7569('0xda'):_0x7569('0xdb'),'messages':_(_0x34df92[_0x7569('0xc8')])[_0x7569('0x78')]({'secret':![]})[_0x7569('0x2a')](function(_0x2f0450){if(_0x2f0450['Attachment']){var _0x207657=path[_0x7569('0xbe')](_0x1ebfb7,_0x2f0450[_0x7569('0xc7')][_0x7569('0xdc')]);if(fs[_0x7569('0xdd')](_0x207657)){fs[_0x7569('0xde')](_0x207657)[_0x7569('0xdf')](fs[_0x7569('0xe0')](path['join'](_0x3d0f26,_0x2f0450[_0x7569('0xc7')]['basename'])));}}return{'date':moment(_0x2f0450['createdAt'])['format'](_0x7569('0xb4'))[_0x7569('0x8e')](),'sender':_0x2f0450['direction']==='out'?_0x2f0450[_0x7569('0x65')]?_0x2f0450[_0x7569('0x65')][_0x7569('0x2b')]:_0x7569('0xe1'):_0x2f0450[_0x7569('0x5c')][_0x7569('0xc5')]+(_0x2f0450[_0x7569('0x5c')]['lastName']?'\x20'+_0x2f0450[_0x7569('0x5c')]['lastName']:''),'body':_0x2f0450[_0x7569('0xc7')]?_0x2f0450['Attachment'][_0x7569('0xdc')]:_0x2f0450[_0x7569('0xaa')],'direction':_0x2f0450[_0x7569('0xe2')]==='out'?'A':'C','secret':_0x2f0450[_0x7569('0xc9')],'read':_0x2f0450[_0x7569('0x75')],'attachment':_0x2f0450[_0x7569('0xc7')]};})[_0x7569('0x5e')]()};return ejs[_0x7569('0xe3')](path['join'](config[_0x7569('0xbf')],'server',_0x7569('0xe4'),_0x7569('0xe5')),{'interaction':_0x21db38})[_0x7569('0x24')](function(_0x1368fb){return new BPromise(function(_0x4db2de,_0x31d4be){pdf[_0x7569('0xa9')](_0x1368fb,_0x232b39)[_0x7569('0xe6')](path[_0x7569('0xbe')](_0x3d0f26,_0x7569('0xe7')+_0x34df92['id']+'-'+_0x37de31+_0x7569('0xe8')),function(_0x546529,_0x828b10){if(_0x546529)return _0x31d4be(_0x546529);_0x4db2de(_0x828b10);});});})['then'](function(){return new BPromise(function(_0x51aa44,_0x121239){zipdir(_0x3d0f26,{'saveTo':_0x865bc1},function(_0x4586c0,_0xf8f1e0){if(_0x4586c0)return _0x121239(_0x4586c0);return _0x51aa44(_0xf8f1e0);});})[_0x7569('0x24')](function(){return new BPromise(function(_0x2ab1c8,_0x55964c){rimraf(_0x3d0f26,function(_0xcd56ac){if(_0xcd56ac)_0x55964c(_0xcd56ac);return _0x2ab1c8();});});})['then'](function(){return _0x229f7b[_0x7569('0xbc')](_0x865bc1,_0x11f408,function(_0x4c4bfa){if(_0x4c4bfa){console[_0x7569('0xe9')](_0x7569('0xea'),_0x4c4bfa);}else{fs['unlinkSync'](_0x865bc1);}});});});}else{return _0x229f7b[_0x7569('0x1a')](0xc8);}})['catch'](handleError(_0x229f7b,null));}; \ No newline at end of file +var _0xfda3=['./openchannelInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','split','push','catch','index','OpenchannelInteraction','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','field','color','select','u.fullname','ui.OpenchannelInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$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','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','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','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','rawAttributes','includeAll','include','params','describe','addMessage','OpenchannelMessage','omit','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','ids','spread','Tag','openchannelInteractionTags:save','removeTags','download','root','files','tmp','server','attachments','transcript-%d-%s.zip','join','fullname','CmContact','firstName','lastName','Messages','direction','OpenchannelAccount','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','YYYY-MM-DD','Openchannel','N.A.','closed','closedAt','basename','createReadStream','createWriteStream','Attachment','out','System','secret','renderFile','views','downloadInteraction.html','create','toFile','log','err','unlinkSync','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost'];(function(_0x1e945f,_0x3f24d2){var _0x189aa7=function(_0x15d561){while(--_0x15d561){_0x1e945f['push'](_0x1e945f['shift']());}};_0x189aa7(++_0x3f24d2);}(_0xfda3,0x1b7));var _0x3fda=function(_0x490d21,_0x45d3de){_0x490d21=_0x490d21-0x0;var _0x31f143=_0xfda3[_0x490d21];return _0x31f143;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3fda('0x0'));var jsonpatch=require(_0x3fda('0x1'));var rp=require('request-promise');var moment=require(_0x3fda('0x2'));var BPromise=require(_0x3fda('0x3'));var Mustache=require(_0x3fda('0x4'));var util=require(_0x3fda('0x5'));var path=require('path');var sox=require(_0x3fda('0x6'));var csv=require('to-csv');var ejs=require(_0x3fda('0x7'));var fs=require('fs');var _=require(_0x3fda('0x8'));var squel=require(_0x3fda('0x9'));var crypto=require(_0x3fda('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3fda('0xb'));var querystring=require('querystring');var Papa=require(_0x3fda('0xc'));var Redis=require(_0x3fda('0xd'));var authService=require(_0x3fda('0xe'));var qs=require(_0x3fda('0xf'));var as=require(_0x3fda('0x10'));var hardwareService=require(_0x3fda('0x11'));var logger=require(_0x3fda('0x12'))(_0x3fda('0x13'));var utils=require(_0x3fda('0x14'));var config=require(_0x3fda('0x15'));var db=require(_0x3fda('0x16'))['db'];config[_0x3fda('0x17')]=_['defaults'](config['redis'],{'host':_0x3fda('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3fda('0x17')]));require(_0x3fda('0x19'))[_0x3fda('0x1a')](socket);function respondWithStatusCode(_0x779e6d,_0x350b65){_0x350b65=_0x350b65||0xcc;return function(_0x3a8a73){if(_0x3a8a73){return _0x779e6d[_0x3fda('0x1b')](_0x350b65);}return _0x779e6d[_0x3fda('0x1c')](_0x350b65)[_0x3fda('0x1d')]();};}function respondWithResult(_0x44b8e7,_0x1602ec){_0x1602ec=_0x1602ec||0xc8;return function(_0x184ff9){if(_0x184ff9){return _0x44b8e7[_0x3fda('0x1c')](_0x1602ec)[_0x3fda('0x1e')](_0x184ff9);}};}function respondWithFilteredResult(_0x3a1a7e,_0x2637e4){return function(_0x45828b){if(_0x45828b){var _0x4fa2d4=_0x45828b[_0x3fda('0x1f')],_0x219b5e=_0x2637e4[_0x3fda('0x20')],_0x300856=_0x2637e4[_0x3fda('0x20')]+_0x2637e4[_0x3fda('0x21')],_0x461919;if(_0x300856>=_0x4fa2d4){_0x300856=_0x4fa2d4;_0x461919=0xc8;}else{_0x461919=0xce;}_0x3a1a7e['status'](_0x461919);return _0x3a1a7e[_0x3fda('0x22')]('Content-Range',_0x219b5e+'-'+_0x300856+'/'+_0x4fa2d4)[_0x3fda('0x1e')](_0x45828b);}return null;};}function patchUpdates(_0x4902a3){return function(_0x2ad346){try{jsonpatch['apply'](_0x2ad346,_0x4902a3,!![]);}catch(_0x3476d4){return BPromise[_0x3fda('0x23')](_0x3476d4);}return _0x2ad346[_0x3fda('0x24')]();};}function saveUpdates(_0x44ab0f,_0x5e2946){return function(_0x443fb4){if(_0x443fb4){return _0x443fb4[_0x3fda('0x25')](_0x44ab0f)[_0x3fda('0x26')](function(_0x11d760){return _0x11d760;});}return null;};}function removeEntity(_0x9265ba,_0x4a4bd){return function(_0x4a36d3){if(_0x4a36d3){return _0x4a36d3[_0x3fda('0x27')]()[_0x3fda('0x26')](function(){_0x9265ba[_0x3fda('0x1c')](0xcc)[_0x3fda('0x1d')]();});}};}function handleEntityNotFound(_0x481d4b,_0x5d6cb9){return function(_0x1f40c3){if(!_0x1f40c3){_0x481d4b['sendStatus'](0x194);}return _0x1f40c3;};}function handleError(_0x12439d,_0x226c35){_0x226c35=_0x226c35||0x1f4;return function(_0x2effea){logger[_0x3fda('0x28')](_0x2effea[_0x3fda('0x29')]);if(_0x2effea[_0x3fda('0x2a')]){delete _0x2effea[_0x3fda('0x2a')];}_0x12439d[_0x3fda('0x1c')](_0x226c35)[_0x3fda('0x2b')](_0x2effea);};}function getInteractionUsers(_0x36bbb0,_0x5f15ca){return new BPromise(function(_0x432317,_0x53d97c){try{if(_0x5f15ca[_0x36bbb0['id']]){_0x36bbb0[_0x3fda('0x2c')]=_[_0x3fda('0x2d')](_0x5f15ca[_0x36bbb0['id']],function(_0x17139e){return{'id':_0x17139e['id'],'fullname':_0x17139e['fullname']};});}}catch(_0xb3f92e){_0x53d97c(_0xb3f92e);}_0x432317(_0x36bbb0);});}function getInteractionTags(_0x37f7ef,_0x97f099){return new BPromise(function(_0x23ec6d,_0x5f41e3){try{if(_0x37f7ef[_0x3fda('0x2e')]){_0x37f7ef[_0x3fda('0x2f')]=[];_0x37f7ef[_0x3fda('0x2e')][_0x3fda('0x30')](',')['forEach'](function(_0x5eff27){_0x37f7ef[_0x3fda('0x2f')][_0x3fda('0x31')](_0x97f099[_0x5eff27]);});}delete _0x37f7ef[_0x3fda('0x2e')];}catch(_0x1e0684){_0x5f41e3(_0x1e0684);}_0x23ec6d(_0x37f7ef);});}function updateOpenchannelInteraction(_0x5e8348,_0x212c91,_0x56642b){return new BPromise(function(_0x1679f4,_0xff5775){return getInteractionUsers(_0x5e8348,_0x56642b)[_0x3fda('0x26')](function(_0x544822){return getInteractionTags(_0x544822,_0x212c91);})['then'](function(_0x2da1ed){_0x1679f4(_0x2da1ed);})[_0x3fda('0x32')](function(_0x440c85){_0xff5775(_0x440c85);});});}exports[_0x3fda('0x33')]=function(_0x451251,_0x4fbca2){var _0x12f33a={},_0x427dba={},_0x14b203={'count':0x0,'rows':[]};var _0x5164e0=_[_0x3fda('0x2d')](db[_0x3fda('0x34')]['rawAttributes'],function(_0x36a18c){return{'name':_0x36a18c['fieldName'],'type':_0x36a18c['type']['key']};});_0x427dba[_0x3fda('0x35')]=_[_0x3fda('0x2d')](_0x5164e0,_0x3fda('0x2a'));_0x427dba[_0x3fda('0x36')]=_[_0x3fda('0x37')](_0x451251['query']);_0x427dba[_0x3fda('0x38')]=_[_0x3fda('0x39')](_0x427dba[_0x3fda('0x35')],_0x427dba['query']);_0x12f33a['attributes']=_[_0x3fda('0x39')](_0x427dba[_0x3fda('0x35')],qs[_0x3fda('0x3a')](_0x451251[_0x3fda('0x36')][_0x3fda('0x3a')]));_0x12f33a[_0x3fda('0x3b')]=_0x12f33a[_0x3fda('0x3b')][_0x3fda('0x3c')]?_0x12f33a[_0x3fda('0x3b')]:_0x427dba['model'];if(!_0x451251[_0x3fda('0x36')][_0x3fda('0x3d')]('nolimit')){_0x12f33a[_0x3fda('0x21')]=qs[_0x3fda('0x21')](_0x451251[_0x3fda('0x36')][_0x3fda('0x21')]);_0x12f33a['offset']=qs['offset'](_0x451251[_0x3fda('0x36')][_0x3fda('0x20')]);}_0x12f33a[_0x3fda('0x3e')]=qs[_0x3fda('0x3f')](_0x451251[_0x3fda('0x36')]['sort']);_0x12f33a[_0x3fda('0x40')]=qs[_0x3fda('0x38')](_[_0x3fda('0x41')](_0x451251['query'],_0x427dba[_0x3fda('0x38')]),_0x5164e0);var _0x261270=[];var _0x24b704=squel['select']()[_0x3fda('0x42')]('id')[_0x3fda('0x42')](_0x3fda('0x2a'))['field'](_0x3fda('0x43'))['from']('tools_tags');var _0x215a9e=squel[_0x3fda('0x44')]()[_0x3fda('0x42')]('u.id')[_0x3fda('0x42')](_0x3fda('0x45'))['field'](_0x3fda('0x46'))[_0x3fda('0x47')]('user_has_openchannel_interactions','ui')[_0x3fda('0x48')](_0x3fda('0x49'),'u',_0x3fda('0x4a'));var _0x2ab2bf=squel[_0x3fda('0x44')]()[_0x3fda('0x47')](_0x3fda('0x4b'),'i')[_0x3fda('0x48')](_0x3fda('0x4c'),'c',_0x3fda('0x4d'))['left_join'](_0x3fda('0x49'),'o',_0x3fda('0x4e'))[_0x3fda('0x48')](_0x3fda('0x4f'),'a',_0x3fda('0x50'))['left_join']('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x3fda('0x48')](_0x3fda('0x51'),'it',_0x3fda('0x52'))[_0x3fda('0x48')](_0x3fda('0x53'),'t',_0x3fda('0x54'));var _0x22dff0=squel[_0x3fda('0x55')]();var _0xa0874a=[];var _0x23e9d8=squel['expr']();var _0x496846;if(_0x451251[_0x3fda('0x36')][_0x3fda('0x56')]){_0x496846=as['parseSearch'](_0x451251['query']['search']);var _0x524beb=_0x496846['sqlOperator'];for(var _0x51ad35=0x0;_0x51ad35<_0x496846[_0x3fda('0x57')][_0x3fda('0x3c')];_0x51ad35++){var _0x1228b1=_0x496846['conditions'][_0x51ad35];var _0x4fbcc5='i';var _0x1185ec=_[_0x3fda('0x58')](_0x5164e0,['name',_0x1228b1[_0x3fda('0x42')]]);if(!_0x1185ec){switch(_0x1228b1[_0x3fda('0x42')]){case _0x3fda('0x59'):if(_0x1228b1[_0x3fda('0x5a')]==0x1){_0x2ab2bf[_0x3fda('0x5b')]('`'+_0x1228b1[_0x3fda('0x42')]+'`\x20=\x200');}else{_0x2ab2bf[_0x3fda('0x5b')]('`'+_0x1228b1[_0x3fda('0x42')]+_0x3fda('0x5c'));}break;case _0x3fda('0x5d'):if(_0x1228b1[_0x3fda('0x5e')]===_0x3fda('0x5f')){if(_0x1228b1[_0x3fda('0x5a')][_0x3fda('0x30')]('\x20')[_0x3fda('0x3c')]>0x1){_0x22dff0[_0x524beb]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3fda('0x60')](_0x1228b1[_0x3fda('0x5a')]),null);}else{var _0x4d8ea9='%'+_0x1228b1[_0x3fda('0x5a')]+'%';_0x22dff0[_0x524beb](_0x3fda('0x61'),_0x4d8ea9,_0x4d8ea9,_0x4d8ea9);}}else{_0x1185ec=_[_0x3fda('0x58')](_0x5164e0,[_0x3fda('0x2a'),_0x3fda('0x62')]);_0x1228b1[_0x3fda('0x42')]=_0x3fda('0x62');_0x6a8ec0=as[_0x3fda('0x63')](_0x4fbcc5,_0x1185ec[_0x3fda('0x64')],_0x1228b1);_0x22dff0[_0x524beb](_0x6a8ec0[_0x3fda('0x65')],_0x6a8ec0[_0x3fda('0x5a')][_0x3fda('0x66')],_0x6a8ec0['value'][_0x3fda('0x1d')]);}break;case'Tag':var _0x3fe0d8=_0x1228b1[_0x3fda('0x5a')]['split'](',')[_0x3fda('0x2d')](function(_0x286df4){return Number(_0x286df4);});_0x3fe0d8[_0x3fda('0x67')](function(_0xf5fd4f){_0x23e9d8['or'](_0x3fda('0x68'),'%,'+_0xf5fd4f+',%');});_0xa0874a=_['union'](_0xa0874a,_0x3fe0d8);break;case _0x3fda('0x69'):if(_0x1228b1[_0x3fda('0x5e')]===_0x3fda('0x5f')){_0x22dff0[_0x524beb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1228b1[_0x3fda('0x5a')]+'%',null);}else{_0x1185ec=_[_0x3fda('0x58')](_0x5164e0,[_0x3fda('0x2a'),_0x3fda('0x6a')]);_0x1228b1[_0x3fda('0x42')]=_0x3fda('0x6a');_0x6a8ec0=as[_0x3fda('0x63')](_0x4fbcc5,_0x1185ec['type'],_0x1228b1);_0x22dff0[_0x524beb](_0x6a8ec0[_0x3fda('0x65')],_0x6a8ec0[_0x3fda('0x5a')][_0x3fda('0x66')],_0x6a8ec0[_0x3fda('0x5a')][_0x3fda('0x1d')]);}break;case _0x3fda('0x6b'):_0x6a8ec0=as[_0x3fda('0x63')]('me',null,_0x1228b1);_0x22dff0[_0x524beb](_0x6a8ec0['text'],_0x6a8ec0['value'][_0x3fda('0x66')],_0x6a8ec0[_0x3fda('0x5a')][_0x3fda('0x1d')]);break;}}else{var _0x6a8ec0=as[_0x3fda('0x63')](_0x4fbcc5,_0x1185ec[_0x3fda('0x64')],_0x1228b1);_0x22dff0[_0x524beb](_0x6a8ec0[_0x3fda('0x65')],_0x6a8ec0[_0x3fda('0x5a')]['start'],_0x6a8ec0[_0x3fda('0x5a')][_0x3fda('0x1d')]);}}}else{var _0x54899c=_(_0x451251[_0x3fda('0x36')])[_0x3fda('0x37')]()[_0x3fda('0x2d')](function(_0xb19ab9){return _[_0x3fda('0x6c')](_0x5164e0,[_0x3fda('0x2a'),_0xb19ab9])?_0xb19ab9:undefined;})[_0x3fda('0x6d')]()[_0x3fda('0x5a')]();if(!_[_0x3fda('0x6e')](_0x54899c)){_0x54899c['forEach'](function(_0x56b7a1){if(_0x56b7a1===_0x3fda('0x6f')){_0x2ab2bf[_0x3fda('0x40')](_0x3fda('0x70'),[][_0x3fda('0x71')](_0x451251[_0x3fda('0x36')][_0x56b7a1]));}else if(_0x56b7a1===_0x3fda('0x72')){var _0x4f0522=JSON['parse'](_0x451251['query'][_0x56b7a1])[_0x3fda('0x73')];var _0x363beb=JSON[_0x3fda('0x74')](_0x451251['query'][_0x56b7a1])[_0x3fda('0x75')];_0x2ab2bf[_0x3fda('0x40')](_0x3fda('0x76'),_0x4f0522,_0x363beb);}else{if(_0x451251[_0x3fda('0x36')][_0x56b7a1]===_0x3fda('0x77')){_0x2ab2bf['where']('i.'+_0x56b7a1+_0x3fda('0x78'));}else{_0x2ab2bf[_0x3fda('0x40')]('i.'+_0x56b7a1+_0x3fda('0x79'),_0x451251['query'][_0x56b7a1]);}}});}if(_0x451251[_0x3fda('0x36')][_0x3fda('0x7a')]){if(_0x451251['query'][_0x3fda('0x7a')]==0x1){_0x2ab2bf[_0x3fda('0x5b')]('`unreadMessages`\x20=\x200');}else{_0x2ab2bf[_0x3fda('0x5b')](_0x3fda('0x7b'));}}if(_0x451251[_0x3fda('0x36')][_0x3fda('0x7c')]){_0xa0874a=_[_0x3fda('0x7d')](_0x451251['query'][_0x3fda('0x7c')])?_0x451251[_0x3fda('0x36')][_0x3fda('0x7c')]:new Array(_0x451251['query'][_0x3fda('0x7c')]);_0xa0874a['forEach'](function(_0x2608f5){_0x23e9d8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2608f5+',%');});}if(_0x451251[_0x3fda('0x36')][_0x3fda('0x7e')]){var _0x201f4e=_0x451251[_0x3fda('0x36')][_0x3fda('0x7e')][_0x3fda('0x7f')]('\x5c','\x5c\x5c')[_0x3fda('0x7f')]('\x27\x27',_0x3fda('0x80'));if(qs[_0x3fda('0x81')](_0x201f4e)){_0x22dff0['or']('i.id\x20LIKE\x20?',_0x201f4e+'%');}else{_0x22dff0['or'](_0x3fda('0x82'),qs[_0x3fda('0x60')](_0x201f4e))['or'](_0x3fda('0x83'),_0x201f4e+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x201f4e+'%');}}}_0x2ab2bf[_0x3fda('0x40')](_0x22dff0);_0x2ab2bf[_0x3fda('0x84')](_0x3fda('0x85'));var _0x25a31d={'type':db[_0x3fda('0x86')][_0x3fda('0x87')]['SELECT'],'raw':!![]};var _0x167a7d=_0x2ab2bf[_0x3fda('0x88')]();_0x167a7d[_0x3fda('0x42')](_0x3fda('0x85'));_0x167a7d[_0x3fda('0x42')](_0x3fda('0x89'),'unreadMessages');if(_0x12f33a[_0x3fda('0x3e')]){_0x12f33a[_0x3fda('0x3e')]['forEach'](function(_0x414450){_0x2ab2bf[_0x3fda('0x3e')]('i.'+_0x414450[0x0],_0x414450[0x1]===_0x3fda('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0xa0874a)){_0x2ab2bf[_0x3fda('0x5b')](_0x23e9d8);_0x167a7d[_0x3fda('0x40')](_0x3fda('0x8b'),_0xa0874a);}BPromise['resolve']()[_0x3fda('0x26')](function(){if(!_0x496846){if(_0x451251['query'][_0x3fda('0x6f')]||_0x451251['query'][_0x3fda('0x8c')])return;_0x167a7d[_0x3fda('0x40')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x2ab2bf['where'](_0x3fda('0x8d'));return;}return _0x451251[_0x3fda('0x8e')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x181d88){if(_[_0x3fda('0x6e')](_0x181d88)){_0x167a7d[_0x3fda('0x40')](_0x3fda('0x8f'));_0x2ab2bf[_0x3fda('0x40')](_0x3fda('0x8f'));}else{_0x167a7d['where'](_0x3fda('0x70'),_[_0x3fda('0x2d')](_0x181d88,'id'));_0x2ab2bf[_0x3fda('0x40')](_0x3fda('0x70'),_[_0x3fda('0x2d')](_0x181d88,'id'));}});})['then'](function(){db[_0x3fda('0x90')]['query'](_0x167a7d[_0x3fda('0x91')](),_0x25a31d)[_0x3fda('0x26')](function(_0x176a1f){_0x14b203[_0x3fda('0x1f')]=_0x176a1f[_0x3fda('0x3c')];if(_0x14b203['count']===0x0)return[];return db[_0x3fda('0x90')][_0x3fda('0x36')](_0x24b704[_0x3fda('0x91')](),_0x25a31d)[_0x3fda('0x26')](function(_0x446261){_0x261270=_['keyBy'](_0x446261,'id');_0x25a31d=_[_0x3fda('0x92')](_0x25a31d,{'model':db[_0x3fda('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x451251['query'][_0x3fda('0x3a')]){_0x12f33a['attributes'][_0x3fda('0x67')](function(_0x3e6452){_0x2ab2bf[_0x3fda('0x42')]('i.'+_0x3e6452);});}else{_0x2ab2bf[_0x3fda('0x42')](_0x3fda('0x89'),'unreadMessages');_0x2ab2bf[_0x3fda('0x42')]('a.key',_0x3fda('0x93'));_0x2ab2bf['field'](_0x3fda('0x94'),_0x3fda('0x95'));_0x2ab2bf['field'](_0x3fda('0x96'));_0x2ab2bf[_0x3fda('0x42')](_0x3fda('0x97'),_0x3fda('0x98'));_0x2ab2bf[_0x3fda('0x42')](_0x3fda('0x99'),_0x3fda('0x9a'));_0x2ab2bf[_0x3fda('0x42')](_0x3fda('0x9b'),_0x3fda('0x9c'));_0x2ab2bf[_0x3fda('0x42')](_0x3fda('0x9d'),_0x3fda('0x9e'));_0x2ab2bf['field'](_0x3fda('0x9f'),'Contact.mobile');_0x2ab2bf[_0x3fda('0x42')]('c.fax',_0x3fda('0xa0'));_0x2ab2bf['field'](_0x3fda('0xa1'),_0x3fda('0xa2'));_0x2ab2bf[_0x3fda('0x42')]('o.internal','Owner.internal');_0x2ab2bf[_0x3fda('0x42')](_0x3fda('0xa3'),_0x3fda('0x2e'));}if(_0x12f33a[_0x3fda('0x21')])_0x2ab2bf[_0x3fda('0x21')](_0x12f33a[_0x3fda('0x21')]);if(_0x12f33a[_0x3fda('0x20')])_0x2ab2bf[_0x3fda('0x20')](_0x12f33a['offset']);return db[_0x3fda('0x90')][_0x3fda('0x36')](_0x2ab2bf[_0x3fda('0x91')](),_0x25a31d);})['then'](function(_0x37365a){_0x215a9e[_0x3fda('0x40')](_0x3fda('0xa4'),_[_0x3fda('0x2d')](_0x37365a,'id'));return db[_0x3fda('0x90')]['query'](_0x215a9e[_0x3fda('0x91')](),_0x25a31d)[_0x3fda('0x26')](function(_0x6f60f8){var _0x16221a=_[_0x3fda('0xa5')](_0x6f60f8,_0x3fda('0xa6'));var _0x344b85=[];_0x37365a[_0x3fda('0x67')](function(_0x251d15){_0x344b85[_0x3fda('0x31')](updateOpenchannelInteraction(_0x251d15,_0x261270,_0x16221a));});return BPromise[_0x3fda('0xa7')](_0x344b85);});});})[_0x3fda('0x26')](function(_0x189c14){_0x14b203[_0x3fda('0xa8')]=_0x189c14;return _0x14b203;})[_0x3fda('0x26')](respondWithFilteredResult(_0x4fbca2,_0x12f33a));})['catch'](handleError(_0x4fbca2,null));};exports[_0x3fda('0xa9')]=function(_0x853dbb,_0x2114ea){var _0x5a7636={'raw':![],'where':{'id':_0x853dbb['params']['id']}},_0x1c4deb={};_0x1c4deb['model']=_['keys'](db[_0x3fda('0x34')][_0x3fda('0xaa')]);_0x1c4deb[_0x3fda('0x36')]=_['keys'](_0x853dbb[_0x3fda('0x36')]);_0x1c4deb['filters']=_[_0x3fda('0x39')](_0x1c4deb['model'],_0x1c4deb[_0x3fda('0x36')]);_0x5a7636[_0x3fda('0x3b')]=_[_0x3fda('0x39')](_0x1c4deb['model'],qs[_0x3fda('0x3a')](_0x853dbb[_0x3fda('0x36')]['fields']));_0x5a7636[_0x3fda('0x3b')]=_0x5a7636[_0x3fda('0x3b')][_0x3fda('0x3c')]?_0x5a7636[_0x3fda('0x3b')]:_0x1c4deb[_0x3fda('0x35')];if(_0x853dbb[_0x3fda('0x36')][_0x3fda('0xab')]){_0x5a7636[_0x3fda('0xac')]=[{'all':!![]}];}_0x5a7636=_[_0x3fda('0x92')]({},_0x5a7636,_0x853dbb['options']);return db['OpenchannelInteraction'][_0x3fda('0x58')](_0x5a7636)[_0x3fda('0x26')](handleEntityNotFound(_0x2114ea,null))[_0x3fda('0x26')](respondWithResult(_0x2114ea,null))[_0x3fda('0x32')](handleError(_0x2114ea,null));};exports['create']=function(_0x2e2137,_0x374ce0){return db[_0x3fda('0x34')]['create'](_0x2e2137[_0x3fda('0x6b')],{})[_0x3fda('0x26')](respondWithResult(_0x374ce0,0xc9))[_0x3fda('0x32')](handleError(_0x374ce0,null));};exports[_0x3fda('0x25')]=function(_0x146af5,_0x35b406){if(_0x146af5[_0x3fda('0x6b')]['id']){delete _0x146af5['body']['id'];}return db[_0x3fda('0x34')][_0x3fda('0x58')]({'where':{'id':_0x146af5[_0x3fda('0xad')]['id']}})[_0x3fda('0x26')](handleEntityNotFound(_0x35b406,null))[_0x3fda('0x26')](saveUpdates(_0x146af5[_0x3fda('0x6b')],null))[_0x3fda('0x26')](respondWithResult(_0x35b406,null))[_0x3fda('0x32')](handleError(_0x35b406,null));};exports[_0x3fda('0x27')]=function(_0x89de8a,_0x7f5198){return db['OpenchannelInteraction'][_0x3fda('0x58')]({'where':{'id':_0x89de8a[_0x3fda('0xad')]['id']}})[_0x3fda('0x26')](handleEntityNotFound(_0x7f5198,null))[_0x3fda('0x26')](removeEntity(_0x7f5198,null))['catch'](handleError(_0x7f5198,null));};exports[_0x3fda('0xae')]=function(_0x648583,_0x518d5a){return db[_0x3fda('0x34')][_0x3fda('0xae')]()[_0x3fda('0x26')](respondWithResult(_0x518d5a,null))['catch'](handleError(_0x518d5a,null));};exports[_0x3fda('0xaf')]=function(_0x1b96a4,_0x25579e,_0x367a7f){return db[_0x3fda('0xb0')][_0x3fda('0x58')]({'where':{'id':_0x1b96a4['params']['id']}})[_0x3fda('0x26')](handleEntityNotFound(_0x25579e,null))[_0x3fda('0x26')](function(_0x58d2a6){if(_0x58d2a6){return _0x58d2a6[_0x3fda('0xaf')](_0x1b96a4['body']['ids'],_[_0x3fda('0xb1')](_0x1b96a4['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x25579e,null))[_0x3fda('0x32')](handleError(_0x25579e,null));};exports['getMessages']=function(_0x332fc2,_0x10b97b,_0x272621){var _0x366c8d={'raw':![],'where':{}};var _0x49741f={};var _0xf0e2ae={'count':0x0,'rows':[]};return db[_0x3fda('0x34')][_0x3fda('0xb2')]({'where':{'id':_0x332fc2[_0x3fda('0xad')]['id']}})[_0x3fda('0x26')](handleEntityNotFound(_0x10b97b,null))[_0x3fda('0x26')](function(_0x474659){if(_0x474659){_0x49741f[_0x3fda('0x35')]=_[_0x3fda('0x37')](db['OpenchannelMessage'][_0x3fda('0xaa')]);_0x49741f[_0x3fda('0x36')]=_[_0x3fda('0x37')](_0x332fc2['query']);_0x49741f[_0x3fda('0x38')]=_['intersection'](_0x49741f['model'],_0x49741f['query']);_0x366c8d['attributes']=_[_0x3fda('0x39')](_0x49741f['model'],qs[_0x3fda('0x3a')](_0x332fc2[_0x3fda('0x36')]['fields']));_0x366c8d[_0x3fda('0x3b')]=_0x366c8d['attributes']['length']?_0x366c8d[_0x3fda('0x3b')]:_0x49741f['model'];if(!_0x332fc2[_0x3fda('0x36')]['hasOwnProperty'](_0x3fda('0xb3'))){_0x366c8d['limit']=qs[_0x3fda('0x21')](_0x332fc2['query'][_0x3fda('0x21')]);_0x366c8d[_0x3fda('0x20')]=qs[_0x3fda('0x20')](_0x332fc2[_0x3fda('0x36')][_0x3fda('0x20')]);}_0x366c8d['order']=qs['sort'](_0x332fc2[_0x3fda('0x36')][_0x3fda('0x3f')]);_0x366c8d[_0x3fda('0x40')]=qs['filters'](_[_0x3fda('0x41')](_0x332fc2['query'],_0x49741f[_0x3fda('0x38')]));_0x366c8d[_0x3fda('0x40')]['OpenchannelInteractionId']=_0x474659['id'];if(_0x332fc2[_0x3fda('0x36')][_0x3fda('0x7e')]){_0x366c8d[_0x3fda('0x40')]=_[_0x3fda('0x92')](_0x366c8d[_0x3fda('0x40')],{'$or':_[_0x3fda('0x2d')](_0x366c8d[_0x3fda('0x3b')],function(_0x3c4acf){var _0x45d6f0={};_0x45d6f0[_0x3c4acf]={'$like':'%'+_0x332fc2['query'][_0x3fda('0x7e')]+'%'};return _0x45d6f0;})});}if(_0x332fc2[_0x3fda('0x36')][_0x3fda('0x73')]){var _0x410f1b=_0x332fc2[_0x3fda('0x36')][_0x3fda('0x73')][_0x3fda('0x30')](',');var _0x4a3e67={};_0x4a3e67[_0x410f1b[0x0]]={'$gte':moment(_0x410f1b[0x1])[_0x3fda('0xb4')](_0x3fda('0xb5'))};_0x366c8d[_0x3fda('0x40')]=_[_0x3fda('0x92')](_0x366c8d[_0x3fda('0x40')],_0x4a3e67);}_0x366c8d=_[_0x3fda('0x92')]({},_0x366c8d,_0x332fc2[_0x3fda('0xb6')]);return db[_0x3fda('0xb0')]['count']({'where':_0x366c8d['where']})[_0x3fda('0x26')](function(_0x10fc71){_0xf0e2ae[_0x3fda('0x1f')]=_0x10fc71;if(_0x332fc2['query'][_0x3fda('0xab')]){_0x366c8d[_0x3fda('0xac')]=[{'all':!![]}];}return db[_0x3fda('0xb0')][_0x3fda('0xb7')](_0x366c8d);})[_0x3fda('0x26')](function(_0x5b274c){_0xf0e2ae['rows']=_0x5b274c;return _0xf0e2ae;});}})[_0x3fda('0x26')](respondWithFilteredResult(_0x10b97b,_0x366c8d))[_0x3fda('0x32')](handleError(_0x10b97b,null));};exports[_0x3fda('0xb8')]=function(_0x349d5e,_0x128f68,_0x2590fc){return db[_0x3fda('0x34')][_0x3fda('0x58')]({'where':{'id':_0x349d5e[_0x3fda('0xad')]['id']}})[_0x3fda('0x26')](handleEntityNotFound(_0x128f68,null))[_0x3fda('0x26')](function(_0x595632){if(_0x595632){return _0x595632[_0x3fda('0xb9')](_0x349d5e[_0x3fda('0x6b')][_0x3fda('0xba')],_['omit'](_0x349d5e[_0x3fda('0x6b')],[_0x3fda('0xba'),'id'])||{})[_0x3fda('0xbb')](function(){return db[_0x3fda('0xbc')][_0x3fda('0xb7')]({'attributes':['id',_0x3fda('0x2a'),_0x3fda('0x43')],'where':{'id':_0x349d5e[_0x3fda('0x6b')]['ids']}});})[_0x3fda('0x26')](function(_0x207159){socket['emit'](_0x3fda('0xbd'),{'id':Number(_0x349d5e[_0x3fda('0xad')]['id']),'tags':_0x207159||[]});return{'id':Number(_0x349d5e[_0x3fda('0xad')]['id']),'tags':_0x207159||[]};});}})[_0x3fda('0x26')](respondWithResult(_0x128f68,null))[_0x3fda('0x32')](handleError(_0x128f68,null));};exports['removeTags']=function(_0x5a73ed,_0x291299,_0x4c06ed){return db[_0x3fda('0x34')][_0x3fda('0x58')]({'where':{'id':_0x5a73ed[_0x3fda('0xad')]['id']}})[_0x3fda('0x26')](handleEntityNotFound(_0x291299,null))[_0x3fda('0x26')](function(_0x45b58c){if(_0x45b58c){return _0x45b58c[_0x3fda('0xbe')](_0x5a73ed[_0x3fda('0x36')][_0x3fda('0xba')]);}})['then'](respondWithStatusCode(_0x291299,null))['catch'](handleError(_0x291299,null));};exports[_0x3fda('0xbf')]=function(_0x17b37c,_0x7113da){var _0x51fca2=moment()['unix']()[_0x3fda('0x91')]();var _0x4a7c54=path['join'](config[_0x3fda('0xc0')],'server',_0x3fda('0xc1'),_0x3fda('0xc2'));var _0xe86114=path['join'](config['root'],_0x3fda('0xc3'),_0x3fda('0xc1'),_0x3fda('0xc4'));var _0x6fb647=path['join'](_0x4a7c54,_0x51fca2);var _0x520206=util['format'](_0x3fda('0xc5'),_0x17b37c[_0x3fda('0xad')]['id'],_0x51fca2);var _0x3c81e6=path[_0x3fda('0xc6')](_0x4a7c54,_0x520206);var _0x2568e1=[];_0x2568e1[_0x3fda('0x31')]({'model':db['User'],'as':'User','attributes':['id',_0x3fda('0xc7')],'raw':!![]});_0x2568e1[_0x3fda('0x31')]({'model':db[_0x3fda('0xc8')],'as':_0x3fda('0x5d'),'attributes':['id',_0x3fda('0xc9'),_0x3fda('0xca')],'raw':!![]});if(_0x17b37c[_0x3fda('0x36')][_0x3fda('0xc4')]){_0x2568e1[_0x3fda('0x31')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x25e9ec=[{'model':db[_0x3fda('0xb0')],'as':_0x3fda('0xcb'),'attributes':['id',_0x3fda('0x6b'),_0x3fda('0x72'),_0x3fda('0xcc'),'secret',_0x3fda('0x7a')],'include':_0x2568e1}];_0x25e9ec['push']({'model':db[_0x3fda('0xcd')],'as':_0x3fda('0xce'),'attributes':['id',_0x3fda('0x2a')]});_0x25e9ec[_0x3fda('0x31')]({'model':db[_0x3fda('0x69')],'as':_0x3fda('0xcf'),'attributes':['id',_0x3fda('0xc7')]});return db[_0x3fda('0x34')][_0x3fda('0x58')]({'where':{'id':_0x17b37c[_0x3fda('0xad')]['id']},'include':_0x25e9ec})[_0x3fda('0x26')](handleEntityNotFound(_0x7113da,null))[_0x3fda('0x26')](function(_0x15a890){if(_0x15a890){var _0x1a095e=_0x15a890['get']({'plain':!![]});fs[_0x3fda('0xd0')](_0x6fb647);var _0x3a21c9={'format':'A4','border':_0x3fda('0xd1'),'header':{'height':_0x3fda('0xd2'),'contents':{'first':_0x3fda('0xd3')}},'footer':{'height':'30px','contents':{'default':util[_0x3fda('0xb4')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x3fda('0xb4')]('%s\x20#%d','Openchannel',_0x1a095e['id']),moment()[_0x3fda('0xb4')](_0x3fda('0xd4'))['toString']())}}};var _0x20c0c7={'channel':_0x3fda('0xd5'),'account':_0x1a095e[_0x3fda('0xce')][_0x3fda('0x2a')],'agent':_0x1a095e[_0x3fda('0xcf')]?_0x1a095e[_0x3fda('0xcf')][_0x3fda('0xc7')]:_0x3fda('0xd6'),'createdAt':moment(_0x1a095e['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3fda('0x91')](),'closedAt':_0x1a095e[_0x3fda('0xd7')]?moment(_0x1a095e[_0x3fda('0xd8')])[_0x3fda('0xb4')](_0x3fda('0xb5'))[_0x3fda('0x91')]():'','disposition':_0x1a095e['disposition'],'visibility':_0x1a095e['threadId']?'Public':'Private','messages':_(_0x1a095e['Messages'])[_0x3fda('0x7e')]({'secret':![]})[_0x3fda('0x2d')](function(_0x3a569c){if(_0x3a569c['Attachment']){var _0x500e44=path['join'](_0xe86114,_0x3a569c['Attachment'][_0x3fda('0xd9')]);if(fs['existsSync'](_0x500e44)){fs[_0x3fda('0xda')](_0x500e44)['pipe'](fs[_0x3fda('0xdb')](path['join'](_0x6fb647,_0x3a569c[_0x3fda('0xdc')]['basename'])));}}return{'date':moment(_0x3a569c[_0x3fda('0x72')])[_0x3fda('0xb4')](_0x3fda('0xb5'))['toString'](),'sender':_0x3a569c[_0x3fda('0xcc')]===_0x3fda('0xdd')?_0x3a569c['User']?_0x3a569c[_0x3fda('0x69')][_0x3fda('0xc7')]:_0x3fda('0xde'):_0x3a569c[_0x3fda('0x5d')]['firstName']+(_0x3a569c['Contact']['lastName']?'\x20'+_0x3a569c[_0x3fda('0x5d')][_0x3fda('0xca')]:''),'body':_0x3a569c['Attachment']?_0x3a569c[_0x3fda('0xdc')]['basename']:_0x3a569c[_0x3fda('0x6b')],'direction':_0x3a569c['direction']===_0x3fda('0xdd')?'A':'C','secret':_0x3a569c[_0x3fda('0xdf')],'read':_0x3a569c[_0x3fda('0x7a')],'attachment':_0x3a569c[_0x3fda('0xdc')]};})[_0x3fda('0x5a')]()};return ejs[_0x3fda('0xe0')](path[_0x3fda('0xc6')](config['root'],_0x3fda('0xc3'),_0x3fda('0xe1'),_0x3fda('0xe2')),{'interaction':_0x20c0c7})[_0x3fda('0x26')](function(_0x2aa212){return new BPromise(function(_0x84dfca,_0x1bc06a){pdf[_0x3fda('0xe3')](_0x2aa212,_0x3a21c9)[_0x3fda('0xe4')](path[_0x3fda('0xc6')](_0x6fb647,'transcript-'+_0x1a095e['id']+'-'+_0x51fca2+'.pdf'),function(_0x3d498a,_0x48c52d){if(_0x3d498a)return _0x1bc06a(_0x3d498a);_0x84dfca(_0x48c52d);});});})[_0x3fda('0x26')](function(){return new BPromise(function(_0x21ccde,_0x6f2cf7){zipdir(_0x6fb647,{'saveTo':_0x3c81e6},function(_0x5d44a9,_0x130cb1){if(_0x5d44a9)return _0x6f2cf7(_0x5d44a9);return _0x21ccde(_0x130cb1);});})[_0x3fda('0x26')](function(){return new BPromise(function(_0xb69b8b,_0x322eed){rimraf(_0x6fb647,function(_0x11accf){if(_0x11accf)_0x322eed(_0x11accf);return _0xb69b8b();});});})['then'](function(){return _0x7113da['download'](_0x3c81e6,_0x520206,function(_0x4dfc12){if(_0x4dfc12){console[_0x3fda('0xe5')](_0x3fda('0xe6'),_0x4dfc12);}else{fs[_0x3fda('0xe7')](_0x3c81e6);}});});});}else{return _0x7113da[_0x3fda('0x1b')](0xc8);}})[_0x3fda('0x32')](handleError(_0x7113da,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 0df2ccc..63b700e 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 _0xd566=['hook','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','update','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x1d2938,_0x2ae8d4){var _0x2c5afd=function(_0x146f6e){while(--_0x146f6e){_0x1d2938['push'](_0x1d2938['shift']());}};_0x2c5afd(++_0x2ae8d4);}(_0xd566,0xc4));var _0x6d56=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd566[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x6d56('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x6d56('0x1')];var OpenchannelMessage=require(_0x6d56('0x2'))['db'][_0x6d56('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6d56('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d56('0x5'),'afterDestroy':'remove'};function emitEvent(_0x8821a2){return function(_0x247b35,_0x501ab4,_0xf39b41){_0x247b35['getUsers']({'attributes':['id'],'raw':!![]})[_0x6d56('0x6')](function(_0x9763db){_0x247b35[_0x6d56('0x7')]('Users',_0x9763db['map'](function(_0x1ad440){return{'id':_0x1ad440['id']};}));return OpenchannelMessage[_0x6d56('0x8')]({'where':{'OpenchannelInteractionId':_0x247b35['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6d56('0x6')](function(_0x111a65){_0x247b35[_0x6d56('0x7')](_0x6d56('0x9'),_0x111a65[_0x6d56('0xa')]);OpenchannelInteractionEvents[_0x6d56('0xb')](_0x8821a2+':'+_0x247b35['id'],_0x247b35);OpenchannelInteractionEvents['emit'](_0x8821a2,_0x247b35);_0xf39b41(null);})[_0x6d56('0xc')](_0xf39b41(null));};}for(var e in events){if(events[_0x6d56('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x6d56('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6140=['remove','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0xb5287,_0x1ad847){var _0x37929c=function(_0x5eaaba){while(--_0x5eaaba){_0xb5287['push'](_0xb5287['shift']());}};_0x37929c(++_0x1ad847);}(_0x6140,0x84));var _0x0614=function(_0x4ee140,_0xddce08){_0x4ee140=_0x4ee140-0x0;var _0x1c14bd=_0x6140[_0x4ee140];return _0x1c14bd;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x0614('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x0614('0x0'))['db'][_0x0614('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0614('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0614('0x3')};function emitEvent(_0x5e4da4){return function(_0x3a831b,_0x318057,_0xd6395f){_0x3a831b['getUsers']({'attributes':['id'],'raw':!![]})[_0x0614('0x4')](function(_0x8ed401){_0x3a831b['setDataValue'](_0x0614('0x5'),_0x8ed401[_0x0614('0x6')](function(_0x5417c4){return{'id':_0x5417c4['id']};}));return OpenchannelMessage[_0x0614('0x7')]({'where':{'OpenchannelInteractionId':_0x3a831b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0614('0x4')](function(_0x204be9){_0x3a831b[_0x0614('0x8')](_0x0614('0x9'),_0x204be9[_0x0614('0xa')]);OpenchannelInteractionEvents[_0x0614('0xb')](_0x5e4da4+':'+_0x3a831b['id'],_0x3a831b);OpenchannelInteractionEvents[_0x0614('0xb')](_0x5e4da4,_0x3a831b);_0xd6395f(null);})[_0x0614('0xc')](_0xd6395f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x0614('0xd')](e,emitEvent(event));}}module[_0x0614('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 ecfe9aa..212f80d 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 _0x0e8b=['changed','closedAt','format','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x4e0560,_0x2841c4){var _0x1b34df=function(_0x241842){while(--_0x241842){_0x4e0560['push'](_0x4e0560['shift']());}};_0x1b34df(++_0x2841c4);}(_0x0e8b,0x111));var _0xb0e8=function(_0x48352b,_0x53db91){_0x48352b=_0x48352b-0x0;var _0x2e95ff=_0x0e8b[_0x48352b];return _0x2e95ff;};'use strict';var _=require(_0xb0e8('0x0'));var util=require('util');var logger=require(_0xb0e8('0x1'))(_0xb0e8('0x2'));var moment=require(_0xb0e8('0x3'));var BPromise=require(_0xb0e8('0x4'));var rp=require(_0xb0e8('0x5'));var fs=require('fs');var path=require(_0xb0e8('0x6'));var rimraf=require('rimraf');var config=require(_0xb0e8('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0xb0e8('0x8')]=function(_0x109340,_0x3e138f){return _0x109340[_0xb0e8('0x9')](_0xb0e8('0xa'),attributes,{'tableName':_0xb0e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa85040,_0x4dc029,_0x3866dc){if(_0xa85040[_0xb0e8('0xc')]('closed')){_0xa85040[_0xb0e8('0xd')]=moment()[_0xb0e8('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3866dc(null,_0xa85040);}}});}; \ No newline at end of file +var _0x6382=['changed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x46a5b4,_0x191e3e){var _0x4a356e=function(_0x34b4e6){while(--_0x34b4e6){_0x46a5b4['push'](_0x46a5b4['shift']());}};_0x4a356e(++_0x191e3e);}(_0x6382,0x116));var _0x2638=function(_0x3672bb,_0x1d2b24){_0x3672bb=_0x3672bb-0x0;var _0x46d02d=_0x6382[_0x3672bb];return _0x46d02d;};'use strict';var _=require('lodash');var util=require(_0x2638('0x0'));var logger=require('../../config/logger')(_0x2638('0x1'));var moment=require(_0x2638('0x2'));var BPromise=require(_0x2638('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2638('0x4'));module[_0x2638('0x5')]=function(_0x3eeb1d,_0x2a8d47){return _0x3eeb1d[_0x2638('0x6')](_0x2638('0x7'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dc8d3,_0x53267d,_0x5558dd){if(_0x1dc8d3[_0x2638('0x8')]('closed')){_0x1dc8d3['closedAt']=moment()[_0x2638('0x9')](_0x2638('0xa'));}_0x5558dd(null,_0x1dc8d3);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index d3a782a..18171f1 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 _0xa8e6=['client','redis','localhost','socket.io-emitter','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','attributes','limit','then','find','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0xa8e6,0x14c));var _0x6a8e=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0xa8e6[_0xfc0976];return _0x23579f;};'use strict';var _=require(_0x6a8e('0x0'));var util=require('util');var moment=require(_0x6a8e('0x1'));var BPromise=require('bluebird');var rs=require(_0x6a8e('0x2'));var fs=require('fs');var Redis=require(_0x6a8e('0x3'));var db=require(_0x6a8e('0x4'))['db'];var utils=require(_0x6a8e('0x5'));var logger=require(_0x6a8e('0x6'))(_0x6a8e('0x7'));var config=require(_0x6a8e('0x8'));var jayson=require(_0x6a8e('0x9'));var client=jayson[_0x6a8e('0xa')]['http']({'port':0x232a});config[_0x6a8e('0xb')]=_['defaults'](config[_0x6a8e('0xb')],{'host':_0x6a8e('0xc'),'port':0x18eb});var socket=require(_0x6a8e('0xd'))(new Redis(config[_0x6a8e('0xb')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3ce72b,_0x500dee,_0x62be35){return new BPromise(function(_0xaafbc7,_0x158888){return client[_0x6a8e('0xe')](_0x3ce72b,_0x62be35)['then'](function(_0x5db6a3){logger[_0x6a8e('0xf')](_0x6a8e('0x10'),_0x500dee,_0x6a8e('0x11'));logger[_0x6a8e('0x12')](_0x6a8e('0x13'),_0x500dee,'request\x20sent',JSON[_0x6a8e('0x14')](_0x5db6a3));if(_0x5db6a3[_0x6a8e('0x15')]){if(_0x5db6a3['error'][_0x6a8e('0x16')]===0x1f4){logger[_0x6a8e('0x15')](_0x6a8e('0x10'),_0x500dee,_0x5db6a3['error'][_0x6a8e('0x17')]);return _0x158888(_0x5db6a3[_0x6a8e('0x15')][_0x6a8e('0x17')]);}logger[_0x6a8e('0x15')](_0x6a8e('0x10'),_0x500dee,_0x5db6a3['error'][_0x6a8e('0x17')]);return _0xaafbc7(_0x5db6a3[_0x6a8e('0x15')][_0x6a8e('0x17')]);}else{logger[_0x6a8e('0xf')](_0x6a8e('0x10'),_0x500dee,_0x6a8e('0x11'));_0xaafbc7(_0x5db6a3['result'][_0x6a8e('0x17')]);}})[_0x6a8e('0x18')](function(_0x11e3ee){logger[_0x6a8e('0x15')](_0x6a8e('0x10'),_0x500dee,_0x11e3ee);_0x158888(_0x11e3ee);});});}exports[_0x6a8e('0x19')]=function(_0x4bbc13){var _0x3774a8=this;return new Promise(function(_0x47db5f,_0x58b091){return db[_0x6a8e('0x1a')]['update'](_0x4bbc13[_0x6a8e('0x1b')],{'raw':_0x4bbc13[_0x6a8e('0x1c')]?_0x4bbc13[_0x6a8e('0x1c')][_0x6a8e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bbc13[_0x6a8e('0x1c')]?_0x4bbc13[_0x6a8e('0x1c')]['where']||null:null,'attributes':_0x4bbc13[_0x6a8e('0x1c')]?_0x4bbc13[_0x6a8e('0x1c')][_0x6a8e('0x1e')]||null:null,'limit':_0x4bbc13['options']?_0x4bbc13[_0x6a8e('0x1c')][_0x6a8e('0x1f')]||null:null})[_0x6a8e('0x20')](function(_0x3f0939){logger[_0x6a8e('0xf')](_0x6a8e('0x19'),_0x4bbc13);logger[_0x6a8e('0x12')]('UpdateOpenchannelInteraction',_0x4bbc13,JSON[_0x6a8e('0x14')](_0x3f0939));_0x47db5f(_0x3f0939);})[_0x6a8e('0x18')](function(_0x5a1d73){logger[_0x6a8e('0x15')](_0x6a8e('0x19'),_0x5a1d73['message'],_0x4bbc13);_0x58b091(_0x3774a8[_0x6a8e('0x15')](0x1f4,_0x5a1d73['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x204518){return new Promise(function(_0x1fb709,_0x1ac8ca){return db[_0x6a8e('0x1a')][_0x6a8e('0x21')]({'where':_0x204518[_0x6a8e('0x1c')]?_0x204518[_0x6a8e('0x1c')]['where']||null:null})[_0x6a8e('0x20')](function(_0x2aa995){if(_0x2aa995){return _0x2aa995['addTags'](_0x204518[_0x6a8e('0x1b')][_0x6a8e('0x22')],_[_0x6a8e('0x23')](_0x204518['body'],['ids','id'])||{});}})[_0x6a8e('0x24')](function(_0x15e21d){logger[_0x6a8e('0xf')](_0x6a8e('0x25'),_0x204518);logger[_0x6a8e('0x12')](_0x6a8e('0x25'),_0x204518,JSON[_0x6a8e('0x14')](_0x15e21d));_0x1fb709(_0x15e21d);})[_0x6a8e('0x18')](function(_0xde4a73){logger[_0x6a8e('0x15')](_0x6a8e('0x25'),_0xde4a73['message'],_0x204518);_0x1ac8ca(_this['error'](0x1f4,_0xde4a73['message']));});});}; \ No newline at end of file +var _0x6d5b=['result','catch','update','body','options','raw','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','addTags','omit','AddTags','stringify','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x5edb51,_0x11dd47){var _0x1b10df=function(_0x167cf9){while(--_0x167cf9){_0x5edb51['push'](_0x5edb51['shift']());}};_0x1b10df(++_0x11dd47);}(_0x6d5b,0x1a1));var _0xb6d5=function(_0x49f118,_0x5138e4){_0x49f118=_0x49f118-0x0;var _0x3a0443=_0x6d5b[_0x49f118];return _0x3a0443;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb6d5('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6d5('0x1'));var db=require(_0xb6d5('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb6d5('0x3'))(_0xb6d5('0x4'));var config=require(_0xb6d5('0x5'));var jayson=require(_0xb6d5('0x6'));var client=jayson[_0xb6d5('0x7')][_0xb6d5('0x8')]({'port':0x232a});config[_0xb6d5('0x9')]=_[_0xb6d5('0xa')](config[_0xb6d5('0x9')],{'host':_0xb6d5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb6d5('0xc'))[_0xb6d5('0xd')](socket);function respondWithRpcPromise(_0x376a44,_0x48fe7f,_0x2391e7){return new BPromise(function(_0x483ef4,_0x152306){return client[_0xb6d5('0xe')](_0x376a44,_0x2391e7)[_0xb6d5('0xf')](function(_0x4437b8){logger[_0xb6d5('0x10')](_0xb6d5('0x11'),_0x48fe7f,_0xb6d5('0x12'));logger[_0xb6d5('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x48fe7f,_0xb6d5('0x12'),JSON['stringify'](_0x4437b8));if(_0x4437b8[_0xb6d5('0x14')]){if(_0x4437b8[_0xb6d5('0x14')][_0xb6d5('0x15')]===0x1f4){logger[_0xb6d5('0x14')](_0xb6d5('0x11'),_0x48fe7f,_0x4437b8[_0xb6d5('0x14')][_0xb6d5('0x16')]);return _0x152306(_0x4437b8[_0xb6d5('0x14')][_0xb6d5('0x16')]);}logger[_0xb6d5('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x48fe7f,_0x4437b8[_0xb6d5('0x14')][_0xb6d5('0x16')]);return _0x483ef4(_0x4437b8[_0xb6d5('0x14')]['message']);}else{logger['info'](_0xb6d5('0x11'),_0x48fe7f,'request\x20sent');_0x483ef4(_0x4437b8[_0xb6d5('0x17')]['message']);}})[_0xb6d5('0x18')](function(_0x167aba){logger[_0xb6d5('0x14')](_0xb6d5('0x11'),_0x48fe7f,_0x167aba);_0x152306(_0x167aba);});});}exports['UpdateOpenchannelInteraction']=function(_0x480bcb){var _0x391172=this;return new Promise(function(_0x53937b,_0x11baaf){return db['OpenchannelInteraction'][_0xb6d5('0x19')](_0x480bcb[_0xb6d5('0x1a')],{'raw':_0x480bcb[_0xb6d5('0x1b')]?_0x480bcb[_0xb6d5('0x1b')][_0xb6d5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480bcb[_0xb6d5('0x1b')]?_0x480bcb[_0xb6d5('0x1b')]['where']||null:null,'attributes':_0x480bcb[_0xb6d5('0x1b')]?_0x480bcb[_0xb6d5('0x1b')][_0xb6d5('0x1d')]||null:null,'limit':_0x480bcb[_0xb6d5('0x1b')]?_0x480bcb['options'][_0xb6d5('0x1e')]||null:null})[_0xb6d5('0xf')](function(_0x4e06c6){logger[_0xb6d5('0x10')](_0xb6d5('0x1f'),_0x480bcb);logger[_0xb6d5('0x13')](_0xb6d5('0x1f'),_0x480bcb,JSON['stringify'](_0x4e06c6));_0x53937b(_0x4e06c6);})[_0xb6d5('0x18')](function(_0x2b8d53){logger[_0xb6d5('0x14')](_0xb6d5('0x1f'),_0x2b8d53[_0xb6d5('0x16')],_0x480bcb);_0x11baaf(_0x391172[_0xb6d5('0x14')](0x1f4,_0x2b8d53[_0xb6d5('0x16')]));});});};exports[_0xb6d5('0x20')]=function(_0x496ecb){return new Promise(function(_0x3914d3,_0x3577b4){return db[_0xb6d5('0x21')][_0xb6d5('0x22')]({'where':_0x496ecb[_0xb6d5('0x1b')]?_0x496ecb[_0xb6d5('0x1b')][_0xb6d5('0x23')]||null:null})[_0xb6d5('0xf')](function(_0x17281b){if(_0x17281b){return _0x17281b[_0xb6d5('0x24')](_0x496ecb[_0xb6d5('0x1a')]['ids'],_[_0xb6d5('0x25')](_0x496ecb[_0xb6d5('0x1a')],['ids','id'])||{});}})['spread'](function(_0x4f28ca){logger['info'](_0xb6d5('0x26'),_0x496ecb);logger[_0xb6d5('0x13')](_0xb6d5('0x26'),_0x496ecb,JSON[_0xb6d5('0x27')](_0x4f28ca));_0x3914d3(_0x4f28ca);})[_0xb6d5('0x18')](function(_0x45a06e){logger[_0xb6d5('0x14')](_0xb6d5('0x26'),_0x45a06e[_0xb6d5('0x16')],_0x496ecb);_0x3577b4(_this[_0xb6d5('0x14')](0x1f4,_0x45a06e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index d68c108..f83282c 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 _0xf747=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','register'];(function(_0x5473c9,_0xcb5b77){var _0x2630ea=function(_0x42d5aa){while(--_0x42d5aa){_0x5473c9['push'](_0x5473c9['shift']());}};_0x2630ea(++_0xcb5b77);}(_0xf747,0x12e));var _0x7f74=function(_0x2de0ad,_0x53005f){_0x2de0ad=_0x2de0ad-0x0;var _0x53e110=_0xf747[_0x2de0ad];return _0x53e110;};'use strict';var OpenchannelInteractionEvents=require(_0x7f74('0x0'));var events=[_0x7f74('0x1'),_0x7f74('0x2'),_0x7f74('0x3')];function createListener(_0x4e57cc,_0xb11843){return function(_0x4df3d3){_0xb11843[_0x7f74('0x4')](_0x4e57cc,_0x4df3d3);};}function removeListener(_0x2160b6,_0x4d7b3c){return function(){OpenchannelInteractionEvents['removeListener'](_0x2160b6,_0x4d7b3c);};}exports[_0x7f74('0x5')]=function(_0x137a0b){for(var _0x442009=0x0,_0x33ce95=events['length'];_0x442009<_0x33ce95;_0x442009++){var _0x2f8a9f=events[_0x442009];var _0x5dfa42=createListener(_0x7f74('0x6')+_0x2f8a9f,_0x137a0b);OpenchannelInteractionEvents['on'](_0x2f8a9f,_0x5dfa42);}}; \ No newline at end of file +var _0x92b4=['length','openchannelInteraction:','./openchannelInteraction.events','remove','update','emit','removeListener','register'];(function(_0xbb0310,_0x240c6a){var _0x1e9b6e=function(_0x3c32fe){while(--_0x3c32fe){_0xbb0310['push'](_0xbb0310['shift']());}};_0x1e9b6e(++_0x240c6a);}(_0x92b4,0x92));var _0x492b=function(_0x3ad3ff,_0x2db04b){_0x3ad3ff=_0x3ad3ff-0x0;var _0x5eb8d0=_0x92b4[_0x3ad3ff];return _0x5eb8d0;};'use strict';var OpenchannelInteractionEvents=require(_0x492b('0x0'));var events=['save',_0x492b('0x1'),_0x492b('0x2')];function createListener(_0x5008fe,_0x4f0f37){return function(_0x5ac010){_0x4f0f37[_0x492b('0x3')](_0x5008fe,_0x5ac010);};}function removeListener(_0xda2505,_0x578d0e){return function(){OpenchannelInteractionEvents[_0x492b('0x4')](_0xda2505,_0x578d0e);};}exports[_0x492b('0x5')]=function(_0x438151){for(var _0x2420a5=0x0,_0x2388b7=events[_0x492b('0x6')];_0x2420a5<_0x2388b7;_0x2420a5++){var _0x2f7e22=events[_0x2420a5];var _0x162f26=createListener(_0x492b('0x7')+_0x2f7e22,_0x438151);OpenchannelInteractionEvents['on'](_0x2f7e22,_0x162f26);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 21e2771..3ec314b 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 _0x8812=['Router','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','show','tracked','openchannel','openchannelmessage:create','create','put','/:id','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x7774bc,_0x50e512){var _0x1a40c8=function(_0x370263){while(--_0x370263){_0x7774bc['push'](_0x7774bc['shift']());}};_0x1a40c8(++_0x50e512);}(_0x8812,0x181));var _0x2881=function(_0x236880,_0x2aab32){_0x236880=_0x236880-0x0;var _0x1a275c=_0x8812[_0x236880];return _0x1a275c;};'use strict';var multer=require(_0x2881('0x0'));var util=require(_0x2881('0x1'));var path=require(_0x2881('0x2'));var timeout=require(_0x2881('0x3'));var express=require(_0x2881('0x4'));var router=express[_0x2881('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2881('0x6'));var config=require('../../config/environment');var controller=require(_0x2881('0x7'));router['get']('/',auth[_0x2881('0x8')](),controller[_0x2881('0x9')]);router[_0x2881('0xa')](_0x2881('0xb'),auth[_0x2881('0x8')](),controller[_0x2881('0xc')]);router[_0x2881('0xa')]('/:id',auth[_0x2881('0x8')](),controller[_0x2881('0xd')]);router['post']('/',auth[_0x2881('0x8')](),interaction[_0x2881('0xe')](_0x2881('0xf'),_0x2881('0x10')),controller[_0x2881('0x11')]);router[_0x2881('0x12')](_0x2881('0x13'),auth[_0x2881('0x8')](),controller['update']);router[_0x2881('0x12')](_0x2881('0x14'),auth[_0x2881('0x8')](),controller[_0x2881('0x15')]);router[_0x2881('0x12')](_0x2881('0x16'),auth['isAuthenticated'](),controller[_0x2881('0x17')]);router['delete'](_0x2881('0x13'),auth[_0x2881('0x8')](),controller[_0x2881('0x18')]);module[_0x2881('0x19')]=router; \ No newline at end of file +var _0xda82=['post','tracked','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','/describe','describe','get','/:id','show'];(function(_0x358372,_0x5336fe){var _0x2e3eb3=function(_0x23ca11){while(--_0x23ca11){_0x358372['push'](_0x358372['shift']());}};_0x2e3eb3(++_0x5336fe);}(_0xda82,0xdb));var _0x2da8=function(_0x33e00b,_0x1b4863){_0x33e00b=_0x33e00b-0x0;var _0x393021=_0xda82[_0x33e00b];return _0x393021;};'use strict';var multer=require(_0x2da8('0x0'));var util=require(_0x2da8('0x1'));var path=require('path');var timeout=require(_0x2da8('0x2'));var express=require(_0x2da8('0x3'));var router=express[_0x2da8('0x4')]();var auth=require(_0x2da8('0x5'));var interaction=require(_0x2da8('0x6'));var config=require(_0x2da8('0x7'));var controller=require(_0x2da8('0x8'));router['get']('/',auth[_0x2da8('0x9')](),controller['index']);router['get'](_0x2da8('0xa'),auth[_0x2da8('0x9')](),controller[_0x2da8('0xb')]);router[_0x2da8('0xc')](_0x2da8('0xd'),auth[_0x2da8('0x9')](),controller[_0x2da8('0xe')]);router[_0x2da8('0xf')]('/',auth['isAuthenticated'](),interaction[_0x2da8('0x10')]('openchannel','openchannelmessage:create'),controller[_0x2da8('0x11')]);router['put'](_0x2da8('0xd'),auth['isAuthenticated'](),controller[_0x2da8('0x12')]);router[_0x2da8('0x13')](_0x2da8('0x14'),auth[_0x2da8('0x9')](),controller[_0x2da8('0x15')]);router[_0x2da8('0x13')](_0x2da8('0x16'),auth[_0x2da8('0x9')](),controller[_0x2da8('0x17')]);router[_0x2da8('0x18')](_0x2da8('0xd'),auth[_0x2da8('0x9')](),controller[_0x2da8('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index e5faa74..26ca3d4 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 _0xf28c=['BOOLEAN','ENUM','out','sequelize','TEXT','medium'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0xf28c,0x183));var _0xcf28=function(_0x4e730d,_0x5dde25){_0x4e730d=_0x4e730d-0x0;var _0x3b6097=_0xf28c[_0x4e730d];return _0x3b6097;};'use strict';var Sequelize=require(_0xcf28('0x0'));module['exports']={'body':{'type':Sequelize[_0xcf28('0x1')](_0xcf28('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcf28('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xcf28('0x4')]('in',_0xcf28('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x9f13=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x9f13,0x1e9));var _0x39f1=function(_0x55cf47,_0x3d037b){_0x55cf47=_0x55cf47-0x0;var _0x42bf2b=_0x9f13[_0x55cf47];return _0x42bf2b;};'use strict';var Sequelize=require(_0x39f1('0x0'));module['exports']={'body':{'type':Sequelize[_0x39f1('0x1')](_0x39f1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x39f1('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x39f1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x39f1('0x4')]('in',_0x39f1('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x39f1('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 9c92936..f854342 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 _0x5163=['readAt','UserId','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','user','stringify','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','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','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','error','code','message','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','findAll','rows','show','params','find','create','body','update','describe','openchannel-interactions','accept','openchannel'];(function(_0x567f0e,_0x2be7a0){var _0x15aca8=function(_0x1e6ca6){while(--_0x1e6ca6){_0x567f0e['push'](_0x567f0e['shift']());}};_0x15aca8(++_0x2be7a0);}(_0x5163,0x96));var _0x3516=function(_0x7de0cb,_0x4dee18){_0x7de0cb=_0x7de0cb-0x0;var _0x271be6=_0x5163[_0x7de0cb];return _0x271be6;};'use strict';var pdf=require(_0x3516('0x0'));var emlformat=require(_0x3516('0x1'));var rimraf=require(_0x3516('0x2'));var zipdir=require(_0x3516('0x3'));var jsonpatch=require(_0x3516('0x4'));var rp=require(_0x3516('0x5'));var moment=require(_0x3516('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3516('0x7'));var util=require('util');var path=require(_0x3516('0x8'));var sox=require(_0x3516('0x9'));var csv=require(_0x3516('0xa'));var ejs=require(_0x3516('0xb'));var fs=require('fs');var _=require(_0x3516('0xc'));var squel=require(_0x3516('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3516('0xe'));var toCsv=require(_0x3516('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3516('0xf'));var authService=require(_0x3516('0x10'));var qs=require(_0x3516('0x11'));var as=require(_0x3516('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3516('0x13'))('api');var utils=require(_0x3516('0x14'));var config=require(_0x3516('0x15'));var db=require(_0x3516('0x16'))['db'];config['redis']=_[_0x3516('0x17')](config[_0x3516('0x18')],{'host':_0x3516('0x19'),'port':0x18eb});var socket=require(_0x3516('0x1a'))(new Redis(config[_0x3516('0x18')]));require('./openchannelMessage.socket')[_0x3516('0x1b')](socket);var jayson=require(_0x3516('0x1c'));var client=jayson[_0x3516('0x1d')][_0x3516('0x1e')]({'port':0x232c});var client9002=jayson[_0x3516('0x1d')][_0x3516('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x439e31,_0x4f4f5f,_0x411ecd){if(_0x411ecd){var _0x4b6a5f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b6a5f[_0x3516('0x1f')](_0x4f4f5f)){return _0x439e31;}else{throw new db['Sequelize'][(_0x3516('0x20'))](_0x3516('0x21'));}}else{return _0x439e31;}}function respondWithRpcPromise(_0x31b62b,_0x2329a8,_0x5782b3,_0x229df2){return new BPromise(function(_0x4ec30d,_0x26e0a7){var _0x656f01=_0x229df2||client;return _0x656f01[_0x3516('0x22')](_0x31b62b,_0x5782b3)[_0x3516('0x23')](function(_0xfda7ad){logger[_0x3516('0x24')](_0x3516('0x25'),_0x2329a8,_0x3516('0x26'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2329a8,_0x3516('0x26'),JSON['stringify'](_0xfda7ad));if(_0xfda7ad[_0x3516('0x27')]){if(_0xfda7ad['error'][_0x3516('0x28')]===0x1f4){logger['error'](_0x3516('0x25'),_0x2329a8,_0xfda7ad[_0x3516('0x27')][_0x3516('0x29')]);return _0x26e0a7(_0xfda7ad['error']['message']);}logger[_0x3516('0x27')](_0x3516('0x25'),_0x2329a8,_0xfda7ad[_0x3516('0x27')][_0x3516('0x29')]);return _0x4ec30d(_0xfda7ad['error'][_0x3516('0x29')]);}else{logger[_0x3516('0x24')](_0x3516('0x25'),_0x2329a8,'request\x20sent');_0x4ec30d(_0xfda7ad['result'][_0x3516('0x29')]);}})[_0x3516('0x2a')](function(_0x2a4e52){logger[_0x3516('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x2329a8,_0x2a4e52);_0x26e0a7(_0x2a4e52);});});}function respondWithStatusCode(_0x2babcb,_0x73eb7a){_0x73eb7a=_0x73eb7a||0xcc;return function(_0x5843af){if(_0x5843af){return _0x2babcb['sendStatus'](_0x73eb7a);}return _0x2babcb[_0x3516('0x2b')](_0x73eb7a)[_0x3516('0x2c')]();};}function respondWithResult(_0x2fa495,_0x1feca5){_0x1feca5=_0x1feca5||0xc8;return function(_0x3436b5){if(_0x3436b5){return _0x2fa495['status'](_0x1feca5)[_0x3516('0x2d')](_0x3436b5);}};}function respondWithFilteredResult(_0x2d2cf6,_0x5e1b42){return function(_0x52bcd9){if(_0x52bcd9){var _0x58c681=_0x52bcd9[_0x3516('0x2e')],_0x268467=_0x5e1b42[_0x3516('0x2f')],_0x52d96a=_0x5e1b42[_0x3516('0x2f')]+_0x5e1b42['limit'],_0x13f2a0;if(_0x52d96a>=_0x58c681){_0x52d96a=_0x58c681;_0x13f2a0=0xc8;}else{_0x13f2a0=0xce;}_0x2d2cf6[_0x3516('0x2b')](_0x13f2a0);return _0x2d2cf6[_0x3516('0x30')](_0x3516('0x31'),_0x268467+'-'+_0x52d96a+'/'+_0x58c681)[_0x3516('0x2d')](_0x52bcd9);}return null;};}function patchUpdates(_0x25c60d){return function(_0x40d0aa){try{jsonpatch[_0x3516('0x32')](_0x40d0aa,_0x25c60d,!![]);}catch(_0x59e9a0){return BPromise[_0x3516('0x33')](_0x59e9a0);}return _0x40d0aa[_0x3516('0x34')]();};}function saveUpdates(_0x54d21e,_0x3ea27e){return function(_0x217d4a){if(_0x217d4a){return _0x217d4a['update'](_0x54d21e)[_0x3516('0x23')](function(_0x56984f){return _0x56984f;});}return null;};}function removeEntity(_0x595e99,_0x2c49ed){return function(_0x5a3667){if(_0x5a3667){return _0x5a3667[_0x3516('0x35')]()[_0x3516('0x23')](function(){_0x595e99[_0x3516('0x2b')](0xcc)[_0x3516('0x2c')]();});}};}function handleEntityNotFound(_0x452ef1,_0x2482db){return function(_0x48b2aa){if(!_0x48b2aa){_0x452ef1[_0x3516('0x36')](0x194);}return _0x48b2aa;};}function handleError(_0x1abbba,_0x10f24c){_0x10f24c=_0x10f24c||0x1f4;return function(_0x45f88d){logger[_0x3516('0x27')](_0x45f88d[_0x3516('0x37')]);if(_0x45f88d['name']){delete _0x45f88d[_0x3516('0x38')];}_0x1abbba[_0x3516('0x2b')](_0x10f24c)[_0x3516('0x39')](_0x45f88d);};}exports[_0x3516('0x3a')]=function(_0x39e454,_0x2f796b){var _0x529bcc={},_0x4f486b={},_0x341f81={'count':0x0,'rows':[]};var _0x2a14e6=_[_0x3516('0x3b')](db['OpenchannelMessage'][_0x3516('0x3c')],function(_0x41a240){return{'name':_0x41a240['fieldName'],'type':_0x41a240[_0x3516('0x3d')][_0x3516('0x3e')]};});_0x4f486b['model']=_['map'](_0x2a14e6,_0x3516('0x38'));_0x4f486b['query']=_[_0x3516('0x3f')](_0x39e454[_0x3516('0x40')]);_0x4f486b[_0x3516('0x41')]=_[_0x3516('0x42')](_0x4f486b['model'],_0x4f486b['query']);_0x529bcc[_0x3516('0x43')]=_[_0x3516('0x42')](_0x4f486b[_0x3516('0x44')],qs[_0x3516('0x45')](_0x39e454[_0x3516('0x40')][_0x3516('0x45')]));_0x529bcc['attributes']=_0x529bcc[_0x3516('0x43')][_0x3516('0x46')]?_0x529bcc[_0x3516('0x43')]:_0x4f486b[_0x3516('0x44')];if(!_0x39e454[_0x3516('0x40')][_0x3516('0x47')](_0x3516('0x48'))){_0x529bcc[_0x3516('0x49')]=qs[_0x3516('0x49')](_0x39e454[_0x3516('0x40')][_0x3516('0x49')]);_0x529bcc[_0x3516('0x2f')]=qs[_0x3516('0x2f')](_0x39e454[_0x3516('0x40')]['offset']);}_0x529bcc['order']=qs['sort'](_0x39e454[_0x3516('0x40')][_0x3516('0x4a')]);_0x529bcc[_0x3516('0x4b')]=qs['filters'](_[_0x3516('0x4c')](_0x39e454[_0x3516('0x40')],_0x4f486b[_0x3516('0x41')]),_0x2a14e6);if(_0x39e454[_0x3516('0x40')][_0x3516('0x4d')]){_0x529bcc[_0x3516('0x4b')]=_[_0x3516('0x4e')](_0x529bcc[_0x3516('0x4b')],{'$or':_['map'](_0x2a14e6,function(_0x391b3a){if(_0x391b3a[_0x3516('0x3d')]!==_0x3516('0x4f')){var _0x3d5a64={};_0x3d5a64[_0x391b3a[_0x3516('0x38')]]={'$like':'%'+_0x39e454['query'][_0x3516('0x4d')]+'%'};return _0x3d5a64;}})});}_0x529bcc=_[_0x3516('0x4e')]({},_0x529bcc,_0x39e454[_0x3516('0x50')]);var _0x4ce815={'where':_0x529bcc[_0x3516('0x4b')]};return db[_0x3516('0x51')][_0x3516('0x2e')](_0x4ce815)[_0x3516('0x23')](function(_0x410733){_0x341f81[_0x3516('0x2e')]=_0x410733;if(_0x39e454[_0x3516('0x40')][_0x3516('0x52')]){_0x529bcc[_0x3516('0x53')]=[{'all':!![]}];}return db[_0x3516('0x51')][_0x3516('0x54')](_0x529bcc);})[_0x3516('0x23')](function(_0x1765d1){_0x341f81[_0x3516('0x55')]=_0x1765d1;return _0x341f81;})[_0x3516('0x23')](respondWithFilteredResult(_0x2f796b,_0x529bcc))[_0x3516('0x2a')](handleError(_0x2f796b,null));};exports[_0x3516('0x56')]=function(_0x20a209,_0x5a78ad){var _0x26d566={'raw':!![],'where':{'id':_0x20a209[_0x3516('0x57')]['id']}},_0x53dd12={};_0x53dd12[_0x3516('0x44')]=_[_0x3516('0x3f')](db[_0x3516('0x51')][_0x3516('0x3c')]);_0x53dd12[_0x3516('0x40')]=_[_0x3516('0x3f')](_0x20a209[_0x3516('0x40')]);_0x53dd12[_0x3516('0x41')]=_[_0x3516('0x42')](_0x53dd12[_0x3516('0x44')],_0x53dd12['query']);_0x26d566['attributes']=_[_0x3516('0x42')](_0x53dd12['model'],qs[_0x3516('0x45')](_0x20a209[_0x3516('0x40')][_0x3516('0x45')]));_0x26d566[_0x3516('0x43')]=_0x26d566[_0x3516('0x43')][_0x3516('0x46')]?_0x26d566[_0x3516('0x43')]:_0x53dd12['model'];if(_0x20a209[_0x3516('0x40')][_0x3516('0x52')]){_0x26d566[_0x3516('0x53')]=[{'all':!![]}];}_0x26d566=_[_0x3516('0x4e')]({},_0x26d566,_0x20a209[_0x3516('0x50')]);return db[_0x3516('0x51')][_0x3516('0x58')](_0x26d566)[_0x3516('0x23')](handleEntityNotFound(_0x5a78ad,null))[_0x3516('0x23')](respondWithResult(_0x5a78ad,null))[_0x3516('0x2a')](handleError(_0x5a78ad,null));};exports[_0x3516('0x59')]=function(_0x287a07,_0x15a6e5){return db[_0x3516('0x51')][_0x3516('0x59')](_0x287a07[_0x3516('0x5a')],{})[_0x3516('0x23')](respondWithResult(_0x15a6e5,0xc9))[_0x3516('0x2a')](handleError(_0x15a6e5,null));};exports[_0x3516('0x5b')]=function(_0x237c94,_0x53be30){if(_0x237c94['body']['id']){delete _0x237c94[_0x3516('0x5a')]['id'];}return db[_0x3516('0x51')]['find']({'where':{'id':_0x237c94[_0x3516('0x57')]['id']}})['then'](handleEntityNotFound(_0x53be30,null))[_0x3516('0x23')](saveUpdates(_0x237c94[_0x3516('0x5a')],null))['then'](respondWithResult(_0x53be30,null))[_0x3516('0x2a')](handleError(_0x53be30,null));};exports[_0x3516('0x35')]=function(_0x44fdc8,_0x1f6fbf){return db['OpenchannelMessage']['find']({'where':{'id':_0x44fdc8[_0x3516('0x57')]['id']}})['then'](handleEntityNotFound(_0x1f6fbf,null))['then'](removeEntity(_0x1f6fbf,null))[_0x3516('0x2a')](handleError(_0x1f6fbf,null));};exports[_0x3516('0x5c')]=function(_0x7e7ac5,_0x33d3ca){return db[_0x3516('0x51')][_0x3516('0x5c')]()[_0x3516('0x23')](respondWithResult(_0x33d3ca,null))['catch'](handleError(_0x33d3ca,null));};var interaction_log=require('../../config/logger')(_0x3516('0x5d'));exports[_0x3516('0x5e')]=function(_0x188803,_0x3d8c20,_0x3b610e){var _0x1f5449={'channel':_0x3516('0x5f')};if(_0x188803[_0x3516('0x5a')]['id']){delete _0x188803['body']['id'];}_0x188803['body']['read']=!![];_0x188803[_0x3516('0x5a')][_0x3516('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x188803[_0x3516('0x5a')][_0x3516('0x61')]=_0x188803[_0x3516('0x5a')][_0x3516('0x61')]||_0x188803['user']['id'];return db[_0x3516('0x51')][_0x3516('0x58')]({'where':{'id':_0x188803[_0x3516('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x3516('0x62')],'as':'Contact'}]})[_0x3516('0x23')](handleEntityNotFound(_0x3d8c20,null))[_0x3516('0x23')](saveUpdates(_0x188803[_0x3516('0x5a')],null))[_0x3516('0x23')](function(_0x1a0456){if(_0x1a0456){_0x1f5449[_0x3516('0x29')]=_0x1a0456[_0x3516('0x63')]({'plain':!![]});return db[_0x3516('0x64')][_0x3516('0x58')]({'where':{'id':_0x1a0456[_0x3516('0x65')]}});}return null;})[_0x3516('0x23')](handleEntityNotFound(_0x3d8c20,null))[_0x3516('0x23')](function(_0x16a4f4){if(_0x16a4f4){return _0x16a4f4[_0x3516('0x5b')]({'UserId':_0x188803['body']['UserId'],'read1stAt':_[_0x3516('0x66')](_0x16a4f4[_0x3516('0x67')])?moment()[_0x3516('0x68')](_0x3516('0x69')):undefined});}return null;})[_0x3516('0x23')](function(_0x7c217e){if(_0x7c217e){_0x1f5449[_0x3516('0x6a')]=_0x7c217e['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x188803[_0x3516('0x6b')]['id'],_0x188803[_0x3516('0x6b')]['name'],_0x188803['user']['role'],_0x1f5449[_0x3516('0x6a')]['id'],_0x188803[_0x3516('0x5a')]?JSON[_0x3516('0x6c')](_0x188803[_0x3516('0x5a')]):_0x3516('0x6d'));return respondWithRpcPromise(_0x3516('0x6e'),_0x3516('0x6f'),_0x1f5449);}return null;})[_0x3516('0x23')](function(_0x9eb212){if(_0x9eb212){if(_0x188803['body'][_0x3516('0x70')]){_0x1f5449[_0x3516('0x29')][_0x3516('0x71')]=util['format']('SIP/%s',_0x188803['user'][_0x3516('0x38')]);_0x1f5449[_0x3516('0x29')][_0x3516('0x72')]=_0x1f5449[_0x3516('0x72')];_0x1f5449[_0x3516('0x29')][_0x3516('0x73')]=_0x3516('0x5e');return respondWithRpcPromise(_0x3516('0x74'),_0x3516('0x74'),{'event':_0x3516('0x75'),'message':_0x1f5449[_0x3516('0x29')]},client9002)[_0x3516('0x23')](function(){return _0x1f5449;});}return _0x1f5449;}return null;})[_0x3516('0x23')](respondWithResult(_0x3d8c20,null))[_0x3516('0x2a')](handleError(_0x3d8c20,null));};var interaction_log=require(_0x3516('0x13'))(_0x3516('0x5d'));exports[_0x3516('0x33')]=function(_0x1363a8,_0x255dfb,_0x33750a){var _0x5c0883={'agent':{},'channel':_0x3516('0x5f')};if(_0x1363a8['body']['id']){delete _0x1363a8[_0x3516('0x5a')]['id'];}_0x1363a8[_0x3516('0x5a')][_0x3516('0x61')]=_0x1363a8['body']['UserId']||_0x1363a8[_0x3516('0x6b')]['id'];_0x5c0883['agent']['id']=_0x1363a8[_0x3516('0x5a')][_0x3516('0x61')];return db[_0x3516('0x51')]['find']({'where':{'id':_0x1363a8[_0x3516('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x255dfb,null))[_0x3516('0x23')](function(_0x123df7){if(_0x123df7){_0x5c0883['message']=_0x123df7[_0x3516('0x63')]({'plain':!![]});return db[_0x3516('0x64')][_0x3516('0x58')]({'where':{'id':_0x123df7[_0x3516('0x65')]}});}return null;})[_0x3516('0x23')](handleEntityNotFound(_0x255dfb,null))[_0x3516('0x23')](function(_0x48fc31){if(_0x48fc31){_0x5c0883['interaction']=_0x48fc31['get']({'plain':!![]});interaction_log[_0x3516('0x24')](_0x3516('0x76'),_0x1363a8[_0x3516('0x6b')]['id'],_0x1363a8['user']['name'],_0x1363a8['user'][_0x3516('0x77')],_0x5c0883['interaction']['id'],_0x1363a8['body']?JSON[_0x3516('0x6c')](_0x1363a8[_0x3516('0x5a')]):_0x3516('0x6d'));return respondWithRpcPromise('RejectMessage',_0x3516('0x78'),_0x5c0883);}return null;})[_0x3516('0x23')](function(_0x46de35){if(_0x46de35){_0x46de35[_0x3516('0x29')][_0x3516('0x71')]=util[_0x3516('0x68')](_0x3516('0x79'),_0x1363a8[_0x3516('0x6b')][_0x3516('0x38')]);_0x46de35[_0x3516('0x29')][_0x3516('0x72')]=_0x5c0883[_0x3516('0x72')];_0x46de35[_0x3516('0x29')][_0x3516('0x73')]='reject';respondWithRpcPromise('EventManager',_0x3516('0x74'),{'event':_0x3516('0x7a'),'message':_0x46de35[_0x3516('0x29')]},client9002);return _0x5c0883;}return null;})[_0x3516('0x23')](respondWithResult(_0x255dfb,null))[_0x3516('0x2a')](handleError(_0x255dfb,null));}; \ No newline at end of file +var _0x6a6a=['result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','send','index','OpenchannelMessage','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','describe','openchannel-interactions','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','params','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','agent','null','RejectMessage','rejectMessage','reject','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x1233d1,_0x15cf04){var _0x56ee5e=function(_0x470ed9){while(--_0x470ed9){_0x1233d1['push'](_0x1233d1['shift']());}};_0x56ee5e(++_0x15cf04);}(_0x6a6a,0xcb));var _0xa6a6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6a6a[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xa6a6('0x0'));var emlformat=require(_0xa6a6('0x1'));var rimraf=require(_0xa6a6('0x2'));var zipdir=require(_0xa6a6('0x3'));var jsonpatch=require(_0xa6a6('0x4'));var rp=require(_0xa6a6('0x5'));var moment=require(_0xa6a6('0x6'));var BPromise=require(_0xa6a6('0x7'));var Mustache=require(_0xa6a6('0x8'));var util=require(_0xa6a6('0x9'));var path=require('path');var sox=require(_0xa6a6('0xa'));var csv=require(_0xa6a6('0xb'));var ejs=require(_0xa6a6('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa6a6('0xd'));var crypto=require(_0xa6a6('0xe'));var jsforce=require(_0xa6a6('0xf'));var deskjs=require(_0xa6a6('0x10'));var toCsv=require(_0xa6a6('0xb'));var querystring=require(_0xa6a6('0x11'));var Papa=require(_0xa6a6('0x12'));var Redis=require(_0xa6a6('0x13'));var authService=require(_0xa6a6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa6a6('0x15'));var hardwareService=require(_0xa6a6('0x16'));var logger=require(_0xa6a6('0x17'))(_0xa6a6('0x18'));var utils=require(_0xa6a6('0x19'));var config=require(_0xa6a6('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa6a6('0x1b')](config['redis'],{'host':_0xa6a6('0x1c'),'port':0x18eb});var socket=require(_0xa6a6('0x1d'))(new Redis(config[_0xa6a6('0x1e')]));require(_0xa6a6('0x1f'))[_0xa6a6('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa6a6('0x21')][_0xa6a6('0x22')]({'port':0x232c});var client9002=jayson[_0xa6a6('0x21')][_0xa6a6('0x22')]({'port':0x232a});function checkPasswordPattern(_0x232560,_0x27d6bc,_0x3d87c8){if(_0x3d87c8){var _0x3e4ae5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e4ae5[_0xa6a6('0x23')](_0x27d6bc)){return _0x232560;}else{throw new db[(_0xa6a6('0x24'))][(_0xa6a6('0x25'))](_0xa6a6('0x26'));}}else{return _0x232560;}}function respondWithRpcPromise(_0x174ba1,_0x2dc4f1,_0x378aa4,_0x5a343f){return new BPromise(function(_0x32f02c,_0x1f94da){var _0x44f0bb=_0x5a343f||client;return _0x44f0bb[_0xa6a6('0x27')](_0x174ba1,_0x378aa4)[_0xa6a6('0x28')](function(_0x2f0de2){logger[_0xa6a6('0x29')](_0xa6a6('0x2a'),_0x2dc4f1,'request\x20sent');logger[_0xa6a6('0x2b')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2dc4f1,_0xa6a6('0x2c'),JSON[_0xa6a6('0x2d')](_0x2f0de2));if(_0x2f0de2[_0xa6a6('0x2e')]){if(_0x2f0de2[_0xa6a6('0x2e')][_0xa6a6('0x2f')]===0x1f4){logger[_0xa6a6('0x2e')](_0xa6a6('0x2a'),_0x2dc4f1,_0x2f0de2['error'][_0xa6a6('0x30')]);return _0x1f94da(_0x2f0de2['error']['message']);}logger[_0xa6a6('0x2e')](_0xa6a6('0x2a'),_0x2dc4f1,_0x2f0de2['error']['message']);return _0x32f02c(_0x2f0de2[_0xa6a6('0x2e')][_0xa6a6('0x30')]);}else{logger[_0xa6a6('0x29')](_0xa6a6('0x2a'),_0x2dc4f1,_0xa6a6('0x2c'));_0x32f02c(_0x2f0de2[_0xa6a6('0x31')][_0xa6a6('0x30')]);}})['catch'](function(_0x5a6eb5){logger[_0xa6a6('0x2e')](_0xa6a6('0x2a'),_0x2dc4f1,_0x5a6eb5);_0x1f94da(_0x5a6eb5);});});}function respondWithStatusCode(_0xced51,_0x490ca1){_0x490ca1=_0x490ca1||0xcc;return function(_0x400f76){if(_0x400f76){return _0xced51[_0xa6a6('0x32')](_0x490ca1);}return _0xced51[_0xa6a6('0x33')](_0x490ca1)[_0xa6a6('0x34')]();};}function respondWithResult(_0x56877d,_0x22061a){_0x22061a=_0x22061a||0xc8;return function(_0x56b7f3){if(_0x56b7f3){return _0x56877d[_0xa6a6('0x33')](_0x22061a)[_0xa6a6('0x35')](_0x56b7f3);}};}function respondWithFilteredResult(_0x26715b,_0x42128b){return function(_0x2c3b9f){if(_0x2c3b9f){var _0x31f264=_0x2c3b9f[_0xa6a6('0x36')],_0x338750=_0x42128b[_0xa6a6('0x37')],_0x521f57=_0x42128b['offset']+_0x42128b[_0xa6a6('0x38')],_0x3e0131;if(_0x521f57>=_0x31f264){_0x521f57=_0x31f264;_0x3e0131=0xc8;}else{_0x3e0131=0xce;}_0x26715b[_0xa6a6('0x33')](_0x3e0131);return _0x26715b[_0xa6a6('0x39')](_0xa6a6('0x3a'),_0x338750+'-'+_0x521f57+'/'+_0x31f264)[_0xa6a6('0x35')](_0x2c3b9f);}return null;};}function patchUpdates(_0x5515be){return function(_0x448066){try{jsonpatch[_0xa6a6('0x3b')](_0x448066,_0x5515be,!![]);}catch(_0x18a709){return BPromise['reject'](_0x18a709);}return _0x448066['save']();};}function saveUpdates(_0x33b8d3,_0x49cac4){return function(_0x17061c){if(_0x17061c){return _0x17061c[_0xa6a6('0x3c')](_0x33b8d3)[_0xa6a6('0x28')](function(_0x5f1713){return _0x5f1713;});}return null;};}function removeEntity(_0x37e9a9,_0x302691){return function(_0x283478){if(_0x283478){return _0x283478['destroy']()[_0xa6a6('0x28')](function(){_0x37e9a9[_0xa6a6('0x33')](0xcc)[_0xa6a6('0x34')]();});}};}function handleEntityNotFound(_0x2314be,_0x1ee38b){return function(_0x13ce91){if(!_0x13ce91){_0x2314be['sendStatus'](0x194);}return _0x13ce91;};}function handleError(_0x1c0a18,_0x4677be){_0x4677be=_0x4677be||0x1f4;return function(_0x2dbd68){logger[_0xa6a6('0x2e')](_0x2dbd68['stack']);if(_0x2dbd68['name']){delete _0x2dbd68['name'];}_0x1c0a18[_0xa6a6('0x33')](_0x4677be)[_0xa6a6('0x3d')](_0x2dbd68);};}exports[_0xa6a6('0x3e')]=function(_0x57a980,_0x482c11){var _0x44ed76={},_0x1be0d7={},_0xa181c={'count':0x0,'rows':[]};var _0x5b5295=_['map'](db[_0xa6a6('0x3f')][_0xa6a6('0x40')],function(_0x4213f9){return{'name':_0x4213f9[_0xa6a6('0x41')],'type':_0x4213f9['type']['key']};});_0x1be0d7[_0xa6a6('0x42')]=_['map'](_0x5b5295,_0xa6a6('0x43'));_0x1be0d7[_0xa6a6('0x44')]=_[_0xa6a6('0x45')](_0x57a980[_0xa6a6('0x44')]);_0x1be0d7[_0xa6a6('0x46')]=_[_0xa6a6('0x47')](_0x1be0d7['model'],_0x1be0d7['query']);_0x44ed76[_0xa6a6('0x48')]=_[_0xa6a6('0x47')](_0x1be0d7[_0xa6a6('0x42')],qs[_0xa6a6('0x49')](_0x57a980[_0xa6a6('0x44')][_0xa6a6('0x49')]));_0x44ed76[_0xa6a6('0x48')]=_0x44ed76[_0xa6a6('0x48')][_0xa6a6('0x4a')]?_0x44ed76[_0xa6a6('0x48')]:_0x1be0d7[_0xa6a6('0x42')];if(!_0x57a980[_0xa6a6('0x44')][_0xa6a6('0x4b')](_0xa6a6('0x4c'))){_0x44ed76[_0xa6a6('0x38')]=qs['limit'](_0x57a980[_0xa6a6('0x44')][_0xa6a6('0x38')]);_0x44ed76[_0xa6a6('0x37')]=qs[_0xa6a6('0x37')](_0x57a980[_0xa6a6('0x44')][_0xa6a6('0x37')]);}_0x44ed76[_0xa6a6('0x4d')]=qs[_0xa6a6('0x4e')](_0x57a980['query'][_0xa6a6('0x4e')]);_0x44ed76[_0xa6a6('0x4f')]=qs[_0xa6a6('0x46')](_[_0xa6a6('0x50')](_0x57a980[_0xa6a6('0x44')],_0x1be0d7[_0xa6a6('0x46')]),_0x5b5295);if(_0x57a980[_0xa6a6('0x44')][_0xa6a6('0x51')]){_0x44ed76[_0xa6a6('0x4f')]=_[_0xa6a6('0x52')](_0x44ed76[_0xa6a6('0x4f')],{'$or':_['map'](_0x5b5295,function(_0x5f2833){if(_0x5f2833[_0xa6a6('0x53')]!==_0xa6a6('0x54')){var _0x3a1200={};_0x3a1200[_0x5f2833[_0xa6a6('0x43')]]={'$like':'%'+_0x57a980[_0xa6a6('0x44')][_0xa6a6('0x51')]+'%'};return _0x3a1200;}})});}_0x44ed76=_[_0xa6a6('0x52')]({},_0x44ed76,_0x57a980[_0xa6a6('0x55')]);var _0x2afd72={'where':_0x44ed76[_0xa6a6('0x4f')]};return db[_0xa6a6('0x3f')]['count'](_0x2afd72)[_0xa6a6('0x28')](function(_0x4dae20){_0xa181c['count']=_0x4dae20;if(_0x57a980['query'][_0xa6a6('0x56')]){_0x44ed76[_0xa6a6('0x57')]=[{'all':!![]}];}return db[_0xa6a6('0x3f')][_0xa6a6('0x58')](_0x44ed76);})[_0xa6a6('0x28')](function(_0x4ff85f){_0xa181c[_0xa6a6('0x59')]=_0x4ff85f;return _0xa181c;})[_0xa6a6('0x28')](respondWithFilteredResult(_0x482c11,_0x44ed76))['catch'](handleError(_0x482c11,null));};exports[_0xa6a6('0x5a')]=function(_0xce2b85,_0x5cd72d){var _0x560410={'raw':!![],'where':{'id':_0xce2b85['params']['id']}},_0x3dae4c={};_0x3dae4c[_0xa6a6('0x42')]=_[_0xa6a6('0x45')](db['OpenchannelMessage']['rawAttributes']);_0x3dae4c[_0xa6a6('0x44')]=_[_0xa6a6('0x45')](_0xce2b85[_0xa6a6('0x44')]);_0x3dae4c[_0xa6a6('0x46')]=_[_0xa6a6('0x47')](_0x3dae4c[_0xa6a6('0x42')],_0x3dae4c[_0xa6a6('0x44')]);_0x560410['attributes']=_[_0xa6a6('0x47')](_0x3dae4c[_0xa6a6('0x42')],qs[_0xa6a6('0x49')](_0xce2b85[_0xa6a6('0x44')][_0xa6a6('0x49')]));_0x560410[_0xa6a6('0x48')]=_0x560410['attributes']['length']?_0x560410['attributes']:_0x3dae4c['model'];if(_0xce2b85[_0xa6a6('0x44')][_0xa6a6('0x56')]){_0x560410['include']=[{'all':!![]}];}_0x560410=_[_0xa6a6('0x52')]({},_0x560410,_0xce2b85[_0xa6a6('0x55')]);return db[_0xa6a6('0x3f')][_0xa6a6('0x5b')](_0x560410)['then'](handleEntityNotFound(_0x5cd72d,null))[_0xa6a6('0x28')](respondWithResult(_0x5cd72d,null))[_0xa6a6('0x5c')](handleError(_0x5cd72d,null));};exports[_0xa6a6('0x5d')]=function(_0x2c3963,_0x5181bc){return db[_0xa6a6('0x3f')][_0xa6a6('0x5d')](_0x2c3963[_0xa6a6('0x5e')],{})[_0xa6a6('0x28')](respondWithResult(_0x5181bc,0xc9))[_0xa6a6('0x5c')](handleError(_0x5181bc,null));};exports[_0xa6a6('0x3c')]=function(_0x540c05,_0x5d5190){if(_0x540c05[_0xa6a6('0x5e')]['id']){delete _0x540c05[_0xa6a6('0x5e')]['id'];}return db[_0xa6a6('0x3f')][_0xa6a6('0x5b')]({'where':{'id':_0x540c05['params']['id']}})[_0xa6a6('0x28')](handleEntityNotFound(_0x5d5190,null))[_0xa6a6('0x28')](saveUpdates(_0x540c05[_0xa6a6('0x5e')],null))[_0xa6a6('0x28')](respondWithResult(_0x5d5190,null))[_0xa6a6('0x5c')](handleError(_0x5d5190,null));};exports['destroy']=function(_0x3dc6ee,_0x4de7bb){return db[_0xa6a6('0x3f')]['find']({'where':{'id':_0x3dc6ee['params']['id']}})[_0xa6a6('0x28')](handleEntityNotFound(_0x4de7bb,null))['then'](removeEntity(_0x4de7bb,null))[_0xa6a6('0x5c')](handleError(_0x4de7bb,null));};exports[_0xa6a6('0x5f')]=function(_0x3b9f3a,_0x26d783){return db[_0xa6a6('0x3f')][_0xa6a6('0x5f')]()[_0xa6a6('0x28')](respondWithResult(_0x26d783,null))[_0xa6a6('0x5c')](handleError(_0x26d783,null));};var interaction_log=require(_0xa6a6('0x17'))(_0xa6a6('0x60'));exports[_0xa6a6('0x61')]=function(_0x8d38c9,_0x3ee1f4,_0x4f56f1){var _0x34ea65={'channel':_0xa6a6('0x62')};if(_0x8d38c9[_0xa6a6('0x5e')]['id']){delete _0x8d38c9[_0xa6a6('0x5e')]['id'];}_0x8d38c9[_0xa6a6('0x5e')]['read']=!![];_0x8d38c9[_0xa6a6('0x5e')]['readAt']=moment()[_0xa6a6('0x63')](_0xa6a6('0x64'));_0x8d38c9[_0xa6a6('0x5e')][_0xa6a6('0x65')]=_0x8d38c9[_0xa6a6('0x5e')]['UserId']||_0x8d38c9[_0xa6a6('0x66')]['id'];return db['OpenchannelMessage'][_0xa6a6('0x5b')]({'where':{'id':_0x8d38c9[_0xa6a6('0x67')]['id'],'UserId':null},'include':[{'model':db[_0xa6a6('0x68')],'as':_0xa6a6('0x69')}]})['then'](handleEntityNotFound(_0x3ee1f4,null))[_0xa6a6('0x28')](saveUpdates(_0x8d38c9[_0xa6a6('0x5e')],null))[_0xa6a6('0x28')](function(_0x2aeb19){if(_0x2aeb19){_0x34ea65[_0xa6a6('0x30')]=_0x2aeb19[_0xa6a6('0x6a')]({'plain':!![]});return db[_0xa6a6('0x6b')][_0xa6a6('0x5b')]({'where':{'id':_0x2aeb19[_0xa6a6('0x6c')]}});}return null;})[_0xa6a6('0x28')](handleEntityNotFound(_0x3ee1f4,null))[_0xa6a6('0x28')](function(_0x3e7b20){if(_0x3e7b20){return _0x3e7b20[_0xa6a6('0x3c')]({'UserId':_0x8d38c9[_0xa6a6('0x5e')]['UserId'],'read1stAt':_[_0xa6a6('0x6d')](_0x3e7b20['read1stAt'])?moment()['format'](_0xa6a6('0x64')):undefined});}return null;})[_0xa6a6('0x28')](function(_0x5c7e63){if(_0x5c7e63){_0x34ea65[_0xa6a6('0x6e')]=_0x5c7e63[_0xa6a6('0x6a')]({'plain':!![]});interaction_log[_0xa6a6('0x29')](_0xa6a6('0x6f'),_0x8d38c9[_0xa6a6('0x66')]['id'],_0x8d38c9[_0xa6a6('0x66')][_0xa6a6('0x43')],_0x8d38c9[_0xa6a6('0x66')][_0xa6a6('0x70')],_0x34ea65[_0xa6a6('0x6e')]['id'],_0x8d38c9[_0xa6a6('0x5e')]?JSON[_0xa6a6('0x2d')](_0x8d38c9[_0xa6a6('0x5e')]):'null');return respondWithRpcPromise(_0xa6a6('0x71'),_0xa6a6('0x72'),_0x34ea65);}return null;})[_0xa6a6('0x28')](function(_0x523a9e){if(_0x523a9e){if(_0x8d38c9['body']['manual']){_0x34ea65[_0xa6a6('0x30')][_0xa6a6('0x73')]=util[_0xa6a6('0x63')]('SIP/%s',_0x8d38c9[_0xa6a6('0x66')][_0xa6a6('0x43')]);_0x34ea65[_0xa6a6('0x30')]['channel']=_0x34ea65[_0xa6a6('0x74')];_0x34ea65[_0xa6a6('0x30')][_0xa6a6('0x75')]=_0xa6a6('0x61');return respondWithRpcPromise('EventManager',_0xa6a6('0x76'),{'event':_0xa6a6('0x77'),'message':_0x34ea65[_0xa6a6('0x30')]},client9002)[_0xa6a6('0x28')](function(){return _0x34ea65;});}return _0x34ea65;}return null;})[_0xa6a6('0x28')](respondWithResult(_0x3ee1f4,null))[_0xa6a6('0x5c')](handleError(_0x3ee1f4,null));};var interaction_log=require('../../config/logger')(_0xa6a6('0x60'));exports['reject']=function(_0x3394ba,_0x250987,_0x38a2a3){var _0x198d2={'agent':{},'channel':'openchannel'};if(_0x3394ba[_0xa6a6('0x5e')]['id']){delete _0x3394ba[_0xa6a6('0x5e')]['id'];}_0x3394ba[_0xa6a6('0x5e')]['UserId']=_0x3394ba[_0xa6a6('0x5e')][_0xa6a6('0x65')]||_0x3394ba[_0xa6a6('0x66')]['id'];_0x198d2[_0xa6a6('0x78')]['id']=_0x3394ba[_0xa6a6('0x5e')]['UserId'];return db['OpenchannelMessage'][_0xa6a6('0x5b')]({'where':{'id':_0x3394ba[_0xa6a6('0x67')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x250987,null))['then'](function(_0x5e0112){if(_0x5e0112){_0x198d2[_0xa6a6('0x30')]=_0x5e0112[_0xa6a6('0x6a')]({'plain':!![]});return db['OpenchannelInteraction'][_0xa6a6('0x5b')]({'where':{'id':_0x5e0112[_0xa6a6('0x6c')]}});}return null;})[_0xa6a6('0x28')](handleEntityNotFound(_0x250987,null))[_0xa6a6('0x28')](function(_0x2552b5){if(_0x2552b5){_0x198d2['interaction']=_0x2552b5[_0xa6a6('0x6a')]({'plain':!![]});interaction_log[_0xa6a6('0x29')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3394ba[_0xa6a6('0x66')]['id'],_0x3394ba['user'][_0xa6a6('0x43')],_0x3394ba[_0xa6a6('0x66')]['role'],_0x198d2[_0xa6a6('0x6e')]['id'],_0x3394ba[_0xa6a6('0x5e')]?JSON[_0xa6a6('0x2d')](_0x3394ba[_0xa6a6('0x5e')]):_0xa6a6('0x79'));return respondWithRpcPromise(_0xa6a6('0x7a'),_0xa6a6('0x7b'),_0x198d2);}return null;})['then'](function(_0x33d345){if(_0x33d345){_0x33d345[_0xa6a6('0x30')][_0xa6a6('0x73')]=util[_0xa6a6('0x63')]('SIP/%s',_0x3394ba[_0xa6a6('0x66')][_0xa6a6('0x43')]);_0x33d345[_0xa6a6('0x30')][_0xa6a6('0x74')]=_0x198d2[_0xa6a6('0x74')];_0x33d345['message'][_0xa6a6('0x75')]=_0xa6a6('0x7c');respondWithRpcPromise('EventManager',_0xa6a6('0x76'),{'event':_0xa6a6('0x7d'),'message':_0x33d345['message']},client9002);return _0x198d2;}return null;})[_0xa6a6('0x28')](respondWithResult(_0x250987,null))[_0xa6a6('0x5c')](handleError(_0x250987,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index cf56e2a..2d7755d 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 _0x4d33=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x4fc702,_0x590060){var _0x1357d3=function(_0x45a119){while(--_0x45a119){_0x4fc702['push'](_0x4fc702['shift']());}};_0x1357d3(++_0x590060);}(_0x4d33,0x1b0));var _0x34d3=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x4d33[_0x4792c8];return _0x35edb1;};'use strict';var EventEmitter=require(_0x34d3('0x0'));var OpenchannelMessage=require(_0x34d3('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x34d3('0x2'),'afterUpdate':_0x34d3('0x3'),'afterDestroy':_0x34d3('0x4')};function emitEvent(_0x4666ae){return function(_0x1abdbf,_0x41b864,_0x54cdae){OpenchannelMessageEvents[_0x34d3('0x5')](_0x4666ae+':'+_0x1abdbf['id'],_0x1abdbf);OpenchannelMessageEvents[_0x34d3('0x5')](_0x4666ae,_0x1abdbf);_0x54cdae(null);};}for(var e in events){if(events[_0x34d3('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x34d3('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xae02=['exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xae02,0x169));var _0x2ae0=function(_0x1c9940,_0x40fceb){_0x1c9940=_0x1c9940-0x0;var _0x536128=_0xae02[_0x1c9940];return _0x536128;};'use strict';var EventEmitter=require(_0x2ae0('0x0'));var OpenchannelMessage=require(_0x2ae0('0x1'))['db'][_0x2ae0('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x2ae0('0x3')](0x0);var events={'afterCreate':_0x2ae0('0x4'),'afterUpdate':_0x2ae0('0x5'),'afterDestroy':_0x2ae0('0x6')};function emitEvent(_0xfcc335){return function(_0x545de6,_0x4e5644,_0x405c60){OpenchannelMessageEvents[_0x2ae0('0x7')](_0xfcc335+':'+_0x545de6['id'],_0x545de6);OpenchannelMessageEvents[_0x2ae0('0x7')](_0xfcc335,_0x545de6);_0x405c60(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x2ae0('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 19f76b3..0ebfa70 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 _0xce50=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','rimraf','exports','define','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','catch','error','out','secret','CmContact','then','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','length','Interaction','omit','POST','GET','body','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally'];(function(_0x244914,_0x1108b3){var _0x5d9568=function(_0x130d10){while(--_0x130d10){_0x244914['push'](_0x244914['shift']());}};_0x5d9568(++_0x1108b3);}(_0xce50,0x1d8));var _0x0ce5=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xce50[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require(_0x0ce5('0x0'));var logger=require(_0x0ce5('0x1'))(_0x0ce5('0x2'));var moment=require(_0x0ce5('0x3'));var BPromise=require(_0x0ce5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ce5('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0x0ce5('0x6')]=function(_0x42fadd,_0x69892c){return _0x42fadd[_0x0ce5('0x7')]('OpenchannelMessage',attributes,{'tableName':_0x0ce5('0x8'),'paranoid':![],'indexes':[{'name':_0x0ce5('0x9'),'fields':['body'],'type':_0x0ce5('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55639f,_0x4475c9,_0x4ecdce){var _0x3ed31c=_0x42fadd[_0x0ce5('0xb')];var _0x5a3955=_0x55639f[_0x0ce5('0xc')]({'plain':!![]});if(_0x5a3955[_0x0ce5('0xd')][_0x0ce5('0xe')]()==='in'||_0x5a3955[_0x0ce5('0xd')][_0x0ce5('0xe')]()==='out'&&!_0x5a3955['secret']&&!_['isNil'](_0x5a3955[_0x0ce5('0xf')])){_0x3ed31c[_0x0ce5('0x10')][_0x0ce5('0x11')]({'where':{'id':_0x5a3955[_0x0ce5('0x12')]}})['then'](function(_0x85bbb){if(_0x85bbb){_0x85bbb[_0x0ce5('0x13')]({'lastMsgAt':_0x5a3955['createdAt'],'lastMsgDirection':_0x5a3955[_0x0ce5('0xd')]['toLowerCase']()});}})[_0x0ce5('0x14')](function(_0x1dd856){console[_0x0ce5('0x15')](_0x1dd856);});}if(_0x5a3955[_0x0ce5('0xd')]===_0x0ce5('0x16')&&!_0x5a3955[_0x0ce5('0x17')]){var _0x13486a;_0x3ed31c[_0x0ce5('0x18')]['describe']()[_0x0ce5('0x19')](function(_0x4292ce){return _0x3ed31c['OpenchannelAccount']['find']({'where':{'id':_0x5a3955[_0x0ce5('0x1a')]},'include':[{'model':_0x3ed31c['OpenchannelInteraction'],'as':_0x0ce5('0x1b'),'where':{'id':_0x5a3955[_0x0ce5('0x12')]},'limit':0x1,'include':[{'model':_0x3ed31c[_0x0ce5('0x18')],'as':_0x0ce5('0x1c'),'attributes':_[_0x0ce5('0x1d')](_0x4292ce)}]}]});})[_0x0ce5('0x19')](function(_0x57d9da){_0x13486a=_0x57d9da[_0x0ce5('0xc')]({'plain':!![]});if(_0x13486a&&_0x13486a[_0x0ce5('0x1e')]){logger[_0x0ce5('0x1f')](_0x0ce5('0x20'),'afterCreate',util[_0x0ce5('0x21')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5a3955['id'],_0x13486a[_0x0ce5('0x1e')]));if(_0x13486a[_0x0ce5('0x1b')]&&_0x13486a[_0x0ce5('0x1b')][_0x0ce5('0x22')]){_0x5a3955[_0x0ce5('0x23')]=_[_0x0ce5('0x24')](_0x13486a[_0x0ce5('0x1b')][0x0],_0x0ce5('0x1c'));_0x5a3955[_0x0ce5('0x1c')]=_0x13486a[_0x0ce5('0x1b')][0x0]['Contact'];}var _0x4475c9={'method':_0x0ce5('0x25'),'uri':encodeURI(_0x13486a['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4475c9['method']){case _0x0ce5('0x26'):_0x4475c9['qs']=_0x5a3955;break;case'POST':_0x4475c9[_0x0ce5('0x27')]=_0x5a3955;break;}return rp(_0x4475c9)[_0x0ce5('0x19')](function(_0x5bdf41){logger['info'](_0x0ce5('0x20'),_0x0ce5('0x28'),util['format'](_0x0ce5('0x29'),_0x5a3955['id'],_0x13486a[_0x0ce5('0x1e')]));if(_0x5bdf41[_0x0ce5('0x27')]['threadId']&&_0x5bdf41['body'][_0x0ce5('0x2a')]!=_0x5a3955[_0x0ce5('0x23')][_0x0ce5('0x2a')]){return _0x3ed31c[_0x0ce5('0x10')][_0x0ce5('0x13')]({'threadId':_0x5bdf41[_0x0ce5('0x27')][_0x0ce5('0x2a')]},{'logging':!![],'where':{'id':_0x5a3955[_0x0ce5('0x23')]['id']}});}else{return;}})[_0x0ce5('0x19')](function(){return _0x55639f[_0x0ce5('0x13')]({'read':!![]});})[_0x0ce5('0x14')](function(_0x2a94a5){logger[_0x0ce5('0x15')](_0x0ce5('0x20'),_0x0ce5('0x28'),util[_0x0ce5('0x2b')](_0x2a94a5,{'showHidden':![],'depth':null}));_0x4ecdce();});}else{_0x4ecdce();}})[_0x0ce5('0x2c')](function(){_0x4ecdce();});}else{_0x4ecdce();}}},'charset':_0x0ce5('0x2d'),'collate':_0x0ce5('0x2e')});}; \ No newline at end of file +var _0xc92f=['inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','define','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','error','CmContact','describe','then','OpenchannelAccountId','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Contact','POST','method','GET','Interaction','threadId','update'];(function(_0x4eda24,_0x407afa){var _0x5300cf=function(_0x3b3e6f){while(--_0x3b3e6f){_0x4eda24['push'](_0x4eda24['shift']());}};_0x5300cf(++_0x407afa);}(_0xc92f,0xf3));var _0xfc92=function(_0x147964,_0x1341b2){_0x147964=_0x147964-0x0;var _0x2992f1=_0xc92f[_0x147964];return _0x2992f1;};'use strict';var _=require(_0xfc92('0x0'));var util=require(_0xfc92('0x1'));var logger=require('../../config/logger')(_0xfc92('0x2'));var moment=require(_0xfc92('0x3'));var BPromise=require(_0xfc92('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc92('0x5'));var rimraf=require(_0xfc92('0x6'));var config=require(_0xfc92('0x7'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x930bab,_0x47abee){return _0x930bab[_0xfc92('0x8')]('OpenchannelMessage',attributes,{'tableName':_0xfc92('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xfc92('0xa')],'type':_0xfc92('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fbe63,_0x4f37f2,_0x18a53b){var _0x379756=_0x930bab[_0xfc92('0xc')];var _0x552eab=_0x3fbe63[_0xfc92('0xd')]({'plain':!![]});if(_0x552eab[_0xfc92('0xe')][_0xfc92('0xf')]()==='in'||_0x552eab[_0xfc92('0xe')][_0xfc92('0xf')]()===_0xfc92('0x10')&&!_0x552eab[_0xfc92('0x11')]&&!_[_0xfc92('0x12')](_0x552eab[_0xfc92('0x13')])){_0x379756[_0xfc92('0x14')][_0xfc92('0x15')]({'where':{'id':_0x552eab[_0xfc92('0x16')]}})['then'](function(_0x55d532){if(_0x55d532){_0x55d532['update']({'lastMsgAt':_0x552eab[_0xfc92('0x17')],'lastMsgDirection':_0x552eab[_0xfc92('0xe')]['toLowerCase']()});}})[_0xfc92('0x18')](function(_0x15ee68){console[_0xfc92('0x19')](_0x15ee68);});}if(_0x552eab[_0xfc92('0xe')]===_0xfc92('0x10')&&!_0x552eab[_0xfc92('0x11')]){var _0x492d40;_0x379756[_0xfc92('0x1a')][_0xfc92('0x1b')]()[_0xfc92('0x1c')](function(_0xcb8866){return _0x379756['OpenchannelAccount']['find']({'where':{'id':_0x552eab[_0xfc92('0x1d')]},'include':[{'model':_0x379756[_0xfc92('0x14')],'as':'Interactions','where':{'id':_0x552eab[_0xfc92('0x16')]},'limit':0x1,'include':[{'model':_0x379756[_0xfc92('0x1a')],'as':'Contact','attributes':_[_0xfc92('0x1e')](_0xcb8866)}]}]});})['then'](function(_0x376551){_0x492d40=_0x376551[_0xfc92('0xd')]({'plain':!![]});if(_0x492d40&&_0x492d40[_0xfc92('0x1f')]){logger[_0xfc92('0x20')](_0xfc92('0x21'),_0xfc92('0x22'),util['format'](_0xfc92('0x23'),_0x552eab['id'],_0x492d40['replyUri']));if(_0x492d40[_0xfc92('0x24')]&&_0x492d40[_0xfc92('0x24')][_0xfc92('0x25')]){_0x552eab['Interaction']=_['omit'](_0x492d40['Interactions'][0x0],'Contact');_0x552eab[_0xfc92('0x26')]=_0x492d40[_0xfc92('0x24')][0x0][_0xfc92('0x26')];}var _0x4f37f2={'method':_0xfc92('0x27'),'uri':encodeURI(_0x492d40[_0xfc92('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4f37f2[_0xfc92('0x28')]){case _0xfc92('0x29'):_0x4f37f2['qs']=_0x552eab;break;case'POST':_0x4f37f2[_0xfc92('0xa')]=_0x552eab;break;}return rp(_0x4f37f2)[_0xfc92('0x1c')](function(_0x35cea1){logger['info'](_0xfc92('0x21'),_0xfc92('0x22'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x552eab['id'],_0x492d40[_0xfc92('0x1f')]));if(_0x35cea1[_0xfc92('0xa')]['threadId']&&_0x35cea1[_0xfc92('0xa')]['threadId']!=_0x552eab[_0xfc92('0x2a')][_0xfc92('0x2b')]){return _0x379756['OpenchannelInteraction'][_0xfc92('0x2c')]({'threadId':_0x35cea1[_0xfc92('0xa')][_0xfc92('0x2b')]},{'logging':!![],'where':{'id':_0x552eab[_0xfc92('0x2a')]['id']}});}else{return;}})[_0xfc92('0x1c')](function(){return _0x3fbe63[_0xfc92('0x2c')]({'read':!![]});})[_0xfc92('0x18')](function(_0x27c7ed){logger[_0xfc92('0x19')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xfc92('0x2d')](_0x27c7ed,{'showHidden':![],'depth':null}));_0x18a53b();});}else{_0x18a53b();}})['finally'](function(){_0x18a53b();});}else{_0x18a53b();}}},'charset':_0xfc92('0x2e'),'collate':_0xfc92('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index d497d5e..f97680d 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 _0xffd6=['./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelMessage','create','options','raw','debug','CreateOpenchannelMessage','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0xace428,_0x42a542){var _0x2cf205=function(_0x2d93d4){while(--_0x2d93d4){_0xace428['push'](_0xace428['shift']());}};_0x2cf205(++_0x42a542);}(_0xffd6,0x97));var _0x6ffd=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0xffd6[_0x46428c];return _0x16a677;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});config[_0x6ffd('0xa')]=_[_0x6ffd('0xb')](config[_0x6ffd('0xa')],{'host':_0x6ffd('0xc'),'port':0x18eb});var socket=require(_0x6ffd('0xd'))(new Redis(config['redis']));require(_0x6ffd('0xe'))[_0x6ffd('0xf')](socket);function respondWithRpcPromise(_0x4e57f5,_0x469d0d,_0x38fc68){return new BPromise(function(_0x23f7f2,_0x3dda1e){return client[_0x6ffd('0x10')](_0x4e57f5,_0x38fc68)[_0x6ffd('0x11')](function(_0x836501){logger['info'](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));logger['debug'](_0x6ffd('0x14'),_0x469d0d,_0x6ffd('0x13'),JSON[_0x6ffd('0x15')](_0x836501));if(_0x836501[_0x6ffd('0x16')]){if(_0x836501['error'][_0x6ffd('0x17')]===0x1f4){logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501['error'][_0x6ffd('0x18')]);return _0x3dda1e(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);return _0x23f7f2(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}else{logger[_0x6ffd('0x19')](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));_0x23f7f2(_0x836501['result'][_0x6ffd('0x18')]);}})['catch'](function(_0x587d0b){logger[_0x6ffd('0x16')](_0x6ffd('0x12'),_0x469d0d,_0x587d0b);_0x3dda1e(_0x587d0b);});});}exports['CreateOpenchannelMessage']=function(_0x34c3c1){var _0x4612a3=this;return new Promise(function(_0x4eeaa2,_0x564a11){return db[_0x6ffd('0x1a')][_0x6ffd('0x1b')](_0x34c3c1['body'],{'raw':_0x34c3c1[_0x6ffd('0x1c')]?_0x34c3c1[_0x6ffd('0x1c')][_0x6ffd('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3ba429){logger[_0x6ffd('0x19')]('CreateOpenchannelMessage',_0x34c3c1);logger[_0x6ffd('0x1e')](_0x6ffd('0x1f'),_0x34c3c1,JSON['stringify'](_0x3ba429));_0x4eeaa2(_0x3ba429);})[_0x6ffd('0x20')](function(_0x35ef16){logger[_0x6ffd('0x16')]('CreateOpenchannelMessage',_0x35ef16[_0x6ffd('0x18')],_0x34c3c1);_0x564a11(_0x4612a3[_0x6ffd('0x16')](0x1f4,_0x35ef16[_0x6ffd('0x18')]));});});}; \ No newline at end of file +var _0xee9c=['code','message','info','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','raw','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0xee9c,0x1e6));var _0xcee9=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0xee9c[_0x217c2e];return _0x22b7d8;};'use strict';var _=require('lodash');var util=require(_0xcee9('0x0'));var moment=require(_0xcee9('0x1'));var BPromise=require(_0xcee9('0x2'));var rs=require(_0xcee9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcee9('0x4'));var logger=require(_0xcee9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcee9('0x6'));var client=jayson['client'][_0xcee9('0x7')]({'port':0x232a});config[_0xcee9('0x8')]=_[_0xcee9('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcee9('0xa'))(new Redis(config[_0xcee9('0x8')]));require('./openchannelMessage.socket')[_0xcee9('0xb')](socket);function respondWithRpcPromise(_0x3002cf,_0x3e08b2,_0x13d681){return new BPromise(function(_0x10f960,_0x430fbd){return client['request'](_0x3002cf,_0x13d681)[_0xcee9('0xc')](function(_0x3c28b6){logger['info'](_0xcee9('0xd'),_0x3e08b2,_0xcee9('0xe'));logger[_0xcee9('0xf')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3e08b2,_0xcee9('0xe'),JSON[_0xcee9('0x10')](_0x3c28b6));if(_0x3c28b6[_0xcee9('0x11')]){if(_0x3c28b6[_0xcee9('0x11')][_0xcee9('0x12')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3e08b2,_0x3c28b6[_0xcee9('0x11')][_0xcee9('0x13')]);return _0x430fbd(_0x3c28b6[_0xcee9('0x11')][_0xcee9('0x13')]);}logger[_0xcee9('0x11')](_0xcee9('0xd'),_0x3e08b2,_0x3c28b6[_0xcee9('0x11')][_0xcee9('0x13')]);return _0x10f960(_0x3c28b6[_0xcee9('0x11')][_0xcee9('0x13')]);}else{logger[_0xcee9('0x14')](_0xcee9('0xd'),_0x3e08b2,'request\x20sent');_0x10f960(_0x3c28b6[_0xcee9('0x15')][_0xcee9('0x13')]);}})[_0xcee9('0x16')](function(_0xb84710){logger[_0xcee9('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e08b2,_0xb84710);_0x430fbd(_0xb84710);});});}exports[_0xcee9('0x17')]=function(_0x16dfd1){var _0x3ff421=this;return new Promise(function(_0x961900,_0x580b06){return db[_0xcee9('0x18')][_0xcee9('0x19')](_0x16dfd1['body'],{'raw':_0x16dfd1['options']?_0x16dfd1[_0xcee9('0x1a')][_0xcee9('0x1b')]===undefined?!![]:![]:!![]})[_0xcee9('0xc')](function(_0x49afe8){logger[_0xcee9('0x14')](_0xcee9('0x17'),_0x16dfd1);logger[_0xcee9('0xf')]('CreateOpenchannelMessage',_0x16dfd1,JSON[_0xcee9('0x10')](_0x49afe8));_0x961900(_0x49afe8);})['catch'](function(_0x26c694){logger[_0xcee9('0x11')](_0xcee9('0x17'),_0x26c694[_0xcee9('0x13')],_0x16dfd1);_0x580b06(_0x3ff421[_0xcee9('0x11')](0x1f4,_0x26c694[_0xcee9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 570b536..57e78ca 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 _0xcb91=['remove','update','emit','removeListener','register'];(function(_0x1b0f87,_0xb78388){var _0x1041ca=function(_0x25ce0f){while(--_0x25ce0f){_0x1b0f87['push'](_0x1b0f87['shift']());}};_0x1041ca(++_0xb78388);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4a96ca,_0x13754e){_0x4a96ca=_0x4a96ca-0x0;var _0x2aed48=_0xcb91[_0x4a96ca];return _0x2aed48;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x1cb9('0x0'),_0x1cb9('0x1')];function createListener(_0x17d4ec,_0x22c4b8){return function(_0x4c37e8){_0x22c4b8[_0x1cb9('0x2')](_0x17d4ec,_0x4c37e8);};}function removeListener(_0x2c17b8,_0x545a34){return function(){OpenchannelMessageEvents[_0x1cb9('0x3')](_0x2c17b8,_0x545a34);};}exports[_0x1cb9('0x4')]=function(_0x53ffbd){for(var _0x226b69=0x0,_0x3f7deb=events['length'];_0x226b69<_0x3f7deb;_0x226b69++){var _0x38737d=events[_0x226b69];var _0x12567c=createListener('openchannelMessage:'+_0x38737d,_0x53ffbd);OpenchannelMessageEvents['on'](_0x38737d,_0x12567c);}}; \ No newline at end of file +var _0x54ef=['remove','emit','removeListener','length','./openchannelMessage.events','save'];(function(_0x5ed8ee,_0x21376e){var _0x3ed347=function(_0x4b5abe){while(--_0x4b5abe){_0x5ed8ee['push'](_0x5ed8ee['shift']());}};_0x3ed347(++_0x21376e);}(_0x54ef,0x112));var _0xf54e=function(_0x23afc9,_0x46df37){_0x23afc9=_0x23afc9-0x0;var _0x1b3eda=_0x54ef[_0x23afc9];return _0x1b3eda;};'use strict';var OpenchannelMessageEvents=require(_0xf54e('0x0'));var events=[_0xf54e('0x1'),_0xf54e('0x2'),'update'];function createListener(_0xd936f7,_0x18b7d6){return function(_0x18b1cf){_0x18b7d6[_0xf54e('0x3')](_0xd936f7,_0x18b1cf);};}function removeListener(_0x8b6bb6,_0x431e36){return function(){OpenchannelMessageEvents[_0xf54e('0x4')](_0x8b6bb6,_0x431e36);};}exports['register']=function(_0x55e611){for(var _0x18e84e=0x0,_0x99cf9=events[_0xf54e('0x5')];_0x18e84e<_0x99cf9;_0x18e84e++){var _0x561870=events[_0x18e84e];var _0x27e69b=createListener('openchannelMessage:'+_0x561870,_0x55e611);OpenchannelMessageEvents['on'](_0x561870,_0x27e69b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index da25ffb..b0c620b 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 _0x36b2=['/:id/teams','addTeams','/:id/users','update','delete','removeTeams','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getMembers','getTeams','post'];(function(_0x26bcf0,_0x11ebb7){var _0x3bf097=function(_0x5c9cd2){while(--_0x5c9cd2){_0x26bcf0['push'](_0x26bcf0['shift']());}};_0x3bf097(++_0x11ebb7);}(_0x36b2,0x6b));var _0x236b=function(_0x43f804,_0x12ca6c){_0x43f804=_0x43f804-0x0;var _0x35f5f8=_0x36b2[_0x43f804];return _0x35f5f8;};'use strict';var multer=require(_0x236b('0x0'));var util=require(_0x236b('0x1'));var path=require(_0x236b('0x2'));var timeout=require('connect-timeout');var express=require(_0x236b('0x3'));var router=express[_0x236b('0x4')]();var auth=require(_0x236b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x236b('0x6'));var controller=require(_0x236b('0x7'));router['get']('/',auth[_0x236b('0x8')](),controller[_0x236b('0x9')]);router[_0x236b('0xa')](_0x236b('0xb'),auth[_0x236b('0x8')](),controller[_0x236b('0xc')]);router['get'](_0x236b('0xd'),auth[_0x236b('0x8')](),controller[_0x236b('0xe')]);router[_0x236b('0xa')]('/:id/members',auth[_0x236b('0x8')](),controller[_0x236b('0xf')]);router[_0x236b('0xa')]('/:id/teams',auth[_0x236b('0x8')](),controller[_0x236b('0x10')]);router[_0x236b('0xa')]('/:id/users',auth[_0x236b('0x8')](),controller['getAgents']);router['post']('/',auth[_0x236b('0x8')](),controller['create']);router[_0x236b('0x11')](_0x236b('0x12'),auth[_0x236b('0x8')](),controller[_0x236b('0x13')]);router[_0x236b('0x11')](_0x236b('0x14'),auth[_0x236b('0x8')](),controller['addAgents']);router['put'](_0x236b('0xd'),auth[_0x236b('0x8')](),controller[_0x236b('0x15')]);router[_0x236b('0x16')](_0x236b('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x236b('0x16')]('/:id/teams',auth[_0x236b('0x8')](),controller[_0x236b('0x17')]);router['delete']('/:id/users',auth[_0x236b('0x8')](),controller['removeAgents']);module[_0x236b('0x18')]=router; \ No newline at end of file +var _0xbd10=['getAgents','post','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users'];(function(_0x1ce210,_0x43adb3){var _0x22fccf=function(_0x538f4f){while(--_0x538f4f){_0x1ce210['push'](_0x1ce210['shift']());}};_0x22fccf(++_0x43adb3);}(_0xbd10,0x85));var _0x0bd1=function(_0x358eff,_0x4ebd94){_0x358eff=_0x358eff-0x0;var _0x6901b6=_0xbd10[_0x358eff];return _0x6901b6;};'use strict';var multer=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var path=require(_0x0bd1('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd1('0x3'));var router=express[_0x0bd1('0x4')]();var auth=require(_0x0bd1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0bd1('0x6'));var controller=require(_0x0bd1('0x7'));router[_0x0bd1('0x8')]('/',auth[_0x0bd1('0x9')](),controller[_0x0bd1('0xa')]);router[_0x0bd1('0x8')]('/describe',auth[_0x0bd1('0x9')](),controller['describe']);router[_0x0bd1('0x8')](_0x0bd1('0xb'),auth[_0x0bd1('0x9')](),controller[_0x0bd1('0xc')]);router['get'](_0x0bd1('0xd'),auth[_0x0bd1('0x9')](),controller[_0x0bd1('0xe')]);router[_0x0bd1('0x8')](_0x0bd1('0xf'),auth[_0x0bd1('0x9')](),controller['getTeams']);router[_0x0bd1('0x8')](_0x0bd1('0x10'),auth[_0x0bd1('0x9')](),controller[_0x0bd1('0x11')]);router[_0x0bd1('0x12')]('/',auth[_0x0bd1('0x9')](),controller['create']);router[_0x0bd1('0x12')](_0x0bd1('0xf'),auth[_0x0bd1('0x9')](),controller['addTeams']);router['post'](_0x0bd1('0x10'),auth[_0x0bd1('0x9')](),controller[_0x0bd1('0x13')]);router['put']('/:id',auth[_0x0bd1('0x9')](),controller[_0x0bd1('0x14')]);router[_0x0bd1('0x15')]('/:id',auth[_0x0bd1('0x9')](),controller[_0x0bd1('0x16')]);router[_0x0bd1('0x15')](_0x0bd1('0xf'),auth['isAuthenticated'](),controller[_0x0bd1('0x17')]);router[_0x0bd1('0x15')]('/:id/users',auth[_0x0bd1('0x9')](),controller[_0x0bd1('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index b9ee49e..9578a01 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 _0x873e=['roundrobin','sequelize','exports','STRING','name'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x873e,0x141));var _0xe873=function(_0x407fe0,_0x4ac8d6){_0x407fe0=_0x407fe0-0x0;var _0x143229=_0x873e[_0x407fe0];return _0x143229;};'use strict';var Sequelize=require(_0xe873('0x0'));module[_0xe873('0x1')]={'name':{'type':Sequelize[_0xe873('0x2')],'unique':_0xe873('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe873('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xe873('0x4'))}}; \ No newline at end of file +var _0xa6c7=['name','STRING','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa6c7,0x133));var _0x7a6c=function(_0x1f37d5,_0x102bb8){_0x1f37d5=_0x1f37d5-0x0;var _0x3bbd99=_0xa6c7[_0x1f37d5];return _0x3bbd99;};'use strict';var Sequelize=require('sequelize');module[_0x7a6c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7a6c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7a6c('0x2')]},'timeout':{'type':Sequelize[_0x7a6c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7a6c('0x4'),_0x7a6c('0x5'),_0x7a6c('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index afff81b..503b76e 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 _0x9ffc=['getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','ids','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','emit','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','register','sendStatus','end','status','json','count','offset','set','reject','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','key','keys','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','length','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe'];(function(_0x268f21,_0x211a4b){var _0x28a293=function(_0x1ea9ff){while(--_0x1ea9ff){_0x268f21['push'](_0x268f21['shift']());}};_0x28a293(++_0x211a4b);}(_0x9ffc,0xc0));var _0xc9ff=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0x9ffc[_0x16771d];return _0x386f11;};'use strict';var pdf=require(_0xc9ff('0x0'));var emlformat=require(_0xc9ff('0x1'));var rimraf=require(_0xc9ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9ff('0x3'));var rp=require(_0xc9ff('0x4'));var moment=require(_0xc9ff('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc9ff('0x6'));var path=require(_0xc9ff('0x7'));var sox=require(_0xc9ff('0x8'));var csv=require(_0xc9ff('0x9'));var ejs=require(_0xc9ff('0xa'));var fs=require('fs');var _=require(_0xc9ff('0xb'));var squel=require(_0xc9ff('0xc'));var crypto=require(_0xc9ff('0xd'));var jsforce=require(_0xc9ff('0xe'));var deskjs=require(_0xc9ff('0xf'));var toCsv=require(_0xc9ff('0x9'));var querystring=require(_0xc9ff('0x10'));var Papa=require(_0xc9ff('0x11'));var Redis=require(_0xc9ff('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc9ff('0x13'));var as=require(_0xc9ff('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9ff('0x15'))(_0xc9ff('0x16'));var utils=require(_0xc9ff('0x17'));var config=require(_0xc9ff('0x18'));var db=require('../../mysqldb')['db'];config[_0xc9ff('0x19')]=_['defaults'](config[_0xc9ff('0x19')],{'host':_0xc9ff('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc9ff('0x19')]));require('./openchannelQueue.socket')[_0xc9ff('0x1b')](socket);function respondWithStatusCode(_0x41a93e,_0x4b9701){_0x4b9701=_0x4b9701||0xcc;return function(_0x4f8b90){if(_0x4f8b90){return _0x41a93e[_0xc9ff('0x1c')](_0x4b9701);}return _0x41a93e['status'](_0x4b9701)[_0xc9ff('0x1d')]();};}function respondWithResult(_0x258eb5,_0x57eca7){_0x57eca7=_0x57eca7||0xc8;return function(_0x5f0d03){if(_0x5f0d03){return _0x258eb5[_0xc9ff('0x1e')](_0x57eca7)[_0xc9ff('0x1f')](_0x5f0d03);}};}function respondWithFilteredResult(_0x21d7ce,_0x40cc66){return function(_0x36657b){if(_0x36657b){var _0x238f2e=_0x36657b[_0xc9ff('0x20')],_0x22085a=_0x40cc66['offset'],_0x48f8cc=_0x40cc66[_0xc9ff('0x21')]+_0x40cc66['limit'],_0x1f452d;if(_0x48f8cc>=_0x238f2e){_0x48f8cc=_0x238f2e;_0x1f452d=0xc8;}else{_0x1f452d=0xce;}_0x21d7ce[_0xc9ff('0x1e')](_0x1f452d);return _0x21d7ce[_0xc9ff('0x22')]('Content-Range',_0x22085a+'-'+_0x48f8cc+'/'+_0x238f2e)[_0xc9ff('0x1f')](_0x36657b);}return null;};}function patchUpdates(_0x1b3c94){return function(_0xc997a6){try{jsonpatch['apply'](_0xc997a6,_0x1b3c94,!![]);}catch(_0x1f7fc0){return BPromise[_0xc9ff('0x23')](_0x1f7fc0);}return _0xc997a6['save']();};}function saveUpdates(_0x5c038e,_0x104b8c){return function(_0x42fddf){if(_0x42fddf){return _0x42fddf[_0xc9ff('0x24')](_0x5c038e)[_0xc9ff('0x25')](function(_0x2a9e1a){return _0x2a9e1a;});}return null;};}function removeEntity(_0x1a182f,_0x486dd1){return function(_0x48f0db){if(_0x48f0db){return _0x48f0db[_0xc9ff('0x26')]()[_0xc9ff('0x25')](function(){var _0x4dfc5d=_0x48f0db[_0xc9ff('0x27')]({'plain':!![]});var _0x1b2d3c=_0xc9ff('0x28');return db[_0xc9ff('0x29')][_0xc9ff('0x26')]({'where':{'type':_0x1b2d3c,'resourceId':_0x4dfc5d['id']}})[_0xc9ff('0x25')](function(){return _0x48f0db;});})[_0xc9ff('0x25')](function(){_0x1a182f['status'](0xcc)[_0xc9ff('0x1d')]();});}};}function handleEntityNotFound(_0x1f89b6,_0x1bc3d2){return function(_0x50dd59){if(!_0x50dd59){_0x1f89b6['sendStatus'](0x194);}return _0x50dd59;};}function handleError(_0x493fcf,_0x3a7a28){_0x3a7a28=_0x3a7a28||0x1f4;return function(_0x494b65){logger[_0xc9ff('0x2a')](_0x494b65[_0xc9ff('0x2b')]);if(_0x494b65[_0xc9ff('0x2c')]){delete _0x494b65[_0xc9ff('0x2c')];}_0x493fcf[_0xc9ff('0x1e')](_0x3a7a28)['send'](_0x494b65);};}exports[_0xc9ff('0x2d')]=function(_0x97ebf3,_0x534df0){var _0x41f653={},_0x588796={},_0x412233={'count':0x0,'rows':[]};var _0x29d885=_[_0xc9ff('0x2e')](db[_0xc9ff('0x2f')][_0xc9ff('0x30')],function(_0x555874){return{'name':_0x555874[_0xc9ff('0x31')],'type':_0x555874['type'][_0xc9ff('0x32')]};});_0x588796['model']=_['map'](_0x29d885,_0xc9ff('0x2c'));_0x588796['query']=_[_0xc9ff('0x33')](_0x97ebf3[_0xc9ff('0x34')]);_0x588796['filters']=_[_0xc9ff('0x35')](_0x588796['model'],_0x588796[_0xc9ff('0x34')]);_0x41f653[_0xc9ff('0x36')]=_['intersection'](_0x588796[_0xc9ff('0x37')],qs['fields'](_0x97ebf3[_0xc9ff('0x34')][_0xc9ff('0x38')]));_0x41f653[_0xc9ff('0x36')]=_0x41f653[_0xc9ff('0x36')]['length']?_0x41f653[_0xc9ff('0x36')]:_0x588796[_0xc9ff('0x37')];if(!_0x97ebf3[_0xc9ff('0x34')][_0xc9ff('0x39')](_0xc9ff('0x3a'))){_0x41f653[_0xc9ff('0x3b')]=qs['limit'](_0x97ebf3[_0xc9ff('0x34')][_0xc9ff('0x3b')]);_0x41f653[_0xc9ff('0x21')]=qs[_0xc9ff('0x21')](_0x97ebf3[_0xc9ff('0x34')]['offset']);}_0x41f653[_0xc9ff('0x3c')]=qs[_0xc9ff('0x3d')](_0x97ebf3['query'][_0xc9ff('0x3d')]);_0x41f653[_0xc9ff('0x3e')]=qs[_0xc9ff('0x3f')](_[_0xc9ff('0x40')](_0x97ebf3[_0xc9ff('0x34')],_0x588796['filters']),_0x29d885);if(_0x97ebf3[_0xc9ff('0x34')]['filter']){_0x41f653[_0xc9ff('0x3e')]=_[_0xc9ff('0x41')](_0x41f653['where'],{'$or':_[_0xc9ff('0x2e')](_0x29d885,function(_0x23f4c4){if(_0x23f4c4[_0xc9ff('0x42')]!==_0xc9ff('0x43')){var _0x348319={};_0x348319[_0x23f4c4[_0xc9ff('0x2c')]]={'$like':'%'+_0x97ebf3[_0xc9ff('0x34')][_0xc9ff('0x44')]+'%'};return _0x348319;}})});}_0x41f653=_['merge']({},_0x41f653,_0x97ebf3[_0xc9ff('0x45')]);var _0x37bc6d={'where':_0x41f653[_0xc9ff('0x3e')]};return db['OpenchannelQueue'][_0xc9ff('0x20')](_0x37bc6d)['then'](function(_0x579f34){_0x412233[_0xc9ff('0x20')]=_0x579f34;if(_0x97ebf3[_0xc9ff('0x34')][_0xc9ff('0x46')]){_0x41f653['include']=[{'all':!![]}];}return db[_0xc9ff('0x2f')][_0xc9ff('0x47')](_0x41f653);})['then'](function(_0x41666d){_0x412233[_0xc9ff('0x48')]=_0x41666d;return _0x412233;})['then'](respondWithFilteredResult(_0x534df0,_0x41f653))['catch'](handleError(_0x534df0,null));};exports[_0xc9ff('0x49')]=function(_0x47239c,_0x316169){var _0x5811b5={'raw':!![],'where':{'id':_0x47239c[_0xc9ff('0x4a')]['id']}},_0x5a21a8={};_0x5a21a8[_0xc9ff('0x37')]=_[_0xc9ff('0x33')](db['OpenchannelQueue'][_0xc9ff('0x30')]);_0x5a21a8[_0xc9ff('0x34')]=_['keys'](_0x47239c[_0xc9ff('0x34')]);_0x5a21a8[_0xc9ff('0x3f')]=_[_0xc9ff('0x35')](_0x5a21a8[_0xc9ff('0x37')],_0x5a21a8[_0xc9ff('0x34')]);_0x5811b5['attributes']=_['intersection'](_0x5a21a8[_0xc9ff('0x37')],qs[_0xc9ff('0x38')](_0x47239c['query']['fields']));_0x5811b5['attributes']=_0x5811b5['attributes'][_0xc9ff('0x4b')]?_0x5811b5[_0xc9ff('0x36')]:_0x5a21a8[_0xc9ff('0x37')];if(_0x47239c[_0xc9ff('0x34')]['includeAll']){_0x5811b5['include']=[{'all':!![]}];}_0x5811b5=_[_0xc9ff('0x41')]({},_0x5811b5,_0x47239c['options']);return db[_0xc9ff('0x2f')][_0xc9ff('0x4c')](_0x5811b5)[_0xc9ff('0x25')](handleEntityNotFound(_0x316169,null))[_0xc9ff('0x25')](respondWithResult(_0x316169,null))[_0xc9ff('0x4d')](handleError(_0x316169,null));};exports['create']=function(_0x284626,_0x5add17){return db[_0xc9ff('0x2f')]['create'](_0x284626[_0xc9ff('0x4e')],{})['then'](function(_0x23e18d){var _0x530b10=_0x284626[_0xc9ff('0x4f')][_0xc9ff('0x27')]({'plain':!![]});if(!_0x530b10)throw new Error(_0xc9ff('0x50'));if(_0x530b10['role']==='user'){var _0x563b4d=_0x23e18d['get']({'plain':!![]});var _0x2bc116=_0xc9ff('0x28');return db[_0xc9ff('0x51')]['find']({'where':{'name':_0x2bc116,'userProfileId':_0x530b10[_0xc9ff('0x52')]},'raw':!![]})[_0xc9ff('0x25')](function(_0x12ca0f){if(_0x12ca0f&&_0x12ca0f['autoAssociation']===0x0){return db['UserProfileResource'][_0xc9ff('0x53')]({'name':_0x563b4d[_0xc9ff('0x2c')],'resourceId':_0x563b4d['id'],'type':_0x12ca0f[_0xc9ff('0x2c')],'sectionId':_0x12ca0f['id']},{})['then'](function(){return _0x23e18d;});}else{return _0x23e18d;}})[_0xc9ff('0x4d')](function(_0x7a0901){logger[_0xc9ff('0x2a')](_0xc9ff('0x54'),_0x7a0901);throw _0x7a0901;});}return _0x23e18d;})['then'](respondWithResult(_0x5add17,0xc9))[_0xc9ff('0x4d')](handleError(_0x5add17,null));};exports[_0xc9ff('0x24')]=function(_0x2a7f4d,_0x57d5da){if(_0x2a7f4d['body']['id']){delete _0x2a7f4d[_0xc9ff('0x4e')]['id'];}return db[_0xc9ff('0x2f')]['find']({'where':{'id':_0x2a7f4d[_0xc9ff('0x4a')]['id']}})[_0xc9ff('0x25')](handleEntityNotFound(_0x57d5da,null))[_0xc9ff('0x25')](saveUpdates(_0x2a7f4d[_0xc9ff('0x4e')],null))[_0xc9ff('0x25')](respondWithResult(_0x57d5da,null))[_0xc9ff('0x4d')](handleError(_0x57d5da,null));};exports[_0xc9ff('0x26')]=function(_0x2e55ef,_0x470089){return db[_0xc9ff('0x2f')]['find']({'where':{'id':_0x2e55ef[_0xc9ff('0x4a')]['id']}})[_0xc9ff('0x25')](handleEntityNotFound(_0x470089,null))['then'](removeEntity(_0x470089,null))[_0xc9ff('0x4d')](handleError(_0x470089,null));};exports[_0xc9ff('0x55')]=function(_0x4a1476,_0x2babc2){return db[_0xc9ff('0x2f')]['describe']()[_0xc9ff('0x25')](respondWithResult(_0x2babc2,null))[_0xc9ff('0x4d')](handleError(_0x2babc2,null));};exports[_0xc9ff('0x56')]=function(_0x2b9590,_0x3b2ba5,_0x36ac80){var _0x229d13={'raw':!![],'where':{}},_0x57a531={},_0x4e7fdb;return db['OpenchannelQueue'][_0xc9ff('0x57')]({'where':{'id':_0x2b9590[_0xc9ff('0x4a')]['id']}})[_0xc9ff('0x25')](handleEntityNotFound(_0x3b2ba5,null))['then'](function(_0x4d5a27){if(_0x4d5a27){_0x4e7fdb=_0x4d5a27[_0xc9ff('0x27')]({'plain':!![]});_0x57a531[_0xc9ff('0x37')]=_[_0xc9ff('0x33')](db[_0xc9ff('0x58')][_0xc9ff('0x30')]);_0x57a531[_0xc9ff('0x34')]=_[_0xc9ff('0x33')](_0x2b9590['query']);_0x57a531[_0xc9ff('0x3f')]=_[_0xc9ff('0x35')](_0x57a531['model'],_0x57a531[_0xc9ff('0x34')]);_0x229d13[_0xc9ff('0x36')]=_['intersection'](_0x57a531[_0xc9ff('0x37')],qs['fields'](_0x2b9590[_0xc9ff('0x34')]['fields']));_0x229d13[_0xc9ff('0x36')]=_0x229d13[_0xc9ff('0x36')]['length']?_0x229d13[_0xc9ff('0x36')]:_0x57a531[_0xc9ff('0x37')];if(!_0x2b9590[_0xc9ff('0x34')][_0xc9ff('0x39')](_0xc9ff('0x3a'))){_0x229d13[_0xc9ff('0x3b')]=qs[_0xc9ff('0x3b')](_0x2b9590[_0xc9ff('0x34')][_0xc9ff('0x3b')]);_0x229d13['offset']=qs['offset'](_0x2b9590[_0xc9ff('0x34')][_0xc9ff('0x21')]);}_0x229d13['order']=qs[_0xc9ff('0x3d')](_0x2b9590['query']['sort']);_0x229d13[_0xc9ff('0x3e')]=qs[_0xc9ff('0x3f')](_['pick'](_0x2b9590[_0xc9ff('0x34')],_0x57a531[_0xc9ff('0x3f')]));_0x229d13['where'][_0xc9ff('0x59')]=_0x4d5a27['id'];if(_0x2b9590[_0xc9ff('0x34')]['filter']){_0x229d13[_0xc9ff('0x3e')]=_[_0xc9ff('0x41')](_0x229d13[_0xc9ff('0x3e')],{'$or':_['map'](_0x229d13[_0xc9ff('0x36')],function(_0x42219c){var _0x2dc011={};_0x2dc011[_0x42219c]={'$like':'%'+_0x2b9590['query'][_0xc9ff('0x44')]+'%'};return _0x2dc011;})});}_0x229d13=_[_0xc9ff('0x41')]({},_0x229d13,_0x2b9590[_0xc9ff('0x45')]);return db[_0xc9ff('0x58')][_0xc9ff('0x47')](_0x229d13);}})[_0xc9ff('0x25')](function(_0x262f15){if(_0x262f15){return db[_0xc9ff('0x5a')][_0xc9ff('0x5b')]({'where':{'id':_[_0xc9ff('0x2e')](_0x262f15,_0xc9ff('0x5c')),'role':_0xc9ff('0x5d')},'attributes':['id','name',_0xc9ff('0x5e'),_0xc9ff('0x5f'),_0xc9ff('0x60')]});}})[_0xc9ff('0x25')](function(_0x6fc85f){if(_0x6fc85f){return{'count':_0x6fc85f[_0xc9ff('0x20')],'rows':_[_0xc9ff('0x2e')](_0x6fc85f[_0xc9ff('0x48')],function(_0x297af4){return{'membername':_0x297af4[_0xc9ff('0x2c')],'UserId':_0x297af4['id'],'queue_name':_0x4e7fdb[_0xc9ff('0x2c')],'OpenchannelQueueId':_0x4e7fdb['id'],'interface':util[_0xc9ff('0x61')]('%s/%s',_0xc9ff('0x62'),_0x297af4[_0xc9ff('0x2c')]),'penalty':0x0,'paused':_0x297af4[_0xc9ff('0x5e')],'createdAt':_0x297af4['createdAt'],'updatedAt':_0x297af4[_0xc9ff('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc9ff('0x25')](respondWithFilteredResult(_0x3b2ba5,_0x229d13))[_0xc9ff('0x4d')](handleError(_0x3b2ba5,null));};exports[_0xc9ff('0x63')]=function(_0xe4b2f4,_0xe96427,_0x2257e5){var _0x488ef1={};var _0x5d842f={};var _0x31fdcf;var _0x102442;return db[_0xc9ff('0x2f')]['findOne']({'where':{'id':_0xe4b2f4[_0xc9ff('0x4a')]['id']}})['then'](handleEntityNotFound(_0xe96427,null))[_0xc9ff('0x25')](function(_0x2a47e7){if(_0x2a47e7){_0x31fdcf=_0x2a47e7;_0x5d842f[_0xc9ff('0x37')]=_[_0xc9ff('0x33')](db[_0xc9ff('0x64')][_0xc9ff('0x30')]);_0x5d842f['query']=_[_0xc9ff('0x33')](_0xe4b2f4[_0xc9ff('0x34')]);_0x5d842f['filters']=_[_0xc9ff('0x35')](_0x5d842f[_0xc9ff('0x37')],_0x5d842f[_0xc9ff('0x34')]);_0x488ef1['attributes']=_[_0xc9ff('0x35')](_0x5d842f['model'],qs[_0xc9ff('0x38')](_0xe4b2f4[_0xc9ff('0x34')]['fields']));_0x488ef1[_0xc9ff('0x36')]=_0x488ef1[_0xc9ff('0x36')][_0xc9ff('0x4b')]?_0x488ef1['attributes']:_0x5d842f[_0xc9ff('0x37')];_0x488ef1[_0xc9ff('0x3c')]=qs[_0xc9ff('0x3d')](_0xe4b2f4[_0xc9ff('0x34')][_0xc9ff('0x3d')]);_0x488ef1['where']=qs[_0xc9ff('0x3f')](_[_0xc9ff('0x40')](_0xe4b2f4['query'],_0x5d842f['filters']));if(_0xe4b2f4['query'][_0xc9ff('0x44')]){_0x488ef1['where']=_[_0xc9ff('0x41')](_0x488ef1[_0xc9ff('0x3e')],{'$or':_[_0xc9ff('0x2e')](_0x488ef1[_0xc9ff('0x36')],function(_0x524b80){var _0x327677={};_0x327677[_0x524b80]={'$like':'%'+_0xe4b2f4[_0xc9ff('0x34')][_0xc9ff('0x44')]+'%'};return _0x327677;})});}_0x488ef1=_[_0xc9ff('0x41')]({},_0x488ef1,_0xe4b2f4['options']);return _0x31fdcf[_0xc9ff('0x63')](_0x488ef1);}})['then'](function(_0x4dcd9a){if(_0x4dcd9a){_0x102442=_0x4dcd9a[_0xc9ff('0x4b')];if(!_0xe4b2f4[_0xc9ff('0x34')][_0xc9ff('0x39')]('nolimit')){_0x488ef1[_0xc9ff('0x3b')]=qs[_0xc9ff('0x3b')](_0xe4b2f4[_0xc9ff('0x34')][_0xc9ff('0x3b')]);_0x488ef1[_0xc9ff('0x21')]=qs[_0xc9ff('0x21')](_0xe4b2f4[_0xc9ff('0x34')][_0xc9ff('0x21')]);}return _0x31fdcf[_0xc9ff('0x63')](_0x488ef1);}})[_0xc9ff('0x25')](function(_0x5b7613){if(_0x5b7613){return _0x5b7613?{'count':_0x102442,'rows':_0x5b7613}:null;}})[_0xc9ff('0x25')](respondWithResult(_0xe96427,null))['catch'](handleError(_0xe96427,null));};exports[_0xc9ff('0x65')]=function(_0x9249f2,_0xddf3b,_0x21a720){var _0x52df33=_0x9249f2[_0xc9ff('0x4e')]['ids'];return db[_0xc9ff('0x64')][_0xc9ff('0x47')]({'where':{'id':_0x52df33},'attributes':['id'],'include':[{'model':db[_0xc9ff('0x5a')],'as':_0xc9ff('0x66'),'attributes':['id',_0xc9ff('0x2c'),'online',_0xc9ff('0x67'),_0xc9ff('0x68')],'raw':!![]}]})[_0xc9ff('0x25')](function(_0x2ce7ff){if(_0x2ce7ff){var _0x4b4e21=_['flatMap'](_0x2ce7ff,function(_0x3a7e70){var _0x1b6360=_0x3a7e70[_0xc9ff('0x27')]({'plain':!![]});return _0x1b6360[_0xc9ff('0x66')];});return db[_0xc9ff('0x2f')][_0xc9ff('0x4c')]({'where':{'id':_0x9249f2['params']['id']}})[_0xc9ff('0x25')](function(_0x2f76f2){return db[_0xc9ff('0x69')][_0xc9ff('0x6a')](function(_0x26a37e){return _0x2f76f2[_0xc9ff('0x65')](_0x52df33,{'transaction':_0x26a37e})[_0xc9ff('0x25')](function(){return BPromise[_0xc9ff('0x6b')](_0x4b4e21,function(_0xe4baea){return db[_0xc9ff('0x58')][_0xc9ff('0x6c')]({'where':{'UserId':_0xe4baea['id'],'OpenchannelQueueId':_0x9249f2[_0xc9ff('0x4a')]['id']},'transaction':_0x26a37e});});})[_0xc9ff('0x25')](function(){_0x4b4e21[_0xc9ff('0x6d')](function(_0x23776e){socket['emit'](_0xc9ff('0x6e'),{'UserId':_0x23776e['id'],'OpenchannelQueueId':_0x2f76f2['id']});});});});});}})[_0xc9ff('0x25')](respondWithStatusCode(_0xddf3b,null))[_0xc9ff('0x4d')](handleError(_0xddf3b,null));};exports[_0xc9ff('0x6f')]=function(_0x2871df,_0x32fda1,_0x1d8013){return db[_0xc9ff('0x64')]['findAll']({'where':{'id':_0x2871df['query'][_0xc9ff('0x70')]},'attributes':['id'],'include':[{'model':db[_0xc9ff('0x5a')],'as':_0xc9ff('0x66'),'attributes':['id'],'raw':!![]}]})[_0xc9ff('0x25')](handleEntityNotFound(_0x32fda1,null))[_0xc9ff('0x25')](function(_0x569c48){var _0x47a5de=_[_0xc9ff('0x2e')](_0x569c48,'id');var _0x461790=[];var _0x1126c2=[];var _0x3c5779=squel[_0xc9ff('0x71')]();_0x3c5779[_0xc9ff('0x72')]('tq.TeamId')[_0xc9ff('0x73')](_0xc9ff('0x74'),'tq')[_0xc9ff('0x75')](_0xc9ff('0x76'),'ut',_0xc9ff('0x77'))[_0xc9ff('0x3e')](_0xc9ff('0x78'),_0x2871df['params']['id']);for(var _0x1b2ccf=0x0;_0x1b2ccf<_0x569c48[_0xc9ff('0x4b')];_0x1b2ccf+=0x1){let _0x59ba94=_0x569c48[_0x1b2ccf];for(var _0x204b20=0x0;_0x204b20<_0x59ba94[_0xc9ff('0x66')][_0xc9ff('0x4b')];_0x204b20+=0x1){let _0x45edb1=_0x59ba94[_0xc9ff('0x66')][_0x204b20];var _0x4690d1=_0x3c5779[_0xc9ff('0x79')]();_0x4690d1[_0xc9ff('0x3e')]('ut.UserId\x20=\x20?',_0x45edb1['id']);_0x1126c2['push'](db['sequelize'][_0xc9ff('0x34')](_0x4690d1[_0xc9ff('0x7a')](),{'type':db[_0xc9ff('0x69')][_0xc9ff('0x7b')][_0xc9ff('0x7c')]})['then'](function(_0x43d3e6){if(_0x43d3e6['length']===0x1){return _0x45edb1['id'];}else{var _0x2d49f3=_[_0xc9ff('0x7d')](_[_0xc9ff('0x2e')](_0x43d3e6,_0xc9ff('0x7e')),function(_0x24f55d){return _['includes'](_0x47a5de,_0x24f55d);});if(_0x2d49f3){return _0x45edb1['id'];}}}));}}return BPromise[_0xc9ff('0x7f')](_0x1126c2)[_0xc9ff('0x25')](function(_0x587379){_0x461790=_(_0x461790)[_0xc9ff('0x80')](_0x587379)[_0xc9ff('0x81')]()['value']();return db[_0xc9ff('0x2f')][_0xc9ff('0x4c')]({'where':{'id':_0x2871df[_0xc9ff('0x4a')]['id']}})[_0xc9ff('0x25')](function(_0x49db39){return db[_0xc9ff('0x69')][_0xc9ff('0x6a')](function(_0x2397d0){return _0x49db39[_0xc9ff('0x6f')](_0x2871df[_0xc9ff('0x34')]['ids'],{'transaction':_0x2397d0})[_0xc9ff('0x25')](function(){if(!_[_0xc9ff('0x82')](_0x461790)){return _0x49db39['removeAgents'](_0x461790,{'transaction':_0x2397d0});}})[_0xc9ff('0x25')](function(){_0x461790[_0xc9ff('0x6d')](function(_0x362269){socket[_0xc9ff('0x83')](_0xc9ff('0x84'),{'UserId':_0x362269,'OpenchannelQueueId':_0x49db39['id']});});});});});});})['then'](respondWithStatusCode(_0x32fda1,null))[_0xc9ff('0x4d')](handleError(_0x32fda1,null));};exports[_0xc9ff('0x85')]=function(_0x4a4e41,_0x4d5aba,_0x3e2580){return db[_0xc9ff('0x2f')][_0xc9ff('0x4c')]({'where':{'id':_0x4a4e41['params']['id']}})[_0xc9ff('0x25')](handleEntityNotFound(_0x4d5aba,null))['then'](function(_0x312ff4){if(_0x312ff4){return _0x312ff4[_0xc9ff('0x85')](_0x4a4e41[_0xc9ff('0x4e')][_0xc9ff('0x70')],_[_0xc9ff('0x86')](_0x4a4e41[_0xc9ff('0x4e')],[_0xc9ff('0x70'),'id'])||{})[_0xc9ff('0x87')](function(_0x22f797){for(var _0x26467a=0x0;_0x26467a<_0x4a4e41['body']['ids'][_0xc9ff('0x4b')];_0x26467a+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x4a4e41[_0xc9ff('0x4e')][_0xc9ff('0x70')][_0x26467a],'OpenchannelQueueId':_0x4a4e41[_0xc9ff('0x4a')]['id']});}return _0x22f797;});}})[_0xc9ff('0x25')](respondWithResult(_0x4d5aba,null))[_0xc9ff('0x4d')](handleError(_0x4d5aba,null));};exports[_0xc9ff('0x88')]=function(_0x277caa,_0x131737,_0x1928d4){return db['OpenchannelQueue'][_0xc9ff('0x4c')]({'where':{'id':_0x277caa[_0xc9ff('0x4a')]['id']}})[_0xc9ff('0x25')](handleEntityNotFound(_0x131737,null))[_0xc9ff('0x25')](function(_0x26a7c0){if(_0x26a7c0){return _0x26a7c0['removeAgents'](_0x277caa[_0xc9ff('0x34')][_0xc9ff('0x70')])['then'](function(){if(_[_0xc9ff('0x89')](_0x277caa[_0xc9ff('0x34')]['ids'])){for(var _0xff3a18=0x0;_0xff3a18<_0x277caa[_0xc9ff('0x34')]['ids'][_0xc9ff('0x4b')];_0xff3a18+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x277caa[_0xc9ff('0x34')]['ids'][_0xff3a18]),'OpenchannelQueueId':Number(_0x277caa[_0xc9ff('0x4a')]['id'])});}}else{socket[_0xc9ff('0x83')](_0xc9ff('0x84'),{'UserId':Number(_0x277caa['query']['ids']),'OpenchannelQueueId':Number(_0x277caa['params']['id'])});}});}})[_0xc9ff('0x25')](respondWithStatusCode(_0x131737,null))[_0xc9ff('0x4d')](handleError(_0x131737,null));};exports[_0xc9ff('0x8a')]=function(_0x3f0249,_0x5d5976,_0x356faa){var _0x10e423={};var _0x4b7270={};var _0x22c53b;var _0x15f8ef;return db[_0xc9ff('0x2f')]['findOne']({'where':{'id':_0x3f0249[_0xc9ff('0x4a')]['id']}})[_0xc9ff('0x25')](handleEntityNotFound(_0x5d5976,null))['then'](function(_0x2bd7e7){if(_0x2bd7e7){_0x22c53b=_0x2bd7e7;_0x4b7270[_0xc9ff('0x37')]=_[_0xc9ff('0x33')](db[_0xc9ff('0x5a')][_0xc9ff('0x30')]);_0x4b7270[_0xc9ff('0x34')]=_[_0xc9ff('0x33')](_0x3f0249['query']);_0x4b7270[_0xc9ff('0x3f')]=_[_0xc9ff('0x35')](_0x4b7270['model'],_0x4b7270[_0xc9ff('0x34')]);_0x10e423[_0xc9ff('0x36')]=_[_0xc9ff('0x35')](_0x4b7270['model'],qs['fields'](_0x3f0249[_0xc9ff('0x34')][_0xc9ff('0x38')]));_0x10e423['attributes']=_0x10e423[_0xc9ff('0x36')][_0xc9ff('0x4b')]?_0x10e423[_0xc9ff('0x36')]:_0x4b7270[_0xc9ff('0x37')];_0x10e423['order']=qs[_0xc9ff('0x3d')](_0x3f0249[_0xc9ff('0x34')][_0xc9ff('0x3d')]);_0x10e423['where']=qs[_0xc9ff('0x3f')](_['pick'](_0x3f0249['query'],_0x4b7270[_0xc9ff('0x3f')]));if(_0x3f0249['query']['filter']){_0x10e423[_0xc9ff('0x3e')]=_[_0xc9ff('0x41')](_0x10e423[_0xc9ff('0x3e')],{'$or':_[_0xc9ff('0x2e')](_0x10e423['attributes'],function(_0x564fed){var _0x1e66aa={};_0x1e66aa[_0x564fed]={'$like':'%'+_0x3f0249[_0xc9ff('0x34')]['filter']+'%'};return _0x1e66aa;})});}_0x10e423=_['merge']({},_0x10e423,_0x3f0249[_0xc9ff('0x45')]);return _0x22c53b[_0xc9ff('0x8a')](_0x10e423);}})[_0xc9ff('0x25')](function(_0x499217){if(_0x499217){_0x15f8ef=_0x499217['length'];if(!_0x3f0249[_0xc9ff('0x34')][_0xc9ff('0x39')](_0xc9ff('0x3a'))){_0x10e423['limit']=qs['limit'](_0x3f0249[_0xc9ff('0x34')][_0xc9ff('0x3b')]);_0x10e423[_0xc9ff('0x21')]=qs['offset'](_0x3f0249[_0xc9ff('0x34')][_0xc9ff('0x21')]);}return _0x22c53b[_0xc9ff('0x8a')](_0x10e423);}})[_0xc9ff('0x25')](function(_0x31a050){if(_0x31a050){return _0x31a050?{'count':_0x15f8ef,'rows':_0x31a050}:null;}})['then'](respondWithResult(_0x5d5976,null))[_0xc9ff('0x4d')](handleError(_0x5d5976,null));}; \ No newline at end of file +var _0xf555=['userOpenchannelQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','find','userProfileId','autoAssociation','error','describe','getMembers','findOne','length','sort','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','%s/%s','createdAt','getTeams','Team','addTeams','ids','online','interface','flatMap','sequelize','each','UserOpenchannelQueue','findOrCreate','forEach','emit','User','Agents','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','transaction','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit'];(function(_0x4de563,_0xf0e7e6){var _0x2034dc=function(_0x282d05){while(--_0x282d05){_0x4de563['push'](_0x4de563['shift']());}};_0x2034dc(++_0xf0e7e6);}(_0xf555,0x8f));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5f55('0x0'));var emlformat=require(_0x5f55('0x1'));var rimraf=require(_0x5f55('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5f55('0x3'));var moment=require(_0x5f55('0x4'));var BPromise=require(_0x5f55('0x5'));var Mustache=require(_0x5f55('0x6'));var util=require('util');var path=require(_0x5f55('0x7'));var sox=require('sox');var csv=require(_0x5f55('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5f55('0x9'));var squel=require(_0x5f55('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5f55('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5f55('0xc'));var Papa=require('papaparse');var Redis=require(_0x5f55('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5f55('0xe'));var as=require(_0x5f55('0xf'));var hardwareService=require(_0x5f55('0x10'));var logger=require(_0x5f55('0x11'))(_0x5f55('0x12'));var utils=require(_0x5f55('0x13'));var config=require(_0x5f55('0x14'));var db=require(_0x5f55('0x15'))['db'];config[_0x5f55('0x16')]=_['defaults'](config[_0x5f55('0x16')],{'host':_0x5f55('0x17'),'port':0x18eb});var socket=require(_0x5f55('0x18'))(new Redis(config['redis']));require(_0x5f55('0x19'))[_0x5f55('0x1a')](socket);function respondWithStatusCode(_0x22ddc2,_0x1b23bb){_0x1b23bb=_0x1b23bb||0xcc;return function(_0x5558f4){if(_0x5558f4){return _0x22ddc2['sendStatus'](_0x1b23bb);}return _0x22ddc2[_0x5f55('0x1b')](_0x1b23bb)[_0x5f55('0x1c')]();};}function respondWithResult(_0x4c0b03,_0x2e198c){_0x2e198c=_0x2e198c||0xc8;return function(_0x42ef66){if(_0x42ef66){return _0x4c0b03[_0x5f55('0x1b')](_0x2e198c)[_0x5f55('0x1d')](_0x42ef66);}};}function respondWithFilteredResult(_0x2e864a,_0x349d2e){return function(_0x3f2888){if(_0x3f2888){var _0xf60db9=_0x3f2888[_0x5f55('0x1e')],_0x16e001=_0x349d2e[_0x5f55('0x1f')],_0x5c4472=_0x349d2e[_0x5f55('0x1f')]+_0x349d2e[_0x5f55('0x20')],_0x3f4fa2;if(_0x5c4472>=_0xf60db9){_0x5c4472=_0xf60db9;_0x3f4fa2=0xc8;}else{_0x3f4fa2=0xce;}_0x2e864a[_0x5f55('0x1b')](_0x3f4fa2);return _0x2e864a[_0x5f55('0x21')](_0x5f55('0x22'),_0x16e001+'-'+_0x5c4472+'/'+_0xf60db9)[_0x5f55('0x1d')](_0x3f2888);}return null;};}function patchUpdates(_0x5c55df){return function(_0x5b1ffa){try{jsonpatch[_0x5f55('0x23')](_0x5b1ffa,_0x5c55df,!![]);}catch(_0x17c5ad){return BPromise['reject'](_0x17c5ad);}return _0x5b1ffa[_0x5f55('0x24')]();};}function saveUpdates(_0x4754d5,_0x3f8e94){return function(_0x12b128){if(_0x12b128){return _0x12b128[_0x5f55('0x25')](_0x4754d5)[_0x5f55('0x26')](function(_0x10039c){return _0x10039c;});}return null;};}function removeEntity(_0x18ef8a,_0x13c6c6){return function(_0x31ff5c){if(_0x31ff5c){return _0x31ff5c[_0x5f55('0x27')]()['then'](function(){var _0x4d4261=_0x31ff5c[_0x5f55('0x28')]({'plain':!![]});var _0x38d207='OpenchannelQueues';return db[_0x5f55('0x29')][_0x5f55('0x27')]({'where':{'type':_0x38d207,'resourceId':_0x4d4261['id']}})[_0x5f55('0x26')](function(){return _0x31ff5c;});})['then'](function(){_0x18ef8a[_0x5f55('0x1b')](0xcc)[_0x5f55('0x1c')]();});}};}function handleEntityNotFound(_0x46d334,_0x27f330){return function(_0x14d2b4){if(!_0x14d2b4){_0x46d334[_0x5f55('0x2a')](0x194);}return _0x14d2b4;};}function handleError(_0x5a52e8,_0x22f81d){_0x22f81d=_0x22f81d||0x1f4;return function(_0x335a5d){logger['error'](_0x335a5d['stack']);if(_0x335a5d['name']){delete _0x335a5d[_0x5f55('0x2b')];}_0x5a52e8[_0x5f55('0x1b')](_0x22f81d)['send'](_0x335a5d);};}exports[_0x5f55('0x2c')]=function(_0x5bb4c0,_0x2e2535){var _0x27f0f5={},_0x4f9599={},_0x6af5f1={'count':0x0,'rows':[]};var _0x3c2aa5=_[_0x5f55('0x2d')](db[_0x5f55('0x2e')][_0x5f55('0x2f')],function(_0x394829){return{'name':_0x394829[_0x5f55('0x30')],'type':_0x394829[_0x5f55('0x31')][_0x5f55('0x32')]};});_0x4f9599[_0x5f55('0x33')]=_[_0x5f55('0x2d')](_0x3c2aa5,_0x5f55('0x2b'));_0x4f9599['query']=_[_0x5f55('0x34')](_0x5bb4c0[_0x5f55('0x35')]);_0x4f9599[_0x5f55('0x36')]=_[_0x5f55('0x37')](_0x4f9599[_0x5f55('0x33')],_0x4f9599['query']);_0x27f0f5[_0x5f55('0x38')]=_[_0x5f55('0x37')](_0x4f9599[_0x5f55('0x33')],qs[_0x5f55('0x39')](_0x5bb4c0[_0x5f55('0x35')][_0x5f55('0x39')]));_0x27f0f5['attributes']=_0x27f0f5[_0x5f55('0x38')]['length']?_0x27f0f5[_0x5f55('0x38')]:_0x4f9599[_0x5f55('0x33')];if(!_0x5bb4c0['query'][_0x5f55('0x3a')](_0x5f55('0x3b'))){_0x27f0f5[_0x5f55('0x20')]=qs[_0x5f55('0x20')](_0x5bb4c0[_0x5f55('0x35')][_0x5f55('0x20')]);_0x27f0f5[_0x5f55('0x1f')]=qs['offset'](_0x5bb4c0[_0x5f55('0x35')][_0x5f55('0x1f')]);}_0x27f0f5[_0x5f55('0x3c')]=qs['sort'](_0x5bb4c0[_0x5f55('0x35')]['sort']);_0x27f0f5[_0x5f55('0x3d')]=qs[_0x5f55('0x36')](_[_0x5f55('0x3e')](_0x5bb4c0[_0x5f55('0x35')],_0x4f9599[_0x5f55('0x36')]),_0x3c2aa5);if(_0x5bb4c0[_0x5f55('0x35')][_0x5f55('0x3f')]){_0x27f0f5[_0x5f55('0x3d')]=_[_0x5f55('0x40')](_0x27f0f5['where'],{'$or':_[_0x5f55('0x2d')](_0x3c2aa5,function(_0xeb7cba){if(_0xeb7cba['type']!==_0x5f55('0x41')){var _0x553702={};_0x553702[_0xeb7cba[_0x5f55('0x2b')]]={'$like':'%'+_0x5bb4c0[_0x5f55('0x35')][_0x5f55('0x3f')]+'%'};return _0x553702;}})});}_0x27f0f5=_['merge']({},_0x27f0f5,_0x5bb4c0[_0x5f55('0x42')]);var _0x4bafa2={'where':_0x27f0f5[_0x5f55('0x3d')]};return db[_0x5f55('0x2e')][_0x5f55('0x1e')](_0x4bafa2)[_0x5f55('0x26')](function(_0x5b26ec){_0x6af5f1[_0x5f55('0x1e')]=_0x5b26ec;if(_0x5bb4c0[_0x5f55('0x35')][_0x5f55('0x43')]){_0x27f0f5['include']=[{'all':!![]}];}return db[_0x5f55('0x2e')][_0x5f55('0x44')](_0x27f0f5);})[_0x5f55('0x26')](function(_0x8f45b1){_0x6af5f1[_0x5f55('0x45')]=_0x8f45b1;return _0x6af5f1;})[_0x5f55('0x26')](respondWithFilteredResult(_0x2e2535,_0x27f0f5))[_0x5f55('0x46')](handleError(_0x2e2535,null));};exports[_0x5f55('0x47')]=function(_0x4907f0,_0x531b4f){var _0x5e8eb0={'raw':!![],'where':{'id':_0x4907f0[_0x5f55('0x48')]['id']}},_0x10c9ba={};_0x10c9ba[_0x5f55('0x33')]=_['keys'](db[_0x5f55('0x2e')][_0x5f55('0x2f')]);_0x10c9ba[_0x5f55('0x35')]=_['keys'](_0x4907f0[_0x5f55('0x35')]);_0x10c9ba[_0x5f55('0x36')]=_[_0x5f55('0x37')](_0x10c9ba[_0x5f55('0x33')],_0x10c9ba[_0x5f55('0x35')]);_0x5e8eb0['attributes']=_[_0x5f55('0x37')](_0x10c9ba[_0x5f55('0x33')],qs[_0x5f55('0x39')](_0x4907f0['query'][_0x5f55('0x39')]));_0x5e8eb0[_0x5f55('0x38')]=_0x5e8eb0['attributes']['length']?_0x5e8eb0['attributes']:_0x10c9ba['model'];if(_0x4907f0[_0x5f55('0x35')][_0x5f55('0x43')]){_0x5e8eb0[_0x5f55('0x49')]=[{'all':!![]}];}_0x5e8eb0=_['merge']({},_0x5e8eb0,_0x4907f0['options']);return db[_0x5f55('0x2e')]['find'](_0x5e8eb0)[_0x5f55('0x26')](handleEntityNotFound(_0x531b4f,null))['then'](respondWithResult(_0x531b4f,null))[_0x5f55('0x46')](handleError(_0x531b4f,null));};exports['create']=function(_0x2e0dcd,_0x4d8081){return db[_0x5f55('0x2e')][_0x5f55('0x4a')](_0x2e0dcd[_0x5f55('0x4b')],{})[_0x5f55('0x26')](function(_0x4d1d95){var _0x563a5e=_0x2e0dcd[_0x5f55('0x4c')][_0x5f55('0x28')]({'plain':!![]});if(!_0x563a5e)throw new Error(_0x5f55('0x4d'));if(_0x563a5e[_0x5f55('0x4e')]===_0x5f55('0x4c')){var _0x27429e=_0x4d1d95[_0x5f55('0x28')]({'plain':!![]});var _0x1ae994=_0x5f55('0x4f');return db[_0x5f55('0x50')][_0x5f55('0x51')]({'where':{'name':_0x1ae994,'userProfileId':_0x563a5e[_0x5f55('0x52')]},'raw':!![]})[_0x5f55('0x26')](function(_0x5eb3bf){if(_0x5eb3bf&&_0x5eb3bf[_0x5f55('0x53')]===0x0){return db[_0x5f55('0x29')][_0x5f55('0x4a')]({'name':_0x27429e[_0x5f55('0x2b')],'resourceId':_0x27429e['id'],'type':_0x5eb3bf[_0x5f55('0x2b')],'sectionId':_0x5eb3bf['id']},{})[_0x5f55('0x26')](function(){return _0x4d1d95;});}else{return _0x4d1d95;}})['catch'](function(_0x45a6b3){logger[_0x5f55('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45a6b3);throw _0x45a6b3;});}return _0x4d1d95;})[_0x5f55('0x26')](respondWithResult(_0x4d8081,0xc9))[_0x5f55('0x46')](handleError(_0x4d8081,null));};exports[_0x5f55('0x25')]=function(_0x1a4a44,_0x4d5feb){if(_0x1a4a44[_0x5f55('0x4b')]['id']){delete _0x1a4a44[_0x5f55('0x4b')]['id'];}return db[_0x5f55('0x2e')][_0x5f55('0x51')]({'where':{'id':_0x1a4a44[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x4d5feb,null))[_0x5f55('0x26')](saveUpdates(_0x1a4a44[_0x5f55('0x4b')],null))['then'](respondWithResult(_0x4d5feb,null))['catch'](handleError(_0x4d5feb,null));};exports[_0x5f55('0x27')]=function(_0x40da43,_0x528ecd){return db['OpenchannelQueue']['find']({'where':{'id':_0x40da43[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x528ecd,null))[_0x5f55('0x26')](removeEntity(_0x528ecd,null))[_0x5f55('0x46')](handleError(_0x528ecd,null));};exports['describe']=function(_0x2bcf3f,_0x2d602e){return db[_0x5f55('0x2e')][_0x5f55('0x55')]()[_0x5f55('0x26')](respondWithResult(_0x2d602e,null))[_0x5f55('0x46')](handleError(_0x2d602e,null));};exports[_0x5f55('0x56')]=function(_0x430bef,_0x314c64,_0x58f285){var _0x4e893b={'raw':!![],'where':{}},_0x8d833e={},_0x1ee164;return db[_0x5f55('0x2e')][_0x5f55('0x57')]({'where':{'id':_0x430bef[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x314c64,null))['then'](function(_0x54080a){if(_0x54080a){_0x1ee164=_0x54080a[_0x5f55('0x28')]({'plain':!![]});_0x8d833e['model']=_[_0x5f55('0x34')](db['UserOpenchannelQueue'][_0x5f55('0x2f')]);_0x8d833e[_0x5f55('0x35')]=_[_0x5f55('0x34')](_0x430bef['query']);_0x8d833e[_0x5f55('0x36')]=_['intersection'](_0x8d833e[_0x5f55('0x33')],_0x8d833e['query']);_0x4e893b[_0x5f55('0x38')]=_[_0x5f55('0x37')](_0x8d833e[_0x5f55('0x33')],qs[_0x5f55('0x39')](_0x430bef[_0x5f55('0x35')]['fields']));_0x4e893b[_0x5f55('0x38')]=_0x4e893b[_0x5f55('0x38')][_0x5f55('0x58')]?_0x4e893b[_0x5f55('0x38')]:_0x8d833e[_0x5f55('0x33')];if(!_0x430bef[_0x5f55('0x35')][_0x5f55('0x3a')](_0x5f55('0x3b'))){_0x4e893b[_0x5f55('0x20')]=qs['limit'](_0x430bef[_0x5f55('0x35')][_0x5f55('0x20')]);_0x4e893b[_0x5f55('0x1f')]=qs[_0x5f55('0x1f')](_0x430bef[_0x5f55('0x35')][_0x5f55('0x1f')]);}_0x4e893b[_0x5f55('0x3c')]=qs[_0x5f55('0x59')](_0x430bef['query'][_0x5f55('0x59')]);_0x4e893b[_0x5f55('0x3d')]=qs[_0x5f55('0x36')](_[_0x5f55('0x3e')](_0x430bef[_0x5f55('0x35')],_0x8d833e['filters']));_0x4e893b[_0x5f55('0x3d')][_0x5f55('0x5a')]=_0x54080a['id'];if(_0x430bef[_0x5f55('0x35')][_0x5f55('0x3f')]){_0x4e893b['where']=_[_0x5f55('0x40')](_0x4e893b[_0x5f55('0x3d')],{'$or':_[_0x5f55('0x2d')](_0x4e893b[_0x5f55('0x38')],function(_0x4c27df){var _0x1e4689={};_0x1e4689[_0x4c27df]={'$like':'%'+_0x430bef[_0x5f55('0x35')][_0x5f55('0x3f')]+'%'};return _0x1e4689;})});}_0x4e893b=_[_0x5f55('0x40')]({},_0x4e893b,_0x430bef[_0x5f55('0x42')]);return db['UserOpenchannelQueue']['findAll'](_0x4e893b);}})[_0x5f55('0x26')](function(_0x538b48){if(_0x538b48){return db['User'][_0x5f55('0x5b')]({'where':{'id':_['map'](_0x538b48,_0x5f55('0x5c')),'role':_0x5f55('0x5d')},'attributes':['id',_0x5f55('0x2b'),_0x5f55('0x5e'),_0x5f55('0x5f'),'createdAt']});}})[_0x5f55('0x26')](function(_0x255b0a){if(_0x255b0a){return{'count':_0x255b0a[_0x5f55('0x1e')],'rows':_[_0x5f55('0x2d')](_0x255b0a[_0x5f55('0x45')],function(_0x466ca8){return{'membername':_0x466ca8[_0x5f55('0x2b')],'UserId':_0x466ca8['id'],'queue_name':_0x1ee164[_0x5f55('0x2b')],'OpenchannelQueueId':_0x1ee164['id'],'interface':util['format'](_0x5f55('0x60'),'SIP',_0x466ca8['name']),'penalty':0x0,'paused':_0x466ca8[_0x5f55('0x5e')],'createdAt':_0x466ca8[_0x5f55('0x61')],'updatedAt':_0x466ca8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5f55('0x26')](respondWithFilteredResult(_0x314c64,_0x4e893b))[_0x5f55('0x46')](handleError(_0x314c64,null));};exports[_0x5f55('0x62')]=function(_0x55f306,_0x186247,_0x117e03){var _0x2d6496={};var _0x2f610c={};var _0x40f5da;var _0x2cce9a;return db['OpenchannelQueue'][_0x5f55('0x57')]({'where':{'id':_0x55f306[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x186247,null))['then'](function(_0x264082){if(_0x264082){_0x40f5da=_0x264082;_0x2f610c[_0x5f55('0x33')]=_[_0x5f55('0x34')](db[_0x5f55('0x63')]['rawAttributes']);_0x2f610c[_0x5f55('0x35')]=_[_0x5f55('0x34')](_0x55f306[_0x5f55('0x35')]);_0x2f610c[_0x5f55('0x36')]=_['intersection'](_0x2f610c[_0x5f55('0x33')],_0x2f610c[_0x5f55('0x35')]);_0x2d6496[_0x5f55('0x38')]=_[_0x5f55('0x37')](_0x2f610c[_0x5f55('0x33')],qs[_0x5f55('0x39')](_0x55f306[_0x5f55('0x35')][_0x5f55('0x39')]));_0x2d6496[_0x5f55('0x38')]=_0x2d6496[_0x5f55('0x38')][_0x5f55('0x58')]?_0x2d6496[_0x5f55('0x38')]:_0x2f610c[_0x5f55('0x33')];_0x2d6496[_0x5f55('0x3c')]=qs[_0x5f55('0x59')](_0x55f306[_0x5f55('0x35')]['sort']);_0x2d6496[_0x5f55('0x3d')]=qs[_0x5f55('0x36')](_[_0x5f55('0x3e')](_0x55f306['query'],_0x2f610c[_0x5f55('0x36')]));if(_0x55f306[_0x5f55('0x35')][_0x5f55('0x3f')]){_0x2d6496[_0x5f55('0x3d')]=_[_0x5f55('0x40')](_0x2d6496[_0x5f55('0x3d')],{'$or':_['map'](_0x2d6496['attributes'],function(_0x20ddcc){var _0x2896b6={};_0x2896b6[_0x20ddcc]={'$like':'%'+_0x55f306[_0x5f55('0x35')][_0x5f55('0x3f')]+'%'};return _0x2896b6;})});}_0x2d6496=_[_0x5f55('0x40')]({},_0x2d6496,_0x55f306[_0x5f55('0x42')]);return _0x40f5da[_0x5f55('0x62')](_0x2d6496);}})[_0x5f55('0x26')](function(_0x577c9b){if(_0x577c9b){_0x2cce9a=_0x577c9b[_0x5f55('0x58')];if(!_0x55f306[_0x5f55('0x35')]['hasOwnProperty']('nolimit')){_0x2d6496['limit']=qs['limit'](_0x55f306['query'][_0x5f55('0x20')]);_0x2d6496[_0x5f55('0x1f')]=qs[_0x5f55('0x1f')](_0x55f306['query']['offset']);}return _0x40f5da[_0x5f55('0x62')](_0x2d6496);}})[_0x5f55('0x26')](function(_0x4f0db8){if(_0x4f0db8){return _0x4f0db8?{'count':_0x2cce9a,'rows':_0x4f0db8}:null;}})['then'](respondWithResult(_0x186247,null))[_0x5f55('0x46')](handleError(_0x186247,null));};exports[_0x5f55('0x64')]=function(_0x24c3de,_0xd5d919,_0x548431){var _0x3c2c53=_0x24c3de['body'][_0x5f55('0x65')];return db[_0x5f55('0x63')]['findAll']({'where':{'id':_0x3c2c53},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x5f55('0x2b'),_0x5f55('0x66'),'voicePause',_0x5f55('0x67')],'raw':!![]}]})[_0x5f55('0x26')](function(_0x48cd7c){if(_0x48cd7c){var _0x514551=_[_0x5f55('0x68')](_0x48cd7c,function(_0x298a98){var _0x25eea2=_0x298a98[_0x5f55('0x28')]({'plain':!![]});return _0x25eea2['Agents'];});return db[_0x5f55('0x2e')][_0x5f55('0x51')]({'where':{'id':_0x24c3de[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](function(_0x2cab18){return db[_0x5f55('0x69')]['transaction'](function(_0x432ac9){return _0x2cab18[_0x5f55('0x64')](_0x3c2c53,{'transaction':_0x432ac9})['then'](function(){return BPromise[_0x5f55('0x6a')](_0x514551,function(_0x23e221){return db[_0x5f55('0x6b')][_0x5f55('0x6c')]({'where':{'UserId':_0x23e221['id'],'OpenchannelQueueId':_0x24c3de[_0x5f55('0x48')]['id']},'transaction':_0x432ac9});});})[_0x5f55('0x26')](function(){_0x514551[_0x5f55('0x6d')](function(_0x477376){socket[_0x5f55('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x477376['id'],'OpenchannelQueueId':_0x2cab18['id']});});});});});}})[_0x5f55('0x26')](respondWithStatusCode(_0xd5d919,null))['catch'](handleError(_0xd5d919,null));};exports['removeTeams']=function(_0x369305,_0x40c1f7,_0x4738ae){return db[_0x5f55('0x63')][_0x5f55('0x44')]({'where':{'id':_0x369305[_0x5f55('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5f55('0x6f')],'as':_0x5f55('0x70'),'attributes':['id'],'raw':!![]}]})[_0x5f55('0x26')](handleEntityNotFound(_0x40c1f7,null))[_0x5f55('0x26')](function(_0x16f6d6){var _0xf1f7d0=_[_0x5f55('0x2d')](_0x16f6d6,'id');var _0x2a0deb=[];var _0x3a128e=[];var _0x1ef3e6=squel[_0x5f55('0x71')]();_0x1ef3e6[_0x5f55('0x72')](_0x5f55('0x73'))[_0x5f55('0x74')](_0x5f55('0x75'),'tq')[_0x5f55('0x76')](_0x5f55('0x77'),'ut',_0x5f55('0x78'))[_0x5f55('0x3d')]('OpenchannelQueueId\x20=\x20?',_0x369305[_0x5f55('0x48')]['id']);for(var _0x3f266f=0x0;_0x3f266f<_0x16f6d6[_0x5f55('0x58')];_0x3f266f+=0x1){let _0x5760b2=_0x16f6d6[_0x3f266f];for(var _0x45bc5c=0x0;_0x45bc5c<_0x5760b2[_0x5f55('0x70')][_0x5f55('0x58')];_0x45bc5c+=0x1){let _0x3c7177=_0x5760b2[_0x5f55('0x70')][_0x45bc5c];var _0x48d9c3=_0x1ef3e6[_0x5f55('0x79')]();_0x48d9c3[_0x5f55('0x3d')]('ut.UserId\x20=\x20?',_0x3c7177['id']);_0x3a128e['push'](db['sequelize'][_0x5f55('0x35')](_0x48d9c3[_0x5f55('0x7a')](),{'type':db[_0x5f55('0x69')][_0x5f55('0x7b')][_0x5f55('0x7c')]})[_0x5f55('0x26')](function(_0x438520){if(_0x438520[_0x5f55('0x58')]===0x1){return _0x3c7177['id'];}else{var _0x3d49da=_['every'](_['map'](_0x438520,_0x5f55('0x7d')),function(_0x382e1f){return _[_0x5f55('0x7e')](_0xf1f7d0,_0x382e1f);});if(_0x3d49da){return _0x3c7177['id'];}}}));}}return BPromise[_0x5f55('0x7f')](_0x3a128e)['then'](function(_0x4e3c20){_0x2a0deb=_(_0x2a0deb)['union'](_0x4e3c20)[_0x5f55('0x80')]()[_0x5f55('0x81')]();return db[_0x5f55('0x2e')][_0x5f55('0x51')]({'where':{'id':_0x369305[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](function(_0xd9ae9f){return db['sequelize'][_0x5f55('0x82')](function(_0x3352d2){return _0xd9ae9f[_0x5f55('0x83')](_0x369305[_0x5f55('0x35')][_0x5f55('0x65')],{'transaction':_0x3352d2})[_0x5f55('0x26')](function(){if(!_[_0x5f55('0x84')](_0x2a0deb)){return _0xd9ae9f[_0x5f55('0x85')](_0x2a0deb,{'transaction':_0x3352d2});}})[_0x5f55('0x26')](function(){_0x2a0deb[_0x5f55('0x6d')](function(_0x5006a3){socket[_0x5f55('0x6e')](_0x5f55('0x86'),{'UserId':_0x5006a3,'OpenchannelQueueId':_0xd9ae9f['id']});});});});});});})[_0x5f55('0x26')](respondWithStatusCode(_0x40c1f7,null))['catch'](handleError(_0x40c1f7,null));};exports[_0x5f55('0x87')]=function(_0x294b67,_0x2fc047,_0x1685f7){return db[_0x5f55('0x2e')][_0x5f55('0x51')]({'where':{'id':_0x294b67[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x2fc047,null))[_0x5f55('0x26')](function(_0x15b4b5){if(_0x15b4b5){return _0x15b4b5[_0x5f55('0x87')](_0x294b67['body']['ids'],_[_0x5f55('0x88')](_0x294b67['body'],[_0x5f55('0x65'),'id'])||{})['spread'](function(_0x2265d2){for(var _0xdc8877=0x0;_0xdc8877<_0x294b67['body'][_0x5f55('0x65')]['length'];_0xdc8877+=0x1){socket['emit'](_0x5f55('0x89'),{'UserId':_0x294b67[_0x5f55('0x4b')]['ids'][_0xdc8877],'OpenchannelQueueId':_0x294b67[_0x5f55('0x48')]['id']});}return _0x2265d2;});}})[_0x5f55('0x26')](respondWithResult(_0x2fc047,null))['catch'](handleError(_0x2fc047,null));};exports[_0x5f55('0x85')]=function(_0x5d1a84,_0xefca29,_0x15c927){return db[_0x5f55('0x2e')][_0x5f55('0x51')]({'where':{'id':_0x5d1a84[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0xefca29,null))[_0x5f55('0x26')](function(_0x2e327f){if(_0x2e327f){return _0x2e327f[_0x5f55('0x85')](_0x5d1a84['query']['ids'])[_0x5f55('0x26')](function(){if(_[_0x5f55('0x8a')](_0x5d1a84['query'][_0x5f55('0x65')])){for(var _0x406e4c=0x0;_0x406e4c<_0x5d1a84[_0x5f55('0x35')][_0x5f55('0x65')][_0x5f55('0x58')];_0x406e4c+=0x1){socket['emit'](_0x5f55('0x86'),{'UserId':Number(_0x5d1a84[_0x5f55('0x35')][_0x5f55('0x65')][_0x406e4c]),'OpenchannelQueueId':Number(_0x5d1a84[_0x5f55('0x48')]['id'])});}}else{socket[_0x5f55('0x6e')](_0x5f55('0x86'),{'UserId':Number(_0x5d1a84[_0x5f55('0x35')][_0x5f55('0x65')]),'OpenchannelQueueId':Number(_0x5d1a84[_0x5f55('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0xefca29,null))['catch'](handleError(_0xefca29,null));};exports['getAgents']=function(_0x387a17,_0x187f3b,_0x3de9bb){var _0x192078={};var _0x23c3e0={};var _0x26ee51;var _0x4bf9f8;return db[_0x5f55('0x2e')]['findOne']({'where':{'id':_0x387a17[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x187f3b,null))[_0x5f55('0x26')](function(_0x4a70d8){if(_0x4a70d8){_0x26ee51=_0x4a70d8;_0x23c3e0[_0x5f55('0x33')]=_[_0x5f55('0x34')](db[_0x5f55('0x6f')][_0x5f55('0x2f')]);_0x23c3e0[_0x5f55('0x35')]=_[_0x5f55('0x34')](_0x387a17[_0x5f55('0x35')]);_0x23c3e0['filters']=_[_0x5f55('0x37')](_0x23c3e0[_0x5f55('0x33')],_0x23c3e0[_0x5f55('0x35')]);_0x192078[_0x5f55('0x38')]=_[_0x5f55('0x37')](_0x23c3e0['model'],qs[_0x5f55('0x39')](_0x387a17[_0x5f55('0x35')][_0x5f55('0x39')]));_0x192078[_0x5f55('0x38')]=_0x192078['attributes'][_0x5f55('0x58')]?_0x192078[_0x5f55('0x38')]:_0x23c3e0[_0x5f55('0x33')];_0x192078[_0x5f55('0x3c')]=qs[_0x5f55('0x59')](_0x387a17['query'][_0x5f55('0x59')]);_0x192078['where']=qs[_0x5f55('0x36')](_[_0x5f55('0x3e')](_0x387a17[_0x5f55('0x35')],_0x23c3e0[_0x5f55('0x36')]));if(_0x387a17['query'][_0x5f55('0x3f')]){_0x192078[_0x5f55('0x3d')]=_[_0x5f55('0x40')](_0x192078[_0x5f55('0x3d')],{'$or':_['map'](_0x192078[_0x5f55('0x38')],function(_0x562a8e){var _0x1161df={};_0x1161df[_0x562a8e]={'$like':'%'+_0x387a17['query'][_0x5f55('0x3f')]+'%'};return _0x1161df;})});}_0x192078=_[_0x5f55('0x40')]({},_0x192078,_0x387a17[_0x5f55('0x42')]);return _0x26ee51[_0x5f55('0x8b')](_0x192078);}})[_0x5f55('0x26')](function(_0x141a66){if(_0x141a66){_0x4bf9f8=_0x141a66[_0x5f55('0x58')];if(!_0x387a17[_0x5f55('0x35')][_0x5f55('0x3a')](_0x5f55('0x3b'))){_0x192078['limit']=qs[_0x5f55('0x20')](_0x387a17[_0x5f55('0x35')]['limit']);_0x192078['offset']=qs[_0x5f55('0x1f')](_0x387a17[_0x5f55('0x35')][_0x5f55('0x1f')]);}return _0x26ee51['getAgents'](_0x192078);}})[_0x5f55('0x26')](function(_0x10fd26){if(_0x10fd26){return _0x10fd26?{'count':_0x4bf9f8,'rows':_0x10fd26}:null;}})['then'](respondWithResult(_0x187f3b,null))[_0x5f55('0x46')](handleError(_0x187f3b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index cccbe6b..e8cb441 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 _0x8575=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save','remove'];(function(_0x5d2d9a,_0x28e9ee){var _0x3034da=function(_0x4bd362){while(--_0x4bd362){_0x5d2d9a['push'](_0x5d2d9a['shift']());}};_0x3034da(++_0x28e9ee);}(_0x8575,0x163));var _0x5857=function(_0x2c1bde,_0x318123){_0x2c1bde=_0x2c1bde-0x0;var _0x542efc=_0x8575[_0x2c1bde];return _0x542efc;};'use strict';var EventEmitter=require(_0x5857('0x0'));var OpenchannelQueue=require(_0x5857('0x1'))['db'][_0x5857('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5857('0x3'),'afterUpdate':'update','afterDestroy':_0x5857('0x4')};function emitEvent(_0x1c689b){return function(_0x4a8427,_0x3a93da,_0x26bd7a){OpenchannelQueueEvents[_0x5857('0x5')](_0x1c689b+':'+_0x4a8427['id'],_0x4a8427);OpenchannelQueueEvents[_0x5857('0x5')](_0x1c689b,_0x4a8427);_0x26bd7a(null);};}for(var e in events){if(events[_0x5857('0x6')](e)){var event=events[e];OpenchannelQueue[_0x5857('0x7')](e,emitEvent(event));}}module[_0x5857('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x9bac=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x15d8ae,_0x29fe74){var _0x19598a=function(_0x46593c){while(--_0x46593c){_0x15d8ae['push'](_0x15d8ae['shift']());}};_0x19598a(++_0x29fe74);}(_0x9bac,0x6c));var _0xc9ba=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9bac[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xc9ba('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc9ba('0x1')](0x0);var events={'afterCreate':_0xc9ba('0x2'),'afterUpdate':_0xc9ba('0x3'),'afterDestroy':_0xc9ba('0x4')};function emitEvent(_0x575239){return function(_0x4b9de6,_0x16741d,_0x13dd12){OpenchannelQueueEvents['emit'](_0x575239+':'+_0x4b9de6['id'],_0x4b9de6);OpenchannelQueueEvents[_0xc9ba('0x5')](_0x575239,_0x4b9de6);_0x13dd12(null);};}for(var e in events){if(events[_0xc9ba('0x6')](e)){var event=events[e];OpenchannelQueue[_0xc9ba('0x7')](e,emitEvent(event));}}module[_0xc9ba('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 8c18bac..2d3c1ab 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 _0x5cfd=['OpenchannelQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./openchannelQueue.attributes','exports','define'];(function(_0x38c676,_0x54dd03){var _0x51e800=function(_0x314415){while(--_0x314415){_0x38c676['push'](_0x38c676['shift']());}};_0x51e800(++_0x54dd03);}(_0x5cfd,0x1a3));var _0xd5cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5cfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5cf('0x0'));var util=require(_0xd5cf('0x1'));var logger=require(_0xd5cf('0x2'))(_0xd5cf('0x3'));var moment=require(_0xd5cf('0x4'));var BPromise=require(_0xd5cf('0x5'));var rp=require(_0xd5cf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd5cf('0x7'));module[_0xd5cf('0x8')]=function(_0x3484f5,_0x1f29b2){return _0x3484f5[_0xd5cf('0x9')](_0xd5cf('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6ff=['openchannel_queues','util','api','moment','bluebird','path','./openchannelQueue.attributes','define'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0xa6ff,0x109));var _0xfa6f=function(_0xfabe1,_0x263f08){_0xfabe1=_0xfabe1-0x0;var _0x1750f8=_0xa6ff[_0xfabe1];return _0x1750f8;};'use strict';var _=require('lodash');var util=require(_0xfa6f('0x0'));var logger=require('../../config/logger')(_0xfa6f('0x1'));var moment=require(_0xfa6f('0x2'));var BPromise=require(_0xfa6f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa6f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa6f('0x5'));module['exports']=function(_0x557f9c,_0x5a6ddf){return _0x557f9c[_0xfa6f('0x6')]('OpenchannelQueue',attributes,{'tableName':_0xfa6f('0x7'),'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 f6c0216..d4a1341 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 _0x744b=['info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','find','ShowOpenchannelQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./openchannelQueue.socket','request','then'];(function(_0x362020,_0x3e5804){var _0x13356c=function(_0x1e915f){while(--_0x1e915f){_0x362020['push'](_0x362020['shift']());}};_0x13356c(++_0x3e5804);}(_0x744b,0x160));var _0xb744=function(_0x21ce03,_0x1baada){_0x21ce03=_0x21ce03-0x0;var _0x184974=_0x744b[_0x21ce03];return _0x184974;};'use strict';var _=require(_0xb744('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb744('0x1'));var rs=require(_0xb744('0x2'));var fs=require('fs');var Redis=require(_0xb744('0x3'));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(_0xb744('0x9'));var client=jayson[_0xb744('0xa')]['http']({'port':0x232a});config[_0xb744('0xb')]=_[_0xb744('0xc')](config[_0xb744('0xb')],{'host':_0xb744('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb744('0xb')]));require(_0xb744('0xe'))['register'](socket);function respondWithRpcPromise(_0x390fc0,_0x3c66dc,_0x1195ea){return new BPromise(function(_0x31fbcd,_0x46389c){return client[_0xb744('0xf')](_0x390fc0,_0x1195ea)[_0xb744('0x10')](function(_0x5c39d){logger[_0xb744('0x11')](_0xb744('0x12'),_0x3c66dc,_0xb744('0x13'));logger[_0xb744('0x14')](_0xb744('0x15'),_0x3c66dc,_0xb744('0x13'),JSON[_0xb744('0x16')](_0x5c39d));if(_0x5c39d['error']){if(_0x5c39d[_0xb744('0x17')][_0xb744('0x18')]===0x1f4){logger[_0xb744('0x17')](_0xb744('0x12'),_0x3c66dc,_0x5c39d[_0xb744('0x17')][_0xb744('0x19')]);return _0x46389c(_0x5c39d[_0xb744('0x17')]['message']);}logger[_0xb744('0x17')](_0xb744('0x12'),_0x3c66dc,_0x5c39d[_0xb744('0x17')][_0xb744('0x19')]);return _0x31fbcd(_0x5c39d[_0xb744('0x17')][_0xb744('0x19')]);}else{logger[_0xb744('0x11')](_0xb744('0x12'),_0x3c66dc,_0xb744('0x13'));_0x31fbcd(_0x5c39d[_0xb744('0x1a')]['message']);}})[_0xb744('0x1b')](function(_0x4ce4da){logger[_0xb744('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x3c66dc,_0x4ce4da);_0x46389c(_0x4ce4da);});});}exports['GetOpenchannelQueue']=function(_0x5da425){var _0x510d58=this;return new Promise(function(_0x26d215,_0x5e28e1){return db[_0xb744('0x1c')][_0xb744('0x1d')]({'raw':_0x5da425[_0xb744('0x1e')]?_0x5da425[_0xb744('0x1e')][_0xb744('0x1f')]===undefined?!![]:![]:!![],'where':_0x5da425[_0xb744('0x1e')]?_0x5da425[_0xb744('0x1e')][_0xb744('0x20')]||null:null,'attributes':_0x5da425[_0xb744('0x1e')]?_0x5da425[_0xb744('0x1e')][_0xb744('0x21')]||null:null,'limit':_0x5da425[_0xb744('0x1e')]?_0x5da425[_0xb744('0x1e')][_0xb744('0x22')]||null:null,'include':_0x5da425[_0xb744('0x1e')]?_0x5da425[_0xb744('0x1e')][_0xb744('0x23')]?_[_0xb744('0x24')](_0x5da425[_0xb744('0x1e')][_0xb744('0x23')],function(_0x1dfbb3){return{'model':db[_0x1dfbb3[_0xb744('0x25')]],'as':_0x1dfbb3['as'],'attributes':_0x1dfbb3[_0xb744('0x21')],'include':_0x1dfbb3[_0xb744('0x23')]?_[_0xb744('0x24')](_0x1dfbb3[_0xb744('0x23')],function(_0x1b344e){return{'model':db[_0x1b344e[_0xb744('0x25')]],'as':_0x1b344e['as'],'attributes':_0x1b344e[_0xb744('0x21')],'include':_0x1b344e[_0xb744('0x23')]?_[_0xb744('0x24')](_0x1b344e[_0xb744('0x23')],function(_0x138380){return{'model':db[_0x138380[_0xb744('0x25')]],'as':_0x138380['as'],'attributes':_0x138380[_0xb744('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb744('0x10')](function(_0x1d4c1d){logger['info'](_0xb744('0x26'),_0x5da425);logger['debug'](_0xb744('0x26'),_0x5da425,JSON[_0xb744('0x16')](_0x1d4c1d));_0x26d215(_0x1d4c1d);})[_0xb744('0x1b')](function(_0x16976d){logger[_0xb744('0x17')]('GetOpenchannelQueue',_0x16976d[_0xb744('0x19')],_0x5da425);_0x5e28e1(_0x510d58['error'](0x1f4,_0x16976d[_0xb744('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x24886f){var _0x548bc5=this;return new Promise(function(_0x185e84,_0x67e1a){return db[_0xb744('0x1c')][_0xb744('0x27')]({'raw':_0x24886f[_0xb744('0x1e')]?_0x24886f[_0xb744('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x24886f['options']?_0x24886f[_0xb744('0x1e')]['where']||null:null,'attributes':_0x24886f['options']?_0x24886f[_0xb744('0x1e')][_0xb744('0x21')]||null:null,'include':_0x24886f[_0xb744('0x1e')]?_0x24886f['options'][_0xb744('0x23')]?_['map'](_0x24886f['options']['include'],function(_0xa7557e){return{'model':db[_0xa7557e[_0xb744('0x25')]],'as':_0xa7557e['as'],'attributes':_0xa7557e['attributes'],'include':_0xa7557e[_0xb744('0x23')]?_[_0xb744('0x24')](_0xa7557e[_0xb744('0x23')],function(_0x225f95){return{'model':db[_0x225f95['model']],'as':_0x225f95['as'],'attributes':_0x225f95['attributes'],'include':_0x225f95['include']?_[_0xb744('0x24')](_0x225f95[_0xb744('0x23')],function(_0x1d0ca5){return{'model':db[_0x1d0ca5[_0xb744('0x25')]],'as':_0x1d0ca5['as'],'attributes':_0x1d0ca5[_0xb744('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb744('0x10')](function(_0x381e0f){logger['info']('ShowOpenchannelQueue',_0x24886f);logger[_0xb744('0x14')](_0xb744('0x28'),_0x24886f,JSON[_0xb744('0x16')](_0x381e0f));_0x185e84(_0x381e0f);})[_0xb744('0x1b')](function(_0x293d91){logger[_0xb744('0x17')](_0xb744('0x28'),_0x293d91['message'],_0x24886f);_0x67e1a(_0x548bc5['error'](0x1f4,_0x293d91['message']));});});}; \ No newline at end of file +var _0x4235=['socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','limit','map','include','model','attributes','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4235,0x18c));var _0x5423=function(_0x4e7b46,_0x1e5718){_0x4e7b46=_0x4e7b46-0x0;var _0x309599=_0x4235[_0x4e7b46];return _0x309599;};'use strict';var _=require(_0x5423('0x0'));var util=require(_0x5423('0x1'));var moment=require(_0x5423('0x2'));var BPromise=require(_0x5423('0x3'));var rs=require(_0x5423('0x4'));var fs=require('fs');var Redis=require(_0x5423('0x5'));var db=require(_0x5423('0x6'))['db'];var utils=require(_0x5423('0x7'));var logger=require(_0x5423('0x8'))(_0x5423('0x9'));var config=require(_0x5423('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5423('0xb')]=_[_0x5423('0xc')](config['redis'],{'host':_0x5423('0xd'),'port':0x18eb});var socket=require(_0x5423('0xe'))(new Redis(config['redis']));require(_0x5423('0xf'))[_0x5423('0x10')](socket);function respondWithRpcPromise(_0x2dbed3,_0x16b910,_0x17289a){return new BPromise(function(_0x5c9fe8,_0x22d32e){return client[_0x5423('0x11')](_0x2dbed3,_0x17289a)[_0x5423('0x12')](function(_0x4ffe6b){logger['info'](_0x5423('0x13'),_0x16b910,_0x5423('0x14'));logger[_0x5423('0x15')](_0x5423('0x16'),_0x16b910,_0x5423('0x14'),JSON[_0x5423('0x17')](_0x4ffe6b));if(_0x4ffe6b[_0x5423('0x18')]){if(_0x4ffe6b['error'][_0x5423('0x19')]===0x1f4){logger[_0x5423('0x18')](_0x5423('0x13'),_0x16b910,_0x4ffe6b[_0x5423('0x18')]['message']);return _0x22d32e(_0x4ffe6b[_0x5423('0x18')][_0x5423('0x1a')]);}logger['error'](_0x5423('0x13'),_0x16b910,_0x4ffe6b[_0x5423('0x18')][_0x5423('0x1a')]);return _0x5c9fe8(_0x4ffe6b[_0x5423('0x18')]['message']);}else{logger[_0x5423('0x1b')](_0x5423('0x13'),_0x16b910,_0x5423('0x14'));_0x5c9fe8(_0x4ffe6b['result'][_0x5423('0x1a')]);}})[_0x5423('0x1c')](function(_0x3d53bd){logger['error'](_0x5423('0x13'),_0x16b910,_0x3d53bd);_0x22d32e(_0x3d53bd);});});}exports[_0x5423('0x1d')]=function(_0x511ed8){var _0x599c08=this;return new Promise(function(_0x15c174,_0x49cb41){return db[_0x5423('0x1e')]['findAll']({'raw':_0x511ed8[_0x5423('0x1f')]?_0x511ed8[_0x5423('0x1f')][_0x5423('0x20')]===undefined?!![]:![]:!![],'where':_0x511ed8[_0x5423('0x1f')]?_0x511ed8[_0x5423('0x1f')][_0x5423('0x21')]||null:null,'attributes':_0x511ed8[_0x5423('0x1f')]?_0x511ed8[_0x5423('0x1f')]['attributes']||null:null,'limit':_0x511ed8[_0x5423('0x1f')]?_0x511ed8['options'][_0x5423('0x22')]||null:null,'include':_0x511ed8[_0x5423('0x1f')]?_0x511ed8[_0x5423('0x1f')]['include']?_[_0x5423('0x23')](_0x511ed8[_0x5423('0x1f')][_0x5423('0x24')],function(_0x37aed6){return{'model':db[_0x37aed6[_0x5423('0x25')]],'as':_0x37aed6['as'],'attributes':_0x37aed6[_0x5423('0x26')],'include':_0x37aed6[_0x5423('0x24')]?_['map'](_0x37aed6[_0x5423('0x24')],function(_0x26a7f2){return{'model':db[_0x26a7f2[_0x5423('0x25')]],'as':_0x26a7f2['as'],'attributes':_0x26a7f2[_0x5423('0x26')],'include':_0x26a7f2[_0x5423('0x24')]?_['map'](_0x26a7f2[_0x5423('0x24')],function(_0x2fef48){return{'model':db[_0x2fef48[_0x5423('0x25')]],'as':_0x2fef48['as'],'attributes':_0x2fef48[_0x5423('0x26')]};}):[]};}):[]};}):[]:[]})[_0x5423('0x12')](function(_0xa79dca){logger[_0x5423('0x1b')]('GetOpenchannelQueue',_0x511ed8);logger[_0x5423('0x15')](_0x5423('0x1d'),_0x511ed8,JSON[_0x5423('0x17')](_0xa79dca));_0x15c174(_0xa79dca);})['catch'](function(_0x756ed1){logger[_0x5423('0x18')](_0x5423('0x1d'),_0x756ed1[_0x5423('0x1a')],_0x511ed8);_0x49cb41(_0x599c08[_0x5423('0x18')](0x1f4,_0x756ed1[_0x5423('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x484169){var _0x12578e=this;return new Promise(function(_0x95cafc,_0x30f120){return db['OpenchannelQueue'][_0x5423('0x27')]({'raw':_0x484169['options']?_0x484169[_0x5423('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x484169['options']?_0x484169[_0x5423('0x1f')][_0x5423('0x21')]||null:null,'attributes':_0x484169['options']?_0x484169[_0x5423('0x1f')]['attributes']||null:null,'include':_0x484169['options']?_0x484169[_0x5423('0x1f')][_0x5423('0x24')]?_['map'](_0x484169['options'][_0x5423('0x24')],function(_0x5b221b){return{'model':db[_0x5b221b[_0x5423('0x25')]],'as':_0x5b221b['as'],'attributes':_0x5b221b[_0x5423('0x26')],'include':_0x5b221b[_0x5423('0x24')]?_[_0x5423('0x23')](_0x5b221b[_0x5423('0x24')],function(_0x3b4487){return{'model':db[_0x3b4487[_0x5423('0x25')]],'as':_0x3b4487['as'],'attributes':_0x3b4487['attributes'],'include':_0x3b4487[_0x5423('0x24')]?_[_0x5423('0x23')](_0x3b4487['include'],function(_0x74142){return{'model':db[_0x74142[_0x5423('0x25')]],'as':_0x74142['as'],'attributes':_0x74142[_0x5423('0x26')]};}):[]};}):[]};}):[]:[]})[_0x5423('0x12')](function(_0x57bd1f){logger[_0x5423('0x1b')](_0x5423('0x28'),_0x484169);logger[_0x5423('0x15')](_0x5423('0x28'),_0x484169,JSON['stringify'](_0x57bd1f));_0x95cafc(_0x57bd1f);})[_0x5423('0x1c')](function(_0x10844f){logger['error'](_0x5423('0x28'),_0x10844f['message'],_0x484169);_0x30f120(_0x12578e[_0x5423('0x18')](0x1f4,_0x10844f['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index c89cdf6..33a1d09 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 _0x82c0=['openchannelQueue:','./openchannelQueue.events','update','emit','removeListener','length'];(function(_0x3b7fb7,_0x30abbb){var _0x34da82=function(_0x1177ae){while(--_0x1177ae){_0x3b7fb7['push'](_0x3b7fb7['shift']());}};_0x34da82(++_0x30abbb);}(_0x82c0,0x73));var _0x082c=function(_0x4dfd7e,_0x198f79){_0x4dfd7e=_0x4dfd7e-0x0;var _0x36556f=_0x82c0[_0x4dfd7e];return _0x36556f;};'use strict';var OpenchannelQueueEvents=require(_0x082c('0x0'));var events=['save','remove',_0x082c('0x1')];function createListener(_0x4c5740,_0x2a8170){return function(_0x30e08e){_0x2a8170[_0x082c('0x2')](_0x4c5740,_0x30e08e);};}function removeListener(_0x37cf56,_0x289f6d){return function(){OpenchannelQueueEvents[_0x082c('0x3')](_0x37cf56,_0x289f6d);};}exports['register']=function(_0x997d5b){for(var _0x28aa64=0x0,_0x57912d=events[_0x082c('0x4')];_0x28aa64<_0x57912d;_0x28aa64++){var _0x39d449=events[_0x28aa64];var _0x55c4d9=createListener(_0x082c('0x5')+_0x39d449,_0x997d5b);OpenchannelQueueEvents['on'](_0x39d449,_0x55c4d9);}}; \ No newline at end of file +var _0x2532=['register','length','openchannelQueue:','./openchannelQueue.events','remove','update','removeListener'];(function(_0x87bbee,_0x1304a3){var _0x7e262f=function(_0x4a4096){while(--_0x4a4096){_0x87bbee['push'](_0x87bbee['shift']());}};_0x7e262f(++_0x1304a3);}(_0x2532,0xc7));var _0x2253=function(_0x317d5a,_0x54a251){_0x317d5a=_0x317d5a-0x0;var _0x49bdcf=_0x2532[_0x317d5a];return _0x49bdcf;};'use strict';var OpenchannelQueueEvents=require(_0x2253('0x0'));var events=['save',_0x2253('0x1'),_0x2253('0x2')];function createListener(_0x341968,_0x43dcd3){return function(_0x3793ec){_0x43dcd3['emit'](_0x341968,_0x3793ec);};}function removeListener(_0x103c5b,_0xa3626d){return function(){OpenchannelQueueEvents[_0x2253('0x3')](_0x103c5b,_0xa3626d);};}exports[_0x2253('0x4')]=function(_0x310062){for(var _0x4cbbf0=0x0,_0x221225=events[_0x2253('0x5')];_0x4cbbf0<_0x221225;_0x4cbbf0++){var _0x1533be=events[_0x4cbbf0];var _0x4f43ee=createListener(_0x2253('0x6')+_0x1533be,_0x310062);OpenchannelQueueEvents['on'](_0x1533be,_0x4f43ee);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index c9917f1..49ccb11 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 _0x203c=['util','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','update','delete','exports','multer'];(function(_0x49d73a,_0x37ea42){var _0x1b05e1=function(_0x8ac987){while(--_0x8ac987){_0x49d73a['push'](_0x49d73a['shift']());}};_0x1b05e1(++_0x37ea42);}(_0x203c,0xa4));var _0xc203=function(_0x1be5a3,_0x1f80f2){_0x1be5a3=_0x1be5a3-0x0;var _0x53b728=_0x203c[_0x1be5a3];return _0x53b728;};'use strict';var multer=require(_0xc203('0x0'));var util=require(_0xc203('0x1'));var path=require('path');var timeout=require(_0xc203('0x2'));var express=require('express');var router=express[_0xc203('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc203('0x4'));var config=require(_0xc203('0x5'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0xc203('0x6')](),controller['index']);router[_0xc203('0x7')](_0xc203('0x8'),auth[_0xc203('0x6')](),controller[_0xc203('0x9')]);router[_0xc203('0x7')](_0xc203('0xa'),auth['isAuthenticated'](),controller[_0xc203('0xb')]);router['post']('/',auth[_0xc203('0x6')](),controller['create']);router['put'](_0xc203('0xa'),auth[_0xc203('0x6')](),controller[_0xc203('0xc')]);router[_0xc203('0xd')](_0xc203('0xa'),auth[_0xc203('0x6')](),controller['destroy']);module[_0xc203('0xe')]=router; \ No newline at end of file +var _0x1ec5=['/:id','post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x10f1ae,_0x5a9262){var _0xbdd5db=function(_0x39e3cb){while(--_0x39e3cb){_0x10f1ae['push'](_0x10f1ae['shift']());}};_0xbdd5db(++_0x5a9262);}(_0x1ec5,0xc4));var _0x51ec=function(_0x275025,_0x43ea6b){_0x275025=_0x275025-0x0;var _0x713d25=_0x1ec5[_0x275025];return _0x713d25;};'use strict';var multer=require(_0x51ec('0x0'));var util=require(_0x51ec('0x1'));var path=require('path');var timeout=require(_0x51ec('0x2'));var express=require(_0x51ec('0x3'));var router=express[_0x51ec('0x4')]();var auth=require(_0x51ec('0x5'));var interaction=require(_0x51ec('0x6'));var config=require(_0x51ec('0x7'));var controller=require(_0x51ec('0x8'));router[_0x51ec('0x9')]('/',auth[_0x51ec('0xa')](),controller[_0x51ec('0xb')]);router[_0x51ec('0x9')](_0x51ec('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x51ec('0x9')](_0x51ec('0xd'),auth[_0x51ec('0xa')](),controller['show']);router[_0x51ec('0xe')]('/',auth[_0x51ec('0xa')](),controller['create']);router[_0x51ec('0xf')](_0x51ec('0xd'),auth[_0x51ec('0xa')](),controller['update']);router[_0x51ec('0x10')]('/:id',auth[_0x51ec('0xa')](),controller[_0x51ec('0x11')]);module[_0x51ec('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index d9bba2e..8bb7aad 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 _0x92ab=['STRING','DATE','moment','exports'];(function(_0x41446c,_0x54a35b){var _0x14203f=function(_0x137800){while(--_0x137800){_0x41446c['push'](_0x41446c['shift']());}};_0x14203f(++_0x54a35b);}(_0x92ab,0x1a6));var _0xb92a=function(_0x472872,_0x1cfdb7){_0x472872=_0x472872-0x0;var _0x47c1f2=_0x92ab[_0x472872];return _0x47c1f2;};'use strict';var moment=require(_0xb92a('0x0'));var Sequelize=require('sequelize');module[_0xb92a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb92a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb92a('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb92a('0x3')]},'reason':{'type':Sequelize[_0xb92a('0x2')]}}; \ No newline at end of file +var _0x0aa6=['exports','STRING','DATE','moment','sequelize'];(function(_0x1ee093,_0x55a008){var _0x2485b8=function(_0x516a90){while(--_0x516a90){_0x1ee093['push'](_0x1ee093['shift']());}};_0x2485b8(++_0x55a008);}(_0x0aa6,0x116));var _0x60aa=function(_0x3ca375,_0x3807c8){_0x3ca375=_0x3ca375-0x0;var _0x28cec3=_0x0aa6[_0x3ca375];return _0x28cec3;};'use strict';var moment=require(_0x60aa('0x0'));var Sequelize=require(_0x60aa('0x1'));module[_0x60aa('0x2')]={'uniqueid':{'type':Sequelize[_0x60aa('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x60aa('0x4')]},'leaveAt':{'type':Sequelize[_0x60aa('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x60aa('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index cb1ed7d..07bd09a 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 _0x964b=['apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','body','update','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range'];(function(_0xc17940,_0x2e38fa){var _0x4ef1c8=function(_0x188168){while(--_0x188168){_0xc17940['push'](_0xc17940['shift']());}};_0x4ef1c8(++_0x2e38fa);}(_0x964b,0x112));var _0xb964=function(_0xff2a3b,_0xb3d7a4){_0xff2a3b=_0xff2a3b-0x0;var _0x5a816d=_0x964b[_0xff2a3b];return _0x5a816d;};'use strict';var pdf=require(_0xb964('0x0'));var emlformat=require(_0xb964('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb964('0x2'));var jsonpatch=require(_0xb964('0x3'));var rp=require(_0xb964('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb964('0x5'));var util=require('util');var path=require(_0xb964('0x6'));var sox=require(_0xb964('0x7'));var csv=require(_0xb964('0x8'));var ejs=require(_0xb964('0x9'));var fs=require('fs');var _=require(_0xb964('0xa'));var squel=require(_0xb964('0xb'));var crypto=require(_0xb964('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb964('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb964('0xd'));var authService=require(_0xb964('0xe'));var qs=require(_0xb964('0xf'));var as=require(_0xb964('0x10'));var hardwareService=require(_0xb964('0x11'));var logger=require(_0xb964('0x12'))('api');var utils=require(_0xb964('0x13'));var config=require(_0xb964('0x14'));var db=require(_0xb964('0x15'))['db'];function respondWithStatusCode(_0x30c217,_0x4e7e0f){_0x4e7e0f=_0x4e7e0f||0xcc;return function(_0x2137db){if(_0x2137db){return _0x30c217['sendStatus'](_0x4e7e0f);}return _0x30c217['status'](_0x4e7e0f)[_0xb964('0x16')]();};}function respondWithResult(_0x256e02,_0xe111d2){_0xe111d2=_0xe111d2||0xc8;return function(_0x407f8c){if(_0x407f8c){return _0x256e02[_0xb964('0x17')](_0xe111d2)[_0xb964('0x18')](_0x407f8c);}};}function respondWithFilteredResult(_0x3d5baa,_0x59965c){return function(_0x3f507a){if(_0x3f507a){var _0x5a2ce4=_0x3f507a[_0xb964('0x19')],_0x538d2e=_0x59965c[_0xb964('0x1a')],_0xd775d5=_0x59965c[_0xb964('0x1a')]+_0x59965c[_0xb964('0x1b')],_0x19eb59;if(_0xd775d5>=_0x5a2ce4){_0xd775d5=_0x5a2ce4;_0x19eb59=0xc8;}else{_0x19eb59=0xce;}_0x3d5baa[_0xb964('0x17')](_0x19eb59);return _0x3d5baa[_0xb964('0x1c')](_0xb964('0x1d'),_0x538d2e+'-'+_0xd775d5+'/'+_0x5a2ce4)['json'](_0x3f507a);}return null;};}function patchUpdates(_0x54da04){return function(_0x49a066){try{jsonpatch[_0xb964('0x1e')](_0x49a066,_0x54da04,!![]);}catch(_0x42e78e){return BPromise[_0xb964('0x1f')](_0x42e78e);}return _0x49a066[_0xb964('0x20')]();};}function saveUpdates(_0x12056d,_0x5a49ac){return function(_0x52c497){if(_0x52c497){return _0x52c497['update'](_0x12056d)[_0xb964('0x21')](function(_0x457f43){return _0x457f43;});}return null;};}function removeEntity(_0x30d78f,_0x4e5160){return function(_0x3cc265){if(_0x3cc265){return _0x3cc265[_0xb964('0x22')]()[_0xb964('0x21')](function(){_0x30d78f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x114124,_0x5469c2){return function(_0x14dece){if(!_0x14dece){_0x114124[_0xb964('0x23')](0x194);}return _0x14dece;};}function handleError(_0x2b9b74,_0x446e1b){_0x446e1b=_0x446e1b||0x1f4;return function(_0x51257e){logger[_0xb964('0x24')](_0x51257e[_0xb964('0x25')]);if(_0x51257e[_0xb964('0x26')]){delete _0x51257e[_0xb964('0x26')];}_0x2b9b74[_0xb964('0x17')](_0x446e1b)[_0xb964('0x27')](_0x51257e);};}exports[_0xb964('0x28')]=function(_0x1626f2,_0x142f76){var _0x4d82e2={},_0x2b5b7d={},_0x273ca4={'count':0x0,'rows':[]};var _0x9e2530=_[_0xb964('0x29')](db[_0xb964('0x2a')][_0xb964('0x2b')],function(_0x20b89a){return{'name':_0x20b89a['fieldName'],'type':_0x20b89a[_0xb964('0x2c')][_0xb964('0x2d')]};});_0x2b5b7d[_0xb964('0x2e')]=_['map'](_0x9e2530,_0xb964('0x26'));_0x2b5b7d[_0xb964('0x2f')]=_[_0xb964('0x30')](_0x1626f2[_0xb964('0x2f')]);_0x2b5b7d[_0xb964('0x31')]=_[_0xb964('0x32')](_0x2b5b7d['model'],_0x2b5b7d['query']);_0x4d82e2[_0xb964('0x33')]=_[_0xb964('0x32')](_0x2b5b7d[_0xb964('0x2e')],qs[_0xb964('0x34')](_0x1626f2['query'][_0xb964('0x34')]));_0x4d82e2['attributes']=_0x4d82e2[_0xb964('0x33')][_0xb964('0x35')]?_0x4d82e2['attributes']:_0x2b5b7d['model'];if(!_0x1626f2[_0xb964('0x2f')][_0xb964('0x36')](_0xb964('0x37'))){_0x4d82e2[_0xb964('0x1b')]=qs[_0xb964('0x1b')](_0x1626f2[_0xb964('0x2f')]['limit']);_0x4d82e2['offset']=qs['offset'](_0x1626f2[_0xb964('0x2f')][_0xb964('0x1a')]);}_0x4d82e2[_0xb964('0x38')]=qs[_0xb964('0x39')](_0x1626f2[_0xb964('0x2f')][_0xb964('0x39')]);_0x4d82e2['where']=qs['filters'](_[_0xb964('0x3a')](_0x1626f2[_0xb964('0x2f')],_0x2b5b7d[_0xb964('0x31')]),_0x9e2530);if(_0x1626f2[_0xb964('0x2f')][_0xb964('0x3b')]){_0x4d82e2['where']=_[_0xb964('0x3c')](_0x4d82e2[_0xb964('0x3d')],{'$or':_[_0xb964('0x29')](_0x9e2530,function(_0x5f3244){if(_0x5f3244[_0xb964('0x2c')]!==_0xb964('0x3e')){var _0x4286c3={};_0x4286c3[_0x5f3244['name']]={'$like':'%'+_0x1626f2[_0xb964('0x2f')]['filter']+'%'};return _0x4286c3;}})});}_0x4d82e2=_[_0xb964('0x3c')]({},_0x4d82e2,_0x1626f2['options']);var _0xb0891={'where':_0x4d82e2[_0xb964('0x3d')]};return db['OpenchannelQueueReport']['count'](_0xb0891)[_0xb964('0x21')](function(_0x3f74fb){_0x273ca4[_0xb964('0x19')]=_0x3f74fb;if(_0x1626f2[_0xb964('0x2f')][_0xb964('0x3f')]){_0x4d82e2['include']=[{'all':!![]}];}return db[_0xb964('0x2a')][_0xb964('0x40')](_0x4d82e2);})[_0xb964('0x21')](function(_0x5e8208){_0x273ca4[_0xb964('0x41')]=_0x5e8208;return _0x273ca4;})[_0xb964('0x21')](respondWithFilteredResult(_0x142f76,_0x4d82e2))[_0xb964('0x42')](handleError(_0x142f76,null));};exports[_0xb964('0x43')]=function(_0x33cfd,_0x57b735){var _0xe962f9={'raw':!![],'where':{'id':_0x33cfd['params']['id']}},_0x1643e7={};_0x1643e7[_0xb964('0x2e')]=_[_0xb964('0x30')](db[_0xb964('0x2a')][_0xb964('0x2b')]);_0x1643e7['query']=_['keys'](_0x33cfd[_0xb964('0x2f')]);_0x1643e7[_0xb964('0x31')]=_[_0xb964('0x32')](_0x1643e7[_0xb964('0x2e')],_0x1643e7[_0xb964('0x2f')]);_0xe962f9[_0xb964('0x33')]=_[_0xb964('0x32')](_0x1643e7[_0xb964('0x2e')],qs['fields'](_0x33cfd[_0xb964('0x2f')]['fields']));_0xe962f9[_0xb964('0x33')]=_0xe962f9[_0xb964('0x33')][_0xb964('0x35')]?_0xe962f9['attributes']:_0x1643e7[_0xb964('0x2e')];if(_0x33cfd[_0xb964('0x2f')][_0xb964('0x3f')]){_0xe962f9[_0xb964('0x44')]=[{'all':!![]}];}_0xe962f9=_[_0xb964('0x3c')]({},_0xe962f9,_0x33cfd[_0xb964('0x45')]);return db[_0xb964('0x2a')][_0xb964('0x46')](_0xe962f9)[_0xb964('0x21')](handleEntityNotFound(_0x57b735,null))['then'](respondWithResult(_0x57b735,null))['catch'](handleError(_0x57b735,null));};exports['create']=function(_0x12c58f,_0xe4e024){return db['OpenchannelQueueReport'][_0xb964('0x47')](_0x12c58f[_0xb964('0x48')],{})['then'](respondWithResult(_0xe4e024,0xc9))['catch'](handleError(_0xe4e024,null));};exports[_0xb964('0x49')]=function(_0x429d9d,_0x562261){if(_0x429d9d[_0xb964('0x48')]['id']){delete _0x429d9d['body']['id'];}return db[_0xb964('0x2a')]['find']({'where':{'id':_0x429d9d[_0xb964('0x4a')]['id']}})[_0xb964('0x21')](handleEntityNotFound(_0x562261,null))[_0xb964('0x21')](saveUpdates(_0x429d9d[_0xb964('0x48')],null))[_0xb964('0x21')](respondWithResult(_0x562261,null))[_0xb964('0x42')](handleError(_0x562261,null));};exports[_0xb964('0x22')]=function(_0x266121,_0x591a20){return db[_0xb964('0x2a')][_0xb964('0x46')]({'where':{'id':_0x266121[_0xb964('0x4a')]['id']}})[_0xb964('0x21')](handleEntityNotFound(_0x591a20,null))['then'](removeEntity(_0x591a20,null))[_0xb964('0x42')](handleError(_0x591a20,null));};exports[_0xb964('0x4b')]=function(_0x1759bc,_0x23ebfa){return db[_0xb964('0x2a')][_0xb964('0x4b')]()[_0xb964('0x21')](respondWithResult(_0x23ebfa,null))[_0xb964('0x42')](handleError(_0x23ebfa,null));}; \ No newline at end of file +var _0xd48e=['catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','OpenchannelQueueReport','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0xfaa8b7,_0x56d200){var _0x363662=function(_0x35042d){while(--_0x35042d){_0xfaa8b7['push'](_0xfaa8b7['shift']());}};_0x363662(++_0x56d200);}(_0xd48e,0x93));var _0xed48=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd48e[_0x4b369d];return _0x571a98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xed48('0x0'));var rimraf=require(_0xed48('0x1'));var zipdir=require(_0xed48('0x2'));var jsonpatch=require(_0xed48('0x3'));var rp=require(_0xed48('0x4'));var moment=require('moment');var BPromise=require(_0xed48('0x5'));var Mustache=require(_0xed48('0x6'));var util=require(_0xed48('0x7'));var path=require('path');var sox=require(_0xed48('0x8'));var csv=require(_0xed48('0x9'));var ejs=require(_0xed48('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xed48('0xb'));var crypto=require(_0xed48('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed48('0xd'));var Papa=require(_0xed48('0xe'));var Redis=require(_0xed48('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xed48('0x10'));var hardwareService=require(_0xed48('0x11'));var logger=require(_0xed48('0x12'))('api');var utils=require(_0xed48('0x13'));var config=require(_0xed48('0x14'));var db=require(_0xed48('0x15'))['db'];function respondWithStatusCode(_0x2e07f5,_0x7ee238){_0x7ee238=_0x7ee238||0xcc;return function(_0xaf4b6d){if(_0xaf4b6d){return _0x2e07f5[_0xed48('0x16')](_0x7ee238);}return _0x2e07f5[_0xed48('0x17')](_0x7ee238)[_0xed48('0x18')]();};}function respondWithResult(_0x2eea4d,_0x408ce8){_0x408ce8=_0x408ce8||0xc8;return function(_0x24e67c){if(_0x24e67c){return _0x2eea4d[_0xed48('0x17')](_0x408ce8)['json'](_0x24e67c);}};}function respondWithFilteredResult(_0x2ca898,_0x4a0296){return function(_0x3bf0b7){if(_0x3bf0b7){var _0x4d23d9=_0x3bf0b7[_0xed48('0x19')],_0x4d896f=_0x4a0296[_0xed48('0x1a')],_0x36cf4f=_0x4a0296[_0xed48('0x1a')]+_0x4a0296['limit'],_0x443f35;if(_0x36cf4f>=_0x4d23d9){_0x36cf4f=_0x4d23d9;_0x443f35=0xc8;}else{_0x443f35=0xce;}_0x2ca898[_0xed48('0x17')](_0x443f35);return _0x2ca898['set'](_0xed48('0x1b'),_0x4d896f+'-'+_0x36cf4f+'/'+_0x4d23d9)['json'](_0x3bf0b7);}return null;};}function patchUpdates(_0x302530){return function(_0x2e494c){try{jsonpatch[_0xed48('0x1c')](_0x2e494c,_0x302530,!![]);}catch(_0x55eebb){return BPromise['reject'](_0x55eebb);}return _0x2e494c[_0xed48('0x1d')]();};}function saveUpdates(_0x3e2044,_0x225d0f){return function(_0x54288f){if(_0x54288f){return _0x54288f[_0xed48('0x1e')](_0x3e2044)[_0xed48('0x1f')](function(_0x19d897){return _0x19d897;});}return null;};}function removeEntity(_0x483396,_0x277efb){return function(_0x1bda45){if(_0x1bda45){return _0x1bda45[_0xed48('0x20')]()[_0xed48('0x1f')](function(){_0x483396[_0xed48('0x17')](0xcc)[_0xed48('0x18')]();});}};}function handleEntityNotFound(_0x4a6d93,_0x2683e4){return function(_0x4b829b){if(!_0x4b829b){_0x4a6d93[_0xed48('0x16')](0x194);}return _0x4b829b;};}function handleError(_0x3d3acc,_0x14e642){_0x14e642=_0x14e642||0x1f4;return function(_0x585709){logger['error'](_0x585709[_0xed48('0x21')]);if(_0x585709[_0xed48('0x22')]){delete _0x585709[_0xed48('0x22')];}_0x3d3acc[_0xed48('0x17')](_0x14e642)[_0xed48('0x23')](_0x585709);};}exports[_0xed48('0x24')]=function(_0x37ef54,_0x5a83bf){var _0x289060={},_0x3ce573={},_0x2d4ee2={'count':0x0,'rows':[]};var _0x5db1f3=_[_0xed48('0x25')](db[_0xed48('0x26')]['rawAttributes'],function(_0x2baff3){return{'name':_0x2baff3['fieldName'],'type':_0x2baff3['type'][_0xed48('0x27')]};});_0x3ce573['model']=_['map'](_0x5db1f3,_0xed48('0x22'));_0x3ce573[_0xed48('0x28')]=_[_0xed48('0x29')](_0x37ef54['query']);_0x3ce573[_0xed48('0x2a')]=_[_0xed48('0x2b')](_0x3ce573[_0xed48('0x2c')],_0x3ce573[_0xed48('0x28')]);_0x289060['attributes']=_['intersection'](_0x3ce573[_0xed48('0x2c')],qs['fields'](_0x37ef54[_0xed48('0x28')][_0xed48('0x2d')]));_0x289060[_0xed48('0x2e')]=_0x289060[_0xed48('0x2e')]['length']?_0x289060['attributes']:_0x3ce573[_0xed48('0x2c')];if(!_0x37ef54[_0xed48('0x28')][_0xed48('0x2f')](_0xed48('0x30'))){_0x289060[_0xed48('0x31')]=qs[_0xed48('0x31')](_0x37ef54[_0xed48('0x28')][_0xed48('0x31')]);_0x289060[_0xed48('0x1a')]=qs[_0xed48('0x1a')](_0x37ef54[_0xed48('0x28')][_0xed48('0x1a')]);}_0x289060['order']=qs[_0xed48('0x32')](_0x37ef54[_0xed48('0x28')][_0xed48('0x32')]);_0x289060[_0xed48('0x33')]=qs[_0xed48('0x2a')](_[_0xed48('0x34')](_0x37ef54[_0xed48('0x28')],_0x3ce573[_0xed48('0x2a')]),_0x5db1f3);if(_0x37ef54[_0xed48('0x28')][_0xed48('0x35')]){_0x289060['where']=_[_0xed48('0x36')](_0x289060[_0xed48('0x33')],{'$or':_[_0xed48('0x25')](_0x5db1f3,function(_0xa59e7c){if(_0xa59e7c['type']!==_0xed48('0x37')){var _0x22d20d={};_0x22d20d[_0xa59e7c['name']]={'$like':'%'+_0x37ef54[_0xed48('0x28')][_0xed48('0x35')]+'%'};return _0x22d20d;}})});}_0x289060=_[_0xed48('0x36')]({},_0x289060,_0x37ef54['options']);var _0x4b3aeb={'where':_0x289060[_0xed48('0x33')]};return db['OpenchannelQueueReport'][_0xed48('0x19')](_0x4b3aeb)[_0xed48('0x1f')](function(_0x360f55){_0x2d4ee2[_0xed48('0x19')]=_0x360f55;if(_0x37ef54[_0xed48('0x28')][_0xed48('0x38')]){_0x289060[_0xed48('0x39')]=[{'all':!![]}];}return db[_0xed48('0x26')][_0xed48('0x3a')](_0x289060);})['then'](function(_0x34bacd){_0x2d4ee2[_0xed48('0x3b')]=_0x34bacd;return _0x2d4ee2;})[_0xed48('0x1f')](respondWithFilteredResult(_0x5a83bf,_0x289060))[_0xed48('0x3c')](handleError(_0x5a83bf,null));};exports[_0xed48('0x3d')]=function(_0x5b75b7,_0x35042d){var _0x1af81d={'raw':!![],'where':{'id':_0x5b75b7[_0xed48('0x3e')]['id']}},_0x2f8712={};_0x2f8712[_0xed48('0x2c')]=_[_0xed48('0x29')](db[_0xed48('0x26')][_0xed48('0x3f')]);_0x2f8712[_0xed48('0x28')]=_[_0xed48('0x29')](_0x5b75b7[_0xed48('0x28')]);_0x2f8712[_0xed48('0x2a')]=_[_0xed48('0x2b')](_0x2f8712[_0xed48('0x2c')],_0x2f8712[_0xed48('0x28')]);_0x1af81d[_0xed48('0x2e')]=_[_0xed48('0x2b')](_0x2f8712[_0xed48('0x2c')],qs['fields'](_0x5b75b7[_0xed48('0x28')][_0xed48('0x2d')]));_0x1af81d[_0xed48('0x2e')]=_0x1af81d[_0xed48('0x2e')][_0xed48('0x40')]?_0x1af81d[_0xed48('0x2e')]:_0x2f8712['model'];if(_0x5b75b7[_0xed48('0x28')]['includeAll']){_0x1af81d[_0xed48('0x39')]=[{'all':!![]}];}_0x1af81d=_[_0xed48('0x36')]({},_0x1af81d,_0x5b75b7['options']);return db['OpenchannelQueueReport'][_0xed48('0x41')](_0x1af81d)['then'](handleEntityNotFound(_0x35042d,null))[_0xed48('0x1f')](respondWithResult(_0x35042d,null))['catch'](handleError(_0x35042d,null));};exports['create']=function(_0x58876a,_0x2565e5){return db[_0xed48('0x26')][_0xed48('0x42')](_0x58876a[_0xed48('0x43')],{})[_0xed48('0x1f')](respondWithResult(_0x2565e5,0xc9))[_0xed48('0x3c')](handleError(_0x2565e5,null));};exports['update']=function(_0x51d9d6,_0x1369c9){if(_0x51d9d6[_0xed48('0x43')]['id']){delete _0x51d9d6[_0xed48('0x43')]['id'];}return db[_0xed48('0x26')][_0xed48('0x41')]({'where':{'id':_0x51d9d6[_0xed48('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1369c9,null))[_0xed48('0x1f')](saveUpdates(_0x51d9d6['body'],null))['then'](respondWithResult(_0x1369c9,null))['catch'](handleError(_0x1369c9,null));};exports[_0xed48('0x20')]=function(_0x1be83e,_0x198213){return db[_0xed48('0x26')][_0xed48('0x41')]({'where':{'id':_0x1be83e[_0xed48('0x3e')]['id']}})[_0xed48('0x1f')](handleEntityNotFound(_0x198213,null))[_0xed48('0x1f')](removeEntity(_0x198213,null))[_0xed48('0x3c')](handleError(_0x198213,null));};exports[_0xed48('0x44')]=function(_0x2760ac,_0x20f92c){return db['OpenchannelQueueReport'][_0xed48('0x44')]()[_0xed48('0x1f')](respondWithResult(_0x20f92c,null))[_0xed48('0x3c')](handleError(_0x20f92c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index f012c61..4a80c83 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 _0xa2a6=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueueReport.attributes'];(function(_0x413a9a,_0x54c68e){var _0x16bdb7=function(_0x298abd){while(--_0x298abd){_0x413a9a['push'](_0x413a9a['shift']());}};_0x16bdb7(++_0x54c68e);}(_0xa2a6,0xc8));var _0x6a2a=function(_0x5bc188,_0x2af445){_0x5bc188=_0x5bc188-0x0;var _0x662326=_0xa2a6[_0x5bc188];return _0x662326;};'use strict';var _=require(_0x6a2a('0x0'));var util=require(_0x6a2a('0x1'));var logger=require(_0x6a2a('0x2'))(_0x6a2a('0x3'));var moment=require(_0x6a2a('0x4'));var BPromise=require(_0x6a2a('0x5'));var rp=require(_0x6a2a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a2a('0x7'));var config=require(_0x6a2a('0x8'));var attributes=require(_0x6a2a('0x9'));module['exports']=function(_0x2e0241,_0xf853a9){return _0x2e0241[_0x6a2a('0xa')](_0x6a2a('0xb'),attributes,{'tableName':_0x6a2a('0xc'),'paranoid':![],'indexes':[{'name':_0x6a2a('0xd'),'fields':[_0x6a2a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa562=['path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x308e66,_0x3f4d6b){var _0x1f70f9=function(_0x55fb51){while(--_0x55fb51){_0x308e66['push'](_0x308e66['shift']());}};_0x1f70f9(++_0x3f4d6b);}(_0xa562,0x1a9));var _0x2a56=function(_0x5c956b,_0xa87d11){_0x5c956b=_0x5c956b-0x0;var _0xaff46a=_0xa562[_0x5c956b];return _0xaff46a;};'use strict';var _=require(_0x2a56('0x0'));var util=require(_0x2a56('0x1'));var logger=require(_0x2a56('0x2'))(_0x2a56('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a56('0x4'));var rimraf=require(_0x2a56('0x5'));var config=require(_0x2a56('0x6'));var attributes=require(_0x2a56('0x7'));module['exports']=function(_0x319ef1,_0x5cd3f2){return _0x319ef1[_0x2a56('0x8')]('OpenchannelQueueReport',attributes,{'tableName':_0x2a56('0x9'),'paranoid':![],'indexes':[{'name':_0x2a56('0xa'),'fields':[_0x2a56('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 7abb9b2..e81aab6 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 _0x6ac2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','then','debug','UpdateOpenchannelQueueReport','update','raw','options','where','attributes','lodash','moment'];(function(_0x306c78,_0x4f2018){var _0x57a319=function(_0x1fdcbf){while(--_0x1fdcbf){_0x306c78['push'](_0x306c78['shift']());}};_0x57a319(++_0x4f2018);}(_0x6ac2,0x184));var _0x26ac=function(_0x511cbb,_0x1a52c0){_0x511cbb=_0x511cbb-0x0;var _0x43466f=_0x6ac2[_0x511cbb];return _0x43466f;};'use strict';var _=require(_0x26ac('0x0'));var util=require('util');var moment=require(_0x26ac('0x1'));var BPromise=require(_0x26ac('0x2'));var rs=require(_0x26ac('0x3'));var fs=require('fs');var Redis=require(_0x26ac('0x4'));var db=require(_0x26ac('0x5'))['db'];var utils=require(_0x26ac('0x6'));var logger=require('../../config/logger')(_0x26ac('0x7'));var config=require('../../config/environment');var jayson=require(_0x26ac('0x8'));var client=jayson[_0x26ac('0x9')][_0x26ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x159ba6,_0x36389c,_0x444ca1){return new BPromise(function(_0x1906d0,_0xd8b1e5){return client['request'](_0x159ba6,_0x444ca1)['then'](function(_0x27ff15){logger[_0x26ac('0xb')](_0x26ac('0xc'),_0x36389c,_0x26ac('0xd'));logger['debug'](_0x26ac('0xe'),_0x36389c,_0x26ac('0xd'),JSON[_0x26ac('0xf')](_0x27ff15));if(_0x27ff15[_0x26ac('0x10')]){if(_0x27ff15['error']['code']===0x1f4){logger[_0x26ac('0x10')](_0x26ac('0xc'),_0x36389c,_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);return _0xd8b1e5(_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);}logger[_0x26ac('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x36389c,_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);return _0x1906d0(_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);}else{logger['info'](_0x26ac('0xc'),_0x36389c,_0x26ac('0xd'));_0x1906d0(_0x27ff15['result'][_0x26ac('0x11')]);}})[_0x26ac('0x12')](function(_0x3b7c5d){logger[_0x26ac('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x36389c,_0x3b7c5d);_0xd8b1e5(_0x3b7c5d);});});}exports[_0x26ac('0x13')]=function(_0xb03bbc){var _0x5cd737=this;return new Promise(function(_0x539eda,_0x111613){return db[_0x26ac('0x14')]['create'](_0xb03bbc[_0x26ac('0x15')],{'raw':_0xb03bbc['options']?_0xb03bbc['options']['raw']===undefined?!![]:![]:!![]})[_0x26ac('0x16')](function(_0x58ee68){logger[_0x26ac('0xb')](_0x26ac('0x13'),_0xb03bbc);logger[_0x26ac('0x17')](_0x26ac('0x13'),_0xb03bbc,JSON[_0x26ac('0xf')](_0x58ee68));_0x539eda(_0x58ee68);})[_0x26ac('0x12')](function(_0x21b6ab){logger[_0x26ac('0x10')](_0x26ac('0x13'),_0x21b6ab['message'],_0xb03bbc);_0x111613(_0x5cd737[_0x26ac('0x10')](0x1f4,_0x21b6ab[_0x26ac('0x11')]));});});};exports[_0x26ac('0x18')]=function(_0x1885f7){var _0x346001=this;return new Promise(function(_0x268200,_0x1074b5){return db[_0x26ac('0x14')][_0x26ac('0x19')](_0x1885f7[_0x26ac('0x15')],{'raw':_0x1885f7['options']?_0x1885f7['options'][_0x26ac('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1885f7['options']?_0x1885f7[_0x26ac('0x1b')][_0x26ac('0x1c')]||null:null,'attributes':_0x1885f7[_0x26ac('0x1b')]?_0x1885f7[_0x26ac('0x1b')][_0x26ac('0x1d')]||null:null,'limit':_0x1885f7[_0x26ac('0x1b')]?_0x1885f7['options']['limit']||null:null})[_0x26ac('0x16')](function(_0x3e2c4d){logger[_0x26ac('0xb')]('UpdateOpenchannelQueueReport',_0x1885f7);logger['debug'](_0x26ac('0x18'),_0x1885f7,JSON[_0x26ac('0xf')](_0x3e2c4d));_0x268200(_0x3e2c4d);})[_0x26ac('0x12')](function(_0x325818){logger['error']('UpdateOpenchannelQueueReport',_0x325818[_0x26ac('0x11')],_0x1885f7);_0x1074b5(_0x346001[_0x26ac('0x10')](0x1f4,_0x325818[_0x26ac('0x11')]));});});}; \ No newline at end of file +var _0x0137=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0137,0x1d8));var _0x7013=function(_0x23b85e,_0x39b209){_0x23b85e=_0x23b85e-0x0;var _0x329756=_0x0137[_0x23b85e];return _0x329756;};'use strict';var _=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var moment=require(_0x7013('0x2'));var BPromise=require(_0x7013('0x3'));var rs=require(_0x7013('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7013('0x5'))['db'];var utils=require(_0x7013('0x6'));var logger=require(_0x7013('0x7'))(_0x7013('0x8'));var config=require(_0x7013('0x9'));var jayson=require(_0x7013('0xa'));var client=jayson['client'][_0x7013('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x346a4d,_0x4e2460,_0x16c0c8){return new BPromise(function(_0x16dae3,_0x1b748c){return client['request'](_0x346a4d,_0x16c0c8)[_0x7013('0xc')](function(_0x551b8a){logger[_0x7013('0xd')](_0x7013('0xe'),_0x4e2460,'request\x20sent');logger[_0x7013('0xf')](_0x7013('0x10'),_0x4e2460,_0x7013('0x11'),JSON[_0x7013('0x12')](_0x551b8a));if(_0x551b8a[_0x7013('0x13')]){if(_0x551b8a[_0x7013('0x13')]['code']===0x1f4){logger[_0x7013('0x13')](_0x7013('0xe'),_0x4e2460,_0x551b8a[_0x7013('0x13')][_0x7013('0x14')]);return _0x1b748c(_0x551b8a[_0x7013('0x13')][_0x7013('0x14')]);}logger[_0x7013('0x13')](_0x7013('0xe'),_0x4e2460,_0x551b8a[_0x7013('0x13')][_0x7013('0x14')]);return _0x16dae3(_0x551b8a[_0x7013('0x13')]['message']);}else{logger['info'](_0x7013('0xe'),_0x4e2460,_0x7013('0x11'));_0x16dae3(_0x551b8a[_0x7013('0x15')][_0x7013('0x14')]);}})[_0x7013('0x16')](function(_0x48614e){logger['error'](_0x7013('0xe'),_0x4e2460,_0x48614e);_0x1b748c(_0x48614e);});});}exports[_0x7013('0x17')]=function(_0x161a19){var _0x1b68b0=this;return new Promise(function(_0x363cbc,_0x4eee5e){return db[_0x7013('0x18')][_0x7013('0x19')](_0x161a19['body'],{'raw':_0x161a19['options']?_0x161a19[_0x7013('0x1a')][_0x7013('0x1b')]===undefined?!![]:![]:!![]})[_0x7013('0xc')](function(_0x5cf9c9){logger[_0x7013('0xd')]('CreateOpenchannelQueueReport',_0x161a19);logger[_0x7013('0xf')](_0x7013('0x17'),_0x161a19,JSON[_0x7013('0x12')](_0x5cf9c9));_0x363cbc(_0x5cf9c9);})[_0x7013('0x16')](function(_0x3bb319){logger[_0x7013('0x13')](_0x7013('0x17'),_0x3bb319[_0x7013('0x14')],_0x161a19);_0x4eee5e(_0x1b68b0[_0x7013('0x13')](0x1f4,_0x3bb319[_0x7013('0x14')]));});});};exports[_0x7013('0x1c')]=function(_0x99f13d){var _0x34811e=this;return new Promise(function(_0x18a137,_0x35653e){return db[_0x7013('0x18')][_0x7013('0x1d')](_0x99f13d[_0x7013('0x1e')],{'raw':_0x99f13d[_0x7013('0x1a')]?_0x99f13d[_0x7013('0x1a')][_0x7013('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x99f13d['options']?_0x99f13d[_0x7013('0x1a')][_0x7013('0x1f')]||null:null,'attributes':_0x99f13d[_0x7013('0x1a')]?_0x99f13d['options'][_0x7013('0x20')]||null:null,'limit':_0x99f13d['options']?_0x99f13d[_0x7013('0x1a')][_0x7013('0x21')]||null:null})['then'](function(_0x1511c0){logger['info'](_0x7013('0x1c'),_0x99f13d);logger[_0x7013('0xf')](_0x7013('0x1c'),_0x99f13d,JSON['stringify'](_0x1511c0));_0x18a137(_0x1511c0);})[_0x7013('0x16')](function(_0x182958){logger[_0x7013('0x13')](_0x7013('0x1c'),_0x182958['message'],_0x99f13d);_0x35653e(_0x34811e[_0x7013('0x13')](0x1f4,_0x182958[_0x7013('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 280b40c..851ca68 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(_0x48c4ef,_0x319d44){var _0x435715=function(_0x925d50){while(--_0x925d50){_0x48c4ef['push'](_0x48c4ef['shift']());}};_0x435715(++_0x319d44);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 594006c..3a1114d 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 _0x3014=['account','queue','DATE','NOW','sequelize','STRING','ENUM'];(function(_0x321387,_0x1c989d){var _0x541916=function(_0x38e737){while(--_0x38e737){_0x321387['push'](_0x321387['shift']());}};_0x541916(++_0x1c989d);}(_0x3014,0x17e));var _0x4301=function(_0x4a06f2,_0x50d27f){_0x4a06f2=_0x4a06f2-0x0;var _0x5a22da=_0x3014[_0x4a06f2];return _0x5a22da;};'use strict';var moment=require('moment');var Sequelize=require(_0x4301('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4301('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4301('0x2')](_0x4301('0x3'),'agent','queue'),'allowNull':![],'defaultValue':_0x4301('0x4')},'transferredAt':{'type':Sequelize[_0x4301('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x4301('0x6')]}}; \ No newline at end of file +var _0x4e75=['queue','DATE','NOW','moment','ENUM'];(function(_0x72e965,_0x47af03){var _0x478929=function(_0x3cecdf){while(--_0x3cecdf){_0x72e965['push'](_0x72e965['shift']());}};_0x478929(++_0x47af03);}(_0x4e75,0xc6));var _0x54e7=function(_0x596549,_0x590c40){_0x596549=_0x596549-0x0;var _0x3f6209=_0x4e75[_0x596549];return _0x3f6209;};'use strict';var moment=require(_0x54e7('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x54e7('0x1')]('account','agent',_0x54e7('0x2')),'allowNull':![],'defaultValue':_0x54e7('0x2')},'transferredAt':{'type':Sequelize[_0x54e7('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x54e7('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 0e39180..43519af 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 _0xdd28=['end','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','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'];(function(_0x232584,_0x24bcd7){var _0x3a41c7=function(_0x384a11){while(--_0x384a11){_0x232584['push'](_0x232584['shift']());}};_0x3a41c7(++_0x24bcd7);}(_0xdd28,0x1eb));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x8dd2('0x0'));var emlformat=require(_0x8dd2('0x1'));var rimraf=require(_0x8dd2('0x2'));var zipdir=require(_0x8dd2('0x3'));var jsonpatch=require(_0x8dd2('0x4'));var rp=require(_0x8dd2('0x5'));var moment=require(_0x8dd2('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8dd2('0x7'));var sox=require(_0x8dd2('0x8'));var csv=require('to-csv');var ejs=require(_0x8dd2('0x9'));var fs=require('fs');var _=require(_0x8dd2('0xa'));var squel=require(_0x8dd2('0xb'));var crypto=require(_0x8dd2('0xc'));var jsforce=require(_0x8dd2('0xd'));var deskjs=require(_0x8dd2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8dd2('0xf'));var Papa=require(_0x8dd2('0x10'));var Redis=require(_0x8dd2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8dd2('0x12'));var as=require(_0x8dd2('0x13'));var hardwareService=require(_0x8dd2('0x14'));var logger=require(_0x8dd2('0x15'))(_0x8dd2('0x16'));var utils=require(_0x8dd2('0x17'));var config=require(_0x8dd2('0x18'));var db=require(_0x8dd2('0x19'))['db'];function respondWithStatusCode(_0x4652f1,_0x2e7e7e){_0x2e7e7e=_0x2e7e7e||0xcc;return function(_0x480d1b){if(_0x480d1b){return _0x4652f1['sendStatus'](_0x2e7e7e);}return _0x4652f1[_0x8dd2('0x1a')](_0x2e7e7e)[_0x8dd2('0x1b')]();};}function respondWithResult(_0x399c85,_0x5530d6){_0x5530d6=_0x5530d6||0xc8;return function(_0x556c3e){if(_0x556c3e){return _0x399c85['status'](_0x5530d6)['json'](_0x556c3e);}};}function respondWithFilteredResult(_0x2d2476,_0x559baa){return function(_0x124b7c){if(_0x124b7c){var _0x285060=_0x124b7c[_0x8dd2('0x1c')],_0x1bed3d=_0x559baa[_0x8dd2('0x1d')],_0x28f1db=_0x559baa[_0x8dd2('0x1d')]+_0x559baa[_0x8dd2('0x1e')],_0x5a766c;if(_0x28f1db>=_0x285060){_0x28f1db=_0x285060;_0x5a766c=0xc8;}else{_0x5a766c=0xce;}_0x2d2476[_0x8dd2('0x1a')](_0x5a766c);return _0x2d2476[_0x8dd2('0x1f')](_0x8dd2('0x20'),_0x1bed3d+'-'+_0x28f1db+'/'+_0x285060)['json'](_0x124b7c);}return null;};}function patchUpdates(_0x4772d5){return function(_0x1d4684){try{jsonpatch['apply'](_0x1d4684,_0x4772d5,!![]);}catch(_0x5091c6){return BPromise[_0x8dd2('0x21')](_0x5091c6);}return _0x1d4684[_0x8dd2('0x22')]();};}function saveUpdates(_0x3f7f3f,_0xddf157){return function(_0x1b223c){if(_0x1b223c){return _0x1b223c['update'](_0x3f7f3f)[_0x8dd2('0x23')](function(_0x408d7f){return _0x408d7f;});}return null;};}function removeEntity(_0x3a92e1,_0x498ddf){return function(_0x57f54f){if(_0x57f54f){return _0x57f54f[_0x8dd2('0x24')]()[_0x8dd2('0x23')](function(){_0x3a92e1[_0x8dd2('0x1a')](0xcc)[_0x8dd2('0x1b')]();});}};}function handleEntityNotFound(_0x47bdc8,_0x2b48e5){return function(_0x302ebf){if(!_0x302ebf){_0x47bdc8[_0x8dd2('0x25')](0x194);}return _0x302ebf;};}function handleError(_0x31158e,_0x1ff907){_0x1ff907=_0x1ff907||0x1f4;return function(_0x535175){logger[_0x8dd2('0x26')](_0x535175[_0x8dd2('0x27')]);if(_0x535175['name']){delete _0x535175[_0x8dd2('0x28')];}_0x31158e[_0x8dd2('0x1a')](_0x1ff907)[_0x8dd2('0x29')](_0x535175);};}exports[_0x8dd2('0x2a')]=function(_0x4cc954,_0x4e6429){var _0x359fc7={},_0x42d8e3={},_0x455131={'count':0x0,'rows':[]};var _0x1f725c=_[_0x8dd2('0x2b')](db[_0x8dd2('0x2c')][_0x8dd2('0x2d')],function(_0x4dbe18){return{'name':_0x4dbe18['fieldName'],'type':_0x4dbe18['type']['key']};});_0x42d8e3[_0x8dd2('0x2e')]=_[_0x8dd2('0x2b')](_0x1f725c,_0x8dd2('0x28'));_0x42d8e3[_0x8dd2('0x2f')]=_['keys'](_0x4cc954['query']);_0x42d8e3['filters']=_[_0x8dd2('0x30')](_0x42d8e3[_0x8dd2('0x2e')],_0x42d8e3[_0x8dd2('0x2f')]);_0x359fc7['attributes']=_[_0x8dd2('0x30')](_0x42d8e3[_0x8dd2('0x2e')],qs[_0x8dd2('0x31')](_0x4cc954[_0x8dd2('0x2f')][_0x8dd2('0x31')]));_0x359fc7[_0x8dd2('0x32')]=_0x359fc7[_0x8dd2('0x32')]['length']?_0x359fc7['attributes']:_0x42d8e3[_0x8dd2('0x2e')];if(!_0x4cc954[_0x8dd2('0x2f')][_0x8dd2('0x33')](_0x8dd2('0x34'))){_0x359fc7[_0x8dd2('0x1e')]=qs[_0x8dd2('0x1e')](_0x4cc954[_0x8dd2('0x2f')]['limit']);_0x359fc7['offset']=qs[_0x8dd2('0x1d')](_0x4cc954[_0x8dd2('0x2f')]['offset']);}_0x359fc7['order']=qs[_0x8dd2('0x35')](_0x4cc954[_0x8dd2('0x2f')][_0x8dd2('0x35')]);_0x359fc7[_0x8dd2('0x36')]=qs['filters'](_[_0x8dd2('0x37')](_0x4cc954[_0x8dd2('0x2f')],_0x42d8e3[_0x8dd2('0x38')]),_0x1f725c);if(_0x4cc954['query']['filter']){_0x359fc7[_0x8dd2('0x36')]=_[_0x8dd2('0x39')](_0x359fc7[_0x8dd2('0x36')],{'$or':_[_0x8dd2('0x2b')](_0x1f725c,function(_0x4619d5){if(_0x4619d5[_0x8dd2('0x3a')]!==_0x8dd2('0x3b')){var _0x265e64={};_0x265e64[_0x4619d5[_0x8dd2('0x28')]]={'$like':'%'+_0x4cc954[_0x8dd2('0x2f')][_0x8dd2('0x3c')]+'%'};return _0x265e64;}})});}_0x359fc7=_[_0x8dd2('0x39')]({},_0x359fc7,_0x4cc954[_0x8dd2('0x3d')]);var _0x3b5726={'where':_0x359fc7[_0x8dd2('0x36')]};return db[_0x8dd2('0x2c')][_0x8dd2('0x1c')](_0x3b5726)['then'](function(_0x280564){_0x455131['count']=_0x280564;if(_0x4cc954['query'][_0x8dd2('0x3e')]){_0x359fc7[_0x8dd2('0x3f')]=[{'all':!![]}];}return db[_0x8dd2('0x2c')][_0x8dd2('0x40')](_0x359fc7);})[_0x8dd2('0x23')](function(_0xf55005){_0x455131['rows']=_0xf55005;return _0x455131;})[_0x8dd2('0x23')](respondWithFilteredResult(_0x4e6429,_0x359fc7))[_0x8dd2('0x41')](handleError(_0x4e6429,null));};exports[_0x8dd2('0x42')]=function(_0x1c0238,_0xa98ead){var _0x334a2d={'raw':!![],'where':{'id':_0x1c0238[_0x8dd2('0x43')]['id']}},_0x2480bf={};_0x2480bf[_0x8dd2('0x2e')]=_[_0x8dd2('0x44')](db[_0x8dd2('0x2c')][_0x8dd2('0x2d')]);_0x2480bf[_0x8dd2('0x2f')]=_['keys'](_0x1c0238[_0x8dd2('0x2f')]);_0x2480bf[_0x8dd2('0x38')]=_[_0x8dd2('0x30')](_0x2480bf[_0x8dd2('0x2e')],_0x2480bf[_0x8dd2('0x2f')]);_0x334a2d[_0x8dd2('0x32')]=_[_0x8dd2('0x30')](_0x2480bf[_0x8dd2('0x2e')],qs[_0x8dd2('0x31')](_0x1c0238[_0x8dd2('0x2f')][_0x8dd2('0x31')]));_0x334a2d['attributes']=_0x334a2d['attributes'][_0x8dd2('0x45')]?_0x334a2d['attributes']:_0x2480bf['model'];if(_0x1c0238[_0x8dd2('0x2f')][_0x8dd2('0x3e')]){_0x334a2d[_0x8dd2('0x3f')]=[{'all':!![]}];}_0x334a2d=_[_0x8dd2('0x39')]({},_0x334a2d,_0x1c0238[_0x8dd2('0x3d')]);return db['OpenchannelTransferReport'][_0x8dd2('0x46')](_0x334a2d)[_0x8dd2('0x23')](handleEntityNotFound(_0xa98ead,null))[_0x8dd2('0x23')](respondWithResult(_0xa98ead,null))[_0x8dd2('0x41')](handleError(_0xa98ead,null));};exports['create']=function(_0x3df299,_0x42096d){return db[_0x8dd2('0x2c')][_0x8dd2('0x47')](_0x3df299[_0x8dd2('0x48')],{})['then'](respondWithResult(_0x42096d,0xc9))[_0x8dd2('0x41')](handleError(_0x42096d,null));};exports['update']=function(_0x385c7d,_0x5563f4){if(_0x385c7d['body']['id']){delete _0x385c7d[_0x8dd2('0x48')]['id'];}return db[_0x8dd2('0x2c')][_0x8dd2('0x46')]({'where':{'id':_0x385c7d[_0x8dd2('0x43')]['id']}})[_0x8dd2('0x23')](handleEntityNotFound(_0x5563f4,null))[_0x8dd2('0x23')](saveUpdates(_0x385c7d[_0x8dd2('0x48')],null))[_0x8dd2('0x23')](respondWithResult(_0x5563f4,null))[_0x8dd2('0x41')](handleError(_0x5563f4,null));};exports[_0x8dd2('0x24')]=function(_0xb7a109,_0x4c5009){return db['OpenchannelTransferReport'][_0x8dd2('0x46')]({'where':{'id':_0xb7a109['params']['id']}})['then'](handleEntityNotFound(_0x4c5009,null))[_0x8dd2('0x23')](removeEntity(_0x4c5009,null))[_0x8dd2('0x41')](handleError(_0x4c5009,null));};exports[_0x8dd2('0x49')]=function(_0x567ebf,_0x5ce3a7){return db[_0x8dd2('0x2c')]['describe']()[_0x8dd2('0x23')](respondWithResult(_0x5ce3a7,null))[_0x8dd2('0x41')](handleError(_0x5ce3a7,null));}; \ No newline at end of file +var _0x5160=['pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','type','model','keys','filters','intersection','attributes','fields','length','query','nolimit','limit','order','sort','where'];(function(_0x28b591,_0x587f9e){var _0x46700c=function(_0x3b28f6){while(--_0x3b28f6){_0x28b591['push'](_0x28b591['shift']());}};_0x46700c(++_0x587f9e);}(_0x5160,0x1cc));var _0x0516=function(_0x3db3d8,_0x4fae40){_0x3db3d8=_0x3db3d8-0x0;var _0x41f827=_0x5160[_0x3db3d8];return _0x41f827;};'use strict';var pdf=require(_0x0516('0x0'));var emlformat=require(_0x0516('0x1'));var rimraf=require(_0x0516('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0516('0x3'));var rp=require(_0x0516('0x4'));var moment=require(_0x0516('0x5'));var BPromise=require(_0x0516('0x6'));var Mustache=require(_0x0516('0x7'));var util=require(_0x0516('0x8'));var path=require(_0x0516('0x9'));var sox=require('sox');var csv=require(_0x0516('0xa'));var ejs=require(_0x0516('0xb'));var fs=require('fs');var _=require(_0x0516('0xc'));var squel=require(_0x0516('0xd'));var crypto=require(_0x0516('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0516('0xf'));var toCsv=require(_0x0516('0xa'));var querystring=require(_0x0516('0x10'));var Papa=require(_0x0516('0x11'));var Redis=require(_0x0516('0x12'));var authService=require(_0x0516('0x13'));var qs=require(_0x0516('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0516('0x15'));var logger=require(_0x0516('0x16'))('api');var utils=require(_0x0516('0x17'));var config=require(_0x0516('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a2bba,_0x34e692){_0x34e692=_0x34e692||0xcc;return function(_0x4e8b5d){if(_0x4e8b5d){return _0x2a2bba[_0x0516('0x19')](_0x34e692);}return _0x2a2bba[_0x0516('0x1a')](_0x34e692)[_0x0516('0x1b')]();};}function respondWithResult(_0x2876b4,_0x475076){_0x475076=_0x475076||0xc8;return function(_0x41849e){if(_0x41849e){return _0x2876b4[_0x0516('0x1a')](_0x475076)[_0x0516('0x1c')](_0x41849e);}};}function respondWithFilteredResult(_0x3af260,_0x3f08dd){return function(_0x52f5f0){if(_0x52f5f0){var _0x51f0d1=_0x52f5f0[_0x0516('0x1d')],_0x41e1d1=_0x3f08dd[_0x0516('0x1e')],_0x3f2364=_0x3f08dd[_0x0516('0x1e')]+_0x3f08dd['limit'],_0x473cca;if(_0x3f2364>=_0x51f0d1){_0x3f2364=_0x51f0d1;_0x473cca=0xc8;}else{_0x473cca=0xce;}_0x3af260[_0x0516('0x1a')](_0x473cca);return _0x3af260['set'](_0x0516('0x1f'),_0x41e1d1+'-'+_0x3f2364+'/'+_0x51f0d1)['json'](_0x52f5f0);}return null;};}function patchUpdates(_0x1e39e4){return function(_0x5b32f0){try{jsonpatch[_0x0516('0x20')](_0x5b32f0,_0x1e39e4,!![]);}catch(_0x25ef7b){return BPromise[_0x0516('0x21')](_0x25ef7b);}return _0x5b32f0[_0x0516('0x22')]();};}function saveUpdates(_0x4f8de1,_0x7ebb9a){return function(_0x24af59){if(_0x24af59){return _0x24af59[_0x0516('0x23')](_0x4f8de1)['then'](function(_0x81029c){return _0x81029c;});}return null;};}function removeEntity(_0x213348,_0x488c0f){return function(_0x4c0851){if(_0x4c0851){return _0x4c0851[_0x0516('0x24')]()['then'](function(){_0x213348[_0x0516('0x1a')](0xcc)[_0x0516('0x1b')]();});}};}function handleEntityNotFound(_0x29c8f1,_0x399ac8){return function(_0x8cb455){if(!_0x8cb455){_0x29c8f1[_0x0516('0x19')](0x194);}return _0x8cb455;};}function handleError(_0x286d73,_0x232ef2){_0x232ef2=_0x232ef2||0x1f4;return function(_0x3b4c21){logger[_0x0516('0x25')](_0x3b4c21[_0x0516('0x26')]);if(_0x3b4c21[_0x0516('0x27')]){delete _0x3b4c21[_0x0516('0x27')];}_0x286d73[_0x0516('0x1a')](_0x232ef2)[_0x0516('0x28')](_0x3b4c21);};}exports['index']=function(_0x4e6d84,_0x2abed6){var _0x479118={},_0x3dec81={},_0x29a97d={'count':0x0,'rows':[]};var _0x44b83f=_[_0x0516('0x29')](db[_0x0516('0x2a')][_0x0516('0x2b')],function(_0x1f15a2){return{'name':_0x1f15a2['fieldName'],'type':_0x1f15a2[_0x0516('0x2c')]['key']};});_0x3dec81[_0x0516('0x2d')]=_[_0x0516('0x29')](_0x44b83f,_0x0516('0x27'));_0x3dec81['query']=_[_0x0516('0x2e')](_0x4e6d84['query']);_0x3dec81[_0x0516('0x2f')]=_[_0x0516('0x30')](_0x3dec81[_0x0516('0x2d')],_0x3dec81['query']);_0x479118[_0x0516('0x31')]=_[_0x0516('0x30')](_0x3dec81['model'],qs[_0x0516('0x32')](_0x4e6d84['query'][_0x0516('0x32')]));_0x479118['attributes']=_0x479118[_0x0516('0x31')][_0x0516('0x33')]?_0x479118[_0x0516('0x31')]:_0x3dec81['model'];if(!_0x4e6d84[_0x0516('0x34')]['hasOwnProperty'](_0x0516('0x35'))){_0x479118[_0x0516('0x36')]=qs['limit'](_0x4e6d84[_0x0516('0x34')][_0x0516('0x36')]);_0x479118['offset']=qs[_0x0516('0x1e')](_0x4e6d84[_0x0516('0x34')][_0x0516('0x1e')]);}_0x479118[_0x0516('0x37')]=qs[_0x0516('0x38')](_0x4e6d84['query'][_0x0516('0x38')]);_0x479118[_0x0516('0x39')]=qs[_0x0516('0x2f')](_[_0x0516('0x3a')](_0x4e6d84[_0x0516('0x34')],_0x3dec81[_0x0516('0x2f')]),_0x44b83f);if(_0x4e6d84[_0x0516('0x34')][_0x0516('0x3b')]){_0x479118['where']=_[_0x0516('0x3c')](_0x479118[_0x0516('0x39')],{'$or':_[_0x0516('0x29')](_0x44b83f,function(_0xa81f7e){if(_0xa81f7e[_0x0516('0x2c')]!=='VIRTUAL'){var _0x2b5e17={};_0x2b5e17[_0xa81f7e[_0x0516('0x27')]]={'$like':'%'+_0x4e6d84['query'][_0x0516('0x3b')]+'%'};return _0x2b5e17;}})});}_0x479118=_[_0x0516('0x3c')]({},_0x479118,_0x4e6d84[_0x0516('0x3d')]);var _0x554f09={'where':_0x479118[_0x0516('0x39')]};return db[_0x0516('0x2a')][_0x0516('0x1d')](_0x554f09)[_0x0516('0x3e')](function(_0x7d8e12){_0x29a97d[_0x0516('0x1d')]=_0x7d8e12;if(_0x4e6d84['query'][_0x0516('0x3f')]){_0x479118[_0x0516('0x40')]=[{'all':!![]}];}return db[_0x0516('0x2a')][_0x0516('0x41')](_0x479118);})[_0x0516('0x3e')](function(_0x14a5ef){_0x29a97d[_0x0516('0x42')]=_0x14a5ef;return _0x29a97d;})[_0x0516('0x3e')](respondWithFilteredResult(_0x2abed6,_0x479118))[_0x0516('0x43')](handleError(_0x2abed6,null));};exports[_0x0516('0x44')]=function(_0x3c4493,_0x52227e){var _0x346f3c={'raw':!![],'where':{'id':_0x3c4493[_0x0516('0x45')]['id']}},_0x27ad5d={};_0x27ad5d['model']=_[_0x0516('0x2e')](db[_0x0516('0x2a')]['rawAttributes']);_0x27ad5d[_0x0516('0x34')]=_[_0x0516('0x2e')](_0x3c4493['query']);_0x27ad5d[_0x0516('0x2f')]=_['intersection'](_0x27ad5d['model'],_0x27ad5d[_0x0516('0x34')]);_0x346f3c['attributes']=_['intersection'](_0x27ad5d[_0x0516('0x2d')],qs[_0x0516('0x32')](_0x3c4493[_0x0516('0x34')]['fields']));_0x346f3c['attributes']=_0x346f3c[_0x0516('0x31')][_0x0516('0x33')]?_0x346f3c['attributes']:_0x27ad5d['model'];if(_0x3c4493[_0x0516('0x34')][_0x0516('0x3f')]){_0x346f3c[_0x0516('0x40')]=[{'all':!![]}];}_0x346f3c=_['merge']({},_0x346f3c,_0x3c4493[_0x0516('0x3d')]);return db[_0x0516('0x2a')][_0x0516('0x46')](_0x346f3c)[_0x0516('0x3e')](handleEntityNotFound(_0x52227e,null))[_0x0516('0x3e')](respondWithResult(_0x52227e,null))[_0x0516('0x43')](handleError(_0x52227e,null));};exports[_0x0516('0x47')]=function(_0x1902a7,_0x299bcd){return db[_0x0516('0x2a')][_0x0516('0x47')](_0x1902a7[_0x0516('0x48')],{})[_0x0516('0x3e')](respondWithResult(_0x299bcd,0xc9))[_0x0516('0x43')](handleError(_0x299bcd,null));};exports['update']=function(_0x4cb679,_0xa4b7ce){if(_0x4cb679[_0x0516('0x48')]['id']){delete _0x4cb679[_0x0516('0x48')]['id'];}return db[_0x0516('0x2a')][_0x0516('0x46')]({'where':{'id':_0x4cb679[_0x0516('0x45')]['id']}})['then'](handleEntityNotFound(_0xa4b7ce,null))[_0x0516('0x3e')](saveUpdates(_0x4cb679['body'],null))[_0x0516('0x3e')](respondWithResult(_0xa4b7ce,null))[_0x0516('0x43')](handleError(_0xa4b7ce,null));};exports[_0x0516('0x24')]=function(_0xdcf175,_0x3dc129){return db[_0x0516('0x2a')][_0x0516('0x46')]({'where':{'id':_0xdcf175[_0x0516('0x45')]['id']}})[_0x0516('0x3e')](handleEntityNotFound(_0x3dc129,null))[_0x0516('0x3e')](removeEntity(_0x3dc129,null))[_0x0516('0x43')](handleError(_0x3dc129,null));};exports[_0x0516('0x49')]=function(_0x3f1fff,_0x5cfff1){return db[_0x0516('0x2a')][_0x0516('0x49')]()['then'](respondWithResult(_0x5cfff1,null))[_0x0516('0x43')](handleError(_0x5cfff1,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 6cda33b..76ddb26 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 _0xe928=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x185a62,_0x4c2d00){var _0x3e88bb=function(_0x7d6b1d){while(--_0x7d6b1d){_0x185a62['push'](_0x185a62['shift']());}};_0x3e88bb(++_0x4c2d00);}(_0xe928,0x145));var _0x8e92=function(_0x3979db,_0x27398b){_0x3979db=_0x3979db-0x0;var _0x1de1c3=_0xe928[_0x3979db];return _0x1de1c3;};'use strict';var _=require(_0x8e92('0x0'));var util=require(_0x8e92('0x1'));var logger=require(_0x8e92('0x2'))('api');var moment=require(_0x8e92('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e92('0x4'));var fs=require('fs');var path=require(_0x8e92('0x5'));var rimraf=require(_0x8e92('0x6'));var config=require(_0x8e92('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x8e92('0x8')]=function(_0x50cf8a,_0x2d938d){return _0x50cf8a[_0x8e92('0x9')](_0x8e92('0xa'),attributes,{'tableName':_0x8e92('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8e92('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe75a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','uniqueid','lodash','util','api'];(function(_0x5967c0,_0x452377){var _0x2ad249=function(_0x7eb26){while(--_0x7eb26){_0x5967c0['push'](_0x5967c0['shift']());}};_0x2ad249(++_0x452377);}(_0xe75a,0x1de));var _0xae75=function(_0x4efd3d,_0x2b9694){_0x4efd3d=_0x4efd3d-0x0;var _0x1293f2=_0xe75a[_0x4efd3d];return _0x1293f2;};'use strict';var _=require(_0xae75('0x0'));var util=require(_0xae75('0x1'));var logger=require('../../config/logger')(_0xae75('0x2'));var moment=require(_0xae75('0x3'));var BPromise=require(_0xae75('0x4'));var rp=require(_0xae75('0x5'));var fs=require('fs');var path=require(_0xae75('0x6'));var rimraf=require(_0xae75('0x7'));var config=require(_0xae75('0x8'));var attributes=require(_0xae75('0x9'));module[_0xae75('0xa')]=function(_0x7352d2,_0x4eb1bf){return _0x7352d2[_0xae75('0xb')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xae75('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index af7fc1e..a298475 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 _0x74c3=['request','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4c3349,_0x38feb8){var _0x5b596b=function(_0xad68b7){while(--_0xad68b7){_0x4c3349['push'](_0x4c3349['shift']());}};_0x5b596b(++_0x38feb8);}(_0x74c3,0x16c));var _0x374c=function(_0x229702,_0x40947d){_0x229702=_0x229702-0x0;var _0x1901af=_0x74c3[_0x229702];return _0x1901af;};'use strict';var _=require(_0x374c('0x0'));var util=require(_0x374c('0x1'));var moment=require('moment');var BPromise=require(_0x374c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x374c('0x3'));var logger=require(_0x374c('0x4'))(_0x374c('0x5'));var config=require(_0x374c('0x6'));var jayson=require(_0x374c('0x7'));var client=jayson[_0x374c('0x8')][_0x374c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e4b35,_0x521ead,_0x2370be){return new BPromise(function(_0xa9bfcf,_0x2051d9){return client[_0x374c('0xa')](_0x1e4b35,_0x2370be)[_0x374c('0xb')](function(_0x4b9411){logger['info'](_0x374c('0xc'),_0x521ead,'request\x20sent');logger[_0x374c('0xd')](_0x374c('0xe'),_0x521ead,_0x374c('0xf'),JSON[_0x374c('0x10')](_0x4b9411));if(_0x4b9411[_0x374c('0x11')]){if(_0x4b9411[_0x374c('0x11')]['code']===0x1f4){logger[_0x374c('0x11')](_0x374c('0xc'),_0x521ead,_0x4b9411[_0x374c('0x11')][_0x374c('0x12')]);return _0x2051d9(_0x4b9411[_0x374c('0x11')][_0x374c('0x12')]);}logger[_0x374c('0x11')](_0x374c('0xc'),_0x521ead,_0x4b9411[_0x374c('0x11')]['message']);return _0xa9bfcf(_0x4b9411[_0x374c('0x11')][_0x374c('0x12')]);}else{logger[_0x374c('0x13')](_0x374c('0xc'),_0x521ead,_0x374c('0xf'));_0xa9bfcf(_0x4b9411[_0x374c('0x14')][_0x374c('0x12')]);}})[_0x374c('0x15')](function(_0x1f7854){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x521ead,_0x1f7854);_0x2051d9(_0x1f7854);});});} \ No newline at end of file +var _0x572c=['rpc','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x33b6b3,_0x644e80){var _0x1e2d7a=function(_0x2aec35){while(--_0x2aec35){_0x33b6b3['push'](_0x33b6b3['shift']());}};_0x1e2d7a(++_0x644e80);}(_0x572c,0xc7));var _0xc572=function(_0x4b7d5f,_0x5abbe0){_0x4b7d5f=_0x4b7d5f-0x0;var _0x4e0a60=_0x572c[_0x4b7d5f];return _0x4e0a60;};'use strict';var _=require('lodash');var util=require(_0xc572('0x0'));var moment=require(_0xc572('0x1'));var BPromise=require(_0xc572('0x2'));var rs=require(_0xc572('0x3'));var fs=require('fs');var Redis=require(_0xc572('0x4'));var db=require(_0xc572('0x5'))['db'];var utils=require(_0xc572('0x6'));var logger=require(_0xc572('0x7'))(_0xc572('0x8'));var config=require('../../config/environment');var jayson=require(_0xc572('0x9'));var client=jayson[_0xc572('0xa')][_0xc572('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fa604,_0x271fe8,_0x21ccdf){return new BPromise(function(_0x3a6caa,_0x593c16){return client[_0xc572('0xc')](_0x2fa604,_0x21ccdf)[_0xc572('0xd')](function(_0x2d16c4){logger[_0xc572('0xe')](_0xc572('0xf'),_0x271fe8,_0xc572('0x10'));logger[_0xc572('0x11')](_0xc572('0x12'),_0x271fe8,_0xc572('0x10'),JSON['stringify'](_0x2d16c4));if(_0x2d16c4[_0xc572('0x13')]){if(_0x2d16c4[_0xc572('0x13')]['code']===0x1f4){logger['error'](_0xc572('0xf'),_0x271fe8,_0x2d16c4[_0xc572('0x13')]['message']);return _0x593c16(_0x2d16c4['error'][_0xc572('0x14')]);}logger['error'](_0xc572('0xf'),_0x271fe8,_0x2d16c4[_0xc572('0x13')][_0xc572('0x14')]);return _0x3a6caa(_0x2d16c4[_0xc572('0x13')][_0xc572('0x14')]);}else{logger[_0xc572('0xe')](_0xc572('0xf'),_0x271fe8,_0xc572('0x10'));_0x3a6caa(_0x2d16c4[_0xc572('0x15')][_0xc572('0x14')]);}})[_0xc572('0x16')](function(_0x50f355){logger['error'](_0xc572('0xf'),_0x271fe8,_0x50f355);_0x593c16(_0x50f355);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index e5fa7f3..a702351 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 _0xbc7c=['destroy','../../components/auth/service','../../components/interaction/service','./pause.controller','get','/:id','post','create','put','isAuthenticated'];(function(_0x466326,_0x254adc){var _0x54ed19=function(_0x55295f){while(--_0x55295f){_0x466326['push'](_0x466326['shift']());}};_0x54ed19(++_0x254adc);}(_0xbc7c,0x155));var _0xcbc7=function(_0xd4e6b4,_0x14394e){_0xd4e6b4=_0xd4e6b4-0x0;var _0x63f282=_0xbc7c[_0xd4e6b4];return _0x63f282;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xcbc7('0x0'));var interaction=require(_0xcbc7('0x1'));var config=require('../../config/environment');var controller=require(_0xcbc7('0x2'));router[_0xcbc7('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcbc7('0x3')](_0xcbc7('0x4'),auth['isAuthenticated'](),controller['show']);router[_0xcbc7('0x5')]('/',auth['isAuthenticated'](),controller[_0xcbc7('0x6')]);router[_0xcbc7('0x7')]('/:id',auth[_0xcbc7('0x8')](),controller['update']);router['delete'](_0xcbc7('0x4'),auth[_0xcbc7('0x8')](),controller[_0xcbc7('0x9')]);module['exports']=router; \ No newline at end of file +var _0x7487=['../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','connect-timeout','Router'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0x7487,0x140));var _0x7748=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x7487[_0x121b1a];return _0x2d89a6;};'use strict';var multer=require(_0x7748('0x0'));var util=require(_0x7748('0x1'));var path=require('path');var timeout=require(_0x7748('0x2'));var express=require('express');var router=express[_0x7748('0x3')]();var auth=require(_0x7748('0x4'));var interaction=require(_0x7748('0x5'));var config=require(_0x7748('0x6'));var controller=require(_0x7748('0x7'));router[_0x7748('0x8')]('/',auth[_0x7748('0x9')](),controller[_0x7748('0xa')]);router[_0x7748('0x8')](_0x7748('0xb'),auth[_0x7748('0x9')](),controller[_0x7748('0xc')]);router[_0x7748('0xd')]('/',auth[_0x7748('0x9')](),controller[_0x7748('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7748('0xf')]);router[_0x7748('0x10')](_0x7748('0xb'),auth[_0x7748('0x9')](),controller['destroy']);module[_0x7748('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 813236c..d5c8652 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 _0x9cca=['exports','name','STRING'];(function(_0x15d35c,_0x5ad523){var _0x1913fa=function(_0x388365){while(--_0x388365){_0x15d35c['push'](_0x15d35c['shift']());}};_0x1913fa(++_0x5ad523);}(_0x9cca,0x156));var _0xa9cc=function(_0xc8accf,_0x12b987){_0xc8accf=_0xc8accf-0x0;var _0x4364b7=_0x9cca[_0xc8accf];return _0x4364b7;};'use strict';var Sequelize=require('sequelize');module[_0xa9cc('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa9cc('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xa9cc('0x2')]}}; \ No newline at end of file +var _0x35b6=['sequelize','STRING','name'];(function(_0x44e422,_0x2be343){var _0x13d7f5=function(_0x27fb50){while(--_0x27fb50){_0x44e422['push'](_0x44e422['shift']());}};_0x13d7f5(++_0x2be343);}(_0x35b6,0x15c));var _0x635b=function(_0x42fee7,_0x583a2d){_0x42fee7=_0x42fee7-0x0;var _0x5f2366=_0x35b6[_0x42fee7];return _0x5f2366;};'use strict';var Sequelize=require(_0x635b('0x0'));module['exports']={'name':{'type':Sequelize[_0x635b('0x1')],'unique':_0x635b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x635b('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 9ab48dc..48a119e 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 _0x4536=['to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','UserProfileResource','name','send','index','map','Pause','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x134672,_0x84491e){var _0x4adf90=function(_0x371834){while(--_0x371834){_0x134672['push'](_0x134672['shift']());}};_0x4adf90(++_0x84491e);}(_0x4536,0x18a));var _0x6453=function(_0x5786f9,_0x59a148){_0x5786f9=_0x5786f9-0x0;var _0x22c3cf=_0x4536[_0x5786f9];return _0x22c3cf;};'use strict';var pdf=require(_0x6453('0x0'));var emlformat=require(_0x6453('0x1'));var rimraf=require(_0x6453('0x2'));var zipdir=require(_0x6453('0x3'));var jsonpatch=require(_0x6453('0x4'));var rp=require(_0x6453('0x5'));var moment=require(_0x6453('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x6453('0x7'));var util=require(_0x6453('0x8'));var path=require(_0x6453('0x9'));var sox=require(_0x6453('0xa'));var csv=require(_0x6453('0xb'));var ejs=require(_0x6453('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6453('0xd'));var jsforce=require(_0x6453('0xe'));var deskjs=require(_0x6453('0xf'));var toCsv=require(_0x6453('0xb'));var querystring=require(_0x6453('0x10'));var Papa=require(_0x6453('0x11'));var Redis=require(_0x6453('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(_0x6453('0x13'))(_0x6453('0x14'));var utils=require(_0x6453('0x15'));var config=require(_0x6453('0x16'));var db=require(_0x6453('0x17'))['db'];function respondWithStatusCode(_0x9f9895,_0x295365){_0x295365=_0x295365||0xcc;return function(_0x4678af){if(_0x4678af){return _0x9f9895[_0x6453('0x18')](_0x295365);}return _0x9f9895['status'](_0x295365)[_0x6453('0x19')]();};}function respondWithResult(_0x52237c,_0x2505d5){_0x2505d5=_0x2505d5||0xc8;return function(_0x258494){if(_0x258494){return _0x52237c[_0x6453('0x1a')](_0x2505d5)[_0x6453('0x1b')](_0x258494);}};}function respondWithFilteredResult(_0x544054,_0x36f3d3){return function(_0x225fc8){if(_0x225fc8){var _0x44c20a=_0x225fc8[_0x6453('0x1c')],_0x566713=_0x36f3d3[_0x6453('0x1d')],_0x201db1=_0x36f3d3['offset']+_0x36f3d3[_0x6453('0x1e')],_0x43d0a4;if(_0x201db1>=_0x44c20a){_0x201db1=_0x44c20a;_0x43d0a4=0xc8;}else{_0x43d0a4=0xce;}_0x544054[_0x6453('0x1a')](_0x43d0a4);return _0x544054['set'](_0x6453('0x1f'),_0x566713+'-'+_0x201db1+'/'+_0x44c20a)['json'](_0x225fc8);}return null;};}function patchUpdates(_0x5265b9){return function(_0x47d886){try{jsonpatch[_0x6453('0x20')](_0x47d886,_0x5265b9,!![]);}catch(_0x1d503c){return BPromise[_0x6453('0x21')](_0x1d503c);}return _0x47d886['save']();};}function saveUpdates(_0x2fed84,_0x5130e1){return function(_0x2a25b4){if(_0x2a25b4){return _0x2a25b4[_0x6453('0x22')](_0x2fed84)[_0x6453('0x23')](function(_0x2367ad){return _0x2367ad;});}return null;};}function removeEntity(_0x14b1e9,_0x411563){return function(_0x5b32be){if(_0x5b32be){return _0x5b32be[_0x6453('0x24')]()[_0x6453('0x23')](function(){var _0xa1e8db=_0x5b32be['get']({'plain':!![]});var _0x4f978d='Pauses';return db[_0x6453('0x25')]['destroy']({'where':{'type':_0x4f978d,'resourceId':_0xa1e8db['id']}})[_0x6453('0x23')](function(){return _0x5b32be;});})[_0x6453('0x23')](function(){_0x14b1e9[_0x6453('0x1a')](0xcc)[_0x6453('0x19')]();});}};}function handleEntityNotFound(_0x3283c8,_0x2de9f3){return function(_0x291062){if(!_0x291062){_0x3283c8[_0x6453('0x18')](0x194);}return _0x291062;};}function handleError(_0x168c24,_0x2f0cec){_0x2f0cec=_0x2f0cec||0x1f4;return function(_0x2c6ebf){logger['error'](_0x2c6ebf['stack']);if(_0x2c6ebf[_0x6453('0x26')]){delete _0x2c6ebf[_0x6453('0x26')];}_0x168c24['status'](_0x2f0cec)[_0x6453('0x27')](_0x2c6ebf);};}exports[_0x6453('0x28')]=function(_0x48ad2e,_0x33afc1){var _0x1068ce={},_0x4e3002={},_0x523c51={'count':0x0,'rows':[]};var _0x569d92=_[_0x6453('0x29')](db[_0x6453('0x2a')]['rawAttributes'],function(_0x5e5762){return{'name':_0x5e5762[_0x6453('0x2b')],'type':_0x5e5762['type'][_0x6453('0x2c')]};});_0x4e3002['model']=_[_0x6453('0x29')](_0x569d92,_0x6453('0x26'));_0x4e3002[_0x6453('0x2d')]=_[_0x6453('0x2e')](_0x48ad2e[_0x6453('0x2d')]);_0x4e3002[_0x6453('0x2f')]=_['intersection'](_0x4e3002[_0x6453('0x30')],_0x4e3002[_0x6453('0x2d')]);_0x1068ce[_0x6453('0x31')]=_[_0x6453('0x32')](_0x4e3002['model'],qs[_0x6453('0x33')](_0x48ad2e[_0x6453('0x2d')]['fields']));_0x1068ce[_0x6453('0x31')]=_0x1068ce[_0x6453('0x31')][_0x6453('0x34')]?_0x1068ce[_0x6453('0x31')]:_0x4e3002['model'];if(!_0x48ad2e[_0x6453('0x2d')][_0x6453('0x35')](_0x6453('0x36'))){_0x1068ce[_0x6453('0x1e')]=qs['limit'](_0x48ad2e[_0x6453('0x2d')]['limit']);_0x1068ce['offset']=qs['offset'](_0x48ad2e['query']['offset']);}_0x1068ce[_0x6453('0x37')]=qs[_0x6453('0x38')](_0x48ad2e[_0x6453('0x2d')][_0x6453('0x38')]);_0x1068ce[_0x6453('0x39')]=qs[_0x6453('0x2f')](_['pick'](_0x48ad2e[_0x6453('0x2d')],_0x4e3002[_0x6453('0x2f')]),_0x569d92);if(_0x48ad2e['query']['filter']){_0x1068ce[_0x6453('0x39')]=_[_0x6453('0x3a')](_0x1068ce[_0x6453('0x39')],{'$or':_[_0x6453('0x29')](_0x569d92,function(_0x238e84){if(_0x238e84[_0x6453('0x3b')]!=='VIRTUAL'){var _0x581e31={};_0x581e31[_0x238e84[_0x6453('0x26')]]={'$like':'%'+_0x48ad2e['query']['filter']+'%'};return _0x581e31;}})});}_0x1068ce=_[_0x6453('0x3a')]({},_0x1068ce,_0x48ad2e['options']);var _0xa68578={'where':_0x1068ce['where']};return db['Pause']['count'](_0xa68578)[_0x6453('0x23')](function(_0x1f53c1){_0x523c51['count']=_0x1f53c1;if(_0x48ad2e[_0x6453('0x2d')][_0x6453('0x3c')]){_0x1068ce[_0x6453('0x3d')]=[{'all':!![]}];}return db[_0x6453('0x2a')][_0x6453('0x3e')](_0x1068ce);})[_0x6453('0x23')](function(_0x5c1400){_0x523c51['rows']=_0x5c1400;return _0x523c51;})['then'](respondWithFilteredResult(_0x33afc1,_0x1068ce))[_0x6453('0x3f')](handleError(_0x33afc1,null));};exports[_0x6453('0x40')]=function(_0x18eb6c,_0x417e39){var _0xa8f8f1={'raw':!![],'where':{'id':_0x18eb6c[_0x6453('0x41')]['id']}},_0x1ff7e2={};_0x1ff7e2['model']=_[_0x6453('0x2e')](db[_0x6453('0x2a')][_0x6453('0x42')]);_0x1ff7e2[_0x6453('0x2d')]=_[_0x6453('0x2e')](_0x18eb6c['query']);_0x1ff7e2['filters']=_[_0x6453('0x32')](_0x1ff7e2[_0x6453('0x30')],_0x1ff7e2[_0x6453('0x2d')]);_0xa8f8f1['attributes']=_['intersection'](_0x1ff7e2['model'],qs['fields'](_0x18eb6c[_0x6453('0x2d')]['fields']));_0xa8f8f1['attributes']=_0xa8f8f1['attributes'][_0x6453('0x34')]?_0xa8f8f1[_0x6453('0x31')]:_0x1ff7e2[_0x6453('0x30')];if(_0x18eb6c['query'][_0x6453('0x3c')]){_0xa8f8f1[_0x6453('0x3d')]=[{'all':!![]}];}_0xa8f8f1=_[_0x6453('0x3a')]({},_0xa8f8f1,_0x18eb6c[_0x6453('0x43')]);return db[_0x6453('0x2a')][_0x6453('0x44')](_0xa8f8f1)[_0x6453('0x23')](handleEntityNotFound(_0x417e39,null))[_0x6453('0x23')](respondWithResult(_0x417e39,null))[_0x6453('0x3f')](handleError(_0x417e39,null));};exports[_0x6453('0x45')]=function(_0xd59c98,_0x23d885){return db['Pause'][_0x6453('0x45')](_0xd59c98[_0x6453('0x46')],{})['then'](function(_0x4acfcc){var _0x1bdc6d=_0xd59c98[_0x6453('0x47')][_0x6453('0x48')]({'plain':!![]});if(!_0x1bdc6d)throw new Error(_0x6453('0x49'));if(_0x1bdc6d[_0x6453('0x4a')]===_0x6453('0x47')){var _0x3bff42=_0x4acfcc['get']({'plain':!![]});var _0x59bc4c=_0x6453('0x4b');return db[_0x6453('0x4c')]['find']({'where':{'name':_0x59bc4c,'userProfileId':_0x1bdc6d[_0x6453('0x4d')]},'raw':!![]})[_0x6453('0x23')](function(_0x3bfe34){if(_0x3bfe34&&_0x3bfe34[_0x6453('0x4e')]===0x0){return db[_0x6453('0x25')][_0x6453('0x45')]({'name':_0x3bff42[_0x6453('0x26')],'resourceId':_0x3bff42['id'],'type':_0x3bfe34['name'],'sectionId':_0x3bfe34['id']},{})[_0x6453('0x23')](function(){return _0x4acfcc;});}else{return _0x4acfcc;}})[_0x6453('0x3f')](function(_0x256db7){logger[_0x6453('0x4f')](_0x6453('0x50'),_0x256db7);throw _0x256db7;});}return _0x4acfcc;})[_0x6453('0x23')](respondWithResult(_0x23d885,0xc9))[_0x6453('0x3f')](handleError(_0x23d885,null));};exports[_0x6453('0x22')]=function(_0x12286f,_0x8b2942){if(_0x12286f[_0x6453('0x46')]['id']){delete _0x12286f[_0x6453('0x46')]['id'];}return db[_0x6453('0x2a')][_0x6453('0x44')]({'where':{'id':_0x12286f[_0x6453('0x41')]['id']}})['then'](handleEntityNotFound(_0x8b2942,null))[_0x6453('0x23')](saveUpdates(_0x12286f[_0x6453('0x46')],null))[_0x6453('0x23')](respondWithResult(_0x8b2942,null))[_0x6453('0x3f')](handleError(_0x8b2942,null));};exports['destroy']=function(_0x31ad59,_0x280b01){return db['Pause'][_0x6453('0x44')]({'where':{'id':_0x31ad59[_0x6453('0x41')]['id']}})[_0x6453('0x23')](handleEntityNotFound(_0x280b01,null))['then'](removeEntity(_0x280b01,null))[_0x6453('0x3f')](handleError(_0x280b01,null));}; \ No newline at end of file +var _0x5a8c=['moment','mustache','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','Pauses','destroy','end','sendStatus','stack','name','send','index','map','Pause','rawAttributes','model','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x32a779,_0x359c6b){var _0x1743e0=function(_0x196b71){while(--_0x196b71){_0x32a779['push'](_0x32a779['shift']());}};_0x1743e0(++_0x359c6b);}(_0x5a8c,0xe5));var _0xc5a8=function(_0x86794c,_0x5df4b0){_0x86794c=_0x86794c-0x0;var _0x2ea7a8=_0x5a8c[_0x86794c];return _0x2ea7a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc5a8('0x0'));var rimraf=require(_0xc5a8('0x1'));var zipdir=require(_0xc5a8('0x2'));var jsonpatch=require(_0xc5a8('0x3'));var rp=require(_0xc5a8('0x4'));var moment=require(_0xc5a8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc5a8('0x6'));var util=require(_0xc5a8('0x7'));var path=require(_0xc5a8('0x8'));var sox=require(_0xc5a8('0x9'));var csv=require(_0xc5a8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc5a8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc5a8('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc5a8('0xd'));var Papa=require(_0xc5a8('0xe'));var Redis=require('ioredis');var authService=require(_0xc5a8('0xf'));var qs=require(_0xc5a8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5a8('0x11'));var logger=require(_0xc5a8('0x12'))(_0xc5a8('0x13'));var utils=require(_0xc5a8('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25cb9d,_0x314c52){_0x314c52=_0x314c52||0xcc;return function(_0x57a006){if(_0x57a006){return _0x25cb9d['sendStatus'](_0x314c52);}return _0x25cb9d[_0xc5a8('0x15')](_0x314c52)['end']();};}function respondWithResult(_0x27a14a,_0x1c6ecf){_0x1c6ecf=_0x1c6ecf||0xc8;return function(_0x3b3b52){if(_0x3b3b52){return _0x27a14a['status'](_0x1c6ecf)[_0xc5a8('0x16')](_0x3b3b52);}};}function respondWithFilteredResult(_0x14db58,_0xd235fa){return function(_0x3cce3b){if(_0x3cce3b){var _0x499f8f=_0x3cce3b[_0xc5a8('0x17')],_0x30fd2b=_0xd235fa[_0xc5a8('0x18')],_0x3c7555=_0xd235fa[_0xc5a8('0x18')]+_0xd235fa[_0xc5a8('0x19')],_0x56f03a;if(_0x3c7555>=_0x499f8f){_0x3c7555=_0x499f8f;_0x56f03a=0xc8;}else{_0x56f03a=0xce;}_0x14db58[_0xc5a8('0x15')](_0x56f03a);return _0x14db58[_0xc5a8('0x1a')](_0xc5a8('0x1b'),_0x30fd2b+'-'+_0x3c7555+'/'+_0x499f8f)[_0xc5a8('0x16')](_0x3cce3b);}return null;};}function patchUpdates(_0x40b9e1){return function(_0x2ab8b1){try{jsonpatch[_0xc5a8('0x1c')](_0x2ab8b1,_0x40b9e1,!![]);}catch(_0x57b6c3){return BPromise[_0xc5a8('0x1d')](_0x57b6c3);}return _0x2ab8b1[_0xc5a8('0x1e')]();};}function saveUpdates(_0x49fc2a,_0x5f2852){return function(_0x5948b6){if(_0x5948b6){return _0x5948b6['update'](_0x49fc2a)[_0xc5a8('0x1f')](function(_0x14b143){return _0x14b143;});}return null;};}function removeEntity(_0x1fb93f,_0x3f58fd){return function(_0x369e0a){if(_0x369e0a){return _0x369e0a['destroy']()[_0xc5a8('0x1f')](function(){var _0x32af8f=_0x369e0a[_0xc5a8('0x20')]({'plain':!![]});var _0x123b31=_0xc5a8('0x21');return db['UserProfileResource'][_0xc5a8('0x22')]({'where':{'type':_0x123b31,'resourceId':_0x32af8f['id']}})[_0xc5a8('0x1f')](function(){return _0x369e0a;});})[_0xc5a8('0x1f')](function(){_0x1fb93f[_0xc5a8('0x15')](0xcc)[_0xc5a8('0x23')]();});}};}function handleEntityNotFound(_0x24168a,_0x129c1d){return function(_0x20c199){if(!_0x20c199){_0x24168a[_0xc5a8('0x24')](0x194);}return _0x20c199;};}function handleError(_0x171e01,_0x7b566c){_0x7b566c=_0x7b566c||0x1f4;return function(_0x58eb95){logger['error'](_0x58eb95[_0xc5a8('0x25')]);if(_0x58eb95[_0xc5a8('0x26')]){delete _0x58eb95[_0xc5a8('0x26')];}_0x171e01[_0xc5a8('0x15')](_0x7b566c)[_0xc5a8('0x27')](_0x58eb95);};}exports[_0xc5a8('0x28')]=function(_0x490bdf,_0x7dbe3e){var _0x1a15d6={},_0x3c4200={},_0x53e518={'count':0x0,'rows':[]};var _0x5a4203=_[_0xc5a8('0x29')](db[_0xc5a8('0x2a')][_0xc5a8('0x2b')],function(_0x19df06){return{'name':_0x19df06['fieldName'],'type':_0x19df06['type']['key']};});_0x3c4200[_0xc5a8('0x2c')]=_[_0xc5a8('0x29')](_0x5a4203,_0xc5a8('0x26'));_0x3c4200[_0xc5a8('0x2d')]=_['keys'](_0x490bdf[_0xc5a8('0x2d')]);_0x3c4200[_0xc5a8('0x2e')]=_[_0xc5a8('0x2f')](_0x3c4200['model'],_0x3c4200[_0xc5a8('0x2d')]);_0x1a15d6['attributes']=_[_0xc5a8('0x2f')](_0x3c4200[_0xc5a8('0x2c')],qs[_0xc5a8('0x30')](_0x490bdf[_0xc5a8('0x2d')][_0xc5a8('0x30')]));_0x1a15d6[_0xc5a8('0x31')]=_0x1a15d6[_0xc5a8('0x31')]['length']?_0x1a15d6[_0xc5a8('0x31')]:_0x3c4200[_0xc5a8('0x2c')];if(!_0x490bdf[_0xc5a8('0x2d')]['hasOwnProperty']('nolimit')){_0x1a15d6['limit']=qs[_0xc5a8('0x19')](_0x490bdf[_0xc5a8('0x2d')]['limit']);_0x1a15d6[_0xc5a8('0x18')]=qs['offset'](_0x490bdf['query'][_0xc5a8('0x18')]);}_0x1a15d6[_0xc5a8('0x32')]=qs[_0xc5a8('0x33')](_0x490bdf[_0xc5a8('0x2d')][_0xc5a8('0x33')]);_0x1a15d6[_0xc5a8('0x34')]=qs[_0xc5a8('0x2e')](_[_0xc5a8('0x35')](_0x490bdf[_0xc5a8('0x2d')],_0x3c4200['filters']),_0x5a4203);if(_0x490bdf[_0xc5a8('0x2d')][_0xc5a8('0x36')]){_0x1a15d6[_0xc5a8('0x34')]=_['merge'](_0x1a15d6[_0xc5a8('0x34')],{'$or':_[_0xc5a8('0x29')](_0x5a4203,function(_0x22c698){if(_0x22c698[_0xc5a8('0x37')]!==_0xc5a8('0x38')){var _0x312f4c={};_0x312f4c[_0x22c698['name']]={'$like':'%'+_0x490bdf[_0xc5a8('0x2d')][_0xc5a8('0x36')]+'%'};return _0x312f4c;}})});}_0x1a15d6=_['merge']({},_0x1a15d6,_0x490bdf['options']);var _0x15327b={'where':_0x1a15d6[_0xc5a8('0x34')]};return db[_0xc5a8('0x2a')][_0xc5a8('0x17')](_0x15327b)['then'](function(_0x2fb557){_0x53e518['count']=_0x2fb557;if(_0x490bdf[_0xc5a8('0x2d')][_0xc5a8('0x39')]){_0x1a15d6[_0xc5a8('0x3a')]=[{'all':!![]}];}return db['Pause'][_0xc5a8('0x3b')](_0x1a15d6);})['then'](function(_0x45f7fb){_0x53e518[_0xc5a8('0x3c')]=_0x45f7fb;return _0x53e518;})[_0xc5a8('0x1f')](respondWithFilteredResult(_0x7dbe3e,_0x1a15d6))[_0xc5a8('0x3d')](handleError(_0x7dbe3e,null));};exports[_0xc5a8('0x3e')]=function(_0x21edd6,_0x5d67a4){var _0x52d417={'raw':!![],'where':{'id':_0x21edd6[_0xc5a8('0x3f')]['id']}},_0x3cdc18={};_0x3cdc18[_0xc5a8('0x2c')]=_[_0xc5a8('0x40')](db['Pause'][_0xc5a8('0x2b')]);_0x3cdc18['query']=_[_0xc5a8('0x40')](_0x21edd6[_0xc5a8('0x2d')]);_0x3cdc18[_0xc5a8('0x2e')]=_[_0xc5a8('0x2f')](_0x3cdc18[_0xc5a8('0x2c')],_0x3cdc18[_0xc5a8('0x2d')]);_0x52d417[_0xc5a8('0x31')]=_[_0xc5a8('0x2f')](_0x3cdc18[_0xc5a8('0x2c')],qs[_0xc5a8('0x30')](_0x21edd6[_0xc5a8('0x2d')][_0xc5a8('0x30')]));_0x52d417[_0xc5a8('0x31')]=_0x52d417[_0xc5a8('0x31')][_0xc5a8('0x41')]?_0x52d417['attributes']:_0x3cdc18['model'];if(_0x21edd6[_0xc5a8('0x2d')][_0xc5a8('0x39')]){_0x52d417[_0xc5a8('0x3a')]=[{'all':!![]}];}_0x52d417=_[_0xc5a8('0x42')]({},_0x52d417,_0x21edd6[_0xc5a8('0x43')]);return db[_0xc5a8('0x2a')]['find'](_0x52d417)[_0xc5a8('0x1f')](handleEntityNotFound(_0x5d67a4,null))['then'](respondWithResult(_0x5d67a4,null))[_0xc5a8('0x3d')](handleError(_0x5d67a4,null));};exports[_0xc5a8('0x44')]=function(_0x5f59c7,_0x2f6918){return db[_0xc5a8('0x2a')][_0xc5a8('0x44')](_0x5f59c7[_0xc5a8('0x45')],{})[_0xc5a8('0x1f')](function(_0x3656d9){var _0x354065=_0x5f59c7[_0xc5a8('0x46')][_0xc5a8('0x20')]({'plain':!![]});if(!_0x354065)throw new Error(_0xc5a8('0x47'));if(_0x354065[_0xc5a8('0x48')]===_0xc5a8('0x46')){var _0x4592c9=_0x3656d9[_0xc5a8('0x20')]({'plain':!![]});var _0x2913a7=_0xc5a8('0x21');return db[_0xc5a8('0x49')][_0xc5a8('0x4a')]({'where':{'name':_0x2913a7,'userProfileId':_0x354065[_0xc5a8('0x4b')]},'raw':!![]})[_0xc5a8('0x1f')](function(_0x368c54){if(_0x368c54&&_0x368c54['autoAssociation']===0x0){return db['UserProfileResource'][_0xc5a8('0x44')]({'name':_0x4592c9['name'],'resourceId':_0x4592c9['id'],'type':_0x368c54['name'],'sectionId':_0x368c54['id']},{})[_0xc5a8('0x1f')](function(){return _0x3656d9;});}else{return _0x3656d9;}})[_0xc5a8('0x3d')](function(_0x136269){logger['error'](_0xc5a8('0x4c'),_0x136269);throw _0x136269;});}return _0x3656d9;})[_0xc5a8('0x1f')](respondWithResult(_0x2f6918,0xc9))[_0xc5a8('0x3d')](handleError(_0x2f6918,null));};exports[_0xc5a8('0x4d')]=function(_0x4ee81f,_0xdd4c4a){if(_0x4ee81f[_0xc5a8('0x45')]['id']){delete _0x4ee81f['body']['id'];}return db[_0xc5a8('0x2a')][_0xc5a8('0x4a')]({'where':{'id':_0x4ee81f[_0xc5a8('0x3f')]['id']}})[_0xc5a8('0x1f')](handleEntityNotFound(_0xdd4c4a,null))[_0xc5a8('0x1f')](saveUpdates(_0x4ee81f[_0xc5a8('0x45')],null))['then'](respondWithResult(_0xdd4c4a,null))[_0xc5a8('0x3d')](handleError(_0xdd4c4a,null));};exports['destroy']=function(_0x19cd28,_0x3680eb){return db[_0xc5a8('0x2a')]['find']({'where':{'id':_0x19cd28['params']['id']}})[_0xc5a8('0x1f')](handleEntityNotFound(_0x3680eb,null))['then'](removeEntity(_0x3680eb,null))[_0xc5a8('0x3d')](handleError(_0x3680eb,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 1cbe7d7..8084078 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 _0x1ec3=['path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','moment','bluebird'];(function(_0x87d3ec,_0x387888){var _0x5f3f6f=function(_0x5492ac){while(--_0x5492ac){_0x87d3ec['push'](_0x87d3ec['shift']());}};_0x5f3f6f(++_0x387888);}(_0x1ec3,0xa4));var _0x31ec=function(_0x280d63,_0xb3c4be){_0x280d63=_0x280d63-0x0;var _0x5e88a1=_0x1ec3[_0x280d63];return _0x5e88a1;};'use strict';var _=require(_0x31ec('0x0'));var util=require(_0x31ec('0x1'));var logger=require(_0x31ec('0x2'))('api');var moment=require(_0x31ec('0x3'));var BPromise=require(_0x31ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31ec('0x5'));var rimraf=require(_0x31ec('0x6'));var config=require(_0x31ec('0x7'));var attributes=require(_0x31ec('0x8'));module[_0x31ec('0x9')]=function(_0x37ee08,_0x5a94f4){return _0x37ee08[_0x31ec('0xa')](_0x31ec('0xb'),attributes,{'tableName':_0x31ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85ef=['Pause','tools_pauses','lodash','api','request-promise','../../config/environment','exports','define'];(function(_0x4249f5,_0x949cd5){var _0x217990=function(_0x52fe01){while(--_0x52fe01){_0x4249f5['push'](_0x4249f5['shift']());}};_0x217990(++_0x949cd5);}(_0x85ef,0x162));var _0xf85e=function(_0x557c7f,_0x3de638){_0x557c7f=_0x557c7f-0x0;var _0x2e596b=_0x85ef[_0x557c7f];return _0x2e596b;};'use strict';var _=require(_0xf85e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf85e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf85e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf85e('0x3'));var attributes=require('./pause.attributes');module[_0xf85e('0x4')]=function(_0x3610aa,_0x864e22){return _0x3610aa[_0xf85e('0x5')](_0xf85e('0x6'),attributes,{'tableName':_0xf85e('0x7'),'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 09b2754..cf6efde 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 _0x9d58=['request','info','Pause,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowPause','options','where','include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x60fbb5,_0x373e91){var _0x4fad02=function(_0x3c41b6){while(--_0x3c41b6){_0x60fbb5['push'](_0x60fbb5['shift']());}};_0x4fad02(++_0x373e91);}(_0x9d58,0x179));var _0x89d5=function(_0x2095ed,_0x156cfb){_0x2095ed=_0x2095ed-0x0;var _0x22dbb0=_0x9d58[_0x2095ed];return _0x22dbb0;};'use strict';var _=require(_0x89d5('0x0'));var util=require('util');var moment=require(_0x89d5('0x1'));var BPromise=require(_0x89d5('0x2'));var rs=require(_0x89d5('0x3'));var fs=require('fs');var Redis=require(_0x89d5('0x4'));var db=require(_0x89d5('0x5'))['db'];var utils=require(_0x89d5('0x6'));var logger=require(_0x89d5('0x7'))(_0x89d5('0x8'));var config=require(_0x89d5('0x9'));var jayson=require(_0x89d5('0xa'));var client=jayson[_0x89d5('0xb')][_0x89d5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cdb88,_0x4c55e2,_0x55b054){return new BPromise(function(_0x57ca57,_0x14072b){return client[_0x89d5('0xd')](_0x2cdb88,_0x55b054)['then'](function(_0xf315de){logger[_0x89d5('0xe')](_0x89d5('0xf'),_0x4c55e2,_0x89d5('0x10'));logger[_0x89d5('0x11')]('Pause,\x20%s,\x20%s,\x20%s',_0x4c55e2,_0x89d5('0x10'),JSON[_0x89d5('0x12')](_0xf315de));if(_0xf315de['error']){if(_0xf315de[_0x89d5('0x13')][_0x89d5('0x14')]===0x1f4){logger[_0x89d5('0x13')]('Pause,\x20%s,\x20%s',_0x4c55e2,_0xf315de['error'][_0x89d5('0x15')]);return _0x14072b(_0xf315de[_0x89d5('0x13')]['message']);}logger[_0x89d5('0x13')](_0x89d5('0xf'),_0x4c55e2,_0xf315de['error'][_0x89d5('0x15')]);return _0x57ca57(_0xf315de['error'][_0x89d5('0x15')]);}else{logger['info'](_0x89d5('0xf'),_0x4c55e2,_0x89d5('0x10'));_0x57ca57(_0xf315de[_0x89d5('0x16')][_0x89d5('0x15')]);}})['catch'](function(_0x152516){logger[_0x89d5('0x13')]('Pause,\x20%s,\x20%s',_0x4c55e2,_0x152516);_0x14072b(_0x152516);});});}exports[_0x89d5('0x17')]=function(_0x20eb54){var _0x4ce0a8=this;return new Promise(function(_0x2c4045,_0x361323){return db['Pause']['find']({'raw':_0x20eb54['options']?_0x20eb54[_0x89d5('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x20eb54[_0x89d5('0x18')]?_0x20eb54[_0x89d5('0x18')][_0x89d5('0x19')]||null:null,'attributes':_0x20eb54[_0x89d5('0x18')]?_0x20eb54[_0x89d5('0x18')]['attributes']||null:null,'include':_0x20eb54[_0x89d5('0x18')]?_0x20eb54[_0x89d5('0x18')][_0x89d5('0x1a')]?_['map'](_0x20eb54[_0x89d5('0x18')]['include'],function(_0x119405){return{'model':db[_0x119405[_0x89d5('0x1b')]],'as':_0x119405['as'],'attributes':_0x119405[_0x89d5('0x1c')],'include':_0x119405[_0x89d5('0x1a')]?_[_0x89d5('0x1d')](_0x119405[_0x89d5('0x1a')],function(_0xa16946){return{'model':db[_0xa16946[_0x89d5('0x1b')]],'as':_0xa16946['as'],'attributes':_0xa16946['attributes'],'include':_0xa16946[_0x89d5('0x1a')]?_['map'](_0xa16946['include'],function(_0x2c1955){return{'model':db[_0x2c1955[_0x89d5('0x1b')]],'as':_0x2c1955['as'],'attributes':_0x2c1955[_0x89d5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e15a9){logger[_0x89d5('0xe')](_0x89d5('0x17'),_0x20eb54);logger[_0x89d5('0x11')](_0x89d5('0x17'),_0x20eb54,JSON['stringify'](_0x2e15a9));_0x2c4045(_0x2e15a9);})['catch'](function(_0x1eca3e){logger[_0x89d5('0x13')]('ShowPause',_0x1eca3e['message'],_0x20eb54);_0x361323(_0x4ce0a8[_0x89d5('0x13')](0x1f4,_0x1eca3e[_0x89d5('0x15')]));});});}; \ No newline at end of file +var _0x1fa7=['options','raw','where','attributes','map','model','include','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowPause','find'];(function(_0x2160d1,_0x10c2dc){var _0x1ed631=function(_0xb8bc73){while(--_0xb8bc73){_0x2160d1['push'](_0x2160d1['shift']());}};_0x1ed631(++_0x10c2dc);}(_0x1fa7,0x151));var _0x71fa=function(_0x424f1a,_0x5906bc){_0x424f1a=_0x424f1a-0x0;var _0x44cbf1=_0x1fa7[_0x424f1a];return _0x44cbf1;};'use strict';var _=require('lodash');var util=require(_0x71fa('0x0'));var moment=require(_0x71fa('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71fa('0x2'));var db=require(_0x71fa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x71fa('0x4'))('rpc');var config=require(_0x71fa('0x5'));var jayson=require(_0x71fa('0x6'));var client=jayson[_0x71fa('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa06ae9,_0x442069,_0x37a87c){return new BPromise(function(_0x5bd4ed,_0x51e3f4){return client[_0x71fa('0x8')](_0xa06ae9,_0x37a87c)[_0x71fa('0x9')](function(_0x25da9d){logger[_0x71fa('0xa')](_0x71fa('0xb'),_0x442069,'request\x20sent');logger[_0x71fa('0xc')](_0x71fa('0xd'),_0x442069,_0x71fa('0xe'),JSON[_0x71fa('0xf')](_0x25da9d));if(_0x25da9d[_0x71fa('0x10')]){if(_0x25da9d['error'][_0x71fa('0x11')]===0x1f4){logger[_0x71fa('0x10')]('Pause,\x20%s,\x20%s',_0x442069,_0x25da9d[_0x71fa('0x10')][_0x71fa('0x12')]);return _0x51e3f4(_0x25da9d['error'][_0x71fa('0x12')]);}logger[_0x71fa('0x10')](_0x71fa('0xb'),_0x442069,_0x25da9d[_0x71fa('0x10')][_0x71fa('0x12')]);return _0x5bd4ed(_0x25da9d[_0x71fa('0x10')][_0x71fa('0x12')]);}else{logger[_0x71fa('0xa')]('Pause,\x20%s,\x20%s',_0x442069,_0x71fa('0xe'));_0x5bd4ed(_0x25da9d[_0x71fa('0x13')][_0x71fa('0x12')]);}})[_0x71fa('0x14')](function(_0x542e1a){logger['error'](_0x71fa('0xb'),_0x442069,_0x542e1a);_0x51e3f4(_0x542e1a);});});}exports[_0x71fa('0x15')]=function(_0x1f88b5){var _0x2e8d57=this;return new Promise(function(_0xa78e6a,_0x3ddb6b){return db['Pause'][_0x71fa('0x16')]({'raw':_0x1f88b5['options']?_0x1f88b5[_0x71fa('0x17')][_0x71fa('0x18')]===undefined?!![]:![]:!![],'where':_0x1f88b5[_0x71fa('0x17')]?_0x1f88b5[_0x71fa('0x17')][_0x71fa('0x19')]||null:null,'attributes':_0x1f88b5['options']?_0x1f88b5[_0x71fa('0x17')][_0x71fa('0x1a')]||null:null,'include':_0x1f88b5[_0x71fa('0x17')]?_0x1f88b5[_0x71fa('0x17')]['include']?_[_0x71fa('0x1b')](_0x1f88b5['options']['include'],function(_0x1c7041){return{'model':db[_0x1c7041[_0x71fa('0x1c')]],'as':_0x1c7041['as'],'attributes':_0x1c7041[_0x71fa('0x1a')],'include':_0x1c7041[_0x71fa('0x1d')]?_[_0x71fa('0x1b')](_0x1c7041[_0x71fa('0x1d')],function(_0x4490ed){return{'model':db[_0x4490ed[_0x71fa('0x1c')]],'as':_0x4490ed['as'],'attributes':_0x4490ed[_0x71fa('0x1a')],'include':_0x4490ed[_0x71fa('0x1d')]?_['map'](_0x4490ed[_0x71fa('0x1d')],function(_0x4ad521){return{'model':db[_0x4ad521[_0x71fa('0x1c')]],'as':_0x4ad521['as'],'attributes':_0x4ad521[_0x71fa('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x71fa('0x9')](function(_0x24274c){logger['info']('ShowPause',_0x1f88b5);logger[_0x71fa('0xc')](_0x71fa('0x15'),_0x1f88b5,JSON[_0x71fa('0xf')](_0x24274c));_0xa78e6a(_0x24274c);})[_0x71fa('0x14')](function(_0x41b50f){logger[_0x71fa('0x10')](_0x71fa('0x15'),_0x41b50f[_0x71fa('0x12')],_0x1f88b5);_0x3ddb6b(_0x2e8d57[_0x71fa('0x10')](0x1f4,_0x41b50f[_0x71fa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 0deeea3..26ee6e5 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 _0xd7ee=['single','file','/webhook','webhookPost','put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','join','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','post'];(function(_0x4d4141,_0x2cac76){var _0x4b4fe4=function(_0x49cc3a){while(--_0x49cc3a){_0x4d4141['push'](_0x4d4141['shift']());}};_0x4b4fe4(++_0x2cac76);}(_0xd7ee,0x1e8));var _0xed7e=function(_0x50fb34,_0x56b847){_0x50fb34=_0x50fb34-0x0;var _0x478797=_0xd7ee[_0x50fb34];return _0x478797;};'use strict';var multer=require('multer');var util=require(_0xed7e('0x0'));var path=require('path');var timeout=require(_0xed7e('0x1'));var express=require(_0xed7e('0x2'));var router=express[_0xed7e('0x3')]();var auth=require(_0xed7e('0x4'));var interaction=require(_0xed7e('0x5'));var config=require('../../config/environment');var controller=require(_0xed7e('0x6'));router[_0xed7e('0x7')]('/',auth[_0xed7e('0x8')](),controller[_0xed7e('0x9')]);router[_0xed7e('0x7')]('/webhook',controller[_0xed7e('0xa')]);router[_0xed7e('0x7')](_0xed7e('0xb'),auth[_0xed7e('0x8')](),controller[_0xed7e('0xc')]);router[_0xed7e('0x7')](_0xed7e('0xd'),auth[_0xed7e('0x8')](),controller[_0xed7e('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2db03b,_0x7cb88a,_0x379c72){_0x379c72(null,path[_0xed7e('0xf')](config['root'],_0xed7e('0x10')));},'filename':function(_0x4f89d3,_0x4c7538,_0x2d0823){_0x4c7538[_0xed7e('0x11')]=_0x4c7538[_0xed7e('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d0823(null,util[_0xed7e('0x12')](_0xed7e('0x13'),path[_0xed7e('0x14')](_0x4c7538['originalname'],path[_0xed7e('0x15')](_0x4c7538[_0xed7e('0x11')])),Date[_0xed7e('0x16')](),path[_0xed7e('0x15')](_0x4c7538[_0xed7e('0x11')])));}})});router[_0xed7e('0x17')]('/',upload[_0xed7e('0x18')](_0xed7e('0x19')),controller['upload']);router['post'](_0xed7e('0x1a'),controller[_0xed7e('0x1b')]);router[_0xed7e('0x1c')](_0xed7e('0xb'),auth[_0xed7e('0x8')](),controller[_0xed7e('0x1d')]);router[_0xed7e('0x1e')](_0xed7e('0xb'),auth[_0xed7e('0x8')](),controller[_0xed7e('0x1e')]);module[_0xed7e('0x1f')]=router; \ No newline at end of file +var _0x1631=['now','post','single','file','put','update','delete','exports','multer','path','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','root','originalname','format','basename','extname'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x1631,0x167));var _0x1163=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1631[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x1163('0x0'));var util=require('util');var path=require(_0x1163('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x1163('0x2'));var interaction=require(_0x1163('0x3'));var config=require('../../config/environment');var controller=require('./plugin.controller');router[_0x1163('0x4')]('/',auth[_0x1163('0x5')](),controller[_0x1163('0x6')]);router['get'](_0x1163('0x7'),controller[_0x1163('0x8')]);router[_0x1163('0x4')](_0x1163('0x9'),auth[_0x1163('0x5')](),controller['show']);router['get'](_0x1163('0xa'),auth[_0x1163('0x5')](),controller[_0x1163('0xb')]);var upload=multer({'storage':multer[_0x1163('0xc')]({'destination':function(_0x5a5a61,_0x23a3ff,_0x1f5571){_0x1f5571(null,path[_0x1163('0xd')](config[_0x1163('0xe')],'server/files/plugins'));},'filename':function(_0x387d6f,_0x3b2922,_0x30452d){_0x3b2922['originalname']=_0x3b2922[_0x1163('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x30452d(null,util[_0x1163('0x10')]('%s-%s%s',path[_0x1163('0x11')](_0x3b2922[_0x1163('0xf')],path[_0x1163('0x12')](_0x3b2922['originalname'])),Date[_0x1163('0x13')](),path[_0x1163('0x12')](_0x3b2922[_0x1163('0xf')])));}})});router[_0x1163('0x14')]('/',upload[_0x1163('0x15')](_0x1163('0x16')),controller['upload']);router[_0x1163('0x14')]('/webhook',controller['webhookPost']);router[_0x1163('0x17')](_0x1163('0x9'),auth['isAuthenticated'](),controller[_0x1163('0x18')]);router[_0x1163('0x19')](_0x1163('0x9'),auth['isAuthenticated'](),controller[_0x1163('0x19')]);module[_0x1163('0x1a')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 63345ee..1cf0b07 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 _0xd975=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never'];(function(_0x492f33,_0x2b300d){var _0x377487=function(_0x4fd14e){while(--_0x4fd14e){_0x492f33['push'](_0x492f33['shift']());}};_0x377487(++_0x2b300d);}(_0xd975,0x8d));var _0x5d97=function(_0x755361,_0x5dd96c){_0x755361=_0x755361-0x0;var _0x1dbcc4=_0xd975[_0x755361];return _0x1dbcc4;};'use strict';var Sequelize=require(_0x5d97('0x0'));module[_0x5d97('0x1')]={'name':{'type':Sequelize[_0x5d97('0x2')]},'type':{'type':Sequelize[_0x5d97('0x3')](_0x5d97('0x4'),_0x5d97('0x5'))},'description':{'type':Sequelize[_0x5d97('0x6')]},'version':{'type':Sequelize[_0x5d97('0x6')]},'path':{'type':Sequelize[_0x5d97('0x2')],'comment':_0x5d97('0x7')},'active':{'type':Sequelize[_0x5d97('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x5d97('0x3')](_0x5d97('0x9'),_0x5d97('0xa'),_0x5d97('0xb'),_0x5d97('0xc')),'defaultValue':_0x5d97('0xb'),'comment':_0x5d97('0xd')},'icon':{'type':Sequelize[_0x5d97('0x2')]},'adminUrl':{'type':Sequelize[_0x5d97('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x5d97('0x2')]},'scriptPath':{'type':Sequelize[_0x5d97('0x2')]}}; \ No newline at end of file +var _0xa289=['agentOnly','never','always','sequelize','exports','ENUM','script','TEXT','STRING','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0x4d3924,_0x327b56){var _0x844555=function(_0x387a6d){while(--_0x387a6d){_0x4d3924['push'](_0x4d3924['shift']());}};_0x844555(++_0x327b56);}(_0xa289,0x1ef));var _0x9a28=function(_0x530a60,_0x3709aa){_0x530a60=_0x530a60-0x0;var _0x2b0440=_0xa289[_0x530a60];return _0x2b0440;};'use strict';var Sequelize=require(_0x9a28('0x0'));module[_0x9a28('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9a28('0x2')]('html',_0x9a28('0x3'))},'description':{'type':Sequelize[_0x9a28('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x9a28('0x5')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x9a28('0x6')],'defaultValue':0x0,'comment':_0x9a28('0x7')},'sidebar':{'type':Sequelize[_0x9a28('0x2')](_0x9a28('0x8'),_0x9a28('0x9'),'always',_0x9a28('0xa')),'defaultValue':_0x9a28('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x9a28('0x5')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x9a28('0x5')]},'scriptName':{'type':Sequelize[_0x9a28('0x5')]},'scriptPath':{'type':Sequelize[_0x9a28('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index ea47f74..8095eae 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 _0xf765=['moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','Plugins','UserProfileResource','end','error','name','index','map','Plugin','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','options','includeAll','findAll','rows','include','find','download','params','path','join','%s.zip','basename','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','root','server/files/plugins','dirname','attachments/**/*','close','existsSync','Plugin\x20not\x20found','format','Error','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','admin','views','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','Warning:\x20admin\x20view\x20not\x20specified','agent','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','scriptPath','create','body','role','userProfileId','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','statusCode','content-type','html-pdf','eml-format','rimraf','zip-dir','request-promise'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xf765,0x1e7));var _0x5f76=function(_0x216782,_0x1f15e9){_0x216782=_0x216782-0x0;var _0x35176e=_0xf765[_0x216782];return _0x35176e;};'use strict';var pdf=require(_0x5f76('0x0'));var emlformat=require(_0x5f76('0x1'));var rimraf=require(_0x5f76('0x2'));var zipdir=require(_0x5f76('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f76('0x4'));var moment=require(_0x5f76('0x5'));var BPromise=require(_0x5f76('0x6'));var Mustache=require(_0x5f76('0x7'));var util=require(_0x5f76('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x5f76('0x9'));var ejs=require(_0x5f76('0xa'));var fs=require('fs');var _=require(_0x5f76('0xb'));var squel=require(_0x5f76('0xc'));var crypto=require(_0x5f76('0xd'));var jsforce=require(_0x5f76('0xe'));var deskjs=require(_0x5f76('0xf'));var toCsv=require(_0x5f76('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x5f76('0x10'));var rimraf=require(_0x5f76('0x2'));var archiver=require(_0x5f76('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f76('0x12'));var as=require(_0x5f76('0x13'));var hardwareService=require(_0x5f76('0x14'));var logger=require(_0x5f76('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5f76('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5f76('0x17')](config[_0x5f76('0x18')],{'host':_0x5f76('0x19'),'port':0x18eb});var socket=require(_0x5f76('0x1a'))(new Redis(config[_0x5f76('0x18')]));require(_0x5f76('0x1b'))[_0x5f76('0x1c')](socket);function respondWithStatusCode(_0x2b0080,_0x30c474){_0x30c474=_0x30c474||0xcc;return function(_0x40c713){if(_0x40c713){return _0x2b0080[_0x5f76('0x1d')](_0x30c474);}return _0x2b0080[_0x5f76('0x1e')](_0x30c474)['end']();};}function respondWithResult(_0x1d2bf7,_0x1391ef){_0x1391ef=_0x1391ef||0xc8;return function(_0x19fc50){if(_0x19fc50){return _0x1d2bf7[_0x5f76('0x1e')](_0x1391ef)[_0x5f76('0x1f')](_0x19fc50);}};}function respondWithFilteredResult(_0x51e882,_0x1c12cd){return function(_0x16ea19){if(_0x16ea19){var _0x2418df=_0x16ea19[_0x5f76('0x20')],_0x4e7486=_0x1c12cd['offset'],_0x24953e=_0x1c12cd[_0x5f76('0x21')]+_0x1c12cd[_0x5f76('0x22')],_0xbd9385;if(_0x24953e>=_0x2418df){_0x24953e=_0x2418df;_0xbd9385=0xc8;}else{_0xbd9385=0xce;}_0x51e882[_0x5f76('0x1e')](_0xbd9385);return _0x51e882[_0x5f76('0x23')](_0x5f76('0x24'),_0x4e7486+'-'+_0x24953e+'/'+_0x2418df)[_0x5f76('0x1f')](_0x16ea19);}return null;};}function patchUpdates(_0x4405a2){return function(_0x1b2d52){try{jsonpatch[_0x5f76('0x25')](_0x1b2d52,_0x4405a2,!![]);}catch(_0x739aae){return BPromise[_0x5f76('0x26')](_0x739aae);}return _0x1b2d52[_0x5f76('0x27')]();};}function saveUpdates(_0x12e61c,_0x4df30c){return function(_0x57631e){if(_0x57631e){return _0x57631e['update'](_0x12e61c)[_0x5f76('0x28')](function(_0x1a58b7){return _0x1a58b7;});}return null;};}function removeEntity(_0x231937,_0x246a86){return function(_0x1259b3){if(_0x1259b3){return _0x1259b3['destroy']()[_0x5f76('0x28')](function(){var _0x4babcc=_0x1259b3[_0x5f76('0x29')]({'plain':!![]});var _0x42bfe7=_0x5f76('0x2a');return db[_0x5f76('0x2b')]['destroy']({'where':{'type':_0x42bfe7,'resourceId':_0x4babcc['id']}})['then'](function(){return _0x1259b3;});})[_0x5f76('0x28')](function(){_0x231937[_0x5f76('0x1e')](0xcc)[_0x5f76('0x2c')]();});}};}function handleEntityNotFound(_0x56e818,_0x1cad38){return function(_0x5e3c3e){if(!_0x5e3c3e){_0x56e818[_0x5f76('0x1d')](0x194);}return _0x5e3c3e;};}function handleError(_0x481160,_0x246307){_0x246307=_0x246307||0x1f4;return function(_0x11ed91){logger[_0x5f76('0x2d')](_0x11ed91['stack']);if(_0x11ed91[_0x5f76('0x2e')]){delete _0x11ed91['name'];}_0x481160['status'](_0x246307)['send'](_0x11ed91);};}exports[_0x5f76('0x2f')]=function(_0x107ab7,_0x254f37){var _0x1d0173={},_0x1f2681={},_0x5b5a46={'count':0x0,'rows':[]};var _0x598206=_[_0x5f76('0x30')](db[_0x5f76('0x31')][_0x5f76('0x32')],function(_0x195d70){return{'name':_0x195d70['fieldName'],'type':_0x195d70[_0x5f76('0x33')][_0x5f76('0x34')]};});_0x1f2681[_0x5f76('0x35')]=_['map'](_0x598206,'name');_0x1f2681[_0x5f76('0x36')]=_[_0x5f76('0x37')](_0x107ab7[_0x5f76('0x36')]);_0x1f2681['filters']=_[_0x5f76('0x38')](_0x1f2681[_0x5f76('0x35')],_0x1f2681['query']);_0x1d0173['attributes']=_['intersection'](_0x1f2681['model'],qs[_0x5f76('0x39')](_0x107ab7[_0x5f76('0x36')][_0x5f76('0x39')]));_0x1d0173[_0x5f76('0x3a')]=_0x1d0173['attributes'][_0x5f76('0x3b')]?_0x1d0173[_0x5f76('0x3a')]:_0x1f2681['model'];if(!_0x107ab7[_0x5f76('0x36')]['hasOwnProperty'](_0x5f76('0x3c'))){_0x1d0173[_0x5f76('0x22')]=qs[_0x5f76('0x22')](_0x107ab7[_0x5f76('0x36')][_0x5f76('0x22')]);_0x1d0173[_0x5f76('0x21')]=qs['offset'](_0x107ab7[_0x5f76('0x36')][_0x5f76('0x21')]);}_0x1d0173[_0x5f76('0x3d')]=qs[_0x5f76('0x3e')](_0x107ab7[_0x5f76('0x36')][_0x5f76('0x3e')]);_0x1d0173['where']=qs['filters'](_['pick'](_0x107ab7[_0x5f76('0x36')],_0x1f2681[_0x5f76('0x3f')]),_0x598206);if(_0x107ab7['query'][_0x5f76('0x40')]){_0x1d0173['where']=_['merge'](_0x1d0173[_0x5f76('0x41')],{'$or':_[_0x5f76('0x30')](_0x598206,function(_0x30533f){if(_0x30533f[_0x5f76('0x33')]!=='VIRTUAL'){var _0x1c44cd={};_0x1c44cd[_0x30533f[_0x5f76('0x2e')]]={'$like':'%'+_0x107ab7[_0x5f76('0x36')][_0x5f76('0x40')]+'%'};return _0x1c44cd;}})});}_0x1d0173=_['merge']({},_0x1d0173,_0x107ab7[_0x5f76('0x42')]);var _0x2350a4={'where':_0x1d0173[_0x5f76('0x41')]};return db['Plugin'][_0x5f76('0x20')](_0x2350a4)['then'](function(_0x33dd99){_0x5b5a46['count']=_0x33dd99;if(_0x107ab7['query'][_0x5f76('0x43')]){_0x1d0173['include']=[{'all':!![]}];}return db[_0x5f76('0x31')][_0x5f76('0x44')](_0x1d0173);})['then'](function(_0x297e36){_0x5b5a46[_0x5f76('0x45')]=_0x297e36;return _0x5b5a46;})[_0x5f76('0x28')](respondWithFilteredResult(_0x254f37,_0x1d0173))['catch'](handleError(_0x254f37,null));};exports['show']=function(_0x811930,_0x22cd4b){var _0x493ac0={'raw':!![],'where':{'id':_0x811930['params']['id']}},_0x45feae={};_0x45feae[_0x5f76('0x35')]=_[_0x5f76('0x37')](db[_0x5f76('0x31')][_0x5f76('0x32')]);_0x45feae[_0x5f76('0x36')]=_[_0x5f76('0x37')](_0x811930['query']);_0x45feae[_0x5f76('0x3f')]=_[_0x5f76('0x38')](_0x45feae[_0x5f76('0x35')],_0x45feae[_0x5f76('0x36')]);_0x493ac0[_0x5f76('0x3a')]=_['intersection'](_0x45feae['model'],qs['fields'](_0x811930[_0x5f76('0x36')][_0x5f76('0x39')]));_0x493ac0['attributes']=_0x493ac0['attributes'][_0x5f76('0x3b')]?_0x493ac0[_0x5f76('0x3a')]:_0x45feae[_0x5f76('0x35')];if(_0x811930[_0x5f76('0x36')][_0x5f76('0x43')]){_0x493ac0[_0x5f76('0x46')]=[{'all':!![]}];}_0x493ac0=_['merge']({},_0x493ac0,_0x811930[_0x5f76('0x42')]);return db['Plugin'][_0x5f76('0x47')](_0x493ac0)[_0x5f76('0x28')](handleEntityNotFound(_0x22cd4b,null))[_0x5f76('0x28')](respondWithResult(_0x22cd4b,null))['catch'](handleError(_0x22cd4b,null));};exports[_0x5f76('0x48')]=function(_0x1e12fd,_0x451af9,_0x129322){return db[_0x5f76('0x31')][_0x5f76('0x47')]({'where':{'id':_0x1e12fd[_0x5f76('0x49')]['id']},'attributes':['name',_0x5f76('0x4a')],'raw':!![]})[_0x5f76('0x28')](handleEntityNotFound(_0x451af9,null))['then'](function(_0xeba9b5){if(_0xeba9b5){var _0x668d44=path[_0x5f76('0x4b')](config['root'],'server/files/plugins',util['format'](_0x5f76('0x4c'),path[_0x5f76('0x4d')](_0xeba9b5[_0x5f76('0x4a')])));var _0xb669b0=fs['createWriteStream'](_0x668d44);var _0x3d2452=archiver('zip',{'zlib':{'level':0x9}});_0x3d2452['on'](_0x5f76('0x4e'),function(_0x37dca9){if(_0x37dca9[_0x5f76('0x4f')]===_0x5f76('0x50')){logger[_0x5f76('0x2d')](_0x37dca9);}else{throw new db['Sequelize']['Error'](_0x5f76('0x51'));}});_0x3d2452['on'](_0x5f76('0x2d'),function(_0x2b2f4b){throw new db[(_0x5f76('0x52'))]['Error'](_0x5f76('0x51'));});_0x3d2452['pipe'](_0xb669b0);_0x3d2452[_0x5f76('0x53')]('**/*',{'cwd':path['join'](config[_0x5f76('0x54')],_0x5f76('0x55'),path[_0x5f76('0x56')](_0xeba9b5['path'])),'ignore':[path[_0x5f76('0x4b')](path[_0x5f76('0x4d')](_0xeba9b5[_0x5f76('0x4a')]),'node_modules/**/*'),path[_0x5f76('0x4b')](path[_0x5f76('0x4d')](_0xeba9b5[_0x5f76('0x4a')]),_0x5f76('0x57'))],'nodir':!![]})['finalize']();_0xb669b0['on'](_0x5f76('0x58'),function(){if(!fs[_0x5f76('0x59')](_0x668d44)){throw new db['Sequelize']['Error'](_0x5f76('0x5a'));}return _0x451af9[_0x5f76('0x48')](_0x668d44,util[_0x5f76('0x5b')](_0x5f76('0x4c'),path[_0x5f76('0x4d')](_0xeba9b5[_0x5f76('0x4a')])),function(_0x947c70){if(_0x947c70){throw new db[(_0x5f76('0x52'))][(_0x5f76('0x5c'))](_0x5f76('0x5d'));}fs[_0x5f76('0x5e')](_0x668d44);logger[_0x5f76('0x5f')](_0x5f76('0x60'));logger[_0x5f76('0x5f')](_0x5f76('0x61'));});});}return null;})[_0x5f76('0x62')](handleError(_0x451af9,null));};exports[_0x5f76('0x63')]=function(_0x10f433,_0x472f34,_0x482fd0){var _0x307ffc=path[_0x5f76('0x4d')](_0x10f433[_0x5f76('0x64')][_0x5f76('0x65')],path[_0x5f76('0x66')](_0x10f433[_0x5f76('0x64')][_0x5f76('0x65')]));var _0x440375=path[_0x5f76('0x4b')](config['root'],'server/files/plugins',_0x10f433[_0x5f76('0x64')]['filename']);var _0x2c8fda=path[_0x5f76('0x4b')](config[_0x5f76('0x54')],_0x5f76('0x55'),_0x307ffc);logger[_0x5f76('0x5f')]('Plugin\x20upload\x20filepath:\x20%s',_0x440375);logger[_0x5f76('0x5f')](_0x5f76('0x67'),_0x2c8fda);try{fs['chmodSync'](_0x440375,parseInt(_0x5f76('0x68'),0x8));extract(_0x440375,{'dir':_0x2c8fda},function(_0x50b42d){if(_0x50b42d){logger[_0x5f76('0x2d')](_0x50b42d);handleError(_0x50b42d,!![]);};var _0x413ecb=fs['readdirSync'](_0x2c8fda);if(_0x413ecb[_0x5f76('0x3b')]>0x1){removeReferences(_0x440375,_0x2c8fda);logger['error']('Invalid\x20plugin\x20structure');return _0x482fd0(new Error(_0x5f76('0x69')));}var _0x4c3ed8=fs[_0x5f76('0x6a')](path[_0x5f76('0x4b')](_0x2c8fda,_0x413ecb[0x0]));if(_0x4c3ed8[_0x5f76('0x6b')]()){removeReferences(_0x440375,_0x2c8fda);logger[_0x5f76('0x2d')]('Invalid\x20plugin\x20structure');return _0x482fd0(new Error('Invalid\x20plugin\x20structure'));}if(_0x4c3ed8['isDirectory']()){var _0x3f3d1d=fs[_0x5f76('0x6c')](path['join'](_0x2c8fda,_0x413ecb[0x0]));if(_0x3f3d1d[_0x5f76('0x3b')]===0x0){removeReferences(_0x440375,_0x2c8fda);logger['error']('Invalid\x20plugin\x20structure');return _0x482fd0(new Error('Invalid\x20plugin\x20structure'));}var _0x1aedd1=_0x3f3d1d[_0x5f76('0x6d')](function(_0x36eae6){return _0x36eae6==='manifest.json';});if(!_0x1aedd1){return _0x482fd0(new Error(_0x5f76('0x6e')));}var _0x4f7672=fs[_0x5f76('0x6f')](path[_0x5f76('0x4b')](_0x2c8fda,_0x413ecb[0x0],_0x5f76('0x70')));var _0x385b38=JSON[_0x5f76('0x71')](_0x4f7672);if(_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x2e')]){return _0x482fd0(new Error(_0x5f76('0x73')));}if(_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x33')]){return _0x482fd0(new Error(_0x5f76('0x74')));}if(_0x5f76('0x72')==typeof _0x385b38['version']){return _0x482fd0(new Error(_0x5f76('0x75')));}if(_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x76')]){return _0x482fd0(new Error(_0x5f76('0x77')));}if(_0x385b38['type']===_0x5f76('0x78')){if(_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x76')]['views']){return _0x482fd0(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x385b38[_0x5f76('0x76')]['views'][_0x5f76('0x79')]&&_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')]['agent']){return _0x482fd0(new Error(_0x5f76('0x7b')));}}else if(_0x385b38['type']==='script'){if(_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x76')]['scriptName']){return _0x482fd0(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x76')]['scriptPath']){return _0x482fd0(new Error(_0x5f76('0x7c')));}}else{return _0x482fd0(new Error(_0x5f76('0x7d')));}var _0x7990a7=_0x385b38[_0x5f76('0x2e')];var _0x1dab3a=_0x385b38[_0x5f76('0x7e')];var _0x37f59a=_0x385b38[_0x5f76('0x33')];var _0x5157a8=_0x385b38[_0x5f76('0x7f')]?_0x385b38[_0x5f76('0x7f')]:_0x5f76('0x80');var _0x32f630=_0x385b38[_0x5f76('0x81')]?_0x385b38[_0x5f76('0x81')]:_0x5f76('0x82');var _0x39efa1='';var _0x2d3645='';var _0x55563f='';var _0x5711d3='';var _0x17f3d1=_0x385b38[_0x5f76('0x83')];if(_0x37f59a===_0x5f76('0x78')){if(_0x5f76('0x72')!=typeof _0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')][_0x5f76('0x79')]){var _0x2702dd=_0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2702dd)){_0x39efa1=path['join']('plugins',_0x307ffc,_0x413ecb[0x0],_0x2702dd);}else{_0x39efa1=_0x2702dd;}}else{logger[_0x5f76('0x5f')](_0x5f76('0x84'));}if(_0x5f76('0x72')!=typeof _0x385b38['parameters']['views'][_0x5f76('0x85')]){var _0x297d9c=_0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')][_0x5f76('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x5f76('0x86')](_0x297d9c)){_0x2d3645=path['join'](_0x5f76('0x87'),_0x307ffc,_0x413ecb[0x0],_0x297d9c);}else{_0x2d3645=_0x297d9c;}}else{logger[_0x5f76('0x5f')](_0x5f76('0x88'));}}else if(_0x37f59a===_0x5f76('0x89')){_0x55563f=_0x385b38['parameters'][_0x5f76('0x8a')];_0x5711d3=_0x385b38['parameters'][_0x5f76('0x8b')];if(_0x5f76('0x72')!=typeof _0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')]){if(_0x5f76('0x72')!=typeof _0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')]['admin']){var _0x2702dd=_0x385b38[_0x5f76('0x76')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2702dd)){_0x39efa1=path['join']('plugins',_0x307ffc,_0x413ecb[0x0],_0x2702dd);}else{_0x39efa1=_0x2702dd;}}if(_0x5f76('0x72')!=typeof _0x385b38[_0x5f76('0x76')]['views']['agent']){var _0x297d9c=_0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x5f76('0x86')](_0x297d9c)){_0x2d3645=path[_0x5f76('0x4b')]('plugins',_0x307ffc,_0x413ecb[0x0],_0x297d9c);}else{_0x2d3645=_0x297d9c;}}}}var _0x2c6718={'name':_0x7990a7,'description':_0x1dab3a,'path':path[_0x5f76('0x4b')](_0x307ffc,_0x413ecb[0x0]),'type':_0x37f59a,'sidebar':_0x5157a8,'icon':_0x32f630,'adminUrl':_0x39efa1,'agentUrl':_0x2d3645,'scriptName':_0x55563f,'scriptPath':_0x5711d3,'version':_0x17f3d1};removeReferences(_0x440375,null);return db[_0x5f76('0x31')][_0x5f76('0x8c')](_0x2c6718)['then'](function(_0x5a9dd1){var _0x4a271c={'role':_0x10f433[_0x5f76('0x8d')][_0x5f76('0x8e')],'userProfileId':_0x10f433['body'][_0x5f76('0x8f')]};if(!_0x4a271c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a271c['role']===_0x5f76('0x90')){var _0x2a868d=_0x5a9dd1['get']({'plain':!![]});return db[_0x5f76('0x91')][_0x5f76('0x47')]({'where':{'name':_0x5f76('0x2a'),'userProfileId':_0x4a271c[_0x5f76('0x8f')]},'raw':!![]})[_0x5f76('0x28')](function(_0x2bb2af){if(_0x2bb2af&&_0x2bb2af['autoAssociation']===0x0){return db[_0x5f76('0x2b')][_0x5f76('0x8c')]({'name':_0x2a868d[_0x5f76('0x2e')],'resourceId':_0x2a868d['id'],'type':_0x2bb2af['name'],'sectionId':_0x2bb2af['id']},{})[_0x5f76('0x28')](function(){return _0x5a9dd1;});}else{return _0x5a9dd1;}})[_0x5f76('0x62')](function(_0x35bd43){logger[_0x5f76('0x2d')](_0x5f76('0x92'),_0x35bd43);throw _0x35bd43;});}return _0x5a9dd1;})[_0x5f76('0x28')](respondWithResult(_0x472f34,null))[_0x5f76('0x62')](handleError(_0x472f34,null));}});}catch(_0x32a269){_0x472f34[_0x5f76('0x1e')](0x1f4)[_0x5f76('0x93')](_0x32a269);}};function removeReferences(_0x333515,_0x2faa08){try{if(_0x333515){fs[_0x5f76('0x5e')](_0x333515);logger[_0x5f76('0x5f')](_0x5f76('0x94'));}if(_0x2faa08){rimraf(_0x2faa08,function(){});logger[_0x5f76('0x5f')](_0x5f76('0x95'));}}catch(_0x47d8c8){logger['error'](_0x47d8c8);}}exports['update']=function(_0x2c6a2a,_0x485de4,_0x1a1307){return db[_0x5f76('0x31')][_0x5f76('0x47')]({'where':{'id':_0x2c6a2a[_0x5f76('0x49')]['id']}})['then'](handleEntityNotFound(_0x485de4,null))[_0x5f76('0x28')](saveUpdates(_0x2c6a2a[_0x5f76('0x8d')],null))[_0x5f76('0x28')](respondWithResult(_0x485de4,null))[_0x5f76('0x62')](handleError(_0x485de4,null));};exports[_0x5f76('0x96')]=function(_0x57cb79,_0x59d8cc,_0x5e3a50){return db['Plugin'][_0x5f76('0x47')]({'where':{'id':_0x57cb79['params']['id']}})[_0x5f76('0x28')](function(_0x5d6a9a){if(_0x5d6a9a){return _0x5d6a9a['destroy']();}})[_0x5f76('0x28')](function(_0x6407c6){rimraf(path[_0x5f76('0x4b')](config[_0x5f76('0x54')],_0x5f76('0x55'),path[_0x5f76('0x56')](_0x6407c6[_0x5f76('0x4a')])),function(){});return _0x6407c6;})[_0x5f76('0x28')](handleEntityNotFound(_0x59d8cc,null))['then'](respondWithStatusCode(_0x59d8cc,null))['catch'](handleError(_0x59d8cc,null));};exports[_0x5f76('0x97')]=function(_0x1b51b6,_0x126990,_0x8b45f7){return BPromise[_0x5f76('0x98')]()[_0x5f76('0x28')](function(){if(!_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x4a')]){throw new Error(_0x5f76('0x99'));}if(!_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x9a')]){throw new Error(_0x5f76('0x9b'));}var _0x11ce0e=_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x9c')]?_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x9c')]+':'+_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x9a')]:_0x5f76('0x9d')+_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x9a')];var _0x149cd5=_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x1f')]?_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x1f')]:!![];var _0x31b598=_0x1b51b6['query']['encoding']?_0x1b51b6['query'][_0x5f76('0x9e')]:null;var _0x36dbf3={'method':_0x1b51b6[_0x5f76('0x9f')],'uri':util[_0x5f76('0x5b')]('%s%s',_0x11ce0e,_0x1b51b6['query'][_0x5f76('0x4a')]),'json':_0x149cd5,'resolveWithFullResponse':!![],'encoding':_0x31b598,'qs':_0x1b51b6['query']};if(_0x1b51b6[_0x5f76('0xa0')]){_0x36dbf3[_0x5f76('0xa0')]=_0x1b51b6['headers'];if(_0x36dbf3[_0x5f76('0xa0')]['content-length']){delete _0x36dbf3[_0x5f76('0xa0')][_0x5f76('0xa1')];}}if(_0x36dbf3['headers']['content-type']){delete _0x36dbf3['headers']['content-type'];}return rp(_0x36dbf3);})[_0x5f76('0x28')](function(_0x3323ff){if(_0x3323ff){_0x126990[_0x5f76('0x23')](_0x3323ff[_0x5f76('0xa0')]);logger[_0x5f76('0x5f')](_0x3323ff[_0x5f76('0x8d')]);if(_['endsWith'](_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x4a')],_0x5f76('0x48'))&&_0x3323ff['statusCode']==0x1f4){return _0x126990[_0x5f76('0x1d')](_0x3323ff[_0x5f76('0xa2')]);}else{return _0x126990['status'](_0x3323ff[_0x5f76('0xa2')])[_0x5f76('0x93')](_0x3323ff[_0x5f76('0x8d')]);}}else{return _0x126990[_0x5f76('0x1d')](0xc8);}})['catch'](handleError(_0x126990,null));};exports['webhookPost']=function(_0x318127,_0x2e363a,_0x86afab){return BPromise['resolve']()[_0x5f76('0x28')](function(){if(!_0x318127[_0x5f76('0x36')][_0x5f76('0x4a')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x318127[_0x5f76('0x36')][_0x5f76('0x9a')]){throw new Error(_0x5f76('0x9b'));}var _0x7b58b=_0x318127[_0x5f76('0x36')][_0x5f76('0x9c')]?_0x318127[_0x5f76('0x36')][_0x5f76('0x9c')]+':'+_0x318127[_0x5f76('0x36')][_0x5f76('0x9a')]:_0x5f76('0x9d')+_0x318127[_0x5f76('0x36')][_0x5f76('0x9a')];var _0x45ff3f=_0x318127[_0x5f76('0x36')]['json']?_0x318127[_0x5f76('0x36')][_0x5f76('0x1f')]:!![];var _0x58e9f7=_0x318127['query'][_0x5f76('0x9e')]?_0x318127[_0x5f76('0x36')]['encoding']:null;var _0x295141={'method':_0x318127['method'],'uri':util[_0x5f76('0x5b')]('%s%s',_0x7b58b,_0x318127['query']['path']),'json':_0x45ff3f,'resolveWithFullResponse':!![],'encoding':_0x58e9f7,'body':_0x318127[_0x5f76('0x8d')]};if(_0x318127[_0x5f76('0xa0')]){_0x295141[_0x5f76('0xa0')]=_0x318127[_0x5f76('0xa0')];if(_0x295141['headers']['content-length']){delete _0x295141['headers'][_0x5f76('0xa1')];}}if(_0x295141['headers'][_0x5f76('0xa3')]){delete _0x295141[_0x5f76('0xa0')][_0x5f76('0xa3')];}return rp(_0x295141);})[_0x5f76('0x28')](function(_0x598f7c){if(_0x598f7c){_0x2e363a[_0x5f76('0x23')](_0x598f7c['headers']);logger[_0x5f76('0x5f')](_0x598f7c['body']);return _0x2e363a['status'](_0x598f7c[_0x5f76('0xa2')])[_0x5f76('0x93')](_0x598f7c['body']);}else{return _0x2e363a['sendStatus'](0xc8);}})[_0x5f76('0x62')](handleError(_0x2e363a,null));}; \ No newline at end of file +var _0x8b2e=['existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','UserProfileSection','Plugins','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','set','endsWith','statusCode','webhookPost','content-type','html-pdf','eml-format','zip-dir','request-promise','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','./plugin.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','download','find','join','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','root','dirname','attachments/**/*','finalize','close'];(function(_0x2a23c1,_0x5d7fb3){var _0x8943d1=function(_0x416e13){while(--_0x416e13){_0x2a23c1['push'](_0x2a23c1['shift']());}};_0x8943d1(++_0x5d7fb3);}(_0x8b2e,0x1a5));var _0xe8b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b2e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe8b2('0x0'));var emlformat=require(_0xe8b2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe8b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe8b2('0x4'));var sox=require('sox');var csv=require(_0xe8b2('0x5'));var ejs=require(_0xe8b2('0x6'));var fs=require('fs');var _=require(_0xe8b2('0x7'));var squel=require('squel');var crypto=require(_0xe8b2('0x8'));var jsforce=require(_0xe8b2('0x9'));var deskjs=require(_0xe8b2('0xa'));var toCsv=require(_0xe8b2('0x5'));var querystring=require(_0xe8b2('0xb'));var Papa=require(_0xe8b2('0xc'));var extract=require(_0xe8b2('0xd'));var rimraf=require('rimraf');var archiver=require(_0xe8b2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe8b2('0xf'));var as=require(_0xe8b2('0x10'));var hardwareService=require(_0xe8b2('0x11'));var logger=require(_0xe8b2('0x12'))(_0xe8b2('0x13'));var utils=require(_0xe8b2('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xe8b2('0x15')]=_['defaults'](config['redis'],{'host':_0xe8b2('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8b2('0x15')]));require(_0xe8b2('0x17'))[_0xe8b2('0x18')](socket);function respondWithStatusCode(_0x3ab00c,_0x53fee7){_0x53fee7=_0x53fee7||0xcc;return function(_0x4f2f79){if(_0x4f2f79){return _0x3ab00c[_0xe8b2('0x19')](_0x53fee7);}return _0x3ab00c[_0xe8b2('0x1a')](_0x53fee7)[_0xe8b2('0x1b')]();};}function respondWithResult(_0x5cd4a5,_0x4403af){_0x4403af=_0x4403af||0xc8;return function(_0x165d67){if(_0x165d67){return _0x5cd4a5[_0xe8b2('0x1a')](_0x4403af)['json'](_0x165d67);}};}function respondWithFilteredResult(_0x1b36cd,_0x581bf2){return function(_0x2dd98d){if(_0x2dd98d){var _0x2677d0=_0x2dd98d[_0xe8b2('0x1c')],_0x40ad71=_0x581bf2['offset'],_0x4f75dc=_0x581bf2[_0xe8b2('0x1d')]+_0x581bf2[_0xe8b2('0x1e')],_0x39e0ae;if(_0x4f75dc>=_0x2677d0){_0x4f75dc=_0x2677d0;_0x39e0ae=0xc8;}else{_0x39e0ae=0xce;}_0x1b36cd['status'](_0x39e0ae);return _0x1b36cd['set'](_0xe8b2('0x1f'),_0x40ad71+'-'+_0x4f75dc+'/'+_0x2677d0)[_0xe8b2('0x20')](_0x2dd98d);}return null;};}function patchUpdates(_0x4810e3){return function(_0xa7ce7b){try{jsonpatch[_0xe8b2('0x21')](_0xa7ce7b,_0x4810e3,!![]);}catch(_0x6c99e9){return BPromise[_0xe8b2('0x22')](_0x6c99e9);}return _0xa7ce7b[_0xe8b2('0x23')]();};}function saveUpdates(_0x443418,_0x52afcf){return function(_0x5258b6){if(_0x5258b6){return _0x5258b6[_0xe8b2('0x24')](_0x443418)[_0xe8b2('0x25')](function(_0xdb2679){return _0xdb2679;});}return null;};}function removeEntity(_0x6b17a5,_0x587cfa){return function(_0x22ec75){if(_0x22ec75){return _0x22ec75['destroy']()[_0xe8b2('0x25')](function(){var _0x327761=_0x22ec75[_0xe8b2('0x26')]({'plain':!![]});var _0x3e39b4='Plugins';return db[_0xe8b2('0x27')][_0xe8b2('0x28')]({'where':{'type':_0x3e39b4,'resourceId':_0x327761['id']}})['then'](function(){return _0x22ec75;});})['then'](function(){_0x6b17a5[_0xe8b2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ef28,_0x5e8a5a){return function(_0x456fa6){if(!_0x456fa6){_0x47ef28[_0xe8b2('0x19')](0x194);}return _0x456fa6;};}function handleError(_0x42083b,_0x1e7cb3){_0x1e7cb3=_0x1e7cb3||0x1f4;return function(_0x3cbca5){logger[_0xe8b2('0x29')](_0x3cbca5[_0xe8b2('0x2a')]);if(_0x3cbca5['name']){delete _0x3cbca5[_0xe8b2('0x2b')];}_0x42083b[_0xe8b2('0x1a')](_0x1e7cb3)[_0xe8b2('0x2c')](_0x3cbca5);};}exports[_0xe8b2('0x2d')]=function(_0x1e5435,_0x2a17ba){var _0x3e533d={},_0x3e84cb={},_0x13438b={'count':0x0,'rows':[]};var _0x346ef9=_[_0xe8b2('0x2e')](db[_0xe8b2('0x2f')][_0xe8b2('0x30')],function(_0x1f13dc){return{'name':_0x1f13dc[_0xe8b2('0x31')],'type':_0x1f13dc['type'][_0xe8b2('0x32')]};});_0x3e84cb['model']=_['map'](_0x346ef9,_0xe8b2('0x2b'));_0x3e84cb[_0xe8b2('0x33')]=_[_0xe8b2('0x34')](_0x1e5435['query']);_0x3e84cb[_0xe8b2('0x35')]=_[_0xe8b2('0x36')](_0x3e84cb[_0xe8b2('0x37')],_0x3e84cb[_0xe8b2('0x33')]);_0x3e533d['attributes']=_['intersection'](_0x3e84cb[_0xe8b2('0x37')],qs[_0xe8b2('0x38')](_0x1e5435['query'][_0xe8b2('0x38')]));_0x3e533d['attributes']=_0x3e533d[_0xe8b2('0x39')]['length']?_0x3e533d[_0xe8b2('0x39')]:_0x3e84cb[_0xe8b2('0x37')];if(!_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x3a')](_0xe8b2('0x3b'))){_0x3e533d[_0xe8b2('0x1e')]=qs[_0xe8b2('0x1e')](_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x1e')]);_0x3e533d[_0xe8b2('0x1d')]=qs['offset'](_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x1d')]);}_0x3e533d[_0xe8b2('0x3c')]=qs[_0xe8b2('0x3d')](_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x3d')]);_0x3e533d[_0xe8b2('0x3e')]=qs[_0xe8b2('0x35')](_[_0xe8b2('0x3f')](_0x1e5435[_0xe8b2('0x33')],_0x3e84cb[_0xe8b2('0x35')]),_0x346ef9);if(_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x40')]){_0x3e533d[_0xe8b2('0x3e')]=_[_0xe8b2('0x41')](_0x3e533d['where'],{'$or':_['map'](_0x346ef9,function(_0x4605a4){if(_0x4605a4[_0xe8b2('0x42')]!==_0xe8b2('0x43')){var _0x449222={};_0x449222[_0x4605a4['name']]={'$like':'%'+_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x40')]+'%'};return _0x449222;}})});}_0x3e533d=_[_0xe8b2('0x41')]({},_0x3e533d,_0x1e5435[_0xe8b2('0x44')]);var _0x5fa104={'where':_0x3e533d[_0xe8b2('0x3e')]};return db[_0xe8b2('0x2f')]['count'](_0x5fa104)[_0xe8b2('0x25')](function(_0x303cfb){_0x13438b[_0xe8b2('0x1c')]=_0x303cfb;if(_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x45')]){_0x3e533d[_0xe8b2('0x46')]=[{'all':!![]}];}return db[_0xe8b2('0x2f')][_0xe8b2('0x47')](_0x3e533d);})[_0xe8b2('0x25')](function(_0x307f9c){_0x13438b[_0xe8b2('0x48')]=_0x307f9c;return _0x13438b;})['then'](respondWithFilteredResult(_0x2a17ba,_0x3e533d))[_0xe8b2('0x49')](handleError(_0x2a17ba,null));};exports[_0xe8b2('0x4a')]=function(_0x2b48f9,_0xa31d67){var _0x51899a={'raw':!![],'where':{'id':_0x2b48f9[_0xe8b2('0x4b')]['id']}},_0x4b6a67={};_0x4b6a67[_0xe8b2('0x37')]=_[_0xe8b2('0x34')](db[_0xe8b2('0x2f')][_0xe8b2('0x30')]);_0x4b6a67[_0xe8b2('0x33')]=_[_0xe8b2('0x34')](_0x2b48f9['query']);_0x4b6a67[_0xe8b2('0x35')]=_[_0xe8b2('0x36')](_0x4b6a67[_0xe8b2('0x37')],_0x4b6a67['query']);_0x51899a[_0xe8b2('0x39')]=_[_0xe8b2('0x36')](_0x4b6a67['model'],qs['fields'](_0x2b48f9[_0xe8b2('0x33')][_0xe8b2('0x38')]));_0x51899a[_0xe8b2('0x39')]=_0x51899a[_0xe8b2('0x39')][_0xe8b2('0x4c')]?_0x51899a[_0xe8b2('0x39')]:_0x4b6a67[_0xe8b2('0x37')];if(_0x2b48f9[_0xe8b2('0x33')][_0xe8b2('0x45')]){_0x51899a['include']=[{'all':!![]}];}_0x51899a=_['merge']({},_0x51899a,_0x2b48f9[_0xe8b2('0x44')]);return db['Plugin']['find'](_0x51899a)[_0xe8b2('0x25')](handleEntityNotFound(_0xa31d67,null))[_0xe8b2('0x25')](respondWithResult(_0xa31d67,null))[_0xe8b2('0x49')](handleError(_0xa31d67,null));};exports[_0xe8b2('0x4d')]=function(_0x963dde,_0x24ece9,_0x6fce3f){return db[_0xe8b2('0x2f')][_0xe8b2('0x4e')]({'where':{'id':_0x963dde[_0xe8b2('0x4b')]['id']},'attributes':[_0xe8b2('0x2b'),_0xe8b2('0x4')],'raw':!![]})[_0xe8b2('0x25')](handleEntityNotFound(_0x24ece9,null))['then'](function(_0x503d93){if(_0x503d93){var _0x4d56a4=path[_0xe8b2('0x4f')](config['root'],_0xe8b2('0x50'),util[_0xe8b2('0x51')](_0xe8b2('0x52'),path[_0xe8b2('0x53')](_0x503d93[_0xe8b2('0x4')])));var _0x300ec3=fs[_0xe8b2('0x54')](_0x4d56a4);var _0x4ac414=archiver('zip',{'zlib':{'level':0x9}});_0x4ac414['on'](_0xe8b2('0x55'),function(_0x14eeef){if(_0x14eeef[_0xe8b2('0x56')]===_0xe8b2('0x57')){logger[_0xe8b2('0x29')](_0x14eeef);}else{throw new db[(_0xe8b2('0x58'))][(_0xe8b2('0x59'))](_0xe8b2('0x5a'));}});_0x4ac414['on'](_0xe8b2('0x29'),function(_0x29b719){throw new db[(_0xe8b2('0x58'))][(_0xe8b2('0x59'))](_0xe8b2('0x5a'));});_0x4ac414['pipe'](_0x300ec3);_0x4ac414[_0xe8b2('0x5b')](_0xe8b2('0x5c'),{'cwd':path['join'](config[_0xe8b2('0x5d')],'server/files/plugins',path[_0xe8b2('0x5e')](_0x503d93['path'])),'ignore':[path['join'](path[_0xe8b2('0x53')](_0x503d93[_0xe8b2('0x4')]),'node_modules/**/*'),path['join'](path[_0xe8b2('0x53')](_0x503d93[_0xe8b2('0x4')]),_0xe8b2('0x5f'))],'nodir':!![]})[_0xe8b2('0x60')]();_0x300ec3['on'](_0xe8b2('0x61'),function(){if(!fs[_0xe8b2('0x62')](_0x4d56a4)){throw new db[(_0xe8b2('0x58'))][(_0xe8b2('0x59'))](_0xe8b2('0x63'));}return _0x24ece9[_0xe8b2('0x4d')](_0x4d56a4,util[_0xe8b2('0x51')](_0xe8b2('0x52'),path[_0xe8b2('0x53')](_0x503d93[_0xe8b2('0x4')])),function(_0xe22d6a){if(_0xe22d6a){throw new db[(_0xe8b2('0x58'))][(_0xe8b2('0x59'))](_0xe8b2('0x64'));}fs[_0xe8b2('0x65')](_0x4d56a4);logger[_0xe8b2('0x66')](_0xe8b2('0x67'));logger['info'](_0xe8b2('0x68'));});});}return null;})[_0xe8b2('0x49')](handleError(_0x24ece9,null));};exports[_0xe8b2('0x69')]=function(_0x132b8d,_0x5e49bb,_0x4c1510){var _0x41efd1=path['basename'](_0x132b8d[_0xe8b2('0x6a')]['filename'],path[_0xe8b2('0x6b')](_0x132b8d['file'][_0xe8b2('0x6c')]));var _0x3516be=path['join'](config[_0xe8b2('0x5d')],_0xe8b2('0x50'),_0x132b8d[_0xe8b2('0x6a')]['filename']);var _0x45b987=path[_0xe8b2('0x4f')](config['root'],_0xe8b2('0x50'),_0x41efd1);logger[_0xe8b2('0x66')](_0xe8b2('0x6d'),_0x3516be);logger['info'](_0xe8b2('0x6e'),_0x45b987);try{fs[_0xe8b2('0x6f')](_0x3516be,parseInt(_0xe8b2('0x70'),0x8));extract(_0x3516be,{'dir':_0x45b987},function(_0x4a3258){if(_0x4a3258){logger['error'](_0x4a3258);handleError(_0x4a3258,!![]);};var _0x27c9b6=fs[_0xe8b2('0x71')](_0x45b987);if(_0x27c9b6[_0xe8b2('0x4c')]>0x1){removeReferences(_0x3516be,_0x45b987);logger[_0xe8b2('0x29')](_0xe8b2('0x72'));return _0x4c1510(new Error(_0xe8b2('0x72')));}var _0x4868a6=fs[_0xe8b2('0x73')](path[_0xe8b2('0x4f')](_0x45b987,_0x27c9b6[0x0]));if(_0x4868a6[_0xe8b2('0x74')]()){removeReferences(_0x3516be,_0x45b987);logger[_0xe8b2('0x29')](_0xe8b2('0x72'));return _0x4c1510(new Error('Invalid\x20plugin\x20structure'));}if(_0x4868a6[_0xe8b2('0x75')]()){var _0x403af0=fs[_0xe8b2('0x71')](path[_0xe8b2('0x4f')](_0x45b987,_0x27c9b6[0x0]));if(_0x403af0['length']===0x0){removeReferences(_0x3516be,_0x45b987);logger[_0xe8b2('0x29')]('Invalid\x20plugin\x20structure');return _0x4c1510(new Error('Invalid\x20plugin\x20structure'));}var _0x43b595=_0x403af0[_0xe8b2('0x76')](function(_0x4e4b9e){return _0x4e4b9e===_0xe8b2('0x77');});if(!_0x43b595){return _0x4c1510(new Error(_0xe8b2('0x78')));}var _0x1b7574=fs['readFileSync'](path[_0xe8b2('0x4f')](_0x45b987,_0x27c9b6[0x0],_0xe8b2('0x77')));var _0x2edad0=JSON[_0xe8b2('0x79')](_0x1b7574);if(_0xe8b2('0x7a')==typeof _0x2edad0['name']){return _0x4c1510(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x2edad0[_0xe8b2('0x42')]){return _0x4c1510(new Error(_0xe8b2('0x7b')));}if(_0xe8b2('0x7a')==typeof _0x2edad0[_0xe8b2('0x7c')]){return _0x4c1510(new Error(_0xe8b2('0x7d')));}if(_0xe8b2('0x7a')==typeof _0x2edad0[_0xe8b2('0x7e')]){return _0x4c1510(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x2edad0['type']==='html'){if('undefined'==typeof _0x2edad0['parameters']['views']){return _0x4c1510(new Error(_0xe8b2('0x7f')));}if(_0xe8b2('0x7a')==typeof _0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x80')]['admin']&&_0xe8b2('0x7a')==typeof _0x2edad0[_0xe8b2('0x7e')]['views'][_0xe8b2('0x81')]){return _0x4c1510(new Error(_0xe8b2('0x82')));}}else if(_0x2edad0[_0xe8b2('0x42')]===_0xe8b2('0x83')){if(_0xe8b2('0x7a')==typeof _0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x84')]){return _0x4c1510(new Error(_0xe8b2('0x85')));}if(_0xe8b2('0x7a')==typeof _0x2edad0['parameters'][_0xe8b2('0x86')]){return _0x4c1510(new Error(_0xe8b2('0x87')));}}else{return _0x4c1510(new Error(_0xe8b2('0x88')));}var _0x59540b=_0x2edad0[_0xe8b2('0x2b')];var _0x12fc66=_0x2edad0[_0xe8b2('0x89')];var _0x58ab16=_0x2edad0['type'];var _0x43784e=_0x2edad0[_0xe8b2('0x8a')]?_0x2edad0[_0xe8b2('0x8a')]:_0xe8b2('0x8b');var _0x3d144a=_0x2edad0[_0xe8b2('0x8c')]?_0x2edad0[_0xe8b2('0x8c')]:'icon-apps';var _0x2dc45a='';var _0x5d5075='';var _0x25dba2='';var _0x1aa6aa='';var _0x4013b4=_0x2edad0[_0xe8b2('0x7c')];if(_0x58ab16===_0xe8b2('0x8d')){if('undefined'!=typeof _0x2edad0[_0xe8b2('0x7e')]['views'][_0xe8b2('0x8e')]){var _0x454210=_0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xe8b2('0x8f')](_0x454210)){_0x2dc45a=path[_0xe8b2('0x4f')](_0xe8b2('0x90'),_0x41efd1,_0x27c9b6[0x0],_0x454210);}else{_0x2dc45a=_0x454210;}}else{logger[_0xe8b2('0x66')](_0xe8b2('0x91'));}if(_0xe8b2('0x7a')!=typeof _0x2edad0[_0xe8b2('0x7e')]['views']['agent']){var _0x1eb344=_0x2edad0[_0xe8b2('0x7e')]['views'][_0xe8b2('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xe8b2('0x8f')](_0x1eb344)){_0x5d5075=path[_0xe8b2('0x4f')](_0xe8b2('0x90'),_0x41efd1,_0x27c9b6[0x0],_0x1eb344);}else{_0x5d5075=_0x1eb344;}}else{logger[_0xe8b2('0x66')](_0xe8b2('0x92'));}}else if(_0x58ab16===_0xe8b2('0x83')){_0x25dba2=_0x2edad0['parameters'][_0xe8b2('0x84')];_0x1aa6aa=_0x2edad0['parameters'][_0xe8b2('0x86')];if(_0xe8b2('0x7a')!=typeof _0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x80')]){if('undefined'!=typeof _0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x80')][_0xe8b2('0x8e')]){var _0x454210=_0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x80')][_0xe8b2('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0xe8b2('0x8f')](_0x454210)){_0x2dc45a=path[_0xe8b2('0x4f')](_0xe8b2('0x90'),_0x41efd1,_0x27c9b6[0x0],_0x454210);}else{_0x2dc45a=_0x454210;}}if(_0xe8b2('0x7a')!=typeof _0x2edad0['parameters'][_0xe8b2('0x80')][_0xe8b2('0x81')]){var _0x1eb344=_0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x80')][_0xe8b2('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xe8b2('0x8f')](_0x1eb344)){_0x5d5075=path[_0xe8b2('0x4f')]('plugins',_0x41efd1,_0x27c9b6[0x0],_0x1eb344);}else{_0x5d5075=_0x1eb344;}}}}var _0x3b5e3f={'name':_0x59540b,'description':_0x12fc66,'path':path[_0xe8b2('0x4f')](_0x41efd1,_0x27c9b6[0x0]),'type':_0x58ab16,'sidebar':_0x43784e,'icon':_0x3d144a,'adminUrl':_0x2dc45a,'agentUrl':_0x5d5075,'scriptName':_0x25dba2,'scriptPath':_0x1aa6aa,'version':_0x4013b4};removeReferences(_0x3516be,null);return db[_0xe8b2('0x2f')][_0xe8b2('0x93')](_0x3b5e3f)[_0xe8b2('0x25')](function(_0x4b7bfc){var _0x4fdf6b={'role':_0x132b8d[_0xe8b2('0x94')]['role'],'userProfileId':_0x132b8d[_0xe8b2('0x94')]['userProfileId']};if(!_0x4fdf6b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fdf6b[_0xe8b2('0x95')]==='user'){var _0x2ac7c7=_0x4b7bfc['get']({'plain':!![]});return db[_0xe8b2('0x96')][_0xe8b2('0x4e')]({'where':{'name':_0xe8b2('0x97'),'userProfileId':_0x4fdf6b[_0xe8b2('0x98')]},'raw':!![]})[_0xe8b2('0x25')](function(_0x48c827){if(_0x48c827&&_0x48c827[_0xe8b2('0x99')]===0x0){return db[_0xe8b2('0x27')][_0xe8b2('0x93')]({'name':_0x2ac7c7['name'],'resourceId':_0x2ac7c7['id'],'type':_0x48c827[_0xe8b2('0x2b')],'sectionId':_0x48c827['id']},{})['then'](function(){return _0x4b7bfc;});}else{return _0x4b7bfc;}})[_0xe8b2('0x49')](function(_0x4b0622){logger[_0xe8b2('0x29')](_0xe8b2('0x9a'),_0x4b0622);throw _0x4b0622;});}return _0x4b7bfc;})['then'](respondWithResult(_0x5e49bb,null))[_0xe8b2('0x49')](handleError(_0x5e49bb,null));}});}catch(_0x3ca752){_0x5e49bb[_0xe8b2('0x1a')](0x1f4)[_0xe8b2('0x2c')](_0x3ca752);}};function removeReferences(_0x291227,_0x69b70d){try{if(_0x291227){fs[_0xe8b2('0x65')](_0x291227);logger[_0xe8b2('0x66')]('Zip\x20archive\x20removed');}if(_0x69b70d){rimraf(_0x69b70d,function(){});logger['info'](_0xe8b2('0x9b'));}}catch(_0x41fe67){logger[_0xe8b2('0x29')](_0x41fe67);}}exports['update']=function(_0x5700c5,_0x587b8a,_0x475c5b){return db['Plugin'][_0xe8b2('0x4e')]({'where':{'id':_0x5700c5[_0xe8b2('0x4b')]['id']}})[_0xe8b2('0x25')](handleEntityNotFound(_0x587b8a,null))[_0xe8b2('0x25')](saveUpdates(_0x5700c5[_0xe8b2('0x94')],null))[_0xe8b2('0x25')](respondWithResult(_0x587b8a,null))['catch'](handleError(_0x587b8a,null));};exports[_0xe8b2('0x9c')]=function(_0x4b25c4,_0x23a350,_0x1de0c3){return db[_0xe8b2('0x2f')][_0xe8b2('0x4e')]({'where':{'id':_0x4b25c4[_0xe8b2('0x4b')]['id']}})['then'](function(_0x5f12bd){if(_0x5f12bd){return _0x5f12bd[_0xe8b2('0x28')]();}})[_0xe8b2('0x25')](function(_0x1d1de1){rimraf(path[_0xe8b2('0x4f')](config[_0xe8b2('0x5d')],_0xe8b2('0x50'),path[_0xe8b2('0x5e')](_0x1d1de1[_0xe8b2('0x4')])),function(){});return _0x1d1de1;})[_0xe8b2('0x25')](handleEntityNotFound(_0x23a350,null))[_0xe8b2('0x25')](respondWithStatusCode(_0x23a350,null))[_0xe8b2('0x49')](handleError(_0x23a350,null));};exports[_0xe8b2('0x9d')]=function(_0x44d7b9,_0x5d011f,_0x10c5d3){return BPromise[_0xe8b2('0x9e')]()['then'](function(){if(!_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0x4')]){throw new Error(_0xe8b2('0x9f'));}if(!_0x44d7b9['query'][_0xe8b2('0xa0')]){throw new Error(_0xe8b2('0xa1'));}var _0x1876f9=_0x44d7b9[_0xe8b2('0x33')]['hostname']?_0x44d7b9['query'][_0xe8b2('0xa2')]+':'+_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0xa0')]:_0xe8b2('0xa3')+_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0xa0')];var _0x230ae7=_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0x20')]?_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0x20')]:!![];var _0x4ef8ab=_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0xa4')]?_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0xa4')]:null;var _0x2cb1c7={'method':_0x44d7b9['method'],'uri':util[_0xe8b2('0x51')](_0xe8b2('0xa5'),_0x1876f9,_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0x4')]),'json':_0x230ae7,'resolveWithFullResponse':!![],'encoding':_0x4ef8ab,'qs':_0x44d7b9['query']};if(_0x44d7b9[_0xe8b2('0xa6')]){_0x2cb1c7[_0xe8b2('0xa6')]=_0x44d7b9[_0xe8b2('0xa6')];if(_0x2cb1c7[_0xe8b2('0xa6')][_0xe8b2('0xa7')]){delete _0x2cb1c7[_0xe8b2('0xa6')]['content-length'];}}if(_0x2cb1c7[_0xe8b2('0xa6')]['content-type']){delete _0x2cb1c7[_0xe8b2('0xa6')]['content-type'];}return rp(_0x2cb1c7);})[_0xe8b2('0x25')](function(_0x47ab83){if(_0x47ab83){_0x5d011f[_0xe8b2('0xa8')](_0x47ab83[_0xe8b2('0xa6')]);logger[_0xe8b2('0x66')](_0x47ab83[_0xe8b2('0x94')]);if(_[_0xe8b2('0xa9')](_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0x4')],_0xe8b2('0x4d'))&&_0x47ab83[_0xe8b2('0xaa')]==0x1f4){return _0x5d011f['sendStatus'](_0x47ab83[_0xe8b2('0xaa')]);}else{return _0x5d011f['status'](_0x47ab83[_0xe8b2('0xaa')])['send'](_0x47ab83[_0xe8b2('0x94')]);}}else{return _0x5d011f[_0xe8b2('0x19')](0xc8);}})[_0xe8b2('0x49')](handleError(_0x5d011f,null));};exports[_0xe8b2('0xab')]=function(_0x3704d4,_0x4d02a5,_0x474b6a){return BPromise[_0xe8b2('0x9e')]()['then'](function(){if(!_0x3704d4[_0xe8b2('0x33')][_0xe8b2('0x4')]){throw new Error(_0xe8b2('0x9f'));}if(!_0x3704d4[_0xe8b2('0x33')]['port']){throw new Error(_0xe8b2('0xa1'));}var _0x1b91dd=_0x3704d4[_0xe8b2('0x33')]['hostname']?_0x3704d4['query'][_0xe8b2('0xa2')]+':'+_0x3704d4[_0xe8b2('0x33')][_0xe8b2('0xa0')]:_0xe8b2('0xa3')+_0x3704d4['query'][_0xe8b2('0xa0')];var _0x2c2ade=_0x3704d4[_0xe8b2('0x33')][_0xe8b2('0x20')]?_0x3704d4[_0xe8b2('0x33')][_0xe8b2('0x20')]:!![];var _0x573139=_0x3704d4[_0xe8b2('0x33')][_0xe8b2('0xa4')]?_0x3704d4['query'][_0xe8b2('0xa4')]:null;var _0x7ca949={'method':_0x3704d4['method'],'uri':util['format'](_0xe8b2('0xa5'),_0x1b91dd,_0x3704d4[_0xe8b2('0x33')][_0xe8b2('0x4')]),'json':_0x2c2ade,'resolveWithFullResponse':!![],'encoding':_0x573139,'body':_0x3704d4[_0xe8b2('0x94')]};if(_0x3704d4[_0xe8b2('0xa6')]){_0x7ca949[_0xe8b2('0xa6')]=_0x3704d4[_0xe8b2('0xa6')];if(_0x7ca949[_0xe8b2('0xa6')][_0xe8b2('0xa7')]){delete _0x7ca949[_0xe8b2('0xa6')][_0xe8b2('0xa7')];}}if(_0x7ca949[_0xe8b2('0xa6')][_0xe8b2('0xac')]){delete _0x7ca949[_0xe8b2('0xa6')][_0xe8b2('0xac')];}return rp(_0x7ca949);})[_0xe8b2('0x25')](function(_0x1677db){if(_0x1677db){_0x4d02a5[_0xe8b2('0xa8')](_0x1677db[_0xe8b2('0xa6')]);logger[_0xe8b2('0x66')](_0x1677db[_0xe8b2('0x94')]);return _0x4d02a5[_0xe8b2('0x1a')](_0x1677db[_0xe8b2('0xaa')])[_0xe8b2('0x2c')](_0x1677db['body']);}else{return _0x4d02a5[_0xe8b2('0x19')](0xc8);}})[_0xe8b2('0x49')](handleError(_0x4d02a5,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b1da2db..b162647 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 _0x4b17=['Plugin','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4ffa7b,_0x39b58a){var _0xd7658c=function(_0x6cf44d){while(--_0x6cf44d){_0x4ffa7b['push'](_0x4ffa7b['shift']());}};_0xd7658c(++_0x39b58a);}(_0x4b17,0x10f));var _0x74b1=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x4b17[_0x44946b];return _0x249bc4;};'use strict';var EventEmitter=require(_0x74b1('0x0'));var Plugin=require('../../mysqldb')['db'][_0x74b1('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x74b1('0x2'),'afterUpdate':_0x74b1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x17689a){return function(_0x4f206f,_0x4fdea2,_0x7b3c36){PluginEvents[_0x74b1('0x4')](_0x17689a+':'+_0x4f206f['id'],_0x4f206f);PluginEvents[_0x74b1('0x4')](_0x17689a,_0x4f206f);_0x7b3c36(null);};}for(var e in events){if(events[_0x74b1('0x5')](e)){var event=events[e];Plugin[_0x74b1('0x6')](e,emitEvent(event));}}module[_0x74b1('0x7')]=PluginEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x2032,0xd9));var _0x2203=function(_0x5e9139,_0x56a566){_0x5e9139=_0x5e9139-0x0;var _0x4a7d09=_0x2032[_0x5e9139];return _0x4a7d09;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){PluginEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);PluginEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Plugin[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 6c498b9..06b46b0 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 _0xc9f9=['./plugin.attributes','exports','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x891872,_0x76fc8e){var _0x5bacc9=function(_0x296967){while(--_0x296967){_0x891872['push'](_0x891872['shift']());}};_0x5bacc9(++_0x76fc8e);}(_0xc9f9,0x1f1));var _0x9c9f=function(_0x46c5fe,_0xc40513){_0x46c5fe=_0x46c5fe-0x0;var _0x294760=_0xc9f9[_0x46c5fe];return _0x294760;};'use strict';var _=require(_0x9c9f('0x0'));var util=require(_0x9c9f('0x1'));var logger=require('../../config/logger')(_0x9c9f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9c9f('0x3'));var fs=require('fs');var path=require(_0x9c9f('0x4'));var rimraf=require(_0x9c9f('0x5'));var config=require(_0x9c9f('0x6'));var attributes=require(_0x9c9f('0x7'));module[_0x9c9f('0x8')]=function(_0x120dd7,_0xdb917b){return _0x120dd7['define']('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf85e=['plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin'];(function(_0x2596fa,_0x189c14){var _0x159184=function(_0x22a487){while(--_0x22a487){_0x2596fa['push'](_0x2596fa['shift']());}};_0x159184(++_0x189c14);}(_0xf85e,0x105));var _0xef85=function(_0x5a4266,_0x345330){_0x5a4266=_0x5a4266-0x0;var _0x16338a=_0xf85e[_0x5a4266];return _0x16338a;};'use strict';var _=require(_0xef85('0x0'));var util=require(_0xef85('0x1'));var logger=require(_0xef85('0x2'))('api');var moment=require(_0xef85('0x3'));var BPromise=require(_0xef85('0x4'));var rp=require(_0xef85('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef85('0x6'));var config=require(_0xef85('0x7'));var attributes=require(_0xef85('0x8'));module[_0xef85('0x9')]=function(_0x19e1f1,_0x5c2348){return _0x19e1f1[_0xef85('0xa')](_0xef85('0xb'),attributes,{'tableName':_0xef85('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 705f79f..bf092e9 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 _0x4380=['stringify','error','message','catch','CreatePlugin','body','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4380,0x93));var _0x0438=function(_0x50b78f,_0x4d08dd){_0x50b78f=_0x50b78f-0x0;var _0x4b98a3=_0x4380[_0x50b78f];return _0x4b98a3;};'use strict';var _=require(_0x0438('0x0'));var util=require(_0x0438('0x1'));var moment=require(_0x0438('0x2'));var BPromise=require('bluebird');var rs=require(_0x0438('0x3'));var fs=require('fs');var Redis=require(_0x0438('0x4'));var db=require(_0x0438('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0438('0x6'));var config=require(_0x0438('0x7'));var jayson=require(_0x0438('0x8'));var client=jayson[_0x0438('0x9')]['http']({'port':0x232a});config[_0x0438('0xa')]=_[_0x0438('0xb')](config[_0x0438('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0438('0xc'))(new Redis(config['redis']));require(_0x0438('0xd'))[_0x0438('0xe')](socket);function respondWithRpcPromise(_0x313ed4,_0x2ed9f0,_0x4d0225){return new BPromise(function(_0x54d517,_0x6cc500){return client[_0x0438('0xf')](_0x313ed4,_0x4d0225)[_0x0438('0x10')](function(_0x3a898b){logger[_0x0438('0x11')](_0x0438('0x12'),_0x2ed9f0,_0x0438('0x13'));logger[_0x0438('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x2ed9f0,_0x0438('0x13'),JSON[_0x0438('0x15')](_0x3a898b));if(_0x3a898b[_0x0438('0x16')]){if(_0x3a898b[_0x0438('0x16')]['code']===0x1f4){logger[_0x0438('0x16')](_0x0438('0x12'),_0x2ed9f0,_0x3a898b['error'][_0x0438('0x17')]);return _0x6cc500(_0x3a898b[_0x0438('0x16')]['message']);}logger['error']('Plugin,\x20%s,\x20%s',_0x2ed9f0,_0x3a898b[_0x0438('0x16')][_0x0438('0x17')]);return _0x54d517(_0x3a898b[_0x0438('0x16')][_0x0438('0x17')]);}else{logger[_0x0438('0x11')](_0x0438('0x12'),_0x2ed9f0,'request\x20sent');_0x54d517(_0x3a898b['result'][_0x0438('0x17')]);}})[_0x0438('0x18')](function(_0x59ba67){logger[_0x0438('0x16')]('Plugin,\x20%s,\x20%s',_0x2ed9f0,_0x59ba67);_0x6cc500(_0x59ba67);});});}exports[_0x0438('0x19')]=function(_0x544422){var _0x4c3914=this;return new Promise(function(_0x15cd53,_0x398ace){return db['Plugin']['create'](_0x544422[_0x0438('0x1a')],{'raw':_0x544422[_0x0438('0x1b')]?_0x544422['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d6fe6){logger[_0x0438('0x11')](_0x0438('0x19'),_0x544422);logger[_0x0438('0x14')]('CreatePlugin',_0x544422,JSON[_0x0438('0x15')](_0x3d6fe6));_0x15cd53(_0x3d6fe6);})[_0x0438('0x18')](function(_0xe78e7){logger['error'](_0x0438('0x19'),_0xe78e7['message'],_0x544422);_0x398ace(_0x4c3914[_0x0438('0x16')](0x1f4,_0xe78e7[_0x0438('0x17')]));});});}; \ No newline at end of file +var _0x67c7=['raw','debug','CreatePlugin','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','then','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','catch','Plugin','create','body','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67c7,0x14d));var _0x767c=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x67c7[_0x1e17eb];return _0x4de4c7;};'use strict';var _=require(_0x767c('0x0'));var util=require(_0x767c('0x1'));var moment=require(_0x767c('0x2'));var BPromise=require(_0x767c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x767c('0x4'));var db=require(_0x767c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x767c('0x6'))(_0x767c('0x7'));var config=require('../../config/environment');var jayson=require(_0x767c('0x8'));var client=jayson[_0x767c('0x9')][_0x767c('0xa')]({'port':0x232a});config['redis']=_[_0x767c('0xb')](config[_0x767c('0xc')],{'host':_0x767c('0xd'),'port':0x18eb});var socket=require(_0x767c('0xe'))(new Redis(config[_0x767c('0xc')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x11eb52,_0x4987ee,_0x575101){return new BPromise(function(_0x56210e,_0x3826cc){return client['request'](_0x11eb52,_0x575101)[_0x767c('0xf')](function(_0x8636ce){logger[_0x767c('0x10')]('Plugin,\x20%s,\x20%s',_0x4987ee,_0x767c('0x11'));logger['debug'](_0x767c('0x12'),_0x4987ee,_0x767c('0x11'),JSON[_0x767c('0x13')](_0x8636ce));if(_0x8636ce[_0x767c('0x14')]){if(_0x8636ce['error'][_0x767c('0x15')]===0x1f4){logger[_0x767c('0x14')]('Plugin,\x20%s,\x20%s',_0x4987ee,_0x8636ce[_0x767c('0x14')][_0x767c('0x16')]);return _0x3826cc(_0x8636ce[_0x767c('0x14')][_0x767c('0x16')]);}logger[_0x767c('0x14')]('Plugin,\x20%s,\x20%s',_0x4987ee,_0x8636ce['error'][_0x767c('0x16')]);return _0x56210e(_0x8636ce['error'][_0x767c('0x16')]);}else{logger[_0x767c('0x10')](_0x767c('0x17'),_0x4987ee,_0x767c('0x11'));_0x56210e(_0x8636ce[_0x767c('0x18')][_0x767c('0x16')]);}})[_0x767c('0x19')](function(_0x48d3f7){logger[_0x767c('0x14')]('Plugin,\x20%s,\x20%s',_0x4987ee,_0x48d3f7);_0x3826cc(_0x48d3f7);});});}exports['CreatePlugin']=function(_0x56e32d){var _0x493e81=this;return new Promise(function(_0x1287aa,_0x31d14a){return db[_0x767c('0x1a')][_0x767c('0x1b')](_0x56e32d[_0x767c('0x1c')],{'raw':_0x56e32d[_0x767c('0x1d')]?_0x56e32d[_0x767c('0x1d')][_0x767c('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x3c7275){logger[_0x767c('0x10')]('CreatePlugin',_0x56e32d);logger[_0x767c('0x1f')](_0x767c('0x20'),_0x56e32d,JSON['stringify'](_0x3c7275));_0x1287aa(_0x3c7275);})['catch'](function(_0x409c17){logger['error'](_0x767c('0x20'),_0x409c17[_0x767c('0x16')],_0x56e32d);_0x31d14a(_0x493e81[_0x767c('0x14')](0x1f4,_0x409c17['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 8ef4835..0732348 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 _0xb9c5=['save','update','emit','removeListener','register','plugin:'];(function(_0x9b0f0,_0x4a9e3d){var _0x226daa=function(_0x5391d3){while(--_0x5391d3){_0x9b0f0['push'](_0x9b0f0['shift']());}};_0x226daa(++_0x4a9e3d);}(_0xb9c5,0x90));var _0x5b9c=function(_0x195bc4,_0x1b0173){_0x195bc4=_0x195bc4-0x0;var _0x71ecdd=_0xb9c5[_0x195bc4];return _0x71ecdd;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x5b9c('0x0'),'remove',_0x5b9c('0x1')];function createListener(_0xc181d3,_0x56d7b0){return function(_0x813182){_0x56d7b0[_0x5b9c('0x2')](_0xc181d3,_0x813182);};}function removeListener(_0x3ef9fb,_0x33d6ae){return function(){PluginEvents[_0x5b9c('0x3')](_0x3ef9fb,_0x33d6ae);};}exports[_0x5b9c('0x4')]=function(_0x12b0e8){for(var _0x1d95c1=0x0,_0x1aeadf=events['length'];_0x1d95c1<_0x1aeadf;_0x1d95c1++){var _0x3a12c7=events[_0x1d95c1];var _0x202aaa=createListener(_0x5b9c('0x5')+_0x3a12c7,_0x12b0e8);PluginEvents['on'](_0x3a12c7,_0x202aaa);}}; \ No newline at end of file +var _0x67a6=['save','remove','update','removeListener','register','length','plugin:','./plugin.events'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0x67a6,0x137));var _0x667a=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x67a6[_0x30faec];return _0x29484f;};'use strict';var PluginEvents=require(_0x667a('0x0'));var events=[_0x667a('0x1'),_0x667a('0x2'),_0x667a('0x3')];function createListener(_0x27023f,_0x41a307){return function(_0x11e4db){_0x41a307['emit'](_0x27023f,_0x11e4db);};}function removeListener(_0x4acd11,_0x2ddb82){return function(){PluginEvents[_0x667a('0x4')](_0x4acd11,_0x2ddb82);};}exports[_0x667a('0x5')]=function(_0x13c304){for(var _0x2dfbba=0x0,_0x69cd32=events[_0x667a('0x6')];_0x2dfbba<_0x69cd32;_0x2dfbba++){var _0x44f6fc=events[_0x2dfbba];var _0xfc9da4=createListener(_0x667a('0x7')+_0x44f6fc,_0x13c304);PluginEvents['on'](_0x44f6fc,_0xfc9da4);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 38445d3..575951a 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 _0x2d55=['../../components/auth/service','./pm2.controller','index','get','/:id','isAuthenticated','post','put','update','delete','exports','express'];(function(_0x36d57f,_0x2f9118){var _0x3f93fb=function(_0x567b58){while(--_0x567b58){_0x36d57f['push'](_0x36d57f['shift']());}};_0x3f93fb(++_0x2f9118);}(_0x2d55,0x8f));var _0x52d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d55[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x52d5('0x0'));var router=express['Router']();var auth=require(_0x52d5('0x1'));var controller=require(_0x52d5('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x52d5('0x3')]);router[_0x52d5('0x4')](_0x52d5('0x5'),auth[_0x52d5('0x6')](),controller['show']);router[_0x52d5('0x7')]('/',auth[_0x52d5('0x6')](),controller['create']);router[_0x52d5('0x8')](_0x52d5('0x5'),auth['isAuthenticated'](),controller[_0x52d5('0x9')]);router[_0x52d5('0xa')](_0x52d5('0x5'),auth['isAuthenticated'](),controller['destroy']);module[_0x52d5('0xb')]=router; \ No newline at end of file +var _0x11c4=['put','update','delete','destroy','exports','express','get','isAuthenticated','index','/:id','show'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x11c4,0xec));var _0x411c=function(_0x4be1f0,_0x78c929){_0x4be1f0=_0x4be1f0-0x0;var _0x1d4bf4=_0x11c4[_0x4be1f0];return _0x1d4bf4;};'use strict';var express=require(_0x411c('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0x411c('0x1')]('/',auth[_0x411c('0x2')](),controller[_0x411c('0x3')]);router['get'](_0x411c('0x4'),auth[_0x411c('0x2')](),controller[_0x411c('0x5')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x411c('0x6')](_0x411c('0x4'),auth[_0x411c('0x2')](),controller[_0x411c('0x7')]);router[_0x411c('0x8')](_0x411c('0x4'),auth[_0x411c('0x2')](),controller[_0x411c('0x9')]);module[_0x411c('0xa')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index cb8f94a..63dbcd1 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 _0xae18=['length','catch','show','describe','params','then','create','body','script','join','cwd','chdir','dirname','start','dump','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','child_process','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','list','reject','motion2'];(function(_0x213eb6,_0x2bf899){var _0x23198c=function(_0x465f7f){while(--_0x465f7f){_0x213eb6['push'](_0x213eb6['shift']());}};_0x23198c(++_0x2bf899);}(_0xae18,0x14f));var _0x8ae1=function(_0x2a2b60,_0x26ff7a){_0x2a2b60=_0x2a2b60-0x0;var _0x316eab=_0xae18[_0x2a2b60];return _0x316eab;};'use strict';var _=require(_0x8ae1('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x8ae1('0x1'))(_0x8ae1('0x2'));var path=require('path');var exec=require(_0x8ae1('0x3'))['exec'];var BPromise=require(_0x8ae1('0x4'));function handleEntityNotFound(_0x89bc4,_0x44addb){return function(_0x191492){if(!_0x191492){_0x89bc4[_0x8ae1('0x5')](0x194);;}return _0x191492;};}function respondWithResult(_0x47e7e6,_0x1d9c8d){_0x1d9c8d=_0x1d9c8d||0xc8;return function(_0x4ba230){if(_0x4ba230){return _0x47e7e6[_0x8ae1('0x6')](_0x1d9c8d)[_0x8ae1('0x7')](_0x4ba230);}return null;};}function handleError(_0x2496e7,_0x5576a5){_0x5576a5=_0x5576a5||0x1f4;return function(_0x4d6ddf){logger[_0x8ae1('0x8')](_0x4d6ddf['stack']);if(_0x4d6ddf[_0x8ae1('0x9')]){delete _0x4d6ddf[_0x8ae1('0x9')];}_0x2496e7[_0x8ae1('0x6')](_0x5576a5)[_0x8ae1('0xa')](_0x4d6ddf);};}function execChildProcess(){return new BPromise(function(_0x1a7655,_0x46b76c){exec(_0x8ae1('0xb'),function(_0x5c5f52,_0x506f34,_0x342a05){logger[_0x8ae1('0xc')](_0x506f34);logger['info'](_0x342a05);if(_0x5c5f52){logger[_0x8ae1('0x8')](_0x5c5f52);return _0x46b76c(_0x5c5f52);}return _0x1a7655(_0x506f34);});});}exports['index']=function(_0x24f62e,_0x208405){return pm2[_0x8ae1('0xd')]()['then'](function(_0x38ed87){if(_0x38ed87){var _0x4afeda=_[_0x8ae1('0xe')](_0x38ed87,function(_0x7ccd04){return _0x7ccd04['name']==='express'||_0x7ccd04['name']===_0x8ae1('0xf');});return{'rows':_0x4afeda,'count':_0x4afeda[_0x8ae1('0x10')]};}return null;})['then'](respondWithResult(_0x208405,null))[_0x8ae1('0x11')](handleError(_0x208405,null));};exports[_0x8ae1('0x12')]=function(_0x4c0cc4,_0x36e76a){return pm2[_0x8ae1('0x13')](_0x4c0cc4[_0x8ae1('0x14')]['id'])[_0x8ae1('0x15')](respondWithResult(_0x36e76a,null))[_0x8ae1('0x15')](handleEntityNotFound(_0x36e76a,null))[_0x8ae1('0x11')](handleError(_0x36e76a,null));};exports[_0x8ae1('0x16')]=function(_0xb8476e,_0x4453eb){if(_0xb8476e[_0x8ae1('0x17')][_0x8ae1('0x9')]&&_0xb8476e[_0x8ae1('0x17')][_0x8ae1('0x18')]){var _0x1851a5=path[_0x8ae1('0x19')](__dirname,'../../files/plugins',_0xb8476e['body'][_0x8ae1('0x18')]);var _0x2d92b6=process[_0x8ae1('0x1a')]();process[_0x8ae1('0x1b')](path[_0x8ae1('0x1c')](_0x1851a5));return execChildProcess()[_0x8ae1('0x15')](function(_0x32703f){process[_0x8ae1('0x1b')](_0x2d92b6);return pm2[_0x8ae1('0x1d')]({'name':_0xb8476e[_0x8ae1('0x17')][_0x8ae1('0x9')],'script':_0x1851a5});})[_0x8ae1('0x15')](function(_0x49f17b){pm2[_0x8ae1('0x1e')]();return _0x49f17b[0x0];})[_0x8ae1('0x15')](respondWithResult(_0x4453eb,0xc9))[_0x8ae1('0x11')](handleError(_0x4453eb,null));}else{return _0x4453eb[_0x8ae1('0x6')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8ae1('0x1f')]=function(_0x581569,_0xcf33f2){if(_0x581569[_0x8ae1('0x17')]['id']){delete _0x581569[_0x8ae1('0x17')]['id'];}var _0x39e4d9={'online':_0x8ae1('0x20'),'stopped':_0x8ae1('0x21')};if(_0x39e4d9[_0x8ae1('0x22')](_0x581569[_0x8ae1('0x17')]['status'])){return pm2[_0x39e4d9[_0x581569[_0x8ae1('0x17')][_0x8ae1('0x6')]]](_0x581569[_0x8ae1('0x14')]['id'])[_0x8ae1('0x15')](respondWithResult(_0xcf33f2,0xc8))['catch'](handleError(_0xcf33f2,null));}else{return _0xcf33f2['status'](0x1f4)[_0x8ae1('0xa')]({'message':_0x8ae1('0x23')});}};exports[_0x8ae1('0x24')]=function(_0xbd32ae,_0x3f8c55){if(_0xbd32ae[_0x8ae1('0x17')]['id']){delete _0xbd32ae[_0x8ae1('0x17')]['id'];}if(_0xbd32ae['params']['id']){return pm2[_0x8ae1('0x25')](_0xbd32ae[_0x8ae1('0x14')]['id'])['then'](function(_0x219c96){pm2['dump']();return _0x219c96[0x0];})['then'](respondWithResult(_0x3f8c55,null))['catch'](handleError(_0x3f8c55,null));}else{return _0x3f8c55['status'](0x1f4)['send']({'message':_0x8ae1('0x26')});}}; \ No newline at end of file +var _0x6dac=['then','catch','show','describe','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','path','bluebird','sendStatus','status','json','error','name','npm\x20install','info','index','list','reject','express','motion2','length'];(function(_0x34b3bb,_0x531597){var _0x430797=function(_0x3a1c6c){while(--_0x3a1c6c){_0x34b3bb['push'](_0x34b3bb['shift']());}};_0x430797(++_0x531597);}(_0x6dac,0x180));var _0xc6da=function(_0x376941,_0x2cec66){_0x376941=_0x376941-0x0;var _0x5ce95a=_0x6dac[_0x376941];return _0x5ce95a;};'use strict';var _=require(_0xc6da('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')('api');var path=require(_0xc6da('0x1'));var exec=require('child_process')['exec'];var BPromise=require(_0xc6da('0x2'));function handleEntityNotFound(_0x445ad6,_0x2b0cfa){return function(_0x5d0011){if(!_0x5d0011){_0x445ad6[_0xc6da('0x3')](0x194);;}return _0x5d0011;};}function respondWithResult(_0x743123,_0x59985d){_0x59985d=_0x59985d||0xc8;return function(_0xe289a4){if(_0xe289a4){return _0x743123[_0xc6da('0x4')](_0x59985d)[_0xc6da('0x5')](_0xe289a4);}return null;};}function handleError(_0x5c233e,_0x16baec){_0x16baec=_0x16baec||0x1f4;return function(_0x33653c){logger[_0xc6da('0x6')](_0x33653c['stack']);if(_0x33653c[_0xc6da('0x7')]){delete _0x33653c[_0xc6da('0x7')];}_0x5c233e[_0xc6da('0x4')](_0x16baec)['send'](_0x33653c);};}function execChildProcess(){return new BPromise(function(_0x3a1bef,_0x4505dc){exec(_0xc6da('0x8'),function(_0x21dfa3,_0x1bb004,_0x315ccd){logger[_0xc6da('0x9')](_0x1bb004);logger['info'](_0x315ccd);if(_0x21dfa3){logger[_0xc6da('0x6')](_0x21dfa3);return _0x4505dc(_0x21dfa3);}return _0x3a1bef(_0x1bb004);});});}exports[_0xc6da('0xa')]=function(_0x1f4ee2,_0xc5fbf7){return pm2[_0xc6da('0xb')]()['then'](function(_0x950967){if(_0x950967){var _0x405afb=_[_0xc6da('0xc')](_0x950967,function(_0x4e28e5){return _0x4e28e5[_0xc6da('0x7')]===_0xc6da('0xd')||_0x4e28e5[_0xc6da('0x7')]===_0xc6da('0xe');});return{'rows':_0x405afb,'count':_0x405afb[_0xc6da('0xf')]};}return null;})[_0xc6da('0x10')](respondWithResult(_0xc5fbf7,null))[_0xc6da('0x11')](handleError(_0xc5fbf7,null));};exports[_0xc6da('0x12')]=function(_0x234e12,_0x5d8bc1){return pm2[_0xc6da('0x13')](_0x234e12['params']['id'])['then'](respondWithResult(_0x5d8bc1,null))['then'](handleEntityNotFound(_0x5d8bc1,null))['catch'](handleError(_0x5d8bc1,null));};exports[_0xc6da('0x14')]=function(_0x18603c,_0xe1b3b4){if(_0x18603c[_0xc6da('0x15')][_0xc6da('0x7')]&&_0x18603c['body']['script']){var _0x1d3b65=path[_0xc6da('0x16')](__dirname,_0xc6da('0x17'),_0x18603c[_0xc6da('0x15')][_0xc6da('0x18')]);var _0x36d6bb=process[_0xc6da('0x19')]();process[_0xc6da('0x1a')](path[_0xc6da('0x1b')](_0x1d3b65));return execChildProcess()[_0xc6da('0x10')](function(_0x50147b){process[_0xc6da('0x1a')](_0x36d6bb);return pm2[_0xc6da('0x1c')]({'name':_0x18603c[_0xc6da('0x15')]['name'],'script':_0x1d3b65});})[_0xc6da('0x10')](function(_0x2efb53){pm2[_0xc6da('0x1d')]();return _0x2efb53[0x0];})[_0xc6da('0x10')](respondWithResult(_0xe1b3b4,0xc9))[_0xc6da('0x11')](handleError(_0xe1b3b4,null));}else{return _0xe1b3b4[_0xc6da('0x4')](0x1f4)[_0xc6da('0x1e')]({'message':_0xc6da('0x1f')});}};exports[_0xc6da('0x20')]=function(_0x3da2ee,_0x182100){if(_0x3da2ee[_0xc6da('0x15')]['id']){delete _0x3da2ee[_0xc6da('0x15')]['id'];}var _0x42d3f2={'online':_0xc6da('0x21'),'stopped':_0xc6da('0x22')};if(_0x42d3f2['hasOwnProperty'](_0x3da2ee['body'][_0xc6da('0x4')])){return pm2[_0x42d3f2[_0x3da2ee[_0xc6da('0x15')][_0xc6da('0x4')]]](_0x3da2ee[_0xc6da('0x23')]['id'])[_0xc6da('0x10')](respondWithResult(_0x182100,0xc8))[_0xc6da('0x11')](handleError(_0x182100,null));}else{return _0x182100[_0xc6da('0x4')](0x1f4)['send']({'message':_0xc6da('0x24')});}};exports[_0xc6da('0x25')]=function(_0x108e9d,_0x7324d1){if(_0x108e9d['body']['id']){delete _0x108e9d[_0xc6da('0x15')]['id'];}if(_0x108e9d[_0xc6da('0x23')]['id']){return pm2[_0xc6da('0x26')](_0x108e9d['params']['id'])[_0xc6da('0x10')](function(_0xaac05a){pm2[_0xc6da('0x1d')]();return _0xaac05a[0x0];})['then'](respondWithResult(_0x7324d1,null))['catch'](handleError(_0x7324d1,null));}else{return _0x7324d1[_0xc6da('0x4')](0x1f4)[_0xc6da('0x1e')]({'message':_0xc6da('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b69bbe4..dd663cc 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 _0x36a5=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','Router'];(function(_0x2ca093,_0x47d8de){var _0x3cd548=function(_0x4f3016){while(--_0x4f3016){_0x2ca093['push'](_0x2ca093['shift']());}};_0x3cd548(++_0x47d8de);}(_0x36a5,0x190));var _0x536a=function(_0x410b31,_0x4780be){_0x410b31=_0x410b31-0x0;var _0x2d4e33=_0x36a5[_0x410b31];return _0x2d4e33;};'use strict';var multer=require(_0x536a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x536a('0x1')]();var auth=require(_0x536a('0x2'));var interaction=require(_0x536a('0x3'));var config=require(_0x536a('0x4'));module[_0x536a('0x5')]=router; \ No newline at end of file +var _0x1445=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x383627,_0x5be16e){var _0x2c16a0=function(_0x569b72){while(--_0x569b72){_0x383627['push'](_0x383627['shift']());}};_0x2c16a0(++_0x5be16e);}(_0x1445,0xf5));var _0x5144=function(_0x1aebfe,_0x5a6e9a){_0x1aebfe=_0x1aebfe-0x0;var _0x5f382d=_0x1445[_0x1aebfe];return _0x5f382d;};'use strict';var multer=require(_0x5144('0x0'));var util=require(_0x5144('0x1'));var path=require(_0x5144('0x2'));var timeout=require(_0x5144('0x3'));var express=require(_0x5144('0x4'));var router=express[_0x5144('0x5')]();var auth=require(_0x5144('0x6'));var interaction=require(_0x5144('0x7'));var config=require('../../config/environment');module[_0x5144('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 4ff5e70..1cea48d 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 _0x7e19=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x6af1b1,_0x4ccf9e){var _0x139dae=function(_0x409ebf){while(--_0x409ebf){_0x6af1b1['push'](_0x6af1b1['shift']());}};_0x139dae(++_0x4ccf9e);}(_0x7e19,0xa1));var _0x97e1=function(_0x5dd52e,_0x98ee28){_0x5dd52e=_0x5dd52e-0x0;var _0x4d2f78=_0x7e19[_0x5dd52e];return _0x4d2f78;};'use strict';var Sequelize=require(_0x97e1('0x0'));module[_0x97e1('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x97e1('0x2')]},'scheduledat':{'type':Sequelize[_0x97e1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x97e1('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x97e1('0x2')]},'campaigntype':{'type':Sequelize[_0x97e1('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc19a=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x1a809d,_0x23cfc5){var _0x501fea=function(_0xb7275f){while(--_0xb7275f){_0x1a809d['push'](_0x1a809d['shift']());}};_0x501fea(++_0x23cfc5);}(_0xc19a,0x181));var _0xac19=function(_0x176099,_0x50f74a){_0x176099=_0x176099-0x0;var _0x40c93f=_0xc19a[_0x176099];return _0x40c93f;};'use strict';var Sequelize=require(_0xac19('0x0'));module[_0xac19('0x1')]={'state':{'type':Sequelize[_0xac19('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xac19('0x3')]},'scheduledat':{'type':Sequelize[_0xac19('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xac19('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xac19('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xac19('0x3')]},'campaigntype':{'type':Sequelize[_0xac19('0x3')]},'membername':{'type':Sequelize[_0xac19('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 91b1a4b..3a28f10 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 _0x9f78=['bluebird','rimraf','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9f78,0x1bf));var _0x89f7=function(_0xbcb6b4,_0x58980d){_0xbcb6b4=_0xbcb6b4-0x0;var _0x16a505=_0x9f78[_0xbcb6b4];return _0x16a505;};'use strict';var _=require(_0x89f7('0x0'));var util=require('util');var logger=require(_0x89f7('0x1'))(_0x89f7('0x2'));var moment=require(_0x89f7('0x3'));var BPromise=require(_0x89f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x89f7('0x5'));var config=require(_0x89f7('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0x89f7('0x7')]=function(_0x453e4e,_0x25defd){return _0x453e4e[_0x89f7('0x8')](_0x89f7('0x9'),attributes,{'tableName':_0x89f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf077=['report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4b40dc,_0xd4cbc3){var _0x566fd7=function(_0x310c98){while(--_0x310c98){_0x4b40dc['push'](_0x4b40dc['shift']());}};_0x566fd7(++_0xd4cbc3);}(_0xf077,0xeb));var _0x7f07=function(_0x5e3902,_0x3d8c15){_0x5e3902=_0x5e3902-0x0;var _0x40fb78=_0xf077[_0x5e3902];return _0x40fb78;};'use strict';var _=require(_0x7f07('0x0'));var util=require(_0x7f07('0x1'));var logger=require(_0x7f07('0x2'))(_0x7f07('0x3'));var moment=require(_0x7f07('0x4'));var BPromise=require(_0x7f07('0x5'));var rp=require(_0x7f07('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f07('0x7'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x4f1abc,_0x10809f){return _0x4f1abc['define']('ReportAgentPreview',attributes,{'tableName':_0x7f07('0x8'),'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 2c1e2b9..370ea0e 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 _0xb6a5=['jayson/promise','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xb6a5,0x1c7));var _0x5b6a=function(_0x767aa3,_0x3b82b1){_0x767aa3=_0x767aa3-0x0;var _0x39bf0f=_0xb6a5[_0x767aa3];return _0x39bf0f;};'use strict';var _=require('lodash');var util=require(_0x5b6a('0x0'));var moment=require(_0x5b6a('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b6a('0x2'));var fs=require('fs');var Redis=require(_0x5b6a('0x3'));var db=require(_0x5b6a('0x4'))['db'];var utils=require(_0x5b6a('0x5'));var logger=require(_0x5b6a('0x6'))(_0x5b6a('0x7'));var config=require(_0x5b6a('0x8'));var jayson=require(_0x5b6a('0x9'));var client=jayson[_0x5b6a('0xa')][_0x5b6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e9ff0,_0x57fa31,_0x354fd3){return new BPromise(function(_0x1b2155,_0x465f2b){return client[_0x5b6a('0xc')](_0x1e9ff0,_0x354fd3)[_0x5b6a('0xd')](function(_0x223b52){logger[_0x5b6a('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x57fa31,_0x5b6a('0xf'));logger[_0x5b6a('0x10')](_0x5b6a('0x11'),_0x57fa31,_0x5b6a('0xf'),JSON[_0x5b6a('0x12')](_0x223b52));if(_0x223b52['error']){if(_0x223b52[_0x5b6a('0x13')]['code']===0x1f4){logger[_0x5b6a('0x13')](_0x5b6a('0x14'),_0x57fa31,_0x223b52[_0x5b6a('0x13')][_0x5b6a('0x15')]);return _0x465f2b(_0x223b52[_0x5b6a('0x13')][_0x5b6a('0x15')]);}logger[_0x5b6a('0x13')](_0x5b6a('0x14'),_0x57fa31,_0x223b52[_0x5b6a('0x13')][_0x5b6a('0x15')]);return _0x1b2155(_0x223b52[_0x5b6a('0x13')]['message']);}else{logger[_0x5b6a('0xe')](_0x5b6a('0x14'),_0x57fa31,_0x5b6a('0xf'));_0x1b2155(_0x223b52['result'][_0x5b6a('0x15')]);}})[_0x5b6a('0x16')](function(_0xd07dda){logger['error'](_0x5b6a('0x14'),_0x57fa31,_0xd07dda);_0x465f2b(_0xd07dda);});});}exports[_0x5b6a('0x17')]=function(_0x2df547){var _0x20b857=this;return new Promise(function(_0x25f957,_0x2ae170){return db[_0x5b6a('0x18')][_0x5b6a('0x19')](_0x2df547[_0x5b6a('0x1a')],{'raw':_0x2df547['options']?_0x2df547[_0x5b6a('0x1b')][_0x5b6a('0x1c')]===undefined?!![]:![]:!![]})[_0x5b6a('0xd')](function(_0x4dca84){logger[_0x5b6a('0xe')]('CreateReportAgentPreview',_0x2df547);logger['debug'](_0x5b6a('0x17'),_0x2df547,JSON['stringify'](_0x4dca84));_0x25f957(_0x4dca84);})['catch'](function(_0x4832ac){logger[_0x5b6a('0x13')](_0x5b6a('0x17'),_0x4832ac[_0x5b6a('0x15')],_0x2df547);_0x2ae170(_0x20b857[_0x5b6a('0x13')](0x1f4,_0x4832ac[_0x5b6a('0x15')]));});});}; \ No newline at end of file +var _0x2bda=['../../config/environment','request','then','info','request\x20sent','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0x2bda,0x1d3));var _0xa2bd=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0x2bda[_0x2f57b2];return _0x5ace77;};'use strict';var _=require(_0xa2bd('0x0'));var util=require('util');var moment=require(_0xa2bd('0x1'));var BPromise=require(_0xa2bd('0x2'));var rs=require(_0xa2bd('0x3'));var fs=require('fs');var Redis=require(_0xa2bd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2bd('0x5'));var logger=require(_0xa2bd('0x6'))(_0xa2bd('0x7'));var config=require(_0xa2bd('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x417412,_0x586725,_0x598e92){return new BPromise(function(_0x259ce0,_0x2c8ad5){return client[_0xa2bd('0x9')](_0x417412,_0x598e92)[_0xa2bd('0xa')](function(_0x2779af){logger[_0xa2bd('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x586725,_0xa2bd('0xc'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x586725,_0xa2bd('0xc'),JSON[_0xa2bd('0xd')](_0x2779af));if(_0x2779af['error']){if(_0x2779af[_0xa2bd('0xe')][_0xa2bd('0xf')]===0x1f4){logger['error'](_0xa2bd('0x10'),_0x586725,_0x2779af[_0xa2bd('0xe')][_0xa2bd('0x11')]);return _0x2c8ad5(_0x2779af['error'][_0xa2bd('0x11')]);}logger[_0xa2bd('0xe')](_0xa2bd('0x10'),_0x586725,_0x2779af['error']['message']);return _0x259ce0(_0x2779af[_0xa2bd('0xe')]['message']);}else{logger[_0xa2bd('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x586725,_0xa2bd('0xc'));_0x259ce0(_0x2779af['result'][_0xa2bd('0x11')]);}})[_0xa2bd('0x12')](function(_0x3d3ebc){logger[_0xa2bd('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x586725,_0x3d3ebc);_0x2c8ad5(_0x3d3ebc);});});}exports[_0xa2bd('0x13')]=function(_0x28e283){var _0x212bdf=this;return new Promise(function(_0x256573,_0x3b149f){return db[_0xa2bd('0x14')][_0xa2bd('0x15')](_0x28e283[_0xa2bd('0x16')],{'raw':_0x28e283[_0xa2bd('0x17')]?_0x28e283[_0xa2bd('0x17')][_0xa2bd('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x16be1b){logger[_0xa2bd('0xb')](_0xa2bd('0x13'),_0x28e283);logger['debug']('CreateReportAgentPreview',_0x28e283,JSON[_0xa2bd('0xd')](_0x16be1b));_0x256573(_0x16be1b);})[_0xa2bd('0x12')](function(_0x3547ec){logger[_0xa2bd('0xe')]('CreateReportAgentPreview',_0x3547ec[_0xa2bd('0x11')],_0x28e283);_0x3b149f(_0x212bdf[_0xa2bd('0xe')](0x1f4,_0x3547ec[_0xa2bd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index e5ac92f..44180d3 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 _0x3c0c=['/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat'];(function(_0x15a01c,_0x46f3bf){var _0x335bcb=function(_0x52c106){while(--_0x52c106){_0x15a01c['push'](_0x15a01c['shift']());}};_0x335bcb(++_0x46f3bf);}(_0x3c0c,0x1a6));var _0xc3c0=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x3c0c[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0xc3c0('0x0'));var util=require(_0xc3c0('0x1'));var path=require(_0xc3c0('0x2'));var express=require(_0xc3c0('0x3'));var router=express[_0xc3c0('0x4')]();var auth=require(_0xc3c0('0x5'));var controller=require('./rpc.controller');router[_0xc3c0('0x6')](_0xc3c0('0x7'),auth[_0xc3c0('0x8')](),controller['voiceChannels']);router[_0xc3c0('0x6')](_0xc3c0('0x9'),auth[_0xc3c0('0x8')](),controller['voiceChannelMixMonitor']);router['get'](_0xc3c0('0xa'),auth['isAuthenticated'](),controller[_0xc3c0('0xb')]);router[_0xc3c0('0x6')](_0xc3c0('0xc'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0xd')]);router[_0xc3c0('0x6')](_0xc3c0('0xe'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0xf')]);router[_0xc3c0('0x6')]('/mail/queues',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x10')]);router[_0xc3c0('0x6')]('/mail/accounts',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x11')]);router[_0xc3c0('0x6')](_0xc3c0('0x12'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x13')]);router['get'](_0xc3c0('0x14'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x15')]);router[_0xc3c0('0x6')]('/whatsapp/queues',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x16')]);router[_0xc3c0('0x6')](_0xc3c0('0x17'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x18')]);router[_0xc3c0('0x6')](_0xc3c0('0x19'),auth[_0xc3c0('0x8')](),controller['voiceQueuesPreview']);router[_0xc3c0('0x6')]('/voice/queues/channels',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x1a')]);router[_0xc3c0('0x6')]('/voice/queues/channels/:uniqueid',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x1b')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x1c')]);router[_0xc3c0('0x6')](_0xc3c0('0x1d'),auth['isAuthenticated'](),controller[_0xc3c0('0x1e')]);router[_0xc3c0('0x6')]('/voice/queues/:id',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x1f')]);router[_0xc3c0('0x6')](_0xc3c0('0x20'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x21')]);router[_0xc3c0('0x6')](_0xc3c0('0x22'),auth['isAuthenticated'](),controller[_0xc3c0('0x23')]);router[_0xc3c0('0x6')](_0xc3c0('0x24'),auth['isAuthenticated'](),controller[_0xc3c0('0x25')]);router['put']('/agents/:id/capacity',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x26')]);router[_0xc3c0('0x6')](_0xc3c0('0x27'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x28')]);router[_0xc3c0('0x6')](_0xc3c0('0x29'),auth['isAuthenticated'](),controller[_0xc3c0('0x2a')]);router[_0xc3c0('0x6')]('/campaigns',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x2b')]);router[_0xc3c0('0x6')](_0xc3c0('0x2c'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x2d')]);router[_0xc3c0('0x6')](_0xc3c0('0x2e'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x2f')]);router['get'](_0xc3c0('0x30'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x31')]);router[_0xc3c0('0x6')](_0xc3c0('0x32'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x33')]);router[_0xc3c0('0x6')]('/sms/queues/waitinginteractions',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x34')]);router[_0xc3c0('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x35')]);router['get'](_0xc3c0('0x36'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x37')]);router[_0xc3c0('0x38')](_0xc3c0('0x39'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x3a')](_0xc3c0('0x3b')));router[_0xc3c0('0x6')](_0xc3c0('0x3c'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x3d')]);router[_0xc3c0('0x38')](_0xc3c0('0x3e'),auth['isAuthenticated'](),controller[_0xc3c0('0x3a')](_0xc3c0('0x3f')));router[_0xc3c0('0x6')](_0xc3c0('0x40'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x41')]);router['post']('/fax/queues/:id/notify',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x3a')]('fax'));router['get'](_0xc3c0('0x42'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x43')]);router[_0xc3c0('0x38')](_0xc3c0('0x44'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x3a')]('openchannel'));router[_0xc3c0('0x6')](_0xc3c0('0x45'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x46')]);router['post'](_0xc3c0('0x47'),auth['isAuthenticated'](),controller[_0xc3c0('0x3a')](_0xc3c0('0x48')));router[_0xc3c0('0x38')](_0xc3c0('0x49'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x3a')](_0xc3c0('0x4a')));router['get'](_0xc3c0('0x4b'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x4c')]);router[_0xc3c0('0x6')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0xc3c0('0x4d')]);router['post'](_0xc3c0('0x4e'),auth['isAuthenticated'](),controller[_0xc3c0('0x4f')]);module[_0xc3c0('0x50')]=router; \ No newline at end of file +var _0x0994=['showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id'];(function(_0x15fce8,_0x7612b7){var _0x3f54aa=function(_0x4c1752){while(--_0x4c1752){_0x15fce8['push'](_0x15fce8['shift']());}};_0x3f54aa(++_0x7612b7);}(_0x0994,0x1af));var _0x4099=function(_0x1e7210,_0xa95b71){_0x1e7210=_0x1e7210-0x0;var _0xad8f6d=_0x0994[_0x1e7210];return _0xad8f6d;};'use strict';var multer=require(_0x4099('0x0'));var util=require(_0x4099('0x1'));var path=require(_0x4099('0x2'));var express=require('express');var router=express[_0x4099('0x3')]();var auth=require(_0x4099('0x4'));var controller=require(_0x4099('0x5'));router[_0x4099('0x6')](_0x4099('0x7'),auth['isAuthenticated'](),controller[_0x4099('0x8')]);router['get'](_0x4099('0x9'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x4099('0x6')](_0x4099('0xa'),auth[_0x4099('0xb')](),controller[_0x4099('0xc')]);router[_0x4099('0x6')](_0x4099('0xd'),auth['isAuthenticated'](),controller[_0x4099('0xe')]);router[_0x4099('0x6')](_0x4099('0xf'),auth[_0x4099('0xb')](),controller[_0x4099('0x10')]);router[_0x4099('0x6')](_0x4099('0x11'),auth[_0x4099('0xb')](),controller['mailQueues']);router['get'](_0x4099('0x12'),auth[_0x4099('0xb')](),controller[_0x4099('0x13')]);router[_0x4099('0x6')](_0x4099('0x14'),auth[_0x4099('0xb')](),controller[_0x4099('0x15')]);router[_0x4099('0x6')](_0x4099('0x16'),auth[_0x4099('0xb')](),controller[_0x4099('0x17')]);router['get'](_0x4099('0x18'),auth[_0x4099('0xb')](),controller['whatsappQueues']);router[_0x4099('0x6')](_0x4099('0x19'),auth[_0x4099('0xb')](),controller[_0x4099('0x1a')]);router[_0x4099('0x6')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x4099('0x1b')]);router['get'](_0x4099('0x1c'),auth[_0x4099('0xb')](),controller[_0x4099('0x1d')]);router['get'](_0x4099('0x1e'),auth[_0x4099('0xb')](),controller[_0x4099('0x1f')]);router[_0x4099('0x6')](_0x4099('0x20'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x4099('0x6')](_0x4099('0x21'),auth[_0x4099('0xb')](),controller['voiceQueuesChannelRedirect']);router[_0x4099('0x6')](_0x4099('0x22'),auth[_0x4099('0xb')](),controller['showVoiceQueues']);router[_0x4099('0x6')](_0x4099('0x23'),auth['isAuthenticated'](),controller[_0x4099('0x24')]);router[_0x4099('0x6')](_0x4099('0x25'),auth[_0x4099('0xb')](),controller[_0x4099('0x26')]);router[_0x4099('0x6')](_0x4099('0x27'),auth[_0x4099('0xb')](),controller[_0x4099('0x28')]);router[_0x4099('0x29')](_0x4099('0x2a'),auth['isAuthenticated'](),controller[_0x4099('0x2b')]);router['get'](_0x4099('0x2c'),auth['isAuthenticated'](),controller[_0x4099('0x2d')]);router[_0x4099('0x6')]('/trunks',auth[_0x4099('0xb')](),controller['trunks']);router['get'](_0x4099('0x2e'),auth[_0x4099('0xb')](),controller[_0x4099('0x2f')]);router[_0x4099('0x6')](_0x4099('0x30'),auth[_0x4099('0xb')](),controller[_0x4099('0x31')]);router[_0x4099('0x6')](_0x4099('0x32'),auth[_0x4099('0xb')](),controller[_0x4099('0x33')]);router[_0x4099('0x6')](_0x4099('0x34'),auth[_0x4099('0xb')](),controller[_0x4099('0x35')]);router[_0x4099('0x6')](_0x4099('0x36'),auth['isAuthenticated'](),controller[_0x4099('0x37')]);router[_0x4099('0x6')](_0x4099('0x38'),auth['isAuthenticated'](),controller[_0x4099('0x39')]);router[_0x4099('0x6')](_0x4099('0x3a'),auth[_0x4099('0xb')](),controller[_0x4099('0x3b')]);router[_0x4099('0x6')](_0x4099('0x3c'),auth['isAuthenticated'](),controller[_0x4099('0x3d')]);router[_0x4099('0x3e')]('/mail/queues/:id/notify',auth[_0x4099('0xb')](),controller[_0x4099('0x3f')](_0x4099('0x40')));router[_0x4099('0x6')](_0x4099('0x41'),auth['isAuthenticated'](),controller[_0x4099('0x42')]);router[_0x4099('0x3e')](_0x4099('0x43'),auth['isAuthenticated'](),controller[_0x4099('0x3f')](_0x4099('0x44')));router[_0x4099('0x6')](_0x4099('0x45'),auth[_0x4099('0xb')](),controller[_0x4099('0x46')]);router[_0x4099('0x3e')](_0x4099('0x47'),auth[_0x4099('0xb')](),controller[_0x4099('0x3f')]('fax'));router[_0x4099('0x6')](_0x4099('0x48'),auth[_0x4099('0xb')](),controller[_0x4099('0x49')]);router[_0x4099('0x3e')](_0x4099('0x4a'),auth[_0x4099('0xb')](),controller['queueNotify']('openchannel'));router['get'](_0x4099('0x4b'),auth[_0x4099('0xb')](),controller[_0x4099('0x4c')]);router[_0x4099('0x3e')]('/sms/queues/:id/notify',auth[_0x4099('0xb')](),controller['queueNotify']('sms'));router[_0x4099('0x3e')]('/whatsapp/queues/:id/notify',auth[_0x4099('0xb')](),controller[_0x4099('0x3f')](_0x4099('0x4d')));router[_0x4099('0x6')]('/sms/queues/:id',auth[_0x4099('0xb')](),controller[_0x4099('0x4e')]);router[_0x4099('0x6')](_0x4099('0x4f'),auth[_0x4099('0xb')](),controller[_0x4099('0x50')]);router[_0x4099('0x3e')](_0x4099('0x51'),auth[_0x4099('0xb')](),controller[_0x4099('0x52')]);module[_0x4099('0x53')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index d94a998..e30974a 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 _0x7552=['MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','create','Start','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','TransferReport','agentTransferTimeout','bluebird','moment','lodash','api','client','http','request','then','error','code','message','result','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','catch','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts'];(function(_0x39ef2c,_0x3feca6){var _0x42684e=function(_0x48ad17){while(--_0x48ad17){_0x39ef2c['push'](_0x39ef2c['shift']());}};_0x42684e(++_0x3feca6);}(_0x7552,0xab));var _0x2755=function(_0x255338,_0x227b66){_0x255338=_0x255338-0x0;var _0xc15ffa=_0x7552[_0x255338];return _0xc15ffa;};'use strict';var BPromise=require(_0x2755('0x0'));var moment=require(_0x2755('0x1'));var _=require(_0x2755('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x2755('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x2755('0x4')][_0x2755('0x5')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x2755('0x4')][_0x2755('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x5480b5,_0x3af4b0,_0x40077c){return new BPromise(function(_0x74a95a,_0x519c53){var _0x445410=_0x40077c?_0x40077c:amiClient;return _0x445410[_0x2755('0x6')](_0x5480b5,_0x3af4b0)[_0x2755('0x7')](function(_0x1c5d4d){if(_0x1c5d4d[_0x2755('0x8')]){if(_0x1c5d4d[_0x2755('0x8')][_0x2755('0x9')]===0x1f4){return _0x519c53(_0x1c5d4d[_0x2755('0x8')][_0x2755('0xa')]);}return _0x74a95a(_0x1c5d4d[_0x2755('0x8')][_0x2755('0xa')]);}else{_0x74a95a(_0x1c5d4d[_0x2755('0xb')]);}})['catch'](function(_0x3dc45f){_0x519c53(_0x3dc45f);});});}function respondWithResult(_0x3f82f0,_0x20445d){_0x20445d=_0x20445d||0xc8;return function(_0x3684d9){if(_0x3684d9){return _0x3f82f0[_0x2755('0xc')](_0x20445d)[_0x2755('0xd')](_0x3684d9);}return _0x3f82f0[_0x2755('0xe')](0x194);};}function handleError(_0x25ad42,_0x5f2b22){_0x5f2b22=_0x5f2b22||0x1f4;return function(_0x129eb1){logger['error'](_0x129eb1[_0x2755('0xf')]);if(_0x129eb1[_0x2755('0x10')]){delete _0x129eb1['name'];}_0x25ad42[_0x2755('0xc')](_0x5f2b22)[_0x2755('0x11')](_0x129eb1);};}function findById(_0x46b59b){return function(_0x296411){if(!_[_0x2755('0x12')](_0x46b59b)&&!_[_0x2755('0x12')](_0x296411)&&!_['isNil'](_0x296411[_0x2755('0x13')])){return _[_0x2755('0x14')](_0x296411[_0x2755('0x13')],function(_0x311c4e){return _0x311c4e['id']==_0x46b59b;});}return null;};}exports[_0x2755('0x15')]=function(_0x43415d,_0x191377){return respondWithRpcPromise(_0x2755('0x16'),_0x43415d[_0x2755('0x17')])['then'](respondWithResult(_0x191377,null))['catch'](handleError(_0x191377,null));};exports[_0x2755('0x18')]=function(_0x51f4cc,_0x3368cd){return respondWithRpcPromise(_0x2755('0x19'),_[_0x2755('0x1a')](_0x51f4cc[_0x2755('0x17')],_0x51f4cc[_0x2755('0x1b')]))[_0x2755('0x7')](respondWithResult(_0x3368cd,null))['catch'](handleError(_0x3368cd,null));};exports['voiceChannelStopMixMonitor']=function(_0x5ec1a1,_0x1e4fc8){return respondWithRpcPromise(_0x2755('0x1c'),_[_0x2755('0x1a')](_0x5ec1a1[_0x2755('0x17')],_0x5ec1a1[_0x2755('0x1b')]))[_0x2755('0x7')](respondWithResult(_0x1e4fc8,null))[_0x2755('0x1d')](handleError(_0x1e4fc8,null));};exports[_0x2755('0x1e')]=function(_0x484392,_0x2f659f){return respondWithRpcPromise(_0x2755('0x1f'),_0x484392['query'])[_0x2755('0x7')](respondWithResult(_0x2f659f,null))['catch'](handleError(_0x2f659f,null));};exports[_0x2755('0x20')]=function(_0x493376,_0x15e2e0){return respondWithRpcPromise(_0x2755('0x1f'),_0x493376[_0x2755('0x17')])[_0x2755('0x7')](findById(_0x493376[_0x2755('0x1b')]['id']))[_0x2755('0x7')](respondWithResult(_0x15e2e0,null))[_0x2755('0x1d')](handleError(_0x15e2e0,null));};exports[_0x2755('0x21')]=function(_0x2269b2,_0x4a7b60){return respondWithRpcPromise(_0x2755('0x22'),_['merge'](_0x2269b2[_0x2755('0x17')],_0x2269b2[_0x2755('0x1b')]))[_0x2755('0x7')](respondWithResult(_0x4a7b60,null))[_0x2755('0x1d')](handleError(_0x4a7b60,null));};exports[_0x2755('0x23')]=function(_0x50471d,_0x69df65){return respondWithRpcPromise(_0x2755('0x24'),_0x50471d[_0x2755('0x17')])['then'](respondWithResult(_0x69df65,null))[_0x2755('0x1d')](handleError(_0x69df65,null));};exports[_0x2755('0x25')]=function(_0x48f0e7,_0x501801){return respondWithRpcPromise(_0x2755('0x26'),_[_0x2755('0x1a')](_0x48f0e7[_0x2755('0x17')],_0x48f0e7['params']))[_0x2755('0x7')](respondWithResult(_0x501801,null))['catch'](handleError(_0x501801,null));};exports[_0x2755('0x27')]=function(_0x549309,_0xdac2f6){return respondWithRpcPromise(_0x2755('0x28'),_['merge'](_0x549309['query'],_0x549309['params']))[_0x2755('0x7')](respondWithResult(_0xdac2f6,null))[_0x2755('0x1d')](handleError(_0xdac2f6,null));};exports[_0x2755('0x29')]=function(_0xa43e3e,_0x5e5d8f){return respondWithRpcPromise(_0x2755('0x2a'),_[_0x2755('0x1a')](_0xa43e3e['query'],_0xa43e3e[_0x2755('0x1b')]))[_0x2755('0x7')](respondWithResult(_0x5e5d8f,null))[_0x2755('0x1d')](handleError(_0x5e5d8f,null));};exports['outbound']=function(_0x322c6d,_0x521053){return respondWithRpcPromise('Outbound',_0x322c6d[_0x2755('0x17')])['then'](respondWithResult(_0x521053,null))[_0x2755('0x1d')](handleError(_0x521053,null));};exports['outboundChannels']=function(_0x2a13ce,_0x64278d){return respondWithRpcPromise(_0x2755('0x2b'),_0x2a13ce[_0x2755('0x17')])['then'](respondWithResult(_0x64278d,null))[_0x2755('0x1d')](handleError(_0x64278d,null));};exports[_0x2755('0x2c')]=function(_0x477e45,_0x106599){var _0x3ecb66;return respondWithRpcPromise('Agents',_0x477e45[_0x2755('0x17')])[_0x2755('0x7')](function(_0x19a532){_0x3ecb66=_0x19a532;return respondWithRpcPromise(_0x2755('0x2d'),_0x477e45[_0x2755('0x17')],routingClient);})[_0x2755('0x7')](function(_0x398dc6){return _[_0x2755('0x1a')]({},_0x398dc6,_0x3ecb66);})[_0x2755('0x7')](respondWithResult(_0x106599,null))[_0x2755('0x1d')](handleError(_0x106599,null));};exports[_0x2755('0x2e')]=function(_0x26b877,_0x44771c){if(_0x26b877[_0x2755('0x2f')]&&_0x26b877[_0x2755('0x2f')]['interaction']&&_0x26b877[_0x2755('0x30')]&&_0x26b877[_0x2755('0x30')][_0x2755('0x10')]){for(var _0x22b42f in _0x26b877['body'][_0x2755('0x31')]){if(_0x26b877[_0x2755('0x2f')][_0x2755('0x31')][_0x2755('0x32')](_0x22b42f)){db[_0x2755('0x33')][_0x2755('0x34')]({'where':{'channel':_0x22b42f,'membername':_0x26b877[_0x2755('0x30')][_0x2755('0x10')],'type':_0x2755('0x35'),'exitAt':null,'uniqueid':_0x26b877['body'][_0x2755('0x31')][_0x22b42f]&&_0x26b877[_0x2755('0x2f')][_0x2755('0x31')][_0x22b42f][_0x2755('0x36')]?{'$notIn':_0x26b877[_0x2755('0x2f')]['interaction'][_0x22b42f]}:{'$ne':null}}})[_0x2755('0x7')](function(_0x47f16a){var _0x1f5bca=moment()[_0x2755('0x37')](_0x2755('0x38'));for(var _0xdadf8b=0x0,_0x5d38cb=_0x47f16a[_0x2755('0x36')];_0xdadf8b<_0x5d38cb;_0xdadf8b+=0x1){_0x47f16a[_0xdadf8b][_0x2755('0x39')]({'exitAt':_0x1f5bca});}});for(var _0x28ea16=0x0;_0x28ea16<_0x26b877[_0x2755('0x2f')][_0x2755('0x31')][_0x22b42f][_0x2755('0x36')];_0x28ea16+=0x1){db['MemberReport'][_0x2755('0x3a')]({'where':{'channel':_0x22b42f,'membername':_0x26b877[_0x2755('0x30')][_0x2755('0x10')],'type':_0x2755('0x35'),'uniqueid':_0x26b877[_0x2755('0x2f')][_0x2755('0x31')][_0x22b42f][_0x28ea16],'exitAt':null},'defaults':{'channel':_0x22b42f,'membername':_0x26b877[_0x2755('0x30')][_0x2755('0x10')],'interface':_[_0x2755('0x12')](_0x26b877[_0x2755('0x30')][_0x2755('0x3b')])?util[_0x2755('0x37')](_0x2755('0x3c'),_0x26b877[_0x2755('0x30')][_0x2755('0x10')]):_0x26b877[_0x2755('0x30')]['interface'],'type':'INTERACTION','enterAt':moment()[_0x2755('0x37')](_0x2755('0x38')),'role':_0x2755('0x3d'),'internal':_0x26b877['user'][_0x2755('0x3e')],'uniqueid':_0x26b877[_0x2755('0x2f')][_0x2755('0x31')][_0x22b42f][_0x28ea16]}});}}}}return respondWithRpcPromise(_0x2755('0x3f'),{'id':_0x26b877[_0x2755('0x1b')]['id'],'capacity':_0x26b877[_0x2755('0x2f')][_0x2755('0x40')]},routingClient)[_0x2755('0x7')](respondWithResult(_0x44771c,null))[_0x2755('0x1d')](handleError(_0x44771c,null));};exports[_0x2755('0x41')]=function(_0x305675,_0x4dcfff){return respondWithRpcPromise(_0x2755('0x42'),_0x305675[_0x2755('0x17')])[_0x2755('0x7')](respondWithResult(_0x4dcfff,null))['catch'](handleError(_0x4dcfff,null));};exports['trunks']=function(_0x20c780,_0x5c1908){return respondWithRpcPromise(_0x2755('0x43'),_0x20c780['query'])[_0x2755('0x7')](respondWithResult(_0x5c1908,null))[_0x2755('0x1d')](handleError(_0x5c1908,null));};exports[_0x2755('0x44')]=function(_0x6a2f61,_0x1067f3){return respondWithRpcPromise(_0x2755('0x45'),_0x6a2f61[_0x2755('0x17')])[_0x2755('0x7')](respondWithResult(_0x1067f3,null))[_0x2755('0x1d')](handleError(_0x1067f3,null));};exports['chatQueues']=function(_0x24d9df,_0x283fd5){return respondWithRpcPromise(_0x2755('0x46'),_0x24d9df['query'],routingClient)[_0x2755('0x7')](respondWithResult(_0x283fd5,null))[_0x2755('0x1d')](handleError(_0x283fd5,null));};exports[_0x2755('0x47')]=function(_0x1d22f3,_0x3910c8){return respondWithRpcPromise(_0x2755('0x46'),_0x1d22f3[_0x2755('0x17')],routingClient)['then'](findById(_0x1d22f3[_0x2755('0x1b')]['id']))[_0x2755('0x7')](respondWithResult(_0x3910c8,null))[_0x2755('0x1d')](handleError(_0x3910c8,null));};exports[_0x2755('0x48')]=function(_0x439df0,_0x5880ee){return respondWithRpcPromise(_0x2755('0x49'),_0x439df0[_0x2755('0x17')],routingClient)['then'](respondWithResult(_0x5880ee,null))[_0x2755('0x1d')](handleError(_0x5880ee,null));};exports['showMailQueues']=function(_0x1ba62b,_0x40b607){return respondWithRpcPromise('MailQueues',_0x1ba62b[_0x2755('0x17')],routingClient)[_0x2755('0x7')](findById(_0x1ba62b['params']['id']))[_0x2755('0x7')](respondWithResult(_0x40b607,null))['catch'](handleError(_0x40b607,null));};exports[_0x2755('0x4a')]=function(_0x563148,_0x3a01b0){return respondWithRpcPromise(_0x2755('0x4b'),_0x563148[_0x2755('0x17')],mailClient)[_0x2755('0x7')](respondWithResult(_0x3a01b0,null))[_0x2755('0x1d')](handleError(_0x3a01b0,null));};exports[_0x2755('0x4c')]=function(_0x59cae5,_0x2cc3d1){return respondWithRpcPromise(_0x2755('0x4d'),_0x59cae5[_0x2755('0x17')],routingClient)[_0x2755('0x7')](respondWithResult(_0x2cc3d1,null))[_0x2755('0x1d')](handleError(_0x2cc3d1,null));};exports['showOpenchannelQueues']=function(_0x16dd01,_0x172247){return respondWithRpcPromise(_0x2755('0x4d'),_0x16dd01['query'],routingClient)[_0x2755('0x7')](findById(_0x16dd01[_0x2755('0x1b')]['id']))[_0x2755('0x7')](respondWithResult(_0x172247,null))[_0x2755('0x1d')](handleError(_0x172247,null));};exports[_0x2755('0x4e')]=function(_0x563d15,_0x1c3af1){return respondWithRpcPromise(_0x2755('0x4f'),_0x563d15[_0x2755('0x17')],routingClient)['then'](respondWithResult(_0x1c3af1,null))[_0x2755('0x1d')](handleError(_0x1c3af1,null));};exports[_0x2755('0x50')]=function(_0x2fdcff,_0x2e560e){return respondWithRpcPromise(_0x2755('0x4f'),_0x2fdcff[_0x2755('0x17')],routingClient)['then'](findById(_0x2fdcff['params']['id']))[_0x2755('0x7')](respondWithResult(_0x2e560e,null))['catch'](handleError(_0x2e560e,null));};exports[_0x2755('0x51')]=function(_0xddd831,_0x149c73){return respondWithRpcPromise(_0x2755('0x52'),_0xddd831[_0x2755('0x17')],routingClient)['then'](respondWithResult(_0x149c73,null))[_0x2755('0x1d')](handleError(_0x149c73,null));};exports[_0x2755('0x53')]=function(_0x524420,_0x405d1f){return respondWithRpcPromise(_0x2755('0x52'),_0x524420[_0x2755('0x17')],routingClient)[_0x2755('0x7')](findById(_0x524420['params']['id']))[_0x2755('0x7')](respondWithResult(_0x405d1f,null))[_0x2755('0x1d')](handleError(_0x405d1f,null));};exports[_0x2755('0x54')]=function(_0x37a435,_0x1ddca9){return respondWithRpcPromise('FaxQueues',_0x37a435[_0x2755('0x17')],routingClient)[_0x2755('0x7')](respondWithResult(_0x1ddca9,null))[_0x2755('0x1d')](handleError(_0x1ddca9,null));};exports[_0x2755('0x55')]=function(_0xad7d0d,_0x45384e){return respondWithRpcPromise(_0x2755('0x56'),_0xad7d0d[_0x2755('0x17')],routingClient)[_0x2755('0x7')](findById(_0xad7d0d[_0x2755('0x1b')]['id']))['then'](respondWithResult(_0x45384e,null))[_0x2755('0x1d')](handleError(_0x45384e,null));};exports[_0x2755('0x57')]=function(_0x2cb6a1,_0x489710){return respondWithRpcPromise(_0x2755('0x58'),_0x2cb6a1[_0x2755('0x17')])[_0x2755('0x7')](respondWithResult(_0x489710,null))['catch'](handleError(_0x489710,null));};exports[_0x2755('0x59')]=function(_0x2e7251,_0x2ce664){return respondWithRpcPromise(_0x2755('0x5a'),_0x2e7251[_0x2755('0x17')],routingClient)[_0x2755('0x7')](respondWithResult(_0x2ce664,null))['catch'](handleError(_0x2ce664,null));};exports[_0x2755('0x5b')]=function(_0x3d9157,_0xe07a88){return respondWithRpcPromise(_0x2755('0x5c'),_0x3d9157[_0x2755('0x17')],routingClient)['then'](respondWithResult(_0xe07a88,null))['catch'](handleError(_0xe07a88,null));};exports[_0x2755('0x5d')]=function(_0x886602,_0x384dce){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x886602['query'],routingClient)[_0x2755('0x7')](respondWithResult(_0x384dce,null))['catch'](handleError(_0x384dce,null));};exports[_0x2755('0x5e')]=function(_0x172bdd,_0x182edb){return respondWithRpcPromise(_0x2755('0x5f'),_0x172bdd[_0x2755('0x17')],routingClient)[_0x2755('0x7')](respondWithResult(_0x182edb,null))[_0x2755('0x1d')](handleError(_0x182edb,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3ead74,_0x5974d3){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x3ead74[_0x2755('0x17')],routingClient)['then'](respondWithResult(_0x5974d3,null))[_0x2755('0x1d')](handleError(_0x5974d3,null));};exports[_0x2755('0x60')]=function(_0x1e90bd,_0x188003){return respondWithRpcPromise(_0x2755('0x61'),_0x1e90bd[_0x2755('0x17')],routingClient)['then'](respondWithResult(_0x188003,null))['catch'](handleError(_0x188003,null));};exports[_0x2755('0x62')]=function(_0x4df508){return function(_0x3d952c,_0x4164ba){var _0xe3771e,_0x12bc2d;var _0x4c4682=_[_0x2755('0x63')](_0x4df508);var _0x434e13=_0x4df508==='chat'?'Website':'Account';return db[_0x4c4682+_0x2755('0x64')][_0x2755('0x65')]({'raw':!![],'where':{'id':_0x3d952c['params']['id']}})['then'](function(_0x425a31){if(_[_0x2755('0x12')](_0x425a31)){throw new Error(_0x4c4682+_0x2755('0x66'));}_0xe3771e=_0x425a31;return db[_0x4c4682+_0x2755('0x67')][_0x2755('0x65')]({'where':{'id':_0x3d952c['body'][_0x2755('0x68')]},'include':[{'model':db[_0x4c4682+_0x2755('0x69')],'as':'Interaction'},{'model':db[_0x4c4682+_0x434e13],'as':_0x2755('0x6a')}]});})['then'](function(_0x1a9de3){if(_[_0x2755('0x12')](_0x1a9de3)){throw new Error(_0x4c4682+_0x2755('0x6b'));}_0x12bc2d=_0x1a9de3;return _0x1a9de3[_0x2755('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2755('0x7')](function(){var _0xba6432={'uniqueid':_0x4df508+'.'+_0x12bc2d['id']+'.'+_0x12bc2d[_0x2755('0x69')]['id'],'FromUserId':_0x3d952c[_0x2755('0x30')]['id'],'type':_0x2755('0x6d')};_0xba6432[_0x4c4682+_0x2755('0x6e')]=_0x12bc2d['id'];_0xba6432[_0x4c4682+_0x2755('0x6f')]=_0x12bc2d[_0x2755('0x69')]['id'];_0xba6432[_0x2755('0x70')+_0x4c4682+_0x434e13+'Id']=_0x12bc2d[_0x2755('0x6a')]['id'];_0xba6432['To'+_0x4c4682+_0x2755('0x71')]=_0xe3771e['id'];return db[_0x4c4682+'TransferReport'][_0x2755('0x72')](_0xba6432);})[_0x2755('0x7')](function(){return respondWithRpcPromise(_0x2755('0x73'),{'channel':_0x4df508,'interaction':_0x12bc2d[_0x2755('0x69')],'message':_0x12bc2d,'account':_0x12bc2d['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x2755('0x6d'),'appdata':_0xe3771e[_0x2755('0x10')]+','+(_0x12bc2d[_0x2755('0x6a')]['queueTransferTimeout']||0x12c),'interval':_0x2755('0x74')}]},routingClient);})['then'](respondWithResult(_0x4164ba,null))['catch'](handleError(_0x4164ba,null));};};exports[_0x2755('0x75')]=function(_0x33854f,_0x23a7f0){var _0x405ccd,_0x4e82e6;if(_['isNil'](_0x33854f[_0x2755('0x2f')][_0x2755('0x76')])){throw new Error(_0x2755('0x77'));}var _0x560248=_0x33854f[_0x2755('0x2f')]['channel'];var _0xd2ec57=_[_0x2755('0x63')](_0x560248);var _0x35fb1b=_0x560248==='chat'?_0x2755('0x78'):'Account';return db['User'][_0x2755('0x65')]({'raw':!![],'where':{'id':_0x33854f[_0x2755('0x1b')]['id'],'role':_0x2755('0x3d')}})[_0x2755('0x7')](function(_0x4e3679){if(_['isNil'](_0x4e3679)){throw new Error('Agent\x20not\x20found');}_0x405ccd=_0x4e3679;return db[_0xd2ec57+_0x2755('0x67')][_0x2755('0x65')]({'where':{'id':_0x33854f['body']['messageId']},'include':[{'model':db[_0xd2ec57+_0x2755('0x69')],'as':_0x2755('0x69')},{'model':db[_0xd2ec57+_0x35fb1b],'as':_0x2755('0x6a')}]});})[_0x2755('0x7')](function(_0x561ff4){if(_[_0x2755('0x12')](_0x561ff4)){throw new Error(_0xd2ec57+'\x20Message\x20not\x20found');}_0x4e82e6=_0x561ff4;return _0x561ff4[_0x2755('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf16824={'uniqueid':_0x560248+'.'+_0x4e82e6['id']+'.'+_0x4e82e6['Interaction']['id'],'FromUserId':_0x33854f['user']['id'],'type':'queue','ToUserId':_0x405ccd['id']};_0xf16824[_0xd2ec57+_0x2755('0x6e')]=_0x4e82e6['id'];_0xf16824[_0xd2ec57+_0x2755('0x6f')]=_0x4e82e6['Interaction']['id'];_0xf16824[_0x2755('0x70')+_0xd2ec57+_0x35fb1b+'Id']=_0x4e82e6[_0x2755('0x6a')]['id'];return db[_0xd2ec57+_0x2755('0x79')]['create'](_0xf16824);})['then'](function(){return respondWithRpcPromise(_0x2755('0x73'),{'channel':_0x560248,'interaction':_0x4e82e6[_0x2755('0x69')],'message':_0x4e82e6,'account':_0x4e82e6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x2755('0x3d'),'appdata':_0x405ccd[_0x2755('0x10')]+','+(_0x4e82e6['Account'][_0x2755('0x7a')]||0x12c),'interval':_0x2755('0x74')}]},routingClient);})['then'](respondWithResult(_0x23a7f0,null))['catch'](handleError(_0x23a7f0,null));}; \ No newline at end of file +var _0x066e=['Outbound','outboundChannels','OutboundChannels','agents','agentCapacity','body','interaction','hasOwnProperty','MemberReport','findAll','user','name','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','channel','Website','User','Agent\x20not\x20found','From','Start','agent','agentTransferTimeout','bluebird','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','code','message','send','isNil','rows','find','voiceChannels','query','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x066e,0xca));var _0xe066=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x066e[_0x257642];return _0x3d813b;};'use strict';var BPromise=require(_0xe066('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0xe066('0x1'));var db=require(_0xe066('0x2'))['db'];var logger=require(_0xe066('0x3'))('api');var jayson=require(_0xe066('0x4'));var amiClient=jayson[_0xe066('0x5')]['http']({'port':0x232a});var mailClient=jayson['client'][_0xe066('0x6')]({'port':0x232b});var routingClient=jayson[_0xe066('0x5')][_0xe066('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x38aa87,_0x215dc4,_0x31ae4d){return new BPromise(function(_0x1e012b,_0x24219d){var _0x266fa2=_0x31ae4d?_0x31ae4d:amiClient;return _0x266fa2[_0xe066('0x7')](_0x38aa87,_0x215dc4)['then'](function(_0x2e81b5){if(_0x2e81b5[_0xe066('0x8')]){if(_0x2e81b5[_0xe066('0x8')][_0xe066('0x9')]===0x1f4){return _0x24219d(_0x2e81b5['error'][_0xe066('0xa')]);}return _0x1e012b(_0x2e81b5[_0xe066('0x8')]['message']);}else{_0x1e012b(_0x2e81b5['result']);}})['catch'](function(_0x13c98a){_0x24219d(_0x13c98a);});});}function respondWithResult(_0x1f2759,_0x4ee460){_0x4ee460=_0x4ee460||0xc8;return function(_0x59109e){if(_0x59109e){return _0x1f2759['status'](_0x4ee460)['json'](_0x59109e);}return _0x1f2759['sendStatus'](0x194);};}function handleError(_0xa0c67f,_0x57ce5b){_0x57ce5b=_0x57ce5b||0x1f4;return function(_0x4bc0f2){logger['error'](_0x4bc0f2['stack']);if(_0x4bc0f2['name']){delete _0x4bc0f2['name'];}_0xa0c67f['status'](_0x57ce5b)[_0xe066('0xb')](_0x4bc0f2);};}function findById(_0x4b05bc){return function(_0x3e5906){if(!_[_0xe066('0xc')](_0x4b05bc)&&!_[_0xe066('0xc')](_0x3e5906)&&!_[_0xe066('0xc')](_0x3e5906[_0xe066('0xd')])){return _[_0xe066('0xe')](_0x3e5906[_0xe066('0xd')],function(_0x4c498b){return _0x4c498b['id']==_0x4b05bc;});}return null;};}exports[_0xe066('0xf')]=function(_0x58a5cf,_0x2d567b){return respondWithRpcPromise('VoiceChannels',_0x58a5cf[_0xe066('0x10')])[_0xe066('0x11')](respondWithResult(_0x2d567b,null))[_0xe066('0x12')](handleError(_0x2d567b,null));};exports[_0xe066('0x13')]=function(_0x33c91a,_0x4d0aa7){return respondWithRpcPromise(_0xe066('0x14'),_[_0xe066('0x15')](_0x33c91a[_0xe066('0x10')],_0x33c91a[_0xe066('0x16')]))[_0xe066('0x11')](respondWithResult(_0x4d0aa7,null))[_0xe066('0x12')](handleError(_0x4d0aa7,null));};exports['voiceChannelStopMixMonitor']=function(_0x18524f,_0x3e4911){return respondWithRpcPromise(_0xe066('0x17'),_['merge'](_0x18524f[_0xe066('0x10')],_0x18524f[_0xe066('0x16')]))[_0xe066('0x11')](respondWithResult(_0x3e4911,null))[_0xe066('0x12')](handleError(_0x3e4911,null));};exports[_0xe066('0x18')]=function(_0x51241a,_0x566ffd){return respondWithRpcPromise('VoiceQueues',_0x51241a[_0xe066('0x10')])[_0xe066('0x11')](respondWithResult(_0x566ffd,null))[_0xe066('0x12')](handleError(_0x566ffd,null));};exports[_0xe066('0x19')]=function(_0x590893,_0x186d5a){return respondWithRpcPromise(_0xe066('0x1a'),_0x590893[_0xe066('0x10')])[_0xe066('0x11')](findById(_0x590893[_0xe066('0x16')]['id']))[_0xe066('0x11')](respondWithResult(_0x186d5a,null))['catch'](handleError(_0x186d5a,null));};exports[_0xe066('0x1b')]=function(_0x2a1e5c,_0x428183){return respondWithRpcPromise(_0xe066('0x1c'),_[_0xe066('0x15')](_0x2a1e5c[_0xe066('0x10')],_0x2a1e5c[_0xe066('0x16')]))[_0xe066('0x11')](respondWithResult(_0x428183,null))[_0xe066('0x12')](handleError(_0x428183,null));};exports[_0xe066('0x1d')]=function(_0x49e6e1,_0x2fc188){return respondWithRpcPromise(_0xe066('0x1e'),_0x49e6e1[_0xe066('0x10')])['then'](respondWithResult(_0x2fc188,null))[_0xe066('0x12')](handleError(_0x2fc188,null));};exports[_0xe066('0x1f')]=function(_0x819ef5,_0x207a78){return respondWithRpcPromise(_0xe066('0x20'),_['merge'](_0x819ef5[_0xe066('0x10')],_0x819ef5[_0xe066('0x16')]))[_0xe066('0x11')](respondWithResult(_0x207a78,null))[_0xe066('0x12')](handleError(_0x207a78,null));};exports[_0xe066('0x21')]=function(_0x531be1,_0x1f2d31){return respondWithRpcPromise(_0xe066('0x22'),_[_0xe066('0x15')](_0x531be1[_0xe066('0x10')],_0x531be1[_0xe066('0x16')]))[_0xe066('0x11')](respondWithResult(_0x1f2d31,null))[_0xe066('0x12')](handleError(_0x1f2d31,null));};exports[_0xe066('0x23')]=function(_0x2e6617,_0x428679){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xe066('0x15')](_0x2e6617[_0xe066('0x10')],_0x2e6617[_0xe066('0x16')]))['then'](respondWithResult(_0x428679,null))[_0xe066('0x12')](handleError(_0x428679,null));};exports['outbound']=function(_0x148891,_0x46eaf3){return respondWithRpcPromise(_0xe066('0x24'),_0x148891[_0xe066('0x10')])[_0xe066('0x11')](respondWithResult(_0x46eaf3,null))[_0xe066('0x12')](handleError(_0x46eaf3,null));};exports[_0xe066('0x25')]=function(_0xd6bcc2,_0x3784b9){return respondWithRpcPromise(_0xe066('0x26'),_0xd6bcc2[_0xe066('0x10')])[_0xe066('0x11')](respondWithResult(_0x3784b9,null))[_0xe066('0x12')](handleError(_0x3784b9,null));};exports[_0xe066('0x27')]=function(_0x16ee2d,_0x1e61d0){var _0x41f235;return respondWithRpcPromise('Agents',_0x16ee2d[_0xe066('0x10')])['then'](function(_0x4b0185){_0x41f235=_0x4b0185;return respondWithRpcPromise('Agents',_0x16ee2d[_0xe066('0x10')],routingClient);})[_0xe066('0x11')](function(_0x1b2f7f){return _[_0xe066('0x15')]({},_0x1b2f7f,_0x41f235);})[_0xe066('0x11')](respondWithResult(_0x1e61d0,null))['catch'](handleError(_0x1e61d0,null));};exports[_0xe066('0x28')]=function(_0x26498b,_0x6f6383){if(_0x26498b[_0xe066('0x29')]&&_0x26498b[_0xe066('0x29')][_0xe066('0x2a')]&&_0x26498b['user']&&_0x26498b['user']['name']){for(var _0x2a39ed in _0x26498b[_0xe066('0x29')]['interaction']){if(_0x26498b[_0xe066('0x29')][_0xe066('0x2a')][_0xe066('0x2b')](_0x2a39ed)){db[_0xe066('0x2c')][_0xe066('0x2d')]({'where':{'channel':_0x2a39ed,'membername':_0x26498b[_0xe066('0x2e')][_0xe066('0x2f')],'type':_0xe066('0x30'),'exitAt':null,'uniqueid':_0x26498b[_0xe066('0x29')]['interaction'][_0x2a39ed]&&_0x26498b[_0xe066('0x29')]['interaction'][_0x2a39ed][_0xe066('0x31')]?{'$notIn':_0x26498b[_0xe066('0x29')][_0xe066('0x2a')][_0x2a39ed]}:{'$ne':null}}})['then'](function(_0x25ad77){var _0x20b3a7=moment()[_0xe066('0x32')](_0xe066('0x33'));for(var _0x288080=0x0,_0x22d280=_0x25ad77[_0xe066('0x31')];_0x288080<_0x22d280;_0x288080+=0x1){_0x25ad77[_0x288080][_0xe066('0x34')]({'exitAt':_0x20b3a7});}});for(var _0x679353=0x0;_0x679353<_0x26498b['body'][_0xe066('0x2a')][_0x2a39ed]['length'];_0x679353+=0x1){db[_0xe066('0x2c')][_0xe066('0x35')]({'where':{'channel':_0x2a39ed,'membername':_0x26498b[_0xe066('0x2e')][_0xe066('0x2f')],'type':_0xe066('0x30'),'uniqueid':_0x26498b[_0xe066('0x29')][_0xe066('0x2a')][_0x2a39ed][_0x679353],'exitAt':null},'defaults':{'channel':_0x2a39ed,'membername':_0x26498b['user']['name'],'interface':_[_0xe066('0xc')](_0x26498b[_0xe066('0x2e')][_0xe066('0x36')])?util[_0xe066('0x32')](_0xe066('0x37'),_0x26498b[_0xe066('0x2e')][_0xe066('0x2f')]):_0x26498b[_0xe066('0x2e')][_0xe066('0x36')],'type':'INTERACTION','enterAt':moment()[_0xe066('0x32')](_0xe066('0x33')),'role':'agent','internal':_0x26498b[_0xe066('0x2e')]['internal'],'uniqueid':_0x26498b[_0xe066('0x29')][_0xe066('0x2a')][_0x2a39ed][_0x679353]}});}}}}return respondWithRpcPromise(_0xe066('0x38'),{'id':_0x26498b[_0xe066('0x16')]['id'],'capacity':_0x26498b[_0xe066('0x29')][_0xe066('0x39')]},routingClient)[_0xe066('0x11')](respondWithResult(_0x6f6383,null))['catch'](handleError(_0x6f6383,null));};exports[_0xe066('0x3a')]=function(_0x2ae5ac,_0x2921e4){return respondWithRpcPromise(_0xe066('0x3b'),_0x2ae5ac[_0xe066('0x10')])[_0xe066('0x11')](respondWithResult(_0x2921e4,null))[_0xe066('0x12')](handleError(_0x2921e4,null));};exports[_0xe066('0x3c')]=function(_0x685ac5,_0x12bd03){return respondWithRpcPromise(_0xe066('0x3d'),_0x685ac5[_0xe066('0x10')])[_0xe066('0x11')](respondWithResult(_0x12bd03,null))[_0xe066('0x12')](handleError(_0x12bd03,null));};exports[_0xe066('0x3e')]=function(_0x246c54,_0x59e57d){return respondWithRpcPromise(_0xe066('0x3f'),_0x246c54[_0xe066('0x10')])['then'](respondWithResult(_0x59e57d,null))[_0xe066('0x12')](handleError(_0x59e57d,null));};exports[_0xe066('0x40')]=function(_0x1f03de,_0x30bf02){return respondWithRpcPromise('ChatQueues',_0x1f03de['query'],routingClient)['then'](respondWithResult(_0x30bf02,null))[_0xe066('0x12')](handleError(_0x30bf02,null));};exports[_0xe066('0x41')]=function(_0x10d5cd,_0x27a44f){return respondWithRpcPromise('ChatQueues',_0x10d5cd[_0xe066('0x10')],routingClient)[_0xe066('0x11')](findById(_0x10d5cd['params']['id']))[_0xe066('0x11')](respondWithResult(_0x27a44f,null))[_0xe066('0x12')](handleError(_0x27a44f,null));};exports[_0xe066('0x42')]=function(_0x591ac1,_0x30404d){return respondWithRpcPromise(_0xe066('0x43'),_0x591ac1[_0xe066('0x10')],routingClient)[_0xe066('0x11')](respondWithResult(_0x30404d,null))['catch'](handleError(_0x30404d,null));};exports[_0xe066('0x44')]=function(_0x3d0747,_0x1d0e8b){return respondWithRpcPromise('MailQueues',_0x3d0747[_0xe066('0x10')],routingClient)['then'](findById(_0x3d0747[_0xe066('0x16')]['id']))[_0xe066('0x11')](respondWithResult(_0x1d0e8b,null))['catch'](handleError(_0x1d0e8b,null));};exports[_0xe066('0x45')]=function(_0x291467,_0x3ce7d7){return respondWithRpcPromise('MailAccounts',_0x291467[_0xe066('0x10')],mailClient)[_0xe066('0x11')](respondWithResult(_0x3ce7d7,null))[_0xe066('0x12')](handleError(_0x3ce7d7,null));};exports[_0xe066('0x46')]=function(_0x38e3af,_0x33d4a4){return respondWithRpcPromise('OpenchannelQueues',_0x38e3af['query'],routingClient)['then'](respondWithResult(_0x33d4a4,null))[_0xe066('0x12')](handleError(_0x33d4a4,null));};exports['showOpenchannelQueues']=function(_0x1e49c1,_0x437575){return respondWithRpcPromise(_0xe066('0x47'),_0x1e49c1['query'],routingClient)['then'](findById(_0x1e49c1[_0xe066('0x16')]['id']))['then'](respondWithResult(_0x437575,null))[_0xe066('0x12')](handleError(_0x437575,null));};exports[_0xe066('0x48')]=function(_0xa78bd1,_0x585c32){return respondWithRpcPromise(_0xe066('0x49'),_0xa78bd1[_0xe066('0x10')],routingClient)['then'](respondWithResult(_0x585c32,null))[_0xe066('0x12')](handleError(_0x585c32,null));};exports[_0xe066('0x4a')]=function(_0x190d7e,_0x4f0868){return respondWithRpcPromise(_0xe066('0x49'),_0x190d7e[_0xe066('0x10')],routingClient)[_0xe066('0x11')](findById(_0x190d7e['params']['id']))['then'](respondWithResult(_0x4f0868,null))[_0xe066('0x12')](handleError(_0x4f0868,null));};exports[_0xe066('0x4b')]=function(_0x34cb84,_0x4db8b4){return respondWithRpcPromise(_0xe066('0x4c'),_0x34cb84[_0xe066('0x10')],routingClient)['then'](respondWithResult(_0x4db8b4,null))[_0xe066('0x12')](handleError(_0x4db8b4,null));};exports[_0xe066('0x4d')]=function(_0x363216,_0x51e7df){return respondWithRpcPromise('WhatsappQueues',_0x363216['query'],routingClient)[_0xe066('0x11')](findById(_0x363216['params']['id']))[_0xe066('0x11')](respondWithResult(_0x51e7df,null))[_0xe066('0x12')](handleError(_0x51e7df,null));};exports[_0xe066('0x4e')]=function(_0x59a80d,_0x258a0c){return respondWithRpcPromise(_0xe066('0x4f'),_0x59a80d['query'],routingClient)[_0xe066('0x11')](respondWithResult(_0x258a0c,null))['catch'](handleError(_0x258a0c,null));};exports[_0xe066('0x50')]=function(_0x4957a4,_0x192c24){return respondWithRpcPromise('FaxQueues',_0x4957a4[_0xe066('0x10')],routingClient)[_0xe066('0x11')](findById(_0x4957a4[_0xe066('0x16')]['id']))[_0xe066('0x11')](respondWithResult(_0x192c24,null))[_0xe066('0x12')](handleError(_0x192c24,null));};exports['faxAccounts']=function(_0x4d66e1,_0x1c2b89){return respondWithRpcPromise(_0xe066('0x51'),_0x4d66e1[_0xe066('0x10')])['then'](respondWithResult(_0x1c2b89,null))[_0xe066('0x12')](handleError(_0x1c2b89,null));};exports[_0xe066('0x52')]=function(_0x474ecd,_0x1ff452){return respondWithRpcPromise(_0xe066('0x53'),_0x474ecd[_0xe066('0x10')],routingClient)[_0xe066('0x11')](respondWithResult(_0x1ff452,null))['catch'](handleError(_0x1ff452,null));};exports['mailQueuesWaitingInteractions']=function(_0x3cb607,_0x43a91b){return respondWithRpcPromise(_0xe066('0x54'),_0x3cb607[_0xe066('0x10')],routingClient)[_0xe066('0x11')](respondWithResult(_0x43a91b,null))[_0xe066('0x12')](handleError(_0x43a91b,null));};exports[_0xe066('0x55')]=function(_0xcb01ca,_0x6544db){return respondWithRpcPromise(_0xe066('0x56'),_0xcb01ca[_0xe066('0x10')],routingClient)[_0xe066('0x11')](respondWithResult(_0x6544db,null))[_0xe066('0x12')](handleError(_0x6544db,null));};exports['smsQueuesWaitingInteractions']=function(_0x476151,_0x19a97d){return respondWithRpcPromise(_0xe066('0x57'),_0x476151[_0xe066('0x10')],routingClient)[_0xe066('0x11')](respondWithResult(_0x19a97d,null))['catch'](handleError(_0x19a97d,null));};exports[_0xe066('0x58')]=function(_0x10d550,_0x1a8f63){return respondWithRpcPromise(_0xe066('0x59'),_0x10d550['query'],routingClient)[_0xe066('0x11')](respondWithResult(_0x1a8f63,null))['catch'](handleError(_0x1a8f63,null));};exports[_0xe066('0x5a')]=function(_0x5b6e77,_0x5b109b){return respondWithRpcPromise(_0xe066('0x5b'),_0x5b6e77[_0xe066('0x10')],routingClient)[_0xe066('0x11')](respondWithResult(_0x5b109b,null))['catch'](handleError(_0x5b109b,null));};exports[_0xe066('0x5c')]=function(_0x5c6264){return function(_0x14d235,_0x95f83b){var _0x5004eb,_0x1bdd7b;var _0x1c78f9=_[_0xe066('0x5d')](_0x5c6264);var _0xe579c6=_0x5c6264===_0xe066('0x5e')?'Website':_0xe066('0x5f');return db[_0x1c78f9+_0xe066('0x60')][_0xe066('0x61')]({'raw':!![],'where':{'id':_0x14d235[_0xe066('0x16')]['id']}})[_0xe066('0x11')](function(_0x598df0){if(_[_0xe066('0xc')](_0x598df0)){throw new Error(_0x1c78f9+_0xe066('0x62'));}_0x5004eb=_0x598df0;return db[_0x1c78f9+_0xe066('0x63')][_0xe066('0x61')]({'where':{'id':_0x14d235['body']['messageId']},'include':[{'model':db[_0x1c78f9+_0xe066('0x64')],'as':_0xe066('0x64')},{'model':db[_0x1c78f9+_0xe579c6],'as':_0xe066('0x5f')}]});})['then'](function(_0x283c0e){if(_[_0xe066('0xc')](_0x283c0e)){throw new Error(_0x1c78f9+_0xe066('0x65'));}_0x1bdd7b=_0x283c0e;return _0x283c0e[_0xe066('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe066('0x11')](function(){var _0x54fff4={'uniqueid':_0x5c6264+'.'+_0x1bdd7b['id']+'.'+_0x1bdd7b[_0xe066('0x64')]['id'],'FromUserId':_0x14d235['user']['id'],'type':'queue'};_0x54fff4[_0x1c78f9+_0xe066('0x67')]=_0x1bdd7b['id'];_0x54fff4[_0x1c78f9+_0xe066('0x68')]=_0x1bdd7b[_0xe066('0x64')]['id'];_0x54fff4['From'+_0x1c78f9+_0xe579c6+'Id']=_0x1bdd7b[_0xe066('0x5f')]['id'];_0x54fff4['To'+_0x1c78f9+_0xe066('0x69')]=_0x5004eb['id'];return db[_0x1c78f9+_0xe066('0x6a')][_0xe066('0x6b')](_0x54fff4);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5c6264,'interaction':_0x1bdd7b[_0xe066('0x64')],'message':_0x1bdd7b,'account':_0x1bdd7b[_0xe066('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe066('0x6c'),'appdata':_0x5004eb[_0xe066('0x2f')]+','+(_0x1bdd7b[_0xe066('0x5f')][_0xe066('0x6d')]||0x12c),'interval':_0xe066('0x6e')}]},routingClient);})[_0xe066('0x11')](respondWithResult(_0x95f83b,null))['catch'](handleError(_0x95f83b,null));};};exports['agentNotify']=function(_0x110b6a,_0x378616){var _0x27853a,_0xe9216b;if(_[_0xe066('0xc')](_0x110b6a[_0xe066('0x29')][_0xe066('0x6f')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x2e4624=_0x110b6a[_0xe066('0x29')][_0xe066('0x6f')];var _0x36baf1=_[_0xe066('0x5d')](_0x2e4624);var _0xf70a1b=_0x2e4624===_0xe066('0x5e')?_0xe066('0x70'):_0xe066('0x5f');return db[_0xe066('0x71')][_0xe066('0x61')]({'raw':!![],'where':{'id':_0x110b6a['params']['id'],'role':'agent'}})['then'](function(_0x14e572){if(_['isNil'](_0x14e572)){throw new Error(_0xe066('0x72'));}_0x27853a=_0x14e572;return db[_0x36baf1+_0xe066('0x63')]['findOne']({'where':{'id':_0x110b6a[_0xe066('0x29')]['messageId']},'include':[{'model':db[_0x36baf1+_0xe066('0x64')],'as':_0xe066('0x64')},{'model':db[_0x36baf1+_0xf70a1b],'as':_0xe066('0x5f')}]});})[_0xe066('0x11')](function(_0x422860){if(_[_0xe066('0xc')](_0x422860)){throw new Error(_0x36baf1+_0xe066('0x65'));}_0xe9216b=_0x422860;return _0x422860[_0xe066('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe066('0x11')](function(){var _0xa9e40c={'uniqueid':_0x2e4624+'.'+_0xe9216b['id']+'.'+_0xe9216b[_0xe066('0x64')]['id'],'FromUserId':_0x110b6a['user']['id'],'type':_0xe066('0x6c'),'ToUserId':_0x27853a['id']};_0xa9e40c[_0x36baf1+'MessageId']=_0xe9216b['id'];_0xa9e40c[_0x36baf1+_0xe066('0x68')]=_0xe9216b['Interaction']['id'];_0xa9e40c[_0xe066('0x73')+_0x36baf1+_0xf70a1b+'Id']=_0xe9216b['Account']['id'];return db[_0x36baf1+_0xe066('0x6a')][_0xe066('0x6b')](_0xa9e40c);})['then'](function(){return respondWithRpcPromise(_0xe066('0x74'),{'channel':_0x2e4624,'interaction':_0xe9216b['Interaction'],'message':_0xe9216b,'account':_0xe9216b[_0xe066('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe066('0x75'),'appdata':_0x27853a['name']+','+(_0xe9216b[_0xe066('0x5f')][_0xe066('0x76')]||0x12c),'interval':_0xe066('0x6e')}]},routingClient);})[_0xe066('0x11')](respondWithResult(_0x378616,null))[_0xe066('0x12')](handleError(_0x378616,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a7f1cc7..9b4db9c 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 _0x2739=['delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','post','create','/:id','update'];(function(_0x48f86f,_0x3bda2e){var _0x3dfd1c=function(_0x54610f){while(--_0x54610f){_0x48f86f['push'](_0x48f86f['shift']());}};_0x3dfd1c(++_0x3bda2e);}(_0x2739,0xca));var _0x9273=function(_0x2bfcba,_0x2f8562){_0x2bfcba=_0x2bfcba-0x0;var _0x18014c=_0x2739[_0x2bfcba];return _0x18014c;};'use strict';var multer=require(_0x9273('0x0'));var util=require(_0x9273('0x1'));var path=require(_0x9273('0x2'));var timeout=require(_0x9273('0x3'));var express=require('express');var router=express[_0x9273('0x4')]();var auth=require(_0x9273('0x5'));var interaction=require(_0x9273('0x6'));var config=require('../../config/environment');var controller=require(_0x9273('0x7'));router[_0x9273('0x8')]('/',auth[_0x9273('0x9')](),controller[_0x9273('0xa')]);router[_0x9273('0x8')]('/:id',auth[_0x9273('0x9')](),controller[_0x9273('0xb')]);router[_0x9273('0x8')](_0x9273('0xc'),auth[_0x9273('0x9')](),controller[_0x9273('0xd')]);router[_0x9273('0xe')]('/',auth[_0x9273('0x9')](),controller[_0x9273('0xf')]);router['put'](_0x9273('0x10'),auth[_0x9273('0x9')](),controller[_0x9273('0x11')]);router[_0x9273('0x12')](_0x9273('0x10'),auth[_0x9273('0x9')](),controller[_0x9273('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1936=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','get','/:id','show','/:id/run','isAuthenticated','post','create','put','delete','destroy','exports','multer','path'];(function(_0x157979,_0x3cc241){var _0x92417f=function(_0x877393){while(--_0x877393){_0x157979['push'](_0x157979['shift']());}};_0x92417f(++_0x3cc241);}(_0x1936,0x96));var _0x6193=function(_0x5841d3,_0x5bcb4c){_0x5841d3=_0x5841d3-0x0;var _0x25bfd2=_0x1936[_0x5841d3];return _0x25bfd2;};'use strict';var multer=require(_0x6193('0x0'));var util=require('util');var path=require(_0x6193('0x1'));var timeout=require(_0x6193('0x2'));var express=require(_0x6193('0x3'));var router=express[_0x6193('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6193('0x5'));var config=require(_0x6193('0x6'));var controller=require(_0x6193('0x7'));router[_0x6193('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6193('0x8')](_0x6193('0x9'),auth['isAuthenticated'](),controller[_0x6193('0xa')]);router[_0x6193('0x8')](_0x6193('0xb'),auth[_0x6193('0xc')](),controller['run']);router[_0x6193('0xd')]('/',auth[_0x6193('0xc')](),controller[_0x6193('0xe')]);router[_0x6193('0xf')]('/:id',auth[_0x6193('0xc')](),controller['update']);router[_0x6193('0x10')](_0x6193('0x9'),auth[_0x6193('0xc')](),controller[_0x6193('0x11')]);module[_0x6193('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index b7baa64..46974c2 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 _0x39c7=['csv','pdf','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','months','weeks','minutes','days'];(function(_0x4c781d,_0x1da49b){var _0x3bd77d=function(_0x3ae237){while(--_0x3ae237){_0x4c781d['push'](_0x4c781d['shift']());}};_0x3bd77d(++_0x1da49b);}(_0x39c7,0x85));var _0x739c=function(_0x24dfa6,_0x6959fc){_0x24dfa6=_0x24dfa6-0x0;var _0x19f2bb=_0x39c7[_0x24dfa6];return _0x19f2bb;};'use strict';var Sequelize=require('sequelize');module[_0x739c('0x0')]={'name':{'type':Sequelize[_0x739c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x739c('0x1')]},'active':{'type':Sequelize[_0x739c('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x739c('0x1')],'allowNull':![],'defaultValue':_0x739c('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x739c('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x739c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x739c('0x6')]('years','quarters',_0x739c('0x7'),_0x739c('0x8'),'days','hours',_0x739c('0x9')),'allowNull':![],'defaultValue':_0x739c('0xa')},'output':{'type':Sequelize['ENUM'](_0x739c('0xb'),_0x739c('0xc'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x739c('0x6')](_0x739c('0xd'),_0x739c('0xe')),'allowNull':![],'defaultValue':_0x739c('0xd')},'sendMail':{'type':Sequelize[_0x739c('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x739c('0x1')]},'cc':{'type':Sequelize[_0x739c('0xf')]},'bcc':{'type':Sequelize[_0x739c('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x739c('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1c3b=['BOOLEAN','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','pdf','xlsx','csv','custom','default','TEXT'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1c3b,0xab));var _0xb1c3=function(_0x27c35b,_0xc203d2){_0x27c35b=_0x27c35b-0x0;var _0x26bf35=_0x1c3b[_0x27c35b];return _0x26bf35;};'use strict';var Sequelize=require(_0xb1c3('0x0'));module[_0xb1c3('0x1')]={'name':{'type':Sequelize[_0xb1c3('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb1c3('0x2')],'allowNull':![],'defaultValue':_0xb1c3('0x3')},'startAt':{'type':Sequelize[_0xb1c3('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb1c3('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb1c3('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb1c3('0x6')]('years',_0xb1c3('0x7'),_0xb1c3('0x8'),_0xb1c3('0x9'),'days','hours','minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xb1c3('0x6')]('csv',_0xb1c3('0xa'),_0xb1c3('0xb')),'allowNull':![],'defaultValue':_0xb1c3('0xc')},'type':{'type':Sequelize['ENUM'](_0xb1c3('0xd'),_0xb1c3('0xe')),'allowNull':![],'defaultValue':_0xb1c3('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xb1c3('0x2')]},'cc':{'type':Sequelize[_0xb1c3('0xf')]},'bcc':{'type':Sequelize[_0xb1c3('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xb1c3('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index d2174fe..2aa7b6f 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 _0x5b3a=['intersection','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','merge','options','Schedule','includeAll','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Scheduler','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes'];(function(_0x156854,_0x5b81b2){var _0x10b704=function(_0x4bf2cb){while(--_0x4bf2cb){_0x156854['push'](_0x156854['shift']());}};_0x10b704(++_0x5b81b2);}(_0x5b3a,0x6e));var _0xa5b3=function(_0x4c99be,_0x59be8f){_0x4c99be=_0x4c99be-0x0;var _0x4b51c5=_0x5b3a[_0x4c99be];return _0x4b51c5;};'use strict';var pdf=require(_0xa5b3('0x0'));var emlformat=require(_0xa5b3('0x1'));var rimraf=require(_0xa5b3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa5b3('0x3'));var rp=require(_0xa5b3('0x4'));var moment=require(_0xa5b3('0x5'));var BPromise=require(_0xa5b3('0x6'));var Mustache=require(_0xa5b3('0x7'));var util=require(_0xa5b3('0x8'));var path=require(_0xa5b3('0x9'));var sox=require(_0xa5b3('0xa'));var csv=require(_0xa5b3('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa5b3('0xc'));var squel=require(_0xa5b3('0xd'));var crypto=require(_0xa5b3('0xe'));var jsforce=require(_0xa5b3('0xf'));var deskjs=require(_0xa5b3('0x10'));var toCsv=require(_0xa5b3('0xb'));var querystring=require('querystring');var Papa=require(_0xa5b3('0x11'));var Redis=require(_0xa5b3('0x12'));var authService=require(_0xa5b3('0x13'));var qs=require(_0xa5b3('0x14'));var as=require(_0xa5b3('0x15'));var hardwareService=require(_0xa5b3('0x16'));var logger=require(_0xa5b3('0x17'))(_0xa5b3('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa5b3('0x19'))['db'];function respondWithStatusCode(_0x523901,_0x30e315){_0x30e315=_0x30e315||0xcc;return function(_0x36ac58){if(_0x36ac58){return _0x523901[_0xa5b3('0x1a')](_0x30e315);}return _0x523901[_0xa5b3('0x1b')](_0x30e315)[_0xa5b3('0x1c')]();};}function respondWithResult(_0x24929c,_0x11c01a){_0x11c01a=_0x11c01a||0xc8;return function(_0x4d35c9){if(_0x4d35c9){return _0x24929c[_0xa5b3('0x1b')](_0x11c01a)[_0xa5b3('0x1d')](_0x4d35c9);}};}function respondWithFilteredResult(_0x49383d,_0x2ea9f8){return function(_0x3564e6){if(_0x3564e6){var _0x1dba75=_0x3564e6[_0xa5b3('0x1e')],_0x433e1b=_0x2ea9f8['offset'],_0x162689=_0x2ea9f8[_0xa5b3('0x1f')]+_0x2ea9f8[_0xa5b3('0x20')],_0x11ddf4;if(_0x162689>=_0x1dba75){_0x162689=_0x1dba75;_0x11ddf4=0xc8;}else{_0x11ddf4=0xce;}_0x49383d[_0xa5b3('0x1b')](_0x11ddf4);return _0x49383d[_0xa5b3('0x21')](_0xa5b3('0x22'),_0x433e1b+'-'+_0x162689+'/'+_0x1dba75)[_0xa5b3('0x1d')](_0x3564e6);}return null;};}function patchUpdates(_0x39c8d6){return function(_0x560d52){try{jsonpatch['apply'](_0x560d52,_0x39c8d6,!![]);}catch(_0x5de449){return BPromise['reject'](_0x5de449);}return _0x560d52[_0xa5b3('0x23')]();};}function saveUpdates(_0xd91852,_0x556aa9){return function(_0x2619e6){if(_0x2619e6){return _0x2619e6[_0xa5b3('0x24')](_0xd91852)[_0xa5b3('0x25')](function(_0x17a83d){return _0x17a83d;});}return null;};}function removeEntity(_0x520984,_0x150f45){return function(_0x5023dd){if(_0x5023dd){return _0x5023dd['destroy']()[_0xa5b3('0x25')](function(){var _0x1c63f9=_0x5023dd[_0xa5b3('0x26')]({'plain':!![]});var _0x1d21bd='Scheduler';return db[_0xa5b3('0x27')][_0xa5b3('0x28')]({'where':{'type':_0x1d21bd,'resourceId':_0x1c63f9['id']}})[_0xa5b3('0x25')](function(){return _0x5023dd;});})[_0xa5b3('0x25')](function(){_0x520984[_0xa5b3('0x1b')](0xcc)[_0xa5b3('0x1c')]();});}};}function handleEntityNotFound(_0x1248b0,_0x2749cd){return function(_0xed042d){if(!_0xed042d){_0x1248b0[_0xa5b3('0x1a')](0x194);}return _0xed042d;};}function handleError(_0x3cbe9a,_0x1d1fc2){_0x1d1fc2=_0x1d1fc2||0x1f4;return function(_0x191316){logger[_0xa5b3('0x29')](_0x191316[_0xa5b3('0x2a')]);if(_0x191316[_0xa5b3('0x2b')]){delete _0x191316[_0xa5b3('0x2b')];}_0x3cbe9a[_0xa5b3('0x1b')](_0x1d1fc2)[_0xa5b3('0x2c')](_0x191316);};}exports['index']=function(_0x453b6d,_0x1aef12){var _0x2b457e={},_0x2edb1a={},_0x10d153={'count':0x0,'rows':[]};var _0x440e90=_[_0xa5b3('0x2d')](db['Schedule'][_0xa5b3('0x2e')],function(_0x1bc84){return{'name':_0x1bc84['fieldName'],'type':_0x1bc84[_0xa5b3('0x2f')][_0xa5b3('0x30')]};});_0x2edb1a[_0xa5b3('0x31')]=_[_0xa5b3('0x2d')](_0x440e90,_0xa5b3('0x2b'));_0x2edb1a[_0xa5b3('0x32')]=_[_0xa5b3('0x33')](_0x453b6d[_0xa5b3('0x32')]);_0x2edb1a[_0xa5b3('0x34')]=_['intersection'](_0x2edb1a[_0xa5b3('0x31')],_0x2edb1a[_0xa5b3('0x32')]);_0x2b457e[_0xa5b3('0x35')]=_[_0xa5b3('0x36')](_0x2edb1a['model'],qs[_0xa5b3('0x37')](_0x453b6d[_0xa5b3('0x32')]['fields']));_0x2b457e[_0xa5b3('0x35')]=_0x2b457e[_0xa5b3('0x35')][_0xa5b3('0x38')]?_0x2b457e[_0xa5b3('0x35')]:_0x2edb1a[_0xa5b3('0x31')];if(!_0x453b6d[_0xa5b3('0x32')][_0xa5b3('0x39')]('nolimit')){_0x2b457e['limit']=qs[_0xa5b3('0x20')](_0x453b6d['query'][_0xa5b3('0x20')]);_0x2b457e[_0xa5b3('0x1f')]=qs[_0xa5b3('0x1f')](_0x453b6d[_0xa5b3('0x32')]['offset']);}_0x2b457e['order']=qs['sort'](_0x453b6d[_0xa5b3('0x32')][_0xa5b3('0x3a')]);_0x2b457e[_0xa5b3('0x3b')]=qs[_0xa5b3('0x34')](_[_0xa5b3('0x3c')](_0x453b6d[_0xa5b3('0x32')],_0x2edb1a[_0xa5b3('0x34')]),_0x440e90);if(_0x453b6d[_0xa5b3('0x32')]['filter']){_0x2b457e['where']=_['merge'](_0x2b457e[_0xa5b3('0x3b')],{'$or':_[_0xa5b3('0x2d')](_0x440e90,function(_0x34b507){if(_0x34b507[_0xa5b3('0x2f')]!==_0xa5b3('0x3d')){var _0x5e3fbf={};_0x5e3fbf[_0x34b507[_0xa5b3('0x2b')]]={'$like':'%'+_0x453b6d['query']['filter']+'%'};return _0x5e3fbf;}})});}_0x2b457e=_[_0xa5b3('0x3e')]({},_0x2b457e,_0x453b6d[_0xa5b3('0x3f')]);var _0xb572e9={'where':_0x2b457e['where']};return db[_0xa5b3('0x40')]['count'](_0xb572e9)['then'](function(_0xd0314e){_0x10d153[_0xa5b3('0x1e')]=_0xd0314e;if(_0x453b6d[_0xa5b3('0x32')][_0xa5b3('0x41')]){_0x2b457e['include']=[{'all':!![]}];}return db[_0xa5b3('0x40')][_0xa5b3('0x42')](_0x2b457e);})[_0xa5b3('0x25')](function(_0x59c6bf){_0x10d153[_0xa5b3('0x43')]=_0x59c6bf;return _0x10d153;})[_0xa5b3('0x25')](respondWithFilteredResult(_0x1aef12,_0x2b457e))['catch'](handleError(_0x1aef12,null));};exports[_0xa5b3('0x44')]=function(_0xba4d88,_0x289426){var _0x512980={'raw':![],'where':{'id':_0xba4d88[_0xa5b3('0x45')]['id']}},_0x3a4612={};_0x3a4612[_0xa5b3('0x31')]=_[_0xa5b3('0x33')](db['Schedule']['rawAttributes']);_0x3a4612[_0xa5b3('0x32')]=_[_0xa5b3('0x33')](_0xba4d88[_0xa5b3('0x32')]);_0x3a4612[_0xa5b3('0x34')]=_[_0xa5b3('0x36')](_0x3a4612['model'],_0x3a4612['query']);_0x512980[_0xa5b3('0x35')]=_[_0xa5b3('0x36')](_0x3a4612[_0xa5b3('0x31')],qs[_0xa5b3('0x37')](_0xba4d88[_0xa5b3('0x32')]['fields']));_0x512980[_0xa5b3('0x35')]=_0x512980[_0xa5b3('0x35')][_0xa5b3('0x38')]?_0x512980[_0xa5b3('0x35')]:_0x3a4612[_0xa5b3('0x31')];if(_0xba4d88[_0xa5b3('0x32')]['includeAll']){_0x512980[_0xa5b3('0x46')]=[{'all':!![]}];}_0x512980=_[_0xa5b3('0x3e')]({},_0x512980,_0xba4d88[_0xa5b3('0x3f')]);return db[_0xa5b3('0x40')][_0xa5b3('0x47')](_0x512980)['then'](handleEntityNotFound(_0x289426,null))[_0xa5b3('0x25')](respondWithResult(_0x289426,null))['catch'](handleError(_0x289426,null));};exports['create']=function(_0x5729e1,_0x4a866e){return db[_0xa5b3('0x40')][_0xa5b3('0x48')](_0x5729e1[_0xa5b3('0x49')],{})[_0xa5b3('0x25')](function(_0x5d66e1){var _0x2d8a7f=_0x5729e1[_0xa5b3('0x4a')][_0xa5b3('0x26')]({'plain':!![]});if(!_0x2d8a7f)throw new Error(_0xa5b3('0x4b'));if(_0x2d8a7f['role']==='user'){var _0x56a8df=_0x5d66e1['get']({'plain':!![]});var _0x35a068=_0xa5b3('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x35a068,'userProfileId':_0x2d8a7f[_0xa5b3('0x4d')]},'raw':!![]})['then'](function(_0x108d14){if(_0x108d14&&_0x108d14[_0xa5b3('0x4e')]===0x0){return db[_0xa5b3('0x27')][_0xa5b3('0x48')]({'name':_0x56a8df[_0xa5b3('0x2b')],'resourceId':_0x56a8df['id'],'type':_0x108d14[_0xa5b3('0x2b')],'sectionId':_0x108d14['id']},{})[_0xa5b3('0x25')](function(){return _0x5d66e1;});}else{return _0x5d66e1;}})['catch'](function(_0xd86210){logger[_0xa5b3('0x29')](_0xa5b3('0x4f'),_0xd86210);throw _0xd86210;});}return _0x5d66e1;})[_0xa5b3('0x25')](respondWithResult(_0x4a866e,0xc9))[_0xa5b3('0x50')](handleError(_0x4a866e,null));};exports[_0xa5b3('0x24')]=function(_0x3a1532,_0x5b9ae1){if(_0x3a1532['body']['id']){delete _0x3a1532[_0xa5b3('0x49')]['id'];}return db[_0xa5b3('0x40')][_0xa5b3('0x47')]({'where':{'id':_0x3a1532[_0xa5b3('0x45')]['id']}})[_0xa5b3('0x25')](handleEntityNotFound(_0x5b9ae1,null))['then'](saveUpdates(_0x3a1532['body'],null))[_0xa5b3('0x25')](respondWithResult(_0x5b9ae1,null))[_0xa5b3('0x50')](handleError(_0x5b9ae1,null));};exports[_0xa5b3('0x28')]=function(_0x4ed63d,_0x41d77a){return db[_0xa5b3('0x40')][_0xa5b3('0x47')]({'where':{'id':_0x4ed63d[_0xa5b3('0x45')]['id']}})[_0xa5b3('0x25')](handleEntityNotFound(_0x41d77a,null))['then'](removeEntity(_0x41d77a,null))['catch'](handleError(_0x41d77a,null));};exports[_0xa5b3('0x51')]=function(_0x8ec055,_0x1bbe29,_0x59c2e5){var _0x42c5c2=require('../../config/schedule');return db[_0xa5b3('0x40')][_0xa5b3('0x47')]({'where':{'id':_0x8ec055[_0xa5b3('0x45')]['id']},'raw':!![]})[_0xa5b3('0x25')](handleEntityNotFound(_0x1bbe29,null))[_0xa5b3('0x25')](function(){_0x42c5c2['run'](_0x8ec055[_0xa5b3('0x45')]['id']);})['then'](respondWithStatusCode(_0x1bbe29,null))[_0xa5b3('0x50')](handleError(_0x1bbe29,null));}; \ No newline at end of file +var _0x815e=['catch','show','params','Schedule','intersection','merge','find','create','get','role','user','Scheduler','UserProfileSection','userProfileId','autoAssociation','update','body','run','../../config/schedule','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','then','destroy','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','model','name','keys','query','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','rows'];(function(_0x26c880,_0x465998){var _0x2e6c09=function(_0x5ab2b8){while(--_0x5ab2b8){_0x26c880['push'](_0x26c880['shift']());}};_0x2e6c09(++_0x465998);}(_0x815e,0xb9));var _0xe815=function(_0x36781b,_0x56e903){_0x36781b=_0x36781b-0x0;var _0x7a1bc6=_0x815e[_0x36781b];return _0x7a1bc6;};'use strict';var pdf=require(_0xe815('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe815('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe815('0x2'));var rp=require(_0xe815('0x3'));var moment=require(_0xe815('0x4'));var BPromise=require(_0xe815('0x5'));var Mustache=require(_0xe815('0x6'));var util=require(_0xe815('0x7'));var path=require(_0xe815('0x8'));var sox=require(_0xe815('0x9'));var csv=require(_0xe815('0xa'));var ejs=require(_0xe815('0xb'));var fs=require('fs');var _=require(_0xe815('0xc'));var squel=require('squel');var crypto=require(_0xe815('0xd'));var jsforce=require(_0xe815('0xe'));var deskjs=require(_0xe815('0xf'));var toCsv=require(_0xe815('0xa'));var querystring=require('querystring');var Papa=require(_0xe815('0x10'));var Redis=require(_0xe815('0x11'));var authService=require(_0xe815('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe815('0x13'));var hardwareService=require(_0xe815('0x14'));var logger=require(_0xe815('0x15'))(_0xe815('0x16'));var utils=require(_0xe815('0x17'));var config=require(_0xe815('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ddf1e,_0x1c6ab2){_0x1c6ab2=_0x1c6ab2||0xcc;return function(_0x55715b){if(_0x55715b){return _0x3ddf1e[_0xe815('0x19')](_0x1c6ab2);}return _0x3ddf1e[_0xe815('0x1a')](_0x1c6ab2)[_0xe815('0x1b')]();};}function respondWithResult(_0xf1ba12,_0x35c364){_0x35c364=_0x35c364||0xc8;return function(_0x22dea5){if(_0x22dea5){return _0xf1ba12[_0xe815('0x1a')](_0x35c364)[_0xe815('0x1c')](_0x22dea5);}};}function respondWithFilteredResult(_0x414f7d,_0x409972){return function(_0x5a2fc0){if(_0x5a2fc0){var _0x3b3026=_0x5a2fc0[_0xe815('0x1d')],_0x397a7b=_0x409972[_0xe815('0x1e')],_0x48a5e1=_0x409972['offset']+_0x409972[_0xe815('0x1f')],_0x423c99;if(_0x48a5e1>=_0x3b3026){_0x48a5e1=_0x3b3026;_0x423c99=0xc8;}else{_0x423c99=0xce;}_0x414f7d[_0xe815('0x1a')](_0x423c99);return _0x414f7d['set'](_0xe815('0x20'),_0x397a7b+'-'+_0x48a5e1+'/'+_0x3b3026)['json'](_0x5a2fc0);}return null;};}function patchUpdates(_0x2e807d){return function(_0x4feb93){try{jsonpatch[_0xe815('0x21')](_0x4feb93,_0x2e807d,!![]);}catch(_0x19966b){return BPromise['reject'](_0x19966b);}return _0x4feb93[_0xe815('0x22')]();};}function saveUpdates(_0x1254fa,_0x56d0e2){return function(_0x4ac04e){if(_0x4ac04e){return _0x4ac04e['update'](_0x1254fa)[_0xe815('0x23')](function(_0x5e1383){return _0x5e1383;});}return null;};}function removeEntity(_0x3040cc,_0x6abf3c){return function(_0x37c4fb){if(_0x37c4fb){return _0x37c4fb[_0xe815('0x24')]()[_0xe815('0x23')](function(){var _0x37ed74=_0x37c4fb['get']({'plain':!![]});var _0x437466='Scheduler';return db[_0xe815('0x25')][_0xe815('0x24')]({'where':{'type':_0x437466,'resourceId':_0x37ed74['id']}})[_0xe815('0x23')](function(){return _0x37c4fb;});})[_0xe815('0x23')](function(){_0x3040cc[_0xe815('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25213a,_0x567533){return function(_0xac4717){if(!_0xac4717){_0x25213a[_0xe815('0x19')](0x194);}return _0xac4717;};}function handleError(_0xa838a4,_0x270fe1){_0x270fe1=_0x270fe1||0x1f4;return function(_0x22d932){logger[_0xe815('0x26')](_0x22d932[_0xe815('0x27')]);if(_0x22d932['name']){delete _0x22d932['name'];}_0xa838a4[_0xe815('0x1a')](_0x270fe1)[_0xe815('0x28')](_0x22d932);};}exports[_0xe815('0x29')]=function(_0x204385,_0x465481){var _0x59a95f={},_0x249f3e={},_0x210d20={'count':0x0,'rows':[]};var _0x51102e=_[_0xe815('0x2a')](db['Schedule'][_0xe815('0x2b')],function(_0x439b6f){return{'name':_0x439b6f[_0xe815('0x2c')],'type':_0x439b6f['type'][_0xe815('0x2d')]};});_0x249f3e[_0xe815('0x2e')]=_[_0xe815('0x2a')](_0x51102e,_0xe815('0x2f'));_0x249f3e['query']=_[_0xe815('0x30')](_0x204385['query']);_0x249f3e['filters']=_['intersection'](_0x249f3e[_0xe815('0x2e')],_0x249f3e[_0xe815('0x31')]);_0x59a95f[_0xe815('0x32')]=_['intersection'](_0x249f3e[_0xe815('0x2e')],qs[_0xe815('0x33')](_0x204385[_0xe815('0x31')][_0xe815('0x33')]));_0x59a95f[_0xe815('0x32')]=_0x59a95f[_0xe815('0x32')][_0xe815('0x34')]?_0x59a95f['attributes']:_0x249f3e[_0xe815('0x2e')];if(!_0x204385[_0xe815('0x31')]['hasOwnProperty'](_0xe815('0x35'))){_0x59a95f[_0xe815('0x1f')]=qs[_0xe815('0x1f')](_0x204385[_0xe815('0x31')][_0xe815('0x1f')]);_0x59a95f[_0xe815('0x1e')]=qs[_0xe815('0x1e')](_0x204385[_0xe815('0x31')][_0xe815('0x1e')]);}_0x59a95f[_0xe815('0x36')]=qs[_0xe815('0x37')](_0x204385[_0xe815('0x31')][_0xe815('0x37')]);_0x59a95f[_0xe815('0x38')]=qs['filters'](_['pick'](_0x204385['query'],_0x249f3e[_0xe815('0x39')]),_0x51102e);if(_0x204385[_0xe815('0x31')][_0xe815('0x3a')]){_0x59a95f[_0xe815('0x38')]=_['merge'](_0x59a95f['where'],{'$or':_[_0xe815('0x2a')](_0x51102e,function(_0x62ef3f){if(_0x62ef3f['type']!==_0xe815('0x3b')){var _0x1c45bc={};_0x1c45bc[_0x62ef3f[_0xe815('0x2f')]]={'$like':'%'+_0x204385['query'][_0xe815('0x3a')]+'%'};return _0x1c45bc;}})});}_0x59a95f=_['merge']({},_0x59a95f,_0x204385[_0xe815('0x3c')]);var _0x223799={'where':_0x59a95f[_0xe815('0x38')]};return db['Schedule']['count'](_0x223799)['then'](function(_0x39beca){_0x210d20[_0xe815('0x1d')]=_0x39beca;if(_0x204385[_0xe815('0x31')][_0xe815('0x3d')]){_0x59a95f[_0xe815('0x3e')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x59a95f);})[_0xe815('0x23')](function(_0x123c21){_0x210d20[_0xe815('0x3f')]=_0x123c21;return _0x210d20;})['then'](respondWithFilteredResult(_0x465481,_0x59a95f))[_0xe815('0x40')](handleError(_0x465481,null));};exports[_0xe815('0x41')]=function(_0x243bb6,_0x3d671a){var _0x4fc708={'raw':![],'where':{'id':_0x243bb6[_0xe815('0x42')]['id']}},_0x3b28b5={};_0x3b28b5['model']=_[_0xe815('0x30')](db[_0xe815('0x43')]['rawAttributes']);_0x3b28b5['query']=_[_0xe815('0x30')](_0x243bb6[_0xe815('0x31')]);_0x3b28b5[_0xe815('0x39')]=_[_0xe815('0x44')](_0x3b28b5['model'],_0x3b28b5[_0xe815('0x31')]);_0x4fc708['attributes']=_[_0xe815('0x44')](_0x3b28b5[_0xe815('0x2e')],qs[_0xe815('0x33')](_0x243bb6[_0xe815('0x31')][_0xe815('0x33')]));_0x4fc708['attributes']=_0x4fc708['attributes']['length']?_0x4fc708[_0xe815('0x32')]:_0x3b28b5[_0xe815('0x2e')];if(_0x243bb6['query'][_0xe815('0x3d')]){_0x4fc708[_0xe815('0x3e')]=[{'all':!![]}];}_0x4fc708=_[_0xe815('0x45')]({},_0x4fc708,_0x243bb6[_0xe815('0x3c')]);return db['Schedule'][_0xe815('0x46')](_0x4fc708)[_0xe815('0x23')](handleEntityNotFound(_0x3d671a,null))[_0xe815('0x23')](respondWithResult(_0x3d671a,null))[_0xe815('0x40')](handleError(_0x3d671a,null));};exports[_0xe815('0x47')]=function(_0x2e13c9,_0x2bf5e0){return db[_0xe815('0x43')][_0xe815('0x47')](_0x2e13c9['body'],{})[_0xe815('0x23')](function(_0x1fe611){var _0x1a9ab2=_0x2e13c9['user'][_0xe815('0x48')]({'plain':!![]});if(!_0x1a9ab2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a9ab2[_0xe815('0x49')]===_0xe815('0x4a')){var _0x54d84f=_0x1fe611[_0xe815('0x48')]({'plain':!![]});var _0x173d6b=_0xe815('0x4b');return db[_0xe815('0x4c')][_0xe815('0x46')]({'where':{'name':_0x173d6b,'userProfileId':_0x1a9ab2[_0xe815('0x4d')]},'raw':!![]})['then'](function(_0x56aad6){if(_0x56aad6&&_0x56aad6[_0xe815('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x54d84f[_0xe815('0x2f')],'resourceId':_0x54d84f['id'],'type':_0x56aad6[_0xe815('0x2f')],'sectionId':_0x56aad6['id']},{})[_0xe815('0x23')](function(){return _0x1fe611;});}else{return _0x1fe611;}})['catch'](function(_0x2f0a23){logger[_0xe815('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f0a23);throw _0x2f0a23;});}return _0x1fe611;})[_0xe815('0x23')](respondWithResult(_0x2bf5e0,0xc9))['catch'](handleError(_0x2bf5e0,null));};exports[_0xe815('0x4f')]=function(_0x5c6d27,_0x54063e){if(_0x5c6d27['body']['id']){delete _0x5c6d27[_0xe815('0x50')]['id'];}return db[_0xe815('0x43')][_0xe815('0x46')]({'where':{'id':_0x5c6d27['params']['id']}})[_0xe815('0x23')](handleEntityNotFound(_0x54063e,null))[_0xe815('0x23')](saveUpdates(_0x5c6d27['body'],null))[_0xe815('0x23')](respondWithResult(_0x54063e,null))[_0xe815('0x40')](handleError(_0x54063e,null));};exports[_0xe815('0x24')]=function(_0x518caf,_0x507161){return db[_0xe815('0x43')]['find']({'where':{'id':_0x518caf[_0xe815('0x42')]['id']}})[_0xe815('0x23')](handleEntityNotFound(_0x507161,null))['then'](removeEntity(_0x507161,null))[_0xe815('0x40')](handleError(_0x507161,null));};exports[_0xe815('0x51')]=function(_0x61b77b,_0x51cfaa,_0x1b0c0a){var _0x429971=require(_0xe815('0x52'));return db[_0xe815('0x43')][_0xe815('0x46')]({'where':{'id':_0x61b77b[_0xe815('0x42')]['id']},'raw':!![]})[_0xe815('0x23')](handleEntityNotFound(_0x51cfaa,null))[_0xe815('0x23')](function(){_0x429971[_0xe815('0x51')](_0x61b77b['params']['id']);})[_0xe815('0x23')](respondWithStatusCode(_0x51cfaa,null))[_0xe815('0x40')](handleError(_0x51cfaa,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 53c5271..73f30fa 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 _0x4e39=['define','Schedule','tools_schedules','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./schedule.attributes'];(function(_0x25508e,_0x350436){var _0x36c55a=function(_0x4ccf04){while(--_0x4ccf04){_0x25508e['push'](_0x25508e['shift']());}};_0x36c55a(++_0x350436);}(_0x4e39,0xdf));var _0x94e3=function(_0x110c54,_0xa3cfcb){_0x110c54=_0x110c54-0x0;var _0x58a348=_0x4e39[_0x110c54];return _0x58a348;};'use strict';var _=require('lodash');var util=require(_0x94e3('0x0'));var logger=require(_0x94e3('0x1'))(_0x94e3('0x2'));var moment=require(_0x94e3('0x3'));var BPromise=require(_0x94e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94e3('0x5'));var rimraf=require('rimraf');var config=require(_0x94e3('0x6'));var attributes=require(_0x94e3('0x7'));module['exports']=function(_0x579d00,_0x547767){return _0x579d00[_0x94e3('0x8')](_0x94e3('0x9'),attributes,{'tableName':_0x94e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0956=['lodash','util','moment','rimraf','./schedule.attributes','define','Schedule','tools_schedules'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0956,0x130));var _0x6095=function(_0x2922b3,_0x41ed49){_0x2922b3=_0x2922b3-0x0;var _0x3c17ad=_0x0956[_0x2922b3];return _0x3c17ad;};'use strict';var _=require(_0x6095('0x0'));var util=require(_0x6095('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6095('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6095('0x3'));var config=require('../../config/environment');var attributes=require(_0x6095('0x4'));module['exports']=function(_0x2cfbaa,_0x4be339){return _0x2cfbaa[_0x6095('0x5')](_0x6095('0x6'),attributes,{'tableName':_0x6095('0x7'),'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 013d80a..cde1029 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 _0xa74f=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x14c8ee,_0x34d4fb){var _0x51acc2=function(_0x4c1277){while(--_0x4c1277){_0x14c8ee['push'](_0x14c8ee['shift']());}};_0x51acc2(++_0x34d4fb);}(_0xa74f,0x1b2));var _0xfa74=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xa74f[_0x3cec8c];return _0x38032e;};'use strict';var _=require(_0xfa74('0x0'));var util=require(_0xfa74('0x1'));var moment=require('moment');var BPromise=require(_0xfa74('0x2'));var rs=require(_0xfa74('0x3'));var fs=require('fs');var Redis=require(_0xfa74('0x4'));var db=require(_0xfa74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa74('0x6'))(_0xfa74('0x7'));var config=require(_0xfa74('0x8'));var jayson=require(_0xfa74('0x9'));var client=jayson[_0xfa74('0xa')][_0xfa74('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a8094,_0x1850be,_0x2d44fc){return new BPromise(function(_0x593e3b,_0x39e9a5){return client[_0xfa74('0xc')](_0x5a8094,_0x2d44fc)['then'](function(_0x1173bc){logger[_0xfa74('0xd')](_0xfa74('0xe'),_0x1850be,_0xfa74('0xf'));logger[_0xfa74('0x10')](_0xfa74('0x11'),_0x1850be,_0xfa74('0xf'),JSON[_0xfa74('0x12')](_0x1173bc));if(_0x1173bc['error']){if(_0x1173bc[_0xfa74('0x13')][_0xfa74('0x14')]===0x1f4){logger['error'](_0xfa74('0xe'),_0x1850be,_0x1173bc[_0xfa74('0x13')]['message']);return _0x39e9a5(_0x1173bc[_0xfa74('0x13')][_0xfa74('0x15')]);}logger[_0xfa74('0x13')]('Schedule,\x20%s,\x20%s',_0x1850be,_0x1173bc[_0xfa74('0x13')]['message']);return _0x593e3b(_0x1173bc[_0xfa74('0x13')][_0xfa74('0x15')]);}else{logger[_0xfa74('0xd')](_0xfa74('0xe'),_0x1850be,_0xfa74('0xf'));_0x593e3b(_0x1173bc[_0xfa74('0x16')][_0xfa74('0x15')]);}})[_0xfa74('0x17')](function(_0x1ae318){logger[_0xfa74('0x13')]('Schedule,\x20%s,\x20%s',_0x1850be,_0x1ae318);_0x39e9a5(_0x1ae318);});});} \ No newline at end of file +var _0x1652=['request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0x1652,0x102));var _0x2165=function(_0x1b01f6,_0x57d583){_0x1b01f6=_0x1b01f6-0x0;var _0x1f67af=_0x1652[_0x1b01f6];return _0x1f67af;};'use strict';var _=require(_0x2165('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2165('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x2165('0x2'));var logger=require(_0x2165('0x3'))('rpc');var config=require(_0x2165('0x4'));var jayson=require(_0x2165('0x5'));var client=jayson[_0x2165('0x6')][_0x2165('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43b74d,_0x1bc137,_0x3d64f7){return new BPromise(function(_0x1e50b0,_0xeae905){return client[_0x2165('0x8')](_0x43b74d,_0x3d64f7)[_0x2165('0x9')](function(_0x10d70b){logger[_0x2165('0xa')](_0x2165('0xb'),_0x1bc137,_0x2165('0xc'));logger[_0x2165('0xd')](_0x2165('0xe'),_0x1bc137,_0x2165('0xc'),JSON[_0x2165('0xf')](_0x10d70b));if(_0x10d70b[_0x2165('0x10')]){if(_0x10d70b['error']['code']===0x1f4){logger[_0x2165('0x10')](_0x2165('0xb'),_0x1bc137,_0x10d70b['error'][_0x2165('0x11')]);return _0xeae905(_0x10d70b[_0x2165('0x10')][_0x2165('0x11')]);}logger[_0x2165('0x10')](_0x2165('0xb'),_0x1bc137,_0x10d70b[_0x2165('0x10')][_0x2165('0x11')]);return _0x1e50b0(_0x10d70b[_0x2165('0x10')][_0x2165('0x11')]);}else{logger[_0x2165('0xa')](_0x2165('0xb'),_0x1bc137,_0x2165('0xc'));_0x1e50b0(_0x10d70b['result'][_0x2165('0x11')]);}})[_0x2165('0x12')](function(_0x4e38e0){logger[_0x2165('0x10')](_0x2165('0xb'),_0x1bc137,_0x4e38e0);_0xeae905(_0x4e38e0);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 6ab02d6..c8adba2 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 _0x0a97=['./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id/download','post','create','/:id','update','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c3e16,_0x10874e){var _0x36e860=function(_0xdabd7){while(--_0xdabd7){_0x2c3e16['push'](_0x2c3e16['shift']());}};_0x36e860(++_0x10874e);}(_0x0a97,0x79));var _0x70a9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0a97[_0x3e5086];return _0xfeb102;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x70a9('0x0'));var express=require('express');var router=express[_0x70a9('0x1')]();var auth=require(_0x70a9('0x2'));var interaction=require(_0x70a9('0x3'));var config=require(_0x70a9('0x4'));var controller=require(_0x70a9('0x5'));router[_0x70a9('0x6')]('/',auth[_0x70a9('0x7')](),controller[_0x70a9('0x8')]);router[_0x70a9('0x6')](_0x70a9('0x9'),auth[_0x70a9('0x7')](),controller[_0x70a9('0xa')]);router['get']('/:id',auth[_0x70a9('0x7')](),controller['show']);router[_0x70a9('0x6')](_0x70a9('0xb'),auth[_0x70a9('0x7')](),controller['download']);router[_0x70a9('0xc')]('/',auth[_0x70a9('0x7')](),controller[_0x70a9('0xd')]);router['put'](_0x70a9('0xe'),auth[_0x70a9('0x7')](),controller[_0x70a9('0xf')]);router['delete']('/:id',auth[_0x70a9('0x7')](),controller[_0x70a9('0x10')]);module[_0x70a9('0x11')]=router; \ No newline at end of file +var _0xc0b3=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','download','put'];(function(_0x5b98d6,_0x4e8ebf){var _0x36f2de=function(_0x36a342){while(--_0x36a342){_0x5b98d6['push'](_0x5b98d6['shift']());}};_0x36f2de(++_0x4e8ebf);}(_0xc0b3,0x17f));var _0x3c0b=function(_0x416ba8,_0x4f8b0e){_0x416ba8=_0x416ba8-0x0;var _0x30a759=_0xc0b3[_0x416ba8];return _0x30a759;};'use strict';var multer=require(_0x3c0b('0x0'));var util=require(_0x3c0b('0x1'));var path=require(_0x3c0b('0x2'));var timeout=require(_0x3c0b('0x3'));var express=require(_0x3c0b('0x4'));var router=express['Router']();var auth=require(_0x3c0b('0x5'));var interaction=require(_0x3c0b('0x6'));var config=require(_0x3c0b('0x7'));var controller=require(_0x3c0b('0x8'));router[_0x3c0b('0x9')]('/',auth[_0x3c0b('0xa')](),controller[_0x3c0b('0xb')]);router['get'](_0x3c0b('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x3c0b('0x9')](_0x3c0b('0xd'),auth[_0x3c0b('0xa')](),controller['show']);router[_0x3c0b('0x9')]('/:id/download',auth[_0x3c0b('0xa')](),controller[_0x3c0b('0xe')]);router['post']('/',auth[_0x3c0b('0xa')](),controller['create']);router[_0x3c0b('0xf')]('/:id',auth[_0x3c0b('0xa')](),controller['update']);router[_0x3c0b('0x10')](_0x3c0b('0xd'),auth[_0x3c0b('0xa')](),controller[_0x3c0b('0x11')]);module[_0x3c0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 960d868..8209408 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 _0xa630=['sequelize','moment','exports','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt'];(function(_0x447328,_0x3fcf4f){var _0x53450c=function(_0x5309b3){while(--_0x5309b3){_0x447328['push'](_0x447328['shift']());}};_0x53450c(++_0x3fcf4f);}(_0xa630,0xbe));var _0x0a63=function(_0x37aec4,_0x38975e){_0x37aec4=_0x37aec4-0x0;var _0x38bb4b=_0xa630[_0x37aec4];return _0x38bb4b;};'use strict';var Sequelize=require(_0x0a63('0x0'));var moment=require(_0x0a63('0x1'));var path=require('path');var config=require('../../config/environment');module[_0x0a63('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a63('0x3')]('value')?path[_0x0a63('0x4')](this[_0x0a63('0x3')](_0x0a63('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x0a63('0x6')]},'channel':{'type':Sequelize[_0x0a63('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x2760b0){var _0x3d5f0b=_0x2760b0[_0x0a63('0x7')](/\\/g,'/');this[_0x0a63('0x8')](_0x0a63('0x5'),_0x3d5f0b);}},'rating':{'type':Sequelize[_0x0a63('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x688acd){this[_0x0a63('0x8')](_0x0a63('0xa'),moment()[_0x0a63('0xb')](_0x688acd,'ms'));this[_0x0a63('0x8')](_0x0a63('0xc'),moment());this[_0x0a63('0x8')](_0x0a63('0xd'),_0x688acd);}},'startedAt':{'type':Sequelize[_0x0a63('0xe')],'get':function(){return moment(this[_0x0a63('0x3')]('startedAt'))[_0x0a63('0xf')](_0x0a63('0x10'))[_0x0a63('0x11')]();}},'closedAt':{'type':Sequelize[_0x0a63('0xe')],'get':function(){return moment(this['getDataValue'](_0x0a63('0xc')))['format'](_0x0a63('0x10'))[_0x0a63('0x11')]();}},'createdAt':{'type':Sequelize[_0x0a63('0xe')],'get':function(){return moment(this[_0x0a63('0x3')](_0x0a63('0x12')))[_0x0a63('0xf')](_0x0a63('0x10'))[_0x0a63('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a63('0x3')]('updatedAt'))[_0x0a63('0xf')](_0x0a63('0x10'))[_0x0a63('0x11')]();}}}; \ No newline at end of file +var _0x84ab=['MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value','STRING','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','toString','closedAt'];(function(_0x44d54c,_0x21c7ff){var _0x287de2=function(_0x531f21){while(--_0x531f21){_0x44d54c['push'](_0x44d54c['shift']());}};_0x287de2(++_0x21c7ff);}(_0x84ab,0x12f));var _0xb84a=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x84ab[_0x1265ed];return _0x5ac459;};'use strict';var Sequelize=require(_0xb84a('0x0'));var moment=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var config=require(_0xb84a('0x3'));module[_0xb84a('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb84a('0x5')](_0xb84a('0x6'))?path['extname'](this[_0xb84a('0x5')](_0xb84a('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xb84a('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x4dc496){var _0xd445b5=_0x4dc496['replace'](/\\/g,'/');this[_0xb84a('0x8')](_0xb84a('0x6'),_0xd445b5);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb84a('0x9')],'set':function(_0x525cb7){this[_0xb84a('0x8')](_0xb84a('0xa'),moment()[_0xb84a('0xb')](_0x525cb7,'ms'));this['setDataValue']('closedAt',moment());this['setDataValue'](_0xb84a('0xc'),_0x525cb7);}},'startedAt':{'type':Sequelize[_0xb84a('0xd')],'get':function(){return moment(this[_0xb84a('0x5')](_0xb84a('0xa')))[_0xb84a('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xb84a('0xf')]();}},'closedAt':{'type':Sequelize[_0xb84a('0xd')],'get':function(){return moment(this[_0xb84a('0x5')](_0xb84a('0x10')))[_0xb84a('0xe')](_0xb84a('0x11'))[_0xb84a('0xf')]();}},'createdAt':{'type':Sequelize[_0xb84a('0xd')],'get':function(){return moment(this[_0xb84a('0x5')](_0xb84a('0x12')))[_0xb84a('0xe')](_0xb84a('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0xb84a('0xd')],'get':function(){return moment(this[_0xb84a('0x5')](_0xb84a('0x13')))[_0xb84a('0xe')](_0xb84a('0x11'))[_0xb84a('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 87f7f85..fd4f99d 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 _0x1b12=['secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','ScreenRecording','rawAttributes','type','model','differenceBy','format','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','keys','find','create','update','body','createdAt','closedAt','value','catch','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync'];(function(_0x3192c3,_0x550336){var _0x4e3932=function(_0x34c461){while(--_0x34c461){_0x3192c3['push'](_0x3192c3['shift']());}};_0x4e3932(++_0x550336);}(_0x1b12,0x1b6));var _0x21b1=function(_0x122975,_0xc962ef){_0x122975=_0x122975-0x0;var _0x3657db=_0x1b12[_0x122975];return _0x3657db;};'use strict';var pdf=require(_0x21b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x21b1('0x1'));var zipdir=require(_0x21b1('0x2'));var jsonpatch=require(_0x21b1('0x3'));var rp=require('request-promise');var moment=require(_0x21b1('0x4'));var BPromise=require(_0x21b1('0x5'));var Mustache=require(_0x21b1('0x6'));var util=require(_0x21b1('0x7'));var path=require('path');var sox=require(_0x21b1('0x8'));var csv=require(_0x21b1('0x9'));var ejs=require(_0x21b1('0xa'));var fs=require('fs');var _=require(_0x21b1('0xb'));var squel=require(_0x21b1('0xc'));var crypto=require(_0x21b1('0xd'));var jsforce=require(_0x21b1('0xe'));var deskjs=require(_0x21b1('0xf'));var toCsv=require(_0x21b1('0x9'));var querystring=require(_0x21b1('0x10'));var Papa=require(_0x21b1('0x11'));var Redis=require(_0x21b1('0x12'));var authService=require(_0x21b1('0x13'));var qs=require(_0x21b1('0x14'));var as=require(_0x21b1('0x15'));var hardwareService=require(_0x21b1('0x16'));var logger=require(_0x21b1('0x17'))(_0x21b1('0x18'));var utils=require('../../config/utils');var config=require(_0x21b1('0x19'));var db=require(_0x21b1('0x1a'))['db'];function respondWithStatusCode(_0x2b9bd2,_0x151d43){_0x151d43=_0x151d43||0xcc;return function(_0x18b50c){if(_0x18b50c){return _0x2b9bd2[_0x21b1('0x1b')](_0x151d43);}return _0x2b9bd2[_0x21b1('0x1c')](_0x151d43)[_0x21b1('0x1d')]();};}function respondWithResult(_0x4fc8e4,_0x381eef){_0x381eef=_0x381eef||0xc8;return function(_0x40ac0a){if(_0x40ac0a){return _0x4fc8e4[_0x21b1('0x1c')](_0x381eef)[_0x21b1('0x1e')](_0x40ac0a);}};}function respondWithFilteredResult(_0x277258,_0x5e1d04){return function(_0x364979){if(_0x364979){var _0x46a38e=_0x364979['count'],_0x5780dd=_0x5e1d04[_0x21b1('0x1f')],_0x32071d=_0x5e1d04['offset']+_0x5e1d04[_0x21b1('0x20')],_0x4da593;if(_0x32071d>=_0x46a38e){_0x32071d=_0x46a38e;_0x4da593=0xc8;}else{_0x4da593=0xce;}_0x277258[_0x21b1('0x1c')](_0x4da593);return _0x277258['set'](_0x21b1('0x21'),_0x5780dd+'-'+_0x32071d+'/'+_0x46a38e)[_0x21b1('0x1e')](_0x364979);}return null;};}function patchUpdates(_0x4f23ab){return function(_0xad99ed){try{jsonpatch[_0x21b1('0x22')](_0xad99ed,_0x4f23ab,!![]);}catch(_0x20c3cc){return BPromise[_0x21b1('0x23')](_0x20c3cc);}return _0xad99ed[_0x21b1('0x24')]();};}function saveUpdates(_0x31e224,_0x564be2){return function(_0x1ee34b){if(_0x1ee34b){return _0x1ee34b['update'](_0x31e224)[_0x21b1('0x25')](function(_0x59c1a6){return _0x59c1a6;});}return null;};}function removeEntity(_0x25db2b,_0x5c3174){return function(_0x5e1234){if(_0x5e1234){return _0x5e1234[_0x21b1('0x26')]()[_0x21b1('0x25')](function(){_0x25db2b[_0x21b1('0x1c')](0xcc)[_0x21b1('0x1d')]();});}};}function handleEntityNotFound(_0x317d64,_0x1c6486){return function(_0x3059f4){if(!_0x3059f4){_0x317d64[_0x21b1('0x1b')](0x194);}return _0x3059f4;};}function handleError(_0xaa460d,_0x3f86df){_0x3f86df=_0x3f86df||0x1f4;return function(_0x5337d1){logger['error'](_0x5337d1[_0x21b1('0x27')]);if(_0x5337d1['name']){delete _0x5337d1[_0x21b1('0x28')];}_0xaa460d[_0x21b1('0x1c')](_0x3f86df)['send'](_0x5337d1);};}exports[_0x21b1('0x29')]=function(_0x3e13e4,_0x21f67e){var _0x5b9e22={},_0x3c252d={},_0x172c9={'count':0x0,'rows':[]};var _0x2d7271=_[_0x21b1('0x2a')](db[_0x21b1('0x2b')][_0x21b1('0x2c')],function(_0x133349){return{'name':_0x133349['fieldName'],'type':_0x133349[_0x21b1('0x2d')]['key']};});_0x3c252d[_0x21b1('0x2e')]=_[_0x21b1('0x2f')](_[_0x21b1('0x2a')](_0x2d7271,'name'),[_0x21b1('0x30')]);_0x3c252d[_0x21b1('0x31')]=_['keys'](_0x3e13e4['query']);_0x3c252d[_0x21b1('0x32')]=_['intersection'](_0x3c252d[_0x21b1('0x2e')],_0x3c252d['query']);_0x5b9e22[_0x21b1('0x33')]=_[_0x21b1('0x34')](_0x3c252d[_0x21b1('0x2e')],qs[_0x21b1('0x35')](_0x3e13e4[_0x21b1('0x31')][_0x21b1('0x35')]));_0x5b9e22[_0x21b1('0x33')]=_0x5b9e22[_0x21b1('0x33')][_0x21b1('0x36')]?_0x5b9e22[_0x21b1('0x33')]:_0x3c252d[_0x21b1('0x2e')];if(!_0x3e13e4['query']['hasOwnProperty'](_0x21b1('0x37'))){_0x5b9e22['limit']=qs[_0x21b1('0x20')](_0x3e13e4[_0x21b1('0x31')][_0x21b1('0x20')]);_0x5b9e22[_0x21b1('0x1f')]=qs['offset'](_0x3e13e4[_0x21b1('0x31')]['offset']);}_0x5b9e22[_0x21b1('0x38')]=qs[_0x21b1('0x39')](_0x3e13e4['query']['sort']);_0x5b9e22['where']=qs['filters'](_[_0x21b1('0x3a')](_0x3e13e4['query'],_0x3c252d[_0x21b1('0x32')]),_0x2d7271);if(_0x3e13e4['query'][_0x21b1('0x3b')]){_0x5b9e22[_0x21b1('0x3c')]=_[_0x21b1('0x3d')](_0x5b9e22['where'],{'$or':_[_0x21b1('0x2a')](_0x2d7271,function(_0x244aa1){if(_0x244aa1[_0x21b1('0x2d')]!==_0x21b1('0x3e')){var _0x4f28b3={};_0x4f28b3[_0x244aa1['name']]={'$like':'%'+_0x3e13e4[_0x21b1('0x31')][_0x21b1('0x3b')]+'%'};return _0x4f28b3;}})});}_0x5b9e22=_[_0x21b1('0x3d')]({},_0x5b9e22,_0x3e13e4[_0x21b1('0x3f')]);var _0x6fd7d4={'where':_0x5b9e22[_0x21b1('0x3c')]};return db[_0x21b1('0x2b')][_0x21b1('0x40')](_0x6fd7d4)['then'](function(_0xadee76){_0x172c9[_0x21b1('0x40')]=_0xadee76;if(_0x3e13e4[_0x21b1('0x31')][_0x21b1('0x41')]){_0x5b9e22[_0x21b1('0x42')]=[{'all':!![]}];}return db[_0x21b1('0x2b')][_0x21b1('0x43')](_0x5b9e22);})[_0x21b1('0x25')](function(_0x1afd34){_0x172c9['rows']=_0x1afd34;return _0x172c9;})[_0x21b1('0x25')](respondWithFilteredResult(_0x21f67e,_0x5b9e22))['catch'](handleError(_0x21f67e,null));};exports[_0x21b1('0x44')]=function(_0x6a9e53,_0x246443){var _0x5905db={'raw':![],'where':{'id':_0x6a9e53[_0x21b1('0x45')]['id']}},_0x2ed78f={};_0x2ed78f['model']=_[_0x21b1('0x46')](db['ScreenRecording'][_0x21b1('0x2c')]);_0x2ed78f[_0x21b1('0x31')]=_[_0x21b1('0x46')](_0x6a9e53[_0x21b1('0x31')]);_0x2ed78f['filters']=_['intersection'](_0x2ed78f[_0x21b1('0x2e')],_0x2ed78f['query']);_0x5905db[_0x21b1('0x33')]=_[_0x21b1('0x34')](_0x2ed78f[_0x21b1('0x2e')],qs[_0x21b1('0x35')](_0x6a9e53['query'][_0x21b1('0x35')]));_0x5905db[_0x21b1('0x33')]=_0x5905db['attributes'][_0x21b1('0x36')]?_0x5905db['attributes']:_0x2ed78f[_0x21b1('0x2e')];if(_0x6a9e53[_0x21b1('0x31')][_0x21b1('0x41')]){_0x5905db[_0x21b1('0x42')]=[{'all':!![]}];}_0x5905db=_['merge']({},_0x5905db,_0x6a9e53[_0x21b1('0x3f')]);return db[_0x21b1('0x2b')][_0x21b1('0x47')](_0x5905db)[_0x21b1('0x25')](handleEntityNotFound(_0x246443,null))[_0x21b1('0x25')](respondWithResult(_0x246443,null))['catch'](handleError(_0x246443,null));};exports[_0x21b1('0x48')]=function(_0x36f6c5,_0x110032){return db[_0x21b1('0x2b')][_0x21b1('0x48')](_0x36f6c5['body'],{})[_0x21b1('0x25')](respondWithResult(_0x110032,0xc9))['catch'](handleError(_0x110032,null));};exports[_0x21b1('0x49')]=function(_0x4dfd80,_0x28f28c){if(_0x4dfd80[_0x21b1('0x4a')]['id']){delete _0x4dfd80[_0x21b1('0x4a')]['id'];}delete _0x4dfd80['body']['duration'];delete _0x4dfd80[_0x21b1('0x4a')][_0x21b1('0x4b')];delete _0x4dfd80[_0x21b1('0x4a')][_0x21b1('0x4c')];delete _0x4dfd80[_0x21b1('0x4a')][_0x21b1('0x4d')];return db['ScreenRecording'][_0x21b1('0x47')]({'where':{'id':_0x4dfd80[_0x21b1('0x45')]['id']}})['then'](handleEntityNotFound(_0x28f28c,null))[_0x21b1('0x25')](saveUpdates(_0x4dfd80[_0x21b1('0x4a')],null))[_0x21b1('0x25')](respondWithResult(_0x28f28c,null))[_0x21b1('0x4e')](handleError(_0x28f28c,null));};exports[_0x21b1('0x4f')]=function(_0x5ec93b,_0x4d64d9){return db[_0x21b1('0x2b')][_0x21b1('0x4f')]()['then'](respondWithResult(_0x4d64d9,null))['catch'](handleError(_0x4d64d9,null));};exports[_0x21b1('0x50')]=function(_0x258d07,_0x5e67e2,_0x36313c){var _0x5c1afc=require('../../components/encryptor');var _0x3e6a34=![];var _0xe70114={};if(_0x258d07[_0x21b1('0x31')]['type']&&_0x258d07[_0x21b1('0x31')][_0x21b1('0x2d')]===_0x21b1('0x51')){_0xe70114['uniqueid']=_0x258d07[_0x21b1('0x45')]['id'];}else{_0xe70114['id']=_0x258d07[_0x21b1('0x45')]['id'];}return db[_0x21b1('0x2b')][_0x21b1('0x47')]({'where':_0xe70114,'attributes':['id',_0x21b1('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x5e67e2,null))[_0x21b1('0x25')](function(_0x15cb60){if(_0x15cb60){var _0x3d5ab5=path[_0x21b1('0x52')](config[_0x21b1('0x53')],_0x21b1('0x54'),_0x15cb60[_0x21b1('0x4d')]);var _0xaf384f=util[_0x21b1('0x30')](_0x21b1('0x55'),_0x3d5ab5);if(fs[_0x21b1('0x56')](_0xaf384f)){_0x3e6a34=!![];return _0x5c1afc['decryptFile'](_0xaf384f,_0x3d5ab5,config[_0x21b1('0x57')][_0x21b1('0x58')])[_0x21b1('0x25')](function(){return _0x15cb60;});}return _0x15cb60;}})[_0x21b1('0x25')](function(_0x113810){if(_0x113810){var _0x4a2c50=path[_0x21b1('0x52')](config[_0x21b1('0x53')],_0x21b1('0x54'),_0x113810[_0x21b1('0x4d')]);if(!fs['existsSync'](_0x4a2c50)){throw new db[(_0x21b1('0x59'))][(_0x21b1('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x113810[_0x21b1('0x5b')]){return _0x5e67e2[_0x21b1('0x50')](_0x4a2c50,_0x113810[_0x21b1('0x5b')]+path[_0x21b1('0x5c')](_0x4a2c50),function(){if(_0x3e6a34){fs[_0x21b1('0x5d')](_0x4a2c50);}});}else{return _0x5e67e2[_0x21b1('0x50')](_0x4a2c50,function(_0x5c24e9){if(_0x3e6a34){fs[_0x21b1('0x5d')](_0x4a2c50);}});}}})[_0x21b1('0x4e')](function(_0x275ff0){if(_0x275ff0[_0x21b1('0x5e')]===_0x21b1('0x5f')){_0x5e67e2[_0x21b1('0x1c')](0x194)[_0x21b1('0x60')](_0x21b1('0x61'));}else{return handleError(_0x5e67e2,null);}});};exports['destroy']=function(_0x327deb,_0x49eaf5){return db[_0x21b1('0x2b')][_0x21b1('0x47')]({'where':{'id':_0x327deb[_0x21b1('0x45')]['id']}})[_0x21b1('0x25')](function(_0x5ac43c){if(!_0x5ac43c)throw new ReferenceError(_0x21b1('0x62'));return _0x5ac43c;})[_0x21b1('0x25')](function(_0x52d7c3){var _0x5db40f=path[_0x21b1('0x52')](config[_0x21b1('0x53')],_0x21b1('0x54'),_0x52d7c3[_0x21b1('0x4d')]);logger[_0x21b1('0x63')](_0x21b1('0x64'),_0x5db40f);if(!_['isNil'](_0x52d7c3[_0x21b1('0x4d')])&&fs[_0x21b1('0x56')](_0x5db40f)){logger[_0x21b1('0x63')](_0x21b1('0x65')+_0x5db40f+_0x21b1('0x66'));fs[_0x21b1('0x67')](_0x5db40f);}_0x5db40f=_0x5db40f+'.cypher';if(!_[_0x21b1('0x68')](_0x52d7c3[_0x21b1('0x4d')])&&fs[_0x21b1('0x56')](_0x5db40f)){logger[_0x21b1('0x63')]('File:\x20\x22'+_0x5db40f+_0x21b1('0x66'));fs[_0x21b1('0x67')](_0x5db40f);}return _0x52d7c3;})['then'](function(_0x487edf){if(!_0x487edf)throw new InternalError();return _0x487edf[_0x21b1('0x26')]();})[_0x21b1('0x25')](function(){_0x49eaf5[_0x21b1('0x1c')](0xcc)[_0x21b1('0x1d')]();})[_0x21b1('0x4e')](handleError(_0x49eaf5,null));}; \ No newline at end of file +var _0xddf6=['keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','duration','createdAt','params','describe','download','../../components/encryptor','type','uniqueid','root','server/files/screen_recordings','value','format','existsSync','decryptFile','secrets','recording','join','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','send','Not\x20found','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','destroy','then','error','name','index','map','ScreenRecording','rawAttributes','fieldName','key','model','differenceBy','query'];(function(_0xce26e0,_0x1f96ca){var _0x3fd222=function(_0x30e954){while(--_0x30e954){_0xce26e0['push'](_0xce26e0['shift']());}};_0x3fd222(++_0x1f96ca);}(_0xddf6,0xf7));var _0x6ddf=function(_0x29934d,_0xcdc14){_0x29934d=_0x29934d-0x0;var _0x184539=_0xddf6[_0x29934d];return _0x184539;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6ddf('0x0'));var rimraf=require(_0x6ddf('0x1'));var zipdir=require(_0x6ddf('0x2'));var jsonpatch=require(_0x6ddf('0x3'));var rp=require(_0x6ddf('0x4'));var moment=require(_0x6ddf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6ddf('0x6'));var sox=require('sox');var csv=require(_0x6ddf('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6ddf('0x8'));var squel=require(_0x6ddf('0x9'));var crypto=require('crypto');var jsforce=require(_0x6ddf('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6ddf('0xb'));var Redis=require(_0x6ddf('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6ddf('0xd'));var as=require(_0x6ddf('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6ddf('0xf'));var utils=require(_0x6ddf('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x308472,_0x53cca5){_0x53cca5=_0x53cca5||0xcc;return function(_0x2a272e){if(_0x2a272e){return _0x308472[_0x6ddf('0x11')](_0x53cca5);}return _0x308472[_0x6ddf('0x12')](_0x53cca5)[_0x6ddf('0x13')]();};}function respondWithResult(_0x19d697,_0x4085a3){_0x4085a3=_0x4085a3||0xc8;return function(_0x877eca){if(_0x877eca){return _0x19d697[_0x6ddf('0x12')](_0x4085a3)['json'](_0x877eca);}};}function respondWithFilteredResult(_0x4e0d51,_0x257aab){return function(_0x3652e8){if(_0x3652e8){var _0x55d97c=_0x3652e8[_0x6ddf('0x14')],_0x5bad01=_0x257aab[_0x6ddf('0x15')],_0x475cbb=_0x257aab['offset']+_0x257aab[_0x6ddf('0x16')],_0x4bbe9b;if(_0x475cbb>=_0x55d97c){_0x475cbb=_0x55d97c;_0x4bbe9b=0xc8;}else{_0x4bbe9b=0xce;}_0x4e0d51[_0x6ddf('0x12')](_0x4bbe9b);return _0x4e0d51[_0x6ddf('0x17')](_0x6ddf('0x18'),_0x5bad01+'-'+_0x475cbb+'/'+_0x55d97c)[_0x6ddf('0x19')](_0x3652e8);}return null;};}function patchUpdates(_0x356383){return function(_0x19031f){try{jsonpatch[_0x6ddf('0x1a')](_0x19031f,_0x356383,!![]);}catch(_0x2b0b82){return BPromise[_0x6ddf('0x1b')](_0x2b0b82);}return _0x19031f['save']();};}function saveUpdates(_0x3f8c9a,_0x190fb9){return function(_0x3570f3){if(_0x3570f3){return _0x3570f3['update'](_0x3f8c9a)['then'](function(_0x45b844){return _0x45b844;});}return null;};}function removeEntity(_0x920ba4,_0x3717d7){return function(_0x3ebb9c){if(_0x3ebb9c){return _0x3ebb9c[_0x6ddf('0x1c')]()[_0x6ddf('0x1d')](function(){_0x920ba4[_0x6ddf('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x478bd9,_0x4897ba){return function(_0x12ffaa){if(!_0x12ffaa){_0x478bd9[_0x6ddf('0x11')](0x194);}return _0x12ffaa;};}function handleError(_0xd60db6,_0x412c4b){_0x412c4b=_0x412c4b||0x1f4;return function(_0x4bd7f8){logger[_0x6ddf('0x1e')](_0x4bd7f8['stack']);if(_0x4bd7f8[_0x6ddf('0x1f')]){delete _0x4bd7f8[_0x6ddf('0x1f')];}_0xd60db6[_0x6ddf('0x12')](_0x412c4b)['send'](_0x4bd7f8);};}exports[_0x6ddf('0x20')]=function(_0x530652,_0x3c2de9){var _0x48146a={},_0x3064b7={},_0x41a54f={'count':0x0,'rows':[]};var _0x1fc093=_[_0x6ddf('0x21')](db[_0x6ddf('0x22')][_0x6ddf('0x23')],function(_0x5a238b){return{'name':_0x5a238b[_0x6ddf('0x24')],'type':_0x5a238b['type'][_0x6ddf('0x25')]};});_0x3064b7[_0x6ddf('0x26')]=_[_0x6ddf('0x27')](_[_0x6ddf('0x21')](_0x1fc093,_0x6ddf('0x1f')),['format']);_0x3064b7[_0x6ddf('0x28')]=_[_0x6ddf('0x29')](_0x530652[_0x6ddf('0x28')]);_0x3064b7[_0x6ddf('0x2a')]=_[_0x6ddf('0x2b')](_0x3064b7[_0x6ddf('0x26')],_0x3064b7[_0x6ddf('0x28')]);_0x48146a[_0x6ddf('0x2c')]=_[_0x6ddf('0x2b')](_0x3064b7['model'],qs['fields'](_0x530652['query'][_0x6ddf('0x2d')]));_0x48146a[_0x6ddf('0x2c')]=_0x48146a[_0x6ddf('0x2c')][_0x6ddf('0x2e')]?_0x48146a['attributes']:_0x3064b7['model'];if(!_0x530652[_0x6ddf('0x28')]['hasOwnProperty'](_0x6ddf('0x2f'))){_0x48146a[_0x6ddf('0x16')]=qs[_0x6ddf('0x16')](_0x530652[_0x6ddf('0x28')]['limit']);_0x48146a[_0x6ddf('0x15')]=qs[_0x6ddf('0x15')](_0x530652['query'][_0x6ddf('0x15')]);}_0x48146a['order']=qs['sort'](_0x530652[_0x6ddf('0x28')][_0x6ddf('0x30')]);_0x48146a[_0x6ddf('0x31')]=qs[_0x6ddf('0x2a')](_[_0x6ddf('0x32')](_0x530652[_0x6ddf('0x28')],_0x3064b7[_0x6ddf('0x2a')]),_0x1fc093);if(_0x530652[_0x6ddf('0x28')][_0x6ddf('0x33')]){_0x48146a[_0x6ddf('0x31')]=_[_0x6ddf('0x34')](_0x48146a[_0x6ddf('0x31')],{'$or':_[_0x6ddf('0x21')](_0x1fc093,function(_0x4c618c){if(_0x4c618c['type']!=='VIRTUAL'){var _0x3ee674={};_0x3ee674[_0x4c618c['name']]={'$like':'%'+_0x530652[_0x6ddf('0x28')][_0x6ddf('0x33')]+'%'};return _0x3ee674;}})});}_0x48146a=_[_0x6ddf('0x34')]({},_0x48146a,_0x530652['options']);var _0x2153af={'where':_0x48146a[_0x6ddf('0x31')]};return db['ScreenRecording'][_0x6ddf('0x14')](_0x2153af)[_0x6ddf('0x1d')](function(_0x3a8065){_0x41a54f[_0x6ddf('0x14')]=_0x3a8065;if(_0x530652[_0x6ddf('0x28')][_0x6ddf('0x35')]){_0x48146a[_0x6ddf('0x36')]=[{'all':!![]}];}return db[_0x6ddf('0x22')][_0x6ddf('0x37')](_0x48146a);})['then'](function(_0x46d8e2){_0x41a54f[_0x6ddf('0x38')]=_0x46d8e2;return _0x41a54f;})[_0x6ddf('0x1d')](respondWithFilteredResult(_0x3c2de9,_0x48146a))[_0x6ddf('0x39')](handleError(_0x3c2de9,null));};exports[_0x6ddf('0x3a')]=function(_0x52c14c,_0x42b549){var _0x1aee6c={'raw':![],'where':{'id':_0x52c14c['params']['id']}},_0x212fa9={};_0x212fa9[_0x6ddf('0x26')]=_[_0x6ddf('0x29')](db[_0x6ddf('0x22')][_0x6ddf('0x23')]);_0x212fa9[_0x6ddf('0x28')]=_[_0x6ddf('0x29')](_0x52c14c[_0x6ddf('0x28')]);_0x212fa9['filters']=_[_0x6ddf('0x2b')](_0x212fa9[_0x6ddf('0x26')],_0x212fa9[_0x6ddf('0x28')]);_0x1aee6c['attributes']=_[_0x6ddf('0x2b')](_0x212fa9[_0x6ddf('0x26')],qs[_0x6ddf('0x2d')](_0x52c14c[_0x6ddf('0x28')]['fields']));_0x1aee6c['attributes']=_0x1aee6c[_0x6ddf('0x2c')][_0x6ddf('0x2e')]?_0x1aee6c[_0x6ddf('0x2c')]:_0x212fa9[_0x6ddf('0x26')];if(_0x52c14c[_0x6ddf('0x28')][_0x6ddf('0x35')]){_0x1aee6c[_0x6ddf('0x36')]=[{'all':!![]}];}_0x1aee6c=_[_0x6ddf('0x34')]({},_0x1aee6c,_0x52c14c[_0x6ddf('0x3b')]);return db[_0x6ddf('0x22')][_0x6ddf('0x3c')](_0x1aee6c)[_0x6ddf('0x1d')](handleEntityNotFound(_0x42b549,null))[_0x6ddf('0x1d')](respondWithResult(_0x42b549,null))['catch'](handleError(_0x42b549,null));};exports[_0x6ddf('0x3d')]=function(_0x18ef05,_0x1aaeb9){return db[_0x6ddf('0x22')][_0x6ddf('0x3d')](_0x18ef05[_0x6ddf('0x3e')],{})[_0x6ddf('0x1d')](respondWithResult(_0x1aaeb9,0xc9))[_0x6ddf('0x39')](handleError(_0x1aaeb9,null));};exports[_0x6ddf('0x3f')]=function(_0x588185,_0x462846){if(_0x588185['body']['id']){delete _0x588185[_0x6ddf('0x3e')]['id'];}delete _0x588185[_0x6ddf('0x3e')][_0x6ddf('0x40')];delete _0x588185[_0x6ddf('0x3e')][_0x6ddf('0x41')];delete _0x588185[_0x6ddf('0x3e')]['closedAt'];delete _0x588185[_0x6ddf('0x3e')]['value'];return db[_0x6ddf('0x22')]['find']({'where':{'id':_0x588185[_0x6ddf('0x42')]['id']}})['then'](handleEntityNotFound(_0x462846,null))[_0x6ddf('0x1d')](saveUpdates(_0x588185[_0x6ddf('0x3e')],null))[_0x6ddf('0x1d')](respondWithResult(_0x462846,null))[_0x6ddf('0x39')](handleError(_0x462846,null));};exports[_0x6ddf('0x43')]=function(_0x298f36,_0x3f34ef){return db['ScreenRecording'][_0x6ddf('0x43')]()[_0x6ddf('0x1d')](respondWithResult(_0x3f34ef,null))[_0x6ddf('0x39')](handleError(_0x3f34ef,null));};exports[_0x6ddf('0x44')]=function(_0x2fe2fe,_0x3b6309,_0x1af1c4){var _0x536d4d=require(_0x6ddf('0x45'));var _0x3fe62f=![];var _0x245d33={};if(_0x2fe2fe[_0x6ddf('0x28')]['type']&&_0x2fe2fe[_0x6ddf('0x28')][_0x6ddf('0x46')]==='uniqueid'){_0x245d33[_0x6ddf('0x47')]=_0x2fe2fe['params']['id'];}else{_0x245d33['id']=_0x2fe2fe[_0x6ddf('0x42')]['id'];}return db[_0x6ddf('0x22')][_0x6ddf('0x3c')]({'where':_0x245d33,'attributes':['id','value'],'raw':!![]})[_0x6ddf('0x1d')](handleEntityNotFound(_0x3b6309,null))[_0x6ddf('0x1d')](function(_0x3d511b){if(_0x3d511b){var _0xaea7c=path['join'](config[_0x6ddf('0x48')],_0x6ddf('0x49'),_0x3d511b[_0x6ddf('0x4a')]);var _0x34e6f8=util[_0x6ddf('0x4b')]('%s.cypher',_0xaea7c);if(fs[_0x6ddf('0x4c')](_0x34e6f8)){_0x3fe62f=!![];return _0x536d4d[_0x6ddf('0x4d')](_0x34e6f8,_0xaea7c,config[_0x6ddf('0x4e')][_0x6ddf('0x4f')])[_0x6ddf('0x1d')](function(){return _0x3d511b;});}return _0x3d511b;}})[_0x6ddf('0x1d')](function(_0x559025){if(_0x559025){var _0x54b258=path[_0x6ddf('0x50')](config[_0x6ddf('0x48')],_0x6ddf('0x49'),_0x559025[_0x6ddf('0x4a')]);if(!fs['existsSync'](_0x54b258)){throw new db['Sequelize'][(_0x6ddf('0x51'))]('ScreenRecording\x20not\x20found');}if(_0x559025[_0x6ddf('0x52')]){return _0x3b6309[_0x6ddf('0x44')](_0x54b258,_0x559025[_0x6ddf('0x52')]+path[_0x6ddf('0x53')](_0x54b258),function(){if(_0x3fe62f){fs['unlink'](_0x54b258);}});}else{return _0x3b6309[_0x6ddf('0x44')](_0x54b258,function(_0x277bbd){if(_0x3fe62f){fs[_0x6ddf('0x54')](_0x54b258);}});}}})[_0x6ddf('0x39')](function(_0x187b07){if(_0x187b07[_0x6ddf('0x55')]===_0x6ddf('0x56')){_0x3b6309[_0x6ddf('0x12')](0x194)[_0x6ddf('0x57')](_0x6ddf('0x58'));}else{return handleError(_0x3b6309,null);}});};exports[_0x6ddf('0x1c')]=function(_0x2e545f,_0x53a00a){return db[_0x6ddf('0x22')][_0x6ddf('0x3c')]({'where':{'id':_0x2e545f[_0x6ddf('0x42')]['id']}})['then'](function(_0x2e16f){if(!_0x2e16f)throw new ReferenceError(_0x6ddf('0x59'));return _0x2e16f;})['then'](function(_0x3fb4d2){var _0x19f69c=path[_0x6ddf('0x50')](config[_0x6ddf('0x48')],_0x6ddf('0x49'),_0x3fb4d2[_0x6ddf('0x4a')]);logger[_0x6ddf('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x19f69c);if(!_[_0x6ddf('0x5b')](_0x3fb4d2['value'])&&fs[_0x6ddf('0x4c')](_0x19f69c)){logger['info']('File:\x20\x22'+_0x19f69c+_0x6ddf('0x5c'));fs[_0x6ddf('0x5d')](_0x19f69c);}_0x19f69c=_0x19f69c+_0x6ddf('0x5e');if(!_[_0x6ddf('0x5b')](_0x3fb4d2[_0x6ddf('0x4a')])&&fs[_0x6ddf('0x4c')](_0x19f69c)){logger['info'](_0x6ddf('0x5f')+_0x19f69c+_0x6ddf('0x5c'));fs[_0x6ddf('0x5d')](_0x19f69c);}return _0x3fb4d2;})[_0x6ddf('0x1d')](function(_0x488c98){if(!_0x488c98)throw new InternalError();return _0x488c98[_0x6ddf('0x1c')]();})[_0x6ddf('0x1d')](function(){_0x53a00a[_0x6ddf('0x12')](0xcc)[_0x6ddf('0x13')]();})[_0x6ddf('0x39')](handleError(_0x53a00a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 4ca8bbf..c2c520b 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 _0x312f=['../../config/logger','api','moment','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x49e0e5,_0x1f1f6b){var _0x249c90=function(_0x2851ea){while(--_0x2851ea){_0x49e0e5['push'](_0x49e0e5['shift']());}};_0x249c90(++_0x1f1f6b);}(_0x312f,0x1ab));var _0xf312=function(_0x102b3c,_0xbdb3f9){_0x102b3c=_0x102b3c-0x0;var _0x5590cf=_0x312f[_0x102b3c];return _0x5590cf;};'use strict';var _=require(_0xf312('0x0'));var util=require(_0xf312('0x1'));var logger=require(_0xf312('0x2'))(_0xf312('0x3'));var moment=require(_0xf312('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf312('0x5'));var rimraf=require('rimraf');var config=require(_0xf312('0x6'));var attributes=require(_0xf312('0x7'));module[_0xf312('0x8')]=function(_0x389196,_0x16fc8f){return _0x389196[_0xf312('0x9')](_0xf312('0xa'),attributes,{'tableName':_0xf312('0xb'),'paranoid':![],'indexes':[{'name':_0xf312('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9443=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid'];(function(_0x4ff0e4,_0x3e0f9f){var _0x18a93d=function(_0x4f98e8){while(--_0x4f98e8){_0x4ff0e4['push'](_0x4ff0e4['shift']());}};_0x18a93d(++_0x3e0f9f);}(_0x9443,0xc3));var _0x3944=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9443[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x3944('0x0'));var util=require(_0x3944('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3944('0x2'));var BPromise=require(_0x3944('0x3'));var rp=require(_0x3944('0x4'));var fs=require('fs');var path=require(_0x3944('0x5'));var rimraf=require(_0x3944('0x6'));var config=require(_0x3944('0x7'));var attributes=require(_0x3944('0x8'));module[_0x3944('0x9')]=function(_0x4d2f71,_0x14d2ee){return _0x4d2f71[_0x3944('0xa')]('ScreenRecording',attributes,{'tableName':_0x3944('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x3944('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 092adf7..013e22b 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(_0xc93818,_0xd7f145){var _0x3c6999=function(_0x3bd7ea){while(--_0x3bd7ea){_0xc93818['push'](_0xc93818['shift']());}};_0x3c6999(++_0xd7f145);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x254d41,_0x276339){var _0x122685=function(_0xea2799){while(--_0xea2799){_0x254d41['push'](_0x254d41['shift']());}};_0x122685(++_0x276339);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 da61296..f805549 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 _0x4c07=['/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','post','single','file','addLogo','logologin','originalname','addLogoLogin','%s%s','preferred','favicon','/:id/favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/:id','show','/:id/logo','getLogo'];(function(_0x51fe5e,_0x4fa23d){var _0xd4f5a9=function(_0x24e971){while(--_0x24e971){_0x51fe5e['push'](_0x51fe5e['shift']());}};_0xd4f5a9(++_0x4fa23d);}(_0x4c07,0xfd));var _0x74c0=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x4c07[_0x4defd6];return _0x4c9276;};'use strict';var multer=require(_0x74c0('0x0'));var util=require(_0x74c0('0x1'));var path=require(_0x74c0('0x2'));var timeout=require(_0x74c0('0x3'));var express=require(_0x74c0('0x4'));var router=express[_0x74c0('0x5')]();var auth=require(_0x74c0('0x6'));var interaction=require(_0x74c0('0x7'));var config=require(_0x74c0('0x8'));var controller=require(_0x74c0('0x9'));router['get']('/',auth[_0x74c0('0xa')](),controller[_0x74c0('0xb')]);router[_0x74c0('0xc')](_0x74c0('0xd'),controller[_0x74c0('0xe')]);router[_0x74c0('0xc')](_0x74c0('0xf'),controller[_0x74c0('0x10')]);router[_0x74c0('0xc')](_0x74c0('0x11'),controller[_0x74c0('0x12')]);router['get'](_0x74c0('0x13'),controller['gdpr']);router['get'](_0x74c0('0x14'),controller[_0x74c0('0x15')]);router[_0x74c0('0xc')]('/:id/favicon',controller[_0x74c0('0x16')]);var upload=multer({'storage':multer[_0x74c0('0x17')]({'destination':function(_0x4f9764,_0x4e0966,_0x3d92ba){_0x3d92ba(null,path[_0x74c0('0x18')](config[_0x74c0('0x19')],_0x74c0('0x1a')));},'filename':function(_0x2085d8,_0xa652a0,_0x282bf5){_0x282bf5(null,util[_0x74c0('0x1b')]('%s%s',_0x74c0('0x1c'),path[_0x74c0('0x1d')](_0xa652a0['originalname'])));}})});router[_0x74c0('0x1e')](_0x74c0('0xf'),upload[_0x74c0('0x1f')](_0x74c0('0x20')),controller[_0x74c0('0x21')]);var upload=multer({'storage':multer[_0x74c0('0x17')]({'destination':function(_0x56ed1f,_0x50ea65,_0x438921){_0x438921(null,path[_0x74c0('0x18')](config[_0x74c0('0x19')],_0x74c0('0x1a')));},'filename':function(_0x226579,_0x4c33d2,_0x5a2b31){_0x5a2b31(null,util[_0x74c0('0x1b')]('%s%s',_0x74c0('0x22'),path['extname'](_0x4c33d2[_0x74c0('0x23')])));}})});router['post'](_0x74c0('0x11'),upload['single'](_0x74c0('0x20')),controller[_0x74c0('0x24')]);var upload=multer({'storage':multer[_0x74c0('0x17')]({'destination':function(_0x2fa66a,_0x54a833,_0x1a6364){_0x1a6364(null,path[_0x74c0('0x18')](config[_0x74c0('0x19')],_0x74c0('0x1a')));},'filename':function(_0x440fa5,_0x2fb569,_0x5dd264){_0x5dd264(null,util['format'](_0x74c0('0x25'),_0x74c0('0x26'),path[_0x74c0('0x1d')](_0x2fb569[_0x74c0('0x23')])));}})});router[_0x74c0('0x1e')]('/:id/preferred',upload[_0x74c0('0x1f')](_0x74c0('0x20')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c4620,_0x7d50bc,_0x1e5d14){_0x1e5d14(null,path['join'](config[_0x74c0('0x19')],_0x74c0('0x1a')));},'filename':function(_0x4050a0,_0x4072c4,_0xfc1256){_0xfc1256(null,util['format'](_0x74c0('0x25'),_0x74c0('0x27'),path['extname'](_0x4072c4[_0x74c0('0x23')])));}})});router[_0x74c0('0x1e')](_0x74c0('0x28'),upload['single'](_0x74c0('0x20')),controller[_0x74c0('0x29')]);router[_0x74c0('0x2a')](_0x74c0('0xd'),auth[_0x74c0('0xa')](),controller[_0x74c0('0x2b')]);module[_0x74c0('0x2c')]=router; \ No newline at end of file +var _0xe16c=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/logo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','diskStorage','root','format','%s%s','logo','extname','post','single','addLogo','join','server/files/images/logos/','logologin','originalname','file','addLogoLogin','preferred','addPreferred','favicon','/:id/favicon','put','exports','multer','util','path','connect-timeout'];(function(_0x1f5171,_0x5dcc46){var _0x3bbaa0=function(_0x1ce899){while(--_0x1ce899){_0x1f5171['push'](_0x1f5171['shift']());}};_0x3bbaa0(++_0x5dcc46);}(_0xe16c,0x15b));var _0xce16=function(_0x5eecea,_0x6ac213){_0x5eecea=_0x5eecea-0x0;var _0x4669c3=_0xe16c[_0x5eecea];return _0x4669c3;};'use strict';var multer=require(_0xce16('0x0'));var util=require(_0xce16('0x1'));var path=require(_0xce16('0x2'));var timeout=require(_0xce16('0x3'));var express=require(_0xce16('0x4'));var router=express[_0xce16('0x5')]();var auth=require(_0xce16('0x6'));var interaction=require(_0xce16('0x7'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0xce16('0x8')]('/',auth[_0xce16('0x9')](),controller[_0xce16('0xa')]);router[_0xce16('0x8')](_0xce16('0xb'),controller['show']);router['get'](_0xce16('0xc'),controller['getLogo']);router['get'](_0xce16('0xd'),controller['getLogoLogin']);router[_0xce16('0x8')](_0xce16('0xe'),controller[_0xce16('0xf')]);router[_0xce16('0x8')](_0xce16('0x10'),controller[_0xce16('0x11')]);router[_0xce16('0x8')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0xce16('0x12')]({'destination':function(_0x52aaac,_0x461638,_0x82c1ad){_0x82c1ad(null,path['join'](config[_0xce16('0x13')],'server/files/images/logos/'));},'filename':function(_0x466ae,_0x311b15,_0x197fda){_0x197fda(null,util[_0xce16('0x14')](_0xce16('0x15'),_0xce16('0x16'),path[_0xce16('0x17')](_0x311b15['originalname'])));}})});router[_0xce16('0x18')](_0xce16('0xc'),upload[_0xce16('0x19')]('file'),controller[_0xce16('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x370009,_0x242fdb,_0x56d5e1){_0x56d5e1(null,path[_0xce16('0x1b')](config['root'],_0xce16('0x1c')));},'filename':function(_0x4dd8dc,_0x5b4dd4,_0x2e608b){_0x2e608b(null,util['format'](_0xce16('0x15'),_0xce16('0x1d'),path[_0xce16('0x17')](_0x5b4dd4[_0xce16('0x1e')])));}})});router[_0xce16('0x18')](_0xce16('0xd'),upload[_0xce16('0x19')](_0xce16('0x1f')),controller[_0xce16('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x159a8c,_0x42cbf6,_0x4c7c0e){_0x4c7c0e(null,path[_0xce16('0x1b')](config['root'],'server/files/images/logos/'));},'filename':function(_0x15d136,_0x45959a,_0x2dbe07){_0x2dbe07(null,util['format'](_0xce16('0x15'),_0xce16('0x21'),path[_0xce16('0x17')](_0x45959a[_0xce16('0x1e')])));}})});router[_0xce16('0x18')](_0xce16('0x10'),upload['single'](_0xce16('0x1f')),controller[_0xce16('0x22')]);var upload=multer({'storage':multer[_0xce16('0x12')]({'destination':function(_0x1bd781,_0x28d93d,_0x1283f7){_0x1283f7(null,path[_0xce16('0x1b')](config[_0xce16('0x13')],_0xce16('0x1c')));},'filename':function(_0x16f901,_0x2826ee,_0x5ac1a6){_0x5ac1a6(null,util[_0xce16('0x14')](_0xce16('0x15'),_0xce16('0x23'),path[_0xce16('0x17')](_0x2826ee[_0xce16('0x1e')])));}})});router[_0xce16('0x18')](_0xce16('0x24'),upload[_0xce16('0x19')]('file'),controller['addFavicon']);router[_0xce16('0x25')](_0xce16('0xb'),auth[_0xce16('0x9')](),controller['update']);module[_0xce16('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 5557819..adf2094 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 _0x3981=['exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize'];(function(_0x1e8842,_0x3f0d98){var _0x4be9f6=function(_0x3f9a21){while(--_0x3f9a21){_0x1e8842['push'](_0x1e8842['shift']());}};_0x4be9f6(++_0x3f0d98);}(_0x3981,0x19d));var _0x1398=function(_0x428f33,_0x3abba4){_0x428f33=_0x428f33-0x0;var _0x786c6b=_0x3981[_0x428f33];return _0x786c6b;};'use strict';var Sequelize=require(_0x1398('0x0'));module[_0x1398('0x1')]={'min_internal':{'type':Sequelize[_0x1398('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x1398('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1398('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1398('0x4')],'defaultValue':_0x1398('0x5')},'logo':{'type':Sequelize[_0x1398('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x1398('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1398('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1398('0x4')]},'turnaddr':{'type':Sequelize[_0x1398('0x4')]},'turnusername':{'type':Sequelize[_0x1398('0x4')]},'turnpassword':{'type':Sequelize[_0x1398('0x4')]},'pageTitle':{'type':Sequelize[_0x1398('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1398('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1398('0x4')],'defaultValue':_0x1398('0x7')},'enableEmailPreview':{'type':Sequelize[_0x1398('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x1398('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1398('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1398('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1398('0x4')],'defaultValue':_0x1398('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1398('0x4')]},'defaultPreferred':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1398('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x1398('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x1398('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1398('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1398('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x1398('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1398('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1398('0x2')]},'transcribeRegion':{'type':Sequelize[_0x1398('0x4')]},'sentiment':{'type':Sequelize[_0x1398('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x1398('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1398('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1398('0x4')]},'bucket':{'type':Sequelize[_0x1398('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x47e3=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','sequelize','exports','INTEGER','min_internal'];(function(_0x1c81f4,_0x190357){var _0x4a4053=function(_0x24c79b){while(--_0x24c79b){_0x1c81f4['push'](_0x1c81f4['shift']());}};_0x4a4053(++_0x190357);}(_0x47e3,0x144));var _0x347e=function(_0x86f56c,_0x539f3f){_0x86f56c=_0x86f56c-0x0;var _0x29fd8d=_0x47e3[_0x86f56c];return _0x29fd8d;};'use strict';var Sequelize=require(_0x347e('0x0'));module[_0x347e('0x1')]={'min_internal':{'type':Sequelize[_0x347e('0x2')](0xb),'unique':_0x347e('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x347e('0x2')](0xb),'unique':_0x347e('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x347e('0x5')],'defaultValue':_0x347e('0x6')},'logo':{'type':Sequelize[_0x347e('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x347e('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x347e('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x347e('0x5')]},'turnaddr':{'type':Sequelize[_0x347e('0x5')]},'turnusername':{'type':Sequelize[_0x347e('0x5')]},'turnpassword':{'type':Sequelize[_0x347e('0x5')]},'pageTitle':{'type':Sequelize[_0x347e('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x347e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x347e('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x347e('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x347e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x347e('0x5')]},'defaultPreferred':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x347e('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x347e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x347e('0x5')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x347e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x347e('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x347e('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x347e('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 1118214..6eceab4 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 _0x48b0=['request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','map','merge','options','Setting','count','includeAll','include','findAll','rows','show','params','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','default','upperFirst','custom','default_logo.svg','Sequelize','\x20not\x20found','download','getLogoLogin','server/files/images/logos','favicon','toLower','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../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~!@#$%^&-_=+[{]}.'];(function(_0x44f2b8,_0x25309b){var _0x2e0726=function(_0x2b925f){while(--_0x2b925f){_0x44f2b8['push'](_0x44f2b8['shift']());}};_0x2e0726(++_0x25309b);}(_0x48b0,0x1cc));var _0x048b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x48b0[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x048b('0x0'));var emlformat=require(_0x048b('0x1'));var rimraf=require(_0x048b('0x2'));var zipdir=require(_0x048b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x048b('0x4'));var BPromise=require(_0x048b('0x5'));var Mustache=require(_0x048b('0x6'));var util=require(_0x048b('0x7'));var path=require(_0x048b('0x8'));var sox=require(_0x048b('0x9'));var csv=require(_0x048b('0xa'));var ejs=require(_0x048b('0xb'));var fs=require('fs');var _=require(_0x048b('0xc'));var squel=require(_0x048b('0xd'));var crypto=require(_0x048b('0xe'));var jsforce=require(_0x048b('0xf'));var deskjs=require(_0x048b('0x10'));var toCsv=require(_0x048b('0xa'));var querystring=require(_0x048b('0x11'));var Papa=require(_0x048b('0x12'));var Redis=require(_0x048b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x048b('0x14'));var as=require(_0x048b('0x15'));var hardwareService=require(_0x048b('0x16'));var logger=require('../../config/logger')(_0x048b('0x17'));var utils=require('../../config/utils');var config=require(_0x048b('0x18'));var db=require(_0x048b('0x19'))['db'];var jayson=require(_0x048b('0x1a'));var client=jayson[_0x048b('0x1b')][_0x048b('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x9a12fb,_0x596f1a,_0x4a2036){if(_0x4a2036){var _0x2a3956=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a3956[_0x048b('0x1d')](_0x596f1a)){return _0x9a12fb;}else{throw new db['Sequelize'][(_0x048b('0x1e'))](_0x048b('0x1f'));}}else{return _0x9a12fb;}}function respondWithRpcPromise(_0x4701c2,_0x1d96f1,_0x3f5632,_0x5e724a){return new BPromise(function(_0x20989e,_0x3e02e0){var _0x45ef81=_0x5e724a||client;return _0x45ef81[_0x048b('0x20')](_0x4701c2,_0x3f5632)[_0x048b('0x21')](function(_0x44d54c){logger['info'](_0x048b('0x22'),_0x1d96f1,_0x048b('0x23'));logger[_0x048b('0x24')](_0x048b('0x25'),_0x1d96f1,_0x048b('0x23'),JSON[_0x048b('0x26')](_0x44d54c));if(_0x44d54c['error']){if(_0x44d54c[_0x048b('0x27')][_0x048b('0x28')]===0x1f4){logger[_0x048b('0x27')](_0x048b('0x22'),_0x1d96f1,_0x44d54c['error'][_0x048b('0x29')]);return _0x3e02e0(_0x44d54c[_0x048b('0x27')][_0x048b('0x29')]);}logger['error']('Setting,\x20%s,\x20%s',_0x1d96f1,_0x44d54c[_0x048b('0x27')]['message']);return _0x20989e(_0x44d54c['error']['message']);}else{logger[_0x048b('0x2a')](_0x048b('0x22'),_0x1d96f1,_0x048b('0x23'));_0x20989e(_0x44d54c[_0x048b('0x2b')][_0x048b('0x29')]);}})[_0x048b('0x2c')](function(_0x50a037){logger[_0x048b('0x27')]('Setting,\x20%s,\x20%s',_0x1d96f1,_0x50a037);_0x3e02e0(_0x50a037);});});}function respondWithStatusCode(_0x422bc8,_0x39115d){_0x39115d=_0x39115d||0xcc;return function(_0x57bfc7){if(_0x57bfc7){return _0x422bc8[_0x048b('0x2d')](_0x39115d);}return _0x422bc8['status'](_0x39115d)['end']();};}function respondWithResult(_0x205049,_0x56d0f5){_0x56d0f5=_0x56d0f5||0xc8;return function(_0x23ee32){if(_0x23ee32){return _0x205049[_0x048b('0x2e')](_0x56d0f5)[_0x048b('0x2f')](_0x23ee32);}};}function respondWithFilteredResult(_0x4b9654,_0x465022){return function(_0x4cf1d3){if(_0x4cf1d3){var _0x10ce0b=_0x4cf1d3['count'],_0x31f020=_0x465022[_0x048b('0x30')],_0x1f830f=_0x465022[_0x048b('0x30')]+_0x465022[_0x048b('0x31')],_0x34e143;if(_0x1f830f>=_0x10ce0b){_0x1f830f=_0x10ce0b;_0x34e143=0xc8;}else{_0x34e143=0xce;}_0x4b9654[_0x048b('0x2e')](_0x34e143);return _0x4b9654['set'](_0x048b('0x32'),_0x31f020+'-'+_0x1f830f+'/'+_0x10ce0b)[_0x048b('0x2f')](_0x4cf1d3);}return null;};}function patchUpdates(_0x5e7517){return function(_0x21c529){try{jsonpatch[_0x048b('0x33')](_0x21c529,_0x5e7517,!![]);}catch(_0x3c386d){return BPromise[_0x048b('0x34')](_0x3c386d);}return _0x21c529[_0x048b('0x35')]();};}function saveUpdates(_0x526c9f,_0x4cf887){return function(_0x1b975b){if(_0x1b975b){return _0x1b975b[_0x048b('0x36')](_0x526c9f)[_0x048b('0x21')](function(_0xfdd99e){return _0xfdd99e;});}return null;};}function removeEntity(_0x740b1d,_0x289f56){return function(_0x534833){if(_0x534833){return _0x534833[_0x048b('0x37')]()['then'](function(){_0x740b1d[_0x048b('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12ac4b,_0x4f17fa){return function(_0x188821){if(!_0x188821){_0x12ac4b[_0x048b('0x2d')](0x194);}return _0x188821;};}function handleError(_0x37f991,_0x1eba90){_0x1eba90=_0x1eba90||0x1f4;return function(_0x2d7074){logger[_0x048b('0x27')](_0x2d7074[_0x048b('0x38')]);if(_0x2d7074[_0x048b('0x39')]){delete _0x2d7074['name'];}_0x37f991[_0x048b('0x2e')](_0x1eba90)[_0x048b('0x3a')](_0x2d7074);};}exports['index']=function(_0x5dd465,_0x6564a5){var _0x4704f9={},_0x5790a7={},_0x3321eb={'count':0x0,'rows':[]};var _0x26d622=_['map'](db['Setting'][_0x048b('0x3b')],function(_0x13bac5){return{'name':_0x13bac5['fieldName'],'type':_0x13bac5[_0x048b('0x3c')][_0x048b('0x3d')]};});_0x5790a7[_0x048b('0x3e')]=_['map'](_0x26d622,_0x048b('0x39'));_0x5790a7[_0x048b('0x3f')]=_[_0x048b('0x40')](_0x5dd465[_0x048b('0x3f')]);_0x5790a7[_0x048b('0x41')]=_[_0x048b('0x42')](_0x5790a7['model'],_0x5790a7[_0x048b('0x3f')]);_0x4704f9[_0x048b('0x43')]=_[_0x048b('0x42')](_0x5790a7[_0x048b('0x3e')],qs[_0x048b('0x44')](_0x5dd465[_0x048b('0x3f')][_0x048b('0x44')]));_0x4704f9['attributes']=_0x4704f9['attributes'][_0x048b('0x45')]?_0x4704f9[_0x048b('0x43')]:_0x5790a7['model'];if(!_0x5dd465[_0x048b('0x3f')][_0x048b('0x46')]('nolimit')){_0x4704f9['limit']=qs[_0x048b('0x31')](_0x5dd465[_0x048b('0x3f')][_0x048b('0x31')]);_0x4704f9[_0x048b('0x30')]=qs['offset'](_0x5dd465['query'][_0x048b('0x30')]);}_0x4704f9['order']=qs[_0x048b('0x47')](_0x5dd465[_0x048b('0x3f')][_0x048b('0x47')]);_0x4704f9[_0x048b('0x48')]=qs['filters'](_[_0x048b('0x49')](_0x5dd465[_0x048b('0x3f')],_0x5790a7['filters']),_0x26d622);if(_0x5dd465[_0x048b('0x3f')][_0x048b('0x4a')]){_0x4704f9['where']=_['merge'](_0x4704f9[_0x048b('0x48')],{'$or':_[_0x048b('0x4b')](_0x26d622,function(_0x29f675){if(_0x29f675[_0x048b('0x3c')]!=='VIRTUAL'){var _0x24edce={};_0x24edce[_0x29f675[_0x048b('0x39')]]={'$like':'%'+_0x5dd465['query'][_0x048b('0x4a')]+'%'};return _0x24edce;}})});}_0x4704f9=_[_0x048b('0x4c')]({},_0x4704f9,_0x5dd465[_0x048b('0x4d')]);var _0x227904={'where':_0x4704f9[_0x048b('0x48')]};return db[_0x048b('0x4e')][_0x048b('0x4f')](_0x227904)[_0x048b('0x21')](function(_0x1ce394){_0x3321eb[_0x048b('0x4f')]=_0x1ce394;if(_0x5dd465['query'][_0x048b('0x50')]){_0x4704f9[_0x048b('0x51')]=[{'all':!![]}];}return db[_0x048b('0x4e')][_0x048b('0x52')](_0x4704f9);})[_0x048b('0x21')](function(_0x1a2801){_0x3321eb[_0x048b('0x53')]=_0x1a2801;return _0x3321eb;})[_0x048b('0x21')](respondWithFilteredResult(_0x6564a5,_0x4704f9))['catch'](handleError(_0x6564a5,null));};exports[_0x048b('0x54')]=function(_0x9aab1a,_0x3a5b47){var _0x1c29a6={'raw':![],'where':{'id':_0x9aab1a[_0x048b('0x55')]['id']}},_0x4f6504={};_0x4f6504[_0x048b('0x3e')]=_[_0x048b('0x40')](db[_0x048b('0x4e')][_0x048b('0x3b')]);_0x4f6504[_0x048b('0x3f')]=_[_0x048b('0x40')](_0x9aab1a[_0x048b('0x3f')]);_0x4f6504[_0x048b('0x41')]=_[_0x048b('0x42')](_0x4f6504[_0x048b('0x3e')],_0x4f6504['query']);_0x1c29a6[_0x048b('0x43')]=_[_0x048b('0x42')](_0x4f6504['model'],qs[_0x048b('0x44')](_0x9aab1a['query'][_0x048b('0x44')]));_0x1c29a6[_0x048b('0x43')]=_0x1c29a6[_0x048b('0x43')][_0x048b('0x45')]?_0x1c29a6[_0x048b('0x43')]:_0x4f6504[_0x048b('0x3e')];if(_0x9aab1a['query'][_0x048b('0x50')]){_0x1c29a6[_0x048b('0x51')]=[{'all':!![]}];}_0x1c29a6=_['merge']({},_0x1c29a6,_0x9aab1a[_0x048b('0x4d')]);return db['Setting'][_0x048b('0x56')](_0x1c29a6)['then'](handleEntityNotFound(_0x3a5b47,null))['then'](respondWithResult(_0x3a5b47,null))[_0x048b('0x2c')](handleError(_0x3a5b47,null));};exports[_0x048b('0x36')]=function(_0x158639,_0x3dd699){if(_0x158639['body']['id']){delete _0x158639[_0x048b('0x57')]['id'];}return db[_0x048b('0x4e')][_0x048b('0x56')]({'where':{'id':_0x158639[_0x048b('0x55')]['id']}})[_0x048b('0x21')](handleEntityNotFound(_0x3dd699,null))[_0x048b('0x21')](saveUpdates(_0x158639['body'],null))[_0x048b('0x21')](respondWithResult(_0x3dd699,null))[_0x048b('0x2c')](handleError(_0x3dd699,null));};exports[_0x048b('0x58')]=function(_0x39f8f6,_0x2e6f0c,_0x583c50){if(_0x39f8f6[_0x048b('0x59')]&&_0x39f8f6['file'][_0x048b('0x5a')]){_0x39f8f6[_0x048b('0x57')][_0x048b('0x5b')]=_0x39f8f6['file']['filename'];}return db['Setting'][_0x048b('0x56')]({'where':{'id':_0x39f8f6[_0x048b('0x55')]['id']}})[_0x048b('0x21')](handleEntityNotFound(_0x2e6f0c,null))['then'](saveUpdates(_0x39f8f6[_0x048b('0x57')],null))[_0x048b('0x21')](respondWithResult(_0x2e6f0c,null))[_0x048b('0x2c')](handleError(_0x2e6f0c,null));};exports[_0x048b('0x5c')]=function(_0x716046,_0x36c8dc,_0x3315c9){if(_0x716046[_0x048b('0x59')]&&_0x716046[_0x048b('0x59')][_0x048b('0x5a')]){_0x716046[_0x048b('0x57')][_0x048b('0x5d')]=_0x716046[_0x048b('0x59')][_0x048b('0x5a')];}return db[_0x048b('0x4e')][_0x048b('0x56')]({'where':{'id':_0x716046[_0x048b('0x55')]['id']}})[_0x048b('0x21')](handleEntityNotFound(_0x36c8dc,null))[_0x048b('0x21')](saveUpdates(_0x716046['body'],null))[_0x048b('0x21')](respondWithResult(_0x36c8dc,null))[_0x048b('0x2c')](handleError(_0x36c8dc,null));};var utilLicense=require(_0x048b('0x5e'));exports['getLogo']=function(_0xc0eb90,_0x4bcd06,_0x275d89){var _0x8b6e2d='server/files/images/logos';var _0x183b6c={'custom':![]};return utilLicense[_0x048b('0x5f')]()[_0x048b('0x21')](function(_0x5763bc){if(_0x5763bc){_0x183b6c=_0x5763bc;}return db[_0x048b('0x4e')][_0x048b('0x56')]({'where':{'id':_0xc0eb90[_0x048b('0x55')]['id']},'attributes':[_0x048b('0x5b'),_0x048b('0x5d'),_0x048b('0x60'),'favicon',_0x048b('0x61'),_0x048b('0x62'),_0x048b('0x63'),_0x048b('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x4bcd06,null))[_0x048b('0x21')](function(_0x4cae59){if(_0x4cae59){var _0x2ff223=_0x4cae59[_0x048b('0x5b')]&&fs[_0x048b('0x65')](path[_0x048b('0x66')](config['root'],_0x8b6e2d,_['toLower'](_0x4cae59[_0x048b('0x5b')])))?path[_0x048b('0x66')](config[_0x048b('0x67')],_0x8b6e2d,_['toLower'](_0x4cae59[_0x048b('0x5b')])):path['join'](config['root'],_0x8b6e2d,_['toLower']('default_logo.svg'));var _0x6357a3=_0x048b('0x68')+_[_0x048b('0x69')]('logo');if(_0x4cae59[_0x6357a3]||!_0x183b6c[_0x048b('0x6a')]){_0x2ff223=path[_0x048b('0x66')](config[_0x048b('0x67')],_0x8b6e2d,_['toLower'](_0x048b('0x6b')));}if(!fs[_0x048b('0x65')](_0x2ff223)){throw new db[(_0x048b('0x6c'))]['ValidationError'](_[_0x048b('0x69')](_0x048b('0x5b'))+_0x048b('0x6d'));}return _0x4bcd06[_0x048b('0x6e')](_0x2ff223);}})['catch'](handleError(_0x4bcd06,null));};var utilLicense=require(_0x048b('0x5e'));exports[_0x048b('0x6f')]=function(_0x575c90,_0x467094,_0x308766){var _0x7dbc8f=_0x048b('0x70');var _0x19e508={'custom':![]};return utilLicense[_0x048b('0x5f')]()[_0x048b('0x21')](function(_0x56582a){if(_0x56582a){_0x19e508=_0x56582a;}return db[_0x048b('0x4e')][_0x048b('0x56')]({'where':{'id':_0x575c90[_0x048b('0x55')]['id']},'attributes':[_0x048b('0x5b'),'loginLogo',_0x048b('0x60'),_0x048b('0x71'),_0x048b('0x61'),'defaultLoginLogo',_0x048b('0x63'),_0x048b('0x64')],'raw':!![]});})[_0x048b('0x21')](handleEntityNotFound(_0x467094,null))[_0x048b('0x21')](function(_0x20308d){if(_0x20308d){var _0xbece4f=_0x20308d[_0x048b('0x5d')]&&fs['existsSync'](path['join'](config[_0x048b('0x67')],_0x7dbc8f,_[_0x048b('0x72')](_0x20308d['loginLogo'])))?path['join'](config['root'],_0x7dbc8f,_[_0x048b('0x72')](_0x20308d[_0x048b('0x5d')])):path['join'](config[_0x048b('0x67')],_0x7dbc8f,_[_0x048b('0x72')](_0x048b('0x73')));var _0x4c2066=_0x048b('0x68')+_[_0x048b('0x69')](_0x048b('0x5d'));if(_0x20308d[_0x4c2066]||!_0x19e508['custom']){_0xbece4f=path['join'](config[_0x048b('0x67')],_0x7dbc8f,_[_0x048b('0x72')](_0x048b('0x73')));}if(!fs[_0x048b('0x65')](_0xbece4f)){throw new db[(_0x048b('0x6c'))][(_0x048b('0x1e'))](_[_0x048b('0x69')](_0x048b('0x5d'))+_0x048b('0x6d'));}return _0x467094[_0x048b('0x6e')](_0xbece4f);}})[_0x048b('0x2c')](handleError(_0x467094,null));};exports[_0x048b('0x74')]=function(_0x138488,_0x99f462){return db[_0x048b('0x4e')][_0x048b('0x56')]({'where':{'id':_0x138488[_0x048b('0x55')]['id']},'attributes':[_0x048b('0x75')]})[_0x048b('0x21')](respondWithResult(_0x99f462,null))[_0x048b('0x2c')](handleError(_0x99f462,null));};exports[_0x048b('0x76')]=function(_0xff09c8,_0x23c3ac,_0x25f1d2){if(_0xff09c8[_0x048b('0x59')]&&_0xff09c8[_0x048b('0x59')][_0x048b('0x5a')]){_0xff09c8[_0x048b('0x57')][_0x048b('0x60')]=_0xff09c8[_0x048b('0x59')]['filename'];}return db['Setting'][_0x048b('0x56')]({'where':{'id':_0xff09c8[_0x048b('0x55')]['id']}})[_0x048b('0x21')](handleEntityNotFound(_0x23c3ac,null))[_0x048b('0x21')](saveUpdates(_0xff09c8[_0x048b('0x57')],null))[_0x048b('0x21')](respondWithResult(_0x23c3ac,null))[_0x048b('0x2c')](handleError(_0x23c3ac,null));};var utilLicense=require(_0x048b('0x5e'));exports[_0x048b('0x77')]=function(_0x5bb710,_0x40f1bb,_0x53d689){var _0x3de724=_0x048b('0x70');var _0x20727f={'custom':![]};return utilLicense[_0x048b('0x5f')]()[_0x048b('0x21')](function(_0x26dd4d){if(_0x26dd4d){_0x20727f=_0x26dd4d;}return db['Setting']['find']({'where':{'id':_0x5bb710[_0x048b('0x55')]['id']},'attributes':[_0x048b('0x5b'),'loginLogo',_0x048b('0x60'),'favicon',_0x048b('0x61'),_0x048b('0x62'),_0x048b('0x63'),_0x048b('0x64')],'raw':!![]});})[_0x048b('0x21')](handleEntityNotFound(_0x40f1bb,null))[_0x048b('0x21')](function(_0x186977){if(_0x186977){var _0x45c8bc=_0x186977['preferred']&&fs[_0x048b('0x65')](path[_0x048b('0x66')](config['root'],_0x3de724,_['toLower'](_0x186977[_0x048b('0x60')])))?path[_0x048b('0x66')](config[_0x048b('0x67')],_0x3de724,_[_0x048b('0x72')](_0x186977[_0x048b('0x60')])):path[_0x048b('0x66')](config[_0x048b('0x67')],_0x3de724,_['toLower'](_0x048b('0x78')));var _0xd1f375=_0x048b('0x68')+_[_0x048b('0x69')](_0x048b('0x60'));if(_0x186977[_0xd1f375]||!_0x20727f[_0x048b('0x6a')]||!_0x20727f[_0x048b('0x60')]){_0x45c8bc=path['join'](config[_0x048b('0x67')],_0x3de724,_[_0x048b('0x72')](_0x048b('0x78')));}if(!fs[_0x048b('0x65')](_0x45c8bc)){throw new db[(_0x048b('0x6c'))][(_0x048b('0x1e'))](_[_0x048b('0x69')]('preferred')+_0x048b('0x6d'));}return _0x40f1bb[_0x048b('0x6e')](_0x45c8bc);}})[_0x048b('0x2c')](handleError(_0x40f1bb,null));};exports[_0x048b('0x79')]=function(_0x4e1cb5,_0x40623b,_0x51ede8){if(_0x4e1cb5[_0x048b('0x59')]&&_0x4e1cb5[_0x048b('0x59')]['filename']){_0x4e1cb5[_0x048b('0x57')][_0x048b('0x71')]=_0x4e1cb5[_0x048b('0x59')][_0x048b('0x5a')];}return db['Setting'][_0x048b('0x56')]({'where':{'id':_0x4e1cb5['params']['id']}})[_0x048b('0x21')](handleEntityNotFound(_0x40623b,null))['then'](saveUpdates(_0x4e1cb5[_0x048b('0x57')],null))[_0x048b('0x21')](respondWithResult(_0x40623b,null))[_0x048b('0x2c')](handleError(_0x40623b,null));};var utilLicense=require(_0x048b('0x5e'));exports['getFavicon']=function(_0x4d931e,_0x2261d2,_0x31b908){var _0x29e0dd='server/files/images/logos';var _0x22e4c5={'custom':![]};return utilLicense['getLicense']()[_0x048b('0x21')](function(_0x4b4977){if(_0x4b4977){_0x22e4c5=_0x4b4977;}return db['Setting']['find']({'where':{'id':_0x4d931e[_0x048b('0x55')]['id']},'attributes':[_0x048b('0x5b'),_0x048b('0x5d'),_0x048b('0x60'),'favicon',_0x048b('0x61'),_0x048b('0x62'),_0x048b('0x63'),_0x048b('0x64')],'raw':!![]});})[_0x048b('0x21')](handleEntityNotFound(_0x2261d2,null))[_0x048b('0x21')](function(_0x23a7a5){if(_0x23a7a5){var _0xcb1c80=_0x23a7a5[_0x048b('0x71')]&&fs[_0x048b('0x65')](path[_0x048b('0x66')](config[_0x048b('0x67')],_0x29e0dd,_[_0x048b('0x72')](_0x23a7a5[_0x048b('0x71')])))?path[_0x048b('0x66')](config[_0x048b('0x67')],_0x29e0dd,_[_0x048b('0x72')](_0x23a7a5[_0x048b('0x71')])):path['join'](config['root'],_0x29e0dd,_[_0x048b('0x72')](_0x048b('0x7a')));var _0x33b8b6='default'+_['upperFirst'](_0x048b('0x71'));if(_0x23a7a5[_0x33b8b6]||!_0x22e4c5[_0x048b('0x6a')]){_0xcb1c80=path[_0x048b('0x66')](config['root'],_0x29e0dd,_[_0x048b('0x72')](_0x048b('0x7a')));}if(!fs['existsSync'](_0xcb1c80)){throw new db['Sequelize'][(_0x048b('0x1e'))](_[_0x048b('0x69')](_0x048b('0x71'))+_0x048b('0x6d'));}return _0x2261d2[_0x048b('0x6e')](_0xcb1c80);}})[_0x048b('0x2c')](handleError(_0x2261d2,null));}; \ No newline at end of file +var _0x8926=['existsSync','root','toLower','join','default_logo.svg','upperFirst','custom','ValidationError','\x20not\x20found','download','getLicense','default_loginLogo.svg','default','gdpr','getPreferred','defaultFavicon','default_preferred.png','default_favicon.ico','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','request','Setting,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','stack','name','send','map','Setting','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','include','findAll','rows','show','params','options','find','update','body','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred'];(function(_0x5ec7f8,_0x5d5978){var _0x4cd2e1=function(_0x322023){while(--_0x322023){_0x5ec7f8['push'](_0x5ec7f8['shift']());}};_0x4cd2e1(++_0x5d5978);}(_0x8926,0x88));var _0x6892=function(_0x4ccc77,_0x28dde1){_0x4ccc77=_0x4ccc77-0x0;var _0x2db81c=_0x8926[_0x4ccc77];return _0x2db81c;};'use strict';var pdf=require(_0x6892('0x0'));var emlformat=require(_0x6892('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6892('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6892('0x3'));var moment=require('moment');var BPromise=require(_0x6892('0x4'));var Mustache=require(_0x6892('0x5'));var util=require(_0x6892('0x6'));var path=require(_0x6892('0x7'));var sox=require(_0x6892('0x8'));var csv=require('to-csv');var ejs=require(_0x6892('0x9'));var fs=require('fs');var _=require(_0x6892('0xa'));var squel=require(_0x6892('0xb'));var crypto=require(_0x6892('0xc'));var jsforce=require(_0x6892('0xd'));var deskjs=require(_0x6892('0xe'));var toCsv=require(_0x6892('0xf'));var querystring=require(_0x6892('0x10'));var Papa=require(_0x6892('0x11'));var Redis=require(_0x6892('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6892('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6892('0x14'));var logger=require(_0x6892('0x15'))(_0x6892('0x16'));var utils=require(_0x6892('0x17'));var config=require(_0x6892('0x18'));var db=require(_0x6892('0x19'))['db'];var jayson=require(_0x6892('0x1a'));var client=jayson[_0x6892('0x1b')][_0x6892('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x39a5ec,_0xb2c3e4,_0x1fc0dc){if(_0x1fc0dc){var _0xc10906=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc10906[_0x6892('0x1d')](_0xb2c3e4)){return _0x39a5ec;}else{throw new db[(_0x6892('0x1e'))]['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 _0x39a5ec;}}function respondWithRpcPromise(_0x4c86a1,_0x1e0ff6,_0x5e87a7,_0x599523){return new BPromise(function(_0x2b95bc,_0x18c760){var _0x576b04=_0x599523||client;return _0x576b04[_0x6892('0x1f')](_0x4c86a1,_0x5e87a7)['then'](function(_0x4c0fca){logger['info'](_0x6892('0x20'),_0x1e0ff6,_0x6892('0x21'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x1e0ff6,_0x6892('0x21'),JSON['stringify'](_0x4c0fca));if(_0x4c0fca[_0x6892('0x22')]){if(_0x4c0fca[_0x6892('0x22')][_0x6892('0x23')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x1e0ff6,_0x4c0fca[_0x6892('0x22')][_0x6892('0x24')]);return _0x18c760(_0x4c0fca['error']['message']);}logger[_0x6892('0x22')](_0x6892('0x20'),_0x1e0ff6,_0x4c0fca[_0x6892('0x22')][_0x6892('0x24')]);return _0x2b95bc(_0x4c0fca['error'][_0x6892('0x24')]);}else{logger['info'](_0x6892('0x20'),_0x1e0ff6,_0x6892('0x21'));_0x2b95bc(_0x4c0fca[_0x6892('0x25')][_0x6892('0x24')]);}})[_0x6892('0x26')](function(_0x11d234){logger[_0x6892('0x22')](_0x6892('0x20'),_0x1e0ff6,_0x11d234);_0x18c760(_0x11d234);});});}function respondWithStatusCode(_0x54fbc2,_0x12a6b4){_0x12a6b4=_0x12a6b4||0xcc;return function(_0x43cd58){if(_0x43cd58){return _0x54fbc2['sendStatus'](_0x12a6b4);}return _0x54fbc2[_0x6892('0x27')](_0x12a6b4)[_0x6892('0x28')]();};}function respondWithResult(_0x108ba4,_0xd25433){_0xd25433=_0xd25433||0xc8;return function(_0x42bc3b){if(_0x42bc3b){return _0x108ba4[_0x6892('0x27')](_0xd25433)[_0x6892('0x29')](_0x42bc3b);}};}function respondWithFilteredResult(_0x2d656d,_0x446440){return function(_0x1142cf){if(_0x1142cf){var _0x5a8ae4=_0x1142cf['count'],_0x501f5e=_0x446440[_0x6892('0x2a')],_0x3b26a4=_0x446440['offset']+_0x446440[_0x6892('0x2b')],_0xf4acab;if(_0x3b26a4>=_0x5a8ae4){_0x3b26a4=_0x5a8ae4;_0xf4acab=0xc8;}else{_0xf4acab=0xce;}_0x2d656d[_0x6892('0x27')](_0xf4acab);return _0x2d656d[_0x6892('0x2c')](_0x6892('0x2d'),_0x501f5e+'-'+_0x3b26a4+'/'+_0x5a8ae4)[_0x6892('0x29')](_0x1142cf);}return null;};}function patchUpdates(_0x3bedd9){return function(_0x37e76f){try{jsonpatch[_0x6892('0x2e')](_0x37e76f,_0x3bedd9,!![]);}catch(_0x209ea4){return BPromise[_0x6892('0x2f')](_0x209ea4);}return _0x37e76f[_0x6892('0x30')]();};}function saveUpdates(_0x44d997,_0x1326fe){return function(_0x205ef0){if(_0x205ef0){return _0x205ef0['update'](_0x44d997)['then'](function(_0x3e30cc){return _0x3e30cc;});}return null;};}function removeEntity(_0x1227de,_0x1e5111){return function(_0x59f151){if(_0x59f151){return _0x59f151[_0x6892('0x31')]()[_0x6892('0x32')](function(){_0x1227de[_0x6892('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d39d0,_0x3b0b24){return function(_0x7986be){if(!_0x7986be){_0x1d39d0[_0x6892('0x33')](0x194);}return _0x7986be;};}function handleError(_0x12de1e,_0x2a6f74){_0x2a6f74=_0x2a6f74||0x1f4;return function(_0x111704){logger[_0x6892('0x22')](_0x111704[_0x6892('0x34')]);if(_0x111704[_0x6892('0x35')]){delete _0x111704[_0x6892('0x35')];}_0x12de1e['status'](_0x2a6f74)[_0x6892('0x36')](_0x111704);};}exports['index']=function(_0x862222,_0x1fc45a){var _0x1b2151={},_0x3c8151={},_0x5530cd={'count':0x0,'rows':[]};var _0x1581c2=_[_0x6892('0x37')](db[_0x6892('0x38')][_0x6892('0x39')],function(_0x57a014){return{'name':_0x57a014[_0x6892('0x3a')],'type':_0x57a014[_0x6892('0x3b')]['key']};});_0x3c8151['model']=_[_0x6892('0x37')](_0x1581c2,_0x6892('0x35'));_0x3c8151[_0x6892('0x3c')]=_[_0x6892('0x3d')](_0x862222['query']);_0x3c8151[_0x6892('0x3e')]=_['intersection'](_0x3c8151[_0x6892('0x3f')],_0x3c8151[_0x6892('0x3c')]);_0x1b2151['attributes']=_[_0x6892('0x40')](_0x3c8151[_0x6892('0x3f')],qs[_0x6892('0x41')](_0x862222['query'][_0x6892('0x41')]));_0x1b2151['attributes']=_0x1b2151['attributes']['length']?_0x1b2151[_0x6892('0x42')]:_0x3c8151['model'];if(!_0x862222[_0x6892('0x3c')][_0x6892('0x43')](_0x6892('0x44'))){_0x1b2151['limit']=qs['limit'](_0x862222[_0x6892('0x3c')][_0x6892('0x2b')]);_0x1b2151[_0x6892('0x2a')]=qs['offset'](_0x862222[_0x6892('0x3c')][_0x6892('0x2a')]);}_0x1b2151[_0x6892('0x45')]=qs[_0x6892('0x46')](_0x862222[_0x6892('0x3c')][_0x6892('0x46')]);_0x1b2151['where']=qs['filters'](_[_0x6892('0x47')](_0x862222[_0x6892('0x3c')],_0x3c8151[_0x6892('0x3e')]),_0x1581c2);if(_0x862222[_0x6892('0x3c')][_0x6892('0x48')]){_0x1b2151[_0x6892('0x49')]=_[_0x6892('0x4a')](_0x1b2151[_0x6892('0x49')],{'$or':_['map'](_0x1581c2,function(_0x4f829a){if(_0x4f829a[_0x6892('0x3b')]!==_0x6892('0x4b')){var _0x32c795={};_0x32c795[_0x4f829a[_0x6892('0x35')]]={'$like':'%'+_0x862222['query'][_0x6892('0x48')]+'%'};return _0x32c795;}})});}_0x1b2151=_[_0x6892('0x4a')]({},_0x1b2151,_0x862222['options']);var _0x40cfa4={'where':_0x1b2151['where']};return db[_0x6892('0x38')][_0x6892('0x4c')](_0x40cfa4)[_0x6892('0x32')](function(_0x2a89e7){_0x5530cd[_0x6892('0x4c')]=_0x2a89e7;if(_0x862222[_0x6892('0x3c')]['includeAll']){_0x1b2151[_0x6892('0x4d')]=[{'all':!![]}];}return db[_0x6892('0x38')][_0x6892('0x4e')](_0x1b2151);})[_0x6892('0x32')](function(_0x5bb1eb){_0x5530cd[_0x6892('0x4f')]=_0x5bb1eb;return _0x5530cd;})[_0x6892('0x32')](respondWithFilteredResult(_0x1fc45a,_0x1b2151))[_0x6892('0x26')](handleError(_0x1fc45a,null));};exports[_0x6892('0x50')]=function(_0x492a23,_0x4e361b){var _0x47ebc4={'raw':![],'where':{'id':_0x492a23[_0x6892('0x51')]['id']}},_0x19e74f={};_0x19e74f[_0x6892('0x3f')]=_[_0x6892('0x3d')](db['Setting'][_0x6892('0x39')]);_0x19e74f[_0x6892('0x3c')]=_[_0x6892('0x3d')](_0x492a23[_0x6892('0x3c')]);_0x19e74f[_0x6892('0x3e')]=_[_0x6892('0x40')](_0x19e74f[_0x6892('0x3f')],_0x19e74f['query']);_0x47ebc4[_0x6892('0x42')]=_[_0x6892('0x40')](_0x19e74f[_0x6892('0x3f')],qs[_0x6892('0x41')](_0x492a23[_0x6892('0x3c')]['fields']));_0x47ebc4[_0x6892('0x42')]=_0x47ebc4[_0x6892('0x42')]['length']?_0x47ebc4[_0x6892('0x42')]:_0x19e74f[_0x6892('0x3f')];if(_0x492a23[_0x6892('0x3c')]['includeAll']){_0x47ebc4[_0x6892('0x4d')]=[{'all':!![]}];}_0x47ebc4=_[_0x6892('0x4a')]({},_0x47ebc4,_0x492a23[_0x6892('0x52')]);return db['Setting'][_0x6892('0x53')](_0x47ebc4)['then'](handleEntityNotFound(_0x4e361b,null))[_0x6892('0x32')](respondWithResult(_0x4e361b,null))[_0x6892('0x26')](handleError(_0x4e361b,null));};exports[_0x6892('0x54')]=function(_0x47bc1f,_0x32470c){if(_0x47bc1f[_0x6892('0x55')]['id']){delete _0x47bc1f[_0x6892('0x55')]['id'];}return db[_0x6892('0x38')]['find']({'where':{'id':_0x47bc1f['params']['id']}})[_0x6892('0x32')](handleEntityNotFound(_0x32470c,null))['then'](saveUpdates(_0x47bc1f[_0x6892('0x55')],null))[_0x6892('0x32')](respondWithResult(_0x32470c,null))[_0x6892('0x26')](handleError(_0x32470c,null));};exports[_0x6892('0x56')]=function(_0x441d0a,_0x3dec5a,_0x320a63){if(_0x441d0a[_0x6892('0x57')]&&_0x441d0a[_0x6892('0x57')][_0x6892('0x58')]){_0x441d0a[_0x6892('0x55')]['logo']=_0x441d0a[_0x6892('0x57')][_0x6892('0x58')];}return db[_0x6892('0x38')]['find']({'where':{'id':_0x441d0a[_0x6892('0x51')]['id']}})[_0x6892('0x32')](handleEntityNotFound(_0x3dec5a,null))['then'](saveUpdates(_0x441d0a['body'],null))[_0x6892('0x32')](respondWithResult(_0x3dec5a,null))[_0x6892('0x26')](handleError(_0x3dec5a,null));};exports[_0x6892('0x59')]=function(_0x15b2a0,_0x3f2c18,_0x19ffdd){if(_0x15b2a0['file']&&_0x15b2a0[_0x6892('0x57')][_0x6892('0x58')]){_0x15b2a0[_0x6892('0x55')][_0x6892('0x5a')]=_0x15b2a0[_0x6892('0x57')][_0x6892('0x58')];}return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0x15b2a0[_0x6892('0x51')]['id']}})[_0x6892('0x32')](handleEntityNotFound(_0x3f2c18,null))[_0x6892('0x32')](saveUpdates(_0x15b2a0[_0x6892('0x55')],null))[_0x6892('0x32')](respondWithResult(_0x3f2c18,null))['catch'](handleError(_0x3f2c18,null));};var utilLicense=require(_0x6892('0x5b'));exports[_0x6892('0x5c')]=function(_0xe68e40,_0x186308,_0x3a4d11){var _0xfbf9a9=_0x6892('0x5d');var _0x4639fd={'custom':![]};return utilLicense['getLicense']()[_0x6892('0x32')](function(_0x3d2a10){if(_0x3d2a10){_0x4639fd=_0x3d2a10;}return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0xe68e40[_0x6892('0x51')]['id']},'attributes':[_0x6892('0x5e'),'loginLogo',_0x6892('0x5f'),_0x6892('0x60'),_0x6892('0x61'),_0x6892('0x62'),_0x6892('0x63'),'defaultFavicon'],'raw':!![]});})[_0x6892('0x32')](handleEntityNotFound(_0x186308,null))['then'](function(_0x1a2b71){if(_0x1a2b71){var _0x35b43c=_0x1a2b71['logo']&&fs[_0x6892('0x64')](path['join'](config[_0x6892('0x65')],_0xfbf9a9,_['toLower'](_0x1a2b71[_0x6892('0x5e')])))?path['join'](config[_0x6892('0x65')],_0xfbf9a9,_[_0x6892('0x66')](_0x1a2b71[_0x6892('0x5e')])):path[_0x6892('0x67')](config['root'],_0xfbf9a9,_[_0x6892('0x66')](_0x6892('0x68')));var _0x2fc755='default'+_[_0x6892('0x69')](_0x6892('0x5e'));if(_0x1a2b71[_0x2fc755]||!_0x4639fd[_0x6892('0x6a')]){_0x35b43c=path['join'](config[_0x6892('0x65')],_0xfbf9a9,_[_0x6892('0x66')](_0x6892('0x68')));}if(!fs['existsSync'](_0x35b43c)){throw new db[(_0x6892('0x1e'))][(_0x6892('0x6b'))](_[_0x6892('0x69')]('logo')+_0x6892('0x6c'));}return _0x186308[_0x6892('0x6d')](_0x35b43c);}})['catch'](handleError(_0x186308,null));};var utilLicense=require(_0x6892('0x5b'));exports['getLogoLogin']=function(_0x423040,_0x1d01f6,_0x1ed82c){var _0x47699f=_0x6892('0x5d');var _0x320a93={'custom':![]};return utilLicense[_0x6892('0x6e')]()[_0x6892('0x32')](function(_0x51f5c5){if(_0x51f5c5){_0x320a93=_0x51f5c5;}return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0x423040['params']['id']},'attributes':['logo',_0x6892('0x5a'),'preferred','favicon',_0x6892('0x61'),_0x6892('0x62'),_0x6892('0x63'),'defaultFavicon'],'raw':!![]});})[_0x6892('0x32')](handleEntityNotFound(_0x1d01f6,null))['then'](function(_0x341997){if(_0x341997){var _0x33a3f6=_0x341997[_0x6892('0x5a')]&&fs[_0x6892('0x64')](path[_0x6892('0x67')](config[_0x6892('0x65')],_0x47699f,_[_0x6892('0x66')](_0x341997[_0x6892('0x5a')])))?path[_0x6892('0x67')](config[_0x6892('0x65')],_0x47699f,_[_0x6892('0x66')](_0x341997[_0x6892('0x5a')])):path['join'](config[_0x6892('0x65')],_0x47699f,_[_0x6892('0x66')](_0x6892('0x6f')));var _0x22e458=_0x6892('0x70')+_[_0x6892('0x69')](_0x6892('0x5a'));if(_0x341997[_0x22e458]||!_0x320a93['custom']){_0x33a3f6=path['join'](config[_0x6892('0x65')],_0x47699f,_[_0x6892('0x66')](_0x6892('0x6f')));}if(!fs['existsSync'](_0x33a3f6)){throw new db[(_0x6892('0x1e'))][(_0x6892('0x6b'))](_['upperFirst'](_0x6892('0x5a'))+_0x6892('0x6c'));}return _0x1d01f6[_0x6892('0x6d')](_0x33a3f6);}})[_0x6892('0x26')](handleError(_0x1d01f6,null));};exports[_0x6892('0x71')]=function(_0x251db2,_0x44b516){return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0x251db2[_0x6892('0x51')]['id']},'attributes':['securePassword']})[_0x6892('0x32')](respondWithResult(_0x44b516,null))['catch'](handleError(_0x44b516,null));};exports['addPreferred']=function(_0x36e88d,_0x1173ce,_0x264a10){if(_0x36e88d[_0x6892('0x57')]&&_0x36e88d[_0x6892('0x57')]['filename']){_0x36e88d[_0x6892('0x55')][_0x6892('0x5f')]=_0x36e88d[_0x6892('0x57')][_0x6892('0x58')];}return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0x36e88d['params']['id']}})['then'](handleEntityNotFound(_0x1173ce,null))['then'](saveUpdates(_0x36e88d[_0x6892('0x55')],null))[_0x6892('0x32')](respondWithResult(_0x1173ce,null))['catch'](handleError(_0x1173ce,null));};var utilLicense=require(_0x6892('0x5b'));exports[_0x6892('0x72')]=function(_0x6553fe,_0x3d93ad,_0x3f63a8){var _0x3ff65b=_0x6892('0x5d');var _0x3c6723={'custom':![]};return utilLicense[_0x6892('0x6e')]()[_0x6892('0x32')](function(_0x56ca35){if(_0x56ca35){_0x3c6723=_0x56ca35;}return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0x6553fe[_0x6892('0x51')]['id']},'attributes':['logo',_0x6892('0x5a'),'preferred',_0x6892('0x60'),_0x6892('0x61'),_0x6892('0x62'),_0x6892('0x63'),_0x6892('0x73')],'raw':!![]});})[_0x6892('0x32')](handleEntityNotFound(_0x3d93ad,null))[_0x6892('0x32')](function(_0x2370e4){if(_0x2370e4){var _0x3bbdae=_0x2370e4[_0x6892('0x5f')]&&fs[_0x6892('0x64')](path[_0x6892('0x67')](config[_0x6892('0x65')],_0x3ff65b,_[_0x6892('0x66')](_0x2370e4[_0x6892('0x5f')])))?path['join'](config[_0x6892('0x65')],_0x3ff65b,_[_0x6892('0x66')](_0x2370e4['preferred'])):path['join'](config[_0x6892('0x65')],_0x3ff65b,_[_0x6892('0x66')](_0x6892('0x74')));var _0x11c5a3=_0x6892('0x70')+_['upperFirst'](_0x6892('0x5f'));if(_0x2370e4[_0x11c5a3]||!_0x3c6723[_0x6892('0x6a')]||!_0x3c6723[_0x6892('0x5f')]){_0x3bbdae=path[_0x6892('0x67')](config['root'],_0x3ff65b,_[_0x6892('0x66')]('default_preferred.png'));}if(!fs[_0x6892('0x64')](_0x3bbdae)){throw new db[(_0x6892('0x1e'))][(_0x6892('0x6b'))](_['upperFirst']('preferred')+_0x6892('0x6c'));}return _0x3d93ad[_0x6892('0x6d')](_0x3bbdae);}})[_0x6892('0x26')](handleError(_0x3d93ad,null));};exports['addFavicon']=function(_0x49b020,_0x282e9b,_0x18f272){if(_0x49b020[_0x6892('0x57')]&&_0x49b020[_0x6892('0x57')][_0x6892('0x58')]){_0x49b020[_0x6892('0x55')][_0x6892('0x60')]=_0x49b020['file'][_0x6892('0x58')];}return db['Setting'][_0x6892('0x53')]({'where':{'id':_0x49b020[_0x6892('0x51')]['id']}})['then'](handleEntityNotFound(_0x282e9b,null))[_0x6892('0x32')](saveUpdates(_0x49b020[_0x6892('0x55')],null))[_0x6892('0x32')](respondWithResult(_0x282e9b,null))['catch'](handleError(_0x282e9b,null));};var utilLicense=require(_0x6892('0x5b'));exports['getFavicon']=function(_0x18452e,_0x33a251,_0x4ffaac){var _0x522eb5=_0x6892('0x5d');var _0x287a0a={'custom':![]};return utilLicense[_0x6892('0x6e')]()[_0x6892('0x32')](function(_0x1037f0){if(_0x1037f0){_0x287a0a=_0x1037f0;}return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0x18452e['params']['id']},'attributes':[_0x6892('0x5e'),_0x6892('0x5a'),_0x6892('0x5f'),_0x6892('0x60'),_0x6892('0x61'),_0x6892('0x62'),'defaultPreferred',_0x6892('0x73')],'raw':!![]});})['then'](handleEntityNotFound(_0x33a251,null))[_0x6892('0x32')](function(_0x1a3a59){if(_0x1a3a59){var _0x539f18=_0x1a3a59['favicon']&&fs[_0x6892('0x64')](path['join'](config['root'],_0x522eb5,_[_0x6892('0x66')](_0x1a3a59['favicon'])))?path['join'](config[_0x6892('0x65')],_0x522eb5,_[_0x6892('0x66')](_0x1a3a59[_0x6892('0x60')])):path[_0x6892('0x67')](config['root'],_0x522eb5,_['toLower'](_0x6892('0x75')));var _0x4727fa=_0x6892('0x70')+_[_0x6892('0x69')]('favicon');if(_0x1a3a59[_0x4727fa]||!_0x287a0a[_0x6892('0x6a')]){_0x539f18=path[_0x6892('0x67')](config[_0x6892('0x65')],_0x522eb5,_[_0x6892('0x66')](_0x6892('0x75')));}if(!fs[_0x6892('0x64')](_0x539f18)){throw new db[(_0x6892('0x1e'))][(_0x6892('0x6b'))](_['upperFirst'](_0x6892('0x60'))+_0x6892('0x6c'));}return _0x33a251[_0x6892('0x6d')](_0x539f18);}})[_0x6892('0x26')](handleError(_0x33a251,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index cd96b28..f25560d 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 _0xc71b=['settings','../../config/logger','bluebird','rimraf','../../config/environment','./setting.attributes','exports','define'];(function(_0x192b6c,_0x8f1c71){var _0x330017=function(_0x1d4d74){while(--_0x1d4d74){_0x192b6c['push'](_0x192b6c['shift']());}};_0x330017(++_0x8f1c71);}(_0xc71b,0x99));var _0xbc71=function(_0x5e987b,_0x3cd745){_0x5e987b=_0x5e987b-0x0;var _0x5ebaaf=_0xc71b[_0x5e987b];return _0x5ebaaf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbc71('0x0'))('api');var moment=require('moment');var BPromise=require(_0xbc71('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc71('0x2'));var config=require(_0xbc71('0x3'));var attributes=require(_0xbc71('0x4'));module[_0xbc71('0x5')]=function(_0x8269a6,_0x476ac0){return _0x8269a6[_0xbc71('0x6')]('Setting',attributes,{'tableName':_0xbc71('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd24=['../../config/environment','define','Setting','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xc9c8ca,_0xbc7ae3){var _0x59fc76=function(_0x2b7f3f){while(--_0x2b7f3f){_0xc9c8ca['push'](_0xc9c8ca['shift']());}};_0x59fc76(++_0xbc7ae3);}(_0xcd24,0x193));var _0x4cd2=function(_0x25ab76,_0x596eae){_0x25ab76=_0x25ab76-0x0;var _0x235145=_0xcd24[_0x25ab76];return _0x235145;};'use strict';var _=require(_0x4cd2('0x0'));var util=require('util');var logger=require(_0x4cd2('0x1'))('api');var moment=require(_0x4cd2('0x2'));var BPromise=require(_0x4cd2('0x3'));var rp=require(_0x4cd2('0x4'));var fs=require('fs');var path=require(_0x4cd2('0x5'));var rimraf=require(_0x4cd2('0x6'));var config=require(_0x4cd2('0x7'));var attributes=require('./setting.attributes');module['exports']=function(_0x4a42df,_0x321c17){return _0x4a42df[_0x4cd2('0x8')](_0x4cd2('0x9'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 601e818..5e009f6 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 _0x3f77=['client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x841dd6,_0x32cb31){var _0x3dcdbf=function(_0x2d39fe){while(--_0x2d39fe){_0x841dd6['push'](_0x841dd6['shift']());}};_0x3dcdbf(++_0x32cb31);}(_0x3f77,0xaf));var _0x73f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f77[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73f7('0x0'));var BPromise=require(_0x73f7('0x1'));var rs=require(_0x73f7('0x2'));var fs=require('fs');var Redis=require(_0x73f7('0x3'));var db=require(_0x73f7('0x4'))['db'];var utils=require(_0x73f7('0x5'));var logger=require(_0x73f7('0x6'))('rpc');var config=require(_0x73f7('0x7'));var jayson=require(_0x73f7('0x8'));var client=jayson[_0x73f7('0x9')][_0x73f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x167b80,_0x3f115a,_0x1e3318){return new BPromise(function(_0x166414,_0x1feb7c){return client[_0x73f7('0xb')](_0x167b80,_0x1e3318)['then'](function(_0x344c75){logger[_0x73f7('0xc')](_0x73f7('0xd'),_0x3f115a,_0x73f7('0xe'));logger[_0x73f7('0xf')](_0x73f7('0x10'),_0x3f115a,'request\x20sent',JSON[_0x73f7('0x11')](_0x344c75));if(_0x344c75[_0x73f7('0x12')]){if(_0x344c75['error'][_0x73f7('0x13')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3f115a,_0x344c75['error'][_0x73f7('0x14')]);return _0x1feb7c(_0x344c75['error'][_0x73f7('0x14')]);}logger[_0x73f7('0x12')](_0x73f7('0xd'),_0x3f115a,_0x344c75['error'][_0x73f7('0x14')]);return _0x166414(_0x344c75[_0x73f7('0x12')][_0x73f7('0x14')]);}else{logger[_0x73f7('0xc')]('Setting,\x20%s,\x20%s',_0x3f115a,_0x73f7('0xe'));_0x166414(_0x344c75[_0x73f7('0x15')][_0x73f7('0x14')]);}})[_0x73f7('0x16')](function(_0xc30dcb){logger['error'](_0x73f7('0xd'),_0x3f115a,_0xc30dcb);_0x1feb7c(_0xc30dcb);});});} \ No newline at end of file +var _0xd464=['http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x528a0c,_0x2bb697){var _0x565c7b=function(_0x50ea65){while(--_0x50ea65){_0x528a0c['push'](_0x528a0c['shift']());}};_0x565c7b(++_0x2bb697);}(_0xd464,0x97));var _0x4d46=function(_0x461547,_0x13632e){_0x461547=_0x461547-0x0;var _0x29eed2=_0xd464[_0x461547];return _0x29eed2;};'use strict';var _=require(_0x4d46('0x0'));var util=require(_0x4d46('0x1'));var moment=require('moment');var BPromise=require(_0x4d46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d46('0x3'));var db=require(_0x4d46('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d46('0x5'))(_0x4d46('0x6'));var config=require(_0x4d46('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4d46('0x8')][_0x4d46('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30b30b,_0x20c528,_0x1c1158){return new BPromise(function(_0x550594,_0xf35d17){return client[_0x4d46('0xa')](_0x30b30b,_0x1c1158)[_0x4d46('0xb')](function(_0x5f473f){logger[_0x4d46('0xc')](_0x4d46('0xd'),_0x20c528,_0x4d46('0xe'));logger[_0x4d46('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x20c528,_0x4d46('0xe'),JSON[_0x4d46('0x10')](_0x5f473f));if(_0x5f473f['error']){if(_0x5f473f[_0x4d46('0x11')][_0x4d46('0x12')]===0x1f4){logger['error'](_0x4d46('0xd'),_0x20c528,_0x5f473f[_0x4d46('0x11')][_0x4d46('0x13')]);return _0xf35d17(_0x5f473f[_0x4d46('0x11')]['message']);}logger['error'](_0x4d46('0xd'),_0x20c528,_0x5f473f[_0x4d46('0x11')][_0x4d46('0x13')]);return _0x550594(_0x5f473f['error'][_0x4d46('0x13')]);}else{logger[_0x4d46('0xc')](_0x4d46('0xd'),_0x20c528,_0x4d46('0xe'));_0x550594(_0x5f473f['result'][_0x4d46('0x13')]);}})['catch'](function(_0xe32fc6){logger[_0x4d46('0x11')](_0x4d46('0xd'),_0x20c528,_0xe32fc6);_0xf35d17(_0xe32fc6);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c83a281..3e23145 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 _0x828a=['delete','removeAnswers','removeAgents','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','post','/:id/notify','notify','/:id/send','status','addAgents','put','update'];(function(_0x532086,_0x2195d7){var _0x407586=function(_0x154ec5){while(--_0x154ec5){_0x532086['push'](_0x532086['shift']());}};_0x407586(++_0x2195d7);}(_0x828a,0x8f));var _0xa828=function(_0x836a5,_0x1a520f){_0x836a5=_0x836a5-0x0;var _0x6d25d4=_0x828a[_0x836a5];return _0x6d25d4;};'use strict';var multer=require(_0xa828('0x0'));var util=require('util');var path=require(_0xa828('0x1'));var timeout=require(_0xa828('0x2'));var express=require('express');var router=express[_0xa828('0x3')]();var auth=require(_0xa828('0x4'));var interaction=require(_0xa828('0x5'));var config=require(_0xa828('0x6'));var controller=require(_0xa828('0x7'));router[_0xa828('0x8')]('/',auth['isAuthenticated'](),controller[_0xa828('0x9')]);router[_0xa828('0x8')](_0xa828('0xa'),auth['isAuthenticated'](),controller[_0xa828('0xb')]);router[_0xa828('0x8')](_0xa828('0xc'),auth[_0xa828('0xd')](),controller[_0xa828('0xe')]);router[_0xa828('0x8')](_0xa828('0xf'),auth[_0xa828('0xd')](),controller['getDispositions']);router[_0xa828('0x8')](_0xa828('0x10'),auth['isAuthenticated'](),controller[_0xa828('0x11')]);router['get'](_0xa828('0x12'),auth[_0xa828('0xd')](),controller[_0xa828('0x13')]);router[_0xa828('0x8')](_0xa828('0x14'),auth[_0xa828('0xd')](),controller[_0xa828('0x15')]);router[_0xa828('0x8')](_0xa828('0x16'),controller['statusGet']);router[_0xa828('0x8')](_0xa828('0x17'),auth[_0xa828('0xd')](),controller['getAgents']);router[_0xa828('0x18')]('/',auth[_0xa828('0xd')](),controller['create']);router[_0xa828('0x18')](_0xa828('0xf'),auth[_0xa828('0xd')](),controller['addDisposition']);router[_0xa828('0x18')](_0xa828('0x10'),auth[_0xa828('0xd')](),controller['addAnswer']);router[_0xa828('0x18')](_0xa828('0x19'),controller[_0xa828('0x1a')]);router['post'](_0xa828('0x12'),auth[_0xa828('0xd')](),controller['addApplications']);router[_0xa828('0x18')](_0xa828('0x1b'),auth[_0xa828('0xd')](),controller['send']);router[_0xa828('0x18')](_0xa828('0x16'),controller[_0xa828('0x1c')]);router[_0xa828('0x18')](_0xa828('0x17'),auth[_0xa828('0xd')](),controller[_0xa828('0x1d')]);router[_0xa828('0x1e')](_0xa828('0xc'),auth[_0xa828('0xd')](),controller[_0xa828('0x1f')]);router['delete'](_0xa828('0xc'),auth[_0xa828('0xd')](),controller['destroy']);router[_0xa828('0x20')](_0xa828('0xf'),auth[_0xa828('0xd')](),controller['removeDispositions']);router[_0xa828('0x20')]('/:id/canned_answers',auth[_0xa828('0xd')](),controller[_0xa828('0x21')]);router[_0xa828('0x20')](_0xa828('0x17'),auth[_0xa828('0xd')](),controller[_0xa828('0x22')]);module['exports']=router; \ No newline at end of file +var _0x5aad=['destroy','removeAgents','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/canned_answers','addAnswer','/:id/notify','addApplications','/:id/send','status','/:id/users','addAgents','put','/:id','update','delete'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x5aad,0x71));var _0xd5aa=function(_0x37c1ac,_0x17138d){_0x37c1ac=_0x37c1ac-0x0;var _0x59bc50=_0x5aad[_0x37c1ac];return _0x59bc50;};'use strict';var multer=require(_0xd5aa('0x0'));var util=require(_0xd5aa('0x1'));var path=require('path');var timeout=require(_0xd5aa('0x2'));var express=require(_0xd5aa('0x3'));var router=express['Router']();var auth=require(_0xd5aa('0x4'));var interaction=require(_0xd5aa('0x5'));var config=require('../../config/environment');var controller=require(_0xd5aa('0x6'));router[_0xd5aa('0x7')]('/',auth[_0xd5aa('0x8')](),controller[_0xd5aa('0x9')]);router[_0xd5aa('0x7')](_0xd5aa('0xa'),auth[_0xd5aa('0x8')](),controller['describe']);router[_0xd5aa('0x7')]('/:id',auth[_0xd5aa('0x8')](),controller[_0xd5aa('0xb')]);router[_0xd5aa('0x7')](_0xd5aa('0xc'),auth[_0xd5aa('0x8')](),controller[_0xd5aa('0xd')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd5aa('0xe')]);router[_0xd5aa('0x7')](_0xd5aa('0xf'),auth['isAuthenticated'](),controller[_0xd5aa('0x10')]);router[_0xd5aa('0x7')](_0xd5aa('0x11'),auth['isAuthenticated'](),controller[_0xd5aa('0x12')]);router[_0xd5aa('0x7')](_0xd5aa('0x13'),controller[_0xd5aa('0x14')]);router[_0xd5aa('0x7')]('/:id/users',auth[_0xd5aa('0x8')](),controller[_0xd5aa('0x15')]);router[_0xd5aa('0x16')]('/',auth[_0xd5aa('0x8')](),controller['create']);router['post'](_0xd5aa('0xc'),auth[_0xd5aa('0x8')](),controller['addDisposition']);router['post'](_0xd5aa('0x17'),auth[_0xd5aa('0x8')](),controller[_0xd5aa('0x18')]);router['post'](_0xd5aa('0x19'),controller['notify']);router[_0xd5aa('0x16')](_0xd5aa('0xf'),auth['isAuthenticated'](),controller[_0xd5aa('0x1a')]);router[_0xd5aa('0x16')](_0xd5aa('0x1b'),auth[_0xd5aa('0x8')](),controller['send']);router[_0xd5aa('0x16')](_0xd5aa('0x13'),controller[_0xd5aa('0x1c')]);router[_0xd5aa('0x16')](_0xd5aa('0x1d'),auth[_0xd5aa('0x8')](),controller[_0xd5aa('0x1e')]);router[_0xd5aa('0x1f')](_0xd5aa('0x20'),auth[_0xd5aa('0x8')](),controller[_0xd5aa('0x21')]);router[_0xd5aa('0x22')](_0xd5aa('0x20'),auth['isAuthenticated'](),controller[_0xd5aa('0x23')]);router[_0xd5aa('0x22')](_0xd5aa('0xc'),auth[_0xd5aa('0x8')](),controller['removeDispositions']);router[_0xd5aa('0x22')](_0xd5aa('0x17'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0xd5aa('0x1d'),auth['isAuthenticated'](),controller[_0xd5aa('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 6d939ca..619cc20 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 _0xb18c=['generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name'];(function(_0x21b2ed,_0xe06493){var _0x4033d8=function(_0x177324){while(--_0x177324){_0x21b2ed['push'](_0x21b2ed['shift']());}};_0x4033d8(++_0xe06493);}(_0xb18c,0xce));var _0xcb18=function(_0x234079,_0x494a11){_0x234079=_0x234079-0x0;var _0x54130b=_0xb18c[_0x234079];return _0x54130b;};'use strict';var Sequelize=require(_0xcb18('0x0'));var rs=require(_0xcb18('0x1'));module['exports']={'name':{'type':Sequelize[_0xcb18('0x2')],'unique':_0xcb18('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xcb18('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xcb18('0x2')],'defaultValue':function(){return rs[_0xcb18('0x4')]();}},'phone':{'type':Sequelize[_0xcb18('0x2')]},'type':{'type':Sequelize[_0xcb18('0x5')](_0xcb18('0x6'),_0xcb18('0x7'),'connectel',_0xcb18('0x8'),_0xcb18('0x9'),_0xcb18('0xa'),_0xcb18('0xb'),_0xcb18('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0xcb18('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xcb18('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xcb18('0x2')]},'password':{'type':Sequelize[_0xcb18('0x2')]},'apiKey':{'type':Sequelize[_0xcb18('0x2')]},'senderString':{'type':Sequelize[_0xcb18('0x2')]},'deliveryReport':{'type':Sequelize[_0xcb18('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xcb18('0xe')],'defaultValue':function(){return _0xcb18('0xf');}},'notificationSound':{'type':Sequelize[_0xcb18('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcb18('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcb18('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcb18('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcb18('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcb18('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xcb18('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcb18('0x10')],'comment':_0xcb18('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xcb18('0xd')],'defaultValue':![],'comment':_0xcb18('0x12'),'set':function(_0x5a6e3c){if(!_0x5a6e3c)this[_0xcb18('0x13')](_0xcb18('0x14'),null);this[_0xcb18('0x13')]('mandatoryDisposition',_0x5a6e3c);}}}; \ No newline at end of file +var _0x19a2=['intelepeer','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','infobip'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x19a2,0x126));var _0x219a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x19a2[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x219a('0x0'));var rs=require(_0x219a('0x1'));module[_0x219a('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x219a('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x219a('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x219a('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x219a('0x4')]},'type':{'type':Sequelize[_0x219a('0x5')](_0x219a('0x6'),_0x219a('0x7'),_0x219a('0x8'),_0x219a('0x9'),_0x219a('0xa'),_0x219a('0xb'),_0x219a('0xc'),_0x219a('0xd'),_0x219a('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x219a('0x4')]},'authToken':{'type':Sequelize[_0x219a('0x4')]},'smsMethod':{'type':Sequelize[_0x219a('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x219a('0x4')]},'password':{'type':Sequelize[_0x219a('0x4')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x219a('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x219a('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x219a('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x219a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x219a('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x219a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x219a('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x219a('0xf')],'defaultValue':![],'comment':_0x219a('0x12'),'set':function(_0x40c5e5){if(!_0x40c5e5)this['setDataValue'](_0x219a('0x13'),null);this[_0x219a('0x14')](_0x219a('0x15'),_0x40c5e5);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 1d44723..028321d 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file +var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x7f4658,_0x53ee88){var _0x5b9264=function(_0x2d64ad){while(--_0x2d64ad){_0x7f4658['push'](_0x7f4658['shift']());}};_0x5b9264(++_0x53ee88);}(_0x7a54,0x106));var _0x47a5=function(_0x69322,_0x105c4e){_0x69322=_0x69322-0x0;var _0xcb795b=_0x7a54[_0x69322];return _0xcb795b;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 34ffa87..5c97ad7 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 _0xfd1d=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x321b98,_0x4c7b2b){var _0x22948f=function(_0x12ac50){while(--_0x12ac50){_0x321b98['push'](_0x321b98['shift']());}};_0x22948f(++_0x4c7b2b);}(_0xfd1d,0x177));var _0xdfd1=function(_0x3cbaf3,_0x4ec303){_0x3cbaf3=_0x3cbaf3-0x0;var _0x25daeb=_0xfd1d[_0x3cbaf3];return _0x25daeb;};'use strict';var EventEmitter=require(_0xdfd1('0x0'));var SmsAccount=require(_0xdfd1('0x1'))['db'][_0xdfd1('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xdfd1('0x3')](0x0);var events={'afterCreate':_0xdfd1('0x4'),'afterUpdate':_0xdfd1('0x5'),'afterDestroy':_0xdfd1('0x6')};function emitEvent(_0x2da7c4){return function(_0x5e1286,_0x2bd5ec,_0x33ebf0){SmsAccountEvents[_0xdfd1('0x7')](_0x2da7c4+':'+_0x5e1286['id'],_0x5e1286);SmsAccountEvents[_0xdfd1('0x7')](_0x2da7c4,_0x5e1286);_0x33ebf0(null);};}for(var e in events){if(events[_0xdfd1('0x8')](e)){var event=events[e];SmsAccount[_0xdfd1('0x9')](e,emitEvent(event));}}module[_0xdfd1('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0xf5ef=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x2208f4,_0x2d5b22){var _0x4d0e5b=function(_0x56da93){while(--_0x56da93){_0x2208f4['push'](_0x2208f4['shift']());}};_0x4d0e5b(++_0x2d5b22);}(_0xf5ef,0xba));var _0xff5e=function(_0x40ebc3,_0x5b7f78){_0x40ebc3=_0x40ebc3-0x0;var _0x1d8b08=_0xf5ef[_0x40ebc3];return _0x1d8b08;};'use strict';var EventEmitter=require(_0xff5e('0x0'));var SmsAccount=require(_0xff5e('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xff5e('0x2')](0x0);var events={'afterCreate':_0xff5e('0x3'),'afterUpdate':'update','afterDestroy':_0xff5e('0x4')};function emitEvent(_0x1e871b){return function(_0x16851f,_0x54d6b6,_0x3d3fd6){SmsAccountEvents[_0xff5e('0x5')](_0x1e871b+':'+_0x16851f['id'],_0x16851f);SmsAccountEvents[_0xff5e('0x5')](_0x1e871b,_0x16851f);_0x3d3fd6(null);};}for(var e in events){if(events[_0xff5e('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xff5e('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 b14fafa..f287302 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x295d3a,_0x156b05){var _0x40be1a=function(_0x177dae){while(--_0x177dae){_0x295d3a['push'](_0x295d3a['shift']());}};_0x40be1a(++_0x156b05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x40458c,_0x3ff275){var _0x305216=function(_0x1ced2c){while(--_0x1ced2c){_0x40458c['push'](_0x40458c['shift']());}};_0x305216(++_0x3ff275);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 56da553..778a9a7 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 _0x335c=['defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','where','attributes','include','model','map','stringify','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x583b50,_0x230145){var _0x4538bf=function(_0x190c9b){while(--_0x190c9b){_0x583b50['push'](_0x583b50['shift']());}};_0x4538bf(++_0x230145);}(_0x335c,0x1b0));var _0xc335=function(_0x3ca96b,_0x34a069){_0x3ca96b=_0x3ca96b-0x0;var _0x4dbfd8=_0x335c[_0x3ca96b];return _0x4dbfd8;};'use strict';var _=require(_0xc335('0x0'));var util=require(_0xc335('0x1'));var moment=require(_0xc335('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc335('0x3'))['db'];var utils=require(_0xc335('0x4'));var logger=require(_0xc335('0x5'))(_0xc335('0x6'));var config=require(_0xc335('0x7'));var jayson=require(_0xc335('0x8'));var client=jayson[_0xc335('0x9')][_0xc335('0xa')]({'port':0x232a});config[_0xc335('0xb')]=_[_0xc335('0xc')](config['redis'],{'host':_0xc335('0xd'),'port':0x18eb});var socket=require(_0xc335('0xe'))(new Redis(config[_0xc335('0xb')]));require(_0xc335('0xf'))[_0xc335('0x10')](socket);function respondWithRpcPromise(_0x500176,_0x1c0288,_0x4489c9){return new BPromise(function(_0x15dd01,_0x1b24b5){return client[_0xc335('0x11')](_0x500176,_0x4489c9)[_0xc335('0x12')](function(_0x47da61){logger[_0xc335('0x13')](_0xc335('0x14'),_0x1c0288,_0xc335('0x15'));logger[_0xc335('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1c0288,'request\x20sent',JSON['stringify'](_0x47da61));if(_0x47da61['error']){if(_0x47da61[_0xc335('0x17')][_0xc335('0x18')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x1c0288,_0x47da61['error'][_0xc335('0x19')]);return _0x1b24b5(_0x47da61[_0xc335('0x17')]['message']);}logger[_0xc335('0x17')](_0xc335('0x14'),_0x1c0288,_0x47da61['error'][_0xc335('0x19')]);return _0x15dd01(_0x47da61[_0xc335('0x17')][_0xc335('0x19')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x1c0288,_0xc335('0x15'));_0x15dd01(_0x47da61[_0xc335('0x1a')][_0xc335('0x19')]);}})[_0xc335('0x1b')](function(_0x3274ef){logger[_0xc335('0x17')](_0xc335('0x14'),_0x1c0288,_0x3274ef);_0x1b24b5(_0x3274ef);});});}exports[_0xc335('0x1c')]=function(_0x3082d7){var _0x1644a3=this;return new Promise(function(_0x21ef9d,_0x46fb54){return db[_0xc335('0x1d')]['find']({'raw':_0x3082d7['options']?_0x3082d7[_0xc335('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3082d7[_0xc335('0x1e')]?_0x3082d7['options'][_0xc335('0x1f')]||null:null,'attributes':_0x3082d7['options']?_0x3082d7['options'][_0xc335('0x20')]||null:null,'include':_0x3082d7[_0xc335('0x1e')]?_0x3082d7['options'][_0xc335('0x21')]?_['map'](_0x3082d7[_0xc335('0x1e')][_0xc335('0x21')],function(_0x216ff2){return{'model':db[_0x216ff2[_0xc335('0x22')]],'as':_0x216ff2['as'],'attributes':_0x216ff2[_0xc335('0x20')],'include':_0x216ff2[_0xc335('0x21')]?_[_0xc335('0x23')](_0x216ff2[_0xc335('0x21')],function(_0x29f813){return{'model':db[_0x29f813[_0xc335('0x22')]],'as':_0x29f813['as'],'attributes':_0x29f813['attributes'],'include':_0x29f813[_0xc335('0x21')]?_['map'](_0x29f813[_0xc335('0x21')],function(_0x48ff41){return{'model':db[_0x48ff41['model']],'as':_0x48ff41['as'],'attributes':_0x48ff41[_0xc335('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc335('0x12')](function(_0x180a62){logger[_0xc335('0x13')]('ShowSmsAccount',_0x3082d7);logger[_0xc335('0x16')](_0xc335('0x1c'),_0x3082d7,JSON[_0xc335('0x24')](_0x180a62));_0x21ef9d(_0x180a62);})['catch'](function(_0x20478e){logger[_0xc335('0x17')](_0xc335('0x1c'),_0x20478e['message'],_0x3082d7);_0x46fb54(_0x1644a3['error'](0x1f4,_0x20478e[_0xc335('0x19')]));});});}; \ No newline at end of file +var _0xd20e=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','ShowSmsAccount','SmsAccount','options','raw','where','attributes','map','include','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','request\x20sent','debug'];(function(_0x1a077a,_0xe2bb6b){var _0x2d6e4c=function(_0x1a95db){while(--_0x1a95db){_0x1a077a['push'](_0x1a077a['shift']());}};_0x2d6e4c(++_0xe2bb6b);}(_0xd20e,0xbe));var _0xed20=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xd20e[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0xed20('0x0'));var moment=require(_0xed20('0x1'));var BPromise=require(_0xed20('0x2'));var rs=require(_0xed20('0x3'));var fs=require('fs');var Redis=require(_0xed20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed20('0x5'));var logger=require(_0xed20('0x6'))(_0xed20('0x7'));var config=require(_0xed20('0x8'));var jayson=require(_0xed20('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xed20('0xa')]=_[_0xed20('0xb')](config['redis'],{'host':_0xed20('0xc'),'port':0x18eb});var socket=require(_0xed20('0xd'))(new Redis(config[_0xed20('0xa')]));require(_0xed20('0xe'))[_0xed20('0xf')](socket);function respondWithRpcPromise(_0xc562cd,_0xfaa0f6,_0x175c6a){return new BPromise(function(_0x11eb1c,_0x157b21){return client['request'](_0xc562cd,_0x175c6a)[_0xed20('0x10')](function(_0x2e227d){logger[_0xed20('0x11')]('SmsAccount,\x20%s,\x20%s',_0xfaa0f6,_0xed20('0x12'));logger[_0xed20('0x13')](_0xed20('0x14'),_0xfaa0f6,_0xed20('0x12'),JSON[_0xed20('0x15')](_0x2e227d));if(_0x2e227d[_0xed20('0x16')]){if(_0x2e227d['error'][_0xed20('0x17')]===0x1f4){logger[_0xed20('0x16')]('SmsAccount,\x20%s,\x20%s',_0xfaa0f6,_0x2e227d[_0xed20('0x16')][_0xed20('0x18')]);return _0x157b21(_0x2e227d[_0xed20('0x16')]['message']);}logger[_0xed20('0x16')]('SmsAccount,\x20%s,\x20%s',_0xfaa0f6,_0x2e227d['error'][_0xed20('0x18')]);return _0x11eb1c(_0x2e227d[_0xed20('0x16')][_0xed20('0x18')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0xfaa0f6,_0xed20('0x12'));_0x11eb1c(_0x2e227d['result'][_0xed20('0x18')]);}})['catch'](function(_0x36428c){logger[_0xed20('0x16')](_0xed20('0x19'),_0xfaa0f6,_0x36428c);_0x157b21(_0x36428c);});});}exports[_0xed20('0x1a')]=function(_0x2fb68b){var _0x5f11a2=this;return new Promise(function(_0x5d697a,_0x178b37){return db[_0xed20('0x1b')]['find']({'raw':_0x2fb68b[_0xed20('0x1c')]?_0x2fb68b[_0xed20('0x1c')][_0xed20('0x1d')]===undefined?!![]:![]:!![],'where':_0x2fb68b[_0xed20('0x1c')]?_0x2fb68b['options'][_0xed20('0x1e')]||null:null,'attributes':_0x2fb68b['options']?_0x2fb68b['options'][_0xed20('0x1f')]||null:null,'include':_0x2fb68b[_0xed20('0x1c')]?_0x2fb68b[_0xed20('0x1c')]['include']?_[_0xed20('0x20')](_0x2fb68b['options'][_0xed20('0x21')],function(_0x17fd62){return{'model':db[_0x17fd62['model']],'as':_0x17fd62['as'],'attributes':_0x17fd62[_0xed20('0x1f')],'include':_0x17fd62['include']?_['map'](_0x17fd62[_0xed20('0x21')],function(_0x52ab53){return{'model':db[_0x52ab53['model']],'as':_0x52ab53['as'],'attributes':_0x52ab53[_0xed20('0x1f')],'include':_0x52ab53['include']?_[_0xed20('0x20')](_0x52ab53[_0xed20('0x21')],function(_0x3fa30f){return{'model':db[_0x3fa30f['model']],'as':_0x3fa30f['as'],'attributes':_0x3fa30f[_0xed20('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xed20('0x10')](function(_0x4bea82){logger[_0xed20('0x11')](_0xed20('0x1a'),_0x2fb68b);logger['debug'](_0xed20('0x1a'),_0x2fb68b,JSON[_0xed20('0x15')](_0x4bea82));_0x5d697a(_0x4bea82);})[_0xed20('0x22')](function(_0x17cebe){logger[_0xed20('0x16')]('ShowSmsAccount',_0x17cebe['message'],_0x2fb68b);_0x178b37(_0x5f11a2[_0xed20('0x16')](0x1f4,_0x17cebe['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index a70a559..d3ee0f9 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 _0xdbc7=['update','emit','removeListener','register','length','./smsAccount.events','save','remove'];(function(_0x37378d,_0x3d27ed){var _0x685c2d=function(_0x11d809){while(--_0x11d809){_0x37378d['push'](_0x37378d['shift']());}};_0x685c2d(++_0x3d27ed);}(_0xdbc7,0x1c5));var _0x7dbc=function(_0x50c492,_0x5c1e67){_0x50c492=_0x50c492-0x0;var _0x3505a8=_0xdbc7[_0x50c492];return _0x3505a8;};'use strict';var SmsAccountEvents=require(_0x7dbc('0x0'));var events=[_0x7dbc('0x1'),_0x7dbc('0x2'),_0x7dbc('0x3')];function createListener(_0xf736ff,_0x57bca2){return function(_0x42121f){_0x57bca2[_0x7dbc('0x4')](_0xf736ff,_0x42121f);};}function removeListener(_0x43f504,_0x1e0d86){return function(){SmsAccountEvents[_0x7dbc('0x5')](_0x43f504,_0x1e0d86);};}exports[_0x7dbc('0x6')]=function(_0x321f4c){for(var _0x147978=0x0,_0x22b6dd=events[_0x7dbc('0x7')];_0x147978<_0x22b6dd;_0x147978++){var _0x1f994b=events[_0x147978];var _0x23edac=createListener('smsAccount:'+_0x1f994b,_0x321f4c);SmsAccountEvents['on'](_0x1f994b,_0x23edac);}}; \ No newline at end of file +var _0x9137=['update','register','length','smsAccount:','./smsAccount.events','save','remove'];(function(_0x16d3f8,_0x3f5dd3){var _0x49a172=function(_0x2f730d){while(--_0x2f730d){_0x16d3f8['push'](_0x16d3f8['shift']());}};_0x49a172(++_0x3f5dd3);}(_0x9137,0x7b));var _0x7913=function(_0x3b0e76,_0x239221){_0x3b0e76=_0x3b0e76-0x0;var _0x1e4af4=_0x9137[_0x3b0e76];return _0x1e4af4;};'use strict';var SmsAccountEvents=require(_0x7913('0x0'));var events=[_0x7913('0x1'),_0x7913('0x2'),_0x7913('0x3')];function createListener(_0x5eed68,_0x3580d7){return function(_0x1d4e46){_0x3580d7['emit'](_0x5eed68,_0x1d4e46);};}function removeListener(_0x443e95,_0x454252){return function(){SmsAccountEvents['removeListener'](_0x443e95,_0x454252);};}exports[_0x7913('0x4')]=function(_0x1ba461){for(var _0x37882a=0x0,_0x45e99c=events[_0x7913('0x5')];_0x37882a<_0x45e99c;_0x37882a++){var _0x37f46b=events[_0x37882a];var _0x479929=createListener(_0x7913('0x6')+_0x37f46b,_0x1ba461);SmsAccountEvents['on'](_0x37f46b,_0x479929);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 373f3bf..9fd50ae 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 _0x86d7=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','show','create','put','/:id','update','delete','destroy'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x86d7,0x144));var _0x786d=function(_0x384c96,_0x363897){_0x384c96=_0x384c96-0x0;var _0x145217=_0x86d7[_0x384c96];return _0x145217;};'use strict';var multer=require(_0x786d('0x0'));var util=require(_0x786d('0x1'));var path=require(_0x786d('0x2'));var timeout=require(_0x786d('0x3'));var express=require(_0x786d('0x4'));var router=express[_0x786d('0x5')]();var auth=require(_0x786d('0x6'));var interaction=require(_0x786d('0x7'));var config=require('../../config/environment');var controller=require(_0x786d('0x8'));router[_0x786d('0x9')]('/',auth[_0x786d('0xa')](),controller['index']);router[_0x786d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x786d('0xb')]);router['post']('/',auth[_0x786d('0xa')](),controller[_0x786d('0xc')]);router[_0x786d('0xd')](_0x786d('0xe'),auth['isAuthenticated'](),controller[_0x786d('0xf')]);router[_0x786d('0x10')](_0x786d('0xe'),auth[_0x786d('0xa')](),controller[_0x786d('0x11')]);module[_0x786d('0x12')]=router; \ No newline at end of file +var _0x23c2=['put','delete','destroy','exports','express','Router','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x26bb15,_0x39b070){var _0x7aa58a=function(_0x25a1b6){while(--_0x25a1b6){_0x26bb15['push'](_0x26bb15['shift']());}};_0x7aa58a(++_0x39b070);}(_0x23c2,0x199));var _0x223c=function(_0x118d61,_0x2410d8){_0x118d61=_0x118d61-0x0;var _0x45c03c=_0x23c2[_0x118d61];return _0x45c03c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x223c('0x0'));var router=express[_0x223c('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x223c('0x2'));var config=require(_0x223c('0x3'));var controller=require(_0x223c('0x4'));router[_0x223c('0x5')]('/',auth[_0x223c('0x6')](),controller[_0x223c('0x7')]);router[_0x223c('0x5')](_0x223c('0x8'),auth[_0x223c('0x6')](),controller['show']);router[_0x223c('0x9')]('/',auth[_0x223c('0x6')](),controller[_0x223c('0xa')]);router[_0x223c('0xb')](_0x223c('0x8'),auth[_0x223c('0x6')](),controller['update']);router[_0x223c('0xc')](_0x223c('0x8'),auth[_0x223c('0x6')](),controller[_0x223c('0xd')]);module[_0x223c('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 84037d5..0af8a94 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 _0x784b=['TEXT','sequelize','exports','STRING'];(function(_0x4337b4,_0x25732b){var _0x55da4e=function(_0x24562e){while(--_0x24562e){_0x4337b4['push'](_0x4337b4['shift']());}};_0x55da4e(++_0x25732b);}(_0x784b,0x149));var _0xb784=function(_0x44671c,_0x2a7436){_0x44671c=_0x44671c-0x0;var _0x5a61bc=_0x784b[_0x44671c];return _0x5a61bc;};'use strict';var Sequelize=require(_0xb784('0x0'));module[_0xb784('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb784('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb784('0x3')]()},'description':{'type':Sequelize[_0xb784('0x2')]},'interval':{'type':Sequelize[_0xb784('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0715=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x479fa1,_0x3a89b8){var _0x342aca=function(_0xaa7a8c){while(--_0xaa7a8c){_0x479fa1['push'](_0x479fa1['shift']());}};_0x342aca(++_0x3a89b8);}(_0x0715,0x1f4));var _0x5071=function(_0x3fddf2,_0x110b15){_0x3fddf2=_0x3fddf2-0x0;var _0x539bf2=_0x0715[_0x3fddf2];return _0x539bf2;};'use strict';var Sequelize=require('sequelize');module[_0x5071('0x0')]={'priority':{'type':Sequelize[_0x5071('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5071('0x2')],'allowNull':![],'defaultValue':_0x5071('0x3')},'appdata':{'type':Sequelize[_0x5071('0x4')]()},'description':{'type':Sequelize[_0x5071('0x2')]},'interval':{'type':Sequelize[_0x5071('0x2')],'defaultValue':_0x5071('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 48b9f28..aa64c91 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 _0xab40=['show','params','include','find','catch','create','body','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','update','destroy','name','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','limit','offset','order','where','pick','filter','merge','map','VIRTUAL','options','SmsApplication','then','includeAll','findAll'];(function(_0x2fc54e,_0x402e5c){var _0x55d2b3=function(_0xa28e9c){while(--_0xa28e9c){_0x2fc54e['push'](_0x2fc54e['shift']());}};_0x55d2b3(++_0x402e5c);}(_0xab40,0xcd));var _0x0ab4=function(_0x5de62d,_0xa44a9){_0x5de62d=_0x5de62d-0x0;var _0x174133=_0xab40[_0x5de62d];return _0x174133;};'use strict';var pdf=require(_0x0ab4('0x0'));var emlformat=require(_0x0ab4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0ab4('0x2'));var moment=require(_0x0ab4('0x3'));var BPromise=require(_0x0ab4('0x4'));var Mustache=require(_0x0ab4('0x5'));var util=require(_0x0ab4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0ab4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var Redis=require(_0x0ab4('0xd'));var authService=require(_0x0ab4('0xe'));var qs=require(_0x0ab4('0xf'));var as=require(_0x0ab4('0x10'));var hardwareService=require(_0x0ab4('0x11'));var logger=require(_0x0ab4('0x12'))(_0x0ab4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0ab4('0x14'))['db'];function respondWithStatusCode(_0x4c21b0,_0x249dc3){_0x249dc3=_0x249dc3||0xcc;return function(_0x45e6fd){if(_0x45e6fd){return _0x4c21b0[_0x0ab4('0x15')](_0x249dc3);}return _0x4c21b0[_0x0ab4('0x16')](_0x249dc3)[_0x0ab4('0x17')]();};}function respondWithResult(_0x329104,_0x112162){_0x112162=_0x112162||0xc8;return function(_0x2cc644){if(_0x2cc644){return _0x329104[_0x0ab4('0x16')](_0x112162)[_0x0ab4('0x18')](_0x2cc644);}};}function respondWithFilteredResult(_0x216a17,_0x36d246){return function(_0x293e20){if(_0x293e20){var _0x45fad1=_0x293e20[_0x0ab4('0x19')],_0x2a83a8=_0x36d246['offset'],_0x2403db=_0x36d246['offset']+_0x36d246['limit'],_0x283b15;if(_0x2403db>=_0x45fad1){_0x2403db=_0x45fad1;_0x283b15=0xc8;}else{_0x283b15=0xce;}_0x216a17[_0x0ab4('0x16')](_0x283b15);return _0x216a17[_0x0ab4('0x1a')](_0x0ab4('0x1b'),_0x2a83a8+'-'+_0x2403db+'/'+_0x45fad1)['json'](_0x293e20);}return null;};}function patchUpdates(_0x1e3fe2){return function(_0x13ea9f){try{jsonpatch[_0x0ab4('0x1c')](_0x13ea9f,_0x1e3fe2,!![]);}catch(_0x31ee29){return BPromise['reject'](_0x31ee29);}return _0x13ea9f['save']();};}function saveUpdates(_0xdb0797,_0x5b1ed5){return function(_0x2b0e29){if(_0x2b0e29){return _0x2b0e29[_0x0ab4('0x1d')](_0xdb0797)['then'](function(_0xacd68e){return _0xacd68e;});}return null;};}function removeEntity(_0x430b89,_0x2c55b3){return function(_0x1d5c14){if(_0x1d5c14){return _0x1d5c14[_0x0ab4('0x1e')]()['then'](function(){_0x430b89['status'](0xcc)[_0x0ab4('0x17')]();});}};}function handleEntityNotFound(_0x14087f,_0x392afe){return function(_0x13c882){if(!_0x13c882){_0x14087f['sendStatus'](0x194);}return _0x13c882;};}function handleError(_0x42d2dd,_0x3caa9d){_0x3caa9d=_0x3caa9d||0x1f4;return function(_0x32b14a){logger['error'](_0x32b14a['stack']);if(_0x32b14a[_0x0ab4('0x1f')]){delete _0x32b14a[_0x0ab4('0x1f')];}_0x42d2dd[_0x0ab4('0x16')](_0x3caa9d)['send'](_0x32b14a);};}exports['index']=function(_0x49c72d,_0x19ecc6){var _0x5ba3a2={},_0x3bf844={},_0x3b4621={'count':0x0,'rows':[]};var _0x4f1aeb=_['map'](db['SmsApplication'][_0x0ab4('0x20')],function(_0x183bac){return{'name':_0x183bac[_0x0ab4('0x21')],'type':_0x183bac[_0x0ab4('0x22')][_0x0ab4('0x23')]};});_0x3bf844['model']=_['map'](_0x4f1aeb,'name');_0x3bf844[_0x0ab4('0x24')]=_[_0x0ab4('0x25')](_0x49c72d[_0x0ab4('0x24')]);_0x3bf844[_0x0ab4('0x26')]=_[_0x0ab4('0x27')](_0x3bf844['model'],_0x3bf844['query']);_0x5ba3a2[_0x0ab4('0x28')]=_[_0x0ab4('0x27')](_0x3bf844[_0x0ab4('0x29')],qs['fields'](_0x49c72d['query'][_0x0ab4('0x2a')]));_0x5ba3a2['attributes']=_0x5ba3a2[_0x0ab4('0x28')][_0x0ab4('0x2b')]?_0x5ba3a2[_0x0ab4('0x28')]:_0x3bf844[_0x0ab4('0x29')];if(!_0x49c72d[_0x0ab4('0x24')][_0x0ab4('0x2c')]('nolimit')){_0x5ba3a2[_0x0ab4('0x2d')]=qs[_0x0ab4('0x2d')](_0x49c72d[_0x0ab4('0x24')][_0x0ab4('0x2d')]);_0x5ba3a2['offset']=qs['offset'](_0x49c72d[_0x0ab4('0x24')][_0x0ab4('0x2e')]);}_0x5ba3a2[_0x0ab4('0x2f')]=qs['sort'](_0x49c72d['query']['sort']);_0x5ba3a2[_0x0ab4('0x30')]=qs[_0x0ab4('0x26')](_[_0x0ab4('0x31')](_0x49c72d['query'],_0x3bf844['filters']),_0x4f1aeb);if(_0x49c72d['query'][_0x0ab4('0x32')]){_0x5ba3a2[_0x0ab4('0x30')]=_[_0x0ab4('0x33')](_0x5ba3a2[_0x0ab4('0x30')],{'$or':_[_0x0ab4('0x34')](_0x4f1aeb,function(_0x70f561){if(_0x70f561[_0x0ab4('0x22')]!==_0x0ab4('0x35')){var _0x3ef580={};_0x3ef580[_0x70f561[_0x0ab4('0x1f')]]={'$like':'%'+_0x49c72d['query'][_0x0ab4('0x32')]+'%'};return _0x3ef580;}})});}_0x5ba3a2=_[_0x0ab4('0x33')]({},_0x5ba3a2,_0x49c72d[_0x0ab4('0x36')]);var _0x97d4ad={'where':_0x5ba3a2[_0x0ab4('0x30')]};return db[_0x0ab4('0x37')][_0x0ab4('0x19')](_0x97d4ad)[_0x0ab4('0x38')](function(_0x37b53b){_0x3b4621[_0x0ab4('0x19')]=_0x37b53b;if(_0x49c72d[_0x0ab4('0x24')][_0x0ab4('0x39')]){_0x5ba3a2['include']=[{'all':!![]}];}return db[_0x0ab4('0x37')][_0x0ab4('0x3a')](_0x5ba3a2);})[_0x0ab4('0x38')](function(_0x3acb8d){_0x3b4621['rows']=_0x3acb8d;return _0x3b4621;})[_0x0ab4('0x38')](respondWithFilteredResult(_0x19ecc6,_0x5ba3a2))['catch'](handleError(_0x19ecc6,null));};exports[_0x0ab4('0x3b')]=function(_0x454e3d,_0x248a58){var _0x245021={'raw':!![],'where':{'id':_0x454e3d[_0x0ab4('0x3c')]['id']}},_0xd2293={};_0xd2293['model']=_[_0x0ab4('0x25')](db[_0x0ab4('0x37')][_0x0ab4('0x20')]);_0xd2293['query']=_[_0x0ab4('0x25')](_0x454e3d[_0x0ab4('0x24')]);_0xd2293[_0x0ab4('0x26')]=_[_0x0ab4('0x27')](_0xd2293[_0x0ab4('0x29')],_0xd2293['query']);_0x245021['attributes']=_['intersection'](_0xd2293[_0x0ab4('0x29')],qs[_0x0ab4('0x2a')](_0x454e3d['query'][_0x0ab4('0x2a')]));_0x245021['attributes']=_0x245021[_0x0ab4('0x28')]['length']?_0x245021[_0x0ab4('0x28')]:_0xd2293[_0x0ab4('0x29')];if(_0x454e3d[_0x0ab4('0x24')][_0x0ab4('0x39')]){_0x245021[_0x0ab4('0x3d')]=[{'all':!![]}];}_0x245021=_[_0x0ab4('0x33')]({},_0x245021,_0x454e3d['options']);return db[_0x0ab4('0x37')][_0x0ab4('0x3e')](_0x245021)[_0x0ab4('0x38')](handleEntityNotFound(_0x248a58,null))[_0x0ab4('0x38')](respondWithResult(_0x248a58,null))[_0x0ab4('0x3f')](handleError(_0x248a58,null));};exports[_0x0ab4('0x40')]=function(_0x54c201,_0x9b2c74){return db['SmsApplication'][_0x0ab4('0x40')](_0x54c201[_0x0ab4('0x41')],{})[_0x0ab4('0x38')](respondWithResult(_0x9b2c74,0xc9))['catch'](handleError(_0x9b2c74,null));};exports[_0x0ab4('0x1d')]=function(_0x1fcc3b,_0x1ce096){if(_0x1fcc3b[_0x0ab4('0x41')]['id']){delete _0x1fcc3b[_0x0ab4('0x41')]['id'];}return db[_0x0ab4('0x37')]['find']({'where':{'id':_0x1fcc3b[_0x0ab4('0x3c')]['id']}})[_0x0ab4('0x38')](handleEntityNotFound(_0x1ce096,null))[_0x0ab4('0x38')](saveUpdates(_0x1fcc3b[_0x0ab4('0x41')],null))[_0x0ab4('0x38')](respondWithResult(_0x1ce096,null))[_0x0ab4('0x3f')](handleError(_0x1ce096,null));};exports[_0x0ab4('0x1e')]=function(_0x356bc9,_0x22402e){return db[_0x0ab4('0x37')][_0x0ab4('0x3e')]({'where':{'id':_0x356bc9[_0x0ab4('0x3c')]['id']}})[_0x0ab4('0x38')](handleEntityNotFound(_0x22402e,null))['then'](removeEntity(_0x22402e,null))[_0x0ab4('0x3f')](handleError(_0x22402e,null));}; \ No newline at end of file +var _0xfcbb=['../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','then','end','sendStatus','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x2c515d,_0x420b13){_0x2c515d=_0x2c515d-0x0;var _0x17bd36=_0xfcbb[_0x2c515d];return _0x17bd36;};'use strict';var pdf=require(_0xbfcb('0x0'));var emlformat=require(_0xbfcb('0x1'));var rimraf=require(_0xbfcb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbfcb('0x3'));var moment=require(_0xbfcb('0x4'));var BPromise=require(_0xbfcb('0x5'));var Mustache=require(_0xbfcb('0x6'));var util=require(_0xbfcb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbfcb('0x8'));var ejs=require(_0xbfcb('0x9'));var fs=require('fs');var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var db=require(_0xbfcb('0x18'))['db'];function respondWithStatusCode(_0x583513,_0xb2f601){_0xb2f601=_0xb2f601||0xcc;return function(_0x2268da){if(_0x2268da){return _0x583513['sendStatus'](_0xb2f601);}return _0x583513[_0xbfcb('0x19')](_0xb2f601)['end']();};}function respondWithResult(_0x211a30,_0x1c52df){_0x1c52df=_0x1c52df||0xc8;return function(_0x44ad6c){if(_0x44ad6c){return _0x211a30[_0xbfcb('0x19')](_0x1c52df)[_0xbfcb('0x1a')](_0x44ad6c);}};}function respondWithFilteredResult(_0xe47707,_0x71304e){return function(_0x2d314a){if(_0x2d314a){var _0x90ed8c=_0x2d314a[_0xbfcb('0x1b')],_0x339347=_0x71304e[_0xbfcb('0x1c')],_0x2c4a85=_0x71304e[_0xbfcb('0x1c')]+_0x71304e[_0xbfcb('0x1d')],_0x3f847f;if(_0x2c4a85>=_0x90ed8c){_0x2c4a85=_0x90ed8c;_0x3f847f=0xc8;}else{_0x3f847f=0xce;}_0xe47707[_0xbfcb('0x19')](_0x3f847f);return _0xe47707[_0xbfcb('0x1e')](_0xbfcb('0x1f'),_0x339347+'-'+_0x2c4a85+'/'+_0x90ed8c)[_0xbfcb('0x1a')](_0x2d314a);}return null;};}function patchUpdates(_0xccd6ff){return function(_0x25afa3){try{jsonpatch['apply'](_0x25afa3,_0xccd6ff,!![]);}catch(_0x26451d){return BPromise[_0xbfcb('0x20')](_0x26451d);}return _0x25afa3['save']();};}function saveUpdates(_0xa3c089,_0x1a7225){return function(_0x48c3c8){if(_0x48c3c8){return _0x48c3c8['update'](_0xa3c089)[_0xbfcb('0x21')](function(_0x45f0a0){return _0x45f0a0;});}return null;};}function removeEntity(_0x2bd235,_0x45661a){return function(_0x1c5924){if(_0x1c5924){return _0x1c5924['destroy']()[_0xbfcb('0x21')](function(){_0x2bd235[_0xbfcb('0x19')](0xcc)[_0xbfcb('0x22')]();});}};}function handleEntityNotFound(_0xd4d29,_0x1651e5){return function(_0x19616c){if(!_0x19616c){_0xd4d29[_0xbfcb('0x23')](0x194);}return _0x19616c;};}function handleError(_0x14e43c,_0x11f6f7){_0x11f6f7=_0x11f6f7||0x1f4;return function(_0x13e101){logger[_0xbfcb('0x24')](_0x13e101[_0xbfcb('0x25')]);if(_0x13e101[_0xbfcb('0x26')]){delete _0x13e101[_0xbfcb('0x26')];}_0x14e43c[_0xbfcb('0x19')](_0x11f6f7)[_0xbfcb('0x27')](_0x13e101);};}exports['index']=function(_0x3465f5,_0x2881f8){var _0x4cf7ca={},_0x64a69={},_0x15197b={'count':0x0,'rows':[]};var _0x781773=_[_0xbfcb('0x28')](db[_0xbfcb('0x29')][_0xbfcb('0x2a')],function(_0x4069a7){return{'name':_0x4069a7[_0xbfcb('0x2b')],'type':_0x4069a7[_0xbfcb('0x2c')][_0xbfcb('0x2d')]};});_0x64a69['model']=_[_0xbfcb('0x28')](_0x781773,_0xbfcb('0x26'));_0x64a69[_0xbfcb('0x2e')]=_[_0xbfcb('0x2f')](_0x3465f5[_0xbfcb('0x2e')]);_0x64a69[_0xbfcb('0x30')]=_[_0xbfcb('0x31')](_0x64a69[_0xbfcb('0x32')],_0x64a69[_0xbfcb('0x2e')]);_0x4cf7ca['attributes']=_[_0xbfcb('0x31')](_0x64a69[_0xbfcb('0x32')],qs[_0xbfcb('0x33')](_0x3465f5[_0xbfcb('0x2e')]['fields']));_0x4cf7ca['attributes']=_0x4cf7ca[_0xbfcb('0x34')][_0xbfcb('0x35')]?_0x4cf7ca[_0xbfcb('0x34')]:_0x64a69[_0xbfcb('0x32')];if(!_0x3465f5[_0xbfcb('0x2e')][_0xbfcb('0x36')](_0xbfcb('0x37'))){_0x4cf7ca['limit']=qs['limit'](_0x3465f5['query'][_0xbfcb('0x1d')]);_0x4cf7ca['offset']=qs[_0xbfcb('0x1c')](_0x3465f5[_0xbfcb('0x2e')]['offset']);}_0x4cf7ca['order']=qs[_0xbfcb('0x38')](_0x3465f5[_0xbfcb('0x2e')][_0xbfcb('0x38')]);_0x4cf7ca[_0xbfcb('0x39')]=qs['filters'](_[_0xbfcb('0x3a')](_0x3465f5[_0xbfcb('0x2e')],_0x64a69['filters']),_0x781773);if(_0x3465f5['query'][_0xbfcb('0x3b')]){_0x4cf7ca['where']=_['merge'](_0x4cf7ca[_0xbfcb('0x39')],{'$or':_[_0xbfcb('0x28')](_0x781773,function(_0x43ec1b){if(_0x43ec1b[_0xbfcb('0x2c')]!=='VIRTUAL'){var _0x3b0a7a={};_0x3b0a7a[_0x43ec1b[_0xbfcb('0x26')]]={'$like':'%'+_0x3465f5[_0xbfcb('0x2e')][_0xbfcb('0x3b')]+'%'};return _0x3b0a7a;}})});}_0x4cf7ca=_[_0xbfcb('0x3c')]({},_0x4cf7ca,_0x3465f5[_0xbfcb('0x3d')]);var _0x53111c={'where':_0x4cf7ca[_0xbfcb('0x39')]};return db['SmsApplication'][_0xbfcb('0x1b')](_0x53111c)['then'](function(_0x809fde){_0x15197b[_0xbfcb('0x1b')]=_0x809fde;if(_0x3465f5[_0xbfcb('0x2e')][_0xbfcb('0x3e')]){_0x4cf7ca[_0xbfcb('0x3f')]=[{'all':!![]}];}return db[_0xbfcb('0x29')][_0xbfcb('0x40')](_0x4cf7ca);})[_0xbfcb('0x21')](function(_0x3a98e0){_0x15197b[_0xbfcb('0x41')]=_0x3a98e0;return _0x15197b;})['then'](respondWithFilteredResult(_0x2881f8,_0x4cf7ca))[_0xbfcb('0x42')](handleError(_0x2881f8,null));};exports[_0xbfcb('0x43')]=function(_0x49685f,_0x2f6f54){var _0x306ea4={'raw':!![],'where':{'id':_0x49685f[_0xbfcb('0x44')]['id']}},_0x269102={};_0x269102[_0xbfcb('0x32')]=_[_0xbfcb('0x2f')](db['SmsApplication'][_0xbfcb('0x2a')]);_0x269102[_0xbfcb('0x2e')]=_[_0xbfcb('0x2f')](_0x49685f['query']);_0x269102[_0xbfcb('0x30')]=_[_0xbfcb('0x31')](_0x269102[_0xbfcb('0x32')],_0x269102['query']);_0x306ea4[_0xbfcb('0x34')]=_[_0xbfcb('0x31')](_0x269102['model'],qs['fields'](_0x49685f[_0xbfcb('0x2e')][_0xbfcb('0x33')]));_0x306ea4['attributes']=_0x306ea4[_0xbfcb('0x34')][_0xbfcb('0x35')]?_0x306ea4['attributes']:_0x269102[_0xbfcb('0x32')];if(_0x49685f[_0xbfcb('0x2e')][_0xbfcb('0x3e')]){_0x306ea4[_0xbfcb('0x3f')]=[{'all':!![]}];}_0x306ea4=_[_0xbfcb('0x3c')]({},_0x306ea4,_0x49685f[_0xbfcb('0x3d')]);return db[_0xbfcb('0x29')][_0xbfcb('0x45')](_0x306ea4)[_0xbfcb('0x21')](handleEntityNotFound(_0x2f6f54,null))[_0xbfcb('0x21')](respondWithResult(_0x2f6f54,null))[_0xbfcb('0x42')](handleError(_0x2f6f54,null));};exports[_0xbfcb('0x46')]=function(_0x5f307b,_0x12889b){return db[_0xbfcb('0x29')][_0xbfcb('0x46')](_0x5f307b['body'],{})[_0xbfcb('0x21')](respondWithResult(_0x12889b,0xc9))['catch'](handleError(_0x12889b,null));};exports['update']=function(_0x2dcfb3,_0x20918c){if(_0x2dcfb3[_0xbfcb('0x47')]['id']){delete _0x2dcfb3['body']['id'];}return db[_0xbfcb('0x29')]['find']({'where':{'id':_0x2dcfb3['params']['id']}})[_0xbfcb('0x21')](handleEntityNotFound(_0x20918c,null))['then'](saveUpdates(_0x2dcfb3[_0xbfcb('0x47')],null))[_0xbfcb('0x21')](respondWithResult(_0x20918c,null))['catch'](handleError(_0x20918c,null));};exports[_0xbfcb('0x48')]=function(_0x5d942f,_0x8347be){return db['SmsApplication'][_0xbfcb('0x45')]({'where':{'id':_0x5d942f['params']['id']}})[_0xbfcb('0x21')](handleEntityNotFound(_0x8347be,null))[_0xbfcb('0x21')](removeEntity(_0x8347be,null))['catch'](handleError(_0x8347be,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 3da187b..a92a8b8 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 _0x93d2=['path','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x53f74c,_0xd71010){var _0x467bc0=function(_0x58ab34){while(--_0x58ab34){_0x53f74c['push'](_0x53f74c['shift']());}};_0x467bc0(++_0xd71010);}(_0x93d2,0x1e9));var _0x293d=function(_0x452450,_0x40b419){_0x452450=_0x452450-0x0;var _0x448b19=_0x93d2[_0x452450];return _0x448b19;};'use strict';var _=require(_0x293d('0x0'));var util=require(_0x293d('0x1'));var logger=require(_0x293d('0x2'))(_0x293d('0x3'));var moment=require(_0x293d('0x4'));var BPromise=require(_0x293d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x293d('0x6'));var rimraf=require('rimraf');var config=require(_0x293d('0x7'));var attributes=require(_0x293d('0x8'));module[_0x293d('0x9')]=function(_0x239a98,_0x56b3a6){return _0x239a98[_0x293d('0xa')](_0x293d('0xb'),attributes,{'tableName':_0x293d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x293d('0xd'),'collate':_0x293d('0xe')});}; \ No newline at end of file +var _0x2846=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x223a3e,_0x2da798){var _0x582005=function(_0x4adba8){while(--_0x4adba8){_0x223a3e['push'](_0x223a3e['shift']());}};_0x582005(++_0x2da798);}(_0x2846,0x1a0));var _0x6284=function(_0x2f0829,_0x375d74){_0x2f0829=_0x2f0829-0x0;var _0xb45c6f=_0x2846[_0x2f0829];return _0xb45c6f;};'use strict';var _=require('lodash');var util=require(_0x6284('0x0'));var logger=require(_0x6284('0x1'))(_0x6284('0x2'));var moment=require(_0x6284('0x3'));var BPromise=require(_0x6284('0x4'));var rp=require(_0x6284('0x5'));var fs=require('fs');var path=require(_0x6284('0x6'));var rimraf=require(_0x6284('0x7'));var config=require(_0x6284('0x8'));var attributes=require(_0x6284('0x9'));module[_0x6284('0xa')]=function(_0xb63fbb,_0x5d3500){return _0xb63fbb[_0x6284('0xb')](_0x6284('0xc'),attributes,{'tableName':_0x6284('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6284('0xe'),'collate':_0x6284('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 19035c6..f8d4be1 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 _0x2caf=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsApplication,\x20%s,\x20%s','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x520758,_0x5113b7){var _0x49b8c3=function(_0x5a3cd0){while(--_0x5a3cd0){_0x520758['push'](_0x520758['shift']());}};_0x49b8c3(++_0x5113b7);}(_0x2caf,0x6a));var _0xf2ca=function(_0x45c4f9,_0x49a7af){_0x45c4f9=_0x45c4f9-0x0;var _0x4c2a46=_0x2caf[_0x45c4f9];return _0x4c2a46;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf2ca('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2ca('0x1'));var db=require(_0xf2ca('0x2'))['db'];var utils=require(_0xf2ca('0x3'));var logger=require(_0xf2ca('0x4'))(_0xf2ca('0x5'));var config=require(_0xf2ca('0x6'));var jayson=require(_0xf2ca('0x7'));var client=jayson['client'][_0xf2ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4292b4,_0x16cabd,_0x57e3e8){return new BPromise(function(_0x4ea38c,_0x2fbb08){return client[_0xf2ca('0x9')](_0x4292b4,_0x57e3e8)[_0xf2ca('0xa')](function(_0x1cf4a0){logger[_0xf2ca('0xb')]('SmsApplication,\x20%s,\x20%s',_0x16cabd,_0xf2ca('0xc'));logger[_0xf2ca('0xd')](_0xf2ca('0xe'),_0x16cabd,_0xf2ca('0xc'),JSON[_0xf2ca('0xf')](_0x1cf4a0));if(_0x1cf4a0[_0xf2ca('0x10')]){if(_0x1cf4a0['error'][_0xf2ca('0x11')]===0x1f4){logger[_0xf2ca('0x10')]('SmsApplication,\x20%s,\x20%s',_0x16cabd,_0x1cf4a0[_0xf2ca('0x10')][_0xf2ca('0x12')]);return _0x2fbb08(_0x1cf4a0['error']['message']);}logger[_0xf2ca('0x10')]('SmsApplication,\x20%s,\x20%s',_0x16cabd,_0x1cf4a0[_0xf2ca('0x10')][_0xf2ca('0x12')]);return _0x4ea38c(_0x1cf4a0[_0xf2ca('0x10')][_0xf2ca('0x12')]);}else{logger[_0xf2ca('0xb')](_0xf2ca('0x13'),_0x16cabd,_0xf2ca('0xc'));_0x4ea38c(_0x1cf4a0['result'][_0xf2ca('0x12')]);}})['catch'](function(_0x2d12bb){logger['error'](_0xf2ca('0x13'),_0x16cabd,_0x2d12bb);_0x2fbb08(_0x2d12bb);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x38546e,_0x4a20f2){var _0x2d914a=function(_0x39490c){while(--_0x39490c){_0x38546e['push'](_0x38546e['shift']());}};_0x2d914a(++_0x4a20f2);}(_0xe14b,0x93));var _0xbe14=function(_0x3d1378,_0x509e8d){_0x3d1378=_0x3d1378-0x0;var _0x4c8ee4=_0xe14b[_0x3d1378];return _0x4c8ee4;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 41d6d99..fd51bc4 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 _0x565e=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','multer'];(function(_0x56066c,_0x1ebb36){var _0x59d6f0=function(_0x2088a7){while(--_0x2088a7){_0x56066c['push'](_0x56066c['shift']());}};_0x59d6f0(++_0x1ebb36);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe565('0x0'));var util=require('util');var path=require(_0xe565('0x1'));var timeout=require(_0xe565('0x2'));var express=require(_0xe565('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe565('0x4'));var config=require(_0xe565('0x5'));var controller=require(_0xe565('0x6'));router[_0xe565('0x7')]('/',auth[_0xe565('0x8')](),controller[_0xe565('0x9')]);router[_0xe565('0x7')](_0xe565('0xa'),auth[_0xe565('0x8')](),controller[_0xe565('0xb')]);router[_0xe565('0x7')](_0xe565('0xc'),auth[_0xe565('0x8')](),controller[_0xe565('0xd')]);router[_0xe565('0x7')](_0xe565('0xe'),auth['isAuthenticated'](),controller[_0xe565('0xf')]);router[_0xe565('0x7')](_0xe565('0x10'),auth['isAuthenticated'](),controller[_0xe565('0x11')]);router[_0xe565('0x12')]('/',auth[_0xe565('0x8')](),controller[_0xe565('0x13')]);router['post'](_0xe565('0xe'),auth['isAuthenticated'](),controller[_0xe565('0x14')]);router['post'](_0xe565('0x15'),auth[_0xe565('0x8')](),interaction[_0xe565('0x16')]('sms',_0xe565('0x17')),controller[_0xe565('0x18')]);router[_0xe565('0x19')](_0xe565('0xc'),auth['isAuthenticated'](),interaction[_0xe565('0x16')](_0xe565('0x1a'),_0xe565('0x1b')),controller[_0xe565('0x1c')]);router[_0xe565('0x1d')](_0xe565('0xc'),auth['isAuthenticated'](),interaction[_0xe565('0x16')](_0xe565('0x1a'),_0xe565('0x1e')),controller[_0xe565('0x1f')]);router['delete'](_0xe565('0x15'),auth[_0xe565('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xb199=['sms','smsinteraction:addtags','addTags','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','post','/:id/messages','tracked'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xb199,0xdc));var _0x9b19=function(_0x536712,_0x71206a){_0x536712=_0x536712-0x0;var _0x2cbf65=_0xb199[_0x536712];return _0x2cbf65;};'use strict';var multer=require('multer');var util=require(_0x9b19('0x0'));var path=require(_0x9b19('0x1'));var timeout=require(_0x9b19('0x2'));var express=require(_0x9b19('0x3'));var router=express['Router']();var auth=require(_0x9b19('0x4'));var interaction=require(_0x9b19('0x5'));var config=require(_0x9b19('0x6'));var controller=require(_0x9b19('0x7'));router[_0x9b19('0x8')]('/',auth[_0x9b19('0x9')](),controller[_0x9b19('0xa')]);router['get'](_0x9b19('0xb'),auth[_0x9b19('0x9')](),controller[_0x9b19('0xc')]);router[_0x9b19('0x8')](_0x9b19('0xd'),auth[_0x9b19('0x9')](),controller[_0x9b19('0xe')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x9b19('0xf')]);router['get']('/:id/download',auth[_0x9b19('0x9')](),controller[_0x9b19('0x10')]);router[_0x9b19('0x11')]('/',auth[_0x9b19('0x9')](),controller['create']);router[_0x9b19('0x11')](_0x9b19('0x12'),auth['isAuthenticated'](),controller['addMessage']);router[_0x9b19('0x11')]('/:id/tags',auth[_0x9b19('0x9')](),interaction[_0x9b19('0x13')](_0x9b19('0x14'),_0x9b19('0x15')),controller[_0x9b19('0x16')]);router['put']('/:id',auth[_0x9b19('0x9')](),interaction[_0x9b19('0x13')]('sms','smsinteraction:update'),controller[_0x9b19('0x17')]);router['delete'](_0x9b19('0xd'),auth['isAuthenticated'](),interaction[_0x9b19('0x13')](_0x9b19('0x14'),_0x9b19('0x18')),controller[_0x9b19('0x19')]);router[_0x9b19('0x1a')](_0x9b19('0x1b'),auth[_0x9b19('0x9')](),controller[_0x9b19('0x1c')]);module[_0x9b19('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 2940200..d97d246 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 _0xe706=['ENUM','out','sequelize','moment','exports','DATE','STRING'];(function(_0x5362f2,_0x17a236){var _0x9c2059=function(_0x20a7a6){while(--_0x20a7a6){_0x5362f2['push'](_0x5362f2['shift']());}};_0x9c2059(++_0x17a236);}(_0xe706,0xa3));var _0x6e70=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0xe706[_0x231dda];return _0x3f88cb;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize[_0x6e70('0x4')]},'note':{'type':Sequelize[_0x6e70('0x4')]},'phone':{'type':Sequelize[_0x6e70('0x4')]},'read1stAt':{'type':Sequelize[_0x6e70('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6e70('0x5')]('in',_0x6e70('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6e70('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6e70('0x5')]('in',_0x6e70('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd8b0=['moment','STRING','DATE','ENUM','out','sequelize'];(function(_0x1b1604,_0x368535){var _0x57918d=function(_0x176c51){while(--_0x176c51){_0x1b1604['push'](_0x1b1604['shift']());}};_0x57918d(++_0x368535);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 795973a..047f616 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 _0x41bb=['reject','save','update','then','destroy','stack','name','send','Users','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','from','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','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','Tag','map','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','isEmpty','SmsAccountId','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','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','clone','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','toString','count','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','params','include','options','create','body','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','findAll','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','join','server','tmp','files','attachments','format','fullname','firstName','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','apply'];(function(_0x13e2df,_0x376a54){var _0x2d7086=function(_0x1264f4){while(--_0x1264f4){_0x13e2df['push'](_0x13e2df['shift']());}};_0x2d7086(++_0x376a54);}(_0x41bb,0xc5));var _0xb41b=function(_0x32559d,_0x341473){_0x32559d=_0x32559d-0x0;var _0x466cf9=_0x41bb[_0x32559d];return _0x466cf9;};'use strict';var pdf=require(_0xb41b('0x0'));var emlformat=require(_0xb41b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb41b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb41b('0x3'));var moment=require(_0xb41b('0x4'));var BPromise=require(_0xb41b('0x5'));var Mustache=require(_0xb41b('0x6'));var util=require('util');var path=require(_0xb41b('0x7'));var sox=require(_0xb41b('0x8'));var csv=require(_0xb41b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb41b('0xa'));var jsforce=require(_0xb41b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb41b('0x9'));var querystring=require(_0xb41b('0xc'));var Papa=require(_0xb41b('0xd'));var Redis=require(_0xb41b('0xe'));var authService=require(_0xb41b('0xf'));var qs=require(_0xb41b('0x10'));var as=require(_0xb41b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb41b('0x12'))('api');var utils=require(_0xb41b('0x13'));var config=require(_0xb41b('0x14'));var db=require(_0xb41b('0x15'))['db'];config[_0xb41b('0x16')]=_[_0xb41b('0x17')](config['redis'],{'host':_0xb41b('0x18'),'port':0x18eb});var socket=require(_0xb41b('0x19'))(new Redis(config[_0xb41b('0x16')]));require(_0xb41b('0x1a'))[_0xb41b('0x1b')](socket);function respondWithStatusCode(_0x4e8603,_0x4e7f11){_0x4e7f11=_0x4e7f11||0xcc;return function(_0x55e507){if(_0x55e507){return _0x4e8603[_0xb41b('0x1c')](_0x4e7f11);}return _0x4e8603[_0xb41b('0x1d')](_0x4e7f11)[_0xb41b('0x1e')]();};}function respondWithResult(_0x338920,_0x29ea51){_0x29ea51=_0x29ea51||0xc8;return function(_0x54591e){if(_0x54591e){return _0x338920[_0xb41b('0x1d')](_0x29ea51)[_0xb41b('0x1f')](_0x54591e);}};}function respondWithFilteredResult(_0x401dd9,_0xcf0728){return function(_0x43f4ea){if(_0x43f4ea){var _0x47154d=_0x43f4ea['count'],_0x198783=_0xcf0728[_0xb41b('0x20')],_0x5df8c2=_0xcf0728['offset']+_0xcf0728[_0xb41b('0x21')],_0x4b3580;if(_0x5df8c2>=_0x47154d){_0x5df8c2=_0x47154d;_0x4b3580=0xc8;}else{_0x4b3580=0xce;}_0x401dd9[_0xb41b('0x1d')](_0x4b3580);return _0x401dd9[_0xb41b('0x22')]('Content-Range',_0x198783+'-'+_0x5df8c2+'/'+_0x47154d)['json'](_0x43f4ea);}return null;};}function patchUpdates(_0x1a1386){return function(_0x3b6ffb){try{jsonpatch[_0xb41b('0x23')](_0x3b6ffb,_0x1a1386,!![]);}catch(_0x2373f4){return BPromise[_0xb41b('0x24')](_0x2373f4);}return _0x3b6ffb[_0xb41b('0x25')]();};}function saveUpdates(_0x4c73da,_0x58f149){return function(_0x2b436f){if(_0x2b436f){return _0x2b436f[_0xb41b('0x26')](_0x4c73da)[_0xb41b('0x27')](function(_0x583741){return _0x583741;});}return null;};}function removeEntity(_0x14e9c8,_0x2441d6){return function(_0x546101){if(_0x546101){return _0x546101[_0xb41b('0x28')]()[_0xb41b('0x27')](function(){_0x14e9c8['status'](0xcc)[_0xb41b('0x1e')]();});}};}function handleEntityNotFound(_0x4a7992,_0x2d0f27){return function(_0x4c6a91){if(!_0x4c6a91){_0x4a7992['sendStatus'](0x194);}return _0x4c6a91;};}function handleError(_0x3af2c,_0x4265b8){_0x4265b8=_0x4265b8||0x1f4;return function(_0x583099){logger['error'](_0x583099[_0xb41b('0x29')]);if(_0x583099[_0xb41b('0x2a')]){delete _0x583099[_0xb41b('0x2a')];}_0x3af2c[_0xb41b('0x1d')](_0x4265b8)[_0xb41b('0x2b')](_0x583099);};}function getInteractionUsers(_0x181cbd,_0x253efb){return new BPromise(function(_0x545395,_0x26ef96){try{if(_0x253efb[_0x181cbd['id']]){_0x181cbd[_0xb41b('0x2c')]=_['map'](_0x253efb[_0x181cbd['id']],function(_0xe64568){return{'id':_0xe64568['id'],'fullname':_0xe64568['fullname']};});}}catch(_0x38277f){_0x26ef96(_0x38277f);}_0x545395(_0x181cbd);});}function getInteractionTags(_0x31d4cd,_0x597a35){return new BPromise(function(_0x23a6ed,_0x4a95e7){try{if(_0x31d4cd[_0xb41b('0x2d')]){_0x31d4cd[_0xb41b('0x2e')]=[];_0x31d4cd['TagIds'][_0xb41b('0x2f')](',')[_0xb41b('0x30')](function(_0x14c2e7){_0x31d4cd[_0xb41b('0x2e')][_0xb41b('0x31')](_0x597a35[_0x14c2e7]);});}delete _0x31d4cd[_0xb41b('0x2d')];}catch(_0x157048){_0x4a95e7(_0x157048);}_0x23a6ed(_0x31d4cd);});}function updateSmsInteraction(_0x3de167,_0x29ad07,_0x4464d6){return new BPromise(function(_0x4c3585,_0x976d56){return getInteractionUsers(_0x3de167,_0x4464d6)['then'](function(_0x4cb8ee){return getInteractionTags(_0x4cb8ee,_0x29ad07);})[_0xb41b('0x27')](function(_0x192ceb){_0x4c3585(_0x192ceb);})[_0xb41b('0x32')](function(_0x18e70e){_0x976d56(_0x18e70e);});});}exports[_0xb41b('0x33')]=function(_0xe204e4,_0x1de31b){var _0x197197={},_0x1e2b1e={},_0x1d3e90={'count':0x0,'rows':[]};var _0x3a06a0=_['map'](db[_0xb41b('0x34')][_0xb41b('0x35')],function(_0x2f95b9){return{'name':_0x2f95b9[_0xb41b('0x36')],'type':_0x2f95b9[_0xb41b('0x37')][_0xb41b('0x38')]};});_0x1e2b1e['model']=_['map'](_0x3a06a0,_0xb41b('0x2a'));_0x1e2b1e[_0xb41b('0x39')]=_['keys'](_0xe204e4[_0xb41b('0x39')]);_0x1e2b1e[_0xb41b('0x3a')]=_[_0xb41b('0x3b')](_0x1e2b1e[_0xb41b('0x3c')],_0x1e2b1e[_0xb41b('0x39')]);_0x197197['attributes']=_[_0xb41b('0x3b')](_0x1e2b1e['model'],qs[_0xb41b('0x3d')](_0xe204e4[_0xb41b('0x39')][_0xb41b('0x3d')]));_0x197197[_0xb41b('0x3e')]=_0x197197[_0xb41b('0x3e')][_0xb41b('0x3f')]?_0x197197[_0xb41b('0x3e')]:_0x1e2b1e[_0xb41b('0x3c')];if(!_0xe204e4[_0xb41b('0x39')]['hasOwnProperty']('nolimit')){_0x197197['limit']=qs[_0xb41b('0x21')](_0xe204e4['query']['limit']);_0x197197[_0xb41b('0x20')]=qs['offset'](_0xe204e4[_0xb41b('0x39')][_0xb41b('0x20')]);}_0x197197[_0xb41b('0x40')]=qs[_0xb41b('0x41')](_0xe204e4[_0xb41b('0x39')][_0xb41b('0x41')]);_0x197197[_0xb41b('0x42')]=qs['filters'](_[_0xb41b('0x43')](_0xe204e4[_0xb41b('0x39')],_0x1e2b1e[_0xb41b('0x3a')]),_0x3a06a0);var _0x174d6c=[];var _0x47bab5=squel[_0xb41b('0x44')]()['field']('id')[_0xb41b('0x45')](_0xb41b('0x2a'))[_0xb41b('0x45')]('color')['from'](_0xb41b('0x46'));var _0x28ea6f=squel[_0xb41b('0x44')]()[_0xb41b('0x45')](_0xb41b('0x47'))[_0xb41b('0x45')](_0xb41b('0x48'))['field']('ui.SmsInteractionId')[_0xb41b('0x49')]('user_has_sms_interactions','ui')[_0xb41b('0x4a')]('users','u',_0xb41b('0x4b'));var _0x4973a7=squel[_0xb41b('0x44')]()['from'](_0xb41b('0x4c'),'i')[_0xb41b('0x4a')](_0xb41b('0x4d'),'c',_0xb41b('0x4e'))['left_join'](_0xb41b('0x4f'),'o',_0xb41b('0x50'))['left_join'](_0xb41b('0x51'),'a','a.id\x20=\x20i.SmsAccountId')['left_join']('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0xb41b('0x4a')](_0xb41b('0x52'),'it',_0xb41b('0x53'))[_0xb41b('0x4a')](_0xb41b('0x46'),'t',_0xb41b('0x54'));var _0x34d076=squel[_0xb41b('0x55')]();var _0x1913b4=[];var _0x226031=squel[_0xb41b('0x55')]();var _0x38886a;if(_0xe204e4[_0xb41b('0x39')][_0xb41b('0x56')]){_0x38886a=as[_0xb41b('0x57')](_0xe204e4[_0xb41b('0x39')]['search']);var _0x2398f8=_0x38886a['sqlOperator'];for(var _0x4a7aa3=0x0;_0x4a7aa3<_0x38886a[_0xb41b('0x58')][_0xb41b('0x3f')];_0x4a7aa3++){var _0x2c6fc2=_0x38886a[_0xb41b('0x58')][_0x4a7aa3];var _0xb599eb='i';var _0x309bc1=_[_0xb41b('0x59')](_0x3a06a0,[_0xb41b('0x2a'),_0x2c6fc2[_0xb41b('0x45')]]);if(!_0x309bc1){switch(_0x2c6fc2[_0xb41b('0x45')]){case _0xb41b('0x5a'):if(_0x2c6fc2[_0xb41b('0x5b')]==0x1){_0x4973a7[_0xb41b('0x5c')]('`'+_0x2c6fc2[_0xb41b('0x45')]+_0xb41b('0x5d'));}else{_0x4973a7[_0xb41b('0x5c')]('`'+_0x2c6fc2[_0xb41b('0x45')]+_0xb41b('0x5e'));}break;case _0xb41b('0x5f'):if(_0x2c6fc2[_0xb41b('0x60')]===_0xb41b('0x61')){if(_0x2c6fc2['value'][_0xb41b('0x2f')]('\x20')['length']>0x1){_0x34d076[_0x2398f8](_0xb41b('0x62'),qs[_0xb41b('0x63')](_0x2c6fc2[_0xb41b('0x5b')]),null);}else{var _0x29df34='%'+_0x2c6fc2[_0xb41b('0x5b')]+'%';_0x34d076[_0x2398f8](_0xb41b('0x64'),_0x29df34,_0x29df34,_0x29df34);}}else{_0x309bc1=_[_0xb41b('0x59')](_0x3a06a0,['name',_0xb41b('0x65')]);_0x2c6fc2[_0xb41b('0x45')]=_0xb41b('0x65');_0x9bae17=as['buildExpression'](_0xb599eb,_0x309bc1[_0xb41b('0x37')],_0x2c6fc2);_0x34d076[_0x2398f8](_0x9bae17[_0xb41b('0x66')],_0x9bae17[_0xb41b('0x5b')][_0xb41b('0x67')],_0x9bae17[_0xb41b('0x5b')][_0xb41b('0x1e')]);}break;case _0xb41b('0x68'):var _0x540763=_0x2c6fc2['value'][_0xb41b('0x2f')](',')[_0xb41b('0x69')](function(_0x50d28c){return Number(_0x50d28c);});_0x540763[_0xb41b('0x30')](function(_0x285099){_0x226031['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x285099+',%');});_0x1913b4=_[_0xb41b('0x6a')](_0x1913b4,_0x540763);break;case _0xb41b('0x6b'):if(_0x2c6fc2[_0xb41b('0x60')]===_0xb41b('0x61')){_0x34d076[_0x2398f8](_0xb41b('0x6c'),'%'+_0x2c6fc2[_0xb41b('0x5b')]+'%',null);}else{_0x309bc1=_[_0xb41b('0x59')](_0x3a06a0,[_0xb41b('0x2a'),_0xb41b('0x6d')]);_0x2c6fc2[_0xb41b('0x45')]='UserId';_0x9bae17=as[_0xb41b('0x6e')](_0xb599eb,_0x309bc1[_0xb41b('0x37')],_0x2c6fc2);_0x34d076[_0x2398f8](_0x9bae17['text'],_0x9bae17['value'][_0xb41b('0x67')],_0x9bae17[_0xb41b('0x5b')][_0xb41b('0x1e')]);}break;case'body':_0x9bae17=as[_0xb41b('0x6e')]('me',null,_0x2c6fc2);_0x34d076[_0x2398f8](_0x9bae17[_0xb41b('0x66')],_0x9bae17[_0xb41b('0x5b')][_0xb41b('0x67')],_0x9bae17[_0xb41b('0x5b')][_0xb41b('0x1e')]);break;}}else{var _0x9bae17=as[_0xb41b('0x6e')](_0xb599eb,_0x309bc1[_0xb41b('0x37')],_0x2c6fc2);_0x34d076[_0x2398f8](_0x9bae17[_0xb41b('0x66')],_0x9bae17['value'][_0xb41b('0x67')],_0x9bae17[_0xb41b('0x5b')]['end']);}}}else{var _0x2a46ff=_(_0xe204e4[_0xb41b('0x39')])[_0xb41b('0x6f')]()['map'](function(_0x23b64e){return _[_0xb41b('0x70')](_0x3a06a0,[_0xb41b('0x2a'),_0x23b64e])?_0x23b64e:undefined;})[_0xb41b('0x71')]()[_0xb41b('0x5b')]();if(!_[_0xb41b('0x72')](_0x2a46ff)){_0x2a46ff[_0xb41b('0x30')](function(_0x4367ee){if(_0x4367ee===_0xb41b('0x73')){_0x4973a7[_0xb41b('0x42')]('i.SmsAccountId\x20IN\x20?',[]['concat'](_0xe204e4['query'][_0x4367ee]));}else if(_0x4367ee==='createdAt'){var _0x273b89=JSON[_0xb41b('0x74')](_0xe204e4[_0xb41b('0x39')][_0x4367ee])[_0xb41b('0x75')];var _0x46eed9=JSON[_0xb41b('0x74')](_0xe204e4['query'][_0x4367ee])[_0xb41b('0x76')];_0x4973a7['where'](_0xb41b('0x77'),_0x273b89,_0x46eed9);}else{if(_0xe204e4['query'][_0x4367ee]===_0xb41b('0x78')){_0x4973a7['where']('i.'+_0x4367ee+_0xb41b('0x79'));}else{_0x4973a7[_0xb41b('0x42')]('i.'+_0x4367ee+'\x20=\x20?',_0xe204e4[_0xb41b('0x39')][_0x4367ee]);}}});}if(_0xe204e4[_0xb41b('0x39')][_0xb41b('0x7a')]){if(_0xe204e4[_0xb41b('0x39')][_0xb41b('0x7a')]==0x1){_0x4973a7[_0xb41b('0x5c')](_0xb41b('0x7b'));}else{_0x4973a7['having'](_0xb41b('0x7c'));}}if(_0xe204e4['query'][_0xb41b('0x7d')]){_0x1913b4=_[_0xb41b('0x7e')](_0xe204e4[_0xb41b('0x39')]['tag'])?_0xe204e4['query']['tag']:new Array(_0xe204e4['query'][_0xb41b('0x7d')]);_0x1913b4[_0xb41b('0x30')](function(_0x3523ca){_0x226031['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3523ca+',%');});}if(_0xe204e4['query'][_0xb41b('0x7f')]){var _0x339c04=_0xe204e4[_0xb41b('0x39')][_0xb41b('0x7f')][_0xb41b('0x80')]('\x5c','\x5c\x5c')[_0xb41b('0x80')]('\x27\x27',_0xb41b('0x81'));if(qs['isNumeric'](_0x339c04)){_0x34d076['or']('i.id\x20LIKE\x20?',_0x339c04+'%')['or'](_0xb41b('0x82'),_0x339c04+'%');}else{_0x34d076['or'](_0xb41b('0x83'),qs['getFullTextValue'](_0x339c04))['or'](_0xb41b('0x84'),_0x339c04+'%');}}}_0x4973a7['where'](_0x34d076);_0x4973a7[_0xb41b('0x85')](_0xb41b('0x86'));var _0x5b2022={'type':db[_0xb41b('0x87')][_0xb41b('0x88')]['SELECT'],'raw':!![]};var _0x585d7c=_0x4973a7[_0xb41b('0x89')]();_0x585d7c[_0xb41b('0x45')]('i.id');_0x585d7c[_0xb41b('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb41b('0x5a'));if(_0x197197[_0xb41b('0x40')]){_0x197197['order']['forEach'](function(_0x468899){_0x4973a7[_0xb41b('0x40')]('i.'+_0x468899[0x0],_0x468899[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb41b('0x72')](_0x1913b4)){_0x4973a7[_0xb41b('0x5c')](_0x226031);_0x585d7c[_0xb41b('0x42')]('t.id\x20IN\x20?',_0x1913b4);}BPromise[_0xb41b('0x8a')]()['then'](function(){if(!_0x38886a){if(_0xe204e4['query'][_0xb41b('0x73')]||_0xe204e4[_0xb41b('0x39')][_0xb41b('0x8b')])return;_0x585d7c[_0xb41b('0x42')](_0xb41b('0x8c'));_0x4973a7[_0xb41b('0x42')](_0xb41b('0x8c'));return;}return _0xe204e4[_0xb41b('0x8d')][_0xb41b('0x8e')]({'attributes':['id'],'raw':!![]})[_0xb41b('0x27')](function(_0x2a10ca){if(_[_0xb41b('0x72')](_0x2a10ca)){_0x585d7c[_0xb41b('0x42')]('i.SmsAccountId\x20IS\x20NULL');_0x4973a7[_0xb41b('0x42')](_0xb41b('0x8f'));}else{_0x585d7c[_0xb41b('0x42')](_0xb41b('0x90'),_[_0xb41b('0x69')](_0x2a10ca,'id'));_0x4973a7[_0xb41b('0x42')](_0xb41b('0x90'),_[_0xb41b('0x69')](_0x2a10ca,'id'));}});})['then'](function(){db['sequelize'][_0xb41b('0x39')](_0x585d7c[_0xb41b('0x91')](),_0x5b2022)[_0xb41b('0x27')](function(_0x5af045){_0x1d3e90[_0xb41b('0x92')]=_0x5af045[_0xb41b('0x3f')];if(_0x1d3e90['count']===0x0)return[];return db[_0xb41b('0x93')][_0xb41b('0x39')](_0x47bab5['toString'](),_0x5b2022)[_0xb41b('0x27')](function(_0x3874d9){_0x174d6c=_[_0xb41b('0x94')](_0x3874d9,'id');_0x5b2022=_[_0xb41b('0x95')](_0x5b2022,{'model':db[_0xb41b('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xe204e4[_0xb41b('0x39')][_0xb41b('0x3d')]){_0x197197[_0xb41b('0x3e')][_0xb41b('0x30')](function(_0x5d0535){_0x4973a7['field']('i.'+_0x5d0535);});}else{_0x4973a7[_0xb41b('0x45')](_0xb41b('0x96'),_0xb41b('0x5a'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0x97'),_0xb41b('0x98'));_0x4973a7['field'](_0xb41b('0x99'),_0xb41b('0x9a'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0x9b'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0x9c'),_0xb41b('0x9d'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0x9e'),_0xb41b('0x9f'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0xa0'),_0xb41b('0xa1'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0xa2'),_0xb41b('0xa3'));_0x4973a7['field']('c.mobile','Contact.mobile');_0x4973a7[_0xb41b('0x45')]('c.fax',_0xb41b('0xa4'));_0x4973a7[_0xb41b('0x45')]('o.fullname',_0xb41b('0xa5'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0xa6'),_0xb41b('0xa7'));_0x4973a7[_0xb41b('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb41b('0x2d'));}if(_0x197197[_0xb41b('0x21')])_0x4973a7['limit'](_0x197197['limit']);if(_0x197197[_0xb41b('0x20')])_0x4973a7[_0xb41b('0x20')](_0x197197['offset']);return db[_0xb41b('0x93')][_0xb41b('0x39')](_0x4973a7[_0xb41b('0x91')](),_0x5b2022);})['then'](function(_0x546d2a){_0x28ea6f[_0xb41b('0x42')](_0xb41b('0xa8'),_['map'](_0x546d2a,'id'));return db[_0xb41b('0x93')][_0xb41b('0x39')](_0x28ea6f[_0xb41b('0x91')](),_0x5b2022)['then'](function(_0xb0c791){var _0x205664=_[_0xb41b('0xa9')](_0xb0c791,_0xb41b('0xaa'));var _0x261ca0=[];_0x546d2a[_0xb41b('0x30')](function(_0x33aa9d){_0x261ca0[_0xb41b('0x31')](updateSmsInteraction(_0x33aa9d,_0x174d6c,_0x205664));});return BPromise[_0xb41b('0xab')](_0x261ca0);});});})['then'](function(_0x1f9ca0){_0x1d3e90[_0xb41b('0xac')]=_0x1f9ca0;return _0x1d3e90;})['then'](respondWithFilteredResult(_0x1de31b,_0x197197));})[_0xb41b('0x32')](handleError(_0x1de31b,null));};exports['show']=function(_0x12ffa4,_0x5c421e){var _0x2e3441={'raw':![],'where':{'id':_0x12ffa4[_0xb41b('0xad')]['id']}},_0xccf8d1={};_0xccf8d1[_0xb41b('0x3c')]=_[_0xb41b('0x6f')](db[_0xb41b('0x34')][_0xb41b('0x35')]);_0xccf8d1[_0xb41b('0x39')]=_[_0xb41b('0x6f')](_0x12ffa4['query']);_0xccf8d1[_0xb41b('0x3a')]=_[_0xb41b('0x3b')](_0xccf8d1[_0xb41b('0x3c')],_0xccf8d1[_0xb41b('0x39')]);_0x2e3441['attributes']=_[_0xb41b('0x3b')](_0xccf8d1['model'],qs['fields'](_0x12ffa4[_0xb41b('0x39')][_0xb41b('0x3d')]));_0x2e3441['attributes']=_0x2e3441[_0xb41b('0x3e')][_0xb41b('0x3f')]?_0x2e3441['attributes']:_0xccf8d1[_0xb41b('0x3c')];if(_0x12ffa4['query']['includeAll']){_0x2e3441[_0xb41b('0xae')]=[{'all':!![]}];}_0x2e3441=_[_0xb41b('0x95')]({},_0x2e3441,_0x12ffa4[_0xb41b('0xaf')]);return db[_0xb41b('0x34')]['find'](_0x2e3441)[_0xb41b('0x27')](handleEntityNotFound(_0x5c421e,null))[_0xb41b('0x27')](respondWithResult(_0x5c421e,null))[_0xb41b('0x32')](handleError(_0x5c421e,null));};exports[_0xb41b('0xb0')]=function(_0x513894,_0x14229a){return db[_0xb41b('0x34')][_0xb41b('0xb0')](_0x513894[_0xb41b('0xb1')],{})[_0xb41b('0x27')](respondWithResult(_0x14229a,0xc9))[_0xb41b('0x32')](handleError(_0x14229a,null));};exports[_0xb41b('0x26')]=function(_0x3a5740,_0x538179){if(_0x3a5740[_0xb41b('0xb1')]['id']){delete _0x3a5740[_0xb41b('0xb1')]['id'];}return db[_0xb41b('0x34')][_0xb41b('0x59')]({'where':{'id':_0x3a5740[_0xb41b('0xad')]['id']}})[_0xb41b('0x27')](handleEntityNotFound(_0x538179,null))[_0xb41b('0x27')](saveUpdates(_0x3a5740[_0xb41b('0xb1')],null))['then'](respondWithResult(_0x538179,null))[_0xb41b('0x32')](handleError(_0x538179,null));};exports[_0xb41b('0x28')]=function(_0x5881cb,_0x426b65){return db[_0xb41b('0x34')]['find']({'where':{'id':_0x5881cb[_0xb41b('0xad')]['id']}})[_0xb41b('0x27')](handleEntityNotFound(_0x426b65,null))[_0xb41b('0x27')](removeEntity(_0x426b65,null))[_0xb41b('0x32')](handleError(_0x426b65,null));};exports[_0xb41b('0xb2')]=function(_0x7066e9,_0x2722cb){return db[_0xb41b('0x34')][_0xb41b('0xb2')]()[_0xb41b('0x27')](respondWithResult(_0x2722cb,null))['catch'](handleError(_0x2722cb,null));};exports[_0xb41b('0xb3')]=function(_0x289057,_0x20ebbb,_0x34d06f){return db['SmsMessage'][_0xb41b('0x59')]({'where':{'id':_0x289057[_0xb41b('0xad')]['id']}})[_0xb41b('0x27')](handleEntityNotFound(_0x20ebbb,null))[_0xb41b('0x27')](function(_0x3719b7){if(_0x3719b7){return _0x3719b7[_0xb41b('0xb3')](_0x289057['body'][_0xb41b('0xb4')],_[_0xb41b('0xb5')](_0x289057[_0xb41b('0xb1')],['ids','id'])||{});}})[_0xb41b('0x27')](respondWithResult(_0x20ebbb,null))[_0xb41b('0x32')](handleError(_0x20ebbb,null));};exports[_0xb41b('0xb6')]=function(_0x79d1f5,_0x1db78a,_0x304cfe){var _0x24a75a={'raw':![],'where':{}};var _0xda4444={};var _0xb149a3={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xb41b('0xb7')]({'where':{'id':_0x79d1f5['params']['id']}})[_0xb41b('0x27')](handleEntityNotFound(_0x1db78a,null))[_0xb41b('0x27')](function(_0x45da0a){if(_0x45da0a){_0xda4444[_0xb41b('0x3c')]=_[_0xb41b('0x6f')](db[_0xb41b('0xb8')][_0xb41b('0x35')]);_0xda4444[_0xb41b('0x39')]=_['keys'](_0x79d1f5[_0xb41b('0x39')]);_0xda4444[_0xb41b('0x3a')]=_[_0xb41b('0x3b')](_0xda4444['model'],_0xda4444['query']);_0x24a75a['attributes']=_[_0xb41b('0x3b')](_0xda4444[_0xb41b('0x3c')],qs[_0xb41b('0x3d')](_0x79d1f5[_0xb41b('0x39')]['fields']));_0x24a75a[_0xb41b('0x3e')]=_0x24a75a[_0xb41b('0x3e')][_0xb41b('0x3f')]?_0x24a75a[_0xb41b('0x3e')]:_0xda4444[_0xb41b('0x3c')];if(!_0x79d1f5[_0xb41b('0x39')][_0xb41b('0xb9')](_0xb41b('0xba'))){_0x24a75a[_0xb41b('0x21')]=qs[_0xb41b('0x21')](_0x79d1f5[_0xb41b('0x39')]['limit']);_0x24a75a['offset']=qs[_0xb41b('0x20')](_0x79d1f5['query'][_0xb41b('0x20')]);}_0x24a75a[_0xb41b('0x40')]=qs[_0xb41b('0x41')](_0x79d1f5[_0xb41b('0x39')][_0xb41b('0x41')]);_0x24a75a[_0xb41b('0x42')]=qs['filters'](_['pick'](_0x79d1f5[_0xb41b('0x39')],_0xda4444[_0xb41b('0x3a')]));_0x24a75a[_0xb41b('0x42')][_0xb41b('0xaa')]=_0x45da0a['id'];if(_0x79d1f5['query']['filter']){_0x24a75a[_0xb41b('0x42')]=_[_0xb41b('0x95')](_0x24a75a[_0xb41b('0x42')],{'$or':_[_0xb41b('0x69')](_0x24a75a[_0xb41b('0x3e')],function(_0x1d55c3){var _0x1ff912={};_0x1ff912[_0x1d55c3]={'$like':'%'+_0x79d1f5[_0xb41b('0x39')][_0xb41b('0x7f')]+'%'};return _0x1ff912;})});}if(_0x79d1f5[_0xb41b('0x39')][_0xb41b('0x75')]){var _0x55cfc8=_0x79d1f5[_0xb41b('0x39')][_0xb41b('0x75')][_0xb41b('0x2f')](',');var _0x3cf3ac={};_0x3cf3ac[_0x55cfc8[0x0]]={'$gte':moment(_0x55cfc8[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x24a75a[_0xb41b('0x42')]=_['merge'](_0x24a75a[_0xb41b('0x42')],_0x3cf3ac);}_0x24a75a=_['merge']({},_0x24a75a,_0x79d1f5['options']);return db[_0xb41b('0xb8')][_0xb41b('0x92')]({'where':_0x24a75a[_0xb41b('0x42')]})[_0xb41b('0x27')](function(_0x3437ed){_0xb149a3[_0xb41b('0x92')]=_0x3437ed;if(_0x79d1f5['query']['includeAll']){_0x24a75a[_0xb41b('0xae')]=[{'all':!![]}];}return db[_0xb41b('0xb8')][_0xb41b('0xbb')](_0x24a75a);})[_0xb41b('0x27')](function(_0x5813ba){_0xb149a3[_0xb41b('0xac')]=_0x5813ba;return _0xb149a3;});}})[_0xb41b('0x27')](respondWithFilteredResult(_0x1db78a,_0x24a75a))[_0xb41b('0x32')](handleError(_0x1db78a,null));};exports[_0xb41b('0xbc')]=function(_0x49394a,_0x3c3101,_0x4e7646){return db[_0xb41b('0x34')]['find']({'where':{'id':_0x49394a[_0xb41b('0xad')]['id']}})['then'](handleEntityNotFound(_0x3c3101,null))[_0xb41b('0x27')](function(_0x5d64c0){if(_0x5d64c0){return _0x5d64c0[_0xb41b('0xbd')](_0x49394a[_0xb41b('0xb1')]['ids'],_['omit'](_0x49394a[_0xb41b('0xb1')],[_0xb41b('0xb4'),'id'])||{})[_0xb41b('0xbe')](function(){return db['Tag']['findAll']({'attributes':['id',_0xb41b('0x2a'),_0xb41b('0xbf')],'where':{'id':_0x49394a[_0xb41b('0xb1')][_0xb41b('0xb4')]}});})['then'](function(_0x357d62){socket[_0xb41b('0xc0')](_0xb41b('0xc1'),{'id':Number(_0x49394a[_0xb41b('0xad')]['id']),'tags':_0x357d62||[]});return{'id':Number(_0x49394a[_0xb41b('0xad')]['id']),'tags':_0x357d62||[]};});}})['then'](respondWithResult(_0x3c3101,null))[_0xb41b('0x32')](handleError(_0x3c3101,null));};exports['removeTags']=function(_0x3e99ab,_0x425830,_0x40e2fa){return db[_0xb41b('0x34')]['find']({'where':{'id':_0x3e99ab[_0xb41b('0xad')]['id']}})[_0xb41b('0x27')](handleEntityNotFound(_0x425830,null))[_0xb41b('0x27')](function(_0x44837c){if(_0x44837c){return _0x44837c[_0xb41b('0xc2')](_0x3e99ab[_0xb41b('0x39')][_0xb41b('0xb4')]);}})['then'](respondWithStatusCode(_0x425830,null))[_0xb41b('0x32')](handleError(_0x425830,null));};exports['download']=function(_0x4a1a38,_0x468d70){var _0x402e3e=moment()['unix']()[_0xb41b('0x91')]();var _0x1a315d=path[_0xb41b('0xc3')](config['root'],_0xb41b('0xc4'),'files',_0xb41b('0xc5'));var _0x4d4b14=path['join'](config['root'],_0xb41b('0xc4'),_0xb41b('0xc6'),_0xb41b('0xc7'));var _0x40989c=path[_0xb41b('0xc3')](_0x1a315d,_0x402e3e);var _0x828ef4=util[_0xb41b('0xc8')]('transcript-%d-%s.zip',_0x4a1a38[_0xb41b('0xad')]['id'],_0x402e3e);var _0x1910a2=path[_0xb41b('0xc3')](_0x1a315d,_0x828ef4);var _0x22ad90=[];_0x22ad90[_0xb41b('0x31')]({'model':db[_0xb41b('0x6b')],'as':_0xb41b('0x6b'),'attributes':['id',_0xb41b('0xc9')],'raw':!![]});_0x22ad90[_0xb41b('0x31')]({'model':db['CmContact'],'as':_0xb41b('0x5f'),'attributes':['id',_0xb41b('0xca'),_0xb41b('0xcb')],'raw':!![]});var _0x29b332=[{'model':db[_0xb41b('0xb8')],'as':_0xb41b('0xcc'),'attributes':['id',_0xb41b('0xb1'),_0xb41b('0xcd'),_0xb41b('0xce'),_0xb41b('0xcf'),_0xb41b('0x7a')],'include':_0x22ad90}];_0x29b332[_0xb41b('0x31')]({'model':db[_0xb41b('0xd0')],'as':_0xb41b('0xd1'),'attributes':['id',_0xb41b('0x2a')]});_0x29b332['push']({'model':db[_0xb41b('0x6b')],'as':'Owner','attributes':['id',_0xb41b('0xc9')]});return db[_0xb41b('0x34')]['find']({'where':{'id':_0x4a1a38[_0xb41b('0xad')]['id']},'include':_0x29b332})[_0xb41b('0x27')](handleEntityNotFound(_0x468d70,null))['then'](function(_0x5d22b2){if(_0x5d22b2){var _0x4965ee=_0x5d22b2[_0xb41b('0xd2')]({'plain':!![]});fs['mkdirSync'](_0x40989c);var _0x112f68={'format':'A4','border':_0xb41b('0xd3'),'header':{'height':_0xb41b('0xd4'),'contents':{'first':_0xb41b('0xd5')}},'footer':{'height':_0xb41b('0xd6'),'contents':{'default':util['format'](_0xb41b('0xd7'),util[_0xb41b('0xc8')](_0xb41b('0xd8'),_0xb41b('0xd9'),_0x4965ee['id']),moment()[_0xb41b('0xc8')](_0xb41b('0xda'))[_0xb41b('0x91')]())}}};var _0x330c7a={'channel':'Sms','account':_0x4965ee[_0xb41b('0xd1')][_0xb41b('0x2a')],'agent':_0x4965ee['Owner']?_0x4965ee['Owner'][_0xb41b('0xc9')]:'N.A.','createdAt':moment(_0x4965ee[_0xb41b('0xcd')])[_0xb41b('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb41b('0x91')](),'closedAt':_0x4965ee[_0xb41b('0xdb')]?moment(_0x4965ee[_0xb41b('0xdc')])[_0xb41b('0xc8')](_0xb41b('0xdd'))[_0xb41b('0x91')]():'','disposition':_0x4965ee[_0xb41b('0xde')],'messages':_(_0x4965ee[_0xb41b('0xcc')])['filter']({'secret':![]})[_0xb41b('0x69')](function(_0xb5844b){return{'date':moment(_0xb5844b['createdAt'])['format'](_0xb41b('0xdd'))[_0xb41b('0x91')](),'sender':_0xb5844b[_0xb41b('0xce')]==='out'?_0xb5844b[_0xb41b('0x6b')]?_0xb5844b['User'][_0xb41b('0xc9')]:_0xb41b('0xdf'):_0xb5844b[_0xb41b('0x5f')][_0xb41b('0xca')]+(_0xb5844b[_0xb41b('0x5f')][_0xb41b('0xcb')]?'\x20'+_0xb5844b[_0xb41b('0x5f')][_0xb41b('0xcb')]:''),'body':_0xb5844b['body'],'direction':_0xb5844b[_0xb41b('0xce')]===_0xb41b('0xe0')?'A':'C','secret':_0xb5844b[_0xb41b('0xcf')],'read':_0xb5844b['read']};})[_0xb41b('0x5b')]()};return ejs[_0xb41b('0xe1')](path[_0xb41b('0xc3')](config['root'],_0xb41b('0xc4'),_0xb41b('0xe2'),_0xb41b('0xe3')),{'interaction':_0x330c7a})[_0xb41b('0x27')](function(_0xb10d8e){return new BPromise(function(_0x44f7e7,_0x2f2975){pdf['create'](_0xb10d8e,_0x112f68)[_0xb41b('0xe4')](path[_0xb41b('0xc3')](_0x40989c,_0xb41b('0xe5')+_0x4965ee['id']+'-'+_0x402e3e+_0xb41b('0xe6')),function(_0x586367,_0x4b5475){if(_0x586367)return _0x2f2975(_0x586367);_0x44f7e7(_0x4b5475);});});})[_0xb41b('0x27')](function(){return new BPromise(function(_0xfb125d,_0x1ce7f8){zipdir(_0x40989c,{'saveTo':_0x1910a2},function(_0x183210,_0x30029d){if(_0x183210)return _0x1ce7f8(_0x183210);return _0xfb125d(_0x30029d);});})[_0xb41b('0x27')](function(){return new BPromise(function(_0x13471a,_0x158978){rimraf(_0x40989c,function(_0x45ae7a){if(_0x45ae7a)_0x158978(_0x45ae7a);return _0x13471a();});});})[_0xb41b('0x27')](function(){return _0x468d70['download'](_0x1910a2,_0x828ef4,function(_0x3ab5ee){if(_0x3ab5ee){console[_0xb41b('0xe7')]('err',_0x3ab5ee);}else{fs[_0xb41b('0xe8')](_0x1910a2);}});});});}else{return _0x468d70[_0xb41b('0x1c')](0xc8);}})[_0xb41b('0x32')](handleError(_0x468d70,null));}; \ No newline at end of file +var _0x3667=['end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','split','forEach','Tags','TagIds','catch','index','SmsInteraction','rawAttributes','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','where','select','field','color','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','`\x20>\x200','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','compact','SmsAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','having','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','params','include','create','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','sort','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','setTags','spread','emit','download','unix','root','tmp','server','files','attachments','join','format','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Messages','direction','secret','Account','Owner','get','mkdirSync','10px','40px','30px','Sms','YYYY-MM-DD','closed','closedAt','disposition','System','Contact','out','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status'];(function(_0x3c30a4,_0x152fd6){var _0x4f3e14=function(_0x28d11e){while(--_0x28d11e){_0x3c30a4['push'](_0x3c30a4['shift']());}};_0x4f3e14(++_0x152fd6);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7366('0x0'));var emlformat=require(_0x7366('0x1'));var rimraf=require(_0x7366('0x2'));var zipdir=require(_0x7366('0x3'));var jsonpatch=require(_0x7366('0x4'));var rp=require('request-promise');var moment=require(_0x7366('0x5'));var BPromise=require(_0x7366('0x6'));var Mustache=require('mustache');var util=require(_0x7366('0x7'));var path=require(_0x7366('0x8'));var sox=require(_0x7366('0x9'));var csv=require(_0x7366('0xa'));var ejs=require(_0x7366('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7366('0xc'));var crypto=require(_0x7366('0xd'));var jsforce=require(_0x7366('0xe'));var deskjs=require(_0x7366('0xf'));var toCsv=require(_0x7366('0xa'));var querystring=require(_0x7366('0x10'));var Papa=require(_0x7366('0x11'));var Redis=require(_0x7366('0x12'));var authService=require(_0x7366('0x13'));var qs=require(_0x7366('0x14'));var as=require(_0x7366('0x15'));var hardwareService=require(_0x7366('0x16'));var logger=require(_0x7366('0x17'))(_0x7366('0x18'));var utils=require(_0x7366('0x19'));var config=require(_0x7366('0x1a'));var db=require(_0x7366('0x1b'))['db'];config[_0x7366('0x1c')]=_[_0x7366('0x1d')](config[_0x7366('0x1c')],{'host':_0x7366('0x1e'),'port':0x18eb});var socket=require(_0x7366('0x1f'))(new Redis(config[_0x7366('0x1c')]));require(_0x7366('0x20'))[_0x7366('0x21')](socket);function respondWithStatusCode(_0x27500c,_0x22562f){_0x22562f=_0x22562f||0xcc;return function(_0xf4114){if(_0xf4114){return _0x27500c['sendStatus'](_0x22562f);}return _0x27500c[_0x7366('0x22')](_0x22562f)[_0x7366('0x23')]();};}function respondWithResult(_0x338719,_0x2c0422){_0x2c0422=_0x2c0422||0xc8;return function(_0xe2c87b){if(_0xe2c87b){return _0x338719[_0x7366('0x22')](_0x2c0422)[_0x7366('0x24')](_0xe2c87b);}};}function respondWithFilteredResult(_0x22d348,_0x83e5d5){return function(_0x41113f){if(_0x41113f){var _0x1a71f5=_0x41113f[_0x7366('0x25')],_0x49e50b=_0x83e5d5[_0x7366('0x26')],_0x208ac8=_0x83e5d5[_0x7366('0x26')]+_0x83e5d5['limit'],_0x4ffbc7;if(_0x208ac8>=_0x1a71f5){_0x208ac8=_0x1a71f5;_0x4ffbc7=0xc8;}else{_0x4ffbc7=0xce;}_0x22d348[_0x7366('0x22')](_0x4ffbc7);return _0x22d348[_0x7366('0x27')](_0x7366('0x28'),_0x49e50b+'-'+_0x208ac8+'/'+_0x1a71f5)['json'](_0x41113f);}return null;};}function patchUpdates(_0x16e038){return function(_0x1946c6){try{jsonpatch['apply'](_0x1946c6,_0x16e038,!![]);}catch(_0x3bfbca){return BPromise[_0x7366('0x29')](_0x3bfbca);}return _0x1946c6[_0x7366('0x2a')]();};}function saveUpdates(_0x1a12d2,_0x3c30a2){return function(_0x1d3139){if(_0x1d3139){return _0x1d3139[_0x7366('0x2b')](_0x1a12d2)[_0x7366('0x2c')](function(_0x2095a1){return _0x2095a1;});}return null;};}function removeEntity(_0x301220,_0x12aed6){return function(_0x1dc875){if(_0x1dc875){return _0x1dc875[_0x7366('0x2d')]()['then'](function(){_0x301220[_0x7366('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x379146,_0x4ab987){return function(_0x5e30fb){if(!_0x5e30fb){_0x379146[_0x7366('0x2e')](0x194);}return _0x5e30fb;};}function handleError(_0x4d4cb5,_0x254374){_0x254374=_0x254374||0x1f4;return function(_0x4ac138){logger[_0x7366('0x2f')](_0x4ac138[_0x7366('0x30')]);if(_0x4ac138['name']){delete _0x4ac138[_0x7366('0x31')];}_0x4d4cb5['status'](_0x254374)[_0x7366('0x32')](_0x4ac138);};}function getInteractionUsers(_0x2b61af,_0x4a4e67){return new BPromise(function(_0x3cef4a,_0x507baf){try{if(_0x4a4e67[_0x2b61af['id']]){_0x2b61af[_0x7366('0x33')]=_[_0x7366('0x34')](_0x4a4e67[_0x2b61af['id']],function(_0x39d6ea){return{'id':_0x39d6ea['id'],'fullname':_0x39d6ea[_0x7366('0x35')]};});}}catch(_0x2dda4b){_0x507baf(_0x2dda4b);}_0x3cef4a(_0x2b61af);});}function getInteractionTags(_0x5e075c,_0x166628){return new BPromise(function(_0x447807,_0x538d42){try{if(_0x5e075c['TagIds']){_0x5e075c['Tags']=[];_0x5e075c['TagIds'][_0x7366('0x36')](',')[_0x7366('0x37')](function(_0x163a29){_0x5e075c[_0x7366('0x38')]['push'](_0x166628[_0x163a29]);});}delete _0x5e075c[_0x7366('0x39')];}catch(_0x2abf10){_0x538d42(_0x2abf10);}_0x447807(_0x5e075c);});}function updateSmsInteraction(_0xdaffd3,_0x21547f,_0x5214bc){return new BPromise(function(_0x3ab373,_0x311dab){return getInteractionUsers(_0xdaffd3,_0x5214bc)['then'](function(_0x2befc7){return getInteractionTags(_0x2befc7,_0x21547f);})[_0x7366('0x2c')](function(_0x1de991){_0x3ab373(_0x1de991);})[_0x7366('0x3a')](function(_0x7779c7){_0x311dab(_0x7779c7);});});}exports[_0x7366('0x3b')]=function(_0x3a69fa,_0x26858b){var _0x437713={},_0x59dead={},_0x45db2a={'count':0x0,'rows':[]};var _0x83b879=_['map'](db[_0x7366('0x3c')][_0x7366('0x3d')],function(_0x3ca8e9){return{'name':_0x3ca8e9['fieldName'],'type':_0x3ca8e9[_0x7366('0x3e')]['key']};});_0x59dead[_0x7366('0x3f')]=_['map'](_0x83b879,'name');_0x59dead[_0x7366('0x40')]=_['keys'](_0x3a69fa[_0x7366('0x40')]);_0x59dead[_0x7366('0x41')]=_['intersection'](_0x59dead[_0x7366('0x3f')],_0x59dead['query']);_0x437713[_0x7366('0x42')]=_[_0x7366('0x43')](_0x59dead[_0x7366('0x3f')],qs[_0x7366('0x44')](_0x3a69fa['query'][_0x7366('0x44')]));_0x437713[_0x7366('0x42')]=_0x437713[_0x7366('0x42')]['length']?_0x437713[_0x7366('0x42')]:_0x59dead[_0x7366('0x3f')];if(!_0x3a69fa[_0x7366('0x40')][_0x7366('0x45')](_0x7366('0x46'))){_0x437713[_0x7366('0x47')]=qs[_0x7366('0x47')](_0x3a69fa['query']['limit']);_0x437713[_0x7366('0x26')]=qs[_0x7366('0x26')](_0x3a69fa['query'][_0x7366('0x26')]);}_0x437713[_0x7366('0x48')]=qs['sort'](_0x3a69fa[_0x7366('0x40')]['sort']);_0x437713[_0x7366('0x49')]=qs[_0x7366('0x41')](_['pick'](_0x3a69fa['query'],_0x59dead[_0x7366('0x41')]),_0x83b879);var _0xedc3c7=[];var _0x2ac2e6=squel[_0x7366('0x4a')]()['field']('id')[_0x7366('0x4b')](_0x7366('0x31'))[_0x7366('0x4b')](_0x7366('0x4c'))[_0x7366('0x4d')](_0x7366('0x4e'));var _0x37fcd6=squel['select']()[_0x7366('0x4b')](_0x7366('0x4f'))[_0x7366('0x4b')]('u.fullname')[_0x7366('0x4b')](_0x7366('0x50'))['from'](_0x7366('0x51'),'ui')[_0x7366('0x52')](_0x7366('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x1909d4=squel[_0x7366('0x4a')]()[_0x7366('0x4d')]('sms_interactions','i')[_0x7366('0x52')](_0x7366('0x54'),'c',_0x7366('0x55'))['left_join'](_0x7366('0x53'),'o',_0x7366('0x56'))[_0x7366('0x52')](_0x7366('0x57'),'a','a.id\x20=\x20i.SmsAccountId')[_0x7366('0x52')](_0x7366('0x58'),'me',_0x7366('0x59'))[_0x7366('0x52')](_0x7366('0x5a'),'it',_0x7366('0x5b'))[_0x7366('0x52')](_0x7366('0x4e'),'t',_0x7366('0x5c'));var _0x59f078=squel[_0x7366('0x5d')]();var _0x1b8dcd=[];var _0x5db903=squel[_0x7366('0x5d')]();var _0x33a804;if(_0x3a69fa['query'][_0x7366('0x5e')]){_0x33a804=as['parseSearch'](_0x3a69fa[_0x7366('0x40')][_0x7366('0x5e')]);var _0x1295ca=_0x33a804[_0x7366('0x5f')];for(var _0x588b31=0x0;_0x588b31<_0x33a804[_0x7366('0x60')][_0x7366('0x61')];_0x588b31++){var _0x390bd7=_0x33a804[_0x7366('0x60')][_0x588b31];var _0x1de0a7='i';var _0x2146dc=_[_0x7366('0x62')](_0x83b879,[_0x7366('0x31'),_0x390bd7[_0x7366('0x4b')]]);if(!_0x2146dc){switch(_0x390bd7[_0x7366('0x4b')]){case _0x7366('0x63'):if(_0x390bd7[_0x7366('0x64')]==0x1){_0x1909d4['having']('`'+_0x390bd7[_0x7366('0x4b')]+'`\x20=\x200');}else{_0x1909d4['having']('`'+_0x390bd7[_0x7366('0x4b')]+_0x7366('0x65'));}break;case'Contact':if(_0x390bd7[_0x7366('0x66')]===_0x7366('0x67')){if(_0x390bd7['value']['split']('\x20')[_0x7366('0x61')]>0x1){_0x59f078[_0x1295ca]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7366('0x68')](_0x390bd7[_0x7366('0x64')]),null);}else{var _0x4ca4f7='%'+_0x390bd7[_0x7366('0x64')]+'%';_0x59f078[_0x1295ca](_0x7366('0x69'),_0x4ca4f7,_0x4ca4f7,_0x4ca4f7);}}else{_0x2146dc=_[_0x7366('0x62')](_0x83b879,['name',_0x7366('0x6a')]);_0x390bd7[_0x7366('0x4b')]=_0x7366('0x6a');_0x523016=as[_0x7366('0x6b')](_0x1de0a7,_0x2146dc['type'],_0x390bd7);_0x59f078[_0x1295ca](_0x523016[_0x7366('0x6c')],_0x523016[_0x7366('0x64')][_0x7366('0x6d')],_0x523016[_0x7366('0x64')][_0x7366('0x23')]);}break;case'Tag':var _0x1249a7=_0x390bd7[_0x7366('0x64')][_0x7366('0x36')](',')[_0x7366('0x34')](function(_0x54c117){return Number(_0x54c117);});_0x1249a7[_0x7366('0x37')](function(_0x5cbefc){_0x5db903['or'](_0x7366('0x6e'),'%,'+_0x5cbefc+',%');});_0x1b8dcd=_[_0x7366('0x6f')](_0x1b8dcd,_0x1249a7);break;case'User':if(_0x390bd7[_0x7366('0x66')]===_0x7366('0x67')){_0x59f078[_0x1295ca](_0x7366('0x70'),'%'+_0x390bd7[_0x7366('0x64')]+'%',null);}else{_0x2146dc=_['find'](_0x83b879,['name',_0x7366('0x71')]);_0x390bd7['field']=_0x7366('0x71');_0x523016=as[_0x7366('0x6b')](_0x1de0a7,_0x2146dc[_0x7366('0x3e')],_0x390bd7);_0x59f078[_0x1295ca](_0x523016[_0x7366('0x6c')],_0x523016[_0x7366('0x64')][_0x7366('0x6d')],_0x523016[_0x7366('0x64')][_0x7366('0x23')]);}break;case _0x7366('0x72'):_0x523016=as['buildExpression']('me',null,_0x390bd7);_0x59f078[_0x1295ca](_0x523016[_0x7366('0x6c')],_0x523016['value']['start'],_0x523016['value'][_0x7366('0x23')]);break;}}else{var _0x523016=as[_0x7366('0x6b')](_0x1de0a7,_0x2146dc['type'],_0x390bd7);_0x59f078[_0x1295ca](_0x523016[_0x7366('0x6c')],_0x523016['value'][_0x7366('0x6d')],_0x523016[_0x7366('0x64')]['end']);}}}else{var _0x4793c6=_(_0x3a69fa[_0x7366('0x40')])[_0x7366('0x73')]()[_0x7366('0x34')](function(_0x37a599){return _['some'](_0x83b879,[_0x7366('0x31'),_0x37a599])?_0x37a599:undefined;})[_0x7366('0x74')]()[_0x7366('0x64')]();if(!_['isEmpty'](_0x4793c6)){_0x4793c6['forEach'](function(_0x26ab9b){if(_0x26ab9b===_0x7366('0x75')){_0x1909d4[_0x7366('0x49')]('i.SmsAccountId\x20IN\x20?',[][_0x7366('0x76')](_0x3a69fa[_0x7366('0x40')][_0x26ab9b]));}else if(_0x26ab9b===_0x7366('0x77')){var _0x236180=JSON[_0x7366('0x78')](_0x3a69fa[_0x7366('0x40')][_0x26ab9b])[_0x7366('0x79')];var _0x38c65b=JSON[_0x7366('0x78')](_0x3a69fa[_0x7366('0x40')][_0x26ab9b])[_0x7366('0x7a')];_0x1909d4['where'](_0x7366('0x7b'),_0x236180,_0x38c65b);}else{if(_0x3a69fa[_0x7366('0x40')][_0x26ab9b]==='null'){_0x1909d4[_0x7366('0x49')]('i.'+_0x26ab9b+'\x20IS\x20NULL');}else{_0x1909d4['where']('i.'+_0x26ab9b+_0x7366('0x7c'),_0x3a69fa[_0x7366('0x40')][_0x26ab9b]);}}});}if(_0x3a69fa[_0x7366('0x40')][_0x7366('0x7d')]){if(_0x3a69fa[_0x7366('0x40')][_0x7366('0x7d')]==0x1){_0x1909d4['having'](_0x7366('0x7e'));}else{_0x1909d4[_0x7366('0x7f')](_0x7366('0x80'));}}if(_0x3a69fa['query'][_0x7366('0x81')]){_0x1b8dcd=_['isArray'](_0x3a69fa['query'][_0x7366('0x81')])?_0x3a69fa['query'][_0x7366('0x81')]:new Array(_0x3a69fa[_0x7366('0x40')][_0x7366('0x81')]);_0x1b8dcd[_0x7366('0x37')](function(_0x4b9045){_0x5db903['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4b9045+',%');});}if(_0x3a69fa[_0x7366('0x40')][_0x7366('0x82')]){var _0x1a2c88=_0x3a69fa[_0x7366('0x40')]['filter'][_0x7366('0x83')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x7366('0x84')](_0x1a2c88)){_0x59f078['or'](_0x7366('0x85'),_0x1a2c88+'%')['or']('i.phone\x20LIKE\x20?',_0x1a2c88+'%');}else{_0x59f078['or'](_0x7366('0x86'),qs[_0x7366('0x68')](_0x1a2c88))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1a2c88+'%');}}}_0x1909d4[_0x7366('0x49')](_0x59f078);_0x1909d4[_0x7366('0x87')](_0x7366('0x88'));var _0x3cad9e={'type':db[_0x7366('0x89')][_0x7366('0x8a')][_0x7366('0x8b')],'raw':!![]};var _0x16b3a=_0x1909d4[_0x7366('0x8c')]();_0x16b3a[_0x7366('0x4b')]('i.id');_0x16b3a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7366('0x63'));if(_0x437713[_0x7366('0x48')]){_0x437713[_0x7366('0x48')]['forEach'](function(_0x2754ae){_0x1909d4[_0x7366('0x48')]('i.'+_0x2754ae[0x0],_0x2754ae[0x1]===_0x7366('0x8d')?![]:!![]);});}if(!_[_0x7366('0x8e')](_0x1b8dcd)){_0x1909d4[_0x7366('0x7f')](_0x5db903);_0x16b3a['where'](_0x7366('0x8f'),_0x1b8dcd);}BPromise[_0x7366('0x90')]()['then'](function(){if(!_0x33a804){if(_0x3a69fa[_0x7366('0x40')][_0x7366('0x75')]||_0x3a69fa[_0x7366('0x40')][_0x7366('0x91')])return;_0x16b3a[_0x7366('0x49')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x1909d4['where'](_0x7366('0x92'));return;}return _0x3a69fa[_0x7366('0x93')][_0x7366('0x94')]({'attributes':['id'],'raw':!![]})[_0x7366('0x2c')](function(_0x3bc663){if(_[_0x7366('0x8e')](_0x3bc663)){_0x16b3a[_0x7366('0x49')](_0x7366('0x95'));_0x1909d4[_0x7366('0x49')](_0x7366('0x95'));}else{_0x16b3a[_0x7366('0x49')](_0x7366('0x96'),_[_0x7366('0x34')](_0x3bc663,'id'));_0x1909d4[_0x7366('0x49')]('i.SmsAccountId\x20IN\x20?',_[_0x7366('0x34')](_0x3bc663,'id'));}});})['then'](function(){db[_0x7366('0x97')]['query'](_0x16b3a[_0x7366('0x98')](),_0x3cad9e)['then'](function(_0x313478){_0x45db2a[_0x7366('0x25')]=_0x313478['length'];if(_0x45db2a[_0x7366('0x25')]===0x0)return[];return db[_0x7366('0x97')]['query'](_0x2ac2e6['toString'](),_0x3cad9e)[_0x7366('0x2c')](function(_0x1821e1){_0xedc3c7=_['keyBy'](_0x1821e1,'id');_0x3cad9e=_[_0x7366('0x99')](_0x3cad9e,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a69fa[_0x7366('0x40')]['fields']){_0x437713['attributes'][_0x7366('0x37')](function(_0x40a7a3){_0x1909d4[_0x7366('0x4b')]('i.'+_0x40a7a3);});}else{_0x1909d4['field'](_0x7366('0x9a'),_0x7366('0x63'));_0x1909d4[_0x7366('0x4b')]('a.key',_0x7366('0x9b'));_0x1909d4[_0x7366('0x4b')](_0x7366('0x9c'),_0x7366('0x9d'));_0x1909d4[_0x7366('0x4b')](_0x7366('0x9e'));_0x1909d4['field'](_0x7366('0x9f'),_0x7366('0xa0'));_0x1909d4[_0x7366('0x4b')]('c.lastName',_0x7366('0xa1'));_0x1909d4['field'](_0x7366('0xa2'),_0x7366('0xa3'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xa4'),_0x7366('0xa5'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xa6'),_0x7366('0xa7'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xa8'),_0x7366('0xa9'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xaa'),'Owner.fullname');_0x1909d4[_0x7366('0x4b')](_0x7366('0xab'),_0x7366('0xac'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xad'),'TagIds');}if(_0x437713[_0x7366('0x47')])_0x1909d4[_0x7366('0x47')](_0x437713['limit']);if(_0x437713[_0x7366('0x26')])_0x1909d4[_0x7366('0x26')](_0x437713[_0x7366('0x26')]);return db['sequelize'][_0x7366('0x40')](_0x1909d4['toString'](),_0x3cad9e);})['then'](function(_0x5d3a75){_0x37fcd6[_0x7366('0x49')](_0x7366('0xae'),_[_0x7366('0x34')](_0x5d3a75,'id'));return db[_0x7366('0x97')][_0x7366('0x40')](_0x37fcd6[_0x7366('0x98')](),_0x3cad9e)['then'](function(_0x506c11){var _0x133be0=_[_0x7366('0xaf')](_0x506c11,_0x7366('0xb0'));var _0xe26771=[];_0x5d3a75['forEach'](function(_0x2c69bf){_0xe26771[_0x7366('0xb1')](updateSmsInteraction(_0x2c69bf,_0xedc3c7,_0x133be0));});return BPromise[_0x7366('0xb2')](_0xe26771);});});})[_0x7366('0x2c')](function(_0x12b3e2){_0x45db2a[_0x7366('0xb3')]=_0x12b3e2;return _0x45db2a;})['then'](respondWithFilteredResult(_0x26858b,_0x437713));})[_0x7366('0x3a')](handleError(_0x26858b,null));};exports[_0x7366('0xb4')]=function(_0x2e52a7,_0x33ae81){var _0x108dba={'raw':![],'where':{'id':_0x2e52a7[_0x7366('0xb5')]['id']}},_0x123d0a={};_0x123d0a['model']=_[_0x7366('0x73')](db[_0x7366('0x3c')]['rawAttributes']);_0x123d0a[_0x7366('0x40')]=_[_0x7366('0x73')](_0x2e52a7[_0x7366('0x40')]);_0x123d0a[_0x7366('0x41')]=_[_0x7366('0x43')](_0x123d0a['model'],_0x123d0a['query']);_0x108dba['attributes']=_[_0x7366('0x43')](_0x123d0a[_0x7366('0x3f')],qs[_0x7366('0x44')](_0x2e52a7[_0x7366('0x40')][_0x7366('0x44')]));_0x108dba[_0x7366('0x42')]=_0x108dba[_0x7366('0x42')][_0x7366('0x61')]?_0x108dba['attributes']:_0x123d0a[_0x7366('0x3f')];if(_0x2e52a7[_0x7366('0x40')]['includeAll']){_0x108dba[_0x7366('0xb6')]=[{'all':!![]}];}_0x108dba=_['merge']({},_0x108dba,_0x2e52a7['options']);return db['SmsInteraction'][_0x7366('0x62')](_0x108dba)[_0x7366('0x2c')](handleEntityNotFound(_0x33ae81,null))[_0x7366('0x2c')](respondWithResult(_0x33ae81,null))[_0x7366('0x3a')](handleError(_0x33ae81,null));};exports[_0x7366('0xb7')]=function(_0x29640b,_0x313ea8){return db[_0x7366('0x3c')][_0x7366('0xb7')](_0x29640b[_0x7366('0x72')],{})['then'](respondWithResult(_0x313ea8,0xc9))[_0x7366('0x3a')](handleError(_0x313ea8,null));};exports[_0x7366('0x2b')]=function(_0x5e0556,_0x57df7b){if(_0x5e0556[_0x7366('0x72')]['id']){delete _0x5e0556[_0x7366('0x72')]['id'];}return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x5e0556[_0x7366('0xb5')]['id']}})['then'](handleEntityNotFound(_0x57df7b,null))[_0x7366('0x2c')](saveUpdates(_0x5e0556[_0x7366('0x72')],null))[_0x7366('0x2c')](respondWithResult(_0x57df7b,null))[_0x7366('0x3a')](handleError(_0x57df7b,null));};exports[_0x7366('0x2d')]=function(_0x57a6b7,_0x18c2bf){return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x57a6b7[_0x7366('0xb5')]['id']}})[_0x7366('0x2c')](handleEntityNotFound(_0x18c2bf,null))[_0x7366('0x2c')](removeEntity(_0x18c2bf,null))[_0x7366('0x3a')](handleError(_0x18c2bf,null));};exports[_0x7366('0xb8')]=function(_0x5c1ec2,_0x544935){return db[_0x7366('0x3c')][_0x7366('0xb8')]()[_0x7366('0x2c')](respondWithResult(_0x544935,null))[_0x7366('0x3a')](handleError(_0x544935,null));};exports[_0x7366('0xb9')]=function(_0x36fdb0,_0x1844f8,_0x31138d){return db['SmsMessage'][_0x7366('0x62')]({'where':{'id':_0x36fdb0['params']['id']}})[_0x7366('0x2c')](handleEntityNotFound(_0x1844f8,null))[_0x7366('0x2c')](function(_0x172ee4){if(_0x172ee4){return _0x172ee4[_0x7366('0xb9')](_0x36fdb0[_0x7366('0x72')][_0x7366('0xba')],_[_0x7366('0xbb')](_0x36fdb0[_0x7366('0x72')],[_0x7366('0xba'),'id'])||{});}})[_0x7366('0x2c')](respondWithResult(_0x1844f8,null))[_0x7366('0x3a')](handleError(_0x1844f8,null));};exports[_0x7366('0xbc')]=function(_0x576751,_0x1acf3b,_0xd4246a){var _0x2ff830={'raw':![],'where':{}};var _0x145519={};var _0x3c36db={'count':0x0,'rows':[]};return db[_0x7366('0x3c')][_0x7366('0xbd')]({'where':{'id':_0x576751[_0x7366('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1acf3b,null))[_0x7366('0x2c')](function(_0x2e0ccb){if(_0x2e0ccb){_0x145519[_0x7366('0x3f')]=_[_0x7366('0x73')](db[_0x7366('0xbe')][_0x7366('0x3d')]);_0x145519[_0x7366('0x40')]=_[_0x7366('0x73')](_0x576751[_0x7366('0x40')]);_0x145519[_0x7366('0x41')]=_[_0x7366('0x43')](_0x145519[_0x7366('0x3f')],_0x145519[_0x7366('0x40')]);_0x2ff830['attributes']=_[_0x7366('0x43')](_0x145519[_0x7366('0x3f')],qs['fields'](_0x576751['query']['fields']));_0x2ff830['attributes']=_0x2ff830[_0x7366('0x42')]['length']?_0x2ff830[_0x7366('0x42')]:_0x145519[_0x7366('0x3f')];if(!_0x576751['query'][_0x7366('0x45')](_0x7366('0x46'))){_0x2ff830[_0x7366('0x47')]=qs['limit'](_0x576751[_0x7366('0x40')][_0x7366('0x47')]);_0x2ff830['offset']=qs[_0x7366('0x26')](_0x576751[_0x7366('0x40')][_0x7366('0x26')]);}_0x2ff830[_0x7366('0x48')]=qs[_0x7366('0xbf')](_0x576751[_0x7366('0x40')]['sort']);_0x2ff830[_0x7366('0x49')]=qs[_0x7366('0x41')](_['pick'](_0x576751[_0x7366('0x40')],_0x145519[_0x7366('0x41')]));_0x2ff830[_0x7366('0x49')]['SmsInteractionId']=_0x2e0ccb['id'];if(_0x576751[_0x7366('0x40')][_0x7366('0x82')]){_0x2ff830['where']=_[_0x7366('0x99')](_0x2ff830[_0x7366('0x49')],{'$or':_[_0x7366('0x34')](_0x2ff830[_0x7366('0x42')],function(_0x54d697){var _0x4aaba8={};_0x4aaba8[_0x54d697]={'$like':'%'+_0x576751[_0x7366('0x40')][_0x7366('0x82')]+'%'};return _0x4aaba8;})});}if(_0x576751['query']['$gte']){var _0x4f0e41=_0x576751[_0x7366('0x40')][_0x7366('0x79')]['split'](',');var _0x20930e={};_0x20930e[_0x4f0e41[0x0]]={'$gte':moment(_0x4f0e41[0x1])['format'](_0x7366('0xc0'))};_0x2ff830[_0x7366('0x49')]=_[_0x7366('0x99')](_0x2ff830['where'],_0x20930e);}_0x2ff830=_[_0x7366('0x99')]({},_0x2ff830,_0x576751[_0x7366('0xc1')]);return db[_0x7366('0xbe')]['count']({'where':_0x2ff830[_0x7366('0x49')]})[_0x7366('0x2c')](function(_0x20a10b){_0x3c36db[_0x7366('0x25')]=_0x20a10b;if(_0x576751[_0x7366('0x40')][_0x7366('0xc2')]){_0x2ff830[_0x7366('0xb6')]=[{'all':!![]}];}return db[_0x7366('0xbe')][_0x7366('0xc3')](_0x2ff830);})[_0x7366('0x2c')](function(_0x58a5b5){_0x3c36db[_0x7366('0xb3')]=_0x58a5b5;return _0x3c36db;});}})['then'](respondWithFilteredResult(_0x1acf3b,_0x2ff830))[_0x7366('0x3a')](handleError(_0x1acf3b,null));};exports[_0x7366('0xc4')]=function(_0x26ef04,_0x328b4a,_0x17b9e5){return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x26ef04['params']['id']}})[_0x7366('0x2c')](handleEntityNotFound(_0x328b4a,null))[_0x7366('0x2c')](function(_0x540c12){if(_0x540c12){return _0x540c12[_0x7366('0xc5')](_0x26ef04[_0x7366('0x72')][_0x7366('0xba')],_[_0x7366('0xbb')](_0x26ef04[_0x7366('0x72')],[_0x7366('0xba'),'id'])||{})[_0x7366('0xc6')](function(){return db['Tag'][_0x7366('0xc3')]({'attributes':['id',_0x7366('0x31'),'color'],'where':{'id':_0x26ef04[_0x7366('0x72')][_0x7366('0xba')]}});})[_0x7366('0x2c')](function(_0x49139e){socket[_0x7366('0xc7')]('smsInteractionTags:save',{'id':Number(_0x26ef04[_0x7366('0xb5')]['id']),'tags':_0x49139e||[]});return{'id':Number(_0x26ef04[_0x7366('0xb5')]['id']),'tags':_0x49139e||[]};});}})[_0x7366('0x2c')](respondWithResult(_0x328b4a,null))['catch'](handleError(_0x328b4a,null));};exports['removeTags']=function(_0x19414f,_0x432daf,_0x1d5a79){return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x19414f[_0x7366('0xb5')]['id']}})[_0x7366('0x2c')](handleEntityNotFound(_0x432daf,null))[_0x7366('0x2c')](function(_0x433172){if(_0x433172){return _0x433172['removeTags'](_0x19414f[_0x7366('0x40')][_0x7366('0xba')]);}})[_0x7366('0x2c')](respondWithStatusCode(_0x432daf,null))['catch'](handleError(_0x432daf,null));};exports[_0x7366('0xc8')]=function(_0x1f21e7,_0x652bd2){var _0x4c42fa=moment()[_0x7366('0xc9')]()['toString']();var _0x3a9cdd=path['join'](config[_0x7366('0xca')],'server','files',_0x7366('0xcb'));var _0x368452=path['join'](config[_0x7366('0xca')],_0x7366('0xcc'),_0x7366('0xcd'),_0x7366('0xce'));var _0x3774be=path[_0x7366('0xcf')](_0x3a9cdd,_0x4c42fa);var _0x41d8ae=util[_0x7366('0xd0')](_0x7366('0xd1'),_0x1f21e7[_0x7366('0xb5')]['id'],_0x4c42fa);var _0xbeb315=path['join'](_0x3a9cdd,_0x41d8ae);var _0x3dd418=[];_0x3dd418['push']({'model':db[_0x7366('0xd2')],'as':_0x7366('0xd2'),'attributes':['id',_0x7366('0x35')],'raw':!![]});_0x3dd418[_0x7366('0xb1')]({'model':db[_0x7366('0xd3')],'as':'Contact','attributes':['id',_0x7366('0xd4'),_0x7366('0xd5')],'raw':!![]});var _0x237485=[{'model':db[_0x7366('0xbe')],'as':_0x7366('0xd6'),'attributes':['id',_0x7366('0x72'),_0x7366('0x77'),_0x7366('0xd7'),_0x7366('0xd8'),'read'],'include':_0x3dd418}];_0x237485['push']({'model':db['SmsAccount'],'as':_0x7366('0xd9'),'attributes':['id','name']});_0x237485['push']({'model':db[_0x7366('0xd2')],'as':_0x7366('0xda'),'attributes':['id',_0x7366('0x35')]});return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x1f21e7[_0x7366('0xb5')]['id']},'include':_0x237485})['then'](handleEntityNotFound(_0x652bd2,null))[_0x7366('0x2c')](function(_0x5ed9eb){if(_0x5ed9eb){var _0x4c6f72=_0x5ed9eb[_0x7366('0xdb')]({'plain':!![]});fs[_0x7366('0xdc')](_0x3774be);var _0x17571a={'format':'A4','border':_0x7366('0xdd'),'header':{'height':_0x7366('0xde'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x7366('0xdf'),'contents':{'default':util[_0x7366('0xd0')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x7366('0xd0')]('%s\x20#%d',_0x7366('0xe0'),_0x4c6f72['id']),moment()[_0x7366('0xd0')](_0x7366('0xe1'))[_0x7366('0x98')]())}}};var _0x402781={'channel':_0x7366('0xe0'),'account':_0x4c6f72[_0x7366('0xd9')]['name'],'agent':_0x4c6f72[_0x7366('0xda')]?_0x4c6f72[_0x7366('0xda')]['fullname']:'N.A.','createdAt':moment(_0x4c6f72[_0x7366('0x77')])[_0x7366('0xd0')](_0x7366('0xc0'))[_0x7366('0x98')](),'closedAt':_0x4c6f72[_0x7366('0xe2')]?moment(_0x4c6f72[_0x7366('0xe3')])['format'](_0x7366('0xc0'))[_0x7366('0x98')]():'','disposition':_0x4c6f72[_0x7366('0xe4')],'messages':_(_0x4c6f72[_0x7366('0xd6')])['filter']({'secret':![]})[_0x7366('0x34')](function(_0x33d651){return{'date':moment(_0x33d651[_0x7366('0x77')])[_0x7366('0xd0')](_0x7366('0xc0'))[_0x7366('0x98')](),'sender':_0x33d651[_0x7366('0xd7')]==='out'?_0x33d651[_0x7366('0xd2')]?_0x33d651['User']['fullname']:_0x7366('0xe5'):_0x33d651['Contact'][_0x7366('0xd4')]+(_0x33d651[_0x7366('0xe6')]['lastName']?'\x20'+_0x33d651[_0x7366('0xe6')][_0x7366('0xd5')]:''),'body':_0x33d651[_0x7366('0x72')],'direction':_0x33d651[_0x7366('0xd7')]===_0x7366('0xe7')?'A':'C','secret':_0x33d651['secret'],'read':_0x33d651['read']};})[_0x7366('0x64')]()};return ejs[_0x7366('0xe8')](path['join'](config['root'],_0x7366('0xcc'),_0x7366('0xe9'),_0x7366('0xea')),{'interaction':_0x402781})[_0x7366('0x2c')](function(_0x286bb4){return new BPromise(function(_0x5c264f,_0x2e9f64){pdf['create'](_0x286bb4,_0x17571a)[_0x7366('0xeb')](path[_0x7366('0xcf')](_0x3774be,_0x7366('0xec')+_0x4c6f72['id']+'-'+_0x4c42fa+'.pdf'),function(_0x28096d,_0x1d8808){if(_0x28096d)return _0x2e9f64(_0x28096d);_0x5c264f(_0x1d8808);});});})[_0x7366('0x2c')](function(){return new BPromise(function(_0x5660cf,_0x42e7ad){zipdir(_0x3774be,{'saveTo':_0xbeb315},function(_0x37c6b2,_0x56e058){if(_0x37c6b2)return _0x42e7ad(_0x37c6b2);return _0x5660cf(_0x56e058);});})[_0x7366('0x2c')](function(){return new BPromise(function(_0x581897,_0x3de2a6){rimraf(_0x3774be,function(_0x5073d9){if(_0x5073d9)_0x3de2a6(_0x5073d9);return _0x581897();});});})[_0x7366('0x2c')](function(){return _0x652bd2[_0x7366('0xc8')](_0xbeb315,_0x41d8ae,function(_0x35e024){if(_0x35e024){console[_0x7366('0xed')](_0x7366('0xee'),_0x35e024);}else{fs[_0x7366('0xef')](_0xbeb315);}});});});}else{return _0x652bd2[_0x7366('0x2e')](0xc8);}})[_0x7366('0x3a')](handleError(_0x652bd2,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index e3e9643..8a469ac 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 _0x1dcc=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction'];(function(_0x5d6327,_0x2a61fe){var _0x402c86=function(_0x4b0276){while(--_0x4b0276){_0x5d6327['push'](_0x5d6327['shift']());}};_0x402c86(++_0x2a61fe);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x3b8142,_0x44e052){_0x3b8142=_0x3b8142-0x0;var _0x1564cb=_0x1dcc[_0x3b8142];return _0x1564cb;};'use strict';var EventEmitter=require(_0xc1dc('0x0'));var SmsInteraction=require(_0xc1dc('0x1'))['db'][_0xc1dc('0x2')];var SmsMessage=require(_0xc1dc('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc1dc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc1dc('0x4'),'afterDestroy':_0xc1dc('0x5')};function emitEvent(_0x2a8ff9){return function(_0x5deaf7,_0x4ad50f,_0x1e57ba){_0x5deaf7[_0xc1dc('0x6')]({'attributes':['id'],'raw':!![]})[_0xc1dc('0x7')](function(_0x4dab41){_0x5deaf7[_0xc1dc('0x8')](_0xc1dc('0x9'),_0x4dab41['map'](function(_0x6aad09){return{'id':_0x6aad09['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x5deaf7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc1dc('0x7')](function(_0x49ef48){_0x5deaf7[_0xc1dc('0x8')](_0xc1dc('0xa'),_0x49ef48[_0xc1dc('0xb')]);SmsInteractionEvents[_0xc1dc('0xc')](_0x2a8ff9+':'+_0x5deaf7['id'],_0x5deaf7);SmsInteractionEvents[_0xc1dc('0xc')](_0x2a8ff9,_0x5deaf7);_0x1e57ba(null);})[_0xc1dc('0xd')](_0x1e57ba(null));};}for(var e in events){if(events[_0xc1dc('0xe')](e)){var event=events[e];SmsInteraction[_0xc1dc('0xf')](e,emitEvent(event));}}module[_0xc1dc('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x9649=['remove','getUsers','then','setDataValue','map','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save'];(function(_0x59445d,_0x4bb626){var _0x5b820f=function(_0x54975){while(--_0x54975){_0x59445d['push'](_0x59445d['shift']());}};_0x5b820f(++_0x4bb626);}(_0x9649,0x19f));var _0x9964=function(_0x2de607,_0x4f6b43){_0x2de607=_0x2de607-0x0;var _0x132b0f=_0x9649[_0x2de607];return _0x132b0f;};'use strict';var EventEmitter=require(_0x9964('0x0'));var SmsInteraction=require(_0x9964('0x1'))['db'][_0x9964('0x2')];var SmsMessage=require(_0x9964('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9964('0x3')](0x0);var events={'afterCreate':_0x9964('0x4'),'afterUpdate':'update','afterDestroy':_0x9964('0x5')};function emitEvent(_0x4b5a66){return function(_0xa0afe,_0x32aeb4,_0x12dd14){_0xa0afe[_0x9964('0x6')]({'attributes':['id'],'raw':!![]})[_0x9964('0x7')](function(_0x1338e7){_0xa0afe[_0x9964('0x8')]('Users',_0x1338e7[_0x9964('0x9')](function(_0x67291b){return{'id':_0x67291b['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0xa0afe['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9964('0x7')](function(_0x3fbce9){_0xa0afe['setDataValue']('unreadMessages',_0x3fbce9[_0x9964('0xa')]);SmsInteractionEvents[_0x9964('0xb')](_0x4b5a66+':'+_0xa0afe['id'],_0xa0afe);SmsInteractionEvents[_0x9964('0xb')](_0x4b5a66,_0xa0afe);_0x12dd14(null);})[_0x9964('0xc')](_0x12dd14(null));};}for(var e in events){if(events[_0x9964('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x9964('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index b13dc91..bfb4984 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 _0x3b83=['api','moment','bluebird','request-promise','../../config/environment','./smsInteraction.attributes','exports','define','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger'];(function(_0x48d3a1,_0x539d3){var _0x94b27a=function(_0x3345a5){while(--_0x3345a5){_0x48d3a1['push'](_0x48d3a1['shift']());}};_0x94b27a(++_0x539d3);}(_0x3b83,0x83));var _0x33b8=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x3b83[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x33b8('0x0'))(_0x33b8('0x1'));var moment=require(_0x33b8('0x2'));var BPromise=require(_0x33b8('0x3'));var rp=require(_0x33b8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x33b8('0x5'));var attributes=require(_0x33b8('0x6'));module[_0x33b8('0x7')]=function(_0x41e374,_0xb46f5a){return _0x41e374[_0x33b8('0x8')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43ca55,_0x26c071,_0x26fe26){if(_0x43ca55['changed'](_0x33b8('0x9'))){_0x43ca55[_0x33b8('0xa')]=moment()['format'](_0x33b8('0xb'));}_0x26fe26(null,_0x43ca55);}}});}; \ No newline at end of file +var _0x30cb=['api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x27650e,_0x278f7a){var _0x28fe08=function(_0x476eee){while(--_0x476eee){_0x27650e['push'](_0x27650e['shift']());}};_0x28fe08(++_0x278f7a);}(_0x30cb,0x1be));var _0xb30c=function(_0x103e8f,_0x786d03){_0x103e8f=_0x103e8f-0x0;var _0x2523f8=_0x30cb[_0x103e8f];return _0x2523f8;};'use strict';var _=require(_0xb30c('0x0'));var util=require(_0xb30c('0x1'));var logger=require('../../config/logger')(_0xb30c('0x2'));var moment=require(_0xb30c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb30c('0x4'));var fs=require('fs');var path=require(_0xb30c('0x5'));var rimraf=require(_0xb30c('0x6'));var config=require(_0xb30c('0x7'));var attributes=require(_0xb30c('0x8'));module[_0xb30c('0x9')]=function(_0x5a03b2,_0x3d1990){return _0x5a03b2['define'](_0xb30c('0xa'),attributes,{'tableName':_0xb30c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25f175,_0x609819,_0x2998b7){if(_0x25f175['changed']('closed')){_0x25f175['closedAt']=moment()[_0xb30c('0xc')](_0xb30c('0xd'));}_0x2998b7(null,_0x25f175);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index aa16d31..d398a78 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 _0x0145=['request\x20sent','stringify','error','message','catch','SmsInteraction','options','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','body','ids','omit','lodash','util','moment','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x30a191,_0x38b23b){var _0xf6f720=function(_0x127ac0){while(--_0x127ac0){_0x30a191['push'](_0x30a191['shift']());}};_0xf6f720(++_0x38b23b);}(_0x0145,0x179));var _0x5014=function(_0x5d884a,_0x2b0448){_0x5d884a=_0x5d884a-0x0;var _0x38f211=_0x0145[_0x5d884a];return _0x38f211;};'use strict';var _=require(_0x5014('0x0'));var util=require(_0x5014('0x1'));var moment=require(_0x5014('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5014('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5014('0x4'))('rpc');var config=require(_0x5014('0x5'));var jayson=require(_0x5014('0x6'));var client=jayson[_0x5014('0x7')][_0x5014('0x8')]({'port':0x232a});config['redis']=_[_0x5014('0x9')](config[_0x5014('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5014('0xb'))(new Redis(config[_0x5014('0xa')]));require('./smsInteraction.socket')[_0x5014('0xc')](socket);function respondWithRpcPromise(_0x3e64a9,_0x13280a,_0x6cd9f8){return new BPromise(function(_0x4a4a9a,_0x2ed9fd){return client[_0x5014('0xd')](_0x3e64a9,_0x6cd9f8)[_0x5014('0xe')](function(_0x3d9541){logger[_0x5014('0xf')](_0x5014('0x10'),_0x13280a,'request\x20sent');logger[_0x5014('0x11')](_0x5014('0x12'),_0x13280a,_0x5014('0x13'),JSON[_0x5014('0x14')](_0x3d9541));if(_0x3d9541[_0x5014('0x15')]){if(_0x3d9541[_0x5014('0x15')]['code']===0x1f4){logger[_0x5014('0x15')](_0x5014('0x10'),_0x13280a,_0x3d9541[_0x5014('0x15')]['message']);return _0x2ed9fd(_0x3d9541['error'][_0x5014('0x16')]);}logger[_0x5014('0x15')](_0x5014('0x10'),_0x13280a,_0x3d9541[_0x5014('0x15')]['message']);return _0x4a4a9a(_0x3d9541[_0x5014('0x15')][_0x5014('0x16')]);}else{logger['info'](_0x5014('0x10'),_0x13280a,_0x5014('0x13'));_0x4a4a9a(_0x3d9541['result'][_0x5014('0x16')]);}})[_0x5014('0x17')](function(_0x2629ce){logger[_0x5014('0x15')](_0x5014('0x10'),_0x13280a,_0x2629ce);_0x2ed9fd(_0x2629ce);});});}exports['UpdateSmsInteraction']=function(_0x2b91fa){var _0x5bef4a=this;return new Promise(function(_0x2348d0,_0x2e171d){return db[_0x5014('0x18')]['update'](_0x2b91fa['body'],{'raw':_0x2b91fa[_0x5014('0x19')]?_0x2b91fa[_0x5014('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b91fa[_0x5014('0x19')]?_0x2b91fa[_0x5014('0x19')][_0x5014('0x1a')]||null:null,'attributes':_0x2b91fa[_0x5014('0x19')]?_0x2b91fa[_0x5014('0x19')][_0x5014('0x1b')]||null:null,'limit':_0x2b91fa['options']?_0x2b91fa[_0x5014('0x19')][_0x5014('0x1c')]||null:null})[_0x5014('0xe')](function(_0x3c07bb){logger[_0x5014('0xf')](_0x5014('0x1d'),_0x2b91fa);logger[_0x5014('0x11')]('UpdateSmsInteraction',_0x2b91fa,JSON['stringify'](_0x3c07bb));_0x2348d0(_0x3c07bb);})[_0x5014('0x17')](function(_0x26abf0){logger[_0x5014('0x15')](_0x5014('0x1d'),_0x26abf0[_0x5014('0x16')],_0x2b91fa);_0x2e171d(_0x5bef4a[_0x5014('0x15')](0x1f4,_0x26abf0[_0x5014('0x16')]));});});};exports[_0x5014('0x1e')]=function(_0x3c29e6){return new Promise(function(_0x4f7c27,_0x2169d5){return db[_0x5014('0x18')][_0x5014('0x1f')]({'where':_0x3c29e6[_0x5014('0x19')]?_0x3c29e6[_0x5014('0x19')]['where']||null:null})['then'](function(_0x5abb3a){if(_0x5abb3a){return _0x5abb3a[_0x5014('0x20')](_0x3c29e6[_0x5014('0x21')][_0x5014('0x22')],_[_0x5014('0x23')](_0x3c29e6['body'],[_0x5014('0x22'),'id'])||{});}})['spread'](function(_0x435b11){logger['info']('AddTags',_0x3c29e6);logger['debug']('AddTags',_0x3c29e6,JSON['stringify'](_0x435b11));_0x4f7c27(_0x435b11);})[_0x5014('0x17')](function(_0x50422c){logger[_0x5014('0x15')]('AddTags',_0x50422c[_0x5014('0x16')],_0x3c29e6);_0x2169d5(_this['error'](0x1f4,_0x50422c[_0x5014('0x16')]));});});}; \ No newline at end of file +var _0xffd8=['error','code','SmsInteraction,\x20%s,\x20%s','message','result','SmsInteraction','update','body','options','where','limit','UpdateSmsInteraction','catch','AddTagsToSmsInteraction','find','addTags','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsInteraction.socket','register','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x44ea17,_0x422059){var _0x1d8af1=function(_0x159a75){while(--_0x159a75){_0x44ea17['push'](_0x44ea17['shift']());}};_0x1d8af1(++_0x422059);}(_0xffd8,0x1e0));var _0x8ffd=function(_0x23eec2,_0x5c7253){_0x23eec2=_0x23eec2-0x0;var _0x419075=_0xffd8[_0x23eec2];return _0x419075;};'use strict';var _=require(_0x8ffd('0x0'));var util=require(_0x8ffd('0x1'));var moment=require(_0x8ffd('0x2'));var BPromise=require(_0x8ffd('0x3'));var rs=require(_0x8ffd('0x4'));var fs=require('fs');var Redis=require(_0x8ffd('0x5'));var db=require(_0x8ffd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ffd('0x7'))(_0x8ffd('0x8'));var config=require(_0x8ffd('0x9'));var jayson=require(_0x8ffd('0xa'));var client=jayson[_0x8ffd('0xb')][_0x8ffd('0xc')]({'port':0x232a});config['redis']=_[_0x8ffd('0xd')](config[_0x8ffd('0xe')],{'host':_0x8ffd('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8ffd('0xe')]));require(_0x8ffd('0x10'))[_0x8ffd('0x11')](socket);function respondWithRpcPromise(_0x383668,_0xc0f86a,_0x2ed9ce){return new BPromise(function(_0x356e0b,_0x44ba49){return client['request'](_0x383668,_0x2ed9ce)[_0x8ffd('0x12')](function(_0x338f7d){logger[_0x8ffd('0x13')]('SmsInteraction,\x20%s,\x20%s',_0xc0f86a,_0x8ffd('0x14'));logger[_0x8ffd('0x15')](_0x8ffd('0x16'),_0xc0f86a,_0x8ffd('0x14'),JSON[_0x8ffd('0x17')](_0x338f7d));if(_0x338f7d[_0x8ffd('0x18')]){if(_0x338f7d[_0x8ffd('0x18')][_0x8ffd('0x19')]===0x1f4){logger['error'](_0x8ffd('0x1a'),_0xc0f86a,_0x338f7d['error'][_0x8ffd('0x1b')]);return _0x44ba49(_0x338f7d[_0x8ffd('0x18')][_0x8ffd('0x1b')]);}logger[_0x8ffd('0x18')](_0x8ffd('0x1a'),_0xc0f86a,_0x338f7d[_0x8ffd('0x18')][_0x8ffd('0x1b')]);return _0x356e0b(_0x338f7d['error'][_0x8ffd('0x1b')]);}else{logger[_0x8ffd('0x13')](_0x8ffd('0x1a'),_0xc0f86a,_0x8ffd('0x14'));_0x356e0b(_0x338f7d[_0x8ffd('0x1c')][_0x8ffd('0x1b')]);}})['catch'](function(_0x496993){logger[_0x8ffd('0x18')](_0x8ffd('0x1a'),_0xc0f86a,_0x496993);_0x44ba49(_0x496993);});});}exports['UpdateSmsInteraction']=function(_0x51a5e1){var _0x22afc0=this;return new Promise(function(_0x161e3c,_0x116f00){return db[_0x8ffd('0x1d')][_0x8ffd('0x1e')](_0x51a5e1[_0x8ffd('0x1f')],{'raw':_0x51a5e1[_0x8ffd('0x20')]?_0x51a5e1[_0x8ffd('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51a5e1['options']?_0x51a5e1[_0x8ffd('0x20')][_0x8ffd('0x21')]||null:null,'attributes':_0x51a5e1['options']?_0x51a5e1[_0x8ffd('0x20')]['attributes']||null:null,'limit':_0x51a5e1[_0x8ffd('0x20')]?_0x51a5e1['options'][_0x8ffd('0x22')]||null:null})[_0x8ffd('0x12')](function(_0x522128){logger[_0x8ffd('0x13')](_0x8ffd('0x23'),_0x51a5e1);logger[_0x8ffd('0x15')](_0x8ffd('0x23'),_0x51a5e1,JSON[_0x8ffd('0x17')](_0x522128));_0x161e3c(_0x522128);})[_0x8ffd('0x24')](function(_0x46f61a){logger[_0x8ffd('0x18')]('UpdateSmsInteraction',_0x46f61a[_0x8ffd('0x1b')],_0x51a5e1);_0x116f00(_0x22afc0[_0x8ffd('0x18')](0x1f4,_0x46f61a['message']));});});};exports[_0x8ffd('0x25')]=function(_0x37b77c){return new Promise(function(_0xeea760,_0x680a13){return db[_0x8ffd('0x1d')][_0x8ffd('0x26')]({'where':_0x37b77c[_0x8ffd('0x20')]?_0x37b77c['options'][_0x8ffd('0x21')]||null:null})[_0x8ffd('0x12')](function(_0x32c259){if(_0x32c259){return _0x32c259[_0x8ffd('0x27')](_0x37b77c['body']['ids'],_[_0x8ffd('0x28')](_0x37b77c['body'],['ids','id'])||{});}})['spread'](function(_0xcac316){logger[_0x8ffd('0x13')](_0x8ffd('0x29'),_0x37b77c);logger[_0x8ffd('0x15')]('AddTags',_0x37b77c,JSON[_0x8ffd('0x17')](_0xcac316));_0xeea760(_0xcac316);})[_0x8ffd('0x24')](function(_0x3bbf5c){logger[_0x8ffd('0x18')](_0x8ffd('0x29'),_0x3bbf5c[_0x8ffd('0x1b')],_0x37b77c);_0x680a13(_this[_0x8ffd('0x18')](0x1f4,_0x3bbf5c[_0x8ffd('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index a4fb363..cae2213 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 _0xd8b0=['save','emit','./smsInteraction.events'];(function(_0x4d6aae,_0x5172ef){var _0x565b10=function(_0x182144){while(--_0x182144){_0x4d6aae['push'](_0x4d6aae['shift']());}};_0x565b10(++_0x5172ef);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 +var _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x2032,0xd9));var _0x2203=function(_0x58ef54,_0x283ecc){_0x58ef54=_0x58ef54-0x0;var _0x1c7797=_0x2032[_0x58ef54];return _0x1c7797;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 6cb645f..4f954ce 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 _0xc29b=['post','tracked','sms','smsmessage:create','create','status','put','/:id','/:id/accept','accept','/:id/reject','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','/describe','show'];(function(_0x27401d,_0x47e9e8){var _0x276df=function(_0xdf078d){while(--_0xdf078d){_0x27401d['push'](_0x27401d['shift']());}};_0x276df(++_0x47e9e8);}(_0xc29b,0x165));var _0xbc29=function(_0x448a1b,_0x325388){_0x448a1b=_0x448a1b-0x0;var _0x195dc1=_0xc29b[_0x448a1b];return _0x195dc1;};'use strict';var multer=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc29('0x2'));var router=express[_0xbc29('0x3')]();var auth=require(_0xbc29('0x4'));var interaction=require(_0xbc29('0x5'));var config=require('../../config/environment');var controller=require(_0xbc29('0x6'));router[_0xbc29('0x7')]('/',auth[_0xbc29('0x8')](),controller['index']);router[_0xbc29('0x7')](_0xbc29('0x9'),auth[_0xbc29('0x8')](),controller['describe']);router['get']('/:id',auth[_0xbc29('0x8')](),controller[_0xbc29('0xa')]);router[_0xbc29('0xb')]('/',auth[_0xbc29('0x8')](),interaction[_0xbc29('0xc')](_0xbc29('0xd'),_0xbc29('0xe')),controller[_0xbc29('0xf')]);router['post']('/:id/status',controller[_0xbc29('0x10')]);router[_0xbc29('0x11')](_0xbc29('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xbc29('0x11')](_0xbc29('0x13'),auth[_0xbc29('0x8')](),controller[_0xbc29('0x14')]);router[_0xbc29('0x11')](_0xbc29('0x15'),auth[_0xbc29('0x8')](),controller['reject']);router['delete'](_0xbc29('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0xbc29('0x16')]=router; \ No newline at end of file +var _0x61ea=['smsmessage:create','create','post','/:id/status','put','accept','/:id/reject','reject','exports','multer','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','tracked','sms'];(function(_0x39af25,_0x51187b){var _0x5a8ae2=function(_0x76e1e2){while(--_0x76e1e2){_0x39af25['push'](_0x39af25['shift']());}};_0x5a8ae2(++_0x51187b);}(_0x61ea,0x1d5));var _0xa61e=function(_0x342928,_0x1b8983){_0x342928=_0x342928-0x0;var _0x5d8a16=_0x61ea[_0x342928];return _0x5d8a16;};'use strict';var multer=require(_0xa61e('0x0'));var util=require(_0xa61e('0x1'));var path=require(_0xa61e('0x2'));var timeout=require(_0xa61e('0x3'));var express=require('express');var router=express[_0xa61e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa61e('0x5'));var controller=require('./smsMessage.controller');router[_0xa61e('0x6')]('/',auth[_0xa61e('0x7')](),controller[_0xa61e('0x8')]);router[_0xa61e('0x6')](_0xa61e('0x9'),auth[_0xa61e('0x7')](),controller[_0xa61e('0xa')]);router[_0xa61e('0x6')](_0xa61e('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa61e('0x7')](),interaction[_0xa61e('0xc')](_0xa61e('0xd'),_0xa61e('0xe')),controller[_0xa61e('0xf')]);router[_0xa61e('0x10')](_0xa61e('0x11'),controller['status']);router[_0xa61e('0x12')](_0xa61e('0xb'),auth[_0xa61e('0x7')](),controller['update']);router[_0xa61e('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0xa61e('0x13')]);router[_0xa61e('0x12')](_0xa61e('0x14'),auth[_0xa61e('0x7')](),controller[_0xa61e('0x15')]);router['delete'](_0xa61e('0xb'),auth[_0xa61e('0x7')](),controller['destroy']);module[_0xa61e('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index e0e5dda..9896981 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 _0xf6c1=['medium','ENUM','out','STRING','BOOLEAN','sequelize'];(function(_0x467ee9,_0x555315){var _0x13504d=function(_0x59e04a){while(--_0x59e04a){_0x467ee9['push'](_0x467ee9['shift']());}};_0x13504d(++_0x555315);}(_0xf6c1,0x149));var _0x1f6c=function(_0x2f0ce7,_0x3b4e01){_0x2f0ce7=_0x2f0ce7-0x0;var _0x75436e=_0xf6c1[_0x2f0ce7];return _0x75436e;};'use strict';var Sequelize=require(_0x1f6c('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x1f6c('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1f6c('0x2')]('in',_0x1f6c('0x3')),'defaultValue':_0x1f6c('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1f6c('0x4')](0xbe)},'phone':{'type':Sequelize[_0x1f6c('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x1f6c('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x1b3e=['DATE','medium','ENUM','out','STRING'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x1b3e,0x128));var _0xe1b3=function(_0x19d672,_0x3b1afa){_0x19d672=_0x19d672-0x0;var _0x1a9916=_0x1b3e[_0x19d672];return _0x1a9916;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xe1b3('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe1b3('0x1')]('in','out'),'defaultValue':_0xe1b3('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe1b3('0x3')](0xbe)},'phone':{'type':Sequelize[_0xe1b3('0x3')]},'readAt':{'type':Sequelize[_0xe1b3('0x4')]},'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 7ec2321..819dc0a 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 _0x9bc3=['read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','reject','SmsAccount','SmsAccountId','inspect','twilio','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','Status','results','groupName','DELIVERED','infobip','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','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','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','show','keys','fields','options','find','create','body','params','describe','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','isNil'];(function(_0x4abef5,_0x10e42a){var _0x35eeeb=function(_0x534f9b){while(--_0x534f9b){_0x4abef5['push'](_0x4abef5['shift']());}};_0x35eeeb(++_0x10e42a);}(_0x9bc3,0x137));var _0x39bc=function(_0xa3114,_0x2576d5){_0xa3114=_0xa3114-0x0;var _0x1d414d=_0x9bc3[_0xa3114];return _0x1d414d;};'use strict';var pdf=require(_0x39bc('0x0'));var emlformat=require(_0x39bc('0x1'));var rimraf=require(_0x39bc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39bc('0x3'));var rp=require(_0x39bc('0x4'));var moment=require(_0x39bc('0x5'));var BPromise=require(_0x39bc('0x6'));var Mustache=require('mustache');var util=require(_0x39bc('0x7'));var path=require(_0x39bc('0x8'));var sox=require(_0x39bc('0x9'));var csv=require(_0x39bc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x39bc('0xb'));var squel=require(_0x39bc('0xc'));var crypto=require(_0x39bc('0xd'));var jsforce=require(_0x39bc('0xe'));var deskjs=require(_0x39bc('0xf'));var toCsv=require(_0x39bc('0xa'));var querystring=require(_0x39bc('0x10'));var Papa=require(_0x39bc('0x11'));var Redis=require('ioredis');var authService=require(_0x39bc('0x12'));var qs=require(_0x39bc('0x13'));var as=require(_0x39bc('0x14'));var hardwareService=require(_0x39bc('0x15'));var logger=require(_0x39bc('0x16'))(_0x39bc('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x39bc('0x18'))['db'];config[_0x39bc('0x19')]=_['defaults'](config[_0x39bc('0x19')],{'host':_0x39bc('0x1a'),'port':0x18eb});var socket=require(_0x39bc('0x1b'))(new Redis(config['redis']));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x39bc('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x39bc('0x1d')][_0x39bc('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x5c63df,_0x546753,_0x413400){if(_0x413400){var _0x47528f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47528f[_0x39bc('0x1f')](_0x546753)){return _0x5c63df;}else{throw new db['Sequelize'][(_0x39bc('0x20'))](_0x39bc('0x21'));}}else{return _0x5c63df;}}function respondWithRpcPromise(_0x4495a0,_0x1e121f,_0x3064c1,_0x3f13c8){return new BPromise(function(_0x311923,_0x486757){var _0x1de936=_0x3f13c8||client;return _0x1de936[_0x39bc('0x22')](_0x4495a0,_0x3064c1)[_0x39bc('0x23')](function(_0x65ee0e){logger['info'](_0x39bc('0x24'),_0x1e121f,'request\x20sent');logger[_0x39bc('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1e121f,_0x39bc('0x26'),JSON[_0x39bc('0x27')](_0x65ee0e));if(_0x65ee0e[_0x39bc('0x28')]){if(_0x65ee0e[_0x39bc('0x28')][_0x39bc('0x29')]===0x1f4){logger['error'](_0x39bc('0x24'),_0x1e121f,_0x65ee0e[_0x39bc('0x28')]['message']);return _0x486757(_0x65ee0e[_0x39bc('0x28')][_0x39bc('0x2a')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x1e121f,_0x65ee0e[_0x39bc('0x28')][_0x39bc('0x2a')]);return _0x311923(_0x65ee0e['error'][_0x39bc('0x2a')]);}else{logger[_0x39bc('0x2b')]('SmsMessage,\x20%s,\x20%s',_0x1e121f,'request\x20sent');_0x311923(_0x65ee0e['result'][_0x39bc('0x2a')]);}})[_0x39bc('0x2c')](function(_0x2ca4de){logger[_0x39bc('0x28')](_0x39bc('0x24'),_0x1e121f,_0x2ca4de);_0x486757(_0x2ca4de);});});}function respondWithStatusCode(_0x581148,_0x1a6d5b){_0x1a6d5b=_0x1a6d5b||0xcc;return function(_0x20ba97){if(_0x20ba97){return _0x581148[_0x39bc('0x2d')](_0x1a6d5b);}return _0x581148[_0x39bc('0x2e')](_0x1a6d5b)[_0x39bc('0x2f')]();};}function respondWithResult(_0x2f732b,_0x2a13bc){_0x2a13bc=_0x2a13bc||0xc8;return function(_0x41a85c){if(_0x41a85c){return _0x2f732b[_0x39bc('0x2e')](_0x2a13bc)[_0x39bc('0x30')](_0x41a85c);}};}function respondWithFilteredResult(_0x390a13,_0x4266b2){return function(_0x1c1d3f){if(_0x1c1d3f){var _0x1cba19=_0x1c1d3f[_0x39bc('0x31')],_0x2313d6=_0x4266b2['offset'],_0xd2694d=_0x4266b2[_0x39bc('0x32')]+_0x4266b2[_0x39bc('0x33')],_0x5239ea;if(_0xd2694d>=_0x1cba19){_0xd2694d=_0x1cba19;_0x5239ea=0xc8;}else{_0x5239ea=0xce;}_0x390a13[_0x39bc('0x2e')](_0x5239ea);return _0x390a13[_0x39bc('0x34')]('Content-Range',_0x2313d6+'-'+_0xd2694d+'/'+_0x1cba19)[_0x39bc('0x30')](_0x1c1d3f);}return null;};}function patchUpdates(_0x39d70a){return function(_0xf4beec){try{jsonpatch['apply'](_0xf4beec,_0x39d70a,!![]);}catch(_0x2fe76f){return BPromise['reject'](_0x2fe76f);}return _0xf4beec[_0x39bc('0x35')]();};}function saveUpdates(_0x22412a,_0xa9118b){return function(_0x31060e){if(_0x31060e){return _0x31060e[_0x39bc('0x36')](_0x22412a)[_0x39bc('0x23')](function(_0x2d00dd){return _0x2d00dd;});}return null;};}function removeEntity(_0x24f179,_0x12bbe4){return function(_0xe27a3f){if(_0xe27a3f){return _0xe27a3f[_0x39bc('0x37')]()[_0x39bc('0x23')](function(){_0x24f179[_0x39bc('0x2e')](0xcc)[_0x39bc('0x2f')]();});}};}function handleEntityNotFound(_0x84667c,_0x6c84d2){return function(_0xd26d07){if(!_0xd26d07){_0x84667c['sendStatus'](0x194);}return _0xd26d07;};}function handleError(_0x4a1ac6,_0x1b639c){_0x1b639c=_0x1b639c||0x1f4;return function(_0x194eb9){logger['error'](_0x194eb9[_0x39bc('0x38')]);if(_0x194eb9[_0x39bc('0x39')]){delete _0x194eb9['name'];}_0x4a1ac6[_0x39bc('0x2e')](_0x1b639c)[_0x39bc('0x3a')](_0x194eb9);};}exports[_0x39bc('0x3b')]=function(_0x4cbac7,_0x57e2c0){var _0x56a6e6={},_0x41f483={},_0x339a4b={'count':0x0,'rows':[]};var _0x3fe0a0=_[_0x39bc('0x3c')](db[_0x39bc('0x3d')][_0x39bc('0x3e')],function(_0x5796c3){return{'name':_0x5796c3[_0x39bc('0x3f')],'type':_0x5796c3[_0x39bc('0x40')]['key']};});_0x41f483[_0x39bc('0x41')]=_[_0x39bc('0x3c')](_0x3fe0a0,_0x39bc('0x39'));_0x41f483[_0x39bc('0x42')]=_['keys'](_0x4cbac7['query']);_0x41f483[_0x39bc('0x43')]=_[_0x39bc('0x44')](_0x41f483[_0x39bc('0x41')],_0x41f483[_0x39bc('0x42')]);_0x56a6e6[_0x39bc('0x45')]=_[_0x39bc('0x44')](_0x41f483['model'],qs['fields'](_0x4cbac7[_0x39bc('0x42')]['fields']));_0x56a6e6[_0x39bc('0x45')]=_0x56a6e6['attributes'][_0x39bc('0x46')]?_0x56a6e6[_0x39bc('0x45')]:_0x41f483[_0x39bc('0x41')];if(!_0x4cbac7[_0x39bc('0x42')][_0x39bc('0x47')](_0x39bc('0x48'))){_0x56a6e6['limit']=qs['limit'](_0x4cbac7[_0x39bc('0x42')][_0x39bc('0x33')]);_0x56a6e6[_0x39bc('0x32')]=qs[_0x39bc('0x32')](_0x4cbac7[_0x39bc('0x42')]['offset']);}_0x56a6e6[_0x39bc('0x49')]=qs[_0x39bc('0x4a')](_0x4cbac7['query'][_0x39bc('0x4a')]);_0x56a6e6[_0x39bc('0x4b')]=qs['filters'](_['pick'](_0x4cbac7[_0x39bc('0x42')],_0x41f483[_0x39bc('0x43')]),_0x3fe0a0);if(_0x4cbac7[_0x39bc('0x42')][_0x39bc('0x4c')]){_0x56a6e6[_0x39bc('0x4b')]=_[_0x39bc('0x4d')](_0x56a6e6[_0x39bc('0x4b')],{'$or':_[_0x39bc('0x3c')](_0x3fe0a0,function(_0x8b306f){if(_0x8b306f[_0x39bc('0x40')]!==_0x39bc('0x4e')){var _0x44acfb={};_0x44acfb[_0x8b306f['name']]={'$like':'%'+_0x4cbac7[_0x39bc('0x42')][_0x39bc('0x4c')]+'%'};return _0x44acfb;}})});}_0x56a6e6=_[_0x39bc('0x4d')]({},_0x56a6e6,_0x4cbac7['options']);var _0x450e49={'where':_0x56a6e6[_0x39bc('0x4b')]};return db['SmsMessage'][_0x39bc('0x31')](_0x450e49)[_0x39bc('0x23')](function(_0x1a2b0c){_0x339a4b[_0x39bc('0x31')]=_0x1a2b0c;if(_0x4cbac7[_0x39bc('0x42')][_0x39bc('0x4f')]){_0x56a6e6[_0x39bc('0x50')]=[{'all':!![]}];}return db[_0x39bc('0x3d')]['findAll'](_0x56a6e6);})[_0x39bc('0x23')](function(_0x8311e8){_0x339a4b[_0x39bc('0x51')]=_0x8311e8;return _0x339a4b;})['then'](respondWithFilteredResult(_0x57e2c0,_0x56a6e6))[_0x39bc('0x2c')](handleError(_0x57e2c0,null));};exports[_0x39bc('0x52')]=function(_0x5deb07,_0x23a13c){var _0x15d55d={'raw':!![],'where':{'id':_0x5deb07['params']['id']}},_0x5daabf={};_0x5daabf['model']=_[_0x39bc('0x53')](db['SmsMessage'][_0x39bc('0x3e')]);_0x5daabf[_0x39bc('0x42')]=_[_0x39bc('0x53')](_0x5deb07[_0x39bc('0x42')]);_0x5daabf[_0x39bc('0x43')]=_[_0x39bc('0x44')](_0x5daabf[_0x39bc('0x41')],_0x5daabf[_0x39bc('0x42')]);_0x15d55d[_0x39bc('0x45')]=_[_0x39bc('0x44')](_0x5daabf['model'],qs[_0x39bc('0x54')](_0x5deb07['query'][_0x39bc('0x54')]));_0x15d55d[_0x39bc('0x45')]=_0x15d55d['attributes'][_0x39bc('0x46')]?_0x15d55d[_0x39bc('0x45')]:_0x5daabf[_0x39bc('0x41')];if(_0x5deb07[_0x39bc('0x42')][_0x39bc('0x4f')]){_0x15d55d['include']=[{'all':!![]}];}_0x15d55d=_[_0x39bc('0x4d')]({},_0x15d55d,_0x5deb07[_0x39bc('0x55')]);return db[_0x39bc('0x3d')][_0x39bc('0x56')](_0x15d55d)[_0x39bc('0x23')](handleEntityNotFound(_0x23a13c,null))[_0x39bc('0x23')](respondWithResult(_0x23a13c,null))[_0x39bc('0x2c')](handleError(_0x23a13c,null));};exports[_0x39bc('0x57')]=function(_0x448a59,_0x32f392){return db['SmsMessage'][_0x39bc('0x57')](_0x448a59[_0x39bc('0x58')],{})['then'](respondWithResult(_0x32f392,0xc9))[_0x39bc('0x2c')](handleError(_0x32f392,null));};exports[_0x39bc('0x36')]=function(_0x2e5a42,_0x2d123c){if(_0x2e5a42[_0x39bc('0x58')]['id']){delete _0x2e5a42[_0x39bc('0x58')]['id'];}return db[_0x39bc('0x3d')][_0x39bc('0x56')]({'where':{'id':_0x2e5a42[_0x39bc('0x59')]['id']}})['then'](handleEntityNotFound(_0x2d123c,null))[_0x39bc('0x23')](saveUpdates(_0x2e5a42[_0x39bc('0x58')],null))[_0x39bc('0x23')](respondWithResult(_0x2d123c,null))[_0x39bc('0x2c')](handleError(_0x2d123c,null));};exports[_0x39bc('0x37')]=function(_0x429801,_0x2d7483){return db[_0x39bc('0x3d')]['find']({'where':{'id':_0x429801[_0x39bc('0x59')]['id']}})[_0x39bc('0x23')](handleEntityNotFound(_0x2d7483,null))[_0x39bc('0x23')](removeEntity(_0x2d7483,null))['catch'](handleError(_0x2d7483,null));};exports[_0x39bc('0x5a')]=function(_0x36675c,_0xe79197){return db['SmsMessage'][_0x39bc('0x5a')]()[_0x39bc('0x23')](respondWithResult(_0xe79197,null))[_0x39bc('0x2c')](handleError(_0xe79197,null));};var interaction_log=require('../../config/logger')(_0x39bc('0x5b'));exports[_0x39bc('0x5c')]=function(_0x55ecb9,_0x22a530,_0x52bad9){var _0x3b238c={'channel':_0x39bc('0x5d')};if(_0x55ecb9[_0x39bc('0x58')]['id']){delete _0x55ecb9[_0x39bc('0x58')]['id'];}_0x55ecb9['body']['read']=!![];_0x55ecb9[_0x39bc('0x58')][_0x39bc('0x5e')]=moment()[_0x39bc('0x5f')](_0x39bc('0x60'));_0x55ecb9[_0x39bc('0x58')][_0x39bc('0x61')]=_0x55ecb9[_0x39bc('0x58')][_0x39bc('0x61')]||_0x55ecb9[_0x39bc('0x62')]['id'];return db['SmsMessage'][_0x39bc('0x56')]({'where':{'id':_0x55ecb9[_0x39bc('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x39bc('0x63')],'as':_0x39bc('0x64')}]})[_0x39bc('0x23')](handleEntityNotFound(_0x22a530,null))[_0x39bc('0x23')](saveUpdates(_0x55ecb9['body'],null))['then'](function(_0x309c04){if(_0x309c04){_0x3b238c[_0x39bc('0x2a')]=_0x309c04[_0x39bc('0x65')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x309c04['SmsInteractionId']}});}return null;})[_0x39bc('0x23')](handleEntityNotFound(_0x22a530,null))[_0x39bc('0x23')](function(_0x57bc96){if(_0x57bc96){return _0x57bc96[_0x39bc('0x36')]({'UserId':_0x55ecb9[_0x39bc('0x58')][_0x39bc('0x61')],'read1stAt':_[_0x39bc('0x66')](_0x57bc96[_0x39bc('0x67')])?moment()[_0x39bc('0x5f')](_0x39bc('0x60')):undefined});}return null;})[_0x39bc('0x23')](function(_0x52b5f2){if(_0x52b5f2){_0x3b238c[_0x39bc('0x68')]=_0x52b5f2[_0x39bc('0x65')]({'plain':!![]});interaction_log[_0x39bc('0x2b')](_0x39bc('0x69'),_0x55ecb9[_0x39bc('0x62')]['id'],_0x55ecb9[_0x39bc('0x62')][_0x39bc('0x39')],_0x55ecb9[_0x39bc('0x62')][_0x39bc('0x6a')],_0x3b238c['interaction']['id'],_0x55ecb9[_0x39bc('0x58')]?JSON[_0x39bc('0x27')](_0x55ecb9['body']):_0x39bc('0x6b'));return respondWithRpcPromise(_0x39bc('0x6c'),_0x39bc('0x6d'),_0x3b238c);}return null;})[_0x39bc('0x23')](function(_0x2d51f5){if(_0x2d51f5){if(_0x55ecb9['body'][_0x39bc('0x6e')]){_0x3b238c[_0x39bc('0x2a')][_0x39bc('0x6f')]=util[_0x39bc('0x5f')](_0x39bc('0x70'),_0x55ecb9['user'][_0x39bc('0x39')]);_0x3b238c[_0x39bc('0x2a')][_0x39bc('0x71')]=_0x3b238c[_0x39bc('0x71')];_0x3b238c[_0x39bc('0x2a')][_0x39bc('0x72')]='accept';return respondWithRpcPromise('EventManager',_0x39bc('0x73'),{'event':_0x39bc('0x74'),'message':_0x3b238c[_0x39bc('0x2a')]},client9002)[_0x39bc('0x23')](function(){return _0x3b238c;});}return _0x3b238c;}return null;})[_0x39bc('0x23')](respondWithResult(_0x22a530,null))[_0x39bc('0x2c')](handleError(_0x22a530,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports['reject']=function(_0x56b3b3,_0x41d08e,_0x20f4cf){var _0x5f09ea={'agent':{},'channel':'sms'};if(_0x56b3b3['body']['id']){delete _0x56b3b3['body']['id'];}_0x56b3b3[_0x39bc('0x58')][_0x39bc('0x61')]=_0x56b3b3[_0x39bc('0x58')][_0x39bc('0x61')]||_0x56b3b3['user']['id'];_0x5f09ea[_0x39bc('0x75')]['id']=_0x56b3b3['body'][_0x39bc('0x61')];return db['SmsMessage']['find']({'where':{'id':_0x56b3b3['params']['id'],'UserId':null}})[_0x39bc('0x23')](handleEntityNotFound(_0x41d08e,null))[_0x39bc('0x23')](function(_0x18d15c){if(_0x18d15c){_0x5f09ea['message']=_0x18d15c[_0x39bc('0x65')]({'plain':!![]});return db[_0x39bc('0x76')][_0x39bc('0x56')]({'where':{'id':_0x18d15c[_0x39bc('0x77')]}});}return null;})[_0x39bc('0x23')](handleEntityNotFound(_0x41d08e,null))[_0x39bc('0x23')](function(_0x3a0b99){if(_0x3a0b99){_0x5f09ea[_0x39bc('0x68')]=_0x3a0b99['get']({'plain':!![]});interaction_log['info'](_0x39bc('0x78'),_0x56b3b3[_0x39bc('0x62')]['id'],_0x56b3b3[_0x39bc('0x62')][_0x39bc('0x39')],_0x56b3b3['user'][_0x39bc('0x6a')],_0x5f09ea[_0x39bc('0x68')]['id'],_0x56b3b3['body']?JSON['stringify'](_0x56b3b3[_0x39bc('0x58')]):_0x39bc('0x6b'));return respondWithRpcPromise('RejectMessage',_0x39bc('0x79'),_0x5f09ea);}return null;})['then'](function(_0x55c89b){if(_0x55c89b){_0x55c89b[_0x39bc('0x2a')]['interface']=util[_0x39bc('0x5f')](_0x39bc('0x70'),_0x56b3b3[_0x39bc('0x62')][_0x39bc('0x39')]);_0x55c89b[_0x39bc('0x2a')][_0x39bc('0x71')]=_0x5f09ea['channel'];_0x55c89b[_0x39bc('0x2a')][_0x39bc('0x72')]=_0x39bc('0x7a');respondWithRpcPromise(_0x39bc('0x73'),'EventManager',{'event':'rejectmessage','message':_0x55c89b[_0x39bc('0x2a')]},client9002);return _0x5f09ea;}return null;})[_0x39bc('0x23')](respondWithResult(_0x41d08e,null))[_0x39bc('0x2c')](handleError(_0x41d08e,null));};exports[_0x39bc('0x2e')]=function(_0x52de27,_0x4eddad,_0x2d9c9b){if(_0x52de27[_0x39bc('0x58')]['id']){delete _0x52de27[_0x39bc('0x58')]['id'];}var _0x9eeee4;return db[_0x39bc('0x3d')][_0x39bc('0x56')]({'where':{'id':_0x52de27[_0x39bc('0x59')]['id']}})['then'](handleEntityNotFound(_0x4eddad,null))['then'](function(_0x2d07d5){if(_0x2d07d5){_0x9eeee4=_0x2d07d5;return db[_0x39bc('0x7b')][_0x39bc('0x56')]({'where':{'id':_0x2d07d5[_0x39bc('0x7c')]}});}})[_0x39bc('0x23')](handleEntityNotFound(_0x4eddad,null))[_0x39bc('0x23')](function(_0x20e540){if(_0x20e540){logger[_0x39bc('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x20e540[_0x39bc('0x40')],util[_0x39bc('0x7d')](_0x52de27[_0x39bc('0x58')],{'showHidden':![],'depth':null}));switch(_0x20e540[_0x39bc('0x40')]){case _0x39bc('0x7e'):if(_0x52de27[_0x39bc('0x58')]['MessageSid']&&_0x52de27['body']['MessageSid']===_0x9eeee4['messageId']){return _0x9eeee4[_0x39bc('0x36')]({'read':!![]});}else{logger['error'](_0x39bc('0x7f'),_0x39bc('0x2e'),_0x39bc('0x7e'),util[_0x39bc('0x7d')](_0x52de27[_0x39bc('0x58')],{'showHidden':![],'depth':null}));}break;case _0x39bc('0x80'):if(_0x52de27['body']['MessageUUID']&&_0x52de27[_0x39bc('0x58')][_0x39bc('0x81')]===_0x9eeee4[_0x39bc('0x82')]&&_[_0x39bc('0x83')]([_0x39bc('0x84'),'delivered'],_0x52de27[_0x39bc('0x58')][_0x39bc('0x85')])>=0x0){return _0x9eeee4[_0x39bc('0x36')]({'read':!![]});}else{logger[_0x39bc('0x28')](_0x39bc('0x7f'),_0x39bc('0x2e'),'plivio',util[_0x39bc('0x7d')](_0x52de27[_0x39bc('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4ac76e=_0x52de27[_0x39bc('0x58')][_0x39bc('0x86')][0x0];if(_0x4ac76e['status'][_0x39bc('0x87')]===_0x39bc('0x88')){return _0x9eeee4['update']({'read':!![]});}else{logger[_0x39bc('0x28')](_0x39bc('0x7f'),'status',_0x39bc('0x89'),util[_0x39bc('0x7d')](_0x52de27['body'],{'showHidden':![],'depth':null}));}break;}return _0x9eeee4;}})[_0x39bc('0x23')](respondWithResult(_0x4eddad,null))[_0x39bc('0x2c')](handleError(_0x4eddad,null));}; \ No newline at end of file +var _0x58d6=['get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','user','role','null','AcceptMessage','acceptMessage','manual','interface','channel','accept','EventManager','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.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~!@#$%^&-_=+[{]}.','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','SmsMessage','include','findAll','show','params','keys','length','includeAll','find','create','body','describe','../../config/logger','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact'];(function(_0x1ac736,_0x5ea881){var _0x450b8c=function(_0x459556){while(--_0x459556){_0x1ac736['push'](_0x1ac736['shift']());}};_0x450b8c(++_0x5ea881);}(_0x58d6,0x1d3));var _0x658d=function(_0x3d2012,_0x3d02b9){_0x3d2012=_0x3d2012-0x0;var _0x53d542=_0x58d6[_0x3d2012];return _0x53d542;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x658d('0x0'));var rimraf=require(_0x658d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x658d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x658d('0x3'));var Mustache=require(_0x658d('0x4'));var util=require(_0x658d('0x5'));var path=require(_0x658d('0x6'));var sox=require('sox');var csv=require(_0x658d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x658d('0x8'));var squel=require(_0x658d('0x9'));var crypto=require(_0x658d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x658d('0xb'));var toCsv=require(_0x658d('0x7'));var querystring=require(_0x658d('0xc'));var Papa=require('papaparse');var Redis=require(_0x658d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x658d('0xe'));var as=require(_0x658d('0xf'));var hardwareService=require(_0x658d('0x10'));var logger=require('../../config/logger')(_0x658d('0x11'));var utils=require(_0x658d('0x12'));var config=require(_0x658d('0x13'));var db=require(_0x658d('0x14'))['db'];config[_0x658d('0x15')]=_[_0x658d('0x16')](config[_0x658d('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x658d('0x17'))(new Redis(config[_0x658d('0x15')]));require(_0x658d('0x18'))[_0x658d('0x19')](socket);var jayson=require(_0x658d('0x1a'));var client=jayson[_0x658d('0x1b')][_0x658d('0x1c')]({'port':0x232c});var client9002=jayson[_0x658d('0x1b')][_0x658d('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x17b20f,_0x284431,_0x42aae9){if(_0x42aae9){var _0x2d8968=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d8968['test'](_0x284431)){return _0x17b20f;}else{throw new db[(_0x658d('0x1d'))][(_0x658d('0x1e'))](_0x658d('0x1f'));}}else{return _0x17b20f;}}function respondWithRpcPromise(_0x61cfa6,_0x8bcf62,_0x25769e,_0x13aa47){return new BPromise(function(_0x3cdc74,_0x331750){var _0x50b4c3=_0x13aa47||client;return _0x50b4c3['request'](_0x61cfa6,_0x25769e)[_0x658d('0x20')](function(_0x2a45dc){logger[_0x658d('0x21')](_0x658d('0x22'),_0x8bcf62,_0x658d('0x23'));logger[_0x658d('0x24')](_0x658d('0x25'),_0x8bcf62,_0x658d('0x23'),JSON[_0x658d('0x26')](_0x2a45dc));if(_0x2a45dc['error']){if(_0x2a45dc['error'][_0x658d('0x27')]===0x1f4){logger[_0x658d('0x28')]('SmsMessage,\x20%s,\x20%s',_0x8bcf62,_0x2a45dc[_0x658d('0x28')][_0x658d('0x29')]);return _0x331750(_0x2a45dc[_0x658d('0x28')]['message']);}logger['error'](_0x658d('0x22'),_0x8bcf62,_0x2a45dc[_0x658d('0x28')]['message']);return _0x3cdc74(_0x2a45dc[_0x658d('0x28')][_0x658d('0x29')]);}else{logger['info'](_0x658d('0x22'),_0x8bcf62,_0x658d('0x23'));_0x3cdc74(_0x2a45dc[_0x658d('0x2a')]['message']);}})[_0x658d('0x2b')](function(_0x12107d){logger[_0x658d('0x28')](_0x658d('0x22'),_0x8bcf62,_0x12107d);_0x331750(_0x12107d);});});}function respondWithStatusCode(_0xb2f751,_0x160d77){_0x160d77=_0x160d77||0xcc;return function(_0x1924aa){if(_0x1924aa){return _0xb2f751[_0x658d('0x2c')](_0x160d77);}return _0xb2f751[_0x658d('0x2d')](_0x160d77)[_0x658d('0x2e')]();};}function respondWithResult(_0x38cd62,_0x323042){_0x323042=_0x323042||0xc8;return function(_0x4c5176){if(_0x4c5176){return _0x38cd62[_0x658d('0x2d')](_0x323042)[_0x658d('0x2f')](_0x4c5176);}};}function respondWithFilteredResult(_0x540303,_0x11c191){return function(_0xda355b){if(_0xda355b){var _0x17db1a=_0xda355b[_0x658d('0x30')],_0x1e189b=_0x11c191[_0x658d('0x31')],_0xc62d8=_0x11c191[_0x658d('0x31')]+_0x11c191['limit'],_0x9d8b62;if(_0xc62d8>=_0x17db1a){_0xc62d8=_0x17db1a;_0x9d8b62=0xc8;}else{_0x9d8b62=0xce;}_0x540303[_0x658d('0x2d')](_0x9d8b62);return _0x540303['set'](_0x658d('0x32'),_0x1e189b+'-'+_0xc62d8+'/'+_0x17db1a)[_0x658d('0x2f')](_0xda355b);}return null;};}function patchUpdates(_0x3aabaa){return function(_0x2565e){try{jsonpatch[_0x658d('0x33')](_0x2565e,_0x3aabaa,!![]);}catch(_0x1b1874){return BPromise[_0x658d('0x34')](_0x1b1874);}return _0x2565e[_0x658d('0x35')]();};}function saveUpdates(_0x3896c1,_0x40e20e){return function(_0x40f04f){if(_0x40f04f){return _0x40f04f[_0x658d('0x36')](_0x3896c1)[_0x658d('0x20')](function(_0x1eb131){return _0x1eb131;});}return null;};}function removeEntity(_0x1e56f8,_0xab3f2d){return function(_0x53f2a5){if(_0x53f2a5){return _0x53f2a5['destroy']()[_0x658d('0x20')](function(){_0x1e56f8['status'](0xcc)[_0x658d('0x2e')]();});}};}function handleEntityNotFound(_0x12852d,_0x2d30fd){return function(_0x11bf24){if(!_0x11bf24){_0x12852d[_0x658d('0x2c')](0x194);}return _0x11bf24;};}function handleError(_0x13d12a,_0x3b6812){_0x3b6812=_0x3b6812||0x1f4;return function(_0x1f4269){logger[_0x658d('0x28')](_0x1f4269['stack']);if(_0x1f4269['name']){delete _0x1f4269[_0x658d('0x37')];}_0x13d12a[_0x658d('0x2d')](_0x3b6812)[_0x658d('0x38')](_0x1f4269);};}exports[_0x658d('0x39')]=function(_0x2702e3,_0x13ad5e){var _0x118783={},_0x39ae42={},_0x47438a={'count':0x0,'rows':[]};var _0x3c0f8d=_[_0x658d('0x3a')](db['SmsMessage'][_0x658d('0x3b')],function(_0x2ac68c){return{'name':_0x2ac68c[_0x658d('0x3c')],'type':_0x2ac68c[_0x658d('0x3d')][_0x658d('0x3e')]};});_0x39ae42[_0x658d('0x3f')]=_[_0x658d('0x3a')](_0x3c0f8d,_0x658d('0x37'));_0x39ae42[_0x658d('0x40')]=_['keys'](_0x2702e3[_0x658d('0x40')]);_0x39ae42[_0x658d('0x41')]=_[_0x658d('0x42')](_0x39ae42[_0x658d('0x3f')],_0x39ae42[_0x658d('0x40')]);_0x118783[_0x658d('0x43')]=_[_0x658d('0x42')](_0x39ae42['model'],qs[_0x658d('0x44')](_0x2702e3[_0x658d('0x40')][_0x658d('0x44')]));_0x118783[_0x658d('0x43')]=_0x118783[_0x658d('0x43')]['length']?_0x118783[_0x658d('0x43')]:_0x39ae42['model'];if(!_0x2702e3['query'][_0x658d('0x45')](_0x658d('0x46'))){_0x118783[_0x658d('0x47')]=qs['limit'](_0x2702e3[_0x658d('0x40')]['limit']);_0x118783[_0x658d('0x31')]=qs[_0x658d('0x31')](_0x2702e3[_0x658d('0x40')]['offset']);}_0x118783[_0x658d('0x48')]=qs['sort'](_0x2702e3[_0x658d('0x40')][_0x658d('0x49')]);_0x118783[_0x658d('0x4a')]=qs[_0x658d('0x41')](_['pick'](_0x2702e3[_0x658d('0x40')],_0x39ae42['filters']),_0x3c0f8d);if(_0x2702e3[_0x658d('0x40')][_0x658d('0x4b')]){_0x118783['where']=_['merge'](_0x118783[_0x658d('0x4a')],{'$or':_[_0x658d('0x3a')](_0x3c0f8d,function(_0x545c0f){if(_0x545c0f[_0x658d('0x3d')]!==_0x658d('0x4c')){var _0x2b8dd8={};_0x2b8dd8[_0x545c0f[_0x658d('0x37')]]={'$like':'%'+_0x2702e3['query']['filter']+'%'};return _0x2b8dd8;}})});}_0x118783=_[_0x658d('0x4d')]({},_0x118783,_0x2702e3[_0x658d('0x4e')]);var _0x1ec5a7={'where':_0x118783[_0x658d('0x4a')]};return db[_0x658d('0x4f')][_0x658d('0x30')](_0x1ec5a7)['then'](function(_0x4ec428){_0x47438a[_0x658d('0x30')]=_0x4ec428;if(_0x2702e3[_0x658d('0x40')]['includeAll']){_0x118783[_0x658d('0x50')]=[{'all':!![]}];}return db[_0x658d('0x4f')][_0x658d('0x51')](_0x118783);})[_0x658d('0x20')](function(_0x5d19b3){_0x47438a['rows']=_0x5d19b3;return _0x47438a;})[_0x658d('0x20')](respondWithFilteredResult(_0x13ad5e,_0x118783))[_0x658d('0x2b')](handleError(_0x13ad5e,null));};exports[_0x658d('0x52')]=function(_0x24ecfc,_0x2ae11b){var _0x1447ac={'raw':!![],'where':{'id':_0x24ecfc[_0x658d('0x53')]['id']}},_0x386eff={};_0x386eff['model']=_[_0x658d('0x54')](db['SmsMessage'][_0x658d('0x3b')]);_0x386eff[_0x658d('0x40')]=_[_0x658d('0x54')](_0x24ecfc[_0x658d('0x40')]);_0x386eff[_0x658d('0x41')]=_[_0x658d('0x42')](_0x386eff[_0x658d('0x3f')],_0x386eff[_0x658d('0x40')]);_0x1447ac[_0x658d('0x43')]=_[_0x658d('0x42')](_0x386eff[_0x658d('0x3f')],qs['fields'](_0x24ecfc['query'][_0x658d('0x44')]));_0x1447ac[_0x658d('0x43')]=_0x1447ac['attributes'][_0x658d('0x55')]?_0x1447ac['attributes']:_0x386eff['model'];if(_0x24ecfc[_0x658d('0x40')][_0x658d('0x56')]){_0x1447ac[_0x658d('0x50')]=[{'all':!![]}];}_0x1447ac=_[_0x658d('0x4d')]({},_0x1447ac,_0x24ecfc[_0x658d('0x4e')]);return db[_0x658d('0x4f')][_0x658d('0x57')](_0x1447ac)[_0x658d('0x20')](handleEntityNotFound(_0x2ae11b,null))[_0x658d('0x20')](respondWithResult(_0x2ae11b,null))[_0x658d('0x2b')](handleError(_0x2ae11b,null));};exports[_0x658d('0x58')]=function(_0x3fe125,_0x26d7e8){return db[_0x658d('0x4f')][_0x658d('0x58')](_0x3fe125[_0x658d('0x59')],{})[_0x658d('0x20')](respondWithResult(_0x26d7e8,0xc9))[_0x658d('0x2b')](handleError(_0x26d7e8,null));};exports[_0x658d('0x36')]=function(_0x366a77,_0x1c1a14){if(_0x366a77[_0x658d('0x59')]['id']){delete _0x366a77[_0x658d('0x59')]['id'];}return db[_0x658d('0x4f')][_0x658d('0x57')]({'where':{'id':_0x366a77['params']['id']}})['then'](handleEntityNotFound(_0x1c1a14,null))[_0x658d('0x20')](saveUpdates(_0x366a77[_0x658d('0x59')],null))['then'](respondWithResult(_0x1c1a14,null))[_0x658d('0x2b')](handleError(_0x1c1a14,null));};exports['destroy']=function(_0xfdfcb,_0x2facfc){return db['SmsMessage']['find']({'where':{'id':_0xfdfcb[_0x658d('0x53')]['id']}})[_0x658d('0x20')](handleEntityNotFound(_0x2facfc,null))[_0x658d('0x20')](removeEntity(_0x2facfc,null))['catch'](handleError(_0x2facfc,null));};exports[_0x658d('0x5a')]=function(_0x12bf33,_0x128d31){return db['SmsMessage'][_0x658d('0x5a')]()[_0x658d('0x20')](respondWithResult(_0x128d31,null))['catch'](handleError(_0x128d31,null));};var interaction_log=require(_0x658d('0x5b'))(_0x658d('0x5c'));exports['accept']=function(_0x21af99,_0x53ccba,_0x1dd267){var _0x7c51dd={'channel':_0x658d('0x5d')};if(_0x21af99[_0x658d('0x59')]['id']){delete _0x21af99[_0x658d('0x59')]['id'];}_0x21af99['body'][_0x658d('0x5e')]=!![];_0x21af99[_0x658d('0x59')][_0x658d('0x5f')]=moment()[_0x658d('0x60')](_0x658d('0x61'));_0x21af99[_0x658d('0x59')][_0x658d('0x62')]=_0x21af99['body']['UserId']||_0x21af99['user']['id'];return db[_0x658d('0x4f')][_0x658d('0x57')]({'where':{'id':_0x21af99[_0x658d('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x658d('0x63')],'as':_0x658d('0x64')}]})[_0x658d('0x20')](handleEntityNotFound(_0x53ccba,null))[_0x658d('0x20')](saveUpdates(_0x21af99[_0x658d('0x59')],null))[_0x658d('0x20')](function(_0x3f70f7){if(_0x3f70f7){_0x7c51dd[_0x658d('0x29')]=_0x3f70f7[_0x658d('0x65')]({'plain':!![]});return db[_0x658d('0x66')][_0x658d('0x57')]({'where':{'id':_0x3f70f7[_0x658d('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x53ccba,null))[_0x658d('0x20')](function(_0x3651e5){if(_0x3651e5){return _0x3651e5[_0x658d('0x36')]({'UserId':_0x21af99['body'][_0x658d('0x62')],'read1stAt':_[_0x658d('0x68')](_0x3651e5[_0x658d('0x69')])?moment()[_0x658d('0x60')](_0x658d('0x61')):undefined});}return null;})[_0x658d('0x20')](function(_0x833d06){if(_0x833d06){_0x7c51dd[_0x658d('0x6a')]=_0x833d06['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x21af99['user']['id'],_0x21af99[_0x658d('0x6b')][_0x658d('0x37')],_0x21af99[_0x658d('0x6b')][_0x658d('0x6c')],_0x7c51dd[_0x658d('0x6a')]['id'],_0x21af99[_0x658d('0x59')]?JSON[_0x658d('0x26')](_0x21af99[_0x658d('0x59')]):_0x658d('0x6d'));return respondWithRpcPromise(_0x658d('0x6e'),_0x658d('0x6f'),_0x7c51dd);}return null;})['then'](function(_0xa9f87c){if(_0xa9f87c){if(_0x21af99[_0x658d('0x59')][_0x658d('0x70')]){_0x7c51dd[_0x658d('0x29')][_0x658d('0x71')]=util[_0x658d('0x60')]('SIP/%s',_0x21af99['user'][_0x658d('0x37')]);_0x7c51dd[_0x658d('0x29')][_0x658d('0x72')]=_0x7c51dd[_0x658d('0x72')];_0x7c51dd[_0x658d('0x29')]['event']=_0x658d('0x73');return respondWithRpcPromise(_0x658d('0x74'),'EventManager',{'event':'acceptmessage','message':_0x7c51dd[_0x658d('0x29')]},client9002)[_0x658d('0x20')](function(){return _0x7c51dd;});}return _0x7c51dd;}return null;})[_0x658d('0x20')](respondWithResult(_0x53ccba,null))[_0x658d('0x2b')](handleError(_0x53ccba,null));};var interaction_log=require(_0x658d('0x5b'))('sms-interactions');exports[_0x658d('0x34')]=function(_0xb00956,_0xa4385c,_0xb4886e){var _0x4702dc={'agent':{},'channel':_0x658d('0x5d')};if(_0xb00956[_0x658d('0x59')]['id']){delete _0xb00956['body']['id'];}_0xb00956['body'][_0x658d('0x62')]=_0xb00956[_0x658d('0x59')][_0x658d('0x62')]||_0xb00956[_0x658d('0x6b')]['id'];_0x4702dc[_0x658d('0x75')]['id']=_0xb00956[_0x658d('0x59')][_0x658d('0x62')];return db['SmsMessage'][_0x658d('0x57')]({'where':{'id':_0xb00956['params']['id'],'UserId':null}})[_0x658d('0x20')](handleEntityNotFound(_0xa4385c,null))[_0x658d('0x20')](function(_0x256e09){if(_0x256e09){_0x4702dc[_0x658d('0x29')]=_0x256e09[_0x658d('0x65')]({'plain':!![]});return db[_0x658d('0x66')][_0x658d('0x57')]({'where':{'id':_0x256e09[_0x658d('0x67')]}});}return null;})[_0x658d('0x20')](handleEntityNotFound(_0xa4385c,null))['then'](function(_0x413aca){if(_0x413aca){_0x4702dc['interaction']=_0x413aca['get']({'plain':!![]});interaction_log[_0x658d('0x21')](_0x658d('0x76'),_0xb00956['user']['id'],_0xb00956[_0x658d('0x6b')]['name'],_0xb00956[_0x658d('0x6b')][_0x658d('0x6c')],_0x4702dc[_0x658d('0x6a')]['id'],_0xb00956[_0x658d('0x59')]?JSON[_0x658d('0x26')](_0xb00956[_0x658d('0x59')]):_0x658d('0x6d'));return respondWithRpcPromise(_0x658d('0x77'),_0x658d('0x78'),_0x4702dc);}return null;})['then'](function(_0x210fee){if(_0x210fee){_0x210fee[_0x658d('0x29')][_0x658d('0x71')]=util[_0x658d('0x60')](_0x658d('0x79'),_0xb00956[_0x658d('0x6b')][_0x658d('0x37')]);_0x210fee[_0x658d('0x29')][_0x658d('0x72')]=_0x4702dc[_0x658d('0x72')];_0x210fee['message']['event']=_0x658d('0x34');respondWithRpcPromise(_0x658d('0x74'),'EventManager',{'event':_0x658d('0x7a'),'message':_0x210fee[_0x658d('0x29')]},client9002);return _0x4702dc;}return null;})['then'](respondWithResult(_0xa4385c,null))[_0x658d('0x2b')](handleError(_0xa4385c,null));};exports[_0x658d('0x2d')]=function(_0x3c456e,_0x32992c,_0x56637e){if(_0x3c456e['body']['id']){delete _0x3c456e[_0x658d('0x59')]['id'];}var _0x7e2310;return db[_0x658d('0x4f')][_0x658d('0x57')]({'where':{'id':_0x3c456e['params']['id']}})[_0x658d('0x20')](handleEntityNotFound(_0x32992c,null))['then'](function(_0x2b4c03){if(_0x2b4c03){_0x7e2310=_0x2b4c03;return db[_0x658d('0x7b')][_0x658d('0x57')]({'where':{'id':_0x2b4c03[_0x658d('0x7c')]}});}})['then'](handleEntityNotFound(_0x32992c,null))[_0x658d('0x20')](function(_0x4e92a4){if(_0x4e92a4){logger[_0x658d('0x24')](_0x658d('0x25'),_0x658d('0x2d'),_0x658d('0x7d'),_0x4e92a4[_0x658d('0x3d')],util[_0x658d('0x7e')](_0x3c456e[_0x658d('0x59')],{'showHidden':![],'depth':null}));switch(_0x4e92a4[_0x658d('0x3d')]){case _0x658d('0x7f'):if(_0x3c456e[_0x658d('0x59')][_0x658d('0x80')]&&_0x3c456e[_0x658d('0x59')][_0x658d('0x80')]===_0x7e2310[_0x658d('0x81')]){return _0x7e2310['update']({'read':!![]});}else{logger['error'](_0x658d('0x82'),_0x658d('0x2d'),_0x658d('0x7f'),util[_0x658d('0x7e')](_0x3c456e[_0x658d('0x59')],{'showHidden':![],'depth':null}));}break;case _0x658d('0x83'):if(_0x3c456e[_0x658d('0x59')][_0x658d('0x84')]&&_0x3c456e[_0x658d('0x59')][_0x658d('0x84')]===_0x7e2310[_0x658d('0x81')]&&_[_0x658d('0x85')]([_0x658d('0x86'),_0x658d('0x87')],_0x3c456e['body'][_0x658d('0x88')])>=0x0){return _0x7e2310[_0x658d('0x36')]({'read':!![]});}else{logger['error'](_0x658d('0x82'),'status',_0x658d('0x89'),util['inspect'](_0x3c456e[_0x658d('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3d7689=_0x3c456e[_0x658d('0x59')][_0x658d('0x8a')][0x0];if(_0x3d7689[_0x658d('0x2d')][_0x658d('0x8b')]===_0x658d('0x8c')){return _0x7e2310[_0x658d('0x36')]({'read':!![]});}else{logger[_0x658d('0x28')](_0x658d('0x82'),_0x658d('0x2d'),_0x658d('0x8d'),util[_0x658d('0x7e')](_0x3c456e[_0x658d('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x7e2310;}})['then'](respondWithResult(_0x32992c,null))[_0x658d('0x2b')](handleError(_0x32992c,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 1951f4f..eacc928 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 _0xd40e=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x51b241,_0x187fab){var _0x16a3a7=function(_0x5f1b23){while(--_0x5f1b23){_0x51b241['push'](_0x51b241['shift']());}};_0x16a3a7(++_0x187fab);}(_0xd40e,0x155));var _0xed40=function(_0x3c1312,_0x45bfdb){_0x3c1312=_0x3c1312-0x0;var _0x5b4831=_0xd40e[_0x3c1312];return _0x5b4831;};'use strict';var EventEmitter=require(_0xed40('0x0'));var SmsMessage=require(_0xed40('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xed40('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xed40('0x3'),'afterDestroy':_0xed40('0x4')};function emitEvent(_0x11afc3){return function(_0x3d3c73,_0x3fb3d2,_0x14020f){SmsMessageEvents[_0xed40('0x5')](_0x11afc3+':'+_0x3d3c73['id'],_0x3d3c73);SmsMessageEvents['emit'](_0x11afc3,_0x3d3c73);_0x14020f(null);};}for(var e in events){if(events[_0xed40('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xed40('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x7caa=['SmsMessage','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x142a8f,_0x1ff9cd){var _0x2dade1=function(_0x1b1adb){while(--_0x1b1adb){_0x142a8f['push'](_0x142a8f['shift']());}};_0x2dade1(++_0x1ff9cd);}(_0x7caa,0x1db));var _0xa7ca=function(_0x1dbf78,_0x5ebf26){_0x1dbf78=_0x1dbf78-0x0;var _0x2d5f60=_0x7caa[_0x1dbf78];return _0x2d5f60;};'use strict';var EventEmitter=require(_0xa7ca('0x0'));var SmsMessage=require(_0xa7ca('0x1'))['db'][_0xa7ca('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa7ca('0x3'),'afterUpdate':_0xa7ca('0x4'),'afterDestroy':_0xa7ca('0x5')};function emitEvent(_0x5aaeb8){return function(_0x568e42,_0x51dad1,_0xc44fd4){SmsMessageEvents[_0xa7ca('0x6')](_0x5aaeb8+':'+_0x568e42['id'],_0x568e42);SmsMessageEvents[_0xa7ca('0x6')](_0x5aaeb8,_0x568e42);_0xc44fd4(null);};}for(var e in events){if(events[_0xa7ca('0x7')](e)){var event=events[e];SmsMessage[_0xa7ca('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 afe318f..c290c3b 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 _0xdd91=['baseUrl','/auth/1/session','/api/sms/messages/','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','keys','sort','length','createHash','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','catch','error','SmsAccountId','type','twilio','accountSid','phone','messages','create','remote','/status?token=','token','sid','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','sms','user_key','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','authToken','senderString','POST','https://smsapi.connectel.se/api/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','infobip'];(function(_0x136852,_0x313cd0){var _0x49fb3b=function(_0x2f9e14){while(--_0x2f9e14){_0x136852['push'](_0x136852['shift']());}};_0x49fb3b(++_0x313cd0);}(_0xdd91,0x188));var _0x1dd9=function(_0x342616,_0x4ea22c){_0x342616=_0x342616-0x0;var _0x5c1cdb=_0xdd91[_0x342616];return _0x5c1cdb;};'use strict';var _=require(_0x1dd9('0x0'));var util=require(_0x1dd9('0x1'));var logger=require(_0x1dd9('0x2'))(_0x1dd9('0x3'));var moment=require(_0x1dd9('0x4'));var BPromise=require('bluebird');var rp=require(_0x1dd9('0x5'));var fs=require('fs');var path=require(_0x1dd9('0x6'));var rimraf=require(_0x1dd9('0x7'));var config=require(_0x1dd9('0x8'));var attributes=require(_0x1dd9('0x9'));module[_0x1dd9('0xa')]=function(_0x287443,_0x46159d){return _0x287443[_0x1dd9('0xb')]('SmsMessage',attributes,{'tableName':_0x1dd9('0xc'),'paranoid':![],'indexes':[{'name':_0x1dd9('0xd'),'fields':[_0x1dd9('0xd')]},{'name':'fti_sms_messages','fields':[_0x1dd9('0xe')],'type':_0x1dd9('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41bae0,_0x2a797c,_0x242ff9){var _0x2ec890=_0x287443[_0x1dd9('0x10')];var _0x31f50b=_0x41bae0['get']({'plain':!![]});if(_0x31f50b[_0x1dd9('0x11')][_0x1dd9('0x12')]()==='in'||_0x31f50b[_0x1dd9('0x11')][_0x1dd9('0x12')]()===_0x1dd9('0x13')&&!_0x31f50b[_0x1dd9('0x14')]&&!_[_0x1dd9('0x15')](_0x31f50b[_0x1dd9('0x16')])){_0x2ec890[_0x1dd9('0x17')][_0x1dd9('0x18')]({'where':{'id':_0x31f50b['SmsInteractionId']}})[_0x1dd9('0x19')](function(_0x12967d){if(_0x12967d){_0x12967d[_0x1dd9('0x1a')]({'lastMsgAt':_0x31f50b[_0x1dd9('0x1b')],'lastMsgDirection':_0x31f50b[_0x1dd9('0x11')][_0x1dd9('0x12')]()});}})[_0x1dd9('0x1c')](function(_0x12552){console[_0x1dd9('0x1d')](_0x12552);});}if(_0x31f50b[_0x1dd9('0x11')]==='out'&&!_0x31f50b[_0x1dd9('0x14')]){var _0x59a63a;_0x2ec890['SmsAccount']['find']({'where':{'id':_0x31f50b[_0x1dd9('0x1e')]},'raw':!![]})[_0x1dd9('0x19')](function(_0x53576c){_0x59a63a=_0x53576c;if(_0x59a63a&&_0x59a63a[_0x1dd9('0x1f')]){switch(_0x59a63a[_0x1dd9('0x1f')]){case _0x1dd9('0x20'):var _0xcb2c11=require(_0x1dd9('0x20'));if(_0x59a63a[_0x1dd9('0x21')]&&_0x59a63a['authToken']&&_0x59a63a[_0x1dd9('0x22')]){var _0x3dca45=new _0xcb2c11(_0x59a63a[_0x1dd9('0x21')],_0x59a63a['authToken']);_0x3dca45[_0x1dd9('0x23')][_0x1dd9('0x24')]({'body':_0x31f50b[_0x1dd9('0xe')],'to':_0x31f50b[_0x1dd9('0x22')],'from':_0x59a63a[_0x1dd9('0x22')],'statusCallback':_0x59a63a[_0x1dd9('0x25')]+'/api/sms/messages/'+_0x31f50b['id']+_0x1dd9('0x26')+_0x59a63a[_0x1dd9('0x27')]})[_0x1dd9('0x19')](function(_0x40a6c8){if(_0x40a6c8[_0x1dd9('0x28')]){return _0x41bae0[_0x1dd9('0x1a')]({'messageId':_0x40a6c8[_0x1dd9('0x28')]});}})['catch'](function(_0x256cde){logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x20'),util[_0x1dd9('0x2b')](_0x256cde,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x20'),_0x1dd9('0x2c'));}break;case'skebby':var _0x2c9824=_0x1dd9('0x2d');if(_0x59a63a[_0x1dd9('0x2e')]&&_0x59a63a[_0x1dd9('0x2f')]){var _0x38f16a={'recipient':[_0x31f50b[_0x1dd9('0x22')]],'message':_0x31f50b[_0x1dd9('0xe')],'message_type':_0x59a63a['smsMethod']};if(_0x59a63a[_0x1dd9('0x30')]&&_0x59a63a[_0x1dd9('0x30')]!=='SI'){_0x38f16a[_0x1dd9('0x31')]=_0x59a63a[_0x1dd9('0x22')];}var _0x3931ed={'url':_0x2c9824+_0x1dd9('0x32')+_0x59a63a[_0x1dd9('0x2e')]+_0x1dd9('0x33')+_0x59a63a[_0x1dd9('0x2f')],'method':_0x1dd9('0x34')};rp(_0x3931ed)[_0x1dd9('0x19')](function(_0x59fb81){var _0x198404=_0x59fb81['split'](';');var _0x4c970d={'user_key':_0x198404[0x0],'session_key':_0x198404[0x1]};_0x3931ed={'url':_0x2c9824+_0x1dd9('0x35'),'method':'POST','headers':{'user_key':_0x4c970d[_0x1dd9('0x36')],'Session_key':_0x4c970d['session_key']},'json':!![],'body':_0x38f16a};return rp(_0x3931ed);})['then'](function(_0x2d313b){if(_0x2d313b['total_sent']>=0x1){var _0x50503a={'messageId':_0x2d313b[_0x1dd9('0x37')]};if(_0x59a63a[_0x1dd9('0x30')]!=='GP'||!_0x59a63a[_0x1dd9('0x38')]){_0x50503a['read']=!![];}return _0x41bae0[_0x1dd9('0x1a')](_0x50503a);}else{return logger[_0x1dd9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1dd9('0x39'),util[_0x1dd9('0x2b')](_0x2d313b,{'showHidden':![],'depth':null}));}})[_0x1dd9('0x1c')](function(_0x54680e){return logger['error'](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x39'),util['inspect'](_0x54680e,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x39'),_0x1dd9('0x3a'));}break;case'connectel':if(_0x59a63a[_0x1dd9('0x3b')]){var _0x358796={'recipient':_0x31f50b['phone'],'message':_0x31f50b[_0x1dd9('0xe')],'sender':_0x59a63a[_0x1dd9('0x3c')]||_0x59a63a['phone'],'authorization':_0x59a63a[_0x1dd9('0x3b')]};var _0x2a797c={'method':_0x1dd9('0x3d'),'uri':_0x1dd9('0x3e'),'body':_0x358796,'json':!![]};rp(_0x2a797c)[_0x1dd9('0x19')](function(_0x12672c){var _0x586181={'messageId':_0x12672c[_0x1dd9('0x3f')]};if(!_0x59a63a[_0x1dd9('0x38')]){_0x586181[_0x1dd9('0x40')]=!![];}return _0x41bae0[_0x1dd9('0x1a')](_0x586181);})[_0x1dd9('0x1c')](function(_0x1f5b23){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1dd9('0x2a'),'connectel',util[_0x1dd9('0x2b')](_0x1f5b23,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),'connectel',_0x1dd9('0x41'));}break;case _0x1dd9('0x42'):if(_0x59a63a[_0x1dd9('0x2e')]&&_0x59a63a['password']){var _0x358796={'messages':[{'source':_0x1dd9('0x43'),'to':_0x31f50b[_0x1dd9('0x22')],'body':_0x31f50b[_0x1dd9('0xe')],'from':_0x59a63a[_0x1dd9('0x3c')]||_0x59a63a[_0x1dd9('0x22')]}]};var _0x31510f=util[_0x1dd9('0x44')](_0x1dd9('0x45'),_0x59a63a[_0x1dd9('0x2e')],_0x59a63a[_0x1dd9('0x2f')]);var _0x2a797c={'method':'POST','uri':_0x1dd9('0x46'),'body':_0x358796,'headers':{'Authorization':util[_0x1dd9('0x44')](_0x1dd9('0x47'),new Buffer(_0x31510f)[_0x1dd9('0x48')]('base64'))},'json':!![]};rp(_0x2a797c)[_0x1dd9('0x19')](function(_0x26c267){if(_0x26c267[_0x1dd9('0x49')]>=0xc8&&_0x26c267['http_code']<=0xce){if(_0x26c267['data']&&_0x26c267[_0x1dd9('0x4a')][_0x1dd9('0x4b')]>0x0){var _0x41c892=_['head'](_0x26c267[_0x1dd9('0x4a')][_0x1dd9('0x23')]);var _0x3f8d0f={'messageId':_0x41c892[_0x1dd9('0x4c')]};if(!_0x59a63a[_0x1dd9('0x38')]){_0x3f8d0f['read']=!![];}return _0x41bae0[_0x1dd9('0x1a')](_0x3f8d0f);}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x4d'),util['inspect'](_0x26c267,{'showHidden':![],'depth':null}));}}else{logger[_0x1dd9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1dd9('0x2a'),_0x1dd9('0x4d'),util['inspect'](_0x26c267,{'showHidden':![],'depth':null}));}})[_0x1dd9('0x1c')](function(_0x7c6abf){logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x4d'),util[_0x1dd9('0x2b')](_0x7c6abf,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x4d'),_0x1dd9('0x3a'));}break;case _0x1dd9('0x4e'):if(_0x59a63a[_0x1dd9('0x4f')]&&_0x59a63a[_0x1dd9('0x3b')]){var _0x358796={'dst':_0x31f50b[_0x1dd9('0x22')],'text':_0x31f50b['body'],'src':_0x59a63a[_0x1dd9('0x3c')]||_0x59a63a[_0x1dd9('0x22')],'url':_0x59a63a['remote']+'/api/sms/messages/'+_0x31f50b['id']+_0x1dd9('0x26')+_0x59a63a[_0x1dd9('0x27')]};var _0x31510f=util[_0x1dd9('0x44')](_0x1dd9('0x45'),_0x59a63a[_0x1dd9('0x4f')],_0x59a63a[_0x1dd9('0x3b')]);var _0x2a797c={'method':_0x1dd9('0x3d'),'uri':util['format'](_0x1dd9('0x50'),_0x59a63a[_0x1dd9('0x4f')]),'body':_0x358796,'headers':{'Authorization':util[_0x1dd9('0x44')](_0x1dd9('0x47'),new Buffer(_0x31510f)[_0x1dd9('0x48')](_0x1dd9('0x51')))},'json':!![]};rp(_0x2a797c)[_0x1dd9('0x19')](function(_0x4250b1){var _0x4bbd3a={'messageId':_0x4250b1[_0x1dd9('0x52')][0x0]};return _0x41bae0['update'](_0x4bbd3a);})[_0x1dd9('0x1c')](function(_0x4b4260){logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x4e'),util['inspect'](_0x4b4260,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x1dd9('0x53'):if(_0x59a63a['username']&&_0x59a63a['password']){if(_0x59a63a[_0x1dd9('0x54')]){var _0x14c73f={'method':_0x1dd9('0x3d'),'uri':_0x59a63a['baseUrl']+_0x1dd9('0x55'),'body':{'username':_0x59a63a[_0x1dd9('0x2e')],'password':_0x59a63a[_0x1dd9('0x2f')]},'json':!![]};return rp(_0x14c73f)[_0x1dd9('0x19')](function(_0xe15fc5){var _0x5c5a1f={'method':_0x1dd9('0x3d'),'uri':_0x59a63a[_0x1dd9('0x54')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x59a63a['phone'],'destinations':[{'to':_0x31f50b['phone']}],'text':_0x31f50b[_0x1dd9('0xe')],'notifyUrl':_0x59a63a[_0x1dd9('0x25')]+_0x1dd9('0x56')+_0x31f50b['id']+_0x1dd9('0x26')+_0x59a63a[_0x1dd9('0x27')],'notifyContentType':_0x1dd9('0x57'),'callbackData':_0x59a63a['phone']+';'+_0x31f50b[_0x1dd9('0xe')]}]},'headers':{'Authorization':_0x1dd9('0x58')+_0xe15fc5[_0x1dd9('0x27')]},'json':!![]};return rp(_0x5c5a1f)[_0x1dd9('0x19')](function(_0x4c0a22){if(_0x4c0a22[_0x1dd9('0x23')]){var _0x15f15b={'messageId':_0x4c0a22[_0x1dd9('0x23')][0x0][_0x1dd9('0xd')]};if(!_0x59a63a['deliveryReport']){_0x15f15b[_0x1dd9('0x40')]=!![];}return _0x41bae0['update'](_0x15f15b);}else{return logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),'infobip',util[_0x1dd9('0x2b')](_0x4c0a22,{'showHidden':![],'depth':null}));}});})[_0x1dd9('0x1c')](function(_0x1dce89){return logger[_0x1dd9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1dd9('0x2a'),_0x1dd9('0x53'),util[_0x1dd9('0x2b')](_0x1dce89,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),'infobip',_0x1dd9('0x59'));}}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x53'),_0x1dd9('0x3a'));}break;case _0x1dd9('0x5a'):var _0x4b9c10=require(_0x1dd9('0x5b'));if(_0x59a63a[_0x1dd9('0x5c')]){var _0x47eb03={};_0x47eb03['login']=_0x59a63a[_0x1dd9('0x2e')];_0x47eb03[_0x1dd9('0x22')]=_0x31f50b[_0x1dd9('0x22')];_0x47eb03[_0x1dd9('0x31')]=_0x59a63a[_0x1dd9('0x22')];_0x47eb03[_0x1dd9('0x5d')]=_0x31f50b[_0x1dd9('0xe')];_0x47eb03['timestamp']=+new Date();var _0x285467='';var _0x4e39fd='';var _0x2ff8fd=Object[_0x1dd9('0x5e')](_0x47eb03);_0x2ff8fd[_0x1dd9('0x5f')]();for(var _0x4724ed=0x0;_0x4724ed<_0x2ff8fd[_0x1dd9('0x60')];_0x4724ed++){if(_0x285467!=''){_0x285467+='&';}_0x285467+=_0x2ff8fd[_0x4724ed]+'='+encodeURIComponent(_0x47eb03[_0x2ff8fd[_0x4724ed]]);_0x4e39fd+=_0x47eb03[_0x2ff8fd[_0x4724ed]];}_0x4e39fd+=_0x59a63a['apiKey'];_0x4e39fd=_0x4b9c10[_0x1dd9('0x61')]('md5')[_0x1dd9('0x1a')](_0x4e39fd)[_0x1dd9('0x62')](_0x1dd9('0x63'));if(_0x285467!==''){_0x285467+='&';}_0x285467+=_0x1dd9('0x64')+_0x4e39fd;var _0x3931ed={'method':_0x1dd9('0x34'),'uri':_0x59a63a['baseUrl']+_0x1dd9('0x65')+_0x285467,'json':!![]};return rp(_0x3931ed)[_0x1dd9('0x19')](function(_0x392af1){var _0x4a07b2=Object[_0x1dd9('0x5e')](_0x392af1);if(_0x392af1[_0x4a07b2[0x0]][_0x1dd9('0x1d')]&&parseInt(_0x392af1[_0x4a07b2[0x0]][_0x1dd9('0x1d')])===0x0){var _0x2f9655={'messageId':_0x392af1[_0x4a07b2[0x0]][_0x1dd9('0x66')]};if(!_0x59a63a[_0x1dd9('0x38')]){_0x2f9655[_0x1dd9('0x40')]=!![];}return _0x41bae0[_0x1dd9('0x1a')](_0x2f9655);}else{return logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x5a'),util['inspect'](_0x392af1[_0x1dd9('0x1d')],{'showHidden':![],'depth':null}));}})[_0x1dd9('0x1c')](function(_0x50887f){return logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x5a'),util['inspect'](_0x50887f,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x5a'),_0x1dd9('0x67'));}break;case _0x1dd9('0x68'):if(_0x59a63a[_0x1dd9('0x5c')]){var _0x5edc8d={'method':_0x1dd9('0x3d'),'uri':_0x1dd9('0x69'),'headers':{'Authorization':_0x59a63a['apiKey']},'body':{'content':_0x31f50b['body'],'to':[_0x31f50b[_0x1dd9('0x22')]],'from':_0x59a63a[_0x1dd9('0x22')],'binary':![],'clientMessageId':_0x1dd9('0x6a'),'charset':_0x1dd9('0x6b')},'json':!![]};rp(_0x5edc8d)['then'](function(_0x4c0c38){if(!_0x4c0c38[_0x1dd9('0x1d')]){var _0x3e7cc6={'messageId':_0x4c0c38[_0x1dd9('0x23')][0x0]['apiMessageId']};if(!_0x59a63a[_0x1dd9('0x38')]){_0x3e7cc6[_0x1dd9('0x40')]=!![];}return _0x41bae0[_0x1dd9('0x1a')](_0x3e7cc6);}else{return logger[_0x1dd9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1dd9('0x2a'),_0x1dd9('0x68'),util[_0x1dd9('0x2b')](_0x4c0c38[_0x1dd9('0x1d')],{'showHidden':![],'depth':null}));}})[_0x1dd9('0x1c')](function(_0x54b1b1){return logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),'clickatell',util[_0x1dd9('0x2b')](_0x54b1b1,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x68'),_0x1dd9('0x67'));}break;case _0x1dd9('0x6c'):if(_0x59a63a[_0x1dd9('0x5c')]){var _0xb19424={};var _0x3931ed={'method':_0x1dd9('0x3d'),'uri':_0x1dd9('0x6d'),'headers':{'Authorization':_0x1dd9('0x6e')+_0x59a63a[_0x1dd9('0x5c')],'Content-Type':_0x1dd9('0x57')},'body':{'from':_0x59a63a[_0x1dd9('0x22')],'to':_0x31f50b[_0x1dd9('0x22')],'text':_0x31f50b[_0x1dd9('0xe')]},'json':!![]};return rp(_0x3931ed)['then'](function(_0x299f09){if(_0x299f09['code']==0xca){_0xb19424[_0x1dd9('0x6f')]=_0x299f09;var _0x31d50c={'method':_0x1dd9('0x3d'),'uri':_0x1dd9('0x70'),'headers':{'Authorization':_0x1dd9('0x6e')+_0x59a63a['apiKey'],'Content-Type':_0x1dd9('0x57')},'body':{'refid':_0xb19424['message'][_0x1dd9('0x71')]},'json':!![]};return rp(_0x31d50c)['then'](function(_0x6efe1e){_0xb19424[_0x1dd9('0x72')]=_0x6efe1e;var _0xe0a59c={'messageId':_0xb19424[_0x1dd9('0x6f')]['refid'],'read':!![]};return _0x41bae0[_0x1dd9('0x1a')](_0xe0a59c);});}else{return logger[_0x1dd9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1dd9('0x2a'),'intelepeer',util['inspect'](_0x299f09,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2fb91d){return logger[_0x1dd9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1dd9('0x2a'),_0x1dd9('0x6c'),util['inspect'](_0x2fb91d,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x6c'),_0x1dd9('0x73'));}break;}}})[_0x1dd9('0x74')](function(){_0x242ff9();});}else{_0x242ff9();}}},'charset':_0x1dd9('0x75'),'collate':_0x1dd9('0x76')});}; \ No newline at end of file +var _0x79b7=['UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','refid','status','Token\x20not\x20received','finally','utf8mb4','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','UserId','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','messages','remote','/api/sms/messages/','token','then','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','username','split','sms','POST','user_key','session_key','total_sent','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','authToken','requestid','read','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','senderString','format','%s:%s','Basic\x20%s','base64','http_code','data','queued_count','head','clickSend','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','toString','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','csc','crypto','apiKey','sort','length','md5','hex','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x79b7,0x1c4));var _0x779b=function(_0x5e7ec8,_0x6dae85){_0x5e7ec8=_0x5e7ec8-0x0;var _0x47bc80=_0x79b7[_0x5e7ec8];return _0x47bc80;};'use strict';var _=require('lodash');var util=require(_0x779b('0x0'));var logger=require('../../config/logger')(_0x779b('0x1'));var moment=require('moment');var BPromise=require(_0x779b('0x2'));var rp=require(_0x779b('0x3'));var fs=require('fs');var path=require(_0x779b('0x4'));var rimraf=require(_0x779b('0x5'));var config=require(_0x779b('0x6'));var attributes=require(_0x779b('0x7'));module[_0x779b('0x8')]=function(_0x2a0975,_0x4ac92e){return _0x2a0975[_0x779b('0x9')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x779b('0xa'),'fields':[_0x779b('0xa')]},{'name':_0x779b('0xb'),'fields':[_0x779b('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a5307,_0x3c54bd,_0x11f177){var _0x2f1463=_0x2a0975[_0x779b('0xd')];var _0x447545=_0x1a5307[_0x779b('0xe')]({'plain':!![]});if(_0x447545[_0x779b('0xf')][_0x779b('0x10')]()==='in'||_0x447545[_0x779b('0xf')]['toLowerCase']()===_0x779b('0x11')&&!_0x447545[_0x779b('0x12')]&&!_['isNil'](_0x447545[_0x779b('0x13')])){_0x2f1463['SmsInteraction'][_0x779b('0x14')]({'where':{'id':_0x447545[_0x779b('0x15')]}})['then'](function(_0x4847a5){if(_0x4847a5){_0x4847a5[_0x779b('0x16')]({'lastMsgAt':_0x447545[_0x779b('0x17')],'lastMsgDirection':_0x447545[_0x779b('0xf')][_0x779b('0x10')]()});}})[_0x779b('0x18')](function(_0x1e24ac){console[_0x779b('0x19')](_0x1e24ac);});}if(_0x447545[_0x779b('0xf')]===_0x779b('0x11')&&!_0x447545[_0x779b('0x12')]){var _0x3c678d;_0x2f1463[_0x779b('0x1a')][_0x779b('0x1b')]({'where':{'id':_0x447545[_0x779b('0x1c')]},'raw':!![]})['then'](function(_0x43fd14){_0x3c678d=_0x43fd14;if(_0x3c678d&&_0x3c678d[_0x779b('0x1d')]){switch(_0x3c678d[_0x779b('0x1d')]){case _0x779b('0x1e'):var _0x18f9c0=require('twilio');if(_0x3c678d[_0x779b('0x1f')]&&_0x3c678d['authToken']&&_0x3c678d[_0x779b('0x20')]){var _0x276da1=new _0x18f9c0(_0x3c678d['accountSid'],_0x3c678d['authToken']);_0x276da1[_0x779b('0x21')]['create']({'body':_0x447545['body'],'to':_0x447545[_0x779b('0x20')],'from':_0x3c678d['phone'],'statusCallback':_0x3c678d[_0x779b('0x22')]+_0x779b('0x23')+_0x447545['id']+'/status?token='+_0x3c678d[_0x779b('0x24')]})[_0x779b('0x25')](function(_0x2dadf9){if(_0x2dadf9[_0x779b('0x26')]){return _0x1a5307[_0x779b('0x16')]({'messageId':_0x2dadf9[_0x779b('0x26')]});}})[_0x779b('0x18')](function(_0x44c72c){logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x1e'),util[_0x779b('0x29')](_0x44c72c,{'showHidden':![],'depth':null}));});}else{logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x779b('0x2a'):var _0x2d6af8=_0x779b('0x2b');if(_0x3c678d['username']&&_0x3c678d['password']){var _0x1b76f4={'recipient':[_0x447545[_0x779b('0x20')]],'message':_0x447545[_0x779b('0xc')],'message_type':_0x3c678d[_0x779b('0x2c')]};if(_0x3c678d[_0x779b('0x2c')]&&_0x3c678d['smsMethod']!=='SI'){_0x1b76f4[_0x779b('0x2d')]=_0x3c678d[_0x779b('0x20')];}var _0x3ea540={'url':_0x2d6af8+'login?username='+_0x3c678d[_0x779b('0x2e')]+'&password='+_0x3c678d['password'],'method':'GET'};rp(_0x3ea540)[_0x779b('0x25')](function(_0x5f0834){var _0x9416ce=_0x5f0834[_0x779b('0x2f')](';');var _0x279a4a={'user_key':_0x9416ce[0x0],'session_key':_0x9416ce[0x1]};_0x3ea540={'url':_0x2d6af8+_0x779b('0x30'),'method':_0x779b('0x31'),'headers':{'user_key':_0x279a4a[_0x779b('0x32')],'Session_key':_0x279a4a[_0x779b('0x33')]},'json':!![],'body':_0x1b76f4};return rp(_0x3ea540);})[_0x779b('0x25')](function(_0x1b8313){if(_0x1b8313[_0x779b('0x34')]>=0x1){var _0xbcd473={'messageId':_0x1b8313['internal_order_id']};if(_0x3c678d[_0x779b('0x2c')]!=='GP'||!_0x3c678d[_0x779b('0x35')]){_0xbcd473['read']=!![];}return _0x1a5307['update'](_0xbcd473);}else{return logger['error'](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x2a'),util[_0x779b('0x29')](_0x1b8313,{'showHidden':![],'depth':null}));}})[_0x779b('0x18')](function(_0x24ae36){return logger['error'](_0x779b('0x27'),'afterCreate',_0x779b('0x2a'),util['inspect'](_0x24ae36,{'showHidden':![],'depth':null}));});}else{logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x2a'),_0x779b('0x36'));}break;case _0x779b('0x37'):if(_0x3c678d['authToken']){var _0x35868d={'recipient':_0x447545[_0x779b('0x20')],'message':_0x447545[_0x779b('0xc')],'sender':_0x3c678d['senderString']||_0x3c678d['phone'],'authorization':_0x3c678d[_0x779b('0x38')]};var _0x3c54bd={'method':_0x779b('0x31'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x35868d,'json':!![]};rp(_0x3c54bd)['then'](function(_0x126e35){var _0x455aab={'messageId':_0x126e35[_0x779b('0x39')]};if(!_0x3c678d['deliveryReport']){_0x455aab[_0x779b('0x3a')]=!![];}return _0x1a5307[_0x779b('0x16')](_0x455aab);})['catch'](function(_0x25ba90){logger[_0x779b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x779b('0x28'),_0x779b('0x37'),util[_0x779b('0x29')](_0x25ba90,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x37'),_0x779b('0x3b'));}break;case _0x779b('0x3c'):if(_0x3c678d[_0x779b('0x2e')]&&_0x3c678d[_0x779b('0x3d')]){var _0x35868d={'messages':[{'source':_0x779b('0x3e'),'to':_0x447545['phone'],'body':_0x447545['body'],'from':_0x3c678d[_0x779b('0x3f')]||_0x3c678d[_0x779b('0x20')]}]};var _0x375790=util[_0x779b('0x40')](_0x779b('0x41'),_0x3c678d[_0x779b('0x2e')],_0x3c678d['password']);var _0x3c54bd={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x35868d,'headers':{'Authorization':util[_0x779b('0x40')](_0x779b('0x42'),new Buffer(_0x375790)['toString'](_0x779b('0x43')))},'json':!![]};rp(_0x3c54bd)[_0x779b('0x25')](function(_0x2ef5a1){if(_0x2ef5a1[_0x779b('0x44')]>=0xc8&&_0x2ef5a1[_0x779b('0x44')]<=0xce){if(_0x2ef5a1[_0x779b('0x45')]&&_0x2ef5a1['data'][_0x779b('0x46')]>0x0){var _0x574c57=_[_0x779b('0x47')](_0x2ef5a1['data'][_0x779b('0x21')]);var _0x5385ab={'messageId':_0x574c57['message_id']};if(!_0x3c678d[_0x779b('0x35')]){_0x5385ab[_0x779b('0x3a')]=!![];}return _0x1a5307['update'](_0x5385ab);}else{logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x48'),util[_0x779b('0x29')](_0x2ef5a1,{'showHidden':![],'depth':null}));}}else{logger[_0x779b('0x19')](_0x779b('0x27'),'afterCreate',_0x779b('0x48'),util['inspect'](_0x2ef5a1,{'showHidden':![],'depth':null}));}})[_0x779b('0x18')](function(_0x37e23b){logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x48'),util[_0x779b('0x29')](_0x37e23b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x779b('0x27'),'afterCreate',_0x779b('0x48'),_0x779b('0x36'));}break;case'plivo':if(_0x3c678d[_0x779b('0x49')]&&_0x3c678d[_0x779b('0x38')]){var _0x35868d={'dst':_0x447545[_0x779b('0x20')],'text':_0x447545[_0x779b('0xc')],'src':_0x3c678d['senderString']||_0x3c678d[_0x779b('0x20')],'url':_0x3c678d[_0x779b('0x22')]+'/api/sms/messages/'+_0x447545['id']+_0x779b('0x4a')+_0x3c678d[_0x779b('0x24')]};var _0x375790=util[_0x779b('0x40')](_0x779b('0x41'),_0x3c678d[_0x779b('0x49')],_0x3c678d['authToken']);var _0x3c54bd={'method':_0x779b('0x31'),'uri':util[_0x779b('0x40')](_0x779b('0x4b'),_0x3c678d[_0x779b('0x49')]),'body':_0x35868d,'headers':{'Authorization':util['format'](_0x779b('0x42'),new Buffer(_0x375790)[_0x779b('0x4c')](_0x779b('0x43')))},'json':!![]};rp(_0x3c54bd)[_0x779b('0x25')](function(_0xa2d116){var _0x2b3acf={'messageId':_0xa2d116['message_uuid'][0x0]};return _0x1a5307['update'](_0x2b3acf);})[_0x779b('0x18')](function(_0x5e98b7){logger['error'](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x4d'),util[_0x779b('0x29')](_0x5e98b7,{'showHidden':![],'depth':null}));});}else{logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),'plivo',_0x779b('0x4e'));}break;case _0x779b('0x4f'):if(_0x3c678d[_0x779b('0x2e')]&&_0x3c678d[_0x779b('0x3d')]){if(_0x3c678d['baseUrl']){var _0x23b1db={'method':'POST','uri':_0x3c678d[_0x779b('0x50')]+_0x779b('0x51'),'body':{'username':_0x3c678d['username'],'password':_0x3c678d['password']},'json':!![]};return rp(_0x23b1db)[_0x779b('0x25')](function(_0x47c5ea){var _0x452d02={'method':_0x779b('0x31'),'uri':_0x3c678d[_0x779b('0x50')]+_0x779b('0x52'),'body':{'messages':[{'from':_0x3c678d[_0x779b('0x20')],'destinations':[{'to':_0x447545[_0x779b('0x20')]}],'text':_0x447545[_0x779b('0xc')],'notifyUrl':_0x3c678d[_0x779b('0x22')]+_0x779b('0x23')+_0x447545['id']+_0x779b('0x4a')+_0x3c678d['token'],'notifyContentType':'application/json','callbackData':_0x3c678d[_0x779b('0x20')]+';'+_0x447545['body']}]},'headers':{'Authorization':_0x779b('0x53')+_0x47c5ea[_0x779b('0x24')]},'json':!![]};return rp(_0x452d02)[_0x779b('0x25')](function(_0x4b80fb){if(_0x4b80fb[_0x779b('0x21')]){var _0x560469={'messageId':_0x4b80fb[_0x779b('0x21')][0x0][_0x779b('0xa')]};if(!_0x3c678d[_0x779b('0x35')]){_0x560469[_0x779b('0x3a')]=!![];}return _0x1a5307['update'](_0x560469);}else{return logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x4f'),util[_0x779b('0x29')](_0x4b80fb,{'showHidden':![],'depth':null}));}});})[_0x779b('0x18')](function(_0x556d50){return logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),'infobip',util[_0x779b('0x29')](_0x556d50,{'showHidden':![],'depth':null}));});}else{logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x4f'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x779b('0x19')](_0x779b('0x27'),'afterCreate','infobip',_0x779b('0x36'));}break;case _0x779b('0x54'):var _0x69e3ea=require(_0x779b('0x55'));if(_0x3c678d[_0x779b('0x56')]){var _0x3efc0b={};_0x3efc0b['login']=_0x3c678d[_0x779b('0x2e')];_0x3efc0b[_0x779b('0x20')]=_0x447545[_0x779b('0x20')];_0x3efc0b[_0x779b('0x2d')]=_0x3c678d[_0x779b('0x20')];_0x3efc0b['text']=_0x447545[_0x779b('0xc')];_0x3efc0b['timestamp']=+new Date();var _0x580839='';var _0x136982='';var _0x60a86e=Object['keys'](_0x3efc0b);_0x60a86e[_0x779b('0x57')]();for(var _0x162eb0=0x0;_0x162eb0<_0x60a86e[_0x779b('0x58')];_0x162eb0++){if(_0x580839!=''){_0x580839+='&';}_0x580839+=_0x60a86e[_0x162eb0]+'='+encodeURIComponent(_0x3efc0b[_0x60a86e[_0x162eb0]]);_0x136982+=_0x3efc0b[_0x60a86e[_0x162eb0]];}_0x136982+=_0x3c678d['apiKey'];_0x136982=_0x69e3ea['createHash'](_0x779b('0x59'))[_0x779b('0x16')](_0x136982)['digest'](_0x779b('0x5a'));if(_0x580839!==''){_0x580839+='&';}_0x580839+='signature='+_0x136982;var _0x3ea540={'method':_0x779b('0x5b'),'uri':_0x3c678d[_0x779b('0x50')]+_0x779b('0x5c')+_0x580839,'json':!![]};return rp(_0x3ea540)[_0x779b('0x25')](function(_0x3dde5b){var _0x1860a5=Object['keys'](_0x3dde5b);if(_0x3dde5b[_0x1860a5[0x0]][_0x779b('0x19')]&&parseInt(_0x3dde5b[_0x1860a5[0x0]][_0x779b('0x19')])===0x0){var _0x2f53aa={'messageId':_0x3dde5b[_0x1860a5[0x0]][_0x779b('0x5d')]};if(!_0x3c678d[_0x779b('0x35')]){_0x2f53aa[_0x779b('0x3a')]=!![];}return _0x1a5307[_0x779b('0x16')](_0x2f53aa);}else{return logger['error'](_0x779b('0x27'),'afterCreate','csc',util['inspect'](_0x3dde5b['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e3463){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x779b('0x28'),'csc',util[_0x779b('0x29')](_0x4e3463,{'showHidden':![],'depth':null}));});}else{logger[_0x779b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x779b('0x28'),_0x779b('0x54'),_0x779b('0x5e'));}break;case _0x779b('0x5f'):if(_0x3c678d[_0x779b('0x56')]){var _0x6d353={'method':_0x779b('0x31'),'uri':_0x779b('0x60'),'headers':{'Authorization':_0x3c678d[_0x779b('0x56')]},'body':{'content':_0x447545[_0x779b('0xc')],'to':[_0x447545[_0x779b('0x20')]],'from':_0x3c678d[_0x779b('0x20')],'binary':![],'clientMessageId':_0x779b('0x61'),'charset':_0x779b('0x62')},'json':!![]};rp(_0x6d353)['then'](function(_0x479239){if(!_0x479239[_0x779b('0x19')]){var _0x113c1d={'messageId':_0x479239[_0x779b('0x21')][0x0][_0x779b('0x63')]};if(!_0x3c678d['deliveryReport']){_0x113c1d['read']=!![];}return _0x1a5307[_0x779b('0x16')](_0x113c1d);}else{return logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x5f'),util[_0x779b('0x29')](_0x479239[_0x779b('0x19')],{'showHidden':![],'depth':null}));}})[_0x779b('0x18')](function(_0x200045){return logger['error'](_0x779b('0x27'),_0x779b('0x28'),'clickatell',util['inspect'](_0x200045,{'showHidden':![],'depth':null}));});}else{logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x5f'),_0x779b('0x5e'));}break;case _0x779b('0x64'):if(_0x3c678d['apiKey']){var _0x4f4833={};var _0x3ea540={'method':_0x779b('0x31'),'uri':_0x779b('0x65'),'headers':{'Authorization':_0x779b('0x66')+_0x3c678d[_0x779b('0x56')],'Content-Type':_0x779b('0x67')},'body':{'from':_0x3c678d[_0x779b('0x20')],'to':_0x447545[_0x779b('0x20')],'text':_0x447545[_0x779b('0xc')]},'json':!![]};return rp(_0x3ea540)['then'](function(_0x5e58d2){if(_0x5e58d2['code']==0xca){_0x4f4833[_0x779b('0x68')]=_0x5e58d2;var _0x2090ec={'method':_0x779b('0x31'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x779b('0x66')+_0x3c678d['apiKey'],'Content-Type':_0x779b('0x67')},'body':{'refid':_0x4f4833['message'][_0x779b('0x69')]},'json':!![]};return rp(_0x2090ec)['then'](function(_0x75c7bf){_0x4f4833[_0x779b('0x6a')]=_0x75c7bf;var _0x2befc5={'messageId':_0x4f4833[_0x779b('0x68')][_0x779b('0x69')],'read':!![]};return _0x1a5307[_0x779b('0x16')](_0x2befc5);});}else{return logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x64'),util['inspect'](_0x5e58d2,{'showHidden':![],'depth':null}));}})[_0x779b('0x18')](function(_0x5ab14d){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x779b('0x28'),_0x779b('0x64'),util[_0x779b('0x29')](_0x5ab14d,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x64'),_0x779b('0x6b'));}break;}}})[_0x779b('0x6c')](function(){_0x11f177();});}else{_0x11f177();}}},'charset':_0x779b('0x6d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 4b3a6e5..5aa2a24 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 _0x66fa=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','request','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify'];(function(_0x4e7c03,_0x29ffcf){var _0x5510d3=function(_0xe60000){while(--_0xe60000){_0x4e7c03['push'](_0x4e7c03['shift']());}};_0x5510d3(++_0x29ffcf);}(_0x66fa,0x117));var _0xa66f=function(_0xbfaba2,_0x1e8ea2){_0xbfaba2=_0xbfaba2-0x0;var _0x491bfe=_0x66fa[_0xbfaba2];return _0x491bfe;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});config[_0xa66f('0xb')]=_[_0xa66f('0xc')](config[_0xa66f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa66f('0xd'))(new Redis(config['redis']));require(_0xa66f('0xe'))['register'](socket);function respondWithRpcPromise(_0x101e10,_0x53ca76,_0x52d802){return new BPromise(function(_0x55e6dc,_0x1e1997){return client[_0xa66f('0xf')](_0x101e10,_0x52d802)['then'](function(_0x14d31e){logger['info'](_0xa66f('0x10'),_0x53ca76,'request\x20sent');logger[_0xa66f('0x11')](_0xa66f('0x12'),_0x53ca76,_0xa66f('0x13'),JSON['stringify'](_0x14d31e));if(_0x14d31e['error']){if(_0x14d31e[_0xa66f('0x14')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);return _0x1e1997(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}logger[_0xa66f('0x14')]('SmsMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e['error'][_0xa66f('0x15')]);return _0x55e6dc(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}else{logger[_0xa66f('0x16')]('SmsMessage,\x20%s,\x20%s',_0x53ca76,_0xa66f('0x13'));_0x55e6dc(_0x14d31e['result']['message']);}})[_0xa66f('0x17')](function(_0x413e80){logger[_0xa66f('0x14')](_0xa66f('0x10'),_0x53ca76,_0x413e80);_0x1e1997(_0x413e80);});});}exports[_0xa66f('0x18')]=function(_0x408bc7){var _0x251f60=this;return new Promise(function(_0x150291,_0x2033a4){return db[_0xa66f('0x19')][_0xa66f('0x1a')](_0x408bc7[_0xa66f('0x1b')],{'raw':_0x408bc7[_0xa66f('0x1c')]?_0x408bc7[_0xa66f('0x1c')][_0xa66f('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x27f570){logger[_0xa66f('0x16')](_0xa66f('0x18'),_0x408bc7);logger[_0xa66f('0x11')]('CreateSmsMessage',_0x408bc7,JSON[_0xa66f('0x1e')](_0x27f570));_0x150291(_0x27f570);})[_0xa66f('0x17')](function(_0x209f4d){logger[_0xa66f('0x14')]('CreateSmsMessage',_0x209f4d['message'],_0x408bc7);_0x2033a4(_0x251f60[_0xa66f('0x14')](0x1f4,_0x209f4d['message']));});});}; \ No newline at end of file +var _0xda2d=['body','options','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','CreateSmsMessage','SmsMessage'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0xda2d,0x102));var _0xdda2=function(_0x2aeed7,_0x4c16b5){_0x2aeed7=_0x2aeed7-0x0;var _0x59f5be=_0xda2d[_0x2aeed7];return _0x59f5be;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});config[_0xdda2('0xa')]=_[_0xdda2('0xb')](config[_0xdda2('0xa')],{'host':_0xdda2('0xc'),'port':0x18eb});var socket=require(_0xdda2('0xd'))(new Redis(config['redis']));require(_0xdda2('0xe'))[_0xdda2('0xf')](socket);function respondWithRpcPromise(_0x4df6b8,_0x1c11b2,_0x2f3454){return new BPromise(function(_0x42d990,_0x346119){return client[_0xdda2('0x10')](_0x4df6b8,_0x2f3454)[_0xdda2('0x11')](function(_0x26fe81){logger[_0xdda2('0x12')]('SmsMessage,\x20%s,\x20%s',_0x1c11b2,'request\x20sent');logger['debug'](_0xdda2('0x13'),_0x1c11b2,_0xdda2('0x14'),JSON[_0xdda2('0x15')](_0x26fe81));if(_0x26fe81[_0xdda2('0x16')]){if(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x17')]===0x1f4){logger[_0xdda2('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x346119(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x18')]);}logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x42d990(_0x26fe81['error'][_0xdda2('0x18')]);}else{logger['info'](_0xdda2('0x19'),_0x1c11b2,_0xdda2('0x14'));_0x42d990(_0x26fe81[_0xdda2('0x1a')][_0xdda2('0x18')]);}})[_0xdda2('0x1b')](function(_0x17015f){logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x17015f);_0x346119(_0x17015f);});});}exports[_0xdda2('0x1c')]=function(_0x337b0b){var _0x312ef1=this;return new Promise(function(_0x6fdede,_0x4eed30){return db[_0xdda2('0x1d')]['create'](_0x337b0b[_0xdda2('0x1e')],{'raw':_0x337b0b[_0xdda2('0x1f')]?_0x337b0b[_0xdda2('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xdda2('0x11')](function(_0x5a9bb8){logger[_0xdda2('0x12')](_0xdda2('0x1c'),_0x337b0b);logger['debug'](_0xdda2('0x1c'),_0x337b0b,JSON[_0xdda2('0x15')](_0x5a9bb8));_0x6fdede(_0x5a9bb8);})[_0xdda2('0x1b')](function(_0x13b0f3){logger[_0xdda2('0x16')]('CreateSmsMessage',_0x13b0f3[_0xdda2('0x18')],_0x337b0b);_0x4eed30(_0x312ef1[_0xdda2('0x16')](0x1f4,_0x13b0f3[_0xdda2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index fa0b6b4..4e17849 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 _0x2123=['./smsMessage.events','save','remove','update','emit','removeListener','length','smsMessage:'];(function(_0x5fa520,_0xaf0e7d){var _0x1bf6c4=function(_0x2a7440){while(--_0x2a7440){_0x5fa520['push'](_0x5fa520['shift']());}};_0x1bf6c4(++_0xaf0e7d);}(_0x2123,0x188));var _0x3212=function(_0x47a37c,_0x5e3e52){_0x47a37c=_0x47a37c-0x0;var _0x22d62d=_0x2123[_0x47a37c];return _0x22d62d;};'use strict';var SmsMessageEvents=require(_0x3212('0x0'));var events=[_0x3212('0x1'),_0x3212('0x2'),_0x3212('0x3')];function createListener(_0x1cf79a,_0x1bd709){return function(_0x37fbb2){_0x1bd709[_0x3212('0x4')](_0x1cf79a,_0x37fbb2);};}function removeListener(_0x51eb06,_0x485c2e){return function(){SmsMessageEvents[_0x3212('0x5')](_0x51eb06,_0x485c2e);};}exports['register']=function(_0x2e4d72){for(var _0x438830=0x0,_0xc6f1b4=events[_0x3212('0x6')];_0x438830<_0xc6f1b4;_0x438830++){var _0x42d953=events[_0x438830];var _0x14e13a=createListener(_0x3212('0x7')+_0x42d953,_0x2e4d72);SmsMessageEvents['on'](_0x42d953,_0x14e13a);}}; \ No newline at end of file +var _0x73c1=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x73c1,0x1ad));var _0x173c=function(_0x9aad68,_0x45377){_0x9aad68=_0x9aad68-0x0;var _0x281340=_0x73c1[_0x9aad68];return _0x281340;};'use strict';var SmsMessageEvents=require(_0x173c('0x0'));var events=['save',_0x173c('0x1'),_0x173c('0x2')];function createListener(_0x437982,_0x23f64d){return function(_0x321f5b){_0x23f64d[_0x173c('0x3')](_0x437982,_0x321f5b);};}function removeListener(_0x219534,_0x388e16){return function(){SmsMessageEvents[_0x173c('0x4')](_0x219534,_0x388e16);};}exports[_0x173c('0x5')]=function(_0x51057c){for(var _0x102499=0x0,_0x5938d5=events[_0x173c('0x6')];_0x102499<_0x5938d5;_0x102499++){var _0x29802b=events[_0x102499];var _0x301229=createListener(_0x173c('0x7')+_0x29802b,_0x51057c);SmsMessageEvents['on'](_0x29802b,_0x301229);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index de5b983..278f87c 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 _0x4148=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x1a0564,_0x50e720){var _0x5dbd66=function(_0x2093ea){while(--_0x2093ea){_0x1a0564['push'](_0x1a0564['shift']());}};_0x5dbd66(++_0x50e720);}(_0x4148,0xc6));var _0x8414=function(_0x5e6fe1,_0x8f80ad){_0x5e6fe1=_0x5e6fe1-0x0;var _0x5a6018=_0x4148[_0x5e6fe1];return _0x5a6018;};'use strict';var multer=require(_0x8414('0x0'));var util=require(_0x8414('0x1'));var path=require(_0x8414('0x2'));var timeout=require(_0x8414('0x3'));var express=require(_0x8414('0x4'));var router=express['Router']();var auth=require(_0x8414('0x5'));var interaction=require(_0x8414('0x6'));var config=require(_0x8414('0x7'));var controller=require(_0x8414('0x8'));router['get']('/',auth[_0x8414('0x9')](),controller['index']);router[_0x8414('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x8414('0xb')]);router[_0x8414('0xa')](_0x8414('0xc'),auth[_0x8414('0x9')](),controller[_0x8414('0xd')]);router[_0x8414('0xa')](_0x8414('0xe'),auth[_0x8414('0x9')](),controller[_0x8414('0xf')]);router[_0x8414('0xa')](_0x8414('0x10'),auth['isAuthenticated'](),controller[_0x8414('0x11')]);router['get'](_0x8414('0x12'),auth[_0x8414('0x9')](),controller[_0x8414('0x13')]);router[_0x8414('0x14')]('/',auth['isAuthenticated'](),controller[_0x8414('0x15')]);router['post'](_0x8414('0x10'),auth[_0x8414('0x9')](),controller[_0x8414('0x16')]);router['post'](_0x8414('0x12'),auth[_0x8414('0x9')](),controller[_0x8414('0x17')]);router['put']('/:id',auth[_0x8414('0x9')](),controller[_0x8414('0x18')]);router[_0x8414('0x19')](_0x8414('0xc'),auth['isAuthenticated'](),controller[_0x8414('0x1a')]);router[_0x8414('0x19')](_0x8414('0x10'),auth[_0x8414('0x9')](),controller['removeTeams']);router['delete'](_0x8414('0x12'),auth['isAuthenticated'](),controller[_0x8414('0x1b')]);module[_0x8414('0x1c')]=router; \ No newline at end of file +var _0xaf0d=['index','describe','/:id','isAuthenticated','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addAgents','delete','removeAgents','exports','util','path','../../config/environment','./smsQueue.controller','get'];(function(_0x399fb4,_0x3b9673){var _0x599673=function(_0x5f16a1){while(--_0x5f16a1){_0x399fb4['push'](_0x399fb4['shift']());}};_0x599673(++_0x3b9673);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x315624,_0x526a80){_0x315624=_0x315624-0x0;var _0x5a15c9=_0xaf0d[_0x315624];return _0x5a15c9;};'use strict';var multer=require('multer');var util=require(_0xdaf0('0x0'));var path=require(_0xdaf0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdaf0('0x2'));var controller=require(_0xdaf0('0x3'));router[_0xdaf0('0x4')]('/',auth['isAuthenticated'](),controller[_0xdaf0('0x5')]);router[_0xdaf0('0x4')]('/describe',auth['isAuthenticated'](),controller[_0xdaf0('0x6')]);router[_0xdaf0('0x4')](_0xdaf0('0x7'),auth[_0xdaf0('0x8')](),controller['show']);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xdaf0('0x9')]);router[_0xdaf0('0x4')]('/:id/teams',auth[_0xdaf0('0x8')](),controller[_0xdaf0('0xa')]);router[_0xdaf0('0x4')](_0xdaf0('0xb'),auth['isAuthenticated'](),controller[_0xdaf0('0xc')]);router[_0xdaf0('0xd')]('/',auth[_0xdaf0('0x8')](),controller['create']);router[_0xdaf0('0xd')](_0xdaf0('0xe'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xdaf0('0xf')]);router['put'](_0xdaf0('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xdaf0('0x10')](_0xdaf0('0x7'),auth[_0xdaf0('0x8')](),controller['destroy']);router[_0xdaf0('0x10')](_0xdaf0('0xe'),auth[_0xdaf0('0x8')](),controller['removeTeams']);router['delete'](_0xdaf0('0xb'),auth[_0xdaf0('0x8')](),controller[_0xdaf0('0x11')]);module[_0xdaf0('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 40dab13..436752a 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 _0x2bec=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x469ed3,_0x3c1e7b){var _0x11dff4=function(_0x113f1e){while(--_0x113f1e){_0x469ed3['push'](_0x469ed3['shift']());}};_0x11dff4(++_0x3c1e7b);}(_0x2bec,0xf8));var _0xc2be=function(_0x31fe77,_0x46bdd2){_0x31fe77=_0x31fe77-0x0;var _0x31cf72=_0x2bec[_0x31fe77];return _0x31cf72;};'use strict';var Sequelize=require(_0xc2be('0x0'));module[_0xc2be('0x1')]={'name':{'type':Sequelize[_0xc2be('0x2')],'unique':_0xc2be('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc2be('0x4')](_0xc2be('0x5'),'beepall',_0xc2be('0x6'))}}; \ No newline at end of file +var _0x8c34=['roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1c0a25,_0x227201){var _0x4ddd7e=function(_0x59f4ac){while(--_0x59f4ac){_0x1c0a25['push'](_0x1c0a25['shift']());}};_0x4ddd7e(++_0x227201);}(_0x8c34,0x181));var _0x48c3=function(_0x2615b4,_0x535f59){_0x2615b4=_0x2615b4-0x0;var _0x471ae3=_0x8c34[_0x2615b4];return _0x471ae3;};'use strict';var Sequelize=require('sequelize');module[_0x48c3('0x0')]={'name':{'type':Sequelize[_0x48c3('0x1')],'unique':_0x48c3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x48c3('0x1')]},'timeout':{'type':Sequelize[_0x48c3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x48c3('0x4')](_0x48c3('0x5'),_0x48c3('0x6'),_0x48c3('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index ff02932..44a9b10 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 _0x37e0=['findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','includes','all','union','compact','value','removeTeams','isEmpty','userSmsQueue:remove','addAgents','omit','spread','removeAgents','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','count','set','apply','reject','save','then','destroy','get','SmsQueues','UserProfileResource','end','error','stack','name','send','rawAttributes','fieldName','type','query','filters','model','fields','attributes','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SmsQueue','includeAll','include','findAll','show','params','keys','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','rows','%s/%s','getTeams','findOne','nolimit','addTeams','ids','Agents','online','flatMap','sequelize','transaction','each'];(function(_0x1bc7ac,_0x1eed0e){var _0x5a35d7=function(_0x1496c6){while(--_0x1496c6){_0x1bc7ac['push'](_0x1bc7ac['shift']());}};_0x5a35d7(++_0x1eed0e);}(_0x37e0,0x135));var _0x037e=function(_0x39b6a4,_0x4c715a){_0x39b6a4=_0x39b6a4-0x0;var _0x12c896=_0x37e0[_0x39b6a4];return _0x12c896;};'use strict';var pdf=require(_0x037e('0x0'));var emlformat=require(_0x037e('0x1'));var rimraf=require(_0x037e('0x2'));var zipdir=require(_0x037e('0x3'));var jsonpatch=require(_0x037e('0x4'));var rp=require(_0x037e('0x5'));var moment=require(_0x037e('0x6'));var BPromise=require(_0x037e('0x7'));var Mustache=require(_0x037e('0x8'));var util=require(_0x037e('0x9'));var path=require(_0x037e('0xa'));var sox=require(_0x037e('0xb'));var csv=require(_0x037e('0xc'));var ejs=require(_0x037e('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x037e('0xe'));var crypto=require('crypto');var jsforce=require(_0x037e('0xf'));var deskjs=require(_0x037e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x037e('0x11'));var Papa=require(_0x037e('0x12'));var Redis=require(_0x037e('0x13'));var authService=require(_0x037e('0x14'));var qs=require(_0x037e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x037e('0x16'));var logger=require(_0x037e('0x17'))('api');var utils=require(_0x037e('0x18'));var config=require(_0x037e('0x19'));var db=require(_0x037e('0x1a'))['db'];config[_0x037e('0x1b')]=_[_0x037e('0x1c')](config['redis'],{'host':_0x037e('0x1d'),'port':0x18eb});var socket=require(_0x037e('0x1e'))(new Redis(config['redis']));require(_0x037e('0x1f'))[_0x037e('0x20')](socket);function respondWithStatusCode(_0xffefc6,_0x3b626f){_0x3b626f=_0x3b626f||0xcc;return function(_0x354604){if(_0x354604){return _0xffefc6[_0x037e('0x21')](_0x3b626f);}return _0xffefc6['status'](_0x3b626f)['end']();};}function respondWithResult(_0x248362,_0xbf13e6){_0xbf13e6=_0xbf13e6||0xc8;return function(_0x2bf68f){if(_0x2bf68f){return _0x248362[_0x037e('0x22')](_0xbf13e6)[_0x037e('0x23')](_0x2bf68f);}};}function respondWithFilteredResult(_0x809e02,_0x1caf34){return function(_0x210835){if(_0x210835){var _0x4d64b8=_0x210835[_0x037e('0x24')],_0x468c5c=_0x1caf34['offset'],_0x39938e=_0x1caf34['offset']+_0x1caf34['limit'],_0x3d5742;if(_0x39938e>=_0x4d64b8){_0x39938e=_0x4d64b8;_0x3d5742=0xc8;}else{_0x3d5742=0xce;}_0x809e02[_0x037e('0x22')](_0x3d5742);return _0x809e02[_0x037e('0x25')]('Content-Range',_0x468c5c+'-'+_0x39938e+'/'+_0x4d64b8)['json'](_0x210835);}return null;};}function patchUpdates(_0x3e7420){return function(_0x5e767d){try{jsonpatch[_0x037e('0x26')](_0x5e767d,_0x3e7420,!![]);}catch(_0x19f235){return BPromise[_0x037e('0x27')](_0x19f235);}return _0x5e767d[_0x037e('0x28')]();};}function saveUpdates(_0x2a82c4,_0x5239c6){return function(_0xb99258){if(_0xb99258){return _0xb99258['update'](_0x2a82c4)[_0x037e('0x29')](function(_0x1a31f3){return _0x1a31f3;});}return null;};}function removeEntity(_0x519cac,_0x32a8cc){return function(_0x2b84f3){if(_0x2b84f3){return _0x2b84f3[_0x037e('0x2a')]()[_0x037e('0x29')](function(){var _0x2aad18=_0x2b84f3[_0x037e('0x2b')]({'plain':!![]});var _0x28b27d=_0x037e('0x2c');return db[_0x037e('0x2d')]['destroy']({'where':{'type':_0x28b27d,'resourceId':_0x2aad18['id']}})[_0x037e('0x29')](function(){return _0x2b84f3;});})[_0x037e('0x29')](function(){_0x519cac['status'](0xcc)[_0x037e('0x2e')]();});}};}function handleEntityNotFound(_0x2f2883,_0x408c98){return function(_0x170747){if(!_0x170747){_0x2f2883[_0x037e('0x21')](0x194);}return _0x170747;};}function handleError(_0x41b2d3,_0x2af168){_0x2af168=_0x2af168||0x1f4;return function(_0x2e1d94){logger[_0x037e('0x2f')](_0x2e1d94[_0x037e('0x30')]);if(_0x2e1d94[_0x037e('0x31')]){delete _0x2e1d94[_0x037e('0x31')];}_0x41b2d3['status'](_0x2af168)[_0x037e('0x32')](_0x2e1d94);};}exports['index']=function(_0x59aa76,_0x127d80){var _0x561372={},_0x1ffaca={},_0x5a4295={'count':0x0,'rows':[]};var _0x1893d1=_['map'](db['SmsQueue'][_0x037e('0x33')],function(_0x22aa69){return{'name':_0x22aa69[_0x037e('0x34')],'type':_0x22aa69[_0x037e('0x35')]['key']};});_0x1ffaca['model']=_['map'](_0x1893d1,_0x037e('0x31'));_0x1ffaca[_0x037e('0x36')]=_['keys'](_0x59aa76[_0x037e('0x36')]);_0x1ffaca[_0x037e('0x37')]=_['intersection'](_0x1ffaca[_0x037e('0x38')],_0x1ffaca['query']);_0x561372['attributes']=_['intersection'](_0x1ffaca[_0x037e('0x38')],qs[_0x037e('0x39')](_0x59aa76[_0x037e('0x36')][_0x037e('0x39')]));_0x561372[_0x037e('0x3a')]=_0x561372[_0x037e('0x3a')][_0x037e('0x3b')]?_0x561372[_0x037e('0x3a')]:_0x1ffaca[_0x037e('0x38')];if(!_0x59aa76[_0x037e('0x36')][_0x037e('0x3c')]('nolimit')){_0x561372[_0x037e('0x3d')]=qs['limit'](_0x59aa76['query']['limit']);_0x561372[_0x037e('0x3e')]=qs[_0x037e('0x3e')](_0x59aa76[_0x037e('0x36')][_0x037e('0x3e')]);}_0x561372[_0x037e('0x3f')]=qs[_0x037e('0x40')](_0x59aa76[_0x037e('0x36')][_0x037e('0x40')]);_0x561372[_0x037e('0x41')]=qs[_0x037e('0x37')](_[_0x037e('0x42')](_0x59aa76['query'],_0x1ffaca[_0x037e('0x37')]),_0x1893d1);if(_0x59aa76[_0x037e('0x36')][_0x037e('0x43')]){_0x561372[_0x037e('0x41')]=_[_0x037e('0x44')](_0x561372[_0x037e('0x41')],{'$or':_[_0x037e('0x45')](_0x1893d1,function(_0x523097){if(_0x523097[_0x037e('0x35')]!==_0x037e('0x46')){var _0x20e988={};_0x20e988[_0x523097[_0x037e('0x31')]]={'$like':'%'+_0x59aa76[_0x037e('0x36')]['filter']+'%'};return _0x20e988;}})});}_0x561372=_['merge']({},_0x561372,_0x59aa76[_0x037e('0x47')]);var _0x2b34ae={'where':_0x561372['where']};return db[_0x037e('0x48')][_0x037e('0x24')](_0x2b34ae)['then'](function(_0x254a42){_0x5a4295[_0x037e('0x24')]=_0x254a42;if(_0x59aa76[_0x037e('0x36')][_0x037e('0x49')]){_0x561372[_0x037e('0x4a')]=[{'all':!![]}];}return db['SmsQueue'][_0x037e('0x4b')](_0x561372);})[_0x037e('0x29')](function(_0x169e52){_0x5a4295['rows']=_0x169e52;return _0x5a4295;})[_0x037e('0x29')](respondWithFilteredResult(_0x127d80,_0x561372))['catch'](handleError(_0x127d80,null));};exports[_0x037e('0x4c')]=function(_0x404e4a,_0x1bc0b9){var _0x8ec183={'raw':!![],'where':{'id':_0x404e4a[_0x037e('0x4d')]['id']}},_0x5b8053={};_0x5b8053['model']=_[_0x037e('0x4e')](db['SmsQueue'][_0x037e('0x33')]);_0x5b8053['query']=_['keys'](_0x404e4a[_0x037e('0x36')]);_0x5b8053['filters']=_['intersection'](_0x5b8053[_0x037e('0x38')],_0x5b8053[_0x037e('0x36')]);_0x8ec183[_0x037e('0x3a')]=_[_0x037e('0x4f')](_0x5b8053[_0x037e('0x38')],qs[_0x037e('0x39')](_0x404e4a[_0x037e('0x36')]['fields']));_0x8ec183['attributes']=_0x8ec183['attributes']['length']?_0x8ec183[_0x037e('0x3a')]:_0x5b8053['model'];if(_0x404e4a[_0x037e('0x36')][_0x037e('0x49')]){_0x8ec183[_0x037e('0x4a')]=[{'all':!![]}];}_0x8ec183=_[_0x037e('0x44')]({},_0x8ec183,_0x404e4a[_0x037e('0x47')]);return db[_0x037e('0x48')][_0x037e('0x50')](_0x8ec183)['then'](handleEntityNotFound(_0x1bc0b9,null))[_0x037e('0x29')](respondWithResult(_0x1bc0b9,null))[_0x037e('0x51')](handleError(_0x1bc0b9,null));};exports[_0x037e('0x52')]=function(_0x6e7526,_0x564114){return db[_0x037e('0x48')][_0x037e('0x52')](_0x6e7526[_0x037e('0x53')],{})['then'](function(_0x3f7ffd){var _0x2a0fcf=_0x6e7526[_0x037e('0x54')][_0x037e('0x2b')]({'plain':!![]});if(!_0x2a0fcf)throw new Error(_0x037e('0x55'));if(_0x2a0fcf['role']===_0x037e('0x54')){var _0x1157e8=_0x3f7ffd[_0x037e('0x2b')]({'plain':!![]});var _0x18f5b4=_0x037e('0x2c');return db[_0x037e('0x56')][_0x037e('0x50')]({'where':{'name':_0x18f5b4,'userProfileId':_0x2a0fcf['userProfileId']},'raw':!![]})['then'](function(_0x3def3e){if(_0x3def3e&&_0x3def3e[_0x037e('0x57')]===0x0){return db[_0x037e('0x2d')][_0x037e('0x52')]({'name':_0x1157e8[_0x037e('0x31')],'resourceId':_0x1157e8['id'],'type':_0x3def3e[_0x037e('0x31')],'sectionId':_0x3def3e['id']},{})[_0x037e('0x29')](function(){return _0x3f7ffd;});}else{return _0x3f7ffd;}})[_0x037e('0x51')](function(_0x48f339){logger['error'](_0x037e('0x58'),_0x48f339);throw _0x48f339;});}return _0x3f7ffd;})['then'](respondWithResult(_0x564114,0xc9))[_0x037e('0x51')](handleError(_0x564114,null));};exports['update']=function(_0x2476de,_0xd6145d){if(_0x2476de[_0x037e('0x53')]['id']){delete _0x2476de[_0x037e('0x53')]['id'];}return db[_0x037e('0x48')]['find']({'where':{'id':_0x2476de['params']['id']}})['then'](handleEntityNotFound(_0xd6145d,null))[_0x037e('0x29')](saveUpdates(_0x2476de['body'],null))[_0x037e('0x29')](respondWithResult(_0xd6145d,null))[_0x037e('0x51')](handleError(_0xd6145d,null));};exports[_0x037e('0x2a')]=function(_0x3176ec,_0x4f5f6b){return db['SmsQueue'][_0x037e('0x50')]({'where':{'id':_0x3176ec[_0x037e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4f5f6b,null))[_0x037e('0x29')](removeEntity(_0x4f5f6b,null))[_0x037e('0x51')](handleError(_0x4f5f6b,null));};exports['describe']=function(_0x89c51,_0x3da998){return db['SmsQueue'][_0x037e('0x59')]()[_0x037e('0x29')](respondWithResult(_0x3da998,null))[_0x037e('0x51')](handleError(_0x3da998,null));};exports[_0x037e('0x5a')]=function(_0x3a7975,_0x2960d7,_0x35c41c){var _0x31692a={'raw':!![],'where':{}},_0xad0dd6={},_0x6c111;return db[_0x037e('0x48')]['findOne']({'where':{'id':_0x3a7975['params']['id']}})[_0x037e('0x29')](handleEntityNotFound(_0x2960d7,null))[_0x037e('0x29')](function(_0x16f346){if(_0x16f346){_0x6c111=_0x16f346['get']({'plain':!![]});_0xad0dd6[_0x037e('0x38')]=_[_0x037e('0x4e')](db['UserSmsQueue'][_0x037e('0x33')]);_0xad0dd6['query']=_[_0x037e('0x4e')](_0x3a7975[_0x037e('0x36')]);_0xad0dd6[_0x037e('0x37')]=_[_0x037e('0x4f')](_0xad0dd6[_0x037e('0x38')],_0xad0dd6['query']);_0x31692a['attributes']=_[_0x037e('0x4f')](_0xad0dd6[_0x037e('0x38')],qs[_0x037e('0x39')](_0x3a7975[_0x037e('0x36')][_0x037e('0x39')]));_0x31692a[_0x037e('0x3a')]=_0x31692a[_0x037e('0x3a')][_0x037e('0x3b')]?_0x31692a[_0x037e('0x3a')]:_0xad0dd6[_0x037e('0x38')];if(!_0x3a7975['query'][_0x037e('0x3c')]('nolimit')){_0x31692a[_0x037e('0x3d')]=qs[_0x037e('0x3d')](_0x3a7975['query'][_0x037e('0x3d')]);_0x31692a[_0x037e('0x3e')]=qs[_0x037e('0x3e')](_0x3a7975[_0x037e('0x36')]['offset']);}_0x31692a[_0x037e('0x3f')]=qs['sort'](_0x3a7975[_0x037e('0x36')][_0x037e('0x40')]);_0x31692a[_0x037e('0x41')]=qs['filters'](_[_0x037e('0x42')](_0x3a7975[_0x037e('0x36')],_0xad0dd6['filters']));_0x31692a['where']['SmsQueueId']=_0x16f346['id'];if(_0x3a7975[_0x037e('0x36')][_0x037e('0x43')]){_0x31692a['where']=_[_0x037e('0x44')](_0x31692a[_0x037e('0x41')],{'$or':_[_0x037e('0x45')](_0x31692a['attributes'],function(_0x43ade2){var _0x423948={};_0x423948[_0x43ade2]={'$like':'%'+_0x3a7975[_0x037e('0x36')][_0x037e('0x43')]+'%'};return _0x423948;})});}_0x31692a=_['merge']({},_0x31692a,_0x3a7975[_0x037e('0x47')]);return db[_0x037e('0x5b')][_0x037e('0x4b')](_0x31692a);}})['then'](function(_0x1f3867){if(_0x1f3867){return db[_0x037e('0x5c')][_0x037e('0x5d')]({'where':{'id':_[_0x037e('0x45')](_0x1f3867,'UserId'),'role':_0x037e('0x5e')},'attributes':['id',_0x037e('0x31'),_0x037e('0x5f'),_0x037e('0x60'),_0x037e('0x61')]});}})[_0x037e('0x29')](function(_0x3f86f2){if(_0x3f86f2){return{'count':_0x3f86f2[_0x037e('0x24')],'rows':_[_0x037e('0x45')](_0x3f86f2[_0x037e('0x62')],function(_0xbc0403){return{'membername':_0xbc0403[_0x037e('0x31')],'UserId':_0xbc0403['id'],'queue_name':_0x6c111[_0x037e('0x31')],'SmsQueueId':_0x6c111['id'],'interface':util['format'](_0x037e('0x63'),'SIP',_0xbc0403[_0x037e('0x31')]),'penalty':0x0,'paused':_0xbc0403[_0x037e('0x5f')],'createdAt':_0xbc0403['createdAt'],'updatedAt':_0xbc0403[_0x037e('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2960d7,_0x31692a))[_0x037e('0x51')](handleError(_0x2960d7,null));};exports[_0x037e('0x64')]=function(_0x54d5b0,_0x1fdaf3,_0x1f4bd9){var _0x5cc38a={};var _0x28a078={};var _0x412b3b;var _0x36a598;return db[_0x037e('0x48')][_0x037e('0x65')]({'where':{'id':_0x54d5b0[_0x037e('0x4d')]['id']}})[_0x037e('0x29')](handleEntityNotFound(_0x1fdaf3,null))[_0x037e('0x29')](function(_0x13a54d){if(_0x13a54d){_0x412b3b=_0x13a54d;_0x28a078['model']=_[_0x037e('0x4e')](db['Team'][_0x037e('0x33')]);_0x28a078[_0x037e('0x36')]=_[_0x037e('0x4e')](_0x54d5b0[_0x037e('0x36')]);_0x28a078[_0x037e('0x37')]=_[_0x037e('0x4f')](_0x28a078[_0x037e('0x38')],_0x28a078[_0x037e('0x36')]);_0x5cc38a[_0x037e('0x3a')]=_[_0x037e('0x4f')](_0x28a078[_0x037e('0x38')],qs[_0x037e('0x39')](_0x54d5b0['query']['fields']));_0x5cc38a[_0x037e('0x3a')]=_0x5cc38a[_0x037e('0x3a')][_0x037e('0x3b')]?_0x5cc38a[_0x037e('0x3a')]:_0x28a078[_0x037e('0x38')];_0x5cc38a['order']=qs[_0x037e('0x40')](_0x54d5b0[_0x037e('0x36')][_0x037e('0x40')]);_0x5cc38a[_0x037e('0x41')]=qs[_0x037e('0x37')](_[_0x037e('0x42')](_0x54d5b0[_0x037e('0x36')],_0x28a078[_0x037e('0x37')]));if(_0x54d5b0['query'][_0x037e('0x43')]){_0x5cc38a[_0x037e('0x41')]=_[_0x037e('0x44')](_0x5cc38a[_0x037e('0x41')],{'$or':_[_0x037e('0x45')](_0x5cc38a[_0x037e('0x3a')],function(_0xfca900){var _0x9275c5={};_0x9275c5[_0xfca900]={'$like':'%'+_0x54d5b0[_0x037e('0x36')][_0x037e('0x43')]+'%'};return _0x9275c5;})});}_0x5cc38a=_[_0x037e('0x44')]({},_0x5cc38a,_0x54d5b0[_0x037e('0x47')]);return _0x412b3b[_0x037e('0x64')](_0x5cc38a);}})[_0x037e('0x29')](function(_0x21fb9e){if(_0x21fb9e){_0x36a598=_0x21fb9e['length'];if(!_0x54d5b0[_0x037e('0x36')][_0x037e('0x3c')](_0x037e('0x66'))){_0x5cc38a[_0x037e('0x3d')]=qs['limit'](_0x54d5b0['query']['limit']);_0x5cc38a[_0x037e('0x3e')]=qs['offset'](_0x54d5b0['query'][_0x037e('0x3e')]);}return _0x412b3b[_0x037e('0x64')](_0x5cc38a);}})[_0x037e('0x29')](function(_0x227b01){if(_0x227b01){return _0x227b01?{'count':_0x36a598,'rows':_0x227b01}:null;}})['then'](respondWithResult(_0x1fdaf3,null))[_0x037e('0x51')](handleError(_0x1fdaf3,null));};exports[_0x037e('0x67')]=function(_0x1d15f3,_0x308018,_0x20ff9f){var _0x2beaa4=_0x1d15f3['body'][_0x037e('0x68')];return db['Team'][_0x037e('0x4b')]({'where':{'id':_0x2beaa4},'attributes':['id'],'include':[{'model':db[_0x037e('0x5c')],'as':_0x037e('0x69'),'attributes':['id',_0x037e('0x31'),_0x037e('0x6a'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x5cae88){if(_0x5cae88){var _0x31a0f6=_[_0x037e('0x6b')](_0x5cae88,function(_0x265629){var _0x4e6e26=_0x265629[_0x037e('0x2b')]({'plain':!![]});return _0x4e6e26['Agents'];});return db[_0x037e('0x48')][_0x037e('0x50')]({'where':{'id':_0x1d15f3[_0x037e('0x4d')]['id']}})['then'](function(_0x16b193){return db[_0x037e('0x6c')][_0x037e('0x6d')](function(_0x41d06b){return _0x16b193[_0x037e('0x67')](_0x2beaa4,{'transaction':_0x41d06b})[_0x037e('0x29')](function(){return BPromise[_0x037e('0x6e')](_0x31a0f6,function(_0x496d29){return db[_0x037e('0x5b')][_0x037e('0x6f')]({'where':{'UserId':_0x496d29['id'],'SmsQueueId':_0x1d15f3['params']['id']},'transaction':_0x41d06b});});})['then'](function(){_0x31a0f6[_0x037e('0x70')](function(_0x4bc637){socket[_0x037e('0x71')](_0x037e('0x72'),{'UserId':_0x4bc637['id'],'SmsQueueId':_0x16b193['id']});});});});});}})[_0x037e('0x29')](respondWithStatusCode(_0x308018,null))[_0x037e('0x51')](handleError(_0x308018,null));};exports['removeTeams']=function(_0x277eb6,_0x22043b,_0x864ad6){return db['Team'][_0x037e('0x4b')]({'where':{'id':_0x277eb6[_0x037e('0x36')][_0x037e('0x68')]},'attributes':['id'],'include':[{'model':db[_0x037e('0x5c')],'as':_0x037e('0x69'),'attributes':['id'],'raw':!![]}]})[_0x037e('0x29')](handleEntityNotFound(_0x22043b,null))[_0x037e('0x29')](function(_0x4c317c){var _0x550375=_[_0x037e('0x45')](_0x4c317c,'id');var _0x275dec=[];var _0x2f1ebd=[];var _0xed9945=squel[_0x037e('0x73')]();_0xed9945[_0x037e('0x74')](_0x037e('0x75'))[_0x037e('0x76')](_0x037e('0x77'),'tq')[_0x037e('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x037e('0x41')](_0x037e('0x79'),_0x277eb6[_0x037e('0x4d')]['id']);for(var _0x25e3e5=0x0;_0x25e3e5<_0x4c317c[_0x037e('0x3b')];_0x25e3e5+=0x1){let _0x1a9c50=_0x4c317c[_0x25e3e5];for(var _0x3f3644=0x0;_0x3f3644<_0x1a9c50[_0x037e('0x69')][_0x037e('0x3b')];_0x3f3644+=0x1){let _0xbceee7=_0x1a9c50[_0x037e('0x69')][_0x3f3644];var _0x3ac4a0=_0xed9945[_0x037e('0x7a')]();_0x3ac4a0[_0x037e('0x41')](_0x037e('0x7b'),_0xbceee7['id']);_0x2f1ebd[_0x037e('0x7c')](db[_0x037e('0x6c')]['query'](_0x3ac4a0['toString'](),{'type':db[_0x037e('0x6c')][_0x037e('0x7d')][_0x037e('0x7e')]})[_0x037e('0x29')](function(_0x58ee7c){if(_0x58ee7c[_0x037e('0x3b')]===0x1){return _0xbceee7['id'];}else{var _0x211d93=_['every'](_[_0x037e('0x45')](_0x58ee7c,'TeamId'),function(_0x3d7143){return _[_0x037e('0x7f')](_0x550375,_0x3d7143);});if(_0x211d93){return _0xbceee7['id'];}}}));}}return BPromise[_0x037e('0x80')](_0x2f1ebd)['then'](function(_0x2d65c5){_0x275dec=_(_0x275dec)[_0x037e('0x81')](_0x2d65c5)[_0x037e('0x82')]()[_0x037e('0x83')]();return db['SmsQueue']['find']({'where':{'id':_0x277eb6['params']['id']}})['then'](function(_0x959aec){return db[_0x037e('0x6c')][_0x037e('0x6d')](function(_0x3231f8){return _0x959aec[_0x037e('0x84')](_0x277eb6[_0x037e('0x36')][_0x037e('0x68')],{'transaction':_0x3231f8})['then'](function(){if(!_[_0x037e('0x85')](_0x275dec)){return _0x959aec['removeAgents'](_0x275dec,{'transaction':_0x3231f8});}})['then'](function(){_0x275dec[_0x037e('0x70')](function(_0x1723af){socket[_0x037e('0x71')](_0x037e('0x86'),{'UserId':_0x1723af,'SmsQueueId':_0x959aec['id']});});});});});});})[_0x037e('0x29')](respondWithStatusCode(_0x22043b,null))['catch'](handleError(_0x22043b,null));};exports['addAgents']=function(_0x1bfdc1,_0x25716c,_0x2ef5d1){return db[_0x037e('0x48')][_0x037e('0x50')]({'where':{'id':_0x1bfdc1[_0x037e('0x4d')]['id']}})[_0x037e('0x29')](handleEntityNotFound(_0x25716c,null))[_0x037e('0x29')](function(_0x2460ad){if(_0x2460ad){return _0x2460ad[_0x037e('0x87')](_0x1bfdc1[_0x037e('0x53')][_0x037e('0x68')],_[_0x037e('0x88')](_0x1bfdc1[_0x037e('0x53')],[_0x037e('0x68'),'id'])||{})[_0x037e('0x89')](function(_0x57ee84){for(var _0x246219=0x0;_0x246219<_0x1bfdc1[_0x037e('0x53')][_0x037e('0x68')][_0x037e('0x3b')];_0x246219+=0x1){socket['emit'](_0x037e('0x72'),{'UserId':_0x1bfdc1[_0x037e('0x53')][_0x037e('0x68')][_0x246219],'SmsQueueId':_0x1bfdc1['params']['id']});}return _0x57ee84;});}})['then'](respondWithResult(_0x25716c,null))[_0x037e('0x51')](handleError(_0x25716c,null));};exports[_0x037e('0x8a')]=function(_0x1bb1d1,_0x58e8a8,_0x2e1286){return db[_0x037e('0x48')][_0x037e('0x50')]({'where':{'id':_0x1bb1d1[_0x037e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x58e8a8,null))[_0x037e('0x29')](function(_0x527a55){if(_0x527a55){return _0x527a55[_0x037e('0x8a')](_0x1bb1d1[_0x037e('0x36')][_0x037e('0x68')])[_0x037e('0x29')](function(){if(_['isArray'](_0x1bb1d1[_0x037e('0x36')]['ids'])){for(var _0x46057d=0x0;_0x46057d<_0x1bb1d1[_0x037e('0x36')]['ids'][_0x037e('0x3b')];_0x46057d+=0x1){socket['emit'](_0x037e('0x86'),{'UserId':Number(_0x1bb1d1['query']['ids'][_0x46057d]),'SmsQueueId':Number(_0x1bb1d1[_0x037e('0x4d')]['id'])});}}else{socket[_0x037e('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x1bb1d1[_0x037e('0x36')][_0x037e('0x68')]),'SmsQueueId':Number(_0x1bb1d1['params']['id'])});}});}})[_0x037e('0x29')](respondWithStatusCode(_0x58e8a8,null))['catch'](handleError(_0x58e8a8,null));};exports[_0x037e('0x8b')]=function(_0x225750,_0x2f2a36,_0x300db2){var _0x40256e={};var _0x5b762c={};var _0x56d7f3;var _0x391379;return db[_0x037e('0x48')]['findOne']({'where':{'id':_0x225750[_0x037e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2f2a36,null))[_0x037e('0x29')](function(_0x5d3298){if(_0x5d3298){_0x56d7f3=_0x5d3298;_0x5b762c[_0x037e('0x38')]=_[_0x037e('0x4e')](db[_0x037e('0x5c')][_0x037e('0x33')]);_0x5b762c[_0x037e('0x36')]=_[_0x037e('0x4e')](_0x225750[_0x037e('0x36')]);_0x5b762c[_0x037e('0x37')]=_['intersection'](_0x5b762c[_0x037e('0x38')],_0x5b762c['query']);_0x40256e[_0x037e('0x3a')]=_[_0x037e('0x4f')](_0x5b762c[_0x037e('0x38')],qs[_0x037e('0x39')](_0x225750[_0x037e('0x36')][_0x037e('0x39')]));_0x40256e['attributes']=_0x40256e[_0x037e('0x3a')][_0x037e('0x3b')]?_0x40256e[_0x037e('0x3a')]:_0x5b762c[_0x037e('0x38')];_0x40256e[_0x037e('0x3f')]=qs[_0x037e('0x40')](_0x225750['query']['sort']);_0x40256e[_0x037e('0x41')]=qs[_0x037e('0x37')](_[_0x037e('0x42')](_0x225750[_0x037e('0x36')],_0x5b762c[_0x037e('0x37')]));if(_0x225750['query'][_0x037e('0x43')]){_0x40256e[_0x037e('0x41')]=_[_0x037e('0x44')](_0x40256e['where'],{'$or':_[_0x037e('0x45')](_0x40256e[_0x037e('0x3a')],function(_0x5cfd60){var _0x28a8ef={};_0x28a8ef[_0x5cfd60]={'$like':'%'+_0x225750[_0x037e('0x36')][_0x037e('0x43')]+'%'};return _0x28a8ef;})});}_0x40256e=_[_0x037e('0x44')]({},_0x40256e,_0x225750[_0x037e('0x47')]);return _0x56d7f3['getAgents'](_0x40256e);}})[_0x037e('0x29')](function(_0x57a0ec){if(_0x57a0ec){_0x391379=_0x57a0ec['length'];if(!_0x225750[_0x037e('0x36')][_0x037e('0x3c')](_0x037e('0x66'))){_0x40256e[_0x037e('0x3d')]=qs['limit'](_0x225750[_0x037e('0x36')][_0x037e('0x3d')]);_0x40256e[_0x037e('0x3e')]=qs[_0x037e('0x3e')](_0x225750[_0x037e('0x36')][_0x037e('0x3e')]);}return _0x56d7f3['getAgents'](_0x40256e);}})[_0x037e('0x29')](function(_0x4f9ed2){if(_0x4f9ed2){return _0x4f9ed2?{'count':_0x391379,'rows':_0x4f9ed2}:null;}})[_0x037e('0x29')](respondWithResult(_0x2f2a36,null))[_0x037e('0x51')](handleError(_0x2f2a36,null));}; \ No newline at end of file +var _0x240c=['socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','then','get','SmsQueues','UserProfileResource','destroy','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','keys','UserSmsQueue','pick','SmsQueueId','options','UserId','updatedAt','createdAt','SIP','smsPause','findOne','Team','getTeams','hasOwnProperty','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userSmsQueue:save','removeTeams','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x240c,0xf8));var _0xc240=function(_0x5f3c15,_0x155cf5){_0x5f3c15=_0x5f3c15-0x0;var _0x6e7001=_0x240c[_0x5f3c15];return _0x6e7001;};'use strict';var pdf=require(_0xc240('0x0'));var emlformat=require(_0xc240('0x1'));var rimraf=require(_0xc240('0x2'));var zipdir=require(_0xc240('0x3'));var jsonpatch=require(_0xc240('0x4'));var rp=require(_0xc240('0x5'));var moment=require('moment');var BPromise=require(_0xc240('0x6'));var Mustache=require('mustache');var util=require(_0xc240('0x7'));var path=require(_0xc240('0x8'));var sox=require(_0xc240('0x9'));var csv=require(_0xc240('0xa'));var ejs=require(_0xc240('0xb'));var fs=require('fs');var _=require(_0xc240('0xc'));var squel=require(_0xc240('0xd'));var crypto=require(_0xc240('0xe'));var jsforce=require(_0xc240('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc240('0xa'));var querystring=require(_0xc240('0x10'));var Papa=require(_0xc240('0x11'));var Redis=require('ioredis');var authService=require(_0xc240('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc240('0x13'));var hardwareService=require(_0xc240('0x14'));var logger=require(_0xc240('0x15'))(_0xc240('0x16'));var utils=require('../../config/utils');var config=require(_0xc240('0x17'));var db=require('../../mysqldb')['db'];config[_0xc240('0x18')]=_[_0xc240('0x19')](config[_0xc240('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc240('0x1a'))(new Redis(config[_0xc240('0x18')]));require(_0xc240('0x1b'))[_0xc240('0x1c')](socket);function respondWithStatusCode(_0xfb2520,_0x365fc6){_0x365fc6=_0x365fc6||0xcc;return function(_0x25c283){if(_0x25c283){return _0xfb2520[_0xc240('0x1d')](_0x365fc6);}return _0xfb2520['status'](_0x365fc6)[_0xc240('0x1e')]();};}function respondWithResult(_0x9e759b,_0x12e414){_0x12e414=_0x12e414||0xc8;return function(_0x28f066){if(_0x28f066){return _0x9e759b[_0xc240('0x1f')](_0x12e414)[_0xc240('0x20')](_0x28f066);}};}function respondWithFilteredResult(_0x16d534,_0x106a03){return function(_0x279552){if(_0x279552){var _0x14bfba=_0x279552[_0xc240('0x21')],_0x1b663e=_0x106a03['offset'],_0x5550f2=_0x106a03[_0xc240('0x22')]+_0x106a03[_0xc240('0x23')],_0x77f462;if(_0x5550f2>=_0x14bfba){_0x5550f2=_0x14bfba;_0x77f462=0xc8;}else{_0x77f462=0xce;}_0x16d534[_0xc240('0x1f')](_0x77f462);return _0x16d534[_0xc240('0x24')](_0xc240('0x25'),_0x1b663e+'-'+_0x5550f2+'/'+_0x14bfba)[_0xc240('0x20')](_0x279552);}return null;};}function patchUpdates(_0x105e1f){return function(_0x58b703){try{jsonpatch['apply'](_0x58b703,_0x105e1f,!![]);}catch(_0x4e8909){return BPromise['reject'](_0x4e8909);}return _0x58b703['save']();};}function saveUpdates(_0x435bc1,_0x12376c){return function(_0x1ae538){if(_0x1ae538){return _0x1ae538['update'](_0x435bc1)[_0xc240('0x26')](function(_0x44c203){return _0x44c203;});}return null;};}function removeEntity(_0x1fe8f4,_0x231893){return function(_0x537f57){if(_0x537f57){return _0x537f57['destroy']()['then'](function(){var _0x4f5e5c=_0x537f57[_0xc240('0x27')]({'plain':!![]});var _0x112fd4=_0xc240('0x28');return db[_0xc240('0x29')][_0xc240('0x2a')]({'where':{'type':_0x112fd4,'resourceId':_0x4f5e5c['id']}})[_0xc240('0x26')](function(){return _0x537f57;});})[_0xc240('0x26')](function(){_0x1fe8f4['status'](0xcc)[_0xc240('0x1e')]();});}};}function handleEntityNotFound(_0x5ca1d7,_0x13764f){return function(_0x11dc88){if(!_0x11dc88){_0x5ca1d7[_0xc240('0x1d')](0x194);}return _0x11dc88;};}function handleError(_0x22279c,_0x290f18){_0x290f18=_0x290f18||0x1f4;return function(_0x3b4fd8){logger[_0xc240('0x2b')](_0x3b4fd8[_0xc240('0x2c')]);if(_0x3b4fd8[_0xc240('0x2d')]){delete _0x3b4fd8[_0xc240('0x2d')];}_0x22279c[_0xc240('0x1f')](_0x290f18)[_0xc240('0x2e')](_0x3b4fd8);};}exports[_0xc240('0x2f')]=function(_0x58727d,_0x202f8f){var _0x13b3f2={},_0x48a9db={},_0x4f8026={'count':0x0,'rows':[]};var _0x1925e7=_[_0xc240('0x30')](db[_0xc240('0x31')][_0xc240('0x32')],function(_0x125a1e){return{'name':_0x125a1e[_0xc240('0x33')],'type':_0x125a1e[_0xc240('0x34')][_0xc240('0x35')]};});_0x48a9db[_0xc240('0x36')]=_[_0xc240('0x30')](_0x1925e7,'name');_0x48a9db[_0xc240('0x37')]=_['keys'](_0x58727d[_0xc240('0x37')]);_0x48a9db[_0xc240('0x38')]=_[_0xc240('0x39')](_0x48a9db[_0xc240('0x36')],_0x48a9db[_0xc240('0x37')]);_0x13b3f2[_0xc240('0x3a')]=_[_0xc240('0x39')](_0x48a9db[_0xc240('0x36')],qs[_0xc240('0x3b')](_0x58727d['query'][_0xc240('0x3b')]));_0x13b3f2[_0xc240('0x3a')]=_0x13b3f2[_0xc240('0x3a')][_0xc240('0x3c')]?_0x13b3f2['attributes']:_0x48a9db[_0xc240('0x36')];if(!_0x58727d[_0xc240('0x37')]['hasOwnProperty'](_0xc240('0x3d'))){_0x13b3f2[_0xc240('0x23')]=qs['limit'](_0x58727d[_0xc240('0x37')]['limit']);_0x13b3f2[_0xc240('0x22')]=qs['offset'](_0x58727d[_0xc240('0x37')][_0xc240('0x22')]);}_0x13b3f2[_0xc240('0x3e')]=qs[_0xc240('0x3f')](_0x58727d[_0xc240('0x37')][_0xc240('0x3f')]);_0x13b3f2[_0xc240('0x40')]=qs[_0xc240('0x38')](_['pick'](_0x58727d['query'],_0x48a9db['filters']),_0x1925e7);if(_0x58727d['query'][_0xc240('0x41')]){_0x13b3f2[_0xc240('0x40')]=_[_0xc240('0x42')](_0x13b3f2[_0xc240('0x40')],{'$or':_[_0xc240('0x30')](_0x1925e7,function(_0x2ae099){if(_0x2ae099[_0xc240('0x34')]!=='VIRTUAL'){var _0x478437={};_0x478437[_0x2ae099[_0xc240('0x2d')]]={'$like':'%'+_0x58727d[_0xc240('0x37')][_0xc240('0x41')]+'%'};return _0x478437;}})});}_0x13b3f2=_['merge']({},_0x13b3f2,_0x58727d['options']);var _0x4ef12a={'where':_0x13b3f2[_0xc240('0x40')]};return db[_0xc240('0x31')][_0xc240('0x21')](_0x4ef12a)[_0xc240('0x26')](function(_0x2b401e){_0x4f8026[_0xc240('0x21')]=_0x2b401e;if(_0x58727d['query'][_0xc240('0x43')]){_0x13b3f2[_0xc240('0x44')]=[{'all':!![]}];}return db[_0xc240('0x31')][_0xc240('0x45')](_0x13b3f2);})['then'](function(_0x519a64){_0x4f8026[_0xc240('0x46')]=_0x519a64;return _0x4f8026;})[_0xc240('0x26')](respondWithFilteredResult(_0x202f8f,_0x13b3f2))[_0xc240('0x47')](handleError(_0x202f8f,null));};exports[_0xc240('0x48')]=function(_0x1f24da,_0x551092){var _0xc63644={'raw':!![],'where':{'id':_0x1f24da[_0xc240('0x49')]['id']}},_0x5c7179={};_0x5c7179[_0xc240('0x36')]=_['keys'](db[_0xc240('0x31')][_0xc240('0x32')]);_0x5c7179[_0xc240('0x37')]=_['keys'](_0x1f24da[_0xc240('0x37')]);_0x5c7179['filters']=_[_0xc240('0x39')](_0x5c7179[_0xc240('0x36')],_0x5c7179[_0xc240('0x37')]);_0xc63644[_0xc240('0x3a')]=_[_0xc240('0x39')](_0x5c7179[_0xc240('0x36')],qs[_0xc240('0x3b')](_0x1f24da[_0xc240('0x37')][_0xc240('0x3b')]));_0xc63644[_0xc240('0x3a')]=_0xc63644[_0xc240('0x3a')][_0xc240('0x3c')]?_0xc63644['attributes']:_0x5c7179[_0xc240('0x36')];if(_0x1f24da['query']['includeAll']){_0xc63644[_0xc240('0x44')]=[{'all':!![]}];}_0xc63644=_['merge']({},_0xc63644,_0x1f24da['options']);return db[_0xc240('0x31')][_0xc240('0x4a')](_0xc63644)['then'](handleEntityNotFound(_0x551092,null))[_0xc240('0x26')](respondWithResult(_0x551092,null))[_0xc240('0x47')](handleError(_0x551092,null));};exports[_0xc240('0x4b')]=function(_0x30f6fe,_0x105a2b){return db['SmsQueue']['create'](_0x30f6fe[_0xc240('0x4c')],{})[_0xc240('0x26')](function(_0x56cc82){var _0xdaaafb=_0x30f6fe[_0xc240('0x4d')][_0xc240('0x27')]({'plain':!![]});if(!_0xdaaafb)throw new Error(_0xc240('0x4e'));if(_0xdaaafb[_0xc240('0x4f')]==='user'){var _0x5c38f0=_0x56cc82[_0xc240('0x27')]({'plain':!![]});var _0x4bb747=_0xc240('0x28');return db[_0xc240('0x50')][_0xc240('0x4a')]({'where':{'name':_0x4bb747,'userProfileId':_0xdaaafb[_0xc240('0x51')]},'raw':!![]})[_0xc240('0x26')](function(_0xdb00fa){if(_0xdb00fa&&_0xdb00fa[_0xc240('0x52')]===0x0){return db[_0xc240('0x29')]['create']({'name':_0x5c38f0[_0xc240('0x2d')],'resourceId':_0x5c38f0['id'],'type':_0xdb00fa[_0xc240('0x2d')],'sectionId':_0xdb00fa['id']},{})[_0xc240('0x26')](function(){return _0x56cc82;});}else{return _0x56cc82;}})[_0xc240('0x47')](function(_0x16a644){logger[_0xc240('0x2b')](_0xc240('0x53'),_0x16a644);throw _0x16a644;});}return _0x56cc82;})['then'](respondWithResult(_0x105a2b,0xc9))[_0xc240('0x47')](handleError(_0x105a2b,null));};exports[_0xc240('0x54')]=function(_0x43f7de,_0x4a07d7){if(_0x43f7de[_0xc240('0x4c')]['id']){delete _0x43f7de['body']['id'];}return db[_0xc240('0x31')][_0xc240('0x4a')]({'where':{'id':_0x43f7de['params']['id']}})[_0xc240('0x26')](handleEntityNotFound(_0x4a07d7,null))[_0xc240('0x26')](saveUpdates(_0x43f7de[_0xc240('0x4c')],null))[_0xc240('0x26')](respondWithResult(_0x4a07d7,null))['catch'](handleError(_0x4a07d7,null));};exports[_0xc240('0x2a')]=function(_0x2473db,_0x195d27){return db[_0xc240('0x31')][_0xc240('0x4a')]({'where':{'id':_0x2473db[_0xc240('0x49')]['id']}})[_0xc240('0x26')](handleEntityNotFound(_0x195d27,null))['then'](removeEntity(_0x195d27,null))[_0xc240('0x47')](handleError(_0x195d27,null));};exports[_0xc240('0x55')]=function(_0x3abbf,_0x1935ff){return db['SmsQueue'][_0xc240('0x55')]()[_0xc240('0x26')](respondWithResult(_0x1935ff,null))['catch'](handleError(_0x1935ff,null));};exports[_0xc240('0x56')]=function(_0x677ab8,_0x492089,_0x2840a8){var _0x769705={'raw':!![],'where':{}},_0x4abfa8={},_0x57714f;return db[_0xc240('0x31')]['findOne']({'where':{'id':_0x677ab8[_0xc240('0x49')]['id']}})[_0xc240('0x26')](handleEntityNotFound(_0x492089,null))['then'](function(_0xef2104){if(_0xef2104){_0x57714f=_0xef2104[_0xc240('0x27')]({'plain':!![]});_0x4abfa8[_0xc240('0x36')]=_[_0xc240('0x57')](db[_0xc240('0x58')][_0xc240('0x32')]);_0x4abfa8['query']=_[_0xc240('0x57')](_0x677ab8[_0xc240('0x37')]);_0x4abfa8[_0xc240('0x38')]=_[_0xc240('0x39')](_0x4abfa8['model'],_0x4abfa8['query']);_0x769705['attributes']=_['intersection'](_0x4abfa8[_0xc240('0x36')],qs['fields'](_0x677ab8[_0xc240('0x37')][_0xc240('0x3b')]));_0x769705['attributes']=_0x769705['attributes']['length']?_0x769705[_0xc240('0x3a')]:_0x4abfa8[_0xc240('0x36')];if(!_0x677ab8[_0xc240('0x37')]['hasOwnProperty'](_0xc240('0x3d'))){_0x769705[_0xc240('0x23')]=qs[_0xc240('0x23')](_0x677ab8[_0xc240('0x37')][_0xc240('0x23')]);_0x769705[_0xc240('0x22')]=qs[_0xc240('0x22')](_0x677ab8[_0xc240('0x37')][_0xc240('0x22')]);}_0x769705[_0xc240('0x3e')]=qs[_0xc240('0x3f')](_0x677ab8[_0xc240('0x37')]['sort']);_0x769705[_0xc240('0x40')]=qs[_0xc240('0x38')](_[_0xc240('0x59')](_0x677ab8[_0xc240('0x37')],_0x4abfa8[_0xc240('0x38')]));_0x769705['where'][_0xc240('0x5a')]=_0xef2104['id'];if(_0x677ab8[_0xc240('0x37')][_0xc240('0x41')]){_0x769705['where']=_[_0xc240('0x42')](_0x769705[_0xc240('0x40')],{'$or':_['map'](_0x769705['attributes'],function(_0x26dce9){var _0x54c1b1={};_0x54c1b1[_0x26dce9]={'$like':'%'+_0x677ab8['query'][_0xc240('0x41')]+'%'};return _0x54c1b1;})});}_0x769705=_[_0xc240('0x42')]({},_0x769705,_0x677ab8[_0xc240('0x5b')]);return db[_0xc240('0x58')][_0xc240('0x45')](_0x769705);}})[_0xc240('0x26')](function(_0x278893){if(_0x278893){return db['User']['findAndCountAll']({'where':{'id':_[_0xc240('0x30')](_0x278893,_0xc240('0x5c')),'role':'agent'},'attributes':['id',_0xc240('0x2d'),'smsPause',_0xc240('0x5d'),_0xc240('0x5e')]});}})[_0xc240('0x26')](function(_0x50d82a){if(_0x50d82a){return{'count':_0x50d82a[_0xc240('0x21')],'rows':_['map'](_0x50d82a[_0xc240('0x46')],function(_0x39a3dc){return{'membername':_0x39a3dc[_0xc240('0x2d')],'UserId':_0x39a3dc['id'],'queue_name':_0x57714f[_0xc240('0x2d')],'SmsQueueId':_0x57714f['id'],'interface':util['format']('%s/%s',_0xc240('0x5f'),_0x39a3dc[_0xc240('0x2d')]),'penalty':0x0,'paused':_0x39a3dc[_0xc240('0x60')],'createdAt':_0x39a3dc['createdAt'],'updatedAt':_0x39a3dc[_0xc240('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc240('0x26')](respondWithFilteredResult(_0x492089,_0x769705))[_0xc240('0x47')](handleError(_0x492089,null));};exports['getTeams']=function(_0x205561,_0x5882cd,_0x20dd2d){var _0x362ada={};var _0x51acdd={};var _0xf07bcb;var _0x45f043;return db[_0xc240('0x31')][_0xc240('0x61')]({'where':{'id':_0x205561[_0xc240('0x49')]['id']}})['then'](handleEntityNotFound(_0x5882cd,null))[_0xc240('0x26')](function(_0x250326){if(_0x250326){_0xf07bcb=_0x250326;_0x51acdd[_0xc240('0x36')]=_['keys'](db[_0xc240('0x62')][_0xc240('0x32')]);_0x51acdd[_0xc240('0x37')]=_[_0xc240('0x57')](_0x205561[_0xc240('0x37')]);_0x51acdd[_0xc240('0x38')]=_[_0xc240('0x39')](_0x51acdd['model'],_0x51acdd['query']);_0x362ada[_0xc240('0x3a')]=_[_0xc240('0x39')](_0x51acdd['model'],qs['fields'](_0x205561[_0xc240('0x37')][_0xc240('0x3b')]));_0x362ada[_0xc240('0x3a')]=_0x362ada[_0xc240('0x3a')][_0xc240('0x3c')]?_0x362ada[_0xc240('0x3a')]:_0x51acdd[_0xc240('0x36')];_0x362ada[_0xc240('0x3e')]=qs[_0xc240('0x3f')](_0x205561['query']['sort']);_0x362ada['where']=qs[_0xc240('0x38')](_[_0xc240('0x59')](_0x205561['query'],_0x51acdd[_0xc240('0x38')]));if(_0x205561['query'][_0xc240('0x41')]){_0x362ada['where']=_[_0xc240('0x42')](_0x362ada[_0xc240('0x40')],{'$or':_[_0xc240('0x30')](_0x362ada[_0xc240('0x3a')],function(_0x31a83a){var _0x194cb1={};_0x194cb1[_0x31a83a]={'$like':'%'+_0x205561[_0xc240('0x37')][_0xc240('0x41')]+'%'};return _0x194cb1;})});}_0x362ada=_[_0xc240('0x42')]({},_0x362ada,_0x205561[_0xc240('0x5b')]);return _0xf07bcb[_0xc240('0x63')](_0x362ada);}})[_0xc240('0x26')](function(_0x58796a){if(_0x58796a){_0x45f043=_0x58796a[_0xc240('0x3c')];if(!_0x205561[_0xc240('0x37')][_0xc240('0x64')](_0xc240('0x3d'))){_0x362ada[_0xc240('0x23')]=qs['limit'](_0x205561[_0xc240('0x37')]['limit']);_0x362ada['offset']=qs[_0xc240('0x22')](_0x205561[_0xc240('0x37')][_0xc240('0x22')]);}return _0xf07bcb['getTeams'](_0x362ada);}})[_0xc240('0x26')](function(_0x365fa7){if(_0x365fa7){return _0x365fa7?{'count':_0x45f043,'rows':_0x365fa7}:null;}})['then'](respondWithResult(_0x5882cd,null))[_0xc240('0x47')](handleError(_0x5882cd,null));};exports[_0xc240('0x65')]=function(_0x433656,_0x5c87d9,_0x323dd1){var _0xbdb03c=_0x433656[_0xc240('0x4c')][_0xc240('0x66')];return db[_0xc240('0x62')]['findAll']({'where':{'id':_0xbdb03c},'attributes':['id'],'include':[{'model':db[_0xc240('0x67')],'as':_0xc240('0x68'),'attributes':['id',_0xc240('0x2d'),_0xc240('0x69'),_0xc240('0x6a'),_0xc240('0x6b')],'raw':!![]}]})['then'](function(_0x1cf53b){if(_0x1cf53b){var _0x2b0cbe=_[_0xc240('0x6c')](_0x1cf53b,function(_0x357c2f){var _0x430906=_0x357c2f[_0xc240('0x27')]({'plain':!![]});return _0x430906['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x433656['params']['id']}})[_0xc240('0x26')](function(_0x4a0c2e){return db[_0xc240('0x6d')][_0xc240('0x6e')](function(_0x4e5cd2){return _0x4a0c2e[_0xc240('0x65')](_0xbdb03c,{'transaction':_0x4e5cd2})[_0xc240('0x26')](function(){return BPromise[_0xc240('0x6f')](_0x2b0cbe,function(_0x486ecd){return db[_0xc240('0x58')][_0xc240('0x70')]({'where':{'UserId':_0x486ecd['id'],'SmsQueueId':_0x433656[_0xc240('0x49')]['id']},'transaction':_0x4e5cd2});});})['then'](function(){_0x2b0cbe['forEach'](function(_0x6d0219){socket[_0xc240('0x71')](_0xc240('0x72'),{'UserId':_0x6d0219['id'],'SmsQueueId':_0x4a0c2e['id']});});});});});}})['then'](respondWithStatusCode(_0x5c87d9,null))[_0xc240('0x47')](handleError(_0x5c87d9,null));};exports[_0xc240('0x73')]=function(_0x59d2a9,_0x53d4e4,_0x1a85a6){return db[_0xc240('0x62')]['findAll']({'where':{'id':_0x59d2a9[_0xc240('0x37')][_0xc240('0x66')]},'attributes':['id'],'include':[{'model':db[_0xc240('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc240('0x26')](handleEntityNotFound(_0x53d4e4,null))[_0xc240('0x26')](function(_0x4f2d66){var _0x2da884=_[_0xc240('0x30')](_0x4f2d66,'id');var _0x3f5bd5=[];var _0x468500=[];var _0x3ebf9a=squel['select']();_0x3ebf9a[_0xc240('0x74')](_0xc240('0x75'))[_0xc240('0x76')](_0xc240('0x77'),'tq')[_0xc240('0x78')]('user_has_teams','ut',_0xc240('0x79'))['where'](_0xc240('0x7a'),_0x59d2a9[_0xc240('0x49')]['id']);for(var _0x9eaf3f=0x0;_0x9eaf3f<_0x4f2d66[_0xc240('0x3c')];_0x9eaf3f+=0x1){let _0x2cd294=_0x4f2d66[_0x9eaf3f];for(var _0x52e7e7=0x0;_0x52e7e7<_0x2cd294[_0xc240('0x68')][_0xc240('0x3c')];_0x52e7e7+=0x1){let _0x3fde3c=_0x2cd294[_0xc240('0x68')][_0x52e7e7];var _0x6bb648=_0x3ebf9a['clone']();_0x6bb648[_0xc240('0x40')]('ut.UserId\x20=\x20?',_0x3fde3c['id']);_0x468500['push'](db[_0xc240('0x6d')][_0xc240('0x37')](_0x6bb648[_0xc240('0x7b')](),{'type':db['sequelize']['QueryTypes'][_0xc240('0x7c')]})[_0xc240('0x26')](function(_0x4f30a2){if(_0x4f30a2['length']===0x1){return _0x3fde3c['id'];}else{var _0x53d55b=_['every'](_[_0xc240('0x30')](_0x4f30a2,_0xc240('0x7d')),function(_0x5103f3){return _[_0xc240('0x7e')](_0x2da884,_0x5103f3);});if(_0x53d55b){return _0x3fde3c['id'];}}}));}}return BPromise[_0xc240('0x7f')](_0x468500)[_0xc240('0x26')](function(_0x4d5a39){_0x3f5bd5=_(_0x3f5bd5)[_0xc240('0x80')](_0x4d5a39)[_0xc240('0x81')]()[_0xc240('0x82')]();return db[_0xc240('0x31')][_0xc240('0x4a')]({'where':{'id':_0x59d2a9['params']['id']}})[_0xc240('0x26')](function(_0x223edc){return db['sequelize'][_0xc240('0x6e')](function(_0x32a3aa){return _0x223edc['removeTeams'](_0x59d2a9[_0xc240('0x37')][_0xc240('0x66')],{'transaction':_0x32a3aa})[_0xc240('0x26')](function(){if(!_[_0xc240('0x83')](_0x3f5bd5)){return _0x223edc[_0xc240('0x84')](_0x3f5bd5,{'transaction':_0x32a3aa});}})[_0xc240('0x26')](function(){_0x3f5bd5['forEach'](function(_0x33803d){socket[_0xc240('0x71')](_0xc240('0x85'),{'UserId':_0x33803d,'SmsQueueId':_0x223edc['id']});});});});});});})[_0xc240('0x26')](respondWithStatusCode(_0x53d4e4,null))[_0xc240('0x47')](handleError(_0x53d4e4,null));};exports[_0xc240('0x86')]=function(_0x24650c,_0x5951bb,_0x3fe951){return db[_0xc240('0x31')][_0xc240('0x4a')]({'where':{'id':_0x24650c[_0xc240('0x49')]['id']}})['then'](handleEntityNotFound(_0x5951bb,null))[_0xc240('0x26')](function(_0x58fac6){if(_0x58fac6){return _0x58fac6['addAgents'](_0x24650c['body'][_0xc240('0x66')],_[_0xc240('0x87')](_0x24650c[_0xc240('0x4c')],['ids','id'])||{})['spread'](function(_0x152d13){for(var _0x1ad27e=0x0;_0x1ad27e<_0x24650c[_0xc240('0x4c')][_0xc240('0x66')][_0xc240('0x3c')];_0x1ad27e+=0x1){socket[_0xc240('0x71')]('userSmsQueue:save',{'UserId':_0x24650c[_0xc240('0x4c')][_0xc240('0x66')][_0x1ad27e],'SmsQueueId':_0x24650c[_0xc240('0x49')]['id']});}return _0x152d13;});}})[_0xc240('0x26')](respondWithResult(_0x5951bb,null))[_0xc240('0x47')](handleError(_0x5951bb,null));};exports[_0xc240('0x84')]=function(_0x4fcc69,_0x345b76,_0xecb3e6){return db['SmsQueue'][_0xc240('0x4a')]({'where':{'id':_0x4fcc69['params']['id']}})[_0xc240('0x26')](handleEntityNotFound(_0x345b76,null))[_0xc240('0x26')](function(_0x35af5e){if(_0x35af5e){return _0x35af5e[_0xc240('0x84')](_0x4fcc69[_0xc240('0x37')][_0xc240('0x66')])[_0xc240('0x26')](function(){if(_['isArray'](_0x4fcc69[_0xc240('0x37')]['ids'])){for(var _0x208519=0x0;_0x208519<_0x4fcc69[_0xc240('0x37')]['ids'][_0xc240('0x3c')];_0x208519+=0x1){socket[_0xc240('0x71')](_0xc240('0x85'),{'UserId':Number(_0x4fcc69[_0xc240('0x37')][_0xc240('0x66')][_0x208519]),'SmsQueueId':Number(_0x4fcc69[_0xc240('0x49')]['id'])});}}else{socket[_0xc240('0x71')](_0xc240('0x85'),{'UserId':Number(_0x4fcc69[_0xc240('0x37')][_0xc240('0x66')]),'SmsQueueId':Number(_0x4fcc69[_0xc240('0x49')]['id'])});}});}})[_0xc240('0x26')](respondWithStatusCode(_0x345b76,null))[_0xc240('0x47')](handleError(_0x345b76,null));};exports[_0xc240('0x88')]=function(_0x162563,_0x1960f2,_0x5f1a52){var _0x9a4eae={};var _0x2d624d={};var _0x555e89;var _0x34c974;return db['SmsQueue'][_0xc240('0x61')]({'where':{'id':_0x162563['params']['id']}})['then'](handleEntityNotFound(_0x1960f2,null))[_0xc240('0x26')](function(_0x2758c9){if(_0x2758c9){_0x555e89=_0x2758c9;_0x2d624d[_0xc240('0x36')]=_[_0xc240('0x57')](db[_0xc240('0x67')][_0xc240('0x32')]);_0x2d624d[_0xc240('0x37')]=_[_0xc240('0x57')](_0x162563[_0xc240('0x37')]);_0x2d624d[_0xc240('0x38')]=_[_0xc240('0x39')](_0x2d624d['model'],_0x2d624d[_0xc240('0x37')]);_0x9a4eae[_0xc240('0x3a')]=_[_0xc240('0x39')](_0x2d624d['model'],qs[_0xc240('0x3b')](_0x162563[_0xc240('0x37')][_0xc240('0x3b')]));_0x9a4eae['attributes']=_0x9a4eae[_0xc240('0x3a')][_0xc240('0x3c')]?_0x9a4eae[_0xc240('0x3a')]:_0x2d624d[_0xc240('0x36')];_0x9a4eae[_0xc240('0x3e')]=qs[_0xc240('0x3f')](_0x162563[_0xc240('0x37')][_0xc240('0x3f')]);_0x9a4eae[_0xc240('0x40')]=qs[_0xc240('0x38')](_['pick'](_0x162563[_0xc240('0x37')],_0x2d624d['filters']));if(_0x162563['query'][_0xc240('0x41')]){_0x9a4eae[_0xc240('0x40')]=_[_0xc240('0x42')](_0x9a4eae[_0xc240('0x40')],{'$or':_['map'](_0x9a4eae[_0xc240('0x3a')],function(_0x4e1fe6){var _0x465868={};_0x465868[_0x4e1fe6]={'$like':'%'+_0x162563[_0xc240('0x37')][_0xc240('0x41')]+'%'};return _0x465868;})});}_0x9a4eae=_['merge']({},_0x9a4eae,_0x162563[_0xc240('0x5b')]);return _0x555e89[_0xc240('0x88')](_0x9a4eae);}})['then'](function(_0x1ca48a){if(_0x1ca48a){_0x34c974=_0x1ca48a[_0xc240('0x3c')];if(!_0x162563[_0xc240('0x37')][_0xc240('0x64')]('nolimit')){_0x9a4eae['limit']=qs['limit'](_0x162563['query'][_0xc240('0x23')]);_0x9a4eae['offset']=qs[_0xc240('0x22')](_0x162563[_0xc240('0x37')][_0xc240('0x22')]);}return _0x555e89['getAgents'](_0x9a4eae);}})[_0xc240('0x26')](function(_0x1fc475){if(_0x1fc475){return _0x1fc475?{'count':_0x34c974,'rows':_0x1fc475}:null;}})[_0xc240('0x26')](respondWithResult(_0x1960f2,null))['catch'](handleError(_0x1960f2,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index bfc2327..90c06df 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 _0x76e1=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x530103,_0x255d2e){var _0x104d42=function(_0x100de7){while(--_0x100de7){_0x530103['push'](_0x530103['shift']());}};_0x104d42(++_0x255d2e);}(_0x76e1,0xb1));var _0x176e=function(_0x4cb2,_0x48eef2){_0x4cb2=_0x4cb2-0x0;var _0x59c9f0=_0x76e1[_0x4cb2];return _0x59c9f0;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x176e('0x0'))['db'][_0x176e('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x176e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x176e('0x3'),'afterDestroy':_0x176e('0x4')};function emitEvent(_0x150f98){return function(_0x2fc79d,_0x253f19,_0x5e1642){SmsQueueEvents['emit'](_0x150f98+':'+_0x2fc79d['id'],_0x2fc79d);SmsQueueEvents[_0x176e('0x5')](_0x150f98,_0x2fc79d);_0x5e1642(null);};}for(var e in events){if(events[_0x176e('0x6')](e)){var event=events[e];SmsQueue[_0x176e('0x7')](e,emitEvent(event));}}module[_0x176e('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xa4e9=['../../mysqldb','save','remove','exports','events'];(function(_0x609412,_0x30d278){var _0xad208b=function(_0x3503cd){while(--_0x3503cd){_0x609412['push'](_0x609412['shift']());}};_0xad208b(++_0x30d278);}(_0xa4e9,0x1c6));var _0x9a4e=function(_0x5fd5f,_0x33d044){_0x5fd5f=_0x5fd5f-0x0;var _0x17c12a=_0xa4e9[_0x5fd5f];return _0x17c12a;};'use strict';var EventEmitter=require(_0x9a4e('0x0'));var SmsQueue=require(_0x9a4e('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a4e('0x2'),'afterUpdate':'update','afterDestroy':_0x9a4e('0x3')};function emitEvent(_0x4a4961){return function(_0x5f1f63,_0x95b20d,_0x413db6){SmsQueueEvents['emit'](_0x4a4961+':'+_0x5f1f63['id'],_0x5f1f63);SmsQueueEvents['emit'](_0x4a4961,_0x5f1f63);_0x413db6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x9a4e('0x4')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index ec8d97a..58defe2 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 _0x0e9f=['moment','path','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0e9f,0x116));var _0xf0e9=function(_0x43fdfd,_0x2fe21b){_0x43fdfd=_0x43fdfd-0x0;var _0x49aab1=_0x0e9f[_0x43fdfd];return _0x49aab1;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf0e9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0e9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf0e9('0x4'));module[_0xf0e9('0x5')]=function(_0x59ac7e,_0x2322dc){return _0x59ac7e['define'](_0xf0e9('0x6'),attributes,{'tableName':_0xf0e9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fc2=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util'];(function(_0xcb093d,_0x1e5834){var _0x43baa5=function(_0x554c9d){while(--_0x554c9d){_0xcb093d['push'](_0xcb093d['shift']());}};_0x43baa5(++_0x1e5834);}(_0x0fc2,0x6e));var _0x20fc=function(_0x550faf,_0x262443){_0x550faf=_0x550faf-0x0;var _0x16dd4e=_0x0fc2[_0x550faf];return _0x16dd4e;};'use strict';var _=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var logger=require(_0x20fc('0x2'))(_0x20fc('0x3'));var moment=require('moment');var BPromise=require(_0x20fc('0x4'));var rp=require(_0x20fc('0x5'));var fs=require('fs');var path=require(_0x20fc('0x6'));var rimraf=require(_0x20fc('0x7'));var config=require(_0x20fc('0x8'));var attributes=require(_0x20fc('0x9'));module[_0x20fc('0xa')]=function(_0x13f2d5,_0x10f6ad){return _0x13f2d5[_0x20fc('0xb')](_0x20fc('0xc'),attributes,{'tableName':_0x20fc('0xd'),'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 502ab1a..86d178d 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 _0x9a4f=['request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','SmsQueue,\x20%s,\x20%s','error','message','result','GetSmsQueue','options','raw','where','limit','include','map','attributes','model','catch','find','ShowSmsQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0x9a4f,0x93));var _0xf9a4=function(_0x36de4f,_0x350d30){_0x36de4f=_0x36de4f-0x0;var _0x1a91c2=_0x9a4f[_0x36de4f];return _0x1a91c2;};'use strict';var _=require(_0xf9a4('0x0'));var util=require(_0xf9a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf9a4('0x2'));var fs=require('fs');var Redis=require(_0xf9a4('0x3'));var db=require(_0xf9a4('0x4'))['db'];var utils=require(_0xf9a4('0x5'));var logger=require(_0xf9a4('0x6'))(_0xf9a4('0x7'));var config=require(_0xf9a4('0x8'));var jayson=require(_0xf9a4('0x9'));var client=jayson[_0xf9a4('0xa')][_0xf9a4('0xb')]({'port':0x232a});config[_0xf9a4('0xc')]=_['defaults'](config[_0xf9a4('0xc')],{'host':_0xf9a4('0xd'),'port':0x18eb});var socket=require(_0xf9a4('0xe'))(new Redis(config['redis']));require(_0xf9a4('0xf'))[_0xf9a4('0x10')](socket);function respondWithRpcPromise(_0x224d01,_0x455642,_0x23b60e){return new BPromise(function(_0x58b51f,_0x3a5e83){return client[_0xf9a4('0x11')](_0x224d01,_0x23b60e)[_0xf9a4('0x12')](function(_0x40535c){logger[_0xf9a4('0x13')]('SmsQueue,\x20%s,\x20%s',_0x455642,_0xf9a4('0x14'));logger[_0xf9a4('0x15')](_0xf9a4('0x16'),_0x455642,_0xf9a4('0x14'),JSON[_0xf9a4('0x17')](_0x40535c));if(_0x40535c['error']){if(_0x40535c['error'][_0xf9a4('0x18')]===0x1f4){logger['error'](_0xf9a4('0x19'),_0x455642,_0x40535c[_0xf9a4('0x1a')][_0xf9a4('0x1b')]);return _0x3a5e83(_0x40535c[_0xf9a4('0x1a')][_0xf9a4('0x1b')]);}logger['error'](_0xf9a4('0x19'),_0x455642,_0x40535c['error'][_0xf9a4('0x1b')]);return _0x58b51f(_0x40535c[_0xf9a4('0x1a')][_0xf9a4('0x1b')]);}else{logger[_0xf9a4('0x13')](_0xf9a4('0x19'),_0x455642,_0xf9a4('0x14'));_0x58b51f(_0x40535c[_0xf9a4('0x1c')]['message']);}})['catch'](function(_0x4cc2af){logger[_0xf9a4('0x1a')](_0xf9a4('0x19'),_0x455642,_0x4cc2af);_0x3a5e83(_0x4cc2af);});});}exports[_0xf9a4('0x1d')]=function(_0x49c5f7){var _0x2e6526=this;return new Promise(function(_0x2fd6cb,_0x200c44){return db['SmsQueue']['findAll']({'raw':_0x49c5f7['options']?_0x49c5f7[_0xf9a4('0x1e')][_0xf9a4('0x1f')]===undefined?!![]:![]:!![],'where':_0x49c5f7[_0xf9a4('0x1e')]?_0x49c5f7[_0xf9a4('0x1e')][_0xf9a4('0x20')]||null:null,'attributes':_0x49c5f7[_0xf9a4('0x1e')]?_0x49c5f7[_0xf9a4('0x1e')]['attributes']||null:null,'limit':_0x49c5f7[_0xf9a4('0x1e')]?_0x49c5f7[_0xf9a4('0x1e')][_0xf9a4('0x21')]||null:null,'include':_0x49c5f7[_0xf9a4('0x1e')]?_0x49c5f7[_0xf9a4('0x1e')][_0xf9a4('0x22')]?_[_0xf9a4('0x23')](_0x49c5f7[_0xf9a4('0x1e')][_0xf9a4('0x22')],function(_0x128a86){return{'model':db[_0x128a86['model']],'as':_0x128a86['as'],'attributes':_0x128a86[_0xf9a4('0x24')],'include':_0x128a86[_0xf9a4('0x22')]?_[_0xf9a4('0x23')](_0x128a86[_0xf9a4('0x22')],function(_0x513a9a){return{'model':db[_0x513a9a[_0xf9a4('0x25')]],'as':_0x513a9a['as'],'attributes':_0x513a9a[_0xf9a4('0x24')],'include':_0x513a9a[_0xf9a4('0x22')]?_['map'](_0x513a9a[_0xf9a4('0x22')],function(_0x593c1d){return{'model':db[_0x593c1d['model']],'as':_0x593c1d['as'],'attributes':_0x593c1d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf9a4('0x12')](function(_0x56ea52){logger[_0xf9a4('0x13')](_0xf9a4('0x1d'),_0x49c5f7);logger[_0xf9a4('0x15')]('GetSmsQueue',_0x49c5f7,JSON[_0xf9a4('0x17')](_0x56ea52));_0x2fd6cb(_0x56ea52);})[_0xf9a4('0x26')](function(_0x247951){logger[_0xf9a4('0x1a')](_0xf9a4('0x1d'),_0x247951[_0xf9a4('0x1b')],_0x49c5f7);_0x200c44(_0x2e6526[_0xf9a4('0x1a')](0x1f4,_0x247951[_0xf9a4('0x1b')]));});});};exports['ShowSmsQueue']=function(_0x3269b6){var _0x10b8f8=this;return new Promise(function(_0x454ee8,_0x4c6008){return db['SmsQueue'][_0xf9a4('0x27')]({'raw':_0x3269b6[_0xf9a4('0x1e')]?_0x3269b6[_0xf9a4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3269b6['options']?_0x3269b6[_0xf9a4('0x1e')][_0xf9a4('0x20')]||null:null,'attributes':_0x3269b6[_0xf9a4('0x1e')]?_0x3269b6['options'][_0xf9a4('0x24')]||null:null,'include':_0x3269b6[_0xf9a4('0x1e')]?_0x3269b6[_0xf9a4('0x1e')][_0xf9a4('0x22')]?_[_0xf9a4('0x23')](_0x3269b6['options'][_0xf9a4('0x22')],function(_0x5234f7){return{'model':db[_0x5234f7[_0xf9a4('0x25')]],'as':_0x5234f7['as'],'attributes':_0x5234f7[_0xf9a4('0x24')],'include':_0x5234f7[_0xf9a4('0x22')]?_[_0xf9a4('0x23')](_0x5234f7['include'],function(_0x3e2593){return{'model':db[_0x3e2593['model']],'as':_0x3e2593['as'],'attributes':_0x3e2593['attributes'],'include':_0x3e2593['include']?_[_0xf9a4('0x23')](_0x3e2593[_0xf9a4('0x22')],function(_0x1de2ab){return{'model':db[_0x1de2ab[_0xf9a4('0x25')]],'as':_0x1de2ab['as'],'attributes':_0x1de2ab[_0xf9a4('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf9a4('0x12')](function(_0x454f6a){logger['info'](_0xf9a4('0x28'),_0x3269b6);logger['debug']('ShowSmsQueue',_0x3269b6,JSON[_0xf9a4('0x17')](_0x454f6a));_0x454ee8(_0x454f6a);})['catch'](function(_0x3edd7d){logger['error'](_0xf9a4('0x28'),_0x3edd7d[_0xf9a4('0x1b')],_0x3269b6);_0x4c6008(_0x10b8f8[_0xf9a4('0x1a')](0x1f4,_0x3edd7d[_0xf9a4('0x1b')]));});});}; \ No newline at end of file +var _0xb7fa=['model','attributes','stringify','ShowSmsQueue','SmsQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSmsQueue','findAll','options','where','limit','include','map'];(function(_0x5b1394,_0x17f08d){var _0x483150=function(_0x1d9539){while(--_0x1d9539){_0x5b1394['push'](_0x5b1394['shift']());}};_0x483150(++_0x17f08d);}(_0xb7fa,0x18d));var _0xab7f=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0xb7fa[_0x38c699];return _0x3b1ded;};'use strict';var _=require(_0xab7f('0x0'));var util=require(_0xab7f('0x1'));var moment=require(_0xab7f('0x2'));var BPromise=require('bluebird');var rs=require(_0xab7f('0x3'));var fs=require('fs');var Redis=require(_0xab7f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xab7f('0x5'))(_0xab7f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xab7f('0x7')][_0xab7f('0x8')]({'port':0x232a});config['redis']=_[_0xab7f('0x9')](config[_0xab7f('0xa')],{'host':_0xab7f('0xb'),'port':0x18eb});var socket=require(_0xab7f('0xc'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xab7f('0xd')](socket);function respondWithRpcPromise(_0x95ca43,_0x5981de,_0x1e3307){return new BPromise(function(_0x50ffd6,_0xfb45d0){return client[_0xab7f('0xe')](_0x95ca43,_0x1e3307)[_0xab7f('0xf')](function(_0x222483){logger[_0xab7f('0x10')](_0xab7f('0x11'),_0x5981de,_0xab7f('0x12'));logger[_0xab7f('0x13')](_0xab7f('0x14'),_0x5981de,_0xab7f('0x12'),JSON['stringify'](_0x222483));if(_0x222483[_0xab7f('0x15')]){if(_0x222483[_0xab7f('0x15')]['code']===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x5981de,_0x222483[_0xab7f('0x15')][_0xab7f('0x16')]);return _0xfb45d0(_0x222483[_0xab7f('0x15')]['message']);}logger[_0xab7f('0x15')]('SmsQueue,\x20%s,\x20%s',_0x5981de,_0x222483[_0xab7f('0x15')][_0xab7f('0x16')]);return _0x50ffd6(_0x222483[_0xab7f('0x15')]['message']);}else{logger[_0xab7f('0x10')]('SmsQueue,\x20%s,\x20%s',_0x5981de,_0xab7f('0x12'));_0x50ffd6(_0x222483[_0xab7f('0x17')][_0xab7f('0x16')]);}})[_0xab7f('0x18')](function(_0xb5a5ff){logger[_0xab7f('0x15')](_0xab7f('0x11'),_0x5981de,_0xb5a5ff);_0xfb45d0(_0xb5a5ff);});});}exports[_0xab7f('0x19')]=function(_0x219973){var _0x21a015=this;return new Promise(function(_0x1f63f4,_0x311b58){return db['SmsQueue'][_0xab7f('0x1a')]({'raw':_0x219973[_0xab7f('0x1b')]?_0x219973[_0xab7f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x219973[_0xab7f('0x1b')]?_0x219973['options'][_0xab7f('0x1c')]||null:null,'attributes':_0x219973[_0xab7f('0x1b')]?_0x219973[_0xab7f('0x1b')]['attributes']||null:null,'limit':_0x219973['options']?_0x219973[_0xab7f('0x1b')][_0xab7f('0x1d')]||null:null,'include':_0x219973['options']?_0x219973[_0xab7f('0x1b')][_0xab7f('0x1e')]?_[_0xab7f('0x1f')](_0x219973['options'][_0xab7f('0x1e')],function(_0x4c1914){return{'model':db[_0x4c1914[_0xab7f('0x20')]],'as':_0x4c1914['as'],'attributes':_0x4c1914[_0xab7f('0x21')],'include':_0x4c1914[_0xab7f('0x1e')]?_[_0xab7f('0x1f')](_0x4c1914[_0xab7f('0x1e')],function(_0x4b4ff4){return{'model':db[_0x4b4ff4['model']],'as':_0x4b4ff4['as'],'attributes':_0x4b4ff4[_0xab7f('0x21')],'include':_0x4b4ff4[_0xab7f('0x1e')]?_[_0xab7f('0x1f')](_0x4b4ff4[_0xab7f('0x1e')],function(_0x6cee65){return{'model':db[_0x6cee65['model']],'as':_0x6cee65['as'],'attributes':_0x6cee65['attributes']};}):[]};}):[]};}):[]:[]})[_0xab7f('0xf')](function(_0x462918){logger[_0xab7f('0x10')](_0xab7f('0x19'),_0x219973);logger[_0xab7f('0x13')](_0xab7f('0x19'),_0x219973,JSON[_0xab7f('0x22')](_0x462918));_0x1f63f4(_0x462918);})[_0xab7f('0x18')](function(_0x68874e){logger[_0xab7f('0x15')]('GetSmsQueue',_0x68874e[_0xab7f('0x16')],_0x219973);_0x311b58(_0x21a015[_0xab7f('0x15')](0x1f4,_0x68874e[_0xab7f('0x16')]));});});};exports[_0xab7f('0x23')]=function(_0x2643a2){var _0x484dfb=this;return new Promise(function(_0x4c87d3,_0x1f6d78){return db[_0xab7f('0x24')][_0xab7f('0x25')]({'raw':_0x2643a2['options']?_0x2643a2['options'][_0xab7f('0x26')]===undefined?!![]:![]:!![],'where':_0x2643a2[_0xab7f('0x1b')]?_0x2643a2[_0xab7f('0x1b')][_0xab7f('0x1c')]||null:null,'attributes':_0x2643a2[_0xab7f('0x1b')]?_0x2643a2[_0xab7f('0x1b')][_0xab7f('0x21')]||null:null,'include':_0x2643a2[_0xab7f('0x1b')]?_0x2643a2[_0xab7f('0x1b')][_0xab7f('0x1e')]?_[_0xab7f('0x1f')](_0x2643a2[_0xab7f('0x1b')][_0xab7f('0x1e')],function(_0x38e26a){return{'model':db[_0x38e26a['model']],'as':_0x38e26a['as'],'attributes':_0x38e26a[_0xab7f('0x21')],'include':_0x38e26a[_0xab7f('0x1e')]?_[_0xab7f('0x1f')](_0x38e26a[_0xab7f('0x1e')],function(_0x2351ff){return{'model':db[_0x2351ff['model']],'as':_0x2351ff['as'],'attributes':_0x2351ff[_0xab7f('0x21')],'include':_0x2351ff[_0xab7f('0x1e')]?_[_0xab7f('0x1f')](_0x2351ff[_0xab7f('0x1e')],function(_0x501ba2){return{'model':db[_0x501ba2[_0xab7f('0x20')]],'as':_0x501ba2['as'],'attributes':_0x501ba2[_0xab7f('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x275c4f){logger[_0xab7f('0x10')](_0xab7f('0x23'),_0x2643a2);logger['debug'](_0xab7f('0x23'),_0x2643a2,JSON[_0xab7f('0x22')](_0x275c4f));_0x4c87d3(_0x275c4f);})['catch'](function(_0x174e6a){logger[_0xab7f('0x15')](_0xab7f('0x23'),_0x174e6a[_0xab7f('0x16')],_0x2643a2);_0x1f6d78(_0x484dfb[_0xab7f('0x15')](0x1f4,_0x174e6a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 6a1fd71..89bdf98 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 _0x548a=['register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x54c3c5,_0x1c1bae){var _0x191b03=function(_0x5e95c9){while(--_0x5e95c9){_0x54c3c5['push'](_0x54c3c5['shift']());}};_0x191b03(++_0x1c1bae);}(_0x548a,0x173));var _0xa548=function(_0x5c82c1,_0x577293){_0x5c82c1=_0x5c82c1-0x0;var _0x22034d=_0x548a[_0x5c82c1];return _0x22034d;};'use strict';var SmsQueueEvents=require(_0xa548('0x0'));var events=[_0xa548('0x1'),_0xa548('0x2'),_0xa548('0x3')];function createListener(_0x27b5e4,_0x3dcc31){return function(_0x41fe98){_0x3dcc31[_0xa548('0x4')](_0x27b5e4,_0x41fe98);};}function removeListener(_0x24ef21,_0x2ce5da){return function(){SmsQueueEvents['removeListener'](_0x24ef21,_0x2ce5da);};}exports[_0xa548('0x5')]=function(_0x38ce5d){for(var _0x1f9b03=0x0,_0x495d37=events[_0xa548('0x6')];_0x1f9b03<_0x495d37;_0x1f9b03++){var _0x46d71a=events[_0x1f9b03];var _0x5d02be=createListener(_0xa548('0x7')+_0x46d71a,_0x38ce5d);SmsQueueEvents['on'](_0x46d71a,_0x5d02be);}}; \ No newline at end of file +var _0x8c02=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x8c02,0x13f));var _0x28c0=function(_0x194c34,_0x11e2dd){_0x194c34=_0x194c34-0x0;var _0xaadd57=_0x8c02[_0x194c34];return _0xaadd57;};'use strict';var SmsQueueEvents=require(_0x28c0('0x0'));var events=[_0x28c0('0x1'),_0x28c0('0x2'),_0x28c0('0x3')];function createListener(_0x4022e2,_0x3e44f5){return function(_0x213ee8){_0x3e44f5[_0x28c0('0x4')](_0x4022e2,_0x213ee8);};}function removeListener(_0x17ca8b,_0x3d5edc){return function(){SmsQueueEvents[_0x28c0('0x5')](_0x17ca8b,_0x3d5edc);};}exports[_0x28c0('0x6')]=function(_0x372e6e){for(var _0x36fed8=0x0,_0x2a2768=events[_0x28c0('0x7')];_0x36fed8<_0x2a2768;_0x36fed8++){var _0x57288f=events[_0x36fed8];var _0x9ba02b=createListener(_0x28c0('0x8')+_0x57288f,_0x372e6e);SmsQueueEvents['on'](_0x57288f,_0x9ba02b);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 79546f8..d707c10 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 _0xe35f=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x160b12,_0x46d66c){var _0x2959f7=function(_0x18a76b){while(--_0x18a76b){_0x160b12['push'](_0x160b12['shift']());}};_0x2959f7(++_0x46d66c);}(_0xe35f,0x140));var _0xfe35=function(_0x2af6d3,_0x28899d){_0x2af6d3=_0x2af6d3-0x0;var _0x42a02f=_0xe35f[_0x2af6d3];return _0x42a02f;};'use strict';var multer=require(_0xfe35('0x0'));var util=require('util');var path=require(_0xfe35('0x1'));var timeout=require(_0xfe35('0x2'));var express=require('express');var router=express[_0xfe35('0x3')]();var auth=require(_0xfe35('0x4'));var interaction=require(_0xfe35('0x5'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0xfe35('0x6')]('/',auth[_0xfe35('0x7')](),controller[_0xfe35('0x8')]);router[_0xfe35('0x6')](_0xfe35('0x9'),auth['isAuthenticated'](),controller[_0xfe35('0xa')]);router[_0xfe35('0x6')](_0xfe35('0xb'),auth[_0xfe35('0x7')](),controller[_0xfe35('0xc')]);router['post']('/',auth[_0xfe35('0x7')](),controller[_0xfe35('0xd')]);router[_0xfe35('0xe')](_0xfe35('0xb'),auth['isAuthenticated'](),controller[_0xfe35('0xf')]);router['delete'](_0xfe35('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1d5f=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x1d5f,0xbf));var _0xf1d5=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0x1d5f[_0x3a0863];return _0x85c557;};'use strict';var multer=require(_0xf1d5('0x0'));var util=require(_0xf1d5('0x1'));var path=require(_0xf1d5('0x2'));var timeout=require(_0xf1d5('0x3'));var express=require('express');var router=express[_0xf1d5('0x4')]();var auth=require(_0xf1d5('0x5'));var interaction=require(_0xf1d5('0x6'));var config=require('../../config/environment');var controller=require(_0xf1d5('0x7'));router[_0xf1d5('0x8')]('/',auth[_0xf1d5('0x9')](),controller[_0xf1d5('0xa')]);router['get'](_0xf1d5('0xb'),auth[_0xf1d5('0x9')](),controller[_0xf1d5('0xc')]);router[_0xf1d5('0x8')](_0xf1d5('0xd'),auth[_0xf1d5('0x9')](),controller[_0xf1d5('0xe')]);router[_0xf1d5('0xf')]('/',auth['isAuthenticated'](),controller[_0xf1d5('0x10')]);router[_0xf1d5('0x11')](_0xf1d5('0xd'),auth[_0xf1d5('0x9')](),controller['update']);router[_0xf1d5('0x12')](_0xf1d5('0xd'),auth[_0xf1d5('0x9')](),controller[_0xf1d5('0x13')]);module[_0xf1d5('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index aad5094..04cff8c 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 _0x2e9b=['STRING','DATE','moment','sequelize','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2e9b,0x1c4));var _0xb2e9=function(_0x2165ad,_0x4323f9){_0x2165ad=_0x2165ad-0x0;var _0x2624ca=_0x2e9b[_0x2165ad];return _0x2624ca;};'use strict';var moment=require(_0xb2e9('0x0'));var Sequelize=require(_0xb2e9('0x1'));module[_0xb2e9('0x2')]={'uniqueid':{'type':Sequelize[_0xb2e9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb2e9('0x3')]},'joinAt':{'type':Sequelize[_0xb2e9('0x4')]},'leaveAt':{'type':Sequelize[_0xb2e9('0x4')]},'acceptAt':{'type':Sequelize[_0xb2e9('0x4')]},'exitAt':{'type':Sequelize[_0xb2e9('0x4')]},'reason':{'type':Sequelize[_0xb2e9('0x3')]}}; \ No newline at end of file +var _0x2e30=['moment','sequelize','STRING','DATE'];(function(_0x45edfb,_0x14a39f){var _0x1d0976=function(_0x5b8262){while(--_0x5b8262){_0x45edfb['push'](_0x45edfb['shift']());}};_0x1d0976(++_0x14a39f);}(_0x2e30,0xe0));var _0x02e3=function(_0x36e52e,_0x82e900){_0x36e52e=_0x36e52e-0x0;var _0xab13eb=_0x2e30[_0x36e52e];return _0xab13eb;};'use strict';var moment=require(_0x02e3('0x0'));var Sequelize=require(_0x02e3('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x02e3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x02e3('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x02e3('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x02e3('0x3')]},'reason':{'type':Sequelize[_0x02e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 5769b0b..bdab937 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 _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','SmsQueueReport','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(_0x561432,_0x21ec65){var _0x3485b6=function(_0x3e022f){while(--_0x3e022f){_0x561432['push'](_0x561432['shift']());}};_0x3485b6(++_0x21ec65);}(_0x814b,0x1a2));var _0xb814=function(_0x161ac3,_0x142e49){_0x161ac3=_0x161ac3-0x0;var _0x3bb837=_0x814b[_0x161ac3];return _0x3bb837;};'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['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_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['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','SmsQueueReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x211c0a,_0x54f209){var _0x26f1a1=function(_0x13b0cd){while(--_0x13b0cd){_0x211c0a['push'](_0x211c0a['shift']());}};_0x26f1a1(++_0x54f209);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['SmsQueueReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]),_0x132a42);if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 59a2e6c..4b816c5 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 _0xc8e0=['exports','define','SmsQueueReport','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0xc8e0,0x1e4));var _0x0c8e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc8e0[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x0c8e('0x0'));var util=require(_0x0c8e('0x1'));var logger=require('../../config/logger')(_0x0c8e('0x2'));var moment=require(_0x0c8e('0x3'));var BPromise=require(_0x0c8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c8e('0x5'));var rimraf=require(_0x0c8e('0x6'));var config=require(_0x0c8e('0x7'));var attributes=require('./smsQueueReport.attributes');module[_0x0c8e('0x8')]=function(_0x27cecd,_0x5f2909){return _0x27cecd[_0x0c8e('0x9')](_0x0c8e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x0c8e('0xb'),'fields':[_0x0c8e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f2c=['request-promise','../../config/environment','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x41a76d,_0x59c60a){var _0x25d915=function(_0x4a1c6f){while(--_0x4a1c6f){_0x41a76d['push'](_0x41a76d['shift']());}};_0x25d915(++_0x59c60a);}(_0x6f2c,0x14c));var _0xc6f2=function(_0x1eeaf4,_0x3302fa){_0x1eeaf4=_0x1eeaf4-0x0;var _0x1fe081=_0x6f2c[_0x1eeaf4];return _0x1fe081;};'use strict';var _=require(_0xc6f2('0x0'));var util=require(_0xc6f2('0x1'));var logger=require(_0xc6f2('0x2'))(_0xc6f2('0x3'));var moment=require(_0xc6f2('0x4'));var BPromise=require(_0xc6f2('0x5'));var rp=require(_0xc6f2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc6f2('0x7'));var attributes=require('./smsQueueReport.attributes');module[_0xc6f2('0x8')]=function(_0x2faff3,_0x537839){return _0x2faff3[_0xc6f2('0x9')](_0xc6f2('0xa'),attributes,{'tableName':_0xc6f2('0xb'),'paranoid':![],'indexes':[{'name':_0xc6f2('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 6e8aa60..4cdd253 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 _0x6be8=['moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateSmsQueueReport','create','body','options','raw','update','where','UpdateSmsQueueReport','lodash'];(function(_0x38b86f,_0x4b3582){var _0x163974=function(_0x188793){while(--_0x188793){_0x38b86f['push'](_0x38b86f['shift']());}};_0x163974(++_0x4b3582);}(_0x6be8,0x128));var _0x86be=function(_0x193b01,_0x2f9ac6){_0x193b01=_0x193b01-0x0;var _0x531e06=_0x6be8[_0x193b01];return _0x531e06;};'use strict';var _=require(_0x86be('0x0'));var util=require('util');var moment=require(_0x86be('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86be('0x2'))['db'];var utils=require(_0x86be('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x86be('0x4'));var jayson=require(_0x86be('0x5'));var client=jayson[_0x86be('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39d34e,_0x1de9a1,_0xb0f1ea){return new BPromise(function(_0x3010d2,_0x54c9b6){return client[_0x86be('0x7')](_0x39d34e,_0xb0f1ea)[_0x86be('0x8')](function(_0x545c7b){logger['info'](_0x86be('0x9'),_0x1de9a1,_0x86be('0xa'));logger[_0x86be('0xb')](_0x86be('0xc'),_0x1de9a1,_0x86be('0xa'),JSON[_0x86be('0xd')](_0x545c7b));if(_0x545c7b[_0x86be('0xe')]){if(_0x545c7b[_0x86be('0xe')]['code']===0x1f4){logger[_0x86be('0xe')](_0x86be('0x9'),_0x1de9a1,_0x545c7b[_0x86be('0xe')][_0x86be('0xf')]);return _0x54c9b6(_0x545c7b[_0x86be('0xe')][_0x86be('0xf')]);}logger[_0x86be('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x1de9a1,_0x545c7b[_0x86be('0xe')][_0x86be('0xf')]);return _0x3010d2(_0x545c7b[_0x86be('0xe')]['message']);}else{logger[_0x86be('0x10')](_0x86be('0x9'),_0x1de9a1,_0x86be('0xa'));_0x3010d2(_0x545c7b[_0x86be('0x11')][_0x86be('0xf')]);}})[_0x86be('0x12')](function(_0x536fdc){logger[_0x86be('0xe')](_0x86be('0x9'),_0x1de9a1,_0x536fdc);_0x54c9b6(_0x536fdc);});});}exports[_0x86be('0x13')]=function(_0x158c4d){var _0x47d50e=this;return new Promise(function(_0x121a99,_0x597e73){return db['SmsQueueReport'][_0x86be('0x14')](_0x158c4d[_0x86be('0x15')],{'raw':_0x158c4d[_0x86be('0x16')]?_0x158c4d[_0x86be('0x16')][_0x86be('0x17')]===undefined?!![]:![]:!![]})[_0x86be('0x8')](function(_0x424c87){logger[_0x86be('0x10')]('CreateSmsQueueReport',_0x158c4d);logger[_0x86be('0xb')](_0x86be('0x13'),_0x158c4d,JSON[_0x86be('0xd')](_0x424c87));_0x121a99(_0x424c87);})[_0x86be('0x12')](function(_0xa3ce7f){logger[_0x86be('0xe')](_0x86be('0x13'),_0xa3ce7f[_0x86be('0xf')],_0x158c4d);_0x597e73(_0x47d50e['error'](0x1f4,_0xa3ce7f[_0x86be('0xf')]));});});};exports['UpdateSmsQueueReport']=function(_0x3f0069){var _0x45d125=this;return new Promise(function(_0x17e6cb,_0x5e1b85){return db['SmsQueueReport'][_0x86be('0x18')](_0x3f0069[_0x86be('0x15')],{'raw':_0x3f0069[_0x86be('0x16')]?_0x3f0069[_0x86be('0x16')][_0x86be('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f0069[_0x86be('0x16')]?_0x3f0069[_0x86be('0x16')][_0x86be('0x19')]||null:null,'attributes':_0x3f0069[_0x86be('0x16')]?_0x3f0069[_0x86be('0x16')]['attributes']||null:null,'limit':_0x3f0069[_0x86be('0x16')]?_0x3f0069[_0x86be('0x16')]['limit']||null:null})['then'](function(_0x27ec65){logger['info'](_0x86be('0x1a'),_0x3f0069);logger[_0x86be('0xb')](_0x86be('0x1a'),_0x3f0069,JSON[_0x86be('0xd')](_0x27ec65));_0x17e6cb(_0x27ec65);})[_0x86be('0x12')](function(_0x5e1362){logger['error'](_0x86be('0x1a'),_0x5e1362[_0x86be('0xf')],_0x3f0069);_0x5e1b85(_0x45d125[_0x86be('0xe')](0x1f4,_0x5e1362['message']));});});}; \ No newline at end of file +var _0x755c=['jayson/promise','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x54e594,_0xb5dc9c){var _0x4a14c3=function(_0x141d5b){while(--_0x141d5b){_0x54e594['push'](_0x54e594['shift']());}};_0x4a14c3(++_0xb5dc9c);}(_0x755c,0x10e));var _0xc755=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x755c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc755('0x0'));var util=require(_0xc755('0x1'));var moment=require(_0xc755('0x2'));var BPromise=require('bluebird');var rs=require(_0xc755('0x3'));var fs=require('fs');var Redis=require(_0xc755('0x4'));var db=require(_0xc755('0x5'))['db'];var utils=require(_0xc755('0x6'));var logger=require(_0xc755('0x7'))(_0xc755('0x8'));var config=require(_0xc755('0x9'));var jayson=require(_0xc755('0xa'));var client=jayson['client'][_0xc755('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43d095,_0x5e76da,_0x15d80f){return new BPromise(function(_0x288bb3,_0x44f05b){return client[_0xc755('0xc')](_0x43d095,_0x15d80f)['then'](function(_0x589ceb){logger[_0xc755('0xd')](_0xc755('0xe'),_0x5e76da,_0xc755('0xf'));logger[_0xc755('0x10')](_0xc755('0x11'),_0x5e76da,_0xc755('0xf'),JSON[_0xc755('0x12')](_0x589ceb));if(_0x589ceb['error']){if(_0x589ceb[_0xc755('0x13')][_0xc755('0x14')]===0x1f4){logger[_0xc755('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x5e76da,_0x589ceb[_0xc755('0x13')][_0xc755('0x15')]);return _0x44f05b(_0x589ceb['error']['message']);}logger[_0xc755('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x5e76da,_0x589ceb[_0xc755('0x13')][_0xc755('0x15')]);return _0x288bb3(_0x589ceb['error'][_0xc755('0x15')]);}else{logger[_0xc755('0xd')](_0xc755('0xe'),_0x5e76da,_0xc755('0xf'));_0x288bb3(_0x589ceb[_0xc755('0x16')][_0xc755('0x15')]);}})[_0xc755('0x17')](function(_0x3f6d86){logger[_0xc755('0x13')](_0xc755('0xe'),_0x5e76da,_0x3f6d86);_0x44f05b(_0x3f6d86);});});}exports[_0xc755('0x18')]=function(_0x54e3ca){var _0x1e8587=this;return new Promise(function(_0x3c480d,_0x158f22){return db[_0xc755('0x19')][_0xc755('0x1a')](_0x54e3ca[_0xc755('0x1b')],{'raw':_0x54e3ca[_0xc755('0x1c')]?_0x54e3ca['options'][_0xc755('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x42406c){logger['info']('CreateSmsQueueReport',_0x54e3ca);logger[_0xc755('0x10')]('CreateSmsQueueReport',_0x54e3ca,JSON[_0xc755('0x12')](_0x42406c));_0x3c480d(_0x42406c);})['catch'](function(_0x527090){logger[_0xc755('0x13')]('CreateSmsQueueReport',_0x527090[_0xc755('0x15')],_0x54e3ca);_0x158f22(_0x1e8587[_0xc755('0x13')](0x1f4,_0x527090[_0xc755('0x15')]));});});};exports['UpdateSmsQueueReport']=function(_0x4cda2d){var _0x29a4f7=this;return new Promise(function(_0x49dbc3,_0x28c991){return db[_0xc755('0x19')][_0xc755('0x1e')](_0x4cda2d[_0xc755('0x1b')],{'raw':_0x4cda2d['options']?_0x4cda2d['options'][_0xc755('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cda2d[_0xc755('0x1c')]?_0x4cda2d[_0xc755('0x1c')][_0xc755('0x1f')]||null:null,'attributes':_0x4cda2d[_0xc755('0x1c')]?_0x4cda2d['options'][_0xc755('0x20')]||null:null,'limit':_0x4cda2d['options']?_0x4cda2d[_0xc755('0x1c')][_0xc755('0x21')]||null:null})['then'](function(_0x578d77){logger[_0xc755('0xd')](_0xc755('0x22'),_0x4cda2d);logger[_0xc755('0x10')](_0xc755('0x22'),_0x4cda2d,JSON[_0xc755('0x12')](_0x578d77));_0x49dbc3(_0x578d77);})['catch'](function(_0x5897d0){logger[_0xc755('0x13')](_0xc755('0x22'),_0x5897d0[_0xc755('0x15')],_0x4cda2d);_0x28c991(_0x29a4f7[_0xc755('0x13')](0x1f4,_0x5897d0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index df6d6f6..1997413 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 _0x13f6=['post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','index','/:id','isAuthenticated','show'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x13f6,0x124));var _0x613f=function(_0x3243f9,_0x56a64b){_0x3243f9=_0x3243f9-0x0;var _0x3553f7=_0x13f6[_0x3243f9];return _0x3553f7;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var auth=require(_0x613f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x613f('0x5'));var controller=require(_0x613f('0x6'));router[_0x613f('0x7')]('/',auth['isAuthenticated'](),controller[_0x613f('0x8')]);router[_0x613f('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x613f('0x9'),auth[_0x613f('0xa')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/',auth['isAuthenticated'](),controller[_0x613f('0xd')]);router[_0x613f('0xe')](_0x613f('0x9'),auth['isAuthenticated'](),controller[_0x613f('0xf')]);router[_0x613f('0x10')](_0x613f('0x9'),auth['isAuthenticated'](),controller[_0x613f('0x11')]);module[_0x613f('0x12')]=router; \ No newline at end of file +var _0xa74f=['post','create','delete','destroy','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3a10b6,_0x3181f0){var _0x463dc3=function(_0x5e37f2){while(--_0x5e37f2){_0x3a10b6['push'](_0x3a10b6['shift']());}};_0x463dc3(++_0x3181f0);}(_0xa74f,0x9a));var _0xfa74=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xa74f[_0x5e6ea3];return _0x4048b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var auth=require(_0xfa74('0x2'));var interaction=require(_0xfa74('0x3'));var config=require(_0xfa74('0x4'));var controller=require('./smsTransferReport.controller');router[_0xfa74('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfa74('0x5')](_0xfa74('0x6'),auth[_0xfa74('0x7')](),controller[_0xfa74('0x8')]);router[_0xfa74('0x5')](_0xfa74('0x9'),auth['isAuthenticated'](),controller[_0xfa74('0xa')]);router[_0xfa74('0xb')]('/',auth[_0xfa74('0x7')](),controller[_0xfa74('0xc')]);router['put'](_0xfa74('0x9'),auth[_0xfa74('0x7')](),controller['update']);router[_0xfa74('0xd')](_0xfa74('0x9'),auth[_0xfa74('0x7')](),controller[_0xfa74('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 7270476..b99c0f9 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 _0xb405=['sequelize','exports','ENUM','account','agent','queue','DATE','NOW'];(function(_0x5f51d2,_0x4f0133){var _0x24bf08=function(_0x25e6b5){while(--_0x25e6b5){_0x5f51d2['push'](_0x5f51d2['shift']());}};_0x24bf08(++_0x4f0133);}(_0xb405,0x188));var _0x5b40=function(_0xf0884,_0x436054){_0xf0884=_0xf0884-0x0;var _0x1be9a8=_0xb405[_0xf0884];return _0x1be9a8;};'use strict';var moment=require('moment');var Sequelize=require(_0x5b40('0x0'));module[_0x5b40('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5b40('0x2')](_0x5b40('0x3'),_0x5b40('0x4'),_0x5b40('0x5')),'allowNull':![],'defaultValue':_0x5b40('0x5')},'transferredAt':{'type':Sequelize[_0x5b40('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x5b40('0x7')]}}; \ No newline at end of file +var _0xe2fb=['STRING','ENUM','account','queue','NOW','moment','sequelize'];(function(_0x5dd98d,_0xedac2c){var _0x3e010f=function(_0x19f645){while(--_0x19f645){_0x5dd98d['push'](_0x5dd98d['shift']());}};_0x3e010f(++_0xedac2c);}(_0xe2fb,0x124));var _0xbe2f=function(_0x4257fe,_0x18cdc3){_0x4257fe=_0x4257fe-0x0;var _0x559c17=_0xe2fb[_0x4257fe];return _0x559c17;};'use strict';var moment=require(_0xbe2f('0x0'));var Sequelize=require(_0xbe2f('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbe2f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbe2f('0x3')](_0xbe2f('0x4'),'agent',_0xbe2f('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xbe2f('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 295ff3f..e95f57b 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 _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x28fbca,_0x1df23d){var _0x9d69d3=function(_0x3e11e3){while(--_0x3e11e3){_0x28fbca['push'](_0x28fbca['shift']());}};_0x9d69d3(++_0x1df23d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['SmsTransferReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['SmsTransferReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file +var _0xd8b0=['intersection','fields','attributes','length','model','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','SmsTransferReport','count','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys'];(function(_0x2bea0c,_0x9d2212){var _0x124b8f=function(_0x9f2bc2){while(--_0x9f2bc2){_0x2bea0c['push'](_0x2bea0c['shift']());}};_0x124b8f(++_0x9d2212);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={},_0x28f639={},_0x3ef745={'count':0x0,'rows':[]};var _0x4c05ee=_[_0x0d8b('0x28')](db['SmsTransferReport'][_0x0d8b('0x29')],function(_0x4b59e5){return{'name':_0x4b59e5[_0x0d8b('0x2a')],'type':_0x4b59e5['type'][_0x0d8b('0x2b')]};});_0x28f639['model']=_[_0x0d8b('0x28')](_0x4c05ee,'name');_0x28f639[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0xa2af02[_0x0d8b('0x2c')]);_0x28f639['filters']=_['intersection'](_0x28f639['model'],_0x28f639[_0x0d8b('0x2c')]);_0x59a905['attributes']=_[_0x0d8b('0x2e')](_0x28f639['model'],qs['fields'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x59a905[_0x0d8b('0x30')]=_0x59a905[_0x0d8b('0x30')][_0x0d8b('0x31')]?_0x59a905[_0x0d8b('0x30')]:_0x28f639[_0x0d8b('0x32')];if(!_0xa2af02[_0x0d8b('0x2c')]['hasOwnProperty'](_0x0d8b('0x33'))){_0x59a905[_0x0d8b('0x1b')]=qs['limit'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1b')]);_0x59a905[_0x0d8b('0x1a')]=qs['offset'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}_0x59a905[_0x0d8b('0x34')]=qs[_0x0d8b('0x35')](_0xa2af02[_0x0d8b('0x2c')]['sort']);_0x59a905[_0x0d8b('0x36')]=qs[_0x0d8b('0x37')](_['pick'](_0xa2af02[_0x0d8b('0x2c')],_0x28f639[_0x0d8b('0x37')]),_0x4c05ee);if(_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x59a905[_0x0d8b('0x36')]=_['merge'](_0x59a905['where'],{'$or':_[_0x0d8b('0x28')](_0x4c05ee,function(_0x5c2c04){if(_0x5c2c04['type']!==_0x0d8b('0x39')){var _0x2e279c={};_0x2e279c[_0x5c2c04[_0x0d8b('0x25')]]={'$like':'%'+_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x2e279c;}})});}_0x59a905=_[_0x0d8b('0x3a')]({},_0x59a905,_0xa2af02['options']);var _0x6e5bab={'where':_0x59a905[_0x0d8b('0x36')]};return db[_0x0d8b('0x3b')][_0x0d8b('0x3c')](_0x6e5bab)[_0x0d8b('0x22')](function(_0x1a39ad){_0x3ef745[_0x0d8b('0x3c')]=_0x1a39ad;if(_0xa2af02['query'][_0x0d8b('0x3d')]){_0x59a905[_0x0d8b('0x3e')]=[{'all':!![]}];}return db[_0x0d8b('0x3b')][_0x0d8b('0x3f')](_0x59a905);})['then'](function(_0xe0bf42){_0x3ef745['rows']=_0xe0bf42;return _0x3ef745;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4fe6f9,_0x59a905))[_0x0d8b('0x40')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x41')]=function(_0x26ac10,_0x35fa7e){var _0x3e632e={'raw':!![],'where':{'id':_0x26ac10[_0x0d8b('0x42')]['id']}},_0x1ff17d={};_0x1ff17d[_0x0d8b('0x32')]=_[_0x0d8b('0x2d')](db['SmsTransferReport']['rawAttributes']);_0x1ff17d['query']=_['keys'](_0x26ac10['query']);_0x1ff17d[_0x0d8b('0x37')]=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],_0x1ff17d['query']);_0x3e632e['attributes']=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],qs[_0x0d8b('0x2f')](_0x26ac10['query'][_0x0d8b('0x2f')]));_0x3e632e[_0x0d8b('0x30')]=_0x3e632e['attributes']['length']?_0x3e632e[_0x0d8b('0x30')]:_0x1ff17d['model'];if(_0x26ac10[_0x0d8b('0x2c')]['includeAll']){_0x3e632e['include']=[{'all':!![]}];}_0x3e632e=_[_0x0d8b('0x3a')]({},_0x3e632e,_0x26ac10[_0x0d8b('0x43')]);return db['SmsTransferReport']['find'](_0x3e632e)['then'](handleEntityNotFound(_0x35fa7e,null))['then'](respondWithResult(_0x35fa7e,null))[_0x0d8b('0x40')](handleError(_0x35fa7e,null));};exports[_0x0d8b('0x44')]=function(_0xd9d4c3,_0x490eda){return db[_0x0d8b('0x3b')][_0x0d8b('0x44')](_0xd9d4c3[_0x0d8b('0x45')],{})[_0x0d8b('0x22')](respondWithResult(_0x490eda,0xc9))[_0x0d8b('0x40')](handleError(_0x490eda,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x45')]['id']){delete _0x11d22b[_0x0d8b('0x45')]['id'];}return db[_0x0d8b('0x3b')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x45')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x40')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x47')]=function(_0x574b90,_0x371fa0){return db['SmsTransferReport']['find']({'where':{'id':_0x574b90[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x371fa0,null))[_0x0d8b('0x22')](removeEntity(_0x371fa0,null))[_0x0d8b('0x40')](handleError(_0x371fa0,null));};exports['describe']=function(_0x131579,_0x1106d6){return db[_0x0d8b('0x3b')][_0x0d8b('0x48')]()[_0x0d8b('0x22')](respondWithResult(_0x1106d6,null))['catch'](handleError(_0x1106d6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index bd757b8..96d8e2b 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 _0xa5ee=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x14f0a5,_0x1703e7){var _0x33eb9e=function(_0x4ca530){while(--_0x4ca530){_0x14f0a5['push'](_0x14f0a5['shift']());}};_0x33eb9e(++_0x1703e7);}(_0xa5ee,0x1a8));var _0xea5e=function(_0x162a06,_0x3094d7){_0x162a06=_0x162a06-0x0;var _0x32447b=_0xa5ee[_0x162a06];return _0x32447b;};'use strict';var _=require(_0xea5e('0x0'));var util=require(_0xea5e('0x1'));var logger=require(_0xea5e('0x2'))('api');var moment=require(_0xea5e('0x3'));var BPromise=require(_0xea5e('0x4'));var rp=require(_0xea5e('0x5'));var fs=require('fs');var path=require(_0xea5e('0x6'));var rimraf=require(_0xea5e('0x7'));var config=require(_0xea5e('0x8'));var attributes=require(_0xea5e('0x9'));module['exports']=function(_0x5e043c,_0x39d3fc){return _0x5e043c[_0xea5e('0xa')](_0xea5e('0xb'),attributes,{'tableName':_0xea5e('0xc'),'paranoid':![],'indexes':[{'name':_0xea5e('0xd'),'fields':[_0xea5e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4aef=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x4aef,0x1e6));var _0xf4ae=function(_0x597e38,_0x551ac2){_0x597e38=_0x597e38-0x0;var _0x5305d2=_0x4aef[_0x597e38];return _0x5305d2;};'use strict';var _=require('lodash');var util=require(_0xf4ae('0x0'));var logger=require(_0xf4ae('0x1'))(_0xf4ae('0x2'));var moment=require('moment');var BPromise=require(_0xf4ae('0x3'));var rp=require(_0xf4ae('0x4'));var fs=require('fs');var path=require(_0xf4ae('0x5'));var rimraf=require('rimraf');var config=require(_0xf4ae('0x6'));var attributes=require(_0xf4ae('0x7'));module[_0xf4ae('0x8')]=function(_0x212968,_0x38faee){return _0x212968[_0xf4ae('0x9')](_0xf4ae('0xa'),attributes,{'tableName':_0xf4ae('0xb'),'paranoid':![],'indexes':[{'name':_0xf4ae('0xc'),'fields':[_0xf4ae('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 0f4cbe3..7218faf 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 _0xc9d4=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x283c87,_0x545688){var _0xde4143=function(_0x187b8d){while(--_0x187b8d){_0x283c87['push'](_0x283c87['shift']());}};_0xde4143(++_0x545688);}(_0xc9d4,0x1c9));var _0x4c9d=function(_0x136e04,_0xe65b6b){_0x136e04=_0x136e04-0x0;var _0x52bfe2=_0xc9d4[_0x136e04];return _0x52bfe2;};'use strict';var _=require(_0x4c9d('0x0'));var util=require(_0x4c9d('0x1'));var moment=require(_0x4c9d('0x2'));var BPromise=require(_0x4c9d('0x3'));var rs=require(_0x4c9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c9d('0x5'))['db'];var utils=require(_0x4c9d('0x6'));var logger=require(_0x4c9d('0x7'))(_0x4c9d('0x8'));var config=require(_0x4c9d('0x9'));var jayson=require(_0x4c9d('0xa'));var client=jayson[_0x4c9d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10e13e,_0xbcfcc0,_0x409f83){return new BPromise(function(_0x3af4dc,_0x5284f7){return client[_0x4c9d('0xc')](_0x10e13e,_0x409f83)[_0x4c9d('0xd')](function(_0x2a64d1){logger['info'](_0x4c9d('0xe'),_0xbcfcc0,_0x4c9d('0xf'));logger[_0x4c9d('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0xbcfcc0,'request\x20sent',JSON[_0x4c9d('0x11')](_0x2a64d1));if(_0x2a64d1[_0x4c9d('0x12')]){if(_0x2a64d1[_0x4c9d('0x12')]['code']===0x1f4){logger[_0x4c9d('0x12')](_0x4c9d('0xe'),_0xbcfcc0,_0x2a64d1[_0x4c9d('0x12')][_0x4c9d('0x13')]);return _0x5284f7(_0x2a64d1[_0x4c9d('0x12')][_0x4c9d('0x13')]);}logger[_0x4c9d('0x12')](_0x4c9d('0xe'),_0xbcfcc0,_0x2a64d1['error'][_0x4c9d('0x13')]);return _0x3af4dc(_0x2a64d1[_0x4c9d('0x12')][_0x4c9d('0x13')]);}else{logger[_0x4c9d('0x14')](_0x4c9d('0xe'),_0xbcfcc0,_0x4c9d('0xf'));_0x3af4dc(_0x2a64d1[_0x4c9d('0x15')]['message']);}})[_0x4c9d('0x16')](function(_0x305bd2){logger[_0x4c9d('0x12')](_0x4c9d('0xe'),_0xbcfcc0,_0x305bd2);_0x5284f7(_0x305bd2);});});} \ No newline at end of file +var _0x865d=['SmsTransferReport,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x41b10b,_0x39e294){var _0x314242=function(_0xe0f3bc){while(--_0xe0f3bc){_0x41b10b['push'](_0x41b10b['shift']());}};_0x314242(++_0x39e294);}(_0x865d,0x157));var _0xd865=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x865d[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xd865('0x0'));var util=require('util');var moment=require(_0xd865('0x1'));var BPromise=require(_0xd865('0x2'));var rs=require(_0xd865('0x3'));var fs=require('fs');var Redis=require(_0xd865('0x4'));var db=require(_0xd865('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd865('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd865('0x7'));var client=jayson[_0xd865('0x8')][_0xd865('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30d06e,_0xdd8a15,_0x8ded2d){return new BPromise(function(_0x5292b7,_0x16a6fd){return client[_0xd865('0xa')](_0x30d06e,_0x8ded2d)[_0xd865('0xb')](function(_0x5c0419){logger[_0xd865('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0xdd8a15,_0xd865('0xd'));logger['debug'](_0xd865('0xe'),_0xdd8a15,_0xd865('0xd'),JSON['stringify'](_0x5c0419));if(_0x5c0419['error']){if(_0x5c0419[_0xd865('0xf')][_0xd865('0x10')]===0x1f4){logger[_0xd865('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0xdd8a15,_0x5c0419[_0xd865('0xf')][_0xd865('0x11')]);return _0x16a6fd(_0x5c0419[_0xd865('0xf')][_0xd865('0x11')]);}logger[_0xd865('0xf')](_0xd865('0x12'),_0xdd8a15,_0x5c0419[_0xd865('0xf')][_0xd865('0x11')]);return _0x5292b7(_0x5c0419[_0xd865('0xf')][_0xd865('0x11')]);}else{logger['info'](_0xd865('0x12'),_0xdd8a15,_0xd865('0xd'));_0x5292b7(_0x5c0419['result'][_0xd865('0x11')]);}})['catch'](function(_0x3f22e1){logger[_0xd865('0xf')](_0xd865('0x12'),_0xdd8a15,_0x3f22e1);_0x16a6fd(_0x3f22e1);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3235cd7..9707fc1 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 _0x5bb8=['download','diskStorage','root','originalname','replace','format','%s-%s%s','extname','now','create','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bb8,0x15d));var _0x85bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5bb8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x85bb('0x0'));var util=require('util');var path=require(_0x85bb('0x1'));var timeout=require(_0x85bb('0x2'));var express=require('express');var router=express[_0x85bb('0x3')]();var auth=require(_0x85bb('0x4'));var interaction=require(_0x85bb('0x5'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x85bb('0x6')]('/',auth[_0x85bb('0x7')](),controller[_0x85bb('0x8')]);router[_0x85bb('0x6')](_0x85bb('0x9'),auth[_0x85bb('0x7')](),controller[_0x85bb('0xa')]);router[_0x85bb('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x85bb('0xb')]);var upload=multer({'storage':multer[_0x85bb('0xc')]({'destination':function(_0x354973,_0x3a4f22,_0x463bf7){_0x463bf7(null,path['join'](config[_0x85bb('0xd')],'server/files/sounds/original/'));},'filename':function(_0x56bfdd,_0x78b0e5,_0x50537a){_0x78b0e5[_0x85bb('0xe')]=_0x78b0e5['originalname'][_0x85bb('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x50537a(null,util[_0x85bb('0x10')](_0x85bb('0x11'),path['basename'](_0x78b0e5[_0x85bb('0xe')],path[_0x85bb('0x12')](_0x78b0e5[_0x85bb('0xe')])),Date[_0x85bb('0x13')](),path[_0x85bb('0x12')](_0x78b0e5[_0x85bb('0xe')])));}})});router['post']('/',upload['single']('file'),controller[_0x85bb('0x14')]);router['put'](_0x85bb('0x9'),auth[_0x85bb('0x7')](),controller[_0x85bb('0x15')]);router[_0x85bb('0x16')](_0x85bb('0x9'),auth[_0x85bb('0x7')](),controller['delete']);module[_0x85bb('0x17')]=router; \ No newline at end of file +var _0xc2f2=['basename','now','extname','post','file','put','update','delete','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2f2,0x134));var _0x2c2f=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xc2f2[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x2c2f('0x0'));var util=require(_0x2c2f('0x1'));var path=require(_0x2c2f('0x2'));var timeout=require(_0x2c2f('0x3'));var express=require('express');var router=express[_0x2c2f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2c2f('0x5'));var config=require(_0x2c2f('0x6'));var controller=require(_0x2c2f('0x7'));router['get']('/',auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x9')]);router[_0x2c2f('0xa')](_0x2c2f('0xb'),auth[_0x2c2f('0x8')](),controller[_0x2c2f('0xc')]);router['get'](_0x2c2f('0xd'),auth['isAuthenticated'](),controller[_0x2c2f('0xe')]);var upload=multer({'storage':multer[_0x2c2f('0xf')]({'destination':function(_0x284052,_0x2ac2cb,_0xb67485){_0xb67485(null,path['join'](config[_0x2c2f('0x10')],_0x2c2f('0x11')));},'filename':function(_0x3bbb1e,_0xd5fd1a,_0x2f730b){_0xd5fd1a[_0x2c2f('0x12')]=_0xd5fd1a[_0x2c2f('0x12')][_0x2c2f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2f730b(null,util[_0x2c2f('0x14')](_0x2c2f('0x15'),path[_0x2c2f('0x16')](_0xd5fd1a['originalname'],path['extname'](_0xd5fd1a[_0x2c2f('0x12')])),Date[_0x2c2f('0x17')](),path[_0x2c2f('0x18')](_0xd5fd1a[_0x2c2f('0x12')])));}})});router[_0x2c2f('0x19')]('/',upload['single'](_0x2c2f('0x1a')),controller['create']);router[_0x2c2f('0x1b')](_0x2c2f('0xb'),auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x1c')]);router['delete'](_0x2c2f('0xb'),auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 3c59efa..1a3bfa3 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 _0x1860=['INTEGER','exports','STRING','FLOAT','BIGINT'];(function(_0x139845,_0x7b8d0e){var _0x549c8f=function(_0x4d7078){while(--_0x4d7078){_0x139845['push'](_0x139845['shift']());}};_0x549c8f(++_0x7b8d0e);}(_0x1860,0xe2));var _0x0186=function(_0x4337f8,_0x36c050){_0x4337f8=_0x4337f8-0x0;var _0x2ec301=_0x1860[_0x4337f8];return _0x2ec301;};'use strict';var Sequelize=require('sequelize');module[_0x0186('0x0')]={'name':{'type':Sequelize[_0x0186('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x0186('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x0186('0x1')]},'original_format':{'type':Sequelize[_0x0186('0x1')]},'original_duration':{'type':Sequelize[_0x0186('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x0186('0x3')]},'original_sampleRate':{'type':Sequelize[_0x0186('0x4')]},'converted_format':{'type':Sequelize[_0x0186('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x0186('0x3')]},'converted_channelCount':{'type':Sequelize[_0x0186('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x0186('0x4')]}}; \ No newline at end of file +var _0x7507=['FLOAT','BIGINT','INTEGER','exports','STRING','name'];(function(_0x2bdf29,_0x40cab0){var _0x60cb83=function(_0x4bc761){while(--_0x4bc761){_0x2bdf29['push'](_0x2bdf29['shift']());}};_0x60cb83(++_0x40cab0);}(_0x7507,0x1d7));var _0x7750=function(_0x138a2e,_0xc7013d){_0x138a2e=_0x138a2e-0x0;var _0xa0452f=_0x7507[_0x138a2e];return _0xa0452f;};'use strict';var Sequelize=require('sequelize');module[_0x7750('0x0')]={'name':{'type':Sequelize[_0x7750('0x1')],'unique':_0x7750('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x7750('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x7750('0x1')]},'original_format':{'type':Sequelize[_0x7750('0x1')]},'original_duration':{'type':Sequelize[_0x7750('0x3')]},'original_sampleCount':{'type':Sequelize[_0x7750('0x4')]},'original_channelCount':{'type':Sequelize[_0x7750('0x5')]},'original_bitRate':{'type':Sequelize[_0x7750('0x4')]},'original_sampleRate':{'type':Sequelize[_0x7750('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x7750('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x7750('0x4')]},'converted_channelCount':{'type':Sequelize[_0x7750('0x5')]},'converted_bitRate':{'type':Sequelize[_0x7750('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x7750('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 67ebe58..afd2d64 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 _0x48b1=['create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','wav','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format'];(function(_0x189d3c,_0x5efebf){var _0x485959=function(_0x1161da){while(--_0x1161da){_0x189d3c['push'](_0x189d3c['shift']());}};_0x485959(++_0x5efebf);}(_0x48b1,0x197));var _0x148b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x48b1[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x148b('0x0'));var jsonpatch=require(_0x148b('0x1'));var rp=require(_0x148b('0x2'));var moment=require(_0x148b('0x3'));var BPromise=require(_0x148b('0x4'));var Mustache=require(_0x148b('0x5'));var util=require(_0x148b('0x6'));var path=require(_0x148b('0x7'));var sox=require(_0x148b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x148b('0x9'));var squel=require(_0x148b('0xa'));var crypto=require(_0x148b('0xb'));var jsforce=require(_0x148b('0xc'));var deskjs=require(_0x148b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x148b('0xe'));var Papa=require('papaparse');var Redis=require(_0x148b('0xf'));var authService=require(_0x148b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x148b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x148b('0x12'));var utils=require(_0x148b('0x13'));var config=require(_0x148b('0x14'));var db=require(_0x148b('0x15'))['db'];function respondWithStatusCode(_0x42b719,_0x4b6ecb){_0x4b6ecb=_0x4b6ecb||0xcc;return function(_0x43c99d){if(_0x43c99d){return _0x42b719[_0x148b('0x16')](_0x4b6ecb);}return _0x42b719[_0x148b('0x17')](_0x4b6ecb)[_0x148b('0x18')]();};}function respondWithResult(_0x2ba0e6,_0x48f12b){_0x48f12b=_0x48f12b||0xc8;return function(_0x3f9a4b){if(_0x3f9a4b){return _0x2ba0e6[_0x148b('0x17')](_0x48f12b)[_0x148b('0x19')](_0x3f9a4b);}};}function respondWithFilteredResult(_0x15b2f1,_0x2ecaf2){return function(_0x16c4b6){if(_0x16c4b6){var _0x2b91d7=_0x16c4b6[_0x148b('0x1a')],_0x3852c9=_0x2ecaf2[_0x148b('0x1b')],_0x230f88=_0x2ecaf2['offset']+_0x2ecaf2[_0x148b('0x1c')],_0x4a33f1;if(_0x230f88>=_0x2b91d7){_0x230f88=_0x2b91d7;_0x4a33f1=0xc8;}else{_0x4a33f1=0xce;}_0x15b2f1['status'](_0x4a33f1);return _0x15b2f1['set']('Content-Range',_0x3852c9+'-'+_0x230f88+'/'+_0x2b91d7)[_0x148b('0x19')](_0x16c4b6);}return null;};}function patchUpdates(_0x2caa90){return function(_0x4b0938){try{jsonpatch[_0x148b('0x1d')](_0x4b0938,_0x2caa90,!![]);}catch(_0x454157){return BPromise['reject'](_0x454157);}return _0x4b0938['save']();};}function saveUpdates(_0x46209a,_0x1781f0){return function(_0x442cdc){if(_0x442cdc){return _0x442cdc[_0x148b('0x1e')](_0x46209a)[_0x148b('0x1f')](function(_0x3b48d2){return _0x3b48d2;});}return null;};}function removeEntity(_0x1fc2f8,_0x264d57){return function(_0x49cd84){if(_0x49cd84){return _0x49cd84[_0x148b('0x20')]()['then'](function(){var _0x269f23=_0x49cd84[_0x148b('0x21')]({'plain':!![]});var _0x4b7f15=_0x148b('0x22');return db[_0x148b('0x23')][_0x148b('0x20')]({'where':{'type':_0x4b7f15,'resourceId':_0x269f23['id']}})[_0x148b('0x1f')](function(){return _0x49cd84;});})[_0x148b('0x1f')](function(){_0x1fc2f8[_0x148b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31cf16,_0x41aca4){return function(_0x26a107){if(!_0x26a107){_0x31cf16[_0x148b('0x16')](0x194);}return _0x26a107;};}function handleError(_0x65b099,_0x164604){_0x164604=_0x164604||0x1f4;return function(_0x350d70){logger[_0x148b('0x24')](_0x350d70[_0x148b('0x25')]);if(_0x350d70[_0x148b('0x26')]){delete _0x350d70['name'];}_0x65b099[_0x148b('0x17')](_0x164604)[_0x148b('0x27')](_0x350d70);};}exports[_0x148b('0x28')]=function(_0x1c8dec,_0x3fef40){var _0x1e9dc9={},_0x499280={},_0x1cb1ca={'count':0x0,'rows':[]};var _0xa5a711=_[_0x148b('0x29')](db[_0x148b('0x2a')][_0x148b('0x2b')],function(_0x3f8ab0){return{'name':_0x3f8ab0[_0x148b('0x2c')],'type':_0x3f8ab0['type'][_0x148b('0x2d')]};});_0x499280[_0x148b('0x2e')]=_['map'](_0xa5a711,_0x148b('0x26'));_0x499280[_0x148b('0x2f')]=_['keys'](_0x1c8dec['query']);_0x499280[_0x148b('0x30')]=_['intersection'](_0x499280[_0x148b('0x2e')],_0x499280['query']);_0x1e9dc9[_0x148b('0x31')]=_[_0x148b('0x32')](_0x499280[_0x148b('0x2e')],qs[_0x148b('0x33')](_0x1c8dec[_0x148b('0x2f')][_0x148b('0x33')]));_0x1e9dc9[_0x148b('0x31')]=_0x1e9dc9[_0x148b('0x31')][_0x148b('0x34')]?_0x1e9dc9[_0x148b('0x31')]:_0x499280['model'];if(!_0x1c8dec[_0x148b('0x2f')][_0x148b('0x35')](_0x148b('0x36'))){_0x1e9dc9[_0x148b('0x1c')]=qs[_0x148b('0x1c')](_0x1c8dec[_0x148b('0x2f')]['limit']);_0x1e9dc9[_0x148b('0x1b')]=qs['offset'](_0x1c8dec[_0x148b('0x2f')][_0x148b('0x1b')]);}_0x1e9dc9['order']=qs[_0x148b('0x37')](_0x1c8dec[_0x148b('0x2f')][_0x148b('0x37')]);_0x1e9dc9[_0x148b('0x38')]=qs[_0x148b('0x30')](_[_0x148b('0x39')](_0x1c8dec[_0x148b('0x2f')],_0x499280[_0x148b('0x30')]),_0xa5a711);if(_0x1c8dec[_0x148b('0x2f')][_0x148b('0x3a')]){_0x1e9dc9[_0x148b('0x38')]=_[_0x148b('0x3b')](_0x1e9dc9[_0x148b('0x38')],{'$or':_[_0x148b('0x29')](_0xa5a711,function(_0x378aec){if(_0x378aec[_0x148b('0x3c')]!==_0x148b('0x3d')){var _0x8b780c={};_0x8b780c[_0x378aec[_0x148b('0x26')]]={'$like':'%'+_0x1c8dec['query'][_0x148b('0x3a')]+'%'};return _0x8b780c;}})});}_0x1e9dc9=_[_0x148b('0x3b')]({},_0x1e9dc9,_0x1c8dec['options']);var _0x59d0fb={'where':_0x1e9dc9[_0x148b('0x38')]};return db[_0x148b('0x2a')]['count'](_0x59d0fb)[_0x148b('0x1f')](function(_0x3c1d53){_0x1cb1ca[_0x148b('0x1a')]=_0x3c1d53;if(_0x1c8dec[_0x148b('0x2f')][_0x148b('0x3e')]){_0x1e9dc9[_0x148b('0x3f')]=[{'all':!![]}];}return db[_0x148b('0x2a')]['findAll'](_0x1e9dc9);})[_0x148b('0x1f')](function(_0x4a2eed){_0x1cb1ca[_0x148b('0x40')]=_0x4a2eed;return _0x1cb1ca;})[_0x148b('0x1f')](respondWithFilteredResult(_0x3fef40,_0x1e9dc9))[_0x148b('0x41')](handleError(_0x3fef40,null));};exports[_0x148b('0x42')]=function(_0x187cc3,_0x52e7c0){var _0x1828f9={'raw':!![],'where':{'id':_0x187cc3[_0x148b('0x43')]['id']}},_0x29e81d={};_0x29e81d[_0x148b('0x2e')]=_[_0x148b('0x44')](db[_0x148b('0x2a')][_0x148b('0x2b')]);_0x29e81d[_0x148b('0x2f')]=_[_0x148b('0x44')](_0x187cc3[_0x148b('0x2f')]);_0x29e81d['filters']=_['intersection'](_0x29e81d['model'],_0x29e81d[_0x148b('0x2f')]);_0x1828f9[_0x148b('0x31')]=_[_0x148b('0x32')](_0x29e81d[_0x148b('0x2e')],qs['fields'](_0x187cc3[_0x148b('0x2f')]['fields']));_0x1828f9[_0x148b('0x31')]=_0x1828f9[_0x148b('0x31')][_0x148b('0x34')]?_0x1828f9['attributes']:_0x29e81d[_0x148b('0x2e')];if(_0x187cc3[_0x148b('0x2f')][_0x148b('0x3e')]){_0x1828f9['include']=[{'all':!![]}];}_0x1828f9=_[_0x148b('0x3b')]({},_0x1828f9,_0x187cc3[_0x148b('0x45')]);return db[_0x148b('0x2a')][_0x148b('0x46')](_0x1828f9)[_0x148b('0x1f')](handleEntityNotFound(_0x52e7c0,null))[_0x148b('0x1f')](respondWithResult(_0x52e7c0,null))['catch'](handleError(_0x52e7c0,null));};exports[_0x148b('0x47')]=function(_0x38a06a,_0x299b85,_0x412205){return db[_0x148b('0x2a')][_0x148b('0x46')]({'where':{'id':_0x38a06a['params']['id']},'attributes':[_0x148b('0x26'),_0x148b('0x48'),_0x148b('0x49')],'raw':!![]})[_0x148b('0x1f')](handleEntityNotFound(_0x299b85,null))[_0x148b('0x1f')](function(_0x15d177){if(_0x15d177){if(!fs[_0x148b('0x4a')](path[_0x148b('0x4b')](config[_0x148b('0x4c')],_0x148b('0x4d'),_0x15d177[_0x148b('0x48')]+'.'+_0x15d177['converted_format']))){throw new db[(_0x148b('0x4e'))]['ValidationError'](_0x148b('0x4f'));}return _0x299b85['download'](path[_0x148b('0x4b')](config[_0x148b('0x4c')],'server/files/sounds/converted',util['format']('%s.%s',_0x15d177['save_name'],_0x15d177[_0x148b('0x49')])),util[_0x148b('0x50')]('%s.%s',_0x15d177[_0x148b('0x26')],_0x15d177[_0x148b('0x49')]));}return null;})[_0x148b('0x41')](handleError(_0x299b85,null));};exports[_0x148b('0x51')]=function(_0xab8f37,_0x34662e,_0x25c101){var _0x229a5d={'name':path[_0x148b('0x52')](_0xab8f37[_0x148b('0x53')][_0x148b('0x54')],path[_0x148b('0x55')](_0xab8f37[_0x148b('0x53')][_0x148b('0x54')])),'save_name':path[_0x148b('0x52')](_0xab8f37[_0x148b('0x53')][_0x148b('0x56')],path[_0x148b('0x55')](_0xab8f37[_0x148b('0x53')][_0x148b('0x56')])),'original_format':path[_0x148b('0x55')](_0xab8f37['file'][_0x148b('0x54')])[_0x148b('0x57')](0x1),'converted_format':'wav'};var _0x3cd204=path[_0x148b('0x4b')](config[_0x148b('0x4c')],_0x148b('0x58'),_0xab8f37['file'][_0x148b('0x56')]);var _0x123abe=path[_0x148b('0x4b')](config[_0x148b('0x4c')],_0x148b('0x4d'),util['format'](_0x148b('0x59'),path[_0x148b('0x52')](_0xab8f37[_0x148b('0x53')][_0x148b('0x56')],path[_0x148b('0x55')](_0xab8f37[_0x148b('0x53')]['filename'])),_0x229a5d['converted_format']));logger[_0x148b('0x5a')](_0x148b('0x5b'),_0x3cd204);logger[_0x148b('0x5a')](_0x148b('0x5c'),_0x123abe);try{fs[_0x148b('0x5d')](_0x3cd204,parseInt('0777',0x8));var _0x2b1b6c=sox['transcode'](_0x3cd204,_0x123abe,{'sampleRate':0x1f40,'format':_0x148b('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2b1b6c['on'](_0x148b('0x24'),function(_0x16dbc4){fs[_0x148b('0x5f')](_0x3cd204);_0x34662e['status'](0x1f4)['send'](_0x16dbc4);});_0x2b1b6c['on'](_0x148b('0x60'),function(_0x5b44cc){_0x229a5d['original_duration']=isNaN(_0x5b44cc['duration'])?null:_0x5b44cc[_0x148b('0x61')]*0x3e8;_0x229a5d[_0x148b('0x62')]=isNaN(_0x5b44cc[_0x148b('0x63')])?null:_0x5b44cc[_0x148b('0x63')];_0x229a5d[_0x148b('0x64')]=isNaN(_0x5b44cc[_0x148b('0x65')])?null:_0x5b44cc[_0x148b('0x65')];_0x229a5d['original_bitRate']=isNaN(_0x5b44cc[_0x148b('0x66')])?null:_0x5b44cc[_0x148b('0x66')];_0x229a5d[_0x148b('0x67')]=isNaN(_0x5b44cc[_0x148b('0x68')])?null:_0x5b44cc['sampleRate'];});_0x2b1b6c['on'](_0x148b('0x69'),function(_0x55a3bf){_0x229a5d[_0x148b('0x6a')]=isNaN(_0x55a3bf['duration'])?null:_0x55a3bf[_0x148b('0x61')]*0x3e8;_0x229a5d[_0x148b('0x6b')]=isNaN(_0x55a3bf[_0x148b('0x63')])?null:_0x55a3bf['sampleCount'];_0x229a5d[_0x148b('0x6c')]=isNaN(_0x55a3bf[_0x148b('0x65')])?null:_0x55a3bf[_0x148b('0x65')];_0x229a5d[_0x148b('0x6d')]=isNaN(_0x55a3bf[_0x148b('0x66')])?null:_0x55a3bf[_0x148b('0x66')];_0x229a5d[_0x148b('0x6e')]=isNaN(_0x55a3bf[_0x148b('0x68')])?null:_0x55a3bf['sampleRate'];});_0x2b1b6c['on'](_0x148b('0x18'),function(){fs[_0x148b('0x5d')](_0x123abe,parseInt(_0x148b('0x6f'),0x8));return db[_0x148b('0x2a')][_0x148b('0x51')](_0x229a5d)[_0x148b('0x1f')](function(_0x382949){var _0x5b3362={'role':_0xab8f37[_0x148b('0x70')][_0x148b('0x71')],'userProfileId':_0xab8f37[_0x148b('0x70')]['userProfileId']};if(!_0x5b3362)throw new Error(_0x148b('0x72'));if(_0x5b3362[_0x148b('0x71')]===_0x148b('0x73')){var _0x49e4d0=_0x382949['get']({'plain':!![]});return db[_0x148b('0x74')]['find']({'where':{'name':_0x148b('0x22'),'userProfileId':_0x5b3362['userProfileId']},'raw':!![]})[_0x148b('0x1f')](function(_0x4eecc0){if(_0x4eecc0&&_0x4eecc0['autoAssociation']===0x0){return db[_0x148b('0x23')]['create']({'name':_0x49e4d0['name'],'resourceId':_0x49e4d0['id'],'type':_0x4eecc0['name'],'sectionId':_0x4eecc0['id']},{})[_0x148b('0x1f')](function(){return _0x382949;});}else{return _0x382949;}})[_0x148b('0x41')](function(_0x12fc4e){logger['error'](_0x148b('0x75'),_0x12fc4e);throw _0x12fc4e;});}return _0x382949;})[_0x148b('0x1f')](respondWithResult(_0x34662e,null))[_0x148b('0x41')](handleError(_0x34662e,null));});_0x2b1b6c[_0x148b('0x76')]();}catch(_0x397558){_0x34662e[_0x148b('0x17')](0x1f4)['send'](_0x397558);}};exports[_0x148b('0x1e')]=function(_0x6929a9,_0x178404,_0x2ae014){return db['Sound'][_0x148b('0x46')]({'where':{'id':_0x6929a9['params']['id']}})[_0x148b('0x1f')](handleEntityNotFound(_0x178404,null))[_0x148b('0x1f')](saveUpdates(_[_0x148b('0x39')](_0x6929a9['body'],['name',_0x148b('0x77')]),null))['then'](respondWithResult(_0x178404,null))[_0x148b('0x41')](handleError(_0x178404,null));};exports[_0x148b('0x78')]=function(_0x30a3aa,_0x1c49d6,_0xab9f5){return db[_0x148b('0x2a')][_0x148b('0x46')]({'where':{'id':_0x30a3aa['params']['id']}})['then'](function(_0x57bc34){if(_0x57bc34){return _0x57bc34['destroy']();}})[_0x148b('0x1f')](function(_0x8be212){var _0x287725=path[_0x148b('0x4b')](config[_0x148b('0x4c')],_0x148b('0x58'),util['format']('%s.%s',_0x8be212[_0x148b('0x48')],_0x8be212[_0x148b('0x79')]));var _0x3987f8=path[_0x148b('0x4b')](config[_0x148b('0x4c')],_0x148b('0x4d'),util[_0x148b('0x50')](_0x148b('0x59'),_0x8be212[_0x148b('0x48')],_0x8be212['converted_format']));fs[_0x148b('0x5f')](_0x287725);fs['unlinkSync'](_0x3987f8);return _0x8be212;})[_0x148b('0x1f')](function(_0x5c682a){if(_0x5c682a){return _0x1c49d6[_0x148b('0x17')](0xcc)['end']();}})[_0x148b('0x1f')](handleEntityNotFound(_0x1c49d6,null))[_0x148b('0x41')](handleError(_0x1c49d6,null));}; \ No newline at end of file +var _0x9200=['VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','options','find','download','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','file','extname','originalname','basename','filename','substring','wav','server/files/sounds/original','converted_format','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_channelCount','converted_bitRate','converted_sampleRate','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','description','delete','original_format','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','json','reject','save','update','destroy','then','get','Sounds','UserProfileResource','error','name','send','index','map','Sound','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x321c24,_0x5e939a){var _0x1754b8=function(_0xd95c80){while(--_0xd95c80){_0x321c24['push'](_0x321c24['shift']());}};_0x1754b8(++_0x5e939a);}(_0x9200,0xbc));var _0x0920=function(_0x4d36bf,_0xa9bc82){_0x4d36bf=_0x4d36bf-0x0;var _0x5507d8=_0x9200[_0x4d36bf];return _0x5507d8;};'use strict';var pdf=require(_0x0920('0x0'));var emlformat=require(_0x0920('0x1'));var rimraf=require(_0x0920('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0920('0x3'));var rp=require('request-promise');var moment=require(_0x0920('0x4'));var BPromise=require(_0x0920('0x5'));var Mustache=require(_0x0920('0x6'));var util=require(_0x0920('0x7'));var path=require(_0x0920('0x8'));var sox=require('sox');var csv=require(_0x0920('0x9'));var ejs=require(_0x0920('0xa'));var fs=require('fs');var _=require(_0x0920('0xb'));var squel=require('squel');var crypto=require(_0x0920('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0920('0xd'));var toCsv=require(_0x0920('0x9'));var querystring=require(_0x0920('0xe'));var Papa=require(_0x0920('0xf'));var Redis=require('ioredis');var authService=require(_0x0920('0x10'));var qs=require(_0x0920('0x11'));var as=require(_0x0920('0x12'));var hardwareService=require(_0x0920('0x13'));var logger=require(_0x0920('0x14'))(_0x0920('0x15'));var utils=require(_0x0920('0x16'));var config=require(_0x0920('0x17'));var db=require(_0x0920('0x18'))['db'];function respondWithStatusCode(_0x171925,_0x21e245){_0x21e245=_0x21e245||0xcc;return function(_0x528d74){if(_0x528d74){return _0x171925[_0x0920('0x19')](_0x21e245);}return _0x171925[_0x0920('0x1a')](_0x21e245)[_0x0920('0x1b')]();};}function respondWithResult(_0x352d1d,_0x39e1dc){_0x39e1dc=_0x39e1dc||0xc8;return function(_0x1dea7f){if(_0x1dea7f){return _0x352d1d[_0x0920('0x1a')](_0x39e1dc)['json'](_0x1dea7f);}};}function respondWithFilteredResult(_0x106cf5,_0x11431d){return function(_0x43b761){if(_0x43b761){var _0x144beb=_0x43b761['count'],_0x1c32b8=_0x11431d[_0x0920('0x1c')],_0x7a5a9d=_0x11431d['offset']+_0x11431d[_0x0920('0x1d')],_0x25ec32;if(_0x7a5a9d>=_0x144beb){_0x7a5a9d=_0x144beb;_0x25ec32=0xc8;}else{_0x25ec32=0xce;}_0x106cf5['status'](_0x25ec32);return _0x106cf5[_0x0920('0x1e')]('Content-Range',_0x1c32b8+'-'+_0x7a5a9d+'/'+_0x144beb)[_0x0920('0x1f')](_0x43b761);}return null;};}function patchUpdates(_0x697c83){return function(_0x153723){try{jsonpatch['apply'](_0x153723,_0x697c83,!![]);}catch(_0xa09af){return BPromise[_0x0920('0x20')](_0xa09af);}return _0x153723[_0x0920('0x21')]();};}function saveUpdates(_0x391e9d,_0xa047b2){return function(_0xb2860a){if(_0xb2860a){return _0xb2860a[_0x0920('0x22')](_0x391e9d)['then'](function(_0x3d716d){return _0x3d716d;});}return null;};}function removeEntity(_0x51d44d,_0x1d2655){return function(_0x5ce6c2){if(_0x5ce6c2){return _0x5ce6c2[_0x0920('0x23')]()[_0x0920('0x24')](function(){var _0x578764=_0x5ce6c2[_0x0920('0x25')]({'plain':!![]});var _0x2a61f3=_0x0920('0x26');return db[_0x0920('0x27')]['destroy']({'where':{'type':_0x2a61f3,'resourceId':_0x578764['id']}})[_0x0920('0x24')](function(){return _0x5ce6c2;});})['then'](function(){_0x51d44d[_0x0920('0x1a')](0xcc)[_0x0920('0x1b')]();});}};}function handleEntityNotFound(_0x5f12c8,_0x3e6d1f){return function(_0x37f2d2){if(!_0x37f2d2){_0x5f12c8[_0x0920('0x19')](0x194);}return _0x37f2d2;};}function handleError(_0x36b7d2,_0x2b6b9c){_0x2b6b9c=_0x2b6b9c||0x1f4;return function(_0x149a46){logger[_0x0920('0x28')](_0x149a46['stack']);if(_0x149a46[_0x0920('0x29')]){delete _0x149a46['name'];}_0x36b7d2[_0x0920('0x1a')](_0x2b6b9c)[_0x0920('0x2a')](_0x149a46);};}exports[_0x0920('0x2b')]=function(_0x36b1ff,_0x8fc001){var _0xbb70ad={},_0x178348={},_0x4ceb79={'count':0x0,'rows':[]};var _0x59acf0=_[_0x0920('0x2c')](db[_0x0920('0x2d')]['rawAttributes'],function(_0x32bb6d){return{'name':_0x32bb6d['fieldName'],'type':_0x32bb6d[_0x0920('0x2e')]['key']};});_0x178348[_0x0920('0x2f')]=_[_0x0920('0x2c')](_0x59acf0,_0x0920('0x29'));_0x178348[_0x0920('0x30')]=_['keys'](_0x36b1ff[_0x0920('0x30')]);_0x178348[_0x0920('0x31')]=_[_0x0920('0x32')](_0x178348['model'],_0x178348[_0x0920('0x30')]);_0xbb70ad[_0x0920('0x33')]=_['intersection'](_0x178348[_0x0920('0x2f')],qs[_0x0920('0x34')](_0x36b1ff[_0x0920('0x30')][_0x0920('0x34')]));_0xbb70ad[_0x0920('0x33')]=_0xbb70ad[_0x0920('0x33')][_0x0920('0x35')]?_0xbb70ad[_0x0920('0x33')]:_0x178348[_0x0920('0x2f')];if(!_0x36b1ff[_0x0920('0x30')]['hasOwnProperty'](_0x0920('0x36'))){_0xbb70ad[_0x0920('0x1d')]=qs[_0x0920('0x1d')](_0x36b1ff[_0x0920('0x30')][_0x0920('0x1d')]);_0xbb70ad[_0x0920('0x1c')]=qs[_0x0920('0x1c')](_0x36b1ff[_0x0920('0x30')][_0x0920('0x1c')]);}_0xbb70ad[_0x0920('0x37')]=qs['sort'](_0x36b1ff[_0x0920('0x30')][_0x0920('0x38')]);_0xbb70ad[_0x0920('0x39')]=qs[_0x0920('0x31')](_[_0x0920('0x3a')](_0x36b1ff[_0x0920('0x30')],_0x178348['filters']),_0x59acf0);if(_0x36b1ff['query'][_0x0920('0x3b')]){_0xbb70ad[_0x0920('0x39')]=_['merge'](_0xbb70ad[_0x0920('0x39')],{'$or':_['map'](_0x59acf0,function(_0x86a952){if(_0x86a952[_0x0920('0x2e')]!==_0x0920('0x3c')){var _0x52bda3={};_0x52bda3[_0x86a952[_0x0920('0x29')]]={'$like':'%'+_0x36b1ff[_0x0920('0x30')][_0x0920('0x3b')]+'%'};return _0x52bda3;}})});}_0xbb70ad=_[_0x0920('0x3d')]({},_0xbb70ad,_0x36b1ff['options']);var _0x130e48={'where':_0xbb70ad[_0x0920('0x39')]};return db[_0x0920('0x2d')][_0x0920('0x3e')](_0x130e48)[_0x0920('0x24')](function(_0x173c40){_0x4ceb79[_0x0920('0x3e')]=_0x173c40;if(_0x36b1ff[_0x0920('0x30')][_0x0920('0x3f')]){_0xbb70ad[_0x0920('0x40')]=[{'all':!![]}];}return db['Sound'][_0x0920('0x41')](_0xbb70ad);})['then'](function(_0x22ef6a){_0x4ceb79[_0x0920('0x42')]=_0x22ef6a;return _0x4ceb79;})[_0x0920('0x24')](respondWithFilteredResult(_0x8fc001,_0xbb70ad))[_0x0920('0x43')](handleError(_0x8fc001,null));};exports[_0x0920('0x44')]=function(_0x391aae,_0x302df4){var _0x51e37a={'raw':!![],'where':{'id':_0x391aae[_0x0920('0x45')]['id']}},_0x423607={};_0x423607[_0x0920('0x2f')]=_[_0x0920('0x46')](db[_0x0920('0x2d')]['rawAttributes']);_0x423607[_0x0920('0x30')]=_['keys'](_0x391aae['query']);_0x423607[_0x0920('0x31')]=_['intersection'](_0x423607[_0x0920('0x2f')],_0x423607[_0x0920('0x30')]);_0x51e37a[_0x0920('0x33')]=_[_0x0920('0x32')](_0x423607[_0x0920('0x2f')],qs[_0x0920('0x34')](_0x391aae['query']['fields']));_0x51e37a[_0x0920('0x33')]=_0x51e37a['attributes']['length']?_0x51e37a[_0x0920('0x33')]:_0x423607[_0x0920('0x2f')];if(_0x391aae['query']['includeAll']){_0x51e37a[_0x0920('0x40')]=[{'all':!![]}];}_0x51e37a=_[_0x0920('0x3d')]({},_0x51e37a,_0x391aae[_0x0920('0x47')]);return db[_0x0920('0x2d')][_0x0920('0x48')](_0x51e37a)[_0x0920('0x24')](handleEntityNotFound(_0x302df4,null))[_0x0920('0x24')](respondWithResult(_0x302df4,null))[_0x0920('0x43')](handleError(_0x302df4,null));};exports[_0x0920('0x49')]=function(_0xcc72f0,_0x2d98f1,_0x3e8bed){return db['Sound']['find']({'where':{'id':_0xcc72f0[_0x0920('0x45')]['id']},'attributes':[_0x0920('0x29'),'save_name','converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x2d98f1,null))[_0x0920('0x24')](function(_0x449ace){if(_0x449ace){if(!fs[_0x0920('0x4a')](path[_0x0920('0x4b')](config[_0x0920('0x4c')],_0x0920('0x4d'),_0x449ace[_0x0920('0x4e')]+'.'+_0x449ace['converted_format']))){throw new db[(_0x0920('0x4f'))][(_0x0920('0x50'))](_0x0920('0x51'));}return _0x2d98f1[_0x0920('0x49')](path[_0x0920('0x4b')](config[_0x0920('0x4c')],_0x0920('0x4d'),util[_0x0920('0x52')](_0x0920('0x53'),_0x449ace[_0x0920('0x4e')],_0x449ace['converted_format'])),util[_0x0920('0x52')](_0x0920('0x53'),_0x449ace[_0x0920('0x29')],_0x449ace['converted_format']));}return null;})['catch'](handleError(_0x2d98f1,null));};exports['create']=function(_0x573755,_0x73cac2,_0x571412){var _0x2e68a1={'name':path['basename'](_0x573755[_0x0920('0x54')]['originalname'],path[_0x0920('0x55')](_0x573755['file'][_0x0920('0x56')])),'save_name':path[_0x0920('0x57')](_0x573755[_0x0920('0x54')][_0x0920('0x58')],path[_0x0920('0x55')](_0x573755['file']['filename'])),'original_format':path[_0x0920('0x55')](_0x573755[_0x0920('0x54')][_0x0920('0x56')])[_0x0920('0x59')](0x1),'converted_format':_0x0920('0x5a')};var _0x14c3d7=path[_0x0920('0x4b')](config[_0x0920('0x4c')],_0x0920('0x5b'),_0x573755[_0x0920('0x54')]['filename']);var _0x5902d6=path[_0x0920('0x4b')](config[_0x0920('0x4c')],_0x0920('0x4d'),util['format'](_0x0920('0x53'),path[_0x0920('0x57')](_0x573755[_0x0920('0x54')]['filename'],path[_0x0920('0x55')](_0x573755[_0x0920('0x54')][_0x0920('0x58')])),_0x2e68a1[_0x0920('0x5c')]));logger['info'](_0x0920('0x5d'),_0x14c3d7);logger['info'](_0x0920('0x5e'),_0x5902d6);try{fs[_0x0920('0x5f')](_0x14c3d7,parseInt(_0x0920('0x60'),0x8));var _0xa6887a=sox['transcode'](_0x14c3d7,_0x5902d6,{'sampleRate':0x1f40,'format':_0x0920('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xa6887a['on'](_0x0920('0x28'),function(_0x54d020){fs[_0x0920('0x61')](_0x14c3d7);_0x73cac2[_0x0920('0x1a')](0x1f4)[_0x0920('0x2a')](_0x54d020);});_0xa6887a['on'](_0x0920('0x62'),function(_0x58c3e0){_0x2e68a1['original_duration']=isNaN(_0x58c3e0['duration'])?null:_0x58c3e0['duration']*0x3e8;_0x2e68a1[_0x0920('0x63')]=isNaN(_0x58c3e0[_0x0920('0x64')])?null:_0x58c3e0[_0x0920('0x64')];_0x2e68a1[_0x0920('0x65')]=isNaN(_0x58c3e0[_0x0920('0x66')])?null:_0x58c3e0[_0x0920('0x66')];_0x2e68a1['original_bitRate']=isNaN(_0x58c3e0['bitRate'])?null:_0x58c3e0[_0x0920('0x67')];_0x2e68a1[_0x0920('0x68')]=isNaN(_0x58c3e0[_0x0920('0x69')])?null:_0x58c3e0['sampleRate'];});_0xa6887a['on'](_0x0920('0x6a'),function(_0x6ee24a){_0x2e68a1[_0x0920('0x6b')]=isNaN(_0x6ee24a[_0x0920('0x6c')])?null:_0x6ee24a[_0x0920('0x6c')]*0x3e8;_0x2e68a1['converted_sampleCount']=isNaN(_0x6ee24a['sampleCount'])?null:_0x6ee24a['sampleCount'];_0x2e68a1[_0x0920('0x6d')]=isNaN(_0x6ee24a[_0x0920('0x66')])?null:_0x6ee24a[_0x0920('0x66')];_0x2e68a1[_0x0920('0x6e')]=isNaN(_0x6ee24a[_0x0920('0x67')])?null:_0x6ee24a[_0x0920('0x67')];_0x2e68a1[_0x0920('0x6f')]=isNaN(_0x6ee24a[_0x0920('0x69')])?null:_0x6ee24a[_0x0920('0x69')];});_0xa6887a['on'](_0x0920('0x1b'),function(){fs['chmodSync'](_0x5902d6,parseInt(_0x0920('0x60'),0x8));return db[_0x0920('0x2d')]['create'](_0x2e68a1)[_0x0920('0x24')](function(_0x598a42){var _0x3c750f={'role':_0x573755['body'][_0x0920('0x70')],'userProfileId':_0x573755['body']['userProfileId']};if(!_0x3c750f)throw new Error(_0x0920('0x71'));if(_0x3c750f[_0x0920('0x70')]===_0x0920('0x72')){var _0x3a100d=_0x598a42['get']({'plain':!![]});return db[_0x0920('0x73')]['find']({'where':{'name':_0x0920('0x26'),'userProfileId':_0x3c750f[_0x0920('0x74')]},'raw':!![]})['then'](function(_0x76c2a9){if(_0x76c2a9&&_0x76c2a9[_0x0920('0x75')]===0x0){return db['UserProfileResource'][_0x0920('0x76')]({'name':_0x3a100d[_0x0920('0x29')],'resourceId':_0x3a100d['id'],'type':_0x76c2a9[_0x0920('0x29')],'sectionId':_0x76c2a9['id']},{})[_0x0920('0x24')](function(){return _0x598a42;});}else{return _0x598a42;}})[_0x0920('0x43')](function(_0xdef5c5){logger['error'](_0x0920('0x77'),_0xdef5c5);throw _0xdef5c5;});}return _0x598a42;})['then'](respondWithResult(_0x73cac2,null))[_0x0920('0x43')](handleError(_0x73cac2,null));});_0xa6887a['start']();}catch(_0x788847){_0x73cac2['status'](0x1f4)[_0x0920('0x2a')](_0x788847);}};exports[_0x0920('0x22')]=function(_0x5f0219,_0x1561d0,_0x34d880){return db['Sound'][_0x0920('0x48')]({'where':{'id':_0x5f0219['params']['id']}})[_0x0920('0x24')](handleEntityNotFound(_0x1561d0,null))['then'](saveUpdates(_[_0x0920('0x3a')](_0x5f0219[_0x0920('0x78')],['name',_0x0920('0x79')]),null))[_0x0920('0x24')](respondWithResult(_0x1561d0,null))[_0x0920('0x43')](handleError(_0x1561d0,null));};exports[_0x0920('0x7a')]=function(_0x59201e,_0x14de97,_0x412935){return db[_0x0920('0x2d')][_0x0920('0x48')]({'where':{'id':_0x59201e[_0x0920('0x45')]['id']}})[_0x0920('0x24')](function(_0x2d6e5f){if(_0x2d6e5f){return _0x2d6e5f['destroy']();}})[_0x0920('0x24')](function(_0x58208c){var _0x545d49=path[_0x0920('0x4b')](config[_0x0920('0x4c')],_0x0920('0x5b'),util['format'](_0x0920('0x53'),_0x58208c['save_name'],_0x58208c[_0x0920('0x7b')]));var _0xe846f2=path[_0x0920('0x4b')](config[_0x0920('0x4c')],_0x0920('0x4d'),util['format'](_0x0920('0x53'),_0x58208c['save_name'],_0x58208c[_0x0920('0x5c')]));fs[_0x0920('0x61')](_0x545d49);fs['unlinkSync'](_0xe846f2);return _0x58208c;})[_0x0920('0x24')](function(_0x54609c){if(_0x54609c){return _0x14de97[_0x0920('0x1a')](0xcc)[_0x0920('0x1b')]();}})[_0x0920('0x24')](handleEntityNotFound(_0x14de97,null))['catch'](handleError(_0x14de97,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index b2178ff..9c50fd0 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 _0xdb40=['request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','tools_sounds','lodash','../../config/logger','api','moment'];(function(_0x52dbe7,_0x7bd74a){var _0x1166d=function(_0x1ea3c7){while(--_0x1ea3c7){_0x52dbe7['push'](_0x52dbe7['shift']());}};_0x1166d(++_0x7bd74a);}(_0xdb40,0xee));var _0x0db4=function(_0x404afb,_0x6e2ab2){_0x404afb=_0x404afb-0x0;var _0x19b697=_0xdb40[_0x404afb];return _0x19b697;};'use strict';var _=require(_0x0db4('0x0'));var util=require('util');var logger=require(_0x0db4('0x1'))(_0x0db4('0x2'));var moment=require(_0x0db4('0x3'));var BPromise=require('bluebird');var rp=require(_0x0db4('0x4'));var fs=require('fs');var path=require(_0x0db4('0x5'));var rimraf=require(_0x0db4('0x6'));var config=require(_0x0db4('0x7'));var attributes=require(_0x0db4('0x8'));module[_0x0db4('0x9')]=function(_0x26c250,_0x315108){return _0x26c250['define']('Sound',attributes,{'tableName':_0x0db4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e5a=['tools_sounds','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./sound.attributes','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x6e5a,0x7a));var _0xa6e5=function(_0x46b79a,_0x52f896){_0x46b79a=_0x46b79a-0x0;var _0x54c14b=_0x6e5a[_0x46b79a];return _0x54c14b;};'use strict';var _=require(_0xa6e5('0x0'));var util=require(_0xa6e5('0x1'));var logger=require('../../config/logger')(_0xa6e5('0x2'));var moment=require(_0xa6e5('0x3'));var BPromise=require(_0xa6e5('0x4'));var rp=require(_0xa6e5('0x5'));var fs=require('fs');var path=require(_0xa6e5('0x6'));var rimraf=require(_0xa6e5('0x7'));var config=require('../../config/environment');var attributes=require(_0xa6e5('0x8'));module[_0xa6e5('0x9')]=function(_0x1818e7,_0x3e6f3a){return _0x1818e7['define']('Sound',attributes,{'tableName':_0xa6e5('0xa'),'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 4927de4..bea8390 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 _0xdd23=['http','request','then','debug','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','info','result','ShowSound','find','options','where','include','map','model','attributes','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x59e333,_0x49d09c){var _0x3465c0=function(_0x53d722){while(--_0x53d722){_0x59e333['push'](_0x59e333['shift']());}};_0x3465c0(++_0x49d09c);}(_0xdd23,0x95));var _0x3dd2=function(_0x56e0b6,_0x3fdb97){_0x56e0b6=_0x56e0b6-0x0;var _0x42e9c5=_0xdd23[_0x56e0b6];return _0x42e9c5;};'use strict';var _=require(_0x3dd2('0x0'));var util=require('util');var moment=require(_0x3dd2('0x1'));var BPromise=require(_0x3dd2('0x2'));var rs=require(_0x3dd2('0x3'));var fs=require('fs');var Redis=require(_0x3dd2('0x4'));var db=require(_0x3dd2('0x5'))['db'];var utils=require(_0x3dd2('0x6'));var logger=require('../../config/logger')(_0x3dd2('0x7'));var config=require(_0x3dd2('0x8'));var jayson=require(_0x3dd2('0x9'));var client=jayson[_0x3dd2('0xa')][_0x3dd2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4733a0,_0x15c4f8,_0x110888){return new BPromise(function(_0x51a596,_0x4b04a1){return client[_0x3dd2('0xc')](_0x4733a0,_0x110888)[_0x3dd2('0xd')](function(_0xef1df2){logger['info']('Sound,\x20%s,\x20%s',_0x15c4f8,'request\x20sent');logger[_0x3dd2('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x15c4f8,_0x3dd2('0xf'),JSON[_0x3dd2('0x10')](_0xef1df2));if(_0xef1df2[_0x3dd2('0x11')]){if(_0xef1df2[_0x3dd2('0x11')][_0x3dd2('0x12')]===0x1f4){logger['error'](_0x3dd2('0x13'),_0x15c4f8,_0xef1df2[_0x3dd2('0x11')][_0x3dd2('0x14')]);return _0x4b04a1(_0xef1df2['error'][_0x3dd2('0x14')]);}logger[_0x3dd2('0x11')](_0x3dd2('0x13'),_0x15c4f8,_0xef1df2[_0x3dd2('0x11')][_0x3dd2('0x14')]);return _0x51a596(_0xef1df2[_0x3dd2('0x11')][_0x3dd2('0x14')]);}else{logger[_0x3dd2('0x15')]('Sound,\x20%s,\x20%s',_0x15c4f8,_0x3dd2('0xf'));_0x51a596(_0xef1df2[_0x3dd2('0x16')][_0x3dd2('0x14')]);}})['catch'](function(_0x31b709){logger[_0x3dd2('0x11')]('Sound,\x20%s,\x20%s',_0x15c4f8,_0x31b709);_0x4b04a1(_0x31b709);});});}exports[_0x3dd2('0x17')]=function(_0x18f518){var _0x354495=this;return new Promise(function(_0x2345a7,_0x20d432){return db['Sound'][_0x3dd2('0x18')]({'raw':_0x18f518['options']?_0x18f518['options']['raw']===undefined?!![]:![]:!![],'where':_0x18f518[_0x3dd2('0x19')]?_0x18f518[_0x3dd2('0x19')][_0x3dd2('0x1a')]||null:null,'attributes':_0x18f518[_0x3dd2('0x19')]?_0x18f518[_0x3dd2('0x19')]['attributes']||null:null,'include':_0x18f518[_0x3dd2('0x19')]?_0x18f518[_0x3dd2('0x19')][_0x3dd2('0x1b')]?_[_0x3dd2('0x1c')](_0x18f518[_0x3dd2('0x19')][_0x3dd2('0x1b')],function(_0x418703){return{'model':db[_0x418703[_0x3dd2('0x1d')]],'as':_0x418703['as'],'attributes':_0x418703['attributes'],'include':_0x418703['include']?_[_0x3dd2('0x1c')](_0x418703[_0x3dd2('0x1b')],function(_0x28098d){return{'model':db[_0x28098d['model']],'as':_0x28098d['as'],'attributes':_0x28098d[_0x3dd2('0x1e')],'include':_0x28098d[_0x3dd2('0x1b')]?_[_0x3dd2('0x1c')](_0x28098d['include'],function(_0x7089b4){return{'model':db[_0x7089b4[_0x3dd2('0x1d')]],'as':_0x7089b4['as'],'attributes':_0x7089b4[_0x3dd2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3dd2('0xd')](function(_0x10a78f){logger['info'](_0x3dd2('0x17'),_0x18f518);logger[_0x3dd2('0xe')](_0x3dd2('0x17'),_0x18f518,JSON[_0x3dd2('0x10')](_0x10a78f));_0x2345a7(_0x10a78f);})[_0x3dd2('0x1f')](function(_0x5a253f){logger[_0x3dd2('0x11')](_0x3dd2('0x17'),_0x5a253f[_0x3dd2('0x14')],_0x18f518);_0x20d432(_0x354495['error'](0x1f4,_0x5a253f['message']));});});}; \ No newline at end of file +var _0xc1c1=['Sound','options','raw','where','map','include','attributes','debug','stringify','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','error','message','catch','ShowSound'];(function(_0x115f4e,_0x85c81){var _0x36e666=function(_0x4c42ca){while(--_0x4c42ca){_0x115f4e['push'](_0x115f4e['shift']());}};_0x36e666(++_0x85c81);}(_0xc1c1,0x19e));var _0x1c1c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc1c1[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1c1c('0x0'));var rs=require(_0x1c1c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1c1c('0x2'));var logger=require(_0x1c1c('0x3'))(_0x1c1c('0x4'));var config=require(_0x1c1c('0x5'));var jayson=require(_0x1c1c('0x6'));var client=jayson[_0x1c1c('0x7')][_0x1c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40d035,_0x24937d,_0x1b6218){return new BPromise(function(_0x2e80db,_0x244730){return client[_0x1c1c('0x9')](_0x40d035,_0x1b6218)[_0x1c1c('0xa')](function(_0x6b05fd){logger[_0x1c1c('0xb')](_0x1c1c('0xc'),_0x24937d,'request\x20sent');logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x24937d,_0x1c1c('0xd'),JSON['stringify'](_0x6b05fd));if(_0x6b05fd[_0x1c1c('0xe')]){if(_0x6b05fd[_0x1c1c('0xe')]['code']===0x1f4){logger[_0x1c1c('0xe')](_0x1c1c('0xc'),_0x24937d,_0x6b05fd['error'][_0x1c1c('0xf')]);return _0x244730(_0x6b05fd[_0x1c1c('0xe')]['message']);}logger[_0x1c1c('0xe')]('Sound,\x20%s,\x20%s',_0x24937d,_0x6b05fd[_0x1c1c('0xe')][_0x1c1c('0xf')]);return _0x2e80db(_0x6b05fd[_0x1c1c('0xe')][_0x1c1c('0xf')]);}else{logger[_0x1c1c('0xb')](_0x1c1c('0xc'),_0x24937d,_0x1c1c('0xd'));_0x2e80db(_0x6b05fd['result'][_0x1c1c('0xf')]);}})[_0x1c1c('0x10')](function(_0x165b8a){logger[_0x1c1c('0xe')](_0x1c1c('0xc'),_0x24937d,_0x165b8a);_0x244730(_0x165b8a);});});}exports[_0x1c1c('0x11')]=function(_0x4e30c4){var _0x5c917e=this;return new Promise(function(_0x268e3e,_0x28bbc0){return db[_0x1c1c('0x12')]['find']({'raw':_0x4e30c4['options']?_0x4e30c4[_0x1c1c('0x13')][_0x1c1c('0x14')]===undefined?!![]:![]:!![],'where':_0x4e30c4['options']?_0x4e30c4[_0x1c1c('0x13')][_0x1c1c('0x15')]||null:null,'attributes':_0x4e30c4[_0x1c1c('0x13')]?_0x4e30c4[_0x1c1c('0x13')]['attributes']||null:null,'include':_0x4e30c4[_0x1c1c('0x13')]?_0x4e30c4[_0x1c1c('0x13')]['include']?_[_0x1c1c('0x16')](_0x4e30c4[_0x1c1c('0x13')][_0x1c1c('0x17')],function(_0x54679c){return{'model':db[_0x54679c['model']],'as':_0x54679c['as'],'attributes':_0x54679c['attributes'],'include':_0x54679c['include']?_[_0x1c1c('0x16')](_0x54679c[_0x1c1c('0x17')],function(_0x5c0a3b){return{'model':db[_0x5c0a3b['model']],'as':_0x5c0a3b['as'],'attributes':_0x5c0a3b[_0x1c1c('0x18')],'include':_0x5c0a3b[_0x1c1c('0x17')]?_[_0x1c1c('0x16')](_0x5c0a3b[_0x1c1c('0x17')],function(_0x1e6217){return{'model':db[_0x1e6217['model']],'as':_0x1e6217['as'],'attributes':_0x1e6217['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c1c('0xa')](function(_0x2afa03){logger[_0x1c1c('0xb')](_0x1c1c('0x11'),_0x4e30c4);logger[_0x1c1c('0x19')](_0x1c1c('0x11'),_0x4e30c4,JSON[_0x1c1c('0x1a')](_0x2afa03));_0x268e3e(_0x2afa03);})[_0x1c1c('0x10')](function(_0x4c25c3){logger[_0x1c1c('0xe')](_0x1c1c('0x11'),_0x4c25c3['message'],_0x4e30c4);_0x28bbc0(_0x5c917e[_0x1c1c('0xe')](0x1f4,_0x4c25c3[_0x1c1c('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 25e278a..a92fa97 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 _0x30cc=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','create','put','delete','destroy','exports'];(function(_0x39a826,_0x48f7b3){var _0x56fa63=function(_0x4cae40){while(--_0x4cae40){_0x39a826['push'](_0x39a826['shift']());}};_0x56fa63(++_0x48f7b3);}(_0x30cc,0xd1));var _0xc30c=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x30cc[_0x5b740b];return _0x6f8f4e;};'use strict';var multer=require(_0xc30c('0x0'));var util=require(_0xc30c('0x1'));var path=require(_0xc30c('0x2'));var timeout=require(_0xc30c('0x3'));var express=require(_0xc30c('0x4'));var router=express[_0xc30c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc30c('0x6'));var config=require(_0xc30c('0x7'));var controller=require(_0xc30c('0x8'));router['get']('/',auth[_0xc30c('0x9')](),controller[_0xc30c('0xa')]);router[_0xc30c('0xb')](_0xc30c('0xc'),auth[_0xc30c('0x9')](),controller[_0xc30c('0xd')]);router['post']('/',auth[_0xc30c('0x9')](),controller[_0xc30c('0xe')]);router[_0xc30c('0xf')](_0xc30c('0xc'),auth[_0xc30c('0x9')](),controller['update']);router[_0xc30c('0x10')]('/:id',auth[_0xc30c('0x9')](),controller[_0xc30c('0x11')]);module[_0xc30c('0x12')]=router; \ No newline at end of file +var _0xbe09=['put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0xbe09,0xcb));var _0x9be0=function(_0xd747d9,_0x53e805){_0xd747d9=_0xd747d9-0x0;var _0x3fc4b0=_0xbe09[_0xd747d9];return _0x3fc4b0;};'use strict';var multer=require(_0x9be0('0x0'));var util=require(_0x9be0('0x1'));var path=require(_0x9be0('0x2'));var timeout=require('connect-timeout');var express=require(_0x9be0('0x3'));var router=express[_0x9be0('0x4')]();var auth=require(_0x9be0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9be0('0x6'));router[_0x9be0('0x7')]('/',auth[_0x9be0('0x8')](),controller[_0x9be0('0x9')]);router['get'](_0x9be0('0xa'),auth[_0x9be0('0x8')](),controller['show']);router[_0x9be0('0xb')]('/',auth['isAuthenticated'](),controller[_0x9be0('0xc')]);router[_0x9be0('0xd')](_0x9be0('0xa'),auth[_0x9be0('0x8')](),controller[_0x9be0('0xe')]);router[_0x9be0('0xf')](_0x9be0('0xa'),auth[_0x9be0('0x8')](),controller[_0x9be0('0x10')]);module[_0x9be0('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 19df63e..4801015 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 _0xaca2=['ENUM','STRING'];(function(_0x3cb529,_0x3c3657){var _0x436c3c=function(_0x20e43b){while(--_0x20e43b){_0x3cb529['push'](_0x3cb529['shift']());}};_0x436c3c(++_0x3c3657);}(_0xaca2,0x1a3));var _0x2aca=function(_0x49b984,_0x387c83){_0x49b984=_0x49b984-0x0;var _0x49d1e0=_0xaca2[_0x49b984];return _0x49d1e0;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x2aca('0x0')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x2aca('0x1')]('in','out'),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file +var _0xcb06=['medium','ENUM','out','sequelize','exports','STRING'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0xcb06,0x1c5));var _0x6cb0=function(_0x140357,_0x6670bd){_0x140357=_0x140357-0x0;var _0x4fdf00=_0xcb06[_0x140357];return _0x4fdf00;};'use strict';var Sequelize=require(_0x6cb0('0x0'));module[_0x6cb0('0x1')]={'uniqueid':{'type':Sequelize[_0x6cb0('0x2')]},'body':{'type':Sequelize['TEXT'](_0x6cb0('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6cb0('0x4')]('in',_0x6cb0('0x5')),'defaultValue':_0x6cb0('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index afd592d..ae0b385 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 _0xaba0=['set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','SquareMessage','findAll','rows','catch','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x9e61e3,_0x4fc7f4){var _0x468493=function(_0x4d864b){while(--_0x4d864b){_0x9e61e3['push'](_0x9e61e3['shift']());}};_0x468493(++_0x4fc7f4);}(_0xaba0,0x1c8));var _0x0aba=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaba0[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0aba('0x0'));var rimraf=require(_0x0aba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0aba('0x2'));var rp=require(_0x0aba('0x3'));var moment=require(_0x0aba('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0aba('0x5'));var path=require(_0x0aba('0x6'));var sox=require(_0x0aba('0x7'));var csv=require(_0x0aba('0x8'));var ejs=require(_0x0aba('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0aba('0xa'));var jsforce=require(_0x0aba('0xb'));var deskjs=require(_0x0aba('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0aba('0xd'));var Papa=require(_0x0aba('0xe'));var Redis=require(_0x0aba('0xf'));var authService=require(_0x0aba('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0aba('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0aba('0x12'));var utils=require('../../config/utils');var config=require(_0x0aba('0x13'));var db=require(_0x0aba('0x14'))['db'];function respondWithStatusCode(_0x35b8e5,_0x32736f){_0x32736f=_0x32736f||0xcc;return function(_0x9ca293){if(_0x9ca293){return _0x35b8e5[_0x0aba('0x15')](_0x32736f);}return _0x35b8e5[_0x0aba('0x16')](_0x32736f)[_0x0aba('0x17')]();};}function respondWithResult(_0x68600e,_0x3b0698){_0x3b0698=_0x3b0698||0xc8;return function(_0x35d21e){if(_0x35d21e){return _0x68600e[_0x0aba('0x16')](_0x3b0698)[_0x0aba('0x18')](_0x35d21e);}};}function respondWithFilteredResult(_0x54ec85,_0x188d00){return function(_0x314dc6){if(_0x314dc6){var _0x4b3d1d=_0x314dc6['count'],_0x570d01=_0x188d00[_0x0aba('0x19')],_0x33e06e=_0x188d00[_0x0aba('0x19')]+_0x188d00[_0x0aba('0x1a')],_0x46a17b;if(_0x33e06e>=_0x4b3d1d){_0x33e06e=_0x4b3d1d;_0x46a17b=0xc8;}else{_0x46a17b=0xce;}_0x54ec85[_0x0aba('0x16')](_0x46a17b);return _0x54ec85[_0x0aba('0x1b')](_0x0aba('0x1c'),_0x570d01+'-'+_0x33e06e+'/'+_0x4b3d1d)[_0x0aba('0x18')](_0x314dc6);}return null;};}function patchUpdates(_0x5893d1){return function(_0xed7946){try{jsonpatch['apply'](_0xed7946,_0x5893d1,!![]);}catch(_0xfeaa10){return BPromise[_0x0aba('0x1d')](_0xfeaa10);}return _0xed7946[_0x0aba('0x1e')]();};}function saveUpdates(_0xbd6202,_0x45a545){return function(_0x10856b){if(_0x10856b){return _0x10856b[_0x0aba('0x1f')](_0xbd6202)[_0x0aba('0x20')](function(_0x36d70c){return _0x36d70c;});}return null;};}function removeEntity(_0x1aa266,_0x412c1b){return function(_0x38a4d6){if(_0x38a4d6){return _0x38a4d6['destroy']()[_0x0aba('0x20')](function(){_0x1aa266['status'](0xcc)[_0x0aba('0x17')]();});}};}function handleEntityNotFound(_0x176897,_0x43d7ce){return function(_0x3de3a6){if(!_0x3de3a6){_0x176897[_0x0aba('0x15')](0x194);}return _0x3de3a6;};}function handleError(_0xade436,_0xd0e91d){_0xd0e91d=_0xd0e91d||0x1f4;return function(_0x406619){logger[_0x0aba('0x21')](_0x406619[_0x0aba('0x22')]);if(_0x406619[_0x0aba('0x23')]){delete _0x406619[_0x0aba('0x23')];}_0xade436[_0x0aba('0x16')](_0xd0e91d)[_0x0aba('0x24')](_0x406619);};}exports[_0x0aba('0x25')]=function(_0x4fec3b,_0x4de2a7){var _0x2324e5={},_0xb34cc3={},_0x262d68={'count':0x0,'rows':[]};var _0x283c30=_[_0x0aba('0x26')](db['SquareMessage'][_0x0aba('0x27')],function(_0x55e45a){return{'name':_0x55e45a[_0x0aba('0x28')],'type':_0x55e45a[_0x0aba('0x29')][_0x0aba('0x2a')]};});_0xb34cc3[_0x0aba('0x2b')]=_[_0x0aba('0x26')](_0x283c30,_0x0aba('0x23'));_0xb34cc3['query']=_[_0x0aba('0x2c')](_0x4fec3b[_0x0aba('0x2d')]);_0xb34cc3['filters']=_[_0x0aba('0x2e')](_0xb34cc3[_0x0aba('0x2b')],_0xb34cc3[_0x0aba('0x2d')]);_0x2324e5[_0x0aba('0x2f')]=_[_0x0aba('0x2e')](_0xb34cc3[_0x0aba('0x2b')],qs[_0x0aba('0x30')](_0x4fec3b['query'][_0x0aba('0x30')]));_0x2324e5['attributes']=_0x2324e5[_0x0aba('0x2f')][_0x0aba('0x31')]?_0x2324e5[_0x0aba('0x2f')]:_0xb34cc3[_0x0aba('0x2b')];if(!_0x4fec3b[_0x0aba('0x2d')][_0x0aba('0x32')]('nolimit')){_0x2324e5[_0x0aba('0x1a')]=qs['limit'](_0x4fec3b[_0x0aba('0x2d')]['limit']);_0x2324e5[_0x0aba('0x19')]=qs['offset'](_0x4fec3b[_0x0aba('0x2d')][_0x0aba('0x19')]);}_0x2324e5['order']=qs[_0x0aba('0x33')](_0x4fec3b[_0x0aba('0x2d')][_0x0aba('0x33')]);_0x2324e5[_0x0aba('0x34')]=qs['filters'](_[_0x0aba('0x35')](_0x4fec3b[_0x0aba('0x2d')],_0xb34cc3['filters']),_0x283c30);if(_0x4fec3b[_0x0aba('0x2d')][_0x0aba('0x36')]){_0x2324e5[_0x0aba('0x34')]=_['merge'](_0x2324e5[_0x0aba('0x34')],{'$or':_[_0x0aba('0x26')](_0x283c30,function(_0x1b1a16){if(_0x1b1a16[_0x0aba('0x29')]!==_0x0aba('0x37')){var _0x4d2996={};_0x4d2996[_0x1b1a16[_0x0aba('0x23')]]={'$like':'%'+_0x4fec3b[_0x0aba('0x2d')][_0x0aba('0x36')]+'%'};return _0x4d2996;}})});}_0x2324e5=_[_0x0aba('0x38')]({},_0x2324e5,_0x4fec3b[_0x0aba('0x39')]);var _0xb9374={'where':_0x2324e5[_0x0aba('0x34')]};return db['SquareMessage'][_0x0aba('0x3a')](_0xb9374)['then'](function(_0x181d93){_0x262d68[_0x0aba('0x3a')]=_0x181d93;if(_0x4fec3b[_0x0aba('0x2d')][_0x0aba('0x3b')]){_0x2324e5[_0x0aba('0x3c')]=[{'all':!![]}];}return db[_0x0aba('0x3d')][_0x0aba('0x3e')](_0x2324e5);})[_0x0aba('0x20')](function(_0x4d610c){_0x262d68[_0x0aba('0x3f')]=_0x4d610c;return _0x262d68;})[_0x0aba('0x20')](respondWithFilteredResult(_0x4de2a7,_0x2324e5))[_0x0aba('0x40')](handleError(_0x4de2a7,null));};exports['show']=function(_0x4570e4,_0x3c8ec4){var _0x428a1e={'raw':!![],'where':{'id':_0x4570e4[_0x0aba('0x41')]['id']}},_0x252d41={};_0x252d41['model']=_[_0x0aba('0x2c')](db[_0x0aba('0x3d')]['rawAttributes']);_0x252d41[_0x0aba('0x2d')]=_['keys'](_0x4570e4['query']);_0x252d41['filters']=_['intersection'](_0x252d41['model'],_0x252d41['query']);_0x428a1e[_0x0aba('0x2f')]=_[_0x0aba('0x2e')](_0x252d41[_0x0aba('0x2b')],qs[_0x0aba('0x30')](_0x4570e4[_0x0aba('0x2d')]['fields']));_0x428a1e[_0x0aba('0x2f')]=_0x428a1e[_0x0aba('0x2f')][_0x0aba('0x31')]?_0x428a1e[_0x0aba('0x2f')]:_0x252d41['model'];if(_0x4570e4[_0x0aba('0x2d')]['includeAll']){_0x428a1e[_0x0aba('0x3c')]=[{'all':!![]}];}_0x428a1e=_[_0x0aba('0x38')]({},_0x428a1e,_0x4570e4[_0x0aba('0x39')]);return db[_0x0aba('0x3d')][_0x0aba('0x42')](_0x428a1e)['then'](handleEntityNotFound(_0x3c8ec4,null))['then'](respondWithResult(_0x3c8ec4,null))[_0x0aba('0x40')](handleError(_0x3c8ec4,null));};exports[_0x0aba('0x43')]=function(_0x1f9614,_0x2b97d0){return db[_0x0aba('0x3d')]['create'](_0x1f9614['body'],{})[_0x0aba('0x20')](respondWithResult(_0x2b97d0,0xc9))['catch'](handleError(_0x2b97d0,null));};exports[_0x0aba('0x1f')]=function(_0x4e0778,_0x5600da){if(_0x4e0778['body']['id']){delete _0x4e0778[_0x0aba('0x44')]['id'];}return db[_0x0aba('0x3d')][_0x0aba('0x42')]({'where':{'id':_0x4e0778[_0x0aba('0x41')]['id']}})['then'](handleEntityNotFound(_0x5600da,null))[_0x0aba('0x20')](saveUpdates(_0x4e0778['body'],null))['then'](respondWithResult(_0x5600da,null))[_0x0aba('0x40')](handleError(_0x5600da,null));};exports['destroy']=function(_0x40cd21,_0x6fe954){return db['SquareMessage'][_0x0aba('0x42')]({'where':{'id':_0x40cd21[_0x0aba('0x41')]['id']}})['then'](handleEntityNotFound(_0x6fe954,null))['then'](removeEntity(_0x6fe954,null))['catch'](handleError(_0x6fe954,null));}; \ No newline at end of file +var _0x0cd0=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','Content-Range','apply','reject','update','then','error','name','send','index','map','fieldName','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','filter','options','SquareMessage','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0x3bceea,_0x58af75){var _0x30a8d3=function(_0x1550b5){while(--_0x1550b5){_0x3bceea['push'](_0x3bceea['shift']());}};_0x30a8d3(++_0x58af75);}(_0x0cd0,0x19a));var _0x00cd=function(_0x12d549,_0x215a80){_0x12d549=_0x12d549-0x0;var _0x4d0fee=_0x0cd0[_0x12d549];return _0x4d0fee;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x00cd('0x0'));var rimraf=require(_0x00cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00cd('0x2'));var rp=require(_0x00cd('0x3'));var moment=require(_0x00cd('0x4'));var BPromise=require(_0x00cd('0x5'));var Mustache=require(_0x00cd('0x6'));var util=require(_0x00cd('0x7'));var path=require(_0x00cd('0x8'));var sox=require(_0x00cd('0x9'));var csv=require('to-csv');var ejs=require(_0x00cd('0xa'));var fs=require('fs');var _=require(_0x00cd('0xb'));var squel=require(_0x00cd('0xc'));var crypto=require('crypto');var jsforce=require(_0x00cd('0xd'));var deskjs=require(_0x00cd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x00cd('0xf'));var Papa=require(_0x00cd('0x10'));var Redis=require(_0x00cd('0x11'));var authService=require(_0x00cd('0x12'));var qs=require(_0x00cd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00cd('0x14'));var logger=require(_0x00cd('0x15'))(_0x00cd('0x16'));var utils=require(_0x00cd('0x17'));var config=require(_0x00cd('0x18'));var db=require(_0x00cd('0x19'))['db'];function respondWithStatusCode(_0x11e6a4,_0x21310e){_0x21310e=_0x21310e||0xcc;return function(_0x59f07d){if(_0x59f07d){return _0x11e6a4['sendStatus'](_0x21310e);}return _0x11e6a4['status'](_0x21310e)[_0x00cd('0x1a')]();};}function respondWithResult(_0x559a64,_0x53a0a9){_0x53a0a9=_0x53a0a9||0xc8;return function(_0x2ef4f8){if(_0x2ef4f8){return _0x559a64[_0x00cd('0x1b')](_0x53a0a9)[_0x00cd('0x1c')](_0x2ef4f8);}};}function respondWithFilteredResult(_0x26da68,_0x5108df){return function(_0x394068){if(_0x394068){var _0x11ca3f=_0x394068[_0x00cd('0x1d')],_0x5bfe05=_0x5108df[_0x00cd('0x1e')],_0x212c82=_0x5108df[_0x00cd('0x1e')]+_0x5108df['limit'],_0x9b434d;if(_0x212c82>=_0x11ca3f){_0x212c82=_0x11ca3f;_0x9b434d=0xc8;}else{_0x9b434d=0xce;}_0x26da68[_0x00cd('0x1b')](_0x9b434d);return _0x26da68['set'](_0x00cd('0x1f'),_0x5bfe05+'-'+_0x212c82+'/'+_0x11ca3f)[_0x00cd('0x1c')](_0x394068);}return null;};}function patchUpdates(_0x467e1f){return function(_0x26f7d6){try{jsonpatch[_0x00cd('0x20')](_0x26f7d6,_0x467e1f,!![]);}catch(_0x3636a3){return BPromise[_0x00cd('0x21')](_0x3636a3);}return _0x26f7d6['save']();};}function saveUpdates(_0x3d2d4c,_0x6e904b){return function(_0x2a2c03){if(_0x2a2c03){return _0x2a2c03[_0x00cd('0x22')](_0x3d2d4c)['then'](function(_0x52a10b){return _0x52a10b;});}return null;};}function removeEntity(_0x2fdf11,_0x405212){return function(_0x4c96fb){if(_0x4c96fb){return _0x4c96fb['destroy']()[_0x00cd('0x23')](function(){_0x2fdf11[_0x00cd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f0f85,_0x5d0810){return function(_0x24f7b7){if(!_0x24f7b7){_0x1f0f85['sendStatus'](0x194);}return _0x24f7b7;};}function handleError(_0x3d5f73,_0x4bcb9d){_0x4bcb9d=_0x4bcb9d||0x1f4;return function(_0xb2f790){logger[_0x00cd('0x24')](_0xb2f790['stack']);if(_0xb2f790['name']){delete _0xb2f790[_0x00cd('0x25')];}_0x3d5f73[_0x00cd('0x1b')](_0x4bcb9d)[_0x00cd('0x26')](_0xb2f790);};}exports[_0x00cd('0x27')]=function(_0x69e7fa,_0x7d8011){var _0x47ff7e={},_0x2d3a60={},_0xc4afc8={'count':0x0,'rows':[]};var _0x29b5ca=_[_0x00cd('0x28')](db['SquareMessage']['rawAttributes'],function(_0x3b2e64){return{'name':_0x3b2e64[_0x00cd('0x29')],'type':_0x3b2e64['type'][_0x00cd('0x2a')]};});_0x2d3a60['model']=_[_0x00cd('0x28')](_0x29b5ca,_0x00cd('0x25'));_0x2d3a60[_0x00cd('0x2b')]=_[_0x00cd('0x2c')](_0x69e7fa[_0x00cd('0x2b')]);_0x2d3a60[_0x00cd('0x2d')]=_[_0x00cd('0x2e')](_0x2d3a60['model'],_0x2d3a60[_0x00cd('0x2b')]);_0x47ff7e[_0x00cd('0x2f')]=_['intersection'](_0x2d3a60[_0x00cd('0x30')],qs['fields'](_0x69e7fa[_0x00cd('0x2b')][_0x00cd('0x31')]));_0x47ff7e['attributes']=_0x47ff7e[_0x00cd('0x2f')]['length']?_0x47ff7e['attributes']:_0x2d3a60['model'];if(!_0x69e7fa[_0x00cd('0x2b')][_0x00cd('0x32')]('nolimit')){_0x47ff7e[_0x00cd('0x33')]=qs[_0x00cd('0x33')](_0x69e7fa[_0x00cd('0x2b')][_0x00cd('0x33')]);_0x47ff7e[_0x00cd('0x1e')]=qs['offset'](_0x69e7fa[_0x00cd('0x2b')][_0x00cd('0x1e')]);}_0x47ff7e['order']=qs[_0x00cd('0x34')](_0x69e7fa[_0x00cd('0x2b')][_0x00cd('0x34')]);_0x47ff7e[_0x00cd('0x35')]=qs['filters'](_[_0x00cd('0x36')](_0x69e7fa[_0x00cd('0x2b')],_0x2d3a60[_0x00cd('0x2d')]),_0x29b5ca);if(_0x69e7fa['query']['filter']){_0x47ff7e[_0x00cd('0x35')]=_[_0x00cd('0x37')](_0x47ff7e[_0x00cd('0x35')],{'$or':_[_0x00cd('0x28')](_0x29b5ca,function(_0x340811){if(_0x340811['type']!==_0x00cd('0x38')){var _0x32c2b5={};_0x32c2b5[_0x340811[_0x00cd('0x25')]]={'$like':'%'+_0x69e7fa[_0x00cd('0x2b')][_0x00cd('0x39')]+'%'};return _0x32c2b5;}})});}_0x47ff7e=_['merge']({},_0x47ff7e,_0x69e7fa[_0x00cd('0x3a')]);var _0x35001f={'where':_0x47ff7e[_0x00cd('0x35')]};return db[_0x00cd('0x3b')]['count'](_0x35001f)['then'](function(_0x3adf34){_0xc4afc8[_0x00cd('0x1d')]=_0x3adf34;if(_0x69e7fa['query'][_0x00cd('0x3c')]){_0x47ff7e[_0x00cd('0x3d')]=[{'all':!![]}];}return db[_0x00cd('0x3b')][_0x00cd('0x3e')](_0x47ff7e);})[_0x00cd('0x23')](function(_0x24c692){_0xc4afc8[_0x00cd('0x3f')]=_0x24c692;return _0xc4afc8;})[_0x00cd('0x23')](respondWithFilteredResult(_0x7d8011,_0x47ff7e))[_0x00cd('0x40')](handleError(_0x7d8011,null));};exports[_0x00cd('0x41')]=function(_0x13034e,_0x7fa72){var _0x2fdb9d={'raw':!![],'where':{'id':_0x13034e[_0x00cd('0x42')]['id']}},_0x1b8168={};_0x1b8168['model']=_[_0x00cd('0x2c')](db['SquareMessage']['rawAttributes']);_0x1b8168[_0x00cd('0x2b')]=_[_0x00cd('0x2c')](_0x13034e['query']);_0x1b8168[_0x00cd('0x2d')]=_[_0x00cd('0x2e')](_0x1b8168[_0x00cd('0x30')],_0x1b8168['query']);_0x2fdb9d[_0x00cd('0x2f')]=_[_0x00cd('0x2e')](_0x1b8168['model'],qs[_0x00cd('0x31')](_0x13034e[_0x00cd('0x2b')]['fields']));_0x2fdb9d[_0x00cd('0x2f')]=_0x2fdb9d[_0x00cd('0x2f')][_0x00cd('0x43')]?_0x2fdb9d[_0x00cd('0x2f')]:_0x1b8168[_0x00cd('0x30')];if(_0x13034e[_0x00cd('0x2b')][_0x00cd('0x3c')]){_0x2fdb9d[_0x00cd('0x3d')]=[{'all':!![]}];}_0x2fdb9d=_['merge']({},_0x2fdb9d,_0x13034e[_0x00cd('0x3a')]);return db[_0x00cd('0x3b')][_0x00cd('0x44')](_0x2fdb9d)[_0x00cd('0x23')](handleEntityNotFound(_0x7fa72,null))[_0x00cd('0x23')](respondWithResult(_0x7fa72,null))[_0x00cd('0x40')](handleError(_0x7fa72,null));};exports[_0x00cd('0x45')]=function(_0x18aff4,_0x1c0308){return db[_0x00cd('0x3b')][_0x00cd('0x45')](_0x18aff4[_0x00cd('0x46')],{})[_0x00cd('0x23')](respondWithResult(_0x1c0308,0xc9))[_0x00cd('0x40')](handleError(_0x1c0308,null));};exports[_0x00cd('0x22')]=function(_0x50687c,_0x283773){if(_0x50687c[_0x00cd('0x46')]['id']){delete _0x50687c[_0x00cd('0x46')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x50687c['params']['id']}})[_0x00cd('0x23')](handleEntityNotFound(_0x283773,null))[_0x00cd('0x23')](saveUpdates(_0x50687c[_0x00cd('0x46')],null))[_0x00cd('0x23')](respondWithResult(_0x283773,null))[_0x00cd('0x40')](handleError(_0x283773,null));};exports['destroy']=function(_0x47ebc0,_0x204092){return db[_0x00cd('0x3b')][_0x00cd('0x44')]({'where':{'id':_0x47ebc0[_0x00cd('0x42')]['id']}})[_0x00cd('0x23')](handleEntityNotFound(_0x204092,null))['then'](removeEntity(_0x204092,null))['catch'](handleError(_0x204092,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index a5b12a8..9c4bdca 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 _0xc6ac=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util','../../config/logger'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5268ad,_0x57dc01){_0x5268ad=_0x5268ad-0x0;var _0x1f2be4=_0xc6ac[_0x5268ad];return _0x1f2be4;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','SquareMessage','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x14b8ab,_0x382dc0){var _0x34b6e1=function(_0x495de3){while(--_0x495de3){_0x14b8ab['push'](_0x14b8ab['shift']());}};_0x34b6e1(++_0x382dc0);}(_0x814b,0x1a2));var _0xb814=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0x814b[_0x360739];return _0x3e23a1;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),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 b42bbf2..9c6773e 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 _0x9fe7=['SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x9fe7,0x1df));var _0x79fe=function(_0x16b683,_0x1de3db){_0x16b683=_0x16b683-0x0;var _0x25c35c=_0x9fe7[_0x16b683];return _0x25c35c;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var moment=require('moment');var BPromise=require(_0x79fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79fe('0x3'));var db=require(_0x79fe('0x4'))['db'];var utils=require(_0x79fe('0x5'));var logger=require('../../config/logger')(_0x79fe('0x6'));var config=require(_0x79fe('0x7'));var jayson=require(_0x79fe('0x8'));var client=jayson['client'][_0x79fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a5aef,_0x2ba246,_0x4c8314){return new BPromise(function(_0x24faa0,_0x264323){return client[_0x79fe('0xa')](_0x2a5aef,_0x4c8314)[_0x79fe('0xb')](function(_0xafc7cd){logger['info'](_0x79fe('0xc'),_0x2ba246,_0x79fe('0xd'));logger['debug'](_0x79fe('0xe'),_0x2ba246,_0x79fe('0xd'),JSON[_0x79fe('0xf')](_0xafc7cd));if(_0xafc7cd[_0x79fe('0x10')]){if(_0xafc7cd['error'][_0x79fe('0x11')]===0x1f4){logger[_0x79fe('0x10')](_0x79fe('0xc'),_0x2ba246,_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x264323(_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);}logger[_0x79fe('0x10')]('SquareMessage,\x20%s,\x20%s',_0x2ba246,_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x24faa0(_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);}else{logger[_0x79fe('0x13')](_0x79fe('0xc'),_0x2ba246,'request\x20sent');_0x24faa0(_0xafc7cd[_0x79fe('0x14')][_0x79fe('0x12')]);}})[_0x79fe('0x15')](function(_0x5f0af3){logger['error'](_0x79fe('0xc'),_0x2ba246,_0x5f0af3);_0x264323(_0x5f0af3);});});}exports[_0x79fe('0x16')]=function(_0x39be95){var _0x40a549=this;return new Promise(function(_0x536641,_0x5e2f0b){return db[_0x79fe('0x17')][_0x79fe('0x18')](_0x39be95[_0x79fe('0x19')],{'raw':_0x39be95['options']?_0x39be95[_0x79fe('0x1a')][_0x79fe('0x1b')]===undefined?!![]:![]:!![]})[_0x79fe('0xb')](function(_0x4c7062){logger[_0x79fe('0x13')]('CreateSquareMessage',_0x39be95);logger[_0x79fe('0x1c')](_0x79fe('0x16'),_0x39be95,JSON[_0x79fe('0xf')](_0x4c7062));_0x536641(_0x4c7062);})[_0x79fe('0x15')](function(_0x1ac8d7){logger[_0x79fe('0x10')]('CreateSquareMessage',_0x1ac8d7['message'],_0x39be95);_0x5e2f0b(_0x40a549[_0x79fe('0x10')](0x1f4,_0x1ac8d7['message']));});});}; \ No newline at end of file +var _0x46ed=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','create','body','options','raw','CreateSquareMessage','catch','lodash','util','bluebird','randomstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x46ed,0x168));var _0xd46e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x46ed[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){return client[_0xd46e('0xb')](_0x45e680,_0x437ea0)[_0xd46e('0xc')](function(_0x59c88d){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,'request\x20sent');logger[_0xd46e('0xf')](_0xd46e('0x10'),_0x855f24,_0xd46e('0x11'),JSON[_0xd46e('0x12')](_0x59c88d));if(_0x59c88d[_0xd46e('0x13')]){if(_0x59c88d[_0xd46e('0x13')]['code']===0x1f4){logger[_0xd46e('0x13')]('SquareMessage,\x20%s,\x20%s',_0x855f24,_0x59c88d['error'][_0xd46e('0x14')]);return _0x31259b(_0x59c88d[_0xd46e('0x13')]['message']);}logger['error'](_0xd46e('0xe'),_0x855f24,_0x59c88d[_0xd46e('0x13')][_0xd46e('0x14')]);return _0x144687(_0x59c88d[_0xd46e('0x13')]['message']);}else{logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,_0xd46e('0x11'));_0x144687(_0x59c88d[_0xd46e('0x15')][_0xd46e('0x14')]);}})['catch'](function(_0x1d50a5){logger[_0xd46e('0x13')](_0xd46e('0xe'),_0x855f24,_0x1d50a5);_0x31259b(_0x1d50a5);});});}exports['CreateSquareMessage']=function(_0x5ddd04){var _0x2e8f6d=this;return new Promise(function(_0x1bd574,_0x488690){return db['SquareMessage'][_0xd46e('0x16')](_0x5ddd04[_0xd46e('0x17')],{'raw':_0x5ddd04[_0xd46e('0x18')]?_0x5ddd04[_0xd46e('0x18')][_0xd46e('0x19')]===undefined?!![]:![]:!![]})[_0xd46e('0xc')](function(_0x3b5fa4){logger[_0xd46e('0xd')](_0xd46e('0x1a'),_0x5ddd04);logger[_0xd46e('0xf')](_0xd46e('0x1a'),_0x5ddd04,JSON['stringify'](_0x3b5fa4));_0x1bd574(_0x3b5fa4);})[_0xd46e('0x1b')](function(_0x1c83fa){logger[_0xd46e('0x13')](_0xd46e('0x1a'),_0x1c83fa[_0xd46e('0x14')],_0x5ddd04);_0x488690(_0x2e8f6d[_0xd46e('0x13')](0x1f4,_0x1c83fa[_0xd46e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 9fd7e56..bbdab5f 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 _0x4e14=['Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','test','post','create','put','update','delete','multer','util','path','connect-timeout','express'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x4e14,0x10c));var _0x44e1=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x4e14[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0x44e1('0x0'));var util=require(_0x44e1('0x1'));var path=require(_0x44e1('0x2'));var timeout=require(_0x44e1('0x3'));var express=require(_0x44e1('0x4'));var router=express[_0x44e1('0x5')]();var auth=require(_0x44e1('0x6'));var interaction=require(_0x44e1('0x7'));var config=require('../../config/environment');var controller=require(_0x44e1('0x8'));router[_0x44e1('0x9')]('/',auth[_0x44e1('0xa')](),controller['index']);router['get'](_0x44e1('0xb'),auth[_0x44e1('0xa')](),controller[_0x44e1('0xc')]);router['get'](_0x44e1('0xd'),auth[_0x44e1('0xa')](),timeout(_0x44e1('0xe')),controller[_0x44e1('0xf')]);router[_0x44e1('0x10')]('/',auth['isAuthenticated'](),controller[_0x44e1('0x11')]);router[_0x44e1('0x12')](_0x44e1('0xb'),auth[_0x44e1('0xa')](),controller[_0x44e1('0x13')]);router[_0x44e1('0x14')](_0x44e1('0xb'),auth[_0x44e1('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7e35=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','post','update','delete'];(function(_0x380d79,_0x316022){var _0x45116d=function(_0x38ebcc){while(--_0x38ebcc){_0x380d79['push'](_0x380d79['shift']());}};_0x45116d(++_0x316022);}(_0x7e35,0xc9));var _0x57e3=function(_0x21e1eb,_0x3f0a9e){_0x21e1eb=_0x21e1eb-0x0;var _0x4f1206=_0x7e35[_0x21e1eb];return _0x4f1206;};'use strict';var multer=require(_0x57e3('0x0'));var util=require(_0x57e3('0x1'));var path=require(_0x57e3('0x2'));var timeout=require(_0x57e3('0x3'));var express=require(_0x57e3('0x4'));var router=express[_0x57e3('0x5')]();var auth=require(_0x57e3('0x6'));var interaction=require(_0x57e3('0x7'));var config=require(_0x57e3('0x8'));var controller=require(_0x57e3('0x9'));router[_0x57e3('0xa')]('/',auth[_0x57e3('0xb')](),controller['index']);router[_0x57e3('0xa')](_0x57e3('0xc'),auth[_0x57e3('0xb')](),controller[_0x57e3('0xd')]);router['get'](_0x57e3('0xe'),auth[_0x57e3('0xb')](),timeout(_0x57e3('0xf')),controller['test']);router[_0x57e3('0x10')]('/',auth[_0x57e3('0xb')](),controller['create']);router['put'](_0x57e3('0xc'),auth[_0x57e3('0xb')](),controller[_0x57e3('0x11')]);router[_0x57e3('0x12')](_0x57e3('0xc'),auth[_0x57e3('0xb')](),controller[_0x57e3('0x13')]);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 945d8f8..7c85aea 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 _0x8c32=['name','exports','STRING'];(function(_0x116fe4,_0x3a71d7){var _0x26b378=function(_0x35e6d6){while(--_0x35e6d6){_0x116fe4['push'](_0x116fe4['shift']());}};_0x26b378(++_0x3a71d7);}(_0x8c32,0x6a));var _0x28c3=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x8c32[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require('sequelize');module[_0x28c3('0x0')]={'name':{'type':Sequelize[_0x28c3('0x1')],'unique':_0x28c3('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x28c3('0x1')]},'description':{'type':Sequelize[_0x28c3('0x1')]}}; \ No newline at end of file +var _0xabb3=['sequelize','exports','STRING'];(function(_0x48cc0e,_0x22d4ed){var _0x1144e6=function(_0x55b224){while(--_0x55b224){_0x48cc0e['push'](_0x48cc0e['shift']());}};_0x1144e6(++_0x22d4ed);}(_0xabb3,0xe1));var _0x3abb=function(_0x35d823,_0x212793){_0x35d823=_0x35d823-0x0;var _0x518ac5=_0xabb3[_0x35d823];return _0x518ac5;};'use strict';var Sequelize=require(_0x3abb('0x0'));module[_0x3abb('0x1')]={'name':{'type':Sequelize[_0x3abb('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3abb('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 3c7cfc0..cd46741 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 _0x64fb=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','then','destroy','get','ODBC','UserProfileResource','name','send','index','map','rawAttributes','key','keys','filters','query','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','SquareOdbc','count','includeAll','include','findAll','catch','show','params','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','closeSync','html-pdf','eml-format','rimraf'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x64fb,0xff));var _0xb64f=function(_0x5bc3c8,_0x1ff774){_0x5bc3c8=_0x5bc3c8-0x0;var _0x142c18=_0x64fb[_0x5bc3c8];return _0x142c18;};'use strict';var pdf=require(_0xb64f('0x0'));var emlformat=require(_0xb64f('0x1'));var rimraf=require(_0xb64f('0x2'));var zipdir=require(_0xb64f('0x3'));var jsonpatch=require(_0xb64f('0x4'));var rp=require(_0xb64f('0x5'));var moment=require(_0xb64f('0x6'));var BPromise=require(_0xb64f('0x7'));var Mustache=require(_0xb64f('0x8'));var util=require(_0xb64f('0x9'));var path=require(_0xb64f('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb64f('0xb'));var fs=require('fs');var _=require(_0xb64f('0xc'));var squel=require('squel');var crypto=require(_0xb64f('0xd'));var jsforce=require(_0xb64f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb64f('0xf'));var Redis=require(_0xb64f('0x10'));var authService=require(_0xb64f('0x11'));var qs=require(_0xb64f('0x12'));var as=require(_0xb64f('0x13'));var hardwareService=require(_0xb64f('0x14'));var logger=require(_0xb64f('0x15'))(_0xb64f('0x16'));var utils=require('../../config/utils');var config=require(_0xb64f('0x17'));var db=require(_0xb64f('0x18'))['db'];function respondWithStatusCode(_0x182832,_0x3d113d){_0x3d113d=_0x3d113d||0xcc;return function(_0x2b1f95){if(_0x2b1f95){return _0x182832[_0xb64f('0x19')](_0x3d113d);}return _0x182832['status'](_0x3d113d)[_0xb64f('0x1a')]();};}function respondWithResult(_0xdcef03,_0x22b50b){_0x22b50b=_0x22b50b||0xc8;return function(_0x37a969){if(_0x37a969){return _0xdcef03[_0xb64f('0x1b')](_0x22b50b)[_0xb64f('0x1c')](_0x37a969);}};}function respondWithFilteredResult(_0x5b302c,_0x19c87d){return function(_0x1f57f5){if(_0x1f57f5){var _0x32cc2e=_0x1f57f5['count'],_0x4954ee=_0x19c87d[_0xb64f('0x1d')],_0x2c5daa=_0x19c87d[_0xb64f('0x1d')]+_0x19c87d[_0xb64f('0x1e')],_0x36d8b7;if(_0x2c5daa>=_0x32cc2e){_0x2c5daa=_0x32cc2e;_0x36d8b7=0xc8;}else{_0x36d8b7=0xce;}_0x5b302c[_0xb64f('0x1b')](_0x36d8b7);return _0x5b302c[_0xb64f('0x1f')](_0xb64f('0x20'),_0x4954ee+'-'+_0x2c5daa+'/'+_0x32cc2e)[_0xb64f('0x1c')](_0x1f57f5);}return null;};}function patchUpdates(_0x10a6cd){return function(_0x4587a4){try{jsonpatch[_0xb64f('0x21')](_0x4587a4,_0x10a6cd,!![]);}catch(_0x4b8de4){return BPromise['reject'](_0x4b8de4);}return _0x4587a4[_0xb64f('0x22')]();};}function saveUpdates(_0x55cfdb,_0x4634ec){return function(_0x5b8f40){if(_0x5b8f40){return _0x5b8f40['update'](_0x55cfdb)[_0xb64f('0x23')](function(_0x213987){return _0x213987;});}return null;};}function removeEntity(_0x2a679e,_0x138da8){return function(_0x14187b){if(_0x14187b){return _0x14187b[_0xb64f('0x24')]()[_0xb64f('0x23')](function(){var _0x3985cb=_0x14187b[_0xb64f('0x25')]({'plain':!![]});var _0x4ebbbb=_0xb64f('0x26');return db[_0xb64f('0x27')]['destroy']({'where':{'type':_0x4ebbbb,'resourceId':_0x3985cb['id']}})['then'](function(){return _0x14187b;});})[_0xb64f('0x23')](function(){_0x2a679e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43ce13,_0x5e5170){return function(_0x15f1b7){if(!_0x15f1b7){_0x43ce13[_0xb64f('0x19')](0x194);}return _0x15f1b7;};}function handleError(_0x575c7f,_0x4976da){_0x4976da=_0x4976da||0x1f4;return function(_0x41c911){logger['error'](_0x41c911['stack']);if(_0x41c911['name']){delete _0x41c911[_0xb64f('0x28')];}_0x575c7f['status'](_0x4976da)[_0xb64f('0x29')](_0x41c911);};}exports[_0xb64f('0x2a')]=function(_0x592f61,_0x3cfc22){var _0x4961e8={},_0x117b32={},_0x46887a={'count':0x0,'rows':[]};var _0x287a76=_[_0xb64f('0x2b')](db['SquareOdbc'][_0xb64f('0x2c')],function(_0x3f7a67){return{'name':_0x3f7a67['fieldName'],'type':_0x3f7a67['type'][_0xb64f('0x2d')]};});_0x117b32['model']=_[_0xb64f('0x2b')](_0x287a76,_0xb64f('0x28'));_0x117b32['query']=_[_0xb64f('0x2e')](_0x592f61['query']);_0x117b32[_0xb64f('0x2f')]=_['intersection'](_0x117b32['model'],_0x117b32[_0xb64f('0x30')]);_0x4961e8['attributes']=_['intersection'](_0x117b32[_0xb64f('0x31')],qs[_0xb64f('0x32')](_0x592f61[_0xb64f('0x30')][_0xb64f('0x32')]));_0x4961e8['attributes']=_0x4961e8[_0xb64f('0x33')][_0xb64f('0x34')]?_0x4961e8[_0xb64f('0x33')]:_0x117b32[_0xb64f('0x31')];if(!_0x592f61[_0xb64f('0x30')][_0xb64f('0x35')](_0xb64f('0x36'))){_0x4961e8[_0xb64f('0x1e')]=qs['limit'](_0x592f61['query'][_0xb64f('0x1e')]);_0x4961e8[_0xb64f('0x1d')]=qs['offset'](_0x592f61[_0xb64f('0x30')][_0xb64f('0x1d')]);}_0x4961e8[_0xb64f('0x37')]=qs[_0xb64f('0x38')](_0x592f61[_0xb64f('0x30')][_0xb64f('0x38')]);_0x4961e8[_0xb64f('0x39')]=qs[_0xb64f('0x2f')](_[_0xb64f('0x3a')](_0x592f61['query'],_0x117b32['filters']),_0x287a76);if(_0x592f61[_0xb64f('0x30')]['filter']){_0x4961e8[_0xb64f('0x39')]=_[_0xb64f('0x3b')](_0x4961e8[_0xb64f('0x39')],{'$or':_['map'](_0x287a76,function(_0x59998){if(_0x59998[_0xb64f('0x3c')]!=='VIRTUAL'){var _0x442235={};_0x442235[_0x59998[_0xb64f('0x28')]]={'$like':'%'+_0x592f61[_0xb64f('0x30')][_0xb64f('0x3d')]+'%'};return _0x442235;}})});}_0x4961e8=_[_0xb64f('0x3b')]({},_0x4961e8,_0x592f61[_0xb64f('0x3e')]);var _0x45c870={'where':_0x4961e8[_0xb64f('0x39')]};return db[_0xb64f('0x3f')][_0xb64f('0x40')](_0x45c870)[_0xb64f('0x23')](function(_0x672d96){_0x46887a[_0xb64f('0x40')]=_0x672d96;if(_0x592f61['query'][_0xb64f('0x41')]){_0x4961e8[_0xb64f('0x42')]=[{'all':!![]}];}return db['SquareOdbc'][_0xb64f('0x43')](_0x4961e8);})[_0xb64f('0x23')](function(_0x2bce85){_0x46887a['rows']=_0x2bce85;return _0x46887a;})[_0xb64f('0x23')](respondWithFilteredResult(_0x3cfc22,_0x4961e8))[_0xb64f('0x44')](handleError(_0x3cfc22,null));};exports[_0xb64f('0x45')]=function(_0x1cce07,_0x418565){var _0xe38521={'raw':!![],'where':{'id':_0x1cce07[_0xb64f('0x46')]['id']}},_0x5321b8={};_0x5321b8[_0xb64f('0x31')]=_[_0xb64f('0x2e')](db[_0xb64f('0x3f')]['rawAttributes']);_0x5321b8[_0xb64f('0x30')]=_['keys'](_0x1cce07[_0xb64f('0x30')]);_0x5321b8[_0xb64f('0x2f')]=_['intersection'](_0x5321b8[_0xb64f('0x31')],_0x5321b8[_0xb64f('0x30')]);_0xe38521[_0xb64f('0x33')]=_[_0xb64f('0x47')](_0x5321b8[_0xb64f('0x31')],qs[_0xb64f('0x32')](_0x1cce07['query'][_0xb64f('0x32')]));_0xe38521[_0xb64f('0x33')]=_0xe38521[_0xb64f('0x33')][_0xb64f('0x34')]?_0xe38521[_0xb64f('0x33')]:_0x5321b8[_0xb64f('0x31')];if(_0x1cce07[_0xb64f('0x30')]['includeAll']){_0xe38521['include']=[{'all':!![]}];}_0xe38521=_[_0xb64f('0x3b')]({},_0xe38521,_0x1cce07[_0xb64f('0x3e')]);return db[_0xb64f('0x3f')][_0xb64f('0x48')](_0xe38521)[_0xb64f('0x23')](handleEntityNotFound(_0x418565,null))[_0xb64f('0x23')](respondWithResult(_0x418565,null))[_0xb64f('0x44')](handleError(_0x418565,null));};exports[_0xb64f('0x49')]=function(_0x507405,_0x3e6df5){return db[_0xb64f('0x3f')]['create'](_0x507405['body'],{})[_0xb64f('0x23')](function(_0xa5f609){var _0x18ab56=_0x507405[_0xb64f('0x4a')][_0xb64f('0x25')]({'plain':!![]});if(!_0x18ab56)throw new Error(_0xb64f('0x4b'));if(_0x18ab56[_0xb64f('0x4c')]===_0xb64f('0x4a')){var _0x4b29f5=_0xa5f609[_0xb64f('0x25')]({'plain':!![]});var _0x56d883=_0xb64f('0x26');return db[_0xb64f('0x4d')][_0xb64f('0x48')]({'where':{'name':_0x56d883,'userProfileId':_0x18ab56['userProfileId']},'raw':!![]})[_0xb64f('0x23')](function(_0x403d3f){if(_0x403d3f&&_0x403d3f[_0xb64f('0x4e')]===0x0){return db[_0xb64f('0x27')][_0xb64f('0x49')]({'name':_0x4b29f5[_0xb64f('0x28')],'resourceId':_0x4b29f5['id'],'type':_0x403d3f['name'],'sectionId':_0x403d3f['id']},{})[_0xb64f('0x23')](function(){return _0xa5f609;});}else{return _0xa5f609;}})[_0xb64f('0x44')](function(_0x1a1299){logger[_0xb64f('0x4f')](_0xb64f('0x50'),_0x1a1299);throw _0x1a1299;});}return _0xa5f609;})['then'](respondWithResult(_0x3e6df5,0xc9))[_0xb64f('0x44')](handleError(_0x3e6df5,null));};exports['update']=function(_0x4af9e4,_0x1089df){if(_0x4af9e4[_0xb64f('0x51')]['id']){delete _0x4af9e4[_0xb64f('0x51')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x4af9e4[_0xb64f('0x46')]['id']}})[_0xb64f('0x23')](handleEntityNotFound(_0x1089df,null))[_0xb64f('0x23')](saveUpdates(_0x4af9e4['body'],null))[_0xb64f('0x23')](respondWithResult(_0x1089df,null))[_0xb64f('0x44')](handleError(_0x1089df,null));};exports[_0xb64f('0x24')]=function(_0x5282b8,_0xfc68bc){return db[_0xb64f('0x3f')][_0xb64f('0x48')]({'where':{'id':_0x5282b8[_0xb64f('0x46')]['id']}})[_0xb64f('0x23')](handleEntityNotFound(_0xfc68bc,null))[_0xb64f('0x23')](removeEntity(_0xfc68bc,null))[_0xb64f('0x44')](handleError(_0xfc68bc,null));};exports[_0xb64f('0x52')]=function(_0x337210,_0x4c26b2,_0xc8834a){var _0x5e50d8;return db[_0xb64f('0x3f')][_0xb64f('0x48')]({'where':{'id':_0x337210['params']['id']},'attributes':['id',_0xb64f('0x53')]})[_0xb64f('0x23')](handleEntityNotFound(_0x4c26b2,null))[_0xb64f('0x23')](function(_0x2bb83c){if(_0x2bb83c){var _0x13c6b5=require(_0xb64f('0x54'))();_0x13c6b5['openSync'](_0x2bb83c[_0xb64f('0x53')]);_0x13c6b5[_0xb64f('0x55')]();return _0x2bb83c;}})[_0xb64f('0x23')](respondWithResult(_0x4c26b2,null))['catch'](handleError(_0x4c26b2,null));}; \ No newline at end of file +var _0x7a23=['send','index','map','SquareOdbc','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','dsn','openSync','closeSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','error','stack','name'];(function(_0x26e6fb,_0x3551ca){var _0x10fde8=function(_0x592948){while(--_0x592948){_0x26e6fb['push'](_0x26e6fb['shift']());}};_0x10fde8(++_0x3551ca);}(_0x7a23,0xd2));var _0x37a2=function(_0x5bc59a,_0x397c97){_0x5bc59a=_0x5bc59a-0x0;var _0x3d5447=_0x7a23[_0x5bc59a];return _0x3d5447;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x37a2('0x0'));var jsonpatch=require(_0x37a2('0x1'));var rp=require(_0x37a2('0x2'));var moment=require(_0x37a2('0x3'));var BPromise=require(_0x37a2('0x4'));var Mustache=require(_0x37a2('0x5'));var util=require(_0x37a2('0x6'));var path=require(_0x37a2('0x7'));var sox=require(_0x37a2('0x8'));var csv=require(_0x37a2('0x9'));var ejs=require(_0x37a2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x37a2('0xb'));var crypto=require('crypto');var jsforce=require(_0x37a2('0xc'));var deskjs=require(_0x37a2('0xd'));var toCsv=require(_0x37a2('0x9'));var querystring=require(_0x37a2('0xe'));var Papa=require('papaparse');var Redis=require(_0x37a2('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x37a2('0x10'));var hardwareService=require(_0x37a2('0x11'));var logger=require(_0x37a2('0x12'))(_0x37a2('0x13'));var utils=require(_0x37a2('0x14'));var config=require(_0x37a2('0x15'));var db=require(_0x37a2('0x16'))['db'];function respondWithStatusCode(_0x2307dd,_0x542222){_0x542222=_0x542222||0xcc;return function(_0x21d560){if(_0x21d560){return _0x2307dd[_0x37a2('0x17')](_0x542222);}return _0x2307dd[_0x37a2('0x18')](_0x542222)[_0x37a2('0x19')]();};}function respondWithResult(_0x3e6992,_0x3b61c2){_0x3b61c2=_0x3b61c2||0xc8;return function(_0x236411){if(_0x236411){return _0x3e6992['status'](_0x3b61c2)[_0x37a2('0x1a')](_0x236411);}};}function respondWithFilteredResult(_0x3f7032,_0x2e4baa){return function(_0x4b2d51){if(_0x4b2d51){var _0x25be47=_0x4b2d51[_0x37a2('0x1b')],_0x3d6e71=_0x2e4baa['offset'],_0x123589=_0x2e4baa['offset']+_0x2e4baa[_0x37a2('0x1c')],_0x383b4c;if(_0x123589>=_0x25be47){_0x123589=_0x25be47;_0x383b4c=0xc8;}else{_0x383b4c=0xce;}_0x3f7032[_0x37a2('0x18')](_0x383b4c);return _0x3f7032[_0x37a2('0x1d')](_0x37a2('0x1e'),_0x3d6e71+'-'+_0x123589+'/'+_0x25be47)[_0x37a2('0x1a')](_0x4b2d51);}return null;};}function patchUpdates(_0x2fa319){return function(_0x18c94c){try{jsonpatch[_0x37a2('0x1f')](_0x18c94c,_0x2fa319,!![]);}catch(_0xd38f1){return BPromise[_0x37a2('0x20')](_0xd38f1);}return _0x18c94c[_0x37a2('0x21')]();};}function saveUpdates(_0x132384,_0x4dcace){return function(_0x2c9894){if(_0x2c9894){return _0x2c9894['update'](_0x132384)[_0x37a2('0x22')](function(_0x4072ae){return _0x4072ae;});}return null;};}function removeEntity(_0x35713c,_0x18cecd){return function(_0x2d9f36){if(_0x2d9f36){return _0x2d9f36[_0x37a2('0x23')]()['then'](function(){var _0x52fe21=_0x2d9f36[_0x37a2('0x24')]({'plain':!![]});var _0x2722aa=_0x37a2('0x25');return db[_0x37a2('0x26')]['destroy']({'where':{'type':_0x2722aa,'resourceId':_0x52fe21['id']}})[_0x37a2('0x22')](function(){return _0x2d9f36;});})[_0x37a2('0x22')](function(){_0x35713c[_0x37a2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x566107,_0xfa915c){return function(_0x3d831b){if(!_0x3d831b){_0x566107['sendStatus'](0x194);}return _0x3d831b;};}function handleError(_0x241f29,_0x3b1d86){_0x3b1d86=_0x3b1d86||0x1f4;return function(_0xb33e7d){logger[_0x37a2('0x27')](_0xb33e7d[_0x37a2('0x28')]);if(_0xb33e7d['name']){delete _0xb33e7d[_0x37a2('0x29')];}_0x241f29[_0x37a2('0x18')](_0x3b1d86)[_0x37a2('0x2a')](_0xb33e7d);};}exports[_0x37a2('0x2b')]=function(_0x42987a,_0x15ee1c){var _0x36cf1b={},_0x35d400={},_0x25b2e1={'count':0x0,'rows':[]};var _0x7e62e5=_[_0x37a2('0x2c')](db[_0x37a2('0x2d')][_0x37a2('0x2e')],function(_0x44bfd4){return{'name':_0x44bfd4['fieldName'],'type':_0x44bfd4['type'][_0x37a2('0x2f')]};});_0x35d400[_0x37a2('0x30')]=_[_0x37a2('0x2c')](_0x7e62e5,_0x37a2('0x29'));_0x35d400[_0x37a2('0x31')]=_['keys'](_0x42987a[_0x37a2('0x31')]);_0x35d400[_0x37a2('0x32')]=_[_0x37a2('0x33')](_0x35d400[_0x37a2('0x30')],_0x35d400['query']);_0x36cf1b[_0x37a2('0x34')]=_['intersection'](_0x35d400[_0x37a2('0x30')],qs[_0x37a2('0x35')](_0x42987a[_0x37a2('0x31')][_0x37a2('0x35')]));_0x36cf1b[_0x37a2('0x34')]=_0x36cf1b[_0x37a2('0x34')][_0x37a2('0x36')]?_0x36cf1b[_0x37a2('0x34')]:_0x35d400[_0x37a2('0x30')];if(!_0x42987a['query'][_0x37a2('0x37')]('nolimit')){_0x36cf1b[_0x37a2('0x1c')]=qs[_0x37a2('0x1c')](_0x42987a[_0x37a2('0x31')][_0x37a2('0x1c')]);_0x36cf1b[_0x37a2('0x38')]=qs[_0x37a2('0x38')](_0x42987a['query']['offset']);}_0x36cf1b[_0x37a2('0x39')]=qs['sort'](_0x42987a[_0x37a2('0x31')][_0x37a2('0x3a')]);_0x36cf1b[_0x37a2('0x3b')]=qs[_0x37a2('0x32')](_[_0x37a2('0x3c')](_0x42987a[_0x37a2('0x31')],_0x35d400['filters']),_0x7e62e5);if(_0x42987a['query']['filter']){_0x36cf1b[_0x37a2('0x3b')]=_['merge'](_0x36cf1b[_0x37a2('0x3b')],{'$or':_['map'](_0x7e62e5,function(_0x1d9db9){if(_0x1d9db9[_0x37a2('0x3d')]!=='VIRTUAL'){var _0xa07fc8={};_0xa07fc8[_0x1d9db9[_0x37a2('0x29')]]={'$like':'%'+_0x42987a['query'][_0x37a2('0x3e')]+'%'};return _0xa07fc8;}})});}_0x36cf1b=_[_0x37a2('0x3f')]({},_0x36cf1b,_0x42987a[_0x37a2('0x40')]);var _0x903e98={'where':_0x36cf1b[_0x37a2('0x3b')]};return db[_0x37a2('0x2d')][_0x37a2('0x1b')](_0x903e98)[_0x37a2('0x22')](function(_0x46a351){_0x25b2e1[_0x37a2('0x1b')]=_0x46a351;if(_0x42987a[_0x37a2('0x31')][_0x37a2('0x41')]){_0x36cf1b[_0x37a2('0x42')]=[{'all':!![]}];}return db[_0x37a2('0x2d')][_0x37a2('0x43')](_0x36cf1b);})['then'](function(_0x504f33){_0x25b2e1[_0x37a2('0x44')]=_0x504f33;return _0x25b2e1;})[_0x37a2('0x22')](respondWithFilteredResult(_0x15ee1c,_0x36cf1b))[_0x37a2('0x45')](handleError(_0x15ee1c,null));};exports['show']=function(_0x231973,_0x381ae5){var _0x8744df={'raw':!![],'where':{'id':_0x231973[_0x37a2('0x46')]['id']}},_0x550a61={};_0x550a61['model']=_[_0x37a2('0x47')](db[_0x37a2('0x2d')][_0x37a2('0x2e')]);_0x550a61[_0x37a2('0x31')]=_[_0x37a2('0x47')](_0x231973[_0x37a2('0x31')]);_0x550a61['filters']=_[_0x37a2('0x33')](_0x550a61['model'],_0x550a61[_0x37a2('0x31')]);_0x8744df['attributes']=_[_0x37a2('0x33')](_0x550a61[_0x37a2('0x30')],qs[_0x37a2('0x35')](_0x231973[_0x37a2('0x31')]['fields']));_0x8744df[_0x37a2('0x34')]=_0x8744df[_0x37a2('0x34')][_0x37a2('0x36')]?_0x8744df['attributes']:_0x550a61[_0x37a2('0x30')];if(_0x231973[_0x37a2('0x31')]['includeAll']){_0x8744df[_0x37a2('0x42')]=[{'all':!![]}];}_0x8744df=_[_0x37a2('0x3f')]({},_0x8744df,_0x231973['options']);return db['SquareOdbc'][_0x37a2('0x48')](_0x8744df)[_0x37a2('0x22')](handleEntityNotFound(_0x381ae5,null))['then'](respondWithResult(_0x381ae5,null))[_0x37a2('0x45')](handleError(_0x381ae5,null));};exports[_0x37a2('0x49')]=function(_0x25d85b,_0x4055f5){return db[_0x37a2('0x2d')]['create'](_0x25d85b['body'],{})[_0x37a2('0x22')](function(_0x40a9c6){var _0x57f97f=_0x25d85b['user'][_0x37a2('0x24')]({'plain':!![]});if(!_0x57f97f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57f97f[_0x37a2('0x4a')]===_0x37a2('0x4b')){var _0x117a91=_0x40a9c6[_0x37a2('0x24')]({'plain':!![]});var _0xa21c23=_0x37a2('0x25');return db[_0x37a2('0x4c')][_0x37a2('0x48')]({'where':{'name':_0xa21c23,'userProfileId':_0x57f97f[_0x37a2('0x4d')]},'raw':!![]})[_0x37a2('0x22')](function(_0x39490c){if(_0x39490c&&_0x39490c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x117a91[_0x37a2('0x29')],'resourceId':_0x117a91['id'],'type':_0x39490c[_0x37a2('0x29')],'sectionId':_0x39490c['id']},{})[_0x37a2('0x22')](function(){return _0x40a9c6;});}else{return _0x40a9c6;}})[_0x37a2('0x45')](function(_0x3c1e22){logger[_0x37a2('0x27')](_0x37a2('0x4e'),_0x3c1e22);throw _0x3c1e22;});}return _0x40a9c6;})[_0x37a2('0x22')](respondWithResult(_0x4055f5,0xc9))[_0x37a2('0x45')](handleError(_0x4055f5,null));};exports[_0x37a2('0x4f')]=function(_0x248780,_0x313e13){if(_0x248780[_0x37a2('0x50')]['id']){delete _0x248780[_0x37a2('0x50')]['id'];}return db[_0x37a2('0x2d')][_0x37a2('0x48')]({'where':{'id':_0x248780[_0x37a2('0x46')]['id']}})[_0x37a2('0x22')](handleEntityNotFound(_0x313e13,null))['then'](saveUpdates(_0x248780[_0x37a2('0x50')],null))['then'](respondWithResult(_0x313e13,null))['catch'](handleError(_0x313e13,null));};exports[_0x37a2('0x23')]=function(_0x417d34,_0x181fa6){return db[_0x37a2('0x2d')][_0x37a2('0x48')]({'where':{'id':_0x417d34[_0x37a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x181fa6,null))[_0x37a2('0x22')](removeEntity(_0x181fa6,null))[_0x37a2('0x45')](handleError(_0x181fa6,null));};exports['test']=function(_0x54df88,_0x165bda,_0x32798a){var _0x2e2705;return db['SquareOdbc'][_0x37a2('0x48')]({'where':{'id':_0x54df88[_0x37a2('0x46')]['id']},'attributes':['id',_0x37a2('0x51')]})['then'](handleEntityNotFound(_0x165bda,null))[_0x37a2('0x22')](function(_0x4b1e21){if(_0x4b1e21){var _0x5c0db7=require('odbc')();_0x5c0db7[_0x37a2('0x52')](_0x4b1e21[_0x37a2('0x51')]);_0x5c0db7[_0x37a2('0x53')]();return _0x4b1e21;}})[_0x37a2('0x22')](respondWithResult(_0x165bda,null))[_0x37a2('0x45')](handleError(_0x165bda,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 1d4dd7d..4d6163d 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 _0x77fa=['SquareOdbc','square_odbc','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x421f4a,_0x4734b3){var _0x4751c1=function(_0x200654){while(--_0x200654){_0x421f4a['push'](_0x421f4a['shift']());}};_0x4751c1(++_0x4734b3);}(_0x77fa,0x1ee));var _0xa77f=function(_0x595fce,_0x21c512){_0x595fce=_0x595fce-0x0;var _0x18e06f=_0x77fa[_0x595fce];return _0x18e06f;};'use strict';var _=require(_0xa77f('0x0'));var util=require('util');var logger=require(_0xa77f('0x1'))('api');var moment=require(_0xa77f('0x2'));var BPromise=require('bluebird');var rp=require(_0xa77f('0x3'));var fs=require('fs');var path=require(_0xa77f('0x4'));var rimraf=require(_0xa77f('0x5'));var config=require(_0xa77f('0x6'));var attributes=require(_0xa77f('0x7'));module[_0xa77f('0x8')]=function(_0x119d46,_0x642af1){return _0x119d46[_0xa77f('0x9')](_0xa77f('0xa'),attributes,{'tableName':_0xa77f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4e7=['path','rimraf','./squareOdbc.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x185d1e,_0x5ad33b){var _0x211a49=function(_0x4903ac){while(--_0x4903ac){_0x185d1e['push'](_0x185d1e['shift']());}};_0x211a49(++_0x5ad33b);}(_0xf4e7,0x139));var _0x7f4e=function(_0x28de54,_0x5ea11a){_0x28de54=_0x28de54-0x0;var _0x3b59d8=_0xf4e7[_0x28de54];return _0x3b59d8;};'use strict';var _=require(_0x7f4e('0x0'));var util=require(_0x7f4e('0x1'));var logger=require(_0x7f4e('0x2'))(_0x7f4e('0x3'));var moment=require(_0x7f4e('0x4'));var BPromise=require('bluebird');var rp=require(_0x7f4e('0x5'));var fs=require('fs');var path=require(_0x7f4e('0x6'));var rimraf=require(_0x7f4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x7f4e('0x8'));module[_0x7f4e('0x9')]=function(_0x5d989d,_0x41666d){return _0x5d989d[_0x7f4e('0xa')]('SquareOdbc',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 f646982..670e9ed 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x1efb29,_0x41cd3b){var _0xae79e9=function(_0x59c502){while(--_0x59c502){_0x1efb29['push'](_0x1efb29['shift']());}};_0xae79e9(++_0x41cd3b);}(_0x008c,0x188));var _0xc008=function(_0x48f8c4,_0x4e3dba){_0x48f8c4=_0x48f8c4-0x0;var _0x118849=_0x008c[_0x48f8c4];return _0x118849;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file +var _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(_0x1624f5,_0xa2f147){var _0x23b431=function(_0x5393d4){while(--_0x5393d4){_0x1624f5['push'](_0x1624f5['shift']());}};_0x23b431(++_0xa2f147);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x5fc3[_0x3a8db5];return _0x2c03cd;};'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 diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 68e0ceb..9b72e66 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 _0xf7b4=['../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','post','addUsers','put','destroy','delete','removeUsers','exports','multer','connect-timeout','express','../../components/interaction/service'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xf7b4,0x152));var _0x4f7b=function(_0x522eb8,_0xaf0729){_0x522eb8=_0x522eb8-0x0;var _0x32b68a=_0xf7b4[_0x522eb8];return _0x32b68a;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4f7b('0x3'));var config=require(_0x4f7b('0x4'));var controller=require(_0x4f7b('0x5'));router[_0x4f7b('0x6')]('/',auth[_0x4f7b('0x7')](),controller[_0x4f7b('0x8')]);router[_0x4f7b('0x6')](_0x4f7b('0x9'),auth[_0x4f7b('0x7')](),controller[_0x4f7b('0xa')]);router[_0x4f7b('0x6')](_0x4f7b('0xb'),auth[_0x4f7b('0x7')](),controller['getUsers']);router[_0x4f7b('0xc')]('/',auth[_0x4f7b('0x7')](),controller['create']);router[_0x4f7b('0xc')](_0x4f7b('0xb'),auth[_0x4f7b('0x7')](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0xe')]('/:id',auth[_0x4f7b('0x7')](),controller['update']);router['delete'](_0x4f7b('0x9'),auth[_0x4f7b('0x7')](),controller[_0x4f7b('0xf')]);router[_0x4f7b('0x10')]('/:id/users',auth[_0x4f7b('0x7')](),controller[_0x4f7b('0x11')]);module[_0x4f7b('0x12')]=router; \ No newline at end of file +var _0x96cc=['index','/:id','show','/:id/users','getUsers','create','post','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated'];(function(_0x40b046,_0x27857f){var _0x1558d4=function(_0xbfd78f){while(--_0xbfd78f){_0x40b046['push'](_0x40b046['shift']());}};_0x1558d4(++_0x27857f);}(_0x96cc,0x16c));var _0xc96c=function(_0x18d50f,_0x124aff){_0x18d50f=_0x18d50f-0x0;var _0x8ce385=_0x96cc[_0x18d50f];return _0x8ce385;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var auth=require(_0xc96c('0x4'));var interaction=require(_0xc96c('0x5'));var config=require(_0xc96c('0x6'));var controller=require(_0xc96c('0x7'));router[_0xc96c('0x8')]('/',auth[_0xc96c('0x9')](),controller[_0xc96c('0xa')]);router['get'](_0xc96c('0xb'),auth[_0xc96c('0x9')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x8')](_0xc96c('0xd'),auth[_0xc96c('0x9')](),controller[_0xc96c('0xe')]);router['post']('/',auth[_0xc96c('0x9')](),controller[_0xc96c('0xf')]);router[_0xc96c('0x10')]('/:id/users',auth[_0xc96c('0x9')](),controller['addUsers']);router[_0xc96c('0x11')]('/:id',auth[_0xc96c('0x9')](),controller[_0xc96c('0x12')]);router[_0xc96c('0x13')](_0xc96c('0xb'),auth['isAuthenticated'](),controller[_0xc96c('0x14')]);router[_0xc96c('0x13')](_0xc96c('0xd'),auth[_0xc96c('0x9')](),controller['removeUsers']);module[_0xc96c('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 409e3c6..201c378 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 _0xeada=['STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','sequelize','exports'];(function(_0x3e8214,_0x563177){var _0x17e4ae=function(_0x82560f){while(--_0x82560f){_0x3e8214['push'](_0x3e8214['shift']());}};_0x17e4ae(++_0x563177);}(_0xeada,0x76));var _0xaead=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeada[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xaead('0x0'));module[_0xaead('0x1')]={'name':{'type':Sequelize[_0xaead('0x2')],'unique':_0xaead('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xaead('0x4')]},'preproduction':{'type':Sequelize[_0xaead('0x5')](_0xaead('0x6')),'get':function(){if(this[_0xaead('0x7')](_0xaead('0x8'))){return this[_0xaead('0x7')](_0xaead('0x8'))[_0xaead('0x9')](_0xaead('0xa'));}}},'production':{'type':Sequelize[_0xaead('0x5')](_0xaead('0x6')),'get':function(){if(this[_0xaead('0x7')](_0xaead('0xb'))){return this[_0xaead('0x7')]('production')['toString'](_0xaead('0xa'));}}}}; \ No newline at end of file +var _0xdc96=['exports','name','TEXT','BLOB','getDataValue','preproduction','utf8','long','production'];(function(_0x36de71,_0x148629){var _0x304290=function(_0x217b19){while(--_0x217b19){_0x36de71['push'](_0x36de71['shift']());}};_0x304290(++_0x148629);}(_0xdc96,0x1b0));var _0x6dc9=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xdc96[_0x45d3f0];return _0x314b79;};'use strict';var Sequelize=require('sequelize');module[_0x6dc9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6dc9('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x6dc9('0x2')]},'preproduction':{'type':Sequelize[_0x6dc9('0x3')]('long'),'get':function(){if(this[_0x6dc9('0x4')]('preproduction')){return this[_0x6dc9('0x4')](_0x6dc9('0x5'))['toString'](_0x6dc9('0x6'));}}},'production':{'type':Sequelize[_0x6dc9('0x3')](_0x6dc9('0x7')),'get':function(){if(this[_0x6dc9('0x4')]('production')){return this['getDataValue'](_0x6dc9('0x8'))['toString'](_0x6dc9('0x6'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 08dec6f..7b64603 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 _0x13a8=['../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','then','destroy','get','SquareProjects','UserProfileResource','stack','name','index','map','SquareProject','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','removeUsers','isArray','userSquareProject:remove','getUsers','findOne','order','sort','pick','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x76afcc,_0x22f653){var _0x1a1cae=function(_0x5983d0){while(--_0x5983d0){_0x76afcc['push'](_0x76afcc['shift']());}};_0x1a1cae(++_0x22f653);}(_0x13a8,0xa3));var _0x813a=function(_0x28f2e6,_0x1d1fb7){_0x28f2e6=_0x28f2e6-0x0;var _0x2e16f6=_0x13a8[_0x28f2e6];return _0x2e16f6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x813a('0x0'));var rimraf=require(_0x813a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x813a('0x2'));var moment=require(_0x813a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x813a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x813a('0x5'));var csv=require(_0x813a('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x813a('0x7'));var squel=require(_0x813a('0x8'));var crypto=require('crypto');var jsforce=require(_0x813a('0x9'));var deskjs=require(_0x813a('0xa'));var toCsv=require(_0x813a('0x6'));var querystring=require(_0x813a('0xb'));var Papa=require(_0x813a('0xc'));var Redis=require(_0x813a('0xd'));var authService=require(_0x813a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x813a('0xf'));var hardwareService=require(_0x813a('0x10'));var logger=require(_0x813a('0x11'))('api');var utils=require(_0x813a('0x12'));var config=require(_0x813a('0x13'));var db=require(_0x813a('0x14'))['db'];config['redis']=_[_0x813a('0x15')](config[_0x813a('0x16')],{'host':_0x813a('0x17'),'port':0x18eb});var socket=require(_0x813a('0x18'))(new Redis(config[_0x813a('0x16')]));require(_0x813a('0x19'))[_0x813a('0x1a')](socket);function respondWithStatusCode(_0x1891aa,_0x5905a3){_0x5905a3=_0x5905a3||0xcc;return function(_0x417ce){if(_0x417ce){return _0x1891aa[_0x813a('0x1b')](_0x5905a3);}return _0x1891aa[_0x813a('0x1c')](_0x5905a3)[_0x813a('0x1d')]();};}function respondWithResult(_0x531f43,_0x33a08f){_0x33a08f=_0x33a08f||0xc8;return function(_0x36ff65){if(_0x36ff65){return _0x531f43[_0x813a('0x1c')](_0x33a08f)['json'](_0x36ff65);}};}function respondWithFilteredResult(_0x5c37a1,_0x487560){return function(_0x4066c3){if(_0x4066c3){var _0x52b08b=_0x4066c3[_0x813a('0x1e')],_0x11160a=_0x487560[_0x813a('0x1f')],_0x2ecaf6=_0x487560[_0x813a('0x1f')]+_0x487560[_0x813a('0x20')],_0x588317;if(_0x2ecaf6>=_0x52b08b){_0x2ecaf6=_0x52b08b;_0x588317=0xc8;}else{_0x588317=0xce;}_0x5c37a1[_0x813a('0x1c')](_0x588317);return _0x5c37a1[_0x813a('0x21')](_0x813a('0x22'),_0x11160a+'-'+_0x2ecaf6+'/'+_0x52b08b)[_0x813a('0x23')](_0x4066c3);}return null;};}function patchUpdates(_0x20bf79){return function(_0x50fd03){try{jsonpatch['apply'](_0x50fd03,_0x20bf79,!![]);}catch(_0x5619a7){return BPromise['reject'](_0x5619a7);}return _0x50fd03[_0x813a('0x24')]();};}function saveUpdates(_0x4140de,_0x16bb71){return function(_0x557d01){if(_0x557d01){return _0x557d01['update'](_0x4140de)[_0x813a('0x25')](function(_0x1f3dfa){return _0x1f3dfa;});}return null;};}function removeEntity(_0x30412e,_0x2198d4){return function(_0x9a1f76){if(_0x9a1f76){return _0x9a1f76[_0x813a('0x26')]()[_0x813a('0x25')](function(){var _0x388651=_0x9a1f76[_0x813a('0x27')]({'plain':!![]});var _0x13a268=_0x813a('0x28');return db[_0x813a('0x29')][_0x813a('0x26')]({'where':{'type':_0x13a268,'resourceId':_0x388651['id']}})[_0x813a('0x25')](function(){return _0x9a1f76;});})[_0x813a('0x25')](function(){_0x30412e[_0x813a('0x1c')](0xcc)[_0x813a('0x1d')]();});}};}function handleEntityNotFound(_0x2f1c4b,_0x291a09){return function(_0x188185){if(!_0x188185){_0x2f1c4b['sendStatus'](0x194);}return _0x188185;};}function handleError(_0x1c59d3,_0x183c2d){_0x183c2d=_0x183c2d||0x1f4;return function(_0x571fa7){logger['error'](_0x571fa7[_0x813a('0x2a')]);if(_0x571fa7[_0x813a('0x2b')]){delete _0x571fa7[_0x813a('0x2b')];}_0x1c59d3['status'](_0x183c2d)['send'](_0x571fa7);};}exports[_0x813a('0x2c')]=function(_0x2e0fee,_0x2abbde){var _0x5bc36d={},_0x27c06a={},_0x283ccc={'count':0x0,'rows':[]};var _0x200bef=_[_0x813a('0x2d')](db[_0x813a('0x2e')][_0x813a('0x2f')],function(_0x29af67){return{'name':_0x29af67['fieldName'],'type':_0x29af67[_0x813a('0x30')][_0x813a('0x31')]};});_0x27c06a['model']=_['map'](_0x200bef,_0x813a('0x2b'));_0x27c06a[_0x813a('0x32')]=_[_0x813a('0x33')](_0x2e0fee[_0x813a('0x32')]);_0x27c06a[_0x813a('0x34')]=_[_0x813a('0x35')](_0x27c06a['model'],_0x27c06a['query']);_0x5bc36d[_0x813a('0x36')]=_[_0x813a('0x35')](_0x27c06a[_0x813a('0x37')],qs[_0x813a('0x38')](_0x2e0fee[_0x813a('0x32')][_0x813a('0x38')]));_0x5bc36d[_0x813a('0x36')]=_0x5bc36d[_0x813a('0x36')][_0x813a('0x39')]?_0x5bc36d['attributes']:_0x27c06a[_0x813a('0x37')];if(!_0x2e0fee['query'][_0x813a('0x3a')](_0x813a('0x3b'))){_0x5bc36d[_0x813a('0x20')]=qs['limit'](_0x2e0fee[_0x813a('0x32')][_0x813a('0x20')]);_0x5bc36d[_0x813a('0x1f')]=qs[_0x813a('0x1f')](_0x2e0fee['query']['offset']);}_0x5bc36d['order']=qs['sort'](_0x2e0fee[_0x813a('0x32')]['sort']);_0x5bc36d[_0x813a('0x3c')]=qs['filters'](_['pick'](_0x2e0fee['query'],_0x27c06a[_0x813a('0x34')]),_0x200bef);if(_0x2e0fee['query'][_0x813a('0x3d')]){_0x5bc36d[_0x813a('0x3c')]=_[_0x813a('0x3e')](_0x5bc36d[_0x813a('0x3c')],{'$or':_[_0x813a('0x2d')](_0x200bef,function(_0x5e3e9f){if(_0x5e3e9f[_0x813a('0x30')]!==_0x813a('0x3f')){var _0xee290a={};_0xee290a[_0x5e3e9f[_0x813a('0x2b')]]={'$like':'%'+_0x2e0fee[_0x813a('0x32')][_0x813a('0x3d')]+'%'};return _0xee290a;}})});}_0x5bc36d=_['merge']({},_0x5bc36d,_0x2e0fee['options']);var _0x3dc048={'where':_0x5bc36d[_0x813a('0x3c')]};return db['SquareProject'][_0x813a('0x1e')](_0x3dc048)[_0x813a('0x25')](function(_0x4c13fb){_0x283ccc['count']=_0x4c13fb;if(_0x2e0fee['query'][_0x813a('0x40')]){_0x5bc36d['include']=[{'all':!![]}];}return db[_0x813a('0x2e')][_0x813a('0x41')](_0x5bc36d);})['then'](function(_0x24cf9c){_0x283ccc[_0x813a('0x42')]=_0x24cf9c;return _0x283ccc;})[_0x813a('0x25')](respondWithFilteredResult(_0x2abbde,_0x5bc36d))[_0x813a('0x43')](handleError(_0x2abbde,null));};exports['show']=function(_0x124dc8,_0x340b4c){var _0x402b8f={'raw':![],'where':{'id':_0x124dc8[_0x813a('0x44')]['id']}},_0x266ccd={};_0x266ccd['model']=_[_0x813a('0x33')](db[_0x813a('0x2e')][_0x813a('0x2f')]);_0x266ccd[_0x813a('0x32')]=_[_0x813a('0x33')](_0x124dc8['query']);_0x266ccd[_0x813a('0x34')]=_[_0x813a('0x35')](_0x266ccd[_0x813a('0x37')],_0x266ccd[_0x813a('0x32')]);_0x402b8f[_0x813a('0x36')]=_[_0x813a('0x35')](_0x266ccd[_0x813a('0x37')],qs[_0x813a('0x38')](_0x124dc8[_0x813a('0x32')][_0x813a('0x38')]));_0x402b8f[_0x813a('0x36')]=_0x402b8f['attributes'][_0x813a('0x39')]?_0x402b8f[_0x813a('0x36')]:_0x266ccd[_0x813a('0x37')];if(_0x124dc8[_0x813a('0x32')]['includeAll']){_0x402b8f[_0x813a('0x45')]=[{'all':!![]}];}_0x402b8f=_[_0x813a('0x3e')]({},_0x402b8f,_0x124dc8[_0x813a('0x46')]);return db[_0x813a('0x2e')][_0x813a('0x47')](_0x402b8f)['then'](handleEntityNotFound(_0x340b4c,null))[_0x813a('0x25')](respondWithResult(_0x340b4c,null))[_0x813a('0x43')](handleError(_0x340b4c,null));};exports[_0x813a('0x48')]=function(_0x4adc9d,_0x28b947){return db['SquareProject'][_0x813a('0x48')](_0x4adc9d[_0x813a('0x49')],{})[_0x813a('0x25')](function(_0x2563bc){var _0x3c3b06=_0x4adc9d[_0x813a('0x4a')]['get']({'plain':!![]});if(!_0x3c3b06)throw new Error(_0x813a('0x4b'));if(_0x3c3b06[_0x813a('0x4c')]===_0x813a('0x4a')){var _0x37d165=_0x2563bc[_0x813a('0x27')]({'plain':!![]});var _0x1316f7=_0x813a('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1316f7,'userProfileId':_0x3c3b06['userProfileId']},'raw':!![]})[_0x813a('0x25')](function(_0x243af7){if(_0x243af7&&_0x243af7[_0x813a('0x4d')]===0x0){return db[_0x813a('0x29')][_0x813a('0x48')]({'name':_0x37d165[_0x813a('0x2b')],'resourceId':_0x37d165['id'],'type':_0x243af7[_0x813a('0x2b')],'sectionId':_0x243af7['id']},{})['then'](function(){return _0x2563bc;});}else{return _0x2563bc;}})['catch'](function(_0x1e50a2){logger[_0x813a('0x4e')](_0x813a('0x4f'),_0x1e50a2);throw _0x1e50a2;});}return _0x2563bc;})[_0x813a('0x25')](respondWithResult(_0x28b947,0xc9))[_0x813a('0x43')](handleError(_0x28b947,null));};exports[_0x813a('0x50')]=function(_0x58dcb7,_0x202ba0){if(_0x58dcb7[_0x813a('0x49')]['id']){delete _0x58dcb7['body']['id'];}return db[_0x813a('0x2e')][_0x813a('0x47')]({'where':{'id':_0x58dcb7['params']['id']}})[_0x813a('0x25')](handleEntityNotFound(_0x202ba0,null))[_0x813a('0x25')](saveUpdates(_0x58dcb7[_0x813a('0x49')],null))[_0x813a('0x25')](respondWithResult(_0x202ba0,null))[_0x813a('0x43')](handleError(_0x202ba0,null));};exports[_0x813a('0x26')]=function(_0x83fc5e,_0x593f43){return db[_0x813a('0x2e')]['find']({'where':{'id':_0x83fc5e[_0x813a('0x44')]['id']}})[_0x813a('0x25')](handleEntityNotFound(_0x593f43,null))[_0x813a('0x25')](removeEntity(_0x593f43,null))[_0x813a('0x43')](handleError(_0x593f43,null));};exports[_0x813a('0x51')]=function(_0x902fdc,_0x2fbc61,_0x1ea50d){return db['SquareProject'][_0x813a('0x47')]({'where':{'id':_0x902fdc[_0x813a('0x44')]['id']}})['then'](handleEntityNotFound(_0x2fbc61,null))['then'](function(_0x682661){if(_0x682661){return _0x682661[_0x813a('0x51')](_0x902fdc[_0x813a('0x49')][_0x813a('0x52')],_['omit'](_0x902fdc[_0x813a('0x49')],[_0x813a('0x52'),'id'])||{});}})[_0x813a('0x25')](respondWithResult(_0x2fbc61,null))['catch'](handleError(_0x2fbc61,null));};exports[_0x813a('0x53')]=function(_0x79d92e,_0x17eb4d,_0x3882e9){return db[_0x813a('0x2e')][_0x813a('0x47')]({'where':{'id':_0x79d92e[_0x813a('0x44')]['id']}})[_0x813a('0x25')](handleEntityNotFound(_0x17eb4d,null))[_0x813a('0x25')](function(_0x15f6c5){if(_0x15f6c5){return _0x15f6c5[_0x813a('0x53')](_0x79d92e[_0x813a('0x32')][_0x813a('0x52')])[_0x813a('0x25')](function(){if(_[_0x813a('0x54')](_0x79d92e[_0x813a('0x32')]['ids'])){for(var _0x4ec4e3=0x0;_0x4ec4e3<_0x79d92e[_0x813a('0x32')][_0x813a('0x52')][_0x813a('0x39')];_0x4ec4e3+=0x1){socket['emit'](_0x813a('0x55'),{'UserId':Number(_0x79d92e[_0x813a('0x32')][_0x813a('0x52')][_0x4ec4e3]),'SquareProjectId':Number(_0x79d92e[_0x813a('0x44')]['id'])});}}else{socket['emit'](_0x813a('0x55'),{'UserId':Number(_0x79d92e[_0x813a('0x32')][_0x813a('0x52')]),'SquareProjectId':Number(_0x79d92e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x17eb4d,null))[_0x813a('0x43')](handleError(_0x17eb4d,null));};exports[_0x813a('0x56')]=function(_0x302bfe,_0x583258,_0x4f6605){var _0x5edb74={};var _0xd45f5d={};var _0x2cc3b7;var _0x4cc65e;return db[_0x813a('0x2e')][_0x813a('0x57')]({'where':{'id':_0x302bfe[_0x813a('0x44')]['id']}})[_0x813a('0x25')](handleEntityNotFound(_0x583258,null))['then'](function(_0x5dbbff){if(_0x5dbbff){_0x2cc3b7=_0x5dbbff;_0xd45f5d[_0x813a('0x37')]=_['keys'](db['User'][_0x813a('0x2f')]);_0xd45f5d['query']=_[_0x813a('0x33')](_0x302bfe['query']);_0xd45f5d[_0x813a('0x34')]=_[_0x813a('0x35')](_0xd45f5d[_0x813a('0x37')],_0xd45f5d[_0x813a('0x32')]);_0x5edb74[_0x813a('0x36')]=_[_0x813a('0x35')](_0xd45f5d[_0x813a('0x37')],qs[_0x813a('0x38')](_0x302bfe[_0x813a('0x32')]['fields']));_0x5edb74['attributes']=_0x5edb74[_0x813a('0x36')][_0x813a('0x39')]?_0x5edb74[_0x813a('0x36')]:_0xd45f5d['model'];_0x5edb74[_0x813a('0x58')]=qs[_0x813a('0x59')](_0x302bfe[_0x813a('0x32')][_0x813a('0x59')]);_0x5edb74[_0x813a('0x3c')]=qs[_0x813a('0x34')](_[_0x813a('0x5a')](_0x302bfe['query'],_0xd45f5d[_0x813a('0x34')]));if(_0x302bfe[_0x813a('0x32')][_0x813a('0x3d')]){_0x5edb74[_0x813a('0x3c')]=_['merge'](_0x5edb74[_0x813a('0x3c')],{'$or':_['map'](_0x5edb74['attributes'],function(_0x341bad){var _0x50d36e={};_0x50d36e[_0x341bad]={'$like':'%'+_0x302bfe[_0x813a('0x32')][_0x813a('0x3d')]+'%'};return _0x50d36e;})});}_0x5edb74=_[_0x813a('0x3e')]({},_0x5edb74,_0x302bfe[_0x813a('0x46')]);return _0x2cc3b7['getUsers'](_0x5edb74);}})['then'](function(_0x2edbdb){if(_0x2edbdb){_0x4cc65e=_0x2edbdb['length'];if(!_0x302bfe[_0x813a('0x32')][_0x813a('0x3a')](_0x813a('0x3b'))){_0x5edb74[_0x813a('0x20')]=qs[_0x813a('0x20')](_0x302bfe[_0x813a('0x32')][_0x813a('0x20')]);_0x5edb74['offset']=qs['offset'](_0x302bfe[_0x813a('0x32')][_0x813a('0x1f')]);}return _0x2cc3b7['getUsers'](_0x5edb74);}})['then'](function(_0x4533fc){if(_0x4533fc){return _0x4533fc?{'count':_0x4cc65e,'rows':_0x4533fc}:null;}})[_0x813a('0x25')](respondWithResult(_0x583258,null))[_0x813a('0x43')](handleError(_0x583258,null));}; \ No newline at end of file +var _0x4775=['filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','fields','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addUsers','ids','omit','removeUsers','isArray','emit','getUsers','findOne','User','options','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','model','query','keys'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x4775,0x8b));var _0x5477=function(_0x2390bd,_0x212fbd){_0x2390bd=_0x2390bd-0x0;var _0x3a969d=_0x4775[_0x2390bd];return _0x3a969d;};'use strict';var pdf=require(_0x5477('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5477('0x1'));var zipdir=require(_0x5477('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5477('0x3'));var BPromise=require(_0x5477('0x4'));var Mustache=require(_0x5477('0x5'));var util=require(_0x5477('0x6'));var path=require(_0x5477('0x7'));var sox=require(_0x5477('0x8'));var csv=require(_0x5477('0x9'));var ejs=require(_0x5477('0xa'));var fs=require('fs');var _=require(_0x5477('0xb'));var squel=require(_0x5477('0xc'));var crypto=require(_0x5477('0xd'));var jsforce=require(_0x5477('0xe'));var deskjs=require(_0x5477('0xf'));var toCsv=require(_0x5477('0x9'));var querystring=require(_0x5477('0x10'));var Papa=require(_0x5477('0x11'));var Redis=require('ioredis');var authService=require(_0x5477('0x12'));var qs=require(_0x5477('0x13'));var as=require(_0x5477('0x14'));var hardwareService=require(_0x5477('0x15'));var logger=require(_0x5477('0x16'))('api');var utils=require(_0x5477('0x17'));var config=require(_0x5477('0x18'));var db=require(_0x5477('0x19'))['db'];config[_0x5477('0x1a')]=_[_0x5477('0x1b')](config[_0x5477('0x1a')],{'host':_0x5477('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5477('0x1a')]));require(_0x5477('0x1d'))[_0x5477('0x1e')](socket);function respondWithStatusCode(_0x598be1,_0x3b8cea){_0x3b8cea=_0x3b8cea||0xcc;return function(_0xfe5ac9){if(_0xfe5ac9){return _0x598be1[_0x5477('0x1f')](_0x3b8cea);}return _0x598be1[_0x5477('0x20')](_0x3b8cea)[_0x5477('0x21')]();};}function respondWithResult(_0x3afae8,_0xcce307){_0xcce307=_0xcce307||0xc8;return function(_0x52d748){if(_0x52d748){return _0x3afae8[_0x5477('0x20')](_0xcce307)['json'](_0x52d748);}};}function respondWithFilteredResult(_0x4d9426,_0x251f68){return function(_0x55519f){if(_0x55519f){var _0x48b26c=_0x55519f[_0x5477('0x22')],_0x3d0ade=_0x251f68[_0x5477('0x23')],_0x4e538c=_0x251f68[_0x5477('0x23')]+_0x251f68[_0x5477('0x24')],_0x2095b1;if(_0x4e538c>=_0x48b26c){_0x4e538c=_0x48b26c;_0x2095b1=0xc8;}else{_0x2095b1=0xce;}_0x4d9426[_0x5477('0x20')](_0x2095b1);return _0x4d9426[_0x5477('0x25')](_0x5477('0x26'),_0x3d0ade+'-'+_0x4e538c+'/'+_0x48b26c)[_0x5477('0x27')](_0x55519f);}return null;};}function patchUpdates(_0x33af1c){return function(_0x3a9546){try{jsonpatch[_0x5477('0x28')](_0x3a9546,_0x33af1c,!![]);}catch(_0x2f1a9e){return BPromise[_0x5477('0x29')](_0x2f1a9e);}return _0x3a9546['save']();};}function saveUpdates(_0xba0113,_0x1054e7){return function(_0xdb458e){if(_0xdb458e){return _0xdb458e['update'](_0xba0113)[_0x5477('0x2a')](function(_0x5e8614){return _0x5e8614;});}return null;};}function removeEntity(_0xb1095,_0x38d5b7){return function(_0x21af31){if(_0x21af31){return _0x21af31[_0x5477('0x2b')]()[_0x5477('0x2a')](function(){var _0x45f112=_0x21af31[_0x5477('0x2c')]({'plain':!![]});var _0x6cd965=_0x5477('0x2d');return db[_0x5477('0x2e')][_0x5477('0x2b')]({'where':{'type':_0x6cd965,'resourceId':_0x45f112['id']}})[_0x5477('0x2a')](function(){return _0x21af31;});})['then'](function(){_0xb1095[_0x5477('0x20')](0xcc)[_0x5477('0x21')]();});}};}function handleEntityNotFound(_0x1bfc5c,_0x45f071){return function(_0x460656){if(!_0x460656){_0x1bfc5c[_0x5477('0x1f')](0x194);}return _0x460656;};}function handleError(_0x33d9cb,_0x430109){_0x430109=_0x430109||0x1f4;return function(_0x136391){logger[_0x5477('0x2f')](_0x136391[_0x5477('0x30')]);if(_0x136391[_0x5477('0x31')]){delete _0x136391[_0x5477('0x31')];}_0x33d9cb[_0x5477('0x20')](_0x430109)['send'](_0x136391);};}exports[_0x5477('0x32')]=function(_0x1f614f,_0x4e0004){var _0x3a16a1={},_0x50db94={},_0x48633c={'count':0x0,'rows':[]};var _0x3814f2=_[_0x5477('0x33')](db[_0x5477('0x34')][_0x5477('0x35')],function(_0x92a5f9){return{'name':_0x92a5f9[_0x5477('0x36')],'type':_0x92a5f9[_0x5477('0x37')]['key']};});_0x50db94[_0x5477('0x38')]=_[_0x5477('0x33')](_0x3814f2,_0x5477('0x31'));_0x50db94[_0x5477('0x39')]=_[_0x5477('0x3a')](_0x1f614f['query']);_0x50db94[_0x5477('0x3b')]=_[_0x5477('0x3c')](_0x50db94[_0x5477('0x38')],_0x50db94[_0x5477('0x39')]);_0x3a16a1['attributes']=_[_0x5477('0x3c')](_0x50db94['model'],qs['fields'](_0x1f614f['query']['fields']));_0x3a16a1[_0x5477('0x3d')]=_0x3a16a1['attributes'][_0x5477('0x3e')]?_0x3a16a1[_0x5477('0x3d')]:_0x50db94[_0x5477('0x38')];if(!_0x1f614f[_0x5477('0x39')][_0x5477('0x3f')](_0x5477('0x40'))){_0x3a16a1[_0x5477('0x24')]=qs['limit'](_0x1f614f['query'][_0x5477('0x24')]);_0x3a16a1['offset']=qs[_0x5477('0x23')](_0x1f614f[_0x5477('0x39')][_0x5477('0x23')]);}_0x3a16a1[_0x5477('0x41')]=qs[_0x5477('0x42')](_0x1f614f[_0x5477('0x39')][_0x5477('0x42')]);_0x3a16a1['where']=qs[_0x5477('0x3b')](_[_0x5477('0x43')](_0x1f614f[_0x5477('0x39')],_0x50db94[_0x5477('0x3b')]),_0x3814f2);if(_0x1f614f[_0x5477('0x39')][_0x5477('0x44')]){_0x3a16a1[_0x5477('0x45')]=_[_0x5477('0x46')](_0x3a16a1['where'],{'$or':_['map'](_0x3814f2,function(_0x253ecc){if(_0x253ecc[_0x5477('0x37')]!==_0x5477('0x47')){var _0x1f29f1={};_0x1f29f1[_0x253ecc[_0x5477('0x31')]]={'$like':'%'+_0x1f614f[_0x5477('0x39')][_0x5477('0x44')]+'%'};return _0x1f29f1;}})});}_0x3a16a1=_[_0x5477('0x46')]({},_0x3a16a1,_0x1f614f['options']);var _0xf383a9={'where':_0x3a16a1['where']};return db['SquareProject'][_0x5477('0x22')](_0xf383a9)[_0x5477('0x2a')](function(_0x31e5b4){_0x48633c['count']=_0x31e5b4;if(_0x1f614f['query'][_0x5477('0x48')]){_0x3a16a1[_0x5477('0x49')]=[{'all':!![]}];}return db['SquareProject'][_0x5477('0x4a')](_0x3a16a1);})[_0x5477('0x2a')](function(_0x47bd68){_0x48633c[_0x5477('0x4b')]=_0x47bd68;return _0x48633c;})[_0x5477('0x2a')](respondWithFilteredResult(_0x4e0004,_0x3a16a1))['catch'](handleError(_0x4e0004,null));};exports['show']=function(_0x7a4b29,_0x5870b5){var _0xe3eddc={'raw':![],'where':{'id':_0x7a4b29[_0x5477('0x4c')]['id']}},_0x10f4d9={};_0x10f4d9[_0x5477('0x38')]=_[_0x5477('0x3a')](db[_0x5477('0x34')][_0x5477('0x35')]);_0x10f4d9[_0x5477('0x39')]=_[_0x5477('0x3a')](_0x7a4b29['query']);_0x10f4d9[_0x5477('0x3b')]=_['intersection'](_0x10f4d9['model'],_0x10f4d9[_0x5477('0x39')]);_0xe3eddc[_0x5477('0x3d')]=_['intersection'](_0x10f4d9[_0x5477('0x38')],qs[_0x5477('0x4d')](_0x7a4b29[_0x5477('0x39')][_0x5477('0x4d')]));_0xe3eddc[_0x5477('0x3d')]=_0xe3eddc['attributes'][_0x5477('0x3e')]?_0xe3eddc[_0x5477('0x3d')]:_0x10f4d9[_0x5477('0x38')];if(_0x7a4b29[_0x5477('0x39')][_0x5477('0x48')]){_0xe3eddc[_0x5477('0x49')]=[{'all':!![]}];}_0xe3eddc=_[_0x5477('0x46')]({},_0xe3eddc,_0x7a4b29['options']);return db[_0x5477('0x34')][_0x5477('0x4e')](_0xe3eddc)[_0x5477('0x2a')](handleEntityNotFound(_0x5870b5,null))[_0x5477('0x2a')](respondWithResult(_0x5870b5,null))[_0x5477('0x4f')](handleError(_0x5870b5,null));};exports[_0x5477('0x50')]=function(_0x46bba8,_0x447bcd){return db[_0x5477('0x34')][_0x5477('0x50')](_0x46bba8['body'],{})['then'](function(_0x35f80e){var _0x3a995b=_0x46bba8['user'][_0x5477('0x2c')]({'plain':!![]});if(!_0x3a995b)throw new Error(_0x5477('0x51'));if(_0x3a995b[_0x5477('0x52')]===_0x5477('0x53')){var _0x10c55f=_0x35f80e['get']({'plain':!![]});var _0x3c6a73=_0x5477('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x3c6a73,'userProfileId':_0x3a995b[_0x5477('0x54')]},'raw':!![]})[_0x5477('0x2a')](function(_0x2e75c6){if(_0x2e75c6&&_0x2e75c6[_0x5477('0x55')]===0x0){return db[_0x5477('0x2e')][_0x5477('0x50')]({'name':_0x10c55f[_0x5477('0x31')],'resourceId':_0x10c55f['id'],'type':_0x2e75c6['name'],'sectionId':_0x2e75c6['id']},{})['then'](function(){return _0x35f80e;});}else{return _0x35f80e;}})['catch'](function(_0x43a225){logger[_0x5477('0x2f')](_0x5477('0x56'),_0x43a225);throw _0x43a225;});}return _0x35f80e;})[_0x5477('0x2a')](respondWithResult(_0x447bcd,0xc9))[_0x5477('0x4f')](handleError(_0x447bcd,null));};exports[_0x5477('0x57')]=function(_0x5e0cf1,_0x104cf){if(_0x5e0cf1[_0x5477('0x58')]['id']){delete _0x5e0cf1[_0x5477('0x58')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x5e0cf1[_0x5477('0x4c')]['id']}})[_0x5477('0x2a')](handleEntityNotFound(_0x104cf,null))[_0x5477('0x2a')](saveUpdates(_0x5e0cf1[_0x5477('0x58')],null))[_0x5477('0x2a')](respondWithResult(_0x104cf,null))['catch'](handleError(_0x104cf,null));};exports[_0x5477('0x2b')]=function(_0x12c20d,_0x2112c5){return db[_0x5477('0x34')]['find']({'where':{'id':_0x12c20d['params']['id']}})[_0x5477('0x2a')](handleEntityNotFound(_0x2112c5,null))[_0x5477('0x2a')](removeEntity(_0x2112c5,null))[_0x5477('0x4f')](handleError(_0x2112c5,null));};exports['addUsers']=function(_0xb7b913,_0x252862,_0x2888cb){return db[_0x5477('0x34')]['find']({'where':{'id':_0xb7b913[_0x5477('0x4c')]['id']}})['then'](handleEntityNotFound(_0x252862,null))[_0x5477('0x2a')](function(_0x4e5835){if(_0x4e5835){return _0x4e5835[_0x5477('0x59')](_0xb7b913['body'][_0x5477('0x5a')],_[_0x5477('0x5b')](_0xb7b913[_0x5477('0x58')],['ids','id'])||{});}})[_0x5477('0x2a')](respondWithResult(_0x252862,null))[_0x5477('0x4f')](handleError(_0x252862,null));};exports[_0x5477('0x5c')]=function(_0x2f255f,_0x46d137,_0x3d671c){return db[_0x5477('0x34')][_0x5477('0x4e')]({'where':{'id':_0x2f255f[_0x5477('0x4c')]['id']}})[_0x5477('0x2a')](handleEntityNotFound(_0x46d137,null))[_0x5477('0x2a')](function(_0x2bcc51){if(_0x2bcc51){return _0x2bcc51[_0x5477('0x5c')](_0x2f255f[_0x5477('0x39')][_0x5477('0x5a')])[_0x5477('0x2a')](function(){if(_[_0x5477('0x5d')](_0x2f255f[_0x5477('0x39')][_0x5477('0x5a')])){for(var _0x145ff2=0x0;_0x145ff2<_0x2f255f[_0x5477('0x39')][_0x5477('0x5a')][_0x5477('0x3e')];_0x145ff2+=0x1){socket[_0x5477('0x5e')]('userSquareProject:remove',{'UserId':Number(_0x2f255f[_0x5477('0x39')][_0x5477('0x5a')][_0x145ff2]),'SquareProjectId':Number(_0x2f255f[_0x5477('0x4c')]['id'])});}}else{socket[_0x5477('0x5e')]('userSquareProject:remove',{'UserId':Number(_0x2f255f['query'][_0x5477('0x5a')]),'SquareProjectId':Number(_0x2f255f[_0x5477('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x46d137,null))[_0x5477('0x4f')](handleError(_0x46d137,null));};exports[_0x5477('0x5f')]=function(_0x4edc8e,_0x385dd2,_0x326b06){var _0x1fcc82={};var _0x32f181={};var _0x3c1cab;var _0x52a277;return db['SquareProject'][_0x5477('0x60')]({'where':{'id':_0x4edc8e[_0x5477('0x4c')]['id']}})[_0x5477('0x2a')](handleEntityNotFound(_0x385dd2,null))[_0x5477('0x2a')](function(_0x27ff52){if(_0x27ff52){_0x3c1cab=_0x27ff52;_0x32f181[_0x5477('0x38')]=_[_0x5477('0x3a')](db[_0x5477('0x61')][_0x5477('0x35')]);_0x32f181[_0x5477('0x39')]=_[_0x5477('0x3a')](_0x4edc8e[_0x5477('0x39')]);_0x32f181[_0x5477('0x3b')]=_[_0x5477('0x3c')](_0x32f181[_0x5477('0x38')],_0x32f181[_0x5477('0x39')]);_0x1fcc82[_0x5477('0x3d')]=_[_0x5477('0x3c')](_0x32f181[_0x5477('0x38')],qs['fields'](_0x4edc8e[_0x5477('0x39')][_0x5477('0x4d')]));_0x1fcc82[_0x5477('0x3d')]=_0x1fcc82['attributes']['length']?_0x1fcc82['attributes']:_0x32f181['model'];_0x1fcc82[_0x5477('0x41')]=qs[_0x5477('0x42')](_0x4edc8e[_0x5477('0x39')]['sort']);_0x1fcc82[_0x5477('0x45')]=qs[_0x5477('0x3b')](_[_0x5477('0x43')](_0x4edc8e[_0x5477('0x39')],_0x32f181[_0x5477('0x3b')]));if(_0x4edc8e[_0x5477('0x39')]['filter']){_0x1fcc82[_0x5477('0x45')]=_['merge'](_0x1fcc82[_0x5477('0x45')],{'$or':_[_0x5477('0x33')](_0x1fcc82['attributes'],function(_0x1cbc62){var _0x2c2dda={};_0x2c2dda[_0x1cbc62]={'$like':'%'+_0x4edc8e['query'][_0x5477('0x44')]+'%'};return _0x2c2dda;})});}_0x1fcc82=_[_0x5477('0x46')]({},_0x1fcc82,_0x4edc8e[_0x5477('0x62')]);return _0x3c1cab[_0x5477('0x5f')](_0x1fcc82);}})[_0x5477('0x2a')](function(_0xa8a72c){if(_0xa8a72c){_0x52a277=_0xa8a72c[_0x5477('0x3e')];if(!_0x4edc8e[_0x5477('0x39')][_0x5477('0x3f')](_0x5477('0x40'))){_0x1fcc82[_0x5477('0x24')]=qs[_0x5477('0x24')](_0x4edc8e[_0x5477('0x39')]['limit']);_0x1fcc82[_0x5477('0x23')]=qs[_0x5477('0x23')](_0x4edc8e[_0x5477('0x39')][_0x5477('0x23')]);}return _0x3c1cab[_0x5477('0x5f')](_0x1fcc82);}})[_0x5477('0x2a')](function(_0xcb0900){if(_0xcb0900){return _0xcb0900?{'count':_0x52a277,'rows':_0xcb0900}:null;}})[_0x5477('0x2a')](respondWithResult(_0x385dd2,null))['catch'](handleError(_0x385dd2,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e212d8d..fe10296 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 _0xcafb=['update','remove','emit','exports','events','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcafb,0x16c));var _0xbcaf=function(_0x38512d,_0xfe6fc3){_0x38512d=_0x38512d-0x0;var _0x2a8ec8=_0xcafb[_0x38512d];return _0x2a8ec8;};'use strict';var EventEmitter=require(_0xbcaf('0x0'));var SquareProject=require(_0xbcaf('0x1'))['db'][_0xbcaf('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xbcaf('0x3')](0x0);var events={'afterCreate':_0xbcaf('0x4'),'afterUpdate':_0xbcaf('0x5'),'afterDestroy':_0xbcaf('0x6')};function emitEvent(_0x3bc156){return function(_0x154ce3,_0x1f6b2f,_0x55ee36){SquareProjectEvents[_0xbcaf('0x7')](_0x3bc156+':'+_0x154ce3['id'],_0x154ce3);SquareProjectEvents[_0xbcaf('0x7')](_0x3bc156,_0x154ce3);_0x55ee36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xbcaf('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x8bfe=['../../mysqldb','SquareProject','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8bfe,0x1a6));var _0xe8bf=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0x8bfe[_0xb5fc3e];return _0x2efc3c;};'use strict';var EventEmitter=require(_0xe8bf('0x0'));var SquareProject=require(_0xe8bf('0x1'))['db'][_0xe8bf('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe8bf('0x3'),'afterUpdate':_0xe8bf('0x4'),'afterDestroy':_0xe8bf('0x5')};function emitEvent(_0x4bdabd){return function(_0xcbba86,_0x50ba82,_0x13135a){SquareProjectEvents[_0xe8bf('0x6')](_0x4bdabd+':'+_0xcbba86['id'],_0xcbba86);SquareProjectEvents['emit'](_0x4bdabd,_0xcbba86);_0x13135a(null);};}for(var e in events){if(events[_0xe8bf('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xe8bf('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index dc102ba..25f2331 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 _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareProject','square_projects','lodash','util'];(function(_0x18341e,_0x382e64){var _0x33d786=function(_0x41e06b){while(--_0x41e06b){_0x18341e['push'](_0x18341e['shift']());}};_0x33d786(++_0x382e64);}(_0xdb28,0x106));var _0x8db2=function(_0x3a5d82,_0x3c5f96){_0x3a5d82=_0x3a5d82-0x0;var _0x2faa9c=_0xdb28[_0x3a5d82];return _0x2faa9c;};'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('./squareProject.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['exports','define','SquareProject','square_projects','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareProject.attributes'];(function(_0x4c0df6,_0x102c54){var _0x475448=function(_0x1be1c0){while(--_0x1be1c0){_0x4c0df6['push'](_0x4c0df6['shift']());}};_0x475448(++_0x102c54);}(_0x2ef3,0xba));var _0x32ef=function(_0x2739d8,_0x1477af){_0x2739d8=_0x2739d8-0x0;var _0x55530e=_0x2ef3[_0x2739d8];return _0x55530e;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 43508ef..3ae43dc 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 _0x69f6=['stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s'];(function(_0x201ff4,_0x54c34e){var _0x493821=function(_0x2f1f18){while(--_0x2f1f18){_0x201ff4['push'](_0x201ff4['shift']());}};_0x493821(++_0x54c34e);}(_0x69f6,0x177));var _0x669f=function(_0x1e1026,_0x549bfd){_0x1e1026=_0x1e1026-0x0;var _0x3dfd47=_0x69f6[_0x1e1026];return _0x3dfd47;};'use strict';var _=require(_0x669f('0x0'));var util=require(_0x669f('0x1'));var moment=require(_0x669f('0x2'));var BPromise=require('bluebird');var rs=require(_0x669f('0x3'));var fs=require('fs');var Redis=require(_0x669f('0x4'));var db=require(_0x669f('0x5'))['db'];var utils=require(_0x669f('0x6'));var logger=require('../../config/logger')(_0x669f('0x7'));var config=require(_0x669f('0x8'));var jayson=require(_0x669f('0x9'));var client=jayson['client'][_0x669f('0xa')]({'port':0x232a});config[_0x669f('0xb')]=_['defaults'](config[_0x669f('0xb')],{'host':_0x669f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x669f('0xb')]));require(_0x669f('0xd'))[_0x669f('0xe')](socket);function respondWithRpcPromise(_0x25b8b1,_0x3d5a50,_0x78b807){return new BPromise(function(_0x1134e3,_0x2400f8){return client[_0x669f('0xf')](_0x25b8b1,_0x78b807)['then'](function(_0x4efbda){logger[_0x669f('0x10')](_0x669f('0x11'),_0x3d5a50,_0x669f('0x12'));logger[_0x669f('0x13')](_0x669f('0x14'),_0x3d5a50,_0x669f('0x12'),JSON[_0x669f('0x15')](_0x4efbda));if(_0x4efbda[_0x669f('0x16')]){if(_0x4efbda[_0x669f('0x16')][_0x669f('0x17')]===0x1f4){logger[_0x669f('0x16')]('SquareProject,\x20%s,\x20%s',_0x3d5a50,_0x4efbda['error']['message']);return _0x2400f8(_0x4efbda['error'][_0x669f('0x18')]);}logger[_0x669f('0x16')](_0x669f('0x11'),_0x3d5a50,_0x4efbda[_0x669f('0x16')][_0x669f('0x18')]);return _0x1134e3(_0x4efbda[_0x669f('0x16')]['message']);}else{logger[_0x669f('0x10')]('SquareProject,\x20%s,\x20%s',_0x3d5a50,'request\x20sent');_0x1134e3(_0x4efbda[_0x669f('0x19')][_0x669f('0x18')]);}})[_0x669f('0x1a')](function(_0x1591c3){logger['error'](_0x669f('0x11'),_0x3d5a50,_0x1591c3);_0x2400f8(_0x1591c3);});});}exports[_0x669f('0x1b')]=function(_0x3fb9ca){var _0x39d9e2=this;return new Promise(function(_0x523f8f,_0x27fca5){return db[_0x669f('0x1c')][_0x669f('0x1d')]({'raw':_0x3fb9ca['options']?_0x3fb9ca[_0x669f('0x1e')][_0x669f('0x1f')]===undefined?!![]:![]:!![],'where':_0x3fb9ca[_0x669f('0x1e')]?_0x3fb9ca[_0x669f('0x1e')]['where']||null:null,'attributes':_0x3fb9ca['options']?_0x3fb9ca['options'][_0x669f('0x20')]||null:null,'include':_0x3fb9ca[_0x669f('0x1e')]?_0x3fb9ca[_0x669f('0x1e')][_0x669f('0x21')]?_[_0x669f('0x22')](_0x3fb9ca['options']['include'],function(_0x2ffb93){return{'model':db[_0x2ffb93['model']],'as':_0x2ffb93['as'],'attributes':_0x2ffb93[_0x669f('0x20')],'include':_0x2ffb93['include']?_[_0x669f('0x22')](_0x2ffb93[_0x669f('0x21')],function(_0x3c49f2){return{'model':db[_0x3c49f2[_0x669f('0x23')]],'as':_0x3c49f2['as'],'attributes':_0x3c49f2['attributes'],'include':_0x3c49f2[_0x669f('0x21')]?_['map'](_0x3c49f2[_0x669f('0x21')],function(_0x5b33d8){return{'model':db[_0x5b33d8[_0x669f('0x23')]],'as':_0x5b33d8['as'],'attributes':_0x5b33d8[_0x669f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x220b83){logger[_0x669f('0x10')](_0x669f('0x1b'),_0x3fb9ca);logger[_0x669f('0x13')]('ShowSquareProject',_0x3fb9ca,JSON['stringify'](_0x220b83));_0x523f8f(_0x220b83);})[_0x669f('0x1a')](function(_0x5f2f80){logger[_0x669f('0x16')](_0x669f('0x1b'),_0x5f2f80[_0x669f('0x18')],_0x3fb9ca);_0x27fca5(_0x39d9e2['error'](0x1f4,_0x5f2f80['message']));});});}; \ No newline at end of file +var _0x1483=['options','where','include','map','model','attributes','then','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','SquareProject,\x20%s,\x20%s','result','ShowSquareProject','SquareProject','find'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x1483,0x171));var _0x3148=function(_0x25ba6a,_0x4422d6){_0x25ba6a=_0x25ba6a-0x0;var _0x1be09a=_0x1483[_0x25ba6a];return _0x1be09a;};'use strict';var _=require(_0x3148('0x0'));var util=require('util');var moment=require(_0x3148('0x1'));var BPromise=require(_0x3148('0x2'));var rs=require(_0x3148('0x3'));var fs=require('fs');var Redis=require(_0x3148('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3148('0x5'))(_0x3148('0x6'));var config=require(_0x3148('0x7'));var jayson=require(_0x3148('0x8'));var client=jayson['client'][_0x3148('0x9')]({'port':0x232a});config[_0x3148('0xa')]=_[_0x3148('0xb')](config[_0x3148('0xa')],{'host':_0x3148('0xc'),'port':0x18eb});var socket=require(_0x3148('0xd'))(new Redis(config[_0x3148('0xa')]));require('./squareProject.socket')[_0x3148('0xe')](socket);function respondWithRpcPromise(_0x39e7b6,_0x4e072a,_0x2e24c1){return new BPromise(function(_0x572a8f,_0x168327){return client[_0x3148('0xf')](_0x39e7b6,_0x2e24c1)['then'](function(_0x1ec15a){logger[_0x3148('0x10')]('SquareProject,\x20%s,\x20%s',_0x4e072a,'request\x20sent');logger[_0x3148('0x11')](_0x3148('0x12'),_0x4e072a,_0x3148('0x13'),JSON['stringify'](_0x1ec15a));if(_0x1ec15a['error']){if(_0x1ec15a[_0x3148('0x14')]['code']===0x1f4){logger[_0x3148('0x14')]('SquareProject,\x20%s,\x20%s',_0x4e072a,_0x1ec15a[_0x3148('0x14')][_0x3148('0x15')]);return _0x168327(_0x1ec15a['error'][_0x3148('0x15')]);}logger[_0x3148('0x14')](_0x3148('0x16'),_0x4e072a,_0x1ec15a[_0x3148('0x14')]['message']);return _0x572a8f(_0x1ec15a[_0x3148('0x14')][_0x3148('0x15')]);}else{logger[_0x3148('0x10')](_0x3148('0x16'),_0x4e072a,_0x3148('0x13'));_0x572a8f(_0x1ec15a[_0x3148('0x17')][_0x3148('0x15')]);}})['catch'](function(_0x2aea57){logger[_0x3148('0x14')](_0x3148('0x16'),_0x4e072a,_0x2aea57);_0x168327(_0x2aea57);});});}exports[_0x3148('0x18')]=function(_0x525985){var _0x371b84=this;return new Promise(function(_0x4faf28,_0x4d3907){return db[_0x3148('0x19')][_0x3148('0x1a')]({'raw':_0x525985[_0x3148('0x1b')]?_0x525985[_0x3148('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x525985[_0x3148('0x1b')]?_0x525985['options'][_0x3148('0x1c')]||null:null,'attributes':_0x525985[_0x3148('0x1b')]?_0x525985[_0x3148('0x1b')]['attributes']||null:null,'include':_0x525985[_0x3148('0x1b')]?_0x525985[_0x3148('0x1b')][_0x3148('0x1d')]?_[_0x3148('0x1e')](_0x525985['options'][_0x3148('0x1d')],function(_0x1690d6){return{'model':db[_0x1690d6[_0x3148('0x1f')]],'as':_0x1690d6['as'],'attributes':_0x1690d6[_0x3148('0x20')],'include':_0x1690d6['include']?_['map'](_0x1690d6[_0x3148('0x1d')],function(_0x1fc92c){return{'model':db[_0x1fc92c[_0x3148('0x1f')]],'as':_0x1fc92c['as'],'attributes':_0x1fc92c[_0x3148('0x20')],'include':_0x1fc92c['include']?_[_0x3148('0x1e')](_0x1fc92c[_0x3148('0x1d')],function(_0x8cfecd){return{'model':db[_0x8cfecd[_0x3148('0x1f')]],'as':_0x8cfecd['as'],'attributes':_0x8cfecd[_0x3148('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3148('0x21')](function(_0x4aa342){logger[_0x3148('0x10')](_0x3148('0x18'),_0x525985);logger['debug'](_0x3148('0x18'),_0x525985,JSON[_0x3148('0x22')](_0x4aa342));_0x4faf28(_0x4aa342);})[_0x3148('0x23')](function(_0x4c4ba9){logger['error'](_0x3148('0x18'),_0x4c4ba9[_0x3148('0x15')],_0x525985);_0x4d3907(_0x371b84[_0x3148('0x14')](0x1f4,_0x4c4ba9['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 40d62e8..fd1e9cb 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 _0xadb5=['update','emit','register','length','squareProject:','save'];(function(_0x230e37,_0x2b416c){var _0x4266d1=function(_0x4be00d){while(--_0x4be00d){_0x230e37['push'](_0x230e37['shift']());}};_0x4266d1(++_0x2b416c);}(_0xadb5,0xad));var _0x5adb=function(_0xd07679,_0x29bdf1){_0xd07679=_0xd07679-0x0;var _0x5b4ed0=_0xadb5[_0xd07679];return _0x5b4ed0;};'use strict';var SquareProjectEvents=require('./squareProject.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(){SquareProjectEvents['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);SquareProjectEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file +var _0x5fab=['emit','removeListener','register','length','./squareProject.events','save','update'];(function(_0x2051bd,_0x4b1e3e){var _0x512fcf=function(_0x264db4){while(--_0x264db4){_0x2051bd['push'](_0x2051bd['shift']());}};_0x512fcf(++_0x4b1e3e);}(_0x5fab,0x177));var _0xb5fa=function(_0x3a196b,_0x1a03c4){_0x3a196b=_0x3a196b-0x0;var _0x192dd8=_0x5fab[_0x3a196b];return _0x192dd8;};'use strict';var SquareProjectEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){SquareProjectEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('squareProject:'+_0x1aec3e,_0x44df89);SquareProjectEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 22f809f..f1c3a32 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 _0x5f5d=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','download','post','create','/:id','update','delete','/:id/delete','destroy','exports','multer','util','path'];(function(_0x7b1a9e,_0x2784d0){var _0x2f6709=function(_0x148d5f){while(--_0x148d5f){_0x7b1a9e['push'](_0x7b1a9e['shift']());}};_0x2f6709(++_0x2784d0);}(_0x5f5d,0x75));var _0xd5f5=function(_0x2fa47f,_0x77acc8){_0x2fa47f=_0x2fa47f-0x0;var _0x13d706=_0x5f5d[_0x2fa47f];return _0x13d706;};'use strict';var multer=require(_0xd5f5('0x0'));var util=require(_0xd5f5('0x1'));var path=require(_0xd5f5('0x2'));var timeout=require(_0xd5f5('0x3'));var express=require(_0xd5f5('0x4'));var router=express['Router']();var auth=require(_0xd5f5('0x5'));var interaction=require(_0xd5f5('0x6'));var config=require('../../config/environment');var controller=require('./squareRecording.controller');router[_0xd5f5('0x7')]('/',auth[_0xd5f5('0x8')](),controller[_0xd5f5('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd5f5('0xa')]);router[_0xd5f5('0x7')]('/:id/download',auth[_0xd5f5('0x8')](),controller[_0xd5f5('0xb')]);router[_0xd5f5('0xc')]('/',auth['isAuthenticated'](),controller[_0xd5f5('0xd')]);router['put'](_0xd5f5('0xe'),auth['isAuthenticated'](),controller[_0xd5f5('0xf')]);router[_0xd5f5('0x10')](_0xd5f5('0x11'),auth[_0xd5f5('0x8')](),controller[_0xd5f5('0x12')]);module[_0xd5f5('0x13')]=router; \ No newline at end of file +var _0xb05a=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','create','update','delete','/:id/delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x183259,_0x1d01ba){var _0x13fc5e=function(_0x5cbbe9){while(--_0x5cbbe9){_0x183259['push'](_0x183259['shift']());}};_0x13fc5e(++_0x1d01ba);}(_0xb05a,0x67));var _0xab05=function(_0x4d7b67,_0x5b3c9f){_0x4d7b67=_0x4d7b67-0x0;var _0x2d85e6=_0xb05a[_0x4d7b67];return _0x2d85e6;};'use strict';var multer=require('multer');var util=require(_0xab05('0x0'));var path=require(_0xab05('0x1'));var timeout=require(_0xab05('0x2'));var express=require(_0xab05('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xab05('0x4'));var config=require(_0xab05('0x5'));var controller=require(_0xab05('0x6'));router[_0xab05('0x7')]('/',auth[_0xab05('0x8')](),controller[_0xab05('0x9')]);router[_0xab05('0x7')](_0xab05('0xa'),auth[_0xab05('0x8')](),controller['show']);router[_0xab05('0x7')](_0xab05('0xb'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xab05('0xc')]);router['put'](_0xab05('0xa'),auth['isAuthenticated'](),controller[_0xab05('0xd')]);router[_0xab05('0xe')](_0xab05('0xf'),auth[_0xab05('0x8')](),controller[_0xab05('0x10')]);module[_0xab05('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index bb2fd1a..a0dc572 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 _0xbf44=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x398b3d,_0x2f497e){var _0x20b1cf=function(_0x23a3ea){while(--_0x23a3ea){_0x398b3d['push'](_0x398b3d['shift']());}};_0x20b1cf(++_0x2f497e);}(_0xbf44,0xa0));var _0x4bf4=function(_0x8f52c7,_0x10f91c){_0x8f52c7=_0x8f52c7-0x0;var _0x48bb92=_0xbf44[_0x8f52c7];return _0x48bb92;};'use strict';var Sequelize=require(_0x4bf4('0x0'));module[_0x4bf4('0x1')]={'uniqueid':{'type':Sequelize[_0x4bf4('0x2')]},'callerid':{'type':Sequelize[_0x4bf4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4bf4('0x2')]},'extension':{'type':Sequelize[_0x4bf4('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x4bf4('0x2')]},'saveName':{'type':Sequelize[_0x4bf4('0x2')]},'filename':{'type':Sequelize[_0x4bf4('0x2')]},'savePath':{'type':Sequelize[_0x4bf4('0x2')]},'format':{'type':Sequelize[_0x4bf4('0x3')],'get':function(){var _0x655adf='';var _0x5389ac=this[_0x4bf4('0x4')](_0x4bf4('0x5'));if(_0x5389ac){_0x655adf=_0x5389ac[_0x4bf4('0x6')](_0x5389ac['lastIndexOf']('.'));}return _0x655adf;}}}; \ No newline at end of file +var _0x323d=['VIRTUAL','getDataValue','substring','exports','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x323d,0x12f));var _0xd323=function(_0x28a471,_0x80beab){_0x28a471=_0x28a471-0x0;var _0x59c413=_0x323d[_0x28a471];return _0x59c413;};'use strict';var Sequelize=require('sequelize');module[_0xd323('0x0')]={'uniqueid':{'type':Sequelize[_0xd323('0x1')]},'callerid':{'type':Sequelize[_0xd323('0x1')]},'calleridname':{'type':Sequelize[_0xd323('0x1')]},'context':{'type':Sequelize[_0xd323('0x1')]},'extension':{'type':Sequelize[_0xd323('0x1')]},'priority':{'type':Sequelize[_0xd323('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd323('0x1')]},'saveName':{'type':Sequelize[_0xd323('0x1')]},'filename':{'type':Sequelize[_0xd323('0x1')]},'savePath':{'type':Sequelize[_0xd323('0x1')]},'format':{'type':Sequelize[_0xd323('0x2')],'get':function(){var _0x3afb55='';var _0x5d6fad=this[_0xd323('0x3')]('savePath');if(_0x5d6fad){_0x3afb55=_0x5d6fad[_0xd323('0x4')](_0x5d6fad['lastIndexOf']('.'));}return _0x3afb55;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a14bd69..ded358c 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 _0xc7bf=['catch','show','length','include','find','create','body','params','download','../../components/encryptor','uniqueid','filename','savePath','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','info','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','count','offset','set','reject','update','then','destroy','sendStatus','error','stack','name','send','SquareRecording','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','merge','rows'];(function(_0x3d9ba3,_0x48ad4e){var _0x20ee18=function(_0x2b18e2){while(--_0x2b18e2){_0x3d9ba3['push'](_0x3d9ba3['shift']());}};_0x20ee18(++_0x48ad4e);}(_0xc7bf,0x186));var _0xfc7b=function(_0x18bd45,_0x429dd2){_0x18bd45=_0x18bd45-0x0;var _0x110441=_0xc7bf[_0x18bd45];return _0x110441;};'use strict';var pdf=require(_0xfc7b('0x0'));var emlformat=require(_0xfc7b('0x1'));var rimraf=require(_0xfc7b('0x2'));var zipdir=require(_0xfc7b('0x3'));var jsonpatch=require(_0xfc7b('0x4'));var rp=require('request-promise');var moment=require(_0xfc7b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfc7b('0x6'));var util=require(_0xfc7b('0x7'));var path=require(_0xfc7b('0x8'));var sox=require(_0xfc7b('0x9'));var csv=require(_0xfc7b('0xa'));var ejs=require(_0xfc7b('0xb'));var fs=require('fs');var _=require(_0xfc7b('0xc'));var squel=require(_0xfc7b('0xd'));var crypto=require('crypto');var jsforce=require(_0xfc7b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfc7b('0xf'));var Papa=require(_0xfc7b('0x10'));var Redis=require(_0xfc7b('0x11'));var authService=require(_0xfc7b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfc7b('0x13'));var hardwareService=require(_0xfc7b('0x14'));var logger=require(_0xfc7b('0x15'))(_0xfc7b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfc7b('0x17'))['db'];function respondWithStatusCode(_0x12de12,_0x301f4c){_0x301f4c=_0x301f4c||0xcc;return function(_0xbf8780){if(_0xbf8780){return _0x12de12['sendStatus'](_0x301f4c);}return _0x12de12[_0xfc7b('0x18')](_0x301f4c)[_0xfc7b('0x19')]();};}function respondWithResult(_0x39bec4,_0x4a6fb1){_0x4a6fb1=_0x4a6fb1||0xc8;return function(_0x4e504d){if(_0x4e504d){return _0x39bec4[_0xfc7b('0x18')](_0x4a6fb1)[_0xfc7b('0x1a')](_0x4e504d);}};}function respondWithFilteredResult(_0xed5d1f,_0x46ece8){return function(_0x3d5c69){if(_0x3d5c69){var _0xec5fe=_0x3d5c69[_0xfc7b('0x1b')],_0x50c8f2=_0x46ece8[_0xfc7b('0x1c')],_0x27adb0=_0x46ece8[_0xfc7b('0x1c')]+_0x46ece8['limit'],_0x922677;if(_0x27adb0>=_0xec5fe){_0x27adb0=_0xec5fe;_0x922677=0xc8;}else{_0x922677=0xce;}_0xed5d1f[_0xfc7b('0x18')](_0x922677);return _0xed5d1f[_0xfc7b('0x1d')]('Content-Range',_0x50c8f2+'-'+_0x27adb0+'/'+_0xec5fe)['json'](_0x3d5c69);}return null;};}function patchUpdates(_0x3be15e){return function(_0x526745){try{jsonpatch['apply'](_0x526745,_0x3be15e,!![]);}catch(_0x2f1a2f){return BPromise[_0xfc7b('0x1e')](_0x2f1a2f);}return _0x526745['save']();};}function saveUpdates(_0x5f10ca,_0x2599db){return function(_0x2720b7){if(_0x2720b7){return _0x2720b7[_0xfc7b('0x1f')](_0x5f10ca)[_0xfc7b('0x20')](function(_0x3945d1){return _0x3945d1;});}return null;};}function removeEntity(_0x1b4905,_0x102516){return function(_0x238c09){if(_0x238c09){return _0x238c09[_0xfc7b('0x21')]()['then'](function(){_0x1b4905[_0xfc7b('0x18')](0xcc)[_0xfc7b('0x19')]();});}};}function handleEntityNotFound(_0x2009fa,_0x23d484){return function(_0x2a905b){if(!_0x2a905b){_0x2009fa[_0xfc7b('0x22')](0x194);}return _0x2a905b;};}function handleError(_0xa2ce82,_0x57e7ae){_0x57e7ae=_0x57e7ae||0x1f4;return function(_0x10855a){logger[_0xfc7b('0x23')](_0x10855a[_0xfc7b('0x24')]);if(_0x10855a['name']){delete _0x10855a[_0xfc7b('0x25')];}_0xa2ce82['status'](_0x57e7ae)[_0xfc7b('0x26')](_0x10855a);};}exports['index']=function(_0x2254b5,_0x863fa){var _0x2c139c={},_0x4e0db3={},_0x5d70ac={'count':0x0,'rows':[]};var _0x13e4ee=_['map'](db[_0xfc7b('0x27')][_0xfc7b('0x28')],function(_0x4f88ce){return{'name':_0x4f88ce[_0xfc7b('0x29')],'type':_0x4f88ce[_0xfc7b('0x2a')][_0xfc7b('0x2b')]};});_0x4e0db3[_0xfc7b('0x2c')]=_[_0xfc7b('0x2d')](_0x13e4ee,_0xfc7b('0x25'));_0x4e0db3['query']=_[_0xfc7b('0x2e')](_0x2254b5[_0xfc7b('0x2f')]);_0x4e0db3[_0xfc7b('0x30')]=_[_0xfc7b('0x31')](_0x4e0db3[_0xfc7b('0x2c')],_0x4e0db3[_0xfc7b('0x2f')]);_0x2c139c[_0xfc7b('0x32')]=_[_0xfc7b('0x31')](_0x4e0db3[_0xfc7b('0x2c')],qs[_0xfc7b('0x33')](_0x2254b5['query'][_0xfc7b('0x33')]));_0x2c139c[_0xfc7b('0x32')]=_0x2c139c['attributes']['length']?_0x2c139c['attributes']:_0x4e0db3[_0xfc7b('0x2c')];if(!_0x2254b5[_0xfc7b('0x2f')][_0xfc7b('0x34')](_0xfc7b('0x35'))){_0x2c139c['limit']=qs[_0xfc7b('0x36')](_0x2254b5['query'][_0xfc7b('0x36')]);_0x2c139c[_0xfc7b('0x1c')]=qs[_0xfc7b('0x1c')](_0x2254b5[_0xfc7b('0x2f')][_0xfc7b('0x1c')]);}_0x2c139c[_0xfc7b('0x37')]=qs['sort'](_0x2254b5[_0xfc7b('0x2f')]['sort']);_0x2c139c[_0xfc7b('0x38')]=qs[_0xfc7b('0x30')](_[_0xfc7b('0x39')](_0x2254b5[_0xfc7b('0x2f')],_0x4e0db3['filters']),_0x13e4ee);if(_0x2254b5[_0xfc7b('0x2f')]['filter']){_0x2c139c[_0xfc7b('0x38')]=_[_0xfc7b('0x3a')](_0x2c139c[_0xfc7b('0x38')],{'$or':_[_0xfc7b('0x2d')](_0x13e4ee,function(_0x5407f0){if(_0x5407f0[_0xfc7b('0x2a')]!=='VIRTUAL'){var _0x11219d={};_0x11219d[_0x5407f0['name']]={'$like':'%'+_0x2254b5[_0xfc7b('0x2f')]['filter']+'%'};return _0x11219d;}})});}_0x2c139c=_['merge']({},_0x2c139c,_0x2254b5['options']);var _0x45c8b5={'where':_0x2c139c[_0xfc7b('0x38')]};return db[_0xfc7b('0x27')][_0xfc7b('0x1b')](_0x45c8b5)[_0xfc7b('0x20')](function(_0x54aa18){_0x5d70ac[_0xfc7b('0x1b')]=_0x54aa18;if(_0x2254b5[_0xfc7b('0x2f')]['includeAll']){_0x2c139c['include']=[{'all':!![]}];}return db[_0xfc7b('0x27')]['findAll'](_0x2c139c);})['then'](function(_0x34e392){_0x5d70ac[_0xfc7b('0x3b')]=_0x34e392;return _0x5d70ac;})[_0xfc7b('0x20')](respondWithFilteredResult(_0x863fa,_0x2c139c))[_0xfc7b('0x3c')](handleError(_0x863fa,null));};exports[_0xfc7b('0x3d')]=function(_0x270107,_0x19519d){var _0x4c30c7={'raw':!![],'where':{'id':_0x270107['params']['id']}},_0x2878d4={};_0x2878d4[_0xfc7b('0x2c')]=_[_0xfc7b('0x2e')](db[_0xfc7b('0x27')][_0xfc7b('0x28')]);_0x2878d4[_0xfc7b('0x2f')]=_[_0xfc7b('0x2e')](_0x270107[_0xfc7b('0x2f')]);_0x2878d4['filters']=_['intersection'](_0x2878d4['model'],_0x2878d4[_0xfc7b('0x2f')]);_0x4c30c7['attributes']=_[_0xfc7b('0x31')](_0x2878d4[_0xfc7b('0x2c')],qs[_0xfc7b('0x33')](_0x270107[_0xfc7b('0x2f')][_0xfc7b('0x33')]));_0x4c30c7['attributes']=_0x4c30c7['attributes'][_0xfc7b('0x3e')]?_0x4c30c7[_0xfc7b('0x32')]:_0x2878d4[_0xfc7b('0x2c')];if(_0x270107['query']['includeAll']){_0x4c30c7[_0xfc7b('0x3f')]=[{'all':!![]}];}_0x4c30c7=_[_0xfc7b('0x3a')]({},_0x4c30c7,_0x270107['options']);return db[_0xfc7b('0x27')][_0xfc7b('0x40')](_0x4c30c7)[_0xfc7b('0x20')](handleEntityNotFound(_0x19519d,null))[_0xfc7b('0x20')](respondWithResult(_0x19519d,null))[_0xfc7b('0x3c')](handleError(_0x19519d,null));};exports[_0xfc7b('0x41')]=function(_0x187d8a,_0x2f9d5c){return db[_0xfc7b('0x27')][_0xfc7b('0x41')](_0x187d8a[_0xfc7b('0x42')],{})[_0xfc7b('0x20')](respondWithResult(_0x2f9d5c,0xc9))[_0xfc7b('0x3c')](handleError(_0x2f9d5c,null));};exports[_0xfc7b('0x1f')]=function(_0x321873,_0x3a1004){if(_0x321873['body']['id']){delete _0x321873[_0xfc7b('0x42')]['id'];}return db[_0xfc7b('0x27')][_0xfc7b('0x40')]({'where':{'id':_0x321873[_0xfc7b('0x43')]['id']}})[_0xfc7b('0x20')](handleEntityNotFound(_0x3a1004,null))[_0xfc7b('0x20')](saveUpdates(_0x321873[_0xfc7b('0x42')],null))[_0xfc7b('0x20')](respondWithResult(_0x3a1004,null))[_0xfc7b('0x3c')](handleError(_0x3a1004,null));};exports[_0xfc7b('0x44')]=function(_0x419bf2,_0x3316dd,_0x2e0d76){var _0x3a77b7=require(_0xfc7b('0x45'));var _0x5af122=![];var _0x17ed79={};if(_0x419bf2['query'][_0xfc7b('0x2a')]&&_0x419bf2[_0xfc7b('0x2f')]['type']===_0xfc7b('0x46')){_0x17ed79[_0xfc7b('0x46')]=_0x419bf2[_0xfc7b('0x43')]['id'];}else{_0x17ed79['id']=_0x419bf2[_0xfc7b('0x43')]['id'];}return db[_0xfc7b('0x27')][_0xfc7b('0x40')]({'where':_0x17ed79,'attributes':['id','savePath',_0xfc7b('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x3316dd,null))[_0xfc7b('0x20')](function(_0x414fc7){if(_0x414fc7){var _0x196958=_0x414fc7[_0xfc7b('0x48')];var _0x16b03d=util['format'](_0xfc7b('0x49'),_0x196958);if(fs[_0xfc7b('0x4a')](_0x16b03d)){_0x5af122=!![];return _0x3a77b7[_0xfc7b('0x4b')](_0x16b03d,_0x196958,config['secrets'][_0xfc7b('0x4c')])['then'](function(){return _0x414fc7;});}return _0x414fc7;}})[_0xfc7b('0x20')](function(_0x437c42){if(_0x437c42){var _0x141498=_0x437c42['savePath'];if(!fs['existsSync'](_0x141498)){throw new db[(_0xfc7b('0x4d'))][(_0xfc7b('0x4e'))](_0xfc7b('0x4f'));}if(_0x437c42[_0xfc7b('0x47')]){return _0x3316dd[_0xfc7b('0x44')](_0x141498,_0x437c42[_0xfc7b('0x47')]+path[_0xfc7b('0x50')](_0x141498),function(){if(_0x5af122){fs[_0xfc7b('0x51')](_0x141498);}});}else{return _0x3316dd[_0xfc7b('0x44')](_0x141498,function(_0x3caed1){if(_0x5af122){fs[_0xfc7b('0x51')](_0x141498);}});}}})[_0xfc7b('0x3c')](function(_0x4a615e){if(_0x4a615e[_0xfc7b('0x52')]===_0xfc7b('0x4f')){_0x3316dd[_0xfc7b('0x18')](0x194)[_0xfc7b('0x26')](_0xfc7b('0x53'));}else{return handleError(_0x3316dd,null);}});};exports[_0xfc7b('0x21')]=function(_0x1079df,_0x537454){return db[_0xfc7b('0x27')][_0xfc7b('0x40')]({'where':{'id':_0x1079df[_0xfc7b('0x43')]['id']}})[_0xfc7b('0x20')](function(_0x2446ef){if(!_0x2446ef)throw new ReferenceError('Entity\x20not\x20found');return _0x2446ef;})['then'](function(_0x55c9ad){var _0x315b95=_0x55c9ad[_0xfc7b('0x48')];logger['info'](_0xfc7b('0x54'),_0x315b95);if(!_['isNil'](_0x55c9ad[_0xfc7b('0x48')])&&fs[_0xfc7b('0x4a')](_0x315b95)){logger['info'](_0xfc7b('0x55')+_0x315b95+_0xfc7b('0x56'));fs[_0xfc7b('0x57')](_0x315b95);}_0x315b95=_0x315b95+'.cypher';if(!_[_0xfc7b('0x58')](_0x55c9ad['savePath'])&&fs['existsSync'](_0x315b95)){logger[_0xfc7b('0x59')](_0xfc7b('0x55')+_0x315b95+_0xfc7b('0x56'));fs['unlinkSync'](_0x315b95);}return _0x55c9ad;})['then'](function(_0x551435){if(!_0x551435)throw new InternalError();return _0x551435[_0xfc7b('0x21')]();})[_0xfc7b('0x20')](function(){_0x537454[_0xfc7b('0x18')](0xcc)[_0xfc7b('0x19')]();})['catch'](handleError(_0x537454,null));}; \ No newline at end of file +var _0x6a0d=['sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','intersection','create','body','download','../../components/encryptor','uniqueid','find','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','order'];(function(_0x402a07,_0xf894){var _0x49563b=function(_0x2b857e){while(--_0x2b857e){_0x402a07['push'](_0x402a07['shift']());}};_0x49563b(++_0xf894);}(_0x6a0d,0x14a));var _0xd6a0=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x6a0d[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0xd6a0('0x0'));var emlformat=require(_0xd6a0('0x1'));var rimraf=require(_0xd6a0('0x2'));var zipdir=require(_0xd6a0('0x3'));var jsonpatch=require(_0xd6a0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd6a0('0x5'));var Mustache=require('mustache');var util=require(_0xd6a0('0x6'));var path=require(_0xd6a0('0x7'));var sox=require('sox');var csv=require(_0xd6a0('0x8'));var ejs=require(_0xd6a0('0x9'));var fs=require('fs');var _=require(_0xd6a0('0xa'));var squel=require(_0xd6a0('0xb'));var crypto=require('crypto');var jsforce=require(_0xd6a0('0xc'));var deskjs=require(_0xd6a0('0xd'));var toCsv=require(_0xd6a0('0x8'));var querystring=require(_0xd6a0('0xe'));var Papa=require(_0xd6a0('0xf'));var Redis=require('ioredis');var authService=require(_0xd6a0('0x10'));var qs=require(_0xd6a0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6a0('0x12'))(_0xd6a0('0x13'));var utils=require(_0xd6a0('0x14'));var config=require(_0xd6a0('0x15'));var db=require(_0xd6a0('0x16'))['db'];function respondWithStatusCode(_0x5313ab,_0x1f9153){_0x1f9153=_0x1f9153||0xcc;return function(_0x50a853){if(_0x50a853){return _0x5313ab[_0xd6a0('0x17')](_0x1f9153);}return _0x5313ab['status'](_0x1f9153)[_0xd6a0('0x18')]();};}function respondWithResult(_0x472205,_0x1f62ef){_0x1f62ef=_0x1f62ef||0xc8;return function(_0x2171ed){if(_0x2171ed){return _0x472205[_0xd6a0('0x19')](_0x1f62ef)[_0xd6a0('0x1a')](_0x2171ed);}};}function respondWithFilteredResult(_0x87459d,_0x55820e){return function(_0x15b8ed){if(_0x15b8ed){var _0x31ddff=_0x15b8ed['count'],_0x2e2472=_0x55820e[_0xd6a0('0x1b')],_0x601d11=_0x55820e[_0xd6a0('0x1b')]+_0x55820e[_0xd6a0('0x1c')],_0x36c2b0;if(_0x601d11>=_0x31ddff){_0x601d11=_0x31ddff;_0x36c2b0=0xc8;}else{_0x36c2b0=0xce;}_0x87459d[_0xd6a0('0x19')](_0x36c2b0);return _0x87459d[_0xd6a0('0x1d')](_0xd6a0('0x1e'),_0x2e2472+'-'+_0x601d11+'/'+_0x31ddff)['json'](_0x15b8ed);}return null;};}function patchUpdates(_0x3c2539){return function(_0x41581d){try{jsonpatch[_0xd6a0('0x1f')](_0x41581d,_0x3c2539,!![]);}catch(_0x743212){return BPromise[_0xd6a0('0x20')](_0x743212);}return _0x41581d['save']();};}function saveUpdates(_0x4de857,_0x2d7c4d){return function(_0x1bb904){if(_0x1bb904){return _0x1bb904[_0xd6a0('0x21')](_0x4de857)[_0xd6a0('0x22')](function(_0x12b8d5){return _0x12b8d5;});}return null;};}function removeEntity(_0x419232,_0x58a5c2){return function(_0x684681){if(_0x684681){return _0x684681[_0xd6a0('0x23')]()['then'](function(){_0x419232[_0xd6a0('0x19')](0xcc)[_0xd6a0('0x18')]();});}};}function handleEntityNotFound(_0x31a9a3,_0x4b3a33){return function(_0x10480a){if(!_0x10480a){_0x31a9a3[_0xd6a0('0x17')](0x194);}return _0x10480a;};}function handleError(_0x12a6ef,_0x304d9a){_0x304d9a=_0x304d9a||0x1f4;return function(_0x3d4602){logger[_0xd6a0('0x24')](_0x3d4602[_0xd6a0('0x25')]);if(_0x3d4602[_0xd6a0('0x26')]){delete _0x3d4602[_0xd6a0('0x26')];}_0x12a6ef[_0xd6a0('0x19')](_0x304d9a)[_0xd6a0('0x27')](_0x3d4602);};}exports[_0xd6a0('0x28')]=function(_0x513c54,_0x4a0571){var _0x2e9aaa={},_0x1260c8={},_0x1ec36f={'count':0x0,'rows':[]};var _0x486fe9=_[_0xd6a0('0x29')](db[_0xd6a0('0x2a')][_0xd6a0('0x2b')],function(_0x3d1003){return{'name':_0x3d1003[_0xd6a0('0x2c')],'type':_0x3d1003[_0xd6a0('0x2d')][_0xd6a0('0x2e')]};});_0x1260c8[_0xd6a0('0x2f')]=_['map'](_0x486fe9,'name');_0x1260c8[_0xd6a0('0x30')]=_[_0xd6a0('0x31')](_0x513c54['query']);_0x1260c8['filters']=_['intersection'](_0x1260c8[_0xd6a0('0x2f')],_0x1260c8[_0xd6a0('0x30')]);_0x2e9aaa[_0xd6a0('0x32')]=_['intersection'](_0x1260c8[_0xd6a0('0x2f')],qs[_0xd6a0('0x33')](_0x513c54['query'][_0xd6a0('0x33')]));_0x2e9aaa[_0xd6a0('0x32')]=_0x2e9aaa[_0xd6a0('0x32')][_0xd6a0('0x34')]?_0x2e9aaa['attributes']:_0x1260c8[_0xd6a0('0x2f')];if(!_0x513c54[_0xd6a0('0x30')]['hasOwnProperty']('nolimit')){_0x2e9aaa[_0xd6a0('0x1c')]=qs[_0xd6a0('0x1c')](_0x513c54[_0xd6a0('0x30')][_0xd6a0('0x1c')]);_0x2e9aaa[_0xd6a0('0x1b')]=qs[_0xd6a0('0x1b')](_0x513c54[_0xd6a0('0x30')][_0xd6a0('0x1b')]);}_0x2e9aaa[_0xd6a0('0x35')]=qs[_0xd6a0('0x36')](_0x513c54[_0xd6a0('0x30')]['sort']);_0x2e9aaa[_0xd6a0('0x37')]=qs[_0xd6a0('0x38')](_[_0xd6a0('0x39')](_0x513c54['query'],_0x1260c8[_0xd6a0('0x38')]),_0x486fe9);if(_0x513c54['query'][_0xd6a0('0x3a')]){_0x2e9aaa[_0xd6a0('0x37')]=_[_0xd6a0('0x3b')](_0x2e9aaa[_0xd6a0('0x37')],{'$or':_['map'](_0x486fe9,function(_0x42d8e3){if(_0x42d8e3[_0xd6a0('0x2d')]!==_0xd6a0('0x3c')){var _0x5ec24b={};_0x5ec24b[_0x42d8e3[_0xd6a0('0x26')]]={'$like':'%'+_0x513c54['query'][_0xd6a0('0x3a')]+'%'};return _0x5ec24b;}})});}_0x2e9aaa=_[_0xd6a0('0x3b')]({},_0x2e9aaa,_0x513c54[_0xd6a0('0x3d')]);var _0x4fb474={'where':_0x2e9aaa['where']};return db[_0xd6a0('0x2a')][_0xd6a0('0x3e')](_0x4fb474)['then'](function(_0x1d0d6c){_0x1ec36f['count']=_0x1d0d6c;if(_0x513c54[_0xd6a0('0x30')][_0xd6a0('0x3f')]){_0x2e9aaa[_0xd6a0('0x40')]=[{'all':!![]}];}return db[_0xd6a0('0x2a')][_0xd6a0('0x41')](_0x2e9aaa);})[_0xd6a0('0x22')](function(_0x407c9f){_0x1ec36f[_0xd6a0('0x42')]=_0x407c9f;return _0x1ec36f;})[_0xd6a0('0x22')](respondWithFilteredResult(_0x4a0571,_0x2e9aaa))[_0xd6a0('0x43')](handleError(_0x4a0571,null));};exports['show']=function(_0x878014,_0x110fb5){var _0x315a0e={'raw':!![],'where':{'id':_0x878014[_0xd6a0('0x44')]['id']}},_0x8f8348={};_0x8f8348[_0xd6a0('0x2f')]=_['keys'](db[_0xd6a0('0x2a')][_0xd6a0('0x2b')]);_0x8f8348['query']=_[_0xd6a0('0x31')](_0x878014[_0xd6a0('0x30')]);_0x8f8348[_0xd6a0('0x38')]=_['intersection'](_0x8f8348[_0xd6a0('0x2f')],_0x8f8348['query']);_0x315a0e[_0xd6a0('0x32')]=_[_0xd6a0('0x45')](_0x8f8348[_0xd6a0('0x2f')],qs[_0xd6a0('0x33')](_0x878014['query'][_0xd6a0('0x33')]));_0x315a0e[_0xd6a0('0x32')]=_0x315a0e[_0xd6a0('0x32')][_0xd6a0('0x34')]?_0x315a0e[_0xd6a0('0x32')]:_0x8f8348[_0xd6a0('0x2f')];if(_0x878014[_0xd6a0('0x30')][_0xd6a0('0x3f')]){_0x315a0e[_0xd6a0('0x40')]=[{'all':!![]}];}_0x315a0e=_[_0xd6a0('0x3b')]({},_0x315a0e,_0x878014[_0xd6a0('0x3d')]);return db[_0xd6a0('0x2a')]['find'](_0x315a0e)[_0xd6a0('0x22')](handleEntityNotFound(_0x110fb5,null))['then'](respondWithResult(_0x110fb5,null))[_0xd6a0('0x43')](handleError(_0x110fb5,null));};exports[_0xd6a0('0x46')]=function(_0x290ccb,_0x3570ba){return db['SquareRecording']['create'](_0x290ccb[_0xd6a0('0x47')],{})['then'](respondWithResult(_0x3570ba,0xc9))[_0xd6a0('0x43')](handleError(_0x3570ba,null));};exports[_0xd6a0('0x21')]=function(_0x4e2745,_0x66a817){if(_0x4e2745[_0xd6a0('0x47')]['id']){delete _0x4e2745['body']['id'];}return db[_0xd6a0('0x2a')]['find']({'where':{'id':_0x4e2745['params']['id']}})[_0xd6a0('0x22')](handleEntityNotFound(_0x66a817,null))['then'](saveUpdates(_0x4e2745[_0xd6a0('0x47')],null))['then'](respondWithResult(_0x66a817,null))['catch'](handleError(_0x66a817,null));};exports[_0xd6a0('0x48')]=function(_0x19a3a0,_0x9f3fb7,_0x1350a6){var _0x5d12e4=require(_0xd6a0('0x49'));var _0x559199=![];var _0x361111={};if(_0x19a3a0[_0xd6a0('0x30')][_0xd6a0('0x2d')]&&_0x19a3a0[_0xd6a0('0x30')]['type']===_0xd6a0('0x4a')){_0x361111['uniqueid']=_0x19a3a0['params']['id'];}else{_0x361111['id']=_0x19a3a0['params']['id'];}return db[_0xd6a0('0x2a')][_0xd6a0('0x4b')]({'where':_0x361111,'attributes':['id',_0xd6a0('0x4c'),_0xd6a0('0x4d')],'raw':!![]})[_0xd6a0('0x22')](handleEntityNotFound(_0x9f3fb7,null))[_0xd6a0('0x22')](function(_0x59fb21){if(_0x59fb21){var _0x4e8d4d=_0x59fb21[_0xd6a0('0x4c')];var _0x41f611=util[_0xd6a0('0x4e')](_0xd6a0('0x4f'),_0x4e8d4d);if(fs[_0xd6a0('0x50')](_0x41f611)){_0x559199=!![];return _0x5d12e4[_0xd6a0('0x51')](_0x41f611,_0x4e8d4d,config[_0xd6a0('0x52')][_0xd6a0('0x53')])[_0xd6a0('0x22')](function(){return _0x59fb21;});}return _0x59fb21;}})[_0xd6a0('0x22')](function(_0x23dfa3){if(_0x23dfa3){var _0x130d39=_0x23dfa3[_0xd6a0('0x4c')];if(!fs[_0xd6a0('0x50')](_0x130d39)){throw new db['Sequelize'][(_0xd6a0('0x54'))](_0xd6a0('0x55'));}if(_0x23dfa3[_0xd6a0('0x4d')]){return _0x9f3fb7[_0xd6a0('0x48')](_0x130d39,_0x23dfa3[_0xd6a0('0x4d')]+path[_0xd6a0('0x56')](_0x130d39),function(){if(_0x559199){fs['unlink'](_0x130d39);}});}else{return _0x9f3fb7['download'](_0x130d39,function(_0x4437ac){if(_0x559199){fs[_0xd6a0('0x57')](_0x130d39);}});}}})[_0xd6a0('0x43')](function(_0x1c3a87){if(_0x1c3a87[_0xd6a0('0x58')]==='SquareRecording\x20not\x20found'){_0x9f3fb7[_0xd6a0('0x19')](0x194)[_0xd6a0('0x27')](_0xd6a0('0x59'));}else{return handleError(_0x9f3fb7,null);}});};exports[_0xd6a0('0x23')]=function(_0x4b590d,_0x2e8808){return db[_0xd6a0('0x2a')]['find']({'where':{'id':_0x4b590d[_0xd6a0('0x44')]['id']}})[_0xd6a0('0x22')](function(_0x6eeb03){if(!_0x6eeb03)throw new ReferenceError(_0xd6a0('0x5a'));return _0x6eeb03;})[_0xd6a0('0x22')](function(_0x46ce0e){var _0x4adde8=_0x46ce0e[_0xd6a0('0x4c')];logger[_0xd6a0('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x4adde8);if(!_['isNil'](_0x46ce0e[_0xd6a0('0x4c')])&&fs[_0xd6a0('0x50')](_0x4adde8)){logger[_0xd6a0('0x5b')](_0xd6a0('0x5c')+_0x4adde8+_0xd6a0('0x5d'));fs[_0xd6a0('0x5e')](_0x4adde8);}_0x4adde8=_0x4adde8+'.cypher';if(!_[_0xd6a0('0x5f')](_0x46ce0e[_0xd6a0('0x4c')])&&fs['existsSync'](_0x4adde8)){logger[_0xd6a0('0x5b')](_0xd6a0('0x5c')+_0x4adde8+_0xd6a0('0x5d'));fs[_0xd6a0('0x5e')](_0x4adde8);}return _0x46ce0e;})[_0xd6a0('0x22')](function(_0x374303){if(!_0x374303)throw new InternalError();return _0x374303[_0xd6a0('0x23')]();})['then'](function(){_0x2e8808[_0xd6a0('0x19')](0xcc)[_0xd6a0('0x18')]();})['catch'](handleError(_0x2e8808,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 7cac815..8e641fc 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 _0x43e7=['exports','SquareRecording','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes'];(function(_0x19ad66,_0x54731b){var _0x1607b9=function(_0x1ac187){while(--_0x1ac187){_0x19ad66['push'](_0x19ad66['shift']());}};_0x1607b9(++_0x54731b);}(_0x43e7,0x1b2));var _0x743e=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x43e7[_0x374ada];return _0x449ed8;};'use strict';var _=require(_0x743e('0x0'));var util=require(_0x743e('0x1'));var logger=require(_0x743e('0x2'))(_0x743e('0x3'));var moment=require(_0x743e('0x4'));var BPromise=require(_0x743e('0x5'));var rp=require(_0x743e('0x6'));var fs=require('fs');var path=require(_0x743e('0x7'));var rimraf=require('rimraf');var config=require(_0x743e('0x8'));var attributes=require(_0x743e('0x9'));module[_0x743e('0xa')]=function(_0xfb57be,_0x5ef224){return _0xfb57be['define'](_0x743e('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53b3=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53b3,0x1b5));var _0x353b=function(_0x5efbf8,_0x334430){_0x5efbf8=_0x5efbf8-0x0;var _0x57f96e=_0x53b3[_0x5efbf8];return _0x57f96e;};'use strict';var _=require(_0x353b('0x0'));var util=require(_0x353b('0x1'));var logger=require(_0x353b('0x2'))(_0x353b('0x3'));var moment=require('moment');var BPromise=require(_0x353b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x353b('0x5'));var rimraf=require(_0x353b('0x6'));var config=require(_0x353b('0x7'));var attributes=require(_0x353b('0x8'));module[_0x353b('0x9')]=function(_0x414518,_0x294738){return _0x414518[_0x353b('0xa')](_0x353b('0xb'),attributes,{'tableName':_0x353b('0xc'),'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 4f68c14..98f6209 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 _0x7e48=['client','http','request','then','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','info','result','catch','create','body','options','CreateSquareRecording','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x33b36e,_0x34853b){var _0x512fd8=function(_0xae973c){while(--_0xae973c){_0x33b36e['push'](_0x33b36e['shift']());}};_0x512fd8(++_0x34853b);}(_0x7e48,0x135));var _0x87e4=function(_0x1273b6,_0x11259e){_0x1273b6=_0x1273b6-0x0;var _0x1b037a=_0x7e48[_0x1273b6];return _0x1b037a;};'use strict';var _=require(_0x87e4('0x0'));var util=require(_0x87e4('0x1'));var moment=require('moment');var BPromise=require(_0x87e4('0x2'));var rs=require(_0x87e4('0x3'));var fs=require('fs');var Redis=require(_0x87e4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x87e4('0x5'));var logger=require(_0x87e4('0x6'))(_0x87e4('0x7'));var config=require(_0x87e4('0x8'));var jayson=require(_0x87e4('0x9'));var client=jayson[_0x87e4('0xa')][_0x87e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3604ef,_0x1ab579,_0x155de4){return new BPromise(function(_0x292737,_0x179f05){return client[_0x87e4('0xc')](_0x3604ef,_0x155de4)[_0x87e4('0xd')](function(_0x4c5aab){logger['info']('SquareRecording,\x20%s,\x20%s',_0x1ab579,_0x87e4('0xe'));logger['debug'](_0x87e4('0xf'),_0x1ab579,_0x87e4('0xe'),JSON[_0x87e4('0x10')](_0x4c5aab));if(_0x4c5aab[_0x87e4('0x11')]){if(_0x4c5aab[_0x87e4('0x11')][_0x87e4('0x12')]===0x1f4){logger[_0x87e4('0x11')](_0x87e4('0x13'),_0x1ab579,_0x4c5aab[_0x87e4('0x11')][_0x87e4('0x14')]);return _0x179f05(_0x4c5aab['error']['message']);}logger[_0x87e4('0x11')](_0x87e4('0x13'),_0x1ab579,_0x4c5aab['error']['message']);return _0x292737(_0x4c5aab[_0x87e4('0x11')][_0x87e4('0x14')]);}else{logger[_0x87e4('0x15')](_0x87e4('0x13'),_0x1ab579,'request\x20sent');_0x292737(_0x4c5aab[_0x87e4('0x16')][_0x87e4('0x14')]);}})[_0x87e4('0x17')](function(_0xa691e3){logger[_0x87e4('0x11')](_0x87e4('0x13'),_0x1ab579,_0xa691e3);_0x179f05(_0xa691e3);});});}exports['CreateSquareRecording']=function(_0x37c4b1){var _0x51d632=this;return new Promise(function(_0xe92622,_0x4905ea){return db['SquareRecording'][_0x87e4('0x18')](_0x37c4b1[_0x87e4('0x19')],{'raw':_0x37c4b1['options']?_0x37c4b1[_0x87e4('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x87e4('0xd')](function(_0x4c1967){logger[_0x87e4('0x15')](_0x87e4('0x1b'),_0x37c4b1);logger[_0x87e4('0x1c')]('CreateSquareRecording',_0x37c4b1,JSON[_0x87e4('0x10')](_0x4c1967));_0xe92622(_0x4c1967);})[_0x87e4('0x17')](function(_0x37a6c2){logger[_0x87e4('0x11')](_0x87e4('0x1b'),_0x37a6c2[_0x87e4('0x14')],_0x37c4b1);_0x4905ea(_0x51d632[_0x87e4('0x11')](0x1f4,_0x37a6c2['message']));});});}; \ No newline at end of file +var _0x4fbc=['client','http','request','then','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2f3999,_0x5eab0f){var _0x58776b=function(_0x2745f3){while(--_0x2745f3){_0x2f3999['push'](_0x2f3999['shift']());}};_0x58776b(++_0x5eab0f);}(_0x4fbc,0x1df));var _0xc4fb=function(_0x20b809,_0x148d71){_0x20b809=_0x20b809-0x0;var _0x381d38=_0x4fbc[_0x20b809];return _0x381d38;};'use strict';var _=require(_0xc4fb('0x0'));var util=require(_0xc4fb('0x1'));var moment=require(_0xc4fb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4fb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4fb('0x4'))(_0xc4fb('0x5'));var config=require(_0xc4fb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc4fb('0x7')][_0xc4fb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3cbea7,_0x5e8284,_0x5cd7ae){return new BPromise(function(_0x28759b,_0x5c13fc){return client[_0xc4fb('0x9')](_0x3cbea7,_0x5cd7ae)[_0xc4fb('0xa')](function(_0x406325){logger['info'](_0xc4fb('0xb'),_0x5e8284,'request\x20sent');logger[_0xc4fb('0xc')](_0xc4fb('0xd'),_0x5e8284,_0xc4fb('0xe'),JSON[_0xc4fb('0xf')](_0x406325));if(_0x406325['error']){if(_0x406325[_0xc4fb('0x10')][_0xc4fb('0x11')]===0x1f4){logger['error'](_0xc4fb('0xb'),_0x5e8284,_0x406325[_0xc4fb('0x10')][_0xc4fb('0x12')]);return _0x5c13fc(_0x406325[_0xc4fb('0x10')][_0xc4fb('0x12')]);}logger[_0xc4fb('0x10')](_0xc4fb('0xb'),_0x5e8284,_0x406325[_0xc4fb('0x10')][_0xc4fb('0x12')]);return _0x28759b(_0x406325[_0xc4fb('0x10')][_0xc4fb('0x12')]);}else{logger[_0xc4fb('0x13')](_0xc4fb('0xb'),_0x5e8284,_0xc4fb('0xe'));_0x28759b(_0x406325[_0xc4fb('0x14')][_0xc4fb('0x12')]);}})[_0xc4fb('0x15')](function(_0x56cb1e){logger[_0xc4fb('0x10')]('SquareRecording,\x20%s,\x20%s',_0x5e8284,_0x56cb1e);_0x5c13fc(_0x56cb1e);});});}exports[_0xc4fb('0x16')]=function(_0x48e4dd){var _0x4c7279=this;return new Promise(function(_0x5ac870,_0x59ba3d){return db[_0xc4fb('0x17')]['create'](_0x48e4dd[_0xc4fb('0x18')],{'raw':_0x48e4dd[_0xc4fb('0x19')]?_0x48e4dd['options'][_0xc4fb('0x1a')]===undefined?!![]:![]:!![]})[_0xc4fb('0xa')](function(_0x182658){logger[_0xc4fb('0x13')](_0xc4fb('0x16'),_0x48e4dd);logger['debug'](_0xc4fb('0x16'),_0x48e4dd,JSON[_0xc4fb('0xf')](_0x182658));_0x5ac870(_0x182658);})['catch'](function(_0x4e8779){logger['error'](_0xc4fb('0x16'),_0x4e8779[_0xc4fb('0x12')],_0x48e4dd);_0x59ba3d(_0x4c7279[_0xc4fb('0x10')](0x1f4,_0x4e8779[_0xc4fb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 6976e00..89b2943 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 _0x954d=['connect-timeout','express','Router','../../config/environment','./squareReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x156cbc,_0x4fcc20){var _0x30f727=function(_0x556685){while(--_0x556685){_0x156cbc['push'](_0x156cbc['shift']());}};_0x30f727(++_0x4fcc20);}(_0x954d,0xd9));var _0xd954=function(_0xf67a90,_0x2eb2f3){_0xf67a90=_0xf67a90-0x0;var _0x648b2=_0x954d[_0xf67a90];return _0x648b2;};'use strict';var multer=require(_0xd954('0x0'));var util=require(_0xd954('0x1'));var path=require(_0xd954('0x2'));var timeout=require(_0xd954('0x3'));var express=require(_0xd954('0x4'));var router=express[_0xd954('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd954('0x6'));var controller=require(_0xd954('0x7'));router[_0xd954('0x8')]('/',auth[_0xd954('0x9')](),controller[_0xd954('0xa')]);router[_0xd954('0x8')]('/describe',auth[_0xd954('0x9')](),controller[_0xd954('0xb')]);router[_0xd954('0x8')](_0xd954('0xc'),auth[_0xd954('0x9')](),controller[_0xd954('0xd')]);router['post']('/',auth[_0xd954('0x9')](),controller[_0xd954('0xe')]);router[_0xd954('0xf')](_0xd954('0xc'),auth[_0xd954('0x9')](),controller[_0xd954('0x10')]);router[_0xd954('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd954('0x12')]);module[_0xd954('0x13')]=router; \ No newline at end of file +var _0xe162=['create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareReport.controller','/describe','isAuthenticated','describe','show','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe162,0x95));var _0x2e16=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe162[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x2e16('0x0'));var util=require(_0x2e16('0x1'));var path=require(_0x2e16('0x2'));var timeout=require(_0x2e16('0x3'));var express=require(_0x2e16('0x4'));var router=express['Router']();var auth=require(_0x2e16('0x5'));var interaction=require(_0x2e16('0x6'));var config=require('../../config/environment');var controller=require(_0x2e16('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2e16('0x8'),auth[_0x2e16('0x9')](),controller[_0x2e16('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2e16('0xb')]);router[_0x2e16('0xc')]('/',auth['isAuthenticated'](),controller[_0x2e16('0xd')]);router[_0x2e16('0xe')](_0x2e16('0xf'),auth[_0x2e16('0x9')](),controller[_0x2e16('0x10')]);router['delete'](_0x2e16('0xf'),auth[_0x2e16('0x9')](),controller[_0x2e16('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3e5cd1d..14eb6ef 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 _0x9db0=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x309f71,_0x3a56ff){var _0x1f9bf4=function(_0x5b9024){while(--_0x5b9024){_0x309f71['push'](_0x309f71['shift']());}};_0x1f9bf4(++_0x3a56ff);}(_0x9db0,0xa0));var _0x09db=function(_0x191026,_0x6dde39){_0x191026=_0x191026-0x0;var _0x2301fb=_0x9db0[_0x191026];return _0x2301fb;};'use strict';var Sequelize=require(_0x09db('0x0'));module[_0x09db('0x1')]={'network':{'type':Sequelize[_0x09db('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x09db('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x09db('0x2')]},'type':{'type':Sequelize[_0x09db('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x09db('0x2')]},'callerid':{'type':Sequelize[_0x09db('0x2')]},'calleridname':{'type':Sequelize[_0x09db('0x2')]},'callingpres':{'type':Sequelize[_0x09db('0x2')]},'callingani2':{'type':Sequelize[_0x09db('0x2')]},'callington':{'type':Sequelize[_0x09db('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x09db('0x2')]},'context':{'type':Sequelize[_0x09db('0x2')]},'extension':{'type':Sequelize[_0x09db('0x2')]},'priority':{'type':Sequelize[_0x09db('0x2')]},'enhanced':{'type':Sequelize[_0x09db('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x09db('0x2')]},'project_name':{'type':Sequelize[_0x09db('0x2')]},'joinAt':{'type':Sequelize[_0x09db('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x09db('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3b9a=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3b9a,0x1d5));var _0xa3b9=function(_0x45e9b4,_0x4133e3){_0x45e9b4=_0x45e9b4-0x0;var _0xdcf7fd=_0x3b9a[_0x45e9b4];return _0xdcf7fd;};'use strict';var Sequelize=require(_0xa3b9('0x0'));module[_0xa3b9('0x1')]={'network':{'type':Sequelize[_0xa3b9('0x2')]},'network_script':{'type':Sequelize[_0xa3b9('0x2')]},'request':{'type':Sequelize[_0xa3b9('0x2')]},'channel':{'type':Sequelize[_0xa3b9('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xa3b9('0x2')]},'callerid':{'type':Sequelize[_0xa3b9('0x2')]},'calleridname':{'type':Sequelize[_0xa3b9('0x2')]},'callingpres':{'type':Sequelize[_0xa3b9('0x2')]},'callingani2':{'type':Sequelize[_0xa3b9('0x2')]},'callington':{'type':Sequelize[_0xa3b9('0x2')]},'callingtns':{'type':Sequelize[_0xa3b9('0x2')]},'dnid':{'type':Sequelize[_0xa3b9('0x2')]},'rdnis':{'type':Sequelize[_0xa3b9('0x2')]},'context':{'type':Sequelize[_0xa3b9('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa3b9('0x2')]},'enhanced':{'type':Sequelize[_0xa3b9('0x2')]},'accountcode':{'type':Sequelize[_0xa3b9('0x2')]},'threadid':{'type':Sequelize[_0xa3b9('0x2')]},'project_name':{'type':Sequelize[_0xa3b9('0x2')]},'joinAt':{'type':Sequelize[_0xa3b9('0x3')]},'leaveAt':{'type':Sequelize[_0xa3b9('0x3')]},'bot':{'type':Sequelize[_0xa3b9('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 489fe0e..2cbd87b 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 _0xcf24=['path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','SquareReport','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x3503e5,_0x490a96){var _0x2059fa=function(_0x6e735f){while(--_0x6e735f){_0x3503e5['push'](_0x3503e5['shift']());}};_0x2059fa(++_0x490a96);}(_0xcf24,0x92));var _0x4cf2=function(_0x3cf9a8,_0x3b907e){_0x3cf9a8=_0x3cf9a8-0x0;var _0x2a2096=_0xcf24[_0x3cf9a8];return _0x2a2096;};'use strict';var pdf=require(_0x4cf2('0x0'));var emlformat=require(_0x4cf2('0x1'));var rimraf=require(_0x4cf2('0x2'));var zipdir=require(_0x4cf2('0x3'));var jsonpatch=require(_0x4cf2('0x4'));var rp=require(_0x4cf2('0x5'));var moment=require(_0x4cf2('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4cf2('0x7'));var util=require('util');var path=require(_0x4cf2('0x8'));var sox=require(_0x4cf2('0x9'));var csv=require(_0x4cf2('0xa'));var ejs=require(_0x4cf2('0xb'));var fs=require('fs');var _=require(_0x4cf2('0xc'));var squel=require('squel');var crypto=require(_0x4cf2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4cf2('0xe'));var toCsv=require(_0x4cf2('0xa'));var querystring=require(_0x4cf2('0xf'));var Papa=require(_0x4cf2('0x10'));var Redis=require('ioredis');var authService=require(_0x4cf2('0x11'));var qs=require(_0x4cf2('0x12'));var as=require(_0x4cf2('0x13'));var hardwareService=require(_0x4cf2('0x14'));var logger=require(_0x4cf2('0x15'))(_0x4cf2('0x16'));var utils=require(_0x4cf2('0x17'));var config=require(_0x4cf2('0x18'));var db=require(_0x4cf2('0x19'))['db'];function respondWithStatusCode(_0x44e8e1,_0x34074d){_0x34074d=_0x34074d||0xcc;return function(_0x45fe42){if(_0x45fe42){return _0x44e8e1[_0x4cf2('0x1a')](_0x34074d);}return _0x44e8e1[_0x4cf2('0x1b')](_0x34074d)[_0x4cf2('0x1c')]();};}function respondWithResult(_0x41cc02,_0x418ec8){_0x418ec8=_0x418ec8||0xc8;return function(_0x132cc4){if(_0x132cc4){return _0x41cc02['status'](_0x418ec8)[_0x4cf2('0x1d')](_0x132cc4);}};}function respondWithFilteredResult(_0x5693a2,_0x2f4bb7){return function(_0x3a5e22){if(_0x3a5e22){var _0x1d276b=_0x3a5e22[_0x4cf2('0x1e')],_0x31983b=_0x2f4bb7[_0x4cf2('0x1f')],_0x3d1d0f=_0x2f4bb7[_0x4cf2('0x1f')]+_0x2f4bb7[_0x4cf2('0x20')],_0x5f0e1f;if(_0x3d1d0f>=_0x1d276b){_0x3d1d0f=_0x1d276b;_0x5f0e1f=0xc8;}else{_0x5f0e1f=0xce;}_0x5693a2['status'](_0x5f0e1f);return _0x5693a2[_0x4cf2('0x21')]('Content-Range',_0x31983b+'-'+_0x3d1d0f+'/'+_0x1d276b)['json'](_0x3a5e22);}return null;};}function patchUpdates(_0x324d45){return function(_0x37cfad){try{jsonpatch[_0x4cf2('0x22')](_0x37cfad,_0x324d45,!![]);}catch(_0x3818c4){return BPromise[_0x4cf2('0x23')](_0x3818c4);}return _0x37cfad[_0x4cf2('0x24')]();};}function saveUpdates(_0x54ed65,_0x44338d){return function(_0x2c1722){if(_0x2c1722){return _0x2c1722[_0x4cf2('0x25')](_0x54ed65)[_0x4cf2('0x26')](function(_0x3921d5){return _0x3921d5;});}return null;};}function removeEntity(_0x176e36,_0x27de57){return function(_0x42cdc7){if(_0x42cdc7){return _0x42cdc7['destroy']()[_0x4cf2('0x26')](function(){_0x176e36[_0x4cf2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x552d3c,_0x2e1ba2){return function(_0x192c44){if(!_0x192c44){_0x552d3c[_0x4cf2('0x1a')](0x194);}return _0x192c44;};}function handleError(_0x7e0349,_0x90e247){_0x90e247=_0x90e247||0x1f4;return function(_0x52e9be){logger[_0x4cf2('0x27')](_0x52e9be[_0x4cf2('0x28')]);if(_0x52e9be[_0x4cf2('0x29')]){delete _0x52e9be['name'];}_0x7e0349['status'](_0x90e247)[_0x4cf2('0x2a')](_0x52e9be);};}exports[_0x4cf2('0x2b')]=function(_0x2fdcb6,_0x5ba3d9){var _0x11b974={},_0x2a48da={},_0x4eb2b0={'count':0x0,'rows':[]};var _0x2a24b0=_[_0x4cf2('0x2c')](db['SquareReport'][_0x4cf2('0x2d')],function(_0x55d77f){return{'name':_0x55d77f['fieldName'],'type':_0x55d77f[_0x4cf2('0x2e')]['key']};});_0x2a48da[_0x4cf2('0x2f')]=_['map'](_0x2a24b0,_0x4cf2('0x29'));_0x2a48da['query']=_[_0x4cf2('0x30')](_0x2fdcb6[_0x4cf2('0x31')]);_0x2a48da['filters']=_[_0x4cf2('0x32')](_0x2a48da[_0x4cf2('0x2f')],_0x2a48da[_0x4cf2('0x31')]);_0x11b974[_0x4cf2('0x33')]=_[_0x4cf2('0x32')](_0x2a48da[_0x4cf2('0x2f')],qs[_0x4cf2('0x34')](_0x2fdcb6[_0x4cf2('0x31')]['fields']));_0x11b974[_0x4cf2('0x33')]=_0x11b974[_0x4cf2('0x33')][_0x4cf2('0x35')]?_0x11b974[_0x4cf2('0x33')]:_0x2a48da[_0x4cf2('0x2f')];if(!_0x2fdcb6['query'][_0x4cf2('0x36')](_0x4cf2('0x37'))){_0x11b974[_0x4cf2('0x20')]=qs['limit'](_0x2fdcb6[_0x4cf2('0x31')][_0x4cf2('0x20')]);_0x11b974[_0x4cf2('0x1f')]=qs[_0x4cf2('0x1f')](_0x2fdcb6[_0x4cf2('0x31')][_0x4cf2('0x1f')]);}_0x11b974[_0x4cf2('0x38')]=qs[_0x4cf2('0x39')](_0x2fdcb6[_0x4cf2('0x31')]['sort']);_0x11b974['where']=qs[_0x4cf2('0x3a')](_[_0x4cf2('0x3b')](_0x2fdcb6[_0x4cf2('0x31')],_0x2a48da[_0x4cf2('0x3a')]),_0x2a24b0);if(_0x2fdcb6[_0x4cf2('0x31')][_0x4cf2('0x3c')]){_0x11b974[_0x4cf2('0x3d')]=_[_0x4cf2('0x3e')](_0x11b974[_0x4cf2('0x3d')],{'$or':_[_0x4cf2('0x2c')](_0x2a24b0,function(_0x57db73){if(_0x57db73['type']!=='VIRTUAL'){var _0x3dac59={};_0x3dac59[_0x57db73[_0x4cf2('0x29')]]={'$like':'%'+_0x2fdcb6[_0x4cf2('0x31')]['filter']+'%'};return _0x3dac59;}})});}_0x11b974=_['merge']({},_0x11b974,_0x2fdcb6[_0x4cf2('0x3f')]);var _0x535eb8={'where':_0x11b974[_0x4cf2('0x3d')]};return db[_0x4cf2('0x40')][_0x4cf2('0x1e')](_0x535eb8)[_0x4cf2('0x26')](function(_0xd6e19d){_0x4eb2b0[_0x4cf2('0x1e')]=_0xd6e19d;if(_0x2fdcb6['query']['includeAll']){_0x11b974[_0x4cf2('0x41')]=[{'all':!![]}];}return db['SquareReport'][_0x4cf2('0x42')](_0x11b974);})['then'](function(_0x24998f){_0x4eb2b0[_0x4cf2('0x43')]=_0x24998f;return _0x4eb2b0;})[_0x4cf2('0x26')](respondWithFilteredResult(_0x5ba3d9,_0x11b974))[_0x4cf2('0x44')](handleError(_0x5ba3d9,null));};exports[_0x4cf2('0x45')]=function(_0x384dee,_0x8fe2ae){var _0xea2915={'raw':!![],'where':{'id':_0x384dee[_0x4cf2('0x46')]['id']}},_0x42807f={};_0x42807f[_0x4cf2('0x2f')]=_[_0x4cf2('0x30')](db[_0x4cf2('0x40')]['rawAttributes']);_0x42807f[_0x4cf2('0x31')]=_[_0x4cf2('0x30')](_0x384dee[_0x4cf2('0x31')]);_0x42807f[_0x4cf2('0x3a')]=_[_0x4cf2('0x32')](_0x42807f[_0x4cf2('0x2f')],_0x42807f[_0x4cf2('0x31')]);_0xea2915['attributes']=_['intersection'](_0x42807f[_0x4cf2('0x2f')],qs[_0x4cf2('0x34')](_0x384dee[_0x4cf2('0x31')]['fields']));_0xea2915[_0x4cf2('0x33')]=_0xea2915[_0x4cf2('0x33')][_0x4cf2('0x35')]?_0xea2915[_0x4cf2('0x33')]:_0x42807f[_0x4cf2('0x2f')];if(_0x384dee[_0x4cf2('0x31')][_0x4cf2('0x47')]){_0xea2915['include']=[{'all':!![]}];}_0xea2915=_[_0x4cf2('0x3e')]({},_0xea2915,_0x384dee[_0x4cf2('0x3f')]);return db[_0x4cf2('0x40')]['find'](_0xea2915)['then'](handleEntityNotFound(_0x8fe2ae,null))[_0x4cf2('0x26')](respondWithResult(_0x8fe2ae,null))[_0x4cf2('0x44')](handleError(_0x8fe2ae,null));};exports['create']=function(_0x58984c,_0x81aabf){return db['SquareReport'][_0x4cf2('0x48')](_0x58984c[_0x4cf2('0x49')],{})[_0x4cf2('0x26')](respondWithResult(_0x81aabf,0xc9))[_0x4cf2('0x44')](handleError(_0x81aabf,null));};exports[_0x4cf2('0x25')]=function(_0x549115,_0x2ac53d){if(_0x549115[_0x4cf2('0x49')]['id']){delete _0x549115[_0x4cf2('0x49')]['id'];}return db[_0x4cf2('0x40')][_0x4cf2('0x4a')]({'where':{'id':_0x549115[_0x4cf2('0x46')]['id']}})[_0x4cf2('0x26')](handleEntityNotFound(_0x2ac53d,null))[_0x4cf2('0x26')](saveUpdates(_0x549115[_0x4cf2('0x49')],null))['then'](respondWithResult(_0x2ac53d,null))[_0x4cf2('0x44')](handleError(_0x2ac53d,null));};exports[_0x4cf2('0x4b')]=function(_0x1ab3cf,_0x125037){return db[_0x4cf2('0x40')]['find']({'where':{'id':_0x1ab3cf[_0x4cf2('0x46')]['id']}})[_0x4cf2('0x26')](handleEntityNotFound(_0x125037,null))[_0x4cf2('0x26')](removeEntity(_0x125037,null))[_0x4cf2('0x44')](handleError(_0x125037,null));};exports[_0x4cf2('0x4c')]=function(_0x159680,_0xf28fb5){return db[_0x4cf2('0x40')][_0x4cf2('0x4c')]()[_0x4cf2('0x26')](respondWithResult(_0xf28fb5,null))[_0x4cf2('0x44')](handleError(_0xf28fb5,null));}; \ No newline at end of file +var _0xc35c=['options','count','includeAll','include','rows','catch','merge','find','create','body','params','describe','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','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','offset','status','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','SquareReport','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','type','VIRTUAL'];(function(_0x5edae6,_0x3b4a19){var _0x1490a2=function(_0x16a961){while(--_0x16a961){_0x5edae6['push'](_0x5edae6['shift']());}};_0x1490a2(++_0x3b4a19);}(_0xc35c,0xa0));var _0xcc35=function(_0x337804,_0x490a9a){_0x337804=_0x337804-0x0;var _0x30e983=_0xc35c[_0x337804];return _0x30e983;};'use strict';var pdf=require(_0xcc35('0x0'));var emlformat=require(_0xcc35('0x1'));var rimraf=require(_0xcc35('0x2'));var zipdir=require(_0xcc35('0x3'));var jsonpatch=require(_0xcc35('0x4'));var rp=require(_0xcc35('0x5'));var moment=require(_0xcc35('0x6'));var BPromise=require(_0xcc35('0x7'));var Mustache=require(_0xcc35('0x8'));var util=require(_0xcc35('0x9'));var path=require(_0xcc35('0xa'));var sox=require('sox');var csv=require(_0xcc35('0xb'));var ejs=require(_0xcc35('0xc'));var fs=require('fs');var _=require(_0xcc35('0xd'));var squel=require('squel');var crypto=require(_0xcc35('0xe'));var jsforce=require(_0xcc35('0xf'));var deskjs=require(_0xcc35('0x10'));var toCsv=require(_0xcc35('0xb'));var querystring=require(_0xcc35('0x11'));var Papa=require(_0xcc35('0x12'));var Redis=require(_0xcc35('0x13'));var authService=require(_0xcc35('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc35('0x15'));var logger=require(_0xcc35('0x16'))(_0xcc35('0x17'));var utils=require('../../config/utils');var config=require(_0xcc35('0x18'));var db=require(_0xcc35('0x19'))['db'];function respondWithStatusCode(_0x39ffe1,_0x1ac351){_0x1ac351=_0x1ac351||0xcc;return function(_0x25b558){if(_0x25b558){return _0x39ffe1['sendStatus'](_0x1ac351);}return _0x39ffe1['status'](_0x1ac351)[_0xcc35('0x1a')]();};}function respondWithResult(_0x2d9271,_0x9ca248){_0x9ca248=_0x9ca248||0xc8;return function(_0x1216f3){if(_0x1216f3){return _0x2d9271['status'](_0x9ca248)['json'](_0x1216f3);}};}function respondWithFilteredResult(_0x29730a,_0x49f3c2){return function(_0x7ed919){if(_0x7ed919){var _0x2d8fc8=_0x7ed919['count'],_0x39423c=_0x49f3c2['offset'],_0x475cb4=_0x49f3c2[_0xcc35('0x1b')]+_0x49f3c2['limit'],_0x368c73;if(_0x475cb4>=_0x2d8fc8){_0x475cb4=_0x2d8fc8;_0x368c73=0xc8;}else{_0x368c73=0xce;}_0x29730a[_0xcc35('0x1c')](_0x368c73);return _0x29730a[_0xcc35('0x1d')](_0xcc35('0x1e'),_0x39423c+'-'+_0x475cb4+'/'+_0x2d8fc8)[_0xcc35('0x1f')](_0x7ed919);}return null;};}function patchUpdates(_0x167aad){return function(_0x1ff161){try{jsonpatch[_0xcc35('0x20')](_0x1ff161,_0x167aad,!![]);}catch(_0x5e0498){return BPromise[_0xcc35('0x21')](_0x5e0498);}return _0x1ff161[_0xcc35('0x22')]();};}function saveUpdates(_0xb396a9,_0x142509){return function(_0x54df94){if(_0x54df94){return _0x54df94[_0xcc35('0x23')](_0xb396a9)[_0xcc35('0x24')](function(_0x6638c4){return _0x6638c4;});}return null;};}function removeEntity(_0x283182,_0x5b1df7){return function(_0x217cb9){if(_0x217cb9){return _0x217cb9[_0xcc35('0x25')]()[_0xcc35('0x24')](function(){_0x283182[_0xcc35('0x1c')](0xcc)[_0xcc35('0x1a')]();});}};}function handleEntityNotFound(_0x4c7af8,_0x55bcbb){return function(_0x26e21d){if(!_0x26e21d){_0x4c7af8[_0xcc35('0x26')](0x194);}return _0x26e21d;};}function handleError(_0x185467,_0x4b6eb7){_0x4b6eb7=_0x4b6eb7||0x1f4;return function(_0x1c149e){logger['error'](_0x1c149e['stack']);if(_0x1c149e[_0xcc35('0x27')]){delete _0x1c149e[_0xcc35('0x27')];}_0x185467[_0xcc35('0x1c')](_0x4b6eb7)[_0xcc35('0x28')](_0x1c149e);};}exports[_0xcc35('0x29')]=function(_0x409689,_0x1d9a89){var _0x545bd2={},_0x480476={},_0x2aeeab={'count':0x0,'rows':[]};var _0x408a9f=_['map'](db[_0xcc35('0x2a')][_0xcc35('0x2b')],function(_0x39dce9){return{'name':_0x39dce9[_0xcc35('0x2c')],'type':_0x39dce9['type']['key']};});_0x480476[_0xcc35('0x2d')]=_[_0xcc35('0x2e')](_0x408a9f,_0xcc35('0x27'));_0x480476[_0xcc35('0x2f')]=_[_0xcc35('0x30')](_0x409689[_0xcc35('0x2f')]);_0x480476['filters']=_[_0xcc35('0x31')](_0x480476['model'],_0x480476[_0xcc35('0x2f')]);_0x545bd2[_0xcc35('0x32')]=_[_0xcc35('0x31')](_0x480476['model'],qs[_0xcc35('0x33')](_0x409689[_0xcc35('0x2f')][_0xcc35('0x33')]));_0x545bd2[_0xcc35('0x32')]=_0x545bd2[_0xcc35('0x32')][_0xcc35('0x34')]?_0x545bd2[_0xcc35('0x32')]:_0x480476['model'];if(!_0x409689[_0xcc35('0x2f')][_0xcc35('0x35')](_0xcc35('0x36'))){_0x545bd2[_0xcc35('0x37')]=qs[_0xcc35('0x37')](_0x409689['query'][_0xcc35('0x37')]);_0x545bd2['offset']=qs[_0xcc35('0x1b')](_0x409689['query'][_0xcc35('0x1b')]);}_0x545bd2['order']=qs['sort'](_0x409689[_0xcc35('0x2f')][_0xcc35('0x38')]);_0x545bd2[_0xcc35('0x39')]=qs[_0xcc35('0x3a')](_['pick'](_0x409689[_0xcc35('0x2f')],_0x480476['filters']),_0x408a9f);if(_0x409689[_0xcc35('0x2f')][_0xcc35('0x3b')]){_0x545bd2[_0xcc35('0x39')]=_['merge'](_0x545bd2[_0xcc35('0x39')],{'$or':_[_0xcc35('0x2e')](_0x408a9f,function(_0x758090){if(_0x758090[_0xcc35('0x3c')]!==_0xcc35('0x3d')){var _0x2974bc={};_0x2974bc[_0x758090[_0xcc35('0x27')]]={'$like':'%'+_0x409689[_0xcc35('0x2f')]['filter']+'%'};return _0x2974bc;}})});}_0x545bd2=_['merge']({},_0x545bd2,_0x409689[_0xcc35('0x3e')]);var _0x1e3d26={'where':_0x545bd2['where']};return db['SquareReport'][_0xcc35('0x3f')](_0x1e3d26)[_0xcc35('0x24')](function(_0x188f01){_0x2aeeab['count']=_0x188f01;if(_0x409689[_0xcc35('0x2f')][_0xcc35('0x40')]){_0x545bd2[_0xcc35('0x41')]=[{'all':!![]}];}return db[_0xcc35('0x2a')]['findAll'](_0x545bd2);})[_0xcc35('0x24')](function(_0x41e8aa){_0x2aeeab[_0xcc35('0x42')]=_0x41e8aa;return _0x2aeeab;})[_0xcc35('0x24')](respondWithFilteredResult(_0x1d9a89,_0x545bd2))[_0xcc35('0x43')](handleError(_0x1d9a89,null));};exports['show']=function(_0x56f05a,_0x33cabc){var _0x3ba05={'raw':!![],'where':{'id':_0x56f05a['params']['id']}},_0xffe9da={};_0xffe9da[_0xcc35('0x2d')]=_['keys'](db[_0xcc35('0x2a')][_0xcc35('0x2b')]);_0xffe9da['query']=_[_0xcc35('0x30')](_0x56f05a[_0xcc35('0x2f')]);_0xffe9da[_0xcc35('0x3a')]=_[_0xcc35('0x31')](_0xffe9da[_0xcc35('0x2d')],_0xffe9da[_0xcc35('0x2f')]);_0x3ba05['attributes']=_[_0xcc35('0x31')](_0xffe9da[_0xcc35('0x2d')],qs[_0xcc35('0x33')](_0x56f05a['query'][_0xcc35('0x33')]));_0x3ba05[_0xcc35('0x32')]=_0x3ba05[_0xcc35('0x32')][_0xcc35('0x34')]?_0x3ba05[_0xcc35('0x32')]:_0xffe9da[_0xcc35('0x2d')];if(_0x56f05a[_0xcc35('0x2f')][_0xcc35('0x40')]){_0x3ba05[_0xcc35('0x41')]=[{'all':!![]}];}_0x3ba05=_[_0xcc35('0x44')]({},_0x3ba05,_0x56f05a[_0xcc35('0x3e')]);return db[_0xcc35('0x2a')][_0xcc35('0x45')](_0x3ba05)[_0xcc35('0x24')](handleEntityNotFound(_0x33cabc,null))[_0xcc35('0x24')](respondWithResult(_0x33cabc,null))[_0xcc35('0x43')](handleError(_0x33cabc,null));};exports[_0xcc35('0x46')]=function(_0x447a8a,_0x33d35f){return db['SquareReport'][_0xcc35('0x46')](_0x447a8a[_0xcc35('0x47')],{})['then'](respondWithResult(_0x33d35f,0xc9))[_0xcc35('0x43')](handleError(_0x33d35f,null));};exports[_0xcc35('0x23')]=function(_0x155bc8,_0x517b4b){if(_0x155bc8[_0xcc35('0x47')]['id']){delete _0x155bc8[_0xcc35('0x47')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x155bc8[_0xcc35('0x48')]['id']}})[_0xcc35('0x24')](handleEntityNotFound(_0x517b4b,null))['then'](saveUpdates(_0x155bc8[_0xcc35('0x47')],null))[_0xcc35('0x24')](respondWithResult(_0x517b4b,null))['catch'](handleError(_0x517b4b,null));};exports[_0xcc35('0x25')]=function(_0x391159,_0x2b04bb){return db[_0xcc35('0x2a')]['find']({'where':{'id':_0x391159[_0xcc35('0x48')]['id']}})[_0xcc35('0x24')](handleEntityNotFound(_0x2b04bb,null))[_0xcc35('0x24')](removeEntity(_0x2b04bb,null))[_0xcc35('0x43')](handleError(_0x2b04bb,null));};exports[_0xcc35('0x49')]=function(_0x26c165,_0x1cf9df){return db[_0xcc35('0x2a')][_0xcc35('0x49')]()[_0xcc35('0x24')](respondWithResult(_0x1cf9df,null))[_0xcc35('0x43')](handleError(_0x1cf9df,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 3e91f4d..eab2c3e 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 _0x513a=['rimraf','define','report_square','leaveAt','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x44865b,_0x1730f0){var _0x5d8362=function(_0x36b776){while(--_0x36b776){_0x44865b['push'](_0x44865b['shift']());}};_0x5d8362(++_0x1730f0);}(_0x513a,0x1e4));var _0xa513=function(_0x5c7107,_0x3c9e3a){_0x5c7107=_0x5c7107-0x0;var _0x52d2cb=_0x513a[_0x5c7107];return _0x52d2cb;};'use strict';var _=require(_0xa513('0x0'));var util=require(_0xa513('0x1'));var logger=require(_0xa513('0x2'))('api');var moment=require(_0xa513('0x3'));var BPromise=require('bluebird');var rp=require(_0xa513('0x4'));var fs=require('fs');var path=require(_0xa513('0x5'));var rimraf=require(_0xa513('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module['exports']=function(_0x2c80a1,_0x20dbcf){return _0x2c80a1[_0xa513('0x7')]('SquareReport',attributes,{'tableName':_0xa513('0x8'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid','project_name']},{'name':'leaveAt','fields':[_0xa513('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdddd=['rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4fcdc4,_0x23a840){var _0x45b3d0=function(_0x234247){while(--_0x234247){_0x4fcdc4['push'](_0x4fcdc4['shift']());}};_0x45b3d0(++_0x23a840);}(_0xdddd,0x17a));var _0xdddd=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0xdddd[_0x398294];return _0x2a872d;};'use strict';var _=require(_0xdddd('0x0'));var util=require('util');var logger=require(_0xdddd('0x1'))(_0xdddd('0x2'));var moment=require(_0xdddd('0x3'));var BPromise=require(_0xdddd('0x4'));var rp=require(_0xdddd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdddd('0x6'));var config=require(_0xdddd('0x7'));var attributes=require(_0xdddd('0x8'));module[_0xdddd('0x9')]=function(_0x511df9,_0x518fc8){return _0x511df9[_0xdddd('0xa')](_0xdddd('0xb'),attributes,{'tableName':_0xdddd('0xc'),'paranoid':![],'indexes':[{'name':_0xdddd('0xd'),'fields':['uniqueid',_0xdddd('0xe')]},{'name':_0xdddd('0xf'),'fields':[_0xdddd('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 1123a57..7adf62f 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 _0xfce6=['catch','SquareReport','create','body','options','raw','then','CreateSquareReport','stringify','UpdateSquareReport','update','where','attributes','lodash','util','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xfce6,0x143));var _0x6fce=function(_0x502784,_0x12a1b0){_0x502784=_0x502784-0x0;var _0x5657f0=_0xfce6[_0x502784];return _0x5657f0;};'use strict';var _=require(_0x6fce('0x0'));var util=require(_0x6fce('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6fce('0x2'));var fs=require('fs');var Redis=require(_0x6fce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fce('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6fce('0x5'));var jayson=require(_0x6fce('0x6'));var client=jayson[_0x6fce('0x7')][_0x6fce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d36ca,_0x3a2c9b,_0x22c175){return new BPromise(function(_0x316238,_0x1630f7){return client[_0x6fce('0x9')](_0x2d36ca,_0x22c175)['then'](function(_0xa62c21){logger[_0x6fce('0xa')](_0x6fce('0xb'),_0x3a2c9b,_0x6fce('0xc'));logger[_0x6fce('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x3a2c9b,_0x6fce('0xc'),JSON['stringify'](_0xa62c21));if(_0xa62c21[_0x6fce('0xe')]){if(_0xa62c21[_0x6fce('0xe')][_0x6fce('0xf')]===0x1f4){logger[_0x6fce('0xe')](_0x6fce('0xb'),_0x3a2c9b,_0xa62c21[_0x6fce('0xe')][_0x6fce('0x10')]);return _0x1630f7(_0xa62c21[_0x6fce('0xe')][_0x6fce('0x10')]);}logger[_0x6fce('0xe')](_0x6fce('0xb'),_0x3a2c9b,_0xa62c21[_0x6fce('0xe')][_0x6fce('0x10')]);return _0x316238(_0xa62c21['error']['message']);}else{logger[_0x6fce('0xa')](_0x6fce('0xb'),_0x3a2c9b,_0x6fce('0xc'));_0x316238(_0xa62c21[_0x6fce('0x11')][_0x6fce('0x10')]);}})[_0x6fce('0x12')](function(_0x2ebeaf){logger['error']('SquareReport,\x20%s,\x20%s',_0x3a2c9b,_0x2ebeaf);_0x1630f7(_0x2ebeaf);});});}exports['CreateSquareReport']=function(_0x261fa5){var _0x483a37=this;return new Promise(function(_0x5bda19,_0x41a933){return db[_0x6fce('0x13')][_0x6fce('0x14')](_0x261fa5[_0x6fce('0x15')],{'raw':_0x261fa5[_0x6fce('0x16')]?_0x261fa5[_0x6fce('0x16')][_0x6fce('0x17')]===undefined?!![]:![]:!![]})[_0x6fce('0x18')](function(_0x2e0ce1){logger['info'](_0x6fce('0x19'),_0x261fa5);logger[_0x6fce('0xd')](_0x6fce('0x19'),_0x261fa5,JSON[_0x6fce('0x1a')](_0x2e0ce1));_0x5bda19(_0x2e0ce1);})['catch'](function(_0x295f17){logger[_0x6fce('0xe')](_0x6fce('0x19'),_0x295f17[_0x6fce('0x10')],_0x261fa5);_0x41a933(_0x483a37[_0x6fce('0xe')](0x1f4,_0x295f17[_0x6fce('0x10')]));});});};exports[_0x6fce('0x1b')]=function(_0x10a65b){var _0x21fa3f=this;return new Promise(function(_0x5aff80,_0x468c0a){return db[_0x6fce('0x13')][_0x6fce('0x1c')](_0x10a65b[_0x6fce('0x15')],{'raw':_0x10a65b[_0x6fce('0x16')]?_0x10a65b[_0x6fce('0x16')][_0x6fce('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10a65b[_0x6fce('0x16')]?_0x10a65b['options'][_0x6fce('0x1d')]||null:null,'attributes':_0x10a65b[_0x6fce('0x16')]?_0x10a65b[_0x6fce('0x16')][_0x6fce('0x1e')]||null:null,'limit':_0x10a65b[_0x6fce('0x16')]?_0x10a65b['options']['limit']||null:null})[_0x6fce('0x18')](function(_0xe25752){logger[_0x6fce('0xa')]('UpdateSquareReport',_0x10a65b);logger[_0x6fce('0xd')]('UpdateSquareReport',_0x10a65b,JSON[_0x6fce('0x1a')](_0xe25752));_0x5aff80(_0xe25752);})[_0x6fce('0x12')](function(_0x4ef32b){logger[_0x6fce('0xe')](_0x6fce('0x1b'),_0x4ef32b[_0x6fce('0x10')],_0x10a65b);_0x468c0a(_0x21fa3f[_0x6fce('0xe')](0x1f4,_0x4ef32b['message']));});});}; \ No newline at end of file +var _0x360a=['client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3764c5,_0x526b87){var _0x3b5133=function(_0x3f870d){while(--_0x3f870d){_0x3764c5['push'](_0x3764c5['shift']());}};_0x3b5133(++_0x526b87);}(_0x360a,0x6d));var _0xa360=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x360a[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xa360('0x0'));var util=require('util');var moment=require(_0xa360('0x1'));var BPromise=require(_0xa360('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa360('0x3'));var db=require(_0xa360('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa360('0x5'))(_0xa360('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa360('0x7')][_0xa360('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c0da8,_0x28b8e8,_0x1e2744){return new BPromise(function(_0x34084d,_0x2ec2f9){return client[_0xa360('0x9')](_0x2c0da8,_0x1e2744)[_0xa360('0xa')](function(_0x5d12b3){logger['info'](_0xa360('0xb'),_0x28b8e8,_0xa360('0xc'));logger[_0xa360('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x28b8e8,_0xa360('0xc'),JSON[_0xa360('0xe')](_0x5d12b3));if(_0x5d12b3[_0xa360('0xf')]){if(_0x5d12b3['error'][_0xa360('0x10')]===0x1f4){logger['error'](_0xa360('0xb'),_0x28b8e8,_0x5d12b3[_0xa360('0xf')][_0xa360('0x11')]);return _0x2ec2f9(_0x5d12b3[_0xa360('0xf')]['message']);}logger['error'](_0xa360('0xb'),_0x28b8e8,_0x5d12b3[_0xa360('0xf')][_0xa360('0x11')]);return _0x34084d(_0x5d12b3['error'][_0xa360('0x11')]);}else{logger[_0xa360('0x12')]('SquareReport,\x20%s,\x20%s',_0x28b8e8,_0xa360('0xc'));_0x34084d(_0x5d12b3['result'][_0xa360('0x11')]);}})[_0xa360('0x13')](function(_0x51e208){logger['error'](_0xa360('0xb'),_0x28b8e8,_0x51e208);_0x2ec2f9(_0x51e208);});});}exports[_0xa360('0x14')]=function(_0x57e569){var _0x259725=this;return new Promise(function(_0x4db9c7,_0xc16229){return db['SquareReport'][_0xa360('0x15')](_0x57e569[_0xa360('0x16')],{'raw':_0x57e569[_0xa360('0x17')]?_0x57e569[_0xa360('0x17')][_0xa360('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x6bc61b){logger['info'](_0xa360('0x14'),_0x57e569);logger['debug']('CreateSquareReport',_0x57e569,JSON[_0xa360('0xe')](_0x6bc61b));_0x4db9c7(_0x6bc61b);})['catch'](function(_0xffdf5c){logger[_0xa360('0xf')](_0xa360('0x14'),_0xffdf5c[_0xa360('0x11')],_0x57e569);_0xc16229(_0x259725[_0xa360('0xf')](0x1f4,_0xffdf5c[_0xa360('0x11')]));});});};exports[_0xa360('0x19')]=function(_0x1d994e){var _0x35ed88=this;return new Promise(function(_0x270ab9,_0x212c84){return db[_0xa360('0x1a')][_0xa360('0x1b')](_0x1d994e[_0xa360('0x16')],{'raw':_0x1d994e['options']?_0x1d994e[_0xa360('0x17')][_0xa360('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d994e[_0xa360('0x17')]?_0x1d994e[_0xa360('0x17')]['where']||null:null,'attributes':_0x1d994e[_0xa360('0x17')]?_0x1d994e[_0xa360('0x17')][_0xa360('0x1c')]||null:null,'limit':_0x1d994e[_0xa360('0x17')]?_0x1d994e[_0xa360('0x17')]['limit']||null:null})[_0xa360('0xa')](function(_0x501f56){logger[_0xa360('0x12')](_0xa360('0x19'),_0x1d994e);logger[_0xa360('0xd')](_0xa360('0x19'),_0x1d994e,JSON[_0xa360('0xe')](_0x501f56));_0x270ab9(_0x501f56);})[_0xa360('0x13')](function(_0x4c2bbf){logger[_0xa360('0xf')]('UpdateSquareReport',_0x4c2bbf[_0xa360('0x11')],_0x1d994e);_0x212c84(_0x35ed88[_0xa360('0xf')](0x1f4,_0x4c2bbf[_0xa360('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 3c7e7c8..832955a 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x4d0527,_0x40e7b9){var _0x37f03e=function(_0x1b51e6){while(--_0x1b51e6){_0x4d0527['push'](_0x4d0527['shift']());}};_0x37f03e(++_0x40e7b9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5438b6,_0x446306){_0x5438b6=_0x5438b6-0x0;var _0x4680fa=_0x5f2f[_0x5438b6];return _0x4680fa;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x5cb1a4,_0x31feaa){var _0x466c0b=function(_0x471b29){while(--_0x471b29){_0x5cb1a4['push'](_0x5cb1a4['shift']());}};_0x466c0b(++_0x31feaa);}(_0x5f2f,0x73));var _0xf5f2=function(_0x252085,_0x9b7770){_0x252085=_0x252085-0x0;var _0x5bf7ef=_0x5f2f[_0x252085];return _0x5bf7ef;};'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 c3120fa..05043d7 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 _0xcaaf=['exports','STRING','TEXT'];(function(_0x1b6318,_0x5761fd){var _0x573968=function(_0x2b47fd){while(--_0x2b47fd){_0x1b6318['push'](_0x1b6318['shift']());}};_0x573968(++_0x5761fd);}(_0xcaaf,0x129));var _0xfcaa=function(_0x36e0e,_0x50a25c){_0x36e0e=_0x36e0e-0x0;var _0x5a0f02=_0xcaaf[_0x36e0e];return _0x5a0f02;};'use strict';var Sequelize=require('sequelize');module[_0xfcaa('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xfcaa('0x1')]},'data':{'type':Sequelize[_0xfcaa('0x2')]},'project_name':{'type':Sequelize[_0xfcaa('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x21c8=['exports','STRING','TEXT','sequelize'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x21c8,0x1e3));var _0x821c=function(_0x2b72ef,_0x574981){_0x2b72ef=_0x2b72ef-0x0;var _0x56a161=_0x21c8[_0x2b72ef];return _0x56a161;};'use strict';var Sequelize=require(_0x821c('0x0'));module[_0x821c('0x1')]={'uniqueid':{'type':Sequelize[_0x821c('0x2')]},'node':{'type':Sequelize[_0x821c('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x821c('0x3')]},'project_name':{'type':Sequelize[_0x821c('0x2')]},'callerid':{'type':Sequelize[_0x821c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 0e6142b..ba803b4 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 _0x6b10=['error','name','send','map','SquareDetailsReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','rawAttributes','length','options','catch','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','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','count','offset','limit','set','Content-Range','json','reject','save','update','then'];(function(_0x276d5c,_0x1c171e){var _0x1d5997=function(_0x33e6c3){while(--_0x33e6c3){_0x276d5c['push'](_0x276d5c['shift']());}};_0x1d5997(++_0x1c171e);}(_0x6b10,0x1ee));var _0x06b1=function(_0x1384c0,_0x3f628e){_0x1384c0=_0x1384c0-0x0;var _0x4c85f3=_0x6b10[_0x1384c0];return _0x4c85f3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x06b1('0x0'));var zipdir=require(_0x06b1('0x1'));var jsonpatch=require(_0x06b1('0x2'));var rp=require(_0x06b1('0x3'));var moment=require(_0x06b1('0x4'));var BPromise=require(_0x06b1('0x5'));var Mustache=require(_0x06b1('0x6'));var util=require(_0x06b1('0x7'));var path=require(_0x06b1('0x8'));var sox=require(_0x06b1('0x9'));var csv=require(_0x06b1('0xa'));var ejs=require(_0x06b1('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x06b1('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x06b1('0xd'));var toCsv=require(_0x06b1('0xa'));var querystring=require(_0x06b1('0xe'));var Papa=require('papaparse');var Redis=require(_0x06b1('0xf'));var authService=require(_0x06b1('0x10'));var qs=require(_0x06b1('0x11'));var as=require(_0x06b1('0x12'));var hardwareService=require(_0x06b1('0x13'));var logger=require(_0x06b1('0x14'))(_0x06b1('0x15'));var utils=require(_0x06b1('0x16'));var config=require(_0x06b1('0x17'));var db=require(_0x06b1('0x18'))['db'];function respondWithStatusCode(_0x2bb07f,_0x24ce06){_0x24ce06=_0x24ce06||0xcc;return function(_0x5a730c){if(_0x5a730c){return _0x2bb07f[_0x06b1('0x19')](_0x24ce06);}return _0x2bb07f[_0x06b1('0x1a')](_0x24ce06)[_0x06b1('0x1b')]();};}function respondWithResult(_0x465b51,_0x217de2){_0x217de2=_0x217de2||0xc8;return function(_0x190f9b){if(_0x190f9b){return _0x465b51[_0x06b1('0x1a')](_0x217de2)['json'](_0x190f9b);}};}function respondWithFilteredResult(_0x1e5b9a,_0x693536){return function(_0x257a69){if(_0x257a69){var _0x17b4cc=_0x257a69[_0x06b1('0x1c')],_0x303554=_0x693536[_0x06b1('0x1d')],_0x1f1c87=_0x693536[_0x06b1('0x1d')]+_0x693536[_0x06b1('0x1e')],_0xa66c01;if(_0x1f1c87>=_0x17b4cc){_0x1f1c87=_0x17b4cc;_0xa66c01=0xc8;}else{_0xa66c01=0xce;}_0x1e5b9a[_0x06b1('0x1a')](_0xa66c01);return _0x1e5b9a[_0x06b1('0x1f')](_0x06b1('0x20'),_0x303554+'-'+_0x1f1c87+'/'+_0x17b4cc)[_0x06b1('0x21')](_0x257a69);}return null;};}function patchUpdates(_0x531260){return function(_0x316f7b){try{jsonpatch['apply'](_0x316f7b,_0x531260,!![]);}catch(_0x2eb421){return BPromise[_0x06b1('0x22')](_0x2eb421);}return _0x316f7b[_0x06b1('0x23')]();};}function saveUpdates(_0x578c36,_0xbdfc03){return function(_0x214dde){if(_0x214dde){return _0x214dde[_0x06b1('0x24')](_0x578c36)[_0x06b1('0x25')](function(_0x3bd849){return _0x3bd849;});}return null;};}function removeEntity(_0x509d7a,_0x3987e6){return function(_0x5b4ad5){if(_0x5b4ad5){return _0x5b4ad5['destroy']()[_0x06b1('0x25')](function(){_0x509d7a['status'](0xcc)[_0x06b1('0x1b')]();});}};}function handleEntityNotFound(_0x155d2a,_0x36c72c){return function(_0x4e3b62){if(!_0x4e3b62){_0x155d2a[_0x06b1('0x19')](0x194);}return _0x4e3b62;};}function handleError(_0xb5e249,_0x320cb5){_0x320cb5=_0x320cb5||0x1f4;return function(_0x1553b0){logger[_0x06b1('0x26')](_0x1553b0['stack']);if(_0x1553b0[_0x06b1('0x27')]){delete _0x1553b0[_0x06b1('0x27')];}_0xb5e249[_0x06b1('0x1a')](_0x320cb5)[_0x06b1('0x28')](_0x1553b0);};}exports['index']=function(_0x4d839c,_0x130e1f){var _0x5d9ee6={},_0x572556={},_0x36a2f7={'count':0x0,'rows':[]};var _0x57dcc5=_[_0x06b1('0x29')](db[_0x06b1('0x2a')]['rawAttributes'],function(_0x125e82){return{'name':_0x125e82[_0x06b1('0x2b')],'type':_0x125e82[_0x06b1('0x2c')][_0x06b1('0x2d')]};});_0x572556[_0x06b1('0x2e')]=_['map'](_0x57dcc5,_0x06b1('0x27'));_0x572556[_0x06b1('0x2f')]=_[_0x06b1('0x30')](_0x4d839c[_0x06b1('0x2f')]);_0x572556[_0x06b1('0x31')]=_[_0x06b1('0x32')](_0x572556[_0x06b1('0x2e')],_0x572556[_0x06b1('0x2f')]);_0x5d9ee6['attributes']=_[_0x06b1('0x32')](_0x572556['model'],qs[_0x06b1('0x33')](_0x4d839c[_0x06b1('0x2f')][_0x06b1('0x33')]));_0x5d9ee6[_0x06b1('0x34')]=_0x5d9ee6[_0x06b1('0x34')]['length']?_0x5d9ee6[_0x06b1('0x34')]:_0x572556[_0x06b1('0x2e')];if(!_0x4d839c['query']['hasOwnProperty'](_0x06b1('0x35'))){_0x5d9ee6[_0x06b1('0x1e')]=qs[_0x06b1('0x1e')](_0x4d839c['query'][_0x06b1('0x1e')]);_0x5d9ee6[_0x06b1('0x1d')]=qs[_0x06b1('0x1d')](_0x4d839c[_0x06b1('0x2f')][_0x06b1('0x1d')]);}_0x5d9ee6[_0x06b1('0x36')]=qs[_0x06b1('0x37')](_0x4d839c[_0x06b1('0x2f')][_0x06b1('0x37')]);_0x5d9ee6[_0x06b1('0x38')]=qs[_0x06b1('0x31')](_[_0x06b1('0x39')](_0x4d839c[_0x06b1('0x2f')],_0x572556['filters']),_0x57dcc5);if(_0x4d839c[_0x06b1('0x2f')][_0x06b1('0x3a')]){_0x5d9ee6[_0x06b1('0x38')]=_['merge'](_0x5d9ee6['where'],{'$or':_[_0x06b1('0x29')](_0x57dcc5,function(_0x42f2af){if(_0x42f2af['type']!==_0x06b1('0x3b')){var _0x5f1827={};_0x5f1827[_0x42f2af[_0x06b1('0x27')]]={'$like':'%'+_0x4d839c[_0x06b1('0x2f')]['filter']+'%'};return _0x5f1827;}})});}_0x5d9ee6=_[_0x06b1('0x3c')]({},_0x5d9ee6,_0x4d839c['options']);var _0x3eaa5f={'where':_0x5d9ee6['where']};return db[_0x06b1('0x2a')][_0x06b1('0x1c')](_0x3eaa5f)[_0x06b1('0x25')](function(_0x5cbbdc){_0x36a2f7[_0x06b1('0x1c')]=_0x5cbbdc;if(_0x4d839c[_0x06b1('0x2f')][_0x06b1('0x3d')]){_0x5d9ee6[_0x06b1('0x3e')]=[{'all':!![]}];}return db[_0x06b1('0x2a')][_0x06b1('0x3f')](_0x5d9ee6);})['then'](function(_0x3aed9f){_0x36a2f7[_0x06b1('0x40')]=_0x3aed9f;return _0x36a2f7;})[_0x06b1('0x25')](respondWithFilteredResult(_0x130e1f,_0x5d9ee6))['catch'](handleError(_0x130e1f,null));};exports[_0x06b1('0x41')]=function(_0x5e5293,_0x27175e){var _0x3daa9d={'raw':!![],'where':{'id':_0x5e5293[_0x06b1('0x42')]['id']}},_0x22204f={};_0x22204f[_0x06b1('0x2e')]=_[_0x06b1('0x30')](db[_0x06b1('0x2a')][_0x06b1('0x43')]);_0x22204f[_0x06b1('0x2f')]=_[_0x06b1('0x30')](_0x5e5293[_0x06b1('0x2f')]);_0x22204f[_0x06b1('0x31')]=_[_0x06b1('0x32')](_0x22204f[_0x06b1('0x2e')],_0x22204f[_0x06b1('0x2f')]);_0x3daa9d['attributes']=_['intersection'](_0x22204f[_0x06b1('0x2e')],qs[_0x06b1('0x33')](_0x5e5293[_0x06b1('0x2f')][_0x06b1('0x33')]));_0x3daa9d[_0x06b1('0x34')]=_0x3daa9d['attributes'][_0x06b1('0x44')]?_0x3daa9d[_0x06b1('0x34')]:_0x22204f[_0x06b1('0x2e')];if(_0x5e5293['query'][_0x06b1('0x3d')]){_0x3daa9d[_0x06b1('0x3e')]=[{'all':!![]}];}_0x3daa9d=_[_0x06b1('0x3c')]({},_0x3daa9d,_0x5e5293[_0x06b1('0x45')]);return db[_0x06b1('0x2a')]['find'](_0x3daa9d)[_0x06b1('0x25')](handleEntityNotFound(_0x27175e,null))[_0x06b1('0x25')](respondWithResult(_0x27175e,null))[_0x06b1('0x46')](handleError(_0x27175e,null));};exports[_0x06b1('0x47')]=function(_0x124544,_0x6fb3b0){return db['SquareDetailsReport'][_0x06b1('0x47')](_0x124544['body'],{})[_0x06b1('0x25')](respondWithResult(_0x6fb3b0,0xc9))[_0x06b1('0x46')](handleError(_0x6fb3b0,null));};exports[_0x06b1('0x24')]=function(_0x15b633,_0x482810){if(_0x15b633[_0x06b1('0x48')]['id']){delete _0x15b633['body']['id'];}return db['SquareDetailsReport'][_0x06b1('0x49')]({'where':{'id':_0x15b633[_0x06b1('0x42')]['id']}})[_0x06b1('0x25')](handleEntityNotFound(_0x482810,null))['then'](saveUpdates(_0x15b633[_0x06b1('0x48')],null))[_0x06b1('0x25')](respondWithResult(_0x482810,null))['catch'](handleError(_0x482810,null));};exports[_0x06b1('0x4a')]=function(_0x4cbf01,_0x2c714e){return db[_0x06b1('0x2a')]['find']({'where':{'id':_0x4cbf01[_0x06b1('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c714e,null))[_0x06b1('0x25')](removeEntity(_0x2c714e,null))[_0x06b1('0x46')](handleError(_0x2c714e,null));};exports[_0x06b1('0x4b')]=function(_0x7a876,_0x59c3ae){return db['SquareDetailsReport']['describe']()[_0x06b1('0x25')](respondWithResult(_0x59c3ae,null))[_0x06b1('0x46')](handleError(_0x59c3ae,null));}; \ No newline at end of file +var _0x004e=['Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','status','end','json','offset','limit','set'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x004e,0x112));var _0xe004=function(_0x254276,_0x368672){_0x254276=_0x254276-0x0;var _0x1d098d=_0x004e[_0x254276];return _0x1d098d;};'use strict';var pdf=require(_0xe004('0x0'));var emlformat=require(_0xe004('0x1'));var rimraf=require(_0xe004('0x2'));var zipdir=require(_0xe004('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe004('0x4'));var moment=require(_0xe004('0x5'));var BPromise=require(_0xe004('0x6'));var Mustache=require(_0xe004('0x7'));var util=require(_0xe004('0x8'));var path=require(_0xe004('0x9'));var sox=require(_0xe004('0xa'));var csv=require('to-csv');var ejs=require(_0xe004('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe004('0xc'));var crypto=require(_0xe004('0xd'));var jsforce=require(_0xe004('0xe'));var deskjs=require(_0xe004('0xf'));var toCsv=require(_0xe004('0x10'));var querystring=require(_0xe004('0x11'));var Papa=require(_0xe004('0x12'));var Redis=require('ioredis');var authService=require(_0xe004('0x13'));var qs=require(_0xe004('0x14'));var as=require(_0xe004('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe004('0x16'));var config=require(_0xe004('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2061ec,_0x57f1c9){_0x57f1c9=_0x57f1c9||0xcc;return function(_0x4f8624){if(_0x4f8624){return _0x2061ec['sendStatus'](_0x57f1c9);}return _0x2061ec[_0xe004('0x18')](_0x57f1c9)[_0xe004('0x19')]();};}function respondWithResult(_0x1f8b11,_0x2ad92b){_0x2ad92b=_0x2ad92b||0xc8;return function(_0x418a7c){if(_0x418a7c){return _0x1f8b11['status'](_0x2ad92b)[_0xe004('0x1a')](_0x418a7c);}};}function respondWithFilteredResult(_0x5259a6,_0x4c1cad){return function(_0xf0eff9){if(_0xf0eff9){var _0x12a3d6=_0xf0eff9['count'],_0x19a14b=_0x4c1cad[_0xe004('0x1b')],_0x146f31=_0x4c1cad[_0xe004('0x1b')]+_0x4c1cad[_0xe004('0x1c')],_0x423bd7;if(_0x146f31>=_0x12a3d6){_0x146f31=_0x12a3d6;_0x423bd7=0xc8;}else{_0x423bd7=0xce;}_0x5259a6['status'](_0x423bd7);return _0x5259a6[_0xe004('0x1d')](_0xe004('0x1e'),_0x19a14b+'-'+_0x146f31+'/'+_0x12a3d6)[_0xe004('0x1a')](_0xf0eff9);}return null;};}function patchUpdates(_0x22bc8f){return function(_0x265fe7){try{jsonpatch[_0xe004('0x1f')](_0x265fe7,_0x22bc8f,!![]);}catch(_0x52e38b){return BPromise[_0xe004('0x20')](_0x52e38b);}return _0x265fe7['save']();};}function saveUpdates(_0x2b5e97,_0x4b904a){return function(_0x4ee641){if(_0x4ee641){return _0x4ee641[_0xe004('0x21')](_0x2b5e97)[_0xe004('0x22')](function(_0x39d905){return _0x39d905;});}return null;};}function removeEntity(_0x31dc81,_0x149e25){return function(_0x42e81a){if(_0x42e81a){return _0x42e81a[_0xe004('0x23')]()[_0xe004('0x22')](function(){_0x31dc81[_0xe004('0x18')](0xcc)[_0xe004('0x19')]();});}};}function handleEntityNotFound(_0x1f88f8,_0xd11c92){return function(_0x53d0c2){if(!_0x53d0c2){_0x1f88f8[_0xe004('0x24')](0x194);}return _0x53d0c2;};}function handleError(_0x3d9b21,_0x95e580){_0x95e580=_0x95e580||0x1f4;return function(_0x4296d7){logger[_0xe004('0x25')](_0x4296d7['stack']);if(_0x4296d7[_0xe004('0x26')]){delete _0x4296d7['name'];}_0x3d9b21[_0xe004('0x18')](_0x95e580)[_0xe004('0x27')](_0x4296d7);};}exports[_0xe004('0x28')]=function(_0x531e23,_0x391862){var _0x1c4836={},_0x5d8f37={},_0xd6b891={'count':0x0,'rows':[]};var _0x4b115b=_[_0xe004('0x29')](db[_0xe004('0x2a')][_0xe004('0x2b')],function(_0xc72f98){return{'name':_0xc72f98[_0xe004('0x2c')],'type':_0xc72f98[_0xe004('0x2d')][_0xe004('0x2e')]};});_0x5d8f37[_0xe004('0x2f')]=_[_0xe004('0x29')](_0x4b115b,_0xe004('0x26'));_0x5d8f37[_0xe004('0x30')]=_[_0xe004('0x31')](_0x531e23[_0xe004('0x30')]);_0x5d8f37[_0xe004('0x32')]=_[_0xe004('0x33')](_0x5d8f37['model'],_0x5d8f37[_0xe004('0x30')]);_0x1c4836[_0xe004('0x34')]=_[_0xe004('0x33')](_0x5d8f37[_0xe004('0x2f')],qs[_0xe004('0x35')](_0x531e23[_0xe004('0x30')]['fields']));_0x1c4836[_0xe004('0x34')]=_0x1c4836[_0xe004('0x34')][_0xe004('0x36')]?_0x1c4836[_0xe004('0x34')]:_0x5d8f37[_0xe004('0x2f')];if(!_0x531e23[_0xe004('0x30')]['hasOwnProperty'](_0xe004('0x37'))){_0x1c4836['limit']=qs[_0xe004('0x1c')](_0x531e23[_0xe004('0x30')][_0xe004('0x1c')]);_0x1c4836[_0xe004('0x1b')]=qs[_0xe004('0x1b')](_0x531e23[_0xe004('0x30')][_0xe004('0x1b')]);}_0x1c4836[_0xe004('0x38')]=qs[_0xe004('0x39')](_0x531e23['query'][_0xe004('0x39')]);_0x1c4836[_0xe004('0x3a')]=qs[_0xe004('0x32')](_[_0xe004('0x3b')](_0x531e23[_0xe004('0x30')],_0x5d8f37[_0xe004('0x32')]),_0x4b115b);if(_0x531e23['query'][_0xe004('0x3c')]){_0x1c4836[_0xe004('0x3a')]=_[_0xe004('0x3d')](_0x1c4836[_0xe004('0x3a')],{'$or':_[_0xe004('0x29')](_0x4b115b,function(_0x411959){if(_0x411959[_0xe004('0x2d')]!==_0xe004('0x3e')){var _0x416bec={};_0x416bec[_0x411959['name']]={'$like':'%'+_0x531e23[_0xe004('0x30')][_0xe004('0x3c')]+'%'};return _0x416bec;}})});}_0x1c4836=_[_0xe004('0x3d')]({},_0x1c4836,_0x531e23[_0xe004('0x3f')]);var _0x1de834={'where':_0x1c4836['where']};return db[_0xe004('0x2a')][_0xe004('0x40')](_0x1de834)[_0xe004('0x22')](function(_0x4bdade){_0xd6b891['count']=_0x4bdade;if(_0x531e23[_0xe004('0x30')][_0xe004('0x41')]){_0x1c4836[_0xe004('0x42')]=[{'all':!![]}];}return db[_0xe004('0x2a')][_0xe004('0x43')](_0x1c4836);})['then'](function(_0x22ee9d){_0xd6b891[_0xe004('0x44')]=_0x22ee9d;return _0xd6b891;})[_0xe004('0x22')](respondWithFilteredResult(_0x391862,_0x1c4836))[_0xe004('0x45')](handleError(_0x391862,null));};exports[_0xe004('0x46')]=function(_0x38bfb2,_0x2d6f68){var _0x482835={'raw':!![],'where':{'id':_0x38bfb2[_0xe004('0x47')]['id']}},_0x5ee5cf={};_0x5ee5cf['model']=_[_0xe004('0x31')](db[_0xe004('0x2a')][_0xe004('0x2b')]);_0x5ee5cf[_0xe004('0x30')]=_[_0xe004('0x31')](_0x38bfb2[_0xe004('0x30')]);_0x5ee5cf[_0xe004('0x32')]=_[_0xe004('0x33')](_0x5ee5cf['model'],_0x5ee5cf[_0xe004('0x30')]);_0x482835[_0xe004('0x34')]=_[_0xe004('0x33')](_0x5ee5cf[_0xe004('0x2f')],qs[_0xe004('0x35')](_0x38bfb2[_0xe004('0x30')][_0xe004('0x35')]));_0x482835['attributes']=_0x482835[_0xe004('0x34')][_0xe004('0x36')]?_0x482835['attributes']:_0x5ee5cf[_0xe004('0x2f')];if(_0x38bfb2[_0xe004('0x30')][_0xe004('0x41')]){_0x482835[_0xe004('0x42')]=[{'all':!![]}];}_0x482835=_['merge']({},_0x482835,_0x38bfb2[_0xe004('0x3f')]);return db[_0xe004('0x2a')][_0xe004('0x48')](_0x482835)[_0xe004('0x22')](handleEntityNotFound(_0x2d6f68,null))[_0xe004('0x22')](respondWithResult(_0x2d6f68,null))[_0xe004('0x45')](handleError(_0x2d6f68,null));};exports[_0xe004('0x49')]=function(_0x4fb436,_0x590c50){return db[_0xe004('0x2a')][_0xe004('0x49')](_0x4fb436['body'],{})['then'](respondWithResult(_0x590c50,0xc9))[_0xe004('0x45')](handleError(_0x590c50,null));};exports[_0xe004('0x21')]=function(_0x469dba,_0x4b5c4d){if(_0x469dba[_0xe004('0x4a')]['id']){delete _0x469dba[_0xe004('0x4a')]['id'];}return db[_0xe004('0x2a')]['find']({'where':{'id':_0x469dba[_0xe004('0x47')]['id']}})[_0xe004('0x22')](handleEntityNotFound(_0x4b5c4d,null))[_0xe004('0x22')](saveUpdates(_0x469dba[_0xe004('0x4a')],null))['then'](respondWithResult(_0x4b5c4d,null))[_0xe004('0x45')](handleError(_0x4b5c4d,null));};exports[_0xe004('0x23')]=function(_0x3b01a6,_0x12f1c5){return db[_0xe004('0x2a')][_0xe004('0x48')]({'where':{'id':_0x3b01a6[_0xe004('0x47')]['id']}})['then'](handleEntityNotFound(_0x12f1c5,null))[_0xe004('0x22')](removeEntity(_0x12f1c5,null))[_0xe004('0x45')](handleError(_0x12f1c5,null));};exports[_0xe004('0x4b')]=function(_0x4f3448,_0x355683){return db[_0xe004('0x2a')]['describe']()[_0xe004('0x22')](respondWithResult(_0x355683,null))[_0xe004('0x45')](handleError(_0x355683,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 31c224e..8c05801 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 _0xa734=['SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','define'];(function(_0x4c0c84,_0x320c5d){var _0x4e61dd=function(_0x27077e){while(--_0x27077e){_0x4c0c84['push'](_0x4c0c84['shift']());}};_0x4e61dd(++_0x320c5d);}(_0xa734,0x13a));var _0x4a73=function(_0x1eebc5,_0x3f23c4){_0x1eebc5=_0x1eebc5-0x0;var _0x5815ee=_0xa734[_0x1eebc5];return _0x5815ee;};'use strict';var _=require(_0x4a73('0x0'));var util=require('util');var logger=require(_0x4a73('0x1'))(_0x4a73('0x2'));var moment=require(_0x4a73('0x3'));var BPromise=require(_0x4a73('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a73('0x5'));var rimraf=require(_0x4a73('0x6'));var config=require(_0x4a73('0x7'));var attributes=require(_0x4a73('0x8'));module['exports']=function(_0x4ed2e0,_0xd40a73){return _0x4ed2e0[_0x4a73('0x9')](_0x4a73('0xa'),attributes,{'tableName':_0x4a73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa27d=['../../config/environment','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x1e8476,_0x1935ab){var _0x4ea133=function(_0x3f4a84){while(--_0x3f4a84){_0x1e8476['push'](_0x1e8476['shift']());}};_0x4ea133(++_0x1935ab);}(_0xa27d,0x89));var _0xda27=function(_0x29c2a4,_0x3a839c){_0x29c2a4=_0x29c2a4-0x0;var _0x2d69fa=_0xa27d[_0x29c2a4];return _0x2d69fa;};'use strict';var _=require(_0xda27('0x0'));var util=require(_0xda27('0x1'));var logger=require(_0xda27('0x2'))('api');var moment=require('moment');var BPromise=require(_0xda27('0x3'));var rp=require(_0xda27('0x4'));var fs=require('fs');var path=require(_0xda27('0x5'));var rimraf=require('rimraf');var config=require(_0xda27('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0xda27('0x7')]=function(_0x2d746a,_0x5220ce){return _0x2d746a[_0xda27('0x8')](_0xda27('0x9'),attributes,{'tableName':_0xda27('0xa'),'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 70b78d1..64d0041 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 _0xb5aa=['message','result','CreateSquareDetailsReport','body','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0xb5aa,0x119));var _0xab5a=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xb5aa[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xab5a('0x0'));var util=require(_0xab5a('0x1'));var moment=require(_0xab5a('0x2'));var BPromise=require('bluebird');var rs=require(_0xab5a('0x3'));var fs=require('fs');var Redis=require(_0xab5a('0x4'));var db=require(_0xab5a('0x5'))['db'];var utils=require(_0xab5a('0x6'));var logger=require(_0xab5a('0x7'))(_0xab5a('0x8'));var config=require(_0xab5a('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x207ea6,_0x4d7056,_0x15b761){return new BPromise(function(_0x4c251d,_0x4a4a36){return client['request'](_0x207ea6,_0x15b761)[_0xab5a('0xa')](function(_0x38ea97){logger[_0xab5a('0xb')](_0xab5a('0xc'),_0x4d7056,'request\x20sent');logger[_0xab5a('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x4d7056,_0xab5a('0xe'),JSON[_0xab5a('0xf')](_0x38ea97));if(_0x38ea97[_0xab5a('0x10')]){if(_0x38ea97[_0xab5a('0x10')][_0xab5a('0x11')]===0x1f4){logger[_0xab5a('0x10')](_0xab5a('0xc'),_0x4d7056,_0x38ea97['error']['message']);return _0x4a4a36(_0x38ea97[_0xab5a('0x10')]['message']);}logger[_0xab5a('0x10')](_0xab5a('0xc'),_0x4d7056,_0x38ea97[_0xab5a('0x10')]['message']);return _0x4c251d(_0x38ea97[_0xab5a('0x10')][_0xab5a('0x12')]);}else{logger[_0xab5a('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x4d7056,_0xab5a('0xe'));_0x4c251d(_0x38ea97[_0xab5a('0x13')][_0xab5a('0x12')]);}})['catch'](function(_0x513a24){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4d7056,_0x513a24);_0x4a4a36(_0x513a24);});});}exports[_0xab5a('0x14')]=function(_0x8c1574){var _0x43b5c0=this;return new Promise(function(_0x32f79f,_0x23eef2){return db['SquareDetailsReport']['create'](_0x8c1574[_0xab5a('0x15')],{'raw':_0x8c1574[_0xab5a('0x16')]?_0x8c1574['options']['raw']===undefined?!![]:![]:!![]})[_0xab5a('0xa')](function(_0xd413cd){logger[_0xab5a('0xb')](_0xab5a('0x14'),_0x8c1574);logger[_0xab5a('0xd')](_0xab5a('0x14'),_0x8c1574,JSON['stringify'](_0xd413cd));_0x32f79f(_0xd413cd);})['catch'](function(_0x2e1697){logger['error']('CreateSquareDetailsReport',_0x2e1697[_0xab5a('0x12')],_0x8c1574);_0x23eef2(_0x43b5c0[_0xab5a('0x10')](0x1f4,_0x2e1697[_0xab5a('0x12')]));});});}; \ No newline at end of file +var _0x9785=['body','options','raw','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport'];(function(_0x436749,_0x1dd59){var _0x35c8bb=function(_0x47ed47){while(--_0x47ed47){_0x436749['push'](_0x436749['shift']());}};_0x35c8bb(++_0x1dd59);}(_0x9785,0x17e));var _0x5978=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x9785[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x5978('0x0'));var util=require('util');var moment=require(_0x5978('0x1'));var BPromise=require(_0x5978('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5978('0x3'));var db=require(_0x5978('0x4'))['db'];var utils=require(_0x5978('0x5'));var logger=require('../../config/logger')(_0x5978('0x6'));var config=require(_0x5978('0x7'));var jayson=require(_0x5978('0x8'));var client=jayson[_0x5978('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45efef,_0x2bc055,_0xddb846){return new BPromise(function(_0x174535,_0xd6a1ee){return client[_0x5978('0xa')](_0x45efef,_0xddb846)[_0x5978('0xb')](function(_0x446a0a){logger[_0x5978('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2bc055,_0x5978('0xd'));logger['debug'](_0x5978('0xe'),_0x2bc055,_0x5978('0xd'),JSON[_0x5978('0xf')](_0x446a0a));if(_0x446a0a[_0x5978('0x10')]){if(_0x446a0a[_0x5978('0x10')]['code']===0x1f4){logger[_0x5978('0x10')](_0x5978('0x11'),_0x2bc055,_0x446a0a[_0x5978('0x10')]['message']);return _0xd6a1ee(_0x446a0a[_0x5978('0x10')][_0x5978('0x12')]);}logger[_0x5978('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2bc055,_0x446a0a[_0x5978('0x10')][_0x5978('0x12')]);return _0x174535(_0x446a0a[_0x5978('0x10')][_0x5978('0x12')]);}else{logger[_0x5978('0xc')](_0x5978('0x11'),_0x2bc055,_0x5978('0xd'));_0x174535(_0x446a0a[_0x5978('0x13')][_0x5978('0x12')]);}})[_0x5978('0x14')](function(_0x3debea){logger[_0x5978('0x10')](_0x5978('0x11'),_0x2bc055,_0x3debea);_0xd6a1ee(_0x3debea);});});}exports[_0x5978('0x15')]=function(_0x3034b9){var _0x337a06=this;return new Promise(function(_0x1b38a3,_0x4e1a54){return db[_0x5978('0x16')]['create'](_0x3034b9[_0x5978('0x17')],{'raw':_0x3034b9[_0x5978('0x18')]?_0x3034b9[_0x5978('0x18')][_0x5978('0x19')]===undefined?!![]:![]:!![]})[_0x5978('0xb')](function(_0x56e2fd){logger[_0x5978('0xc')](_0x5978('0x15'),_0x3034b9);logger[_0x5978('0x1a')]('CreateSquareDetailsReport',_0x3034b9,JSON[_0x5978('0xf')](_0x56e2fd));_0x1b38a3(_0x56e2fd);})[_0x5978('0x14')](function(_0x674750){logger['error'](_0x5978('0x15'),_0x674750[_0x5978('0x12')],_0x3034b9);_0x4e1a54(_0x337a06[_0x5978('0x10')](0x1f4,_0x674750[_0x5978('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index c1f2f8c..ac9041b 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 _0xb28d=['exports','express','Router','../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess'];(function(_0x33e114,_0x77cc5a){var _0x17e9b6=function(_0xd1cb2f){while(--_0xd1cb2f){_0x33e114['push'](_0x33e114['shift']());}};_0x17e9b6(++_0x77cc5a);}(_0xb28d,0xbf));var _0xdb28=function(_0x129046,_0x519448){_0x129046=_0x129046-0x0;var _0x4d06d9=_0xb28d[_0x129046];return _0x4d06d9;};'use strict';var express=require(_0xdb28('0x0'));var router=express[_0xdb28('0x1')]();var auth=require(_0xdb28('0x2'));var controller=require(_0xdb28('0x3'));router[_0xdb28('0x4')]('/',auth['isAuthenticated'](),controller[_0xdb28('0x5')]);router[_0xdb28('0x4')](_0xdb28('0x6'),auth[_0xdb28('0x7')](),controller[_0xdb28('0x8')]);module[_0xdb28('0x9')]=router; \ No newline at end of file +var _0xe808=['killProcess','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill'];(function(_0x4d661a,_0x524d8b){var _0x36a3c3=function(_0x5f4923){while(--_0x5f4923){_0x4d661a['push'](_0x4d661a['shift']());}};_0x36a3c3(++_0x524d8b);}(_0xe808,0x1e1));var _0x8e80=function(_0x1d35a5,_0xb694c0){_0x1d35a5=_0x1d35a5-0x0;var _0x120704=_0xe808[_0x1d35a5];return _0x120704;};'use strict';var express=require(_0x8e80('0x0'));var router=express[_0x8e80('0x1')]();var auth=require(_0x8e80('0x2'));var controller=require(_0x8e80('0x3'));router[_0x8e80('0x4')]('/',auth[_0x8e80('0x5')](),controller['index']);router[_0x8e80('0x4')](_0x8e80('0x6'),auth[_0x8e80('0x5')](),controller[_0x8e80('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 35e8741..35adb41 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 _0xd2f5=['exec','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','then','json','catch','killProcess','components/import/cm','format','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','systeminformation'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xd2f5,0x144));var _0x5d2f=function(_0x2499c1,_0x4407df){_0x2499c1=_0x2499c1-0x0;var _0x38cdc4=_0xd2f5[_0x2499c1];return _0x38cdc4;};'use strict';var info=require(_0x5d2f('0x0'));var exec=require('child_process')[_0x5d2f('0x1')];var logger=require('../../config/logger')(_0x5d2f('0x2'));var util=require('util');var BPromise=require(_0x5d2f('0x3'));var _=require(_0x5d2f('0x4'));function handleError(_0x102911,_0xc7102b,_0x439434){_0xc7102b=_0xc7102b||0x1f4;return function(_0x3cda2a){logger[_0x5d2f('0x5')](_0x5d2f('0x6'),_0x439434,_0xc7102b,util['inspect'](_0x3cda2a,{'showHidden':![],'depth':null}));delete _0x3cda2a[_0x5d2f('0x7')];_0x102911[_0x5d2f('0x8')](_0xc7102b)[_0x5d2f('0x9')](_0x3cda2a);};}exports[_0x5d2f('0xa')]=function(_0x31b789,_0xb7b530){return info['getAllData']()[_0x5d2f('0xb')](function(_0xcd29b4){return _0xb7b530['status'](0xc8)[_0x5d2f('0xc')](_0xcd29b4);})[_0x5d2f('0xd')](function(_0x2a74a2){return _0xb7b530['status'](0x1f4)[_0x5d2f('0xc')](_0x2a74a2);});};exports[_0x5d2f('0xe')]=function(_0x439475,_0x5d07f4){var _0x510eb5=[_0x5d2f('0xf')];return new BPromise(function(_0x4bc97f,_0x293e95){return exec(util[_0x5d2f('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x439475[_0x5d2f('0x11')]['pid']),function(_0x6ce2d1,_0x158375,_0x309985){if(_0x6ce2d1){return _0x293e95(_0x6ce2d1);}return _0x4bc97f(_0x158375);});})['then'](function(_0x6d7c6c){var _0x39a7d5=![];var _0x1ca388=_0x6d7c6c[_0x5d2f('0x12')](/\n/);for(var _0x1536ee=0x0,_0x5796f6=_0x510eb5[_0x5d2f('0x13')];_0x1536ee<_0x5796f6,_0x39a7d5===![];_0x1536ee+=0x1){if(_0x6d7c6c[_0x5d2f('0x14')](_0x510eb5[_0x1536ee])>=0x0){_0x39a7d5=!![];}}if(!_0x39a7d5){throw new Error(util[_0x5d2f('0x10')](_0x5d2f('0x15'),_0x439475['params'][_0x5d2f('0x16')]));}process[_0x5d2f('0x17')](_0x439475[_0x5d2f('0x11')][_0x5d2f('0x16')],_0x5d2f('0x18'));return _0x5d07f4[_0x5d2f('0x8')](0xc8)[_0x5d2f('0xc')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x439475['params'][_0x5d2f('0x16')])});})[_0x5d2f('0xd')](handleError(_0x5d07f4,null,_0x5d2f('0xe')));}; \ No newline at end of file +var _0xba0d=['indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','bluebird','inspect','name','status','send','then','catch','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xba0d,0x8e));var _0xdba0=function(_0x349d3f,_0xb3132c){_0x349d3f=_0x349d3f-0x0;var _0x328153=_0xba0d[_0x349d3f];return _0x328153;};'use strict';var info=require(_0xdba0('0x0'));var exec=require('child_process')[_0xdba0('0x1')];var logger=require(_0xdba0('0x2'))(_0xdba0('0x3'));var util=require('util');var BPromise=require(_0xdba0('0x4'));var _=require('lodash');function handleError(_0xebb600,_0x426cac,_0x6a96ad){_0x426cac=_0x426cac||0x1f4;return function(_0x8b0331){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x6a96ad,_0x426cac,util[_0xdba0('0x5')](_0x8b0331,{'showHidden':![],'depth':null}));delete _0x8b0331[_0xdba0('0x6')];_0xebb600[_0xdba0('0x7')](_0x426cac)[_0xdba0('0x8')](_0x8b0331);};}exports['index']=function(_0x3db492,_0x5d2ac2){return info['getAllData']()[_0xdba0('0x9')](function(_0x4d01a9){return _0x5d2ac2[_0xdba0('0x7')](0xc8)['json'](_0x4d01a9);})[_0xdba0('0xa')](function(_0x357072){return _0x5d2ac2[_0xdba0('0x7')](0x1f4)[_0xdba0('0xb')](_0x357072);});};exports[_0xdba0('0xc')]=function(_0x5da0ca,_0x24bf36){var _0x43ae3a=['components/import/cm'];return new BPromise(function(_0x49e581,_0x158cdf){return exec(util[_0xdba0('0xd')](_0xdba0('0xe'),_0x5da0ca[_0xdba0('0xf')][_0xdba0('0x10')]),function(_0x28da4c,_0x1077c2,_0x563983){if(_0x28da4c){return _0x158cdf(_0x28da4c);}return _0x49e581(_0x1077c2);});})[_0xdba0('0x9')](function(_0x722955){var _0x3e47da=![];var _0xb0ffc4=_0x722955[_0xdba0('0x11')](/\n/);for(var _0x1aee2d=0x0,_0x316a23=_0x43ae3a[_0xdba0('0x12')];_0x1aee2d<_0x316a23,_0x3e47da===![];_0x1aee2d+=0x1){if(_0x722955[_0xdba0('0x13')](_0x43ae3a[_0x1aee2d])>=0x0){_0x3e47da=!![];}}if(!_0x3e47da){throw new Error(util[_0xdba0('0xd')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5da0ca[_0xdba0('0xf')]['pid']));}process[_0xdba0('0x14')](_0x5da0ca[_0xdba0('0xf')][_0xdba0('0x10')],_0xdba0('0x15'));return _0x24bf36['status'](0xc8)['json']({'message':util[_0xdba0('0xd')](_0xdba0('0x16'),_0x5da0ca['params'][_0xdba0('0x10')])});})[_0xdba0('0xa')](handleError(_0x24bf36,null,_0xdba0('0xc')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index e6124d6..1738370 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 _0x0a9a=['get','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./tag.controller','isAuthenticated','index'];(function(_0x4ae9a6,_0x30b6fb){var _0x347a21=function(_0x4566ce){while(--_0x4566ce){_0x4ae9a6['push'](_0x4ae9a6['shift']());}};_0x347a21(++_0x30b6fb);}(_0x0a9a,0x183));var _0xa0a9=function(_0x5c8ae8,_0x5e5591){_0x5c8ae8=_0x5c8ae8-0x0;var _0x41cd26=_0x0a9a[_0x5c8ae8];return _0x41cd26;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var auth=require(_0xa0a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0a9('0x5'));var controller=require(_0xa0a9('0x6'));router['get']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0x8')]);router[_0xa0a9('0x9')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0xc')]);router[_0xa0a9('0xd')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);router[_0xa0a9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa0a9('0x10')]);module[_0xa0a9('0x11')]=router; \ No newline at end of file +var _0xdace=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','exports','multer'];(function(_0x35f53a,_0x2b8b76){var _0x50ea70=function(_0x5b7d99){while(--_0x5b7d99){_0x35f53a['push'](_0x35f53a['shift']());}};_0x50ea70(++_0x2b8b76);}(_0xdace,0xc5));var _0xedac=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xdace[_0x1ed116];return _0x574066;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var auth=require(_0xedac('0x4'));var interaction=require(_0xedac('0x5'));var config=require(_0xedac('0x6'));var controller=require(_0xedac('0x7'));router['get']('/',auth[_0xedac('0x8')](),controller[_0xedac('0x9')]);router[_0xedac('0xa')]('/:id',auth[_0xedac('0x8')](),controller[_0xedac('0xb')]);router[_0xedac('0xc')]('/',auth['isAuthenticated'](),controller[_0xedac('0xd')]);router[_0xedac('0xe')](_0xedac('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xedac('0x10')](_0xedac('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xedac('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 66405ce..ca43875 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 _0xd8b0=['STRING','sequelize','exports','#0091EA'];(function(_0xa04daf,_0x25e602){var _0x3f7fa6=function(_0x41b149){while(--_0x41b149){_0xa04daf['push'](_0xa04daf['shift']());}};_0x3f7fa6(++_0x25e602);}(_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')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x2')},'description':{'type':Sequelize[_0x0d8b('0x3')]}}; \ No newline at end of file +var _0x087b=['sequelize','exports','STRING'];(function(_0x2d9ce8,_0xe8e638){var _0x243f38=function(_0x17d62e){while(--_0x17d62e){_0x2d9ce8['push'](_0x2d9ce8['shift']());}};_0x243f38(++_0xe8e638);}(_0x087b,0x11a));var _0xb087=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x087b[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb087('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xb087('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index fa31766..e280101 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 _0x2bc3=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','findAll','rows','catch','show','params','include','options','find','create','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','Tags','UserProfileResource','stack','name','send','Tag','type','model','query','filters','intersection','attributes','fields'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x2bc3,0xb4));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x32bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32bc('0x1'));var jsonpatch=require(_0x32bc('0x2'));var rp=require(_0x32bc('0x3'));var moment=require('moment');var BPromise=require(_0x32bc('0x4'));var Mustache=require(_0x32bc('0x5'));var util=require(_0x32bc('0x6'));var path=require(_0x32bc('0x7'));var sox=require(_0x32bc('0x8'));var csv=require('to-csv');var ejs=require(_0x32bc('0x9'));var fs=require('fs');var _=require(_0x32bc('0xa'));var squel=require(_0x32bc('0xb'));var crypto=require(_0x32bc('0xc'));var jsforce=require(_0x32bc('0xd'));var deskjs=require(_0x32bc('0xe'));var toCsv=require(_0x32bc('0xf'));var querystring=require('querystring');var Papa=require(_0x32bc('0x10'));var Redis=require(_0x32bc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x32bc('0x12'));var as=require(_0x32bc('0x13'));var hardwareService=require(_0x32bc('0x14'));var logger=require(_0x32bc('0x15'))('api');var utils=require(_0x32bc('0x16'));var config=require(_0x32bc('0x17'));var db=require(_0x32bc('0x18'))['db'];function respondWithStatusCode(_0x57a28b,_0x3037ea){_0x3037ea=_0x3037ea||0xcc;return function(_0x51e367){if(_0x51e367){return _0x57a28b[_0x32bc('0x19')](_0x3037ea);}return _0x57a28b[_0x32bc('0x1a')](_0x3037ea)[_0x32bc('0x1b')]();};}function respondWithResult(_0xcbc8df,_0x2a3fdc){_0x2a3fdc=_0x2a3fdc||0xc8;return function(_0x4d9f2b){if(_0x4d9f2b){return _0xcbc8df[_0x32bc('0x1a')](_0x2a3fdc)[_0x32bc('0x1c')](_0x4d9f2b);}};}function respondWithFilteredResult(_0x5dc9e1,_0x5d0f13){return function(_0x5c266f){if(_0x5c266f){var _0x558713=_0x5c266f[_0x32bc('0x1d')],_0x4dd117=_0x5d0f13['offset'],_0x57623f=_0x5d0f13[_0x32bc('0x1e')]+_0x5d0f13[_0x32bc('0x1f')],_0x3ad328;if(_0x57623f>=_0x558713){_0x57623f=_0x558713;_0x3ad328=0xc8;}else{_0x3ad328=0xce;}_0x5dc9e1['status'](_0x3ad328);return _0x5dc9e1[_0x32bc('0x20')]('Content-Range',_0x4dd117+'-'+_0x57623f+'/'+_0x558713)[_0x32bc('0x1c')](_0x5c266f);}return null;};}function patchUpdates(_0x4e5080){return function(_0x56ee6f){try{jsonpatch['apply'](_0x56ee6f,_0x4e5080,!![]);}catch(_0x33b708){return BPromise[_0x32bc('0x21')](_0x33b708);}return _0x56ee6f[_0x32bc('0x22')]();};}function saveUpdates(_0x402d7e,_0x5c48eb){return function(_0x48c79c){if(_0x48c79c){return _0x48c79c[_0x32bc('0x23')](_0x402d7e)[_0x32bc('0x24')](function(_0x41a4b4){return _0x41a4b4;});}return null;};}function removeEntity(_0x118283,_0x3b89fa){return function(_0x39c9d5){if(_0x39c9d5){return _0x39c9d5[_0x32bc('0x25')]()[_0x32bc('0x24')](function(){var _0x1d62ef=_0x39c9d5['get']({'plain':!![]});var _0x2e314c=_0x32bc('0x26');return db[_0x32bc('0x27')][_0x32bc('0x25')]({'where':{'type':_0x2e314c,'resourceId':_0x1d62ef['id']}})['then'](function(){return _0x39c9d5;});})['then'](function(){_0x118283[_0x32bc('0x1a')](0xcc)[_0x32bc('0x1b')]();});}};}function handleEntityNotFound(_0x33541e,_0x491259){return function(_0x2829de){if(!_0x2829de){_0x33541e[_0x32bc('0x19')](0x194);}return _0x2829de;};}function handleError(_0x466ffb,_0x567168){_0x567168=_0x567168||0x1f4;return function(_0x88935b){logger['error'](_0x88935b[_0x32bc('0x28')]);if(_0x88935b[_0x32bc('0x29')]){delete _0x88935b[_0x32bc('0x29')];}_0x466ffb['status'](_0x567168)[_0x32bc('0x2a')](_0x88935b);};}exports['index']=function(_0x3e6c55,_0x37c354){var _0x48cb3f={},_0x214dd3={},_0x3bb663={'count':0x0,'rows':[]};var _0x157f3d=_['map'](db[_0x32bc('0x2b')]['rawAttributes'],function(_0x21a071){return{'name':_0x21a071['fieldName'],'type':_0x21a071[_0x32bc('0x2c')]['key']};});_0x214dd3[_0x32bc('0x2d')]=_['map'](_0x157f3d,'name');_0x214dd3['query']=_['keys'](_0x3e6c55[_0x32bc('0x2e')]);_0x214dd3[_0x32bc('0x2f')]=_[_0x32bc('0x30')](_0x214dd3['model'],_0x214dd3[_0x32bc('0x2e')]);_0x48cb3f[_0x32bc('0x31')]=_[_0x32bc('0x30')](_0x214dd3[_0x32bc('0x2d')],qs['fields'](_0x3e6c55[_0x32bc('0x2e')][_0x32bc('0x32')]));_0x48cb3f[_0x32bc('0x31')]=_0x48cb3f[_0x32bc('0x31')][_0x32bc('0x33')]?_0x48cb3f[_0x32bc('0x31')]:_0x214dd3[_0x32bc('0x2d')];if(!_0x3e6c55[_0x32bc('0x2e')][_0x32bc('0x34')](_0x32bc('0x35'))){_0x48cb3f[_0x32bc('0x1f')]=qs[_0x32bc('0x1f')](_0x3e6c55[_0x32bc('0x2e')][_0x32bc('0x1f')]);_0x48cb3f[_0x32bc('0x1e')]=qs[_0x32bc('0x1e')](_0x3e6c55[_0x32bc('0x2e')][_0x32bc('0x1e')]);}_0x48cb3f[_0x32bc('0x36')]=qs[_0x32bc('0x37')](_0x3e6c55['query'][_0x32bc('0x37')]);_0x48cb3f[_0x32bc('0x38')]=qs[_0x32bc('0x2f')](_[_0x32bc('0x39')](_0x3e6c55[_0x32bc('0x2e')],_0x214dd3['filters']),_0x157f3d);if(_0x3e6c55['query'][_0x32bc('0x3a')]){_0x48cb3f[_0x32bc('0x38')]=_[_0x32bc('0x3b')](_0x48cb3f['where'],{'$or':_[_0x32bc('0x3c')](_0x157f3d,function(_0x415c02){if(_0x415c02[_0x32bc('0x2c')]!=='VIRTUAL'){var _0x4553ac={};_0x4553ac[_0x415c02[_0x32bc('0x29')]]={'$like':'%'+_0x3e6c55[_0x32bc('0x2e')][_0x32bc('0x3a')]+'%'};return _0x4553ac;}})});}_0x48cb3f=_['merge']({},_0x48cb3f,_0x3e6c55['options']);var _0x41adc8={'where':_0x48cb3f['where']};return db[_0x32bc('0x2b')]['count'](_0x41adc8)[_0x32bc('0x24')](function(_0x460596){_0x3bb663[_0x32bc('0x1d')]=_0x460596;if(_0x3e6c55[_0x32bc('0x2e')][_0x32bc('0x3d')]){_0x48cb3f['include']=[{'all':!![]}];}return db[_0x32bc('0x2b')][_0x32bc('0x3e')](_0x48cb3f);})[_0x32bc('0x24')](function(_0x47731d){_0x3bb663[_0x32bc('0x3f')]=_0x47731d;return _0x3bb663;})[_0x32bc('0x24')](respondWithFilteredResult(_0x37c354,_0x48cb3f))[_0x32bc('0x40')](handleError(_0x37c354,null));};exports[_0x32bc('0x41')]=function(_0x342362,_0x1df6e9){var _0x4c9396={'raw':!![],'where':{'id':_0x342362[_0x32bc('0x42')]['id']}},_0x1d066f={};_0x1d066f['model']=_['keys'](db[_0x32bc('0x2b')]['rawAttributes']);_0x1d066f[_0x32bc('0x2e')]=_['keys'](_0x342362['query']);_0x1d066f[_0x32bc('0x2f')]=_[_0x32bc('0x30')](_0x1d066f['model'],_0x1d066f['query']);_0x4c9396[_0x32bc('0x31')]=_['intersection'](_0x1d066f[_0x32bc('0x2d')],qs[_0x32bc('0x32')](_0x342362[_0x32bc('0x2e')][_0x32bc('0x32')]));_0x4c9396['attributes']=_0x4c9396[_0x32bc('0x31')]['length']?_0x4c9396[_0x32bc('0x31')]:_0x1d066f[_0x32bc('0x2d')];if(_0x342362[_0x32bc('0x2e')]['includeAll']){_0x4c9396[_0x32bc('0x43')]=[{'all':!![]}];}_0x4c9396=_[_0x32bc('0x3b')]({},_0x4c9396,_0x342362[_0x32bc('0x44')]);return db[_0x32bc('0x2b')][_0x32bc('0x45')](_0x4c9396)[_0x32bc('0x24')](handleEntityNotFound(_0x1df6e9,null))[_0x32bc('0x24')](respondWithResult(_0x1df6e9,null))['catch'](handleError(_0x1df6e9,null));};exports[_0x32bc('0x46')]=function(_0x4abdf7,_0x5854a7){return db['Tag']['create'](_0x4abdf7['body'],{})[_0x32bc('0x24')](function(_0x1fd15d){var _0x5dfd86=_0x4abdf7[_0x32bc('0x47')][_0x32bc('0x48')]({'plain':!![]});if(!_0x5dfd86)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5dfd86['role']===_0x32bc('0x47')){var _0x42b96e=_0x1fd15d['get']({'plain':!![]});var _0x4167c2=_0x32bc('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x4167c2,'userProfileId':_0x5dfd86[_0x32bc('0x49')]},'raw':!![]})['then'](function(_0xe8eaf9){if(_0xe8eaf9&&_0xe8eaf9[_0x32bc('0x4a')]===0x0){return db['UserProfileResource'][_0x32bc('0x46')]({'name':_0x42b96e['name'],'resourceId':_0x42b96e['id'],'type':_0xe8eaf9[_0x32bc('0x29')],'sectionId':_0xe8eaf9['id']},{})[_0x32bc('0x24')](function(){return _0x1fd15d;});}else{return _0x1fd15d;}})[_0x32bc('0x40')](function(_0x189be9){logger['error'](_0x32bc('0x4b'),_0x189be9);throw _0x189be9;});}return _0x1fd15d;})[_0x32bc('0x24')](respondWithResult(_0x5854a7,0xc9))[_0x32bc('0x40')](handleError(_0x5854a7,null));};exports[_0x32bc('0x23')]=function(_0x3c0760,_0x1c8e6f){if(_0x3c0760['body']['id']){delete _0x3c0760[_0x32bc('0x4c')]['id'];}return db[_0x32bc('0x2b')]['find']({'where':{'id':_0x3c0760['params']['id']}})[_0x32bc('0x24')](handleEntityNotFound(_0x1c8e6f,null))[_0x32bc('0x24')](saveUpdates(_0x3c0760[_0x32bc('0x4c')],null))[_0x32bc('0x24')](respondWithResult(_0x1c8e6f,null))['catch'](handleError(_0x1c8e6f,null));};exports[_0x32bc('0x25')]=function(_0x1ea16c,_0x5bcad9){return db['Tag'][_0x32bc('0x45')]({'where':{'id':_0x1ea16c[_0x32bc('0x42')]['id']}})[_0x32bc('0x24')](handleEntityNotFound(_0x5bcad9,null))[_0x32bc('0x24')](removeEntity(_0x5bcad9,null))[_0x32bc('0x40')](handleError(_0x5bcad9,null));}; \ No newline at end of file +var _0xa748=['then','get','destroy','error','send','index','Tag','rawAttributes','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','filter','merge','where','VIRTUAL','name','options','includeAll','rows','catch','show','params','keys','filters','include','find','create','body','user','role','Tags','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa748,0x73));var _0x8a74=function(_0x255fa4,_0xa3b664){_0x255fa4=_0x255fa4-0x0;var _0x12be17=_0xa748[_0x255fa4];return _0x12be17;};'use strict';var pdf=require(_0x8a74('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8a74('0x1'));var jsonpatch=require(_0x8a74('0x2'));var rp=require(_0x8a74('0x3'));var moment=require(_0x8a74('0x4'));var BPromise=require(_0x8a74('0x5'));var Mustache=require(_0x8a74('0x6'));var util=require(_0x8a74('0x7'));var path=require('path');var sox=require(_0x8a74('0x8'));var csv=require('to-csv');var ejs=require(_0x8a74('0x9'));var fs=require('fs');var _=require(_0x8a74('0xa'));var squel=require(_0x8a74('0xb'));var crypto=require('crypto');var jsforce=require(_0x8a74('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8a74('0xd'));var Papa=require(_0x8a74('0xe'));var Redis=require(_0x8a74('0xf'));var authService=require(_0x8a74('0x10'));var qs=require(_0x8a74('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a74('0x12'))('api');var utils=require(_0x8a74('0x13'));var config=require('../../config/environment');var db=require(_0x8a74('0x14'))['db'];function respondWithStatusCode(_0x101043,_0x1a5ea5){_0x1a5ea5=_0x1a5ea5||0xcc;return function(_0x48e261){if(_0x48e261){return _0x101043[_0x8a74('0x15')](_0x1a5ea5);}return _0x101043[_0x8a74('0x16')](_0x1a5ea5)[_0x8a74('0x17')]();};}function respondWithResult(_0xa9ce1,_0x2302c3){_0x2302c3=_0x2302c3||0xc8;return function(_0x561c29){if(_0x561c29){return _0xa9ce1[_0x8a74('0x16')](_0x2302c3)[_0x8a74('0x18')](_0x561c29);}};}function respondWithFilteredResult(_0x456f77,_0x558360){return function(_0x5373e3){if(_0x5373e3){var _0x31df4b=_0x5373e3[_0x8a74('0x19')],_0x5e22f4=_0x558360[_0x8a74('0x1a')],_0x212ad5=_0x558360[_0x8a74('0x1a')]+_0x558360[_0x8a74('0x1b')],_0x3300ee;if(_0x212ad5>=_0x31df4b){_0x212ad5=_0x31df4b;_0x3300ee=0xc8;}else{_0x3300ee=0xce;}_0x456f77[_0x8a74('0x16')](_0x3300ee);return _0x456f77['set']('Content-Range',_0x5e22f4+'-'+_0x212ad5+'/'+_0x31df4b)[_0x8a74('0x18')](_0x5373e3);}return null;};}function patchUpdates(_0x4819d2){return function(_0xfac6d1){try{jsonpatch[_0x8a74('0x1c')](_0xfac6d1,_0x4819d2,!![]);}catch(_0x2adebf){return BPromise[_0x8a74('0x1d')](_0x2adebf);}return _0xfac6d1[_0x8a74('0x1e')]();};}function saveUpdates(_0x444e93,_0x10b8f0){return function(_0x3b966b){if(_0x3b966b){return _0x3b966b['update'](_0x444e93)[_0x8a74('0x1f')](function(_0x31959b){return _0x31959b;});}return null;};}function removeEntity(_0x3a9362,_0x2d0741){return function(_0x3c8a88){if(_0x3c8a88){return _0x3c8a88['destroy']()[_0x8a74('0x1f')](function(){var _0x3ac96a=_0x3c8a88[_0x8a74('0x20')]({'plain':!![]});var _0x1dcabb='Tags';return db['UserProfileResource'][_0x8a74('0x21')]({'where':{'type':_0x1dcabb,'resourceId':_0x3ac96a['id']}})[_0x8a74('0x1f')](function(){return _0x3c8a88;});})[_0x8a74('0x1f')](function(){_0x3a9362['status'](0xcc)[_0x8a74('0x17')]();});}};}function handleEntityNotFound(_0xbf632b,_0x5ece8b){return function(_0x4387dd){if(!_0x4387dd){_0xbf632b[_0x8a74('0x15')](0x194);}return _0x4387dd;};}function handleError(_0x26fbf4,_0x57309e){_0x57309e=_0x57309e||0x1f4;return function(_0x59aec6){logger[_0x8a74('0x22')](_0x59aec6['stack']);if(_0x59aec6['name']){delete _0x59aec6['name'];}_0x26fbf4[_0x8a74('0x16')](_0x57309e)[_0x8a74('0x23')](_0x59aec6);};}exports[_0x8a74('0x24')]=function(_0x22a498,_0x112e99){var _0x7e6840={},_0x3ae984={},_0x45be5a={'count':0x0,'rows':[]};var _0x26e36d=_['map'](db[_0x8a74('0x25')][_0x8a74('0x26')],function(_0x3bf586){return{'name':_0x3bf586['fieldName'],'type':_0x3bf586[_0x8a74('0x27')]['key']};});_0x3ae984[_0x8a74('0x28')]=_[_0x8a74('0x29')](_0x26e36d,'name');_0x3ae984[_0x8a74('0x2a')]=_['keys'](_0x22a498[_0x8a74('0x2a')]);_0x3ae984['filters']=_[_0x8a74('0x2b')](_0x3ae984['model'],_0x3ae984['query']);_0x7e6840[_0x8a74('0x2c')]=_[_0x8a74('0x2b')](_0x3ae984[_0x8a74('0x28')],qs['fields'](_0x22a498['query'][_0x8a74('0x2d')]));_0x7e6840['attributes']=_0x7e6840[_0x8a74('0x2c')][_0x8a74('0x2e')]?_0x7e6840[_0x8a74('0x2c')]:_0x3ae984['model'];if(!_0x22a498['query']['hasOwnProperty'](_0x8a74('0x2f'))){_0x7e6840['limit']=qs[_0x8a74('0x1b')](_0x22a498['query'][_0x8a74('0x1b')]);_0x7e6840[_0x8a74('0x1a')]=qs[_0x8a74('0x1a')](_0x22a498[_0x8a74('0x2a')][_0x8a74('0x1a')]);}_0x7e6840['order']=qs[_0x8a74('0x30')](_0x22a498[_0x8a74('0x2a')][_0x8a74('0x30')]);_0x7e6840['where']=qs['filters'](_['pick'](_0x22a498[_0x8a74('0x2a')],_0x3ae984['filters']),_0x26e36d);if(_0x22a498[_0x8a74('0x2a')][_0x8a74('0x31')]){_0x7e6840['where']=_[_0x8a74('0x32')](_0x7e6840[_0x8a74('0x33')],{'$or':_['map'](_0x26e36d,function(_0x31d525){if(_0x31d525[_0x8a74('0x27')]!==_0x8a74('0x34')){var _0x2bd664={};_0x2bd664[_0x31d525[_0x8a74('0x35')]]={'$like':'%'+_0x22a498[_0x8a74('0x2a')][_0x8a74('0x31')]+'%'};return _0x2bd664;}})});}_0x7e6840=_[_0x8a74('0x32')]({},_0x7e6840,_0x22a498[_0x8a74('0x36')]);var _0x4bdab9={'where':_0x7e6840[_0x8a74('0x33')]};return db['Tag']['count'](_0x4bdab9)[_0x8a74('0x1f')](function(_0x5940dd){_0x45be5a[_0x8a74('0x19')]=_0x5940dd;if(_0x22a498[_0x8a74('0x2a')][_0x8a74('0x37')]){_0x7e6840['include']=[{'all':!![]}];}return db[_0x8a74('0x25')]['findAll'](_0x7e6840);})['then'](function(_0x500c10){_0x45be5a[_0x8a74('0x38')]=_0x500c10;return _0x45be5a;})['then'](respondWithFilteredResult(_0x112e99,_0x7e6840))[_0x8a74('0x39')](handleError(_0x112e99,null));};exports[_0x8a74('0x3a')]=function(_0x5cc4ad,_0x354dd1){var _0x37b0a6={'raw':!![],'where':{'id':_0x5cc4ad[_0x8a74('0x3b')]['id']}},_0x26d5be={};_0x26d5be[_0x8a74('0x28')]=_['keys'](db['Tag'][_0x8a74('0x26')]);_0x26d5be[_0x8a74('0x2a')]=_[_0x8a74('0x3c')](_0x5cc4ad[_0x8a74('0x2a')]);_0x26d5be[_0x8a74('0x3d')]=_[_0x8a74('0x2b')](_0x26d5be[_0x8a74('0x28')],_0x26d5be[_0x8a74('0x2a')]);_0x37b0a6[_0x8a74('0x2c')]=_[_0x8a74('0x2b')](_0x26d5be['model'],qs['fields'](_0x5cc4ad[_0x8a74('0x2a')][_0x8a74('0x2d')]));_0x37b0a6[_0x8a74('0x2c')]=_0x37b0a6[_0x8a74('0x2c')][_0x8a74('0x2e')]?_0x37b0a6[_0x8a74('0x2c')]:_0x26d5be[_0x8a74('0x28')];if(_0x5cc4ad['query'][_0x8a74('0x37')]){_0x37b0a6[_0x8a74('0x3e')]=[{'all':!![]}];}_0x37b0a6=_['merge']({},_0x37b0a6,_0x5cc4ad['options']);return db['Tag'][_0x8a74('0x3f')](_0x37b0a6)['then'](handleEntityNotFound(_0x354dd1,null))[_0x8a74('0x1f')](respondWithResult(_0x354dd1,null))[_0x8a74('0x39')](handleError(_0x354dd1,null));};exports[_0x8a74('0x40')]=function(_0x1111f1,_0x40d264){return db[_0x8a74('0x25')][_0x8a74('0x40')](_0x1111f1[_0x8a74('0x41')],{})[_0x8a74('0x1f')](function(_0x1b5014){var _0x4b12b6=_0x1111f1[_0x8a74('0x42')]['get']({'plain':!![]});if(!_0x4b12b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b12b6[_0x8a74('0x43')]===_0x8a74('0x42')){var _0x2b5c66=_0x1b5014['get']({'plain':!![]});var _0x363b32=_0x8a74('0x44');return db[_0x8a74('0x45')][_0x8a74('0x3f')]({'where':{'name':_0x363b32,'userProfileId':_0x4b12b6[_0x8a74('0x46')]},'raw':!![]})[_0x8a74('0x1f')](function(_0x31cf0c){if(_0x31cf0c&&_0x31cf0c[_0x8a74('0x47')]===0x0){return db['UserProfileResource'][_0x8a74('0x40')]({'name':_0x2b5c66[_0x8a74('0x35')],'resourceId':_0x2b5c66['id'],'type':_0x31cf0c[_0x8a74('0x35')],'sectionId':_0x31cf0c['id']},{})[_0x8a74('0x1f')](function(){return _0x1b5014;});}else{return _0x1b5014;}})['catch'](function(_0x17466f){logger[_0x8a74('0x22')](_0x8a74('0x48'),_0x17466f);throw _0x17466f;});}return _0x1b5014;})[_0x8a74('0x1f')](respondWithResult(_0x40d264,0xc9))['catch'](handleError(_0x40d264,null));};exports['update']=function(_0x4dc15e,_0x2ba8dc){if(_0x4dc15e[_0x8a74('0x41')]['id']){delete _0x4dc15e[_0x8a74('0x41')]['id'];}return db[_0x8a74('0x25')]['find']({'where':{'id':_0x4dc15e[_0x8a74('0x3b')]['id']}})[_0x8a74('0x1f')](handleEntityNotFound(_0x2ba8dc,null))[_0x8a74('0x1f')](saveUpdates(_0x4dc15e['body'],null))[_0x8a74('0x1f')](respondWithResult(_0x2ba8dc,null))[_0x8a74('0x39')](handleError(_0x2ba8dc,null));};exports[_0x8a74('0x21')]=function(_0x24d947,_0x1578c3){return db[_0x8a74('0x25')][_0x8a74('0x3f')]({'where':{'id':_0x24d947[_0x8a74('0x3b')]['id']}})[_0x8a74('0x1f')](handleEntityNotFound(_0x1578c3,null))[_0x8a74('0x1f')](removeEntity(_0x1578c3,null))[_0x8a74('0x39')](handleError(_0x1578c3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index ea1123b..3e4e9d3 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 _0x6300=['bluebird','request-promise','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','api'];(function(_0x2e3987,_0x38fc25){var _0x22f461=function(_0x199992){while(--_0x199992){_0x2e3987['push'](_0x2e3987['shift']());}};_0x22f461(++_0x38fc25);}(_0x6300,0x1ae));var _0x0630=function(_0x3786dc,_0x22814c){_0x3786dc=_0x3786dc-0x0;var _0x50cc06=_0x6300[_0x3786dc];return _0x50cc06;};'use strict';var _=require(_0x0630('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0630('0x1'));var moment=require('moment');var BPromise=require(_0x0630('0x2'));var rp=require(_0x0630('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0630('0x4'));var attributes=require(_0x0630('0x5'));module['exports']=function(_0x4513c9,_0x4ec6a9){return _0x4513c9[_0x0630('0x6')](_0x0630('0x7'),attributes,{'tableName':_0x0630('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9eb=['Tag','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./tag.attributes','define'];(function(_0x54a1a5,_0x330d60){var _0x2d07c2=function(_0x5d931f){while(--_0x5d931f){_0x54a1a5['push'](_0x54a1a5['shift']());}};_0x2d07c2(++_0x330d60);}(_0xc9eb,0x199));var _0xbc9e=function(_0x5e2b26,_0x3a9b9a){_0x5e2b26=_0x5e2b26-0x0;var _0x41f745=_0xc9eb[_0x5e2b26];return _0x41f745;};'use strict';var _=require(_0xbc9e('0x0'));var util=require(_0xbc9e('0x1'));var logger=require(_0xbc9e('0x2'))(_0xbc9e('0x3'));var moment=require(_0xbc9e('0x4'));var BPromise=require(_0xbc9e('0x5'));var rp=require(_0xbc9e('0x6'));var fs=require('fs');var path=require(_0xbc9e('0x7'));var rimraf=require('rimraf');var config=require(_0xbc9e('0x8'));var attributes=require(_0xbc9e('0x9'));module['exports']=function(_0xaee339,_0x5b7c1d){return _0xaee339[_0xbc9e('0xa')](_0xbc9e('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 259525d..93b226b 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 _0x5ff3=['message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','Tag,\x20%s,\x20%s'];(function(_0x2c588b,_0x479b65){var _0x4676ce=function(_0x47da2f){while(--_0x47da2f){_0x2c588b['push'](_0x2c588b['shift']());}};_0x4676ce(++_0x479b65);}(_0x5ff3,0x17d));var _0x35ff=function(_0x419d0b,_0x3d1f29){_0x419d0b=_0x419d0b-0x0;var _0x28c8a0=_0x5ff3[_0x419d0b];return _0x28c8a0;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('Tag,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});} \ No newline at end of file +var _0xc6d8=['debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x7789fb,_0x2efc99){var _0x1753a8=function(_0x3f65eb){while(--_0x3f65eb){_0x7789fb['push'](_0x7789fb['shift']());}};_0x1753a8(++_0x2efc99);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x18a01c,_0xd1a13a){_0x18a01c=_0x18a01c-0x0;var _0x2b0cd6=_0xc6d8[_0x18a01c];return _0x2b0cd6;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbb52,_0x98cae4,_0x5529f1){return new BPromise(function(_0x1496ba,_0x75c49f){return client[_0x8c6d('0x9')](_0x2dbb52,_0x5529f1)['then'](function(_0x3cecc1){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x98cae4,_0x8c6d('0xc'));logger[_0x8c6d('0xd')](_0x8c6d('0xe'),_0x98cae4,_0x8c6d('0xc'),JSON[_0x8c6d('0xf')](_0x3cecc1));if(_0x3cecc1['error']){if(_0x3cecc1[_0x8c6d('0x10')]['code']===0x1f4){logger['error'](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x75c49f(_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);}logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x1496ba(_0x3cecc1[_0x8c6d('0x10')]['message']);}else{logger[_0x8c6d('0xa')]('Tag,\x20%s,\x20%s',_0x98cae4,_0x8c6d('0xc'));_0x1496ba(_0x3cecc1['result'][_0x8c6d('0x11')]);}})[_0x8c6d('0x12')](function(_0x52ed7b){logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x52ed7b);_0x75c49f(_0x52ed7b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index aac36a9..751517b 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 _0x7ac9=['/:id/queues','getAgents','create','post','addQueues','/:id/users','addAgents','put','update','delete','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./team.controller','get','isAuthenticated','show'];(function(_0x1071a4,_0x4f668c){var _0x3da743=function(_0x13b080){while(--_0x13b080){_0x1071a4['push'](_0x1071a4['shift']());}};_0x3da743(++_0x4f668c);}(_0x7ac9,0xfd));var _0x97ac=function(_0x48cbc7,_0x3d15e6){_0x48cbc7=_0x48cbc7-0x0;var _0x52ebe4=_0x7ac9[_0x48cbc7];return _0x52ebe4;};'use strict';var multer=require(_0x97ac('0x0'));var util=require(_0x97ac('0x1'));var path=require(_0x97ac('0x2'));var timeout=require(_0x97ac('0x3'));var express=require('express');var router=express[_0x97ac('0x4')]();var auth=require(_0x97ac('0x5'));var interaction=require(_0x97ac('0x6'));var config=require('../../config/environment');var controller=require(_0x97ac('0x7'));router[_0x97ac('0x8')]('/',auth[_0x97ac('0x9')](),controller['index']);router[_0x97ac('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x97ac('0xa')]);router[_0x97ac('0x8')](_0x97ac('0xb'),auth[_0x97ac('0x9')](),controller['getQueues']);router[_0x97ac('0x8')]('/:id/users',auth[_0x97ac('0x9')](),controller[_0x97ac('0xc')]);router['post']('/',auth[_0x97ac('0x9')](),controller[_0x97ac('0xd')]);router[_0x97ac('0xe')](_0x97ac('0xb'),auth[_0x97ac('0x9')](),controller[_0x97ac('0xf')]);router[_0x97ac('0xe')](_0x97ac('0x10'),auth[_0x97ac('0x9')](),controller[_0x97ac('0x11')]);router[_0x97ac('0x12')]('/:id',auth[_0x97ac('0x9')](),controller[_0x97ac('0x13')]);router[_0x97ac('0x14')]('/:id',auth[_0x97ac('0x9')](),controller['destroy']);router[_0x97ac('0x14')]('/:id/queues',auth[_0x97ac('0x9')](),controller[_0x97ac('0x15')]);router[_0x97ac('0x14')]('/:id/users',auth[_0x97ac('0x9')](),controller[_0x97ac('0x16')]);module[_0x97ac('0x17')]=router; \ No newline at end of file +var _0x939f=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','removeAgents','exports'];(function(_0x3ea291,_0x3ac8c3){var _0x278591=function(_0x28a057){while(--_0x28a057){_0x3ea291['push'](_0x3ea291['shift']());}};_0x278591(++_0x3ac8c3);}(_0x939f,0xd0));var _0xf939=function(_0x4c7892,_0x1c2cb0){_0x4c7892=_0x4c7892-0x0;var _0x2a79c8=_0x939f[_0x4c7892];return _0x2a79c8;};'use strict';var multer=require('multer');var util=require(_0xf939('0x0'));var path=require('path');var timeout=require(_0xf939('0x1'));var express=require(_0xf939('0x2'));var router=express[_0xf939('0x3')]();var auth=require(_0xf939('0x4'));var interaction=require(_0xf939('0x5'));var config=require(_0xf939('0x6'));var controller=require(_0xf939('0x7'));router[_0xf939('0x8')]('/',auth[_0xf939('0x9')](),controller[_0xf939('0xa')]);router[_0xf939('0x8')](_0xf939('0xb'),auth[_0xf939('0x9')](),controller[_0xf939('0xc')]);router[_0xf939('0x8')](_0xf939('0xd'),auth[_0xf939('0x9')](),controller[_0xf939('0xe')]);router[_0xf939('0x8')](_0xf939('0xf'),auth[_0xf939('0x9')](),controller[_0xf939('0x10')]);router[_0xf939('0x11')]('/',auth[_0xf939('0x9')](),controller[_0xf939('0x12')]);router['post']('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);router[_0xf939('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0xf939('0x13')]);router[_0xf939('0x14')]('/:id',auth[_0xf939('0x9')](),controller[_0xf939('0x15')]);router['delete'](_0xf939('0xb'),auth['isAuthenticated'](),controller[_0xf939('0x16')]);router[_0xf939('0x17')](_0xf939('0xd'),auth[_0xf939('0x9')](),controller['removeQueues']);router[_0xf939('0x17')]('/:id/users',auth[_0xf939('0x9')](),controller[_0xf939('0x18')]);module[_0xf939('0x19')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index a0fbb56..f8b2512 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 _0xfa2c=['STRING','name','sequelize','exports'];(function(_0x153762,_0xad5864){var _0x548f8c=function(_0x33ab7a){while(--_0x33ab7a){_0x153762['push'](_0x153762['shift']());}};_0x548f8c(++_0xad5864);}(_0xfa2c,0xb6));var _0xcfa2=function(_0x331db5,_0x2cefd4){_0x331db5=_0x331db5-0x0;var _0x5b6d8f=_0xfa2c[_0x331db5];return _0x5b6d8f;};'use strict';var Sequelize=require(_0xcfa2('0x0'));module[_0xcfa2('0x1')]={'name':{'type':Sequelize[_0xcfa2('0x2')],'allowNull':![],'unique':_0xcfa2('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa0c8=['exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa0c8,0x168));var _0x8a0c=function(_0x3dfa3e,_0x293558){_0x3dfa3e=_0x3dfa3e-0x0;var _0x3ff9ed=_0xa0c8[_0x3dfa3e];return _0x3ff9ed;};'use strict';var Sequelize=require('sequelize');module[_0x8a0c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x8a0c('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 116f40b..c81e60b 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 _0x66c7=['ids','removeQueues','remove','addAgents','Voice','Chat','Sms','Fax','each','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','voice','sms','openchannel','whatsapp','isArray','userTeam:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','get','Teams','UserProfileResource','error','stack','name','send','index','map','Team','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','show','params','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','getQueues','findOne','isValidChannel','ValidationError','capitalize','Queue','channel','toLowerCase','Queues','addQueues','Sequelize','Unknown\x20channel','add'];(function(_0x4c060b,_0x4c5e75){var _0x5b9790=function(_0x32e525){while(--_0x32e525){_0x4c060b['push'](_0x4c060b['shift']());}};_0x5b9790(++_0x4c5e75);}(_0x66c7,0x19d));var _0x766c=function(_0x1ac12c,_0x43fad2){_0x1ac12c=_0x1ac12c-0x0;var _0x4b2bce=_0x66c7[_0x1ac12c];return _0x4b2bce;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x766c('0x0'));var zipdir=require(_0x766c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x766c('0x2'));var moment=require(_0x766c('0x3'));var BPromise=require(_0x766c('0x4'));var Mustache=require(_0x766c('0x5'));var util=require(_0x766c('0x6'));var path=require('path');var sox=require(_0x766c('0x7'));var csv=require('to-csv');var ejs=require(_0x766c('0x8'));var fs=require('fs');var _=require(_0x766c('0x9'));var squel=require(_0x766c('0xa'));var crypto=require(_0x766c('0xb'));var jsforce=require(_0x766c('0xc'));var deskjs=require(_0x766c('0xd'));var toCsv=require(_0x766c('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x766c('0xf'));var qs=require(_0x766c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x766c('0x11'))(_0x766c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x766c('0x13'))['db'];config[_0x766c('0x14')]=_[_0x766c('0x15')](config[_0x766c('0x14')],{'host':_0x766c('0x16'),'port':0x18eb});var socket=require(_0x766c('0x17'))(new Redis(config['redis']));require('./team.socket')[_0x766c('0x18')](socket);function respondWithStatusCode(_0x58c690,_0x5a813a){_0x5a813a=_0x5a813a||0xcc;return function(_0x4551a1){if(_0x4551a1){return _0x58c690[_0x766c('0x19')](_0x5a813a);}return _0x58c690[_0x766c('0x1a')](_0x5a813a)[_0x766c('0x1b')]();};}function respondWithResult(_0x5e792f,_0x21baed){_0x21baed=_0x21baed||0xc8;return function(_0x231dc8){if(_0x231dc8){return _0x5e792f[_0x766c('0x1a')](_0x21baed)[_0x766c('0x1c')](_0x231dc8);}};}function respondWithFilteredResult(_0x12c6a4,_0xf21d2c){return function(_0x5e1084){if(_0x5e1084){var _0x472703=_0x5e1084[_0x766c('0x1d')],_0x428d0e=_0xf21d2c[_0x766c('0x1e')],_0x2f0ceb=_0xf21d2c[_0x766c('0x1e')]+_0xf21d2c['limit'],_0x2e7495;if(_0x2f0ceb>=_0x472703){_0x2f0ceb=_0x472703;_0x2e7495=0xc8;}else{_0x2e7495=0xce;}_0x12c6a4[_0x766c('0x1a')](_0x2e7495);return _0x12c6a4[_0x766c('0x1f')]('Content-Range',_0x428d0e+'-'+_0x2f0ceb+'/'+_0x472703)[_0x766c('0x1c')](_0x5e1084);}return null;};}function patchUpdates(_0x3503ca){return function(_0x380a19){try{jsonpatch[_0x766c('0x20')](_0x380a19,_0x3503ca,!![]);}catch(_0x56c45f){return BPromise[_0x766c('0x21')](_0x56c45f);}return _0x380a19[_0x766c('0x22')]();};}function saveUpdates(_0x13bb9c,_0x5ea412){return function(_0x4cc436){if(_0x4cc436){return _0x4cc436[_0x766c('0x23')](_0x13bb9c)[_0x766c('0x24')](function(_0x3c6f64){return _0x3c6f64;});}return null;};}function removeEntity(_0x3f931a,_0x4c2841){return function(_0x5ac649){if(_0x5ac649){return _0x5ac649[_0x766c('0x25')]()[_0x766c('0x24')](function(){var _0x4b63c6=_0x5ac649[_0x766c('0x26')]({'plain':!![]});var _0x5626ab=_0x766c('0x27');return db[_0x766c('0x28')]['destroy']({'where':{'type':_0x5626ab,'resourceId':_0x4b63c6['id']}})[_0x766c('0x24')](function(){return _0x5ac649;});})[_0x766c('0x24')](function(){_0x3f931a['status'](0xcc)[_0x766c('0x1b')]();});}};}function handleEntityNotFound(_0x2add8b,_0xf4500){return function(_0x39ba91){if(!_0x39ba91){_0x2add8b[_0x766c('0x19')](0x194);}return _0x39ba91;};}function handleError(_0x3dd030,_0x50e749){_0x50e749=_0x50e749||0x1f4;return function(_0x2bd28c){logger[_0x766c('0x29')](_0x2bd28c[_0x766c('0x2a')]);if(_0x2bd28c[_0x766c('0x2b')]){delete _0x2bd28c['name'];}_0x3dd030[_0x766c('0x1a')](_0x50e749)[_0x766c('0x2c')](_0x2bd28c);};}exports[_0x766c('0x2d')]=function(_0x5bf1f2,_0x52e99c){var _0x56c705={},_0x32665d={},_0x4a52e6={'count':0x0,'rows':[]};var _0x30c0b3=_[_0x766c('0x2e')](db[_0x766c('0x2f')][_0x766c('0x30')],function(_0x247e8e){return{'name':_0x247e8e['fieldName'],'type':_0x247e8e[_0x766c('0x31')][_0x766c('0x32')]};});_0x32665d[_0x766c('0x33')]=_[_0x766c('0x2e')](_0x30c0b3,_0x766c('0x2b'));_0x32665d[_0x766c('0x34')]=_[_0x766c('0x35')](_0x5bf1f2[_0x766c('0x34')]);_0x32665d[_0x766c('0x36')]=_[_0x766c('0x37')](_0x32665d[_0x766c('0x33')],_0x32665d[_0x766c('0x34')]);_0x56c705['attributes']=_[_0x766c('0x37')](_0x32665d[_0x766c('0x33')],qs['fields'](_0x5bf1f2[_0x766c('0x34')][_0x766c('0x38')]));_0x56c705[_0x766c('0x39')]=_0x56c705[_0x766c('0x39')][_0x766c('0x3a')]?_0x56c705['attributes']:_0x32665d[_0x766c('0x33')];if(!_0x5bf1f2[_0x766c('0x34')][_0x766c('0x3b')](_0x766c('0x3c'))){_0x56c705[_0x766c('0x3d')]=qs[_0x766c('0x3d')](_0x5bf1f2['query'][_0x766c('0x3d')]);_0x56c705['offset']=qs[_0x766c('0x1e')](_0x5bf1f2[_0x766c('0x34')][_0x766c('0x1e')]);}_0x56c705[_0x766c('0x3e')]=qs[_0x766c('0x3f')](_0x5bf1f2[_0x766c('0x34')][_0x766c('0x3f')]);_0x56c705['where']=qs[_0x766c('0x36')](_[_0x766c('0x40')](_0x5bf1f2[_0x766c('0x34')],_0x32665d[_0x766c('0x36')]),_0x30c0b3);if(_0x5bf1f2[_0x766c('0x34')][_0x766c('0x41')]){_0x56c705[_0x766c('0x42')]=_[_0x766c('0x43')](_0x56c705[_0x766c('0x42')],{'$or':_['map'](_0x30c0b3,function(_0x27231d){if(_0x27231d['type']!==_0x766c('0x44')){var _0x40f03a={};_0x40f03a[_0x27231d['name']]={'$like':'%'+_0x5bf1f2['query'][_0x766c('0x41')]+'%'};return _0x40f03a;}})});}_0x56c705=_[_0x766c('0x43')]({},_0x56c705,_0x5bf1f2[_0x766c('0x45')]);var _0x5f24f0={'where':_0x56c705[_0x766c('0x42')]};return db[_0x766c('0x2f')][_0x766c('0x1d')](_0x5f24f0)[_0x766c('0x24')](function(_0x32f711){_0x4a52e6[_0x766c('0x1d')]=_0x32f711;if(_0x5bf1f2[_0x766c('0x34')]['includeAll']){_0x56c705['include']=[{'all':!![]}];}return db[_0x766c('0x2f')][_0x766c('0x46')](_0x56c705);})[_0x766c('0x24')](function(_0x153714){_0x4a52e6['rows']=_0x153714;return _0x4a52e6;})[_0x766c('0x24')](respondWithFilteredResult(_0x52e99c,_0x56c705))['catch'](handleError(_0x52e99c,null));};exports[_0x766c('0x47')]=function(_0x3daae8,_0x241de6){var _0xe433b6={'raw':![],'where':{'id':_0x3daae8[_0x766c('0x48')]['id']}},_0x465bd0={};_0x465bd0[_0x766c('0x33')]=_['keys'](db['Team']['rawAttributes']);_0x465bd0[_0x766c('0x34')]=_[_0x766c('0x35')](_0x3daae8['query']);_0x465bd0['filters']=_[_0x766c('0x37')](_0x465bd0[_0x766c('0x33')],_0x465bd0[_0x766c('0x34')]);_0xe433b6[_0x766c('0x39')]=_[_0x766c('0x37')](_0x465bd0[_0x766c('0x33')],qs[_0x766c('0x38')](_0x3daae8[_0x766c('0x34')]['fields']));_0xe433b6[_0x766c('0x39')]=_0xe433b6[_0x766c('0x39')][_0x766c('0x3a')]?_0xe433b6['attributes']:_0x465bd0[_0x766c('0x33')];if(_0x3daae8[_0x766c('0x34')][_0x766c('0x49')]){_0xe433b6[_0x766c('0x4a')]=[{'all':!![]}];}_0xe433b6=_[_0x766c('0x43')]({},_0xe433b6,_0x3daae8[_0x766c('0x45')]);return db[_0x766c('0x2f')][_0x766c('0x4b')](_0xe433b6)[_0x766c('0x24')](handleEntityNotFound(_0x241de6,null))[_0x766c('0x24')](respondWithResult(_0x241de6,null))['catch'](handleError(_0x241de6,null));};exports[_0x766c('0x4c')]=function(_0xff6de4,_0x4777a5){return db[_0x766c('0x2f')][_0x766c('0x4c')](_0xff6de4['body'],{})[_0x766c('0x24')](function(_0x411460){var _0xe1dac2=_0xff6de4[_0x766c('0x4d')][_0x766c('0x26')]({'plain':!![]});if(!_0xe1dac2)throw new Error(_0x766c('0x4e'));if(_0xe1dac2[_0x766c('0x4f')]===_0x766c('0x4d')){var _0x4e32a7=_0x411460['get']({'plain':!![]});var _0x2fbb83=_0x766c('0x27');return db[_0x766c('0x50')][_0x766c('0x4b')]({'where':{'name':_0x2fbb83,'userProfileId':_0xe1dac2[_0x766c('0x51')]},'raw':!![]})['then'](function(_0x99a433){if(_0x99a433&&_0x99a433[_0x766c('0x52')]===0x0){return db[_0x766c('0x28')][_0x766c('0x4c')]({'name':_0x4e32a7[_0x766c('0x2b')],'resourceId':_0x4e32a7['id'],'type':_0x99a433[_0x766c('0x2b')],'sectionId':_0x99a433['id']},{})[_0x766c('0x24')](function(){return _0x411460;});}else{return _0x411460;}})['catch'](function(_0x555d41){logger[_0x766c('0x29')](_0x766c('0x53'),_0x555d41);throw _0x555d41;});}return _0x411460;})['then'](respondWithResult(_0x4777a5,0xc9))[_0x766c('0x54')](handleError(_0x4777a5,null));};exports[_0x766c('0x23')]=function(_0x4b71cb,_0x3fff4d){if(_0x4b71cb['body']['id']){delete _0x4b71cb[_0x766c('0x55')]['id'];}return db[_0x766c('0x2f')][_0x766c('0x4b')]({'where':{'id':_0x4b71cb[_0x766c('0x48')]['id']}})[_0x766c('0x24')](handleEntityNotFound(_0x3fff4d,null))['then'](saveUpdates(_0x4b71cb[_0x766c('0x55')],null))[_0x766c('0x24')](respondWithResult(_0x3fff4d,null))['catch'](handleError(_0x3fff4d,null));};exports[_0x766c('0x25')]=function(_0x490d78,_0x595f6a){return db['Team']['find']({'where':{'id':_0x490d78[_0x766c('0x48')]['id']}})[_0x766c('0x24')](handleEntityNotFound(_0x595f6a,null))['then'](removeEntity(_0x595f6a,null))[_0x766c('0x54')](handleError(_0x595f6a,null));};exports[_0x766c('0x56')]=function(_0x191bc7,_0x505fe7,_0x3c21d1){return db[_0x766c('0x2f')][_0x766c('0x57')]({'where':{'id':_0x191bc7['params']['id']}})[_0x766c('0x24')](handleEntityNotFound(_0x505fe7,null))[_0x766c('0x24')](function(_0x1b17a1){if(!_0x191bc7['query']['channel']||!utils[_0x766c('0x58')](_0x191bc7[_0x766c('0x34')]['channel'])){throw new db['Sequelize'][(_0x766c('0x59'))]('Unknown\x20channel');}var _0x252e76={};var _0x5dc9f5={};_0x5dc9f5[_0x766c('0x33')]=_[_0x766c('0x35')](db[_[_0x766c('0x5a')](_0x191bc7[_0x766c('0x34')]['channel']['toLowerCase']())+_0x766c('0x5b')]['rawAttributes']);_0x5dc9f5[_0x766c('0x34')]=_[_0x766c('0x35')](_0x191bc7['query']);_0x5dc9f5[_0x766c('0x36')]=_[_0x766c('0x37')](_0x5dc9f5[_0x766c('0x33')],_0x5dc9f5[_0x766c('0x34')]);_0x252e76[_0x766c('0x39')]=_[_0x766c('0x37')](_0x5dc9f5['model'],qs[_0x766c('0x38')](_0x191bc7[_0x766c('0x34')][_0x766c('0x38')]));_0x252e76[_0x766c('0x39')]=_0x252e76['attributes'][_0x766c('0x3a')]?_0x252e76[_0x766c('0x39')]:_0x5dc9f5[_0x766c('0x33')];_0x252e76[_0x766c('0x3d')]=qs[_0x766c('0x3d')](_0x191bc7[_0x766c('0x34')][_0x766c('0x3d')]);_0x252e76[_0x766c('0x1e')]=qs['offset'](_0x191bc7['query']['offset']);_0x252e76['order']=qs[_0x766c('0x3f')](_0x191bc7[_0x766c('0x34')][_0x766c('0x3f')]);_0x252e76[_0x766c('0x42')]=qs[_0x766c('0x36')](_[_0x766c('0x40')](_0x191bc7[_0x766c('0x34')],_0x5dc9f5[_0x766c('0x36')]));_0x252e76=_[_0x766c('0x43')]({},_0x252e76,_0x191bc7[_0x766c('0x45')]);return _0x1b17a1[_0x766c('0x26')+_[_0x766c('0x5a')](_0x191bc7[_0x766c('0x34')][_0x766c('0x5c')][_0x766c('0x5d')]())+_0x766c('0x5e')](_0x252e76);})['then'](respondWithResult(_0x505fe7,null))[_0x766c('0x54')](handleError(_0x505fe7,null));};exports[_0x766c('0x5f')]=function(_0x22c52c,_0x16d521,_0x56392c){return db[_0x766c('0x2f')][_0x766c('0x57')]({'where':{'id':_0x22c52c[_0x766c('0x48')]['id']}})['then'](function(_0x30647b){if(_0x30647b){if(!_0x22c52c['body'][_0x766c('0x5c')]||!utils[_0x766c('0x58')](_0x22c52c[_0x766c('0x55')][_0x766c('0x5c')])){throw new db[(_0x766c('0x60'))][(_0x766c('0x59'))](_0x766c('0x61'));}return _0x30647b[_0x766c('0x62')+_[_0x766c('0x5a')](_0x22c52c[_0x766c('0x55')][_0x766c('0x5c')][_0x766c('0x5d')]())+_0x766c('0x5e')](_0x22c52c[_0x766c('0x55')][_0x766c('0x63')]);}return null;})[_0x766c('0x24')](handleEntityNotFound(_0x16d521,null))[_0x766c('0x24')](respondWithStatusCode(_0x16d521,null))[_0x766c('0x54')](handleError(_0x16d521,null));};exports[_0x766c('0x64')]=function(_0x13c745,_0x217135,_0x5bbca8){return db[_0x766c('0x2f')][_0x766c('0x57')]({'where':{'id':_0x13c745[_0x766c('0x48')]['id']}})[_0x766c('0x24')](function(_0x5d6814){if(_0x5d6814){if(!_0x13c745[_0x766c('0x34')][_0x766c('0x5c')]||!utils['isValidChannel'](_0x13c745[_0x766c('0x34')]['channel'])){throw new db[(_0x766c('0x60'))][(_0x766c('0x59'))](_0x766c('0x61'));}return _0x5d6814[_0x766c('0x65')+_[_0x766c('0x5a')](_0x13c745[_0x766c('0x34')]['channel'][_0x766c('0x5d')]())+_0x766c('0x5e')](_0x13c745[_0x766c('0x34')]['ids']);}return null;})[_0x766c('0x24')](handleEntityNotFound(_0x217135,null))['then'](respondWithStatusCode(_0x217135,null))[_0x766c('0x54')](handleError(_0x217135,null));};exports[_0x766c('0x66')]=function(_0x4d157a,_0x33b914,_0x215da1){return db[_0x766c('0x2f')][_0x766c('0x4b')]({'where':{'id':_0x4d157a[_0x766c('0x48')]['id']}})[_0x766c('0x24')](handleEntityNotFound(_0x33b914,null))['then'](function(_0x47b5f0){if(_0x47b5f0){var _0x50a393=[_0x766c('0x67'),_0x766c('0x68'),'Mail',_0x766c('0x69'),_0x766c('0x6a'),'Openchannel','Whatsapp'];return BPromise[_0x766c('0x6b')](_0x50a393,function(_0x592ba1){return _0x47b5f0['get'+_0x592ba1+'Queues']({'attributes':['id','name']})[_0x766c('0x24')](function(_0x4e8644){return BPromise[_0x766c('0x6b')](_0x4e8644,function(_0x2440f4){return _0x2440f4['addAgents'](_0x4d157a[_0x766c('0x55')][_0x766c('0x63')])[_0x766c('0x24')](function(){if(_0x592ba1===_0x766c('0x67')){return db['User'][_0x766c('0x46')]({'where':{'id':_0x4d157a[_0x766c('0x55')][_0x766c('0x63')]},'attributes':['id',_0x766c('0x2b'),_0x766c('0x6c'),_0x766c('0x6d'),_0x766c('0x6e')],'raw':!![]})[_0x766c('0x24')](function(_0x3cbf4a){return BPromise['each'](_['filter'](_0x3cbf4a,{'online':0x1}),function(_0x1e934a){return db[_0x766c('0x6f')][_0x766c('0x70')]({'membername':_0x1e934a[_0x766c('0x2b')],'UserId':_0x1e934a['id'],'queue_name':_0x2440f4[_0x766c('0x2b')],'VoiceQueueId':_0x2440f4['id'],'interface':_[_0x766c('0x71')](_0x1e934a[_0x766c('0x6e')])?util[_0x766c('0x72')](_0x766c('0x73'),_0x1e934a[_0x766c('0x2b')]):_0x1e934a[_0x766c('0x6e')],'paused':_0x1e934a['voicePause']||![],'penalty':0x0});});});}});});})[_0x766c('0x24')](function(){return _0x47b5f0;});})[_0x766c('0x24')](function(){return _0x47b5f0;});}})['then'](function(_0xad7e03){if(_0xad7e03){return _0xad7e03[_0x766c('0x66')](_0x4d157a[_0x766c('0x55')][_0x766c('0x63')],_[_0x766c('0x74')](_0x4d157a['body'],['ids','id'])||{})[_0x766c('0x75')](function(_0x4ba25f){for(var _0x436774=0x0;_0x436774<_0x4d157a[_0x766c('0x55')][_0x766c('0x63')][_0x766c('0x3a')];_0x436774+=0x1){socket[_0x766c('0x76')](_0x766c('0x77'),{'UserId':_0x4d157a[_0x766c('0x55')][_0x766c('0x63')][_0x436774],'TeamId':_0x4d157a[_0x766c('0x48')]['id']});}return _0x4ba25f;});}})['then'](respondWithResult(_0x33b914,null))[_0x766c('0x54')](handleError(_0x33b914,null));};exports[_0x766c('0x78')]=function(_0x34ca8c,_0x594b68,_0x5abab6){return db[_0x766c('0x2f')][_0x766c('0x4b')]({'where':{'id':_0x34ca8c[_0x766c('0x48')]['id']}})['then'](handleEntityNotFound(_0x594b68,null))[_0x766c('0x24')](function(_0xd00b6f){if(_0xd00b6f){return BPromise[_0x766c('0x6b')]([_0x766c('0x79'),'chat','mail',_0x766c('0x7a'),'fax',_0x766c('0x7b'),_0x766c('0x7c')],function(_0x59f641){return _0xd00b6f[_0x766c('0x26')+_[_0x766c('0x5a')](_0x59f641)+_0x766c('0x5e')]({'attributes':['id',_0x766c('0x2b')]})[_0x766c('0x24')](function(_0x3b22d6){return BPromise[_0x766c('0x6b')](_0x3b22d6,function(_0x50cd74){return _0x50cd74[_0x766c('0x78')](_0x34ca8c['query'][_0x766c('0x63')])['then'](function(){if(_0x59f641===_0x766c('0x79')){return db[_0x766c('0x6f')]['destroy']({'where':{'VoiceQueueId':_0x50cd74['id'],'UserId':_0x34ca8c[_0x766c('0x34')][_0x766c('0x63')]}});}});});})['then'](function(){return _0xd00b6f;});})['then'](function(){return _0xd00b6f;});}})[_0x766c('0x24')](function(_0x8e761b){if(_0x8e761b){return _0x8e761b['removeAgents'](_0x34ca8c['query'][_0x766c('0x63')])[_0x766c('0x24')](function(){if(_[_0x766c('0x7d')](_0x34ca8c[_0x766c('0x34')][_0x766c('0x63')])){for(var _0x1057ac=0x0;_0x1057ac<_0x34ca8c[_0x766c('0x34')]['ids'][_0x766c('0x3a')];_0x1057ac+=0x1){socket[_0x766c('0x76')]('userTeam:remove',{'UserId':Number(_0x34ca8c['query'][_0x766c('0x63')][_0x1057ac]),'TeamId':Number(_0x34ca8c[_0x766c('0x48')]['id'])});}}else{socket[_0x766c('0x76')](_0x766c('0x7e'),{'UserId':Number(_0x34ca8c[_0x766c('0x34')]['ids']),'TeamId':Number(_0x34ca8c[_0x766c('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x594b68,null))[_0x766c('0x54')](handleError(_0x594b68,null));};exports[_0x766c('0x7f')]=function(_0x3cc406,_0x462f17,_0x1ea44d){var _0x297d40={};var _0x5c941c={};var _0x3635a5;var _0x4f6b0e;return db[_0x766c('0x2f')][_0x766c('0x57')]({'where':{'id':_0x3cc406[_0x766c('0x48')]['id']}})[_0x766c('0x24')](handleEntityNotFound(_0x462f17,null))['then'](function(_0x141eef){if(_0x141eef){_0x3635a5=_0x141eef;_0x5c941c[_0x766c('0x33')]=_[_0x766c('0x35')](db['User'][_0x766c('0x30')]);_0x5c941c[_0x766c('0x34')]=_[_0x766c('0x35')](_0x3cc406['query']);_0x5c941c[_0x766c('0x36')]=_[_0x766c('0x37')](_0x5c941c[_0x766c('0x33')],_0x5c941c[_0x766c('0x34')]);_0x297d40[_0x766c('0x39')]=_['intersection'](_0x5c941c['model'],qs['fields'](_0x3cc406[_0x766c('0x34')][_0x766c('0x38')]));_0x297d40[_0x766c('0x39')]=_0x297d40['attributes']['length']?_0x297d40[_0x766c('0x39')]:_0x5c941c[_0x766c('0x33')];_0x297d40[_0x766c('0x3e')]=qs[_0x766c('0x3f')](_0x3cc406['query']['sort']);_0x297d40[_0x766c('0x42')]=qs[_0x766c('0x36')](_[_0x766c('0x40')](_0x3cc406['query'],_0x5c941c[_0x766c('0x36')]));if(_0x3cc406[_0x766c('0x34')][_0x766c('0x41')]){_0x297d40[_0x766c('0x42')]=_[_0x766c('0x43')](_0x297d40['where'],{'$or':_[_0x766c('0x2e')](_0x297d40[_0x766c('0x39')],function(_0x4972d9){var _0x1e80e1={};_0x1e80e1[_0x4972d9]={'$like':'%'+_0x3cc406['query'][_0x766c('0x41')]+'%'};return _0x1e80e1;})});}_0x297d40=_['merge']({},_0x297d40,_0x3cc406[_0x766c('0x45')]);return _0x3635a5[_0x766c('0x7f')](_0x297d40);}})['then'](function(_0x1f0123){if(_0x1f0123){_0x4f6b0e=_0x1f0123[_0x766c('0x3a')];if(!_0x3cc406[_0x766c('0x34')]['hasOwnProperty'](_0x766c('0x3c'))){_0x297d40[_0x766c('0x3d')]=qs['limit'](_0x3cc406[_0x766c('0x34')][_0x766c('0x3d')]);_0x297d40[_0x766c('0x1e')]=qs[_0x766c('0x1e')](_0x3cc406[_0x766c('0x34')]['offset']);}return _0x3635a5[_0x766c('0x7f')](_0x297d40);}})['then'](function(_0x2b6bb2){if(_0x2b6bb2){return _0x2b6bb2?{'count':_0x4f6b0e,'rows':_0x2b6bb2}:null;}})[_0x766c('0x24')](respondWithResult(_0x462f17,null))[_0x766c('0x54')](handleError(_0x462f17,null));}; \ No newline at end of file +var _0xa906=['localhost','./team.socket','register','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','Team','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','show','keys','intersection','includeAll','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','channel','Sequelize','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','findOne','ValidationError','add','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','spread','emit','chat','mail','sms','openchannel','whatsapp','removeAgents','userTeam:remove','getAgents','html-pdf','rimraf','request-promise','moment','util','path','to-csv','ejs','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis'];(function(_0x273d2b,_0x4b6f61){var _0x2b6238=function(_0x11c7df){while(--_0x11c7df){_0x273d2b['push'](_0x273d2b['shift']());}};_0x2b6238(++_0x4b6f61);}(_0xa906,0x1e3));var _0x6a90=function(_0x244510,_0x548c6c){_0x244510=_0x244510-0x0;var _0x2b4a7b=_0xa906[_0x244510];return _0x2b4a7b;};'use strict';var pdf=require(_0x6a90('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6a90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6a90('0x2'));var moment=require(_0x6a90('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6a90('0x4'));var path=require(_0x6a90('0x5'));var sox=require('sox');var csv=require(_0x6a90('0x6'));var ejs=require(_0x6a90('0x7'));var fs=require('fs');var _=require(_0x6a90('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6a90('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a90('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a90('0xb'));var qs=require(_0x6a90('0xc'));var as=require(_0x6a90('0xd'));var hardwareService=require(_0x6a90('0xe'));var logger=require(_0x6a90('0xf'))(_0x6a90('0x10'));var utils=require('../../config/utils');var config=require(_0x6a90('0x11'));var db=require(_0x6a90('0x12'))['db'];config['redis']=_[_0x6a90('0x13')](config[_0x6a90('0x14')],{'host':_0x6a90('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a90('0x14')]));require(_0x6a90('0x16'))[_0x6a90('0x17')](socket);function respondWithStatusCode(_0xa054b7,_0x16cf2b){_0x16cf2b=_0x16cf2b||0xcc;return function(_0x3234ff){if(_0x3234ff){return _0xa054b7[_0x6a90('0x18')](_0x16cf2b);}return _0xa054b7[_0x6a90('0x19')](_0x16cf2b)[_0x6a90('0x1a')]();};}function respondWithResult(_0x5f433a,_0xf0c0ac){_0xf0c0ac=_0xf0c0ac||0xc8;return function(_0x850e32){if(_0x850e32){return _0x5f433a[_0x6a90('0x19')](_0xf0c0ac)[_0x6a90('0x1b')](_0x850e32);}};}function respondWithFilteredResult(_0x38be60,_0x310974){return function(_0x86b510){if(_0x86b510){var _0xec500e=_0x86b510['count'],_0x5f3de5=_0x310974[_0x6a90('0x1c')],_0x4d70e3=_0x310974[_0x6a90('0x1c')]+_0x310974['limit'],_0x64494c;if(_0x4d70e3>=_0xec500e){_0x4d70e3=_0xec500e;_0x64494c=0xc8;}else{_0x64494c=0xce;}_0x38be60[_0x6a90('0x19')](_0x64494c);return _0x38be60[_0x6a90('0x1d')]('Content-Range',_0x5f3de5+'-'+_0x4d70e3+'/'+_0xec500e)[_0x6a90('0x1b')](_0x86b510);}return null;};}function patchUpdates(_0x27b489){return function(_0x1948aa){try{jsonpatch[_0x6a90('0x1e')](_0x1948aa,_0x27b489,!![]);}catch(_0x3b950c){return BPromise[_0x6a90('0x1f')](_0x3b950c);}return _0x1948aa[_0x6a90('0x20')]();};}function saveUpdates(_0x3236fe,_0xc9e627){return function(_0x414944){if(_0x414944){return _0x414944[_0x6a90('0x21')](_0x3236fe)[_0x6a90('0x22')](function(_0x2339cd){return _0x2339cd;});}return null;};}function removeEntity(_0x1bfdbc,_0x16a86f){return function(_0x175497){if(_0x175497){return _0x175497[_0x6a90('0x23')]()[_0x6a90('0x22')](function(){var _0x4cf74e=_0x175497[_0x6a90('0x24')]({'plain':!![]});var _0x5d02ec='Teams';return db[_0x6a90('0x25')][_0x6a90('0x23')]({'where':{'type':_0x5d02ec,'resourceId':_0x4cf74e['id']}})[_0x6a90('0x22')](function(){return _0x175497;});})['then'](function(){_0x1bfdbc[_0x6a90('0x19')](0xcc)[_0x6a90('0x1a')]();});}};}function handleEntityNotFound(_0x22c4da,_0x54fbf5){return function(_0x4f120a){if(!_0x4f120a){_0x22c4da[_0x6a90('0x18')](0x194);}return _0x4f120a;};}function handleError(_0x3da95d,_0x11f752){_0x11f752=_0x11f752||0x1f4;return function(_0x57c12e){logger[_0x6a90('0x26')](_0x57c12e[_0x6a90('0x27')]);if(_0x57c12e[_0x6a90('0x28')]){delete _0x57c12e[_0x6a90('0x28')];}_0x3da95d[_0x6a90('0x19')](_0x11f752)['send'](_0x57c12e);};}exports['index']=function(_0x38d527,_0x73fa59){var _0x2de257={},_0x3ea311={},_0x1ec6ac={'count':0x0,'rows':[]};var _0x4f2937=_[_0x6a90('0x29')](db[_0x6a90('0x2a')][_0x6a90('0x2b')],function(_0x5895e7){return{'name':_0x5895e7[_0x6a90('0x2c')],'type':_0x5895e7[_0x6a90('0x2d')][_0x6a90('0x2e')]};});_0x3ea311[_0x6a90('0x2f')]=_[_0x6a90('0x29')](_0x4f2937,_0x6a90('0x28'));_0x3ea311[_0x6a90('0x30')]=_['keys'](_0x38d527[_0x6a90('0x30')]);_0x3ea311[_0x6a90('0x31')]=_['intersection'](_0x3ea311['model'],_0x3ea311[_0x6a90('0x30')]);_0x2de257['attributes']=_['intersection'](_0x3ea311['model'],qs[_0x6a90('0x32')](_0x38d527[_0x6a90('0x30')]['fields']));_0x2de257['attributes']=_0x2de257[_0x6a90('0x33')][_0x6a90('0x34')]?_0x2de257[_0x6a90('0x33')]:_0x3ea311[_0x6a90('0x2f')];if(!_0x38d527['query'][_0x6a90('0x35')](_0x6a90('0x36'))){_0x2de257[_0x6a90('0x37')]=qs[_0x6a90('0x37')](_0x38d527[_0x6a90('0x30')]['limit']);_0x2de257[_0x6a90('0x1c')]=qs[_0x6a90('0x1c')](_0x38d527[_0x6a90('0x30')]['offset']);}_0x2de257[_0x6a90('0x38')]=qs[_0x6a90('0x39')](_0x38d527['query'][_0x6a90('0x39')]);_0x2de257[_0x6a90('0x3a')]=qs[_0x6a90('0x31')](_[_0x6a90('0x3b')](_0x38d527[_0x6a90('0x30')],_0x3ea311[_0x6a90('0x31')]),_0x4f2937);if(_0x38d527[_0x6a90('0x30')][_0x6a90('0x3c')]){_0x2de257[_0x6a90('0x3a')]=_[_0x6a90('0x3d')](_0x2de257[_0x6a90('0x3a')],{'$or':_[_0x6a90('0x29')](_0x4f2937,function(_0x443476){if(_0x443476['type']!==_0x6a90('0x3e')){var _0x4e0bd7={};_0x4e0bd7[_0x443476[_0x6a90('0x28')]]={'$like':'%'+_0x38d527[_0x6a90('0x30')]['filter']+'%'};return _0x4e0bd7;}})});}_0x2de257=_[_0x6a90('0x3d')]({},_0x2de257,_0x38d527['options']);var _0x36642f={'where':_0x2de257[_0x6a90('0x3a')]};return db[_0x6a90('0x2a')][_0x6a90('0x3f')](_0x36642f)['then'](function(_0x4a5e5e){_0x1ec6ac[_0x6a90('0x3f')]=_0x4a5e5e;if(_0x38d527['query']['includeAll']){_0x2de257[_0x6a90('0x40')]=[{'all':!![]}];}return db[_0x6a90('0x2a')][_0x6a90('0x41')](_0x2de257);})[_0x6a90('0x22')](function(_0x2ee087){_0x1ec6ac[_0x6a90('0x42')]=_0x2ee087;return _0x1ec6ac;})[_0x6a90('0x22')](respondWithFilteredResult(_0x73fa59,_0x2de257))[_0x6a90('0x43')](handleError(_0x73fa59,null));};exports[_0x6a90('0x44')]=function(_0x34edb0,_0x429500){var _0x34e152={'raw':![],'where':{'id':_0x34edb0['params']['id']}},_0x39b1de={};_0x39b1de['model']=_[_0x6a90('0x45')](db[_0x6a90('0x2a')][_0x6a90('0x2b')]);_0x39b1de['query']=_[_0x6a90('0x45')](_0x34edb0[_0x6a90('0x30')]);_0x39b1de[_0x6a90('0x31')]=_[_0x6a90('0x46')](_0x39b1de[_0x6a90('0x2f')],_0x39b1de['query']);_0x34e152[_0x6a90('0x33')]=_[_0x6a90('0x46')](_0x39b1de[_0x6a90('0x2f')],qs[_0x6a90('0x32')](_0x34edb0[_0x6a90('0x30')][_0x6a90('0x32')]));_0x34e152[_0x6a90('0x33')]=_0x34e152['attributes']['length']?_0x34e152['attributes']:_0x39b1de[_0x6a90('0x2f')];if(_0x34edb0[_0x6a90('0x30')][_0x6a90('0x47')]){_0x34e152[_0x6a90('0x40')]=[{'all':!![]}];}_0x34e152=_[_0x6a90('0x3d')]({},_0x34e152,_0x34edb0[_0x6a90('0x48')]);return db[_0x6a90('0x2a')][_0x6a90('0x49')](_0x34e152)['then'](handleEntityNotFound(_0x429500,null))[_0x6a90('0x22')](respondWithResult(_0x429500,null))[_0x6a90('0x43')](handleError(_0x429500,null));};exports['create']=function(_0x107148,_0x14e3ec){return db[_0x6a90('0x2a')]['create'](_0x107148[_0x6a90('0x4a')],{})[_0x6a90('0x22')](function(_0x28c430){var _0x5b6ce6=_0x107148[_0x6a90('0x4b')][_0x6a90('0x24')]({'plain':!![]});if(!_0x5b6ce6)throw new Error(_0x6a90('0x4c'));if(_0x5b6ce6[_0x6a90('0x4d')]==='user'){var _0x337b3a=_0x28c430[_0x6a90('0x24')]({'plain':!![]});var _0x3a4300=_0x6a90('0x4e');return db[_0x6a90('0x4f')]['find']({'where':{'name':_0x3a4300,'userProfileId':_0x5b6ce6['userProfileId']},'raw':!![]})['then'](function(_0xf75112){if(_0xf75112&&_0xf75112[_0x6a90('0x50')]===0x0){return db[_0x6a90('0x25')][_0x6a90('0x51')]({'name':_0x337b3a['name'],'resourceId':_0x337b3a['id'],'type':_0xf75112[_0x6a90('0x28')],'sectionId':_0xf75112['id']},{})['then'](function(){return _0x28c430;});}else{return _0x28c430;}})[_0x6a90('0x43')](function(_0x3bc7e5){logger[_0x6a90('0x26')](_0x6a90('0x52'),_0x3bc7e5);throw _0x3bc7e5;});}return _0x28c430;})['then'](respondWithResult(_0x14e3ec,0xc9))['catch'](handleError(_0x14e3ec,null));};exports[_0x6a90('0x21')]=function(_0x2ff7c6,_0x321c5d){if(_0x2ff7c6[_0x6a90('0x4a')]['id']){delete _0x2ff7c6[_0x6a90('0x4a')]['id'];}return db[_0x6a90('0x2a')][_0x6a90('0x49')]({'where':{'id':_0x2ff7c6[_0x6a90('0x53')]['id']}})[_0x6a90('0x22')](handleEntityNotFound(_0x321c5d,null))[_0x6a90('0x22')](saveUpdates(_0x2ff7c6[_0x6a90('0x4a')],null))[_0x6a90('0x22')](respondWithResult(_0x321c5d,null))[_0x6a90('0x43')](handleError(_0x321c5d,null));};exports[_0x6a90('0x23')]=function(_0x368735,_0x3f6652){return db[_0x6a90('0x2a')][_0x6a90('0x49')]({'where':{'id':_0x368735[_0x6a90('0x53')]['id']}})[_0x6a90('0x22')](handleEntityNotFound(_0x3f6652,null))[_0x6a90('0x22')](removeEntity(_0x3f6652,null))[_0x6a90('0x43')](handleError(_0x3f6652,null));};exports[_0x6a90('0x54')]=function(_0x1347ec,_0x349d1c,_0x525c26){return db[_0x6a90('0x2a')]['findOne']({'where':{'id':_0x1347ec[_0x6a90('0x53')]['id']}})[_0x6a90('0x22')](handleEntityNotFound(_0x349d1c,null))[_0x6a90('0x22')](function(_0x5cd408){if(!_0x1347ec[_0x6a90('0x30')][_0x6a90('0x55')]||!utils['isValidChannel'](_0x1347ec['query'][_0x6a90('0x55')])){throw new db[(_0x6a90('0x56'))]['ValidationError'](_0x6a90('0x57'));}var _0x2d3659={};var _0x331b4d={};_0x331b4d[_0x6a90('0x2f')]=_[_0x6a90('0x45')](db[_[_0x6a90('0x58')](_0x1347ec[_0x6a90('0x30')][_0x6a90('0x55')][_0x6a90('0x59')]())+_0x6a90('0x5a')][_0x6a90('0x2b')]);_0x331b4d[_0x6a90('0x30')]=_[_0x6a90('0x45')](_0x1347ec[_0x6a90('0x30')]);_0x331b4d[_0x6a90('0x31')]=_[_0x6a90('0x46')](_0x331b4d['model'],_0x331b4d[_0x6a90('0x30')]);_0x2d3659[_0x6a90('0x33')]=_[_0x6a90('0x46')](_0x331b4d['model'],qs['fields'](_0x1347ec[_0x6a90('0x30')]['fields']));_0x2d3659[_0x6a90('0x33')]=_0x2d3659[_0x6a90('0x33')][_0x6a90('0x34')]?_0x2d3659[_0x6a90('0x33')]:_0x331b4d[_0x6a90('0x2f')];_0x2d3659[_0x6a90('0x37')]=qs[_0x6a90('0x37')](_0x1347ec[_0x6a90('0x30')][_0x6a90('0x37')]);_0x2d3659['offset']=qs['offset'](_0x1347ec[_0x6a90('0x30')][_0x6a90('0x1c')]);_0x2d3659['order']=qs[_0x6a90('0x39')](_0x1347ec[_0x6a90('0x30')][_0x6a90('0x39')]);_0x2d3659['where']=qs['filters'](_['pick'](_0x1347ec['query'],_0x331b4d[_0x6a90('0x31')]));_0x2d3659=_['merge']({},_0x2d3659,_0x1347ec[_0x6a90('0x48')]);return _0x5cd408[_0x6a90('0x24')+_[_0x6a90('0x58')](_0x1347ec['query']['channel']['toLowerCase']())+'Queues'](_0x2d3659);})[_0x6a90('0x22')](respondWithResult(_0x349d1c,null))[_0x6a90('0x43')](handleError(_0x349d1c,null));};exports[_0x6a90('0x5b')]=function(_0x1ee771,_0x25871c,_0x4234ec){return db[_0x6a90('0x2a')][_0x6a90('0x5c')]({'where':{'id':_0x1ee771[_0x6a90('0x53')]['id']}})[_0x6a90('0x22')](function(_0x529e96){if(_0x529e96){if(!_0x1ee771[_0x6a90('0x4a')][_0x6a90('0x55')]||!utils['isValidChannel'](_0x1ee771[_0x6a90('0x4a')][_0x6a90('0x55')])){throw new db[(_0x6a90('0x56'))][(_0x6a90('0x5d'))](_0x6a90('0x57'));}return _0x529e96[_0x6a90('0x5e')+_[_0x6a90('0x58')](_0x1ee771[_0x6a90('0x4a')]['channel'][_0x6a90('0x59')]())+_0x6a90('0x5f')](_0x1ee771[_0x6a90('0x4a')][_0x6a90('0x60')]);}return null;})[_0x6a90('0x22')](handleEntityNotFound(_0x25871c,null))['then'](respondWithStatusCode(_0x25871c,null))[_0x6a90('0x43')](handleError(_0x25871c,null));};exports[_0x6a90('0x61')]=function(_0x18861b,_0x5a3a86,_0x229744){return db['Team'][_0x6a90('0x5c')]({'where':{'id':_0x18861b[_0x6a90('0x53')]['id']}})[_0x6a90('0x22')](function(_0x28aa96){if(_0x28aa96){if(!_0x18861b['query']['channel']||!utils['isValidChannel'](_0x18861b[_0x6a90('0x30')][_0x6a90('0x55')])){throw new db[(_0x6a90('0x56'))][(_0x6a90('0x5d'))]('Unknown\x20channel');}return _0x28aa96[_0x6a90('0x62')+_['capitalize'](_0x18861b[_0x6a90('0x30')]['channel'][_0x6a90('0x59')]())+'Queues'](_0x18861b[_0x6a90('0x30')][_0x6a90('0x60')]);}return null;})['then'](handleEntityNotFound(_0x5a3a86,null))['then'](respondWithStatusCode(_0x5a3a86,null))['catch'](handleError(_0x5a3a86,null));};exports[_0x6a90('0x63')]=function(_0x18ff37,_0x366fc4,_0x2bfc15){return db[_0x6a90('0x2a')][_0x6a90('0x49')]({'where':{'id':_0x18ff37[_0x6a90('0x53')]['id']}})[_0x6a90('0x22')](handleEntityNotFound(_0x366fc4,null))[_0x6a90('0x22')](function(_0x2e58f9){if(_0x2e58f9){var _0x1fe3da=[_0x6a90('0x64'),_0x6a90('0x65'),_0x6a90('0x66'),_0x6a90('0x67'),_0x6a90('0x68'),_0x6a90('0x69'),_0x6a90('0x6a')];return BPromise[_0x6a90('0x6b')](_0x1fe3da,function(_0xbf8d19){return _0x2e58f9[_0x6a90('0x24')+_0xbf8d19+_0x6a90('0x5f')]({'attributes':['id','name']})[_0x6a90('0x22')](function(_0x5b0e3d){return BPromise[_0x6a90('0x6b')](_0x5b0e3d,function(_0x3dc63c){return _0x3dc63c[_0x6a90('0x63')](_0x18ff37[_0x6a90('0x4a')][_0x6a90('0x60')])[_0x6a90('0x22')](function(){if(_0xbf8d19==='Voice'){return db[_0x6a90('0x6c')]['findAll']({'where':{'id':_0x18ff37[_0x6a90('0x4a')][_0x6a90('0x60')]},'attributes':['id',_0x6a90('0x28'),'online',_0x6a90('0x6d'),_0x6a90('0x6e')],'raw':!![]})[_0x6a90('0x22')](function(_0x528c62){return BPromise['each'](_[_0x6a90('0x3c')](_0x528c62,{'online':0x1}),function(_0x2b33cc){return db[_0x6a90('0x6f')][_0x6a90('0x70')]({'membername':_0x2b33cc['name'],'UserId':_0x2b33cc['id'],'queue_name':_0x3dc63c['name'],'VoiceQueueId':_0x3dc63c['id'],'interface':_[_0x6a90('0x71')](_0x2b33cc[_0x6a90('0x6e')])?util[_0x6a90('0x72')](_0x6a90('0x73'),_0x2b33cc[_0x6a90('0x28')]):_0x2b33cc[_0x6a90('0x6e')],'paused':_0x2b33cc['voicePause']||![],'penalty':0x0});});});}});});})[_0x6a90('0x22')](function(){return _0x2e58f9;});})[_0x6a90('0x22')](function(){return _0x2e58f9;});}})[_0x6a90('0x22')](function(_0x1d89c9){if(_0x1d89c9){return _0x1d89c9[_0x6a90('0x63')](_0x18ff37[_0x6a90('0x4a')]['ids'],_['omit'](_0x18ff37[_0x6a90('0x4a')],[_0x6a90('0x60'),'id'])||{})[_0x6a90('0x74')](function(_0x51832d){for(var _0x2cd601=0x0;_0x2cd601<_0x18ff37['body']['ids'][_0x6a90('0x34')];_0x2cd601+=0x1){socket[_0x6a90('0x75')]('userTeam:save',{'UserId':_0x18ff37['body'][_0x6a90('0x60')][_0x2cd601],'TeamId':_0x18ff37[_0x6a90('0x53')]['id']});}return _0x51832d;});}})[_0x6a90('0x22')](respondWithResult(_0x366fc4,null))[_0x6a90('0x43')](handleError(_0x366fc4,null));};exports['removeAgents']=function(_0x363878,_0x117a4d,_0x385832){return db[_0x6a90('0x2a')][_0x6a90('0x49')]({'where':{'id':_0x363878[_0x6a90('0x53')]['id']}})['then'](handleEntityNotFound(_0x117a4d,null))[_0x6a90('0x22')](function(_0x17e6cd){if(_0x17e6cd){return BPromise[_0x6a90('0x6b')](['voice',_0x6a90('0x76'),_0x6a90('0x77'),_0x6a90('0x78'),'fax',_0x6a90('0x79'),_0x6a90('0x7a')],function(_0x52317b){return _0x17e6cd[_0x6a90('0x24')+_[_0x6a90('0x58')](_0x52317b)+_0x6a90('0x5f')]({'attributes':['id',_0x6a90('0x28')]})['then'](function(_0x5bd714){return BPromise[_0x6a90('0x6b')](_0x5bd714,function(_0x1ad38b){return _0x1ad38b[_0x6a90('0x7b')](_0x363878[_0x6a90('0x30')][_0x6a90('0x60')])['then'](function(){if(_0x52317b==='voice'){return db[_0x6a90('0x6f')][_0x6a90('0x23')]({'where':{'VoiceQueueId':_0x1ad38b['id'],'UserId':_0x363878[_0x6a90('0x30')][_0x6a90('0x60')]}});}});});})['then'](function(){return _0x17e6cd;});})[_0x6a90('0x22')](function(){return _0x17e6cd;});}})['then'](function(_0x570ac1){if(_0x570ac1){return _0x570ac1['removeAgents'](_0x363878[_0x6a90('0x30')][_0x6a90('0x60')])['then'](function(){if(_['isArray'](_0x363878[_0x6a90('0x30')][_0x6a90('0x60')])){for(var _0x281f15=0x0;_0x281f15<_0x363878[_0x6a90('0x30')]['ids'][_0x6a90('0x34')];_0x281f15+=0x1){socket['emit'](_0x6a90('0x7c'),{'UserId':Number(_0x363878[_0x6a90('0x30')][_0x6a90('0x60')][_0x281f15]),'TeamId':Number(_0x363878[_0x6a90('0x53')]['id'])});}}else{socket[_0x6a90('0x75')](_0x6a90('0x7c'),{'UserId':Number(_0x363878['query'][_0x6a90('0x60')]),'TeamId':Number(_0x363878[_0x6a90('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x117a4d,null))[_0x6a90('0x43')](handleError(_0x117a4d,null));};exports[_0x6a90('0x7d')]=function(_0x27d7a0,_0x1df446,_0x45f48f){var _0x30cd9d={};var _0x45a720={};var _0x2195fa;var _0x3d6ee1;return db[_0x6a90('0x2a')][_0x6a90('0x5c')]({'where':{'id':_0x27d7a0[_0x6a90('0x53')]['id']}})['then'](handleEntityNotFound(_0x1df446,null))[_0x6a90('0x22')](function(_0x18c830){if(_0x18c830){_0x2195fa=_0x18c830;_0x45a720[_0x6a90('0x2f')]=_[_0x6a90('0x45')](db[_0x6a90('0x6c')][_0x6a90('0x2b')]);_0x45a720['query']=_[_0x6a90('0x45')](_0x27d7a0['query']);_0x45a720[_0x6a90('0x31')]=_['intersection'](_0x45a720[_0x6a90('0x2f')],_0x45a720['query']);_0x30cd9d[_0x6a90('0x33')]=_[_0x6a90('0x46')](_0x45a720[_0x6a90('0x2f')],qs[_0x6a90('0x32')](_0x27d7a0['query'][_0x6a90('0x32')]));_0x30cd9d[_0x6a90('0x33')]=_0x30cd9d[_0x6a90('0x33')][_0x6a90('0x34')]?_0x30cd9d['attributes']:_0x45a720['model'];_0x30cd9d['order']=qs[_0x6a90('0x39')](_0x27d7a0[_0x6a90('0x30')][_0x6a90('0x39')]);_0x30cd9d[_0x6a90('0x3a')]=qs[_0x6a90('0x31')](_[_0x6a90('0x3b')](_0x27d7a0['query'],_0x45a720['filters']));if(_0x27d7a0[_0x6a90('0x30')]['filter']){_0x30cd9d['where']=_[_0x6a90('0x3d')](_0x30cd9d['where'],{'$or':_[_0x6a90('0x29')](_0x30cd9d[_0x6a90('0x33')],function(_0x2d2e31){var _0x2546e0={};_0x2546e0[_0x2d2e31]={'$like':'%'+_0x27d7a0['query'][_0x6a90('0x3c')]+'%'};return _0x2546e0;})});}_0x30cd9d=_[_0x6a90('0x3d')]({},_0x30cd9d,_0x27d7a0[_0x6a90('0x48')]);return _0x2195fa[_0x6a90('0x7d')](_0x30cd9d);}})[_0x6a90('0x22')](function(_0x21a068){if(_0x21a068){_0x3d6ee1=_0x21a068[_0x6a90('0x34')];if(!_0x27d7a0[_0x6a90('0x30')][_0x6a90('0x35')](_0x6a90('0x36'))){_0x30cd9d['limit']=qs[_0x6a90('0x37')](_0x27d7a0[_0x6a90('0x30')][_0x6a90('0x37')]);_0x30cd9d[_0x6a90('0x1c')]=qs[_0x6a90('0x1c')](_0x27d7a0[_0x6a90('0x30')]['offset']);}return _0x2195fa[_0x6a90('0x7d')](_0x30cd9d);}})[_0x6a90('0x22')](function(_0x3c572b){if(_0x3c572b){return _0x3c572b?{'count':_0x3d6ee1,'rows':_0x3c572b}:null;}})[_0x6a90('0x22')](respondWithResult(_0x1df446,null))[_0x6a90('0x43')](handleError(_0x1df446,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index fa01f2a..61f4fd5 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 _0x4eeb=['emit','exports','events','Team','save','update','remove'];(function(_0x3e275a,_0x5003c5){var _0x5b1db6=function(_0x4f22ff){while(--_0x4f22ff){_0x3e275a['push'](_0x3e275a['shift']());}};_0x5b1db6(++_0x5003c5);}(_0x4eeb,0xfe));var _0xb4ee=function(_0xec1513,_0x2486f5){_0xec1513=_0xec1513-0x0;var _0x110167=_0x4eeb[_0xec1513];return _0x110167;};'use strict';var EventEmitter=require(_0xb4ee('0x0'));var Team=require('../../mysqldb')['db'][_0xb4ee('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb4ee('0x2'),'afterUpdate':_0xb4ee('0x3'),'afterDestroy':_0xb4ee('0x4')};function emitEvent(_0x1bdf07){return function(_0x5b14d5,_0x467089,_0xd434b3){TeamEvents['emit'](_0x1bdf07+':'+_0x5b14d5['id'],_0x5b14d5);TeamEvents[_0xb4ee('0x5')](_0x1bdf07,_0x5b14d5);_0xd434b3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xb4ee('0x6')]=TeamEvents; \ No newline at end of file +var _0x5cd8=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Team','setMaxListeners','save'];(function(_0x2b4210,_0x521514){var _0x5b5b93=function(_0x2a3140){while(--_0x2a3140){_0x2b4210['push'](_0x2b4210['shift']());}};_0x5b5b93(++_0x521514);}(_0x5cd8,0x13c));var _0x85cd=function(_0x38a67a,_0x248684){_0x38a67a=_0x38a67a-0x0;var _0x2f933e=_0x5cd8[_0x38a67a];return _0x2f933e;};'use strict';var EventEmitter=require('events');var Team=require(_0x85cd('0x0'))['db'][_0x85cd('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x85cd('0x2')](0x0);var events={'afterCreate':_0x85cd('0x3'),'afterUpdate':_0x85cd('0x4'),'afterDestroy':_0x85cd('0x5')};function emitEvent(_0x279bdc){return function(_0x37ded8,_0xb64f38,_0x2ad293){TeamEvents['emit'](_0x279bdc+':'+_0x37ded8['id'],_0x37ded8);TeamEvents[_0x85cd('0x6')](_0x279bdc,_0x37ded8);_0x2ad293(null);};}for(var e in events){if(events[_0x85cd('0x7')](e)){var event=events[e];Team[_0x85cd('0x8')](e,emitEvent(event));}}module[_0x85cd('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index f5146e3..3c3b0f7 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 _0x8031=['define','Team','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports'];(function(_0x47a8c8,_0x3e16ec){var _0x92b07d=function(_0x38324c){while(--_0x38324c){_0x47a8c8['push'](_0x47a8c8['shift']());}};_0x92b07d(++_0x3e16ec);}(_0x8031,0xc5));var _0x1803=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x8031[_0x172747];return _0x509692;};'use strict';var _=require(_0x1803('0x0'));var util=require(_0x1803('0x1'));var logger=require('../../config/logger')(_0x1803('0x2'));var moment=require(_0x1803('0x3'));var BPromise=require(_0x1803('0x4'));var rp=require(_0x1803('0x5'));var fs=require('fs');var path=require(_0x1803('0x6'));var rimraf=require(_0x1803('0x7'));var config=require(_0x1803('0x8'));var attributes=require(_0x1803('0x9'));module[_0x1803('0xa')]=function(_0x828a75,_0x3abe34){return _0x828a75[_0x1803('0xb')](_0x1803('0xc'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b5f=['rimraf','./team.attributes','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x5b5f,0x157));var _0xf5b5=function(_0x2dc735,_0x5b3890){_0x2dc735=_0x2dc735-0x0;var _0x1c3693=_0x5b5f[_0x2dc735];return _0x1c3693;};'use strict';var _=require(_0xf5b5('0x0'));var util=require('util');var logger=require(_0xf5b5('0x1'))(_0xf5b5('0x2'));var moment=require(_0xf5b5('0x3'));var BPromise=require(_0xf5b5('0x4'));var rp=require(_0xf5b5('0x5'));var fs=require('fs');var path=require(_0xf5b5('0x6'));var rimraf=require(_0xf5b5('0x7'));var config=require('../../config/environment');var attributes=require(_0xf5b5('0x8'));module['exports']=function(_0x11d8cd,_0x59c99f){return _0x11d8cd[_0xf5b5('0x9')]('Team',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 bbd0571..0a32f2f 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 _0x3313=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','request','then','info','debug','request\x20sent','error','Team,\x20%s,\x20%s'];(function(_0x12c9c7,_0x5882c3){var _0x27af58=function(_0x20670a){while(--_0x20670a){_0x12c9c7['push'](_0x12c9c7['shift']());}};_0x27af58(++_0x5882c3);}(_0x3313,0x1ac));var _0x3331=function(_0x10c6e2,_0x2c22da){_0x10c6e2=_0x10c6e2-0x0;var _0x3e6bd8=_0x3313[_0x10c6e2];return _0x3e6bd8;};'use strict';var _=require(_0x3331('0x0'));var util=require(_0x3331('0x1'));var moment=require(_0x3331('0x2'));var BPromise=require(_0x3331('0x3'));var rs=require(_0x3331('0x4'));var fs=require('fs');var Redis=require(_0x3331('0x5'));var db=require(_0x3331('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3331('0x7'))(_0x3331('0x8'));var config=require(_0x3331('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3331('0xa')][_0x3331('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3331('0xc'),'port':0x18eb});var socket=require(_0x3331('0xd'))(new Redis(config[_0x3331('0xe')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x398109,_0x4d7935,_0x45bf61){return new BPromise(function(_0x33b3c9,_0x1437ee){return client[_0x3331('0xf')](_0x398109,_0x45bf61)[_0x3331('0x10')](function(_0xabbd81){logger[_0x3331('0x11')]('Team,\x20%s,\x20%s',_0x4d7935,'request\x20sent');logger[_0x3331('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x4d7935,_0x3331('0x13'),JSON['stringify'](_0xabbd81));if(_0xabbd81[_0x3331('0x14')]){if(_0xabbd81['error']['code']===0x1f4){logger[_0x3331('0x14')](_0x3331('0x15'),_0x4d7935,_0xabbd81[_0x3331('0x14')][_0x3331('0x16')]);return _0x1437ee(_0xabbd81['error'][_0x3331('0x16')]);}logger['error'](_0x3331('0x15'),_0x4d7935,_0xabbd81['error'][_0x3331('0x16')]);return _0x33b3c9(_0xabbd81[_0x3331('0x14')][_0x3331('0x16')]);}else{logger[_0x3331('0x11')]('Team,\x20%s,\x20%s',_0x4d7935,_0x3331('0x13'));_0x33b3c9(_0xabbd81[_0x3331('0x17')]['message']);}})[_0x3331('0x18')](function(_0x351d84){logger['error']('Team,\x20%s,\x20%s',_0x4d7935,_0x351d84);_0x1437ee(_0x351d84);});});} \ No newline at end of file +var _0x910f=['Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','./team.socket','register','request','info'];(function(_0x38df8f,_0x41d61d){var _0x2a98e9=function(_0x2ea1b5){while(--_0x2ea1b5){_0x38df8f['push'](_0x38df8f['shift']());}};_0x2a98e9(++_0x41d61d);}(_0x910f,0x19a));var _0xf910=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x910f[_0x59d89e];return _0x554e93;};'use strict';var _=require(_0xf910('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf910('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf910('0x2'));var db=require(_0xf910('0x3'))['db'];var utils=require(_0xf910('0x4'));var logger=require(_0xf910('0x5'))('rpc');var config=require(_0xf910('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf910('0x7')]['http']({'port':0x232a});config[_0xf910('0x8')]=_[_0xf910('0x9')](config[_0xf910('0x8')],{'host':_0xf910('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf910('0x8')]));require(_0xf910('0xb'))[_0xf910('0xc')](socket);function respondWithRpcPromise(_0x5c9e7e,_0x149cf1,_0x291e6e){return new BPromise(function(_0x1512db,_0x12e129){return client[_0xf910('0xd')](_0x5c9e7e,_0x291e6e)['then'](function(_0x3537da){logger[_0xf910('0xe')](_0xf910('0xf'),_0x149cf1,'request\x20sent');logger[_0xf910('0x10')](_0xf910('0x11'),_0x149cf1,_0xf910('0x12'),JSON[_0xf910('0x13')](_0x3537da));if(_0x3537da[_0xf910('0x14')]){if(_0x3537da[_0xf910('0x14')][_0xf910('0x15')]===0x1f4){logger[_0xf910('0x14')](_0xf910('0xf'),_0x149cf1,_0x3537da[_0xf910('0x14')]['message']);return _0x12e129(_0x3537da[_0xf910('0x14')][_0xf910('0x16')]);}logger['error'](_0xf910('0xf'),_0x149cf1,_0x3537da[_0xf910('0x14')]['message']);return _0x1512db(_0x3537da['error'][_0xf910('0x16')]);}else{logger[_0xf910('0xe')](_0xf910('0xf'),_0x149cf1,'request\x20sent');_0x1512db(_0x3537da[_0xf910('0x17')][_0xf910('0x16')]);}})[_0xf910('0x18')](function(_0x4c1dbf){logger[_0xf910('0x14')]('Team,\x20%s,\x20%s',_0x149cf1,_0x4c1dbf);_0x12e129(_0x4c1dbf);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index bbe2a51..192ec57 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 _0xa46e=['./team.events','save','update','emit','register','team:'];(function(_0x426df2,_0x1df2dd){var _0x5ab5bd=function(_0x173abd){while(--_0x173abd){_0x426df2['push'](_0x426df2['shift']());}};_0x5ab5bd(++_0x1df2dd);}(_0xa46e,0x8a));var _0xea46=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0xa46e[_0x2f0057];return _0x17f2c3;};'use strict';var TeamEvents=require(_0xea46('0x0'));var events=[_0xea46('0x1'),'remove',_0xea46('0x2')];function createListener(_0x2f69cc,_0x12deba){return function(_0x4cc9a2){_0x12deba[_0xea46('0x3')](_0x2f69cc,_0x4cc9a2);};}function removeListener(_0x4b6e4a,_0x3a2209){return function(){TeamEvents['removeListener'](_0x4b6e4a,_0x3a2209);};}exports[_0xea46('0x4')]=function(_0x528404){for(var _0x10bee5=0x0,_0x3dc26f=events['length'];_0x10bee5<_0x3dc26f;_0x10bee5++){var _0x2d1b30=events[_0x10bee5];var _0x42771a=createListener(_0xea46('0x5')+_0x2d1b30,_0x528404);TeamEvents['on'](_0x2d1b30,_0x42771a);}}; \ No newline at end of file +var _0xd8fb=['./team.events','save','remove','update','emit','removeListener','register','length','team:'];(function(_0x19741a,_0x279473){var _0x3fc644=function(_0x5e6195){while(--_0x5e6195){_0x19741a['push'](_0x19741a['shift']());}};_0x3fc644(++_0x279473);}(_0xd8fb,0x99));var _0xbd8f=function(_0x55dc50,_0x1797c8){_0x55dc50=_0x55dc50-0x0;var _0x39221d=_0xd8fb[_0x55dc50];return _0x39221d;};'use strict';var TeamEvents=require(_0xbd8f('0x0'));var events=[_0xbd8f('0x1'),_0xbd8f('0x2'),_0xbd8f('0x3')];function createListener(_0x52724c,_0x5ea933){return function(_0x4e9545){_0x5ea933[_0xbd8f('0x4')](_0x52724c,_0x4e9545);};}function removeListener(_0x43d177,_0x53cccc){return function(){TeamEvents[_0xbd8f('0x5')](_0x43d177,_0x53cccc);};}exports[_0xbd8f('0x6')]=function(_0x5543b2){for(var _0x33d541=0x0,_0x4e97cf=events[_0xbd8f('0x7')];_0x33d541<_0x4e97cf;_0x33d541++){var _0x578499=events[_0x33d541];var _0x197827=createListener(_0xbd8f('0x8')+_0x578499,_0x5543b2);TeamEvents['on'](_0x578499,_0x197827);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 7b2f456..b618eda 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 _0x9e12=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4621c7,_0x3258dd){var _0xeb2801=function(_0x486494){while(--_0x486494){_0x4621c7['push'](_0x4621c7['shift']());}};_0xeb2801(++_0x3258dd);}(_0x9e12,0x14a));var _0x29e1=function(_0x214915,_0x57669b){_0x214915=_0x214915-0x0;var _0xad30f9=_0x9e12[_0x214915];return _0xad30f9;};'use strict';var multer=require(_0x29e1('0x0'));var util=require(_0x29e1('0x1'));var path=require(_0x29e1('0x2'));var timeout=require(_0x29e1('0x3'));var express=require(_0x29e1('0x4'));var router=express[_0x29e1('0x5')]();var auth=require(_0x29e1('0x6'));var interaction=require(_0x29e1('0x7'));var config=require(_0x29e1('0x8'));var controller=require('./template.controller');router[_0x29e1('0x9')]('/',auth[_0x29e1('0xa')](),controller['index']);router[_0x29e1('0x9')]('/:id',auth[_0x29e1('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x29e1('0xb')]);router[_0x29e1('0xc')](_0x29e1('0xd'),auth[_0x29e1('0xa')](),controller['update']);router['delete'](_0x29e1('0xd'),auth['isAuthenticated'](),controller[_0x29e1('0xe')]);module[_0x29e1('0xf')]=router; \ No newline at end of file +var _0xe28a=['update','delete','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./template.controller','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x1677ea,_0x4eb263){var _0x4968f7=function(_0x121a74){while(--_0x121a74){_0x1677ea['push'](_0x1677ea['shift']());}};_0x4968f7(++_0x4eb263);}(_0xe28a,0x103));var _0xae28=function(_0x221381,_0x16c3bc){_0x221381=_0x221381-0x0;var _0x42d046=_0xe28a[_0x221381];return _0x42d046;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xae28('0x0'));var express=require(_0xae28('0x1'));var router=express[_0xae28('0x2')]();var auth=require(_0xae28('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xae28('0x4'));var controller=require(_0xae28('0x5'));router['get']('/',auth[_0xae28('0x6')](),controller[_0xae28('0x7')]);router['get']('/:id',auth[_0xae28('0x6')](),controller[_0xae28('0x8')]);router[_0xae28('0x9')]('/',auth['isAuthenticated'](),controller[_0xae28('0xa')]);router[_0xae28('0xb')](_0xae28('0xc'),auth[_0xae28('0x6')](),controller[_0xae28('0xd')]);router[_0xae28('0xe')](_0xae28('0xc'),auth[_0xae28('0x6')](),controller['destroy']);module[_0xae28('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index f8384cb..c4596eb 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 _0x5b2a=['sequelize','exports','STRING','TEXT'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x5b2a,0x124));var _0xa5b2=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x5b2a[_0x50bf5a];return _0x4ddc1d;};'use strict';var Sequelize=require(_0xa5b2('0x0'));module[_0xa5b2('0x1')]={'name':{'type':Sequelize[_0xa5b2('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xa5b2('0x3')]}}; \ No newline at end of file +var _0xc2f2=['STRING','TEXT','sequelize'];(function(_0x5827dd,_0x40b061){var _0x6195bb=function(_0x113aef){while(--_0x113aef){_0x5827dd['push'](_0x5827dd['shift']());}};_0x6195bb(++_0x40b061);}(_0xc2f2,0xb9));var _0x2c2f=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xc2f2[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x2c2f('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c2f('0x1')]},'description':{'type':Sequelize[_0x2c2f('0x1')]},'html':{'type':Sequelize[_0x2c2f('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 339e6ab..443595a 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 _0x952a=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','name','send','index','Template','rawAttributes','fieldName','model','keys','query','filters','intersection'];(function(_0x86d76f,_0x198b26){var _0x332d3d=function(_0x49785e){while(--_0x49785e){_0x86d76f['push'](_0x86d76f['shift']());}};_0x332d3d(++_0x198b26);}(_0x952a,0x16d));var _0xa952=function(_0x45ac27,_0x3d634a){_0x45ac27=_0x45ac27-0x0;var _0x1577aa=_0x952a[_0x45ac27];return _0x1577aa;};'use strict';var pdf=require(_0xa952('0x0'));var emlformat=require(_0xa952('0x1'));var rimraf=require(_0xa952('0x2'));var zipdir=require(_0xa952('0x3'));var jsonpatch=require(_0xa952('0x4'));var rp=require(_0xa952('0x5'));var moment=require(_0xa952('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa952('0x7'));var util=require(_0xa952('0x8'));var path=require(_0xa952('0x9'));var sox=require('sox');var csv=require(_0xa952('0xa'));var ejs=require(_0xa952('0xb'));var fs=require('fs');var _=require(_0xa952('0xc'));var squel=require(_0xa952('0xd'));var crypto=require(_0xa952('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa952('0xf'));var toCsv=require(_0xa952('0xa'));var querystring=require(_0xa952('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa952('0x11'));var qs=require(_0xa952('0x12'));var as=require(_0xa952('0x13'));var hardwareService=require(_0xa952('0x14'));var logger=require(_0xa952('0x15'))(_0xa952('0x16'));var utils=require(_0xa952('0x17'));var config=require(_0xa952('0x18'));var db=require(_0xa952('0x19'))['db'];function respondWithStatusCode(_0x1d7c4c,_0x3033a3){_0x3033a3=_0x3033a3||0xcc;return function(_0xb5c8b1){if(_0xb5c8b1){return _0x1d7c4c[_0xa952('0x1a')](_0x3033a3);}return _0x1d7c4c['status'](_0x3033a3)[_0xa952('0x1b')]();};}function respondWithResult(_0x3c8f7c,_0x11c7d2){_0x11c7d2=_0x11c7d2||0xc8;return function(_0x30211e){if(_0x30211e){return _0x3c8f7c[_0xa952('0x1c')](_0x11c7d2)['json'](_0x30211e);}};}function respondWithFilteredResult(_0x295c35,_0x4a0177){return function(_0x54ddf2){if(_0x54ddf2){var _0x49a8c0=_0x54ddf2[_0xa952('0x1d')],_0x236c69=_0x4a0177[_0xa952('0x1e')],_0x117bee=_0x4a0177[_0xa952('0x1e')]+_0x4a0177[_0xa952('0x1f')],_0x369db1;if(_0x117bee>=_0x49a8c0){_0x117bee=_0x49a8c0;_0x369db1=0xc8;}else{_0x369db1=0xce;}_0x295c35['status'](_0x369db1);return _0x295c35['set'](_0xa952('0x20'),_0x236c69+'-'+_0x117bee+'/'+_0x49a8c0)[_0xa952('0x21')](_0x54ddf2);}return null;};}function patchUpdates(_0x52c9ee){return function(_0x2f8d6e){try{jsonpatch[_0xa952('0x22')](_0x2f8d6e,_0x52c9ee,!![]);}catch(_0x416a21){return BPromise[_0xa952('0x23')](_0x416a21);}return _0x2f8d6e[_0xa952('0x24')]();};}function saveUpdates(_0x477184,_0x28033d){return function(_0x33ef7c){if(_0x33ef7c){return _0x33ef7c[_0xa952('0x25')](_0x477184)[_0xa952('0x26')](function(_0x33ef08){return _0x33ef08;});}return null;};}function removeEntity(_0x384531,_0xf4dcc0){return function(_0x4355bc){if(_0x4355bc){return _0x4355bc[_0xa952('0x27')]()[_0xa952('0x26')](function(){var _0x241eff=_0x4355bc[_0xa952('0x28')]({'plain':!![]});var _0x5a8f45=_0xa952('0x29');return db[_0xa952('0x2a')][_0xa952('0x27')]({'where':{'type':_0x5a8f45,'resourceId':_0x241eff['id']}})['then'](function(){return _0x4355bc;});})[_0xa952('0x26')](function(){_0x384531[_0xa952('0x1c')](0xcc)[_0xa952('0x1b')]();});}};}function handleEntityNotFound(_0x41947e,_0x1d3906){return function(_0x2e5b69){if(!_0x2e5b69){_0x41947e['sendStatus'](0x194);}return _0x2e5b69;};}function handleError(_0x16ed4f,_0x3ffae8){_0x3ffae8=_0x3ffae8||0x1f4;return function(_0x37b012){logger[_0xa952('0x2b')](_0x37b012['stack']);if(_0x37b012[_0xa952('0x2c')]){delete _0x37b012[_0xa952('0x2c')];}_0x16ed4f['status'](_0x3ffae8)[_0xa952('0x2d')](_0x37b012);};}exports[_0xa952('0x2e')]=function(_0x2a7877,_0x540a68){var _0x1d1f1d={},_0x1fef67={},_0xa6e07b={'count':0x0,'rows':[]};var _0x25a017=_['map'](db[_0xa952('0x2f')][_0xa952('0x30')],function(_0x3da2c7){return{'name':_0x3da2c7[_0xa952('0x31')],'type':_0x3da2c7['type']['key']};});_0x1fef67[_0xa952('0x32')]=_['map'](_0x25a017,_0xa952('0x2c'));_0x1fef67['query']=_[_0xa952('0x33')](_0x2a7877[_0xa952('0x34')]);_0x1fef67[_0xa952('0x35')]=_[_0xa952('0x36')](_0x1fef67[_0xa952('0x32')],_0x1fef67['query']);_0x1d1f1d[_0xa952('0x37')]=_[_0xa952('0x36')](_0x1fef67[_0xa952('0x32')],qs[_0xa952('0x38')](_0x2a7877[_0xa952('0x34')][_0xa952('0x38')]));_0x1d1f1d[_0xa952('0x37')]=_0x1d1f1d[_0xa952('0x37')][_0xa952('0x39')]?_0x1d1f1d[_0xa952('0x37')]:_0x1fef67[_0xa952('0x32')];if(!_0x2a7877[_0xa952('0x34')][_0xa952('0x3a')](_0xa952('0x3b'))){_0x1d1f1d[_0xa952('0x1f')]=qs[_0xa952('0x1f')](_0x2a7877[_0xa952('0x34')][_0xa952('0x1f')]);_0x1d1f1d[_0xa952('0x1e')]=qs[_0xa952('0x1e')](_0x2a7877[_0xa952('0x34')][_0xa952('0x1e')]);}_0x1d1f1d[_0xa952('0x3c')]=qs['sort'](_0x2a7877['query'][_0xa952('0x3d')]);_0x1d1f1d[_0xa952('0x3e')]=qs['filters'](_[_0xa952('0x3f')](_0x2a7877[_0xa952('0x34')],_0x1fef67[_0xa952('0x35')]),_0x25a017);if(_0x2a7877[_0xa952('0x34')][_0xa952('0x40')]){_0x1d1f1d['where']=_[_0xa952('0x41')](_0x1d1f1d['where'],{'$or':_[_0xa952('0x42')](_0x25a017,function(_0x475011){if(_0x475011[_0xa952('0x43')]!==_0xa952('0x44')){var _0x1054a6={};_0x1054a6[_0x475011['name']]={'$like':'%'+_0x2a7877[_0xa952('0x34')][_0xa952('0x40')]+'%'};return _0x1054a6;}})});}_0x1d1f1d=_[_0xa952('0x41')]({},_0x1d1f1d,_0x2a7877[_0xa952('0x45')]);var _0x2a99bf={'where':_0x1d1f1d[_0xa952('0x3e')]};return db[_0xa952('0x2f')][_0xa952('0x1d')](_0x2a99bf)[_0xa952('0x26')](function(_0x157f1e){_0xa6e07b[_0xa952('0x1d')]=_0x157f1e;if(_0x2a7877[_0xa952('0x34')]['includeAll']){_0x1d1f1d[_0xa952('0x46')]=[{'all':!![]}];}return db[_0xa952('0x2f')][_0xa952('0x47')](_0x1d1f1d);})[_0xa952('0x26')](function(_0x45573d){_0xa6e07b[_0xa952('0x48')]=_0x45573d;return _0xa6e07b;})['then'](respondWithFilteredResult(_0x540a68,_0x1d1f1d))[_0xa952('0x49')](handleError(_0x540a68,null));};exports['show']=function(_0x5763ef,_0x773bfb){var _0x1e739e={'raw':!![],'where':{'id':_0x5763ef[_0xa952('0x4a')]['id']}},_0x11fae7={};_0x11fae7[_0xa952('0x32')]=_[_0xa952('0x33')](db['Template'][_0xa952('0x30')]);_0x11fae7['query']=_[_0xa952('0x33')](_0x5763ef[_0xa952('0x34')]);_0x11fae7['filters']=_[_0xa952('0x36')](_0x11fae7[_0xa952('0x32')],_0x11fae7[_0xa952('0x34')]);_0x1e739e[_0xa952('0x37')]=_[_0xa952('0x36')](_0x11fae7['model'],qs['fields'](_0x5763ef['query'][_0xa952('0x38')]));_0x1e739e['attributes']=_0x1e739e[_0xa952('0x37')][_0xa952('0x39')]?_0x1e739e['attributes']:_0x11fae7[_0xa952('0x32')];if(_0x5763ef[_0xa952('0x34')][_0xa952('0x4b')]){_0x1e739e[_0xa952('0x46')]=[{'all':!![]}];}_0x1e739e=_[_0xa952('0x41')]({},_0x1e739e,_0x5763ef[_0xa952('0x45')]);return db[_0xa952('0x2f')][_0xa952('0x4c')](_0x1e739e)[_0xa952('0x26')](handleEntityNotFound(_0x773bfb,null))['then'](respondWithResult(_0x773bfb,null))[_0xa952('0x49')](handleError(_0x773bfb,null));};exports['create']=function(_0x596109,_0x2bf993){return db[_0xa952('0x2f')][_0xa952('0x4d')](_0x596109['body'],{})['then'](function(_0xecb7d5){var _0x28bdcc=_0x596109[_0xa952('0x4e')][_0xa952('0x28')]({'plain':!![]});if(!_0x28bdcc)throw new Error(_0xa952('0x4f'));if(_0x28bdcc[_0xa952('0x50')]===_0xa952('0x4e')){var _0x22baec=_0xecb7d5[_0xa952('0x28')]({'plain':!![]});var _0x424434=_0xa952('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x424434,'userProfileId':_0x28bdcc[_0xa952('0x51')]},'raw':!![]})[_0xa952('0x26')](function(_0x1893c9){if(_0x1893c9&&_0x1893c9['autoAssociation']===0x0){return db['UserProfileResource'][_0xa952('0x4d')]({'name':_0x22baec[_0xa952('0x2c')],'resourceId':_0x22baec['id'],'type':_0x1893c9[_0xa952('0x2c')],'sectionId':_0x1893c9['id']},{})[_0xa952('0x26')](function(){return _0xecb7d5;});}else{return _0xecb7d5;}})['catch'](function(_0x50fe9f){logger[_0xa952('0x2b')](_0xa952('0x52'),_0x50fe9f);throw _0x50fe9f;});}return _0xecb7d5;})[_0xa952('0x26')](respondWithResult(_0x2bf993,0xc9))[_0xa952('0x49')](handleError(_0x2bf993,null));};exports['update']=function(_0x687812,_0x9be3dd){if(_0x687812[_0xa952('0x53')]['id']){delete _0x687812[_0xa952('0x53')]['id'];}return db[_0xa952('0x2f')][_0xa952('0x4c')]({'where':{'id':_0x687812['params']['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x9be3dd,null))['then'](saveUpdates(_0x687812[_0xa952('0x53')],null))[_0xa952('0x26')](respondWithResult(_0x9be3dd,null))['catch'](handleError(_0x9be3dd,null));};exports[_0xa952('0x27')]=function(_0x2e024c,_0x3b45f2){return db[_0xa952('0x2f')][_0xa952('0x4c')]({'where':{'id':_0x2e024c[_0xa952('0x4a')]['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x3b45f2,null))[_0xa952('0x26')](removeEntity(_0x3b45f2,null))['catch'](handleError(_0x3b45f2,null));}; \ No newline at end of file +var _0x7282=['intersection','fields','attributes','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','json','count','offset','limit','apply','reject','save','update','destroy','then','get','Templates','sendStatus','error','stack','name','send','index','map','Template','fieldName','type','keys','query','filters','model'];(function(_0x27cee6,_0x517bde){var _0x3736fa=function(_0x365e73){while(--_0x365e73){_0x27cee6['push'](_0x27cee6['shift']());}};_0x3736fa(++_0x517bde);}(_0x7282,0xba));var _0x2728=function(_0x2c396c,_0x4db177){_0x2c396c=_0x2c396c-0x0;var _0x26219b=_0x7282[_0x2c396c];return _0x26219b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2728('0x0'));var rimraf=require(_0x2728('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2728('0x2'));var rp=require('request-promise');var moment=require(_0x2728('0x3'));var BPromise=require(_0x2728('0x4'));var Mustache=require(_0x2728('0x5'));var util=require(_0x2728('0x6'));var path=require(_0x2728('0x7'));var sox=require(_0x2728('0x8'));var csv=require(_0x2728('0x9'));var ejs=require(_0x2728('0xa'));var fs=require('fs');var _=require(_0x2728('0xb'));var squel=require(_0x2728('0xc'));var crypto=require(_0x2728('0xd'));var jsforce=require(_0x2728('0xe'));var deskjs=require(_0x2728('0xf'));var toCsv=require(_0x2728('0x9'));var querystring=require(_0x2728('0x10'));var Papa=require(_0x2728('0x11'));var Redis=require(_0x2728('0x12'));var authService=require(_0x2728('0x13'));var qs=require(_0x2728('0x14'));var as=require(_0x2728('0x15'));var hardwareService=require(_0x2728('0x16'));var logger=require(_0x2728('0x17'))(_0x2728('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2728('0x19'))['db'];function respondWithStatusCode(_0x3c8664,_0x5eb18e){_0x5eb18e=_0x5eb18e||0xcc;return function(_0x4b420e){if(_0x4b420e){return _0x3c8664['sendStatus'](_0x5eb18e);}return _0x3c8664['status'](_0x5eb18e)[_0x2728('0x1a')]();};}function respondWithResult(_0x23034d,_0x5a497b){_0x5a497b=_0x5a497b||0xc8;return function(_0x54e519){if(_0x54e519){return _0x23034d[_0x2728('0x1b')](_0x5a497b)[_0x2728('0x1c')](_0x54e519);}};}function respondWithFilteredResult(_0x1e8046,_0x86fcd9){return function(_0xf4adcd){if(_0xf4adcd){var _0x5307ee=_0xf4adcd[_0x2728('0x1d')],_0x20687a=_0x86fcd9[_0x2728('0x1e')],_0x2131ba=_0x86fcd9[_0x2728('0x1e')]+_0x86fcd9[_0x2728('0x1f')],_0x377213;if(_0x2131ba>=_0x5307ee){_0x2131ba=_0x5307ee;_0x377213=0xc8;}else{_0x377213=0xce;}_0x1e8046[_0x2728('0x1b')](_0x377213);return _0x1e8046['set']('Content-Range',_0x20687a+'-'+_0x2131ba+'/'+_0x5307ee)['json'](_0xf4adcd);}return null;};}function patchUpdates(_0x1767e2){return function(_0x36b31a){try{jsonpatch[_0x2728('0x20')](_0x36b31a,_0x1767e2,!![]);}catch(_0x3f8ba6){return BPromise[_0x2728('0x21')](_0x3f8ba6);}return _0x36b31a[_0x2728('0x22')]();};}function saveUpdates(_0x115a4e,_0x372816){return function(_0x53a574){if(_0x53a574){return _0x53a574[_0x2728('0x23')](_0x115a4e)['then'](function(_0x171c23){return _0x171c23;});}return null;};}function removeEntity(_0xbfd495,_0x54692f){return function(_0x33d2cd){if(_0x33d2cd){return _0x33d2cd[_0x2728('0x24')]()[_0x2728('0x25')](function(){var _0x5bfc60=_0x33d2cd[_0x2728('0x26')]({'plain':!![]});var _0x232495=_0x2728('0x27');return db['UserProfileResource'][_0x2728('0x24')]({'where':{'type':_0x232495,'resourceId':_0x5bfc60['id']}})[_0x2728('0x25')](function(){return _0x33d2cd;});})['then'](function(){_0xbfd495[_0x2728('0x1b')](0xcc)[_0x2728('0x1a')]();});}};}function handleEntityNotFound(_0x353078,_0x33da7a){return function(_0x4e3b8a){if(!_0x4e3b8a){_0x353078[_0x2728('0x28')](0x194);}return _0x4e3b8a;};}function handleError(_0x514bfe,_0x45f6fc){_0x45f6fc=_0x45f6fc||0x1f4;return function(_0x4d9de3){logger[_0x2728('0x29')](_0x4d9de3[_0x2728('0x2a')]);if(_0x4d9de3[_0x2728('0x2b')]){delete _0x4d9de3[_0x2728('0x2b')];}_0x514bfe[_0x2728('0x1b')](_0x45f6fc)[_0x2728('0x2c')](_0x4d9de3);};}exports[_0x2728('0x2d')]=function(_0x505902,_0x49d09a){var _0x1a6bc2={},_0x525fd5={},_0x383f31={'count':0x0,'rows':[]};var _0x29d8d1=_[_0x2728('0x2e')](db[_0x2728('0x2f')]['rawAttributes'],function(_0x5dabd7){return{'name':_0x5dabd7[_0x2728('0x30')],'type':_0x5dabd7[_0x2728('0x31')]['key']};});_0x525fd5['model']=_['map'](_0x29d8d1,'name');_0x525fd5['query']=_[_0x2728('0x32')](_0x505902[_0x2728('0x33')]);_0x525fd5[_0x2728('0x34')]=_['intersection'](_0x525fd5[_0x2728('0x35')],_0x525fd5[_0x2728('0x33')]);_0x1a6bc2['attributes']=_[_0x2728('0x36')](_0x525fd5['model'],qs[_0x2728('0x37')](_0x505902['query']['fields']));_0x1a6bc2[_0x2728('0x38')]=_0x1a6bc2['attributes'][_0x2728('0x39')]?_0x1a6bc2['attributes']:_0x525fd5[_0x2728('0x35')];if(!_0x505902[_0x2728('0x33')][_0x2728('0x3a')]('nolimit')){_0x1a6bc2[_0x2728('0x1f')]=qs[_0x2728('0x1f')](_0x505902['query'][_0x2728('0x1f')]);_0x1a6bc2[_0x2728('0x1e')]=qs['offset'](_0x505902[_0x2728('0x33')][_0x2728('0x1e')]);}_0x1a6bc2['order']=qs['sort'](_0x505902[_0x2728('0x33')]['sort']);_0x1a6bc2[_0x2728('0x3b')]=qs[_0x2728('0x34')](_[_0x2728('0x3c')](_0x505902[_0x2728('0x33')],_0x525fd5[_0x2728('0x34')]),_0x29d8d1);if(_0x505902[_0x2728('0x33')][_0x2728('0x3d')]){_0x1a6bc2[_0x2728('0x3b')]=_[_0x2728('0x3e')](_0x1a6bc2[_0x2728('0x3b')],{'$or':_[_0x2728('0x2e')](_0x29d8d1,function(_0x5d5881){if(_0x5d5881[_0x2728('0x31')]!==_0x2728('0x3f')){var _0x31f61f={};_0x31f61f[_0x5d5881['name']]={'$like':'%'+_0x505902[_0x2728('0x33')][_0x2728('0x3d')]+'%'};return _0x31f61f;}})});}_0x1a6bc2=_[_0x2728('0x3e')]({},_0x1a6bc2,_0x505902[_0x2728('0x40')]);var _0x59c533={'where':_0x1a6bc2['where']};return db[_0x2728('0x2f')][_0x2728('0x1d')](_0x59c533)['then'](function(_0x326757){_0x383f31[_0x2728('0x1d')]=_0x326757;if(_0x505902[_0x2728('0x33')]['includeAll']){_0x1a6bc2[_0x2728('0x41')]=[{'all':!![]}];}return db['Template'][_0x2728('0x42')](_0x1a6bc2);})[_0x2728('0x25')](function(_0x104eb7){_0x383f31['rows']=_0x104eb7;return _0x383f31;})[_0x2728('0x25')](respondWithFilteredResult(_0x49d09a,_0x1a6bc2))[_0x2728('0x43')](handleError(_0x49d09a,null));};exports[_0x2728('0x44')]=function(_0x535d8c,_0x39aa97){var _0x8f400d={'raw':!![],'where':{'id':_0x535d8c[_0x2728('0x45')]['id']}},_0x2e9cd0={};_0x2e9cd0[_0x2728('0x35')]=_[_0x2728('0x32')](db['Template'][_0x2728('0x46')]);_0x2e9cd0[_0x2728('0x33')]=_[_0x2728('0x32')](_0x535d8c['query']);_0x2e9cd0[_0x2728('0x34')]=_[_0x2728('0x36')](_0x2e9cd0[_0x2728('0x35')],_0x2e9cd0[_0x2728('0x33')]);_0x8f400d[_0x2728('0x38')]=_['intersection'](_0x2e9cd0[_0x2728('0x35')],qs[_0x2728('0x37')](_0x535d8c[_0x2728('0x33')][_0x2728('0x37')]));_0x8f400d['attributes']=_0x8f400d[_0x2728('0x38')][_0x2728('0x39')]?_0x8f400d[_0x2728('0x38')]:_0x2e9cd0[_0x2728('0x35')];if(_0x535d8c[_0x2728('0x33')]['includeAll']){_0x8f400d['include']=[{'all':!![]}];}_0x8f400d=_[_0x2728('0x3e')]({},_0x8f400d,_0x535d8c[_0x2728('0x40')]);return db['Template']['find'](_0x8f400d)[_0x2728('0x25')](handleEntityNotFound(_0x39aa97,null))[_0x2728('0x25')](respondWithResult(_0x39aa97,null))[_0x2728('0x43')](handleError(_0x39aa97,null));};exports[_0x2728('0x47')]=function(_0x339ded,_0x7c6635){return db[_0x2728('0x2f')][_0x2728('0x47')](_0x339ded[_0x2728('0x48')],{})['then'](function(_0x114efb){var _0x2927ed=_0x339ded['user'][_0x2728('0x26')]({'plain':!![]});if(!_0x2927ed)throw new Error(_0x2728('0x49'));if(_0x2927ed['role']==='user'){var _0x3a58a2=_0x114efb[_0x2728('0x26')]({'plain':!![]});var _0x593773=_0x2728('0x27');return db[_0x2728('0x4a')][_0x2728('0x4b')]({'where':{'name':_0x593773,'userProfileId':_0x2927ed[_0x2728('0x4c')]},'raw':!![]})[_0x2728('0x25')](function(_0x244e61){if(_0x244e61&&_0x244e61[_0x2728('0x4d')]===0x0){return db[_0x2728('0x4e')][_0x2728('0x47')]({'name':_0x3a58a2[_0x2728('0x2b')],'resourceId':_0x3a58a2['id'],'type':_0x244e61[_0x2728('0x2b')],'sectionId':_0x244e61['id']},{})['then'](function(){return _0x114efb;});}else{return _0x114efb;}})[_0x2728('0x43')](function(_0x4e416d){logger[_0x2728('0x29')](_0x2728('0x4f'),_0x4e416d);throw _0x4e416d;});}return _0x114efb;})[_0x2728('0x25')](respondWithResult(_0x7c6635,0xc9))['catch'](handleError(_0x7c6635,null));};exports[_0x2728('0x23')]=function(_0x56ebad,_0x39ee41){if(_0x56ebad['body']['id']){delete _0x56ebad['body']['id'];}return db['Template'][_0x2728('0x4b')]({'where':{'id':_0x56ebad['params']['id']}})['then'](handleEntityNotFound(_0x39ee41,null))[_0x2728('0x25')](saveUpdates(_0x56ebad[_0x2728('0x48')],null))[_0x2728('0x25')](respondWithResult(_0x39ee41,null))['catch'](handleError(_0x39ee41,null));};exports[_0x2728('0x24')]=function(_0x509d4f,_0xe15564){return db[_0x2728('0x2f')][_0x2728('0x4b')]({'where':{'id':_0x509d4f['params']['id']}})[_0x2728('0x25')](handleEntityNotFound(_0xe15564,null))[_0x2728('0x25')](removeEntity(_0xe15564,null))['catch'](handleError(_0xe15564,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 302ac8d..ec692ca 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 _0x95eb=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0x95eb,0x1cc));var _0xb95e=function(_0x3adf83,_0x41fd7e){_0x3adf83=_0x3adf83-0x0;var _0x4cb2be=_0x95eb[_0x3adf83];return _0x4cb2be;};'use strict';var _=require(_0xb95e('0x0'));var util=require(_0xb95e('0x1'));var logger=require(_0xb95e('0x2'))(_0xb95e('0x3'));var moment=require(_0xb95e('0x4'));var BPromise=require('bluebird');var rp=require(_0xb95e('0x5'));var fs=require('fs');var path=require(_0xb95e('0x6'));var rimraf=require(_0xb95e('0x7'));var config=require(_0xb95e('0x8'));var attributes=require(_0xb95e('0x9'));module[_0xb95e('0xa')]=function(_0x37fd7b,_0x2a95cc){return _0x37fd7b[_0xb95e('0xb')](_0xb95e('0xc'),attributes,{'tableName':_0xb95e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x207e=['define','Template','tools_templates','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x207e,0x1e7));var _0xe207=function(_0x21e022,_0xb2e734){_0x21e022=_0x21e022-0x0;var _0x4abc93=_0x207e[_0x21e022];return _0x4abc93;};'use strict';var _=require(_0xe207('0x0'));var util=require(_0xe207('0x1'));var logger=require(_0xe207('0x2'))('api');var moment=require(_0xe207('0x3'));var BPromise=require(_0xe207('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe207('0x5'));var rimraf=require('rimraf');var config=require(_0xe207('0x6'));var attributes=require('./template.attributes');module[_0xe207('0x7')]=function(_0x399cb4,_0x2abac3){return _0x399cb4[_0xe207('0x8')](_0xe207('0x9'),attributes,{'tableName':_0xe207('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index eb0955b..efcc267 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 _0x1378=['where','attributes','limit','include','map','model','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Template,\x20%s,\x20%s','GetTemplate','findAll','options'];(function(_0x5de7a5,_0x23948a){var _0x41e57b=function(_0x4b348e){while(--_0x4b348e){_0x5de7a5['push'](_0x5de7a5['shift']());}};_0x41e57b(++_0x23948a);}(_0x1378,0x11e));var _0x8137=function(_0x10d242,_0x1db5e0){_0x10d242=_0x10d242-0x0;var _0x5a2257=_0x1378[_0x10d242];return _0x5a2257;};'use strict';var _=require(_0x8137('0x0'));var util=require(_0x8137('0x1'));var moment=require(_0x8137('0x2'));var BPromise=require(_0x8137('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8137('0x4'));var db=require(_0x8137('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8137('0x6'))(_0x8137('0x7'));var config=require(_0x8137('0x8'));var jayson=require(_0x8137('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48fbc4,_0x3edb50,_0x38f0fd){return new BPromise(function(_0x5152dd,_0x553c1a){return client['request'](_0x48fbc4,_0x38f0fd)[_0x8137('0xa')](function(_0x427a48){logger[_0x8137('0xb')]('Template,\x20%s,\x20%s',_0x3edb50,'request\x20sent');logger['debug'](_0x8137('0xc'),_0x3edb50,_0x8137('0xd'),JSON[_0x8137('0xe')](_0x427a48));if(_0x427a48[_0x8137('0xf')]){if(_0x427a48[_0x8137('0xf')][_0x8137('0x10')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x3edb50,_0x427a48[_0x8137('0xf')][_0x8137('0x11')]);return _0x553c1a(_0x427a48['error']['message']);}logger['error']('Template,\x20%s,\x20%s',_0x3edb50,_0x427a48['error'][_0x8137('0x11')]);return _0x5152dd(_0x427a48['error']['message']);}else{logger[_0x8137('0xb')]('Template,\x20%s,\x20%s',_0x3edb50,_0x8137('0xd'));_0x5152dd(_0x427a48[_0x8137('0x12')]['message']);}})[_0x8137('0x13')](function(_0x42fa0e){logger[_0x8137('0xf')](_0x8137('0x14'),_0x3edb50,_0x42fa0e);_0x553c1a(_0x42fa0e);});});}exports[_0x8137('0x15')]=function(_0x21d47b){var _0x7436c8=this;return new Promise(function(_0x5648b1,_0x47b0f2){return db['Template'][_0x8137('0x16')]({'raw':_0x21d47b[_0x8137('0x17')]?_0x21d47b[_0x8137('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x21d47b[_0x8137('0x17')]?_0x21d47b[_0x8137('0x17')][_0x8137('0x18')]||null:null,'attributes':_0x21d47b['options']?_0x21d47b['options'][_0x8137('0x19')]||null:null,'limit':_0x21d47b[_0x8137('0x17')]?_0x21d47b[_0x8137('0x17')][_0x8137('0x1a')]||null:null,'include':_0x21d47b['options']?_0x21d47b[_0x8137('0x17')][_0x8137('0x1b')]?_[_0x8137('0x1c')](_0x21d47b[_0x8137('0x17')][_0x8137('0x1b')],function(_0x1d2a92){return{'model':db[_0x1d2a92['model']],'as':_0x1d2a92['as'],'attributes':_0x1d2a92[_0x8137('0x19')],'include':_0x1d2a92[_0x8137('0x1b')]?_[_0x8137('0x1c')](_0x1d2a92['include'],function(_0x28702f){return{'model':db[_0x28702f['model']],'as':_0x28702f['as'],'attributes':_0x28702f[_0x8137('0x19')],'include':_0x28702f[_0x8137('0x1b')]?_[_0x8137('0x1c')](_0x28702f[_0x8137('0x1b')],function(_0x59eb3f){return{'model':db[_0x59eb3f[_0x8137('0x1d')]],'as':_0x59eb3f['as'],'attributes':_0x59eb3f['attributes']};}):[]};}):[]};}):[]:[]})[_0x8137('0xa')](function(_0xae0983){logger[_0x8137('0xb')](_0x8137('0x15'),_0x21d47b);logger[_0x8137('0x1e')](_0x8137('0x15'),_0x21d47b,JSON['stringify'](_0xae0983));_0x5648b1(_0xae0983);})[_0x8137('0x13')](function(_0x3afa0e){logger['error'](_0x8137('0x15'),_0x3afa0e[_0x8137('0x11')],_0x21d47b);_0x47b0f2(_0x7436c8[_0x8137('0xf')](0x1f4,_0x3afa0e[_0x8137('0x11')]));});});}; \ No newline at end of file +var _0x14fa=['attributes','include','map','model','then','stringify','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetTemplate','Template','findAll','options','raw'];(function(_0x50f363,_0x492cab){var _0x6e0047=function(_0x4c9901){while(--_0x4c9901){_0x50f363['push'](_0x50f363['shift']());}};_0x6e0047(++_0x492cab);}(_0x14fa,0x11d));var _0xa14f=function(_0x4122b6,_0x452e47){_0x4122b6=_0x4122b6-0x0;var _0x293102=_0x14fa[_0x4122b6];return _0x293102;};'use strict';var _=require('lodash');var util=require(_0xa14f('0x0'));var moment=require('moment');var BPromise=require(_0xa14f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa14f('0x2'))['db'];var utils=require(_0xa14f('0x3'));var logger=require(_0xa14f('0x4'))(_0xa14f('0x5'));var config=require(_0xa14f('0x6'));var jayson=require(_0xa14f('0x7'));var client=jayson[_0xa14f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x559af7,_0x3fe630,_0xdee673){return new BPromise(function(_0x2d8c20,_0xb52d7d){return client[_0xa14f('0x9')](_0x559af7,_0xdee673)['then'](function(_0x52708d){logger['info'](_0xa14f('0xa'),_0x3fe630,_0xa14f('0xb'));logger[_0xa14f('0xc')](_0xa14f('0xd'),_0x3fe630,_0xa14f('0xb'),JSON['stringify'](_0x52708d));if(_0x52708d['error']){if(_0x52708d[_0xa14f('0xe')][_0xa14f('0xf')]===0x1f4){logger[_0xa14f('0xe')]('Template,\x20%s,\x20%s',_0x3fe630,_0x52708d[_0xa14f('0xe')][_0xa14f('0x10')]);return _0xb52d7d(_0x52708d[_0xa14f('0xe')][_0xa14f('0x10')]);}logger[_0xa14f('0xe')](_0xa14f('0xa'),_0x3fe630,_0x52708d[_0xa14f('0xe')][_0xa14f('0x10')]);return _0x2d8c20(_0x52708d['error'][_0xa14f('0x10')]);}else{logger[_0xa14f('0x11')](_0xa14f('0xa'),_0x3fe630,_0xa14f('0xb'));_0x2d8c20(_0x52708d[_0xa14f('0x12')][_0xa14f('0x10')]);}})[_0xa14f('0x13')](function(_0x4fbb7b){logger[_0xa14f('0xe')](_0xa14f('0xa'),_0x3fe630,_0x4fbb7b);_0xb52d7d(_0x4fbb7b);});});}exports[_0xa14f('0x14')]=function(_0x2804fe){var _0x4748bb=this;return new Promise(function(_0x1cef71,_0x485f8b){return db[_0xa14f('0x15')][_0xa14f('0x16')]({'raw':_0x2804fe[_0xa14f('0x17')]?_0x2804fe[_0xa14f('0x17')][_0xa14f('0x18')]===undefined?!![]:![]:!![],'where':_0x2804fe[_0xa14f('0x17')]?_0x2804fe[_0xa14f('0x17')]['where']||null:null,'attributes':_0x2804fe['options']?_0x2804fe[_0xa14f('0x17')][_0xa14f('0x19')]||null:null,'limit':_0x2804fe[_0xa14f('0x17')]?_0x2804fe[_0xa14f('0x17')]['limit']||null:null,'include':_0x2804fe['options']?_0x2804fe[_0xa14f('0x17')][_0xa14f('0x1a')]?_[_0xa14f('0x1b')](_0x2804fe[_0xa14f('0x17')][_0xa14f('0x1a')],function(_0x40ce68){return{'model':db[_0x40ce68[_0xa14f('0x1c')]],'as':_0x40ce68['as'],'attributes':_0x40ce68[_0xa14f('0x19')],'include':_0x40ce68[_0xa14f('0x1a')]?_[_0xa14f('0x1b')](_0x40ce68[_0xa14f('0x1a')],function(_0x45fde0){return{'model':db[_0x45fde0['model']],'as':_0x45fde0['as'],'attributes':_0x45fde0[_0xa14f('0x19')],'include':_0x45fde0[_0xa14f('0x1a')]?_[_0xa14f('0x1b')](_0x45fde0[_0xa14f('0x1a')],function(_0x46ea3e){return{'model':db[_0x46ea3e[_0xa14f('0x1c')]],'as':_0x46ea3e['as'],'attributes':_0x46ea3e['attributes']};}):[]};}):[]};}):[]:[]})[_0xa14f('0x1d')](function(_0x1c268a){logger[_0xa14f('0x11')](_0xa14f('0x14'),_0x2804fe);logger[_0xa14f('0xc')](_0xa14f('0x14'),_0x2804fe,JSON[_0xa14f('0x1e')](_0x1c268a));_0x1cef71(_0x1c268a);})[_0xa14f('0x13')](function(_0x4cddff){logger[_0xa14f('0xe')]('GetTemplate',_0x4cddff[_0xa14f('0x10')],_0x2804fe);_0x485f8b(_0x4748bb[_0xa14f('0xe')](0x1f4,_0x4cddff[_0xa14f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 97efff8..3bfec9b 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 _0x8782=['../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','getActions','post','addAllCondition','/:id/actions','addAction','/:id','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x420f45,_0x82ba43){var _0x115f02=function(_0x1f2638){while(--_0x1f2638){_0x420f45['push'](_0x420f45['shift']());}};_0x115f02(++_0x82ba43);}(_0x8782,0x16b));var _0x2878=function(_0x8af78f,_0x496b38){_0x8af78f=_0x8af78f-0x0;var _0x119bec=_0x8782[_0x8af78f];return _0x119bec;};'use strict';var multer=require('multer');var util=require(_0x2878('0x0'));var path=require(_0x2878('0x1'));var timeout=require(_0x2878('0x2'));var express=require(_0x2878('0x3'));var router=express[_0x2878('0x4')]();var auth=require(_0x2878('0x5'));var interaction=require(_0x2878('0x6'));var config=require('../../config/environment');var controller=require(_0x2878('0x7'));router[_0x2878('0x8')]('/',auth[_0x2878('0x9')](),controller[_0x2878('0xa')]);router[_0x2878('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2878('0xb')]);router[_0x2878('0x8')](_0x2878('0xc'),auth[_0x2878('0x9')](),controller['getAllConditions']);router[_0x2878('0x8')](_0x2878('0xd'),auth['isAuthenticated'](),controller[_0x2878('0xe')]);router[_0x2878('0x8')]('/:id/actions',auth[_0x2878('0x9')](),controller[_0x2878('0xf')]);router['post']('/',auth[_0x2878('0x9')](),controller['create']);router[_0x2878('0x10')]('/:id/all_conditions',auth[_0x2878('0x9')](),controller[_0x2878('0x11')]);router[_0x2878('0x10')](_0x2878('0xd'),auth[_0x2878('0x9')](),controller['addAnyCondition']);router['post'](_0x2878('0x12'),auth['isAuthenticated'](),controller[_0x2878('0x13')]);router['put'](_0x2878('0x14'),auth[_0x2878('0x9')](),controller['update']);router[_0x2878('0x15')](_0x2878('0x14'),auth[_0x2878('0x9')](),controller['destroy']);module[_0x2878('0x16')]=router; \ No newline at end of file +var _0x87d1=['../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','/:id','show','get','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service'];(function(_0x30f59d,_0xccf80e){var _0x35afc6=function(_0x7affdb){while(--_0x7affdb){_0x30f59d['push'](_0x30f59d['shift']());}};_0x35afc6(++_0xccf80e);}(_0x87d1,0xb2));var _0x187d=function(_0x4c8073,_0x2ae9a9){_0x4c8073=_0x4c8073-0x0;var _0x3a62ac=_0x87d1[_0x4c8073];return _0x3a62ac;};'use strict';var multer=require('multer');var util=require(_0x187d('0x0'));var path=require('path');var timeout=require(_0x187d('0x1'));var express=require(_0x187d('0x2'));var router=express['Router']();var auth=require(_0x187d('0x3'));var interaction=require(_0x187d('0x4'));var config=require(_0x187d('0x5'));var controller=require(_0x187d('0x6'));router['get']('/',auth[_0x187d('0x7')](),controller['index']);router['get'](_0x187d('0x8'),auth[_0x187d('0x7')](),controller[_0x187d('0x9')]);router[_0x187d('0xa')](_0x187d('0xb'),auth[_0x187d('0x7')](),controller['getAllConditions']);router['get']('/:id/any_conditions',auth[_0x187d('0x7')](),controller[_0x187d('0xc')]);router['get'](_0x187d('0xd'),auth[_0x187d('0x7')](),controller[_0x187d('0xe')]);router[_0x187d('0xf')]('/',auth[_0x187d('0x7')](),controller[_0x187d('0x10')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x187d('0x11')]);router[_0x187d('0xf')](_0x187d('0x12'),auth[_0x187d('0x7')](),controller[_0x187d('0x13')]);router[_0x187d('0xf')](_0x187d('0xd'),auth['isAuthenticated'](),controller[_0x187d('0x14')]);router[_0x187d('0x15')]('/:id',auth[_0x187d('0x7')](),controller[_0x187d('0x16')]);router[_0x187d('0x17')](_0x187d('0x8'),auth[_0x187d('0x7')](),controller[_0x187d('0x18')]);module[_0x187d('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index aab1d1a..203af10 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 _0x7c92=['STRING','sequelize','exports'];(function(_0x58d6c2,_0x205acb){var _0x5a192e=function(_0xc0c251){while(--_0xc0c251){_0x58d6c2['push'](_0x58d6c2['shift']());}};_0x5a192e(++_0x205acb);}(_0x7c92,0x121));var _0x27c9=function(_0x441a79,_0x18187b){_0x441a79=_0x441a79-0x0;var _0x445d98=_0x7c92[_0x441a79];return _0x445d98;};'use strict';var Sequelize=require(_0x27c9('0x0'));module[_0x27c9('0x1')]={'name':{'type':Sequelize[_0x27c9('0x2')]},'channel':{'type':Sequelize[_0x27c9('0x2')]},'description':{'type':Sequelize[_0x27c9('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2079=['exports','STRING','BOOLEAN'];(function(_0x48d189,_0x1cf3aa){var _0x3ce62e=function(_0x5dd206){while(--_0x5dd206){_0x48d189['push'](_0x48d189['shift']());}};_0x3ce62e(++_0x1cf3aa);}(_0x2079,0x198));var _0x9207=function(_0x235054,_0x4d0ed0){_0x235054=_0x235054-0x0;var _0x463470=_0x2079[_0x235054];return _0x463470;};'use strict';var Sequelize=require('sequelize');module[_0x9207('0x0')]={'name':{'type':Sequelize[_0x9207('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9207('0x1')]},'status':{'type':Sequelize[_0x9207('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 45e577c..2f54ae2 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 _0xf88f=['UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','pick','getAnyConditions','addAction','Action','getActions','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Triggers','sendStatus','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','show','params','include','find','catch','create','user','userProfileId','autoAssociation'];(function(_0x2e7191,_0x18238d){var _0x19d688=function(_0x279613){while(--_0x279613){_0x2e7191['push'](_0x2e7191['shift']());}};_0x19d688(++_0x18238d);}(_0xf88f,0xc4));var _0xff88=function(_0x3926c5,_0x189b50){_0x3926c5=_0x3926c5-0x0;var _0x14a6c9=_0xf88f[_0x3926c5];return _0x14a6c9;};'use strict';var pdf=require(_0xff88('0x0'));var emlformat=require(_0xff88('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xff88('0x2'));var moment=require(_0xff88('0x3'));var BPromise=require(_0xff88('0x4'));var Mustache=require(_0xff88('0x5'));var util=require(_0xff88('0x6'));var path=require(_0xff88('0x7'));var sox=require(_0xff88('0x8'));var csv=require('to-csv');var ejs=require(_0xff88('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xff88('0xa'));var jsforce=require(_0xff88('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xff88('0xc'));var querystring=require(_0xff88('0xd'));var Papa=require(_0xff88('0xe'));var Redis=require('ioredis');var authService=require(_0xff88('0xf'));var qs=require(_0xff88('0x10'));var as=require(_0xff88('0x11'));var hardwareService=require(_0xff88('0x12'));var logger=require(_0xff88('0x13'))('api');var utils=require(_0xff88('0x14'));var config=require(_0xff88('0x15'));var db=require(_0xff88('0x16'))['db'];function respondWithStatusCode(_0x183c30,_0x367e01){_0x367e01=_0x367e01||0xcc;return function(_0x33658c){if(_0x33658c){return _0x183c30['sendStatus'](_0x367e01);}return _0x183c30['status'](_0x367e01)[_0xff88('0x17')]();};}function respondWithResult(_0x32081d,_0x5918f0){_0x5918f0=_0x5918f0||0xc8;return function(_0x3d653b){if(_0x3d653b){return _0x32081d[_0xff88('0x18')](_0x5918f0)['json'](_0x3d653b);}};}function respondWithFilteredResult(_0x27ca79,_0x1d15bd){return function(_0xe16090){if(_0xe16090){var _0x2b7775=_0xe16090[_0xff88('0x19')],_0x406b42=_0x1d15bd[_0xff88('0x1a')],_0x548b3e=_0x1d15bd[_0xff88('0x1a')]+_0x1d15bd['limit'],_0x1dd1e4;if(_0x548b3e>=_0x2b7775){_0x548b3e=_0x2b7775;_0x1dd1e4=0xc8;}else{_0x1dd1e4=0xce;}_0x27ca79[_0xff88('0x18')](_0x1dd1e4);return _0x27ca79[_0xff88('0x1b')](_0xff88('0x1c'),_0x406b42+'-'+_0x548b3e+'/'+_0x2b7775)[_0xff88('0x1d')](_0xe16090);}return null;};}function patchUpdates(_0x1f8e94){return function(_0x1d012a){try{jsonpatch[_0xff88('0x1e')](_0x1d012a,_0x1f8e94,!![]);}catch(_0x519d86){return BPromise[_0xff88('0x1f')](_0x519d86);}return _0x1d012a[_0xff88('0x20')]();};}function saveUpdates(_0x49b8ec,_0xaf73f1){return function(_0x1d3a83){if(_0x1d3a83){return _0x1d3a83[_0xff88('0x21')](_0x49b8ec)[_0xff88('0x22')](function(_0x70593a){return _0x70593a;});}return null;};}function removeEntity(_0x3c7f72,_0x4caf8c){return function(_0x2ac223){if(_0x2ac223){return _0x2ac223[_0xff88('0x23')]()['then'](function(){var _0x4b8ffe=_0x2ac223[_0xff88('0x24')]({'plain':!![]});var _0x304355=_0xff88('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x304355,'resourceId':_0x4b8ffe['id']}})[_0xff88('0x22')](function(){return _0x2ac223;});})[_0xff88('0x22')](function(){_0x3c7f72[_0xff88('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x137881,_0x17104c){return function(_0x2c3167){if(!_0x2c3167){_0x137881[_0xff88('0x26')](0x194);}return _0x2c3167;};}function handleError(_0x4047ad,_0x5cbd84){_0x5cbd84=_0x5cbd84||0x1f4;return function(_0x30dd78){logger[_0xff88('0x27')](_0x30dd78[_0xff88('0x28')]);if(_0x30dd78['name']){delete _0x30dd78[_0xff88('0x29')];}_0x4047ad[_0xff88('0x18')](_0x5cbd84)[_0xff88('0x2a')](_0x30dd78);};}exports[_0xff88('0x2b')]=function(_0x4229d5,_0x240c02){var _0x1d70b7={},_0x5e7902={},_0x531ee3={'count':0x0,'rows':[]};var _0x3d9a6d=_[_0xff88('0x2c')](db[_0xff88('0x2d')][_0xff88('0x2e')],function(_0x4a6984){return{'name':_0x4a6984[_0xff88('0x2f')],'type':_0x4a6984[_0xff88('0x30')]['key']};});_0x5e7902[_0xff88('0x31')]=_['map'](_0x3d9a6d,_0xff88('0x29'));_0x5e7902[_0xff88('0x32')]=_[_0xff88('0x33')](_0x4229d5[_0xff88('0x32')]);_0x5e7902['filters']=_['intersection'](_0x5e7902[_0xff88('0x31')],_0x5e7902[_0xff88('0x32')]);_0x1d70b7[_0xff88('0x34')]=_[_0xff88('0x35')](_0x5e7902['model'],qs[_0xff88('0x36')](_0x4229d5[_0xff88('0x32')][_0xff88('0x36')]));_0x1d70b7[_0xff88('0x34')]=_0x1d70b7[_0xff88('0x34')][_0xff88('0x37')]?_0x1d70b7[_0xff88('0x34')]:_0x5e7902[_0xff88('0x31')];if(!_0x4229d5['query'][_0xff88('0x38')](_0xff88('0x39'))){_0x1d70b7['limit']=qs[_0xff88('0x3a')](_0x4229d5['query'][_0xff88('0x3a')]);_0x1d70b7[_0xff88('0x1a')]=qs['offset'](_0x4229d5['query'][_0xff88('0x1a')]);}_0x1d70b7[_0xff88('0x3b')]=qs[_0xff88('0x3c')](_0x4229d5[_0xff88('0x32')][_0xff88('0x3c')]);_0x1d70b7[_0xff88('0x3d')]=qs[_0xff88('0x3e')](_['pick'](_0x4229d5[_0xff88('0x32')],_0x5e7902[_0xff88('0x3e')]),_0x3d9a6d);if(_0x4229d5[_0xff88('0x32')][_0xff88('0x3f')]){_0x1d70b7[_0xff88('0x3d')]=_[_0xff88('0x40')](_0x1d70b7[_0xff88('0x3d')],{'$or':_[_0xff88('0x2c')](_0x3d9a6d,function(_0x75f661){if(_0x75f661[_0xff88('0x30')]!==_0xff88('0x41')){var _0x304737={};_0x304737[_0x75f661[_0xff88('0x29')]]={'$like':'%'+_0x4229d5[_0xff88('0x32')][_0xff88('0x3f')]+'%'};return _0x304737;}})});}_0x1d70b7=_['merge']({},_0x1d70b7,_0x4229d5[_0xff88('0x42')]);var _0x76da85={'where':_0x1d70b7[_0xff88('0x3d')]};return db[_0xff88('0x2d')][_0xff88('0x19')](_0x76da85)['then'](function(_0xe5aa2b){_0x531ee3['count']=_0xe5aa2b;if(_0x4229d5['query'][_0xff88('0x43')]){_0x1d70b7['include']=[{'all':!![]}];}return db[_0xff88('0x2d')]['findAll'](_0x1d70b7);})['then'](function(_0x695da6){_0x531ee3['rows']=_0x695da6;return _0x531ee3;})[_0xff88('0x22')](respondWithFilteredResult(_0x240c02,_0x1d70b7))['catch'](handleError(_0x240c02,null));};exports[_0xff88('0x44')]=function(_0x45b21f,_0xbd28){var _0x51ed27={'raw':![],'where':{'id':_0x45b21f[_0xff88('0x45')]['id']}},_0x2536a8={};_0x2536a8[_0xff88('0x31')]=_[_0xff88('0x33')](db[_0xff88('0x2d')][_0xff88('0x2e')]);_0x2536a8[_0xff88('0x32')]=_[_0xff88('0x33')](_0x45b21f[_0xff88('0x32')]);_0x2536a8[_0xff88('0x3e')]=_[_0xff88('0x35')](_0x2536a8[_0xff88('0x31')],_0x2536a8[_0xff88('0x32')]);_0x51ed27[_0xff88('0x34')]=_[_0xff88('0x35')](_0x2536a8[_0xff88('0x31')],qs['fields'](_0x45b21f[_0xff88('0x32')][_0xff88('0x36')]));_0x51ed27[_0xff88('0x34')]=_0x51ed27[_0xff88('0x34')][_0xff88('0x37')]?_0x51ed27[_0xff88('0x34')]:_0x2536a8[_0xff88('0x31')];if(_0x45b21f[_0xff88('0x32')][_0xff88('0x43')]){_0x51ed27[_0xff88('0x46')]=[{'all':!![]}];}_0x51ed27=_[_0xff88('0x40')]({},_0x51ed27,_0x45b21f[_0xff88('0x42')]);return db['Trigger'][_0xff88('0x47')](_0x51ed27)[_0xff88('0x22')](handleEntityNotFound(_0xbd28,null))[_0xff88('0x22')](respondWithResult(_0xbd28,null))[_0xff88('0x48')](handleError(_0xbd28,null));};exports['create']=function(_0x39c0e2,_0x90ebe7){return db[_0xff88('0x2d')][_0xff88('0x49')](_0x39c0e2['body'],{})[_0xff88('0x22')](function(_0x30fe03){var _0x5442ab=_0x39c0e2[_0xff88('0x4a')][_0xff88('0x24')]({'plain':!![]});if(!_0x5442ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5442ab['role']===_0xff88('0x4a')){var _0x2b032b=_0x30fe03[_0xff88('0x24')]({'plain':!![]});var _0xdb0385=_0xff88('0x25');return db['UserProfileSection'][_0xff88('0x47')]({'where':{'name':_0xdb0385,'userProfileId':_0x5442ab[_0xff88('0x4b')]},'raw':!![]})[_0xff88('0x22')](function(_0x341ce1){if(_0x341ce1&&_0x341ce1[_0xff88('0x4c')]===0x0){return db[_0xff88('0x4d')][_0xff88('0x49')]({'name':_0x2b032b[_0xff88('0x29')],'resourceId':_0x2b032b['id'],'type':_0x341ce1[_0xff88('0x29')],'sectionId':_0x341ce1['id']},{})[_0xff88('0x22')](function(){return _0x30fe03;});}else{return _0x30fe03;}})[_0xff88('0x48')](function(_0x2560a2){logger['error'](_0xff88('0x4e'),_0x2560a2);throw _0x2560a2;});}return _0x30fe03;})['then'](respondWithResult(_0x90ebe7,0xc9))['catch'](handleError(_0x90ebe7,null));};exports[_0xff88('0x21')]=function(_0x84a06f,_0x1ee835){if(_0x84a06f[_0xff88('0x4f')]['id']){delete _0x84a06f[_0xff88('0x4f')]['id'];}return db[_0xff88('0x2d')][_0xff88('0x47')]({'where':{'id':_0x84a06f[_0xff88('0x45')]['id']}})[_0xff88('0x22')](handleEntityNotFound(_0x1ee835,null))[_0xff88('0x22')](saveUpdates(_0x84a06f['body'],null))['then'](respondWithResult(_0x1ee835,null))[_0xff88('0x48')](handleError(_0x1ee835,null));};exports[_0xff88('0x23')]=function(_0xad2f53,_0xf57c85){return db['Trigger'][_0xff88('0x47')]({'where':{'id':_0xad2f53[_0xff88('0x45')]['id']}})[_0xff88('0x22')](handleEntityNotFound(_0xf57c85,null))[_0xff88('0x22')](removeEntity(_0xf57c85,null))[_0xff88('0x48')](handleError(_0xf57c85,null));};exports[_0xff88('0x50')]=function(_0x101a78,_0x4f405d,_0x3d6505){if(_0x101a78['body']['id']){delete _0x101a78[_0xff88('0x4f')]['id'];}return db[_0xff88('0x2d')][_0xff88('0x47')]({'where':{'id':_0x101a78[_0xff88('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f405d,null))[_0xff88('0x22')](function(_0x5c3cc8){if(_0x5c3cc8){_0x101a78[_0xff88('0x4f')]['TriggerAllId']=_0x5c3cc8['id'];return db['Condition'][_0xff88('0x49')](_0x101a78[_0xff88('0x4f')]);}})[_0xff88('0x22')](respondWithResult(_0x4f405d,null))[_0xff88('0x48')](handleError(_0x4f405d,null));};exports[_0xff88('0x51')]=function(_0x42decb,_0x4a60e3,_0x525120){if(_0x42decb['body']['id']){delete _0x42decb[_0xff88('0x4f')]['id'];}return db['Trigger']['find']({'where':{'id':_0x42decb[_0xff88('0x45')]['id']}})[_0xff88('0x22')](handleEntityNotFound(_0x4a60e3,null))['then'](function(_0x42ce91){if(_0x42ce91){_0x42decb[_0xff88('0x4f')][_0xff88('0x52')]=_0x42ce91['id'];return db[_0xff88('0x53')][_0xff88('0x49')](_0x42decb[_0xff88('0x4f')]);}})[_0xff88('0x22')](respondWithResult(_0x4a60e3,null))[_0xff88('0x48')](handleError(_0x4a60e3,null));};exports[_0xff88('0x54')]=function(_0xa32522,_0x26632d,_0x50b938){var _0x16c849={};var _0x5d405c={};var _0x45afeb;var _0x48514a;return db[_0xff88('0x2d')][_0xff88('0x55')]({'where':{'id':_0xa32522[_0xff88('0x45')]['id']}})['then'](handleEntityNotFound(_0x26632d,null))[_0xff88('0x22')](function(_0x3fc9fe){if(_0x3fc9fe){_0x45afeb=_0x3fc9fe;_0x5d405c[_0xff88('0x31')]=_[_0xff88('0x33')](db['Condition'][_0xff88('0x2e')]);_0x5d405c[_0xff88('0x32')]=_[_0xff88('0x33')](_0xa32522[_0xff88('0x32')]);_0x5d405c[_0xff88('0x3e')]=_['intersection'](_0x5d405c[_0xff88('0x31')],_0x5d405c[_0xff88('0x32')]);_0x16c849['attributes']=_[_0xff88('0x35')](_0x5d405c[_0xff88('0x31')],qs[_0xff88('0x36')](_0xa32522[_0xff88('0x32')][_0xff88('0x36')]));_0x16c849['attributes']=_0x16c849['attributes'][_0xff88('0x37')]?_0x16c849[_0xff88('0x34')]:_0x5d405c[_0xff88('0x31')];_0x16c849[_0xff88('0x3b')]=qs[_0xff88('0x3c')](_0xa32522['query'][_0xff88('0x3c')]);_0x16c849[_0xff88('0x3d')]=qs[_0xff88('0x3e')](_[_0xff88('0x56')](_0xa32522[_0xff88('0x32')],_0x5d405c[_0xff88('0x3e')]));if(_0xa32522[_0xff88('0x32')]['filter']){_0x16c849[_0xff88('0x3d')]=_[_0xff88('0x40')](_0x16c849['where'],{'$or':_[_0xff88('0x2c')](_0x16c849[_0xff88('0x34')],function(_0x4b36a8){var _0x114e81={};_0x114e81[_0x4b36a8]={'$like':'%'+_0xa32522[_0xff88('0x32')][_0xff88('0x3f')]+'%'};return _0x114e81;})});}_0x16c849=_[_0xff88('0x40')]({},_0x16c849,_0xa32522[_0xff88('0x42')]);return _0x45afeb[_0xff88('0x54')](_0x16c849);}})[_0xff88('0x22')](function(_0x4469d6){if(_0x4469d6){_0x48514a=_0x4469d6['length'];if(!_0xa32522[_0xff88('0x32')][_0xff88('0x38')](_0xff88('0x39'))){_0x16c849['limit']=qs[_0xff88('0x3a')](_0xa32522[_0xff88('0x32')][_0xff88('0x3a')]);_0x16c849[_0xff88('0x1a')]=qs['offset'](_0xa32522[_0xff88('0x32')][_0xff88('0x1a')]);}return _0x45afeb[_0xff88('0x54')](_0x16c849);}})['then'](function(_0x1ca4b1){if(_0x1ca4b1){return _0x1ca4b1?{'count':_0x48514a,'rows':_0x1ca4b1}:null;}})['then'](respondWithResult(_0x26632d,null))[_0xff88('0x48')](handleError(_0x26632d,null));};exports['getAnyConditions']=function(_0x20f89e,_0x5ad8c8,_0x222831){var _0x18e808={};var _0x206f85={};var _0x35cbb4;var _0x5e6ccb;return db[_0xff88('0x2d')]['findOne']({'where':{'id':_0x20f89e[_0xff88('0x45')]['id']}})[_0xff88('0x22')](handleEntityNotFound(_0x5ad8c8,null))['then'](function(_0x1aeed7){if(_0x1aeed7){_0x35cbb4=_0x1aeed7;_0x206f85[_0xff88('0x31')]=_[_0xff88('0x33')](db[_0xff88('0x53')][_0xff88('0x2e')]);_0x206f85['query']=_[_0xff88('0x33')](_0x20f89e[_0xff88('0x32')]);_0x206f85['filters']=_[_0xff88('0x35')](_0x206f85[_0xff88('0x31')],_0x206f85[_0xff88('0x32')]);_0x18e808[_0xff88('0x34')]=_[_0xff88('0x35')](_0x206f85[_0xff88('0x31')],qs[_0xff88('0x36')](_0x20f89e[_0xff88('0x32')][_0xff88('0x36')]));_0x18e808['attributes']=_0x18e808[_0xff88('0x34')][_0xff88('0x37')]?_0x18e808[_0xff88('0x34')]:_0x206f85[_0xff88('0x31')];_0x18e808['order']=qs[_0xff88('0x3c')](_0x20f89e[_0xff88('0x32')][_0xff88('0x3c')]);_0x18e808[_0xff88('0x3d')]=qs[_0xff88('0x3e')](_[_0xff88('0x56')](_0x20f89e[_0xff88('0x32')],_0x206f85[_0xff88('0x3e')]));if(_0x20f89e[_0xff88('0x32')][_0xff88('0x3f')]){_0x18e808['where']=_[_0xff88('0x40')](_0x18e808['where'],{'$or':_[_0xff88('0x2c')](_0x18e808[_0xff88('0x34')],function(_0x3d2a07){var _0x3676e6={};_0x3676e6[_0x3d2a07]={'$like':'%'+_0x20f89e[_0xff88('0x32')]['filter']+'%'};return _0x3676e6;})});}_0x18e808=_[_0xff88('0x40')]({},_0x18e808,_0x20f89e['options']);return _0x35cbb4[_0xff88('0x57')](_0x18e808);}})[_0xff88('0x22')](function(_0x15c964){if(_0x15c964){_0x5e6ccb=_0x15c964['length'];if(!_0x20f89e['query'][_0xff88('0x38')](_0xff88('0x39'))){_0x18e808['limit']=qs[_0xff88('0x3a')](_0x20f89e[_0xff88('0x32')][_0xff88('0x3a')]);_0x18e808['offset']=qs[_0xff88('0x1a')](_0x20f89e[_0xff88('0x32')][_0xff88('0x1a')]);}return _0x35cbb4[_0xff88('0x57')](_0x18e808);}})[_0xff88('0x22')](function(_0x3b4859){if(_0x3b4859){return _0x3b4859?{'count':_0x5e6ccb,'rows':_0x3b4859}:null;}})[_0xff88('0x22')](respondWithResult(_0x5ad8c8,null))[_0xff88('0x48')](handleError(_0x5ad8c8,null));};exports[_0xff88('0x58')]=function(_0x593d02,_0x5182f3,_0x7d14f8){if(_0x593d02[_0xff88('0x4f')]['id']){delete _0x593d02[_0xff88('0x4f')]['id'];}return db[_0xff88('0x2d')][_0xff88('0x47')]({'where':{'id':_0x593d02[_0xff88('0x45')]['id']}})[_0xff88('0x22')](handleEntityNotFound(_0x5182f3,null))[_0xff88('0x22')](function(_0x4c9065){if(_0x4c9065){_0x593d02['body']['TriggerId']=_0x4c9065['id'];return db[_0xff88('0x59')][_0xff88('0x49')](_0x593d02['body']);}})[_0xff88('0x22')](respondWithResult(_0x5182f3,null))[_0xff88('0x48')](handleError(_0x5182f3,null));};exports[_0xff88('0x5a')]=function(_0x1517d4,_0x10ca1,_0x2690ed){var _0x185d62={};var _0x13944a={};var _0x419ff3;var _0x36af3e;return db[_0xff88('0x2d')]['findOne']({'where':{'id':_0x1517d4[_0xff88('0x45')]['id']}})[_0xff88('0x22')](handleEntityNotFound(_0x10ca1,null))['then'](function(_0x1c83a9){if(_0x1c83a9){_0x419ff3=_0x1c83a9;_0x13944a[_0xff88('0x31')]=_[_0xff88('0x33')](db[_0xff88('0x59')][_0xff88('0x2e')]);_0x13944a[_0xff88('0x32')]=_[_0xff88('0x33')](_0x1517d4[_0xff88('0x32')]);_0x13944a[_0xff88('0x3e')]=_[_0xff88('0x35')](_0x13944a[_0xff88('0x31')],_0x13944a['query']);_0x185d62[_0xff88('0x34')]=_[_0xff88('0x35')](_0x13944a[_0xff88('0x31')],qs['fields'](_0x1517d4[_0xff88('0x32')][_0xff88('0x36')]));_0x185d62[_0xff88('0x34')]=_0x185d62[_0xff88('0x34')][_0xff88('0x37')]?_0x185d62['attributes']:_0x13944a[_0xff88('0x31')];_0x185d62[_0xff88('0x3b')]=qs[_0xff88('0x3c')](_0x1517d4[_0xff88('0x32')][_0xff88('0x3c')]);_0x185d62[_0xff88('0x3d')]=qs['filters'](_[_0xff88('0x56')](_0x1517d4[_0xff88('0x32')],_0x13944a[_0xff88('0x3e')]));if(_0x1517d4[_0xff88('0x32')][_0xff88('0x3f')]){_0x185d62[_0xff88('0x3d')]=_[_0xff88('0x40')](_0x185d62[_0xff88('0x3d')],{'$or':_[_0xff88('0x2c')](_0x185d62['attributes'],function(_0x1155f4){var _0x57296f={};_0x57296f[_0x1155f4]={'$like':'%'+_0x1517d4[_0xff88('0x32')][_0xff88('0x3f')]+'%'};return _0x57296f;})});}_0x185d62=_[_0xff88('0x40')]({},_0x185d62,_0x1517d4[_0xff88('0x42')]);return _0x419ff3[_0xff88('0x5a')](_0x185d62);}})[_0xff88('0x22')](function(_0x1231c6){if(_0x1231c6){_0x36af3e=_0x1231c6[_0xff88('0x37')];if(!_0x1517d4['query']['hasOwnProperty']('nolimit')){_0x185d62[_0xff88('0x3a')]=qs[_0xff88('0x3a')](_0x1517d4['query'][_0xff88('0x3a')]);_0x185d62[_0xff88('0x1a')]=qs[_0xff88('0x1a')](_0x1517d4[_0xff88('0x32')][_0xff88('0x1a')]);}return _0x419ff3[_0xff88('0x5a')](_0x185d62);}})[_0xff88('0x22')](function(_0x53f7c7){if(_0x53f7c7){return _0x53f7c7?{'count':_0x36af3e,'rows':_0x53f7c7}:null;}})[_0xff88('0x22')](respondWithResult(_0x10ca1,null))['catch'](handleError(_0x10ca1,null));}; \ No newline at end of file +var _0x937f=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','update','then','destroy','get','Triggers','UserProfileResource','error','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','role','user'];(function(_0x17cf11,_0x365d9b){var _0x3ce625=function(_0x282e07){while(--_0x282e07){_0x17cf11['push'](_0x17cf11['shift']());}};_0x3ce625(++_0x365d9b);}(_0x937f,0x179));var _0xf937=function(_0x3030a9,_0x3e7be2){_0x3030a9=_0x3030a9-0x0;var _0x5e6b29=_0x937f[_0x3030a9];return _0x5e6b29;};'use strict';var pdf=require(_0xf937('0x0'));var emlformat=require(_0xf937('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf937('0x2'));var jsonpatch=require(_0xf937('0x3'));var rp=require(_0xf937('0x4'));var moment=require(_0xf937('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf937('0x6'));var util=require(_0xf937('0x7'));var path=require(_0xf937('0x8'));var sox=require(_0xf937('0x9'));var csv=require(_0xf937('0xa'));var ejs=require(_0xf937('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf937('0xc'));var crypto=require(_0xf937('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf937('0xe'));var toCsv=require(_0xf937('0xa'));var querystring=require(_0xf937('0xf'));var Papa=require(_0xf937('0x10'));var Redis=require(_0xf937('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf937('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf937('0x13'));var logger=require('../../config/logger')(_0xf937('0x14'));var utils=require('../../config/utils');var config=require(_0xf937('0x15'));var db=require(_0xf937('0x16'))['db'];function respondWithStatusCode(_0x27d845,_0x57f664){_0x57f664=_0x57f664||0xcc;return function(_0x570af5){if(_0x570af5){return _0x27d845[_0xf937('0x17')](_0x57f664);}return _0x27d845[_0xf937('0x18')](_0x57f664)['end']();};}function respondWithResult(_0x311d8f,_0x18be40){_0x18be40=_0x18be40||0xc8;return function(_0x12486f){if(_0x12486f){return _0x311d8f['status'](_0x18be40)[_0xf937('0x19')](_0x12486f);}};}function respondWithFilteredResult(_0x166e99,_0x36c8e2){return function(_0x20a609){if(_0x20a609){var _0x3dca1a=_0x20a609[_0xf937('0x1a')],_0x106fe1=_0x36c8e2[_0xf937('0x1b')],_0x403a46=_0x36c8e2[_0xf937('0x1b')]+_0x36c8e2[_0xf937('0x1c')],_0x3d675b;if(_0x403a46>=_0x3dca1a){_0x403a46=_0x3dca1a;_0x3d675b=0xc8;}else{_0x3d675b=0xce;}_0x166e99[_0xf937('0x18')](_0x3d675b);return _0x166e99[_0xf937('0x1d')]('Content-Range',_0x106fe1+'-'+_0x403a46+'/'+_0x3dca1a)['json'](_0x20a609);}return null;};}function patchUpdates(_0x3f4234){return function(_0x136a64){try{jsonpatch['apply'](_0x136a64,_0x3f4234,!![]);}catch(_0x5e98e0){return BPromise['reject'](_0x5e98e0);}return _0x136a64['save']();};}function saveUpdates(_0x513958,_0x14b88e){return function(_0x43d852){if(_0x43d852){return _0x43d852[_0xf937('0x1e')](_0x513958)[_0xf937('0x1f')](function(_0x535e6c){return _0x535e6c;});}return null;};}function removeEntity(_0x26c4f3,_0x438a57){return function(_0x479411){if(_0x479411){return _0x479411[_0xf937('0x20')]()[_0xf937('0x1f')](function(){var _0x4f62f0=_0x479411[_0xf937('0x21')]({'plain':!![]});var _0x1698dd=_0xf937('0x22');return db[_0xf937('0x23')][_0xf937('0x20')]({'where':{'type':_0x1698dd,'resourceId':_0x4f62f0['id']}})[_0xf937('0x1f')](function(){return _0x479411;});})[_0xf937('0x1f')](function(){_0x26c4f3[_0xf937('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14066d,_0x5689f5){return function(_0x3d5d0b){if(!_0x3d5d0b){_0x14066d['sendStatus'](0x194);}return _0x3d5d0b;};}function handleError(_0x534ccd,_0x19368f){_0x19368f=_0x19368f||0x1f4;return function(_0x3c0273){logger[_0xf937('0x24')](_0x3c0273['stack']);if(_0x3c0273[_0xf937('0x25')]){delete _0x3c0273[_0xf937('0x25')];}_0x534ccd['status'](_0x19368f)[_0xf937('0x26')](_0x3c0273);};}exports[_0xf937('0x27')]=function(_0x48767f,_0x3fa2aa){var _0x19a7c8={},_0x40ee80={},_0x3abf53={'count':0x0,'rows':[]};var _0xb9da57=_[_0xf937('0x28')](db[_0xf937('0x29')][_0xf937('0x2a')],function(_0x318a65){return{'name':_0x318a65[_0xf937('0x2b')],'type':_0x318a65[_0xf937('0x2c')][_0xf937('0x2d')]};});_0x40ee80[_0xf937('0x2e')]=_['map'](_0xb9da57,_0xf937('0x25'));_0x40ee80['query']=_[_0xf937('0x2f')](_0x48767f[_0xf937('0x30')]);_0x40ee80[_0xf937('0x31')]=_[_0xf937('0x32')](_0x40ee80['model'],_0x40ee80[_0xf937('0x30')]);_0x19a7c8[_0xf937('0x33')]=_[_0xf937('0x32')](_0x40ee80['model'],qs['fields'](_0x48767f[_0xf937('0x30')][_0xf937('0x34')]));_0x19a7c8[_0xf937('0x33')]=_0x19a7c8[_0xf937('0x33')]['length']?_0x19a7c8[_0xf937('0x33')]:_0x40ee80[_0xf937('0x2e')];if(!_0x48767f[_0xf937('0x30')][_0xf937('0x35')](_0xf937('0x36'))){_0x19a7c8[_0xf937('0x1c')]=qs[_0xf937('0x1c')](_0x48767f[_0xf937('0x30')][_0xf937('0x1c')]);_0x19a7c8[_0xf937('0x1b')]=qs['offset'](_0x48767f[_0xf937('0x30')][_0xf937('0x1b')]);}_0x19a7c8['order']=qs['sort'](_0x48767f[_0xf937('0x30')][_0xf937('0x37')]);_0x19a7c8[_0xf937('0x38')]=qs[_0xf937('0x31')](_[_0xf937('0x39')](_0x48767f['query'],_0x40ee80[_0xf937('0x31')]),_0xb9da57);if(_0x48767f[_0xf937('0x30')][_0xf937('0x3a')]){_0x19a7c8[_0xf937('0x38')]=_[_0xf937('0x3b')](_0x19a7c8[_0xf937('0x38')],{'$or':_[_0xf937('0x28')](_0xb9da57,function(_0x16e79a){if(_0x16e79a[_0xf937('0x2c')]!=='VIRTUAL'){var _0x50126e={};_0x50126e[_0x16e79a['name']]={'$like':'%'+_0x48767f[_0xf937('0x30')][_0xf937('0x3a')]+'%'};return _0x50126e;}})});}_0x19a7c8=_[_0xf937('0x3b')]({},_0x19a7c8,_0x48767f[_0xf937('0x3c')]);var _0x155f33={'where':_0x19a7c8['where']};return db['Trigger'][_0xf937('0x1a')](_0x155f33)[_0xf937('0x1f')](function(_0x34bc38){_0x3abf53[_0xf937('0x1a')]=_0x34bc38;if(_0x48767f[_0xf937('0x30')][_0xf937('0x3d')]){_0x19a7c8[_0xf937('0x3e')]=[{'all':!![]}];}return db[_0xf937('0x29')][_0xf937('0x3f')](_0x19a7c8);})[_0xf937('0x1f')](function(_0x38cb05){_0x3abf53[_0xf937('0x40')]=_0x38cb05;return _0x3abf53;})[_0xf937('0x1f')](respondWithFilteredResult(_0x3fa2aa,_0x19a7c8))[_0xf937('0x41')](handleError(_0x3fa2aa,null));};exports['show']=function(_0x3e2f2b,_0x35502f){var _0x3f2af1={'raw':![],'where':{'id':_0x3e2f2b[_0xf937('0x42')]['id']}},_0x2d9b6d={};_0x2d9b6d[_0xf937('0x2e')]=_['keys'](db[_0xf937('0x29')][_0xf937('0x2a')]);_0x2d9b6d['query']=_[_0xf937('0x2f')](_0x3e2f2b[_0xf937('0x30')]);_0x2d9b6d[_0xf937('0x31')]=_[_0xf937('0x32')](_0x2d9b6d[_0xf937('0x2e')],_0x2d9b6d[_0xf937('0x30')]);_0x3f2af1[_0xf937('0x33')]=_[_0xf937('0x32')](_0x2d9b6d[_0xf937('0x2e')],qs[_0xf937('0x34')](_0x3e2f2b[_0xf937('0x30')][_0xf937('0x34')]));_0x3f2af1['attributes']=_0x3f2af1['attributes'][_0xf937('0x43')]?_0x3f2af1[_0xf937('0x33')]:_0x2d9b6d[_0xf937('0x2e')];if(_0x3e2f2b[_0xf937('0x30')][_0xf937('0x3d')]){_0x3f2af1[_0xf937('0x3e')]=[{'all':!![]}];}_0x3f2af1=_[_0xf937('0x3b')]({},_0x3f2af1,_0x3e2f2b[_0xf937('0x3c')]);return db[_0xf937('0x29')][_0xf937('0x44')](_0x3f2af1)[_0xf937('0x1f')](handleEntityNotFound(_0x35502f,null))[_0xf937('0x1f')](respondWithResult(_0x35502f,null))[_0xf937('0x41')](handleError(_0x35502f,null));};exports[_0xf937('0x45')]=function(_0x13d9f7,_0x15e980){return db[_0xf937('0x29')]['create'](_0x13d9f7[_0xf937('0x46')],{})[_0xf937('0x1f')](function(_0x480304){var _0x1109b=_0x13d9f7['user'][_0xf937('0x21')]({'plain':!![]});if(!_0x1109b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1109b[_0xf937('0x47')]===_0xf937('0x48')){var _0x194851=_0x480304['get']({'plain':!![]});var _0x385f5e=_0xf937('0x22');return db[_0xf937('0x49')]['find']({'where':{'name':_0x385f5e,'userProfileId':_0x1109b[_0xf937('0x4a')]},'raw':!![]})[_0xf937('0x1f')](function(_0x4f4b79){if(_0x4f4b79&&_0x4f4b79[_0xf937('0x4b')]===0x0){return db[_0xf937('0x23')][_0xf937('0x45')]({'name':_0x194851[_0xf937('0x25')],'resourceId':_0x194851['id'],'type':_0x4f4b79['name'],'sectionId':_0x4f4b79['id']},{})[_0xf937('0x1f')](function(){return _0x480304;});}else{return _0x480304;}})['catch'](function(_0x41694b){logger[_0xf937('0x24')](_0xf937('0x4c'),_0x41694b);throw _0x41694b;});}return _0x480304;})[_0xf937('0x1f')](respondWithResult(_0x15e980,0xc9))[_0xf937('0x41')](handleError(_0x15e980,null));};exports[_0xf937('0x1e')]=function(_0xf9218c,_0x57b9b1){if(_0xf9218c['body']['id']){delete _0xf9218c['body']['id'];}return db[_0xf937('0x29')][_0xf937('0x44')]({'where':{'id':_0xf9218c['params']['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x57b9b1,null))[_0xf937('0x1f')](saveUpdates(_0xf9218c[_0xf937('0x46')],null))[_0xf937('0x1f')](respondWithResult(_0x57b9b1,null))[_0xf937('0x41')](handleError(_0x57b9b1,null));};exports[_0xf937('0x20')]=function(_0x33312c,_0xa06629){return db['Trigger'][_0xf937('0x44')]({'where':{'id':_0x33312c['params']['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0xa06629,null))[_0xf937('0x1f')](removeEntity(_0xa06629,null))[_0xf937('0x41')](handleError(_0xa06629,null));};exports[_0xf937('0x4d')]=function(_0x20985c,_0x3a4026,_0x1d10b9){if(_0x20985c[_0xf937('0x46')]['id']){delete _0x20985c['body']['id'];}return db[_0xf937('0x29')][_0xf937('0x44')]({'where':{'id':_0x20985c[_0xf937('0x42')]['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x3a4026,null))[_0xf937('0x1f')](function(_0x1065a7){if(_0x1065a7){_0x20985c['body'][_0xf937('0x4e')]=_0x1065a7['id'];return db[_0xf937('0x4f')]['create'](_0x20985c[_0xf937('0x46')]);}})[_0xf937('0x1f')](respondWithResult(_0x3a4026,null))[_0xf937('0x41')](handleError(_0x3a4026,null));};exports[_0xf937('0x50')]=function(_0x57cea9,_0x42fc99,_0x2b44f7){if(_0x57cea9[_0xf937('0x46')]['id']){delete _0x57cea9['body']['id'];}return db[_0xf937('0x29')][_0xf937('0x44')]({'where':{'id':_0x57cea9[_0xf937('0x42')]['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x42fc99,null))[_0xf937('0x1f')](function(_0x1c3023){if(_0x1c3023){_0x57cea9[_0xf937('0x46')][_0xf937('0x51')]=_0x1c3023['id'];return db[_0xf937('0x4f')][_0xf937('0x45')](_0x57cea9[_0xf937('0x46')]);}})[_0xf937('0x1f')](respondWithResult(_0x42fc99,null))['catch'](handleError(_0x42fc99,null));};exports[_0xf937('0x52')]=function(_0x4e0089,_0x531c3f,_0x148eb7){var _0x3832d2={};var _0x34b1bb={};var _0x483f3b;var _0x3b797f;return db[_0xf937('0x29')][_0xf937('0x53')]({'where':{'id':_0x4e0089['params']['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x531c3f,null))[_0xf937('0x1f')](function(_0x1fc400){if(_0x1fc400){_0x483f3b=_0x1fc400;_0x34b1bb[_0xf937('0x2e')]=_[_0xf937('0x2f')](db[_0xf937('0x4f')][_0xf937('0x2a')]);_0x34b1bb[_0xf937('0x30')]=_['keys'](_0x4e0089[_0xf937('0x30')]);_0x34b1bb[_0xf937('0x31')]=_[_0xf937('0x32')](_0x34b1bb[_0xf937('0x2e')],_0x34b1bb[_0xf937('0x30')]);_0x3832d2[_0xf937('0x33')]=_['intersection'](_0x34b1bb[_0xf937('0x2e')],qs['fields'](_0x4e0089[_0xf937('0x30')][_0xf937('0x34')]));_0x3832d2[_0xf937('0x33')]=_0x3832d2[_0xf937('0x33')][_0xf937('0x43')]?_0x3832d2[_0xf937('0x33')]:_0x34b1bb[_0xf937('0x2e')];_0x3832d2[_0xf937('0x54')]=qs[_0xf937('0x37')](_0x4e0089['query']['sort']);_0x3832d2[_0xf937('0x38')]=qs[_0xf937('0x31')](_[_0xf937('0x39')](_0x4e0089[_0xf937('0x30')],_0x34b1bb[_0xf937('0x31')]));if(_0x4e0089['query'][_0xf937('0x3a')]){_0x3832d2[_0xf937('0x38')]=_[_0xf937('0x3b')](_0x3832d2[_0xf937('0x38')],{'$or':_[_0xf937('0x28')](_0x3832d2[_0xf937('0x33')],function(_0x3c5017){var _0x5cd533={};_0x5cd533[_0x3c5017]={'$like':'%'+_0x4e0089[_0xf937('0x30')][_0xf937('0x3a')]+'%'};return _0x5cd533;})});}_0x3832d2=_[_0xf937('0x3b')]({},_0x3832d2,_0x4e0089[_0xf937('0x3c')]);return _0x483f3b[_0xf937('0x52')](_0x3832d2);}})['then'](function(_0x3a8d7f){if(_0x3a8d7f){_0x3b797f=_0x3a8d7f[_0xf937('0x43')];if(!_0x4e0089[_0xf937('0x30')]['hasOwnProperty'](_0xf937('0x36'))){_0x3832d2[_0xf937('0x1c')]=qs[_0xf937('0x1c')](_0x4e0089[_0xf937('0x30')]['limit']);_0x3832d2[_0xf937('0x1b')]=qs[_0xf937('0x1b')](_0x4e0089['query'][_0xf937('0x1b')]);}return _0x483f3b['getAllConditions'](_0x3832d2);}})[_0xf937('0x1f')](function(_0x2b806b){if(_0x2b806b){return _0x2b806b?{'count':_0x3b797f,'rows':_0x2b806b}:null;}})['then'](respondWithResult(_0x531c3f,null))['catch'](handleError(_0x531c3f,null));};exports[_0xf937('0x55')]=function(_0x41cde6,_0x542c2e,_0x4b4e25){var _0x519ba2={};var _0x5b7c76={};var _0x359fd6;var _0x34592f;return db[_0xf937('0x29')][_0xf937('0x53')]({'where':{'id':_0x41cde6[_0xf937('0x42')]['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x542c2e,null))['then'](function(_0x1852c6){if(_0x1852c6){_0x359fd6=_0x1852c6;_0x5b7c76[_0xf937('0x2e')]=_['keys'](db[_0xf937('0x4f')][_0xf937('0x2a')]);_0x5b7c76['query']=_['keys'](_0x41cde6[_0xf937('0x30')]);_0x5b7c76[_0xf937('0x31')]=_[_0xf937('0x32')](_0x5b7c76['model'],_0x5b7c76[_0xf937('0x30')]);_0x519ba2[_0xf937('0x33')]=_[_0xf937('0x32')](_0x5b7c76[_0xf937('0x2e')],qs[_0xf937('0x34')](_0x41cde6[_0xf937('0x30')][_0xf937('0x34')]));_0x519ba2['attributes']=_0x519ba2[_0xf937('0x33')][_0xf937('0x43')]?_0x519ba2[_0xf937('0x33')]:_0x5b7c76['model'];_0x519ba2[_0xf937('0x54')]=qs['sort'](_0x41cde6[_0xf937('0x30')]['sort']);_0x519ba2[_0xf937('0x38')]=qs['filters'](_[_0xf937('0x39')](_0x41cde6[_0xf937('0x30')],_0x5b7c76[_0xf937('0x31')]));if(_0x41cde6[_0xf937('0x30')][_0xf937('0x3a')]){_0x519ba2[_0xf937('0x38')]=_[_0xf937('0x3b')](_0x519ba2[_0xf937('0x38')],{'$or':_[_0xf937('0x28')](_0x519ba2[_0xf937('0x33')],function(_0x33b2f9){var _0x5c07be={};_0x5c07be[_0x33b2f9]={'$like':'%'+_0x41cde6[_0xf937('0x30')][_0xf937('0x3a')]+'%'};return _0x5c07be;})});}_0x519ba2=_[_0xf937('0x3b')]({},_0x519ba2,_0x41cde6[_0xf937('0x3c')]);return _0x359fd6[_0xf937('0x55')](_0x519ba2);}})[_0xf937('0x1f')](function(_0x36fe3c){if(_0x36fe3c){_0x34592f=_0x36fe3c['length'];if(!_0x41cde6[_0xf937('0x30')][_0xf937('0x35')](_0xf937('0x36'))){_0x519ba2['limit']=qs[_0xf937('0x1c')](_0x41cde6['query'][_0xf937('0x1c')]);_0x519ba2[_0xf937('0x1b')]=qs[_0xf937('0x1b')](_0x41cde6[_0xf937('0x30')][_0xf937('0x1b')]);}return _0x359fd6['getAnyConditions'](_0x519ba2);}})['then'](function(_0x41c580){if(_0x41c580){return _0x41c580?{'count':_0x34592f,'rows':_0x41c580}:null;}})[_0xf937('0x1f')](respondWithResult(_0x542c2e,null))[_0xf937('0x41')](handleError(_0x542c2e,null));};exports[_0xf937('0x56')]=function(_0x26eac8,_0x2437eb,_0xa1e28c){if(_0x26eac8['body']['id']){delete _0x26eac8['body']['id'];}return db[_0xf937('0x29')][_0xf937('0x44')]({'where':{'id':_0x26eac8[_0xf937('0x42')]['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x2437eb,null))[_0xf937('0x1f')](function(_0x4eb064){if(_0x4eb064){_0x26eac8['body'][_0xf937('0x57')]=_0x4eb064['id'];return db[_0xf937('0x58')][_0xf937('0x45')](_0x26eac8['body']);}})['then'](respondWithResult(_0x2437eb,null))[_0xf937('0x41')](handleError(_0x2437eb,null));};exports[_0xf937('0x59')]=function(_0xc6f914,_0x19db88,_0x2efe6d){var _0x184661={};var _0x316dd1={};var _0x258e40;var _0x2cff69;return db[_0xf937('0x29')][_0xf937('0x53')]({'where':{'id':_0xc6f914[_0xf937('0x42')]['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x19db88,null))[_0xf937('0x1f')](function(_0x29123a){if(_0x29123a){_0x258e40=_0x29123a;_0x316dd1['model']=_['keys'](db['Action'][_0xf937('0x2a')]);_0x316dd1[_0xf937('0x30')]=_[_0xf937('0x2f')](_0xc6f914[_0xf937('0x30')]);_0x316dd1[_0xf937('0x31')]=_[_0xf937('0x32')](_0x316dd1['model'],_0x316dd1['query']);_0x184661[_0xf937('0x33')]=_[_0xf937('0x32')](_0x316dd1['model'],qs[_0xf937('0x34')](_0xc6f914[_0xf937('0x30')][_0xf937('0x34')]));_0x184661[_0xf937('0x33')]=_0x184661[_0xf937('0x33')][_0xf937('0x43')]?_0x184661[_0xf937('0x33')]:_0x316dd1[_0xf937('0x2e')];_0x184661[_0xf937('0x54')]=qs[_0xf937('0x37')](_0xc6f914['query'][_0xf937('0x37')]);_0x184661[_0xf937('0x38')]=qs[_0xf937('0x31')](_[_0xf937('0x39')](_0xc6f914[_0xf937('0x30')],_0x316dd1['filters']));if(_0xc6f914[_0xf937('0x30')][_0xf937('0x3a')]){_0x184661['where']=_['merge'](_0x184661[_0xf937('0x38')],{'$or':_[_0xf937('0x28')](_0x184661[_0xf937('0x33')],function(_0x1e7035){var _0x1c029d={};_0x1c029d[_0x1e7035]={'$like':'%'+_0xc6f914[_0xf937('0x30')][_0xf937('0x3a')]+'%'};return _0x1c029d;})});}_0x184661=_[_0xf937('0x3b')]({},_0x184661,_0xc6f914[_0xf937('0x3c')]);return _0x258e40[_0xf937('0x59')](_0x184661);}})[_0xf937('0x1f')](function(_0x557041){if(_0x557041){_0x2cff69=_0x557041[_0xf937('0x43')];if(!_0xc6f914[_0xf937('0x30')]['hasOwnProperty'](_0xf937('0x36'))){_0x184661[_0xf937('0x1c')]=qs[_0xf937('0x1c')](_0xc6f914[_0xf937('0x30')][_0xf937('0x1c')]);_0x184661[_0xf937('0x1b')]=qs[_0xf937('0x1b')](_0xc6f914[_0xf937('0x30')][_0xf937('0x1b')]);}return _0x258e40['getActions'](_0x184661);}})[_0xf937('0x1f')](function(_0x23dc3a){if(_0x23dc3a){return _0x23dc3a?{'count':_0x2cff69,'rows':_0x23dc3a}:null;}})[_0xf937('0x1f')](respondWithResult(_0x19db88,null))['catch'](handleError(_0x19db88,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 69413fa..dcf61b8 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 _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','Trigger','tools_triggers','util','api','moment'];(function(_0x1c4aa3,_0x5514ef){var _0x1a27d6=function(_0x2a5b9d){while(--_0x2a5b9d){_0x1c4aa3['push'](_0x1c4aa3['shift']());}};_0x1a27d6(++_0x5514ef);}(_0xadb5,0xad));var _0x5adb=function(_0x5639d2,_0x2e585c){_0x5639d2=_0x5639d2-0x0;var _0x6dbd5c=_0xadb5[_0x5639d2];return _0x6dbd5c;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./trigger.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['path','rimraf','../../config/environment','./trigger.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x5cdb19,_0x43b3e6){var _0x5656a7=function(_0x5b9f58){while(--_0x5b9f58){_0x5cdb19['push'](_0x5cdb19['shift']());}};_0x5656a7(++_0x43b3e6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4e6cbb,_0x3450f0){_0x4e6cbb=_0x4e6cbb-0x0;var _0x15ced4=_0x0b0e[_0x4e6cbb];return _0x15ced4;};'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')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 2b00f9b..5812f43 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 _0xa5fa=['jayson/promise','client','http','request','info','debug','stringify','error','code','Trigger,\x20%s,\x20%s','message','request\x20sent','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','then','ShowTrigger','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x25acac,_0x1411ad){var _0x30f276=function(_0x4c7460){while(--_0x4c7460){_0x25acac['push'](_0x25acac['shift']());}};_0x30f276(++_0x1411ad);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x5f0c2e,_0x33309f){_0x5f0c2e=_0x5f0c2e-0x0;var _0x1c2dda=_0xa5fa[_0x5f0c2e];return _0x1c2dda;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('Trigger,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')]({'raw':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'limit':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')]['limit']||null:null,'include':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f['options'][_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x3d874f['options'][_0xaa5f('0x1d')],function(_0x1032ce){return{'model':db[_0x1032ce['model']],'as':_0x1032ce['as'],'attributes':_0x1032ce[_0xaa5f('0x1c')],'include':_0x1032ce[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1032ce[_0xaa5f('0x1d')],function(_0x1f66c0){return{'model':db[_0x1f66c0[_0xaa5f('0x1f')]],'as':_0x1f66c0['as'],'attributes':_0x1f66c0[_0xaa5f('0x1c')],'include':_0x1f66c0[_0xaa5f('0x1d')]?_['map'](_0x1f66c0[_0xaa5f('0x1d')],function(_0x3a66e8){return{'model':db[_0x3a66e8[_0xaa5f('0x1f')]],'as':_0x3a66e8['as'],'attributes':_0x3a66e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x269209){logger[_0xaa5f('0xc')]('GetTrigger',_0x3d874f);logger[_0xaa5f('0xd')]('GetTrigger',_0x3d874f,JSON['stringify'](_0x269209));_0x1019e8(_0x269209);})[_0xaa5f('0x15')](function(_0x50998f){logger[_0xaa5f('0xf')]('GetTrigger',_0x50998f['message'],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x50998f[_0xaa5f('0x12')]));});});};exports['ShowTrigger']=function(_0x310828){var _0xc0bb03=this;return new Promise(function(_0x555876,_0x58f608){return db[_0xaa5f('0x17')]['find']({'raw':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x310828['options']?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'include':_0x310828['options']?_0x310828['options']['include']?_['map'](_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1d')],function(_0x2a6015){return{'model':db[_0x2a6015[_0xaa5f('0x1f')]],'as':_0x2a6015['as'],'attributes':_0x2a6015[_0xaa5f('0x1c')],'include':_0x2a6015[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x2a6015['include'],function(_0x1ab07f){return{'model':db[_0x1ab07f[_0xaa5f('0x1f')]],'as':_0x1ab07f['as'],'attributes':_0x1ab07f[_0xaa5f('0x1c')],'include':_0x1ab07f[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1ab07f[_0xaa5f('0x1d')],function(_0x49442c){return{'model':db[_0x49442c[_0xaa5f('0x1f')]],'as':_0x49442c['as'],'attributes':_0x49442c[_0xaa5f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x2ac0f8){logger[_0xaa5f('0xc')]('ShowTrigger',_0x310828);logger['debug'](_0xaa5f('0x21'),_0x310828,JSON[_0xaa5f('0xe')](_0x2ac0f8));_0x555876(_0x2ac0f8);})[_0xaa5f('0x15')](function(_0x964105){logger['error'](_0xaa5f('0x21'),_0x964105[_0xaa5f('0x12')],_0x310828);_0x58f608(_0xc0bb03[_0xaa5f('0xf')](0x1f4,_0x964105[_0xaa5f('0x12')]));});});}; \ No newline at end of file +var _0x8f4c=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrigger','Trigger','findAll','options','raw','attributes','limit','map','include','model','ShowTrigger','find','lodash','util','moment','bluebird','randomstring'];(function(_0x534d4f,_0x22d038){var _0x4ea1b0=function(_0x389d0b){while(--_0x389d0b){_0x534d4f['push'](_0x534d4f['shift']());}};_0x4ea1b0(++_0x22d038);}(_0x8f4c,0x113));var _0xc8f4=function(_0x4e8c47,_0x94ee2d){_0x4e8c47=_0x4e8c47-0x0;var _0x6c119=_0x8f4c[_0x4e8c47];return _0x6c119;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')]({'raw':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1b')]===undefined?!![]:![]:!![],'where':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')]['where']||null:null,'attributes':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1c')]||null:null,'limit':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1d')]||null:null,'include':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')]['include']?_[_0xc8f4('0x1e')](_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1f')],function(_0x1d159e){return{'model':db[_0x1d159e['model']],'as':_0x1d159e['as'],'attributes':_0x1d159e[_0xc8f4('0x1c')],'include':_0x1d159e['include']?_[_0xc8f4('0x1e')](_0x1d159e['include'],function(_0x177a44){return{'model':db[_0x177a44[_0xc8f4('0x20')]],'as':_0x177a44['as'],'attributes':_0x177a44['attributes'],'include':_0x177a44[_0xc8f4('0x1f')]?_[_0xc8f4('0x1e')](_0x177a44[_0xc8f4('0x1f')],function(_0x2fa052){return{'model':db[_0x2fa052['model']],'as':_0x2fa052['as'],'attributes':_0x2fa052[_0xc8f4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc8f4('0xb')](function(_0x5db666){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5db666));_0x4763c1(_0x5db666);})[_0xc8f4('0x16')](function(_0x4a25da){logger[_0xc8f4('0x11')](_0xc8f4('0x17'),_0x4a25da[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973['error'](0x1f4,_0x4a25da[_0xc8f4('0x13')]));});});};exports[_0xc8f4('0x21')]=function(_0x5ab6cb){var _0x56ec4b=this;return new Promise(function(_0x4d6c43,_0x2717ff){return db[_0xc8f4('0x18')][_0xc8f4('0x22')]({'raw':_0x5ab6cb[_0xc8f4('0x1a')]?_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ab6cb[_0xc8f4('0x1a')]?_0x5ab6cb[_0xc8f4('0x1a')]['where']||null:null,'attributes':_0x5ab6cb[_0xc8f4('0x1a')]?_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1c')]||null:null,'include':_0x5ab6cb['options']?_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1f')]?_['map'](_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1f')],function(_0x36f24f){return{'model':db[_0x36f24f['model']],'as':_0x36f24f['as'],'attributes':_0x36f24f[_0xc8f4('0x1c')],'include':_0x36f24f[_0xc8f4('0x1f')]?_[_0xc8f4('0x1e')](_0x36f24f['include'],function(_0x1c9d57){return{'model':db[_0x1c9d57[_0xc8f4('0x20')]],'as':_0x1c9d57['as'],'attributes':_0x1c9d57[_0xc8f4('0x1c')],'include':_0x1c9d57[_0xc8f4('0x1f')]?_[_0xc8f4('0x1e')](_0x1c9d57[_0xc8f4('0x1f')],function(_0xeacb80){return{'model':db[_0xeacb80[_0xc8f4('0x20')]],'as':_0xeacb80['as'],'attributes':_0xeacb80[_0xc8f4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc8f4('0xb')](function(_0x35b516){logger[_0xc8f4('0x14')](_0xc8f4('0x21'),_0x5ab6cb);logger[_0xc8f4('0xe')](_0xc8f4('0x21'),_0x5ab6cb,JSON[_0xc8f4('0x10')](_0x35b516));_0x4d6c43(_0x35b516);})['catch'](function(_0x3a8cac){logger['error'](_0xc8f4('0x21'),_0x3a8cac['message'],_0x5ab6cb);_0x2717ff(_0x56ec4b[_0xc8f4('0x11')](0x1f4,_0x3a8cac[_0xc8f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index bba2f04..9b8969c 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 _0xd2ea=['../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0xd2ea,0x15f));var _0xad2e=function(_0x555fb7,_0x4d894e){_0x555fb7=_0x555fb7-0x0;var _0x9348f1=_0xd2ea[_0x555fb7];return _0x9348f1;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var auth=require(_0xad2e('0x5'));var interaction=require(_0xad2e('0x6'));var config=require(_0xad2e('0x7'));var controller=require(_0xad2e('0x8'));router[_0xad2e('0x9')]('/',auth[_0xad2e('0xa')](),controller[_0xad2e('0xb')]);router['get'](_0xad2e('0xc'),auth[_0xad2e('0xa')](),controller[_0xad2e('0xd')]);router['post'](_0xad2e('0xe'),auth[_0xad2e('0xa')](),controller['clone']);router[_0xad2e('0xf')]('/',auth['isAuthenticated'](),controller[_0xad2e('0x10')]);router[_0xad2e('0x11')](_0xad2e('0xc'),auth[_0xad2e('0xa')](),controller['update']);router[_0xad2e('0x12')]('/:id',auth[_0xad2e('0xa')](),controller[_0xad2e('0x13')]);module[_0xad2e('0x14')]=router; \ No newline at end of file +var _0x7da7=['post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','index','/:id','show'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7da7,0x10d));var _0x77da=function(_0x48c2ae,_0x4cea90){_0x48c2ae=_0x48c2ae-0x0;var _0x8f7531=_0x7da7[_0x48c2ae];return _0x8f7531;};'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/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 577c647..fb1c110 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 _0x036e=['friend','user','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','nonat','update,nonat','sequelize','exports','STRING','ENUM'];(function(_0x16cc69,_0x49b16d){var _0x2e65c8=function(_0x21fd8b){while(--_0x21fd8b){_0x16cc69['push'](_0x16cc69['shift']());}};_0x2e65c8(++_0x49b16d);}(_0x036e,0x128));var _0xe036=function(_0x3a71c3,_0x3ddcf4){_0x3a71c3=_0x3a71c3-0x0;var _0x41f2ee=_0x036e[_0x3a71c3];return _0x41f2ee;};'use strict';var Sequelize=require(_0xe036('0x0'));module[_0xe036('0x1')]={'name':{'type':Sequelize[_0xe036('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x4'),_0xe036('0x5'),_0xe036('0x6')),'allowNull':![],'defaultValue':_0xe036('0x4')},'context':{'type':Sequelize[_0xe036('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xe036('0x3')]('ALLOWED_NOT_SCREENED',_0xe036('0x7'),_0xe036('0x8'),_0xe036('0x9'),_0xe036('0xa'),_0xe036('0xb'),_0xe036('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0xe036('0x2')]},'permit':{'type':Sequelize[_0xe036('0x2')]},'secret':{'type':Sequelize[_0xe036('0x2')]},'md5secret':{'type':Sequelize[_0xe036('0x2')]},'remotesecret':{'type':Sequelize[_0xe036('0x2')]},'transport':{'type':Sequelize[_0xe036('0x2')],'defaultValue':_0xe036('0xd'),'set':function(_0x1040c3){this[_0xe036('0xe')](_0xe036('0xf'),_0x1040c3?_0x1040c3[_0xe036('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xe036('0xf'))?this[_0xe036('0x11')](_0xe036('0xf'))[_0xe036('0x12')](','):null;},'comment':_0xe036('0x13')},'dtmfmode':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x14'),_0xe036('0x15'),_0xe036('0x16'),_0xe036('0x17'),'auto'),'defaultValue':_0xe036('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0xe036('0x18'),'no','nonat',_0xe036('0x19'),_0xe036('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe036('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe036('0x2')]},'directmediadeny':{'type':Sequelize[_0xe036('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xe036('0x1b'),'set':function(_0x424260){this['setDataValue']('nat',_0x424260?_0x424260[_0xe036('0x10')](','):null);},'get':function(){return this[_0xe036('0x11')](_0xe036('0x1c'))?this[_0xe036('0x11')](_0xe036('0x1c'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe036('0x2')]},'namedcallgroup':{'type':Sequelize[_0xe036('0x2')]},'pickupgroup':{'type':Sequelize[_0xe036('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xe036('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe036('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe036('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe036('0x1d'),'set':function(_0x1be3d5){this[_0xe036('0xe')](_0xe036('0x1e'),_0x1be3d5?_0x1be3d5[_0xe036('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xe036('0x11')](_0xe036('0x1e'))?this[_0xe036('0x11')](_0xe036('0x1e'))['split'](';'):null;},'comment':_0xe036('0x1f')},'autoframing':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xe036('0x20'),'set':function(_0x3ff500){this[_0xe036('0xe')]('insecure',_0x3ff500?_0x3ff500['join'](','):null);},'get':function(){return this[_0xe036('0x11')](_0xe036('0x21'))?this['getDataValue'](_0xe036('0x21'))[_0xe036('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe036('0x3')]('yes','no',_0xe036('0x22'))},'promiscredir':{'type':Sequelize['ENUM'](_0xe036('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xe036('0x18'),'no')},'accountcode':{'type':Sequelize[_0xe036('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xe036('0x24')},'amaflags':{'type':Sequelize[_0xe036('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xe036('0x18'),'no'),'defaultValue':_0xe036('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xe036('0x2')]},'template':{'type':Sequelize[_0xe036('0x2')]},'videosupport':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no',_0xe036('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe036('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x26'),'refuse',_0xe036('0x27'))},'session_expires':{'type':Sequelize[_0xe036('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xe036('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xe036('0x3')]('uac',_0xe036('0x28')),'defaultValue':_0xe036('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0xe036('0x2')]},'regexten':{'type':Sequelize[_0xe036('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xe036('0x2')]},'port':{'type':Sequelize[_0xe036('0x23')](0x5)},'qualify':{'type':Sequelize[_0xe036('0x3')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xe036('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xe036('0x2')]},'defaultuser':{'type':Sequelize[_0xe036('0x2')]},'rtptimeout':{'type':Sequelize[_0xe036('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe036('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe036('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no',_0xe036('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe036('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xe036('0x23')](0xb)},'timerb':{'type':Sequelize[_0xe036('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xe036('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xe036('0x2')]},'contactdeny':{'type':Sequelize[_0xe036('0x2')]},'contactacl':{'type':Sequelize[_0xe036('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xe036('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'force_avp':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0xe036('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xe036('0x3')]('yes','no',_0xe036('0x2a'),_0xe036('0x2b'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xe036('0x2')]},'dtlscipher':{'type':Sequelize[_0xe036('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xe036('0x2')]},'dtlssetup':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x2c'),_0xe036('0x2d'),_0xe036('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe036('0x2')]},'usereqphone':{'type':Sequelize[_0xe036('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe036('0x2')]},'recordofffeature':{'type':Sequelize[_0xe036('0x2')]},'call_limit':{'type':Sequelize[_0xe036('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'vmexten':{'type':Sequelize[_0xe036('0x2')]},'mohinterpret':{'type':Sequelize[_0xe036('0x2')]},'mohsuggest':{'type':Sequelize[_0xe036('0x2')]},'parkinglot':{'type':Sequelize[_0xe036('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0xe036('0x2f')},'canreinvite':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no',_0xe036('0x30'),_0xe036('0x19'),_0xe036('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xe036('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe036('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x8426=['never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','name','ENUM','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'];(function(_0x4c5181,_0x6a51e){var _0x252a33=function(_0x18daf3){while(--_0x18daf3){_0x4c5181['push'](_0x4c5181['shift']());}};_0x252a33(++_0x6a51e);}(_0x8426,0x1b9));var _0x6842=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x8426[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require('sequelize');module[_0x6842('0x0')]={'name':{'type':Sequelize[_0x6842('0x1')],'allowNull':![],'unique':_0x6842('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6842('0x3')]('friend',_0x6842('0x4'),'peer'),'allowNull':![],'defaultValue':_0x6842('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6842('0x6')},'callingpres':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x7'),_0x6842('0x8'),_0x6842('0x9'),_0x6842('0xa'),_0x6842('0xb'),'PROHIB_PASSED_SCREEN',_0x6842('0xc'),_0x6842('0xd'))},'deny':{'type':Sequelize[_0x6842('0x1')]},'permit':{'type':Sequelize[_0x6842('0x1')]},'secret':{'type':Sequelize[_0x6842('0x1')]},'md5secret':{'type':Sequelize[_0x6842('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x6842('0x1')],'defaultValue':'udp','set':function(_0x1cef15){this[_0x6842('0xe')](_0x6842('0xf'),_0x1cef15?_0x1cef15[_0x6842('0x10')](','):null);},'get':function(){return this[_0x6842('0x11')]('transport')?this[_0x6842('0x11')](_0x6842('0xf'))[_0x6842('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x6842('0x13'),_0x6842('0x14'),_0x6842('0x15'),_0x6842('0x16'),_0x6842('0x17')),'defaultValue':_0x6842('0x13')},'directmedia':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no',_0x6842('0x19'),_0x6842('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x6842('0x1')]},'nat':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x1b'),'set':function(_0x52c08e){this[_0x6842('0xe')](_0x6842('0x1c'),_0x52c08e?_0x52c08e[_0x6842('0x10')](','):null);},'get':function(){return this[_0x6842('0x11')](_0x6842('0x1c'))?this[_0x6842('0x11')](_0x6842('0x1c'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x6842('0x1')]},'namedcallgroup':{'type':Sequelize[_0x6842('0x1')]},'pickupgroup':{'type':Sequelize[_0x6842('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x6842('0x1')]},'language':{'type':Sequelize[_0x6842('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6842('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x1d')},'allow':{'type':Sequelize[_0x6842('0x1')],'allowNull':![],'defaultValue':_0x6842('0x1e'),'set':function(_0x316b45){this[_0x6842('0xe')](_0x6842('0x1f'),_0x316b45?_0x316b45[_0x6842('0x10')](';'):_0x6842('0x1e'));},'get':function(){return this[_0x6842('0x11')](_0x6842('0x1f'))?this['getDataValue']('allow')['split'](';'):null;},'comment':_0x6842('0x20')},'autoframing':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'insecure':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x21'),'set':function(_0x14a9cd){this[_0x6842('0xe')](_0x6842('0x22'),_0x14a9cd?_0x14a9cd[_0x6842('0x10')](','):null);},'get':function(){return this[_0x6842('0x11')](_0x6842('0x22'))?this['getDataValue'](_0x6842('0x22'))[_0x6842('0x12')](','):null;},'comment':_0x6842('0x23')},'trustrpid':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6842('0x3')]('yes','no',_0x6842('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0x6842('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x25')},'amaflags':{'type':Sequelize[_0x6842('0x1')]},'callcounter':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no'),'defaultValue':_0x6842('0x18')},'busylevel':{'type':Sequelize[_0x6842('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x6842('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x6842('0x1')]},'videosupport':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no',_0x6842('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'mailbox':{'type':Sequelize[_0x6842('0x1')]},'session_timers':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x28'),_0x6842('0x29'),_0x6842('0x2a'))},'session_expires':{'type':Sequelize[_0x6842('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x6842('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x2b'),_0x6842('0x2c')),'defaultValue':_0x6842('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x6842('0x1')]},'regexten':{'type':Sequelize[_0x6842('0x1')]},'fromdomain':{'type':Sequelize[_0x6842('0x1')]},'fromuser':{'type':Sequelize[_0x6842('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no'),'defaultValue':_0x6842('0x18')},'keepalive':{'type':Sequelize[_0x6842('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x6842('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6842('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no',_0x6842('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6842('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x6842('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x6842('0x26')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x6842('0x1')]},'contactacl':{'type':Sequelize[_0x6842('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x6842('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x6842('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x6842('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'force_avp':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x6842('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x6842('0x18'),'no',_0x6842('0x2e'),_0x6842('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x6842('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x6842('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x6842('0x1')]},'dtlscipher':{'type':Sequelize[_0x6842('0x1')]},'dtlscafile':{'type':Sequelize[_0x6842('0x1')]},'dtlscapath':{'type':Sequelize[_0x6842('0x1')]},'dtlssetup':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x30'),'passive',_0x6842('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x6842('0x1')]},'call_limit':{'type':Sequelize[_0x6842('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'vmexten':{'type':Sequelize[_0x6842('0x1')]},'mohinterpret':{'type':Sequelize[_0x6842('0x1')]},'mohsuggest':{'type':Sequelize[_0x6842('0x1')]},'parkinglot':{'type':Sequelize[_0x6842('0x1')]},'description':{'type':Sequelize[_0x6842('0x1')]},'host':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x32')},'canreinvite':{'type':Sequelize['ENUM'](_0x6842('0x18'),'no','nonat','update',_0x6842('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x6842('0x1')]},'active':{'type':Sequelize[_0x6842('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 61af428..dcac586 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 _0xf7b4=['render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','join','server/files/templates/registry.ejs','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','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','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','stack','name','send','map','rawAttributes','key','keys','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','type','merge','options','Trunk','includeAll','include','findAll','rows','catch','show','params','length','find','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','utf8'];(function(_0x58649b,_0x22c03b){var _0x423588=function(_0x3e2b83){while(--_0x3e2b83){_0x58649b['push'](_0x58649b['shift']());}};_0x423588(++_0x22c03b);}(_0xf7b4,0x152));var _0x4f7b=function(_0xba9332,_0x4b4a65){_0xba9332=_0xba9332-0x0;var _0x4ef1ba=_0xf7b4[_0xba9332];return _0x4ef1ba;};'use strict';var pdf=require(_0x4f7b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f7b('0x1'));var jsonpatch=require(_0x4f7b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4f7b('0x3'));var Mustache=require(_0x4f7b('0x4'));var util=require(_0x4f7b('0x5'));var path=require(_0x4f7b('0x6'));var sox=require(_0x4f7b('0x7'));var csv=require(_0x4f7b('0x8'));var ejs=require(_0x4f7b('0x9'));var fs=require('fs');var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x8'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x4f7b('0x17')][_0x4f7b('0x18')]({'port':0x232a});function checkPasswordPattern(_0x3c55e1,_0x41a050,_0x4f7c2b){if(_0x4f7c2b){var _0x889894=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x889894[_0x4f7b('0x19')](_0x41a050)){return _0x3c55e1;}else{throw new db[(_0x4f7b('0x1a'))][(_0x4f7b('0x1b'))](_0x4f7b('0x1c'));}}else{return _0x3c55e1;}}function respondWithRpcPromise(_0x330de9,_0x40ecb0,_0x2437cc,_0x260667){return new BPromise(function(_0x29fdd5,_0x1a28b8){var _0x1e7afc=_0x260667||client;return _0x1e7afc['request'](_0x330de9,_0x2437cc)[_0x4f7b('0x1d')](function(_0x496322){logger['info'](_0x4f7b('0x1e'),_0x40ecb0,_0x4f7b('0x1f'));logger['debug'](_0x4f7b('0x20'),_0x40ecb0,_0x4f7b('0x1f'),JSON[_0x4f7b('0x21')](_0x496322));if(_0x496322[_0x4f7b('0x22')]){if(_0x496322['error'][_0x4f7b('0x23')]===0x1f4){logger['error'](_0x4f7b('0x1e'),_0x40ecb0,_0x496322[_0x4f7b('0x22')][_0x4f7b('0x24')]);return _0x1a28b8(_0x496322[_0x4f7b('0x22')][_0x4f7b('0x24')]);}logger[_0x4f7b('0x22')](_0x4f7b('0x1e'),_0x40ecb0,_0x496322[_0x4f7b('0x22')][_0x4f7b('0x24')]);return _0x29fdd5(_0x496322['error'][_0x4f7b('0x24')]);}else{logger[_0x4f7b('0x25')](_0x4f7b('0x1e'),_0x40ecb0,'request\x20sent');_0x29fdd5(_0x496322[_0x4f7b('0x26')][_0x4f7b('0x24')]);}})['catch'](function(_0x15dbec){logger['error'](_0x4f7b('0x1e'),_0x40ecb0,_0x15dbec);_0x1a28b8(_0x15dbec);});});}function respondWithStatusCode(_0x2429be,_0x23c820){_0x23c820=_0x23c820||0xcc;return function(_0x278c41){if(_0x278c41){return _0x2429be[_0x4f7b('0x27')](_0x23c820);}return _0x2429be[_0x4f7b('0x28')](_0x23c820)[_0x4f7b('0x29')]();};}function respondWithResult(_0x3ad769,_0x4ec9a3){_0x4ec9a3=_0x4ec9a3||0xc8;return function(_0x6c9626){if(_0x6c9626){return _0x3ad769[_0x4f7b('0x28')](_0x4ec9a3)[_0x4f7b('0x2a')](_0x6c9626);}};}function respondWithFilteredResult(_0x5c6c3e,_0x19da29){return function(_0x336739){if(_0x336739){var _0x1db684=_0x336739[_0x4f7b('0x2b')],_0x3a56ff=_0x19da29[_0x4f7b('0x2c')],_0x1ccce0=_0x19da29[_0x4f7b('0x2c')]+_0x19da29['limit'],_0x4ebffa;if(_0x1ccce0>=_0x1db684){_0x1ccce0=_0x1db684;_0x4ebffa=0xc8;}else{_0x4ebffa=0xce;}_0x5c6c3e[_0x4f7b('0x28')](_0x4ebffa);return _0x5c6c3e['set']('Content-Range',_0x3a56ff+'-'+_0x1ccce0+'/'+_0x1db684)[_0x4f7b('0x2a')](_0x336739);}return null;};}function patchUpdates(_0x52a5b1){return function(_0x1aad4b){try{jsonpatch[_0x4f7b('0x2d')](_0x1aad4b,_0x52a5b1,!![]);}catch(_0x22f489){return BPromise[_0x4f7b('0x2e')](_0x22f489);}return _0x1aad4b[_0x4f7b('0x2f')]();};}function saveUpdates(_0x4e5862,_0x13a113){return function(_0x179372){if(_0x179372){return _0x179372[_0x4f7b('0x30')](_0x4e5862)[_0x4f7b('0x1d')](function(_0x1c133d){return _0x1c133d;});}return null;};}function removeEntity(_0x8d3266,_0x3e7fb4){return function(_0x121923){if(_0x121923){return _0x121923[_0x4f7b('0x31')]()[_0x4f7b('0x1d')](function(){var _0x32e039=_0x121923[_0x4f7b('0x32')]({'plain':!![]});var _0x35f1ed=_0x4f7b('0x33');return db[_0x4f7b('0x34')][_0x4f7b('0x31')]({'where':{'type':_0x35f1ed,'resourceId':_0x32e039['id']}})['then'](function(){return _0x121923;});})[_0x4f7b('0x1d')](function(){_0x8d3266['status'](0xcc)[_0x4f7b('0x29')]();});}};}function handleEntityNotFound(_0x4005ad,_0x579ad4){return function(_0xa28dab){if(!_0xa28dab){_0x4005ad[_0x4f7b('0x27')](0x194);}return _0xa28dab;};}function handleError(_0x1347b6,_0x584b25){_0x584b25=_0x584b25||0x1f4;return function(_0x38b463){logger[_0x4f7b('0x22')](_0x38b463[_0x4f7b('0x35')]);if(_0x38b463[_0x4f7b('0x36')]){delete _0x38b463[_0x4f7b('0x36')];}_0x1347b6[_0x4f7b('0x28')](_0x584b25)[_0x4f7b('0x37')](_0x38b463);};}exports['index']=function(_0x90b979,_0x486187){var _0x26fe5b={},_0x14d1f3={},_0xa9143c={'count':0x0,'rows':[]};var _0x593ec2=_[_0x4f7b('0x38')](db['Trunk'][_0x4f7b('0x39')],function(_0x16d554){return{'name':_0x16d554['fieldName'],'type':_0x16d554['type'][_0x4f7b('0x3a')]};});_0x14d1f3['model']=_[_0x4f7b('0x38')](_0x593ec2,_0x4f7b('0x36'));_0x14d1f3['query']=_[_0x4f7b('0x3b')](_0x90b979['query']);_0x14d1f3['filters']=_['intersection'](_0x14d1f3[_0x4f7b('0x3c')],_0x14d1f3[_0x4f7b('0x3d')]);_0x26fe5b[_0x4f7b('0x3e')]=_[_0x4f7b('0x3f')](_0x14d1f3['model'],qs[_0x4f7b('0x40')](_0x90b979['query'][_0x4f7b('0x40')]));_0x26fe5b['attributes']=_0x26fe5b[_0x4f7b('0x3e')]['length']?_0x26fe5b[_0x4f7b('0x3e')]:_0x14d1f3[_0x4f7b('0x3c')];if(!_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x41')](_0x4f7b('0x42'))){_0x26fe5b[_0x4f7b('0x43')]=qs[_0x4f7b('0x43')](_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x43')]);_0x26fe5b[_0x4f7b('0x2c')]=qs[_0x4f7b('0x2c')](_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x2c')]);}_0x26fe5b[_0x4f7b('0x44')]=qs[_0x4f7b('0x45')](_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x45')]);_0x26fe5b[_0x4f7b('0x46')]=qs['filters'](_['pick'](_0x90b979[_0x4f7b('0x3d')],_0x14d1f3[_0x4f7b('0x47')]),_0x593ec2);if(_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x48')]){_0x26fe5b['where']=_['merge'](_0x26fe5b[_0x4f7b('0x46')],{'$or':_[_0x4f7b('0x38')](_0x593ec2,function(_0x242bde){if(_0x242bde[_0x4f7b('0x49')]!=='VIRTUAL'){var _0x4ceea1={};_0x4ceea1[_0x242bde[_0x4f7b('0x36')]]={'$like':'%'+_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x48')]+'%'};return _0x4ceea1;}})});}_0x26fe5b=_[_0x4f7b('0x4a')]({},_0x26fe5b,_0x90b979[_0x4f7b('0x4b')]);var _0x4a3fe1={'where':_0x26fe5b[_0x4f7b('0x46')]};return db[_0x4f7b('0x4c')][_0x4f7b('0x2b')](_0x4a3fe1)['then'](function(_0x6c659c){_0xa9143c[_0x4f7b('0x2b')]=_0x6c659c;if(_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x4d')]){_0x26fe5b[_0x4f7b('0x4e')]=[{'all':!![]}];}return db[_0x4f7b('0x4c')][_0x4f7b('0x4f')](_0x26fe5b);})[_0x4f7b('0x1d')](function(_0x2630ec){_0xa9143c[_0x4f7b('0x50')]=_0x2630ec;return _0xa9143c;})['then'](respondWithFilteredResult(_0x486187,_0x26fe5b))[_0x4f7b('0x51')](handleError(_0x486187,null));};exports[_0x4f7b('0x52')]=function(_0x148da8,_0x5003f1){var _0x16eaef={'raw':![],'where':{'id':_0x148da8[_0x4f7b('0x53')]['id']}},_0x3faadf={};_0x3faadf[_0x4f7b('0x3c')]=_[_0x4f7b('0x3b')](db[_0x4f7b('0x4c')][_0x4f7b('0x39')]);_0x3faadf[_0x4f7b('0x3d')]=_[_0x4f7b('0x3b')](_0x148da8[_0x4f7b('0x3d')]);_0x3faadf['filters']=_[_0x4f7b('0x3f')](_0x3faadf[_0x4f7b('0x3c')],_0x3faadf[_0x4f7b('0x3d')]);_0x16eaef['attributes']=_[_0x4f7b('0x3f')](_0x3faadf[_0x4f7b('0x3c')],qs[_0x4f7b('0x40')](_0x148da8[_0x4f7b('0x3d')][_0x4f7b('0x40')]));_0x16eaef[_0x4f7b('0x3e')]=_0x16eaef['attributes'][_0x4f7b('0x54')]?_0x16eaef[_0x4f7b('0x3e')]:_0x3faadf[_0x4f7b('0x3c')];if(_0x148da8['query'][_0x4f7b('0x4d')]){_0x16eaef[_0x4f7b('0x4e')]=[{'all':!![]}];}_0x16eaef=_[_0x4f7b('0x4a')]({},_0x16eaef,_0x148da8[_0x4f7b('0x4b')]);return db[_0x4f7b('0x4c')][_0x4f7b('0x55')](_0x16eaef)['then'](handleEntityNotFound(_0x5003f1,null))[_0x4f7b('0x1d')](respondWithResult(_0x5003f1,null))['catch'](handleError(_0x5003f1,null));};exports['clone']=function(_0x5aef6e,_0x21e852){var _0x3dfade={'where':{'id':_0x5aef6e['params']['id']}},_0x27b2e1={};_0x27b2e1['model']=_[_0x4f7b('0x3b')](db[_0x4f7b('0x4c')]['rawAttributes']);_0x3dfade[_0x4f7b('0x3e')]=_[_0x4f7b('0x3f')](_0x27b2e1[_0x4f7b('0x3c')],qs[_0x4f7b('0x40')](_0x5aef6e['query'][_0x4f7b('0x40')]));_0x3dfade[_0x4f7b('0x3e')]=_0x3dfade[_0x4f7b('0x3e')][_0x4f7b('0x54')]?_0x3dfade[_0x4f7b('0x3e')]:_0x27b2e1[_0x4f7b('0x3c')];if(_0x5aef6e[_0x4f7b('0x3d')]['includeAll']){_0x3dfade['include']=[{'all':!![]}];}_0x3dfade=_['merge']({},_0x3dfade,_0x5aef6e[_0x4f7b('0x4b')]);return db['Trunk']['find'](_0x3dfade)['then'](handleEntityNotFound(_0x21e852,null))['then'](function(_0x4a35d1){if(_0x4a35d1){var _0x2715b5=_0x4a35d1[_0x4f7b('0x32')]({'plain':!![]});_0x2715b5=qs[_0x4f7b('0x56')](_0x2715b5,['id',_0x4f7b('0x57'),_0x4f7b('0x58')]);_0x5aef6e[_0x4f7b('0x59')]=_[_0x4f7b('0x56')](_0x5aef6e[_0x4f7b('0x59')],['id',_0x4f7b('0x57'),_0x4f7b('0x58')]);return db[_0x4f7b('0x4c')][_0x4f7b('0x5a')](_[_0x4f7b('0x4a')](_0x2715b5,_0x5aef6e[_0x4f7b('0x59')]),{'include':_0x5aef6e[_0x4f7b('0x3d')][_0x4f7b('0x4d')]?[{'all':!![]}]:undefined})[_0x4f7b('0x1d')](function(_0x548735){var _0x1b1a72=_0x5aef6e[_0x4f7b('0x5b')][_0x4f7b('0x32')]({'plain':!![]});if(!_0x1b1a72)throw new Error(_0x4f7b('0x5c'));if(_0x1b1a72[_0x4f7b('0x5d')]==='user'){var _0x4b9f3a=_0x548735[_0x4f7b('0x32')]({'plain':!![]});var _0x5a2b3d=_0x4f7b('0x33');return db[_0x4f7b('0x5e')][_0x4f7b('0x55')]({'where':{'name':_0x5a2b3d,'userProfileId':_0x1b1a72[_0x4f7b('0x5f')]},'raw':!![]})['then'](function(_0x27ac22){if(_0x27ac22&&_0x27ac22[_0x4f7b('0x60')]===0x0){return db[_0x4f7b('0x34')]['create']({'name':_0x4b9f3a['name'],'resourceId':_0x4b9f3a['id'],'type':_0x27ac22['name'],'sectionId':_0x27ac22['id']},{})[_0x4f7b('0x1d')](function(){return _0x548735;});}else{return _0x548735;}})['catch'](function(_0x49ff77){logger['error'](_0x4f7b('0x61'),_0x49ff77);throw _0x49ff77;});}return _0x548735;});}})[_0x4f7b('0x1d')](respondWithResult(_0x21e852,0xc9))[_0x4f7b('0x51')](handleError(_0x21e852,null));};exports['create']=function(_0x6be571,_0x3fd55a,_0x56b3c7){var _0x57874c;return db[_0x4f7b('0x4c')][_0x4f7b('0x5a')](_0x6be571[_0x4f7b('0x59')],{'raw':!![]})[_0x4f7b('0x1d')](function(_0x51ff0c){_0x57874c=_0x51ff0c;return db[_0x4f7b('0x4c')][_0x4f7b('0x4f')]({'raw':!![]});})[_0x4f7b('0x1d')](function(_0x2cb5f1){var _0x2ac8db=fs[_0x4f7b('0x62')](path['join'](config[_0x4f7b('0x63')],_0x4f7b('0x64')),_0x4f7b('0x65'));var _0x220f21=fs[_0x4f7b('0x62')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x4f7b('0x65'));var _0x306057=ejs[_0x4f7b('0x66')](_0x2ac8db,{'trunks':_0x2cb5f1||[]});fs[_0x4f7b('0x67')](_0x4f7b('0x68'),_0x306057);if(_0x57874c['registry']){var _0x960913=ejs[_0x4f7b('0x66')](_0x220f21,{'trunks':_0x2cb5f1||[]});fs[_0x4f7b('0x67')](_0x4f7b('0x69'),_0x960913);}})[_0x4f7b('0x1d')](function(){return respondWithRpcPromise(_0x4f7b('0x6a'),_0x4f7b('0x5a'),{'module':_0x4f7b('0x6b')});})[_0x4f7b('0x1d')](function(){var _0x6e6ba3=_0x6be571[_0x4f7b('0x5b')][_0x4f7b('0x32')]({'plain':!![]});if(!_0x6e6ba3)throw new Error(_0x4f7b('0x5c'));if(_0x6e6ba3[_0x4f7b('0x5d')]===_0x4f7b('0x5b')){var _0x33f3a0=_0x57874c[_0x4f7b('0x32')]({'plain':!![]});return db[_0x4f7b('0x5e')]['find']({'where':{'name':'Trunks','userProfileId':_0x6e6ba3[_0x4f7b('0x5f')]},'raw':!![]})[_0x4f7b('0x1d')](function(_0x38de9f){if(_0x38de9f&&_0x38de9f[_0x4f7b('0x60')]===0x0){return db['UserProfileResource'][_0x4f7b('0x5a')]({'name':_0x33f3a0[_0x4f7b('0x36')],'resourceId':_0x33f3a0['id'],'type':_0x38de9f[_0x4f7b('0x36')],'sectionId':_0x38de9f['id']},{})[_0x4f7b('0x1d')](function(){return _0x57874c;});}else{return _0x57874c;}})[_0x4f7b('0x51')](function(_0x378587){logger[_0x4f7b('0x22')](_0x4f7b('0x61'),_0x378587);throw _0x378587;});}return _0x57874c;})[_0x4f7b('0x1d')](respondWithResult(_0x3fd55a,0xc9))[_0x4f7b('0x51')](handleError(_0x3fd55a,null));};exports[_0x4f7b('0x30')]=function(_0x15fc22,_0x26b5cb,_0x278d72){var _0x121e19;return db['Trunk'][_0x4f7b('0x55')]({'where':{'id':_0x15fc22[_0x4f7b('0x53')]['id']}})['then'](handleEntityNotFound(_0x26b5cb,null))['then'](saveUpdates(_0x15fc22[_0x4f7b('0x59')],null))[_0x4f7b('0x1d')](function(_0x3d25a6){if(_0x3d25a6){_0x121e19=_0x3d25a6;return db[_0x4f7b('0x4c')][_0x4f7b('0x4f')]({'raw':!![]});}})[_0x4f7b('0x1d')](function(_0x1f7692){if(_0x1f7692){var _0x48d9c6=fs['readFileSync'](path[_0x4f7b('0x6c')](config[_0x4f7b('0x63')],_0x4f7b('0x64')),_0x4f7b('0x65'));var _0x52997f=fs[_0x4f7b('0x62')](path[_0x4f7b('0x6c')](config['root'],_0x4f7b('0x6d')),_0x4f7b('0x65'));var _0x50aabe=ejs['render'](_0x48d9c6,{'trunks':_0x1f7692||[]});fs[_0x4f7b('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x50aabe);var _0x58d04a=ejs['render'](_0x52997f,{'trunks':_0x1f7692||[]});fs[_0x4f7b('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x58d04a);return respondWithRpcPromise(_0x4f7b('0x6a'),_0x4f7b('0x30'),{'module':_0x4f7b('0x6b')});}return null;})[_0x4f7b('0x1d')](function(_0x19d106){if(_0x19d106){return _0x121e19;}})[_0x4f7b('0x1d')](respondWithResult(_0x26b5cb,null))[_0x4f7b('0x51')](handleError(_0x26b5cb,null));};exports[_0x4f7b('0x31')]=function(_0x39799b,_0x4da13f,_0x476637){var _0x35c3cb;return db[_0x4f7b('0x4c')][_0x4f7b('0x55')]({'where':{'id':_0x39799b[_0x4f7b('0x53')]['id']}})[_0x4f7b('0x1d')](handleEntityNotFound(_0x4da13f,null))[_0x4f7b('0x1d')](removeEntity(_0x4da13f,null))[_0x4f7b('0x1d')](function(){return db['Trunk'][_0x4f7b('0x4f')]({'raw':!![]});})[_0x4f7b('0x1d')](function(_0xfc5752){var _0x4d9ed4=fs[_0x4f7b('0x62')](path['join'](config[_0x4f7b('0x63')],_0x4f7b('0x64')),'utf8');var _0x5d4c37=fs[_0x4f7b('0x62')](path['join'](config[_0x4f7b('0x63')],'server/files/templates/registry.ejs'),_0x4f7b('0x65'));var _0x170a12=ejs[_0x4f7b('0x66')](_0x4d9ed4,{'trunks':_0xfc5752});var _0x4ece3a=ejs[_0x4f7b('0x66')](_0x5d4c37,{'trunks':_0xfc5752});fs['writeFileSync'](_0x4f7b('0x68'),_0x170a12);fs[_0x4f7b('0x67')](_0x4f7b('0x69'),_0x4ece3a);return respondWithRpcPromise(_0x4f7b('0x6a'),_0x4f7b('0x31'),{'module':_0x4f7b('0x6b')});})[_0x4f7b('0x51')](handleError(_0x4da13f,null));}; \ No newline at end of file +var _0x578c=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../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','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','Content-Range','apply','reject','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Trunk','count','includeAll','include','rows','params','rawAttributes','find','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','findAll','root','server/files/templates/trunk.ejs','utf8','readFileSync','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x1a17dd,_0x46f57d){var _0x54a08f=function(_0x35ebca){while(--_0x35ebca){_0x1a17dd['push'](_0x1a17dd['shift']());}};_0x54a08f(++_0x46f57d);}(_0x578c,0x158));var _0xc578=function(_0x2e2795,_0x3865b2){_0x2e2795=_0x2e2795-0x0;var _0x3c7b99=_0x578c[_0x2e2795];return _0x3c7b99;};'use strict';var pdf=require(_0xc578('0x0'));var emlformat=require(_0xc578('0x1'));var rimraf=require(_0xc578('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc578('0x3'));var rp=require(_0xc578('0x4'));var moment=require(_0xc578('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc578('0x6'));var util=require(_0xc578('0x7'));var path=require(_0xc578('0x8'));var sox=require(_0xc578('0x9'));var csv=require(_0xc578('0xa'));var ejs=require(_0xc578('0xb'));var fs=require('fs');var _=require(_0xc578('0xc'));var squel=require(_0xc578('0xd'));var crypto=require(_0xc578('0xe'));var jsforce=require(_0xc578('0xf'));var deskjs=require(_0xc578('0x10'));var toCsv=require(_0xc578('0xa'));var querystring=require(_0xc578('0x11'));var Papa=require(_0xc578('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc578('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc578('0x14'));var logger=require(_0xc578('0x15'))(_0xc578('0x16'));var utils=require('../../config/utils');var config=require(_0xc578('0x17'));var db=require(_0xc578('0x18'))['db'];var jayson=require(_0xc578('0x19'));var client=jayson['client'][_0xc578('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3dbda8,_0x335415,_0x191ab2){if(_0x191ab2){var _0x1e28b9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e28b9['test'](_0x335415)){return _0x3dbda8;}else{throw new db[(_0xc578('0x1b'))][(_0xc578('0x1c'))](_0xc578('0x1d'));}}else{return _0x3dbda8;}}function respondWithRpcPromise(_0x251007,_0x2ce76d,_0x1c7078,_0x3294f8){return new BPromise(function(_0x13b6d4,_0x109756){var _0x3f6f18=_0x3294f8||client;return _0x3f6f18[_0xc578('0x1e')](_0x251007,_0x1c7078)[_0xc578('0x1f')](function(_0x45e527){logger[_0xc578('0x20')](_0xc578('0x21'),_0x2ce76d,_0xc578('0x22'));logger[_0xc578('0x23')](_0xc578('0x24'),_0x2ce76d,'request\x20sent',JSON[_0xc578('0x25')](_0x45e527));if(_0x45e527[_0xc578('0x26')]){if(_0x45e527[_0xc578('0x26')][_0xc578('0x27')]===0x1f4){logger['error'](_0xc578('0x21'),_0x2ce76d,_0x45e527[_0xc578('0x26')][_0xc578('0x28')]);return _0x109756(_0x45e527['error']['message']);}logger['error'](_0xc578('0x21'),_0x2ce76d,_0x45e527[_0xc578('0x26')][_0xc578('0x28')]);return _0x13b6d4(_0x45e527[_0xc578('0x26')][_0xc578('0x28')]);}else{logger['info'](_0xc578('0x21'),_0x2ce76d,_0xc578('0x22'));_0x13b6d4(_0x45e527[_0xc578('0x29')]['message']);}})[_0xc578('0x2a')](function(_0x54388f){logger['error'](_0xc578('0x21'),_0x2ce76d,_0x54388f);_0x109756(_0x54388f);});});}function respondWithStatusCode(_0xbf3f05,_0xf4090e){_0xf4090e=_0xf4090e||0xcc;return function(_0x431638){if(_0x431638){return _0xbf3f05['sendStatus'](_0xf4090e);}return _0xbf3f05[_0xc578('0x2b')](_0xf4090e)[_0xc578('0x2c')]();};}function respondWithResult(_0x5c1a03,_0x2b3a2f){_0x2b3a2f=_0x2b3a2f||0xc8;return function(_0x2762d9){if(_0x2762d9){return _0x5c1a03['status'](_0x2b3a2f)[_0xc578('0x2d')](_0x2762d9);}};}function respondWithFilteredResult(_0x5141ac,_0x1622d1){return function(_0x56d9e1){if(_0x56d9e1){var _0x1e4623=_0x56d9e1['count'],_0x9474f7=_0x1622d1[_0xc578('0x2e')],_0x5398f7=_0x1622d1[_0xc578('0x2e')]+_0x1622d1[_0xc578('0x2f')],_0x5d0023;if(_0x5398f7>=_0x1e4623){_0x5398f7=_0x1e4623;_0x5d0023=0xc8;}else{_0x5d0023=0xce;}_0x5141ac['status'](_0x5d0023);return _0x5141ac['set'](_0xc578('0x30'),_0x9474f7+'-'+_0x5398f7+'/'+_0x1e4623)[_0xc578('0x2d')](_0x56d9e1);}return null;};}function patchUpdates(_0x3c3690){return function(_0x169586){try{jsonpatch[_0xc578('0x31')](_0x169586,_0x3c3690,!![]);}catch(_0x313c01){return BPromise[_0xc578('0x32')](_0x313c01);}return _0x169586['save']();};}function saveUpdates(_0x3781a8,_0x30357d){return function(_0x1bb6cb){if(_0x1bb6cb){return _0x1bb6cb[_0xc578('0x33')](_0x3781a8)[_0xc578('0x1f')](function(_0x472e38){return _0x472e38;});}return null;};}function removeEntity(_0x83799d,_0x235e08){return function(_0x227dc9){if(_0x227dc9){return _0x227dc9[_0xc578('0x34')]()[_0xc578('0x1f')](function(){var _0x3ac265=_0x227dc9[_0xc578('0x35')]({'plain':!![]});var _0x3ac4c1=_0xc578('0x36');return db[_0xc578('0x37')][_0xc578('0x34')]({'where':{'type':_0x3ac4c1,'resourceId':_0x3ac265['id']}})[_0xc578('0x1f')](function(){return _0x227dc9;});})[_0xc578('0x1f')](function(){_0x83799d['status'](0xcc)[_0xc578('0x2c')]();});}};}function handleEntityNotFound(_0x2428c7,_0x2c5abf){return function(_0x1cf2fe){if(!_0x1cf2fe){_0x2428c7[_0xc578('0x38')](0x194);}return _0x1cf2fe;};}function handleError(_0x1d4c1a,_0x2f60ec){_0x2f60ec=_0x2f60ec||0x1f4;return function(_0x45aed0){logger[_0xc578('0x26')](_0x45aed0[_0xc578('0x39')]);if(_0x45aed0['name']){delete _0x45aed0[_0xc578('0x3a')];}_0x1d4c1a[_0xc578('0x2b')](_0x2f60ec)[_0xc578('0x3b')](_0x45aed0);};}exports[_0xc578('0x3c')]=function(_0x16b0b6,_0x4c93b4){var _0x29e20d={},_0x51767d={},_0x37c9a4={'count':0x0,'rows':[]};var _0x1f32c6=_[_0xc578('0x3d')](db['Trunk']['rawAttributes'],function(_0x5e3d16){return{'name':_0x5e3d16[_0xc578('0x3e')],'type':_0x5e3d16[_0xc578('0x3f')][_0xc578('0x40')]};});_0x51767d[_0xc578('0x41')]=_[_0xc578('0x3d')](_0x1f32c6,_0xc578('0x3a'));_0x51767d['query']=_[_0xc578('0x42')](_0x16b0b6[_0xc578('0x43')]);_0x51767d[_0xc578('0x44')]=_[_0xc578('0x45')](_0x51767d[_0xc578('0x41')],_0x51767d[_0xc578('0x43')]);_0x29e20d[_0xc578('0x46')]=_[_0xc578('0x45')](_0x51767d['model'],qs[_0xc578('0x47')](_0x16b0b6['query'][_0xc578('0x47')]));_0x29e20d['attributes']=_0x29e20d[_0xc578('0x46')][_0xc578('0x48')]?_0x29e20d[_0xc578('0x46')]:_0x51767d['model'];if(!_0x16b0b6['query'][_0xc578('0x49')](_0xc578('0x4a'))){_0x29e20d[_0xc578('0x2f')]=qs['limit'](_0x16b0b6['query'][_0xc578('0x2f')]);_0x29e20d[_0xc578('0x2e')]=qs['offset'](_0x16b0b6[_0xc578('0x43')][_0xc578('0x2e')]);}_0x29e20d[_0xc578('0x4b')]=qs[_0xc578('0x4c')](_0x16b0b6[_0xc578('0x43')][_0xc578('0x4c')]);_0x29e20d[_0xc578('0x4d')]=qs[_0xc578('0x44')](_[_0xc578('0x4e')](_0x16b0b6[_0xc578('0x43')],_0x51767d[_0xc578('0x44')]),_0x1f32c6);if(_0x16b0b6['query'][_0xc578('0x4f')]){_0x29e20d['where']=_[_0xc578('0x50')](_0x29e20d[_0xc578('0x4d')],{'$or':_[_0xc578('0x3d')](_0x1f32c6,function(_0x332384){if(_0x332384[_0xc578('0x3f')]!=='VIRTUAL'){var _0x1bfb5b={};_0x1bfb5b[_0x332384['name']]={'$like':'%'+_0x16b0b6[_0xc578('0x43')][_0xc578('0x4f')]+'%'};return _0x1bfb5b;}})});}_0x29e20d=_[_0xc578('0x50')]({},_0x29e20d,_0x16b0b6[_0xc578('0x51')]);var _0x576435={'where':_0x29e20d[_0xc578('0x4d')]};return db[_0xc578('0x52')][_0xc578('0x53')](_0x576435)[_0xc578('0x1f')](function(_0x41cb81){_0x37c9a4[_0xc578('0x53')]=_0x41cb81;if(_0x16b0b6['query'][_0xc578('0x54')]){_0x29e20d[_0xc578('0x55')]=[{'all':!![]}];}return db[_0xc578('0x52')]['findAll'](_0x29e20d);})[_0xc578('0x1f')](function(_0x233b76){_0x37c9a4[_0xc578('0x56')]=_0x233b76;return _0x37c9a4;})[_0xc578('0x1f')](respondWithFilteredResult(_0x4c93b4,_0x29e20d))[_0xc578('0x2a')](handleError(_0x4c93b4,null));};exports['show']=function(_0x2b88d9,_0x3cc17c){var _0x5b5932={'raw':![],'where':{'id':_0x2b88d9[_0xc578('0x57')]['id']}},_0x7108a1={};_0x7108a1[_0xc578('0x41')]=_[_0xc578('0x42')](db[_0xc578('0x52')][_0xc578('0x58')]);_0x7108a1[_0xc578('0x43')]=_['keys'](_0x2b88d9[_0xc578('0x43')]);_0x7108a1[_0xc578('0x44')]=_[_0xc578('0x45')](_0x7108a1[_0xc578('0x41')],_0x7108a1[_0xc578('0x43')]);_0x5b5932['attributes']=_[_0xc578('0x45')](_0x7108a1['model'],qs[_0xc578('0x47')](_0x2b88d9[_0xc578('0x43')][_0xc578('0x47')]));_0x5b5932['attributes']=_0x5b5932[_0xc578('0x46')][_0xc578('0x48')]?_0x5b5932[_0xc578('0x46')]:_0x7108a1[_0xc578('0x41')];if(_0x2b88d9[_0xc578('0x43')][_0xc578('0x54')]){_0x5b5932[_0xc578('0x55')]=[{'all':!![]}];}_0x5b5932=_['merge']({},_0x5b5932,_0x2b88d9[_0xc578('0x51')]);return db['Trunk']['find'](_0x5b5932)[_0xc578('0x1f')](handleEntityNotFound(_0x3cc17c,null))[_0xc578('0x1f')](respondWithResult(_0x3cc17c,null))[_0xc578('0x2a')](handleError(_0x3cc17c,null));};exports['clone']=function(_0x2dc099,_0x5e5b7b){var _0x32d93a={'where':{'id':_0x2dc099[_0xc578('0x57')]['id']}},_0x22150a={};_0x22150a[_0xc578('0x41')]=_[_0xc578('0x42')](db[_0xc578('0x52')]['rawAttributes']);_0x32d93a[_0xc578('0x46')]=_['intersection'](_0x22150a[_0xc578('0x41')],qs[_0xc578('0x47')](_0x2dc099['query'][_0xc578('0x47')]));_0x32d93a['attributes']=_0x32d93a[_0xc578('0x46')][_0xc578('0x48')]?_0x32d93a[_0xc578('0x46')]:_0x22150a['model'];if(_0x2dc099['query'][_0xc578('0x54')]){_0x32d93a[_0xc578('0x55')]=[{'all':!![]}];}_0x32d93a=_[_0xc578('0x50')]({},_0x32d93a,_0x2dc099[_0xc578('0x51')]);return db[_0xc578('0x52')][_0xc578('0x59')](_0x32d93a)[_0xc578('0x1f')](handleEntityNotFound(_0x5e5b7b,null))[_0xc578('0x1f')](function(_0x1e7d8f){if(_0x1e7d8f){var _0x1a2976=_0x1e7d8f['get']({'plain':!![]});_0x1a2976=qs[_0xc578('0x5a')](_0x1a2976,['id',_0xc578('0x5b'),_0xc578('0x5c')]);_0x2dc099[_0xc578('0x5d')]=_[_0xc578('0x5a')](_0x2dc099['body'],['id',_0xc578('0x5b'),_0xc578('0x5c')]);return db[_0xc578('0x52')]['create'](_['merge'](_0x1a2976,_0x2dc099[_0xc578('0x5d')]),{'include':_0x2dc099['query'][_0xc578('0x54')]?[{'all':!![]}]:undefined})[_0xc578('0x1f')](function(_0x2d25a4){var _0x5c572d=_0x2dc099[_0xc578('0x5e')][_0xc578('0x35')]({'plain':!![]});if(!_0x5c572d)throw new Error(_0xc578('0x5f'));if(_0x5c572d[_0xc578('0x60')]==='user'){var _0x267f86=_0x2d25a4[_0xc578('0x35')]({'plain':!![]});var _0x367e02=_0xc578('0x36');return db[_0xc578('0x61')]['find']({'where':{'name':_0x367e02,'userProfileId':_0x5c572d[_0xc578('0x62')]},'raw':!![]})[_0xc578('0x1f')](function(_0x5cea0d){if(_0x5cea0d&&_0x5cea0d[_0xc578('0x63')]===0x0){return db[_0xc578('0x37')]['create']({'name':_0x267f86[_0xc578('0x3a')],'resourceId':_0x267f86['id'],'type':_0x5cea0d['name'],'sectionId':_0x5cea0d['id']},{})[_0xc578('0x1f')](function(){return _0x2d25a4;});}else{return _0x2d25a4;}})['catch'](function(_0x9aa020){logger[_0xc578('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9aa020);throw _0x9aa020;});}return _0x2d25a4;});}})['then'](respondWithResult(_0x5e5b7b,0xc9))[_0xc578('0x2a')](handleError(_0x5e5b7b,null));};exports[_0xc578('0x64')]=function(_0xeb731f,_0x48f8e0,_0x37ffcc){var _0x432a21;return db['Trunk'][_0xc578('0x64')](_0xeb731f['body'],{'raw':!![]})[_0xc578('0x1f')](function(_0x194344){_0x432a21=_0x194344;return db['Trunk'][_0xc578('0x65')]({'raw':!![]});})[_0xc578('0x1f')](function(_0x3bcfd1){var _0x43553c=fs['readFileSync'](path['join'](config[_0xc578('0x66')],_0xc578('0x67')),_0xc578('0x68'));var _0x19de7e=fs[_0xc578('0x69')](path[_0xc578('0x6a')](config[_0xc578('0x66')],_0xc578('0x6b')),_0xc578('0x68'));var _0x13e98e=ejs[_0xc578('0x6c')](_0x43553c,{'trunks':_0x3bcfd1||[]});fs[_0xc578('0x6d')](_0xc578('0x6e'),_0x13e98e);if(_0x432a21[_0xc578('0x6f')]){var _0x164254=ejs[_0xc578('0x6c')](_0x19de7e,{'trunks':_0x3bcfd1||[]});fs[_0xc578('0x6d')](_0xc578('0x70'),_0x164254);}})[_0xc578('0x1f')](function(){return respondWithRpcPromise('Reload',_0xc578('0x64'),{'module':_0xc578('0x71')});})[_0xc578('0x1f')](function(){var _0x4616b5=_0xeb731f[_0xc578('0x5e')][_0xc578('0x35')]({'plain':!![]});if(!_0x4616b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4616b5['role']==='user'){var _0x2dc023=_0x432a21[_0xc578('0x35')]({'plain':!![]});return db[_0xc578('0x61')][_0xc578('0x59')]({'where':{'name':_0xc578('0x36'),'userProfileId':_0x4616b5['userProfileId']},'raw':!![]})[_0xc578('0x1f')](function(_0x21059c){if(_0x21059c&&_0x21059c['autoAssociation']===0x0){return db[_0xc578('0x37')][_0xc578('0x64')]({'name':_0x2dc023[_0xc578('0x3a')],'resourceId':_0x2dc023['id'],'type':_0x21059c[_0xc578('0x3a')],'sectionId':_0x21059c['id']},{})[_0xc578('0x1f')](function(){return _0x432a21;});}else{return _0x432a21;}})[_0xc578('0x2a')](function(_0x4410f9){logger['error'](_0xc578('0x72'),_0x4410f9);throw _0x4410f9;});}return _0x432a21;})[_0xc578('0x1f')](respondWithResult(_0x48f8e0,0xc9))[_0xc578('0x2a')](handleError(_0x48f8e0,null));};exports['update']=function(_0x58ba22,_0x5f038e,_0x4021cf){var _0x59b110;return db[_0xc578('0x52')][_0xc578('0x59')]({'where':{'id':_0x58ba22[_0xc578('0x57')]['id']}})[_0xc578('0x1f')](handleEntityNotFound(_0x5f038e,null))[_0xc578('0x1f')](saveUpdates(_0x58ba22[_0xc578('0x5d')],null))[_0xc578('0x1f')](function(_0x33b337){if(_0x33b337){_0x59b110=_0x33b337;return db[_0xc578('0x52')]['findAll']({'raw':!![]});}})[_0xc578('0x1f')](function(_0x549d08){if(_0x549d08){var _0x1b5dfe=fs[_0xc578('0x69')](path['join'](config[_0xc578('0x66')],_0xc578('0x67')),_0xc578('0x68'));var _0x1088ee=fs['readFileSync'](path[_0xc578('0x6a')](config[_0xc578('0x66')],_0xc578('0x6b')),'utf8');var _0x3414a9=ejs[_0xc578('0x6c')](_0x1b5dfe,{'trunks':_0x549d08||[]});fs[_0xc578('0x6d')](_0xc578('0x6e'),_0x3414a9);var _0x3d7a75=ejs[_0xc578('0x6c')](_0x1088ee,{'trunks':_0x549d08||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3d7a75);return respondWithRpcPromise(_0xc578('0x73'),_0xc578('0x33'),{'module':_0xc578('0x71')});}return null;})['then'](function(_0x2b7685){if(_0x2b7685){return _0x59b110;}})[_0xc578('0x1f')](respondWithResult(_0x5f038e,null))['catch'](handleError(_0x5f038e,null));};exports[_0xc578('0x34')]=function(_0x47ec61,_0x33d133,_0x3eeb70){var _0x41ead7;return db[_0xc578('0x52')][_0xc578('0x59')]({'where':{'id':_0x47ec61['params']['id']}})[_0xc578('0x1f')](handleEntityNotFound(_0x33d133,null))[_0xc578('0x1f')](removeEntity(_0x33d133,null))[_0xc578('0x1f')](function(){return db[_0xc578('0x52')][_0xc578('0x65')]({'raw':!![]});})[_0xc578('0x1f')](function(_0x1b5fe0){var _0x777dae=fs[_0xc578('0x69')](path['join'](config[_0xc578('0x66')],_0xc578('0x67')),_0xc578('0x68'));var _0x2ae2af=fs[_0xc578('0x69')](path[_0xc578('0x6a')](config['root'],_0xc578('0x6b')),'utf8');var _0x32fba8=ejs[_0xc578('0x6c')](_0x777dae,{'trunks':_0x1b5fe0});var _0x5aaace=ejs[_0xc578('0x6c')](_0x2ae2af,{'trunks':_0x1b5fe0});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x32fba8);fs[_0xc578('0x6d')](_0xc578('0x70'),_0x5aaace);return respondWithRpcPromise(_0xc578('0x73'),_0xc578('0x34'),{'module':_0xc578('0x71')});})[_0xc578('0x2a')](handleError(_0x33d133,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index a3efd98..b2507fb 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 _0x947c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','../../config/logger','api'];(function(_0x48aaca,_0x140945){var _0xac5ed9=function(_0x180b19){while(--_0x180b19){_0x48aaca['push'](_0x48aaca['shift']());}};_0xac5ed9(++_0x140945);}(_0x947c,0x1aa));var _0xc947=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x947c[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0xc947('0x0'));var util=require('util');var logger=require(_0xc947('0x1'))(_0xc947('0x2'));var moment=require(_0xc947('0x3'));var BPromise=require(_0xc947('0x4'));var rp=require(_0xc947('0x5'));var fs=require('fs');var path=require(_0xc947('0x6'));var rimraf=require(_0xc947('0x7'));var config=require(_0xc947('0x8'));var attributes=require(_0xc947('0x9'));module[_0xc947('0xa')]=function(_0x30c477,_0x1a8d99){return _0x30c477['define'](_0xc947('0xb'),attributes,{'tableName':_0xc947('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a3d=['rimraf','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x213dcf,_0xe4d1ca){var _0x35c1c1=function(_0x389305){while(--_0x389305){_0x213dcf['push'](_0x213dcf['shift']());}};_0x35c1c1(++_0xe4d1ca);}(_0x0a3d,0xe3));var _0xd0a3=function(_0x93de14,_0x3b5298){_0x93de14=_0x93de14-0x0;var _0x3c613b=_0x0a3d[_0x93de14];return _0x3c613b;};'use strict';var _=require(_0xd0a3('0x0'));var util=require(_0xd0a3('0x1'));var logger=require(_0xd0a3('0x2'))(_0xd0a3('0x3'));var moment=require('moment');var BPromise=require(_0xd0a3('0x4'));var rp=require(_0xd0a3('0x5'));var fs=require('fs');var path=require(_0xd0a3('0x6'));var rimraf=require(_0xd0a3('0x7'));var config=require(_0xd0a3('0x8'));var attributes=require(_0xd0a3('0x9'));module['exports']=function(_0x2a5dc3,_0x2abcf8){return _0x2a5dc3[_0xd0a3('0xa')](_0xd0a3('0xb'),attributes,{'tableName':_0xd0a3('0xc'),'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 91811cc..b273703 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 _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(_0x16ecad,_0x205047){var _0x313ff7=function(_0x58b16a){while(--_0x58b16a){_0x16ecad['push'](_0x16ecad['shift']());}};_0x313ff7(++_0x205047);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'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 +var _0xb7e7=['request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','include','map','model','ShowTrunk','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0xeee00e,_0x33de55){var _0x1c12af=function(_0x132aa1){while(--_0x132aa1){_0xeee00e['push'](_0xeee00e['shift']());}};_0x1c12af(++_0x33de55);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xb7e7[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Trunk,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetTrunk',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['Trunk'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowTrunk',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index ffb0a43..a965176 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 _0x12ec=['/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','update','put','changePassword','delete','removeQueues','destroy','/:id/chat_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','/:id','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','bulkCreate','addContacts','create','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions'];(function(_0x13c577,_0x2d3ef7){var _0x542bd8=function(_0x155f83){while(--_0x155f83){_0x13c577['push'](_0x13c577['shift']());}};_0x542bd8(++_0x2d3ef7);}(_0x12ec,0x1e4));var _0xc12e=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x12ec[_0x5e6cb8];return _0x3faeb3;};'use strict';var multer=require(_0xc12e('0x0'));var util=require(_0xc12e('0x1'));var path=require(_0xc12e('0x2'));var timeout=require(_0xc12e('0x3'));var express=require(_0xc12e('0x4'));var router=express[_0xc12e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc12e('0x6'));var config=require(_0xc12e('0x7'));var controller=require(_0xc12e('0x8'));router[_0xc12e('0x9')]('/',auth[_0xc12e('0xa')](),controller[_0xc12e('0xb')]);router['get'](_0xc12e('0xc'),auth[_0xc12e('0xa')](),controller['describe']);router[_0xc12e('0x9')](_0xc12e('0xd'),auth['isAuthenticated'](),controller[_0xc12e('0xe')]);router['get'](_0xc12e('0xf'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x10')]);router[_0xc12e('0x9')]('/:id/avatar',controller[_0xc12e('0x11')]);router[_0xc12e('0x9')](_0xc12e('0x12'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x13')]);router[_0xc12e('0x9')](_0xc12e('0x14'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x15')]);router['get'](_0xc12e('0x16'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x17')]);router['get'](_0xc12e('0x18'),auth[_0xc12e('0xa')](),controller['getGroups']);router[_0xc12e('0x9')]('/:id/recordings',auth[_0xc12e('0xa')](),controller[_0xc12e('0x19')]);router[_0xc12e('0x9')](_0xc12e('0x1a'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x1b')]);router[_0xc12e('0x9')](_0xc12e('0x1c'),auth[_0xc12e('0xa')](),controller['getChatInteractions']);router[_0xc12e('0x9')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router['get'](_0xc12e('0x1d'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x1e')]);router[_0xc12e('0x9')](_0xc12e('0x1f'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x20')]);router['get'](_0xc12e('0x21'),auth['isAuthenticated'](),controller[_0xc12e('0x22')]);router[_0xc12e('0x9')](_0xc12e('0x23'),auth[_0xc12e('0xa')](),controller['getWhatsappInteractions']);router['get'](_0xc12e('0x24'),auth['isAuthenticated'](),controller[_0xc12e('0x25')]);router[_0xc12e('0x9')](_0xc12e('0x26'),auth['isAuthenticated'](),controller['getLists']);router[_0xc12e('0x9')](_0xc12e('0x27'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x28')]);router['get'](_0xc12e('0x29'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x2a')]);router[_0xc12e('0x9')](_0xc12e('0x2b'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x2c')]);router[_0xc12e('0x9')](_0xc12e('0x2d'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x2e')]);router[_0xc12e('0x9')]('/:id/openchannel_accounts',auth[_0xc12e('0xa')](),controller['getOpenchannelAccounts']);router['get'](_0xc12e('0x2f'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x30')]);router[_0xc12e('0x9')](_0xc12e('0x31'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x32')]);router[_0xc12e('0x9')]('/:id/whatsapp_accounts',auth[_0xc12e('0xa')](),controller['getWhatsappAccounts']);router[_0xc12e('0x9')](_0xc12e('0x33'),auth[_0xc12e('0xa')](),controller['getSquareProjects']);router[_0xc12e('0x9')](_0xc12e('0x34'),auth['isAuthenticated'](),controller[_0xc12e('0x35')]);router['get'](_0xc12e('0x36'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x37')]);router[_0xc12e('0x38')]('/create_many',auth['isAuthenticated'](),controller[_0xc12e('0x39')]);router[_0xc12e('0x38')]('/:id/contacts',auth[_0xc12e('0xa')](),controller[_0xc12e('0x3a')]);router['post']('/',auth[_0xc12e('0xa')](),controller[_0xc12e('0x3b')]);router[_0xc12e('0x38')]('/:id/queues',auth[_0xc12e('0xa')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x152f43,_0x731708,_0x38f270){_0x38f270(null,path[_0xc12e('0x3c')](config[_0xc12e('0x3d')],_0xc12e('0x3e')));},'filename':function(_0x66161d,_0x33bfbd,_0x9985de){_0x9985de(null,util[_0xc12e('0x3f')](_0xc12e('0x40'),Date[_0xc12e('0x41')](),_0x33bfbd[_0xc12e('0x42')]));}})});router[_0xc12e('0x38')](_0xc12e('0x43'),upload[_0xc12e('0x44')](_0xc12e('0x45')),controller['addAvatar']);router[_0xc12e('0x38')](_0xc12e('0x46'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x47')]);router[_0xc12e('0x38')](_0xc12e('0x48'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x49')]);router[_0xc12e('0x38')](_0xc12e('0x4a'),auth[_0xc12e('0xa')](),controller['pause']);router[_0xc12e('0x38')](_0xc12e('0x4b'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x4c')]);router[_0xc12e('0x38')](_0xc12e('0x24'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x4d')]);router[_0xc12e('0x38')]('/:id/chat_interactions',auth[_0xc12e('0xa')](),controller[_0xc12e('0x4e')]);router['post'](_0xc12e('0x4f'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x50')]);router['post'](_0xc12e('0x51'),auth['isAuthenticated'](),controller[_0xc12e('0x52')]);router[_0xc12e('0x38')](_0xc12e('0x53'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x54')]);router['post'](_0xc12e('0x55'),auth['isAuthenticated'](),controller[_0xc12e('0x56')]);router[_0xc12e('0x38')](_0xc12e('0x57'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x58')]);router[_0xc12e('0x38')](_0xc12e('0x2b'),auth[_0xc12e('0xa')](),controller['addFaxAccounts']);router[_0xc12e('0x38')](_0xc12e('0x2d'),auth['isAuthenticated'](),controller[_0xc12e('0x59')]);router['post'](_0xc12e('0x5a'),auth['isAuthenticated'](),controller[_0xc12e('0x5b')]);router[_0xc12e('0x38')](_0xc12e('0x2f'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x5c')]);router[_0xc12e('0x38')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xc12e('0x5d')]);router[_0xc12e('0x38')](_0xc12e('0x5e'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x5f')]);router[_0xc12e('0x38')](_0xc12e('0x33'),auth[_0xc12e('0xa')](),controller['addSquareProjects']);router['post']('/:id/api_key',auth[_0xc12e('0xa')](),controller[_0xc12e('0x60')]);router['put'](_0xc12e('0xf'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x61')]);router[_0xc12e('0x62')]('/:id/password',auth['isAuthenticated'](),controller[_0xc12e('0x63')]);router[_0xc12e('0x64')](_0xc12e('0x14'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x65')]);router[_0xc12e('0x64')](_0xc12e('0x24'),auth[_0xc12e('0xa')](),controller['removeTeams']);router[_0xc12e('0x64')](_0xc12e('0xf'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x66')]);router[_0xc12e('0x64')](_0xc12e('0x67'),auth['isAuthenticated'](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth[_0xc12e('0xa')](),controller[_0xc12e('0x68')]);router[_0xc12e('0x64')](_0xc12e('0x51'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x69')]);router[_0xc12e('0x64')](_0xc12e('0x53'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x6a')]);router[_0xc12e('0x64')](_0xc12e('0x55'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xc12e('0x64')](_0xc12e('0x57'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x6b')]);router[_0xc12e('0x64')](_0xc12e('0x2b'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x6c')]);router[_0xc12e('0x64')](_0xc12e('0x2d'),auth[_0xc12e('0xa')](),controller['removeMailAccounts']);router[_0xc12e('0x64')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xc12e('0x64')](_0xc12e('0x2f'),auth['isAuthenticated'](),controller[_0xc12e('0x6d')]);router['delete']('/:id/chat_websites',auth[_0xc12e('0xa')](),controller['removeChatWebsites']);router['delete'](_0xc12e('0x5e'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x6e')]);router[_0xc12e('0x64')]('/:id/square_projects',auth[_0xc12e('0xa')](),controller[_0xc12e('0x6f')]);router[_0xc12e('0x64')]('/:id/api_key',auth[_0xc12e('0xa')](),controller['removeApiKey']);module[_0xc12e('0x70')]=router; \ No newline at end of file +var _0xa21c=['getAvatar','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','/:id/api_key','post','bulkCreate','addContacts','create','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','/:id/password','changePassword','delete','removeTeams','destroy','removeMailInteractions','/:id/fax_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','/:id/mail_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','/whoami','whoami','show','/:id/avatar'];(function(_0x1f73c3,_0xa8af11){var _0x20450e=function(_0x2f30fb){while(--_0x2f30fb){_0x1f73c3['push'](_0x1f73c3['shift']());}};_0x20450e(++_0xa8af11);}(_0xa21c,0xd2));var _0xca21=function(_0x5ba853,_0x14af4c){_0x5ba853=_0x5ba853-0x0;var _0x22d3b5=_0xa21c[_0x5ba853];return _0x22d3b5;};'use strict';var multer=require('multer');var util=require(_0xca21('0x0'));var path=require(_0xca21('0x1'));var timeout=require(_0xca21('0x2'));var express=require(_0xca21('0x3'));var router=express['Router']();var auth=require(_0xca21('0x4'));var interaction=require(_0xca21('0x5'));var config=require(_0xca21('0x6'));var controller=require(_0xca21('0x7'));router['get']('/',auth[_0xca21('0x8')](),controller[_0xca21('0x9')]);router[_0xca21('0xa')](_0xca21('0xb'),auth[_0xca21('0x8')](),controller['describe']);router[_0xca21('0xa')](_0xca21('0xc'),auth['isAuthenticated'](),controller[_0xca21('0xd')]);router[_0xca21('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xca21('0xe')]);router[_0xca21('0xa')](_0xca21('0xf'),controller[_0xca21('0x10')]);router[_0xca21('0xa')](_0xca21('0x11'),auth[_0xca21('0x8')](),controller['getContacts']);router[_0xca21('0xa')](_0xca21('0x12'),auth['isAuthenticated'](),controller[_0xca21('0x13')]);router[_0xca21('0xa')]('/:id/queues_rt',auth[_0xca21('0x8')](),controller[_0xca21('0x14')]);router['get'](_0xca21('0x15'),auth[_0xca21('0x8')](),controller[_0xca21('0x16')]);router[_0xca21('0xa')](_0xca21('0x17'),auth['isAuthenticated'](),controller[_0xca21('0x18')]);router[_0xca21('0xa')](_0xca21('0x19'),auth['isAuthenticated'](),controller['getScreenRecordings']);router['get'](_0xca21('0x1a'),auth[_0xca21('0x8')](),controller[_0xca21('0x1b')]);router[_0xca21('0xa')](_0xca21('0x1c'),auth['isAuthenticated'](),controller[_0xca21('0x1d')]);router[_0xca21('0xa')](_0xca21('0x1e'),auth[_0xca21('0x8')](),controller[_0xca21('0x1f')]);router[_0xca21('0xa')](_0xca21('0x20'),auth[_0xca21('0x8')](),controller['getSmsInteractions']);router['get'](_0xca21('0x21'),auth['isAuthenticated'](),controller[_0xca21('0x22')]);router[_0xca21('0xa')](_0xca21('0x23'),auth['isAuthenticated'](),controller[_0xca21('0x24')]);router['get'](_0xca21('0x25'),auth[_0xca21('0x8')](),controller[_0xca21('0x26')]);router[_0xca21('0xa')]('/:id/lists',auth[_0xca21('0x8')](),controller[_0xca21('0x27')]);router[_0xca21('0xa')](_0xca21('0x28'),auth[_0xca21('0x8')](),controller['getAgents']);router[_0xca21('0xa')](_0xca21('0x29'),auth['isAuthenticated'](),controller[_0xca21('0x2a')]);router['get']('/:id/fax_accounts',auth[_0xca21('0x8')](),controller[_0xca21('0x2b')]);router[_0xca21('0xa')]('/:id/mail_accounts',auth[_0xca21('0x8')](),controller[_0xca21('0x2c')]);router[_0xca21('0xa')](_0xca21('0x2d'),auth[_0xca21('0x8')](),controller[_0xca21('0x2e')]);router[_0xca21('0xa')](_0xca21('0x2f'),auth[_0xca21('0x8')](),controller[_0xca21('0x30')]);router['get'](_0xca21('0x31'),auth['isAuthenticated'](),controller[_0xca21('0x32')]);router[_0xca21('0xa')](_0xca21('0x33'),auth[_0xca21('0x8')](),controller[_0xca21('0x34')]);router['get'](_0xca21('0x35'),auth[_0xca21('0x8')](),controller['getSquareProjects']);router[_0xca21('0xa')](_0xca21('0x36'),auth[_0xca21('0x8')](),controller['getScheduledCalls']);router[_0xca21('0xa')](_0xca21('0x37'),auth[_0xca21('0x8')](),controller['getApiKey']);router[_0xca21('0x38')]('/create_many',auth[_0xca21('0x8')](),controller[_0xca21('0x39')]);router[_0xca21('0x38')](_0xca21('0x11'),auth['isAuthenticated'](),controller[_0xca21('0x3a')]);router[_0xca21('0x38')]('/',auth['isAuthenticated'](),controller[_0xca21('0x3b')]);router[_0xca21('0x38')](_0xca21('0x12'),auth[_0xca21('0x8')](),controller[_0xca21('0x3c')]);var upload=multer({'storage':multer[_0xca21('0x3d')]({'destination':function(_0x32c80f,_0x1b21f2,_0x1c3db9){_0x1c3db9(null,path[_0xca21('0x3e')](config[_0xca21('0x3f')],_0xca21('0x40')));},'filename':function(_0x10c436,_0x3867aa,_0x142469){_0x142469(null,util[_0xca21('0x41')](_0xca21('0x42'),Date[_0xca21('0x43')](),_0x3867aa['originalname']));}})});router[_0xca21('0x38')](_0xca21('0xf'),upload[_0xca21('0x44')]('file'),controller[_0xca21('0x45')]);router[_0xca21('0x38')](_0xca21('0x46'),auth[_0xca21('0x8')](),controller[_0xca21('0x47')]);router['post']('/:id/logout',auth['isAuthenticated'](),controller[_0xca21('0x48')]);router['post'](_0xca21('0x49'),auth[_0xca21('0x8')](),controller[_0xca21('0x4a')]);router['post'](_0xca21('0x4b'),auth[_0xca21('0x8')](),controller[_0xca21('0x4c')]);router[_0xca21('0x38')](_0xca21('0x25'),auth[_0xca21('0x8')](),controller['addTeams']);router[_0xca21('0x38')](_0xca21('0x4d'),auth['isAuthenticated'](),controller[_0xca21('0x4e')]);router['post'](_0xca21('0x4f'),auth[_0xca21('0x8')](),controller[_0xca21('0x50')]);router['post']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xca21('0x51')]);router[_0xca21('0x38')](_0xca21('0x52'),auth['isAuthenticated'](),controller[_0xca21('0x53')]);router[_0xca21('0x38')](_0xca21('0x54'),auth['isAuthenticated'](),controller[_0xca21('0x55')]);router[_0xca21('0x38')](_0xca21('0x56'),auth[_0xca21('0x8')](),controller[_0xca21('0x57')]);router[_0xca21('0x38')](_0xca21('0x58'),auth[_0xca21('0x8')](),controller[_0xca21('0x59')]);router[_0xca21('0x38')]('/:id/mail_accounts',auth[_0xca21('0x8')](),controller['addMailAccounts']);router['post'](_0xca21('0x2d'),auth[_0xca21('0x8')](),controller[_0xca21('0x5a')]);router[_0xca21('0x38')](_0xca21('0x2f'),auth[_0xca21('0x8')](),controller[_0xca21('0x5b')]);router[_0xca21('0x38')]('/:id/chat_websites',auth[_0xca21('0x8')](),controller[_0xca21('0x5c')]);router[_0xca21('0x38')](_0xca21('0x33'),auth[_0xca21('0x8')](),controller[_0xca21('0x5d')]);router[_0xca21('0x38')](_0xca21('0x35'),auth[_0xca21('0x8')](),controller[_0xca21('0x5e')]);router[_0xca21('0x38')](_0xca21('0x37'),auth[_0xca21('0x8')](),controller[_0xca21('0x5f')]);router[_0xca21('0x60')](_0xca21('0x61'),auth[_0xca21('0x8')](),controller['update']);router[_0xca21('0x60')](_0xca21('0x62'),auth[_0xca21('0x8')](),controller[_0xca21('0x63')]);router[_0xca21('0x64')](_0xca21('0x12'),auth[_0xca21('0x8')](),controller['removeQueues']);router[_0xca21('0x64')](_0xca21('0x25'),auth[_0xca21('0x8')](),controller[_0xca21('0x65')]);router['delete'](_0xca21('0x61'),auth[_0xca21('0x8')](),controller[_0xca21('0x66')]);router[_0xca21('0x64')]('/:id/chat_interactions',auth['isAuthenticated'](),controller['removeChatInteractions']);router['delete'](_0xca21('0x4f'),auth[_0xca21('0x8')](),controller[_0xca21('0x67')]);router[_0xca21('0x64')](_0xca21('0x68'),auth[_0xca21('0x8')](),controller['removeFaxInteractions']);router['delete']('/:id/sms_interactions',auth[_0xca21('0x8')](),controller[_0xca21('0x69')]);router['delete'](_0xca21('0x54'),auth[_0xca21('0x8')](),controller[_0xca21('0x6a')]);router[_0xca21('0x64')](_0xca21('0x56'),auth[_0xca21('0x8')](),controller['removeWhatsappInteractions']);router['delete'](_0xca21('0x58'),auth[_0xca21('0x8')](),controller[_0xca21('0x6b')]);router[_0xca21('0x64')](_0xca21('0x6c'),auth[_0xca21('0x8')](),controller['removeMailAccounts']);router[_0xca21('0x64')](_0xca21('0x2d'),auth[_0xca21('0x8')](),controller[_0xca21('0x6d')]);router[_0xca21('0x64')](_0xca21('0x2f'),auth[_0xca21('0x8')](),controller[_0xca21('0x6e')]);router[_0xca21('0x64')](_0xca21('0x31'),auth[_0xca21('0x8')](),controller[_0xca21('0x6f')]);router[_0xca21('0x64')](_0xca21('0x33'),auth[_0xca21('0x8')](),controller['removeWhatsappAccounts']);router[_0xca21('0x64')]('/:id/square_projects',auth[_0xca21('0x8')](),controller['removeSquareProjects']);router['delete'](_0xca21('0x37'),auth['isAuthenticated'](),controller[_0xca21('0x70')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index bdf3df9..3879b88 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 _0x619e=['rtcp_mux','icesupport','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','agent','telephone','local','BOOLEAN','DATE','INTEGER','dynamic','peer','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','join','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','uas','fingerprint','certificate','active','passive','actpass','update','showWebBar','get','isArray','wss','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x619e,0x67));var _0xe619=function(_0x17aa7a,_0x2be8e4){_0x17aa7a=_0x17aa7a-0x0;var _0x2321f8=_0x619e[_0x17aa7a];return _0x2321f8;};'use strict';var Sequelize=require(_0xe619('0x0'));var moment=require(_0xe619('0x1'));var util=require('util');var _=require(_0xe619('0x2'));module[_0xe619('0x3')]={'name':{'type':Sequelize[_0xe619('0x4')],'allowNull':![],'unique':_0xe619('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4a8a2f){this[_0xe619('0x6')](_0xe619('0x5'),_0x4a8a2f);this[_0xe619('0x6')](_0xe619('0x7'),_0x4a8a2f);},'comment':_0xe619('0x8')},'fullname':{'type':Sequelize[_0xe619('0x4')],'allowNull':![],'set':function(_0x496c72){this[_0xe619('0x6')](_0xe619('0x9'),_0x496c72);this[_0xe619('0x6')](_0xe619('0xa'),util[_0xe619('0xb')](_0xe619('0xc'),_0x496c72,this[_0xe619('0xd')](_0xe619('0xe'))));}},'alias':{'type':Sequelize[_0xe619('0x4')]},'email':{'type':Sequelize[_0xe619('0x4')],'allowNull':![],'unique':_0xe619('0xf'),'validate':{'isEmail':!![]},'set':function(_0x52ac59){if(_0x52ac59){this['setDataValue']('email',_0x52ac59['toLowerCase']());}}},'role':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x11'),_0xe619('0x12'),_0xe619('0x13'),_0xe619('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0xe619('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe619('0x4')],'defaultValue':_0xe619('0x15')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0xfbf61b){this['setDataValue'](_0xe619('0xe'),_0xfbf61b);this[_0xe619('0x6')]('accountcode',_0xfbf61b);this['setDataValue']('callerid',util[_0xe619('0xb')](_0xe619('0xc'),this[_0xe619('0xd')](_0xe619('0x9')),_0xfbf61b));}},'salt':{'type':Sequelize[_0xe619('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xe619('0x4')]},'address':{'type':Sequelize[_0xe619('0x4')]},'zipcode':{'type':Sequelize[_0xe619('0x4')]},'userpic':{'type':Sequelize[_0xe619('0x4')]},'city':{'type':Sequelize[_0xe619('0x4')]},'country':{'type':Sequelize[_0xe619('0x4')]},'online':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe619('0x17')]},'voicePause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xe619('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xe619('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe619('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe619('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xe619('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![],'defaultValue':_0xe619('0x19')},'ipaddr':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xe619('0x10')]('friend','user',_0xe619('0x1a')),'allowNull':!![],'defaultValue':_0xe619('0x1b')},'context':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![],'defaultValue':_0xe619('0x1c')},'callingpres':{'type':Sequelize[_0xe619('0x10')]('ALLOWED_NOT_SCREENED',_0xe619('0x1d'),'ALLOWED_FAILED_SCREEN',_0xe619('0x1e'),_0xe619('0x1f'),'PROHIB_PASSED_SCREEN',_0xe619('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![],'defaultValue':_0xe619('0x21'),'set':function(_0x1e4cd7){this['setDataValue'](_0xe619('0x22'),_0x1e4cd7?_0x1e4cd7['join'](','):null);},'get':function(){return this[_0xe619('0xd')]('transport')?this['getDataValue']('transport')[_0xe619('0x23')](','):null;},'comment':_0xe619('0x24')},'dtmfmode':{'type':Sequelize['ENUM'](_0xe619('0x25'),_0xe619('0x26'),_0xe619('0x27'),_0xe619('0x28'),_0xe619('0x29')),'allowNull':!![],'defaultValue':_0xe619('0x25')},'directmedia':{'type':Sequelize['ENUM'](_0xe619('0x2a'),'no',_0xe619('0x2b'),'update',_0xe619('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe619('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![],'defaultValue':_0xe619('0x2d'),'set':function(_0x217ca5){this[_0xe619('0x6')](_0xe619('0x2e'),_0x217ca5?_0x217ca5[_0xe619('0x2f')](','):null);},'get':function(){return this[_0xe619('0xd')]('nat')?this[_0xe619('0xd')](_0xe619('0x2e'))[_0xe619('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe619('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xe619('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xe619('0x4')]},'language':{'type':Sequelize[_0xe619('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe619('0x4')]},'disallow':{'type':Sequelize[_0xe619('0x4')],'allowNull':![],'defaultValue':_0xe619('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe619('0x31'),'set':function(_0xcd6bd1){this[_0xe619('0x6')](_0xe619('0x32'),_0xcd6bd1?_0xcd6bd1['join'](';'):_0xe619('0x31'));},'get':function(){return this['getDataValue'](_0xe619('0x32'))?this['getDataValue']('allow')[_0xe619('0x23')](';'):null;},'comment':_0xe619('0x33')},'autoframing':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![],'set':function(_0x256083){this['setDataValue']('insecure',_0x256083?_0x256083[_0xe619('0x2f')](','):null);},'get':function(){return this[_0xe619('0xd')](_0xe619('0x34'))?this[_0xe619('0xd')](_0xe619('0x34'))[_0xe619('0x23')](','):null;},'comment':_0xe619('0x35')},'trustrpid':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no',_0xe619('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe619('0x10')]('yes','no'),'allowNull':!![],'defaultValue':_0xe619('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xe619('0x10')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no',_0xe619('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x38'),_0xe619('0x39'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe619('0x10')]('uac',_0xe619('0x3a')),'allowNull':!![],'defaultValue':_0xe619('0x3a')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe619('0x10')]('yes','no'),'allowNull':!![],'defaultValue':_0xe619('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe619('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no',_0xe619('0x3b'),_0xe619('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xe619('0x3d'),_0xe619('0x3e'),_0xe619('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no','nonat',_0xe619('0x40'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe619('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xe619('0x17')]},'showWebBar':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x0,'set':function(_0x2facb4){this[_0xe619('0x6')](_0xe619('0x41'),_0x2facb4);var _0x38b8b8=this[_0xe619('0x42')]({'plain':!![]});switch(_0x2facb4){case 0x0:case 0x1:var _0x1a495d=_0x38b8b8[_0xe619('0x22')]?_[_0xe619('0x43')](_0x38b8b8[_0xe619('0x22')])?_0x38b8b8['transport'][_0xe619('0x2f')]():_0x38b8b8['transport']:_0xe619('0x21');if(_0x1a495d===_0xe619('0x44')){_0x1a495d=_0xe619('0x21');}this[_0xe619('0x6')]('transport',_0x1a495d);this[_0xe619('0x6')](_0xe619('0x45'),'no');this[_0xe619('0x6')](_0xe619('0x46'),null);this[_0xe619('0x6')](_0xe619('0x47'),null);this[_0xe619('0x6')]('icesupport',null);this[_0xe619('0x6')](_0xe619('0x48'),null);this[_0xe619('0x6')](_0xe619('0x49'),null);this[_0xe619('0x6')](_0xe619('0x4a'),null);this[_0xe619('0x6')](_0xe619('0x4b'),null);this[_0xe619('0x6')](_0xe619('0x4c'),null);this[_0xe619('0x6')](_0xe619('0x4d'),'no');break;case 0x2:this[_0xe619('0x6')](_0xe619('0x22'),'wss');this[_0xe619('0x6')](_0xe619('0x45'),'yes');this[_0xe619('0x6')](_0xe619('0x46'),_0xe619('0x2a'));this[_0xe619('0x6')](_0xe619('0x47'),_0xe619('0x2a'));this[_0xe619('0x6')](_0xe619('0x4e'),'yes');this[_0xe619('0x6')](_0xe619('0x48'),'yes');this[_0xe619('0x6')](_0xe619('0x49'),'no');this[_0xe619('0x6')](_0xe619('0x4a'),_0xe619('0x3f'));this[_0xe619('0x6')]('dtlscertfile',_0x38b8b8['dtlscertfile']||_0xe619('0x4f'));this[_0xe619('0x6')](_0xe619('0x4c'),_0x38b8b8[_0xe619('0x4c')]||_0xe619('0x50'));this[_0xe619('0x6')](_0xe619('0x4d'),_0xe619('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x414e42){this[_0xe619('0x6')](_0xe619('0x51'),_0x414e42?_0x414e42[_0xe619('0x2f')](','):[]);},'get':function(){return this['getDataValue'](_0xe619('0x51'))?_[_0xe619('0x52')](this[_0xe619('0xd')]('permissions')[_0xe619('0x23')](','),function(_0x26203d){return parseInt(_0x26203d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe619('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe619('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xe619('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe619('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xe619('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xe619('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe619('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize[_0xe619('0x17')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe619('0x53')],'get':function(){return this[_0xe619('0xd')](_0xe619('0x54'))?this[_0xe619('0xd')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xe619('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![],'set':function(_0x45642e){if(typeof _0x45642e===_0xe619('0x55')){var _0x5ce44c=_0x45642e==='1'?!![]:_0x45642e==='0'?![]:_0x45642e==='true'?!![]:_0x45642e==='false'?![]:![];this[_0xe619('0x6')]('screenrecording',_0x5ce44c);}else{this['setDataValue'](_0xe619('0x56'),_0x45642e);}}},'blocked':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![],'set':function(_0x596819){this[_0xe619('0x6')](_0xe619('0x57'),_0x596819);if(_0x596819===!![]){this['setDataValue'](_0xe619('0x58'),moment());this[_0xe619('0x6')](_0xe619('0x59'),0x0);}else{this[_0xe619('0x6')](_0xe619('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0x1575=['fingerprint','certificate','active','passive','actpass','DATE','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','admin','user','agent','local','INTEGER','fullname','BOOLEAN','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas'];(function(_0x692463,_0x2c1ebc){var _0x14dbc2=function(_0x2c2b53){while(--_0x2c2b53){_0x692463['push'](_0x692463['shift']());}};_0x14dbc2(++_0x2c1ebc);}(_0x1575,0x186));var _0x5157=function(_0x5eb7c4,_0xa4a571){_0x5eb7c4=_0x5eb7c4-0x0;var _0x55df44=_0x1575[_0x5eb7c4];return _0x55df44;};'use strict';var Sequelize=require(_0x5157('0x0'));var moment=require(_0x5157('0x1'));var util=require(_0x5157('0x2'));var _=require(_0x5157('0x3'));module[_0x5157('0x4')]={'name':{'type':Sequelize[_0x5157('0x5')],'allowNull':![],'unique':_0x5157('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x24f13a){this[_0x5157('0x7')](_0x5157('0x6'),_0x24f13a);this[_0x5157('0x7')](_0x5157('0x8'),_0x24f13a);},'comment':_0x5157('0x9')},'fullname':{'type':Sequelize[_0x5157('0x5')],'allowNull':![],'set':function(_0x545391){this[_0x5157('0x7')]('fullname',_0x545391);this[_0x5157('0x7')](_0x5157('0xa'),util[_0x5157('0xb')](_0x5157('0xc'),_0x545391,this[_0x5157('0xd')](_0x5157('0xe'))));}},'alias':{'type':Sequelize[_0x5157('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5157('0xf'),'validate':{'isEmail':!![]},'set':function(_0x14369e){if(_0x14369e){this[_0x5157('0x7')](_0x5157('0xf'),_0x14369e['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x5157('0x10'),_0x5157('0x11'),_0x5157('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x5157('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x5157('0x5')],'defaultValue':_0x5157('0x13')},'internal':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x2df8b9){this[_0x5157('0x7')](_0x5157('0xe'),_0x2df8b9);this['setDataValue']('accountcode',_0x2df8b9);this[_0x5157('0x7')](_0x5157('0xa'),util[_0x5157('0xb')](_0x5157('0xc'),this[_0x5157('0xd')](_0x5157('0x15')),_0x2df8b9));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x5157('0x5')]},'mobile':{'type':Sequelize[_0x5157('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x5157('0x5')]},'userpic':{'type':Sequelize[_0x5157('0x5')]},'city':{'type':Sequelize[_0x5157('0x5')]},'country':{'type':Sequelize[_0x5157('0x5')]},'online':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x5157('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x5157('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5157('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![],'defaultValue':_0x5157('0x17')},'ipaddr':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x5157('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x19'),_0x5157('0x11'),_0x5157('0x1a')),'allowNull':!![],'defaultValue':_0x5157('0x19')},'context':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![],'defaultValue':_0x5157('0x1b')},'callingpres':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x1c'),'ALLOWED_PASSED_SCREEN',_0x5157('0x1d'),_0x5157('0x1e'),_0x5157('0x1f'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![],'defaultValue':_0x5157('0x20'),'set':function(_0x4d59d7){this[_0x5157('0x7')](_0x5157('0x21'),_0x4d59d7?_0x4d59d7['join'](','):null);},'get':function(){return this['getDataValue'](_0x5157('0x21'))?this[_0x5157('0xd')]('transport')[_0x5157('0x22')](','):null;},'comment':_0x5157('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x5157('0x24'),_0x5157('0x25'),_0x5157('0x26'),_0x5157('0x27'),_0x5157('0x28')),'allowNull':!![],'defaultValue':_0x5157('0x24')},'directmedia':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no',_0x5157('0x2a'),_0x5157('0x2b'),_0x5157('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5157('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![],'defaultValue':_0x5157('0x2d'),'set':function(_0x4faf7d){this[_0x5157('0x7')](_0x5157('0x2e'),_0x4faf7d?_0x4faf7d[_0x5157('0x2f')](','):null);},'get':function(){return this[_0x5157('0xd')](_0x5157('0x2e'))?this[_0x5157('0xd')](_0x5157('0x2e'))[_0x5157('0x22')](','):null;},'comment':_0x5157('0x30')},'callgroup':{'type':Sequelize[_0x5157('0x5')]},'namedcallgroup':{'type':Sequelize[_0x5157('0x5')]},'pickupgroup':{'type':Sequelize[_0x5157('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x5157('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x5157('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x5157('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x6a987d){this[_0x5157('0x7')](_0x5157('0x31'),_0x6a987d?_0x6a987d[_0x5157('0x2f')](';'):_0x5157('0x32'));},'get':function(){return this['getDataValue']('allow')?this[_0x5157('0xd')](_0x5157('0x31'))[_0x5157('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![],'set':function(_0x143488){this[_0x5157('0x7')](_0x5157('0x33'),_0x143488?_0x143488[_0x5157('0x2f')](','):null);},'get':function(){return this['getDataValue'](_0x5157('0x33'))?this[_0x5157('0xd')](_0x5157('0x33'))[_0x5157('0x22')](','):null;},'comment':_0x5157('0x34')},'trustrpid':{'type':Sequelize[_0x5157('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no',_0x5157('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x5157('0x18')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![],'defaultValue':_0x5157('0x36')},'amaflags':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![],'defaultValue':_0x5157('0x29')},'busylevel':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x5157('0x18')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no',_0x5157('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x38'),'refuse',_0x5157('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x5157('0x3a'),_0x5157('0x3b')),'allowNull':!![],'defaultValue':_0x5157('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![],'defaultValue':_0x5157('0x29')},'keepalive':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x5157('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no',_0x5157('0x3c'),_0x5157('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x3e'),_0x5157('0x3f'),_0x5157('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x5157('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[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no',_0x5157('0x2a'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x5157('0x41')]},'showWebBar':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0,'set':function(_0x4e98a8){this[_0x5157('0x7')](_0x5157('0x42'),_0x4e98a8);var _0x4a7429=this[_0x5157('0x43')]({'plain':!![]});switch(_0x4e98a8){case 0x0:case 0x1:var _0x41f02a=_0x4a7429[_0x5157('0x21')]?_[_0x5157('0x44')](_0x4a7429[_0x5157('0x21')])?_0x4a7429[_0x5157('0x21')][_0x5157('0x2f')]():_0x4a7429[_0x5157('0x21')]:_0x5157('0x20');if(_0x41f02a===_0x5157('0x45')){_0x41f02a=_0x5157('0x20');}this[_0x5157('0x7')](_0x5157('0x21'),_0x41f02a);this['setDataValue'](_0x5157('0x46'),'no');this[_0x5157('0x7')]('avpf',null);this[_0x5157('0x7')](_0x5157('0x47'),null);this['setDataValue'](_0x5157('0x48'),null);this[_0x5157('0x7')](_0x5157('0x49'),null);this['setDataValue'](_0x5157('0x4a'),null);this[_0x5157('0x7')]('dtlssetup',null);this[_0x5157('0x7')](_0x5157('0x4b'),null);this[_0x5157('0x7')](_0x5157('0x4c'),null);this[_0x5157('0x7')](_0x5157('0x4d'),'no');break;case 0x2:this[_0x5157('0x7')](_0x5157('0x21'),'wss');this[_0x5157('0x7')](_0x5157('0x46'),'yes');this[_0x5157('0x7')]('avpf',_0x5157('0x29'));this['setDataValue'](_0x5157('0x47'),_0x5157('0x29'));this['setDataValue'](_0x5157('0x48'),_0x5157('0x29'));this[_0x5157('0x7')]('dtlsenable',_0x5157('0x29'));this[_0x5157('0x7')](_0x5157('0x4a'),'no');this[_0x5157('0x7')]('dtlssetup',_0x5157('0x40'));this[_0x5157('0x7')]('dtlscertfile',_0x4a7429[_0x5157('0x4b')]||_0x5157('0x4e'));this[_0x5157('0x7')]('dtlsprivatekey',_0x4a7429['dtlsprivatekey']||_0x5157('0x4f'));this[_0x5157('0x7')](_0x5157('0x4d'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x866345){this[_0x5157('0x7')]('permissions',_0x866345?_0x866345[_0x5157('0x2f')](','):[]);},'get':function(){return this['getDataValue'](_0x5157('0x50'))?_[_0x5157('0x51')](this[_0x5157('0xd')]('permissions')['split'](','),function(_0x5c9dee){return parseInt(_0x5c9dee,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x5157('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x5157('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5157('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x5157('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x5157('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x5157('0x5')]},'passwordResetAt':{'type':Sequelize[_0x5157('0x41')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x5157('0x52')],'get':function(){return this[_0x5157('0xd')](_0x5157('0x53'))?this[_0x5157('0xd')](_0x5157('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x30fe85){if(typeof _0x30fe85===_0x5157('0x54')){var _0x3da7f0=_0x30fe85==='1'?!![]:_0x30fe85==='0'?![]:_0x30fe85===_0x5157('0x55')?!![]:_0x30fe85===_0x5157('0x56')?![]:![];this[_0x5157('0x7')](_0x5157('0x57'),_0x3da7f0);}else{this[_0x5157('0x7')](_0x5157('0x57'),_0x30fe85);}}},'blocked':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![],'set':function(_0x3e735f){this[_0x5157('0x7')](_0x5157('0x58'),_0x3e735f);if(_0x3e735f===!![]){this['setDataValue']('blockedAt',moment());this[_0x5157('0x7')]('loginAttempts',0x0);}else{this[_0x5157('0x7')](_0x5157('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0x5157('0x41')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index c645268..10de0d2 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 _0x4599=['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','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','Users','user','Agents','agent','telephone','filter','ignore','map','value','includes','role','end','stack','name','send','index','fieldName','type','key','model','password','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','sequelize','lower','col','options','User','findAll','show','differenceBy','rawAttributes','find','bulkCreate','body','catch','params','describe','addContacts','ids','omit','agent\x20role','admin','../../config/license/util','getLicense','telephones','users','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','Setting','securePassword','min_internal','max','internal','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)','from','voicemail','mailbox','VoiceMail','email','permissions','102','103','110','104','109','111','114','create','Telephones','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','penalty','QueueId','emit','voice','push','UserVoiceQueueRt','removeQueues','Unknown\x20channel','remove','Queues','Queue:remove','destroy','addAvatar','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','download','root','server/files/images/','getContacts','findOne','CmContact','include','CmList','List','Tag','Tags','color','tag','getQueues','Queue','Unknown\x20role','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','includeAll','rows','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','each','upsert','MemberReport','forEach','all','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','concat','LOGININPAUSE','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','whatsapppause','pauseType','lastPauseAt','QueuePause','fax','sms','whatsapp','manual','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','Mail','getSmsQueues','getWhatsappQueues','Whatsapp','Fax','getOpenchannelQueues','Openchannel','transaction','addAgent','removeTeams','Sms','getFaxQueues','flatten','removeAgent','getDataValue','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','isArray','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','spread','user_has_sms_interactions:save','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$in','$like','$notLike','$notILike','$contains','firstName','lastName','phone','Contact','dialActive','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','register','client','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4599,0x155));var _0x9459=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4599[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9459('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9459('0x1'));var zipdir=require(_0x9459('0x2'));var jsonpatch=require(_0x9459('0x3'));var rp=require(_0x9459('0x4'));var moment=require(_0x9459('0x5'));var BPromise=require(_0x9459('0x6'));var Mustache=require(_0x9459('0x7'));var util=require(_0x9459('0x8'));var path=require(_0x9459('0x9'));var sox=require(_0x9459('0xa'));var csv=require(_0x9459('0xb'));var ejs=require(_0x9459('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9459('0xd'));var crypto=require(_0x9459('0xe'));var jsforce=require(_0x9459('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9459('0xb'));var querystring=require(_0x9459('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9459('0x11'));var qs=require(_0x9459('0x12'));var as=require(_0x9459('0x13'));var hardwareService=require(_0x9459('0x14'));var logger=require(_0x9459('0x15'))(_0x9459('0x16'));var utils=require(_0x9459('0x17'));var config=require('../../config/environment');var db=require(_0x9459('0x18'))['db'];config[_0x9459('0x19')]=_[_0x9459('0x1a')](config['redis'],{'host':_0x9459('0x1b'),'port':0x18eb});var socket=require(_0x9459('0x1c'))(new Redis(config[_0x9459('0x19')]));require(_0x9459('0x1d'))[_0x9459('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9459('0x1f')][_0x9459('0x20')]({'port':0x232a});function checkPasswordPattern(_0x435b2c,_0x368fa5,_0x110712){if(_0x110712){var _0x2ce707=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ce707['test'](_0x368fa5)){return _0x435b2c;}else{throw new db[(_0x9459('0x21'))][(_0x9459('0x22'))](_0x9459('0x23'));}}else{return _0x435b2c;}}function respondWithRpcPromise(_0x2bb831,_0x19f48b,_0x571720,_0x3f9674){return new BPromise(function(_0x26151a,_0x340b40){var _0x351432=_0x3f9674||client;return _0x351432['request'](_0x2bb831,_0x571720)[_0x9459('0x24')](function(_0x28ca71){logger[_0x9459('0x25')](_0x9459('0x26'),_0x19f48b,_0x9459('0x27'));logger[_0x9459('0x28')](_0x9459('0x29'),_0x19f48b,_0x9459('0x27'),JSON[_0x9459('0x2a')](_0x28ca71));if(_0x28ca71['error']){if(_0x28ca71['error'][_0x9459('0x2b')]===0x1f4){logger[_0x9459('0x2c')]('User,\x20%s,\x20%s',_0x19f48b,_0x28ca71[_0x9459('0x2c')]['message']);return _0x340b40(_0x28ca71[_0x9459('0x2c')][_0x9459('0x2d')]);}logger[_0x9459('0x2c')]('User,\x20%s,\x20%s',_0x19f48b,_0x28ca71[_0x9459('0x2c')][_0x9459('0x2d')]);return _0x26151a(_0x28ca71['error'][_0x9459('0x2d')]);}else{logger[_0x9459('0x25')](_0x9459('0x26'),_0x19f48b,'request\x20sent');_0x26151a(_0x28ca71[_0x9459('0x2e')][_0x9459('0x2d')]);}})['catch'](function(_0x34aa5b){logger[_0x9459('0x2c')](_0x9459('0x26'),_0x19f48b,_0x34aa5b);_0x340b40(_0x34aa5b);});});}function respondWithStatusCode(_0x33b08e,_0xd5e663){_0xd5e663=_0xd5e663||0xcc;return function(_0x135bbe){if(_0x135bbe){return _0x33b08e[_0x9459('0x2f')](_0xd5e663);}return _0x33b08e[_0x9459('0x30')](_0xd5e663)['end']();};}function respondWithResult(_0x3c0892,_0x1c0faa){_0x1c0faa=_0x1c0faa||0xc8;return function(_0xedf314){if(_0xedf314){return _0x3c0892['status'](_0x1c0faa)[_0x9459('0x31')](_0xedf314);}};}function respondWithFilteredResult(_0x2152cb,_0x2d53c3){return function(_0x4752b7){if(_0x4752b7){var _0x141128=_0x4752b7[_0x9459('0x32')],_0x6c0635=_0x2d53c3['offset'],_0x2b5e4c=_0x2d53c3[_0x9459('0x33')]+_0x2d53c3[_0x9459('0x34')],_0x2130a0;if(_0x2b5e4c>=_0x141128){_0x2b5e4c=_0x141128;_0x2130a0=0xc8;}else{_0x2130a0=0xce;}_0x2152cb[_0x9459('0x30')](_0x2130a0);return _0x2152cb[_0x9459('0x35')](_0x9459('0x36'),_0x6c0635+'-'+_0x2b5e4c+'/'+_0x141128)[_0x9459('0x31')](_0x4752b7);}return null;};}function patchUpdates(_0x2fad9c){return function(_0x1186dc){try{jsonpatch[_0x9459('0x37')](_0x1186dc,_0x2fad9c,!![]);}catch(_0x2b96a9){return BPromise[_0x9459('0x38')](_0x2b96a9);}return _0x1186dc[_0x9459('0x39')]();};}function saveUpdates(_0x1b0506,_0x2be7b1){return function(_0x59d974){if(_0x59d974){return _0x59d974[_0x9459('0x3a')](_0x1b0506)[_0x9459('0x24')](function(_0x3e9174){return _0x3e9174;});}return null;};}function removeEntity(_0x5a62af,_0x1c723f){return function(_0x2db47a){if(_0x2db47a){return _0x2db47a['destroy']()['then'](function(){var _0x403b25=_0x2db47a[_0x9459('0x3b')]({'plain':!![]});var _0x249ae7=[{'name':_0x9459('0x3c'),'value':_0x9459('0x3d'),'ignore':!![]},{'name':_0x9459('0x3e'),'value':_0x9459('0x3f'),'ignore':![]},{'name':'Telephones','value':_0x9459('0x40'),'ignore':![]}];var _0x4886d6=_(_0x249ae7)[_0x9459('0x41')](_0x9459('0x42'))[_0x9459('0x43')](_0x9459('0x44'))['value']();if(_[_0x9459('0x45')](_0x4886d6,_0x403b25[_0x9459('0x46')])){return;}var _0x47731c=_['find'](_0x249ae7,['value',_0x403b25[_0x9459('0x46')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x47731c,'resourceId':_0x403b25['id']}})['then'](function(){return _0x2db47a;});})[_0x9459('0x24')](function(){_0x5a62af[_0x9459('0x30')](0xcc)[_0x9459('0x47')]();});}};}function handleEntityNotFound(_0x1ccf64,_0x52c6f0){return function(_0x2be6ed){if(!_0x2be6ed){_0x1ccf64['sendStatus'](0x194);}return _0x2be6ed;};}function handleError(_0x21ebe8,_0xc03ed4){_0xc03ed4=_0xc03ed4||0x1f4;return function(_0x281342){logger['error'](_0x281342[_0x9459('0x48')]);if(_0x281342[_0x9459('0x49')]){delete _0x281342['name'];}_0x21ebe8[_0x9459('0x30')](_0xc03ed4)[_0x9459('0x4a')](_0x281342);};}exports[_0x9459('0x4b')]=function(_0x4f1602,_0x23a33f){var _0x3c95f4={},_0x395ede={},_0x5cf721={'count':0x0,'rows':[]};var _0x2d7f4a=_[_0x9459('0x43')](db['User']['rawAttributes'],function(_0x3f06fc){return{'name':_0x3f06fc[_0x9459('0x4c')],'type':_0x3f06fc[_0x9459('0x4d')][_0x9459('0x4e')]};});_0x395ede[_0x9459('0x4f')]=_['differenceBy'](_[_0x9459('0x43')](_0x2d7f4a,'name'),[_0x9459('0x50'),'salt']);_0x395ede[_0x9459('0x51')]=_[_0x9459('0x52')](_0x4f1602[_0x9459('0x51')]);_0x395ede[_0x9459('0x53')]=_['intersection'](_0x395ede['model'],_0x395ede['query']);_0x3c95f4[_0x9459('0x54')]=_[_0x9459('0x55')](_0x395ede[_0x9459('0x4f')],qs['fields'](_0x4f1602[_0x9459('0x51')][_0x9459('0x56')]));_0x3c95f4[_0x9459('0x54')]=_0x3c95f4[_0x9459('0x54')][_0x9459('0x57')]?_0x3c95f4['attributes']:_0x395ede[_0x9459('0x4f')];if(!_0x4f1602[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x3c95f4['limit']=qs[_0x9459('0x34')](_0x4f1602[_0x9459('0x51')][_0x9459('0x34')]);_0x3c95f4[_0x9459('0x33')]=qs['offset'](_0x4f1602[_0x9459('0x51')]['offset']);}_0x3c95f4[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x4f1602[_0x9459('0x51')][_0x9459('0x5b')]);_0x3c95f4[_0x9459('0x5c')]=qs[_0x9459('0x53')](_[_0x9459('0x5d')](_0x4f1602['query'],_0x395ede['filters']),_0x2d7f4a);if(_0x4f1602[_0x9459('0x51')][_0x9459('0x41')]){_0x3c95f4[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x3c95f4['where'],{'$or':_[_0x9459('0x43')](_0x2d7f4a,function(_0x1c52db){if(_0x1c52db[_0x9459('0x4d')]!==_0x9459('0x5f')){return db[_0x9459('0x60')]['where'](db['sequelize']['fn'](_0x9459('0x61'),db[_0x9459('0x60')][_0x9459('0x62')](_0x1c52db[_0x9459('0x49')])),{'$like':db[_0x9459('0x60')]['fn'](_0x9459('0x61'),'%'+_0x4f1602['query'][_0x9459('0x41')]+'%')});}})});}_0x3c95f4=_[_0x9459('0x5e')]({},_0x3c95f4,_0x4f1602[_0x9459('0x63')]);var _0x1ec1a3={'where':_0x3c95f4['where']};return db[_0x9459('0x64')][_0x9459('0x32')](_0x1ec1a3)['then'](function(_0x35c9ae){_0x5cf721[_0x9459('0x32')]=_0x35c9ae;if(_0x4f1602[_0x9459('0x51')]['includeAll']){_0x3c95f4['include']=[{'all':!![]}];}return db[_0x9459('0x64')][_0x9459('0x65')](_0x3c95f4);})[_0x9459('0x24')](function(_0x6773f1){_0x5cf721['rows']=_0x6773f1;return _0x5cf721;})['then'](respondWithFilteredResult(_0x23a33f,_0x3c95f4))['catch'](handleError(_0x23a33f,null));};exports[_0x9459('0x66')]=function(_0x166c21,_0x3de915){var _0x7fb6fe={'raw':![],'where':{'id':_0x166c21['params']['id']}},_0x1266a4={};_0x1266a4[_0x9459('0x4f')]=_[_0x9459('0x67')](_[_0x9459('0x52')](db[_0x9459('0x64')][_0x9459('0x68')]),[_0x9459('0x50'),'salt']);_0x1266a4[_0x9459('0x51')]=_[_0x9459('0x52')](_0x166c21[_0x9459('0x51')]);_0x1266a4[_0x9459('0x53')]=_[_0x9459('0x55')](_0x1266a4[_0x9459('0x4f')],_0x1266a4['query']);_0x7fb6fe[_0x9459('0x54')]=_[_0x9459('0x55')](_0x1266a4[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x166c21[_0x9459('0x51')][_0x9459('0x56')]));_0x7fb6fe[_0x9459('0x54')]=_0x7fb6fe[_0x9459('0x54')]['length']?_0x7fb6fe[_0x9459('0x54')]:_0x1266a4[_0x9459('0x4f')];if(_0x166c21[_0x9459('0x51')]['includeAll']){_0x7fb6fe['include']=[{'all':!![]}];}_0x7fb6fe=_[_0x9459('0x5e')]({},_0x7fb6fe,_0x166c21[_0x9459('0x63')]);return db[_0x9459('0x64')][_0x9459('0x69')](_0x7fb6fe)[_0x9459('0x24')](handleEntityNotFound(_0x3de915,null))[_0x9459('0x24')](respondWithResult(_0x3de915,null))['catch'](handleError(_0x3de915,null));};exports['bulkCreate']=function(_0x50d284,_0x187c0c){return db[_0x9459('0x64')][_0x9459('0x6a')](_0x50d284[_0x9459('0x6b')],{'raw':![],'individualHooks':!![]})[_0x9459('0x24')](respondWithResult(_0x187c0c,0xc9))[_0x9459('0x6c')](handleError(_0x187c0c,null));};exports[_0x9459('0x3a')]=function(_0x52c93a,_0x2f4b5d){if(_0x52c93a[_0x9459('0x6b')]['id']){delete _0x52c93a[_0x9459('0x6b')]['id'];}delete _0x52c93a[_0x9459('0x6b')][_0x9459('0x46')];return db['User'][_0x9459('0x69')]({'where':{'id':_0x52c93a[_0x9459('0x6d')]['id']}})['then'](handleEntityNotFound(_0x2f4b5d,null))['then'](saveUpdates(_0x52c93a[_0x9459('0x6b')],null))[_0x9459('0x24')](respondWithResult(_0x2f4b5d,null))['catch'](handleError(_0x2f4b5d,null));};exports[_0x9459('0x6e')]=function(_0x4759a4,_0x2a1910){return db[_0x9459('0x64')][_0x9459('0x6e')]()[_0x9459('0x24')](respondWithResult(_0x2a1910,null))[_0x9459('0x6c')](handleError(_0x2a1910,null));};exports[_0x9459('0x6f')]=function(_0x1abc5d,_0xb44e38,_0x4b7087){return db[_0x9459('0x64')][_0x9459('0x69')]({'where':{'id':_0x1abc5d[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0xb44e38,null))[_0x9459('0x24')](function(_0x280154){if(_0x280154){return _0x280154['addContacts'](_0x1abc5d['body'][_0x9459('0x70')],_[_0x9459('0x71')](_0x1abc5d['body'],[_0x9459('0x70'),'id'])||{});}})[_0x9459('0x24')](respondWithResult(_0xb44e38,null))[_0x9459('0x6c')](handleError(_0xb44e38,null));};var getLicense=function(_0x38a7cf){return new BPromise(function(_0x4be579,_0xed4ff9){var _0x14ad05=0x0;_0x38a7cf[_0x9459('0x6b')][_0x9459('0x46')]===_0x9459('0x3f')&&_0x4be579(_0x9459('0x72'));return db[_0x9459('0x64')][_0x9459('0x32')]({'where':{'$or':[{'role':_0x38a7cf[_0x9459('0x6b')]['role']===_0x9459('0x40')?_0x9459('0x40'):[_0x9459('0x73'),_0x9459('0x3d')]}]}})[_0x9459('0x24')](function(_0x59481c){_0x14ad05=_0x59481c;return require(_0x9459('0x74'))[_0x9459('0x75')]();})[_0x9459('0x24')](function(_0x225619){var _0x291775=_0x38a7cf[_0x9459('0x6b')][_0x9459('0x46')]===_0x9459('0x40')?_0x9459('0x76'):_0x9459('0x77');if(!_[_0x9459('0x78')](_0x225619[_0x291775])&&_0x14ad05>=_0x225619[_0x291775]){return _0xed4ff9({'message':_0x9459('0x79')});}return _0x4be579(util[_0x9459('0x7a')](_0x9459('0x7b'),_0x291775,_0x14ad05));})['catch'](function(_0x428796){return _0xed4ff9(_0x428796);});});};exports['create']=function(_0x8c0af4,_0x46ca1c){return getLicense(_0x8c0af4)['then'](function(_0x46e117){if(!_0x8c0af4[_0x9459('0x6b')]['internal']){var _0x56af9b;return db[_0x9459('0x7c')]['findById'](0x1)['then'](function(_0x431673){return checkPasswordPattern(_0x431673,_0x8c0af4[_0x9459('0x6b')][_0x9459('0x50')],_0x431673[_0x9459('0x7d')]);})[_0x9459('0x24')](function(_0x38d640){_0x56af9b=_0x38d640[_0x9459('0x7e')];return db['User'][_0x9459('0x7f')](_0x9459('0x80'));})['then'](function(_0x11d5c5){if(_[_0x9459('0x78')](_0x11d5c5)){if(_0x56af9b){_0x8c0af4[_0x9459('0x6b')][_0x9459('0x80')]=_0x56af9b;}else{_0x8c0af4[_0x9459('0x6b')][_0x9459('0x80')]=0x1;}}else{if(_['isNil'](_0x56af9b)||_0x56af9b==_0x11d5c5){_0x8c0af4[_0x9459('0x6b')]['internal']=_0x11d5c5+0x1;}else if(_0x56af9b>_0x11d5c5){_0x8c0af4[_0x9459('0x6b')]['internal']=_0x56af9b;}else{return db['sequelize'][_0x9459('0x51')](_0x9459('0x81'),{'type':db[_0x9459('0x60')]['QueryTypes']['SELECT']})['then'](function(_0x665c8a){if(_0x665c8a&&_0x665c8a[_0x9459('0x57')]){for(var _0x320310=0x0,_0xe491f3=_0x665c8a['length'];_0x320310<_0xe491f3&&_[_0x9459('0x78')](_0x8c0af4[_0x9459('0x6b')][_0x9459('0x80')]);_0x320310++){if(_0x56af9b<=_0x665c8a[_0x320310]['from']){_0x8c0af4[_0x9459('0x6b')][_0x9459('0x80')]=_0x665c8a[_0x320310]['from'];}else if(_0x56af9b>_0x665c8a[_0x320310][_0x9459('0x82')]&&_0x56af9b<=_0x665c8a[_0x320310]['to']){_0x8c0af4[_0x9459('0x6b')]['internal']=_0x56af9b;}}}if(_[_0x9459('0x78')](_0x8c0af4['body']['internal'])){_0x8c0af4[_0x9459('0x6b')]['internal']=_0x11d5c5+0x1;}});}}});}})[_0x9459('0x24')](function(){if(_0x8c0af4[_0x9459('0x6b')][_0x9459('0x83')]){_0x8c0af4[_0x9459('0x6b')][_0x9459('0x84')]=_0x8c0af4[_0x9459('0x6b')][_0x9459('0x80')];_0x8c0af4[_0x9459('0x6b')][_0x9459('0x85')]={'mailbox':_0x8c0af4[_0x9459('0x6b')]['internal'],'password':_0x8c0af4[_0x9459('0x6b')]['password'],'fullname':_0x8c0af4[_0x9459('0x6b')]['fullname'],'email':_0x8c0af4[_0x9459('0x6b')][_0x9459('0x86')]};}if(_0x8c0af4[_0x9459('0x6b')]&&_0x8c0af4[_0x9459('0x6b')]['role']===_0x9459('0x3f')){if(!_0x8c0af4['body'][_0x9459('0x87')]){_0x8c0af4[_0x9459('0x6b')][_0x9459('0x87')]=['101',_0x9459('0x88'),_0x9459('0x89'),'113',_0x9459('0x8a'),_0x9459('0x8b'),'105','106','107','108',_0x9459('0x8c'),'100',_0x9459('0x8d'),_0x9459('0x8e')];}}return db[_0x9459('0x64')][_0x9459('0x8f')](_0x8c0af4['body'],{'include':[{'model':db[_0x9459('0x85')],'as':_0x9459('0x85')}]});})[_0x9459('0x24')](function(_0x2abeaf){if(_0x8c0af4['body'][_0x9459('0x46')]===_0x9459('0x3d'))return _0x2abeaf;var _0x2ef4b9=_0x8c0af4[_0x9459('0x3d')][_0x9459('0x3b')]({'plain':!![]});if(!_0x2ef4b9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ef4b9[_0x9459('0x46')]===_0x9459('0x3d')){var _0x41047e=_0x2abeaf['get']({'plain':!![]});var _0x5bf559=[{'name':_0x9459('0x3e'),'value':_0x9459('0x3f')},{'name':_0x9459('0x90'),'value':_0x9459('0x40')}];var _0x11dc92=_[_0x9459('0x69')](_0x5bf559,['value',_0x41047e[_0x9459('0x46')]])['name'];return db[_0x9459('0x91')][_0x9459('0x69')]({'where':{'name':_0x11dc92,'userProfileId':_0x2ef4b9['userProfileId']},'raw':!![]})[_0x9459('0x24')](function(_0x34125a){if(_0x34125a&&_0x34125a[_0x9459('0x92')]===0x0){return db[_0x9459('0x93')]['create']({'name':_0x41047e[_0x9459('0x49')],'resourceId':_0x41047e['id'],'type':_0x34125a[_0x9459('0x49')],'sectionId':_0x34125a['id']},{})[_0x9459('0x24')](function(){return _0x2abeaf;});}else{return _0x2abeaf;}})[_0x9459('0x6c')](function(_0x5775dd){logger[_0x9459('0x2c')](_0x9459('0x94'),_0x5775dd);throw _0x5775dd;});}return _0x2abeaf;})['then'](respondWithResult(_0x46ca1c,0xc9))[_0x9459('0x6c')](handleError(_0x46ca1c,null));};exports[_0x9459('0x95')]=function(_0x48130d,_0x57c91e,_0x6184fc){var _0x489ecd=![];if(_0x48130d[_0x9459('0x6b')]['id']){delete _0x48130d[_0x9459('0x6b')]['id'];}return db['Setting']['findOne']({'attributes':['id',_0x9459('0x7d')]})[_0x9459('0x24')](function(_0x2773e5){_0x489ecd=_0x2773e5[_0x9459('0x7d')];return db[_0x9459('0x64')]['find']({'where':{'id':_0x48130d[_0x9459('0x6d')]['id']}});})['then'](function(_0x18136d){if(_0x18136d){if(_0x18136d['id']==_0x48130d[_0x9459('0x3d')]['id']){if(!_0x48130d[_0x9459('0x6b')][_0x9459('0x96')]||!_0x48130d[_0x9459('0x6b')][_0x9459('0x97')]){throw new db[(_0x9459('0x21'))][(_0x9459('0x22'))](_0x9459('0x98'));}if(!_0x18136d['authenticate'](_0x48130d[_0x9459('0x6b')]['oldPassword'])){throw new db['Sequelize']['ValidationError'](_0x9459('0x99'));}if(_0x48130d[_0x9459('0x6b')][_0x9459('0x96')]==_0x48130d[_0x9459('0x6b')][_0x9459('0x97')]){throw new db['Sequelize'][(_0x9459('0x22'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x18136d;}else if(_0x48130d['user'][_0x9459('0x46')]==_0x9459('0x73')){if(!_0x48130d[_0x9459('0x6b')][_0x9459('0x97')]){throw new db[(_0x9459('0x21'))][(_0x9459('0x22'))](_0x9459('0x9a'));}return _0x18136d;}else if(_0x48130d[_0x9459('0x3d')][_0x9459('0x46')]==_0x9459('0x3d')){if(!_0x48130d['body'][_0x9459('0x97')]){throw new db['Sequelize'][(_0x9459('0x22'))](_0x9459('0x9a'));}if(_0x18136d[_0x9459('0x46')]!=_0x9459('0x3f')){throw new db[(_0x9459('0x21'))][(_0x9459('0x22'))]('Unauthorized');}return _0x18136d;}else{throw new db['Sequelize'][(_0x9459('0x22'))](_0x9459('0x9b'));}}return null;})[_0x9459('0x24')](handleEntityNotFound(_0x57c91e,null))[_0x9459('0x24')](function(_0xb07de4){return checkPasswordPattern(_0xb07de4,_0x48130d[_0x9459('0x6b')]['newPassword'],_0x489ecd);})['then'](saveUpdates({'password':_0x48130d[_0x9459('0x6b')][_0x9459('0x97')],'passwordResetAt':_0x48130d[_0x9459('0x3d')]['id']==_0x48130d[_0x9459('0x6d')]['id']?moment():null},null))[_0x9459('0x24')](respondWithResult(_0x57c91e,null))[_0x9459('0x6c')](handleError(_0x57c91e,null));};exports[_0x9459('0x9c')]=function(_0x5d30a9,_0x391118,_0xb5d3e2){var _0x2f5fa6=_0x5d30a9[_0x9459('0x6b')][_0x9459('0x9d')];return db[_0x9459('0x64')][_0x9459('0x69')]({'where':{'id':_0x5d30a9[_0x9459('0x6d')]['id']},'attributes':['id',_0x9459('0x49'),_0x9459('0x46'),_0x9459('0x9e'),_0x9459('0x9f'),_0x9459('0xa0'),_0x9459('0xa1')]})[_0x9459('0x24')](handleEntityNotFound(_0x391118,null))[_0x9459('0x24')](function(_0x1d620d){if(_0x1d620d){if(!utils[_0x9459('0xa2')](_0x2f5fa6)){throw new db[(_0x9459('0x21'))][(_0x9459('0x22'))]('Unknown\x20channel');}return _0x1d620d[_0x9459('0xa3')+_[_0x9459('0xa4')](_0x2f5fa6[_0x9459('0xa5')]())+'Queues'](_0x5d30a9['body'][_0x9459('0x70')],{'penalty':_0x5d30a9[_0x9459('0x6b')][_0x9459('0xa6')]||0x0})['spread'](function(_0x49d31d){for(var _0x33be85=0x0;_0x33be85<_0x5d30a9[_0x9459('0x6b')][_0x9459('0x70')][_0x9459('0x57')];_0x33be85+=0x1){var _0x77e3ff={'UserId':_0x5d30a9[_0x9459('0x6d')]['id']};_0x77e3ff[_[_0x9459('0xa4')](_0x2f5fa6[_0x9459('0xa5')]())+_0x9459('0xa7')]=_0x5d30a9['body']['ids'][_0x33be85];socket[_0x9459('0xa8')]('user'+_['capitalize'](_0x2f5fa6['toLowerCase']())+'Queue:save',_0x77e3ff);}return _0x49d31d;})[_0x9459('0x24')](function(){if(_0x2f5fa6===_0x9459('0xa9')){return db['VoiceQueue'][_0x9459('0x65')]({'where':{'id':_0x5d30a9['body']['ids']||[]},'raw':!![],'attributes':['id',_0x9459('0x49')]});}})['then'](function(_0x5d8434){var _0x52aaa7=_0x1d620d[_0x9459('0x3b')]({'plain':!![]});var _0x223f20=[];if(_0x2f5fa6===_0x9459('0xa9')&&_0x52aaa7[_0x9459('0x46')]===_0x9459('0x3f')&&_0x52aaa7[_0x9459('0x9e')]){for(var _0x3fb171=0x0;_0x3fb171<_0x5d8434['length'];_0x3fb171+=0x1){_0x223f20[_0x9459('0xaa')]({'membername':_0x52aaa7[_0x9459('0x49')],'UserId':_0x52aaa7['id'],'queue_name':_0x5d8434[_0x3fb171][_0x9459('0x49')],'VoiceQueueId':_0x5d8434[_0x3fb171]['id'],'interface':_['isNil'](_0x52aaa7['interface'])?util[_0x9459('0x7a')]('SIP/%s',_0x52aaa7[_0x9459('0x49')]):_0x52aaa7['interface'],'paused':_0x52aaa7['voicePause']||![],'penalty':_0x5d30a9[_0x9459('0x6b')][_0x9459('0xa6')]||0x0});}return BPromise['each'](_0x223f20,function(_0x5d944a){return db[_0x9459('0xab')]['upsert'](_0x5d944a);});}return _0x1d620d;});}})['then'](respondWithStatusCode(_0x391118,null))[_0x9459('0x6c')](handleError(_0x391118,null));};exports[_0x9459('0xac')]=function(_0x19e3f5,_0x26e6d3,_0x324655){var _0x34db9a;return db['User'][_0x9459('0x69')]({'where':{'id':_0x19e3f5[_0x9459('0x6d')]['id']},'attributes':['id',_0x9459('0x49'),_0x9459('0x46')]})[_0x9459('0x24')](handleEntityNotFound(_0x26e6d3,null))['then'](function(_0xf8c930){if(_0xf8c930){_0x34db9a=_0xf8c930;if(!_0x19e3f5['query'][_0x9459('0x9d')]||!utils[_0x9459('0xa2')](_0x19e3f5[_0x9459('0x51')][_0x9459('0x9d')])){throw new db['Sequelize'][(_0x9459('0x22'))](_0x9459('0xad'));}return _0xf8c930[_0x9459('0xae')+_['capitalize'](_0x19e3f5['query'][_0x9459('0x9d')][_0x9459('0xa5')]())+_0x9459('0xaf')](_0x19e3f5['query']['ids']);}})[_0x9459('0x24')](function(_0x5bc55c){for(var _0x5d1163=0x0;_0x5d1163<_0x19e3f5[_0x9459('0x51')][_0x9459('0x70')][_0x9459('0x57')];_0x5d1163+=0x1){var _0x2d1214={'UserId':_0x19e3f5[_0x9459('0x6d')]['id']};_0x2d1214[_[_0x9459('0xa4')](_0x19e3f5[_0x9459('0x51')][_0x9459('0x9d')][_0x9459('0xa5')]())+_0x9459('0xa7')]=_0x19e3f5[_0x9459('0x51')][_0x9459('0x70')][_0x5d1163];socket[_0x9459('0xa8')]('user'+_[_0x9459('0xa4')](_0x19e3f5['query'][_0x9459('0x9d')][_0x9459('0xa5')]())+_0x9459('0xb0'),_0x2d1214);}return _0x5bc55c;})[_0x9459('0x24')](function(){if(_0x19e3f5[_0x9459('0x51')]['channel']===_0x9459('0xa9')){return db[_0x9459('0xab')][_0x9459('0xb1')]({'where':{'UserId':_0x19e3f5[_0x9459('0x6d')]['id'],'VoiceQueueId':_0x19e3f5[_0x9459('0x51')]['ids']},'individualHooks':!![]})['then'](function(){return _0x34db9a;});}return _0x34db9a;})[_0x9459('0x24')](respondWithStatusCode(_0x26e6d3,null))['catch'](handleError(_0x26e6d3,null));};exports[_0x9459('0xb2')]=function(_0xfd1060,_0x7a6d1e,_0x240d65){_0xfd1060[_0x9459('0x6b')][_0x9459('0xb3')]=_0xfd1060[_0x9459('0xb4')][_0x9459('0xb5')];return db[_0x9459('0x64')][_0x9459('0x69')]({'where':{'id':_0xfd1060[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x7a6d1e,null))['then'](saveUpdates(_0xfd1060[_0x9459('0x6b')],null))[_0x9459('0x24')](respondWithResult(_0x7a6d1e,null))[_0x9459('0x6c')](handleError(_0x7a6d1e,null));};exports[_0x9459('0xb6')]=function(_0x32caea,_0x313d15,_0x5329c6){var _0x6315f0=path[_0x9459('0xb7')](config['root'],_0x9459('0xb8'));return db['User']['find']({'where':{'id':_0x32caea[_0x9459('0x6d')]['id']},'attributes':['id',_0x9459('0xb3')],'raw':!![]})[_0x9459('0x24')](handleEntityNotFound(_0x313d15,null))['then'](function(_0x154f13){if(_0x154f13){if(_['isNil'](_0x154f13[_0x9459('0xb3')])){return _0x313d15[_0x9459('0xb9')](_0x6315f0);}else{if(!fs['existsSync'](path[_0x9459('0xb7')](config[_0x9459('0xba')],_0x9459('0xbb'),_0x154f13[_0x9459('0xb3')]))){return _0x313d15['download'](_0x6315f0);}return _0x313d15[_0x9459('0xb9')](path[_0x9459('0xb7')](config[_0x9459('0xba')],_0x9459('0xbb'),_0x154f13[_0x9459('0xb3')]));}}})[_0x9459('0x6c')](handleError(_0x313d15,null));};exports[_0x9459('0xbc')]=function(_0x29ad0a,_0x23ff3f,_0x286650){var _0x5047fd={};var _0x5f56d4={};var _0x29828e;var _0x2d0b38;return db['User'][_0x9459('0xbd')]({'where':{'id':_0x29ad0a[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x23ff3f,null))['then'](function(_0x4633fb){if(_0x4633fb){_0x29828e=_0x4633fb;_0x5f56d4[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xbe')][_0x9459('0x68')]);_0x5f56d4[_0x9459('0x51')]=_['keys'](_0x29ad0a['query']);_0x5f56d4[_0x9459('0x53')]=_['intersection'](_0x5f56d4[_0x9459('0x4f')],_0x5f56d4[_0x9459('0x51')]);_0x5047fd['attributes']=_[_0x9459('0x55')](_0x5f56d4[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x29ad0a[_0x9459('0x51')][_0x9459('0x56')]));_0x5047fd[_0x9459('0x54')]=_0x5047fd['attributes'][_0x9459('0x57')]?_0x5047fd['attributes']:_0x5f56d4[_0x9459('0x4f')];_0x5047fd[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x29ad0a[_0x9459('0x51')][_0x9459('0x5b')]);_0x5047fd[_0x9459('0x5c')]=qs['filters'](_[_0x9459('0x5d')](_0x29ad0a['query'],_0x5f56d4[_0x9459('0x53')]));if(_0x29ad0a[_0x9459('0x51')][_0x9459('0x41')]){_0x5047fd['where']=_[_0x9459('0x5e')](_0x5047fd[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x5047fd[_0x9459('0x54')],function(_0x154d00){var _0x10c144={};_0x10c144[_0x154d00]={'$like':'%'+_0x29ad0a[_0x9459('0x51')]['filter']+'%'};return _0x10c144;})});}_0x5047fd=_['merge']({},_0x5047fd,_0x29ad0a[_0x9459('0x63')]);return _0x29828e[_0x9459('0xbc')](_0x5047fd);}})[_0x9459('0x24')](function(_0x47f1bb){if(_0x47f1bb){_0x2d0b38=_0x47f1bb['length'];if(_0x29ad0a['query'][_0x9459('0x58')]('includeAll')){_0x5047fd[_0x9459('0xbf')]=[{'model':db[_0x9459('0xc0')],'as':_0x9459('0xc1'),'required':![]},{'model':db[_0x9459('0xc2')],'as':_0x9459('0xc3'),'attributes':['id',_0x9459('0x49'),_0x9459('0xc4')],'where':_0x29ad0a['query'][_0x9459('0xc5')]?{'id':_0x29ad0a[_0x9459('0x51')][_0x9459('0xc5')]}:undefined,'required':_0x29ad0a['query'][_0x9459('0xc5')]?!![]:![]}];}if(!_0x29ad0a[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x5047fd['limit']=qs[_0x9459('0x34')](_0x29ad0a['query'][_0x9459('0x34')]);_0x5047fd[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x29ad0a['query']['offset']);}return _0x29828e[_0x9459('0xbc')](_0x5047fd);}})[_0x9459('0x24')](function(_0x281813){if(_0x281813){return _0x281813?{'count':_0x2d0b38,'rows':_0x281813}:null;}})[_0x9459('0x24')](respondWithResult(_0x23ff3f,null))[_0x9459('0x6c')](handleError(_0x23ff3f,null));};exports[_0x9459('0xc6')]=function(_0x170f70,_0x332e7d,_0x1d9d45){var _0x988cb5;var _0x2d30ff;var _0x362e9e={};var _0x47ad4b;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x170f70[_0x9459('0x6d')]['id']},'attributes':['id',_0x9459('0x49'),'role']})[_0x9459('0x24')](handleEntityNotFound(_0x332e7d,null))['then'](function(_0x55cb15){if(!utils[_0x9459('0xa2')](_0x170f70[_0x9459('0x51')]['channel'])){throw new db[(_0x9459('0x21'))][(_0x9459('0x22'))]('Unknown\x20channel');}_0x988cb5=_0x55cb15;var _0x14ae9d={};_0x14ae9d[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_[_0x9459('0xa4')](_0x170f70[_0x9459('0x51')][_0x9459('0x9d')])+_0x9459('0xc7')][_0x9459('0x68')]);_0x14ae9d['query']=_[_0x9459('0x52')](_0x170f70['query']);_0x14ae9d[_0x9459('0x53')]=_[_0x9459('0x55')](_0x14ae9d[_0x9459('0x4f')],_0x14ae9d[_0x9459('0x51')]);_0x362e9e[_0x9459('0x54')]=_[_0x9459('0x55')](_0x14ae9d[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x170f70[_0x9459('0x51')]['fields']));_0x362e9e[_0x9459('0x54')]=_0x362e9e[_0x9459('0x54')][_0x9459('0x57')]?_0x362e9e[_0x9459('0x54')]:_0x14ae9d[_0x9459('0x4f')];_0x362e9e[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x170f70[_0x9459('0x51')]['sort']);_0x362e9e[_0x9459('0x5c')]=qs['filters'](_[_0x9459('0x5d')](_0x170f70[_0x9459('0x51')],_0x14ae9d['filters']));if(_0x170f70['query'][_0x9459('0x41')]){_0x362e9e[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x362e9e['where'],{'$or':_[_0x9459('0x43')](_0x362e9e[_0x9459('0x54')],function(_0x8ca2ca){var _0xc1b669={};_0xc1b669[_0x8ca2ca]={'$like':'%'+_0x170f70[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0xc1b669;})});}_0x362e9e=_[_0x9459('0x5e')]({},_0x362e9e,_0x170f70[_0x9459('0x63')]);switch(_0x988cb5[_0x9459('0x46')]){case'admin':return db[_[_0x9459('0xa4')](_0x170f70['query'][_0x9459('0x9d')])+_0x9459('0xc7')]['findAll'](_0x362e9e);case _0x9459('0x3d'):case'agent':return _0x988cb5[_0x9459('0x3b')+_[_0x9459('0xa4')](_0x170f70[_0x9459('0x51')][_0x9459('0x9d')])+_0x9459('0xaf')](_0x362e9e);default:throw new db[(_0x9459('0x21'))]['ValidationError'](_0x9459('0xc8'));}})[_0x9459('0x24')](function(_0xc27a58){_0x47ad4b=_0xc27a58[_0x9459('0x57')];if(!_0x170f70[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x362e9e[_0x9459('0x34')]=qs[_0x9459('0x34')](_0x170f70['query']['limit']);_0x362e9e[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x170f70[_0x9459('0x51')][_0x9459('0x33')]);}switch(_0x988cb5[_0x9459('0x46')]){case _0x9459('0x73'):return db[_[_0x9459('0xa4')](_0x170f70[_0x9459('0x51')][_0x9459('0x9d')])+_0x9459('0xc7')][_0x9459('0x65')](_0x362e9e);case _0x9459('0x3d'):case _0x9459('0x3f'):return _0x988cb5[_0x9459('0x3b')+_['capitalize'](_0x170f70[_0x9459('0x51')][_0x9459('0x9d')])+_0x9459('0xaf')](_0x362e9e);}})[_0x9459('0x24')](function(_0x43f9d1){return{'count':_0x47ad4b,'rows':_0x43f9d1};})[_0x9459('0x24')](respondWithResult(_0x332e7d,null))[_0x9459('0x6c')](handleError(_0x332e7d,null));};exports['getVoiceQueuesRt']=function(_0x512d50,_0x2a7305,_0x577dd1){var _0x1cffe0={};var _0x5c1d3b={};var _0xd15611;var _0x162280;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x512d50[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x2a7305,null))[_0x9459('0x24')](function(_0x5806c5){if(_0x5806c5){_0xd15611=_0x5806c5;_0x5c1d3b[_0x9459('0x4f')]=_[_0x9459('0x52')](db['UserVoiceQueueRt'][_0x9459('0x68')]);_0x5c1d3b['query']=_[_0x9459('0x52')](_0x512d50[_0x9459('0x51')]);_0x5c1d3b[_0x9459('0x53')]=_[_0x9459('0x55')](_0x5c1d3b[_0x9459('0x4f')],_0x5c1d3b['query']);_0x1cffe0[_0x9459('0x54')]=_['intersection'](_0x5c1d3b[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x512d50['query'][_0x9459('0x56')]));_0x1cffe0[_0x9459('0x54')]=_0x1cffe0[_0x9459('0x54')][_0x9459('0x57')]?_0x1cffe0[_0x9459('0x54')]:_0x5c1d3b[_0x9459('0x4f')];_0x1cffe0['order']=qs[_0x9459('0x5b')](_0x512d50[_0x9459('0x51')][_0x9459('0x5b')]);_0x1cffe0[_0x9459('0x5c')]=qs['filters'](_['pick'](_0x512d50['query'],_0x5c1d3b[_0x9459('0x53')]));if(_0x512d50[_0x9459('0x51')][_0x9459('0x41')]){_0x1cffe0[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x1cffe0[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x1cffe0[_0x9459('0x54')],function(_0x235ab0){var _0x145719={};_0x145719[_0x235ab0]={'$like':'%'+_0x512d50[_0x9459('0x51')]['filter']+'%'};return _0x145719;})});}_0x1cffe0=_[_0x9459('0x5e')]({},_0x1cffe0,_0x512d50[_0x9459('0x63')]);return _0xd15611['getVoiceQueuesRt'](_0x1cffe0);}})[_0x9459('0x24')](function(_0x5c3e82){if(_0x5c3e82){_0x162280=_0x5c3e82[_0x9459('0x57')];if(!_0x512d50[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x1cffe0[_0x9459('0x34')]=qs[_0x9459('0x34')](_0x512d50['query'][_0x9459('0x34')]);_0x1cffe0[_0x9459('0x33')]=qs['offset'](_0x512d50['query'][_0x9459('0x33')]);}return _0xd15611['getVoiceQueuesRt'](_0x1cffe0);}})['then'](function(_0x4af322){if(_0x4af322){return _0x4af322?{'count':_0x162280,'rows':_0x4af322}:null;}})[_0x9459('0x24')](respondWithResult(_0x2a7305,null))[_0x9459('0x6c')](handleError(_0x2a7305,null));};exports[_0x9459('0xc9')]=function(_0x301bb6,_0x125f51,_0x373bf2){var _0x2288b5={};var _0x15c2c5={};var _0x532397;var _0x3ed3b3;return db['User'][_0x9459('0xbd')]({'where':{'id':_0x301bb6['params']['id']}})['then'](handleEntityNotFound(_0x125f51,null))[_0x9459('0x24')](function(_0x4c071d){if(_0x4c071d){_0x532397=_0x4c071d;_0x15c2c5[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xca')][_0x9459('0x68')]);_0x15c2c5['query']=_[_0x9459('0x52')](_0x301bb6[_0x9459('0x51')]);_0x15c2c5[_0x9459('0x53')]=_['intersection'](_0x15c2c5[_0x9459('0x4f')],_0x15c2c5[_0x9459('0x51')]);_0x2288b5[_0x9459('0x54')]=_[_0x9459('0x55')](_0x15c2c5[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x301bb6[_0x9459('0x51')][_0x9459('0x56')]));_0x2288b5['attributes']=_0x2288b5[_0x9459('0x54')][_0x9459('0x57')]?_0x2288b5['attributes']:_0x15c2c5[_0x9459('0x4f')];_0x2288b5[_0x9459('0x5a')]=qs['sort'](_0x301bb6[_0x9459('0x51')][_0x9459('0x5b')]);_0x2288b5[_0x9459('0x5c')]=qs['filters'](_[_0x9459('0x5d')](_0x301bb6['query'],_0x15c2c5[_0x9459('0x53')]));if(_0x301bb6['query'][_0x9459('0x41')]){_0x2288b5[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x2288b5[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x2288b5[_0x9459('0x54')],function(_0x1c74cd){var _0x3bffb9={};_0x3bffb9[_0x1c74cd]={'$like':'%'+_0x301bb6[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x3bffb9;})});}_0x2288b5=_['merge']({},_0x2288b5,_0x301bb6[_0x9459('0x63')]);return _0x532397[_0x9459('0xc9')](_0x2288b5);}})['then'](function(_0x207cba){if(_0x207cba){_0x3ed3b3=_0x207cba['length'];if(!_0x301bb6[_0x9459('0x51')][_0x9459('0x58')]('nolimit')){_0x2288b5['limit']=qs[_0x9459('0x34')](_0x301bb6[_0x9459('0x51')][_0x9459('0x34')]);_0x2288b5[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x301bb6[_0x9459('0x51')][_0x9459('0x33')]);}return _0x532397[_0x9459('0xc9')](_0x2288b5);}})[_0x9459('0x24')](function(_0x3d49b2){if(_0x3d49b2){return _0x3d49b2?{'count':_0x3ed3b3,'rows':_0x3d49b2}:null;}})[_0x9459('0x24')](respondWithResult(_0x125f51,null))[_0x9459('0x6c')](handleError(_0x125f51,null));};exports[_0x9459('0xcb')]=function(_0x5563e5,_0x408d68,_0x4cc8fe){var _0x1aeb2d={'raw':!![],'where':{}};var _0x116e73={};var _0x316c1e={'count':0x0,'rows':[]};return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x5563e5[_0x9459('0x6d')]['id']}})['then'](handleEntityNotFound(_0x408d68,null))[_0x9459('0x24')](function(_0x52a0d6){if(_0x52a0d6){_0x116e73[_0x9459('0x4f')]=_['keys'](db['VoiceRecording'][_0x9459('0x68')]);_0x116e73[_0x9459('0x51')]=_[_0x9459('0x52')](_0x5563e5[_0x9459('0x51')]);_0x116e73['filters']=_[_0x9459('0x55')](_0x116e73[_0x9459('0x4f')],_0x116e73['query']);_0x1aeb2d[_0x9459('0x54')]=_[_0x9459('0x55')](_0x116e73[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x5563e5['query']['fields']));_0x1aeb2d['attributes']=_0x1aeb2d[_0x9459('0x54')][_0x9459('0x57')]?_0x1aeb2d[_0x9459('0x54')]:_0x116e73[_0x9459('0x4f')];if(!_0x5563e5[_0x9459('0x51')]['hasOwnProperty'](_0x9459('0x59'))){_0x1aeb2d['limit']=qs[_0x9459('0x34')](_0x5563e5[_0x9459('0x51')][_0x9459('0x34')]);_0x1aeb2d[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x5563e5[_0x9459('0x51')][_0x9459('0x33')]);}_0x1aeb2d['order']=qs[_0x9459('0x5b')](_0x5563e5[_0x9459('0x51')]['sort']);_0x1aeb2d[_0x9459('0x5c')]=qs['filters'](_[_0x9459('0x5d')](_0x5563e5['query'],_0x116e73['filters']));_0x1aeb2d['where'][_0x9459('0xcc')]=_0x52a0d6['id'];if(_0x5563e5['query'][_0x9459('0x41')]){_0x1aeb2d['where']=_[_0x9459('0x5e')](_0x1aeb2d[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x1aeb2d['attributes'],function(_0x28d3b9){var _0x276e5b={};_0x276e5b[_0x28d3b9]={'$like':'%'+_0x5563e5[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x276e5b;})});}_0x1aeb2d=_['merge']({},_0x1aeb2d,_0x5563e5[_0x9459('0x63')]);return db[_0x9459('0xcd')][_0x9459('0x32')]({'where':_0x1aeb2d[_0x9459('0x5c')]})[_0x9459('0x24')](function(_0x45cf7b){_0x316c1e[_0x9459('0x32')]=_0x45cf7b;if(_0x5563e5[_0x9459('0x51')][_0x9459('0xce')]){_0x1aeb2d['include']=[{'all':!![]}];}return db[_0x9459('0xcd')]['findAll'](_0x1aeb2d);})[_0x9459('0x24')](function(_0x13d533){_0x316c1e[_0x9459('0xcf')]=_0x13d533;return _0x316c1e;});}})[_0x9459('0x24')](respondWithFilteredResult(_0x408d68,_0x1aeb2d))[_0x9459('0x6c')](handleError(_0x408d68,null));};exports[_0x9459('0xd0')]=function(_0x1a9f5a,_0x43a906,_0x224613){var _0x3f17ff={'raw':!![],'where':{}};var _0x526a2b={};var _0x23175b={'count':0x0,'rows':[]};return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x1a9f5a[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x43a906,null))['then'](function(_0x554d37){if(_0x554d37){_0x526a2b[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xd1')]['rawAttributes']);_0x526a2b['query']=_[_0x9459('0x52')](_0x1a9f5a['query']);_0x526a2b[_0x9459('0x53')]=_[_0x9459('0x55')](_0x526a2b[_0x9459('0x4f')],_0x526a2b[_0x9459('0x51')]);_0x3f17ff[_0x9459('0x54')]=_[_0x9459('0x55')](_0x526a2b[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x1a9f5a[_0x9459('0x51')][_0x9459('0x56')]));_0x3f17ff[_0x9459('0x54')]=_0x3f17ff[_0x9459('0x54')][_0x9459('0x57')]?_0x3f17ff[_0x9459('0x54')]:_0x526a2b[_0x9459('0x4f')];if(!_0x1a9f5a[_0x9459('0x51')][_0x9459('0x58')]('nolimit')){_0x3f17ff['limit']=qs[_0x9459('0x34')](_0x1a9f5a[_0x9459('0x51')][_0x9459('0x34')]);_0x3f17ff['offset']=qs[_0x9459('0x33')](_0x1a9f5a[_0x9459('0x51')][_0x9459('0x33')]);}_0x3f17ff[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x1a9f5a[_0x9459('0x51')][_0x9459('0x5b')]);_0x3f17ff[_0x9459('0x5c')]=qs[_0x9459('0x53')](_[_0x9459('0x5d')](_0x1a9f5a[_0x9459('0x51')],_0x526a2b[_0x9459('0x53')]));_0x3f17ff['where'][_0x9459('0xcc')]=_0x554d37['id'];if(_0x1a9f5a[_0x9459('0x51')][_0x9459('0x41')]){_0x3f17ff['where']=_[_0x9459('0x5e')](_0x3f17ff[_0x9459('0x5c')],{'$or':_['map'](_0x3f17ff[_0x9459('0x54')],function(_0x49ab9a){var _0x3ecab8={};_0x3ecab8[_0x49ab9a]={'$like':'%'+_0x1a9f5a[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x3ecab8;})});}_0x3f17ff=_['merge']({},_0x3f17ff,_0x1a9f5a[_0x9459('0x63')]);return db['ScreenRecording'][_0x9459('0x32')]({'where':_0x3f17ff[_0x9459('0x5c')]})[_0x9459('0x24')](function(_0x340819){_0x23175b[_0x9459('0x32')]=_0x340819;if(_0x1a9f5a[_0x9459('0x51')][_0x9459('0xce')]){_0x3f17ff[_0x9459('0xbf')]=[{'all':!![]}];}return db[_0x9459('0xd1')]['findAll'](_0x3f17ff);})['then'](function(_0x528261){_0x23175b[_0x9459('0xcf')]=_0x528261;return _0x23175b;});}})[_0x9459('0x24')](respondWithFilteredResult(_0x43a906,_0x3f17ff))['catch'](handleError(_0x43a906,null));};exports['getChatInteractions']=function(_0x12412b,_0x17aae9,_0x17fb76){var _0x32031e={};var _0x236614={};var _0x219c40;var _0x5e6f62;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x12412b[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x17aae9,null))[_0x9459('0x24')](function(_0x509160){if(_0x509160){_0x219c40=_0x509160;_0x236614[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xd2')]['rawAttributes']);_0x236614[_0x9459('0x51')]=_[_0x9459('0x52')](_0x12412b['query']);_0x236614[_0x9459('0x53')]=_['intersection'](_0x236614['model'],_0x236614[_0x9459('0x51')]);_0x32031e[_0x9459('0x54')]=_[_0x9459('0x55')](_0x236614[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x12412b[_0x9459('0x51')][_0x9459('0x56')]));_0x32031e[_0x9459('0x54')]=_0x32031e[_0x9459('0x54')][_0x9459('0x57')]?_0x32031e['attributes']:_0x236614[_0x9459('0x4f')];_0x32031e['order']=qs[_0x9459('0x5b')](_0x12412b[_0x9459('0x51')][_0x9459('0x5b')]);_0x32031e[_0x9459('0x5c')]=qs[_0x9459('0x53')](_[_0x9459('0x5d')](_0x12412b['query'],_0x236614[_0x9459('0x53')]));if(_0x12412b[_0x9459('0x51')][_0x9459('0x41')]){_0x32031e[_0x9459('0x5c')]=_['merge'](_0x32031e[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x32031e[_0x9459('0x54')],function(_0x3d410d){var _0x448bfa={};_0x448bfa[_0x3d410d]={'$like':'%'+_0x12412b[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x448bfa;})});}_0x32031e=_[_0x9459('0x5e')]({},_0x32031e,_0x12412b['options']);return _0x219c40[_0x9459('0xd3')](_0x32031e);}})[_0x9459('0x24')](function(_0x3022ed){if(_0x3022ed){_0x5e6f62=_0x3022ed[_0x9459('0x57')];if(!_0x12412b[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x32031e['limit']=qs[_0x9459('0x34')](_0x12412b[_0x9459('0x51')][_0x9459('0x34')]);_0x32031e[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x12412b[_0x9459('0x51')][_0x9459('0x33')]);}return _0x219c40['getChatInteractions'](_0x32031e);}})[_0x9459('0x24')](function(_0xe6512){if(_0xe6512){return _0xe6512?{'count':_0x5e6f62,'rows':_0xe6512}:null;}})['then'](respondWithResult(_0x17aae9,null))[_0x9459('0x6c')](handleError(_0x17aae9,null));};exports[_0x9459('0xd4')]=function(_0x3badcc,_0x1c0fbd,_0x7eb6eb){var _0x4ac664={};var _0xcdd1b2={};var _0x1195c4;var _0x1399a3;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x3badcc[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x1c0fbd,null))['then'](function(_0x5bb638){if(_0x5bb638){_0x1195c4=_0x5bb638;_0xcdd1b2[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xd5')]['rawAttributes']);_0xcdd1b2[_0x9459('0x51')]=_[_0x9459('0x52')](_0x3badcc[_0x9459('0x51')]);_0xcdd1b2[_0x9459('0x53')]=_[_0x9459('0x55')](_0xcdd1b2['model'],_0xcdd1b2['query']);_0x4ac664['attributes']=_['intersection'](_0xcdd1b2['model'],qs[_0x9459('0x56')](_0x3badcc[_0x9459('0x51')][_0x9459('0x56')]));_0x4ac664[_0x9459('0x54')]=_0x4ac664[_0x9459('0x54')][_0x9459('0x57')]?_0x4ac664[_0x9459('0x54')]:_0xcdd1b2['model'];_0x4ac664['order']=qs[_0x9459('0x5b')](_0x3badcc['query'][_0x9459('0x5b')]);_0x4ac664['where']=qs['filters'](_['pick'](_0x3badcc[_0x9459('0x51')],_0xcdd1b2[_0x9459('0x53')]));if(_0x3badcc[_0x9459('0x51')][_0x9459('0x41')]){_0x4ac664[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x4ac664['where'],{'$or':_[_0x9459('0x43')](_0x4ac664[_0x9459('0x54')],function(_0x4578a1){var _0x5a75d3={};_0x5a75d3[_0x4578a1]={'$like':'%'+_0x3badcc[_0x9459('0x51')]['filter']+'%'};return _0x5a75d3;})});}_0x4ac664=_[_0x9459('0x5e')]({},_0x4ac664,_0x3badcc[_0x9459('0x63')]);return _0x1195c4['getOpenchannelInteractions'](_0x4ac664);}})[_0x9459('0x24')](function(_0x4f1eb3){if(_0x4f1eb3){_0x1399a3=_0x4f1eb3[_0x9459('0x57')];if(!_0x3badcc[_0x9459('0x51')]['hasOwnProperty']('nolimit')){_0x4ac664['limit']=qs[_0x9459('0x34')](_0x3badcc['query']['limit']);_0x4ac664['offset']=qs[_0x9459('0x33')](_0x3badcc[_0x9459('0x51')][_0x9459('0x33')]);}return _0x1195c4['getOpenchannelInteractions'](_0x4ac664);}})[_0x9459('0x24')](function(_0x53fe26){if(_0x53fe26){return _0x53fe26?{'count':_0x1399a3,'rows':_0x53fe26}:null;}})['then'](respondWithResult(_0x1c0fbd,null))[_0x9459('0x6c')](handleError(_0x1c0fbd,null));};exports['getMailInteractions']=function(_0x4747ff,_0x540c39,_0x1aa7e2){var _0x150a80={'raw':!![],'where':{}};var _0x290e9e={};var _0x3b9ec7={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x4747ff[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x540c39,null))[_0x9459('0x24')](function(_0x5ba99f){if(_0x5ba99f){_0x290e9e[_0x9459('0x4f')]=_[_0x9459('0x52')](db['MailInteraction'][_0x9459('0x68')]);_0x290e9e['query']=_[_0x9459('0x52')](_0x4747ff['query']);_0x290e9e[_0x9459('0x53')]=_['intersection'](_0x290e9e[_0x9459('0x4f')],_0x290e9e[_0x9459('0x51')]);_0x150a80['attributes']=_[_0x9459('0x55')](_0x290e9e[_0x9459('0x4f')],qs['fields'](_0x4747ff[_0x9459('0x51')]['fields']));_0x150a80[_0x9459('0x54')]=_0x150a80['attributes'][_0x9459('0x57')]?_0x150a80[_0x9459('0x54')]:_0x290e9e[_0x9459('0x4f')];if(!_0x4747ff[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x150a80[_0x9459('0x34')]=qs[_0x9459('0x34')](_0x4747ff[_0x9459('0x51')][_0x9459('0x34')]);_0x150a80['offset']=qs['offset'](_0x4747ff['query'][_0x9459('0x33')]);}_0x150a80[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x4747ff['query'][_0x9459('0x5b')]);_0x150a80[_0x9459('0x5c')]=qs['filters'](_['pick'](_0x4747ff[_0x9459('0x51')],_0x290e9e[_0x9459('0x53')]));_0x150a80['where'][_0x9459('0xcc')]=_0x5ba99f['id'];if(_0x4747ff[_0x9459('0x51')][_0x9459('0x41')]){_0x150a80[_0x9459('0x5c')]=_['merge'](_0x150a80[_0x9459('0x5c')],{'$or':_['map'](_0x150a80[_0x9459('0x54')],function(_0x2fe602){var _0x2b063d={};_0x2b063d[_0x2fe602]={'$like':'%'+_0x4747ff[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x2b063d;})});}_0x150a80=_[_0x9459('0x5e')]({},_0x150a80,_0x4747ff['options']);return db[_0x9459('0xd6')]['count']({'where':_0x150a80['where']})['then'](function(_0x4ed550){_0x3b9ec7[_0x9459('0x32')]=_0x4ed550;if(_0x4747ff[_0x9459('0x51')]['includeAll']){_0x150a80[_0x9459('0xbf')]=[{'all':!![]}];}return db[_0x9459('0xd6')][_0x9459('0x65')](_0x150a80);})[_0x9459('0x24')](function(_0x53a15e){_0x3b9ec7[_0x9459('0xcf')]=_0x53a15e;return _0x3b9ec7;});}})[_0x9459('0x24')](respondWithFilteredResult(_0x540c39,_0x150a80))[_0x9459('0x6c')](handleError(_0x540c39,null));};exports[_0x9459('0xd7')]=function(_0x2e8985,_0x39d900,_0x1128ce){var _0x8fdc39={};var _0x368d85={};var _0x548eb1;var _0x187cf3;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x2e8985[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x39d900,null))[_0x9459('0x24')](function(_0x2b4b12){if(_0x2b4b12){_0x548eb1=_0x2b4b12;_0x368d85['model']=_[_0x9459('0x52')](db[_0x9459('0xd8')][_0x9459('0x68')]);_0x368d85['query']=_[_0x9459('0x52')](_0x2e8985[_0x9459('0x51')]);_0x368d85[_0x9459('0x53')]=_[_0x9459('0x55')](_0x368d85['model'],_0x368d85[_0x9459('0x51')]);_0x8fdc39[_0x9459('0x54')]=_[_0x9459('0x55')](_0x368d85[_0x9459('0x4f')],qs['fields'](_0x2e8985[_0x9459('0x51')][_0x9459('0x56')]));_0x8fdc39['attributes']=_0x8fdc39[_0x9459('0x54')][_0x9459('0x57')]?_0x8fdc39['attributes']:_0x368d85['model'];_0x8fdc39[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x2e8985[_0x9459('0x51')][_0x9459('0x5b')]);_0x8fdc39[_0x9459('0x5c')]=qs[_0x9459('0x53')](_[_0x9459('0x5d')](_0x2e8985[_0x9459('0x51')],_0x368d85[_0x9459('0x53')]));if(_0x2e8985[_0x9459('0x51')][_0x9459('0x41')]){_0x8fdc39['where']=_[_0x9459('0x5e')](_0x8fdc39[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x8fdc39['attributes'],function(_0x1b23ff){var _0x347908={};_0x347908[_0x1b23ff]={'$like':'%'+_0x2e8985[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x347908;})});}_0x8fdc39=_[_0x9459('0x5e')]({},_0x8fdc39,_0x2e8985['options']);return _0x548eb1[_0x9459('0xd7')](_0x8fdc39);}})[_0x9459('0x24')](function(_0x3da69e){if(_0x3da69e){_0x187cf3=_0x3da69e['length'];if(!_0x2e8985[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x8fdc39[_0x9459('0x34')]=qs[_0x9459('0x34')](_0x2e8985[_0x9459('0x51')]['limit']);_0x8fdc39[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x2e8985['query']['offset']);}return _0x548eb1[_0x9459('0xd7')](_0x8fdc39);}})[_0x9459('0x24')](function(_0x4fd84a){if(_0x4fd84a){return _0x4fd84a?{'count':_0x187cf3,'rows':_0x4fd84a}:null;}})[_0x9459('0x24')](respondWithResult(_0x39d900,null))[_0x9459('0x6c')](handleError(_0x39d900,null));};exports[_0x9459('0xd9')]=function(_0x3ae1cc,_0x3ce225,_0x559020){var _0x3ca348={};var _0x54007a={};var _0x4e768f;var _0x1c1ba5;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x3ae1cc['params']['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x3ce225,null))['then'](function(_0x3de22a){if(_0x3de22a){_0x4e768f=_0x3de22a;_0x54007a[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xda')][_0x9459('0x68')]);_0x54007a[_0x9459('0x51')]=_['keys'](_0x3ae1cc[_0x9459('0x51')]);_0x54007a[_0x9459('0x53')]=_[_0x9459('0x55')](_0x54007a[_0x9459('0x4f')],_0x54007a[_0x9459('0x51')]);_0x3ca348[_0x9459('0x54')]=_[_0x9459('0x55')](_0x54007a[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x3ae1cc[_0x9459('0x51')][_0x9459('0x56')]));_0x3ca348[_0x9459('0x54')]=_0x3ca348['attributes'][_0x9459('0x57')]?_0x3ca348[_0x9459('0x54')]:_0x54007a['model'];_0x3ca348[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x3ae1cc[_0x9459('0x51')]['sort']);_0x3ca348[_0x9459('0x5c')]=qs[_0x9459('0x53')](_[_0x9459('0x5d')](_0x3ae1cc[_0x9459('0x51')],_0x54007a[_0x9459('0x53')]));if(_0x3ae1cc[_0x9459('0x51')]['filter']){_0x3ca348[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x3ca348['where'],{'$or':_['map'](_0x3ca348['attributes'],function(_0x16adc2){var _0x2298fa={};_0x2298fa[_0x16adc2]={'$like':'%'+_0x3ae1cc[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x2298fa;})});}_0x3ca348=_[_0x9459('0x5e')]({},_0x3ca348,_0x3ae1cc['options']);return _0x4e768f[_0x9459('0xd9')](_0x3ca348);}})[_0x9459('0x24')](function(_0x122edf){if(_0x122edf){_0x1c1ba5=_0x122edf[_0x9459('0x57')];if(!_0x3ae1cc[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x3ca348[_0x9459('0x34')]=qs['limit'](_0x3ae1cc[_0x9459('0x51')]['limit']);_0x3ca348['offset']=qs['offset'](_0x3ae1cc[_0x9459('0x51')][_0x9459('0x33')]);}return _0x4e768f[_0x9459('0xd9')](_0x3ca348);}})[_0x9459('0x24')](function(_0x518537){if(_0x518537){return _0x518537?{'count':_0x1c1ba5,'rows':_0x518537}:null;}})['then'](respondWithResult(_0x3ce225,null))[_0x9459('0x6c')](handleError(_0x3ce225,null));};exports[_0x9459('0xdb')]=function(_0x50fe59,_0x1e8780,_0x44ea46){var _0x164391={};var _0x346715={};var _0x304c81;var _0x30425a;return db['User'][_0x9459('0xbd')]({'where':{'id':_0x50fe59[_0x9459('0x6d')]['id']}})['then'](handleEntityNotFound(_0x1e8780,null))[_0x9459('0x24')](function(_0x2d8c2f){if(_0x2d8c2f){_0x304c81=_0x2d8c2f;_0x346715[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xdc')][_0x9459('0x68')]);_0x346715[_0x9459('0x51')]=_['keys'](_0x50fe59[_0x9459('0x51')]);_0x346715['filters']=_[_0x9459('0x55')](_0x346715[_0x9459('0x4f')],_0x346715[_0x9459('0x51')]);_0x164391['attributes']=_[_0x9459('0x55')](_0x346715[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x50fe59[_0x9459('0x51')]['fields']));_0x164391[_0x9459('0x54')]=_0x164391[_0x9459('0x54')][_0x9459('0x57')]?_0x164391[_0x9459('0x54')]:_0x346715[_0x9459('0x4f')];_0x164391[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x50fe59['query'][_0x9459('0x5b')]);_0x164391[_0x9459('0x5c')]=qs['filters'](_['pick'](_0x50fe59[_0x9459('0x51')],_0x346715[_0x9459('0x53')]));if(_0x50fe59[_0x9459('0x51')]['filter']){_0x164391[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x164391['where'],{'$or':_[_0x9459('0x43')](_0x164391['attributes'],function(_0x585e91){var _0x408fa0={};_0x408fa0[_0x585e91]={'$like':'%'+_0x50fe59['query']['filter']+'%'};return _0x408fa0;})});}_0x164391=_[_0x9459('0x5e')]({},_0x164391,_0x50fe59[_0x9459('0x63')]);return _0x304c81[_0x9459('0xdb')](_0x164391);}})[_0x9459('0x24')](function(_0x4e6cc0){if(_0x4e6cc0){_0x30425a=_0x4e6cc0[_0x9459('0x57')];if(!_0x50fe59[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x164391['limit']=qs['limit'](_0x50fe59[_0x9459('0x51')][_0x9459('0x34')]);_0x164391[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x50fe59[_0x9459('0x51')][_0x9459('0x33')]);}return _0x304c81[_0x9459('0xdb')](_0x164391);}})[_0x9459('0x24')](function(_0x7cd2ac){if(_0x7cd2ac){return _0x7cd2ac?{'count':_0x30425a,'rows':_0x7cd2ac}:null;}})[_0x9459('0x24')](respondWithResult(_0x1e8780,null))[_0x9459('0x6c')](handleError(_0x1e8780,null));};exports[_0x9459('0xdd')]=function(_0x17d657,_0xb6fb69,_0x18cc12){var _0x6a4268;var _0x3fddfc;var _0x56a663;var _0x53e256=!_[_0x9459('0x78')](_0x17d657[_0x9459('0x6d')]['id'])?_0x17d657[_0x9459('0x6d')]['id']:!_[_0x9459('0x78')](_0x17d657[_0x9459('0x3d')]['id'])?_0x17d657[_0x9459('0x3d')]['id']:null;return db[_0x9459('0x64')][_0x9459('0x69')]({'where':{'id':_0x53e256,'role':{'$or':[_0x9459('0x73'),_0x9459('0x3d'),_0x9459('0x3f')]}},'attributes':['id','name','phone',_0x9459('0xde'),_0x9459('0x46'),_0x9459('0x80'),'loginInPause']})[_0x9459('0x24')](function(_0x3226e4){if(_0x3226e4){if(_0x3226e4['role']===_0x9459('0x3f')){_0x6a4268=_0x3226e4;if(_0x17d657[_0x9459('0x6b')]['interface']){_0x56a663=util['format']('LOCAL/%s@from-sip/n',_0x6a4268[_0x17d657[_0x9459('0x6b')][_0x9459('0xa1')]]);}else if(_0x17d657[_0x9459('0x6b')][_0x9459('0xdf')]){_0x56a663=util[_0x9459('0x7a')](_0x9459('0xe0'),_0x17d657['body']['intrf']);}else{_0x56a663=util[_0x9459('0x7a')](_0x9459('0xe0'),_0x6a4268[_0x9459('0x49')]);}socket['to'](util[_0x9459('0x7a')](_0x9459('0xe1'),_0x6a4268['name']))['emit'](_0x9459('0xe2'),{'ip':_0x17d657[_0x9459('0xe3')][_0x9459('0xe4')]||_0x17d657[_0x9459('0xe5')][_0x9459('0xe6')]||_0x17d657[_0x9459('0xe7')][_0x9459('0xe6')]||_0x17d657[_0x9459('0xe5')][_0x9459('0xe7')][_0x9459('0xe6')]});return db[_0x9459('0xab')]['destroy']({'where':{'membername':_0x6a4268['name']},'individualHooks':!![]});}}else{throw new db[(_0x9459('0x21'))]['ValidationError'](_0x9459('0xe8'));}})[_0x9459('0x24')](function(){if(_0x6a4268){return _0x6a4268[_0x9459('0xe9')]({'raw':!![]});}})[_0x9459('0x24')](function(_0x3df229){if(_0x6a4268){var _0x4386dd=[];if(_0x3df229){_0x3fddfc=_0x3df229;if(_0x3fddfc[_0x9459('0x57')]){for(var _0x1e94b7=0x0;_0x1e94b7<_0x3fddfc[_0x9459('0x57')];_0x1e94b7++){_0x4386dd[_0x9459('0xaa')]({'membername':_0x6a4268[_0x9459('0x49')],'UserId':_0x6a4268['id'],'queue_name':_0x3fddfc[_0x1e94b7][_0x9459('0x49')],'VoiceQueueId':_0x3fddfc[_0x1e94b7]['id'],'interface':_0x56a663,'paused':_0x6a4268[_0x9459('0x9f')]||![],'penalty':_0x3fddfc[_0x1e94b7][_0x9459('0xea')]||0x0});}return BPromise[_0x9459('0xeb')](_0x4386dd,function(_0x3475d1){return db['UserVoiceQueueRt'][_0x9459('0xec')](_0x3475d1);});}}}})[_0x9459('0x24')](function(){if(_0x6a4268){return db[_0x9459('0xed')][_0x9459('0x65')]({'where':{'membername':_0x6a4268[_0x9459('0x49')],'exitAt':null}});}})[_0x9459('0x24')](function(_0x53025b){if(_0x6a4268){var _0x3ea4dc=[];_0x53025b[_0x9459('0xee')](function(_0x350e74){_0x3ea4dc[_0x9459('0xaa')](_0x350e74[_0x9459('0x3a')]({'exitAt':moment()[_0x9459('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9459('0xef')](_0x3ea4dc);}})[_0x9459('0x24')](function(){if(_0x6a4268){var _0x24c159=[];var _0x57f24e=[];var _0x33549a=utils[_0x9459('0xf0')]();var _0x5e15a6={'membername':_0x6a4268[_0x9459('0x49')],'interface':_0x56a663,'enterAt':moment()[_0x9459('0x7a')](_0x9459('0xf1')),'role':_0x6a4268[_0x9459('0x46')],'internal':_0x6a4268[_0x9459('0x80')]};_0x33549a[_0x9459('0xee')](function(_0xdaf3a1){_0x24c159[_0x9459('0xaa')](_[_0x9459('0x5e')]({'channel':_0xdaf3a1,'type':_0x9459('0xf2'),'data1':_0x17d657[_0x9459('0x6b')][_0x9459('0xf3')],'data2':_0x56a663},_0x5e15a6));if(_0x6a4268[_0x9459('0x9f')]){_0x57f24e['push'](_[_0x9459('0x5e')]({'channel':_0xdaf3a1,'type':_0x9459('0xf4'),'data1':'LOGININPAUSE'},_0x5e15a6));}});return db[_0x9459('0xed')]['bulkCreate'](_0x24c159[_0x9459('0xf5')](_0x57f24e),{'individualHooks':!![]});}})[_0x9459('0x24')](function(){if(_0x6a4268){return _0x6a4268[_0x9459('0x3a')]({'online':!![],'lastLoginAt':moment()[_0x9459('0x7a')](_0x9459('0xf1')),'voicePause':_0x6a4268[_0x9459('0x9f')]||![],'mailPause':_0x6a4268[_0x9459('0x9f')]||![],'chatPause':_0x6a4268['loginInPause']||![],'faxPause':_0x6a4268['loginInPause']||![],'smsPause':_0x6a4268[_0x9459('0x9f')]||![],'openchannelPause':_0x6a4268['loginInPause']||![],'whatsappPause':_0x6a4268[_0x9459('0x9f')]||![],'pauseType':_0x6a4268[_0x9459('0x9f')]?_0x9459('0xf6'):null,'interface':_0x56a663,'lastPauseAt':moment()[_0x9459('0x7a')](_0x9459('0xf1'))});}})[_0x9459('0x24')](function(_0x565496){if(_0x17d657[_0x9459('0xf7')]){return _0x18cc12();}else{return BPromise[_0x9459('0xf8')](_0x565496)[_0x9459('0x24')](respondWithResult(_0xb6fb69,null));}})[_0x9459('0x6c')](handleError(_0xb6fb69,null));};exports[_0x9459('0xf9')]=function(_0x58d03b,_0x2014ce,_0x3177c5){var _0x51e25b;return db[_0x9459('0x64')][_0x9459('0x69')]({'where':{'id':_0x58d03b[_0x9459('0x6d')]['id'],'role':_0x9459('0x3f')},'attributes':['id',_0x9459('0x49'),_0x9459('0x46')]})[_0x9459('0x24')](handleEntityNotFound(_0x2014ce,null))[_0x9459('0x24')](function(_0x5bf58d){if(_0x5bf58d){_0x51e25b=_0x5bf58d;return db[_0x9459('0xab')][_0x9459('0xb1')]({'where':{'membername':_0x51e25b[_0x9459('0x49')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x51e25b[_0x9459('0x49')],'exitAt':null}});})[_0x9459('0x24')](function(_0x37c124){var _0x472044=[];_0x37c124[_0x9459('0xee')](function(_0x21e89a){_0x472044[_0x9459('0xaa')](_0x21e89a[_0x9459('0x3a')]({'exitAt':moment()[_0x9459('0x7a')](_0x9459('0xf1'))}));});return BPromise[_0x9459('0xef')](_0x472044);})[_0x9459('0x24')](function(){return _0x51e25b['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9459('0x24')](respondWithResult(_0x2014ce,null))[_0x9459('0x6c')](handleError(_0x2014ce,null));};exports[_0x9459('0xfa')]=function(_0x10d56a,_0x5e21f1,_0x17008f){var _0x7608e4;return db[_0x9459('0xab')][_0x9459('0x3a')]({'paused':0x1},{'where':{'UserId':_0x10d56a['params']['id']},'individualHooks':!![]})[_0x9459('0x24')](function(){return db[_0x9459('0x64')]['find']({'where':{'id':_0x10d56a['params']['id'],'role':_0x9459('0x3f')},'attributes':['id',_0x9459('0x49'),_0x9459('0x46'),_0x9459('0x80'),_0x9459('0xa1')]});})['then'](handleEntityNotFound(_0x5e21f1,null))['then'](function(_0x597780){if(_0x597780){_0x7608e4=_0x597780;return respondWithRpcPromise('QueuePause',_0x9459('0xfa'),{'id':_0x7608e4['id'],'name':_0x7608e4[_0x9459('0x49')],'pause':!![]});}})[_0x9459('0x24')](function(){if(_0x7608e4){return db['MemberReport'][_0x9459('0x65')]({'where':{'membername':_0x7608e4[_0x9459('0x49')],'type':_0x9459('0xf4'),'exitAt':null}});}})[_0x9459('0x24')](function(_0x5a6e88){if(_0x5a6e88[_0x9459('0x57')]){var _0x21226e=moment()['format'](_0x9459('0xf1'));for(var _0x5110f0=0x0,_0x274820=_0x5a6e88[_0x9459('0x57')];_0x5110f0<_0x274820;_0x5110f0++){_0x5a6e88[_0x5110f0][_0x9459('0xfb')]({'exitAt':_0x21226e});}}})[_0x9459('0x24')](function(){var _0x41d944=[];var _0x4863bb=utils['getChannels']();_0x4863bb[_0x9459('0xee')](function(_0x1262f0){_0x41d944[_0x9459('0xaa')]({'channel':_0x1262f0,'membername':_0x7608e4[_0x9459('0x49')],'interface':_['isNil'](_0x7608e4[_0x9459('0xa1')])?util['format'](_0x9459('0xe0'),_0x7608e4[_0x9459('0x49')]):_0x7608e4[_0x9459('0xa1')],'type':'PAUSE','enterAt':moment()[_0x9459('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x10d56a[_0x9459('0x6b')][_0x9459('0x4d')]||_0x9459('0xfc'),'role':_0x7608e4[_0x9459('0x46')],'internal':_0x7608e4[_0x9459('0x80')]});});return db[_0x9459('0xed')][_0x9459('0x6a')](_0x41d944,{'individualHooks':!![]});})[_0x9459('0x24')](function(){return _0x7608e4['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x10d56a[_0x9459('0x6b')]['type']||_0x9459('0xfc'),'lastPauseAt':moment()[_0x9459('0x7a')](_0x9459('0xf1'))});})[_0x9459('0x24')](respondWithResult(_0x5e21f1,null))[_0x9459('0x6c')](handleError(_0x5e21f1,null));};exports[_0x9459('0xfd')]=function(_0x4904c5,_0x1d4716,_0x5ba8c1){var _0xeebcaa;return db[_0x9459('0x64')][_0x9459('0x69')]({'where':{'id':_0x4904c5['params']['id']},'attributes':['id',_0x9459('0x49'),'role',_0x9459('0xa0'),_0x9459('0xfe'),_0x9459('0xff'),_0x9459('0x100'),_0x9459('0x101'),'smsPause',_0x9459('0x102'),_0x9459('0x103'),_0x9459('0x104')]})[_0x9459('0x24')](handleEntityNotFound(_0x1d4716,null))['then'](function(_0x4f0b79){if(_0x4f0b79){_0xeebcaa=_0x4f0b79;if(_0x4904c5[_0x9459('0x6b')][_0x9459('0x9d')]&&!utils[_0x9459('0xa2')](_0x4904c5[_0x9459('0x6b')][_0x9459('0x9d')])){throw new db[(_0x9459('0x21'))]['ValidationError']('Unknown\x20channel');}switch(_0x4904c5[_0x9459('0x6b')]['channel']){case _0x9459('0xa9'):return respondWithRpcPromise(_0x9459('0x105'),'unpause',{'id':_0xeebcaa['id'],'name':_0xeebcaa[_0x9459('0x49')],'pause':![]})['then'](function(){return db[_0x9459('0xab')][_0x9459('0x3a')]({'paused':0x0},{'where':{'UserId':_0xeebcaa['id']},'individualHooks':!![]});})['then'](function(){return db[_0x9459('0xed')]['find']({'where':{'channel':_0x4904c5[_0x9459('0x6b')]['channel'],'membername':_0xeebcaa[_0x9459('0x49')],'type':_0x9459('0xf4'),'exitAt':null}});})['then'](function(_0x12b8ee){if(_0x12b8ee){return _0x12b8ee[_0x9459('0x3a')]({'exitAt':moment()[_0x9459('0x7a')](_0x9459('0xf1')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x9459('0x24')](function(){return _0xeebcaa['update']({'voicePause':![]});});case'mail':case'chat':case _0x9459('0x106'):case _0x9459('0x107'):case _0x9459('0x108'):case'openchannel':return db[_0x9459('0xed')][_0x9459('0x69')]({'where':{'channel':_0x4904c5[_0x9459('0x6b')][_0x9459('0x9d')],'membername':_0xeebcaa[_0x9459('0x49')],'type':_0x9459('0xf4'),'exitAt':null}})['then'](function(_0x17c40c){if(_0x17c40c){return _0x17c40c['update']({'exitAt':moment()['format'](_0x9459('0xf1')),'data2':_0x9459('0x109')},{'individualHooks':!![]});}return null;})[_0x9459('0x24')](function(){var _0x2f1b33={};_[_0x9459('0x35')](_0x2f1b33,util['format'](_0x9459('0x10a'),_0x4904c5[_0x9459('0x6b')][_0x9459('0x9d')],_0x9459('0x10b')),![]);return _0xeebcaa['update'](_0x2f1b33);});default:return respondWithRpcPromise(_0x9459('0x105'),'unpause',{'id':_0xeebcaa['id'],'name':_0xeebcaa[_0x9459('0x49')],'pause':![]})[_0x9459('0x24')](function(){return db[_0x9459('0xab')]['update']({'paused':0x0},{'where':{'UserId':_0xeebcaa['id']}});})[_0x9459('0x24')](function(){return db[_0x9459('0xed')]['findAll']({'where':{'membername':_0xeebcaa['name'],'type':_0x9459('0xf4'),'exitAt':null}});})[_0x9459('0x24')](function(_0x411542){var _0x359ddd=[];_0x411542[_0x9459('0xee')](function(_0x39225a){_0x359ddd[_0x9459('0xaa')](_0x39225a[_0x9459('0x3a')]({'exitAt':moment()[_0x9459('0x7a')](_0x9459('0xf1')),'data2':'manual'}));});return BPromise[_0x9459('0xef')](_0x359ddd);})[_0x9459('0x24')](function(){return _0xeebcaa[_0x9459('0x3a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x1d4716,null))[_0x9459('0x6c')](handleError(_0x1d4716,null));};exports[_0x9459('0x10c')]=function(_0x2f7e79,_0x5f1bd4,_0xfad01a){var _0xfa7609={};var _0x1007c1={};var _0x1bed60;var _0x9133c5;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x2f7e79[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x5f1bd4,null))[_0x9459('0x24')](function(_0x2838e1){if(_0x2838e1){_0x1bed60=_0x2838e1;_0x1007c1[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0x10d')][_0x9459('0x68')]);_0x1007c1[_0x9459('0x51')]=_[_0x9459('0x52')](_0x2f7e79['query']);_0x1007c1[_0x9459('0x53')]=_[_0x9459('0x55')](_0x1007c1['model'],_0x1007c1['query']);_0xfa7609['attributes']=_[_0x9459('0x55')](_0x1007c1['model'],qs[_0x9459('0x56')](_0x2f7e79[_0x9459('0x51')][_0x9459('0x56')]));_0xfa7609['attributes']=_0xfa7609[_0x9459('0x54')][_0x9459('0x57')]?_0xfa7609['attributes']:_0x1007c1[_0x9459('0x4f')];_0xfa7609[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x2f7e79[_0x9459('0x51')][_0x9459('0x5b')]);_0xfa7609[_0x9459('0x5c')]=qs['filters'](_[_0x9459('0x5d')](_0x2f7e79[_0x9459('0x51')],_0x1007c1[_0x9459('0x53')]));if(_0x2f7e79[_0x9459('0x51')][_0x9459('0x41')]){_0xfa7609[_0x9459('0x5c')]=_['merge'](_0xfa7609['where'],{'$or':_[_0x9459('0x43')](_0xfa7609[_0x9459('0x54')],function(_0xd5942a){var _0x4239c6={};_0x4239c6[_0xd5942a]={'$like':'%'+_0x2f7e79['query'][_0x9459('0x41')]+'%'};return _0x4239c6;})});}_0xfa7609=_['merge']({},_0xfa7609,_0x2f7e79[_0x9459('0x63')]);return _0x1bed60[_0x9459('0x10c')](_0xfa7609);}})[_0x9459('0x24')](function(_0x49ac2c){if(_0x49ac2c){_0x9133c5=_0x49ac2c[_0x9459('0x57')];if(!_0x2f7e79['query'][_0x9459('0x58')](_0x9459('0x59'))){_0xfa7609['limit']=qs[_0x9459('0x34')](_0x2f7e79['query'][_0x9459('0x34')]);_0xfa7609[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x2f7e79[_0x9459('0x51')]['offset']);}return _0x1bed60[_0x9459('0x10c')](_0xfa7609);}})['then'](function(_0x5efe8a){if(_0x5efe8a){return _0x5efe8a?{'count':_0x9133c5,'rows':_0x5efe8a}:null;}})[_0x9459('0x24')](respondWithResult(_0x5f1bd4,null))[_0x9459('0x6c')](handleError(_0x5f1bd4,null));};exports[_0x9459('0x10e')]=function(_0xa9a345,_0x3ab7b4){return db['User'][_0x9459('0x69')]({'where':{'id':_0xa9a345['params']['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x3ab7b4,null))[_0x9459('0x24')](function(_0x290bec){if(_0x290bec){var _0x211e4f=_0x290bec['get']({'plain':!![]});return _0x290bec[_0x9459('0x10e')](_0xa9a345[_0x9459('0x6b')][_0x9459('0x70')],_[_0x9459('0x71')](_0xa9a345[_0x9459('0x6b')],[_0x9459('0x70'),'id'])||{})[_0x9459('0x24')](function(){for(var _0x381694=0x0;_0x381694<_0xa9a345[_0x9459('0x6b')][_0x9459('0x70')][_0x9459('0x57')];_0x381694++){var _0x565cc5=[];db[_0x9459('0x10d')][_0x9459('0xbd')]({'where':{'id':_0xa9a345[_0x9459('0x6b')]['ids'][_0x381694]}})[_0x9459('0x24')](function(_0x26cf36){_0x565cc5[_0x9459('0xaa')](_0x26cf36[_0x9459('0xe9')]()[_0x9459('0x24')](function(_0x344fc3){for(var _0x29ea4f=0x0;_0x29ea4f<_0x344fc3[_0x9459('0x57')];_0x29ea4f++){_0x344fc3[_0x29ea4f][_0x9459('0x10f')](_0x9459('0x9d'),_0x9459('0x110'));}return _0x344fc3;}));_0x565cc5[_0x9459('0xaa')](_0x26cf36[_0x9459('0x111')]()[_0x9459('0x24')](function(_0x5529a7){for(var _0x2dcafd=0x0;_0x2dcafd<_0x5529a7[_0x9459('0x57')];_0x2dcafd++){_0x5529a7[_0x2dcafd]['setDataValue']('channel',_0x9459('0x112'));}return _0x5529a7;}));_0x565cc5[_0x9459('0xaa')](_0x26cf36['getMailQueues']()['then'](function(_0x2e114a){for(var _0x39e3d2=0x0;_0x39e3d2<_0x2e114a[_0x9459('0x57')];_0x39e3d2++){_0x2e114a[_0x39e3d2][_0x9459('0x10f')]('channel',_0x9459('0x113'));}return _0x2e114a;}));_0x565cc5['push'](_0x26cf36[_0x9459('0x114')]()['then'](function(_0x2041fb){for(var _0x504451=0x0;_0x504451<_0x2041fb[_0x9459('0x57')];_0x504451++){_0x2041fb[_0x504451][_0x9459('0x10f')](_0x9459('0x9d'),'Sms');}return _0x2041fb;}));_0x565cc5[_0x9459('0xaa')](_0x26cf36[_0x9459('0x115')]()[_0x9459('0x24')](function(_0x4017ff){for(var _0x2b1dca=0x0;_0x2b1dca<_0x4017ff[_0x9459('0x57')];_0x2b1dca++){_0x4017ff[_0x2b1dca]['setDataValue']('channel',_0x9459('0x116'));}return _0x4017ff;}));_0x565cc5[_0x9459('0xaa')](_0x26cf36['getFaxQueues']()['then'](function(_0x40f207){for(var _0x7d70a1=0x0;_0x7d70a1<_0x40f207[_0x9459('0x57')];_0x7d70a1++){_0x40f207[_0x7d70a1][_0x9459('0x10f')](_0x9459('0x9d'),_0x9459('0x117'));}return _0x40f207;}));_0x565cc5[_0x9459('0xaa')](_0x26cf36[_0x9459('0x118')]()[_0x9459('0x24')](function(_0x16b6b6){for(var _0x4cafb7=0x0;_0x4cafb7<_0x16b6b6[_0x9459('0x57')];_0x4cafb7++){_0x16b6b6[_0x4cafb7]['setDataValue'](_0x9459('0x9d'),_0x9459('0x119'));}return _0x16b6b6;}));return BPromise['all'](_0x565cc5);})[_0x9459('0x24')](function(_0x212586){var _0x30cab3=_['flatten'](_0x212586);_0x565cc5=[];return db[_0x9459('0x60')][_0x9459('0x11a')](function(_0x264fbd){for(var _0x2039b9=0x0;_0x2039b9<_0x30cab3['length'];_0x2039b9++){_0x565cc5[_0x9459('0xaa')](_0x30cab3[_0x2039b9][_0x9459('0x11b')](_0x211e4f['id']),{'transaction':_0x264fbd});}return BPromise[_0x9459('0xef')](_0x565cc5)[_0x9459('0x24')](function(){if(_0x211e4f[_0x9459('0x9e')]){return BPromise[_0x9459('0xeb')](_[_0x9459('0x41')](_0x30cab3,function(_0x2ec926){return _0x2ec926['getDataValue'](_0x9459('0x9d'))===_0x9459('0x110');}),function(_0x3a63d4){return db[_0x9459('0xab')][_0x9459('0xec')]({'membername':_0x211e4f[_0x9459('0x49')],'UserId':_0x211e4f['id'],'queue_name':_0x3a63d4['name'],'VoiceQueueId':_0x3a63d4['id'],'interface':_[_0x9459('0x78')](_0x211e4f[_0x9459('0xa1')])?util[_0x9459('0x7a')](_0x9459('0xe0'),_0x211e4f[_0x9459('0x49')]):_0x211e4f[_0x9459('0xa1')],'paused':_0x211e4f['voicePause']||![],'penalty':_0x211e4f[_0x9459('0xa6')]},{'transaction':_0x264fbd});});}else{return;}})[_0x9459('0x24')](function(){for(var _0x1e802b=0x0;_0x1e802b<_0x30cab3[_0x9459('0x57')];_0x1e802b++){var _0x2cfdb0=_0x30cab3[_0x1e802b]['getDataValue'](_0x9459('0x9d'));var _0x18f82a=_0x2cfdb0+_0x9459('0xa7');socket[_0x9459('0xa8')](_0x9459('0x3d')+_0x2cfdb0+'Queue:save',{'UserId':_0x211e4f['id'],['queueField']:_0x30cab3[_0x1e802b]['id']});}});});});}});}})[_0x9459('0x24')](respondWithStatusCode(_0x3ab7b4,null))[_0x9459('0x6c')](handleError(_0x3ab7b4,null));};exports[_0x9459('0x11c')]=function(_0x254aa,_0xc58493){return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x254aa[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0xc58493,null))['then'](function(_0xafcb60){if(_0xafcb60){var _0x1fc0d5=_0xafcb60[_0x9459('0x3b')]({'plain':!![]});var _0x33c8c4=_0x254aa[_0x9459('0x51')]['ids'];return _0xafcb60[_0x9459('0x11c')](_0x33c8c4)[_0x9459('0x24')](function(){for(var _0x4652aa=0x0;_0x4652aa<_0x33c8c4[_0x9459('0x57')];_0x4652aa++){var _0x5639e4=[];db[_0x9459('0x10d')][_0x9459('0xbd')]({'where':{'id':_0x33c8c4[_0x4652aa]}})[_0x9459('0x24')](function(_0x1aeb2e){_0x5639e4[_0x9459('0xaa')](_0x1aeb2e['getVoiceQueues']()[_0x9459('0x24')](function(_0x29a0f0){for(var _0x4e2b75=0x0;_0x4e2b75<_0x29a0f0[_0x9459('0x57')];_0x4e2b75++){_0x29a0f0[_0x4e2b75][_0x9459('0x10f')](_0x9459('0x9d'),'Voice');}return _0x29a0f0;}));_0x5639e4['push'](_0x1aeb2e[_0x9459('0x111')]()['then'](function(_0xf9f56c){for(var _0x55e0a3=0x0;_0x55e0a3<_0xf9f56c[_0x9459('0x57')];_0x55e0a3++){_0xf9f56c[_0x55e0a3]['setDataValue'](_0x9459('0x9d'),_0x9459('0x112'));}return _0xf9f56c;}));_0x5639e4[_0x9459('0xaa')](_0x1aeb2e['getMailQueues']()['then'](function(_0x3a8eb){for(var _0x251771=0x0;_0x251771<_0x3a8eb['length'];_0x251771++){_0x3a8eb[_0x251771][_0x9459('0x10f')](_0x9459('0x9d'),_0x9459('0x113'));}return _0x3a8eb;}));_0x5639e4[_0x9459('0xaa')](_0x1aeb2e[_0x9459('0x114')]()[_0x9459('0x24')](function(_0x3c8513){for(var _0x5a21d5=0x0;_0x5a21d5<_0x3c8513['length'];_0x5a21d5++){_0x3c8513[_0x5a21d5][_0x9459('0x10f')](_0x9459('0x9d'),_0x9459('0x11d'));}return _0x3c8513;}));_0x5639e4[_0x9459('0xaa')](_0x1aeb2e['getWhatsappQueues']()[_0x9459('0x24')](function(_0x2c3b11){for(var _0x16dc92=0x0;_0x16dc92<_0x2c3b11[_0x9459('0x57')];_0x16dc92++){_0x2c3b11[_0x16dc92]['setDataValue'](_0x9459('0x9d'),_0x9459('0x116'));}return _0x2c3b11;}));_0x5639e4[_0x9459('0xaa')](_0x1aeb2e[_0x9459('0x11e')]()[_0x9459('0x24')](function(_0x49e27c){for(var _0x152aa4=0x0;_0x152aa4<_0x49e27c[_0x9459('0x57')];_0x152aa4++){_0x49e27c[_0x152aa4]['setDataValue'](_0x9459('0x9d'),_0x9459('0x117'));}return _0x49e27c;}));_0x5639e4[_0x9459('0xaa')](_0x1aeb2e['getOpenchannelQueues']()[_0x9459('0x24')](function(_0x6b16c9){for(var _0x396674=0x0;_0x396674<_0x6b16c9['length'];_0x396674++){_0x6b16c9[_0x396674]['setDataValue'](_0x9459('0x9d'),'Openchannel');}return _0x6b16c9;}));return BPromise[_0x9459('0xef')](_0x5639e4);})[_0x9459('0x24')](function(_0x2b5b8c){var _0x43f7f0=_[_0x9459('0x11f')](_0x2b5b8c);_0x5639e4=[];return db[_0x9459('0x60')][_0x9459('0x11a')](function(_0x568134){for(var _0x131753=0x0;_0x131753<_0x43f7f0[_0x9459('0x57')];_0x131753++){_0x5639e4[_0x9459('0xaa')](_0x43f7f0[_0x131753][_0x9459('0x120')](_0x1fc0d5['id']),{'transaction':_0x568134});}return BPromise['all'](_0x5639e4)[_0x9459('0x24')](function(){if(_0x1fc0d5[_0x9459('0x9e')]){return BPromise['each'](_[_0x9459('0x41')](_0x43f7f0,function(_0x1bc1a6){return _0x1bc1a6[_0x9459('0x121')](_0x9459('0x9d'))===_0x9459('0x110');}),function(_0x231a54){return db[_0x9459('0xab')][_0x9459('0xb1')]({'where':{'VoiceQueueId':_0x231a54['id'],'UserId':_0x1fc0d5['id']},'transaction':_0x568134});});}else{return;}})[_0x9459('0x24')](function(){for(var _0x11a3f2=0x0;_0x11a3f2<_0x43f7f0[_0x9459('0x57')];_0x11a3f2++){var _0x3f9b97=_0x43f7f0[_0x11a3f2][_0x9459('0x121')](_0x9459('0x9d'));var _0x4ab411=_0x3f9b97+_0x9459('0xa7');socket[_0x9459('0xa8')](_0x9459('0x3d')+_0x3f9b97+_0x9459('0xb0'),{'UserId':_0x1fc0d5['id'],['queueField']:_0x43f7f0[_0x11a3f2]['id']});}});});});}});}})['then'](respondWithStatusCode(_0xc58493,null))[_0x9459('0x6c')](handleError(_0xc58493,null));};exports[_0x9459('0x122')]=function(_0x11be21,_0x21600e,_0x2d29ac){var _0x390b95={};var _0x39f0fa={};var _0x25276b;var _0x1b9502;return db['User'][_0x9459('0xbd')]({'where':{'id':_0x11be21[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x21600e,null))[_0x9459('0x24')](function(_0x135562){if(_0x135562){_0x25276b=_0x135562;_0x39f0fa[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xc0')][_0x9459('0x68')]);_0x39f0fa[_0x9459('0x51')]=_[_0x9459('0x52')](_0x11be21['query']);_0x39f0fa[_0x9459('0x53')]=_[_0x9459('0x55')](_0x39f0fa[_0x9459('0x4f')],_0x39f0fa[_0x9459('0x51')]);_0x390b95[_0x9459('0x54')]=_[_0x9459('0x55')](_0x39f0fa[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x11be21['query'][_0x9459('0x56')]));_0x390b95[_0x9459('0x54')]=_0x390b95[_0x9459('0x54')][_0x9459('0x57')]?_0x390b95[_0x9459('0x54')]:_0x39f0fa['model'];_0x390b95[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x11be21[_0x9459('0x51')][_0x9459('0x5b')]);_0x390b95['where']=qs[_0x9459('0x53')](_[_0x9459('0x5d')](_0x11be21[_0x9459('0x51')],_0x39f0fa['filters']));if(_0x11be21[_0x9459('0x51')][_0x9459('0x41')]){_0x390b95[_0x9459('0x5c')]=_['merge'](_0x390b95[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x390b95['attributes'],function(_0x46da51){var _0x2ecf59={};_0x2ecf59[_0x46da51]={'$like':'%'+_0x11be21[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x2ecf59;})});}_0x390b95=_[_0x9459('0x5e')]({},_0x390b95,_0x11be21[_0x9459('0x63')]);return _0x25276b['getLists'](_0x390b95);}})[_0x9459('0x24')](function(_0x41fc34){if(_0x41fc34){_0x1b9502=_0x41fc34[_0x9459('0x57')];if(!_0x11be21['query']['hasOwnProperty'](_0x9459('0x59'))){_0x390b95[_0x9459('0x34')]=qs[_0x9459('0x34')](_0x11be21[_0x9459('0x51')][_0x9459('0x34')]);_0x390b95['offset']=qs[_0x9459('0x33')](_0x11be21[_0x9459('0x51')][_0x9459('0x33')]);}return _0x25276b['getLists'](_0x390b95);}})[_0x9459('0x24')](function(_0x35eb6f){if(_0x35eb6f){return _0x35eb6f?{'count':_0x1b9502,'rows':_0x35eb6f}:null;}})[_0x9459('0x24')](respondWithResult(_0x21600e,null))[_0x9459('0x6c')](handleError(_0x21600e,null));};exports[_0x9459('0x123')]=function(_0x3fa4e9,_0x4aa827,_0x349786){var _0xb9ab0f={};var _0x247678={};var _0x4b9dc3;var _0x103e42;return db['User'][_0x9459('0xbd')]({'where':{'id':_0x3fa4e9[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x4aa827,null))[_0x9459('0x24')](function(_0x44f842){if(_0x44f842){_0x4b9dc3=_0x44f842;_0x247678[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0x64')]['rawAttributes']);_0x247678[_0x9459('0x51')]=_[_0x9459('0x52')](_0x3fa4e9[_0x9459('0x51')]);_0x247678[_0x9459('0x53')]=_[_0x9459('0x55')](_0x247678[_0x9459('0x4f')],_0x247678[_0x9459('0x51')]);_0xb9ab0f['attributes']=_[_0x9459('0x55')](_0x247678[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x3fa4e9['query'][_0x9459('0x56')]));_0xb9ab0f[_0x9459('0x54')]=_0xb9ab0f[_0x9459('0x54')][_0x9459('0x57')]?_0xb9ab0f['attributes']:_0x247678[_0x9459('0x4f')];_0xb9ab0f['order']=qs[_0x9459('0x5b')](_0x3fa4e9[_0x9459('0x51')][_0x9459('0x5b')]);_0xb9ab0f['where']=qs['filters'](_['pick'](_0x3fa4e9[_0x9459('0x51')],_0x247678['filters']));if(_0x3fa4e9[_0x9459('0x51')]['filter']){_0xb9ab0f[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0xb9ab0f[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0xb9ab0f[_0x9459('0x54')],function(_0x2f9f68){var _0x20df22={};_0x20df22[_0x2f9f68]={'$like':'%'+_0x3fa4e9['query'][_0x9459('0x41')]+'%'};return _0x20df22;})});}_0xb9ab0f[_0x9459('0x4f')]=db[_0x9459('0x64')];_0xb9ab0f['as']=_0x9459('0x3e');_0xb9ab0f=_[_0x9459('0x5e')]({},_0xb9ab0f,_0x3fa4e9[_0x9459('0x63')]);return _0x4b9dc3[_0x9459('0xe9')]({'include':[_0xb9ab0f]});}})['then'](function(_0x16ae6e){if(_0x16ae6e){var _0xd4fc7b={},_0x1474b6=[],_0x4c1d8f=0x0;for(var _0xfa815=0x0;_0xfa815<_0x16ae6e[_0x9459('0x57')];_0xfa815+=0x1){for(var _0xc6a54e=0x0,_0xcff861;_0xc6a54e<_0x16ae6e[_0xfa815]['Agents'][_0x9459('0x57')];_0xc6a54e+=0x1){_0xcff861=_0x16ae6e[_0xfa815][_0x9459('0x3e')][_0xc6a54e]['get']({'plain':!![]});_0xd4fc7b[_0xcff861['id']]=_0xcff861;}}_0xd4fc7b=_[_0x9459('0x124')](_0xd4fc7b);for(var _0x3e10e1=qs['offset'](_0x3fa4e9['query'][_0x9459('0x33')]);_0x3e10e1<_0xd4fc7b['length']&&_0x1474b6['length']=_0x490160){_0x46fbc3=_0x490160;_0x588976=0xc8;}else{_0x588976=0xce;}_0x2a1093[_0x7337('0x33')](_0x588976);return _0x2a1093['set'](_0x7337('0x39'),_0x2187cd+'-'+_0x46fbc3+'/'+_0x490160)[_0x7337('0x35')](_0x477c6d);}return null;};}function patchUpdates(_0x187026){return function(_0xbdb762){try{jsonpatch[_0x7337('0x3a')](_0xbdb762,_0x187026,!![]);}catch(_0xe85361){return BPromise['reject'](_0xe85361);}return _0xbdb762[_0x7337('0x3b')]();};}function saveUpdates(_0x5e9c21,_0x583eef){return function(_0x207c4f){if(_0x207c4f){return _0x207c4f[_0x7337('0x3c')](_0x5e9c21)[_0x7337('0x27')](function(_0x3c9f31){return _0x3c9f31;});}return null;};}function removeEntity(_0x1f061b,_0x38bacd){return function(_0x70abb6){if(_0x70abb6){return _0x70abb6[_0x7337('0x3d')]()[_0x7337('0x27')](function(){var _0x67d257=_0x70abb6[_0x7337('0x3e')]({'plain':!![]});var _0x5d3f83=[{'name':_0x7337('0x3f'),'value':_0x7337('0x40'),'ignore':!![]},{'name':_0x7337('0x41'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x7337('0x42'),'ignore':![]}];var _0x12cfb8=_(_0x5d3f83)['filter'](_0x7337('0x43'))['map'](_0x7337('0x44'))[_0x7337('0x44')]();if(_['includes'](_0x12cfb8,_0x67d257[_0x7337('0x45')])){return;}var _0x4ebdc7=_[_0x7337('0x46')](_0x5d3f83,[_0x7337('0x44'),_0x67d257[_0x7337('0x45')]])[_0x7337('0x47')];return db[_0x7337('0x48')][_0x7337('0x3d')]({'where':{'type':_0x4ebdc7,'resourceId':_0x67d257['id']}})[_0x7337('0x27')](function(){return _0x70abb6;});})[_0x7337('0x27')](function(){_0x1f061b[_0x7337('0x33')](0xcc)[_0x7337('0x34')]();});}};}function handleEntityNotFound(_0x77008f,_0x5cae20){return function(_0x505937){if(!_0x505937){_0x77008f['sendStatus'](0x194);}return _0x505937;};}function handleError(_0xa3d4c4,_0x141908){_0x141908=_0x141908||0x1f4;return function(_0x3bb4e3){logger[_0x7337('0x2e')](_0x3bb4e3[_0x7337('0x49')]);if(_0x3bb4e3[_0x7337('0x47')]){delete _0x3bb4e3['name'];}_0xa3d4c4[_0x7337('0x33')](_0x141908)['send'](_0x3bb4e3);};}exports['index']=function(_0x463aae,_0x12fd46){var _0x1b36e8={},_0x11f663={},_0x56d973={'count':0x0,'rows':[]};var _0x3a3009=_[_0x7337('0x4a')](db['User'][_0x7337('0x4b')],function(_0x1501b6){return{'name':_0x1501b6[_0x7337('0x4c')],'type':_0x1501b6[_0x7337('0x4d')][_0x7337('0x4e')]};});_0x11f663[_0x7337('0x4f')]=_['differenceBy'](_[_0x7337('0x4a')](_0x3a3009,'name'),[_0x7337('0x50'),_0x7337('0x51')]);_0x11f663[_0x7337('0x52')]=_['keys'](_0x463aae[_0x7337('0x52')]);_0x11f663[_0x7337('0x53')]=_[_0x7337('0x54')](_0x11f663['model'],_0x11f663['query']);_0x1b36e8[_0x7337('0x55')]=_[_0x7337('0x54')](_0x11f663[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x463aae[_0x7337('0x52')][_0x7337('0x56')]));_0x1b36e8[_0x7337('0x55')]=_0x1b36e8[_0x7337('0x55')][_0x7337('0x57')]?_0x1b36e8[_0x7337('0x55')]:_0x11f663[_0x7337('0x4f')];if(!_0x463aae[_0x7337('0x52')][_0x7337('0x58')]('nolimit')){_0x1b36e8[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x463aae[_0x7337('0x52')]['limit']);_0x1b36e8['offset']=qs[_0x7337('0x37')](_0x463aae['query']['offset']);}_0x1b36e8[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x463aae[_0x7337('0x52')][_0x7337('0x5a')]);_0x1b36e8[_0x7337('0x5b')]=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0x463aae['query'],_0x11f663[_0x7337('0x53')]),_0x3a3009);if(_0x463aae[_0x7337('0x52')][_0x7337('0x5d')]){_0x1b36e8[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x1b36e8['where'],{'$or':_['map'](_0x3a3009,function(_0x34a373){if(_0x34a373[_0x7337('0x4d')]!==_0x7337('0x5f')){return db[_0x7337('0x60')][_0x7337('0x5b')](db[_0x7337('0x60')]['fn'](_0x7337('0x61'),db[_0x7337('0x60')][_0x7337('0x62')](_0x34a373[_0x7337('0x47')])),{'$like':db['sequelize']['fn'](_0x7337('0x61'),'%'+_0x463aae['query'][_0x7337('0x5d')]+'%')});}})});}_0x1b36e8=_[_0x7337('0x5e')]({},_0x1b36e8,_0x463aae[_0x7337('0x63')]);var _0x5d175e={'where':_0x1b36e8[_0x7337('0x5b')]};return db[_0x7337('0x64')]['count'](_0x5d175e)[_0x7337('0x27')](function(_0x35cf4e){_0x56d973[_0x7337('0x36')]=_0x35cf4e;if(_0x463aae[_0x7337('0x52')]['includeAll']){_0x1b36e8['include']=[{'all':!![]}];}return db['User'][_0x7337('0x65')](_0x1b36e8);})[_0x7337('0x27')](function(_0x37a5a8){_0x56d973['rows']=_0x37a5a8;return _0x56d973;})['then'](respondWithFilteredResult(_0x12fd46,_0x1b36e8))[_0x7337('0x31')](handleError(_0x12fd46,null));};exports['show']=function(_0x8b9a03,_0x3d0fcb){var _0x245ce1={'raw':![],'where':{'id':_0x8b9a03['params']['id']}},_0x5d3c18={};_0x5d3c18['model']=_[_0x7337('0x66')](_[_0x7337('0x67')](db[_0x7337('0x64')][_0x7337('0x4b')]),['password',_0x7337('0x51')]);_0x5d3c18['query']=_[_0x7337('0x67')](_0x8b9a03[_0x7337('0x52')]);_0x5d3c18[_0x7337('0x53')]=_[_0x7337('0x54')](_0x5d3c18['model'],_0x5d3c18['query']);_0x245ce1[_0x7337('0x55')]=_['intersection'](_0x5d3c18[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x8b9a03[_0x7337('0x52')][_0x7337('0x56')]));_0x245ce1[_0x7337('0x55')]=_0x245ce1[_0x7337('0x55')][_0x7337('0x57')]?_0x245ce1[_0x7337('0x55')]:_0x5d3c18[_0x7337('0x4f')];if(_0x8b9a03['query'][_0x7337('0x68')]){_0x245ce1[_0x7337('0x69')]=[{'all':!![]}];}_0x245ce1=_[_0x7337('0x5e')]({},_0x245ce1,_0x8b9a03[_0x7337('0x63')]);return db[_0x7337('0x64')]['find'](_0x245ce1)[_0x7337('0x27')](handleEntityNotFound(_0x3d0fcb,null))[_0x7337('0x27')](respondWithResult(_0x3d0fcb,null))[_0x7337('0x31')](handleError(_0x3d0fcb,null));};exports['bulkCreate']=function(_0x5341ed,_0x20edbb){return db[_0x7337('0x64')][_0x7337('0x6a')](_0x5341ed['body'],{'raw':![],'individualHooks':!![]})[_0x7337('0x27')](respondWithResult(_0x20edbb,0xc9))[_0x7337('0x31')](handleError(_0x20edbb,null));};exports[_0x7337('0x3c')]=function(_0x122c94,_0x3c3f02){if(_0x122c94[_0x7337('0x6b')]['id']){delete _0x122c94[_0x7337('0x6b')]['id'];}delete _0x122c94[_0x7337('0x6b')][_0x7337('0x45')];return db[_0x7337('0x64')]['find']({'where':{'id':_0x122c94['params']['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x3c3f02,null))['then'](saveUpdates(_0x122c94['body'],null))[_0x7337('0x27')](respondWithResult(_0x3c3f02,null))[_0x7337('0x31')](handleError(_0x3c3f02,null));};exports[_0x7337('0x6c')]=function(_0x19df21,_0x46f0a7){return db[_0x7337('0x64')]['describe']()['then'](respondWithResult(_0x46f0a7,null))[_0x7337('0x31')](handleError(_0x46f0a7,null));};exports['addContacts']=function(_0x11cdd7,_0x3ea0f9,_0x50febb){return db[_0x7337('0x64')][_0x7337('0x46')]({'where':{'id':_0x11cdd7[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x3ea0f9,null))['then'](function(_0x5c978f){if(_0x5c978f){return _0x5c978f[_0x7337('0x6e')](_0x11cdd7[_0x7337('0x6b')]['ids'],_[_0x7337('0x6f')](_0x11cdd7[_0x7337('0x6b')],[_0x7337('0x70'),'id'])||{});}})[_0x7337('0x27')](respondWithResult(_0x3ea0f9,null))[_0x7337('0x31')](handleError(_0x3ea0f9,null));};var getLicense=function(_0x56160a){return new BPromise(function(_0x4f5899,_0xfd7f2d){var _0x3231e7=0x0;_0x56160a[_0x7337('0x6b')][_0x7337('0x45')]===_0x7337('0x71')&&_0x4f5899(_0x7337('0x72'));return db[_0x7337('0x64')][_0x7337('0x36')]({'where':{'$or':[{'role':_0x56160a[_0x7337('0x6b')]['role']===_0x7337('0x42')?'telephone':[_0x7337('0x73'),_0x7337('0x40')]}]}})[_0x7337('0x27')](function(_0x4be810){_0x3231e7=_0x4be810;return require(_0x7337('0x74'))['getLicense']();})[_0x7337('0x27')](function(_0x98bbd0){var _0xdda792=_0x56160a[_0x7337('0x6b')][_0x7337('0x45')]===_0x7337('0x42')?'telephones':'users';if(!_[_0x7337('0x75')](_0x98bbd0[_0xdda792])&&_0x3231e7>=_0x98bbd0[_0xdda792]){return _0xfd7f2d({'message':_0x7337('0x76')});}return _0x4f5899(util[_0x7337('0x77')](_0x7337('0x78'),_0xdda792,_0x3231e7));})[_0x7337('0x31')](function(_0x4486a2){return _0xfd7f2d(_0x4486a2);});});};exports['create']=function(_0x4bc775,_0x569ea1){return getLicense(_0x4bc775)[_0x7337('0x27')](function(_0x4ff0b6){if(!_0x4bc775[_0x7337('0x6b')][_0x7337('0x79')]){var _0x3f20b3;return db[_0x7337('0x7a')][_0x7337('0x7b')](0x1)['then'](function(_0x576f84){return checkPasswordPattern(_0x576f84,_0x4bc775[_0x7337('0x6b')][_0x7337('0x50')],_0x576f84[_0x7337('0x7c')]);})['then'](function(_0x3b5c1d){_0x3f20b3=_0x3b5c1d[_0x7337('0x7d')];return db[_0x7337('0x64')][_0x7337('0x7e')](_0x7337('0x79'));})[_0x7337('0x27')](function(_0x2b09f5){if(_[_0x7337('0x75')](_0x2b09f5)){if(_0x3f20b3){_0x4bc775[_0x7337('0x6b')]['internal']=_0x3f20b3;}else{_0x4bc775['body']['internal']=0x1;}}else{if(_['isNil'](_0x3f20b3)||_0x3f20b3==_0x2b09f5){_0x4bc775['body'][_0x7337('0x79')]=_0x2b09f5+0x1;}else if(_0x3f20b3>_0x2b09f5){_0x4bc775['body'][_0x7337('0x79')]=_0x3f20b3;}else{return db[_0x7337('0x60')][_0x7337('0x52')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x7337('0x60')][_0x7337('0x7f')][_0x7337('0x80')]})[_0x7337('0x27')](function(_0x25c021){if(_0x25c021&&_0x25c021[_0x7337('0x57')]){for(var _0x8c9db1=0x0,_0x5215cf=_0x25c021[_0x7337('0x57')];_0x8c9db1<_0x5215cf&&_[_0x7337('0x75')](_0x4bc775[_0x7337('0x6b')]['internal']);_0x8c9db1++){if(_0x3f20b3<=_0x25c021[_0x8c9db1][_0x7337('0x81')]){_0x4bc775[_0x7337('0x6b')][_0x7337('0x79')]=_0x25c021[_0x8c9db1][_0x7337('0x81')];}else if(_0x3f20b3>_0x25c021[_0x8c9db1][_0x7337('0x81')]&&_0x3f20b3<=_0x25c021[_0x8c9db1]['to']){_0x4bc775[_0x7337('0x6b')]['internal']=_0x3f20b3;}}}if(_[_0x7337('0x75')](_0x4bc775['body'][_0x7337('0x79')])){_0x4bc775[_0x7337('0x6b')]['internal']=_0x2b09f5+0x1;}});}}});}})['then'](function(){if(_0x4bc775[_0x7337('0x6b')][_0x7337('0x82')]){_0x4bc775[_0x7337('0x6b')][_0x7337('0x83')]=_0x4bc775['body'][_0x7337('0x79')];_0x4bc775['body'][_0x7337('0x84')]={'mailbox':_0x4bc775[_0x7337('0x6b')]['internal'],'password':_0x4bc775[_0x7337('0x6b')]['password'],'fullname':_0x4bc775[_0x7337('0x6b')][_0x7337('0x85')],'email':_0x4bc775[_0x7337('0x6b')][_0x7337('0x86')]};}if(_0x4bc775[_0x7337('0x6b')]&&_0x4bc775[_0x7337('0x6b')]['role']===_0x7337('0x71')){if(!_0x4bc775[_0x7337('0x6b')][_0x7337('0x87')]){_0x4bc775[_0x7337('0x6b')][_0x7337('0x87')]=[_0x7337('0x88'),_0x7337('0x89'),_0x7337('0x8a'),_0x7337('0x8b'),_0x7337('0x8c'),_0x7337('0x8d'),_0x7337('0x8e'),_0x7337('0x8f'),_0x7337('0x90'),_0x7337('0x91'),'109',_0x7337('0x92'),_0x7337('0x93'),_0x7337('0x94')];}}return db[_0x7337('0x64')][_0x7337('0x95')](_0x4bc775['body'],{'include':[{'model':db['VoiceMail'],'as':_0x7337('0x84')}]});})[_0x7337('0x27')](function(_0x139fe3){if(_0x4bc775[_0x7337('0x6b')][_0x7337('0x45')]===_0x7337('0x40'))return _0x139fe3;var _0x1fbcd6=_0x4bc775[_0x7337('0x40')][_0x7337('0x3e')]({'plain':!![]});if(!_0x1fbcd6)throw new Error(_0x7337('0x96'));if(_0x1fbcd6[_0x7337('0x45')]==='user'){var _0x76ed76=_0x139fe3[_0x7337('0x3e')]({'plain':!![]});var _0x18e0d1=[{'name':_0x7337('0x41'),'value':_0x7337('0x71')},{'name':_0x7337('0x97'),'value':_0x7337('0x42')}];var _0x18d9e9=_[_0x7337('0x46')](_0x18e0d1,[_0x7337('0x44'),_0x76ed76[_0x7337('0x45')]])[_0x7337('0x47')];return db['UserProfileSection'][_0x7337('0x46')]({'where':{'name':_0x18d9e9,'userProfileId':_0x1fbcd6['userProfileId']},'raw':!![]})[_0x7337('0x27')](function(_0x6d5f61){if(_0x6d5f61&&_0x6d5f61[_0x7337('0x98')]===0x0){return db[_0x7337('0x48')]['create']({'name':_0x76ed76[_0x7337('0x47')],'resourceId':_0x76ed76['id'],'type':_0x6d5f61[_0x7337('0x47')],'sectionId':_0x6d5f61['id']},{})[_0x7337('0x27')](function(){return _0x139fe3;});}else{return _0x139fe3;}})[_0x7337('0x31')](function(_0x4bfffc){logger[_0x7337('0x2e')](_0x7337('0x99'),_0x4bfffc);throw _0x4bfffc;});}return _0x139fe3;})[_0x7337('0x27')](respondWithResult(_0x569ea1,0xc9))[_0x7337('0x31')](handleError(_0x569ea1,null));};exports[_0x7337('0x9a')]=function(_0x29c939,_0x58a6c4,_0x2bea90){var _0x52ecac=![];if(_0x29c939[_0x7337('0x6b')]['id']){delete _0x29c939['body']['id'];}return db['Setting'][_0x7337('0x9b')]({'attributes':['id',_0x7337('0x7c')]})['then'](function(_0x205280){_0x52ecac=_0x205280['securePassword'];return db[_0x7337('0x64')]['find']({'where':{'id':_0x29c939[_0x7337('0x6d')]['id']}});})['then'](function(_0x57f409){if(_0x57f409){if(_0x57f409['id']==_0x29c939[_0x7337('0x40')]['id']){if(!_0x29c939[_0x7337('0x6b')][_0x7337('0x9c')]||!_0x29c939[_0x7337('0x6b')]['newPassword']){throw new db['Sequelize'][(_0x7337('0x9d'))](_0x7337('0x9e'));}if(!_0x57f409['authenticate'](_0x29c939['body'][_0x7337('0x9c')])){throw new db['Sequelize'][(_0x7337('0x9d'))](_0x7337('0x9f'));}if(_0x29c939[_0x7337('0x6b')][_0x7337('0x9c')]==_0x29c939[_0x7337('0x6b')][_0x7337('0xa0')]){throw new db['Sequelize'][(_0x7337('0x9d'))](_0x7337('0xa1'));}return _0x57f409;}else if(_0x29c939[_0x7337('0x40')]['role']==_0x7337('0x73')){if(!_0x29c939[_0x7337('0x6b')]['newPassword']){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x57f409;}else if(_0x29c939[_0x7337('0x40')]['role']==_0x7337('0x40')){if(!_0x29c939[_0x7337('0x6b')]['newPassword']){throw new db[(_0x7337('0x24'))]['ValidationError'](_0x7337('0xa2'));}if(_0x57f409[_0x7337('0x45')]!=_0x7337('0x71')){throw new db[(_0x7337('0x24'))][(_0x7337('0x9d'))]('Unauthorized');}return _0x57f409;}else{throw new db[(_0x7337('0x24'))][(_0x7337('0x9d'))](_0x7337('0xa3'));}}return null;})[_0x7337('0x27')](handleEntityNotFound(_0x58a6c4,null))[_0x7337('0x27')](function(_0x40add5){return checkPasswordPattern(_0x40add5,_0x29c939['body']['newPassword'],_0x52ecac);})[_0x7337('0x27')](saveUpdates({'password':_0x29c939['body'][_0x7337('0xa0')],'passwordResetAt':_0x29c939[_0x7337('0x40')]['id']==_0x29c939[_0x7337('0x6d')]['id']?moment():null},null))['then'](respondWithResult(_0x58a6c4,null))[_0x7337('0x31')](handleError(_0x58a6c4,null));};exports[_0x7337('0xa4')]=function(_0x11a1a2,_0x527fba,_0x3cdf13){var _0x37b2f5=_0x11a1a2[_0x7337('0x6b')][_0x7337('0xa5')];return db[_0x7337('0x64')]['find']({'where':{'id':_0x11a1a2[_0x7337('0x6d')]['id']},'attributes':['id',_0x7337('0x47'),_0x7337('0x45'),_0x7337('0xa6'),_0x7337('0xa7'),_0x7337('0xa8'),_0x7337('0xa9')]})[_0x7337('0x27')](handleEntityNotFound(_0x527fba,null))['then'](function(_0x13f122){if(_0x13f122){if(!utils[_0x7337('0xaa')](_0x37b2f5)){throw new db['Sequelize'][(_0x7337('0x9d'))](_0x7337('0xab'));}return _0x13f122[_0x7337('0xac')+_[_0x7337('0xad')](_0x37b2f5['toLowerCase']())+_0x7337('0xae')](_0x11a1a2['body'][_0x7337('0x70')],{'penalty':_0x11a1a2[_0x7337('0x6b')][_0x7337('0xaf')]||0x0})[_0x7337('0xb0')](function(_0x40a712){for(var _0x45692f=0x0;_0x45692f<_0x11a1a2[_0x7337('0x6b')][_0x7337('0x70')][_0x7337('0x57')];_0x45692f+=0x1){var _0x219aea={'UserId':_0x11a1a2[_0x7337('0x6d')]['id']};_0x219aea[_['capitalize'](_0x37b2f5['toLowerCase']())+_0x7337('0xb1')]=_0x11a1a2[_0x7337('0x6b')]['ids'][_0x45692f];socket[_0x7337('0xb2')](_0x7337('0x40')+_[_0x7337('0xad')](_0x37b2f5[_0x7337('0xb3')]())+'Queue:save',_0x219aea);}return _0x40a712;})['then'](function(){if(_0x37b2f5===_0x7337('0xb4')){return db['VoiceQueue'][_0x7337('0x65')]({'where':{'id':_0x11a1a2[_0x7337('0x6b')][_0x7337('0x70')]||[]},'raw':!![],'attributes':['id',_0x7337('0x47')]});}})[_0x7337('0x27')](function(_0x5676ba){var _0x1d0b6f=_0x13f122[_0x7337('0x3e')]({'plain':!![]});var _0x7cc338=[];if(_0x37b2f5==='voice'&&_0x1d0b6f[_0x7337('0x45')]==='agent'&&_0x1d0b6f[_0x7337('0xa6')]){for(var _0x10013e=0x0;_0x10013e<_0x5676ba[_0x7337('0x57')];_0x10013e+=0x1){_0x7cc338['push']({'membername':_0x1d0b6f[_0x7337('0x47')],'UserId':_0x1d0b6f['id'],'queue_name':_0x5676ba[_0x10013e]['name'],'VoiceQueueId':_0x5676ba[_0x10013e]['id'],'interface':_[_0x7337('0x75')](_0x1d0b6f['interface'])?util[_0x7337('0x77')](_0x7337('0xb5'),_0x1d0b6f['name']):_0x1d0b6f[_0x7337('0xa9')],'paused':_0x1d0b6f['voicePause']||![],'penalty':_0x11a1a2[_0x7337('0x6b')][_0x7337('0xaf')]||0x0});}return BPromise['each'](_0x7cc338,function(_0x3c9a2a){return db['UserVoiceQueueRt']['upsert'](_0x3c9a2a);});}return _0x13f122;});}})[_0x7337('0x27')](respondWithStatusCode(_0x527fba,null))['catch'](handleError(_0x527fba,null));};exports[_0x7337('0xb6')]=function(_0x9570a1,_0x1ffdd0,_0x5247e0){var _0x3d306e;return db['User'][_0x7337('0x46')]({'where':{'id':_0x9570a1[_0x7337('0x6d')]['id']},'attributes':['id',_0x7337('0x47'),'role']})[_0x7337('0x27')](handleEntityNotFound(_0x1ffdd0,null))[_0x7337('0x27')](function(_0x39f73b){if(_0x39f73b){_0x3d306e=_0x39f73b;if(!_0x9570a1[_0x7337('0x52')]['channel']||!utils[_0x7337('0xaa')](_0x9570a1[_0x7337('0x52')]['channel'])){throw new db['Sequelize'][(_0x7337('0x9d'))]('Unknown\x20channel');}return _0x39f73b['remove'+_[_0x7337('0xad')](_0x9570a1['query']['channel'][_0x7337('0xb3')]())+_0x7337('0xae')](_0x9570a1[_0x7337('0x52')][_0x7337('0x70')]);}})[_0x7337('0x27')](function(_0x493eb0){for(var _0x29d1c9=0x0;_0x29d1c9<_0x9570a1[_0x7337('0x52')][_0x7337('0x70')][_0x7337('0x57')];_0x29d1c9+=0x1){var _0x2248f0={'UserId':_0x9570a1[_0x7337('0x6d')]['id']};_0x2248f0[_[_0x7337('0xad')](_0x9570a1[_0x7337('0x52')][_0x7337('0xa5')][_0x7337('0xb3')]())+_0x7337('0xb1')]=_0x9570a1[_0x7337('0x52')][_0x7337('0x70')][_0x29d1c9];socket['emit'](_0x7337('0x40')+_[_0x7337('0xad')](_0x9570a1[_0x7337('0x52')]['channel'][_0x7337('0xb3')]())+_0x7337('0xb7'),_0x2248f0);}return _0x493eb0;})['then'](function(){if(_0x9570a1['query']['channel']==='voice'){return db[_0x7337('0xb8')][_0x7337('0x3d')]({'where':{'UserId':_0x9570a1[_0x7337('0x6d')]['id'],'VoiceQueueId':_0x9570a1[_0x7337('0x52')][_0x7337('0x70')]},'individualHooks':!![]})[_0x7337('0x27')](function(){return _0x3d306e;});}return _0x3d306e;})[_0x7337('0x27')](respondWithStatusCode(_0x1ffdd0,null))[_0x7337('0x31')](handleError(_0x1ffdd0,null));};exports[_0x7337('0xb9')]=function(_0x5cf75a,_0x4a3246,_0x244099){_0x5cf75a[_0x7337('0x6b')][_0x7337('0xba')]=_0x5cf75a[_0x7337('0xbb')][_0x7337('0xbc')];return db[_0x7337('0x64')][_0x7337('0x46')]({'where':{'id':_0x5cf75a['params']['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x4a3246,null))[_0x7337('0x27')](saveUpdates(_0x5cf75a['body'],null))['then'](respondWithResult(_0x4a3246,null))[_0x7337('0x31')](handleError(_0x4a3246,null));};exports[_0x7337('0xbd')]=function(_0x45dda8,_0x2a96c8,_0x3b1c05){var _0x40a357=path[_0x7337('0xbe')](config[_0x7337('0xbf')],_0x7337('0xc0'));return db[_0x7337('0x64')][_0x7337('0x46')]({'where':{'id':_0x45dda8[_0x7337('0x6d')]['id']},'attributes':['id',_0x7337('0xba')],'raw':!![]})[_0x7337('0x27')](handleEntityNotFound(_0x2a96c8,null))['then'](function(_0x195830){if(_0x195830){if(_[_0x7337('0x75')](_0x195830[_0x7337('0xba')])){return _0x2a96c8['download'](_0x40a357);}else{if(!fs[_0x7337('0xc1')](path['join'](config[_0x7337('0xbf')],'server/files/images/',_0x195830['userpic']))){return _0x2a96c8['download'](_0x40a357);}return _0x2a96c8[_0x7337('0xc2')](path[_0x7337('0xbe')](config['root'],_0x7337('0xc3'),_0x195830[_0x7337('0xba')]));}}})[_0x7337('0x31')](handleError(_0x2a96c8,null));};exports[_0x7337('0xc4')]=function(_0x4cf190,_0x445b1c,_0x2b961d){var _0x29b428={};var _0x584349={};var _0x57d378;var _0x3b2ad7;return db['User'][_0x7337('0x9b')]({'where':{'id':_0x4cf190[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x445b1c,null))['then'](function(_0x10f07c){if(_0x10f07c){_0x57d378=_0x10f07c;_0x584349[_0x7337('0x4f')]=_['keys'](db[_0x7337('0xc5')][_0x7337('0x4b')]);_0x584349[_0x7337('0x52')]=_[_0x7337('0x67')](_0x4cf190['query']);_0x584349[_0x7337('0x53')]=_[_0x7337('0x54')](_0x584349[_0x7337('0x4f')],_0x584349[_0x7337('0x52')]);_0x29b428[_0x7337('0x55')]=_[_0x7337('0x54')](_0x584349[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x4cf190[_0x7337('0x52')][_0x7337('0x56')]));_0x29b428[_0x7337('0x55')]=_0x29b428['attributes'][_0x7337('0x57')]?_0x29b428['attributes']:_0x584349[_0x7337('0x4f')];_0x29b428[_0x7337('0x59')]=qs['sort'](_0x4cf190[_0x7337('0x52')][_0x7337('0x5a')]);_0x29b428[_0x7337('0x5b')]=qs[_0x7337('0x53')](_['pick'](_0x4cf190[_0x7337('0x52')],_0x584349[_0x7337('0x53')]));if(_0x4cf190['query'][_0x7337('0x5d')]){_0x29b428[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x29b428[_0x7337('0x5b')],{'$or':_['map'](_0x29b428[_0x7337('0x55')],function(_0x24a57a){var _0x15d677={};_0x15d677[_0x24a57a]={'$like':'%'+_0x4cf190[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x15d677;})});}_0x29b428=_[_0x7337('0x5e')]({},_0x29b428,_0x4cf190[_0x7337('0x63')]);return _0x57d378[_0x7337('0xc4')](_0x29b428);}})[_0x7337('0x27')](function(_0x1d677a){if(_0x1d677a){_0x3b2ad7=_0x1d677a[_0x7337('0x57')];if(_0x4cf190[_0x7337('0x52')][_0x7337('0x58')]('includeAll')){_0x29b428[_0x7337('0x69')]=[{'model':db[_0x7337('0xc6')],'as':_0x7337('0xc7'),'required':![]},{'model':db[_0x7337('0xc8')],'as':_0x7337('0xc9'),'attributes':['id','name',_0x7337('0xca')],'where':_0x4cf190[_0x7337('0x52')][_0x7337('0xcb')]?{'id':_0x4cf190[_0x7337('0x52')][_0x7337('0xcb')]}:undefined,'required':_0x4cf190[_0x7337('0x52')][_0x7337('0xcb')]?!![]:![]}];}if(!_0x4cf190[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0x29b428[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x4cf190[_0x7337('0x52')]['limit']);_0x29b428[_0x7337('0x37')]=qs['offset'](_0x4cf190['query'][_0x7337('0x37')]);}return _0x57d378[_0x7337('0xc4')](_0x29b428);}})['then'](function(_0x226393){if(_0x226393){return _0x226393?{'count':_0x3b2ad7,'rows':_0x226393}:null;}})[_0x7337('0x27')](respondWithResult(_0x445b1c,null))[_0x7337('0x31')](handleError(_0x445b1c,null));};exports[_0x7337('0xcd')]=function(_0x235723,_0x315c93,_0x1e52d1){var _0x40062c;var _0x49c06c;var _0x5ac505={};var _0x41c60b;return db[_0x7337('0x64')]['findOne']({'where':{'id':_0x235723['params']['id']},'attributes':['id',_0x7337('0x47'),_0x7337('0x45')]})[_0x7337('0x27')](handleEntityNotFound(_0x315c93,null))[_0x7337('0x27')](function(_0x21d9ac){if(!utils[_0x7337('0xaa')](_0x235723[_0x7337('0x52')][_0x7337('0xa5')])){throw new db[(_0x7337('0x24'))][(_0x7337('0x9d'))]('Unknown\x20channel');}_0x40062c=_0x21d9ac;var _0x2ed30e={};_0x2ed30e[_0x7337('0x4f')]=_[_0x7337('0x67')](db[_[_0x7337('0xad')](_0x235723[_0x7337('0x52')]['channel'])+_0x7337('0xce')][_0x7337('0x4b')]);_0x2ed30e[_0x7337('0x52')]=_['keys'](_0x235723['query']);_0x2ed30e[_0x7337('0x53')]=_['intersection'](_0x2ed30e[_0x7337('0x4f')],_0x2ed30e[_0x7337('0x52')]);_0x5ac505[_0x7337('0x55')]=_[_0x7337('0x54')](_0x2ed30e[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x235723[_0x7337('0x52')][_0x7337('0x56')]));_0x5ac505[_0x7337('0x55')]=_0x5ac505[_0x7337('0x55')][_0x7337('0x57')]?_0x5ac505[_0x7337('0x55')]:_0x2ed30e[_0x7337('0x4f')];_0x5ac505[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x235723[_0x7337('0x52')]['sort']);_0x5ac505[_0x7337('0x5b')]=qs['filters'](_[_0x7337('0x5c')](_0x235723[_0x7337('0x52')],_0x2ed30e[_0x7337('0x53')]));if(_0x235723[_0x7337('0x52')]['filter']){_0x5ac505[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x5ac505[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x5ac505[_0x7337('0x55')],function(_0xfb2e4){var _0x30cf={};_0x30cf[_0xfb2e4]={'$like':'%'+_0x235723[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x30cf;})});}_0x5ac505=_['merge']({},_0x5ac505,_0x235723[_0x7337('0x63')]);switch(_0x40062c[_0x7337('0x45')]){case _0x7337('0x73'):return db[_[_0x7337('0xad')](_0x235723[_0x7337('0x52')][_0x7337('0xa5')])+_0x7337('0xce')][_0x7337('0x65')](_0x5ac505);case _0x7337('0x40'):case _0x7337('0x71'):return _0x40062c[_0x7337('0x3e')+_[_0x7337('0xad')](_0x235723[_0x7337('0x52')][_0x7337('0xa5')])+_0x7337('0xae')](_0x5ac505);default:throw new db['Sequelize'][(_0x7337('0x9d'))](_0x7337('0xcf'));}})[_0x7337('0x27')](function(_0x3e37e9){_0x41c60b=_0x3e37e9[_0x7337('0x57')];if(!_0x235723['query'][_0x7337('0x58')](_0x7337('0xcc'))){_0x5ac505['limit']=qs[_0x7337('0x38')](_0x235723[_0x7337('0x52')][_0x7337('0x38')]);_0x5ac505[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x235723[_0x7337('0x52')][_0x7337('0x37')]);}switch(_0x40062c[_0x7337('0x45')]){case _0x7337('0x73'):return db[_[_0x7337('0xad')](_0x235723[_0x7337('0x52')][_0x7337('0xa5')])+_0x7337('0xce')][_0x7337('0x65')](_0x5ac505);case'user':case'agent':return _0x40062c['get'+_[_0x7337('0xad')](_0x235723[_0x7337('0x52')]['channel'])+_0x7337('0xae')](_0x5ac505);}})[_0x7337('0x27')](function(_0x278b52){return{'count':_0x41c60b,'rows':_0x278b52};})[_0x7337('0x27')](respondWithResult(_0x315c93,null))['catch'](handleError(_0x315c93,null));};exports['getVoiceQueuesRt']=function(_0x33baa4,_0x4371ec,_0x583c9e){var _0x31740f={};var _0x57df1e={};var _0x25cde4;var _0x5d7c6e;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0x33baa4[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x4371ec,null))[_0x7337('0x27')](function(_0xde870){if(_0xde870){_0x25cde4=_0xde870;_0x57df1e[_0x7337('0x4f')]=_[_0x7337('0x67')](db[_0x7337('0xb8')][_0x7337('0x4b')]);_0x57df1e[_0x7337('0x52')]=_['keys'](_0x33baa4[_0x7337('0x52')]);_0x57df1e[_0x7337('0x53')]=_[_0x7337('0x54')](_0x57df1e[_0x7337('0x4f')],_0x57df1e[_0x7337('0x52')]);_0x31740f[_0x7337('0x55')]=_[_0x7337('0x54')](_0x57df1e['model'],qs[_0x7337('0x56')](_0x33baa4[_0x7337('0x52')][_0x7337('0x56')]));_0x31740f[_0x7337('0x55')]=_0x31740f['attributes'][_0x7337('0x57')]?_0x31740f[_0x7337('0x55')]:_0x57df1e['model'];_0x31740f[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x33baa4[_0x7337('0x52')][_0x7337('0x5a')]);_0x31740f['where']=qs[_0x7337('0x53')](_['pick'](_0x33baa4[_0x7337('0x52')],_0x57df1e[_0x7337('0x53')]));if(_0x33baa4['query'][_0x7337('0x5d')]){_0x31740f['where']=_['merge'](_0x31740f[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x31740f[_0x7337('0x55')],function(_0x83241e){var _0x12ae68={};_0x12ae68[_0x83241e]={'$like':'%'+_0x33baa4[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x12ae68;})});}_0x31740f=_['merge']({},_0x31740f,_0x33baa4[_0x7337('0x63')]);return _0x25cde4['getVoiceQueuesRt'](_0x31740f);}})['then'](function(_0xf8c26b){if(_0xf8c26b){_0x5d7c6e=_0xf8c26b['length'];if(!_0x33baa4[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0x31740f['limit']=qs[_0x7337('0x38')](_0x33baa4[_0x7337('0x52')][_0x7337('0x38')]);_0x31740f['offset']=qs[_0x7337('0x37')](_0x33baa4[_0x7337('0x52')][_0x7337('0x37')]);}return _0x25cde4['getVoiceQueuesRt'](_0x31740f);}})[_0x7337('0x27')](function(_0x5a4fde){if(_0x5a4fde){return _0x5a4fde?{'count':_0x5d7c6e,'rows':_0x5a4fde}:null;}})[_0x7337('0x27')](respondWithResult(_0x4371ec,null))[_0x7337('0x31')](handleError(_0x4371ec,null));};exports[_0x7337('0xd0')]=function(_0x1c3b68,_0x236275,_0x29dc4c){var _0x2c19c7={};var _0x30c880={};var _0x43e207;var _0x5ed7a6;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0x1c3b68[_0x7337('0x6d')]['id']}})['then'](handleEntityNotFound(_0x236275,null))[_0x7337('0x27')](function(_0x49c84c){if(_0x49c84c){_0x43e207=_0x49c84c;_0x30c880[_0x7337('0x4f')]=_['keys'](db['ChatGroup'][_0x7337('0x4b')]);_0x30c880[_0x7337('0x52')]=_[_0x7337('0x67')](_0x1c3b68[_0x7337('0x52')]);_0x30c880[_0x7337('0x53')]=_[_0x7337('0x54')](_0x30c880['model'],_0x30c880[_0x7337('0x52')]);_0x2c19c7[_0x7337('0x55')]=_['intersection'](_0x30c880[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x1c3b68['query'][_0x7337('0x56')]));_0x2c19c7[_0x7337('0x55')]=_0x2c19c7[_0x7337('0x55')]['length']?_0x2c19c7[_0x7337('0x55')]:_0x30c880[_0x7337('0x4f')];_0x2c19c7[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x1c3b68[_0x7337('0x52')]['sort']);_0x2c19c7['where']=qs['filters'](_['pick'](_0x1c3b68[_0x7337('0x52')],_0x30c880[_0x7337('0x53')]));if(_0x1c3b68['query'][_0x7337('0x5d')]){_0x2c19c7['where']=_[_0x7337('0x5e')](_0x2c19c7['where'],{'$or':_[_0x7337('0x4a')](_0x2c19c7[_0x7337('0x55')],function(_0x54f18a){var _0x5a4a4d={};_0x5a4a4d[_0x54f18a]={'$like':'%'+_0x1c3b68[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x5a4a4d;})});}_0x2c19c7=_['merge']({},_0x2c19c7,_0x1c3b68[_0x7337('0x63')]);return _0x43e207[_0x7337('0xd0')](_0x2c19c7);}})[_0x7337('0x27')](function(_0x3569e2){if(_0x3569e2){_0x5ed7a6=_0x3569e2[_0x7337('0x57')];if(!_0x1c3b68[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0x2c19c7['limit']=qs[_0x7337('0x38')](_0x1c3b68[_0x7337('0x52')][_0x7337('0x38')]);_0x2c19c7[_0x7337('0x37')]=qs['offset'](_0x1c3b68[_0x7337('0x52')][_0x7337('0x37')]);}return _0x43e207[_0x7337('0xd0')](_0x2c19c7);}})['then'](function(_0x304d90){if(_0x304d90){return _0x304d90?{'count':_0x5ed7a6,'rows':_0x304d90}:null;}})[_0x7337('0x27')](respondWithResult(_0x236275,null))[_0x7337('0x31')](handleError(_0x236275,null));};exports[_0x7337('0xd1')]=function(_0x3b0fd2,_0x4a2cf8,_0x2c49cc){var _0x149ad1={'raw':!![],'where':{}};var _0x1ed748={};var _0xb29f92={'count':0x0,'rows':[]};return db['User'][_0x7337('0x9b')]({'where':{'id':_0x3b0fd2['params']['id']}})['then'](handleEntityNotFound(_0x4a2cf8,null))[_0x7337('0x27')](function(_0x3b5eb8){if(_0x3b5eb8){_0x1ed748[_0x7337('0x4f')]=_['keys'](db[_0x7337('0xd2')][_0x7337('0x4b')]);_0x1ed748[_0x7337('0x52')]=_[_0x7337('0x67')](_0x3b0fd2['query']);_0x1ed748[_0x7337('0x53')]=_[_0x7337('0x54')](_0x1ed748[_0x7337('0x4f')],_0x1ed748[_0x7337('0x52')]);_0x149ad1[_0x7337('0x55')]=_[_0x7337('0x54')](_0x1ed748[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x3b0fd2['query'][_0x7337('0x56')]));_0x149ad1[_0x7337('0x55')]=_0x149ad1['attributes'][_0x7337('0x57')]?_0x149ad1[_0x7337('0x55')]:_0x1ed748[_0x7337('0x4f')];if(!_0x3b0fd2['query'][_0x7337('0x58')]('nolimit')){_0x149ad1[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x3b0fd2[_0x7337('0x52')][_0x7337('0x38')]);_0x149ad1[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x3b0fd2[_0x7337('0x52')]['offset']);}_0x149ad1['order']=qs[_0x7337('0x5a')](_0x3b0fd2[_0x7337('0x52')][_0x7337('0x5a')]);_0x149ad1[_0x7337('0x5b')]=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0x3b0fd2[_0x7337('0x52')],_0x1ed748[_0x7337('0x53')]));_0x149ad1['where'][_0x7337('0xd3')]=_0x3b5eb8['id'];if(_0x3b0fd2[_0x7337('0x52')][_0x7337('0x5d')]){_0x149ad1[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x149ad1['where'],{'$or':_['map'](_0x149ad1['attributes'],function(_0x5970eb){var _0x254932={};_0x254932[_0x5970eb]={'$like':'%'+_0x3b0fd2[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x254932;})});}_0x149ad1=_[_0x7337('0x5e')]({},_0x149ad1,_0x3b0fd2[_0x7337('0x63')]);return db['VoiceRecording'][_0x7337('0x36')]({'where':_0x149ad1['where']})[_0x7337('0x27')](function(_0x227f92){_0xb29f92['count']=_0x227f92;if(_0x3b0fd2[_0x7337('0x52')][_0x7337('0x68')]){_0x149ad1['include']=[{'all':!![]}];}return db[_0x7337('0xd2')][_0x7337('0x65')](_0x149ad1);})[_0x7337('0x27')](function(_0x17d1c4){_0xb29f92[_0x7337('0xd4')]=_0x17d1c4;return _0xb29f92;});}})[_0x7337('0x27')](respondWithFilteredResult(_0x4a2cf8,_0x149ad1))['catch'](handleError(_0x4a2cf8,null));};exports[_0x7337('0xd5')]=function(_0x250969,_0x381754,_0x5817b3){var _0x329125={'raw':!![],'where':{}};var _0x451bae={};var _0x1adcde={'count':0x0,'rows':[]};return db['User'][_0x7337('0x9b')]({'where':{'id':_0x250969['params']['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x381754,null))[_0x7337('0x27')](function(_0x22febe){if(_0x22febe){_0x451bae[_0x7337('0x4f')]=_[_0x7337('0x67')](db[_0x7337('0xd6')]['rawAttributes']);_0x451bae[_0x7337('0x52')]=_['keys'](_0x250969[_0x7337('0x52')]);_0x451bae[_0x7337('0x53')]=_['intersection'](_0x451bae[_0x7337('0x4f')],_0x451bae[_0x7337('0x52')]);_0x329125[_0x7337('0x55')]=_['intersection'](_0x451bae[_0x7337('0x4f')],qs['fields'](_0x250969[_0x7337('0x52')][_0x7337('0x56')]));_0x329125['attributes']=_0x329125[_0x7337('0x55')][_0x7337('0x57')]?_0x329125['attributes']:_0x451bae[_0x7337('0x4f')];if(!_0x250969['query'][_0x7337('0x58')](_0x7337('0xcc'))){_0x329125['limit']=qs[_0x7337('0x38')](_0x250969[_0x7337('0x52')][_0x7337('0x38')]);_0x329125['offset']=qs['offset'](_0x250969[_0x7337('0x52')][_0x7337('0x37')]);}_0x329125['order']=qs[_0x7337('0x5a')](_0x250969[_0x7337('0x52')][_0x7337('0x5a')]);_0x329125[_0x7337('0x5b')]=qs['filters'](_[_0x7337('0x5c')](_0x250969[_0x7337('0x52')],_0x451bae[_0x7337('0x53')]));_0x329125[_0x7337('0x5b')][_0x7337('0xd3')]=_0x22febe['id'];if(_0x250969[_0x7337('0x52')][_0x7337('0x5d')]){_0x329125[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x329125[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x329125[_0x7337('0x55')],function(_0xf1bc12){var _0x4215d4={};_0x4215d4[_0xf1bc12]={'$like':'%'+_0x250969['query'][_0x7337('0x5d')]+'%'};return _0x4215d4;})});}_0x329125=_['merge']({},_0x329125,_0x250969['options']);return db[_0x7337('0xd6')]['count']({'where':_0x329125[_0x7337('0x5b')]})[_0x7337('0x27')](function(_0x4098e5){_0x1adcde[_0x7337('0x36')]=_0x4098e5;if(_0x250969[_0x7337('0x52')][_0x7337('0x68')]){_0x329125[_0x7337('0x69')]=[{'all':!![]}];}return db['ScreenRecording'][_0x7337('0x65')](_0x329125);})[_0x7337('0x27')](function(_0x1b1509){_0x1adcde[_0x7337('0xd4')]=_0x1b1509;return _0x1adcde;});}})[_0x7337('0x27')](respondWithFilteredResult(_0x381754,_0x329125))[_0x7337('0x31')](handleError(_0x381754,null));};exports[_0x7337('0xd7')]=function(_0x5ab6af,_0x146e7f,_0x2b059a){var _0x3a24e1={};var _0x327e13={};var _0x451154;var _0x315aa1;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0x5ab6af[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x146e7f,null))['then'](function(_0x37c51e){if(_0x37c51e){_0x451154=_0x37c51e;_0x327e13['model']=_['keys'](db[_0x7337('0xd8')][_0x7337('0x4b')]);_0x327e13[_0x7337('0x52')]=_['keys'](_0x5ab6af[_0x7337('0x52')]);_0x327e13[_0x7337('0x53')]=_['intersection'](_0x327e13['model'],_0x327e13[_0x7337('0x52')]);_0x3a24e1[_0x7337('0x55')]=_[_0x7337('0x54')](_0x327e13['model'],qs['fields'](_0x5ab6af[_0x7337('0x52')][_0x7337('0x56')]));_0x3a24e1[_0x7337('0x55')]=_0x3a24e1[_0x7337('0x55')][_0x7337('0x57')]?_0x3a24e1[_0x7337('0x55')]:_0x327e13[_0x7337('0x4f')];_0x3a24e1[_0x7337('0x59')]=qs['sort'](_0x5ab6af[_0x7337('0x52')][_0x7337('0x5a')]);_0x3a24e1[_0x7337('0x5b')]=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0x5ab6af[_0x7337('0x52')],_0x327e13[_0x7337('0x53')]));if(_0x5ab6af[_0x7337('0x52')][_0x7337('0x5d')]){_0x3a24e1[_0x7337('0x5b')]=_['merge'](_0x3a24e1[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x3a24e1['attributes'],function(_0x3de5b6){var _0x40dc22={};_0x40dc22[_0x3de5b6]={'$like':'%'+_0x5ab6af[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x40dc22;})});}_0x3a24e1=_[_0x7337('0x5e')]({},_0x3a24e1,_0x5ab6af[_0x7337('0x63')]);return _0x451154[_0x7337('0xd7')](_0x3a24e1);}})[_0x7337('0x27')](function(_0x575b9f){if(_0x575b9f){_0x315aa1=_0x575b9f[_0x7337('0x57')];if(!_0x5ab6af[_0x7337('0x52')][_0x7337('0x58')]('nolimit')){_0x3a24e1[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x5ab6af[_0x7337('0x52')][_0x7337('0x38')]);_0x3a24e1[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x5ab6af['query'][_0x7337('0x37')]);}return _0x451154['getChatInteractions'](_0x3a24e1);}})[_0x7337('0x27')](function(_0x58233b){if(_0x58233b){return _0x58233b?{'count':_0x315aa1,'rows':_0x58233b}:null;}})[_0x7337('0x27')](respondWithResult(_0x146e7f,null))['catch'](handleError(_0x146e7f,null));};exports[_0x7337('0xd9')]=function(_0x4ccba0,_0x23be77,_0x4f1347){var _0xdb8a05={};var _0x2696a9={};var _0x46f861;var _0x28b815;return db[_0x7337('0x64')]['findOne']({'where':{'id':_0x4ccba0[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x23be77,null))[_0x7337('0x27')](function(_0x3d37a4){if(_0x3d37a4){_0x46f861=_0x3d37a4;_0x2696a9[_0x7337('0x4f')]=_['keys'](db[_0x7337('0xda')][_0x7337('0x4b')]);_0x2696a9['query']=_[_0x7337('0x67')](_0x4ccba0['query']);_0x2696a9[_0x7337('0x53')]=_[_0x7337('0x54')](_0x2696a9['model'],_0x2696a9[_0x7337('0x52')]);_0xdb8a05[_0x7337('0x55')]=_[_0x7337('0x54')](_0x2696a9['model'],qs['fields'](_0x4ccba0[_0x7337('0x52')][_0x7337('0x56')]));_0xdb8a05[_0x7337('0x55')]=_0xdb8a05['attributes'][_0x7337('0x57')]?_0xdb8a05[_0x7337('0x55')]:_0x2696a9[_0x7337('0x4f')];_0xdb8a05[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x4ccba0[_0x7337('0x52')][_0x7337('0x5a')]);_0xdb8a05['where']=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0x4ccba0[_0x7337('0x52')],_0x2696a9[_0x7337('0x53')]));if(_0x4ccba0[_0x7337('0x52')][_0x7337('0x5d')]){_0xdb8a05[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0xdb8a05['where'],{'$or':_[_0x7337('0x4a')](_0xdb8a05[_0x7337('0x55')],function(_0x43adc6){var _0x11ed73={};_0x11ed73[_0x43adc6]={'$like':'%'+_0x4ccba0[_0x7337('0x52')]['filter']+'%'};return _0x11ed73;})});}_0xdb8a05=_[_0x7337('0x5e')]({},_0xdb8a05,_0x4ccba0[_0x7337('0x63')]);return _0x46f861['getOpenchannelInteractions'](_0xdb8a05);}})['then'](function(_0x228fd9){if(_0x228fd9){_0x28b815=_0x228fd9[_0x7337('0x57')];if(!_0x4ccba0[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0xdb8a05[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x4ccba0['query']['limit']);_0xdb8a05[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x4ccba0[_0x7337('0x52')]['offset']);}return _0x46f861[_0x7337('0xd9')](_0xdb8a05);}})['then'](function(_0x53d3c4){if(_0x53d3c4){return _0x53d3c4?{'count':_0x28b815,'rows':_0x53d3c4}:null;}})[_0x7337('0x27')](respondWithResult(_0x23be77,null))[_0x7337('0x31')](handleError(_0x23be77,null));};exports['getMailInteractions']=function(_0x274db1,_0x2226c2,_0x176b42){var _0x44af85={'raw':!![],'where':{}};var _0x44ff9d={};var _0xaecd2a={'count':0x0,'rows':[]};return db['User'][_0x7337('0x9b')]({'where':{'id':_0x274db1['params']['id']}})['then'](handleEntityNotFound(_0x2226c2,null))[_0x7337('0x27')](function(_0x1fbcd2){if(_0x1fbcd2){_0x44ff9d[_0x7337('0x4f')]=_['keys'](db[_0x7337('0xdb')][_0x7337('0x4b')]);_0x44ff9d[_0x7337('0x52')]=_[_0x7337('0x67')](_0x274db1[_0x7337('0x52')]);_0x44ff9d[_0x7337('0x53')]=_[_0x7337('0x54')](_0x44ff9d[_0x7337('0x4f')],_0x44ff9d[_0x7337('0x52')]);_0x44af85[_0x7337('0x55')]=_['intersection'](_0x44ff9d['model'],qs[_0x7337('0x56')](_0x274db1[_0x7337('0x52')][_0x7337('0x56')]));_0x44af85[_0x7337('0x55')]=_0x44af85[_0x7337('0x55')][_0x7337('0x57')]?_0x44af85[_0x7337('0x55')]:_0x44ff9d[_0x7337('0x4f')];if(!_0x274db1['query'][_0x7337('0x58')](_0x7337('0xcc'))){_0x44af85[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x274db1['query'][_0x7337('0x38')]);_0x44af85[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x274db1[_0x7337('0x52')]['offset']);}_0x44af85[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x274db1[_0x7337('0x52')][_0x7337('0x5a')]);_0x44af85[_0x7337('0x5b')]=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0x274db1['query'],_0x44ff9d['filters']));_0x44af85[_0x7337('0x5b')][_0x7337('0xd3')]=_0x1fbcd2['id'];if(_0x274db1[_0x7337('0x52')]['filter']){_0x44af85[_0x7337('0x5b')]=_['merge'](_0x44af85[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x44af85[_0x7337('0x55')],function(_0x350a8a){var _0x3f3f33={};_0x3f3f33[_0x350a8a]={'$like':'%'+_0x274db1[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x3f3f33;})});}_0x44af85=_[_0x7337('0x5e')]({},_0x44af85,_0x274db1[_0x7337('0x63')]);return db['MailInteraction']['count']({'where':_0x44af85[_0x7337('0x5b')]})[_0x7337('0x27')](function(_0x18d1d5){_0xaecd2a[_0x7337('0x36')]=_0x18d1d5;if(_0x274db1[_0x7337('0x52')][_0x7337('0x68')]){_0x44af85['include']=[{'all':!![]}];}return db[_0x7337('0xdb')][_0x7337('0x65')](_0x44af85);})[_0x7337('0x27')](function(_0x1d79ff){_0xaecd2a['rows']=_0x1d79ff;return _0xaecd2a;});}})[_0x7337('0x27')](respondWithFilteredResult(_0x2226c2,_0x44af85))[_0x7337('0x31')](handleError(_0x2226c2,null));};exports[_0x7337('0xdc')]=function(_0x343aaa,_0x1d5a44,_0x59452e){var _0xf9c3e7={};var _0x1531c0={};var _0xcf9315;var _0x2386f7;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0x343aaa[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x1d5a44,null))[_0x7337('0x27')](function(_0x138b65){if(_0x138b65){_0xcf9315=_0x138b65;_0x1531c0[_0x7337('0x4f')]=_[_0x7337('0x67')](db[_0x7337('0xdd')][_0x7337('0x4b')]);_0x1531c0[_0x7337('0x52')]=_[_0x7337('0x67')](_0x343aaa[_0x7337('0x52')]);_0x1531c0[_0x7337('0x53')]=_[_0x7337('0x54')](_0x1531c0[_0x7337('0x4f')],_0x1531c0[_0x7337('0x52')]);_0xf9c3e7[_0x7337('0x55')]=_[_0x7337('0x54')](_0x1531c0[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x343aaa[_0x7337('0x52')][_0x7337('0x56')]));_0xf9c3e7[_0x7337('0x55')]=_0xf9c3e7[_0x7337('0x55')][_0x7337('0x57')]?_0xf9c3e7[_0x7337('0x55')]:_0x1531c0[_0x7337('0x4f')];_0xf9c3e7[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x343aaa[_0x7337('0x52')][_0x7337('0x5a')]);_0xf9c3e7['where']=qs[_0x7337('0x53')](_['pick'](_0x343aaa[_0x7337('0x52')],_0x1531c0[_0x7337('0x53')]));if(_0x343aaa['query']['filter']){_0xf9c3e7[_0x7337('0x5b')]=_['merge'](_0xf9c3e7[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0xf9c3e7[_0x7337('0x55')],function(_0x2baeb5){var _0x2c40ec={};_0x2c40ec[_0x2baeb5]={'$like':'%'+_0x343aaa[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x2c40ec;})});}_0xf9c3e7=_[_0x7337('0x5e')]({},_0xf9c3e7,_0x343aaa[_0x7337('0x63')]);return _0xcf9315[_0x7337('0xdc')](_0xf9c3e7);}})[_0x7337('0x27')](function(_0x505746){if(_0x505746){_0x2386f7=_0x505746['length'];if(!_0x343aaa[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0xf9c3e7[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x343aaa[_0x7337('0x52')][_0x7337('0x38')]);_0xf9c3e7[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x343aaa[_0x7337('0x52')]['offset']);}return _0xcf9315['getSmsInteractions'](_0xf9c3e7);}})['then'](function(_0x5f3fb6){if(_0x5f3fb6){return _0x5f3fb6?{'count':_0x2386f7,'rows':_0x5f3fb6}:null;}})[_0x7337('0x27')](respondWithResult(_0x1d5a44,null))[_0x7337('0x31')](handleError(_0x1d5a44,null));};exports[_0x7337('0xde')]=function(_0x3d824b,_0x47bc6c,_0x2c4461){var _0x1fce05={};var _0xc5a0b7={};var _0x214dac;var _0x14ec56;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0x3d824b['params']['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x47bc6c,null))[_0x7337('0x27')](function(_0x37904f){if(_0x37904f){_0x214dac=_0x37904f;_0xc5a0b7['model']=_[_0x7337('0x67')](db['FaxInteraction'][_0x7337('0x4b')]);_0xc5a0b7['query']=_[_0x7337('0x67')](_0x3d824b['query']);_0xc5a0b7[_0x7337('0x53')]=_[_0x7337('0x54')](_0xc5a0b7[_0x7337('0x4f')],_0xc5a0b7['query']);_0x1fce05['attributes']=_[_0x7337('0x54')](_0xc5a0b7[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x3d824b[_0x7337('0x52')][_0x7337('0x56')]));_0x1fce05[_0x7337('0x55')]=_0x1fce05['attributes'][_0x7337('0x57')]?_0x1fce05[_0x7337('0x55')]:_0xc5a0b7[_0x7337('0x4f')];_0x1fce05[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x3d824b[_0x7337('0x52')][_0x7337('0x5a')]);_0x1fce05[_0x7337('0x5b')]=qs['filters'](_[_0x7337('0x5c')](_0x3d824b[_0x7337('0x52')],_0xc5a0b7[_0x7337('0x53')]));if(_0x3d824b[_0x7337('0x52')]['filter']){_0x1fce05[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x1fce05[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x1fce05[_0x7337('0x55')],function(_0x8ce464){var _0x5b75a6={};_0x5b75a6[_0x8ce464]={'$like':'%'+_0x3d824b['query'][_0x7337('0x5d')]+'%'};return _0x5b75a6;})});}_0x1fce05=_[_0x7337('0x5e')]({},_0x1fce05,_0x3d824b[_0x7337('0x63')]);return _0x214dac[_0x7337('0xde')](_0x1fce05);}})[_0x7337('0x27')](function(_0x19f7cf){if(_0x19f7cf){_0x14ec56=_0x19f7cf[_0x7337('0x57')];if(!_0x3d824b[_0x7337('0x52')][_0x7337('0x58')]('nolimit')){_0x1fce05['limit']=qs[_0x7337('0x38')](_0x3d824b[_0x7337('0x52')]['limit']);_0x1fce05[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x3d824b['query'][_0x7337('0x37')]);}return _0x214dac['getFaxInteractions'](_0x1fce05);}})[_0x7337('0x27')](function(_0x4b2bb5){if(_0x4b2bb5){return _0x4b2bb5?{'count':_0x14ec56,'rows':_0x4b2bb5}:null;}})[_0x7337('0x27')](respondWithResult(_0x47bc6c,null))['catch'](handleError(_0x47bc6c,null));};exports[_0x7337('0xdf')]=function(_0x48f857,_0x219d95,_0x1a6c23){var _0x2e2caf={};var _0x251326={};var _0x3256ca;var _0x28443f;return db['User'][_0x7337('0x9b')]({'where':{'id':_0x48f857[_0x7337('0x6d')]['id']}})['then'](handleEntityNotFound(_0x219d95,null))['then'](function(_0x28f582){if(_0x28f582){_0x3256ca=_0x28f582;_0x251326[_0x7337('0x4f')]=_[_0x7337('0x67')](db[_0x7337('0xe0')]['rawAttributes']);_0x251326[_0x7337('0x52')]=_[_0x7337('0x67')](_0x48f857[_0x7337('0x52')]);_0x251326[_0x7337('0x53')]=_[_0x7337('0x54')](_0x251326[_0x7337('0x4f')],_0x251326[_0x7337('0x52')]);_0x2e2caf['attributes']=_['intersection'](_0x251326[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x48f857['query'][_0x7337('0x56')]));_0x2e2caf[_0x7337('0x55')]=_0x2e2caf['attributes']['length']?_0x2e2caf['attributes']:_0x251326[_0x7337('0x4f')];_0x2e2caf[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x48f857[_0x7337('0x52')][_0x7337('0x5a')]);_0x2e2caf['where']=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0x48f857[_0x7337('0x52')],_0x251326[_0x7337('0x53')]));if(_0x48f857[_0x7337('0x52')]['filter']){_0x2e2caf[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x2e2caf[_0x7337('0x5b')],{'$or':_['map'](_0x2e2caf[_0x7337('0x55')],function(_0x191905){var _0x1f2ece={};_0x1f2ece[_0x191905]={'$like':'%'+_0x48f857['query'][_0x7337('0x5d')]+'%'};return _0x1f2ece;})});}_0x2e2caf=_[_0x7337('0x5e')]({},_0x2e2caf,_0x48f857['options']);return _0x3256ca[_0x7337('0xdf')](_0x2e2caf);}})[_0x7337('0x27')](function(_0x5e202a){if(_0x5e202a){_0x28443f=_0x5e202a[_0x7337('0x57')];if(!_0x48f857[_0x7337('0x52')]['hasOwnProperty'](_0x7337('0xcc'))){_0x2e2caf[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x48f857[_0x7337('0x52')][_0x7337('0x38')]);_0x2e2caf['offset']=qs[_0x7337('0x37')](_0x48f857['query'][_0x7337('0x37')]);}return _0x3256ca[_0x7337('0xdf')](_0x2e2caf);}})['then'](function(_0x31a23d){if(_0x31a23d){return _0x31a23d?{'count':_0x28443f,'rows':_0x31a23d}:null;}})['then'](respondWithResult(_0x219d95,null))['catch'](handleError(_0x219d95,null));};exports[_0x7337('0xe1')]=function(_0xbbe45d,_0x3e1ee6,_0x1d33ed){var _0xcd1d30;var _0x146ee1;var _0x5142aa;var _0x1296d6=!_[_0x7337('0x75')](_0xbbe45d['params']['id'])?_0xbbe45d[_0x7337('0x6d')]['id']:!_[_0x7337('0x75')](_0xbbe45d[_0x7337('0x40')]['id'])?_0xbbe45d[_0x7337('0x40')]['id']:null;return db[_0x7337('0x64')][_0x7337('0x46')]({'where':{'id':_0x1296d6,'role':{'$or':['admin',_0x7337('0x40'),_0x7337('0x71')]}},'attributes':['id','name',_0x7337('0xe2'),_0x7337('0xe3'),_0x7337('0x45'),_0x7337('0x79'),_0x7337('0xa7')]})[_0x7337('0x27')](function(_0x2328d0){if(_0x2328d0){if(_0x2328d0[_0x7337('0x45')]===_0x7337('0x71')){_0xcd1d30=_0x2328d0;if(_0xbbe45d['body'][_0x7337('0xa9')]){_0x5142aa=util[_0x7337('0x77')](_0x7337('0xe4'),_0xcd1d30[_0xbbe45d['body'][_0x7337('0xa9')]]);}else if(_0xbbe45d['body'][_0x7337('0xe5')]){_0x5142aa=util[_0x7337('0x77')]('SIP/%s',_0xbbe45d[_0x7337('0x6b')]['intrf']);}else{_0x5142aa=util[_0x7337('0x77')](_0x7337('0xb5'),_0xcd1d30[_0x7337('0x47')]);}socket['to'](util['format'](_0x7337('0xe6'),_0xcd1d30[_0x7337('0x47')]))[_0x7337('0xb2')]('user:forcelogout',{'ip':_0xbbe45d[_0x7337('0xe7')]['x-forwarded-for']||_0xbbe45d['connection'][_0x7337('0xe8')]||_0xbbe45d[_0x7337('0xe9')][_0x7337('0xe8')]||_0xbbe45d[_0x7337('0xea')][_0x7337('0xe9')]['remoteAddress']});return db[_0x7337('0xb8')][_0x7337('0x3d')]({'where':{'membername':_0xcd1d30[_0x7337('0x47')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x7337('0x9d'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x7337('0x27')](function(){if(_0xcd1d30){return _0xcd1d30[_0x7337('0xeb')]({'raw':!![]});}})['then'](function(_0x10b8c3){if(_0xcd1d30){var _0x1fe2d8=[];if(_0x10b8c3){_0x146ee1=_0x10b8c3;if(_0x146ee1[_0x7337('0x57')]){for(var _0xb4cd6=0x0;_0xb4cd6<_0x146ee1[_0x7337('0x57')];_0xb4cd6++){_0x1fe2d8[_0x7337('0xec')]({'membername':_0xcd1d30[_0x7337('0x47')],'UserId':_0xcd1d30['id'],'queue_name':_0x146ee1[_0xb4cd6][_0x7337('0x47')],'VoiceQueueId':_0x146ee1[_0xb4cd6]['id'],'interface':_0x5142aa,'paused':_0xcd1d30[_0x7337('0xa7')]||![],'penalty':_0x146ee1[_0xb4cd6][_0x7337('0xed')]||0x0});}return BPromise[_0x7337('0xee')](_0x1fe2d8,function(_0x1fc443){return db[_0x7337('0xb8')][_0x7337('0xef')](_0x1fc443);});}}}})['then'](function(){if(_0xcd1d30){return db[_0x7337('0xf0')][_0x7337('0x65')]({'where':{'membername':_0xcd1d30[_0x7337('0x47')],'exitAt':null}});}})[_0x7337('0x27')](function(_0x1550e0){if(_0xcd1d30){var _0xc818a6=[];_0x1550e0[_0x7337('0xf1')](function(_0x5dd828){_0xc818a6[_0x7337('0xec')](_0x5dd828[_0x7337('0x3c')]({'exitAt':moment()['format'](_0x7337('0xf2'))}));});return BPromise[_0x7337('0xf3')](_0xc818a6);}})['then'](function(){if(_0xcd1d30){var _0x39cee9=[];var _0x70ce1=[];var _0x431f54=utils[_0x7337('0xf4')]();var _0x41ddef={'membername':_0xcd1d30['name'],'interface':_0x5142aa,'enterAt':moment()[_0x7337('0x77')](_0x7337('0xf2')),'role':_0xcd1d30[_0x7337('0x45')],'internal':_0xcd1d30[_0x7337('0x79')]};_0x431f54['forEach'](function(_0x4ab5f8){_0x39cee9[_0x7337('0xec')](_['merge']({'channel':_0x4ab5f8,'type':_0x7337('0xf5'),'data1':_0xbbe45d['body'][_0x7337('0xf6')],'data2':_0x5142aa},_0x41ddef));if(_0xcd1d30['loginInPause']){_0x70ce1['push'](_[_0x7337('0x5e')]({'channel':_0x4ab5f8,'type':_0x7337('0xf7'),'data1':_0x7337('0xf8')},_0x41ddef));}});return db[_0x7337('0xf0')][_0x7337('0x6a')](_0x39cee9[_0x7337('0xf9')](_0x70ce1),{'individualHooks':!![]});}})['then'](function(){if(_0xcd1d30){return _0xcd1d30[_0x7337('0x3c')]({'online':!![],'lastLoginAt':moment()[_0x7337('0x77')](_0x7337('0xf2')),'voicePause':_0xcd1d30[_0x7337('0xa7')]||![],'mailPause':_0xcd1d30[_0x7337('0xa7')]||![],'chatPause':_0xcd1d30[_0x7337('0xa7')]||![],'faxPause':_0xcd1d30[_0x7337('0xa7')]||![],'smsPause':_0xcd1d30[_0x7337('0xa7')]||![],'openchannelPause':_0xcd1d30[_0x7337('0xa7')]||![],'whatsappPause':_0xcd1d30[_0x7337('0xa7')]||![],'pauseType':_0xcd1d30[_0x7337('0xa7')]?_0x7337('0xf8'):null,'interface':_0x5142aa,'lastPauseAt':moment()[_0x7337('0x77')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x7337('0x27')](function(_0x243c98){if(_0xbbe45d[_0x7337('0xfa')]){return _0x1d33ed();}else{return BPromise[_0x7337('0xfb')](_0x243c98)[_0x7337('0x27')](respondWithResult(_0x3e1ee6,null));}})['catch'](handleError(_0x3e1ee6,null));};exports[_0x7337('0xfc')]=function(_0x1bf776,_0x179dda,_0x50cd8a){var _0x5429b2;return db['User'][_0x7337('0x46')]({'where':{'id':_0x1bf776['params']['id'],'role':_0x7337('0x71')},'attributes':['id',_0x7337('0x47'),_0x7337('0x45')]})['then'](handleEntityNotFound(_0x179dda,null))['then'](function(_0x83b61c){if(_0x83b61c){_0x5429b2=_0x83b61c;return db[_0x7337('0xb8')][_0x7337('0x3d')]({'where':{'membername':_0x5429b2[_0x7337('0x47')]},'individualHooks':!![]});}})[_0x7337('0x27')](function(){return db[_0x7337('0xf0')][_0x7337('0x65')]({'where':{'membername':_0x5429b2[_0x7337('0x47')],'exitAt':null}});})[_0x7337('0x27')](function(_0x523aa9){var _0x1e9d65=[];_0x523aa9[_0x7337('0xf1')](function(_0x5db948){_0x1e9d65[_0x7337('0xec')](_0x5db948[_0x7337('0x3c')]({'exitAt':moment()[_0x7337('0x77')](_0x7337('0xf2'))}));});return BPromise[_0x7337('0xf3')](_0x1e9d65);})[_0x7337('0x27')](function(){return _0x5429b2[_0x7337('0x3c')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x7337('0x27')](respondWithResult(_0x179dda,null))['catch'](handleError(_0x179dda,null));};exports['pause']=function(_0x90ea6a,_0x1230aa,_0x6c7648){var _0x691f5c;return db[_0x7337('0xb8')]['update']({'paused':0x1},{'where':{'UserId':_0x90ea6a[_0x7337('0x6d')]['id']},'individualHooks':!![]})[_0x7337('0x27')](function(){return db[_0x7337('0x64')][_0x7337('0x46')]({'where':{'id':_0x90ea6a[_0x7337('0x6d')]['id'],'role':_0x7337('0x71')},'attributes':['id',_0x7337('0x47'),_0x7337('0x45'),_0x7337('0x79'),_0x7337('0xa9')]});})[_0x7337('0x27')](handleEntityNotFound(_0x1230aa,null))[_0x7337('0x27')](function(_0x42c209){if(_0x42c209){_0x691f5c=_0x42c209;return respondWithRpcPromise(_0x7337('0xfd'),_0x7337('0xfe'),{'id':_0x691f5c['id'],'name':_0x691f5c[_0x7337('0x47')],'pause':!![]});}})[_0x7337('0x27')](function(){if(_0x691f5c){return db[_0x7337('0xf0')][_0x7337('0x65')]({'where':{'membername':_0x691f5c[_0x7337('0x47')],'type':_0x7337('0xf7'),'exitAt':null}});}})[_0x7337('0x27')](function(_0x5eb676){if(_0x5eb676[_0x7337('0x57')]){var _0x183dcf=moment()['format'](_0x7337('0xf2'));for(var _0x2aca76=0x0,_0xdd5c1b=_0x5eb676[_0x7337('0x57')];_0x2aca76<_0xdd5c1b;_0x2aca76++){_0x5eb676[_0x2aca76][_0x7337('0xff')]({'exitAt':_0x183dcf});}}})[_0x7337('0x27')](function(){var _0x59f90b=[];var _0x1589e0=utils['getChannels']();_0x1589e0[_0x7337('0xf1')](function(_0x540a24){_0x59f90b[_0x7337('0xec')]({'channel':_0x540a24,'membername':_0x691f5c[_0x7337('0x47')],'interface':_[_0x7337('0x75')](_0x691f5c[_0x7337('0xa9')])?util['format']('SIP/%s',_0x691f5c[_0x7337('0x47')]):_0x691f5c[_0x7337('0xa9')],'type':_0x7337('0xf7'),'enterAt':moment()[_0x7337('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x90ea6a[_0x7337('0x6b')]['type']||_0x7337('0x100'),'role':_0x691f5c[_0x7337('0x45')],'internal':_0x691f5c[_0x7337('0x79')]});});return db[_0x7337('0xf0')][_0x7337('0x6a')](_0x59f90b,{'individualHooks':!![]});})[_0x7337('0x27')](function(){return _0x691f5c[_0x7337('0x3c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x90ea6a[_0x7337('0x6b')][_0x7337('0x4d')]||_0x7337('0x100'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x1230aa,null))['catch'](handleError(_0x1230aa,null));};exports[_0x7337('0x101')]=function(_0x3e0f4d,_0x40ab47,_0x19dc3b){var _0x87ff60;return db[_0x7337('0x64')][_0x7337('0x46')]({'where':{'id':_0x3e0f4d[_0x7337('0x6d')]['id']},'attributes':['id',_0x7337('0x47'),'role',_0x7337('0xa8'),_0x7337('0x102'),_0x7337('0x103'),_0x7337('0x104'),'openchannelPause','smsPause',_0x7337('0x105'),'pauseType',_0x7337('0x106')]})[_0x7337('0x27')](handleEntityNotFound(_0x40ab47,null))[_0x7337('0x27')](function(_0x33ba96){if(_0x33ba96){_0x87ff60=_0x33ba96;if(_0x3e0f4d['body'][_0x7337('0xa5')]&&!utils[_0x7337('0xaa')](_0x3e0f4d[_0x7337('0x6b')][_0x7337('0xa5')])){throw new db[(_0x7337('0x24'))][(_0x7337('0x9d'))](_0x7337('0xab'));}switch(_0x3e0f4d[_0x7337('0x6b')][_0x7337('0xa5')]){case _0x7337('0xb4'):return respondWithRpcPromise(_0x7337('0xfd'),_0x7337('0x101'),{'id':_0x87ff60['id'],'name':_0x87ff60[_0x7337('0x47')],'pause':![]})[_0x7337('0x27')](function(){return db[_0x7337('0xb8')]['update']({'paused':0x0},{'where':{'UserId':_0x87ff60['id']},'individualHooks':!![]});})[_0x7337('0x27')](function(){return db[_0x7337('0xf0')]['find']({'where':{'channel':_0x3e0f4d[_0x7337('0x6b')][_0x7337('0xa5')],'membername':_0x87ff60[_0x7337('0x47')],'type':_0x7337('0xf7'),'exitAt':null}});})['then'](function(_0x5733fe){if(_0x5733fe){return _0x5733fe[_0x7337('0x3c')]({'exitAt':moment()[_0x7337('0x77')](_0x7337('0xf2')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x7337('0x27')](function(){return _0x87ff60[_0x7337('0x3c')]({'voicePause':![]});});case _0x7337('0x107'):case _0x7337('0x108'):case _0x7337('0x109'):case _0x7337('0x10a'):case _0x7337('0x10b'):case _0x7337('0x10c'):return db[_0x7337('0xf0')]['find']({'where':{'channel':_0x3e0f4d[_0x7337('0x6b')][_0x7337('0xa5')],'membername':_0x87ff60['name'],'type':'PAUSE','exitAt':null}})['then'](function(_0x59bab1){if(_0x59bab1){return _0x59bab1[_0x7337('0x3c')]({'exitAt':moment()[_0x7337('0x77')](_0x7337('0xf2')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x7337('0x27')](function(){var _0x168697={};_['set'](_0x168697,util[_0x7337('0x77')](_0x7337('0x10d'),_0x3e0f4d['body'][_0x7337('0xa5')],_0x7337('0x10e')),![]);return _0x87ff60[_0x7337('0x3c')](_0x168697);});default:return respondWithRpcPromise(_0x7337('0xfd'),_0x7337('0x101'),{'id':_0x87ff60['id'],'name':_0x87ff60[_0x7337('0x47')],'pause':![]})[_0x7337('0x27')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x87ff60['id']}});})['then'](function(){return db[_0x7337('0xf0')][_0x7337('0x65')]({'where':{'membername':_0x87ff60[_0x7337('0x47')],'type':_0x7337('0xf7'),'exitAt':null}});})[_0x7337('0x27')](function(_0x380695){var _0x339a6e=[];_0x380695[_0x7337('0xf1')](function(_0x509267){_0x339a6e[_0x7337('0xec')](_0x509267[_0x7337('0x3c')]({'exitAt':moment()[_0x7337('0x77')](_0x7337('0xf2')),'data2':_0x7337('0x10f')}));});return BPromise[_0x7337('0xf3')](_0x339a6e);})[_0x7337('0x27')](function(){return _0x87ff60['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x40ab47,null))[_0x7337('0x31')](handleError(_0x40ab47,null));};exports[_0x7337('0x110')]=function(_0x49448c,_0x428348,_0x4c30f0){var _0x171438={};var _0x5e7a11={};var _0x11d490;var _0xa2b820;return db['User'][_0x7337('0x9b')]({'where':{'id':_0x49448c[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x428348,null))['then'](function(_0x501e56){if(_0x501e56){_0x11d490=_0x501e56;_0x5e7a11[_0x7337('0x4f')]=_['keys'](db[_0x7337('0x111')][_0x7337('0x4b')]);_0x5e7a11[_0x7337('0x52')]=_['keys'](_0x49448c['query']);_0x5e7a11[_0x7337('0x53')]=_[_0x7337('0x54')](_0x5e7a11[_0x7337('0x4f')],_0x5e7a11[_0x7337('0x52')]);_0x171438['attributes']=_[_0x7337('0x54')](_0x5e7a11['model'],qs[_0x7337('0x56')](_0x49448c[_0x7337('0x52')]['fields']));_0x171438[_0x7337('0x55')]=_0x171438[_0x7337('0x55')][_0x7337('0x57')]?_0x171438[_0x7337('0x55')]:_0x5e7a11['model'];_0x171438[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x49448c['query'][_0x7337('0x5a')]);_0x171438['where']=qs[_0x7337('0x53')](_['pick'](_0x49448c[_0x7337('0x52')],_0x5e7a11[_0x7337('0x53')]));if(_0x49448c[_0x7337('0x52')][_0x7337('0x5d')]){_0x171438[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x171438[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x171438[_0x7337('0x55')],function(_0x5e9852){var _0xadeefb={};_0xadeefb[_0x5e9852]={'$like':'%'+_0x49448c[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0xadeefb;})});}_0x171438=_['merge']({},_0x171438,_0x49448c[_0x7337('0x63')]);return _0x11d490[_0x7337('0x110')](_0x171438);}})[_0x7337('0x27')](function(_0x594323){if(_0x594323){_0xa2b820=_0x594323['length'];if(!_0x49448c[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0x171438[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x49448c[_0x7337('0x52')][_0x7337('0x38')]);_0x171438[_0x7337('0x37')]=qs['offset'](_0x49448c[_0x7337('0x52')][_0x7337('0x37')]);}return _0x11d490[_0x7337('0x110')](_0x171438);}})[_0x7337('0x27')](function(_0x3f340b){if(_0x3f340b){return _0x3f340b?{'count':_0xa2b820,'rows':_0x3f340b}:null;}})[_0x7337('0x27')](respondWithResult(_0x428348,null))[_0x7337('0x31')](handleError(_0x428348,null));};exports[_0x7337('0x112')]=function(_0x25ab12,_0x1bf78b){return db[_0x7337('0x64')]['find']({'where':{'id':_0x25ab12['params']['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x1bf78b,null))[_0x7337('0x27')](function(_0x53c52d){if(_0x53c52d){var _0x45221c=_0x53c52d[_0x7337('0x3e')]({'plain':!![]});return _0x53c52d[_0x7337('0x112')](_0x25ab12[_0x7337('0x6b')][_0x7337('0x70')],_[_0x7337('0x6f')](_0x25ab12[_0x7337('0x6b')],[_0x7337('0x70'),'id'])||{})[_0x7337('0x27')](function(){for(var _0x2d6bea=0x0;_0x2d6bea<_0x25ab12[_0x7337('0x6b')][_0x7337('0x70')][_0x7337('0x57')];_0x2d6bea++){var _0x49623f=[];db['Team'][_0x7337('0x9b')]({'where':{'id':_0x25ab12[_0x7337('0x6b')][_0x7337('0x70')][_0x2d6bea]}})[_0x7337('0x27')](function(_0x2a3d30){_0x49623f[_0x7337('0xec')](_0x2a3d30['getVoiceQueues']()['then'](function(_0x23c118){for(var _0x44db83=0x0;_0x44db83<_0x23c118[_0x7337('0x57')];_0x44db83++){_0x23c118[_0x44db83][_0x7337('0x113')](_0x7337('0xa5'),'Voice');}return _0x23c118;}));_0x49623f['push'](_0x2a3d30[_0x7337('0x114')]()['then'](function(_0x202704){for(var _0x3ee45b=0x0;_0x3ee45b<_0x202704[_0x7337('0x57')];_0x3ee45b++){_0x202704[_0x3ee45b][_0x7337('0x113')](_0x7337('0xa5'),_0x7337('0x115'));}return _0x202704;}));_0x49623f[_0x7337('0xec')](_0x2a3d30[_0x7337('0x116')]()['then'](function(_0x1e7e70){for(var _0x9737be=0x0;_0x9737be<_0x1e7e70[_0x7337('0x57')];_0x9737be++){_0x1e7e70[_0x9737be][_0x7337('0x113')](_0x7337('0xa5'),_0x7337('0x117'));}return _0x1e7e70;}));_0x49623f[_0x7337('0xec')](_0x2a3d30[_0x7337('0x118')]()['then'](function(_0x37248c){for(var _0x8e193=0x0;_0x8e193<_0x37248c['length'];_0x8e193++){_0x37248c[_0x8e193][_0x7337('0x113')](_0x7337('0xa5'),'Sms');}return _0x37248c;}));_0x49623f[_0x7337('0xec')](_0x2a3d30[_0x7337('0x119')]()[_0x7337('0x27')](function(_0x5cc4f3){for(var _0x32e7d6=0x0;_0x32e7d6<_0x5cc4f3[_0x7337('0x57')];_0x32e7d6++){_0x5cc4f3[_0x32e7d6][_0x7337('0x113')]('channel','Whatsapp');}return _0x5cc4f3;}));_0x49623f[_0x7337('0xec')](_0x2a3d30[_0x7337('0x11a')]()['then'](function(_0x1f04cb){for(var _0x2c9a92=0x0;_0x2c9a92<_0x1f04cb['length'];_0x2c9a92++){_0x1f04cb[_0x2c9a92][_0x7337('0x113')](_0x7337('0xa5'),'Fax');}return _0x1f04cb;}));_0x49623f[_0x7337('0xec')](_0x2a3d30['getOpenchannelQueues']()[_0x7337('0x27')](function(_0x41b604){for(var _0x50e353=0x0;_0x50e353<_0x41b604[_0x7337('0x57')];_0x50e353++){_0x41b604[_0x50e353]['setDataValue'](_0x7337('0xa5'),'Openchannel');}return _0x41b604;}));return BPromise['all'](_0x49623f);})[_0x7337('0x27')](function(_0x3085bf){var _0x359e29=_[_0x7337('0x11b')](_0x3085bf);_0x49623f=[];return db[_0x7337('0x60')][_0x7337('0x11c')](function(_0x5bc3a6){for(var _0x519dbf=0x0;_0x519dbf<_0x359e29[_0x7337('0x57')];_0x519dbf++){_0x49623f[_0x7337('0xec')](_0x359e29[_0x519dbf]['addAgent'](_0x45221c['id']),{'transaction':_0x5bc3a6});}return BPromise[_0x7337('0xf3')](_0x49623f)['then'](function(){if(_0x45221c[_0x7337('0xa6')]){return BPromise[_0x7337('0xee')](_[_0x7337('0x5d')](_0x359e29,function(_0x47256a){return _0x47256a['getDataValue'](_0x7337('0xa5'))===_0x7337('0x11d');}),function(_0x3b87b0){return db[_0x7337('0xb8')]['upsert']({'membername':_0x45221c[_0x7337('0x47')],'UserId':_0x45221c['id'],'queue_name':_0x3b87b0['name'],'VoiceQueueId':_0x3b87b0['id'],'interface':_[_0x7337('0x75')](_0x45221c[_0x7337('0xa9')])?util[_0x7337('0x77')](_0x7337('0xb5'),_0x45221c[_0x7337('0x47')]):_0x45221c[_0x7337('0xa9')],'paused':_0x45221c[_0x7337('0xa8')]||![],'penalty':_0x45221c[_0x7337('0xaf')]},{'transaction':_0x5bc3a6});});}else{return;}})[_0x7337('0x27')](function(){for(var _0x14e6f2=0x0;_0x14e6f2<_0x359e29[_0x7337('0x57')];_0x14e6f2++){var _0x2b47f4=_0x359e29[_0x14e6f2][_0x7337('0x11e')](_0x7337('0xa5'));var _0x1d7ebf=_0x2b47f4+'QueueId';socket[_0x7337('0xb2')](_0x7337('0x40')+_0x2b47f4+'Queue:save',{'UserId':_0x45221c['id'],['queueField']:_0x359e29[_0x14e6f2]['id']});}});});});}});}})[_0x7337('0x27')](respondWithStatusCode(_0x1bf78b,null))[_0x7337('0x31')](handleError(_0x1bf78b,null));};exports[_0x7337('0x11f')]=function(_0x5373db,_0x542a8a){return db[_0x7337('0x64')]['findOne']({'where':{'id':_0x5373db[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x542a8a,null))[_0x7337('0x27')](function(_0x2671e4){if(_0x2671e4){var _0xbfa377=_0x2671e4[_0x7337('0x3e')]({'plain':!![]});var _0xa6af33=_0x5373db[_0x7337('0x52')][_0x7337('0x70')];return _0x2671e4[_0x7337('0x11f')](_0xa6af33)[_0x7337('0x27')](function(){for(var _0x39140f=0x0;_0x39140f<_0xa6af33['length'];_0x39140f++){var _0x3ec030=[];db[_0x7337('0x111')][_0x7337('0x9b')]({'where':{'id':_0xa6af33[_0x39140f]}})[_0x7337('0x27')](function(_0x32d970){_0x3ec030[_0x7337('0xec')](_0x32d970[_0x7337('0xeb')]()[_0x7337('0x27')](function(_0x191212){for(var _0x3583a1=0x0;_0x3583a1<_0x191212['length'];_0x3583a1++){_0x191212[_0x3583a1][_0x7337('0x113')](_0x7337('0xa5'),_0x7337('0x11d'));}return _0x191212;}));_0x3ec030[_0x7337('0xec')](_0x32d970[_0x7337('0x114')]()[_0x7337('0x27')](function(_0x107d72){for(var _0x5d45a8=0x0;_0x5d45a8<_0x107d72[_0x7337('0x57')];_0x5d45a8++){_0x107d72[_0x5d45a8]['setDataValue']('channel',_0x7337('0x115'));}return _0x107d72;}));_0x3ec030[_0x7337('0xec')](_0x32d970[_0x7337('0x116')]()['then'](function(_0x139641){for(var _0x2998f6=0x0;_0x2998f6<_0x139641[_0x7337('0x57')];_0x2998f6++){_0x139641[_0x2998f6][_0x7337('0x113')]('channel',_0x7337('0x117'));}return _0x139641;}));_0x3ec030[_0x7337('0xec')](_0x32d970['getSmsQueues']()['then'](function(_0xebae75){for(var _0x5e24e8=0x0;_0x5e24e8<_0xebae75[_0x7337('0x57')];_0x5e24e8++){_0xebae75[_0x5e24e8]['setDataValue'](_0x7337('0xa5'),_0x7337('0x120'));}return _0xebae75;}));_0x3ec030[_0x7337('0xec')](_0x32d970[_0x7337('0x119')]()[_0x7337('0x27')](function(_0x5e4025){for(var _0xfb7643=0x0;_0xfb7643<_0x5e4025[_0x7337('0x57')];_0xfb7643++){_0x5e4025[_0xfb7643][_0x7337('0x113')](_0x7337('0xa5'),_0x7337('0x121'));}return _0x5e4025;}));_0x3ec030[_0x7337('0xec')](_0x32d970[_0x7337('0x11a')]()['then'](function(_0x33c33b){for(var _0x563222=0x0;_0x563222<_0x33c33b[_0x7337('0x57')];_0x563222++){_0x33c33b[_0x563222][_0x7337('0x113')](_0x7337('0xa5'),'Fax');}return _0x33c33b;}));_0x3ec030[_0x7337('0xec')](_0x32d970[_0x7337('0x122')]()[_0x7337('0x27')](function(_0x1206b4){for(var _0x276d56=0x0;_0x276d56<_0x1206b4['length'];_0x276d56++){_0x1206b4[_0x276d56][_0x7337('0x113')]('channel',_0x7337('0x123'));}return _0x1206b4;}));return BPromise[_0x7337('0xf3')](_0x3ec030);})[_0x7337('0x27')](function(_0x2b091f){var _0x4e37b7=_['flatten'](_0x2b091f);_0x3ec030=[];return db[_0x7337('0x60')][_0x7337('0x11c')](function(_0x3aa290){for(var _0x3dbd9d=0x0;_0x3dbd9d<_0x4e37b7[_0x7337('0x57')];_0x3dbd9d++){_0x3ec030[_0x7337('0xec')](_0x4e37b7[_0x3dbd9d]['removeAgent'](_0xbfa377['id']),{'transaction':_0x3aa290});}return BPromise[_0x7337('0xf3')](_0x3ec030)[_0x7337('0x27')](function(){if(_0xbfa377[_0x7337('0xa6')]){return BPromise['each'](_['filter'](_0x4e37b7,function(_0x275333){return _0x275333[_0x7337('0x11e')](_0x7337('0xa5'))===_0x7337('0x11d');}),function(_0x2ad0e2){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x2ad0e2['id'],'UserId':_0xbfa377['id']},'transaction':_0x3aa290});});}else{return;}})[_0x7337('0x27')](function(){for(var _0x1264ba=0x0;_0x1264ba<_0x4e37b7[_0x7337('0x57')];_0x1264ba++){var _0x4ad75b=_0x4e37b7[_0x1264ba][_0x7337('0x11e')](_0x7337('0xa5'));var _0xda40d3=_0x4ad75b+_0x7337('0xb1');socket[_0x7337('0xb2')](_0x7337('0x40')+_0x4ad75b+_0x7337('0xb7'),{'UserId':_0xbfa377['id'],['queueField']:_0x4e37b7[_0x1264ba]['id']});}});});});}});}})[_0x7337('0x27')](respondWithStatusCode(_0x542a8a,null))['catch'](handleError(_0x542a8a,null));};exports[_0x7337('0x124')]=function(_0x3cd2e9,_0x5ecb4c,_0x5ed38d){var _0x3a370a={};var _0x15a77c={};var _0x2df378;var _0x1d6f3c;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0x3cd2e9[_0x7337('0x6d')]['id']}})['then'](handleEntityNotFound(_0x5ecb4c,null))[_0x7337('0x27')](function(_0x2bef47){if(_0x2bef47){_0x2df378=_0x2bef47;_0x15a77c[_0x7337('0x4f')]=_[_0x7337('0x67')](db['CmList'][_0x7337('0x4b')]);_0x15a77c[_0x7337('0x52')]=_[_0x7337('0x67')](_0x3cd2e9[_0x7337('0x52')]);_0x15a77c['filters']=_[_0x7337('0x54')](_0x15a77c[_0x7337('0x4f')],_0x15a77c[_0x7337('0x52')]);_0x3a370a[_0x7337('0x55')]=_[_0x7337('0x54')](_0x15a77c['model'],qs[_0x7337('0x56')](_0x3cd2e9[_0x7337('0x52')][_0x7337('0x56')]));_0x3a370a[_0x7337('0x55')]=_0x3a370a['attributes'][_0x7337('0x57')]?_0x3a370a['attributes']:_0x15a77c[_0x7337('0x4f')];_0x3a370a['order']=qs['sort'](_0x3cd2e9[_0x7337('0x52')][_0x7337('0x5a')]);_0x3a370a[_0x7337('0x5b')]=qs['filters'](_[_0x7337('0x5c')](_0x3cd2e9[_0x7337('0x52')],_0x15a77c['filters']));if(_0x3cd2e9[_0x7337('0x52')][_0x7337('0x5d')]){_0x3a370a['where']=_[_0x7337('0x5e')](_0x3a370a[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x3a370a['attributes'],function(_0x1bb5df){var _0x5078b8={};_0x5078b8[_0x1bb5df]={'$like':'%'+_0x3cd2e9[_0x7337('0x52')]['filter']+'%'};return _0x5078b8;})});}_0x3a370a=_['merge']({},_0x3a370a,_0x3cd2e9[_0x7337('0x63')]);return _0x2df378[_0x7337('0x124')](_0x3a370a);}})['then'](function(_0x1f95c5){if(_0x1f95c5){_0x1d6f3c=_0x1f95c5[_0x7337('0x57')];if(!_0x3cd2e9[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0x3a370a['limit']=qs['limit'](_0x3cd2e9[_0x7337('0x52')][_0x7337('0x38')]);_0x3a370a[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x3cd2e9[_0x7337('0x52')][_0x7337('0x37')]);}return _0x2df378['getLists'](_0x3a370a);}})[_0x7337('0x27')](function(_0x43675e){if(_0x43675e){return _0x43675e?{'count':_0x1d6f3c,'rows':_0x43675e}:null;}})[_0x7337('0x27')](respondWithResult(_0x5ecb4c,null))[_0x7337('0x31')](handleError(_0x5ecb4c,null));};exports['getAgents']=function(_0xd77795,_0x4a5506,_0x138395){var _0x38c7c5={};var _0x5dd131={};var _0x2ca5f5;var _0x49e60d;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0xd77795['params']['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x4a5506,null))[_0x7337('0x27')](function(_0x12ba54){if(_0x12ba54){_0x2ca5f5=_0x12ba54;_0x5dd131['model']=_[_0x7337('0x67')](db[_0x7337('0x64')][_0x7337('0x4b')]);_0x5dd131[_0x7337('0x52')]=_['keys'](_0xd77795[_0x7337('0x52')]);_0x5dd131[_0x7337('0x53')]=_[_0x7337('0x54')](_0x5dd131[_0x7337('0x4f')],_0x5dd131[_0x7337('0x52')]);_0x38c7c5[_0x7337('0x55')]=_[_0x7337('0x54')](_0x5dd131[_0x7337('0x4f')],qs['fields'](_0xd77795[_0x7337('0x52')][_0x7337('0x56')]));_0x38c7c5[_0x7337('0x55')]=_0x38c7c5['attributes'][_0x7337('0x57')]?_0x38c7c5[_0x7337('0x55')]:_0x5dd131['model'];_0x38c7c5[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0xd77795[_0x7337('0x52')][_0x7337('0x5a')]);_0x38c7c5[_0x7337('0x5b')]=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0xd77795[_0x7337('0x52')],_0x5dd131[_0x7337('0x53')]));if(_0xd77795[_0x7337('0x52')][_0x7337('0x5d')]){_0x38c7c5[_0x7337('0x5b')]=_['merge'](_0x38c7c5['where'],{'$or':_['map'](_0x38c7c5[_0x7337('0x55')],function(_0x450000){var _0x5e65a6={};_0x5e65a6[_0x450000]={'$like':'%'+_0xd77795[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x5e65a6;})});}_0x38c7c5[_0x7337('0x4f')]=db['User'];_0x38c7c5['as']=_0x7337('0x41');_0x38c7c5=_[_0x7337('0x5e')]({},_0x38c7c5,_0xd77795[_0x7337('0x63')]);return _0x2ca5f5[_0x7337('0xeb')]({'include':[_0x38c7c5]});}})[_0x7337('0x27')](function(_0x3667e7){if(_0x3667e7){var _0x4d3654={},_0x24d41b=[],_0x2a4df2=0x0;for(var _0x250180=0x0;_0x250180<_0x3667e7[_0x7337('0x57')];_0x250180+=0x1){for(var _0x53567c=0x0,_0x366b7c;_0x53567c<_0x3667e7[_0x250180][_0x7337('0x41')]['length'];_0x53567c+=0x1){_0x366b7c=_0x3667e7[_0x250180]['Agents'][_0x53567c][_0x7337('0x3e')]({'plain':!![]});_0x4d3654[_0x366b7c['id']]=_0x366b7c;}}_0x4d3654=_['values'](_0x4d3654);for(var _0x578128=qs[_0x7337('0x37')](_0xd77795[_0x7337('0x52')][_0x7337('0x37')]);_0x578128<_0x4d3654[_0x7337('0x57')]&&_0x24d41b[_0x7337('0x57')]=_0x532fc2[_0x83fd('0x55')]){throw new Error(_0x83fd('0x56'));}})['then'](function(){if(_0x52695c){return db['UserVoiceQueueRt'][_0x83fd('0x4c')]({'where':{'membername':_0x52695c[_0x83fd('0x29')]},'individualHooks':!![]});}})[_0x83fd('0x12')](function(){if(_0x52695c){return _0x52695c[_0x83fd('0x57')]({'raw':!![]});}})[_0x83fd('0x12')](function(_0x432691){if(_0x52695c){if(_0x432691){var _0x5a0fce=[];_0x2d450c=_0x432691;if(_0x2d450c[_0x83fd('0x33')]){for(var _0x5bc1f4=0x0;_0x5bc1f4<_0x2d450c['length'];_0x5bc1f4++){_0x5a0fce[_0x83fd('0x49')](db[_0x83fd('0x2d')][_0x83fd('0x58')]({'membername':_0x52695c[_0x83fd('0x29')],'UserId':_0x52695c['id'],'queue_name':_0x2d450c[_0x5bc1f4][_0x83fd('0x29')],'VoiceQueueId':_0x2d450c[_0x5bc1f4]['id'],'interface':_0x12dc18,'paused':_0x52695c[_0x83fd('0x50')]||![],'penalty':_0x2d450c[_0x5bc1f4]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x83fd('0x4a')](_0x5a0fce);}}}})[_0x83fd('0x12')](function(){if(_0x52695c){return db[_0x83fd('0x2f')][_0x83fd('0x1f')]({'where':{'membername':_0x52695c[_0x83fd('0x29')],'exitAt':null}});}})[_0x83fd('0x12')](function(_0x5c4715){if(_0x52695c){if(_0x5c4715&&_0x5c4715[_0x83fd('0x33')]){var _0x20fae6=[];_0x5c4715[_0x83fd('0x36')](function(_0x5b9881){_0x20fae6[_0x83fd('0x49')](_0x5b9881[_0x83fd('0x2e')]({'exitAt':moment()[_0x83fd('0x31')](_0x83fd('0x32'))}));});return BPromise['all'](_0x20fae6);}}})['then'](function(_0x1098a5){if(_0x52695c){var _0x4a58be=[];var _0x356bb2=[];var _0x2c7dab=utils[_0x83fd('0x35')]();var _0x396e54={'membername':_0x52695c[_0x83fd('0x29')],'interface':_0x12dc18,'enterAt':moment()['format'](_0x83fd('0x32')),'role':_0x52695c['role'],'internal':_0x52695c[_0x83fd('0x2b')]};_0x2c7dab[_0x83fd('0x36')](function(_0x151b61){_0x4a58be[_0x83fd('0x49')](_[_0x83fd('0x59')]({'channel':_0x151b61,'type':_0x83fd('0x5a'),'data1':_0x83fd('0x5b'),'data2':_0x12dc18},_0x396e54));if(_0x52695c[_0x83fd('0x50')]){_0x356bb2[_0x83fd('0x49')](_['merge']({'channel':_0x151b61,'type':_0x83fd('0x30'),'data1':_0x83fd('0x5c')},_0x396e54));}});return db[_0x83fd('0x2f')]['bulkCreate'](_0x4a58be[_0x83fd('0x5d')](_0x356bb2),{'individualHooks':!![]});}})[_0x83fd('0x12')](function(){if(_0x52695c){return _0x52695c[_0x83fd('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x83fd('0x31')](_0x83fd('0x32')),'voicePause':_0x52695c['loginInPause']||![],'mailPause':_0x52695c[_0x83fd('0x50')]||![],'chatPause':_0x52695c['loginInPause']||![],'faxPause':_0x52695c[_0x83fd('0x50')]||![],'smsPause':_0x52695c['loginInPause']||![],'openchannelPause':_0x52695c[_0x83fd('0x50')]||![],'pauseType':_0x52695c[_0x83fd('0x50')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x83fd('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x12dc18});}})[_0x83fd('0x12')](function(_0x4a480e){_0x3c9fe6(_0x4a480e);})[_0x83fd('0x1c')](function(_0x2d3a89){_0x3360c7(_0x3032aa['error'](0x1f4,_0x2d3a89[_0x83fd('0x1a')]));});});}; \ No newline at end of file +var _0xb00d=['interface','UserVoiceQueueRt','update','MemberReport','findAll','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','name','SIP/%s','body','DEFAULT\x20PAUSE','role','type','UnpauseUser','findOne','channel','isValidChannel','voice','mail','chat','openchannel','system','%s%s','Pause','all','LogoutUser','destroy','LoginUser','mobile','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','bulkCreate','concat','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','socket.io-emitter','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','User','options','where','limit','include','map','model','attributes','GetUser','ShowUser','find','raw','PauseUser','internal'];(function(_0x43211f,_0xbaef90){var _0x1099ac=function(_0x3236c6){while(--_0x3236c6){_0x43211f['push'](_0x43211f['shift']());}};_0x1099ac(++_0xbaef90);}(_0xb00d,0x196));var _0xdb00=function(_0x3fbb91,_0x5ec106){_0x3fbb91=_0x3fbb91-0x0;var _0x3eb213=_0xb00d[_0x3fbb91];return _0x3eb213;};'use strict';var _=require(_0xdb00('0x0'));var util=require(_0xdb00('0x1'));var moment=require(_0xdb00('0x2'));var BPromise=require(_0xdb00('0x3'));var rs=require(_0xdb00('0x4'));var fs=require('fs');var Redis=require(_0xdb00('0x5'));var db=require(_0xdb00('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb00('0x7'))(_0xdb00('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xdb00('0x9')]({'port':0x232a});config[_0xdb00('0xa')]=_['defaults'](config[_0xdb00('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb00('0xb'))(new Redis(config[_0xdb00('0xa')]));require(_0xdb00('0xc'))[_0xdb00('0xd')](socket);function respondWithRpcPromise(_0x532306,_0x1c4861,_0x696d0d){return new BPromise(function(_0x976259,_0x4122c5){return client['request'](_0x532306,_0x696d0d)[_0xdb00('0xe')](function(_0x3c3f79){logger[_0xdb00('0xf')](_0xdb00('0x10'),_0x1c4861,_0xdb00('0x11'));logger[_0xdb00('0x12')]('User,\x20%s,\x20%s,\x20%s',_0x1c4861,_0xdb00('0x11'),JSON[_0xdb00('0x13')](_0x3c3f79));if(_0x3c3f79[_0xdb00('0x14')]){if(_0x3c3f79['error'][_0xdb00('0x15')]===0x1f4){logger['error'](_0xdb00('0x10'),_0x1c4861,_0x3c3f79['error'][_0xdb00('0x16')]);return _0x4122c5(_0x3c3f79[_0xdb00('0x14')][_0xdb00('0x16')]);}logger['error'](_0xdb00('0x10'),_0x1c4861,_0x3c3f79[_0xdb00('0x14')][_0xdb00('0x16')]);return _0x976259(_0x3c3f79[_0xdb00('0x14')]['message']);}else{logger['info'](_0xdb00('0x10'),_0x1c4861,_0xdb00('0x11'));_0x976259(_0x3c3f79[_0xdb00('0x17')][_0xdb00('0x16')]);}})[_0xdb00('0x18')](function(_0x3605f2){logger[_0xdb00('0x14')](_0xdb00('0x10'),_0x1c4861,_0x3605f2);_0x4122c5(_0x3605f2);});});}exports['GetUser']=function(_0x12eb3a){var _0x152862=this;return new Promise(function(_0x3656a5,_0x487a3a){return db[_0xdb00('0x19')]['findAll']({'raw':_0x12eb3a[_0xdb00('0x1a')]?_0x12eb3a[_0xdb00('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x12eb3a[_0xdb00('0x1a')]?_0x12eb3a['options'][_0xdb00('0x1b')]||null:null,'attributes':_0x12eb3a[_0xdb00('0x1a')]?_0x12eb3a[_0xdb00('0x1a')]['attributes']||null:null,'limit':_0x12eb3a[_0xdb00('0x1a')]?_0x12eb3a['options'][_0xdb00('0x1c')]||null:null,'include':_0x12eb3a[_0xdb00('0x1a')]?_0x12eb3a[_0xdb00('0x1a')][_0xdb00('0x1d')]?_[_0xdb00('0x1e')](_0x12eb3a['options'][_0xdb00('0x1d')],function(_0x5c78a1){return{'model':db[_0x5c78a1[_0xdb00('0x1f')]],'as':_0x5c78a1['as'],'attributes':_0x5c78a1[_0xdb00('0x20')],'include':_0x5c78a1[_0xdb00('0x1d')]?_[_0xdb00('0x1e')](_0x5c78a1[_0xdb00('0x1d')],function(_0x39bdc2){return{'model':db[_0x39bdc2['model']],'as':_0x39bdc2['as'],'attributes':_0x39bdc2[_0xdb00('0x20')],'include':_0x39bdc2[_0xdb00('0x1d')]?_[_0xdb00('0x1e')](_0x39bdc2['include'],function(_0x2a3ed9){return{'model':db[_0x2a3ed9[_0xdb00('0x1f')]],'as':_0x2a3ed9['as'],'attributes':_0x2a3ed9[_0xdb00('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdb00('0xe')](function(_0x2b64a4){logger[_0xdb00('0xf')](_0xdb00('0x21'),_0x12eb3a);logger['debug'](_0xdb00('0x21'),_0x12eb3a,JSON[_0xdb00('0x13')](_0x2b64a4));_0x3656a5(_0x2b64a4);})[_0xdb00('0x18')](function(_0x51d971){logger[_0xdb00('0x14')](_0xdb00('0x21'),_0x51d971[_0xdb00('0x16')],_0x12eb3a);_0x487a3a(_0x152862[_0xdb00('0x14')](0x1f4,_0x51d971[_0xdb00('0x16')]));});});};exports[_0xdb00('0x22')]=function(_0x762b70){var _0x4b1d2d=this;return new Promise(function(_0x4421ac,_0x192174){return db['User'][_0xdb00('0x23')]({'raw':_0x762b70[_0xdb00('0x1a')]?_0x762b70[_0xdb00('0x1a')][_0xdb00('0x24')]===undefined?!![]:![]:!![],'where':_0x762b70[_0xdb00('0x1a')]?_0x762b70[_0xdb00('0x1a')][_0xdb00('0x1b')]||null:null,'attributes':_0x762b70['options']?_0x762b70[_0xdb00('0x1a')]['attributes']||null:null,'include':_0x762b70['options']?_0x762b70[_0xdb00('0x1a')][_0xdb00('0x1d')]?_[_0xdb00('0x1e')](_0x762b70['options'][_0xdb00('0x1d')],function(_0x5614a2){return{'model':db[_0x5614a2[_0xdb00('0x1f')]],'as':_0x5614a2['as'],'attributes':_0x5614a2[_0xdb00('0x20')],'include':_0x5614a2['include']?_[_0xdb00('0x1e')](_0x5614a2['include'],function(_0x23fccd){return{'model':db[_0x23fccd[_0xdb00('0x1f')]],'as':_0x23fccd['as'],'attributes':_0x23fccd['attributes'],'include':_0x23fccd[_0xdb00('0x1d')]?_[_0xdb00('0x1e')](_0x23fccd[_0xdb00('0x1d')],function(_0xb72a89){return{'model':db[_0xb72a89[_0xdb00('0x1f')]],'as':_0xb72a89['as'],'attributes':_0xb72a89['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb00('0xe')](function(_0x10fe70){logger['info'](_0xdb00('0x22'),_0x762b70);logger[_0xdb00('0x12')]('ShowUser',_0x762b70,JSON[_0xdb00('0x13')](_0x10fe70));_0x4421ac(_0x10fe70);})['catch'](function(_0x1dc417){logger[_0xdb00('0x14')](_0xdb00('0x22'),_0x1dc417[_0xdb00('0x16')],_0x762b70);_0x192174(_0x4b1d2d['error'](0x1f4,_0x1dc417[_0xdb00('0x16')]));});});};exports[_0xdb00('0x25')]=function(_0x5a90bb){var _0x5e52fa=this;return new Promise(function(_0x126272,_0x2e957b){var _0x4a8f7f;return db['User'][_0xdb00('0x23')]({'where':_0x5a90bb[_0xdb00('0x1a')]['where']||{},'attributes':['id','name','role',_0xdb00('0x26'),_0xdb00('0x27')]})[_0xdb00('0xe')](function(_0x1d251b){if(_0x1d251b){_0x4a8f7f=_0x1d251b;return db[_0xdb00('0x28')][_0xdb00('0x29')]({'paused':0x1},{'where':{'UserId':_0x4a8f7f['id']},'individualHooks':!![]});}})[_0xdb00('0xe')](function(){if(_0x4a8f7f){return db[_0xdb00('0x2a')][_0xdb00('0x2b')]({'where':{'membername':_0x4a8f7f['name'],'type':_0xdb00('0x2c'),'exitAt':null}});}})['then'](function(_0x5efa71){if(_0x4a8f7f){if(_0x5efa71&&_0x5efa71[_0xdb00('0x2d')]){var _0x2c80fd=moment()[_0xdb00('0x2e')](_0xdb00('0x2f'));for(var _0x19eccc=0x0,_0x50d186=_0x5efa71[_0xdb00('0x2d')];_0x19eccc<_0x50d186;_0x19eccc++){_0x5efa71[_0x19eccc][_0xdb00('0x30')]({'exitAt':_0x2c80fd});}}}})['then'](function(){if(_0x4a8f7f){var _0x13cf76=[];var _0x5e9e08=utils[_0xdb00('0x31')]();_0x5e9e08[_0xdb00('0x32')](function(_0x4a30fc){_0x13cf76[_0xdb00('0x33')]({'channel':_0x4a30fc,'membername':_0x4a8f7f[_0xdb00('0x34')],'interface':_['isNil'](_0x4a8f7f[_0xdb00('0x27')])?util['format'](_0xdb00('0x35'),_0x4a8f7f[_0xdb00('0x34')]):_0x4a8f7f[_0xdb00('0x27')],'type':_0xdb00('0x2c'),'enterAt':moment()[_0xdb00('0x2e')](_0xdb00('0x2f')),'data1':_0x5a90bb[_0xdb00('0x36')]['type']||_0xdb00('0x37'),'role':_0x4a8f7f[_0xdb00('0x38')],'internal':_0x4a8f7f[_0xdb00('0x26')],'uniqueid':_0x5a90bb[_0xdb00('0x36')]['uniqueid']||null});});return db[_0xdb00('0x2a')]['bulkCreate'](_0x13cf76,{'individualHooks':!![]});}})[_0xdb00('0xe')](function(){if(_0x4a8f7f){return _0x4a8f7f['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x5a90bb['body'][_0xdb00('0x39')]||_0xdb00('0x37'),'lastPauseAt':moment()[_0xdb00('0x2e')](_0xdb00('0x2f'))});}})[_0xdb00('0xe')](function(_0x57c147){_0x126272(_0x57c147);})[_0xdb00('0x18')](function(_0x5747f4){_0x2e957b(_0x5e52fa[_0xdb00('0x14')](0x1f4,_0x5747f4['message']));});});};exports[_0xdb00('0x3a')]=function(_0x1ca44a){var _0x122ca5=this;return new Promise(function(_0x2b6e9b,_0x3e59ba){var _0x28c784;return db[_0xdb00('0x19')][_0xdb00('0x3b')]({'where':_0x1ca44a[_0xdb00('0x1a')]['where']||{},'attributes':['id',_0xdb00('0x34')]})[_0xdb00('0xe')](function(_0x402285){if(_0x402285){_0x28c784=_0x402285;if(_0x1ca44a[_0xdb00('0x36')][_0xdb00('0x3c')]&&!utils[_0xdb00('0x3d')](_0x1ca44a[_0xdb00('0x36')][_0xdb00('0x3c')])){throw new Error('Unknown\x20channel');}switch(_0x1ca44a['body'][_0xdb00('0x3c')]){case _0xdb00('0x3e'):return db[_0xdb00('0x28')][_0xdb00('0x29')]({'paused':0x0},{'where':{'UserId':_0x28c784['id']}})['then'](function(){return db[_0xdb00('0x2a')][_0xdb00('0x23')]({'where':{'channel':_0x1ca44a[_0xdb00('0x36')][_0xdb00('0x3c')],'membername':_0x28c784[_0xdb00('0x34')],'type':_0xdb00('0x2c'),'exitAt':null}});})['then'](function(_0x29b01b){if(_0x29b01b){return _0x29b01b[_0xdb00('0x29')]({'exitAt':moment()[_0xdb00('0x2e')](_0xdb00('0x2f')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0xdb00('0xe')](function(){return _0x28c784[_0xdb00('0x29')]({'voicePause':![]});});case _0xdb00('0x3f'):case _0xdb00('0x40'):case'fax':case'sms':case _0xdb00('0x41'):return db[_0xdb00('0x2a')][_0xdb00('0x23')]({'where':{'channel':_0x1ca44a[_0xdb00('0x36')][_0xdb00('0x3c')],'membername':_0x28c784[_0xdb00('0x34')],'type':'PAUSE','exitAt':null}})[_0xdb00('0xe')](function(_0x1d2062){return _0x1d2062['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xdb00('0x42')},{'individualHooks':!![]});})[_0xdb00('0xe')](function(){var _0x3d72ef={};_['set'](_0x3d72ef,util[_0xdb00('0x2e')](_0xdb00('0x43'),_0x1ca44a['body'][_0xdb00('0x3c')],_0xdb00('0x44')),![]);return _0x28c784[_0xdb00('0x29')](_0x3d72ef);});default:return db['UserVoiceQueueRt'][_0xdb00('0x29')]({'paused':0x0},{'where':{'UserId':_0x28c784['id']}})[_0xdb00('0xe')](function(){return db[_0xdb00('0x2a')]['findAll']({'where':{'membername':_0x28c784[_0xdb00('0x34')],'type':_0xdb00('0x2c'),'exitAt':null}});})[_0xdb00('0xe')](function(_0x1b2dea){var _0x32bb4f=[];_0x1b2dea['forEach'](function(_0x26b0f4){_0x32bb4f[_0xdb00('0x33')](_0x26b0f4['update']({'exitAt':moment()[_0xdb00('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise[_0xdb00('0x45')](_0x32bb4f);})['then'](function(){return _0x28c784[_0xdb00('0x29')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xdb00('0xe')](function(_0x1e01cb){_0x2b6e9b(_0x1e01cb);})[_0xdb00('0x18')](function(_0x56e2f4){_0x3e59ba(_0x122ca5['error'](0x1f4,_0x56e2f4['message']));});});};exports[_0xdb00('0x46')]=function(_0x505b25){var _0xff103d=this;return new Promise(function(_0x1240fa,_0x5435ea){var _0x31194a;return db[_0xdb00('0x19')][_0xdb00('0x3b')]({'where':_0x505b25[_0xdb00('0x1a')]['where']||{},'attributes':['id',_0xdb00('0x34')]})[_0xdb00('0xe')](function(_0x503c88){if(_0x503c88){_0x31194a=_0x503c88;return db[_0xdb00('0x28')][_0xdb00('0x47')]({'where':{'membername':_0x31194a[_0xdb00('0x34')]},'individualHooks':!![]});}})['then'](function(){if(_0x31194a){return db[_0xdb00('0x2a')][_0xdb00('0x2b')]({'where':{'membername':_0x31194a[_0xdb00('0x34')],'exitAt':null}});}})[_0xdb00('0xe')](function(_0x2abe85){if(_0x31194a){if(_0x2abe85&&_0x2abe85['length']){var _0x1c1029=[];_0x2abe85[_0xdb00('0x32')](function(_0x5d11cb){_0x1c1029[_0xdb00('0x33')](_0x5d11cb[_0xdb00('0x29')]({'exitAt':moment()[_0xdb00('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xdb00('0x45')](_0x1c1029);}}})[_0xdb00('0xe')](function(){if(_0x31194a){return _0x31194a[_0xdb00('0x29')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x3a9308){_0x1240fa(_0x3a9308);})[_0xdb00('0x18')](function(_0x5b085a){_0x5435ea(_0xff103d['error'](0x1f4,_0x5b085a[_0xdb00('0x16')]));});});};exports[_0xdb00('0x48')]=function(_0x128b89){var _0x2ce6cc=this;return new Promise(function(_0x5d6c6f,_0x22de5){var _0x40f5e7;var _0x2c0a47;var _0x460518;var _0x2c5a87;return db['User']['findOne']({'where':_0x128b89[_0xdb00('0x1a')][_0xdb00('0x1b')]||{},'attributes':['id',_0xdb00('0x34'),'role',_0xdb00('0x49'),'phone','internal',_0xdb00('0x4a'),_0xdb00('0x27')]})['then'](function(_0x54fa7d){if(_0x54fa7d){_0x40f5e7=_0x54fa7d;_0x2c5a87=_0x128b89[_0xdb00('0x36')]['interface']?_0x128b89[_0xdb00('0x36')]['interface']:util[_0xdb00('0x2e')]('SIP/%s',_0x40f5e7['name']);return db[_0xdb00('0x19')][_0xdb00('0x4b')]({'where':{'role':_0xdb00('0x4c'),'online':!![],'id':{'$ne':_0x40f5e7['id']}}});}})['then'](function(_0x1f768e){if(_0x1f768e){_0x460518=_0x1f768e;return require(_0xdb00('0x4d'))[_0xdb00('0x4e')]();}})[_0xdb00('0xe')](function(_0x54a676){if(_0x54a676&&_0x54a676[_0xdb00('0x4f')]&&_0x460518>=_0x54a676[_0xdb00('0x4f')]){throw new Error(_0xdb00('0x50'));}})['then'](function(){if(_0x40f5e7){return db[_0xdb00('0x28')][_0xdb00('0x47')]({'where':{'membername':_0x40f5e7['name']},'individualHooks':!![]});}})[_0xdb00('0xe')](function(){if(_0x40f5e7){return _0x40f5e7[_0xdb00('0x51')]({'raw':!![]});}})[_0xdb00('0xe')](function(_0x557a5e){if(_0x40f5e7){if(_0x557a5e){var _0x32712b=[];_0x2c0a47=_0x557a5e;if(_0x2c0a47[_0xdb00('0x2d')]){for(var _0x29047c=0x0;_0x29047c<_0x2c0a47['length'];_0x29047c++){_0x32712b[_0xdb00('0x33')](db[_0xdb00('0x28')][_0xdb00('0x52')]({'membername':_0x40f5e7[_0xdb00('0x34')],'UserId':_0x40f5e7['id'],'queue_name':_0x2c0a47[_0x29047c][_0xdb00('0x34')],'VoiceQueueId':_0x2c0a47[_0x29047c]['id'],'interface':_0x2c5a87,'paused':_0x40f5e7['loginInPause']||![],'penalty':_0x2c0a47[_0x29047c][_0xdb00('0x53')]||0x0}));}return BPromise['all'](_0x32712b);}}}})['then'](function(){if(_0x40f5e7){return db[_0xdb00('0x2a')]['findAll']({'where':{'membername':_0x40f5e7[_0xdb00('0x34')],'exitAt':null}});}})[_0xdb00('0xe')](function(_0x198508){if(_0x40f5e7){if(_0x198508&&_0x198508[_0xdb00('0x2d')]){var _0x537566=[];_0x198508[_0xdb00('0x32')](function(_0x58d314){_0x537566['push'](_0x58d314[_0xdb00('0x29')]({'exitAt':moment()[_0xdb00('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x537566);}}})[_0xdb00('0xe')](function(_0x246248){if(_0x40f5e7){var _0x2bb924=[];var _0x3e837c=[];var _0x4da3f7=utils[_0xdb00('0x31')]();var _0x32dbc0={'membername':_0x40f5e7['name'],'interface':_0x2c5a87,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x40f5e7['role'],'internal':_0x40f5e7[_0xdb00('0x26')]};_0x4da3f7[_0xdb00('0x32')](function(_0x2ec4d7){_0x2bb924[_0xdb00('0x33')](_[_0xdb00('0x54')]({'channel':_0x2ec4d7,'type':_0xdb00('0x55'),'data1':'callysquare','data2':_0x2c5a87},_0x32dbc0));if(_0x40f5e7['loginInPause']){_0x3e837c[_0xdb00('0x33')](_[_0xdb00('0x54')]({'channel':_0x2ec4d7,'type':'PAUSE','data1':'LOGININPAUSE'},_0x32dbc0));}});return db[_0xdb00('0x2a')][_0xdb00('0x56')](_0x2bb924[_0xdb00('0x57')](_0x3e837c),{'individualHooks':!![]});}})[_0xdb00('0xe')](function(){if(_0x40f5e7){return _0x40f5e7['update']({'online':!![],'lastLoginAt':moment()['format'](_0xdb00('0x2f')),'voicePause':_0x40f5e7['loginInPause']||![],'mailPause':_0x40f5e7[_0xdb00('0x4a')]||![],'chatPause':_0x40f5e7['loginInPause']||![],'faxPause':_0x40f5e7[_0xdb00('0x4a')]||![],'smsPause':_0x40f5e7[_0xdb00('0x4a')]||![],'openchannelPause':_0x40f5e7[_0xdb00('0x4a')]||![],'pauseType':_0x40f5e7['loginInPause']?_0xdb00('0x58'):null,'lastPauseAt':moment()[_0xdb00('0x2e')](_0xdb00('0x2f')),'interface':_0x2c5a87});}})['then'](function(_0x14ee0c){_0x5d6c6f(_0x14ee0c);})['catch'](function(_0x166d56){_0x22de5(_0x2ce6cc[_0xdb00('0x14')](0x1f4,_0x166d56['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index fa073b5..459aa3d 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 _0x2c0e=['./user.events','update','emit','removeListener','register','user:'];(function(_0x529419,_0x248ca3){var _0x1f554e=function(_0x34e528){while(--_0x34e528){_0x529419['push'](_0x529419['shift']());}};_0x1f554e(++_0x248ca3);}(_0x2c0e,0xd8));var _0xe2c0=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x2c0e[_0x328534];return _0x2796c0;};'use strict';var UserEvents=require(_0xe2c0('0x0'));var events=['save','remove',_0xe2c0('0x1')];function createListener(_0x55e37b,_0xdf0490){return function(_0x491235){_0xdf0490[_0xe2c0('0x2')](_0x55e37b,_0x491235);};}function removeListener(_0x52d074,_0x38aab3){return function(){UserEvents[_0xe2c0('0x3')](_0x52d074,_0x38aab3);};}exports[_0xe2c0('0x4')]=function(_0x5d65fa){for(var _0x93fcb8=0x0,_0x3fca13=events['length'];_0x93fcb8<_0x3fca13;_0x93fcb8++){var _0x44e666=events[_0x93fcb8];var _0x1a33f8=createListener(_0xe2c0('0x5')+_0x44e666,_0x5d65fa);UserEvents['on'](_0x44e666,_0x1a33f8);}}; \ No newline at end of file +var _0x30b4=['register','./user.events','save','remove','emit','removeListener'];(function(_0x3c963f,_0x277ba6){var _0x5995af=function(_0x1a02c1){while(--_0x1a02c1){_0x3c963f['push'](_0x3c963f['shift']());}};_0x5995af(++_0x277ba6);}(_0x30b4,0x1e1));var _0x430b=function(_0x1b664d,_0x1d8695){_0x1b664d=_0x1b664d-0x0;var _0x43af6b=_0x30b4[_0x1b664d];return _0x43af6b;};'use strict';var UserEvents=require(_0x430b('0x0'));var events=[_0x430b('0x1'),_0x430b('0x2'),'update'];function createListener(_0x5decbc,_0x585a77){return function(_0x423a01){_0x585a77[_0x430b('0x3')](_0x5decbc,_0x423a01);};}function removeListener(_0x27f8df,_0x3178d3){return function(){UserEvents[_0x430b('0x4')](_0x27f8df,_0x3178d3);};}exports[_0x430b('0x5')]=function(_0x33a2ce){for(var _0x3a6377=0x0,_0x2d04db=events['length'];_0x3a6377<_0x2d04db;_0x3a6377++){var _0x4af45c=events[_0x3a6377];var _0x4bd1e3=createListener('user:'+_0x4af45c,_0x33a2ce);UserEvents['on'](_0x4af45c,_0x4bd1e3);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index fa147f2..bf051f9 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 _0x47e8=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x2c51a7,_0x2339a2){var _0x15e5d2=function(_0x1b4051){while(--_0x1b4051){_0x2c51a7['push'](_0x2c51a7['shift']());}};_0x15e5d2(++_0x2339a2);}(_0x47e8,0xf4));var _0x847e=function(_0x586c70,_0x4a8cb3){_0x586c70=_0x586c70-0x0;var _0x26db79=_0x47e8[_0x586c70];return _0x26db79;};'use strict';var multer=require(_0x847e('0x0'));var util=require(_0x847e('0x1'));var path=require(_0x847e('0x2'));var timeout=require(_0x847e('0x3'));var express=require(_0x847e('0x4'));var router=express['Router']();var auth=require(_0x847e('0x5'));var interaction=require(_0x847e('0x6'));var config=require(_0x847e('0x7'));module['exports']=router; \ No newline at end of file +var _0x4400=['util','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x469c14,_0x2f43eb){var _0x4e5129=function(_0x1453d9){while(--_0x1453d9){_0x469c14['push'](_0x469c14['shift']());}};_0x4e5129(++_0x2f43eb);}(_0x4400,0xf4));var _0x0440=function(_0x2d3308,_0x288134){_0x2d3308=_0x2d3308-0x0;var _0x562e33=_0x4400[_0x2d3308];return _0x562e33;};'use strict';var multer=require(_0x0440('0x0'));var util=require(_0x0440('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0440('0x2'));var router=express[_0x0440('0x3')]();var auth=require(_0x0440('0x4'));var interaction=require(_0x0440('0x5'));var config=require('../../config/environment');module[_0x0440('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 82f9b00..67c8f07 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(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x327edf,_0x4143a1){var _0x31df9d=function(_0x41a767){while(--_0x41a767){_0x327edf['push'](_0x327edf['shift']());}};_0x31df9d(++_0x4143a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 3475b75..a3aecc6 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 _0x9bd5=['rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','moment','request-promise','path'];(function(_0x3377a4,_0x5c89d1){var _0x1f24fb=function(_0x5f22f6){while(--_0x5f22f6){_0x3377a4['push'](_0x3377a4['shift']());}};_0x1f24fb(++_0x5c89d1);}(_0x9bd5,0xab));var _0x59bd=function(_0x38bd0e,_0x4cc124){_0x38bd0e=_0x38bd0e-0x0;var _0x3d273e=_0x9bd5[_0x38bd0e];return _0x3d273e;};'use strict';var _=require(_0x59bd('0x0'));var util=require(_0x59bd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x59bd('0x2'));var BPromise=require('bluebird');var rp=require(_0x59bd('0x3'));var fs=require('fs');var path=require(_0x59bd('0x4'));var rimraf=require(_0x59bd('0x5'));var config=require(_0x59bd('0x6'));var attributes=require('./userChatQueue.attributes');module[_0x59bd('0x7')]=function(_0x3865e0,_0x34c961){return _0x3865e0[_0x59bd('0x8')](_0x59bd('0x9'),attributes,{'tableName':_0x59bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4114=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x3c3ddc,_0x1408d5){var _0x1c9a42=function(_0x57e824){while(--_0x57e824){_0x3c3ddc['push'](_0x3c3ddc['shift']());}};_0x1c9a42(++_0x1408d5);}(_0x4114,0x1aa));var _0x4411=function(_0x2bc057,_0x357822){_0x2bc057=_0x2bc057-0x0;var _0x18dff1=_0x4114[_0x2bc057];return _0x18dff1;};'use strict';var _=require(_0x4411('0x0'));var util=require(_0x4411('0x1'));var logger=require(_0x4411('0x2'))('api');var moment=require(_0x4411('0x3'));var BPromise=require(_0x4411('0x4'));var rp=require(_0x4411('0x5'));var fs=require('fs');var path=require(_0x4411('0x6'));var rimraf=require(_0x4411('0x7'));var config=require(_0x4411('0x8'));var attributes=require('./userChatQueue.attributes');module[_0x4411('0x9')]=function(_0x62c89b,_0x58fcbe){return _0x62c89b[_0x4411('0xa')](_0x4411('0xb'),attributes,{'tableName':_0x4411('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 3699883..d85adc4 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 _0x85f0=['message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','UserChatQueue,\x20%s,\x20%s'];(function(_0x1977c2,_0x19446a){var _0x1f591c=function(_0x33d69d){while(--_0x33d69d){_0x1977c2['push'](_0x1977c2['shift']());}};_0x1f591c(++_0x19446a);}(_0x85f0,0x137));var _0x085f=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0x85f0[_0x2b45b5];return _0x1d9c06;};'use strict';var _=require(_0x085f('0x0'));var util=require('util');var moment=require(_0x085f('0x1'));var BPromise=require(_0x085f('0x2'));var rs=require(_0x085f('0x3'));var fs=require('fs');var Redis=require(_0x085f('0x4'));var db=require(_0x085f('0x5'))['db'];var utils=require(_0x085f('0x6'));var logger=require(_0x085f('0x7'))(_0x085f('0x8'));var config=require(_0x085f('0x9'));var jayson=require(_0x085f('0xa'));var client=jayson[_0x085f('0xb')][_0x085f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ce52b,_0x53e358,_0x5ebc68){return new BPromise(function(_0x23ea92,_0x369d3c){return client[_0x085f('0xd')](_0x4ce52b,_0x5ebc68)['then'](function(_0x451bc6){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x53e358,_0x085f('0xe'));logger[_0x085f('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x53e358,'request\x20sent',JSON[_0x085f('0x10')](_0x451bc6));if(_0x451bc6[_0x085f('0x11')]){if(_0x451bc6[_0x085f('0x11')]['code']===0x1f4){logger[_0x085f('0x11')](_0x085f('0x12'),_0x53e358,_0x451bc6[_0x085f('0x11')][_0x085f('0x13')]);return _0x369d3c(_0x451bc6[_0x085f('0x11')][_0x085f('0x13')]);}logger[_0x085f('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x53e358,_0x451bc6[_0x085f('0x11')][_0x085f('0x13')]);return _0x23ea92(_0x451bc6['error'][_0x085f('0x13')]);}else{logger[_0x085f('0x14')](_0x085f('0x12'),_0x53e358,_0x085f('0xe'));_0x23ea92(_0x451bc6[_0x085f('0x15')][_0x085f('0x13')]);}})['catch'](function(_0x7f73f8){logger[_0x085f('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x53e358,_0x7f73f8);_0x369d3c(_0x7f73f8);});});} \ No newline at end of file +var _0x4d77=['stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x4d77,0x1e9));var _0x74d7=function(_0x323fd6,_0x23231a){_0x323fd6=_0x323fd6-0x0;var _0x2df4e2=_0x4d77[_0x323fd6];return _0x2df4e2;};'use strict';var _=require(_0x74d7('0x0'));var util=require(_0x74d7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x74d7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74d7('0x3'))['db'];var utils=require(_0x74d7('0x4'));var logger=require(_0x74d7('0x5'))(_0x74d7('0x6'));var config=require(_0x74d7('0x7'));var jayson=require(_0x74d7('0x8'));var client=jayson[_0x74d7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x257de2,_0x57bf6c,_0x5a0710){return new BPromise(function(_0x3b0cd8,_0x589b10){return client['request'](_0x257de2,_0x5a0710)[_0x74d7('0xa')](function(_0x2ce486){logger[_0x74d7('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x57bf6c,'request\x20sent');logger[_0x74d7('0xc')](_0x74d7('0xd'),_0x57bf6c,_0x74d7('0xe'),JSON[_0x74d7('0xf')](_0x2ce486));if(_0x2ce486[_0x74d7('0x10')]){if(_0x2ce486[_0x74d7('0x10')][_0x74d7('0x11')]===0x1f4){logger[_0x74d7('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x57bf6c,_0x2ce486[_0x74d7('0x10')][_0x74d7('0x12')]);return _0x589b10(_0x2ce486['error'][_0x74d7('0x12')]);}logger[_0x74d7('0x10')](_0x74d7('0x13'),_0x57bf6c,_0x2ce486[_0x74d7('0x10')]['message']);return _0x3b0cd8(_0x2ce486[_0x74d7('0x10')][_0x74d7('0x12')]);}else{logger[_0x74d7('0xb')](_0x74d7('0x13'),_0x57bf6c,_0x74d7('0xe'));_0x3b0cd8(_0x2ce486['result'][_0x74d7('0x12')]);}})[_0x74d7('0x14')](function(_0x87a5b3){logger[_0x74d7('0x10')](_0x74d7('0x13'),_0x57bf6c,_0x87a5b3);_0x589b10(_0x87a5b3);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 96dde1a..721cf2e 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 _0x6296=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x26bb56,_0x5de187){var _0x5688e4=function(_0x1a2f74){while(--_0x1a2f74){_0x26bb56['push'](_0x26bb56['shift']());}};_0x5688e4(++_0x5de187);}(_0x6296,0x169));var _0x6629=function(_0x45fad3,_0x35058){_0x45fad3=_0x45fad3-0x0;var _0x5a9e3f=_0x6296[_0x45fad3];return _0x5a9e3f;};'use strict';var multer=require(_0x6629('0x0'));var util=require('util');var path=require(_0x6629('0x1'));var timeout=require(_0x6629('0x2'));var express=require(_0x6629('0x3'));var router=express[_0x6629('0x4')]();var auth=require(_0x6629('0x5'));var interaction=require(_0x6629('0x6'));var config=require(_0x6629('0x7'));module[_0x6629('0x8')]=router; \ No newline at end of file +var _0x1021=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x54fc23,_0x13657e){var _0x1948e5=function(_0x3c3c69){while(--_0x3c3c69){_0x54fc23['push'](_0x54fc23['shift']());}};_0x1948e5(++_0x13657e);}(_0x1021,0x124));var _0x1102=function(_0x1e0d89,_0x4e0482){_0x1e0d89=_0x1e0d89-0x0;var _0x140d15=_0x1021[_0x1e0d89];return _0x140d15;};'use strict';var multer=require(_0x1102('0x0'));var util=require(_0x1102('0x1'));var path=require(_0x1102('0x2'));var timeout=require(_0x1102('0x3'));var express=require(_0x1102('0x4'));var router=express[_0x1102('0x5')]();var auth=require(_0x1102('0x6'));var interaction=require(_0x1102('0x7'));var config=require(_0x1102('0x8'));module[_0x1102('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 507b163..385f93a 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 _0x93e9=['sequelize','exports','INTEGER','STRING'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x93e9,0xcc));var _0x993e=function(_0x5bb3f8,_0x5f3bcb){_0x5bb3f8=_0x5bb3f8-0x0;var _0x332911=_0x93e9[_0x5bb3f8];return _0x332911;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'penalty':{'type':Sequelize[_0x993e('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x993e('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x993e('0x3')]}}; \ No newline at end of file +var _0xefda=['sequelize','INTEGER','STRING'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xefda,0x96));var _0xaefd=function(_0x54fc91,_0x30f519){_0x54fc91=_0x54fc91-0x0;var _0x1a0c37=_0xefda[_0x54fc91];return _0x1a0c37;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaefd('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xaefd('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 3ea5729..f962edd 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 _0x5f2f=['bluebird','request-promise','path','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','api','moment'];(function(_0x36e7c0,_0x1e143d){var _0x1ba956=function(_0x143ea0){while(--_0x143ea0){_0x36e7c0['push'](_0x36e7c0['shift']());}};_0x1ba956(++_0x1e143d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x565154,_0x189d5e){_0x565154=_0x565154-0x0;var _0x593821=_0x5f2f[_0x565154];return _0x593821;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0xb10b,0x12a));var _0xbb10=function(_0x2199f1,_0x10c734){_0x2199f1=_0x2199f1-0x0;var _0x43436b=_0xb10b[_0x2199f1];return _0x43436b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 21f1361..5e31d56 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 _0x9370=['error','code','UserFaxQueue,\x20%s,\x20%s','message','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x138745,_0x2bfc09){var _0x5c2d89=function(_0x2cbd5a){while(--_0x2cbd5a){_0x138745['push'](_0x138745['shift']());}};_0x5c2d89(++_0x2bfc09);}(_0x9370,0x158));var _0x0937=function(_0x29316e,_0x581de7){_0x29316e=_0x29316e-0x0;var _0xa7edf3=_0x9370[_0x29316e];return _0xa7edf3;};'use strict';var _=require('lodash');var util=require(_0x0937('0x0'));var moment=require('moment');var BPromise=require(_0x0937('0x1'));var rs=require(_0x0937('0x2'));var fs=require('fs');var Redis=require(_0x0937('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0937('0x4'));var logger=require(_0x0937('0x5'))(_0x0937('0x6'));var config=require(_0x0937('0x7'));var jayson=require(_0x0937('0x8'));var client=jayson[_0x0937('0x9')][_0x0937('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2102b4,_0x2b1766,_0x238cb0){return new BPromise(function(_0xa2eec9,_0xc03188){return client[_0x0937('0xb')](_0x2102b4,_0x238cb0)[_0x0937('0xc')](function(_0x311e7c){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x2b1766,_0x0937('0xd'));logger['debug'](_0x0937('0xe'),_0x2b1766,_0x0937('0xd'),JSON[_0x0937('0xf')](_0x311e7c));if(_0x311e7c[_0x0937('0x10')]){if(_0x311e7c[_0x0937('0x10')][_0x0937('0x11')]===0x1f4){logger[_0x0937('0x10')](_0x0937('0x12'),_0x2b1766,_0x311e7c['error']['message']);return _0xc03188(_0x311e7c[_0x0937('0x10')]['message']);}logger[_0x0937('0x10')](_0x0937('0x12'),_0x2b1766,_0x311e7c[_0x0937('0x10')][_0x0937('0x13')]);return _0xa2eec9(_0x311e7c['error'][_0x0937('0x13')]);}else{logger['info'](_0x0937('0x12'),_0x2b1766,_0x0937('0xd'));_0xa2eec9(_0x311e7c['result']['message']);}})['catch'](function(_0x4dfcd6){logger['error'](_0x0937('0x12'),_0x2b1766,_0x4dfcd6);_0xc03188(_0x4dfcd6);});});} \ No newline at end of file +var _0x8807=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0x35de68,_0x165ef8){var _0xf70815=function(_0x731b8e){while(--_0x731b8e){_0x35de68['push'](_0x35de68['shift']());}};_0xf70815(++_0x165ef8);}(_0x8807,0xac));var _0x7880=function(_0x1c0a25,_0x227201){_0x1c0a25=_0x1c0a25-0x0;var _0x4ddd7e=_0x8807[_0x1c0a25];return _0x4ddd7e;};'use strict';var _=require('lodash');var util=require(_0x7880('0x0'));var moment=require(_0x7880('0x1'));var BPromise=require(_0x7880('0x2'));var rs=require(_0x7880('0x3'));var fs=require('fs');var Redis=require(_0x7880('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7880('0x5'));var logger=require('../../config/logger')(_0x7880('0x6'));var config=require(_0x7880('0x7'));var jayson=require(_0x7880('0x8'));var client=jayson[_0x7880('0x9')][_0x7880('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20a358,_0x1c5da6,_0x5dd3d4){return new BPromise(function(_0x483193,_0x3b7fd6){return client['request'](_0x20a358,_0x5dd3d4)['then'](function(_0x40f3ed){logger['info'](_0x7880('0xb'),_0x1c5da6,_0x7880('0xc'));logger[_0x7880('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1c5da6,_0x7880('0xc'),JSON[_0x7880('0xe')](_0x40f3ed));if(_0x40f3ed[_0x7880('0xf')]){if(_0x40f3ed[_0x7880('0xf')]['code']===0x1f4){logger[_0x7880('0xf')](_0x7880('0xb'),_0x1c5da6,_0x40f3ed[_0x7880('0xf')]['message']);return _0x3b7fd6(_0x40f3ed[_0x7880('0xf')][_0x7880('0x10')]);}logger[_0x7880('0xf')](_0x7880('0xb'),_0x1c5da6,_0x40f3ed['error'][_0x7880('0x10')]);return _0x483193(_0x40f3ed[_0x7880('0xf')]['message']);}else{logger[_0x7880('0x11')](_0x7880('0xb'),_0x1c5da6,_0x7880('0xc'));_0x483193(_0x40f3ed['result'][_0x7880('0x10')]);}})[_0x7880('0x12')](function(_0x35b044){logger[_0x7880('0xf')](_0x7880('0xb'),_0x1c5da6,_0x35b044);_0x3b7fd6(_0x35b044);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 86c434c..ee0905d 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 _0xd680=['exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x1bdc52,_0x4876a9){var _0xdf3fa3=function(_0x2a3ba4){while(--_0x2a3ba4){_0x1bdc52['push'](_0x1bdc52['shift']());}};_0xdf3fa3(++_0x4876a9);}(_0xd680,0xaf));var _0x0d68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd680[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0d68('0x0'));var util=require('util');var path=require(_0x0d68('0x1'));var timeout=require(_0x0d68('0x2'));var express=require(_0x0d68('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0d68('0x4'));var config=require('../../config/environment');module[_0x0d68('0x5')]=router; \ No newline at end of file +var _0xc727=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xc727,0x16c));var _0x7c72=function(_0x236174,_0x202c44){_0x236174=_0x236174-0x0;var _0x465a51=_0xc727[_0x236174];return _0x465a51;};'use strict';var multer=require(_0x7c72('0x0'));var util=require(_0x7c72('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7c72('0x2'));var router=express[_0x7c72('0x3')]();var auth=require(_0x7c72('0x4'));var interaction=require(_0x7c72('0x5'));var config=require(_0x7c72('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index e7b2e08..91d7f4f 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x5bb1fa,_0x4989aa){var _0xba07d=function(_0x1576f0){while(--_0x1576f0){_0x5bb1fa['push'](_0x5bb1fa['shift']());}};_0xba07d(++_0x4989aa);}(_0xe706,0xa3));var _0x6e70=function(_0x5172a3,_0x1a1e39){_0x5172a3=_0x5172a3-0x0;var _0x50c69b=_0xe706[_0x5172a3];return _0x50c69b;};'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(_0x1e0ca5,_0x57fd4f){var _0x410923=function(_0x5bd94d){while(--_0x5bd94d){_0x1e0ca5['push'](_0x1e0ca5['shift']());}};_0x410923(++_0x57fd4f);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 650d914..7297f8d 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x22a092,_0x186476){var _0x1103c4=function(_0x3a459e){while(--_0x3a459e){_0x22a092['push'](_0x22a092['shift']());}};_0x1103c4(++_0x186476);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x320227,_0x2a6dca){var _0x39be31=function(_0x25aae9){while(--_0x25aae9){_0x320227['push'](_0x320227['shift']());}};_0x39be31(++_0x2a6dca);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 5cff5a7..187e0b5 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 _0x565f=['error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x34572e,_0x570e0a){var _0x267176=function(_0x3a9c46){while(--_0x3a9c46){_0x34572e['push'](_0x34572e['shift']());}};_0x267176(++_0x570e0a);}(_0x565f,0x68));var _0xf565=function(_0x5ca734,_0x41b241){_0x5ca734=_0x5ca734-0x0;var _0x473116=_0x565f[_0x5ca734];return _0x473116;};'use strict';var _=require('lodash');var util=require(_0xf565('0x0'));var moment=require(_0xf565('0x1'));var BPromise=require(_0xf565('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf565('0x3'));var db=require(_0xf565('0x4'))['db'];var utils=require(_0xf565('0x5'));var logger=require(_0xf565('0x6'))(_0xf565('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf565('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cc0ea,_0x2d3b27,_0x45db1b){return new BPromise(function(_0x43b686,_0x55685c){return client[_0xf565('0x9')](_0x4cc0ea,_0x45db1b)['then'](function(_0x35377e){logger['info'](_0xf565('0xa'),_0x2d3b27,_0xf565('0xb'));logger[_0xf565('0xc')](_0xf565('0xd'),_0x2d3b27,_0xf565('0xb'),JSON[_0xf565('0xe')](_0x35377e));if(_0x35377e['error']){if(_0x35377e['error'][_0xf565('0xf')]===0x1f4){logger[_0xf565('0x10')](_0xf565('0xa'),_0x2d3b27,_0x35377e[_0xf565('0x10')][_0xf565('0x11')]);return _0x55685c(_0x35377e[_0xf565('0x10')][_0xf565('0x11')]);}logger[_0xf565('0x10')](_0xf565('0xa'),_0x2d3b27,_0x35377e[_0xf565('0x10')]['message']);return _0x43b686(_0x35377e[_0xf565('0x10')][_0xf565('0x11')]);}else{logger['info'](_0xf565('0xa'),_0x2d3b27,_0xf565('0xb'));_0x43b686(_0x35377e[_0xf565('0x12')][_0xf565('0x11')]);}})[_0xf565('0x13')](function(_0x509ff4){logger[_0xf565('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x2d3b27,_0x509ff4);_0x55685c(_0x509ff4);});});} \ No newline at end of file +var _0x9a96=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a96,0xd0));var _0x69a9=function(_0x22af50,_0x321323){_0x22af50=_0x22af50-0x0;var _0x1f81ee=_0x9a96[_0x22af50];return _0x1f81ee;};'use strict';var _=require(_0x69a9('0x0'));var util=require(_0x69a9('0x1'));var moment=require(_0x69a9('0x2'));var BPromise=require(_0x69a9('0x3'));var rs=require(_0x69a9('0x4'));var fs=require('fs');var Redis=require(_0x69a9('0x5'));var db=require(_0x69a9('0x6'))['db'];var utils=require(_0x69a9('0x7'));var logger=require(_0x69a9('0x8'))(_0x69a9('0x9'));var config=require(_0x69a9('0xa'));var jayson=require(_0x69a9('0xb'));var client=jayson['client'][_0x69a9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x260fd3,_0xca335e,_0x2306b8){return new BPromise(function(_0x49125f,_0x371fd0){return client[_0x69a9('0xd')](_0x260fd3,_0x2306b8)[_0x69a9('0xe')](function(_0x2587ef){logger[_0x69a9('0xf')](_0x69a9('0x10'),_0xca335e,_0x69a9('0x11'));logger['debug'](_0x69a9('0x12'),_0xca335e,'request\x20sent',JSON[_0x69a9('0x13')](_0x2587ef));if(_0x2587ef[_0x69a9('0x14')]){if(_0x2587ef[_0x69a9('0x14')]['code']===0x1f4){logger[_0x69a9('0x14')](_0x69a9('0x10'),_0xca335e,_0x2587ef[_0x69a9('0x14')][_0x69a9('0x15')]);return _0x371fd0(_0x2587ef[_0x69a9('0x14')][_0x69a9('0x15')]);}logger[_0x69a9('0x14')](_0x69a9('0x10'),_0xca335e,_0x2587ef['error'][_0x69a9('0x15')]);return _0x49125f(_0x2587ef[_0x69a9('0x14')][_0x69a9('0x15')]);}else{logger[_0x69a9('0xf')](_0x69a9('0x10'),_0xca335e,_0x69a9('0x11'));_0x49125f(_0x2587ef['result']['message']);}})[_0x69a9('0x16')](function(_0x2061e4){logger[_0x69a9('0x14')]('UserMailQueue,\x20%s,\x20%s',_0xca335e,_0x2061e4);_0x371fd0(_0x2061e4);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 544ff7c..c852616 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 _0x0a6f=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x5da324,_0x554ea8){var _0x3daef3=function(_0x4e3488){while(--_0x4e3488){_0x5da324['push'](_0x5da324['shift']());}};_0x3daef3(++_0x554ea8);}(_0x0a6f,0xea));var _0xf0a6=function(_0x4beb7a,_0x246983){_0x4beb7a=_0x4beb7a-0x0;var _0x50c7dd=_0x0a6f[_0x4beb7a];return _0x50c7dd;};'use strict';var multer=require('multer');var util=require(_0xf0a6('0x0'));var path=require(_0xf0a6('0x1'));var timeout=require(_0xf0a6('0x2'));var express=require(_0xf0a6('0x3'));var router=express[_0xf0a6('0x4')]();var auth=require(_0xf0a6('0x5'));var interaction=require(_0xf0a6('0x6'));var config=require(_0xf0a6('0x7'));module[_0xf0a6('0x8')]=router; \ No newline at end of file +var _0xe535=['../../config/environment','multer','util','path','Router','../../components/auth/service'];(function(_0x183dc1,_0x12b97c){var _0x551e45=function(_0x5a2fb4){while(--_0x5a2fb4){_0x183dc1['push'](_0x183dc1['shift']());}};_0x551e45(++_0x12b97c);}(_0xe535,0x109));var _0x5e53=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xe535[_0x3de8a4];return _0x4635cf;};'use strict';var multer=require(_0x5e53('0x0'));var util=require(_0x5e53('0x1'));var path=require(_0x5e53('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e53('0x3')]();var auth=require(_0x5e53('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5e53('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e5dd54d..fa93ebc 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 _0xbaf0=['exports','INTEGER'];(function(_0x28fbbf,_0x11f896){var _0x543af6=function(_0x27fa74){while(--_0x27fa74){_0x28fbbf['push'](_0x28fbbf['shift']());}};_0x543af6(++_0x11f896);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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(_0x2a7210,_0x2f3d23){var _0x460766=function(_0xd575dd){while(--_0xd575dd){_0x2a7210['push'](_0x2a7210['shift']());}};_0x460766(++_0x2f3d23);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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 eefd1f5..9a1f1b8 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 _0x673f=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserOpenchannelQueue','util'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x673f,0x77));var _0xf673=function(_0x2a8079,_0x1ebafd){_0x2a8079=_0x2a8079-0x0;var _0x25e337=_0x673f[_0x2a8079];return _0x25e337;};'use strict';var _=require('lodash');var util=require(_0xf673('0x0'));var logger=require('../../config/logger')(_0xf673('0x1'));var moment=require(_0xf673('0x2'));var BPromise=require(_0xf673('0x3'));var rp=require(_0xf673('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf673('0x5'));var config=require(_0xf673('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xf673('0x7')]=function(_0x3fd386,_0x4020de){return _0x3fd386[_0xf673('0x8')](_0xf673('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4783=['./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x348472,_0x133d9d){var _0x55251e=function(_0x416d17){while(--_0x416d17){_0x348472['push'](_0x348472['shift']());}};_0x55251e(++_0x133d9d);}(_0x4783,0xd0));var _0x3478=function(_0x2d28b1,_0x1fa19c){_0x2d28b1=_0x2d28b1-0x0;var _0xf1657c=_0x4783[_0x2d28b1];return _0xf1657c;};'use strict';var _=require(_0x3478('0x0'));var util=require('util');var logger=require(_0x3478('0x1'))(_0x3478('0x2'));var moment=require(_0x3478('0x3'));var BPromise=require(_0x3478('0x4'));var rp=require(_0x3478('0x5'));var fs=require('fs');var path=require(_0x3478('0x6'));var rimraf=require(_0x3478('0x7'));var config=require('../../config/environment');var attributes=require(_0x3478('0x8'));module[_0x3478('0x9')]=function(_0x5a5301,_0x72ad4a){return _0x5a5301[_0x3478('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0x3478('0xb'),'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 5ccc9cd..6617712 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 _0x3438=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3438,0x76));var _0x8343=function(_0x2c6065,_0x45c931){_0x2c6065=_0x2c6065-0x0;var _0x2e17e0=_0x3438[_0x2c6065];return _0x2e17e0;};'use strict';var _=require(_0x8343('0x0'));var util=require(_0x8343('0x1'));var moment=require(_0x8343('0x2'));var BPromise=require(_0x8343('0x3'));var rs=require(_0x8343('0x4'));var fs=require('fs');var Redis=require(_0x8343('0x5'));var db=require(_0x8343('0x6'))['db'];var utils=require(_0x8343('0x7'));var logger=require(_0x8343('0x8'))('rpc');var config=require(_0x8343('0x9'));var jayson=require(_0x8343('0xa'));var client=jayson[_0x8343('0xb')][_0x8343('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54d201,_0x3778ce,_0x1a908f){return new BPromise(function(_0x4107a4,_0x2053f5){return client[_0x8343('0xd')](_0x54d201,_0x1a908f)[_0x8343('0xe')](function(_0x4e47be){logger[_0x8343('0xf')](_0x8343('0x10'),_0x3778ce,_0x8343('0x11'));logger['debug'](_0x8343('0x12'),_0x3778ce,_0x8343('0x11'),JSON[_0x8343('0x13')](_0x4e47be));if(_0x4e47be[_0x8343('0x14')]){if(_0x4e47be['error'][_0x8343('0x15')]===0x1f4){logger['error'](_0x8343('0x10'),_0x3778ce,_0x4e47be[_0x8343('0x14')][_0x8343('0x16')]);return _0x2053f5(_0x4e47be['error'][_0x8343('0x16')]);}logger[_0x8343('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3778ce,_0x4e47be[_0x8343('0x14')][_0x8343('0x16')]);return _0x4107a4(_0x4e47be[_0x8343('0x14')]['message']);}else{logger[_0x8343('0xf')](_0x8343('0x10'),_0x3778ce,'request\x20sent');_0x4107a4(_0x4e47be[_0x8343('0x17')][_0x8343('0x16')]);}})[_0x8343('0x18')](function(_0x40de1d){logger[_0x8343('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3778ce,_0x40de1d);_0x2053f5(_0x40de1d);});});} \ No newline at end of file +var _0x164b=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0x164b,0x12d));var _0xb164=function(_0x2bb0fa,_0x2b3066){_0x2bb0fa=_0x2bb0fa-0x0;var _0x469f7b=_0x164b[_0x2bb0fa];return _0x469f7b;};'use strict';var _=require(_0xb164('0x0'));var util=require(_0xb164('0x1'));var moment=require(_0xb164('0x2'));var BPromise=require(_0xb164('0x3'));var rs=require(_0xb164('0x4'));var fs=require('fs');var Redis=require(_0xb164('0x5'));var db=require(_0xb164('0x6'))['db'];var utils=require(_0xb164('0x7'));var logger=require(_0xb164('0x8'))('rpc');var config=require(_0xb164('0x9'));var jayson=require(_0xb164('0xa'));var client=jayson[_0xb164('0xb')][_0xb164('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x540f36,_0x3c46e9,_0x5973c6){return new BPromise(function(_0x160e53,_0x1ce4b8){return client[_0xb164('0xd')](_0x540f36,_0x5973c6)[_0xb164('0xe')](function(_0x458acf){logger['info'](_0xb164('0xf'),_0x3c46e9,'request\x20sent');logger[_0xb164('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3c46e9,_0xb164('0x11'),JSON['stringify'](_0x458acf));if(_0x458acf[_0xb164('0x12')]){if(_0x458acf[_0xb164('0x12')][_0xb164('0x13')]===0x1f4){logger['error'](_0xb164('0xf'),_0x3c46e9,_0x458acf[_0xb164('0x12')][_0xb164('0x14')]);return _0x1ce4b8(_0x458acf[_0xb164('0x12')][_0xb164('0x14')]);}logger['error'](_0xb164('0xf'),_0x3c46e9,_0x458acf[_0xb164('0x12')][_0xb164('0x14')]);return _0x160e53(_0x458acf[_0xb164('0x12')][_0xb164('0x14')]);}else{logger['info'](_0xb164('0xf'),_0x3c46e9,_0xb164('0x11'));_0x160e53(_0x458acf[_0xb164('0x15')]['message']);}})['catch'](function(_0x1d62ef){logger[_0xb164('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3c46e9,_0x1d62ef);_0x1ce4b8(_0x1d62ef);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 74bff3d..7880332 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 _0xfe23=['update','delete','destroy','removeSections','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','isAuthenticated','describe','/:id/sections','getSections','/:id/resources','getResources','create','/:id/clone','post','addResources','/:id'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xfe23,0x19a));var _0x3fe2=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xfe23[_0x33032e];return _0x13316b;};'use strict';var multer=require('multer');var util=require(_0x3fe2('0x0'));var path=require(_0x3fe2('0x1'));var timeout=require(_0x3fe2('0x2'));var express=require(_0x3fe2('0x3'));var router=express[_0x3fe2('0x4')]();var auth=require(_0x3fe2('0x5'));var interaction=require(_0x3fe2('0x6'));var config=require(_0x3fe2('0x7'));var controller=require(_0x3fe2('0x8'));router[_0x3fe2('0x9')]('/',auth['isAuthenticated'](),controller[_0x3fe2('0xa')]);router[_0x3fe2('0x9')]('/describe',auth[_0x3fe2('0xb')](),controller[_0x3fe2('0xc')]);router[_0x3fe2('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3fe2('0x9')](_0x3fe2('0xd'),auth['isAuthenticated'](),controller[_0x3fe2('0xe')]);router[_0x3fe2('0x9')](_0x3fe2('0xf'),auth[_0x3fe2('0xb')](),controller[_0x3fe2('0x10')]);router['post']('/',auth[_0x3fe2('0xb')](),controller[_0x3fe2('0x11')]);router['post'](_0x3fe2('0x12'),auth['isAuthenticated'](),controller['clone']);router['post']('/:id/sections',auth[_0x3fe2('0xb')](),controller['addSections']);router[_0x3fe2('0x13')](_0x3fe2('0xf'),auth[_0x3fe2('0xb')](),controller[_0x3fe2('0x14')]);router['put'](_0x3fe2('0x15'),auth[_0x3fe2('0xb')](),controller[_0x3fe2('0x16')]);router[_0x3fe2('0x17')]('/:id',auth[_0x3fe2('0xb')](),controller[_0x3fe2('0x18')]);router['delete'](_0x3fe2('0xd'),auth['isAuthenticated'](),controller[_0x3fe2('0x19')]);router[_0x3fe2('0x17')](_0x3fe2('0xf'),auth['isAuthenticated'](),controller['removeResources']);module[_0x3fe2('0x1a')]=router; \ No newline at end of file +var _0x783b=['clone','addSections','delete','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone'];(function(_0x5b2728,_0x27c28a){var _0x505960=function(_0x1460db){while(--_0x1460db){_0x5b2728['push'](_0x5b2728['shift']());}};_0x505960(++_0x27c28a);}(_0x783b,0xab));var _0xb783=function(_0x417dcb,_0x2c71da){_0x417dcb=_0x417dcb-0x0;var _0x27cbca=_0x783b[_0x417dcb];return _0x27cbca;};'use strict';var multer=require(_0xb783('0x0'));var util=require(_0xb783('0x1'));var path=require(_0xb783('0x2'));var timeout=require(_0xb783('0x3'));var express=require('express');var router=express[_0xb783('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb783('0x5'));var config=require(_0xb783('0x6'));var controller=require(_0xb783('0x7'));router[_0xb783('0x8')]('/',auth['isAuthenticated'](),controller[_0xb783('0x9')]);router[_0xb783('0x8')](_0xb783('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xb783('0x8')](_0xb783('0xb'),auth[_0xb783('0xc')](),controller[_0xb783('0xd')]);router['get'](_0xb783('0xe'),auth[_0xb783('0xc')](),controller[_0xb783('0xf')]);router[_0xb783('0x8')](_0xb783('0x10'),auth[_0xb783('0xc')](),controller[_0xb783('0x11')]);router[_0xb783('0x12')]('/',auth['isAuthenticated'](),controller[_0xb783('0x13')]);router[_0xb783('0x12')](_0xb783('0x14'),auth[_0xb783('0xc')](),controller[_0xb783('0x15')]);router[_0xb783('0x12')](_0xb783('0xe'),auth[_0xb783('0xc')](),controller[_0xb783('0x16')]);router[_0xb783('0x12')]('/:id/resources',auth[_0xb783('0xc')](),controller['addResources']);router['put'](_0xb783('0xb'),auth[_0xb783('0xc')](),controller['update']);router[_0xb783('0x17')]('/:id',auth[_0xb783('0xc')](),controller['destroy']);router[_0xb783('0x17')](_0xb783('0xe'),auth[_0xb783('0xc')](),controller['removeSections']);router[_0xb783('0x17')]('/:id/resources',auth[_0xb783('0xc')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 076c257..67a5bdb 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 _0xfde3=['exports','STRING','name','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x103cd1,_0x51ea6b){var _0x3e3bfc=function(_0x381bd6){while(--_0x381bd6){_0x103cd1['push'](_0x103cd1['shift']());}};_0x3e3bfc(++_0x51ea6b);}(_0xfde3,0x19f));var _0x3fde=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfde3[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x3fde('0x0'));module[_0x3fde('0x1')]={'name':{'type':Sequelize[_0x3fde('0x2')],'allowNull':![],'unique':_0x3fde('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1a82bc){this[_0x3fde('0x4')](_0x3fde('0x5'),_0x1a82bc?_0x1a82bc['join'](''):[]);},'get':function(){return this[_0x3fde('0x6')]('crudPermissions')?this['getDataValue'](_0x3fde('0x5'))[_0x3fde('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x809a=['sequelize','exports','STRING','name','crudPermissions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x809a,0x186));var _0xa809=function(_0x30f98c,_0x11a7f3){_0x30f98c=_0x30f98c-0x0;var _0x2fc8b0=_0x809a[_0x30f98c];return _0x2fc8b0;};'use strict';var Sequelize=require(_0xa809('0x0'));module[_0xa809('0x1')]={'name':{'type':Sequelize[_0xa809('0x2')],'allowNull':![],'unique':_0xa809('0x3')},'crudPermissions':{'type':Sequelize[_0xa809('0x2')],'set':function(_0x4a33df){this['setDataValue']('crudPermissions',_0x4a33df?_0x4a33df['join'](''):[]);},'get':function(){return this['getDataValue'](_0xa809('0x4'))?this['getDataValue'](_0xa809('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa809('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 0a2b8c6..d72bdc0 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 _0xcb1f=['CustomReports','rows','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','Lists','ListId','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','User','telephone','VoiceQueues','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','QueueCampaigns','telephones','Users','admin','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','intervals','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Template','triggers','Trigger','Trunk','variables','plugins','extractedreports','Reports','AnalyticMetric','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','clone','find','get','omit','updatedAt','crudPermissions','body','createdAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','addSections','removeSections','ids','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','undefined','Sequelize','mergeResources','ValidationError','parentSections','all','ignore','childModel','order','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcb1f,0x6e));var _0xfcb1=function(_0x3628cd,_0x48ebb6){_0x3628cd=_0x3628cd-0x0;var _0x3fbade=_0xcb1f[_0x3628cd];return _0x3fbade;};'use strict';var pdf=require(_0xfcb1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfcb1('0x1'));var zipdir=require(_0xfcb1('0x2'));var jsonpatch=require(_0xfcb1('0x3'));var rp=require(_0xfcb1('0x4'));var moment=require('moment');var BPromise=require(_0xfcb1('0x5'));var Mustache=require(_0xfcb1('0x6'));var util=require('util');var path=require(_0xfcb1('0x7'));var sox=require(_0xfcb1('0x8'));var csv=require(_0xfcb1('0x9'));var ejs=require(_0xfcb1('0xa'));var fs=require('fs');var _=require(_0xfcb1('0xb'));var squel=require(_0xfcb1('0xc'));var crypto=require(_0xfcb1('0xd'));var jsforce=require(_0xfcb1('0xe'));var deskjs=require(_0xfcb1('0xf'));var toCsv=require(_0xfcb1('0x9'));var querystring=require('querystring');var Papa=require(_0xfcb1('0x10'));var Redis=require(_0xfcb1('0x11'));var authService=require(_0xfcb1('0x12'));var qs=require(_0xfcb1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcb1('0x14'))(_0xfcb1('0x15'));var utils=require(_0xfcb1('0x16'));var config=require('../../config/environment');var db=require(_0xfcb1('0x17'))['db'];config[_0xfcb1('0x18')]=_['defaults'](config[_0xfcb1('0x18')],{'host':_0xfcb1('0x19'),'port':0x18eb});var socket=require(_0xfcb1('0x1a'))(new Redis(config[_0xfcb1('0x18')]));require(_0xfcb1('0x1b'))[_0xfcb1('0x1c')](socket);function respondWithStatusCode(_0x31fec6,_0x31081a){_0x31081a=_0x31081a||0xcc;return function(_0x4be5b3){if(_0x4be5b3){return _0x31fec6[_0xfcb1('0x1d')](_0x31081a);}return _0x31fec6[_0xfcb1('0x1e')](_0x31081a)['end']();};}function respondWithResult(_0x44475d,_0x32a9e1){_0x32a9e1=_0x32a9e1||0xc8;return function(_0x1c6048){if(_0x1c6048){return _0x44475d[_0xfcb1('0x1e')](_0x32a9e1)[_0xfcb1('0x1f')](_0x1c6048);}};}function respondWithFilteredResult(_0x2eece8,_0x472dd2){return function(_0x1d6f3b){if(_0x1d6f3b){var _0x41980a=_0x1d6f3b[_0xfcb1('0x20')],_0xd6c879=_0x472dd2['offset'],_0x1067d7=_0x472dd2['offset']+_0x472dd2['limit'],_0xf06059;if(_0x1067d7>=_0x41980a){_0x1067d7=_0x41980a;_0xf06059=0xc8;}else{_0xf06059=0xce;}_0x2eece8['status'](_0xf06059);return _0x2eece8[_0xfcb1('0x21')]('Content-Range',_0xd6c879+'-'+_0x1067d7+'/'+_0x41980a)[_0xfcb1('0x1f')](_0x1d6f3b);}return null;};}function patchUpdates(_0xcd42bf){return function(_0x518c29){try{jsonpatch[_0xfcb1('0x22')](_0x518c29,_0xcd42bf,!![]);}catch(_0x432388){return BPromise[_0xfcb1('0x23')](_0x432388);}return _0x518c29[_0xfcb1('0x24')]();};}function saveUpdates(_0x1753ab,_0x1c552c){return function(_0x15efc1){if(_0x15efc1){return _0x15efc1[_0xfcb1('0x25')](_0x1753ab)[_0xfcb1('0x26')](function(_0x4b862e){return _0x4b862e;});}return null;};}function removeEntity(_0x1e4327,_0x441beb){return function(_0x200656){if(_0x200656){return _0x200656[_0xfcb1('0x27')]()[_0xfcb1('0x26')](function(){_0x1e4327[_0xfcb1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ccf6f,_0x3590ad){return function(_0x1e706b){if(!_0x1e706b){_0x2ccf6f['sendStatus'](0x194);}return _0x1e706b;};}function handleError(_0x48bd8b,_0x1d2805){_0x1d2805=_0x1d2805||0x1f4;return function(_0xb4c5c3){logger[_0xfcb1('0x28')](_0xb4c5c3[_0xfcb1('0x29')]);if(_0xb4c5c3['name']){delete _0xb4c5c3[_0xfcb1('0x2a')];}_0x48bd8b[_0xfcb1('0x1e')](_0x1d2805)[_0xfcb1('0x2b')](_0xb4c5c3);};}exports[_0xfcb1('0x2c')]=function(_0x23d2e8,_0x4a0157){var _0x540e8a={},_0x57f795={},_0x3c095c={'count':0x0,'rows':[]};var _0x27dd5f=_['map'](db[_0xfcb1('0x2d')][_0xfcb1('0x2e')],function(_0x6f6e83){return{'name':_0x6f6e83[_0xfcb1('0x2f')],'type':_0x6f6e83[_0xfcb1('0x30')][_0xfcb1('0x31')]};});_0x57f795[_0xfcb1('0x32')]=_[_0xfcb1('0x33')](_0x27dd5f,_0xfcb1('0x2a'));_0x57f795['query']=_[_0xfcb1('0x34')](_0x23d2e8['query']);_0x57f795['filters']=_[_0xfcb1('0x35')](_0x57f795[_0xfcb1('0x32')],_0x57f795[_0xfcb1('0x36')]);_0x540e8a[_0xfcb1('0x37')]=_['intersection'](_0x57f795[_0xfcb1('0x32')],qs[_0xfcb1('0x38')](_0x23d2e8[_0xfcb1('0x36')][_0xfcb1('0x38')]));_0x540e8a[_0xfcb1('0x37')]=_0x540e8a[_0xfcb1('0x37')][_0xfcb1('0x39')]?_0x540e8a['attributes']:_0x57f795[_0xfcb1('0x32')];if(!_0x23d2e8[_0xfcb1('0x36')][_0xfcb1('0x3a')](_0xfcb1('0x3b'))){_0x540e8a[_0xfcb1('0x3c')]=qs[_0xfcb1('0x3c')](_0x23d2e8[_0xfcb1('0x36')][_0xfcb1('0x3c')]);_0x540e8a[_0xfcb1('0x3d')]=qs[_0xfcb1('0x3d')](_0x23d2e8['query'][_0xfcb1('0x3d')]);}_0x540e8a['order']=qs[_0xfcb1('0x3e')](_0x23d2e8[_0xfcb1('0x36')][_0xfcb1('0x3e')]);_0x540e8a[_0xfcb1('0x3f')]=qs[_0xfcb1('0x40')](_[_0xfcb1('0x41')](_0x23d2e8['query'],_0x57f795['filters']),_0x27dd5f);if(_0x23d2e8[_0xfcb1('0x36')][_0xfcb1('0x42')]){_0x540e8a[_0xfcb1('0x3f')]=_[_0xfcb1('0x43')](_0x540e8a[_0xfcb1('0x3f')],{'$or':_[_0xfcb1('0x33')](_0x27dd5f,function(_0x5c3fde){if(_0x5c3fde[_0xfcb1('0x30')]!==_0xfcb1('0x44')){var _0x9bcf89={};_0x9bcf89[_0x5c3fde['name']]={'$like':'%'+_0x23d2e8['query'][_0xfcb1('0x42')]+'%'};return _0x9bcf89;}})});}_0x540e8a=_['merge']({},_0x540e8a,_0x23d2e8[_0xfcb1('0x45')]);var _0x2e3629={'where':_0x540e8a[_0xfcb1('0x3f')]};return db[_0xfcb1('0x2d')]['count'](_0x2e3629)['then'](function(_0x4cd716){_0x3c095c[_0xfcb1('0x20')]=_0x4cd716;if(_0x23d2e8[_0xfcb1('0x36')][_0xfcb1('0x46')]){_0x540e8a[_0xfcb1('0x47')]=[{'all':!![]}];}return db[_0xfcb1('0x2d')][_0xfcb1('0x48')](_0x540e8a);})[_0xfcb1('0x26')](function(_0x1134f2){_0x3c095c['rows']=_0x1134f2;return _0x3c095c;})[_0xfcb1('0x26')](respondWithFilteredResult(_0x4a0157,_0x540e8a))[_0xfcb1('0x49')](handleError(_0x4a0157,null));};exports[_0xfcb1('0x4a')]=function(_0x218b85,_0x12f933){var _0x5d2e44={'raw':![],'where':{'id':_0x218b85[_0xfcb1('0x4b')]['id']}},_0x1947f4={};_0x1947f4[_0xfcb1('0x32')]=_[_0xfcb1('0x34')](db[_0xfcb1('0x2d')]['rawAttributes']);_0x1947f4[_0xfcb1('0x36')]=_[_0xfcb1('0x34')](_0x218b85['query']);_0x1947f4[_0xfcb1('0x40')]=_[_0xfcb1('0x35')](_0x1947f4[_0xfcb1('0x32')],_0x1947f4[_0xfcb1('0x36')]);_0x5d2e44[_0xfcb1('0x37')]=_['intersection'](_0x1947f4[_0xfcb1('0x32')],qs['fields'](_0x218b85['query'][_0xfcb1('0x38')]));_0x5d2e44['attributes']=_0x5d2e44['attributes']['length']?_0x5d2e44[_0xfcb1('0x37')]:_0x1947f4[_0xfcb1('0x32')];if(_0x218b85[_0xfcb1('0x36')][_0xfcb1('0x46')]){_0x5d2e44[_0xfcb1('0x47')]=[{'all':!![]}];}_0x5d2e44=_[_0xfcb1('0x43')]({},_0x5d2e44,_0x218b85[_0xfcb1('0x45')]);return db[_0xfcb1('0x2d')]['find'](_0x5d2e44)['then'](handleEntityNotFound(_0x12f933,null))[_0xfcb1('0x26')](respondWithResult(_0x12f933,null))['catch'](handleError(_0x12f933,null));};exports[_0xfcb1('0x4c')]=function(_0xfecbdf,_0x2c76c7){return db[_0xfcb1('0x2d')]['create'](_0xfecbdf['body'],{})[_0xfcb1('0x26')](respondWithResult(_0x2c76c7,0xc9))['catch'](handleError(_0x2c76c7,null));};exports[_0xfcb1('0x4d')]=function(_0x5e86ef,_0x3aa0f5){var _0xa8526b={'where':{'id':_0x5e86ef['params']['id']}},_0x50c945={};_0x50c945[_0xfcb1('0x32')]=_[_0xfcb1('0x34')](db[_0xfcb1('0x2d')][_0xfcb1('0x2e')]);_0xa8526b['attributes']=_['intersection'](_0x50c945['model'],qs['fields'](_0x5e86ef['query'][_0xfcb1('0x38')]));_0xa8526b['attributes']=_0xa8526b[_0xfcb1('0x37')]['length']?_0xa8526b[_0xfcb1('0x37')]:_0x50c945['model'];if(_0x5e86ef[_0xfcb1('0x36')][_0xfcb1('0x46')]){_0xa8526b[_0xfcb1('0x47')]=[{'all':!![]}];}_0xa8526b=_[_0xfcb1('0x43')]({},_0xa8526b,_0x5e86ef[_0xfcb1('0x45')]);return db['UserProfile'][_0xfcb1('0x4e')](_0xa8526b)[_0xfcb1('0x26')](handleEntityNotFound(_0x3aa0f5,null))[_0xfcb1('0x26')](function(_0x2df9df){if(_0x2df9df){var _0x454e33=_0x2df9df[_0xfcb1('0x4f')]({'plain':!![]});_0x454e33=qs[_0xfcb1('0x50')](_0x454e33,['id','createdAt',_0xfcb1('0x51'),_0xfcb1('0x52')]);_0x5e86ef[_0xfcb1('0x53')]=_[_0xfcb1('0x50')](_0x5e86ef[_0xfcb1('0x53')],['id',_0xfcb1('0x54'),'updatedAt']);return db[_0xfcb1('0x55')][_0xfcb1('0x56')](function(_0x3b4c9c){return db['UserProfile'][_0xfcb1('0x4c')](_['merge'](_0x454e33,_0x5e86ef[_0xfcb1('0x53')]),{'include':_0x5e86ef[_0xfcb1('0x36')][_0xfcb1('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x3b4c9c})['then'](function(_0x2bd793){var _0x2b4b59=_0x2bd793[_0xfcb1('0x4f')]({'plain':!![]});return db[_0xfcb1('0x57')][_0xfcb1('0x48')]({'where':{'userProfileId':_0x5e86ef[_0xfcb1('0x4b')]['id']},'raw':!![]})[_0xfcb1('0x26')](function(_0x7a8bda){if(_0x7a8bda){return BPromise['each'](_0x7a8bda,function(_0x415ad2){return new BPromise(function(_0x4363ef,_0x5e1626){if(_0x415ad2['autoAssociation']===null||_0x415ad2[_0xfcb1('0x58')]===0x1)_0x4363ef(null);return db[_0xfcb1('0x59')][_0xfcb1('0x48')]({'where':{'sectionId':_0x415ad2['id']},'raw':!![]})[_0xfcb1('0x26')](function(_0x4313ed){var _0x23a801=_[_0xfcb1('0x33')](_0x4313ed,function(_0x485dee){return qs[_0xfcb1('0x50')](_0x485dee,['id','createdAt','updatedAt',_0xfcb1('0x5a')]);});_0x4363ef(_0x23a801);})[_0xfcb1('0x49')](function(_0xbf386f){_0x5e1626(_0xbf386f);});})[_0xfcb1('0x26')](function(_0x1142f0){var _0x44554f=qs[_0xfcb1('0x50')](_0x415ad2,['id',_0xfcb1('0x54'),_0xfcb1('0x51')]);_0x44554f[_0xfcb1('0x5b')]=_0x2b4b59['id'];if(_0x1142f0)_0x44554f[_0xfcb1('0x5c')]=_0x1142f0;return _0x44554f;})['then'](function(_0x270839){return db[_0xfcb1('0x57')]['create'](_0x270839,{'include':[{'model':db[_0xfcb1('0x59')],'as':_0xfcb1('0x5c')}],'raw':!![],'transaction':_0x3b4c9c});});})[_0xfcb1('0x26')](function(){return _0x2b4b59;});}});});});}})[_0xfcb1('0x26')](respondWithResult(_0x3aa0f5,0xc9))['catch'](handleError(_0x3aa0f5,null));};exports['update']=function(_0x459bee,_0x3c4060){if(_0x459bee[_0xfcb1('0x53')]['id']){delete _0x459bee[_0xfcb1('0x53')]['id'];}return db[_0xfcb1('0x2d')]['find']({'where':{'id':_0x459bee[_0xfcb1('0x4b')]['id']}})[_0xfcb1('0x26')](handleEntityNotFound(_0x3c4060,null))[_0xfcb1('0x26')](saveUpdates(_0x459bee['body'],null))[_0xfcb1('0x26')](respondWithResult(_0x3c4060,null))[_0xfcb1('0x49')](handleError(_0x3c4060,null));};exports['destroy']=function(_0x534bc,_0x493907){return db[_0xfcb1('0x2d')]['find']({'where':{'id':_0x534bc['params']['id']}})[_0xfcb1('0x26')](handleEntityNotFound(_0x493907,null))['then'](removeEntity(_0x493907,null))['catch'](handleError(_0x493907,null));};exports['describe']=function(_0x3e30b3,_0x1084f1){return db[_0xfcb1('0x2d')]['describe']()[_0xfcb1('0x26')](respondWithResult(_0x1084f1,null))[_0xfcb1('0x49')](handleError(_0x1084f1,null));};exports[_0xfcb1('0x5d')]=function(_0x57e858,_0x12db63){var _0x5d60ad=_0x57e858['body'];return db['UserProfile'][_0xfcb1('0x4e')]({'where':{'id':_0x57e858[_0xfcb1('0x4b')]['id']}})[_0xfcb1('0x26')](handleEntityNotFound(_0x12db63,null))['then'](function(_0x1c5603){if(_0x1c5603){return db[_0xfcb1('0x55')][_0xfcb1('0x56')](function(_0x19cfd1){return db[_0xfcb1('0x57')]['destroy']({'where':{'userProfileId':_0x57e858[_0xfcb1('0x4b')]['id'],'sectionId':_[_0xfcb1('0x33')](_0x5d60ad,function(_0x5cf67f){return _0x5cf67f[_0xfcb1('0x5a')];})},'transaction':_0x19cfd1})['then'](function(){var _0x272b1e=_['map'](_0x5d60ad,function(_0x5dfb7e){_0x5dfb7e[_0xfcb1('0x5b')]=_0x57e858[_0xfcb1('0x4b')]['id'];return _0x5dfb7e;});var _0x580f54=[];return BPromise['each'](_0x272b1e,function(_0x2553ef){return db[_0xfcb1('0x57')][_0xfcb1('0x4c')](_0x2553ef,{'include':[{'model':db[_0xfcb1('0x59')],'as':_0xfcb1('0x5c')}],'raw':!![],'transaction':_0x19cfd1})[_0xfcb1('0x26')](function(_0x3dade6){_0x580f54['push'](_0x3dade6['get']({'plain':!![]}));});})['then'](function(){return _0x580f54;});});});}})['then'](function(_0x2e6ce8){return _0x2e6ce8;})[_0xfcb1('0x26')](respondWithResult(_0x12db63,null))['catch'](handleError(_0x12db63,null));};exports[_0xfcb1('0x5e')]=function(_0x5f024b,_0x185d52){var _0x3d84ee;return db[_0xfcb1('0x2d')]['find']({'where':{'id':_0x5f024b[_0xfcb1('0x4b')]['id']},'attributes':['id',_0xfcb1('0x2a')]})[_0xfcb1('0x26')](handleEntityNotFound(_0x185d52,null))[_0xfcb1('0x26')](function(_0x1b17e1){if(_0x1b17e1){_0x3d84ee=_0x1b17e1;return db[_0xfcb1('0x57')]['destroy']({'where':{'userProfileId':_0x5f024b[_0xfcb1('0x4b')]['id'],'sectionId':_0x5f024b[_0xfcb1('0x36')][_0xfcb1('0x5f')]}});}})[_0xfcb1('0x26')](function(){return _0x3d84ee;})[_0xfcb1('0x26')](respondWithStatusCode(_0x185d52,null))[_0xfcb1('0x49')](handleError(_0x185d52,null));};exports['getSections']=function(_0x4346e2,_0x216da0){var _0x14f1dc=[];var _0x48edf0=[];return db[_0xfcb1('0x57')][_0xfcb1('0x48')]({'where':{'userProfileId':_0x4346e2[_0xfcb1('0x4b')]['id']},'raw':!![]})[_0xfcb1('0x26')](function(_0x5cb1b0){_0x14f1dc=_[_0xfcb1('0x42')](_0x5cb1b0,function(_0x5a8688){return _0x5a8688[_0xfcb1('0x60')]===0x1||_[_0xfcb1('0x61')]([0x3eb,0x709],_0x5a8688[_0xfcb1('0x5a')]);});if(!_[_0xfcb1('0x62')](_0x14f1dc)){return _[_0xfcb1('0x33')](_0x14f1dc,function(_0x150346){return _0x150346['sectionId'];});}else{return;}})[_0xfcb1('0x26')](function(_0x3edc90){if(_0x3edc90)_0x48edf0=_0x3edc90;if(_['includes'](_0x48edf0,0x64)){var _0x394159=_['find'](_0x14f1dc,{'sectionId':0x64});return hasDefaultDashboard(_0x394159)[_0xfcb1('0x26')](function(_0x159f9e){return _[_0xfcb1('0x33')](_0x14f1dc,function(_0x494f56){if(_0x494f56['sectionId']===0x64){_0x494f56[_0xfcb1('0x63')]=_0x159f9e;}return _0x494f56;});});}else{return;}})[_0xfcb1('0x26')](function(_0x5d8414){if(_0x5d8414)_0x14f1dc=_0x5d8414;if(_['includes'](_0x48edf0,0x3eb)){var _0x188371=_[_0xfcb1('0x4e')](_0x14f1dc,{'sectionId':0x3eb});return getCustomDashboards(_0x188371)[_0xfcb1('0x26')](function(_0x4c4b34){return _[_0xfcb1('0x33')](_0x14f1dc,function(_0x12de77){if(_0x188371[_0xfcb1('0x60')]){if(_0x12de77[_0xfcb1('0x5a')]===0x3eb){_0x12de77[_0xfcb1('0x63')]=_0x4c4b34;}}else{if(_0x12de77['sectionId']===0x64){_0x12de77['subsections']=_0x4c4b34;}}return _0x12de77;});});}else{return;}})[_0xfcb1('0x26')](function(_0x104efc){if(_0x104efc)_0x14f1dc=_0x104efc;if(_[_0xfcb1('0x61')](_0x48edf0,0x709)){var _0x267c34=_[_0xfcb1('0x4e')](_0x14f1dc,{'sectionId':0x709});return getPlugins(_0x267c34)[_0xfcb1('0x26')](function(_0xca58c3){if(_0x267c34[_0xfcb1('0x60')]){return _['map'](_0x14f1dc,function(_0x4123c8){if(_0x4123c8['sectionId']===0x709){_0x4123c8[_0xfcb1('0x63')]=_0xca58c3;}return _0x4123c8;});}else{var _0x2013ea={'sectionId':0x76c,'enabled':0x1,'subsections':_0xca58c3};var _0x24d5ff=_[_0xfcb1('0x33')](_0x14f1dc);_0x24d5ff[_0xfcb1('0x64')](_0x2013ea);return _0x24d5ff;}});}else{return;}})[_0xfcb1('0x26')](function(_0x3bb803){if(_0x3bb803)_0x14f1dc=_0x3bb803;return _[_0xfcb1('0x42')](_0x14f1dc,[_0xfcb1('0x60'),0x1]);})[_0xfcb1('0x26')](respondWithResult(_0x216da0,null))['catch'](handleError(_0x216da0,null));};function hasDefaultDashboard(_0x599ca7){var _0x5aa77c=[0x65];return new BPromise(function(_0x2478e2,_0x2d260d){try{if(_0x599ca7['autoAssociation']){_0x2478e2(_0x5aa77c);}else{return db[_0xfcb1('0x59')][_0xfcb1('0x65')]({'where':{'sectionId':_0x599ca7['id']},'raw':!![]})[_0xfcb1('0x26')](function(_0x4fdce8){_0x4fdce8?_0x2478e2(_0x5aa77c):_0x2478e2();});}}catch(_0x2bdea2){_0x2d260d(_0x2bdea2);}});}function getCustomDashboards(_0x1a91f0){var _0x1f1a12=[];return new BPromise(function(_0x337275,_0x386422){try{if(_0x1a91f0['autoAssociation']){return db[_0xfcb1('0x66')][_0xfcb1('0x48')]({'raw':!![]})[_0xfcb1('0x26')](function(_0x2df70c){_0x2df70c[_0xfcb1('0x67')](function(_0x5cc495){_0x1f1a12[_0xfcb1('0x64')](_0x5cc495['id']+0x1869f);});_0x337275(_0x1f1a12);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x1a91f0['id']},'raw':!![]})[_0xfcb1('0x26')](function(_0x107d64){_0x107d64[_0xfcb1('0x67')](function(_0xedbe8f){_0x1f1a12['push'](_0xedbe8f['resourceId']+0x1869f);});_0x337275(_0x1f1a12);});}}catch(_0x485356){_0x386422(_0x485356);}});}function getPlugins(_0x349b58){var _0x5c3374=[];return new BPromise(function(_0x233ffd,_0x545d29){try{if(_0x349b58[_0xfcb1('0x58')]){return db[_0xfcb1('0x68')][_0xfcb1('0x48')]({'raw':!![]})[_0xfcb1('0x26')](function(_0x469c8e){_0x469c8e[_0xfcb1('0x67')](function(_0x5c21af){_0x5c3374[_0xfcb1('0x64')](_0x5c21af['id']+0x15b38);});_0x233ffd(_0x5c3374);});}else{return db[_0xfcb1('0x59')][_0xfcb1('0x48')]({'where':{'sectionId':_0x349b58['id']},'raw':!![]})['then'](function(_0x1878ab){_0x1878ab[_0xfcb1('0x67')](function(_0x1f3ea3){_0x5c3374['push'](_0x1f3ea3[_0xfcb1('0x69')]+0x15b38);});_0x233ffd(_0x5c3374);});}}catch(_0x3127da){_0x545d29(_0x3127da);}});}exports[_0xfcb1('0x6a')]=function(_0x3d30e3,_0x3c5942){return db[_0xfcb1('0x2d')]['find']({'where':{'id':_0x3d30e3[_0xfcb1('0x4b')]['id']}})[_0xfcb1('0x26')](handleEntityNotFound(_0x3c5942,null))[_0xfcb1('0x26')](function(_0x8b4430){if(_0x8b4430){return db[_0xfcb1('0x55')]['transaction'](function(_0x38cf1f){return db[_0xfcb1('0x57')][_0xfcb1('0x48')]({'where':{'userProfileId':_0x3d30e3['params']['id']},'attributes':['id'],'raw':!![]})[_0xfcb1('0x26')](function(_0x4e06b5){if(_0x4e06b5){return db[_0xfcb1('0x57')][_0xfcb1('0x27')]({'where':{'userProfileId':_0x3d30e3[_0xfcb1('0x4b')]['id'],'id':_[_0xfcb1('0x33')](_0x4e06b5,function(_0x3d1371){return _0x3d1371['id'];})},'transaction':_0x38cf1f});}})[_0xfcb1('0x26')](function(_0x5c370b){var _0x524a71=_[_0xfcb1('0x33')](_0x3d30e3[_0xfcb1('0x53')],function(_0x21efc4){_0x21efc4['userProfileId']=_0x3d30e3[_0xfcb1('0x4b')]['id'];return _0x21efc4;});return db[_0xfcb1('0x57')]['bulkCreate'](_0x524a71,{'raw':!![],'transaction':_0x38cf1f});})[_0xfcb1('0x26')](function(_0x178090){var _0x339780=_[_0xfcb1('0x42')](_[_0xfcb1('0x33')](_0x178090,function(_0x41613e){return _0x41613e[_0xfcb1('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x339780){return db[_0xfcb1('0x57')][_0xfcb1('0x48')]({'where':{'userProfileId':_0x3d30e3[_0xfcb1('0x4b')]['id'],'sectionId':_[_0xfcb1('0x33')](_0x339780,function(_0x3521ae){return _0x3521ae[_0xfcb1('0x5a')];})},'attributes':['id',_0xfcb1('0x5a')],'raw':!![]})[_0xfcb1('0x26')](function(_0xdf34e9){var _0x29528f=_[_0xfcb1('0x33')](_0x3d30e3[_0xfcb1('0x53')],function(_0x5ad887){_0x5ad887['userProfileId']=_0x3d30e3[_0xfcb1('0x4b')]['id'];return _0x5ad887;});return db['UserProfileResource'][_0xfcb1('0x6b')](_0x29528f,{'raw':!![],'transaction':_0x38cf1f});});}})[_0xfcb1('0x49')](handleError(_0x3c5942,null));});}})[_0xfcb1('0x26')](function(_0x52f645){var _0x4f87d1=_[_0xfcb1('0x33')](_0x52f645,function(_0x7a600c){return _0x7a600c[_0xfcb1('0x4f')]({'plain':!![]});});})[_0xfcb1('0x26')](respondWithResult(_0x3c5942,null))['catch'](handleError(_0x3c5942,null));};exports[_0xfcb1('0x6c')]=function(_0x227b20,_0xe55774,_0x24e722){return db['UserProfile'][_0xfcb1('0x4e')]({'where':{'id':_0x227b20[_0xfcb1('0x4b')]['id']}})[_0xfcb1('0x26')](handleEntityNotFound(_0xe55774,null))['then'](function(_0x36bbde){if(_0x36bbde){return _0x36bbde[_0xfcb1('0x6c')](_0x227b20[_0xfcb1('0x36')][_0xfcb1('0x5f')]);}})[_0xfcb1('0x26')](respondWithStatusCode(_0xe55774,null))[_0xfcb1('0x49')](handleError(_0xe55774,null));};exports[_0xfcb1('0x6d')]=function(_0x2989b7,_0x5502e9){var _0x5387a6={'raw':![],'where':{}};var _0x1032d6={};var _0x4b8910={'count':0x0,'rows':[]};var _0x2461b6=_0x2989b7['query']['section'];if(typeof _0x2461b6===_0xfcb1('0x6e')){throw new db[(_0xfcb1('0x6f'))]['ValidationError']('Unknown\x20section');}var _0x343ec9=_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x70')]||![];var _0x420903=getQueryModels(_0x2461b6,_0x343ec9);if(typeof _0x420903['childModel']===_0xfcb1('0x6e')){throw new db[(_0xfcb1('0x6f'))][(_0xfcb1('0x71'))]('Invalid\x20section\x20\x27'+_0x2461b6+'\x27');}var _0x3a03c5=[];if(!_['isEmpty'](_0x420903[_0xfcb1('0x72')])){_0x3a03c5=_0x420903[_0xfcb1('0x72')];}else{_0x3a03c5=[{'name':_0x2461b6}];}return db['UserProfile']['findOne']({'where':{'id':_0x2989b7[_0xfcb1('0x4b')]['id']}})[_0xfcb1('0x26')](handleEntityNotFound(_0x5502e9,null))[_0xfcb1('0x26')](function(_0xc0d23d){if(_0xc0d23d){var _0x3c05f2=[];for(var _0x4e9927=0x0;_0x4e9927<_0x3a03c5[_0xfcb1('0x39')];_0x4e9927++){_0x3c05f2['push'](db[_0xfcb1('0x57')][_0xfcb1('0x65')]({'where':{'userProfileId':_0xc0d23d['id'],'name':_0x3a03c5[_0x4e9927][_0xfcb1('0x2a')]},'raw':!![]}));}return BPromise[_0xfcb1('0x73')](_0x3c05f2);}})[_0xfcb1('0x26')](function(_0xb693b3){var _0x580b5a=_[_0xfcb1('0x42')](_0xb693b3,function(_0x2b1a41){return _0x2b1a41?_0x2b1a41:undefined;});var _0x2c834a=_[_0xfcb1('0x42')](_0x3a03c5,[_0xfcb1('0x74'),!![]]);var _0x57d56e=_[_0xfcb1('0x62')](_0x580b5a)&&_['isEmpty'](_0x2c834a)?null:_['union'](_0x2c834a,_0x580b5a);if(_0x57d56e){var _0x34430b=[];for(var _0x1d3248=0x0;_0x1d3248<_0x57d56e[_0xfcb1('0x39')];_0x1d3248++){var _0x28506b=_['find'](_0x3a03c5,function(_0x19544d){return _0x57d56e[_0x1d3248]?_0x19544d[_0xfcb1('0x2a')]===_0x57d56e[_0x1d3248][_0xfcb1('0x2a')]:null;});if(_0x28506b){if(_0x57d56e[_0x1d3248]['ignore']){_0x34430b['push'](getAllResources(_0x420903[_0xfcb1('0x75')],_0x57d56e[_0x1d3248]));}else{if(!_0x57d56e[_0x1d3248][_0xfcb1('0x58')]){_0x34430b['push'](getAllowedResources(_0x28506b,_0x57d56e[_0x1d3248],_0x420903['childModel']));}else{if(_0x28506b[_0xfcb1('0x32')]){_0x34430b[_0xfcb1('0x64')](getAllFilteredResources(_0x28506b,_0x57d56e[_0x1d3248]));}}}}}return BPromise[_0xfcb1('0x73')](_0x34430b);}else{return null;}})[_0xfcb1('0x26')](function(_0x46fb1e){var _0x5d2797=_0x46fb1e;var _0x31e01a=null;if(_0x5d2797){_0x31e01a=_0x5d2797[_0xfcb1('0x39')]===0x1?_0x5d2797[0x0]:null;}if(_0x31e01a||_0x5d2797){var _0x458e26=db[_0x420903[_0xfcb1('0x75')]]['rawAttributes'];_0x1032d6[_0xfcb1('0x32')]=_[_0xfcb1('0x34')](_0x458e26);_0x1032d6[_0xfcb1('0x36')]=_[_0xfcb1('0x34')](_0x2989b7[_0xfcb1('0x36')]);_0x1032d6['filters']=_[_0xfcb1('0x35')](_0x1032d6[_0xfcb1('0x32')],_0x1032d6['query']);_0x5387a6[_0xfcb1('0x37')]=_[_0xfcb1('0x35')](_0x1032d6[_0xfcb1('0x32')],qs[_0xfcb1('0x38')](_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x38')]));_0x5387a6[_0xfcb1('0x37')]=_0x5387a6['attributes'][_0xfcb1('0x39')]?_0x5387a6[_0xfcb1('0x37')]:_0x1032d6[_0xfcb1('0x32')];if(!_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x3a')](_0xfcb1('0x3b'))){_0x5387a6['limit']=qs[_0xfcb1('0x3c')](_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x3c')]);_0x5387a6[_0xfcb1('0x3d')]=qs['offset'](_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x3d')]);}_0x5387a6[_0xfcb1('0x76')]=qs[_0xfcb1('0x3e')](_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x3e')]);_0x5387a6[_0xfcb1('0x3f')]=qs[_0xfcb1('0x40')](_[_0xfcb1('0x41')](_0x2989b7[_0xfcb1('0x36')],_0x1032d6['filters']));if(_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x42')]){_0x5387a6[_0xfcb1('0x3f')]=_[_0xfcb1('0x43')](_0x5387a6['where'],{'$or':_[_0xfcb1('0x33')](_0x458e26,function(_0x59ee13){if(_0x59ee13[_0xfcb1('0x30')][_0xfcb1('0x31')]!==_0xfcb1('0x44')){var _0x4c69cf={};_0x4c69cf[_0x59ee13['field']]={'$like':'%'+_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x42')]+'%'};return _0x4c69cf;}})});}var _0x50f3ad=[];if(_0x31e01a){var _0x48febb=_[_0xfcb1('0x4e')](_0x3a03c5,[_0xfcb1('0x2a'),_0x31e01a[_0xfcb1('0x2a')]]);if(_0x48febb[_0xfcb1('0x77')]){var _0x3eecf8={};if(_0x420903[_0xfcb1('0x75')]===_0xfcb1('0x78')){_0x3eecf8[_0x48febb[_0xfcb1('0x79')]]=_['map'](_0x31e01a['associatedResources'],'id');}else{_0x3eecf8[_0x48febb[_0xfcb1('0x79')]]=_0x31e01a[_0xfcb1('0x7a')];}_0x50f3ad[_0xfcb1('0x64')](_0x3eecf8);}else{_0x5387a6[_0xfcb1('0x3f')]['id']=_0x31e01a[_0xfcb1('0x7a')];}}else{for(var _0x3c21de=0x0;_0x3c21de<_0x5d2797[_0xfcb1('0x39')];_0x3c21de++){var _0x48febb=_[_0xfcb1('0x4e')](_0x3a03c5,[_0xfcb1('0x2a'),_0x5d2797[_0x3c21de][_0xfcb1('0x2a')]]);if(_0x48febb[_0xfcb1('0x77')]){var _0x3eecf8={};_0x3eecf8[_0x48febb[_0xfcb1('0x79')]]=_0x5d2797[_0x3c21de][_0xfcb1('0x7a')];_0x50f3ad['push'](_0x3eecf8);}else{if(!_0x5387a6[_0xfcb1('0x3f')]['id'])_0x5387a6[_0xfcb1('0x3f')]['id']=[];_0x5d2797[_0x3c21de][_0xfcb1('0x7a')][_0xfcb1('0x67')](function(_0x147b72){_0x5387a6[_0xfcb1('0x3f')]['id']['push'](_0x147b72);});}}}if(!_[_0xfcb1('0x62')](_0x50f3ad)){_0x5387a6[_0xfcb1('0x3f')]=_[_0xfcb1('0x43')](_0x5387a6[_0xfcb1('0x3f')],{'$and':{'$or':_0x50f3ad}});}_0x5387a6=_[_0xfcb1('0x43')]({},_0x5387a6,_0x2989b7[_0xfcb1('0x45')]);if(_0x31e01a&&!_0x31e01a['autoAssociation']&&_0x420903[_0xfcb1('0x75')]===_0xfcb1('0x78')){if(_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x46')]){_0x5387a6['include']=[{'all':!![]}];}return db[_0x420903[_0xfcb1('0x75')]][_0xfcb1('0x48')](_0x5387a6)[_0xfcb1('0x26')](function(_0x2e0a8f){var _0x4b0886=[];_0x2e0a8f[_0xfcb1('0x67')](function(_0xcb3ce0){var _0x299ed4;switch(_0xcb3ce0[_0xfcb1('0x7b')]){case _0xfcb1('0x7c'):_0x299ed4=_[_0xfcb1('0x4e')](_0x31e01a['associatedResources'],function(_0x1c9f54){return _0x1c9f54['id']===_0xcb3ce0[_0xfcb1('0x7d')]&&_0x1c9f54[_0xfcb1('0x30')]===_0xfcb1('0x7e');});break;case _0xfcb1('0x7f'):_0x299ed4=_[_0xfcb1('0x4e')](_0x31e01a[_0xfcb1('0x7a')],function(_0x4a31de){return _0x4a31de['id']===_0xcb3ce0[_0xfcb1('0x7d')]&&_0x4a31de[_0xfcb1('0x30')]===_0xfcb1('0x80');});break;}if(_0x299ed4)_0x4b0886[_0xfcb1('0x64')](_0xcb3ce0);});_0x4b8910[_0xfcb1('0x20')]=_0x4b0886[_0xfcb1('0x39')];_0x4b8910[_0xfcb1('0x81')]=_0x4b0886;return _0x4b8910;});}else{return db[_0x420903[_0xfcb1('0x75')]][_0xfcb1('0x20')]({'where':_0x5387a6['where']})[_0xfcb1('0x26')](function(_0x53cd32){_0x4b8910[_0xfcb1('0x20')]=_0x53cd32;if(_0x2989b7[_0xfcb1('0x36')]['includeAll']){if(_0x420903[_0xfcb1('0x75')]===_0xfcb1('0x82')){_0x5387a6[_0xfcb1('0x47')]=[{'model':db[_0xfcb1('0x83')],'as':_0xfcb1('0x84'),'attributes':['id',_0xfcb1('0x2a'),_0xfcb1('0x85')],'required':_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x86')]?!![]:![]},{'model':db['Tag'],'as':_0xfcb1('0x87'),'attributes':['id',_0xfcb1('0x2a'),_0xfcb1('0x85')],'through':_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x86')]?{'attributes':[],'where':{'TagId':_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x86')]||undefined}}:{},'required':_0x2989b7['query'][_0xfcb1('0x86')]?!![]:![]}];}else{_0x5387a6[_0xfcb1('0x47')]=[{'all':!![]}];}}return db[_0x420903[_0xfcb1('0x75')]][_0xfcb1('0x48')](_0x5387a6);})[_0xfcb1('0x26')](function(_0x4e6289){_0x4b8910[_0xfcb1('0x81')]=_0x4e6289;return _0x4b8910;});}}else{return _0x4b8910;}})[_0xfcb1('0x26')](respondWithFilteredResult(_0x5502e9,_0x5387a6))[_0xfcb1('0x49')](handleError(_0x5502e9,null));};function getAllResources(_0x2189b5,_0x4fe38a){return new BPromise(function(_0x3ca73f,_0x3505bc){if(_0x4fe38a){var _0x432f41=_0x4fe38a[_0xfcb1('0x42')]?{[_0x4fe38a[_0xfcb1('0x42')]['field']]:_0x4fe38a[_0xfcb1('0x42')][_0xfcb1('0x88')]}:undefined;return db[_0x2189b5][_0xfcb1('0x48')]({'where':_0x432f41,'raw':!![]})[_0xfcb1('0x26')](function(_0x569179){_0x4fe38a['associatedResources']=_[_0xfcb1('0x33')](_0x569179,'id');_0x3ca73f(_0x4fe38a);})[_0xfcb1('0x49')](function(_0x519178){_0x3505bc(_0x519178);});}else{_0x3ca73f(null);}});}function getAllFilteredResources(_0x3799f2,_0x1fe7a9){return new BPromise(function(_0x127a65,_0x27bdf4){var _0xfe7c9=_0x3799f2[_0xfcb1('0x42')]?{[_0x3799f2['filter'][_0xfcb1('0x77')]]:_0x3799f2[_0xfcb1('0x42')][_0xfcb1('0x88')]}:undefined;return db[_0x3799f2[_0xfcb1('0x32')]]['findAll']({'where':_0xfe7c9,'raw':!![]})[_0xfcb1('0x26')](function(_0x128675){_0x1fe7a9[_0xfcb1('0x7a')]=_[_0xfcb1('0x33')](_0x128675,function(_0xfdee88){return _0xfdee88[_0xfcb1('0x2a')];});_0x127a65(_0x1fe7a9);})[_0xfcb1('0x49')](function(_0x9c08d9){_0x27bdf4(_0x9c08d9);});});}function getAllowedResources(_0x835805,_0x3cfe02,_0x26923f){return new BPromise(function(_0x378570,_0x277625){if(_0x3cfe02){return db[_0xfcb1('0x59')]['findAll']({'where':{'sectionId':_0x3cfe02['id']},'raw':!![]})[_0xfcb1('0x26')](function(_0x528b77){if(_0x835805['field']&&_0x835805[_0xfcb1('0x77')]!=='id'){_0x3cfe02['associatedResources']=_[_0xfcb1('0x33')](_0x528b77,function(_0xa71ec){return _0xa71ec[_0x835805[_0xfcb1('0x77')]];});}else{if(_0x26923f===_0xfcb1('0x78')){_0x3cfe02[_0xfcb1('0x7a')]=_[_0xfcb1('0x33')](_0x528b77,function(_0x36f9c5){return{'id':_0x36f9c5[_0xfcb1('0x69')],'type':_0x36f9c5['type']};});}else{_0x3cfe02[_0xfcb1('0x7a')]=_[_0xfcb1('0x33')](_0x528b77,function(_0x395ae7){return _0x395ae7[_0xfcb1('0x69')];});}}_0x378570(_0x3cfe02);})[_0xfcb1('0x49')](function(_0x4a8f36){_0x277625(_0x4a8f36);});}else{_0x378570(null);}});}function getQueryModels(_0x16a2ad,_0x1f373e){var _0x1df5ef=_0x16a2ad[_0xfcb1('0x89')]();var _0x237eb9={'childModel':undefined,'parentSections':[]};switch(_0x1df5ef){case'squareprojects':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x8a');break;case _0xfcb1('0x8b'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x8c');break;case _0xfcb1('0x8d'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x8e');_0x237eb9[_0xfcb1('0x72')]=[{'name':_0xfcb1('0x8f'),'field':'name','foreignKey':'projectName'}];break;case _0xfcb1('0x90'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x91');break;case'contacts':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x82');_0x237eb9[_0xfcb1('0x72')]=[{'name':_0xfcb1('0x92'),'field':'id','foreignKey':_0xfcb1('0x93')}];break;case _0xfcb1('0x94'):_0x237eb9['childModel']=_0xfcb1('0x95');break;case _0xfcb1('0x96'):_0x237eb9[_0xfcb1('0x75')]='CmCompany';break;case'globalcustomfields':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x97');break;case _0xfcb1('0x98'):_0x237eb9['childModel']=_0xfcb1('0x99');break;case _0xfcb1('0x9a'):_0x237eb9[_0xfcb1('0x75')]='ChatWebsite';break;case _0xfcb1('0x9b'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x9c');break;case _0xfcb1('0x9d'):_0x237eb9[_0xfcb1('0x75')]='FaxAccount';break;case _0xfcb1('0x9e'):case _0xfcb1('0x9f'):case _0xfcb1('0xa0'):_0x237eb9[_0xfcb1('0x75')]='VoiceExtension';break;case _0xfcb1('0xa1'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xa2');break;case _0xfcb1('0xa3'):_0x237eb9['childModel']=_0xfcb1('0xa4');break;case _0xfcb1('0xa5'):_0x237eb9['childModel']=_0xfcb1('0xa6');_0x237eb9[_0xfcb1('0x72')]=[{'name':_0xfcb1('0xa7'),'field':_0xfcb1('0x2a'),'foreignKey':_0xfcb1('0xa8'),'model':'User','filter':{'field':_0xfcb1('0xa9'),'value':[_0xfcb1('0xaa')]}},{'name':'Telephones','field':_0xfcb1('0x2a'),'foreignKey':'membername','model':_0xfcb1('0xab'),'filter':{'field':_0xfcb1('0xa9'),'value':[_0xfcb1('0xac')]}},{'name':_0xfcb1('0xad'),'field':_0xfcb1('0x2a'),'foreignKey':_0xfcb1('0xae'),'model':_0xfcb1('0xaf'),'filter':{'field':'type','value':['inbound']}},{'name':'QueueCampaigns','field':'name','foreignKey':_0xfcb1('0xae'),'model':_0xfcb1('0xaf'),'filter':{'field':_0xfcb1('0x30'),'value':[_0xfcb1('0xb0')]}}];break;case _0xfcb1('0xb1'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xb2');break;case _0xfcb1('0xb3'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xb4');break;case _0xfcb1('0xb5'):_0x237eb9['childModel']=_0xfcb1('0xb6');break;case _0xfcb1('0xb7'):_0x237eb9['childModel']='Campaign';break;case'mailqueues':_0x237eb9['childModel']=_0xfcb1('0xb8');break;case _0xfcb1('0xb9'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xba');break;case'mailsubstatuses':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xbb');break;case _0xfcb1('0xbc'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xbd');break;case _0xfcb1('0xbe'):_0x237eb9[_0xfcb1('0x75')]='OpenchannelAccount';break;case _0xfcb1('0xbf'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xc0');break;case _0xfcb1('0xc1'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xc2');break;case _0xfcb1('0xc3'):_0x237eb9['childModel']=_0xfcb1('0xc4');break;case _0xfcb1('0xc5'):_0x237eb9['childModel']=_0xfcb1('0xc6');break;case _0xfcb1('0xc7'):_0x237eb9[_0xfcb1('0x75')]='Team';break;case'voicequeues':case _0xfcb1('0xc8'):_0x237eb9[_0xfcb1('0x75')]='VoiceQueue';if(_0x1f373e){_0x237eb9[_0xfcb1('0x72')]=[{'name':'VoiceQueues'},{'name':_0xfcb1('0xc9')}];}break;case'users':case'agents':case _0xfcb1('0xca'):_0x237eb9['childModel']=_0xfcb1('0xab');if(_0x1f373e){_0x237eb9[_0xfcb1('0x72')]=[{'name':_0xfcb1('0xcb'),'filter':{'field':'role','value':[_0xfcb1('0xcc'),'user']},'ignore':!![]},{'name':_0xfcb1('0xa7')},{'name':_0xfcb1('0xcd')}];}break;case _0xfcb1('0xce'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xcf');break;case _0xfcb1('0xd0'):_0x237eb9['childModel']=_0xfcb1('0xd1');break;case _0xfcb1('0xd2'):_0x237eb9[_0xfcb1('0x75')]='FreshdeskAccount';break;case _0xfcb1('0xd3'):_0x237eb9['childModel']='SugarcrmAccount';break;case _0xfcb1('0xd4'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xd5');break;case _0xfcb1('0xd6'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xd7');break;case _0xfcb1('0xd8'):_0x237eb9['childModel']=_0xfcb1('0xab');break;case _0xfcb1('0xd9'):_0x237eb9['childModel']=_0xfcb1('0xda');break;case _0xfcb1('0xdb'):_0x237eb9['childModel']=_0xfcb1('0xdc');break;case'customdashboards':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x66');break;case _0xfcb1('0xdd'):_0x237eb9[_0xfcb1('0x75')]='Interval';break;case _0xfcb1('0xde'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xdf');break;case _0xfcb1('0xe0'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xe1');break;case _0xfcb1('0xe2'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xe3');break;case _0xfcb1('0xe4'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x83');break;case'templates':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xe5');break;case _0xfcb1('0xe6'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xe7');break;case'trunks':_0x237eb9['childModel']=_0xfcb1('0xe8');break;case _0xfcb1('0xe9'):_0x237eb9[_0xfcb1('0x75')]='Variable';break;case _0xfcb1('0xea'):_0x237eb9[_0xfcb1('0x75')]='Plugin';break;case _0xfcb1('0xeb'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x78');_0x237eb9[_0xfcb1('0x72')]=[{'name':_0xfcb1('0xec'),'field':'id','foreignKey':_0xfcb1('0x7d')}];break;case'metrics':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xed');break;case _0xfcb1('0xc5'):_0x237eb9['childModel']=_0xfcb1('0xc6');break;default:return _0x237eb9;}return _0x237eb9;} \ No newline at end of file +var _0xaf84=['membername','User','Telephones','telephone','VoiceQueues','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','OpenchannelQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','Team','QueueCampaigns','users','agents','Users','role','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','pauses','Pause','Schedule','sounds','Template','triggers','Trigger','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','WhatsappAccount','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','end','count','offset','limit','status','set','Content-Range','json','reject','save','update','then','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','clone','find','get','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','omit','userProfileId','Resources','destroy','describe','sectionId','push','removeSections','ids','enabled','includes','subsections','forEach','Plugin','resourceId','bulkCreate','removeResources','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','all','ignore','union','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','custom','reportId','CmContact','Tag','Tags','color','tag','ThroughTags','toLowerCase','squareprojects','SquareProject','SquareOdbc','squarerecordings','SquareRecording','projectName','projects','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xaf84,0x12f));var _0x4af8=function(_0x292fbe,_0x1148ec){_0x292fbe=_0x292fbe-0x0;var _0x53ddce=_0xaf84[_0x292fbe];return _0x53ddce;};'use strict';var pdf=require(_0x4af8('0x0'));var emlformat=require(_0x4af8('0x1'));var rimraf=require(_0x4af8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4af8('0x3'));var rp=require(_0x4af8('0x4'));var moment=require(_0x4af8('0x5'));var BPromise=require(_0x4af8('0x6'));var Mustache=require(_0x4af8('0x7'));var util=require(_0x4af8('0x8'));var path=require(_0x4af8('0x9'));var sox=require(_0x4af8('0xa'));var csv=require(_0x4af8('0xb'));var ejs=require(_0x4af8('0xc'));var fs=require('fs');var _=require(_0x4af8('0xd'));var squel=require(_0x4af8('0xe'));var crypto=require(_0x4af8('0xf'));var jsforce=require(_0x4af8('0x10'));var deskjs=require(_0x4af8('0x11'));var toCsv=require(_0x4af8('0xb'));var querystring=require(_0x4af8('0x12'));var Papa=require('papaparse');var Redis=require(_0x4af8('0x13'));var authService=require(_0x4af8('0x14'));var qs=require(_0x4af8('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4af8('0x16'));var logger=require(_0x4af8('0x17'))('api');var utils=require(_0x4af8('0x18'));var config=require(_0x4af8('0x19'));var db=require(_0x4af8('0x1a'))['db'];config[_0x4af8('0x1b')]=_[_0x4af8('0x1c')](config[_0x4af8('0x1b')],{'host':_0x4af8('0x1d'),'port':0x18eb});var socket=require(_0x4af8('0x1e'))(new Redis(config['redis']));require(_0x4af8('0x1f'))['register'](socket);function respondWithStatusCode(_0x473947,_0x63fd28){_0x63fd28=_0x63fd28||0xcc;return function(_0x3e7a38){if(_0x3e7a38){return _0x473947[_0x4af8('0x20')](_0x63fd28);}return _0x473947['status'](_0x63fd28)[_0x4af8('0x21')]();};}function respondWithResult(_0x5cbe11,_0x3f168f){_0x3f168f=_0x3f168f||0xc8;return function(_0x1d2179){if(_0x1d2179){return _0x5cbe11['status'](_0x3f168f)['json'](_0x1d2179);}};}function respondWithFilteredResult(_0x3fd882,_0x555f8e){return function(_0x13af6e){if(_0x13af6e){var _0x72fd7e=_0x13af6e[_0x4af8('0x22')],_0x319a6a=_0x555f8e['offset'],_0x5cbd8e=_0x555f8e[_0x4af8('0x23')]+_0x555f8e[_0x4af8('0x24')],_0x353f35;if(_0x5cbd8e>=_0x72fd7e){_0x5cbd8e=_0x72fd7e;_0x353f35=0xc8;}else{_0x353f35=0xce;}_0x3fd882[_0x4af8('0x25')](_0x353f35);return _0x3fd882[_0x4af8('0x26')](_0x4af8('0x27'),_0x319a6a+'-'+_0x5cbd8e+'/'+_0x72fd7e)[_0x4af8('0x28')](_0x13af6e);}return null;};}function patchUpdates(_0x461f7d){return function(_0x344304){try{jsonpatch['apply'](_0x344304,_0x461f7d,!![]);}catch(_0x510faa){return BPromise[_0x4af8('0x29')](_0x510faa);}return _0x344304[_0x4af8('0x2a')]();};}function saveUpdates(_0x270fc0,_0x3b4d05){return function(_0x2d9ef3){if(_0x2d9ef3){return _0x2d9ef3[_0x4af8('0x2b')](_0x270fc0)['then'](function(_0x3d4aa6){return _0x3d4aa6;});}return null;};}function removeEntity(_0x387b22,_0x59642e){return function(_0x126567){if(_0x126567){return _0x126567['destroy']()[_0x4af8('0x2c')](function(){_0x387b22[_0x4af8('0x25')](0xcc)[_0x4af8('0x21')]();});}};}function handleEntityNotFound(_0x2bb749,_0x59af60){return function(_0x4b30a8){if(!_0x4b30a8){_0x2bb749[_0x4af8('0x20')](0x194);}return _0x4b30a8;};}function handleError(_0x3c8fae,_0x214dde){_0x214dde=_0x214dde||0x1f4;return function(_0x566125){logger['error'](_0x566125[_0x4af8('0x2d')]);if(_0x566125[_0x4af8('0x2e')]){delete _0x566125[_0x4af8('0x2e')];}_0x3c8fae[_0x4af8('0x25')](_0x214dde)[_0x4af8('0x2f')](_0x566125);};}exports[_0x4af8('0x30')]=function(_0x278873,_0x56ce5f){var _0x2a78a3={},_0x42f786={},_0x1f36ba={'count':0x0,'rows':[]};var _0x26e701=_[_0x4af8('0x31')](db[_0x4af8('0x32')][_0x4af8('0x33')],function(_0x35ed4f){return{'name':_0x35ed4f[_0x4af8('0x34')],'type':_0x35ed4f['type'][_0x4af8('0x35')]};});_0x42f786[_0x4af8('0x36')]=_[_0x4af8('0x31')](_0x26e701,_0x4af8('0x2e'));_0x42f786['query']=_[_0x4af8('0x37')](_0x278873[_0x4af8('0x38')]);_0x42f786[_0x4af8('0x39')]=_[_0x4af8('0x3a')](_0x42f786[_0x4af8('0x36')],_0x42f786['query']);_0x2a78a3['attributes']=_['intersection'](_0x42f786[_0x4af8('0x36')],qs[_0x4af8('0x3b')](_0x278873[_0x4af8('0x38')][_0x4af8('0x3b')]));_0x2a78a3[_0x4af8('0x3c')]=_0x2a78a3[_0x4af8('0x3c')][_0x4af8('0x3d')]?_0x2a78a3[_0x4af8('0x3c')]:_0x42f786['model'];if(!_0x278873['query'][_0x4af8('0x3e')](_0x4af8('0x3f'))){_0x2a78a3['limit']=qs[_0x4af8('0x24')](_0x278873[_0x4af8('0x38')][_0x4af8('0x24')]);_0x2a78a3['offset']=qs[_0x4af8('0x23')](_0x278873[_0x4af8('0x38')]['offset']);}_0x2a78a3[_0x4af8('0x40')]=qs[_0x4af8('0x41')](_0x278873[_0x4af8('0x38')]['sort']);_0x2a78a3[_0x4af8('0x42')]=qs[_0x4af8('0x39')](_[_0x4af8('0x43')](_0x278873['query'],_0x42f786[_0x4af8('0x39')]),_0x26e701);if(_0x278873[_0x4af8('0x38')][_0x4af8('0x44')]){_0x2a78a3[_0x4af8('0x42')]=_[_0x4af8('0x45')](_0x2a78a3[_0x4af8('0x42')],{'$or':_[_0x4af8('0x31')](_0x26e701,function(_0x6b314d){if(_0x6b314d[_0x4af8('0x46')]!==_0x4af8('0x47')){var _0x33772f={};_0x33772f[_0x6b314d['name']]={'$like':'%'+_0x278873['query'][_0x4af8('0x44')]+'%'};return _0x33772f;}})});}_0x2a78a3=_[_0x4af8('0x45')]({},_0x2a78a3,_0x278873['options']);var _0x3c66dc={'where':_0x2a78a3['where']};return db[_0x4af8('0x32')][_0x4af8('0x22')](_0x3c66dc)['then'](function(_0x46d58d){_0x1f36ba[_0x4af8('0x22')]=_0x46d58d;if(_0x278873[_0x4af8('0x38')][_0x4af8('0x48')]){_0x2a78a3[_0x4af8('0x49')]=[{'all':!![]}];}return db[_0x4af8('0x32')][_0x4af8('0x4a')](_0x2a78a3);})[_0x4af8('0x2c')](function(_0x1e98d2){_0x1f36ba[_0x4af8('0x4b')]=_0x1e98d2;return _0x1f36ba;})['then'](respondWithFilteredResult(_0x56ce5f,_0x2a78a3))['catch'](handleError(_0x56ce5f,null));};exports[_0x4af8('0x4c')]=function(_0x2b1c32,_0x2e6348){var _0x3ea7ef={'raw':![],'where':{'id':_0x2b1c32[_0x4af8('0x4d')]['id']}},_0x5d6a8d={};_0x5d6a8d[_0x4af8('0x36')]=_[_0x4af8('0x37')](db[_0x4af8('0x32')][_0x4af8('0x33')]);_0x5d6a8d[_0x4af8('0x38')]=_[_0x4af8('0x37')](_0x2b1c32['query']);_0x5d6a8d[_0x4af8('0x39')]=_[_0x4af8('0x3a')](_0x5d6a8d[_0x4af8('0x36')],_0x5d6a8d['query']);_0x3ea7ef[_0x4af8('0x3c')]=_[_0x4af8('0x3a')](_0x5d6a8d[_0x4af8('0x36')],qs[_0x4af8('0x3b')](_0x2b1c32[_0x4af8('0x38')]['fields']));_0x3ea7ef[_0x4af8('0x3c')]=_0x3ea7ef[_0x4af8('0x3c')][_0x4af8('0x3d')]?_0x3ea7ef[_0x4af8('0x3c')]:_0x5d6a8d[_0x4af8('0x36')];if(_0x2b1c32[_0x4af8('0x38')]['includeAll']){_0x3ea7ef[_0x4af8('0x49')]=[{'all':!![]}];}_0x3ea7ef=_['merge']({},_0x3ea7ef,_0x2b1c32[_0x4af8('0x4e')]);return db[_0x4af8('0x32')]['find'](_0x3ea7ef)['then'](handleEntityNotFound(_0x2e6348,null))['then'](respondWithResult(_0x2e6348,null))[_0x4af8('0x4f')](handleError(_0x2e6348,null));};exports[_0x4af8('0x50')]=function(_0x470666,_0x2a4aec){return db[_0x4af8('0x32')][_0x4af8('0x50')](_0x470666['body'],{})[_0x4af8('0x2c')](respondWithResult(_0x2a4aec,0xc9))[_0x4af8('0x4f')](handleError(_0x2a4aec,null));};exports[_0x4af8('0x51')]=function(_0x46d1db,_0x18fd47){var _0x35dfe7={'where':{'id':_0x46d1db['params']['id']}},_0x319d7f={};_0x319d7f[_0x4af8('0x36')]=_['keys'](db['UserProfile'][_0x4af8('0x33')]);_0x35dfe7[_0x4af8('0x3c')]=_['intersection'](_0x319d7f[_0x4af8('0x36')],qs[_0x4af8('0x3b')](_0x46d1db['query'][_0x4af8('0x3b')]));_0x35dfe7[_0x4af8('0x3c')]=_0x35dfe7[_0x4af8('0x3c')]['length']?_0x35dfe7[_0x4af8('0x3c')]:_0x319d7f[_0x4af8('0x36')];if(_0x46d1db['query'][_0x4af8('0x48')]){_0x35dfe7['include']=[{'all':!![]}];}_0x35dfe7=_[_0x4af8('0x45')]({},_0x35dfe7,_0x46d1db[_0x4af8('0x4e')]);return db[_0x4af8('0x32')][_0x4af8('0x52')](_0x35dfe7)[_0x4af8('0x2c')](handleEntityNotFound(_0x18fd47,null))[_0x4af8('0x2c')](function(_0x49bb73){if(_0x49bb73){var _0x21b6e6=_0x49bb73[_0x4af8('0x53')]({'plain':!![]});_0x21b6e6=qs['omit'](_0x21b6e6,['id',_0x4af8('0x54'),_0x4af8('0x55'),_0x4af8('0x56')]);_0x46d1db['body']=_['omit'](_0x46d1db[_0x4af8('0x57')],['id',_0x4af8('0x54'),'updatedAt']);return db[_0x4af8('0x58')][_0x4af8('0x59')](function(_0x401e3d){return db[_0x4af8('0x32')][_0x4af8('0x50')](_['merge'](_0x21b6e6,_0x46d1db['body']),{'include':_0x46d1db[_0x4af8('0x38')][_0x4af8('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x401e3d})['then'](function(_0x2077ab){var _0x14d321=_0x2077ab['get']({'plain':!![]});return db[_0x4af8('0x5a')][_0x4af8('0x4a')]({'where':{'userProfileId':_0x46d1db['params']['id']},'raw':!![]})[_0x4af8('0x2c')](function(_0x46df51){if(_0x46df51){return BPromise[_0x4af8('0x5b')](_0x46df51,function(_0x312cdb){return new BPromise(function(_0x541d0d,_0x7c9108){if(_0x312cdb[_0x4af8('0x5c')]===null||_0x312cdb[_0x4af8('0x5c')]===0x1)_0x541d0d(null);return db[_0x4af8('0x5d')]['findAll']({'where':{'sectionId':_0x312cdb['id']},'raw':!![]})[_0x4af8('0x2c')](function(_0xb109d5){var _0xed93f4=_[_0x4af8('0x31')](_0xb109d5,function(_0x131a49){return qs['omit'](_0x131a49,['id','createdAt',_0x4af8('0x55'),'sectionId']);});_0x541d0d(_0xed93f4);})[_0x4af8('0x4f')](function(_0x3f9c86){_0x7c9108(_0x3f9c86);});})[_0x4af8('0x2c')](function(_0x18d13e){var _0x50300e=qs[_0x4af8('0x5e')](_0x312cdb,['id',_0x4af8('0x54'),_0x4af8('0x55')]);_0x50300e[_0x4af8('0x5f')]=_0x14d321['id'];if(_0x18d13e)_0x50300e['Resources']=_0x18d13e;return _0x50300e;})[_0x4af8('0x2c')](function(_0x1e94fd){return db['UserProfileSection']['create'](_0x1e94fd,{'include':[{'model':db['UserProfileResource'],'as':_0x4af8('0x60')}],'raw':!![],'transaction':_0x401e3d});});})[_0x4af8('0x2c')](function(){return _0x14d321;});}});});});}})[_0x4af8('0x2c')](respondWithResult(_0x18fd47,0xc9))[_0x4af8('0x4f')](handleError(_0x18fd47,null));};exports[_0x4af8('0x2b')]=function(_0x2a9b7d,_0x3a8b7b){if(_0x2a9b7d[_0x4af8('0x57')]['id']){delete _0x2a9b7d[_0x4af8('0x57')]['id'];}return db['UserProfile'][_0x4af8('0x52')]({'where':{'id':_0x2a9b7d[_0x4af8('0x4d')]['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x3a8b7b,null))['then'](saveUpdates(_0x2a9b7d['body'],null))[_0x4af8('0x2c')](respondWithResult(_0x3a8b7b,null))['catch'](handleError(_0x3a8b7b,null));};exports[_0x4af8('0x61')]=function(_0x1814ce,_0x517f4d){return db[_0x4af8('0x32')]['find']({'where':{'id':_0x1814ce['params']['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x517f4d,null))[_0x4af8('0x2c')](removeEntity(_0x517f4d,null))['catch'](handleError(_0x517f4d,null));};exports[_0x4af8('0x62')]=function(_0x5d6ac6,_0x333b87){return db[_0x4af8('0x32')][_0x4af8('0x62')]()['then'](respondWithResult(_0x333b87,null))[_0x4af8('0x4f')](handleError(_0x333b87,null));};exports['addSections']=function(_0x5e774d,_0x301eb1){var _0x1dc929=_0x5e774d[_0x4af8('0x57')];return db['UserProfile'][_0x4af8('0x52')]({'where':{'id':_0x5e774d[_0x4af8('0x4d')]['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x301eb1,null))[_0x4af8('0x2c')](function(_0x57b5bb){if(_0x57b5bb){return db['sequelize'][_0x4af8('0x59')](function(_0x37d830){return db['UserProfileSection'][_0x4af8('0x61')]({'where':{'userProfileId':_0x5e774d[_0x4af8('0x4d')]['id'],'sectionId':_['map'](_0x1dc929,function(_0x2e81b7){return _0x2e81b7[_0x4af8('0x63')];})},'transaction':_0x37d830})[_0x4af8('0x2c')](function(){var _0x3eeb4b=_['map'](_0x1dc929,function(_0x213751){_0x213751['userProfileId']=_0x5e774d[_0x4af8('0x4d')]['id'];return _0x213751;});var _0x2d34c3=[];return BPromise[_0x4af8('0x5b')](_0x3eeb4b,function(_0x8d860c){return db[_0x4af8('0x5a')][_0x4af8('0x50')](_0x8d860c,{'include':[{'model':db[_0x4af8('0x5d')],'as':_0x4af8('0x60')}],'raw':!![],'transaction':_0x37d830})[_0x4af8('0x2c')](function(_0x38bb37){_0x2d34c3[_0x4af8('0x64')](_0x38bb37[_0x4af8('0x53')]({'plain':!![]}));});})[_0x4af8('0x2c')](function(){return _0x2d34c3;});});});}})[_0x4af8('0x2c')](function(_0x5daf29){return _0x5daf29;})[_0x4af8('0x2c')](respondWithResult(_0x301eb1,null))[_0x4af8('0x4f')](handleError(_0x301eb1,null));};exports[_0x4af8('0x65')]=function(_0x455e1f,_0x595d8c){var _0x18d397;return db[_0x4af8('0x32')][_0x4af8('0x52')]({'where':{'id':_0x455e1f[_0x4af8('0x4d')]['id']},'attributes':['id',_0x4af8('0x2e')]})[_0x4af8('0x2c')](handleEntityNotFound(_0x595d8c,null))[_0x4af8('0x2c')](function(_0x2b5f89){if(_0x2b5f89){_0x18d397=_0x2b5f89;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x455e1f[_0x4af8('0x4d')]['id'],'sectionId':_0x455e1f[_0x4af8('0x38')][_0x4af8('0x66')]}});}})[_0x4af8('0x2c')](function(){return _0x18d397;})[_0x4af8('0x2c')](respondWithStatusCode(_0x595d8c,null))[_0x4af8('0x4f')](handleError(_0x595d8c,null));};exports['getSections']=function(_0x16af53,_0x5951fe){var _0x164f53=[];var _0x14b5cc=[];return db[_0x4af8('0x5a')][_0x4af8('0x4a')]({'where':{'userProfileId':_0x16af53[_0x4af8('0x4d')]['id']},'raw':!![]})['then'](function(_0x96c3b6){_0x164f53=_[_0x4af8('0x44')](_0x96c3b6,function(_0x2a39b8){return _0x2a39b8[_0x4af8('0x67')]===0x1||_[_0x4af8('0x68')]([0x3eb,0x709],_0x2a39b8[_0x4af8('0x63')]);});if(!_['isEmpty'](_0x164f53)){return _[_0x4af8('0x31')](_0x164f53,function(_0xd967fd){return _0xd967fd[_0x4af8('0x63')];});}else{return;}})['then'](function(_0x4eaaee){if(_0x4eaaee)_0x14b5cc=_0x4eaaee;if(_[_0x4af8('0x68')](_0x14b5cc,0x64)){var _0x3b9614=_[_0x4af8('0x52')](_0x164f53,{'sectionId':0x64});return hasDefaultDashboard(_0x3b9614)[_0x4af8('0x2c')](function(_0xa0a3f3){return _[_0x4af8('0x31')](_0x164f53,function(_0x3ab21a){if(_0x3ab21a['sectionId']===0x64){_0x3ab21a[_0x4af8('0x69')]=_0xa0a3f3;}return _0x3ab21a;});});}else{return;}})['then'](function(_0x3f6d02){if(_0x3f6d02)_0x164f53=_0x3f6d02;if(_[_0x4af8('0x68')](_0x14b5cc,0x3eb)){var _0x1eaac0=_['find'](_0x164f53,{'sectionId':0x3eb});return getCustomDashboards(_0x1eaac0)[_0x4af8('0x2c')](function(_0x4ddc5d){return _[_0x4af8('0x31')](_0x164f53,function(_0x18faaf){if(_0x1eaac0[_0x4af8('0x67')]){if(_0x18faaf[_0x4af8('0x63')]===0x3eb){_0x18faaf[_0x4af8('0x69')]=_0x4ddc5d;}}else{if(_0x18faaf[_0x4af8('0x63')]===0x64){_0x18faaf[_0x4af8('0x69')]=_0x4ddc5d;}}return _0x18faaf;});});}else{return;}})[_0x4af8('0x2c')](function(_0x2d7998){if(_0x2d7998)_0x164f53=_0x2d7998;if(_[_0x4af8('0x68')](_0x14b5cc,0x709)){var _0x19ac55=_[_0x4af8('0x52')](_0x164f53,{'sectionId':0x709});return getPlugins(_0x19ac55)[_0x4af8('0x2c')](function(_0x407549){if(_0x19ac55[_0x4af8('0x67')]){return _[_0x4af8('0x31')](_0x164f53,function(_0x1467ac){if(_0x1467ac[_0x4af8('0x63')]===0x709){_0x1467ac[_0x4af8('0x69')]=_0x407549;}return _0x1467ac;});}else{var _0xff00b7={'sectionId':0x76c,'enabled':0x1,'subsections':_0x407549};var _0x21ef77=_['map'](_0x164f53);_0x21ef77['push'](_0xff00b7);return _0x21ef77;}});}else{return;}})[_0x4af8('0x2c')](function(_0x4f2518){if(_0x4f2518)_0x164f53=_0x4f2518;return _[_0x4af8('0x44')](_0x164f53,[_0x4af8('0x67'),0x1]);})[_0x4af8('0x2c')](respondWithResult(_0x5951fe,null))[_0x4af8('0x4f')](handleError(_0x5951fe,null));};function hasDefaultDashboard(_0x37152e){var _0x5cdf8b=[0x65];return new BPromise(function(_0x2c5410,_0x157a9a){try{if(_0x37152e[_0x4af8('0x5c')]){_0x2c5410(_0x5cdf8b);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x37152e['id']},'raw':!![]})[_0x4af8('0x2c')](function(_0x269bff){_0x269bff?_0x2c5410(_0x5cdf8b):_0x2c5410();});}}catch(_0x1c860e){_0x157a9a(_0x1c860e);}});}function getCustomDashboards(_0xb0598c){var _0x140023=[];return new BPromise(function(_0x27cf09,_0x472eae){try{if(_0xb0598c['autoAssociation']){return db['Dashboard'][_0x4af8('0x4a')]({'raw':!![]})[_0x4af8('0x2c')](function(_0x4ba43b){_0x4ba43b[_0x4af8('0x6a')](function(_0x49776a){_0x140023['push'](_0x49776a['id']+0x1869f);});_0x27cf09(_0x140023);});}else{return db[_0x4af8('0x5d')][_0x4af8('0x4a')]({'where':{'sectionId':_0xb0598c['id']},'raw':!![]})[_0x4af8('0x2c')](function(_0x4ce7d5){_0x4ce7d5[_0x4af8('0x6a')](function(_0xa4c32e){_0x140023[_0x4af8('0x64')](_0xa4c32e['resourceId']+0x1869f);});_0x27cf09(_0x140023);});}}catch(_0x221f46){_0x472eae(_0x221f46);}});}function getPlugins(_0x2b9141){var _0x2d6757=[];return new BPromise(function(_0x57bbc9,_0x22703d){try{if(_0x2b9141[_0x4af8('0x5c')]){return db[_0x4af8('0x6b')][_0x4af8('0x4a')]({'raw':!![]})[_0x4af8('0x2c')](function(_0x46a55c){_0x46a55c[_0x4af8('0x6a')](function(_0xc34403){_0x2d6757[_0x4af8('0x64')](_0xc34403['id']+0x15b38);});_0x57bbc9(_0x2d6757);});}else{return db['UserProfileResource'][_0x4af8('0x4a')]({'where':{'sectionId':_0x2b9141['id']},'raw':!![]})['then'](function(_0x18a103){_0x18a103[_0x4af8('0x6a')](function(_0x2d89aa){_0x2d6757['push'](_0x2d89aa[_0x4af8('0x6c')]+0x15b38);});_0x57bbc9(_0x2d6757);});}}catch(_0x25f59a){_0x22703d(_0x25f59a);}});}exports['addResources']=function(_0x1302c1,_0x2df69e){return db[_0x4af8('0x32')][_0x4af8('0x52')]({'where':{'id':_0x1302c1['params']['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x2df69e,null))[_0x4af8('0x2c')](function(_0xfa64de){if(_0xfa64de){return db[_0x4af8('0x58')][_0x4af8('0x59')](function(_0x882a11){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x1302c1[_0x4af8('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0x4af8('0x2c')](function(_0xc1bf0){if(_0xc1bf0){return db[_0x4af8('0x5a')][_0x4af8('0x61')]({'where':{'userProfileId':_0x1302c1[_0x4af8('0x4d')]['id'],'id':_[_0x4af8('0x31')](_0xc1bf0,function(_0x57eab3){return _0x57eab3['id'];})},'transaction':_0x882a11});}})[_0x4af8('0x2c')](function(_0x2660cb){var _0x463a0d=_[_0x4af8('0x31')](_0x1302c1[_0x4af8('0x57')],function(_0xddb878){_0xddb878[_0x4af8('0x5f')]=_0x1302c1['params']['id'];return _0xddb878;});return db[_0x4af8('0x5a')][_0x4af8('0x6d')](_0x463a0d,{'raw':!![],'transaction':_0x882a11});})[_0x4af8('0x2c')](function(_0x376e99){var _0x24c4d8=_[_0x4af8('0x44')](_['map'](_0x376e99,function(_0x4e8df8){return _0x4e8df8[_0x4af8('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x24c4d8){return db['UserProfileSection'][_0x4af8('0x4a')]({'where':{'userProfileId':_0x1302c1[_0x4af8('0x4d')]['id'],'sectionId':_[_0x4af8('0x31')](_0x24c4d8,function(_0x4b3b97){return _0x4b3b97[_0x4af8('0x63')];})},'attributes':['id',_0x4af8('0x63')],'raw':!![]})[_0x4af8('0x2c')](function(_0x145f30){var _0x1ed1a5=_['map'](_0x1302c1[_0x4af8('0x57')],function(_0x541b01){_0x541b01['userProfileId']=_0x1302c1['params']['id'];return _0x541b01;});return db[_0x4af8('0x5d')]['bulkCreate'](_0x1ed1a5,{'raw':!![],'transaction':_0x882a11});});}})[_0x4af8('0x4f')](handleError(_0x2df69e,null));});}})[_0x4af8('0x2c')](function(_0xde17b8){var _0x50f42a=_[_0x4af8('0x31')](_0xde17b8,function(_0x35eb5a){return _0x35eb5a[_0x4af8('0x53')]({'plain':!![]});});})[_0x4af8('0x2c')](respondWithResult(_0x2df69e,null))['catch'](handleError(_0x2df69e,null));};exports['removeResources']=function(_0x2f556b,_0x8455f3,_0x173fe7){return db['UserProfile'][_0x4af8('0x52')]({'where':{'id':_0x2f556b[_0x4af8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x8455f3,null))[_0x4af8('0x2c')](function(_0x242319){if(_0x242319){return _0x242319[_0x4af8('0x6e')](_0x2f556b[_0x4af8('0x38')][_0x4af8('0x66')]);}})[_0x4af8('0x2c')](respondWithStatusCode(_0x8455f3,null))[_0x4af8('0x4f')](handleError(_0x8455f3,null));};exports[_0x4af8('0x6f')]=function(_0x5c0275,_0x20623e){var _0x122737={'raw':![],'where':{}};var _0x2a1a6b={};var _0x442fbe={'count':0x0,'rows':[]};var _0x2569ae=_0x5c0275[_0x4af8('0x38')]['section'];if(typeof _0x2569ae===_0x4af8('0x70')){throw new db[(_0x4af8('0x71'))][(_0x4af8('0x72'))](_0x4af8('0x73'));}var _0x2476cf=_0x5c0275[_0x4af8('0x38')][_0x4af8('0x74')]||![];var _0x3d3083=getQueryModels(_0x2569ae,_0x2476cf);if(typeof _0x3d3083[_0x4af8('0x75')]===_0x4af8('0x70')){throw new db['Sequelize'][(_0x4af8('0x72'))](_0x4af8('0x76')+_0x2569ae+'\x27');}var _0x57b939=[];if(!_[_0x4af8('0x77')](_0x3d3083[_0x4af8('0x78')])){_0x57b939=_0x3d3083[_0x4af8('0x78')];}else{_0x57b939=[{'name':_0x2569ae}];}return db[_0x4af8('0x32')][_0x4af8('0x79')]({'where':{'id':_0x5c0275[_0x4af8('0x4d')]['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x20623e,null))[_0x4af8('0x2c')](function(_0x2d48cd){if(_0x2d48cd){var _0x4284b5=[];for(var _0x531814=0x0;_0x531814<_0x57b939[_0x4af8('0x3d')];_0x531814++){_0x4284b5['push'](db[_0x4af8('0x5a')]['findOne']({'where':{'userProfileId':_0x2d48cd['id'],'name':_0x57b939[_0x531814][_0x4af8('0x2e')]},'raw':!![]}));}return BPromise[_0x4af8('0x7a')](_0x4284b5);}})[_0x4af8('0x2c')](function(_0x287b36){var _0x23c221=_[_0x4af8('0x44')](_0x287b36,function(_0xee27e5){return _0xee27e5?_0xee27e5:undefined;});var _0x1a4f43=_['filter'](_0x57b939,[_0x4af8('0x7b'),!![]]);var _0x5b18d1=_['isEmpty'](_0x23c221)&&_[_0x4af8('0x77')](_0x1a4f43)?null:_[_0x4af8('0x7c')](_0x1a4f43,_0x23c221);if(_0x5b18d1){var _0x4fa2f8=[];for(var _0x177a3c=0x0;_0x177a3c<_0x5b18d1[_0x4af8('0x3d')];_0x177a3c++){var _0x170b65=_[_0x4af8('0x52')](_0x57b939,function(_0x1ebebf){return _0x5b18d1[_0x177a3c]?_0x1ebebf[_0x4af8('0x2e')]===_0x5b18d1[_0x177a3c][_0x4af8('0x2e')]:null;});if(_0x170b65){if(_0x5b18d1[_0x177a3c][_0x4af8('0x7b')]){_0x4fa2f8[_0x4af8('0x64')](getAllResources(_0x3d3083['childModel'],_0x5b18d1[_0x177a3c]));}else{if(!_0x5b18d1[_0x177a3c][_0x4af8('0x5c')]){_0x4fa2f8[_0x4af8('0x64')](getAllowedResources(_0x170b65,_0x5b18d1[_0x177a3c],_0x3d3083['childModel']));}else{if(_0x170b65['model']){_0x4fa2f8['push'](getAllFilteredResources(_0x170b65,_0x5b18d1[_0x177a3c]));}}}}}return BPromise['all'](_0x4fa2f8);}else{return null;}})[_0x4af8('0x2c')](function(_0x5a7aae){var _0x531349=_0x5a7aae;var _0x32fcd6=null;if(_0x531349){_0x32fcd6=_0x531349[_0x4af8('0x3d')]===0x1?_0x531349[0x0]:null;}if(_0x32fcd6||_0x531349){var _0x4596e7=db[_0x3d3083[_0x4af8('0x75')]]['rawAttributes'];_0x2a1a6b['model']=_[_0x4af8('0x37')](_0x4596e7);_0x2a1a6b['query']=_['keys'](_0x5c0275[_0x4af8('0x38')]);_0x2a1a6b[_0x4af8('0x39')]=_['intersection'](_0x2a1a6b[_0x4af8('0x36')],_0x2a1a6b[_0x4af8('0x38')]);_0x122737['attributes']=_[_0x4af8('0x3a')](_0x2a1a6b[_0x4af8('0x36')],qs[_0x4af8('0x3b')](_0x5c0275[_0x4af8('0x38')][_0x4af8('0x3b')]));_0x122737[_0x4af8('0x3c')]=_0x122737['attributes'][_0x4af8('0x3d')]?_0x122737[_0x4af8('0x3c')]:_0x2a1a6b[_0x4af8('0x36')];if(!_0x5c0275[_0x4af8('0x38')]['hasOwnProperty'](_0x4af8('0x3f'))){_0x122737[_0x4af8('0x24')]=qs[_0x4af8('0x24')](_0x5c0275['query'][_0x4af8('0x24')]);_0x122737[_0x4af8('0x23')]=qs[_0x4af8('0x23')](_0x5c0275[_0x4af8('0x38')][_0x4af8('0x23')]);}_0x122737[_0x4af8('0x40')]=qs[_0x4af8('0x41')](_0x5c0275[_0x4af8('0x38')][_0x4af8('0x41')]);_0x122737[_0x4af8('0x42')]=qs[_0x4af8('0x39')](_[_0x4af8('0x43')](_0x5c0275[_0x4af8('0x38')],_0x2a1a6b[_0x4af8('0x39')]));if(_0x5c0275[_0x4af8('0x38')]['filter']){_0x122737[_0x4af8('0x42')]=_[_0x4af8('0x45')](_0x122737[_0x4af8('0x42')],{'$or':_[_0x4af8('0x31')](_0x4596e7,function(_0x307c18){if(_0x307c18[_0x4af8('0x46')][_0x4af8('0x35')]!==_0x4af8('0x47')){var _0x19e9d0={};_0x19e9d0[_0x307c18[_0x4af8('0x7d')]]={'$like':'%'+_0x5c0275[_0x4af8('0x38')][_0x4af8('0x44')]+'%'};return _0x19e9d0;}})});}var _0x4560b3=[];if(_0x32fcd6){var _0x44f547=_['find'](_0x57b939,[_0x4af8('0x2e'),_0x32fcd6[_0x4af8('0x2e')]]);if(_0x44f547[_0x4af8('0x7d')]){var _0x27e8b4={};if(_0x3d3083['childModel']===_0x4af8('0x7e')){_0x27e8b4[_0x44f547[_0x4af8('0x7f')]]=_[_0x4af8('0x31')](_0x32fcd6[_0x4af8('0x80')],'id');}else{_0x27e8b4[_0x44f547[_0x4af8('0x7f')]]=_0x32fcd6[_0x4af8('0x80')];}_0x4560b3[_0x4af8('0x64')](_0x27e8b4);}else{_0x122737[_0x4af8('0x42')]['id']=_0x32fcd6[_0x4af8('0x80')];}}else{for(var _0xc0c9aa=0x0;_0xc0c9aa<_0x531349[_0x4af8('0x3d')];_0xc0c9aa++){var _0x44f547=_[_0x4af8('0x52')](_0x57b939,[_0x4af8('0x2e'),_0x531349[_0xc0c9aa][_0x4af8('0x2e')]]);if(_0x44f547[_0x4af8('0x7d')]){var _0x27e8b4={};_0x27e8b4[_0x44f547[_0x4af8('0x7f')]]=_0x531349[_0xc0c9aa][_0x4af8('0x80')];_0x4560b3[_0x4af8('0x64')](_0x27e8b4);}else{if(!_0x122737[_0x4af8('0x42')]['id'])_0x122737['where']['id']=[];_0x531349[_0xc0c9aa]['associatedResources'][_0x4af8('0x6a')](function(_0x15a3bd){_0x122737['where']['id'][_0x4af8('0x64')](_0x15a3bd);});}}}if(!_['isEmpty'](_0x4560b3)){_0x122737[_0x4af8('0x42')]=_[_0x4af8('0x45')](_0x122737[_0x4af8('0x42')],{'$and':{'$or':_0x4560b3}});}_0x122737=_[_0x4af8('0x45')]({},_0x122737,_0x5c0275[_0x4af8('0x4e')]);if(_0x32fcd6&&!_0x32fcd6[_0x4af8('0x5c')]&&_0x3d3083[_0x4af8('0x75')]===_0x4af8('0x7e')){if(_0x5c0275[_0x4af8('0x38')]['includeAll']){_0x122737[_0x4af8('0x49')]=[{'all':!![]}];}return db[_0x3d3083[_0x4af8('0x75')]][_0x4af8('0x4a')](_0x122737)[_0x4af8('0x2c')](function(_0x5f22cd){var _0x33d675=[];_0x5f22cd[_0x4af8('0x6a')](function(_0x5d8814){var _0x55da4d;switch(_0x5d8814[_0x4af8('0x81')]){case _0x4af8('0x82'):_0x55da4d=_[_0x4af8('0x52')](_0x32fcd6[_0x4af8('0x80')],function(_0x8f6f2f){return _0x8f6f2f['id']===_0x5d8814['reportId']&&_0x8f6f2f[_0x4af8('0x46')]===_0x4af8('0x83');});break;case _0x4af8('0x84'):_0x55da4d=_[_0x4af8('0x52')](_0x32fcd6[_0x4af8('0x80')],function(_0x3e3df0){return _0x3e3df0['id']===_0x5d8814[_0x4af8('0x85')]&&_0x3e3df0['type']==='CustomReports';});break;}if(_0x55da4d)_0x33d675['push'](_0x5d8814);});_0x442fbe[_0x4af8('0x22')]=_0x33d675[_0x4af8('0x3d')];_0x442fbe[_0x4af8('0x4b')]=_0x33d675;return _0x442fbe;});}else{return db[_0x3d3083[_0x4af8('0x75')]][_0x4af8('0x22')]({'where':_0x122737[_0x4af8('0x42')]})['then'](function(_0x5723c7){_0x442fbe['count']=_0x5723c7;if(_0x5c0275[_0x4af8('0x38')][_0x4af8('0x48')]){if(_0x3d3083[_0x4af8('0x75')]===_0x4af8('0x86')){_0x122737[_0x4af8('0x49')]=[{'model':db[_0x4af8('0x87')],'as':_0x4af8('0x88'),'attributes':['id',_0x4af8('0x2e'),_0x4af8('0x89')],'required':_0x5c0275[_0x4af8('0x38')][_0x4af8('0x8a')]?!![]:![]},{'model':db[_0x4af8('0x87')],'as':_0x4af8('0x8b'),'attributes':['id',_0x4af8('0x2e'),'color'],'through':_0x5c0275[_0x4af8('0x38')][_0x4af8('0x8a')]?{'attributes':[],'where':{'TagId':_0x5c0275[_0x4af8('0x38')]['tag']||undefined}}:{},'required':_0x5c0275[_0x4af8('0x38')]['tag']?!![]:![]}];}else{_0x122737[_0x4af8('0x49')]=[{'all':!![]}];}}return db[_0x3d3083[_0x4af8('0x75')]][_0x4af8('0x4a')](_0x122737);})[_0x4af8('0x2c')](function(_0x3bca31){_0x442fbe[_0x4af8('0x4b')]=_0x3bca31;return _0x442fbe;});}}else{return _0x442fbe;}})[_0x4af8('0x2c')](respondWithFilteredResult(_0x20623e,_0x122737))['catch'](handleError(_0x20623e,null));};function getAllResources(_0x483525,_0x2dcae7){return new BPromise(function(_0x511b88,_0x34a61f){if(_0x2dcae7){var _0x4f69a6=_0x2dcae7[_0x4af8('0x44')]?{[_0x2dcae7['filter'][_0x4af8('0x7d')]]:_0x2dcae7[_0x4af8('0x44')]['value']}:undefined;return db[_0x483525]['findAll']({'where':_0x4f69a6,'raw':!![]})['then'](function(_0x2ae2a2){_0x2dcae7[_0x4af8('0x80')]=_[_0x4af8('0x31')](_0x2ae2a2,'id');_0x511b88(_0x2dcae7);})[_0x4af8('0x4f')](function(_0x3434ee){_0x34a61f(_0x3434ee);});}else{_0x511b88(null);}});}function getAllFilteredResources(_0x357d36,_0x2d16bb){return new BPromise(function(_0x51dc9e,_0x1205b6){var _0x1810dc=_0x357d36[_0x4af8('0x44')]?{[_0x357d36[_0x4af8('0x44')]['field']]:_0x357d36['filter']['value']}:undefined;return db[_0x357d36['model']][_0x4af8('0x4a')]({'where':_0x1810dc,'raw':!![]})[_0x4af8('0x2c')](function(_0x17ada9){_0x2d16bb['associatedResources']=_[_0x4af8('0x31')](_0x17ada9,function(_0x5368a2){return _0x5368a2[_0x4af8('0x2e')];});_0x51dc9e(_0x2d16bb);})[_0x4af8('0x4f')](function(_0x2ebac0){_0x1205b6(_0x2ebac0);});});}function getAllowedResources(_0x4bea97,_0x17a876,_0x5059ec){return new BPromise(function(_0x513a7d,_0x517d44){if(_0x17a876){return db['UserProfileResource'][_0x4af8('0x4a')]({'where':{'sectionId':_0x17a876['id']},'raw':!![]})[_0x4af8('0x2c')](function(_0x93de6e){if(_0x4bea97[_0x4af8('0x7d')]&&_0x4bea97[_0x4af8('0x7d')]!=='id'){_0x17a876[_0x4af8('0x80')]=_[_0x4af8('0x31')](_0x93de6e,function(_0x3d0509){return _0x3d0509[_0x4bea97[_0x4af8('0x7d')]];});}else{if(_0x5059ec===_0x4af8('0x7e')){_0x17a876[_0x4af8('0x80')]=_[_0x4af8('0x31')](_0x93de6e,function(_0x938196){return{'id':_0x938196['resourceId'],'type':_0x938196[_0x4af8('0x46')]};});}else{_0x17a876[_0x4af8('0x80')]=_[_0x4af8('0x31')](_0x93de6e,function(_0x288af8){return _0x288af8[_0x4af8('0x6c')];});}}_0x513a7d(_0x17a876);})[_0x4af8('0x4f')](function(_0x31b0b3){_0x517d44(_0x31b0b3);});}else{_0x513a7d(null);}});}function getQueryModels(_0x222be4,_0x59b5ab){var _0x1787e4=_0x222be4[_0x4af8('0x8c')]();var _0xc2dccd={'childModel':undefined,'parentSections':[]};switch(_0x1787e4){case _0x4af8('0x8d'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x8e');break;case'odbc':_0xc2dccd['childModel']=_0x4af8('0x8f');break;case _0x4af8('0x90'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x91');_0xc2dccd[_0x4af8('0x78')]=[{'name':'SquareProjects','field':_0x4af8('0x2e'),'foreignKey':_0x4af8('0x92')}];break;case _0x4af8('0x93'):_0xc2dccd['childModel']='JscriptyProject';break;case'contacts':_0xc2dccd[_0x4af8('0x75')]='CmContact';_0xc2dccd[_0x4af8('0x78')]=[{'name':_0x4af8('0x94'),'field':'id','foreignKey':_0x4af8('0x95')}];break;case _0x4af8('0x96'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x97');break;case _0x4af8('0x98'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x99');break;case _0x4af8('0x9a'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x9b');break;case _0x4af8('0x9c'):_0xc2dccd['childModel']=_0x4af8('0x9d');break;case'chatwebsites':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x9e');break;case'faxqueues':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x9f');break;case _0x4af8('0xa0'):_0xc2dccd['childModel']=_0x4af8('0xa1');break;case'inboundroutes':case _0x4af8('0xa2'):case _0x4af8('0xa3'):_0xc2dccd['childModel']=_0x4af8('0xa4');break;case'contexts':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xa5');break;case'voicemails':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xa6');break;case _0x4af8('0xa7'):_0xc2dccd['childModel']=_0x4af8('0xa8');_0xc2dccd[_0x4af8('0x78')]=[{'name':'Agents','field':_0x4af8('0x2e'),'foreignKey':_0x4af8('0xa9'),'model':_0x4af8('0xaa'),'filter':{'field':'role','value':['agent']}},{'name':_0x4af8('0xab'),'field':_0x4af8('0x2e'),'foreignKey':_0x4af8('0xa9'),'model':'User','filter':{'field':'role','value':[_0x4af8('0xac')]}},{'name':_0x4af8('0xad'),'field':_0x4af8('0x2e'),'foreignKey':_0x4af8('0xae'),'model':_0x4af8('0xaf'),'filter':{'field':_0x4af8('0x46'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0x4af8('0x2e'),'foreignKey':_0x4af8('0xae'),'model':_0x4af8('0xaf'),'filter':{'field':_0x4af8('0x46'),'value':[_0x4af8('0xb0')]}}];break;case _0x4af8('0xb1'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xb2');break;case _0x4af8('0xb3'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xb4');break;case _0x4af8('0xb5'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xb6');break;case _0x4af8('0xb7'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xb8');break;case _0x4af8('0xb9'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xba');break;case _0x4af8('0xbb'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xbc');break;case'mailsubstatuses':_0xc2dccd[_0x4af8('0x75')]='MailSubstatus';break;case'openchannelqueues':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xbd');break;case'openchannelaccounts':_0xc2dccd['childModel']='OpenchannelAccount';break;case'smsqueues':_0xc2dccd[_0x4af8('0x75')]='SmsQueue';break;case _0x4af8('0xbe'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xbf');break;case _0x4af8('0xc0'):_0xc2dccd['childModel']=_0x4af8('0xc1');break;case _0x4af8('0xc2'):_0xc2dccd[_0x4af8('0x75')]='WhatsappAccount';break;case'teams':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xc3');break;case'voicequeues':case'queuecampaigns':_0xc2dccd['childModel']=_0x4af8('0xaf');if(_0x59b5ab){_0xc2dccd['parentSections']=[{'name':_0x4af8('0xad')},{'name':_0x4af8('0xc4')}];}break;case _0x4af8('0xc5'):case _0x4af8('0xc6'):case'telephones':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xaa');if(_0x59b5ab){_0xc2dccd[_0x4af8('0x78')]=[{'name':_0x4af8('0xc7'),'filter':{'field':_0x4af8('0xc8'),'value':[_0x4af8('0xc9'),_0x4af8('0xca')]},'ignore':!![]},{'name':_0x4af8('0xcb')},{'name':_0x4af8('0xab')}];}break;case _0x4af8('0xcc'):_0xc2dccd['childModel']=_0x4af8('0xcd');break;case _0x4af8('0xce'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xcf');break;case _0x4af8('0xd0'):_0xc2dccd[_0x4af8('0x75')]='FreshdeskAccount';break;case _0x4af8('0xd1'):_0xc2dccd[_0x4af8('0x75')]='SugarcrmAccount';break;case _0x4af8('0xd2'):_0xc2dccd[_0x4af8('0x75')]='DeskAccount';break;case _0x4af8('0xd3'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xd4');break;case _0x4af8('0xd5'):_0xc2dccd['childModel']=_0x4af8('0xaa');break;case _0x4af8('0xd6'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xd7');break;case _0x4af8('0xd8'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xd9');break;case _0x4af8('0xda'):_0xc2dccd[_0x4af8('0x75')]='Dashboard';break;case _0x4af8('0xdb'):_0xc2dccd['childModel']='Interval';break;case _0x4af8('0xdc'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xdd');break;case'scheduler':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xde');break;case _0x4af8('0xdf'):_0xc2dccd['childModel']='Sound';break;case'tags':_0xc2dccd['childModel']=_0x4af8('0x87');break;case'templates':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xe0');break;case _0x4af8('0xe1'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xe2');break;case'trunks':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xe3');break;case _0x4af8('0xe4'):_0xc2dccd['childModel']=_0x4af8('0xe5');break;case _0x4af8('0xe6'):_0xc2dccd['childModel']=_0x4af8('0x6b');break;case _0x4af8('0xe7'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x7e');_0xc2dccd[_0x4af8('0x78')]=[{'name':_0x4af8('0xe8'),'field':'id','foreignKey':_0x4af8('0x85')}];break;case _0x4af8('0xe9'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xea');break;case _0x4af8('0xc2'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xeb');break;default:return _0xc2dccd;}return _0xc2dccd;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index bbe338b..45ab4fb 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 _0x36cd=['../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x36cd,0x112));var _0xd36c=function(_0x44cc74,_0x426cda){_0x44cc74=_0x44cc74-0x0;var _0x8761b4=_0x36cd[_0x44cc74];return _0x8761b4;};'use strict';var EventEmitter=require(_0xd36c('0x0'));var UserProfile=require(_0xd36c('0x1'))['db'][_0xd36c('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd36c('0x3')](0x0);var events={'afterCreate':_0xd36c('0x4'),'afterUpdate':_0xd36c('0x5'),'afterDestroy':_0xd36c('0x6')};function emitEvent(_0x42fa5a){return function(_0x3eb36b,_0x2a936d,_0x47bd19){UserProfileEvents['emit'](_0x42fa5a+':'+_0x3eb36b['id'],_0x3eb36b);UserProfileEvents[_0xd36c('0x7')](_0x42fa5a,_0x3eb36b);_0x47bd19(null);};}for(var e in events){if(events[_0xd36c('0x8')](e)){var event=events[e];UserProfile[_0xd36c('0x9')](e,emitEvent(event));}}module[_0xd36c('0xa')]=UserProfileEvents; \ No newline at end of file +var _0x3ad6=['hasOwnProperty','hook','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x26ddc0,_0x573b35){var _0x68651b=function(_0x173ef1){while(--_0x173ef1){_0x26ddc0['push'](_0x26ddc0['shift']());}};_0x68651b(++_0x573b35);}(_0x3ad6,0xb6));var _0x63ad=function(_0x311a70,_0xc12dbb){_0x311a70=_0x311a70-0x0;var _0x2a4abb=_0x3ad6[_0x311a70];return _0x2a4abb;};'use strict';var EventEmitter=require(_0x63ad('0x0'));var UserProfile=require(_0x63ad('0x1'))['db'][_0x63ad('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x63ad('0x3')](0x0);var events={'afterCreate':_0x63ad('0x4'),'afterUpdate':_0x63ad('0x5'),'afterDestroy':_0x63ad('0x6')};function emitEvent(_0x29a439){return function(_0x2f5d54,_0x4331a1,_0x57d1bb){UserProfileEvents[_0x63ad('0x7')](_0x29a439+':'+_0x2f5d54['id'],_0x2f5d54);UserProfileEvents['emit'](_0x29a439,_0x2f5d54);_0x57d1bb(null);};}for(var e in events){if(events[_0x63ad('0x8')](e)){var event=events[e];UserProfile[_0x63ad('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index ca7c2f9..8e40fa3 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 _0x756d=['user_profiles','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userProfile.attributes','exports','define'];(function(_0x1772e7,_0x3be1fa){var _0x1c475e=function(_0x1ab8e7){while(--_0x1ab8e7){_0x1772e7['push'](_0x1772e7['shift']());}};_0x1c475e(++_0x3be1fa);}(_0x756d,0x112));var _0xd756=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x756d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd756('0x0'));var util=require(_0xd756('0x1'));var logger=require(_0xd756('0x2'))(_0xd756('0x3'));var moment=require(_0xd756('0x4'));var BPromise=require(_0xd756('0x5'));var rp=require(_0xd756('0x6'));var fs=require('fs');var path=require(_0xd756('0x7'));var rimraf=require('rimraf');var config=require(_0xd756('0x8'));var attributes=require(_0xd756('0x9'));module[_0xd756('0xa')]=function(_0x42ad5c,_0x637ffb){return _0x42ad5c[_0xd756('0xb')]('UserProfile',attributes,{'tableName':_0xd756('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xead5=['rimraf','./userProfile.attributes','define','UserProfile','user_profiles','lodash','../../config/logger','api','moment'];(function(_0x44ffa0,_0x35f9fe){var _0x19cf56=function(_0x3b5542){while(--_0x3b5542){_0x44ffa0['push'](_0x44ffa0['shift']());}};_0x19cf56(++_0x35f9fe);}(_0xead5,0xef));var _0x5ead=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0xead5[_0x56fb33];return _0x435ee4;};'use strict';var _=require(_0x5ead('0x0'));var util=require('util');var logger=require(_0x5ead('0x1'))(_0x5ead('0x2'));var moment=require(_0x5ead('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5ead('0x4'));var config=require('../../config/environment');var attributes=require(_0x5ead('0x5'));module['exports']=function(_0x4fef74,_0x517641){return _0x4fef74[_0x5ead('0x6')](_0x5ead('0x7'),attributes,{'tableName':_0x5ead('0x8'),'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 3153284..f0f23d1 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 _0xeda8=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xeda8,0x104));var _0x8eda=function(_0x1c05f0,_0x1f03ca){_0x1c05f0=_0x1c05f0-0x0;var _0x438425=_0xeda8[_0x1c05f0];return _0x438425;};'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});config[_0x8eda('0xd')]=_['defaults'](config[_0x8eda('0xd')],{'host':_0x8eda('0xe'),'port':0x18eb});var socket=require(_0x8eda('0xf'))(new Redis(config[_0x8eda('0xd')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x488849,_0x4fbf0a,_0xe69181){return new BPromise(function(_0x2d3739,_0x41442d){return client['request'](_0x488849,_0xe69181)[_0x8eda('0x10')](function(_0x5a80ca){logger[_0x8eda('0x11')](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));logger[_0x8eda('0x14')](_0x8eda('0x15'),_0x4fbf0a,_0x8eda('0x13'),JSON[_0x8eda('0x16')](_0x5a80ca));if(_0x5a80ca[_0x8eda('0x17')]){if(_0x5a80ca['error']['code']===0x1f4){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x41442d(_0x5a80ca[_0x8eda('0x17')][_0x8eda('0x18')]);}logger['error'](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x2d3739(_0x5a80ca['error'][_0x8eda('0x18')]);}else{logger['info'](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));_0x2d3739(_0x5a80ca['result']['message']);}})[_0x8eda('0x19')](function(_0x1b7e94){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x1b7e94);_0x41442d(_0x1b7e94);});});} \ No newline at end of file +var _0x46ed=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','info','request\x20sent','stringify','code','error','UserProfile,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring'];(function(_0x4b9e79,_0x2c5857){var _0x4c07eb=function(_0x387b72){while(--_0x387b72){_0x4b9e79['push'](_0x4b9e79['shift']());}};_0x4c07eb(++_0x2c5857);}(_0x46ed,0x168));var _0xd46e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x46ed[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});config[_0xd46e('0xb')]=_[_0xd46e('0xc')](config[_0xd46e('0xb')],{'host':_0xd46e('0xd'),'port':0x18eb});var socket=require(_0xd46e('0xe'))(new Redis(config[_0xd46e('0xb')]));require(_0xd46e('0xf'))['register'](socket);function respondWithRpcPromise(_0x7b2d69,_0x81235b,_0x50ccd3){return new BPromise(function(_0x3585e7,_0x15b5cb){return client[_0xd46e('0x10')](_0x7b2d69,_0x50ccd3)[_0xd46e('0x11')](function(_0x1ad723){logger[_0xd46e('0x12')]('UserProfile,\x20%s,\x20%s',_0x81235b,_0xd46e('0x13'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x81235b,_0xd46e('0x13'),JSON[_0xd46e('0x14')](_0x1ad723));if(_0x1ad723['error']){if(_0x1ad723['error'][_0xd46e('0x15')]===0x1f4){logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x1ad723[_0xd46e('0x16')]['message']);return _0x15b5cb(_0x1ad723[_0xd46e('0x16')][_0xd46e('0x18')]);}logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x1ad723[_0xd46e('0x16')]['message']);return _0x3585e7(_0x1ad723[_0xd46e('0x16')][_0xd46e('0x18')]);}else{logger[_0xd46e('0x12')]('UserProfile,\x20%s,\x20%s',_0x81235b,'request\x20sent');_0x3585e7(_0x1ad723[_0xd46e('0x19')][_0xd46e('0x18')]);}})['catch'](function(_0x4fd1f2){logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x4fd1f2);_0x15b5cb(_0x4fd1f2);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 853d879..fd7f938 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 _0xbc80=['./userProfile.events','remove','register','length'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbc80,0x180));var _0x0bc8=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xbc80[_0x344a3f];return _0x264712;};'use strict';var UserProfileEvents=require(_0x0bc8('0x0'));var events=['save',_0x0bc8('0x1'),'update'];function createListener(_0x307218,_0x269b39){return function(_0x5b4389){_0x269b39['emit'](_0x307218,_0x5b4389);};}function removeListener(_0x419186,_0xbf28a4){return function(){UserProfileEvents['removeListener'](_0x419186,_0xbf28a4);};}exports[_0x0bc8('0x2')]=function(_0x3dfeb0){for(var _0x88cd5f=0x0,_0x53f757=events[_0x0bc8('0x3')];_0x88cd5f<_0x53f757;_0x88cd5f++){var _0x35a367=events[_0x88cd5f];var _0x20d78d=createListener('userProfile:'+_0x35a367,_0x3dfeb0);UserProfileEvents['on'](_0x35a367,_0x20d78d);}}; \ No newline at end of file +var _0x86b0=['removeListener','register','userProfile:','save','update','emit'];(function(_0x361762,_0x466f6e){var _0x2bf5c1=function(_0x253c7f){while(--_0x253c7f){_0x361762['push'](_0x361762['shift']());}};_0x2bf5c1(++_0x466f6e);}(_0x86b0,0x15f));var _0x086b=function(_0x3b78bc,_0x44fc89){_0x3b78bc=_0x3b78bc-0x0;var _0x4ac63a=_0x86b0[_0x3b78bc];return _0x4ac63a;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x086b('0x0'),'remove',_0x086b('0x1')];function createListener(_0x4a50c2,_0x36beae){return function(_0x22bb23){_0x36beae[_0x086b('0x2')](_0x4a50c2,_0x22bb23);};}function removeListener(_0x4de36f,_0x751856){return function(){UserProfileEvents[_0x086b('0x3')](_0x4de36f,_0x751856);};}exports[_0x086b('0x4')]=function(_0x4741a7){for(var _0x57b2ea=0x0,_0xe4d31d=events['length'];_0x57b2ea<_0xe4d31d;_0x57b2ea++){var _0x56d0e6=events[_0x57b2ea];var _0x5acd58=createListener(_0x086b('0x5')+_0x56d0e6,_0x4741a7);UserProfileEvents['on'](_0x56d0e6,_0x5acd58);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index da1242a..d9484ea 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 _0x3e05=['put','/:id','update','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','show','post','create'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x3e05,0x64));var _0x53e0=function(_0x393575,_0x18ec1f){_0x393575=_0x393575-0x0;var _0x358396=_0x3e05[_0x393575];return _0x358396;};'use strict';var multer=require('multer');var util=require(_0x53e0('0x0'));var path=require(_0x53e0('0x1'));var timeout=require(_0x53e0('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x53e0('0x3'));var interaction=require(_0x53e0('0x4'));var config=require(_0x53e0('0x5'));var controller=require(_0x53e0('0x6'));router[_0x53e0('0x7')]('/',auth[_0x53e0('0x8')](),controller[_0x53e0('0x9')]);router[_0x53e0('0x7')](_0x53e0('0xa'),auth[_0x53e0('0x8')](),controller['describe']);router[_0x53e0('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x53e0('0xb')]);router[_0x53e0('0xc')]('/',auth[_0x53e0('0x8')](),controller[_0x53e0('0xd')]);router[_0x53e0('0xe')](_0x53e0('0xf'),auth[_0x53e0('0x8')](),controller[_0x53e0('0x10')]);router['delete'](_0x53e0('0xf'),auth[_0x53e0('0x8')](),controller[_0x53e0('0x11')]);module[_0x53e0('0x12')]=router; \ No newline at end of file +var _0x9ffd=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer'];(function(_0x3a93ff,_0x2cca55){var _0x3af771=function(_0x13fd79){while(--_0x13fd79){_0x3a93ff['push'](_0x3a93ff['shift']());}};_0x3af771(++_0x2cca55);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2ab617,_0x4b0576){_0x2ab617=_0x2ab617-0x0;var _0xdead2e=_0x9ffd[_0x2ab617];return _0xdead2e;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var auth=require(_0xd9ff('0x5'));var interaction=require(_0xd9ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ff('0x7'));router[_0xd9ff('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9ff('0x9')]);router[_0xd9ff('0x8')](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xc')]);router[_0xd9ff('0x8')](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0x10')](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('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 5936fa2..782a1bd 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 _0x6a5f=['sequelize','exports','INTEGER'];(function(_0x3cdba4,_0x38853d){var _0x5b35bc=function(_0x3d77e7){while(--_0x3d77e7){_0x3cdba4['push'](_0x3cdba4['shift']());}};_0x5b35bc(++_0x38853d);}(_0x6a5f,0x81));var _0xf6a5=function(_0x44d797,_0x276017){_0x44d797=_0x44d797-0x0;var _0x4005c2=_0x6a5f[_0x44d797];return _0x4005c2;};'use strict';var Sequelize=require(_0xf6a5('0x0'));module[_0xf6a5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf6a5('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0cad=['STRING','INTEGER','sequelize'];(function(_0x207061,_0xe38cda){var _0x4a2833=function(_0x16906e){while(--_0x16906e){_0x207061['push'](_0x207061['shift']());}};_0x4a2833(++_0xe38cda);}(_0x0cad,0xf8));var _0xd0ca=function(_0x6470a2,_0x3b5f44){_0x6470a2=_0x6470a2-0x0;var _0x24ac61=_0x0cad[_0x6470a2];return _0x24ac61;};'use strict';var Sequelize=require(_0xd0ca('0x0'));module['exports']={'name':{'type':Sequelize[_0xd0ca('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xd0ca('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd0ca('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 00d66dc..3d0c75b 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 _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','intersection','options','catch','create','body','find','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x466468,_0x4c4af4){var _0x44756c=function(_0x2b1196){while(--_0x2b1196){_0x466468['push'](_0x466468['shift']());}};_0x44756c(++_0x4c4af4);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0x24ca[_0x4b1032];return _0x5a1d55;};'use strict';var pdf=require(_0xa24c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa24c('0x1'));var zipdir=require(_0xa24c('0x2'));var jsonpatch=require(_0xa24c('0x3'));var rp=require('request-promise');var moment=require(_0xa24c('0x4'));var BPromise=require(_0xa24c('0x5'));var Mustache=require(_0xa24c('0x6'));var util=require(_0xa24c('0x7'));var path=require(_0xa24c('0x8'));var sox=require(_0xa24c('0x9'));var csv=require(_0xa24c('0xa'));var ejs=require(_0xa24c('0xb'));var fs=require('fs');var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0xa'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43bcd3,_0x11090c){_0x11090c=_0x11090c||0xcc;return function(_0xcee4fe){if(_0xcee4fe){return _0x43bcd3[_0xa24c('0x1a')](_0x11090c);}return _0x43bcd3['status'](_0x11090c)[_0xa24c('0x1b')]();};}function respondWithResult(_0x3c23fc,_0x26ff28){_0x26ff28=_0x26ff28||0xc8;return function(_0x2fcd8b){if(_0x2fcd8b){return _0x3c23fc[_0xa24c('0x1c')](_0x26ff28)[_0xa24c('0x1d')](_0x2fcd8b);}};}function respondWithFilteredResult(_0x448275,_0x5d4727){return function(_0x47a063){if(_0x47a063){var _0xb80781=_0x47a063[_0xa24c('0x1e')],_0x87aa90=_0x5d4727[_0xa24c('0x1f')],_0x49ce53=_0x5d4727['offset']+_0x5d4727[_0xa24c('0x20')],_0x5babb5;if(_0x49ce53>=_0xb80781){_0x49ce53=_0xb80781;_0x5babb5=0xc8;}else{_0x5babb5=0xce;}_0x448275['status'](_0x5babb5);return _0x448275[_0xa24c('0x21')](_0xa24c('0x22'),_0x87aa90+'-'+_0x49ce53+'/'+_0xb80781)[_0xa24c('0x1d')](_0x47a063);}return null;};}function patchUpdates(_0xefdbd9){return function(_0x4ff97c){try{jsonpatch[_0xa24c('0x23')](_0x4ff97c,_0xefdbd9,!![]);}catch(_0x18b7e0){return BPromise[_0xa24c('0x24')](_0x18b7e0);}return _0x4ff97c['save']();};}function saveUpdates(_0x48a768,_0x506424){return function(_0x4cd77e){if(_0x4cd77e){return _0x4cd77e[_0xa24c('0x25')](_0x48a768)[_0xa24c('0x26')](function(_0x26e9c3){return _0x26e9c3;});}return null;};}function removeEntity(_0x180297,_0x51a275){return function(_0x30ec21){if(_0x30ec21){return _0x30ec21['destroy']()[_0xa24c('0x26')](function(){_0x180297[_0xa24c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(!_0x43a0c0){_0x346ee8[_0xa24c('0x1a')](0x194);}return _0x43a0c0;};}function handleError(_0x14cc65,_0x47e0eb){_0x47e0eb=_0x47e0eb||0x1f4;return function(_0xec9167){logger['error'](_0xec9167[_0xa24c('0x27')]);if(_0xec9167[_0xa24c('0x28')]){delete _0xec9167[_0xa24c('0x28')];}_0x14cc65['status'](_0x47e0eb)[_0xa24c('0x29')](_0xec9167);};}exports[_0xa24c('0x2a')]=function(_0x14fd5a,_0x314121){var _0x11e4e0={},_0x3ad0e6={},_0x39609a={'count':0x0,'rows':[]};var _0x5b23f4=_[_0xa24c('0x2b')](db[_0xa24c('0x2c')][_0xa24c('0x2d')],function(_0x12dbdc){return{'name':_0x12dbdc['fieldName'],'type':_0x12dbdc[_0xa24c('0x2e')][_0xa24c('0x2f')]};});_0x3ad0e6[_0xa24c('0x30')]=_['map'](_0x5b23f4,_0xa24c('0x28'));_0x3ad0e6[_0xa24c('0x31')]=_[_0xa24c('0x32')](_0x14fd5a['query']);_0x3ad0e6[_0xa24c('0x33')]=_['intersection'](_0x3ad0e6[_0xa24c('0x30')],_0x3ad0e6[_0xa24c('0x31')]);_0x11e4e0[_0xa24c('0x34')]=_['intersection'](_0x3ad0e6[_0xa24c('0x30')],qs[_0xa24c('0x35')](_0x14fd5a[_0xa24c('0x31')]['fields']));_0x11e4e0[_0xa24c('0x34')]=_0x11e4e0['attributes'][_0xa24c('0x36')]?_0x11e4e0[_0xa24c('0x34')]:_0x3ad0e6['model'];if(!_0x14fd5a['query'][_0xa24c('0x37')](_0xa24c('0x38'))){_0x11e4e0[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x14fd5a[_0xa24c('0x31')][_0xa24c('0x20')]);_0x11e4e0[_0xa24c('0x1f')]=qs['offset'](_0x14fd5a[_0xa24c('0x31')][_0xa24c('0x1f')]);}_0x11e4e0[_0xa24c('0x39')]=qs[_0xa24c('0x3a')](_0x14fd5a[_0xa24c('0x31')][_0xa24c('0x3a')]);_0x11e4e0[_0xa24c('0x3b')]=qs[_0xa24c('0x33')](_[_0xa24c('0x3c')](_0x14fd5a[_0xa24c('0x31')],_0x3ad0e6['filters']),_0x5b23f4);if(_0x14fd5a[_0xa24c('0x31')][_0xa24c('0x3d')]){_0x11e4e0[_0xa24c('0x3b')]=_[_0xa24c('0x3e')](_0x11e4e0['where'],{'$or':_['map'](_0x5b23f4,function(_0x19a65f){if(_0x19a65f['type']!==_0xa24c('0x3f')){var _0x13f272={};_0x13f272[_0x19a65f[_0xa24c('0x28')]]={'$like':'%'+_0x14fd5a[_0xa24c('0x31')][_0xa24c('0x3d')]+'%'};return _0x13f272;}})});}_0x11e4e0=_['merge']({},_0x11e4e0,_0x14fd5a['options']);var _0x3121e={'where':_0x11e4e0[_0xa24c('0x3b')]};return db[_0xa24c('0x2c')][_0xa24c('0x1e')](_0x3121e)[_0xa24c('0x26')](function(_0x472912){_0x39609a['count']=_0x472912;if(_0x14fd5a['query'][_0xa24c('0x40')]){_0x11e4e0[_0xa24c('0x41')]=[{'all':!![]}];}return db[_0xa24c('0x2c')][_0xa24c('0x42')](_0x11e4e0);})[_0xa24c('0x26')](function(_0x4c5b7e){_0x39609a[_0xa24c('0x43')]=_0x4c5b7e;return _0x39609a;})[_0xa24c('0x26')](respondWithFilteredResult(_0x314121,_0x11e4e0))['catch'](handleError(_0x314121,null));};exports['show']=function(_0xba7407,_0x44f6ae){var _0x231eea={'raw':![],'where':{'id':_0xba7407['params']['id']}},_0x537849={};_0x537849[_0xa24c('0x30')]=_[_0xa24c('0x32')](db[_0xa24c('0x2c')][_0xa24c('0x2d')]);_0x537849[_0xa24c('0x31')]=_[_0xa24c('0x32')](_0xba7407[_0xa24c('0x31')]);_0x537849[_0xa24c('0x33')]=_['intersection'](_0x537849['model'],_0x537849[_0xa24c('0x31')]);_0x231eea[_0xa24c('0x34')]=_[_0xa24c('0x44')](_0x537849['model'],qs[_0xa24c('0x35')](_0xba7407[_0xa24c('0x31')][_0xa24c('0x35')]));_0x231eea[_0xa24c('0x34')]=_0x231eea[_0xa24c('0x34')][_0xa24c('0x36')]?_0x231eea[_0xa24c('0x34')]:_0x537849[_0xa24c('0x30')];if(_0xba7407[_0xa24c('0x31')][_0xa24c('0x40')]){_0x231eea['include']=[{'all':!![]}];}_0x231eea=_[_0xa24c('0x3e')]({},_0x231eea,_0xba7407[_0xa24c('0x45')]);return db[_0xa24c('0x2c')]['find'](_0x231eea)[_0xa24c('0x26')](handleEntityNotFound(_0x44f6ae,null))[_0xa24c('0x26')](respondWithResult(_0x44f6ae,null))[_0xa24c('0x46')](handleError(_0x44f6ae,null));};exports[_0xa24c('0x47')]=function(_0x3918a6,_0x16d340){return db[_0xa24c('0x2c')][_0xa24c('0x47')](_0x3918a6[_0xa24c('0x48')],{})[_0xa24c('0x26')](respondWithResult(_0x16d340,0xc9))[_0xa24c('0x46')](handleError(_0x16d340,null));};exports['update']=function(_0x29a84d,_0x96b977){if(_0x29a84d[_0xa24c('0x48')]['id']){delete _0x29a84d[_0xa24c('0x48')]['id'];}return db[_0xa24c('0x2c')][_0xa24c('0x49')]({'where':{'id':_0x29a84d[_0xa24c('0x4a')]['id']}})[_0xa24c('0x26')](handleEntityNotFound(_0x96b977,null))[_0xa24c('0x26')](saveUpdates(_0x29a84d['body'],null))['then'](respondWithResult(_0x96b977,null))[_0xa24c('0x46')](handleError(_0x96b977,null));};exports['destroy']=function(_0xc078ef,_0x1f436c){return db['UserProfileResource'][_0xa24c('0x49')]({'where':{'id':_0xc078ef[_0xa24c('0x4a')]['id']}})[_0xa24c('0x26')](handleEntityNotFound(_0x1f436c,null))['then'](removeEntity(_0x1f436c,null))['catch'](handleError(_0x1f436c,null));};exports[_0xa24c('0x4b')]=function(_0x5ba726,_0x4769a1){return db[_0xa24c('0x2c')][_0xa24c('0x4b')]()[_0xa24c('0x26')](respondWithResult(_0x4769a1,null))[_0xa24c('0x46')](handleError(_0x4769a1,null));}; \ No newline at end of file +var _0x008c=['sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','destroy','then','name','send','index','map','UserProfileResource','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x17b20b,_0x4c3299){var _0x107f0b=function(_0x3488ad){while(--_0x3488ad){_0x17b20b['push'](_0x17b20b['shift']());}};_0x107f0b(++_0x4c3299);}(_0x008c,0x188));var _0xc008=function(_0x5bce33,_0x4a4b06){_0x5bce33=_0x5bce33-0x0;var _0x15bc20=_0x008c[_0x5bce33];return _0x15bc20;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];function respondWithStatusCode(_0x2a5b4e,_0x9ffa93){_0x9ffa93=_0x9ffa93||0xcc;return function(_0x1819c6){if(_0x1819c6){return _0x2a5b4e[_0xc008('0x17')](_0x9ffa93);}return _0x2a5b4e['status'](_0x9ffa93)['end']();};}function respondWithResult(_0x33f44c,_0x50c1ab){_0x50c1ab=_0x50c1ab||0xc8;return function(_0x25e13f){if(_0x25e13f){return _0x33f44c[_0xc008('0x18')](_0x50c1ab)[_0xc008('0x19')](_0x25e13f);}};}function respondWithFilteredResult(_0x339ffc,_0x3f0ecf){return function(_0x5ee00b){if(_0x5ee00b){var _0x5e894e=_0x5ee00b[_0xc008('0x1a')],_0x4bd0f4=_0x3f0ecf[_0xc008('0x1b')],_0x11ef38=_0x3f0ecf['offset']+_0x3f0ecf['limit'],_0x15a6ad;if(_0x11ef38>=_0x5e894e){_0x11ef38=_0x5e894e;_0x15a6ad=0xc8;}else{_0x15a6ad=0xce;}_0x339ffc['status'](_0x15a6ad);return _0x339ffc['set'](_0xc008('0x1c'),_0x4bd0f4+'-'+_0x11ef38+'/'+_0x5e894e)[_0xc008('0x19')](_0x5ee00b);}return null;};}function patchUpdates(_0x501137){return function(_0x813397){try{jsonpatch['apply'](_0x813397,_0x501137,!![]);}catch(_0x4bd611){return BPromise['reject'](_0x4bd611);}return _0x813397['save']();};}function saveUpdates(_0x5754a0,_0x4b9726){return function(_0x5560b1){if(_0x5560b1){return _0x5560b1['update'](_0x5754a0)['then'](function(_0x5a58bd){return _0x5a58bd;});}return null;};}function removeEntity(_0x13a263,_0x4777a6){return function(_0x251db2){if(_0x251db2){return _0x251db2[_0xc008('0x1d')]()[_0xc008('0x1e')](function(){_0x13a263[_0xc008('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(!_0x58a6ea){_0x459fd9[_0xc008('0x17')](0x194);}return _0x58a6ea;};}function handleError(_0x36f358,_0x2e3cfb){_0x2e3cfb=_0x2e3cfb||0x1f4;return function(_0x3cb28c){logger['error'](_0x3cb28c['stack']);if(_0x3cb28c['name']){delete _0x3cb28c[_0xc008('0x1f')];}_0x36f358[_0xc008('0x18')](_0x2e3cfb)[_0xc008('0x20')](_0x3cb28c);};}exports[_0xc008('0x21')]=function(_0x5bebd9,_0x5e2aca){var _0x4fce9c={},_0x4adbab={},_0x4caaf4={'count':0x0,'rows':[]};var _0x3865c0=_[_0xc008('0x22')](db[_0xc008('0x23')]['rawAttributes'],function(_0x24c14c){return{'name':_0x24c14c[_0xc008('0x24')],'type':_0x24c14c[_0xc008('0x25')][_0xc008('0x26')]};});_0x4adbab['model']=_[_0xc008('0x22')](_0x3865c0,_0xc008('0x1f'));_0x4adbab['query']=_['keys'](_0x5bebd9['query']);_0x4adbab[_0xc008('0x27')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],_0x4adbab[_0xc008('0x2a')]);_0x4fce9c[_0xc008('0x2b')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2c')]));_0x4fce9c[_0xc008('0x2b')]=_0x4fce9c[_0xc008('0x2b')]['length']?_0x4fce9c[_0xc008('0x2b')]:_0x4adbab[_0xc008('0x29')];if(!_0x5bebd9['query'][_0xc008('0x2d')](_0xc008('0x2e'))){_0x4fce9c[_0xc008('0x2f')]=qs[_0xc008('0x2f')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2f')]);_0x4fce9c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x5bebd9[_0xc008('0x2a')]['offset']);}_0x4fce9c[_0xc008('0x30')]=qs[_0xc008('0x31')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x31')]);_0x4fce9c[_0xc008('0x32')]=qs[_0xc008('0x27')](_[_0xc008('0x33')](_0x5bebd9['query'],_0x4adbab[_0xc008('0x27')]),_0x3865c0);if(_0x5bebd9[_0xc008('0x2a')]['filter']){_0x4fce9c[_0xc008('0x32')]=_[_0xc008('0x34')](_0x4fce9c['where'],{'$or':_[_0xc008('0x22')](_0x3865c0,function(_0x2e4ae1){if(_0x2e4ae1[_0xc008('0x25')]!=='VIRTUAL'){var _0x53b353={};_0x53b353[_0x2e4ae1['name']]={'$like':'%'+_0x5bebd9[_0xc008('0x2a')]['filter']+'%'};return _0x53b353;}})});}_0x4fce9c=_[_0xc008('0x34')]({},_0x4fce9c,_0x5bebd9[_0xc008('0x35')]);var _0x6a4ccb={'where':_0x4fce9c[_0xc008('0x32')]};return db[_0xc008('0x23')][_0xc008('0x1a')](_0x6a4ccb)[_0xc008('0x1e')](function(_0x35b496){_0x4caaf4[_0xc008('0x1a')]=_0x35b496;if(_0x5bebd9[_0xc008('0x2a')][_0xc008('0x36')]){_0x4fce9c[_0xc008('0x37')]=[{'all':!![]}];}return db[_0xc008('0x23')][_0xc008('0x38')](_0x4fce9c);})['then'](function(_0x3238b4){_0x4caaf4[_0xc008('0x39')]=_0x3238b4;return _0x4caaf4;})[_0xc008('0x1e')](respondWithFilteredResult(_0x5e2aca,_0x4fce9c))[_0xc008('0x3a')](handleError(_0x5e2aca,null));};exports['show']=function(_0x2c4964,_0x15396b){var _0xc8cb91={'raw':![],'where':{'id':_0x2c4964[_0xc008('0x3b')]['id']}},_0x36e7ae={};_0x36e7ae['model']=_[_0xc008('0x3c')](db[_0xc008('0x23')][_0xc008('0x3d')]);_0x36e7ae[_0xc008('0x2a')]=_[_0xc008('0x3c')](_0x2c4964['query']);_0x36e7ae[_0xc008('0x27')]=_[_0xc008('0x28')](_0x36e7ae[_0xc008('0x29')],_0x36e7ae[_0xc008('0x2a')]);_0xc8cb91['attributes']=_[_0xc008('0x28')](_0x36e7ae[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x2c4964['query'][_0xc008('0x2c')]));_0xc8cb91['attributes']=_0xc8cb91[_0xc008('0x2b')]['length']?_0xc8cb91[_0xc008('0x2b')]:_0x36e7ae[_0xc008('0x29')];if(_0x2c4964['query'][_0xc008('0x36')]){_0xc8cb91[_0xc008('0x37')]=[{'all':!![]}];}_0xc8cb91=_[_0xc008('0x34')]({},_0xc8cb91,_0x2c4964['options']);return db[_0xc008('0x23')][_0xc008('0x3e')](_0xc8cb91)[_0xc008('0x1e')](handleEntityNotFound(_0x15396b,null))[_0xc008('0x1e')](respondWithResult(_0x15396b,null))[_0xc008('0x3a')](handleError(_0x15396b,null));};exports[_0xc008('0x3f')]=function(_0x59ca2b,_0x47cafa){return db['UserProfileResource'][_0xc008('0x3f')](_0x59ca2b[_0xc008('0x40')],{})[_0xc008('0x1e')](respondWithResult(_0x47cafa,0xc9))[_0xc008('0x3a')](handleError(_0x47cafa,null));};exports[_0xc008('0x41')]=function(_0x24f6a4,_0x2cf641){if(_0x24f6a4[_0xc008('0x40')]['id']){delete _0x24f6a4['body']['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x24f6a4[_0xc008('0x3b')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x2cf641,null))[_0xc008('0x1e')](saveUpdates(_0x24f6a4['body'],null))[_0xc008('0x1e')](respondWithResult(_0x2cf641,null))[_0xc008('0x3a')](handleError(_0x2cf641,null));};exports[_0xc008('0x1d')]=function(_0x1c2c50,_0x4981b4){return db[_0xc008('0x23')][_0xc008('0x3e')]({'where':{'id':_0x1c2c50[_0xc008('0x3b')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1e')](removeEntity(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports['describe']=function(_0x223056,_0x51cb14){return db[_0xc008('0x23')][_0xc008('0x42')]()[_0xc008('0x1e')](respondWithResult(_0x51cb14,null))['catch'](handleError(_0x51cb14,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 7eae37c..f484b4e 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 _0x878f=['rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x7550b2,_0xb765da){var _0x412744=function(_0x23b420){while(--_0x23b420){_0x7550b2['push'](_0x7550b2['shift']());}};_0x412744(++_0xb765da);}(_0x878f,0x173));var _0xf878=function(_0x5e8b95,_0x2ae446){_0x5e8b95=_0x5e8b95-0x0;var _0x43fe06=_0x878f[_0x5e8b95];return _0x43fe06;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var BPromise=require(_0xf878('0x4'));var rp=require(_0xf878('0x5'));var fs=require('fs');var path=require(_0xf878('0x6'));var rimraf=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var attributes=require(_0xf878('0x9'));module[_0xf878('0xa')]=function(_0x4bc9aa,_0x4ac8d8){return _0x4bc9aa[_0xf878('0xb')](_0xf878('0xc'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0xf878('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f7a=['request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x526ad6,_0x30a50a){_0x526ad6=_0x526ad6-0x0;var _0x2a327e=_0x6f7a[_0x526ad6];return _0x2a327e;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var moment=require('moment');var BPromise=require(_0xa6f7('0x4'));var rp=require(_0xa6f7('0x5'));var fs=require('fs');var path=require(_0xa6f7('0x6'));var rimraf=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var attributes=require(_0xa6f7('0x9'));module[_0xa6f7('0xa')]=function(_0x20cccd,_0x1fdd5f){return _0x20cccd[_0xa6f7('0xb')](_0xa6f7('0xc'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xa6f7('0xd'),_0xa6f7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 582006d..f0e897c 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 _0xae7a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0x260e11,_0x81e165){var _0x317605=function(_0x369ba2){while(--_0x369ba2){_0x260e11['push'](_0x260e11['shift']());}};_0x317605(++_0x81e165);}(_0xae7a,0x98));var _0xaae7=function(_0x242f4d,_0x5ee66c){_0x242f4d=_0x242f4d-0x0;var _0x281b98=_0xae7a[_0x242f4d];return _0x281b98;};'use strict';var _=require('lodash');var util=require(_0xaae7('0x0'));var moment=require(_0xaae7('0x1'));var BPromise=require(_0xaae7('0x2'));var rs=require(_0xaae7('0x3'));var fs=require('fs');var Redis=require(_0xaae7('0x4'));var db=require(_0xaae7('0x5'))['db'];var utils=require(_0xaae7('0x6'));var logger=require(_0xaae7('0x7'))('rpc');var config=require(_0xaae7('0x8'));var jayson=require(_0xaae7('0x9'));var client=jayson['client'][_0xaae7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d0d71,_0x16c0e2,_0x328a02){return new BPromise(function(_0x3c9236,_0x1dbe98){return client[_0xaae7('0xb')](_0x1d0d71,_0x328a02)['then'](function(_0x5d2194){logger[_0xaae7('0xc')](_0xaae7('0xd'),_0x16c0e2,_0xaae7('0xe'));logger[_0xaae7('0xf')](_0xaae7('0x10'),_0x16c0e2,_0xaae7('0xe'),JSON[_0xaae7('0x11')](_0x5d2194));if(_0x5d2194[_0xaae7('0x12')]){if(_0x5d2194[_0xaae7('0x12')][_0xaae7('0x13')]===0x1f4){logger['error'](_0xaae7('0xd'),_0x16c0e2,_0x5d2194['error']['message']);return _0x1dbe98(_0x5d2194[_0xaae7('0x12')][_0xaae7('0x14')]);}logger[_0xaae7('0x12')](_0xaae7('0xd'),_0x16c0e2,_0x5d2194[_0xaae7('0x12')]['message']);return _0x3c9236(_0x5d2194['error']['message']);}else{logger[_0xaae7('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x16c0e2,'request\x20sent');_0x3c9236(_0x5d2194['result'][_0xaae7('0x14')]);}})[_0xaae7('0x15')](function(_0x6d1773){logger[_0xaae7('0x12')](_0xaae7('0xd'),_0x16c0e2,_0x6d1773);_0x1dbe98(_0x6d1773);});});} \ No newline at end of file +var _0xabbe=['http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabbe,0x70));var _0xeabb=function(_0x245250,_0x9a88e4){_0x245250=_0x245250-0x0;var _0x47f0ff=_0xabbe[_0x245250];return _0x47f0ff;};'use strict';var _=require(_0xeabb('0x0'));var util=require('util');var moment=require(_0xeabb('0x1'));var BPromise=require('bluebird');var rs=require(_0xeabb('0x2'));var fs=require('fs');var Redis=require(_0xeabb('0x3'));var db=require(_0xeabb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeabb('0x5'));var config=require(_0xeabb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xeabb('0x7')][_0xeabb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x534e4d,_0x3867b5,_0x17386a){return new BPromise(function(_0xe64536,_0x3a7a9c){return client[_0xeabb('0x9')](_0x534e4d,_0x17386a)['then'](function(_0x5ea9c9){logger[_0xeabb('0xa')](_0xeabb('0xb'),_0x3867b5,_0xeabb('0xc'));logger['debug'](_0xeabb('0xd'),_0x3867b5,_0xeabb('0xc'),JSON[_0xeabb('0xe')](_0x5ea9c9));if(_0x5ea9c9[_0xeabb('0xf')]){if(_0x5ea9c9[_0xeabb('0xf')][_0xeabb('0x10')]===0x1f4){logger['error'](_0xeabb('0xb'),_0x3867b5,_0x5ea9c9['error'][_0xeabb('0x11')]);return _0x3a7a9c(_0x5ea9c9[_0xeabb('0xf')][_0xeabb('0x11')]);}logger[_0xeabb('0xf')](_0xeabb('0xb'),_0x3867b5,_0x5ea9c9[_0xeabb('0xf')][_0xeabb('0x11')]);return _0xe64536(_0x5ea9c9['error'][_0xeabb('0x11')]);}else{logger['info'](_0xeabb('0xb'),_0x3867b5,'request\x20sent');_0xe64536(_0x5ea9c9[_0xeabb('0x12')][_0xeabb('0x11')]);}})[_0xeabb('0x13')](function(_0x3a5879){logger[_0xeabb('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x3867b5,_0x3a5879);_0x3a7a9c(_0x3a5879);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 621a1cc..1742297 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 _0x842a=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','put'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x842a,0x181));var _0xa842=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x842a[_0x5a60ce];return _0x393e5e;};'use strict';var multer=require(_0xa842('0x0'));var util=require(_0xa842('0x1'));var path=require(_0xa842('0x2'));var timeout=require(_0xa842('0x3'));var express=require(_0xa842('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa842('0x5'));var config=require(_0xa842('0x6'));var controller=require(_0xa842('0x7'));router[_0xa842('0x8')]('/',auth[_0xa842('0x9')](),controller[_0xa842('0xa')]);router[_0xa842('0x8')](_0xa842('0xb'),auth['isAuthenticated'](),controller[_0xa842('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa842('0xd')]);router['post']('/',auth[_0xa842('0x9')](),controller['create']);router[_0xa842('0xe')](_0xa842('0xf'),auth[_0xa842('0x9')](),controller[_0xa842('0x10')]);router[_0xa842('0x11')]('/:id',auth[_0xa842('0x9')](),controller[_0xa842('0x12')]);module[_0xa842('0x13')]=router; \ No newline at end of file +var _0xfe72=['../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5d8c1d,_0xe2218e){var _0xe18d8f=function(_0x3f9270){while(--_0x3f9270){_0x5d8c1d['push'](_0x5d8c1d['shift']());}};_0xe18d8f(++_0xe2218e);}(_0xfe72,0x1a3));var _0x2fe7=function(_0x24b9e9,_0x4edca9){_0x24b9e9=_0x24b9e9-0x0;var _0x3e495d=_0xfe72[_0x24b9e9];return _0x3e495d;};'use strict';var multer=require(_0x2fe7('0x0'));var util=require(_0x2fe7('0x1'));var path=require(_0x2fe7('0x2'));var timeout=require(_0x2fe7('0x3'));var express=require(_0x2fe7('0x4'));var router=express[_0x2fe7('0x5')]();var auth=require(_0x2fe7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x2fe7('0x7')]('/',auth[_0x2fe7('0x8')](),controller['index']);router[_0x2fe7('0x7')](_0x2fe7('0x9'),auth[_0x2fe7('0x8')](),controller[_0x2fe7('0xa')]);router[_0x2fe7('0x7')](_0x2fe7('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2fe7('0xc')]('/',auth[_0x2fe7('0x8')](),controller[_0x2fe7('0xd')]);router['put'](_0x2fe7('0xb'),auth[_0x2fe7('0x8')](),controller['update']);router[_0x2fe7('0xe')](_0x2fe7('0xb'),auth[_0x2fe7('0x8')](),controller[_0x2fe7('0xf')]);module[_0x2fe7('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 0b5baad..fe4b8bf 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 _0x78d8=['setDataValue','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x78d8,0x15c));var _0x878d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x78d8[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x878d('0x0')]={'name':{'type':Sequelize[_0x878d('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x878d('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x45ee75){this[_0x878d('0x2')](_0x878d('0x3'),_0x45ee75?_0x45ee75[_0x878d('0x4')](''):[]);},'get':function(){return this[_0x878d('0x5')](_0x878d('0x3'))?this[_0x878d('0x5')](_0x878d('0x3'))[_0x878d('0x6')](''):[];}}}; \ No newline at end of file +var _0x8da5=['crudPermissions','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue'];(function(_0x16ec32,_0x4a61c8){var _0xcc8578=function(_0x35cb76){while(--_0x35cb76){_0x16ec32['push'](_0x16ec32['shift']());}};_0xcc8578(++_0x4a61c8);}(_0x8da5,0x71));var _0x58da=function(_0x32cfd9,_0x16347b){_0x32cfd9=_0x32cfd9-0x0;var _0x26c6e2=_0x8da5[_0x32cfd9];return _0x26c6e2;};'use strict';var Sequelize=require(_0x58da('0x0'));module['exports']={'name':{'type':Sequelize[_0x58da('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x58da('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x58da('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x58da('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x58da('0x1')],'set':function(_0x17670a){this[_0x58da('0x4')]('crudPermissions',_0x17670a?_0x17670a[_0x58da('0x5')](''):[]);},'get':function(){return this[_0x58da('0x6')](_0x58da('0x7'))?this[_0x58da('0x6')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index f493ab0..944b8cb 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 _0x13c0=['offset','limit','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','map','UserProfileSection','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','update','body','destroy','params','describe','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','json','count'];(function(_0x5c805a,_0xcdbdbc){var _0x13e151=function(_0x29828a){while(--_0x29828a){_0x5c805a['push'](_0x5c805a['shift']());}};_0x13e151(++_0xcdbdbc);}(_0x13c0,0x79));var _0x013c=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x13c0[_0x3ab9ee];return _0x82ee88;};'use strict';var pdf=require(_0x013c('0x0'));var emlformat=require(_0x013c('0x1'));var rimraf=require(_0x013c('0x2'));var zipdir=require(_0x013c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x013c('0x4'));var Mustache=require(_0x013c('0x5'));var util=require(_0x013c('0x6'));var path=require(_0x013c('0x7'));var sox=require(_0x013c('0x8'));var csv=require(_0x013c('0x9'));var ejs=require(_0x013c('0xa'));var fs=require('fs');var _=require(_0x013c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x013c('0xc'));var toCsv=require(_0x013c('0x9'));var querystring=require('querystring');var Papa=require(_0x013c('0xd'));var Redis=require(_0x013c('0xe'));var authService=require(_0x013c('0xf'));var qs=require(_0x013c('0x10'));var as=require(_0x013c('0x11'));var hardwareService=require(_0x013c('0x12'));var logger=require(_0x013c('0x13'))(_0x013c('0x14'));var utils=require(_0x013c('0x15'));var config=require(_0x013c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54aba0,_0xce456f){_0xce456f=_0xce456f||0xcc;return function(_0x4631c5){if(_0x4631c5){return _0x54aba0[_0x013c('0x17')](_0xce456f);}return _0x54aba0[_0x013c('0x18')](_0xce456f)['end']();};}function respondWithResult(_0x29c12f,_0x2313de){_0x2313de=_0x2313de||0xc8;return function(_0xcfe81a){if(_0xcfe81a){return _0x29c12f[_0x013c('0x18')](_0x2313de)[_0x013c('0x19')](_0xcfe81a);}};}function respondWithFilteredResult(_0x57f017,_0x307f34){return function(_0x1c2e11){if(_0x1c2e11){var _0x84244=_0x1c2e11[_0x013c('0x1a')],_0x92c3ca=_0x307f34[_0x013c('0x1b')],_0x1a5e16=_0x307f34[_0x013c('0x1b')]+_0x307f34[_0x013c('0x1c')],_0x1038d6;if(_0x1a5e16>=_0x84244){_0x1a5e16=_0x84244;_0x1038d6=0xc8;}else{_0x1038d6=0xce;}_0x57f017[_0x013c('0x18')](_0x1038d6);return _0x57f017[_0x013c('0x1d')](_0x013c('0x1e'),_0x92c3ca+'-'+_0x1a5e16+'/'+_0x84244)['json'](_0x1c2e11);}return null;};}function patchUpdates(_0x59bcbe){return function(_0x42d0a1){try{jsonpatch[_0x013c('0x1f')](_0x42d0a1,_0x59bcbe,!![]);}catch(_0x5752bd){return BPromise[_0x013c('0x20')](_0x5752bd);}return _0x42d0a1[_0x013c('0x21')]();};}function saveUpdates(_0x29c141,_0x38bac2){return function(_0xb87452){if(_0xb87452){return _0xb87452['update'](_0x29c141)[_0x013c('0x22')](function(_0x336022){return _0x336022;});}return null;};}function removeEntity(_0x48e6af,_0x1df9d2){return function(_0x82f9f1){if(_0x82f9f1){return _0x82f9f1['destroy']()['then'](function(){_0x48e6af[_0x013c('0x18')](0xcc)[_0x013c('0x23')]();});}};}function handleEntityNotFound(_0x2509f4,_0x447c0b){return function(_0x20aff2){if(!_0x20aff2){_0x2509f4[_0x013c('0x17')](0x194);}return _0x20aff2;};}function handleError(_0x186677,_0x1b9bdc){_0x1b9bdc=_0x1b9bdc||0x1f4;return function(_0x4ffb6d){logger[_0x013c('0x24')](_0x4ffb6d[_0x013c('0x25')]);if(_0x4ffb6d[_0x013c('0x26')]){delete _0x4ffb6d[_0x013c('0x26')];}_0x186677[_0x013c('0x18')](_0x1b9bdc)[_0x013c('0x27')](_0x4ffb6d);};}exports['index']=function(_0xc1e719,_0xd85349){var _0x21c86e={},_0x5f251b={},_0xa74f05={'count':0x0,'rows':[]};var _0x4f062f=_[_0x013c('0x28')](db[_0x013c('0x29')]['rawAttributes'],function(_0x353cb7){return{'name':_0x353cb7[_0x013c('0x2a')],'type':_0x353cb7[_0x013c('0x2b')][_0x013c('0x2c')]};});_0x5f251b[_0x013c('0x2d')]=_[_0x013c('0x28')](_0x4f062f,_0x013c('0x26'));_0x5f251b[_0x013c('0x2e')]=_[_0x013c('0x2f')](_0xc1e719[_0x013c('0x2e')]);_0x5f251b['filters']=_[_0x013c('0x30')](_0x5f251b[_0x013c('0x2d')],_0x5f251b[_0x013c('0x2e')]);_0x21c86e[_0x013c('0x31')]=_[_0x013c('0x30')](_0x5f251b['model'],qs[_0x013c('0x32')](_0xc1e719[_0x013c('0x2e')][_0x013c('0x32')]));_0x21c86e[_0x013c('0x31')]=_0x21c86e['attributes']['length']?_0x21c86e['attributes']:_0x5f251b[_0x013c('0x2d')];if(!_0xc1e719[_0x013c('0x2e')][_0x013c('0x33')](_0x013c('0x34'))){_0x21c86e[_0x013c('0x1c')]=qs[_0x013c('0x1c')](_0xc1e719[_0x013c('0x2e')][_0x013c('0x1c')]);_0x21c86e[_0x013c('0x1b')]=qs[_0x013c('0x1b')](_0xc1e719[_0x013c('0x2e')][_0x013c('0x1b')]);}_0x21c86e['order']=qs['sort'](_0xc1e719[_0x013c('0x2e')][_0x013c('0x35')]);_0x21c86e[_0x013c('0x36')]=qs[_0x013c('0x37')](_['pick'](_0xc1e719[_0x013c('0x2e')],_0x5f251b[_0x013c('0x37')]),_0x4f062f);if(_0xc1e719[_0x013c('0x2e')][_0x013c('0x38')]){_0x21c86e['where']=_[_0x013c('0x39')](_0x21c86e[_0x013c('0x36')],{'$or':_['map'](_0x4f062f,function(_0x1ddc7c){if(_0x1ddc7c['type']!==_0x013c('0x3a')){var _0x2ff0bb={};_0x2ff0bb[_0x1ddc7c[_0x013c('0x26')]]={'$like':'%'+_0xc1e719[_0x013c('0x2e')]['filter']+'%'};return _0x2ff0bb;}})});}_0x21c86e=_[_0x013c('0x39')]({},_0x21c86e,_0xc1e719[_0x013c('0x3b')]);var _0x391f1f={'where':_0x21c86e[_0x013c('0x36')]};return db[_0x013c('0x29')][_0x013c('0x1a')](_0x391f1f)[_0x013c('0x22')](function(_0x4408a4){_0xa74f05[_0x013c('0x1a')]=_0x4408a4;if(_0xc1e719['query'][_0x013c('0x3c')]){_0x21c86e[_0x013c('0x3d')]=[{'all':!![]}];}return db['UserProfileSection'][_0x013c('0x3e')](_0x21c86e);})[_0x013c('0x22')](function(_0x5c7863){_0xa74f05[_0x013c('0x3f')]=_0x5c7863;return _0xa74f05;})[_0x013c('0x22')](respondWithFilteredResult(_0xd85349,_0x21c86e))[_0x013c('0x40')](handleError(_0xd85349,null));};exports[_0x013c('0x41')]=function(_0x11a0b4,_0x5eb1db){var _0x3d0ffd={'raw':![],'where':{'id':_0x11a0b4['params']['id']}},_0x4ea6c3={};_0x4ea6c3['model']=_['keys'](db[_0x013c('0x29')][_0x013c('0x42')]);_0x4ea6c3[_0x013c('0x2e')]=_['keys'](_0x11a0b4[_0x013c('0x2e')]);_0x4ea6c3[_0x013c('0x37')]=_[_0x013c('0x30')](_0x4ea6c3[_0x013c('0x2d')],_0x4ea6c3[_0x013c('0x2e')]);_0x3d0ffd['attributes']=_[_0x013c('0x30')](_0x4ea6c3[_0x013c('0x2d')],qs['fields'](_0x11a0b4['query']['fields']));_0x3d0ffd['attributes']=_0x3d0ffd[_0x013c('0x31')][_0x013c('0x43')]?_0x3d0ffd['attributes']:_0x4ea6c3[_0x013c('0x2d')];if(_0x11a0b4[_0x013c('0x2e')]['includeAll']){_0x3d0ffd[_0x013c('0x3d')]=[{'all':!![]}];}_0x3d0ffd=_[_0x013c('0x39')]({},_0x3d0ffd,_0x11a0b4[_0x013c('0x3b')]);return db[_0x013c('0x29')][_0x013c('0x44')](_0x3d0ffd)[_0x013c('0x22')](handleEntityNotFound(_0x5eb1db,null))[_0x013c('0x22')](respondWithResult(_0x5eb1db,null))[_0x013c('0x40')](handleError(_0x5eb1db,null));};exports['create']=function(_0x242eac,_0x499f0d){return db[_0x013c('0x29')]['create'](_0x242eac['body'],{})[_0x013c('0x22')](respondWithResult(_0x499f0d,0xc9))['catch'](handleError(_0x499f0d,null));};exports[_0x013c('0x45')]=function(_0x35f81,_0x3352c3){if(_0x35f81[_0x013c('0x46')]['id']){delete _0x35f81['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x35f81['params']['id']}})[_0x013c('0x22')](handleEntityNotFound(_0x3352c3,null))['then'](saveUpdates(_0x35f81[_0x013c('0x46')],null))[_0x013c('0x22')](respondWithResult(_0x3352c3,null))[_0x013c('0x40')](handleError(_0x3352c3,null));};exports[_0x013c('0x47')]=function(_0x104a68,_0x2e99db){return db[_0x013c('0x29')][_0x013c('0x44')]({'where':{'id':_0x104a68[_0x013c('0x48')]['id']}})['then'](handleEntityNotFound(_0x2e99db,null))[_0x013c('0x22')](removeEntity(_0x2e99db,null))['catch'](handleError(_0x2e99db,null));};exports['describe']=function(_0x12236a,_0x5f2b11){return db['UserProfileSection'][_0x013c('0x49')]()[_0x013c('0x22')](respondWithResult(_0x5f2b11,null))['catch'](handleError(_0x5f2b11,null));}; \ No newline at end of file +var _0xd9f1=['index','map','UserProfileSection','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','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','save','then','end','sendStatus','error','stack','name'];(function(_0x283f12,_0x580caa){var _0x144858=function(_0x29936f){while(--_0x29936f){_0x283f12['push'](_0x283f12['shift']());}};_0x144858(++_0x580caa);}(_0xd9f1,0x1df));var _0x1d9f=function(_0x406227,_0x3ab53e){_0x406227=_0x406227-0x0;var _0x12c759=_0xd9f1[_0x406227];return _0x12c759;};'use strict';var pdf=require(_0x1d9f('0x0'));var emlformat=require(_0x1d9f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1d9f('0x2'));var jsonpatch=require(_0x1d9f('0x3'));var rp=require(_0x1d9f('0x4'));var moment=require(_0x1d9f('0x5'));var BPromise=require(_0x1d9f('0x6'));var Mustache=require(_0x1d9f('0x7'));var util=require(_0x1d9f('0x8'));var path=require('path');var sox=require(_0x1d9f('0x9'));var csv=require(_0x1d9f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d9f('0xb'));var squel=require(_0x1d9f('0xc'));var crypto=require('crypto');var jsforce=require(_0x1d9f('0xd'));var deskjs=require(_0x1d9f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d9f('0xf'));var Redis=require(_0x1d9f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1d9f('0x11'));var as=require(_0x1d9f('0x12'));var hardwareService=require(_0x1d9f('0x13'));var logger=require(_0x1d9f('0x14'))(_0x1d9f('0x15'));var utils=require(_0x1d9f('0x16'));var config=require(_0x1d9f('0x17'));var db=require(_0x1d9f('0x18'))['db'];function respondWithStatusCode(_0x39a54e,_0x34d72d){_0x34d72d=_0x34d72d||0xcc;return function(_0x4a3842){if(_0x4a3842){return _0x39a54e['sendStatus'](_0x34d72d);}return _0x39a54e[_0x1d9f('0x19')](_0x34d72d)['end']();};}function respondWithResult(_0x1dec83,_0x4998ce){_0x4998ce=_0x4998ce||0xc8;return function(_0x4f13bb){if(_0x4f13bb){return _0x1dec83[_0x1d9f('0x19')](_0x4998ce)[_0x1d9f('0x1a')](_0x4f13bb);}};}function respondWithFilteredResult(_0x4bc52a,_0x3750cf){return function(_0x56e7ef){if(_0x56e7ef){var _0x4afd57=_0x56e7ef['count'],_0x43cf1c=_0x3750cf[_0x1d9f('0x1b')],_0xb7ad6=_0x3750cf[_0x1d9f('0x1b')]+_0x3750cf[_0x1d9f('0x1c')],_0x54ba8e;if(_0xb7ad6>=_0x4afd57){_0xb7ad6=_0x4afd57;_0x54ba8e=0xc8;}else{_0x54ba8e=0xce;}_0x4bc52a[_0x1d9f('0x19')](_0x54ba8e);return _0x4bc52a['set'](_0x1d9f('0x1d'),_0x43cf1c+'-'+_0xb7ad6+'/'+_0x4afd57)['json'](_0x56e7ef);}return null;};}function patchUpdates(_0x1f7c85){return function(_0x5d37ef){try{jsonpatch[_0x1d9f('0x1e')](_0x5d37ef,_0x1f7c85,!![]);}catch(_0x5c2e89){return BPromise[_0x1d9f('0x1f')](_0x5c2e89);}return _0x5d37ef[_0x1d9f('0x20')]();};}function saveUpdates(_0x28a1fd,_0x274ced){return function(_0x2abdda){if(_0x2abdda){return _0x2abdda['update'](_0x28a1fd)[_0x1d9f('0x21')](function(_0x5953fa){return _0x5953fa;});}return null;};}function removeEntity(_0x389e2b,_0x4ac0cd){return function(_0x2c5447){if(_0x2c5447){return _0x2c5447['destroy']()['then'](function(){_0x389e2b[_0x1d9f('0x19')](0xcc)[_0x1d9f('0x22')]();});}};}function handleEntityNotFound(_0x25d8da,_0x6d6509){return function(_0x283eaa){if(!_0x283eaa){_0x25d8da[_0x1d9f('0x23')](0x194);}return _0x283eaa;};}function handleError(_0x2c1fc7,_0xde160){_0xde160=_0xde160||0x1f4;return function(_0x4f494b){logger[_0x1d9f('0x24')](_0x4f494b[_0x1d9f('0x25')]);if(_0x4f494b[_0x1d9f('0x26')]){delete _0x4f494b[_0x1d9f('0x26')];}_0x2c1fc7['status'](_0xde160)['send'](_0x4f494b);};}exports[_0x1d9f('0x27')]=function(_0x9da85a,_0x2cf22f){var _0x3a2cdd={},_0x5ba8a7={},_0x31ee68={'count':0x0,'rows':[]};var _0x3c7236=_[_0x1d9f('0x28')](db[_0x1d9f('0x29')][_0x1d9f('0x2a')],function(_0x318bf8){return{'name':_0x318bf8[_0x1d9f('0x2b')],'type':_0x318bf8[_0x1d9f('0x2c')]['key']};});_0x5ba8a7['model']=_[_0x1d9f('0x28')](_0x3c7236,_0x1d9f('0x26'));_0x5ba8a7['query']=_[_0x1d9f('0x2d')](_0x9da85a[_0x1d9f('0x2e')]);_0x5ba8a7[_0x1d9f('0x2f')]=_[_0x1d9f('0x30')](_0x5ba8a7[_0x1d9f('0x31')],_0x5ba8a7[_0x1d9f('0x2e')]);_0x3a2cdd[_0x1d9f('0x32')]=_['intersection'](_0x5ba8a7[_0x1d9f('0x31')],qs[_0x1d9f('0x33')](_0x9da85a[_0x1d9f('0x2e')][_0x1d9f('0x33')]));_0x3a2cdd[_0x1d9f('0x32')]=_0x3a2cdd[_0x1d9f('0x32')][_0x1d9f('0x34')]?_0x3a2cdd[_0x1d9f('0x32')]:_0x5ba8a7[_0x1d9f('0x31')];if(!_0x9da85a[_0x1d9f('0x2e')][_0x1d9f('0x35')](_0x1d9f('0x36'))){_0x3a2cdd[_0x1d9f('0x1c')]=qs[_0x1d9f('0x1c')](_0x9da85a['query']['limit']);_0x3a2cdd['offset']=qs['offset'](_0x9da85a[_0x1d9f('0x2e')][_0x1d9f('0x1b')]);}_0x3a2cdd[_0x1d9f('0x37')]=qs[_0x1d9f('0x38')](_0x9da85a[_0x1d9f('0x2e')][_0x1d9f('0x38')]);_0x3a2cdd[_0x1d9f('0x39')]=qs[_0x1d9f('0x2f')](_[_0x1d9f('0x3a')](_0x9da85a['query'],_0x5ba8a7[_0x1d9f('0x2f')]),_0x3c7236);if(_0x9da85a[_0x1d9f('0x2e')]['filter']){_0x3a2cdd[_0x1d9f('0x39')]=_['merge'](_0x3a2cdd[_0x1d9f('0x39')],{'$or':_['map'](_0x3c7236,function(_0x238665){if(_0x238665[_0x1d9f('0x2c')]!=='VIRTUAL'){var _0x285b57={};_0x285b57[_0x238665[_0x1d9f('0x26')]]={'$like':'%'+_0x9da85a['query'][_0x1d9f('0x3b')]+'%'};return _0x285b57;}})});}_0x3a2cdd=_[_0x1d9f('0x3c')]({},_0x3a2cdd,_0x9da85a[_0x1d9f('0x3d')]);var _0x4333a9={'where':_0x3a2cdd['where']};return db['UserProfileSection']['count'](_0x4333a9)['then'](function(_0x3e5aaa){_0x31ee68['count']=_0x3e5aaa;if(_0x9da85a['query'][_0x1d9f('0x3e')]){_0x3a2cdd[_0x1d9f('0x3f')]=[{'all':!![]}];}return db[_0x1d9f('0x29')][_0x1d9f('0x40')](_0x3a2cdd);})['then'](function(_0x276cf8){_0x31ee68[_0x1d9f('0x41')]=_0x276cf8;return _0x31ee68;})[_0x1d9f('0x21')](respondWithFilteredResult(_0x2cf22f,_0x3a2cdd))[_0x1d9f('0x42')](handleError(_0x2cf22f,null));};exports[_0x1d9f('0x43')]=function(_0x321509,_0x6ee385){var _0x2e4f40={'raw':![],'where':{'id':_0x321509[_0x1d9f('0x44')]['id']}},_0x4679cd={};_0x4679cd['model']=_[_0x1d9f('0x2d')](db[_0x1d9f('0x29')][_0x1d9f('0x2a')]);_0x4679cd[_0x1d9f('0x2e')]=_[_0x1d9f('0x2d')](_0x321509[_0x1d9f('0x2e')]);_0x4679cd['filters']=_[_0x1d9f('0x30')](_0x4679cd['model'],_0x4679cd[_0x1d9f('0x2e')]);_0x2e4f40[_0x1d9f('0x32')]=_[_0x1d9f('0x30')](_0x4679cd[_0x1d9f('0x31')],qs['fields'](_0x321509[_0x1d9f('0x2e')]['fields']));_0x2e4f40['attributes']=_0x2e4f40[_0x1d9f('0x32')][_0x1d9f('0x34')]?_0x2e4f40[_0x1d9f('0x32')]:_0x4679cd[_0x1d9f('0x31')];if(_0x321509[_0x1d9f('0x2e')]['includeAll']){_0x2e4f40[_0x1d9f('0x3f')]=[{'all':!![]}];}_0x2e4f40=_[_0x1d9f('0x3c')]({},_0x2e4f40,_0x321509[_0x1d9f('0x3d')]);return db[_0x1d9f('0x29')][_0x1d9f('0x45')](_0x2e4f40)[_0x1d9f('0x21')](handleEntityNotFound(_0x6ee385,null))[_0x1d9f('0x21')](respondWithResult(_0x6ee385,null))[_0x1d9f('0x42')](handleError(_0x6ee385,null));};exports[_0x1d9f('0x46')]=function(_0x35f7cf,_0x394117){return db[_0x1d9f('0x29')][_0x1d9f('0x46')](_0x35f7cf[_0x1d9f('0x47')],{})['then'](respondWithResult(_0x394117,0xc9))[_0x1d9f('0x42')](handleError(_0x394117,null));};exports['update']=function(_0x2f16d6,_0x1fbacc){if(_0x2f16d6[_0x1d9f('0x47')]['id']){delete _0x2f16d6['body']['id'];}return db[_0x1d9f('0x29')][_0x1d9f('0x45')]({'where':{'id':_0x2f16d6[_0x1d9f('0x44')]['id']}})['then'](handleEntityNotFound(_0x1fbacc,null))['then'](saveUpdates(_0x2f16d6[_0x1d9f('0x47')],null))[_0x1d9f('0x21')](respondWithResult(_0x1fbacc,null))[_0x1d9f('0x42')](handleError(_0x1fbacc,null));};exports[_0x1d9f('0x48')]=function(_0x53fc91,_0x3e5a20){return db['UserProfileSection']['find']({'where':{'id':_0x53fc91[_0x1d9f('0x44')]['id']}})[_0x1d9f('0x21')](handleEntityNotFound(_0x3e5a20,null))['then'](removeEntity(_0x3e5a20,null))[_0x1d9f('0x42')](handleError(_0x3e5a20,null));};exports['describe']=function(_0x28d473,_0x21d668){return db['UserProfileSection'][_0x1d9f('0x49')]()[_0x1d9f('0x21')](respondWithResult(_0x21d668,null))[_0x1d9f('0x42')](handleError(_0x21d668,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 25de824..72c1408 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 _0x3142=['sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3142,0x10f));var _0x2314=function(_0x2242a1,_0x38f44d){_0x2242a1=_0x2242a1-0x0;var _0x2c298b=_0x3142[_0x2242a1];return _0x2c298b;};'use strict';var _=require(_0x2314('0x0'));var util=require('util');var logger=require(_0x2314('0x1'))(_0x2314('0x2'));var moment=require(_0x2314('0x3'));var BPromise=require(_0x2314('0x4'));var rp=require(_0x2314('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2314('0x6'));var config=require(_0x2314('0x7'));var attributes=require(_0x2314('0x8'));module[_0x2314('0x9')]=function(_0x1d65c2,_0x546515){return _0x1d65c2[_0x2314('0xa')](_0x2314('0xb'),attributes,{'tableName':_0x2314('0xc'),'paranoid':![],'indexes':[{'name':_0x2314('0xd'),'fields':[_0x2314('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7530=['user_profile_has_sections','compositeIndex','sectionId','util','../../config/logger','moment','bluebird','rimraf','UserProfileSection'];(function(_0x107836,_0x255ebc){var _0x6946d2=function(_0x220ab6){while(--_0x220ab6){_0x107836['push'](_0x107836['shift']());}};_0x6946d2(++_0x255ebc);}(_0x7530,0x162));var _0x0753=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0x7530[_0x1ee62e];return _0x27c6c8;};'use strict';var _=require('lodash');var util=require(_0x0753('0x0'));var logger=require(_0x0753('0x1'))('api');var moment=require(_0x0753('0x2'));var BPromise=require(_0x0753('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0753('0x4'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x21e6f5,_0x5a724e){return _0x21e6f5['define'](_0x0753('0x5'),attributes,{'tableName':_0x0753('0x6'),'paranoid':![],'indexes':[{'name':_0x0753('0x7'),'fields':[_0x0753('0x8'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 87674ec..e182afa 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 _0xd70b=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UserProfileSection,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xd70b,0x17b));var _0xbd70=function(_0x40ff3b,_0x238af7){_0x40ff3b=_0x40ff3b-0x0;var _0x3ccf4f=_0xd70b[_0x40ff3b];return _0x3ccf4f;};'use strict';var _=require(_0xbd70('0x0'));var util=require(_0xbd70('0x1'));var moment=require(_0xbd70('0x2'));var BPromise=require(_0xbd70('0x3'));var rs=require(_0xbd70('0x4'));var fs=require('fs');var Redis=require(_0xbd70('0x5'));var db=require(_0xbd70('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd70('0x7'))(_0xbd70('0x8'));var config=require(_0xbd70('0x9'));var jayson=require(_0xbd70('0xa'));var client=jayson[_0xbd70('0xb')][_0xbd70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b90c0,_0x103d00,_0x51344d){return new BPromise(function(_0x25bca8,_0x1c414c){return client[_0xbd70('0xd')](_0x4b90c0,_0x51344d)['then'](function(_0x488578){logger[_0xbd70('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x103d00,'request\x20sent');logger[_0xbd70('0xf')](_0xbd70('0x10'),_0x103d00,_0xbd70('0x11'),JSON[_0xbd70('0x12')](_0x488578));if(_0x488578[_0xbd70('0x13')]){if(_0x488578[_0xbd70('0x13')]['code']===0x1f4){logger[_0xbd70('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x103d00,_0x488578[_0xbd70('0x13')][_0xbd70('0x14')]);return _0x1c414c(_0x488578[_0xbd70('0x13')]['message']);}logger['error'](_0xbd70('0x15'),_0x103d00,_0x488578[_0xbd70('0x13')][_0xbd70('0x14')]);return _0x25bca8(_0x488578[_0xbd70('0x13')][_0xbd70('0x14')]);}else{logger[_0xbd70('0xe')](_0xbd70('0x15'),_0x103d00,'request\x20sent');_0x25bca8(_0x488578[_0xbd70('0x16')][_0xbd70('0x14')]);}})[_0xbd70('0x17')](function(_0x1f41d9){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x103d00,_0x1f41d9);_0x1c414c(_0x1f41d9);});});} \ No newline at end of file +var _0x6c5b=['client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xdc5a81,_0xcfb8c3){var _0x96ec2=function(_0x2e38b8){while(--_0x2e38b8){_0xdc5a81['push'](_0xdc5a81['shift']());}};_0x96ec2(++_0xcfb8c3);}(_0x6c5b,0x1c4));var _0xb6c5=function(_0xe85064,_0x274bc3){_0xe85064=_0xe85064-0x0;var _0x43428e=_0x6c5b[_0xe85064];return _0x43428e;};'use strict';var _=require(_0xb6c5('0x0'));var util=require(_0xb6c5('0x1'));var moment=require(_0xb6c5('0x2'));var BPromise=require(_0xb6c5('0x3'));var rs=require(_0xb6c5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6c5('0x5'))['db'];var utils=require(_0xb6c5('0x6'));var logger=require(_0xb6c5('0x7'))(_0xb6c5('0x8'));var config=require('../../config/environment');var jayson=require(_0xb6c5('0x9'));var client=jayson[_0xb6c5('0xa')][_0xb6c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x131413,_0x4d6ef7,_0x35bbea){return new BPromise(function(_0x27fab3,_0x4ce0a3){return client[_0xb6c5('0xc')](_0x131413,_0x35bbea)['then'](function(_0x1f638f){logger[_0xb6c5('0xd')](_0xb6c5('0xe'),_0x4d6ef7,_0xb6c5('0xf'));logger['debug'](_0xb6c5('0x10'),_0x4d6ef7,_0xb6c5('0xf'),JSON['stringify'](_0x1f638f));if(_0x1f638f['error']){if(_0x1f638f[_0xb6c5('0x11')][_0xb6c5('0x12')]===0x1f4){logger[_0xb6c5('0x11')](_0xb6c5('0xe'),_0x4d6ef7,_0x1f638f[_0xb6c5('0x11')][_0xb6c5('0x13')]);return _0x4ce0a3(_0x1f638f[_0xb6c5('0x11')][_0xb6c5('0x13')]);}logger[_0xb6c5('0x11')](_0xb6c5('0xe'),_0x4d6ef7,_0x1f638f['error']['message']);return _0x27fab3(_0x1f638f[_0xb6c5('0x11')][_0xb6c5('0x13')]);}else{logger['info'](_0xb6c5('0xe'),_0x4d6ef7,_0xb6c5('0xf'));_0x27fab3(_0x1f638f['result'][_0xb6c5('0x13')]);}})[_0xb6c5('0x14')](function(_0x4a0501){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x4d6ef7,_0x4a0501);_0x4ce0a3(_0x4a0501);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index a8cf1ae..9138b3c 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 _0x8fde=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','express'];(function(_0x1df11b,_0x456d05){var _0x2e4504=function(_0x12a9da){while(--_0x12a9da){_0x1df11b['push'](_0x1df11b['shift']());}};_0x2e4504(++_0x456d05);}(_0x8fde,0x1ac));var _0xe8fd=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x8fde[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xe8fd('0x0'));var util=require(_0xe8fd('0x1'));var path=require(_0xe8fd('0x2'));var timeout=require('connect-timeout');var express=require(_0xe8fd('0x3'));var router=express[_0xe8fd('0x4')]();var auth=require(_0xe8fd('0x5'));var interaction=require(_0xe8fd('0x6'));var config=require(_0xe8fd('0x7'));module['exports']=router; \ No newline at end of file +var _0x76c1=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x76c1,0x75));var _0x176c=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x76c1[_0x2ca2d0];return _0x521c23;};'use strict';var multer=require(_0x176c('0x0'));var util=require(_0x176c('0x1'));var path=require(_0x176c('0x2'));var timeout=require('connect-timeout');var express=require(_0x176c('0x3'));var router=express[_0x176c('0x4')]();var auth=require(_0x176c('0x5'));var interaction=require(_0x176c('0x6'));var config=require(_0x176c('0x7'));module[_0x176c('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 1ea3be0..7a145b6 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x2a8444,_0xb5ee31){var _0x53c724=function(_0xf67066){while(--_0xf67066){_0x2a8444['push'](_0x2a8444['shift']());}};_0x53c724(++_0xb5ee31);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x46b14d,_0x2129e2){var _0x1df69e=function(_0x512661){while(--_0x512661){_0x46b14d['push'](_0x46b14d['shift']());}};_0x1df69e(++_0x2129e2);}(_0xe706,0xa3));var _0x6e70=function(_0x3f47bd,_0xa1b88c){_0x3f47bd=_0x3f47bd-0x0;var _0x133064=_0xe706[_0x3f47bd];return _0x133064;};'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 22ab7bf..cd69757 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 _0x0825=['../../config/environment','./userSmsQueue.attributes','exports','user_has_sms_queues','lodash','util','moment','bluebird','path','rimraf'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x0825,0x1e4));var _0x5082=function(_0x18d3aa,_0x3da5b3){_0x18d3aa=_0x18d3aa-0x0;var _0x215d9b=_0x0825[_0x18d3aa];return _0x215d9b;};'use strict';var _=require(_0x5082('0x0'));var util=require(_0x5082('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5082('0x2'));var BPromise=require(_0x5082('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5082('0x4'));var rimraf=require(_0x5082('0x5'));var config=require(_0x5082('0x6'));var attributes=require(_0x5082('0x7'));module[_0x5082('0x8')]=function(_0x297cda,_0x5a119b){return _0x297cda['define']('UserSmsQueue',attributes,{'tableName':_0x5082('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ec8=['bluebird','rimraf','./userSmsQueue.attributes','exports','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x2ec8,0x188));var _0x82ec=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2ec8[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x82ec('0x0'));var util=require(_0x82ec('0x1'));var logger=require(_0x82ec('0x2'))(_0x82ec('0x3'));var moment=require('moment');var BPromise=require(_0x82ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x82ec('0x5'));var config=require('../../config/environment');var attributes=require(_0x82ec('0x6'));module[_0x82ec('0x7')]=function(_0x528e26,_0x4c9400){return _0x528e26['define']('UserSmsQueue',attributes,{'tableName':_0x82ec('0x8'),'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 4df6f41..0cc5b8b 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 _0x273d=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring'];(function(_0x189c0c,_0x3c8aff){var _0x533076=function(_0x4c9439){while(--_0x4c9439){_0x189c0c['push'](_0x189c0c['shift']());}};_0x533076(++_0x3c8aff);}(_0x273d,0x13e));var _0xd273=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x273d[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xd273('0x0'));var moment=require(_0xd273('0x1'));var BPromise=require(_0xd273('0x2'));var rs=require(_0xd273('0x3'));var fs=require('fs');var Redis=require(_0xd273('0x4'));var db=require(_0xd273('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd273('0x6'))(_0xd273('0x7'));var config=require(_0xd273('0x8'));var jayson=require(_0xd273('0x9'));var client=jayson[_0xd273('0xa')][_0xd273('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x578122,_0x346d70,_0x1880d7){return new BPromise(function(_0xeda96b,_0xf2f73e){return client[_0xd273('0xc')](_0x578122,_0x1880d7)['then'](function(_0x577b30){logger['info'](_0xd273('0xd'),_0x346d70,'request\x20sent');logger[_0xd273('0xe')](_0xd273('0xf'),_0x346d70,'request\x20sent',JSON['stringify'](_0x577b30));if(_0x577b30[_0xd273('0x10')]){if(_0x577b30[_0xd273('0x10')][_0xd273('0x11')]===0x1f4){logger[_0xd273('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x346d70,_0x577b30[_0xd273('0x10')][_0xd273('0x12')]);return _0xf2f73e(_0x577b30[_0xd273('0x10')]['message']);}logger[_0xd273('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x346d70,_0x577b30[_0xd273('0x10')][_0xd273('0x12')]);return _0xeda96b(_0x577b30[_0xd273('0x10')][_0xd273('0x12')]);}else{logger[_0xd273('0x13')](_0xd273('0xd'),_0x346d70,_0xd273('0x14'));_0xeda96b(_0x577b30[_0xd273('0x15')][_0xd273('0x12')]);}})[_0xd273('0x16')](function(_0x407e98){logger[_0xd273('0x10')](_0xd273('0xd'),_0x346d70,_0x407e98);_0xf2f73e(_0x407e98);});});} \ No newline at end of file +var _0x7fe4=['debug','stringify','error','code','message','result','catch','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4e1219,_0x4f88ac){var _0x5b2e94=function(_0x31bdd7){while(--_0x31bdd7){_0x4e1219['push'](_0x4e1219['shift']());}};_0x5b2e94(++_0x4f88ac);}(_0x7fe4,0x14a));var _0x47fe=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x7fe4[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47fe('0x0'));var db=require('../../mysqldb')['db'];var utils=require(_0x47fe('0x1'));var logger=require('../../config/logger')(_0x47fe('0x2'));var config=require(_0x47fe('0x3'));var jayson=require(_0x47fe('0x4'));var client=jayson[_0x47fe('0x5')][_0x47fe('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x433448,_0x132a97,_0x288e4d){return new BPromise(function(_0xe923b5,_0x3b3301){return client[_0x47fe('0x7')](_0x433448,_0x288e4d)[_0x47fe('0x8')](function(_0x33af69){logger[_0x47fe('0x9')](_0x47fe('0xa'),_0x132a97,_0x47fe('0xb'));logger[_0x47fe('0xc')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x132a97,_0x47fe('0xb'),JSON[_0x47fe('0xd')](_0x33af69));if(_0x33af69[_0x47fe('0xe')]){if(_0x33af69[_0x47fe('0xe')][_0x47fe('0xf')]===0x1f4){logger[_0x47fe('0xe')](_0x47fe('0xa'),_0x132a97,_0x33af69[_0x47fe('0xe')][_0x47fe('0x10')]);return _0x3b3301(_0x33af69[_0x47fe('0xe')][_0x47fe('0x10')]);}logger[_0x47fe('0xe')](_0x47fe('0xa'),_0x132a97,_0x33af69[_0x47fe('0xe')][_0x47fe('0x10')]);return _0xe923b5(_0x33af69[_0x47fe('0xe')][_0x47fe('0x10')]);}else{logger[_0x47fe('0x9')](_0x47fe('0xa'),_0x132a97,_0x47fe('0xb'));_0xe923b5(_0x33af69[_0x47fe('0x11')][_0x47fe('0x10')]);}})[_0x47fe('0x12')](function(_0x30cbd0){logger[_0x47fe('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x132a97,_0x30cbd0);_0x3b3301(_0x30cbd0);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 5e39b0c..7cc7bb9 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 _0x9815=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x5df4e7,_0x1a5f97){var _0x2523d7=function(_0x1fe885){while(--_0x1fe885){_0x5df4e7['push'](_0x5df4e7['shift']());}};_0x2523d7(++_0x1a5f97);}(_0x9815,0x1d0));var _0x5981=function(_0x25f1e7,_0x2a220f){_0x25f1e7=_0x25f1e7-0x0;var _0x51c086=_0x9815[_0x25f1e7];return _0x51c086;};'use strict';var multer=require(_0x5981('0x0'));var util=require(_0x5981('0x1'));var path=require(_0x5981('0x2'));var timeout=require(_0x5981('0x3'));var express=require(_0x5981('0x4'));var router=express['Router']();var auth=require(_0x5981('0x5'));var interaction=require(_0x5981('0x6'));var config=require(_0x5981('0x7'));module[_0x5981('0x8')]=router; \ No newline at end of file +var _0x5e61=['path','connect-timeout','express','../../components/auth/service','../../config/environment','exports'];(function(_0x53633a,_0x466e14){var _0x5f4d14=function(_0x4ae6d6){while(--_0x4ae6d6){_0x53633a['push'](_0x53633a['shift']());}};_0x5f4d14(++_0x466e14);}(_0x5e61,0x84));var _0x15e6=function(_0x4aa3fa,_0x2e0d9c){_0x4aa3fa=_0x4aa3fa-0x0;var _0x3b4988=_0x5e61[_0x4aa3fa];return _0x3b4988;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x15e6('0x0'));var timeout=require(_0x15e6('0x1'));var express=require(_0x15e6('0x2'));var router=express['Router']();var auth=require(_0x15e6('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x15e6('0x4'));module[_0x15e6('0x5')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 7ae078b..a56c8d4 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 _0xb10b=['sequelize','INTEGER'];(function(_0x1b86ae,_0x4296a8){var _0x10c097=function(_0x3b772f){while(--_0x3b772f){_0x1b86ae['push'](_0x1b86ae['shift']());}};_0x10c097(++_0x4296a8);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a5755,_0x17f587){_0x2a5755=_0x2a5755-0x0;var _0x1700da=_0xb10b[_0x2a5755];return _0x1700da;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x358145,_0x49a096){var _0x36a7ac=function(_0x5ca63e){while(--_0x5ca63e){_0x358145['push'](_0x358145['shift']());}};_0x36a7ac(++_0x49a096);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index a8d50a0..06e1634 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 _0xfe47=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define'];(function(_0x597d52,_0x470643){var _0x1e831f=function(_0x20f393){while(--_0x20f393){_0x597d52['push'](_0x597d52['shift']());}};_0x1e831f(++_0x470643);}(_0xfe47,0xe5));var _0x7fe4=function(_0x4495b6,_0x1660d5){_0x4495b6=_0x4495b6-0x0;var _0x2ff893=_0xfe47[_0x4495b6];return _0x2ff893;};'use strict';var _=require(_0x7fe4('0x0'));var util=require(_0x7fe4('0x1'));var logger=require(_0x7fe4('0x2'))(_0x7fe4('0x3'));var moment=require(_0x7fe4('0x4'));var BPromise=require('bluebird');var rp=require(_0x7fe4('0x5'));var fs=require('fs');var path=require(_0x7fe4('0x6'));var rimraf=require(_0x7fe4('0x7'));var config=require(_0x7fe4('0x8'));var attributes=require(_0x7fe4('0x9'));module['exports']=function(_0x4079be,_0x33c3c0){return _0x4079be[_0x7fe4('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x7fe4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89f2=['UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x89f2,0xf9));var _0x289f=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x89f2[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x289f('0x0'));var util=require(_0x289f('0x1'));var logger=require('../../config/logger')(_0x289f('0x2'));var moment=require(_0x289f('0x3'));var BPromise=require(_0x289f('0x4'));var rp=require(_0x289f('0x5'));var fs=require('fs');var path=require(_0x289f('0x6'));var rimraf=require(_0x289f('0x7'));var config=require('../../config/environment');var attributes=require(_0x289f('0x8'));module[_0x289f('0x9')]=function(_0x1b3c10,_0x207dea){return _0x1b3c10[_0x289f('0xa')](_0x289f('0xb'),attributes,{'tableName':_0x289f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index c9bf647..bed7ac1 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 _0x4f01=['then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x4f01,0x1d9));var _0x14f0=function(_0x57118e,_0x23e1c4){_0x57118e=_0x57118e-0x0;var _0x24ea06=_0x4f01[_0x57118e];return _0x24ea06;};'use strict';var _=require(_0x14f0('0x0'));var util=require(_0x14f0('0x1'));var moment=require(_0x14f0('0x2'));var BPromise=require(_0x14f0('0x3'));var rs=require(_0x14f0('0x4'));var fs=require('fs');var Redis=require(_0x14f0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x14f0('0x6'))(_0x14f0('0x7'));var config=require(_0x14f0('0x8'));var jayson=require(_0x14f0('0x9'));var client=jayson[_0x14f0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d4663,_0x478fc9,_0x322610){return new BPromise(function(_0x332f5a,_0x33349a){return client['request'](_0x3d4663,_0x322610)[_0x14f0('0xb')](function(_0x496ed6){logger[_0x14f0('0xc')](_0x14f0('0xd'),_0x478fc9,_0x14f0('0xe'));logger['debug'](_0x14f0('0xf'),_0x478fc9,_0x14f0('0xe'),JSON[_0x14f0('0x10')](_0x496ed6));if(_0x496ed6['error']){if(_0x496ed6[_0x14f0('0x11')][_0x14f0('0x12')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x478fc9,_0x496ed6[_0x14f0('0x11')][_0x14f0('0x13')]);return _0x33349a(_0x496ed6[_0x14f0('0x11')][_0x14f0('0x13')]);}logger[_0x14f0('0x11')](_0x14f0('0xd'),_0x478fc9,_0x496ed6['error'][_0x14f0('0x13')]);return _0x332f5a(_0x496ed6[_0x14f0('0x11')]['message']);}else{logger[_0x14f0('0xc')](_0x14f0('0xd'),_0x478fc9,_0x14f0('0xe'));_0x332f5a(_0x496ed6[_0x14f0('0x14')][_0x14f0('0x13')]);}})[_0x14f0('0x15')](function(_0x4f96d4){logger[_0x14f0('0x11')](_0x14f0('0xd'),_0x478fc9,_0x4f96d4);_0x33349a(_0x4f96d4);});});} \ No newline at end of file +var _0x961b=['message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x341a13,_0x35a03d){var _0x58a08a=function(_0x427523){while(--_0x427523){_0x341a13['push'](_0x341a13['shift']());}};_0x58a08a(++_0x35a03d);}(_0x961b,0x115));var _0xb961=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x961b[_0x541ea6];return _0x3c3e84;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb961('0x0'));var rs=require(_0xb961('0x1'));var fs=require('fs');var Redis=require(_0xb961('0x2'));var db=require(_0xb961('0x3'))['db'];var utils=require(_0xb961('0x4'));var logger=require('../../config/logger')(_0xb961('0x5'));var config=require('../../config/environment');var jayson=require(_0xb961('0x6'));var client=jayson[_0xb961('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5961db,_0x2729a3,_0x261467){return new BPromise(function(_0x5d2b1d,_0x1f170c){return client[_0xb961('0x8')](_0x5961db,_0x261467)[_0xb961('0x9')](function(_0xc224b4){logger['info'](_0xb961('0xa'),_0x2729a3,_0xb961('0xb'));logger[_0xb961('0xc')](_0xb961('0xd'),_0x2729a3,_0xb961('0xb'),JSON[_0xb961('0xe')](_0xc224b4));if(_0xc224b4[_0xb961('0xf')]){if(_0xc224b4[_0xb961('0xf')][_0xb961('0x10')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x2729a3,_0xc224b4[_0xb961('0xf')][_0xb961('0x11')]);return _0x1f170c(_0xc224b4[_0xb961('0xf')]['message']);}logger[_0xb961('0xf')](_0xb961('0xa'),_0x2729a3,_0xc224b4['error'][_0xb961('0x11')]);return _0x5d2b1d(_0xc224b4['error'][_0xb961('0x11')]);}else{logger[_0xb961('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x2729a3,'request\x20sent');_0x5d2b1d(_0xc224b4[_0xb961('0x13')][_0xb961('0x11')]);}})[_0xb961('0x14')](function(_0x140cf4){logger[_0xb961('0xf')](_0xb961('0xa'),_0x2729a3,_0x140cf4);_0x1f170c(_0x140cf4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 22d7c04..1f1e19c 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 _0xbe37=['exports','multer','express','Router','../../components/auth/service'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xbe37,0x105));var _0x7be3=function(_0xbe651e,_0x2f400a){_0xbe651e=_0xbe651e-0x0;var _0x314524=_0xbe37[_0xbe651e];return _0x314524;};'use strict';var multer=require(_0x7be3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7be3('0x1'));var router=express[_0x7be3('0x2')]();var auth=require(_0x7be3('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x7be3('0x4')]=router; \ No newline at end of file +var _0xaee6=['Router','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xaee6,0x187));var _0x6aee=function(_0x1010b0,_0x2c6b0d){_0x1010b0=_0x1010b0-0x0;var _0x29a1d8=_0xaee6[_0x1010b0];return _0x29a1d8;};'use strict';var multer=require(_0x6aee('0x0'));var util=require(_0x6aee('0x1'));var path=require(_0x6aee('0x2'));var timeout=require(_0x6aee('0x3'));var express=require(_0x6aee('0x4'));var router=express[_0x6aee('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6aee('0x6'));var config=require(_0x6aee('0x7'));module[_0x6aee('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 ce443d5..03dc7a3 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 _0xe6c4=['STRING','exports','Required\x20by\x20Asterisk','INTEGER','queue_interface'];(function(_0x3ba6d0,_0x51ac99){var _0x1a3e77=function(_0x5c3129){while(--_0x5c3129){_0x3ba6d0['push'](_0x3ba6d0['shift']());}};_0x1a3e77(++_0x51ac99);}(_0xe6c4,0x123));var _0x4e6c=function(_0x37ba4c,_0x2beb84){_0x37ba4c=_0x37ba4c-0x0;var _0x633b57=_0xe6c4[_0x37ba4c];return _0x633b57;};'use strict';var Sequelize=require('sequelize');module[_0x4e6c('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4e6c('0x1')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x4e6c('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4e6c('0x3'),'comment':_0x4e6c('0x1')},'VoiceQueueId':{'type':Sequelize[_0x4e6c('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x4e6c('0x4')],'allowNull':![],'unique':_0x4e6c('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x4e6c('0x2')](0xb),'defaultValue':0x0,'comment':_0x4e6c('0x1')},'paused':{'type':Sequelize[_0x4e6c('0x2')](0xb),'defaultValue':0x0,'comment':_0x4e6c('0x1')}}; \ No newline at end of file +var _0xd2f5=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x20398a,_0x897b80){var _0x349ba9=function(_0x5e696a){while(--_0x5e696a){_0x20398a['push'](_0x20398a['shift']());}};_0x349ba9(++_0x897b80);}(_0xd2f5,0xbf));var _0x5d2f=function(_0x1232a9,_0xd60081){_0x1232a9=_0x1232a9-0x0;var _0x3fb7e1=_0xd2f5[_0x1232a9];return _0x3fb7e1;};'use strict';var Sequelize=require(_0x5d2f('0x0'));module[_0x5d2f('0x1')]={'uniqueid':{'type':Sequelize[_0x5d2f('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5d2f('0x3')},'membername':{'type':Sequelize[_0x5d2f('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x5d2f('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5d2f('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5d2f('0x5'),'comment':_0x5d2f('0x3')},'penalty':{'type':Sequelize[_0x5d2f('0x2')](0xb),'defaultValue':0x0,'comment':_0x5d2f('0x3')},'paused':{'type':Sequelize[_0x5d2f('0x2')](0xb),'defaultValue':0x0,'comment':_0x5d2f('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 0342acd..86d421c 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 _0x3e75=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x55754e,_0x286388){var _0x2e9948=function(_0x1eaeff){while(--_0x1eaeff){_0x55754e['push'](_0x55754e['shift']());}};_0x2e9948(++_0x286388);}(_0x3e75,0x1d0));var _0x53e7=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x3e75[_0x5be795];return _0x4e8a3b;};'use strict';var EventEmitter=require(_0x53e7('0x0'));var UserVoiceQueueRt=require(_0x53e7('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x53e7('0x2')](0x0);var events={'afterCreate':_0x53e7('0x3'),'afterUpdate':_0x53e7('0x4'),'afterDestroy':_0x53e7('0x5')};function emitEvent(_0x29c6a3){return function(_0x3ce4c3,_0x43869b,_0xede4f7){UserVoiceQueueRtEvents[_0x53e7('0x6')](_0x29c6a3+':'+_0x3ce4c3['id'],_0x3ce4c3);UserVoiceQueueRtEvents[_0x53e7('0x6')](_0x29c6a3,_0x3ce4c3);_0xede4f7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x53e7('0x7')](e,emitEvent(event));}}module[_0x53e7('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x21ab=['events','setMaxListeners','save','update','remove','emit','exports'];(function(_0x4b259b,_0x24da46){var _0x541c44=function(_0x1b6508){while(--_0x1b6508){_0x4b259b['push'](_0x4b259b['shift']());}};_0x541c44(++_0x24da46);}(_0x21ab,0x173));var _0xb21a=function(_0x54faff,_0x9a3b5e){_0x54faff=_0x54faff-0x0;var _0x5a784c=_0x21ab[_0x54faff];return _0x5a784c;};'use strict';var EventEmitter=require(_0xb21a('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb21a('0x1')](0x0);var events={'afterCreate':_0xb21a('0x2'),'afterUpdate':_0xb21a('0x3'),'afterDestroy':_0xb21a('0x4')};function emitEvent(_0x25b75c){return function(_0x52e1fa,_0x524615,_0x5a36ef){UserVoiceQueueRtEvents[_0xb21a('0x5')](_0x25b75c+':'+_0x52e1fa['id'],_0x52e1fa);UserVoiceQueueRtEvents[_0xb21a('0x5')](_0x25b75c,_0x52e1fa);_0x5a36ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xb21a('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 38ffc84..e8ab1cc 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 _0xc6a7=['rimraf','../../config/environment','exports','UserVoiceQueueRt','user_has_voice_queues_rt','util','api','moment','request-promise','path'];(function(_0x20fff9,_0x230a25){var _0x179b59=function(_0x8011a0){while(--_0x8011a0){_0x20fff9['push'](_0x20fff9['shift']());}};_0x179b59(++_0x230a25);}(_0xc6a7,0x73));var _0x7c6a=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xc6a7[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0x7c6a('0x0'));var logger=require('../../config/logger')(_0x7c6a('0x1'));var moment=require(_0x7c6a('0x2'));var BPromise=require('bluebird');var rp=require(_0x7c6a('0x3'));var fs=require('fs');var path=require(_0x7c6a('0x4'));var rimraf=require(_0x7c6a('0x5'));var config=require(_0x7c6a('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x7c6a('0x7')]=function(_0x356fc6,_0x3889e4){return _0x356fc6['define'](_0x7c6a('0x8'),attributes,{'tableName':_0x7c6a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e77=['exports','define','UserVoiceQueueRt','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x126229,_0x4215ad){var _0x2c4b48=function(_0x5b15ae){while(--_0x5b15ae){_0x126229['push'](_0x126229['shift']());}};_0x2c4b48(++_0x4215ad);}(_0x4e77,0x177));var _0x74e7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4e77[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x74e7('0x0'));var util=require(_0x74e7('0x1'));var logger=require(_0x74e7('0x2'))('api');var moment=require(_0x74e7('0x3'));var BPromise=require('bluebird');var rp=require(_0x74e7('0x4'));var fs=require('fs');var path=require(_0x74e7('0x5'));var rimraf=require(_0x74e7('0x6'));var config=require(_0x74e7('0x7'));var attributes=require(_0x74e7('0x8'));module[_0x74e7('0x9')]=function(_0x1efed8,_0x5648ae){return _0x1efed8[_0x74e7('0xa')](_0x74e7('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 141669b..e1d6d05 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 _0x342f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','UserVoiceQueueRt','options','raw','sequelize','COUNT','literal','outboundQueuePauses','GetVoiceQueueRtPauses'];(function(_0x2b290d,_0x8bd129){var _0x4ac75c=function(_0x298f6e){while(--_0x298f6e){_0x2b290d['push'](_0x2b290d['shift']());}};_0x4ac75c(++_0x8bd129);}(_0x342f,0x1a2));var _0xf342=function(_0x3ee9b2,_0xa090bb){_0x3ee9b2=_0x3ee9b2-0x0;var _0x51ac3e=_0x342f[_0x3ee9b2];return _0x51ac3e;};'use strict';var _=require(_0xf342('0x0'));var util=require(_0xf342('0x1'));var moment=require(_0xf342('0x2'));var BPromise=require(_0xf342('0x3'));var rs=require(_0xf342('0x4'));var fs=require('fs');var Redis=require(_0xf342('0x5'));var db=require(_0xf342('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf342('0x7'));var config=require(_0xf342('0x8'));var jayson=require(_0xf342('0x9'));var client=jayson[_0xf342('0xa')][_0xf342('0xb')]({'port':0x232a});config[_0xf342('0xc')]=_[_0xf342('0xd')](config[_0xf342('0xc')],{'host':_0xf342('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf342('0xc')]));require(_0xf342('0xf'))[_0xf342('0x10')](socket);function respondWithRpcPromise(_0x3ca460,_0x3615ae,_0x18d268){return new BPromise(function(_0x540f96,_0x124036){return client[_0xf342('0x11')](_0x3ca460,_0x18d268)[_0xf342('0x12')](function(_0x3251dc){logger[_0xf342('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3615ae,_0xf342('0x14'));logger[_0xf342('0x15')](_0xf342('0x16'),_0x3615ae,_0xf342('0x14'),JSON[_0xf342('0x17')](_0x3251dc));if(_0x3251dc[_0xf342('0x18')]){if(_0x3251dc['error'][_0xf342('0x19')]===0x1f4){logger[_0xf342('0x18')](_0xf342('0x1a'),_0x3615ae,_0x3251dc[_0xf342('0x18')][_0xf342('0x1b')]);return _0x124036(_0x3251dc[_0xf342('0x18')][_0xf342('0x1b')]);}logger[_0xf342('0x18')](_0xf342('0x1a'),_0x3615ae,_0x3251dc['error'][_0xf342('0x1b')]);return _0x540f96(_0x3251dc[_0xf342('0x18')]['message']);}else{logger[_0xf342('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3615ae,_0xf342('0x14'));_0x540f96(_0x3251dc[_0xf342('0x1c')]['message']);}})[_0xf342('0x1d')](function(_0x2d58f8){logger[_0xf342('0x18')](_0xf342('0x1a'),_0x3615ae,_0x2d58f8);_0x124036(_0x2d58f8);});});}exports['GetVoiceQueueRtPauses']=function(_0x50a80b){var _0x1862db=this;return new Promise(function(_0xee65cd,_0x2f7950){return db[_0xf342('0x1e')]['findAll']({'raw':_0x50a80b['options']?_0x50a80b[_0xf342('0x1f')][_0xf342('0x20')]===undefined?!![]:![]:!![],'where':_0x50a80b['options']?_0x50a80b['options']['where']||null:null,'attributes':[[db[_0xf342('0x21')]['fn'](_0xf342('0x22'),db[_0xf342('0x21')]['fn']('IF',db[_0xf342('0x21')][_0xf342('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0xf342('0x24')]]})[_0xf342('0x12')](function(_0x1d6cc4){logger[_0xf342('0x13')](_0xf342('0x25'),_0x50a80b);logger[_0xf342('0x15')](_0xf342('0x25'),_0x50a80b,JSON[_0xf342('0x17')](_0x1d6cc4));_0xee65cd(_0x1d6cc4);})[_0xf342('0x1d')](function(_0x5d3425){logger['error'](_0xf342('0x25'),_0x5d3425[_0xf342('0x1b')],_0x50a80b);_0x2f7950(_0x1862db[_0xf342('0x18')](0x1f4,_0x5d3425[_0xf342('0x1b')]));});});}; \ No newline at end of file +var _0xd0c1=['options','where','sequelize','COUNT','literal','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','findAll'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xd0c1,0xab));var _0x1d0c=function(_0x47d295,_0x53014d){_0x47d295=_0x47d295-0x0;var _0x503761=_0xd0c1[_0x47d295];return _0x503761;};'use strict';var _=require(_0x1d0c('0x0'));var util=require(_0x1d0c('0x1'));var moment=require(_0x1d0c('0x2'));var BPromise=require(_0x1d0c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d0c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d0c('0x5'))(_0x1d0c('0x6'));var config=require(_0x1d0c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1d0c('0x8')][_0x1d0c('0x9')]({'port':0x232a});config[_0x1d0c('0xa')]=_[_0x1d0c('0xb')](config['redis'],{'host':_0x1d0c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1d0c('0xd'))['register'](socket);function respondWithRpcPromise(_0x5a39b2,_0x5a1656,_0x1a4068){return new BPromise(function(_0x298ea9,_0x5a789d){return client[_0x1d0c('0xe')](_0x5a39b2,_0x1a4068)[_0x1d0c('0xf')](function(_0x1e893d){logger[_0x1d0c('0x10')](_0x1d0c('0x11'),_0x5a1656,_0x1d0c('0x12'));logger['debug'](_0x1d0c('0x13'),_0x5a1656,'request\x20sent',JSON[_0x1d0c('0x14')](_0x1e893d));if(_0x1e893d['error']){if(_0x1e893d['error']['code']===0x1f4){logger[_0x1d0c('0x15')](_0x1d0c('0x11'),_0x5a1656,_0x1e893d[_0x1d0c('0x15')][_0x1d0c('0x16')]);return _0x5a789d(_0x1e893d['error'][_0x1d0c('0x16')]);}logger[_0x1d0c('0x15')](_0x1d0c('0x11'),_0x5a1656,_0x1e893d['error'][_0x1d0c('0x16')]);return _0x298ea9(_0x1e893d[_0x1d0c('0x15')][_0x1d0c('0x16')]);}else{logger[_0x1d0c('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5a1656,'request\x20sent');_0x298ea9(_0x1e893d[_0x1d0c('0x17')][_0x1d0c('0x16')]);}})[_0x1d0c('0x18')](function(_0x1ec483){logger[_0x1d0c('0x15')](_0x1d0c('0x11'),_0x5a1656,_0x1ec483);_0x5a789d(_0x1ec483);});});}exports[_0x1d0c('0x19')]=function(_0x40fb3e){var _0x359b37=this;return new Promise(function(_0x900f9c,_0x52c4e4){return db['UserVoiceQueueRt'][_0x1d0c('0x1a')]({'raw':_0x40fb3e[_0x1d0c('0x1b')]?_0x40fb3e[_0x1d0c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x40fb3e[_0x1d0c('0x1b')]?_0x40fb3e[_0x1d0c('0x1b')][_0x1d0c('0x1c')]||null:null,'attributes':[[db[_0x1d0c('0x1d')]['fn'](_0x1d0c('0x1e'),db['sequelize']['fn']('IF',db[_0x1d0c('0x1d')][_0x1d0c('0x1f')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x1d0c('0xf')](function(_0x1c3276){logger['info'](_0x1d0c('0x19'),_0x40fb3e);logger[_0x1d0c('0x20')](_0x1d0c('0x19'),_0x40fb3e,JSON[_0x1d0c('0x14')](_0x1c3276));_0x900f9c(_0x1c3276);})[_0x1d0c('0x18')](function(_0x26d597){logger[_0x1d0c('0x15')](_0x1d0c('0x19'),_0x26d597[_0x1d0c('0x16')],_0x40fb3e);_0x52c4e4(_0x359b37[_0x1d0c('0x15')](0x1f4,_0x26d597[_0x1d0c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index f50f83c..80403be 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 _0x5bdf=['length','userVoiceQueueRt:','remove','register'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5bdf,0x1be));var _0xf5bd=function(_0x52bb05,_0x2ad46a){_0x52bb05=_0x52bb05-0x0;var _0x58f528=_0x5bdf[_0x52bb05];return _0x58f528;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0xf5bd('0x0'),'update'];function createListener(_0xd97038,_0x36e8fd){return function(_0x81a1b7){_0x36e8fd['emit'](_0xd97038,_0x81a1b7);};}function removeListener(_0x4cbbd5,_0x34935b){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4cbbd5,_0x34935b);};}exports[_0xf5bd('0x1')]=function(_0x5069bc){for(var _0x31965b=0x0,_0x25858b=events[_0xf5bd('0x2')];_0x31965b<_0x25858b;_0x31965b++){var _0x437c93=events[_0x31965b];var _0x4fa0a9=createListener(_0xf5bd('0x3')+_0x437c93,_0x5069bc);UserVoiceQueueRtEvents['on'](_0x437c93,_0x4fa0a9);}}; \ No newline at end of file +var _0xcbe7=['./userVoiceQueueRt.events','save','remove','update','removeListener','length','userVoiceQueueRt:'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xcbe7,0x1c7));var _0x7cbe=function(_0x3a19cd,_0x57c331){_0x3a19cd=_0x3a19cd-0x0;var _0x372764=_0xcbe7[_0x3a19cd];return _0x372764;};'use strict';var UserVoiceQueueRtEvents=require(_0x7cbe('0x0'));var events=[_0x7cbe('0x1'),_0x7cbe('0x2'),_0x7cbe('0x3')];function createListener(_0x277228,_0x11b7bd){return function(_0x3a3f70){_0x11b7bd['emit'](_0x277228,_0x3a3f70);};}function removeListener(_0x304584,_0x3fa1ca){return function(){UserVoiceQueueRtEvents[_0x7cbe('0x4')](_0x304584,_0x3fa1ca);};}exports['register']=function(_0x3e5cd3){for(var _0x2c20a5=0x0,_0x3b755e=events[_0x7cbe('0x5')];_0x2c20a5<_0x3b755e;_0x2c20a5++){var _0x19baec=events[_0x2c20a5];var _0x5f0ffa=createListener(_0x7cbe('0x6')+_0x19baec,_0x3e5cd3);UserVoiceQueueRtEvents['on'](_0x19baec,_0x5f0ffa);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 41189c5..d11ddd7 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 _0xa4f1=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x47856a,_0x1ad7a0){var _0x1edd96=function(_0x4da7f3){while(--_0x4da7f3){_0x47856a['push'](_0x47856a['shift']());}};_0x1edd96(++_0x1ad7a0);}(_0xa4f1,0x1a8));var _0x1a4f=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xa4f1[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0x1a4f('0x0'));var util=require('util');var path=require(_0x1a4f('0x1'));var timeout=require(_0x1a4f('0x2'));var express=require(_0x1a4f('0x3'));var router=express[_0x1a4f('0x4')]();var auth=require(_0x1a4f('0x5'));var interaction=require(_0x1a4f('0x6'));var config=require(_0x1a4f('0x7'));module[_0x1a4f('0x8')]=router; \ No newline at end of file +var _0xd813=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','exports'];(function(_0x3aee37,_0x4a4dfa){var _0x4e1a6b=function(_0x275238){while(--_0x275238){_0x3aee37['push'](_0x3aee37['shift']());}};_0x4e1a6b(++_0x4a4dfa);}(_0xd813,0x1c8));var _0x3d81=function(_0x58d61e,_0x11153d){_0x58d61e=_0x58d61e-0x0;var _0x54b06b=_0xd813[_0x58d61e];return _0x54b06b;};'use strict';var multer=require(_0x3d81('0x0'));var util=require(_0x3d81('0x1'));var path=require(_0x3d81('0x2'));var timeout=require(_0x3d81('0x3'));var express=require(_0x3d81('0x4'));var router=express['Router']();var auth=require(_0x3d81('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3d81('0x6'));module[_0x3d81('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 755d826..6caf080 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x204c82,_0x5bd73e){var _0x2c7553=function(_0x123b61){while(--_0x123b61){_0x204c82['push'](_0x204c82['shift']());}};_0x2c7553(++_0x5bd73e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x21c3da,_0x551beb){var _0x28ac07=function(_0x17803d){while(--_0x17803d){_0x21c3da['push'](_0x21c3da['shift']());}};_0x28ac07(++_0x551beb);}(_0xb10b,0x12a));var _0xbb10=function(_0x17d76b,_0x54345b){_0x17d76b=_0x17d76b-0x0;var _0x16f3ac=_0xb10b[_0x17d76b];return _0x16f3ac;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index a699330..a0fbcfc 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 _0x9929=['bluebird','path','rimraf','./userWhatsappQueue.attributes','define','util','moment'];(function(_0x9f9816,_0x579b0e){var _0x40a913=function(_0x5340c4){while(--_0x5340c4){_0x9f9816['push'](_0x9f9816['shift']());}};_0x40a913(++_0x579b0e);}(_0x9929,0x75));var _0x9992=function(_0x5f1e02,_0x3df6ea){_0x5f1e02=_0x5f1e02-0x0;var _0x5ab4d1=_0x9929[_0x5f1e02];return _0x5ab4d1;};'use strict';var _=require('lodash');var util=require(_0x9992('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9992('0x1'));var BPromise=require(_0x9992('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9992('0x3'));var rimraf=require(_0x9992('0x4'));var config=require('../../config/environment');var attributes=require(_0x9992('0x5'));module['exports']=function(_0x267b68,_0x59b753){return _0x267b68[_0x9992('0x6')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75f0=['lodash','util','api','request-promise','path','exports','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x75f0,0xe8));var _0x075f=function(_0x13b110,_0xaed0f2){_0x13b110=_0x13b110-0x0;var _0xd52387=_0x75f0[_0x13b110];return _0xd52387;};'use strict';var _=require(_0x075f('0x0'));var util=require(_0x075f('0x1'));var logger=require('../../config/logger')(_0x075f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x075f('0x3'));var fs=require('fs');var path=require(_0x075f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x075f('0x5')]=function(_0x3d2c3a,_0x269f7f){return _0x3d2c3a['define'](_0x075f('0x6'),attributes,{'tableName':_0x075f('0x7'),'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 70e64c2..fbeca6e 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(_0x1f42bd,_0x481f3b){var _0xa1bb06=function(_0x3c6955){while(--_0x3c6955){_0x1f42bd['push'](_0x1f42bd['shift']());}};_0xa1bb06(++_0x481f3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x8acdc0,_0x57386b){var _0x4b6340=function(_0x58964d){while(--_0x58964d){_0x8acdc0['push'](_0x8acdc0['shift']());}};_0x4b6340(++_0x57386b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e429056..41b14ba 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 _0x73cb=['express','./variable.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','destroy','exports','path','connect-timeout'];(function(_0x1bb38b,_0x491c7c){var _0x54afa5=function(_0x26353d){while(--_0x26353d){_0x1bb38b['push'](_0x1bb38b['shift']());}};_0x54afa5(++_0x491c7c);}(_0x73cb,0x1ed));var _0xb73c=function(_0x55f0e9,_0x329863){_0x55f0e9=_0x55f0e9-0x0;var _0x2c38eb=_0x73cb[_0x55f0e9];return _0x2c38eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb73c('0x0'));var timeout=require(_0xb73c('0x1'));var express=require(_0xb73c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb73c('0x3'));router['get']('/',auth[_0xb73c('0x4')](),controller[_0xb73c('0x5')]);router[_0xb73c('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xb73c('0x7')]);router[_0xb73c('0x8')]('/',auth[_0xb73c('0x4')](),controller[_0xb73c('0x9')]);router[_0xb73c('0xa')](_0xb73c('0xb'),auth[_0xb73c('0x4')](),controller['update']);router[_0xb73c('0xc')](_0xb73c('0xb'),auth[_0xb73c('0x4')](),controller[_0xb73c('0xd')]);module[_0xb73c('0xe')]=router; \ No newline at end of file +var _0x6753=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./variable.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer'];(function(_0xdf4058,_0x3d913d){var _0x141888=function(_0x52b935){while(--_0x52b935){_0xdf4058['push'](_0xdf4058['shift']());}};_0x141888(++_0x3d913d);}(_0x6753,0xa1));var _0x3675=function(_0x5d8e90,_0x4ffac5){_0x5d8e90=_0x5d8e90-0x0;var _0x56968c=_0x6753[_0x5d8e90];return _0x56968c;};'use strict';var multer=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var path=require(_0x3675('0x2'));var timeout=require(_0x3675('0x3'));var express=require('express');var router=express[_0x3675('0x4')]();var auth=require(_0x3675('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3675('0x6'));var controller=require(_0x3675('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3675('0x8')](_0x3675('0x9'),auth[_0x3675('0xa')](),controller[_0x3675('0xb')]);router[_0x3675('0xc')]('/',auth[_0x3675('0xa')](),controller[_0x3675('0xd')]);router[_0x3675('0xe')](_0x3675('0x9'),auth[_0x3675('0xa')](),controller[_0x3675('0xf')]);router[_0x3675('0x10')](_0x3675('0x9'),auth[_0x3675('0xa')](),controller['destroy']);module[_0x3675('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 859717d..3a15551 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 _0x243a=['sequelize','exports','STRING','name'];(function(_0x4b032b,_0xc99963){var _0x31d941=function(_0x13cd99){while(--_0x13cd99){_0x4b032b['push'](_0x4b032b['shift']());}};_0x31d941(++_0xc99963);}(_0x243a,0x80));var _0xa243=function(_0x2da21b,_0x432a6e){_0x2da21b=_0x2da21b-0x0;var _0x1a917f=_0x243a[_0x2da21b];return _0x1a917f;};'use strict';var Sequelize=require(_0xa243('0x0'));module[_0xa243('0x1')]={'name':{'type':Sequelize[_0xa243('0x2')],'unique':_0xa243('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9969=['sequelize','STRING','name'];(function(_0x40e1be,_0x553cd6){var _0x59908d=function(_0x1e3d12){while(--_0x1e3d12){_0x40e1be['push'](_0x40e1be['shift']());}};_0x59908d(++_0x553cd6);}(_0x9969,0x7b));var _0x9996=function(_0x3e6656,_0xb89a20){_0x3e6656=_0x3e6656-0x0;var _0x59882b=_0x9969[_0x3e6656];return _0x59882b;};'use strict';var Sequelize=require(_0x9996('0x0'));module['exports']={'name':{'type':Sequelize[_0x9996('0x1')],'unique':_0x9996('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9996('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 493b5ef..2fcb3b2 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 _0xdb01=['Variables','UserProfileResource','error','stack','name','send','Variable','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','rows','catch','params','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','get'];(function(_0x2a3428,_0x4522d5){var _0x29f234=function(_0x407bdf){while(--_0x407bdf){_0x2a3428['push'](_0x2a3428['shift']());}};_0x29f234(++_0x4522d5);}(_0xdb01,0x16d));var _0x1db0=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0xdb01[_0x284a61];return _0x220e3c;};'use strict';var pdf=require(_0x1db0('0x0'));var emlformat=require(_0x1db0('0x1'));var rimraf=require(_0x1db0('0x2'));var zipdir=require(_0x1db0('0x3'));var jsonpatch=require(_0x1db0('0x4'));var rp=require(_0x1db0('0x5'));var moment=require('moment');var BPromise=require(_0x1db0('0x6'));var Mustache=require(_0x1db0('0x7'));var util=require(_0x1db0('0x8'));var path=require(_0x1db0('0x9'));var sox=require(_0x1db0('0xa'));var csv=require(_0x1db0('0xb'));var ejs=require(_0x1db0('0xc'));var fs=require('fs');var _=require(_0x1db0('0xd'));var squel=require(_0x1db0('0xe'));var crypto=require('crypto');var jsforce=require(_0x1db0('0xf'));var deskjs=require(_0x1db0('0x10'));var toCsv=require(_0x1db0('0xb'));var querystring=require(_0x1db0('0x11'));var Papa=require('papaparse');var Redis=require(_0x1db0('0x12'));var authService=require(_0x1db0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1db0('0x14'));var hardwareService=require(_0x1db0('0x15'));var logger=require(_0x1db0('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1db0('0x17'));var db=require(_0x1db0('0x18'))['db'];function respondWithStatusCode(_0x494a8a,_0x1816cf){_0x1816cf=_0x1816cf||0xcc;return function(_0xceb832){if(_0xceb832){return _0x494a8a[_0x1db0('0x19')](_0x1816cf);}return _0x494a8a[_0x1db0('0x1a')](_0x1816cf)[_0x1db0('0x1b')]();};}function respondWithResult(_0x2d587b,_0xae1b82){_0xae1b82=_0xae1b82||0xc8;return function(_0x30442c){if(_0x30442c){return _0x2d587b['status'](_0xae1b82)[_0x1db0('0x1c')](_0x30442c);}};}function respondWithFilteredResult(_0x389b74,_0x18404f){return function(_0x10fcf7){if(_0x10fcf7){var _0x15b289=_0x10fcf7[_0x1db0('0x1d')],_0x1e2a72=_0x18404f[_0x1db0('0x1e')],_0x2a6c44=_0x18404f[_0x1db0('0x1e')]+_0x18404f[_0x1db0('0x1f')],_0x5c242f;if(_0x2a6c44>=_0x15b289){_0x2a6c44=_0x15b289;_0x5c242f=0xc8;}else{_0x5c242f=0xce;}_0x389b74[_0x1db0('0x1a')](_0x5c242f);return _0x389b74[_0x1db0('0x20')](_0x1db0('0x21'),_0x1e2a72+'-'+_0x2a6c44+'/'+_0x15b289)[_0x1db0('0x1c')](_0x10fcf7);}return null;};}function patchUpdates(_0x5df51a){return function(_0x36af22){try{jsonpatch['apply'](_0x36af22,_0x5df51a,!![]);}catch(_0x4c396d){return BPromise[_0x1db0('0x22')](_0x4c396d);}return _0x36af22[_0x1db0('0x23')]();};}function saveUpdates(_0x4841fd,_0x326a02){return function(_0x1222ad){if(_0x1222ad){return _0x1222ad[_0x1db0('0x24')](_0x4841fd)['then'](function(_0x2cb7a7){return _0x2cb7a7;});}return null;};}function removeEntity(_0x10c837,_0x3297c1){return function(_0x1f29d5){if(_0x1f29d5){return _0x1f29d5[_0x1db0('0x25')]()[_0x1db0('0x26')](function(){var _0x264687=_0x1f29d5[_0x1db0('0x27')]({'plain':!![]});var _0xc1e27a=_0x1db0('0x28');return db[_0x1db0('0x29')][_0x1db0('0x25')]({'where':{'type':_0xc1e27a,'resourceId':_0x264687['id']}})['then'](function(){return _0x1f29d5;});})['then'](function(){_0x10c837[_0x1db0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50c894,_0x4ab10a){return function(_0x3ebb47){if(!_0x3ebb47){_0x50c894[_0x1db0('0x19')](0x194);}return _0x3ebb47;};}function handleError(_0x3bbd04,_0x5ed1a4){_0x5ed1a4=_0x5ed1a4||0x1f4;return function(_0xfc3eef){logger[_0x1db0('0x2a')](_0xfc3eef[_0x1db0('0x2b')]);if(_0xfc3eef['name']){delete _0xfc3eef[_0x1db0('0x2c')];}_0x3bbd04['status'](_0x5ed1a4)[_0x1db0('0x2d')](_0xfc3eef);};}exports['index']=function(_0x19dc82,_0x1d0166){var _0x18d784={},_0x22e453={},_0x128a1a={'count':0x0,'rows':[]};var _0x5f2486=_['map'](db[_0x1db0('0x2e')][_0x1db0('0x2f')],function(_0x39a8a6){return{'name':_0x39a8a6[_0x1db0('0x30')],'type':_0x39a8a6['type'][_0x1db0('0x31')]};});_0x22e453[_0x1db0('0x32')]=_['map'](_0x5f2486,_0x1db0('0x2c'));_0x22e453[_0x1db0('0x33')]=_[_0x1db0('0x34')](_0x19dc82['query']);_0x22e453[_0x1db0('0x35')]=_[_0x1db0('0x36')](_0x22e453[_0x1db0('0x32')],_0x22e453['query']);_0x18d784[_0x1db0('0x37')]=_[_0x1db0('0x36')](_0x22e453[_0x1db0('0x32')],qs[_0x1db0('0x38')](_0x19dc82[_0x1db0('0x33')]['fields']));_0x18d784['attributes']=_0x18d784[_0x1db0('0x37')][_0x1db0('0x39')]?_0x18d784['attributes']:_0x22e453['model'];if(!_0x19dc82[_0x1db0('0x33')][_0x1db0('0x3a')]('nolimit')){_0x18d784[_0x1db0('0x1f')]=qs[_0x1db0('0x1f')](_0x19dc82[_0x1db0('0x33')][_0x1db0('0x1f')]);_0x18d784[_0x1db0('0x1e')]=qs[_0x1db0('0x1e')](_0x19dc82['query'][_0x1db0('0x1e')]);}_0x18d784[_0x1db0('0x3b')]=qs[_0x1db0('0x3c')](_0x19dc82[_0x1db0('0x33')][_0x1db0('0x3c')]);_0x18d784[_0x1db0('0x3d')]=qs[_0x1db0('0x35')](_[_0x1db0('0x3e')](_0x19dc82[_0x1db0('0x33')],_0x22e453[_0x1db0('0x35')]),_0x5f2486);if(_0x19dc82[_0x1db0('0x33')][_0x1db0('0x3f')]){_0x18d784[_0x1db0('0x3d')]=_[_0x1db0('0x40')](_0x18d784[_0x1db0('0x3d')],{'$or':_[_0x1db0('0x41')](_0x5f2486,function(_0x52f527){if(_0x52f527[_0x1db0('0x42')]!==_0x1db0('0x43')){var _0x1e555c={};_0x1e555c[_0x52f527[_0x1db0('0x2c')]]={'$like':'%'+_0x19dc82[_0x1db0('0x33')]['filter']+'%'};return _0x1e555c;}})});}_0x18d784=_[_0x1db0('0x40')]({},_0x18d784,_0x19dc82[_0x1db0('0x44')]);var _0x23481a={'where':_0x18d784[_0x1db0('0x3d')]};return db['Variable']['count'](_0x23481a)[_0x1db0('0x26')](function(_0x23cc6d){_0x128a1a[_0x1db0('0x1d')]=_0x23cc6d;if(_0x19dc82[_0x1db0('0x33')]['includeAll']){_0x18d784['include']=[{'all':!![]}];}return db[_0x1db0('0x2e')]['findAll'](_0x18d784);})[_0x1db0('0x26')](function(_0x25e647){_0x128a1a[_0x1db0('0x45')]=_0x25e647;return _0x128a1a;})[_0x1db0('0x26')](respondWithFilteredResult(_0x1d0166,_0x18d784))[_0x1db0('0x46')](handleError(_0x1d0166,null));};exports['show']=function(_0x3cb461,_0x29ea0a){var _0x51c9c2={'raw':!![],'where':{'id':_0x3cb461[_0x1db0('0x47')]['id']}},_0xbfc997={};_0xbfc997[_0x1db0('0x32')]=_[_0x1db0('0x34')](db[_0x1db0('0x2e')]['rawAttributes']);_0xbfc997[_0x1db0('0x33')]=_[_0x1db0('0x34')](_0x3cb461[_0x1db0('0x33')]);_0xbfc997['filters']=_[_0x1db0('0x36')](_0xbfc997[_0x1db0('0x32')],_0xbfc997[_0x1db0('0x33')]);_0x51c9c2[_0x1db0('0x37')]=_['intersection'](_0xbfc997[_0x1db0('0x32')],qs['fields'](_0x3cb461[_0x1db0('0x33')]['fields']));_0x51c9c2[_0x1db0('0x37')]=_0x51c9c2[_0x1db0('0x37')]['length']?_0x51c9c2[_0x1db0('0x37')]:_0xbfc997[_0x1db0('0x32')];if(_0x3cb461['query'][_0x1db0('0x48')]){_0x51c9c2[_0x1db0('0x49')]=[{'all':!![]}];}_0x51c9c2=_[_0x1db0('0x40')]({},_0x51c9c2,_0x3cb461[_0x1db0('0x44')]);return db[_0x1db0('0x2e')]['find'](_0x51c9c2)['then'](handleEntityNotFound(_0x29ea0a,null))[_0x1db0('0x26')](respondWithResult(_0x29ea0a,null))[_0x1db0('0x46')](handleError(_0x29ea0a,null));};exports[_0x1db0('0x4a')]=function(_0x1d4c04,_0xf08cb9){return db[_0x1db0('0x2e')]['create'](_0x1d4c04[_0x1db0('0x4b')],{})[_0x1db0('0x26')](function(_0x269d7e){var _0x3e6385=_0x1d4c04[_0x1db0('0x4c')][_0x1db0('0x27')]({'plain':!![]});if(!_0x3e6385)throw new Error(_0x1db0('0x4d'));if(_0x3e6385['role']===_0x1db0('0x4c')){var _0x1d46fc=_0x269d7e[_0x1db0('0x27')]({'plain':!![]});var _0x281b53=_0x1db0('0x28');return db[_0x1db0('0x4e')][_0x1db0('0x4f')]({'where':{'name':_0x281b53,'userProfileId':_0x3e6385['userProfileId']},'raw':!![]})[_0x1db0('0x26')](function(_0x5d064a){if(_0x5d064a&&_0x5d064a[_0x1db0('0x50')]===0x0){return db[_0x1db0('0x29')]['create']({'name':_0x1d46fc['name'],'resourceId':_0x1d46fc['id'],'type':_0x5d064a[_0x1db0('0x2c')],'sectionId':_0x5d064a['id']},{})[_0x1db0('0x26')](function(){return _0x269d7e;});}else{return _0x269d7e;}})[_0x1db0('0x46')](function(_0x1ea329){logger[_0x1db0('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ea329);throw _0x1ea329;});}return _0x269d7e;})[_0x1db0('0x26')](respondWithResult(_0xf08cb9,0xc9))[_0x1db0('0x46')](handleError(_0xf08cb9,null));};exports[_0x1db0('0x24')]=function(_0x4edba6,_0x2e4d8e){if(_0x4edba6['body']['id']){delete _0x4edba6[_0x1db0('0x4b')]['id'];}return db[_0x1db0('0x2e')][_0x1db0('0x4f')]({'where':{'id':_0x4edba6[_0x1db0('0x47')]['id']}})[_0x1db0('0x26')](handleEntityNotFound(_0x2e4d8e,null))[_0x1db0('0x26')](saveUpdates(_0x4edba6[_0x1db0('0x4b')],null))[_0x1db0('0x26')](respondWithResult(_0x2e4d8e,null))[_0x1db0('0x46')](handleError(_0x2e4d8e,null));};exports['destroy']=function(_0x577eb1,_0x4629fa){return db[_0x1db0('0x2e')][_0x1db0('0x4f')]({'where':{'id':_0x577eb1['params']['id']}})[_0x1db0('0x26')](handleEntityNotFound(_0x4629fa,null))[_0x1db0('0x26')](removeEntity(_0x4629fa,null))[_0x1db0('0x46')](handleError(_0x4629fa,null));}; \ No newline at end of file +var _0xa968=['status','json','count','limit','Content-Range','apply','reject','update','then','destroy','get','Variables','end','error','stack','name','send','index','Variable','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x35cd69,_0x12289e){var _0x21df7e=function(_0x2f8e15){while(--_0x2f8e15){_0x35cd69['push'](_0x35cd69['shift']());}};_0x21df7e(++_0x12289e);}(_0xa968,0x1c2));var _0x8a96=function(_0x3969ae,_0x3bb56f){_0x3969ae=_0x3969ae-0x0;var _0x2050d2=_0xa968[_0x3969ae];return _0x2050d2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8a96('0x0'));var rimraf=require(_0x8a96('0x1'));var zipdir=require(_0x8a96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a96('0x3'));var moment=require(_0x8a96('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8a96('0x5'));var path=require('path');var sox=require(_0x8a96('0x6'));var csv=require(_0x8a96('0x7'));var ejs=require(_0x8a96('0x8'));var fs=require('fs');var _=require(_0x8a96('0x9'));var squel=require(_0x8a96('0xa'));var crypto=require(_0x8a96('0xb'));var jsforce=require(_0x8a96('0xc'));var deskjs=require(_0x8a96('0xd'));var toCsv=require(_0x8a96('0x7'));var querystring=require('querystring');var Papa=require(_0x8a96('0xe'));var Redis=require(_0x8a96('0xf'));var authService=require(_0x8a96('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8a96('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a96('0x12'))(_0x8a96('0x13'));var utils=require(_0x8a96('0x14'));var config=require(_0x8a96('0x15'));var db=require(_0x8a96('0x16'))['db'];function respondWithStatusCode(_0x47da00,_0x13e056){_0x13e056=_0x13e056||0xcc;return function(_0x13d91d){if(_0x13d91d){return _0x47da00[_0x8a96('0x17')](_0x13e056);}return _0x47da00['status'](_0x13e056)['end']();};}function respondWithResult(_0x326764,_0x13ad04){_0x13ad04=_0x13ad04||0xc8;return function(_0x29f2b8){if(_0x29f2b8){return _0x326764[_0x8a96('0x18')](_0x13ad04)[_0x8a96('0x19')](_0x29f2b8);}};}function respondWithFilteredResult(_0x2b3361,_0x4ab6da){return function(_0xf69e6e){if(_0xf69e6e){var _0x3e2428=_0xf69e6e[_0x8a96('0x1a')],_0x581aa2=_0x4ab6da['offset'],_0xb80da4=_0x4ab6da['offset']+_0x4ab6da[_0x8a96('0x1b')],_0x51254b;if(_0xb80da4>=_0x3e2428){_0xb80da4=_0x3e2428;_0x51254b=0xc8;}else{_0x51254b=0xce;}_0x2b3361[_0x8a96('0x18')](_0x51254b);return _0x2b3361['set'](_0x8a96('0x1c'),_0x581aa2+'-'+_0xb80da4+'/'+_0x3e2428)[_0x8a96('0x19')](_0xf69e6e);}return null;};}function patchUpdates(_0x1a175d){return function(_0x50f783){try{jsonpatch[_0x8a96('0x1d')](_0x50f783,_0x1a175d,!![]);}catch(_0x461dd8){return BPromise[_0x8a96('0x1e')](_0x461dd8);}return _0x50f783['save']();};}function saveUpdates(_0x1808a1,_0x5f1b9c){return function(_0x53154c){if(_0x53154c){return _0x53154c[_0x8a96('0x1f')](_0x1808a1)[_0x8a96('0x20')](function(_0x121ddc){return _0x121ddc;});}return null;};}function removeEntity(_0x3fe751,_0x518e67){return function(_0x314f86){if(_0x314f86){return _0x314f86[_0x8a96('0x21')]()[_0x8a96('0x20')](function(){var _0x270845=_0x314f86[_0x8a96('0x22')]({'plain':!![]});var _0x36c926=_0x8a96('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x36c926,'resourceId':_0x270845['id']}})[_0x8a96('0x20')](function(){return _0x314f86;});})['then'](function(){_0x3fe751['status'](0xcc)[_0x8a96('0x24')]();});}};}function handleEntityNotFound(_0x588e67,_0x3a3a9e){return function(_0x64f15c){if(!_0x64f15c){_0x588e67[_0x8a96('0x17')](0x194);}return _0x64f15c;};}function handleError(_0x3a87bd,_0x4fdfa1){_0x4fdfa1=_0x4fdfa1||0x1f4;return function(_0x2d2b99){logger[_0x8a96('0x25')](_0x2d2b99[_0x8a96('0x26')]);if(_0x2d2b99[_0x8a96('0x27')]){delete _0x2d2b99[_0x8a96('0x27')];}_0x3a87bd['status'](_0x4fdfa1)[_0x8a96('0x28')](_0x2d2b99);};}exports[_0x8a96('0x29')]=function(_0x15c373,_0x5f3880){var _0x30c776={},_0x6340c4={},_0x44e9de={'count':0x0,'rows':[]};var _0x34d69e=_['map'](db[_0x8a96('0x2a')]['rawAttributes'],function(_0x154a13){return{'name':_0x154a13[_0x8a96('0x2b')],'type':_0x154a13['type']['key']};});_0x6340c4[_0x8a96('0x2c')]=_[_0x8a96('0x2d')](_0x34d69e,_0x8a96('0x27'));_0x6340c4['query']=_[_0x8a96('0x2e')](_0x15c373[_0x8a96('0x2f')]);_0x6340c4[_0x8a96('0x30')]=_[_0x8a96('0x31')](_0x6340c4[_0x8a96('0x2c')],_0x6340c4[_0x8a96('0x2f')]);_0x30c776[_0x8a96('0x32')]=_[_0x8a96('0x31')](_0x6340c4[_0x8a96('0x2c')],qs[_0x8a96('0x33')](_0x15c373[_0x8a96('0x2f')]['fields']));_0x30c776[_0x8a96('0x32')]=_0x30c776[_0x8a96('0x32')][_0x8a96('0x34')]?_0x30c776['attributes']:_0x6340c4['model'];if(!_0x15c373['query'][_0x8a96('0x35')](_0x8a96('0x36'))){_0x30c776[_0x8a96('0x1b')]=qs[_0x8a96('0x1b')](_0x15c373[_0x8a96('0x2f')][_0x8a96('0x1b')]);_0x30c776[_0x8a96('0x37')]=qs[_0x8a96('0x37')](_0x15c373['query'][_0x8a96('0x37')]);}_0x30c776[_0x8a96('0x38')]=qs[_0x8a96('0x39')](_0x15c373['query']['sort']);_0x30c776[_0x8a96('0x3a')]=qs[_0x8a96('0x30')](_[_0x8a96('0x3b')](_0x15c373[_0x8a96('0x2f')],_0x6340c4[_0x8a96('0x30')]),_0x34d69e);if(_0x15c373['query'][_0x8a96('0x3c')]){_0x30c776[_0x8a96('0x3a')]=_[_0x8a96('0x3d')](_0x30c776[_0x8a96('0x3a')],{'$or':_[_0x8a96('0x2d')](_0x34d69e,function(_0x4e0fc2){if(_0x4e0fc2['type']!==_0x8a96('0x3e')){var _0x213666={};_0x213666[_0x4e0fc2[_0x8a96('0x27')]]={'$like':'%'+_0x15c373[_0x8a96('0x2f')][_0x8a96('0x3c')]+'%'};return _0x213666;}})});}_0x30c776=_[_0x8a96('0x3d')]({},_0x30c776,_0x15c373[_0x8a96('0x3f')]);var _0x1d3c04={'where':_0x30c776['where']};return db[_0x8a96('0x2a')][_0x8a96('0x1a')](_0x1d3c04)[_0x8a96('0x20')](function(_0xb88e85){_0x44e9de['count']=_0xb88e85;if(_0x15c373[_0x8a96('0x2f')][_0x8a96('0x40')]){_0x30c776[_0x8a96('0x41')]=[{'all':!![]}];}return db[_0x8a96('0x2a')][_0x8a96('0x42')](_0x30c776);})[_0x8a96('0x20')](function(_0xaf7832){_0x44e9de[_0x8a96('0x43')]=_0xaf7832;return _0x44e9de;})[_0x8a96('0x20')](respondWithFilteredResult(_0x5f3880,_0x30c776))[_0x8a96('0x44')](handleError(_0x5f3880,null));};exports['show']=function(_0x46e273,_0x292bb6){var _0x3b4fc1={'raw':!![],'where':{'id':_0x46e273[_0x8a96('0x45')]['id']}},_0x161475={};_0x161475[_0x8a96('0x2c')]=_[_0x8a96('0x2e')](db[_0x8a96('0x2a')]['rawAttributes']);_0x161475[_0x8a96('0x2f')]=_[_0x8a96('0x2e')](_0x46e273['query']);_0x161475[_0x8a96('0x30')]=_[_0x8a96('0x31')](_0x161475[_0x8a96('0x2c')],_0x161475[_0x8a96('0x2f')]);_0x3b4fc1[_0x8a96('0x32')]=_['intersection'](_0x161475['model'],qs[_0x8a96('0x33')](_0x46e273['query'][_0x8a96('0x33')]));_0x3b4fc1[_0x8a96('0x32')]=_0x3b4fc1['attributes'][_0x8a96('0x34')]?_0x3b4fc1['attributes']:_0x161475[_0x8a96('0x2c')];if(_0x46e273[_0x8a96('0x2f')][_0x8a96('0x40')]){_0x3b4fc1['include']=[{'all':!![]}];}_0x3b4fc1=_['merge']({},_0x3b4fc1,_0x46e273['options']);return db[_0x8a96('0x2a')][_0x8a96('0x46')](_0x3b4fc1)['then'](handleEntityNotFound(_0x292bb6,null))[_0x8a96('0x20')](respondWithResult(_0x292bb6,null))[_0x8a96('0x44')](handleError(_0x292bb6,null));};exports['create']=function(_0x482ac0,_0x254482){return db[_0x8a96('0x2a')]['create'](_0x482ac0[_0x8a96('0x47')],{})['then'](function(_0x340abf){var _0x5a0353=_0x482ac0[_0x8a96('0x48')][_0x8a96('0x22')]({'plain':!![]});if(!_0x5a0353)throw new Error(_0x8a96('0x49'));if(_0x5a0353[_0x8a96('0x4a')]===_0x8a96('0x48')){var _0x477e36=_0x340abf[_0x8a96('0x22')]({'plain':!![]});var _0x58fd3f='Variables';return db[_0x8a96('0x4b')][_0x8a96('0x46')]({'where':{'name':_0x58fd3f,'userProfileId':_0x5a0353[_0x8a96('0x4c')]},'raw':!![]})['then'](function(_0x5a8c6c){if(_0x5a8c6c&&_0x5a8c6c['autoAssociation']===0x0){return db['UserProfileResource'][_0x8a96('0x4d')]({'name':_0x477e36[_0x8a96('0x27')],'resourceId':_0x477e36['id'],'type':_0x5a8c6c['name'],'sectionId':_0x5a8c6c['id']},{})[_0x8a96('0x20')](function(){return _0x340abf;});}else{return _0x340abf;}})[_0x8a96('0x44')](function(_0x31cde8){logger[_0x8a96('0x25')](_0x8a96('0x4e'),_0x31cde8);throw _0x31cde8;});}return _0x340abf;})[_0x8a96('0x20')](respondWithResult(_0x254482,0xc9))['catch'](handleError(_0x254482,null));};exports['update']=function(_0x1b814e,_0x5aa155){if(_0x1b814e[_0x8a96('0x47')]['id']){delete _0x1b814e[_0x8a96('0x47')]['id'];}return db[_0x8a96('0x2a')][_0x8a96('0x46')]({'where':{'id':_0x1b814e[_0x8a96('0x45')]['id']}})['then'](handleEntityNotFound(_0x5aa155,null))['then'](saveUpdates(_0x1b814e[_0x8a96('0x47')],null))[_0x8a96('0x20')](respondWithResult(_0x5aa155,null))[_0x8a96('0x44')](handleError(_0x5aa155,null));};exports['destroy']=function(_0x32c685,_0x392f2a){return db[_0x8a96('0x2a')][_0x8a96('0x46')]({'where':{'id':_0x32c685[_0x8a96('0x45')]['id']}})[_0x8a96('0x20')](handleEntityNotFound(_0x392f2a,null))[_0x8a96('0x20')](removeEntity(_0x392f2a,null))[_0x8a96('0x44')](handleError(_0x392f2a,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 779aed4..a0099ef 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 _0xee5c=['tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable'];(function(_0x30d741,_0xdf9600){var _0x252b78=function(_0x1c1f0c){while(--_0x1c1f0c){_0x30d741['push'](_0x30d741['shift']());}};_0x252b78(++_0xdf9600);}(_0xee5c,0xb7));var _0xcee5=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0xee5c[_0x4a599b];return _0x2d53d3;};'use strict';var _=require(_0xcee5('0x0'));var util=require(_0xcee5('0x1'));var logger=require(_0xcee5('0x2'))(_0xcee5('0x3'));var moment=require('moment');var BPromise=require(_0xcee5('0x4'));var rp=require(_0xcee5('0x5'));var fs=require('fs');var path=require(_0xcee5('0x6'));var rimraf=require(_0xcee5('0x7'));var config=require(_0xcee5('0x8'));var attributes=require(_0xcee5('0x9'));module[_0xcee5('0xa')]=function(_0x30fd77,_0x103c3e){return _0x30fd77[_0xcee5('0xb')](_0xcee5('0xc'),attributes,{'tableName':_0xcee5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e23=['util','../../config/logger','moment','bluebird','request-promise','path','./variable.attributes','exports','define','tools_variables'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0x8e23,0x136));var _0x38e2=function(_0x7a9761,_0x164166){_0x7a9761=_0x7a9761-0x0;var _0x3658f7=_0x8e23[_0x7a9761];return _0x3658f7;};'use strict';var _=require('lodash');var util=require(_0x38e2('0x0'));var logger=require(_0x38e2('0x1'))('api');var moment=require(_0x38e2('0x2'));var BPromise=require(_0x38e2('0x3'));var rp=require(_0x38e2('0x4'));var fs=require('fs');var path=require(_0x38e2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x38e2('0x6'));module[_0x38e2('0x7')]=function(_0x174e56,_0x57063e){return _0x174e56[_0x38e2('0x8')]('Variable',attributes,{'tableName':_0x38e2('0x9'),'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 0ee8b64..7e67c0b 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 _0x1e94=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Variable','options','where','attributes','include','map','model','ShowVariable','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e94,0x102));var _0x41e9=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x1e94[_0x2d486b];return _0x4291d1;};'use strict';var _=require(_0x41e9('0x0'));var util=require(_0x41e9('0x1'));var moment=require(_0x41e9('0x2'));var BPromise=require(_0x41e9('0x3'));var rs=require(_0x41e9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41e9('0x5'))['db'];var utils=require(_0x41e9('0x6'));var logger=require(_0x41e9('0x7'))(_0x41e9('0x8'));var config=require(_0x41e9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x41e9('0xa')][_0x41e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e539b,_0x2bc87d,_0x17665c){return new BPromise(function(_0x2ae304,_0x4d2db9){return client[_0x41e9('0xc')](_0x5e539b,_0x17665c)[_0x41e9('0xd')](function(_0x169b71){logger[_0x41e9('0xe')](_0x41e9('0xf'),_0x2bc87d,_0x41e9('0x10'));logger[_0x41e9('0x11')](_0x41e9('0x12'),_0x2bc87d,_0x41e9('0x10'),JSON[_0x41e9('0x13')](_0x169b71));if(_0x169b71[_0x41e9('0x14')]){if(_0x169b71[_0x41e9('0x14')][_0x41e9('0x15')]===0x1f4){logger['error'](_0x41e9('0xf'),_0x2bc87d,_0x169b71['error']['message']);return _0x4d2db9(_0x169b71[_0x41e9('0x14')]['message']);}logger['error'](_0x41e9('0xf'),_0x2bc87d,_0x169b71[_0x41e9('0x14')][_0x41e9('0x16')]);return _0x2ae304(_0x169b71['error'][_0x41e9('0x16')]);}else{logger[_0x41e9('0xe')](_0x41e9('0xf'),_0x2bc87d,_0x41e9('0x10'));_0x2ae304(_0x169b71[_0x41e9('0x17')][_0x41e9('0x16')]);}})['catch'](function(_0x417994){logger[_0x41e9('0x14')](_0x41e9('0xf'),_0x2bc87d,_0x417994);_0x4d2db9(_0x417994);});});}exports['ShowVariable']=function(_0x14acda){var _0x496b5b=this;return new Promise(function(_0x178277,_0x14ecaa){return db[_0x41e9('0x18')]['find']({'raw':_0x14acda[_0x41e9('0x19')]?_0x14acda[_0x41e9('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x14acda[_0x41e9('0x19')]?_0x14acda[_0x41e9('0x19')][_0x41e9('0x1a')]||null:null,'attributes':_0x14acda['options']?_0x14acda[_0x41e9('0x19')][_0x41e9('0x1b')]||null:null,'include':_0x14acda[_0x41e9('0x19')]?_0x14acda[_0x41e9('0x19')][_0x41e9('0x1c')]?_[_0x41e9('0x1d')](_0x14acda[_0x41e9('0x19')][_0x41e9('0x1c')],function(_0x27f5ab){return{'model':db[_0x27f5ab[_0x41e9('0x1e')]],'as':_0x27f5ab['as'],'attributes':_0x27f5ab[_0x41e9('0x1b')],'include':_0x27f5ab[_0x41e9('0x1c')]?_[_0x41e9('0x1d')](_0x27f5ab['include'],function(_0x134602){return{'model':db[_0x134602[_0x41e9('0x1e')]],'as':_0x134602['as'],'attributes':_0x134602[_0x41e9('0x1b')],'include':_0x134602[_0x41e9('0x1c')]?_[_0x41e9('0x1d')](_0x134602[_0x41e9('0x1c')],function(_0x57a8d5){return{'model':db[_0x57a8d5[_0x41e9('0x1e')]],'as':_0x57a8d5['as'],'attributes':_0x57a8d5[_0x41e9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x41e9('0xd')](function(_0x5e0bc5){logger[_0x41e9('0xe')](_0x41e9('0x1f'),_0x14acda);logger[_0x41e9('0x11')](_0x41e9('0x1f'),_0x14acda,JSON[_0x41e9('0x13')](_0x5e0bc5));_0x178277(_0x5e0bc5);})[_0x41e9('0x20')](function(_0x52fc39){logger[_0x41e9('0x14')](_0x41e9('0x1f'),_0x52fc39[_0x41e9('0x16')],_0x14acda);_0x14ecaa(_0x496b5b[_0x41e9('0x14')](0x1f4,_0x52fc39[_0x41e9('0x16')]));});});}; \ No newline at end of file +var _0xf81f=['options','raw','where','attributes','include','model','map','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowVariable','Variable'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf81f,0x128));var _0xff81=function(_0x15aec1,_0x527e84){_0x15aec1=_0x15aec1-0x0;var _0x37a89d=_0xf81f[_0x15aec1];return _0x37a89d;};'use strict';var _=require('lodash');var util=require(_0xff81('0x0'));var moment=require(_0xff81('0x1'));var BPromise=require(_0xff81('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff81('0x3'));var db=require(_0xff81('0x4'))['db'];var utils=require(_0xff81('0x5'));var logger=require(_0xff81('0x6'))(_0xff81('0x7'));var config=require(_0xff81('0x8'));var jayson=require(_0xff81('0x9'));var client=jayson[_0xff81('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d4090,_0x42ea89,_0x5763a7){return new BPromise(function(_0x31f2cc,_0x30738f){return client[_0xff81('0xb')](_0x1d4090,_0x5763a7)[_0xff81('0xc')](function(_0x482ef3){logger[_0xff81('0xd')](_0xff81('0xe'),_0x42ea89,'request\x20sent');logger[_0xff81('0xf')](_0xff81('0x10'),_0x42ea89,_0xff81('0x11'),JSON[_0xff81('0x12')](_0x482ef3));if(_0x482ef3[_0xff81('0x13')]){if(_0x482ef3['error']['code']===0x1f4){logger[_0xff81('0x13')]('Variable,\x20%s,\x20%s',_0x42ea89,_0x482ef3[_0xff81('0x13')][_0xff81('0x14')]);return _0x30738f(_0x482ef3[_0xff81('0x13')][_0xff81('0x14')]);}logger[_0xff81('0x13')](_0xff81('0xe'),_0x42ea89,_0x482ef3['error'][_0xff81('0x14')]);return _0x31f2cc(_0x482ef3[_0xff81('0x13')][_0xff81('0x14')]);}else{logger[_0xff81('0xd')]('Variable,\x20%s,\x20%s',_0x42ea89,_0xff81('0x11'));_0x31f2cc(_0x482ef3[_0xff81('0x15')][_0xff81('0x14')]);}})['catch'](function(_0x2e9e6f){logger[_0xff81('0x13')]('Variable,\x20%s,\x20%s',_0x42ea89,_0x2e9e6f);_0x30738f(_0x2e9e6f);});});}exports[_0xff81('0x16')]=function(_0x39ffdd){var _0x39e54a=this;return new Promise(function(_0x39e4a2,_0x1a6968){return db[_0xff81('0x17')]['find']({'raw':_0x39ffdd[_0xff81('0x18')]?_0x39ffdd[_0xff81('0x18')][_0xff81('0x19')]===undefined?!![]:![]:!![],'where':_0x39ffdd[_0xff81('0x18')]?_0x39ffdd[_0xff81('0x18')][_0xff81('0x1a')]||null:null,'attributes':_0x39ffdd['options']?_0x39ffdd[_0xff81('0x18')][_0xff81('0x1b')]||null:null,'include':_0x39ffdd[_0xff81('0x18')]?_0x39ffdd['options'][_0xff81('0x1c')]?_['map'](_0x39ffdd[_0xff81('0x18')][_0xff81('0x1c')],function(_0x1e48d7){return{'model':db[_0x1e48d7[_0xff81('0x1d')]],'as':_0x1e48d7['as'],'attributes':_0x1e48d7['attributes'],'include':_0x1e48d7[_0xff81('0x1c')]?_[_0xff81('0x1e')](_0x1e48d7[_0xff81('0x1c')],function(_0x114b74){return{'model':db[_0x114b74[_0xff81('0x1d')]],'as':_0x114b74['as'],'attributes':_0x114b74[_0xff81('0x1b')],'include':_0x114b74[_0xff81('0x1c')]?_['map'](_0x114b74[_0xff81('0x1c')],function(_0xc45fc0){return{'model':db[_0xc45fc0[_0xff81('0x1d')]],'as':_0xc45fc0['as'],'attributes':_0xc45fc0[_0xff81('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x135600){logger[_0xff81('0xd')](_0xff81('0x16'),_0x39ffdd);logger['debug'](_0xff81('0x16'),_0x39ffdd,JSON[_0xff81('0x12')](_0x135600));_0x39e4a2(_0x135600);})[_0xff81('0x1f')](function(_0x5a6c10){logger[_0xff81('0x13')](_0xff81('0x16'),_0x5a6c10[_0xff81('0x14')],_0x39ffdd);_0x1a6968(_0x39e54a['error'](0x1f4,_0x5a6c10[_0xff81('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index f5a83d7..82b45c9 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 _0xa3ec=['/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','index','get','isAuthenticated','canUpdate','fetch'];(function(_0x544f04,_0x3ad158){var _0x2f200e=function(_0x5c980c){while(--_0x5c980c){_0x544f04['push'](_0x544f04['shift']());}};_0x2f200e(++_0x3ad158);}(_0xa3ec,0x195));var _0xca3e=function(_0x27c1e3,_0x413cf3){_0x27c1e3=_0x27c1e3-0x0;var _0x2ad841=_0xa3ec[_0x27c1e3];return _0x2ad841;};'use strict';var express=require(_0xca3e('0x0'));var router=express[_0xca3e('0x1')]();var auth=require(_0xca3e('0x2'));var controller=require(_0xca3e('0x3'));router['get']('/',controller[_0xca3e('0x4')]);router[_0xca3e('0x5')]('/fetch',auth[_0xca3e('0x6')](),auth[_0xca3e('0x7')](),controller[_0xca3e('0x8')]);router[_0xca3e('0x5')](_0xca3e('0x9'),auth[_0xca3e('0x6')](),auth[_0xca3e('0x7')](),controller[_0xca3e('0xa')]);router['get'](_0xca3e('0xb'),auth['isAuthenticated'](),auth[_0xca3e('0x7')](),controller[_0xca3e('0xc')]);router[_0xca3e('0x5')](_0xca3e('0xd'),auth[_0xca3e('0x6')](),controller[_0xca3e('0xe')]);router[_0xca3e('0x5')](_0xca3e('0xf'),controller[_0xca3e('0x10')]);module[_0xca3e('0x11')]=router; \ No newline at end of file +var _0xfa09=['index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','./version.controller','get'];(function(_0x23ed26,_0x1d2ff4){var _0x545502=function(_0x5bd921){while(--_0x5bd921){_0x23ed26['push'](_0x23ed26['shift']());}};_0x545502(++_0x1d2ff4);}(_0xfa09,0x10a));var _0x9fa0=function(_0x45a1b8,_0xdea5ee){_0x45a1b8=_0x45a1b8-0x0;var _0x50e3d6=_0xfa09[_0x45a1b8];return _0x50e3d6;};'use strict';var express=require(_0x9fa0('0x0'));var router=express[_0x9fa0('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9fa0('0x2'));router[_0x9fa0('0x3')]('/',controller[_0x9fa0('0x4')]);router[_0x9fa0('0x3')](_0x9fa0('0x5'),auth[_0x9fa0('0x6')](),auth[_0x9fa0('0x7')](),controller[_0x9fa0('0x8')]);router['get'](_0x9fa0('0x9'),auth['isAuthenticated'](),auth[_0x9fa0('0x7')](),controller[_0x9fa0('0xa')]);router[_0x9fa0('0x3')](_0x9fa0('0xb'),auth[_0x9fa0('0x6')](),auth['canUpdate'](),controller[_0x9fa0('0xc')]);router[_0x9fa0('0x3')](_0x9fa0('0xd'),auth[_0x9fa0('0x6')](),controller[_0x9fa0('0xe')]);router[_0x9fa0('0x3')](_0x9fa0('0xf'),controller[_0x9fa0('0x10')]);module[_0x9fa0('0x11')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 26f83ad..88aa148 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 _0xf643=['getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','sequelize','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','length','replace','push'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0xf643,0x122));var _0x3f64=function(_0x55c2a5,_0x3ab35b){_0x55c2a5=_0x55c2a5-0x0;var _0x177d1d=_0xf643[_0x55c2a5];return _0x177d1d;};'use strict';var Umzug=require(_0x3f64('0x0'));var path=require(_0x3f64('0x1'));var fs=require('fs');var _=require(_0x3f64('0x2'));var pkginfo=require(_0x3f64('0x3'))(module,'version');var compareVersions=require(_0x3f64('0x4'));var exec=require(_0x3f64('0x5'))['exec'];var db=require(_0x3f64('0x6'))['db'];var config=require(_0x3f64('0x7'));var pm2=require(_0x3f64('0x8'));var logger=require(_0x3f64('0x9'))(_0x3f64('0xa'));var git=require(_0x3f64('0xb'))(config[_0x3f64('0xc')]);exports[_0x3f64('0xd')]=function(_0x40b245,_0x2a7c90){var _0x219dcb={'current':module[_0x3f64('0xe')][_0x3f64('0xf')],'phonebar':0x2};if(_0x40b245[_0x3f64('0x10')]&&_0x40b245[_0x3f64('0x10')]['latest']){return git[_0x3f64('0x11')]()[_0x3f64('0x12')](function(_0x8aa885,_0x506f2a){_0x219dcb[_0x3f64('0x13')]=(_0x8aa885?module[_0x3f64('0xe')][_0x3f64('0xf')]:_0x506f2a[_0x3f64('0x13')])||_0x3f64('0x14');return _0x2a7c90[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')](_0x219dcb);});}else{return _0x2a7c90[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')](_0x219dcb);}};exports[_0x3f64('0x11')]=function(_0x4b77e1,_0x3165b6){return git['fetch']([_0x3f64('0x17'),_0x3f64('0x18')],function(_0x3fb0bd){if(_0x3fb0bd){logger[_0x3f64('0x19')](_0x3fb0bd);return _0x3165b6['status'](0x1f4)[_0x3f64('0x16')](_0x3fb0bd);}logger[_0x3f64('0x1a')](_0x3f64('0x1b'));return _0x3165b6[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')]({'output':_0x3f64('0x1c')});});};exports[_0x3f64('0x1d')]=function(_0x5ac514,_0xbcf1aa){return git[_0x3f64('0x1d')]([_0x3f64('0x1e'),'FETCH_HEAD'],function(_0x628b59){if(_0x628b59){logger['error'](_0x628b59);return _0xbcf1aa['status'](0x1f4)[_0x3f64('0x16')](_0x628b59);}logger[_0x3f64('0x1a')](_0x3f64('0x1f'));return _0xbcf1aa['status'](0xc8)[_0x3f64('0x16')]({'output':_0x3f64('0x20')});});};exports[_0x3f64('0x21')]=function(_0x5f5507,_0x16b3fd){exec(_0x3f64('0x22'),function(_0x4c725c,_0xc72655,_0x3faf46){logger['info'](_0xc72655);logger['info'](_0x3faf46);if(_0x4c725c){logger['error'](_0x4c725c);return _0x16b3fd[_0x3f64('0x15')](0x1f4)[_0x3f64('0x16')](_0x4c725c);}return _0x16b3fd[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')]({'output':_0xc72655});});};exports[_0x3f64('0x23')]=function(_0x48be0c,_0x222097){return pm2[_0x3f64('0x23')](_0x3f64('0x24'))[_0x3f64('0x25')](function(_0x383780){logger[_0x3f64('0x1a')](_0x3f64('0x26'),_0x383780);return _0x222097[_0x3f64('0x15')](0xc8)['json']({'output':_0x3f64('0x27')});})['catch'](function(_0x473b46){logger[_0x3f64('0x19')](_0x473b46);return _0x222097[_0x3f64('0x15')](0x1f4)[_0x3f64('0x16')](_0x473b46);});};exports[_0x3f64('0x28')]=function(_0x307efc,_0x286b2a){var _0x1bcefe=fs[_0x3f64('0x29')](path[_0x3f64('0x2a')](config['root'],'server',_0x3f64('0x28')));var _0x5a03a8=[];for(var _0x34e8cc=0x0;_0x34e8cc<_0x1bcefe[_0x3f64('0x2b')];_0x34e8cc++){var _0x211da2=_0x1bcefe[_0x34e8cc][_0x3f64('0x2c')]('.js','');if(compareVersions(module['exports'][_0x3f64('0xf')],_0x211da2)===-0x1){_0x5a03a8[_0x3f64('0x2d')](_0x211da2);}}if(_0x5a03a8[_0x3f64('0x2b')]){var _0x2a2579=_0x5a03a8['sort'](compareVersions);var _0x1ee952=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x3f64('0xf')},'migrations':{'params':[db['sequelize'][_0x3f64('0x2e')](),db['sequelize'][_0x3f64('0x2f')],function(){throw new Error(_0x3f64('0x30'));}],'path':path[_0x3f64('0x2a')](config[_0x3f64('0xc')],'server',_0x3f64('0x28')),'pattern':/\.js$/}});_0x1ee952['up']({'migrations':_[_0x3f64('0x31')](_0x2a2579,function(_0x2fe6b5){return _0x2fe6b5+'.js';})})['then'](function(){return _0x286b2a[_0x3f64('0x15')](0xc8)['json']({'output':_0x3f64('0x32')+module[_0x3f64('0xe')][_0x3f64('0xf')]+'\x20to\x20'+_[_0x3f64('0x33')](_0x2a2579),'migrations':_[_0x3f64('0x2a')](_0x2a2579)});})[_0x3f64('0x34')](function(_0x4210c6){if(_0x4210c6 instanceof db[_0x3f64('0x35')][_0x3f64('0x36')]){return _0x286b2a[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')]({'output':_0x3f64('0x37')});}else{return _0x286b2a[_0x3f64('0x15')](0x1f4)[_0x3f64('0x16')](_0x4210c6);}});}else{return _0x286b2a[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')]({'output':_0x3f64('0x37')});}}; \ No newline at end of file +var _0x6bfc=['git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','\x20to\x20','last','Database\x20already\x20up-to-date','path','lodash','pkginfo','compare-versions','exec','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','version','query','latest','fetch','tags','2.0.0','status','json','master','error','info','git\x20fetch','--hard','FETCH_HEAD'];(function(_0x9c6c1c,_0x21ead9){var _0x594c42=function(_0x27764b){while(--_0x27764b){_0x9c6c1c['push'](_0x9c6c1c['shift']());}};_0x594c42(++_0x21ead9);}(_0x6bfc,0x159));var _0xc6bf=function(_0x474095,_0x1608e2){_0x474095=_0x474095-0x0;var _0x58c58a=_0x6bfc[_0x474095];return _0x58c58a;};'use strict';var Umzug=require('umzug');var path=require(_0xc6bf('0x0'));var fs=require('fs');var _=require(_0xc6bf('0x1'));var pkginfo=require(_0xc6bf('0x2'))(module,'version');var compareVersions=require(_0xc6bf('0x3'));var exec=require('child_process')[_0xc6bf('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0xc6bf('0x5'));var pm2=require(_0xc6bf('0x6'));var logger=require(_0xc6bf('0x7'))('update');var git=require(_0xc6bf('0x8'))(config[_0xc6bf('0x9')]);exports[_0xc6bf('0xa')]=function(_0x28d218,_0x250311){var _0x3b2815={'current':module[_0xc6bf('0xb')][_0xc6bf('0xc')],'phonebar':0x2};if(_0x28d218['query']&&_0x28d218[_0xc6bf('0xd')][_0xc6bf('0xe')]){return git[_0xc6bf('0xf')]()[_0xc6bf('0x10')](function(_0x5f2f8f,_0x5ad559){_0x3b2815[_0xc6bf('0xe')]=(_0x5f2f8f?module[_0xc6bf('0xb')]['version']:_0x5ad559['latest'])||_0xc6bf('0x11');return _0x250311[_0xc6bf('0x12')](0xc8)['json'](_0x3b2815);});}else{return _0x250311[_0xc6bf('0x12')](0xc8)[_0xc6bf('0x13')](_0x3b2815);}};exports[_0xc6bf('0xf')]=function(_0x34420d,_0x42e25e){return git['fetch'](['origin',_0xc6bf('0x14')],function(_0x391117){if(_0x391117){logger[_0xc6bf('0x15')](_0x391117);return _0x42e25e[_0xc6bf('0x12')](0x1f4)[_0xc6bf('0x13')](_0x391117);}logger[_0xc6bf('0x16')](_0xc6bf('0x17'));return _0x42e25e['status'](0xc8)[_0xc6bf('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x195c3f,_0x23a9e9){return git['reset']([_0xc6bf('0x18'),_0xc6bf('0x19')],function(_0x498c02){if(_0x498c02){logger[_0xc6bf('0x15')](_0x498c02);return _0x23a9e9['status'](0x1f4)['json'](_0x498c02);}logger['info'](_0xc6bf('0x1a'));return _0x23a9e9[_0xc6bf('0x12')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0xc6bf('0x1b')]=function(_0x2e47ce,_0x5ca782){exec(_0xc6bf('0x1c'),function(_0x41ca5a,_0x1e2110,_0x56e899){logger['info'](_0x1e2110);logger[_0xc6bf('0x16')](_0x56e899);if(_0x41ca5a){logger[_0xc6bf('0x15')](_0x41ca5a);return _0x5ca782[_0xc6bf('0x12')](0x1f4)[_0xc6bf('0x13')](_0x41ca5a);}return _0x5ca782[_0xc6bf('0x12')](0xc8)[_0xc6bf('0x13')]({'output':_0x1e2110});});};exports[_0xc6bf('0x1d')]=function(_0x1cf65d,_0x5a5d51){return pm2[_0xc6bf('0x1d')](_0xc6bf('0x1e'))[_0xc6bf('0x1f')](function(_0x532bc1){logger[_0xc6bf('0x16')](_0xc6bf('0x20'),_0x532bc1);return _0x5a5d51[_0xc6bf('0x12')](0xc8)[_0xc6bf('0x13')]({'output':_0xc6bf('0x21')});})[_0xc6bf('0x22')](function(_0x5abf52){logger['error'](_0x5abf52);return _0x5a5d51[_0xc6bf('0x12')](0x1f4)['json'](_0x5abf52);});};exports[_0xc6bf('0x23')]=function(_0x48adb6,_0x54fb9a){var _0x2806e6=fs[_0xc6bf('0x24')](path[_0xc6bf('0x25')](config[_0xc6bf('0x9')],'server','migrations'));var _0x543ad5=[];for(var _0x4f0234=0x0;_0x4f0234<_0x2806e6[_0xc6bf('0x26')];_0x4f0234++){var _0xf49ed7=_0x2806e6[_0x4f0234][_0xc6bf('0x27')](_0xc6bf('0x28'),'');if(compareVersions(module[_0xc6bf('0xb')][_0xc6bf('0xc')],_0xf49ed7)===-0x1){_0x543ad5[_0xc6bf('0x29')](_0xf49ed7);}}if(_0x543ad5[_0xc6bf('0x26')]){var _0x14146e=_0x543ad5[_0xc6bf('0x2a')](compareVersions);var _0x2ec79e=new Umzug({'storage':_0xc6bf('0x2b'),'storageOptions':{'model':db[_0xc6bf('0x2c')],'modelName':_0xc6bf('0x2c'),'columnName':_0xc6bf('0xc')},'migrations':{'params':[db['sequelize'][_0xc6bf('0x2d')](),db[_0xc6bf('0x2b')][_0xc6bf('0x2e')],function(){throw new Error(_0xc6bf('0x2f'));}],'path':path['join'](config['root'],_0xc6bf('0x30'),_0xc6bf('0x23')),'pattern':/\.js$/}});_0x2ec79e['up']({'migrations':_[_0xc6bf('0x31')](_0x14146e,function(_0x3e3d15){return _0x3e3d15+_0xc6bf('0x28');})})['then'](function(){return _0x54fb9a[_0xc6bf('0x12')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xc6bf('0xb')][_0xc6bf('0xc')]+_0xc6bf('0x32')+_[_0xc6bf('0x33')](_0x14146e),'migrations':_[_0xc6bf('0x25')](_0x14146e)});})['catch'](function(_0x1f64d5){if(_0x1f64d5 instanceof db[_0xc6bf('0x2b')]['UniqueConstraintError']){return _0x54fb9a[_0xc6bf('0x12')](0xc8)[_0xc6bf('0x13')]({'output':_0xc6bf('0x34')});}else{return _0x54fb9a['status'](0x1f4)['json'](_0x1f64d5);}});}else{return _0x54fb9a['status'](0xc8)[_0xc6bf('0x13')]({'output':_0xc6bf('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 28299e2..7f3d758 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 _0x8761=['put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x3eb9fb,_0x284cb6){var _0x5a5e11=function(_0x43db05){while(--_0x43db05){_0x3eb9fb['push'](_0x3eb9fb['shift']());}};_0x5a5e11(++_0x284cb6);}(_0x8761,0xf5));var _0x1876=function(_0xc780db,_0x480155){_0xc780db=_0xc780db-0x0;var _0x3d5621=_0x8761[_0xc780db];return _0x3d5621;};'use strict';var multer=require('multer');var util=require(_0x1876('0x0'));var path=require(_0x1876('0x1'));var timeout=require(_0x1876('0x2'));var express=require('express');var router=express[_0x1876('0x3')]();var auth=require(_0x1876('0x4'));var interaction=require(_0x1876('0x5'));var config=require('../../config/environment');var controller=require(_0x1876('0x6'));router[_0x1876('0x7')]('/',auth[_0x1876('0x8')](),controller['index']);router[_0x1876('0x7')](_0x1876('0x9'),auth[_0x1876('0x8')](),controller[_0x1876('0xa')]);router[_0x1876('0x7')](_0x1876('0xb'),auth['isAuthenticated'](),controller[_0x1876('0xc')]);router[_0x1876('0xd')]('/',auth[_0x1876('0x8')](),controller[_0x1876('0xe')]);router[_0x1876('0xf')](_0x1876('0xb'),auth[_0x1876('0x8')](),controller[_0x1876('0x10')]);router[_0x1876('0x11')](_0x1876('0xb'),auth[_0x1876('0x8')](),controller[_0x1876('0x12')]);module[_0x1876('0x13')]=router; \ No newline at end of file +var _0x1bf3=['Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x574159,_0x952110){var _0x5dd226=function(_0x5a32f2){while(--_0x5a32f2){_0x574159['push'](_0x574159['shift']());}};_0x5dd226(++_0x952110);}(_0x1bf3,0xcd));var _0x31bf=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1bf3[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x31bf('0x0'));var util=require(_0x31bf('0x1'));var path=require(_0x31bf('0x2'));var timeout=require(_0x31bf('0x3'));var express=require(_0x31bf('0x4'));var router=express[_0x31bf('0x5')]();var auth=require(_0x31bf('0x6'));var interaction=require(_0x31bf('0x7'));var config=require('../../config/environment');var controller=require(_0x31bf('0x8'));router[_0x31bf('0x9')]('/',auth[_0x31bf('0xa')](),controller['index']);router[_0x31bf('0x9')](_0x31bf('0xb'),auth[_0x31bf('0xa')](),controller[_0x31bf('0xc')]);router[_0x31bf('0x9')](_0x31bf('0xd'),auth[_0x31bf('0xa')](),controller[_0x31bf('0xe')]);router[_0x31bf('0xf')]('/',auth['isAuthenticated'](),controller[_0x31bf('0x10')]);router[_0x31bf('0x11')](_0x31bf('0xd'),auth[_0x31bf('0xa')](),controller[_0x31bf('0x12')]);router[_0x31bf('0x13')](_0x31bf('0xd'),auth[_0x31bf('0xa')](),controller['destroy']);module[_0x31bf('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 581b893..e1b9c44 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 _0xeda8=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xeda8,0x104));var _0x8eda=function(_0x16501d,_0x4b1665){_0x16501d=_0x16501d-0x0;var _0x99ce16=_0xeda8[_0x16501d];return _0x99ce16;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8eda('0x2')]},'calleridnum':{'type':Sequelize[_0x8eda('0x2')]},'calleridname':{'type':Sequelize[_0x8eda('0x2')]},'queue':{'type':Sequelize[_0x8eda('0x2')]},'interface':{'type':Sequelize[_0x8eda('0x2')]},'membername':{'type':Sequelize[_0x8eda('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8eda('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8eda('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x8eda('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x8eda('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8eda('0x3')]},'holdtime':{'type':Sequelize[_0x8eda('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8eda('0x4')]},'agentacw':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x8eda('0x4')]},'channelstatedesc':{'type':Sequelize[_0x8eda('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8eda('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8eda('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8eda('0x2')]},'exten':{'type':Sequelize[_0x8eda('0x2')]},'priority':{'type':Sequelize[_0x8eda('0x2')]},'destchannel':{'type':Sequelize[_0x8eda('0x2')]},'destchannelstate':{'type':Sequelize[_0x8eda('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8eda('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8eda('0x2')]},'destcalleridname':{'type':Sequelize[_0x8eda('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8eda('0x2')]},'destaccountcode':{'type':Sequelize[_0x8eda('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x8eda('0x2')]},'destpriority':{'type':Sequelize[_0x8eda('0x2')]},'destuniqueid':{'type':Sequelize[_0x8eda('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x8eda('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8eda('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x8eda('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x8eda('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeda8=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xeda8,0x104));var _0x8eda=function(_0x214d3f,_0x2b96b0){_0x214d3f=_0x214d3f-0x0;var _0x352131=_0xeda8[_0x214d3f];return _0x352131;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8eda('0x2')]},'calleridnum':{'type':Sequelize[_0x8eda('0x2')]},'calleridname':{'type':Sequelize[_0x8eda('0x2')]},'queue':{'type':Sequelize[_0x8eda('0x2')]},'interface':{'type':Sequelize[_0x8eda('0x2')]},'membername':{'type':Sequelize[_0x8eda('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8eda('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8eda('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x8eda('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x8eda('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8eda('0x3')]},'holdtime':{'type':Sequelize[_0x8eda('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8eda('0x4')]},'agentacw':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x8eda('0x4')]},'channelstatedesc':{'type':Sequelize[_0x8eda('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8eda('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8eda('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8eda('0x2')]},'exten':{'type':Sequelize[_0x8eda('0x2')]},'priority':{'type':Sequelize[_0x8eda('0x2')]},'destchannel':{'type':Sequelize[_0x8eda('0x2')]},'destchannelstate':{'type':Sequelize[_0x8eda('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8eda('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8eda('0x2')]},'destcalleridname':{'type':Sequelize[_0x8eda('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8eda('0x2')]},'destaccountcode':{'type':Sequelize[_0x8eda('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x8eda('0x2')]},'destpriority':{'type':Sequelize[_0x8eda('0x2')]},'destuniqueid':{'type':Sequelize[_0x8eda('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x8eda('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8eda('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x8eda('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x8eda('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index d17bd68..ec94a84 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 _0x5426=['limit','set','Content-Range','apply','then','destroy','error','stack','name','send','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','keys','filters','includeAll','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','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/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x43090c,_0x3c9956){var _0x4f1b4d=function(_0x2f0d1d){while(--_0x2f0d1d){_0x43090c['push'](_0x43090c['shift']());}};_0x4f1b4d(++_0x3c9956);}(_0x5426,0x102));var _0x6542=function(_0x57133f,_0x241a29){_0x57133f=_0x57133f-0x0;var _0x310cf7=_0x5426[_0x57133f];return _0x310cf7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6542('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6542('0x1'));var rp=require(_0x6542('0x2'));var moment=require('moment');var BPromise=require(_0x6542('0x3'));var Mustache=require(_0x6542('0x4'));var util=require(_0x6542('0x5'));var path=require(_0x6542('0x6'));var sox=require('sox');var csv=require(_0x6542('0x7'));var ejs=require(_0x6542('0x8'));var fs=require('fs');var _=require(_0x6542('0x9'));var squel=require(_0x6542('0xa'));var crypto=require(_0x6542('0xb'));var jsforce=require(_0x6542('0xc'));var deskjs=require(_0x6542('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6542('0xe'));var Papa=require(_0x6542('0xf'));var Redis=require(_0x6542('0x10'));var authService=require(_0x6542('0x11'));var qs=require(_0x6542('0x12'));var as=require(_0x6542('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6542('0x14'))('api');var utils=require(_0x6542('0x15'));var config=require(_0x6542('0x16'));var db=require(_0x6542('0x17'))['db'];function respondWithStatusCode(_0x474b37,_0x44c6a3){_0x44c6a3=_0x44c6a3||0xcc;return function(_0x1538c3){if(_0x1538c3){return _0x474b37[_0x6542('0x18')](_0x44c6a3);}return _0x474b37[_0x6542('0x19')](_0x44c6a3)[_0x6542('0x1a')]();};}function respondWithResult(_0x280111,_0x160cd2){_0x160cd2=_0x160cd2||0xc8;return function(_0x4b795c){if(_0x4b795c){return _0x280111['status'](_0x160cd2)[_0x6542('0x1b')](_0x4b795c);}};}function respondWithFilteredResult(_0x1a4e85,_0x3bcb88){return function(_0x420222){if(_0x420222){var _0x40e3e8=_0x420222[_0x6542('0x1c')],_0x45952d=_0x3bcb88['offset'],_0x21ad82=_0x3bcb88[_0x6542('0x1d')]+_0x3bcb88[_0x6542('0x1e')],_0x45d137;if(_0x21ad82>=_0x40e3e8){_0x21ad82=_0x40e3e8;_0x45d137=0xc8;}else{_0x45d137=0xce;}_0x1a4e85[_0x6542('0x19')](_0x45d137);return _0x1a4e85[_0x6542('0x1f')](_0x6542('0x20'),_0x45952d+'-'+_0x21ad82+'/'+_0x40e3e8)[_0x6542('0x1b')](_0x420222);}return null;};}function patchUpdates(_0x5c7843){return function(_0x4feab0){try{jsonpatch[_0x6542('0x21')](_0x4feab0,_0x5c7843,!![]);}catch(_0x1ad2c3){return BPromise['reject'](_0x1ad2c3);}return _0x4feab0['save']();};}function saveUpdates(_0x49c03d,_0x564bde){return function(_0x3a15b){if(_0x3a15b){return _0x3a15b['update'](_0x49c03d)[_0x6542('0x22')](function(_0xae2287){return _0xae2287;});}return null;};}function removeEntity(_0x527dec,_0x3aa9ec){return function(_0x248c9d){if(_0x248c9d){return _0x248c9d[_0x6542('0x23')]()[_0x6542('0x22')](function(){_0x527dec[_0x6542('0x19')](0xcc)[_0x6542('0x1a')]();});}};}function handleEntityNotFound(_0x5b445d,_0x48ed3e){return function(_0x4d1095){if(!_0x4d1095){_0x5b445d['sendStatus'](0x194);}return _0x4d1095;};}function handleError(_0x1acb4f,_0x4a705d){_0x4a705d=_0x4a705d||0x1f4;return function(_0xb7d39f){logger[_0x6542('0x24')](_0xb7d39f[_0x6542('0x25')]);if(_0xb7d39f[_0x6542('0x26')]){delete _0xb7d39f[_0x6542('0x26')];}_0x1acb4f[_0x6542('0x19')](_0x4a705d)[_0x6542('0x27')](_0xb7d39f);};}exports['index']=function(_0x371ac4,_0x3b44fa){var _0x5ee6fe={},_0x215a89={},_0x494ab3={'count':0x0,'rows':[]};var _0x1d4738=_[_0x6542('0x28')](db[_0x6542('0x29')][_0x6542('0x2a')],function(_0x44777c){return{'name':_0x44777c[_0x6542('0x2b')],'type':_0x44777c[_0x6542('0x2c')][_0x6542('0x2d')]};});_0x215a89[_0x6542('0x2e')]=_[_0x6542('0x28')](_0x1d4738,'name');_0x215a89[_0x6542('0x2f')]=_['keys'](_0x371ac4[_0x6542('0x2f')]);_0x215a89['filters']=_[_0x6542('0x30')](_0x215a89[_0x6542('0x2e')],_0x215a89[_0x6542('0x2f')]);_0x5ee6fe[_0x6542('0x31')]=_[_0x6542('0x30')](_0x215a89[_0x6542('0x2e')],qs[_0x6542('0x32')](_0x371ac4[_0x6542('0x2f')][_0x6542('0x32')]));_0x5ee6fe[_0x6542('0x31')]=_0x5ee6fe[_0x6542('0x31')][_0x6542('0x33')]?_0x5ee6fe[_0x6542('0x31')]:_0x215a89[_0x6542('0x2e')];if(!_0x371ac4[_0x6542('0x2f')]['hasOwnProperty'](_0x6542('0x34'))){_0x5ee6fe[_0x6542('0x1e')]=qs['limit'](_0x371ac4['query'][_0x6542('0x1e')]);_0x5ee6fe[_0x6542('0x1d')]=qs[_0x6542('0x1d')](_0x371ac4[_0x6542('0x2f')][_0x6542('0x1d')]);}_0x5ee6fe[_0x6542('0x35')]=qs[_0x6542('0x36')](_0x371ac4[_0x6542('0x2f')][_0x6542('0x36')]);_0x5ee6fe[_0x6542('0x37')]=qs['filters'](_['pick'](_0x371ac4['query'],_0x215a89['filters']),_0x1d4738);if(_0x371ac4['query'][_0x6542('0x38')]){_0x5ee6fe['where']=_['merge'](_0x5ee6fe[_0x6542('0x37')],{'$or':_[_0x6542('0x28')](_0x1d4738,function(_0x5ee731){if(_0x5ee731['type']!=='VIRTUAL'){var _0x4d406d={};_0x4d406d[_0x5ee731['name']]={'$like':'%'+_0x371ac4[_0x6542('0x2f')]['filter']+'%'};return _0x4d406d;}})});}_0x5ee6fe=_[_0x6542('0x39')]({},_0x5ee6fe,_0x371ac4[_0x6542('0x3a')]);var _0x45cb78={'where':_0x5ee6fe[_0x6542('0x37')]};return db[_0x6542('0x29')]['count'](_0x45cb78)[_0x6542('0x22')](function(_0x15b67a){_0x494ab3[_0x6542('0x1c')]=_0x15b67a;if(_0x371ac4[_0x6542('0x2f')]['includeAll']){_0x5ee6fe[_0x6542('0x3b')]=[{'all':!![]}];}return db[_0x6542('0x29')][_0x6542('0x3c')](_0x5ee6fe);})[_0x6542('0x22')](function(_0x208530){_0x494ab3[_0x6542('0x3d')]=_0x208530;return _0x494ab3;})['then'](respondWithFilteredResult(_0x3b44fa,_0x5ee6fe))[_0x6542('0x3e')](handleError(_0x3b44fa,null));};exports[_0x6542('0x3f')]=function(_0x4dab8a,_0x38e094){var _0x4429de={'raw':![],'where':{'id':_0x4dab8a['params']['id']}},_0x52b1d2={};_0x52b1d2[_0x6542('0x2e')]=_['keys'](db[_0x6542('0x29')][_0x6542('0x2a')]);_0x52b1d2[_0x6542('0x2f')]=_[_0x6542('0x40')](_0x4dab8a['query']);_0x52b1d2[_0x6542('0x41')]=_[_0x6542('0x30')](_0x52b1d2['model'],_0x52b1d2[_0x6542('0x2f')]);_0x4429de[_0x6542('0x31')]=_[_0x6542('0x30')](_0x52b1d2[_0x6542('0x2e')],qs[_0x6542('0x32')](_0x4dab8a[_0x6542('0x2f')][_0x6542('0x32')]));_0x4429de[_0x6542('0x31')]=_0x4429de[_0x6542('0x31')][_0x6542('0x33')]?_0x4429de[_0x6542('0x31')]:_0x52b1d2[_0x6542('0x2e')];if(_0x4dab8a['query'][_0x6542('0x42')]){_0x4429de[_0x6542('0x3b')]=[{'all':!![]}];}_0x4429de=_[_0x6542('0x39')]({},_0x4429de,_0x4dab8a[_0x6542('0x3a')]);return db[_0x6542('0x29')][_0x6542('0x43')](_0x4429de)[_0x6542('0x22')](handleEntityNotFound(_0x38e094,null))[_0x6542('0x22')](respondWithResult(_0x38e094,null))[_0x6542('0x3e')](handleError(_0x38e094,null));};exports[_0x6542('0x44')]=function(_0x35aee2,_0x14571d){return db['VoiceAgentReport']['create'](_0x35aee2['body'],{})[_0x6542('0x22')](respondWithResult(_0x14571d,0xc9))[_0x6542('0x3e')](handleError(_0x14571d,null));};exports['update']=function(_0x1a5c4f,_0x1195ea){if(_0x1a5c4f['body']['id']){delete _0x1a5c4f[_0x6542('0x45')]['id'];}return db[_0x6542('0x29')][_0x6542('0x43')]({'where':{'id':_0x1a5c4f[_0x6542('0x46')]['id']}})[_0x6542('0x22')](handleEntityNotFound(_0x1195ea,null))[_0x6542('0x22')](saveUpdates(_0x1a5c4f[_0x6542('0x45')],null))[_0x6542('0x22')](respondWithResult(_0x1195ea,null))['catch'](handleError(_0x1195ea,null));};exports[_0x6542('0x23')]=function(_0x14f2dc,_0x44aae7){return db[_0x6542('0x29')][_0x6542('0x43')]({'where':{'id':_0x14f2dc[_0x6542('0x46')]['id']}})['then'](handleEntityNotFound(_0x44aae7,null))[_0x6542('0x22')](removeEntity(_0x44aae7,null))[_0x6542('0x3e')](handleError(_0x44aae7,null));};exports['describe']=function(_0x3b7970,_0x34fbc5){return db['VoiceAgentReport'][_0x6542('0x47')]()[_0x6542('0x22')](respondWithResult(_0x34fbc5,null))[_0x6542('0x3e')](handleError(_0x34fbc5,null));}; \ No newline at end of file +var _0x9c6a=['util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceAgentReport','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x4b2366,_0x2bc6e4){var _0x3dbcd9=function(_0x2ea496){while(--_0x2ea496){_0x4b2366['push'](_0x4b2366['shift']());}};_0x3dbcd9(++_0x2bc6e4);}(_0x9c6a,0x1c2));var _0xa9c6=function(_0x288264,_0x28bd9a){_0x288264=_0x288264-0x0;var _0x213964=_0x9c6a[_0x288264];return _0x213964;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa9c6('0x0'));var rimraf=require(_0xa9c6('0x1'));var zipdir=require(_0xa9c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9c6('0x3'));var moment=require(_0xa9c6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa9c6('0x5'));var util=require(_0xa9c6('0x6'));var path=require(_0xa9c6('0x7'));var sox=require(_0xa9c6('0x8'));var csv=require(_0xa9c6('0x9'));var ejs=require(_0xa9c6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa9c6('0xb'));var crypto=require(_0xa9c6('0xc'));var jsforce=require(_0xa9c6('0xd'));var deskjs=require(_0xa9c6('0xe'));var toCsv=require(_0xa9c6('0x9'));var querystring=require(_0xa9c6('0xf'));var Papa=require(_0xa9c6('0x10'));var Redis=require(_0xa9c6('0x11'));var authService=require(_0xa9c6('0x12'));var qs=require(_0xa9c6('0x13'));var as=require(_0xa9c6('0x14'));var hardwareService=require(_0xa9c6('0x15'));var logger=require(_0xa9c6('0x16'))(_0xa9c6('0x17'));var utils=require(_0xa9c6('0x18'));var config=require(_0xa9c6('0x19'));var db=require(_0xa9c6('0x1a'))['db'];function respondWithStatusCode(_0x192518,_0x333456){_0x333456=_0x333456||0xcc;return function(_0x5dff33){if(_0x5dff33){return _0x192518['sendStatus'](_0x333456);}return _0x192518[_0xa9c6('0x1b')](_0x333456)['end']();};}function respondWithResult(_0x39ad63,_0x3b4ffc){_0x3b4ffc=_0x3b4ffc||0xc8;return function(_0x938472){if(_0x938472){return _0x39ad63['status'](_0x3b4ffc)[_0xa9c6('0x1c')](_0x938472);}};}function respondWithFilteredResult(_0xd371c4,_0x5edd3a){return function(_0xf42125){if(_0xf42125){var _0x237e2a=_0xf42125[_0xa9c6('0x1d')],_0x2d5ae7=_0x5edd3a[_0xa9c6('0x1e')],_0x1905a4=_0x5edd3a['offset']+_0x5edd3a[_0xa9c6('0x1f')],_0xdfcad6;if(_0x1905a4>=_0x237e2a){_0x1905a4=_0x237e2a;_0xdfcad6=0xc8;}else{_0xdfcad6=0xce;}_0xd371c4[_0xa9c6('0x1b')](_0xdfcad6);return _0xd371c4[_0xa9c6('0x20')]('Content-Range',_0x2d5ae7+'-'+_0x1905a4+'/'+_0x237e2a)[_0xa9c6('0x1c')](_0xf42125);}return null;};}function patchUpdates(_0x3bb3ac){return function(_0x42ae4d){try{jsonpatch[_0xa9c6('0x21')](_0x42ae4d,_0x3bb3ac,!![]);}catch(_0x44efc7){return BPromise[_0xa9c6('0x22')](_0x44efc7);}return _0x42ae4d[_0xa9c6('0x23')]();};}function saveUpdates(_0x5a8913,_0x770503){return function(_0xdffb2b){if(_0xdffb2b){return _0xdffb2b[_0xa9c6('0x24')](_0x5a8913)[_0xa9c6('0x25')](function(_0x52f3cb){return _0x52f3cb;});}return null;};}function removeEntity(_0x587402,_0x2942d3){return function(_0x1e0efb){if(_0x1e0efb){return _0x1e0efb[_0xa9c6('0x26')]()[_0xa9c6('0x25')](function(){_0x587402[_0xa9c6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a301,_0x599ab6){return function(_0x3b92a6){if(!_0x3b92a6){_0x54a301['sendStatus'](0x194);}return _0x3b92a6;};}function handleError(_0x193940,_0x2e46cc){_0x2e46cc=_0x2e46cc||0x1f4;return function(_0x34f48e){logger[_0xa9c6('0x27')](_0x34f48e[_0xa9c6('0x28')]);if(_0x34f48e['name']){delete _0x34f48e[_0xa9c6('0x29')];}_0x193940['status'](_0x2e46cc)[_0xa9c6('0x2a')](_0x34f48e);};}exports[_0xa9c6('0x2b')]=function(_0x154d9c,_0x23e2a9){var _0x484465={},_0x1574c7={},_0x3d3a3c={'count':0x0,'rows':[]};var _0x524e4d=_[_0xa9c6('0x2c')](db[_0xa9c6('0x2d')]['rawAttributes'],function(_0x4d1525){return{'name':_0x4d1525[_0xa9c6('0x2e')],'type':_0x4d1525[_0xa9c6('0x2f')][_0xa9c6('0x30')]};});_0x1574c7[_0xa9c6('0x31')]=_['map'](_0x524e4d,_0xa9c6('0x29'));_0x1574c7['query']=_[_0xa9c6('0x32')](_0x154d9c['query']);_0x1574c7[_0xa9c6('0x33')]=_['intersection'](_0x1574c7['model'],_0x1574c7[_0xa9c6('0x34')]);_0x484465[_0xa9c6('0x35')]=_[_0xa9c6('0x36')](_0x1574c7['model'],qs[_0xa9c6('0x37')](_0x154d9c[_0xa9c6('0x34')][_0xa9c6('0x37')]));_0x484465[_0xa9c6('0x35')]=_0x484465[_0xa9c6('0x35')][_0xa9c6('0x38')]?_0x484465['attributes']:_0x1574c7[_0xa9c6('0x31')];if(!_0x154d9c[_0xa9c6('0x34')]['hasOwnProperty'](_0xa9c6('0x39'))){_0x484465[_0xa9c6('0x1f')]=qs[_0xa9c6('0x1f')](_0x154d9c[_0xa9c6('0x34')][_0xa9c6('0x1f')]);_0x484465['offset']=qs['offset'](_0x154d9c[_0xa9c6('0x34')][_0xa9c6('0x1e')]);}_0x484465['order']=qs[_0xa9c6('0x3a')](_0x154d9c[_0xa9c6('0x34')][_0xa9c6('0x3a')]);_0x484465[_0xa9c6('0x3b')]=qs[_0xa9c6('0x33')](_[_0xa9c6('0x3c')](_0x154d9c[_0xa9c6('0x34')],_0x1574c7[_0xa9c6('0x33')]),_0x524e4d);if(_0x154d9c[_0xa9c6('0x34')][_0xa9c6('0x3d')]){_0x484465[_0xa9c6('0x3b')]=_[_0xa9c6('0x3e')](_0x484465['where'],{'$or':_[_0xa9c6('0x2c')](_0x524e4d,function(_0x2467b4){if(_0x2467b4['type']!=='VIRTUAL'){var _0xaa412a={};_0xaa412a[_0x2467b4[_0xa9c6('0x29')]]={'$like':'%'+_0x154d9c[_0xa9c6('0x34')][_0xa9c6('0x3d')]+'%'};return _0xaa412a;}})});}_0x484465=_[_0xa9c6('0x3e')]({},_0x484465,_0x154d9c[_0xa9c6('0x3f')]);var _0x26e8e={'where':_0x484465[_0xa9c6('0x3b')]};return db['VoiceAgentReport'][_0xa9c6('0x1d')](_0x26e8e)[_0xa9c6('0x25')](function(_0x483b79){_0x3d3a3c['count']=_0x483b79;if(_0x154d9c['query'][_0xa9c6('0x40')]){_0x484465[_0xa9c6('0x41')]=[{'all':!![]}];}return db[_0xa9c6('0x2d')][_0xa9c6('0x42')](_0x484465);})[_0xa9c6('0x25')](function(_0x26e26f){_0x3d3a3c[_0xa9c6('0x43')]=_0x26e26f;return _0x3d3a3c;})[_0xa9c6('0x25')](respondWithFilteredResult(_0x23e2a9,_0x484465))[_0xa9c6('0x44')](handleError(_0x23e2a9,null));};exports[_0xa9c6('0x45')]=function(_0x3410dd,_0x559a04){var _0x35546b={'raw':![],'where':{'id':_0x3410dd[_0xa9c6('0x46')]['id']}},_0x31ae99={};_0x31ae99[_0xa9c6('0x31')]=_['keys'](db[_0xa9c6('0x2d')][_0xa9c6('0x47')]);_0x31ae99['query']=_[_0xa9c6('0x32')](_0x3410dd[_0xa9c6('0x34')]);_0x31ae99[_0xa9c6('0x33')]=_[_0xa9c6('0x36')](_0x31ae99[_0xa9c6('0x31')],_0x31ae99['query']);_0x35546b[_0xa9c6('0x35')]=_['intersection'](_0x31ae99[_0xa9c6('0x31')],qs[_0xa9c6('0x37')](_0x3410dd[_0xa9c6('0x34')][_0xa9c6('0x37')]));_0x35546b[_0xa9c6('0x35')]=_0x35546b['attributes'][_0xa9c6('0x38')]?_0x35546b[_0xa9c6('0x35')]:_0x31ae99[_0xa9c6('0x31')];if(_0x3410dd[_0xa9c6('0x34')][_0xa9c6('0x40')]){_0x35546b['include']=[{'all':!![]}];}_0x35546b=_[_0xa9c6('0x3e')]({},_0x35546b,_0x3410dd['options']);return db[_0xa9c6('0x2d')][_0xa9c6('0x48')](_0x35546b)[_0xa9c6('0x25')](handleEntityNotFound(_0x559a04,null))['then'](respondWithResult(_0x559a04,null))[_0xa9c6('0x44')](handleError(_0x559a04,null));};exports['create']=function(_0x5c3ed2,_0x4c76ab){return db['VoiceAgentReport'][_0xa9c6('0x49')](_0x5c3ed2[_0xa9c6('0x4a')],{})['then'](respondWithResult(_0x4c76ab,0xc9))[_0xa9c6('0x44')](handleError(_0x4c76ab,null));};exports[_0xa9c6('0x24')]=function(_0x39c1e0,_0x43ee40){if(_0x39c1e0['body']['id']){delete _0x39c1e0[_0xa9c6('0x4a')]['id'];}return db['VoiceAgentReport']['find']({'where':{'id':_0x39c1e0['params']['id']}})['then'](handleEntityNotFound(_0x43ee40,null))[_0xa9c6('0x25')](saveUpdates(_0x39c1e0[_0xa9c6('0x4a')],null))[_0xa9c6('0x25')](respondWithResult(_0x43ee40,null))[_0xa9c6('0x44')](handleError(_0x43ee40,null));};exports[_0xa9c6('0x26')]=function(_0x14b0ed,_0x5012e4){return db[_0xa9c6('0x2d')]['find']({'where':{'id':_0x14b0ed[_0xa9c6('0x46')]['id']}})[_0xa9c6('0x25')](handleEntityNotFound(_0x5012e4,null))[_0xa9c6('0x25')](removeEntity(_0x5012e4,null))[_0xa9c6('0x44')](handleError(_0x5012e4,null));};exports[_0xa9c6('0x4b')]=function(_0x312ca2,_0x537e4b){return db['VoiceAgentReport'][_0xa9c6('0x4b')]()[_0xa9c6('0x25')](respondWithResult(_0x537e4b,null))[_0xa9c6('0x44')](handleError(_0x537e4b,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 3b948e9..1ae7d25 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 _0xedd9=['./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xbb2f2d,_0x5753f8){var _0x44ccdf=function(_0x2f657f){while(--_0x2f657f){_0xbb2f2d['push'](_0xbb2f2d['shift']());}};_0x44ccdf(++_0x5753f8);}(_0xedd9,0xfc));var _0x9edd=function(_0x3c153c,_0x289c25){_0x3c153c=_0x3c153c-0x0;var _0x2ab7b5=_0xedd9[_0x3c153c];return _0x2ab7b5;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x9edd('0xb'),_0x9edd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3071('0xc'),_0x3071('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 0e18d14..053b524 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 _0xb1e5=['UpdateVoiceAgentReport','VoiceAgentReport','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateVoiceAgentReport'];(function(_0x19f2d5,_0x5893f2){var _0x5e8c46=function(_0x2f07ed){while(--_0x2f07ed){_0x19f2d5['push'](_0x19f2d5['shift']());}};_0x5e8c46(++_0x5893f2);}(_0xb1e5,0xcb));var _0x5b1e=function(_0x342d7d,_0x1e758d){_0x342d7d=_0x342d7d-0x0;var _0x2e59b0=_0xb1e5[_0x342d7d];return _0x2e59b0;};'use strict';var _=require(_0x5b1e('0x0'));var util=require(_0x5b1e('0x1'));var moment=require('moment');var BPromise=require(_0x5b1e('0x2'));var rs=require(_0x5b1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b1e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b1e('0x5'))(_0x5b1e('0x6'));var config=require(_0x5b1e('0x7'));var jayson=require(_0x5b1e('0x8'));var client=jayson['client'][_0x5b1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b7661,_0x19fb90,_0x4316a0){return new BPromise(function(_0x3152a9,_0x15edc8){return client[_0x5b1e('0xa')](_0x3b7661,_0x4316a0)[_0x5b1e('0xb')](function(_0x16efd0){logger[_0x5b1e('0xc')](_0x5b1e('0xd'),_0x19fb90,_0x5b1e('0xe'));logger[_0x5b1e('0xf')](_0x5b1e('0x10'),_0x19fb90,_0x5b1e('0xe'),JSON[_0x5b1e('0x11')](_0x16efd0));if(_0x16efd0[_0x5b1e('0x12')]){if(_0x16efd0['error'][_0x5b1e('0x13')]===0x1f4){logger[_0x5b1e('0x12')](_0x5b1e('0xd'),_0x19fb90,_0x16efd0[_0x5b1e('0x12')][_0x5b1e('0x14')]);return _0x15edc8(_0x16efd0[_0x5b1e('0x12')][_0x5b1e('0x14')]);}logger[_0x5b1e('0x12')](_0x5b1e('0xd'),_0x19fb90,_0x16efd0[_0x5b1e('0x12')][_0x5b1e('0x14')]);return _0x3152a9(_0x16efd0[_0x5b1e('0x12')]['message']);}else{logger[_0x5b1e('0xc')](_0x5b1e('0xd'),_0x19fb90,_0x5b1e('0xe'));_0x3152a9(_0x16efd0[_0x5b1e('0x15')][_0x5b1e('0x14')]);}})[_0x5b1e('0x16')](function(_0x17cb68){logger[_0x5b1e('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x19fb90,_0x17cb68);_0x15edc8(_0x17cb68);});});}exports['CreateVoiceAgentReport']=function(_0x1cf438){var _0x13793b=this;return new Promise(function(_0x48e6e1,_0x4edeb5){return db['VoiceAgentReport'][_0x5b1e('0x17')](_0x1cf438[_0x5b1e('0x18')],{'raw':_0x1cf438[_0x5b1e('0x19')]?_0x1cf438[_0x5b1e('0x19')][_0x5b1e('0x1a')]===undefined?!![]:![]:!![]})[_0x5b1e('0xb')](function(_0x128e65){logger[_0x5b1e('0xc')]('CreateVoiceAgentReport',_0x1cf438);logger[_0x5b1e('0xf')](_0x5b1e('0x1b'),_0x1cf438,JSON['stringify'](_0x128e65));_0x48e6e1(_0x128e65);})['catch'](function(_0x1696bb){logger[_0x5b1e('0x12')](_0x5b1e('0x1b'),_0x1696bb[_0x5b1e('0x14')],_0x1cf438);_0x4edeb5(_0x13793b[_0x5b1e('0x12')](0x1f4,_0x1696bb[_0x5b1e('0x14')]));});});};exports[_0x5b1e('0x1c')]=function(_0x18cf9a){var _0x1ba289=this;return new Promise(function(_0x2d873d,_0x4d33cb){return db[_0x5b1e('0x1d')]['update'](_0x18cf9a[_0x5b1e('0x18')],{'raw':_0x18cf9a[_0x5b1e('0x19')]?_0x18cf9a[_0x5b1e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18cf9a['options']?_0x18cf9a['options'][_0x5b1e('0x1e')]||null:null,'attributes':_0x18cf9a[_0x5b1e('0x19')]?_0x18cf9a['options'][_0x5b1e('0x1f')]||null:null,'limit':_0x18cf9a[_0x5b1e('0x19')]?_0x18cf9a[_0x5b1e('0x19')][_0x5b1e('0x20')]||null:null})['then'](function(_0x35ce41){logger[_0x5b1e('0xc')]('UpdateVoiceAgentReport',_0x18cf9a);logger[_0x5b1e('0xf')](_0x5b1e('0x1c'),_0x18cf9a,JSON[_0x5b1e('0x11')](_0x35ce41));_0x2d873d(_0x35ce41);})[_0x5b1e('0x16')](function(_0x945c0b){logger[_0x5b1e('0x12')](_0x5b1e('0x1c'),_0x945c0b[_0x5b1e('0x14')],_0x18cf9a);_0x4d33cb(_0x1ba289[_0x5b1e('0x12')](0x1f4,_0x945c0b[_0x5b1e('0x14')]));});});}; \ No newline at end of file +var _0xebbe=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','debug','UpdateVoiceAgentReport','update','raw','where','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x260893,_0x49810e){var _0x30f503=function(_0x31dd49){while(--_0x31dd49){_0x260893['push'](_0x260893['shift']());}};_0x30f503(++_0x49810e);}(_0xebbe,0xe3));var _0xeebb=function(_0x8dcbad,_0x1b6c41){_0x8dcbad=_0x8dcbad-0x0;var _0x44921d=_0xebbe[_0x8dcbad];return _0x44921d;};'use strict';var _=require('lodash');var util=require(_0xeebb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeebb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeebb('0x2'));var logger=require(_0xeebb('0x3'))(_0xeebb('0x4'));var config=require(_0xeebb('0x5'));var jayson=require(_0xeebb('0x6'));var client=jayson['client'][_0xeebb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f2513,_0x463b08,_0x5d1a94){return new BPromise(function(_0x3fbda6,_0x1d8e96){return client[_0xeebb('0x8')](_0x5f2513,_0x5d1a94)[_0xeebb('0x9')](function(_0x126bfb){logger[_0xeebb('0xa')](_0xeebb('0xb'),_0x463b08,_0xeebb('0xc'));logger['debug'](_0xeebb('0xd'),_0x463b08,'request\x20sent',JSON[_0xeebb('0xe')](_0x126bfb));if(_0x126bfb['error']){if(_0x126bfb['error'][_0xeebb('0xf')]===0x1f4){logger[_0xeebb('0x10')](_0xeebb('0xb'),_0x463b08,_0x126bfb[_0xeebb('0x10')][_0xeebb('0x11')]);return _0x1d8e96(_0x126bfb[_0xeebb('0x10')][_0xeebb('0x11')]);}logger[_0xeebb('0x10')](_0xeebb('0xb'),_0x463b08,_0x126bfb['error']['message']);return _0x3fbda6(_0x126bfb[_0xeebb('0x10')][_0xeebb('0x11')]);}else{logger[_0xeebb('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x463b08,'request\x20sent');_0x3fbda6(_0x126bfb[_0xeebb('0x12')][_0xeebb('0x11')]);}})[_0xeebb('0x13')](function(_0x39ba6a){logger[_0xeebb('0x10')](_0xeebb('0xb'),_0x463b08,_0x39ba6a);_0x1d8e96(_0x39ba6a);});});}exports['CreateVoiceAgentReport']=function(_0x399e9a){var _0xf21076=this;return new Promise(function(_0x505c54,_0x5af9da){return db[_0xeebb('0x14')][_0xeebb('0x15')](_0x399e9a[_0xeebb('0x16')],{'raw':_0x399e9a[_0xeebb('0x17')]?_0x399e9a[_0xeebb('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xeebb('0x9')](function(_0x45bfcb){logger[_0xeebb('0xa')](_0xeebb('0x18'),_0x399e9a);logger[_0xeebb('0x19')](_0xeebb('0x18'),_0x399e9a,JSON[_0xeebb('0xe')](_0x45bfcb));_0x505c54(_0x45bfcb);})['catch'](function(_0x5b7a16){logger[_0xeebb('0x10')](_0xeebb('0x18'),_0x5b7a16[_0xeebb('0x11')],_0x399e9a);_0x5af9da(_0xf21076['error'](0x1f4,_0x5b7a16[_0xeebb('0x11')]));});});};exports[_0xeebb('0x1a')]=function(_0x3972ca){var _0x4be21a=this;return new Promise(function(_0x422d7a,_0x2b5556){return db[_0xeebb('0x14')][_0xeebb('0x1b')](_0x3972ca[_0xeebb('0x16')],{'raw':_0x3972ca[_0xeebb('0x17')]?_0x3972ca[_0xeebb('0x17')][_0xeebb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3972ca[_0xeebb('0x17')]?_0x3972ca[_0xeebb('0x17')][_0xeebb('0x1d')]||null:null,'attributes':_0x3972ca['options']?_0x3972ca[_0xeebb('0x17')]['attributes']||null:null,'limit':_0x3972ca[_0xeebb('0x17')]?_0x3972ca[_0xeebb('0x17')]['limit']||null:null})[_0xeebb('0x9')](function(_0x483c6){logger['info']('UpdateVoiceAgentReport',_0x3972ca);logger[_0xeebb('0x19')]('UpdateVoiceAgentReport',_0x3972ca,JSON['stringify'](_0x483c6));_0x422d7a(_0x483c6);})[_0xeebb('0x13')](function(_0x424a9e){logger[_0xeebb('0x10')](_0xeebb('0x1a'),_0x424a9e[_0xeebb('0x11')],_0x3972ca);_0x2b5556(_0x4be21a['error'](0x1f4,_0x424a9e[_0xeebb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index fc76860..d18561f 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 _0x85fb=['../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path','express'];(function(_0x334d51,_0x20000f){var _0x33adf3=function(_0x51290a){while(--_0x51290a){_0x334d51['push'](_0x334d51['shift']());}};_0x33adf3(++_0x20000f);}(_0x85fb,0x11e));var _0xb85f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x85fb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb85f('0x0'));var util=require('util');var path=require(_0xb85f('0x1'));var timeout=require('connect-timeout');var express=require(_0xb85f('0x2'));var router=express['Router']();var auth=require(_0xb85f('0x3'));var interaction=require(_0xb85f('0x4'));var config=require('../../config/environment');var controller=require(_0xb85f('0x5'));router[_0xb85f('0x6')]('/',auth[_0xb85f('0x7')](),controller[_0xb85f('0x8')]);router[_0xb85f('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xb85f('0x6')](_0xb85f('0x9'),auth['isAuthenticated'](),controller[_0xb85f('0xa')]);router[_0xb85f('0xb')]('/',auth[_0xb85f('0x7')](),controller[_0xb85f('0xc')]);router[_0xb85f('0xd')](_0xb85f('0x9'),auth[_0xb85f('0x7')](),controller[_0xb85f('0xe')]);router['delete'](_0xb85f('0x9'),auth['isAuthenticated'](),controller[_0xb85f('0xf')]);module[_0xb85f('0x10')]=router; \ No newline at end of file +var _0x7ba4=['create','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','describe','post'];(function(_0x38182b,_0x5dbf8b){var _0x3d6a8c=function(_0x5ee16f){while(--_0x5ee16f){_0x38182b['push'](_0x38182b['shift']());}};_0x3d6a8c(++_0x5dbf8b);}(_0x7ba4,0x104));var _0x47ba=function(_0x3b79f0,_0x455fc5){_0x3b79f0=_0x3b79f0-0x0;var _0x51bb97=_0x7ba4[_0x3b79f0];return _0x51bb97;};'use strict';var multer=require(_0x47ba('0x0'));var util=require('util');var path=require(_0x47ba('0x1'));var timeout=require(_0x47ba('0x2'));var express=require('express');var router=express[_0x47ba('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x47ba('0x4'));var config=require(_0x47ba('0x5'));var controller=require(_0x47ba('0x6'));router[_0x47ba('0x7')]('/',auth[_0x47ba('0x8')](),controller[_0x47ba('0x9')]);router['get']('/describe',auth[_0x47ba('0x8')](),controller[_0x47ba('0xa')]);router[_0x47ba('0x7')]('/:id',auth[_0x47ba('0x8')](),controller['show']);router[_0x47ba('0xb')]('/',auth[_0x47ba('0x8')](),controller[_0x47ba('0xc')]);router[_0x47ba('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x47ba('0xe')]);router[_0x47ba('0xf')]('/:id',auth[_0x47ba('0x8')](),controller['destroy']);module[_0x47ba('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b759a57..bcd18bf 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x208ffe,_0x5b5236){var _0x35bb40=function(_0x572869){while(--_0x572869){_0x208ffe['push'](_0x208ffe['shift']());}};_0x35bb40(++_0x5b5236);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x1561b0,_0xec68c3){var _0x11c88e=function(_0x2a9b07){while(--_0x2a9b07){_0x1561b0['push'](_0x1561b0['shift']());}};_0x11c88e(++_0xec68c3);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 5e809f3..f06efb6 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 _0xc1d3=['rows','catch','show','params','keys','include','options','find','create','body','destroy','describe','update','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','apply','reject','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','VIRTUAL','filter','merge','VoiceCallReport','fullname','User'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0xc1d3,0x143));var _0x3c1d=function(_0x24c8bf,_0xb71663){_0x24c8bf=_0x24c8bf-0x0;var _0x451e91=_0xc1d3[_0x24c8bf];return _0x451e91;};'use strict';var pdf=require(_0x3c1d('0x0'));var emlformat=require(_0x3c1d('0x1'));var rimraf=require(_0x3c1d('0x2'));var zipdir=require(_0x3c1d('0x3'));var jsonpatch=require(_0x3c1d('0x4'));var rp=require(_0x3c1d('0x5'));var moment=require(_0x3c1d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3c1d('0x7'));var util=require(_0x3c1d('0x8'));var path=require(_0x3c1d('0x9'));var sox=require(_0x3c1d('0xa'));var csv=require(_0x3c1d('0xb'));var ejs=require(_0x3c1d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3c1d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3c1d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3c1d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3c1d('0x10'));var as=require(_0x3c1d('0x11'));var hardwareService=require(_0x3c1d('0x12'));var logger=require('../../config/logger')(_0x3c1d('0x13'));var utils=require(_0x3c1d('0x14'));var config=require(_0x3c1d('0x15'));var db=require(_0x3c1d('0x16'))['db'];function respondWithStatusCode(_0x2d965d,_0x5086bf){_0x5086bf=_0x5086bf||0xcc;return function(_0x321a1d){if(_0x321a1d){return _0x2d965d[_0x3c1d('0x17')](_0x5086bf);}return _0x2d965d[_0x3c1d('0x18')](_0x5086bf)[_0x3c1d('0x19')]();};}function respondWithResult(_0x26a0a9,_0x2ef11a){_0x2ef11a=_0x2ef11a||0xc8;return function(_0x33b1ff){if(_0x33b1ff){return _0x26a0a9[_0x3c1d('0x18')](_0x2ef11a)[_0x3c1d('0x1a')](_0x33b1ff);}};}function respondWithFilteredResult(_0x591e76,_0x5924db){return function(_0x2713b1){if(_0x2713b1){var _0x2dadd0=_0x2713b1[_0x3c1d('0x1b')],_0x18326a=_0x5924db['offset'],_0x56a5b9=_0x5924db['offset']+_0x5924db[_0x3c1d('0x1c')],_0x1e8a28;if(_0x56a5b9>=_0x2dadd0){_0x56a5b9=_0x2dadd0;_0x1e8a28=0xc8;}else{_0x1e8a28=0xce;}_0x591e76[_0x3c1d('0x18')](_0x1e8a28);return _0x591e76[_0x3c1d('0x1d')]('Content-Range',_0x18326a+'-'+_0x56a5b9+'/'+_0x2dadd0)[_0x3c1d('0x1a')](_0x2713b1);}return null;};}function patchUpdates(_0x553cbf){return function(_0x156095){try{jsonpatch[_0x3c1d('0x1e')](_0x156095,_0x553cbf,!![]);}catch(_0x30864d){return BPromise[_0x3c1d('0x1f')](_0x30864d);}return _0x156095['save']();};}function saveUpdates(_0x3ead9f,_0x235e97){return function(_0x71d1d6){if(_0x71d1d6){return _0x71d1d6['update'](_0x3ead9f)[_0x3c1d('0x20')](function(_0x5209ee){return _0x5209ee;});}return null;};}function removeEntity(_0x29ef1c,_0x118d49){return function(_0x5ef7b7){if(_0x5ef7b7){return _0x5ef7b7['destroy']()[_0x3c1d('0x20')](function(){_0x29ef1c[_0x3c1d('0x18')](0xcc)[_0x3c1d('0x19')]();});}};}function handleEntityNotFound(_0x41f1f0,_0x50112){return function(_0x7d24ae){if(!_0x7d24ae){_0x41f1f0['sendStatus'](0x194);}return _0x7d24ae;};}function handleError(_0x537e6b,_0x490993){_0x490993=_0x490993||0x1f4;return function(_0x167c5f){logger[_0x3c1d('0x21')](_0x167c5f[_0x3c1d('0x22')]);if(_0x167c5f['name']){delete _0x167c5f[_0x3c1d('0x23')];}_0x537e6b[_0x3c1d('0x18')](_0x490993)['send'](_0x167c5f);};}exports[_0x3c1d('0x24')]=function(_0x436cea,_0x6171dd){var _0x90b7e2={},_0x5752dc={},_0x2f0f78={'count':0x0,'rows':[]};var _0x3d3c40=_[_0x3c1d('0x25')](db['VoiceCallReport'][_0x3c1d('0x26')],function(_0xa76fee){return{'name':_0xa76fee[_0x3c1d('0x27')],'type':_0xa76fee[_0x3c1d('0x28')][_0x3c1d('0x29')]};});_0x5752dc[_0x3c1d('0x2a')]=_[_0x3c1d('0x25')](_0x3d3c40,'name');_0x5752dc[_0x3c1d('0x2b')]=_['keys'](_0x436cea[_0x3c1d('0x2b')]);_0x5752dc[_0x3c1d('0x2c')]=_[_0x3c1d('0x2d')](_0x5752dc[_0x3c1d('0x2a')],_0x5752dc['query']);_0x90b7e2[_0x3c1d('0x2e')]=_['intersection'](_0x5752dc[_0x3c1d('0x2a')],qs[_0x3c1d('0x2f')](_0x436cea[_0x3c1d('0x2b')][_0x3c1d('0x2f')]));_0x90b7e2['attributes']=_0x90b7e2['attributes'][_0x3c1d('0x30')]?_0x90b7e2['attributes']:_0x5752dc['model'];if(!_0x436cea[_0x3c1d('0x2b')][_0x3c1d('0x31')](_0x3c1d('0x32'))){_0x90b7e2[_0x3c1d('0x1c')]=qs[_0x3c1d('0x1c')](_0x436cea['query']['limit']);_0x90b7e2[_0x3c1d('0x33')]=qs['offset'](_0x436cea['query']['offset']);}_0x90b7e2[_0x3c1d('0x34')]=qs[_0x3c1d('0x35')](_0x436cea[_0x3c1d('0x2b')][_0x3c1d('0x35')]);_0x90b7e2[_0x3c1d('0x36')]=qs['filters'](_[_0x3c1d('0x37')](_0x436cea['query'],_0x5752dc[_0x3c1d('0x2c')]),_0x3d3c40);if(_0x436cea[_0x3c1d('0x2b')]['filter']){_0x90b7e2[_0x3c1d('0x36')]=_['merge'](_0x90b7e2[_0x3c1d('0x36')],{'$or':_[_0x3c1d('0x25')](_0x3d3c40,function(_0x1be2c2){if(_0x1be2c2[_0x3c1d('0x28')]!==_0x3c1d('0x38')){var _0x5c9b4a={};_0x5c9b4a[_0x1be2c2['name']]={'$like':'%'+_0x436cea[_0x3c1d('0x2b')][_0x3c1d('0x39')]+'%'};return _0x5c9b4a;}})});}_0x90b7e2=_[_0x3c1d('0x3a')]({},_0x90b7e2,_0x436cea['options']);var _0x45f07a={'where':_0x90b7e2[_0x3c1d('0x36')]};return db[_0x3c1d('0x3b')][_0x3c1d('0x1b')](_0x45f07a)[_0x3c1d('0x20')](function(_0xf8bba9){_0x2f0f78[_0x3c1d('0x1b')]=_0xf8bba9;if(_0x436cea['query']['includeAll']){_0x90b7e2['include']=[{'attributes':['id','name',_0x3c1d('0x3c'),'alias'],'model':db[_0x3c1d('0x3d')],'as':_0x3c1d('0x3d')}];}return db['VoiceCallReport']['findAll'](_0x90b7e2);})[_0x3c1d('0x20')](function(_0x3fec00){_0x2f0f78[_0x3c1d('0x3e')]=_0x3fec00;return _0x2f0f78;})[_0x3c1d('0x20')](respondWithFilteredResult(_0x6171dd,_0x90b7e2))[_0x3c1d('0x3f')](handleError(_0x6171dd,null));};exports[_0x3c1d('0x40')]=function(_0x6c1338,_0x5b3de6){var _0x1c7f8d={'raw':!![],'where':{'id':_0x6c1338[_0x3c1d('0x41')]['id']}},_0x463806={};_0x463806[_0x3c1d('0x2a')]=_[_0x3c1d('0x42')](db[_0x3c1d('0x3b')]['rawAttributes']);_0x463806[_0x3c1d('0x2b')]=_[_0x3c1d('0x42')](_0x6c1338[_0x3c1d('0x2b')]);_0x463806['filters']=_[_0x3c1d('0x2d')](_0x463806[_0x3c1d('0x2a')],_0x463806['query']);_0x1c7f8d[_0x3c1d('0x2e')]=_[_0x3c1d('0x2d')](_0x463806[_0x3c1d('0x2a')],qs[_0x3c1d('0x2f')](_0x6c1338[_0x3c1d('0x2b')][_0x3c1d('0x2f')]));_0x1c7f8d['attributes']=_0x1c7f8d[_0x3c1d('0x2e')][_0x3c1d('0x30')]?_0x1c7f8d['attributes']:_0x463806[_0x3c1d('0x2a')];if(_0x6c1338['query']['includeAll']){_0x1c7f8d[_0x3c1d('0x43')]=[{'all':!![]}];}_0x1c7f8d=_['merge']({},_0x1c7f8d,_0x6c1338[_0x3c1d('0x44')]);return db[_0x3c1d('0x3b')][_0x3c1d('0x45')](_0x1c7f8d)['then'](handleEntityNotFound(_0x5b3de6,null))[_0x3c1d('0x20')](respondWithResult(_0x5b3de6,null))[_0x3c1d('0x3f')](handleError(_0x5b3de6,null));};exports[_0x3c1d('0x46')]=function(_0x128ff2,_0x5c681c){return db[_0x3c1d('0x3b')]['create'](_0x128ff2[_0x3c1d('0x47')],{})['then'](respondWithResult(_0x5c681c,0xc9))[_0x3c1d('0x3f')](handleError(_0x5c681c,null));};exports[_0x3c1d('0x48')]=function(_0x47b675,_0x2aa914){return db[_0x3c1d('0x3b')]['find']({'where':{'id':_0x47b675['params']['id']}})[_0x3c1d('0x20')](handleEntityNotFound(_0x2aa914,null))[_0x3c1d('0x20')](removeEntity(_0x2aa914,null))[_0x3c1d('0x3f')](handleError(_0x2aa914,null));};exports[_0x3c1d('0x49')]=function(_0x9cc374,_0x37b4fe){return db['VoiceCallReport']['describe']()[_0x3c1d('0x20')](respondWithResult(_0x37b4fe,null))[_0x3c1d('0x3f')](handleError(_0x37b4fe,null));};exports[_0x3c1d('0x4a')]=function(_0x16640c,_0x4d4793){if(_0x16640c[_0x3c1d('0x47')][_0x3c1d('0x4b')]){delete _0x16640c[_0x3c1d('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0x3c1d('0x45')]({'where':{'uniqueid':_0x16640c[_0x3c1d('0x41')]['id'],'UserId':{'$or':[null,_0x16640c[_0x3c1d('0x4c')]['id']]}}})[_0x3c1d('0x20')](handleEntityNotFound(_0x4d4793,null))[_0x3c1d('0x20')](saveUpdates(_0x16640c[_0x3c1d('0x47')],null))['then'](respondWithResult(_0x4d4793,null))['catch'](handleError(_0x4d4793,null));}; \ No newline at end of file +var _0x0f98=['to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','VoiceCallReport','key','model','query','keys','attributes','fields','length','hasOwnProperty','sort','where','filter','type','VIRTUAL','merge','options','count','include','fullname','alias','User','findAll','rows','show','params','rawAttributes','intersection','includeAll','find','catch','create','describe','body','uniqueid','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x44bc14,_0x43d4cb){var _0x6cd15a=function(_0x3641da){while(--_0x3641da){_0x44bc14['push'](_0x44bc14['shift']());}};_0x6cd15a(++_0x43d4cb);}(_0x0f98,0x171));var _0x80f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f98[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x80f9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x80f9('0x1'));var zipdir=require(_0x80f9('0x2'));var jsonpatch=require(_0x80f9('0x3'));var rp=require(_0x80f9('0x4'));var moment=require(_0x80f9('0x5'));var BPromise=require(_0x80f9('0x6'));var Mustache=require(_0x80f9('0x7'));var util=require(_0x80f9('0x8'));var path=require(_0x80f9('0x9'));var sox=require(_0x80f9('0xa'));var csv=require(_0x80f9('0xb'));var ejs=require(_0x80f9('0xc'));var fs=require('fs');var _=require(_0x80f9('0xd'));var squel=require(_0x80f9('0xe'));var crypto=require('crypto');var jsforce=require(_0x80f9('0xf'));var deskjs=require(_0x80f9('0x10'));var toCsv=require(_0x80f9('0xb'));var querystring=require('querystring');var Papa=require(_0x80f9('0x11'));var Redis=require(_0x80f9('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x80f9('0x13'));var hardwareService=require(_0x80f9('0x14'));var logger=require(_0x80f9('0x15'))(_0x80f9('0x16'));var utils=require('../../config/utils');var config=require(_0x80f9('0x17'));var db=require(_0x80f9('0x18'))['db'];function respondWithStatusCode(_0xa505bb,_0x52f0ea){_0x52f0ea=_0x52f0ea||0xcc;return function(_0x48e9af){if(_0x48e9af){return _0xa505bb[_0x80f9('0x19')](_0x52f0ea);}return _0xa505bb[_0x80f9('0x1a')](_0x52f0ea)[_0x80f9('0x1b')]();};}function respondWithResult(_0xed0f55,_0x2c628d){_0x2c628d=_0x2c628d||0xc8;return function(_0x16b37b){if(_0x16b37b){return _0xed0f55[_0x80f9('0x1a')](_0x2c628d)['json'](_0x16b37b);}};}function respondWithFilteredResult(_0x41707e,_0xfd637d){return function(_0x195895){if(_0x195895){var _0x3a1cbd=_0x195895['count'],_0x3a9078=_0xfd637d[_0x80f9('0x1c')],_0x2676df=_0xfd637d[_0x80f9('0x1c')]+_0xfd637d[_0x80f9('0x1d')],_0x28e5ff;if(_0x2676df>=_0x3a1cbd){_0x2676df=_0x3a1cbd;_0x28e5ff=0xc8;}else{_0x28e5ff=0xce;}_0x41707e[_0x80f9('0x1a')](_0x28e5ff);return _0x41707e['set'](_0x80f9('0x1e'),_0x3a9078+'-'+_0x2676df+'/'+_0x3a1cbd)['json'](_0x195895);}return null;};}function patchUpdates(_0x21a3ec){return function(_0x523d5d){try{jsonpatch[_0x80f9('0x1f')](_0x523d5d,_0x21a3ec,!![]);}catch(_0x517275){return BPromise[_0x80f9('0x20')](_0x517275);}return _0x523d5d[_0x80f9('0x21')]();};}function saveUpdates(_0x547dd,_0x3849e4){return function(_0x8a0101){if(_0x8a0101){return _0x8a0101[_0x80f9('0x22')](_0x547dd)['then'](function(_0x39a468){return _0x39a468;});}return null;};}function removeEntity(_0x2d17fb,_0x4b6ddf){return function(_0x3e639c){if(_0x3e639c){return _0x3e639c[_0x80f9('0x23')]()[_0x80f9('0x24')](function(){_0x2d17fb['status'](0xcc)[_0x80f9('0x1b')]();});}};}function handleEntityNotFound(_0x1b955a,_0x3f6471){return function(_0x597c18){if(!_0x597c18){_0x1b955a[_0x80f9('0x19')](0x194);}return _0x597c18;};}function handleError(_0xc623f2,_0x4d48a6){_0x4d48a6=_0x4d48a6||0x1f4;return function(_0x29bbd8){logger[_0x80f9('0x25')](_0x29bbd8[_0x80f9('0x26')]);if(_0x29bbd8[_0x80f9('0x27')]){delete _0x29bbd8[_0x80f9('0x27')];}_0xc623f2[_0x80f9('0x1a')](_0x4d48a6)[_0x80f9('0x28')](_0x29bbd8);};}exports['index']=function(_0x374da3,_0xfb6273){var _0x307765={},_0x3c8940={},_0x4a8e30={'count':0x0,'rows':[]};var _0x1297c3=_[_0x80f9('0x29')](db[_0x80f9('0x2a')]['rawAttributes'],function(_0x23724b){return{'name':_0x23724b['fieldName'],'type':_0x23724b['type'][_0x80f9('0x2b')]};});_0x3c8940[_0x80f9('0x2c')]=_[_0x80f9('0x29')](_0x1297c3,_0x80f9('0x27'));_0x3c8940[_0x80f9('0x2d')]=_[_0x80f9('0x2e')](_0x374da3[_0x80f9('0x2d')]);_0x3c8940['filters']=_['intersection'](_0x3c8940[_0x80f9('0x2c')],_0x3c8940[_0x80f9('0x2d')]);_0x307765[_0x80f9('0x2f')]=_['intersection'](_0x3c8940[_0x80f9('0x2c')],qs[_0x80f9('0x30')](_0x374da3['query']['fields']));_0x307765[_0x80f9('0x2f')]=_0x307765['attributes'][_0x80f9('0x31')]?_0x307765[_0x80f9('0x2f')]:_0x3c8940[_0x80f9('0x2c')];if(!_0x374da3[_0x80f9('0x2d')][_0x80f9('0x32')]('nolimit')){_0x307765[_0x80f9('0x1d')]=qs['limit'](_0x374da3[_0x80f9('0x2d')][_0x80f9('0x1d')]);_0x307765[_0x80f9('0x1c')]=qs[_0x80f9('0x1c')](_0x374da3['query'][_0x80f9('0x1c')]);}_0x307765['order']=qs[_0x80f9('0x33')](_0x374da3[_0x80f9('0x2d')][_0x80f9('0x33')]);_0x307765[_0x80f9('0x34')]=qs['filters'](_['pick'](_0x374da3[_0x80f9('0x2d')],_0x3c8940['filters']),_0x1297c3);if(_0x374da3['query'][_0x80f9('0x35')]){_0x307765[_0x80f9('0x34')]=_['merge'](_0x307765['where'],{'$or':_['map'](_0x1297c3,function(_0x56373c){if(_0x56373c[_0x80f9('0x36')]!==_0x80f9('0x37')){var _0x113a4c={};_0x113a4c[_0x56373c[_0x80f9('0x27')]]={'$like':'%'+_0x374da3[_0x80f9('0x2d')][_0x80f9('0x35')]+'%'};return _0x113a4c;}})});}_0x307765=_[_0x80f9('0x38')]({},_0x307765,_0x374da3[_0x80f9('0x39')]);var _0x41aef6={'where':_0x307765[_0x80f9('0x34')]};return db[_0x80f9('0x2a')][_0x80f9('0x3a')](_0x41aef6)[_0x80f9('0x24')](function(_0x2f4365){_0x4a8e30[_0x80f9('0x3a')]=_0x2f4365;if(_0x374da3[_0x80f9('0x2d')]['includeAll']){_0x307765[_0x80f9('0x3b')]=[{'attributes':['id',_0x80f9('0x27'),_0x80f9('0x3c'),_0x80f9('0x3d')],'model':db['User'],'as':_0x80f9('0x3e')}];}return db[_0x80f9('0x2a')][_0x80f9('0x3f')](_0x307765);})[_0x80f9('0x24')](function(_0x3b4085){_0x4a8e30[_0x80f9('0x40')]=_0x3b4085;return _0x4a8e30;})[_0x80f9('0x24')](respondWithFilteredResult(_0xfb6273,_0x307765))['catch'](handleError(_0xfb6273,null));};exports[_0x80f9('0x41')]=function(_0x2cf59e,_0x397fba){var _0x36a032={'raw':!![],'where':{'id':_0x2cf59e[_0x80f9('0x42')]['id']}},_0x19c4e0={};_0x19c4e0[_0x80f9('0x2c')]=_['keys'](db[_0x80f9('0x2a')][_0x80f9('0x43')]);_0x19c4e0['query']=_[_0x80f9('0x2e')](_0x2cf59e[_0x80f9('0x2d')]);_0x19c4e0['filters']=_[_0x80f9('0x44')](_0x19c4e0[_0x80f9('0x2c')],_0x19c4e0[_0x80f9('0x2d')]);_0x36a032[_0x80f9('0x2f')]=_[_0x80f9('0x44')](_0x19c4e0[_0x80f9('0x2c')],qs[_0x80f9('0x30')](_0x2cf59e['query']['fields']));_0x36a032[_0x80f9('0x2f')]=_0x36a032['attributes'][_0x80f9('0x31')]?_0x36a032[_0x80f9('0x2f')]:_0x19c4e0[_0x80f9('0x2c')];if(_0x2cf59e[_0x80f9('0x2d')][_0x80f9('0x45')]){_0x36a032['include']=[{'all':!![]}];}_0x36a032=_[_0x80f9('0x38')]({},_0x36a032,_0x2cf59e[_0x80f9('0x39')]);return db['VoiceCallReport'][_0x80f9('0x46')](_0x36a032)[_0x80f9('0x24')](handleEntityNotFound(_0x397fba,null))['then'](respondWithResult(_0x397fba,null))[_0x80f9('0x47')](handleError(_0x397fba,null));};exports[_0x80f9('0x48')]=function(_0x740c14,_0x1744a8){return db[_0x80f9('0x2a')]['create'](_0x740c14['body'],{})[_0x80f9('0x24')](respondWithResult(_0x1744a8,0xc9))[_0x80f9('0x47')](handleError(_0x1744a8,null));};exports['destroy']=function(_0x4f2e58,_0x349238){return db['VoiceCallReport'][_0x80f9('0x46')]({'where':{'id':_0x4f2e58[_0x80f9('0x42')]['id']}})[_0x80f9('0x24')](handleEntityNotFound(_0x349238,null))[_0x80f9('0x24')](removeEntity(_0x349238,null))[_0x80f9('0x47')](handleError(_0x349238,null));};exports['describe']=function(_0x5abe42,_0x16d996){return db[_0x80f9('0x2a')][_0x80f9('0x49')]()[_0x80f9('0x24')](respondWithResult(_0x16d996,null))['catch'](handleError(_0x16d996,null));};exports[_0x80f9('0x22')]=function(_0xcb687e,_0x200e33){if(_0xcb687e[_0x80f9('0x4a')][_0x80f9('0x4b')]){delete _0xcb687e[_0x80f9('0x4a')][_0x80f9('0x4b')];}return db[_0x80f9('0x2a')][_0x80f9('0x46')]({'where':{'uniqueid':_0xcb687e['params']['id'],'UserId':{'$or':[null,_0xcb687e['user']['id']]}}})[_0x80f9('0x24')](handleEntityNotFound(_0x200e33,null))['then'](saveUpdates(_0xcb687e[_0x80f9('0x4a')],null))[_0x80f9('0x24')](respondWithResult(_0x200e33,null))[_0x80f9('0x47')](handleError(_0x200e33,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c00c70d..e4ce0b1 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 _0xbe87=['bluebird','path','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util'];(function(_0x218d3f,_0x32e8ea){var _0x5726e5=function(_0x1dcda6){while(--_0x1dcda6){_0x218d3f['push'](_0x218d3f['shift']());}};_0x5726e5(++_0x32e8ea);}(_0xbe87,0x1b6));var _0x7be8=function(_0x118026,_0x4f114b){_0x118026=_0x118026-0x0;var _0x54b1d9=_0xbe87[_0x118026];return _0x54b1d9;};'use strict';var _=require(_0x7be8('0x0'));var util=require(_0x7be8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7be8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7be8('0x3'));var rimraf=require('rimraf');var config=require(_0x7be8('0x4'));var attributes=require(_0x7be8('0x5'));module[_0x7be8('0x6')]=function(_0x4db262,_0x530485){return _0x4db262[_0x7be8('0x7')](_0x7be8('0x8'),attributes,{'tableName':_0x7be8('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0b4=['define','VoiceCallReport','report_call','uniqueid','lodash','util','moment','bluebird','request-promise','path','./voiceCallReport.attributes','exports'];(function(_0x14f947,_0x69eef1){var _0x226553=function(_0x32d6da){while(--_0x32d6da){_0x14f947['push'](_0x14f947['shift']());}};_0x226553(++_0x69eef1);}(_0xe0b4,0x190));var _0x4e0b=function(_0x419672,_0x8387b3){_0x419672=_0x419672-0x0;var _0x5ea7ed=_0xe0b4[_0x419672];return _0x5ea7ed;};'use strict';var _=require(_0x4e0b('0x0'));var util=require(_0x4e0b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4e0b('0x2'));var BPromise=require(_0x4e0b('0x3'));var rp=require(_0x4e0b('0x4'));var fs=require('fs');var path=require(_0x4e0b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e0b('0x6'));module[_0x4e0b('0x7')]=function(_0x1c6ebb,_0x632ee){return _0x1c6ebb[_0x4e0b('0x8')](_0x4e0b('0x9'),attributes,{'tableName':_0x4e0b('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4e0b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index f3b2581..ad292fe 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 _0x7066=['rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','options','attributes','limit','include','map','model','debug','create','body','raw','CreateVoiceCallReport','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x98459f,_0x4dfb55){var _0x128f94=function(_0xe6315c){while(--_0xe6315c){_0x98459f['push'](_0x98459f['shift']());}};_0x128f94(++_0x4dfb55);}(_0x7066,0x68));var _0x6706=function(_0x5d06bd,_0x47e43c){_0x5d06bd=_0x5d06bd-0x0;var _0x11735b=_0x7066[_0x5d06bd];return _0x11735b;};'use strict';var _=require(_0x6706('0x0'));var util=require(_0x6706('0x1'));var moment=require(_0x6706('0x2'));var BPromise=require(_0x6706('0x3'));var rs=require(_0x6706('0x4'));var fs=require('fs');var Redis=require(_0x6706('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6706('0x6'));var logger=require('../../config/logger')(_0x6706('0x7'));var config=require(_0x6706('0x8'));var jayson=require(_0x6706('0x9'));var client=jayson[_0x6706('0xa')][_0x6706('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x629576,_0x288237,_0x2e5221){return new BPromise(function(_0x55eb32,_0x180b8f){return client[_0x6706('0xc')](_0x629576,_0x2e5221)[_0x6706('0xd')](function(_0x121d93){logger['info'](_0x6706('0xe'),_0x288237,_0x6706('0xf'));logger['debug'](_0x6706('0x10'),_0x288237,'request\x20sent',JSON[_0x6706('0x11')](_0x121d93));if(_0x121d93[_0x6706('0x12')]){if(_0x121d93[_0x6706('0x12')]['code']===0x1f4){logger['error'](_0x6706('0xe'),_0x288237,_0x121d93[_0x6706('0x12')][_0x6706('0x13')]);return _0x180b8f(_0x121d93[_0x6706('0x12')][_0x6706('0x13')]);}logger[_0x6706('0x12')](_0x6706('0xe'),_0x288237,_0x121d93[_0x6706('0x12')]['message']);return _0x55eb32(_0x121d93[_0x6706('0x12')][_0x6706('0x13')]);}else{logger[_0x6706('0x14')](_0x6706('0xe'),_0x288237,_0x6706('0xf'));_0x55eb32(_0x121d93[_0x6706('0x15')][_0x6706('0x13')]);}})[_0x6706('0x16')](function(_0x5471e5){logger[_0x6706('0x12')](_0x6706('0xe'),_0x288237,_0x5471e5);_0x180b8f(_0x5471e5);});});}exports[_0x6706('0x17')]=function(_0x58ceeb){var _0x227490=this;return new Promise(function(_0x4d8789,_0x25b26f){return db[_0x6706('0x18')]['findAll']({'raw':_0x58ceeb['options']?_0x58ceeb[_0x6706('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x58ceeb[_0x6706('0x19')]?_0x58ceeb['options']['where']||null:null,'attributes':_0x58ceeb[_0x6706('0x19')]?_0x58ceeb[_0x6706('0x19')][_0x6706('0x1a')]||null:null,'limit':_0x58ceeb[_0x6706('0x19')]?_0x58ceeb[_0x6706('0x19')][_0x6706('0x1b')]||null:null,'include':_0x58ceeb[_0x6706('0x19')]?_0x58ceeb[_0x6706('0x19')][_0x6706('0x1c')]?_[_0x6706('0x1d')](_0x58ceeb['options'][_0x6706('0x1c')],function(_0x2dcbc5){return{'model':db[_0x2dcbc5[_0x6706('0x1e')]],'as':_0x2dcbc5['as'],'attributes':_0x2dcbc5['attributes'],'include':_0x2dcbc5[_0x6706('0x1c')]?_[_0x6706('0x1d')](_0x2dcbc5[_0x6706('0x1c')],function(_0x54ab75){return{'model':db[_0x54ab75['model']],'as':_0x54ab75['as'],'attributes':_0x54ab75[_0x6706('0x1a')],'include':_0x54ab75['include']?_['map'](_0x54ab75['include'],function(_0x3240a2){return{'model':db[_0x3240a2[_0x6706('0x1e')]],'as':_0x3240a2['as'],'attributes':_0x3240a2[_0x6706('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6706('0xd')](function(_0x16b9b0){logger['info']('GetVoiceCallReport',_0x58ceeb);logger[_0x6706('0x1f')]('GetVoiceCallReport',_0x58ceeb,JSON[_0x6706('0x11')](_0x16b9b0));_0x4d8789(_0x16b9b0);})[_0x6706('0x16')](function(_0x33c397){logger[_0x6706('0x12')](_0x6706('0x17'),_0x33c397['message'],_0x58ceeb);_0x25b26f(_0x227490[_0x6706('0x12')](0x1f4,_0x33c397[_0x6706('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x5d5967){var _0x135728=this;return new Promise(function(_0x177786,_0x451246){return db[_0x6706('0x18')][_0x6706('0x20')](_0x5d5967[_0x6706('0x21')],{'raw':_0x5d5967['options']?_0x5d5967['options'][_0x6706('0x22')]===undefined?!![]:![]:!![]})[_0x6706('0xd')](function(_0x45b54f){logger[_0x6706('0x14')](_0x6706('0x23'),_0x5d5967);logger[_0x6706('0x1f')](_0x6706('0x23'),_0x5d5967,JSON['stringify'](_0x45b54f));_0x177786(_0x45b54f);})[_0x6706('0x16')](function(_0x438a3d){logger[_0x6706('0x12')]('CreateVoiceCallReport',_0x438a3d['message'],_0x5d5967);_0x451246(_0x135728[_0x6706('0x12')](0x1f4,_0x438a3d[_0x6706('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x7a2ea3){var _0x4b844d=this;return new Promise(function(_0x20b49d,_0x314178){return db[_0x6706('0x18')]['update'](_0x7a2ea3['body'],{'raw':_0x7a2ea3[_0x6706('0x19')]?_0x7a2ea3[_0x6706('0x19')][_0x6706('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7a2ea3[_0x6706('0x19')]?_0x7a2ea3[_0x6706('0x19')]['where']||null:null,'attributes':_0x7a2ea3['options']?_0x7a2ea3[_0x6706('0x19')][_0x6706('0x1a')]||null:null,'limit':_0x7a2ea3[_0x6706('0x19')]?_0x7a2ea3[_0x6706('0x19')][_0x6706('0x1b')]||null:null})[_0x6706('0xd')](function(_0x210058){logger[_0x6706('0x14')](_0x6706('0x24'),_0x7a2ea3);logger[_0x6706('0x1f')](_0x6706('0x24'),_0x7a2ea3,JSON[_0x6706('0x11')](_0x210058));_0x20b49d(_0x210058);})[_0x6706('0x16')](function(_0x56202a){logger[_0x6706('0x12')](_0x6706('0x24'),_0x56202a['message'],_0x7a2ea3);_0x314178(_0x4b844d[_0x6706('0x12')](0x1f4,_0x56202a[_0x6706('0x13')]));});});}; \ No newline at end of file +var _0x3671=['ioredis','../../mysqldb','../../config/logger','rpc','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','where','attributes','limit','include','map','model','then','CreateVoiceCallReport','VoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','lodash','util'];(function(_0x46f595,_0x390c14){var _0x5a69a2=function(_0x28f66d){while(--_0x28f66d){_0x46f595['push'](_0x46f595['shift']());}};_0x5a69a2(++_0x390c14);}(_0x3671,0x10e));var _0x1367=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x3671[_0x49aa7d];return _0xdd0d26;};'use strict';var _=require(_0x1367('0x0'));var util=require(_0x1367('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1367('0x2'));var db=require(_0x1367('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1367('0x4'))(_0x1367('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2164f1,_0x3bb9c2,_0x367811){return new BPromise(function(_0xa529b2,_0x778690){return client['request'](_0x2164f1,_0x367811)['then'](function(_0x81db0f){logger[_0x1367('0x6')](_0x1367('0x7'),_0x3bb9c2,_0x1367('0x8'));logger[_0x1367('0x9')](_0x1367('0xa'),_0x3bb9c2,_0x1367('0x8'),JSON[_0x1367('0xb')](_0x81db0f));if(_0x81db0f[_0x1367('0xc')]){if(_0x81db0f['error'][_0x1367('0xd')]===0x1f4){logger['error'](_0x1367('0x7'),_0x3bb9c2,_0x81db0f[_0x1367('0xc')][_0x1367('0xe')]);return _0x778690(_0x81db0f[_0x1367('0xc')][_0x1367('0xe')]);}logger[_0x1367('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x3bb9c2,_0x81db0f[_0x1367('0xc')][_0x1367('0xe')]);return _0xa529b2(_0x81db0f[_0x1367('0xc')]['message']);}else{logger[_0x1367('0x6')](_0x1367('0x7'),_0x3bb9c2,_0x1367('0x8'));_0xa529b2(_0x81db0f[_0x1367('0xf')][_0x1367('0xe')]);}})[_0x1367('0x10')](function(_0x338328){logger[_0x1367('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x3bb9c2,_0x338328);_0x778690(_0x338328);});});}exports[_0x1367('0x11')]=function(_0x2bc2ff){var _0x350414=this;return new Promise(function(_0x2138e6,_0x1ea05a){return db['VoiceCallReport'][_0x1367('0x12')]({'raw':_0x2bc2ff[_0x1367('0x13')]?_0x2bc2ff[_0x1367('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x2bc2ff[_0x1367('0x13')]?_0x2bc2ff[_0x1367('0x13')][_0x1367('0x14')]||null:null,'attributes':_0x2bc2ff['options']?_0x2bc2ff[_0x1367('0x13')][_0x1367('0x15')]||null:null,'limit':_0x2bc2ff['options']?_0x2bc2ff[_0x1367('0x13')][_0x1367('0x16')]||null:null,'include':_0x2bc2ff[_0x1367('0x13')]?_0x2bc2ff[_0x1367('0x13')][_0x1367('0x17')]?_[_0x1367('0x18')](_0x2bc2ff[_0x1367('0x13')][_0x1367('0x17')],function(_0x59d4fc){return{'model':db[_0x59d4fc[_0x1367('0x19')]],'as':_0x59d4fc['as'],'attributes':_0x59d4fc['attributes'],'include':_0x59d4fc[_0x1367('0x17')]?_[_0x1367('0x18')](_0x59d4fc[_0x1367('0x17')],function(_0x5df446){return{'model':db[_0x5df446[_0x1367('0x19')]],'as':_0x5df446['as'],'attributes':_0x5df446[_0x1367('0x15')],'include':_0x5df446['include']?_['map'](_0x5df446[_0x1367('0x17')],function(_0x55363c){return{'model':db[_0x55363c[_0x1367('0x19')]],'as':_0x55363c['as'],'attributes':_0x55363c[_0x1367('0x15')]};}):[]};}):[]};}):[]:[]})[_0x1367('0x1a')](function(_0x5c2bd7){logger['info'](_0x1367('0x11'),_0x2bc2ff);logger[_0x1367('0x9')](_0x1367('0x11'),_0x2bc2ff,JSON['stringify'](_0x5c2bd7));_0x2138e6(_0x5c2bd7);})[_0x1367('0x10')](function(_0x51fe0f){logger['error']('GetVoiceCallReport',_0x51fe0f[_0x1367('0xe')],_0x2bc2ff);_0x1ea05a(_0x350414[_0x1367('0xc')](0x1f4,_0x51fe0f['message']));});});};exports[_0x1367('0x1b')]=function(_0x1f280b){var _0x3b9463=this;return new Promise(function(_0x5ae499,_0x323b5d){return db[_0x1367('0x1c')][_0x1367('0x1d')](_0x1f280b[_0x1367('0x1e')],{'raw':_0x1f280b['options']?_0x1f280b[_0x1367('0x13')][_0x1367('0x1f')]===undefined?!![]:![]:!![]})[_0x1367('0x1a')](function(_0x21d4a0){logger['info']('CreateVoiceCallReport',_0x1f280b);logger[_0x1367('0x9')](_0x1367('0x1b'),_0x1f280b,JSON[_0x1367('0xb')](_0x21d4a0));_0x5ae499(_0x21d4a0);})[_0x1367('0x10')](function(_0x471233){logger[_0x1367('0xc')]('CreateVoiceCallReport',_0x471233['message'],_0x1f280b);_0x323b5d(_0x3b9463[_0x1367('0xc')](0x1f4,_0x471233[_0x1367('0xe')]));});});};exports[_0x1367('0x20')]=function(_0x2a657a){var _0x685c17=this;return new Promise(function(_0x102907,_0x354467){return db[_0x1367('0x1c')][_0x1367('0x21')](_0x2a657a[_0x1367('0x1e')],{'raw':_0x2a657a['options']?_0x2a657a[_0x1367('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a657a[_0x1367('0x13')]?_0x2a657a[_0x1367('0x13')][_0x1367('0x14')]||null:null,'attributes':_0x2a657a['options']?_0x2a657a[_0x1367('0x13')][_0x1367('0x15')]||null:null,'limit':_0x2a657a[_0x1367('0x13')]?_0x2a657a['options'][_0x1367('0x16')]||null:null})[_0x1367('0x1a')](function(_0x4a2217){logger[_0x1367('0x6')](_0x1367('0x20'),_0x2a657a);logger[_0x1367('0x9')](_0x1367('0x20'),_0x2a657a,JSON[_0x1367('0xb')](_0x4a2217));_0x102907(_0x4a2217);})[_0x1367('0x10')](function(_0x3532c5){logger[_0x1367('0xc')]('UpdateVoiceCallReport',_0x3532c5[_0x1367('0xe')],_0x2a657a);_0x354467(_0x685c17[_0x1367('0xc')](0x1f4,_0x3532c5[_0x1367('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 31e6751..f4c1c4b 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 _0xd2e3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','path','express'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xd2e3,0x1e3));var _0x3d2e=function(_0x4da7cc,_0x57fbaa){_0x4da7cc=_0x4da7cc-0x0;var _0x233d81=_0xd2e3[_0x4da7cc];return _0x233d81;};'use strict';var multer=require(_0x3d2e('0x0'));var util=require('util');var path=require(_0x3d2e('0x1'));var timeout=require('connect-timeout');var express=require(_0x3d2e('0x2'));var router=express[_0x3d2e('0x3')]();var auth=require(_0x3d2e('0x4'));var interaction=require(_0x3d2e('0x5'));var config=require(_0x3d2e('0x6'));var controller=require(_0x3d2e('0x7'));router[_0x3d2e('0x8')]('/',auth[_0x3d2e('0x9')](),controller[_0x3d2e('0xa')]);router['get'](_0x3d2e('0xb'),auth[_0x3d2e('0x9')](),controller['show']);router[_0x3d2e('0xc')]('/',auth[_0x3d2e('0x9')](),controller[_0x3d2e('0xd')]);router[_0x3d2e('0xe')](_0x3d2e('0xb'),auth['isAuthenticated'](),controller[_0x3d2e('0xf')]);router[_0x3d2e('0x10')](_0x3d2e('0xb'),auth[_0x3d2e('0x9')](),controller['destroy']);module[_0x3d2e('0x11')]=router; \ No newline at end of file +var _0xc2d6=['/:id','show','isAuthenticated','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc2d6,0x171));var _0x6c2d=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xc2d6[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require('multer');var util=require(_0x6c2d('0x0'));var path=require(_0x6c2d('0x1'));var timeout=require(_0x6c2d('0x2'));var express=require(_0x6c2d('0x3'));var router=express[_0x6c2d('0x4')]();var auth=require(_0x6c2d('0x5'));var interaction=require(_0x6c2d('0x6'));var config=require(_0x6c2d('0x7'));var controller=require(_0x6c2d('0x8'));router[_0x6c2d('0x9')]('/',auth['isAuthenticated'](),controller[_0x6c2d('0xa')]);router[_0x6c2d('0x9')](_0x6c2d('0xb'),auth['isAuthenticated'](),controller[_0x6c2d('0xc')]);router['post']('/',auth[_0x6c2d('0xd')](),controller[_0x6c2d('0xe')]);router[_0x6c2d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6c2d('0x10')]);router[_0x6c2d('0x11')](_0x6c2d('0xb'),auth[_0x6c2d('0xd')](),controller['destroy']);module[_0x6c2d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 14bc4cc..c58e31a 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 _0x806f=['sequelize','exports','STRING','name','setDataValue','options','getDataValue','split','BOOLEAN'];(function(_0x511c38,_0x12071b){var _0x3120a4=function(_0x2e9259){while(--_0x2e9259){_0x511c38['push'](_0x511c38['shift']());}};_0x3120a4(++_0x12071b);}(_0x806f,0x13b));var _0xf806=function(_0x53f35,_0x2cfc69){_0x53f35=_0x53f35-0x0;var _0x38da4c=_0x806f[_0x53f35];return _0x38da4c;};'use strict';var Sequelize=require(_0xf806('0x0'));module[_0xf806('0x1')]={'name':{'type':Sequelize[_0xf806('0x2')]},'prefix':{'type':Sequelize[_0xf806('0x2')],'unique':_0xf806('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xf806('0x2')],'set':function(_0x564e42){this[_0xf806('0x4')](_0xf806('0x5'),_0x564e42?_0x564e42['join'](''):[]);},'get':function(){return this[_0xf806('0x6')](_0xf806('0x5'))?this[_0xf806('0x6')](_0xf806('0x5'))[_0xf806('0x7')](''):[];}},'auth':{'type':Sequelize[_0xf806('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xf806('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf806('0x2')]},'description':{'type':Sequelize[_0xf806('0x2')]}}; \ No newline at end of file +var _0x81aa=['getDataValue','BOOLEAN','exports','STRING','options','join'];(function(_0x595d76,_0x28cd7e){var _0xd352c5=function(_0x531493){while(--_0x531493){_0x595d76['push'](_0x595d76['shift']());}};_0xd352c5(++_0x28cd7e);}(_0x81aa,0xec));var _0xa81a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x81aa[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');module[_0xa81a('0x0')]={'name':{'type':Sequelize[_0xa81a('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xa81a('0x1')],'set':function(_0x3a6e68){this['setDataValue'](_0xa81a('0x2'),_0x3a6e68?_0x3a6e68[_0xa81a('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xa81a('0x2'))?this[_0xa81a('0x4')](_0xa81a('0x2'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xa81a('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa81a('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 69f3a1a..a52ef40 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 _0xcc60=['catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0xcc60,0x1e9));var _0x0cc6=function(_0x4812dd,_0x38e4db){_0x4812dd=_0x4812dd-0x0;var _0x5bade8=_0xcc60[_0x4812dd];return _0x5bade8;};'use strict';var pdf=require(_0x0cc6('0x0'));var emlformat=require(_0x0cc6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0cc6('0x2'));var jsonpatch=require(_0x0cc6('0x3'));var rp=require('request-promise');var moment=require(_0x0cc6('0x4'));var BPromise=require(_0x0cc6('0x5'));var Mustache=require(_0x0cc6('0x6'));var util=require('util');var path=require(_0x0cc6('0x7'));var sox=require(_0x0cc6('0x8'));var csv=require(_0x0cc6('0x9'));var ejs=require(_0x0cc6('0xa'));var fs=require('fs');var _=require(_0x0cc6('0xb'));var squel=require(_0x0cc6('0xc'));var crypto=require('crypto');var jsforce=require(_0x0cc6('0xd'));var deskjs=require(_0x0cc6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0cc6('0xf'));var Papa=require(_0x0cc6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0cc6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0cc6('0x12'));var logger=require('../../config/logger')(_0x0cc6('0x13'));var utils=require(_0x0cc6('0x14'));var config=require(_0x0cc6('0x15'));var db=require(_0x0cc6('0x16'))['db'];function respondWithStatusCode(_0x1aebde,_0xac471e){_0xac471e=_0xac471e||0xcc;return function(_0x106139){if(_0x106139){return _0x1aebde['sendStatus'](_0xac471e);}return _0x1aebde[_0x0cc6('0x17')](_0xac471e)['end']();};}function respondWithResult(_0x11850c,_0x5cefc8){_0x5cefc8=_0x5cefc8||0xc8;return function(_0x1b1811){if(_0x1b1811){return _0x11850c[_0x0cc6('0x17')](_0x5cefc8)[_0x0cc6('0x18')](_0x1b1811);}};}function respondWithFilteredResult(_0x3bc201,_0x1f615b){return function(_0x5cccab){if(_0x5cccab){var _0x21c530=_0x5cccab[_0x0cc6('0x19')],_0xa8227=_0x1f615b[_0x0cc6('0x1a')],_0x42e44a=_0x1f615b[_0x0cc6('0x1a')]+_0x1f615b[_0x0cc6('0x1b')],_0x42978f;if(_0x42e44a>=_0x21c530){_0x42e44a=_0x21c530;_0x42978f=0xc8;}else{_0x42978f=0xce;}_0x3bc201[_0x0cc6('0x17')](_0x42978f);return _0x3bc201['set'](_0x0cc6('0x1c'),_0xa8227+'-'+_0x42e44a+'/'+_0x21c530)[_0x0cc6('0x18')](_0x5cccab);}return null;};}function patchUpdates(_0x53079a){return function(_0x4b4d72){try{jsonpatch['apply'](_0x4b4d72,_0x53079a,!![]);}catch(_0xb9c381){return BPromise[_0x0cc6('0x1d')](_0xb9c381);}return _0x4b4d72[_0x0cc6('0x1e')]();};}function saveUpdates(_0x115203,_0x314e97){return function(_0x35d30c){if(_0x35d30c){return _0x35d30c[_0x0cc6('0x1f')](_0x115203)[_0x0cc6('0x20')](function(_0x1a45f8){return _0x1a45f8;});}return null;};}function removeEntity(_0x218b01,_0x59f447){return function(_0x1aa191){if(_0x1aa191){return _0x1aa191[_0x0cc6('0x21')]()[_0x0cc6('0x20')](function(){var _0x446e70=_0x1aa191[_0x0cc6('0x22')]({'plain':!![]});var _0x1e1d1e='ChanSpies';return db[_0x0cc6('0x23')][_0x0cc6('0x21')]({'where':{'type':_0x1e1d1e,'resourceId':_0x446e70['id']}})[_0x0cc6('0x20')](function(){return _0x1aa191;});})[_0x0cc6('0x20')](function(){_0x218b01[_0x0cc6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3643e6,_0x4d5482){return function(_0x11b75f){if(!_0x11b75f){_0x3643e6[_0x0cc6('0x24')](0x194);}return _0x11b75f;};}function handleError(_0x12d2a2,_0x4b60e){_0x4b60e=_0x4b60e||0x1f4;return function(_0xa28892){logger[_0x0cc6('0x25')](_0xa28892['stack']);if(_0xa28892['name']){delete _0xa28892[_0x0cc6('0x26')];}_0x12d2a2[_0x0cc6('0x17')](_0x4b60e)[_0x0cc6('0x27')](_0xa28892);};}exports[_0x0cc6('0x28')]=function(_0x327325,_0x3ef60d){var _0x457ef6={},_0x5c10f3={},_0x46decf={'count':0x0,'rows':[]};var _0x26f7e9=_[_0x0cc6('0x29')](db[_0x0cc6('0x2a')]['rawAttributes'],function(_0x750bd4){return{'name':_0x750bd4[_0x0cc6('0x2b')],'type':_0x750bd4[_0x0cc6('0x2c')][_0x0cc6('0x2d')]};});_0x5c10f3[_0x0cc6('0x2e')]=_[_0x0cc6('0x29')](_0x26f7e9,_0x0cc6('0x26'));_0x5c10f3[_0x0cc6('0x2f')]=_[_0x0cc6('0x30')](_0x327325[_0x0cc6('0x2f')]);_0x5c10f3[_0x0cc6('0x31')]=_[_0x0cc6('0x32')](_0x5c10f3[_0x0cc6('0x2e')],_0x5c10f3[_0x0cc6('0x2f')]);_0x457ef6[_0x0cc6('0x33')]=_['intersection'](_0x5c10f3[_0x0cc6('0x2e')],qs['fields'](_0x327325[_0x0cc6('0x2f')][_0x0cc6('0x34')]));_0x457ef6[_0x0cc6('0x33')]=_0x457ef6[_0x0cc6('0x33')]['length']?_0x457ef6[_0x0cc6('0x33')]:_0x5c10f3['model'];if(!_0x327325[_0x0cc6('0x2f')][_0x0cc6('0x35')]('nolimit')){_0x457ef6[_0x0cc6('0x1b')]=qs[_0x0cc6('0x1b')](_0x327325[_0x0cc6('0x2f')][_0x0cc6('0x1b')]);_0x457ef6['offset']=qs[_0x0cc6('0x1a')](_0x327325[_0x0cc6('0x2f')][_0x0cc6('0x1a')]);}_0x457ef6['order']=qs[_0x0cc6('0x36')](_0x327325['query'][_0x0cc6('0x36')]);_0x457ef6['where']=qs['filters'](_[_0x0cc6('0x37')](_0x327325['query'],_0x5c10f3[_0x0cc6('0x31')]),_0x26f7e9);if(_0x327325['query'][_0x0cc6('0x38')]){_0x457ef6[_0x0cc6('0x39')]=_[_0x0cc6('0x3a')](_0x457ef6[_0x0cc6('0x39')],{'$or':_[_0x0cc6('0x29')](_0x26f7e9,function(_0x180db6){if(_0x180db6[_0x0cc6('0x2c')]!==_0x0cc6('0x3b')){var _0x2bfc76={};_0x2bfc76[_0x180db6[_0x0cc6('0x26')]]={'$like':'%'+_0x327325[_0x0cc6('0x2f')][_0x0cc6('0x38')]+'%'};return _0x2bfc76;}})});}_0x457ef6=_['merge']({},_0x457ef6,_0x327325[_0x0cc6('0x3c')]);var _0x39fffd={'where':_0x457ef6['where']};return db['VoiceChanSpy'][_0x0cc6('0x19')](_0x39fffd)[_0x0cc6('0x20')](function(_0xe95b3f){_0x46decf[_0x0cc6('0x19')]=_0xe95b3f;if(_0x327325[_0x0cc6('0x2f')]['includeAll']){_0x457ef6[_0x0cc6('0x3d')]=[{'all':!![]}];}return db[_0x0cc6('0x2a')][_0x0cc6('0x3e')](_0x457ef6);})[_0x0cc6('0x20')](function(_0x576e8f){_0x46decf[_0x0cc6('0x3f')]=_0x576e8f;return _0x46decf;})[_0x0cc6('0x20')](respondWithFilteredResult(_0x3ef60d,_0x457ef6))[_0x0cc6('0x40')](handleError(_0x3ef60d,null));};exports[_0x0cc6('0x41')]=function(_0x1260d8,_0xfa91b6){var _0x2a7e25={'raw':![],'where':{'id':_0x1260d8[_0x0cc6('0x42')]['id']}},_0x4aca8b={};_0x4aca8b[_0x0cc6('0x2e')]=_['keys'](db[_0x0cc6('0x2a')][_0x0cc6('0x43')]);_0x4aca8b[_0x0cc6('0x2f')]=_[_0x0cc6('0x30')](_0x1260d8['query']);_0x4aca8b[_0x0cc6('0x31')]=_[_0x0cc6('0x32')](_0x4aca8b[_0x0cc6('0x2e')],_0x4aca8b[_0x0cc6('0x2f')]);_0x2a7e25['attributes']=_[_0x0cc6('0x32')](_0x4aca8b[_0x0cc6('0x2e')],qs[_0x0cc6('0x34')](_0x1260d8[_0x0cc6('0x2f')]['fields']));_0x2a7e25[_0x0cc6('0x33')]=_0x2a7e25[_0x0cc6('0x33')]['length']?_0x2a7e25[_0x0cc6('0x33')]:_0x4aca8b[_0x0cc6('0x2e')];if(_0x1260d8[_0x0cc6('0x2f')][_0x0cc6('0x44')]){_0x2a7e25[_0x0cc6('0x3d')]=[{'all':!![]}];}_0x2a7e25=_[_0x0cc6('0x3a')]({},_0x2a7e25,_0x1260d8[_0x0cc6('0x3c')]);return db[_0x0cc6('0x2a')][_0x0cc6('0x45')](_0x2a7e25)[_0x0cc6('0x20')](handleEntityNotFound(_0xfa91b6,null))[_0x0cc6('0x20')](respondWithResult(_0xfa91b6,null))[_0x0cc6('0x40')](handleError(_0xfa91b6,null));};exports[_0x0cc6('0x46')]=function(_0x276653,_0x304264){return db[_0x0cc6('0x2a')]['create'](_0x276653[_0x0cc6('0x47')],{})[_0x0cc6('0x20')](function(_0x17b4cd){var _0x4fd254=_0x276653[_0x0cc6('0x48')][_0x0cc6('0x22')]({'plain':!![]});if(!_0x4fd254)throw new Error(_0x0cc6('0x49'));if(_0x4fd254[_0x0cc6('0x4a')]===_0x0cc6('0x48')){var _0x3bb31d=_0x17b4cd[_0x0cc6('0x22')]({'plain':!![]});var _0x41c9cd=_0x0cc6('0x4b');return db['UserProfileSection'][_0x0cc6('0x45')]({'where':{'name':_0x41c9cd,'userProfileId':_0x4fd254[_0x0cc6('0x4c')]},'raw':!![]})[_0x0cc6('0x20')](function(_0x37aa26){if(_0x37aa26&&_0x37aa26[_0x0cc6('0x4d')]===0x0){return db[_0x0cc6('0x23')]['create']({'name':_0x3bb31d[_0x0cc6('0x26')],'resourceId':_0x3bb31d['id'],'type':_0x37aa26[_0x0cc6('0x26')],'sectionId':_0x37aa26['id']},{})[_0x0cc6('0x20')](function(){return _0x17b4cd;});}else{return _0x17b4cd;}})[_0x0cc6('0x40')](function(_0x265880){logger[_0x0cc6('0x25')](_0x0cc6('0x4e'),_0x265880);throw _0x265880;});}return _0x17b4cd;})['then'](respondWithResult(_0x304264,0xc9))[_0x0cc6('0x40')](handleError(_0x304264,null));};exports[_0x0cc6('0x1f')]=function(_0x16cafb,_0x241331){if(_0x16cafb[_0x0cc6('0x47')]['id']){delete _0x16cafb['body']['id'];}return db['VoiceChanSpy'][_0x0cc6('0x45')]({'where':{'id':_0x16cafb['params']['id']}})[_0x0cc6('0x20')](handleEntityNotFound(_0x241331,null))[_0x0cc6('0x20')](saveUpdates(_0x16cafb[_0x0cc6('0x47')],null))['then'](respondWithResult(_0x241331,null))[_0x0cc6('0x40')](handleError(_0x241331,null));};exports[_0x0cc6('0x21')]=function(_0xc38d5c,_0x374734){return db[_0x0cc6('0x2a')][_0x0cc6('0x45')]({'where':{'id':_0xc38d5c[_0x0cc6('0x42')]['id']}})[_0x0cc6('0x20')](handleEntityNotFound(_0x374734,null))['then'](removeEntity(_0x374734,null))['catch'](handleError(_0x374734,null));}; \ No newline at end of file +var _0x83d9=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','update','destroy','then','get','UserProfileResource','name','send','map','VoiceChanSpy','rawAttributes','fieldName','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','limit','order','sort','where','merge','type','filter','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','error','html-pdf'];(function(_0x5e2c02,_0x490707){var _0x4f0194=function(_0x27651b){while(--_0x27651b){_0x5e2c02['push'](_0x5e2c02['shift']());}};_0x4f0194(++_0x490707);}(_0x83d9,0xe0));var _0x983d=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x83d9[_0x1b828b];return _0x98da1a;};'use strict';var pdf=require(_0x983d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x983d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x983d('0x2'));var rp=require(_0x983d('0x3'));var moment=require(_0x983d('0x4'));var BPromise=require(_0x983d('0x5'));var Mustache=require(_0x983d('0x6'));var util=require('util');var path=require(_0x983d('0x7'));var sox=require(_0x983d('0x8'));var csv=require(_0x983d('0x9'));var ejs=require(_0x983d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x983d('0xb'));var crypto=require(_0x983d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x983d('0xd'));var toCsv=require(_0x983d('0x9'));var querystring=require(_0x983d('0xe'));var Papa=require(_0x983d('0xf'));var Redis=require('ioredis');var authService=require(_0x983d('0x10'));var qs=require(_0x983d('0x11'));var as=require(_0x983d('0x12'));var hardwareService=require(_0x983d('0x13'));var logger=require('../../config/logger')(_0x983d('0x14'));var utils=require(_0x983d('0x15'));var config=require('../../config/environment');var db=require(_0x983d('0x16'))['db'];function respondWithStatusCode(_0x519683,_0x8344d6){_0x8344d6=_0x8344d6||0xcc;return function(_0x35d635){if(_0x35d635){return _0x519683[_0x983d('0x17')](_0x8344d6);}return _0x519683[_0x983d('0x18')](_0x8344d6)[_0x983d('0x19')]();};}function respondWithResult(_0x55041f,_0x1aa73c){_0x1aa73c=_0x1aa73c||0xc8;return function(_0x2bd2fb){if(_0x2bd2fb){return _0x55041f[_0x983d('0x18')](_0x1aa73c)[_0x983d('0x1a')](_0x2bd2fb);}};}function respondWithFilteredResult(_0x1c6c55,_0x24ed47){return function(_0x4e01f2){if(_0x4e01f2){var _0xfdaf88=_0x4e01f2[_0x983d('0x1b')],_0x34eee1=_0x24ed47[_0x983d('0x1c')],_0x45a10c=_0x24ed47[_0x983d('0x1c')]+_0x24ed47['limit'],_0x1fd670;if(_0x45a10c>=_0xfdaf88){_0x45a10c=_0xfdaf88;_0x1fd670=0xc8;}else{_0x1fd670=0xce;}_0x1c6c55[_0x983d('0x18')](_0x1fd670);return _0x1c6c55['set'](_0x983d('0x1d'),_0x34eee1+'-'+_0x45a10c+'/'+_0xfdaf88)['json'](_0x4e01f2);}return null;};}function patchUpdates(_0x5a6651){return function(_0x301b59){try{jsonpatch['apply'](_0x301b59,_0x5a6651,!![]);}catch(_0x4c62dc){return BPromise['reject'](_0x4c62dc);}return _0x301b59['save']();};}function saveUpdates(_0x4466e6,_0x517437){return function(_0x4d0cfd){if(_0x4d0cfd){return _0x4d0cfd[_0x983d('0x1e')](_0x4466e6)['then'](function(_0x52c0b5){return _0x52c0b5;});}return null;};}function removeEntity(_0x1bf4f2,_0x26b5d0){return function(_0x15466b){if(_0x15466b){return _0x15466b[_0x983d('0x1f')]()[_0x983d('0x20')](function(){var _0x2be4ed=_0x15466b[_0x983d('0x21')]({'plain':!![]});var _0x406530='ChanSpies';return db[_0x983d('0x22')][_0x983d('0x1f')]({'where':{'type':_0x406530,'resourceId':_0x2be4ed['id']}})['then'](function(){return _0x15466b;});})[_0x983d('0x20')](function(){_0x1bf4f2[_0x983d('0x18')](0xcc)[_0x983d('0x19')]();});}};}function handleEntityNotFound(_0x60ac42,_0x5f680a){return function(_0x2e6549){if(!_0x2e6549){_0x60ac42['sendStatus'](0x194);}return _0x2e6549;};}function handleError(_0x379c6f,_0x540e07){_0x540e07=_0x540e07||0x1f4;return function(_0x3d5ff1){logger['error'](_0x3d5ff1['stack']);if(_0x3d5ff1[_0x983d('0x23')]){delete _0x3d5ff1[_0x983d('0x23')];}_0x379c6f['status'](_0x540e07)[_0x983d('0x24')](_0x3d5ff1);};}exports['index']=function(_0x5d42fb,_0x4b139a){var _0x410a47={},_0x1390a8={},_0x4fa00a={'count':0x0,'rows':[]};var _0x47ed68=_[_0x983d('0x25')](db[_0x983d('0x26')][_0x983d('0x27')],function(_0xb40ff8){return{'name':_0xb40ff8[_0x983d('0x28')],'type':_0xb40ff8['type'][_0x983d('0x29')]};});_0x1390a8['model']=_[_0x983d('0x25')](_0x47ed68,'name');_0x1390a8['query']=_['keys'](_0x5d42fb[_0x983d('0x2a')]);_0x1390a8[_0x983d('0x2b')]=_['intersection'](_0x1390a8['model'],_0x1390a8[_0x983d('0x2a')]);_0x410a47[_0x983d('0x2c')]=_[_0x983d('0x2d')](_0x1390a8[_0x983d('0x2e')],qs['fields'](_0x5d42fb[_0x983d('0x2a')][_0x983d('0x2f')]));_0x410a47[_0x983d('0x2c')]=_0x410a47[_0x983d('0x2c')][_0x983d('0x30')]?_0x410a47['attributes']:_0x1390a8[_0x983d('0x2e')];if(!_0x5d42fb[_0x983d('0x2a')][_0x983d('0x31')]('nolimit')){_0x410a47[_0x983d('0x32')]=qs[_0x983d('0x32')](_0x5d42fb[_0x983d('0x2a')][_0x983d('0x32')]);_0x410a47[_0x983d('0x1c')]=qs[_0x983d('0x1c')](_0x5d42fb['query'][_0x983d('0x1c')]);}_0x410a47[_0x983d('0x33')]=qs[_0x983d('0x34')](_0x5d42fb[_0x983d('0x2a')][_0x983d('0x34')]);_0x410a47[_0x983d('0x35')]=qs[_0x983d('0x2b')](_['pick'](_0x5d42fb[_0x983d('0x2a')],_0x1390a8[_0x983d('0x2b')]),_0x47ed68);if(_0x5d42fb['query']['filter']){_0x410a47[_0x983d('0x35')]=_[_0x983d('0x36')](_0x410a47[_0x983d('0x35')],{'$or':_[_0x983d('0x25')](_0x47ed68,function(_0x565681){if(_0x565681[_0x983d('0x37')]!=='VIRTUAL'){var _0x1bdfd4={};_0x1bdfd4[_0x565681[_0x983d('0x23')]]={'$like':'%'+_0x5d42fb[_0x983d('0x2a')][_0x983d('0x38')]+'%'};return _0x1bdfd4;}})});}_0x410a47=_[_0x983d('0x36')]({},_0x410a47,_0x5d42fb[_0x983d('0x39')]);var _0x1c6588={'where':_0x410a47['where']};return db['VoiceChanSpy']['count'](_0x1c6588)[_0x983d('0x20')](function(_0x53026b){_0x4fa00a[_0x983d('0x1b')]=_0x53026b;if(_0x5d42fb[_0x983d('0x2a')][_0x983d('0x3a')]){_0x410a47[_0x983d('0x3b')]=[{'all':!![]}];}return db[_0x983d('0x26')][_0x983d('0x3c')](_0x410a47);})['then'](function(_0x2d10ad){_0x4fa00a[_0x983d('0x3d')]=_0x2d10ad;return _0x4fa00a;})['then'](respondWithFilteredResult(_0x4b139a,_0x410a47))['catch'](handleError(_0x4b139a,null));};exports[_0x983d('0x3e')]=function(_0x471b7f,_0xdf833d){var _0x4e915e={'raw':![],'where':{'id':_0x471b7f[_0x983d('0x3f')]['id']}},_0x3f41b0={};_0x3f41b0['model']=_[_0x983d('0x40')](db[_0x983d('0x26')][_0x983d('0x27')]);_0x3f41b0[_0x983d('0x2a')]=_[_0x983d('0x40')](_0x471b7f[_0x983d('0x2a')]);_0x3f41b0[_0x983d('0x2b')]=_['intersection'](_0x3f41b0[_0x983d('0x2e')],_0x3f41b0['query']);_0x4e915e[_0x983d('0x2c')]=_[_0x983d('0x2d')](_0x3f41b0['model'],qs[_0x983d('0x2f')](_0x471b7f[_0x983d('0x2a')][_0x983d('0x2f')]));_0x4e915e[_0x983d('0x2c')]=_0x4e915e[_0x983d('0x2c')][_0x983d('0x30')]?_0x4e915e[_0x983d('0x2c')]:_0x3f41b0[_0x983d('0x2e')];if(_0x471b7f[_0x983d('0x2a')][_0x983d('0x3a')]){_0x4e915e[_0x983d('0x3b')]=[{'all':!![]}];}_0x4e915e=_['merge']({},_0x4e915e,_0x471b7f[_0x983d('0x39')]);return db[_0x983d('0x26')][_0x983d('0x41')](_0x4e915e)[_0x983d('0x20')](handleEntityNotFound(_0xdf833d,null))[_0x983d('0x20')](respondWithResult(_0xdf833d,null))[_0x983d('0x42')](handleError(_0xdf833d,null));};exports[_0x983d('0x43')]=function(_0x25b2a9,_0x31e20b){return db[_0x983d('0x26')][_0x983d('0x43')](_0x25b2a9['body'],{})[_0x983d('0x20')](function(_0x2ead1e){var _0x3efae5=_0x25b2a9['user']['get']({'plain':!![]});if(!_0x3efae5)throw new Error(_0x983d('0x44'));if(_0x3efae5[_0x983d('0x45')]===_0x983d('0x46')){var _0x5b0922=_0x2ead1e['get']({'plain':!![]});var _0x7bf7ef=_0x983d('0x47');return db[_0x983d('0x48')][_0x983d('0x41')]({'where':{'name':_0x7bf7ef,'userProfileId':_0x3efae5[_0x983d('0x49')]},'raw':!![]})[_0x983d('0x20')](function(_0x2f156e){if(_0x2f156e&&_0x2f156e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5b0922[_0x983d('0x23')],'resourceId':_0x5b0922['id'],'type':_0x2f156e['name'],'sectionId':_0x2f156e['id']},{})['then'](function(){return _0x2ead1e;});}else{return _0x2ead1e;}})['catch'](function(_0x369acd){logger[_0x983d('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x369acd);throw _0x369acd;});}return _0x2ead1e;})[_0x983d('0x20')](respondWithResult(_0x31e20b,0xc9))[_0x983d('0x42')](handleError(_0x31e20b,null));};exports[_0x983d('0x1e')]=function(_0x3d73f5,_0x5d749d){if(_0x3d73f5['body']['id']){delete _0x3d73f5['body']['id'];}return db[_0x983d('0x26')][_0x983d('0x41')]({'where':{'id':_0x3d73f5['params']['id']}})[_0x983d('0x20')](handleEntityNotFound(_0x5d749d,null))[_0x983d('0x20')](saveUpdates(_0x3d73f5['body'],null))[_0x983d('0x20')](respondWithResult(_0x5d749d,null))[_0x983d('0x42')](handleError(_0x5d749d,null));};exports[_0x983d('0x1f')]=function(_0x18d204,_0x140016){return db[_0x983d('0x26')][_0x983d('0x41')]({'where':{'id':_0x18d204[_0x983d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x140016,null))['then'](removeEntity(_0x140016,null))[_0x983d('0x42')](handleError(_0x140016,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index d5807e4..64bfda8 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 _0x9b5b=['catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','then','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','push','Set','CDR(type)=%s','record','merge','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0x9b5b,0x7f));var _0xb9b5=function(_0x445140,_0x5b5b99){_0x445140=_0x445140-0x0;var _0x25ce78=_0x9b5b[_0x445140];return _0x25ce78;};'use strict';var _=require(_0xb9b5('0x0'));var util=require(_0xb9b5('0x1'));var BPromise=require(_0xb9b5('0x2'));var attributes=require(_0xb9b5('0x3'));var getUserApplications=function(_0x295b93,_0x172064,_0x19208c){var _0xf3dd29=0x1;var _0x6c5d19=[];var _0x575d3a={'context':_0x172064[_0xb9b5('0x4')]||_0xb9b5('0x5'),'exten':util[_0xb9b5('0x6')]('%s%s',_0x295b93['prefix'],_0x19208c),'type':'system','isApp':![],'ChanSpyId':_0x295b93['id'],'UserId':_0x172064['id']};_0x6c5d19[_0xb9b5('0x7')](_['merge']({'app':_0xb9b5('0x8'),'appdata':util[_0xb9b5('0x6')](_0xb9b5('0x9'),'chanspy'),'priority':_0xf3dd29++},_0x575d3a));if(_0x295b93[_0xb9b5('0xa')]){_0x6c5d19['push'](_[_0xb9b5('0xb')]({'app':_0xb9b5('0xc'),'appdata':util[_0xb9b5('0x6')](_0xb9b5('0xd'),_0x295b93['recordingFormat']),'priority':_0xf3dd29++},_0x575d3a));}if(_0x295b93[_0xb9b5('0xe')]){_0x6c5d19[_0xb9b5('0x7')](_[_0xb9b5('0xb')]({'app':_0xb9b5('0xf'),'appdata':_0x295b93[_0xb9b5('0x10')],'priority':_0xf3dd29++},_0x575d3a));}_0x6c5d19[_0xb9b5('0x7')](_[_0xb9b5('0xb')]({'app':_0xb9b5('0x11'),'appdata':util[_0xb9b5('0x6')](_0xb9b5('0x12'),_0x172064['name'],_0x295b93['options']?_0x295b93[_0xb9b5('0x13')][_0xb9b5('0x14')](''):''),'priority':_0xf3dd29++},_0x575d3a));if(_0x295b93[_0xb9b5('0xa')]){_0x6c5d19[_0xb9b5('0x7')](_[_0xb9b5('0xb')]({'app':_0xb9b5('0x15'),'priority':_0xf3dd29++},_0x575d3a));}return _0x6c5d19;};var getChanSpyApplications=function(_0x1a452b,_0x3c89c0){var _0x1dc8c2=[];for(var _0x1e7064=0x0,_0x54f33e=0x1;_0x1e7064<_0x3c89c0[_0xb9b5('0x16')];_0x1e7064++,_0x54f33e=0x1){_0x1dc8c2=_0x1dc8c2[_0xb9b5('0x17')](getUserApplications(_0x1a452b,_0x3c89c0[_0x1e7064],_0x3c89c0[_0x1e7064][_0xb9b5('0x18')]));if(_0x3c89c0[_0x1e7064][_0xb9b5('0x18')]!=_0x3c89c0[_0x1e7064][_0xb9b5('0x19')]){_0x1dc8c2=_0x1dc8c2['concat'](getUserApplications(_0x1a452b,_0x3c89c0[_0x1e7064],_0x3c89c0[_0x1e7064][_0xb9b5('0x19')]));}}return _0x1dc8c2;};var getChanSpyPromise=function(_0x7ab648,_0x2c2893){return new BPromise(function(_0x1dc0a8,_0x3dbacd){return _0x7ab648[_0xb9b5('0x1a')][_0xb9b5('0x1b')]({'attributes':['id',_0xb9b5('0x19'),'internal'],'where':{'role':_0xb9b5('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x394310){if(_0x394310){return _0x1dc0a8(getChanSpyApplications(_0x2c2893,_0x394310));}return _0x1dc0a8([]);})[_0xb9b5('0x1d')](function(_0x1bbf62){_0x3dbacd(_0x1bbf62);});});};module[_0xb9b5('0x1e')]=function(_0x1d55cd,_0xd1a22c){var _0x33af2a=_0x1d55cd[_0xb9b5('0x1f')];return _0x1d55cd[_0xb9b5('0x20')](_0xb9b5('0x21'),attributes,{'tableName':_0xb9b5('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5bb50c,_0x5f0ce4,_0x3239f8){return getChanSpyPromise(_0x33af2a,_0x5bb50c)['then'](function(_0x10bdca){if(_0x10bdca&&_0x10bdca[_0xb9b5('0x16')]){return _0x33af2a[_0xb9b5('0x23')][_0xb9b5('0x24')](_0x10bdca);}})[_0xb9b5('0x25')](function(){_0x3239f8();})[_0xb9b5('0x1d')](function(_0x1df9bd){_0x3239f8(_0x1df9bd);});},'afterUpdate':function(_0x3865ec,_0x42d908,_0x38f07a){return _0x33af2a[_0xb9b5('0x23')][_0xb9b5('0x26')]({'where':{'ChanSpyId':_0x3865ec['id']}})[_0xb9b5('0x25')](function(){return getChanSpyPromise(_0x33af2a,_0x3865ec);})['then'](function(_0x54869a){if(_0x54869a&&_0x54869a[_0xb9b5('0x16')]){return _0x33af2a[_0xb9b5('0x23')][_0xb9b5('0x24')](_0x54869a);}})[_0xb9b5('0x25')](function(){_0x38f07a();})[_0xb9b5('0x1d')](function(_0x1259c2){_0x38f07a(_0x1259c2);});},'afterDestroy':function(_0x16e6fa,_0x2e8d0e,_0x49d657){return _0x33af2a['VoiceExtension'][_0xb9b5('0x26')]({'where':{'ChanSpyId':_0x16e6fa['id']}})[_0xb9b5('0x25')](function(){_0x49d657();})[_0xb9b5('0x1d')](function(_0x2612a1){_0x49d657(_0x2612a1);});}}});}; \ No newline at end of file +var _0xcdd2=['internal','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','chanspy','record','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat'];(function(_0x21fec0,_0x2f9a99){var _0xcf272e=function(_0x18e35d){while(--_0x18e35d){_0x21fec0['push'](_0x21fec0['shift']());}};_0xcf272e(++_0x2f9a99);}(_0xcdd2,0x13d));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var BPromise=require('bluebird');var attributes=require(_0x2cdd('0x2'));var getUserApplications=function(_0x5b038f,_0x1b37f3,_0xc57eca){var _0x37512a=0x1;var _0x5ceaca=[];var _0x2738d6={'context':_0x1b37f3[_0x2cdd('0x3')]||_0x2cdd('0x4'),'exten':util[_0x2cdd('0x5')](_0x2cdd('0x6'),_0x5b038f[_0x2cdd('0x7')],_0xc57eca),'type':_0x2cdd('0x8'),'isApp':![],'ChanSpyId':_0x5b038f['id'],'UserId':_0x1b37f3['id']};_0x5ceaca[_0x2cdd('0x9')](_[_0x2cdd('0xa')]({'app':_0x2cdd('0xb'),'appdata':util['format']('CDR(type)=%s',_0x2cdd('0xc')),'priority':_0x37512a++},_0x2738d6));if(_0x5b038f[_0x2cdd('0xd')]){_0x5ceaca[_0x2cdd('0x9')](_[_0x2cdd('0xa')]({'app':'MixMonitor','appdata':util['format'](_0x2cdd('0xe'),_0x5b038f['recordingFormat']),'priority':_0x37512a++},_0x2738d6));}if(_0x5b038f[_0x2cdd('0xf')]){_0x5ceaca[_0x2cdd('0x9')](_[_0x2cdd('0xa')]({'app':_0x2cdd('0x10'),'appdata':_0x5b038f[_0x2cdd('0x11')],'priority':_0x37512a++},_0x2738d6));}_0x5ceaca[_0x2cdd('0x9')](_[_0x2cdd('0xa')]({'app':_0x2cdd('0x12'),'appdata':util[_0x2cdd('0x5')](_0x2cdd('0x13'),_0x1b37f3[_0x2cdd('0x14')],_0x5b038f[_0x2cdd('0x15')]?_0x5b038f[_0x2cdd('0x15')]['join'](''):''),'priority':_0x37512a++},_0x2738d6));if(_0x5b038f[_0x2cdd('0xd')]){_0x5ceaca['push'](_[_0x2cdd('0xa')]({'app':_0x2cdd('0x16'),'priority':_0x37512a++},_0x2738d6));}return _0x5ceaca;};var getChanSpyApplications=function(_0x2321d8,_0x35a5ff){var _0x19bbae=[];for(var _0x7ae468=0x0,_0x25e3c0=0x1;_0x7ae468<_0x35a5ff[_0x2cdd('0x17')];_0x7ae468++,_0x25e3c0=0x1){_0x19bbae=_0x19bbae[_0x2cdd('0x18')](getUserApplications(_0x2321d8,_0x35a5ff[_0x7ae468],_0x35a5ff[_0x7ae468][_0x2cdd('0x19')]));if(_0x35a5ff[_0x7ae468]['internal']!=_0x35a5ff[_0x7ae468][_0x2cdd('0x14')]){_0x19bbae=_0x19bbae[_0x2cdd('0x18')](getUserApplications(_0x2321d8,_0x35a5ff[_0x7ae468],_0x35a5ff[_0x7ae468][_0x2cdd('0x14')]));}}return _0x19bbae;};var getChanSpyPromise=function(_0xb661ed,_0x16cef1){return new BPromise(function(_0x28bcd5,_0xaac9be){return _0xb661ed['User'][_0x2cdd('0x1a')]({'attributes':['id',_0x2cdd('0x14'),'internal'],'where':{'role':_0x2cdd('0x1b'),'chanspy':!![]},'raw':!![]})[_0x2cdd('0x1c')](function(_0x54061a){if(_0x54061a){return _0x28bcd5(getChanSpyApplications(_0x16cef1,_0x54061a));}return _0x28bcd5([]);})[_0x2cdd('0x1d')](function(_0x4a5370){_0xaac9be(_0x4a5370);});});};module[_0x2cdd('0x1e')]=function(_0x29f6f9,_0x4be912){var _0x386387=_0x29f6f9[_0x2cdd('0x1f')];return _0x29f6f9[_0x2cdd('0x20')](_0x2cdd('0x21'),attributes,{'tableName':_0x2cdd('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x61bd27,_0x12648d,_0x38e90f){return getChanSpyPromise(_0x386387,_0x61bd27)['then'](function(_0x16b1d4){if(_0x16b1d4&&_0x16b1d4[_0x2cdd('0x17')]){return _0x386387[_0x2cdd('0x23')][_0x2cdd('0x24')](_0x16b1d4);}})[_0x2cdd('0x1c')](function(){_0x38e90f();})[_0x2cdd('0x1d')](function(_0x5d8b47){_0x38e90f(_0x5d8b47);});},'afterUpdate':function(_0x170488,_0xc62821,_0x16552f){return _0x386387[_0x2cdd('0x23')][_0x2cdd('0x25')]({'where':{'ChanSpyId':_0x170488['id']}})['then'](function(){return getChanSpyPromise(_0x386387,_0x170488);})[_0x2cdd('0x1c')](function(_0x2f9827){if(_0x2f9827&&_0x2f9827[_0x2cdd('0x17')]){return _0x386387[_0x2cdd('0x23')]['bulkCreate'](_0x2f9827);}})[_0x2cdd('0x1c')](function(){_0x16552f();})[_0x2cdd('0x1d')](function(_0x377082){_0x16552f(_0x377082);});},'afterDestroy':function(_0x1f357e,_0x4112f7,_0x363f19){return _0x386387[_0x2cdd('0x23')]['destroy']({'where':{'ChanSpyId':_0x1f357e['id']}})['then'](function(){_0x363f19();})['catch'](function(_0x371081){_0x363f19(_0x371081);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 4894c53..8a462a0 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 _0x1deb=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x1deb,0xeb));var _0xb1de=function(_0x3547af,_0x1e4445){_0x3547af=_0x3547af-0x0;var _0x52de78=_0x1deb[_0x3547af];return _0x52de78;};'use strict';var _=require(_0xb1de('0x0'));var util=require(_0xb1de('0x1'));var moment=require(_0xb1de('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1de('0x3'));var fs=require('fs');var Redis=require(_0xb1de('0x4'));var db=require(_0xb1de('0x5'))['db'];var utils=require(_0xb1de('0x6'));var logger=require(_0xb1de('0x7'))(_0xb1de('0x8'));var config=require(_0xb1de('0x9'));var jayson=require(_0xb1de('0xa'));var client=jayson[_0xb1de('0xb')][_0xb1de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcbf39c,_0x3a37cf,_0x4ff7cc){return new BPromise(function(_0x42a73f,_0x274f4){return client['request'](_0xcbf39c,_0x4ff7cc)[_0xb1de('0xd')](function(_0x1fb1a4){logger[_0xb1de('0xe')](_0xb1de('0xf'),_0x3a37cf,'request\x20sent');logger[_0xb1de('0x10')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x3a37cf,_0xb1de('0x11'),JSON[_0xb1de('0x12')](_0x1fb1a4));if(_0x1fb1a4[_0xb1de('0x13')]){if(_0x1fb1a4['error']['code']===0x1f4){logger[_0xb1de('0x13')](_0xb1de('0xf'),_0x3a37cf,_0x1fb1a4[_0xb1de('0x13')][_0xb1de('0x14')]);return _0x274f4(_0x1fb1a4[_0xb1de('0x13')]['message']);}logger['error'](_0xb1de('0xf'),_0x3a37cf,_0x1fb1a4['error']['message']);return _0x42a73f(_0x1fb1a4[_0xb1de('0x13')][_0xb1de('0x14')]);}else{logger[_0xb1de('0xe')](_0xb1de('0xf'),_0x3a37cf,_0xb1de('0x11'));_0x42a73f(_0x1fb1a4[_0xb1de('0x15')]['message']);}})[_0xb1de('0x16')](function(_0x3a1e2c){logger['error'](_0xb1de('0xf'),_0x3a37cf,_0x3a1e2c);_0x274f4(_0x3a1e2c);});});} \ No newline at end of file +var _0x2b2a=['rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4b5266,_0xb3e42f){var _0x51da62=function(_0x5b6e09){while(--_0x5b6e09){_0x4b5266['push'](_0x4b5266['shift']());}};_0x51da62(++_0xb3e42f);}(_0x2b2a,0xdd));var _0xa2b2=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x2b2a[_0x43b584];return _0x48f27b;};'use strict';var _=require(_0xa2b2('0x0'));var util=require(_0xa2b2('0x1'));var moment=require(_0xa2b2('0x2'));var BPromise=require(_0xa2b2('0x3'));var rs=require(_0xa2b2('0x4'));var fs=require('fs');var Redis=require(_0xa2b2('0x5'));var db=require(_0xa2b2('0x6'))['db'];var utils=require(_0xa2b2('0x7'));var logger=require(_0xa2b2('0x8'))(_0xa2b2('0x9'));var config=require(_0xa2b2('0xa'));var jayson=require(_0xa2b2('0xb'));var client=jayson['client'][_0xa2b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x237b90,_0x4f267e,_0x36031a){return new BPromise(function(_0x461358,_0x185a97){return client[_0xa2b2('0xd')](_0x237b90,_0x36031a)[_0xa2b2('0xe')](function(_0x51d42d){logger[_0xa2b2('0xf')](_0xa2b2('0x10'),_0x4f267e,'request\x20sent');logger[_0xa2b2('0x11')](_0xa2b2('0x12'),_0x4f267e,_0xa2b2('0x13'),JSON[_0xa2b2('0x14')](_0x51d42d));if(_0x51d42d[_0xa2b2('0x15')]){if(_0x51d42d[_0xa2b2('0x15')]['code']===0x1f4){logger[_0xa2b2('0x15')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f267e,_0x51d42d[_0xa2b2('0x15')]['message']);return _0x185a97(_0x51d42d[_0xa2b2('0x15')]['message']);}logger['error'](_0xa2b2('0x10'),_0x4f267e,_0x51d42d[_0xa2b2('0x15')][_0xa2b2('0x16')]);return _0x461358(_0x51d42d['error'][_0xa2b2('0x16')]);}else{logger[_0xa2b2('0xf')](_0xa2b2('0x10'),_0x4f267e,_0xa2b2('0x13'));_0x461358(_0x51d42d['result'][_0xa2b2('0x16')]);}})['catch'](function(_0x4fcf67){logger[_0xa2b2('0x15')](_0xa2b2('0x10'),_0x4f267e,_0x4fcf67);_0x185a97(_0x4fcf67);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index d444159..8a9e094 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 _0x4976=['create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4976,0x110));var _0x6497=function(_0xb0fb2e,_0x191466){_0xb0fb2e=_0xb0fb2e-0x0;var _0x3c90a4=_0x4976[_0xb0fb2e];return _0x3c90a4;};'use strict';var multer=require('multer');var util=require(_0x6497('0x0'));var path=require(_0x6497('0x1'));var timeout=require('connect-timeout');var express=require(_0x6497('0x2'));var router=express[_0x6497('0x3')]();var auth=require(_0x6497('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6497('0x5'));var controller=require(_0x6497('0x6'));router[_0x6497('0x7')]('/',auth[_0x6497('0x8')](),controller[_0x6497('0x9')]);router['get'](_0x6497('0xa'),auth[_0x6497('0x8')](),controller[_0x6497('0xb')]);router[_0x6497('0xc')]('/',auth[_0x6497('0x8')](),controller[_0x6497('0xd')]);router[_0x6497('0xe')](_0x6497('0xa'),auth['isAuthenticated'](),controller[_0x6497('0xf')]);router[_0x6497('0x10')](_0x6497('0xa'),auth[_0x6497('0x8')](),controller[_0x6497('0x11')]);module[_0x6497('0x12')]=router; \ No newline at end of file +var _0x9a8c=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','/:id','update','delete'];(function(_0x20d254,_0xed3703){var _0x383069=function(_0x441fa4){while(--_0x441fa4){_0x20d254['push'](_0x20d254['shift']());}};_0x383069(++_0xed3703);}(_0x9a8c,0x80));var _0xc9a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a8c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc9a8('0x0'));var util=require(_0xc9a8('0x1'));var path=require('path');var timeout=require(_0xc9a8('0x2'));var express=require('express');var router=express[_0xc9a8('0x3')]();var auth=require(_0xc9a8('0x4'));var interaction=require(_0xc9a8('0x5'));var config=require(_0xc9a8('0x6'));var controller=require('./voiceContext.controller');router[_0xc9a8('0x7')]('/',auth[_0xc9a8('0x8')](),controller[_0xc9a8('0x9')]);router['get']('/:id',auth[_0xc9a8('0x8')](),controller[_0xc9a8('0xa')]);router[_0xc9a8('0xb')]('/',auth[_0xc9a8('0x8')](),controller[_0xc9a8('0xc')]);router['put'](_0xc9a8('0xd'),auth[_0xc9a8('0x8')](),controller[_0xc9a8('0xe')]);router[_0xc9a8('0xf')]('/:id',auth[_0xc9a8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 8481953..9a521bf 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(_0x5b9f15,_0x16270b){var _0x49ceab=function(_0x132808){while(--_0x132808){_0x5b9f15['push'](_0x5b9f15['shift']());}};_0x49ceab(++_0x16270b);}(_0x34e8,0x12c));var _0x834e=function(_0x2165e6,_0x149f89){_0x2165e6=_0x2165e6-0x0;var _0x4ec5af=_0x34e8[_0x2165e6];return _0x4ec5af;};'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(_0x6ea8a2,_0x561d6c){var _0x4fe938=function(_0x1efa6c){while(--_0x1efa6c){_0x6ea8a2['push'](_0x6ea8a2['shift']());}};_0x4fe938(++_0x561d6c);}(_0x3e74,0x175));var _0x43e7=function(_0x3c46dc,_0x1e81e5){_0x3c46dc=_0x3c46dc-0x0;var _0x5da97e=_0x3e74[_0x3c46dc];return _0x5da97e;};'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 399a428..8d87e29 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 _0x3e74=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\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','get','Contexts','UserProfileResource','destroy','stack','name','send','map','VoiceContext','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','includeAll','findAll','show','params','include','find','create','join','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','readFileSync','server/files/templates/context.ejs','chan_sip.so','render','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'];(function(_0x37f1b9,_0x4d667d){var _0x3efb87=function(_0x517bcb){while(--_0x517bcb){_0x37f1b9['push'](_0x37f1b9['shift']());}};_0x3efb87(++_0x4d667d);}(_0x3e74,0x175));var _0x43e7=function(_0x23f2ea,_0x4e8a98){_0x23f2ea=_0x23f2ea-0x0;var _0x177d54=_0x3e74[_0x23f2ea];return _0x177d54;};'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')]('VoiceContext,\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(){var _0x5e203f=_0x3f280d[_0x43e7('0x31')]({'plain':!![]});var _0xbe6e28=_0x43e7('0x32');return db[_0x43e7('0x33')][_0x43e7('0x34')]({'where':{'type':_0xbe6e28,'resourceId':_0x5e203f['id']}})[_0x43e7('0x1a')](function(){return _0x3f280d;});})['then'](function(){_0x49b83d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e5b2,_0x4e8e86){return function(_0x564f0e){if(!_0x564f0e){_0x59e5b2['sendStatus'](0x194);}return _0x564f0e;};}function handleError(_0x14d888,_0x49cda6){_0x49cda6=_0x49cda6||0x1f4;return function(_0x2b4bfd){logger[_0x43e7('0x20')](_0x2b4bfd[_0x43e7('0x35')]);if(_0x2b4bfd[_0x43e7('0x36')]){delete _0x2b4bfd[_0x43e7('0x36')];}_0x14d888[_0x43e7('0x26')](_0x49cda6)[_0x43e7('0x37')](_0x2b4bfd);};}exports['index']=function(_0x5332d9,_0x5d84f4){var _0xfa0474={},_0xfe70e9={},_0x199ff6={'count':0x0,'rows':[]};var _0x16cdba=_[_0x43e7('0x38')](db[_0x43e7('0x39')][_0x43e7('0x3a')],function(_0x2ffd43){return{'name':_0x2ffd43['fieldName'],'type':_0x2ffd43[_0x43e7('0x3b')][_0x43e7('0x3c')]};});_0xfe70e9['model']=_[_0x43e7('0x38')](_0x16cdba,'name');_0xfe70e9[_0x43e7('0x3d')]=_[_0x43e7('0x3e')](_0x5332d9[_0x43e7('0x3d')]);_0xfe70e9[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfe70e9[_0x43e7('0x41')],_0xfe70e9['query']);_0xfa0474['attributes']=_[_0x43e7('0x40')](_0xfe70e9[_0x43e7('0x41')],qs[_0x43e7('0x42')](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x42')]));_0xfa0474['attributes']=_0xfa0474[_0x43e7('0x43')][_0x43e7('0x44')]?_0xfa0474['attributes']:_0xfe70e9[_0x43e7('0x41')];if(!_0x5332d9['query'][_0x43e7('0x45')]('nolimit')){_0xfa0474[_0x43e7('0x2a')]=qs[_0x43e7('0x2a')](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x2a')]);_0xfa0474['offset']=qs['offset'](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x29')]);}_0xfa0474[_0x43e7('0x46')]=qs[_0x43e7('0x47')](_0x5332d9['query']['sort']);_0xfa0474['where']=qs[_0x43e7('0x3f')](_['pick'](_0x5332d9[_0x43e7('0x3d')],_0xfe70e9['filters']),_0x16cdba);if(_0x5332d9['query'][_0x43e7('0x48')]){_0xfa0474['where']=_[_0x43e7('0x49')](_0xfa0474[_0x43e7('0x4a')],{'$or':_[_0x43e7('0x38')](_0x16cdba,function(_0x99b9e1){if(_0x99b9e1['type']!==_0x43e7('0x4b')){var _0x2b9046={};_0x2b9046[_0x99b9e1[_0x43e7('0x36')]]={'$like':'%'+_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x48')]+'%'};return _0x2b9046;}})});}_0xfa0474=_[_0x43e7('0x49')]({},_0xfa0474,_0x5332d9['options']);var _0x4930a2={'where':_0xfa0474[_0x43e7('0x4a')]};return db[_0x43e7('0x39')][_0x43e7('0x28')](_0x4930a2)['then'](function(_0x5c1c18){_0x199ff6['count']=_0x5c1c18;if(_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x4c')]){_0xfa0474['include']=[{'all':!![]}];}return db[_0x43e7('0x39')][_0x43e7('0x4d')](_0xfa0474);})[_0x43e7('0x1a')](function(_0x560329){_0x199ff6['rows']=_0x560329;return _0x199ff6;})['then'](respondWithFilteredResult(_0x5d84f4,_0xfa0474))['catch'](handleError(_0x5d84f4,null));};exports[_0x43e7('0x4e')]=function(_0xe955fc,_0x52fea5){var _0x23e7cb={'raw':![],'where':{'id':_0xe955fc[_0x43e7('0x4f')]['id']}},_0x82d32f={};_0x82d32f[_0x43e7('0x41')]=_['keys'](db[_0x43e7('0x39')]['rawAttributes']);_0x82d32f['query']=_[_0x43e7('0x3e')](_0xe955fc[_0x43e7('0x3d')]);_0x82d32f[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x82d32f[_0x43e7('0x41')],_0x82d32f[_0x43e7('0x3d')]);_0x23e7cb[_0x43e7('0x43')]=_[_0x43e7('0x40')](_0x82d32f[_0x43e7('0x41')],qs[_0x43e7('0x42')](_0xe955fc['query'][_0x43e7('0x42')]));_0x23e7cb[_0x43e7('0x43')]=_0x23e7cb['attributes'][_0x43e7('0x44')]?_0x23e7cb['attributes']:_0x82d32f[_0x43e7('0x41')];if(_0xe955fc[_0x43e7('0x3d')][_0x43e7('0x4c')]){_0x23e7cb[_0x43e7('0x50')]=[{'all':!![]}];}_0x23e7cb=_[_0x43e7('0x49')]({},_0x23e7cb,_0xe955fc['options']);return db['VoiceContext'][_0x43e7('0x51')](_0x23e7cb)[_0x43e7('0x1a')](handleEntityNotFound(_0x52fea5,null))[_0x43e7('0x1a')](respondWithResult(_0x52fea5,null))[_0x43e7('0x24')](handleError(_0x52fea5,null));};exports[_0x43e7('0x52')]=function(_0x25bb44,_0xa47464,_0x44f8a0){var _0x26d86c;return db[_0x43e7('0x39')][_0x43e7('0x52')](_0x25bb44['body'],{'raw':!![]})[_0x43e7('0x1a')](function(_0x2da2f3){_0x26d86c=_0x2da2f3;return db['VoiceContext'][_0x43e7('0x4d')]({'raw':!![]});})[_0x43e7('0x1a')](function(_0x2d0052){var _0x558d54=fs['readFileSync'](path[_0x43e7('0x53')](config[_0x43e7('0x54')],'server/files/templates/context.ejs'),_0x43e7('0x55'));var _0x54506d=ejs['render'](_0x558d54,{'contexts':_0x2d0052||[]});fs[_0x43e7('0x56')](_0x43e7('0x57'),_0x54506d);})[_0x43e7('0x1a')](function(){return respondWithRpcPromise(_0x43e7('0x58'),_0x43e7('0x52'),{'module':'chan_sip.so'});})[_0x43e7('0x1a')](function(){var _0xdb9fbe=_0x25bb44['user'][_0x43e7('0x31')]({'plain':!![]});if(!_0xdb9fbe)throw new Error(_0x43e7('0x59'));if(_0xdb9fbe[_0x43e7('0x5a')]==='user'){var _0x5a4c95=_0x26d86c['get']({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x51')]({'where':{'name':_0x43e7('0x32'),'userProfileId':_0xdb9fbe[_0x43e7('0x5c')]},'raw':!![]})['then'](function(_0x5a50fc){if(_0x5a50fc&&_0x5a50fc[_0x43e7('0x5d')]===0x0){return db[_0x43e7('0x33')][_0x43e7('0x52')]({'name':_0x5a4c95[_0x43e7('0x36')],'resourceId':_0x5a4c95['id'],'type':_0x5a50fc['name'],'sectionId':_0x5a50fc['id']},{})[_0x43e7('0x1a')](function(){return _0x26d86c;});}else{return _0x26d86c;}})[_0x43e7('0x24')](function(_0x23595c){logger[_0x43e7('0x20')](_0x43e7('0x5e'),_0x23595c);throw _0x23595c;});}return _0x26d86c;})[_0x43e7('0x1a')](respondWithResult(_0xa47464,0xc9))[_0x43e7('0x24')](handleError(_0xa47464,null));};exports[_0x43e7('0x30')]=function(_0x406155,_0x381208,_0x252f00){var _0x57fdfe;return db['VoiceContext'][_0x43e7('0x51')]({'where':{'id':_0x406155['params']['id']}})['then'](handleEntityNotFound(_0x381208,null))['then'](saveUpdates(_0x406155[_0x43e7('0x5f')],null))[_0x43e7('0x1a')](function(_0x5d7b37){if(_0x5d7b37){_0x57fdfe=_0x5d7b37;return db[_0x43e7('0x39')][_0x43e7('0x4d')]({'raw':!![]});}})[_0x43e7('0x1a')](function(_0x537a53){var _0x2b7406=fs[_0x43e7('0x60')](path[_0x43e7('0x53')](config[_0x43e7('0x54')],_0x43e7('0x61')),_0x43e7('0x55'));var _0x1e02fa=ejs['render'](_0x2b7406,{'contexts':_0x537a53||[]});fs[_0x43e7('0x56')](_0x43e7('0x57'),_0x1e02fa);})[_0x43e7('0x1a')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x43e7('0x62')});})['then'](function(){return _0x57fdfe;})['then'](respondWithResult(_0x381208,null))[_0x43e7('0x24')](handleError(_0x381208,null));};exports[_0x43e7('0x34')]=function(_0x5b5833,_0x88c7f,_0x28b21d){var _0x1e2fed;return db[_0x43e7('0x39')][_0x43e7('0x51')]({'where':{'id':_0x5b5833[_0x43e7('0x4f')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x88c7f,null))['then'](removeEntity(_0x88c7f,null))[_0x43e7('0x1a')](function(){return db[_0x43e7('0x39')]['findAll']({'raw':!![]});})[_0x43e7('0x1a')](function(_0x5c2c5f){var _0x26ee52=fs[_0x43e7('0x60')](path[_0x43e7('0x53')](config[_0x43e7('0x54')],'server/files/templates/context.ejs'),_0x43e7('0x55'));var _0x2646c2=ejs[_0x43e7('0x63')](_0x26ee52,{'contexts':_0x5c2c5f});fs['writeFileSync'](_0x43e7('0x57'),_0x2646c2);return respondWithRpcPromise(_0x43e7('0x58'),_0x43e7('0x34'),{'module':_0x43e7('0x62')});})[_0x43e7('0x24')](handleError(_0x88c7f,null));}; \ No newline at end of file +var _0x7217=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','get','Contexts','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceContext','includeAll','include','findAll','show','params','length','options','find','create','body','join','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','role','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','root','server/files/templates/context.ejs','utf8','chan_sip.so','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x30d87a,_0xf3a07f){var _0x48f64b=function(_0x2078b7){while(--_0x2078b7){_0x30d87a['push'](_0x30d87a['shift']());}};_0x48f64b(++_0xf3a07f);}(_0x7217,0x19e));var _0x7721=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x7217[_0x1b828b];return _0x98da1a;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var db=require(_0x7721('0x1a'))['db'];var jayson=require(_0x7721('0x1b'));var client=jayson['client'][_0x7721('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x199930,_0x57ff6d,_0x109900){if(_0x109900){var _0x30da54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30da54[_0x7721('0x1d')](_0x57ff6d)){return _0x199930;}else{throw new db[(_0x7721('0x1e'))]['ValidationError'](_0x7721('0x1f'));}}else{return _0x199930;}}function respondWithRpcPromise(_0x25b1c0,_0x534f1b,_0x4e199a,_0x4b183e){return new BPromise(function(_0x5ed54,_0x25a628){var _0x3cc909=_0x4b183e||client;return _0x3cc909[_0x7721('0x20')](_0x25b1c0,_0x4e199a)['then'](function(_0x20f669){logger['info'](_0x7721('0x21'),_0x534f1b,'request\x20sent');logger[_0x7721('0x22')](_0x7721('0x23'),_0x534f1b,_0x7721('0x24'),JSON[_0x7721('0x25')](_0x20f669));if(_0x20f669[_0x7721('0x26')]){if(_0x20f669[_0x7721('0x26')][_0x7721('0x27')]===0x1f4){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669[_0x7721('0x26')]['message']);return _0x25a628(_0x20f669[_0x7721('0x26')][_0x7721('0x28')]);}logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669['error'][_0x7721('0x28')]);return _0x5ed54(_0x20f669['error'][_0x7721('0x28')]);}else{logger[_0x7721('0x29')](_0x7721('0x21'),_0x534f1b,_0x7721('0x24'));_0x5ed54(_0x20f669[_0x7721('0x2a')][_0x7721('0x28')]);}})[_0x7721('0x2b')](function(_0x5b4d74){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x5b4d74);_0x25a628(_0x5b4d74);});});}function respondWithStatusCode(_0x125564,_0x1f67c7){_0x1f67c7=_0x1f67c7||0xcc;return function(_0x40d550){if(_0x40d550){return _0x125564[_0x7721('0x2c')](_0x1f67c7);}return _0x125564[_0x7721('0x2d')](_0x1f67c7)[_0x7721('0x2e')]();};}function respondWithResult(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0xc8;return function(_0x258ddf){if(_0x258ddf){return _0x40f367['status'](_0x52316e)['json'](_0x258ddf);}};}function respondWithFilteredResult(_0x315202,_0x343c19){return function(_0x53c904){if(_0x53c904){var _0x158d98=_0x53c904[_0x7721('0x2f')],_0x1ea4d=_0x343c19['offset'],_0x37b9f0=_0x343c19[_0x7721('0x30')]+_0x343c19[_0x7721('0x31')],_0xd7d703;if(_0x37b9f0>=_0x158d98){_0x37b9f0=_0x158d98;_0xd7d703=0xc8;}else{_0xd7d703=0xce;}_0x315202['status'](_0xd7d703);return _0x315202['set'](_0x7721('0x32'),_0x1ea4d+'-'+_0x37b9f0+'/'+_0x158d98)[_0x7721('0x33')](_0x53c904);}return null;};}function patchUpdates(_0x48f329){return function(_0x46f772){try{jsonpatch[_0x7721('0x34')](_0x46f772,_0x48f329,!![]);}catch(_0x382821){return BPromise['reject'](_0x382821);}return _0x46f772[_0x7721('0x35')]();};}function saveUpdates(_0x1ff31b,_0x1492d4){return function(_0x3f15e2){if(_0x3f15e2){return _0x3f15e2[_0x7721('0x36')](_0x1ff31b)['then'](function(_0x195ffb){return _0x195ffb;});}return null;};}function removeEntity(_0x3e4e56,_0xb2386d){return function(_0x5c5b33){if(_0x5c5b33){return _0x5c5b33[_0x7721('0x37')]()[_0x7721('0x38')](function(){var _0x498654=_0x5c5b33[_0x7721('0x39')]({'plain':!![]});var _0x5ce026=_0x7721('0x3a');return db[_0x7721('0x3b')][_0x7721('0x37')]({'where':{'type':_0x5ce026,'resourceId':_0x498654['id']}})[_0x7721('0x38')](function(){return _0x5c5b33;});})[_0x7721('0x38')](function(){_0x3e4e56[_0x7721('0x2d')](0xcc)[_0x7721('0x2e')]();});}};}function handleEntityNotFound(_0x15545a,_0x25bdd9){return function(_0x3a2eb7){if(!_0x3a2eb7){_0x15545a[_0x7721('0x2c')](0x194);}return _0x3a2eb7;};}function handleError(_0x5c806d,_0xd1df68){_0xd1df68=_0xd1df68||0x1f4;return function(_0x5e6663){logger[_0x7721('0x26')](_0x5e6663[_0x7721('0x3c')]);if(_0x5e6663[_0x7721('0x3d')]){delete _0x5e6663[_0x7721('0x3d')];}_0x5c806d[_0x7721('0x2d')](_0xd1df68)[_0x7721('0x3e')](_0x5e6663);};}exports['index']=function(_0x557c34,_0x4cadef){var _0x539560={},_0x18001c={},_0x1b3f8d={'count':0x0,'rows':[]};var _0x1acc72=_[_0x7721('0x3f')](db['VoiceContext'][_0x7721('0x40')],function(_0x4cf659){return{'name':_0x4cf659[_0x7721('0x41')],'type':_0x4cf659[_0x7721('0x42')]['key']};});_0x18001c[_0x7721('0x43')]=_[_0x7721('0x3f')](_0x1acc72,'name');_0x18001c['query']=_[_0x7721('0x44')](_0x557c34[_0x7721('0x45')]);_0x18001c[_0x7721('0x46')]=_[_0x7721('0x47')](_0x18001c['model'],_0x18001c[_0x7721('0x45')]);_0x539560[_0x7721('0x48')]=_[_0x7721('0x47')](_0x18001c[_0x7721('0x43')],qs[_0x7721('0x49')](_0x557c34['query'][_0x7721('0x49')]));_0x539560['attributes']=_0x539560[_0x7721('0x48')]['length']?_0x539560[_0x7721('0x48')]:_0x18001c[_0x7721('0x43')];if(!_0x557c34[_0x7721('0x45')]['hasOwnProperty'](_0x7721('0x4a'))){_0x539560[_0x7721('0x31')]=qs[_0x7721('0x31')](_0x557c34['query'][_0x7721('0x31')]);_0x539560[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x557c34[_0x7721('0x45')][_0x7721('0x30')]);}_0x539560[_0x7721('0x4b')]=qs[_0x7721('0x4c')](_0x557c34['query']['sort']);_0x539560[_0x7721('0x4d')]=qs[_0x7721('0x46')](_[_0x7721('0x4e')](_0x557c34[_0x7721('0x45')],_0x18001c[_0x7721('0x46')]),_0x1acc72);if(_0x557c34[_0x7721('0x45')][_0x7721('0x4f')]){_0x539560[_0x7721('0x4d')]=_[_0x7721('0x50')](_0x539560[_0x7721('0x4d')],{'$or':_['map'](_0x1acc72,function(_0x578867){if(_0x578867[_0x7721('0x42')]!==_0x7721('0x51')){var _0x151f69={};_0x151f69[_0x578867[_0x7721('0x3d')]]={'$like':'%'+_0x557c34['query'][_0x7721('0x4f')]+'%'};return _0x151f69;}})});}_0x539560=_[_0x7721('0x50')]({},_0x539560,_0x557c34['options']);var _0x330fac={'where':_0x539560['where']};return db[_0x7721('0x52')]['count'](_0x330fac)[_0x7721('0x38')](function(_0x196be4){_0x1b3f8d[_0x7721('0x2f')]=_0x196be4;if(_0x557c34['query'][_0x7721('0x53')]){_0x539560[_0x7721('0x54')]=[{'all':!![]}];}return db['VoiceContext'][_0x7721('0x55')](_0x539560);})[_0x7721('0x38')](function(_0xf88e8c){_0x1b3f8d['rows']=_0xf88e8c;return _0x1b3f8d;})[_0x7721('0x38')](respondWithFilteredResult(_0x4cadef,_0x539560))['catch'](handleError(_0x4cadef,null));};exports[_0x7721('0x56')]=function(_0x310549,_0x4738ef){var _0x443503={'raw':![],'where':{'id':_0x310549[_0x7721('0x57')]['id']}},_0x1c95d8={};_0x1c95d8[_0x7721('0x43')]=_[_0x7721('0x44')](db[_0x7721('0x52')][_0x7721('0x40')]);_0x1c95d8[_0x7721('0x45')]=_[_0x7721('0x44')](_0x310549[_0x7721('0x45')]);_0x1c95d8[_0x7721('0x46')]=_[_0x7721('0x47')](_0x1c95d8['model'],_0x1c95d8[_0x7721('0x45')]);_0x443503[_0x7721('0x48')]=_[_0x7721('0x47')](_0x1c95d8[_0x7721('0x43')],qs[_0x7721('0x49')](_0x310549[_0x7721('0x45')][_0x7721('0x49')]));_0x443503['attributes']=_0x443503[_0x7721('0x48')][_0x7721('0x58')]?_0x443503[_0x7721('0x48')]:_0x1c95d8[_0x7721('0x43')];if(_0x310549[_0x7721('0x45')][_0x7721('0x53')]){_0x443503[_0x7721('0x54')]=[{'all':!![]}];}_0x443503=_[_0x7721('0x50')]({},_0x443503,_0x310549[_0x7721('0x59')]);return db[_0x7721('0x52')][_0x7721('0x5a')](_0x443503)['then'](handleEntityNotFound(_0x4738ef,null))[_0x7721('0x38')](respondWithResult(_0x4738ef,null))[_0x7721('0x2b')](handleError(_0x4738ef,null));};exports[_0x7721('0x5b')]=function(_0x2ee3c0,_0x15ed3b,_0x3e7918){var _0x41644f;return db[_0x7721('0x52')][_0x7721('0x5b')](_0x2ee3c0[_0x7721('0x5c')],{'raw':!![]})[_0x7721('0x38')](function(_0x2e5c28){_0x41644f=_0x2e5c28;return db[_0x7721('0x52')][_0x7721('0x55')]({'raw':!![]});})[_0x7721('0x38')](function(_0x577f47){var _0x50e9e9=fs['readFileSync'](path[_0x7721('0x5d')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x5d7036=ejs[_0x7721('0x5e')](_0x50e9e9,{'contexts':_0x577f47||[]});fs[_0x7721('0x5f')](_0x7721('0x60'),_0x5d7036);})['then'](function(){return respondWithRpcPromise(_0x7721('0x61'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x24d1dc=_0x2ee3c0['user']['get']({'plain':!![]});if(!_0x24d1dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24d1dc[_0x7721('0x62')]===_0x7721('0x63')){var _0x1ff090=_0x41644f['get']({'plain':!![]});return db[_0x7721('0x64')][_0x7721('0x5a')]({'where':{'name':_0x7721('0x3a'),'userProfileId':_0x24d1dc[_0x7721('0x65')]},'raw':!![]})[_0x7721('0x38')](function(_0x16e80b){if(_0x16e80b&&_0x16e80b[_0x7721('0x66')]===0x0){return db[_0x7721('0x3b')][_0x7721('0x5b')]({'name':_0x1ff090[_0x7721('0x3d')],'resourceId':_0x1ff090['id'],'type':_0x16e80b[_0x7721('0x3d')],'sectionId':_0x16e80b['id']},{})[_0x7721('0x38')](function(){return _0x41644f;});}else{return _0x41644f;}})[_0x7721('0x2b')](function(_0x211d27){logger[_0x7721('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211d27);throw _0x211d27;});}return _0x41644f;})[_0x7721('0x38')](respondWithResult(_0x15ed3b,0xc9))[_0x7721('0x2b')](handleError(_0x15ed3b,null));};exports[_0x7721('0x36')]=function(_0xb6db23,_0x542e30,_0x103009){var _0x104f05;return db['VoiceContext'][_0x7721('0x5a')]({'where':{'id':_0xb6db23['params']['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x542e30,null))[_0x7721('0x38')](saveUpdates(_0xb6db23[_0x7721('0x5c')],null))[_0x7721('0x38')](function(_0x3d2b7d){if(_0x3d2b7d){_0x104f05=_0x3d2b7d;return db[_0x7721('0x52')][_0x7721('0x55')]({'raw':!![]});}})[_0x7721('0x38')](function(_0x4727b0){var _0x57759a=fs[_0x7721('0x67')](path[_0x7721('0x5d')](config[_0x7721('0x68')],_0x7721('0x69')),_0x7721('0x6a'));var _0x3ed425=ejs[_0x7721('0x5e')](_0x57759a,{'contexts':_0x4727b0||[]});fs['writeFileSync'](_0x7721('0x60'),_0x3ed425);})[_0x7721('0x38')](function(){return respondWithRpcPromise('Reload',_0x7721('0x36'),{'module':'chan_sip.so'});})[_0x7721('0x38')](function(){return _0x104f05;})[_0x7721('0x38')](respondWithResult(_0x542e30,null))[_0x7721('0x2b')](handleError(_0x542e30,null));};exports[_0x7721('0x37')]=function(_0x1e2436,_0x2bab14,_0x258c57){var _0x5dca04;return db[_0x7721('0x52')][_0x7721('0x5a')]({'where':{'id':_0x1e2436[_0x7721('0x57')]['id']}})['then'](handleEntityNotFound(_0x2bab14,null))['then'](removeEntity(_0x2bab14,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x7721('0x38')](function(_0x2645dd){var _0x580473=fs[_0x7721('0x67')](path[_0x7721('0x5d')](config[_0x7721('0x68')],_0x7721('0x69')),'utf8');var _0x275b25=ejs[_0x7721('0x5e')](_0x580473,{'contexts':_0x2645dd});fs[_0x7721('0x5f')](_0x7721('0x60'),_0x275b25);return respondWithRpcPromise(_0x7721('0x61'),'destroy',{'module':_0x7721('0x6b')});})[_0x7721('0x2b')](handleError(_0x2bab14,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 3eb714a..69eb195 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 _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 5477270..591b7f8 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 _0x6de8=['rpc','../../config/environment','jayson/promise','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1f12cf,_0x5aef63){var _0x26227a=function(_0x3110ef){while(--_0x3110ef){_0x1f12cf['push'](_0x1f12cf['shift']());}};_0x26227a(++_0x5aef63);}(_0x6de8,0x126));var _0x86de=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0x6de8[_0x3a607e];return _0x37b106;};'use strict';var _=require('lodash');var util=require(_0x86de('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x86de('0x1'));var fs=require('fs');var Redis=require(_0x86de('0x2'));var db=require(_0x86de('0x3'))['db'];var utils=require(_0x86de('0x4'));var logger=require(_0x86de('0x5'))(_0x86de('0x6'));var config=require(_0x86de('0x7'));var jayson=require(_0x86de('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4663c9,_0x54eb9d,_0x5039b3){return new BPromise(function(_0x131456,_0x53862f){return client[_0x86de('0x9')](_0x4663c9,_0x5039b3)[_0x86de('0xa')](function(_0x3cc2dd){logger['info'](_0x86de('0xb'),_0x54eb9d,'request\x20sent');logger[_0x86de('0xc')](_0x86de('0xd'),_0x54eb9d,_0x86de('0xe'),JSON[_0x86de('0xf')](_0x3cc2dd));if(_0x3cc2dd[_0x86de('0x10')]){if(_0x3cc2dd[_0x86de('0x10')]['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x54eb9d,_0x3cc2dd[_0x86de('0x10')][_0x86de('0x11')]);return _0x53862f(_0x3cc2dd['error'][_0x86de('0x11')]);}logger[_0x86de('0x10')](_0x86de('0xb'),_0x54eb9d,_0x3cc2dd[_0x86de('0x10')][_0x86de('0x11')]);return _0x131456(_0x3cc2dd[_0x86de('0x10')]['message']);}else{logger['info'](_0x86de('0xb'),_0x54eb9d,_0x86de('0xe'));_0x131456(_0x3cc2dd[_0x86de('0x12')][_0x86de('0x11')]);}})[_0x86de('0x13')](function(_0x8c04b1){logger['error'](_0x86de('0xb'),_0x54eb9d,_0x8c04b1);_0x53862f(_0x8c04b1);});});} \ No newline at end of file +var _0x1c72=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','util','moment','bluebird'];(function(_0x49cbfe,_0x1e6a12){var _0xa22a0c=function(_0x3bab8e){while(--_0x3bab8e){_0x49cbfe['push'](_0x49cbfe['shift']());}};_0xa22a0c(++_0x1e6a12);}(_0x1c72,0x13f));var _0x21c7=function(_0x502852,_0xd575cb){_0x502852=_0x502852-0x0;var _0x5096e3=_0x1c72[_0x502852];return _0x5096e3;};'use strict';var _=require('lodash');var util=require(_0x21c7('0x0'));var moment=require(_0x21c7('0x1'));var BPromise=require(_0x21c7('0x2'));var rs=require(_0x21c7('0x3'));var fs=require('fs');var Redis=require(_0x21c7('0x4'));var db=require(_0x21c7('0x5'))['db'];var utils=require(_0x21c7('0x6'));var logger=require('../../config/logger')(_0x21c7('0x7'));var config=require(_0x21c7('0x8'));var jayson=require(_0x21c7('0x9'));var client=jayson[_0x21c7('0xa')][_0x21c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa36eb4,_0x5677a3,_0x313a85){return new BPromise(function(_0x1ada36,_0x40ba0e){return client[_0x21c7('0xc')](_0xa36eb4,_0x313a85)[_0x21c7('0xd')](function(_0xdc00ba){logger[_0x21c7('0xe')](_0x21c7('0xf'),_0x5677a3,'request\x20sent');logger['debug'](_0x21c7('0x10'),_0x5677a3,_0x21c7('0x11'),JSON[_0x21c7('0x12')](_0xdc00ba));if(_0xdc00ba['error']){if(_0xdc00ba['error'][_0x21c7('0x13')]===0x1f4){logger['error'](_0x21c7('0xf'),_0x5677a3,_0xdc00ba[_0x21c7('0x14')][_0x21c7('0x15')]);return _0x40ba0e(_0xdc00ba[_0x21c7('0x14')]['message']);}logger[_0x21c7('0x14')](_0x21c7('0xf'),_0x5677a3,_0xdc00ba['error'][_0x21c7('0x15')]);return _0x1ada36(_0xdc00ba[_0x21c7('0x14')][_0x21c7('0x15')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x5677a3,_0x21c7('0x11'));_0x1ada36(_0xdc00ba['result'][_0x21c7('0x15')]);}})[_0x21c7('0x16')](function(_0x30a528){logger[_0x21c7('0x14')](_0x21c7('0xf'),_0x5677a3,_0x30a528);_0x40ba0e(_0x30a528);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c83d6f9..fadcd61 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 _0x6caf=['exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0xa115c0,_0x50ce1b){var _0x4bc842=function(_0x348250){while(--_0x348250){_0xa115c0['push'](_0xa115c0['shift']());}};_0x4bc842(++_0x50ce1b);}(_0x6caf,0x17d));var _0xf6ca=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0x6caf[_0x18abd2];return _0x1dcad6;};'use strict';var multer=require(_0xf6ca('0x0'));var util=require(_0xf6ca('0x1'));var path=require('path');var timeout=require(_0xf6ca('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf6ca('0x3'));var interaction=require(_0xf6ca('0x4'));var config=require(_0xf6ca('0x5'));var controller=require(_0xf6ca('0x6'));router[_0xf6ca('0x7')]('/',auth[_0xf6ca('0x8')](),controller[_0xf6ca('0x9')]);router[_0xf6ca('0x7')]('/describe',auth[_0xf6ca('0x8')](),controller[_0xf6ca('0xa')]);router['get'](_0xf6ca('0xb'),auth[_0xf6ca('0x8')](),controller[_0xf6ca('0xc')]);router[_0xf6ca('0xd')]('/',auth['isAuthenticated'](),controller[_0xf6ca('0xe')]);router[_0xf6ca('0xf')](_0xf6ca('0xb'),auth['isAuthenticated'](),controller[_0xf6ca('0x10')]);router[_0xf6ca('0x11')](_0xf6ca('0xb'),auth[_0xf6ca('0x8')](),controller['destroy']);module[_0xf6ca('0x12')]=router; \ No newline at end of file +var _0xd7d6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy','exports','multer','path','connect-timeout'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xd7d6,0x1cb));var _0x6d7d=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0xd7d6[_0x36c6eb];return _0x30675b;};'use strict';var multer=require(_0x6d7d('0x0'));var util=require('util');var path=require(_0x6d7d('0x1'));var timeout=require(_0x6d7d('0x2'));var express=require(_0x6d7d('0x3'));var router=express[_0x6d7d('0x4')]();var auth=require(_0x6d7d('0x5'));var interaction=require(_0x6d7d('0x6'));var config=require(_0x6d7d('0x7'));var controller=require(_0x6d7d('0x8'));router[_0x6d7d('0x9')]('/',auth[_0x6d7d('0xa')](),controller[_0x6d7d('0xb')]);router[_0x6d7d('0x9')](_0x6d7d('0xc'),auth[_0x6d7d('0xa')](),controller[_0x6d7d('0xd')]);router[_0x6d7d('0x9')](_0x6d7d('0xe'),auth[_0x6d7d('0xa')](),controller[_0x6d7d('0xf')]);router[_0x6d7d('0x10')]('/',auth[_0x6d7d('0xa')](),controller[_0x6d7d('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6d7d('0x12')]);router['delete']('/:id',auth[_0x6d7d('0xa')](),controller[_0x6d7d('0x13')]);module[_0x6d7d('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7de4aac..8992151 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 _0x8ae5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x3cf1dc,_0x1d3274){var _0xb97c58=function(_0x1460d7){while(--_0x1460d7){_0x3cf1dc['push'](_0x3cf1dc['shift']());}};_0xb97c58(++_0x1d3274);}(_0x8ae5,0x73));var _0x58ae=function(_0x457501,_0x9eacca){_0x457501=_0x457501-0x0;var _0x47ab95=_0x8ae5[_0x457501];return _0x47ab95;};'use strict';var Sequelize=require(_0x58ae('0x0'));module[_0x58ae('0x1')]={'privilege':{'type':Sequelize[_0x58ae('0x2')]},'channel':{'type':Sequelize[_0x58ae('0x2')]},'channelstate':{'type':Sequelize[_0x58ae('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x58ae('0x2')]},'connectedlinenum':{'type':Sequelize[_0x58ae('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x58ae('0x2')]},'accountcode':{'type':Sequelize[_0x58ae('0x2')]},'context':{'type':Sequelize[_0x58ae('0x2')]},'exten':{'type':Sequelize[_0x58ae('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x58ae('0x2')]},'linkedid':{'type':Sequelize[_0x58ae('0x2')]},'destchannel':{'type':Sequelize[_0x58ae('0x2')]},'destchannelstate':{'type':Sequelize[_0x58ae('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x58ae('0x2')]},'destcalleridnum':{'type':Sequelize[_0x58ae('0x2')]},'destcalleridname':{'type':Sequelize[_0x58ae('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x58ae('0x2')]},'destlanguage':{'type':Sequelize[_0x58ae('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x58ae('0x2')]},'destexten':{'type':Sequelize[_0x58ae('0x2')]},'destpriority':{'type':Sequelize[_0x58ae('0x3')]},'destuniqueid':{'type':Sequelize[_0x58ae('0x2')]},'destlinkedid':{'type':Sequelize[_0x58ae('0x2')]},'dialstring':{'type':Sequelize[_0x58ae('0x2')]},'dialstatus':{'type':Sequelize[_0x58ae('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x58ae('0x4')]},'endtime':{'type':Sequelize[_0x58ae('0x4')]},'lastevent':{'type':Sequelize[_0x58ae('0x2')],'comment':_0x58ae('0x5')},'routeId':{'type':Sequelize[_0x58ae('0x3')]},'duration':{'type':Sequelize[_0x58ae('0x3')]},'holdtime':{'type':Sequelize[_0x58ae('0x3')]},'billableseconds':{'type':Sequelize[_0x58ae('0x3')]}}; \ No newline at end of file +var _0x440e=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x3ef70c,_0x73d40e){var _0x36e5a8=function(_0x4020fe){while(--_0x4020fe){_0x3ef70c['push'](_0x3ef70c['shift']());}};_0x36e5a8(++_0x73d40e);}(_0x440e,0xaf));var _0xe440=function(_0x369a98,_0x32250c){_0x369a98=_0x369a98-0x0;var _0x29565c=_0x440e[_0x369a98];return _0x29565c;};'use strict';var Sequelize=require(_0xe440('0x0'));module[_0xe440('0x1')]={'privilege':{'type':Sequelize[_0xe440('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xe440('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe440('0x2')]},'calleridnum':{'type':Sequelize[_0xe440('0x2')]},'calleridname':{'type':Sequelize[_0xe440('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe440('0x2')]},'language':{'type':Sequelize[_0xe440('0x2')]},'accountcode':{'type':Sequelize[_0xe440('0x2')]},'context':{'type':Sequelize[_0xe440('0x2')]},'exten':{'type':Sequelize[_0xe440('0x2')]},'priority':{'type':Sequelize[_0xe440('0x3')]},'uniqueid':{'type':Sequelize[_0xe440('0x2')]},'linkedid':{'type':Sequelize[_0xe440('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe440('0x2')]},'destcalleridname':{'type':Sequelize[_0xe440('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe440('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe440('0x2')]},'destlanguage':{'type':Sequelize[_0xe440('0x2')]},'destaccountcode':{'type':Sequelize[_0xe440('0x2')]},'destcontext':{'type':Sequelize[_0xe440('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe440('0x3')]},'destuniqueid':{'type':Sequelize[_0xe440('0x2')]},'destlinkedid':{'type':Sequelize[_0xe440('0x2')]},'dialstring':{'type':Sequelize[_0xe440('0x2')]},'dialstatus':{'type':Sequelize[_0xe440('0x2')]},'starttime':{'type':Sequelize[_0xe440('0x4')]},'answertime':{'type':Sequelize[_0xe440('0x4')]},'endtime':{'type':Sequelize[_0xe440('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe440('0x5')},'routeId':{'type':Sequelize[_0xe440('0x3')]},'duration':{'type':Sequelize[_0xe440('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 109f8c6..57cb3d1 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 _0xec6b=['order','sort','filters','pick','filter','where','map','type','merge','options','include','findAll','catch','show','params','find','create','body','update','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','then','end','sendStatus','stack','name','index','VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x2df1f2,_0x58d388){var _0x38652b=function(_0x18e322){while(--_0x18e322){_0x2df1f2['push'](_0x2df1f2['shift']());}};_0x38652b(++_0x58d388);}(_0xec6b,0x129));var _0xbec6=function(_0x2a5241,_0x23ad00){_0x2a5241=_0x2a5241-0x0;var _0xa36a0a=_0xec6b[_0x2a5241];return _0xa36a0a;};'use strict';var pdf=require(_0xbec6('0x0'));var emlformat=require(_0xbec6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbec6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbec6('0x3'));var moment=require('moment');var BPromise=require(_0xbec6('0x4'));var Mustache=require(_0xbec6('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbec6('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbec6('0x7'));var toCsv=require(_0xbec6('0x8'));var querystring=require(_0xbec6('0x9'));var Papa=require(_0xbec6('0xa'));var Redis=require(_0xbec6('0xb'));var authService=require(_0xbec6('0xc'));var qs=require(_0xbec6('0xd'));var as=require(_0xbec6('0xe'));var hardwareService=require(_0xbec6('0xf'));var logger=require(_0xbec6('0x10'))(_0xbec6('0x11'));var utils=require(_0xbec6('0x12'));var config=require('../../config/environment');var db=require(_0xbec6('0x13'))['db'];function respondWithStatusCode(_0x4a28bf,_0x27cb5c){_0x27cb5c=_0x27cb5c||0xcc;return function(_0x204245){if(_0x204245){return _0x4a28bf['sendStatus'](_0x27cb5c);}return _0x4a28bf[_0xbec6('0x14')](_0x27cb5c)['end']();};}function respondWithResult(_0x3f0bf2,_0x5b88b4){_0x5b88b4=_0x5b88b4||0xc8;return function(_0x335972){if(_0x335972){return _0x3f0bf2['status'](_0x5b88b4)[_0xbec6('0x15')](_0x335972);}};}function respondWithFilteredResult(_0xe54bd,_0x276e74){return function(_0x169cee){if(_0x169cee){var _0x52b5f3=_0x169cee[_0xbec6('0x16')],_0x15461c=_0x276e74[_0xbec6('0x17')],_0x4b70b3=_0x276e74[_0xbec6('0x17')]+_0x276e74[_0xbec6('0x18')],_0x786c76;if(_0x4b70b3>=_0x52b5f3){_0x4b70b3=_0x52b5f3;_0x786c76=0xc8;}else{_0x786c76=0xce;}_0xe54bd['status'](_0x786c76);return _0xe54bd[_0xbec6('0x19')](_0xbec6('0x1a'),_0x15461c+'-'+_0x4b70b3+'/'+_0x52b5f3)['json'](_0x169cee);}return null;};}function patchUpdates(_0x440234){return function(_0x3853c6){try{jsonpatch[_0xbec6('0x1b')](_0x3853c6,_0x440234,!![]);}catch(_0x13ab13){return BPromise['reject'](_0x13ab13);}return _0x3853c6[_0xbec6('0x1c')]();};}function saveUpdates(_0x1b5003,_0x1ee928){return function(_0x26529c){if(_0x26529c){return _0x26529c['update'](_0x1b5003)[_0xbec6('0x1d')](function(_0x2bbf14){return _0x2bbf14;});}return null;};}function removeEntity(_0x132439,_0x5835db){return function(_0x3163c0){if(_0x3163c0){return _0x3163c0['destroy']()[_0xbec6('0x1d')](function(){_0x132439[_0xbec6('0x14')](0xcc)[_0xbec6('0x1e')]();});}};}function handleEntityNotFound(_0x404d91,_0x1d882a){return function(_0x44574e){if(!_0x44574e){_0x404d91[_0xbec6('0x1f')](0x194);}return _0x44574e;};}function handleError(_0x435f80,_0x4048ea){_0x4048ea=_0x4048ea||0x1f4;return function(_0x1adda5){logger['error'](_0x1adda5[_0xbec6('0x20')]);if(_0x1adda5[_0xbec6('0x21')]){delete _0x1adda5['name'];}_0x435f80[_0xbec6('0x14')](_0x4048ea)['send'](_0x1adda5);};}exports[_0xbec6('0x22')]=function(_0x3da858,_0x218039){var _0x3dfa27={},_0x450b5f={},_0x216ae3={'count':0x0,'rows':[]};var _0x3c92ae=_['map'](db[_0xbec6('0x23')][_0xbec6('0x24')],function(_0x3ef4da){return{'name':_0x3ef4da[_0xbec6('0x25')],'type':_0x3ef4da['type'][_0xbec6('0x26')]};});_0x450b5f[_0xbec6('0x27')]=_['map'](_0x3c92ae,_0xbec6('0x21'));_0x450b5f[_0xbec6('0x28')]=_[_0xbec6('0x29')](_0x3da858[_0xbec6('0x28')]);_0x450b5f['filters']=_[_0xbec6('0x2a')](_0x450b5f['model'],_0x450b5f[_0xbec6('0x28')]);_0x3dfa27['attributes']=_['intersection'](_0x450b5f[_0xbec6('0x27')],qs[_0xbec6('0x2b')](_0x3da858['query']['fields']));_0x3dfa27[_0xbec6('0x2c')]=_0x3dfa27[_0xbec6('0x2c')][_0xbec6('0x2d')]?_0x3dfa27[_0xbec6('0x2c')]:_0x450b5f[_0xbec6('0x27')];if(!_0x3da858['query'][_0xbec6('0x2e')](_0xbec6('0x2f'))){_0x3dfa27[_0xbec6('0x18')]=qs['limit'](_0x3da858[_0xbec6('0x28')][_0xbec6('0x18')]);_0x3dfa27[_0xbec6('0x17')]=qs[_0xbec6('0x17')](_0x3da858['query'][_0xbec6('0x17')]);}_0x3dfa27[_0xbec6('0x30')]=qs[_0xbec6('0x31')](_0x3da858[_0xbec6('0x28')][_0xbec6('0x31')]);_0x3dfa27['where']=qs[_0xbec6('0x32')](_[_0xbec6('0x33')](_0x3da858['query'],_0x450b5f[_0xbec6('0x32')]),_0x3c92ae);if(_0x3da858['query'][_0xbec6('0x34')]){_0x3dfa27[_0xbec6('0x35')]=_['merge'](_0x3dfa27[_0xbec6('0x35')],{'$or':_[_0xbec6('0x36')](_0x3c92ae,function(_0xec6e5b){if(_0xec6e5b[_0xbec6('0x37')]!=='VIRTUAL'){var _0x4b1951={};_0x4b1951[_0xec6e5b[_0xbec6('0x21')]]={'$like':'%'+_0x3da858[_0xbec6('0x28')][_0xbec6('0x34')]+'%'};return _0x4b1951;}})});}_0x3dfa27=_[_0xbec6('0x38')]({},_0x3dfa27,_0x3da858[_0xbec6('0x39')]);var _0x5addda={'where':_0x3dfa27[_0xbec6('0x35')]};return db[_0xbec6('0x23')][_0xbec6('0x16')](_0x5addda)[_0xbec6('0x1d')](function(_0x2a5224){_0x216ae3['count']=_0x2a5224;if(_0x3da858[_0xbec6('0x28')]['includeAll']){_0x3dfa27[_0xbec6('0x3a')]=[{'all':!![]}];}return db[_0xbec6('0x23')][_0xbec6('0x3b')](_0x3dfa27);})[_0xbec6('0x1d')](function(_0xb1b4a9){_0x216ae3['rows']=_0xb1b4a9;return _0x216ae3;})[_0xbec6('0x1d')](respondWithFilteredResult(_0x218039,_0x3dfa27))[_0xbec6('0x3c')](handleError(_0x218039,null));};exports[_0xbec6('0x3d')]=function(_0x1b2057,_0x3c2297){var _0x102c47={'raw':!![],'where':{'id':_0x1b2057[_0xbec6('0x3e')]['id']}},_0x4013d2={};_0x4013d2[_0xbec6('0x27')]=_[_0xbec6('0x29')](db[_0xbec6('0x23')]['rawAttributes']);_0x4013d2[_0xbec6('0x28')]=_[_0xbec6('0x29')](_0x1b2057[_0xbec6('0x28')]);_0x4013d2[_0xbec6('0x32')]=_[_0xbec6('0x2a')](_0x4013d2['model'],_0x4013d2['query']);_0x102c47['attributes']=_[_0xbec6('0x2a')](_0x4013d2['model'],qs['fields'](_0x1b2057[_0xbec6('0x28')][_0xbec6('0x2b')]));_0x102c47[_0xbec6('0x2c')]=_0x102c47[_0xbec6('0x2c')]['length']?_0x102c47[_0xbec6('0x2c')]:_0x4013d2[_0xbec6('0x27')];if(_0x1b2057['query']['includeAll']){_0x102c47['include']=[{'all':!![]}];}_0x102c47=_[_0xbec6('0x38')]({},_0x102c47,_0x1b2057[_0xbec6('0x39')]);return db[_0xbec6('0x23')][_0xbec6('0x3f')](_0x102c47)['then'](handleEntityNotFound(_0x3c2297,null))['then'](respondWithResult(_0x3c2297,null))[_0xbec6('0x3c')](handleError(_0x3c2297,null));};exports[_0xbec6('0x40')]=function(_0x20dad2,_0x5f2a5e){return db[_0xbec6('0x23')][_0xbec6('0x40')](_0x20dad2[_0xbec6('0x41')],{})['then'](respondWithResult(_0x5f2a5e,0xc9))['catch'](handleError(_0x5f2a5e,null));};exports[_0xbec6('0x42')]=function(_0x239a23,_0xebe2fe){if(_0x239a23['body']['id']){delete _0x239a23[_0xbec6('0x41')]['id'];}return db[_0xbec6('0x23')][_0xbec6('0x3f')]({'where':{'id':_0x239a23[_0xbec6('0x3e')]['id']}})[_0xbec6('0x1d')](handleEntityNotFound(_0xebe2fe,null))['then'](saveUpdates(_0x239a23['body'],null))['then'](respondWithResult(_0xebe2fe,null))['catch'](handleError(_0xebe2fe,null));};exports[_0xbec6('0x43')]=function(_0x78db93,_0x3cd36f){return db[_0xbec6('0x23')][_0xbec6('0x3f')]({'where':{'id':_0x78db93['params']['id']}})[_0xbec6('0x1d')](handleEntityNotFound(_0x3cd36f,null))[_0xbec6('0x1d')](removeEntity(_0x3cd36f,null))['catch'](handleError(_0x3cd36f,null));};exports[_0xbec6('0x44')]=function(_0x13f02b,_0x42b9e8){return db['VoiceDialReport'][_0xbec6('0x44')]()['then'](respondWithResult(_0x42b9e8,null))[_0xbec6('0x3c')](handleError(_0x42b9e8,null));}; \ No newline at end of file +var _0x7917=['send','index','map','VoiceDialReport','rawAttributes','fieldName','type','keys','query','model','intersection','fields','attributes','order','where','pick','filters','filter','VIRTUAL','name','merge','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error'];(function(_0x31e961,_0x4b5ec9){var _0x24801e=function(_0x21c750){while(--_0x21c750){_0x31e961['push'](_0x31e961['shift']());}};_0x24801e(++_0x4b5ec9);}(_0x7917,0x131));var _0x7791=function(_0x5bd3dd,_0x1f5096){_0x5bd3dd=_0x5bd3dd-0x0;var _0x8daec3=_0x7917[_0x5bd3dd];return _0x8daec3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7791('0x0'));var zipdir=require(_0x7791('0x1'));var jsonpatch=require(_0x7791('0x2'));var rp=require(_0x7791('0x3'));var moment=require(_0x7791('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7791('0x5'));var util=require(_0x7791('0x6'));var path=require(_0x7791('0x7'));var sox=require(_0x7791('0x8'));var csv=require(_0x7791('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7791('0xa'));var squel=require('squel');var crypto=require(_0x7791('0xb'));var jsforce=require(_0x7791('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7791('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7791('0xe'));var as=require(_0x7791('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7791('0x10'))(_0x7791('0x11'));var utils=require(_0x7791('0x12'));var config=require('../../config/environment');var db=require(_0x7791('0x13'))['db'];function respondWithStatusCode(_0x2c0677,_0x449d63){_0x449d63=_0x449d63||0xcc;return function(_0x1d7a35){if(_0x1d7a35){return _0x2c0677[_0x7791('0x14')](_0x449d63);}return _0x2c0677[_0x7791('0x15')](_0x449d63)[_0x7791('0x16')]();};}function respondWithResult(_0x1f601a,_0x2ecb8f){_0x2ecb8f=_0x2ecb8f||0xc8;return function(_0x6c71bc){if(_0x6c71bc){return _0x1f601a[_0x7791('0x15')](_0x2ecb8f)['json'](_0x6c71bc);}};}function respondWithFilteredResult(_0x12903e,_0x5bf3ed){return function(_0x5b23a9){if(_0x5b23a9){var _0x487a21=_0x5b23a9[_0x7791('0x17')],_0x82ec37=_0x5bf3ed['offset'],_0x129a9a=_0x5bf3ed[_0x7791('0x18')]+_0x5bf3ed[_0x7791('0x19')],_0x121033;if(_0x129a9a>=_0x487a21){_0x129a9a=_0x487a21;_0x121033=0xc8;}else{_0x121033=0xce;}_0x12903e[_0x7791('0x15')](_0x121033);return _0x12903e['set'](_0x7791('0x1a'),_0x82ec37+'-'+_0x129a9a+'/'+_0x487a21)[_0x7791('0x1b')](_0x5b23a9);}return null;};}function patchUpdates(_0x4bb5aa){return function(_0x5566b2){try{jsonpatch[_0x7791('0x1c')](_0x5566b2,_0x4bb5aa,!![]);}catch(_0x31dcd8){return BPromise[_0x7791('0x1d')](_0x31dcd8);}return _0x5566b2[_0x7791('0x1e')]();};}function saveUpdates(_0x1d29c9,_0x62f552){return function(_0x250a90){if(_0x250a90){return _0x250a90[_0x7791('0x1f')](_0x1d29c9)[_0x7791('0x20')](function(_0x4651a0){return _0x4651a0;});}return null;};}function removeEntity(_0x2c2954,_0x898c65){return function(_0x3104c3){if(_0x3104c3){return _0x3104c3[_0x7791('0x21')]()[_0x7791('0x20')](function(){_0x2c2954['status'](0xcc)[_0x7791('0x16')]();});}};}function handleEntityNotFound(_0x3dcdaf,_0x35e9d0){return function(_0x4c9296){if(!_0x4c9296){_0x3dcdaf['sendStatus'](0x194);}return _0x4c9296;};}function handleError(_0x5f7703,_0x3f6483){_0x3f6483=_0x3f6483||0x1f4;return function(_0x9f9b06){logger[_0x7791('0x22')](_0x9f9b06['stack']);if(_0x9f9b06['name']){delete _0x9f9b06['name'];}_0x5f7703['status'](_0x3f6483)[_0x7791('0x23')](_0x9f9b06);};}exports[_0x7791('0x24')]=function(_0x4077a7,_0x2b390b){var _0x5c9096={},_0x54cce8={},_0x337310={'count':0x0,'rows':[]};var _0x3e2203=_[_0x7791('0x25')](db[_0x7791('0x26')][_0x7791('0x27')],function(_0x4356a0){return{'name':_0x4356a0[_0x7791('0x28')],'type':_0x4356a0[_0x7791('0x29')]['key']};});_0x54cce8['model']=_[_0x7791('0x25')](_0x3e2203,'name');_0x54cce8['query']=_[_0x7791('0x2a')](_0x4077a7[_0x7791('0x2b')]);_0x54cce8['filters']=_['intersection'](_0x54cce8[_0x7791('0x2c')],_0x54cce8[_0x7791('0x2b')]);_0x5c9096['attributes']=_[_0x7791('0x2d')](_0x54cce8[_0x7791('0x2c')],qs[_0x7791('0x2e')](_0x4077a7['query'][_0x7791('0x2e')]));_0x5c9096[_0x7791('0x2f')]=_0x5c9096['attributes']['length']?_0x5c9096[_0x7791('0x2f')]:_0x54cce8[_0x7791('0x2c')];if(!_0x4077a7[_0x7791('0x2b')]['hasOwnProperty']('nolimit')){_0x5c9096[_0x7791('0x19')]=qs[_0x7791('0x19')](_0x4077a7[_0x7791('0x2b')][_0x7791('0x19')]);_0x5c9096['offset']=qs['offset'](_0x4077a7['query'][_0x7791('0x18')]);}_0x5c9096[_0x7791('0x30')]=qs['sort'](_0x4077a7['query']['sort']);_0x5c9096[_0x7791('0x31')]=qs['filters'](_[_0x7791('0x32')](_0x4077a7['query'],_0x54cce8[_0x7791('0x33')]),_0x3e2203);if(_0x4077a7['query'][_0x7791('0x34')]){_0x5c9096[_0x7791('0x31')]=_['merge'](_0x5c9096[_0x7791('0x31')],{'$or':_[_0x7791('0x25')](_0x3e2203,function(_0x205f5d){if(_0x205f5d['type']!==_0x7791('0x35')){var _0x1f901f={};_0x1f901f[_0x205f5d[_0x7791('0x36')]]={'$like':'%'+_0x4077a7[_0x7791('0x2b')]['filter']+'%'};return _0x1f901f;}})});}_0x5c9096=_[_0x7791('0x37')]({},_0x5c9096,_0x4077a7[_0x7791('0x38')]);var _0x45c28f={'where':_0x5c9096[_0x7791('0x31')]};return db[_0x7791('0x26')][_0x7791('0x17')](_0x45c28f)[_0x7791('0x20')](function(_0x5bf3a7){_0x337310[_0x7791('0x17')]=_0x5bf3a7;if(_0x4077a7[_0x7791('0x2b')][_0x7791('0x39')]){_0x5c9096['include']=[{'all':!![]}];}return db[_0x7791('0x26')][_0x7791('0x3a')](_0x5c9096);})[_0x7791('0x20')](function(_0x466e3b){_0x337310[_0x7791('0x3b')]=_0x466e3b;return _0x337310;})[_0x7791('0x20')](respondWithFilteredResult(_0x2b390b,_0x5c9096))[_0x7791('0x3c')](handleError(_0x2b390b,null));};exports[_0x7791('0x3d')]=function(_0x4b6cef,_0x3de62e){var _0x17c0d6={'raw':!![],'where':{'id':_0x4b6cef[_0x7791('0x3e')]['id']}},_0x1f9a3f={};_0x1f9a3f[_0x7791('0x2c')]=_['keys'](db[_0x7791('0x26')]['rawAttributes']);_0x1f9a3f[_0x7791('0x2b')]=_['keys'](_0x4b6cef[_0x7791('0x2b')]);_0x1f9a3f['filters']=_[_0x7791('0x2d')](_0x1f9a3f['model'],_0x1f9a3f[_0x7791('0x2b')]);_0x17c0d6['attributes']=_[_0x7791('0x2d')](_0x1f9a3f[_0x7791('0x2c')],qs[_0x7791('0x2e')](_0x4b6cef['query'][_0x7791('0x2e')]));_0x17c0d6[_0x7791('0x2f')]=_0x17c0d6[_0x7791('0x2f')][_0x7791('0x3f')]?_0x17c0d6[_0x7791('0x2f')]:_0x1f9a3f[_0x7791('0x2c')];if(_0x4b6cef[_0x7791('0x2b')][_0x7791('0x39')]){_0x17c0d6['include']=[{'all':!![]}];}_0x17c0d6=_[_0x7791('0x37')]({},_0x17c0d6,_0x4b6cef[_0x7791('0x38')]);return db[_0x7791('0x26')][_0x7791('0x40')](_0x17c0d6)[_0x7791('0x20')](handleEntityNotFound(_0x3de62e,null))[_0x7791('0x20')](respondWithResult(_0x3de62e,null))[_0x7791('0x3c')](handleError(_0x3de62e,null));};exports[_0x7791('0x41')]=function(_0x22083f,_0x8f8d56){return db[_0x7791('0x26')][_0x7791('0x41')](_0x22083f[_0x7791('0x42')],{})[_0x7791('0x20')](respondWithResult(_0x8f8d56,0xc9))[_0x7791('0x3c')](handleError(_0x8f8d56,null));};exports[_0x7791('0x1f')]=function(_0x4f332b,_0x57fa93){if(_0x4f332b[_0x7791('0x42')]['id']){delete _0x4f332b[_0x7791('0x42')]['id'];}return db[_0x7791('0x26')]['find']({'where':{'id':_0x4f332b[_0x7791('0x3e')]['id']}})[_0x7791('0x20')](handleEntityNotFound(_0x57fa93,null))['then'](saveUpdates(_0x4f332b[_0x7791('0x42')],null))[_0x7791('0x20')](respondWithResult(_0x57fa93,null))['catch'](handleError(_0x57fa93,null));};exports['destroy']=function(_0x4c6ef8,_0x7709f2){return db['VoiceDialReport'][_0x7791('0x40')]({'where':{'id':_0x4c6ef8[_0x7791('0x3e')]['id']}})[_0x7791('0x20')](handleEntityNotFound(_0x7709f2,null))[_0x7791('0x20')](removeEntity(_0x7709f2,null))['catch'](handleError(_0x7709f2,null));};exports[_0x7791('0x43')]=function(_0x466f5a,_0x585eff){return db[_0x7791('0x26')][_0x7791('0x43')]()[_0x7791('0x20')](respondWithResult(_0x585eff,null))['catch'](handleError(_0x585eff,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 6d50c2f..75c7019 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 _0x06e1=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','uniqueid','../../config/logger','moment'];(function(_0x8e64ac,_0xb3a3a4){var _0x20005c=function(_0xa711d0){while(--_0xa711d0){_0x8e64ac['push'](_0x8e64ac['shift']());}};_0x20005c(++_0xb3a3a4);}(_0x06e1,0x76));var _0x106e=function(_0x34bb5d,_0x5bac4e){_0x34bb5d=_0x34bb5d-0x0;var _0x5cd2d2=_0x06e1[_0x34bb5d];return _0x5cd2d2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x106e('0x0'))('api');var moment=require(_0x106e('0x1'));var BPromise=require('bluebird');var rp=require(_0x106e('0x2'));var fs=require('fs');var path=require(_0x106e('0x3'));var rimraf=require(_0x106e('0x4'));var config=require(_0x106e('0x5'));var attributes=require(_0x106e('0x6'));module['exports']=function(_0x16c6e9,_0x93c581){return _0x16c6e9['define'](_0x106e('0x7'),attributes,{'tableName':_0x106e('0x8'),'paranoid':![],'indexes':[{'fields':[_0x106e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8ed=['exports','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceDialReport.attributes'];(function(_0x5f5093,_0x28585f){var _0x4a6dd1=function(_0x2af025){while(--_0x2af025){_0x5f5093['push'](_0x5f5093['shift']());}};_0x4a6dd1(++_0x28585f);}(_0xa8ed,0x12f));var _0xda8e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa8ed[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xda8e('0x0'));var util=require(_0xda8e('0x1'));var logger=require(_0xda8e('0x2'))(_0xda8e('0x3'));var moment=require(_0xda8e('0x4'));var BPromise=require(_0xda8e('0x5'));var rp=require(_0xda8e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda8e('0x7'));var config=require('../../config/environment');var attributes=require(_0xda8e('0x8'));module[_0xda8e('0x9')]=function(_0x5d5385,_0x16bed4){return _0x5d5385['define'](_0xda8e('0xa'),attributes,{'tableName':_0xda8e('0xb'),'paranoid':![],'indexes':[{'fields':[_0xda8e('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 c69c2f7..8b6005d 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 _0x00bb=['../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VoiceDialReport','body','options','then','CreateVoiceDialReport','update','raw','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','randomstring'];(function(_0x18fb2a,_0x3a3142){var _0x32a9db=function(_0x3d57ee){while(--_0x3d57ee){_0x18fb2a['push'](_0x18fb2a['shift']());}};_0x32a9db(++_0x3a3142);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});}exports['CreateVoiceDialReport']=function(_0x2a7231){var _0x599347=this;return new Promise(function(_0x415f91,_0x5aa9a0){return db[_0xb00b('0x12')]['create'](_0x2a7231[_0xb00b('0x13')],{'raw':_0x2a7231[_0xb00b('0x14')]?_0x2a7231['options']['raw']===undefined?!![]:![]:!![]})[_0xb00b('0x15')](function(_0x4a334b){logger[_0xb00b('0x9')](_0xb00b('0x16'),_0x2a7231);logger[_0xb00b('0xc')](_0xb00b('0x16'),_0x2a7231,JSON['stringify'](_0x4a334b));_0x415f91(_0x4a334b);})[_0xb00b('0x11')](function(_0x4df284){logger[_0xb00b('0xf')](_0xb00b('0x16'),_0x4df284['message'],_0x2a7231);_0x5aa9a0(_0x599347[_0xb00b('0xf')](0x1f4,_0x4df284[_0xb00b('0x10')]));});});};exports['UpdateVoiceDialReport']=function(_0x3ab3cc){var _0x1f04d3=this;return new Promise(function(_0x5568bb,_0x44efe5){return db[_0xb00b('0x12')][_0xb00b('0x17')](_0x3ab3cc[_0xb00b('0x13')],{'raw':_0x3ab3cc['options']?_0x3ab3cc['options'][_0xb00b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ab3cc['options']?_0x3ab3cc['options']['where']||null:null,'attributes':_0x3ab3cc[_0xb00b('0x14')]?_0x3ab3cc[_0xb00b('0x14')][_0xb00b('0x19')]||null:null,'limit':_0x3ab3cc[_0xb00b('0x14')]?_0x3ab3cc[_0xb00b('0x14')][_0xb00b('0x1a')]||null:null})[_0xb00b('0x15')](function(_0x4a8d2b){logger[_0xb00b('0x9')]('UpdateVoiceDialReport',_0x3ab3cc);logger[_0xb00b('0xc')](_0xb00b('0x1b'),_0x3ab3cc,JSON[_0xb00b('0xe')](_0x4a8d2b));_0x5568bb(_0x4a8d2b);})['catch'](function(_0x2fc11a){logger[_0xb00b('0xf')](_0xb00b('0x1b'),_0x2fc11a[_0xb00b('0x10')],_0x3ab3cc);_0x44efe5(_0x1f04d3[_0xb00b('0xf')](0x1f4,_0x2fc11a[_0xb00b('0x10')]));});});}; \ No newline at end of file +var _0x0884=['error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','update','raw','where','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4088('0x0'));var util=require(_0x4088('0x1'));var moment=require(_0x4088('0x2'));var BPromise=require(_0x4088('0x3'));var rs=require(_0x4088('0x4'));var fs=require('fs');var Redis=require(_0x4088('0x5'));var db=require(_0x4088('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4088('0x7'))(_0x4088('0x8'));var config=require(_0x4088('0x9'));var jayson=require(_0x4088('0xa'));var client=jayson[_0x4088('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d68aa,_0x42b2c3,_0x52baff){return new BPromise(function(_0x680227,_0x8f007c){return client[_0x4088('0xc')](_0x4d68aa,_0x52baff)[_0x4088('0xd')](function(_0x32fbb6){logger[_0x4088('0xe')](_0x4088('0xf'),_0x42b2c3,_0x4088('0x10'));logger[_0x4088('0x11')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x42b2c3,_0x4088('0x10'),JSON[_0x4088('0x12')](_0x32fbb6));if(_0x32fbb6[_0x4088('0x13')]){if(_0x32fbb6['error'][_0x4088('0x14')]===0x1f4){logger[_0x4088('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x42b2c3,_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);return _0x8f007c(_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);}logger[_0x4088('0x13')](_0x4088('0xf'),_0x42b2c3,_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);return _0x680227(_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);}else{logger[_0x4088('0xe')](_0x4088('0xf'),_0x42b2c3,_0x4088('0x10'));_0x680227(_0x32fbb6[_0x4088('0x16')][_0x4088('0x15')]);}})[_0x4088('0x17')](function(_0x38c6d6){logger[_0x4088('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x42b2c3,_0x38c6d6);_0x8f007c(_0x38c6d6);});});}exports[_0x4088('0x18')]=function(_0x24fe84){var _0xc7fc8e=this;return new Promise(function(_0xf21ee7,_0x40bea5){return db[_0x4088('0x19')][_0x4088('0x1a')](_0x24fe84[_0x4088('0x1b')],{'raw':_0x24fe84[_0x4088('0x1c')]?_0x24fe84[_0x4088('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x4088('0xd')](function(_0x4b887e){logger['info']('CreateVoiceDialReport',_0x24fe84);logger['debug'](_0x4088('0x18'),_0x24fe84,JSON[_0x4088('0x12')](_0x4b887e));_0xf21ee7(_0x4b887e);})[_0x4088('0x17')](function(_0x31f333){logger['error'](_0x4088('0x18'),_0x31f333[_0x4088('0x15')],_0x24fe84);_0x40bea5(_0xc7fc8e[_0x4088('0x13')](0x1f4,_0x31f333['message']));});});};exports['UpdateVoiceDialReport']=function(_0x27ee8e){var _0xdca2c0=this;return new Promise(function(_0x3ae908,_0x159158){return db[_0x4088('0x19')][_0x4088('0x1d')](_0x27ee8e['body'],{'raw':_0x27ee8e['options']?_0x27ee8e[_0x4088('0x1c')][_0x4088('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27ee8e[_0x4088('0x1c')]?_0x27ee8e[_0x4088('0x1c')][_0x4088('0x1f')]||null:null,'attributes':_0x27ee8e[_0x4088('0x1c')]?_0x27ee8e[_0x4088('0x1c')]['attributes']||null:null,'limit':_0x27ee8e[_0x4088('0x1c')]?_0x27ee8e['options']['limit']||null:null})[_0x4088('0xd')](function(_0x5b8137){logger[_0x4088('0xe')]('UpdateVoiceDialReport',_0x27ee8e);logger[_0x4088('0x11')](_0x4088('0x20'),_0x27ee8e,JSON[_0x4088('0x12')](_0x5b8137));_0x3ae908(_0x5b8137);})['catch'](function(_0x3338fa){logger['error']('UpdateVoiceDialReport',_0x3338fa[_0x4088('0x15')],_0x27ee8e);_0x159158(_0xdca2c0[_0x4088('0x13')](0x1f4,_0x3338fa['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5451691..747695f 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 _0xbd33=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put','update','delete','destroy'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0xbd33,0x155));var _0x3bd3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbd33[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3bd3('0x0'));var util=require('util');var path=require(_0x3bd3('0x1'));var timeout=require('connect-timeout');var express=require(_0x3bd3('0x2'));var router=express[_0x3bd3('0x3')]();var auth=require(_0x3bd3('0x4'));var interaction=require(_0x3bd3('0x5'));var config=require('../../config/environment');var controller=require(_0x3bd3('0x6'));router[_0x3bd3('0x7')]('/',auth[_0x3bd3('0x8')](),controller['index']);router['get'](_0x3bd3('0x9'),auth[_0x3bd3('0x8')](),controller[_0x3bd3('0xa')]);router[_0x3bd3('0xb')]('/',auth['isAuthenticated'](),controller[_0x3bd3('0xc')]);router['post'](_0x3bd3('0xd'),auth[_0x3bd3('0x8')](),controller[_0x3bd3('0xe')]);router[_0x3bd3('0xf')](_0x3bd3('0x9'),auth[_0x3bd3('0x8')](),controller[_0x3bd3('0x10')]);router[_0x3bd3('0x11')](_0x3bd3('0x9'),auth[_0x3bd3('0x8')](),controller[_0x3bd3('0x12')]);module[_0x3bd3('0x13')]=router; \ No newline at end of file +var _0xeb7e=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x35e536,_0x31a95e){var _0x2c6f85=function(_0x4beb0e){while(--_0x4beb0e){_0x35e536['push'](_0x35e536['shift']());}};_0x2c6f85(++_0x31a95e);}(_0xeb7e,0x1f2));var _0xeeb7=function(_0xf254d9,_0x5bdee8){_0xf254d9=_0xf254d9-0x0;var _0x2b4575=_0xeb7e[_0xf254d9];return _0x2b4575;};'use strict';var multer=require(_0xeeb7('0x0'));var util=require(_0xeeb7('0x1'));var path=require(_0xeeb7('0x2'));var timeout=require(_0xeeb7('0x3'));var express=require(_0xeeb7('0x4'));var router=express[_0xeeb7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xeeb7('0x6'));var config=require(_0xeeb7('0x7'));var controller=require(_0xeeb7('0x8'));router[_0xeeb7('0x9')]('/',auth[_0xeeb7('0xa')](),controller[_0xeeb7('0xb')]);router[_0xeeb7('0x9')](_0xeeb7('0xc'),auth['isAuthenticated'](),controller[_0xeeb7('0xd')]);router[_0xeeb7('0xe')]('/',auth['isAuthenticated'](),controller[_0xeeb7('0xf')]);router['post'](_0xeeb7('0x10'),auth['isAuthenticated'](),controller['addApplications']);router['put'](_0xeeb7('0xc'),auth[_0xeeb7('0xa')](),controller[_0xeeb7('0x11')]);router[_0xeeb7('0x12')](_0xeeb7('0xc'),auth['isAuthenticated'](),controller[_0xeeb7('0x13')]);module[_0xeeb7('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 44f9769..96237be 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(_0x501fd6,_0x25c9d4){var _0x5aeb89=function(_0x10caa7){while(--_0x10caa7){_0x501fd6['push'](_0x501fd6['shift']());}};_0x5aeb89(++_0x25c9d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x5e776c,_0x55c6a4){var _0x5c9a62=function(_0x39bdce){while(--_0x39bdce){_0x5e776c['push'](_0x5e776c['shift']());}};_0x5c9a62(++_0x55c6a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 8fba076..e1bd42e 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 _0xef0f=['hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','params','include','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','status','json','count','offset','limit','set','Content-Range','reject','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0xbb8bdf,_0x4a78aa){var _0x14660b=function(_0x40fee6){while(--_0x40fee6){_0xbb8bdf['push'](_0xbb8bdf['shift']());}};_0x14660b(++_0x4a78aa);}(_0xef0f,0x168));var _0xfef0=function(_0x5aba58,_0x446d7d){_0x5aba58=_0x5aba58-0x0;var _0x4024eb=_0xef0f[_0x5aba58];return _0x4024eb;};'use strict';var pdf=require(_0xfef0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfef0('0x1'));var zipdir=require(_0xfef0('0x2'));var jsonpatch=require(_0xfef0('0x3'));var rp=require('request-promise');var moment=require(_0xfef0('0x4'));var BPromise=require(_0xfef0('0x5'));var Mustache=require(_0xfef0('0x6'));var util=require('util');var path=require(_0xfef0('0x7'));var sox=require(_0xfef0('0x8'));var csv=require(_0xfef0('0x9'));var ejs=require(_0xfef0('0xa'));var fs=require('fs');var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x9'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var db=require(_0xfef0('0x19'))['db'];config[_0xfef0('0x1a')]=_['defaults'](config[_0xfef0('0x1a')],{'host':_0xfef0('0x1b'),'port':0x18eb});var socket=require(_0xfef0('0x1c'))(new Redis(config[_0xfef0('0x1a')]));require(_0xfef0('0x1d'))[_0xfef0('0x1e')](socket);function respondWithStatusCode(_0xa9f040,_0x573ae7){_0x573ae7=_0x573ae7||0xcc;return function(_0x3d1f02){if(_0x3d1f02){return _0xa9f040['sendStatus'](_0x573ae7);}return _0xa9f040['status'](_0x573ae7)['end']();};}function respondWithResult(_0x118b8d,_0x284b6d){_0x284b6d=_0x284b6d||0xc8;return function(_0x3510a7){if(_0x3510a7){return _0x118b8d[_0xfef0('0x1f')](_0x284b6d)[_0xfef0('0x20')](_0x3510a7);}};}function respondWithFilteredResult(_0x3f9a6c,_0x155833){return function(_0x2887e6){if(_0x2887e6){var _0x581459=_0x2887e6[_0xfef0('0x21')],_0xd60678=_0x155833[_0xfef0('0x22')],_0x1642cd=_0x155833['offset']+_0x155833[_0xfef0('0x23')],_0x1577fa;if(_0x1642cd>=_0x581459){_0x1642cd=_0x581459;_0x1577fa=0xc8;}else{_0x1577fa=0xce;}_0x3f9a6c['status'](_0x1577fa);return _0x3f9a6c[_0xfef0('0x24')](_0xfef0('0x25'),_0xd60678+'-'+_0x1642cd+'/'+_0x581459)[_0xfef0('0x20')](_0x2887e6);}return null;};}function patchUpdates(_0x48408a){return function(_0x2be956){try{jsonpatch['apply'](_0x2be956,_0x48408a,!![]);}catch(_0x4074b7){return BPromise[_0xfef0('0x26')](_0x4074b7);}return _0x2be956['save']();};}function saveUpdates(_0x4897af,_0x4b8b22){return function(_0x19fde8){if(_0x19fde8){return _0x19fde8['update'](_0x4897af)[_0xfef0('0x27')](function(_0x46b34a){return _0x46b34a;});}return null;};}function removeEntity(_0x1a8d66,_0x4483f2){return function(_0x249fe4){if(_0x249fe4){return _0x249fe4[_0xfef0('0x28')]()['then'](function(){var _0x4ac8c5=_0x249fe4[_0xfef0('0x29')]({'plain':!![]});var _0x1ffaa4=[{'name':_0xfef0('0x2a'),'value':_0xfef0('0x2b'),'ignore':![]},{'name':_0xfef0('0x2c'),'value':_0xfef0('0x2d'),'ignore':![]},{'name':_0xfef0('0x2e'),'value':_0xfef0('0x2f'),'ignore':![]}];var _0x391279=_(_0x1ffaa4)['filter'](_0xfef0('0x30'))[_0xfef0('0x31')](_0xfef0('0x32'))[_0xfef0('0x32')]();if(_[_0xfef0('0x33')](_0x391279,_0x4ac8c5[_0xfef0('0x34')])){return;}var _0x3e3c4c=_[_0xfef0('0x35')](_0x1ffaa4,[_0xfef0('0x32'),_0x4ac8c5[_0xfef0('0x34')]])[_0xfef0('0x36')];return db[_0xfef0('0x37')]['destroy']({'where':{'type':_0x3e3c4c,'resourceId':_0x4ac8c5['id']}})[_0xfef0('0x27')](function(){return _0x249fe4;});})['then'](function(){_0x1a8d66['status'](0xcc)[_0xfef0('0x38')]();});}};}function handleEntityNotFound(_0x2ae54a,_0x4a481d){return function(_0x4bbdba){if(!_0x4bbdba){_0x2ae54a['sendStatus'](0x194);}return _0x4bbdba;};}function handleError(_0x4f65cd,_0x4cce8a){_0x4cce8a=_0x4cce8a||0x1f4;return function(_0x417535){logger[_0xfef0('0x39')](_0x417535[_0xfef0('0x3a')]);if(_0x417535['name']){delete _0x417535['name'];}_0x4f65cd['status'](_0x4cce8a)[_0xfef0('0x3b')](_0x417535);};}exports['index']=function(_0x215032,_0x3783f9){var _0x1b9f39={},_0x4a2773={},_0x3cad13={'count':0x0,'rows':[]};var _0x4c3a0f=_[_0xfef0('0x31')](db[_0xfef0('0x3c')][_0xfef0('0x3d')],function(_0xe5188e){return{'name':_0xe5188e[_0xfef0('0x3e')],'type':_0xe5188e[_0xfef0('0x34')][_0xfef0('0x3f')]};});_0x4a2773[_0xfef0('0x40')]=_['map'](_0x4c3a0f,_0xfef0('0x36'));_0x4a2773[_0xfef0('0x41')]=_[_0xfef0('0x42')](_0x215032[_0xfef0('0x41')]);_0x4a2773[_0xfef0('0x43')]=_[_0xfef0('0x44')](_0x4a2773[_0xfef0('0x40')],_0x4a2773[_0xfef0('0x41')]);_0x1b9f39[_0xfef0('0x45')]=_[_0xfef0('0x44')](_0x4a2773[_0xfef0('0x40')],qs[_0xfef0('0x46')](_0x215032[_0xfef0('0x41')]['fields']));_0x1b9f39[_0xfef0('0x45')]=_0x1b9f39['attributes'][_0xfef0('0x47')]?_0x1b9f39[_0xfef0('0x45')]:_0x4a2773[_0xfef0('0x40')];if(!_0x215032['query'][_0xfef0('0x48')](_0xfef0('0x49'))){_0x1b9f39[_0xfef0('0x23')]=qs['limit'](_0x215032[_0xfef0('0x41')][_0xfef0('0x23')]);_0x1b9f39[_0xfef0('0x22')]=qs['offset'](_0x215032[_0xfef0('0x41')]['offset']);}_0x1b9f39['order']=qs[_0xfef0('0x4a')](_0x215032['query']['sort']);_0x1b9f39[_0xfef0('0x4b')]=qs[_0xfef0('0x43')](_[_0xfef0('0x4c')](_0x215032[_0xfef0('0x41')],_0x4a2773[_0xfef0('0x43')]),_0x4c3a0f);if(_0x215032[_0xfef0('0x41')]['filter']){_0x1b9f39[_0xfef0('0x4b')]=_[_0xfef0('0x4d')](_0x1b9f39['where'],{'$or':_['map'](_0x4c3a0f,function(_0x1d554e){if(_0x1d554e['type']!==_0xfef0('0x4e')){var _0x22c940={};_0x22c940[_0x1d554e[_0xfef0('0x36')]]={'$like':'%'+_0x215032[_0xfef0('0x41')][_0xfef0('0x4f')]+'%'};return _0x22c940;}})});}_0x1b9f39=_[_0xfef0('0x4d')]({},_0x1b9f39,_0x215032[_0xfef0('0x50')]);var _0x15b4a6={'where':_0x1b9f39['where']};return db[_0xfef0('0x3c')]['count'](_0x15b4a6)['then'](function(_0x18c656){_0x3cad13[_0xfef0('0x21')]=_0x18c656;if(_0x215032['query'][_0xfef0('0x51')]){_0x1b9f39['include']=[{'all':!![]}];}return db[_0xfef0('0x3c')][_0xfef0('0x52')](_0x1b9f39);})[_0xfef0('0x27')](function(_0x115e64){_0x3cad13['rows']=_0x115e64;return _0x3cad13;})[_0xfef0('0x27')](respondWithFilteredResult(_0x3783f9,_0x1b9f39))[_0xfef0('0x53')](handleError(_0x3783f9,null));};exports['show']=function(_0x4cafd1,_0x392607){var _0x4f3231={'raw':![],'where':{'id':_0x4cafd1[_0xfef0('0x54')]['id']}},_0x32392a={};_0x32392a[_0xfef0('0x40')]=_[_0xfef0('0x42')](db[_0xfef0('0x3c')][_0xfef0('0x3d')]);_0x32392a['query']=_[_0xfef0('0x42')](_0x4cafd1['query']);_0x32392a['filters']=_[_0xfef0('0x44')](_0x32392a[_0xfef0('0x40')],_0x32392a[_0xfef0('0x41')]);_0x4f3231['attributes']=_[_0xfef0('0x44')](_0x32392a['model'],qs['fields'](_0x4cafd1['query'][_0xfef0('0x46')]));_0x4f3231[_0xfef0('0x45')]=_0x4f3231[_0xfef0('0x45')][_0xfef0('0x47')]?_0x4f3231[_0xfef0('0x45')]:_0x32392a[_0xfef0('0x40')];if(_0x4cafd1[_0xfef0('0x41')][_0xfef0('0x51')]){_0x4f3231[_0xfef0('0x55')]=[{'all':!![]}];}_0x4f3231=_['merge']({},_0x4f3231,_0x4cafd1['options']);return db[_0xfef0('0x3c')][_0xfef0('0x35')](_0x4f3231)[_0xfef0('0x27')](handleEntityNotFound(_0x392607,null))[_0xfef0('0x27')](respondWithResult(_0x392607,null))[_0xfef0('0x53')](handleError(_0x392607,null));};exports[_0xfef0('0x28')]=function(_0x1ec15d,_0x20b647){return db['VoiceExtension'][_0xfef0('0x35')]({'where':{'id':_0x1ec15d[_0xfef0('0x54')]['id']}})[_0xfef0('0x27')](handleEntityNotFound(_0x20b647,null))[_0xfef0('0x27')](removeEntity(_0x20b647,null))[_0xfef0('0x53')](handleError(_0x20b647,null));};exports['create']=function(_0x5b3592,_0x523763){if(_0x5b3592[_0xfef0('0x56')][_0xfef0('0x34')]===_0xfef0('0x2d')&&!_[_0xfef0('0x57')](_0x5b3592['body'][_0xfef0('0x58')],'_')){_0x5b3592[_0xfef0('0x56')][_0xfef0('0x58')]='_'[_0xfef0('0x59')](_0x5b3592[_0xfef0('0x56')][_0xfef0('0x58')]);}return db[_0xfef0('0x3c')]['create'](_0x5b3592[_0xfef0('0x56')],{'raw':![]})[_0xfef0('0x27')](function(_0x47f17a){var _0x291f3f=_0x5b3592['user'][_0xfef0('0x29')]({'plain':!![]});if(!_0x291f3f)throw new Error(_0xfef0('0x5a'));if(_0x291f3f['role']===_0xfef0('0x5b')){var _0x49ec3c=_0x47f17a['get']({'plain':!![]});var _0x4812c7=[{'name':_0xfef0('0x2a'),'value':_0xfef0('0x2b')},{'name':_0xfef0('0x2c'),'value':_0xfef0('0x2d')},{'name':_0xfef0('0x2e'),'value':_0xfef0('0x2f')}];var _0x5b5664=_[_0xfef0('0x35')](_0x4812c7,[_0xfef0('0x32'),_0x49ec3c[_0xfef0('0x34')]])[_0xfef0('0x36')];return db[_0xfef0('0x5c')]['find']({'where':{'name':_0x5b5664,'userProfileId':_0x291f3f[_0xfef0('0x5d')]},'raw':!![]})['then'](function(_0x135653){if(_0x135653&&_0x135653['autoAssociation']===0x0){return db[_0xfef0('0x37')][_0xfef0('0x5e')]({'name':_0x49ec3c[_0xfef0('0x36')],'resourceId':_0x49ec3c['id'],'type':_0x135653[_0xfef0('0x36')],'sectionId':_0x135653['id']},{})[_0xfef0('0x27')](function(){return _0x47f17a;});}else{return _0x47f17a;}})['catch'](function(_0x2abdb7){logger['error'](_0xfef0('0x5f'),_0x2abdb7);throw _0x2abdb7;});}return _0x47f17a;})[_0xfef0('0x27')](respondWithResult(_0x523763,0xc9))['catch'](handleError(_0x523763,null));};exports[_0xfef0('0x60')]=function(_0x3c5640,_0xd6de4d){if(_0x3c5640[_0xfef0('0x56')]['id']){delete _0x3c5640[_0xfef0('0x56')]['id'];}return db[_0xfef0('0x3c')][_0xfef0('0x35')]({'where':{'id':_0x3c5640[_0xfef0('0x54')]['id']}})[_0xfef0('0x27')](handleEntityNotFound(_0xd6de4d,null))[_0xfef0('0x27')](function(_0x2acb4e){if(_0x2acb4e){return db[_0xfef0('0x3c')]['update'](_[_0xfef0('0x4c')](_0x3c5640[_0xfef0('0x56')],[_0xfef0('0x58'),_0xfef0('0x61'),_0xfef0('0x62'),'recordingFormat',_0xfef0('0x63'),_0xfef0('0x64')]),{'where':{'context':_0x2acb4e[_0xfef0('0x61')],'exten':_0x2acb4e[_0xfef0('0x58')]},'individualHooks':!![]})[_0xfef0('0x27')](function(_0x1765e2){return _0x1765e2;});}return null;})[_0xfef0('0x27')](respondWithStatusCode(_0xd6de4d,null))[_0xfef0('0x53')](handleError(_0xd6de4d,null));};exports[_0xfef0('0x65')]=function(_0x3f26d9,_0x4f7ad3,_0x100c6a){return db['VoiceExtension'][_0xfef0('0x66')]({'where':{'id':_0x3f26d9[_0xfef0('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f7ad3,null))[_0xfef0('0x27')](function(_0x20c2ec){if(_0x20c2ec){return db[_0xfef0('0x67')][_0xfef0('0x68')](function(_0x1e0ad5){return db['VoiceExtension'][_0xfef0('0x28')]({'where':{'VoiceExtensionId':_0x3f26d9[_0xfef0('0x54')]['id']},'transaction':_0x1e0ad5})[_0xfef0('0x27')](function(_0x4f0737){var _0x117b74=_[_0xfef0('0x31')](_0x3f26d9[_0xfef0('0x56')],function(_0x6f759a){_0x6f759a[_0xfef0('0x69')]=_0x3f26d9[_0xfef0('0x54')]['id'];return _0x6f759a;});return db[_0xfef0('0x3c')]['bulkCreate'](_0x117b74,{'transaction':_0x1e0ad5});});})[_0xfef0('0x27')](function(){return db[_0xfef0('0x3c')][_0xfef0('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3f26d9[_0xfef0('0x54')]['id']},'order':_0xfef0('0x6b')});});}})[_0xfef0('0x27')](respondWithResult(_0x4f7ad3,null))['catch'](handleError(_0x4f7ad3,null));}; \ No newline at end of file +var _0x1967=['name','error','stack','send','VoiceExtension','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','keys','includeAll','options','find','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','VoiceExtensionId','bulkCreate','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','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','count','offset','reject','save','update','then','destroy','get','InboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type'];(function(_0x1089f1,_0x5afbb0){var _0x1329a3=function(_0x378ecd){while(--_0x378ecd){_0x1089f1['push'](_0x1089f1['shift']());}};_0x1329a3(++_0x5afbb0);}(_0x1967,0x173));var _0x7196=function(_0x538b24,_0x459f62){_0x538b24=_0x538b24-0x0;var _0x36625f=_0x1967[_0x538b24];return _0x36625f;};'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'];config[_0x7196('0x1a')]=_[_0x7196('0x1b')](config[_0x7196('0x1a')],{'host':_0x7196('0x1c'),'port':0x18eb});var socket=require(_0x7196('0x1d'))(new Redis(config['redis']));require(_0x7196('0x1e'))[_0x7196('0x1f')](socket);function respondWithStatusCode(_0x3545aa,_0xf098c1){_0xf098c1=_0xf098c1||0xcc;return function(_0x511aa1){if(_0x511aa1){return _0x3545aa[_0x7196('0x20')](_0xf098c1);}return _0x3545aa['status'](_0xf098c1)[_0x7196('0x21')]();};}function respondWithResult(_0x2590a6,_0xf7e97){_0xf7e97=_0xf7e97||0xc8;return function(_0x3ed1ad){if(_0x3ed1ad){return _0x2590a6[_0x7196('0x22')](_0xf7e97)[_0x7196('0x23')](_0x3ed1ad);}};}function respondWithFilteredResult(_0x22bd62,_0x1ed296){return function(_0x3e4e69){if(_0x3e4e69){var _0x32fe2b=_0x3e4e69[_0x7196('0x24')],_0x385f2d=_0x1ed296[_0x7196('0x25')],_0x5b716a=_0x1ed296[_0x7196('0x25')]+_0x1ed296['limit'],_0x4c4f91;if(_0x5b716a>=_0x32fe2b){_0x5b716a=_0x32fe2b;_0x4c4f91=0xc8;}else{_0x4c4f91=0xce;}_0x22bd62[_0x7196('0x22')](_0x4c4f91);return _0x22bd62['set']('Content-Range',_0x385f2d+'-'+_0x5b716a+'/'+_0x32fe2b)[_0x7196('0x23')](_0x3e4e69);}return null;};}function patchUpdates(_0x627223){return function(_0x8dee9d){try{jsonpatch['apply'](_0x8dee9d,_0x627223,!![]);}catch(_0x57c390){return BPromise[_0x7196('0x26')](_0x57c390);}return _0x8dee9d[_0x7196('0x27')]();};}function saveUpdates(_0x598a26,_0x18649b){return function(_0x27ff84){if(_0x27ff84){return _0x27ff84[_0x7196('0x28')](_0x598a26)[_0x7196('0x29')](function(_0x38b3d6){return _0x38b3d6;});}return null;};}function removeEntity(_0x549f34,_0x3f8178){return function(_0x520d01){if(_0x520d01){return _0x520d01[_0x7196('0x2a')]()[_0x7196('0x29')](function(){var _0x2e15c7=_0x520d01[_0x7196('0x2b')]({'plain':!![]});var _0x70aa65=[{'name':_0x7196('0x2c'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x7196('0x2d'),'ignore':![]},{'name':_0x7196('0x2e'),'value':_0x7196('0x2f'),'ignore':![]}];var _0x4e878f=_(_0x70aa65)['filter'](_0x7196('0x30'))[_0x7196('0x31')](_0x7196('0x32'))['value']();if(_[_0x7196('0x33')](_0x4e878f,_0x2e15c7['type'])){return;}var _0x4fd339=_['find'](_0x70aa65,[_0x7196('0x32'),_0x2e15c7[_0x7196('0x34')]])[_0x7196('0x35')];return db['UserProfileResource'][_0x7196('0x2a')]({'where':{'type':_0x4fd339,'resourceId':_0x2e15c7['id']}})[_0x7196('0x29')](function(){return _0x520d01;});})[_0x7196('0x29')](function(){_0x549f34[_0x7196('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39710d,_0x429160){return function(_0xd07f22){if(!_0xd07f22){_0x39710d[_0x7196('0x20')](0x194);}return _0xd07f22;};}function handleError(_0x4780e1,_0x2786f3){_0x2786f3=_0x2786f3||0x1f4;return function(_0x15c5f0){logger[_0x7196('0x36')](_0x15c5f0[_0x7196('0x37')]);if(_0x15c5f0[_0x7196('0x35')]){delete _0x15c5f0[_0x7196('0x35')];}_0x4780e1['status'](_0x2786f3)[_0x7196('0x38')](_0x15c5f0);};}exports['index']=function(_0x2452f6,_0x4c3365){var _0x372ddc={},_0x25fa11={},_0x5616ed={'count':0x0,'rows':[]};var _0x628e7d=_[_0x7196('0x31')](db[_0x7196('0x39')][_0x7196('0x3a')],function(_0x7547cf){return{'name':_0x7547cf['fieldName'],'type':_0x7547cf[_0x7196('0x34')][_0x7196('0x3b')]};});_0x25fa11[_0x7196('0x3c')]=_[_0x7196('0x31')](_0x628e7d,_0x7196('0x35'));_0x25fa11[_0x7196('0x3d')]=_['keys'](_0x2452f6[_0x7196('0x3d')]);_0x25fa11[_0x7196('0x3e')]=_[_0x7196('0x3f')](_0x25fa11['model'],_0x25fa11[_0x7196('0x3d')]);_0x372ddc[_0x7196('0x40')]=_[_0x7196('0x3f')](_0x25fa11[_0x7196('0x3c')],qs[_0x7196('0x41')](_0x2452f6[_0x7196('0x3d')][_0x7196('0x41')]));_0x372ddc[_0x7196('0x40')]=_0x372ddc[_0x7196('0x40')][_0x7196('0x42')]?_0x372ddc['attributes']:_0x25fa11[_0x7196('0x3c')];if(!_0x2452f6[_0x7196('0x3d')]['hasOwnProperty'](_0x7196('0x43'))){_0x372ddc['limit']=qs['limit'](_0x2452f6[_0x7196('0x3d')][_0x7196('0x44')]);_0x372ddc['offset']=qs['offset'](_0x2452f6[_0x7196('0x3d')][_0x7196('0x25')]);}_0x372ddc[_0x7196('0x45')]=qs['sort'](_0x2452f6[_0x7196('0x3d')][_0x7196('0x46')]);_0x372ddc[_0x7196('0x47')]=qs[_0x7196('0x3e')](_[_0x7196('0x48')](_0x2452f6[_0x7196('0x3d')],_0x25fa11[_0x7196('0x3e')]),_0x628e7d);if(_0x2452f6[_0x7196('0x3d')]['filter']){_0x372ddc[_0x7196('0x47')]=_[_0x7196('0x49')](_0x372ddc['where'],{'$or':_[_0x7196('0x31')](_0x628e7d,function(_0x43d4c0){if(_0x43d4c0['type']!==_0x7196('0x4a')){var _0x471bb2={};_0x471bb2[_0x43d4c0[_0x7196('0x35')]]={'$like':'%'+_0x2452f6['query'][_0x7196('0x4b')]+'%'};return _0x471bb2;}})});}_0x372ddc=_[_0x7196('0x49')]({},_0x372ddc,_0x2452f6['options']);var _0xcd287c={'where':_0x372ddc[_0x7196('0x47')]};return db['VoiceExtension'][_0x7196('0x24')](_0xcd287c)['then'](function(_0x55f308){_0x5616ed['count']=_0x55f308;if(_0x2452f6['query']['includeAll']){_0x372ddc[_0x7196('0x4c')]=[{'all':!![]}];}return db['VoiceExtension'][_0x7196('0x4d')](_0x372ddc);})[_0x7196('0x29')](function(_0x780275){_0x5616ed[_0x7196('0x4e')]=_0x780275;return _0x5616ed;})['then'](respondWithFilteredResult(_0x4c3365,_0x372ddc))[_0x7196('0x4f')](handleError(_0x4c3365,null));};exports['show']=function(_0x12ee76,_0x1703fc){var _0x2ca1a0={'raw':![],'where':{'id':_0x12ee76[_0x7196('0x50')]['id']}},_0x5e34e8={};_0x5e34e8[_0x7196('0x3c')]=_[_0x7196('0x51')](db['VoiceExtension']['rawAttributes']);_0x5e34e8[_0x7196('0x3d')]=_['keys'](_0x12ee76[_0x7196('0x3d')]);_0x5e34e8['filters']=_['intersection'](_0x5e34e8[_0x7196('0x3c')],_0x5e34e8['query']);_0x2ca1a0['attributes']=_['intersection'](_0x5e34e8[_0x7196('0x3c')],qs['fields'](_0x12ee76['query'][_0x7196('0x41')]));_0x2ca1a0[_0x7196('0x40')]=_0x2ca1a0[_0x7196('0x40')][_0x7196('0x42')]?_0x2ca1a0['attributes']:_0x5e34e8[_0x7196('0x3c')];if(_0x12ee76['query'][_0x7196('0x52')]){_0x2ca1a0[_0x7196('0x4c')]=[{'all':!![]}];}_0x2ca1a0=_['merge']({},_0x2ca1a0,_0x12ee76[_0x7196('0x53')]);return db[_0x7196('0x39')][_0x7196('0x54')](_0x2ca1a0)['then'](handleEntityNotFound(_0x1703fc,null))[_0x7196('0x29')](respondWithResult(_0x1703fc,null))['catch'](handleError(_0x1703fc,null));};exports[_0x7196('0x2a')]=function(_0x9fa0d3,_0x179815){return db[_0x7196('0x39')][_0x7196('0x54')]({'where':{'id':_0x9fa0d3[_0x7196('0x50')]['id']}})[_0x7196('0x29')](handleEntityNotFound(_0x179815,null))[_0x7196('0x29')](removeEntity(_0x179815,null))['catch'](handleError(_0x179815,null));};exports['create']=function(_0x24d81a,_0x191c80){if(_0x24d81a[_0x7196('0x55')][_0x7196('0x34')]==='outbound'&&!_[_0x7196('0x56')](_0x24d81a[_0x7196('0x55')][_0x7196('0x57')],'_')){_0x24d81a[_0x7196('0x55')][_0x7196('0x57')]='_'[_0x7196('0x58')](_0x24d81a[_0x7196('0x55')][_0x7196('0x57')]);}return db[_0x7196('0x39')][_0x7196('0x59')](_0x24d81a[_0x7196('0x55')],{'raw':![]})['then'](function(_0x741e67){var _0x6b65c1=_0x24d81a[_0x7196('0x5a')]['get']({'plain':!![]});if(!_0x6b65c1)throw new Error(_0x7196('0x5b'));if(_0x6b65c1['role']===_0x7196('0x5a')){var _0x1b71b3=_0x741e67[_0x7196('0x2b')]({'plain':!![]});var _0x3e74ef=[{'name':_0x7196('0x2c'),'value':'inbound'},{'name':_0x7196('0x5c'),'value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0x1bc358=_[_0x7196('0x54')](_0x3e74ef,[_0x7196('0x32'),_0x1b71b3[_0x7196('0x34')]])[_0x7196('0x35')];return db[_0x7196('0x5d')][_0x7196('0x54')]({'where':{'name':_0x1bc358,'userProfileId':_0x6b65c1['userProfileId']},'raw':!![]})[_0x7196('0x29')](function(_0x14dc43){if(_0x14dc43&&_0x14dc43[_0x7196('0x5e')]===0x0){return db[_0x7196('0x5f')][_0x7196('0x59')]({'name':_0x1b71b3['name'],'resourceId':_0x1b71b3['id'],'type':_0x14dc43['name'],'sectionId':_0x14dc43['id']},{})[_0x7196('0x29')](function(){return _0x741e67;});}else{return _0x741e67;}})[_0x7196('0x4f')](function(_0xeb7e6e){logger[_0x7196('0x36')](_0x7196('0x60'),_0xeb7e6e);throw _0xeb7e6e;});}return _0x741e67;})[_0x7196('0x29')](respondWithResult(_0x191c80,0xc9))[_0x7196('0x4f')](handleError(_0x191c80,null));};exports[_0x7196('0x28')]=function(_0x13e9d0,_0x2caadd){if(_0x13e9d0[_0x7196('0x55')]['id']){delete _0x13e9d0['body']['id'];}return db[_0x7196('0x39')][_0x7196('0x54')]({'where':{'id':_0x13e9d0[_0x7196('0x50')]['id']}})[_0x7196('0x29')](handleEntityNotFound(_0x2caadd,null))['then'](function(_0x4bd0f3){if(_0x4bd0f3){return db[_0x7196('0x39')][_0x7196('0x28')](_[_0x7196('0x48')](_0x13e9d0[_0x7196('0x55')],[_0x7196('0x57'),_0x7196('0x61'),'description',_0x7196('0x62'),_0x7196('0x63'),_0x7196('0x64')]),{'where':{'context':_0x4bd0f3[_0x7196('0x61')],'exten':_0x4bd0f3['exten']},'individualHooks':!![]})[_0x7196('0x29')](function(_0x3809c4){return _0x3809c4;});}return null;})[_0x7196('0x29')](respondWithStatusCode(_0x2caadd,null))[_0x7196('0x4f')](handleError(_0x2caadd,null));};exports[_0x7196('0x65')]=function(_0x37c6be,_0x57065,_0x517dfb){return db['VoiceExtension']['findOne']({'where':{'id':_0x37c6be[_0x7196('0x50')]['id']}})['then'](handleEntityNotFound(_0x57065,null))[_0x7196('0x29')](function(_0x432a38){if(_0x432a38){return db[_0x7196('0x66')][_0x7196('0x67')](function(_0x1f4f0a){return db[_0x7196('0x39')][_0x7196('0x2a')]({'where':{'VoiceExtensionId':_0x37c6be[_0x7196('0x50')]['id']},'transaction':_0x1f4f0a})[_0x7196('0x29')](function(_0x52ab69){var _0x5c001a=_[_0x7196('0x31')](_0x37c6be[_0x7196('0x55')],function(_0x13e53b){_0x13e53b[_0x7196('0x68')]=_0x37c6be[_0x7196('0x50')]['id'];return _0x13e53b;});return db[_0x7196('0x39')][_0x7196('0x69')](_0x5c001a,{'transaction':_0x1f4f0a});});})[_0x7196('0x29')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x37c6be[_0x7196('0x50')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x7196('0x29')](respondWithResult(_0x57065,null))['catch'](handleError(_0x57065,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 573d3d8..9bb4e78 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 _0xe98f=['save','update','emit','hasOwnProperty','exports','events','VoiceExtension'];(function(_0x5f35e2,_0x20105a){var _0x2d93fa=function(_0x4d0ee3){while(--_0x4d0ee3){_0x5f35e2['push'](_0x5f35e2['shift']());}};_0x2d93fa(++_0x20105a);}(_0xe98f,0xde));var _0xfe98=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe98f[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0xfe98('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xfe98('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe98('0x2'),'afterUpdate':_0xfe98('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4f19ea){return function(_0x4047fa,_0x5efd60,_0xabc73f){VoiceExtensionEvents[_0xfe98('0x4')](_0x4f19ea+':'+_0x4047fa['id'],_0x4047fa);VoiceExtensionEvents['emit'](_0x4f19ea,_0x4047fa);_0xabc73f(null);};}for(var e in events){if(events[_0xfe98('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xfe98('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x677c=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','VoiceExtension'];(function(_0x34acae,_0x1472d8){var _0x2d475f=function(_0x23d47){while(--_0x23d47){_0x34acae['push'](_0x34acae['shift']());}};_0x2d475f(++_0x1472d8);}(_0x677c,0x187));var _0xc677=function(_0x2d4ac2,_0x38a9de){_0x2d4ac2=_0x2d4ac2-0x0;var _0x227bc6=_0x677c[_0x2d4ac2];return _0x227bc6;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xc677('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc677('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc677('0x2'),'afterDestroy':_0xc677('0x3')};function emitEvent(_0x20a0e8){return function(_0x444e7e,_0x577e6b,_0x13f450){VoiceExtensionEvents[_0xc677('0x4')](_0x20a0e8+':'+_0x444e7e['id'],_0x444e7e);VoiceExtensionEvents[_0xc677('0x4')](_0x20a0e8,_0x444e7e);_0x13f450(null);};}for(var e in events){if(events[_0xc677('0x5')](e)){var event=events[e];VoiceExtension[_0xc677('0x6')](e,emitEvent(event));}}module[_0xc677('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index e7147ae..8ea7885 100644 --- a/server/api/voiceExtension/voiceExtension.model.js +++ b/server/api/voiceExtension/voiceExtension.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','lodash','util'];(function(_0x13bf70,_0x1d6a0b){var _0x2d1e30=function(_0x42e490){while(--_0x42e490){_0x13bf70['push'](_0x13bf70['shift']());}};_0x2d1e30(++_0x1d6a0b);}(_0x7a54,0x106));var _0x47a5=function(_0x1cfb3d,_0x4be288){_0x1cfb3d=_0x1cfb3d-0x0;var _0x1804bc=_0x7a54[_0x1cfb3d];return _0x1804bc;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./voiceExtension.attributes'];(function(_0x1d4667,_0x179c04){var _0x4f6cf4=function(_0x3761ea){while(--_0x3761ea){_0x1d4667['push'](_0x1d4667['shift']());}};_0x4f6cf4(++_0x179c04);}(_0x2ef3,0xba));var _0x32ef=function(_0x77efc7,_0x1b2312){_0x77efc7=_0x77efc7-0x0;var _0x5d1561=_0x2ef3[_0x77efc7];return _0x5d1561;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index d6bbdf4..3d21508 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 _0xcbd1=['catch','GetVoiceExtension','findAll','options','where','attributes','limit','include','map','model','debug','stringify','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x1805ce,_0x565a64){var _0x344d75=function(_0x1ec743){while(--_0x1ec743){_0x1805ce['push'](_0x1805ce['shift']());}};_0x344d75(++_0x565a64);}(_0xcbd1,0x90));var _0x1cbd=function(_0x4d2411,_0x4f1439){_0x4d2411=_0x4d2411-0x0;var _0x39cf0c=_0xcbd1[_0x4d2411];return _0x39cf0c;};'use strict';var _=require(_0x1cbd('0x0'));var util=require('util');var moment=require(_0x1cbd('0x1'));var BPromise=require(_0x1cbd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cbd('0x3'))['db'];var utils=require(_0x1cbd('0x4'));var logger=require(_0x1cbd('0x5'))(_0x1cbd('0x6'));var config=require('../../config/environment');var jayson=require(_0x1cbd('0x7'));var client=jayson['client'][_0x1cbd('0x8')]({'port':0x232a});config['redis']=_[_0x1cbd('0x9')](config[_0x1cbd('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1cbd('0xb'))['register'](socket);function respondWithRpcPromise(_0x2ea7a6,_0xe76944,_0x436291){return new BPromise(function(_0x336f3f,_0x406d56){return client[_0x1cbd('0xc')](_0x2ea7a6,_0x436291)[_0x1cbd('0xd')](function(_0x752999){logger[_0x1cbd('0xe')](_0x1cbd('0xf'),_0xe76944,_0x1cbd('0x10'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xe76944,_0x1cbd('0x10'),JSON['stringify'](_0x752999));if(_0x752999[_0x1cbd('0x11')]){if(_0x752999[_0x1cbd('0x11')][_0x1cbd('0x12')]===0x1f4){logger[_0x1cbd('0x11')]('VoiceExtension,\x20%s,\x20%s',_0xe76944,_0x752999[_0x1cbd('0x11')]['message']);return _0x406d56(_0x752999[_0x1cbd('0x11')][_0x1cbd('0x13')]);}logger[_0x1cbd('0x11')](_0x1cbd('0xf'),_0xe76944,_0x752999['error'][_0x1cbd('0x13')]);return _0x336f3f(_0x752999[_0x1cbd('0x11')]['message']);}else{logger[_0x1cbd('0xe')](_0x1cbd('0xf'),_0xe76944,_0x1cbd('0x10'));_0x336f3f(_0x752999[_0x1cbd('0x14')]['message']);}})[_0x1cbd('0x15')](function(_0x334a95){logger['error'](_0x1cbd('0xf'),_0xe76944,_0x334a95);_0x406d56(_0x334a95);});});}exports[_0x1cbd('0x16')]=function(_0x275f0f){var _0x30aab5=this;return new Promise(function(_0x4da57c,_0x197d0c){return db['VoiceExtension'][_0x1cbd('0x17')]({'raw':_0x275f0f[_0x1cbd('0x18')]?_0x275f0f[_0x1cbd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x275f0f[_0x1cbd('0x18')]?_0x275f0f[_0x1cbd('0x18')][_0x1cbd('0x19')]||null:null,'attributes':_0x275f0f[_0x1cbd('0x18')]?_0x275f0f[_0x1cbd('0x18')][_0x1cbd('0x1a')]||null:null,'limit':_0x275f0f[_0x1cbd('0x18')]?_0x275f0f[_0x1cbd('0x18')][_0x1cbd('0x1b')]||null:null,'include':_0x275f0f[_0x1cbd('0x18')]?_0x275f0f['options'][_0x1cbd('0x1c')]?_[_0x1cbd('0x1d')](_0x275f0f[_0x1cbd('0x18')][_0x1cbd('0x1c')],function(_0x41a7b5){return{'model':db[_0x41a7b5['model']],'as':_0x41a7b5['as'],'attributes':_0x41a7b5['attributes'],'include':_0x41a7b5['include']?_[_0x1cbd('0x1d')](_0x41a7b5[_0x1cbd('0x1c')],function(_0x5203a1){return{'model':db[_0x5203a1[_0x1cbd('0x1e')]],'as':_0x5203a1['as'],'attributes':_0x5203a1[_0x1cbd('0x1a')],'include':_0x5203a1['include']?_[_0x1cbd('0x1d')](_0x5203a1[_0x1cbd('0x1c')],function(_0x53e134){return{'model':db[_0x53e134[_0x1cbd('0x1e')]],'as':_0x53e134['as'],'attributes':_0x53e134[_0x1cbd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1cbd('0xd')](function(_0x43f7cc){logger[_0x1cbd('0xe')]('GetVoiceExtension',_0x275f0f);logger[_0x1cbd('0x1f')]('GetVoiceExtension',_0x275f0f,JSON[_0x1cbd('0x20')](_0x43f7cc));_0x4da57c(_0x43f7cc);})[_0x1cbd('0x15')](function(_0x560839){logger[_0x1cbd('0x11')](_0x1cbd('0x16'),_0x560839[_0x1cbd('0x13')],_0x275f0f);_0x197d0c(_0x30aab5[_0x1cbd('0x11')](0x1f4,_0x560839[_0x1cbd('0x13')]));});});}; \ No newline at end of file +var _0x81eb=['client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','request','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','info','message','catch','findAll','options','raw','where','attributes','include','map','model','GetVoiceExtension','debug','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x459c75,_0x4d3740){var _0xd11734=function(_0x5445d5){while(--_0x5445d5){_0x459c75['push'](_0x459c75['shift']());}};_0xd11734(++_0x4d3740);}(_0x81eb,0x101));var _0xb81e=function(_0x4691d7,_0x2a6a2c){_0x4691d7=_0x4691d7-0x0;var _0x15aa16=_0x81eb[_0x4691d7];return _0x15aa16;};'use strict';var _=require('lodash');var util=require(_0xb81e('0x0'));var moment=require(_0xb81e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb81e('0x2'));var db=require(_0xb81e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb81e('0x4'))(_0xb81e('0x5'));var config=require(_0xb81e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb81e('0x7')][_0xb81e('0x8')]({'port':0x232a});config[_0xb81e('0x9')]=_['defaults'](config[_0xb81e('0x9')],{'host':_0xb81e('0xa'),'port':0x18eb});var socket=require(_0xb81e('0xb'))(new Redis(config[_0xb81e('0x9')]));require(_0xb81e('0xc'))['register'](socket);function respondWithRpcPromise(_0x5c071e,_0x7232c,_0x4fd398){return new BPromise(function(_0x499e5e,_0x3e6837){return client[_0xb81e('0xd')](_0x5c071e,_0x4fd398)['then'](function(_0xdd61de){logger['info'](_0xb81e('0xe'),_0x7232c,_0xb81e('0xf'));logger['debug'](_0xb81e('0x10'),_0x7232c,_0xb81e('0xf'),JSON[_0xb81e('0x11')](_0xdd61de));if(_0xdd61de['error']){if(_0xdd61de['error'][_0xb81e('0x12')]===0x1f4){logger[_0xb81e('0x13')](_0xb81e('0xe'),_0x7232c,_0xdd61de[_0xb81e('0x13')]['message']);return _0x3e6837(_0xdd61de[_0xb81e('0x13')]['message']);}logger[_0xb81e('0x13')](_0xb81e('0xe'),_0x7232c,_0xdd61de['error']['message']);return _0x499e5e(_0xdd61de['error']['message']);}else{logger[_0xb81e('0x14')](_0xb81e('0xe'),_0x7232c,_0xb81e('0xf'));_0x499e5e(_0xdd61de['result'][_0xb81e('0x15')]);}})[_0xb81e('0x16')](function(_0x1b82eb){logger[_0xb81e('0x13')](_0xb81e('0xe'),_0x7232c,_0x1b82eb);_0x3e6837(_0x1b82eb);});});}exports['GetVoiceExtension']=function(_0xc4b11a){var _0x179607=this;return new Promise(function(_0x16a594,_0x46622c){return db['VoiceExtension'][_0xb81e('0x17')]({'raw':_0xc4b11a[_0xb81e('0x18')]?_0xc4b11a[_0xb81e('0x18')][_0xb81e('0x19')]===undefined?!![]:![]:!![],'where':_0xc4b11a['options']?_0xc4b11a['options'][_0xb81e('0x1a')]||null:null,'attributes':_0xc4b11a[_0xb81e('0x18')]?_0xc4b11a[_0xb81e('0x18')][_0xb81e('0x1b')]||null:null,'limit':_0xc4b11a[_0xb81e('0x18')]?_0xc4b11a['options']['limit']||null:null,'include':_0xc4b11a[_0xb81e('0x18')]?_0xc4b11a[_0xb81e('0x18')][_0xb81e('0x1c')]?_[_0xb81e('0x1d')](_0xc4b11a[_0xb81e('0x18')][_0xb81e('0x1c')],function(_0x31e19d){return{'model':db[_0x31e19d[_0xb81e('0x1e')]],'as':_0x31e19d['as'],'attributes':_0x31e19d[_0xb81e('0x1b')],'include':_0x31e19d[_0xb81e('0x1c')]?_[_0xb81e('0x1d')](_0x31e19d[_0xb81e('0x1c')],function(_0xb7f2a5){return{'model':db[_0xb7f2a5[_0xb81e('0x1e')]],'as':_0xb7f2a5['as'],'attributes':_0xb7f2a5[_0xb81e('0x1b')],'include':_0xb7f2a5[_0xb81e('0x1c')]?_[_0xb81e('0x1d')](_0xb7f2a5['include'],function(_0x31bc00){return{'model':db[_0x31bc00[_0xb81e('0x1e')]],'as':_0x31bc00['as'],'attributes':_0x31bc00['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f39aa){logger['info'](_0xb81e('0x1f'),_0xc4b11a);logger[_0xb81e('0x20')](_0xb81e('0x1f'),_0xc4b11a,JSON[_0xb81e('0x11')](_0x4f39aa));_0x16a594(_0x4f39aa);})[_0xb81e('0x16')](function(_0x1afbde){logger['error'](_0xb81e('0x1f'),_0x1afbde[_0xb81e('0x15')],_0xc4b11a);_0x46622c(_0x179607['error'](0x1f4,_0x1afbde[_0xb81e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 173e089..c83f397 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 _0xa0c4=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xa0c4,0xed));var _0x4a0c=function(_0x6e7d28,_0x79af88){_0x6e7d28=_0x6e7d28-0x0;var _0x57a1d9=_0xa0c4[_0x6e7d28];return _0x57a1d9;};'use strict';var VoiceExtensionEvents=require(_0x4a0c('0x0'));var events=['save',_0x4a0c('0x1'),'update'];function createListener(_0x34357e,_0x2e95df){return function(_0x33c722){_0x2e95df[_0x4a0c('0x2')](_0x34357e,_0x33c722);};}function removeListener(_0x430d48,_0x4901bd){return function(){VoiceExtensionEvents[_0x4a0c('0x3')](_0x430d48,_0x4901bd);};}exports[_0x4a0c('0x4')]=function(_0x19ad40){for(var _0x58e817=0x0,_0x139212=events[_0x4a0c('0x5')];_0x58e817<_0x139212;_0x58e817++){var _0x364530=events[_0x58e817];var _0x45639a=createListener(_0x4a0c('0x6')+_0x364530,_0x19ad40);VoiceExtensionEvents['on'](_0x364530,_0x45639a);}}; \ No newline at end of file +var _0x4ceb=['./voiceExtension.events','save','remove','emit','removeListener','register','length'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x4ceb,0x69));var _0xb4ce=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x4ceb[_0x31e29a];return _0x32d892;};'use strict';var VoiceExtensionEvents=require(_0xb4ce('0x0'));var events=[_0xb4ce('0x1'),_0xb4ce('0x2'),'update'];function createListener(_0x3cddc7,_0xc2e04b){return function(_0x52a718){_0xc2e04b[_0xb4ce('0x3')](_0x3cddc7,_0x52a718);};}function removeListener(_0x4c61dc,_0x558a3e){return function(){VoiceExtensionEvents[_0xb4ce('0x4')](_0x4c61dc,_0x558a3e);};}exports[_0xb4ce('0x5')]=function(_0x430b55){for(var _0x2694a0=0x0,_0x1641cb=events[_0xb4ce('0x6')];_0x2694a0<_0x1641cb;_0x2694a0++){var _0x118a43=events[_0x2694a0];var _0x4f51a6=createListener('voiceExtension:'+_0x118a43,_0x430b55);VoiceExtensionEvents['on'](_0x118a43,_0x4f51a6);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 71ff6f5..3c124f1 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 _0x5d13=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy','exports','util','path'];(function(_0x540315,_0x5e4286){var _0x45b752=function(_0x42f23e){while(--_0x42f23e){_0x540315['push'](_0x540315['shift']());}};_0x45b752(++_0x5e4286);}(_0x5d13,0x1b7));var _0x35d1=function(_0x37ddf0,_0x5c55de){_0x37ddf0=_0x37ddf0-0x0;var _0x47ebcc=_0x5d13[_0x37ddf0];return _0x47ebcc;};'use strict';var multer=require('multer');var util=require(_0x35d1('0x0'));var path=require(_0x35d1('0x1'));var timeout=require(_0x35d1('0x2'));var express=require(_0x35d1('0x3'));var router=express['Router']();var auth=require(_0x35d1('0x4'));var interaction=require(_0x35d1('0x5'));var config=require(_0x35d1('0x6'));var controller=require(_0x35d1('0x7'));router[_0x35d1('0x8')]('/',auth[_0x35d1('0x9')](),controller[_0x35d1('0xa')]);router[_0x35d1('0x8')](_0x35d1('0xb'),auth['isAuthenticated'](),controller[_0x35d1('0xc')]);router[_0x35d1('0x8')](_0x35d1('0xd'),auth[_0x35d1('0x9')](),controller[_0x35d1('0xe')]);router[_0x35d1('0xf')]('/',auth[_0x35d1('0x9')](),controller[_0x35d1('0x10')]);router['put'](_0x35d1('0xb'),auth['isAuthenticated'](),controller[_0x35d1('0x11')]);router[_0x35d1('0x12')](_0x35d1('0xb'),auth['isAuthenticated'](),controller[_0x35d1('0x13')]);module[_0x35d1('0x14')]=router; \ No newline at end of file +var _0xbab2=['post','put','delete','destroy','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id','show','/:id/messages','getMessages'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbab2,0x17f));var _0x2bab=function(_0x770f61,_0x56fa5c){_0x770f61=_0x770f61-0x0;var _0xe7fc09=_0xbab2[_0x770f61];return _0xe7fc09;};'use strict';var multer=require(_0x2bab('0x0'));var util=require(_0x2bab('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2bab('0x2'));var interaction=require(_0x2bab('0x3'));var config=require(_0x2bab('0x4'));var controller=require(_0x2bab('0x5'));router['get']('/',auth[_0x2bab('0x6')](),controller[_0x2bab('0x7')]);router[_0x2bab('0x8')](_0x2bab('0x9'),auth[_0x2bab('0x6')](),controller[_0x2bab('0xa')]);router[_0x2bab('0x8')](_0x2bab('0xb'),auth['isAuthenticated'](),controller[_0x2bab('0xc')]);router[_0x2bab('0xd')]('/',auth[_0x2bab('0x6')](),controller['create']);router[_0x2bab('0xe')](_0x2bab('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x2bab('0xf')](_0x2bab('0x9'),auth['isAuthenticated'](),controller[_0x2bab('0x10')]);module[_0x2bab('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ddd02f8..ab86eaa 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 _0x8603=['exports','STRING','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x25f8e8,_0x519d8e){var _0x1df02c=function(_0x1bee7b){while(--_0x1bee7b){_0x25f8e8['push'](_0x25f8e8['shift']());}};_0x1df02c(++_0x519d8e);}(_0x8603,0x190));var _0x3860=function(_0x3c01e2,_0x204612){_0x3c01e2=_0x3c01e2-0x0;var _0x162c4c=_0x8603[_0x3c01e2];return _0x162c4c;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'customer_id':{'type':Sequelize[_0x3860('0x1')]},'context':{'type':Sequelize[_0x3860('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x3860('0x1')],'defaultValue':'','allowNull':![],'unique':_0x3860('0x2')},'password':{'type':Sequelize[_0x3860('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3860('0x1')],'validate':{'isEmail':!![]},'set':function(_0x56f8c5){this[_0x3860('0x3')](_0x3860('0x4'),typeof _0x56f8c5===_0x3860('0x5')&&_0x56f8c5[_0x3860('0x6')]()?_0x56f8c5[_0x3860('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x3860('0x1')]},'callback':{'type':Sequelize[_0x3860('0x1')]},'review':{'type':Sequelize['ENUM'](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3860('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3860('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3860('0x7')]('yes','no'),'defaultValue':_0x3860('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':_0x3860('0x8'),'allowNull':![]},'stamp':{'type':_0x3860('0xa')},'emailsubject':{'type':Sequelize[_0x3860('0x1')]},'emailbody':{'type':Sequelize[_0x3860('0x1')]},'maxsecs':{'type':Sequelize[_0x3860('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3860('0xc')](_0x3860('0xd'))+_0x3860('0xe')+this['getDataValue'](_0x3860('0xf'));}}}; \ No newline at end of file +var _0xda3f=['fullname','\x20-\x20','exports','STRING','setDataValue','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue'];(function(_0x264d72,_0x3e81b5){var _0x3cfabf=function(_0x423eb4){while(--_0x423eb4){_0x264d72['push'](_0x264d72['shift']());}};_0x3cfabf(++_0x3e81b5);}(_0xda3f,0xec));var _0xfda3=function(_0x32f1b9,_0x592306){_0x32f1b9=_0x32f1b9-0x0;var _0x3184f7=_0xda3f[_0x32f1b9];return _0x3184f7;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'customer_id':{'type':Sequelize[_0xfda3('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xfda3('0x1')]},'fullname':{'type':Sequelize[_0xfda3('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x42bd74){this[_0xfda3('0x2')]('email',typeof _0x42bd74==='string'&&_0x42bd74[_0xfda3('0x3')]()?_0x42bd74[_0xfda3('0x3')]():null);}},'pager':{'type':Sequelize[_0xfda3('0x1')]},'tz':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':_0xfda3('0x4')},'attach':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfda3('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfda3('0x7'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'stamp':{'type':_0xfda3('0x8')},'emailsubject':{'type':Sequelize[_0xfda3('0x1')]},'emailbody':{'type':Sequelize[_0xfda3('0x1')]},'maxsecs':{'type':Sequelize[_0xfda3('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfda3('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xfda3('0xa')](_0xfda3('0xb'))+_0xfda3('0xc')+this[_0xfda3('0xa')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b25f7a0..8587ed2 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 _0xcf2c=['options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','update','getMessages','findOne','pick','filter','mailbox','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','save','then','destroy','get','Voicemails','UserProfileResource','end','error','name','send','index','VoiceMail','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL'];(function(_0x34e4a0,_0x1fd446){var _0x3ead3e=function(_0x47adec){while(--_0x47adec){_0x34e4a0['push'](_0x34e4a0['shift']());}};_0x3ead3e(++_0x1fd446);}(_0xcf2c,0x121));var _0xccf2=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0xcf2c[_0xc69f39];return _0x93be41;};'use strict';var pdf=require(_0xccf2('0x0'));var emlformat=require(_0xccf2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xccf2('0x2'));var jsonpatch=require(_0xccf2('0x3'));var rp=require(_0xccf2('0x4'));var moment=require('moment');var BPromise=require(_0xccf2('0x5'));var Mustache=require(_0xccf2('0x6'));var util=require('util');var path=require(_0xccf2('0x7'));var sox=require(_0xccf2('0x8'));var csv=require(_0xccf2('0x9'));var ejs=require(_0xccf2('0xa'));var fs=require('fs');var _=require(_0xccf2('0xb'));var squel=require(_0xccf2('0xc'));var crypto=require('crypto');var jsforce=require(_0xccf2('0xd'));var deskjs=require(_0xccf2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xccf2('0xf'));var Papa=require(_0xccf2('0x10'));var Redis=require(_0xccf2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xccf2('0x12'));var as=require(_0xccf2('0x13'));var hardwareService=require(_0xccf2('0x14'));var logger=require(_0xccf2('0x15'))(_0xccf2('0x16'));var utils=require(_0xccf2('0x17'));var config=require(_0xccf2('0x18'));var db=require(_0xccf2('0x19'))['db'];function respondWithStatusCode(_0x370495,_0x35b1b9){_0x35b1b9=_0x35b1b9||0xcc;return function(_0x178f54){if(_0x178f54){return _0x370495[_0xccf2('0x1a')](_0x35b1b9);}return _0x370495[_0xccf2('0x1b')](_0x35b1b9)['end']();};}function respondWithResult(_0x1007fc,_0x161107){_0x161107=_0x161107||0xc8;return function(_0x12d016){if(_0x12d016){return _0x1007fc[_0xccf2('0x1b')](_0x161107)[_0xccf2('0x1c')](_0x12d016);}};}function respondWithFilteredResult(_0x35f417,_0x56152e){return function(_0x5453c1){if(_0x5453c1){var _0x53598e=_0x5453c1['count'],_0x12bcb2=_0x56152e[_0xccf2('0x1d')],_0x11d685=_0x56152e[_0xccf2('0x1d')]+_0x56152e[_0xccf2('0x1e')],_0x175b28;if(_0x11d685>=_0x53598e){_0x11d685=_0x53598e;_0x175b28=0xc8;}else{_0x175b28=0xce;}_0x35f417[_0xccf2('0x1b')](_0x175b28);return _0x35f417[_0xccf2('0x1f')](_0xccf2('0x20'),_0x12bcb2+'-'+_0x11d685+'/'+_0x53598e)[_0xccf2('0x1c')](_0x5453c1);}return null;};}function patchUpdates(_0x3dd0dc){return function(_0x124b06){try{jsonpatch['apply'](_0x124b06,_0x3dd0dc,!![]);}catch(_0x50f63a){return BPromise['reject'](_0x50f63a);}return _0x124b06[_0xccf2('0x21')]();};}function saveUpdates(_0x68948a,_0x23b16e){return function(_0x1d61a6){if(_0x1d61a6){return _0x1d61a6['update'](_0x68948a)[_0xccf2('0x22')](function(_0x43212c){return _0x43212c;});}return null;};}function removeEntity(_0x185822,_0x26e98c){return function(_0x2e3944){if(_0x2e3944){return _0x2e3944[_0xccf2('0x23')]()[_0xccf2('0x22')](function(){var _0x3959c5=_0x2e3944[_0xccf2('0x24')]({'plain':!![]});var _0x5da64a=_0xccf2('0x25');return db[_0xccf2('0x26')][_0xccf2('0x23')]({'where':{'type':_0x5da64a,'resourceId':_0x3959c5['id']}})[_0xccf2('0x22')](function(){return _0x2e3944;});})[_0xccf2('0x22')](function(){_0x185822[_0xccf2('0x1b')](0xcc)[_0xccf2('0x27')]();});}};}function handleEntityNotFound(_0x5807d0,_0x4524fe){return function(_0xaaca03){if(!_0xaaca03){_0x5807d0[_0xccf2('0x1a')](0x194);}return _0xaaca03;};}function handleError(_0x53dac6,_0x17a490){_0x17a490=_0x17a490||0x1f4;return function(_0x17fb15){logger[_0xccf2('0x28')](_0x17fb15['stack']);if(_0x17fb15[_0xccf2('0x29')]){delete _0x17fb15[_0xccf2('0x29')];}_0x53dac6[_0xccf2('0x1b')](_0x17a490)[_0xccf2('0x2a')](_0x17fb15);};}exports[_0xccf2('0x2b')]=function(_0x56ab04,_0x1e9447){var _0x5b77f6={},_0x1405d7={},_0x21b2c1={'count':0x0,'rows':[]};var _0x39e234=_['map'](db[_0xccf2('0x2c')]['rawAttributes'],function(_0x51ffd2){return{'name':_0x51ffd2[_0xccf2('0x2d')],'type':_0x51ffd2[_0xccf2('0x2e')][_0xccf2('0x2f')]};});_0x1405d7['model']=_[_0xccf2('0x30')](_0x39e234,_0xccf2('0x29'));_0x1405d7[_0xccf2('0x31')]=_[_0xccf2('0x32')](_0x56ab04['query']);_0x1405d7[_0xccf2('0x33')]=_['intersection'](_0x1405d7[_0xccf2('0x34')],_0x1405d7['query']);_0x5b77f6[_0xccf2('0x35')]=_[_0xccf2('0x36')](_0x1405d7[_0xccf2('0x34')],qs['fields'](_0x56ab04[_0xccf2('0x31')][_0xccf2('0x37')]));_0x5b77f6[_0xccf2('0x35')]=_0x5b77f6[_0xccf2('0x35')][_0xccf2('0x38')]?_0x5b77f6[_0xccf2('0x35')]:_0x1405d7['model'];if(!_0x56ab04[_0xccf2('0x31')][_0xccf2('0x39')]('nolimit')){_0x5b77f6[_0xccf2('0x1e')]=qs[_0xccf2('0x1e')](_0x56ab04[_0xccf2('0x31')]['limit']);_0x5b77f6['offset']=qs[_0xccf2('0x1d')](_0x56ab04[_0xccf2('0x31')][_0xccf2('0x1d')]);}_0x5b77f6[_0xccf2('0x3a')]=qs[_0xccf2('0x3b')](_0x56ab04['query'][_0xccf2('0x3b')]);_0x5b77f6[_0xccf2('0x3c')]=qs[_0xccf2('0x33')](_['pick'](_0x56ab04[_0xccf2('0x31')],_0x1405d7['filters']),_0x39e234);if(_0x56ab04[_0xccf2('0x31')]['filter']){_0x5b77f6[_0xccf2('0x3c')]=_[_0xccf2('0x3d')](_0x5b77f6[_0xccf2('0x3c')],{'$or':_[_0xccf2('0x30')](_0x39e234,function(_0x125ec9){if(_0x125ec9[_0xccf2('0x2e')]!==_0xccf2('0x3e')){var _0x50becc={};_0x50becc[_0x125ec9[_0xccf2('0x29')]]={'$like':'%'+_0x56ab04[_0xccf2('0x31')]['filter']+'%'};return _0x50becc;}})});}_0x5b77f6=_[_0xccf2('0x3d')]({},_0x5b77f6,_0x56ab04[_0xccf2('0x3f')]);var _0x16e0a6={'where':_0x5b77f6[_0xccf2('0x3c')]};return db[_0xccf2('0x2c')][_0xccf2('0x40')](_0x16e0a6)[_0xccf2('0x22')](function(_0x5b7fcd){_0x21b2c1[_0xccf2('0x40')]=_0x5b7fcd;if(_0x56ab04[_0xccf2('0x31')]['includeAll']){_0x5b77f6[_0xccf2('0x41')]=[{'all':!![]}];}return db[_0xccf2('0x2c')][_0xccf2('0x42')](_0x5b77f6);})[_0xccf2('0x22')](function(_0x3b1eb7){_0x21b2c1[_0xccf2('0x43')]=_0x3b1eb7;return _0x21b2c1;})[_0xccf2('0x22')](respondWithFilteredResult(_0x1e9447,_0x5b77f6))[_0xccf2('0x44')](handleError(_0x1e9447,null));};exports[_0xccf2('0x45')]=function(_0x9afeef,_0x3c75a1){var _0x3fd2d6={'raw':!![],'where':{'id':_0x9afeef[_0xccf2('0x46')]['id']}},_0x554aa3={};_0x554aa3[_0xccf2('0x34')]=_[_0xccf2('0x32')](db['VoiceMail'][_0xccf2('0x47')]);_0x554aa3[_0xccf2('0x31')]=_['keys'](_0x9afeef[_0xccf2('0x31')]);_0x554aa3['filters']=_[_0xccf2('0x36')](_0x554aa3[_0xccf2('0x34')],_0x554aa3['query']);_0x3fd2d6[_0xccf2('0x35')]=_[_0xccf2('0x36')](_0x554aa3['model'],qs[_0xccf2('0x37')](_0x9afeef[_0xccf2('0x31')][_0xccf2('0x37')]));_0x3fd2d6[_0xccf2('0x35')]=_0x3fd2d6['attributes'][_0xccf2('0x38')]?_0x3fd2d6[_0xccf2('0x35')]:_0x554aa3[_0xccf2('0x34')];if(_0x9afeef['query'][_0xccf2('0x48')]){_0x3fd2d6[_0xccf2('0x41')]=[{'all':!![]}];}_0x3fd2d6=_[_0xccf2('0x3d')]({},_0x3fd2d6,_0x9afeef['options']);return db[_0xccf2('0x2c')][_0xccf2('0x49')](_0x3fd2d6)['then'](handleEntityNotFound(_0x3c75a1,null))[_0xccf2('0x22')](respondWithResult(_0x3c75a1,null))['catch'](handleError(_0x3c75a1,null));};exports['create']=function(_0x3ef565,_0x33af90){return db[_0xccf2('0x2c')][_0xccf2('0x4a')](_0x3ef565[_0xccf2('0x4b')],{})[_0xccf2('0x22')](function(_0x21662f){var _0x1cf5ce=_0x3ef565[_0xccf2('0x4c')][_0xccf2('0x24')]({'plain':!![]});if(!_0x1cf5ce)throw new Error(_0xccf2('0x4d'));if(_0x1cf5ce['role']===_0xccf2('0x4c')){var _0x34788a=_0x21662f[_0xccf2('0x24')]({'plain':!![]});var _0x573079=_0xccf2('0x25');return db['UserProfileSection'][_0xccf2('0x49')]({'where':{'name':_0x573079,'userProfileId':_0x1cf5ce[_0xccf2('0x4e')]},'raw':!![]})[_0xccf2('0x22')](function(_0x5f9ff1){if(_0x5f9ff1&&_0x5f9ff1[_0xccf2('0x4f')]===0x0){return db['UserProfileResource'][_0xccf2('0x4a')]({'name':_0x34788a[_0xccf2('0x29')],'resourceId':_0x34788a['id'],'type':_0x5f9ff1[_0xccf2('0x29')],'sectionId':_0x5f9ff1['id']},{})[_0xccf2('0x22')](function(){return _0x21662f;});}else{return _0x21662f;}})[_0xccf2('0x44')](function(_0x56df4e){logger[_0xccf2('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56df4e);throw _0x56df4e;});}return _0x21662f;})['then'](respondWithResult(_0x33af90,0xc9))[_0xccf2('0x44')](handleError(_0x33af90,null));};exports[_0xccf2('0x50')]=function(_0x8fa4d7,_0x3057da){if(_0x8fa4d7['body']['id']){delete _0x8fa4d7[_0xccf2('0x4b')]['id'];}return db[_0xccf2('0x2c')][_0xccf2('0x49')]({'where':{'id':_0x8fa4d7['params']['id']}})[_0xccf2('0x22')](handleEntityNotFound(_0x3057da,null))[_0xccf2('0x22')](saveUpdates(_0x8fa4d7[_0xccf2('0x4b')],null))[_0xccf2('0x22')](respondWithResult(_0x3057da,null))[_0xccf2('0x44')](handleError(_0x3057da,null));};exports[_0xccf2('0x23')]=function(_0x597c40,_0x413a84){return db[_0xccf2('0x2c')][_0xccf2('0x49')]({'where':{'id':_0x597c40[_0xccf2('0x46')]['id']}})[_0xccf2('0x22')](handleEntityNotFound(_0x413a84,null))['then'](removeEntity(_0x413a84,null))[_0xccf2('0x44')](handleError(_0x413a84,null));};exports[_0xccf2('0x51')]=function(_0x1142f6,_0x2f5d12,_0x1324cb){return db[_0xccf2('0x2c')][_0xccf2('0x52')]({'where':{'id':_0x1142f6['params']['id']}})[_0xccf2('0x22')](handleEntityNotFound(_0x2f5d12,null))[_0xccf2('0x22')](function(_0x4c63b2){var _0x1b8331;var _0xaeb96={},_0x4e1da3={};_0x4e1da3[_0xccf2('0x34')]=_['keys'](db['VoiceMailMessage'][_0xccf2('0x47')]);_0x4e1da3['query']=_[_0xccf2('0x32')](_0x1142f6[_0xccf2('0x31')]);_0x4e1da3['filters']=_[_0xccf2('0x36')](_0x4e1da3[_0xccf2('0x34')],_0x4e1da3[_0xccf2('0x31')]);_0xaeb96[_0xccf2('0x35')]=_['intersection'](_0x4e1da3[_0xccf2('0x34')],qs['fields'](_0x1142f6['query'][_0xccf2('0x37')]));_0xaeb96['attributes']=_0xaeb96['attributes'][_0xccf2('0x38')]?_0xaeb96[_0xccf2('0x35')]:_0x4e1da3[_0xccf2('0x34')];if(!_0x1142f6[_0xccf2('0x31')][_0xccf2('0x39')]('nolimit')){_0xaeb96[_0xccf2('0x1e')]=qs[_0xccf2('0x1e')](_0x1142f6[_0xccf2('0x31')][_0xccf2('0x1e')]);_0xaeb96[_0xccf2('0x1d')]=qs[_0xccf2('0x1d')](_0x1142f6[_0xccf2('0x31')]['offset']);}_0xaeb96[_0xccf2('0x3a')]=qs['sort'](_0x1142f6[_0xccf2('0x31')]['sort']);_0xaeb96[_0xccf2('0x3c')]=qs[_0xccf2('0x33')](_[_0xccf2('0x53')](_0x1142f6[_0xccf2('0x31')],_0x4e1da3[_0xccf2('0x33')]));if(_0x1142f6[_0xccf2('0x31')][_0xccf2('0x54')]){_0xaeb96['where']=_[_0xccf2('0x3d')](_0xaeb96[_0xccf2('0x3c')],{'$or':_[_0xccf2('0x30')](_0xaeb96[_0xccf2('0x35')],function(_0x25dcc6){var _0x18cd0c={};_0x18cd0c[_0x25dcc6]={'$like':'%'+_0x1142f6[_0xccf2('0x31')][_0xccf2('0x54')]+'%'};return _0x18cd0c;})});}_0xaeb96['where']=_['merge'](_0xaeb96[_0xccf2('0x3c')],{'mailboxuser':_0x4c63b2[_0xccf2('0x55')]});_0xaeb96=_['merge']({},_0xaeb96,_0x1142f6[_0xccf2('0x3f')]);return db[_0xccf2('0x56')][_0xccf2('0x57')](_0xaeb96)['then'](respondWithFilteredResult(_0x2f5d12,_0xaeb96));})[_0xccf2('0x44')](handleError(_0x2f5d12,null));}; \ No newline at end of file +var _0x6d94=['squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','userProfileId','autoAssociation','update','findOne','VoiceMailMessage','order','mailbox','findAndCountAll','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x4ae3e4,_0x97d8e7){var _0x4b1571=function(_0x48786d){while(--_0x48786d){_0x4ae3e4['push'](_0x4ae3e4['shift']());}};_0x4b1571(++_0x97d8e7);}(_0x6d94,0xa0));var _0x46d9=function(_0x20e923,_0x2ef7b6){_0x20e923=_0x20e923-0x0;var _0x4edf3a=_0x6d94[_0x20e923];return _0x4edf3a;};'use strict';var pdf=require(_0x46d9('0x0'));var emlformat=require(_0x46d9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x46d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x46d9('0x3'));var moment=require(_0x46d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x46d9('0x5'));var util=require(_0x46d9('0x6'));var path=require(_0x46d9('0x7'));var sox=require(_0x46d9('0x8'));var csv=require(_0x46d9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x46d9('0xa'));var crypto=require(_0x46d9('0xb'));var jsforce=require(_0x46d9('0xc'));var deskjs=require(_0x46d9('0xd'));var toCsv=require(_0x46d9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x46d9('0xe'));var authService=require(_0x46d9('0xf'));var qs=require(_0x46d9('0x10'));var as=require(_0x46d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46d9('0x12'))(_0x46d9('0x13'));var utils=require(_0x46d9('0x14'));var config=require(_0x46d9('0x15'));var db=require(_0x46d9('0x16'))['db'];function respondWithStatusCode(_0x2dfd1e,_0x4ef43f){_0x4ef43f=_0x4ef43f||0xcc;return function(_0x7bcf64){if(_0x7bcf64){return _0x2dfd1e[_0x46d9('0x17')](_0x4ef43f);}return _0x2dfd1e[_0x46d9('0x18')](_0x4ef43f)[_0x46d9('0x19')]();};}function respondWithResult(_0x28267d,_0x595c3e){_0x595c3e=_0x595c3e||0xc8;return function(_0x1217e1){if(_0x1217e1){return _0x28267d[_0x46d9('0x18')](_0x595c3e)[_0x46d9('0x1a')](_0x1217e1);}};}function respondWithFilteredResult(_0x518dc6,_0x32197b){return function(_0x4a47d9){if(_0x4a47d9){var _0x7005=_0x4a47d9[_0x46d9('0x1b')],_0x283c38=_0x32197b[_0x46d9('0x1c')],_0x52bf07=_0x32197b[_0x46d9('0x1c')]+_0x32197b[_0x46d9('0x1d')],_0x40b44b;if(_0x52bf07>=_0x7005){_0x52bf07=_0x7005;_0x40b44b=0xc8;}else{_0x40b44b=0xce;}_0x518dc6[_0x46d9('0x18')](_0x40b44b);return _0x518dc6['set'](_0x46d9('0x1e'),_0x283c38+'-'+_0x52bf07+'/'+_0x7005)[_0x46d9('0x1a')](_0x4a47d9);}return null;};}function patchUpdates(_0xa3d25d){return function(_0x5a3d9a){try{jsonpatch[_0x46d9('0x1f')](_0x5a3d9a,_0xa3d25d,!![]);}catch(_0x11f9a6){return BPromise[_0x46d9('0x20')](_0x11f9a6);}return _0x5a3d9a[_0x46d9('0x21')]();};}function saveUpdates(_0x2800bd,_0x4161b1){return function(_0x1c6207){if(_0x1c6207){return _0x1c6207['update'](_0x2800bd)[_0x46d9('0x22')](function(_0x4ae8cf){return _0x4ae8cf;});}return null;};}function removeEntity(_0x3dc9ba,_0x463e6e){return function(_0x853b7f){if(_0x853b7f){return _0x853b7f[_0x46d9('0x23')]()[_0x46d9('0x22')](function(){var _0x2b68dd=_0x853b7f[_0x46d9('0x24')]({'plain':!![]});var _0x4a8d83=_0x46d9('0x25');return db[_0x46d9('0x26')]['destroy']({'where':{'type':_0x4a8d83,'resourceId':_0x2b68dd['id']}})[_0x46d9('0x22')](function(){return _0x853b7f;});})[_0x46d9('0x22')](function(){_0x3dc9ba[_0x46d9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44863d,_0xc59d85){return function(_0x4aa1a3){if(!_0x4aa1a3){_0x44863d[_0x46d9('0x17')](0x194);}return _0x4aa1a3;};}function handleError(_0x16e334,_0x5500a8){_0x5500a8=_0x5500a8||0x1f4;return function(_0x3721f6){logger[_0x46d9('0x27')](_0x3721f6[_0x46d9('0x28')]);if(_0x3721f6[_0x46d9('0x29')]){delete _0x3721f6[_0x46d9('0x29')];}_0x16e334[_0x46d9('0x18')](_0x5500a8)[_0x46d9('0x2a')](_0x3721f6);};}exports[_0x46d9('0x2b')]=function(_0x12c3c5,_0x4d3b5f){var _0x6afc93={},_0x5e3a64={},_0x1bc797={'count':0x0,'rows':[]};var _0x1503ba=_[_0x46d9('0x2c')](db['VoiceMail'][_0x46d9('0x2d')],function(_0x16c33a){return{'name':_0x16c33a[_0x46d9('0x2e')],'type':_0x16c33a[_0x46d9('0x2f')][_0x46d9('0x30')]};});_0x5e3a64[_0x46d9('0x31')]=_[_0x46d9('0x2c')](_0x1503ba,_0x46d9('0x29'));_0x5e3a64['query']=_[_0x46d9('0x32')](_0x12c3c5[_0x46d9('0x33')]);_0x5e3a64[_0x46d9('0x34')]=_[_0x46d9('0x35')](_0x5e3a64[_0x46d9('0x31')],_0x5e3a64[_0x46d9('0x33')]);_0x6afc93[_0x46d9('0x36')]=_[_0x46d9('0x35')](_0x5e3a64[_0x46d9('0x31')],qs[_0x46d9('0x37')](_0x12c3c5['query'][_0x46d9('0x37')]));_0x6afc93['attributes']=_0x6afc93['attributes'][_0x46d9('0x38')]?_0x6afc93[_0x46d9('0x36')]:_0x5e3a64[_0x46d9('0x31')];if(!_0x12c3c5['query'][_0x46d9('0x39')](_0x46d9('0x3a'))){_0x6afc93[_0x46d9('0x1d')]=qs[_0x46d9('0x1d')](_0x12c3c5[_0x46d9('0x33')][_0x46d9('0x1d')]);_0x6afc93[_0x46d9('0x1c')]=qs[_0x46d9('0x1c')](_0x12c3c5[_0x46d9('0x33')][_0x46d9('0x1c')]);}_0x6afc93['order']=qs[_0x46d9('0x3b')](_0x12c3c5[_0x46d9('0x33')][_0x46d9('0x3b')]);_0x6afc93[_0x46d9('0x3c')]=qs[_0x46d9('0x34')](_[_0x46d9('0x3d')](_0x12c3c5[_0x46d9('0x33')],_0x5e3a64[_0x46d9('0x34')]),_0x1503ba);if(_0x12c3c5['query'][_0x46d9('0x3e')]){_0x6afc93['where']=_['merge'](_0x6afc93[_0x46d9('0x3c')],{'$or':_['map'](_0x1503ba,function(_0x341c91){if(_0x341c91[_0x46d9('0x2f')]!=='VIRTUAL'){var _0x53eb45={};_0x53eb45[_0x341c91['name']]={'$like':'%'+_0x12c3c5[_0x46d9('0x33')][_0x46d9('0x3e')]+'%'};return _0x53eb45;}})});}_0x6afc93=_[_0x46d9('0x3f')]({},_0x6afc93,_0x12c3c5[_0x46d9('0x40')]);var _0x967b8={'where':_0x6afc93[_0x46d9('0x3c')]};return db[_0x46d9('0x41')]['count'](_0x967b8)[_0x46d9('0x22')](function(_0x1288c3){_0x1bc797[_0x46d9('0x1b')]=_0x1288c3;if(_0x12c3c5['query'][_0x46d9('0x42')]){_0x6afc93[_0x46d9('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x46d9('0x44')](_0x6afc93);})['then'](function(_0x5e50e7){_0x1bc797[_0x46d9('0x45')]=_0x5e50e7;return _0x1bc797;})[_0x46d9('0x22')](respondWithFilteredResult(_0x4d3b5f,_0x6afc93))[_0x46d9('0x46')](handleError(_0x4d3b5f,null));};exports[_0x46d9('0x47')]=function(_0x3d8dcc,_0x43e838){var _0x5a6a2d={'raw':!![],'where':{'id':_0x3d8dcc[_0x46d9('0x48')]['id']}},_0x3af4c0={};_0x3af4c0[_0x46d9('0x31')]=_[_0x46d9('0x32')](db[_0x46d9('0x41')][_0x46d9('0x2d')]);_0x3af4c0[_0x46d9('0x33')]=_[_0x46d9('0x32')](_0x3d8dcc['query']);_0x3af4c0[_0x46d9('0x34')]=_[_0x46d9('0x35')](_0x3af4c0[_0x46d9('0x31')],_0x3af4c0[_0x46d9('0x33')]);_0x5a6a2d['attributes']=_[_0x46d9('0x35')](_0x3af4c0[_0x46d9('0x31')],qs[_0x46d9('0x37')](_0x3d8dcc[_0x46d9('0x33')]['fields']));_0x5a6a2d[_0x46d9('0x36')]=_0x5a6a2d[_0x46d9('0x36')][_0x46d9('0x38')]?_0x5a6a2d[_0x46d9('0x36')]:_0x3af4c0[_0x46d9('0x31')];if(_0x3d8dcc[_0x46d9('0x33')]['includeAll']){_0x5a6a2d[_0x46d9('0x43')]=[{'all':!![]}];}_0x5a6a2d=_[_0x46d9('0x3f')]({},_0x5a6a2d,_0x3d8dcc[_0x46d9('0x40')]);return db[_0x46d9('0x41')][_0x46d9('0x49')](_0x5a6a2d)[_0x46d9('0x22')](handleEntityNotFound(_0x43e838,null))[_0x46d9('0x22')](respondWithResult(_0x43e838,null))[_0x46d9('0x46')](handleError(_0x43e838,null));};exports[_0x46d9('0x4a')]=function(_0x552454,_0x3e1be6){return db[_0x46d9('0x41')][_0x46d9('0x4a')](_0x552454[_0x46d9('0x4b')],{})[_0x46d9('0x22')](function(_0x5acd30){var _0xf5711a=_0x552454[_0x46d9('0x4c')][_0x46d9('0x24')]({'plain':!![]});if(!_0xf5711a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf5711a['role']===_0x46d9('0x4c')){var _0x1c60f2=_0x5acd30[_0x46d9('0x24')]({'plain':!![]});var _0x5b7215=_0x46d9('0x25');return db['UserProfileSection'][_0x46d9('0x49')]({'where':{'name':_0x5b7215,'userProfileId':_0xf5711a[_0x46d9('0x4d')]},'raw':!![]})[_0x46d9('0x22')](function(_0x34b3b7){if(_0x34b3b7&&_0x34b3b7[_0x46d9('0x4e')]===0x0){return db[_0x46d9('0x26')]['create']({'name':_0x1c60f2[_0x46d9('0x29')],'resourceId':_0x1c60f2['id'],'type':_0x34b3b7[_0x46d9('0x29')],'sectionId':_0x34b3b7['id']},{})[_0x46d9('0x22')](function(){return _0x5acd30;});}else{return _0x5acd30;}})[_0x46d9('0x46')](function(_0x1a5f0c){logger[_0x46d9('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a5f0c);throw _0x1a5f0c;});}return _0x5acd30;})[_0x46d9('0x22')](respondWithResult(_0x3e1be6,0xc9))[_0x46d9('0x46')](handleError(_0x3e1be6,null));};exports[_0x46d9('0x4f')]=function(_0x202994,_0x3a980a){if(_0x202994['body']['id']){delete _0x202994['body']['id'];}return db[_0x46d9('0x41')][_0x46d9('0x49')]({'where':{'id':_0x202994['params']['id']}})['then'](handleEntityNotFound(_0x3a980a,null))[_0x46d9('0x22')](saveUpdates(_0x202994['body'],null))[_0x46d9('0x22')](respondWithResult(_0x3a980a,null))[_0x46d9('0x46')](handleError(_0x3a980a,null));};exports[_0x46d9('0x23')]=function(_0x33c9aa,_0x275408){return db[_0x46d9('0x41')]['find']({'where':{'id':_0x33c9aa[_0x46d9('0x48')]['id']}})[_0x46d9('0x22')](handleEntityNotFound(_0x275408,null))[_0x46d9('0x22')](removeEntity(_0x275408,null))['catch'](handleError(_0x275408,null));};exports['getMessages']=function(_0x76b7be,_0x451beb,_0x396669){return db[_0x46d9('0x41')][_0x46d9('0x50')]({'where':{'id':_0x76b7be[_0x46d9('0x48')]['id']}})[_0x46d9('0x22')](handleEntityNotFound(_0x451beb,null))[_0x46d9('0x22')](function(_0x287e37){var _0x9bd947;var _0x3548ca={},_0x259d87={};_0x259d87[_0x46d9('0x31')]=_[_0x46d9('0x32')](db[_0x46d9('0x51')]['rawAttributes']);_0x259d87[_0x46d9('0x33')]=_[_0x46d9('0x32')](_0x76b7be[_0x46d9('0x33')]);_0x259d87[_0x46d9('0x34')]=_[_0x46d9('0x35')](_0x259d87['model'],_0x259d87[_0x46d9('0x33')]);_0x3548ca[_0x46d9('0x36')]=_[_0x46d9('0x35')](_0x259d87[_0x46d9('0x31')],qs[_0x46d9('0x37')](_0x76b7be[_0x46d9('0x33')][_0x46d9('0x37')]));_0x3548ca[_0x46d9('0x36')]=_0x3548ca[_0x46d9('0x36')][_0x46d9('0x38')]?_0x3548ca[_0x46d9('0x36')]:_0x259d87['model'];if(!_0x76b7be['query']['hasOwnProperty'](_0x46d9('0x3a'))){_0x3548ca[_0x46d9('0x1d')]=qs['limit'](_0x76b7be[_0x46d9('0x33')][_0x46d9('0x1d')]);_0x3548ca[_0x46d9('0x1c')]=qs['offset'](_0x76b7be[_0x46d9('0x33')][_0x46d9('0x1c')]);}_0x3548ca[_0x46d9('0x52')]=qs[_0x46d9('0x3b')](_0x76b7be[_0x46d9('0x33')][_0x46d9('0x3b')]);_0x3548ca['where']=qs[_0x46d9('0x34')](_[_0x46d9('0x3d')](_0x76b7be['query'],_0x259d87[_0x46d9('0x34')]));if(_0x76b7be['query'][_0x46d9('0x3e')]){_0x3548ca[_0x46d9('0x3c')]=_[_0x46d9('0x3f')](_0x3548ca[_0x46d9('0x3c')],{'$or':_[_0x46d9('0x2c')](_0x3548ca[_0x46d9('0x36')],function(_0x521039){var _0x1ac96f={};_0x1ac96f[_0x521039]={'$like':'%'+_0x76b7be[_0x46d9('0x33')][_0x46d9('0x3e')]+'%'};return _0x1ac96f;})});}_0x3548ca[_0x46d9('0x3c')]=_[_0x46d9('0x3f')](_0x3548ca[_0x46d9('0x3c')],{'mailboxuser':_0x287e37[_0x46d9('0x53')]});_0x3548ca=_[_0x46d9('0x3f')]({},_0x3548ca,_0x76b7be[_0x46d9('0x40')]);return db[_0x46d9('0x51')][_0x46d9('0x54')](_0x3548ca)['then'](respondWithFilteredResult(_0x451beb,_0x3548ca));})['catch'](handleError(_0x451beb,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 3989147..569cf57 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 _0x2dfb=['rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','moment','bluebird','request-promise','path'];(function(_0x506380,_0x4cc05e){var _0x2d7d52=function(_0x5a7c5f){while(--_0x5a7c5f){_0x506380['push'](_0x506380['shift']());}};_0x2d7d52(++_0x4cc05e);}(_0x2dfb,0x171));var _0xb2df=function(_0x347aa9,_0x4052dc){_0x347aa9=_0x347aa9-0x0;var _0x2954f6=_0x2dfb[_0x347aa9];return _0x2954f6;};'use strict';var _=require(_0xb2df('0x0'));var util=require(_0xb2df('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb2df('0x2'));var BPromise=require(_0xb2df('0x3'));var rp=require(_0xb2df('0x4'));var fs=require('fs');var path=require(_0xb2df('0x5'));var rimraf=require(_0xb2df('0x6'));var config=require(_0xb2df('0x7'));var attributes=require('./voiceMail.attributes');module[_0xb2df('0x8')]=function(_0x428cc5,_0xa56a34){return _0x428cc5[_0xb2df('0x9')](_0xb2df('0xa'),attributes,{'tableName':_0xb2df('0xb'),'paranoid':![],'indexes':[{'name':_0xb2df('0xc'),'fields':[_0xb2df('0xd'),_0xb2df('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf06b=['context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x350281,_0x6e5133){var _0x1eb3e6=function(_0x573d61){while(--_0x573d61){_0x350281['push'](_0x350281['shift']());}};_0x1eb3e6(++_0x6e5133);}(_0xf06b,0x166));var _0xbf06=function(_0x2d13f0,_0x1385d4){_0x2d13f0=_0x2d13f0-0x0;var _0x1e9c78=_0xf06b[_0x2d13f0];return _0x1e9c78;};'use strict';var _=require(_0xbf06('0x0'));var util=require(_0xbf06('0x1'));var logger=require(_0xbf06('0x2'))(_0xbf06('0x3'));var moment=require(_0xbf06('0x4'));var BPromise=require(_0xbf06('0x5'));var rp=require(_0xbf06('0x6'));var fs=require('fs');var path=require(_0xbf06('0x7'));var rimraf=require(_0xbf06('0x8'));var config=require('../../config/environment');var attributes=require(_0xbf06('0x9'));module[_0xbf06('0xa')]=function(_0x286a8c,_0xc028f2){return _0x286a8c[_0xbf06('0xb')](_0xbf06('0xc'),attributes,{'tableName':_0xbf06('0xd'),'paranoid':![],'indexes':[{'name':_0xbf06('0xe'),'fields':[_0xbf06('0xf'),_0xbf06('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 8f4b50b..a1bae56 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 _0x591f=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','bluebird'];(function(_0x35de35,_0x550728){var _0x74089=function(_0x240098){while(--_0x240098){_0x35de35['push'](_0x35de35['shift']());}};_0x74089(++_0x550728);}(_0x591f,0x1d2));var _0xf591=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x591f[_0x355ce8];return _0x1db8b8;};'use strict';var _=require(_0xf591('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf591('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf591('0x2'));var db=require(_0xf591('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf591('0x4'))(_0xf591('0x5'));var config=require(_0xf591('0x6'));var jayson=require(_0xf591('0x7'));var client=jayson[_0xf591('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x278deb,_0x55fa30,_0x3a69df){return new BPromise(function(_0x439745,_0x157203){return client[_0xf591('0x9')](_0x278deb,_0x3a69df)[_0xf591('0xa')](function(_0x306f79){logger[_0xf591('0xb')](_0xf591('0xc'),_0x55fa30,_0xf591('0xd'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x55fa30,'request\x20sent',JSON[_0xf591('0xe')](_0x306f79));if(_0x306f79[_0xf591('0xf')]){if(_0x306f79[_0xf591('0xf')][_0xf591('0x10')]===0x1f4){logger[_0xf591('0xf')]('VoiceMail,\x20%s,\x20%s',_0x55fa30,_0x306f79[_0xf591('0xf')]['message']);return _0x157203(_0x306f79['error'][_0xf591('0x11')]);}logger[_0xf591('0xf')](_0xf591('0xc'),_0x55fa30,_0x306f79[_0xf591('0xf')]['message']);return _0x439745(_0x306f79['error'][_0xf591('0x11')]);}else{logger[_0xf591('0xb')](_0xf591('0xc'),_0x55fa30,_0xf591('0xd'));_0x439745(_0x306f79['result'][_0xf591('0x11')]);}})['catch'](function(_0x4b49ab){logger['error'](_0xf591('0xc'),_0x55fa30,_0x4b49ab);_0x157203(_0x4b49ab);});});} \ No newline at end of file +var _0xc541=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment'];(function(_0x5067c6,_0x3f1e9e){var _0xb5daa3=function(_0x45337e){while(--_0x45337e){_0x5067c6['push'](_0x5067c6['shift']());}};_0xb5daa3(++_0x3f1e9e);}(_0xc541,0x166));var _0x1c54=function(_0x1d930e,_0x20d8b8){_0x1d930e=_0x1d930e-0x0;var _0x5bbd66=_0xc541[_0x1d930e];return _0x5bbd66;};'use strict';var _=require(_0x1c54('0x0'));var util=require('util');var moment=require(_0x1c54('0x1'));var BPromise=require('bluebird');var rs=require(_0x1c54('0x2'));var fs=require('fs');var Redis=require(_0x1c54('0x3'));var db=require(_0x1c54('0x4'))['db'];var utils=require(_0x1c54('0x5'));var logger=require('../../config/logger')(_0x1c54('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c54('0x7'));var client=jayson[_0x1c54('0x8')][_0x1c54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e676e,_0x4da624,_0x2d04a2){return new BPromise(function(_0x1ddfa3,_0x231813){return client['request'](_0x2e676e,_0x2d04a2)[_0x1c54('0xa')](function(_0x23dadc){logger['info'](_0x1c54('0xb'),_0x4da624,_0x1c54('0xc'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4da624,_0x1c54('0xc'),JSON[_0x1c54('0xd')](_0x23dadc));if(_0x23dadc[_0x1c54('0xe')]){if(_0x23dadc[_0x1c54('0xe')][_0x1c54('0xf')]===0x1f4){logger['error'](_0x1c54('0xb'),_0x4da624,_0x23dadc['error'][_0x1c54('0x10')]);return _0x231813(_0x23dadc['error'][_0x1c54('0x10')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x4da624,_0x23dadc[_0x1c54('0xe')][_0x1c54('0x10')]);return _0x1ddfa3(_0x23dadc[_0x1c54('0xe')]['message']);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x4da624,_0x1c54('0xc'));_0x1ddfa3(_0x23dadc['result']['message']);}})[_0x1c54('0x11')](function(_0x706025){logger[_0x1c54('0xe')](_0x1c54('0xb'),_0x4da624,_0x706025);_0x231813(_0x706025);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 3a4d7c0..17c8fb2 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 _0xf494=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x4b0b17,_0x1bb70f){var _0x670de5=function(_0x2e7163){while(--_0x2e7163){_0x4b0b17['push'](_0x4b0b17['shift']());}};_0x670de5(++_0x1bb70f);}(_0xf494,0x1c6));var _0x4f49=function(_0x4b78ae,_0x2b474f){_0x4b78ae=_0x4b78ae-0x0;var _0x4ae393=_0xf494[_0x4b78ae];return _0x4ae393;};'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')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4f49('0x9')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')]('/:id',auth[_0x4f49('0xa')](),controller[_0x4f49('0x12')]);router['delete'](_0x4f49('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4f49('0x13')]=router; \ No newline at end of file +var _0xe2fe=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','/:id','get','download','create','delete','exports','multer'];(function(_0x2511c6,_0x5859ca){var _0x10a803=function(_0x3fb3a2){while(--_0x3fb3a2){_0x2511c6['push'](_0x2511c6['shift']());}};_0x10a803(++_0x5859ca);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var auth=require(_0xee2f('0x3'));var interaction=require(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var controller=require(_0xee2f('0x6'));router['get']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0x8')]);router['get'](_0xee2f('0x9'),auth[_0xee2f('0x7')](),controller['show']);router[_0xee2f('0xa')]('/:id/download',auth[_0xee2f('0x7')](),controller[_0xee2f('0xb')]);router['post']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xee2f('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xee2f('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index cf13797..d5d9ae7 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 _0x9ba2=['TIMESTAMP','exports','STRING','long'];(function(_0x18b25f,_0x211d30){var _0x5795ff=function(_0x2db9c7){while(--_0x2db9c7){_0x18b25f['push'](_0x18b25f['shift']());}};_0x5795ff(++_0x211d30);}(_0x9ba2,0xed));var _0x29ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ba2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x29ba('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x289be3){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'context':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'callerid':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'origtime':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'duration':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x29ba('0x2')),'defaultValue':null},'flag':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x29ba('0x3'),'allowNull':![]}}; \ No newline at end of file +var _0xa0d5=['STRING','BLOB','TIMESTAMP','exports','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0d5,0x1a2));var _0x5a0d=function(_0x3ba335,_0x33b0fb){_0x3ba335=_0x3ba335-0x0;var _0x5dd44a=_0xa0d5[_0x3ba335];return _0x5dd44a;};'use strict';var Sequelize=require('sequelize');module[_0x5a0d('0x0')]={'name':{'type':Sequelize[_0x5a0d('0x1')],'get':function(_0x3485ca){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x5a0d('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5a0d('0x2')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5a0d('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5a0d('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0x5a0d('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x5a0d('0x3')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5a0d('0x2')],'defaultValue':''},'stamp':{'type':_0x5a0d('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 783677e..d216c78 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 _0xf4eb=['filter','where','merge','includeAll','findAll','rows','catch','params','length','include','options','find','create','body','download','recording','msg_id','Sequelize','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','set','html-pdf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','apply','save','update','then','destroy','sendStatus','error','stack','name','VoiceMailMessage','rawAttributes','type','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort'];(function(_0x5e478b,_0x35e449){var _0x39a83d=function(_0x516dec){while(--_0x516dec){_0x5e478b['push'](_0x5e478b['shift']());}};_0x39a83d(++_0x35e449);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5e5e7c,_0x2cb10f){_0x5e5e7c=_0x5e5e7c-0x0;var _0x57f929=_0xf4eb[_0x5e5e7c];return _0x57f929;};'use strict';var pdf=require(_0xbf4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf4e('0x2'));var util=require(_0xbf4e('0x3'));var path=require(_0xbf4e('0x4'));var sox=require(_0xbf4e('0x5'));var csv=require(_0xbf4e('0x6'));var ejs=require(_0xbf4e('0x7'));var fs=require('fs');var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x6'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var db=require(_0xbf4e('0x12'))['db'];function respondWithStatusCode(_0x54a96e,_0x17fd01){_0x17fd01=_0x17fd01||0xcc;return function(_0x5a3035){if(_0x5a3035){return _0x54a96e['sendStatus'](_0x17fd01);}return _0x54a96e[_0xbf4e('0x13')](_0x17fd01)[_0xbf4e('0x14')]();};}function respondWithResult(_0x1e029b,_0x302841){_0x302841=_0x302841||0xc8;return function(_0x3b74bd){if(_0x3b74bd){return _0x1e029b[_0xbf4e('0x13')](_0x302841)['json'](_0x3b74bd);}};}function respondWithFilteredResult(_0x59fb15,_0x180432){return function(_0x1735ae){if(_0x1735ae){var _0x28fc6b=_0x1735ae[_0xbf4e('0x15')],_0x542909=_0x180432[_0xbf4e('0x16')],_0x14110b=_0x180432['offset']+_0x180432[_0xbf4e('0x17')],_0x2c292c;if(_0x14110b>=_0x28fc6b){_0x14110b=_0x28fc6b;_0x2c292c=0xc8;}else{_0x2c292c=0xce;}_0x59fb15['status'](_0x2c292c);return _0x59fb15['set']('Content-Range',_0x542909+'-'+_0x14110b+'/'+_0x28fc6b)['json'](_0x1735ae);}return null;};}function patchUpdates(_0x35992b){return function(_0x1ca73c){try{jsonpatch[_0xbf4e('0x18')](_0x1ca73c,_0x35992b,!![]);}catch(_0x4d9c2a){return BPromise['reject'](_0x4d9c2a);}return _0x1ca73c[_0xbf4e('0x19')]();};}function saveUpdates(_0x9a46ee,_0x3be138){return function(_0x3a875b){if(_0x3a875b){return _0x3a875b[_0xbf4e('0x1a')](_0x9a46ee)[_0xbf4e('0x1b')](function(_0x415963){return _0x415963;});}return null;};}function removeEntity(_0x3d642a,_0xd09e12){return function(_0x376832){if(_0x376832){return _0x376832[_0xbf4e('0x1c')]()['then'](function(){_0x3d642a[_0xbf4e('0x13')](0xcc)[_0xbf4e('0x14')]();});}};}function handleEntityNotFound(_0x51648c,_0x31e3f5){return function(_0x30994d){if(!_0x30994d){_0x51648c[_0xbf4e('0x1d')](0x194);}return _0x30994d;};}function handleError(_0x1bda8b,_0x3a5d72){_0x3a5d72=_0x3a5d72||0x1f4;return function(_0x4a0243){logger[_0xbf4e('0x1e')](_0x4a0243[_0xbf4e('0x1f')]);if(_0x4a0243[_0xbf4e('0x20')]){delete _0x4a0243['name'];}_0x1bda8b[_0xbf4e('0x13')](_0x3a5d72)['send'](_0x4a0243);};}exports['index']=function(_0x2bfccf,_0x5a0a9b){var _0x38c923={},_0x315df3={},_0x4021a9={'count':0x0,'rows':[]};var _0x41f918=_['map'](db[_0xbf4e('0x21')][_0xbf4e('0x22')],function(_0x43879d){return{'name':_0x43879d['fieldName'],'type':_0x43879d[_0xbf4e('0x23')]['key']};});_0x315df3[_0xbf4e('0x24')]=_[_0xbf4e('0x25')](_[_0xbf4e('0x26')](_0x41f918,'name'),[_0xbf4e('0x20')]);_0x315df3[_0xbf4e('0x27')]=_[_0xbf4e('0x28')](_0x2bfccf[_0xbf4e('0x27')]);_0x315df3[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x315df3['model'],_0x315df3[_0xbf4e('0x27')]);_0x38c923[_0xbf4e('0x2b')]=_['intersection'](_0x315df3[_0xbf4e('0x24')],qs[_0xbf4e('0x2c')](_0x2bfccf['query'][_0xbf4e('0x2c')]));_0x38c923['attributes']=_0x38c923[_0xbf4e('0x2b')]['length']?_0x38c923[_0xbf4e('0x2b')]:_0x315df3[_0xbf4e('0x24')];if(!_0x2bfccf[_0xbf4e('0x27')]['hasOwnProperty'](_0xbf4e('0x2d'))){_0x38c923[_0xbf4e('0x17')]=qs[_0xbf4e('0x17')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x17')]);_0x38c923[_0xbf4e('0x16')]=qs['offset'](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x16')]);}_0x38c923[_0xbf4e('0x2e')]=qs[_0xbf4e('0x2f')](_0x2bfccf[_0xbf4e('0x27')]['sort']);_0x38c923['where']=qs['filters'](_['pick'](_0x2bfccf[_0xbf4e('0x27')],_0x315df3[_0xbf4e('0x29')]),_0x41f918);if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x30')]){_0x38c923[_0xbf4e('0x31')]=_[_0xbf4e('0x32')](_0x38c923[_0xbf4e('0x31')],{'$or':_[_0xbf4e('0x26')](_0x41f918,function(_0x1f36aa){if(_0x1f36aa['type']!=='VIRTUAL'){var _0x303fd8={};_0x303fd8[_0x1f36aa[_0xbf4e('0x20')]]={'$like':'%'+_0x2bfccf[_0xbf4e('0x27')]['filter']+'%'};return _0x303fd8;}})});}_0x38c923=_[_0xbf4e('0x32')]({},_0x38c923,_0x2bfccf['options']);var _0x370d90={'where':_0x38c923[_0xbf4e('0x31')]};return db[_0xbf4e('0x21')][_0xbf4e('0x15')](_0x370d90)['then'](function(_0x31d8dc){_0x4021a9[_0xbf4e('0x15')]=_0x31d8dc;if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x33')]){_0x38c923['include']=[{'all':!![]}];}return db[_0xbf4e('0x21')][_0xbf4e('0x34')](_0x38c923);})[_0xbf4e('0x1b')](function(_0x29fe9d){_0x4021a9[_0xbf4e('0x35')]=_0x29fe9d;return _0x4021a9;})[_0xbf4e('0x1b')](respondWithFilteredResult(_0x5a0a9b,_0x38c923))[_0xbf4e('0x36')](handleError(_0x5a0a9b,null));};exports['show']=function(_0x176166,_0x7b3a94){var _0x518400={'raw':!![],'where':{'id':_0x176166[_0xbf4e('0x37')]['id']}},_0x47d6f2={};_0x47d6f2[_0xbf4e('0x24')]=_['keys'](db['VoiceMailMessage'][_0xbf4e('0x22')]);_0x47d6f2[_0xbf4e('0x27')]=_[_0xbf4e('0x28')](_0x176166[_0xbf4e('0x27')]);_0x47d6f2[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x47d6f2['model'],_0x47d6f2[_0xbf4e('0x27')]);_0x518400[_0xbf4e('0x2b')]=_['intersection'](_0x47d6f2['model'],qs['fields'](_0x176166['query'][_0xbf4e('0x2c')]));_0x518400['attributes']=_0x518400[_0xbf4e('0x2b')][_0xbf4e('0x38')]?_0x518400['attributes']:_0x47d6f2['model'];if(_0x176166[_0xbf4e('0x27')][_0xbf4e('0x33')]){_0x518400[_0xbf4e('0x39')]=[{'all':!![]}];}_0x518400=_[_0xbf4e('0x32')]({},_0x518400,_0x176166[_0xbf4e('0x3a')]);return db['VoiceMailMessage'][_0xbf4e('0x3b')](_0x518400)[_0xbf4e('0x1b')](handleEntityNotFound(_0x7b3a94,null))[_0xbf4e('0x1b')](respondWithResult(_0x7b3a94,null))[_0xbf4e('0x36')](handleError(_0x7b3a94,null));};exports[_0xbf4e('0x3c')]=function(_0x1bc421,_0x4060c7){return db[_0xbf4e('0x21')]['create'](_0x1bc421[_0xbf4e('0x3d')],{})[_0xbf4e('0x1b')](respondWithResult(_0x4060c7,0xc9))[_0xbf4e('0x36')](handleError(_0x4060c7,null));};exports[_0xbf4e('0x1a')]=function(_0x9bc1fe,_0x1198e8){if(_0x9bc1fe[_0xbf4e('0x3d')]['id']){delete _0x9bc1fe[_0xbf4e('0x3d')]['id'];}return db[_0xbf4e('0x21')][_0xbf4e('0x3b')]({'where':{'id':_0x9bc1fe[_0xbf4e('0x37')]['id']}})[_0xbf4e('0x1b')](handleEntityNotFound(_0x1198e8,null))[_0xbf4e('0x1b')](saveUpdates(_0x9bc1fe[_0xbf4e('0x3d')],null))[_0xbf4e('0x1b')](respondWithResult(_0x1198e8,null))[_0xbf4e('0x36')](handleError(_0x1198e8,null));};exports[_0xbf4e('0x1c')]=function(_0x5492bf,_0x22d8ef){return db[_0xbf4e('0x21')][_0xbf4e('0x3b')]({'where':{'id':_0x5492bf['params']['id']}})[_0xbf4e('0x1b')](handleEntityNotFound(_0x22d8ef,null))['then'](removeEntity(_0x22d8ef,null))['catch'](handleError(_0x22d8ef,null));};exports[_0xbf4e('0x3e')]=function(_0x200393,_0x4d32b3,_0x22e73b){return db[_0xbf4e('0x21')][_0xbf4e('0x3b')]({'where':{'id':_0x200393[_0xbf4e('0x37')]['id']},'attributes':['id',_0xbf4e('0x3f'),_0xbf4e('0x40')]})[_0xbf4e('0x1b')](handleEntityNotFound(_0x4d32b3,null))[_0xbf4e('0x1b')](function(_0x3cd61b){if(_0x3cd61b){if(!_0x3cd61b[_0xbf4e('0x3f')]){throw new db[(_0xbf4e('0x41'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0xad8934={'Content-Type':_0xbf4e('0x42'),'Content-Disposition':_0xbf4e('0x43')};if(_0x3cd61b['msg_id']){_0xad8934[_0xbf4e('0x44')]=_0xbf4e('0x45')+_0x3cd61b['msg_id']+'.wav\x22';}_0x4d32b3[_0xbf4e('0x46')](_0xad8934);return _0x4d32b3['send'](new Buffer(_0x3cd61b['recording']));}})[_0xbf4e('0x36')](handleError(_0x4d32b3,null));}; \ No newline at end of file +var _0x85b5=['VoiceMailMessage','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','then','includeAll','include','findAll','catch','show','find','create','body','update','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','set','html-pdf','eml-format','zip-dir','request-promise','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','reject','save','destroy','error','stack','name','send','index','map'];(function(_0x50922d,_0x175758){var _0x26051c=function(_0x5277a1){while(--_0x5277a1){_0x50922d['push'](_0x50922d['shift']());}};_0x26051c(++_0x175758);}(_0x85b5,0x7f));var _0x585b=function(_0x368a45,_0x5067a2){_0x368a45=_0x368a45-0x0;var _0x45f804=_0x85b5[_0x368a45];return _0x45f804;};'use strict';var pdf=require(_0x585b('0x0'));var emlformat=require(_0x585b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x585b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x585b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x585b('0x4'));var util=require('util');var path=require(_0x585b('0x5'));var sox=require(_0x585b('0x6'));var csv=require(_0x585b('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x585b('0x8'));var squel=require('squel');var crypto=require(_0x585b('0x9'));var jsforce=require(_0x585b('0xa'));var deskjs=require(_0x585b('0xb'));var toCsv=require(_0x585b('0x7'));var querystring=require('querystring');var Papa=require(_0x585b('0xc'));var Redis=require(_0x585b('0xd'));var authService=require(_0x585b('0xe'));var qs=require(_0x585b('0xf'));var as=require(_0x585b('0x10'));var hardwareService=require(_0x585b('0x11'));var logger=require(_0x585b('0x12'))('api');var utils=require(_0x585b('0x13'));var config=require('../../config/environment');var db=require(_0x585b('0x14'))['db'];function respondWithStatusCode(_0x479304,_0x16d608){_0x16d608=_0x16d608||0xcc;return function(_0x35bda0){if(_0x35bda0){return _0x479304[_0x585b('0x15')](_0x16d608);}return _0x479304['status'](_0x16d608)[_0x585b('0x16')]();};}function respondWithResult(_0x8f10b4,_0x3d15ed){_0x3d15ed=_0x3d15ed||0xc8;return function(_0x299ee4){if(_0x299ee4){return _0x8f10b4[_0x585b('0x17')](_0x3d15ed)[_0x585b('0x18')](_0x299ee4);}};}function respondWithFilteredResult(_0x394361,_0x5ebc1a){return function(_0x2f827f){if(_0x2f827f){var _0x41f50d=_0x2f827f['count'],_0x4c094e=_0x5ebc1a['offset'],_0x4e2a41=_0x5ebc1a[_0x585b('0x19')]+_0x5ebc1a[_0x585b('0x1a')],_0xd53614;if(_0x4e2a41>=_0x41f50d){_0x4e2a41=_0x41f50d;_0xd53614=0xc8;}else{_0xd53614=0xce;}_0x394361[_0x585b('0x17')](_0xd53614);return _0x394361['set'](_0x585b('0x1b'),_0x4c094e+'-'+_0x4e2a41+'/'+_0x41f50d)[_0x585b('0x18')](_0x2f827f);}return null;};}function patchUpdates(_0x326a4e){return function(_0x31f5c2){try{jsonpatch['apply'](_0x31f5c2,_0x326a4e,!![]);}catch(_0xec725d){return BPromise[_0x585b('0x1c')](_0xec725d);}return _0x31f5c2[_0x585b('0x1d')]();};}function saveUpdates(_0x5dd006,_0x5200ec){return function(_0x6bea29){if(_0x6bea29){return _0x6bea29['update'](_0x5dd006)['then'](function(_0x29e033){return _0x29e033;});}return null;};}function removeEntity(_0xb8b33a,_0x48d9f8){return function(_0x183308){if(_0x183308){return _0x183308[_0x585b('0x1e')]()['then'](function(){_0xb8b33a[_0x585b('0x17')](0xcc)[_0x585b('0x16')]();});}};}function handleEntityNotFound(_0x2122e0,_0x5bf9e4){return function(_0x1c8a7b){if(!_0x1c8a7b){_0x2122e0['sendStatus'](0x194);}return _0x1c8a7b;};}function handleError(_0x3c861c,_0x10dd42){_0x10dd42=_0x10dd42||0x1f4;return function(_0x1a3935){logger[_0x585b('0x1f')](_0x1a3935[_0x585b('0x20')]);if(_0x1a3935[_0x585b('0x21')]){delete _0x1a3935[_0x585b('0x21')];}_0x3c861c[_0x585b('0x17')](_0x10dd42)[_0x585b('0x22')](_0x1a3935);};}exports[_0x585b('0x23')]=function(_0x7d8984,_0x35075c){var _0x11dc56={},_0x476ed9={},_0x183e75={'count':0x0,'rows':[]};var _0x554099=_[_0x585b('0x24')](db[_0x585b('0x25')][_0x585b('0x26')],function(_0x2cf48a){return{'name':_0x2cf48a['fieldName'],'type':_0x2cf48a['type'][_0x585b('0x27')]};});_0x476ed9[_0x585b('0x28')]=_['differenceBy'](_[_0x585b('0x24')](_0x554099,_0x585b('0x21')),['name']);_0x476ed9[_0x585b('0x29')]=_[_0x585b('0x2a')](_0x7d8984[_0x585b('0x29')]);_0x476ed9[_0x585b('0x2b')]=_[_0x585b('0x2c')](_0x476ed9[_0x585b('0x28')],_0x476ed9[_0x585b('0x29')]);_0x11dc56[_0x585b('0x2d')]=_[_0x585b('0x2c')](_0x476ed9[_0x585b('0x28')],qs['fields'](_0x7d8984[_0x585b('0x29')][_0x585b('0x2e')]));_0x11dc56[_0x585b('0x2d')]=_0x11dc56['attributes'][_0x585b('0x2f')]?_0x11dc56[_0x585b('0x2d')]:_0x476ed9[_0x585b('0x28')];if(!_0x7d8984['query'][_0x585b('0x30')](_0x585b('0x31'))){_0x11dc56[_0x585b('0x1a')]=qs[_0x585b('0x1a')](_0x7d8984['query']['limit']);_0x11dc56[_0x585b('0x19')]=qs[_0x585b('0x19')](_0x7d8984[_0x585b('0x29')][_0x585b('0x19')]);}_0x11dc56[_0x585b('0x32')]=qs['sort'](_0x7d8984[_0x585b('0x29')][_0x585b('0x33')]);_0x11dc56[_0x585b('0x34')]=qs[_0x585b('0x2b')](_[_0x585b('0x35')](_0x7d8984['query'],_0x476ed9['filters']),_0x554099);if(_0x7d8984['query'][_0x585b('0x36')]){_0x11dc56[_0x585b('0x34')]=_[_0x585b('0x37')](_0x11dc56[_0x585b('0x34')],{'$or':_[_0x585b('0x24')](_0x554099,function(_0x2d2414){if(_0x2d2414[_0x585b('0x38')]!==_0x585b('0x39')){var _0x6cec28={};_0x6cec28[_0x2d2414['name']]={'$like':'%'+_0x7d8984[_0x585b('0x29')][_0x585b('0x36')]+'%'};return _0x6cec28;}})});}_0x11dc56=_['merge']({},_0x11dc56,_0x7d8984[_0x585b('0x3a')]);var _0x3bf1bd={'where':_0x11dc56[_0x585b('0x34')]};return db[_0x585b('0x25')][_0x585b('0x3b')](_0x3bf1bd)[_0x585b('0x3c')](function(_0x58bf4c){_0x183e75[_0x585b('0x3b')]=_0x58bf4c;if(_0x7d8984[_0x585b('0x29')][_0x585b('0x3d')]){_0x11dc56[_0x585b('0x3e')]=[{'all':!![]}];}return db[_0x585b('0x25')][_0x585b('0x3f')](_0x11dc56);})[_0x585b('0x3c')](function(_0xc543ca){_0x183e75['rows']=_0xc543ca;return _0x183e75;})[_0x585b('0x3c')](respondWithFilteredResult(_0x35075c,_0x11dc56))[_0x585b('0x40')](handleError(_0x35075c,null));};exports[_0x585b('0x41')]=function(_0x4c5a14,_0x402334){var _0x698a0f={'raw':!![],'where':{'id':_0x4c5a14['params']['id']}},_0x2b6b1b={};_0x2b6b1b[_0x585b('0x28')]=_[_0x585b('0x2a')](db['VoiceMailMessage']['rawAttributes']);_0x2b6b1b[_0x585b('0x29')]=_['keys'](_0x4c5a14[_0x585b('0x29')]);_0x2b6b1b['filters']=_[_0x585b('0x2c')](_0x2b6b1b[_0x585b('0x28')],_0x2b6b1b['query']);_0x698a0f[_0x585b('0x2d')]=_['intersection'](_0x2b6b1b['model'],qs['fields'](_0x4c5a14[_0x585b('0x29')]['fields']));_0x698a0f[_0x585b('0x2d')]=_0x698a0f[_0x585b('0x2d')]['length']?_0x698a0f[_0x585b('0x2d')]:_0x2b6b1b[_0x585b('0x28')];if(_0x4c5a14[_0x585b('0x29')]['includeAll']){_0x698a0f['include']=[{'all':!![]}];}_0x698a0f=_['merge']({},_0x698a0f,_0x4c5a14[_0x585b('0x3a')]);return db[_0x585b('0x25')][_0x585b('0x42')](_0x698a0f)[_0x585b('0x3c')](handleEntityNotFound(_0x402334,null))['then'](respondWithResult(_0x402334,null))[_0x585b('0x40')](handleError(_0x402334,null));};exports[_0x585b('0x43')]=function(_0x30bf1c,_0x3a7fe2){return db['VoiceMailMessage'][_0x585b('0x43')](_0x30bf1c[_0x585b('0x44')],{})[_0x585b('0x3c')](respondWithResult(_0x3a7fe2,0xc9))[_0x585b('0x40')](handleError(_0x3a7fe2,null));};exports[_0x585b('0x45')]=function(_0x5ca83d,_0x492f3f){if(_0x5ca83d['body']['id']){delete _0x5ca83d[_0x585b('0x44')]['id'];}return db['VoiceMailMessage'][_0x585b('0x42')]({'where':{'id':_0x5ca83d['params']['id']}})['then'](handleEntityNotFound(_0x492f3f,null))['then'](saveUpdates(_0x5ca83d[_0x585b('0x44')],null))[_0x585b('0x3c')](respondWithResult(_0x492f3f,null))['catch'](handleError(_0x492f3f,null));};exports['destroy']=function(_0x2d6d70,_0x40dd9f){return db[_0x585b('0x25')]['find']({'where':{'id':_0x2d6d70[_0x585b('0x46')]['id']}})['then'](handleEntityNotFound(_0x40dd9f,null))[_0x585b('0x3c')](removeEntity(_0x40dd9f,null))['catch'](handleError(_0x40dd9f,null));};exports[_0x585b('0x47')]=function(_0x5a2034,_0x3b96db,_0x53c543){return db[_0x585b('0x25')][_0x585b('0x42')]({'where':{'id':_0x5a2034[_0x585b('0x46')]['id']},'attributes':['id',_0x585b('0x48'),_0x585b('0x49')]})['then'](handleEntityNotFound(_0x3b96db,null))[_0x585b('0x3c')](function(_0x2ef157){if(_0x2ef157){if(!_0x2ef157[_0x585b('0x48')]){throw new db[(_0x585b('0x4a'))][(_0x585b('0x4b'))](_0x585b('0x4c'));}var _0x5d7f10={'Content-Type':_0x585b('0x4d'),'Content-Disposition':_0x585b('0x4e')};if(_0x2ef157[_0x585b('0x49')]){_0x5d7f10[_0x585b('0x4f')]='attachment;\x20filename=\x22'+_0x2ef157[_0x585b('0x49')]+_0x585b('0x50');}_0x3b96db[_0x585b('0x51')](_0x5d7f10);return _0x3b96db['send'](new Buffer(_0x2ef157['recording']));}})['catch'](handleError(_0x3b96db,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c83a0c7..1883f24 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 _0x1619=['request-promise','rimraf','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','../../config/logger','moment','bluebird'];(function(_0x167a65,_0xa502d4){var _0x2e6e10=function(_0x2ba5f8){while(--_0x2ba5f8){_0x167a65['push'](_0x167a65['shift']());}};_0x2e6e10(++_0xa502d4);}(_0x1619,0x189));var _0x9161=function(_0x371d87,_0x147fab){_0x371d87=_0x371d87-0x0;var _0x31100e=_0x1619[_0x371d87];return _0x31100e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9161('0x0'))('api');var moment=require(_0x9161('0x1'));var BPromise=require(_0x9161('0x2'));var rp=require(_0x9161('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9161('0x4'));var config=require('../../config/environment');var attributes=require(_0x9161('0x5'));module['exports']=function(_0x50ed78,_0x1b006d){return _0x50ed78[_0x9161('0x6')]('VoiceMailMessage',attributes,{'tableName':_0x9161('0x7'),'paranoid':![],'indexes':[{'name':_0x9161('0x8'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x0c6b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','dir'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0xe59eee,_0x4205f6){_0xe59eee=_0xe59eee-0x0;var _0x424589=_0x0c6b[_0xe59eee];return _0x424589;};'use strict';var _=require(_0xb0c6('0x0'));var util=require('util');var logger=require(_0xb0c6('0x1'))(_0xb0c6('0x2'));var moment=require(_0xb0c6('0x3'));var BPromise=require(_0xb0c6('0x4'));var rp=require(_0xb0c6('0x5'));var fs=require('fs');var path=require(_0xb0c6('0x6'));var rimraf=require(_0xb0c6('0x7'));var config=require(_0xb0c6('0x8'));var attributes=require(_0xb0c6('0x9'));module[_0xb0c6('0xa')]=function(_0xc26f64,_0x56c7c9){return _0xc26f64['define']('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xb0c6('0xb'),'fields':[_0xb0c6('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 3f63cbd..198401d 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 _0x1967=['then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x1967,0x173));var _0x7196=function(_0x1e3248,_0x150ed2){_0x1e3248=_0x1e3248-0x0;var _0x20bfc1=_0x1967[_0x1e3248];return _0x20bfc1;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x33199e,_0x428ded){var _0x2eef3c=function(_0x41a97a){while(--_0x41a97a){_0x33199e['push'](_0x33199e['shift']());}};_0x2eef3c(++_0x428ded);}(_0x14a0,0x8e));var _0x014a=function(_0x5150b1,_0x1eeec2){_0x5150b1=_0x5150b1-0x0;var _0x5c0639=_0x14a0[_0x5150b1];return _0x5c0639;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 742a51d..f756245 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 _0xd198=['../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','/:id/sounds','post','addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3a3b29,_0x54ec1e){var _0x34d909=function(_0x3c4f0b){while(--_0x3c4f0b){_0x3a3b29['push'](_0x3a3b29['shift']());}};_0x34d909(++_0x54ec1e);}(_0xd198,0x7e));var _0x8d19=function(_0xb28d42,_0x36eeaf){_0xb28d42=_0xb28d42-0x0;var _0x496af2=_0xd198[_0xb28d42];return _0x496af2;};'use strict';var multer=require(_0x8d19('0x0'));var util=require(_0x8d19('0x1'));var path=require('path');var timeout=require(_0x8d19('0x2'));var express=require(_0x8d19('0x3'));var router=express[_0x8d19('0x4')]();var auth=require(_0x8d19('0x5'));var interaction=require(_0x8d19('0x6'));var config=require(_0x8d19('0x7'));var controller=require(_0x8d19('0x8'));router['get']('/',auth[_0x8d19('0x9')](),controller[_0x8d19('0xa')]);router[_0x8d19('0xb')](_0x8d19('0xc'),auth[_0x8d19('0x9')](),controller['show']);router[_0x8d19('0xb')](_0x8d19('0xd'),auth[_0x8d19('0x9')](),controller['getSounds']);router[_0x8d19('0xe')]('/',auth[_0x8d19('0x9')](),controller['create']);router[_0x8d19('0xe')](_0x8d19('0xd'),auth['isAuthenticated'](),controller[_0x8d19('0xf')]);router[_0x8d19('0x10')](_0x8d19('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8d19('0x11')](_0x8d19('0xc'),auth['isAuthenticated'](),controller[_0x8d19('0x12')]);router[_0x8d19('0x11')](_0x8d19('0x13'),auth[_0x8d19('0x9')](),controller[_0x8d19('0x14')]);module[_0x8d19('0x15')]=router; \ No newline at end of file +var _0x5614=['update','delete','destroy','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','create','addSound','put'];(function(_0x32f850,_0x6ba444){var _0x38e424=function(_0x14e281){while(--_0x14e281){_0x32f850['push'](_0x32f850['shift']());}};_0x38e424(++_0x6ba444);}(_0x5614,0x82));var _0x4561=function(_0x1936db,_0x110df7){_0x1936db=_0x1936db-0x0;var _0x43b5c2=_0x5614[_0x1936db];return _0x43b5c2;};'use strict';var multer=require(_0x4561('0x0'));var util=require(_0x4561('0x1'));var path=require(_0x4561('0x2'));var timeout=require(_0x4561('0x3'));var express=require(_0x4561('0x4'));var router=express[_0x4561('0x5')]();var auth=require(_0x4561('0x6'));var interaction=require(_0x4561('0x7'));var config=require(_0x4561('0x8'));var controller=require(_0x4561('0x9'));router[_0x4561('0xa')]('/',auth[_0x4561('0xb')](),controller['index']);router['get'](_0x4561('0xc'),auth['isAuthenticated'](),controller[_0x4561('0xd')]);router[_0x4561('0xa')](_0x4561('0xe'),auth[_0x4561('0xb')](),controller[_0x4561('0xf')]);router[_0x4561('0x10')]('/',auth[_0x4561('0xb')](),controller[_0x4561('0x11')]);router[_0x4561('0x10')]('/:id/sounds',auth[_0x4561('0xb')](),controller[_0x4561('0x12')]);router[_0x4561('0x13')](_0x4561('0xc'),auth[_0x4561('0xb')](),controller[_0x4561('0x14')]);router[_0x4561('0x15')](_0x4561('0xc'),auth[_0x4561('0xb')](),controller[_0x4561('0x16')]);router[_0x4561('0x15')](_0x4561('0x17'),auth['isAuthenticated'](),controller['removeSound']);module[_0x4561('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 706fbd5..dc509d9 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 _0xbb69=['exports','name','ENUM','custom','files','mp3nb','quietmp3nb','STRING','alpha','TIMESTAMP','sequelize'];(function(_0x25c9c8,_0x194c44){var _0x21cb3e=function(_0x40c9ad){while(--_0x40c9ad){_0x25c9c8['push'](_0x25c9c8['shift']());}};_0x21cb3e(++_0x194c44);}(_0xbb69,0xba));var _0x9bb6=function(_0x3125dc,_0x28ee6d){_0x3125dc=_0x3125dc-0x0;var _0x1a0738=_0xbb69[_0x3125dc];return _0x1a0738;};'use strict';var Sequelize=require(_0x9bb6('0x0'));module[_0x9bb6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9bb6('0x2')},'mode':{'type':Sequelize[_0x9bb6('0x3')](_0x9bb6('0x4'),_0x9bb6('0x5'),_0x9bb6('0x6'),_0x9bb6('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x9bb6('0x5')},'directory':{'type':Sequelize[_0x9bb6('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x9bb6('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x9bb6('0x8')],'allowNull':!![],'defaultValue':_0x9bb6('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x9bb6('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x51c2=['STRING','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','exports'];(function(_0x36bf46,_0x3d8db9){var _0x1d0a72=function(_0x328e8d){while(--_0x328e8d){_0x36bf46['push'](_0x36bf46['shift']());}};_0x1d0a72(++_0x3d8db9);}(_0x51c2,0xfc));var _0x251c=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x51c2[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require('sequelize');module[_0x251c('0x0')]={'name':{'type':Sequelize[_0x251c('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x251c('0x2')](_0x251c('0x3'),_0x251c('0x4'),_0x251c('0x5'),_0x251c('0x6'),_0x251c('0x7'),_0x251c('0x8')),'allowNull':!![],'defaultValue':_0x251c('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x251c('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x251c('0x1')],'allowNull':!![],'defaultValue':_0x251c('0x9')},'format':{'type':Sequelize[_0x251c('0x1')],'allowNull':!![]},'stamp':{'type':_0x251c('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 12007ca..7be1389 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x4ab787,_0xda251a){var _0x5061d9=function(_0x4f85ce){while(--_0x4f85ce){_0x4ab787['push'](_0x4ab787['shift']());}};_0x5061d9(++_0xda251a);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b9e13,_0x3cdc73){_0x3b9e13=_0x3b9e13-0x0;var _0x4ea299=_0xb10b[_0x3b9e13];return _0x4ea299;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file +var _0xd8b0=['map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','VoiceMusicOnHold','count','includeAll','include','findAll','rows','catch','params','keys','find','body','create','transaction','mode','directory','join','root','server/files/moh','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','save_name','symlinkSync','ValidationError','removeSound','id2','message','getSounds','options','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','name','send'];(function(_0x108966,_0x3b30c1){var _0x9a536c=function(_0xba5cc8){while(--_0xba5cc8){_0x108966['push'](_0x108966['shift']());}};_0x9a536c(++_0x3b30c1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){var _0x2b924f=_0x56c729[_0x0d8b('0x23')]({'plain':!![]});var _0x38efc8=_0x0d8b('0x24');return db[_0x0d8b('0x25')][_0x0d8b('0x26')]({'where':{'type':_0x38efc8,'resourceId':_0x2b924f['id']}})[_0x0d8b('0x22')](function(){return _0x56c729;});})[_0x0d8b('0x22')](function(){_0x33fb87['status'](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['VoiceMusicOnHold'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1b')]=qs[_0x0d8b('0x1b')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x1b2b59['query'][_0x0d8b('0x1a')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x3e')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3f')]){_0x97050a[_0x0d8b('0x40')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x41')](_0x97050a);})[_0x0d8b('0x22')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x42')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x43')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x44')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3f')]){_0x4d0811[_0x0d8b('0x40')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x4d0811)[_0x0d8b('0x22')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x22')](respondWithResult(_0x576050,null))[_0x0d8b('0x43')](handleError(_0x576050,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x47')]['id']){delete _0x11d22b[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x47')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x43')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x48')]=function(_0x574b90,_0x371fa0,_0x4d8850){return db['sequelize'][_0x0d8b('0x49')](function(_0x113fb7){if(_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4a')]==='files'){_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4b')]=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x4e'),_0x574b90['body']['name']);}return db['VoiceMusicOnHold']['create'](_0x574b90[_0x0d8b('0x47')],{'transaction':_0x113fb7})[_0x0d8b('0x22')](function(_0x5e3bb4){if(_0x574b90['body'][_0x0d8b('0x4a')]===_0x0d8b('0x4f')){fs['mkdirSync'](_0x5e3bb4['directory'],parseInt(_0x0d8b('0x50'),0x8));}var _0xeeefd4=_0x574b90[_0x0d8b('0x51')][_0x0d8b('0x23')]({'plain':!![]});if(!_0xeeefd4)throw new Error(_0x0d8b('0x52'));if(_0xeeefd4['role']===_0x0d8b('0x51')){var _0x2afe34=_0x5e3bb4['get']({'plain':!![]});return db['UserProfileSection'][_0x0d8b('0x46')]({'where':{'name':_0x0d8b('0x24'),'userProfileId':_0xeeefd4['userProfileId']},'raw':!![]})['then'](function(_0xb8be3b){if(_0xb8be3b&&_0xb8be3b[_0x0d8b('0x53')]===0x0){return db[_0x0d8b('0x25')][_0x0d8b('0x48')]({'name':_0x2afe34['name'],'resourceId':_0x2afe34['id'],'type':_0xb8be3b[_0x0d8b('0x27')],'sectionId':_0xb8be3b['id']},{})['then'](function(){return _0x5e3bb4;});}else{return _0x5e3bb4;}})['catch'](function(_0x38c24e){logger[_0x0d8b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c24e);});}return _0x5e3bb4;});})['then'](respondWithResult(_0x371fa0,0xc9))[_0x0d8b('0x43')](handleError(_0x371fa0,null));};exports[_0x0d8b('0x26')]=function(_0xccc2a9,_0x2c1eb0,_0x3afc3a){var _0xb66e76;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0xccc2a9['params']['id']}})[_0x0d8b('0x22')](function(_0x37dc9f){if(_0x37dc9f){return db[_0x0d8b('0x55')][_0x0d8b('0x49')](function(_0x3fb9ea){return _0x37dc9f[_0x0d8b('0x26')]({'transaction':_0x3fb9ea,'raw':!![]})[_0x0d8b('0x22')](function(_0x1c78b6){if(_0x1c78b6[_0x0d8b('0x4b')]){fs['readdirSync'](_0x1c78b6[_0x0d8b('0x4b')])[_0x0d8b('0x56')](function(_0x180b7b){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x1c78b6['directory'],_0x180b7b));});fs[_0x0d8b('0x58')](_0x1c78b6[_0x0d8b('0x4b')]);}return _0x1c78b6;});})[_0x0d8b('0x43')](function(_0x17a87f){throw new db[(_0x0d8b('0x59'))]['ValidationError'](_0x17a87f['message']);});}})[_0x0d8b('0x22')](handleEntityNotFound(_0x2c1eb0,null))[_0x0d8b('0x22')](removeEntity(_0x2c1eb0,null))[_0x0d8b('0x43')](handleError(_0x2c1eb0,null));};exports[_0x0d8b('0x5a')]=function(_0x5a70bd,_0x199122,_0x12aef7){return db[_0x0d8b('0x55')]['transaction'](function(_0x2f19f4){var _0x532a85;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x5a70bd[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](function(_0x2b6eb6){if(_0x2b6eb6){_0x532a85=_0x2b6eb6;return _0x2b6eb6[_0x0d8b('0x5a')](_0x5a70bd['body']['id'],{'transaction':_0x2f19f4});}})[_0x0d8b('0x22')](function(_0x4c074d){if(_0x4c074d){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x5a70bd[_0x0d8b('0x47')]['id']},'attributes':['id',_0x0d8b('0x27'),'save_name',_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2332fc){if(_0x2332fc){var _0x2ccdae=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x5f'),util[_0x0d8b('0x60')](_0x0d8b('0x61'),path['basename'](_0x2332fc['save_name'],path[_0x0d8b('0x62')](_0x2332fc[_0x0d8b('0x63')])),_0x2332fc['converted_format']));var _0xb1aa96=path['join'](config['root'],_0x0d8b('0x4e'),_0x532a85[_0x0d8b('0x27')],util['format']('%s.%s',_0x2332fc[_0x0d8b('0x27')],_0x2332fc[_0x0d8b('0x5d')]));fs[_0x0d8b('0x64')](_0x2ccdae,_0xb1aa96);return _0x2332fc;}})[_0x0d8b('0x43')](function(_0x2ab72b){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x2ab72b['message']);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x199122,null))['then'](respondWithResult(_0x199122,0xc9))[_0x0d8b('0x43')](handleError(_0x199122,null));};exports[_0x0d8b('0x66')]=function(_0x2bb690,_0x14a34b,_0x49f610){return db[_0x0d8b('0x55')]['transaction'](function(_0x3a356b){var _0x2c6c5f;return db[_0x0d8b('0x3d')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](function(_0x91aa89){if(_0x91aa89){_0x2c6c5f=_0x91aa89;return _0x91aa89[_0x0d8b('0x66')](_0x2bb690[_0x0d8b('0x44')]['id2']);}})[_0x0d8b('0x22')](function(_0x54c28b){if(_0x54c28b){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690['params'][_0x0d8b('0x67')]},'attributes':['id','name',_0x0d8b('0x63'),_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2242cd){if(_0x2242cd){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x2c6c5f[_0x0d8b('0x4b')],util['format'](_0x0d8b('0x61'),_0x2242cd[_0x0d8b('0x27')],_0x2242cd['converted_format'])));return _0x2242cd;}})[_0x0d8b('0x43')](function(_0x105df9){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x105df9[_0x0d8b('0x68')]);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](respondWithStatusCode(_0x14a34b,0xcc))[_0x0d8b('0x43')](handleError(_0x14a34b,null));};exports[_0x0d8b('0x69')]=function(_0x5007c0,_0xe35028,_0x16df83){var _0x50c0ff={};var _0x1ece98={};var _0x93fc55;var _0x3acffa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5007c0[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0xe35028,null))[_0x0d8b('0x22')](function(_0x5b76af){if(_0x5b76af){_0x93fc55=_0x5b76af;_0x1ece98['model']=_[_0x0d8b('0x45')](db[_0x0d8b('0x5b')][_0x0d8b('0x2a')]);_0x1ece98[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x5007c0[_0x0d8b('0x2c')]);_0x1ece98[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],_0x1ece98[_0x0d8b('0x2c')]);_0x50c0ff[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],qs['fields'](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x31')]));_0x50c0ff['attributes']=_0x50c0ff['attributes'][_0x0d8b('0x32')]?_0x50c0ff[_0x0d8b('0x30')]:_0x1ece98[_0x0d8b('0x2f')];_0x50c0ff[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x5007c0[_0x0d8b('0x2c')]['sort']);_0x50c0ff['where']=qs['filters'](_[_0x0d8b('0x37')](_0x5007c0[_0x0d8b('0x2c')],_0x1ece98[_0x0d8b('0x2d')]));if(_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x50c0ff[_0x0d8b('0x39')]=_['merge'](_0x50c0ff[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x50c0ff['attributes'],function(_0x30a69d){var _0x57e3c2={};_0x57e3c2[_0x30a69d]={'$like':'%'+_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x57e3c2;})});}_0x50c0ff=_[_0x0d8b('0x3a')]({},_0x50c0ff,_0x5007c0[_0x0d8b('0x6a')]);return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x424f9d){if(_0x424f9d){_0x3acffa=_0x424f9d[_0x0d8b('0x32')];if(!_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x50c0ff[_0x0d8b('0x1b')]=qs['limit'](_0x5007c0['query'][_0x0d8b('0x1b')]);_0x50c0ff[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x54674f){if(_0x54674f){return _0x54674f?{'count':_0x3acffa,'rows':_0x54674f}:null;}})[_0x0d8b('0x22')](respondWithResult(_0xe35028,null))['catch'](handleError(_0xe35028,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index dbbc917..b795c63 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 _0xd4d1=['rimraf','../../config/environment','define','voice_musiconhold','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0xd4d1,0x86));var _0x1d4d=function(_0x4d6581,_0x2609be){_0x4d6581=_0x4d6581-0x0;var _0x43c4aa=_0xd4d1[_0x4d6581];return _0x43c4aa;};'use strict';var _=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d4d('0x2'));var BPromise=require(_0x1d4d('0x3'));var rp=require(_0x1d4d('0x4'));var fs=require('fs');var path=require(_0x1d4d('0x5'));var rimraf=require(_0x1d4d('0x6'));var config=require(_0x1d4d('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x1278db,_0x43d04f){return _0x1278db[_0x1d4d('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x1d4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa751=['moment','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','voice_musiconhold','lodash','../../config/logger','api'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0xa751,0x1ec));var _0x1a75=function(_0x351c01,_0x508367){_0x351c01=_0x351c01-0x0;var _0x1b2e1d=_0xa751[_0x351c01];return _0x1b2e1d;};'use strict';var _=require(_0x1a75('0x0'));var util=require('util');var logger=require(_0x1a75('0x1'))(_0x1a75('0x2'));var moment=require(_0x1a75('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a75('0x4'));var rimraf=require(_0x1a75('0x5'));var config=require(_0x1a75('0x6'));var attributes=require(_0x1a75('0x7'));module['exports']=function(_0x3b8128,_0x5110b9){return _0x3b8128['define']('VoiceMusicOnHold',attributes,{'tableName':_0x1a75('0x8'),'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 590c239..4099448 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 _0x43b9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','message','info','util'];(function(_0x46eef5,_0x542bb8){var _0x2789fe=function(_0x5889ec){while(--_0x5889ec){_0x46eef5['push'](_0x46eef5['shift']());}};_0x2789fe(++_0x542bb8);}(_0x43b9,0x167));var _0x943b=function(_0x46b3f7,_0x37fb7d){_0x46b3f7=_0x46b3f7-0x0;var _0xfe5722=_0x43b9[_0x46b3f7];return _0xfe5722;};'use strict';var _=require('lodash');var util=require(_0x943b('0x0'));var moment=require(_0x943b('0x1'));var BPromise=require(_0x943b('0x2'));var rs=require(_0x943b('0x3'));var fs=require('fs');var Redis=require(_0x943b('0x4'));var db=require(_0x943b('0x5'))['db'];var utils=require(_0x943b('0x6'));var logger=require(_0x943b('0x7'))(_0x943b('0x8'));var config=require(_0x943b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x943b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17a676,_0x26bc15,_0x1c3734){return new BPromise(function(_0x452218,_0x5ea924){return client[_0x943b('0xb')](_0x17a676,_0x1c3734)[_0x943b('0xc')](function(_0x43c420){logger['info'](_0x943b('0xd'),_0x26bc15,_0x943b('0xe'));logger[_0x943b('0xf')](_0x943b('0x10'),_0x26bc15,_0x943b('0xe'),JSON['stringify'](_0x43c420));if(_0x43c420[_0x943b('0x11')]){if(_0x43c420[_0x943b('0x11')]['code']===0x1f4){logger[_0x943b('0x11')](_0x943b('0xd'),_0x26bc15,_0x43c420[_0x943b('0x11')][_0x943b('0x12')]);return _0x5ea924(_0x43c420[_0x943b('0x11')][_0x943b('0x12')]);}logger['error'](_0x943b('0xd'),_0x26bc15,_0x43c420[_0x943b('0x11')][_0x943b('0x12')]);return _0x452218(_0x43c420[_0x943b('0x11')][_0x943b('0x12')]);}else{logger[_0x943b('0x13')](_0x943b('0xd'),_0x26bc15,_0x943b('0xe'));_0x452218(_0x43c420['result'][_0x943b('0x12')]);}})['catch'](function(_0x95755a){logger['error'](_0x943b('0xd'),_0x26bc15,_0x95755a);_0x5ea924(_0x95755a);});});} \ No newline at end of file +var _0xb975=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0xa4a3dd,_0x4ed169){var _0x10fb35=function(_0x5f2252){while(--_0x5f2252){_0xa4a3dd['push'](_0xa4a3dd['shift']());}};_0x10fb35(++_0x4ed169);}(_0xb975,0x14e));var _0x5b97=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xb975[_0x580647];return _0x5f0792;};'use strict';var _=require(_0x5b97('0x0'));var util=require(_0x5b97('0x1'));var moment=require(_0x5b97('0x2'));var BPromise=require(_0x5b97('0x3'));var rs=require(_0x5b97('0x4'));var fs=require('fs');var Redis=require(_0x5b97('0x5'));var db=require(_0x5b97('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b97('0x7'))(_0x5b97('0x8'));var config=require(_0x5b97('0x9'));var jayson=require(_0x5b97('0xa'));var client=jayson[_0x5b97('0xb')][_0x5b97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14d49b,_0x3011d1,_0x30c118){return new BPromise(function(_0x47d558,_0x3589d0){return client[_0x5b97('0xd')](_0x14d49b,_0x30c118)[_0x5b97('0xe')](function(_0x291e9f){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x3011d1,'request\x20sent');logger[_0x5b97('0xf')](_0x5b97('0x10'),_0x3011d1,_0x5b97('0x11'),JSON[_0x5b97('0x12')](_0x291e9f));if(_0x291e9f[_0x5b97('0x13')]){if(_0x291e9f[_0x5b97('0x13')][_0x5b97('0x14')]===0x1f4){logger[_0x5b97('0x13')](_0x5b97('0x15'),_0x3011d1,_0x291e9f[_0x5b97('0x13')][_0x5b97('0x16')]);return _0x3589d0(_0x291e9f[_0x5b97('0x13')][_0x5b97('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x3011d1,_0x291e9f[_0x5b97('0x13')][_0x5b97('0x16')]);return _0x47d558(_0x291e9f['error']['message']);}else{logger[_0x5b97('0x17')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3011d1,_0x5b97('0x11'));_0x47d558(_0x291e9f[_0x5b97('0x18')]['message']);}})[_0x5b97('0x19')](function(_0x58d84){logger[_0x5b97('0x13')](_0x5b97('0x15'),_0x3011d1,_0x58d84);_0x3589d0(_0x58d84);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index f0517d9..b63126a 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 _0xf278=['destroy','removeAgents','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','show','/:id/users','getAgents','post','addAgents','put','update','delete','/:id'];(function(_0x12c2e3,_0x2ad60b){var _0x198154=function(_0x31f785){while(--_0x31f785){_0x12c2e3['push'](_0x12c2e3['shift']());}};_0x198154(++_0x2ad60b);}(_0xf278,0xc8));var _0x8f27=function(_0x3c5e45,_0x5a9916){_0x3c5e45=_0x3c5e45-0x0;var _0x2cecea=_0xf278[_0x3c5e45];return _0x2cecea;};'use strict';var multer=require(_0x8f27('0x0'));var util=require(_0x8f27('0x1'));var path=require(_0x8f27('0x2'));var timeout=require(_0x8f27('0x3'));var express=require('express');var router=express[_0x8f27('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8f27('0x5'));var config=require(_0x8f27('0x6'));var controller=require(_0x8f27('0x7'));router[_0x8f27('0x8')]('/',auth[_0x8f27('0x9')](),controller['index']);router[_0x8f27('0x8')](_0x8f27('0xa'),auth[_0x8f27('0x9')](),controller['describe']);router[_0x8f27('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8f27('0xb')]);router[_0x8f27('0x8')](_0x8f27('0xc'),auth[_0x8f27('0x9')](),controller[_0x8f27('0xd')]);router[_0x8f27('0xe')]('/',auth[_0x8f27('0x9')](),controller['create']);router['post'](_0x8f27('0xc'),auth[_0x8f27('0x9')](),controller[_0x8f27('0xf')]);router[_0x8f27('0x10')]('/:id',auth[_0x8f27('0x9')](),controller[_0x8f27('0x11')]);router[_0x8f27('0x12')](_0x8f27('0x13'),auth[_0x8f27('0x9')](),controller[_0x8f27('0x14')]);router[_0x8f27('0x12')](_0x8f27('0xc'),auth[_0x8f27('0x9')](),controller[_0x8f27('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe542=['post','addAgents','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/users','getAgents'];(function(_0x22d1ef,_0x4a5152){var _0x47c5a3=function(_0x9a2c48){while(--_0x9a2c48){_0x22d1ef['push'](_0x22d1ef['shift']());}};_0x47c5a3(++_0x4a5152);}(_0xe542,0xa0));var _0x2e54=function(_0x40e442,_0x3f5f5e){_0x40e442=_0x40e442-0x0;var _0x1e3687=_0xe542[_0x40e442];return _0x1e3687;};'use strict';var multer=require(_0x2e54('0x0'));var util=require(_0x2e54('0x1'));var path=require(_0x2e54('0x2'));var timeout=require(_0x2e54('0x3'));var express=require('express');var router=express[_0x2e54('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2e54('0x5'));var config=require(_0x2e54('0x6'));var controller=require(_0x2e54('0x7'));router[_0x2e54('0x8')]('/',auth[_0x2e54('0x9')](),controller[_0x2e54('0xa')]);router['get'](_0x2e54('0xb'),auth['isAuthenticated'](),controller[_0x2e54('0xc')]);router['get'](_0x2e54('0xd'),auth[_0x2e54('0x9')](),controller['show']);router[_0x2e54('0x8')](_0x2e54('0xe'),auth['isAuthenticated'](),controller[_0x2e54('0xf')]);router['post']('/',auth[_0x2e54('0x9')](),controller['create']);router[_0x2e54('0x10')](_0x2e54('0xe'),auth[_0x2e54('0x9')](),controller[_0x2e54('0x11')]);router[_0x2e54('0x12')](_0x2e54('0xd'),auth[_0x2e54('0x9')](),controller[_0x2e54('0x13')]);router[_0x2e54('0x14')](_0x2e54('0xd'),auth[_0x2e54('0x9')](),controller['destroy']);router['delete'](_0x2e54('0xe'),auth[_0x2e54('0x9')](),controller['removeAgents']);module[_0x2e54('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 6406b4d..ee8b521 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 _0xcab1=['name','VIRTUAL','getDataValue','INTEGER','exports','STRING'];(function(_0x3d8f92,_0x14017a){var _0x1e7b44=function(_0x461047){while(--_0x461047){_0x3d8f92['push'](_0x3d8f92['shift']());}};_0x1e7b44(++_0x14017a);}(_0xcab1,0x166));var _0x1cab=function(_0x15ab51,_0x938ad){_0x15ab51=_0x15ab51-0x0;var _0x36c7e4=_0xcab1[_0x15ab51];return _0x36c7e4;};'use strict';var Sequelize=require('sequelize');module[_0x1cab('0x0')]={'name':{'type':Sequelize[_0x1cab('0x1')],'allowNull':![],'unique':_0x1cab('0x2')},'prefix':{'type':Sequelize[_0x1cab('0x3')],'get':function(_0x177210){return'system-'+this[_0x1cab('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x1cab('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x1cab('0x5')]}}; \ No newline at end of file +var _0x6400=['STRING','system-','getDataValue','name','sequelize'];(function(_0x1e0363,_0x5822a1){var _0x3bfe65=function(_0x177d9e){while(--_0x177d9e){_0x1e0363['push'](_0x1e0363['shift']());}};_0x3bfe65(++_0x5822a1);}(_0x6400,0x1ee));var _0x0640=function(_0x36d05c,_0x1cb82f){_0x36d05c=_0x36d05c-0x0;var _0x35773c=_0x6400[_0x36d05c];return _0x35773c;};'use strict';var Sequelize=require(_0x0640('0x0'));module['exports']={'name':{'type':Sequelize[_0x0640('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2095ef){return _0x0640('0x2')+this[_0x0640('0x3')](_0x0640('0x4'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x0640('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index b75e96c..34e398d 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 _0x79ea=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','includeAll','include','VoicePrefix','findAll','rows','catch','show','options','find','params','describe','sequelize','transaction','create','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','Extensions\x20creation\x20failed','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','${EXTEN:','charAt','system-','findById','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','end','error','stack','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection'];(function(_0x1d72d0,_0x89db32){var _0x234ae9=function(_0x4ae372){while(--_0x4ae372){_0x1d72d0['push'](_0x1d72d0['shift']());}};_0x234ae9(++_0x89db32);}(_0x79ea,0x13a));var _0xa79e=function(_0x11c6b8,_0x5b2d7b){_0x11c6b8=_0x11c6b8-0x0;var _0x38b38f=_0x79ea[_0x11c6b8];return _0x38b38f;};'use strict';var pdf=require(_0xa79e('0x0'));var emlformat=require(_0xa79e('0x1'));var rimraf=require(_0xa79e('0x2'));var zipdir=require(_0xa79e('0x3'));var jsonpatch=require(_0xa79e('0x4'));var rp=require('request-promise');var moment=require(_0xa79e('0x5'));var BPromise=require(_0xa79e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa79e('0x7'));var csv=require(_0xa79e('0x8'));var ejs=require(_0xa79e('0x9'));var fs=require('fs');var _=require(_0xa79e('0xa'));var squel=require(_0xa79e('0xb'));var crypto=require('crypto');var jsforce=require(_0xa79e('0xc'));var deskjs=require(_0xa79e('0xd'));var toCsv=require(_0xa79e('0x8'));var querystring=require(_0xa79e('0xe'));var Papa=require(_0xa79e('0xf'));var Redis=require(_0xa79e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa79e('0x11'));var as=require(_0xa79e('0x12'));var hardwareService=require(_0xa79e('0x13'));var logger=require(_0xa79e('0x14'))('api');var utils=require(_0xa79e('0x15'));var config=require(_0xa79e('0x16'));var db=require(_0xa79e('0x17'))['db'];config[_0xa79e('0x18')]=_[_0xa79e('0x19')](config[_0xa79e('0x18')],{'host':_0xa79e('0x1a'),'port':0x18eb});var socket=require(_0xa79e('0x1b'))(new Redis(config[_0xa79e('0x18')]));require(_0xa79e('0x1c'))[_0xa79e('0x1d')](socket);function respondWithStatusCode(_0x2d4e43,_0xa11d49){_0xa11d49=_0xa11d49||0xcc;return function(_0xb1344e){if(_0xb1344e){return _0x2d4e43[_0xa79e('0x1e')](_0xa11d49);}return _0x2d4e43['status'](_0xa11d49)['end']();};}function respondWithResult(_0x56fadc,_0x261e1a){_0x261e1a=_0x261e1a||0xc8;return function(_0x3533c6){if(_0x3533c6){return _0x56fadc[_0xa79e('0x1f')](_0x261e1a)[_0xa79e('0x20')](_0x3533c6);}};}function respondWithFilteredResult(_0x3ccda0,_0x2d9a39){return function(_0x1d98e5){if(_0x1d98e5){var _0x18e7aa=_0x1d98e5[_0xa79e('0x21')],_0x58d7a0=_0x2d9a39[_0xa79e('0x22')],_0x3798fe=_0x2d9a39[_0xa79e('0x22')]+_0x2d9a39[_0xa79e('0x23')],_0x660fca;if(_0x3798fe>=_0x18e7aa){_0x3798fe=_0x18e7aa;_0x660fca=0xc8;}else{_0x660fca=0xce;}_0x3ccda0[_0xa79e('0x1f')](_0x660fca);return _0x3ccda0[_0xa79e('0x24')](_0xa79e('0x25'),_0x58d7a0+'-'+_0x3798fe+'/'+_0x18e7aa)[_0xa79e('0x20')](_0x1d98e5);}return null;};}function patchUpdates(_0x23174){return function(_0x3ab852){try{jsonpatch[_0xa79e('0x26')](_0x3ab852,_0x23174,!![]);}catch(_0x265c22){return BPromise[_0xa79e('0x27')](_0x265c22);}return _0x3ab852[_0xa79e('0x28')]();};}function saveUpdates(_0x344942,_0x1ac2be){return function(_0x2a636e){if(_0x2a636e){return _0x2a636e[_0xa79e('0x29')](_0x344942)[_0xa79e('0x2a')](function(_0x444102){return _0x444102;});}return null;};}function removeEntity(_0x1ac1b3,_0x45f4d1){return function(_0x1965fb){if(_0x1965fb){return _0x1965fb[_0xa79e('0x2b')]()['then'](function(){var _0x4e7582=_0x1965fb[_0xa79e('0x2c')]({'plain':!![]});var _0x5c3261=_0xa79e('0x2d');return db['UserProfileResource'][_0xa79e('0x2b')]({'where':{'type':_0x5c3261,'resourceId':_0x4e7582['id']}})[_0xa79e('0x2a')](function(){return _0x1965fb;});})['then'](function(){_0x1ac1b3[_0xa79e('0x1f')](0xcc)[_0xa79e('0x2e')]();});}};}function handleEntityNotFound(_0x3de7a2,_0x7040d4){return function(_0x5ebf42){if(!_0x5ebf42){_0x3de7a2[_0xa79e('0x1e')](0x194);}return _0x5ebf42;};}function handleError(_0x3acda5,_0x1a27db){_0x1a27db=_0x1a27db||0x1f4;return function(_0x161555){logger[_0xa79e('0x2f')](_0x161555[_0xa79e('0x30')]);if(_0x161555['name']){delete _0x161555['name'];}_0x3acda5[_0xa79e('0x1f')](_0x1a27db)[_0xa79e('0x31')](_0x161555);};}exports[_0xa79e('0x32')]=function(_0x15c3b0,_0x46bd2f){var _0x57bd62={},_0x2e42fc={},_0x2064ee={'count':0x0,'rows':[]};var _0x51379d=_[_0xa79e('0x33')](db['VoicePrefix'][_0xa79e('0x34')],function(_0x22088e){return{'name':_0x22088e[_0xa79e('0x35')],'type':_0x22088e[_0xa79e('0x36')]['key']};});_0x2e42fc[_0xa79e('0x37')]=_[_0xa79e('0x33')](_0x51379d,'name');_0x2e42fc[_0xa79e('0x38')]=_[_0xa79e('0x39')](_0x15c3b0[_0xa79e('0x38')]);_0x2e42fc[_0xa79e('0x3a')]=_['intersection'](_0x2e42fc[_0xa79e('0x37')],_0x2e42fc['query']);_0x57bd62[_0xa79e('0x3b')]=_[_0xa79e('0x3c')](_0x2e42fc[_0xa79e('0x37')],qs[_0xa79e('0x3d')](_0x15c3b0['query'][_0xa79e('0x3d')]));_0x57bd62['attributes']=_0x57bd62[_0xa79e('0x3b')][_0xa79e('0x3e')]?_0x57bd62[_0xa79e('0x3b')]:_0x2e42fc[_0xa79e('0x37')];if(!_0x15c3b0['query'][_0xa79e('0x3f')](_0xa79e('0x40'))){_0x57bd62[_0xa79e('0x23')]=qs['limit'](_0x15c3b0[_0xa79e('0x38')]['limit']);_0x57bd62[_0xa79e('0x22')]=qs['offset'](_0x15c3b0['query'][_0xa79e('0x22')]);}_0x57bd62[_0xa79e('0x41')]=qs[_0xa79e('0x42')](_0x15c3b0['query'][_0xa79e('0x42')]);_0x57bd62[_0xa79e('0x43')]=qs[_0xa79e('0x3a')](_['pick'](_0x15c3b0['query'],_0x2e42fc['filters']),_0x51379d);if(_0x15c3b0['query'][_0xa79e('0x44')]){_0x57bd62[_0xa79e('0x43')]=_[_0xa79e('0x45')](_0x57bd62[_0xa79e('0x43')],{'$or':_['map'](_0x51379d,function(_0x32aff6){if(_0x32aff6[_0xa79e('0x36')]!==_0xa79e('0x46')){var _0x38895c={};_0x38895c[_0x32aff6[_0xa79e('0x47')]]={'$like':'%'+_0x15c3b0[_0xa79e('0x38')]['filter']+'%'};return _0x38895c;}})});}_0x57bd62=_['merge']({},_0x57bd62,_0x15c3b0['options']);var _0x1d32b5={'where':_0x57bd62[_0xa79e('0x43')]};return db['VoicePrefix'][_0xa79e('0x21')](_0x1d32b5)[_0xa79e('0x2a')](function(_0xb4c81e){_0x2064ee[_0xa79e('0x21')]=_0xb4c81e;if(_0x15c3b0[_0xa79e('0x38')][_0xa79e('0x48')]){_0x57bd62[_0xa79e('0x49')]=[{'all':!![]}];}return db[_0xa79e('0x4a')][_0xa79e('0x4b')](_0x57bd62);})[_0xa79e('0x2a')](function(_0x43c302){_0x2064ee[_0xa79e('0x4c')]=_0x43c302;return _0x2064ee;})[_0xa79e('0x2a')](respondWithFilteredResult(_0x46bd2f,_0x57bd62))[_0xa79e('0x4d')](handleError(_0x46bd2f,null));};exports[_0xa79e('0x4e')]=function(_0x4de663,_0xb16ffd){var _0x3a6c30={'raw':![],'where':{'id':_0x4de663['params']['id']}},_0x4ca517={};_0x4ca517[_0xa79e('0x37')]=_[_0xa79e('0x39')](db[_0xa79e('0x4a')]['rawAttributes']);_0x4ca517[_0xa79e('0x38')]=_[_0xa79e('0x39')](_0x4de663['query']);_0x4ca517[_0xa79e('0x3a')]=_[_0xa79e('0x3c')](_0x4ca517[_0xa79e('0x37')],_0x4ca517[_0xa79e('0x38')]);_0x3a6c30['attributes']=_[_0xa79e('0x3c')](_0x4ca517[_0xa79e('0x37')],qs[_0xa79e('0x3d')](_0x4de663['query']['fields']));_0x3a6c30['attributes']=_0x3a6c30[_0xa79e('0x3b')][_0xa79e('0x3e')]?_0x3a6c30[_0xa79e('0x3b')]:_0x4ca517[_0xa79e('0x37')];if(_0x4de663[_0xa79e('0x38')][_0xa79e('0x48')]){_0x3a6c30[_0xa79e('0x49')]=[{'all':!![]}];}_0x3a6c30=_['merge']({},_0x3a6c30,_0x4de663[_0xa79e('0x4f')]);return db[_0xa79e('0x4a')][_0xa79e('0x50')](_0x3a6c30)[_0xa79e('0x2a')](handleEntityNotFound(_0xb16ffd,null))[_0xa79e('0x2a')](respondWithResult(_0xb16ffd,null))[_0xa79e('0x4d')](handleError(_0xb16ffd,null));};exports[_0xa79e('0x2b')]=function(_0x58979a,_0x3636b1){return db[_0xa79e('0x4a')]['find']({'where':{'id':_0x58979a[_0xa79e('0x51')]['id']}})[_0xa79e('0x2a')](handleEntityNotFound(_0x3636b1,null))['then'](removeEntity(_0x3636b1,null))['catch'](handleError(_0x3636b1,null));};exports[_0xa79e('0x52')]=function(_0xcf06c2,_0x17f936){return db[_0xa79e('0x4a')]['describe']()[_0xa79e('0x2a')](respondWithResult(_0x17f936,null))[_0xa79e('0x4d')](handleError(_0x17f936,null));};exports['create']=function(_0x20910d,_0x4ae605){var _0x54f3ef;return db[_0xa79e('0x53')][_0xa79e('0x54')](function(_0x9916f8){return db[_0xa79e('0x4a')][_0xa79e('0x55')](_0x20910d[_0xa79e('0x56')],{'transaction':_0x9916f8})[_0xa79e('0x2a')](function(_0x353e5d){_0x54f3ef=_0x353e5d[_0xa79e('0x2c')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x54f3ef[_0xa79e('0x57')]},'raw':!![]})[_0xa79e('0x2a')](function(_0x2c570a){return createVoicePrefixExtensions(_0x54f3ef,_0x2c570a,_0x9916f8);});});})[_0xa79e('0x2a')](function(){var _0x56ca70=_0x20910d[_0xa79e('0x58')]['get']({'plain':!![]});if(!_0x56ca70)throw new Error(_0xa79e('0x59'));if(_0x56ca70[_0xa79e('0x5a')]===_0xa79e('0x58')){var _0x476a42=_0x54f3ef;return db['UserProfileSection'][_0xa79e('0x50')]({'where':{'name':_0xa79e('0x2d'),'userProfileId':_0x56ca70[_0xa79e('0x5b')]},'raw':!![]})[_0xa79e('0x2a')](function(_0x328657){if(_0x328657&&_0x328657[_0xa79e('0x5c')]===0x0){return db[_0xa79e('0x5d')]['create']({'name':_0x476a42[_0xa79e('0x47')],'resourceId':_0x476a42['id'],'type':_0x328657['name'],'sectionId':_0x328657['id']},{})[_0xa79e('0x2a')](function(){return _0x54f3ef;});}else{return _0x54f3ef;}})['catch'](function(_0x322973){logger['error'](_0xa79e('0x5e'),_0x322973);throw _0x322973;});}return _0x54f3ef;})[_0xa79e('0x2a')](respondWithResult(_0x4ae605,null))[_0xa79e('0x4d')](handleError(_0x4ae605,null));};function Extension(_0x47bebc,_0x9e546c,_0x5f1f77,_0x47fef5){this[_0xa79e('0x5f')]=_0xa79e('0x60');this[_0xa79e('0x61')]=_0x47bebc;this[_0xa79e('0x62')]=_0x5f1f77;this['type']='system';this['description']=_0xa79e('0x63');this[_0xa79e('0x64')]=_0x9e546c;this[_0xa79e('0x65')]=_0x47fef5;}function createVoicePrefixExtensions(_0x3abf50,_0x477b63,_0x2ca1ed){return new BPromise(function(_0x36922f,_0x4ad74a){var _0x1cf6f1=new Extension(formatPrefixName(_0x3abf50[_0xa79e('0x66')]),0x1,_0xa79e('0x67'),'Voice\x20Prefix');_0x1cf6f1['VoicePrefixId']=_0x3abf50['id'];return db['VoiceExtension'][_0xa79e('0x55')](_0x1cf6f1,{'transaction':_0x2ca1ed})[_0xa79e('0x2a')](function(_0x2ad22c){var _0x54631b=_0x2ad22c[_0xa79e('0x2c')]({'plain':!![]});var _0x474a4a=_[_0xa79e('0x33')](addVoicePrefixExtensions(_0x3abf50,_0x477b63),function(_0x356a8c){_0x356a8c[_0xa79e('0x57')]=_0x54631b['id'];_0x356a8c[_0xa79e('0x68')]=_0x3abf50['id'];return _0x356a8c;});return db[_0xa79e('0x69')]['bulkCreate'](_0x474a4a,{'transaction':_0x2ca1ed})[_0xa79e('0x2a')](function(_0x5d2c53){if(!_0x5d2c53){return _0x4ad74a(_0xa79e('0x6a'));}else{return _0x36922f(_0x5d2c53);}})[_0xa79e('0x4d')](function(_0x4b1802){return _0x4ad74a(_0x4b1802);});});;});};function addVoicePrefixExtensions(_0x2ba055,_0x6c7f3a){var _0x5d1362=[];var _0x23c0d6=formatPrefixName(_0x2ba055['prefix']);_0x5d1362[_0xa79e('0x6b')](new Extension(_0x23c0d6,0x2,'Set',_0xa79e('0x6c')+_0x2ba055[_0xa79e('0x47')]));if(_0x2ba055['callerIdAll']){_0x5d1362[_0xa79e('0x6b')](new Extension(_0x23c0d6,0x3,_0xa79e('0x6d'),_0xa79e('0x6e')+_0x2ba055[_0xa79e('0x6f')]));}else{_0x5d1362[_0xa79e('0x6b')](new Extension(_0x23c0d6,0x3,_0xa79e('0x67'),'No\x20callerid\x20available'));}_0x5d1362['push'](new Extension(_0x23c0d6,0x4,'goto',_0x6c7f3a[_0xa79e('0x5f')]+','+_0xa79e('0x70')+(0x8+_0x2ba055['name'][_0xa79e('0x3e')])+'}'+','+0x1));return _0x5d1362;}function formatPrefixName(_0x2f2fd9){var _0x24ff99='_';for(var _0x196fc1=0x0;_0x196fc1<_0x2f2fd9['length'];_0x196fc1++){if(_0x2f2fd9['charAt'](_0x196fc1)=='-'){_0x24ff99+=_0x2f2fd9[_0xa79e('0x71')](_0x196fc1);}else{_0x24ff99+='['+_0x2f2fd9[_0xa79e('0x71')](_0x196fc1)+']';}}_0x24ff99+='.';return _0x24ff99;}exports['update']=function(_0x5b705c,_0x1432be,_0x572980){var _0x34a1d0=_0x5b705c[_0xa79e('0x56')];_0x34a1d0[_0xa79e('0x66')]=_0xa79e('0x72')+_0x34a1d0[_0xa79e('0x47')]+'-';return db[_0xa79e('0x53')][_0xa79e('0x54')](function(_0x463f4f){return db[_0xa79e('0x4a')][_0xa79e('0x29')](_0x34a1d0,{'where':{'id':_0x34a1d0['id']},'transaction':_0x463f4f})[_0xa79e('0x2a')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x34a1d0['id']},'transaction':_0x463f4f})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x34a1d0[_0xa79e('0x57')]},'raw':!![]})[_0xa79e('0x2a')](function(_0x4b8e1b){return createVoicePrefixExtensions(_0x34a1d0,_0x4b8e1b,_0x463f4f);});});});})[_0xa79e('0x2a')](function(){return db[_0xa79e('0x4a')][_0xa79e('0x73')](_0x34a1d0['id']);})[_0xa79e('0x2a')](respondWithResult(_0x1432be,null))[_0xa79e('0x4d')](handleError(_0x1432be,null));};exports['addAgents']=function(_0x56c3e6,_0x3420bd,_0x2e7f67){return db['VoicePrefix'][_0xa79e('0x50')]({'where':{'id':_0x56c3e6[_0xa79e('0x51')]['id']}})[_0xa79e('0x2a')](handleEntityNotFound(_0x3420bd,null))[_0xa79e('0x2a')](function(_0x3b5f13){if(_0x3b5f13){return _0x3b5f13['addAgents'](_0x56c3e6[_0xa79e('0x56')][_0xa79e('0x74')],_[_0xa79e('0x75')](_0x56c3e6[_0xa79e('0x56')],[_0xa79e('0x74'),'id'])||{})[_0xa79e('0x76')](function(_0x3d3ff2){for(var _0x4fb16f=0x0;_0x4fb16f<_0x56c3e6[_0xa79e('0x56')][_0xa79e('0x74')][_0xa79e('0x3e')];_0x4fb16f+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x56c3e6[_0xa79e('0x56')][_0xa79e('0x74')][_0x4fb16f],'VoicePrefixId':_0x56c3e6[_0xa79e('0x51')]['id']});}return _0x3d3ff2;});}})['then'](respondWithResult(_0x3420bd,null))['catch'](handleError(_0x3420bd,null));};exports[_0xa79e('0x77')]=function(_0x55babd,_0x53e253,_0x263966){return db[_0xa79e('0x4a')][_0xa79e('0x50')]({'where':{'id':_0x55babd[_0xa79e('0x51')]['id']}})[_0xa79e('0x2a')](handleEntityNotFound(_0x53e253,null))[_0xa79e('0x2a')](function(_0x36c8fc){if(_0x36c8fc){return _0x36c8fc[_0xa79e('0x77')](_0x55babd[_0xa79e('0x38')][_0xa79e('0x74')])[_0xa79e('0x2a')](function(){if(_[_0xa79e('0x78')](_0x55babd[_0xa79e('0x38')][_0xa79e('0x74')])){for(var _0x2ede57=0x0;_0x2ede57<_0x55babd['query'][_0xa79e('0x74')]['length'];_0x2ede57+=0x1){socket[_0xa79e('0x79')](_0xa79e('0x7a'),{'UserId':Number(_0x55babd[_0xa79e('0x38')][_0xa79e('0x74')][_0x2ede57]),'VoicePrefixId':Number(_0x55babd[_0xa79e('0x51')]['id'])});}}else{socket[_0xa79e('0x79')](_0xa79e('0x7a'),{'UserId':Number(_0x55babd[_0xa79e('0x38')][_0xa79e('0x74')]),'VoicePrefixId':Number(_0x55babd[_0xa79e('0x51')]['id'])});}});}})[_0xa79e('0x2a')](respondWithStatusCode(_0x53e253,null))['catch'](handleError(_0x53e253,null));};exports[_0xa79e('0x7b')]=function(_0x4aadb3,_0x5cd0b2,_0x852d3c){var _0x4401a6={};var _0x1a73cd={};var _0x37f00e;var _0x9ddcf6;return db[_0xa79e('0x4a')][_0xa79e('0x7c')]({'where':{'id':_0x4aadb3[_0xa79e('0x51')]['id']}})[_0xa79e('0x2a')](handleEntityNotFound(_0x5cd0b2,null))[_0xa79e('0x2a')](function(_0x55ed20){if(_0x55ed20){_0x37f00e=_0x55ed20;_0x1a73cd[_0xa79e('0x37')]=_[_0xa79e('0x39')](db['User'][_0xa79e('0x34')]);_0x1a73cd[_0xa79e('0x38')]=_['keys'](_0x4aadb3[_0xa79e('0x38')]);_0x1a73cd[_0xa79e('0x3a')]=_[_0xa79e('0x3c')](_0x1a73cd[_0xa79e('0x37')],_0x1a73cd[_0xa79e('0x38')]);_0x4401a6['attributes']=_[_0xa79e('0x3c')](_0x1a73cd['model'],qs[_0xa79e('0x3d')](_0x4aadb3[_0xa79e('0x38')][_0xa79e('0x3d')]));_0x4401a6[_0xa79e('0x3b')]=_0x4401a6[_0xa79e('0x3b')][_0xa79e('0x3e')]?_0x4401a6[_0xa79e('0x3b')]:_0x1a73cd[_0xa79e('0x37')];_0x4401a6[_0xa79e('0x41')]=qs[_0xa79e('0x42')](_0x4aadb3[_0xa79e('0x38')][_0xa79e('0x42')]);_0x4401a6[_0xa79e('0x43')]=qs[_0xa79e('0x3a')](_['pick'](_0x4aadb3['query'],_0x1a73cd[_0xa79e('0x3a')]));if(_0x4aadb3[_0xa79e('0x38')]['filter']){_0x4401a6[_0xa79e('0x43')]=_['merge'](_0x4401a6[_0xa79e('0x43')],{'$or':_[_0xa79e('0x33')](_0x4401a6[_0xa79e('0x3b')],function(_0xbc788e){var _0x3c3777={};_0x3c3777[_0xbc788e]={'$like':'%'+_0x4aadb3[_0xa79e('0x38')][_0xa79e('0x44')]+'%'};return _0x3c3777;})});}_0x4401a6=_[_0xa79e('0x45')]({},_0x4401a6,_0x4aadb3[_0xa79e('0x4f')]);return _0x37f00e[_0xa79e('0x7b')](_0x4401a6);}})['then'](function(_0x4dd953){if(_0x4dd953){_0x9ddcf6=_0x4dd953['length'];if(!_0x4aadb3[_0xa79e('0x38')]['hasOwnProperty']('nolimit')){_0x4401a6[_0xa79e('0x23')]=qs[_0xa79e('0x23')](_0x4aadb3[_0xa79e('0x38')]['limit']);_0x4401a6[_0xa79e('0x22')]=qs[_0xa79e('0x22')](_0x4aadb3[_0xa79e('0x38')]['offset']);}return _0x37f00e[_0xa79e('0x7b')](_0x4401a6);}})[_0xa79e('0x2a')](function(_0x2c1c5e){if(_0x2c1c5e){return _0x2c1c5e?{'count':_0x9ddcf6,'rows':_0x2c1c5e}:null;}})[_0xa79e('0x2a')](respondWithResult(_0x5cd0b2,null))['catch'](handleError(_0x5cd0b2,null));}; \ No newline at end of file +var _0x5fdd=['userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','findOne','User','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','params','describe','create','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','context','exten','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','transaction','findById','addAgents','ids','omit','spread'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x5fdd,0x105));var _0xd5fd=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0x5fdd[_0x3da707];return _0x342ee7;};'use strict';var pdf=require(_0xd5fd('0x0'));var emlformat=require(_0xd5fd('0x1'));var rimraf=require(_0xd5fd('0x2'));var zipdir=require(_0xd5fd('0x3'));var jsonpatch=require(_0xd5fd('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd5fd('0x5'));var util=require('util');var path=require(_0xd5fd('0x6'));var sox=require(_0xd5fd('0x7'));var csv=require('to-csv');var ejs=require(_0xd5fd('0x8'));var fs=require('fs');var _=require(_0xd5fd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd5fd('0xa'));var toCsv=require(_0xd5fd('0xb'));var querystring=require(_0xd5fd('0xc'));var Papa=require(_0xd5fd('0xd'));var Redis=require(_0xd5fd('0xe'));var authService=require(_0xd5fd('0xf'));var qs=require(_0xd5fd('0x10'));var as=require(_0xd5fd('0x11'));var hardwareService=require(_0xd5fd('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd5fd('0x13'));var config=require(_0xd5fd('0x14'));var db=require(_0xd5fd('0x15'))['db'];config[_0xd5fd('0x16')]=_[_0xd5fd('0x17')](config[_0xd5fd('0x16')],{'host':_0xd5fd('0x18'),'port':0x18eb});var socket=require(_0xd5fd('0x19'))(new Redis(config[_0xd5fd('0x16')]));require(_0xd5fd('0x1a'))['register'](socket);function respondWithStatusCode(_0x101e7c,_0x70552a){_0x70552a=_0x70552a||0xcc;return function(_0x35b4ef){if(_0x35b4ef){return _0x101e7c['sendStatus'](_0x70552a);}return _0x101e7c[_0xd5fd('0x1b')](_0x70552a)[_0xd5fd('0x1c')]();};}function respondWithResult(_0x46cf72,_0x57b7e5){_0x57b7e5=_0x57b7e5||0xc8;return function(_0x360dd1){if(_0x360dd1){return _0x46cf72[_0xd5fd('0x1b')](_0x57b7e5)[_0xd5fd('0x1d')](_0x360dd1);}};}function respondWithFilteredResult(_0x2bbe59,_0x1a9816){return function(_0x209625){if(_0x209625){var _0x3171a2=_0x209625[_0xd5fd('0x1e')],_0x3d32d3=_0x1a9816[_0xd5fd('0x1f')],_0x2169dd=_0x1a9816[_0xd5fd('0x1f')]+_0x1a9816['limit'],_0x5c52ff;if(_0x2169dd>=_0x3171a2){_0x2169dd=_0x3171a2;_0x5c52ff=0xc8;}else{_0x5c52ff=0xce;}_0x2bbe59[_0xd5fd('0x1b')](_0x5c52ff);return _0x2bbe59[_0xd5fd('0x20')](_0xd5fd('0x21'),_0x3d32d3+'-'+_0x2169dd+'/'+_0x3171a2)[_0xd5fd('0x1d')](_0x209625);}return null;};}function patchUpdates(_0x393a4a){return function(_0x5d636b){try{jsonpatch[_0xd5fd('0x22')](_0x5d636b,_0x393a4a,!![]);}catch(_0x3adac0){return BPromise[_0xd5fd('0x23')](_0x3adac0);}return _0x5d636b[_0xd5fd('0x24')]();};}function saveUpdates(_0x387fe0,_0x2eadd9){return function(_0x40ef47){if(_0x40ef47){return _0x40ef47[_0xd5fd('0x25')](_0x387fe0)[_0xd5fd('0x26')](function(_0x224a5c){return _0x224a5c;});}return null;};}function removeEntity(_0x20a445,_0x20a5e8){return function(_0x87919b){if(_0x87919b){return _0x87919b[_0xd5fd('0x27')]()['then'](function(){var _0x375edd=_0x87919b[_0xd5fd('0x28')]({'plain':!![]});var _0x5e4cb8=_0xd5fd('0x29');return db[_0xd5fd('0x2a')][_0xd5fd('0x27')]({'where':{'type':_0x5e4cb8,'resourceId':_0x375edd['id']}})[_0xd5fd('0x26')](function(){return _0x87919b;});})[_0xd5fd('0x26')](function(){_0x20a445['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x354f27,_0x33861c){return function(_0x2a0850){if(!_0x2a0850){_0x354f27[_0xd5fd('0x2b')](0x194);}return _0x2a0850;};}function handleError(_0x39a97a,_0x30b293){_0x30b293=_0x30b293||0x1f4;return function(_0x37bfde){logger[_0xd5fd('0x2c')](_0x37bfde[_0xd5fd('0x2d')]);if(_0x37bfde['name']){delete _0x37bfde[_0xd5fd('0x2e')];}_0x39a97a[_0xd5fd('0x1b')](_0x30b293)[_0xd5fd('0x2f')](_0x37bfde);};}exports[_0xd5fd('0x30')]=function(_0x3cee8f,_0x46796a){var _0x2a2e57={},_0x374e5b={},_0x370d3b={'count':0x0,'rows':[]};var _0x133450=_['map'](db[_0xd5fd('0x31')][_0xd5fd('0x32')],function(_0x2a9f94){return{'name':_0x2a9f94[_0xd5fd('0x33')],'type':_0x2a9f94[_0xd5fd('0x34')][_0xd5fd('0x35')]};});_0x374e5b[_0xd5fd('0x36')]=_['map'](_0x133450,_0xd5fd('0x2e'));_0x374e5b[_0xd5fd('0x37')]=_[_0xd5fd('0x38')](_0x3cee8f[_0xd5fd('0x37')]);_0x374e5b[_0xd5fd('0x39')]=_['intersection'](_0x374e5b[_0xd5fd('0x36')],_0x374e5b['query']);_0x2a2e57[_0xd5fd('0x3a')]=_[_0xd5fd('0x3b')](_0x374e5b[_0xd5fd('0x36')],qs[_0xd5fd('0x3c')](_0x3cee8f[_0xd5fd('0x37')][_0xd5fd('0x3c')]));_0x2a2e57[_0xd5fd('0x3a')]=_0x2a2e57['attributes']['length']?_0x2a2e57[_0xd5fd('0x3a')]:_0x374e5b[_0xd5fd('0x36')];if(!_0x3cee8f[_0xd5fd('0x37')][_0xd5fd('0x3d')](_0xd5fd('0x3e'))){_0x2a2e57[_0xd5fd('0x3f')]=qs[_0xd5fd('0x3f')](_0x3cee8f[_0xd5fd('0x37')][_0xd5fd('0x3f')]);_0x2a2e57[_0xd5fd('0x1f')]=qs[_0xd5fd('0x1f')](_0x3cee8f['query'][_0xd5fd('0x1f')]);}_0x2a2e57[_0xd5fd('0x40')]=qs[_0xd5fd('0x41')](_0x3cee8f['query'][_0xd5fd('0x41')]);_0x2a2e57['where']=qs[_0xd5fd('0x39')](_[_0xd5fd('0x42')](_0x3cee8f[_0xd5fd('0x37')],_0x374e5b[_0xd5fd('0x39')]),_0x133450);if(_0x3cee8f[_0xd5fd('0x37')][_0xd5fd('0x43')]){_0x2a2e57[_0xd5fd('0x44')]=_[_0xd5fd('0x45')](_0x2a2e57[_0xd5fd('0x44')],{'$or':_[_0xd5fd('0x46')](_0x133450,function(_0xef38d4){if(_0xef38d4['type']!==_0xd5fd('0x47')){var _0xae1248={};_0xae1248[_0xef38d4[_0xd5fd('0x2e')]]={'$like':'%'+_0x3cee8f[_0xd5fd('0x37')][_0xd5fd('0x43')]+'%'};return _0xae1248;}})});}_0x2a2e57=_[_0xd5fd('0x45')]({},_0x2a2e57,_0x3cee8f[_0xd5fd('0x48')]);var _0x16aa54={'where':_0x2a2e57[_0xd5fd('0x44')]};return db[_0xd5fd('0x31')][_0xd5fd('0x1e')](_0x16aa54)['then'](function(_0x31d1eb){_0x370d3b[_0xd5fd('0x1e')]=_0x31d1eb;if(_0x3cee8f[_0xd5fd('0x37')][_0xd5fd('0x49')]){_0x2a2e57[_0xd5fd('0x4a')]=[{'all':!![]}];}return db['VoicePrefix'][_0xd5fd('0x4b')](_0x2a2e57);})[_0xd5fd('0x26')](function(_0x319c0b){_0x370d3b[_0xd5fd('0x4c')]=_0x319c0b;return _0x370d3b;})[_0xd5fd('0x26')](respondWithFilteredResult(_0x46796a,_0x2a2e57))[_0xd5fd('0x4d')](handleError(_0x46796a,null));};exports[_0xd5fd('0x4e')]=function(_0x12d826,_0x1b39d2){var _0x3af64e={'raw':![],'where':{'id':_0x12d826['params']['id']}},_0xaa5bd1={};_0xaa5bd1[_0xd5fd('0x36')]=_[_0xd5fd('0x38')](db['VoicePrefix'][_0xd5fd('0x32')]);_0xaa5bd1[_0xd5fd('0x37')]=_[_0xd5fd('0x38')](_0x12d826[_0xd5fd('0x37')]);_0xaa5bd1['filters']=_[_0xd5fd('0x3b')](_0xaa5bd1[_0xd5fd('0x36')],_0xaa5bd1[_0xd5fd('0x37')]);_0x3af64e[_0xd5fd('0x3a')]=_[_0xd5fd('0x3b')](_0xaa5bd1[_0xd5fd('0x36')],qs['fields'](_0x12d826[_0xd5fd('0x37')][_0xd5fd('0x3c')]));_0x3af64e[_0xd5fd('0x3a')]=_0x3af64e[_0xd5fd('0x3a')][_0xd5fd('0x4f')]?_0x3af64e['attributes']:_0xaa5bd1[_0xd5fd('0x36')];if(_0x12d826[_0xd5fd('0x37')][_0xd5fd('0x49')]){_0x3af64e[_0xd5fd('0x4a')]=[{'all':!![]}];}_0x3af64e=_[_0xd5fd('0x45')]({},_0x3af64e,_0x12d826['options']);return db[_0xd5fd('0x31')]['find'](_0x3af64e)[_0xd5fd('0x26')](handleEntityNotFound(_0x1b39d2,null))[_0xd5fd('0x26')](respondWithResult(_0x1b39d2,null))[_0xd5fd('0x4d')](handleError(_0x1b39d2,null));};exports[_0xd5fd('0x27')]=function(_0x1c4a07,_0x201c24){return db[_0xd5fd('0x31')][_0xd5fd('0x50')]({'where':{'id':_0x1c4a07[_0xd5fd('0x51')]['id']}})[_0xd5fd('0x26')](handleEntityNotFound(_0x201c24,null))[_0xd5fd('0x26')](removeEntity(_0x201c24,null))[_0xd5fd('0x4d')](handleError(_0x201c24,null));};exports[_0xd5fd('0x52')]=function(_0x21dc13,_0x1bee4c){return db['VoicePrefix']['describe']()['then'](respondWithResult(_0x1bee4c,null))[_0xd5fd('0x4d')](handleError(_0x1bee4c,null));};exports[_0xd5fd('0x53')]=function(_0x32db52,_0x2a0a28){var _0x464e31;return db['sequelize']['transaction'](function(_0xd3da7f){return db[_0xd5fd('0x31')][_0xd5fd('0x53')](_0x32db52[_0xd5fd('0x54')],{'transaction':_0xd3da7f})[_0xd5fd('0x26')](function(_0x62cbe3){_0x464e31=_0x62cbe3[_0xd5fd('0x28')]({'plain':!![]});return db[_0xd5fd('0x55')][_0xd5fd('0x50')]({'where':{'id':_0x464e31['VoiceExtensionId']},'raw':!![]})['then'](function(_0xcbb68f){return createVoicePrefixExtensions(_0x464e31,_0xcbb68f,_0xd3da7f);});});})['then'](function(){var _0x1ea628=_0x32db52['user']['get']({'plain':!![]});if(!_0x1ea628)throw new Error(_0xd5fd('0x56'));if(_0x1ea628[_0xd5fd('0x57')]===_0xd5fd('0x58')){var _0x44ee16=_0x464e31;return db['UserProfileSection']['find']({'where':{'name':_0xd5fd('0x29'),'userProfileId':_0x1ea628['userProfileId']},'raw':!![]})[_0xd5fd('0x26')](function(_0x24fe8f){if(_0x24fe8f&&_0x24fe8f[_0xd5fd('0x59')]===0x0){return db[_0xd5fd('0x2a')][_0xd5fd('0x53')]({'name':_0x44ee16[_0xd5fd('0x2e')],'resourceId':_0x44ee16['id'],'type':_0x24fe8f[_0xd5fd('0x2e')],'sectionId':_0x24fe8f['id']},{})[_0xd5fd('0x26')](function(){return _0x464e31;});}else{return _0x464e31;}})[_0xd5fd('0x4d')](function(_0x23793a){logger[_0xd5fd('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23793a);throw _0x23793a;});}return _0x464e31;})[_0xd5fd('0x26')](respondWithResult(_0x2a0a28,null))[_0xd5fd('0x4d')](handleError(_0x2a0a28,null));};function Extension(_0x42c41d,_0x367f8f,_0x211cae,_0x36f735){this[_0xd5fd('0x5a')]='from-sip';this[_0xd5fd('0x5b')]=_0x42c41d;this['app']=_0x211cae;this[_0xd5fd('0x34')]=_0xd5fd('0x5c');this[_0xd5fd('0x5d')]=_0xd5fd('0x5e');this[_0xd5fd('0x5f')]=_0x367f8f;this[_0xd5fd('0x60')]=_0x36f735;}function createVoicePrefixExtensions(_0x40ea21,_0x2e36c0,_0x5d6d66){return new BPromise(function(_0x455fd4,_0x569e0f){var _0x4bba62=new Extension(formatPrefixName(_0x40ea21['prefix']),0x1,_0xd5fd('0x61'),_0xd5fd('0x62'));_0x4bba62[_0xd5fd('0x63')]=_0x40ea21['id'];return db['VoiceExtension'][_0xd5fd('0x53')](_0x4bba62,{'transaction':_0x5d6d66})[_0xd5fd('0x26')](function(_0x38af37){var _0x7f94a2=_0x38af37['get']({'plain':!![]});var _0x1232e3=_[_0xd5fd('0x46')](addVoicePrefixExtensions(_0x40ea21,_0x2e36c0),function(_0x3779d4){_0x3779d4[_0xd5fd('0x64')]=_0x7f94a2['id'];_0x3779d4[_0xd5fd('0x63')]=_0x40ea21['id'];return _0x3779d4;});return db[_0xd5fd('0x55')][_0xd5fd('0x65')](_0x1232e3,{'transaction':_0x5d6d66})[_0xd5fd('0x26')](function(_0x3b8b09){if(!_0x3b8b09){return _0x569e0f(_0xd5fd('0x66'));}else{return _0x455fd4(_0x3b8b09);}})[_0xd5fd('0x4d')](function(_0xa2cecc){return _0x569e0f(_0xa2cecc);});});;});};function addVoicePrefixExtensions(_0x51f5b8,_0x307cfa){var _0x4bc281=[];var _0x5ceaf3=formatPrefixName(_0x51f5b8[_0xd5fd('0x67')]);_0x4bc281[_0xd5fd('0x68')](new Extension(_0x5ceaf3,0x2,_0xd5fd('0x69'),'CDR(prefix)='+_0x51f5b8[_0xd5fd('0x2e')]));if(_0x51f5b8[_0xd5fd('0x6a')]){_0x4bc281[_0xd5fd('0x68')](new Extension(_0x5ceaf3,0x3,_0xd5fd('0x69'),_0xd5fd('0x6b')+_0x51f5b8[_0xd5fd('0x6a')]));}else{_0x4bc281[_0xd5fd('0x68')](new Extension(_0x5ceaf3,0x3,'NoOp',_0xd5fd('0x6c')));}_0x4bc281[_0xd5fd('0x68')](new Extension(_0x5ceaf3,0x4,_0xd5fd('0x6d'),_0x307cfa[_0xd5fd('0x5a')]+','+_0xd5fd('0x6e')+(0x8+_0x51f5b8[_0xd5fd('0x2e')][_0xd5fd('0x4f')])+'}'+','+0x1));return _0x4bc281;}function formatPrefixName(_0xc4b21b){var _0x4c7617='_';for(var _0xf202d5=0x0;_0xf202d5<_0xc4b21b[_0xd5fd('0x4f')];_0xf202d5++){if(_0xc4b21b[_0xd5fd('0x6f')](_0xf202d5)=='-'){_0x4c7617+=_0xc4b21b[_0xd5fd('0x6f')](_0xf202d5);}else{_0x4c7617+='['+_0xc4b21b[_0xd5fd('0x6f')](_0xf202d5)+']';}}_0x4c7617+='.';return _0x4c7617;}exports[_0xd5fd('0x25')]=function(_0x5615a0,_0x34ba2e,_0x20691e){var _0x5d0db6=_0x5615a0[_0xd5fd('0x54')];_0x5d0db6['prefix']=_0xd5fd('0x70')+_0x5d0db6[_0xd5fd('0x2e')]+'-';return db[_0xd5fd('0x71')][_0xd5fd('0x72')](function(_0x330b1f){return db[_0xd5fd('0x31')]['update'](_0x5d0db6,{'where':{'id':_0x5d0db6['id']},'transaction':_0x330b1f})[_0xd5fd('0x26')](function(){return db['VoiceExtension'][_0xd5fd('0x27')]({'where':{'VoicePrefixId':_0x5d0db6['id']},'transaction':_0x330b1f})[_0xd5fd('0x26')](function(){return db[_0xd5fd('0x55')][_0xd5fd('0x50')]({'where':{'id':_0x5d0db6['VoiceExtensionId']},'raw':!![]})[_0xd5fd('0x26')](function(_0x3ae5f5){return createVoicePrefixExtensions(_0x5d0db6,_0x3ae5f5,_0x330b1f);});});});})[_0xd5fd('0x26')](function(){return db[_0xd5fd('0x31')][_0xd5fd('0x73')](_0x5d0db6['id']);})[_0xd5fd('0x26')](respondWithResult(_0x34ba2e,null))[_0xd5fd('0x4d')](handleError(_0x34ba2e,null));};exports[_0xd5fd('0x74')]=function(_0x3a14b2,_0x4b49ae,_0x1c5651){return db[_0xd5fd('0x31')]['find']({'where':{'id':_0x3a14b2['params']['id']}})[_0xd5fd('0x26')](handleEntityNotFound(_0x4b49ae,null))[_0xd5fd('0x26')](function(_0x17d176){if(_0x17d176){return _0x17d176[_0xd5fd('0x74')](_0x3a14b2[_0xd5fd('0x54')][_0xd5fd('0x75')],_[_0xd5fd('0x76')](_0x3a14b2[_0xd5fd('0x54')],[_0xd5fd('0x75'),'id'])||{})[_0xd5fd('0x77')](function(_0x2f7b20){for(var _0x22e471=0x0;_0x22e471<_0x3a14b2[_0xd5fd('0x54')][_0xd5fd('0x75')]['length'];_0x22e471+=0x1){socket['emit'](_0xd5fd('0x78'),{'UserId':_0x3a14b2[_0xd5fd('0x54')]['ids'][_0x22e471],'VoicePrefixId':_0x3a14b2[_0xd5fd('0x51')]['id']});}return _0x2f7b20;});}})[_0xd5fd('0x26')](respondWithResult(_0x4b49ae,null))[_0xd5fd('0x4d')](handleError(_0x4b49ae,null));};exports[_0xd5fd('0x79')]=function(_0x29d22b,_0x33affb,_0x44a8b4){return db[_0xd5fd('0x31')][_0xd5fd('0x50')]({'where':{'id':_0x29d22b[_0xd5fd('0x51')]['id']}})['then'](handleEntityNotFound(_0x33affb,null))['then'](function(_0x5015f5){if(_0x5015f5){return _0x5015f5[_0xd5fd('0x79')](_0x29d22b[_0xd5fd('0x37')][_0xd5fd('0x75')])[_0xd5fd('0x26')](function(){if(_['isArray'](_0x29d22b[_0xd5fd('0x37')][_0xd5fd('0x75')])){for(var _0x5c51d8=0x0;_0x5c51d8<_0x29d22b[_0xd5fd('0x37')]['ids'][_0xd5fd('0x4f')];_0x5c51d8+=0x1){socket[_0xd5fd('0x7a')](_0xd5fd('0x7b'),{'UserId':Number(_0x29d22b[_0xd5fd('0x37')][_0xd5fd('0x75')][_0x5c51d8]),'VoicePrefixId':Number(_0x29d22b[_0xd5fd('0x51')]['id'])});}}else{socket['emit'](_0xd5fd('0x7b'),{'UserId':Number(_0x29d22b[_0xd5fd('0x37')][_0xd5fd('0x75')]),'VoicePrefixId':Number(_0x29d22b[_0xd5fd('0x51')]['id'])});}});}})[_0xd5fd('0x26')](respondWithStatusCode(_0x33affb,null))[_0xd5fd('0x4d')](handleError(_0x33affb,null));};exports['getAgents']=function(_0x46f9d6,_0x28b83c,_0x3833d9){var _0x492770={};var _0x449084={};var _0x2d2f8f;var _0x5c7daf;return db[_0xd5fd('0x31')][_0xd5fd('0x7c')]({'where':{'id':_0x46f9d6[_0xd5fd('0x51')]['id']}})[_0xd5fd('0x26')](handleEntityNotFound(_0x28b83c,null))[_0xd5fd('0x26')](function(_0x4a7939){if(_0x4a7939){_0x2d2f8f=_0x4a7939;_0x449084[_0xd5fd('0x36')]=_[_0xd5fd('0x38')](db[_0xd5fd('0x7d')]['rawAttributes']);_0x449084[_0xd5fd('0x37')]=_[_0xd5fd('0x38')](_0x46f9d6[_0xd5fd('0x37')]);_0x449084[_0xd5fd('0x39')]=_[_0xd5fd('0x3b')](_0x449084[_0xd5fd('0x36')],_0x449084['query']);_0x492770[_0xd5fd('0x3a')]=_[_0xd5fd('0x3b')](_0x449084[_0xd5fd('0x36')],qs[_0xd5fd('0x3c')](_0x46f9d6['query'][_0xd5fd('0x3c')]));_0x492770['attributes']=_0x492770[_0xd5fd('0x3a')][_0xd5fd('0x4f')]?_0x492770[_0xd5fd('0x3a')]:_0x449084[_0xd5fd('0x36')];_0x492770[_0xd5fd('0x40')]=qs[_0xd5fd('0x41')](_0x46f9d6['query']['sort']);_0x492770[_0xd5fd('0x44')]=qs['filters'](_[_0xd5fd('0x42')](_0x46f9d6['query'],_0x449084[_0xd5fd('0x39')]));if(_0x46f9d6[_0xd5fd('0x37')][_0xd5fd('0x43')]){_0x492770[_0xd5fd('0x44')]=_[_0xd5fd('0x45')](_0x492770[_0xd5fd('0x44')],{'$or':_['map'](_0x492770[_0xd5fd('0x3a')],function(_0x11f721){var _0x5cf5af={};_0x5cf5af[_0x11f721]={'$like':'%'+_0x46f9d6[_0xd5fd('0x37')][_0xd5fd('0x43')]+'%'};return _0x5cf5af;})});}_0x492770=_[_0xd5fd('0x45')]({},_0x492770,_0x46f9d6[_0xd5fd('0x48')]);return _0x2d2f8f[_0xd5fd('0x7e')](_0x492770);}})[_0xd5fd('0x26')](function(_0x23e87b){if(_0x23e87b){_0x5c7daf=_0x23e87b[_0xd5fd('0x4f')];if(!_0x46f9d6[_0xd5fd('0x37')][_0xd5fd('0x3d')](_0xd5fd('0x3e'))){_0x492770[_0xd5fd('0x3f')]=qs[_0xd5fd('0x3f')](_0x46f9d6[_0xd5fd('0x37')][_0xd5fd('0x3f')]);_0x492770['offset']=qs[_0xd5fd('0x1f')](_0x46f9d6[_0xd5fd('0x37')][_0xd5fd('0x1f')]);}return _0x2d2f8f['getAgents'](_0x492770);}})[_0xd5fd('0x26')](function(_0x38f342){if(_0x38f342){return _0x38f342?{'count':_0x5c7daf,'rows':_0x38f342}:null;}})[_0xd5fd('0x26')](respondWithResult(_0x28b83c,null))[_0xd5fd('0x4d')](handleError(_0x28b83c,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index d19a32d..27f822a 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xedd9,0xfc));var _0x9edd=function(_0x116255,_0x1bb57b){_0x116255=_0x116255-0x0;var _0x5cfb32=_0xedd9[_0x116255];return _0x5cfb32;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x2482ba,_0x564210){var _0x409a90=function(_0xa47d7e){while(--_0xa47d7e){_0x2482ba['push'](_0x2482ba['shift']());}};_0x409a90(++_0x564210);}(_0x008c,0x188));var _0xc008=function(_0x3a4203,_0xa6ff2e){_0x3a4203=_0x3a4203-0x0;var _0x1a5661=_0x008c[_0x3a4203];return _0x1a5661;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 79c8713..29618c3 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 _0xb808=['../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb808,0x7b));var _0x8b80=function(_0x2efaa3,_0x35f359){_0x2efaa3=_0x2efaa3-0x0;var _0x24f34c=_0xb808[_0x2efaa3];return _0x24f34c;};'use strict';var _=require(_0x8b80('0x0'));var util=require(_0x8b80('0x1'));var logger=require(_0x8b80('0x2'))(_0x8b80('0x3'));var moment=require(_0x8b80('0x4'));var BPromise=require('bluebird');var rp=require(_0x8b80('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b80('0x6'));var config=require(_0x8b80('0x7'));var attributes=require(_0x8b80('0x8'));module[_0x8b80('0x9')]=function(_0x496642,_0x803b26){return _0x496642[_0x8b80('0xa')](_0x8b80('0xb'),attributes,{'tableName':_0x8b80('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa64f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','voice_prefixes'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xa64f,0x84));var _0xfa64=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa64f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfa64('0x0'));var util=require(_0xfa64('0x1'));var logger=require(_0xfa64('0x2'))(_0xfa64('0x3'));var moment=require('moment');var BPromise=require(_0xfa64('0x4'));var rp=require(_0xfa64('0x5'));var fs=require('fs');var path=require(_0xfa64('0x6'));var rimraf=require(_0xfa64('0x7'));var config=require(_0xfa64('0x8'));var attributes=require(_0xfa64('0x9'));module['exports']=function(_0x451900,_0xa7ac8a){return _0x451900[_0xfa64('0xa')]('VoicePrefix',attributes,{'tableName':_0xfa64('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 cb1c3e9..1de885c 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 _0xad71=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','then'];(function(_0x2c6992,_0x5bf3ce){var _0x3361db=function(_0x4192a4){while(--_0x4192a4){_0x2c6992['push'](_0x2c6992['shift']());}};_0x3361db(++_0x5bf3ce);}(_0xad71,0x126));var _0x1ad7=function(_0x1d6cf0,_0x400647){_0x1d6cf0=_0x1d6cf0-0x0;var _0x4c19cd=_0xad71[_0x1d6cf0];return _0x4c19cd;};'use strict';var _=require(_0x1ad7('0x0'));var util=require('util');var moment=require(_0x1ad7('0x1'));var BPromise=require(_0x1ad7('0x2'));var rs=require(_0x1ad7('0x3'));var fs=require('fs');var Redis=require(_0x1ad7('0x4'));var db=require(_0x1ad7('0x5'))['db'];var utils=require(_0x1ad7('0x6'));var logger=require('../../config/logger')(_0x1ad7('0x7'));var config=require(_0x1ad7('0x8'));var jayson=require(_0x1ad7('0x9'));var client=jayson[_0x1ad7('0xa')][_0x1ad7('0xb')]({'port':0x232a});config[_0x1ad7('0xc')]=_[_0x1ad7('0xd')](config['redis'],{'host':_0x1ad7('0xe'),'port':0x18eb});var socket=require(_0x1ad7('0xf'))(new Redis(config['redis']));require(_0x1ad7('0x10'))['register'](socket);function respondWithRpcPromise(_0x54bc8c,_0x7388e9,_0x9bba3c){return new BPromise(function(_0x324b6d,_0x2420f7){return client['request'](_0x54bc8c,_0x9bba3c)[_0x1ad7('0x11')](function(_0xb6291b){logger[_0x1ad7('0x12')](_0x1ad7('0x13'),_0x7388e9,_0x1ad7('0x14'));logger['debug'](_0x1ad7('0x15'),_0x7388e9,_0x1ad7('0x14'),JSON['stringify'](_0xb6291b));if(_0xb6291b[_0x1ad7('0x16')]){if(_0xb6291b[_0x1ad7('0x16')][_0x1ad7('0x17')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x7388e9,_0xb6291b['error'][_0x1ad7('0x18')]);return _0x2420f7(_0xb6291b[_0x1ad7('0x16')]['message']);}logger[_0x1ad7('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x7388e9,_0xb6291b['error'][_0x1ad7('0x18')]);return _0x324b6d(_0xb6291b[_0x1ad7('0x16')][_0x1ad7('0x18')]);}else{logger[_0x1ad7('0x12')](_0x1ad7('0x13'),_0x7388e9,_0x1ad7('0x14'));_0x324b6d(_0xb6291b[_0x1ad7('0x19')][_0x1ad7('0x18')]);}})['catch'](function(_0x18f75d){logger['error'](_0x1ad7('0x13'),_0x7388e9,_0x18f75d);_0x2420f7(_0x18f75d);});});} \ No newline at end of file +var _0xf3a3=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voicePrefix.socket','register','request','then'];(function(_0x168001,_0x37e3a1){var _0x141e86=function(_0x11556c){while(--_0x11556c){_0x168001['push'](_0x168001['shift']());}};_0x141e86(++_0x37e3a1);}(_0xf3a3,0x18f));var _0x3f3a=function(_0x21b49a,_0x4a930c){_0x21b49a=_0x21b49a-0x0;var _0x2e0492=_0xf3a3[_0x21b49a];return _0x2e0492;};'use strict';var _=require(_0x3f3a('0x0'));var util=require(_0x3f3a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3f3a('0x2'));var fs=require('fs');var Redis=require(_0x3f3a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f3a('0x4'));var logger=require(_0x3f3a('0x5'))(_0x3f3a('0x6'));var config=require(_0x3f3a('0x7'));var jayson=require(_0x3f3a('0x8'));var client=jayson[_0x3f3a('0x9')][_0x3f3a('0xa')]({'port':0x232a});config[_0x3f3a('0xb')]=_['defaults'](config[_0x3f3a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f3a('0xc'))(new Redis(config['redis']));require(_0x3f3a('0xd'))[_0x3f3a('0xe')](socket);function respondWithRpcPromise(_0x58ec9c,_0x2d5a44,_0x3ca538){return new BPromise(function(_0x3d2680,_0x5ea839){return client[_0x3f3a('0xf')](_0x58ec9c,_0x3ca538)[_0x3f3a('0x10')](function(_0x277364){logger[_0x3f3a('0x11')](_0x3f3a('0x12'),_0x2d5a44,_0x3f3a('0x13'));logger[_0x3f3a('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2d5a44,_0x3f3a('0x13'),JSON['stringify'](_0x277364));if(_0x277364[_0x3f3a('0x15')]){if(_0x277364[_0x3f3a('0x15')][_0x3f3a('0x16')]===0x1f4){logger['error'](_0x3f3a('0x12'),_0x2d5a44,_0x277364['error'][_0x3f3a('0x17')]);return _0x5ea839(_0x277364['error']['message']);}logger[_0x3f3a('0x15')](_0x3f3a('0x12'),_0x2d5a44,_0x277364['error']['message']);return _0x3d2680(_0x277364[_0x3f3a('0x15')][_0x3f3a('0x17')]);}else{logger[_0x3f3a('0x11')](_0x3f3a('0x12'),_0x2d5a44,_0x3f3a('0x13'));_0x3d2680(_0x277364[_0x3f3a('0x18')]['message']);}})[_0x3f3a('0x19')](function(_0x42f801){logger['error'](_0x3f3a('0x12'),_0x2d5a44,_0x42f801);_0x5ea839(_0x42f801);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 698193b..bda17ad 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 _0x41c0=['removeListener','register','./voicePrefix.events','remove','update','emit'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x41c0,0x140));var _0x041c=function(_0x4ce960,_0x4258e9){_0x4ce960=_0x4ce960-0x0;var _0x43a9d1=_0x41c0[_0x4ce960];return _0x43a9d1;};'use strict';var VoicePrefixEvents=require(_0x041c('0x0'));var events=['save',_0x041c('0x1'),_0x041c('0x2')];function createListener(_0x1cc831,_0x211b12){return function(_0x41b4de){_0x211b12[_0x041c('0x3')](_0x1cc831,_0x41b4de);};}function removeListener(_0x575cb3,_0x43d1bd){return function(){VoicePrefixEvents[_0x041c('0x4')](_0x575cb3,_0x43d1bd);};}exports[_0x041c('0x5')]=function(_0x125381){for(var _0x2750a2=0x0,_0xdf28a9=events['length'];_0x2750a2<_0xdf28a9;_0x2750a2++){var _0x3c4e56=events[_0x2750a2];var _0x55b818=createListener('voicePrefix:'+_0x3c4e56,_0x125381);VoicePrefixEvents['on'](_0x3c4e56,_0x55b818);}}; \ No newline at end of file +var _0x5eff=['removeListener','register','length','voicePrefix:','remove','update'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0x5eff,0x106));var _0xf5ef=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x5eff[_0x11005e];return _0x29338f;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xf5ef('0x0'),_0xf5ef('0x1')];function createListener(_0xc018e9,_0x552c4b){return function(_0x9d0a1b){_0x552c4b['emit'](_0xc018e9,_0x9d0a1b);};}function removeListener(_0x583177,_0xca3b29){return function(){VoicePrefixEvents[_0xf5ef('0x2')](_0x583177,_0xca3b29);};}exports[_0xf5ef('0x3')]=function(_0x1520a6){for(var _0x744ff3=0x0,_0x2eb2c3=events[_0xf5ef('0x4')];_0x744ff3<_0x2eb2c3;_0x744ff3++){var _0x2e8df8=events[_0x744ff3];var _0xf0e159=createListener(_0xf5ef('0x5')+_0x2e8df8,_0x1520a6);VoicePrefixEvents['on'](_0x2e8df8,_0xf0e159);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index bbecfe2..e13ff98 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 _0x54c5=['/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','/:id/members','/:id/lists','getBlackLists','post','create','/:id/clone','clone','addTeams','addAgents','addBlackLists','put','update','delete','destroy','removeTeams','removeLists','removeBlackLists','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x54c5,0x1f0));var _0x554c=function(_0x235446,_0x40ff49){_0x235446=_0x235446-0x0;var _0x13aae1=_0x54c5[_0x235446];return _0x13aae1;};'use strict';var multer=require(_0x554c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x554c('0x1'));var router=express[_0x554c('0x2')]();var auth=require(_0x554c('0x3'));var interaction=require(_0x554c('0x4'));var config=require(_0x554c('0x5'));var controller=require('./voiceQueue.controller');router[_0x554c('0x6')]('/',auth['isAuthenticated'](),controller[_0x554c('0x7')]);router['get'](_0x554c('0x8'),auth[_0x554c('0x9')](),controller['show']);router['get'](_0x554c('0xa'),auth['isAuthenticated'](),controller[_0x554c('0xb')]);router[_0x554c('0x6')](_0x554c('0xc'),auth[_0x554c('0x9')](),controller['getHopperHistories']);router['get'](_0x554c('0xd'),auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x554c('0xe'),auth[_0x554c('0x9')](),controller[_0x554c('0xf')]);router[_0x554c('0x6')](_0x554c('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x554c('0x6')](_0x554c('0x11'),auth[_0x554c('0x9')](),controller['getAgents']);router[_0x554c('0x6')](_0x554c('0x12'),auth[_0x554c('0x9')](),controller['getMembers']);router[_0x554c('0x6')](_0x554c('0x13'),auth['isAuthenticated'](),controller['getLists']);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x554c('0x14')]);router[_0x554c('0x15')]('/',auth['isAuthenticated'](),controller[_0x554c('0x16')]);router['post'](_0x554c('0x17'),auth[_0x554c('0x9')](),controller[_0x554c('0x18')]);router[_0x554c('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x554c('0x19')]);router[_0x554c('0x15')](_0x554c('0x11'),auth[_0x554c('0x9')](),controller[_0x554c('0x1a')]);router[_0x554c('0x15')](_0x554c('0x13'),auth['isAuthenticated'](),controller['addLists']);router[_0x554c('0x15')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x554c('0x1b')]);router[_0x554c('0x1c')](_0x554c('0x8'),auth[_0x554c('0x9')](),controller[_0x554c('0x1d')]);router[_0x554c('0x1e')](_0x554c('0x8'),auth[_0x554c('0x9')](),controller[_0x554c('0x1f')]);router[_0x554c('0x1e')](_0x554c('0x10'),auth[_0x554c('0x9')](),controller[_0x554c('0x20')]);router[_0x554c('0x1e')](_0x554c('0x11'),auth[_0x554c('0x9')](),controller['removeAgents']);router['delete'](_0x554c('0x13'),auth['isAuthenticated'](),controller[_0x554c('0x21')]);router['delete']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x554c('0x22')]);module[_0x554c('0x23')]=router; \ No newline at end of file +var _0xe5f3=['addTeams','addAgents','addLists','addBlackLists','put','delete','destroy','removeAgents','removeLists','multer','path','express','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone'];(function(_0x414110,_0x45a41b){var _0x55cc70=function(_0x24154f){while(--_0x24154f){_0x414110['push'](_0x414110['shift']());}};_0x55cc70(++_0x45a41b);}(_0xe5f3,0xb8));var _0x3e5f=function(_0x11e607,_0x17bbce){_0x11e607=_0x11e607-0x0;var _0x5778b5=_0xe5f3[_0x11e607];return _0x5778b5;};'use strict';var multer=require(_0x3e5f('0x0'));var util=require('util');var path=require(_0x3e5f('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e5f('0x2'));var router=express['Router']();var auth=require(_0x3e5f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3e5f('0x4'));var controller=require(_0x3e5f('0x5'));router[_0x3e5f('0x6')]('/',auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x8')]);router[_0x3e5f('0x6')](_0x3e5f('0x9'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0xa')]);router[_0x3e5f('0x6')](_0x3e5f('0xb'),auth[_0x3e5f('0x7')](),controller['getHoppers']);router[_0x3e5f('0x6')](_0x3e5f('0xc'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0xd')]);router[_0x3e5f('0x6')](_0x3e5f('0xe'),auth[_0x3e5f('0x7')](),controller['getHopperFinals']);router['get'](_0x3e5f('0xf'),auth['isAuthenticated'](),controller[_0x3e5f('0x10')]);router['get'](_0x3e5f('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3e5f('0x6')](_0x3e5f('0x12'),auth[_0x3e5f('0x7')](),controller['getAgents']);router[_0x3e5f('0x6')]('/:id/members',auth[_0x3e5f('0x7')](),controller['getMembers']);router['get'](_0x3e5f('0x13'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x14')]);router[_0x3e5f('0x6')](_0x3e5f('0x15'),auth[_0x3e5f('0x7')](),controller['getBlackLists']);router[_0x3e5f('0x16')]('/',auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x17')]);router['post'](_0x3e5f('0x18'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x19')]);router[_0x3e5f('0x16')](_0x3e5f('0x11'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x1a')]);router[_0x3e5f('0x16')](_0x3e5f('0x12'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x1b')]);router[_0x3e5f('0x16')](_0x3e5f('0x13'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x1c')]);router[_0x3e5f('0x16')](_0x3e5f('0x15'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x1d')]);router[_0x3e5f('0x1e')]('/:id',auth[_0x3e5f('0x7')](),controller['update']);router[_0x3e5f('0x1f')](_0x3e5f('0x9'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x20')]);router['delete'](_0x3e5f('0x11'),auth[_0x3e5f('0x7')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x21')]);router[_0x3e5f('0x1f')](_0x3e5f('0x13'),auth['isAuthenticated'](),controller[_0x3e5f('0x22')]);router[_0x3e5f('0x1f')](_0x3e5f('0x15'),auth[_0x3e5f('0x7')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 76a409f..21c0481 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(_0x1c1bbb,_0x38a0b8){var _0x2e667c=function(_0x154180){while(--_0x154180){_0x1c1bbb['push'](_0x1c1bbb['shift']());}};_0x2e667c(++_0x38a0b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x160cbc,_0x3025a6){var _0x4ac8c6=function(_0x27e1d3){while(--_0x27e1d3){_0x160cbc['push'](_0x160cbc['shift']());}};_0x4ac8c6(++_0x3025a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 139a1e2..c87128e 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 _0xf62e=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./voiceQueue.socket','register','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','get','VoiceQueues','inbound','outbound','ignore','value','includes','type','find','UserProfileResource','error','stack','name','send','index','map','VoiceQueue','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','findAll','rows','show','params','keys','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','pick','filter','getHopperHistories','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','User','Agents','online','voicePause','interface','forEach','each','UserVoiceQueue','findOrCreate','penalty','UserVoiceQueueRt','upsert','SIP/%s','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','sequelize','every','TeamId','all','transaction','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','ids','spread','push','isNil','format','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','fromQuery','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x1a4e2e,_0x4366d9){var _0x327401=function(_0x21e5f3){while(--_0x21e5f3){_0x1a4e2e['push'](_0x1a4e2e['shift']());}};_0x327401(++_0x4366d9);}(_0xf62e,0x160));var _0xef62=function(_0x5e6954,_0x2d755c){_0x5e6954=_0x5e6954-0x0;var _0x261f97=_0xf62e[_0x5e6954];return _0x261f97;};'use strict';var pdf=require(_0xef62('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xef62('0x1'));var zipdir=require(_0xef62('0x2'));var jsonpatch=require(_0xef62('0x3'));var rp=require(_0xef62('0x4'));var moment=require('moment');var BPromise=require(_0xef62('0x5'));var Mustache=require(_0xef62('0x6'));var util=require(_0xef62('0x7'));var path=require(_0xef62('0x8'));var sox=require(_0xef62('0x9'));var csv=require(_0xef62('0xa'));var ejs=require(_0xef62('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xef62('0xc'));var crypto=require(_0xef62('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xef62('0xe'));var toCsv=require(_0xef62('0xa'));var querystring=require(_0xef62('0xf'));var Papa=require(_0xef62('0x10'));var Redis=require(_0xef62('0x11'));var authService=require(_0xef62('0x12'));var qs=require(_0xef62('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xef62('0x14'));var utils=require('../../config/utils');var config=require(_0xef62('0x15'));var db=require(_0xef62('0x16'))['db'];config[_0xef62('0x17')]=_['defaults'](config['redis'],{'host':_0xef62('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef62('0x17')]));require(_0xef62('0x19'))[_0xef62('0x1a')](socket);function respondWithStatusCode(_0x1308d6,_0x3889d4){_0x3889d4=_0x3889d4||0xcc;return function(_0x20824a){if(_0x20824a){return _0x1308d6['sendStatus'](_0x3889d4);}return _0x1308d6[_0xef62('0x1b')](_0x3889d4)[_0xef62('0x1c')]();};}function respondWithResult(_0x5cb33c,_0x5d5949){_0x5d5949=_0x5d5949||0xc8;return function(_0x3766a4){if(_0x3766a4){return _0x5cb33c['status'](_0x5d5949)[_0xef62('0x1d')](_0x3766a4);}};}function respondWithFilteredResult(_0x18b447,_0x3d28bc){return function(_0x1e52f3){if(_0x1e52f3){var _0x5e0852=_0x1e52f3[_0xef62('0x1e')],_0x379c2e=_0x3d28bc['offset'],_0x5e9fc3=_0x3d28bc[_0xef62('0x1f')]+_0x3d28bc[_0xef62('0x20')],_0x3a5be9;if(_0x5e9fc3>=_0x5e0852){_0x5e9fc3=_0x5e0852;_0x3a5be9=0xc8;}else{_0x3a5be9=0xce;}_0x18b447[_0xef62('0x1b')](_0x3a5be9);return _0x18b447[_0xef62('0x21')]('Content-Range',_0x379c2e+'-'+_0x5e9fc3+'/'+_0x5e0852)[_0xef62('0x1d')](_0x1e52f3);}return null;};}function patchUpdates(_0x52c0ba){return function(_0x5935ac){try{jsonpatch[_0xef62('0x22')](_0x5935ac,_0x52c0ba,!![]);}catch(_0x4bcf14){return BPromise[_0xef62('0x23')](_0x4bcf14);}return _0x5935ac['save']();};}function saveUpdates(_0x2c7143,_0x51cea0){return function(_0x53d03a){if(_0x53d03a){return _0x53d03a[_0xef62('0x24')](_0x2c7143)[_0xef62('0x25')](function(_0x204c33){return _0x204c33;});}return null;};}function removeEntity(_0x503cb4,_0x4906ea){return function(_0x299474){if(_0x299474){return _0x299474[_0xef62('0x26')]()['then'](function(){var _0x3f69f9=_0x299474[_0xef62('0x27')]({'plain':!![]});var _0x15350e=[{'name':_0xef62('0x28'),'value':_0xef62('0x29'),'ignore':![]},{'name':'QueueCampaigns','value':_0xef62('0x2a'),'ignore':![]}];var _0x2f346d=_(_0x15350e)['filter'](_0xef62('0x2b'))['map'](_0xef62('0x2c'))['value']();if(_[_0xef62('0x2d')](_0x2f346d,_0x3f69f9[_0xef62('0x2e')])){return;}var _0x504f49=_[_0xef62('0x2f')](_0x15350e,['value',_0x3f69f9[_0xef62('0x2e')]])['name'];return db[_0xef62('0x30')][_0xef62('0x26')]({'where':{'type':_0x504f49,'resourceId':_0x3f69f9['id']}})[_0xef62('0x25')](function(){return _0x299474;});})[_0xef62('0x25')](function(){_0x503cb4['status'](0xcc)[_0xef62('0x1c')]();});}};}function handleEntityNotFound(_0x414c87,_0x3371e7){return function(_0x6c6d53){if(!_0x6c6d53){_0x414c87['sendStatus'](0x194);}return _0x6c6d53;};}function handleError(_0x1e6437,_0x4f83e0){_0x4f83e0=_0x4f83e0||0x1f4;return function(_0x96cdb){logger[_0xef62('0x31')](_0x96cdb[_0xef62('0x32')]);if(_0x96cdb[_0xef62('0x33')]){delete _0x96cdb[_0xef62('0x33')];}_0x1e6437['status'](_0x4f83e0)[_0xef62('0x34')](_0x96cdb);};}exports[_0xef62('0x35')]=function(_0x3c8dcd,_0x1d187c){var _0x4a02c1={},_0x2547be={},_0x55b7e9={'count':0x0,'rows':[]};var _0x406239=_[_0xef62('0x36')](db[_0xef62('0x37')][_0xef62('0x38')],function(_0x26d1c1){return{'name':_0x26d1c1['fieldName'],'type':_0x26d1c1[_0xef62('0x2e')]['key']};});_0x2547be[_0xef62('0x39')]=_['map'](_0x406239,_0xef62('0x33'));_0x2547be[_0xef62('0x3a')]=_['keys'](_0x3c8dcd[_0xef62('0x3a')]);_0x2547be[_0xef62('0x3b')]=_[_0xef62('0x3c')](_0x2547be[_0xef62('0x39')],_0x2547be[_0xef62('0x3a')]);_0x4a02c1[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x2547be[_0xef62('0x39')],qs[_0xef62('0x3e')](_0x3c8dcd[_0xef62('0x3a')][_0xef62('0x3e')]));_0x4a02c1[_0xef62('0x3d')]=_0x4a02c1[_0xef62('0x3d')][_0xef62('0x3f')]?_0x4a02c1[_0xef62('0x3d')]:_0x2547be[_0xef62('0x39')];if(!_0x3c8dcd['query'][_0xef62('0x40')](_0xef62('0x41'))){_0x4a02c1['limit']=qs[_0xef62('0x20')](_0x3c8dcd['query']['limit']);_0x4a02c1[_0xef62('0x1f')]=qs[_0xef62('0x1f')](_0x3c8dcd[_0xef62('0x3a')]['offset']);}_0x4a02c1[_0xef62('0x42')]=qs[_0xef62('0x43')](_0x3c8dcd[_0xef62('0x3a')][_0xef62('0x43')]);_0x4a02c1[_0xef62('0x44')]=qs[_0xef62('0x3b')](_['pick'](_0x3c8dcd[_0xef62('0x3a')],_0x2547be[_0xef62('0x3b')]),_0x406239);if(_0x3c8dcd[_0xef62('0x3a')]['filter']){_0x4a02c1['where']=_['merge'](_0x4a02c1['where'],{'$or':_[_0xef62('0x36')](_0x406239,function(_0x18df54){if(_0x18df54['type']!==_0xef62('0x45')){var _0x399a39={};_0x399a39[_0x18df54['name']]={'$like':'%'+_0x3c8dcd['query']['filter']+'%'};return _0x399a39;}})});}_0x4a02c1=_[_0xef62('0x46')]({},_0x4a02c1,_0x3c8dcd[_0xef62('0x47')]);var _0x5363bf={'where':_0x4a02c1[_0xef62('0x44')]};return db[_0xef62('0x37')]['count'](_0x5363bf)[_0xef62('0x25')](function(_0x29a555){_0x55b7e9[_0xef62('0x1e')]=_0x29a555;if(_0x3c8dcd[_0xef62('0x3a')]['includeAll']){_0x4a02c1['include']=[{'all':!![]}];}return db[_0xef62('0x37')][_0xef62('0x48')](_0x4a02c1);})[_0xef62('0x25')](function(_0x562b8d){_0x55b7e9[_0xef62('0x49')]=_0x562b8d;return _0x55b7e9;})[_0xef62('0x25')](respondWithFilteredResult(_0x1d187c,_0x4a02c1))['catch'](handleError(_0x1d187c,null));};exports[_0xef62('0x4a')]=function(_0x1a0291,_0x2131aa){var _0x30d643={'raw':![],'where':{'id':_0x1a0291[_0xef62('0x4b')]['id']}},_0x592b63={};_0x592b63['model']=_[_0xef62('0x4c')](db[_0xef62('0x37')][_0xef62('0x38')]);_0x592b63['query']=_[_0xef62('0x4c')](_0x1a0291[_0xef62('0x3a')]);_0x592b63[_0xef62('0x3b')]=_[_0xef62('0x3c')](_0x592b63[_0xef62('0x39')],_0x592b63[_0xef62('0x3a')]);_0x30d643[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x592b63['model'],qs[_0xef62('0x3e')](_0x1a0291[_0xef62('0x3a')][_0xef62('0x3e')]));_0x30d643[_0xef62('0x3d')]=_0x30d643[_0xef62('0x3d')][_0xef62('0x3f')]?_0x30d643[_0xef62('0x3d')]:_0x592b63[_0xef62('0x39')];if(_0x1a0291[_0xef62('0x3a')]['includeAll']){_0x30d643[_0xef62('0x4d')]=[{'all':!![]}];}_0x30d643=_[_0xef62('0x46')]({},_0x30d643,_0x1a0291['options']);return db['VoiceQueue'][_0xef62('0x2f')](_0x30d643)[_0xef62('0x25')](handleEntityNotFound(_0x2131aa,null))['then'](respondWithResult(_0x2131aa,null))[_0xef62('0x4e')](handleError(_0x2131aa,null));};exports[_0xef62('0x4f')]=function(_0x32512a,_0x5eee07){return db[_0xef62('0x37')][_0xef62('0x4f')](_0x32512a[_0xef62('0x50')],{})['then'](function(_0x5f0efd){var _0x2280e6=_0x32512a[_0xef62('0x51')][_0xef62('0x27')]({'plain':!![]});if(!_0x2280e6)throw new Error(_0xef62('0x52'));if(_0x2280e6[_0xef62('0x53')]===_0xef62('0x51')){var _0x338a81=_0x5f0efd[_0xef62('0x27')]({'plain':!![]});var _0x10f0cd=[{'name':_0xef62('0x28'),'value':_0xef62('0x29')},{'name':_0xef62('0x54'),'value':_0xef62('0x2a')}];var _0x92994b=_['find'](_0x10f0cd,['value',_0x338a81[_0xef62('0x2e')]])['name'];return db['UserProfileSection'][_0xef62('0x2f')]({'where':{'name':_0x92994b,'userProfileId':_0x2280e6[_0xef62('0x55')]},'raw':!![]})['then'](function(_0xb63a65){if(_0xb63a65&&_0xb63a65[_0xef62('0x56')]===0x0){return db[_0xef62('0x30')]['create']({'name':_0x338a81[_0xef62('0x33')],'resourceId':_0x338a81['id'],'type':_0xb63a65[_0xef62('0x33')],'sectionId':_0xb63a65['id']},{})[_0xef62('0x25')](function(){return _0x5f0efd;});}else{return _0x5f0efd;}})[_0xef62('0x4e')](function(_0x40d823){logger[_0xef62('0x31')](_0xef62('0x57'),_0x40d823);throw _0x40d823;});}return _0x5f0efd;})[_0xef62('0x25')](respondWithResult(_0x5eee07,0xc9))[_0xef62('0x4e')](handleError(_0x5eee07,null));};exports['clone']=function(_0x1e2af8,_0x4df3f6){var _0x4e60e3={'where':{'id':_0x1e2af8[_0xef62('0x4b')]['id']}},_0x3d73d0={};_0x3d73d0[_0xef62('0x39')]=_['keys'](db[_0xef62('0x37')][_0xef62('0x38')]);_0x4e60e3[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x3d73d0[_0xef62('0x39')],qs['fields'](_0x1e2af8[_0xef62('0x3a')][_0xef62('0x3e')]));_0x4e60e3[_0xef62('0x3d')]=_0x4e60e3[_0xef62('0x3d')]['length']?_0x4e60e3[_0xef62('0x3d')]:_0x3d73d0[_0xef62('0x39')];if(_0x1e2af8[_0xef62('0x3a')][_0xef62('0x58')]){_0x4e60e3[_0xef62('0x4d')]=[{'all':!![]}];}_0x4e60e3=_[_0xef62('0x46')]({},_0x4e60e3,_0x1e2af8[_0xef62('0x47')]);return db[_0xef62('0x37')][_0xef62('0x2f')](_0x4e60e3)[_0xef62('0x25')](handleEntityNotFound(_0x4df3f6,null))[_0xef62('0x25')](function(_0x3835dc){if(_0x3835dc){var _0x430eba=_0x3835dc[_0xef62('0x27')]({'plain':!![]});_0x430eba=qs[_0xef62('0x59')](_0x430eba,['id',_0xef62('0x5a'),'updatedAt']);_0x1e2af8[_0xef62('0x50')]=_[_0xef62('0x59')](_0x1e2af8[_0xef62('0x50')],['id',_0xef62('0x5a'),_0xef62('0x5b')]);return db[_0xef62('0x37')][_0xef62('0x4f')](_['merge'](_0x430eba,_0x1e2af8[_0xef62('0x50')]),{'include':_0x1e2af8[_0xef62('0x3a')][_0xef62('0x58')]?[{'all':!![]}]:undefined})['then'](function(_0x193d07){var _0xec5ddc=_0x1e2af8[_0xef62('0x51')]['get']({'plain':!![]});if(!_0xec5ddc)throw new Error(_0xef62('0x52'));if(_0xec5ddc[_0xef62('0x53')]===_0xef62('0x51')){var _0xf3a26b=_0x193d07[_0xef62('0x27')]({'plain':!![]});var _0x356466=[{'name':'VoiceQueues','value':_0xef62('0x29')},{'name':_0xef62('0x54'),'value':_0xef62('0x2a')}];var _0x291602=_[_0xef62('0x2f')](_0x356466,[_0xef62('0x2c'),_0xf3a26b['type']])[_0xef62('0x33')];return db[_0xef62('0x5c')][_0xef62('0x2f')]({'where':{'name':_0x291602,'userProfileId':_0xec5ddc['userProfileId']},'raw':!![]})['then'](function(_0x1cb7cb){if(_0x1cb7cb&&_0x1cb7cb[_0xef62('0x56')]===0x0){return db[_0xef62('0x30')][_0xef62('0x4f')]({'name':_0xf3a26b[_0xef62('0x33')],'resourceId':_0xf3a26b['id'],'type':_0x1cb7cb['name'],'sectionId':_0x1cb7cb['id']},{})[_0xef62('0x25')](function(){return _0x193d07;});}else{return _0x193d07;}})['catch'](function(_0x17ed3e){logger[_0xef62('0x31')](_0xef62('0x57'),_0x17ed3e);throw _0x17ed3e;});}return _0x193d07;});}})[_0xef62('0x25')](respondWithResult(_0x4df3f6,0xc9))['catch'](handleError(_0x4df3f6,null));};exports[_0xef62('0x24')]=function(_0xea323,_0x4a0dff){if(_0xea323[_0xef62('0x50')]['id']){delete _0xea323[_0xef62('0x50')]['id'];}return db[_0xef62('0x37')][_0xef62('0x2f')]({'where':{'id':_0xea323[_0xef62('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a0dff,null))['then'](saveUpdates(_0xea323[_0xef62('0x50')],null))[_0xef62('0x25')](respondWithResult(_0x4a0dff,null))[_0xef62('0x4e')](handleError(_0x4a0dff,null));};exports[_0xef62('0x26')]=function(_0x152361,_0x53bbbf){return db['VoiceQueue']['find']({'where':{'id':_0x152361[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x53bbbf,null))[_0xef62('0x25')](removeEntity(_0x53bbbf,null))['catch'](handleError(_0x53bbbf,null));};exports[_0xef62('0x5d')]=function(_0x13712c,_0x5c4e8b,_0x30b398){var _0x29cd41={'raw':![],'where':{}};var _0x5385c5={};var _0x1f3bf1={'count':0x0,'rows':[]};return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x13712c['params']['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x5c4e8b,null))[_0xef62('0x25')](function(_0x5ea957){if(_0x5ea957){_0x5385c5[_0xef62('0x39')]=_[_0xef62('0x4c')](db[_0xef62('0x5f')]['rawAttributes']);_0x5385c5['query']=_['keys'](_0x13712c[_0xef62('0x3a')]);_0x5385c5['filters']=_[_0xef62('0x3c')](_0x5385c5[_0xef62('0x39')],_0x5385c5[_0xef62('0x3a')]);_0x29cd41[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x5385c5['model'],qs[_0xef62('0x3e')](_0x13712c[_0xef62('0x3a')][_0xef62('0x3e')]));_0x29cd41[_0xef62('0x3d')]=_0x29cd41['attributes']['length']?_0x29cd41[_0xef62('0x3d')]:_0x5385c5[_0xef62('0x39')];if(!_0x13712c[_0xef62('0x3a')][_0xef62('0x40')](_0xef62('0x41'))){_0x29cd41[_0xef62('0x20')]=qs[_0xef62('0x20')](_0x13712c[_0xef62('0x3a')]['limit']);_0x29cd41['offset']=qs['offset'](_0x13712c[_0xef62('0x3a')][_0xef62('0x1f')]);}_0x29cd41[_0xef62('0x42')]=qs['sort'](_0x13712c[_0xef62('0x3a')][_0xef62('0x43')]);_0x29cd41[_0xef62('0x44')]=qs[_0xef62('0x3b')](_[_0xef62('0x60')](_0x13712c[_0xef62('0x3a')],_0x5385c5[_0xef62('0x3b')]));_0x29cd41[_0xef62('0x44')]['VoiceQueueId']=_0x5ea957['id'];if(_0x13712c['query'][_0xef62('0x61')]){_0x29cd41[_0xef62('0x44')]=_[_0xef62('0x46')](_0x29cd41['where'],{'$or':_[_0xef62('0x36')](_0x29cd41['attributes'],function(_0x3e05ab){var _0x5962b3={};_0x5962b3[_0x3e05ab]={'$like':'%'+_0x13712c[_0xef62('0x3a')]['filter']+'%'};return _0x5962b3;})});}_0x29cd41=_[_0xef62('0x46')]({},_0x29cd41,_0x13712c[_0xef62('0x47')]);return db['CmHopper'][_0xef62('0x1e')]({'where':_0x29cd41['where']})[_0xef62('0x25')](function(_0x5ebd43){_0x1f3bf1['count']=_0x5ebd43;if(_0x13712c[_0xef62('0x3a')]['includeAll']){_0x29cd41['include']=[{'all':!![]}];}return db[_0xef62('0x5f')][_0xef62('0x48')](_0x29cd41);})[_0xef62('0x25')](function(_0xcab651){_0x1f3bf1[_0xef62('0x49')]=_0xcab651;return _0x1f3bf1;});}})[_0xef62('0x25')](respondWithFilteredResult(_0x5c4e8b,_0x29cd41))[_0xef62('0x4e')](handleError(_0x5c4e8b,null));};exports[_0xef62('0x62')]=function(_0x563753,_0x3c5063,_0x4a0f24){var _0x2bff4f={'raw':!![],'where':{}};var _0x2f1998={};var _0x19481a={'count':0x0,'rows':[]};return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x563753[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x3c5063,null))[_0xef62('0x25')](function(_0x2e5c9c){if(_0x2e5c9c){_0x2f1998[_0xef62('0x39')]=_[_0xef62('0x4c')](db['CmHopperHistory'][_0xef62('0x38')]);_0x2f1998[_0xef62('0x3a')]=_[_0xef62('0x4c')](_0x563753['query']);_0x2f1998[_0xef62('0x3b')]=_['intersection'](_0x2f1998['model'],_0x2f1998[_0xef62('0x3a')]);_0x2bff4f[_0xef62('0x3d')]=_['intersection'](_0x2f1998[_0xef62('0x39')],qs['fields'](_0x563753[_0xef62('0x3a')][_0xef62('0x3e')]));_0x2bff4f[_0xef62('0x3d')]=_0x2bff4f['attributes']['length']?_0x2bff4f['attributes']:_0x2f1998[_0xef62('0x39')];if(!_0x563753[_0xef62('0x3a')][_0xef62('0x40')](_0xef62('0x41'))){_0x2bff4f['limit']=qs[_0xef62('0x20')](_0x563753[_0xef62('0x3a')][_0xef62('0x20')]);_0x2bff4f[_0xef62('0x1f')]=qs[_0xef62('0x1f')](_0x563753[_0xef62('0x3a')][_0xef62('0x1f')]);}_0x2bff4f[_0xef62('0x42')]=qs[_0xef62('0x43')](_0x563753[_0xef62('0x3a')]['sort']);_0x2bff4f[_0xef62('0x44')]=qs[_0xef62('0x3b')](_['pick'](_0x563753['query'],_0x2f1998['filters']));_0x2bff4f['where'][_0xef62('0x63')]=_0x2e5c9c['id'];if(_0x563753['query'][_0xef62('0x61')]){_0x2bff4f[_0xef62('0x44')]=_[_0xef62('0x46')](_0x2bff4f[_0xef62('0x44')],{'$or':_[_0xef62('0x36')](_0x2bff4f[_0xef62('0x3d')],function(_0x550365){var _0x9bb25={};_0x9bb25[_0x550365]={'$like':'%'+_0x563753[_0xef62('0x3a')][_0xef62('0x61')]+'%'};return _0x9bb25;})});}_0x2bff4f=_['merge']({},_0x2bff4f,_0x563753[_0xef62('0x47')]);return db['CmHopperHistory'][_0xef62('0x1e')]({'where':_0x2bff4f[_0xef62('0x44')]})[_0xef62('0x25')](function(_0x5ae0e6){_0x19481a['count']=_0x5ae0e6;if(_0x563753[_0xef62('0x3a')][_0xef62('0x58')]){_0x2bff4f['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xef62('0x48')](_0x2bff4f);})[_0xef62('0x25')](function(_0x4c306e){_0x19481a['rows']=_0x4c306e;return _0x19481a;});}})['then'](respondWithFilteredResult(_0x3c5063,_0x2bff4f))[_0xef62('0x4e')](handleError(_0x3c5063,null));};exports[_0xef62('0x64')]=function(_0x14ae6d,_0x2e2ae9,_0x15ba8c){var _0x5d3e12={'raw':!![],'where':{}};var _0x3e2d58={};var _0x5b603a={'count':0x0,'rows':[]};return db[_0xef62('0x37')]['findOne']({'where':{'id':_0x14ae6d[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x2e2ae9,null))[_0xef62('0x25')](function(_0x2ebc31){if(_0x2ebc31){_0x3e2d58[_0xef62('0x39')]=_[_0xef62('0x4c')](db[_0xef62('0x65')]['rawAttributes']);_0x3e2d58['query']=_['keys'](_0x14ae6d['query']);_0x3e2d58['filters']=_[_0xef62('0x3c')](_0x3e2d58[_0xef62('0x39')],_0x3e2d58['query']);_0x5d3e12['attributes']=_[_0xef62('0x3c')](_0x3e2d58[_0xef62('0x39')],qs[_0xef62('0x3e')](_0x14ae6d[_0xef62('0x3a')][_0xef62('0x3e')]));_0x5d3e12[_0xef62('0x3d')]=_0x5d3e12[_0xef62('0x3d')][_0xef62('0x3f')]?_0x5d3e12[_0xef62('0x3d')]:_0x3e2d58[_0xef62('0x39')];if(!_0x14ae6d[_0xef62('0x3a')][_0xef62('0x40')](_0xef62('0x41'))){_0x5d3e12[_0xef62('0x20')]=qs[_0xef62('0x20')](_0x14ae6d[_0xef62('0x3a')][_0xef62('0x20')]);_0x5d3e12[_0xef62('0x1f')]=qs['offset'](_0x14ae6d[_0xef62('0x3a')][_0xef62('0x1f')]);}_0x5d3e12[_0xef62('0x42')]=qs[_0xef62('0x43')](_0x14ae6d['query'][_0xef62('0x43')]);_0x5d3e12[_0xef62('0x44')]=qs[_0xef62('0x3b')](_[_0xef62('0x60')](_0x14ae6d[_0xef62('0x3a')],_0x3e2d58[_0xef62('0x3b')]));_0x5d3e12['where'][_0xef62('0x63')]=_0x2ebc31['id'];if(_0x14ae6d['query'][_0xef62('0x61')]){_0x5d3e12['where']=_[_0xef62('0x46')](_0x5d3e12[_0xef62('0x44')],{'$or':_[_0xef62('0x36')](_0x5d3e12[_0xef62('0x3d')],function(_0x1d0c5e){var _0x1bc1ad={};_0x1bc1ad[_0x1d0c5e]={'$like':'%'+_0x14ae6d['query'][_0xef62('0x61')]+'%'};return _0x1bc1ad;})});}_0x5d3e12=_[_0xef62('0x46')]({},_0x5d3e12,_0x14ae6d['options']);return db[_0xef62('0x65')]['count']({'where':_0x5d3e12[_0xef62('0x44')]})[_0xef62('0x25')](function(_0x564127){_0x5b603a[_0xef62('0x1e')]=_0x564127;if(_0x14ae6d['query'][_0xef62('0x58')]){_0x5d3e12[_0xef62('0x4d')]=[{'all':!![]}];}return db[_0xef62('0x65')][_0xef62('0x48')](_0x5d3e12);})[_0xef62('0x25')](function(_0x432173){_0x5b603a['rows']=_0x432173;return _0x5b603a;});}})['then'](respondWithFilteredResult(_0x2e2ae9,_0x5d3e12))[_0xef62('0x4e')](handleError(_0x2e2ae9,null));};exports[_0xef62('0x66')]=function(_0x1c5f2,_0x5b0571,_0xc824e8){var _0x2e0f5d={'raw':!![],'where':{}};var _0x2ace8e={};var _0x2a4ace={'count':0x0,'rows':[]};return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x1c5f2['params']['id']}})['then'](handleEntityNotFound(_0x5b0571,null))[_0xef62('0x25')](function(_0x305641){if(_0x305641){_0x2ace8e[_0xef62('0x39')]=_[_0xef62('0x4c')](db['CmHopperBlack']['rawAttributes']);_0x2ace8e[_0xef62('0x3a')]=_[_0xef62('0x4c')](_0x1c5f2[_0xef62('0x3a')]);_0x2ace8e[_0xef62('0x3b')]=_['intersection'](_0x2ace8e[_0xef62('0x39')],_0x2ace8e[_0xef62('0x3a')]);_0x2e0f5d[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x2ace8e['model'],qs[_0xef62('0x3e')](_0x1c5f2['query'][_0xef62('0x3e')]));_0x2e0f5d['attributes']=_0x2e0f5d[_0xef62('0x3d')][_0xef62('0x3f')]?_0x2e0f5d[_0xef62('0x3d')]:_0x2ace8e[_0xef62('0x39')];if(!_0x1c5f2[_0xef62('0x3a')][_0xef62('0x40')](_0xef62('0x41'))){_0x2e0f5d[_0xef62('0x20')]=qs[_0xef62('0x20')](_0x1c5f2[_0xef62('0x3a')][_0xef62('0x20')]);_0x2e0f5d[_0xef62('0x1f')]=qs['offset'](_0x1c5f2[_0xef62('0x3a')]['offset']);}_0x2e0f5d[_0xef62('0x42')]=qs['sort'](_0x1c5f2[_0xef62('0x3a')][_0xef62('0x43')]);_0x2e0f5d[_0xef62('0x44')]=qs[_0xef62('0x3b')](_['pick'](_0x1c5f2[_0xef62('0x3a')],_0x2ace8e[_0xef62('0x3b')]));_0x2e0f5d[_0xef62('0x44')][_0xef62('0x63')]=_0x305641['id'];if(_0x1c5f2[_0xef62('0x3a')][_0xef62('0x61')]){_0x2e0f5d[_0xef62('0x44')]=_[_0xef62('0x46')](_0x2e0f5d[_0xef62('0x44')],{'$or':_[_0xef62('0x36')](_0x2e0f5d[_0xef62('0x3d')],function(_0x533025){var _0x10e911={};_0x10e911[_0x533025]={'$like':'%'+_0x1c5f2['query'][_0xef62('0x61')]+'%'};return _0x10e911;})});}_0x2e0f5d=_[_0xef62('0x46')]({},_0x2e0f5d,_0x1c5f2[_0xef62('0x47')]);return db['CmHopperBlack'][_0xef62('0x1e')]({'where':_0x2e0f5d['where']})['then'](function(_0x3ebe77){_0x2a4ace[_0xef62('0x1e')]=_0x3ebe77;if(_0x1c5f2[_0xef62('0x3a')][_0xef62('0x58')]){_0x2e0f5d[_0xef62('0x4d')]=[{'all':!![]}];}return db[_0xef62('0x67')]['findAll'](_0x2e0f5d);})[_0xef62('0x25')](function(_0x56792c){_0x2a4ace[_0xef62('0x49')]=_0x56792c;return _0x2a4ace;});}})[_0xef62('0x25')](respondWithFilteredResult(_0x5b0571,_0x2e0f5d))['catch'](handleError(_0x5b0571,null));};exports[_0xef62('0x68')]=function(_0x2847d8,_0x2085ab,_0x11684b){var _0x433dfa={};var _0x23a8f0={};var _0x2d0163;var _0x39abcd;return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x2847d8[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x2085ab,null))['then'](function(_0x4815f2){if(_0x4815f2){_0x2d0163=_0x4815f2;_0x23a8f0['model']=_[_0xef62('0x4c')](db['Team'][_0xef62('0x38')]);_0x23a8f0['query']=_[_0xef62('0x4c')](_0x2847d8['query']);_0x23a8f0[_0xef62('0x3b')]=_[_0xef62('0x3c')](_0x23a8f0[_0xef62('0x39')],_0x23a8f0[_0xef62('0x3a')]);_0x433dfa[_0xef62('0x3d')]=_['intersection'](_0x23a8f0['model'],qs[_0xef62('0x3e')](_0x2847d8[_0xef62('0x3a')][_0xef62('0x3e')]));_0x433dfa[_0xef62('0x3d')]=_0x433dfa[_0xef62('0x3d')][_0xef62('0x3f')]?_0x433dfa[_0xef62('0x3d')]:_0x23a8f0[_0xef62('0x39')];_0x433dfa[_0xef62('0x42')]=qs['sort'](_0x2847d8['query']['sort']);_0x433dfa['where']=qs[_0xef62('0x3b')](_[_0xef62('0x60')](_0x2847d8[_0xef62('0x3a')],_0x23a8f0[_0xef62('0x3b')]));if(_0x2847d8[_0xef62('0x3a')][_0xef62('0x61')]){_0x433dfa[_0xef62('0x44')]=_['merge'](_0x433dfa[_0xef62('0x44')],{'$or':_['map'](_0x433dfa[_0xef62('0x3d')],function(_0x20a6e1){var _0x639255={};_0x639255[_0x20a6e1]={'$like':'%'+_0x2847d8[_0xef62('0x3a')][_0xef62('0x61')]+'%'};return _0x639255;})});}_0x433dfa=_['merge']({},_0x433dfa,_0x2847d8[_0xef62('0x47')]);return _0x2d0163[_0xef62('0x68')](_0x433dfa);}})[_0xef62('0x25')](function(_0x349b44){if(_0x349b44){_0x39abcd=_0x349b44['length'];if(!_0x2847d8[_0xef62('0x3a')]['hasOwnProperty'](_0xef62('0x41'))){_0x433dfa[_0xef62('0x20')]=qs['limit'](_0x2847d8[_0xef62('0x3a')][_0xef62('0x20')]);_0x433dfa['offset']=qs[_0xef62('0x1f')](_0x2847d8[_0xef62('0x3a')][_0xef62('0x1f')]);}return _0x2d0163[_0xef62('0x68')](_0x433dfa);}})[_0xef62('0x25')](function(_0x1367bf){if(_0x1367bf){return _0x1367bf?{'count':_0x39abcd,'rows':_0x1367bf}:null;}})['then'](respondWithResult(_0x2085ab,null))[_0xef62('0x4e')](handleError(_0x2085ab,null));};exports[_0xef62('0x69')]=function(_0x12d93c,_0x472f23,_0x50432c){var _0x743b37=_0x12d93c[_0xef62('0x50')]['teams'];var _0x5f53f3=_[_0xef62('0x36')](_0x743b37,'id');return db[_0xef62('0x6a')][_0xef62('0x48')]({'where':{'id':_0x5f53f3},'attributes':['id'],'include':[{'model':db[_0xef62('0x6b')],'as':_0xef62('0x6c'),'attributes':['id',_0xef62('0x33'),_0xef62('0x6d'),_0xef62('0x6e'),_0xef62('0x6f')],'raw':!![]}]})[_0xef62('0x25')](function(_0x59237e){if(_0x59237e){var _0x12b509=_['flatMap'](_0x59237e,function(_0x141170){var _0x4cc571=_0x141170[_0xef62('0x27')]({'plain':!![]});_0x4cc571[_0xef62('0x6c')][_0xef62('0x70')](function(_0x161d20){_0x161d20['penalty']=_['find'](_0x743b37,{'id':_0x4cc571['id']})['penalty'];});return _0x4cc571[_0xef62('0x6c')];});return db['VoiceQueue']['find']({'where':{'id':_0x12d93c[_0xef62('0x4b')]['id']}})['then'](function(_0x34feb7){return db['sequelize']['transaction'](function(_0x4546fb){return _0x34feb7[_0xef62('0x69')](_0x5f53f3,{'transaction':_0x4546fb})[_0xef62('0x25')](function(){return BPromise[_0xef62('0x71')](_0x12b509,function(_0x57f565){return db[_0xef62('0x72')][_0xef62('0x73')]({'where':{'UserId':_0x57f565['id'],'VoiceQueueId':_0x12d93c[_0xef62('0x4b')]['id']},'defaults':{'penalty':_0x57f565[_0xef62('0x74')]},'transaction':_0x4546fb});});})['then'](function(){return BPromise['each'](_['filter'](_0x12b509,{'online':!![]}),function(_0x232bb5){return db[_0xef62('0x75')][_0xef62('0x76')]({'membername':_0x232bb5['name'],'UserId':_0x232bb5['id'],'queue_name':_0x34feb7['name'],'VoiceQueueId':_0x34feb7['id'],'interface':_['isNil'](_0x232bb5[_0xef62('0x6f')])?util['format'](_0xef62('0x77'),_0x232bb5[_0xef62('0x33')]):_0x232bb5['interface'],'paused':_0x232bb5[_0xef62('0x6e')]||![],'penalty':_0x232bb5['penalty']},{'transaction':_0x4546fb});});})[_0xef62('0x25')](function(){_0x12b509[_0xef62('0x70')](function(_0x281d41){socket['emit'](_0xef62('0x78'),{'UserId':_0x281d41['id'],'VoiceQueueId':_0x34feb7['id']});});});});});}})[_0xef62('0x25')](respondWithStatusCode(_0x472f23,null))[_0xef62('0x4e')](handleError(_0x472f23,null));};exports[_0xef62('0x79')]=function(_0x53a5c4,_0x298c75,_0x383eb2){return db[_0xef62('0x6a')][_0xef62('0x48')]({'where':{'id':_0x53a5c4['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xef62('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xef62('0x25')](handleEntityNotFound(_0x298c75,null))[_0xef62('0x25')](function(_0x1cb4f4){var _0x28e3ac=_[_0xef62('0x36')](_0x1cb4f4,'id');var _0x4ce345=[];var _0x1ef8ee=[];var _0x5b5877=squel[_0xef62('0x7a')]();_0x5b5877[_0xef62('0x7b')](_0xef62('0x7c'))[_0xef62('0x7d')](_0xef62('0x7e'),'tq')[_0xef62('0x7f')](_0xef62('0x80'),'ut',_0xef62('0x81'))[_0xef62('0x44')]('VoiceQueueId\x20=\x20?',_0x53a5c4[_0xef62('0x4b')]['id']);for(var _0x548694=0x0;_0x548694<_0x1cb4f4['length'];_0x548694+=0x1){let _0x2c9d39=_0x1cb4f4[_0x548694];for(var _0x2adff7=0x0;_0x2adff7<_0x2c9d39[_0xef62('0x6c')]['length'];_0x2adff7+=0x1){let _0x3605bb=_0x2c9d39['Agents'][_0x2adff7];var _0x3cd525=_0x5b5877[_0xef62('0x82')]();_0x3cd525['where']('ut.UserId\x20=\x20?',_0x3605bb['id']);_0x1ef8ee['push'](db['sequelize']['query'](_0x3cd525[_0xef62('0x83')](),{'type':db[_0xef62('0x84')]['QueryTypes']['SELECT']})[_0xef62('0x25')](function(_0xee14eb){if(_0xee14eb[_0xef62('0x3f')]===0x1){return _0x3605bb['id'];}else{var _0x5c20a3=_[_0xef62('0x85')](_[_0xef62('0x36')](_0xee14eb,_0xef62('0x86')),function(_0x44cc6a){return _[_0xef62('0x2d')](_0x28e3ac,_0x44cc6a);});if(_0x5c20a3){return _0x3605bb['id'];}}}));}}return BPromise[_0xef62('0x87')](_0x1ef8ee)['then'](function(_0x4d60b8){_0x4ce345=_(_0x4ce345)['union'](_0x4d60b8)['compact']()[_0xef62('0x2c')]();return db[_0xef62('0x37')][_0xef62('0x2f')]({'where':{'id':_0x53a5c4[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](function(_0x18203b){return db[_0xef62('0x84')][_0xef62('0x88')](function(_0x588099){return _0x18203b['removeTeams'](_0x53a5c4[_0xef62('0x3a')]['ids'],{'transaction':_0x588099})['then'](function(){if(!_[_0xef62('0x89')](_0x4ce345)){return _0x18203b[_0xef62('0x8a')](_0x4ce345,{'transaction':_0x588099})[_0xef62('0x25')](function(){return db[_0xef62('0x75')][_0xef62('0x26')]({'where':{'VoiceQueueId':_0x53a5c4[_0xef62('0x4b')]['id'],'UserId':_0x4ce345},'transaction':_0x588099});});}})[_0xef62('0x25')](function(){_0x4ce345[_0xef62('0x70')](function(_0xf48ca4){socket[_0xef62('0x8b')](_0xef62('0x8c'),{'UserId':_0xf48ca4,'VoiceQueueId':_0x18203b['id']});});});});});});})[_0xef62('0x25')](respondWithStatusCode(_0x298c75,null))['catch'](handleError(_0x298c75,null));};exports[_0xef62('0x8d')]=function(_0x2d2ccf,_0x45cc4c,_0x532c02){var _0x45f2d8,_0x467fb9;return db[_0xef62('0x37')][_0xef62('0x2f')]({'where':{'id':_0x2d2ccf[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x45cc4c,null))['then'](function(_0x251258){if(_0x251258){_0x467fb9=_0x251258;return _0x251258[_0xef62('0x8d')](_0x2d2ccf['body'][_0xef62('0x8e')],_[_0xef62('0x59')](_0x2d2ccf[_0xef62('0x50')],[_0xef62('0x8e'),'id'])||{})[_0xef62('0x8f')](function(_0xdc29b9){for(var _0x5d2589=0x0;_0x5d2589<_0x2d2ccf[_0xef62('0x50')][_0xef62('0x8e')][_0xef62('0x3f')];_0x5d2589+=0x1){socket[_0xef62('0x8b')](_0xef62('0x78'),{'UserId':_0x2d2ccf[_0xef62('0x50')][_0xef62('0x8e')][_0x5d2589],'VoiceQueueId':_0x2d2ccf[_0xef62('0x4b')]['id']});}return _0xdc29b9;});}})[_0xef62('0x25')](function(_0x5ee1c4){_0x45f2d8=_0x5ee1c4||[];if(_0x467fb9){return db[_0xef62('0x6b')][_0xef62('0x48')]({'where':{'id':_0x2d2ccf[_0xef62('0x50')][_0xef62('0x8e')]},'attributes':['id',_0xef62('0x33'),_0xef62('0x6d'),_0xef62('0x6e'),_0xef62('0x6f')],'raw':!![]});}})[_0xef62('0x25')](function(_0x219915){if(!_[_0xef62('0x89')](_0x219915)){var _0x4e31f9=[];for(var _0xdca8e0=0x0;_0xdca8e0<_0x219915[_0xef62('0x3f')];_0xdca8e0++){if(_0x219915[_0xdca8e0][_0xef62('0x6d')]){_0x4e31f9[_0xef62('0x90')](db[_0xef62('0x75')]['upsert']({'membername':_0x219915[_0xdca8e0][_0xef62('0x33')],'UserId':_0x219915[_0xdca8e0]['id'],'queue_name':_0x467fb9[_0xef62('0x33')],'VoiceQueueId':_0x467fb9['id'],'interface':_[_0xef62('0x91')](_0x219915[_0xdca8e0][_0xef62('0x6f')])?util[_0xef62('0x92')](_0xef62('0x77'),_0x219915[_0xdca8e0]['name']):_0x219915[_0xdca8e0][_0xef62('0x6f')],'paused':_0x219915[_0xdca8e0][_0xef62('0x6e')]||![],'penalty':_0x2d2ccf[_0xef62('0x50')]['penalty']||0x0}));}}return BPromise[_0xef62('0x87')](_0x4e31f9);}})['then'](function(){return _0x45f2d8;})[_0xef62('0x25')](respondWithResult(_0x45cc4c,null))['catch'](handleError(_0x45cc4c,null));};exports[_0xef62('0x8a')]=function(_0x7604f,_0x49f1a7,_0x326ffa){return db[_0xef62('0x37')]['find']({'where':{'id':_0x7604f[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x49f1a7,null))[_0xef62('0x25')](function(_0x2e0ba8){if(_0x2e0ba8){return _0x2e0ba8[_0xef62('0x8a')](_0x7604f[_0xef62('0x3a')][_0xef62('0x8e')])[_0xef62('0x25')](function(){if(_[_0xef62('0x93')](_0x7604f['query'][_0xef62('0x8e')])){for(var _0x5bbe6c=0x0;_0x5bbe6c<_0x7604f[_0xef62('0x3a')][_0xef62('0x8e')][_0xef62('0x3f')];_0x5bbe6c+=0x1){socket[_0xef62('0x8b')](_0xef62('0x8c'),{'UserId':Number(_0x7604f['query'][_0xef62('0x8e')][_0x5bbe6c]),'VoiceQueueId':Number(_0x7604f[_0xef62('0x4b')]['id'])});}}else{socket['emit'](_0xef62('0x8c'),{'UserId':Number(_0x7604f[_0xef62('0x3a')][_0xef62('0x8e')]),'VoiceQueueId':Number(_0x7604f[_0xef62('0x4b')]['id'])});}});}})['then'](function(_0x25a7df){return db[_0xef62('0x75')][_0xef62('0x26')]({'where':{'VoiceQueueId':_0x7604f[_0xef62('0x4b')]['id'],'UserId':_0x7604f['query'][_0xef62('0x8e')]}})[_0xef62('0x25')](function(){return _0x25a7df;});})[_0xef62('0x25')](respondWithStatusCode(_0x49f1a7,null))[_0xef62('0x4e')](handleError(_0x49f1a7,null));};exports['getAgents']=function(_0x4ab32f,_0x513a85,_0xe0370e){var _0x4284e1={};var _0x5d1b55={};var _0x40dfcf;var _0x56f874;return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x4ab32f[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x513a85,null))[_0xef62('0x25')](function(_0x126b9c){if(_0x126b9c){_0x40dfcf=_0x126b9c;_0x5d1b55[_0xef62('0x39')]=_[_0xef62('0x4c')](db[_0xef62('0x6b')][_0xef62('0x38')]);_0x5d1b55['query']=_[_0xef62('0x4c')](_0x4ab32f[_0xef62('0x3a')]);_0x5d1b55[_0xef62('0x3b')]=_[_0xef62('0x3c')](_0x5d1b55['model'],_0x5d1b55[_0xef62('0x3a')]);_0x4284e1[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x5d1b55[_0xef62('0x39')],qs[_0xef62('0x3e')](_0x4ab32f['query'][_0xef62('0x3e')]));_0x4284e1[_0xef62('0x3d')]=_0x4284e1[_0xef62('0x3d')][_0xef62('0x3f')]?_0x4284e1[_0xef62('0x3d')]:_0x5d1b55['model'];_0x4284e1['order']=qs[_0xef62('0x43')](_0x4ab32f[_0xef62('0x3a')][_0xef62('0x43')]);_0x4284e1[_0xef62('0x44')]=qs[_0xef62('0x3b')](_[_0xef62('0x60')](_0x4ab32f['query'],_0x5d1b55[_0xef62('0x3b')]));if(_0x4ab32f['query'][_0xef62('0x61')]){_0x4284e1['where']=_[_0xef62('0x46')](_0x4284e1[_0xef62('0x44')],{'$or':_['map'](_0x4284e1['attributes'],function(_0xfaa1a9){var _0x40f9d2={};_0x40f9d2[_0xfaa1a9]={'$like':'%'+_0x4ab32f[_0xef62('0x3a')][_0xef62('0x61')]+'%'};return _0x40f9d2;})});}_0x4284e1=_['merge']({},_0x4284e1,_0x4ab32f[_0xef62('0x47')]);return _0x40dfcf[_0xef62('0x94')](_0x4284e1);}})[_0xef62('0x25')](function(_0x5d29d5){if(_0x5d29d5){_0x56f874=_0x5d29d5['length'];if(!_0x4ab32f['query'][_0xef62('0x40')](_0xef62('0x41'))){_0x4284e1[_0xef62('0x20')]=qs['limit'](_0x4ab32f[_0xef62('0x3a')][_0xef62('0x20')]);_0x4284e1['offset']=qs[_0xef62('0x1f')](_0x4ab32f['query'][_0xef62('0x1f')]);}return _0x40dfcf[_0xef62('0x94')](_0x4284e1);}})[_0xef62('0x25')](function(_0xc5e8bc){if(_0xc5e8bc){return _0xc5e8bc?{'count':_0x56f874,'rows':_0xc5e8bc}:null;}})[_0xef62('0x25')](respondWithResult(_0x513a85,null))[_0xef62('0x4e')](handleError(_0x513a85,null));};exports[_0xef62('0x95')]=function(_0x4bc5b7,_0x295739,_0x168606){var _0x156d17={};var _0x100310={};var _0x10c037;var _0x2ff310;return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x4bc5b7[_0xef62('0x4b')]['id']}})['then'](handleEntityNotFound(_0x295739,null))['then'](function(_0x3895fa){if(_0x3895fa){_0x10c037=_0x3895fa;_0x100310['model']=_[_0xef62('0x4c')](db[_0xef62('0x75')]['rawAttributes']);_0x100310['query']=_['keys'](_0x4bc5b7[_0xef62('0x3a')]);_0x100310[_0xef62('0x3b')]=_[_0xef62('0x3c')](_0x100310['model'],_0x100310['query']);_0x156d17['attributes']=_['intersection'](_0x100310['model'],qs[_0xef62('0x3e')](_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x3e')]));_0x156d17[_0xef62('0x3d')]=_0x156d17[_0xef62('0x3d')][_0xef62('0x3f')]?_0x156d17['attributes']:_0x100310[_0xef62('0x39')];_0x156d17[_0xef62('0x42')]=qs[_0xef62('0x43')](_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x43')]);_0x156d17['where']=qs['filters'](_[_0xef62('0x60')](_0x4bc5b7[_0xef62('0x3a')],_0x100310[_0xef62('0x3b')]));if(_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x61')]){_0x156d17[_0xef62('0x44')]=_[_0xef62('0x46')](_0x156d17[_0xef62('0x44')],{'$or':_[_0xef62('0x36')](_0x156d17[_0xef62('0x3d')],function(_0x327322){var _0x452c1c={};_0x452c1c[_0x327322]={'$like':'%'+_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x61')]+'%'};return _0x452c1c;})});}_0x156d17=_[_0xef62('0x46')]({},_0x156d17,_0x4bc5b7[_0xef62('0x47')]);return _0x10c037['getMembers'](_0x156d17);}})[_0xef62('0x25')](function(_0x4f1210){if(_0x4f1210){_0x2ff310=_0x4f1210['length'];if(!_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x40')]('nolimit')){_0x156d17[_0xef62('0x20')]=qs['limit'](_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x20')]);_0x156d17[_0xef62('0x1f')]=qs[_0xef62('0x1f')](_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x1f')]);}return _0x10c037['getMembers'](_0x156d17);}})[_0xef62('0x25')](function(_0x53813e){return _0x53813e?{'count':_0x2ff310,'rows':_0x53813e}:null;})[_0xef62('0x25')](respondWithResult(_0x295739,null))['catch'](handleError(_0x295739,null));};exports[_0xef62('0x96')]=function(_0x763833,_0xffbe0e,_0xcee3f4){var _0x4a9b03={};var _0x494a45={};var _0x48058e;var _0x4e0f00;return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x763833[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0xffbe0e,null))[_0xef62('0x25')](function(_0x75a3c4){if(_0x75a3c4){_0x48058e=_0x75a3c4;_0x494a45[_0xef62('0x39')]=_['keys'](db['CmList'][_0xef62('0x38')]);_0x494a45[_0xef62('0x3a')]=_[_0xef62('0x4c')](_0x763833['query']);_0x494a45[_0xef62('0x3b')]=_['intersection'](_0x494a45[_0xef62('0x39')],_0x494a45[_0xef62('0x3a')]);_0x4a9b03[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x494a45[_0xef62('0x39')],qs['fields'](_0x763833['query'][_0xef62('0x3e')]));_0x4a9b03[_0xef62('0x3d')]=_0x4a9b03[_0xef62('0x3d')][_0xef62('0x3f')]?_0x4a9b03[_0xef62('0x3d')]:_0x494a45[_0xef62('0x39')];_0x4a9b03['order']=qs[_0xef62('0x43')](_0x763833['query'][_0xef62('0x43')]);_0x4a9b03[_0xef62('0x44')]=qs['filters'](_['pick'](_0x763833['query'],_0x494a45[_0xef62('0x3b')]));if(_0x763833[_0xef62('0x3a')]['filter']){_0x4a9b03[_0xef62('0x44')]=_[_0xef62('0x46')](_0x4a9b03[_0xef62('0x44')],{'$or':_[_0xef62('0x36')](_0x4a9b03[_0xef62('0x3d')],function(_0x8ac54c){var _0x1e45cd={};_0x1e45cd[_0x8ac54c]={'$like':'%'+_0x763833['query'][_0xef62('0x61')]+'%'};return _0x1e45cd;})});}_0x4a9b03=_[_0xef62('0x46')]({},_0x4a9b03,_0x763833[_0xef62('0x47')]);return _0x48058e[_0xef62('0x96')](_0x4a9b03);}})['then'](function(_0x24670b){if(_0x24670b){_0x4e0f00=_0x24670b['length'];if(!_0x763833[_0xef62('0x3a')][_0xef62('0x40')](_0xef62('0x41'))){_0x4a9b03['limit']=qs['limit'](_0x763833[_0xef62('0x3a')][_0xef62('0x20')]);_0x4a9b03[_0xef62('0x1f')]=qs[_0xef62('0x1f')](_0x763833[_0xef62('0x3a')][_0xef62('0x1f')]);}return _0x48058e[_0xef62('0x96')](_0x4a9b03);}})[_0xef62('0x25')](function(_0x4d9103){if(_0x4d9103){return _0x4d9103?{'count':_0x4e0f00,'rows':_0x4d9103}:null;}})[_0xef62('0x25')](respondWithResult(_0xffbe0e,null))[_0xef62('0x4e')](handleError(_0xffbe0e,null));};exports[_0xef62('0x97')]=function(_0x58f43a,_0x45d5bb,_0x5e6d78){var _0x265bc1,_0x6cfb14;return db[_0xef62('0x37')][_0xef62('0x2f')]({'where':{'id':_0x58f43a['params']['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x45d5bb,null))[_0xef62('0x25')](function(_0x1275a9){if(_0x1275a9){_0x6cfb14=_0x1275a9;return _0x1275a9[_0xef62('0x97')](_0x58f43a[_0xef62('0x50')][_0xef62('0x8e')],_[_0xef62('0x59')](_0x58f43a[_0xef62('0x50')],[_0xef62('0x8e'),'id'])||{});}return null;})[_0xef62('0x8f')](function(_0x251f48){var _0x1ed140;_0x265bc1=_0x251f48||[];var _0x5ba628=[];if(_0x251f48){for(var _0x4f0bc1=0x0;_0x4f0bc1<_0x251f48['length'];_0x4f0bc1+=0x1){var _0x1ce4e7=_0x251f48[_0x4f0bc1]['get']({'plain':!![]});_0x6cfb14[_0xef62('0x98')]=_0x58f43a[_0xef62('0x50')][_0xef62('0x98')]?_0x58f43a['body'][_0xef62('0x98')]:_0x6cfb14[_0xef62('0x98')];switch(_0x6cfb14[_0xef62('0x98')]){case _0xef62('0x99'):_0x1ed140=squel[_0xef62('0x9a')]()[_0xef62('0x9b')](_0xef62('0x9c'))['fromQuery']([_0xef62('0x9d'),_0xef62('0x9e'),_0xef62('0x9f'),_0xef62('0xa0'),_0xef62('0x63'),_0xef62('0x5a'),_0xef62('0x5b')],squel[_0xef62('0x7a')]()[_0xef62('0x7b')](_0xef62('0x9d'),_0xef62('0x9d'))['field'](_0xef62('0xa1'),'scheduledAt')['field']('id',_0xef62('0x9f'))[_0xef62('0x7b')](_0x1ce4e7[_0xef62('0xa2')][_0xef62('0x83')](),_0xef62('0xa0'))[_0xef62('0x7b')](_0x58f43a[_0xef62('0x4b')]['id'][_0xef62('0x83')](),_0xef62('0x63'))['field']('NOW()',_0xef62('0x5a'))[_0xef62('0x7b')](_0xef62('0xa1'),_0xef62('0x5b'))['from'](_0xef62('0xa3'))[_0xef62('0x44')](_0xef62('0xa4'))[_0xef62('0x44')]('ListId\x20=\x20?',_0x1ce4e7[_0xef62('0xa2')][_0xef62('0x83')]())[_0xef62('0x44')](_0xef62('0xa5'))['where'](_0xef62('0xa6'),squel[_0xef62('0x7a')]()[_0xef62('0x7b')]('COALESCE(calleridnum,\x27\x27)')[_0xef62('0x7d')](_0xef62('0xa7'))['where']('VoiceQueueId\x20=\x20?',_0x58f43a['params']['id']['toString']()))[_0xef62('0x44')](_0xef62('0xa6'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xef62('0x7d')](_0xef62('0x9c'))[_0xef62('0x44')](_0xef62('0xa8'),_0x58f43a['params']['id'][_0xef62('0x83')]())))['toString']();break;case'onlyIfOpen':_0x1ed140=squel['insert']()[_0xef62('0x9b')](_0xef62('0x9c'))['fromQuery'](['phone',_0xef62('0x9e'),'ContactId',_0xef62('0xa0'),'VoiceQueueId',_0xef62('0x5a'),_0xef62('0x5b')],squel[_0xef62('0x7a')]()[_0xef62('0x7b')]('phone','phone')[_0xef62('0x7b')]('NOW()','scheduledAt')[_0xef62('0x7b')]('id','ContactId')[_0xef62('0x7b')](_0x1ce4e7[_0xef62('0xa2')][_0xef62('0x83')](),_0xef62('0xa0'))['field'](_0x58f43a[_0xef62('0x4b')]['id'][_0xef62('0x83')](),_0xef62('0x63'))[_0xef62('0x7b')]('NOW()',_0xef62('0x5a'))[_0xef62('0x7b')](_0xef62('0xa1'),_0xef62('0x5b'))[_0xef62('0x7d')](_0xef62('0xa3'))[_0xef62('0x44')](_0xef62('0xa4'))[_0xef62('0x44')](_0xef62('0xa9'),_0x1ce4e7[_0xef62('0xa2')][_0xef62('0x83')]())[_0xef62('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0xef62('0x44')](_0xef62('0xa6'),squel[_0xef62('0x7a')]()[_0xef62('0x7b')](_0xef62('0xaa'))['from'](_0xef62('0x9c'))[_0xef62('0x44')](_0xef62('0xa8'),_0x58f43a[_0xef62('0x4b')]['id'][_0xef62('0x83')]())))['toString']();break;default:_0x1ed140=squel[_0xef62('0x9a')]()['into'](_0xef62('0x9c'))[_0xef62('0xab')]([_0xef62('0x9d'),'scheduledAt','ContactId','ListId',_0xef62('0x63'),_0xef62('0x5a'),_0xef62('0x5b')],squel['select']()[_0xef62('0x7b')](_0xef62('0x9d'),_0xef62('0x9d'))[_0xef62('0x7b')]('NOW()',_0xef62('0x9e'))[_0xef62('0x7b')]('id',_0xef62('0x9f'))[_0xef62('0x7b')](_0x1ce4e7[_0xef62('0xa2')]['toString'](),_0xef62('0xa0'))[_0xef62('0x7b')](_0x58f43a[_0xef62('0x4b')]['id'][_0xef62('0x83')](),_0xef62('0x63'))[_0xef62('0x7b')]('NOW()',_0xef62('0x5a'))[_0xef62('0x7b')]('NOW()','updatedAt')[_0xef62('0x7d')](_0xef62('0xa3'))[_0xef62('0x44')](_0xef62('0xa4'))[_0xef62('0x44')]('ListId\x20=\x20?',_0x1ce4e7[_0xef62('0xa2')][_0xef62('0x83')]())[_0xef62('0x44')](_0xef62('0xa5')))[_0xef62('0x83')]();}_0x5ba628[_0xef62('0x90')](db[_0xef62('0x84')][_0xef62('0x3a')](_0x1ed140));}return BPromise[_0xef62('0x87')](_0x5ba628);}})[_0xef62('0x25')](function(){return _0x265bc1;})['then'](respondWithResult(_0x45d5bb,null))[_0xef62('0x4e')](handleError(_0x45d5bb,null));};exports[_0xef62('0xac')]=function(_0x4aaf8b,_0x256b3f,_0x4b7203){return db[_0xef62('0x37')]['find']({'where':{'id':_0x4aaf8b[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x256b3f,null))[_0xef62('0x25')](function(_0x152efe){if(_0x152efe){return _0x152efe[_0xef62('0xac')](_0x4aaf8b['query']['ids']);}})[_0xef62('0x25')](function(_0x52cba4){if(_0x52cba4){return db[_0xef62('0x5f')][_0xef62('0x26')]({'where':{'ListId':_0x4aaf8b[_0xef62('0x3a')][_0xef62('0x8e')],'VoiceQueueId':_0x4aaf8b[_0xef62('0x4b')]['id']}})['then'](function(){return _0x52cba4;});}})[_0xef62('0x25')](respondWithStatusCode(_0x256b3f,null))[_0xef62('0x4e')](handleError(_0x256b3f,null));};exports[_0xef62('0xad')]=function(_0xcc07ef,_0x497942,_0x41cf4f){var _0x3b3922={};var _0x2a215e={};var _0x17d487;var _0x1d86d3;return db['VoiceQueue'][_0xef62('0x5e')]({'where':{'id':_0xcc07ef[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x497942,null))[_0xef62('0x25')](function(_0x1b7114){if(_0x1b7114){_0x17d487=_0x1b7114;_0x2a215e['model']=_['keys'](db[_0xef62('0xae')][_0xef62('0x38')]);_0x2a215e['query']=_['keys'](_0xcc07ef['query']);_0x2a215e['filters']=_[_0xef62('0x3c')](_0x2a215e[_0xef62('0x39')],_0x2a215e[_0xef62('0x3a')]);_0x3b3922[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x2a215e[_0xef62('0x39')],qs[_0xef62('0x3e')](_0xcc07ef[_0xef62('0x3a')]['fields']));_0x3b3922[_0xef62('0x3d')]=_0x3b3922[_0xef62('0x3d')][_0xef62('0x3f')]?_0x3b3922['attributes']:_0x2a215e[_0xef62('0x39')];_0x3b3922[_0xef62('0x42')]=qs[_0xef62('0x43')](_0xcc07ef[_0xef62('0x3a')][_0xef62('0x43')]);_0x3b3922[_0xef62('0x44')]=qs[_0xef62('0x3b')](_['pick'](_0xcc07ef[_0xef62('0x3a')],_0x2a215e[_0xef62('0x3b')]));if(_0xcc07ef['query']['filter']){_0x3b3922[_0xef62('0x44')]=_[_0xef62('0x46')](_0x3b3922['where'],{'$or':_[_0xef62('0x36')](_0x3b3922['attributes'],function(_0x439894){var _0x353e34={};_0x353e34[_0x439894]={'$like':'%'+_0xcc07ef[_0xef62('0x3a')][_0xef62('0x61')]+'%'};return _0x353e34;})});}_0x3b3922=_[_0xef62('0x46')]({},_0x3b3922,_0xcc07ef['options']);return _0x17d487['getBlackLists'](_0x3b3922);}})[_0xef62('0x25')](function(_0x2a1e5a){if(_0x2a1e5a){_0x1d86d3=_0x2a1e5a[_0xef62('0x3f')];if(!_0xcc07ef[_0xef62('0x3a')][_0xef62('0x40')]('nolimit')){_0x3b3922[_0xef62('0x20')]=qs['limit'](_0xcc07ef['query'][_0xef62('0x20')]);_0x3b3922['offset']=qs['offset'](_0xcc07ef[_0xef62('0x3a')][_0xef62('0x1f')]);}return _0x17d487[_0xef62('0xad')](_0x3b3922);}})[_0xef62('0x25')](function(_0x1877a6){if(_0x1877a6){return _0x1877a6?{'count':_0x1d86d3,'rows':_0x1877a6}:null;}})[_0xef62('0x25')](respondWithResult(_0x497942,null))[_0xef62('0x4e')](handleError(_0x497942,null));};exports[_0xef62('0xaf')]=function(_0x26c1e4,_0x3ae933,_0x57bd1e){var _0x57c2c9,_0x4f28fe;return db[_0xef62('0x37')][_0xef62('0x2f')]({'where':{'id':_0x26c1e4[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x3ae933,null))[_0xef62('0x25')](function(_0x524fa1){if(_0x524fa1){_0x4f28fe=_0x524fa1;return _0x524fa1[_0xef62('0xaf')](_0x26c1e4[_0xef62('0x50')]['ids'],_['omit'](_0x26c1e4[_0xef62('0x50')],[_0xef62('0x8e'),'id'])||{});}return null;})[_0xef62('0x8f')](function(_0x293f9a){var _0x2be90f;_0x57c2c9=_0x293f9a||[];var _0xea9cb6=[];if(_0x293f9a){for(var _0x431fe5=0x0;_0x431fe5<_0x293f9a['length'];_0x431fe5+=0x1){var _0x1329aa=_0x293f9a[_0x431fe5][_0xef62('0x27')]({'plain':!![]});_0x2be90f=squel[_0xef62('0x9a')]()[_0xef62('0x9b')](_0xef62('0xb0'))[_0xef62('0xab')]([_0xef62('0x9d'),_0xef62('0x9f'),_0xef62('0xa0'),'VoiceQueueId','createdAt',_0xef62('0x5b')],squel[_0xef62('0x7a')]()[_0xef62('0x7b')](_0xef62('0x9d'),_0xef62('0x9d'))['field']('id',_0xef62('0x9f'))[_0xef62('0x7b')](_0x1329aa[_0xef62('0xa2')][_0xef62('0x83')](),_0xef62('0xa0'))[_0xef62('0x7b')](_0x26c1e4[_0xef62('0x4b')]['id'][_0xef62('0x83')](),_0xef62('0x63'))[_0xef62('0x7b')](_0xef62('0xa1'),'createdAt')[_0xef62('0x7b')]('NOW()','updatedAt')[_0xef62('0x7d')](_0xef62('0xa3'))[_0xef62('0x44')](_0xef62('0xa4'))[_0xef62('0x44')](_0xef62('0xa9'),_0x1329aa['CmListId'][_0xef62('0x83')]())[_0xef62('0x44')](_0xef62('0xa5')))['toString']();_0xea9cb6['push'](db[_0xef62('0x84')][_0xef62('0x3a')](_0x2be90f));}return BPromise[_0xef62('0x87')](_0xea9cb6);}})[_0xef62('0x25')](function(){return _0x57c2c9;})['then'](respondWithResult(_0x3ae933,null))[_0xef62('0x4e')](handleError(_0x3ae933,null));};exports['removeBlackLists']=function(_0xe5aee8,_0x57676e,_0x54407f){return db['VoiceQueue']['find']({'where':{'id':_0xe5aee8[_0xef62('0x4b')]['id']}})['then'](handleEntityNotFound(_0x57676e,null))[_0xef62('0x25')](function(_0x4d793b){if(_0x4d793b){return _0x4d793b[_0xef62('0xb1')](_0xe5aee8['query'][_0xef62('0x8e')]);}})[_0xef62('0x25')](function(_0x22bced){if(_0x22bced){return db[_0xef62('0x67')][_0xef62('0x26')]({'where':{'ListId':_0xe5aee8[_0xef62('0x3a')][_0xef62('0x8e')],'VoiceQueueId':_0xe5aee8[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](function(){return _0x22bced;});}})['then'](respondWithStatusCode(_0x57676e,null))[_0xef62('0x4e')](handleError(_0x57676e,null));}; \ No newline at end of file +var _0x2219=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','VoiceQueueId','options','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','interface','flatMap','penalty','Agents','sequelize','UserVoiceQueue','each','upsert','isNil','SIP/%s','voicePause','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','compact','transaction','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','omit','spread','format','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','insert','cm_contacts','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','includes','type','find','value','name','UserProfileResource','sendStatus','error','send','index','map','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','userProfileId','autoAssociation'];(function(_0x4dab97,_0x19bbcc){var _0x100e4e=function(_0x581a33){while(--_0x581a33){_0x4dab97['push'](_0x4dab97['shift']());}};_0x100e4e(++_0x19bbcc);}(_0x2219,0x115));var _0x9221=function(_0x75ce5b,_0x3b582f){_0x75ce5b=_0x75ce5b-0x0;var _0x22195e=_0x2219[_0x75ce5b];return _0x22195e;};'use strict';var pdf=require(_0x9221('0x0'));var emlformat=require(_0x9221('0x1'));var rimraf=require(_0x9221('0x2'));var zipdir=require(_0x9221('0x3'));var jsonpatch=require(_0x9221('0x4'));var rp=require('request-promise');var moment=require(_0x9221('0x5'));var BPromise=require(_0x9221('0x6'));var Mustache=require(_0x9221('0x7'));var util=require('util');var path=require(_0x9221('0x8'));var sox=require(_0x9221('0x9'));var csv=require('to-csv');var ejs=require(_0x9221('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9221('0xb'));var crypto=require(_0x9221('0xc'));var jsforce=require(_0x9221('0xd'));var deskjs=require(_0x9221('0xe'));var toCsv=require(_0x9221('0xf'));var querystring=require('querystring');var Papa=require(_0x9221('0x10'));var Redis=require('ioredis');var authService=require(_0x9221('0x11'));var qs=require(_0x9221('0x12'));var as=require(_0x9221('0x13'));var hardwareService=require(_0x9221('0x14'));var logger=require(_0x9221('0x15'))(_0x9221('0x16'));var utils=require(_0x9221('0x17'));var config=require(_0x9221('0x18'));var db=require(_0x9221('0x19'))['db'];config[_0x9221('0x1a')]=_[_0x9221('0x1b')](config[_0x9221('0x1a')],{'host':_0x9221('0x1c'),'port':0x18eb});var socket=require(_0x9221('0x1d'))(new Redis(config[_0x9221('0x1a')]));require(_0x9221('0x1e'))['register'](socket);function respondWithStatusCode(_0x5919f9,_0xbab095){_0xbab095=_0xbab095||0xcc;return function(_0x1f3e07){if(_0x1f3e07){return _0x5919f9['sendStatus'](_0xbab095);}return _0x5919f9[_0x9221('0x1f')](_0xbab095)[_0x9221('0x20')]();};}function respondWithResult(_0x2a0609,_0x5f23a5){_0x5f23a5=_0x5f23a5||0xc8;return function(_0x88677a){if(_0x88677a){return _0x2a0609[_0x9221('0x1f')](_0x5f23a5)[_0x9221('0x21')](_0x88677a);}};}function respondWithFilteredResult(_0x215f37,_0x446302){return function(_0x557534){if(_0x557534){var _0x58fbe8=_0x557534['count'],_0x51460b=_0x446302[_0x9221('0x22')],_0x207ecc=_0x446302[_0x9221('0x22')]+_0x446302[_0x9221('0x23')],_0x2fa4af;if(_0x207ecc>=_0x58fbe8){_0x207ecc=_0x58fbe8;_0x2fa4af=0xc8;}else{_0x2fa4af=0xce;}_0x215f37[_0x9221('0x1f')](_0x2fa4af);return _0x215f37[_0x9221('0x24')](_0x9221('0x25'),_0x51460b+'-'+_0x207ecc+'/'+_0x58fbe8)[_0x9221('0x21')](_0x557534);}return null;};}function patchUpdates(_0x1545a2){return function(_0x198e85){try{jsonpatch['apply'](_0x198e85,_0x1545a2,!![]);}catch(_0xdeec8d){return BPromise[_0x9221('0x26')](_0xdeec8d);}return _0x198e85[_0x9221('0x27')]();};}function saveUpdates(_0x73cc2b,_0x5b3251){return function(_0xde204d){if(_0xde204d){return _0xde204d[_0x9221('0x28')](_0x73cc2b)[_0x9221('0x29')](function(_0x6aa86a){return _0x6aa86a;});}return null;};}function removeEntity(_0x57c9e7,_0x13b787){return function(_0x70cbb4){if(_0x70cbb4){return _0x70cbb4[_0x9221('0x2a')]()[_0x9221('0x29')](function(){var _0x2a7391=_0x70cbb4[_0x9221('0x2b')]({'plain':!![]});var _0x3e710d=[{'name':_0x9221('0x2c'),'value':'inbound','ignore':![]},{'name':_0x9221('0x2d'),'value':_0x9221('0x2e'),'ignore':![]}];var _0x1b9810=_(_0x3e710d)[_0x9221('0x2f')](_0x9221('0x30'))['map']('value')['value']();if(_[_0x9221('0x31')](_0x1b9810,_0x2a7391[_0x9221('0x32')])){return;}var _0x2674e3=_[_0x9221('0x33')](_0x3e710d,[_0x9221('0x34'),_0x2a7391[_0x9221('0x32')]])[_0x9221('0x35')];return db[_0x9221('0x36')]['destroy']({'where':{'type':_0x2674e3,'resourceId':_0x2a7391['id']}})[_0x9221('0x29')](function(){return _0x70cbb4;});})[_0x9221('0x29')](function(){_0x57c9e7[_0x9221('0x1f')](0xcc)[_0x9221('0x20')]();});}};}function handleEntityNotFound(_0xe6177,_0x5e3813){return function(_0x26fa7d){if(!_0x26fa7d){_0xe6177[_0x9221('0x37')](0x194);}return _0x26fa7d;};}function handleError(_0x36f31d,_0x18fefb){_0x18fefb=_0x18fefb||0x1f4;return function(_0x36e89d){logger[_0x9221('0x38')](_0x36e89d['stack']);if(_0x36e89d[_0x9221('0x35')]){delete _0x36e89d['name'];}_0x36f31d[_0x9221('0x1f')](_0x18fefb)[_0x9221('0x39')](_0x36e89d);};}exports[_0x9221('0x3a')]=function(_0x14969a,_0x48a0ed){var _0x126185={},_0x2e7a26={},_0x1f7e37={'count':0x0,'rows':[]};var _0x4fdcc2=_[_0x9221('0x3b')](db[_0x9221('0x3c')][_0x9221('0x3d')],function(_0x41ef5f){return{'name':_0x41ef5f[_0x9221('0x3e')],'type':_0x41ef5f[_0x9221('0x32')][_0x9221('0x3f')]};});_0x2e7a26['model']=_[_0x9221('0x3b')](_0x4fdcc2,'name');_0x2e7a26[_0x9221('0x40')]=_[_0x9221('0x41')](_0x14969a[_0x9221('0x40')]);_0x2e7a26[_0x9221('0x42')]=_['intersection'](_0x2e7a26[_0x9221('0x43')],_0x2e7a26[_0x9221('0x40')]);_0x126185['attributes']=_[_0x9221('0x44')](_0x2e7a26[_0x9221('0x43')],qs[_0x9221('0x45')](_0x14969a[_0x9221('0x40')][_0x9221('0x45')]));_0x126185['attributes']=_0x126185[_0x9221('0x46')][_0x9221('0x47')]?_0x126185[_0x9221('0x46')]:_0x2e7a26['model'];if(!_0x14969a[_0x9221('0x40')][_0x9221('0x48')](_0x9221('0x49'))){_0x126185['limit']=qs[_0x9221('0x23')](_0x14969a[_0x9221('0x40')]['limit']);_0x126185[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x14969a[_0x9221('0x40')][_0x9221('0x22')]);}_0x126185[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x14969a[_0x9221('0x40')][_0x9221('0x4b')]);_0x126185[_0x9221('0x4c')]=qs['filters'](_[_0x9221('0x4d')](_0x14969a[_0x9221('0x40')],_0x2e7a26[_0x9221('0x42')]),_0x4fdcc2);if(_0x14969a['query'][_0x9221('0x2f')]){_0x126185['where']=_[_0x9221('0x4e')](_0x126185[_0x9221('0x4c')],{'$or':_['map'](_0x4fdcc2,function(_0x1cc8aa){if(_0x1cc8aa[_0x9221('0x32')]!==_0x9221('0x4f')){var _0x3633cf={};_0x3633cf[_0x1cc8aa['name']]={'$like':'%'+_0x14969a[_0x9221('0x40')][_0x9221('0x2f')]+'%'};return _0x3633cf;}})});}_0x126185=_[_0x9221('0x4e')]({},_0x126185,_0x14969a['options']);var _0x5bd72e={'where':_0x126185[_0x9221('0x4c')]};return db[_0x9221('0x3c')][_0x9221('0x50')](_0x5bd72e)['then'](function(_0x24056a){_0x1f7e37['count']=_0x24056a;if(_0x14969a[_0x9221('0x40')][_0x9221('0x51')]){_0x126185[_0x9221('0x52')]=[{'all':!![]}];}return db['VoiceQueue'][_0x9221('0x53')](_0x126185);})[_0x9221('0x29')](function(_0x52eea2){_0x1f7e37['rows']=_0x52eea2;return _0x1f7e37;})[_0x9221('0x29')](respondWithFilteredResult(_0x48a0ed,_0x126185))[_0x9221('0x54')](handleError(_0x48a0ed,null));};exports[_0x9221('0x55')]=function(_0x4156db,_0x567f3c){var _0x4d1667={'raw':![],'where':{'id':_0x4156db[_0x9221('0x56')]['id']}},_0x49806c={};_0x49806c[_0x9221('0x43')]=_[_0x9221('0x41')](db['VoiceQueue'][_0x9221('0x3d')]);_0x49806c[_0x9221('0x40')]=_['keys'](_0x4156db[_0x9221('0x40')]);_0x49806c['filters']=_['intersection'](_0x49806c[_0x9221('0x43')],_0x49806c['query']);_0x4d1667[_0x9221('0x46')]=_[_0x9221('0x44')](_0x49806c[_0x9221('0x43')],qs[_0x9221('0x45')](_0x4156db[_0x9221('0x40')][_0x9221('0x45')]));_0x4d1667[_0x9221('0x46')]=_0x4d1667[_0x9221('0x46')][_0x9221('0x47')]?_0x4d1667['attributes']:_0x49806c[_0x9221('0x43')];if(_0x4156db[_0x9221('0x40')][_0x9221('0x51')]){_0x4d1667['include']=[{'all':!![]}];}_0x4d1667=_[_0x9221('0x4e')]({},_0x4d1667,_0x4156db['options']);return db[_0x9221('0x3c')][_0x9221('0x33')](_0x4d1667)[_0x9221('0x29')](handleEntityNotFound(_0x567f3c,null))['then'](respondWithResult(_0x567f3c,null))[_0x9221('0x54')](handleError(_0x567f3c,null));};exports['create']=function(_0x2b7c66,_0x24381b){return db['VoiceQueue'][_0x9221('0x57')](_0x2b7c66[_0x9221('0x58')],{})[_0x9221('0x29')](function(_0x1c5ea3){var _0x2f89c7=_0x2b7c66[_0x9221('0x59')][_0x9221('0x2b')]({'plain':!![]});if(!_0x2f89c7)throw new Error(_0x9221('0x5a'));if(_0x2f89c7[_0x9221('0x5b')]===_0x9221('0x59')){var _0x1e83ae=_0x1c5ea3['get']({'plain':!![]});var _0x23e5d0=[{'name':_0x9221('0x2c'),'value':_0x9221('0x5c')},{'name':'QueueCampaigns','value':'outbound'}];var _0x5733b4=_[_0x9221('0x33')](_0x23e5d0,[_0x9221('0x34'),_0x1e83ae[_0x9221('0x32')]])[_0x9221('0x35')];return db['UserProfileSection'][_0x9221('0x33')]({'where':{'name':_0x5733b4,'userProfileId':_0x2f89c7[_0x9221('0x5d')]},'raw':!![]})[_0x9221('0x29')](function(_0x5de5bc){if(_0x5de5bc&&_0x5de5bc[_0x9221('0x5e')]===0x0){return db[_0x9221('0x36')][_0x9221('0x57')]({'name':_0x1e83ae['name'],'resourceId':_0x1e83ae['id'],'type':_0x5de5bc[_0x9221('0x35')],'sectionId':_0x5de5bc['id']},{})[_0x9221('0x29')](function(){return _0x1c5ea3;});}else{return _0x1c5ea3;}})[_0x9221('0x54')](function(_0x229d49){logger['error'](_0x9221('0x5f'),_0x229d49);throw _0x229d49;});}return _0x1c5ea3;})['then'](respondWithResult(_0x24381b,0xc9))['catch'](handleError(_0x24381b,null));};exports[_0x9221('0x60')]=function(_0x163861,_0x335dd3){var _0x5b7c02={'where':{'id':_0x163861[_0x9221('0x56')]['id']}},_0xa5a697={};_0xa5a697[_0x9221('0x43')]=_[_0x9221('0x41')](db[_0x9221('0x3c')][_0x9221('0x3d')]);_0x5b7c02['attributes']=_[_0x9221('0x44')](_0xa5a697['model'],qs['fields'](_0x163861['query']['fields']));_0x5b7c02[_0x9221('0x46')]=_0x5b7c02[_0x9221('0x46')][_0x9221('0x47')]?_0x5b7c02[_0x9221('0x46')]:_0xa5a697['model'];if(_0x163861[_0x9221('0x40')][_0x9221('0x51')]){_0x5b7c02['include']=[{'all':!![]}];}_0x5b7c02=_[_0x9221('0x4e')]({},_0x5b7c02,_0x163861['options']);return db[_0x9221('0x3c')]['find'](_0x5b7c02)[_0x9221('0x29')](handleEntityNotFound(_0x335dd3,null))['then'](function(_0x220cdc){if(_0x220cdc){var _0x1f3f36=_0x220cdc[_0x9221('0x2b')]({'plain':!![]});_0x1f3f36=qs['omit'](_0x1f3f36,['id',_0x9221('0x61'),'updatedAt']);_0x163861[_0x9221('0x58')]=_['omit'](_0x163861[_0x9221('0x58')],['id',_0x9221('0x61'),_0x9221('0x62')]);return db['VoiceQueue'][_0x9221('0x57')](_[_0x9221('0x4e')](_0x1f3f36,_0x163861['body']),{'include':_0x163861['query'][_0x9221('0x51')]?[{'all':!![]}]:undefined})[_0x9221('0x29')](function(_0x517245){var _0x567227=_0x163861[_0x9221('0x59')][_0x9221('0x2b')]({'plain':!![]});if(!_0x567227)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x567227[_0x9221('0x5b')]==='user'){var _0x4d754d=_0x517245['get']({'plain':!![]});var _0x3e110f=[{'name':_0x9221('0x2c'),'value':'inbound'},{'name':_0x9221('0x2d'),'value':_0x9221('0x2e')}];var _0x18f530=_[_0x9221('0x33')](_0x3e110f,['value',_0x4d754d[_0x9221('0x32')]])['name'];return db[_0x9221('0x63')][_0x9221('0x33')]({'where':{'name':_0x18f530,'userProfileId':_0x567227[_0x9221('0x5d')]},'raw':!![]})[_0x9221('0x29')](function(_0x3a05b1){if(_0x3a05b1&&_0x3a05b1['autoAssociation']===0x0){return db[_0x9221('0x36')][_0x9221('0x57')]({'name':_0x4d754d[_0x9221('0x35')],'resourceId':_0x4d754d['id'],'type':_0x3a05b1[_0x9221('0x35')],'sectionId':_0x3a05b1['id']},{})[_0x9221('0x29')](function(){return _0x517245;});}else{return _0x517245;}})[_0x9221('0x54')](function(_0x4f9c70){logger[_0x9221('0x38')](_0x9221('0x5f'),_0x4f9c70);throw _0x4f9c70;});}return _0x517245;});}})[_0x9221('0x29')](respondWithResult(_0x335dd3,0xc9))[_0x9221('0x54')](handleError(_0x335dd3,null));};exports['update']=function(_0x37eed1,_0x149db7){if(_0x37eed1[_0x9221('0x58')]['id']){delete _0x37eed1[_0x9221('0x58')]['id'];}return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x37eed1[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x149db7,null))['then'](saveUpdates(_0x37eed1[_0x9221('0x58')],null))[_0x9221('0x29')](respondWithResult(_0x149db7,null))[_0x9221('0x54')](handleError(_0x149db7,null));};exports[_0x9221('0x2a')]=function(_0x162354,_0x3c30fe){return db[_0x9221('0x3c')]['find']({'where':{'id':_0x162354[_0x9221('0x56')]['id']}})['then'](handleEntityNotFound(_0x3c30fe,null))['then'](removeEntity(_0x3c30fe,null))[_0x9221('0x54')](handleError(_0x3c30fe,null));};exports[_0x9221('0x64')]=function(_0x1a447b,_0x1d9313,_0x261c91){var _0xf578e={'raw':![],'where':{}};var _0x4fff23={};var _0x59b0c7={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9221('0x65')]({'where':{'id':_0x1a447b[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x1d9313,null))[_0x9221('0x29')](function(_0xe2625e){if(_0xe2625e){_0x4fff23['model']=_[_0x9221('0x41')](db[_0x9221('0x66')][_0x9221('0x3d')]);_0x4fff23['query']=_['keys'](_0x1a447b[_0x9221('0x40')]);_0x4fff23['filters']=_[_0x9221('0x44')](_0x4fff23['model'],_0x4fff23[_0x9221('0x40')]);_0xf578e[_0x9221('0x46')]=_['intersection'](_0x4fff23[_0x9221('0x43')],qs[_0x9221('0x45')](_0x1a447b[_0x9221('0x40')][_0x9221('0x45')]));_0xf578e[_0x9221('0x46')]=_0xf578e[_0x9221('0x46')][_0x9221('0x47')]?_0xf578e[_0x9221('0x46')]:_0x4fff23[_0x9221('0x43')];if(!_0x1a447b[_0x9221('0x40')][_0x9221('0x48')]('nolimit')){_0xf578e[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x1a447b[_0x9221('0x40')][_0x9221('0x23')]);_0xf578e[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x1a447b[_0x9221('0x40')][_0x9221('0x22')]);}_0xf578e[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x1a447b[_0x9221('0x40')]['sort']);_0xf578e['where']=qs[_0x9221('0x42')](_[_0x9221('0x4d')](_0x1a447b['query'],_0x4fff23[_0x9221('0x42')]));_0xf578e['where'][_0x9221('0x67')]=_0xe2625e['id'];if(_0x1a447b['query'][_0x9221('0x2f')]){_0xf578e[_0x9221('0x4c')]=_[_0x9221('0x4e')](_0xf578e[_0x9221('0x4c')],{'$or':_[_0x9221('0x3b')](_0xf578e['attributes'],function(_0x15451d){var _0x67cb46={};_0x67cb46[_0x15451d]={'$like':'%'+_0x1a447b['query'][_0x9221('0x2f')]+'%'};return _0x67cb46;})});}_0xf578e=_['merge']({},_0xf578e,_0x1a447b[_0x9221('0x68')]);return db[_0x9221('0x66')][_0x9221('0x50')]({'where':_0xf578e[_0x9221('0x4c')]})[_0x9221('0x29')](function(_0x8e0ceb){_0x59b0c7[_0x9221('0x50')]=_0x8e0ceb;if(_0x1a447b[_0x9221('0x40')][_0x9221('0x51')]){_0xf578e[_0x9221('0x52')]=[{'all':!![]}];}return db[_0x9221('0x66')][_0x9221('0x53')](_0xf578e);})[_0x9221('0x29')](function(_0x6a2a38){_0x59b0c7[_0x9221('0x69')]=_0x6a2a38;return _0x59b0c7;});}})[_0x9221('0x29')](respondWithFilteredResult(_0x1d9313,_0xf578e))[_0x9221('0x54')](handleError(_0x1d9313,null));};exports['getHopperHistories']=function(_0x191f3a,_0x459c0e,_0x103412){var _0x11fe58={'raw':!![],'where':{}};var _0xb4df0d={};var _0x324b93={'count':0x0,'rows':[]};return db[_0x9221('0x3c')]['findOne']({'where':{'id':_0x191f3a[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x459c0e,null))[_0x9221('0x29')](function(_0x5d9938){if(_0x5d9938){_0xb4df0d[_0x9221('0x43')]=_[_0x9221('0x41')](db[_0x9221('0x6a')][_0x9221('0x3d')]);_0xb4df0d['query']=_[_0x9221('0x41')](_0x191f3a['query']);_0xb4df0d[_0x9221('0x42')]=_[_0x9221('0x44')](_0xb4df0d['model'],_0xb4df0d[_0x9221('0x40')]);_0x11fe58[_0x9221('0x46')]=_['intersection'](_0xb4df0d[_0x9221('0x43')],qs['fields'](_0x191f3a[_0x9221('0x40')]['fields']));_0x11fe58[_0x9221('0x46')]=_0x11fe58[_0x9221('0x46')][_0x9221('0x47')]?_0x11fe58['attributes']:_0xb4df0d['model'];if(!_0x191f3a[_0x9221('0x40')]['hasOwnProperty'](_0x9221('0x49'))){_0x11fe58['limit']=qs[_0x9221('0x23')](_0x191f3a[_0x9221('0x40')][_0x9221('0x23')]);_0x11fe58['offset']=qs[_0x9221('0x22')](_0x191f3a['query'][_0x9221('0x22')]);}_0x11fe58[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x191f3a['query'][_0x9221('0x4b')]);_0x11fe58['where']=qs[_0x9221('0x42')](_[_0x9221('0x4d')](_0x191f3a[_0x9221('0x40')],_0xb4df0d[_0x9221('0x42')]));_0x11fe58['where'][_0x9221('0x67')]=_0x5d9938['id'];if(_0x191f3a[_0x9221('0x40')]['filter']){_0x11fe58[_0x9221('0x4c')]=_[_0x9221('0x4e')](_0x11fe58[_0x9221('0x4c')],{'$or':_[_0x9221('0x3b')](_0x11fe58['attributes'],function(_0x53d363){var _0x94d612={};_0x94d612[_0x53d363]={'$like':'%'+_0x191f3a[_0x9221('0x40')][_0x9221('0x2f')]+'%'};return _0x94d612;})});}_0x11fe58=_['merge']({},_0x11fe58,_0x191f3a[_0x9221('0x68')]);return db[_0x9221('0x6a')][_0x9221('0x50')]({'where':_0x11fe58[_0x9221('0x4c')]})[_0x9221('0x29')](function(_0x4be159){_0x324b93[_0x9221('0x50')]=_0x4be159;if(_0x191f3a['query']['includeAll']){_0x11fe58['include']=[{'all':!![]}];}return db[_0x9221('0x6a')]['findAll'](_0x11fe58);})[_0x9221('0x29')](function(_0x1c36e3){_0x324b93[_0x9221('0x69')]=_0x1c36e3;return _0x324b93;});}})[_0x9221('0x29')](respondWithFilteredResult(_0x459c0e,_0x11fe58))[_0x9221('0x54')](handleError(_0x459c0e,null));};exports[_0x9221('0x6b')]=function(_0x558655,_0xd555e5,_0xaba25d){var _0x6063bc={'raw':!![],'where':{}};var _0x2ad2d4={};var _0x2e391a={'count':0x0,'rows':[]};return db[_0x9221('0x3c')][_0x9221('0x65')]({'where':{'id':_0x558655[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0xd555e5,null))[_0x9221('0x29')](function(_0x2315d9){if(_0x2315d9){_0x2ad2d4[_0x9221('0x43')]=_[_0x9221('0x41')](db[_0x9221('0x6c')]['rawAttributes']);_0x2ad2d4[_0x9221('0x40')]=_[_0x9221('0x41')](_0x558655[_0x9221('0x40')]);_0x2ad2d4[_0x9221('0x42')]=_[_0x9221('0x44')](_0x2ad2d4[_0x9221('0x43')],_0x2ad2d4[_0x9221('0x40')]);_0x6063bc[_0x9221('0x46')]=_[_0x9221('0x44')](_0x2ad2d4['model'],qs[_0x9221('0x45')](_0x558655['query']['fields']));_0x6063bc[_0x9221('0x46')]=_0x6063bc[_0x9221('0x46')][_0x9221('0x47')]?_0x6063bc[_0x9221('0x46')]:_0x2ad2d4['model'];if(!_0x558655[_0x9221('0x40')][_0x9221('0x48')](_0x9221('0x49'))){_0x6063bc[_0x9221('0x23')]=qs['limit'](_0x558655[_0x9221('0x40')]['limit']);_0x6063bc[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x558655[_0x9221('0x40')][_0x9221('0x22')]);}_0x6063bc[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x558655[_0x9221('0x40')][_0x9221('0x4b')]);_0x6063bc[_0x9221('0x4c')]=qs['filters'](_[_0x9221('0x4d')](_0x558655['query'],_0x2ad2d4[_0x9221('0x42')]));_0x6063bc['where'][_0x9221('0x67')]=_0x2315d9['id'];if(_0x558655['query'][_0x9221('0x2f')]){_0x6063bc[_0x9221('0x4c')]=_[_0x9221('0x4e')](_0x6063bc[_0x9221('0x4c')],{'$or':_[_0x9221('0x3b')](_0x6063bc[_0x9221('0x46')],function(_0x3f8538){var _0x561c0c={};_0x561c0c[_0x3f8538]={'$like':'%'+_0x558655['query'][_0x9221('0x2f')]+'%'};return _0x561c0c;})});}_0x6063bc=_[_0x9221('0x4e')]({},_0x6063bc,_0x558655['options']);return db['CmHopperFinal'][_0x9221('0x50')]({'where':_0x6063bc[_0x9221('0x4c')]})[_0x9221('0x29')](function(_0x2c501b){_0x2e391a[_0x9221('0x50')]=_0x2c501b;if(_0x558655['query'][_0x9221('0x51')]){_0x6063bc['include']=[{'all':!![]}];}return db[_0x9221('0x6c')][_0x9221('0x53')](_0x6063bc);})[_0x9221('0x29')](function(_0x3af7d3){_0x2e391a[_0x9221('0x69')]=_0x3af7d3;return _0x2e391a;});}})[_0x9221('0x29')](respondWithFilteredResult(_0xd555e5,_0x6063bc))[_0x9221('0x54')](handleError(_0xd555e5,null));};exports[_0x9221('0x6d')]=function(_0x4fd9f6,_0x4ed298,_0x18e23a){var _0x5c9094={'raw':!![],'where':{}};var _0xc11929={};var _0x583878={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9221('0x65')]({'where':{'id':_0x4fd9f6[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x4ed298,null))[_0x9221('0x29')](function(_0x22501f){if(_0x22501f){_0xc11929['model']=_[_0x9221('0x41')](db[_0x9221('0x6e')][_0x9221('0x3d')]);_0xc11929[_0x9221('0x40')]=_[_0x9221('0x41')](_0x4fd9f6[_0x9221('0x40')]);_0xc11929[_0x9221('0x42')]=_[_0x9221('0x44')](_0xc11929[_0x9221('0x43')],_0xc11929['query']);_0x5c9094[_0x9221('0x46')]=_[_0x9221('0x44')](_0xc11929[_0x9221('0x43')],qs[_0x9221('0x45')](_0x4fd9f6['query'][_0x9221('0x45')]));_0x5c9094['attributes']=_0x5c9094[_0x9221('0x46')][_0x9221('0x47')]?_0x5c9094[_0x9221('0x46')]:_0xc11929['model'];if(!_0x4fd9f6[_0x9221('0x40')][_0x9221('0x48')](_0x9221('0x49'))){_0x5c9094[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x4fd9f6[_0x9221('0x40')][_0x9221('0x23')]);_0x5c9094[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x4fd9f6[_0x9221('0x40')]['offset']);}_0x5c9094[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x4fd9f6[_0x9221('0x40')][_0x9221('0x4b')]);_0x5c9094[_0x9221('0x4c')]=qs[_0x9221('0x42')](_[_0x9221('0x4d')](_0x4fd9f6['query'],_0xc11929[_0x9221('0x42')]));_0x5c9094[_0x9221('0x4c')][_0x9221('0x67')]=_0x22501f['id'];if(_0x4fd9f6[_0x9221('0x40')][_0x9221('0x2f')]){_0x5c9094['where']=_[_0x9221('0x4e')](_0x5c9094['where'],{'$or':_['map'](_0x5c9094[_0x9221('0x46')],function(_0x40edaa){var _0x5de5bb={};_0x5de5bb[_0x40edaa]={'$like':'%'+_0x4fd9f6['query'][_0x9221('0x2f')]+'%'};return _0x5de5bb;})});}_0x5c9094=_['merge']({},_0x5c9094,_0x4fd9f6['options']);return db['CmHopperBlack']['count']({'where':_0x5c9094[_0x9221('0x4c')]})['then'](function(_0x1aca39){_0x583878[_0x9221('0x50')]=_0x1aca39;if(_0x4fd9f6[_0x9221('0x40')]['includeAll']){_0x5c9094[_0x9221('0x52')]=[{'all':!![]}];}return db[_0x9221('0x6e')][_0x9221('0x53')](_0x5c9094);})[_0x9221('0x29')](function(_0x3d4663){_0x583878[_0x9221('0x69')]=_0x3d4663;return _0x583878;});}})[_0x9221('0x29')](respondWithFilteredResult(_0x4ed298,_0x5c9094))[_0x9221('0x54')](handleError(_0x4ed298,null));};exports[_0x9221('0x6f')]=function(_0x534cfc,_0x18b526,_0xad7014){var _0x36a04d={};var _0xa4d816={};var _0x10d38e;var _0x27ac7e;return db[_0x9221('0x3c')][_0x9221('0x65')]({'where':{'id':_0x534cfc['params']['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x18b526,null))[_0x9221('0x29')](function(_0x3ffba7){if(_0x3ffba7){_0x10d38e=_0x3ffba7;_0xa4d816[_0x9221('0x43')]=_['keys'](db[_0x9221('0x70')][_0x9221('0x3d')]);_0xa4d816[_0x9221('0x40')]=_['keys'](_0x534cfc['query']);_0xa4d816[_0x9221('0x42')]=_[_0x9221('0x44')](_0xa4d816[_0x9221('0x43')],_0xa4d816[_0x9221('0x40')]);_0x36a04d['attributes']=_[_0x9221('0x44')](_0xa4d816['model'],qs[_0x9221('0x45')](_0x534cfc['query'][_0x9221('0x45')]));_0x36a04d[_0x9221('0x46')]=_0x36a04d['attributes'][_0x9221('0x47')]?_0x36a04d[_0x9221('0x46')]:_0xa4d816[_0x9221('0x43')];_0x36a04d['order']=qs[_0x9221('0x4b')](_0x534cfc['query'][_0x9221('0x4b')]);_0x36a04d['where']=qs[_0x9221('0x42')](_[_0x9221('0x4d')](_0x534cfc[_0x9221('0x40')],_0xa4d816['filters']));if(_0x534cfc['query'][_0x9221('0x2f')]){_0x36a04d[_0x9221('0x4c')]=_[_0x9221('0x4e')](_0x36a04d[_0x9221('0x4c')],{'$or':_[_0x9221('0x3b')](_0x36a04d['attributes'],function(_0x84e4d2){var _0x373b4d={};_0x373b4d[_0x84e4d2]={'$like':'%'+_0x534cfc[_0x9221('0x40')][_0x9221('0x2f')]+'%'};return _0x373b4d;})});}_0x36a04d=_[_0x9221('0x4e')]({},_0x36a04d,_0x534cfc[_0x9221('0x68')]);return _0x10d38e[_0x9221('0x6f')](_0x36a04d);}})['then'](function(_0x3fb027){if(_0x3fb027){_0x27ac7e=_0x3fb027[_0x9221('0x47')];if(!_0x534cfc[_0x9221('0x40')]['hasOwnProperty'](_0x9221('0x49'))){_0x36a04d[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x534cfc[_0x9221('0x40')][_0x9221('0x23')]);_0x36a04d['offset']=qs[_0x9221('0x22')](_0x534cfc[_0x9221('0x40')][_0x9221('0x22')]);}return _0x10d38e['getTeams'](_0x36a04d);}})[_0x9221('0x29')](function(_0x493e7e){if(_0x493e7e){return _0x493e7e?{'count':_0x27ac7e,'rows':_0x493e7e}:null;}})['then'](respondWithResult(_0x18b526,null))[_0x9221('0x54')](handleError(_0x18b526,null));};exports[_0x9221('0x71')]=function(_0x5d3239,_0x15fa4e,_0x125d23){var _0x248f13=_0x5d3239[_0x9221('0x58')][_0x9221('0x72')];var _0x111f89=_[_0x9221('0x3b')](_0x248f13,'id');return db['Team'][_0x9221('0x53')]({'where':{'id':_0x111f89},'attributes':['id'],'include':[{'model':db[_0x9221('0x73')],'as':'Agents','attributes':['id','name',_0x9221('0x74'),'voicePause',_0x9221('0x75')],'raw':!![]}]})['then'](function(_0x1fa9da){if(_0x1fa9da){var _0x41c6b5=_[_0x9221('0x76')](_0x1fa9da,function(_0x29f6cf){var _0x5b9c02=_0x29f6cf[_0x9221('0x2b')]({'plain':!![]});_0x5b9c02['Agents']['forEach'](function(_0x2e7453){_0x2e7453[_0x9221('0x77')]=_[_0x9221('0x33')](_0x248f13,{'id':_0x5b9c02['id']})[_0x9221('0x77')];});return _0x5b9c02[_0x9221('0x78')];});return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x5d3239[_0x9221('0x56')]['id']}})[_0x9221('0x29')](function(_0x3116b3){return db[_0x9221('0x79')]['transaction'](function(_0x3c0aa7){return _0x3116b3[_0x9221('0x71')](_0x111f89,{'transaction':_0x3c0aa7})[_0x9221('0x29')](function(){return BPromise['each'](_0x41c6b5,function(_0x8c0d45){return db[_0x9221('0x7a')]['findOrCreate']({'where':{'UserId':_0x8c0d45['id'],'VoiceQueueId':_0x5d3239['params']['id']},'defaults':{'penalty':_0x8c0d45[_0x9221('0x77')]},'transaction':_0x3c0aa7});});})[_0x9221('0x29')](function(){return BPromise[_0x9221('0x7b')](_[_0x9221('0x2f')](_0x41c6b5,{'online':!![]}),function(_0x39f41a){return db['UserVoiceQueueRt'][_0x9221('0x7c')]({'membername':_0x39f41a['name'],'UserId':_0x39f41a['id'],'queue_name':_0x3116b3[_0x9221('0x35')],'VoiceQueueId':_0x3116b3['id'],'interface':_[_0x9221('0x7d')](_0x39f41a['interface'])?util['format'](_0x9221('0x7e'),_0x39f41a['name']):_0x39f41a[_0x9221('0x75')],'paused':_0x39f41a[_0x9221('0x7f')]||![],'penalty':_0x39f41a[_0x9221('0x77')]},{'transaction':_0x3c0aa7});});})[_0x9221('0x29')](function(){_0x41c6b5[_0x9221('0x80')](function(_0x4debd7){socket[_0x9221('0x81')](_0x9221('0x82'),{'UserId':_0x4debd7['id'],'VoiceQueueId':_0x3116b3['id']});});});});});}})[_0x9221('0x29')](respondWithStatusCode(_0x15fa4e,null))[_0x9221('0x54')](handleError(_0x15fa4e,null));};exports[_0x9221('0x83')]=function(_0x7457aa,_0x1b52f2,_0x1551af){return db['Team'][_0x9221('0x53')]({'where':{'id':_0x7457aa['query'][_0x9221('0x84')]},'attributes':['id'],'include':[{'model':db[_0x9221('0x73')],'as':_0x9221('0x78'),'attributes':['id'],'raw':!![]}]})[_0x9221('0x29')](handleEntityNotFound(_0x1b52f2,null))[_0x9221('0x29')](function(_0x5d2fe7){var _0xe5a115=_['map'](_0x5d2fe7,'id');var _0x4e7196=[];var _0x54ceb9=[];var _0x2b2428=squel[_0x9221('0x85')]();_0x2b2428[_0x9221('0x86')]('tq.TeamId')[_0x9221('0x87')](_0x9221('0x88'),'tq')[_0x9221('0x89')]('user_has_teams','ut',_0x9221('0x8a'))['where'](_0x9221('0x8b'),_0x7457aa['params']['id']);for(var _0x2eb381=0x0;_0x2eb381<_0x5d2fe7[_0x9221('0x47')];_0x2eb381+=0x1){let _0x5da259=_0x5d2fe7[_0x2eb381];for(var _0x22c58e=0x0;_0x22c58e<_0x5da259[_0x9221('0x78')][_0x9221('0x47')];_0x22c58e+=0x1){let _0x3b98f8=_0x5da259[_0x9221('0x78')][_0x22c58e];var _0x118731=_0x2b2428[_0x9221('0x60')]();_0x118731[_0x9221('0x4c')](_0x9221('0x8c'),_0x3b98f8['id']);_0x54ceb9[_0x9221('0x8d')](db[_0x9221('0x79')]['query'](_0x118731[_0x9221('0x8e')](),{'type':db['sequelize'][_0x9221('0x8f')][_0x9221('0x90')]})[_0x9221('0x29')](function(_0x34c133){if(_0x34c133['length']===0x1){return _0x3b98f8['id'];}else{var _0x38d0fe=_[_0x9221('0x91')](_['map'](_0x34c133,'TeamId'),function(_0x7dbd97){return _[_0x9221('0x31')](_0xe5a115,_0x7dbd97);});if(_0x38d0fe){return _0x3b98f8['id'];}}}));}}return BPromise[_0x9221('0x92')](_0x54ceb9)[_0x9221('0x29')](function(_0xd1d047){_0x4e7196=_(_0x4e7196)['union'](_0xd1d047)[_0x9221('0x93')]()[_0x9221('0x34')]();return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x7457aa[_0x9221('0x56')]['id']}})[_0x9221('0x29')](function(_0x1b6c52){return db[_0x9221('0x79')][_0x9221('0x94')](function(_0x3082c9){return _0x1b6c52['removeTeams'](_0x7457aa[_0x9221('0x40')][_0x9221('0x84')],{'transaction':_0x3082c9})[_0x9221('0x29')](function(){if(!_[_0x9221('0x95')](_0x4e7196)){return _0x1b6c52[_0x9221('0x96')](_0x4e7196,{'transaction':_0x3082c9})['then'](function(){return db[_0x9221('0x97')][_0x9221('0x2a')]({'where':{'VoiceQueueId':_0x7457aa[_0x9221('0x56')]['id'],'UserId':_0x4e7196},'transaction':_0x3082c9});});}})['then'](function(){_0x4e7196[_0x9221('0x80')](function(_0x52610c){socket[_0x9221('0x81')](_0x9221('0x98'),{'UserId':_0x52610c,'VoiceQueueId':_0x1b6c52['id']});});});});});});})['then'](respondWithStatusCode(_0x1b52f2,null))[_0x9221('0x54')](handleError(_0x1b52f2,null));};exports['addAgents']=function(_0xc3a214,_0x5af18d,_0x3dc398){var _0x39cb09,_0x1dab38;return db['VoiceQueue'][_0x9221('0x33')]({'where':{'id':_0xc3a214[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x5af18d,null))[_0x9221('0x29')](function(_0x1f6ce7){if(_0x1f6ce7){_0x1dab38=_0x1f6ce7;return _0x1f6ce7['addAgents'](_0xc3a214[_0x9221('0x58')][_0x9221('0x84')],_[_0x9221('0x99')](_0xc3a214[_0x9221('0x58')],[_0x9221('0x84'),'id'])||{})[_0x9221('0x9a')](function(_0x2d9928){for(var _0x3bbfb7=0x0;_0x3bbfb7<_0xc3a214['body'][_0x9221('0x84')][_0x9221('0x47')];_0x3bbfb7+=0x1){socket[_0x9221('0x81')](_0x9221('0x82'),{'UserId':_0xc3a214[_0x9221('0x58')][_0x9221('0x84')][_0x3bbfb7],'VoiceQueueId':_0xc3a214['params']['id']});}return _0x2d9928;});}})['then'](function(_0x26b9d6){_0x39cb09=_0x26b9d6||[];if(_0x1dab38){return db['User'][_0x9221('0x53')]({'where':{'id':_0xc3a214[_0x9221('0x58')][_0x9221('0x84')]},'attributes':['id',_0x9221('0x35'),'online',_0x9221('0x7f'),_0x9221('0x75')],'raw':!![]});}})['then'](function(_0x1c500b){if(!_[_0x9221('0x95')](_0x1c500b)){var _0x49c0b4=[];for(var _0x487393=0x0;_0x487393<_0x1c500b[_0x9221('0x47')];_0x487393++){if(_0x1c500b[_0x487393][_0x9221('0x74')]){_0x49c0b4[_0x9221('0x8d')](db[_0x9221('0x97')]['upsert']({'membername':_0x1c500b[_0x487393][_0x9221('0x35')],'UserId':_0x1c500b[_0x487393]['id'],'queue_name':_0x1dab38[_0x9221('0x35')],'VoiceQueueId':_0x1dab38['id'],'interface':_[_0x9221('0x7d')](_0x1c500b[_0x487393][_0x9221('0x75')])?util[_0x9221('0x9b')](_0x9221('0x7e'),_0x1c500b[_0x487393]['name']):_0x1c500b[_0x487393][_0x9221('0x75')],'paused':_0x1c500b[_0x487393][_0x9221('0x7f')]||![],'penalty':_0xc3a214['body'][_0x9221('0x77')]||0x0}));}}return BPromise[_0x9221('0x92')](_0x49c0b4);}})[_0x9221('0x29')](function(){return _0x39cb09;})[_0x9221('0x29')](respondWithResult(_0x5af18d,null))[_0x9221('0x54')](handleError(_0x5af18d,null));};exports[_0x9221('0x96')]=function(_0x1497f8,_0x20aa05,_0x48a636){return db['VoiceQueue'][_0x9221('0x33')]({'where':{'id':_0x1497f8['params']['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x20aa05,null))[_0x9221('0x29')](function(_0x16c06d){if(_0x16c06d){return _0x16c06d[_0x9221('0x96')](_0x1497f8['query'][_0x9221('0x84')])[_0x9221('0x29')](function(){if(_['isArray'](_0x1497f8[_0x9221('0x40')][_0x9221('0x84')])){for(var _0x25ffe0=0x0;_0x25ffe0<_0x1497f8[_0x9221('0x40')][_0x9221('0x84')]['length'];_0x25ffe0+=0x1){socket['emit'](_0x9221('0x98'),{'UserId':Number(_0x1497f8['query'][_0x9221('0x84')][_0x25ffe0]),'VoiceQueueId':Number(_0x1497f8[_0x9221('0x56')]['id'])});}}else{socket[_0x9221('0x81')](_0x9221('0x98'),{'UserId':Number(_0x1497f8[_0x9221('0x40')]['ids']),'VoiceQueueId':Number(_0x1497f8[_0x9221('0x56')]['id'])});}});}})[_0x9221('0x29')](function(_0x1abd59){return db['UserVoiceQueueRt'][_0x9221('0x2a')]({'where':{'VoiceQueueId':_0x1497f8['params']['id'],'UserId':_0x1497f8['query']['ids']}})[_0x9221('0x29')](function(){return _0x1abd59;});})['then'](respondWithStatusCode(_0x20aa05,null))['catch'](handleError(_0x20aa05,null));};exports[_0x9221('0x9c')]=function(_0x10921b,_0x10d836,_0x5e3cc1){var _0x4fe9bf={};var _0x3fdf8b={};var _0x1cda16;var _0x46f24b;return db[_0x9221('0x3c')][_0x9221('0x65')]({'where':{'id':_0x10921b[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x10d836,null))[_0x9221('0x29')](function(_0x33647d){if(_0x33647d){_0x1cda16=_0x33647d;_0x3fdf8b[_0x9221('0x43')]=_['keys'](db['User'][_0x9221('0x3d')]);_0x3fdf8b[_0x9221('0x40')]=_[_0x9221('0x41')](_0x10921b['query']);_0x3fdf8b['filters']=_['intersection'](_0x3fdf8b['model'],_0x3fdf8b[_0x9221('0x40')]);_0x4fe9bf['attributes']=_[_0x9221('0x44')](_0x3fdf8b['model'],qs[_0x9221('0x45')](_0x10921b[_0x9221('0x40')][_0x9221('0x45')]));_0x4fe9bf[_0x9221('0x46')]=_0x4fe9bf[_0x9221('0x46')][_0x9221('0x47')]?_0x4fe9bf[_0x9221('0x46')]:_0x3fdf8b[_0x9221('0x43')];_0x4fe9bf[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x10921b['query'][_0x9221('0x4b')]);_0x4fe9bf[_0x9221('0x4c')]=qs[_0x9221('0x42')](_[_0x9221('0x4d')](_0x10921b[_0x9221('0x40')],_0x3fdf8b[_0x9221('0x42')]));if(_0x10921b[_0x9221('0x40')]['filter']){_0x4fe9bf[_0x9221('0x4c')]=_['merge'](_0x4fe9bf['where'],{'$or':_[_0x9221('0x3b')](_0x4fe9bf[_0x9221('0x46')],function(_0x53fb7a){var _0xef7587={};_0xef7587[_0x53fb7a]={'$like':'%'+_0x10921b['query']['filter']+'%'};return _0xef7587;})});}_0x4fe9bf=_[_0x9221('0x4e')]({},_0x4fe9bf,_0x10921b[_0x9221('0x68')]);return _0x1cda16[_0x9221('0x9c')](_0x4fe9bf);}})['then'](function(_0x3e56da){if(_0x3e56da){_0x46f24b=_0x3e56da[_0x9221('0x47')];if(!_0x10921b[_0x9221('0x40')]['hasOwnProperty'](_0x9221('0x49'))){_0x4fe9bf[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x10921b[_0x9221('0x40')][_0x9221('0x23')]);_0x4fe9bf[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x10921b['query']['offset']);}return _0x1cda16['getAgents'](_0x4fe9bf);}})[_0x9221('0x29')](function(_0x47ef9f){if(_0x47ef9f){return _0x47ef9f?{'count':_0x46f24b,'rows':_0x47ef9f}:null;}})['then'](respondWithResult(_0x10d836,null))['catch'](handleError(_0x10d836,null));};exports['getMembers']=function(_0x575299,_0x42df6a,_0x5f1b4c){var _0x3f31a7={};var _0x430c43={};var _0x13f716;var _0x5f1700;return db['VoiceQueue']['findOne']({'where':{'id':_0x575299['params']['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x42df6a,null))[_0x9221('0x29')](function(_0x3feddb){if(_0x3feddb){_0x13f716=_0x3feddb;_0x430c43['model']=_[_0x9221('0x41')](db['UserVoiceQueueRt']['rawAttributes']);_0x430c43[_0x9221('0x40')]=_['keys'](_0x575299[_0x9221('0x40')]);_0x430c43['filters']=_[_0x9221('0x44')](_0x430c43[_0x9221('0x43')],_0x430c43[_0x9221('0x40')]);_0x3f31a7[_0x9221('0x46')]=_[_0x9221('0x44')](_0x430c43[_0x9221('0x43')],qs[_0x9221('0x45')](_0x575299[_0x9221('0x40')]['fields']));_0x3f31a7[_0x9221('0x46')]=_0x3f31a7[_0x9221('0x46')][_0x9221('0x47')]?_0x3f31a7['attributes']:_0x430c43['model'];_0x3f31a7[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x575299[_0x9221('0x40')]['sort']);_0x3f31a7['where']=qs[_0x9221('0x42')](_['pick'](_0x575299['query'],_0x430c43[_0x9221('0x42')]));if(_0x575299[_0x9221('0x40')][_0x9221('0x2f')]){_0x3f31a7['where']=_[_0x9221('0x4e')](_0x3f31a7[_0x9221('0x4c')],{'$or':_[_0x9221('0x3b')](_0x3f31a7[_0x9221('0x46')],function(_0x5b40b0){var _0x275f22={};_0x275f22[_0x5b40b0]={'$like':'%'+_0x575299[_0x9221('0x40')][_0x9221('0x2f')]+'%'};return _0x275f22;})});}_0x3f31a7=_[_0x9221('0x4e')]({},_0x3f31a7,_0x575299['options']);return _0x13f716[_0x9221('0x9d')](_0x3f31a7);}})[_0x9221('0x29')](function(_0x12d87f){if(_0x12d87f){_0x5f1700=_0x12d87f[_0x9221('0x47')];if(!_0x575299['query'][_0x9221('0x48')]('nolimit')){_0x3f31a7[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x575299[_0x9221('0x40')][_0x9221('0x23')]);_0x3f31a7[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x575299[_0x9221('0x40')][_0x9221('0x22')]);}return _0x13f716[_0x9221('0x9d')](_0x3f31a7);}})[_0x9221('0x29')](function(_0x5e6540){return _0x5e6540?{'count':_0x5f1700,'rows':_0x5e6540}:null;})[_0x9221('0x29')](respondWithResult(_0x42df6a,null))[_0x9221('0x54')](handleError(_0x42df6a,null));};exports[_0x9221('0x9e')]=function(_0x361dfc,_0x3d90ca,_0x7f792e){var _0x593a93={};var _0x569b5b={};var _0x4bba30;var _0x2e2a4e;return db[_0x9221('0x3c')][_0x9221('0x65')]({'where':{'id':_0x361dfc['params']['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x3d90ca,null))[_0x9221('0x29')](function(_0x2e9a00){if(_0x2e9a00){_0x4bba30=_0x2e9a00;_0x569b5b[_0x9221('0x43')]=_[_0x9221('0x41')](db['CmList'][_0x9221('0x3d')]);_0x569b5b[_0x9221('0x40')]=_[_0x9221('0x41')](_0x361dfc[_0x9221('0x40')]);_0x569b5b['filters']=_['intersection'](_0x569b5b['model'],_0x569b5b[_0x9221('0x40')]);_0x593a93['attributes']=_[_0x9221('0x44')](_0x569b5b[_0x9221('0x43')],qs['fields'](_0x361dfc[_0x9221('0x40')][_0x9221('0x45')]));_0x593a93[_0x9221('0x46')]=_0x593a93[_0x9221('0x46')][_0x9221('0x47')]?_0x593a93[_0x9221('0x46')]:_0x569b5b[_0x9221('0x43')];_0x593a93[_0x9221('0x4a')]=qs['sort'](_0x361dfc[_0x9221('0x40')][_0x9221('0x4b')]);_0x593a93[_0x9221('0x4c')]=qs['filters'](_[_0x9221('0x4d')](_0x361dfc[_0x9221('0x40')],_0x569b5b[_0x9221('0x42')]));if(_0x361dfc['query'][_0x9221('0x2f')]){_0x593a93[_0x9221('0x4c')]=_[_0x9221('0x4e')](_0x593a93[_0x9221('0x4c')],{'$or':_[_0x9221('0x3b')](_0x593a93['attributes'],function(_0x42abc6){var _0x48aa7f={};_0x48aa7f[_0x42abc6]={'$like':'%'+_0x361dfc[_0x9221('0x40')]['filter']+'%'};return _0x48aa7f;})});}_0x593a93=_[_0x9221('0x4e')]({},_0x593a93,_0x361dfc[_0x9221('0x68')]);return _0x4bba30[_0x9221('0x9e')](_0x593a93);}})[_0x9221('0x29')](function(_0x1defbe){if(_0x1defbe){_0x2e2a4e=_0x1defbe[_0x9221('0x47')];if(!_0x361dfc[_0x9221('0x40')][_0x9221('0x48')](_0x9221('0x49'))){_0x593a93[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x361dfc[_0x9221('0x40')][_0x9221('0x23')]);_0x593a93[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x361dfc[_0x9221('0x40')]['offset']);}return _0x4bba30[_0x9221('0x9e')](_0x593a93);}})[_0x9221('0x29')](function(_0x2c6cb8){if(_0x2c6cb8){return _0x2c6cb8?{'count':_0x2e2a4e,'rows':_0x2c6cb8}:null;}})[_0x9221('0x29')](respondWithResult(_0x3d90ca,null))['catch'](handleError(_0x3d90ca,null));};exports[_0x9221('0x9f')]=function(_0x41d3d9,_0x4dd2c9,_0x415bf6){var _0x26d7d5,_0x2796aa;return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x41d3d9[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x4dd2c9,null))[_0x9221('0x29')](function(_0x3aa890){if(_0x3aa890){_0x2796aa=_0x3aa890;return _0x3aa890[_0x9221('0x9f')](_0x41d3d9[_0x9221('0x58')]['ids'],_['omit'](_0x41d3d9[_0x9221('0x58')],[_0x9221('0x84'),'id'])||{});}return null;})[_0x9221('0x9a')](function(_0x5e3fbb){var _0x3f3835;_0x26d7d5=_0x5e3fbb||[];var _0x2d6805=[];if(_0x5e3fbb){for(var _0x222954=0x0;_0x222954<_0x5e3fbb[_0x9221('0x47')];_0x222954+=0x1){var _0x3efa80=_0x5e3fbb[_0x222954][_0x9221('0x2b')]({'plain':!![]});_0x2796aa[_0x9221('0xa0')]=_0x41d3d9[_0x9221('0x58')][_0x9221('0xa0')]?_0x41d3d9[_0x9221('0x58')]['dialCheckDuplicateType']:_0x2796aa['dialCheckDuplicateType'];switch(_0x2796aa[_0x9221('0xa0')]){case _0x9221('0xa1'):_0x3f3835=squel['insert']()[_0x9221('0xa2')](_0x9221('0xa3'))[_0x9221('0xa4')]([_0x9221('0xa5'),_0x9221('0xa6'),_0x9221('0xa7'),'ListId',_0x9221('0x67'),_0x9221('0x61'),_0x9221('0x62')],squel[_0x9221('0x85')]()[_0x9221('0x86')](_0x9221('0xa5'),_0x9221('0xa5'))[_0x9221('0x86')]('NOW()',_0x9221('0xa6'))['field']('id',_0x9221('0xa7'))['field'](_0x3efa80['CmListId'][_0x9221('0x8e')](),_0x9221('0xa8'))[_0x9221('0x86')](_0x41d3d9[_0x9221('0x56')]['id']['toString'](),_0x9221('0x67'))[_0x9221('0x86')](_0x9221('0xa9'),'createdAt')[_0x9221('0x86')](_0x9221('0xa9'),_0x9221('0x62'))[_0x9221('0x87')]('cm_contacts')[_0x9221('0x4c')](_0x9221('0xaa'))[_0x9221('0x4c')](_0x9221('0xab'),_0x3efa80[_0x9221('0xac')][_0x9221('0x8e')]())[_0x9221('0x4c')]('phone\x20IS\x20NOT\x20NULL')[_0x9221('0x4c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9221('0x85')]()[_0x9221('0x86')]('COALESCE(calleridnum,\x27\x27)')[_0x9221('0x87')](_0x9221('0xad'))['where'](_0x9221('0x8b'),_0x41d3d9[_0x9221('0x56')]['id'][_0x9221('0x8e')]()))[_0x9221('0x4c')](_0x9221('0xae'),squel['select']()[_0x9221('0x86')]('COALESCE(phone,\x27\x27)')[_0x9221('0x87')]('cm_hopper')['where'](_0x9221('0x8b'),_0x41d3d9['params']['id'][_0x9221('0x8e')]())))[_0x9221('0x8e')]();break;case _0x9221('0xaf'):_0x3f3835=squel[_0x9221('0xb0')]()[_0x9221('0xa2')]('cm_hopper')[_0x9221('0xa4')](['phone',_0x9221('0xa6'),'ContactId',_0x9221('0xa8'),_0x9221('0x67'),_0x9221('0x61'),_0x9221('0x62')],squel[_0x9221('0x85')]()[_0x9221('0x86')]('phone',_0x9221('0xa5'))['field'](_0x9221('0xa9'),_0x9221('0xa6'))[_0x9221('0x86')]('id',_0x9221('0xa7'))[_0x9221('0x86')](_0x3efa80['CmListId'][_0x9221('0x8e')](),_0x9221('0xa8'))[_0x9221('0x86')](_0x41d3d9['params']['id'][_0x9221('0x8e')](),_0x9221('0x67'))[_0x9221('0x86')](_0x9221('0xa9'),_0x9221('0x61'))['field'](_0x9221('0xa9'),_0x9221('0x62'))[_0x9221('0x87')](_0x9221('0xb1'))[_0x9221('0x4c')]('deletedAt\x20IS\x20NULL')[_0x9221('0x4c')]('ListId\x20=\x20?',_0x3efa80['CmListId']['toString']())[_0x9221('0x4c')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x9221('0x85')]()[_0x9221('0x86')](_0x9221('0xb2'))[_0x9221('0x87')](_0x9221('0xa3'))[_0x9221('0x4c')](_0x9221('0x8b'),_0x41d3d9[_0x9221('0x56')]['id'][_0x9221('0x8e')]())))['toString']();break;default:_0x3f3835=squel[_0x9221('0xb0')]()['into'](_0x9221('0xa3'))[_0x9221('0xa4')]([_0x9221('0xa5'),'scheduledAt',_0x9221('0xa7'),_0x9221('0xa8'),_0x9221('0x67'),_0x9221('0x61'),'updatedAt'],squel['select']()['field'](_0x9221('0xa5'),_0x9221('0xa5'))[_0x9221('0x86')](_0x9221('0xa9'),_0x9221('0xa6'))[_0x9221('0x86')]('id',_0x9221('0xa7'))[_0x9221('0x86')](_0x3efa80[_0x9221('0xac')]['toString'](),_0x9221('0xa8'))[_0x9221('0x86')](_0x41d3d9[_0x9221('0x56')]['id'][_0x9221('0x8e')](),'VoiceQueueId')[_0x9221('0x86')](_0x9221('0xa9'),'createdAt')[_0x9221('0x86')]('NOW()',_0x9221('0x62'))['from'](_0x9221('0xb1'))['where']('deletedAt\x20IS\x20NULL')[_0x9221('0x4c')](_0x9221('0xab'),_0x3efa80[_0x9221('0xac')][_0x9221('0x8e')]())[_0x9221('0x4c')](_0x9221('0xb3')))[_0x9221('0x8e')]();}_0x2d6805[_0x9221('0x8d')](db[_0x9221('0x79')][_0x9221('0x40')](_0x3f3835));}return BPromise[_0x9221('0x92')](_0x2d6805);}})[_0x9221('0x29')](function(){return _0x26d7d5;})[_0x9221('0x29')](respondWithResult(_0x4dd2c9,null))[_0x9221('0x54')](handleError(_0x4dd2c9,null));};exports[_0x9221('0xb4')]=function(_0x4fca68,_0x338672,_0x19eb53){return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x4fca68['params']['id']}})['then'](handleEntityNotFound(_0x338672,null))[_0x9221('0x29')](function(_0x10e90f){if(_0x10e90f){return _0x10e90f[_0x9221('0xb4')](_0x4fca68['query'][_0x9221('0x84')]);}})[_0x9221('0x29')](function(_0x507584){if(_0x507584){return db[_0x9221('0x66')][_0x9221('0x2a')]({'where':{'ListId':_0x4fca68['query']['ids'],'VoiceQueueId':_0x4fca68[_0x9221('0x56')]['id']}})[_0x9221('0x29')](function(){return _0x507584;});}})['then'](respondWithStatusCode(_0x338672,null))[_0x9221('0x54')](handleError(_0x338672,null));};exports['getBlackLists']=function(_0x501b2d,_0x58e7ec,_0x122eb1){var _0x152bcd={};var _0x562f67={};var _0x2b2302;var _0x116d3e;return db[_0x9221('0x3c')][_0x9221('0x65')]({'where':{'id':_0x501b2d['params']['id']}})['then'](handleEntityNotFound(_0x58e7ec,null))[_0x9221('0x29')](function(_0x5f54a8){if(_0x5f54a8){_0x2b2302=_0x5f54a8;_0x562f67[_0x9221('0x43')]=_[_0x9221('0x41')](db[_0x9221('0xb5')][_0x9221('0x3d')]);_0x562f67['query']=_[_0x9221('0x41')](_0x501b2d[_0x9221('0x40')]);_0x562f67['filters']=_[_0x9221('0x44')](_0x562f67[_0x9221('0x43')],_0x562f67[_0x9221('0x40')]);_0x152bcd[_0x9221('0x46')]=_['intersection'](_0x562f67['model'],qs[_0x9221('0x45')](_0x501b2d[_0x9221('0x40')][_0x9221('0x45')]));_0x152bcd[_0x9221('0x46')]=_0x152bcd[_0x9221('0x46')][_0x9221('0x47')]?_0x152bcd['attributes']:_0x562f67[_0x9221('0x43')];_0x152bcd[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x501b2d[_0x9221('0x40')][_0x9221('0x4b')]);_0x152bcd['where']=qs['filters'](_[_0x9221('0x4d')](_0x501b2d['query'],_0x562f67[_0x9221('0x42')]));if(_0x501b2d['query'][_0x9221('0x2f')]){_0x152bcd['where']=_[_0x9221('0x4e')](_0x152bcd['where'],{'$or':_[_0x9221('0x3b')](_0x152bcd['attributes'],function(_0x2f0a77){var _0x50fc19={};_0x50fc19[_0x2f0a77]={'$like':'%'+_0x501b2d[_0x9221('0x40')][_0x9221('0x2f')]+'%'};return _0x50fc19;})});}_0x152bcd=_[_0x9221('0x4e')]({},_0x152bcd,_0x501b2d['options']);return _0x2b2302['getBlackLists'](_0x152bcd);}})[_0x9221('0x29')](function(_0x3ab46b){if(_0x3ab46b){_0x116d3e=_0x3ab46b[_0x9221('0x47')];if(!_0x501b2d[_0x9221('0x40')][_0x9221('0x48')](_0x9221('0x49'))){_0x152bcd[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x501b2d[_0x9221('0x40')]['limit']);_0x152bcd[_0x9221('0x22')]=qs['offset'](_0x501b2d[_0x9221('0x40')][_0x9221('0x22')]);}return _0x2b2302[_0x9221('0xb6')](_0x152bcd);}})[_0x9221('0x29')](function(_0x4e75d9){if(_0x4e75d9){return _0x4e75d9?{'count':_0x116d3e,'rows':_0x4e75d9}:null;}})[_0x9221('0x29')](respondWithResult(_0x58e7ec,null))[_0x9221('0x54')](handleError(_0x58e7ec,null));};exports[_0x9221('0xb7')]=function(_0x2fcf77,_0x16484c,_0x58ca4f){var _0x18617d,_0x3c3a5f;return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x2fcf77[_0x9221('0x56')]['id']}})['then'](handleEntityNotFound(_0x16484c,null))[_0x9221('0x29')](function(_0x5578c5){if(_0x5578c5){_0x3c3a5f=_0x5578c5;return _0x5578c5[_0x9221('0xb7')](_0x2fcf77[_0x9221('0x58')][_0x9221('0x84')],_['omit'](_0x2fcf77['body'],['ids','id'])||{});}return null;})[_0x9221('0x9a')](function(_0x8c9ec8){var _0x4b01a2;_0x18617d=_0x8c9ec8||[];var _0x15374d=[];if(_0x8c9ec8){for(var _0x3d1b0d=0x0;_0x3d1b0d<_0x8c9ec8['length'];_0x3d1b0d+=0x1){var _0x360a92=_0x8c9ec8[_0x3d1b0d]['get']({'plain':!![]});_0x4b01a2=squel[_0x9221('0xb0')]()[_0x9221('0xa2')](_0x9221('0xb8'))[_0x9221('0xa4')](['phone',_0x9221('0xa7'),_0x9221('0xa8'),_0x9221('0x67'),_0x9221('0x61'),_0x9221('0x62')],squel[_0x9221('0x85')]()[_0x9221('0x86')](_0x9221('0xa5'),_0x9221('0xa5'))[_0x9221('0x86')]('id',_0x9221('0xa7'))[_0x9221('0x86')](_0x360a92[_0x9221('0xac')][_0x9221('0x8e')](),_0x9221('0xa8'))[_0x9221('0x86')](_0x2fcf77['params']['id'][_0x9221('0x8e')](),_0x9221('0x67'))[_0x9221('0x86')]('NOW()',_0x9221('0x61'))[_0x9221('0x86')](_0x9221('0xa9'),_0x9221('0x62'))['from'](_0x9221('0xb1'))[_0x9221('0x4c')](_0x9221('0xaa'))['where']('ListId\x20=\x20?',_0x360a92['CmListId'][_0x9221('0x8e')]())[_0x9221('0x4c')](_0x9221('0xb3')))['toString']();_0x15374d['push'](db[_0x9221('0x79')][_0x9221('0x40')](_0x4b01a2));}return BPromise[_0x9221('0x92')](_0x15374d);}})[_0x9221('0x29')](function(){return _0x18617d;})['then'](respondWithResult(_0x16484c,null))['catch'](handleError(_0x16484c,null));};exports[_0x9221('0xb9')]=function(_0x301ac5,_0x48d1ef,_0xdae68d){return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x301ac5[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x48d1ef,null))[_0x9221('0x29')](function(_0x5b4d42){if(_0x5b4d42){return _0x5b4d42[_0x9221('0xb9')](_0x301ac5['query'][_0x9221('0x84')]);}})[_0x9221('0x29')](function(_0xa4de67){if(_0xa4de67){return db[_0x9221('0x6e')][_0x9221('0x2a')]({'where':{'ListId':_0x301ac5[_0x9221('0x40')]['ids'],'VoiceQueueId':_0x301ac5[_0x9221('0x56')]['id']}})[_0x9221('0x29')](function(){return _0xa4de67;});}})[_0x9221('0x29')](respondWithStatusCode(_0x48d1ef,null))[_0x9221('0x54')](handleError(_0x48d1ef,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index f15c118..2d7fcfb 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 _0x8430=['VoiceQueue','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2024af,_0x188afc){var _0x593b94=function(_0x44a030){while(--_0x44a030){_0x2024af['push'](_0x2024af['shift']());}};_0x593b94(++_0x188afc);}(_0x8430,0xce));var _0x0843=function(_0xf23ae0,_0x13041f){_0xf23ae0=_0xf23ae0-0x0;var _0x441c81=_0x8430[_0xf23ae0];return _0x441c81;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x0843('0x0'))['db'][_0x0843('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0843('0x2'),'afterUpdate':_0x0843('0x3'),'afterDestroy':_0x0843('0x4')};function emitEvent(_0x2b63db){return function(_0x574bc0,_0x62f07c,_0x200f01){VoiceQueueEvents['emit'](_0x2b63db+':'+_0x574bc0['id'],_0x574bc0);VoiceQueueEvents[_0x0843('0x5')](_0x2b63db,_0x574bc0);_0x200f01(null);};}for(var e in events){if(events[_0x0843('0x6')](e)){var event=events[e];VoiceQueue[_0x0843('0x7')](e,emitEvent(event));}}module[_0x0843('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xc647=['VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xc647,0x152));var _0x7c64=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xc647[_0x581af1];return _0x54c22e;};'use strict';var EventEmitter=require(_0x7c64('0x0'));var VoiceQueue=require(_0x7c64('0x1'))['db'][_0x7c64('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x7c64('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7c64('0x4'),'afterDestroy':_0x7c64('0x5')};function emitEvent(_0x4e24e6){return function(_0x11caa1,_0x6e837b,_0x291b81){VoiceQueueEvents[_0x7c64('0x6')](_0x4e24e6+':'+_0x11caa1['id'],_0x11caa1);VoiceQueueEvents[_0x7c64('0x6')](_0x4e24e6,_0x11caa1);_0x291b81(null);};}for(var e in events){if(events[_0x7c64('0x7')](e)){var event=events[e];VoiceQueue[_0x7c64('0x8')](e,emitEvent(event));}}module[_0x7c64('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 9f477eb..df5f1bf 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 _0x9cfa=['define','VoiceQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports'];(function(_0x39872b,_0x343e6b){var _0x55fa18=function(_0x217c7f){while(--_0x217c7f){_0x39872b['push'](_0x39872b['shift']());}};_0x55fa18(++_0x343e6b);}(_0x9cfa,0xce));var _0xa9cf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9cfa[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xa9cf('0x0'));var logger=require(_0xa9cf('0x1'))(_0xa9cf('0x2'));var moment=require(_0xa9cf('0x3'));var BPromise=require(_0xa9cf('0x4'));var rp=require(_0xa9cf('0x5'));var fs=require('fs');var path=require(_0xa9cf('0x6'));var rimraf=require(_0xa9cf('0x7'));var config=require('../../config/environment');var attributes=require(_0xa9cf('0x8'));module[_0xa9cf('0x9')]=function(_0x3f52f9,_0x2c0c20){return _0x3f52f9[_0xa9cf('0xa')](_0xa9cf('0xb'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa754=['rimraf','../../config/environment','VoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x50090b,_0x5eac92){var _0x5cb5ee=function(_0xa2f639){while(--_0xa2f639){_0x50090b['push'](_0x50090b['shift']());}};_0x5cb5ee(++_0x5eac92);}(_0xa754,0x16b));var _0x4a75=function(_0x2ddb23,_0x33a83b){_0x2ddb23=_0x2ddb23-0x0;var _0x59671c=_0xa754[_0x2ddb23];return _0x59671c;};'use strict';var _=require(_0x4a75('0x0'));var util=require(_0x4a75('0x1'));var logger=require(_0x4a75('0x2'))(_0x4a75('0x3'));var moment=require(_0x4a75('0x4'));var BPromise=require(_0x4a75('0x5'));var rp=require(_0x4a75('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a75('0x7'));var config=require(_0x4a75('0x8'));var attributes=require('./voiceQueue.attributes');module['exports']=function(_0xef1740,_0x187874){return _0xef1740['define'](_0x4a75('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 67f34bb..2386d6a 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 _0x5ebb=['limit','include','map','model','attributes','then','catch','ShowVoiceQueue','stringify','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','GetVoiceQueue','VoiceQueue','findAll','raw','options'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0x5ebb,0x144));var _0xb5eb=function(_0x407131,_0x1bac9e){_0x407131=_0x407131-0x0;var _0xf60c74=_0x5ebb[_0x407131];return _0xf60c74;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb5eb('0x0'));var BPromise=require(_0xb5eb('0x1'));var rs=require(_0xb5eb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5eb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5eb('0x4'))('rpc');var config=require(_0xb5eb('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb5eb('0x6')][_0xb5eb('0x7')]({'port':0x232a});config[_0xb5eb('0x8')]=_[_0xb5eb('0x9')](config['redis'],{'host':_0xb5eb('0xa'),'port':0x18eb});var socket=require(_0xb5eb('0xb'))(new Redis(config[_0xb5eb('0x8')]));require(_0xb5eb('0xc'))['register'](socket);function respondWithRpcPromise(_0x194ae9,_0xe25d18,_0x518bb6){return new BPromise(function(_0x2526b5,_0x4bb814){return client['request'](_0x194ae9,_0x518bb6)['then'](function(_0x2665fb){logger['info'](_0xb5eb('0xd'),_0xe25d18,_0xb5eb('0xe'));logger[_0xb5eb('0xf')](_0xb5eb('0x10'),_0xe25d18,_0xb5eb('0xe'),JSON['stringify'](_0x2665fb));if(_0x2665fb[_0xb5eb('0x11')]){if(_0x2665fb['error'][_0xb5eb('0x12')]===0x1f4){logger[_0xb5eb('0x11')](_0xb5eb('0xd'),_0xe25d18,_0x2665fb[_0xb5eb('0x11')]['message']);return _0x4bb814(_0x2665fb['error'][_0xb5eb('0x13')]);}logger[_0xb5eb('0x11')]('VoiceQueue,\x20%s,\x20%s',_0xe25d18,_0x2665fb[_0xb5eb('0x11')][_0xb5eb('0x13')]);return _0x2526b5(_0x2665fb[_0xb5eb('0x11')][_0xb5eb('0x13')]);}else{logger[_0xb5eb('0x14')](_0xb5eb('0xd'),_0xe25d18,'request\x20sent');_0x2526b5(_0x2665fb['result'][_0xb5eb('0x13')]);}})['catch'](function(_0x3a2132){logger[_0xb5eb('0x11')](_0xb5eb('0xd'),_0xe25d18,_0x3a2132);_0x4bb814(_0x3a2132);});});}exports[_0xb5eb('0x15')]=function(_0x3c9a72){var _0x253ac9=this;return new Promise(function(_0x65d6a3,_0x4e8d71){return db[_0xb5eb('0x16')][_0xb5eb('0x17')]({'raw':_0x3c9a72['options']?_0x3c9a72['options'][_0xb5eb('0x18')]===undefined?!![]:![]:!![],'where':_0x3c9a72[_0xb5eb('0x19')]?_0x3c9a72[_0xb5eb('0x19')]['where']||null:null,'attributes':_0x3c9a72[_0xb5eb('0x19')]?_0x3c9a72[_0xb5eb('0x19')]['attributes']||null:null,'limit':_0x3c9a72[_0xb5eb('0x19')]?_0x3c9a72[_0xb5eb('0x19')][_0xb5eb('0x1a')]||null:null,'include':_0x3c9a72[_0xb5eb('0x19')]?_0x3c9a72[_0xb5eb('0x19')][_0xb5eb('0x1b')]?_[_0xb5eb('0x1c')](_0x3c9a72[_0xb5eb('0x19')][_0xb5eb('0x1b')],function(_0x3cd787){return{'model':db[_0x3cd787[_0xb5eb('0x1d')]],'as':_0x3cd787['as'],'attributes':_0x3cd787[_0xb5eb('0x1e')],'include':_0x3cd787[_0xb5eb('0x1b')]?_['map'](_0x3cd787[_0xb5eb('0x1b')],function(_0x230ccc){return{'model':db[_0x230ccc[_0xb5eb('0x1d')]],'as':_0x230ccc['as'],'attributes':_0x230ccc[_0xb5eb('0x1e')],'include':_0x230ccc[_0xb5eb('0x1b')]?_['map'](_0x230ccc['include'],function(_0x33a1e0){return{'model':db[_0x33a1e0[_0xb5eb('0x1d')]],'as':_0x33a1e0['as'],'attributes':_0x33a1e0[_0xb5eb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5eb('0x1f')](function(_0x2a9d29){logger[_0xb5eb('0x14')]('GetVoiceQueue',_0x3c9a72);logger[_0xb5eb('0xf')](_0xb5eb('0x15'),_0x3c9a72,JSON['stringify'](_0x2a9d29));_0x65d6a3(_0x2a9d29);})[_0xb5eb('0x20')](function(_0x38f230){logger[_0xb5eb('0x11')](_0xb5eb('0x15'),_0x38f230['message'],_0x3c9a72);_0x4e8d71(_0x253ac9[_0xb5eb('0x11')](0x1f4,_0x38f230[_0xb5eb('0x13')]));});});};exports[_0xb5eb('0x21')]=function(_0x49d5e6){var _0x35c5eb=this;return new Promise(function(_0x546b21,_0x5c841f){return db['VoiceQueue']['find']({'raw':_0x49d5e6['options']?_0x49d5e6[_0xb5eb('0x19')][_0xb5eb('0x18')]===undefined?!![]:![]:!![],'where':_0x49d5e6[_0xb5eb('0x19')]?_0x49d5e6[_0xb5eb('0x19')]['where']||null:null,'attributes':_0x49d5e6[_0xb5eb('0x19')]?_0x49d5e6[_0xb5eb('0x19')][_0xb5eb('0x1e')]||null:null,'include':_0x49d5e6[_0xb5eb('0x19')]?_0x49d5e6['options']['include']?_['map'](_0x49d5e6[_0xb5eb('0x19')][_0xb5eb('0x1b')],function(_0x66f0f0){return{'model':db[_0x66f0f0[_0xb5eb('0x1d')]],'as':_0x66f0f0['as'],'attributes':_0x66f0f0[_0xb5eb('0x1e')],'include':_0x66f0f0[_0xb5eb('0x1b')]?_[_0xb5eb('0x1c')](_0x66f0f0[_0xb5eb('0x1b')],function(_0x38c96d){return{'model':db[_0x38c96d['model']],'as':_0x38c96d['as'],'attributes':_0x38c96d['attributes'],'include':_0x38c96d['include']?_[_0xb5eb('0x1c')](_0x38c96d[_0xb5eb('0x1b')],function(_0x315855){return{'model':db[_0x315855[_0xb5eb('0x1d')]],'as':_0x315855['as'],'attributes':_0x315855[_0xb5eb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5eb('0x1f')](function(_0x16e564){logger[_0xb5eb('0x14')]('ShowVoiceQueue',_0x49d5e6);logger[_0xb5eb('0xf')](_0xb5eb('0x21'),_0x49d5e6,JSON[_0xb5eb('0x22')](_0x16e564));_0x546b21(_0x16e564);})[_0xb5eb('0x20')](function(_0x1539e0){logger['error'](_0xb5eb('0x21'),_0x1539e0[_0xb5eb('0x13')],_0x49d5e6);_0x5c841f(_0x35c5eb[_0xb5eb('0x11')](0x1f4,_0x1539e0['message']));});});}; \ No newline at end of file +var _0xd8f6=['rpc','jayson/promise','client','redis','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueue','VoiceQueue','options','where','attributes','limit','include','map','model','stringify','find','raw','ShowVoiceQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xd8f6,0x1b5));var _0x6d8f=function(_0x1f3430,_0x5f0338){_0x1f3430=_0x1f3430-0x0;var _0x21f17c=_0xd8f6[_0x1f3430];return _0x21f17c;};'use strict';var _=require(_0x6d8f('0x0'));var util=require(_0x6d8f('0x1'));var moment=require('moment');var BPromise=require(_0x6d8f('0x2'));var rs=require(_0x6d8f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d8f('0x4'))['db'];var utils=require(_0x6d8f('0x5'));var logger=require(_0x6d8f('0x6'))(_0x6d8f('0x7'));var config=require('../../config/environment');var jayson=require(_0x6d8f('0x8'));var client=jayson[_0x6d8f('0x9')]['http']({'port':0x232a});config[_0x6d8f('0xa')]=_['defaults'](config[_0x6d8f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d8f('0xb'))(new Redis(config[_0x6d8f('0xa')]));require(_0x6d8f('0xc'))[_0x6d8f('0xd')](socket);function respondWithRpcPromise(_0x47191b,_0x5b4785,_0x518121){return new BPromise(function(_0x38a0c8,_0x23dc5e){return client['request'](_0x47191b,_0x518121)[_0x6d8f('0xe')](function(_0x244400){logger[_0x6d8f('0xf')](_0x6d8f('0x10'),_0x5b4785,_0x6d8f('0x11'));logger[_0x6d8f('0x12')](_0x6d8f('0x13'),_0x5b4785,_0x6d8f('0x11'),JSON['stringify'](_0x244400));if(_0x244400[_0x6d8f('0x14')]){if(_0x244400[_0x6d8f('0x14')][_0x6d8f('0x15')]===0x1f4){logger['error'](_0x6d8f('0x10'),_0x5b4785,_0x244400[_0x6d8f('0x14')]['message']);return _0x23dc5e(_0x244400[_0x6d8f('0x14')][_0x6d8f('0x16')]);}logger[_0x6d8f('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x5b4785,_0x244400[_0x6d8f('0x14')][_0x6d8f('0x16')]);return _0x38a0c8(_0x244400[_0x6d8f('0x14')]['message']);}else{logger[_0x6d8f('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x5b4785,_0x6d8f('0x11'));_0x38a0c8(_0x244400['result'][_0x6d8f('0x16')]);}})[_0x6d8f('0x17')](function(_0x222228){logger['error'](_0x6d8f('0x10'),_0x5b4785,_0x222228);_0x23dc5e(_0x222228);});});}exports[_0x6d8f('0x18')]=function(_0x4930f0){var _0x305dd7=this;return new Promise(function(_0x37d3f5,_0x37765e){return db[_0x6d8f('0x19')]['findAll']({'raw':_0x4930f0[_0x6d8f('0x1a')]?_0x4930f0[_0x6d8f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4930f0[_0x6d8f('0x1a')]?_0x4930f0[_0x6d8f('0x1a')][_0x6d8f('0x1b')]||null:null,'attributes':_0x4930f0['options']?_0x4930f0[_0x6d8f('0x1a')][_0x6d8f('0x1c')]||null:null,'limit':_0x4930f0[_0x6d8f('0x1a')]?_0x4930f0[_0x6d8f('0x1a')][_0x6d8f('0x1d')]||null:null,'include':_0x4930f0['options']?_0x4930f0[_0x6d8f('0x1a')][_0x6d8f('0x1e')]?_[_0x6d8f('0x1f')](_0x4930f0[_0x6d8f('0x1a')][_0x6d8f('0x1e')],function(_0x32f9d4){return{'model':db[_0x32f9d4[_0x6d8f('0x20')]],'as':_0x32f9d4['as'],'attributes':_0x32f9d4[_0x6d8f('0x1c')],'include':_0x32f9d4[_0x6d8f('0x1e')]?_[_0x6d8f('0x1f')](_0x32f9d4[_0x6d8f('0x1e')],function(_0x465e1e){return{'model':db[_0x465e1e[_0x6d8f('0x20')]],'as':_0x465e1e['as'],'attributes':_0x465e1e[_0x6d8f('0x1c')],'include':_0x465e1e['include']?_[_0x6d8f('0x1f')](_0x465e1e[_0x6d8f('0x1e')],function(_0x5b5b0a){return{'model':db[_0x5b5b0a['model']],'as':_0x5b5b0a['as'],'attributes':_0x5b5b0a[_0x6d8f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6d8f('0xe')](function(_0x5d62ef){logger[_0x6d8f('0xf')](_0x6d8f('0x18'),_0x4930f0);logger[_0x6d8f('0x12')](_0x6d8f('0x18'),_0x4930f0,JSON[_0x6d8f('0x21')](_0x5d62ef));_0x37d3f5(_0x5d62ef);})[_0x6d8f('0x17')](function(_0x50d11d){logger[_0x6d8f('0x14')](_0x6d8f('0x18'),_0x50d11d['message'],_0x4930f0);_0x37765e(_0x305dd7['error'](0x1f4,_0x50d11d[_0x6d8f('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x2b0fd9){var _0x14c89b=this;return new Promise(function(_0x5f05e6,_0x45dc7b){return db[_0x6d8f('0x19')][_0x6d8f('0x22')]({'raw':_0x2b0fd9[_0x6d8f('0x1a')]?_0x2b0fd9[_0x6d8f('0x1a')][_0x6d8f('0x23')]===undefined?!![]:![]:!![],'where':_0x2b0fd9[_0x6d8f('0x1a')]?_0x2b0fd9[_0x6d8f('0x1a')][_0x6d8f('0x1b')]||null:null,'attributes':_0x2b0fd9[_0x6d8f('0x1a')]?_0x2b0fd9['options'][_0x6d8f('0x1c')]||null:null,'include':_0x2b0fd9[_0x6d8f('0x1a')]?_0x2b0fd9['options'][_0x6d8f('0x1e')]?_[_0x6d8f('0x1f')](_0x2b0fd9[_0x6d8f('0x1a')][_0x6d8f('0x1e')],function(_0x2b2aea){return{'model':db[_0x2b2aea[_0x6d8f('0x20')]],'as':_0x2b2aea['as'],'attributes':_0x2b2aea[_0x6d8f('0x1c')],'include':_0x2b2aea[_0x6d8f('0x1e')]?_[_0x6d8f('0x1f')](_0x2b2aea[_0x6d8f('0x1e')],function(_0x28329c){return{'model':db[_0x28329c['model']],'as':_0x28329c['as'],'attributes':_0x28329c[_0x6d8f('0x1c')],'include':_0x28329c[_0x6d8f('0x1e')]?_['map'](_0x28329c[_0x6d8f('0x1e')],function(_0xb69219){return{'model':db[_0xb69219[_0x6d8f('0x20')]],'as':_0xb69219['as'],'attributes':_0xb69219[_0x6d8f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6d8f('0xe')](function(_0x522e87){logger['info']('ShowVoiceQueue',_0x2b0fd9);logger['debug'](_0x6d8f('0x24'),_0x2b0fd9,JSON[_0x6d8f('0x21')](_0x522e87));_0x5f05e6(_0x522e87);})[_0x6d8f('0x17')](function(_0x2cced7){logger['error']('ShowVoiceQueue',_0x2cced7[_0x6d8f('0x16')],_0x2b0fd9);_0x45dc7b(_0x14c89b['error'](0x1f4,_0x2cced7[_0x6d8f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 86e4c97..72a61bf 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 _0x7c47=['removeListener','voiceQueue:','./voiceQueue.events','remove','update','emit'];(function(_0x564aee,_0x242538){var _0x1004d8=function(_0x2bc910){while(--_0x2bc910){_0x564aee['push'](_0x564aee['shift']());}};_0x1004d8(++_0x242538);}(_0x7c47,0x1b8));var _0x77c4=function(_0xd91e67,_0x3e9e03){_0xd91e67=_0xd91e67-0x0;var _0x2397db=_0x7c47[_0xd91e67];return _0x2397db;};'use strict';var VoiceQueueEvents=require(_0x77c4('0x0'));var events=['save',_0x77c4('0x1'),_0x77c4('0x2')];function createListener(_0x2fd40f,_0x1fe002){return function(_0x676edf){_0x1fe002[_0x77c4('0x3')](_0x2fd40f,_0x676edf);};}function removeListener(_0x1b6f5d,_0x4eb03f){return function(){VoiceQueueEvents[_0x77c4('0x4')](_0x1b6f5d,_0x4eb03f);};}exports['register']=function(_0x58f8e6){for(var _0x204030=0x0,_0x440887=events['length'];_0x204030<_0x440887;_0x204030++){var _0x2ca0f9=events[_0x204030];var _0x3ce6b1=createListener(_0x77c4('0x5')+_0x2ca0f9,_0x58f8e6);VoiceQueueEvents['on'](_0x2ca0f9,_0x3ce6b1);}}; \ No newline at end of file +var _0x2deb=['remove','update','removeListener','register','length','./voiceQueue.events'];(function(_0x3a1718,_0x45d6f6){var _0x4d9789=function(_0x1bb123){while(--_0x1bb123){_0x3a1718['push'](_0x3a1718['shift']());}};_0x4d9789(++_0x45d6f6);}(_0x2deb,0xef));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var VoiceQueueEvents=require(_0xb2de('0x0'));var events=['save',_0xb2de('0x1'),_0xb2de('0x2')];function createListener(_0x1aa2fe,_0x4576e9){return function(_0x1c257f){_0x4576e9['emit'](_0x1aa2fe,_0x1c257f);};}function removeListener(_0x4388f2,_0x53f9f8){return function(){VoiceQueueEvents[_0xb2de('0x3')](_0x4388f2,_0x53f9f8);};}exports[_0xb2de('0x4')]=function(_0x4847d9){for(var _0x325653=0x0,_0x55a85e=events[_0xb2de('0x5')];_0x325653<_0x55a85e;_0x325653++){var _0x3cf403=events[_0x325653];var _0x2d704a=createListener('voiceQueue:'+_0x3cf403,_0x4847d9);VoiceQueueEvents['on'](_0x3cf403,_0x2d704a);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index b2d3994..6866e9a 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 _0xf494=['./voiceQueueReport.controller','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','/:id','show','create','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14c41b,_0x34ee9e){var _0xa3f91c=function(_0x1dda68){while(--_0x1dda68){_0x14c41b['push'](_0x14c41b['shift']());}};_0xa3f91c(++_0x34ee9e);}(_0xf494,0x1c6));var _0x4f49=function(_0x42e94d,_0x2355e5){_0x42e94d=_0x42e94d-0x0;var _0x5b18c5=_0xf494[_0x42e94d];return _0x5b18c5;};'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')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x4f49('0x9')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0x9')](_0x4f49('0xf'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router['post']('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x4f49('0x12')](_0x4f49('0xf'),auth['isAuthenticated'](),controller[_0x4f49('0x13')]);module[_0x4f49('0x14')]=router; \ No newline at end of file +var _0xf2e3=['describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x42fee0,_0x49a55d){var _0x2ebd12=function(_0x44bee6){while(--_0x44bee6){_0x42fee0['push'](_0x42fee0['shift']());}};_0x2ebd12(++_0x49a55d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf2e3[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var auth=require(_0x3f2e('0x5'));var interaction=require(_0x3f2e('0x6'));var config=require(_0x3f2e('0x7'));var controller=require(_0x3f2e('0x8'));router[_0x3f2e('0x9')]('/',auth['isAuthenticated'](),controller[_0x3f2e('0xa')]);router[_0x3f2e('0x9')](_0x3f2e('0xb'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0xd')]);router[_0x3f2e('0x9')](_0x3f2e('0xe'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0xf')]);router[_0x3f2e('0x9')](_0x3f2e('0x10'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x11')]);router[_0x3f2e('0x12')]('/',auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x13')]);router[_0x3f2e('0x14')](_0x3f2e('0x10'),auth[_0x3f2e('0xc')](),controller['update']);router[_0x3f2e('0x15')](_0x3f2e('0x10'),auth['isAuthenticated'](),controller[_0x3f2e('0x16')]);module[_0x3f2e('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 9db4f86..c743af1 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 _0x6e2a=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue'];(function(_0x77fbf8,_0x31cf3f){var _0x2df250=function(_0x24b65f){while(--_0x24b65f){_0x77fbf8['push'](_0x77fbf8['shift']());}};_0x2df250(++_0x31cf3f);}(_0x6e2a,0xfa));var _0xa6e2=function(_0x387f01,_0x59628a){_0x387f01=_0x387f01-0x0;var _0x4214e5=_0x6e2a[_0x387f01];return _0x4214e5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa6e2('0x0'));module[_0xa6e2('0x1')]={'type':{'type':Sequelize[_0xa6e2('0x2')]},'uniqueid':{'type':Sequelize[_0xa6e2('0x2')]},'calleridnum':{'type':Sequelize[_0xa6e2('0x2')]},'calleridname':{'type':Sequelize[_0xa6e2('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xa6e2('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xa6e2('0x3')],'set':function(_0x499c45){var _0x5ee36f=moment(_0x499c45);var _0x5a2e57=moment(this[_0xa6e2('0x4')]('queuecallerjoinAt'))[_0xa6e2('0x5')](_0xa6e2('0x6'));var _0x4fda21=_0x5ee36f[_0xa6e2('0x7')](_0x5a2e57,_0xa6e2('0x8'));this['setDataValue'](_0xa6e2('0x9'),_0x499c45);this['setDataValue'](_0xa6e2('0xa'),_0x4fda21||null);}},'position':{'type':Sequelize[_0xa6e2('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xa6e2('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa6e2('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xa6e2('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xa6e2('0x3')]},'queuecallerexit':{'type':Sequelize[_0xa6e2('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa6e2('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xa6e2('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xa6e2('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa6e2('0x2')]},'connectedlinename':{'type':Sequelize[_0xa6e2('0x2')]},'accountcode':{'type':Sequelize[_0xa6e2('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa6e2('0x2')]},'priority':{'type':Sequelize[_0xa6e2('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xa6e2('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa6e2('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa6e2('0x2')]},'transfer':{'type':Sequelize[_0xa6e2('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa6e2('0x2')],'comment':_0xa6e2('0xe')},'transferexten':{'type':Sequelize[_0xa6e2('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa6e2('0x2')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xa6e2('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa212=['DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xa212,0xec));var _0x2a21=function(_0x10bdb3,_0x245233){_0x10bdb3=_0x10bdb3-0x0;var _0x39a57b=_0xa212[_0x10bdb3];return _0x39a57b;};'use strict';var Sequelize=require(_0x2a21('0x0'));var moment=require(_0x2a21('0x1'));module[_0x2a21('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2a21('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x2a21('0x4')],'set':function(_0x671038){var _0x67e8ac=moment(_0x671038);var _0x322f16=moment(this[_0x2a21('0x5')]('queuecallerjoinAt'))[_0x2a21('0x6')](_0x2a21('0x7'));var _0x519ee3=_0x67e8ac['diff'](_0x322f16,_0x2a21('0x8'));this[_0x2a21('0x9')](_0x2a21('0xa'),_0x671038);this['setDataValue'](_0x2a21('0xb'),_0x519ee3||null);}},'position':{'type':Sequelize[_0x2a21('0xc')]},'count':{'type':Sequelize[_0x2a21('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x2a21('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2a21('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2a21('0x4')]},'queuecallerexit':{'type':Sequelize[_0x2a21('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2a21('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x2a21('0x3')],'comment':_0x2a21('0xe')},'originalposition':{'type':Sequelize[_0x2a21('0xc')]},'channel':{'type':Sequelize[_0x2a21('0x3')]},'connectedlinenum':{'type':Sequelize[_0x2a21('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2a21('0x3')]},'context':{'type':Sequelize[_0x2a21('0x3')]},'exten':{'type':Sequelize[_0x2a21('0x3')]},'priority':{'type':Sequelize[_0x2a21('0x3')]},'holdtime':{'type':Sequelize[_0x2a21('0xc')]},'mohtime':{'type':Sequelize[_0x2a21('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2a21('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2a21('0x3')]},'transfer':{'type':Sequelize[_0x2a21('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2a21('0x3')],'comment':_0x2a21('0xf')},'transferexten':{'type':Sequelize[_0x2a21('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x2a21('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x2a21('0xc')],'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 eb7b540..76d83d4 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file +var _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x7a54,0x106));var _0x47a5=function(_0x19375f,_0x25dde9){_0x19375f=_0x19375f-0x0;var _0x5c24f7=_0x7a54[_0x19375f];return _0x5c24f7;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6f3519b..4902501 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 _0x53ca=['exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x53ca,0x15f));var _0xa53c=function(_0x171bbd,_0x5e202c){_0x171bbd=_0x171bbd-0x0;var _0x40f393=_0x53ca[_0x171bbd];return _0x40f393;};'use strict';var EventEmitter=require(_0xa53c('0x0'));var VoiceQueueReport=require(_0xa53c('0x1'))['db'][_0xa53c('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xa53c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa53c('0x4'),'afterDestroy':_0xa53c('0x5')};function emitEvent(_0x4e7232){return function(_0x575f9d,_0x3dc44e,_0x1e0018){VoiceQueueReportEvents[_0xa53c('0x6')](_0x4e7232+':'+_0x575f9d['id'],_0x575f9d);VoiceQueueReportEvents[_0xa53c('0x6')](_0x4e7232,_0x575f9d);_0x1e0018(null);};}for(var e in events){if(events[_0xa53c('0x7')](e)){var event=events[e];VoiceQueueReport[_0xa53c('0x8')](e,emitEvent(event));}}module[_0xa53c('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x3579=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x5c0023,_0x5447d7){var _0x47fadf=function(_0x2507e5){while(--_0x2507e5){_0x5c0023['push'](_0x5c0023['shift']());}};_0x47fadf(++_0x5447d7);}(_0x3579,0x90));var _0x9357=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x3579[_0x122096];return _0x3d1966;};'use strict';var EventEmitter=require(_0x9357('0x0'));var VoiceQueueReport=require(_0x9357('0x1'))['db'][_0x9357('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x9357('0x3')](0x0);var events={'afterCreate':_0x9357('0x4'),'afterUpdate':_0x9357('0x5'),'afterDestroy':'remove'};function emitEvent(_0x43b8d6){return function(_0x3ffd0e,_0x19c40f,_0x1f8cd5){VoiceQueueReportEvents[_0x9357('0x6')](_0x43b8d6+':'+_0x3ffd0e['id'],_0x3ffd0e);VoiceQueueReportEvents['emit'](_0x43b8d6,_0x3ffd0e);_0x1f8cd5(null);};}for(var e in events){if(events[_0x9357('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x9357('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 f83ead9..41720dc 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 _0x889e=['api','path','rimraf','VoiceQueueReport','report_queue','uniqueid','calleridnum','util'];(function(_0x4af26f,_0x4d65aa){var _0x39ccd4=function(_0x32e550){while(--_0x32e550){_0x4af26f['push'](_0x4af26f['shift']());}};_0x39ccd4(++_0x4d65aa);}(_0x889e,0xe7));var _0xe889=function(_0x4c7df6,_0x12ccbc){_0x4c7df6=_0x4c7df6-0x0;var _0x2ec1d6=_0x889e[_0x4c7df6];return _0x2ec1d6;};'use strict';var _=require('lodash');var util=require(_0xe889('0x0'));var logger=require('../../config/logger')(_0xe889('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe889('0x2'));var rimraf=require(_0xe889('0x3'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x34d365,_0x57505d){return _0x34d365['define'](_0xe889('0x4'),attributes,{'tableName':_0xe889('0x5'),'paranoid':![],'indexes':[{'fields':[_0xe889('0x6')]},{'fields':[_0xe889('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x836b=['api','moment','bluebird','request-promise','rimraf','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','../../config/logger'];(function(_0x2440fe,_0x281a11){var _0x5cf734=function(_0x38e12b){while(--_0x38e12b){_0x2440fe['push'](_0x2440fe['shift']());}};_0x5cf734(++_0x281a11);}(_0x836b,0xdb));var _0xb836=function(_0x1f4d45,_0x6e1e25){_0x1f4d45=_0x1f4d45-0x0;var _0x5e3bf5=_0x836b[_0x1f4d45];return _0x5e3bf5;};'use strict';var _=require(_0xb836('0x0'));var util=require('util');var logger=require(_0xb836('0x1'))(_0xb836('0x2'));var moment=require(_0xb836('0x3'));var BPromise=require(_0xb836('0x4'));var rp=require(_0xb836('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb836('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xb836('0x7')]=function(_0xd19e7e,_0x5658d4){return _0xd19e7e[_0xb836('0x8')](_0xb836('0x9'),attributes,{'tableName':_0xb836('0xa'),'paranoid':![],'indexes':[{'fields':[_0xb836('0xb')]},{'fields':[_0xb836('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index ae071b2..f71030d 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 _0x2f96=['create','UpdateVoiceQueueReport','body','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','then','CreateVoiceQueueReport','VoiceQueueReport'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0x2f96,0x1dc));var _0x62f9=function(_0x5e2d28,_0x17ee5e){_0x5e2d28=_0x5e2d28-0x0;var _0x5e20aa=_0x2f96[_0x5e2d28];return _0x5e20aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x62f9('0x0'));var BPromise=require(_0x62f9('0x1'));var rs=require(_0x62f9('0x2'));var fs=require('fs');var Redis=require(_0x62f9('0x3'));var db=require(_0x62f9('0x4'))['db'];var utils=require(_0x62f9('0x5'));var logger=require(_0x62f9('0x6'))(_0x62f9('0x7'));var config=require(_0x62f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x62f9('0x9')]['http']({'port':0x232a});config[_0x62f9('0xa')]=_[_0x62f9('0xb')](config[_0x62f9('0xa')],{'host':_0x62f9('0xc'),'port':0x18eb});var socket=require(_0x62f9('0xd'))(new Redis(config[_0x62f9('0xa')]));require(_0x62f9('0xe'))[_0x62f9('0xf')](socket);function respondWithRpcPromise(_0xe7bcbe,_0x37dbec,_0x15d0bd){return new BPromise(function(_0x46e2dc,_0xa9b3f){return client[_0x62f9('0x10')](_0xe7bcbe,_0x15d0bd)['then'](function(_0x2c8280){logger[_0x62f9('0x11')](_0x62f9('0x12'),_0x37dbec,'request\x20sent');logger[_0x62f9('0x13')](_0x62f9('0x14'),_0x37dbec,'request\x20sent',JSON[_0x62f9('0x15')](_0x2c8280));if(_0x2c8280[_0x62f9('0x16')]){if(_0x2c8280[_0x62f9('0x16')]['code']===0x1f4){logger[_0x62f9('0x16')](_0x62f9('0x12'),_0x37dbec,_0x2c8280[_0x62f9('0x16')][_0x62f9('0x17')]);return _0xa9b3f(_0x2c8280['error'][_0x62f9('0x17')]);}logger[_0x62f9('0x16')](_0x62f9('0x12'),_0x37dbec,_0x2c8280[_0x62f9('0x16')][_0x62f9('0x17')]);return _0x46e2dc(_0x2c8280[_0x62f9('0x16')][_0x62f9('0x17')]);}else{logger[_0x62f9('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x37dbec,_0x62f9('0x18'));_0x46e2dc(_0x2c8280[_0x62f9('0x19')][_0x62f9('0x17')]);}})[_0x62f9('0x1a')](function(_0x2a90bb){logger[_0x62f9('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x37dbec,_0x2a90bb);_0xa9b3f(_0x2a90bb);});});}exports[_0x62f9('0x1b')]=function(_0x5f517b){var _0x2bb6c6=this;return new Promise(function(_0x4ed798,_0x14f12b){return db['VoiceQueueReport'][_0x62f9('0x1c')]({'raw':_0x5f517b[_0x62f9('0x1d')]?_0x5f517b[_0x62f9('0x1d')][_0x62f9('0x1e')]===undefined?!![]:![]:!![],'where':_0x5f517b[_0x62f9('0x1d')]?_0x5f517b[_0x62f9('0x1d')][_0x62f9('0x1f')]||null:null,'attributes':_0x5f517b[_0x62f9('0x1d')]?_0x5f517b[_0x62f9('0x1d')][_0x62f9('0x20')]||null:null,'limit':_0x5f517b[_0x62f9('0x1d')]?_0x5f517b[_0x62f9('0x1d')][_0x62f9('0x21')]||null:null,'include':_0x5f517b['options']?_0x5f517b['options'][_0x62f9('0x22')]?_['map'](_0x5f517b['options'][_0x62f9('0x22')],function(_0x9b3188){return{'model':db[_0x9b3188[_0x62f9('0x23')]],'as':_0x9b3188['as'],'attributes':_0x9b3188[_0x62f9('0x20')],'include':_0x9b3188[_0x62f9('0x22')]?_[_0x62f9('0x24')](_0x9b3188[_0x62f9('0x22')],function(_0x376274){return{'model':db[_0x376274[_0x62f9('0x23')]],'as':_0x376274['as'],'attributes':_0x376274[_0x62f9('0x20')],'include':_0x376274[_0x62f9('0x22')]?_[_0x62f9('0x24')](_0x376274[_0x62f9('0x22')],function(_0x1aa9cd){return{'model':db[_0x1aa9cd[_0x62f9('0x23')]],'as':_0x1aa9cd['as'],'attributes':_0x1aa9cd[_0x62f9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x62f9('0x25')](function(_0x1dfa05){logger[_0x62f9('0x11')](_0x62f9('0x1b'),_0x5f517b);logger[_0x62f9('0x13')]('GetVoiceQueueReport',_0x5f517b,JSON['stringify'](_0x1dfa05));_0x4ed798(_0x1dfa05);})[_0x62f9('0x1a')](function(_0x49c6cb){logger[_0x62f9('0x16')](_0x62f9('0x1b'),_0x49c6cb['message'],_0x5f517b);_0x14f12b(_0x2bb6c6[_0x62f9('0x16')](0x1f4,_0x49c6cb['message']));});});};exports[_0x62f9('0x26')]=function(_0xf91bc5){var _0x202141=this;return new Promise(function(_0x286803,_0x19ace2){return db[_0x62f9('0x27')][_0x62f9('0x28')](_0xf91bc5['body'],{'raw':_0xf91bc5[_0x62f9('0x1d')]?_0xf91bc5[_0x62f9('0x1d')][_0x62f9('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4be5c8){logger[_0x62f9('0x11')](_0x62f9('0x26'),_0xf91bc5);logger[_0x62f9('0x13')](_0x62f9('0x26'),_0xf91bc5,JSON[_0x62f9('0x15')](_0x4be5c8));_0x286803(_0x4be5c8);})[_0x62f9('0x1a')](function(_0x12af2e){logger[_0x62f9('0x16')](_0x62f9('0x26'),_0x12af2e[_0x62f9('0x17')],_0xf91bc5);_0x19ace2(_0x202141[_0x62f9('0x16')](0x1f4,_0x12af2e['message']));});});};exports[_0x62f9('0x29')]=function(_0x51d804){var _0x4dfd29=this;return new Promise(function(_0x5823d1,_0x41cdae){return db[_0x62f9('0x27')]['update'](_0x51d804[_0x62f9('0x2a')],{'raw':_0x51d804[_0x62f9('0x1d')]?_0x51d804['options'][_0x62f9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51d804[_0x62f9('0x1d')]?_0x51d804[_0x62f9('0x1d')][_0x62f9('0x1f')]||null:null,'attributes':_0x51d804[_0x62f9('0x1d')]?_0x51d804['options'][_0x62f9('0x20')]||null:null,'limit':_0x51d804['options']?_0x51d804[_0x62f9('0x1d')][_0x62f9('0x21')]||null:null})[_0x62f9('0x25')](function(_0x2764f0){logger[_0x62f9('0x11')]('UpdateVoiceQueueReport',_0x51d804);logger['debug'](_0x62f9('0x29'),_0x51d804,JSON[_0x62f9('0x15')](_0x2764f0));_0x5823d1(_0x2764f0);})['catch'](function(_0x2c622b){logger[_0x62f9('0x16')](_0x62f9('0x29'),_0x2c622b[_0x62f9('0x17')],_0x51d804);_0x41cdae(_0x4dfd29[_0x62f9('0x16')](0x1f4,_0x2c622b[_0x62f9('0x17')]));});});}; \ No newline at end of file +var _0x3077=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','model','map','then','CreateVoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3077,0xc6));var _0x7307=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x3077[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x7307('0x0'));var util=require(_0x7307('0x1'));var moment=require(_0x7307('0x2'));var BPromise=require(_0x7307('0x3'));var rs=require(_0x7307('0x4'));var fs=require('fs');var Redis=require(_0x7307('0x5'));var db=require(_0x7307('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7307('0x7'));var config=require(_0x7307('0x8'));var jayson=require(_0x7307('0x9'));var client=jayson[_0x7307('0xa')][_0x7307('0xb')]({'port':0x232a});config['redis']=_[_0x7307('0xc')](config[_0x7307('0xd')],{'host':_0x7307('0xe'),'port':0x18eb});var socket=require(_0x7307('0xf'))(new Redis(config[_0x7307('0xd')]));require(_0x7307('0x10'))['register'](socket);function respondWithRpcPromise(_0x40227f,_0x276ff4,_0x3690b9){return new BPromise(function(_0xe67d5e,_0x5a7f43){return client[_0x7307('0x11')](_0x40227f,_0x3690b9)['then'](function(_0x549585){logger[_0x7307('0x12')](_0x7307('0x13'),_0x276ff4,_0x7307('0x14'));logger[_0x7307('0x15')](_0x7307('0x16'),_0x276ff4,'request\x20sent',JSON['stringify'](_0x549585));if(_0x549585[_0x7307('0x17')]){if(_0x549585[_0x7307('0x17')][_0x7307('0x18')]===0x1f4){logger[_0x7307('0x17')](_0x7307('0x13'),_0x276ff4,_0x549585['error'][_0x7307('0x19')]);return _0x5a7f43(_0x549585['error']['message']);}logger['error'](_0x7307('0x13'),_0x276ff4,_0x549585[_0x7307('0x17')][_0x7307('0x19')]);return _0xe67d5e(_0x549585[_0x7307('0x17')][_0x7307('0x19')]);}else{logger['info'](_0x7307('0x13'),_0x276ff4,_0x7307('0x14'));_0xe67d5e(_0x549585['result'][_0x7307('0x19')]);}})[_0x7307('0x1a')](function(_0x12236d){logger[_0x7307('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x276ff4,_0x12236d);_0x5a7f43(_0x12236d);});});}exports[_0x7307('0x1b')]=function(_0x2ddf9e){var _0x3c09ef=this;return new Promise(function(_0x4f59a5,_0x5045e3){return db[_0x7307('0x1c')][_0x7307('0x1d')]({'raw':_0x2ddf9e[_0x7307('0x1e')]?_0x2ddf9e[_0x7307('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2ddf9e[_0x7307('0x1e')]?_0x2ddf9e['options'][_0x7307('0x1f')]||null:null,'attributes':_0x2ddf9e['options']?_0x2ddf9e[_0x7307('0x1e')][_0x7307('0x20')]||null:null,'limit':_0x2ddf9e[_0x7307('0x1e')]?_0x2ddf9e['options'][_0x7307('0x21')]||null:null,'include':_0x2ddf9e['options']?_0x2ddf9e[_0x7307('0x1e')][_0x7307('0x22')]?_['map'](_0x2ddf9e[_0x7307('0x1e')][_0x7307('0x22')],function(_0x2f53aa){return{'model':db[_0x2f53aa[_0x7307('0x23')]],'as':_0x2f53aa['as'],'attributes':_0x2f53aa[_0x7307('0x20')],'include':_0x2f53aa[_0x7307('0x22')]?_[_0x7307('0x24')](_0x2f53aa[_0x7307('0x22')],function(_0x4e2b27){return{'model':db[_0x4e2b27[_0x7307('0x23')]],'as':_0x4e2b27['as'],'attributes':_0x4e2b27['attributes'],'include':_0x4e2b27['include']?_[_0x7307('0x24')](_0x4e2b27['include'],function(_0x4a671b){return{'model':db[_0x4a671b[_0x7307('0x23')]],'as':_0x4a671b['as'],'attributes':_0x4a671b[_0x7307('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7307('0x25')](function(_0x512d26){logger[_0x7307('0x12')](_0x7307('0x1b'),_0x2ddf9e);logger[_0x7307('0x15')](_0x7307('0x1b'),_0x2ddf9e,JSON['stringify'](_0x512d26));_0x4f59a5(_0x512d26);})['catch'](function(_0x42a0f6){logger[_0x7307('0x17')](_0x7307('0x1b'),_0x42a0f6[_0x7307('0x19')],_0x2ddf9e);_0x5045e3(_0x3c09ef[_0x7307('0x17')](0x1f4,_0x42a0f6[_0x7307('0x19')]));});});};exports[_0x7307('0x26')]=function(_0x5a956b){var _0x1043b0=this;return new Promise(function(_0x4d801e,_0x1eea8e){return db[_0x7307('0x1c')][_0x7307('0x27')](_0x5a956b[_0x7307('0x28')],{'raw':_0x5a956b[_0x7307('0x1e')]?_0x5a956b[_0x7307('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x7307('0x25')](function(_0x33e3e9){logger[_0x7307('0x12')](_0x7307('0x26'),_0x5a956b);logger[_0x7307('0x15')]('CreateVoiceQueueReport',_0x5a956b,JSON[_0x7307('0x29')](_0x33e3e9));_0x4d801e(_0x33e3e9);})[_0x7307('0x1a')](function(_0x5b4c00){logger[_0x7307('0x17')](_0x7307('0x26'),_0x5b4c00[_0x7307('0x19')],_0x5a956b);_0x1eea8e(_0x1043b0[_0x7307('0x17')](0x1f4,_0x5b4c00[_0x7307('0x19')]));});});};exports[_0x7307('0x2a')]=function(_0x3dd6b0){var _0x185e1c=this;return new Promise(function(_0x1e4ba2,_0x46ac2d){return db[_0x7307('0x1c')][_0x7307('0x2b')](_0x3dd6b0[_0x7307('0x28')],{'raw':_0x3dd6b0[_0x7307('0x1e')]?_0x3dd6b0[_0x7307('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dd6b0['options']?_0x3dd6b0[_0x7307('0x1e')][_0x7307('0x1f')]||null:null,'attributes':_0x3dd6b0[_0x7307('0x1e')]?_0x3dd6b0[_0x7307('0x1e')]['attributes']||null:null,'limit':_0x3dd6b0[_0x7307('0x1e')]?_0x3dd6b0[_0x7307('0x1e')][_0x7307('0x21')]||null:null})['then'](function(_0xdc3e3a){logger['info'](_0x7307('0x2a'),_0x3dd6b0);logger[_0x7307('0x15')](_0x7307('0x2a'),_0x3dd6b0,JSON[_0x7307('0x29')](_0xdc3e3a));_0x1e4ba2(_0xdc3e3a);})[_0x7307('0x1a')](function(_0x274c1e){logger['error'](_0x7307('0x2a'),_0x274c1e[_0x7307('0x19')],_0x3dd6b0);_0x46ac2d(_0x185e1c[_0x7307('0x17')](0x1f4,_0x274c1e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 67ab58b..54a52e3 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 _0xff49=['update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xff49,0xba));var _0x9ff4=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xff49[_0x1da527];return _0x40fc7c;};'use strict';var VoiceQueueReportEvents=require(_0x9ff4('0x0'));var events=[_0x9ff4('0x1'),_0x9ff4('0x2'),_0x9ff4('0x3')];function createListener(_0x71ce47,_0x47ea38){return function(_0x3ad3fd){_0x47ea38[_0x9ff4('0x4')](_0x71ce47,_0x3ad3fd);};}function removeListener(_0x5a158a,_0x2c463d){return function(){VoiceQueueReportEvents[_0x9ff4('0x5')](_0x5a158a,_0x2c463d);};}exports[_0x9ff4('0x6')]=function(_0x57273c){for(var _0x8ce1c6=0x0,_0x2f9362=events[_0x9ff4('0x7')];_0x8ce1c6<_0x2f9362;_0x8ce1c6++){var _0x6e7bd5=events[_0x8ce1c6];var _0x4a506e=createListener(_0x9ff4('0x8')+_0x6e7bd5,_0x57273c);VoiceQueueReportEvents['on'](_0x6e7bd5,_0x4a506e);}}; \ No newline at end of file +var _0xdeb2=['save','remove','update','emit','removeListener','register','./voiceQueueReport.events'];(function(_0x23197e,_0x4e1aae){var _0x23fbb5=function(_0x35dd6e){while(--_0x35dd6e){_0x23197e['push'](_0x23197e['shift']());}};_0x23fbb5(++_0x4e1aae);}(_0xdeb2,0xca));var _0x2deb=function(_0xcc3979,_0x343b85){_0xcc3979=_0xcc3979-0x0;var _0x25dccd=_0xdeb2[_0xcc3979];return _0x25dccd;};'use strict';var VoiceQueueReportEvents=require(_0x2deb('0x0'));var events=[_0x2deb('0x1'),_0x2deb('0x2'),_0x2deb('0x3')];function createListener(_0x2effeb,_0x314fc2){return function(_0x5cc437){_0x314fc2[_0x2deb('0x4')](_0x2effeb,_0x5cc437);};}function removeListener(_0x57d0f7,_0x4045f3){return function(){VoiceQueueReportEvents[_0x2deb('0x5')](_0x57d0f7,_0x4045f3);};}exports[_0x2deb('0x6')]=function(_0x5363ae){for(var _0x2d2c50=0x0,_0x1340f9=events['length'];_0x2d2c50<_0x1340f9;_0x2d2c50++){var _0x13c396=events[_0x2d2c50];var _0x3cf2b5=createListener('voiceQueueReport:'+_0x13c396,_0x5363ae);VoiceQueueReportEvents['on'](_0x13c396,_0x3cf2b5);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 2916818..51aa19d 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 _0xf794=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','put','exports'];(function(_0x509f50,_0x17d3f1){var _0x2cc56a=function(_0x161a9e){while(--_0x161a9e){_0x509f50['push'](_0x509f50['shift']());}};_0x2cc56a(++_0x17d3f1);}(_0xf794,0x150));var _0x4f79=function(_0x169f9f,_0x305b64){_0x169f9f=_0x169f9f-0x0;var _0x5b28a6=_0xf794[_0x169f9f];return _0x5b28a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4f79('0x0'));var timeout=require(_0x4f79('0x1'));var express=require(_0x4f79('0x2'));var router=express['Router']();var auth=require(_0x4f79('0x3'));var interaction=require(_0x4f79('0x4'));var config=require(_0x4f79('0x5'));var controller=require(_0x4f79('0x6'));router[_0x4f79('0x7')]('/',auth[_0x4f79('0x8')](),controller['index']);router[_0x4f79('0x7')](_0x4f79('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x4f79('0x8')](),controller['create']);router[_0x4f79('0xa')](_0x4f79('0x9'),auth[_0x4f79('0x8')](),controller['update']);router['delete'](_0x4f79('0x9'),auth[_0x4f79('0x8')](),controller['destroy']);module[_0x4f79('0xb')]=router; \ No newline at end of file +var _0x69ec=['isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x48c957,_0x45143a){var _0x4ed80c=function(_0x136f83){while(--_0x136f83){_0x48c957['push'](_0x48c957['shift']());}};_0x4ed80c(++_0x45143a);}(_0x69ec,0x14c));var _0xc69e=function(_0x241c5d,_0x4f087e){_0x241c5d=_0x241c5d-0x0;var _0x41cd50=_0x69ec[_0x241c5d];return _0x41cd50;};'use strict';var multer=require(_0xc69e('0x0'));var util=require(_0xc69e('0x1'));var path=require(_0xc69e('0x2'));var timeout=require(_0xc69e('0x3'));var express=require(_0xc69e('0x4'));var router=express[_0xc69e('0x5')]();var auth=require(_0xc69e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc69e('0x7'));var controller=require(_0xc69e('0x8'));router[_0xc69e('0x9')]('/',auth[_0xc69e('0xa')](),controller['index']);router[_0xc69e('0x9')](_0xc69e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc69e('0xc')]('/',auth[_0xc69e('0xa')](),controller[_0xc69e('0xd')]);router[_0xc69e('0xe')]('/:id',auth[_0xc69e('0xa')](),controller[_0xc69e('0xf')]);router[_0xc69e('0x10')]('/:id',auth[_0xc69e('0xa')](),controller[_0xc69e('0x11')]);module[_0xc69e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 19c5f65..2a21f9f 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 _0x8099=['exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0xd35854,_0x50e8e2){var _0x69c515=function(_0x3e1c3d){while(--_0x3e1c3d){_0xd35854['push'](_0xd35854['shift']());}};_0x69c515(++_0x50e8e2);}(_0x8099,0xb3));var _0x9809=function(_0x5f9dcf,_0x5eefda){_0x5f9dcf=_0x5f9dcf-0x0;var _0x1f69f8=_0x8099[_0x5f9dcf];return _0x1f69f8;};'use strict';var Sequelize=require(_0x9809('0x0'));var moment=require('moment');module[_0x9809('0x1')]={'time':{'type':Sequelize[_0x9809('0x2')]},'callid':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x9809('0x3')](_0x9809('0x4'))}}; \ No newline at end of file +var _0x58d1=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0xf174bf,_0x1003c3){var _0xf5a82a=function(_0x300cc7){while(--_0x300cc7){_0xf174bf['push'](_0xf174bf['shift']());}};_0xf5a82a(++_0x1003c3);}(_0x58d1,0x8d));var _0x158d=function(_0x165360,_0x5ca20b){_0x165360=_0x165360-0x0;var _0x5acc59=_0x58d1[_0x165360];return _0x5acc59;};'use strict';var Sequelize=require(_0x158d('0x0'));var moment=require(_0x158d('0x1'));module[_0x158d('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x158d('0x4')],'allowNull':![],'defaultValue':moment()[_0x158d('0x5')](_0x158d('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2dd215f..1e19851 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x5e48fd,_0xb0671f){var _0x27d122=function(_0xd04492){while(--_0xd04492){_0x5e48fd['push'](_0x5e48fd['shift']());}};_0x27d122(++_0xb0671f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x12fcf7,_0x2fa120){var _0x398c34=function(_0x5cae2e){while(--_0x5cae2e){_0x12fcf7['push'](_0x12fcf7['shift']());}};_0x398c34(++_0x2fa120);}(_0xb10b,0x12a));var _0xbb10=function(_0x283ce1,_0x52f230){_0x283ce1=_0x283ce1-0x0;var _0xda31d8=_0xb10b[_0x283ce1];return _0xda31d8;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index fa5cee4..08e5326 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 _0xbff5=['request-promise','rimraf','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3c3b81,_0x49871a){var _0x242d23=function(_0x183729){while(--_0x183729){_0x3c3b81['push'](_0x3c3b81['shift']());}};_0x242d23(++_0x49871a);}(_0xbff5,0x1bc));var _0x5bff=function(_0x4588a7,_0x17af7c){_0x4588a7=_0x4588a7-0x0;var _0x8e89ba=_0xbff5[_0x4588a7];return _0x8e89ba;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var logger=require(_0x5bff('0x2'))(_0x5bff('0x3'));var moment=require(_0x5bff('0x4'));var BPromise=require(_0x5bff('0x5'));var rp=require(_0x5bff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bff('0x7'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x5bff('0x8')]=function(_0x1d8650,_0x151add){return _0x1d8650[_0x5bff('0x9')](_0x5bff('0xa'),attributes,{'tableName':_0x5bff('0xb'),'paranoid':![],'indexes':[{'name':_0x5bff('0xc'),'fields':[_0x5bff('0xd'),_0x5bff('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9fd4=['voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x4e11d9,_0x453c5c){var _0x2811f9=function(_0x420f0f){while(--_0x420f0f){_0x4e11d9['push'](_0x4e11d9['shift']());}};_0x2811f9(++_0x453c5c);}(_0x9fd4,0x16c));var _0x49fd=function(_0x48c19b,_0x3a1721){_0x48c19b=_0x48c19b-0x0;var _0x7b88f=_0x9fd4[_0x48c19b];return _0x7b88f;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[{'name':_0x49fd('0xc'),'fields':[_0x49fd('0xd'),_0x49fd('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0d0f018..260e4c5 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 _0xa45c=['code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2fc8ea,_0x2ec5a7){var _0x3b679e=function(_0x3613b7){while(--_0x3613b7){_0x2fc8ea['push'](_0x2fc8ea['shift']());}};_0x3b679e(++_0x2ec5a7);}(_0xa45c,0x6d));var _0xca45=function(_0x192140,_0x17cef2){_0x192140=_0x192140-0x0;var _0x505d67=_0xa45c[_0x192140];return _0x505d67;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca45('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca45('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xca45('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca45('0x5'));var client=jayson[_0xca45('0x6')][_0xca45('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15628b,_0x578a7b,_0x1a8b9c){return new BPromise(function(_0x276897,_0x7ceab1){return client[_0xca45('0x8')](_0x15628b,_0x1a8b9c)[_0xca45('0x9')](function(_0x5c18b9){logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));logger[_0xca45('0xd')](_0xca45('0xe'),_0x578a7b,_0xca45('0xc'),JSON[_0xca45('0xf')](_0x5c18b9));if(_0x5c18b9['error']){if(_0x5c18b9[_0xca45('0x10')][_0xca45('0x11')]===0x1f4){logger[_0xca45('0x10')](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x7ceab1(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}logger['error'](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x276897(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}else{logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));_0x276897(_0x5c18b9[_0xca45('0x13')]['message']);}})[_0xca45('0x14')](function(_0x5b4e29){logger['error'](_0xca45('0xb'),_0x578a7b,_0x5b4e29);_0x7ceab1(_0x5b4e29);});});} \ No newline at end of file +var _0x96cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x4a7b83,_0x16bf83){var _0x5cf2db=function(_0x41fea4){while(--_0x41fea4){_0x4a7b83['push'](_0x4a7b83['shift']());}};_0x5cf2db(++_0x16bf83);}(_0x96cc,0x16c));var _0xc96c=function(_0x4005e8,_0x52a3b5){_0x4005e8=_0x4005e8-0x0;var _0x2d2903=_0x96cc[_0x4005e8];return _0x2d2903;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index dd92fae..3789bc4 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x254be3,_0x3baf49){var _0x2f3361=function(_0x1d867c){while(--_0x1d867c){_0x254be3['push'](_0x254be3['shift']());}};_0x2f3361(++_0x3baf49);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x452fda,_0x2dd516){var _0xa173d6=function(_0x5b98da){while(--_0x5b98da){_0x452fda['push'](_0x452fda['shift']());}};_0xa173d6(++_0x2dd516);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 153c890..4da419b 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 _0x5246=['format','toString','DATE','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','path','exports','VIRTUAL','value','extname','getDataValue','STRING','channel','membername','split','TEXT','NEW','FLOAT','createdAt'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0x5246,0x195));var _0x6524=function(_0x5b34b2,_0xae69b0){_0x5b34b2=_0x5b34b2-0x0;var _0x2fe78b=_0x5246[_0x5b34b2];return _0x2fe78b;};'use strict';var Sequelize=require(_0x6524('0x0'));var moment=require('moment');var path=require(_0x6524('0x1'));module[_0x6524('0x2')]={'format':{'type':Sequelize[_0x6524('0x3')],'get':function(){return this['getDataValue'](_0x6524('0x4'))?path[_0x6524('0x5')](this[_0x6524('0x6')](_0x6524('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0x6524('0x7')]},'channel':{'type':Sequelize[_0x6524('0x7')],'set':function(_0x5ee797){if(_0x5ee797){this['setDataValue'](_0x6524('0x8'),_0x5ee797);this['setDataValue'](_0x6524('0x9'),_0x5ee797[_0x6524('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x6524('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6524('0x7')]},'connectedlinenum':{'type':Sequelize[_0x6524('0x7')]},'connectedlinename':{'type':Sequelize[_0x6524('0x7')]},'accountcode':{'type':Sequelize[_0x6524('0x7')]},'context':{'type':Sequelize[_0x6524('0x7')]},'exten':{'type':Sequelize[_0x6524('0x7')]},'value':{'type':Sequelize[_0x6524('0x7')]},'type':{'type':Sequelize[_0x6524('0x7')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x6524('0x7')]},'userDisposition':{'type':Sequelize[_0x6524('0x7')]},'location':{'type':Sequelize[_0x6524('0xb')]},'transcribeName':{'type':Sequelize[_0x6524('0x7')]},'transcribeStatus':{'type':Sequelize[_0x6524('0x7')],'defaultValue':_0x6524('0xc')},'fileUri':{'type':Sequelize[_0x6524('0xb')]},'fileText':{'type':Sequelize[_0x6524('0xb')]},'failureReason':{'type':Sequelize[_0x6524('0xb')]},'sentiment':{'type':Sequelize[_0x6524('0x7')]},'sPositive':{'type':Sequelize[_0x6524('0xd')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x6524('0xd')]},'sMixed':{'type':Sequelize[_0x6524('0xd')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6524('0x6')](_0x6524('0xe')))[_0x6524('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x6524('0x10')]();}},'updatedAt':{'type':Sequelize[_0x6524('0x11')],'get':function(){return moment(this[_0x6524('0x6')](_0x6524('0x12')))[_0x6524('0xf')](_0x6524('0x13'))[_0x6524('0x10')]();}}}; \ No newline at end of file +var _0x8a9a=['setDataValue','channel','split','TEXT','NEW','FLOAT','DATE','format','toString','MM-DD-YYYY\x20HH:mm','sequelize','path','exports','VIRTUAL','getDataValue','value','STRING'];(function(_0x18bf17,_0x32626e){var _0x7c4e02=function(_0x4afbbe){while(--_0x4afbbe){_0x18bf17['push'](_0x18bf17['shift']());}};_0x7c4e02(++_0x32626e);}(_0x8a9a,0xe7));var _0xa8a9=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x8a9a[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0xa8a9('0x0'));var moment=require('moment');var path=require(_0xa8a9('0x1'));module[_0xa8a9('0x2')]={'format':{'type':Sequelize[_0xa8a9('0x3')],'get':function(){return this[_0xa8a9('0x4')](_0xa8a9('0x5'))?path['extname'](this[_0xa8a9('0x4')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0xa8a9('0x6')]},'channel':{'type':Sequelize[_0xa8a9('0x6')],'set':function(_0x19d739){if(_0x19d739){this[_0xa8a9('0x7')](_0xa8a9('0x8'),_0x19d739);this[_0xa8a9('0x7')]('membername',_0x19d739[_0xa8a9('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa8a9('0x6')]},'calleridname':{'type':Sequelize[_0xa8a9('0x6')]},'connectedlinenum':{'type':Sequelize[_0xa8a9('0x6')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa8a9('0x6')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xa8a9('0x6')]},'type':{'type':Sequelize[_0xa8a9('0x6')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xa8a9('0x6')]},'userDisposition':{'type':Sequelize[_0xa8a9('0x6')]},'location':{'type':Sequelize[_0xa8a9('0xa')]},'transcribeName':{'type':Sequelize[_0xa8a9('0x6')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0xa8a9('0xb')},'fileUri':{'type':Sequelize[_0xa8a9('0xa')]},'fileText':{'type':Sequelize[_0xa8a9('0xa')]},'failureReason':{'type':Sequelize[_0xa8a9('0xa')]},'sentiment':{'type':Sequelize[_0xa8a9('0x6')]},'sPositive':{'type':Sequelize[_0xa8a9('0xc')]},'sNegative':{'type':Sequelize[_0xa8a9('0xc')]},'sNeutral':{'type':Sequelize[_0xa8a9('0xc')]},'sMixed':{'type':Sequelize[_0xa8a9('0xc')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xa8a9('0xd')],'get':function(){return moment(this[_0xa8a9('0x4')]('createdAt'))[_0xa8a9('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xa8a9('0xf')]();}},'updatedAt':{'type':Sequelize[_0xa8a9('0xd')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xa8a9('0xe')](_0xa8a9('0x10'))[_0xa8a9('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 690c732..be1aafa 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 _0xbd0d=['squel','crypto','jsforce','desk.js','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','keys','filters','intersection','model','query','attributes','fields','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','merge','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','sequelize','MD5','token','$and','push','format','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','end','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','data2','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x353a5e,_0x5c261d){var _0x1320b4=function(_0x21ec21){while(--_0x21ec21){_0x353a5e['push'](_0x353a5e['shift']());}};_0x1320b4(++_0x5c261d);}(_0xbd0d,0x126));var _0xdbd0=function(_0x69d003,_0x391e32){_0x69d003=_0x69d003-0x0;var _0x55aec7=_0xbd0d[_0x69d003];return _0x55aec7;};'use strict';var pdf=require(_0xdbd0('0x0'));var emlformat=require(_0xdbd0('0x1'));var rimraf=require(_0xdbd0('0x2'));var zipdir=require(_0xdbd0('0x3'));var jsonpatch=require(_0xdbd0('0x4'));var rp=require(_0xdbd0('0x5'));var moment=require(_0xdbd0('0x6'));var BPromise=require(_0xdbd0('0x7'));var Mustache=require(_0xdbd0('0x8'));var util=require(_0xdbd0('0x9'));var path=require(_0xdbd0('0xa'));var sox=require('sox');var csv=require(_0xdbd0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdbd0('0xc'));var crypto=require(_0xdbd0('0xd'));var jsforce=require(_0xdbd0('0xe'));var deskjs=require(_0xdbd0('0xf'));var toCsv=require(_0xdbd0('0xb'));var querystring=require('querystring');var Papa=require(_0xdbd0('0x10'));var AWS=require(_0xdbd0('0x11'));var uuidv4=require('uuid/v4');var Redis=require(_0xdbd0('0x12'));var authService=require(_0xdbd0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdbd0('0x14'));var hardwareService=require(_0xdbd0('0x15'));var logger=require('../../config/logger')(_0xdbd0('0x16'));var utils=require('../../config/utils');var config=require(_0xdbd0('0x17'));var db=require(_0xdbd0('0x18'))['db'];function respondWithStatusCode(_0x21e7b0,_0x5363ef){_0x5363ef=_0x5363ef||0xcc;return function(_0x3ac55d){if(_0x3ac55d){return _0x21e7b0[_0xdbd0('0x19')](_0x5363ef);}return _0x21e7b0[_0xdbd0('0x1a')](_0x5363ef)['end']();};}function respondWithResult(_0x79b743,_0x4e3fa6){_0x4e3fa6=_0x4e3fa6||0xc8;return function(_0x3884ea){if(_0x3884ea){return _0x79b743[_0xdbd0('0x1a')](_0x4e3fa6)['json'](_0x3884ea);}};}function respondWithFilteredResult(_0x582ecb,_0x4babdd){return function(_0x550124){if(_0x550124){var _0xc83858=_0x550124[_0xdbd0('0x1b')],_0x2a9af1=_0x4babdd[_0xdbd0('0x1c')],_0x16bb4c=_0x4babdd[_0xdbd0('0x1c')]+_0x4babdd[_0xdbd0('0x1d')],_0x5779ed;if(_0x16bb4c>=_0xc83858){_0x16bb4c=_0xc83858;_0x5779ed=0xc8;}else{_0x5779ed=0xce;}_0x582ecb[_0xdbd0('0x1a')](_0x5779ed);return _0x582ecb[_0xdbd0('0x1e')](_0xdbd0('0x1f'),_0x2a9af1+'-'+_0x16bb4c+'/'+_0xc83858)[_0xdbd0('0x20')](_0x550124);}return null;};}function patchUpdates(_0x59e2e7){return function(_0x401901){try{jsonpatch[_0xdbd0('0x21')](_0x401901,_0x59e2e7,!![]);}catch(_0x72b57c){return BPromise[_0xdbd0('0x22')](_0x72b57c);}return _0x401901[_0xdbd0('0x23')]();};}function saveUpdates(_0x2bf5d7,_0x4c4110){return function(_0x4aecd7){if(_0x4aecd7){return _0x4aecd7[_0xdbd0('0x24')](_0x2bf5d7)[_0xdbd0('0x25')](function(_0x4571a5){return _0x4571a5;});}return null;};}function removeEntity(_0x3e317f,_0x5bf008){return function(_0x4e4328){if(_0x4e4328){return _0x4e4328[_0xdbd0('0x26')]()[_0xdbd0('0x25')](function(){_0x3e317f[_0xdbd0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47a815,_0x1a42ce){return function(_0x2c8e94){if(!_0x2c8e94){_0x47a815[_0xdbd0('0x19')](0x194);}return _0x2c8e94;};}function handleError(_0x1d14c5,_0x2318c){_0x2318c=_0x2318c||0x1f4;return function(_0x589673){logger[_0xdbd0('0x27')](_0x589673[_0xdbd0('0x28')]);if(_0x589673[_0xdbd0('0x29')]){delete _0x589673[_0xdbd0('0x29')];}_0x1d14c5['status'](_0x2318c)[_0xdbd0('0x2a')](_0x589673);};}exports['index']=function(_0x2190c3,_0x384e65){var _0x24e6dc={},_0x345c3f={},_0x340e06={'count':0x0,'rows':[]};var _0x19a767=_[_0xdbd0('0x2b')](db[_0xdbd0('0x2c')][_0xdbd0('0x2d')],function(_0x3a4998){return{'name':_0x3a4998[_0xdbd0('0x2e')],'type':_0x3a4998[_0xdbd0('0x2f')][_0xdbd0('0x30')]};});_0x345c3f['model']=_[_0xdbd0('0x31')](_[_0xdbd0('0x2b')](_0x19a767,_0xdbd0('0x29')),['format']);_0x345c3f['query']=_[_0xdbd0('0x32')](_0x2190c3['query']);_0x345c3f[_0xdbd0('0x33')]=_[_0xdbd0('0x34')](_0x345c3f[_0xdbd0('0x35')],_0x345c3f[_0xdbd0('0x36')]);_0x24e6dc[_0xdbd0('0x37')]=_[_0xdbd0('0x34')](_0x345c3f['model'],qs[_0xdbd0('0x38')](_0x2190c3[_0xdbd0('0x36')]['fields']));_0x24e6dc[_0xdbd0('0x37')]=_0x24e6dc[_0xdbd0('0x37')]['length']?_0x24e6dc[_0xdbd0('0x37')]:_0x345c3f[_0xdbd0('0x35')];if(!_0x2190c3[_0xdbd0('0x36')]['hasOwnProperty']('nolimit')){_0x24e6dc[_0xdbd0('0x1d')]=qs[_0xdbd0('0x1d')](_0x2190c3[_0xdbd0('0x36')][_0xdbd0('0x1d')]);_0x24e6dc[_0xdbd0('0x1c')]=qs[_0xdbd0('0x1c')](_0x2190c3[_0xdbd0('0x36')][_0xdbd0('0x1c')]);}_0x24e6dc[_0xdbd0('0x39')]=qs[_0xdbd0('0x3a')](_0x2190c3[_0xdbd0('0x36')][_0xdbd0('0x3a')]);_0x24e6dc[_0xdbd0('0x3b')]=qs['filters'](_['pick'](_0x2190c3[_0xdbd0('0x36')],_0x345c3f['filters']),_0x19a767);if(_0x2190c3['query'][_0xdbd0('0x3c')]){_0x24e6dc[_0xdbd0('0x3b')]=_['merge'](_0x24e6dc['where'],{'$or':_[_0xdbd0('0x2b')](_0x19a767,function(_0x37cbb9){if(_0x37cbb9[_0xdbd0('0x2f')]!==_0xdbd0('0x3d')){var _0x58ba05={};_0x58ba05[_0x37cbb9['name']]={'$like':'%'+_0x2190c3['query'][_0xdbd0('0x3c')]+'%'};return _0x58ba05;}})});}_0x24e6dc=_['merge']({},_0x24e6dc,_0x2190c3[_0xdbd0('0x3e')]);var _0x2f78b5={'where':_0x24e6dc[_0xdbd0('0x3b')]};return db['VoiceRecording'][_0xdbd0('0x1b')](_0x2f78b5)[_0xdbd0('0x25')](function(_0x27f6ae){_0x340e06['count']=_0x27f6ae;if(_0x2190c3[_0xdbd0('0x36')][_0xdbd0('0x3f')]){_0x24e6dc[_0xdbd0('0x40')]=[{'all':!![]}];}return db[_0xdbd0('0x2c')][_0xdbd0('0x41')](_0x24e6dc);})[_0xdbd0('0x25')](function(_0x290c1a){_0x340e06[_0xdbd0('0x42')]=_0x290c1a;return _0x340e06;})[_0xdbd0('0x25')](respondWithFilteredResult(_0x384e65,_0x24e6dc))[_0xdbd0('0x43')](handleError(_0x384e65,null));};exports[_0xdbd0('0x44')]=function(_0x3fd4d5,_0x585cb4){var _0x2d2992={'raw':![],'where':{'id':_0x3fd4d5['params']['id']}},_0x142203={};_0x142203[_0xdbd0('0x35')]=_[_0xdbd0('0x32')](db[_0xdbd0('0x2c')][_0xdbd0('0x2d')]);_0x142203['query']=_[_0xdbd0('0x32')](_0x3fd4d5['query']);_0x142203[_0xdbd0('0x33')]=_[_0xdbd0('0x34')](_0x142203[_0xdbd0('0x35')],_0x142203[_0xdbd0('0x36')]);_0x2d2992['attributes']=_[_0xdbd0('0x34')](_0x142203[_0xdbd0('0x35')],qs[_0xdbd0('0x38')](_0x3fd4d5['query'][_0xdbd0('0x38')]));_0x2d2992[_0xdbd0('0x37')]=_0x2d2992['attributes'][_0xdbd0('0x45')]?_0x2d2992[_0xdbd0('0x37')]:_0x142203[_0xdbd0('0x35')];if(_0x3fd4d5[_0xdbd0('0x36')][_0xdbd0('0x3f')]){_0x2d2992[_0xdbd0('0x40')]=[{'all':!![]}];}_0x2d2992=_[_0xdbd0('0x46')]({},_0x2d2992,_0x3fd4d5[_0xdbd0('0x3e')]);return db[_0xdbd0('0x2c')][_0xdbd0('0x47')](_0x2d2992)[_0xdbd0('0x25')](handleEntityNotFound(_0x585cb4,null))[_0xdbd0('0x25')](respondWithResult(_0x585cb4,null))[_0xdbd0('0x43')](handleError(_0x585cb4,null));};exports[_0xdbd0('0x48')]=function(_0x56f570,_0x5e31d2){return db[_0xdbd0('0x2c')][_0xdbd0('0x48')](_0x56f570['body'],{})['then'](respondWithResult(_0x5e31d2,0xc9))[_0xdbd0('0x43')](handleError(_0x5e31d2,null));};exports[_0xdbd0('0x24')]=function(_0x481e93,_0x53bc4d){if(_0x481e93['body']['id']){delete _0x481e93[_0xdbd0('0x49')]['id'];}return db[_0xdbd0('0x2c')][_0xdbd0('0x47')]({'where':{'id':_0x481e93[_0xdbd0('0x4a')]['id']}})[_0xdbd0('0x25')](handleEntityNotFound(_0x53bc4d,null))[_0xdbd0('0x25')](saveUpdates(_0x481e93[_0xdbd0('0x49')],null))[_0xdbd0('0x25')](respondWithResult(_0x53bc4d,null))[_0xdbd0('0x43')](handleError(_0x53bc4d,null));};exports[_0xdbd0('0x4b')]=function(_0x6ee86d,_0x795905){return db[_0xdbd0('0x2c')][_0xdbd0('0x4b')]()[_0xdbd0('0x25')](respondWithResult(_0x795905,null))[_0xdbd0('0x43')](handleError(_0x795905,null));};exports[_0xdbd0('0x4c')]=function(_0x444299,_0x3663c5,_0x7c490c){var _0x3c8980=require(_0xdbd0('0x4d'));var _0x2f87e0=![];var _0x241bdc={};if(_0x444299[_0xdbd0('0x36')][_0xdbd0('0x2f')]&&_0x444299['query'][_0xdbd0('0x2f')]===_0xdbd0('0x4e')){_0x241bdc[_0xdbd0('0x4e')]=_0x444299[_0xdbd0('0x4a')]['id'];}else{_0x241bdc['id']=_0x444299[_0xdbd0('0x4a')]['id'];}return db[_0xdbd0('0x2c')][_0xdbd0('0x47')]({'where':_0x241bdc,'attributes':['id',_0xdbd0('0x4f')],'raw':!![]})[_0xdbd0('0x25')](handleEntityNotFound(_0x3663c5,null))[_0xdbd0('0x25')](function(_0x17eef6){if(_0x17eef6){var _0x53c69c=_0x17eef6[_0xdbd0('0x4f')];var _0x29eee9=util['format'](_0xdbd0('0x50'),_0x53c69c);if(fs[_0xdbd0('0x51')](_0x29eee9)){_0x2f87e0=!![];return _0x3c8980[_0xdbd0('0x52')](_0x29eee9,_0x53c69c,config[_0xdbd0('0x53')][_0xdbd0('0x54')])[_0xdbd0('0x25')](function(){return _0x17eef6;});}return _0x17eef6;}})[_0xdbd0('0x25')](function(_0x5d4f4d){if(_0x5d4f4d){var _0x1573a2=_0x5d4f4d[_0xdbd0('0x4f')];if(!fs['existsSync'](_0x1573a2)){throw new db[(_0xdbd0('0x55'))][(_0xdbd0('0x56'))](_0xdbd0('0x57'));}if(_0x5d4f4d[_0xdbd0('0x58')]){return _0x3663c5[_0xdbd0('0x4c')](_0x1573a2,_0x5d4f4d[_0xdbd0('0x58')]+path[_0xdbd0('0x59')](_0x1573a2),function(){if(_0x2f87e0){fs[_0xdbd0('0x5a')](_0x1573a2);}});}else{return _0x3663c5['download'](_0x1573a2,function(_0x4b7850){if(_0x2f87e0){fs['unlink'](_0x1573a2);}});}}})['catch'](function(_0x4e45c4){if(_0x4e45c4['message']==='VoiceRecording\x20not\x20found'){_0x3663c5['status'](0x194)['send'](_0xdbd0('0x5b'));}else{return handleError(_0x3663c5,null);}});};exports['downloads']=function(_0x5920a8,_0x568258,_0x50b4b4){var _0x35e7fe=require(_0xdbd0('0x4d'));var _0x512552=![];var _0xa8cb39={'$and':[db['sequelize'][_0xdbd0('0x3b')](db[_0xdbd0('0x5c')]['fn'](_0xdbd0('0x5d'),db[_0xdbd0('0x5c')]['col']('uniqueid')),_0x5920a8[_0xdbd0('0x36')][_0xdbd0('0x5e')])]};if(_0x5920a8[_0xdbd0('0x36')]['type']&&_0x5920a8['query'][_0xdbd0('0x2f')]==='uniqueid'){_0xa8cb39[_0xdbd0('0x5f')][_0xdbd0('0x60')]({'uniqueid':_0x5920a8[_0xdbd0('0x4a')]['id']});}else{_0xa8cb39[_0xdbd0('0x5f')][_0xdbd0('0x60')]({'id':_0x5920a8[_0xdbd0('0x4a')]['id']});}return db['VoiceRecording'][_0xdbd0('0x47')]({'where':_0xa8cb39,'attributes':['id',_0xdbd0('0x4f')],'raw':!![]})[_0xdbd0('0x25')](handleEntityNotFound(_0x568258,null))[_0xdbd0('0x25')](function(_0x3edb1b){if(_0x3edb1b){var _0x14d16e=util[_0xdbd0('0x61')](_0xdbd0('0x50'),_0x3edb1b['value']);if(fs['existsSync'](_0x14d16e)){_0x512552=!![];return _0x35e7fe[_0xdbd0('0x52')](_0x14d16e,_0x3edb1b['value'],config['secrets'][_0xdbd0('0x54')])['then'](function(){return _0x3edb1b;});}return _0x3edb1b;}})[_0xdbd0('0x25')](function(_0x5ccf74){if(_0x5ccf74){if(!fs[_0xdbd0('0x51')](_0x5ccf74[_0xdbd0('0x4f')])){throw new db[(_0xdbd0('0x55'))][(_0xdbd0('0x56'))](_0xdbd0('0x57'));}if(_0x5ccf74[_0xdbd0('0x58')]){return _0x568258[_0xdbd0('0x4c')](_0x5ccf74[_0xdbd0('0x4f')],_0x5ccf74[_0xdbd0('0x58')]+path['extname'](_0x5ccf74[_0xdbd0('0x4f')]),function(){if(_0x512552){fs[_0xdbd0('0x5a')](_0x5ccf74[_0xdbd0('0x4f')]);}});}else{return _0x568258[_0xdbd0('0x4c')](_0x5ccf74['value'],function(_0x2f7952){if(_0x512552){fs['unlink'](_0x5ccf74[_0xdbd0('0x4f')]);}});}}})[_0xdbd0('0x43')](handleError(_0x568258,null));};exports[_0xdbd0('0x26')]=function(_0x549e68,_0xa2a7){return db['VoiceRecording'][_0xdbd0('0x47')]({'where':{'id':_0x549e68[_0xdbd0('0x4a')]['id']}})['then'](function(_0x79d5fe){if(!_0x79d5fe)throw new ReferenceError(_0xdbd0('0x62'));return _0x79d5fe;})['then'](function(_0x2484ff){var _0x50e169=_0x2484ff['value'];logger[_0xdbd0('0x63')](_0xdbd0('0x64'),_0x50e169);if(!_[_0xdbd0('0x65')](_0x2484ff[_0xdbd0('0x4f')])&&fs[_0xdbd0('0x51')](_0x50e169)){logger['info'](_0xdbd0('0x66')+_0x50e169+_0xdbd0('0x67'));fs['unlinkSync'](_0x50e169);}_0x50e169=_0x50e169+_0xdbd0('0x68');if(!_[_0xdbd0('0x65')](_0x2484ff[_0xdbd0('0x4f')])&&fs[_0xdbd0('0x51')](_0x50e169)){logger['info'](_0xdbd0('0x66')+_0x50e169+_0xdbd0('0x67'));fs[_0xdbd0('0x69')](_0x50e169);}return _0x2484ff;})[_0xdbd0('0x25')](function(_0x5c280e){if(!_0x5c280e)throw new InternalError();return _0x5c280e[_0xdbd0('0x26')]();})[_0xdbd0('0x25')](function(){_0xa2a7[_0xdbd0('0x1a')](0xcc)[_0xdbd0('0x6a')]();})['catch'](handleError(_0xa2a7,null));};function getBucketslist(_0x3c7d39,_0x2a8390,_0xddcc33){return new Promise(function(_0x48fc23,_0x5f2ff7){var _0x258fa1=new AWS['S3']({'accessKeyId':_0x2a8390,'secretAccessKey':_0x3c7d39,'region':_0xddcc33});_0x258fa1[_0xdbd0('0x6b')]({},function(_0x3f48aa,_0x375ee9){if(_0x3f48aa){return _0x5f2ff7(_0x3f48aa);}else{return _0x48fc23(_0x375ee9);}});});}function createBucket(_0x5c94c4,_0x10a4c8,_0x1681b3,_0x357273){return new Promise(function(_0x5500dc,_0x17b998){var _0x3c908d=new AWS['S3']({'accessKeyId':_0x10a4c8,'secretAccessKey':_0x5c94c4,'region':_0x1681b3});_0x3c908d[_0xdbd0('0x6c')]({'Bucket':_0x357273},function(_0x19bbec,_0x1a7f3c){if(_0x19bbec){return _0x17b998(_0x19bbec);}else{return _0x5500dc(_0x1a7f3c);}});});}function uploadFile(_0x1e3997,_0x6bd6f2,_0x223842,_0x52b64e,_0x18ab0f,_0x3d0d79){return new Promise(function(_0xcac2f4,_0x5738c7){var _0x39c725=new AWS['S3']({'accessKeyId':_0x6bd6f2,'secretAccessKey':_0x1e3997,'region':_0x223842});_0x39c725[_0xdbd0('0x6d')]({'Bucket':_0x52b64e,'Key':_0x18ab0f,'Body':_0x3d0d79},function(_0x2f14b8,_0xe9dcf3){if(_0x2f14b8){return _0x5738c7(_0x2f14b8);}else{return _0xcac2f4(_0xe9dcf3);}});});}function startTranscribe(_0x3c3732,_0x2722ab,_0x3c49d8,_0x30a3e5,_0x132735,_0x299a00){return new Promise(function(_0x9f2d9d,_0x2577e6){var _0x277b2e=new AWS[(_0xdbd0('0x6e'))]({'accessKeyId':_0x2722ab,'secretAccessKey':_0x3c3732,'region':_0x3c49d8});_0x277b2e['startTranscriptionJob']({'TranscriptionJobName':_0x30a3e5,'LanguageCode':_0x132735,'Media':{'MediaFileUri':_0x299a00}},function(_0x4ab82f,_0x3c6e76){if(_0x4ab82f){return _0x2577e6(_0x4ab82f);}else{return _0x9f2d9d(_0x3c6e76);}});});}function transcribe(_0x2a21e4,_0xff1633,_0x40d45b,_0x30f602,_0x4ff8f9,_0x194dd4,_0x3010ec){return new Promise(function(_0xa9b261,_0x3ca69d){var _0x2984ff={};logger[_0xdbd0('0x63')](util[_0xdbd0('0x61')](_0xdbd0('0x6f'),_0x2a21e4,_0x4ff8f9));return uploadFile(_0xff1633,_0x40d45b,_0x30f602,_0x4ff8f9,path[_0xdbd0('0x70')](_0x194dd4),fs[_0xdbd0('0x71')](_0x194dd4))[_0xdbd0('0x25')](function(_0x42a47b){logger[_0xdbd0('0x63')](util[_0xdbd0('0x61')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x2a21e4,_0x4ff8f9,_0x42a47b[_0xdbd0('0x72')]));_0x2984ff['bucket']=_0x42a47b[_0xdbd0('0x73')];_0x2984ff[_0xdbd0('0x74')]=_0x42a47b[_0xdbd0('0x72')];logger[_0xdbd0('0x63')](util['format'](_0xdbd0('0x75'),_0x2a21e4));return startTranscribe(_0xff1633,_0x40d45b,_0x30f602,uuidv4(),_0x3010ec,_0x42a47b['Location']);})[_0xdbd0('0x25')](function(_0x46a073){logger['info'](util[_0xdbd0('0x61')](_0xdbd0('0x76'),_0x2a21e4,_0x46a073[_0xdbd0('0x77')][_0xdbd0('0x78')]));_0x2984ff[_0xdbd0('0x79')]=_0x46a073[_0xdbd0('0x77')][_0xdbd0('0x78')];_0x2984ff[_0xdbd0('0x7a')]=_0x46a073[_0xdbd0('0x77')][_0xdbd0('0x7b')];return _0xa9b261(_0x2984ff);})[_0xdbd0('0x43')](function(_0x51c64e){return _0x3ca69d(_0x51c64e);});});}exports['runTranscribe']=function(_0x45fc57,_0x501149,_0x5a7318){var _0x27d848;var _0x4fbeae;var _0x50b9cf;var _0x2731aa=require('../../components/encryptor');return db[_0xdbd0('0x2c')][_0xdbd0('0x7c')]({'where':{'id':_0x45fc57[_0xdbd0('0x4a')]['id']}})['then'](function(_0x62ee78){if(_0x62ee78){var _0x41032e=util[_0xdbd0('0x61')](_0xdbd0('0x50'),_0x62ee78[_0xdbd0('0x4f')]);if(fs['existsSync'](_0x41032e)){cypher=!![];return _0x2731aa[_0xdbd0('0x52')](_0x41032e,_0x62ee78[_0xdbd0('0x4f')],config[_0xdbd0('0x53')]['recording'])['then'](function(){return _0x62ee78;});}return _0x62ee78;}})[_0xdbd0('0x25')](function(_0x36d26f){if(!_0x36d26f){throw new db[(_0xdbd0('0x55'))][(_0xdbd0('0x56'))](_0xdbd0('0x7d'));}_0x4fbeae=_0x36d26f;return db[_0xdbd0('0x7e')][_0xdbd0('0x7c')]({'where':{'id':0x1}});})[_0xdbd0('0x25')](handleEntityNotFound(_0x501149,null))[_0xdbd0('0x25')](function(_0x332189){if(_0x332189){_0x27d848=_0x332189;if(!_0x27d848[_0xdbd0('0x7f')]||!_0x27d848[_0xdbd0('0x80')]||!_0x27d848[_0xdbd0('0x81')]||!_0x27d848[_0xdbd0('0x82')]||!_0x27d848[_0xdbd0('0x83')]){throw new db[(_0xdbd0('0x55'))][(_0xdbd0('0x56'))]('Transcribe\x20not\x20configured');}if(_0x45fc57['body'][_0xdbd0('0x84')]&&(!_0x27d848[_0xdbd0('0x85')]||!_0x27d848[_0xdbd0('0x86')]||!_0x27d848[_0xdbd0('0x87')]||!_0x27d848['language']||!_0x27d848[_0xdbd0('0x83')])){throw new db[(_0xdbd0('0x55'))]['ValidationError'](_0xdbd0('0x88'));}return db[_0xdbd0('0x89')][_0xdbd0('0x7c')]({'where':{'id':_0x27d848[_0xdbd0('0x80')]}});}})['then'](function(_0x3c47ef){if(!_0x3c47ef){throw new db[(_0xdbd0('0x55'))]['ValidationError'](_0xdbd0('0x8a'));}if(!_0x3c47ef[_0xdbd0('0x8b')]||!_0x3c47ef['data2']){throw new db[(_0xdbd0('0x55'))][(_0xdbd0('0x56'))](_0xdbd0('0x8c'));}_0x50b9cf=_0x3c47ef;return getBucketslist(_0x50b9cf['data1'],_0x50b9cf['data2'],_0x27d848['transcribeRegion']);})[_0xdbd0('0x25')](function(_0x561210){if(_0x561210&&_0x561210['Buckets']){var _0x3bb478=_[_0xdbd0('0x47')](_0x561210[_0xdbd0('0x8d')],function(_0x31b548){return _0x31b548['Name']===_0x27d848[_0xdbd0('0x83')];});if(!_0x3bb478){logger[_0xdbd0('0x63')](util[_0xdbd0('0x61')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x45fc57['params']['id'],_0x27d848[_0xdbd0('0x83')]));return createBucket(_0x50b9cf[_0xdbd0('0x8b')],_0x50b9cf['data2'],_0x27d848[_0xdbd0('0x81')],_0x27d848[_0xdbd0('0x83')]);}logger[_0xdbd0('0x63')](util[_0xdbd0('0x61')](_0xdbd0('0x8e'),_0x45fc57[_0xdbd0('0x4a')]['id'],_0x27d848[_0xdbd0('0x83')]));return;}})[_0xdbd0('0x25')](function(_0x51ace7){if(_0x4fbeae[_0xdbd0('0x7a')]===_0xdbd0('0x8f')){return transcribe(_0x45fc57[_0xdbd0('0x4a')]['id'],_0x50b9cf[_0xdbd0('0x8b')],_0x50b9cf[_0xdbd0('0x90')],_0x27d848[_0xdbd0('0x81')],_0x27d848[_0xdbd0('0x83')],_0x4fbeae['value'],_0x27d848[_0xdbd0('0x82')]);}else{logger[_0xdbd0('0x63')](util[_0xdbd0('0x61')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x45fc57['params']['id']));return{'transcribeStatus':_0xdbd0('0x91')};}})[_0xdbd0('0x25')](function(_0x2d96db){if(_0x2d96db){_0x2d96db[_0xdbd0('0x92')]=_0x45fc57[_0xdbd0('0x49')][_0xdbd0('0x84')];return _0x4fbeae[_0xdbd0('0x93')](_0x2d96db);}})[_0xdbd0('0x25')](respondWithResult(_0x501149,null))[_0xdbd0('0x43')](handleError(_0x501149,null));};function writeFile(_0x3435af,_0x2a1774){return new Promise(function(_0x254306,_0x430834){fs[_0xdbd0('0x94')](_0x2a1774,_0x3435af,function(_0x1e656f,_0x38b1e9){if(_0x1e656f){return _0x430834(_0x1e656f);}else{return _0x254306(_0x38b1e9);}});});}exports['downloadTranscribe']=function(_0x1005e4,_0x214d00,_0x1aee2b){return db['VoiceRecording']['findOne']({'where':{'id':_0x1005e4['params']['id']}})[_0xdbd0('0x25')](handleEntityNotFound(_0x214d00))[_0xdbd0('0x25')](function(_0x282584){if(_0x282584&&_0x282584[_0xdbd0('0x95')]){var _0x48204f=_0x282584[_0xdbd0('0x95')];var _0x375944=config[_0xdbd0('0x96')]+'/server/files/transcribes/transcribe_'+_0x282584['id']+_0xdbd0('0x97');if(fs[_0xdbd0('0x51')](_0x375944)){return _0x375944;}return writeFile(_0x48204f,_0x375944)[_0xdbd0('0x25')](function(){return _0x375944;});}else{throw new db['Sequelize'][(_0xdbd0('0x56'))](_0xdbd0('0x98'));}})['then'](function(_0x3374a4){return _0x214d00[_0xdbd0('0x4c')](_0x3374a4);})['catch'](handleError(_0x214d00));}; \ No newline at end of file +var _0x6cc3=['papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','status','end','count','offset','limit','Content-Range','json','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','VIRTUAL','merge','VoiceRecording','includeAll','findAll','rows','show','params','find','create','body','catch','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','token','push','recording','Sequelize','extname','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','writeFile','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js'];(function(_0x5881d0,_0xe8cc44){var _0x3e4211=function(_0x3bfc6e){while(--_0x3bfc6e){_0x5881d0['push'](_0x5881d0['shift']());}};_0x3e4211(++_0xe8cc44);}(_0x6cc3,0x7c));var _0x36cc=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x6cc3[_0x1fc122];return _0xa2cb13;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x36cc('0x0'));var rimraf=require(_0x36cc('0x1'));var zipdir=require(_0x36cc('0x2'));var jsonpatch=require(_0x36cc('0x3'));var rp=require('request-promise');var moment=require(_0x36cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x36cc('0x5'));var util=require(_0x36cc('0x6'));var path=require(_0x36cc('0x7'));var sox=require(_0x36cc('0x8'));var csv=require(_0x36cc('0x9'));var ejs=require(_0x36cc('0xa'));var fs=require('fs');var _=require(_0x36cc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x36cc('0xc'));var deskjs=require(_0x36cc('0xd'));var toCsv=require(_0x36cc('0x9'));var querystring=require('querystring');var Papa=require(_0x36cc('0xe'));var AWS=require(_0x36cc('0xf'));var uuidv4=require(_0x36cc('0x10'));var Redis=require(_0x36cc('0x11'));var authService=require(_0x36cc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x36cc('0x13'));var hardwareService=require(_0x36cc('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x36cc('0x15'))['db'];function respondWithStatusCode(_0x4629bb,_0x1da447){_0x1da447=_0x1da447||0xcc;return function(_0x45e7b3){if(_0x45e7b3){return _0x4629bb['sendStatus'](_0x1da447);}return _0x4629bb[_0x36cc('0x16')](_0x1da447)[_0x36cc('0x17')]();};}function respondWithResult(_0x4641dd,_0x4f3c88){_0x4f3c88=_0x4f3c88||0xc8;return function(_0x34e1af){if(_0x34e1af){return _0x4641dd[_0x36cc('0x16')](_0x4f3c88)['json'](_0x34e1af);}};}function respondWithFilteredResult(_0x4f2cbe,_0x3f326c){return function(_0x2ccd17){if(_0x2ccd17){var _0x290cbd=_0x2ccd17[_0x36cc('0x18')],_0x5313ea=_0x3f326c[_0x36cc('0x19')],_0x1b0ef9=_0x3f326c[_0x36cc('0x19')]+_0x3f326c[_0x36cc('0x1a')],_0x1ba204;if(_0x1b0ef9>=_0x290cbd){_0x1b0ef9=_0x290cbd;_0x1ba204=0xc8;}else{_0x1ba204=0xce;}_0x4f2cbe[_0x36cc('0x16')](_0x1ba204);return _0x4f2cbe['set'](_0x36cc('0x1b'),_0x5313ea+'-'+_0x1b0ef9+'/'+_0x290cbd)[_0x36cc('0x1c')](_0x2ccd17);}return null;};}function patchUpdates(_0x29793f){return function(_0xa36395){try{jsonpatch['apply'](_0xa36395,_0x29793f,!![]);}catch(_0x5482d6){return BPromise['reject'](_0x5482d6);}return _0xa36395[_0x36cc('0x1d')]();};}function saveUpdates(_0xcefa72,_0x346dc3){return function(_0x831525){if(_0x831525){return _0x831525[_0x36cc('0x1e')](_0xcefa72)[_0x36cc('0x1f')](function(_0x8ffbe){return _0x8ffbe;});}return null;};}function removeEntity(_0x9025ea,_0x370b1d){return function(_0x33025e){if(_0x33025e){return _0x33025e['destroy']()[_0x36cc('0x1f')](function(){_0x9025ea[_0x36cc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1464ed,_0x36a6a8){return function(_0x4697fe){if(!_0x4697fe){_0x1464ed[_0x36cc('0x20')](0x194);}return _0x4697fe;};}function handleError(_0x56a31d,_0x1ec145){_0x1ec145=_0x1ec145||0x1f4;return function(_0x1b2dec){logger[_0x36cc('0x21')](_0x1b2dec[_0x36cc('0x22')]);if(_0x1b2dec[_0x36cc('0x23')]){delete _0x1b2dec[_0x36cc('0x23')];}_0x56a31d[_0x36cc('0x16')](_0x1ec145)[_0x36cc('0x24')](_0x1b2dec);};}exports[_0x36cc('0x25')]=function(_0x2f703f,_0x5e6a7a){var _0x60d425={},_0x30b087={},_0x2dfa02={'count':0x0,'rows':[]};var _0x4967c2=_[_0x36cc('0x26')](db['VoiceRecording'][_0x36cc('0x27')],function(_0x499aef){return{'name':_0x499aef[_0x36cc('0x28')],'type':_0x499aef[_0x36cc('0x29')][_0x36cc('0x2a')]};});_0x30b087[_0x36cc('0x2b')]=_[_0x36cc('0x2c')](_[_0x36cc('0x26')](_0x4967c2,_0x36cc('0x23')),[_0x36cc('0x2d')]);_0x30b087[_0x36cc('0x2e')]=_[_0x36cc('0x2f')](_0x2f703f[_0x36cc('0x2e')]);_0x30b087['filters']=_[_0x36cc('0x30')](_0x30b087[_0x36cc('0x2b')],_0x30b087[_0x36cc('0x2e')]);_0x60d425[_0x36cc('0x31')]=_['intersection'](_0x30b087[_0x36cc('0x2b')],qs[_0x36cc('0x32')](_0x2f703f[_0x36cc('0x2e')][_0x36cc('0x32')]));_0x60d425['attributes']=_0x60d425[_0x36cc('0x31')][_0x36cc('0x33')]?_0x60d425[_0x36cc('0x31')]:_0x30b087[_0x36cc('0x2b')];if(!_0x2f703f[_0x36cc('0x2e')][_0x36cc('0x34')]('nolimit')){_0x60d425['limit']=qs[_0x36cc('0x1a')](_0x2f703f['query'][_0x36cc('0x1a')]);_0x60d425[_0x36cc('0x19')]=qs[_0x36cc('0x19')](_0x2f703f['query'][_0x36cc('0x19')]);}_0x60d425[_0x36cc('0x35')]=qs[_0x36cc('0x36')](_0x2f703f[_0x36cc('0x2e')]['sort']);_0x60d425['where']=qs[_0x36cc('0x37')](_['pick'](_0x2f703f[_0x36cc('0x2e')],_0x30b087[_0x36cc('0x37')]),_0x4967c2);if(_0x2f703f[_0x36cc('0x2e')][_0x36cc('0x38')]){_0x60d425['where']=_['merge'](_0x60d425[_0x36cc('0x39')],{'$or':_[_0x36cc('0x26')](_0x4967c2,function(_0x5b4385){if(_0x5b4385[_0x36cc('0x29')]!==_0x36cc('0x3a')){var _0x1834c0={};_0x1834c0[_0x5b4385[_0x36cc('0x23')]]={'$like':'%'+_0x2f703f[_0x36cc('0x2e')][_0x36cc('0x38')]+'%'};return _0x1834c0;}})});}_0x60d425=_[_0x36cc('0x3b')]({},_0x60d425,_0x2f703f['options']);var _0x16fdd5={'where':_0x60d425[_0x36cc('0x39')]};return db[_0x36cc('0x3c')]['count'](_0x16fdd5)[_0x36cc('0x1f')](function(_0xc71f49){_0x2dfa02['count']=_0xc71f49;if(_0x2f703f['query'][_0x36cc('0x3d')]){_0x60d425['include']=[{'all':!![]}];}return db[_0x36cc('0x3c')][_0x36cc('0x3e')](_0x60d425);})['then'](function(_0x4bd5a9){_0x2dfa02[_0x36cc('0x3f')]=_0x4bd5a9;return _0x2dfa02;})[_0x36cc('0x1f')](respondWithFilteredResult(_0x5e6a7a,_0x60d425))['catch'](handleError(_0x5e6a7a,null));};exports[_0x36cc('0x40')]=function(_0x98d799,_0x34b204){var _0x1ca00c={'raw':![],'where':{'id':_0x98d799[_0x36cc('0x41')]['id']}},_0x37addf={};_0x37addf[_0x36cc('0x2b')]=_[_0x36cc('0x2f')](db[_0x36cc('0x3c')][_0x36cc('0x27')]);_0x37addf[_0x36cc('0x2e')]=_[_0x36cc('0x2f')](_0x98d799[_0x36cc('0x2e')]);_0x37addf['filters']=_[_0x36cc('0x30')](_0x37addf[_0x36cc('0x2b')],_0x37addf[_0x36cc('0x2e')]);_0x1ca00c[_0x36cc('0x31')]=_['intersection'](_0x37addf[_0x36cc('0x2b')],qs[_0x36cc('0x32')](_0x98d799[_0x36cc('0x2e')][_0x36cc('0x32')]));_0x1ca00c[_0x36cc('0x31')]=_0x1ca00c[_0x36cc('0x31')][_0x36cc('0x33')]?_0x1ca00c[_0x36cc('0x31')]:_0x37addf[_0x36cc('0x2b')];if(_0x98d799['query'][_0x36cc('0x3d')]){_0x1ca00c['include']=[{'all':!![]}];}_0x1ca00c=_[_0x36cc('0x3b')]({},_0x1ca00c,_0x98d799['options']);return db[_0x36cc('0x3c')][_0x36cc('0x42')](_0x1ca00c)['then'](handleEntityNotFound(_0x34b204,null))[_0x36cc('0x1f')](respondWithResult(_0x34b204,null))['catch'](handleError(_0x34b204,null));};exports[_0x36cc('0x43')]=function(_0x1bb970,_0x105cec){return db[_0x36cc('0x3c')][_0x36cc('0x43')](_0x1bb970[_0x36cc('0x44')],{})[_0x36cc('0x1f')](respondWithResult(_0x105cec,0xc9))[_0x36cc('0x45')](handleError(_0x105cec,null));};exports[_0x36cc('0x1e')]=function(_0x4656f7,_0x294ffe){if(_0x4656f7[_0x36cc('0x44')]['id']){delete _0x4656f7['body']['id'];}return db['VoiceRecording'][_0x36cc('0x42')]({'where':{'id':_0x4656f7[_0x36cc('0x41')]['id']}})[_0x36cc('0x1f')](handleEntityNotFound(_0x294ffe,null))['then'](saveUpdates(_0x4656f7['body'],null))[_0x36cc('0x1f')](respondWithResult(_0x294ffe,null))[_0x36cc('0x45')](handleError(_0x294ffe,null));};exports[_0x36cc('0x46')]=function(_0x4c09f3,_0x1a0fb3){return db[_0x36cc('0x3c')][_0x36cc('0x46')]()[_0x36cc('0x1f')](respondWithResult(_0x1a0fb3,null))[_0x36cc('0x45')](handleError(_0x1a0fb3,null));};exports[_0x36cc('0x47')]=function(_0x21dda7,_0x3a8131,_0x2ba101){var _0x1cc4a8=require('../../components/encryptor');var _0xa73bc0=![];var _0x6ac83={};if(_0x21dda7[_0x36cc('0x2e')][_0x36cc('0x29')]&&_0x21dda7[_0x36cc('0x2e')][_0x36cc('0x29')]===_0x36cc('0x48')){_0x6ac83['uniqueid']=_0x21dda7['params']['id'];}else{_0x6ac83['id']=_0x21dda7[_0x36cc('0x41')]['id'];}return db[_0x36cc('0x3c')][_0x36cc('0x42')]({'where':_0x6ac83,'attributes':['id',_0x36cc('0x49')],'raw':!![]})[_0x36cc('0x1f')](handleEntityNotFound(_0x3a8131,null))['then'](function(_0x1f4c94){if(_0x1f4c94){var _0x684b1a=_0x1f4c94[_0x36cc('0x49')];var _0x238d80=util[_0x36cc('0x2d')](_0x36cc('0x4a'),_0x684b1a);if(fs[_0x36cc('0x4b')](_0x238d80)){_0xa73bc0=!![];return _0x1cc4a8[_0x36cc('0x4c')](_0x238d80,_0x684b1a,config[_0x36cc('0x4d')]['recording'])[_0x36cc('0x1f')](function(){return _0x1f4c94;});}return _0x1f4c94;}})[_0x36cc('0x1f')](function(_0x419169){if(_0x419169){var _0x5be852=_0x419169['value'];if(!fs['existsSync'](_0x5be852)){throw new db['Sequelize'][(_0x36cc('0x4e'))](_0x36cc('0x4f'));}if(_0x419169[_0x36cc('0x50')]){return _0x3a8131[_0x36cc('0x47')](_0x5be852,_0x419169[_0x36cc('0x50')]+path['extname'](_0x5be852),function(){if(_0xa73bc0){fs[_0x36cc('0x51')](_0x5be852);}});}else{return _0x3a8131[_0x36cc('0x47')](_0x5be852,function(_0x250766){if(_0xa73bc0){fs[_0x36cc('0x51')](_0x5be852);}});}}})[_0x36cc('0x45')](function(_0x2015f0){if(_0x2015f0[_0x36cc('0x52')]===_0x36cc('0x4f')){_0x3a8131[_0x36cc('0x16')](0x194)['send'](_0x36cc('0x53'));}else{return handleError(_0x3a8131,null);}});};exports[_0x36cc('0x54')]=function(_0x595818,_0x3b4f19,_0x3b57e4){var _0x35bbfc=require(_0x36cc('0x55'));var _0x4cbc0d=![];var _0xc65104={'$and':[db[_0x36cc('0x56')]['where'](db[_0x36cc('0x56')]['fn'](_0x36cc('0x57'),db[_0x36cc('0x56')]['col'](_0x36cc('0x48'))),_0x595818['query'][_0x36cc('0x58')])]};if(_0x595818['query'][_0x36cc('0x29')]&&_0x595818[_0x36cc('0x2e')]['type']===_0x36cc('0x48')){_0xc65104['$and'][_0x36cc('0x59')]({'uniqueid':_0x595818[_0x36cc('0x41')]['id']});}else{_0xc65104['$and'][_0x36cc('0x59')]({'id':_0x595818[_0x36cc('0x41')]['id']});}return db['VoiceRecording'][_0x36cc('0x42')]({'where':_0xc65104,'attributes':['id','value'],'raw':!![]})[_0x36cc('0x1f')](handleEntityNotFound(_0x3b4f19,null))[_0x36cc('0x1f')](function(_0x9baf68){if(_0x9baf68){var _0x70058f=util[_0x36cc('0x2d')](_0x36cc('0x4a'),_0x9baf68[_0x36cc('0x49')]);if(fs[_0x36cc('0x4b')](_0x70058f)){_0x4cbc0d=!![];return _0x35bbfc[_0x36cc('0x4c')](_0x70058f,_0x9baf68[_0x36cc('0x49')],config['secrets'][_0x36cc('0x5a')])[_0x36cc('0x1f')](function(){return _0x9baf68;});}return _0x9baf68;}})['then'](function(_0x2b7454){if(_0x2b7454){if(!fs[_0x36cc('0x4b')](_0x2b7454[_0x36cc('0x49')])){throw new db[(_0x36cc('0x5b'))][(_0x36cc('0x4e'))]('VoiceRecording\x20not\x20found');}if(_0x2b7454[_0x36cc('0x50')]){return _0x3b4f19[_0x36cc('0x47')](_0x2b7454['value'],_0x2b7454['filename']+path[_0x36cc('0x5c')](_0x2b7454[_0x36cc('0x49')]),function(){if(_0x4cbc0d){fs['unlink'](_0x2b7454[_0x36cc('0x49')]);}});}else{return _0x3b4f19[_0x36cc('0x47')](_0x2b7454[_0x36cc('0x49')],function(_0x481c89){if(_0x4cbc0d){fs[_0x36cc('0x51')](_0x2b7454[_0x36cc('0x49')]);}});}}})[_0x36cc('0x45')](handleError(_0x3b4f19,null));};exports['destroy']=function(_0x25dfda,_0x4c187a){return db[_0x36cc('0x3c')][_0x36cc('0x42')]({'where':{'id':_0x25dfda['params']['id']}})[_0x36cc('0x1f')](function(_0xc1e13e){if(!_0xc1e13e)throw new ReferenceError(_0x36cc('0x5d'));return _0xc1e13e;})[_0x36cc('0x1f')](function(_0x3205e5){var _0x4822d5=_0x3205e5[_0x36cc('0x49')];logger[_0x36cc('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x4822d5);if(!_[_0x36cc('0x5f')](_0x3205e5[_0x36cc('0x49')])&&fs[_0x36cc('0x4b')](_0x4822d5)){logger[_0x36cc('0x5e')](_0x36cc('0x60')+_0x4822d5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x36cc('0x61')](_0x4822d5);}_0x4822d5=_0x4822d5+_0x36cc('0x62');if(!_[_0x36cc('0x5f')](_0x3205e5[_0x36cc('0x49')])&&fs[_0x36cc('0x4b')](_0x4822d5)){logger[_0x36cc('0x5e')]('File:\x20\x22'+_0x4822d5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x36cc('0x61')](_0x4822d5);}return _0x3205e5;})['then'](function(_0xeff54e){if(!_0xeff54e)throw new InternalError();return _0xeff54e['destroy']();})[_0x36cc('0x1f')](function(){_0x4c187a[_0x36cc('0x16')](0xcc)[_0x36cc('0x17')]();})[_0x36cc('0x45')](handleError(_0x4c187a,null));};function getBucketslist(_0x25c1fc,_0x52894e,_0x2da13d){return new Promise(function(_0x3725f6,_0x1423b6){var _0x431c4e=new AWS['S3']({'accessKeyId':_0x52894e,'secretAccessKey':_0x25c1fc,'region':_0x2da13d});_0x431c4e['listBuckets']({},function(_0x5e2254,_0x3f9d29){if(_0x5e2254){return _0x1423b6(_0x5e2254);}else{return _0x3725f6(_0x3f9d29);}});});}function createBucket(_0x1779e1,_0x5774cc,_0x5b5395,_0x1c3f47){return new Promise(function(_0x5ac6e5,_0x590b59){var _0x5920d0=new AWS['S3']({'accessKeyId':_0x5774cc,'secretAccessKey':_0x1779e1,'region':_0x5b5395});_0x5920d0[_0x36cc('0x63')]({'Bucket':_0x1c3f47},function(_0x40bdf6,_0x68a053){if(_0x40bdf6){return _0x590b59(_0x40bdf6);}else{return _0x5ac6e5(_0x68a053);}});});}function uploadFile(_0x516980,_0x14c398,_0x44e6c8,_0x1e68e8,_0x512246,_0x8c56b5){return new Promise(function(_0x41c17e,_0x455963){var _0x830b21=new AWS['S3']({'accessKeyId':_0x14c398,'secretAccessKey':_0x516980,'region':_0x44e6c8});_0x830b21['upload']({'Bucket':_0x1e68e8,'Key':_0x512246,'Body':_0x8c56b5},function(_0x4553c1,_0x27bb1c){if(_0x4553c1){return _0x455963(_0x4553c1);}else{return _0x41c17e(_0x27bb1c);}});});}function startTranscribe(_0x920987,_0x2f0ffe,_0x25fbdc,_0x369498,_0x1cae4b,_0x3ffce5){return new Promise(function(_0xa41ed6,_0x465e27){var _0x4ca48c=new AWS['TranscribeService']({'accessKeyId':_0x2f0ffe,'secretAccessKey':_0x920987,'region':_0x25fbdc});_0x4ca48c[_0x36cc('0x64')]({'TranscriptionJobName':_0x369498,'LanguageCode':_0x1cae4b,'Media':{'MediaFileUri':_0x3ffce5}},function(_0x49143d,_0x12a061){if(_0x49143d){return _0x465e27(_0x49143d);}else{return _0xa41ed6(_0x12a061);}});});}function transcribe(_0x400e80,_0x5b9c78,_0x245a00,_0xa8cab6,_0x3cbf9e,_0x30cad2,_0x4017e5){return new Promise(function(_0x877c50,_0x4052ec){var _0x5b68cf={};logger[_0x36cc('0x5e')](util[_0x36cc('0x2d')](_0x36cc('0x65'),_0x400e80,_0x3cbf9e));return uploadFile(_0x5b9c78,_0x245a00,_0xa8cab6,_0x3cbf9e,path[_0x36cc('0x66')](_0x30cad2),fs['readFileSync'](_0x30cad2))[_0x36cc('0x1f')](function(_0x574d4d){logger[_0x36cc('0x5e')](util[_0x36cc('0x2d')](_0x36cc('0x67'),_0x400e80,_0x3cbf9e,_0x574d4d[_0x36cc('0x68')]));_0x5b68cf[_0x36cc('0x69')]=_0x574d4d['Bucket'];_0x5b68cf[_0x36cc('0x6a')]=_0x574d4d['Location'];logger[_0x36cc('0x5e')](util['format'](_0x36cc('0x6b'),_0x400e80));return startTranscribe(_0x5b9c78,_0x245a00,_0xa8cab6,uuidv4(),_0x4017e5,_0x574d4d[_0x36cc('0x68')]);})[_0x36cc('0x1f')](function(_0x51c50a){logger[_0x36cc('0x5e')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x400e80,_0x51c50a[_0x36cc('0x6c')][_0x36cc('0x6d')]));_0x5b68cf['transcribeName']=_0x51c50a[_0x36cc('0x6c')]['TranscriptionJobName'];_0x5b68cf[_0x36cc('0x6e')]=_0x51c50a['TranscriptionJob'][_0x36cc('0x6f')];return _0x877c50(_0x5b68cf);})[_0x36cc('0x45')](function(_0x178260){return _0x4052ec(_0x178260);});});}exports[_0x36cc('0x70')]=function(_0x54bec5,_0x1ee73b,_0x3cbe4e){var _0x20859;var _0x3f6533;var _0x52c546;var _0x5e4453=require(_0x36cc('0x55'));return db['VoiceRecording']['findOne']({'where':{'id':_0x54bec5[_0x36cc('0x41')]['id']}})[_0x36cc('0x1f')](function(_0x45d298){if(_0x45d298){var _0x4b3e00=util['format'](_0x36cc('0x4a'),_0x45d298[_0x36cc('0x49')]);if(fs['existsSync'](_0x4b3e00)){cypher=!![];return _0x5e4453[_0x36cc('0x4c')](_0x4b3e00,_0x45d298['value'],config[_0x36cc('0x4d')][_0x36cc('0x5a')])[_0x36cc('0x1f')](function(){return _0x45d298;});}return _0x45d298;}})['then'](function(_0x2c0f49){if(!_0x2c0f49){throw new db[(_0x36cc('0x5b'))][(_0x36cc('0x4e'))](_0x36cc('0x71'));}_0x3f6533=_0x2c0f49;return db['Setting'][_0x36cc('0x72')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x1ee73b,null))['then'](function(_0x5f346c){if(_0x5f346c){_0x20859=_0x5f346c;if(!_0x20859[_0x36cc('0x73')]||!_0x20859[_0x36cc('0x74')]||!_0x20859[_0x36cc('0x75')]||!_0x20859[_0x36cc('0x76')]||!_0x20859[_0x36cc('0x69')]){throw new db[(_0x36cc('0x5b'))]['ValidationError'](_0x36cc('0x77'));}if(_0x54bec5['body'][_0x36cc('0x78')]&&(!_0x20859[_0x36cc('0x79')]||!_0x20859[_0x36cc('0x7a')]||!_0x20859[_0x36cc('0x7b')]||!_0x20859[_0x36cc('0x76')]||!_0x20859[_0x36cc('0x69')])){throw new db[(_0x36cc('0x5b'))][(_0x36cc('0x4e'))](_0x36cc('0x7c'));}return db['CloudProvider'][_0x36cc('0x72')]({'where':{'id':_0x20859['transcribeAccountId']}});}})[_0x36cc('0x1f')](function(_0x4197c9){if(!_0x4197c9){throw new db[(_0x36cc('0x5b'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x4197c9['data1']||!_0x4197c9['data2']){throw new db[(_0x36cc('0x5b'))][(_0x36cc('0x4e'))](_0x36cc('0x7d'));}_0x52c546=_0x4197c9;return getBucketslist(_0x52c546[_0x36cc('0x7e')],_0x52c546[_0x36cc('0x7f')],_0x20859[_0x36cc('0x75')]);})[_0x36cc('0x1f')](function(_0xd10f0c){if(_0xd10f0c&&_0xd10f0c[_0x36cc('0x80')]){var _0x155fb1=_[_0x36cc('0x42')](_0xd10f0c[_0x36cc('0x80')],function(_0x124a5d){return _0x124a5d[_0x36cc('0x81')]===_0x20859[_0x36cc('0x69')];});if(!_0x155fb1){logger[_0x36cc('0x5e')](util[_0x36cc('0x2d')](_0x36cc('0x82'),_0x54bec5[_0x36cc('0x41')]['id'],_0x20859[_0x36cc('0x69')]));return createBucket(_0x52c546['data1'],_0x52c546[_0x36cc('0x7f')],_0x20859[_0x36cc('0x75')],_0x20859[_0x36cc('0x69')]);}logger[_0x36cc('0x5e')](util[_0x36cc('0x2d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x54bec5[_0x36cc('0x41')]['id'],_0x20859[_0x36cc('0x69')]));return;}})[_0x36cc('0x1f')](function(_0x278c96){if(_0x3f6533['transcribeStatus']===_0x36cc('0x83')){return transcribe(_0x54bec5[_0x36cc('0x41')]['id'],_0x52c546['data1'],_0x52c546[_0x36cc('0x7f')],_0x20859[_0x36cc('0x75')],_0x20859['bucket'],_0x3f6533['value'],_0x20859['language']);}else{logger[_0x36cc('0x5e')](util['format'](_0x36cc('0x84'),_0x54bec5[_0x36cc('0x41')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x36cc('0x1f')](function(_0x19a898){if(_0x19a898){_0x19a898['tempSentiment']=_0x54bec5['body']['runSentiment'];return _0x3f6533[_0x36cc('0x85')](_0x19a898);}})[_0x36cc('0x1f')](respondWithResult(_0x1ee73b,null))[_0x36cc('0x45')](handleError(_0x1ee73b,null));};function writeFile(_0x547918,_0x4bf52c){return new Promise(function(_0x5852d4,_0x57c26b){fs[_0x36cc('0x86')](_0x4bf52c,_0x547918,function(_0x23194e,_0x54950e){if(_0x23194e){return _0x57c26b(_0x23194e);}else{return _0x5852d4(_0x54950e);}});});}exports['downloadTranscribe']=function(_0x783110,_0x1a5d7f,_0x451b16){return db[_0x36cc('0x3c')][_0x36cc('0x72')]({'where':{'id':_0x783110[_0x36cc('0x41')]['id']}})[_0x36cc('0x1f')](handleEntityNotFound(_0x1a5d7f))[_0x36cc('0x1f')](function(_0x1dafa8){if(_0x1dafa8&&_0x1dafa8[_0x36cc('0x87')]){var _0x2675b5=_0x1dafa8[_0x36cc('0x87')];var _0x5bd16b=config[_0x36cc('0x88')]+'/server/files/transcribes/transcribe_'+_0x1dafa8['id']+'.txt';if(fs[_0x36cc('0x4b')](_0x5bd16b)){return _0x5bd16b;}return writeFile(_0x2675b5,_0x5bd16b)[_0x36cc('0x1f')](function(){return _0x5bd16b;});}else{throw new db[(_0x36cc('0x5b'))][(_0x36cc('0x4e'))](_0x36cc('0x89'));}})[_0x36cc('0x1f')](function(_0x513e44){return _0x1a5d7f[_0x36cc('0x47')](_0x513e44);})[_0x36cc('0x45')](handleError(_0x1a5d7f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index f9c64a3..0946811 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 _0x0eeb=['voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceRecording.attributes','exports','define'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0eeb[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var logger=require(_0xb0ee('0x2'))(_0xb0ee('0x3'));var moment=require(_0xb0ee('0x4'));var BPromise=require(_0xb0ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0ee('0x6'));var config=require(_0xb0ee('0x7'));var attributes=require(_0xb0ee('0x8'));module[_0xb0ee('0x9')]=function(_0x209dda,_0x453fa4){return _0x209dda[_0xb0ee('0xa')]('VoiceRecording',attributes,{'tableName':_0xb0ee('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb0ee('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x677a=['define','VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x356e4f,_0x167f66){var _0x42d2fe=function(_0x30eb7c){while(--_0x30eb7c){_0x356e4f['push'](_0x356e4f['shift']());}};_0x42d2fe(++_0x167f66);}(_0x677a,0xd6));var _0xa677=function(_0x67f485,_0x3ee0c2){_0x67f485=_0x67f485-0x0;var _0x3cd539=_0x677a[_0x67f485];return _0x3cd539;};'use strict';var _=require(_0xa677('0x0'));var util=require('util');var logger=require(_0xa677('0x1'))(_0xa677('0x2'));var moment=require(_0xa677('0x3'));var BPromise=require(_0xa677('0x4'));var rp=require(_0xa677('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa677('0x6'));var config=require(_0xa677('0x7'));var attributes=require(_0xa677('0x8'));module[_0xa677('0x9')]=function(_0x24576c,_0x5127c1){return _0x24576c[_0xa677('0xa')](_0xa677('0xb'),attributes,{'tableName':_0xa677('0xc'),'paranoid':![],'indexes':[{'name':_0xa677('0xd'),'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 0301e86..75395c1 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(_0x24403d,_0x94ebf1){var _0x3fabf3=function(_0x39b1a9){while(--_0x39b1a9){_0x24403d['push'](_0x24403d['shift']());}};_0x3fabf3(++_0x94ebf1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x50d326,_0x1fc7e2){var _0x10f473=function(_0x2588fd){while(--_0x2588fd){_0x50d326['push'](_0x50d326['shift']());}};_0x10f473(++_0x1fc7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 24f0c4c..6b16cc7 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(_0x2b145c,_0x5e021b){var _0x3f766b=function(_0x3536dd){while(--_0x3536dd){_0x2b145c['push'](_0x2b145c['shift']());}};_0x3f766b(++_0x5e021b);}(_0x7a54,0x106));var _0x47a5=function(_0x1f84ba,_0x1ee706){_0x1f84ba=_0x1f84ba-0x0;var _0x1e578f=_0x7a54[_0x1f84ba];return _0x1e578f;};'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 _0x5d17=['../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','exports','multer','util','express','Router'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x5d17,0x114));var _0x75d1=function(_0x2383c3,_0x4fd9de){_0x2383c3=_0x2383c3-0x0;var _0x2cadbc=_0x5d17[_0x2383c3];return _0x2cadbc;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var auth=require(_0x75d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75d1('0x5'));var controller=require(_0x75d1('0x6'));router[_0x75d1('0x7')]('/',auth[_0x75d1('0x8')](),controller['index']);router[_0x75d1('0x7')](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller[_0x75d1('0xa')]);router[_0x75d1('0xb')]('/',auth[_0x75d1('0x8')](),controller[_0x75d1('0xc')]);router['put']('/:id',auth[_0x75d1('0x8')](),controller['update']);router['delete'](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller['destroy']);module[_0x75d1('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 46715a8..9f85de5 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 _0xb418=['sequelize','moment','exports','ENUM','blind','STRING','Yes'];(function(_0x550bc8,_0x4e3932){var _0x4c0a4c=function(_0x466749){while(--_0x466749){_0x550bc8['push'](_0x550bc8['shift']());}};_0x4c0a4c(++_0x4e3932);}(_0xb418,0x11f));var _0x8b41=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xb418[_0x368fb9];return _0x4892fb;};'use strict';var Sequelize=require(_0x8b41('0x0'));var moment=require(_0x8b41('0x1'));module[_0x8b41('0x2')]={'type':{'type':Sequelize[_0x8b41('0x3')](_0x8b41('0x4'),'attended')},'result':{'type':Sequelize[_0x8b41('0x5')]},'transfererchannel':{'type':Sequelize[_0x8b41('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x8b41('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x8b41('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x8b41('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x8b41('0x5')]},'transfereechannel':{'type':Sequelize[_0x8b41('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8b41('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x8b41('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8b41('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8b41('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x8b41('0x5')]},'transfereecontext':{'type':Sequelize[_0x8b41('0x5')]},'transfereeexten':{'type':Sequelize[_0x8b41('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x8b41('0x5')]},'isexternal':{'type':Sequelize[_0x8b41('0x3')](_0x8b41('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8b41('0x5')]}}; \ No newline at end of file +var _0x6e34=['Yes','sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0xd6dfe7,_0x54b698){var _0x2deade=function(_0x1a1e61){while(--_0x1a1e61){_0xd6dfe7['push'](_0xd6dfe7['shift']());}};_0x2deade(++_0x54b698);}(_0x6e34,0x191));var _0x46e3=function(_0x26b8a2,_0xd0d5d4){_0x26b8a2=_0x26b8a2-0x0;var _0x52fee6=_0x6e34[_0x26b8a2];return _0x52fee6;};'use strict';var Sequelize=require(_0x46e3('0x0'));var moment=require(_0x46e3('0x1'));module[_0x46e3('0x2')]={'type':{'type':Sequelize[_0x46e3('0x3')](_0x46e3('0x4'),_0x46e3('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x46e3('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x46e3('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x46e3('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x46e3('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x46e3('0x6')]},'transferercontext':{'type':Sequelize[_0x46e3('0x6')]},'transfererexten':{'type':Sequelize[_0x46e3('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x46e3('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x46e3('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x46e3('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x46e3('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x46e3('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x46e3('0x6')]},'transfereecontext':{'type':Sequelize[_0x46e3('0x6')]},'transfereeexten':{'type':Sequelize[_0x46e3('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x46e3('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0x46e3('0x7'),'No')},'context':{'type':Sequelize[_0x46e3('0x6')]},'extension':{'type':Sequelize[_0x46e3('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 9dc9736..12561b2 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 _0xb97c=['reject','save','update','then','destroy','sendStatus','error','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','set','Content-Range','apply'];(function(_0x5c86f8,_0x584d10){var _0x161119=function(_0x3e5415){while(--_0x3e5415){_0x5c86f8['push'](_0x5c86f8['shift']());}};_0x161119(++_0x584d10);}(_0xb97c,0x72));var _0xcb97=function(_0x5cf900,_0x54e3d3){_0x5cf900=_0x5cf900-0x0;var _0x478b4c=_0xb97c[_0x5cf900];return _0x478b4c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcb97('0x0'));var rimraf=require(_0xcb97('0x1'));var zipdir=require(_0xcb97('0x2'));var jsonpatch=require(_0xcb97('0x3'));var rp=require(_0xcb97('0x4'));var moment=require(_0xcb97('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcb97('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcb97('0x7'));var ejs=require(_0xcb97('0x8'));var fs=require('fs');var _=require(_0xcb97('0x9'));var squel=require(_0xcb97('0xa'));var crypto=require(_0xcb97('0xb'));var jsforce=require(_0xcb97('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcb97('0x7'));var querystring=require(_0xcb97('0xd'));var Papa=require(_0xcb97('0xe'));var Redis=require(_0xcb97('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcb97('0x10'));var hardwareService=require(_0xcb97('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xcb97('0x12'));var config=require(_0xcb97('0x13'));var db=require(_0xcb97('0x14'))['db'];function respondWithStatusCode(_0x5702fb,_0x15724b){_0x15724b=_0x15724b||0xcc;return function(_0x1e23c9){if(_0x1e23c9){return _0x5702fb['sendStatus'](_0x15724b);}return _0x5702fb['status'](_0x15724b)[_0xcb97('0x15')]();};}function respondWithResult(_0xb79f1d,_0x1814cb){_0x1814cb=_0x1814cb||0xc8;return function(_0x56a7b4){if(_0x56a7b4){return _0xb79f1d[_0xcb97('0x16')](_0x1814cb)[_0xcb97('0x17')](_0x56a7b4);}};}function respondWithFilteredResult(_0x15f383,_0x148dec){return function(_0x4defdc){if(_0x4defdc){var _0x3770a8=_0x4defdc[_0xcb97('0x18')],_0x36d337=_0x148dec['offset'],_0x550c72=_0x148dec['offset']+_0x148dec['limit'],_0x19851e;if(_0x550c72>=_0x3770a8){_0x550c72=_0x3770a8;_0x19851e=0xc8;}else{_0x19851e=0xce;}_0x15f383[_0xcb97('0x16')](_0x19851e);return _0x15f383[_0xcb97('0x19')](_0xcb97('0x1a'),_0x36d337+'-'+_0x550c72+'/'+_0x3770a8)[_0xcb97('0x17')](_0x4defdc);}return null;};}function patchUpdates(_0x3a3d10){return function(_0x12dfeb){try{jsonpatch[_0xcb97('0x1b')](_0x12dfeb,_0x3a3d10,!![]);}catch(_0x5f0bf9){return BPromise[_0xcb97('0x1c')](_0x5f0bf9);}return _0x12dfeb[_0xcb97('0x1d')]();};}function saveUpdates(_0x79f6c0,_0x666a2e){return function(_0x1cbb2e){if(_0x1cbb2e){return _0x1cbb2e[_0xcb97('0x1e')](_0x79f6c0)[_0xcb97('0x1f')](function(_0x497310){return _0x497310;});}return null;};}function removeEntity(_0x4ae6b4,_0x2289ca){return function(_0xacd7ed){if(_0xacd7ed){return _0xacd7ed[_0xcb97('0x20')]()[_0xcb97('0x1f')](function(){_0x4ae6b4[_0xcb97('0x16')](0xcc)[_0xcb97('0x15')]();});}};}function handleEntityNotFound(_0x472b2f,_0x4f223e){return function(_0x2110f7){if(!_0x2110f7){_0x472b2f[_0xcb97('0x21')](0x194);}return _0x2110f7;};}function handleError(_0x497807,_0x4138ef){_0x4138ef=_0x4138ef||0x1f4;return function(_0x3ec01d){logger[_0xcb97('0x22')](_0x3ec01d['stack']);if(_0x3ec01d[_0xcb97('0x23')]){delete _0x3ec01d[_0xcb97('0x23')];}_0x497807['status'](_0x4138ef)[_0xcb97('0x24')](_0x3ec01d);};}exports['index']=function(_0x5db9be,_0x63a25e){var _0xc9befd={},_0x1d535a={},_0x24e989={'count':0x0,'rows':[]};var _0x3900f9=_[_0xcb97('0x25')](db[_0xcb97('0x26')][_0xcb97('0x27')],function(_0x6ea8c5){return{'name':_0x6ea8c5[_0xcb97('0x28')],'type':_0x6ea8c5[_0xcb97('0x29')][_0xcb97('0x2a')]};});_0x1d535a[_0xcb97('0x2b')]=_[_0xcb97('0x25')](_0x3900f9,'name');_0x1d535a[_0xcb97('0x2c')]=_[_0xcb97('0x2d')](_0x5db9be[_0xcb97('0x2c')]);_0x1d535a[_0xcb97('0x2e')]=_[_0xcb97('0x2f')](_0x1d535a[_0xcb97('0x2b')],_0x1d535a[_0xcb97('0x2c')]);_0xc9befd[_0xcb97('0x30')]=_[_0xcb97('0x2f')](_0x1d535a['model'],qs['fields'](_0x5db9be[_0xcb97('0x2c')][_0xcb97('0x31')]));_0xc9befd['attributes']=_0xc9befd[_0xcb97('0x30')][_0xcb97('0x32')]?_0xc9befd[_0xcb97('0x30')]:_0x1d535a[_0xcb97('0x2b')];if(!_0x5db9be['query'][_0xcb97('0x33')](_0xcb97('0x34'))){_0xc9befd[_0xcb97('0x35')]=qs['limit'](_0x5db9be['query'][_0xcb97('0x35')]);_0xc9befd[_0xcb97('0x36')]=qs[_0xcb97('0x36')](_0x5db9be[_0xcb97('0x2c')][_0xcb97('0x36')]);}_0xc9befd['order']=qs[_0xcb97('0x37')](_0x5db9be[_0xcb97('0x2c')]['sort']);_0xc9befd[_0xcb97('0x38')]=qs[_0xcb97('0x2e')](_[_0xcb97('0x39')](_0x5db9be[_0xcb97('0x2c')],_0x1d535a['filters']),_0x3900f9);if(_0x5db9be['query'][_0xcb97('0x3a')]){_0xc9befd['where']=_[_0xcb97('0x3b')](_0xc9befd[_0xcb97('0x38')],{'$or':_['map'](_0x3900f9,function(_0x929db8){if(_0x929db8['type']!==_0xcb97('0x3c')){var _0x3a2750={};_0x3a2750[_0x929db8[_0xcb97('0x23')]]={'$like':'%'+_0x5db9be['query']['filter']+'%'};return _0x3a2750;}})});}_0xc9befd=_[_0xcb97('0x3b')]({},_0xc9befd,_0x5db9be['options']);var _0x3bf152={'where':_0xc9befd[_0xcb97('0x38')]};return db[_0xcb97('0x26')][_0xcb97('0x18')](_0x3bf152)[_0xcb97('0x1f')](function(_0xe45d3d){_0x24e989['count']=_0xe45d3d;if(_0x5db9be[_0xcb97('0x2c')][_0xcb97('0x3d')]){_0xc9befd['include']=[{'all':!![]}];}return db[_0xcb97('0x26')][_0xcb97('0x3e')](_0xc9befd);})['then'](function(_0x53cf01){_0x24e989['rows']=_0x53cf01;return _0x24e989;})[_0xcb97('0x1f')](respondWithFilteredResult(_0x63a25e,_0xc9befd))[_0xcb97('0x3f')](handleError(_0x63a25e,null));};exports[_0xcb97('0x40')]=function(_0x5f55bb,_0x5f3bbf){var _0x4e7300={'raw':!![],'where':{'id':_0x5f55bb[_0xcb97('0x41')]['id']}},_0x14014b={};_0x14014b[_0xcb97('0x2b')]=_[_0xcb97('0x2d')](db[_0xcb97('0x26')][_0xcb97('0x27')]);_0x14014b['query']=_[_0xcb97('0x2d')](_0x5f55bb[_0xcb97('0x2c')]);_0x14014b[_0xcb97('0x2e')]=_[_0xcb97('0x2f')](_0x14014b[_0xcb97('0x2b')],_0x14014b[_0xcb97('0x2c')]);_0x4e7300['attributes']=_[_0xcb97('0x2f')](_0x14014b[_0xcb97('0x2b')],qs['fields'](_0x5f55bb[_0xcb97('0x2c')][_0xcb97('0x31')]));_0x4e7300['attributes']=_0x4e7300[_0xcb97('0x30')][_0xcb97('0x32')]?_0x4e7300[_0xcb97('0x30')]:_0x14014b['model'];if(_0x5f55bb[_0xcb97('0x2c')][_0xcb97('0x3d')]){_0x4e7300[_0xcb97('0x42')]=[{'all':!![]}];}_0x4e7300=_['merge']({},_0x4e7300,_0x5f55bb[_0xcb97('0x43')]);return db[_0xcb97('0x26')][_0xcb97('0x44')](_0x4e7300)[_0xcb97('0x1f')](handleEntityNotFound(_0x5f3bbf,null))[_0xcb97('0x1f')](respondWithResult(_0x5f3bbf,null))[_0xcb97('0x3f')](handleError(_0x5f3bbf,null));};exports[_0xcb97('0x45')]=function(_0x4ff23d,_0x544b8e){return db[_0xcb97('0x26')][_0xcb97('0x45')](_0x4ff23d[_0xcb97('0x46')],{})[_0xcb97('0x1f')](respondWithResult(_0x544b8e,0xc9))[_0xcb97('0x3f')](handleError(_0x544b8e,null));};exports['update']=function(_0x46b33b,_0x5f180d){if(_0x46b33b[_0xcb97('0x46')]['id']){delete _0x46b33b[_0xcb97('0x46')]['id'];}return db[_0xcb97('0x26')][_0xcb97('0x44')]({'where':{'id':_0x46b33b[_0xcb97('0x41')]['id']}})[_0xcb97('0x1f')](handleEntityNotFound(_0x5f180d,null))[_0xcb97('0x1f')](saveUpdates(_0x46b33b[_0xcb97('0x46')],null))[_0xcb97('0x1f')](respondWithResult(_0x5f180d,null))['catch'](handleError(_0x5f180d,null));};exports[_0xcb97('0x20')]=function(_0x35794e,_0x11d755){return db[_0xcb97('0x26')][_0xcb97('0x44')]({'where':{'id':_0x35794e[_0xcb97('0x41')]['id']}})[_0xcb97('0x1f')](handleEntityNotFound(_0x11d755,null))[_0xcb97('0x1f')](removeEntity(_0x11d755,null))[_0xcb97('0x3f')](handleError(_0x11d755,null));}; \ No newline at end of file +var _0xf694=['bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','options','where','then','include','findAll','show','length','includeAll','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','moment'];(function(_0x3cadbd,_0x12bc43){var _0x296da9=function(_0x3b15fc){while(--_0x3b15fc){_0x3cadbd['push'](_0x3cadbd['shift']());}};_0x296da9(++_0x12bc43);}(_0xf694,0x1a6));var _0x4f69=function(_0x404739,_0x1c4f4c){_0x404739=_0x404739-0x0;var _0x358c98=_0xf694[_0x404739];return _0x358c98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4f69('0x0'));var rimraf=require(_0x4f69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f69('0x2'));var rp=require('request-promise');var moment=require(_0x4f69('0x3'));var BPromise=require(_0x4f69('0x4'));var Mustache=require('mustache');var util=require(_0x4f69('0x5'));var path=require(_0x4f69('0x6'));var sox=require(_0x4f69('0x7'));var csv=require(_0x4f69('0x8'));var ejs=require(_0x4f69('0x9'));var fs=require('fs');var _=require(_0x4f69('0xa'));var squel=require('squel');var crypto=require(_0x4f69('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4f69('0xc'));var toCsv=require(_0x4f69('0x8'));var querystring=require('querystring');var Papa=require(_0x4f69('0xd'));var Redis=require(_0x4f69('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4f69('0xf'));var hardwareService=require(_0x4f69('0x10'));var logger=require(_0x4f69('0x11'))(_0x4f69('0x12'));var utils=require(_0x4f69('0x13'));var config=require(_0x4f69('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a4411,_0x124e63){_0x124e63=_0x124e63||0xcc;return function(_0x39b5c5){if(_0x39b5c5){return _0x4a4411[_0x4f69('0x15')](_0x124e63);}return _0x4a4411[_0x4f69('0x16')](_0x124e63)[_0x4f69('0x17')]();};}function respondWithResult(_0x5b8e6e,_0x26dea7){_0x26dea7=_0x26dea7||0xc8;return function(_0x424a31){if(_0x424a31){return _0x5b8e6e[_0x4f69('0x16')](_0x26dea7)[_0x4f69('0x18')](_0x424a31);}};}function respondWithFilteredResult(_0x52fdd3,_0x1e8adc){return function(_0x2362c2){if(_0x2362c2){var _0x589b12=_0x2362c2[_0x4f69('0x19')],_0x3258e7=_0x1e8adc['offset'],_0xa46244=_0x1e8adc['offset']+_0x1e8adc[_0x4f69('0x1a')],_0x1b9167;if(_0xa46244>=_0x589b12){_0xa46244=_0x589b12;_0x1b9167=0xc8;}else{_0x1b9167=0xce;}_0x52fdd3[_0x4f69('0x16')](_0x1b9167);return _0x52fdd3[_0x4f69('0x1b')](_0x4f69('0x1c'),_0x3258e7+'-'+_0xa46244+'/'+_0x589b12)[_0x4f69('0x18')](_0x2362c2);}return null;};}function patchUpdates(_0x2acddb){return function(_0x3c2d0f){try{jsonpatch[_0x4f69('0x1d')](_0x3c2d0f,_0x2acddb,!![]);}catch(_0x525096){return BPromise[_0x4f69('0x1e')](_0x525096);}return _0x3c2d0f['save']();};}function saveUpdates(_0x160d51,_0xb2a0d9){return function(_0x4edb52){if(_0x4edb52){return _0x4edb52[_0x4f69('0x1f')](_0x160d51)['then'](function(_0x33fd52){return _0x33fd52;});}return null;};}function removeEntity(_0x22c426,_0x20aa7f){return function(_0x3e070d){if(_0x3e070d){return _0x3e070d[_0x4f69('0x20')]()['then'](function(){_0x22c426['status'](0xcc)[_0x4f69('0x17')]();});}};}function handleEntityNotFound(_0x17e543,_0x2c3b4f){return function(_0x3b0ead){if(!_0x3b0ead){_0x17e543[_0x4f69('0x15')](0x194);}return _0x3b0ead;};}function handleError(_0xab4e90,_0x3d80f3){_0x3d80f3=_0x3d80f3||0x1f4;return function(_0x6e4e8d){logger['error'](_0x6e4e8d[_0x4f69('0x21')]);if(_0x6e4e8d[_0x4f69('0x22')]){delete _0x6e4e8d['name'];}_0xab4e90[_0x4f69('0x16')](_0x3d80f3)[_0x4f69('0x23')](_0x6e4e8d);};}exports[_0x4f69('0x24')]=function(_0x377098,_0x2f195e){var _0x20e95b={},_0x56672a={},_0x3b6cde={'count':0x0,'rows':[]};var _0x374705=_[_0x4f69('0x25')](db[_0x4f69('0x26')][_0x4f69('0x27')],function(_0x36acde){return{'name':_0x36acde[_0x4f69('0x28')],'type':_0x36acde[_0x4f69('0x29')][_0x4f69('0x2a')]};});_0x56672a[_0x4f69('0x2b')]=_[_0x4f69('0x25')](_0x374705,_0x4f69('0x22'));_0x56672a[_0x4f69('0x2c')]=_[_0x4f69('0x2d')](_0x377098[_0x4f69('0x2c')]);_0x56672a[_0x4f69('0x2e')]=_[_0x4f69('0x2f')](_0x56672a[_0x4f69('0x2b')],_0x56672a[_0x4f69('0x2c')]);_0x20e95b[_0x4f69('0x30')]=_[_0x4f69('0x2f')](_0x56672a[_0x4f69('0x2b')],qs[_0x4f69('0x31')](_0x377098[_0x4f69('0x2c')][_0x4f69('0x31')]));_0x20e95b[_0x4f69('0x30')]=_0x20e95b[_0x4f69('0x30')]['length']?_0x20e95b[_0x4f69('0x30')]:_0x56672a['model'];if(!_0x377098[_0x4f69('0x2c')][_0x4f69('0x32')](_0x4f69('0x33'))){_0x20e95b['limit']=qs[_0x4f69('0x1a')](_0x377098[_0x4f69('0x2c')]['limit']);_0x20e95b[_0x4f69('0x34')]=qs[_0x4f69('0x34')](_0x377098['query']['offset']);}_0x20e95b[_0x4f69('0x35')]=qs[_0x4f69('0x36')](_0x377098[_0x4f69('0x2c')][_0x4f69('0x36')]);_0x20e95b['where']=qs['filters'](_[_0x4f69('0x37')](_0x377098[_0x4f69('0x2c')],_0x56672a[_0x4f69('0x2e')]),_0x374705);if(_0x377098[_0x4f69('0x2c')][_0x4f69('0x38')]){_0x20e95b['where']=_['merge'](_0x20e95b['where'],{'$or':_[_0x4f69('0x25')](_0x374705,function(_0x259259){if(_0x259259[_0x4f69('0x29')]!=='VIRTUAL'){var _0x4f9db1={};_0x4f9db1[_0x259259[_0x4f69('0x22')]]={'$like':'%'+_0x377098[_0x4f69('0x2c')]['filter']+'%'};return _0x4f9db1;}})});}_0x20e95b=_[_0x4f69('0x39')]({},_0x20e95b,_0x377098[_0x4f69('0x3a')]);var _0x4da76c={'where':_0x20e95b[_0x4f69('0x3b')]};return db[_0x4f69('0x26')][_0x4f69('0x19')](_0x4da76c)[_0x4f69('0x3c')](function(_0xeccdee){_0x3b6cde['count']=_0xeccdee;if(_0x377098[_0x4f69('0x2c')]['includeAll']){_0x20e95b[_0x4f69('0x3d')]=[{'all':!![]}];}return db[_0x4f69('0x26')][_0x4f69('0x3e')](_0x20e95b);})[_0x4f69('0x3c')](function(_0x1c5a44){_0x3b6cde['rows']=_0x1c5a44;return _0x3b6cde;})[_0x4f69('0x3c')](respondWithFilteredResult(_0x2f195e,_0x20e95b))['catch'](handleError(_0x2f195e,null));};exports[_0x4f69('0x3f')]=function(_0x434dda,_0x118fc8){var _0x5e83ea={'raw':!![],'where':{'id':_0x434dda['params']['id']}},_0x579e66={};_0x579e66['model']=_[_0x4f69('0x2d')](db[_0x4f69('0x26')]['rawAttributes']);_0x579e66[_0x4f69('0x2c')]=_[_0x4f69('0x2d')](_0x434dda['query']);_0x579e66[_0x4f69('0x2e')]=_[_0x4f69('0x2f')](_0x579e66[_0x4f69('0x2b')],_0x579e66['query']);_0x5e83ea[_0x4f69('0x30')]=_[_0x4f69('0x2f')](_0x579e66[_0x4f69('0x2b')],qs[_0x4f69('0x31')](_0x434dda[_0x4f69('0x2c')][_0x4f69('0x31')]));_0x5e83ea[_0x4f69('0x30')]=_0x5e83ea['attributes'][_0x4f69('0x40')]?_0x5e83ea['attributes']:_0x579e66['model'];if(_0x434dda[_0x4f69('0x2c')][_0x4f69('0x41')]){_0x5e83ea[_0x4f69('0x3d')]=[{'all':!![]}];}_0x5e83ea=_[_0x4f69('0x39')]({},_0x5e83ea,_0x434dda['options']);return db['VoiceTransferReport'][_0x4f69('0x42')](_0x5e83ea)['then'](handleEntityNotFound(_0x118fc8,null))['then'](respondWithResult(_0x118fc8,null))[_0x4f69('0x43')](handleError(_0x118fc8,null));};exports[_0x4f69('0x44')]=function(_0x504ac9,_0x45085f){return db[_0x4f69('0x26')]['create'](_0x504ac9['body'],{})[_0x4f69('0x3c')](respondWithResult(_0x45085f,0xc9))[_0x4f69('0x43')](handleError(_0x45085f,null));};exports[_0x4f69('0x1f')]=function(_0x48729a,_0x522e9a){if(_0x48729a[_0x4f69('0x45')]['id']){delete _0x48729a[_0x4f69('0x45')]['id'];}return db[_0x4f69('0x26')][_0x4f69('0x42')]({'where':{'id':_0x48729a[_0x4f69('0x46')]['id']}})['then'](handleEntityNotFound(_0x522e9a,null))[_0x4f69('0x3c')](saveUpdates(_0x48729a['body'],null))[_0x4f69('0x3c')](respondWithResult(_0x522e9a,null))[_0x4f69('0x43')](handleError(_0x522e9a,null));};exports[_0x4f69('0x20')]=function(_0x5b383a,_0xe93be0){return db[_0x4f69('0x26')][_0x4f69('0x42')]({'where':{'id':_0x5b383a[_0x4f69('0x46')]['id']}})[_0x4f69('0x3c')](handleEntityNotFound(_0xe93be0,null))['then'](removeEntity(_0xe93be0,null))[_0x4f69('0x43')](handleError(_0xe93be0,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index b2f0f3f..1107fb0 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 _0xbeb0=['./voiceTransferReport.attributes','exports','VoiceTransferReport','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbeb0,0x135));var _0x0beb=function(_0x29a1e8,_0x1d5571){_0x29a1e8=_0x29a1e8-0x0;var _0x200c2a=_0xbeb0[_0x29a1e8];return _0x200c2a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0beb('0x0'))('api');var moment=require('moment');var BPromise=require(_0x0beb('0x1'));var rp=require(_0x0beb('0x2'));var fs=require('fs');var path=require(_0x0beb('0x3'));var rimraf=require(_0x0beb('0x4'));var config=require(_0x0beb('0x5'));var attributes=require(_0x0beb('0x6'));module[_0x0beb('0x7')]=function(_0x45eef4,_0x257c49){return _0x45eef4['define'](_0x0beb('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a95=['request-promise','path','rimraf','./voiceTransferReport.attributes','exports','VoiceTransferReport','lodash','util','../../config/logger','api','moment'];(function(_0x21c6f5,_0x2ca46d){var _0x5451df=function(_0x35b06c){while(--_0x35b06c){_0x21c6f5['push'](_0x21c6f5['shift']());}};_0x5451df(++_0x2ca46d);}(_0x3a95,0xc1));var _0x53a9=function(_0x3fa715,_0xb42eba){_0x3fa715=_0x3fa715-0x0;var _0x112000=_0x3a95[_0x3fa715];return _0x112000;};'use strict';var _=require(_0x53a9('0x0'));var util=require(_0x53a9('0x1'));var logger=require(_0x53a9('0x2'))(_0x53a9('0x3'));var moment=require(_0x53a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x53a9('0x5'));var fs=require('fs');var path=require(_0x53a9('0x6'));var rimraf=require(_0x53a9('0x7'));var config=require('../../config/environment');var attributes=require(_0x53a9('0x8'));module[_0x53a9('0x9')]=function(_0x13dc6f,_0x33df82){return _0x13dc6f['define'](_0x53a9('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index a49c6c6..962aeb2 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 _0xc2ef=['client','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x265276,_0x323341){var _0x24f28b=function(_0x1c6b58){while(--_0x1c6b58){_0x265276['push'](_0x265276['shift']());}};_0x24f28b(++_0x323341);}(_0xc2ef,0x12b));var _0xfc2e=function(_0x416bc9,_0x5cfa48){_0x416bc9=_0x416bc9-0x0;var _0x495edd=_0xc2ef[_0x416bc9];return _0x495edd;};'use strict';var _=require('lodash');var util=require(_0xfc2e('0x0'));var moment=require(_0xfc2e('0x1'));var BPromise=require(_0xfc2e('0x2'));var rs=require(_0xfc2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc2e('0x4'))['db'];var utils=require(_0xfc2e('0x5'));var logger=require(_0xfc2e('0x6'))(_0xfc2e('0x7'));var config=require(_0xfc2e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfc2e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55c5f4,_0x38e71c,_0x252ffc){return new BPromise(function(_0x16fdee,_0x476166){return client[_0xfc2e('0xa')](_0x55c5f4,_0x252ffc)[_0xfc2e('0xb')](function(_0x2c8d73){logger[_0xfc2e('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x38e71c,_0xfc2e('0xd'));logger[_0xfc2e('0xe')](_0xfc2e('0xf'),_0x38e71c,_0xfc2e('0xd'),JSON[_0xfc2e('0x10')](_0x2c8d73));if(_0x2c8d73[_0xfc2e('0x11')]){if(_0x2c8d73[_0xfc2e('0x11')]['code']===0x1f4){logger['error'](_0xfc2e('0x12'),_0x38e71c,_0x2c8d73[_0xfc2e('0x11')][_0xfc2e('0x13')]);return _0x476166(_0x2c8d73[_0xfc2e('0x11')][_0xfc2e('0x13')]);}logger['error'](_0xfc2e('0x12'),_0x38e71c,_0x2c8d73['error'][_0xfc2e('0x13')]);return _0x16fdee(_0x2c8d73[_0xfc2e('0x11')]['message']);}else{logger[_0xfc2e('0xc')](_0xfc2e('0x12'),_0x38e71c,_0xfc2e('0xd'));_0x16fdee(_0x2c8d73[_0xfc2e('0x14')][_0xfc2e('0x13')]);}})[_0xfc2e('0x15')](function(_0x37d77c){logger['error'](_0xfc2e('0x12'),_0x38e71c,_0x37d77c);_0x476166(_0x37d77c);});});}exports['CreateVoiceTransferReport']=function(_0x5c73b7){var _0x1f39bd=this;return new Promise(function(_0x2c0fef,_0x1cab13){return db[_0xfc2e('0x16')][_0xfc2e('0x17')](_0x5c73b7[_0xfc2e('0x18')],{'raw':_0x5c73b7['options']?_0x5c73b7[_0xfc2e('0x19')][_0xfc2e('0x1a')]===undefined?!![]:![]:!![]})[_0xfc2e('0xb')](function(_0xbbd9d1){logger['info'](_0xfc2e('0x1b'),_0x5c73b7);logger[_0xfc2e('0xe')]('CreateVoiceTransferReport',_0x5c73b7,JSON[_0xfc2e('0x10')](_0xbbd9d1));_0x2c0fef(_0xbbd9d1);})[_0xfc2e('0x15')](function(_0x117e12){logger[_0xfc2e('0x11')](_0xfc2e('0x1b'),_0x117e12[_0xfc2e('0x13')],_0x5c73b7);_0x1cab13(_0x1f39bd[_0xfc2e('0x11')](0x1f4,_0x117e12[_0xfc2e('0x13')]));});});}; \ No newline at end of file +var _0x082e=['../../config/utils','../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3b72e2,_0x302813){var _0x243f37=function(_0x589413){while(--_0x589413){_0x3b72e2['push'](_0x3b72e2['shift']());}};_0x243f37(++_0x302813);}(_0x082e,0x14b));var _0xe082=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x082e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe082('0x0'));var util=require('util');var moment=require(_0xe082('0x1'));var BPromise=require('bluebird');var rs=require(_0xe082('0x2'));var fs=require('fs');var Redis=require(_0xe082('0x3'));var db=require(_0xe082('0x4'))['db'];var utils=require(_0xe082('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe082('0x6'));var jayson=require(_0xe082('0x7'));var client=jayson[_0xe082('0x8')][_0xe082('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x582078,_0x43eb6f,_0x43acc8){return new BPromise(function(_0x41ac96,_0x291f0b){return client['request'](_0x582078,_0x43acc8)['then'](function(_0xdbcbb3){logger[_0xe082('0xa')](_0xe082('0xb'),_0x43eb6f,'request\x20sent');logger[_0xe082('0xc')](_0xe082('0xd'),_0x43eb6f,_0xe082('0xe'),JSON[_0xe082('0xf')](_0xdbcbb3));if(_0xdbcbb3[_0xe082('0x10')]){if(_0xdbcbb3['error'][_0xe082('0x11')]===0x1f4){logger[_0xe082('0x10')](_0xe082('0xb'),_0x43eb6f,_0xdbcbb3[_0xe082('0x10')][_0xe082('0x12')]);return _0x291f0b(_0xdbcbb3[_0xe082('0x10')]['message']);}logger[_0xe082('0x10')](_0xe082('0xb'),_0x43eb6f,_0xdbcbb3['error'][_0xe082('0x12')]);return _0x41ac96(_0xdbcbb3['error'][_0xe082('0x12')]);}else{logger[_0xe082('0xa')](_0xe082('0xb'),_0x43eb6f,_0xe082('0xe'));_0x41ac96(_0xdbcbb3[_0xe082('0x13')][_0xe082('0x12')]);}})[_0xe082('0x14')](function(_0x47382b){logger[_0xe082('0x10')](_0xe082('0xb'),_0x43eb6f,_0x47382b);_0x291f0b(_0x47382b);});});}exports[_0xe082('0x15')]=function(_0x202de8){var _0x257996=this;return new Promise(function(_0x48b597,_0x3c7e1e){return db[_0xe082('0x16')][_0xe082('0x17')](_0x202de8[_0xe082('0x18')],{'raw':_0x202de8[_0xe082('0x19')]?_0x202de8['options'][_0xe082('0x1a')]===undefined?!![]:![]:!![]})[_0xe082('0x1b')](function(_0xcb593f){logger[_0xe082('0xa')](_0xe082('0x15'),_0x202de8);logger[_0xe082('0xc')]('CreateVoiceTransferReport',_0x202de8,JSON['stringify'](_0xcb593f));_0x48b597(_0xcb593f);})['catch'](function(_0x507ab1){logger[_0xe082('0x10')](_0xe082('0x15'),_0x507ab1[_0xe082('0x12')],_0x202de8);_0x3c7e1e(_0x257996['error'](0x1f4,_0x507ab1[_0xe082('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index cbc7a8c..fee5bbb 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 _0xb544=['../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','answer','hold','/unhold','/calls','calls','exports'];(function(_0x7d9ebd,_0x45ecfc){var _0x195672=function(_0x4c13cd){while(--_0x4c13cd){_0x7d9ebd['push'](_0x7d9ebd['shift']());}};_0x195672(++_0x45ecfc);}(_0xb544,0xd0));var _0x4b54=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xb544[_0x5c2e3e];return _0x53f64a;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x4b54('0x0'));var controller=require(_0x4b54('0x1'));router[_0x4b54('0x2')](_0x4b54('0x3'),auth[_0x4b54('0x4')](),auth[_0x4b54('0x5')](),controller[_0x4b54('0x6')]);router[_0x4b54('0x2')]('/hangup',auth['isAuthenticated'](),auth['canUpdate'](),controller['hangup']);router[_0x4b54('0x2')]('/answer',auth[_0x4b54('0x4')](),auth['canUpdate'](),controller[_0x4b54('0x7')]);router[_0x4b54('0x2')]('/hold',auth[_0x4b54('0x4')](),auth[_0x4b54('0x5')](),controller[_0x4b54('0x8')]);router[_0x4b54('0x2')](_0x4b54('0x9'),auth[_0x4b54('0x4')](),auth[_0x4b54('0x5')](),controller['unhold']);router[_0x4b54('0x2')](_0x4b54('0xa'),auth[_0x4b54('0x4')](),auth['canUpdate'](),controller[_0x4b54('0xb')]);router[_0x4b54('0x2')]('/transfer',auth[_0x4b54('0x4')](),auth[_0x4b54('0x5')](),controller['transfer']);module[_0x4b54('0xc')]=router; \ No newline at end of file +var _0xbbb8=['hold','/unhold','unhold','calls','/transfer','transfer','express','Router','./webbar.controller','post','isAuthenticated','canUpdate','originate','/hangup','hangup','answer','/hold'];(function(_0x598a75,_0x100c5e){var _0x121173=function(_0x4ca5e1){while(--_0x4ca5e1){_0x598a75['push'](_0x598a75['shift']());}};_0x121173(++_0x100c5e);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x521c64,_0x2167fc){_0x521c64=_0x521c64-0x0;var _0x5c091d=_0xbbb8[_0x521c64];return _0x5c091d;};'use strict';var express=require(_0x8bbb('0x0'));var router=express[_0x8bbb('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x8bbb('0x2'));router[_0x8bbb('0x3')]('/originate',auth[_0x8bbb('0x4')](),auth[_0x8bbb('0x5')](),controller[_0x8bbb('0x6')]);router[_0x8bbb('0x3')](_0x8bbb('0x7'),auth[_0x8bbb('0x4')](),auth[_0x8bbb('0x5')](),controller[_0x8bbb('0x8')]);router[_0x8bbb('0x3')]('/answer',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x8bbb('0x9')]);router[_0x8bbb('0x3')](_0x8bbb('0xa'),auth[_0x8bbb('0x4')](),auth[_0x8bbb('0x5')](),controller[_0x8bbb('0xb')]);router[_0x8bbb('0x3')](_0x8bbb('0xc'),auth['isAuthenticated'](),auth[_0x8bbb('0x5')](),controller[_0x8bbb('0xd')]);router[_0x8bbb('0x3')]('/calls',auth[_0x8bbb('0x4')](),auth[_0x8bbb('0x5')](),controller[_0x8bbb('0xe')]);router['post'](_0x8bbb('0xf'),auth[_0x8bbb('0x4')](),auth[_0x8bbb('0x5')](),controller[_0x8bbb('0x10')]);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 0d004ea..cc39ec2 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 _0x12c9=['NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callbackUrl','format','user:%s','webbar:originate','hangup','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','client','http','webbarapi','ioredis','defaults','redis','localhost','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','stack','name','status','send'];(function(_0x504c88,_0x1c3016){var _0xb5611e=function(_0x2beaf8){while(--_0x2beaf8){_0x504c88['push'](_0x504c88['shift']());}};_0xb5611e(++_0x1c3016);}(_0x12c9,0x10e));var _0x912c=function(_0x5087cf,_0x10b5a9){_0x5087cf=_0x5087cf-0x0;var _0x3a160f=_0x12c9[_0x5087cf];return _0x3a160f;};'use strict';var path=require(_0x912c('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x912c('0x1'))['db'];var config=require(_0x912c('0x2'));var util=require(_0x912c('0x3'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0x912c('0x4')][_0x912c('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x912c('0x6'));var Redis=require(_0x912c('0x7'));config['redis']=_[_0x912c('0x8')](config[_0x912c('0x9')],{'host':_0x912c('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x912c('0xb'));var originateValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x912c('0xd'),'required':[!![],_0x912c('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],_0x912c('0xf')]},'sessionId':{'type':_0x912c('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x912c('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x912c('0xd'),'required':[!![],_0x912c('0x10')]},'transferNumber':{'type':_0x912c('0xd'),'required':[!![],_0x912c('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x912c('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],_0x912c('0xf')]},'sessionId':{'type':_0x912c('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],_0x912c('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],_0x912c('0xf')]}});function emit(_0x361d2b,_0x54caf3,_0x3c6031){logger[_0x912c('0x12')](_0x361d2b,_0x54caf3,JSON[_0x912c('0x13')](_0x3c6031));io['to'](_0x361d2b)['emit'](_0x54caf3,_0x3c6031);}function handleError(_0x2ec379){return function(_0x284684){console[_0x912c('0x14')]('handleError:',_0x284684,_0x284684 instanceof RangeError);logger[_0x912c('0x15')](_0x284684[_0x912c('0x16')]);if(_0x284684 instanceof RangeError){if(_0x284684['name']){delete _0x284684[_0x912c('0x17')];}_0x2ec379[_0x912c('0x18')](0x194)[_0x912c('0x19')](_0x284684);}else{if(_0x284684[_0x912c('0x17')]){delete _0x284684[_0x912c('0x17')];}_0x2ec379[_0x912c('0x18')](0x1f4)[_0x912c('0x19')](_0x284684);}};}function checkError(){return function(_0x19e7d8){if(!_0x19e7d8){throw new RangeError(_0x912c('0x1a'));}return _0x19e7d8;};}function respondWithRpcPromise(_0x566ea6,_0x5640b9){return new BPromise(function(_0x3f0ee8,_0x5c7e4c){var _0x4d834d=amiClient;return _0x4d834d[_0x912c('0x1b')](_0x566ea6,_0x5640b9)[_0x912c('0x1c')](function(_0x4f0461){if(_0x4f0461[_0x912c('0x15')]){if(_0x4f0461[_0x912c('0x15')][_0x912c('0x1d')]===0x1f4){return _0x5c7e4c(_0x4f0461[_0x912c('0x15')]['message']);}return _0x3f0ee8(_0x4f0461[_0x912c('0x15')][_0x912c('0x1e')]);}else{_0x3f0ee8(_0x4f0461[_0x912c('0x1f')]);}})[_0x912c('0x20')](function(_0x1174e2){_0x5c7e4c(_0x1174e2);});});}function getAgent(_0x216e4d){return db[_0x912c('0x21')][_0x912c('0x22')]({'where':{'id':_0x216e4d,'role':_0x912c('0x23')}})[_0x912c('0x1c')](checkError());}function getAgentCheckSession(_0x14422b,_0x4b3334){return new BPromise(function(_0x5c5d73,_0x275980){var _0xebbd58=respondWithRpcPromise(_0x912c('0x24'));var _0x161088=getAgent(_0x14422b);Promise[_0x912c('0x25')]([_0xebbd58,_0x161088])[_0x912c('0x1c')](function(_0x110639){var _0x47bc0e=_0x110639[0x0];var _0x2fd7b5=_0x110639[0x1];var _0x3baca9=_[_0x912c('0x26')](_0x47bc0e[_0x912c('0x27')],function(_0x50e447){return _0x50e447[_0x912c('0x28')]==_0x2fd7b5['id']&&_0x50e447[_0x912c('0x29')]==_0x4b3334;});if(_0x3baca9[_0x912c('0x2a')]==0x1){_0x5c5d73(_0x2fd7b5);}else{_0x275980(new RangeError('sessionId\x20'+_0x4b3334+_0x912c('0x2b')));}});});}exports[_0x912c('0x2c')]=function(_0xab5957,_0x54df3b){logger[_0x912c('0x12')](_0x912c('0x2d'),_0xab5957[_0x912c('0x2e')]);var _0x4ef410=originateValidation['validate'](_0xab5957['body']);if(_0x4ef410[_0x912c('0x2a')]>0x0){return _0x54df3b[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0x4ef410);}var _0x4f81a5=_0xab5957[_0x912c('0x2e')][_0x912c('0x30')];var _0xac916a=_0xab5957[_0x912c('0x2e')]['callNumber'];var _0x46374e=_0xab5957[_0x912c('0x2e')]['callerId'];var _0x1cc699=_0xab5957[_0x912c('0x2e')][_0x912c('0x31')];return getAgent(_0x4f81a5)[_0x912c('0x1c')](function(_0x49c27d){logger[_0x912c('0x12')]('entityFound:',_0x49c27d[_0x912c('0x17')]);emit(util[_0x912c('0x32')](_0x912c('0x33'),_0x49c27d[_0x912c('0x17')]),_0x912c('0x34'),{'callNumber':_0xac916a,'callerId':_0x46374e,'callbackUrl':_0x1cc699});return _0x54df3b[_0x912c('0x18')](0xc8)[_0x912c('0x2f')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x54df3b));};exports[_0x912c('0x35')]=function(_0x46e27f,_0x11448b){logger[_0x912c('0x12')]('hangup\x20fired:',_0x46e27f[_0x912c('0x2e')]);var _0x333e32=hangupValidation['validate'](_0x46e27f[_0x912c('0x2e')]);if(_0x333e32['length']>0x0){return _0x11448b[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0x333e32);}var _0xa6e2ac=_0x46e27f[_0x912c('0x2e')]['userId'];var _0x155282=_0x46e27f[_0x912c('0x2e')][_0x912c('0x29')];return getAgent(_0xa6e2ac)['then'](function(_0x248578){logger[_0x912c('0x12')](_0x912c('0x36'),_0x248578[_0x912c('0x17')]);emit(util[_0x912c('0x32')](_0x912c('0x33'),_0x248578[_0x912c('0x17')]),_0x912c('0x37'),{'sessionId':_0x155282});return _0x11448b[_0x912c('0x18')](0xc8)[_0x912c('0x2f')]({'error':![],'message':_0x912c('0x38')});})['catch'](handleError(_0x11448b));};exports[_0x912c('0x39')]=function(_0x2efb97,_0x5bdae7){logger[_0x912c('0x12')](_0x912c('0x3a'),_0x2efb97['body']);var _0xa2bea4=answerValidation[_0x912c('0xb')](_0x2efb97[_0x912c('0x2e')]);if(_0xa2bea4[_0x912c('0x2a')]>0x0){return _0x5bdae7[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0xa2bea4);}var _0x29954d=_0x2efb97['body'][_0x912c('0x30')];var _0x5cfbc8=_0x2efb97[_0x912c('0x2e')]['sessionId'];return getAgent(_0x29954d)['then'](function(_0x43c556){logger[_0x912c('0x12')](_0x912c('0x36'),_0x43c556[_0x912c('0x17')]);emit(util[_0x912c('0x32')](_0x912c('0x33'),_0x43c556[_0x912c('0x17')]),'webbar:answer',{'sessionId':_0x5cfbc8});return _0x5bdae7[_0x912c('0x18')](0xc8)[_0x912c('0x2f')]({'error':![],'message':_0x912c('0x3b')});})['catch'](handleError(_0x5bdae7));};exports[_0x912c('0x3c')]=function(_0x81c142,_0x129025){logger['info']('hold\x20fired:',_0x81c142[_0x912c('0x2e')]);var _0x42482c=holdValidation[_0x912c('0xb')](_0x81c142[_0x912c('0x2e')]);if(_0x42482c['length']>0x0){return _0x129025[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0x42482c);}var _0x25769c=_0x81c142[_0x912c('0x2e')][_0x912c('0x30')];var _0x5e69ff=_0x81c142['body'][_0x912c('0x29')];return getAgent(_0x25769c)['then'](function(_0x515477){logger['info']('entityFound:',_0x515477[_0x912c('0x17')]);emit(util[_0x912c('0x32')](_0x912c('0x33'),_0x515477['name']),'webbar:hold',{'sessionId':_0x5e69ff});return _0x129025[_0x912c('0x18')](0xc8)[_0x912c('0x2f')]({'error':![],'message':_0x912c('0x3d')});})['catch'](handleError(_0x129025));};exports[_0x912c('0x3e')]=function(_0x402877,_0x12f114){logger[_0x912c('0x12')](_0x912c('0x3f'),_0x402877[_0x912c('0x2e')]);var _0x1e5105=unholdValidation[_0x912c('0xb')](_0x402877[_0x912c('0x2e')]);if(_0x1e5105[_0x912c('0x2a')]>0x0){return _0x12f114[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0x1e5105);}var _0x20e3e3=_0x402877[_0x912c('0x2e')][_0x912c('0x30')];var _0x19c88b=_0x402877[_0x912c('0x2e')][_0x912c('0x29')];return getAgent(_0x20e3e3)[_0x912c('0x1c')](function(_0x2b0186){logger[_0x912c('0x12')](_0x912c('0x36'),_0x2b0186[_0x912c('0x17')]);emit(util[_0x912c('0x32')]('user:%s',_0x2b0186['name']),_0x912c('0x40'),{'sessionId':_0x19c88b});return _0x12f114[_0x912c('0x18')](0xc8)[_0x912c('0x2f')]({'error':![],'message':_0x912c('0x41')});})[_0x912c('0x20')](handleError(_0x12f114));};exports[_0x912c('0x42')]=function(_0x5986ee,_0x56f576){logger[_0x912c('0x12')]('calls\x20fired:',_0x56f576['body']);var _0x248614=callsValidation[_0x912c('0xb')](_0x5986ee['body']);if(_0x248614['length']>0x0){return _0x56f576['status'](0x190)[_0x912c('0x2f')](_0x248614);}var _0x1543a9=_0x5986ee['body'][_0x912c('0x30')];var _0xd4cb07=respondWithRpcPromise(_0x912c('0x24'));var _0x1edab9=getAgent(_0x1543a9);return Promise[_0x912c('0x25')]([_0xd4cb07,_0x1edab9])['then'](function(_0x3f409e){var _0x1e94b4=_0x3f409e[0x0];var _0x1590ac=_0x3f409e[0x1];var _0x8a48d1=_['filter'](_0x1e94b4[_0x912c('0x27')],function(_0x58af3e){return _0x58af3e[_0x912c('0x28')]==_0x1590ac['id'];});return _0x56f576['status'](0xc8)[_0x912c('0x2f')]({'count':_0x8a48d1[_0x912c('0x2a')],'rows':_0x8a48d1});})[_0x912c('0x20')](handleError(_0x56f576));};exports[_0x912c('0x43')]=function(_0x5b2662,_0x373df5){logger[_0x912c('0x12')](_0x912c('0x44'),_0x5b2662[_0x912c('0x2e')]);var _0x2cf332=conferenceValidation[_0x912c('0xb')](_0x5b2662[_0x912c('0x2e')]);if(_0x2cf332['length']>0x0){return _0x373df5[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0x2cf332);}var _0xefdc56=_0x5b2662['body'][_0x912c('0x30')];return getAgent(_0xefdc56)[_0x912c('0x1c')](function(_0x3e2b44){logger[_0x912c('0x12')](_0x912c('0x36'),_0x3e2b44[_0x912c('0x17')]);emit(util[_0x912c('0x32')]('user:%s',_0x3e2b44[_0x912c('0x17')]),_0x912c('0x45'));return _0x373df5[_0x912c('0x18')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x912c('0x20')](handleError(_0x373df5));};exports[_0x912c('0x46')]=function(_0x1b82cf,_0x336b76){logger[_0x912c('0x12')](_0x912c('0x47'),_0x1b82cf[_0x912c('0x2e')]);var _0x45118b=transferValidation[_0x912c('0xb')](_0x1b82cf[_0x912c('0x2e')]);if(_0x45118b[_0x912c('0x2a')]>0x0){return _0x336b76[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0x45118b);}var _0x447ea0=_0x1b82cf[_0x912c('0x2e')][_0x912c('0x30')];var _0x4ccf2d=_0x1b82cf[_0x912c('0x2e')][_0x912c('0x29')];var _0x50df99=_0x1b82cf[_0x912c('0x2e')][_0x912c('0x48')];return getAgent(_0x447ea0)[_0x912c('0x1c')](function(_0x3408b){logger[_0x912c('0x12')](_0x912c('0x36'),_0x3408b['name']);emit(util[_0x912c('0x32')](_0x912c('0x33'),_0x3408b[_0x912c('0x17')]),'webbar:transfer',{'sessionId':_0x4ccf2d,'transferNumber':_0x50df99});return _0x336b76[_0x912c('0x18')](0xc8)['json']({'error':![],'message':_0x912c('0x49')});})['catch'](handleError(_0x336b76));}; \ No newline at end of file +var _0xc99a=['code','message','result','User','findOne','UserId','sessionId','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callerId','format','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','entityFound:','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','all','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','number','transferNumber\x20is\x20required','info','log','handleError:','error','stack','name','send','status','request','then'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0xc99a,0x7c));var _0xac99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc99a[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xac99('0x0'));var fs=require('fs');var _=require(_0xac99('0x1'));var db=require(_0xac99('0x2'))['db'];var config=require(_0xac99('0x3'));var util=require(_0xac99('0x4'));var BPromise=require(_0xac99('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xac99('0x6')][_0xac99('0x7')]({'port':0x232a});var logger=require(_0xac99('0x8'))(_0xac99('0x9'));var Redis=require(_0xac99('0xa'));config[_0xac99('0xb')]=_[_0xac99('0xc')](config[_0xac99('0xb')],{'host':_0xac99('0xd'),'port':0x18eb});var io=require(_0xac99('0xe'))(new Redis(config[_0xac99('0xb')]));var Schema=require(_0xac99('0xf'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xac99('0x10')]},'callNumber':{'type':_0xac99('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xac99('0x11')},'callbackUrl':{'type':_0xac99('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xac99('0x12'),'required':[!![],_0xac99('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xac99('0x12'),'required':[!![],_0xac99('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xac99('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xac99('0x11'),'required':[!![],_0xac99('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xac99('0x12'),'required':[!![],_0xac99('0x10')]},'sessionId':{'type':_0xac99('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xac99('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xac99('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xac99('0x12'),'required':[!![],_0xac99('0x10')]}});function emit(_0x5cd3fd,_0x3ff09c,_0x3be7d3){logger[_0xac99('0x14')](_0x5cd3fd,_0x3ff09c,JSON['stringify'](_0x3be7d3));io['to'](_0x5cd3fd)['emit'](_0x3ff09c,_0x3be7d3);}function handleError(_0x8a45d3){return function(_0x2d5a20){console[_0xac99('0x15')](_0xac99('0x16'),_0x2d5a20,_0x2d5a20 instanceof RangeError);logger[_0xac99('0x17')](_0x2d5a20[_0xac99('0x18')]);if(_0x2d5a20 instanceof RangeError){if(_0x2d5a20[_0xac99('0x19')]){delete _0x2d5a20['name'];}_0x8a45d3['status'](0x194)[_0xac99('0x1a')](_0x2d5a20);}else{if(_0x2d5a20[_0xac99('0x19')]){delete _0x2d5a20['name'];}_0x8a45d3[_0xac99('0x1b')](0x1f4)[_0xac99('0x1a')](_0x2d5a20);}};}function checkError(){return function(_0x4f9889){if(!_0x4f9889){throw new RangeError('NotFound');}return _0x4f9889;};}function respondWithRpcPromise(_0x42af82,_0x3d057c){return new BPromise(function(_0x38917d,_0x154f4b){var _0x2b7e52=amiClient;return _0x2b7e52[_0xac99('0x1c')](_0x42af82,_0x3d057c)[_0xac99('0x1d')](function(_0x1a39fd){if(_0x1a39fd[_0xac99('0x17')]){if(_0x1a39fd['error'][_0xac99('0x1e')]===0x1f4){return _0x154f4b(_0x1a39fd[_0xac99('0x17')][_0xac99('0x1f')]);}return _0x38917d(_0x1a39fd[_0xac99('0x17')][_0xac99('0x1f')]);}else{_0x38917d(_0x1a39fd[_0xac99('0x20')]);}})['catch'](function(_0xb8e570){_0x154f4b(_0xb8e570);});});}function getAgent(_0x4480fb){return db[_0xac99('0x21')][_0xac99('0x22')]({'where':{'id':_0x4480fb,'role':'agent'}})[_0xac99('0x1d')](checkError());}function getAgentCheckSession(_0x599ebc,_0x3649d1){return new BPromise(function(_0x2423fc,_0x44ee40){var _0x597063=respondWithRpcPromise('VoiceChannels');var _0x353630=getAgent(_0x599ebc);Promise['all']([_0x597063,_0x353630])['then'](function(_0xa4b35e){var _0x38ff85=_0xa4b35e[0x0];var _0x599f62=_0xa4b35e[0x1];var _0x5b6f60=_['filter'](_0x38ff85['rows'],function(_0x44fa13){return _0x44fa13[_0xac99('0x23')]==_0x599f62['id']&&_0x44fa13[_0xac99('0x24')]==_0x3649d1;});if(_0x5b6f60['length']==0x1){_0x2423fc(_0x599f62);}else{_0x44ee40(new RangeError('sessionId\x20'+_0x3649d1+_0xac99('0x25')));}});});}exports[_0xac99('0x26')]=function(_0x47d8d4,_0x271770){logger[_0xac99('0x14')](_0xac99('0x27'),_0x47d8d4[_0xac99('0x28')]);var _0x319ef3=originateValidation[_0xac99('0xf')](_0x47d8d4[_0xac99('0x28')]);if(_0x319ef3[_0xac99('0x29')]>0x0){return _0x271770['status'](0x190)[_0xac99('0x2a')](_0x319ef3);}var _0x59048e=_0x47d8d4[_0xac99('0x28')][_0xac99('0x2b')];var _0x149c23=_0x47d8d4[_0xac99('0x28')]['callNumber'];var _0x112544=_0x47d8d4['body'][_0xac99('0x2c')];var _0x24ec5c=_0x47d8d4[_0xac99('0x28')]['callbackUrl'];return getAgent(_0x59048e)[_0xac99('0x1d')](function(_0x2b4d83){logger[_0xac99('0x14')]('entityFound:',_0x2b4d83['name']);emit(util[_0xac99('0x2d')]('user:%s',_0x2b4d83[_0xac99('0x19')]),_0xac99('0x2e'),{'callNumber':_0x149c23,'callerId':_0x112544,'callbackUrl':_0x24ec5c});return _0x271770[_0xac99('0x1b')](0xc8)[_0xac99('0x2a')]({'error':![],'message':_0xac99('0x2f')});})[_0xac99('0x30')](handleError(_0x271770));};exports[_0xac99('0x31')]=function(_0x3de54e,_0x4ddecf){logger[_0xac99('0x14')](_0xac99('0x32'),_0x3de54e['body']);var _0x5c385c=hangupValidation[_0xac99('0xf')](_0x3de54e[_0xac99('0x28')]);if(_0x5c385c[_0xac99('0x29')]>0x0){return _0x4ddecf[_0xac99('0x1b')](0x190)[_0xac99('0x2a')](_0x5c385c);}var _0x427c60=_0x3de54e[_0xac99('0x28')][_0xac99('0x2b')];var _0x18e88c=_0x3de54e[_0xac99('0x28')][_0xac99('0x24')];return getAgent(_0x427c60)[_0xac99('0x1d')](function(_0x18ad46){logger[_0xac99('0x14')](_0xac99('0x33'),_0x18ad46[_0xac99('0x19')]);emit(util[_0xac99('0x2d')](_0xac99('0x34'),_0x18ad46['name']),_0xac99('0x35'),{'sessionId':_0x18e88c});return _0x4ddecf[_0xac99('0x1b')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x4ddecf));};exports[_0xac99('0x36')]=function(_0x1bea17,_0x28aaea){logger[_0xac99('0x14')](_0xac99('0x37'),_0x1bea17[_0xac99('0x28')]);var _0x48d5e8=answerValidation['validate'](_0x1bea17[_0xac99('0x28')]);if(_0x48d5e8[_0xac99('0x29')]>0x0){return _0x28aaea['status'](0x190)[_0xac99('0x2a')](_0x48d5e8);}var _0x3bdce6=_0x1bea17[_0xac99('0x28')]['userId'];var _0x172f1a=_0x1bea17[_0xac99('0x28')][_0xac99('0x24')];return getAgent(_0x3bdce6)[_0xac99('0x1d')](function(_0x1144ef){logger['info'](_0xac99('0x33'),_0x1144ef[_0xac99('0x19')]);emit(util['format']('user:%s',_0x1144ef['name']),_0xac99('0x38'),{'sessionId':_0x172f1a});return _0x28aaea['status'](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0xac99('0x30')](handleError(_0x28aaea));};exports[_0xac99('0x39')]=function(_0x35ae24,_0xe4003e){logger['info'](_0xac99('0x3a'),_0x35ae24['body']);var _0x382cc8=holdValidation['validate'](_0x35ae24[_0xac99('0x28')]);if(_0x382cc8['length']>0x0){return _0xe4003e['status'](0x190)[_0xac99('0x2a')](_0x382cc8);}var _0x5c6254=_0x35ae24['body'][_0xac99('0x2b')];var _0x5a7de6=_0x35ae24[_0xac99('0x28')][_0xac99('0x24')];return getAgent(_0x5c6254)[_0xac99('0x1d')](function(_0x3df087){logger['info']('entityFound:',_0x3df087[_0xac99('0x19')]);emit(util[_0xac99('0x2d')](_0xac99('0x34'),_0x3df087[_0xac99('0x19')]),_0xac99('0x3b'),{'sessionId':_0x5a7de6});return _0xe4003e[_0xac99('0x1b')](0xc8)[_0xac99('0x2a')]({'error':![],'message':_0xac99('0x3c')});})[_0xac99('0x30')](handleError(_0xe4003e));};exports['unhold']=function(_0x5c14fb,_0x47dcb1){logger[_0xac99('0x14')](_0xac99('0x3d'),_0x5c14fb[_0xac99('0x28')]);var _0x2f257f=unholdValidation[_0xac99('0xf')](_0x5c14fb[_0xac99('0x28')]);if(_0x2f257f[_0xac99('0x29')]>0x0){return _0x47dcb1[_0xac99('0x1b')](0x190)[_0xac99('0x2a')](_0x2f257f);}var _0x4cd670=_0x5c14fb[_0xac99('0x28')][_0xac99('0x2b')];var _0x586f70=_0x5c14fb[_0xac99('0x28')]['sessionId'];return getAgent(_0x4cd670)[_0xac99('0x1d')](function(_0x45ae39){logger[_0xac99('0x14')]('entityFound:',_0x45ae39[_0xac99('0x19')]);emit(util['format']('user:%s',_0x45ae39[_0xac99('0x19')]),_0xac99('0x3e'),{'sessionId':_0x586f70});return _0x47dcb1[_0xac99('0x1b')](0xc8)[_0xac99('0x2a')]({'error':![],'message':_0xac99('0x3f')});})[_0xac99('0x30')](handleError(_0x47dcb1));};exports[_0xac99('0x40')]=function(_0x53f0dc,_0x138750){logger[_0xac99('0x14')](_0xac99('0x41'),_0x138750[_0xac99('0x28')]);var _0x17389b=callsValidation[_0xac99('0xf')](_0x53f0dc['body']);if(_0x17389b[_0xac99('0x29')]>0x0){return _0x138750['status'](0x190)[_0xac99('0x2a')](_0x17389b);}var _0x5df7a3=_0x53f0dc[_0xac99('0x28')][_0xac99('0x2b')];var _0x1afce0=respondWithRpcPromise(_0xac99('0x42'));var _0x28c3cf=getAgent(_0x5df7a3);return Promise[_0xac99('0x43')]([_0x1afce0,_0x28c3cf])[_0xac99('0x1d')](function(_0x88891f){var _0x4009b3=_0x88891f[0x0];var _0x3aad46=_0x88891f[0x1];var _0x4614ac=_['filter'](_0x4009b3[_0xac99('0x44')],function(_0x3fb91d){return _0x3fb91d['UserId']==_0x3aad46['id'];});return _0x138750[_0xac99('0x1b')](0xc8)[_0xac99('0x2a')]({'count':_0x4614ac['length'],'rows':_0x4614ac});})[_0xac99('0x30')](handleError(_0x138750));};exports[_0xac99('0x45')]=function(_0x2ada9d,_0x3d989c){logger[_0xac99('0x14')](_0xac99('0x46'),_0x2ada9d[_0xac99('0x28')]);var _0x5768dc=conferenceValidation['validate'](_0x2ada9d[_0xac99('0x28')]);if(_0x5768dc[_0xac99('0x29')]>0x0){return _0x3d989c[_0xac99('0x1b')](0x190)[_0xac99('0x2a')](_0x5768dc);}var _0x21b2af=_0x2ada9d[_0xac99('0x28')][_0xac99('0x2b')];return getAgent(_0x21b2af)['then'](function(_0x73fa6){logger[_0xac99('0x14')](_0xac99('0x33'),_0x73fa6[_0xac99('0x19')]);emit(util['format'](_0xac99('0x34'),_0x73fa6[_0xac99('0x19')]),_0xac99('0x47'));return _0x3d989c[_0xac99('0x1b')](0xc8)['json']({'error':![],'message':_0xac99('0x48')});})['catch'](handleError(_0x3d989c));};exports[_0xac99('0x49')]=function(_0x39f9ea,_0x3d3462){logger[_0xac99('0x14')](_0xac99('0x4a'),_0x39f9ea[_0xac99('0x28')]);var _0x3a9fa5=transferValidation[_0xac99('0xf')](_0x39f9ea[_0xac99('0x28')]);if(_0x3a9fa5[_0xac99('0x29')]>0x0){return _0x3d3462[_0xac99('0x1b')](0x190)[_0xac99('0x2a')](_0x3a9fa5);}var _0x36efb5=_0x39f9ea[_0xac99('0x28')][_0xac99('0x2b')];var _0x2b022b=_0x39f9ea[_0xac99('0x28')][_0xac99('0x24')];var _0x4d274e=_0x39f9ea[_0xac99('0x28')][_0xac99('0x4b')];return getAgent(_0x36efb5)['then'](function(_0x4bcffa){logger['info'](_0xac99('0x33'),_0x4bcffa['name']);emit(util[_0xac99('0x2d')](_0xac99('0x34'),_0x4bcffa[_0xac99('0x19')]),'webbar:transfer',{'sessionId':_0x2b022b,'transferNumber':_0x4d274e});return _0x3d3462[_0xac99('0x1b')](0xc8)[_0xac99('0x2a')]({'error':![],'message':_0xac99('0x4c')});})[_0xac99('0x30')](handleError(_0x3d3462));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index fb224f1..7879981 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 _0x3781=['../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addDisposition','addAnswer','addAgents','/:id/send','send','delete','/:id','destroy','removeDispositions','removeAnswers','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4da493,_0x15e45a){var _0x33e403=function(_0x11dfd3){while(--_0x11dfd3){_0x4da493['push'](_0x4da493['shift']());}};_0x33e403(++_0x15e45a);}(_0x3781,0x79));var _0x1378=function(_0x2fb19b,_0x19acbd){_0x2fb19b=_0x2fb19b-0x0;var _0x3f6666=_0x3781[_0x2fb19b];return _0x3f6666;};'use strict';var multer=require(_0x1378('0x0'));var util=require(_0x1378('0x1'));var path=require(_0x1378('0x2'));var timeout=require('connect-timeout');var express=require(_0x1378('0x3'));var router=express[_0x1378('0x4')]();var auth=require(_0x1378('0x5'));var interaction=require(_0x1378('0x6'));var config=require(_0x1378('0x7'));var controller=require(_0x1378('0x8'));router[_0x1378('0x9')]('/',auth[_0x1378('0xa')](),controller[_0x1378('0xb')]);router[_0x1378('0x9')](_0x1378('0xc'),auth[_0x1378('0xa')](),controller[_0x1378('0xd')]);router[_0x1378('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1378('0xe')]);router[_0x1378('0x9')](_0x1378('0xf'),auth[_0x1378('0xa')](),controller['getDispositions']);router[_0x1378('0x9')](_0x1378('0x10'),auth[_0x1378('0xa')](),controller[_0x1378('0x11')]);router[_0x1378('0x9')](_0x1378('0x12'),auth[_0x1378('0xa')](),controller['getAgents']);router['get'](_0x1378('0x13'),auth[_0x1378('0xa')](),controller[_0x1378('0x14')]);router[_0x1378('0x15')]('/',auth[_0x1378('0xa')](),controller['create']);router[_0x1378('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x1378('0x16')]);router[_0x1378('0x15')](_0x1378('0x10'),auth[_0x1378('0xa')](),controller[_0x1378('0x17')]);router['post']('/:id/users',auth[_0x1378('0xa')](),controller[_0x1378('0x18')]);router[_0x1378('0x15')](_0x1378('0x13'),auth[_0x1378('0xa')](),controller['addApplications']);router[_0x1378('0x15')]('/:id/notify',controller['notify']);router[_0x1378('0x15')](_0x1378('0x19'),auth['isAuthenticated'](),controller[_0x1378('0x1a')]);router['put']('/:id',auth[_0x1378('0xa')](),controller['update']);router[_0x1378('0x1b')](_0x1378('0x1c'),auth[_0x1378('0xa')](),controller[_0x1378('0x1d')]);router[_0x1378('0x1b')](_0x1378('0xf'),auth['isAuthenticated'](),controller[_0x1378('0x1e')]);router[_0x1378('0x1b')](_0x1378('0x10'),auth[_0x1378('0xa')](),controller[_0x1378('0x1f')]);router['delete'](_0x1378('0x12'),auth[_0x1378('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xdae5=['show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','create','post','addDisposition','addApplications','notify','send','destroy','delete','removeAnswers','/:id/users','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4b043a,_0x268f80){var _0x2bc97a=function(_0x3e6d2a){while(--_0x3e6d2a){_0x4b043a['push'](_0x4b043a['shift']());}};_0x2bc97a(++_0x268f80);}(_0xdae5,0xf8));var _0x5dae=function(_0x19cdc8,_0x1ea53c){_0x19cdc8=_0x19cdc8-0x0;var _0x22fecc=_0xdae5[_0x19cdc8];return _0x22fecc;};'use strict';var multer=require(_0x5dae('0x0'));var util=require(_0x5dae('0x1'));var path=require(_0x5dae('0x2'));var timeout=require(_0x5dae('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x5dae('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5dae('0x5'));var controller=require(_0x5dae('0x6'));router[_0x5dae('0x7')]('/',auth[_0x5dae('0x8')](),controller[_0x5dae('0x9')]);router[_0x5dae('0x7')](_0x5dae('0xa'),auth[_0x5dae('0x8')](),controller[_0x5dae('0xb')]);router[_0x5dae('0x7')](_0x5dae('0xc'),auth[_0x5dae('0x8')](),controller[_0x5dae('0xd')]);router['get'](_0x5dae('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x5dae('0x7')](_0x5dae('0xf'),auth[_0x5dae('0x8')](),controller[_0x5dae('0x10')]);router[_0x5dae('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x5dae('0x7')](_0x5dae('0x11'),auth[_0x5dae('0x8')](),controller['getApplications']);router['post']('/',auth['isAuthenticated'](),controller[_0x5dae('0x12')]);router[_0x5dae('0x13')](_0x5dae('0xe'),auth[_0x5dae('0x8')](),controller[_0x5dae('0x14')]);router[_0x5dae('0x13')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x5dae('0x13')]('/:id/users',auth[_0x5dae('0x8')](),controller['addAgents']);router[_0x5dae('0x13')]('/:id/applications',auth[_0x5dae('0x8')](),controller[_0x5dae('0x15')]);router['post']('/:id/notify',controller[_0x5dae('0x16')]);router[_0x5dae('0x13')]('/:id/send',auth[_0x5dae('0x8')](),controller[_0x5dae('0x17')]);router['put'](_0x5dae('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5dae('0xc'),auth[_0x5dae('0x8')](),controller[_0x5dae('0x18')]);router['delete'](_0x5dae('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5dae('0x19')]('/:id/canned_answers',auth[_0x5dae('0x8')](),controller[_0x5dae('0x1a')]);router[_0x5dae('0x19')](_0x5dae('0x1b'),auth[_0x5dae('0x8')](),controller['removeAgents']);module[_0x5dae('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 9512729..14a5335 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 _0xf441=['generate','twilio','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','name','STRING'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xf441,0xa4));var _0x1f44=function(_0x5ac2ff,_0xc342de){_0x5ac2ff=_0x5ac2ff-0x0;var _0x152512=_0xf441[_0x5ac2ff];return _0x152512;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x1f44('0x0'));module[_0x1f44('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1f44('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x1f44('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x1f44('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x1f44('0x3')],'defaultValue':function(){return rs[_0x1f44('0x4')]();}},'phone':{'type':Sequelize[_0x1f44('0x3')]},'type':{'type':Sequelize['ENUM'](_0x1f44('0x5'))},'accountSid':{'type':Sequelize[_0x1f44('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1f44('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1f44('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1f44('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1f44('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1f44('0x7')],'comment':_0x1f44('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1f44('0x9'),'set':function(_0x338427){if(!_0x338427){this[_0x1f44('0xa')](_0x1f44('0xb'),null);}this[_0x1f44('0xa')]('mandatoryDisposition',_0x338427);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2520=['generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','randomstring','exports','STRING','name'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2520,0x175));var _0x0252=function(_0x1986b7,_0x2186bf){_0x1986b7=_0x1986b7-0x0;var _0x49d5d8=_0x2520[_0x1986b7];return _0x49d5d8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0252('0x0'));module[_0x0252('0x1')]={'name':{'type':Sequelize[_0x0252('0x2')],'unique':_0x0252('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0252('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x0252('0x2')],'defaultValue':function(){return rs[_0x0252('0x4')]();}},'phone':{'type':Sequelize[_0x0252('0x2')]},'type':{'type':Sequelize[_0x0252('0x5')](_0x0252('0x6'))},'accountSid':{'type':Sequelize[_0x0252('0x2')]},'authToken':{'type':Sequelize[_0x0252('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0252('0x7')],'defaultValue':function(){return _0x0252('0x8');}},'notificationSound':{'type':Sequelize[_0x0252('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x0252('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0252('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0252('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0252('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0252('0x9')],'defaultValue':![],'comment':_0x0252('0xb'),'set':function(_0x28467a){if(!_0x28467a){this['setDataValue']('mandatoryDispositionPauseId',null);}this['setDataValue'](_0x0252('0xc'),_0x28467a);}},'description':{'type':Sequelize[_0x0252('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 819ed4a..8b72b9c 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 _0xd8b0=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','sendStatus','end','status','limit','set','apply','reject','save','update','then','get','WhatsappAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','offset','sort','filter','merge','where','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','fields','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','params','describe','addDisposition','getDispositions','findOne','Disposition','order','pick','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','removeAgents','emit','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','applications','orderBy','account','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','DESC','contact','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','json','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','WhatsappInteraction','out','Messages','dataValues','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse'];(function(_0x2fd9be,_0x173916){var _0x32a61a=function(_0x4f6eba){while(--_0x4f6eba){_0x2fd9be['push'](_0x2fd9be['shift']());}};_0x32a61a(++_0x173916);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];config[_0x0d8b('0x16')]=_[_0x0d8b('0x17')](config[_0x0d8b('0x16')],{'host':_0x0d8b('0x18'),'port':0x18eb});var socket=require(_0x0d8b('0x19'))(new Redis(config[_0x0d8b('0x16')]));require(_0x0d8b('0x1a'))[_0x0d8b('0x1b')](socket);var jayson=require(_0x0d8b('0x1c'));var client=jayson[_0x0d8b('0x1d')][_0x0d8b('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x2d4e1c,_0x4f6f21,_0x23eb7b){if(_0x23eb7b){var _0xa86349=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa86349[_0x0d8b('0x1f')](_0x4f6f21)){return _0x2d4e1c;}else{throw new db[(_0x0d8b('0x20'))][(_0x0d8b('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 _0x2d4e1c;}}function respondWithRpcPromise(_0x106a01,_0x4586c2,_0x2fd0fc,_0x5fecbd){return new BPromise(function(_0x333674,_0x18dd2d){var _0x264b39=_0x5fecbd||client;return _0x264b39[_0x0d8b('0x22')](_0x106a01,_0x2fd0fc)['then'](function(_0x27512e){logger[_0x0d8b('0x23')](_0x0d8b('0x24'),_0x4586c2,_0x0d8b('0x25'));logger[_0x0d8b('0x26')](_0x0d8b('0x27'),_0x4586c2,_0x0d8b('0x25'),JSON[_0x0d8b('0x28')](_0x27512e));if(_0x27512e['error']){if(_0x27512e['error'][_0x0d8b('0x29')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4586c2,_0x27512e['error'][_0x0d8b('0x2a')]);return _0x18dd2d(_0x27512e[_0x0d8b('0x2b')][_0x0d8b('0x2a')]);}logger[_0x0d8b('0x2b')](_0x0d8b('0x24'),_0x4586c2,_0x27512e[_0x0d8b('0x2b')][_0x0d8b('0x2a')]);return _0x333674(_0x27512e[_0x0d8b('0x2b')][_0x0d8b('0x2a')]);}else{logger['info'](_0x0d8b('0x24'),_0x4586c2,_0x0d8b('0x25'));_0x333674(_0x27512e['result'][_0x0d8b('0x2a')]);}})['catch'](function(_0x3dd149){logger[_0x0d8b('0x2b')](_0x0d8b('0x24'),_0x4586c2,_0x3dd149);_0x18dd2d(_0x3dd149);});});}function respondWithStatusCode(_0x4fe6f9,_0x59a905){_0x59a905=_0x59a905||0xcc;return function(_0x28f639){if(_0x28f639){return _0x4fe6f9[_0x0d8b('0x2c')](_0x59a905);}return _0x4fe6f9['status'](_0x59a905)[_0x0d8b('0x2d')]();};}function respondWithResult(_0x59aa83,_0x1b2b59){_0x1b2b59=_0x1b2b59||0xc8;return function(_0x4b59e5){if(_0x4b59e5){return _0x59aa83[_0x0d8b('0x2e')](_0x1b2b59)['json'](_0x4b59e5);}};}function respondWithFilteredResult(_0x2ab00d,_0x546bf6){return function(_0x3829c6){if(_0x3829c6){var _0x544735=_0x3829c6['count'],_0x3c8887=_0x546bf6['offset'],_0x106e4c=_0x546bf6['offset']+_0x546bf6[_0x0d8b('0x2f')],_0x2c058d;if(_0x106e4c>=_0x544735){_0x106e4c=_0x544735;_0x2c058d=0xc8;}else{_0x2c058d=0xce;}_0x2ab00d['status'](_0x2c058d);return _0x2ab00d[_0x0d8b('0x30')]('Content-Range',_0x3c8887+'-'+_0x106e4c+'/'+_0x544735)['json'](_0x3829c6);}return null;};}function patchUpdates(_0x36017a){return function(_0x1b6920){try{jsonpatch[_0x0d8b('0x31')](_0x1b6920,_0x36017a,!![]);}catch(_0xdeee5d){return BPromise[_0x0d8b('0x32')](_0xdeee5d);}return _0x1b6920[_0x0d8b('0x33')]();};}function saveUpdates(_0x4a99d3,_0x6f93c7){return function(_0x553e03){if(_0x553e03){return _0x553e03[_0x0d8b('0x34')](_0x4a99d3)[_0x0d8b('0x35')](function(_0x4b3ea0){return _0x4b3ea0;});}return null;};}function removeEntity(_0xb18586,_0x23f7f6){return function(_0x18a905){if(_0x18a905){return _0x18a905['destroy']()[_0x0d8b('0x35')](function(){var _0x2c507e=_0x18a905[_0x0d8b('0x36')]({'plain':!![]});var _0x31ceba=_0x0d8b('0x37');return db['UserProfileResource'][_0x0d8b('0x38')]({'where':{'type':_0x31ceba,'resourceId':_0x2c507e['id']}})[_0x0d8b('0x35')](function(){return _0x18a905;});})['then'](function(){_0xb18586[_0x0d8b('0x2e')](0xcc)[_0x0d8b('0x2d')]();});}};}function handleEntityNotFound(_0x188af2,_0x974b9b){return function(_0x373544){if(!_0x373544){_0x188af2['sendStatus'](0x194);}return _0x373544;};}function handleError(_0x497a71,_0x41b4f9){_0x41b4f9=_0x41b4f9||0x1f4;return function(_0x5c2c04){logger['error'](_0x5c2c04[_0x0d8b('0x39')]);if(_0x5c2c04[_0x0d8b('0x3a')]){delete _0x5c2c04[_0x0d8b('0x3a')];}_0x497a71[_0x0d8b('0x2e')](_0x41b4f9)[_0x0d8b('0x3b')](_0x5c2c04);};}exports[_0x0d8b('0x3c')]=function(_0x579324,_0x6e5bab){var _0x6a02ad={'include':[{'model':db[_0x0d8b('0x3d')],'as':_0x0d8b('0x3e')}]},_0x28fd82={},_0xe8fad={'count':0x0,'rows':[]};var _0xf1680e=_['map'](db[_0x0d8b('0x3f')][_0x0d8b('0x40')],function(_0x3fa955){return{'name':_0x3fa955[_0x0d8b('0x41')],'type':_0x3fa955['type'][_0x0d8b('0x42')]};});_0x28fd82['model']=_[_0x0d8b('0x43')](_0xf1680e,_0x0d8b('0x3a'));_0x28fd82[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x579324[_0x0d8b('0x44')]);_0x28fd82[_0x0d8b('0x46')]=_[_0x0d8b('0x47')](_0x28fd82[_0x0d8b('0x48')],_0x28fd82[_0x0d8b('0x44')]);_0x6a02ad[_0x0d8b('0x49')]=_['intersection'](_0x28fd82['model'],qs['fields'](_0x579324['query']['fields']));_0x6a02ad[_0x0d8b('0x49')]=_0x6a02ad[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0x6a02ad['attributes']:_0x28fd82['model'];if(!_0x579324[_0x0d8b('0x44')][_0x0d8b('0x4b')](_0x0d8b('0x4c'))){_0x6a02ad['limit']=qs[_0x0d8b('0x2f')](_0x579324[_0x0d8b('0x44')]['limit']);_0x6a02ad['offset']=qs[_0x0d8b('0x4d')](_0x579324['query'][_0x0d8b('0x4d')]);}_0x6a02ad['order']=qs['sort'](_0x579324[_0x0d8b('0x44')][_0x0d8b('0x4e')]);_0x6a02ad['where']=qs['filters'](_['pick'](_0x579324['query'],_0x28fd82[_0x0d8b('0x46')]),_0xf1680e);if(_0x579324[_0x0d8b('0x44')][_0x0d8b('0x4f')]){_0x6a02ad['where']=_[_0x0d8b('0x50')](_0x6a02ad[_0x0d8b('0x51')],{'$or':_[_0x0d8b('0x43')](_0xf1680e,function(_0x98a67a){if(_0x98a67a[_0x0d8b('0x52')]!==_0x0d8b('0x53')){var _0x11d22b={};_0x11d22b[_0x98a67a[_0x0d8b('0x3a')]]={'$like':'%'+_0x579324[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x11d22b;}})});}_0x6a02ad=_[_0x0d8b('0x50')]({},_0x6a02ad,_0x579324[_0x0d8b('0x54')]);var _0x84ef1c={'where':_0x6a02ad[_0x0d8b('0x51')]};return db[_0x0d8b('0x3f')][_0x0d8b('0x55')](_0x84ef1c)[_0x0d8b('0x35')](function(_0x1e162c){_0xe8fad[_0x0d8b('0x55')]=_0x1e162c;if(_0x579324['query'][_0x0d8b('0x56')]){_0x6a02ad['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x0d8b('0x57')](_0x6a02ad);})[_0x0d8b('0x35')](function(_0x3f943a){_0xe8fad[_0x0d8b('0x58')]=_0x3f943a;return _0xe8fad;})['then'](respondWithFilteredResult(_0x6e5bab,_0x6a02ad))[_0x0d8b('0x59')](handleError(_0x6e5bab,null));};exports[_0x0d8b('0x5a')]=function(_0x386074,_0x241587){var _0x45cd22={'raw':![],'where':{'id':_0x386074['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4cd85a={};_0x4cd85a[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db['WhatsappAccount']['rawAttributes']);_0x4cd85a[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x386074['query']);_0x4cd85a['filters']=_[_0x0d8b('0x47')](_0x4cd85a[_0x0d8b('0x48')],_0x4cd85a[_0x0d8b('0x44')]);_0x45cd22[_0x0d8b('0x49')]=_[_0x0d8b('0x47')](_0x4cd85a['model'],qs[_0x0d8b('0x5b')](_0x386074[_0x0d8b('0x44')]['fields']));_0x45cd22['attributes']=_0x45cd22[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0x45cd22['attributes']:_0x4cd85a['model'];if(_0x386074[_0x0d8b('0x44')][_0x0d8b('0x56')]){_0x45cd22[_0x0d8b('0x5c')]=[{'all':!![]}];}_0x45cd22=_[_0x0d8b('0x50')]({},_0x45cd22,_0x386074['options']);return db[_0x0d8b('0x3f')]['find'](_0x45cd22)['then'](handleEntityNotFound(_0x241587,null))[_0x0d8b('0x35')](respondWithResult(_0x241587,null))[_0x0d8b('0x59')](handleError(_0x241587,null));};exports['create']=function(_0x4a8f33,_0x44ed23){return db[_0x0d8b('0x3f')][_0x0d8b('0x5d')](_0x4a8f33[_0x0d8b('0x5e')],{})[_0x0d8b('0x35')](function(_0xb66e76){var _0x3978e5=_0x4a8f33[_0x0d8b('0x5f')]['get']({'plain':!![]});if(!_0x3978e5)throw new Error(_0x0d8b('0x60'));if(_0x3978e5[_0x0d8b('0x61')]===_0x0d8b('0x5f')){var _0x3c7efb=_0xb66e76[_0x0d8b('0x36')]({'plain':!![]});var _0x47104e=_0x0d8b('0x37');return db[_0x0d8b('0x62')][_0x0d8b('0x63')]({'where':{'name':_0x47104e,'userProfileId':_0x3978e5['userProfileId']},'raw':!![]})[_0x0d8b('0x35')](function(_0x451940){if(_0x451940&&_0x451940[_0x0d8b('0x64')]===0x0){return db[_0x0d8b('0x65')][_0x0d8b('0x5d')]({'name':_0x3c7efb['name'],'resourceId':_0x3c7efb['id'],'type':_0x451940[_0x0d8b('0x3a')],'sectionId':_0x451940['id']},{})[_0x0d8b('0x35')](function(){return _0xb66e76;});}else{return _0xb66e76;}})[_0x0d8b('0x59')](function(_0x17a87f){logger[_0x0d8b('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17a87f);throw _0x17a87f;});}return _0xb66e76;})['then'](respondWithResult(_0x44ed23,0xc9))[_0x0d8b('0x59')](handleError(_0x44ed23,null));};exports[_0x0d8b('0x34')]=function(_0x3e4a41,_0xbbb520){if(_0x3e4a41['body']['id']){delete _0x3e4a41[_0x0d8b('0x5e')]['id'];}return db[_0x0d8b('0x3f')][_0x0d8b('0x63')]({'where':{'id':_0x3e4a41['params']['id']},'include':[{'model':db[_0x0d8b('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x0d8b('0x35')](handleEntityNotFound(_0xbbb520,null))[_0x0d8b('0x35')](saveUpdates(_0x3e4a41[_0x0d8b('0x5e')],null))[_0x0d8b('0x35')](respondWithResult(_0xbbb520,null))[_0x0d8b('0x59')](handleError(_0xbbb520,null));};exports[_0x0d8b('0x38')]=function(_0x5b5fdb,_0x382d2e){return db['WhatsappAccount'][_0x0d8b('0x63')]({'where':{'id':_0x5b5fdb[_0x0d8b('0x66')]['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x382d2e,null))[_0x0d8b('0x35')](removeEntity(_0x382d2e,null))['catch'](handleError(_0x382d2e,null));};exports[_0x0d8b('0x67')]=function(_0x34d01f,_0x1a1ba7){return db[_0x0d8b('0x3f')][_0x0d8b('0x67')]()[_0x0d8b('0x35')](respondWithResult(_0x1a1ba7,null))[_0x0d8b('0x59')](handleError(_0x1a1ba7,null));};exports[_0x0d8b('0x68')]=function(_0x2ce282,_0x34affb,_0x57e39a){if(_0x2ce282['body']['id']){delete _0x2ce282[_0x0d8b('0x5e')]['id'];}return db[_0x0d8b('0x3f')]['find']({'where':{'id':_0x2ce282[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x34affb,null))['then'](function(_0x22ee20){if(_0x22ee20){_0x2ce282[_0x0d8b('0x5e')]['WhatsappAccountId']=_0x22ee20['id'];return db['Disposition'][_0x0d8b('0x5d')](_0x2ce282[_0x0d8b('0x5e')]);}})[_0x0d8b('0x35')](respondWithResult(_0x34affb,null))[_0x0d8b('0x59')](handleError(_0x34affb,null));};exports[_0x0d8b('0x69')]=function(_0x156859,_0x40d265,_0x5b4402){var _0x1ca60c={'raw':![],'where':{}};var _0x5878c2={};var _0x1a203e={'count':0x0,'rows':[]};return db[_0x0d8b('0x3f')][_0x0d8b('0x6a')]({'where':{'id':_0x156859[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x40d265,null))[_0x0d8b('0x35')](function(_0x4a1c4a){if(_0x4a1c4a){_0x5878c2[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db[_0x0d8b('0x6b')][_0x0d8b('0x40')]);_0x5878c2[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x156859[_0x0d8b('0x44')]);_0x5878c2[_0x0d8b('0x46')]=_[_0x0d8b('0x47')](_0x5878c2[_0x0d8b('0x48')],_0x5878c2['query']);_0x1ca60c[_0x0d8b('0x49')]=_['intersection'](_0x5878c2[_0x0d8b('0x48')],qs[_0x0d8b('0x5b')](_0x156859['query'][_0x0d8b('0x5b')]));_0x1ca60c['attributes']=_0x1ca60c[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0x1ca60c[_0x0d8b('0x49')]:_0x5878c2[_0x0d8b('0x48')];if(!_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4b')](_0x0d8b('0x4c'))){_0x1ca60c[_0x0d8b('0x2f')]=qs['limit'](_0x156859[_0x0d8b('0x44')][_0x0d8b('0x2f')]);_0x1ca60c['offset']=qs[_0x0d8b('0x4d')](_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4d')]);}_0x1ca60c[_0x0d8b('0x6c')]=qs[_0x0d8b('0x4e')](_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4e')]);_0x1ca60c[_0x0d8b('0x51')]=qs[_0x0d8b('0x46')](_[_0x0d8b('0x6d')](_0x156859[_0x0d8b('0x44')],_0x5878c2[_0x0d8b('0x46')]));_0x1ca60c['where'][_0x0d8b('0x6e')]=_0x4a1c4a['id'];if(_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4f')]){_0x1ca60c['where']=_['merge'](_0x1ca60c[_0x0d8b('0x51')],{'$or':_[_0x0d8b('0x43')](_0x1ca60c[_0x0d8b('0x49')],function(_0x5b76af){var _0x5bd5c8={};_0x5bd5c8[_0x5b76af]={'$like':'%'+_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x5bd5c8;})});}_0x1ca60c=_[_0x0d8b('0x50')]({},_0x1ca60c,_0x156859[_0x0d8b('0x54')]);return db[_0x0d8b('0x6b')][_0x0d8b('0x55')]({'where':_0x1ca60c[_0x0d8b('0x51')]})[_0x0d8b('0x35')](function(_0x20a3dd){_0x1a203e[_0x0d8b('0x55')]=_0x20a3dd;if(_0x156859[_0x0d8b('0x44')][_0x0d8b('0x56')]){_0x1ca60c[_0x0d8b('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0x0d8b('0x57')](_0x1ca60c);})[_0x0d8b('0x35')](function(_0x48c965){_0x1a203e['rows']=_0x48c965;return _0x1a203e;});}})[_0x0d8b('0x35')](respondWithFilteredResult(_0x40d265,_0x1ca60c))[_0x0d8b('0x59')](handleError(_0x40d265,null));};exports[_0x0d8b('0x6f')]=function(_0x14b1b8,_0x23e2e0,_0x354208){return db['WhatsappAccount']['find']({'where':{'id':_0x14b1b8['params']['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x23e2e0,null))[_0x0d8b('0x35')](function(_0x466442){if(_0x466442){return _0x466442[_0x0d8b('0x6f')](_0x14b1b8[_0x0d8b('0x44')][_0x0d8b('0x70')]);}})['then'](respondWithStatusCode(_0x23e2e0,null))[_0x0d8b('0x59')](handleError(_0x23e2e0,null));};exports[_0x0d8b('0x71')]=function(_0x4b3363,_0x30a69d,_0x57e3c2){if(_0x4b3363[_0x0d8b('0x5e')]['id']){delete _0x4b3363[_0x0d8b('0x5e')]['id'];}return db[_0x0d8b('0x3f')][_0x0d8b('0x63')]({'where':{'id':_0x4b3363[_0x0d8b('0x66')]['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x30a69d,null))[_0x0d8b('0x35')](function(_0xb73e32){if(_0xb73e32){_0x4b3363[_0x0d8b('0x5e')][_0x0d8b('0x6e')]=_0xb73e32['id'];return db[_0x0d8b('0x72')][_0x0d8b('0x5d')](_0x4b3363['body']);}})['then'](respondWithResult(_0x30a69d,null))[_0x0d8b('0x59')](handleError(_0x30a69d,null));};exports[_0x0d8b('0x73')]=function(_0xb4cb89,_0x165ca6,_0xf91ecd){var _0x3c659e={'raw':![],'where':{}};var _0xeadc0c={};var _0x54674f={'count':0x0,'rows':[]};return db[_0x0d8b('0x3f')]['findOne']({'where':{'id':_0xb4cb89[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x165ca6,null))['then'](function(_0x21a914){if(_0x21a914){_0xeadc0c[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db[_0x0d8b('0x72')][_0x0d8b('0x40')]);_0xeadc0c[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0xb4cb89[_0x0d8b('0x44')]);_0xeadc0c[_0x0d8b('0x46')]=_[_0x0d8b('0x47')](_0xeadc0c[_0x0d8b('0x48')],_0xeadc0c[_0x0d8b('0x44')]);_0x3c659e['attributes']=_[_0x0d8b('0x47')](_0xeadc0c[_0x0d8b('0x48')],qs[_0x0d8b('0x5b')](_0xb4cb89['query']['fields']));_0x3c659e[_0x0d8b('0x49')]=_0x3c659e[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0x3c659e[_0x0d8b('0x49')]:_0xeadc0c[_0x0d8b('0x48')];if(!_0xb4cb89[_0x0d8b('0x44')]['hasOwnProperty'](_0x0d8b('0x4c'))){_0x3c659e[_0x0d8b('0x2f')]=qs[_0x0d8b('0x2f')](_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x2f')]);_0x3c659e['offset']=qs['offset'](_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x4d')]);}_0x3c659e[_0x0d8b('0x6c')]=qs['sort'](_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x4e')]);_0x3c659e[_0x0d8b('0x51')]=qs['filters'](_[_0x0d8b('0x6d')](_0xb4cb89[_0x0d8b('0x44')],_0xeadc0c[_0x0d8b('0x46')]));_0x3c659e[_0x0d8b('0x51')][_0x0d8b('0x6e')]=_0x21a914['id'];if(_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x4f')]){_0x3c659e[_0x0d8b('0x51')]=_[_0x0d8b('0x50')](_0x3c659e['where'],{'$or':_[_0x0d8b('0x43')](_0x3c659e[_0x0d8b('0x49')],function(_0x499e9f){var _0x455a08={};_0x455a08[_0x499e9f]={'$like':'%'+_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x455a08;})});}_0x3c659e=_[_0x0d8b('0x50')]({},_0x3c659e,_0xb4cb89[_0x0d8b('0x54')]);return db[_0x0d8b('0x72')]['count']({'where':_0x3c659e['where']})[_0x0d8b('0x35')](function(_0x3c6ae1){_0x54674f[_0x0d8b('0x55')]=_0x3c6ae1;if(_0xb4cb89[_0x0d8b('0x44')]['includeAll']){_0x3c659e[_0x0d8b('0x5c')]=[{'all':!![]}];}return db[_0x0d8b('0x72')]['findAll'](_0x3c659e);})[_0x0d8b('0x35')](function(_0x4e1b5b){_0x54674f[_0x0d8b('0x58')]=_0x4e1b5b;return _0x54674f;});}})[_0x0d8b('0x35')](respondWithFilteredResult(_0x165ca6,_0x3c659e))[_0x0d8b('0x59')](handleError(_0x165ca6,null));};exports[_0x0d8b('0x74')]=function(_0x36a82f,_0x12c39a,_0x242e6c){return db[_0x0d8b('0x3f')]['find']({'where':{'id':_0x36a82f[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x12c39a,null))['then'](function(_0x35bd36){if(_0x35bd36){return _0x35bd36['removeAnswers'](_0x36a82f[_0x0d8b('0x44')][_0x0d8b('0x70')]);}})['then'](respondWithStatusCode(_0x12c39a,null))[_0x0d8b('0x59')](handleError(_0x12c39a,null));};exports['addAgents']=function(_0x5f3f6f,_0x456642,_0x52c895){return db[_0x0d8b('0x3f')][_0x0d8b('0x63')]({'where':{'id':_0x5f3f6f[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x456642,null))['then'](function(_0x32a60d){if(_0x32a60d){return _0x32a60d[_0x0d8b('0x75')](_0x5f3f6f[_0x0d8b('0x5e')][_0x0d8b('0x70')],_[_0x0d8b('0x76')](_0x5f3f6f[_0x0d8b('0x5e')],[_0x0d8b('0x70'),'id'])||{})[_0x0d8b('0x77')](function(_0x4e3dd1){for(var _0x5ab046=0x0;_0x5ab046<_0x5f3f6f[_0x0d8b('0x5e')][_0x0d8b('0x70')]['length'];_0x5ab046+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x5f3f6f[_0x0d8b('0x5e')][_0x0d8b('0x70')][_0x5ab046],'WhatsappAccountId':_0x5f3f6f[_0x0d8b('0x66')]['id']});}return _0x4e3dd1;});}})['then'](respondWithResult(_0x456642,null))[_0x0d8b('0x59')](handleError(_0x456642,null));};exports[_0x0d8b('0x78')]=function(_0x16afb8,_0x4e428d,_0x3c7f16){return db['WhatsappAccount'][_0x0d8b('0x63')]({'where':{'id':_0x16afb8['params']['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x4e428d,null))[_0x0d8b('0x35')](function(_0x43be3c){if(_0x43be3c){return _0x43be3c[_0x0d8b('0x78')](_0x16afb8[_0x0d8b('0x44')]['ids'])[_0x0d8b('0x35')](function(){if(_['isArray'](_0x16afb8[_0x0d8b('0x44')]['ids'])){for(var _0x165baa=0x0;_0x165baa<_0x16afb8['query']['ids'][_0x0d8b('0x4a')];_0x165baa+=0x1){socket[_0x0d8b('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x16afb8[_0x0d8b('0x44')][_0x0d8b('0x70')][_0x165baa]),'WhatsappAccountId':Number(_0x16afb8[_0x0d8b('0x66')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x16afb8['query'][_0x0d8b('0x70')]),'WhatsappAccountId':Number(_0x16afb8[_0x0d8b('0x66')]['id'])});}});}})[_0x0d8b('0x35')](respondWithStatusCode(_0x4e428d,null))[_0x0d8b('0x59')](handleError(_0x4e428d,null));};exports[_0x0d8b('0x7a')]=function(_0x2a8e14,_0x1d3817,_0x123b77){var _0xa17410={};var _0xba602f={};var _0x4dc5bd;var _0x2e7343;return db[_0x0d8b('0x3f')][_0x0d8b('0x6a')]({'where':{'id':_0x2a8e14['params']['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x1d3817,null))[_0x0d8b('0x35')](function(_0x13bce2){if(_0x13bce2){_0x4dc5bd=_0x13bce2;_0xba602f[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db[_0x0d8b('0x7b')][_0x0d8b('0x40')]);_0xba602f[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x2a8e14[_0x0d8b('0x44')]);_0xba602f[_0x0d8b('0x46')]=_[_0x0d8b('0x47')](_0xba602f['model'],_0xba602f[_0x0d8b('0x44')]);_0xa17410[_0x0d8b('0x49')]=_[_0x0d8b('0x47')](_0xba602f[_0x0d8b('0x48')],qs['fields'](_0x2a8e14['query'][_0x0d8b('0x5b')]));_0xa17410[_0x0d8b('0x49')]=_0xa17410[_0x0d8b('0x49')]['length']?_0xa17410['attributes']:_0xba602f['model'];_0xa17410[_0x0d8b('0x6c')]=qs['sort'](_0x2a8e14[_0x0d8b('0x44')][_0x0d8b('0x4e')]);_0xa17410[_0x0d8b('0x51')]=qs[_0x0d8b('0x46')](_[_0x0d8b('0x6d')](_0x2a8e14[_0x0d8b('0x44')],_0xba602f[_0x0d8b('0x46')]));if(_0x2a8e14[_0x0d8b('0x44')]['filter']){_0xa17410[_0x0d8b('0x51')]=_[_0x0d8b('0x50')](_0xa17410[_0x0d8b('0x51')],{'$or':_[_0x0d8b('0x43')](_0xa17410['attributes'],function(_0x3b4a92){var _0x62fedf={};_0x62fedf[_0x3b4a92]={'$like':'%'+_0x2a8e14[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x62fedf;})});}_0xa17410=_['merge']({},_0xa17410,_0x2a8e14[_0x0d8b('0x54')]);return _0x4dc5bd[_0x0d8b('0x7a')](_0xa17410);}})[_0x0d8b('0x35')](function(_0x127d6b){if(_0x127d6b){_0x2e7343=_0x127d6b['length'];if(!_0x2a8e14[_0x0d8b('0x44')]['hasOwnProperty'](_0x0d8b('0x4c'))){_0xa17410['limit']=qs[_0x0d8b('0x2f')](_0x2a8e14['query'][_0x0d8b('0x2f')]);_0xa17410['offset']=qs[_0x0d8b('0x4d')](_0x2a8e14['query'][_0x0d8b('0x4d')]);}return _0x4dc5bd['getAgents'](_0xa17410);}})[_0x0d8b('0x35')](function(_0x5ebfe0){if(_0x5ebfe0){return _0x5ebfe0?{'count':_0x2e7343,'rows':_0x5ebfe0}:null;}})[_0x0d8b('0x35')](respondWithResult(_0x1d3817,null))[_0x0d8b('0x59')](handleError(_0x1d3817,null));};exports['addApplications']=function(_0x4ea6fb,_0x4cff45,_0x42b956){return db['WhatsappAccount'][_0x0d8b('0x6a')]({'where':{'id':_0x4ea6fb['params']['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x4cff45,null))[_0x0d8b('0x35')](function(_0x120350){if(_0x120350){return db[_0x0d8b('0x7c')][_0x0d8b('0x7d')](function(_0x3d5e21){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x4ea6fb[_0x0d8b('0x66')]['id']},'transaction':_0x3d5e21})['then'](function(_0xf3c16a){var _0x28393f=_[_0x0d8b('0x43')](_0x4ea6fb['body'],function(_0x47251c){_0x47251c['WhatsappAccountId']=_0x4ea6fb[_0x0d8b('0x66')]['id'];return _0x47251c;});return db[_0x0d8b('0x7e')][_0x0d8b('0x7f')](_0x28393f,{'transaction':_0x3d5e21});});})[_0x0d8b('0x35')](function(){return db['WhatsappApplication'][_0x0d8b('0x80')]({'where':{'WhatsappAccountId':_0x4ea6fb[_0x0d8b('0x66')]['id']},'order':_0x0d8b('0x81')});});}})['then'](respondWithResult(_0x4cff45,null))[_0x0d8b('0x59')](handleError(_0x4cff45,null));};exports['getApplications']=function(_0x3a2d0e,_0x28868a,_0x2c00b6){var _0xfc414a={};var _0x19f64c={};var _0x2f4cfd;var _0x278b23;return db[_0x0d8b('0x3f')][_0x0d8b('0x6a')]({'where':{'id':_0x3a2d0e[_0x0d8b('0x66')]['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x28868a,null))[_0x0d8b('0x35')](function(_0x50b987){if(_0x50b987){_0x2f4cfd=_0x50b987;_0x19f64c[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db['WhatsappApplication'][_0x0d8b('0x40')]);_0x19f64c['query']=_[_0x0d8b('0x45')](_0x3a2d0e['query']);_0x19f64c[_0x0d8b('0x46')]=_['intersection'](_0x19f64c['model'],_0x19f64c[_0x0d8b('0x44')]);_0xfc414a[_0x0d8b('0x49')]=_['intersection'](_0x19f64c['model'],qs['fields'](_0x3a2d0e['query'][_0x0d8b('0x5b')]));_0xfc414a[_0x0d8b('0x49')]=_0xfc414a[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0xfc414a[_0x0d8b('0x49')]:_0x19f64c[_0x0d8b('0x48')];_0xfc414a[_0x0d8b('0x6c')]=qs[_0x0d8b('0x4e')](_0x3a2d0e['query'][_0x0d8b('0x4e')]);_0xfc414a['where']=qs[_0x0d8b('0x46')](_['pick'](_0x3a2d0e[_0x0d8b('0x44')],_0x19f64c[_0x0d8b('0x46')]));if(_0x3a2d0e[_0x0d8b('0x44')][_0x0d8b('0x4f')]){_0xfc414a[_0x0d8b('0x51')]=_[_0x0d8b('0x50')](_0xfc414a[_0x0d8b('0x51')],{'$or':_[_0x0d8b('0x43')](_0xfc414a[_0x0d8b('0x49')],function(_0x2f63fe){var _0x44dac0={};_0x44dac0[_0x2f63fe]={'$like':'%'+_0x3a2d0e[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x44dac0;})});}_0xfc414a=_['merge']({},_0xfc414a,_0x3a2d0e[_0x0d8b('0x54')]);return _0x2f4cfd['getApplications'](_0xfc414a);}})[_0x0d8b('0x35')](function(_0xd682dc){if(_0xd682dc){_0x278b23=_0xd682dc['length'];if(!_0x3a2d0e[_0x0d8b('0x44')]['hasOwnProperty'](_0x0d8b('0x4c'))){_0xfc414a['limit']=qs[_0x0d8b('0x2f')](_0x3a2d0e[_0x0d8b('0x44')][_0x0d8b('0x2f')]);_0xfc414a[_0x0d8b('0x4d')]=qs[_0x0d8b('0x4d')](_0x3a2d0e[_0x0d8b('0x44')]['offset']);}return _0x2f4cfd[_0x0d8b('0x82')](_0xfc414a);}})['then'](function(_0x4402a0){if(_0x4402a0){return _0x4402a0?{'count':_0x278b23,'rows':_0x4402a0}:null;}})[_0x0d8b('0x35')](respondWithResult(_0x28868a,null))[_0x0d8b('0x59')](handleError(_0x28868a,null));};exports[_0x0d8b('0x83')]=function(_0x831064,_0x5cfca3,_0x15e78b){var _0x22ca75={'channel':'whatsapp'};var _0x1f6044=[];var _0x2edc22=[];var _0x29f6c0={};return db[_0x0d8b('0x3f')]['find']({'where':{'id':_0x831064[_0x0d8b('0x66')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x0d8b('0x84')}]})['then'](handleEntityNotFound(_0x5cfca3,null))[_0x0d8b('0x35')](function(_0x34f234){_0x22ca75['account']=_0x34f234;_0x22ca75[_0x0d8b('0x85')]=_[_0x0d8b('0x86')](_0x34f234[_0x0d8b('0x84')],[_0x0d8b('0x81')],['asc']);if(_0x22ca75[_0x0d8b('0x87')]['Applications']){delete _0x22ca75[_0x0d8b('0x87')][_0x0d8b('0x84')];}return db['CmContact'][_0x0d8b('0x67')]();})[_0x0d8b('0x35')](function(_0x3e8e3c){if(!_0x3e8e3c){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0x88'));}_0x1f6044=_[_0x0d8b('0x89')](_[_0x0d8b('0x45')](_0x3e8e3c),['createdAt',_0x0d8b('0x8a')]);_0x2edc22=_['difference'](_[_0x0d8b('0x45')](_0x3e8e3c),[_0x0d8b('0x8b'),_0x0d8b('0x8a'),_0x0d8b('0x8c'),_0x0d8b('0x8d')]);_0x22ca75[_0x0d8b('0x5e')]={'mapKey':_0x0d8b('0x8e')};if(_0x22ca75[_0x0d8b('0x87')][_0x0d8b('0x52')]&&_0x22ca75['account'][_0x0d8b('0x52')]===_0x0d8b('0x8f')){_0x22ca75['body'][_0x0d8b('0x90')]=_0x831064[_0x0d8b('0x5e')]['From'][_0x0d8b('0x91')](_0x0d8b('0x92'),'');_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x5e')]=_0x831064[_0x0d8b('0x5e')][_0x0d8b('0x93')];_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x94')]=_0x831064['body'][_0x0d8b('0x95')];}if(_0x22ca75[_0x0d8b('0x5e')]['id']){delete _0x22ca75[_0x0d8b('0x5e')]['id'];}if(_[_0x0d8b('0x96')](_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x90')])){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0x97'));}if(_[_0x0d8b('0x96')](_0x22ca75[_0x0d8b('0x5e')]['body'])||_0x22ca75['body']['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0d8b('0x96')](_0x22ca75['body'][_0x0d8b('0x98')])){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0x99')+_0x2edc22);}if(!_[_0x0d8b('0x9a')](_0x2edc22,_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x98')])){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0x9b')+_0x2edc22);}_0x29f6c0[_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x98')]]=_0x22ca75['body'][_0x0d8b('0x90')];return db['CmList'][_0x0d8b('0x63')]({'where':{'id':_0x22ca75['account'][_0x0d8b('0x8d')]},'include':[{'model':db[_0x0d8b('0x9c')],'as':_0x0d8b('0x9d'),'where':_0x29f6c0,'limit':0x1,'order':[[_0x0d8b('0x8a'),_0x0d8b('0x9e')]]}]});})['then'](handleEntityNotFound(_0x5cfca3,null))[_0x0d8b('0x35')](function(_0x363518){if(_0x363518){_0x22ca75['list']=_[_0x0d8b('0x76')](_0x363518,['Contacts']);if(_0x363518['Contacts'][_0x0d8b('0x4a')]){return _0x363518[_0x0d8b('0x9d')][0x0];}var _0x427369=_[_0x0d8b('0x17')](_0x22ca75[_0x0d8b('0x5e')],{'firstName':_0x22ca75['body']['from'],'ListId':_0x363518['id']});_0x427369[_0x22ca75['body'][_0x0d8b('0x98')]]=_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x90')];return db[_0x0d8b('0x9c')][_0x0d8b('0x5d')](_0x427369,{'fields':_0x1f6044,'raw':!![]});}})[_0x0d8b('0x35')](handleEntityNotFound(_0x5cfca3,null))['then'](function(_0x20becd){if(_0x20becd){_0x22ca75[_0x0d8b('0x9f')]=_0x20becd;var _0x591816={'ContactId':_0x20becd['id'],'phone':_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x90')],'WhatsappAccountId':_0x831064[_0x0d8b('0x66')]['id']};var _0xfe53a={'ContactId':_0x20becd['id'],'WhatsappAccountId':_0x831064[_0x0d8b('0x66')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0xfe53a})[_0x0d8b('0x35')](function(_0xaf1c9c){if(_0xaf1c9c){return[_0xaf1c9c,![]];}return db['WhatsappInteraction'][_0x0d8b('0x5d')](_0x591816)[_0x0d8b('0x35')](function(_0x3a8bee){return[_0x3a8bee,!![]];});});}})['spread'](function(_0x52f5cc,_0x367c57){_0x22ca75[_0x0d8b('0xa0')]=_0x52f5cc['get']({'plain':!![]});_0x22ca75['interaction'][_0x0d8b('0xa1')]=![];if(_0x367c57){if(_0x22ca75['account'][_0x0d8b('0xa2')]){_0x22ca75['applications'][_0x0d8b('0xa3')]({'id':0x0,'priority':_0x22ca75[_0x0d8b('0x85')]['length']+0x1,'app':_0x0d8b('0xa4'),'appdata':'unmanaged','interval':_0x0d8b('0xa5')});}_0x22ca75[_0x0d8b('0xa0')][_0x0d8b('0xa1')]=!![];}return db[_0x0d8b('0xa6')][_0x0d8b('0x5d')]({'phone':_0x22ca75['body'][_0x0d8b('0x90')],'messageId':_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x94')],'body':_0x22ca75['body'][_0x0d8b('0x5e')],'WhatsappAccountId':_0x831064['params']['id'],'WhatsappInteractionId':_0x52f5cc['id'],'direction':'in','ContactId':_0x52f5cc[_0x0d8b('0xa7')],'AttachmentId':_0x22ca75[_0x0d8b('0x5e')]['AttachmentId']});})['then'](function(_0x4b69b6){_0x22ca75[_0x0d8b('0x2a')]=_0x4b69b6;if(_0x22ca75[_0x0d8b('0xa0')]['UserId']){return db[_0x0d8b('0x7b')]['find']({'attributes':['id',_0x0d8b('0x3a')],'where':{'id':_0x22ca75[_0x0d8b('0xa0')][_0x0d8b('0xa8')]}})[_0x0d8b('0x35')](function(_0x2c6aed){if(_0x2c6aed){_0x22ca75[_0x0d8b('0x85')][_0x0d8b('0xa9')]({'id':0x0,'priority':0x0,'app':_0x0d8b('0xaa'),'appdata':_0x2c6aed['name']+','+(_0x22ca75[_0x0d8b('0x87')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0d8b('0xab'),_0x0d8b('0xac'),_0x22ca75);});}return respondWithRpcPromise(_0x0d8b('0xab'),_0x0d8b('0xac'),_0x22ca75);})[_0x0d8b('0x35')](function(_0x25ec9d){if(_0x25ec9d){var _0x2098ed=0xc8;var _0x567b75=_0x0d8b('0xad');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x567b75,_0x2098ed,_0x0d8b('0xae'));logger['debug'](_0x0d8b('0xaf'),_0x567b75,_0x2098ed,'entity\x20found',JSON['stringify'](_0x25ec9d));if(_0x22ca75[_0x0d8b('0x87')][_0x0d8b('0x52')]===_0x0d8b('0x8f')){return _0x5cfca3[_0x0d8b('0x2e')](_0x2098ed)[_0x0d8b('0x30')](_0x0d8b('0xb0'),'text/xml')['send'](_0x0d8b('0xb1'));}else{return _0x5cfca3[_0x0d8b('0x2e')](_0x2098ed)[_0x0d8b('0xb2')](_0x25ec9d);}}})[_0x0d8b('0x59')](handleError(_0x5cfca3,null));};exports[_0x0d8b('0x3b')]=function(_0x206dfd,_0x12816b,_0x474bca){var _0x13d965,_0x228e6c,_0x26fb03;if(_[_0x0d8b('0x96')](_0x206dfd[_0x0d8b('0x5e')]['body'])||_0x206dfd['body']['body']===''){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0xb3'));}if(_[_0x0d8b('0x96')](_0x206dfd[_0x0d8b('0x5e')]['to'])){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0xb4'));}_0x13d965=_0x206dfd[_0x0d8b('0x5e')]['to'];return db[_0x0d8b('0x3f')][_0x0d8b('0x63')]({'where':{'id':_0x206dfd[_0x0d8b('0x66')]['id']},'include':[{'model':db[_0x0d8b('0xb5')],'as':_0x0d8b('0xb6'),'include':[{'model':db[_0x0d8b('0x9c')],'as':_0x0d8b('0x9d'),'where':{'mobile':_0x13d965},'limit':0x1,'order':[[_0x0d8b('0x8a'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x12816b,null))[_0x0d8b('0x35')](function(_0x4d41ea){if(_0x4d41ea&&_0x4d41ea['List']){_0x228e6c=_0x4d41ea['get']({'plain':!![]});if(_0x228e6c[_0x0d8b('0xb6')]&&_0x228e6c[_0x0d8b('0xb6')][_0x0d8b('0x9d')][_0x0d8b('0x4a')]){return _0x228e6c[_0x0d8b('0xb6')]['Contacts'][0x0];}return db[_0x0d8b('0x9c')][_0x0d8b('0x5d')](_[_0x0d8b('0x17')](_0x206dfd[_0x0d8b('0x5e')],{'firstName':_0x13d965,'mobile':_0x13d965,'phone':_0x13d965,'ListId':_0x228e6c['ListId']}));}})['then'](handleEntityNotFound(_0x12816b,null))[_0x0d8b('0x35')](function(_0x593e46){if(_0x593e46){_0x26fb03=_0x593e46;return db[_0x0d8b('0xb7')][_0x0d8b('0x63')]({'where':{'ContactId':_0x26fb03['id'],'closed':![],'WhatsappAccountId':_0x228e6c['id']}})[_0x0d8b('0x35')](function(_0x32237b){if(_0x32237b){return[_0x32237b,![]];}return db[_0x0d8b('0xb7')][_0x0d8b('0x5d')]({'UserId':_0x206dfd['user']['id'],'ContactId':_0x26fb03['id'],'WhatsappAccountId':_0x228e6c['id'],'phone':_0x13d965,'firstMsgDirection':_0x0d8b('0xb8'),'Messages':[_['merge'](_0x206dfd[_0x0d8b('0x5e')],{'read':![],'body':_0x206dfd[_0x0d8b('0x5e')][_0x0d8b('0x5e')],'phone':_0x13d965,'WhatsappAccountId':_0x228e6c['id'],'UserId':_0x206dfd[_0x0d8b('0x5f')]['id'],'ContactId':_0x26fb03['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x58e346){return[_0x58e346,!![]];});});}})[_0x0d8b('0x77')](function(_0x2f4067,_0x3c4315){if(_0x3c4315){return _0x2f4067;}return db[_0x0d8b('0xa6')][_0x0d8b('0x5d')](_[_0x0d8b('0x50')](_0x206dfd['body'],{'read':![],'body':_0x206dfd['body']['body'],'phone':_0x13d965,'WhatsappAccountId':_0x228e6c['id'],'WhatsappInteractionId':_0x2f4067['id'],'UserId':_0x206dfd['user']['id'],'ContactId':_0x26fb03['id']}))[_0x0d8b('0x35')](function(_0x100c54){_0x2f4067['dataValues'][_0x0d8b('0xb9')]=[];_0x2f4067[_0x0d8b('0xba')][_0x0d8b('0xb9')][_0x0d8b('0xa3')](_0x100c54[_0x0d8b('0xba')]);return _0x2f4067;});})[_0x0d8b('0x35')](respondWithResult(_0x12816b,null))[_0x0d8b('0x59')](handleError(_0x12816b,null));}; \ No newline at end of file +var _0x5ec6=['destroy','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','WhatsappAccountId','filter','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','account','orderBy','priority','asc','Applications','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','applications','push','*,*,*,*','WhatsappMessage','ContactId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','send','\x0a','to\x20is\x20mandatory','List','defaults','out','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','WhatsappAccounts','UserProfileResource'];(function(_0xe3fdab,_0x1baca5){var _0x588894=function(_0x525c66){while(--_0x525c66){_0xe3fdab['push'](_0xe3fdab['shift']());}};_0x588894(++_0x1baca5);}(_0x5ec6,0x7f));var _0x65ec=function(_0x44424e,_0x2879a9){_0x44424e=_0x44424e-0x0;var _0x55842c=_0x5ec6[_0x44424e];return _0x55842c;};'use strict';var pdf=require(_0x65ec('0x0'));var emlformat=require(_0x65ec('0x1'));var rimraf=require(_0x65ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65ec('0x3'));var rp=require('request-promise');var moment=require(_0x65ec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x65ec('0x5'));var util=require('util');var path=require(_0x65ec('0x6'));var sox=require('sox');var csv=require(_0x65ec('0x7'));var ejs=require(_0x65ec('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x65ec('0x9'));var crypto=require(_0x65ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65ec('0xb'));var toCsv=require(_0x65ec('0x7'));var querystring=require(_0x65ec('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65ec('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x65ec('0xe'));var hardwareService=require(_0x65ec('0xf'));var logger=require('../../config/logger')(_0x65ec('0x10'));var utils=require(_0x65ec('0x11'));var config=require('../../config/environment');var db=require(_0x65ec('0x12'))['db'];config[_0x65ec('0x13')]=_['defaults'](config[_0x65ec('0x13')],{'host':_0x65ec('0x14'),'port':0x18eb});var socket=require(_0x65ec('0x15'))(new Redis(config[_0x65ec('0x13')]));require(_0x65ec('0x16'))[_0x65ec('0x17')](socket);var jayson=require(_0x65ec('0x18'));var client=jayson[_0x65ec('0x19')]['http']({'port':0x232c});function checkPasswordPattern(_0x28be8b,_0x3ed6f7,_0x35d06b){if(_0x35d06b){var _0x4bbe88=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4bbe88['test'](_0x3ed6f7)){return _0x28be8b;}else{throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x1c'));}}else{return _0x28be8b;}}function respondWithRpcPromise(_0x4f2c63,_0x25dae7,_0x286eac,_0x1254f8){return new BPromise(function(_0xb4ed90,_0x29ebc4){var _0xd81ed3=_0x1254f8||client;return _0xd81ed3[_0x65ec('0x1d')](_0x4f2c63,_0x286eac)[_0x65ec('0x1e')](function(_0x2127e2){logger[_0x65ec('0x1f')](_0x65ec('0x20'),_0x25dae7,_0x65ec('0x21'));logger[_0x65ec('0x22')](_0x65ec('0x23'),_0x25dae7,_0x65ec('0x21'),JSON[_0x65ec('0x24')](_0x2127e2));if(_0x2127e2[_0x65ec('0x25')]){if(_0x2127e2[_0x65ec('0x25')][_0x65ec('0x26')]===0x1f4){logger['error'](_0x65ec('0x20'),_0x25dae7,_0x2127e2[_0x65ec('0x25')][_0x65ec('0x27')]);return _0x29ebc4(_0x2127e2[_0x65ec('0x25')][_0x65ec('0x27')]);}logger[_0x65ec('0x25')](_0x65ec('0x20'),_0x25dae7,_0x2127e2['error'][_0x65ec('0x27')]);return _0xb4ed90(_0x2127e2[_0x65ec('0x25')][_0x65ec('0x27')]);}else{logger[_0x65ec('0x1f')](_0x65ec('0x20'),_0x25dae7,_0x65ec('0x21'));_0xb4ed90(_0x2127e2[_0x65ec('0x28')][_0x65ec('0x27')]);}})[_0x65ec('0x29')](function(_0x4c846b){logger[_0x65ec('0x25')](_0x65ec('0x20'),_0x25dae7,_0x4c846b);_0x29ebc4(_0x4c846b);});});}function respondWithStatusCode(_0x251831,_0x23b1a3){_0x23b1a3=_0x23b1a3||0xcc;return function(_0x4de451){if(_0x4de451){return _0x251831[_0x65ec('0x2a')](_0x23b1a3);}return _0x251831['status'](_0x23b1a3)[_0x65ec('0x2b')]();};}function respondWithResult(_0x1ada47,_0x1d0b5c){_0x1d0b5c=_0x1d0b5c||0xc8;return function(_0x30366c){if(_0x30366c){return _0x1ada47[_0x65ec('0x2c')](_0x1d0b5c)[_0x65ec('0x2d')](_0x30366c);}};}function respondWithFilteredResult(_0x46bf66,_0x39410f){return function(_0x984a82){if(_0x984a82){var _0xeec5d4=_0x984a82[_0x65ec('0x2e')],_0x3c97e2=_0x39410f['offset'],_0x4b435c=_0x39410f[_0x65ec('0x2f')]+_0x39410f[_0x65ec('0x30')],_0x50d81f;if(_0x4b435c>=_0xeec5d4){_0x4b435c=_0xeec5d4;_0x50d81f=0xc8;}else{_0x50d81f=0xce;}_0x46bf66['status'](_0x50d81f);return _0x46bf66[_0x65ec('0x31')](_0x65ec('0x32'),_0x3c97e2+'-'+_0x4b435c+'/'+_0xeec5d4)[_0x65ec('0x2d')](_0x984a82);}return null;};}function patchUpdates(_0x3c8dd7){return function(_0x491dc6){try{jsonpatch[_0x65ec('0x33')](_0x491dc6,_0x3c8dd7,!![]);}catch(_0x3b9dcb){return BPromise[_0x65ec('0x34')](_0x3b9dcb);}return _0x491dc6[_0x65ec('0x35')]();};}function saveUpdates(_0x3e4f4f,_0x3826fa){return function(_0x38dea3){if(_0x38dea3){return _0x38dea3[_0x65ec('0x36')](_0x3e4f4f)[_0x65ec('0x1e')](function(_0xff3f3c){return _0xff3f3c;});}return null;};}function removeEntity(_0x50db17,_0x6a5861){return function(_0x1e20c4){if(_0x1e20c4){return _0x1e20c4['destroy']()[_0x65ec('0x1e')](function(){var _0x24a242=_0x1e20c4[_0x65ec('0x37')]({'plain':!![]});var _0x2b8aca=_0x65ec('0x38');return db[_0x65ec('0x39')][_0x65ec('0x3a')]({'where':{'type':_0x2b8aca,'resourceId':_0x24a242['id']}})['then'](function(){return _0x1e20c4;});})[_0x65ec('0x1e')](function(){_0x50db17[_0x65ec('0x2c')](0xcc)[_0x65ec('0x2b')]();});}};}function handleEntityNotFound(_0x185447,_0x5028e3){return function(_0x5d8458){if(!_0x5d8458){_0x185447[_0x65ec('0x2a')](0x194);}return _0x5d8458;};}function handleError(_0x398edd,_0x940f13){_0x940f13=_0x940f13||0x1f4;return function(_0x55ac61){logger['error'](_0x55ac61[_0x65ec('0x3b')]);if(_0x55ac61['name']){delete _0x55ac61[_0x65ec('0x3c')];}_0x398edd[_0x65ec('0x2c')](_0x940f13)['send'](_0x55ac61);};}exports[_0x65ec('0x3d')]=function(_0x1fbc2b,_0x13aa56){var _0x5357bf={'include':[{'model':db[_0x65ec('0x3e')],'as':_0x65ec('0x3f')}]},_0x3cffbf={},_0x3b72cf={'count':0x0,'rows':[]};var _0x470bb3=_[_0x65ec('0x40')](db[_0x65ec('0x41')]['rawAttributes'],function(_0x28653a){return{'name':_0x28653a['fieldName'],'type':_0x28653a[_0x65ec('0x42')][_0x65ec('0x43')]};});_0x3cffbf[_0x65ec('0x44')]=_[_0x65ec('0x40')](_0x470bb3,_0x65ec('0x3c'));_0x3cffbf[_0x65ec('0x45')]=_['keys'](_0x1fbc2b[_0x65ec('0x45')]);_0x3cffbf['filters']=_['intersection'](_0x3cffbf[_0x65ec('0x44')],_0x3cffbf[_0x65ec('0x45')]);_0x5357bf[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x3cffbf[_0x65ec('0x44')],qs['fields'](_0x1fbc2b['query'][_0x65ec('0x48')]));_0x5357bf[_0x65ec('0x46')]=_0x5357bf[_0x65ec('0x46')][_0x65ec('0x49')]?_0x5357bf[_0x65ec('0x46')]:_0x3cffbf['model'];if(!_0x1fbc2b['query'][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0x5357bf[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x30')]);_0x5357bf[_0x65ec('0x2f')]=qs['offset'](_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x2f')]);}_0x5357bf[_0x65ec('0x4c')]=qs['sort'](_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x5357bf['where']=qs[_0x65ec('0x4e')](_[_0x65ec('0x4f')](_0x1fbc2b[_0x65ec('0x45')],_0x3cffbf[_0x65ec('0x4e')]),_0x470bb3);if(_0x1fbc2b[_0x65ec('0x45')]['filter']){_0x5357bf[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x5357bf[_0x65ec('0x50')],{'$or':_[_0x65ec('0x40')](_0x470bb3,function(_0x59c182){if(_0x59c182[_0x65ec('0x42')]!=='VIRTUAL'){var _0x1ed0f9={};_0x1ed0f9[_0x59c182[_0x65ec('0x3c')]]={'$like':'%'+_0x1fbc2b[_0x65ec('0x45')]['filter']+'%'};return _0x1ed0f9;}})});}_0x5357bf=_['merge']({},_0x5357bf,_0x1fbc2b[_0x65ec('0x52')]);var _0x45d2bc={'where':_0x5357bf[_0x65ec('0x50')]};return db[_0x65ec('0x41')][_0x65ec('0x2e')](_0x45d2bc)[_0x65ec('0x1e')](function(_0x1c546c){_0x3b72cf[_0x65ec('0x2e')]=_0x1c546c;if(_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x53')]){_0x5357bf[_0x65ec('0x54')]=[{'all':!![]}];}return db[_0x65ec('0x41')][_0x65ec('0x55')](_0x5357bf);})[_0x65ec('0x1e')](function(_0x11d2d6){_0x3b72cf[_0x65ec('0x56')]=_0x11d2d6;return _0x3b72cf;})[_0x65ec('0x1e')](respondWithFilteredResult(_0x13aa56,_0x5357bf))['catch'](handleError(_0x13aa56,null));};exports[_0x65ec('0x57')]=function(_0x2814f3,_0x4e0da8){var _0x3a474c={'raw':![],'where':{'id':_0x2814f3[_0x65ec('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x65ec('0x3f')}]},_0x7add40={};_0x7add40[_0x65ec('0x44')]=_[_0x65ec('0x59')](db['WhatsappAccount'][_0x65ec('0x5a')]);_0x7add40['query']=_['keys'](_0x2814f3[_0x65ec('0x45')]);_0x7add40[_0x65ec('0x4e')]=_[_0x65ec('0x47')](_0x7add40['model'],_0x7add40[_0x65ec('0x45')]);_0x3a474c[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x7add40[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x2814f3[_0x65ec('0x45')][_0x65ec('0x48')]));_0x3a474c[_0x65ec('0x46')]=_0x3a474c[_0x65ec('0x46')]['length']?_0x3a474c['attributes']:_0x7add40[_0x65ec('0x44')];if(_0x2814f3['query'][_0x65ec('0x53')]){_0x3a474c['include']=[{'all':!![]}];}_0x3a474c=_[_0x65ec('0x51')]({},_0x3a474c,_0x2814f3[_0x65ec('0x52')]);return db[_0x65ec('0x41')][_0x65ec('0x5b')](_0x3a474c)[_0x65ec('0x1e')](handleEntityNotFound(_0x4e0da8,null))[_0x65ec('0x1e')](respondWithResult(_0x4e0da8,null))[_0x65ec('0x29')](handleError(_0x4e0da8,null));};exports['create']=function(_0x2c7657,_0x474bc0){return db[_0x65ec('0x41')][_0x65ec('0x5c')](_0x2c7657[_0x65ec('0x5d')],{})['then'](function(_0x20f60f){var _0x318be3=_0x2c7657[_0x65ec('0x5e')][_0x65ec('0x37')]({'plain':!![]});if(!_0x318be3)throw new Error(_0x65ec('0x5f'));if(_0x318be3[_0x65ec('0x60')]===_0x65ec('0x5e')){var _0x2e81ea=_0x20f60f['get']({'plain':!![]});var _0x311e78=_0x65ec('0x38');return db[_0x65ec('0x61')][_0x65ec('0x5b')]({'where':{'name':_0x311e78,'userProfileId':_0x318be3[_0x65ec('0x62')]},'raw':!![]})[_0x65ec('0x1e')](function(_0x192055){if(_0x192055&&_0x192055['autoAssociation']===0x0){return db['UserProfileResource'][_0x65ec('0x5c')]({'name':_0x2e81ea['name'],'resourceId':_0x2e81ea['id'],'type':_0x192055[_0x65ec('0x3c')],'sectionId':_0x192055['id']},{})[_0x65ec('0x1e')](function(){return _0x20f60f;});}else{return _0x20f60f;}})['catch'](function(_0x1baa17){logger[_0x65ec('0x25')](_0x65ec('0x63'),_0x1baa17);throw _0x1baa17;});}return _0x20f60f;})[_0x65ec('0x1e')](respondWithResult(_0x474bc0,0xc9))[_0x65ec('0x29')](handleError(_0x474bc0,null));};exports[_0x65ec('0x36')]=function(_0x2279ff,_0x5df65c){if(_0x2279ff['body']['id']){delete _0x2279ff[_0x65ec('0x5d')]['id'];}return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x2279ff['params']['id']},'include':[{'model':db[_0x65ec('0x3e')],'as':_0x65ec('0x3f')}]})[_0x65ec('0x1e')](handleEntityNotFound(_0x5df65c,null))[_0x65ec('0x1e')](saveUpdates(_0x2279ff[_0x65ec('0x5d')],null))[_0x65ec('0x1e')](respondWithResult(_0x5df65c,null))[_0x65ec('0x29')](handleError(_0x5df65c,null));};exports['destroy']=function(_0x464f67,_0x1e2731){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x464f67[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x1e2731,null))[_0x65ec('0x1e')](removeEntity(_0x1e2731,null))[_0x65ec('0x29')](handleError(_0x1e2731,null));};exports[_0x65ec('0x64')]=function(_0x584811,_0x59a690){return db[_0x65ec('0x41')]['describe']()['then'](respondWithResult(_0x59a690,null))[_0x65ec('0x29')](handleError(_0x59a690,null));};exports[_0x65ec('0x65')]=function(_0x39d0ce,_0x547057,_0x501775){if(_0x39d0ce[_0x65ec('0x5d')]['id']){delete _0x39d0ce['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x39d0ce[_0x65ec('0x58')]['id']}})['then'](handleEntityNotFound(_0x547057,null))[_0x65ec('0x1e')](function(_0x1e101c){if(_0x1e101c){_0x39d0ce[_0x65ec('0x5d')]['WhatsappAccountId']=_0x1e101c['id'];return db['Disposition'][_0x65ec('0x5c')](_0x39d0ce['body']);}})[_0x65ec('0x1e')](respondWithResult(_0x547057,null))[_0x65ec('0x29')](handleError(_0x547057,null));};exports[_0x65ec('0x66')]=function(_0x290c68,_0xc47b30,_0x2874ea){var _0xefa74d={'raw':![],'where':{}};var _0x572b15={};var _0x275a42={'count':0x0,'rows':[]};return db[_0x65ec('0x41')]['findOne']({'where':{'id':_0x290c68[_0x65ec('0x58')]['id']}})['then'](handleEntityNotFound(_0xc47b30,null))[_0x65ec('0x1e')](function(_0xf4dbce){if(_0xf4dbce){_0x572b15[_0x65ec('0x44')]=_[_0x65ec('0x59')](db['Disposition'][_0x65ec('0x5a')]);_0x572b15['query']=_[_0x65ec('0x59')](_0x290c68[_0x65ec('0x45')]);_0x572b15[_0x65ec('0x4e')]=_[_0x65ec('0x47')](_0x572b15['model'],_0x572b15['query']);_0xefa74d['attributes']=_[_0x65ec('0x47')](_0x572b15[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x290c68[_0x65ec('0x45')][_0x65ec('0x48')]));_0xefa74d[_0x65ec('0x46')]=_0xefa74d[_0x65ec('0x46')][_0x65ec('0x49')]?_0xefa74d[_0x65ec('0x46')]:_0x572b15[_0x65ec('0x44')];if(!_0x290c68[_0x65ec('0x45')][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0xefa74d['limit']=qs[_0x65ec('0x30')](_0x290c68[_0x65ec('0x45')][_0x65ec('0x30')]);_0xefa74d[_0x65ec('0x2f')]=qs[_0x65ec('0x2f')](_0x290c68[_0x65ec('0x45')][_0x65ec('0x2f')]);}_0xefa74d[_0x65ec('0x4c')]=qs[_0x65ec('0x4d')](_0x290c68[_0x65ec('0x45')]['sort']);_0xefa74d[_0x65ec('0x50')]=qs['filters'](_['pick'](_0x290c68[_0x65ec('0x45')],_0x572b15[_0x65ec('0x4e')]));_0xefa74d[_0x65ec('0x50')][_0x65ec('0x67')]=_0xf4dbce['id'];if(_0x290c68[_0x65ec('0x45')][_0x65ec('0x68')]){_0xefa74d[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0xefa74d['where'],{'$or':_[_0x65ec('0x40')](_0xefa74d['attributes'],function(_0x3850fd){var _0x1cad36={};_0x1cad36[_0x3850fd]={'$like':'%'+_0x290c68[_0x65ec('0x45')]['filter']+'%'};return _0x1cad36;})});}_0xefa74d=_[_0x65ec('0x51')]({},_0xefa74d,_0x290c68[_0x65ec('0x52')]);return db[_0x65ec('0x69')][_0x65ec('0x2e')]({'where':_0xefa74d[_0x65ec('0x50')]})[_0x65ec('0x1e')](function(_0x1172f3){_0x275a42['count']=_0x1172f3;if(_0x290c68[_0x65ec('0x45')][_0x65ec('0x53')]){_0xefa74d[_0x65ec('0x54')]=[{'all':!![]}];}return db[_0x65ec('0x69')]['findAll'](_0xefa74d);})['then'](function(_0x419e33){_0x275a42[_0x65ec('0x56')]=_0x419e33;return _0x275a42;});}})[_0x65ec('0x1e')](respondWithFilteredResult(_0xc47b30,_0xefa74d))[_0x65ec('0x29')](handleError(_0xc47b30,null));};exports[_0x65ec('0x6a')]=function(_0x277499,_0x5a171c,_0x3b0318){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x277499[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x5a171c,null))[_0x65ec('0x1e')](function(_0x44b4e6){if(_0x44b4e6){return _0x44b4e6[_0x65ec('0x6a')](_0x277499['query'][_0x65ec('0x6b')]);}})[_0x65ec('0x1e')](respondWithStatusCode(_0x5a171c,null))['catch'](handleError(_0x5a171c,null));};exports[_0x65ec('0x6c')]=function(_0x2ca85,_0x28731c,_0x2606ea){if(_0x2ca85[_0x65ec('0x5d')]['id']){delete _0x2ca85[_0x65ec('0x5d')]['id'];}return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x2ca85[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x28731c,null))['then'](function(_0x5030f6){if(_0x5030f6){_0x2ca85[_0x65ec('0x5d')][_0x65ec('0x67')]=_0x5030f6['id'];return db[_0x65ec('0x6d')]['create'](_0x2ca85[_0x65ec('0x5d')]);}})[_0x65ec('0x1e')](respondWithResult(_0x28731c,null))[_0x65ec('0x29')](handleError(_0x28731c,null));};exports[_0x65ec('0x6e')]=function(_0x3d79a8,_0x386eba,_0x1ff60f){var _0x3f9105={'raw':![],'where':{}};var _0x27d5d5={};var _0x4f5e10={'count':0x0,'rows':[]};return db[_0x65ec('0x41')][_0x65ec('0x6f')]({'where':{'id':_0x3d79a8[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x386eba,null))[_0x65ec('0x1e')](function(_0xba5894){if(_0xba5894){_0x27d5d5['model']=_[_0x65ec('0x59')](db[_0x65ec('0x6d')][_0x65ec('0x5a')]);_0x27d5d5[_0x65ec('0x45')]=_[_0x65ec('0x59')](_0x3d79a8['query']);_0x27d5d5['filters']=_[_0x65ec('0x47')](_0x27d5d5[_0x65ec('0x44')],_0x27d5d5[_0x65ec('0x45')]);_0x3f9105[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x27d5d5[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x3d79a8[_0x65ec('0x45')][_0x65ec('0x48')]));_0x3f9105[_0x65ec('0x46')]=_0x3f9105[_0x65ec('0x46')]['length']?_0x3f9105[_0x65ec('0x46')]:_0x27d5d5['model'];if(!_0x3d79a8['query'][_0x65ec('0x4a')]('nolimit')){_0x3f9105[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x3d79a8['query']['limit']);_0x3f9105[_0x65ec('0x2f')]=qs[_0x65ec('0x2f')](_0x3d79a8['query'][_0x65ec('0x2f')]);}_0x3f9105[_0x65ec('0x4c')]=qs['sort'](_0x3d79a8[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x3f9105[_0x65ec('0x50')]=qs[_0x65ec('0x4e')](_['pick'](_0x3d79a8[_0x65ec('0x45')],_0x27d5d5[_0x65ec('0x4e')]));_0x3f9105['where'][_0x65ec('0x67')]=_0xba5894['id'];if(_0x3d79a8['query'][_0x65ec('0x68')]){_0x3f9105[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x3f9105['where'],{'$or':_['map'](_0x3f9105[_0x65ec('0x46')],function(_0x5b26b3){var _0x460044={};_0x460044[_0x5b26b3]={'$like':'%'+_0x3d79a8[_0x65ec('0x45')][_0x65ec('0x68')]+'%'};return _0x460044;})});}_0x3f9105=_['merge']({},_0x3f9105,_0x3d79a8[_0x65ec('0x52')]);return db['CannedAnswer']['count']({'where':_0x3f9105[_0x65ec('0x50')]})['then'](function(_0x102e66){_0x4f5e10[_0x65ec('0x2e')]=_0x102e66;if(_0x3d79a8['query']['includeAll']){_0x3f9105['include']=[{'all':!![]}];}return db[_0x65ec('0x6d')][_0x65ec('0x55')](_0x3f9105);})[_0x65ec('0x1e')](function(_0x596f1c){_0x4f5e10['rows']=_0x596f1c;return _0x4f5e10;});}})['then'](respondWithFilteredResult(_0x386eba,_0x3f9105))[_0x65ec('0x29')](handleError(_0x386eba,null));};exports[_0x65ec('0x70')]=function(_0xc908a7,_0x1c8cd1,_0x1df337){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0xc908a7[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x1c8cd1,null))[_0x65ec('0x1e')](function(_0x309341){if(_0x309341){return _0x309341['removeAnswers'](_0xc908a7[_0x65ec('0x45')][_0x65ec('0x6b')]);}})[_0x65ec('0x1e')](respondWithStatusCode(_0x1c8cd1,null))[_0x65ec('0x29')](handleError(_0x1c8cd1,null));};exports[_0x65ec('0x71')]=function(_0x47cf0c,_0x5c6a76,_0x44d1a7){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x47cf0c['params']['id']}})['then'](handleEntityNotFound(_0x5c6a76,null))[_0x65ec('0x1e')](function(_0x3ccb0f){if(_0x3ccb0f){return _0x3ccb0f[_0x65ec('0x71')](_0x47cf0c[_0x65ec('0x5d')][_0x65ec('0x6b')],_[_0x65ec('0x72')](_0x47cf0c[_0x65ec('0x5d')],[_0x65ec('0x6b'),'id'])||{})['spread'](function(_0x6c71a){for(var _0x2d78f4=0x0;_0x2d78f4<_0x47cf0c[_0x65ec('0x5d')][_0x65ec('0x6b')][_0x65ec('0x49')];_0x2d78f4+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x47cf0c['body'][_0x65ec('0x6b')][_0x2d78f4],'WhatsappAccountId':_0x47cf0c[_0x65ec('0x58')]['id']});}return _0x6c71a;});}})[_0x65ec('0x1e')](respondWithResult(_0x5c6a76,null))[_0x65ec('0x29')](handleError(_0x5c6a76,null));};exports[_0x65ec('0x73')]=function(_0x2a065e,_0x5ef5b8,_0x20481e){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x2a065e['params']['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x5ef5b8,null))[_0x65ec('0x1e')](function(_0x172697){if(_0x172697){return _0x172697[_0x65ec('0x73')](_0x2a065e['query'][_0x65ec('0x6b')])[_0x65ec('0x1e')](function(){if(_[_0x65ec('0x74')](_0x2a065e[_0x65ec('0x45')][_0x65ec('0x6b')])){for(var _0x11e8fe=0x0;_0x11e8fe<_0x2a065e['query'][_0x65ec('0x6b')][_0x65ec('0x49')];_0x11e8fe+=0x1){socket[_0x65ec('0x75')](_0x65ec('0x76'),{'UserId':Number(_0x2a065e[_0x65ec('0x45')][_0x65ec('0x6b')][_0x11e8fe]),'WhatsappAccountId':Number(_0x2a065e[_0x65ec('0x58')]['id'])});}}else{socket[_0x65ec('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x2a065e['query'][_0x65ec('0x6b')]),'WhatsappAccountId':Number(_0x2a065e[_0x65ec('0x58')]['id'])});}});}})[_0x65ec('0x1e')](respondWithStatusCode(_0x5ef5b8,null))['catch'](handleError(_0x5ef5b8,null));};exports[_0x65ec('0x77')]=function(_0x152af1,_0x41daf9,_0x50953a){var _0x437d98={};var _0x2e4efe={};var _0x49a6a2;var _0x4848cc;return db[_0x65ec('0x41')][_0x65ec('0x6f')]({'where':{'id':_0x152af1[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x41daf9,null))[_0x65ec('0x1e')](function(_0x4587ea){if(_0x4587ea){_0x49a6a2=_0x4587ea;_0x2e4efe[_0x65ec('0x44')]=_['keys'](db['User'][_0x65ec('0x5a')]);_0x2e4efe[_0x65ec('0x45')]=_[_0x65ec('0x59')](_0x152af1[_0x65ec('0x45')]);_0x2e4efe[_0x65ec('0x4e')]=_['intersection'](_0x2e4efe['model'],_0x2e4efe['query']);_0x437d98[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x2e4efe[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x152af1['query'][_0x65ec('0x48')]));_0x437d98[_0x65ec('0x46')]=_0x437d98[_0x65ec('0x46')][_0x65ec('0x49')]?_0x437d98[_0x65ec('0x46')]:_0x2e4efe[_0x65ec('0x44')];_0x437d98['order']=qs[_0x65ec('0x4d')](_0x152af1[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x437d98[_0x65ec('0x50')]=qs[_0x65ec('0x4e')](_[_0x65ec('0x4f')](_0x152af1[_0x65ec('0x45')],_0x2e4efe['filters']));if(_0x152af1[_0x65ec('0x45')][_0x65ec('0x68')]){_0x437d98[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x437d98[_0x65ec('0x50')],{'$or':_['map'](_0x437d98[_0x65ec('0x46')],function(_0x561a3d){var _0x36af99={};_0x36af99[_0x561a3d]={'$like':'%'+_0x152af1[_0x65ec('0x45')][_0x65ec('0x68')]+'%'};return _0x36af99;})});}_0x437d98=_[_0x65ec('0x51')]({},_0x437d98,_0x152af1[_0x65ec('0x52')]);return _0x49a6a2['getAgents'](_0x437d98);}})[_0x65ec('0x1e')](function(_0x23878c){if(_0x23878c){_0x4848cc=_0x23878c[_0x65ec('0x49')];if(!_0x152af1[_0x65ec('0x45')][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0x437d98[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x152af1['query'][_0x65ec('0x30')]);_0x437d98[_0x65ec('0x2f')]=qs['offset'](_0x152af1['query'][_0x65ec('0x2f')]);}return _0x49a6a2['getAgents'](_0x437d98);}})[_0x65ec('0x1e')](function(_0x23afc6){if(_0x23afc6){return _0x23afc6?{'count':_0x4848cc,'rows':_0x23afc6}:null;}})[_0x65ec('0x1e')](respondWithResult(_0x41daf9,null))['catch'](handleError(_0x41daf9,null));};exports[_0x65ec('0x78')]=function(_0x297db5,_0x4786be,_0x2203a6){return db[_0x65ec('0x41')][_0x65ec('0x6f')]({'where':{'id':_0x297db5[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x4786be,null))[_0x65ec('0x1e')](function(_0x586546){if(_0x586546){return db[_0x65ec('0x79')]['transaction'](function(_0x30c1d3){return db[_0x65ec('0x7a')][_0x65ec('0x3a')]({'where':{'WhatsappAccountId':_0x297db5['params']['id']},'transaction':_0x30c1d3})['then'](function(_0x361aa1){var _0x50407d=_['map'](_0x297db5['body'],function(_0x43c177){_0x43c177['WhatsappAccountId']=_0x297db5[_0x65ec('0x58')]['id'];return _0x43c177;});return db[_0x65ec('0x7a')][_0x65ec('0x7b')](_0x50407d,{'transaction':_0x30c1d3});});})[_0x65ec('0x1e')](function(){return db['WhatsappApplication'][_0x65ec('0x7c')]({'where':{'WhatsappAccountId':_0x297db5[_0x65ec('0x58')]['id']},'order':'priority'});});}})[_0x65ec('0x1e')](respondWithResult(_0x4786be,null))['catch'](handleError(_0x4786be,null));};exports[_0x65ec('0x7d')]=function(_0x3bb9df,_0x211085,_0xd1f1d1){var _0x2f3855={};var _0x39e285={};var _0x2f70c3;var _0x39ddfa;return db[_0x65ec('0x41')]['findOne']({'where':{'id':_0x3bb9df[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x211085,null))[_0x65ec('0x1e')](function(_0x7bfdae){if(_0x7bfdae){_0x2f70c3=_0x7bfdae;_0x39e285['model']=_[_0x65ec('0x59')](db[_0x65ec('0x7a')][_0x65ec('0x5a')]);_0x39e285[_0x65ec('0x45')]=_[_0x65ec('0x59')](_0x3bb9df[_0x65ec('0x45')]);_0x39e285[_0x65ec('0x4e')]=_['intersection'](_0x39e285['model'],_0x39e285[_0x65ec('0x45')]);_0x2f3855[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x39e285[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x48')]));_0x2f3855[_0x65ec('0x46')]=_0x2f3855[_0x65ec('0x46')]['length']?_0x2f3855[_0x65ec('0x46')]:_0x39e285[_0x65ec('0x44')];_0x2f3855[_0x65ec('0x4c')]=qs[_0x65ec('0x4d')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x2f3855[_0x65ec('0x50')]=qs[_0x65ec('0x4e')](_['pick'](_0x3bb9df[_0x65ec('0x45')],_0x39e285['filters']));if(_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x68')]){_0x2f3855[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x2f3855[_0x65ec('0x50')],{'$or':_[_0x65ec('0x40')](_0x2f3855[_0x65ec('0x46')],function(_0x1aa45c){var _0x133d19={};_0x133d19[_0x1aa45c]={'$like':'%'+_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x68')]+'%'};return _0x133d19;})});}_0x2f3855=_[_0x65ec('0x51')]({},_0x2f3855,_0x3bb9df[_0x65ec('0x52')]);return _0x2f70c3[_0x65ec('0x7d')](_0x2f3855);}})[_0x65ec('0x1e')](function(_0xed5827){if(_0xed5827){_0x39ddfa=_0xed5827[_0x65ec('0x49')];if(!_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0x2f3855[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x30')]);_0x2f3855['offset']=qs[_0x65ec('0x2f')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x2f')]);}return _0x2f70c3[_0x65ec('0x7d')](_0x2f3855);}})[_0x65ec('0x1e')](function(_0xc2ad21){if(_0xc2ad21){return _0xc2ad21?{'count':_0x39ddfa,'rows':_0xc2ad21}:null;}})['then'](respondWithResult(_0x211085,null))[_0x65ec('0x29')](handleError(_0x211085,null));};exports[_0x65ec('0x7e')]=function(_0x2577d2,_0x5cb76d,_0x1b2340){var _0x120933={'channel':_0x65ec('0x7f')};var _0x4e5a41=[];var _0x1cdddf=[];var _0x326cc7={};return db[_0x65ec('0x41')]['find']({'where':{'id':_0x2577d2[_0x65ec('0x58')]['id']},'include':[{'model':db[_0x65ec('0x7a')],'as':'Applications'}]})[_0x65ec('0x1e')](handleEntityNotFound(_0x5cb76d,null))[_0x65ec('0x1e')](function(_0x25ecfc){_0x120933[_0x65ec('0x80')]=_0x25ecfc;_0x120933['applications']=_[_0x65ec('0x81')](_0x25ecfc['Applications'],[_0x65ec('0x82')],[_0x65ec('0x83')]);if(_0x120933[_0x65ec('0x80')][_0x65ec('0x84')]){delete _0x120933[_0x65ec('0x80')]['Applications'];}return db[_0x65ec('0x85')][_0x65ec('0x64')]();})[_0x65ec('0x1e')](function(_0x2f60cb){if(!_0x2f60cb){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x86'));}_0x4e5a41=_[_0x65ec('0x87')](_[_0x65ec('0x59')](_0x2f60cb),[_0x65ec('0x88'),_0x65ec('0x89')]);_0x1cdddf=_[_0x65ec('0x87')](_[_0x65ec('0x59')](_0x2f60cb),[_0x65ec('0x88'),_0x65ec('0x89'),_0x65ec('0x8a'),'ListId']);_0x120933['body']={'mapKey':'mobile'};if(_0x120933[_0x65ec('0x80')][_0x65ec('0x42')]&&_0x120933[_0x65ec('0x80')][_0x65ec('0x42')]===_0x65ec('0x8b')){_0x120933['body'][_0x65ec('0x8c')]=_0x2577d2['body'][_0x65ec('0x8d')]['replace'](_0x65ec('0x8e'),'');_0x120933['body'][_0x65ec('0x5d')]=_0x2577d2['body'][_0x65ec('0x8f')];_0x120933['body'][_0x65ec('0x90')]=_0x2577d2[_0x65ec('0x5d')]['MessageSid'];}if(_0x120933[_0x65ec('0x5d')]['id']){delete _0x120933[_0x65ec('0x5d')]['id'];}if(_[_0x65ec('0x91')](_0x120933[_0x65ec('0x5d')][_0x65ec('0x8c')])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x92'));}if(_[_0x65ec('0x91')](_0x120933['body'][_0x65ec('0x5d')])||_0x120933[_0x65ec('0x5d')]['body']===''){throw new db['Sequelize'][(_0x65ec('0x1b'))](_0x65ec('0x93'));}if(_[_0x65ec('0x91')](_0x120933[_0x65ec('0x5d')]['mapKey'])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x94')+_0x1cdddf);}if(!_[_0x65ec('0x95')](_0x1cdddf,_0x120933[_0x65ec('0x5d')][_0x65ec('0x96')])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x97')+_0x1cdddf);}_0x326cc7[_0x120933[_0x65ec('0x5d')][_0x65ec('0x96')]]=_0x120933['body'][_0x65ec('0x8c')];return db[_0x65ec('0x98')][_0x65ec('0x5b')]({'where':{'id':_0x120933[_0x65ec('0x80')][_0x65ec('0x99')]},'include':[{'model':db[_0x65ec('0x85')],'as':_0x65ec('0x9a'),'where':_0x326cc7,'limit':0x1,'order':[[_0x65ec('0x89'),_0x65ec('0x9b')]]}]});})[_0x65ec('0x1e')](handleEntityNotFound(_0x5cb76d,null))[_0x65ec('0x1e')](function(_0x18991a){if(_0x18991a){_0x120933[_0x65ec('0x9c')]=_[_0x65ec('0x72')](_0x18991a,['Contacts']);if(_0x18991a[_0x65ec('0x9a')][_0x65ec('0x49')]){return _0x18991a[_0x65ec('0x9a')][0x0];}var _0x36cbef=_['defaults'](_0x120933['body'],{'firstName':_0x120933['body']['from'],'ListId':_0x18991a['id']});_0x36cbef[_0x120933[_0x65ec('0x5d')][_0x65ec('0x96')]]=_0x120933[_0x65ec('0x5d')][_0x65ec('0x8c')];return db['CmContact'][_0x65ec('0x5c')](_0x36cbef,{'fields':_0x4e5a41,'raw':!![]});}})['then'](handleEntityNotFound(_0x5cb76d,null))[_0x65ec('0x1e')](function(_0x4c7cbb){if(_0x4c7cbb){_0x120933[_0x65ec('0x9d')]=_0x4c7cbb;var _0x4da116={'ContactId':_0x4c7cbb['id'],'phone':_0x120933['body']['from'],'WhatsappAccountId':_0x2577d2['params']['id']};var _0x58bf37={'ContactId':_0x4c7cbb['id'],'WhatsappAccountId':_0x2577d2['params']['id'],'closed':![]};return db[_0x65ec('0x9e')][_0x65ec('0x5b')]({'where':_0x58bf37})[_0x65ec('0x1e')](function(_0x569650){if(_0x569650){return[_0x569650,![]];}return db[_0x65ec('0x9e')][_0x65ec('0x5c')](_0x4da116)['then'](function(_0x285b77){return[_0x285b77,!![]];});});}})[_0x65ec('0x9f')](function(_0x56b3e4,_0x5a1b64){_0x120933[_0x65ec('0xa0')]=_0x56b3e4[_0x65ec('0x37')]({'plain':!![]});_0x120933[_0x65ec('0xa0')][_0x65ec('0xa1')]=![];if(_0x5a1b64){if(_0x120933[_0x65ec('0x80')]['autoclose']){_0x120933[_0x65ec('0xa2')][_0x65ec('0xa3')]({'id':0x0,'priority':_0x120933['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x65ec('0xa4')});}_0x120933[_0x65ec('0xa0')][_0x65ec('0xa1')]=!![];}return db[_0x65ec('0xa5')][_0x65ec('0x5c')]({'phone':_0x120933[_0x65ec('0x5d')][_0x65ec('0x8c')],'messageId':_0x120933[_0x65ec('0x5d')][_0x65ec('0x90')],'body':_0x120933[_0x65ec('0x5d')][_0x65ec('0x5d')],'WhatsappAccountId':_0x2577d2[_0x65ec('0x58')]['id'],'WhatsappInteractionId':_0x56b3e4['id'],'direction':'in','ContactId':_0x56b3e4[_0x65ec('0xa6')],'AttachmentId':_0x120933[_0x65ec('0x5d')]['AttachmentId']});})[_0x65ec('0x1e')](function(_0x1e3b53){_0x120933[_0x65ec('0x27')]=_0x1e3b53;if(_0x120933[_0x65ec('0xa0')]['UserId']){return db[_0x65ec('0xa7')][_0x65ec('0x5b')]({'attributes':['id','name'],'where':{'id':_0x120933['interaction']['UserId']}})[_0x65ec('0x1e')](function(_0x27c361){if(_0x27c361){_0x120933[_0x65ec('0xa2')][_0x65ec('0xa8')]({'id':0x0,'priority':0x0,'app':_0x65ec('0xa9'),'appdata':_0x27c361['name']+','+(_0x120933[_0x65ec('0x80')][_0x65ec('0xaa')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x65ec('0xab'),_0x65ec('0xac'),_0x120933);});}return respondWithRpcPromise(_0x65ec('0xab'),_0x65ec('0xac'),_0x120933);})['then'](function(_0x886c4e){if(_0x886c4e){var _0x235157=0xc8;var _0x1ba87c=_0x65ec('0xad');logger[_0x65ec('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1ba87c,_0x235157,_0x65ec('0xae'));logger['debug'](_0x65ec('0xaf'),_0x1ba87c,_0x235157,_0x65ec('0xae'),JSON[_0x65ec('0x24')](_0x886c4e));if(_0x120933[_0x65ec('0x80')][_0x65ec('0x42')]===_0x65ec('0x8b')){return _0x5cb76d[_0x65ec('0x2c')](_0x235157)[_0x65ec('0x31')](_0x65ec('0xb0'),'text/xml')[_0x65ec('0xb1')](_0x65ec('0xb2'));}else{return _0x5cb76d[_0x65ec('0x2c')](_0x235157)[_0x65ec('0x2d')](_0x886c4e);}}})[_0x65ec('0x29')](handleError(_0x5cb76d,null));};exports['send']=function(_0x36381a,_0x5ac2b0,_0x2fa462){var _0x22528e,_0x1929c7,_0x3af098;if(_[_0x65ec('0x91')](_0x36381a[_0x65ec('0x5d')][_0x65ec('0x5d')])||_0x36381a['body'][_0x65ec('0x5d')]===''){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x65ec('0x91')](_0x36381a[_0x65ec('0x5d')]['to'])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0xb3'));}_0x22528e=_0x36381a['body']['to'];return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x36381a[_0x65ec('0x58')]['id']},'include':[{'model':db[_0x65ec('0x98')],'as':_0x65ec('0xb4'),'include':[{'model':db[_0x65ec('0x85')],'as':_0x65ec('0x9a'),'where':{'mobile':_0x22528e},'limit':0x1,'order':[[_0x65ec('0x89'),_0x65ec('0x9b')]]}]}]})[_0x65ec('0x1e')](handleEntityNotFound(_0x5ac2b0,null))['then'](function(_0x4998a){if(_0x4998a&&_0x4998a[_0x65ec('0xb4')]){_0x1929c7=_0x4998a[_0x65ec('0x37')]({'plain':!![]});if(_0x1929c7[_0x65ec('0xb4')]&&_0x1929c7[_0x65ec('0xb4')][_0x65ec('0x9a')]['length']){return _0x1929c7[_0x65ec('0xb4')]['Contacts'][0x0];}return db[_0x65ec('0x85')][_0x65ec('0x5c')](_[_0x65ec('0xb5')](_0x36381a[_0x65ec('0x5d')],{'firstName':_0x22528e,'mobile':_0x22528e,'phone':_0x22528e,'ListId':_0x1929c7[_0x65ec('0x99')]}));}})[_0x65ec('0x1e')](handleEntityNotFound(_0x5ac2b0,null))[_0x65ec('0x1e')](function(_0x205916){if(_0x205916){_0x3af098=_0x205916;return db[_0x65ec('0x9e')][_0x65ec('0x5b')]({'where':{'ContactId':_0x3af098['id'],'closed':![],'WhatsappAccountId':_0x1929c7['id']}})['then'](function(_0x1cb25d){if(_0x1cb25d){return[_0x1cb25d,![]];}return db[_0x65ec('0x9e')][_0x65ec('0x5c')]({'UserId':_0x36381a[_0x65ec('0x5e')]['id'],'ContactId':_0x3af098['id'],'WhatsappAccountId':_0x1929c7['id'],'phone':_0x22528e,'firstMsgDirection':_0x65ec('0xb6'),'Messages':[_['merge'](_0x36381a[_0x65ec('0x5d')],{'read':![],'body':_0x36381a[_0x65ec('0x5d')][_0x65ec('0x5d')],'phone':_0x22528e,'WhatsappAccountId':_0x1929c7['id'],'UserId':_0x36381a[_0x65ec('0x5e')]['id'],'ContactId':_0x3af098['id']})]},{'include':[{'model':db[_0x65ec('0xa5')],'as':_0x65ec('0xb7')}]})[_0x65ec('0x1e')](function(_0x422bd2){return[_0x422bd2,!![]];});});}})[_0x65ec('0x9f')](function(_0x506ccf,_0x16eded){if(_0x16eded){return _0x506ccf;}return db[_0x65ec('0xa5')]['create'](_[_0x65ec('0x51')](_0x36381a['body'],{'read':![],'body':_0x36381a[_0x65ec('0x5d')][_0x65ec('0x5d')],'phone':_0x22528e,'WhatsappAccountId':_0x1929c7['id'],'WhatsappInteractionId':_0x506ccf['id'],'UserId':_0x36381a[_0x65ec('0x5e')]['id'],'ContactId':_0x3af098['id']}))[_0x65ec('0x1e')](function(_0x566320){_0x506ccf[_0x65ec('0xb8')][_0x65ec('0xb7')]=[];_0x506ccf[_0x65ec('0xb8')][_0x65ec('0xb7')]['push'](_0x566320['dataValues']);return _0x506ccf;});})[_0x65ec('0x1e')](respondWithResult(_0x5ac2b0,null))['catch'](handleError(_0x5ac2b0,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 4f654bd..3abfecc 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 _0xcf98=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x25e2bc,_0x27d1ef){var _0x5152d3=function(_0x354708){while(--_0x354708){_0x25e2bc['push'](_0x25e2bc['shift']());}};_0x5152d3(++_0x27d1ef);}(_0xcf98,0x8d));var _0x8cf9=function(_0x278222,_0x4e2388){_0x278222=_0x278222-0x0;var _0x3b2500=_0xcf98[_0x278222];return _0x3b2500;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x8cf9('0x0'))['db'][_0x8cf9('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8cf9('0x2')](0x0);var events={'afterCreate':_0x8cf9('0x3'),'afterUpdate':_0x8cf9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x479f6b){return function(_0x2ebf57,_0x28ae77,_0x1ce13f){WhatsappAccountEvents[_0x8cf9('0x5')](_0x479f6b+':'+_0x2ebf57['id'],_0x2ebf57);WhatsappAccountEvents[_0x8cf9('0x5')](_0x479f6b,_0x2ebf57);_0x1ce13f(null);};}for(var e in events){if(events[_0x8cf9('0x6')](e)){var event=events[e];WhatsappAccount[_0x8cf9('0x7')](e,emitEvent(event));}}module[_0x8cf9('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x9b0d=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x5dc54f,_0x43a500){_0x5dc54f=_0x5dc54f-0x0;var _0x170843=_0x9b0d[_0x5dc54f];return _0x170843;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xd9b0('0x0'))['db'][_0xd9b0('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd9b0('0x2')](0x0);var events={'afterCreate':_0xd9b0('0x3'),'afterUpdate':'update','afterDestroy':_0xd9b0('0x4')};function emitEvent(_0x32fa05){return function(_0x3168e3,_0xe33596,_0x4ae1d0){WhatsappAccountEvents[_0xd9b0('0x5')](_0x32fa05+':'+_0x3168e3['id'],_0x3168e3);WhatsappAccountEvents[_0xd9b0('0x5')](_0x32fa05,_0x3168e3);_0x4ae1d0(null);};}for(var e in events){if(events[_0xd9b0('0x6')](e)){var event=events[e];WhatsappAccount[_0xd9b0('0x7')](e,emitEvent(event));}}module[_0xd9b0('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a38a175..0e247d1 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 _0x4196=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','WhatsappAccount','whatsapp_accounts','util'];(function(_0x457e09,_0x4f9368){var _0xf20158=function(_0x357c05){while(--_0x357c05){_0x457e09['push'](_0x457e09['shift']());}};_0xf20158(++_0x4f9368);}(_0x4196,0x18b));var _0x6419=function(_0x57a316,_0xb1bbe8){_0x57a316=_0x57a316-0x0;var _0x747168=_0x4196[_0x57a316];return _0x747168;};'use strict';var _=require('lodash');var util=require(_0x6419('0x0'));var logger=require(_0x6419('0x1'))(_0x6419('0x2'));var moment=require(_0x6419('0x3'));var BPromise=require(_0x6419('0x4'));var rp=require(_0x6419('0x5'));var fs=require('fs');var path=require(_0x6419('0x6'));var rimraf=require(_0x6419('0x7'));var config=require(_0x6419('0x8'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x262466,_0x40d1a6){return _0x262466['define'](_0x6419('0x9'),attributes,{'tableName':_0x6419('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x543f=['define','whatsapp_accounts','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5b533e,_0x3ef7e4){var _0x3eeb3a=function(_0x3d7597){while(--_0x3d7597){_0x5b533e['push'](_0x5b533e['shift']());}};_0x3eeb3a(++_0x3ef7e4);}(_0x543f,0xe8));var _0xf543=function(_0x584b71,_0x4b8559){_0x584b71=_0x584b71-0x0;var _0x161e94=_0x543f[_0x584b71];return _0x161e94;};'use strict';var _=require(_0xf543('0x0'));var util=require('util');var logger=require(_0xf543('0x1'))(_0xf543('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf543('0x3'));var fs=require('fs');var path=require(_0xf543('0x4'));var rimraf=require(_0xf543('0x5'));var config=require(_0xf543('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0xf543('0x7')]=function(_0x2139d5,_0x5640c8){return _0x2139d5[_0xf543('0x8')]('WhatsappAccount',attributes,{'tableName':_0xf543('0x9'),'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 c38d0c2..20f64d5 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 _0x86e7=['request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s'];(function(_0x4a104c,_0x31eb74){var _0x11f870=function(_0x3b18c3){while(--_0x3b18c3){_0x4a104c['push'](_0x4a104c['shift']());}};_0x11f870(++_0x31eb74);}(_0x86e7,0xf1));var _0x786e=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x86e7[_0x44a64f];return _0x52024b;};'use strict';var _=require(_0x786e('0x0'));var util=require(_0x786e('0x1'));var moment=require(_0x786e('0x2'));var BPromise=require('bluebird');var rs=require(_0x786e('0x3'));var fs=require('fs');var Redis=require(_0x786e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x786e('0x5'));var logger=require(_0x786e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x786e('0x7')][_0x786e('0x8')]({'port':0x232a});config['redis']=_[_0x786e('0x9')](config[_0x786e('0xa')],{'host':_0x786e('0xb'),'port':0x18eb});var socket=require(_0x786e('0xc'))(new Redis(config[_0x786e('0xa')]));require(_0x786e('0xd'))[_0x786e('0xe')](socket);function respondWithRpcPromise(_0x5ae463,_0x524bb5,_0x5dea01){return new BPromise(function(_0x53a63d,_0x3e4f60){return client[_0x786e('0xf')](_0x5ae463,_0x5dea01)['then'](function(_0x2e16b3){logger[_0x786e('0x10')](_0x786e('0x11'),_0x524bb5,_0x786e('0x12'));logger[_0x786e('0x13')](_0x786e('0x14'),_0x524bb5,_0x786e('0x12'),JSON[_0x786e('0x15')](_0x2e16b3));if(_0x2e16b3['error']){if(_0x2e16b3[_0x786e('0x16')][_0x786e('0x17')]===0x1f4){logger['error'](_0x786e('0x11'),_0x524bb5,_0x2e16b3[_0x786e('0x16')][_0x786e('0x18')]);return _0x3e4f60(_0x2e16b3[_0x786e('0x16')][_0x786e('0x18')]);}logger[_0x786e('0x16')](_0x786e('0x11'),_0x524bb5,_0x2e16b3[_0x786e('0x16')][_0x786e('0x18')]);return _0x53a63d(_0x2e16b3[_0x786e('0x16')][_0x786e('0x18')]);}else{logger[_0x786e('0x10')](_0x786e('0x11'),_0x524bb5,_0x786e('0x12'));_0x53a63d(_0x2e16b3[_0x786e('0x19')][_0x786e('0x18')]);}})['catch'](function(_0x30a218){logger[_0x786e('0x16')](_0x786e('0x11'),_0x524bb5,_0x30a218);_0x3e4f60(_0x30a218);});});}exports[_0x786e('0x1a')]=function(_0x5ad588){var _0x48ee52=this;return new Promise(function(_0xfca95f,_0x1e8383){return db[_0x786e('0x1b')][_0x786e('0x1c')]({'raw':_0x5ad588['options']?_0x5ad588[_0x786e('0x1d')][_0x786e('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ad588[_0x786e('0x1d')]?_0x5ad588['options'][_0x786e('0x1f')]||null:null,'attributes':_0x5ad588[_0x786e('0x1d')]?_0x5ad588[_0x786e('0x1d')][_0x786e('0x20')]||null:null,'include':_0x5ad588[_0x786e('0x1d')]?_0x5ad588[_0x786e('0x1d')][_0x786e('0x21')]?_[_0x786e('0x22')](_0x5ad588['options'][_0x786e('0x21')],function(_0x3fb580){return{'model':db[_0x3fb580[_0x786e('0x23')]],'as':_0x3fb580['as'],'attributes':_0x3fb580[_0x786e('0x20')],'include':_0x3fb580[_0x786e('0x21')]?_['map'](_0x3fb580[_0x786e('0x21')],function(_0x4fe4f4){return{'model':db[_0x4fe4f4[_0x786e('0x23')]],'as':_0x4fe4f4['as'],'attributes':_0x4fe4f4[_0x786e('0x20')],'include':_0x4fe4f4[_0x786e('0x21')]?_[_0x786e('0x22')](_0x4fe4f4[_0x786e('0x21')],function(_0x20be43){return{'model':db[_0x20be43[_0x786e('0x23')]],'as':_0x20be43['as'],'attributes':_0x20be43[_0x786e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x786e('0x24')](function(_0xda56db){logger[_0x786e('0x10')](_0x786e('0x1a'),_0x5ad588);logger[_0x786e('0x13')]('ShowWhatsappAccount',_0x5ad588,JSON['stringify'](_0xda56db));_0xfca95f(_0xda56db);})['catch'](function(_0x45361e){logger[_0x786e('0x16')](_0x786e('0x1a'),_0x45361e['message'],_0x5ad588);_0x1e8383(_0x48ee52[_0x786e('0x16')](0x1f4,_0x45361e[_0x786e('0x18')]));});});}; \ No newline at end of file +var _0xaaff=['localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','include','model','attributes','map','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x592df5,_0x3e64e6){var _0x29f40e=function(_0x5ad3bf){while(--_0x5ad3bf){_0x592df5['push'](_0x592df5['shift']());}};_0x29f40e(++_0x3e64e6);}(_0xaaff,0xad));var _0xfaaf=function(_0x3b204d,_0x2868c6){_0x3b204d=_0x3b204d-0x0;var _0x31c4dd=_0xaaff[_0x3b204d];return _0x31c4dd;};'use strict';var _=require('lodash');var util=require(_0xfaaf('0x0'));var moment=require(_0xfaaf('0x1'));var BPromise=require(_0xfaaf('0x2'));var rs=require(_0xfaaf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfaaf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfaaf('0x5'));var config=require(_0xfaaf('0x6'));var jayson=require(_0xfaaf('0x7'));var client=jayson[_0xfaaf('0x8')][_0xfaaf('0x9')]({'port':0x232a});config[_0xfaaf('0xa')]=_[_0xfaaf('0xb')](config[_0xfaaf('0xa')],{'host':_0xfaaf('0xc'),'port':0x18eb});var socket=require(_0xfaaf('0xd'))(new Redis(config[_0xfaaf('0xa')]));require(_0xfaaf('0xe'))[_0xfaaf('0xf')](socket);function respondWithRpcPromise(_0x5dfb50,_0x54bf0a,_0x34b83c){return new BPromise(function(_0xc7d92e,_0x41950){return client[_0xfaaf('0x10')](_0x5dfb50,_0x34b83c)[_0xfaaf('0x11')](function(_0x84a596){logger[_0xfaaf('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x54bf0a,'request\x20sent');logger[_0xfaaf('0x13')](_0xfaaf('0x14'),_0x54bf0a,_0xfaaf('0x15'),JSON[_0xfaaf('0x16')](_0x84a596));if(_0x84a596['error']){if(_0x84a596[_0xfaaf('0x17')][_0xfaaf('0x18')]===0x1f4){logger[_0xfaaf('0x17')](_0xfaaf('0x19'),_0x54bf0a,_0x84a596[_0xfaaf('0x17')][_0xfaaf('0x1a')]);return _0x41950(_0x84a596['error'][_0xfaaf('0x1a')]);}logger[_0xfaaf('0x17')](_0xfaaf('0x19'),_0x54bf0a,_0x84a596[_0xfaaf('0x17')][_0xfaaf('0x1a')]);return _0xc7d92e(_0x84a596['error'][_0xfaaf('0x1a')]);}else{logger['info'](_0xfaaf('0x19'),_0x54bf0a,'request\x20sent');_0xc7d92e(_0x84a596['result'][_0xfaaf('0x1a')]);}})[_0xfaaf('0x1b')](function(_0x4b6dc2){logger['error'](_0xfaaf('0x19'),_0x54bf0a,_0x4b6dc2);_0x41950(_0x4b6dc2);});});}exports[_0xfaaf('0x1c')]=function(_0x47641a){var _0x24672e=this;return new Promise(function(_0x1ae346,_0x197691){return db[_0xfaaf('0x1d')][_0xfaaf('0x1e')]({'raw':_0x47641a[_0xfaaf('0x1f')]?_0x47641a['options'][_0xfaaf('0x20')]===undefined?!![]:![]:!![],'where':_0x47641a['options']?_0x47641a[_0xfaaf('0x1f')]['where']||null:null,'attributes':_0x47641a['options']?_0x47641a[_0xfaaf('0x1f')]['attributes']||null:null,'include':_0x47641a[_0xfaaf('0x1f')]?_0x47641a[_0xfaaf('0x1f')]['include']?_['map'](_0x47641a[_0xfaaf('0x1f')][_0xfaaf('0x21')],function(_0x9ba174){return{'model':db[_0x9ba174[_0xfaaf('0x22')]],'as':_0x9ba174['as'],'attributes':_0x9ba174[_0xfaaf('0x23')],'include':_0x9ba174[_0xfaaf('0x21')]?_[_0xfaaf('0x24')](_0x9ba174['include'],function(_0x3d7c49){return{'model':db[_0x3d7c49[_0xfaaf('0x22')]],'as':_0x3d7c49['as'],'attributes':_0x3d7c49['attributes'],'include':_0x3d7c49[_0xfaaf('0x21')]?_[_0xfaaf('0x24')](_0x3d7c49[_0xfaaf('0x21')],function(_0x4bb847){return{'model':db[_0x4bb847[_0xfaaf('0x22')]],'as':_0x4bb847['as'],'attributes':_0x4bb847[_0xfaaf('0x23')]};}):[]};}):[]};}):[]:[]})[_0xfaaf('0x11')](function(_0x3999c6){logger['info'](_0xfaaf('0x1c'),_0x47641a);logger[_0xfaaf('0x13')]('ShowWhatsappAccount',_0x47641a,JSON['stringify'](_0x3999c6));_0x1ae346(_0x3999c6);})[_0xfaaf('0x1b')](function(_0x5b65e6){logger[_0xfaaf('0x17')](_0xfaaf('0x1c'),_0x5b65e6[_0xfaaf('0x1a')],_0x47641a);_0x197691(_0x24672e[_0xfaaf('0x17')](0x1f4,_0x5b65e6[_0xfaaf('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index e6f9705..3070bf4 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 _0x0b6a=['save','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x5d8197,_0x55c6c7){var _0x6f9b35=function(_0xb4db10){while(--_0xb4db10){_0x5d8197['push'](_0x5d8197['shift']());}};_0x6f9b35(++_0x55c6c7);}(_0x0b6a,0x11e));var _0xa0b6=function(_0x12c7dc,_0x54a2f9){_0x12c7dc=_0x12c7dc-0x0;var _0x4f4acb=_0x0b6a[_0x12c7dc];return _0x4f4acb;};'use strict';var WhatsappAccountEvents=require(_0xa0b6('0x0'));var events=[_0xa0b6('0x1'),'remove','update'];function createListener(_0x11a53c,_0x35f18a){return function(_0x6978ab){_0x35f18a[_0xa0b6('0x2')](_0x11a53c,_0x6978ab);};}function removeListener(_0xdad245,_0x254768){return function(){WhatsappAccountEvents[_0xa0b6('0x3')](_0xdad245,_0x254768);};}exports[_0xa0b6('0x4')]=function(_0x4e12b4){for(var _0x5e2a78=0x0,_0x555e10=events[_0xa0b6('0x5')];_0x5e2a78<_0x555e10;_0x5e2a78++){var _0x4e466b=events[_0x5e2a78];var _0x450f1e=createListener(_0xa0b6('0x6')+_0x4e466b,_0x4e12b4);WhatsappAccountEvents['on'](_0x4e466b,_0x450f1e);}}; \ No newline at end of file +var _0x87cd=['save','update','emit','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x1b4ed7,_0x5faf41){var _0x271110=function(_0x10b24a){while(--_0x10b24a){_0x1b4ed7['push'](_0x1b4ed7['shift']());}};_0x271110(++_0x5faf41);}(_0x87cd,0xf5));var _0xd87c=function(_0x5b98bd,_0x1461c9){_0x5b98bd=_0x5b98bd-0x0;var _0x5147be=_0x87cd[_0x5b98bd];return _0x5147be;};'use strict';var WhatsappAccountEvents=require(_0xd87c('0x0'));var events=[_0xd87c('0x1'),'remove',_0xd87c('0x2')];function createListener(_0x2c88e2,_0x136a52){return function(_0x539382){_0x136a52[_0xd87c('0x3')](_0x2c88e2,_0x539382);};}function removeListener(_0x177c84,_0x2627c1){return function(){WhatsappAccountEvents['removeListener'](_0x177c84,_0x2627c1);};}exports['register']=function(_0x566e38){for(var _0x3ef959=0x0,_0x8218aa=events[_0xd87c('0x4')];_0x3ef959<_0x8218aa;_0x3ef959++){var _0x1aae2d=events[_0x3ef959];var _0x36eb4d=createListener(_0xd87c('0x5')+_0x1aae2d,_0x566e38);WhatsappAccountEvents['on'](_0x1aae2d,_0x36eb4d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 1cb8aef..a657b1a 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 _0x092e=['../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x50f509,_0x16ebe8){var _0x532391=function(_0x248795){while(--_0x248795){_0x50f509['push'](_0x50f509['shift']());}};_0x532391(++_0x16ebe8);}(_0x092e,0xc0));var _0xe092=function(_0x16fee7,_0x37cdbd){_0x16fee7=_0x16fee7-0x0;var _0x266774=_0x092e[_0x16fee7];return _0x266774;};'use strict';var multer=require(_0xe092('0x0'));var util=require(_0xe092('0x1'));var path=require('path');var timeout=require(_0xe092('0x2'));var express=require(_0xe092('0x3'));var router=express[_0xe092('0x4')]();var auth=require(_0xe092('0x5'));var interaction=require(_0xe092('0x6'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0xe092('0x7')](),controller[_0xe092('0x8')]);router[_0xe092('0x9')](_0xe092('0xa'),auth['isAuthenticated'](),controller[_0xe092('0xb')]);router[_0xe092('0xc')]('/',auth[_0xe092('0x7')](),controller[_0xe092('0xd')]);router[_0xe092('0xe')]('/:id',auth[_0xe092('0x7')](),controller[_0xe092('0xf')]);router[_0xe092('0x10')]('/:id',auth[_0xe092('0x7')](),controller['destroy']);module[_0xe092('0x11')]=router; \ No newline at end of file +var _0x45e3=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4b3f3e,_0x47dfcc){var _0x921fc3=function(_0x3e4b3b){while(--_0x3e4b3b){_0x4b3f3e['push'](_0x4b3f3e['shift']());}};_0x921fc3(++_0x47dfcc);}(_0x45e3,0x1e9));var _0x345e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x45e3[_0x3054be];return _0x3df150;};'use strict';var multer=require('multer');var util=require(_0x345e('0x0'));var path=require(_0x345e('0x1'));var timeout=require(_0x345e('0x2'));var express=require('express');var router=express[_0x345e('0x3')]();var auth=require(_0x345e('0x4'));var interaction=require(_0x345e('0x5'));var config=require(_0x345e('0x6'));var controller=require(_0x345e('0x7'));router[_0x345e('0x8')]('/',auth[_0x345e('0x9')](),controller[_0x345e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x345e('0xb')]('/',auth[_0x345e('0x9')](),controller[_0x345e('0xc')]);router[_0x345e('0xd')](_0x345e('0xe'),auth[_0x345e('0x9')](),controller[_0x345e('0xf')]);router[_0x345e('0x10')](_0x345e('0xe'),auth[_0x345e('0x9')](),controller[_0x345e('0x11')]);module[_0x345e('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index cc83aa4..a4a31bb 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 _0x4248=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x385729,_0xd675){var _0x94abc2=function(_0x5f0ee1){while(--_0x5f0ee1){_0x385729['push'](_0x385729['shift']());}};_0x94abc2(++_0xd675);}(_0x4248,0x192));var _0x8424=function(_0x4efc87,_0x17a7d1){_0x4efc87=_0x4efc87-0x0;var _0x191fc4=_0x4248[_0x4efc87];return _0x191fc4;};'use strict';var Sequelize=require(_0x8424('0x0'));module[_0x8424('0x1')]={'priority':{'type':Sequelize[_0x8424('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8424('0x3')],'allowNull':![],'defaultValue':_0x8424('0x4')},'appdata':{'type':Sequelize[_0x8424('0x5')]()},'description':{'type':Sequelize[_0x8424('0x3')]},'interval':{'type':Sequelize[_0x8424('0x3')],'defaultValue':_0x8424('0x6')}}; \ No newline at end of file +var _0x259d=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x2d5dcf,_0xf71498){var _0x42a3e8=function(_0xaa41d8){while(--_0xaa41d8){_0x2d5dcf['push'](_0x2d5dcf['shift']());}};_0x42a3e8(++_0xf71498);}(_0x259d,0x1e3));var _0xd259=function(_0x5d812b,_0xa39fa9){_0x5d812b=_0x5d812b-0x0;var _0x365fb6=_0x259d[_0x5d812b];return _0x365fb6;};'use strict';var Sequelize=require('sequelize');module[_0xd259('0x0')]={'priority':{'type':Sequelize[_0xd259('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd259('0x2')],'allowNull':![],'defaultValue':_0xd259('0x3')},'appdata':{'type':Sequelize[_0xd259('0x4')]()},'description':{'type':Sequelize[_0xd259('0x2')]},'interval':{'type':Sequelize[_0xd259('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 00c5fa5..8dfa8f6 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 _0x8f1a=['../../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','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','create','body','find','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x386a04,_0x184484){var _0x3ac537=function(_0x3ea883){while(--_0x3ea883){_0x386a04['push'](_0x386a04['shift']());}};_0x3ac537(++_0x184484);}(_0x8f1a,0x82));var _0xa8f1=function(_0x381a3a,_0x2931c6){_0x381a3a=_0x381a3a-0x0;var _0x341f8d=_0x8f1a[_0x381a3a];return _0x341f8d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa8f1('0x0'));var jsonpatch=require(_0xa8f1('0x1'));var rp=require(_0xa8f1('0x2'));var moment=require(_0xa8f1('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa8f1('0x4'));var path=require(_0xa8f1('0x5'));var sox=require(_0xa8f1('0x6'));var csv=require(_0xa8f1('0x7'));var ejs=require(_0xa8f1('0x8'));var fs=require('fs');var _=require(_0xa8f1('0x9'));var squel=require('squel');var crypto=require(_0xa8f1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa8f1('0xb'));var toCsv=require(_0xa8f1('0x7'));var querystring=require(_0xa8f1('0xc'));var Papa=require(_0xa8f1('0xd'));var Redis=require(_0xa8f1('0xe'));var authService=require(_0xa8f1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa8f1('0x10'));var hardwareService=require(_0xa8f1('0x11'));var logger=require(_0xa8f1('0x12'))(_0xa8f1('0x13'));var utils=require(_0xa8f1('0x14'));var config=require(_0xa8f1('0x15'));var db=require(_0xa8f1('0x16'))['db'];function respondWithStatusCode(_0x493434,_0x587885){_0x587885=_0x587885||0xcc;return function(_0x5724b4){if(_0x5724b4){return _0x493434['sendStatus'](_0x587885);}return _0x493434[_0xa8f1('0x17')](_0x587885)[_0xa8f1('0x18')]();};}function respondWithResult(_0x28328b,_0x34bce7){_0x34bce7=_0x34bce7||0xc8;return function(_0x134ffa){if(_0x134ffa){return _0x28328b[_0xa8f1('0x17')](_0x34bce7)[_0xa8f1('0x19')](_0x134ffa);}};}function respondWithFilteredResult(_0x3a3de5,_0x1d1da9){return function(_0x1367aa){if(_0x1367aa){var _0x477441=_0x1367aa[_0xa8f1('0x1a')],_0xbfd0dd=_0x1d1da9['offset'],_0x25817a=_0x1d1da9[_0xa8f1('0x1b')]+_0x1d1da9[_0xa8f1('0x1c')],_0x15c9b8;if(_0x25817a>=_0x477441){_0x25817a=_0x477441;_0x15c9b8=0xc8;}else{_0x15c9b8=0xce;}_0x3a3de5['status'](_0x15c9b8);return _0x3a3de5[_0xa8f1('0x1d')](_0xa8f1('0x1e'),_0xbfd0dd+'-'+_0x25817a+'/'+_0x477441)['json'](_0x1367aa);}return null;};}function patchUpdates(_0x5369f9){return function(_0x2b4be5){try{jsonpatch[_0xa8f1('0x1f')](_0x2b4be5,_0x5369f9,!![]);}catch(_0x18f748){return BPromise[_0xa8f1('0x20')](_0x18f748);}return _0x2b4be5[_0xa8f1('0x21')]();};}function saveUpdates(_0xd6b84,_0x158668){return function(_0x577ace){if(_0x577ace){return _0x577ace[_0xa8f1('0x22')](_0xd6b84)[_0xa8f1('0x23')](function(_0x24977c){return _0x24977c;});}return null;};}function removeEntity(_0x893df1,_0x57fa65){return function(_0x3b8f2b){if(_0x3b8f2b){return _0x3b8f2b[_0xa8f1('0x24')]()[_0xa8f1('0x23')](function(){_0x893df1[_0xa8f1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36b7d2,_0x164fc3){return function(_0x56c621){if(!_0x56c621){_0x36b7d2[_0xa8f1('0x25')](0x194);}return _0x56c621;};}function handleError(_0x51bb18,_0x8e46ff){_0x8e46ff=_0x8e46ff||0x1f4;return function(_0x4a8987){logger[_0xa8f1('0x26')](_0x4a8987[_0xa8f1('0x27')]);if(_0x4a8987['name']){delete _0x4a8987['name'];}_0x51bb18['status'](_0x8e46ff)[_0xa8f1('0x28')](_0x4a8987);};}exports[_0xa8f1('0x29')]=function(_0x5470df,_0x162654){var _0x18cc47={},_0x165924={},_0x588055={'count':0x0,'rows':[]};var _0x194696=_[_0xa8f1('0x2a')](db[_0xa8f1('0x2b')][_0xa8f1('0x2c')],function(_0xa419be){return{'name':_0xa419be[_0xa8f1('0x2d')],'type':_0xa419be[_0xa8f1('0x2e')]['key']};});_0x165924[_0xa8f1('0x2f')]=_[_0xa8f1('0x2a')](_0x194696,_0xa8f1('0x30'));_0x165924[_0xa8f1('0x31')]=_[_0xa8f1('0x32')](_0x5470df['query']);_0x165924[_0xa8f1('0x33')]=_[_0xa8f1('0x34')](_0x165924[_0xa8f1('0x2f')],_0x165924[_0xa8f1('0x31')]);_0x18cc47[_0xa8f1('0x35')]=_[_0xa8f1('0x34')](_0x165924[_0xa8f1('0x2f')],qs[_0xa8f1('0x36')](_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x36')]));_0x18cc47[_0xa8f1('0x35')]=_0x18cc47['attributes'][_0xa8f1('0x37')]?_0x18cc47[_0xa8f1('0x35')]:_0x165924[_0xa8f1('0x2f')];if(!_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x38')](_0xa8f1('0x39'))){_0x18cc47[_0xa8f1('0x1c')]=qs[_0xa8f1('0x1c')](_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x1c')]);_0x18cc47[_0xa8f1('0x1b')]=qs['offset'](_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x1b')]);}_0x18cc47['order']=qs[_0xa8f1('0x3a')](_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x3a')]);_0x18cc47[_0xa8f1('0x3b')]=qs['filters'](_[_0xa8f1('0x3c')](_0x5470df['query'],_0x165924[_0xa8f1('0x33')]),_0x194696);if(_0x5470df['query'][_0xa8f1('0x3d')]){_0x18cc47[_0xa8f1('0x3b')]=_[_0xa8f1('0x3e')](_0x18cc47['where'],{'$or':_[_0xa8f1('0x2a')](_0x194696,function(_0x388b6c){if(_0x388b6c['type']!==_0xa8f1('0x3f')){var _0x2765da={};_0x2765da[_0x388b6c[_0xa8f1('0x30')]]={'$like':'%'+_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x3d')]+'%'};return _0x2765da;}})});}_0x18cc47=_[_0xa8f1('0x3e')]({},_0x18cc47,_0x5470df['options']);var _0x37ad20={'where':_0x18cc47[_0xa8f1('0x3b')]};return db[_0xa8f1('0x2b')]['count'](_0x37ad20)[_0xa8f1('0x23')](function(_0x205f5d){_0x588055[_0xa8f1('0x1a')]=_0x205f5d;if(_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x40')]){_0x18cc47[_0xa8f1('0x41')]=[{'all':!![]}];}return db[_0xa8f1('0x2b')][_0xa8f1('0x42')](_0x18cc47);})['then'](function(_0x371b41){_0x588055['rows']=_0x371b41;return _0x588055;})[_0xa8f1('0x23')](respondWithFilteredResult(_0x162654,_0x18cc47))[_0xa8f1('0x43')](handleError(_0x162654,null));};exports[_0xa8f1('0x44')]=function(_0x1c4ea1,_0x3c68a5){var _0x22c24c={'raw':!![],'where':{'id':_0x1c4ea1[_0xa8f1('0x45')]['id']}},_0x32e4a4={};_0x32e4a4[_0xa8f1('0x2f')]=_['keys'](db[_0xa8f1('0x2b')][_0xa8f1('0x2c')]);_0x32e4a4[_0xa8f1('0x31')]=_['keys'](_0x1c4ea1[_0xa8f1('0x31')]);_0x32e4a4[_0xa8f1('0x33')]=_[_0xa8f1('0x34')](_0x32e4a4[_0xa8f1('0x2f')],_0x32e4a4[_0xa8f1('0x31')]);_0x22c24c[_0xa8f1('0x35')]=_[_0xa8f1('0x34')](_0x32e4a4[_0xa8f1('0x2f')],qs[_0xa8f1('0x36')](_0x1c4ea1[_0xa8f1('0x31')]['fields']));_0x22c24c[_0xa8f1('0x35')]=_0x22c24c[_0xa8f1('0x35')]['length']?_0x22c24c[_0xa8f1('0x35')]:_0x32e4a4[_0xa8f1('0x2f')];if(_0x1c4ea1['query']['includeAll']){_0x22c24c[_0xa8f1('0x41')]=[{'all':!![]}];}_0x22c24c=_[_0xa8f1('0x3e')]({},_0x22c24c,_0x1c4ea1[_0xa8f1('0x46')]);return db[_0xa8f1('0x2b')]['find'](_0x22c24c)[_0xa8f1('0x23')](handleEntityNotFound(_0x3c68a5,null))[_0xa8f1('0x23')](respondWithResult(_0x3c68a5,null))[_0xa8f1('0x43')](handleError(_0x3c68a5,null));};exports[_0xa8f1('0x47')]=function(_0x57574f,_0x3bcd4d){return db[_0xa8f1('0x2b')][_0xa8f1('0x47')](_0x57574f['body'],{})[_0xa8f1('0x23')](respondWithResult(_0x3bcd4d,0xc9))['catch'](handleError(_0x3bcd4d,null));};exports[_0xa8f1('0x22')]=function(_0x5b598e,_0x4a3dbb){if(_0x5b598e['body']['id']){delete _0x5b598e[_0xa8f1('0x48')]['id'];}return db['WhatsappApplication'][_0xa8f1('0x49')]({'where':{'id':_0x5b598e[_0xa8f1('0x45')]['id']}})[_0xa8f1('0x23')](handleEntityNotFound(_0x4a3dbb,null))['then'](saveUpdates(_0x5b598e[_0xa8f1('0x48')],null))['then'](respondWithResult(_0x4a3dbb,null))[_0xa8f1('0x43')](handleError(_0x4a3dbb,null));};exports[_0xa8f1('0x24')]=function(_0x1e4d2d,_0x5861b6){return db['WhatsappApplication']['find']({'where':{'id':_0x1e4d2d[_0xa8f1('0x45')]['id']}})[_0xa8f1('0x23')](handleEntityNotFound(_0x5861b6,null))['then'](removeEntity(_0x5861b6,null))[_0xa8f1('0x43')](handleError(_0x5861b6,null));}; \ No newline at end of file +var _0x5327=['fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','rows','catch','show','keys','include','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x57ea70,_0x5af725){var _0x558a2a=function(_0x3ec44f){while(--_0x3ec44f){_0x57ea70['push'](_0x57ea70['shift']());}};_0x558a2a(++_0x5af725);}(_0x5327,0xa7));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7532('0x0'));var emlformat=require(_0x7532('0x1'));var rimraf=require(_0x7532('0x2'));var zipdir=require(_0x7532('0x3'));var jsonpatch=require(_0x7532('0x4'));var rp=require('request-promise');var moment=require(_0x7532('0x5'));var BPromise=require(_0x7532('0x6'));var Mustache=require(_0x7532('0x7'));var util=require(_0x7532('0x8'));var path=require(_0x7532('0x9'));var sox=require(_0x7532('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7532('0xb'));var squel=require(_0x7532('0xc'));var crypto=require(_0x7532('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7532('0xe'));var querystring=require(_0x7532('0xf'));var Papa=require(_0x7532('0x10'));var Redis=require(_0x7532('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7532('0x12'));var hardwareService=require(_0x7532('0x13'));var logger=require('../../config/logger')(_0x7532('0x14'));var utils=require('../../config/utils');var config=require(_0x7532('0x15'));var db=require(_0x7532('0x16'))['db'];function respondWithStatusCode(_0x145943,_0x23c50b){_0x23c50b=_0x23c50b||0xcc;return function(_0x120939){if(_0x120939){return _0x145943[_0x7532('0x17')](_0x23c50b);}return _0x145943[_0x7532('0x18')](_0x23c50b)[_0x7532('0x19')]();};}function respondWithResult(_0x1efe8c,_0x35e731){_0x35e731=_0x35e731||0xc8;return function(_0x1565d3){if(_0x1565d3){return _0x1efe8c[_0x7532('0x18')](_0x35e731)['json'](_0x1565d3);}};}function respondWithFilteredResult(_0x34d81a,_0x2aa06a){return function(_0x251cc1){if(_0x251cc1){var _0x318a01=_0x251cc1[_0x7532('0x1a')],_0x4c2915=_0x2aa06a[_0x7532('0x1b')],_0x1600d1=_0x2aa06a[_0x7532('0x1b')]+_0x2aa06a['limit'],_0x3abfd7;if(_0x1600d1>=_0x318a01){_0x1600d1=_0x318a01;_0x3abfd7=0xc8;}else{_0x3abfd7=0xce;}_0x34d81a[_0x7532('0x18')](_0x3abfd7);return _0x34d81a[_0x7532('0x1c')](_0x7532('0x1d'),_0x4c2915+'-'+_0x1600d1+'/'+_0x318a01)[_0x7532('0x1e')](_0x251cc1);}return null;};}function patchUpdates(_0x2e17d3){return function(_0x2c21b4){try{jsonpatch[_0x7532('0x1f')](_0x2c21b4,_0x2e17d3,!![]);}catch(_0x29fc57){return BPromise['reject'](_0x29fc57);}return _0x2c21b4[_0x7532('0x20')]();};}function saveUpdates(_0x189a43,_0x2a1ad8){return function(_0x592309){if(_0x592309){return _0x592309[_0x7532('0x21')](_0x189a43)[_0x7532('0x22')](function(_0x18296e){return _0x18296e;});}return null;};}function removeEntity(_0x9757e,_0xe869d2){return function(_0x9d2e6c){if(_0x9d2e6c){return _0x9d2e6c[_0x7532('0x23')]()[_0x7532('0x22')](function(){_0x9757e[_0x7532('0x18')](0xcc)[_0x7532('0x19')]();});}};}function handleEntityNotFound(_0x5e3b71,_0x1a75f2){return function(_0x1dc4b5){if(!_0x1dc4b5){_0x5e3b71[_0x7532('0x17')](0x194);}return _0x1dc4b5;};}function handleError(_0x2e526c,_0x29a775){_0x29a775=_0x29a775||0x1f4;return function(_0x54b0bb){logger['error'](_0x54b0bb['stack']);if(_0x54b0bb[_0x7532('0x24')]){delete _0x54b0bb[_0x7532('0x24')];}_0x2e526c[_0x7532('0x18')](_0x29a775)[_0x7532('0x25')](_0x54b0bb);};}exports[_0x7532('0x26')]=function(_0x2df19e,_0x2f4f49){var _0x6eb1d1={},_0x5b775f={},_0x261e39={'count':0x0,'rows':[]};var _0x56aca5=_[_0x7532('0x27')](db['WhatsappApplication'][_0x7532('0x28')],function(_0x176d9f){return{'name':_0x176d9f[_0x7532('0x29')],'type':_0x176d9f[_0x7532('0x2a')][_0x7532('0x2b')]};});_0x5b775f[_0x7532('0x2c')]=_[_0x7532('0x27')](_0x56aca5,_0x7532('0x24'));_0x5b775f['query']=_['keys'](_0x2df19e[_0x7532('0x2d')]);_0x5b775f[_0x7532('0x2e')]=_[_0x7532('0x2f')](_0x5b775f['model'],_0x5b775f[_0x7532('0x2d')]);_0x6eb1d1[_0x7532('0x30')]=_['intersection'](_0x5b775f['model'],qs[_0x7532('0x31')](_0x2df19e[_0x7532('0x2d')][_0x7532('0x31')]));_0x6eb1d1[_0x7532('0x30')]=_0x6eb1d1[_0x7532('0x30')][_0x7532('0x32')]?_0x6eb1d1[_0x7532('0x30')]:_0x5b775f[_0x7532('0x2c')];if(!_0x2df19e[_0x7532('0x2d')][_0x7532('0x33')](_0x7532('0x34'))){_0x6eb1d1['limit']=qs['limit'](_0x2df19e['query'][_0x7532('0x35')]);_0x6eb1d1[_0x7532('0x1b')]=qs['offset'](_0x2df19e[_0x7532('0x2d')][_0x7532('0x1b')]);}_0x6eb1d1['order']=qs[_0x7532('0x36')](_0x2df19e[_0x7532('0x2d')][_0x7532('0x36')]);_0x6eb1d1[_0x7532('0x37')]=qs[_0x7532('0x2e')](_[_0x7532('0x38')](_0x2df19e[_0x7532('0x2d')],_0x5b775f['filters']),_0x56aca5);if(_0x2df19e[_0x7532('0x2d')][_0x7532('0x39')]){_0x6eb1d1['where']=_[_0x7532('0x3a')](_0x6eb1d1[_0x7532('0x37')],{'$or':_[_0x7532('0x27')](_0x56aca5,function(_0x216955){if(_0x216955[_0x7532('0x2a')]!==_0x7532('0x3b')){var _0x44360a={};_0x44360a[_0x216955[_0x7532('0x24')]]={'$like':'%'+_0x2df19e['query'][_0x7532('0x39')]+'%'};return _0x44360a;}})});}_0x6eb1d1=_[_0x7532('0x3a')]({},_0x6eb1d1,_0x2df19e[_0x7532('0x3c')]);var _0x190236={'where':_0x6eb1d1[_0x7532('0x37')]};return db[_0x7532('0x3d')][_0x7532('0x1a')](_0x190236)['then'](function(_0x542d35){_0x261e39[_0x7532('0x1a')]=_0x542d35;if(_0x2df19e[_0x7532('0x2d')][_0x7532('0x3e')]){_0x6eb1d1['include']=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x6eb1d1);})['then'](function(_0x2e3f1b){_0x261e39[_0x7532('0x3f')]=_0x2e3f1b;return _0x261e39;})['then'](respondWithFilteredResult(_0x2f4f49,_0x6eb1d1))[_0x7532('0x40')](handleError(_0x2f4f49,null));};exports[_0x7532('0x41')]=function(_0xa7fdd6,_0x3d5147){var _0x586d83={'raw':!![],'where':{'id':_0xa7fdd6['params']['id']}},_0x21c99e={};_0x21c99e[_0x7532('0x2c')]=_['keys'](db['WhatsappApplication'][_0x7532('0x28')]);_0x21c99e['query']=_[_0x7532('0x42')](_0xa7fdd6[_0x7532('0x2d')]);_0x21c99e[_0x7532('0x2e')]=_[_0x7532('0x2f')](_0x21c99e[_0x7532('0x2c')],_0x21c99e['query']);_0x586d83[_0x7532('0x30')]=_[_0x7532('0x2f')](_0x21c99e[_0x7532('0x2c')],qs[_0x7532('0x31')](_0xa7fdd6[_0x7532('0x2d')][_0x7532('0x31')]));_0x586d83[_0x7532('0x30')]=_0x586d83[_0x7532('0x30')]['length']?_0x586d83[_0x7532('0x30')]:_0x21c99e[_0x7532('0x2c')];if(_0xa7fdd6[_0x7532('0x2d')]['includeAll']){_0x586d83[_0x7532('0x43')]=[{'all':!![]}];}_0x586d83=_[_0x7532('0x3a')]({},_0x586d83,_0xa7fdd6[_0x7532('0x3c')]);return db[_0x7532('0x3d')][_0x7532('0x44')](_0x586d83)[_0x7532('0x22')](handleEntityNotFound(_0x3d5147,null))[_0x7532('0x22')](respondWithResult(_0x3d5147,null))['catch'](handleError(_0x3d5147,null));};exports[_0x7532('0x45')]=function(_0x712e0b,_0x59ae5e){return db[_0x7532('0x3d')][_0x7532('0x45')](_0x712e0b[_0x7532('0x46')],{})['then'](respondWithResult(_0x59ae5e,0xc9))['catch'](handleError(_0x59ae5e,null));};exports['update']=function(_0x162d16,_0x58e93f){if(_0x162d16[_0x7532('0x46')]['id']){delete _0x162d16['body']['id'];}return db[_0x7532('0x3d')][_0x7532('0x44')]({'where':{'id':_0x162d16['params']['id']}})[_0x7532('0x22')](handleEntityNotFound(_0x58e93f,null))[_0x7532('0x22')](saveUpdates(_0x162d16[_0x7532('0x46')],null))[_0x7532('0x22')](respondWithResult(_0x58e93f,null))[_0x7532('0x40')](handleError(_0x58e93f,null));};exports[_0x7532('0x23')]=function(_0x5d8455,_0x51ca3f){return db[_0x7532('0x3d')][_0x7532('0x44')]({'where':{'id':_0x5d8455[_0x7532('0x47')]['id']}})['then'](handleEntityNotFound(_0x51ca3f,null))[_0x7532('0x22')](removeEntity(_0x51ca3f,null))[_0x7532('0x40')](handleError(_0x51ca3f,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index acd9237..f53d2d4 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 _0x93e6=['bluebird','path','rimraf','../../config/environment','exports','utf8mb4','lodash','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x93e6,0x11e));var _0x693e=function(_0xb729d2,_0x131a0e){_0xb729d2=_0xb729d2-0x0;var _0x181500=_0x93e6[_0xb729d2];return _0x181500;};'use strict';var _=require(_0x693e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x693e('0x1'));var moment=require('moment');var BPromise=require(_0x693e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x693e('0x3'));var rimraf=require(_0x693e('0x4'));var config=require(_0x693e('0x5'));var attributes=require('./whatsappApplication.attributes');module[_0x693e('0x6')]=function(_0x388eb6,_0x2569a4){return _0x388eb6['define']('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x693e('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9c02=['utf8mb4_unicode_ci','lodash','util','../../config/logger','path','../../config/environment','exports','define','WhatsappApplication'];(function(_0x573dcc,_0x2888ae){var _0x3bc335=function(_0x25180e){while(--_0x25180e){_0x573dcc['push'](_0x573dcc['shift']());}};_0x3bc335(++_0x2888ae);}(_0x9c02,0x196));var _0x29c0=function(_0x2d7158,_0x15f598){_0x2d7158=_0x2d7158-0x0;var _0x229b17=_0x9c02[_0x2d7158];return _0x229b17;};'use strict';var _=require(_0x29c0('0x0'));var util=require(_0x29c0('0x1'));var logger=require(_0x29c0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x29c0('0x3'));var rimraf=require('rimraf');var config=require(_0x29c0('0x4'));var attributes=require('./whatsappApplication.attributes');module[_0x29c0('0x5')]=function(_0x4bc5cf,_0x2fb607){return _0x4bc5cf[_0x29c0('0x6')](_0x29c0('0x7'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x29c0('0x8')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 357521c..f2ee4d7 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 _0x6075=['code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0xfacee2,_0x29c3b0){var _0x4cc9ea=function(_0x26ed31){while(--_0x26ed31){_0xfacee2['push'](_0xfacee2['shift']());}};_0x4cc9ea(++_0x29c3b0);}(_0x6075,0x191));var _0x5607=function(_0x4bbce6,_0x554194){_0x4bbce6=_0x4bbce6-0x0;var _0x33ab0a=_0x6075[_0x4bbce6];return _0x33ab0a;};'use strict';var _=require('lodash');var util=require(_0x5607('0x0'));var moment=require(_0x5607('0x1'));var BPromise=require(_0x5607('0x2'));var rs=require(_0x5607('0x3'));var fs=require('fs');var Redis=require(_0x5607('0x4'));var db=require(_0x5607('0x5'))['db'];var utils=require(_0x5607('0x6'));var logger=require(_0x5607('0x7'))(_0x5607('0x8'));var config=require('../../config/environment');var jayson=require(_0x5607('0x9'));var client=jayson[_0x5607('0xa')][_0x5607('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab18d,_0x53f825,_0x3dc860){return new BPromise(function(_0x25107d,_0x24d9da){return client[_0x5607('0xc')](_0x5ab18d,_0x3dc860)[_0x5607('0xd')](function(_0x4f61bf){logger[_0x5607('0xe')](_0x5607('0xf'),_0x53f825,_0x5607('0x10'));logger['debug'](_0x5607('0x11'),_0x53f825,'request\x20sent',JSON['stringify'](_0x4f61bf));if(_0x4f61bf[_0x5607('0x12')]){if(_0x4f61bf[_0x5607('0x12')][_0x5607('0x13')]===0x1f4){logger['error'](_0x5607('0xf'),_0x53f825,_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);return _0x24d9da(_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);}logger[_0x5607('0x12')](_0x5607('0xf'),_0x53f825,_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);return _0x25107d(_0x4f61bf['error'][_0x5607('0x14')]);}else{logger[_0x5607('0xe')](_0x5607('0xf'),_0x53f825,'request\x20sent');_0x25107d(_0x4f61bf['result'][_0x5607('0x14')]);}})['catch'](function(_0x38ab1c){logger[_0x5607('0x12')](_0x5607('0xf'),_0x53f825,_0x38ab1c);_0x24d9da(_0x38ab1c);});});} \ No newline at end of file +var _0xce68=['../../config/environment','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x356093,_0x50806b){var _0x441e4f=function(_0x3be7b6){while(--_0x3be7b6){_0x356093['push'](_0x356093['shift']());}};_0x441e4f(++_0x50806b);}(_0xce68,0x10c));var _0x8ce6=function(_0x58f29e,_0x756a4){_0x58f29e=_0x58f29e-0x0;var _0x475dc3=_0xce68[_0x58f29e];return _0x475dc3;};'use strict';var _=require(_0x8ce6('0x0'));var util=require('util');var moment=require(_0x8ce6('0x1'));var BPromise=require(_0x8ce6('0x2'));var rs=require(_0x8ce6('0x3'));var fs=require('fs');var Redis=require(_0x8ce6('0x4'));var db=require(_0x8ce6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ce6('0x6'))(_0x8ce6('0x7'));var config=require(_0x8ce6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8ce6('0x9')][_0x8ce6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fed90,_0x4e5471,_0x34b134){return new BPromise(function(_0x357fbb,_0x17811e){return client[_0x8ce6('0xb')](_0x4fed90,_0x34b134)['then'](function(_0x417bcf){logger[_0x8ce6('0xc')](_0x8ce6('0xd'),_0x4e5471,_0x8ce6('0xe'));logger[_0x8ce6('0xf')](_0x8ce6('0x10'),_0x4e5471,_0x8ce6('0xe'),JSON[_0x8ce6('0x11')](_0x417bcf));if(_0x417bcf[_0x8ce6('0x12')]){if(_0x417bcf[_0x8ce6('0x12')][_0x8ce6('0x13')]===0x1f4){logger[_0x8ce6('0x12')](_0x8ce6('0xd'),_0x4e5471,_0x417bcf[_0x8ce6('0x12')][_0x8ce6('0x14')]);return _0x17811e(_0x417bcf[_0x8ce6('0x12')][_0x8ce6('0x14')]);}logger[_0x8ce6('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x4e5471,_0x417bcf[_0x8ce6('0x12')]['message']);return _0x357fbb(_0x417bcf[_0x8ce6('0x12')][_0x8ce6('0x14')]);}else{logger[_0x8ce6('0xc')](_0x8ce6('0xd'),_0x4e5471,_0x8ce6('0xe'));_0x357fbb(_0x417bcf[_0x8ce6('0x15')][_0x8ce6('0x14')]);}})[_0x8ce6('0x16')](function(_0x3fae8e){logger[_0x8ce6('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x4e5471,_0x3fae8e);_0x17811e(_0x3fae8e);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 94d7ab9..a322aec 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 _0x4780=['./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','create','post','/:id/messages','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','put','tracked','update','delete','destroy','removeTags','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x426711,_0x12264c){var _0x592991=function(_0x564614){while(--_0x564614){_0x426711['push'](_0x426711['shift']());}};_0x592991(++_0x12264c);}(_0x4780,0xbe));var _0x0478=function(_0x29b714,_0x1b0efb){_0x29b714=_0x29b714-0x0;var _0x3c70df=_0x4780[_0x29b714];return _0x3c70df;};'use strict';var multer=require(_0x0478('0x0'));var util=require(_0x0478('0x1'));var path=require('path');var timeout=require(_0x0478('0x2'));var express=require(_0x0478('0x3'));var router=express['Router']();var auth=require(_0x0478('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0478('0x5'));var controller=require(_0x0478('0x6'));router[_0x0478('0x7')]('/',auth[_0x0478('0x8')](),controller[_0x0478('0x9')]);router[_0x0478('0x7')](_0x0478('0xa'),auth['isAuthenticated'](),controller[_0x0478('0xb')]);router['get'](_0x0478('0xc'),auth[_0x0478('0x8')](),controller[_0x0478('0xd')]);router[_0x0478('0x7')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x0478('0x7')](_0x0478('0xe'),auth[_0x0478('0x8')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x0478('0xf')]);router[_0x0478('0x10')](_0x0478('0x11'),auth[_0x0478('0x8')](),controller['addMessage']);router[_0x0478('0x10')](_0x0478('0x12'),auth[_0x0478('0x8')](),interaction['tracked'](_0x0478('0x13'),_0x0478('0x14')),controller[_0x0478('0x15')]);router[_0x0478('0x16')](_0x0478('0xc'),auth[_0x0478('0x8')](),interaction[_0x0478('0x17')](_0x0478('0x13'),'whatsappinteraction:update'),controller[_0x0478('0x18')]);router[_0x0478('0x19')](_0x0478('0xc'),auth[_0x0478('0x8')](),interaction[_0x0478('0x17')](_0x0478('0x13'),'whatsappinteraction:destroy'),controller[_0x0478('0x1a')]);router[_0x0478('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0478('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xa767=['whatsappinteraction:addtags','addTags','put','tracked','update','delete','whatsappinteraction:destroy','removeTags','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','download','create','addMessage','post','/:id/tags','whatsapp'];(function(_0x2d50d2,_0x3934cc){var _0x3da905=function(_0x4e2f1a){while(--_0x4e2f1a){_0x2d50d2['push'](_0x2d50d2['shift']());}};_0x3da905(++_0x3934cc);}(_0xa767,0x12a));var _0x7a76=function(_0x57d696,_0x56ea10){_0x57d696=_0x57d696-0x0;var _0x3fc844=_0xa767[_0x57d696];return _0x3fc844;};'use strict';var multer=require('multer');var util=require(_0x7a76('0x0'));var path=require(_0x7a76('0x1'));var timeout=require(_0x7a76('0x2'));var express=require(_0x7a76('0x3'));var router=express['Router']();var auth=require(_0x7a76('0x4'));var interaction=require(_0x7a76('0x5'));var config=require(_0x7a76('0x6'));var controller=require(_0x7a76('0x7'));router['get']('/',auth[_0x7a76('0x8')](),controller[_0x7a76('0x9')]);router[_0x7a76('0xa')](_0x7a76('0xb'),auth[_0x7a76('0x8')](),controller[_0x7a76('0xc')]);router[_0x7a76('0xa')](_0x7a76('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x7a76('0xa')](_0x7a76('0xe'),auth[_0x7a76('0x8')](),controller['getMessages']);router[_0x7a76('0xa')]('/:id/download',auth[_0x7a76('0x8')](),controller[_0x7a76('0xf')]);router['post']('/',auth[_0x7a76('0x8')](),controller[_0x7a76('0x10')]);router['post']('/:id/messages',auth[_0x7a76('0x8')](),controller[_0x7a76('0x11')]);router[_0x7a76('0x12')](_0x7a76('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x7a76('0x14'),_0x7a76('0x15')),controller[_0x7a76('0x16')]);router[_0x7a76('0x17')](_0x7a76('0xd'),auth['isAuthenticated'](),interaction[_0x7a76('0x18')](_0x7a76('0x14'),'whatsappinteraction:update'),controller[_0x7a76('0x19')]);router[_0x7a76('0x1a')]('/:id',auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x7a76('0x1b')),controller['destroy']);router[_0x7a76('0x1a')](_0x7a76('0x13'),auth[_0x7a76('0x8')](),controller[_0x7a76('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 135ada3..0cbbc01 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 _0x59e0=['out','moment','exports','DATE','STRING','ENUM'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x59e0,0x103));var _0x059e=function(_0x47a840,_0x1f3dd1){_0x47a840=_0x47a840-0x0;var _0x1e1294=_0x59e0[_0x47a840];return _0x1e1294;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x059e('0x0'));module[_0x059e('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x059e('0x2')]},'disposition':{'type':Sequelize[_0x059e('0x3')]},'note':{'type':Sequelize[_0x059e('0x3')]},'phone':{'type':Sequelize[_0x059e('0x3')]},'read1stAt':{'type':Sequelize[_0x059e('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x059e('0x4')]('in',_0x059e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x059e('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x059e('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xffb9=['STRING','out','ENUM','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x2c84a2,_0x5afe0d){var _0x593ec4=function(_0x311cc9){while(--_0x311cc9){_0x2c84a2['push'](_0x2c84a2['shift']());}};_0x593ec4(++_0x5afe0d);}(_0xffb9,0x1c3));var _0x9ffb=function(_0x4e7261,_0xa23e38){_0x4e7261=_0x4e7261-0x0;var _0x24dd41=_0xffb9[_0x4e7261];return _0x24dd41;};'use strict';var Sequelize=require(_0x9ffb('0x0'));var moment=require(_0x9ffb('0x1'));module[_0x9ffb('0x2')]={'closed':{'type':Sequelize[_0x9ffb('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9ffb('0x4')]},'disposition':{'type':Sequelize[_0x9ffb('0x5')]},'note':{'type':Sequelize[_0x9ffb('0x5')]},'phone':{'type':Sequelize[_0x9ffb('0x5')]},'read1stAt':{'type':Sequelize[_0x9ffb('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9ffb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9ffb('0x7')]('in',_0x9ffb('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 3388128..6bbd092 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 _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(_0x4fa811,_0x20f8b3){var _0x23518e=function(_0x429e21){while(--_0x429e21){_0x4fa811['push'](_0x4fa811['shift']());}};_0x23518e(++_0x20f8b3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc4aa[_0xfae23b];return _0x200640;};'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 +var _0xe14b=['Contact','$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','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','body','some','compact','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','push','all','rows','show','includeAll','include','options','WhatsappInteraction','create','update','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','whatsappInteractionTags:save','download','unix','join','root','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','WhatsappAccount','Account','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','closed','closedAt','basename','existsSync','createReadStream','pipe','createWriteStream','System','lastName','out','secret','server','views','downloadInteraction.html','toFile','transcript-','log','unlinkSync','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','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','count','offset','limit','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','u.id','u.fullname','ui.WhatsappInteractionId','from','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xe14b,0x93));var _0xbe14=function(_0x491fbc,_0x1a708a){_0x491fbc=_0x491fbc-0x0;var _0x2559d7=_0xe14b[_0x491fbc];return _0x2559d7;};'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'];config[_0xbe14('0x15')]=_[_0xbe14('0x16')](config[_0xbe14('0x15')],{'host':_0xbe14('0x17'),'port':0x18eb});var socket=require(_0xbe14('0x18'))(new Redis(config[_0xbe14('0x15')]));require(_0xbe14('0x19'))[_0xbe14('0x1a')](socket);function respondWithStatusCode(_0x33fd54,_0x813399){_0x813399=_0x813399||0xcc;return function(_0x530538){if(_0x530538){return _0x33fd54['sendStatus'](_0x813399);}return _0x33fd54[_0xbe14('0x1b')](_0x813399)[_0xbe14('0x1c')]();};}function respondWithResult(_0xf4ac9,_0x37ce4e){_0x37ce4e=_0x37ce4e||0xc8;return function(_0x4e8f34){if(_0x4e8f34){return _0xf4ac9[_0xbe14('0x1b')](_0x37ce4e)[_0xbe14('0x1d')](_0x4e8f34);}};}function respondWithFilteredResult(_0xfd7b8f,_0x123ede){return function(_0x38f1ea){if(_0x38f1ea){var _0x29ab73=_0x38f1ea[_0xbe14('0x1e')],_0x17ae86=_0x123ede[_0xbe14('0x1f')],_0x5ea1f8=_0x123ede[_0xbe14('0x1f')]+_0x123ede[_0xbe14('0x20')],_0x137ee5;if(_0x5ea1f8>=_0x29ab73){_0x5ea1f8=_0x29ab73;_0x137ee5=0xc8;}else{_0x137ee5=0xce;}_0xfd7b8f[_0xbe14('0x1b')](_0x137ee5);return _0xfd7b8f['set'](_0xbe14('0x21'),_0x17ae86+'-'+_0x5ea1f8+'/'+_0x29ab73)[_0xbe14('0x1d')](_0x38f1ea);}return null;};}function patchUpdates(_0x417c8d){return function(_0xc12977){try{jsonpatch[_0xbe14('0x22')](_0xc12977,_0x417c8d,!![]);}catch(_0x51dc0b){return BPromise[_0xbe14('0x23')](_0x51dc0b);}return _0xc12977['save']();};}function saveUpdates(_0x3c1c85,_0x56e80c){return function(_0x32e8eb){if(_0x32e8eb){return _0x32e8eb['update'](_0x3c1c85)[_0xbe14('0x24')](function(_0x3d3608){return _0x3d3608;});}return null;};}function removeEntity(_0x505dbd,_0x2da350){return function(_0x4d4190){if(_0x4d4190){return _0x4d4190[_0xbe14('0x25')]()['then'](function(){_0x505dbd[_0xbe14('0x1b')](0xcc)[_0xbe14('0x1c')]();});}};}function handleEntityNotFound(_0x1ee9c1,_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x1ee9c1[_0xbe14('0x26')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x27')](_0x1ba46a[_0xbe14('0x28')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x29')];}_0x55d001[_0xbe14('0x1b')](_0x1822e0)['send'](_0x1ba46a);};}function getInteractionUsers(_0x3c3613,_0x3b3e84){return new BPromise(function(_0x1c7cc7,_0x19252f){try{if(_0x3b3e84[_0x3c3613['id']]){_0x3c3613[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x3b3e84[_0x3c3613['id']],function(_0x31a664){return{'id':_0x31a664['id'],'fullname':_0x31a664[_0xbe14('0x2c')]};});}}catch(_0x4168c8){_0x19252f(_0x4168c8);}_0x1c7cc7(_0x3c3613);});}function getInteractionTags(_0x16a159,_0x40538f){return new BPromise(function(_0x3bf43c,_0x39dc0a){try{if(_0x16a159[_0xbe14('0x2d')]){_0x16a159[_0xbe14('0x2e')]=[];_0x16a159[_0xbe14('0x2d')][_0xbe14('0x2f')](',')[_0xbe14('0x30')](function(_0x29e76a){_0x16a159[_0xbe14('0x2e')]['push'](_0x40538f[_0x29e76a]);});}delete _0x16a159[_0xbe14('0x2d')];}catch(_0x499793){_0x39dc0a(_0x499793);}_0x3bf43c(_0x16a159);});}function updateWhatsappInteraction(_0x58f8de,_0x46c2d1,_0x4c1e7e){return new BPromise(function(_0x243524,_0x345b0){return getInteractionUsers(_0x58f8de,_0x4c1e7e)['then'](function(_0x50cb09){return getInteractionTags(_0x50cb09,_0x46c2d1);})['then'](function(_0x412ad5){_0x243524(_0x412ad5);})[_0xbe14('0x31')](function(_0x5f27b6){_0x345b0(_0x5f27b6);});});}exports[_0xbe14('0x32')]=function(_0x1faf3e,_0x452635){var _0x1aa849={},_0x29c23e={},_0x5ef1e5={'count':0x0,'rows':[]};var _0x591a36=_[_0xbe14('0x2b')](db['WhatsappInteraction']['rawAttributes'],function(_0x5c5e9f){return{'name':_0x5c5e9f[_0xbe14('0x33')],'type':_0x5c5e9f[_0xbe14('0x34')][_0xbe14('0x35')]};});_0x29c23e[_0xbe14('0x36')]=_[_0xbe14('0x2b')](_0x591a36,_0xbe14('0x29'));_0x29c23e[_0xbe14('0x37')]=_[_0xbe14('0x38')](_0x1faf3e[_0xbe14('0x37')]);_0x29c23e[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x29c23e[_0xbe14('0x36')],_0x29c23e['query']);_0x1aa849['attributes']=_[_0xbe14('0x3a')](_0x29c23e[_0xbe14('0x36')],qs[_0xbe14('0x3b')](_0x1faf3e['query'][_0xbe14('0x3b')]));_0x1aa849[_0xbe14('0x3c')]=_0x1aa849[_0xbe14('0x3c')][_0xbe14('0x3d')]?_0x1aa849[_0xbe14('0x3c')]:_0x29c23e[_0xbe14('0x36')];if(!_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x3e')](_0xbe14('0x3f'))){_0x1aa849['limit']=qs[_0xbe14('0x20')](_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x20')]);_0x1aa849[_0xbe14('0x1f')]=qs[_0xbe14('0x1f')](_0x1faf3e[_0xbe14('0x37')]['offset']);}_0x1aa849[_0xbe14('0x40')]=qs[_0xbe14('0x41')](_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x41')]);_0x1aa849['where']=qs['filters'](_[_0xbe14('0x42')](_0x1faf3e[_0xbe14('0x37')],_0x29c23e[_0xbe14('0x39')]),_0x591a36);var _0x51c859=[];var _0x5d5318=squel[_0xbe14('0x43')]()['field']('id')['field'](_0xbe14('0x29'))[_0xbe14('0x44')](_0xbe14('0x45'))['from']('tools_tags');var _0x5aaa4f=squel[_0xbe14('0x43')]()[_0xbe14('0x44')](_0xbe14('0x46'))['field'](_0xbe14('0x47'))[_0xbe14('0x44')](_0xbe14('0x48'))[_0xbe14('0x49')]('user_has_whatsapp_interactions','ui')['left_join'](_0xbe14('0x4a'),'u',_0xbe14('0x4b'));var _0x24559b=squel[_0xbe14('0x43')]()[_0xbe14('0x49')]('whatsapp_interactions','i')['left_join'](_0xbe14('0x4c'),'c',_0xbe14('0x4d'))[_0xbe14('0x4e')](_0xbe14('0x4a'),'o','o.id\x20=\x20i.UserId')[_0xbe14('0x4e')](_0xbe14('0x4f'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xbe14('0x4e')](_0xbe14('0x50'),'me',_0xbe14('0x51'))[_0xbe14('0x4e')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xbe14('0x4e')](_0xbe14('0x52'),'t','t.id\x20=\x20it.TagId');var _0x5acf90=squel[_0xbe14('0x53')]();var _0x5d3726=[];var _0x3f7f5b=squel[_0xbe14('0x53')]();var _0xdbc6e1;if(_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x54')]){_0xdbc6e1=as['parseSearch'](_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x54')]);var _0x6928f2=_0xdbc6e1[_0xbe14('0x55')];for(var _0x2fc073=0x0;_0x2fc073<_0xdbc6e1['conditions'][_0xbe14('0x3d')];_0x2fc073++){var _0x3d419a=_0xdbc6e1[_0xbe14('0x56')][_0x2fc073];var _0x20f46d='i';var _0x3d3ae1=_[_0xbe14('0x57')](_0x591a36,['name',_0x3d419a['field']]);if(!_0x3d3ae1){switch(_0x3d419a[_0xbe14('0x44')]){case _0xbe14('0x58'):if(_0x3d419a[_0xbe14('0x59')]==0x1){_0x24559b['having']('`'+_0x3d419a['field']+_0xbe14('0x5a'));}else{_0x24559b[_0xbe14('0x5b')]('`'+_0x3d419a['field']+_0xbe14('0x5c'));}break;case _0xbe14('0x5d'):if(_0x3d419a['operator']===_0xbe14('0x5e')){if(_0x3d419a['value'][_0xbe14('0x2f')]('\x20')[_0xbe14('0x3d')]>0x1){_0x5acf90[_0x6928f2](_0xbe14('0x5f'),qs['getFullTextValue'](_0x3d419a[_0xbe14('0x59')]),null);}else{var _0x404212='%'+_0x3d419a['value']+'%';_0x5acf90[_0x6928f2](_0xbe14('0x60'),_0x404212,_0x404212,_0x404212);}}else{_0x3d3ae1=_[_0xbe14('0x57')](_0x591a36,[_0xbe14('0x29'),_0xbe14('0x61')]);_0x3d419a[_0xbe14('0x44')]='ContactId';_0x1a945b=as[_0xbe14('0x62')](_0x20f46d,_0x3d3ae1[_0xbe14('0x34')],_0x3d419a);_0x5acf90[_0x6928f2](_0x1a945b[_0xbe14('0x63')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x64')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x1c')]);}break;case'Tag':var _0x72c875=_0x3d419a[_0xbe14('0x59')][_0xbe14('0x2f')](',')[_0xbe14('0x2b')](function(_0x246ed5){return Number(_0x246ed5);});_0x72c875[_0xbe14('0x30')](function(_0xd8f78f){_0x3f7f5b['or'](_0xbe14('0x65'),'%,'+_0xd8f78f+',%');});_0x5d3726=_[_0xbe14('0x66')](_0x5d3726,_0x72c875);break;case _0xbe14('0x67'):if(_0x3d419a[_0xbe14('0x68')]==='$substring'){_0x5acf90[_0x6928f2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3d419a['value']+'%',null);}else{_0x3d3ae1=_[_0xbe14('0x57')](_0x591a36,[_0xbe14('0x29'),_0xbe14('0x69')]);_0x3d419a[_0xbe14('0x44')]=_0xbe14('0x69');_0x1a945b=as[_0xbe14('0x62')](_0x20f46d,_0x3d3ae1[_0xbe14('0x34')],_0x3d419a);_0x5acf90[_0x6928f2](_0x1a945b[_0xbe14('0x63')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x64')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x1c')]);}break;case _0xbe14('0x6a'):_0x1a945b=as[_0xbe14('0x62')]('me',null,_0x3d419a);_0x5acf90[_0x6928f2](_0x1a945b[_0xbe14('0x63')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x64')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x1c')]);break;}}else{var _0x1a945b=as['buildExpression'](_0x20f46d,_0x3d3ae1[_0xbe14('0x34')],_0x3d419a);_0x5acf90[_0x6928f2](_0x1a945b[_0xbe14('0x63')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x64')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x1c')]);}}}else{var _0x198b55=_(_0x1faf3e[_0xbe14('0x37')])[_0xbe14('0x38')]()[_0xbe14('0x2b')](function(_0x5917d5){return _[_0xbe14('0x6b')](_0x591a36,[_0xbe14('0x29'),_0x5917d5])?_0x5917d5:undefined;})[_0xbe14('0x6c')]()[_0xbe14('0x59')]();if(!_[_0xbe14('0x6d')](_0x198b55)){_0x198b55['forEach'](function(_0x42b341){if(_0x42b341===_0xbe14('0x6e')){_0x24559b[_0xbe14('0x6f')](_0xbe14('0x70'),[][_0xbe14('0x71')](_0x1faf3e['query'][_0x42b341]));}else if(_0x42b341===_0xbe14('0x72')){var _0x14f064=JSON[_0xbe14('0x73')](_0x1faf3e[_0xbe14('0x37')][_0x42b341])[_0xbe14('0x74')];var _0x289c4d=JSON[_0xbe14('0x73')](_0x1faf3e[_0xbe14('0x37')][_0x42b341])['$lte'];_0x24559b[_0xbe14('0x6f')](_0xbe14('0x75'),_0x14f064,_0x289c4d);}else{if(_0x1faf3e[_0xbe14('0x37')][_0x42b341]===_0xbe14('0x76')){_0x24559b[_0xbe14('0x6f')]('i.'+_0x42b341+_0xbe14('0x77'));}else{_0x24559b[_0xbe14('0x6f')]('i.'+_0x42b341+'\x20=\x20?',_0x1faf3e['query'][_0x42b341]);}}});}if(_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x78')]){if(_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x78')]==0x1){_0x24559b[_0xbe14('0x5b')](_0xbe14('0x79'));}else{_0x24559b[_0xbe14('0x5b')](_0xbe14('0x7a'));}}if(_0x1faf3e['query']['tag']){_0x5d3726=_[_0xbe14('0x7b')](_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x7c')])?_0x1faf3e['query'][_0xbe14('0x7c')]:new Array(_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x7c')]);_0x5d3726[_0xbe14('0x30')](function(_0x468e9f){_0x3f7f5b['or'](_0xbe14('0x65'),'%,'+_0x468e9f+',%');});}if(_0x1faf3e[_0xbe14('0x37')]['filter']){var _0x43b817=_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x7d')][_0xbe14('0x7e')]('\x5c','\x5c\x5c')[_0xbe14('0x7e')]('\x27\x27',_0xbe14('0x7f'));if(qs[_0xbe14('0x80')](_0x43b817)){_0x5acf90['or']('i.id\x20LIKE\x20?',_0x43b817+'%')['or'](_0xbe14('0x81'),_0x43b817+'%');}else{_0x5acf90['or'](_0xbe14('0x82'),qs[_0xbe14('0x83')](_0x43b817))['or'](_0xbe14('0x84'),_0x43b817+'%');}}}_0x24559b[_0xbe14('0x6f')](_0x5acf90);_0x24559b[_0xbe14('0x85')](_0xbe14('0x86'));var _0xd756b2={'type':db['Sequelize'][_0xbe14('0x87')][_0xbe14('0x88')],'raw':!![]};var _0x362999=_0x24559b[_0xbe14('0x89')]();_0x362999[_0xbe14('0x44')](_0xbe14('0x86'));_0x362999['field'](_0xbe14('0x8a'),_0xbe14('0x58'));if(_0x1aa849[_0xbe14('0x40')]){_0x1aa849[_0xbe14('0x40')]['forEach'](function(_0x7e9e5c){_0x24559b[_0xbe14('0x40')]('i.'+_0x7e9e5c[0x0],_0x7e9e5c[0x1]===_0xbe14('0x8b')?![]:!![]);});}if(!_[_0xbe14('0x6d')](_0x5d3726)){_0x24559b[_0xbe14('0x5b')](_0x3f7f5b);_0x362999[_0xbe14('0x6f')](_0xbe14('0x8c'),_0x5d3726);}BPromise['resolve']()[_0xbe14('0x24')](function(){if(!_0xdbc6e1){if(_0x1faf3e['query'][_0xbe14('0x6e')]||_0x1faf3e['query'][_0xbe14('0x8d')])return;_0x362999[_0xbe14('0x6f')](_0xbe14('0x8e'));_0x24559b['where'](_0xbe14('0x8e'));return;}return _0x1faf3e[_0xbe14('0x8f')][_0xbe14('0x90')]({'attributes':['id'],'raw':!![]})['then'](function(_0x41a896){if(_[_0xbe14('0x6d')](_0x41a896)){_0x362999[_0xbe14('0x6f')](_0xbe14('0x91'));_0x24559b['where'](_0xbe14('0x91'));}else{_0x362999[_0xbe14('0x6f')](_0xbe14('0x70'),_[_0xbe14('0x2b')](_0x41a896,'id'));_0x24559b[_0xbe14('0x6f')](_0xbe14('0x70'),_[_0xbe14('0x2b')](_0x41a896,'id'));}});})['then'](function(){db[_0xbe14('0x92')][_0xbe14('0x37')](_0x362999[_0xbe14('0x93')](),_0xd756b2)['then'](function(_0x704c05){_0x5ef1e5[_0xbe14('0x1e')]=_0x704c05[_0xbe14('0x3d')];if(_0x5ef1e5['count']===0x0)return[];return db[_0xbe14('0x92')][_0xbe14('0x37')](_0x5d5318['toString'](),_0xd756b2)[_0xbe14('0x24')](function(_0x49990b){_0x51c859=_[_0xbe14('0x94')](_0x49990b,'id');_0xd756b2=_[_0xbe14('0x95')](_0xd756b2,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1faf3e['query'][_0xbe14('0x3b')]){_0x1aa849[_0xbe14('0x3c')][_0xbe14('0x30')](function(_0x4c76c1){_0x24559b[_0xbe14('0x44')]('i.'+_0x4c76c1);});}else{_0x24559b[_0xbe14('0x44')](_0xbe14('0x8a'),_0xbe14('0x58'));_0x24559b['field']('a.key',_0xbe14('0x96'));_0x24559b[_0xbe14('0x44')](_0xbe14('0x97'),_0xbe14('0x98'));_0x24559b[_0xbe14('0x44')](_0xbe14('0x99'));_0x24559b[_0xbe14('0x44')]('c.firstName',_0xbe14('0x9a'));_0x24559b['field'](_0xbe14('0x9b'),_0xbe14('0x9c'));_0x24559b[_0xbe14('0x44')](_0xbe14('0x9d'),'Contact.email');_0x24559b[_0xbe14('0x44')](_0xbe14('0x9e'),_0xbe14('0x9f'));_0x24559b['field'](_0xbe14('0xa0'),_0xbe14('0xa1'));_0x24559b[_0xbe14('0x44')](_0xbe14('0xa2'),_0xbe14('0xa3'));_0x24559b[_0xbe14('0x44')](_0xbe14('0xa4'),_0xbe14('0xa5'));_0x24559b[_0xbe14('0x44')](_0xbe14('0xa6'),_0xbe14('0xa7'));_0x24559b[_0xbe14('0x44')](_0xbe14('0xa8'),_0xbe14('0x2d'));}if(_0x1aa849[_0xbe14('0x20')])_0x24559b[_0xbe14('0x20')](_0x1aa849[_0xbe14('0x20')]);if(_0x1aa849[_0xbe14('0x1f')])_0x24559b[_0xbe14('0x1f')](_0x1aa849[_0xbe14('0x1f')]);return db['sequelize'][_0xbe14('0x37')](_0x24559b['toString'](),_0xd756b2);})[_0xbe14('0x24')](function(_0x1b8733){_0x5aaa4f[_0xbe14('0x6f')](_0xbe14('0xa9'),_[_0xbe14('0x2b')](_0x1b8733,'id'));return db['sequelize']['query'](_0x5aaa4f[_0xbe14('0x93')](),_0xd756b2)[_0xbe14('0x24')](function(_0x13a732){var _0x42b849=_['groupBy'](_0x13a732,_0xbe14('0xaa'));var _0x357095=[];_0x1b8733['forEach'](function(_0x186225){_0x357095[_0xbe14('0xab')](updateWhatsappInteraction(_0x186225,_0x51c859,_0x42b849));});return BPromise[_0xbe14('0xac')](_0x357095);});});})[_0xbe14('0x24')](function(_0x4f9936){_0x5ef1e5[_0xbe14('0xad')]=_0x4f9936;return _0x5ef1e5;})['then'](respondWithFilteredResult(_0x452635,_0x1aa849));})['catch'](handleError(_0x452635,null));};exports[_0xbe14('0xae')]=function(_0x8d506a,_0x110603){var _0x3d890b={'raw':![],'where':{'id':_0x8d506a['params']['id']}},_0x3e8655={};_0x3e8655[_0xbe14('0x36')]=_[_0xbe14('0x38')](db['WhatsappInteraction']['rawAttributes']);_0x3e8655[_0xbe14('0x37')]=_[_0xbe14('0x38')](_0x8d506a['query']);_0x3e8655[_0xbe14('0x39')]=_['intersection'](_0x3e8655[_0xbe14('0x36')],_0x3e8655['query']);_0x3d890b[_0xbe14('0x3c')]=_['intersection'](_0x3e8655[_0xbe14('0x36')],qs['fields'](_0x8d506a[_0xbe14('0x37')][_0xbe14('0x3b')]));_0x3d890b['attributes']=_0x3d890b['attributes'][_0xbe14('0x3d')]?_0x3d890b['attributes']:_0x3e8655['model'];if(_0x8d506a[_0xbe14('0x37')][_0xbe14('0xaf')]){_0x3d890b[_0xbe14('0xb0')]=[{'all':!![]}];}_0x3d890b=_[_0xbe14('0x95')]({},_0x3d890b,_0x8d506a[_0xbe14('0xb1')]);return db[_0xbe14('0xb2')][_0xbe14('0x57')](_0x3d890b)['then'](handleEntityNotFound(_0x110603,null))[_0xbe14('0x24')](respondWithResult(_0x110603,null))[_0xbe14('0x31')](handleError(_0x110603,null));};exports[_0xbe14('0xb3')]=function(_0x1445ce,_0x59779a){return db[_0xbe14('0xb2')][_0xbe14('0xb3')](_0x1445ce[_0xbe14('0x6a')],{})['then'](respondWithResult(_0x59779a,0xc9))[_0xbe14('0x31')](handleError(_0x59779a,null));};exports[_0xbe14('0xb4')]=function(_0x521a9f,_0x360cee){if(_0x521a9f['body']['id']){delete _0x521a9f[_0xbe14('0x6a')]['id'];}return db[_0xbe14('0xb2')][_0xbe14('0x57')]({'where':{'id':_0x521a9f['params']['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x360cee,null))['then'](saveUpdates(_0x521a9f[_0xbe14('0x6a')],null))['then'](respondWithResult(_0x360cee,null))['catch'](handleError(_0x360cee,null));};exports[_0xbe14('0x25')]=function(_0x553f51,_0xab74eb){return db['WhatsappInteraction'][_0xbe14('0x57')]({'where':{'id':_0x553f51[_0xbe14('0xb5')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0xab74eb,null))[_0xbe14('0x24')](removeEntity(_0xab74eb,null))[_0xbe14('0x31')](handleError(_0xab74eb,null));};exports[_0xbe14('0xb6')]=function(_0x43d406,_0x3086f3){return db[_0xbe14('0xb2')][_0xbe14('0xb6')]()[_0xbe14('0x24')](respondWithResult(_0x3086f3,null))[_0xbe14('0x31')](handleError(_0x3086f3,null));};exports[_0xbe14('0xb7')]=function(_0x4c2a25,_0x2d99fa,_0x234c4e){return db[_0xbe14('0xb8')][_0xbe14('0x57')]({'where':{'id':_0x4c2a25[_0xbe14('0xb5')]['id']}})['then'](handleEntityNotFound(_0x2d99fa,null))['then'](function(_0x116282){if(_0x116282){return _0x116282[_0xbe14('0xb7')](_0x4c2a25[_0xbe14('0x6a')][_0xbe14('0xb9')],_[_0xbe14('0xba')](_0x4c2a25[_0xbe14('0x6a')],[_0xbe14('0xb9'),'id'])||{});}})[_0xbe14('0x24')](respondWithResult(_0x2d99fa,null))[_0xbe14('0x31')](handleError(_0x2d99fa,null));};exports[_0xbe14('0xbb')]=function(_0x761b3d,_0x30597b,_0xaddf0d){var _0x23fd86={'raw':![],'where':{}};var _0x894313={};var _0x2c2dce={'count':0x0,'rows':[]};return db[_0xbe14('0xb2')][_0xbe14('0xbc')]({'where':{'id':_0x761b3d[_0xbe14('0xb5')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x30597b,null))[_0xbe14('0x24')](function(_0x82d19a){if(_0x82d19a){_0x894313[_0xbe14('0x36')]=_[_0xbe14('0x38')](db[_0xbe14('0xb8')]['rawAttributes']);_0x894313[_0xbe14('0x37')]=_[_0xbe14('0x38')](_0x761b3d[_0xbe14('0x37')]);_0x894313[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x894313[_0xbe14('0x36')],_0x894313['query']);_0x23fd86['attributes']=_[_0xbe14('0x3a')](_0x894313['model'],qs[_0xbe14('0x3b')](_0x761b3d['query'][_0xbe14('0x3b')]));_0x23fd86['attributes']=_0x23fd86[_0xbe14('0x3c')][_0xbe14('0x3d')]?_0x23fd86[_0xbe14('0x3c')]:_0x894313[_0xbe14('0x36')];if(!_0x761b3d[_0xbe14('0x37')][_0xbe14('0x3e')](_0xbe14('0x3f'))){_0x23fd86[_0xbe14('0x20')]=qs[_0xbe14('0x20')](_0x761b3d['query'][_0xbe14('0x20')]);_0x23fd86[_0xbe14('0x1f')]=qs[_0xbe14('0x1f')](_0x761b3d[_0xbe14('0x37')]['offset']);}_0x23fd86[_0xbe14('0x40')]=qs['sort'](_0x761b3d[_0xbe14('0x37')]['sort']);_0x23fd86[_0xbe14('0x6f')]=qs[_0xbe14('0x39')](_[_0xbe14('0x42')](_0x761b3d['query'],_0x894313[_0xbe14('0x39')]));_0x23fd86['where'][_0xbe14('0xaa')]=_0x82d19a['id'];if(_0x761b3d[_0xbe14('0x37')][_0xbe14('0x7d')]){_0x23fd86[_0xbe14('0x6f')]=_[_0xbe14('0x95')](_0x23fd86[_0xbe14('0x6f')],{'$or':_[_0xbe14('0x2b')](_0x23fd86[_0xbe14('0x3c')],function(_0x2a2b93){var _0x5a7724={};_0x5a7724[_0x2a2b93]={'$like':'%'+_0x761b3d[_0xbe14('0x37')]['filter']+'%'};return _0x5a7724;})});}if(_0x761b3d[_0xbe14('0x37')][_0xbe14('0x74')]){var _0x119797=_0x761b3d['query'][_0xbe14('0x74')][_0xbe14('0x2f')](',');var _0x219403={};_0x219403[_0x119797[0x0]]={'$gte':moment(_0x119797[0x1])[_0xbe14('0xbd')](_0xbe14('0xbe'))};_0x23fd86['where']=_['merge'](_0x23fd86[_0xbe14('0x6f')],_0x219403);}_0x23fd86=_['merge']({},_0x23fd86,_0x761b3d[_0xbe14('0xb1')]);return db[_0xbe14('0xb8')][_0xbe14('0x1e')]({'where':_0x23fd86[_0xbe14('0x6f')]})['then'](function(_0x33c7d5){_0x2c2dce[_0xbe14('0x1e')]=_0x33c7d5;if(_0x761b3d['query'][_0xbe14('0xaf')]){_0x23fd86[_0xbe14('0xb0')]=[{'all':!![]}];}return db[_0xbe14('0xb8')][_0xbe14('0xbf')](_0x23fd86);})['then'](function(_0x20282c){_0x2c2dce[_0xbe14('0xad')]=_0x20282c;return _0x2c2dce;});}})[_0xbe14('0x24')](respondWithFilteredResult(_0x30597b,_0x23fd86))[_0xbe14('0x31')](handleError(_0x30597b,null));};exports[_0xbe14('0xc0')]=function(_0x469ef3,_0x208fae,_0x310d42){return db[_0xbe14('0xb2')][_0xbe14('0x57')]({'where':{'id':_0x469ef3['params']['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x208fae,null))[_0xbe14('0x24')](function(_0x419706){if(_0x419706){return _0x419706[_0xbe14('0xc1')](_0x469ef3['body'][_0xbe14('0xb9')],_[_0xbe14('0xba')](_0x469ef3[_0xbe14('0x6a')],['ids','id'])||{})[_0xbe14('0xc2')](function(){return db[_0xbe14('0xc3')][_0xbe14('0xbf')]({'attributes':['id',_0xbe14('0x29'),_0xbe14('0x45')],'where':{'id':_0x469ef3[_0xbe14('0x6a')][_0xbe14('0xb9')]}});})['then'](function(_0x2c2e46){socket['emit'](_0xbe14('0xc4'),{'id':Number(_0x469ef3[_0xbe14('0xb5')]['id']),'tags':_0x2c2e46||[]});return{'id':Number(_0x469ef3[_0xbe14('0xb5')]['id']),'tags':_0x2c2e46||[]};});}})[_0xbe14('0x24')](respondWithResult(_0x208fae,null))[_0xbe14('0x31')](handleError(_0x208fae,null));};exports['removeTags']=function(_0x5db8e8,_0xe2c9b,_0x161d13){return db[_0xbe14('0xb2')][_0xbe14('0x57')]({'where':{'id':_0x5db8e8['params']['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0xe2c9b,null))[_0xbe14('0x24')](function(_0x25ebee){if(_0x25ebee){return _0x25ebee['removeTags'](_0x5db8e8[_0xbe14('0x37')]['ids']);}})['then'](respondWithStatusCode(_0xe2c9b,null))[_0xbe14('0x31')](handleError(_0xe2c9b,null));};exports[_0xbe14('0xc5')]=function(_0x359608,_0x5322d7){var _0x3ea9c2=moment()[_0xbe14('0xc6')]()['toString']();var _0x4443a7=path[_0xbe14('0xc7')](config[_0xbe14('0xc8')],'server',_0xbe14('0xc9'),_0xbe14('0xca'));var _0x138ca1=path[_0xbe14('0xc7')](config[_0xbe14('0xc8')],'server',_0xbe14('0xc9'),_0xbe14('0xcb'));var _0x1c6bf4=path['join'](_0x4443a7,_0x3ea9c2);var _0x192dce=util[_0xbe14('0xbd')](_0xbe14('0xcc'),_0x359608[_0xbe14('0xb5')]['id'],_0x3ea9c2);var _0x1c8e26=path[_0xbe14('0xc7')](_0x4443a7,_0x192dce);var _0x1b22a0=[];_0x1b22a0[_0xbe14('0xab')]({'model':db[_0xbe14('0x67')],'as':_0xbe14('0x67'),'attributes':['id',_0xbe14('0x2c')],'raw':!![]});_0x1b22a0['push']({'model':db[_0xbe14('0xcd')],'as':_0xbe14('0x5d'),'attributes':['id',_0xbe14('0xce'),'lastName'],'raw':!![]});if(_0x359608[_0xbe14('0x37')][_0xbe14('0xcb')]){_0x1b22a0[_0xbe14('0xab')]({'model':db['Attachment'],'as':_0xbe14('0xcf'),'raw':!![]});}var _0x55b4a1=[{'model':db[_0xbe14('0xb8')],'as':_0xbe14('0xd0'),'attributes':['id','body',_0xbe14('0x72'),_0xbe14('0xd1'),'secret',_0xbe14('0x78')],'include':_0x1b22a0}];_0x55b4a1[_0xbe14('0xab')]({'model':db[_0xbe14('0xd2')],'as':_0xbe14('0xd3'),'attributes':['id',_0xbe14('0x29')]});_0x55b4a1[_0xbe14('0xab')]({'model':db['User'],'as':'Owner','attributes':['id',_0xbe14('0x2c')]});return db[_0xbe14('0xb2')][_0xbe14('0x57')]({'where':{'id':_0x359608[_0xbe14('0xb5')]['id']},'include':_0x55b4a1})['then'](handleEntityNotFound(_0x5322d7,null))[_0xbe14('0x24')](function(_0x4cb29c){if(_0x4cb29c){var _0x3dac28=_0x4cb29c[_0xbe14('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x1c6bf4);var _0x141449={'format':'A4','border':_0xbe14('0xd5'),'header':{'height':_0xbe14('0xd6'),'contents':{'first':_0xbe14('0xd7')}},'footer':{'height':_0xbe14('0xd8'),'contents':{'default':util[_0xbe14('0xbd')](_0xbe14('0xd9'),util[_0xbe14('0xbd')](_0xbe14('0xda'),_0xbe14('0xdb'),_0x3dac28['id']),moment()[_0xbe14('0xbd')](_0xbe14('0xdc'))['toString']())}}};var _0x20f196={'channel':_0xbe14('0xdb'),'account':_0x3dac28[_0xbe14('0xd3')][_0xbe14('0x29')],'agent':_0x3dac28['Owner']?_0x3dac28[_0xbe14('0xdd')][_0xbe14('0x2c')]:'N.A.','createdAt':moment(_0x3dac28[_0xbe14('0x72')])[_0xbe14('0xbd')](_0xbe14('0xbe'))['toString'](),'closedAt':_0x3dac28[_0xbe14('0xde')]?moment(_0x3dac28[_0xbe14('0xdf')])[_0xbe14('0xbd')](_0xbe14('0xbe'))[_0xbe14('0x93')]():'','disposition':_0x3dac28['disposition'],'messages':_(_0x3dac28[_0xbe14('0xd0')])[_0xbe14('0x7d')]({'secret':![]})[_0xbe14('0x2b')](function(_0x3f7732){if(_0x3f7732[_0xbe14('0xcf')]){var _0x5370c5=path[_0xbe14('0xc7')](_0x138ca1,_0x3f7732[_0xbe14('0xcf')][_0xbe14('0xe0')]);if(fs[_0xbe14('0xe1')](_0x5370c5)){fs[_0xbe14('0xe2')](_0x5370c5)[_0xbe14('0xe3')](fs[_0xbe14('0xe4')](path[_0xbe14('0xc7')](_0x1c6bf4,_0x3f7732['Attachment']['basename'])));}}return{'date':moment(_0x3f7732[_0xbe14('0x72')])[_0xbe14('0xbd')](_0xbe14('0xbe'))[_0xbe14('0x93')](),'sender':_0x3f7732[_0xbe14('0xd1')]==='out'?_0x3f7732[_0xbe14('0x67')]?_0x3f7732[_0xbe14('0x67')][_0xbe14('0x2c')]:_0xbe14('0xe5'):_0x3f7732[_0xbe14('0x5d')][_0xbe14('0xce')]+(_0x3f7732[_0xbe14('0x5d')][_0xbe14('0xe6')]?'\x20'+_0x3f7732['Contact'][_0xbe14('0xe6')]:''),'body':_0x3f7732[_0xbe14('0xcf')]?_0x3f7732['Attachment']['basename']:_0x3f7732[_0xbe14('0x6a')],'direction':_0x3f7732['direction']===_0xbe14('0xe7')?'A':'C','secret':_0x3f7732[_0xbe14('0xe8')],'read':_0x3f7732[_0xbe14('0x78')],'attachment':_0x3f7732[_0xbe14('0xcf')]};})[_0xbe14('0x59')]()};return ejs['renderFile'](path[_0xbe14('0xc7')](config[_0xbe14('0xc8')],_0xbe14('0xe9'),_0xbe14('0xea'),_0xbe14('0xeb')),{'interaction':_0x20f196})[_0xbe14('0x24')](function(_0x4df025){return new BPromise(function(_0x4eea48,_0x2e681e){pdf['create'](_0x4df025,_0x141449)[_0xbe14('0xec')](path[_0xbe14('0xc7')](_0x1c6bf4,_0xbe14('0xed')+_0x3dac28['id']+'-'+_0x3ea9c2+'.pdf'),function(_0x42b665,_0x2a090){if(_0x42b665)return _0x2e681e(_0x42b665);_0x4eea48(_0x2a090);});});})[_0xbe14('0x24')](function(){return new BPromise(function(_0x1ad15d,_0x41a064){zipdir(_0x1c6bf4,{'saveTo':_0x1c8e26},function(_0x2e5106,_0x156fb3){if(_0x2e5106)return _0x41a064(_0x2e5106);return _0x1ad15d(_0x156fb3);});})['then'](function(){return new BPromise(function(_0x2fd64c,_0x5d5fad){rimraf(_0x1c6bf4,function(_0x5e8d27){if(_0x5e8d27)_0x5d5fad(_0x5e8d27);return _0x2fd64c();});});})['then'](function(){return _0x5322d7['download'](_0x1c8e26,_0x192dce,function(_0x1b2a71){if(_0x1b2a71){console[_0xbe14('0xee')]('err',_0x1b2a71);}else{fs[_0xbe14('0xef')](_0x1c8e26);}});});});}else{return _0x5322d7['sendStatus'](0xc8);}})[_0xbe14('0x31')](handleError(_0x5322d7,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index ff17120..7bffcbe 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 _0x3fcd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','then','unreadMessages','length'];(function(_0x2c7ea5,_0x2cb359){var _0x4251c6=function(_0x5882fa){while(--_0x5882fa){_0x2c7ea5['push'](_0x2c7ea5['shift']());}};_0x4251c6(++_0x2cb359);}(_0x3fcd,0x10e));var _0xd3fc=function(_0x4b474b,_0x57f3fd){_0x4b474b=_0x4b474b-0x0;var _0x5aa9dc=_0x3fcd[_0x4b474b];return _0x5aa9dc;};'use strict';var EventEmitter=require(_0xd3fc('0x0'));var WhatsappInteraction=require(_0xd3fc('0x1'))['db'][_0xd3fc('0x2')];var WhatsappMessage=require(_0xd3fc('0x1'))['db'][_0xd3fc('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd3fc('0x4')](0x0);var events={'afterCreate':_0xd3fc('0x5'),'afterUpdate':_0xd3fc('0x6'),'afterDestroy':_0xd3fc('0x7')};function emitEvent(_0x4bfe04){return function(_0x2a49dd,_0x59615b,_0x48daaf){_0x2a49dd[_0xd3fc('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1df4e1){_0x2a49dd[_0xd3fc('0x9')](_0xd3fc('0xa'),_0x1df4e1[_0xd3fc('0xb')](function(_0x3d0446){return{'id':_0x3d0446['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2a49dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd3fc('0xc')](function(_0x2f348f){_0x2a49dd[_0xd3fc('0x9')](_0xd3fc('0xd'),_0x2f348f[_0xd3fc('0xe')]);WhatsappInteractionEvents[_0xd3fc('0xf')](_0x4bfe04+':'+_0x2a49dd['id'],_0x2a49dd);WhatsappInteractionEvents[_0xd3fc('0xf')](_0x4bfe04,_0x2a49dd);_0x48daaf(null);})['catch'](_0x48daaf(null));};}for(var e in events){if(events[_0xd3fc('0x10')](e)){var event=events[e];WhatsappInteraction[_0xd3fc('0x11')](e,emitEvent(event));}}module[_0xd3fc('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x5bc5=['setMaxListeners','save','update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x5bc5,0x186));var _0x55bc=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x5bc5[_0xaa0309];return _0x5de7ce;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x55bc('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x55bc('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x55bc('0x1')](0x0);var events={'afterCreate':_0x55bc('0x2'),'afterUpdate':_0x55bc('0x3'),'afterDestroy':_0x55bc('0x4')};function emitEvent(_0x347851){return function(_0x2df8a3,_0xd211b2,_0x328cf8){_0x2df8a3[_0x55bc('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2d30a5){_0x2df8a3[_0x55bc('0x6')]('Users',_0x2d30a5[_0x55bc('0x7')](function(_0x5bf50d){return{'id':_0x5bf50d['id']};}));return WhatsappMessage[_0x55bc('0x8')]({'where':{'WhatsappInteractionId':_0x2df8a3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x55bc('0x9')](function(_0x1d9571){_0x2df8a3[_0x55bc('0x6')](_0x55bc('0xa'),_0x1d9571[_0x55bc('0xb')]);WhatsappInteractionEvents[_0x55bc('0xc')](_0x347851+':'+_0x2df8a3['id'],_0x2df8a3);WhatsappInteractionEvents['emit'](_0x347851,_0x2df8a3);_0x328cf8(null);})[_0x55bc('0xd')](_0x328cf8(null));};}for(var e in events){if(events[_0x55bc('0xe')](e)){var event=events[e];WhatsappInteraction[_0x55bc('0xf')](e,emitEvent(event));}}module[_0x55bc('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 550cc76..1654d85 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x513897,_0x4fc773){var _0x3b167b=function(_0x3191e8){while(--_0x3191e8){_0x513897['push'](_0x513897['shift']());}};_0x3b167b(++_0x4fc773);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file +var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x4ca7d8,_0x18d1d1){var _0x436c42=function(_0x5aa144){while(--_0x5aa144){_0x4ca7d8['push'](_0x4ca7d8['shift']());}};_0x436c42(++_0x18d1d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index bd65a41..4a35028 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 _0x976b=['bluebird','../../mysqldb','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','WhatsappInteraction','body','options','where','attributes','limit','UpdateWhatsappInteraction','find','addTags','spread','AddTags','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x976b,0x16a));var _0xb976=function(_0x3a0b34,_0x5d642a){_0x3a0b34=_0x3a0b34-0x0;var _0x373835=_0x976b[_0x3a0b34];return _0x373835;};'use strict';var _=require('lodash');var util=require(_0xb976('0x0'));var moment=require('moment');var BPromise=require(_0xb976('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb976('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb976('0x3'));var config=require(_0xb976('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xb976('0x5')]=_[_0xb976('0x6')](config['redis'],{'host':_0xb976('0x7'),'port':0x18eb});var socket=require(_0xb976('0x8'))(new Redis(config[_0xb976('0x5')]));require(_0xb976('0x9'))[_0xb976('0xa')](socket);function respondWithRpcPromise(_0x4f08cd,_0xe56980,_0x5c7073){return new BPromise(function(_0x432be5,_0x44730a){return client[_0xb976('0xb')](_0x4f08cd,_0x5c7073)[_0xb976('0xc')](function(_0x35d133){logger[_0xb976('0xd')](_0xb976('0xe'),_0xe56980,'request\x20sent');logger[_0xb976('0xf')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xe56980,'request\x20sent',JSON[_0xb976('0x10')](_0x35d133));if(_0x35d133[_0xb976('0x11')]){if(_0x35d133[_0xb976('0x11')][_0xb976('0x12')]===0x1f4){logger[_0xb976('0x11')](_0xb976('0xe'),_0xe56980,_0x35d133['error'][_0xb976('0x13')]);return _0x44730a(_0x35d133['error'][_0xb976('0x13')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0xe56980,_0x35d133[_0xb976('0x11')]['message']);return _0x432be5(_0x35d133[_0xb976('0x11')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0xe56980,_0xb976('0x14'));_0x432be5(_0x35d133['result'][_0xb976('0x13')]);}})[_0xb976('0x15')](function(_0x2e912e){logger[_0xb976('0x11')](_0xb976('0xe'),_0xe56980,_0x2e912e);_0x44730a(_0x2e912e);});});}exports['UpdateWhatsappInteraction']=function(_0x542491){var _0x2509b0=this;return new Promise(function(_0x540a3e,_0x41c730){return db[_0xb976('0x16')]['update'](_0x542491[_0xb976('0x17')],{'raw':_0x542491[_0xb976('0x18')]?_0x542491[_0xb976('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x542491[_0xb976('0x18')]?_0x542491[_0xb976('0x18')][_0xb976('0x19')]||null:null,'attributes':_0x542491[_0xb976('0x18')]?_0x542491[_0xb976('0x18')][_0xb976('0x1a')]||null:null,'limit':_0x542491['options']?_0x542491['options'][_0xb976('0x1b')]||null:null})[_0xb976('0xc')](function(_0x1d3c2a){logger[_0xb976('0xd')](_0xb976('0x1c'),_0x542491);logger[_0xb976('0xf')](_0xb976('0x1c'),_0x542491,JSON[_0xb976('0x10')](_0x1d3c2a));_0x540a3e(_0x1d3c2a);})[_0xb976('0x15')](function(_0x1c170b){logger[_0xb976('0x11')]('UpdateWhatsappInteraction',_0x1c170b['message'],_0x542491);_0x41c730(_0x2509b0[_0xb976('0x11')](0x1f4,_0x1c170b[_0xb976('0x13')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x153ab1){return new Promise(function(_0x12bc77,_0x2faa73){return db['WhatsappInteraction'][_0xb976('0x1d')]({'where':_0x153ab1[_0xb976('0x18')]?_0x153ab1[_0xb976('0x18')][_0xb976('0x19')]||null:null})[_0xb976('0xc')](function(_0x35252c){if(_0x35252c){return _0x35252c[_0xb976('0x1e')](_0x153ab1[_0xb976('0x17')]['ids'],_['omit'](_0x153ab1['body'],['ids','id'])||{});}})[_0xb976('0x1f')](function(_0x1f44c0){logger['info']('AddTags',_0x153ab1);logger[_0xb976('0xf')](_0xb976('0x20'),_0x153ab1,JSON[_0xb976('0x10')](_0x1f44c0));_0x12bc77(_0x1f44c0);})['catch'](function(_0x25c7fd){logger['error'](_0xb976('0x20'),_0x25c7fd[_0xb976('0x13')],_0x153ab1);_0x2faa73(_this[_0xb976('0x11')](0x1f4,_0x25c7fd[_0xb976('0x13')]));});});}; \ No newline at end of file +var _0xa056=['spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','options','raw','limit','AddTagsToWhatsappInteraction','find','where','addTags','ids','body'];(function(_0x28efdc,_0x5bc5a4){var _0x35f396=function(_0x2c6762){while(--_0x2c6762){_0x28efdc['push'](_0x28efdc['shift']());}};_0x35f396(++_0x5bc5a4);}(_0xa056,0x13a));var _0x6a05=function(_0x544c32,_0x2c3406){_0x544c32=_0x544c32-0x0;var _0x5abd2c=_0xa056[_0x544c32];return _0x5abd2c;};'use strict';var _=require(_0x6a05('0x0'));var util=require(_0x6a05('0x1'));var moment=require(_0x6a05('0x2'));var BPromise=require(_0x6a05('0x3'));var rs=require(_0x6a05('0x4'));var fs=require('fs');var Redis=require(_0x6a05('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a05('0x6'));var logger=require(_0x6a05('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6a05('0x8'));var client=jayson[_0x6a05('0x9')][_0x6a05('0xa')]({'port':0x232a});config[_0x6a05('0xb')]=_[_0x6a05('0xc')](config[_0x6a05('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6a05('0xd'))[_0x6a05('0xe')](socket);function respondWithRpcPromise(_0x235c52,_0x5e174f,_0xf7ad99){return new BPromise(function(_0x5abfd2,_0x5ee21f){return client['request'](_0x235c52,_0xf7ad99)[_0x6a05('0xf')](function(_0x5143fd){logger[_0x6a05('0x10')](_0x6a05('0x11'),_0x5e174f,_0x6a05('0x12'));logger[_0x6a05('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5e174f,'request\x20sent',JSON[_0x6a05('0x14')](_0x5143fd));if(_0x5143fd['error']){if(_0x5143fd[_0x6a05('0x15')][_0x6a05('0x16')]===0x1f4){logger[_0x6a05('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x5e174f,_0x5143fd['error'][_0x6a05('0x17')]);return _0x5ee21f(_0x5143fd[_0x6a05('0x15')][_0x6a05('0x17')]);}logger[_0x6a05('0x15')](_0x6a05('0x11'),_0x5e174f,_0x5143fd[_0x6a05('0x15')][_0x6a05('0x17')]);return _0x5abfd2(_0x5143fd['error'][_0x6a05('0x17')]);}else{logger[_0x6a05('0x10')](_0x6a05('0x11'),_0x5e174f,_0x6a05('0x12'));_0x5abfd2(_0x5143fd[_0x6a05('0x18')][_0x6a05('0x17')]);}})[_0x6a05('0x19')](function(_0x143749){logger[_0x6a05('0x15')](_0x6a05('0x11'),_0x5e174f,_0x143749);_0x5ee21f(_0x143749);});});}exports[_0x6a05('0x1a')]=function(_0x2e0441){var _0x4221c3=this;return new Promise(function(_0x2dbafb,_0x792159){return db[_0x6a05('0x1b')]['update'](_0x2e0441['body'],{'raw':_0x2e0441[_0x6a05('0x1c')]?_0x2e0441[_0x6a05('0x1c')][_0x6a05('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e0441['options']?_0x2e0441['options']['where']||null:null,'attributes':_0x2e0441[_0x6a05('0x1c')]?_0x2e0441[_0x6a05('0x1c')]['attributes']||null:null,'limit':_0x2e0441[_0x6a05('0x1c')]?_0x2e0441['options'][_0x6a05('0x1e')]||null:null})[_0x6a05('0xf')](function(_0xf738ff){logger[_0x6a05('0x10')]('UpdateWhatsappInteraction',_0x2e0441);logger[_0x6a05('0x13')](_0x6a05('0x1a'),_0x2e0441,JSON[_0x6a05('0x14')](_0xf738ff));_0x2dbafb(_0xf738ff);})[_0x6a05('0x19')](function(_0x5be7aa){logger[_0x6a05('0x15')](_0x6a05('0x1a'),_0x5be7aa['message'],_0x2e0441);_0x792159(_0x4221c3['error'](0x1f4,_0x5be7aa[_0x6a05('0x17')]));});});};exports[_0x6a05('0x1f')]=function(_0x5e76f3){return new Promise(function(_0x1bfa66,_0x20c7d7){return db['WhatsappInteraction'][_0x6a05('0x20')]({'where':_0x5e76f3[_0x6a05('0x1c')]?_0x5e76f3[_0x6a05('0x1c')][_0x6a05('0x21')]||null:null})[_0x6a05('0xf')](function(_0x38276e){if(_0x38276e){return _0x38276e[_0x6a05('0x22')](_0x5e76f3['body'][_0x6a05('0x23')],_['omit'](_0x5e76f3[_0x6a05('0x24')],[_0x6a05('0x23'),'id'])||{});}})[_0x6a05('0x25')](function(_0x139c85){logger[_0x6a05('0x10')](_0x6a05('0x26'),_0x5e76f3);logger[_0x6a05('0x13')]('AddTags',_0x5e76f3,JSON[_0x6a05('0x14')](_0x139c85));_0x1bfa66(_0x139c85);})[_0x6a05('0x19')](function(_0x2069b9){logger[_0x6a05('0x15')](_0x6a05('0x26'),_0x2069b9[_0x6a05('0x17')],_0x5e76f3);_0x20c7d7(_this[_0x6a05('0x15')](0x1f4,_0x2069b9[_0x6a05('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 7c3018c..afc09c0 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 _0x0a29=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x934c22,_0x47b0ce){var _0x34e290=function(_0xcb436e){while(--_0xcb436e){_0x934c22['push'](_0x934c22['shift']());}};_0x34e290(++_0x47b0ce);}(_0x0a29,0x69));var _0x90a2=function(_0x42fb32,_0x1438a3){_0x42fb32=_0x42fb32-0x0;var _0x27d045=_0x0a29[_0x42fb32];return _0x27d045;};'use strict';var WhatsappInteractionEvents=require(_0x90a2('0x0'));var events=[_0x90a2('0x1'),_0x90a2('0x2'),_0x90a2('0x3')];function createListener(_0x2cd787,_0x4d6369){return function(_0x3a7195){_0x4d6369[_0x90a2('0x4')](_0x2cd787,_0x3a7195);};}function removeListener(_0x5d2a76,_0x50d230){return function(){WhatsappInteractionEvents[_0x90a2('0x5')](_0x5d2a76,_0x50d230);};}exports[_0x90a2('0x6')]=function(_0x19652c){for(var _0x3fef01=0x0,_0x5dca59=events[_0x90a2('0x7')];_0x3fef01<_0x5dca59;_0x3fef01++){var _0x51b36e=events[_0x3fef01];var _0x10b37b=createListener(_0x90a2('0x8')+_0x51b36e,_0x19652c);WhatsappInteractionEvents['on'](_0x51b36e,_0x10b37b);}}; \ No newline at end of file +var _0xcad6=['removeListener','length','whatsappInteraction:','./whatsappInteraction.events','remove','update','emit'];(function(_0x49a138,_0x559cad){var _0x446308=function(_0x35a1e5){while(--_0x35a1e5){_0x49a138['push'](_0x49a138['shift']());}};_0x446308(++_0x559cad);}(_0xcad6,0x81));var _0x6cad=function(_0x2dd8d0,_0x45af9c){_0x2dd8d0=_0x2dd8d0-0x0;var _0x34540e=_0xcad6[_0x2dd8d0];return _0x34540e;};'use strict';var WhatsappInteractionEvents=require(_0x6cad('0x0'));var events=['save',_0x6cad('0x1'),_0x6cad('0x2')];function createListener(_0x33321d,_0x3d6dfa){return function(_0x317de7){_0x3d6dfa[_0x6cad('0x3')](_0x33321d,_0x317de7);};}function removeListener(_0x4c1197,_0x58f85a){return function(){WhatsappInteractionEvents[_0x6cad('0x4')](_0x4c1197,_0x58f85a);};}exports['register']=function(_0x27be51){for(var _0x2b1483=0x0,_0x5039a7=events[_0x6cad('0x5')];_0x2b1483<_0x5039a7;_0x2b1483++){var _0x5acfb7=events[_0x2b1483];var _0x642dc7=createListener(_0x6cad('0x6')+_0x5acfb7,_0x27be51);WhatsappInteractionEvents['on'](_0x5acfb7,_0x642dc7);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 6f6939e..163bd86 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 _0xc63b=['status','put','/:id/accept','/:id/reject','delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status'];(function(_0x38e056,_0xe7b973){var _0x33646e=function(_0x35f3a0){while(--_0x35f3a0){_0x38e056['push'](_0x38e056['shift']());}};_0x33646e(++_0xe7b973);}(_0xc63b,0x124));var _0xbc63=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xc63b[_0x34bc30];return _0x5706de;};'use strict';var multer=require('multer');var util=require(_0xbc63('0x0'));var path=require(_0xbc63('0x1'));var timeout=require('connect-timeout');var express=require(_0xbc63('0x2'));var router=express[_0xbc63('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbc63('0x4'));var config=require(_0xbc63('0x5'));var controller=require('./whatsappMessage.controller');router[_0xbc63('0x6')]('/',auth[_0xbc63('0x7')](),controller['index']);router[_0xbc63('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xbc63('0x8')]);router[_0xbc63('0x6')](_0xbc63('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xbc63('0xa')]('/',auth[_0xbc63('0x7')](),interaction[_0xbc63('0xb')](_0xbc63('0xc'),_0xbc63('0xd')),controller[_0xbc63('0xe')]);router['post'](_0xbc63('0xf'),controller[_0xbc63('0x10')]);router[_0xbc63('0x11')](_0xbc63('0x9'),auth[_0xbc63('0x7')](),controller['update']);router[_0xbc63('0x11')](_0xbc63('0x12'),auth[_0xbc63('0x7')](),controller['accept']);router[_0xbc63('0x11')](_0xbc63('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0xbc63('0x14')](_0xbc63('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xbc63('0x15')]=router; \ No newline at end of file +var _0x5bac=['destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','index','get','/describe','/:id','post','isAuthenticated','tracked','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject'];(function(_0x345ab5,_0x452df3){var _0x41c8d4=function(_0x8375dd){while(--_0x8375dd){_0x345ab5['push'](_0x345ab5['shift']());}};_0x41c8d4(++_0x452df3);}(_0x5bac,0x1e2));var _0xc5ba=function(_0x5625b8,_0x2b1e8d){_0x5625b8=_0x5625b8-0x0;var _0xe173f7=_0x5bac[_0x5625b8];return _0xe173f7;};'use strict';var multer=require(_0xc5ba('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc5ba('0x1'));var express=require(_0xc5ba('0x2'));var router=express['Router']();var auth=require(_0xc5ba('0x3'));var interaction=require(_0xc5ba('0x4'));var config=require(_0xc5ba('0x5'));var controller=require(_0xc5ba('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc5ba('0x7')]);router[_0xc5ba('0x8')](_0xc5ba('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xc5ba('0x8')](_0xc5ba('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc5ba('0xb')]('/',auth[_0xc5ba('0xc')](),interaction[_0xc5ba('0xd')]('whatsapp','whatsappmessage:create'),controller[_0xc5ba('0xe')]);router['post'](_0xc5ba('0xf'),controller['status']);router[_0xc5ba('0x10')](_0xc5ba('0xa'),auth[_0xc5ba('0xc')](),controller[_0xc5ba('0x11')]);router[_0xc5ba('0x10')](_0xc5ba('0x12'),auth[_0xc5ba('0xc')](),controller[_0xc5ba('0x13')]);router['put'](_0xc5ba('0x14'),auth[_0xc5ba('0xc')](),controller[_0xc5ba('0x15')]);router['delete'](_0xc5ba('0xa'),auth[_0xc5ba('0xc')](),controller[_0xc5ba('0x16')]);module[_0xc5ba('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 4c0225f..8acb4de 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 _0x0565=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x5a6fbf,_0x20874e){var _0x883f31=function(_0x4721a1){while(--_0x4721a1){_0x5a6fbf['push'](_0x5a6fbf['shift']());}};_0x883f31(++_0x20874e);}(_0x0565,0xf2));var _0x5056=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x0565[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'body':{'type':Sequelize[_0x5056('0x2')](_0x5056('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5056('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5056('0x5')]('in',_0x5056('0x6')),'defaultValue':_0x5056('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5056('0x7')](0xbe)},'phone':{'type':Sequelize[_0x5056('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5056('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xafca=['BOOLEAN','out','STRING','DATE','exports','TEXT'];(function(_0x24ee0e,_0x5deadb){var _0x11b7b0=function(_0x434f52){while(--_0x434f52){_0x24ee0e['push'](_0x24ee0e['shift']());}};_0x11b7b0(++_0x5deadb);}(_0xafca,0x106));var _0xaafc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xafca[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xaafc('0x0')]={'body':{'type':Sequelize[_0xaafc('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xaafc('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xaafc('0x3')),'defaultValue':_0xaafc('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xaafc('0x4')]},'readAt':{'type':Sequelize[_0xaafc('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 33d4e3c..ff1dcfd 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 _0x1a4f=['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','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','destroy','stack','name','map','WhatsappMessage','rawAttributes','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','show','params','options','find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','manual','interface','channel','event','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SIP/%s','rejectmessage','WhatsappAccount','debug','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','http','test','ValidationError'];(function(_0x32a069,_0x2b24b4){var _0x2978a3=function(_0x224e81){while(--_0x224e81){_0x32a069['push'](_0x32a069['shift']());}};_0x2978a3(++_0x2b24b4);}(_0x1a4f,0x151));var _0xf1a4=function(_0x2c46e0,_0x168644){_0x2c46e0=_0x2c46e0-0x0;var _0xb3640c=_0x1a4f[_0x2c46e0];return _0xb3640c;};'use strict';var pdf=require(_0xf1a4('0x0'));var emlformat=require(_0xf1a4('0x1'));var rimraf=require(_0xf1a4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf1a4('0x3'));var rp=require('request-promise');var moment=require(_0xf1a4('0x4'));var BPromise=require(_0xf1a4('0x5'));var Mustache=require('mustache');var util=require(_0xf1a4('0x6'));var path=require(_0xf1a4('0x7'));var sox=require(_0xf1a4('0x8'));var csv=require(_0xf1a4('0x9'));var ejs=require(_0xf1a4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf1a4('0xb'));var crypto=require(_0xf1a4('0xc'));var jsforce=require(_0xf1a4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf1a4('0x9'));var querystring=require('querystring');var Papa=require(_0xf1a4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf1a4('0xf'));var as=require(_0xf1a4('0x10'));var hardwareService=require(_0xf1a4('0x11'));var logger=require(_0xf1a4('0x12'))(_0xf1a4('0x13'));var utils=require(_0xf1a4('0x14'));var config=require(_0xf1a4('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xf1a4('0x16')],{'host':_0xf1a4('0x17'),'port':0x18eb});var socket=require(_0xf1a4('0x18'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xf1a4('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xf1a4('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0xf1a4('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x22a003,_0x5df7ac,_0x3f6425){if(_0x3f6425){var _0x3338a8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3338a8[_0xf1a4('0x1b')](_0x5df7ac)){return _0x22a003;}else{throw new db['Sequelize'][(_0xf1a4('0x1c'))](_0xf1a4('0x1d'));}}else{return _0x22a003;}}function respondWithRpcPromise(_0x597707,_0x124dc8,_0x4fd217,_0x4ed33c){return new BPromise(function(_0x5d92a1,_0x43acd4){var _0x188884=_0x4ed33c||client;return _0x188884[_0xf1a4('0x1e')](_0x597707,_0x4fd217)[_0xf1a4('0x1f')](function(_0x1aa738){logger[_0xf1a4('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x124dc8,_0xf1a4('0x21'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x124dc8,'request\x20sent',JSON[_0xf1a4('0x22')](_0x1aa738));if(_0x1aa738['error']){if(_0x1aa738[_0xf1a4('0x23')][_0xf1a4('0x24')]===0x1f4){logger[_0xf1a4('0x23')](_0xf1a4('0x25'),_0x124dc8,_0x1aa738['error']['message']);return _0x43acd4(_0x1aa738[_0xf1a4('0x23')][_0xf1a4('0x26')]);}logger[_0xf1a4('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x124dc8,_0x1aa738[_0xf1a4('0x23')][_0xf1a4('0x26')]);return _0x5d92a1(_0x1aa738['error'][_0xf1a4('0x26')]);}else{logger[_0xf1a4('0x20')](_0xf1a4('0x25'),_0x124dc8,'request\x20sent');_0x5d92a1(_0x1aa738[_0xf1a4('0x27')][_0xf1a4('0x26')]);}})[_0xf1a4('0x28')](function(_0x333690){logger[_0xf1a4('0x23')](_0xf1a4('0x25'),_0x124dc8,_0x333690);_0x43acd4(_0x333690);});});}function respondWithStatusCode(_0x3878c6,_0x5618ab){_0x5618ab=_0x5618ab||0xcc;return function(_0x6102e6){if(_0x6102e6){return _0x3878c6[_0xf1a4('0x29')](_0x5618ab);}return _0x3878c6[_0xf1a4('0x2a')](_0x5618ab)['end']();};}function respondWithResult(_0x10d167,_0x31296d){_0x31296d=_0x31296d||0xc8;return function(_0x53ca18){if(_0x53ca18){return _0x10d167[_0xf1a4('0x2a')](_0x31296d)[_0xf1a4('0x2b')](_0x53ca18);}};}function respondWithFilteredResult(_0x5ed63c,_0xfbd6a7){return function(_0x3ba15e){if(_0x3ba15e){var _0x317d1b=_0x3ba15e[_0xf1a4('0x2c')],_0xe05d00=_0xfbd6a7[_0xf1a4('0x2d')],_0x5acae9=_0xfbd6a7[_0xf1a4('0x2d')]+_0xfbd6a7[_0xf1a4('0x2e')],_0xd841a6;if(_0x5acae9>=_0x317d1b){_0x5acae9=_0x317d1b;_0xd841a6=0xc8;}else{_0xd841a6=0xce;}_0x5ed63c[_0xf1a4('0x2a')](_0xd841a6);return _0x5ed63c[_0xf1a4('0x2f')](_0xf1a4('0x30'),_0xe05d00+'-'+_0x5acae9+'/'+_0x317d1b)['json'](_0x3ba15e);}return null;};}function patchUpdates(_0x47ed9b){return function(_0x3852c9){try{jsonpatch['apply'](_0x3852c9,_0x47ed9b,!![]);}catch(_0x40e80d){return BPromise[_0xf1a4('0x31')](_0x40e80d);}return _0x3852c9['save']();};}function saveUpdates(_0x1f1608,_0x3d4aab){return function(_0x4d8cd0){if(_0x4d8cd0){return _0x4d8cd0['update'](_0x1f1608)[_0xf1a4('0x1f')](function(_0x5ee33d){return _0x5ee33d;});}return null;};}function removeEntity(_0x256f7a,_0xd862f9){return function(_0x34e3bd){if(_0x34e3bd){return _0x34e3bd[_0xf1a4('0x32')]()[_0xf1a4('0x1f')](function(){_0x256f7a[_0xf1a4('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53d761,_0xc5389d){return function(_0x6d5d98){if(!_0x6d5d98){_0x53d761[_0xf1a4('0x29')](0x194);}return _0x6d5d98;};}function handleError(_0x168ce2,_0x45c85c){_0x45c85c=_0x45c85c||0x1f4;return function(_0x3ad481){logger[_0xf1a4('0x23')](_0x3ad481[_0xf1a4('0x33')]);if(_0x3ad481['name']){delete _0x3ad481[_0xf1a4('0x34')];}_0x168ce2[_0xf1a4('0x2a')](_0x45c85c)['send'](_0x3ad481);};}exports['index']=function(_0x1d9efb,_0x41e4b2){var _0x3852d1={},_0x5c9e67={},_0x147f0d={'count':0x0,'rows':[]};var _0x4767b8=_[_0xf1a4('0x35')](db[_0xf1a4('0x36')][_0xf1a4('0x37')],function(_0x4d8a47){return{'name':_0x4d8a47['fieldName'],'type':_0x4d8a47[_0xf1a4('0x38')]['key']};});_0x5c9e67['model']=_[_0xf1a4('0x35')](_0x4767b8,_0xf1a4('0x34'));_0x5c9e67[_0xf1a4('0x39')]=_[_0xf1a4('0x3a')](_0x1d9efb[_0xf1a4('0x39')]);_0x5c9e67['filters']=_[_0xf1a4('0x3b')](_0x5c9e67[_0xf1a4('0x3c')],_0x5c9e67[_0xf1a4('0x39')]);_0x3852d1['attributes']=_[_0xf1a4('0x3b')](_0x5c9e67[_0xf1a4('0x3c')],qs[_0xf1a4('0x3d')](_0x1d9efb[_0xf1a4('0x39')][_0xf1a4('0x3d')]));_0x3852d1['attributes']=_0x3852d1[_0xf1a4('0x3e')][_0xf1a4('0x3f')]?_0x3852d1[_0xf1a4('0x3e')]:_0x5c9e67[_0xf1a4('0x3c')];if(!_0x1d9efb[_0xf1a4('0x39')][_0xf1a4('0x40')](_0xf1a4('0x41'))){_0x3852d1[_0xf1a4('0x2e')]=qs[_0xf1a4('0x2e')](_0x1d9efb[_0xf1a4('0x39')][_0xf1a4('0x2e')]);_0x3852d1['offset']=qs[_0xf1a4('0x2d')](_0x1d9efb[_0xf1a4('0x39')][_0xf1a4('0x2d')]);}_0x3852d1[_0xf1a4('0x42')]=qs[_0xf1a4('0x43')](_0x1d9efb[_0xf1a4('0x39')]['sort']);_0x3852d1[_0xf1a4('0x44')]=qs['filters'](_['pick'](_0x1d9efb[_0xf1a4('0x39')],_0x5c9e67[_0xf1a4('0x45')]),_0x4767b8);if(_0x1d9efb[_0xf1a4('0x39')][_0xf1a4('0x46')]){_0x3852d1[_0xf1a4('0x44')]=_[_0xf1a4('0x47')](_0x3852d1[_0xf1a4('0x44')],{'$or':_[_0xf1a4('0x35')](_0x4767b8,function(_0x4cd9c4){if(_0x4cd9c4[_0xf1a4('0x38')]!=='VIRTUAL'){var _0x11f0ff={};_0x11f0ff[_0x4cd9c4[_0xf1a4('0x34')]]={'$like':'%'+_0x1d9efb['query'][_0xf1a4('0x46')]+'%'};return _0x11f0ff;}})});}_0x3852d1=_[_0xf1a4('0x47')]({},_0x3852d1,_0x1d9efb['options']);var _0x5901cb={'where':_0x3852d1[_0xf1a4('0x44')]};return db[_0xf1a4('0x36')][_0xf1a4('0x2c')](_0x5901cb)['then'](function(_0x2b2d55){_0x147f0d[_0xf1a4('0x2c')]=_0x2b2d55;if(_0x1d9efb['query'][_0xf1a4('0x48')]){_0x3852d1[_0xf1a4('0x49')]=[{'all':!![]}];}return db[_0xf1a4('0x36')][_0xf1a4('0x4a')](_0x3852d1);})[_0xf1a4('0x1f')](function(_0x3a8b24){_0x147f0d[_0xf1a4('0x4b')]=_0x3a8b24;return _0x147f0d;})[_0xf1a4('0x1f')](respondWithFilteredResult(_0x41e4b2,_0x3852d1))[_0xf1a4('0x28')](handleError(_0x41e4b2,null));};exports[_0xf1a4('0x4c')]=function(_0x4a2bed,_0x1e53a9){var _0x37a351={'raw':!![],'where':{'id':_0x4a2bed[_0xf1a4('0x4d')]['id']}},_0x28708b={};_0x28708b[_0xf1a4('0x3c')]=_['keys'](db[_0xf1a4('0x36')][_0xf1a4('0x37')]);_0x28708b[_0xf1a4('0x39')]=_['keys'](_0x4a2bed[_0xf1a4('0x39')]);_0x28708b[_0xf1a4('0x45')]=_[_0xf1a4('0x3b')](_0x28708b[_0xf1a4('0x3c')],_0x28708b['query']);_0x37a351[_0xf1a4('0x3e')]=_[_0xf1a4('0x3b')](_0x28708b['model'],qs['fields'](_0x4a2bed[_0xf1a4('0x39')]['fields']));_0x37a351[_0xf1a4('0x3e')]=_0x37a351[_0xf1a4('0x3e')][_0xf1a4('0x3f')]?_0x37a351[_0xf1a4('0x3e')]:_0x28708b['model'];if(_0x4a2bed[_0xf1a4('0x39')][_0xf1a4('0x48')]){_0x37a351['include']=[{'all':!![]}];}_0x37a351=_['merge']({},_0x37a351,_0x4a2bed[_0xf1a4('0x4e')]);return db[_0xf1a4('0x36')][_0xf1a4('0x4f')](_0x37a351)[_0xf1a4('0x1f')](handleEntityNotFound(_0x1e53a9,null))['then'](respondWithResult(_0x1e53a9,null))[_0xf1a4('0x28')](handleError(_0x1e53a9,null));};exports[_0xf1a4('0x50')]=function(_0x3ad26a,_0x4d4e85){return db[_0xf1a4('0x36')][_0xf1a4('0x50')](_0x3ad26a[_0xf1a4('0x51')],{})['then'](respondWithResult(_0x4d4e85,0xc9))[_0xf1a4('0x28')](handleError(_0x4d4e85,null));};exports[_0xf1a4('0x52')]=function(_0x36a732,_0x4d0cff){if(_0x36a732[_0xf1a4('0x51')]['id']){delete _0x36a732['body']['id'];}return db[_0xf1a4('0x36')][_0xf1a4('0x4f')]({'where':{'id':_0x36a732['params']['id']}})[_0xf1a4('0x1f')](handleEntityNotFound(_0x4d0cff,null))[_0xf1a4('0x1f')](saveUpdates(_0x36a732[_0xf1a4('0x51')],null))['then'](respondWithResult(_0x4d0cff,null))[_0xf1a4('0x28')](handleError(_0x4d0cff,null));};exports[_0xf1a4('0x32')]=function(_0x33a66a,_0x4ea7f8){return db[_0xf1a4('0x36')]['find']({'where':{'id':_0x33a66a[_0xf1a4('0x4d')]['id']}})[_0xf1a4('0x1f')](handleEntityNotFound(_0x4ea7f8,null))[_0xf1a4('0x1f')](removeEntity(_0x4ea7f8,null))[_0xf1a4('0x28')](handleError(_0x4ea7f8,null));};exports[_0xf1a4('0x53')]=function(_0xaea142,_0x2eb7b5){return db['WhatsappMessage'][_0xf1a4('0x53')]()[_0xf1a4('0x1f')](respondWithResult(_0x2eb7b5,null))[_0xf1a4('0x28')](handleError(_0x2eb7b5,null));};var interaction_log=require(_0xf1a4('0x12'))(_0xf1a4('0x54'));exports[_0xf1a4('0x55')]=function(_0x1f002e,_0x3bbf36,_0x2dbf80){var _0x359996={'channel':_0xf1a4('0x56')};if(_0x1f002e[_0xf1a4('0x51')]['id']){delete _0x1f002e[_0xf1a4('0x51')]['id'];}_0x1f002e[_0xf1a4('0x51')][_0xf1a4('0x57')]=!![];_0x1f002e[_0xf1a4('0x51')][_0xf1a4('0x58')]=moment()[_0xf1a4('0x59')](_0xf1a4('0x5a'));_0x1f002e[_0xf1a4('0x51')][_0xf1a4('0x5b')]=_0x1f002e[_0xf1a4('0x51')][_0xf1a4('0x5b')]||_0x1f002e[_0xf1a4('0x5c')]['id'];return db[_0xf1a4('0x36')][_0xf1a4('0x4f')]({'where':{'id':_0x1f002e[_0xf1a4('0x4d')]['id'],'UserId':null},'include':[{'model':db[_0xf1a4('0x5d')],'as':_0xf1a4('0x5e')}]})[_0xf1a4('0x1f')](handleEntityNotFound(_0x3bbf36,null))[_0xf1a4('0x1f')](saveUpdates(_0x1f002e[_0xf1a4('0x51')],null))['then'](function(_0x13d11e){if(_0x13d11e){_0x359996[_0xf1a4('0x26')]=_0x13d11e[_0xf1a4('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0xf1a4('0x4f')]({'where':{'id':_0x13d11e[_0xf1a4('0x60')]}});}return null;})[_0xf1a4('0x1f')](handleEntityNotFound(_0x3bbf36,null))[_0xf1a4('0x1f')](function(_0x297874){if(_0x297874){return _0x297874['update']({'UserId':_0x1f002e[_0xf1a4('0x51')][_0xf1a4('0x5b')],'read1stAt':_['isNil'](_0x297874[_0xf1a4('0x61')])?moment()[_0xf1a4('0x59')](_0xf1a4('0x5a')):undefined});}return null;})[_0xf1a4('0x1f')](function(_0x57479e){if(_0x57479e){_0x359996[_0xf1a4('0x62')]=_0x57479e[_0xf1a4('0x5f')]({'plain':!![]});interaction_log[_0xf1a4('0x20')](_0xf1a4('0x63'),_0x1f002e[_0xf1a4('0x5c')]['id'],_0x1f002e[_0xf1a4('0x5c')][_0xf1a4('0x34')],_0x1f002e[_0xf1a4('0x5c')][_0xf1a4('0x64')],_0x359996[_0xf1a4('0x62')]['id'],_0x1f002e[_0xf1a4('0x51')]?JSON['stringify'](_0x1f002e[_0xf1a4('0x51')]):'null');return respondWithRpcPromise(_0xf1a4('0x65'),'acceptMessage',_0x359996);}return null;})[_0xf1a4('0x1f')](function(_0x2d9ff8){if(_0x2d9ff8){if(_0x1f002e[_0xf1a4('0x51')][_0xf1a4('0x66')]){_0x359996[_0xf1a4('0x26')][_0xf1a4('0x67')]=util['format']('SIP/%s',_0x1f002e['user']['name']);_0x359996[_0xf1a4('0x26')][_0xf1a4('0x68')]=_0x359996['channel'];_0x359996[_0xf1a4('0x26')][_0xf1a4('0x69')]='accept';return respondWithRpcPromise(_0xf1a4('0x6a'),_0xf1a4('0x6a'),{'event':'acceptmessage','message':_0x359996[_0xf1a4('0x26')]},client9002)[_0xf1a4('0x1f')](function(){return _0x359996;});}return _0x359996;}return null;})[_0xf1a4('0x1f')](respondWithResult(_0x3bbf36,null))['catch'](handleError(_0x3bbf36,null));};var interaction_log=require(_0xf1a4('0x12'))(_0xf1a4('0x54'));exports[_0xf1a4('0x31')]=function(_0x58aa8b,_0x315d9a,_0x32e8b9){var _0x13654f={'agent':{},'channel':_0xf1a4('0x56')};if(_0x58aa8b[_0xf1a4('0x51')]['id']){delete _0x58aa8b[_0xf1a4('0x51')]['id'];}_0x58aa8b[_0xf1a4('0x51')][_0xf1a4('0x5b')]=_0x58aa8b[_0xf1a4('0x51')][_0xf1a4('0x5b')]||_0x58aa8b[_0xf1a4('0x5c')]['id'];_0x13654f['agent']['id']=_0x58aa8b[_0xf1a4('0x51')][_0xf1a4('0x5b')];return db[_0xf1a4('0x36')][_0xf1a4('0x4f')]({'where':{'id':_0x58aa8b[_0xf1a4('0x4d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x315d9a,null))['then'](function(_0x308ddc){if(_0x308ddc){_0x13654f['message']=_0x308ddc['get']({'plain':!![]});return db[_0xf1a4('0x6b')][_0xf1a4('0x4f')]({'where':{'id':_0x308ddc['WhatsappInteractionId']}});}return null;})[_0xf1a4('0x1f')](handleEntityNotFound(_0x315d9a,null))['then'](function(_0x245c38){if(_0x245c38){_0x13654f[_0xf1a4('0x62')]=_0x245c38['get']({'plain':!![]});interaction_log[_0xf1a4('0x20')](_0xf1a4('0x6c'),_0x58aa8b[_0xf1a4('0x5c')]['id'],_0x58aa8b['user']['name'],_0x58aa8b[_0xf1a4('0x5c')][_0xf1a4('0x64')],_0x13654f[_0xf1a4('0x62')]['id'],_0x58aa8b[_0xf1a4('0x51')]?JSON[_0xf1a4('0x22')](_0x58aa8b[_0xf1a4('0x51')]):_0xf1a4('0x6d'));return respondWithRpcPromise(_0xf1a4('0x6e'),_0xf1a4('0x6f'),_0x13654f);}return null;})[_0xf1a4('0x1f')](function(_0xd8afdb){if(_0xd8afdb){_0xd8afdb['message'][_0xf1a4('0x67')]=util[_0xf1a4('0x59')](_0xf1a4('0x70'),_0x58aa8b[_0xf1a4('0x5c')]['name']);_0xd8afdb[_0xf1a4('0x26')][_0xf1a4('0x68')]=_0x13654f['channel'];_0xd8afdb['message'][_0xf1a4('0x69')]=_0xf1a4('0x31');respondWithRpcPromise(_0xf1a4('0x6a'),_0xf1a4('0x6a'),{'event':_0xf1a4('0x71'),'message':_0xd8afdb[_0xf1a4('0x26')]},client9002);return _0x13654f;}return null;})['then'](respondWithResult(_0x315d9a,null))[_0xf1a4('0x28')](handleError(_0x315d9a,null));};exports[_0xf1a4('0x2a')]=function(_0x57aeae,_0x49d776,_0x3d3a08){if(_0x57aeae[_0xf1a4('0x51')]['id']){delete _0x57aeae[_0xf1a4('0x51')]['id'];}var _0x2e8a57;return db['WhatsappMessage'][_0xf1a4('0x4f')]({'where':{'id':_0x57aeae[_0xf1a4('0x4d')]['id']}})[_0xf1a4('0x1f')](handleEntityNotFound(_0x49d776,null))['then'](function(_0x14c7f9){if(_0x14c7f9){_0x2e8a57=_0x14c7f9;return db[_0xf1a4('0x72')][_0xf1a4('0x4f')]({'where':{'id':_0x14c7f9['WhatsappAccountId']}});}})[_0xf1a4('0x1f')](handleEntityNotFound(_0x49d776,null))[_0xf1a4('0x1f')](function(_0x7d027c){if(_0x7d027c){logger[_0xf1a4('0x73')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xf1a4('0x2a'),_0xf1a4('0x74'),_0x7d027c[_0xf1a4('0x38')],util[_0xf1a4('0x75')](_0x57aeae[_0xf1a4('0x51')],{'showHidden':![],'depth':null}));switch(_0x7d027c[_0xf1a4('0x38')]){case'twilio':if(_0x57aeae[_0xf1a4('0x51')]['MessageSid']&&_0x57aeae[_0xf1a4('0x51')][_0xf1a4('0x76')]===_0x2e8a57[_0xf1a4('0x77')]&&_0x57aeae[_0xf1a4('0x51')][_0xf1a4('0x78')]&&_0x57aeae['body']['MessageStatus']===_0xf1a4('0x57')){return _0x2e8a57[_0xf1a4('0x52')]({'read':!![]});}else{logger['error'](_0xf1a4('0x79'),_0xf1a4('0x2a'),'twilio',util['inspect'](_0x57aeae[_0xf1a4('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x2e8a57;}})[_0xf1a4('0x1f')](respondWithResult(_0x49d776,null))[_0xf1a4('0x28')](handleError(_0x49d776,null));}; \ No newline at end of file +var _0xcf59=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.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','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','merge','VIRTUAL','filter','includeAll','findAll','catch','show','params','include','options','find','create','body','describe','accept','whatsapp','read','readAt','format','UserId','CmContact','get','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','stringify','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x9709ce,_0x5765af){var _0x414c87=function(_0x51149b){while(--_0x51149b){_0x9709ce['push'](_0x9709ce['shift']());}};_0x414c87(++_0x5765af);}(_0xcf59,0x71));var _0x9cf5=function(_0x2e97bf,_0x569e2b){_0x2e97bf=_0x2e97bf-0x0;var _0x3b2110=_0xcf59[_0x2e97bf];return _0x3b2110;};'use strict';var pdf=require(_0x9cf5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9cf5('0x1'));var zipdir=require(_0x9cf5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9cf5('0x3'));var moment=require(_0x9cf5('0x4'));var BPromise=require(_0x9cf5('0x5'));var Mustache=require(_0x9cf5('0x6'));var util=require('util');var path=require(_0x9cf5('0x7'));var sox=require(_0x9cf5('0x8'));var csv=require(_0x9cf5('0x9'));var ejs=require(_0x9cf5('0xa'));var fs=require('fs');var _=require(_0x9cf5('0xb'));var squel=require('squel');var crypto=require(_0x9cf5('0xc'));var jsforce=require(_0x9cf5('0xd'));var deskjs=require(_0x9cf5('0xe'));var toCsv=require(_0x9cf5('0x9'));var querystring=require('querystring');var Papa=require(_0x9cf5('0xf'));var Redis=require(_0x9cf5('0x10'));var authService=require(_0x9cf5('0x11'));var qs=require(_0x9cf5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cf5('0x13'));var logger=require(_0x9cf5('0x14'))(_0x9cf5('0x15'));var utils=require(_0x9cf5('0x16'));var config=require(_0x9cf5('0x17'));var db=require(_0x9cf5('0x18'))['db'];config[_0x9cf5('0x19')]=_[_0x9cf5('0x1a')](config[_0x9cf5('0x19')],{'host':_0x9cf5('0x1b'),'port':0x18eb});var socket=require(_0x9cf5('0x1c'))(new Redis(config[_0x9cf5('0x19')]));require(_0x9cf5('0x1d'))[_0x9cf5('0x1e')](socket);var jayson=require(_0x9cf5('0x1f'));var client=jayson[_0x9cf5('0x20')][_0x9cf5('0x21')]({'port':0x232c});var client9002=jayson[_0x9cf5('0x20')][_0x9cf5('0x21')]({'port':0x232a});function checkPasswordPattern(_0x45e869,_0x5f420b,_0x40059f){if(_0x40059f){var _0x54d674=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54d674['test'](_0x5f420b)){return _0x45e869;}else{throw new db[(_0x9cf5('0x22'))][(_0x9cf5('0x23'))](_0x9cf5('0x24'));}}else{return _0x45e869;}}function respondWithRpcPromise(_0x37f18f,_0xb6d853,_0x58e76a,_0x57a5fc){return new BPromise(function(_0x65bdce,_0x27bd59){var _0x2ea5c0=_0x57a5fc||client;return _0x2ea5c0[_0x9cf5('0x25')](_0x37f18f,_0x58e76a)[_0x9cf5('0x26')](function(_0x48c4a9){logger[_0x9cf5('0x27')](_0x9cf5('0x28'),_0xb6d853,_0x9cf5('0x29'));logger[_0x9cf5('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xb6d853,'request\x20sent',JSON['stringify'](_0x48c4a9));if(_0x48c4a9[_0x9cf5('0x2b')]){if(_0x48c4a9[_0x9cf5('0x2b')][_0x9cf5('0x2c')]===0x1f4){logger[_0x9cf5('0x2b')](_0x9cf5('0x28'),_0xb6d853,_0x48c4a9[_0x9cf5('0x2b')][_0x9cf5('0x2d')]);return _0x27bd59(_0x48c4a9[_0x9cf5('0x2b')]['message']);}logger[_0x9cf5('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0xb6d853,_0x48c4a9[_0x9cf5('0x2b')][_0x9cf5('0x2d')]);return _0x65bdce(_0x48c4a9['error'][_0x9cf5('0x2d')]);}else{logger[_0x9cf5('0x27')](_0x9cf5('0x28'),_0xb6d853,_0x9cf5('0x29'));_0x65bdce(_0x48c4a9[_0x9cf5('0x2e')][_0x9cf5('0x2d')]);}})['catch'](function(_0x2a2135){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xb6d853,_0x2a2135);_0x27bd59(_0x2a2135);});});}function respondWithStatusCode(_0x1e871d,_0x5d8700){_0x5d8700=_0x5d8700||0xcc;return function(_0x566a88){if(_0x566a88){return _0x1e871d['sendStatus'](_0x5d8700);}return _0x1e871d[_0x9cf5('0x2f')](_0x5d8700)['end']();};}function respondWithResult(_0x450985,_0x1a16d2){_0x1a16d2=_0x1a16d2||0xc8;return function(_0x67f9f4){if(_0x67f9f4){return _0x450985[_0x9cf5('0x2f')](_0x1a16d2)[_0x9cf5('0x30')](_0x67f9f4);}};}function respondWithFilteredResult(_0x3dbaea,_0x42c4a6){return function(_0x8216e1){if(_0x8216e1){var _0x1a7e35=_0x8216e1[_0x9cf5('0x31')],_0x265459=_0x42c4a6[_0x9cf5('0x32')],_0xef4f5=_0x42c4a6[_0x9cf5('0x32')]+_0x42c4a6[_0x9cf5('0x33')],_0x2e0f75;if(_0xef4f5>=_0x1a7e35){_0xef4f5=_0x1a7e35;_0x2e0f75=0xc8;}else{_0x2e0f75=0xce;}_0x3dbaea['status'](_0x2e0f75);return _0x3dbaea[_0x9cf5('0x34')](_0x9cf5('0x35'),_0x265459+'-'+_0xef4f5+'/'+_0x1a7e35)['json'](_0x8216e1);}return null;};}function patchUpdates(_0x1e89b5){return function(_0x2ff47b){try{jsonpatch[_0x9cf5('0x36')](_0x2ff47b,_0x1e89b5,!![]);}catch(_0x29aeec){return BPromise['reject'](_0x29aeec);}return _0x2ff47b[_0x9cf5('0x37')]();};}function saveUpdates(_0x22b7ca,_0x2e6afc){return function(_0x3829c8){if(_0x3829c8){return _0x3829c8[_0x9cf5('0x38')](_0x22b7ca)['then'](function(_0x53f43c){return _0x53f43c;});}return null;};}function removeEntity(_0x10584e,_0x4a5fb2){return function(_0x238caa){if(_0x238caa){return _0x238caa[_0x9cf5('0x39')]()[_0x9cf5('0x26')](function(){_0x10584e[_0x9cf5('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16d6ce,_0x44b022){return function(_0x2c62b6){if(!_0x2c62b6){_0x16d6ce[_0x9cf5('0x3a')](0x194);}return _0x2c62b6;};}function handleError(_0x298326,_0x32c86c){_0x32c86c=_0x32c86c||0x1f4;return function(_0x167446){logger['error'](_0x167446['stack']);if(_0x167446[_0x9cf5('0x3b')]){delete _0x167446[_0x9cf5('0x3b')];}_0x298326[_0x9cf5('0x2f')](_0x32c86c)[_0x9cf5('0x3c')](_0x167446);};}exports['index']=function(_0x24f178,_0x2e084c){var _0x49cb5f={},_0x1a77e1={},_0x568a37={'count':0x0,'rows':[]};var _0x2a07f4=_[_0x9cf5('0x3d')](db[_0x9cf5('0x3e')][_0x9cf5('0x3f')],function(_0x5743ca){return{'name':_0x5743ca[_0x9cf5('0x40')],'type':_0x5743ca[_0x9cf5('0x41')][_0x9cf5('0x42')]};});_0x1a77e1['model']=_[_0x9cf5('0x3d')](_0x2a07f4,_0x9cf5('0x3b'));_0x1a77e1[_0x9cf5('0x43')]=_[_0x9cf5('0x44')](_0x24f178[_0x9cf5('0x43')]);_0x1a77e1[_0x9cf5('0x45')]=_[_0x9cf5('0x46')](_0x1a77e1['model'],_0x1a77e1['query']);_0x49cb5f['attributes']=_['intersection'](_0x1a77e1[_0x9cf5('0x47')],qs[_0x9cf5('0x48')](_0x24f178[_0x9cf5('0x43')][_0x9cf5('0x48')]));_0x49cb5f[_0x9cf5('0x49')]=_0x49cb5f[_0x9cf5('0x49')][_0x9cf5('0x4a')]?_0x49cb5f[_0x9cf5('0x49')]:_0x1a77e1[_0x9cf5('0x47')];if(!_0x24f178[_0x9cf5('0x43')]['hasOwnProperty'](_0x9cf5('0x4b'))){_0x49cb5f[_0x9cf5('0x33')]=qs[_0x9cf5('0x33')](_0x24f178[_0x9cf5('0x43')][_0x9cf5('0x33')]);_0x49cb5f['offset']=qs['offset'](_0x24f178[_0x9cf5('0x43')][_0x9cf5('0x32')]);}_0x49cb5f['order']=qs[_0x9cf5('0x4c')](_0x24f178[_0x9cf5('0x43')][_0x9cf5('0x4c')]);_0x49cb5f['where']=qs[_0x9cf5('0x45')](_['pick'](_0x24f178['query'],_0x1a77e1['filters']),_0x2a07f4);if(_0x24f178[_0x9cf5('0x43')]['filter']){_0x49cb5f['where']=_[_0x9cf5('0x4d')](_0x49cb5f['where'],{'$or':_[_0x9cf5('0x3d')](_0x2a07f4,function(_0xcc8d4c){if(_0xcc8d4c['type']!==_0x9cf5('0x4e')){var _0x6cd745={};_0x6cd745[_0xcc8d4c[_0x9cf5('0x3b')]]={'$like':'%'+_0x24f178['query'][_0x9cf5('0x4f')]+'%'};return _0x6cd745;}})});}_0x49cb5f=_[_0x9cf5('0x4d')]({},_0x49cb5f,_0x24f178['options']);var _0x3fa409={'where':_0x49cb5f['where']};return db[_0x9cf5('0x3e')][_0x9cf5('0x31')](_0x3fa409)[_0x9cf5('0x26')](function(_0x1522be){_0x568a37['count']=_0x1522be;if(_0x24f178[_0x9cf5('0x43')][_0x9cf5('0x50')]){_0x49cb5f['include']=[{'all':!![]}];}return db[_0x9cf5('0x3e')][_0x9cf5('0x51')](_0x49cb5f);})[_0x9cf5('0x26')](function(_0x177736){_0x568a37['rows']=_0x177736;return _0x568a37;})[_0x9cf5('0x26')](respondWithFilteredResult(_0x2e084c,_0x49cb5f))[_0x9cf5('0x52')](handleError(_0x2e084c,null));};exports[_0x9cf5('0x53')]=function(_0x5426a0,_0x3c11ad){var _0x31c81a={'raw':!![],'where':{'id':_0x5426a0[_0x9cf5('0x54')]['id']}},_0x39610e={};_0x39610e[_0x9cf5('0x47')]=_[_0x9cf5('0x44')](db[_0x9cf5('0x3e')]['rawAttributes']);_0x39610e[_0x9cf5('0x43')]=_[_0x9cf5('0x44')](_0x5426a0['query']);_0x39610e[_0x9cf5('0x45')]=_[_0x9cf5('0x46')](_0x39610e[_0x9cf5('0x47')],_0x39610e[_0x9cf5('0x43')]);_0x31c81a['attributes']=_[_0x9cf5('0x46')](_0x39610e[_0x9cf5('0x47')],qs[_0x9cf5('0x48')](_0x5426a0['query'][_0x9cf5('0x48')]));_0x31c81a[_0x9cf5('0x49')]=_0x31c81a[_0x9cf5('0x49')][_0x9cf5('0x4a')]?_0x31c81a[_0x9cf5('0x49')]:_0x39610e[_0x9cf5('0x47')];if(_0x5426a0[_0x9cf5('0x43')]['includeAll']){_0x31c81a[_0x9cf5('0x55')]=[{'all':!![]}];}_0x31c81a=_[_0x9cf5('0x4d')]({},_0x31c81a,_0x5426a0[_0x9cf5('0x56')]);return db['WhatsappMessage'][_0x9cf5('0x57')](_0x31c81a)['then'](handleEntityNotFound(_0x3c11ad,null))[_0x9cf5('0x26')](respondWithResult(_0x3c11ad,null))[_0x9cf5('0x52')](handleError(_0x3c11ad,null));};exports[_0x9cf5('0x58')]=function(_0x558b55,_0x1b2b15){return db[_0x9cf5('0x3e')][_0x9cf5('0x58')](_0x558b55[_0x9cf5('0x59')],{})[_0x9cf5('0x26')](respondWithResult(_0x1b2b15,0xc9))[_0x9cf5('0x52')](handleError(_0x1b2b15,null));};exports[_0x9cf5('0x38')]=function(_0x25ac78,_0x1891e3){if(_0x25ac78[_0x9cf5('0x59')]['id']){delete _0x25ac78[_0x9cf5('0x59')]['id'];}return db[_0x9cf5('0x3e')][_0x9cf5('0x57')]({'where':{'id':_0x25ac78[_0x9cf5('0x54')]['id']}})[_0x9cf5('0x26')](handleEntityNotFound(_0x1891e3,null))['then'](saveUpdates(_0x25ac78[_0x9cf5('0x59')],null))['then'](respondWithResult(_0x1891e3,null))['catch'](handleError(_0x1891e3,null));};exports[_0x9cf5('0x39')]=function(_0x1bf6a9,_0x4dab63){return db[_0x9cf5('0x3e')][_0x9cf5('0x57')]({'where':{'id':_0x1bf6a9[_0x9cf5('0x54')]['id']}})['then'](handleEntityNotFound(_0x4dab63,null))[_0x9cf5('0x26')](removeEntity(_0x4dab63,null))['catch'](handleError(_0x4dab63,null));};exports['describe']=function(_0xa1ffe6,_0x572633){return db['WhatsappMessage'][_0x9cf5('0x5a')]()[_0x9cf5('0x26')](respondWithResult(_0x572633,null))['catch'](handleError(_0x572633,null));};var interaction_log=require(_0x9cf5('0x14'))('whatsapp-interactions');exports[_0x9cf5('0x5b')]=function(_0xd4db54,_0xef58cc,_0x35e1ab){var _0x567aa6={'channel':_0x9cf5('0x5c')};if(_0xd4db54[_0x9cf5('0x59')]['id']){delete _0xd4db54[_0x9cf5('0x59')]['id'];}_0xd4db54[_0x9cf5('0x59')][_0x9cf5('0x5d')]=!![];_0xd4db54['body'][_0x9cf5('0x5e')]=moment()[_0x9cf5('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0xd4db54[_0x9cf5('0x59')][_0x9cf5('0x60')]=_0xd4db54[_0x9cf5('0x59')][_0x9cf5('0x60')]||_0xd4db54['user']['id'];return db[_0x9cf5('0x3e')][_0x9cf5('0x57')]({'where':{'id':_0xd4db54[_0x9cf5('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x9cf5('0x61')],'as':'Contact'}]})['then'](handleEntityNotFound(_0xef58cc,null))['then'](saveUpdates(_0xd4db54[_0x9cf5('0x59')],null))[_0x9cf5('0x26')](function(_0x3e35ca){if(_0x3e35ca){_0x567aa6[_0x9cf5('0x2d')]=_0x3e35ca[_0x9cf5('0x62')]({'plain':!![]});return db['WhatsappInteraction'][_0x9cf5('0x57')]({'where':{'id':_0x3e35ca[_0x9cf5('0x63')]}});}return null;})['then'](handleEntityNotFound(_0xef58cc,null))['then'](function(_0xba330b){if(_0xba330b){return _0xba330b[_0x9cf5('0x38')]({'UserId':_0xd4db54['body']['UserId'],'read1stAt':_['isNil'](_0xba330b[_0x9cf5('0x64')])?moment()[_0x9cf5('0x5f')](_0x9cf5('0x65')):undefined});}return null;})['then'](function(_0x1c21f7){if(_0x1c21f7){_0x567aa6['interaction']=_0x1c21f7['get']({'plain':!![]});interaction_log['info'](_0x9cf5('0x66'),_0xd4db54[_0x9cf5('0x67')]['id'],_0xd4db54[_0x9cf5('0x67')][_0x9cf5('0x3b')],_0xd4db54[_0x9cf5('0x67')]['role'],_0x567aa6[_0x9cf5('0x68')]['id'],_0xd4db54['body']?JSON[_0x9cf5('0x69')](_0xd4db54[_0x9cf5('0x59')]):_0x9cf5('0x6a'));return respondWithRpcPromise(_0x9cf5('0x6b'),_0x9cf5('0x6c'),_0x567aa6);}return null;})[_0x9cf5('0x26')](function(_0x5f45b7){if(_0x5f45b7){if(_0xd4db54['body']['manual']){_0x567aa6['message'][_0x9cf5('0x6d')]=util[_0x9cf5('0x5f')](_0x9cf5('0x6e'),_0xd4db54['user']['name']);_0x567aa6['message'][_0x9cf5('0x6f')]=_0x567aa6['channel'];_0x567aa6[_0x9cf5('0x2d')][_0x9cf5('0x70')]='accept';return respondWithRpcPromise(_0x9cf5('0x71'),_0x9cf5('0x71'),{'event':_0x9cf5('0x72'),'message':_0x567aa6[_0x9cf5('0x2d')]},client9002)[_0x9cf5('0x26')](function(){return _0x567aa6;});}return _0x567aa6;}return null;})[_0x9cf5('0x26')](respondWithResult(_0xef58cc,null))[_0x9cf5('0x52')](handleError(_0xef58cc,null));};var interaction_log=require(_0x9cf5('0x14'))('whatsapp-interactions');exports[_0x9cf5('0x73')]=function(_0x30ebe2,_0x562341,_0x1415e2){var _0x363f45={'agent':{},'channel':_0x9cf5('0x5c')};if(_0x30ebe2[_0x9cf5('0x59')]['id']){delete _0x30ebe2['body']['id'];}_0x30ebe2['body']['UserId']=_0x30ebe2[_0x9cf5('0x59')][_0x9cf5('0x60')]||_0x30ebe2[_0x9cf5('0x67')]['id'];_0x363f45['agent']['id']=_0x30ebe2['body'][_0x9cf5('0x60')];return db[_0x9cf5('0x3e')]['find']({'where':{'id':_0x30ebe2[_0x9cf5('0x54')]['id'],'UserId':null}})[_0x9cf5('0x26')](handleEntityNotFound(_0x562341,null))['then'](function(_0x22033c){if(_0x22033c){_0x363f45['message']=_0x22033c[_0x9cf5('0x62')]({'plain':!![]});return db[_0x9cf5('0x74')][_0x9cf5('0x57')]({'where':{'id':_0x22033c['WhatsappInteractionId']}});}return null;})[_0x9cf5('0x26')](handleEntityNotFound(_0x562341,null))[_0x9cf5('0x26')](function(_0x5c9274){if(_0x5c9274){_0x363f45[_0x9cf5('0x68')]=_0x5c9274[_0x9cf5('0x62')]({'plain':!![]});interaction_log[_0x9cf5('0x27')](_0x9cf5('0x75'),_0x30ebe2[_0x9cf5('0x67')]['id'],_0x30ebe2[_0x9cf5('0x67')]['name'],_0x30ebe2[_0x9cf5('0x67')]['role'],_0x363f45['interaction']['id'],_0x30ebe2['body']?JSON['stringify'](_0x30ebe2[_0x9cf5('0x59')]):_0x9cf5('0x6a'));return respondWithRpcPromise('RejectMessage',_0x9cf5('0x76'),_0x363f45);}return null;})[_0x9cf5('0x26')](function(_0x28709f){if(_0x28709f){_0x28709f[_0x9cf5('0x2d')][_0x9cf5('0x6d')]=util[_0x9cf5('0x5f')]('SIP/%s',_0x30ebe2['user'][_0x9cf5('0x3b')]);_0x28709f[_0x9cf5('0x2d')][_0x9cf5('0x6f')]=_0x363f45['channel'];_0x28709f['message'][_0x9cf5('0x70')]=_0x9cf5('0x73');respondWithRpcPromise(_0x9cf5('0x71'),_0x9cf5('0x71'),{'event':_0x9cf5('0x77'),'message':_0x28709f[_0x9cf5('0x2d')]},client9002);return _0x363f45;}return null;})[_0x9cf5('0x26')](respondWithResult(_0x562341,null))[_0x9cf5('0x52')](handleError(_0x562341,null));};exports[_0x9cf5('0x2f')]=function(_0x3e307c,_0x250f0a,_0x3e5689){if(_0x3e307c['body']['id']){delete _0x3e307c['body']['id'];}var _0x4c8b73;return db[_0x9cf5('0x3e')][_0x9cf5('0x57')]({'where':{'id':_0x3e307c[_0x9cf5('0x54')]['id']}})['then'](handleEntityNotFound(_0x250f0a,null))[_0x9cf5('0x26')](function(_0x34cbee){if(_0x34cbee){_0x4c8b73=_0x34cbee;return db[_0x9cf5('0x78')]['find']({'where':{'id':_0x34cbee['WhatsappAccountId']}});}})[_0x9cf5('0x26')](handleEntityNotFound(_0x250f0a,null))[_0x9cf5('0x26')](function(_0x3e4533){if(_0x3e4533){logger[_0x9cf5('0x2a')](_0x9cf5('0x79'),_0x9cf5('0x2f'),_0x9cf5('0x7a'),_0x3e4533['type'],util[_0x9cf5('0x7b')](_0x3e307c[_0x9cf5('0x59')],{'showHidden':![],'depth':null}));switch(_0x3e4533[_0x9cf5('0x41')]){case'twilio':if(_0x3e307c[_0x9cf5('0x59')]['MessageSid']&&_0x3e307c['body']['MessageSid']===_0x4c8b73[_0x9cf5('0x7c')]&&_0x3e307c[_0x9cf5('0x59')][_0x9cf5('0x7d')]&&_0x3e307c[_0x9cf5('0x59')][_0x9cf5('0x7d')]===_0x9cf5('0x5d')){return _0x4c8b73['update']({'read':!![]});}else{logger[_0x9cf5('0x2b')](_0x9cf5('0x7e'),'status',_0x9cf5('0x7f'),util[_0x9cf5('0x7b')](_0x3e307c['body'],{'showHidden':![],'depth':null}));}break;}return _0x4c8b73;}})[_0x9cf5('0x26')](respondWithResult(_0x250f0a,null))[_0x9cf5('0x52')](handleError(_0x250f0a,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9de1763..e2d579f 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x337c32,_0x187622){var _0x4bfb68=function(_0x2260bc){while(--_0x2260bc){_0x337c32['push'](_0x337c32['shift']());}};_0x4bfb68(++_0x187622);}(_0xb10b,0x12a));var _0xbb10=function(_0x124c75,_0x332013){_0x124c75=_0x124c75-0x0;var _0x5c5471=_0xb10b[_0x124c75];return _0x5c5471;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x297581,_0x5f3639){var _0x588d68=function(_0x5a056d){while(--_0x5a056d){_0x297581['push'](_0x297581['shift']());}};_0x588d68(++_0x5f3639);}(_0xb10b,0x12a));var _0xbb10=function(_0x56d1ed,_0x237e84){_0x56d1ed=_0x56d1ed-0x0;var _0x1b282b=_0xb10b[_0x56d1ed];return _0x1b282b;};'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 d5a1952..1accaa7 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 _0xab40=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','secret','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/status?token=','token','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x515ae2,_0x4a753d){var _0x505483=function(_0x16b7ff){while(--_0x16b7ff){_0x515ae2['push'](_0x515ae2['shift']());}};_0x505483(++_0x4a753d);}(_0xab40,0x117));var _0x0ab4=function(_0x28ce2a,_0xc2eea9){_0x28ce2a=_0x28ce2a-0x0;var _0x184e58=_0xab40[_0x28ce2a];return _0x184e58;};'use strict';var _=require('lodash');var util=require(_0x0ab4('0x0'));var logger=require(_0x0ab4('0x1'))(_0x0ab4('0x2'));var moment=require(_0x0ab4('0x3'));var BPromise=require(_0x0ab4('0x4'));var rp=require(_0x0ab4('0x5'));var fs=require('fs');var path=require(_0x0ab4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x0ab4('0x7')]=function(_0x5629d9,_0x36d6fb){return _0x5629d9[_0x0ab4('0x8')](_0x0ab4('0x9'),attributes,{'tableName':_0x0ab4('0xa'),'paranoid':![],'indexes':[{'name':_0x0ab4('0xb'),'fields':[_0x0ab4('0xb')]},{'name':_0x0ab4('0xc'),'fields':[_0x0ab4('0xd')],'type':_0x0ab4('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x250ba3,_0x72d7ac,_0x3265fa){var _0x1a8efa=_0x5629d9[_0x0ab4('0xf')];var _0x3eba6d=_0x250ba3[_0x0ab4('0x10')]({'plain':!![]});if(_0x3eba6d[_0x0ab4('0x11')]['toLowerCase']()==='in'||_0x3eba6d[_0x0ab4('0x11')][_0x0ab4('0x12')]()===_0x0ab4('0x13')&&!_0x3eba6d['secret']&&!_[_0x0ab4('0x14')](_0x3eba6d['UserId'])){_0x1a8efa[_0x0ab4('0x15')][_0x0ab4('0x16')]({'where':{'id':_0x3eba6d[_0x0ab4('0x17')]}})[_0x0ab4('0x18')](function(_0xce6bb1){if(_0xce6bb1){_0xce6bb1['update']({'lastMsgAt':_0x3eba6d[_0x0ab4('0x19')],'lastMsgDirection':_0x3eba6d['direction'][_0x0ab4('0x12')]()});}})[_0x0ab4('0x1a')](function(_0x1a03d0){console[_0x0ab4('0x1b')](_0x1a03d0);});}if(_0x3eba6d[_0x0ab4('0x11')]===_0x0ab4('0x13')&&!_0x3eba6d[_0x0ab4('0x1c')]){var _0x521503;_0x1a8efa['WhatsappAccount']['find']({'where':{'id':_0x3eba6d[_0x0ab4('0x1d')]},'raw':!![]})['then'](function(_0x13def2){_0x521503=_0x13def2;if(_0x521503&&_0x521503[_0x0ab4('0x1e')]){switch(_0x521503[_0x0ab4('0x1e')]){case _0x0ab4('0x1f'):var _0x29ce6e=require(_0x0ab4('0x1f'));if(_0x521503[_0x0ab4('0x20')]&&_0x521503[_0x0ab4('0x21')]&&_0x521503['phone']){var _0x273a93=new _0x29ce6e(_0x521503[_0x0ab4('0x20')],_0x521503['authToken']);_0x273a93[_0x0ab4('0x22')][_0x0ab4('0x23')]({'body':_0x3eba6d[_0x0ab4('0xd')],'to':_0x0ab4('0x24')+_0x3eba6d[_0x0ab4('0x25')],'from':_0x0ab4('0x24')+_0x521503[_0x0ab4('0x25')],'statusCallback':_0x521503[_0x0ab4('0x26')]+'/api/whatsapp/messages/'+_0x3eba6d['id']+_0x0ab4('0x27')+_0x521503[_0x0ab4('0x28')]})[_0x0ab4('0x18')](function(_0x2a10d5){if(_0x2a10d5['sid']){return _0x250ba3['update']({'messageId':_0x2a10d5['sid']});}})['catch'](function(_0x5c7483){logger[_0x0ab4('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x0ab4('0x29'),'twilio',util['inspect'](_0x5c7483,{'showHidden':![],'depth':null}));});}else{logger[_0x0ab4('0x1b')](_0x0ab4('0x2a'),_0x0ab4('0x29'),_0x0ab4('0x1f'),_0x0ab4('0x2b'));}break;}}})[_0x0ab4('0x2c')](function(){_0x3265fa();});}else{_0x3265fa();}}},'charset':'utf8mb4','collate':_0x0ab4('0x2d')});}; \ No newline at end of file +var _0x74c1=['whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x74c1,0x1d7));var _0x174c=function(_0xa4703,_0x49c036){_0xa4703=_0xa4703-0x0;var _0x1ff1cb=_0x74c1[_0xa4703];return _0x1ff1cb;};'use strict';var _=require(_0x174c('0x0'));var util=require(_0x174c('0x1'));var logger=require(_0x174c('0x2'))('api');var moment=require(_0x174c('0x3'));var BPromise=require(_0x174c('0x4'));var rp=require(_0x174c('0x5'));var fs=require('fs');var path=require(_0x174c('0x6'));var rimraf=require(_0x174c('0x7'));var config=require(_0x174c('0x8'));var attributes=require(_0x174c('0x9'));module[_0x174c('0xa')]=function(_0x4d525a,_0x443eef){return _0x4d525a[_0x174c('0xb')]('WhatsappMessage',attributes,{'tableName':_0x174c('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x174c('0xd')]},{'name':_0x174c('0xe'),'fields':[_0x174c('0xf')],'type':_0x174c('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4bf68e,_0x26f5db,_0x264e07){var _0x578dcf=_0x4d525a['models'];var _0x1c8799=_0x4bf68e[_0x174c('0x11')]({'plain':!![]});if(_0x1c8799[_0x174c('0x12')]['toLowerCase']()==='in'||_0x1c8799[_0x174c('0x12')][_0x174c('0x13')]()===_0x174c('0x14')&&!_0x1c8799[_0x174c('0x15')]&&!_[_0x174c('0x16')](_0x1c8799[_0x174c('0x17')])){_0x578dcf['WhatsappInteraction']['findOne']({'where':{'id':_0x1c8799[_0x174c('0x18')]}})[_0x174c('0x19')](function(_0x3b1ad5){if(_0x3b1ad5){_0x3b1ad5[_0x174c('0x1a')]({'lastMsgAt':_0x1c8799[_0x174c('0x1b')],'lastMsgDirection':_0x1c8799[_0x174c('0x12')]['toLowerCase']()});}})[_0x174c('0x1c')](function(_0xdb0524){console[_0x174c('0x1d')](_0xdb0524);});}if(_0x1c8799['direction']===_0x174c('0x14')&&!_0x1c8799[_0x174c('0x15')]){var _0x179f02;_0x578dcf[_0x174c('0x1e')][_0x174c('0x1f')]({'where':{'id':_0x1c8799['WhatsappAccountId']},'raw':!![]})[_0x174c('0x19')](function(_0x2ab546){_0x179f02=_0x2ab546;if(_0x179f02&&_0x179f02[_0x174c('0x20')]){switch(_0x179f02['type']){case _0x174c('0x21'):var _0x1aac10=require(_0x174c('0x21'));if(_0x179f02[_0x174c('0x22')]&&_0x179f02[_0x174c('0x23')]&&_0x179f02[_0x174c('0x24')]){var _0x2dbf27=new _0x1aac10(_0x179f02[_0x174c('0x22')],_0x179f02[_0x174c('0x23')]);_0x2dbf27[_0x174c('0x25')][_0x174c('0x26')]({'body':_0x1c8799[_0x174c('0xf')],'to':'whatsapp:'+_0x1c8799['phone'],'from':_0x174c('0x27')+_0x179f02[_0x174c('0x24')],'statusCallback':_0x179f02[_0x174c('0x28')]+_0x174c('0x29')+_0x1c8799['id']+_0x174c('0x2a')+_0x179f02[_0x174c('0x2b')]})['then'](function(_0x563831){if(_0x563831['sid']){return _0x4bf68e[_0x174c('0x1a')]({'messageId':_0x563831[_0x174c('0x2c')]});}})[_0x174c('0x1c')](function(_0x5ba43e){logger[_0x174c('0x1d')](_0x174c('0x2d'),'afterCreate',_0x174c('0x21'),util['inspect'](_0x5ba43e,{'showHidden':![],'depth':null}));});}else{logger[_0x174c('0x1d')](_0x174c('0x2d'),_0x174c('0x2e'),'twilio',_0x174c('0x2f'));}break;}}})[_0x174c('0x30')](function(){_0x264e07();});}else{_0x264e07();}}},'charset':_0x174c('0x31'),'collate':_0x174c('0x32')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 57fbde8..c1bf480 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 _0x1963=['error','code','message','request\x20sent','result','catch','WhatsappMessage','create','body','options','raw','debug','CreateWhatsappMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1dcdc1,_0x2fdd77){var _0x24a48c=function(_0x165b28){while(--_0x165b28){_0x1dcdc1['push'](_0x1dcdc1['shift']());}};_0x24a48c(++_0x2fdd77);}(_0x1963,0xa3));var _0x3196=function(_0x1ee0b8,_0x4ff871){_0x1ee0b8=_0x1ee0b8-0x0;var _0x5c36d2=_0x1963[_0x1ee0b8];return _0x5c36d2;};'use strict';var _=require(_0x3196('0x0'));var util=require(_0x3196('0x1'));var moment=require(_0x3196('0x2'));var BPromise=require('bluebird');var rs=require(_0x3196('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3196('0x4'))['db'];var utils=require(_0x3196('0x5'));var logger=require('../../config/logger')(_0x3196('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3196('0x7')]({'port':0x232a});config[_0x3196('0x8')]=_['defaults'](config['redis'],{'host':_0x3196('0x9'),'port':0x18eb});var socket=require(_0x3196('0xa'))(new Redis(config[_0x3196('0x8')]));require(_0x3196('0xb'))['register'](socket);function respondWithRpcPromise(_0x1a1554,_0x1470c4,_0x752f37){return new BPromise(function(_0x3a8bcc,_0x52b78f){return client['request'](_0x1a1554,_0x752f37)[_0x3196('0xc')](function(_0x578724){logger[_0x3196('0xd')](_0x3196('0xe'),_0x1470c4,'request\x20sent');logger['debug'](_0x3196('0xf'),_0x1470c4,'request\x20sent',JSON[_0x3196('0x10')](_0x578724));if(_0x578724[_0x3196('0x11')]){if(_0x578724[_0x3196('0x11')][_0x3196('0x12')]===0x1f4){logger[_0x3196('0x11')](_0x3196('0xe'),_0x1470c4,_0x578724[_0x3196('0x11')][_0x3196('0x13')]);return _0x52b78f(_0x578724[_0x3196('0x11')][_0x3196('0x13')]);}logger[_0x3196('0x11')](_0x3196('0xe'),_0x1470c4,_0x578724[_0x3196('0x11')][_0x3196('0x13')]);return _0x3a8bcc(_0x578724[_0x3196('0x11')][_0x3196('0x13')]);}else{logger[_0x3196('0xd')]('WhatsappMessage,\x20%s,\x20%s',_0x1470c4,_0x3196('0x14'));_0x3a8bcc(_0x578724[_0x3196('0x15')][_0x3196('0x13')]);}})[_0x3196('0x16')](function(_0x3fc54b){logger[_0x3196('0x11')](_0x3196('0xe'),_0x1470c4,_0x3fc54b);_0x52b78f(_0x3fc54b);});});}exports['CreateWhatsappMessage']=function(_0x16c614){var _0x4d7874=this;return new Promise(function(_0x1915e8,_0x5542cd){return db[_0x3196('0x17')][_0x3196('0x18')](_0x16c614[_0x3196('0x19')],{'raw':_0x16c614['options']?_0x16c614[_0x3196('0x1a')][_0x3196('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1045c6){logger[_0x3196('0xd')]('CreateWhatsappMessage',_0x16c614);logger[_0x3196('0x1c')](_0x3196('0x1d'),_0x16c614,JSON['stringify'](_0x1045c6));_0x1915e8(_0x1045c6);})[_0x3196('0x16')](function(_0x42a545){logger['error'](_0x3196('0x1d'),_0x42a545[_0x3196('0x13')],_0x16c614);_0x5542cd(_0x4d7874['error'](0x1f4,_0x42a545['message']));});});}; \ No newline at end of file +var _0x90d2=['create','body','options','then','debug','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','request\x20sent','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage'];(function(_0x2b82af,_0x46cbe4){var _0xbd1ca=function(_0x16be25){while(--_0x16be25){_0x2b82af['push'](_0x2b82af['shift']());}};_0xbd1ca(++_0x46cbe4);}(_0x90d2,0x185));var _0x290d=function(_0x335eca,_0x23bee1){_0x335eca=_0x335eca-0x0;var _0x4a9e78=_0x90d2[_0x335eca];return _0x4a9e78;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x290d('0x0'));var BPromise=require(_0x290d('0x1'));var rs=require(_0x290d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x290d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x290d('0x4'))(_0x290d('0x5'));var config=require(_0x290d('0x6'));var jayson=require(_0x290d('0x7'));var client=jayson[_0x290d('0x8')][_0x290d('0x9')]({'port':0x232a});config[_0x290d('0xa')]=_[_0x290d('0xb')](config[_0x290d('0xa')],{'host':_0x290d('0xc'),'port':0x18eb});var socket=require(_0x290d('0xd'))(new Redis(config[_0x290d('0xa')]));require(_0x290d('0xe'))[_0x290d('0xf')](socket);function respondWithRpcPromise(_0x5d596e,_0x53cc6e,_0x3a2a60){return new BPromise(function(_0x6d6ae8,_0x47bdb0){return client[_0x290d('0x10')](_0x5d596e,_0x3a2a60)['then'](function(_0x4848bb){logger[_0x290d('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x53cc6e,_0x290d('0x12'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x53cc6e,_0x290d('0x12'),JSON[_0x290d('0x13')](_0x4848bb));if(_0x4848bb[_0x290d('0x14')]){if(_0x4848bb[_0x290d('0x14')]['code']===0x1f4){logger[_0x290d('0x14')](_0x290d('0x15'),_0x53cc6e,_0x4848bb[_0x290d('0x14')]['message']);return _0x47bdb0(_0x4848bb[_0x290d('0x14')]['message']);}logger[_0x290d('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x53cc6e,_0x4848bb['error'][_0x290d('0x16')]);return _0x6d6ae8(_0x4848bb['error'][_0x290d('0x16')]);}else{logger[_0x290d('0x11')](_0x290d('0x15'),_0x53cc6e,'request\x20sent');_0x6d6ae8(_0x4848bb[_0x290d('0x17')][_0x290d('0x16')]);}})[_0x290d('0x18')](function(_0xeee984){logger[_0x290d('0x14')](_0x290d('0x15'),_0x53cc6e,_0xeee984);_0x47bdb0(_0xeee984);});});}exports[_0x290d('0x19')]=function(_0x4f2985){var _0x540045=this;return new Promise(function(_0xf6c4dc,_0x254979){return db[_0x290d('0x1a')][_0x290d('0x1b')](_0x4f2985[_0x290d('0x1c')],{'raw':_0x4f2985[_0x290d('0x1d')]?_0x4f2985[_0x290d('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x290d('0x1e')](function(_0x2a084a){logger[_0x290d('0x11')](_0x290d('0x19'),_0x4f2985);logger[_0x290d('0x1f')](_0x290d('0x19'),_0x4f2985,JSON[_0x290d('0x13')](_0x2a084a));_0xf6c4dc(_0x2a084a);})['catch'](function(_0x4dc9c4){logger[_0x290d('0x14')](_0x290d('0x19'),_0x4dc9c4[_0x290d('0x16')],_0x4f2985);_0x254979(_0x540045[_0x290d('0x14')](0x1f4,_0x4dc9c4[_0x290d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3f3e436..1656d5a 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 _0x360f=['save','remove','removeListener'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x360f,0x132));var _0xf360=function(_0x1603ff,_0x3ea2f2){_0x1603ff=_0x1603ff-0x0;var _0x3e8552=_0x360f[_0x1603ff];return _0x3e8552;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xf360('0x0'),_0xf360('0x1'),'update'];function createListener(_0x1fa846,_0x41f0a6){return function(_0x4f1a1d){_0x41f0a6['emit'](_0x1fa846,_0x4f1a1d);};}function removeListener(_0x37e0ec,_0x3512cb){return function(){WhatsappMessageEvents[_0xf360('0x2')](_0x37e0ec,_0x3512cb);};}exports['register']=function(_0x28b772){for(var _0x3a4f24=0x0,_0x263752=events['length'];_0x3a4f24<_0x263752;_0x3a4f24++){var _0x3d9e36=events[_0x3a4f24];var _0x5eadb0=createListener('whatsappMessage:'+_0x3d9e36,_0x28b772);WhatsappMessageEvents['on'](_0x3d9e36,_0x5eadb0);}}; \ No newline at end of file +var _0xa110=['whatsappMessage:','./whatsappMessage.events','save','update','emit','removeListener','register','length'];(function(_0xd37b38,_0x13d1c3){var _0x1f29c5=function(_0x21036c){while(--_0x21036c){_0xd37b38['push'](_0xd37b38['shift']());}};_0x1f29c5(++_0x13d1c3);}(_0xa110,0x111));var _0x0a11=function(_0x130a56,_0x47e89d){_0x130a56=_0x130a56-0x0;var _0x47dfc9=_0xa110[_0x130a56];return _0x47dfc9;};'use strict';var WhatsappMessageEvents=require(_0x0a11('0x0'));var events=[_0x0a11('0x1'),'remove',_0x0a11('0x2')];function createListener(_0x6511fb,_0x304b11){return function(_0x2d9341){_0x304b11[_0x0a11('0x3')](_0x6511fb,_0x2d9341);};}function removeListener(_0x160bbf,_0x40098f){return function(){WhatsappMessageEvents[_0x0a11('0x4')](_0x160bbf,_0x40098f);};}exports[_0x0a11('0x5')]=function(_0x328e7a){for(var _0x141b7e=0x0,_0x2576ad=events[_0x0a11('0x6')];_0x141b7e<_0x2576ad;_0x141b7e++){var _0x5ac9f1=events[_0x141b7e];var _0x5c7ad9=createListener(_0x0a11('0x7')+_0x5ac9f1,_0x328e7a);WhatsappMessageEvents['on'](_0x5ac9f1,_0x5c7ad9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 87e2b3d..37ccb03 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 _0x32c2=['index','get','/describe','describe','show','/:id/members','getMembers','/:id/users','post','/:id/teams','addTeams','/:id','update','destroy','delete','removeTeams','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','isAuthenticated'];(function(_0x16a960,_0x105d2d){var _0x3e3549=function(_0x319e42){while(--_0x319e42){_0x16a960['push'](_0x16a960['shift']());}};_0x3e3549(++_0x105d2d);}(_0x32c2,0xad));var _0x232c=function(_0x13807b,_0x19737d){_0x13807b=_0x13807b-0x0;var _0x407013=_0x32c2[_0x13807b];return _0x407013;};'use strict';var multer=require(_0x232c('0x0'));var util=require(_0x232c('0x1'));var path=require(_0x232c('0x2'));var timeout=require('connect-timeout');var express=require(_0x232c('0x3'));var router=express[_0x232c('0x4')]();var auth=require(_0x232c('0x5'));var interaction=require(_0x232c('0x6'));var config=require('../../config/environment');var controller=require(_0x232c('0x7'));router['get']('/',auth[_0x232c('0x8')](),controller[_0x232c('0x9')]);router[_0x232c('0xa')](_0x232c('0xb'),auth[_0x232c('0x8')](),controller[_0x232c('0xc')]);router[_0x232c('0xa')]('/:id',auth[_0x232c('0x8')](),controller[_0x232c('0xd')]);router[_0x232c('0xa')](_0x232c('0xe'),auth[_0x232c('0x8')](),controller[_0x232c('0xf')]);router[_0x232c('0xa')]('/:id/teams',auth[_0x232c('0x8')](),controller['getTeams']);router[_0x232c('0xa')](_0x232c('0x10'),auth[_0x232c('0x8')](),controller['getAgents']);router[_0x232c('0x11')]('/',auth[_0x232c('0x8')](),controller['create']);router[_0x232c('0x11')](_0x232c('0x12'),auth['isAuthenticated'](),controller[_0x232c('0x13')]);router[_0x232c('0x11')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x232c('0x14'),auth[_0x232c('0x8')](),controller[_0x232c('0x15')]);router['delete'](_0x232c('0x14'),auth[_0x232c('0x8')](),controller[_0x232c('0x16')]);router[_0x232c('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0x232c('0x18')]);router[_0x232c('0x17')](_0x232c('0x10'),auth[_0x232c('0x8')](),controller[_0x232c('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa29e=['destroy','removeTeams','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','get','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','delete'];(function(_0x335d0b,_0x265021){var _0x1e8e3e=function(_0x33fd78){while(--_0x33fd78){_0x335d0b['push'](_0x335d0b['shift']());}};_0x1e8e3e(++_0x265021);}(_0xa29e,0x1f0));var _0xea29=function(_0x468837,_0x5f0a68){_0x468837=_0x468837-0x0;var _0x7c161e=_0xa29e[_0x468837];return _0x7c161e;};'use strict';var multer=require('multer');var util=require(_0xea29('0x0'));var path=require(_0xea29('0x1'));var timeout=require(_0xea29('0x2'));var express=require(_0xea29('0x3'));var router=express[_0xea29('0x4')]();var auth=require(_0xea29('0x5'));var interaction=require(_0xea29('0x6'));var config=require(_0xea29('0x7'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0xea29('0x8')](),controller[_0xea29('0x9')]);router['get'](_0xea29('0xa'),auth['isAuthenticated'](),controller[_0xea29('0xb')]);router['get'](_0xea29('0xc'),auth['isAuthenticated'](),controller[_0xea29('0xd')]);router['get'](_0xea29('0xe'),auth[_0xea29('0x8')](),controller[_0xea29('0xf')]);router[_0xea29('0x10')](_0xea29('0x11'),auth[_0xea29('0x8')](),controller[_0xea29('0x12')]);router['get'](_0xea29('0x13'),auth[_0xea29('0x8')](),controller[_0xea29('0x14')]);router[_0xea29('0x15')]('/',auth[_0xea29('0x8')](),controller['create']);router[_0xea29('0x15')]('/:id/teams',auth[_0xea29('0x8')](),controller[_0xea29('0x16')]);router[_0xea29('0x15')](_0xea29('0x13'),auth['isAuthenticated'](),controller[_0xea29('0x17')]);router[_0xea29('0x18')](_0xea29('0xc'),auth[_0xea29('0x8')](),controller['update']);router[_0xea29('0x19')](_0xea29('0xc'),auth['isAuthenticated'](),controller[_0xea29('0x1a')]);router['delete']('/:id/teams',auth[_0xea29('0x8')](),controller[_0xea29('0x1b')]);router['delete']('/:id/users',auth[_0xea29('0x8')](),controller['removeAgents']);module[_0xea29('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 9341c5c..27eeab9 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 _0xb98d=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x1c328c,_0x220530){var _0x2c79f5=function(_0x53b203){while(--_0x53b203){_0x1c328c['push'](_0x1c328c['shift']());}};_0x2c79f5(++_0x220530);}(_0xb98d,0x14f));var _0xdb98=function(_0x47139e,_0x36c2aa){_0x47139e=_0x47139e-0x0;var _0x169c3f=_0xb98d[_0x47139e];return _0x169c3f;};'use strict';var Sequelize=require(_0xdb98('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb98('0x1')],'unique':_0xdb98('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xdb98('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdb98('0x4')](_0xdb98('0x5'),_0xdb98('0x6'),_0xdb98('0x7'))},'description':{'type':Sequelize[_0xdb98('0x1')]}}; \ No newline at end of file +var _0x61a1=['beepall','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x3f5d1a,_0x33400b){var _0x2db38a=function(_0x1bd67a){while(--_0x1bd67a){_0x3f5d1a['push'](_0x3f5d1a['shift']());}};_0x2db38a(++_0x33400b);}(_0x61a1,0x121));var _0x161a=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x61a1[_0x3ceb54];return _0x26d8a6;};'use strict';var Sequelize=require(_0x161a('0x0'));module['exports']={'name':{'type':Sequelize[_0x161a('0x1')],'unique':_0x161a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x161a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x161a('0x4'),_0x161a('0x5'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index ff4fcbd..59ad226 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 _0x12b8=['each','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','get','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','options','WhatsappQueue','include','findAll','rows','catch','params','includeAll','find','create','body','user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserWhatsappQueue','sort','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','whatsappPause','getTeams','findOne','Team','nolimit','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction'];(function(_0x48cb86,_0x424ad2){var _0x3afa1f=function(_0x2a359c){while(--_0x2a359c){_0x48cb86['push'](_0x48cb86['shift']());}};_0x3afa1f(++_0x424ad2);}(_0x12b8,0x133));var _0x812b=function(_0x230bb8,_0xa1718){_0x230bb8=_0x230bb8-0x0;var _0x16cb9a=_0x12b8[_0x230bb8];return _0x16cb9a;};'use strict';var pdf=require(_0x812b('0x0'));var emlformat=require(_0x812b('0x1'));var rimraf=require(_0x812b('0x2'));var zipdir=require(_0x812b('0x3'));var jsonpatch=require(_0x812b('0x4'));var rp=require(_0x812b('0x5'));var moment=require(_0x812b('0x6'));var BPromise=require(_0x812b('0x7'));var Mustache=require(_0x812b('0x8'));var util=require(_0x812b('0x9'));var path=require(_0x812b('0xa'));var sox=require(_0x812b('0xb'));var csv=require(_0x812b('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x812b('0xd'));var crypto=require(_0x812b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x812b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x812b('0x10'));var Papa=require(_0x812b('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x812b('0x12'));var as=require(_0x812b('0x13'));var hardwareService=require(_0x812b('0x14'));var logger=require(_0x812b('0x15'))(_0x812b('0x16'));var utils=require(_0x812b('0x17'));var config=require(_0x812b('0x18'));var db=require(_0x812b('0x19'))['db'];config['redis']=_['defaults'](config[_0x812b('0x1a')],{'host':_0x812b('0x1b'),'port':0x18eb});var socket=require(_0x812b('0x1c'))(new Redis(config[_0x812b('0x1a')]));require('./whatsappQueue.socket')[_0x812b('0x1d')](socket);function respondWithStatusCode(_0x31b7db,_0x42aeea){_0x42aeea=_0x42aeea||0xcc;return function(_0x2fc0cf){if(_0x2fc0cf){return _0x31b7db[_0x812b('0x1e')](_0x42aeea);}return _0x31b7db[_0x812b('0x1f')](_0x42aeea)['end']();};}function respondWithResult(_0x42b317,_0x5e0f22){_0x5e0f22=_0x5e0f22||0xc8;return function(_0x583e95){if(_0x583e95){return _0x42b317[_0x812b('0x1f')](_0x5e0f22)[_0x812b('0x20')](_0x583e95);}};}function respondWithFilteredResult(_0x420845,_0x4d1919){return function(_0x43fb7f){if(_0x43fb7f){var _0x49485d=_0x43fb7f[_0x812b('0x21')],_0x35086f=_0x4d1919[_0x812b('0x22')],_0x133c8a=_0x4d1919[_0x812b('0x22')]+_0x4d1919[_0x812b('0x23')],_0x217309;if(_0x133c8a>=_0x49485d){_0x133c8a=_0x49485d;_0x217309=0xc8;}else{_0x217309=0xce;}_0x420845[_0x812b('0x1f')](_0x217309);return _0x420845[_0x812b('0x24')]('Content-Range',_0x35086f+'-'+_0x133c8a+'/'+_0x49485d)['json'](_0x43fb7f);}return null;};}function patchUpdates(_0x5e9a4b){return function(_0x16a32f){try{jsonpatch[_0x812b('0x25')](_0x16a32f,_0x5e9a4b,!![]);}catch(_0xd66467){return BPromise[_0x812b('0x26')](_0xd66467);}return _0x16a32f[_0x812b('0x27')]();};}function saveUpdates(_0x258dc5,_0x5674f1){return function(_0x54555d){if(_0x54555d){return _0x54555d['update'](_0x258dc5)[_0x812b('0x28')](function(_0x3ea4ed){return _0x3ea4ed;});}return null;};}function removeEntity(_0x18cdf1,_0x218d90){return function(_0x4e3efd){if(_0x4e3efd){return _0x4e3efd[_0x812b('0x29')]()[_0x812b('0x28')](function(){var _0x947928=_0x4e3efd[_0x812b('0x2a')]({'plain':!![]});var _0x54c43f='WhatsappQueues';return db[_0x812b('0x2b')][_0x812b('0x29')]({'where':{'type':_0x54c43f,'resourceId':_0x947928['id']}})['then'](function(){return _0x4e3efd;});})[_0x812b('0x28')](function(){_0x18cdf1[_0x812b('0x1f')](0xcc)[_0x812b('0x2c')]();});}};}function handleEntityNotFound(_0x5a38e2,_0x4e226e){return function(_0x354291){if(!_0x354291){_0x5a38e2[_0x812b('0x1e')](0x194);}return _0x354291;};}function handleError(_0x451710,_0x48e695){_0x48e695=_0x48e695||0x1f4;return function(_0x3b6d94){logger[_0x812b('0x2d')](_0x3b6d94['stack']);if(_0x3b6d94[_0x812b('0x2e')]){delete _0x3b6d94[_0x812b('0x2e')];}_0x451710[_0x812b('0x1f')](_0x48e695)[_0x812b('0x2f')](_0x3b6d94);};}exports[_0x812b('0x30')]=function(_0x526987,_0x2bc1fb){var _0x12d0d3={},_0x255e57={},_0x331cef={'count':0x0,'rows':[]};var _0x42fe6d=_[_0x812b('0x31')](db['WhatsappQueue'][_0x812b('0x32')],function(_0x4ec1f2){return{'name':_0x4ec1f2[_0x812b('0x33')],'type':_0x4ec1f2[_0x812b('0x34')][_0x812b('0x35')]};});_0x255e57[_0x812b('0x36')]=_[_0x812b('0x31')](_0x42fe6d,'name');_0x255e57[_0x812b('0x37')]=_[_0x812b('0x38')](_0x526987[_0x812b('0x37')]);_0x255e57[_0x812b('0x39')]=_[_0x812b('0x3a')](_0x255e57[_0x812b('0x36')],_0x255e57[_0x812b('0x37')]);_0x12d0d3[_0x812b('0x3b')]=_['intersection'](_0x255e57['model'],qs[_0x812b('0x3c')](_0x526987[_0x812b('0x37')]['fields']));_0x12d0d3['attributes']=_0x12d0d3[_0x812b('0x3b')][_0x812b('0x3d')]?_0x12d0d3[_0x812b('0x3b')]:_0x255e57[_0x812b('0x36')];if(!_0x526987[_0x812b('0x37')][_0x812b('0x3e')]('nolimit')){_0x12d0d3[_0x812b('0x23')]=qs[_0x812b('0x23')](_0x526987[_0x812b('0x37')]['limit']);_0x12d0d3['offset']=qs['offset'](_0x526987[_0x812b('0x37')]['offset']);}_0x12d0d3[_0x812b('0x3f')]=qs['sort'](_0x526987[_0x812b('0x37')]['sort']);_0x12d0d3[_0x812b('0x40')]=qs[_0x812b('0x39')](_[_0x812b('0x41')](_0x526987[_0x812b('0x37')],_0x255e57[_0x812b('0x39')]),_0x42fe6d);if(_0x526987[_0x812b('0x37')][_0x812b('0x42')]){_0x12d0d3[_0x812b('0x40')]=_[_0x812b('0x43')](_0x12d0d3['where'],{'$or':_[_0x812b('0x31')](_0x42fe6d,function(_0x408dd7){if(_0x408dd7[_0x812b('0x34')]!=='VIRTUAL'){var _0x133431={};_0x133431[_0x408dd7[_0x812b('0x2e')]]={'$like':'%'+_0x526987[_0x812b('0x37')][_0x812b('0x42')]+'%'};return _0x133431;}})});}_0x12d0d3=_[_0x812b('0x43')]({},_0x12d0d3,_0x526987[_0x812b('0x44')]);var _0x359bff={'where':_0x12d0d3[_0x812b('0x40')]};return db[_0x812b('0x45')][_0x812b('0x21')](_0x359bff)[_0x812b('0x28')](function(_0x5db9f0){_0x331cef[_0x812b('0x21')]=_0x5db9f0;if(_0x526987[_0x812b('0x37')]['includeAll']){_0x12d0d3[_0x812b('0x46')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x812b('0x47')](_0x12d0d3);})[_0x812b('0x28')](function(_0x273500){_0x331cef[_0x812b('0x48')]=_0x273500;return _0x331cef;})[_0x812b('0x28')](respondWithFilteredResult(_0x2bc1fb,_0x12d0d3))[_0x812b('0x49')](handleError(_0x2bc1fb,null));};exports['show']=function(_0x1a3537,_0x292ae8){var _0x567d8c={'raw':!![],'where':{'id':_0x1a3537[_0x812b('0x4a')]['id']}},_0x229710={};_0x229710[_0x812b('0x36')]=_[_0x812b('0x38')](db[_0x812b('0x45')][_0x812b('0x32')]);_0x229710['query']=_[_0x812b('0x38')](_0x1a3537['query']);_0x229710['filters']=_[_0x812b('0x3a')](_0x229710['model'],_0x229710[_0x812b('0x37')]);_0x567d8c[_0x812b('0x3b')]=_[_0x812b('0x3a')](_0x229710['model'],qs['fields'](_0x1a3537['query']['fields']));_0x567d8c[_0x812b('0x3b')]=_0x567d8c[_0x812b('0x3b')][_0x812b('0x3d')]?_0x567d8c[_0x812b('0x3b')]:_0x229710[_0x812b('0x36')];if(_0x1a3537[_0x812b('0x37')][_0x812b('0x4b')]){_0x567d8c['include']=[{'all':!![]}];}_0x567d8c=_[_0x812b('0x43')]({},_0x567d8c,_0x1a3537[_0x812b('0x44')]);return db['WhatsappQueue'][_0x812b('0x4c')](_0x567d8c)[_0x812b('0x28')](handleEntityNotFound(_0x292ae8,null))['then'](respondWithResult(_0x292ae8,null))[_0x812b('0x49')](handleError(_0x292ae8,null));};exports['create']=function(_0x3f91dc,_0x3d6bed){return db[_0x812b('0x45')][_0x812b('0x4d')](_0x3f91dc[_0x812b('0x4e')],{})[_0x812b('0x28')](function(_0x4f7094){var _0x411525=_0x3f91dc[_0x812b('0x4f')][_0x812b('0x2a')]({'plain':!![]});if(!_0x411525)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x411525[_0x812b('0x50')]==='user'){var _0x3f4f53=_0x4f7094[_0x812b('0x2a')]({'plain':!![]});var _0x2d7ea6=_0x812b('0x51');return db[_0x812b('0x52')][_0x812b('0x4c')]({'where':{'name':_0x2d7ea6,'userProfileId':_0x411525[_0x812b('0x53')]},'raw':!![]})[_0x812b('0x28')](function(_0x14efe0){if(_0x14efe0&&_0x14efe0[_0x812b('0x54')]===0x0){return db[_0x812b('0x2b')][_0x812b('0x4d')]({'name':_0x3f4f53[_0x812b('0x2e')],'resourceId':_0x3f4f53['id'],'type':_0x14efe0[_0x812b('0x2e')],'sectionId':_0x14efe0['id']},{})[_0x812b('0x28')](function(){return _0x4f7094;});}else{return _0x4f7094;}})[_0x812b('0x49')](function(_0x2471a1){logger[_0x812b('0x2d')](_0x812b('0x55'),_0x2471a1);throw _0x2471a1;});}return _0x4f7094;})['then'](respondWithResult(_0x3d6bed,0xc9))[_0x812b('0x49')](handleError(_0x3d6bed,null));};exports[_0x812b('0x56')]=function(_0x4377e5,_0x355dfb){if(_0x4377e5[_0x812b('0x4e')]['id']){delete _0x4377e5['body']['id'];}return db[_0x812b('0x45')][_0x812b('0x4c')]({'where':{'id':_0x4377e5[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](handleEntityNotFound(_0x355dfb,null))[_0x812b('0x28')](saveUpdates(_0x4377e5[_0x812b('0x4e')],null))[_0x812b('0x28')](respondWithResult(_0x355dfb,null))[_0x812b('0x49')](handleError(_0x355dfb,null));};exports[_0x812b('0x29')]=function(_0x4eb0df,_0xb61cbe){return db[_0x812b('0x45')][_0x812b('0x4c')]({'where':{'id':_0x4eb0df[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](handleEntityNotFound(_0xb61cbe,null))[_0x812b('0x28')](removeEntity(_0xb61cbe,null))['catch'](handleError(_0xb61cbe,null));};exports[_0x812b('0x57')]=function(_0x4a8f9e,_0x3d48e0){return db[_0x812b('0x45')][_0x812b('0x57')]()[_0x812b('0x28')](respondWithResult(_0x3d48e0,null))[_0x812b('0x49')](handleError(_0x3d48e0,null));};exports[_0x812b('0x58')]=function(_0x3b7455,_0x30cf68,_0x511d96){var _0x354e12={'raw':!![],'where':{}},_0x12f7e3={},_0x37f81e;return db['WhatsappQueue']['findOne']({'where':{'id':_0x3b7455['params']['id']}})[_0x812b('0x28')](handleEntityNotFound(_0x30cf68,null))[_0x812b('0x28')](function(_0x3f864d){if(_0x3f864d){_0x37f81e=_0x3f864d[_0x812b('0x2a')]({'plain':!![]});_0x12f7e3[_0x812b('0x36')]=_['keys'](db[_0x812b('0x59')][_0x812b('0x32')]);_0x12f7e3[_0x812b('0x37')]=_[_0x812b('0x38')](_0x3b7455[_0x812b('0x37')]);_0x12f7e3[_0x812b('0x39')]=_[_0x812b('0x3a')](_0x12f7e3[_0x812b('0x36')],_0x12f7e3['query']);_0x354e12['attributes']=_[_0x812b('0x3a')](_0x12f7e3['model'],qs[_0x812b('0x3c')](_0x3b7455[_0x812b('0x37')][_0x812b('0x3c')]));_0x354e12[_0x812b('0x3b')]=_0x354e12[_0x812b('0x3b')]['length']?_0x354e12[_0x812b('0x3b')]:_0x12f7e3[_0x812b('0x36')];if(!_0x3b7455[_0x812b('0x37')][_0x812b('0x3e')]('nolimit')){_0x354e12[_0x812b('0x23')]=qs[_0x812b('0x23')](_0x3b7455[_0x812b('0x37')]['limit']);_0x354e12[_0x812b('0x22')]=qs[_0x812b('0x22')](_0x3b7455[_0x812b('0x37')][_0x812b('0x22')]);}_0x354e12[_0x812b('0x3f')]=qs[_0x812b('0x5a')](_0x3b7455[_0x812b('0x37')][_0x812b('0x5a')]);_0x354e12[_0x812b('0x40')]=qs[_0x812b('0x39')](_[_0x812b('0x41')](_0x3b7455[_0x812b('0x37')],_0x12f7e3[_0x812b('0x39')]));_0x354e12[_0x812b('0x40')]['WhatsappQueueId']=_0x3f864d['id'];if(_0x3b7455[_0x812b('0x37')][_0x812b('0x42')]){_0x354e12[_0x812b('0x40')]=_[_0x812b('0x43')](_0x354e12[_0x812b('0x40')],{'$or':_[_0x812b('0x31')](_0x354e12[_0x812b('0x3b')],function(_0xa43f58){var _0x5549cd={};_0x5549cd[_0xa43f58]={'$like':'%'+_0x3b7455[_0x812b('0x37')]['filter']+'%'};return _0x5549cd;})});}_0x354e12=_[_0x812b('0x43')]({},_0x354e12,_0x3b7455[_0x812b('0x44')]);return db['UserWhatsappQueue'][_0x812b('0x47')](_0x354e12);}})[_0x812b('0x28')](function(_0x2b09b2){if(_0x2b09b2){return db[_0x812b('0x5b')][_0x812b('0x5c')]({'where':{'id':_[_0x812b('0x31')](_0x2b09b2,_0x812b('0x5d')),'role':_0x812b('0x5e')},'attributes':['id','name','whatsappPause',_0x812b('0x5f'),_0x812b('0x60')]});}})[_0x812b('0x28')](function(_0x44688d){if(_0x44688d){return{'count':_0x44688d[_0x812b('0x21')],'rows':_[_0x812b('0x31')](_0x44688d[_0x812b('0x48')],function(_0x4c6869){return{'membername':_0x4c6869['name'],'UserId':_0x4c6869['id'],'queue_name':_0x37f81e[_0x812b('0x2e')],'WhatsappQueueId':_0x37f81e['id'],'interface':util[_0x812b('0x61')]('%s/%s','SIP',_0x4c6869[_0x812b('0x2e')]),'penalty':0x0,'paused':_0x4c6869[_0x812b('0x62')],'createdAt':_0x4c6869['createdAt'],'updatedAt':_0x4c6869[_0x812b('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x30cf68,_0x354e12))[_0x812b('0x49')](handleError(_0x30cf68,null));};exports[_0x812b('0x63')]=function(_0x23a382,_0x48ae92,_0x5ca406){var _0x2f166e={};var _0x4f366a={};var _0x39527a;var _0x590828;return db[_0x812b('0x45')][_0x812b('0x64')]({'where':{'id':_0x23a382[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](handleEntityNotFound(_0x48ae92,null))[_0x812b('0x28')](function(_0x36ecda){if(_0x36ecda){_0x39527a=_0x36ecda;_0x4f366a[_0x812b('0x36')]=_[_0x812b('0x38')](db[_0x812b('0x65')][_0x812b('0x32')]);_0x4f366a[_0x812b('0x37')]=_[_0x812b('0x38')](_0x23a382['query']);_0x4f366a['filters']=_['intersection'](_0x4f366a[_0x812b('0x36')],_0x4f366a[_0x812b('0x37')]);_0x2f166e[_0x812b('0x3b')]=_[_0x812b('0x3a')](_0x4f366a['model'],qs['fields'](_0x23a382[_0x812b('0x37')][_0x812b('0x3c')]));_0x2f166e[_0x812b('0x3b')]=_0x2f166e[_0x812b('0x3b')][_0x812b('0x3d')]?_0x2f166e[_0x812b('0x3b')]:_0x4f366a['model'];_0x2f166e[_0x812b('0x3f')]=qs[_0x812b('0x5a')](_0x23a382[_0x812b('0x37')][_0x812b('0x5a')]);_0x2f166e[_0x812b('0x40')]=qs[_0x812b('0x39')](_[_0x812b('0x41')](_0x23a382['query'],_0x4f366a['filters']));if(_0x23a382[_0x812b('0x37')][_0x812b('0x42')]){_0x2f166e['where']=_[_0x812b('0x43')](_0x2f166e[_0x812b('0x40')],{'$or':_[_0x812b('0x31')](_0x2f166e[_0x812b('0x3b')],function(_0x4aa1ce){var _0x539611={};_0x539611[_0x4aa1ce]={'$like':'%'+_0x23a382[_0x812b('0x37')][_0x812b('0x42')]+'%'};return _0x539611;})});}_0x2f166e=_[_0x812b('0x43')]({},_0x2f166e,_0x23a382['options']);return _0x39527a[_0x812b('0x63')](_0x2f166e);}})[_0x812b('0x28')](function(_0x46eeb4){if(_0x46eeb4){_0x590828=_0x46eeb4[_0x812b('0x3d')];if(!_0x23a382['query'][_0x812b('0x3e')](_0x812b('0x66'))){_0x2f166e['limit']=qs[_0x812b('0x23')](_0x23a382[_0x812b('0x37')]['limit']);_0x2f166e[_0x812b('0x22')]=qs[_0x812b('0x22')](_0x23a382[_0x812b('0x37')][_0x812b('0x22')]);}return _0x39527a[_0x812b('0x63')](_0x2f166e);}})[_0x812b('0x28')](function(_0x389983){if(_0x389983){return _0x389983?{'count':_0x590828,'rows':_0x389983}:null;}})['then'](respondWithResult(_0x48ae92,null))[_0x812b('0x49')](handleError(_0x48ae92,null));};exports[_0x812b('0x67')]=function(_0x45e5ad,_0xe0ce94,_0x54908c){var _0x5f3cdf=_0x45e5ad[_0x812b('0x4e')]['ids'];return db[_0x812b('0x65')][_0x812b('0x47')]({'where':{'id':_0x5f3cdf},'attributes':['id'],'include':[{'model':db[_0x812b('0x5b')],'as':_0x812b('0x68'),'attributes':['id',_0x812b('0x2e'),_0x812b('0x69'),_0x812b('0x6a'),'interface'],'raw':!![]}]})[_0x812b('0x28')](function(_0x356973){if(_0x356973){var _0x346add=_[_0x812b('0x6b')](_0x356973,function(_0x2e9e2b){var _0x2bb241=_0x2e9e2b[_0x812b('0x2a')]({'plain':!![]});return _0x2bb241[_0x812b('0x68')];});return db['WhatsappQueue'][_0x812b('0x4c')]({'where':{'id':_0x45e5ad[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](function(_0x109aa9){return db[_0x812b('0x6c')][_0x812b('0x6d')](function(_0xff51f1){return _0x109aa9[_0x812b('0x67')](_0x5f3cdf,{'transaction':_0xff51f1})[_0x812b('0x28')](function(){return BPromise[_0x812b('0x6e')](_0x346add,function(_0x51f683){return db[_0x812b('0x59')]['findOrCreate']({'where':{'UserId':_0x51f683['id'],'WhatsappQueueId':_0x45e5ad['params']['id']},'transaction':_0xff51f1});});})[_0x812b('0x28')](function(){_0x346add['forEach'](function(_0x482189){socket[_0x812b('0x6f')](_0x812b('0x70'),{'UserId':_0x482189['id'],'WhatsappQueueId':_0x109aa9['id']});});});});});}})[_0x812b('0x28')](respondWithStatusCode(_0xe0ce94,null))[_0x812b('0x49')](handleError(_0xe0ce94,null));};exports[_0x812b('0x71')]=function(_0x35fe22,_0x4f4ec8,_0x130c32){return db[_0x812b('0x65')]['findAll']({'where':{'id':_0x35fe22[_0x812b('0x37')][_0x812b('0x72')]},'attributes':['id'],'include':[{'model':db[_0x812b('0x5b')],'as':_0x812b('0x68'),'attributes':['id'],'raw':!![]}]})[_0x812b('0x28')](handleEntityNotFound(_0x4f4ec8,null))[_0x812b('0x28')](function(_0xd2aa76){var _0x31d40f=_[_0x812b('0x31')](_0xd2aa76,'id');var _0x54f870=[];var _0x23a95e=[];var _0x1bbe10=squel[_0x812b('0x73')]();_0x1bbe10[_0x812b('0x74')](_0x812b('0x75'))[_0x812b('0x76')](_0x812b('0x77'),'tq')[_0x812b('0x78')](_0x812b('0x79'),'ut',_0x812b('0x7a'))[_0x812b('0x40')](_0x812b('0x7b'),_0x35fe22[_0x812b('0x4a')]['id']);for(var _0xa4ce47=0x0;_0xa4ce47<_0xd2aa76[_0x812b('0x3d')];_0xa4ce47+=0x1){let _0x218818=_0xd2aa76[_0xa4ce47];for(var _0x4623c8=0x0;_0x4623c8<_0x218818[_0x812b('0x68')][_0x812b('0x3d')];_0x4623c8+=0x1){let _0x29960c=_0x218818[_0x812b('0x68')][_0x4623c8];var _0x51fb8a=_0x1bbe10['clone']();_0x51fb8a[_0x812b('0x40')]('ut.UserId\x20=\x20?',_0x29960c['id']);_0x23a95e[_0x812b('0x7c')](db[_0x812b('0x6c')][_0x812b('0x37')](_0x51fb8a[_0x812b('0x7d')](),{'type':db[_0x812b('0x6c')][_0x812b('0x7e')][_0x812b('0x7f')]})[_0x812b('0x28')](function(_0x582403){if(_0x582403[_0x812b('0x3d')]===0x1){return _0x29960c['id'];}else{var _0x5db83e=_['every'](_[_0x812b('0x31')](_0x582403,'TeamId'),function(_0x4f50d5){return _[_0x812b('0x80')](_0x31d40f,_0x4f50d5);});if(_0x5db83e){return _0x29960c['id'];}}}));}}return BPromise[_0x812b('0x81')](_0x23a95e)['then'](function(_0x2478fb){_0x54f870=_(_0x54f870)[_0x812b('0x82')](_0x2478fb)[_0x812b('0x83')]()['value']();return db[_0x812b('0x45')][_0x812b('0x4c')]({'where':{'id':_0x35fe22[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](function(_0x30e493){return db[_0x812b('0x6c')][_0x812b('0x6d')](function(_0x5835ef){return _0x30e493[_0x812b('0x71')](_0x35fe22[_0x812b('0x37')][_0x812b('0x72')],{'transaction':_0x5835ef})[_0x812b('0x28')](function(){if(!_['isEmpty'](_0x54f870)){return _0x30e493[_0x812b('0x84')](_0x54f870,{'transaction':_0x5835ef});}})['then'](function(){_0x54f870[_0x812b('0x85')](function(_0x4579a8){socket[_0x812b('0x6f')](_0x812b('0x86'),{'UserId':_0x4579a8,'WhatsappQueueId':_0x30e493['id']});});});});});});})[_0x812b('0x28')](respondWithStatusCode(_0x4f4ec8,null))[_0x812b('0x49')](handleError(_0x4f4ec8,null));};exports[_0x812b('0x87')]=function(_0x2ee4a3,_0x311e33,_0x57c3c9){return db[_0x812b('0x45')][_0x812b('0x4c')]({'where':{'id':_0x2ee4a3[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](handleEntityNotFound(_0x311e33,null))[_0x812b('0x28')](function(_0x5ce623){if(_0x5ce623){return _0x5ce623[_0x812b('0x87')](_0x2ee4a3[_0x812b('0x4e')][_0x812b('0x72')],_[_0x812b('0x88')](_0x2ee4a3[_0x812b('0x4e')],[_0x812b('0x72'),'id'])||{})[_0x812b('0x89')](function(_0x558df4){for(var _0x1f4026=0x0;_0x1f4026<_0x2ee4a3[_0x812b('0x4e')][_0x812b('0x72')]['length'];_0x1f4026+=0x1){socket['emit'](_0x812b('0x70'),{'UserId':_0x2ee4a3[_0x812b('0x4e')][_0x812b('0x72')][_0x1f4026],'WhatsappQueueId':_0x2ee4a3[_0x812b('0x4a')]['id']});}return _0x558df4;});}})['then'](respondWithResult(_0x311e33,null))[_0x812b('0x49')](handleError(_0x311e33,null));};exports[_0x812b('0x84')]=function(_0x2b84c9,_0x55d484,_0x3a3715){return db['WhatsappQueue']['find']({'where':{'id':_0x2b84c9[_0x812b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x55d484,null))['then'](function(_0x52477b){if(_0x52477b){return _0x52477b[_0x812b('0x84')](_0x2b84c9[_0x812b('0x37')][_0x812b('0x72')])[_0x812b('0x28')](function(){if(_['isArray'](_0x2b84c9[_0x812b('0x37')][_0x812b('0x72')])){for(var _0x196d3d=0x0;_0x196d3d<_0x2b84c9[_0x812b('0x37')][_0x812b('0x72')]['length'];_0x196d3d+=0x1){socket['emit'](_0x812b('0x86'),{'UserId':Number(_0x2b84c9[_0x812b('0x37')]['ids'][_0x196d3d]),'WhatsappQueueId':Number(_0x2b84c9[_0x812b('0x4a')]['id'])});}}else{socket[_0x812b('0x6f')](_0x812b('0x86'),{'UserId':Number(_0x2b84c9[_0x812b('0x37')][_0x812b('0x72')]),'WhatsappQueueId':Number(_0x2b84c9[_0x812b('0x4a')]['id'])});}});}})[_0x812b('0x28')](respondWithStatusCode(_0x55d484,null))[_0x812b('0x49')](handleError(_0x55d484,null));};exports[_0x812b('0x8a')]=function(_0x3259e0,_0x66d33f,_0x5b7501){var _0x40442a={};var _0x48a797={};var _0x5b61e5;var _0x58b431;return db[_0x812b('0x45')]['findOne']({'where':{'id':_0x3259e0[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](handleEntityNotFound(_0x66d33f,null))['then'](function(_0x684883){if(_0x684883){_0x5b61e5=_0x684883;_0x48a797[_0x812b('0x36')]=_['keys'](db[_0x812b('0x5b')]['rawAttributes']);_0x48a797[_0x812b('0x37')]=_[_0x812b('0x38')](_0x3259e0[_0x812b('0x37')]);_0x48a797[_0x812b('0x39')]=_[_0x812b('0x3a')](_0x48a797[_0x812b('0x36')],_0x48a797[_0x812b('0x37')]);_0x40442a[_0x812b('0x3b')]=_[_0x812b('0x3a')](_0x48a797[_0x812b('0x36')],qs[_0x812b('0x3c')](_0x3259e0[_0x812b('0x37')][_0x812b('0x3c')]));_0x40442a[_0x812b('0x3b')]=_0x40442a[_0x812b('0x3b')][_0x812b('0x3d')]?_0x40442a[_0x812b('0x3b')]:_0x48a797[_0x812b('0x36')];_0x40442a[_0x812b('0x3f')]=qs[_0x812b('0x5a')](_0x3259e0['query']['sort']);_0x40442a['where']=qs[_0x812b('0x39')](_['pick'](_0x3259e0[_0x812b('0x37')],_0x48a797[_0x812b('0x39')]));if(_0x3259e0[_0x812b('0x37')][_0x812b('0x42')]){_0x40442a[_0x812b('0x40')]=_[_0x812b('0x43')](_0x40442a[_0x812b('0x40')],{'$or':_[_0x812b('0x31')](_0x40442a[_0x812b('0x3b')],function(_0x12d949){var _0x4736d6={};_0x4736d6[_0x12d949]={'$like':'%'+_0x3259e0[_0x812b('0x37')][_0x812b('0x42')]+'%'};return _0x4736d6;})});}_0x40442a=_['merge']({},_0x40442a,_0x3259e0[_0x812b('0x44')]);return _0x5b61e5[_0x812b('0x8a')](_0x40442a);}})[_0x812b('0x28')](function(_0x2cad13){if(_0x2cad13){_0x58b431=_0x2cad13[_0x812b('0x3d')];if(!_0x3259e0['query'][_0x812b('0x3e')](_0x812b('0x66'))){_0x40442a['limit']=qs[_0x812b('0x23')](_0x3259e0[_0x812b('0x37')][_0x812b('0x23')]);_0x40442a[_0x812b('0x22')]=qs[_0x812b('0x22')](_0x3259e0[_0x812b('0x37')]['offset']);}return _0x5b61e5[_0x812b('0x8a')](_0x40442a);}})[_0x812b('0x28')](function(_0x4affbe){if(_0x4affbe){return _0x4affbe?{'count':_0x58b431,'rows':_0x4affbe}:null;}})['then'](respondWithResult(_0x66d33f,null))['catch'](handleError(_0x66d33f,null));}; \ No newline at end of file +var _0x775a=['sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','WhatsappQueues','UserProfileResource','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','params','WhatsappQueue','find','create','user','role','get','userProfileId','autoAssociation','body','describe','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','updatedAt','whatsappPause','createdAt','getTeams','Team','ids','User','Agents','online','voicePause','flatMap','addTeams','each','findOrCreate','forEach','emit','select','tq.TeamId','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','TeamId','includes','all','compact','value','removeTeams','removeAgents','addAgents','omit','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register'];(function(_0x5c0d00,_0x3795fb){var _0x332df9=function(_0x27447a){while(--_0x27447a){_0x5c0d00['push'](_0x5c0d00['shift']());}};_0x332df9(++_0x3795fb);}(_0x775a,0xed));var _0xa775=function(_0x39f7b5,_0x10ddb9){_0x39f7b5=_0x39f7b5-0x0;var _0x17e247=_0x775a[_0x39f7b5];return _0x17e247;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa775('0x0'));var rimraf=require(_0xa775('0x1'));var zipdir=require(_0xa775('0x2'));var jsonpatch=require(_0xa775('0x3'));var rp=require(_0xa775('0x4'));var moment=require(_0xa775('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa775('0x6'));var util=require(_0xa775('0x7'));var path=require(_0xa775('0x8'));var sox=require('sox');var csv=require(_0xa775('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa775('0xa'));var jsforce=require(_0xa775('0xb'));var deskjs=require(_0xa775('0xc'));var toCsv=require(_0xa775('0x9'));var querystring=require(_0xa775('0xd'));var Papa=require(_0xa775('0xe'));var Redis=require(_0xa775('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa775('0x10'));var as=require(_0xa775('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa775('0x12'));var config=require(_0xa775('0x13'));var db=require(_0xa775('0x14'))['db'];config[_0xa775('0x15')]=_[_0xa775('0x16')](config[_0xa775('0x15')],{'host':_0xa775('0x17'),'port':0x18eb});var socket=require(_0xa775('0x18'))(new Redis(config[_0xa775('0x15')]));require(_0xa775('0x19'))[_0xa775('0x1a')](socket);function respondWithStatusCode(_0x16efaa,_0x5708c1){_0x5708c1=_0x5708c1||0xcc;return function(_0x1f3cdb){if(_0x1f3cdb){return _0x16efaa[_0xa775('0x1b')](_0x5708c1);}return _0x16efaa[_0xa775('0x1c')](_0x5708c1)['end']();};}function respondWithResult(_0x5bc58e,_0x52d4a3){_0x52d4a3=_0x52d4a3||0xc8;return function(_0x15020e){if(_0x15020e){return _0x5bc58e[_0xa775('0x1c')](_0x52d4a3)[_0xa775('0x1d')](_0x15020e);}};}function respondWithFilteredResult(_0x5137ec,_0x2cfe1c){return function(_0x3de00f){if(_0x3de00f){var _0x4886c8=_0x3de00f['count'],_0x1ab535=_0x2cfe1c[_0xa775('0x1e')],_0x204f1c=_0x2cfe1c['offset']+_0x2cfe1c[_0xa775('0x1f')],_0x1af19d;if(_0x204f1c>=_0x4886c8){_0x204f1c=_0x4886c8;_0x1af19d=0xc8;}else{_0x1af19d=0xce;}_0x5137ec[_0xa775('0x1c')](_0x1af19d);return _0x5137ec[_0xa775('0x20')](_0xa775('0x21'),_0x1ab535+'-'+_0x204f1c+'/'+_0x4886c8)[_0xa775('0x1d')](_0x3de00f);}return null;};}function patchUpdates(_0x2f1361){return function(_0x5806c0){try{jsonpatch[_0xa775('0x22')](_0x5806c0,_0x2f1361,!![]);}catch(_0x243764){return BPromise[_0xa775('0x23')](_0x243764);}return _0x5806c0['save']();};}function saveUpdates(_0x1431b5,_0xcad945){return function(_0x5260fc){if(_0x5260fc){return _0x5260fc[_0xa775('0x24')](_0x1431b5)['then'](function(_0x15ffde){return _0x15ffde;});}return null;};}function removeEntity(_0x5da623,_0x50c9a1){return function(_0x4330d8){if(_0x4330d8){return _0x4330d8['destroy']()[_0xa775('0x25')](function(){var _0x4e0269=_0x4330d8['get']({'plain':!![]});var _0x62d57a=_0xa775('0x26');return db[_0xa775('0x27')][_0xa775('0x28')]({'where':{'type':_0x62d57a,'resourceId':_0x4e0269['id']}})['then'](function(){return _0x4330d8;});})['then'](function(){_0x5da623[_0xa775('0x1c')](0xcc)[_0xa775('0x29')]();});}};}function handleEntityNotFound(_0x472491,_0x378e61){return function(_0x2519df){if(!_0x2519df){_0x472491[_0xa775('0x1b')](0x194);}return _0x2519df;};}function handleError(_0x1e883d,_0x4974c1){_0x4974c1=_0x4974c1||0x1f4;return function(_0x5ea461){logger[_0xa775('0x2a')](_0x5ea461[_0xa775('0x2b')]);if(_0x5ea461[_0xa775('0x2c')]){delete _0x5ea461[_0xa775('0x2c')];}_0x1e883d[_0xa775('0x1c')](_0x4974c1)['send'](_0x5ea461);};}exports[_0xa775('0x2d')]=function(_0x5812e9,_0x3feb29){var _0x3704da={},_0x5c7c25={},_0x129018={'count':0x0,'rows':[]};var _0x410f55=_[_0xa775('0x2e')](db['WhatsappQueue'][_0xa775('0x2f')],function(_0x34aab6){return{'name':_0x34aab6[_0xa775('0x30')],'type':_0x34aab6[_0xa775('0x31')]['key']};});_0x5c7c25['model']=_[_0xa775('0x2e')](_0x410f55,'name');_0x5c7c25[_0xa775('0x32')]=_[_0xa775('0x33')](_0x5812e9[_0xa775('0x32')]);_0x5c7c25[_0xa775('0x34')]=_[_0xa775('0x35')](_0x5c7c25[_0xa775('0x36')],_0x5c7c25[_0xa775('0x32')]);_0x3704da[_0xa775('0x37')]=_[_0xa775('0x35')](_0x5c7c25['model'],qs[_0xa775('0x38')](_0x5812e9[_0xa775('0x32')][_0xa775('0x38')]));_0x3704da[_0xa775('0x37')]=_0x3704da[_0xa775('0x37')][_0xa775('0x39')]?_0x3704da[_0xa775('0x37')]:_0x5c7c25[_0xa775('0x36')];if(!_0x5812e9['query'][_0xa775('0x3a')](_0xa775('0x3b'))){_0x3704da[_0xa775('0x1f')]=qs['limit'](_0x5812e9['query'][_0xa775('0x1f')]);_0x3704da[_0xa775('0x1e')]=qs[_0xa775('0x1e')](_0x5812e9[_0xa775('0x32')]['offset']);}_0x3704da[_0xa775('0x3c')]=qs['sort'](_0x5812e9[_0xa775('0x32')][_0xa775('0x3d')]);_0x3704da['where']=qs['filters'](_[_0xa775('0x3e')](_0x5812e9['query'],_0x5c7c25[_0xa775('0x34')]),_0x410f55);if(_0x5812e9[_0xa775('0x32')]['filter']){_0x3704da['where']=_[_0xa775('0x3f')](_0x3704da[_0xa775('0x40')],{'$or':_['map'](_0x410f55,function(_0x756113){if(_0x756113[_0xa775('0x31')]!==_0xa775('0x41')){var _0x59dbe8={};_0x59dbe8[_0x756113[_0xa775('0x2c')]]={'$like':'%'+_0x5812e9['query'][_0xa775('0x42')]+'%'};return _0x59dbe8;}})});}_0x3704da=_[_0xa775('0x3f')]({},_0x3704da,_0x5812e9[_0xa775('0x43')]);var _0x509082={'where':_0x3704da['where']};return db['WhatsappQueue'][_0xa775('0x44')](_0x509082)[_0xa775('0x25')](function(_0x2b540e){_0x129018[_0xa775('0x44')]=_0x2b540e;if(_0x5812e9[_0xa775('0x32')][_0xa775('0x45')]){_0x3704da[_0xa775('0x46')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xa775('0x47')](_0x3704da);})[_0xa775('0x25')](function(_0x1a25f6){_0x129018['rows']=_0x1a25f6;return _0x129018;})[_0xa775('0x25')](respondWithFilteredResult(_0x3feb29,_0x3704da))[_0xa775('0x48')](handleError(_0x3feb29,null));};exports[_0xa775('0x49')]=function(_0x1bf101,_0x577d45){var _0x32f101={'raw':!![],'where':{'id':_0x1bf101[_0xa775('0x4a')]['id']}},_0x4d1401={};_0x4d1401[_0xa775('0x36')]=_[_0xa775('0x33')](db[_0xa775('0x4b')]['rawAttributes']);_0x4d1401['query']=_['keys'](_0x1bf101[_0xa775('0x32')]);_0x4d1401[_0xa775('0x34')]=_['intersection'](_0x4d1401[_0xa775('0x36')],_0x4d1401[_0xa775('0x32')]);_0x32f101['attributes']=_[_0xa775('0x35')](_0x4d1401[_0xa775('0x36')],qs[_0xa775('0x38')](_0x1bf101[_0xa775('0x32')]['fields']));_0x32f101[_0xa775('0x37')]=_0x32f101[_0xa775('0x37')]['length']?_0x32f101[_0xa775('0x37')]:_0x4d1401['model'];if(_0x1bf101[_0xa775('0x32')][_0xa775('0x45')]){_0x32f101[_0xa775('0x46')]=[{'all':!![]}];}_0x32f101=_['merge']({},_0x32f101,_0x1bf101[_0xa775('0x43')]);return db[_0xa775('0x4b')][_0xa775('0x4c')](_0x32f101)['then'](handleEntityNotFound(_0x577d45,null))[_0xa775('0x25')](respondWithResult(_0x577d45,null))[_0xa775('0x48')](handleError(_0x577d45,null));};exports[_0xa775('0x4d')]=function(_0x4f2042,_0x39306a){return db['WhatsappQueue']['create'](_0x4f2042['body'],{})[_0xa775('0x25')](function(_0x13fe95){var _0x26ee63=_0x4f2042[_0xa775('0x4e')]['get']({'plain':!![]});if(!_0x26ee63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26ee63[_0xa775('0x4f')]===_0xa775('0x4e')){var _0x30aaf4=_0x13fe95[_0xa775('0x50')]({'plain':!![]});var _0x22b8a8='WhatsappQueues';return db['UserProfileSection'][_0xa775('0x4c')]({'where':{'name':_0x22b8a8,'userProfileId':_0x26ee63[_0xa775('0x51')]},'raw':!![]})[_0xa775('0x25')](function(_0x1abb6d){if(_0x1abb6d&&_0x1abb6d[_0xa775('0x52')]===0x0){return db[_0xa775('0x27')][_0xa775('0x4d')]({'name':_0x30aaf4[_0xa775('0x2c')],'resourceId':_0x30aaf4['id'],'type':_0x1abb6d['name'],'sectionId':_0x1abb6d['id']},{})['then'](function(){return _0x13fe95;});}else{return _0x13fe95;}})['catch'](function(_0x3159c8){logger[_0xa775('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3159c8);throw _0x3159c8;});}return _0x13fe95;})[_0xa775('0x25')](respondWithResult(_0x39306a,0xc9))[_0xa775('0x48')](handleError(_0x39306a,null));};exports[_0xa775('0x24')]=function(_0x17f70d,_0x1524b9){if(_0x17f70d['body']['id']){delete _0x17f70d[_0xa775('0x53')]['id'];}return db[_0xa775('0x4b')]['find']({'where':{'id':_0x17f70d[_0xa775('0x4a')]['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x1524b9,null))['then'](saveUpdates(_0x17f70d['body'],null))[_0xa775('0x25')](respondWithResult(_0x1524b9,null))['catch'](handleError(_0x1524b9,null));};exports[_0xa775('0x28')]=function(_0x22af18,_0x2a3a36){return db['WhatsappQueue'][_0xa775('0x4c')]({'where':{'id':_0x22af18['params']['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x2a3a36,null))[_0xa775('0x25')](removeEntity(_0x2a3a36,null))[_0xa775('0x48')](handleError(_0x2a3a36,null));};exports[_0xa775('0x54')]=function(_0x1b6e7c,_0x243d71){return db['WhatsappQueue'][_0xa775('0x54')]()['then'](respondWithResult(_0x243d71,null))[_0xa775('0x48')](handleError(_0x243d71,null));};exports['getMembers']=function(_0x372b77,_0x1173a4,_0x12ccc){var _0x4698eb={'raw':!![],'where':{}},_0x4ba811={},_0x2d36b2;return db[_0xa775('0x4b')][_0xa775('0x55')]({'where':{'id':_0x372b77[_0xa775('0x4a')]['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x1173a4,null))[_0xa775('0x25')](function(_0x45f48c){if(_0x45f48c){_0x2d36b2=_0x45f48c['get']({'plain':!![]});_0x4ba811[_0xa775('0x36')]=_[_0xa775('0x33')](db[_0xa775('0x56')]['rawAttributes']);_0x4ba811[_0xa775('0x32')]=_[_0xa775('0x33')](_0x372b77['query']);_0x4ba811[_0xa775('0x34')]=_[_0xa775('0x35')](_0x4ba811[_0xa775('0x36')],_0x4ba811['query']);_0x4698eb['attributes']=_[_0xa775('0x35')](_0x4ba811[_0xa775('0x36')],qs[_0xa775('0x38')](_0x372b77[_0xa775('0x32')][_0xa775('0x38')]));_0x4698eb[_0xa775('0x37')]=_0x4698eb[_0xa775('0x37')][_0xa775('0x39')]?_0x4698eb[_0xa775('0x37')]:_0x4ba811[_0xa775('0x36')];if(!_0x372b77[_0xa775('0x32')][_0xa775('0x3a')](_0xa775('0x3b'))){_0x4698eb[_0xa775('0x1f')]=qs['limit'](_0x372b77[_0xa775('0x32')]['limit']);_0x4698eb[_0xa775('0x1e')]=qs[_0xa775('0x1e')](_0x372b77[_0xa775('0x32')][_0xa775('0x1e')]);}_0x4698eb[_0xa775('0x3c')]=qs[_0xa775('0x3d')](_0x372b77['query'][_0xa775('0x3d')]);_0x4698eb['where']=qs[_0xa775('0x34')](_[_0xa775('0x3e')](_0x372b77[_0xa775('0x32')],_0x4ba811[_0xa775('0x34')]));_0x4698eb[_0xa775('0x40')][_0xa775('0x57')]=_0x45f48c['id'];if(_0x372b77[_0xa775('0x32')][_0xa775('0x42')]){_0x4698eb[_0xa775('0x40')]=_[_0xa775('0x3f')](_0x4698eb[_0xa775('0x40')],{'$or':_[_0xa775('0x2e')](_0x4698eb['attributes'],function(_0x82516d){var _0x2490ad={};_0x2490ad[_0x82516d]={'$like':'%'+_0x372b77[_0xa775('0x32')][_0xa775('0x42')]+'%'};return _0x2490ad;})});}_0x4698eb=_[_0xa775('0x3f')]({},_0x4698eb,_0x372b77[_0xa775('0x43')]);return db[_0xa775('0x56')]['findAll'](_0x4698eb);}})[_0xa775('0x25')](function(_0x1eb3c8){if(_0x1eb3c8){return db['User'][_0xa775('0x58')]({'where':{'id':_['map'](_0x1eb3c8,_0xa775('0x59')),'role':_0xa775('0x5a')},'attributes':['id',_0xa775('0x2c'),'whatsappPause',_0xa775('0x5b'),'createdAt']});}})[_0xa775('0x25')](function(_0xb7d7b8){if(_0xb7d7b8){return{'count':_0xb7d7b8['count'],'rows':_[_0xa775('0x2e')](_0xb7d7b8['rows'],function(_0x5d2420){return{'membername':_0x5d2420[_0xa775('0x2c')],'UserId':_0x5d2420['id'],'queue_name':_0x2d36b2['name'],'WhatsappQueueId':_0x2d36b2['id'],'interface':util['format']('%s/%s','SIP',_0x5d2420['name']),'penalty':0x0,'paused':_0x5d2420[_0xa775('0x5c')],'createdAt':_0x5d2420[_0xa775('0x5d')],'updatedAt':_0x5d2420[_0xa775('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa775('0x25')](respondWithFilteredResult(_0x1173a4,_0x4698eb))[_0xa775('0x48')](handleError(_0x1173a4,null));};exports[_0xa775('0x5e')]=function(_0x11d584,_0x5035b3,_0x50cde3){var _0x4e3bca={};var _0x114c0a={};var _0x1a74e0;var _0x54d1a6;return db[_0xa775('0x4b')][_0xa775('0x55')]({'where':{'id':_0x11d584['params']['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x5035b3,null))[_0xa775('0x25')](function(_0x26d3ad){if(_0x26d3ad){_0x1a74e0=_0x26d3ad;_0x114c0a['model']=_[_0xa775('0x33')](db[_0xa775('0x5f')]['rawAttributes']);_0x114c0a[_0xa775('0x32')]=_['keys'](_0x11d584[_0xa775('0x32')]);_0x114c0a[_0xa775('0x34')]=_['intersection'](_0x114c0a[_0xa775('0x36')],_0x114c0a['query']);_0x4e3bca['attributes']=_['intersection'](_0x114c0a[_0xa775('0x36')],qs[_0xa775('0x38')](_0x11d584[_0xa775('0x32')][_0xa775('0x38')]));_0x4e3bca[_0xa775('0x37')]=_0x4e3bca['attributes'][_0xa775('0x39')]?_0x4e3bca[_0xa775('0x37')]:_0x114c0a[_0xa775('0x36')];_0x4e3bca[_0xa775('0x3c')]=qs[_0xa775('0x3d')](_0x11d584[_0xa775('0x32')][_0xa775('0x3d')]);_0x4e3bca['where']=qs[_0xa775('0x34')](_[_0xa775('0x3e')](_0x11d584[_0xa775('0x32')],_0x114c0a[_0xa775('0x34')]));if(_0x11d584[_0xa775('0x32')][_0xa775('0x42')]){_0x4e3bca[_0xa775('0x40')]=_['merge'](_0x4e3bca[_0xa775('0x40')],{'$or':_[_0xa775('0x2e')](_0x4e3bca[_0xa775('0x37')],function(_0x4adf53){var _0x5c2677={};_0x5c2677[_0x4adf53]={'$like':'%'+_0x11d584[_0xa775('0x32')][_0xa775('0x42')]+'%'};return _0x5c2677;})});}_0x4e3bca=_['merge']({},_0x4e3bca,_0x11d584[_0xa775('0x43')]);return _0x1a74e0['getTeams'](_0x4e3bca);}})[_0xa775('0x25')](function(_0x3e3812){if(_0x3e3812){_0x54d1a6=_0x3e3812['length'];if(!_0x11d584['query'][_0xa775('0x3a')](_0xa775('0x3b'))){_0x4e3bca[_0xa775('0x1f')]=qs['limit'](_0x11d584[_0xa775('0x32')][_0xa775('0x1f')]);_0x4e3bca['offset']=qs[_0xa775('0x1e')](_0x11d584[_0xa775('0x32')][_0xa775('0x1e')]);}return _0x1a74e0[_0xa775('0x5e')](_0x4e3bca);}})[_0xa775('0x25')](function(_0x4cdd5b){if(_0x4cdd5b){return _0x4cdd5b?{'count':_0x54d1a6,'rows':_0x4cdd5b}:null;}})[_0xa775('0x25')](respondWithResult(_0x5035b3,null))[_0xa775('0x48')](handleError(_0x5035b3,null));};exports['addTeams']=function(_0x1a72a9,_0x1ff7e1,_0x6e1059){var _0x3362ca=_0x1a72a9[_0xa775('0x53')][_0xa775('0x60')];return db['Team'][_0xa775('0x47')]({'where':{'id':_0x3362ca},'attributes':['id'],'include':[{'model':db[_0xa775('0x61')],'as':_0xa775('0x62'),'attributes':['id',_0xa775('0x2c'),_0xa775('0x63'),_0xa775('0x64'),'interface'],'raw':!![]}]})[_0xa775('0x25')](function(_0x4912e7){if(_0x4912e7){var _0xb45223=_[_0xa775('0x65')](_0x4912e7,function(_0x567ebf){var _0x402ad3=_0x567ebf[_0xa775('0x50')]({'plain':!![]});return _0x402ad3[_0xa775('0x62')];});return db[_0xa775('0x4b')][_0xa775('0x4c')]({'where':{'id':_0x1a72a9[_0xa775('0x4a')]['id']}})['then'](function(_0x4d029f){return db['sequelize']['transaction'](function(_0x229af4){return _0x4d029f[_0xa775('0x66')](_0x3362ca,{'transaction':_0x229af4})['then'](function(){return BPromise[_0xa775('0x67')](_0xb45223,function(_0x553187){return db[_0xa775('0x56')][_0xa775('0x68')]({'where':{'UserId':_0x553187['id'],'WhatsappQueueId':_0x1a72a9[_0xa775('0x4a')]['id']},'transaction':_0x229af4});});})[_0xa775('0x25')](function(){_0xb45223[_0xa775('0x69')](function(_0x5c8450){socket[_0xa775('0x6a')]('userWhatsappQueue:save',{'UserId':_0x5c8450['id'],'WhatsappQueueId':_0x4d029f['id']});});});});});}})[_0xa775('0x25')](respondWithStatusCode(_0x1ff7e1,null))[_0xa775('0x48')](handleError(_0x1ff7e1,null));};exports['removeTeams']=function(_0x59b585,_0x5c37de,_0x5c3b98){return db[_0xa775('0x5f')][_0xa775('0x47')]({'where':{'id':_0x59b585[_0xa775('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa775('0x61')],'as':_0xa775('0x62'),'attributes':['id'],'raw':!![]}]})[_0xa775('0x25')](handleEntityNotFound(_0x5c37de,null))[_0xa775('0x25')](function(_0x297fbe){var _0x473ae2=_[_0xa775('0x2e')](_0x297fbe,'id');var _0x4be1c9=[];var _0x1e3555=[];var _0x3491fa=squel[_0xa775('0x6b')]();_0x3491fa['field'](_0xa775('0x6c'))['from'](_0xa775('0x6d'),'tq')['join']('user_has_teams','ut',_0xa775('0x6e'))[_0xa775('0x40')](_0xa775('0x6f'),_0x59b585[_0xa775('0x4a')]['id']);for(var _0x5065ad=0x0;_0x5065ad<_0x297fbe[_0xa775('0x39')];_0x5065ad+=0x1){let _0xdde26e=_0x297fbe[_0x5065ad];for(var _0x151fea=0x0;_0x151fea<_0xdde26e[_0xa775('0x62')][_0xa775('0x39')];_0x151fea+=0x1){let _0x570f61=_0xdde26e[_0xa775('0x62')][_0x151fea];var _0x1c7ec6=_0x3491fa[_0xa775('0x70')]();_0x1c7ec6[_0xa775('0x40')](_0xa775('0x71'),_0x570f61['id']);_0x1e3555[_0xa775('0x72')](db[_0xa775('0x73')][_0xa775('0x32')](_0x1c7ec6['toString'](),{'type':db['sequelize'][_0xa775('0x74')]['SELECT']})[_0xa775('0x25')](function(_0x14b523){if(_0x14b523[_0xa775('0x39')]===0x1){return _0x570f61['id'];}else{var _0x39ba39=_[_0xa775('0x75')](_[_0xa775('0x2e')](_0x14b523,_0xa775('0x76')),function(_0x3f9959){return _[_0xa775('0x77')](_0x473ae2,_0x3f9959);});if(_0x39ba39){return _0x570f61['id'];}}}));}}return BPromise[_0xa775('0x78')](_0x1e3555)[_0xa775('0x25')](function(_0x1d1ebc){_0x4be1c9=_(_0x4be1c9)['union'](_0x1d1ebc)[_0xa775('0x79')]()[_0xa775('0x7a')]();return db['WhatsappQueue'][_0xa775('0x4c')]({'where':{'id':_0x59b585[_0xa775('0x4a')]['id']}})['then'](function(_0x5cdc0c){return db[_0xa775('0x73')]['transaction'](function(_0x196c78){return _0x5cdc0c[_0xa775('0x7b')](_0x59b585[_0xa775('0x32')]['ids'],{'transaction':_0x196c78})[_0xa775('0x25')](function(){if(!_['isEmpty'](_0x4be1c9)){return _0x5cdc0c[_0xa775('0x7c')](_0x4be1c9,{'transaction':_0x196c78});}})['then'](function(){_0x4be1c9['forEach'](function(_0x59c5c1){socket[_0xa775('0x6a')]('userWhatsappQueue:remove',{'UserId':_0x59c5c1,'WhatsappQueueId':_0x5cdc0c['id']});});});});});});})['then'](respondWithStatusCode(_0x5c37de,null))[_0xa775('0x48')](handleError(_0x5c37de,null));};exports['addAgents']=function(_0x5b5679,_0x5ec1a5,_0x5773d3){return db[_0xa775('0x4b')][_0xa775('0x4c')]({'where':{'id':_0x5b5679[_0xa775('0x4a')]['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x5ec1a5,null))[_0xa775('0x25')](function(_0x40aa67){if(_0x40aa67){return _0x40aa67[_0xa775('0x7d')](_0x5b5679[_0xa775('0x53')][_0xa775('0x60')],_[_0xa775('0x7e')](_0x5b5679[_0xa775('0x53')],[_0xa775('0x60'),'id'])||{})[_0xa775('0x7f')](function(_0x597941){for(var _0x3d1c27=0x0;_0x3d1c27<_0x5b5679['body']['ids'][_0xa775('0x39')];_0x3d1c27+=0x1){socket[_0xa775('0x6a')](_0xa775('0x80'),{'UserId':_0x5b5679[_0xa775('0x53')][_0xa775('0x60')][_0x3d1c27],'WhatsappQueueId':_0x5b5679['params']['id']});}return _0x597941;});}})[_0xa775('0x25')](respondWithResult(_0x5ec1a5,null))[_0xa775('0x48')](handleError(_0x5ec1a5,null));};exports[_0xa775('0x7c')]=function(_0x70daba,_0x4ff7cb,_0x2c1e98){return db['WhatsappQueue'][_0xa775('0x4c')]({'where':{'id':_0x70daba[_0xa775('0x4a')]['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x4ff7cb,null))['then'](function(_0x13ff77){if(_0x13ff77){return _0x13ff77[_0xa775('0x7c')](_0x70daba['query'][_0xa775('0x60')])['then'](function(){if(_[_0xa775('0x81')](_0x70daba[_0xa775('0x32')]['ids'])){for(var _0x131e8c=0x0;_0x131e8c<_0x70daba[_0xa775('0x32')][_0xa775('0x60')][_0xa775('0x39')];_0x131e8c+=0x1){socket[_0xa775('0x6a')](_0xa775('0x82'),{'UserId':Number(_0x70daba[_0xa775('0x32')]['ids'][_0x131e8c]),'WhatsappQueueId':Number(_0x70daba[_0xa775('0x4a')]['id'])});}}else{socket['emit'](_0xa775('0x82'),{'UserId':Number(_0x70daba[_0xa775('0x32')][_0xa775('0x60')]),'WhatsappQueueId':Number(_0x70daba[_0xa775('0x4a')]['id'])});}});}})[_0xa775('0x25')](respondWithStatusCode(_0x4ff7cb,null))['catch'](handleError(_0x4ff7cb,null));};exports['getAgents']=function(_0x382bc7,_0x51b186,_0x304cd8){var _0x3027f9={};var _0xe512b8={};var _0x53b69a;var _0x4f52c1;return db['WhatsappQueue'][_0xa775('0x55')]({'where':{'id':_0x382bc7[_0xa775('0x4a')]['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x51b186,null))[_0xa775('0x25')](function(_0x409391){if(_0x409391){_0x53b69a=_0x409391;_0xe512b8[_0xa775('0x36')]=_['keys'](db['User'][_0xa775('0x2f')]);_0xe512b8[_0xa775('0x32')]=_[_0xa775('0x33')](_0x382bc7[_0xa775('0x32')]);_0xe512b8[_0xa775('0x34')]=_['intersection'](_0xe512b8['model'],_0xe512b8[_0xa775('0x32')]);_0x3027f9[_0xa775('0x37')]=_[_0xa775('0x35')](_0xe512b8[_0xa775('0x36')],qs[_0xa775('0x38')](_0x382bc7[_0xa775('0x32')][_0xa775('0x38')]));_0x3027f9['attributes']=_0x3027f9['attributes']['length']?_0x3027f9[_0xa775('0x37')]:_0xe512b8['model'];_0x3027f9[_0xa775('0x3c')]=qs[_0xa775('0x3d')](_0x382bc7[_0xa775('0x32')][_0xa775('0x3d')]);_0x3027f9[_0xa775('0x40')]=qs['filters'](_['pick'](_0x382bc7[_0xa775('0x32')],_0xe512b8['filters']));if(_0x382bc7[_0xa775('0x32')][_0xa775('0x42')]){_0x3027f9['where']=_[_0xa775('0x3f')](_0x3027f9[_0xa775('0x40')],{'$or':_[_0xa775('0x2e')](_0x3027f9[_0xa775('0x37')],function(_0x360284){var _0x534c32={};_0x534c32[_0x360284]={'$like':'%'+_0x382bc7[_0xa775('0x32')]['filter']+'%'};return _0x534c32;})});}_0x3027f9=_[_0xa775('0x3f')]({},_0x3027f9,_0x382bc7['options']);return _0x53b69a[_0xa775('0x83')](_0x3027f9);}})[_0xa775('0x25')](function(_0x3cb1f5){if(_0x3cb1f5){_0x4f52c1=_0x3cb1f5[_0xa775('0x39')];if(!_0x382bc7[_0xa775('0x32')]['hasOwnProperty'](_0xa775('0x3b'))){_0x3027f9['limit']=qs[_0xa775('0x1f')](_0x382bc7[_0xa775('0x32')][_0xa775('0x1f')]);_0x3027f9['offset']=qs['offset'](_0x382bc7[_0xa775('0x32')][_0xa775('0x1e')]);}return _0x53b69a[_0xa775('0x83')](_0x3027f9);}})['then'](function(_0x4240d2){if(_0x4240d2){return _0x4240d2?{'count':_0x4f52c1,'rows':_0x4240d2}:null;}})['then'](respondWithResult(_0x51b186,null))[_0xa775('0x48')](handleError(_0x51b186,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 77e8fea..eff02cc 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 _0x8d50=['update','remove','emit','hasOwnProperty','hook','WhatsappQueue','save'];(function(_0x480cca,_0x33709f){var _0x22bcdb=function(_0x15ab17){while(--_0x15ab17){_0x480cca['push'](_0x480cca['shift']());}};_0x22bcdb(++_0x33709f);}(_0x8d50,0xec));var _0x08d5=function(_0x11937c,_0x463468){_0x11937c=_0x11937c-0x0;var _0x1f55e9=_0x8d50[_0x11937c];return _0x1f55e9;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x08d5('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x08d5('0x1'),'afterUpdate':_0x08d5('0x2'),'afterDestroy':_0x08d5('0x3')};function emitEvent(_0x1e18bc){return function(_0x37cf52,_0x486b5c,_0x5f1b31){WhatsappQueueEvents['emit'](_0x1e18bc+':'+_0x37cf52['id'],_0x37cf52);WhatsappQueueEvents[_0x08d5('0x4')](_0x1e18bc,_0x37cf52);_0x5f1b31(null);};}for(var e in events){if(events[_0x08d5('0x5')](e)){var event=events[e];WhatsappQueue[_0x08d5('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xd6f5=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0xa5638d,_0x139854){var _0x5e5ac1=function(_0x569c82){while(--_0x569c82){_0xa5638d['push'](_0xa5638d['shift']());}};_0x5e5ac1(++_0x139854);}(_0xd6f5,0x7f));var _0x5d6f=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd6f5[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require(_0x5d6f('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x5d6f('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5d6f('0x2')](0x0);var events={'afterCreate':_0x5d6f('0x3'),'afterUpdate':_0x5d6f('0x4'),'afterDestroy':_0x5d6f('0x5')};function emitEvent(_0xd5a2d4){return function(_0xc17670,_0x294bd1,_0x1d5ac6){WhatsappQueueEvents[_0x5d6f('0x6')](_0xd5a2d4+':'+_0xc17670['id'],_0xc17670);WhatsappQueueEvents[_0x5d6f('0x6')](_0xd5a2d4,_0xc17670);_0x1d5ac6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x5d6f('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index f933b61..2586b35 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 _0xc59d=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x10fcb1,_0x28ddba){var _0x5e1b86=function(_0x5e62e6){while(--_0x5e62e6){_0x10fcb1['push'](_0x10fcb1['shift']());}};_0x5e1b86(++_0x28ddba);}(_0xc59d,0x14e));var _0xdc59=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc59d[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xdc59('0x0'));var util=require(_0xdc59('0x1'));var logger=require(_0xdc59('0x2'))(_0xdc59('0x3'));var moment=require('moment');var BPromise=require(_0xdc59('0x4'));var rp=require(_0xdc59('0x5'));var fs=require('fs');var path=require(_0xdc59('0x6'));var rimraf=require(_0xdc59('0x7'));var config=require(_0xdc59('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xdc59('0x9')]=function(_0x463e07,_0x3443c3){return _0x463e07[_0xdc59('0xa')](_0xdc59('0xb'),attributes,{'tableName':_0xdc59('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1f0=['WhatsappQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappQueue.attributes','exports','define'];(function(_0x221019,_0x15c3c1){var _0x1b3cae=function(_0x7a192d){while(--_0x7a192d){_0x221019['push'](_0x221019['shift']());}};_0x1b3cae(++_0x15c3c1);}(_0xc1f0,0x79));var _0x0c1f=function(_0x263901,_0x36ae24){_0x263901=_0x263901-0x0;var _0x31f81e=_0xc1f0[_0x263901];return _0x31f81e;};'use strict';var _=require(_0x0c1f('0x0'));var util=require(_0x0c1f('0x1'));var logger=require(_0x0c1f('0x2'))(_0x0c1f('0x3'));var moment=require(_0x0c1f('0x4'));var BPromise=require(_0x0c1f('0x5'));var rp=require(_0x0c1f('0x6'));var fs=require('fs');var path=require(_0x0c1f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0c1f('0x8'));module[_0x0c1f('0x9')]=function(_0x46be7e,_0x5e3027){return _0x46be7e[_0x0c1f('0xa')](_0x0c1f('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 51aa71d..6bac316 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 _0xb39f=['WhatsappQueue','findAll','options','raw','limit','include','map','model','attributes','then','stringify','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetWhatsappQueue'];(function(_0x51488a,_0x48014e){var _0x152465=function(_0x378095){while(--_0x378095){_0x51488a['push'](_0x51488a['shift']());}};_0x152465(++_0x48014e);}(_0xb39f,0x188));var _0xfb39=function(_0x2ee6ec,_0x1775d6){_0x2ee6ec=_0x2ee6ec-0x0;var _0x3b95a7=_0xb39f[_0x2ee6ec];return _0x3b95a7;};'use strict';var _=require(_0xfb39('0x0'));var util=require(_0xfb39('0x1'));var moment=require(_0xfb39('0x2'));var BPromise=require(_0xfb39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb39('0x4'));var db=require(_0xfb39('0x5'))['db'];var utils=require(_0xfb39('0x6'));var logger=require('../../config/logger')(_0xfb39('0x7'));var config=require(_0xfb39('0x8'));var jayson=require(_0xfb39('0x9'));var client=jayson[_0xfb39('0xa')][_0xfb39('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfb39('0xc')],{'host':_0xfb39('0xd'),'port':0x18eb});var socket=require(_0xfb39('0xe'))(new Redis(config['redis']));require(_0xfb39('0xf'))[_0xfb39('0x10')](socket);function respondWithRpcPromise(_0x1c1d2b,_0x157d3e,_0x1d01ec){return new BPromise(function(_0x538968,_0x4ed017){return client[_0xfb39('0x11')](_0x1c1d2b,_0x1d01ec)['then'](function(_0x1f6f19){logger[_0xfb39('0x12')](_0xfb39('0x13'),_0x157d3e,'request\x20sent');logger[_0xfb39('0x14')](_0xfb39('0x15'),_0x157d3e,_0xfb39('0x16'),JSON['stringify'](_0x1f6f19));if(_0x1f6f19['error']){if(_0x1f6f19[_0xfb39('0x17')][_0xfb39('0x18')]===0x1f4){logger['error'](_0xfb39('0x13'),_0x157d3e,_0x1f6f19[_0xfb39('0x17')][_0xfb39('0x19')]);return _0x4ed017(_0x1f6f19['error']['message']);}logger[_0xfb39('0x17')](_0xfb39('0x13'),_0x157d3e,_0x1f6f19['error'][_0xfb39('0x19')]);return _0x538968(_0x1f6f19['error']['message']);}else{logger[_0xfb39('0x12')](_0xfb39('0x13'),_0x157d3e,_0xfb39('0x16'));_0x538968(_0x1f6f19['result'][_0xfb39('0x19')]);}})[_0xfb39('0x1a')](function(_0x51eb40){logger[_0xfb39('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x157d3e,_0x51eb40);_0x4ed017(_0x51eb40);});});}exports[_0xfb39('0x1b')]=function(_0x1eb03e){var _0x2b7567=this;return new Promise(function(_0x375d4a,_0x36a9b5){return db[_0xfb39('0x1c')][_0xfb39('0x1d')]({'raw':_0x1eb03e['options']?_0x1eb03e[_0xfb39('0x1e')][_0xfb39('0x1f')]===undefined?!![]:![]:!![],'where':_0x1eb03e[_0xfb39('0x1e')]?_0x1eb03e[_0xfb39('0x1e')]['where']||null:null,'attributes':_0x1eb03e['options']?_0x1eb03e['options']['attributes']||null:null,'limit':_0x1eb03e[_0xfb39('0x1e')]?_0x1eb03e['options'][_0xfb39('0x20')]||null:null,'include':_0x1eb03e['options']?_0x1eb03e[_0xfb39('0x1e')][_0xfb39('0x21')]?_[_0xfb39('0x22')](_0x1eb03e['options']['include'],function(_0xbbeff8){return{'model':db[_0xbbeff8[_0xfb39('0x23')]],'as':_0xbbeff8['as'],'attributes':_0xbbeff8['attributes'],'include':_0xbbeff8[_0xfb39('0x21')]?_[_0xfb39('0x22')](_0xbbeff8[_0xfb39('0x21')],function(_0x1ad70f){return{'model':db[_0x1ad70f[_0xfb39('0x23')]],'as':_0x1ad70f['as'],'attributes':_0x1ad70f[_0xfb39('0x24')],'include':_0x1ad70f[_0xfb39('0x21')]?_['map'](_0x1ad70f[_0xfb39('0x21')],function(_0x20c6db){return{'model':db[_0x20c6db['model']],'as':_0x20c6db['as'],'attributes':_0x20c6db[_0xfb39('0x24')]};}):[]};}):[]};}):[]:[]})[_0xfb39('0x25')](function(_0x458bf4){logger[_0xfb39('0x12')](_0xfb39('0x1b'),_0x1eb03e);logger[_0xfb39('0x14')]('GetWhatsappQueue',_0x1eb03e,JSON[_0xfb39('0x26')](_0x458bf4));_0x375d4a(_0x458bf4);})[_0xfb39('0x1a')](function(_0x4a525b){logger[_0xfb39('0x17')](_0xfb39('0x1b'),_0x4a525b[_0xfb39('0x19')],_0x1eb03e);_0x36a9b5(_0x2b7567['error'](0x1f4,_0x4a525b['message']));});});};exports[_0xfb39('0x27')]=function(_0xa8c8a){var _0x52283f=this;return new Promise(function(_0x2d3e6,_0x4886b7){return db[_0xfb39('0x1c')][_0xfb39('0x28')]({'raw':_0xa8c8a[_0xfb39('0x1e')]?_0xa8c8a[_0xfb39('0x1e')][_0xfb39('0x1f')]===undefined?!![]:![]:!![],'where':_0xa8c8a[_0xfb39('0x1e')]?_0xa8c8a[_0xfb39('0x1e')][_0xfb39('0x29')]||null:null,'attributes':_0xa8c8a[_0xfb39('0x1e')]?_0xa8c8a[_0xfb39('0x1e')]['attributes']||null:null,'include':_0xa8c8a[_0xfb39('0x1e')]?_0xa8c8a[_0xfb39('0x1e')]['include']?_[_0xfb39('0x22')](_0xa8c8a[_0xfb39('0x1e')]['include'],function(_0x2d3bc5){return{'model':db[_0x2d3bc5[_0xfb39('0x23')]],'as':_0x2d3bc5['as'],'attributes':_0x2d3bc5[_0xfb39('0x24')],'include':_0x2d3bc5[_0xfb39('0x21')]?_[_0xfb39('0x22')](_0x2d3bc5[_0xfb39('0x21')],function(_0x808f7e){return{'model':db[_0x808f7e[_0xfb39('0x23')]],'as':_0x808f7e['as'],'attributes':_0x808f7e[_0xfb39('0x24')],'include':_0x808f7e[_0xfb39('0x21')]?_[_0xfb39('0x22')](_0x808f7e['include'],function(_0x2ede52){return{'model':db[_0x2ede52[_0xfb39('0x23')]],'as':_0x2ede52['as'],'attributes':_0x2ede52[_0xfb39('0x24')]};}):[]};}):[]};}):[]:[]})[_0xfb39('0x25')](function(_0x107403){logger[_0xfb39('0x12')]('ShowWhatsappQueue',_0xa8c8a);logger[_0xfb39('0x14')](_0xfb39('0x27'),_0xa8c8a,JSON[_0xfb39('0x26')](_0x107403));_0x2d3e6(_0x107403);})[_0xfb39('0x1a')](function(_0xec645c){logger[_0xfb39('0x17')](_0xfb39('0x27'),_0xec645c[_0xfb39('0x19')],_0xa8c8a);_0x4886b7(_0x52283f[_0xfb39('0x17')](0x1f4,_0xec645c[_0xfb39('0x19')]));});});}; \ No newline at end of file +var _0x2d05=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','find','raw'];(function(_0x36332d,_0x274d7f){var _0x19ace7=function(_0x4edf76){while(--_0x4edf76){_0x36332d['push'](_0x36332d['shift']());}};_0x19ace7(++_0x274d7f);}(_0x2d05,0x1a4));var _0x52d0=function(_0x5e0502,_0x11be0d){_0x5e0502=_0x5e0502-0x0;var _0x1259c2=_0x2d05[_0x5e0502];return _0x1259c2;};'use strict';var _=require(_0x52d0('0x0'));var util=require(_0x52d0('0x1'));var moment=require(_0x52d0('0x2'));var BPromise=require(_0x52d0('0x3'));var rs=require(_0x52d0('0x4'));var fs=require('fs');var Redis=require(_0x52d0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x52d0('0x6'));var logger=require(_0x52d0('0x7'))(_0x52d0('0x8'));var config=require(_0x52d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x52d0('0xa')]({'port':0x232a});config[_0x52d0('0xb')]=_[_0x52d0('0xc')](config[_0x52d0('0xb')],{'host':_0x52d0('0xd'),'port':0x18eb});var socket=require(_0x52d0('0xe'))(new Redis(config[_0x52d0('0xb')]));require(_0x52d0('0xf'))[_0x52d0('0x10')](socket);function respondWithRpcPromise(_0x5d2205,_0x1d41b2,_0x5691ad){return new BPromise(function(_0x3c9327,_0x10ac61){return client[_0x52d0('0x11')](_0x5d2205,_0x5691ad)[_0x52d0('0x12')](function(_0x25f1b7){logger[_0x52d0('0x13')](_0x52d0('0x14'),_0x1d41b2,_0x52d0('0x15'));logger[_0x52d0('0x16')](_0x52d0('0x17'),_0x1d41b2,'request\x20sent',JSON['stringify'](_0x25f1b7));if(_0x25f1b7[_0x52d0('0x18')]){if(_0x25f1b7[_0x52d0('0x18')]['code']===0x1f4){logger[_0x52d0('0x18')](_0x52d0('0x14'),_0x1d41b2,_0x25f1b7[_0x52d0('0x18')][_0x52d0('0x19')]);return _0x10ac61(_0x25f1b7[_0x52d0('0x18')][_0x52d0('0x19')]);}logger[_0x52d0('0x18')](_0x52d0('0x14'),_0x1d41b2,_0x25f1b7[_0x52d0('0x18')][_0x52d0('0x19')]);return _0x3c9327(_0x25f1b7['error'][_0x52d0('0x19')]);}else{logger['info'](_0x52d0('0x14'),_0x1d41b2,_0x52d0('0x15'));_0x3c9327(_0x25f1b7[_0x52d0('0x1a')]['message']);}})[_0x52d0('0x1b')](function(_0x299aee){logger['error'](_0x52d0('0x14'),_0x1d41b2,_0x299aee);_0x10ac61(_0x299aee);});});}exports['GetWhatsappQueue']=function(_0x5b4a7a){var _0x52536c=this;return new Promise(function(_0x449214,_0x3fd8a9){return db[_0x52d0('0x1c')][_0x52d0('0x1d')]({'raw':_0x5b4a7a[_0x52d0('0x1e')]?_0x5b4a7a[_0x52d0('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5b4a7a[_0x52d0('0x1e')]?_0x5b4a7a[_0x52d0('0x1e')][_0x52d0('0x1f')]||null:null,'attributes':_0x5b4a7a[_0x52d0('0x1e')]?_0x5b4a7a[_0x52d0('0x1e')][_0x52d0('0x20')]||null:null,'limit':_0x5b4a7a[_0x52d0('0x1e')]?_0x5b4a7a[_0x52d0('0x1e')][_0x52d0('0x21')]||null:null,'include':_0x5b4a7a[_0x52d0('0x1e')]?_0x5b4a7a[_0x52d0('0x1e')][_0x52d0('0x22')]?_[_0x52d0('0x23')](_0x5b4a7a[_0x52d0('0x1e')]['include'],function(_0x533270){return{'model':db[_0x533270['model']],'as':_0x533270['as'],'attributes':_0x533270['attributes'],'include':_0x533270['include']?_[_0x52d0('0x23')](_0x533270[_0x52d0('0x22')],function(_0x423ef1){return{'model':db[_0x423ef1[_0x52d0('0x24')]],'as':_0x423ef1['as'],'attributes':_0x423ef1[_0x52d0('0x20')],'include':_0x423ef1[_0x52d0('0x22')]?_[_0x52d0('0x23')](_0x423ef1[_0x52d0('0x22')],function(_0x4cca4e){return{'model':db[_0x4cca4e['model']],'as':_0x4cca4e['as'],'attributes':_0x4cca4e['attributes']};}):[]};}):[]};}):[]:[]})[_0x52d0('0x12')](function(_0x56e5b5){logger[_0x52d0('0x13')](_0x52d0('0x25'),_0x5b4a7a);logger['debug'](_0x52d0('0x25'),_0x5b4a7a,JSON[_0x52d0('0x26')](_0x56e5b5));_0x449214(_0x56e5b5);})['catch'](function(_0x4e6387){logger['error'](_0x52d0('0x25'),_0x4e6387[_0x52d0('0x19')],_0x5b4a7a);_0x3fd8a9(_0x52536c[_0x52d0('0x18')](0x1f4,_0x4e6387[_0x52d0('0x19')]));});});};exports[_0x52d0('0x27')]=function(_0x204498){var _0x42bf3=this;return new Promise(function(_0x3a241d,_0xb4039a){return db[_0x52d0('0x1c')][_0x52d0('0x28')]({'raw':_0x204498[_0x52d0('0x1e')]?_0x204498[_0x52d0('0x1e')][_0x52d0('0x29')]===undefined?!![]:![]:!![],'where':_0x204498['options']?_0x204498[_0x52d0('0x1e')][_0x52d0('0x1f')]||null:null,'attributes':_0x204498['options']?_0x204498[_0x52d0('0x1e')][_0x52d0('0x20')]||null:null,'include':_0x204498[_0x52d0('0x1e')]?_0x204498[_0x52d0('0x1e')]['include']?_['map'](_0x204498['options'][_0x52d0('0x22')],function(_0x1aaada){return{'model':db[_0x1aaada[_0x52d0('0x24')]],'as':_0x1aaada['as'],'attributes':_0x1aaada[_0x52d0('0x20')],'include':_0x1aaada[_0x52d0('0x22')]?_[_0x52d0('0x23')](_0x1aaada['include'],function(_0x4e009f){return{'model':db[_0x4e009f[_0x52d0('0x24')]],'as':_0x4e009f['as'],'attributes':_0x4e009f[_0x52d0('0x20')],'include':_0x4e009f[_0x52d0('0x22')]?_[_0x52d0('0x23')](_0x4e009f['include'],function(_0xb7bea6){return{'model':db[_0xb7bea6[_0x52d0('0x24')]],'as':_0xb7bea6['as'],'attributes':_0xb7bea6[_0x52d0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x52d0('0x12')](function(_0x23fb3b){logger['info'](_0x52d0('0x27'),_0x204498);logger[_0x52d0('0x16')](_0x52d0('0x27'),_0x204498,JSON[_0x52d0('0x26')](_0x23fb3b));_0x3a241d(_0x23fb3b);})[_0x52d0('0x1b')](function(_0x4d5a49){logger[_0x52d0('0x18')](_0x52d0('0x27'),_0x4d5a49[_0x52d0('0x19')],_0x204498);_0xb4039a(_0x42bf3[_0x52d0('0x18')](0x1f4,_0x4d5a49[_0x52d0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c1fe992..1431877 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 _0x17ba=['register','length','whatsappQueue:','./whatsappQueue.events','save','update','emit','removeListener'];(function(_0x10b0e0,_0x2d74d8){var _0x25fd32=function(_0x42968e){while(--_0x42968e){_0x10b0e0['push'](_0x10b0e0['shift']());}};_0x25fd32(++_0x2d74d8);}(_0x17ba,0xab));var _0xa17b=function(_0x2f66af,_0x4d486a){_0x2f66af=_0x2f66af-0x0;var _0x32b3a2=_0x17ba[_0x2f66af];return _0x32b3a2;};'use strict';var WhatsappQueueEvents=require(_0xa17b('0x0'));var events=[_0xa17b('0x1'),'remove',_0xa17b('0x2')];function createListener(_0x4563da,_0x2806ac){return function(_0x3c60e5){_0x2806ac[_0xa17b('0x3')](_0x4563da,_0x3c60e5);};}function removeListener(_0x38c13c,_0x11d7b7){return function(){WhatsappQueueEvents[_0xa17b('0x4')](_0x38c13c,_0x11d7b7);};}exports[_0xa17b('0x5')]=function(_0x3cced2){for(var _0xf72ed4=0x0,_0x2e3d43=events[_0xa17b('0x6')];_0xf72ed4<_0x2e3d43;_0xf72ed4++){var _0x57f9cd=events[_0xf72ed4];var _0x2ca4d3=createListener(_0xa17b('0x7')+_0x57f9cd,_0x3cced2);WhatsappQueueEvents['on'](_0x57f9cd,_0x2ca4d3);}}; \ No newline at end of file +var _0x6ae1=['whatsappQueue:','save','remove','update','emit','removeListener','length'];(function(_0x68d80a,_0x13923e){var _0x202105=function(_0x4fdafc){while(--_0x4fdafc){_0x68d80a['push'](_0x68d80a['shift']());}};_0x202105(++_0x13923e);}(_0x6ae1,0x15f));var _0x16ae=function(_0x33dbb6,_0x3483eb){_0x33dbb6=_0x33dbb6-0x0;var _0x397273=_0x6ae1[_0x33dbb6];return _0x397273;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x16ae('0x0'),_0x16ae('0x1'),_0x16ae('0x2')];function createListener(_0x2b560d,_0x44132a){return function(_0x37f230){_0x44132a[_0x16ae('0x3')](_0x2b560d,_0x37f230);};}function removeListener(_0x298b6b,_0x25062a){return function(){WhatsappQueueEvents[_0x16ae('0x4')](_0x298b6b,_0x25062a);};}exports['register']=function(_0x47e09d){for(var _0x219c25=0x0,_0x47d3f8=events[_0x16ae('0x5')];_0x219c25<_0x47d3f8;_0x219c25++){var _0x401622=events[_0x219c25];var _0x1ba690=createListener(_0x16ae('0x6')+_0x401622,_0x47e09d);WhatsappQueueEvents['on'](_0x401622,_0x1ba690);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index c0040a9..2fed39f 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 _0xe6c0=['get','isAuthenticated','index','/describe','describe','/:id','show','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xe6c0,0x88));var _0x0e6c=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xe6c0[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require('multer');var util=require(_0x0e6c('0x0'));var path=require(_0x0e6c('0x1'));var timeout=require(_0x0e6c('0x2'));var express=require('express');var router=express[_0x0e6c('0x3')]();var auth=require(_0x0e6c('0x4'));var interaction=require(_0x0e6c('0x5'));var config=require(_0x0e6c('0x6'));var controller=require(_0x0e6c('0x7'));router[_0x0e6c('0x8')]('/',auth[_0x0e6c('0x9')](),controller[_0x0e6c('0xa')]);router[_0x0e6c('0x8')](_0x0e6c('0xb'),auth['isAuthenticated'](),controller[_0x0e6c('0xc')]);router['get'](_0x0e6c('0xd'),auth[_0x0e6c('0x9')](),controller[_0x0e6c('0xe')]);router['post']('/',auth[_0x0e6c('0x9')](),controller['create']);router['put']('/:id',auth[_0x0e6c('0x9')](),controller[_0x0e6c('0xf')]);router['delete']('/:id',auth[_0x0e6c('0x9')](),controller[_0x0e6c('0x10')]);module[_0x0e6c('0x11')]=router; \ No newline at end of file +var _0xaf11=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x5b2cb6,_0x4edd09){var _0x54b802=function(_0x16f2ca){while(--_0x16f2ca){_0x5b2cb6['push'](_0x5b2cb6['shift']());}};_0x54b802(++_0x4edd09);}(_0xaf11,0x12f));var _0x1af1=function(_0xc57949,_0x3e4648){_0xc57949=_0xc57949-0x0;var _0x331c40=_0xaf11[_0xc57949];return _0x331c40;};'use strict';var multer=require(_0x1af1('0x0'));var util=require(_0x1af1('0x1'));var path=require(_0x1af1('0x2'));var timeout=require(_0x1af1('0x3'));var express=require('express');var router=express[_0x1af1('0x4')]();var auth=require(_0x1af1('0x5'));var interaction=require(_0x1af1('0x6'));var config=require('../../config/environment');var controller=require(_0x1af1('0x7'));router[_0x1af1('0x8')]('/',auth[_0x1af1('0x9')](),controller['index']);router[_0x1af1('0x8')]('/describe',auth[_0x1af1('0x9')](),controller[_0x1af1('0xa')]);router['get'](_0x1af1('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1af1('0xc')]('/',auth[_0x1af1('0x9')](),controller[_0x1af1('0xd')]);router[_0x1af1('0xe')](_0x1af1('0xb'),auth[_0x1af1('0x9')](),controller['update']);router[_0x1af1('0xf')](_0x1af1('0xb'),auth[_0x1af1('0x9')](),controller[_0x1af1('0x10')]);module[_0x1af1('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index b57bf7a..86f2a3b 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['DATE','sequelize','STRING'];(function(_0x157e77,_0x523cb9){var _0x78f6ae=function(_0x5f51f5){while(--_0x5f51f5){_0x157e77['push'](_0x157e77['shift']());}};_0x78f6ae(++_0x523cb9);}(_0x6aa7,0x178));var _0x76aa=function(_0x3c2a5f,_0xa88029){_0x3c2a5f=_0x3c2a5f-0x0;var _0x83115d=_0x6aa7[_0x3c2a5f];return _0x83115d;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x76aa('0x1')]},'joinAt':{'type':Sequelize[_0x76aa('0x2')]},'leaveAt':{'type':Sequelize[_0x76aa('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x76aa('0x2')]},'reason':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file +var _0xa41a=['exports','STRING','DATE','sequelize'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xa41a,0x6b));var _0xaa41=function(_0x36e3bc,_0x41ca82){_0x36e3bc=_0x36e3bc-0x0;var _0x1f8fcb=_0xa41a[_0x36e3bc];return _0x1f8fcb;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xaa41('0x2')]},'joinAt':{'type':Sequelize[_0xaa41('0x3')]},'leaveAt':{'type':Sequelize[_0xaa41('0x3')]},'acceptAt':{'type':Sequelize[_0xaa41('0x3')]},'exitAt':{'type':Sequelize[_0xaa41('0x3')]},'reason':{'type':Sequelize[_0xaa41('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index d08ff47..c49df4b 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 _0x38b8=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','stack','name','send','index','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','mustache','util','to-csv','ejs','squel','crypto','querystring'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x838b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x838b('0x1'));var zipdir=require(_0x838b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x838b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x838b('0x4'));var util=require(_0x838b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x838b('0x6'));var ejs=require(_0x838b('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x838b('0x8'));var crypto=require(_0x838b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x838b('0x6'));var querystring=require(_0x838b('0xa'));var Papa=require(_0x838b('0xb'));var Redis=require('ioredis');var authService=require(_0x838b('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x838b('0xd'));var hardwareService=require(_0x838b('0xe'));var logger=require(_0x838b('0xf'))(_0x838b('0x10'));var utils=require(_0x838b('0x11'));var config=require(_0x838b('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a57cf,_0x281764){_0x281764=_0x281764||0xcc;return function(_0x13fe8a){if(_0x13fe8a){return _0x3a57cf[_0x838b('0x13')](_0x281764);}return _0x3a57cf[_0x838b('0x14')](_0x281764)[_0x838b('0x15')]();};}function respondWithResult(_0xba19e4,_0x3324de){_0x3324de=_0x3324de||0xc8;return function(_0x1ddf43){if(_0x1ddf43){return _0xba19e4['status'](_0x3324de)[_0x838b('0x16')](_0x1ddf43);}};}function respondWithFilteredResult(_0x5497fd,_0x4e1085){return function(_0x584b04){if(_0x584b04){var _0x450b9b=_0x584b04[_0x838b('0x17')],_0x1da340=_0x4e1085['offset'],_0x100ee2=_0x4e1085[_0x838b('0x18')]+_0x4e1085[_0x838b('0x19')],_0x200652;if(_0x100ee2>=_0x450b9b){_0x100ee2=_0x450b9b;_0x200652=0xc8;}else{_0x200652=0xce;}_0x5497fd[_0x838b('0x14')](_0x200652);return _0x5497fd[_0x838b('0x1a')]('Content-Range',_0x1da340+'-'+_0x100ee2+'/'+_0x450b9b)[_0x838b('0x16')](_0x584b04);}return null;};}function patchUpdates(_0x2e606b){return function(_0x49f209){try{jsonpatch[_0x838b('0x1b')](_0x49f209,_0x2e606b,!![]);}catch(_0x46eedc){return BPromise['reject'](_0x46eedc);}return _0x49f209[_0x838b('0x1c')]();};}function saveUpdates(_0x268437,_0x432a75){return function(_0x4deb91){if(_0x4deb91){return _0x4deb91[_0x838b('0x1d')](_0x268437)[_0x838b('0x1e')](function(_0x119e4e){return _0x119e4e;});}return null;};}function removeEntity(_0x1a5241,_0x371082){return function(_0x3f8848){if(_0x3f8848){return _0x3f8848[_0x838b('0x1f')]()[_0x838b('0x1e')](function(){_0x1a5241[_0x838b('0x14')](0xcc)[_0x838b('0x15')]();});}};}function handleEntityNotFound(_0x2eecf9,_0xba76){return function(_0x451089){if(!_0x451089){_0x2eecf9[_0x838b('0x13')](0x194);}return _0x451089;};}function handleError(_0x485990,_0xb9b05f){_0xb9b05f=_0xb9b05f||0x1f4;return function(_0x59be76){logger['error'](_0x59be76[_0x838b('0x20')]);if(_0x59be76[_0x838b('0x21')]){delete _0x59be76[_0x838b('0x21')];}_0x485990['status'](_0xb9b05f)[_0x838b('0x22')](_0x59be76);};}exports[_0x838b('0x23')]=function(_0x47d239,_0x19fc7b){var _0x322e3f={},_0x59fa16={},_0x576bfa={'count':0x0,'rows':[]};var _0x58e739=_['map'](db['WhatsappQueueReport']['rawAttributes'],function(_0x1e74a6){return{'name':_0x1e74a6[_0x838b('0x24')],'type':_0x1e74a6['type']['key']};});_0x59fa16[_0x838b('0x25')]=_[_0x838b('0x26')](_0x58e739,_0x838b('0x21'));_0x59fa16[_0x838b('0x27')]=_[_0x838b('0x28')](_0x47d239[_0x838b('0x27')]);_0x59fa16[_0x838b('0x29')]=_[_0x838b('0x2a')](_0x59fa16[_0x838b('0x25')],_0x59fa16['query']);_0x322e3f[_0x838b('0x2b')]=_[_0x838b('0x2a')](_0x59fa16[_0x838b('0x25')],qs[_0x838b('0x2c')](_0x47d239['query'][_0x838b('0x2c')]));_0x322e3f[_0x838b('0x2b')]=_0x322e3f[_0x838b('0x2b')][_0x838b('0x2d')]?_0x322e3f[_0x838b('0x2b')]:_0x59fa16['model'];if(!_0x47d239[_0x838b('0x27')][_0x838b('0x2e')](_0x838b('0x2f'))){_0x322e3f[_0x838b('0x19')]=qs['limit'](_0x47d239[_0x838b('0x27')][_0x838b('0x19')]);_0x322e3f['offset']=qs[_0x838b('0x18')](_0x47d239[_0x838b('0x27')][_0x838b('0x18')]);}_0x322e3f[_0x838b('0x30')]=qs[_0x838b('0x31')](_0x47d239['query'][_0x838b('0x31')]);_0x322e3f[_0x838b('0x32')]=qs['filters'](_[_0x838b('0x33')](_0x47d239['query'],_0x59fa16[_0x838b('0x29')]),_0x58e739);if(_0x47d239['query'][_0x838b('0x34')]){_0x322e3f['where']=_[_0x838b('0x35')](_0x322e3f[_0x838b('0x32')],{'$or':_[_0x838b('0x26')](_0x58e739,function(_0x47460d){if(_0x47460d[_0x838b('0x36')]!==_0x838b('0x37')){var _0x5f62f={};_0x5f62f[_0x47460d[_0x838b('0x21')]]={'$like':'%'+_0x47d239[_0x838b('0x27')][_0x838b('0x34')]+'%'};return _0x5f62f;}})});}_0x322e3f=_['merge']({},_0x322e3f,_0x47d239[_0x838b('0x38')]);var _0x5e71d5={'where':_0x322e3f[_0x838b('0x32')]};return db[_0x838b('0x39')][_0x838b('0x17')](_0x5e71d5)[_0x838b('0x1e')](function(_0xaaa45c){_0x576bfa[_0x838b('0x17')]=_0xaaa45c;if(_0x47d239[_0x838b('0x27')][_0x838b('0x3a')]){_0x322e3f['include']=[{'all':!![]}];}return db[_0x838b('0x39')][_0x838b('0x3b')](_0x322e3f);})[_0x838b('0x1e')](function(_0x16787d){_0x576bfa[_0x838b('0x3c')]=_0x16787d;return _0x576bfa;})[_0x838b('0x1e')](respondWithFilteredResult(_0x19fc7b,_0x322e3f))['catch'](handleError(_0x19fc7b,null));};exports[_0x838b('0x3d')]=function(_0x5afe8b,_0x426ab3){var _0x3e67de={'raw':!![],'where':{'id':_0x5afe8b[_0x838b('0x3e')]['id']}},_0x5639c9={};_0x5639c9[_0x838b('0x25')]=_[_0x838b('0x28')](db[_0x838b('0x39')]['rawAttributes']);_0x5639c9['query']=_[_0x838b('0x28')](_0x5afe8b[_0x838b('0x27')]);_0x5639c9['filters']=_[_0x838b('0x2a')](_0x5639c9['model'],_0x5639c9[_0x838b('0x27')]);_0x3e67de[_0x838b('0x2b')]=_[_0x838b('0x2a')](_0x5639c9[_0x838b('0x25')],qs[_0x838b('0x2c')](_0x5afe8b['query'][_0x838b('0x2c')]));_0x3e67de['attributes']=_0x3e67de[_0x838b('0x2b')]['length']?_0x3e67de[_0x838b('0x2b')]:_0x5639c9[_0x838b('0x25')];if(_0x5afe8b['query'][_0x838b('0x3a')]){_0x3e67de[_0x838b('0x3f')]=[{'all':!![]}];}_0x3e67de=_['merge']({},_0x3e67de,_0x5afe8b[_0x838b('0x38')]);return db['WhatsappQueueReport'][_0x838b('0x40')](_0x3e67de)[_0x838b('0x1e')](handleEntityNotFound(_0x426ab3,null))['then'](respondWithResult(_0x426ab3,null))[_0x838b('0x41')](handleError(_0x426ab3,null));};exports['create']=function(_0x4d7336,_0x55f812){return db['WhatsappQueueReport'][_0x838b('0x42')](_0x4d7336[_0x838b('0x43')],{})[_0x838b('0x1e')](respondWithResult(_0x55f812,0xc9))[_0x838b('0x41')](handleError(_0x55f812,null));};exports[_0x838b('0x1d')]=function(_0x1aaeb2,_0x5ebde7){if(_0x1aaeb2[_0x838b('0x43')]['id']){delete _0x1aaeb2['body']['id'];}return db[_0x838b('0x39')]['find']({'where':{'id':_0x1aaeb2[_0x838b('0x3e')]['id']}})[_0x838b('0x1e')](handleEntityNotFound(_0x5ebde7,null))[_0x838b('0x1e')](saveUpdates(_0x1aaeb2[_0x838b('0x43')],null))[_0x838b('0x1e')](respondWithResult(_0x5ebde7,null))['catch'](handleError(_0x5ebde7,null));};exports['destroy']=function(_0x3226a7,_0x3aa739){return db['WhatsappQueueReport']['find']({'where':{'id':_0x3226a7[_0x838b('0x3e')]['id']}})[_0x838b('0x1e')](handleEntityNotFound(_0x3aa739,null))[_0x838b('0x1e')](removeEntity(_0x3aa739,null))[_0x838b('0x41')](handleError(_0x3aa739,null));};exports[_0x838b('0x44')]=function(_0x1a370e,_0xbef833){return db[_0x838b('0x39')][_0x838b('0x44')]()[_0x838b('0x1e')](respondWithResult(_0xbef833,null))['catch'](handleError(_0xbef833,null));}; \ No newline at end of file +var _0xaaee=['VIRTUAL','filter','options','includeAll','findAll','rows','show','keys','length','include','merge','find','create','body','catch','params','describe','html-pdf','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/logger','api','../../config/utils','status','end','json','count','offset','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick'];(function(_0x6be2f5,_0x50a3e4){var _0x198c0b=function(_0x11bbfe){while(--_0x11bbfe){_0x6be2f5['push'](_0x6be2f5['shift']());}};_0x198c0b(++_0x50a3e4);}(_0xaaee,0xa9));var _0xeaae=function(_0x37aa2a,_0x126490){_0x37aa2a=_0x37aa2a-0x0;var _0x3c89eb=_0xaaee[_0x37aa2a];return _0x3c89eb;};'use strict';var pdf=require(_0xeaae('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeaae('0x1'));var zipdir=require(_0xeaae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeaae('0x3'));var moment=require(_0xeaae('0x4'));var BPromise=require(_0xeaae('0x5'));var Mustache=require(_0xeaae('0x6'));var util=require('util');var path=require(_0xeaae('0x7'));var sox=require(_0xeaae('0x8'));var csv=require(_0xeaae('0x9'));var ejs=require(_0xeaae('0xa'));var fs=require('fs');var _=require(_0xeaae('0xb'));var squel=require(_0xeaae('0xc'));var crypto=require('crypto');var jsforce=require(_0xeaae('0xd'));var deskjs=require(_0xeaae('0xe'));var toCsv=require(_0xeaae('0x9'));var querystring=require(_0xeaae('0xf'));var Papa=require(_0xeaae('0x10'));var Redis=require(_0xeaae('0x11'));var authService=require(_0xeaae('0x12'));var qs=require(_0xeaae('0x13'));var as=require(_0xeaae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeaae('0x15'))(_0xeaae('0x16'));var utils=require(_0xeaae('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ae51,_0xf4e6b7){_0xf4e6b7=_0xf4e6b7||0xcc;return function(_0x16c851){if(_0x16c851){return _0x24ae51['sendStatus'](_0xf4e6b7);}return _0x24ae51[_0xeaae('0x18')](_0xf4e6b7)[_0xeaae('0x19')]();};}function respondWithResult(_0x3b1578,_0x3f46ff){_0x3f46ff=_0x3f46ff||0xc8;return function(_0x4f3501){if(_0x4f3501){return _0x3b1578['status'](_0x3f46ff)[_0xeaae('0x1a')](_0x4f3501);}};}function respondWithFilteredResult(_0x1b4f7e,_0x8dc1ac){return function(_0x25b974){if(_0x25b974){var _0x49741a=_0x25b974[_0xeaae('0x1b')],_0x1dd48f=_0x8dc1ac[_0xeaae('0x1c')],_0x5be794=_0x8dc1ac[_0xeaae('0x1c')]+_0x8dc1ac['limit'],_0x29bd11;if(_0x5be794>=_0x49741a){_0x5be794=_0x49741a;_0x29bd11=0xc8;}else{_0x29bd11=0xce;}_0x1b4f7e['status'](_0x29bd11);return _0x1b4f7e['set']('Content-Range',_0x1dd48f+'-'+_0x5be794+'/'+_0x49741a)[_0xeaae('0x1a')](_0x25b974);}return null;};}function patchUpdates(_0x1590d2){return function(_0x5b169d){try{jsonpatch[_0xeaae('0x1d')](_0x5b169d,_0x1590d2,!![]);}catch(_0x5cc79c){return BPromise[_0xeaae('0x1e')](_0x5cc79c);}return _0x5b169d[_0xeaae('0x1f')]();};}function saveUpdates(_0x3491a6,_0x52de90){return function(_0x3be7cf){if(_0x3be7cf){return _0x3be7cf[_0xeaae('0x20')](_0x3491a6)['then'](function(_0x590a27){return _0x590a27;});}return null;};}function removeEntity(_0x2cbdbb,_0x5ee523){return function(_0x48f4a9){if(_0x48f4a9){return _0x48f4a9[_0xeaae('0x21')]()[_0xeaae('0x22')](function(){_0x2cbdbb[_0xeaae('0x18')](0xcc)[_0xeaae('0x19')]();});}};}function handleEntityNotFound(_0xefe74b,_0x41739e){return function(_0x2a961c){if(!_0x2a961c){_0xefe74b[_0xeaae('0x23')](0x194);}return _0x2a961c;};}function handleError(_0x31801a,_0x1d3111){_0x1d3111=_0x1d3111||0x1f4;return function(_0x56eae0){logger[_0xeaae('0x24')](_0x56eae0[_0xeaae('0x25')]);if(_0x56eae0[_0xeaae('0x26')]){delete _0x56eae0[_0xeaae('0x26')];}_0x31801a[_0xeaae('0x18')](_0x1d3111)[_0xeaae('0x27')](_0x56eae0);};}exports[_0xeaae('0x28')]=function(_0x21690b,_0x58ac1d){var _0x51c515={},_0x261ccd={},_0x668fd2={'count':0x0,'rows':[]};var _0x3ee762=_['map'](db[_0xeaae('0x29')][_0xeaae('0x2a')],function(_0xa334c8){return{'name':_0xa334c8[_0xeaae('0x2b')],'type':_0xa334c8[_0xeaae('0x2c')][_0xeaae('0x2d')]};});_0x261ccd[_0xeaae('0x2e')]=_[_0xeaae('0x2f')](_0x3ee762,_0xeaae('0x26'));_0x261ccd[_0xeaae('0x30')]=_['keys'](_0x21690b[_0xeaae('0x30')]);_0x261ccd[_0xeaae('0x31')]=_['intersection'](_0x261ccd['model'],_0x261ccd[_0xeaae('0x30')]);_0x51c515['attributes']=_[_0xeaae('0x32')](_0x261ccd[_0xeaae('0x2e')],qs[_0xeaae('0x33')](_0x21690b['query']['fields']));_0x51c515['attributes']=_0x51c515[_0xeaae('0x34')]['length']?_0x51c515[_0xeaae('0x34')]:_0x261ccd[_0xeaae('0x2e')];if(!_0x21690b[_0xeaae('0x30')]['hasOwnProperty'](_0xeaae('0x35'))){_0x51c515[_0xeaae('0x36')]=qs[_0xeaae('0x36')](_0x21690b[_0xeaae('0x30')][_0xeaae('0x36')]);_0x51c515['offset']=qs[_0xeaae('0x1c')](_0x21690b[_0xeaae('0x30')][_0xeaae('0x1c')]);}_0x51c515[_0xeaae('0x37')]=qs[_0xeaae('0x38')](_0x21690b[_0xeaae('0x30')][_0xeaae('0x38')]);_0x51c515[_0xeaae('0x39')]=qs[_0xeaae('0x31')](_[_0xeaae('0x3a')](_0x21690b[_0xeaae('0x30')],_0x261ccd['filters']),_0x3ee762);if(_0x21690b['query']['filter']){_0x51c515['where']=_['merge'](_0x51c515[_0xeaae('0x39')],{'$or':_['map'](_0x3ee762,function(_0xc5a4a7){if(_0xc5a4a7['type']!==_0xeaae('0x3b')){var _0x588a60={};_0x588a60[_0xc5a4a7['name']]={'$like':'%'+_0x21690b[_0xeaae('0x30')][_0xeaae('0x3c')]+'%'};return _0x588a60;}})});}_0x51c515=_['merge']({},_0x51c515,_0x21690b[_0xeaae('0x3d')]);var _0x4284f={'where':_0x51c515['where']};return db[_0xeaae('0x29')][_0xeaae('0x1b')](_0x4284f)[_0xeaae('0x22')](function(_0x116833){_0x668fd2[_0xeaae('0x1b')]=_0x116833;if(_0x21690b['query'][_0xeaae('0x3e')]){_0x51c515['include']=[{'all':!![]}];}return db[_0xeaae('0x29')][_0xeaae('0x3f')](_0x51c515);})['then'](function(_0x22ce0c){_0x668fd2[_0xeaae('0x40')]=_0x22ce0c;return _0x668fd2;})[_0xeaae('0x22')](respondWithFilteredResult(_0x58ac1d,_0x51c515))['catch'](handleError(_0x58ac1d,null));};exports[_0xeaae('0x41')]=function(_0x37f92b,_0x3cabe6){var _0x40d844={'raw':!![],'where':{'id':_0x37f92b['params']['id']}},_0x1386ca={};_0x1386ca['model']=_[_0xeaae('0x42')](db[_0xeaae('0x29')][_0xeaae('0x2a')]);_0x1386ca['query']=_[_0xeaae('0x42')](_0x37f92b['query']);_0x1386ca[_0xeaae('0x31')]=_['intersection'](_0x1386ca[_0xeaae('0x2e')],_0x1386ca[_0xeaae('0x30')]);_0x40d844[_0xeaae('0x34')]=_['intersection'](_0x1386ca[_0xeaae('0x2e')],qs['fields'](_0x37f92b[_0xeaae('0x30')]['fields']));_0x40d844['attributes']=_0x40d844[_0xeaae('0x34')][_0xeaae('0x43')]?_0x40d844['attributes']:_0x1386ca[_0xeaae('0x2e')];if(_0x37f92b[_0xeaae('0x30')][_0xeaae('0x3e')]){_0x40d844[_0xeaae('0x44')]=[{'all':!![]}];}_0x40d844=_[_0xeaae('0x45')]({},_0x40d844,_0x37f92b[_0xeaae('0x3d')]);return db['WhatsappQueueReport'][_0xeaae('0x46')](_0x40d844)[_0xeaae('0x22')](handleEntityNotFound(_0x3cabe6,null))[_0xeaae('0x22')](respondWithResult(_0x3cabe6,null))['catch'](handleError(_0x3cabe6,null));};exports['create']=function(_0x5479b3,_0xf6db32){return db['WhatsappQueueReport'][_0xeaae('0x47')](_0x5479b3[_0xeaae('0x48')],{})[_0xeaae('0x22')](respondWithResult(_0xf6db32,0xc9))[_0xeaae('0x49')](handleError(_0xf6db32,null));};exports[_0xeaae('0x20')]=function(_0x57a5ff,_0x2ea077){if(_0x57a5ff['body']['id']){delete _0x57a5ff['body']['id'];}return db[_0xeaae('0x29')][_0xeaae('0x46')]({'where':{'id':_0x57a5ff[_0xeaae('0x4a')]['id']}})[_0xeaae('0x22')](handleEntityNotFound(_0x2ea077,null))[_0xeaae('0x22')](saveUpdates(_0x57a5ff[_0xeaae('0x48')],null))[_0xeaae('0x22')](respondWithResult(_0x2ea077,null))[_0xeaae('0x49')](handleError(_0x2ea077,null));};exports[_0xeaae('0x21')]=function(_0x246612,_0x407a09){return db[_0xeaae('0x29')][_0xeaae('0x46')]({'where':{'id':_0x246612[_0xeaae('0x4a')]['id']}})['then'](handleEntityNotFound(_0x407a09,null))[_0xeaae('0x22')](removeEntity(_0x407a09,null))['catch'](handleError(_0x407a09,null));};exports[_0xeaae('0x4b')]=function(_0x8ab30c,_0x1a6304){return db[_0xeaae('0x29')]['describe']()[_0xeaae('0x22')](respondWithResult(_0x1a6304,null))['catch'](handleError(_0x1a6304,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index ce6c65a..96c20e6 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 _0x5100=['../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappQueueReport.attributes','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x142bba,_0xfc048e){var _0x10b720=function(_0x595c9d){while(--_0x595c9d){_0x142bba['push'](_0x142bba['shift']());}};_0x10b720(++_0xfc048e);}(_0x5100,0x132));var _0x0510=function(_0x240e0e,_0x55957d){_0x240e0e=_0x240e0e-0x0;var _0x25944d=_0x5100[_0x240e0e];return _0x25944d;};'use strict';var _=require(_0x0510('0x0'));var util=require(_0x0510('0x1'));var logger=require(_0x0510('0x2'))(_0x0510('0x3'));var moment=require(_0x0510('0x4'));var BPromise=require(_0x0510('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0510('0x6'));var rimraf=require('rimraf');var config=require(_0x0510('0x7'));var attributes=require(_0x0510('0x8'));module['exports']=function(_0x314bfe,_0x187274){return _0x314bfe['define']('WhatsappQueueReport',attributes,{'tableName':_0x0510('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0510('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0309=['../../config/logger','api','moment','request-promise','path','./whatsappQueueReport.attributes','define','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0x0309,0x8d));var _0x9030=function(_0x3ff777,_0x5509d3){_0x3ff777=_0x3ff777-0x0;var _0x3cf2df=_0x0309[_0x3ff777];return _0x3cf2df;};'use strict';var _=require(_0x9030('0x0'));var util=require(_0x9030('0x1'));var logger=require(_0x9030('0x2'))(_0x9030('0x3'));var moment=require(_0x9030('0x4'));var BPromise=require('bluebird');var rp=require(_0x9030('0x5'));var fs=require('fs');var path=require(_0x9030('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9030('0x7'));module['exports']=function(_0x56913f,_0x58c3db){return _0x56913f[_0x9030('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x9030('0x9'),'paranoid':![],'indexes':[{'name':_0x9030('0xa'),'fields':[_0x9030('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index be35978..90333d1 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 _0x9695=['body','options','raw','CreateWhatsappQueueReport','stringify','catch','UpdateWhatsappQueueReport','update','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','WhatsappQueueReport','create'];(function(_0xcb96f6,_0x4b3983){var _0xf2c01c=function(_0x1311d6){while(--_0x1311d6){_0xcb96f6['push'](_0xcb96f6['shift']());}};_0xf2c01c(++_0x4b3983);}(_0x9695,0x17f));var _0x5969=function(_0x58d5a9,_0x1d6a52){_0x58d5a9=_0x58d5a9-0x0;var _0x4f25f5=_0x9695[_0x58d5a9];return _0x4f25f5;};'use strict';var _=require('lodash');var util=require(_0x5969('0x0'));var moment=require(_0x5969('0x1'));var BPromise=require('bluebird');var rs=require(_0x5969('0x2'));var fs=require('fs');var Redis=require(_0x5969('0x3'));var db=require(_0x5969('0x4'))['db'];var utils=require(_0x5969('0x5'));var logger=require(_0x5969('0x6'))('rpc');var config=require(_0x5969('0x7'));var jayson=require(_0x5969('0x8'));var client=jayson['client'][_0x5969('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbda141,_0x51f9b9,_0x3568fc){return new BPromise(function(_0x49ea7e,_0xcbb888){return client['request'](_0xbda141,_0x3568fc)[_0x5969('0xa')](function(_0x3d7dfa){logger[_0x5969('0xb')](_0x5969('0xc'),_0x51f9b9,_0x5969('0xd'));logger[_0x5969('0xe')](_0x5969('0xf'),_0x51f9b9,'request\x20sent',JSON['stringify'](_0x3d7dfa));if(_0x3d7dfa[_0x5969('0x10')]){if(_0x3d7dfa[_0x5969('0x10')]['code']===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x51f9b9,_0x3d7dfa[_0x5969('0x10')][_0x5969('0x11')]);return _0xcbb888(_0x3d7dfa[_0x5969('0x10')][_0x5969('0x11')]);}logger[_0x5969('0x10')](_0x5969('0xc'),_0x51f9b9,_0x3d7dfa['error'][_0x5969('0x11')]);return _0x49ea7e(_0x3d7dfa['error']['message']);}else{logger[_0x5969('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x51f9b9,'request\x20sent');_0x49ea7e(_0x3d7dfa['result']['message']);}})['catch'](function(_0x24394b){logger['error'](_0x5969('0xc'),_0x51f9b9,_0x24394b);_0xcbb888(_0x24394b);});});}exports['CreateWhatsappQueueReport']=function(_0x18257c){var _0x1e16f2=this;return new Promise(function(_0x1e9962,_0x39c441){return db[_0x5969('0x12')][_0x5969('0x13')](_0x18257c[_0x5969('0x14')],{'raw':_0x18257c[_0x5969('0x15')]?_0x18257c['options'][_0x5969('0x16')]===undefined?!![]:![]:!![]})[_0x5969('0xa')](function(_0x4acaf3){logger[_0x5969('0xb')](_0x5969('0x17'),_0x18257c);logger[_0x5969('0xe')](_0x5969('0x17'),_0x18257c,JSON[_0x5969('0x18')](_0x4acaf3));_0x1e9962(_0x4acaf3);})[_0x5969('0x19')](function(_0x5acd92){logger['error'](_0x5969('0x17'),_0x5acd92[_0x5969('0x11')],_0x18257c);_0x39c441(_0x1e16f2[_0x5969('0x10')](0x1f4,_0x5acd92[_0x5969('0x11')]));});});};exports[_0x5969('0x1a')]=function(_0x1b4511){var _0x21c35c=this;return new Promise(function(_0x2e07c4,_0x37328d){return db[_0x5969('0x12')][_0x5969('0x1b')](_0x1b4511[_0x5969('0x14')],{'raw':_0x1b4511[_0x5969('0x15')]?_0x1b4511['options'][_0x5969('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b4511[_0x5969('0x15')]?_0x1b4511[_0x5969('0x15')][_0x5969('0x1c')]||null:null,'attributes':_0x1b4511[_0x5969('0x15')]?_0x1b4511['options'][_0x5969('0x1d')]||null:null,'limit':_0x1b4511[_0x5969('0x15')]?_0x1b4511[_0x5969('0x15')][_0x5969('0x1e')]||null:null})[_0x5969('0xa')](function(_0x336e72){logger[_0x5969('0xb')](_0x5969('0x1a'),_0x1b4511);logger[_0x5969('0xe')]('UpdateWhatsappQueueReport',_0x1b4511,JSON['stringify'](_0x336e72));_0x2e07c4(_0x336e72);})[_0x5969('0x19')](function(_0x341bba){logger['error']('UpdateWhatsappQueueReport',_0x341bba['message'],_0x1b4511);_0x37328d(_0x21c35c[_0x5969('0x10')](0x1f4,_0x341bba[_0x5969('0x11')]));});});}; \ No newline at end of file +var _0x1ff1=['lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','where','attributes','UpdateWhatsappQueueReport'];(function(_0x3c80fd,_0x3b6149){var _0x390a9d=function(_0x47b446){while(--_0x47b446){_0x3c80fd['push'](_0x3c80fd['shift']());}};_0x390a9d(++_0x3b6149);}(_0x1ff1,0x1c2));var _0x11ff=function(_0x21cd93,_0x3a305b){_0x21cd93=_0x21cd93-0x0;var _0x69aa37=_0x1ff1[_0x21cd93];return _0x69aa37;};'use strict';var _=require(_0x11ff('0x0'));var util=require(_0x11ff('0x1'));var moment=require('moment');var BPromise=require(_0x11ff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11ff('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x11ff('0x4'))('rpc');var config=require(_0x11ff('0x5'));var jayson=require(_0x11ff('0x6'));var client=jayson[_0x11ff('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18af19,_0x5b3269,_0x2ed378){return new BPromise(function(_0x584a18,_0x4a8e5e){return client[_0x11ff('0x8')](_0x18af19,_0x2ed378)[_0x11ff('0x9')](function(_0x3022c0){logger[_0x11ff('0xa')](_0x11ff('0xb'),_0x5b3269,_0x11ff('0xc'));logger[_0x11ff('0xd')](_0x11ff('0xe'),_0x5b3269,'request\x20sent',JSON[_0x11ff('0xf')](_0x3022c0));if(_0x3022c0['error']){if(_0x3022c0['error'][_0x11ff('0x10')]===0x1f4){logger['error'](_0x11ff('0xb'),_0x5b3269,_0x3022c0[_0x11ff('0x11')][_0x11ff('0x12')]);return _0x4a8e5e(_0x3022c0[_0x11ff('0x11')][_0x11ff('0x12')]);}logger[_0x11ff('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5b3269,_0x3022c0[_0x11ff('0x11')][_0x11ff('0x12')]);return _0x584a18(_0x3022c0[_0x11ff('0x11')][_0x11ff('0x12')]);}else{logger[_0x11ff('0xa')](_0x11ff('0xb'),_0x5b3269,'request\x20sent');_0x584a18(_0x3022c0[_0x11ff('0x13')][_0x11ff('0x12')]);}})[_0x11ff('0x14')](function(_0x448684){logger[_0x11ff('0x11')](_0x11ff('0xb'),_0x5b3269,_0x448684);_0x4a8e5e(_0x448684);});});}exports[_0x11ff('0x15')]=function(_0x231cbb){var _0x404680=this;return new Promise(function(_0x4f9f32,_0x4773e8){return db[_0x11ff('0x16')][_0x11ff('0x17')](_0x231cbb[_0x11ff('0x18')],{'raw':_0x231cbb[_0x11ff('0x19')]?_0x231cbb[_0x11ff('0x19')][_0x11ff('0x1a')]===undefined?!![]:![]:!![]})[_0x11ff('0x9')](function(_0xa0a8bc){logger[_0x11ff('0xa')](_0x11ff('0x15'),_0x231cbb);logger['debug'](_0x11ff('0x15'),_0x231cbb,JSON[_0x11ff('0xf')](_0xa0a8bc));_0x4f9f32(_0xa0a8bc);})[_0x11ff('0x14')](function(_0x5d9278){logger[_0x11ff('0x11')](_0x11ff('0x15'),_0x5d9278[_0x11ff('0x12')],_0x231cbb);_0x4773e8(_0x404680['error'](0x1f4,_0x5d9278['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x41f546){var _0x494e35=this;return new Promise(function(_0x122dc8,_0x354e81){return db[_0x11ff('0x16')]['update'](_0x41f546[_0x11ff('0x18')],{'raw':_0x41f546['options']?_0x41f546[_0x11ff('0x19')][_0x11ff('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41f546['options']?_0x41f546[_0x11ff('0x19')][_0x11ff('0x1b')]||null:null,'attributes':_0x41f546[_0x11ff('0x19')]?_0x41f546[_0x11ff('0x19')][_0x11ff('0x1c')]||null:null,'limit':_0x41f546[_0x11ff('0x19')]?_0x41f546[_0x11ff('0x19')]['limit']||null:null})[_0x11ff('0x9')](function(_0x417725){logger[_0x11ff('0xa')](_0x11ff('0x1d'),_0x41f546);logger[_0x11ff('0xd')](_0x11ff('0x1d'),_0x41f546,JSON[_0x11ff('0xf')](_0x417725));_0x122dc8(_0x417725);})[_0x11ff('0x14')](function(_0x277b93){logger[_0x11ff('0x11')](_0x11ff('0x1d'),_0x277b93[_0x11ff('0x12')],_0x41f546);_0x354e81(_0x494e35['error'](0x1f4,_0x277b93[_0x11ff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 909524c..42a7a37 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 _0xfc73=['util','path','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','multer'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0xfc73,0xff));var _0x3fc7=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xfc73[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0x3fc7('0x0'));var util=require(_0x3fc7('0x1'));var path=require(_0x3fc7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3fc7('0x3'));var config=require(_0x3fc7('0x4'));var controller=require(_0x3fc7('0x5'));router['get']('/',auth[_0x3fc7('0x6')](),controller[_0x3fc7('0x7')]);router['get'](_0x3fc7('0x8'),auth[_0x3fc7('0x6')](),controller[_0x3fc7('0x9')]);router['get'](_0x3fc7('0xa'),auth['isAuthenticated'](),controller[_0x3fc7('0xb')]);router[_0x3fc7('0xc')]('/',auth[_0x3fc7('0x6')](),controller['create']);router[_0x3fc7('0xd')](_0x3fc7('0xa'),auth[_0x3fc7('0x6')](),controller[_0x3fc7('0xe')]);router[_0x3fc7('0xf')]('/:id',auth[_0x3fc7('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb9e0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','update','delete','destroy','exports','multer','util','path'];(function(_0x2b59f2,_0x550b43){var _0x219eb4=function(_0x1be0a2){while(--_0x1be0a2){_0x2b59f2['push'](_0x2b59f2['shift']());}};_0x219eb4(++_0x550b43);}(_0xb9e0,0x18c));var _0x0b9e=function(_0x38c7e3,_0x34b4bc){_0x38c7e3=_0x38c7e3-0x0;var _0x34b66f=_0xb9e0[_0x38c7e3];return _0x34b66f;};'use strict';var multer=require(_0x0b9e('0x0'));var util=require(_0x0b9e('0x1'));var path=require(_0x0b9e('0x2'));var timeout=require(_0x0b9e('0x3'));var express=require(_0x0b9e('0x4'));var router=express[_0x0b9e('0x5')]();var auth=require(_0x0b9e('0x6'));var interaction=require(_0x0b9e('0x7'));var config=require(_0x0b9e('0x8'));var controller=require(_0x0b9e('0x9'));router[_0x0b9e('0xa')]('/',auth[_0x0b9e('0xb')](),controller[_0x0b9e('0xc')]);router[_0x0b9e('0xa')](_0x0b9e('0xd'),auth[_0x0b9e('0xb')](),controller['describe']);router[_0x0b9e('0xa')](_0x0b9e('0xe'),auth[_0x0b9e('0xb')](),controller[_0x0b9e('0xf')]);router[_0x0b9e('0x10')]('/',auth[_0x0b9e('0xb')](),controller['create']);router['put'](_0x0b9e('0xe'),auth[_0x0b9e('0xb')](),controller[_0x0b9e('0x11')]);router[_0x0b9e('0x12')](_0x0b9e('0xe'),auth[_0x0b9e('0xb')](),controller[_0x0b9e('0x13')]);module[_0x0b9e('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 382b977..da4d3b6 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(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'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 _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb10b,0x12a));var _0xbb10=function(_0x3494e8,_0x4111ea){_0x3494e8=_0x3494e8-0x0;var _0x20bd8c=_0xb10b[_0x3494e8];return _0x20bd8c;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 3c4b3e1..aa8d854 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 _0x63f4=['merge','filter','includeAll','include','findAll','rows','catch','show','rawAttributes','options','create','body','find','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x63f4,0x9f));var _0x463f=function(_0x2ad8d7,_0x657aad){_0x2ad8d7=_0x2ad8d7-0x0;var _0x287bd8=_0x63f4[_0x2ad8d7];return _0x287bd8;};'use strict';var pdf=require(_0x463f('0x0'));var emlformat=require(_0x463f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x463f('0x2'));var jsonpatch=require(_0x463f('0x3'));var rp=require(_0x463f('0x4'));var moment=require('moment');var BPromise=require(_0x463f('0x5'));var Mustache=require(_0x463f('0x6'));var util=require('util');var path=require(_0x463f('0x7'));var sox=require(_0x463f('0x8'));var csv=require(_0x463f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x463f('0xa'));var squel=require(_0x463f('0xb'));var crypto=require(_0x463f('0xc'));var jsforce=require(_0x463f('0xd'));var deskjs=require(_0x463f('0xe'));var toCsv=require(_0x463f('0x9'));var querystring=require(_0x463f('0xf'));var Papa=require(_0x463f('0x10'));var Redis=require(_0x463f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x463f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x463f('0x13'));var logger=require(_0x463f('0x14'))(_0x463f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x463f('0x16'))['db'];function respondWithStatusCode(_0x2a7fe7,_0x3c6477){_0x3c6477=_0x3c6477||0xcc;return function(_0x4ced06){if(_0x4ced06){return _0x2a7fe7['sendStatus'](_0x3c6477);}return _0x2a7fe7[_0x463f('0x17')](_0x3c6477)[_0x463f('0x18')]();};}function respondWithResult(_0x4e92b2,_0x3f0526){_0x3f0526=_0x3f0526||0xc8;return function(_0xeb0267){if(_0xeb0267){return _0x4e92b2['status'](_0x3f0526)[_0x463f('0x19')](_0xeb0267);}};}function respondWithFilteredResult(_0x326f73,_0xc376c8){return function(_0x5dd1a0){if(_0x5dd1a0){var _0x3544b6=_0x5dd1a0[_0x463f('0x1a')],_0x25a5fb=_0xc376c8['offset'],_0x6b162f=_0xc376c8[_0x463f('0x1b')]+_0xc376c8[_0x463f('0x1c')],_0x244fea;if(_0x6b162f>=_0x3544b6){_0x6b162f=_0x3544b6;_0x244fea=0xc8;}else{_0x244fea=0xce;}_0x326f73[_0x463f('0x17')](_0x244fea);return _0x326f73[_0x463f('0x1d')]('Content-Range',_0x25a5fb+'-'+_0x6b162f+'/'+_0x3544b6)['json'](_0x5dd1a0);}return null;};}function patchUpdates(_0x3b7c04){return function(_0x1b5c5f){try{jsonpatch[_0x463f('0x1e')](_0x1b5c5f,_0x3b7c04,!![]);}catch(_0x36cce9){return BPromise[_0x463f('0x1f')](_0x36cce9);}return _0x1b5c5f['save']();};}function saveUpdates(_0x37bc27,_0x18b11b){return function(_0x17947f){if(_0x17947f){return _0x17947f[_0x463f('0x20')](_0x37bc27)['then'](function(_0x1566c3){return _0x1566c3;});}return null;};}function removeEntity(_0x195e41,_0x1a24ce){return function(_0x5a9a1f){if(_0x5a9a1f){return _0x5a9a1f[_0x463f('0x21')]()[_0x463f('0x22')](function(){_0x195e41[_0x463f('0x17')](0xcc)[_0x463f('0x18')]();});}};}function handleEntityNotFound(_0x3fd872,_0x5055c3){return function(_0x3d84c4){if(!_0x3d84c4){_0x3fd872[_0x463f('0x23')](0x194);}return _0x3d84c4;};}function handleError(_0x31a85d,_0x4322cd){_0x4322cd=_0x4322cd||0x1f4;return function(_0x4dc5df){logger[_0x463f('0x24')](_0x4dc5df[_0x463f('0x25')]);if(_0x4dc5df[_0x463f('0x26')]){delete _0x4dc5df['name'];}_0x31a85d[_0x463f('0x17')](_0x4322cd)[_0x463f('0x27')](_0x4dc5df);};}exports[_0x463f('0x28')]=function(_0x30815e,_0x2b9ccb){var _0x3e433a={},_0x58bba7={},_0x54589b={'count':0x0,'rows':[]};var _0xee9aed=_[_0x463f('0x29')](db[_0x463f('0x2a')]['rawAttributes'],function(_0x5d1010){return{'name':_0x5d1010[_0x463f('0x2b')],'type':_0x5d1010[_0x463f('0x2c')][_0x463f('0x2d')]};});_0x58bba7[_0x463f('0x2e')]=_[_0x463f('0x29')](_0xee9aed,_0x463f('0x26'));_0x58bba7[_0x463f('0x2f')]=_[_0x463f('0x30')](_0x30815e[_0x463f('0x2f')]);_0x58bba7[_0x463f('0x31')]=_[_0x463f('0x32')](_0x58bba7[_0x463f('0x2e')],_0x58bba7['query']);_0x3e433a[_0x463f('0x33')]=_[_0x463f('0x32')](_0x58bba7[_0x463f('0x2e')],qs[_0x463f('0x34')](_0x30815e[_0x463f('0x2f')][_0x463f('0x34')]));_0x3e433a['attributes']=_0x3e433a[_0x463f('0x33')][_0x463f('0x35')]?_0x3e433a['attributes']:_0x58bba7['model'];if(!_0x30815e[_0x463f('0x2f')][_0x463f('0x36')](_0x463f('0x37'))){_0x3e433a['limit']=qs[_0x463f('0x1c')](_0x30815e[_0x463f('0x2f')][_0x463f('0x1c')]);_0x3e433a['offset']=qs['offset'](_0x30815e['query'][_0x463f('0x1b')]);}_0x3e433a['order']=qs['sort'](_0x30815e[_0x463f('0x2f')]['sort']);_0x3e433a[_0x463f('0x38')]=qs[_0x463f('0x31')](_['pick'](_0x30815e[_0x463f('0x2f')],_0x58bba7[_0x463f('0x31')]),_0xee9aed);if(_0x30815e[_0x463f('0x2f')]['filter']){_0x3e433a[_0x463f('0x38')]=_[_0x463f('0x39')](_0x3e433a['where'],{'$or':_[_0x463f('0x29')](_0xee9aed,function(_0x51e71d){if(_0x51e71d[_0x463f('0x2c')]!=='VIRTUAL'){var _0x52d5d8={};_0x52d5d8[_0x51e71d['name']]={'$like':'%'+_0x30815e['query'][_0x463f('0x3a')]+'%'};return _0x52d5d8;}})});}_0x3e433a=_[_0x463f('0x39')]({},_0x3e433a,_0x30815e['options']);var _0x537f92={'where':_0x3e433a['where']};return db[_0x463f('0x2a')][_0x463f('0x1a')](_0x537f92)['then'](function(_0x270ef1){_0x54589b[_0x463f('0x1a')]=_0x270ef1;if(_0x30815e[_0x463f('0x2f')][_0x463f('0x3b')]){_0x3e433a[_0x463f('0x3c')]=[{'all':!![]}];}return db[_0x463f('0x2a')][_0x463f('0x3d')](_0x3e433a);})[_0x463f('0x22')](function(_0x5b1398){_0x54589b[_0x463f('0x3e')]=_0x5b1398;return _0x54589b;})['then'](respondWithFilteredResult(_0x2b9ccb,_0x3e433a))[_0x463f('0x3f')](handleError(_0x2b9ccb,null));};exports[_0x463f('0x40')]=function(_0x5bc3c6,_0x4a722c){var _0x34ea7e={'raw':!![],'where':{'id':_0x5bc3c6['params']['id']}},_0x39a37c={};_0x39a37c[_0x463f('0x2e')]=_['keys'](db[_0x463f('0x2a')][_0x463f('0x41')]);_0x39a37c['query']=_[_0x463f('0x30')](_0x5bc3c6[_0x463f('0x2f')]);_0x39a37c[_0x463f('0x31')]=_[_0x463f('0x32')](_0x39a37c['model'],_0x39a37c[_0x463f('0x2f')]);_0x34ea7e[_0x463f('0x33')]=_[_0x463f('0x32')](_0x39a37c[_0x463f('0x2e')],qs['fields'](_0x5bc3c6[_0x463f('0x2f')]['fields']));_0x34ea7e['attributes']=_0x34ea7e[_0x463f('0x33')][_0x463f('0x35')]?_0x34ea7e[_0x463f('0x33')]:_0x39a37c[_0x463f('0x2e')];if(_0x5bc3c6[_0x463f('0x2f')][_0x463f('0x3b')]){_0x34ea7e[_0x463f('0x3c')]=[{'all':!![]}];}_0x34ea7e=_[_0x463f('0x39')]({},_0x34ea7e,_0x5bc3c6[_0x463f('0x42')]);return db['WhatsappTransferReport']['find'](_0x34ea7e)[_0x463f('0x22')](handleEntityNotFound(_0x4a722c,null))[_0x463f('0x22')](respondWithResult(_0x4a722c,null))[_0x463f('0x3f')](handleError(_0x4a722c,null));};exports[_0x463f('0x43')]=function(_0x10c453,_0x150dbb){return db['WhatsappTransferReport'][_0x463f('0x43')](_0x10c453[_0x463f('0x44')],{})['then'](respondWithResult(_0x150dbb,0xc9))[_0x463f('0x3f')](handleError(_0x150dbb,null));};exports[_0x463f('0x20')]=function(_0x8bb317,_0x4d999b){if(_0x8bb317[_0x463f('0x44')]['id']){delete _0x8bb317[_0x463f('0x44')]['id'];}return db[_0x463f('0x2a')][_0x463f('0x45')]({'where':{'id':_0x8bb317[_0x463f('0x46')]['id']}})[_0x463f('0x22')](handleEntityNotFound(_0x4d999b,null))['then'](saveUpdates(_0x8bb317['body'],null))[_0x463f('0x22')](respondWithResult(_0x4d999b,null))[_0x463f('0x3f')](handleError(_0x4d999b,null));};exports[_0x463f('0x21')]=function(_0x2aa8a8,_0x10e2fe){return db[_0x463f('0x2a')]['find']({'where':{'id':_0x2aa8a8[_0x463f('0x46')]['id']}})[_0x463f('0x22')](handleEntityNotFound(_0x10e2fe,null))[_0x463f('0x22')](removeEntity(_0x10e2fe,null))[_0x463f('0x3f')](handleError(_0x10e2fe,null));};exports[_0x463f('0x47')]=function(_0xbf735c,_0x22f5c8){return db[_0x463f('0x2a')][_0x463f('0x47')]()[_0x463f('0x22')](respondWithResult(_0x22f5c8,null))[_0x463f('0x3f')](handleError(_0x22f5c8,null));}; \ No newline at end of file +var _0x43a0=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','findAll','rows','show','params','includeAll','include','find','catch','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key'];(function(_0x161ae4,_0x33b6e1){var _0x3438b1=function(_0x2106a0){while(--_0x2106a0){_0x161ae4['push'](_0x161ae4['shift']());}};_0x3438b1(++_0x33b6e1);}(_0x43a0,0x159));var _0x043a=function(_0x395d72,_0x3c4192){_0x395d72=_0x395d72-0x0;var _0x4a5936=_0x43a0[_0x395d72];return _0x4a5936;};'use strict';var pdf=require(_0x043a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x043a('0x1'));var zipdir=require(_0x043a('0x2'));var jsonpatch=require(_0x043a('0x3'));var rp=require(_0x043a('0x4'));var moment=require(_0x043a('0x5'));var BPromise=require(_0x043a('0x6'));var Mustache=require(_0x043a('0x7'));var util=require(_0x043a('0x8'));var path=require(_0x043a('0x9'));var sox=require(_0x043a('0xa'));var csv=require('to-csv');var ejs=require(_0x043a('0xb'));var fs=require('fs');var _=require(_0x043a('0xc'));var squel=require(_0x043a('0xd'));var crypto=require(_0x043a('0xe'));var jsforce=require(_0x043a('0xf'));var deskjs=require(_0x043a('0x10'));var toCsv=require(_0x043a('0x11'));var querystring=require(_0x043a('0x12'));var Papa=require(_0x043a('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x043a('0x14'));var hardwareService=require(_0x043a('0x15'));var logger=require(_0x043a('0x16'))(_0x043a('0x17'));var utils=require(_0x043a('0x18'));var config=require(_0x043a('0x19'));var db=require(_0x043a('0x1a'))['db'];function respondWithStatusCode(_0x201122,_0x1c2672){_0x1c2672=_0x1c2672||0xcc;return function(_0x1ba56a){if(_0x1ba56a){return _0x201122[_0x043a('0x1b')](_0x1c2672);}return _0x201122[_0x043a('0x1c')](_0x1c2672)[_0x043a('0x1d')]();};}function respondWithResult(_0xeec951,_0x3341e1){_0x3341e1=_0x3341e1||0xc8;return function(_0x4457c7){if(_0x4457c7){return _0xeec951[_0x043a('0x1c')](_0x3341e1)[_0x043a('0x1e')](_0x4457c7);}};}function respondWithFilteredResult(_0x1851a9,_0x3f32ae){return function(_0x2a327b){if(_0x2a327b){var _0x584bba=_0x2a327b['count'],_0x2d0ee0=_0x3f32ae[_0x043a('0x1f')],_0xc7bd9a=_0x3f32ae['offset']+_0x3f32ae[_0x043a('0x20')],_0x247f08;if(_0xc7bd9a>=_0x584bba){_0xc7bd9a=_0x584bba;_0x247f08=0xc8;}else{_0x247f08=0xce;}_0x1851a9['status'](_0x247f08);return _0x1851a9[_0x043a('0x21')](_0x043a('0x22'),_0x2d0ee0+'-'+_0xc7bd9a+'/'+_0x584bba)[_0x043a('0x1e')](_0x2a327b);}return null;};}function patchUpdates(_0x238557){return function(_0x30ce3e){try{jsonpatch[_0x043a('0x23')](_0x30ce3e,_0x238557,!![]);}catch(_0x4d619f){return BPromise['reject'](_0x4d619f);}return _0x30ce3e[_0x043a('0x24')]();};}function saveUpdates(_0x4707d8,_0x1d6acb){return function(_0x1bb9c4){if(_0x1bb9c4){return _0x1bb9c4[_0x043a('0x25')](_0x4707d8)[_0x043a('0x26')](function(_0x535c15){return _0x535c15;});}return null;};}function removeEntity(_0x33a6bb,_0x1da056){return function(_0x4b0cbd){if(_0x4b0cbd){return _0x4b0cbd[_0x043a('0x27')]()[_0x043a('0x26')](function(){_0x33a6bb[_0x043a('0x1c')](0xcc)[_0x043a('0x1d')]();});}};}function handleEntityNotFound(_0x149322,_0x45073b){return function(_0x5339fd){if(!_0x5339fd){_0x149322['sendStatus'](0x194);}return _0x5339fd;};}function handleError(_0xa5a41b,_0x1db7c7){_0x1db7c7=_0x1db7c7||0x1f4;return function(_0x5cb95d){logger['error'](_0x5cb95d[_0x043a('0x28')]);if(_0x5cb95d['name']){delete _0x5cb95d[_0x043a('0x29')];}_0xa5a41b[_0x043a('0x1c')](_0x1db7c7)[_0x043a('0x2a')](_0x5cb95d);};}exports[_0x043a('0x2b')]=function(_0x1d316b,_0x55eee6){var _0x803a8e={},_0x595517={},_0x69261a={'count':0x0,'rows':[]};var _0x555450=_[_0x043a('0x2c')](db[_0x043a('0x2d')][_0x043a('0x2e')],function(_0x1c330a){return{'name':_0x1c330a[_0x043a('0x2f')],'type':_0x1c330a[_0x043a('0x30')][_0x043a('0x31')]};});_0x595517[_0x043a('0x32')]=_['map'](_0x555450,_0x043a('0x29'));_0x595517[_0x043a('0x33')]=_[_0x043a('0x34')](_0x1d316b[_0x043a('0x33')]);_0x595517[_0x043a('0x35')]=_[_0x043a('0x36')](_0x595517[_0x043a('0x32')],_0x595517[_0x043a('0x33')]);_0x803a8e[_0x043a('0x37')]=_[_0x043a('0x36')](_0x595517[_0x043a('0x32')],qs[_0x043a('0x38')](_0x1d316b['query']['fields']));_0x803a8e[_0x043a('0x37')]=_0x803a8e[_0x043a('0x37')][_0x043a('0x39')]?_0x803a8e[_0x043a('0x37')]:_0x595517[_0x043a('0x32')];if(!_0x1d316b[_0x043a('0x33')][_0x043a('0x3a')](_0x043a('0x3b'))){_0x803a8e[_0x043a('0x20')]=qs['limit'](_0x1d316b['query'][_0x043a('0x20')]);_0x803a8e[_0x043a('0x1f')]=qs['offset'](_0x1d316b['query']['offset']);}_0x803a8e['order']=qs['sort'](_0x1d316b['query'][_0x043a('0x3c')]);_0x803a8e['where']=qs[_0x043a('0x35')](_[_0x043a('0x3d')](_0x1d316b[_0x043a('0x33')],_0x595517[_0x043a('0x35')]),_0x555450);if(_0x1d316b[_0x043a('0x33')][_0x043a('0x3e')]){_0x803a8e[_0x043a('0x3f')]=_[_0x043a('0x40')](_0x803a8e[_0x043a('0x3f')],{'$or':_[_0x043a('0x2c')](_0x555450,function(_0x3b3039){if(_0x3b3039[_0x043a('0x30')]!==_0x043a('0x41')){var _0x387f7f={};_0x387f7f[_0x3b3039[_0x043a('0x29')]]={'$like':'%'+_0x1d316b['query'][_0x043a('0x3e')]+'%'};return _0x387f7f;}})});}_0x803a8e=_['merge']({},_0x803a8e,_0x1d316b[_0x043a('0x42')]);var _0x2e2e75={'where':_0x803a8e[_0x043a('0x3f')]};return db[_0x043a('0x2d')][_0x043a('0x43')](_0x2e2e75)[_0x043a('0x26')](function(_0x2aac97){_0x69261a['count']=_0x2aac97;if(_0x1d316b[_0x043a('0x33')]['includeAll']){_0x803a8e['include']=[{'all':!![]}];}return db[_0x043a('0x2d')][_0x043a('0x44')](_0x803a8e);})[_0x043a('0x26')](function(_0x303c97){_0x69261a[_0x043a('0x45')]=_0x303c97;return _0x69261a;})[_0x043a('0x26')](respondWithFilteredResult(_0x55eee6,_0x803a8e))['catch'](handleError(_0x55eee6,null));};exports[_0x043a('0x46')]=function(_0x1b63cf,_0x3721e5){var _0x247dfe={'raw':!![],'where':{'id':_0x1b63cf[_0x043a('0x47')]['id']}},_0x1f643e={};_0x1f643e[_0x043a('0x32')]=_['keys'](db[_0x043a('0x2d')][_0x043a('0x2e')]);_0x1f643e[_0x043a('0x33')]=_[_0x043a('0x34')](_0x1b63cf[_0x043a('0x33')]);_0x1f643e[_0x043a('0x35')]=_[_0x043a('0x36')](_0x1f643e[_0x043a('0x32')],_0x1f643e[_0x043a('0x33')]);_0x247dfe[_0x043a('0x37')]=_[_0x043a('0x36')](_0x1f643e[_0x043a('0x32')],qs[_0x043a('0x38')](_0x1b63cf[_0x043a('0x33')][_0x043a('0x38')]));_0x247dfe['attributes']=_0x247dfe[_0x043a('0x37')][_0x043a('0x39')]?_0x247dfe[_0x043a('0x37')]:_0x1f643e[_0x043a('0x32')];if(_0x1b63cf['query'][_0x043a('0x48')]){_0x247dfe[_0x043a('0x49')]=[{'all':!![]}];}_0x247dfe=_['merge']({},_0x247dfe,_0x1b63cf['options']);return db[_0x043a('0x2d')][_0x043a('0x4a')](_0x247dfe)[_0x043a('0x26')](handleEntityNotFound(_0x3721e5,null))[_0x043a('0x26')](respondWithResult(_0x3721e5,null))[_0x043a('0x4b')](handleError(_0x3721e5,null));};exports[_0x043a('0x4c')]=function(_0x152de5,_0x38f59c){return db[_0x043a('0x2d')][_0x043a('0x4c')](_0x152de5[_0x043a('0x4d')],{})[_0x043a('0x26')](respondWithResult(_0x38f59c,0xc9))['catch'](handleError(_0x38f59c,null));};exports['update']=function(_0x31774c,_0x6481b0){if(_0x31774c['body']['id']){delete _0x31774c[_0x043a('0x4d')]['id'];}return db[_0x043a('0x2d')][_0x043a('0x4a')]({'where':{'id':_0x31774c[_0x043a('0x47')]['id']}})[_0x043a('0x26')](handleEntityNotFound(_0x6481b0,null))[_0x043a('0x26')](saveUpdates(_0x31774c[_0x043a('0x4d')],null))['then'](respondWithResult(_0x6481b0,null))[_0x043a('0x4b')](handleError(_0x6481b0,null));};exports['destroy']=function(_0x1bd917,_0x484baa){return db[_0x043a('0x2d')][_0x043a('0x4a')]({'where':{'id':_0x1bd917[_0x043a('0x47')]['id']}})[_0x043a('0x26')](handleEntityNotFound(_0x484baa,null))['then'](removeEntity(_0x484baa,null))['catch'](handleError(_0x484baa,null));};exports[_0x043a('0x4e')]=function(_0x4a6359,_0x524daf){return db[_0x043a('0x2d')][_0x043a('0x4e')]()[_0x043a('0x26')](respondWithResult(_0x524daf,null))['catch'](handleError(_0x524daf,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ebf3c4c..d7c8f19 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 _0xfd9e=['exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_0xfd9e,0x130));var _0xefd9=function(_0x3963bd,_0x375a34){_0x3963bd=_0x3963bd-0x0;var _0x47f794=_0xfd9e[_0x3963bd];return _0x47f794;};'use strict';var _=require('lodash');var util=require(_0xefd9('0x0'));var logger=require('../../config/logger')(_0xefd9('0x1'));var moment=require(_0xefd9('0x2'));var BPromise=require(_0xefd9('0x3'));var rp=require(_0xefd9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefd9('0x5'));var config=require(_0xefd9('0x6'));var attributes=require(_0xefd9('0x7'));module[_0xefd9('0x8')]=function(_0xbdc012,_0x94e4fa){return _0xbdc012[_0xefd9('0x9')](_0xefd9('0xa'),attributes,{'tableName':_0xefd9('0xb'),'paranoid':![],'indexes':[{'name':_0xefd9('0xc'),'fields':[_0xefd9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x61ba=['path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4de1a1,_0x411368){var _0x39417a=function(_0x3c65b2){while(--_0x3c65b2){_0x4de1a1['push'](_0x4de1a1['shift']());}};_0x39417a(++_0x411368);}(_0x61ba,0x166));var _0xa61b=function(_0x362141,_0x4cfdaa){_0x362141=_0x362141-0x0;var _0x60fa60=_0x61ba[_0x362141];return _0x60fa60;};'use strict';var _=require(_0xa61b('0x0'));var util=require(_0xa61b('0x1'));var logger=require('../../config/logger')(_0xa61b('0x2'));var moment=require(_0xa61b('0x3'));var BPromise=require(_0xa61b('0x4'));var rp=require(_0xa61b('0x5'));var fs=require('fs');var path=require(_0xa61b('0x6'));var rimraf=require(_0xa61b('0x7'));var config=require(_0xa61b('0x8'));var attributes=require(_0xa61b('0x9'));module[_0xa61b('0xa')]=function(_0x395984,_0x5ccddc){return _0x395984[_0xa61b('0xb')](_0xa61b('0xc'),attributes,{'tableName':_0xa61b('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 29ed7b8..d7d2a0e 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(_0x3c24e1,_0x214c36){var _0x3b0c73=function(_0x1f42e2){while(--_0x1f42e2){_0x3c24e1['push'](_0x3c24e1['shift']());}};_0x3b0c73(++_0x214c36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x647130,_0x1071ee){var _0x28f986=function(_0x2cecbc){while(--_0x2cecbc){_0x647130['push'](_0x647130['shift']());}};_0x28f986(++_0x1071ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 01a04ef..7145b60 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e6f=['default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/logger','app','./config/pm2/config','./config/schedule','sequelize','listen','then','info','start','Online\x20apps:','map','filter','name','join','Offline\x20apps:','online','None'];(function(_0x598e2e,_0x42f1da){var _0x33aa27=function(_0x1832c3){while(--_0x1832c3){_0x598e2e['push'](_0x598e2e['shift']());}};_0x33aa27(++_0x42f1da);}(_0x6e6f,0xc6));var _0xf6e6=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0x6e6f[_0x3f8759];return _0x2d33ca;};'use strict';var _=require('lodash');var mysqldb=require(_0xf6e6('0x0'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0xf6e6('0x1'))(_0xf6e6('0x2'));var pm2=require('./config/pm2');var pm2Config=require(_0xf6e6('0x3'));var schedule=require(_0xf6e6('0x4'));var chat=require('./config/schedule/chat');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xf6e6('0x5')]['sync']()['then'](function(){return rpc[_0xf6e6('0x6')]();})[_0xf6e6('0x7')](function(_0xb7f4b1){logger[_0xf6e6('0x8')](_0xb7f4b1);return chat[_0xf6e6('0x9')]();})[_0xf6e6('0x7')](function(){return schedule[_0xf6e6('0x9')]();})[_0xf6e6('0x7')](function(){return transcribe[_0xf6e6('0x9')]();})[_0xf6e6('0x7')](function(_0x58ee95){logger['info'](_0x58ee95);return pm2['start'](pm2Config);})[_0xf6e6('0x7')](function(_0x180879){logger[_0xf6e6('0x8')](_0xf6e6('0xa'),_[_0xf6e6('0xb')](_[_0xf6e6('0xc')](_0x180879,{'status':'online'}),_0xf6e6('0xd'))[_0xf6e6('0xe')]());logger[_0xf6e6('0x8')](_0xf6e6('0xf'),_[_0xf6e6('0xb')](_[_0xf6e6('0xc')](_0x180879,function(_0x5ce5af){return _0x5ce5af['status']!==_0xf6e6('0x10');}),_0xf6e6('0xd'))['join']()||_0xf6e6('0x11'));config['seedDB']&&require('./config/seedDB')[_0xf6e6('0x12')]();require(_0xf6e6('0x13'))[_0xf6e6('0x12')]();})[_0xf6e6('0x14')](function(_0xb64ba4){logger[_0xf6e6('0x15')](_0xf6e6('0x16'),_0xb64ba4);process[_0xf6e6('0x17')](0x1);});}main(); \ No newline at end of file +var _0xee96=['map','status','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','sequelize','sync','then','listen','info','start','Online\x20apps:','filter','online','name','join','Offline\x20apps:'];(function(_0x2b672f,_0xe4bca4){var _0x2eabbe=function(_0x4f290e){while(--_0x4f290e){_0x2b672f['push'](_0x2b672f['shift']());}};_0x2eabbe(++_0xe4bca4);}(_0xee96,0xa5));var _0x6ee9=function(_0x264d3e,_0x3268f4){_0x264d3e=_0x264d3e-0x0;var _0x57ae7c=_0xee96[_0x264d3e];return _0x57ae7c;};'use strict';var _=require(_0x6ee9('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0x6ee9('0x1'))('app');var pm2=require(_0x6ee9('0x2'));var pm2Config=require(_0x6ee9('0x3'));var schedule=require(_0x6ee9('0x4'));var chat=require('./config/schedule/chat');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x6ee9('0x5')][_0x6ee9('0x6')]()[_0x6ee9('0x7')](function(){return rpc[_0x6ee9('0x8')]();})[_0x6ee9('0x7')](function(_0x424bb5){logger[_0x6ee9('0x9')](_0x424bb5);return chat['start']();})[_0x6ee9('0x7')](function(){return schedule[_0x6ee9('0xa')]();})['then'](function(){return transcribe[_0x6ee9('0xa')]();})['then'](function(_0x3be7ef){logger['info'](_0x3be7ef);return pm2[_0x6ee9('0xa')](pm2Config);})[_0x6ee9('0x7')](function(_0x15be15){logger[_0x6ee9('0x9')](_0x6ee9('0xb'),_['map'](_[_0x6ee9('0xc')](_0x15be15,{'status':_0x6ee9('0xd')}),_0x6ee9('0xe'))[_0x6ee9('0xf')]());logger['info'](_0x6ee9('0x10'),_[_0x6ee9('0x11')](_['filter'](_0x15be15,function(_0x1a4e0e){return _0x1a4e0e[_0x6ee9('0x12')]!==_0x6ee9('0xd');}),_0x6ee9('0xe'))['join']()||'None');config[_0x6ee9('0x13')]&&require(_0x6ee9('0x14'))[_0x6ee9('0x15')]();require(_0x6ee9('0x16'))[_0x6ee9('0x15')]();})[_0x6ee9('0x17')](function(_0x487280){logger[_0x6ee9('0x18')](_0x6ee9('0x19'),_0x487280);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index bc88870..c91f8f4 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 _0x214d=['basic-auth','crypto','bluebird','session','fullname','name','internal','email','permissions','md5secret','chatPause','faxPause','smsPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControlPort','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Forbidden.','catch','authorization','startsWith','Basic','User','find','then','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','getUuid','query','apikey','sub','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','secret','payload','options','verify','secrets','hex','now','toString','HS512','../../mysqldb','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x214d,0xae));var _0xd214=function(_0xac28e0,_0x46059c){_0xac28e0=_0xac28e0-0x0;var _0x43f980=_0x214d[_0xac28e0];return _0x43f980;};'use strict';var db=require(_0xd214('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var _=require('lodash');var jwt=require(_0xd214('0x1'));var expressJwt=require(_0xd214('0x2'));var compose=require(_0xd214('0x3'));var basicAuth=require(_0xd214('0x4'));var crypto=require(_0xd214('0x5'));var BPromise=require(_0xd214('0x6'));var validateJwt=expressJwt({'secret':config['secrets'][_0xd214('0x7')]});var userAttributes=['id','role',_0xd214('0x8'),_0xd214('0x9'),_0xd214('0xa'),_0xd214('0xb'),'userpic',_0xd214('0xc'),_0xd214('0xd'),'voicePause',_0xd214('0xe'),'mailPause',_0xd214('0xf'),_0xd214('0x10'),'openchannelPause','pauseType','showWebBar',_0xd214('0x11'),_0xd214('0x12'),_0xd214('0x13'),_0xd214('0x14'),'passwordResetAt','alias',_0xd214('0x15'),_0xd214('0x16'),_0xd214('0x17'),'phoneBarEnableRecording',_0xd214('0x18'),_0xd214('0x19'),_0xd214('0x1a'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0xd214('0x1b'),'hotdesk',_0xd214('0x1c'),_0xd214('0x1d')];exports[_0xd214('0x1e')]=function(){return this[_0xd214('0x1f')](!![])[_0xd214('0x20')](function(_0x4e6d38,_0x587136,_0x128f04){if(_0x4e6d38[_0xd214('0x21')]){_0x128f04();}else{return db[_0xd214('0x22')][_0xd214('0x23')]({'where':{'id':_0x4e6d38[_0xd214('0x24')]['id']},'attributes':['id',_0xd214('0x25'),_0xd214('0x26')],'raw':!![]})['then'](function(_0x24537b){if(_0x24537b&&_0x24537b[_0xd214('0x25')]){return _0x587136['status'](_0x24537b['disposition']===_0xd214('0x27')?0x195:0x193)[_0xd214('0x28')]({'message':_0x24537b[_0xd214('0x26')]===_0xd214('0x27')?'Unmanaged.':_0xd214('0x29')});}else{_0x128f04();}})[_0xd214('0x2a')](function(_0x206daf){_0x128f04(_0x206daf);});}});};exports[_0xd214('0x1f')]=function isAuthenticated(_0x131c93){return compose()[_0xd214('0x20')](function(_0x2fca83,_0x5f0672,_0xb1ce2f){if(_0x2fca83['headers'][_0xd214('0x2b')]){if(_[_0xd214('0x2c')](_0x2fca83['headers'][_0xd214('0x2b')],_0xd214('0x2d'))){var _0x54dfff=basicAuth(_0x2fca83);db[_0xd214('0x2e')][_0xd214('0x2f')]({'where':{'name':_0x54dfff[_0xd214('0x9')]}})[_0xd214('0x30')](function(_0x532fd6){if(!_0x532fd6||!_0x532fd6[_0xd214('0x31')](_0x54dfff[_0xd214('0x32')])){return _0x5f0672[_0xd214('0x33')](0x191)[_0xd214('0x28')]({'message':_0xd214('0x34')});}_0x2fca83[_0xd214('0x21')]={'id':_0x532fd6['id']};_0xb1ce2f();})[_0xd214('0x2a')](function(_0x4f977e){_0xb1ce2f(_0x4f977e);});}else if(_[_0xd214('0x2c')](_0x2fca83['headers']['authorization'],_0xd214('0x35'))){validateJwt(_0x2fca83,_0x5f0672,_0xb1ce2f);}else{if(_0x131c93){_0xb1ce2f();}else{return _0x5f0672['status'](0x193)[_0xd214('0x28')]({'message':_0xd214('0x36')});}}}else if(_0x2fca83['query']['apikey']){try{var _0x307665={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xd214('0x37')]()};verifyJwt(_0x2fca83[_0xd214('0x38')][_0xd214('0x39')],_0x307665)['then'](function(_0x129fbc){return db[_0xd214('0x2e')]['find']({'where':{'id':_0x129fbc[_0xd214('0x3a')]}})['then'](function(_0x141385){if(!_0x141385||!_[_0xd214('0x3b')](_0x141385[_0xd214('0x3c')],_0x129fbc[_0xd214('0x3d')])){return _0x5f0672['status'](0x191)[_0xd214('0x28')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x2fca83[_0xd214('0x21')]={'id':_0x141385['id']};_0xb1ce2f();});})[_0xd214('0x2a')](function(){return _0x5f0672['status'](0x191)[_0xd214('0x28')]({'message':_0xd214('0x3e')});});}catch(_0x18e3fc){_0xb1ce2f(_0x18e3fc);}}else if(_0x131c93){_0xb1ce2f();}else{return _0x5f0672[_0xd214('0x33')](0x193)['json']({'message':_0xd214('0x36')});}})[_0xd214('0x20')](function(_0x2e4a8e,_0x2963b1,_0xf5146c){if(_0x2e4a8e[_0xd214('0x21')]){db['User'][_0xd214('0x2f')]({'where':{'id':_0x2e4a8e[_0xd214('0x21')]['id']},'attributes':userAttributes})[_0xd214('0x30')](function(_0x337172){if(!_0x337172){return _0x2963b1[_0xd214('0x33')](0x194)[_0xd214('0x28')]({'message':_0xd214('0x3f')});}_0x2e4a8e[_0xd214('0x21')]=_0x337172;_0xf5146c();})[_0xd214('0x2a')](function(_0x3b2733){_0xf5146c(_0x3b2733);});}else if(_0x131c93){_0xf5146c();}else{return _0x2963b1['status'](0x194)[_0xd214('0x28')]({'message':_0xd214('0x40')});}});};exports[_0xd214('0x41')]=function canUpdate(){return compose()[_0xd214('0x20')](function(_0x32d0f0,_0x2565d6,_0x5a6975){return require(_0xd214('0x42'))['getLicense']()[_0xd214('0x30')](function(_0x30f40a){if(_0x30f40a['update']){_0x5a6975();}else{return _0x2565d6['status'](0x193)[_0xd214('0x28')]({'message':_0xd214('0x43')});}})[_0xd214('0x2a')](function(_0x2a4439){_0x5a6975(_0x2a4439);});});};exports[_0xd214('0x44')]=function(_0x4fb02e,_0x38efc0,_0x5b74b0){_0x4fb02e['isMiddleware']=!![];return _0x5b74b0();};exports[_0xd214('0x45')]=function signToken(_0x2b7f9d){return signJwt(_0x2b7f9d);};exports['setTokenCookie']=function(_0x40e24d,_0x46d513){if(!_0x40e24d[_0xd214('0x21')]){return _0x46d513['status'](0x194)[_0xd214('0x28')]({'message':_0xd214('0x46')});}var _0x4f8913={'payload':{'id':_0x40e24d['user']['id'],'role':_0x40e24d[_0xd214('0x21')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4f8913)[_0xd214('0x30')](function(_0x168362){_0x46d513[_0xd214('0x47')]('motion.token',_0x168362);_0x46d513[_0xd214('0x48')](_0xd214('0x49'));})[_0xd214('0x2a')](function(_0x59fe7d){return _0x46d513[_0xd214('0x33')](0x1f4)['send'](_0x59fe7d);});};exports[_0xd214('0x4a')]=function(_0x35c7d7){if(_[_0xd214('0x4b')](_0x35c7d7[_0xd214('0x3c')])||_['isNil'](_0x35c7d7[_0xd214('0x4c')])){return null;}else{return createJwt(_0x35c7d7);}};exports[_0xd214('0x4d')]=function(_0x161fce){_0x161fce[_0xd214('0x3c')]=generateNonce();_0x161fce[_0xd214('0x4c')]=generateIssuedAt();return createJwt(_0x161fce);};exports['regenerateApiKey']=function(_0x695198,_0x3e733d){var _0x582d97=_0x695198[_0xd214('0x38')][_0xd214('0x39')];if(_0x582d97){var _0x2b35b2={'nonce':_0x3e733d[_0xd214('0x3c')],'iat':_0x3e733d[_0xd214('0x4c')],'audience':hardwareConf[_0xd214('0x37')](),'issuer':hardwareConf[_0xd214('0x37')]()};return verifyJwt(_0x582d97,_0x2b35b2)[_0xd214('0x30')](function(){return generateApiKey(_0x3e733d);});}else{throw{'message':_0xd214('0x4e')};}};function signJwt(_0x5d547b){var _0xd3c62a=BPromise[_0xd214('0x4f')](jwt['sign'],{'context':jwt});var _0x44f932=_0x5d547b[_0xd214('0x50')]||config['secrets'][_0xd214('0x7')];return new BPromise(function(_0x1ae7b0,_0x3a9d3d){_0xd3c62a(_0x5d547b[_0xd214('0x51')],_0x44f932,_0x5d547b[_0xd214('0x52')])[_0xd214('0x30')](function(_0x30ac7a){_0x1ae7b0(_0x30ac7a);})['catch'](function(_0x495dbd){_0x3a9d3d(_0x495dbd);});});}function verifyJwt(_0x36fad5,_0x52a61a,_0x17a62b){var _0x3088fd=BPromise[_0xd214('0x4f')](jwt[_0xd214('0x53')],{'context':jwt});var _0x56a2c9=_0x17a62b||config[_0xd214('0x54')][_0xd214('0x7')];return new BPromise(function(_0x1bc92d,_0x5dcb39){_0x3088fd(_0x36fad5,_0x56a2c9,_0x52a61a)['then'](function(_0x32082d){_0x1bc92d(_0x32082d);})[_0xd214('0x2a')](function(_0x4795cc){_0x5dcb39(_0x4795cc);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0xd214('0x55'));}function generateIssuedAt(){return Math['floor'](Date[_0xd214('0x56')]()/0x3e8)[_0xd214('0x57')]();}function createJwt(_0x572de0){var _0x199628={'payload':{'iat':_0x572de0[_0xd214('0x4c')],'nonce':_0x572de0['apiKeyNonce']},'options':{'algorithm':_0xd214('0x58'),'subject':_0x572de0['id'][_0xd214('0x57')](),'issuer':hardwareConf[_0xd214('0x37')](),'audience':hardwareConf[_0xd214('0x37')]()}};return signJwt(_0x199628)[_0xd214('0x30')](function(_0x48b465){return{'iat':_0x572de0[_0xd214('0x4c')],'nonce':_0x572de0['apiKeyNonce'],'token':_0x48b465};});} \ No newline at end of file +var _0xb127=['Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','sign','secret','payload','options','promisify','randomBytes','toString','floor','now','../../mysqldb','../../config/license/hardware','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','secrets','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarRemoteControlPort','hotdesk','interface','use','findOne','params','closed','then','status','disposition','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','startsWith','authorization','Basic','User','find','pass','json','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','canUpdate','../../config/license/util','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey'];(function(_0x10d4f3,_0x4ed93d){var _0x5761d8=function(_0x11d400){while(--_0x11d400){_0x10d4f3['push'](_0x10d4f3['shift']());}};_0x5761d8(++_0x4ed93d);}(_0xb127,0xbe));var _0x7b12=function(_0x527080,_0x29e4dd){_0x527080=_0x527080-0x0;var _0x535ea1=_0xb127[_0x527080];return _0x535ea1;};'use strict';var db=require(_0x7b12('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x7b12('0x1'));var _=require(_0x7b12('0x2'));var jwt=require(_0x7b12('0x3'));var expressJwt=require('express-jwt');var compose=require(_0x7b12('0x4'));var basicAuth=require(_0x7b12('0x5'));var crypto=require(_0x7b12('0x6'));var BPromise=require(_0x7b12('0x7'));var validateJwt=expressJwt({'secret':config[_0x7b12('0x8')]['session']});var userAttributes=['id','role',_0x7b12('0x9'),_0x7b12('0xa'),_0x7b12('0xb'),_0x7b12('0xc'),_0x7b12('0xd'),_0x7b12('0xe'),_0x7b12('0xf'),_0x7b12('0x10'),_0x7b12('0x11'),'mailPause',_0x7b12('0x12'),_0x7b12('0x13'),_0x7b12('0x14'),_0x7b12('0x15'),_0x7b12('0x16'),_0x7b12('0x17'),'lastPauseAt','crudPermissions',_0x7b12('0x18'),'passwordResetAt',_0x7b12('0x19'),_0x7b12('0x1a'),_0x7b12('0x1b'),_0x7b12('0x1c'),_0x7b12('0x1d'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl',_0x7b12('0x1e'),_0x7b12('0x1f'),_0x7b12('0x20'),'userProfileId'];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x7b12('0x21')](function(_0x438f5f,_0x234f31,_0x2e70c3){if(_0x438f5f['user']){_0x2e70c3();}else{return db['ChatInteraction'][_0x7b12('0x22')]({'where':{'id':_0x438f5f[_0x7b12('0x23')]['id']},'attributes':['id',_0x7b12('0x24'),'disposition'],'raw':!![]})[_0x7b12('0x25')](function(_0x5bcfc2){if(_0x5bcfc2&&_0x5bcfc2[_0x7b12('0x24')]){return _0x234f31[_0x7b12('0x26')](_0x5bcfc2[_0x7b12('0x27')]==='unmanaged'?0x195:0x193)['json']({'message':_0x5bcfc2['disposition']===_0x7b12('0x28')?_0x7b12('0x29'):_0x7b12('0x2a')});}else{_0x2e70c3();}})[_0x7b12('0x2b')](function(_0x3dcd7b){_0x2e70c3(_0x3dcd7b);});}});};exports[_0x7b12('0x2c')]=function isAuthenticated(_0xb2ac69){return compose()['use'](function(_0x4d08b2,_0x32eba4,_0x4662ad){if(_0x4d08b2[_0x7b12('0x2d')]['authorization']){if(_[_0x7b12('0x2e')](_0x4d08b2[_0x7b12('0x2d')][_0x7b12('0x2f')],_0x7b12('0x30'))){var _0x50d551=basicAuth(_0x4d08b2);db[_0x7b12('0x31')][_0x7b12('0x32')]({'where':{'name':_0x50d551[_0x7b12('0xa')]}})[_0x7b12('0x25')](function(_0x2ae42d){if(!_0x2ae42d||!_0x2ae42d['authenticate'](_0x50d551[_0x7b12('0x33')])){return _0x32eba4[_0x7b12('0x26')](0x191)[_0x7b12('0x34')]({'message':'Wrong\x20credentials.'});}_0x4d08b2[_0x7b12('0x35')]={'id':_0x2ae42d['id']};_0x4662ad();})['catch'](function(_0x2192a0){_0x4662ad(_0x2192a0);});}else if(_[_0x7b12('0x2e')](_0x4d08b2[_0x7b12('0x2d')][_0x7b12('0x2f')],_0x7b12('0x36'))){validateJwt(_0x4d08b2,_0x32eba4,_0x4662ad);}else{if(_0xb2ac69){_0x4662ad();}else{return _0x32eba4[_0x7b12('0x26')](0x193)['json']({'message':_0x7b12('0x37')});}}}else if(_0x4d08b2[_0x7b12('0x38')][_0x7b12('0x39')]){try{var _0x54ce60={'audience':hardwareConf[_0x7b12('0x3a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x4d08b2[_0x7b12('0x38')][_0x7b12('0x39')],_0x54ce60)['then'](function(_0x2f02c1){return db[_0x7b12('0x31')][_0x7b12('0x32')]({'where':{'id':_0x2f02c1[_0x7b12('0x3b')]}})[_0x7b12('0x25')](function(_0x1caa1c){if(!_0x1caa1c||!_[_0x7b12('0x3c')](_0x1caa1c['apiKeyNonce'],_0x2f02c1[_0x7b12('0x3d')])){return _0x32eba4[_0x7b12('0x26')](0x191)[_0x7b12('0x34')]({'message':_0x7b12('0x3e')});}_0x4d08b2[_0x7b12('0x35')]={'id':_0x1caa1c['id']};_0x4662ad();});})[_0x7b12('0x2b')](function(){return _0x32eba4[_0x7b12('0x26')](0x191)[_0x7b12('0x34')]({'message':_0x7b12('0x3f')});});}catch(_0x2c0edb){_0x4662ad(_0x2c0edb);}}else if(_0xb2ac69){_0x4662ad();}else{return _0x32eba4['status'](0x193)[_0x7b12('0x34')]({'message':_0x7b12('0x37')});}})['use'](function(_0x355218,_0x50df22,_0x4cd23c){if(_0x355218[_0x7b12('0x35')]){db[_0x7b12('0x31')][_0x7b12('0x32')]({'where':{'id':_0x355218[_0x7b12('0x35')]['id']},'attributes':userAttributes})[_0x7b12('0x25')](function(_0x2805c8){if(!_0x2805c8){return _0x50df22['status'](0x194)[_0x7b12('0x34')]({'message':'User\x20not\x20found.'});}_0x355218[_0x7b12('0x35')]=_0x2805c8;_0x4cd23c();})[_0x7b12('0x2b')](function(_0x2cca83){_0x4cd23c(_0x2cca83);});}else if(_0xb2ac69){_0x4cd23c();}else{return _0x50df22['status'](0x194)[_0x7b12('0x34')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x7b12('0x40')]=function canUpdate(){return compose()[_0x7b12('0x21')](function(_0x4dcf41,_0x4ab33e,_0x29b822){return require(_0x7b12('0x41'))['getLicense']()[_0x7b12('0x25')](function(_0x4473e7){if(_0x4473e7[_0x7b12('0x42')]){_0x29b822();}else{return _0x4ab33e[_0x7b12('0x26')](0x193)['json']({'message':_0x7b12('0x43')});}})[_0x7b12('0x2b')](function(_0x1eb6fb){_0x29b822(_0x1eb6fb);});});};exports[_0x7b12('0x44')]=function(_0x399748,_0x4e7637,_0x1eeb7d){_0x399748[_0x7b12('0x44')]=!![];return _0x1eeb7d();};exports[_0x7b12('0x45')]=function signToken(_0x2bec65){return signJwt(_0x2bec65);};exports[_0x7b12('0x46')]=function(_0x2e7dd8,_0x50f85f){if(!_0x2e7dd8[_0x7b12('0x35')]){return _0x50f85f['status'](0x194)[_0x7b12('0x34')]({'message':_0x7b12('0x47')});}var _0x115963={'payload':{'id':_0x2e7dd8[_0x7b12('0x35')]['id'],'role':_0x2e7dd8[_0x7b12('0x35')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x115963)[_0x7b12('0x25')](function(_0xe2d8fd){_0x50f85f[_0x7b12('0x48')]('motion.token',_0xe2d8fd);_0x50f85f[_0x7b12('0x49')]('/dashboards/general');})[_0x7b12('0x2b')](function(_0xee1c89){return _0x50f85f[_0x7b12('0x26')](0x1f4)[_0x7b12('0x4a')](_0xee1c89);});};exports[_0x7b12('0x4b')]=function(_0x244c45){if(_[_0x7b12('0x4c')](_0x244c45[_0x7b12('0x4d')])||_['isNil'](_0x244c45[_0x7b12('0x4e')])){return null;}else{return createJwt(_0x244c45);}};exports[_0x7b12('0x4f')]=function(_0x51adf6){_0x51adf6[_0x7b12('0x4d')]=generateNonce();_0x51adf6['apiKeyIat']=generateIssuedAt();return createJwt(_0x51adf6);};exports['regenerateApiKey']=function(_0x31ea6b,_0x217a35){var _0x25996a=_0x31ea6b['query'][_0x7b12('0x39')];if(_0x25996a){var _0x447aa9={'nonce':_0x217a35['apiKeyNonce'],'iat':_0x217a35['apiKeyIat'],'audience':hardwareConf[_0x7b12('0x3a')](),'issuer':hardwareConf[_0x7b12('0x3a')]()};return verifyJwt(_0x25996a,_0x447aa9)['then'](function(){return generateApiKey(_0x217a35);});}else{throw{'message':_0x7b12('0x50')};}};function signJwt(_0x2e598f){var _0x1778e6=BPromise['promisify'](jwt[_0x7b12('0x51')],{'context':jwt});var _0x2eaca0=_0x2e598f[_0x7b12('0x52')]||config[_0x7b12('0x8')]['session'];return new BPromise(function(_0x391699,_0x1fb56a){_0x1778e6(_0x2e598f[_0x7b12('0x53')],_0x2eaca0,_0x2e598f[_0x7b12('0x54')])[_0x7b12('0x25')](function(_0x2c6156){_0x391699(_0x2c6156);})['catch'](function(_0x343c8e){_0x1fb56a(_0x343c8e);});});}function verifyJwt(_0x46ef34,_0x475622,_0x3c726a){var _0x113452=BPromise[_0x7b12('0x55')](jwt['verify'],{'context':jwt});var _0x2f372c=_0x3c726a||config['secrets']['session'];return new BPromise(function(_0x222a53,_0x2414e5){_0x113452(_0x46ef34,_0x2f372c,_0x475622)[_0x7b12('0x25')](function(_0x2c40c3){_0x222a53(_0x2c40c3);})['catch'](function(_0x4eb379){_0x2414e5(_0x4eb379);});});}function generateNonce(){return crypto[_0x7b12('0x56')](0x10)[_0x7b12('0x57')]('hex');}function generateIssuedAt(){return Math[_0x7b12('0x58')](Date[_0x7b12('0x59')]()/0x3e8)[_0x7b12('0x57')]();}function createJwt(_0x4f9657){var _0xf02155={'payload':{'iat':_0x4f9657['apiKeyIat'],'nonce':_0x4f9657[_0x7b12('0x4d')]},'options':{'algorithm':'HS512','subject':_0x4f9657['id'][_0x7b12('0x57')](),'issuer':hardwareConf[_0x7b12('0x3a')](),'audience':hardwareConf[_0x7b12('0x3a')]()}};return signJwt(_0xf02155)[_0x7b12('0x25')](function(_0x586568){return{'iat':_0x4f9657[_0x7b12('0x4e')],'nonce':_0x4f9657[_0x7b12('0x4d')],'token':_0x586568};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 1cf6e8f..f9a2a77 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 _0xa9e0=['update','close','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm','data','final','binary','write','end','unlink','decryptFile'];(function(_0x33a2b5,_0x324774){var _0x53be92=function(_0x2d711e){while(--_0x2d711e){_0x33a2b5['push'](_0x33a2b5['shift']());}};_0x53be92(++_0x324774);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var crypto=require(_0x0a9e('0x0'));var fs=require('fs');var BPromise=require(_0x0a9e('0x1'));var defaultOptions={'algorithm':_0x0a9e('0x2')};function combineOptions(_0x5dd881){var _0x550fbc={};for(var _0x18d5c9 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x18d5c9)){_0x550fbc[_0x18d5c9]=defaultOptions[_0x18d5c9];}}if(_0x5dd881){for(var _0x333808 in _0x5dd881){if(_0x5dd881[_0x0a9e('0x3')](_0x333808)){_0x550fbc[_0x333808]=_0x5dd881[_0x333808];}}}return _0x550fbc;}exports[_0x0a9e('0x4')]=function(_0x991246,_0x981158,_0x57b080,_0x219af0){return new BPromise(function(_0x441e3a,_0x2cc193){_0x219af0=combineOptions(_0x219af0);var _0x5f41ea=new Buffer(_0x57b080);var _0x503809=fs[_0x0a9e('0x5')](_0x991246);var _0x56465b=fs['createWriteStream'](_0x981158);var _0x39753a=crypto[_0x0a9e('0x6')](_0x219af0[_0x0a9e('0x7')],_0x5f41ea);_0x503809['on'](_0x0a9e('0x8'),function(_0xfeb75b){var _0xbd1168=new Buffer(_0x39753a['update'](_0xfeb75b),'binary');_0x56465b['write'](_0xbd1168);});_0x503809['on']('end',function(){try{var _0x273d4d=new Buffer(_0x39753a[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x56465b[_0x0a9e('0xb')](_0x273d4d);_0x56465b[_0x0a9e('0xc')]();_0x56465b['on']('close',function(){return _0x441e3a(_0x981158);});}catch(_0x4283ce){fs[_0x0a9e('0xd')](_0x981158);return _0x2cc193(_0x4283ce);}});});};exports[_0x0a9e('0xe')]=function(_0x281129,_0x44dcfd,_0x4d5611,_0x52a03d){return new BPromise(function(_0x22dccb,_0x5d0880){_0x52a03d=combineOptions(_0x52a03d);var _0x1985b6=new Buffer(_0x4d5611);var _0x519dfd=fs[_0x0a9e('0x5')](_0x281129);var _0x12066b=fs['createWriteStream'](_0x44dcfd);var _0x225616=crypto['createDecipher'](_0x52a03d[_0x0a9e('0x7')],_0x1985b6);_0x519dfd['on'](_0x0a9e('0x8'),function(_0x106033){var _0x205fd6=new Buffer(_0x225616[_0x0a9e('0xf')](_0x106033),_0x0a9e('0xa'));_0x12066b[_0x0a9e('0xb')](_0x205fd6);});_0x519dfd['on'](_0x0a9e('0xc'),function(){try{var _0x1314ae=new Buffer(_0x225616[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x12066b['write'](_0x1314ae);_0x12066b[_0x0a9e('0xc')]();_0x12066b['on'](_0x0a9e('0x10'),function(){return _0x22dccb(_0x44dcfd);});}catch(_0x53682f){fs[_0x0a9e('0xd')](_0x44dcfd);return _0x5d0880(_0x53682f);}});});}; \ 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(_0x222b34,_0x42df5e){var _0x8cb53d=function(_0x156e48){while(--_0x156e48){_0x222b34['push'](_0x222b34['shift']());}};_0x8cb53d(++_0x42df5e);}(_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 a72419e..165b459 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 _0x22fb=['savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','num','push','dirname','basename','.csv','split','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','lodash','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv'];(function(_0x5510ab,_0x1e22c4){var _0x9a6e3e=function(_0x3cb30d){while(--_0x3cb30d){_0x5510ab['push'](_0x5510ab['shift']());}};_0x9a6e3e(++_0x1e22c4);}(_0x22fb,0x192));var _0xb22f=function(_0x4a2f2e,_0x543e38){_0x4a2f2e=_0x4a2f2e-0x0;var _0x1675f6=_0x22fb[_0x4a2f2e];return _0x1675f6;};'use strict';var util=require('util');var path=require('path');var _=require(_0xb22f('0x0'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xb22f('0x1'));var zipdir=require(_0xb22f('0x2'));var rimraf=require(_0xb22f('0x3'));var db=require(_0xb22f('0x4'))['db'];var dbH=require(_0xb22f('0x4'))['dbH'];var logger=require(_0xb22f('0x5'))(_0xb22f('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xb22f('0x7')][0x2]);var QUERY=process[_0xb22f('0x7')][0x3];var PATH=process[_0xb22f('0x7')][0x4];function analyticExtractedReport(_0x367d4b,_0x47f61a){var _0x34433b={'status':_0x367d4b};var _0x22c509={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x47f61a){_0x34433b[_0xb22f('0x8')]=_0x47f61a;}return db[_0xb22f('0x9')][_0xb22f('0xa')](_0x34433b,_0x22c509);}function main(){var _0x3593fb=0x1388;var _0x188cea;logger[_0xb22f('0xb')](util[_0xb22f('0xc')](_0xb22f('0xd'),EXTRACTED_REPORT_ID,_0xb22f('0xe')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb22f('0xf')]})['then'](function(_0x4bb02a){if(_0x4bb02a){_0x188cea=_0x4bb02a;_0x3593fb=_0x188cea['splitSizeCsv']||0x1388;}})[_0xb22f('0x10')](function(){return dbH[_0xb22f('0x11')][_0xb22f('0x12')](util[_0xb22f('0xc')](_0xb22f('0x13'),QUERY),{'type':dbH[_0xb22f('0x11')]['QueryTypes'][_0xb22f('0x14')]});})['then'](function(_0x36e2a8){if(!_0x36e2a8[0x0]['num']){return analyticExtractedReport(_0xb22f('0x15'));}var _0x514a8f=[];var _0x160417=0x0;var _0xc36af4=!![];if(_0x36e2a8&&_0x36e2a8[_0xb22f('0x16')]){var _0x538da0=_0x36e2a8[0x0][_0xb22f('0x17')]%(_0x160417+_0x3593fb);if(_0x188cea['split']){for(;_0xc36af4;_0x160417+=_0x3593fb,_0x538da0=_0x36e2a8[0x0][_0xb22f('0x17')]%(_0x160417+_0x3593fb)){if(_0x538da0==0x0||_0x538da0==_0x36e2a8[0x0][_0xb22f('0x17')]){_0xc36af4=![];}_0x514a8f[_0xb22f('0x18')](dbH[_0xb22f('0x11')][_0xb22f('0x12')](util[_0xb22f('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3593fb,_0x160417),{'type':dbH[_0xb22f('0x11')]['QueryTypes'][_0xb22f('0x14')]}));}}else{_0x514a8f[_0xb22f('0x18')](dbH[_0xb22f('0x11')][_0xb22f('0x12')](QUERY,{'type':dbH[_0xb22f('0x11')]['QueryTypes']['SELECT']}));}}var _0x3da442=path[_0xb22f('0x19')](PATH);var _0xf34e0d=path[_0xb22f('0x1a')](PATH,_0xb22f('0x1b'));var _0xcb9a74=_0x188cea[_0xb22f('0x1c')]&&_0x514a8f[_0xb22f('0x16')]>0x1;var _0x583fbe=[];if(!fs['existsSync'](path[_0xb22f('0x1d')](_0x3da442,_0xf34e0d))&&_0xcb9a74){fs[_0xb22f('0x1e')](path['join'](_0x3da442,_0xf34e0d));}return BPromise[_0xb22f('0x1f')](_0x514a8f,function(_0x4364f5){_0x583fbe['push'](_0x4364f5);})[_0xb22f('0x10')](function(){for(var _0x2918be=0x0;_0x2918be<_0x583fbe['length'];_0x2918be+=0x1){var _0x3e471f;var _0x2c4a9e=_0x583fbe[_0x2918be];if(_0xcb9a74){_0x3e471f=path[_0xb22f('0x1d')](_0x3da442,_0xf34e0d,util[_0xb22f('0xc')](_0xb22f('0x20'),_0xf34e0d,_0x2918be,_0xb22f('0x21')));}else{_0x3e471f=path[_0xb22f('0x1d')](_0x3da442,util[_0xb22f('0xc')]('%s.%s',_0xf34e0d,'csv'));}fs['writeFileSync'](_0x3e471f,csv(_0x2c4a9e));}})[_0xb22f('0x10')](function(){if(_0xcb9a74){zipdir(path['join'](_0x3da442,_0xf34e0d),{'saveTo':path[_0xb22f('0x1d')](_0x3da442,util[_0xb22f('0xc')](_0xb22f('0x22'),_0xf34e0d,_0xb22f('0x23')))},function(_0x3bf636,_0x5b2a42){});rimraf(path['join'](_0x3da442,_0xf34e0d),function(){});}})[_0xb22f('0x10')](function(){logger[_0xb22f('0xb')](util[_0xb22f('0xc')](_0xb22f('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xb22f('0x25'),_0xcb9a74?util[_0xb22f('0xc')]('%s.%s',_0xf34e0d,_0xcb9a74?_0xb22f('0x23'):_0xb22f('0x21')):null);});})[_0xb22f('0x26')](function(_0x225194){logger[_0xb22f('0xb')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb22f('0xe')),util[_0xb22f('0x27')](_0x225194,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xb22f('0x28'));});}main(); \ No newline at end of file +var _0xa9e0=['Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','split','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x52a03d&&_0x52a03d[_0x0a9e('0x14')]){var _0x48f32d=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284);if(_0x307b3e['split']){for(;_0x16033c;_0x519dfd+=_0xf81284,_0x48f32d=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x48f32d==0x0||_0x48f32d==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x1a')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1b')](path[_0x0a9e('0x1c')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1d')](path[_0x0a9e('0x1c')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1e')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x14')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,csv(_0x33161b));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1c')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1c')](_0x20f109,util[_0x0a9e('0xb')]('%s.%s',_0x588269,_0x0a9e('0x22')))},function(_0x468813,_0x2b1f27){});rimraf(path[_0x0a9e('0x1c')](_0x20f109,_0x588269),function(){});}})['then'](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x23'),EXTRACTED_REPORT_ID,_0x0a9e('0x24')));return analyticExtractedReport(_0x0a9e('0x25'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x22'):_0x0a9e('0x1f')):null);});})['catch'](function(_0x426950){logger['info'](util[_0x0a9e('0xb')](_0x0a9e('0x26'),EXTRACTED_REPORT_ID,_0x0a9e('0x24')),util[_0x0a9e('0x27')](_0x426950,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0a9e('0x28'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 57ccefb..797d464 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(_0x17faa6,_0x58e793){var _0xb86a58=function(_0x3bad1f){while(--_0x3bad1f){_0x17faa6['push'](_0x17faa6['shift']());}};_0xb86a58(++_0x58e793);}(_0xb10b,0x12a));var _0xbb10=function(_0x49d280,_0x33d68f){_0x49d280=_0x49d280-0x0;var _0x25274a=_0xb10b[_0x49d280];return _0x25274a;};'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(_0x459b9c,_0xfd4ad8){var _0x43d1bd=function(_0x431917){while(--_0x431917){_0x459b9c['push'](_0x459b9c['shift']());}};_0x43d1bd(++_0xfd4ad8);}(_0xb10b,0x12a));var _0xbb10=function(_0x11e000,_0x12a8e5){_0x11e000=_0x11e000-0x0;var _0x110c27=_0xb10b[_0x11e000];return _0x110c27;};'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 ee3f86b..0f1f981 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 _0x9d6f=['SELECT','push','dirname','.xlsx','existsSync','join','xlsx','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x5e019e,_0x33b156){var _0x451844=function(_0x56e489){while(--_0x56e489){_0x5e019e['push'](_0x5e019e['shift']());}};_0x451844(++_0x33b156);}(_0x9d6f,0x12e));var _0xf9d6=function(_0x220e9d,_0x268920){_0x220e9d=_0x220e9d-0x0;var _0x3de965=_0x9d6f[_0x220e9d];return _0x3de965;};'use strict';var util=require(_0xf9d6('0x0'));var path=require(_0xf9d6('0x1'));var _=require(_0xf9d6('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xf9d6('0x3'));var zipdir=require(_0xf9d6('0x4'));var rimraf=require(_0xf9d6('0x5'));var db=require(_0xf9d6('0x6'))['db'];var dbH=require('../../mysqldb')[_0xf9d6('0x7')];var logger=require(_0xf9d6('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xf9d6('0x9')][0x2]);var QUERY=process[_0xf9d6('0x9')][0x3];var PATH=process[_0xf9d6('0x9')][0x4];function analyticExtractedReport(_0x493064,_0x219a84){var _0x543220={'status':_0x493064};var _0x329397={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x219a84){_0x543220['savename']=_0x219a84;}return db[_0xf9d6('0xa')][_0xf9d6('0xb')](_0x543220,_0x329397);}function main(){var _0x33863c=0x1388;var _0x1405dd;logger[_0xf9d6('0xc')](util[_0xf9d6('0xd')](_0xf9d6('0xe'),EXTRACTED_REPORT_ID,_0xf9d6('0xf')));return db[_0xf9d6('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf9d6('0x11'),_0xf9d6('0x12')]})['then'](function(_0x262067){if(_0x262067){_0x1405dd=_0x262067;_0x33863c=_0x1405dd['splitSizeXlsx']||0x1388;}})[_0xf9d6('0x13')](function(){return dbH[_0xf9d6('0x14')][_0xf9d6('0x15')](util[_0xf9d6('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf9d6('0x14')]['QueryTypes']['SELECT']});})[_0xf9d6('0x13')](function(_0x5e8d85){if(!_0x5e8d85[0x0][_0xf9d6('0x16')]){return analyticExtractedReport(_0xf9d6('0x17'));}var _0xd251ea=[];var _0x523ba2=0x0;var _0xe0e801=!![];if(_0x1405dd['split']){if(_0x5e8d85&&_0x5e8d85[_0xf9d6('0x18')]){var _0x16787e=_0x5e8d85[0x0][_0xf9d6('0x16')]%(_0x523ba2+_0x33863c);for(;_0xe0e801;_0x523ba2+=_0x33863c,_0x16787e=_0x5e8d85[0x0][_0xf9d6('0x16')]%(_0x523ba2+_0x33863c)){if(_0x16787e==0x0||_0x16787e==_0x5e8d85[0x0][_0xf9d6('0x16')]){_0xe0e801=![];}_0xd251ea['push'](dbH['sequelize'][_0xf9d6('0x15')](util[_0xf9d6('0xd')](_0xf9d6('0x19'),QUERY,_0x33863c,_0x523ba2),{'type':dbH['sequelize']['QueryTypes'][_0xf9d6('0x1a')]}));}}}else{_0xd251ea[_0xf9d6('0x1b')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xf9d6('0x14')]['QueryTypes']['SELECT']}));}var _0x5d02e0=path[_0xf9d6('0x1c')](PATH);var _0x149362=path['basename'](PATH,_0xf9d6('0x1d'));var _0x1f8c19=_0x1405dd[_0xf9d6('0x11')]&&_0xd251ea[_0xf9d6('0x18')]>0x1;var _0x5b8711=[];if(!fs[_0xf9d6('0x1e')](path[_0xf9d6('0x1f')](_0x5d02e0,_0x149362))&&_0x1f8c19){fs['mkdirSync'](path[_0xf9d6('0x1f')](_0x5d02e0,_0x149362));}return BPromise['each'](_0xd251ea,function(_0xf6dc6f){_0x5b8711[_0xf9d6('0x1b')](_0xf6dc6f);})[_0xf9d6('0x13')](function(){for(var _0x32a142=0x0;_0x32a142<_0x5b8711[_0xf9d6('0x18')];_0x32a142+=0x1){var _0xa03232;var _0x10371e=_0x5b8711[_0x32a142];if(_0x1f8c19){_0xa03232=path['join'](_0x5d02e0,_0x149362,util[_0xf9d6('0xd')]('%s%d.%s',_0x149362,_0x32a142,_0xf9d6('0x20')));}else{_0xa03232=path['join'](_0x5d02e0,util[_0xf9d6('0xd')]('%s.%s',_0x149362,_0xf9d6('0x20')));}fs[_0xf9d6('0x21')](_0xa03232,json2xls(_0x10371e),_0xf9d6('0x22'));}})[_0xf9d6('0x13')](function(){if(_0x1f8c19){zipdir(path[_0xf9d6('0x1f')](_0x5d02e0,_0x149362),{'saveTo':path[_0xf9d6('0x1f')](_0x5d02e0,util[_0xf9d6('0xd')]('%s.%s',_0x149362,_0xf9d6('0x23')))},function(_0x14a3b4,_0x4eee21){});rimraf(path[_0xf9d6('0x1f')](_0x5d02e0,_0x149362),function(){});}})[_0xf9d6('0x13')](function(){logger[_0xf9d6('0xc')](util[_0xf9d6('0xd')](_0xf9d6('0x24'),EXTRACTED_REPORT_ID,_0xf9d6('0xf')));return analyticExtractedReport(_0xf9d6('0x25'),_0x1f8c19?util['format']('%s.%s',_0x149362,_0x1f8c19?_0xf9d6('0x23'):_0xf9d6('0x20')):null);});})[_0xf9d6('0x26')](function(_0x34ebea){logger[_0xf9d6('0xc')](util[_0xf9d6('0xd')](_0xf9d6('0x27'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xf9d6('0x28')](_0x34ebea,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x79ca=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','split','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s','xlsx','binary','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','update','format','XLSX','find','splitSizeXlsx','then','sequelize','query'];(function(_0x176194,_0xb8c7cc){var _0xb65549=function(_0x5703c2){while(--_0x5703c2){_0x176194['push'](_0x176194['shift']());}};_0xb65549(++_0xb8c7cc);}(_0x79ca,0x9e));var _0xa79c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x79ca[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xa79c('0x0'));var path=require(_0xa79c('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xa79c('0x2'));var BPromise=require(_0xa79c('0x3'));var zipdir=require(_0xa79c('0x4'));var rimraf=require(_0xa79c('0x5'));var db=require(_0xa79c('0x6'))['db'];var dbH=require('../../mysqldb')[_0xa79c('0x7')];var logger=require('../../config/logger')(_0xa79c('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xa79c('0x9')][0x4];function analyticExtractedReport(_0x7afb5d,_0x44c906){var _0x58e10a={'status':_0x7afb5d};var _0x3974c4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x44c906){_0x58e10a['savename']=_0x44c906;}return db['AnalyticExtractedReport'][_0xa79c('0xa')](_0x58e10a,_0x3974c4);}function main(){var _0x2335a2=0x1388;var _0xf511a6;logger['info'](util[_0xa79c('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa79c('0xc')));return db['Setting'][_0xa79c('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xa79c('0xe')]})['then'](function(_0x2eb2d2){if(_0x2eb2d2){_0xf511a6=_0x2eb2d2;_0x2335a2=_0xf511a6[_0xa79c('0xe')]||0x1388;}})[_0xa79c('0xf')](function(){return dbH[_0xa79c('0x10')][_0xa79c('0x11')](util[_0xa79c('0xb')](_0xa79c('0x12'),QUERY),{'type':dbH[_0xa79c('0x10')][_0xa79c('0x13')][_0xa79c('0x14')]});})[_0xa79c('0xf')](function(_0x34ade8){if(!_0x34ade8[0x0]['num']){return analyticExtractedReport('Empty');}var _0x3f46f2=[];var _0x51dc6f=0x0;var _0x5692f3=!![];if(_0xf511a6[_0xa79c('0x15')]){if(_0x34ade8&&_0x34ade8[_0xa79c('0x16')]){var _0x356c1a=_0x34ade8[0x0][_0xa79c('0x17')]%(_0x51dc6f+_0x2335a2);for(;_0x5692f3;_0x51dc6f+=_0x2335a2,_0x356c1a=_0x34ade8[0x0][_0xa79c('0x17')]%(_0x51dc6f+_0x2335a2)){if(_0x356c1a==0x0||_0x356c1a==_0x34ade8[0x0][_0xa79c('0x17')]){_0x5692f3=![];}_0x3f46f2[_0xa79c('0x18')](dbH['sequelize']['query'](util[_0xa79c('0xb')](_0xa79c('0x19'),QUERY,_0x2335a2,_0x51dc6f),{'type':dbH[_0xa79c('0x10')][_0xa79c('0x13')]['SELECT']}));}}}else{_0x3f46f2[_0xa79c('0x18')](dbH[_0xa79c('0x10')][_0xa79c('0x11')](QUERY,{'type':dbH[_0xa79c('0x10')][_0xa79c('0x13')][_0xa79c('0x14')]}));}var _0xf38f65=path[_0xa79c('0x1a')](PATH);var _0x3fba78=path[_0xa79c('0x1b')](PATH,_0xa79c('0x1c'));var _0x4055fd=_0xf511a6[_0xa79c('0x15')]&&_0x3f46f2[_0xa79c('0x16')]>0x1;var _0x754855=[];if(!fs[_0xa79c('0x1d')](path[_0xa79c('0x1e')](_0xf38f65,_0x3fba78))&&_0x4055fd){fs[_0xa79c('0x1f')](path[_0xa79c('0x1e')](_0xf38f65,_0x3fba78));}return BPromise['each'](_0x3f46f2,function(_0x2d3065){_0x754855[_0xa79c('0x18')](_0x2d3065);})[_0xa79c('0xf')](function(){for(var _0x528bfa=0x0;_0x528bfa<_0x754855[_0xa79c('0x16')];_0x528bfa+=0x1){var _0x2827eb;var _0x21a296=_0x754855[_0x528bfa];if(_0x4055fd){_0x2827eb=path['join'](_0xf38f65,_0x3fba78,util['format'](_0xa79c('0x20'),_0x3fba78,_0x528bfa,'xlsx'));}else{_0x2827eb=path[_0xa79c('0x1e')](_0xf38f65,util[_0xa79c('0xb')]('%s.%s',_0x3fba78,_0xa79c('0x21')));}fs['writeFileSync'](_0x2827eb,json2xls(_0x21a296),_0xa79c('0x22'));}})[_0xa79c('0xf')](function(){if(_0x4055fd){zipdir(path[_0xa79c('0x1e')](_0xf38f65,_0x3fba78),{'saveTo':path['join'](_0xf38f65,util[_0xa79c('0xb')](_0xa79c('0x23'),_0x3fba78,_0xa79c('0x24')))},function(_0x257d58,_0x5de933){});rimraf(path[_0xa79c('0x1e')](_0xf38f65,_0x3fba78),function(){});}})[_0xa79c('0xf')](function(){logger[_0xa79c('0x25')](util[_0xa79c('0xb')](_0xa79c('0x26'),EXTRACTED_REPORT_ID,_0xa79c('0xc')));return analyticExtractedReport(_0xa79c('0x27'),_0x4055fd?util[_0xa79c('0xb')](_0xa79c('0x23'),_0x3fba78,_0x4055fd?_0xa79c('0x24'):'xlsx'):null);});})[_0xa79c('0x28')](function(_0x5d9436){logger[_0xa79c('0x25')](util[_0xa79c('0xb')](_0xa79c('0x29'),EXTRACTED_REPORT_ID,_0xa79c('0xc')),util[_0xa79c('0x2a')](_0x5d9436,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xa79c('0x2b'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 9af5e04..bbbb719 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 _0x3238=['${EXTEN}','context','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','tag','CDR(tag)=','callerID','answer','indexOf','app','toLowerCase','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','Interval','findAll','then','VoiceExtension','IntervalId','models','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','extension','find','type','Set','CDR(type)=%s','VoiceExtensionId','outbound','push','CDR(destination)=','${EXTEN:'];(function(_0x3abe58,_0x184dd9){var _0x457389=function(_0x59f517){while(--_0x59f517){_0x3abe58['push'](_0x3abe58['shift']());}};_0x457389(++_0x184dd9);}(_0x3238,0x13e));var _0x8323=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3238[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8323('0x0'));var util=require('util');function rewrite(_0x25b74c,_0x1a2138){var _0xd581b1=this;return _0x25b74c['models'][_0x8323('0x1')][_0x8323('0x2')]({'raw':!![]})[_0x8323('0x3')](function(_0xce566d){_0xd581b1['intervals']=_0xce566d;return _0x25b74c['models'][_0x8323('0x4')][_0x8323('0x2')]({'where':{'IntervalId':_0x1a2138[_0x8323('0x5')]},'raw':!![]});})[_0x8323('0x3')](function(_0x4ddf1f){return _0x25b74c[_0x8323('0x6')]['VoiceExtension'][_0x8323('0x2')]({'where':{'exten':{'$in':_[_0x8323('0x7')](_[_0x8323('0x8')](_0x4ddf1f,_0x8323('0x9')))}},'order':[{'raw':_0x8323('0xa')}],'raw':!![]});})[_0x8323('0x3')](function(_0x46f52b){var _0x2dce91=_['filter'](_0x46f52b,{'priority':'1'});var _0x42ca90=_[_0x8323('0xb')](_0x46f52b,{'isApp':0x1});var _0x3c043a=_['groupBy'](_0x42ca90,_0x8323('0x9'));var _0x8be0fe=[_0x8323('0xc'),_0x8323('0xd')];var _0x6b0c66=[];var _0x187bb4=[];for(var _0x325a18 in _0x3c043a){if(_0x3c043a[_0x8323('0xe')](_0x325a18)){_0xd581b1[_0x8323('0xf')]=0x2;_0xd581b1[_0x8323('0x10')]=[];_0xd581b1[_0x8323('0x11')]=_[_0x8323('0x12')](_0x2dce91,{'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')]});_0xd581b1[_0x8323('0x10')]['push']({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':util['format'](_0x8323('0x15'),_0x3c043a[_0x325a18][0x0]['type']),'context':_0x3c043a[_0x325a18][0x0]['context'],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});if(_0x3c043a[_0x325a18][0x0][_0x8323('0x13')]===_0x8323('0x17')){if(_0xd581b1[_0x8323('0x11')]){_0xd581b1['extensions'][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0]['type'],'app':_0x8323('0x14'),'appdata':_0x8323('0x19')+(_0xd581b1[_0x8323('0x11')]['cutdigits']?_0x8323('0x1a')+_0xd581b1['extension']['cutdigits']+'}':_0x8323('0x1b')),'context':_0x3c043a[_0x325a18][0x0][_0x8323('0x1c')],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1['priority']++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0]['VoiceExtensionId']});}_0xd581b1[_0x8323('0x10')][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':_0x8323('0x1d')+_0x3c043a[_0x325a18][0x0][_0x8323('0x16')],'context':_0x3c043a[_0x325a18][0x0][_0x8323('0x1c')],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0]['VoiceExtensionId']});var _0x27155d=_0xd581b1['priority']++;_0xd581b1['extensions']['push']({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x1e'),'appdata':_0x8323('0x1f')+(_0x27155d+0x2)+_0x8323('0x20')+(_0x27155d+0x1)+')','context':_0x3c043a[_0x325a18][0x0]['context'],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0x27155d,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});if(_0xd581b1['extension']){_0xd581b1[_0x8323('0x10')][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':_0xd581b1[_0x8323('0x11')][_0x8323('0x21')]?_0x8323('0x22')+_0xd581b1['extension'][_0x8323('0x21')]+'}':_0x8323('0x23'),'context':_0x3c043a[_0x325a18][0x0]['context'],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});}_0xd581b1[_0x8323('0x10')][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0]['type'],'app':'Set','appdata':'outboundrouteid='+_0x3c043a[_0x325a18][0x0]['VoiceExtensionId'],'context':_0x3c043a[_0x325a18][0x0][_0x8323('0x1c')],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0]['VoiceExtensionId']});if(_0xd581b1['extension']&&_0xd581b1[_0x8323('0x11')][_0x8323('0xe')](_0x8323('0x24'))&&_0xd581b1[_0x8323('0x11')][_0x8323('0x24')]!==_0x8323('0x25')){_0xd581b1[_0x8323('0x10')]['push']({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3c043a[_0x325a18][0x0][_0x8323('0x1c')],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});_0xd581b1[_0x8323('0x10')][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':'Set','appdata':_0x8323('0x26')+_0xd581b1[_0x8323('0x11')][_0x8323('0x24')]||_0x8323('0x27'),'context':_0x3c043a[_0x325a18][0x0][_0x8323('0x1c')],'exten':_0x3c043a[_0x325a18][0x0]['exten'],'priority':_0xd581b1['priority']++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});}}_0xd581b1[_0x8323('0x10')][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':_0x8323('0x28'),'context':_0x3c043a[_0x325a18][0x0]['context'],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0]['VoiceExtensionId']});_0xd581b1[_0x8323('0x10')][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':_0x8323('0x29'),'context':_0x3c043a[_0x325a18][0x0]['context'],'exten':_0x3c043a[_0x325a18][0x0]['exten'],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});_0xd581b1['extensions'][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':_0x8323('0x2a'),'context':_0x3c043a[_0x325a18][0x0][_0x8323('0x1c')],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0]['VoiceExtensionId']});for(var _0x3d42db=0x0,_0x1073c7=0x0;_0x3d42db<_0x3c043a[_0x325a18][_0x8323('0x2b')];_0x3d42db+=0x1,_0x1073c7=0x0){var _0x3e3f7e=_0x3c043a[_0x325a18][_0x3d42db];if(_0x3e3f7e['type']){_0x3e3f7e[_0x8323('0x13')]=_0x3e3f7e[_0x8323('0x13')]['toLowerCase']();}var _0x52b437=[];var _0x355756=[];delete _0x3e3f7e['id'];delete _0x3e3f7e[_0x8323('0x2c')];delete _0x3e3f7e[_0x8323('0x2d')];var _0x467440=_0x3e3f7e[_0x8323('0x2e')]!=='*,*,*,*'?[_0x3e3f7e[_0x8323('0x2e')]]:_0x3e3f7e[_0x8323('0x5')]?_[_0x8323('0x8')](_[_0x8323('0xb')](_0xd581b1['intervals'],{'IntervalId':_0x3e3f7e[_0x8323('0x5')]}),_0x8323('0x2e')):[];if(_0x3e3f7e['hasOwnProperty']('tag')){if(_0x3e3f7e[_0x8323('0x2f')]&&_0x3e3f7e['tag']!=='--'){_0x52b437['push']({'type':_0x3e3f7e[_0x8323('0x13')],'app':'Set','appdata':_0x8323('0x30')+_0x3e3f7e['tag'],'context':_0x3e3f7e[_0x8323('0x1c')],'exten':_0x3e3f7e['exten'],'priority':_0x467440['length']+_0xd581b1[_0x8323('0xf')]+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e[_0x8323('0x16')]});}}if(_0x3e3f7e[_0x8323('0x13')]===_0x8323('0x17')&&_0x3e3f7e[_0x8323('0xe')](_0x8323('0x31'))){if(_0x3e3f7e[_0x8323('0x31')]){_0x52b437[_0x8323('0x18')]({'type':_0x3e3f7e[_0x8323('0x13')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x3e3f7e[_0x8323('0x31')]+')','context':_0x3e3f7e[_0x8323('0x1c')],'exten':_0x3e3f7e[_0x8323('0x9')],'priority':_0x467440[_0x8323('0x2b')]+_0xd581b1[_0x8323('0xf')]+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e[_0x8323('0x16')]});}else{_0x52b437[_0x8323('0x18')]({'type':_0x3e3f7e['type'],'app':_0x8323('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3e3f7e[_0x8323('0x1c')],'exten':_0x3e3f7e['exten'],'priority':_0x467440[_0x8323('0x2b')]+_0xd581b1[_0x8323('0xf')]+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e[_0x8323('0x16')]});}}if(_0x3e3f7e[_0x8323('0xe')](_0x8323('0x32'))){if(_0x8be0fe[_0x8323('0x33')](_0x3e3f7e[_0x8323('0x34')][_0x8323('0x35')]())>=0x0&&_0x3e3f7e['appType']!=='custom'){if(_0x3e3f7e[_0x8323('0x32')]){_0x52b437['push']({'type':_0x3e3f7e[_0x8323('0x13')],'app':'ExecIf','appdata':_0x8323('0x36'),'context':_0x3e3f7e[_0x8323('0x1c')],'exten':_0x3e3f7e[_0x8323('0x9')],'priority':_0x467440[_0x8323('0x2b')]+_0xd581b1['priority']+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e[_0x8323('0x16')]});_0x52b437['push']({'type':_0x3e3f7e['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3e3f7e['context'],'exten':_0x3e3f7e['exten'],'priority':_0x467440[_0x8323('0x2b')]+_0xd581b1[_0x8323('0xf')]+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e[_0x8323('0x16')]});}else{_0x52b437[_0x8323('0x18')]({'type':_0x3e3f7e[_0x8323('0x13')],'app':_0x8323('0x1e'),'appdata':_0x8323('0x37'),'context':_0x3e3f7e[_0x8323('0x1c')],'exten':_0x3e3f7e[_0x8323('0x9')],'priority':_0x467440[_0x8323('0x2b')]+_0xd581b1[_0x8323('0xf')]+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e[_0x8323('0x16')]});_0x52b437[_0x8323('0x18')]({'type':_0x3e3f7e['type'],'app':_0x8323('0x14'),'appdata':_0x8323('0x38'),'context':_0x3e3f7e[_0x8323('0x1c')],'exten':_0x3e3f7e[_0x8323('0x9')],'priority':_0x467440[_0x8323('0x2b')]+_0xd581b1[_0x8323('0xf')]+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e['VoiceExtensionId']});}}}for(var _0x5a57e8=0x0;_0x5a57e8<_0x467440['length'];_0x5a57e8+=0x1){var _0x55962e=_0xd581b1['priority']+_0x467440[_0x8323('0x2b')];var _0x1ad8aa=_0x5a57e8===_0x467440[_0x8323('0x2b')]-0x1?_0xd581b1[_0x8323('0xf')]+_0x52b437['length']+_0x355756[_0x8323('0x2b')]+0x2:_0xd581b1['priority']+_0x5a57e8+0x1;_0x52b437[_0x8323('0x39')](_0x5a57e8,0x0,{'type':_0x3e3f7e[_0x8323('0x13')],'app':_0x8323('0x3a'),'appdata':_0x467440[_0x5a57e8]+'?'+_0x3e3f7e[_0x8323('0x1c')]+_0x8323('0x3b')+_0x55962e+':'+_0x3e3f7e[_0x8323('0x1c')]+_0x8323('0x3b')+_0x1ad8aa,'exten':_0x3e3f7e[_0x8323('0x9')],'context':_0x3e3f7e[_0x8323('0x1c')],'priority':_0xd581b1[_0x8323('0xf')]+_0x5a57e8,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0]['VoiceExtensionId']});}_0x3e3f7e[_0x8323('0xf')]=_0x52b437[_0x8323('0x2b')]?_[_0x8323('0x3c')](_0x52b437)[_0x8323('0xf')]+0x1:_0xd581b1[_0x8323('0xf')];_0xd581b1[_0x8323('0xf')]=(_0x355756[_0x8323('0x2b')]?_[_0x8323('0x3c')](_0x355756)[_0x8323('0xf')]:_0x3e3f7e['priority'])+0x1;_0xd581b1[_0x8323('0x10')]=_['concat'](_0xd581b1[_0x8323('0x10')],_0x52b437,[_0x3e3f7e],_0x355756);}_0xd581b1['extensions'][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x3d'),'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'context':_0x3c043a[_0x325a18][0x0]['context'],'priority':_0xd581b1[_0x8323('0xf')],'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});_0x6b0c66[_0x8323('0x18')](_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]);_0x187bb4=_[_0x8323('0x3e')](_0x187bb4,_0xd581b1['extensions']);}}return _0x25b74c[_0x8323('0x3f')](function(_0x276c47){return _0x25b74c[_0x8323('0x6')][_0x8323('0x4')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x6b0c66}},'transaction':_0x276c47})[_0x8323('0x3')](function(_0xcaff9f){return _0x25b74c[_0x8323('0x6')][_0x8323('0x4')][_0x8323('0x40')](_[_0x8323('0x41')](_0x187bb4,_0x8323('0xf')),{'transaction':_0x276c47});});});})[_0x8323('0x42')](function(_0x47a9b3){console[_0x8323('0x43')](_0x47a9b3);});}exports[_0x8323('0x44')]=rewrite; \ No newline at end of file +var _0xbe5e=['extension','find','exten','Set','type','context','VoiceExtensionId','outbound','extensions','CDR(destination)=','cutdigits','${EXTEN}','push','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','IntervalId','VoiceExtension','uniq','map','filter','groupBy','playback','hasOwnProperty','priority'];(function(_0x24bde7,_0x3f8438){var _0x292aaa=function(_0x103724){while(--_0x103724){_0x24bde7['push'](_0x24bde7['shift']());}};_0x292aaa(++_0x3f8438);}(_0xbe5e,0x81));var _0xebe5=function(_0xe4700f,_0x1b782e){_0xe4700f=_0xe4700f-0x0;var _0x3fce7a=_0xbe5e[_0xe4700f];return _0x3fce7a;};'use strict';var _=require(_0xebe5('0x0'));var util=require(_0xebe5('0x1'));function rewrite(_0x5d46f7,_0x3060a7){var _0x2be430=this;return _0x5d46f7[_0xebe5('0x2')][_0xebe5('0x3')][_0xebe5('0x4')]({'raw':!![]})[_0xebe5('0x5')](function(_0x1e3335){_0x2be430['intervals']=_0x1e3335;return _0x5d46f7[_0xebe5('0x2')]['VoiceExtension'][_0xebe5('0x4')]({'where':{'IntervalId':_0x3060a7[_0xebe5('0x6')]},'raw':!![]});})[_0xebe5('0x5')](function(_0x73d4df){return _0x5d46f7[_0xebe5('0x2')][_0xebe5('0x7')][_0xebe5('0x4')]({'where':{'exten':{'$in':_[_0xebe5('0x8')](_[_0xebe5('0x9')](_0x73d4df,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xebe5('0x5')](function(_0x16c715){var _0x5882ff=_[_0xebe5('0xa')](_0x16c715,{'priority':'1'});var _0x1e8eec=_['filter'](_0x16c715,{'isApp':0x1});var _0x45c3b4=_[_0xebe5('0xb')](_0x1e8eec,'exten');var _0x594b3c=['queue',_0xebe5('0xc')];var _0x219bf0=[];var _0x560491=[];for(var _0x396b16 in _0x45c3b4){if(_0x45c3b4[_0xebe5('0xd')](_0x396b16)){_0x2be430[_0xebe5('0xe')]=0x2;_0x2be430['extensions']=[];_0x2be430[_0xebe5('0xf')]=_[_0xebe5('0x10')](_0x5882ff,{'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')]});_0x2be430['extensions']['push']({'type':_0x45c3b4[_0x396b16][0x0]['type'],'app':_0xebe5('0x12'),'appdata':util['format']('CDR(type)=%s',_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')]),'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});if(_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')]===_0xebe5('0x16')){if(_0x2be430['extension']){_0x2be430[_0xebe5('0x17')]['push']({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x18')+(_0x2be430[_0xebe5('0xf')][_0xebe5('0x19')]?'${EXTEN:'+_0x2be430['extension'][_0xebe5('0x19')]+'}':_0xebe5('0x1a')),'context':_0x45c3b4[_0x396b16][0x0]['context'],'exten':_0x45c3b4[_0x396b16][0x0]['exten'],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});}_0x2be430[_0xebe5('0x17')][_0xebe5('0x1b')]({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':'Set','appdata':_0xebe5('0x1c')+_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')],'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0]['VoiceExtensionId']});var _0x485386=_0x2be430[_0xebe5('0xe')]++;_0x2be430[_0xebe5('0x17')][_0xebe5('0x1b')]({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x1d'),'appdata':_0xebe5('0x1e')+(_0x485386+0x2)+_0xebe5('0x1f')+(_0x485386+0x1)+')','context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0]['exten'],'priority':_0x485386,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});if(_0x2be430[_0xebe5('0xf')]){_0x2be430['extensions'][_0xebe5('0x1b')]({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':'Set','appdata':_0x2be430['extension'][_0xebe5('0x19')]?'CDR(prefix)=${EXTEN:0:'+_0x2be430[_0xebe5('0xf')][_0xebe5('0x19')]+'}':_0xebe5('0x20'),'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0]['VoiceExtensionId']});}_0x2be430[_0xebe5('0x17')]['push']({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x21')+_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')],'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0]['VoiceExtensionId']});if(_0x2be430[_0xebe5('0xf')]&&_0x2be430[_0xebe5('0xf')][_0xebe5('0xd')]('recordingFormat')&&_0x2be430['extension'][_0xebe5('0x22')]!==_0xebe5('0x23')){_0x2be430[_0xebe5('0x17')]['push']({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0]['exten'],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});_0x2be430['extensions'][_0xebe5('0x1b')]({'type':_0x45c3b4[_0x396b16][0x0]['type'],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x24')+_0x2be430[_0xebe5('0xf')][_0xebe5('0x22')]||_0xebe5('0x25'),'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0]['VoiceExtensionId']});}}_0x2be430[_0xebe5('0x17')][_0xebe5('0x1b')]({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x26'),'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});_0x2be430[_0xebe5('0x17')][_0xebe5('0x1b')]({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430['priority']++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});_0x2be430[_0xebe5('0x17')]['push']({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x27'),'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430['priority']++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});for(var _0x17303b=0x0,_0x5a2720=0x0;_0x17303b<_0x45c3b4[_0x396b16]['length'];_0x17303b+=0x1,_0x5a2720=0x0){var _0x468604=_0x45c3b4[_0x396b16][_0x17303b];if(_0x468604[_0xebe5('0x13')]){_0x468604[_0xebe5('0x13')]=_0x468604[_0xebe5('0x13')][_0xebe5('0x28')]();}var _0x37e8f4=[];var _0x307488=[];delete _0x468604['id'];delete _0x468604[_0xebe5('0x29')];delete _0x468604[_0xebe5('0x2a')];var _0x4b04c6=_0x468604[_0xebe5('0x2b')]!==_0xebe5('0x2c')?[_0x468604[_0xebe5('0x2b')]]:_0x468604[_0xebe5('0x6')]?_[_0xebe5('0x9')](_[_0xebe5('0xa')](_0x2be430[_0xebe5('0x2d')],{'IntervalId':_0x468604[_0xebe5('0x6')]}),_0xebe5('0x2b')):[];if(_0x468604['hasOwnProperty']('tag')){if(_0x468604[_0xebe5('0x2e')]&&_0x468604['tag']!=='--'){_0x37e8f4[_0xebe5('0x1b')]({'type':_0x468604[_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x2f')+_0x468604[_0xebe5('0x2e')],'context':_0x468604[_0xebe5('0x14')],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6[_0xebe5('0x30')]+_0x2be430['priority']+_0x5a2720++,'VoiceExtensionId':_0x468604[_0xebe5('0x15')]});}}if(_0x468604[_0xebe5('0x13')]===_0xebe5('0x16')&&_0x468604[_0xebe5('0xd')](_0xebe5('0x31'))){if(_0x468604['callerID']){_0x37e8f4[_0xebe5('0x1b')]({'type':_0x468604[_0xebe5('0x13')],'app':_0xebe5('0x1d'),'appdata':_0xebe5('0x32')+_0x468604['callerID']+')','context':_0x468604[_0xebe5('0x14')],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6[_0xebe5('0x30')]+_0x2be430['priority']+_0x5a2720++,'VoiceExtensionId':_0x468604[_0xebe5('0x15')]});}else{_0x37e8f4[_0xebe5('0x1b')]({'type':_0x468604[_0xebe5('0x13')],'app':_0xebe5('0x1d'),'appdata':_0xebe5('0x33'),'context':_0x468604['context'],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6[_0xebe5('0x30')]+_0x2be430[_0xebe5('0xe')]+_0x5a2720++,'VoiceExtensionId':_0x468604[_0xebe5('0x15')]});}}if(_0x468604['hasOwnProperty'](_0xebe5('0x34'))){if(_0x594b3c[_0xebe5('0x35')](_0x468604[_0xebe5('0x36')][_0xebe5('0x28')]())>=0x0&&_0x468604[_0xebe5('0x37')]!==_0xebe5('0x38')){if(_0x468604['answer']){_0x37e8f4[_0xebe5('0x1b')]({'type':_0x468604[_0xebe5('0x13')],'app':'ExecIf','appdata':_0xebe5('0x39'),'context':_0x468604[_0xebe5('0x14')],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6['length']+_0x2be430[_0xebe5('0xe')]+_0x5a2720++,'VoiceExtensionId':_0x468604[_0xebe5('0x15')]});_0x37e8f4['push']({'type':_0x468604[_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x3a'),'context':_0x468604[_0xebe5('0x14')],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6[_0xebe5('0x30')]+_0x2be430[_0xebe5('0xe')]+_0x5a2720++,'VoiceExtensionId':_0x468604[_0xebe5('0x15')]});}else{_0x37e8f4[_0xebe5('0x1b')]({'type':_0x468604[_0xebe5('0x13')],'app':'ExecIf','appdata':_0xebe5('0x3b'),'context':_0x468604[_0xebe5('0x14')],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6[_0xebe5('0x30')]+_0x2be430[_0xebe5('0xe')]+_0x5a2720++,'VoiceExtensionId':_0x468604['VoiceExtensionId']});_0x37e8f4[_0xebe5('0x1b')]({'type':_0x468604[_0xebe5('0x13')],'app':'Set','appdata':_0xebe5('0x3c'),'context':_0x468604[_0xebe5('0x14')],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6[_0xebe5('0x30')]+_0x2be430['priority']+_0x5a2720++,'VoiceExtensionId':_0x468604['VoiceExtensionId']});}}}for(var _0x6215c9=0x0;_0x6215c9<_0x4b04c6[_0xebe5('0x30')];_0x6215c9+=0x1){var _0x2ec838=_0x2be430[_0xebe5('0xe')]+_0x4b04c6[_0xebe5('0x30')];var _0x1162a7=_0x6215c9===_0x4b04c6[_0xebe5('0x30')]-0x1?_0x2be430[_0xebe5('0xe')]+_0x37e8f4[_0xebe5('0x30')]+_0x307488[_0xebe5('0x30')]+0x2:_0x2be430[_0xebe5('0xe')]+_0x6215c9+0x1;_0x37e8f4[_0xebe5('0x3d')](_0x6215c9,0x0,{'type':_0x468604[_0xebe5('0x13')],'app':_0xebe5('0x3e'),'appdata':_0x4b04c6[_0x6215c9]+'?'+_0x468604['context']+_0xebe5('0x3f')+_0x2ec838+':'+_0x468604[_0xebe5('0x14')]+_0xebe5('0x3f')+_0x1162a7,'exten':_0x468604[_0xebe5('0x11')],'context':_0x468604[_0xebe5('0x14')],'priority':_0x2be430[_0xebe5('0xe')]+_0x6215c9,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});}_0x468604[_0xebe5('0xe')]=_0x37e8f4[_0xebe5('0x30')]?_[_0xebe5('0x40')](_0x37e8f4)[_0xebe5('0xe')]+0x1:_0x2be430[_0xebe5('0xe')];_0x2be430[_0xebe5('0xe')]=(_0x307488[_0xebe5('0x30')]?_[_0xebe5('0x40')](_0x307488)[_0xebe5('0xe')]:_0x468604[_0xebe5('0xe')])+0x1;_0x2be430[_0xebe5('0x17')]=_[_0xebe5('0x41')](_0x2be430[_0xebe5('0x17')],_0x37e8f4,[_0x468604],_0x307488);}_0x2be430['extensions']['push']({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x42'),'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'priority':_0x2be430[_0xebe5('0xe')],'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0]['VoiceExtensionId']});_0x219bf0['push'](_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]);_0x560491=_[_0xebe5('0x41')](_0x560491,_0x2be430[_0xebe5('0x17')]);}}return _0x5d46f7[_0xebe5('0x43')](function(_0x5a1ded){return _0x5d46f7[_0xebe5('0x2')][_0xebe5('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x219bf0}},'transaction':_0x5a1ded})['then'](function(_0x15dafd){return _0x5d46f7['models'][_0xebe5('0x7')][_0xebe5('0x44')](_[_0xebe5('0x45')](_0x560491,_0xebe5('0xe')),{'transaction':_0x5a1ded});});});})[_0xebe5('0x46')](function(_0x3dea29){console['error'](_0x3dea29);});}exports[_0xebe5('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index bc60a5f..da2946f 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x36490d,_0x27e5bc){var _0x23a325=function(_0x438e51){while(--_0x438e51){_0x36490d['push'](_0x36490d['shift']());}};_0x23a325(++_0x27e5bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file +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(_0x23eb37,_0x4df51a){var _0x1d25e7=function(_0x1ba202){while(--_0x1ba202){_0x23eb37['push'](_0x23eb37['shift']());}};_0x1d25e7(++_0x4df51a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 f54fe8b..e94ad35 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 _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0x7a54,0x106));var _0x47a5=function(_0x3675b0,_0x4a25fa){_0x3675b0=_0x3675b0-0x0;var _0x46ce4e=_0x7a54[_0x3675b0];return _0x46ce4e;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){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))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('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',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x5cf175,_0x42be8c){var _0x467baa=function(_0x617e75){while(--_0x617e75){_0x5cf175['push'](_0x5cf175['shift']());}};_0x467baa(++_0x42be8c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x7995('0xe'));function isEmail(_0x3116fb){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 192739c..5af7ad1 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadfa=['uncaughtException','path','lodash','papaparse','bluebird','moment','squel','../../../mysqldb','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','push','then','error','message','AdditionalPhones','split','length','all','filter','CmContactHasItem','PHONE','CmContact','update','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','recallme','select','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_hopper_black','from','cm_contacts','field','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','createdAt','fields','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','exit','errors','code','catch','main','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','parse','data','rows','find','hasOwnProperty','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','isNumber','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','SystemRow','appendFileSync','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','each','finish','emit','contact:import:','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT'];(function(_0x4a249e,_0x30c270){var _0x4168a4=function(_0x21a830){while(--_0x21a830){_0x4a249e['push'](_0x4a249e['shift']());}};_0x4168a4(++_0x30c270);}(_0xadfa,0x1d5));var _0xaadf=function(_0x40ced5,_0x483c61){_0x40ced5=_0x40ced5-0x0;var _0x58ff15=_0xadfa[_0x40ced5];return _0x58ff15;};'use strict';var fs=require('fs');var path=require(_0xaadf('0x0'));var _=require(_0xaadf('0x1'));var Papa=require(_0xaadf('0x2'));var util=require('util');var BPromise=require(_0xaadf('0x3'));var moment=require(_0xaadf('0x4'));var squel=require(_0xaadf('0x5'));var Redis=require('ioredis');var db=require(_0xaadf('0x6'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xaadf('0x7'));config[_0xaadf('0x8')]=_[_0xaadf('0x9')](config[_0xaadf('0x8')],{'host':_0xaadf('0xa'),'port':0x18eb});var socket=require(_0xaadf('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xaadf('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xaadf('0xd')+moment()[_0xaadf('0xc')](_0xaadf('0xe'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x48d6f3){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'](_0x48d6f3);}function selectNotIn(_0x4e68f1,_0x5746c0,_0x36714d,_0x2f95ff,_0x570613){return squel['select']()['field'](_0xaadf('0xf'))['from'](_0x2f95ff)[_0xaadf('0x10')](_0x5746c0,null,_0x5746c0+_0xaadf('0x11')+_0x2f95ff+'.'+_0x36714d)[_0xaadf('0x12')](_0x2f95ff+'.'+_0x36714d+_0xaadf('0x13')+_0x4e68f1+'.'+_0x36714d)[_0xaadf('0x12')](_0x5746c0+_0xaadf('0x14')+_0x570613[_0xaadf('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x314f09,_0x5b6aa1){promisesAdditionalPhones=[];promisesContact=[];return db[_0xaadf('0x15')][_0xaadf('0x16')](_0xaadf('0x17')+tempTableName)[_0xaadf('0x18')](function(_0x46e367){if(_0x46e367!==null){var _0xd0c156=[];for(var _0x11491b=0x0;_0x11491b<_0x46e367['length'];_0x11491b++){var _0x22dc12=_0x46e367[_0x11491b];if(!_[_0xaadf('0x19')](_0x22dc12['phone'])){if(!_[_0xaadf('0x19')](_0x22dc12['AdditionalPhones']))_0xd0c156[_0xaadf('0x1a')](insertAdditionalPhones(_0x22dc12));promisesContact[_0xaadf('0x1a')]({'contact':_0x22dc12});}}}Promise['all'](_0xd0c156)[_0xaadf('0x1b')](function(){_0x314f09({'val':0x1});});})['catch'](function(_0x5df00d){logger[_0xaadf('0x1c')](_0x5df00d[_0xaadf('0x1d')]);});});}function insertAdditionalPhones(_0x2f2f11){return new Promise(function(_0x1ec532,_0x4251f7){var _0x3b9b52=_0x2f2f11[_0xaadf('0x1e')];if(_[_0xaadf('0x19')](_0x3b9b52))_0x4251f7({'val':0x0});else{var _0x357049=_0x3b9b52[_0xaadf('0x1f')](';');var _0x358c6f=[];orderBy=0x0;for(var _0x112205=0x0;_0x112205<_0x357049[_0xaadf('0x20')];_0x112205++){_0x358c6f[_0xaadf('0x1a')](splitAdditionalPhone(_0x2f2f11['id'],_0x357049[_0x112205]));}Promise[_0xaadf('0x21')](_0x358c6f)[_0xaadf('0x1b')](function(){_0x1ec532({'val':_0x357049[_0xaadf('0x20')]});});}});}function splitAdditionalPhone(_0x19e063,_0x531c04){return new Promise(function(_0x2d8658,_0xb0523e){var _0x52ef16=_0x531c04[_0xaadf('0x1f')](':');var _0x22a96b=_0x52ef16[0x0];var _0x2f203b=_0x52ef16[0x1];if(_0x2f203b!==''){var _0x28cdf9=_0x2f203b[_0xaadf('0x1f')]('|');var _0x4effbd=[];for(var _0x302fa3=0x0;_0x302fa3<_0x28cdf9[_0xaadf('0x20')];_0x302fa3++){if(_0x28cdf9[_0x302fa3]!==''){var _0x550ac8=_[_0xaadf('0x22')](promisesAdditionalPhones,{'contactId':_0x19e063,'phone':_0x28cdf9[_0x302fa3]});if(_0x550ac8[_0xaadf('0x20')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x19e063,'contactTypeId':_0x22a96b,'phone':_0x28cdf9[_0x302fa3],'orderBy':orderBy});}}}_0x2d8658({'ok':0x1});}else _0x2d8658({'res':0x0});});}function createAdditionalPhone(_0x17eb6f,_0x5c5a09,_0x5dfe71,_0x19cd9c){return new Promise(function(_0x158153,_0x1b9060){return db[_0xaadf('0x23')]['findOne']({'where':{'CmContactId':_0x17eb6f,'item':_0x5dfe71}})[_0xaadf('0x1b')](function(_0x38a444){if(_0x38a444){return db[_0xaadf('0x23')]['update']({'ItemTypeId':_0x5c5a09,'OrderBy':_0x19cd9c},{'where':{'CmContactId':_0x17eb6f,'item':_0x5dfe71}})['then'](function(_0x359b3d){_0x158153({'res':'updated'});});}else{return db[_0xaadf('0x23')]['create']({'CmContactId':_0x17eb6f,'item':_0x5dfe71,'ItemTypeId':_0x5c5a09,'OrderBy':_0x19cd9c,'ItemClass':_0xaadf('0x24')})[_0xaadf('0x1b')](function(_0x593cee){_0x158153({'res':'inserted'});});}});});}function updateContact(_0x1fe6dc){return new Promise(function(_0x2f19ee,_0x11900b){var _0x17ac8e=_0x1fe6dc['id'];delete _0x1fe6dc['id'];return db[_0xaadf('0x25')][_0xaadf('0x26')](_0x1fe6dc,{'where':{'id':_0x17ac8e}})[_0xaadf('0x1b')](function(_0x22c85e){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x1fe6dc[_0xaadf('0xf')]},{'where':{'ContactId':_0x17ac8e}})[_0xaadf('0x1b')](function(_0x3ddb29){_0x2f19ee({'ret':'OK'});});});});}function insertCmHopper(_0x9c1615,_0x2bfa34,_0xda202a,_0x45517c,_0x31c6de){var _0x4ea40a=['cm_contacts.phone',_0xaadf('0x27'),_0xaadf('0x28'),_0xaadf('0x29'),_0x2bfa34+'.'+_0x45517c,_0xaadf('0x2a'),_0xaadf('0x2b'),_0xaadf('0x2c'),_0xaadf('0x2d'),'\x22'+_0x31c6de+'\x22'];return squel[_0xaadf('0x2e')]()[_0xaadf('0x2f')]('cm_hopper')[_0xaadf('0x30')]([_0xaadf('0xf'),_0xaadf('0x31'),_0xaadf('0x32'),_0xaadf('0x33'),_0x45517c,'createdAt',_0xaadf('0x34'),_0xaadf('0x35'),'UserId',_0xaadf('0x36')],squel[_0xaadf('0x37')]()['fields'](_0x4ea40a)['from'](_0x2bfa34)[_0xaadf('0x10')]('cm_contacts',null,_0xaadf('0x38')+_0x2bfa34+_0xaadf('0x39'))[_0xaadf('0x10')](_0xda202a,null,_0xda202a+'.id\x20=\x20'+_0x2bfa34+'.'+_0x45517c)['where'](_0x2bfa34+_0xaadf('0x3a'),_0x9c1615)[_0xaadf('0x12')](_0xaadf('0x3b'),NOW)[_0xaadf('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2bfa34,_0xda202a,_0x45517c,_0xaadf('0x3c'),[_0xaadf('0x3d'),_0xaadf('0x3e')]))[_0xaadf('0x12')](_0xaadf('0x3f'),selectNotIn(_0x2bfa34,_0xda202a,_0x45517c,_0xaadf('0x3c'),[_0xaadf('0x3d')])))[_0xaadf('0x40')]();}function insertCmHopperBlack(_0x613913,_0x529c93,_0x190df1,_0x20b880){var _0x393c2c=[_0xaadf('0x41'),'cm_contacts.id',_0xaadf('0x29'),_0x529c93+'.'+_0x20b880,_0xaadf('0x2a'),'cm_contacts.updatedAt'];return squel[_0xaadf('0x2e')]()[_0xaadf('0x2f')](_0xaadf('0x42'))[_0xaadf('0x30')]([_0xaadf('0xf'),_0xaadf('0x32'),_0xaadf('0x33'),_0x20b880,'createdAt',_0xaadf('0x34')],squel[_0xaadf('0x37')]()['fields'](_0x393c2c)[_0xaadf('0x43')](_0x529c93)[_0xaadf('0x10')](_0xaadf('0x44'),null,_0xaadf('0x38')+_0x529c93+_0xaadf('0x39'))[_0xaadf('0x10')](_0x190df1,null,_0x190df1+_0xaadf('0x11')+_0x529c93+'.'+_0x20b880)[_0xaadf('0x12')](_0x529c93+'.CmListId\x20=\x20?',_0x613913)[_0xaadf('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xaadf('0x12')](_0xaadf('0x3f'),squel[_0xaadf('0x37')]()[_0xaadf('0x45')]('phone')['from']('cm_hopper_black')['where'](_0xaadf('0x46'),_0x613913)[_0xaadf('0x12')](_0x20b880+'\x20=\x20?',_0x529c93+'.'+_0x20b880)))[_0xaadf('0x40')]();}function insertCmHopperAdditionalPhones(_0x3069f2){var _0x4dc4b3=[_0xaadf('0x47'),_0xaadf('0x48'),_0xaadf('0x49'),'cm_contact_has_items.createdAt',_0xaadf('0x4a')];return squel[_0xaadf('0x2e')]()['into'](_0xaadf('0x4b'))['fromQuery']([_0xaadf('0x4c'),_0xaadf('0xf'),_0xaadf('0x4d'),_0xaadf('0x4e'),'updatedAt'],squel[_0xaadf('0x37')]()[_0xaadf('0x4f')](_0x4dc4b3)[_0xaadf('0x43')]('cm_hopper')[_0xaadf('0x10')](_0xaadf('0x44'),null,_0xaadf('0x50'))[_0xaadf('0x10')]('cm_contact_has_items',null,_0xaadf('0x51'))['where'](_0xaadf('0x52'),_0x3069f2)[_0xaadf('0x12')](_0xaadf('0x3b'),NOW))['toString']();}function insertCmContact(_0x4d62c1,_0xce83d3,_0x3fc7bf,_0x188463){var _0x153d30=_['concat'](_[_0xaadf('0x53')](_0x188463),[_0xaadf('0x33'),_0xaadf('0x54'),_0xaadf('0x4e'),'updatedAt']);return squel[_0xaadf('0x2e')]()['into'](_0xaadf('0x44'))[_0xaadf('0x30')](_0x153d30,squel['select']()[_0xaadf('0x4f')](_0x153d30)[_0xaadf('0x43')](_0xce83d3)[_0xaadf('0x12')]('('+_0x3fc7bf[_0xaadf('0x10')](',')+_0xaadf('0x55'),squel[_0xaadf('0x37')]()[_0xaadf('0x4f')](_0x3fc7bf)[_0xaadf('0x43')](_0xaadf('0x44'))[_0xaadf('0x12')]('ListId\x20=\x20?',_0x4d62c1))['where'](_0xaadf('0x56'),squel['select']()[_0xaadf('0x45')](_0xaadf('0x57'),_0xaadf('0x58'))[_0xaadf('0x43')](_0xce83d3)[_0xaadf('0x59')](_0x3fc7bf[_0xaadf('0x10')](','))))[_0xaadf('0x40')]();}function handleStop(){logger[_0xaadf('0x5a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x15e953){logger[_0xaadf('0x1c')](_0x15e953['message']);process[_0xaadf('0x5b')](0x1);}function handleError(_0x5de01a,_0x2fb3c8){stats[_0xaadf('0x5c')][_0xaadf('0x1a')]({'name':_0x2fb3c8[_0xaadf('0x5d')],'message':_0x2fb3c8[_0xaadf('0x1d')],'row':_0x5de01a});}function handleQuery(_0x1899af){logger[_0xaadf('0x5a')](_0x1899af);return db[_0xaadf('0x15')]['query'](_0x1899af)['spread'](function(_0x49a251){results[_0xaadf('0x1a')](_0x49a251);})[_0xaadf('0x5e')](function(_0x57c0fc){logger['error'](_0x57c0fc['message']);});}function main(_0x33588e,_0x327d45,_0x5402a6,_0x445504){logger[_0xaadf('0x5a')](_0xaadf('0x5f'),_0x33588e,JSON['stringify'](_0x327d45));process[_0xaadf('0x60')](_0xaadf('0x61'));var _0x598bf3=_0x327d45[_0xaadf('0x62')];var _0x4ce68b=_['clone'](_0x598bf3);var _0x2dc2f1=_0x327d45[_0xaadf('0x63')];var _0x1b06e0=path['join'](config[_0xaadf('0x64')],_0xaadf('0x65'),_0x2dc2f1+_0xaadf('0x66'));logger['info'](_0xaadf('0x67'),_0x327d45);db[_0xaadf('0x68')][_0xaadf('0x69')]({'raw':!![],'attributes':['id',_0xaadf('0x6a')]})[_0xaadf('0x1b')](function(_0x124f63){for(var _0x3ce0d0=0x0;_0x3ce0d0<_0x124f63[_0xaadf('0x20')];_0x3ce0d0++){if(_0x124f63[_0x3ce0d0][_0xaadf('0x6a')]in _0x598bf3){contactItemTypes[_0xaadf('0x1a')](_0x124f63[_0x3ce0d0]);delete _0x4ce68b[_0x124f63[_0x3ce0d0][_0xaadf('0x6a')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x4ce68b[_0xaadf('0x1e')]='';var _0x5b9eff=_[_0xaadf('0x53')](_0x4ce68b)[_0xaadf('0x10')]();logger[_0xaadf('0x5a')](_0xaadf('0x6b'),_0x5b9eff);fs['writeFileSync'](_0x1b06e0,_0x5b9eff+'\x0a');Papa[_0xaadf('0x6c')](fs['createReadStream'](_0x33588e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2008fa,_0x2884eb){try{for(var _0x160dea=0x0,_0x15774a=[];_0x160dea<_0x2008fa[_0xaadf('0x6d')][_0xaadf('0x20')];_0x160dea++){stats[_0xaadf('0x6e')]+=0x1;if(_0x2008fa['errors'][_0x160dea]){handleError(_0x2008fa[_0xaadf('0x6d')][_0x160dea],_0x2008fa[_0xaadf('0x5c')][_0x160dea]);}else{var _0x23bc4c=[];var _0x19842f=[];for(var _0xde4543 in _0x598bf3){let _0x505b81=contactItemTypes[_0xaadf('0x6f')](_0x4d57cf=>_0x4d57cf[_0xaadf('0x6a')]===_0xde4543);if(_[_0xaadf('0x19')](_0x505b81)){if(_0x598bf3[_0xaadf('0x70')](_0xde4543)){if(_0x2008fa['data'][_0x160dea][_0x598bf3[_0xde4543]]){var _0x4a6300=_['trim'](_0x2008fa[_0xaadf('0x6d')][_0x160dea][_0x598bf3[_0xde4543]][_0xaadf('0x71')](/"/g,'\x27'));switch(_0xde4543){case _0xaadf('0x31'):var _0x59ce7=moment(_0x4a6300,_0xaadf('0x72'),!![]);if(_0x59ce7[_0xaadf('0x73')]()){_0x15774a[_0xaadf('0x1a')]('\x22'+_0x4a6300+'\x22');}else{_0x23bc4c[_0xaadf('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xaadf('0x35'):var _0x130a2d=parseInt(_0x4a6300);_0x4a6300=_[_0xaadf('0x74')](_0x130a2d)||_0x130a2d<0x0||_0x130a2d>0x4?_0x445504?0x3:0x2:_0x130a2d;_0x15774a[_0xaadf('0x1a')]('\x22'+_0x4a6300+'\x22');break;case'UserId':var _0x4939cb=parseInt(_0x4a6300);if(_[_0xaadf('0x75')](_0x4939cb)&&_['includes'](_0x5402a6,_0x4939cb)){_0x15774a[_0xaadf('0x1a')]('\x22'+_0x4939cb+'\x22');}else{_0x23bc4c[_0xaadf('0x1a')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x4a6300)){_0x15774a['push']('\x22'+_0x4a6300+'\x22');}else{_0x23bc4c[_0xaadf('0x1a')](_0xaadf('0x76'));}break;case'dateOfBirth':var _0x699eca=moment(_0x4a6300,_0xaadf('0x77'),!![]);if(_0x699eca[_0xaadf('0x73')]()){_0x15774a[_0xaadf('0x1a')]('\x22'+_0x4a6300+'\x22');}else{_0x23bc4c[_0xaadf('0x1a')](_0xaadf('0x78'));}break;default:_0x15774a[_0xaadf('0x1a')]('\x22'+_0x4a6300+'\x22');}}else{switch(_0xde4543){case _0xaadf('0x79'):case'phone':_0x23bc4c['push'](_0xde4543+_0xaadf('0x7a'));break;default:_0x15774a[_0xaadf('0x1a')]('\x22\x22');}}}}else{var _0x417295='';for(var _0x9ef7c7=0x0;_0x9ef7c7<_0x598bf3[_0xde4543][_0xaadf('0x20')];_0x9ef7c7++){var _0x4a6300=_[_0xaadf('0x7b')](_0x2008fa[_0xaadf('0x6d')][_0x160dea][_0x598bf3[_0xde4543][_0x9ef7c7]][_0xaadf('0x71')](/"/g,'\x27'));if(_0x417295=='')_0x417295=_0x4a6300;else _0x417295+='|'+_0x4a6300;}_0x19842f['push'](_0x505b81['id']+':'+_0x417295);}}if(hasAdditionalPhones){_0x15774a['push']('\x22'+_0x19842f[_0xaadf('0x10')](';')+'\x22');}if(_0x23bc4c[_0xaadf('0x20')]){handleError(_0x2008fa[_0xaadf('0x6d')][_0x160dea],{'code':_0xaadf('0x7c'),'message':_0x23bc4c[_0xaadf('0x10')]()});}else{fs[_0xaadf('0x7d')](_0x1b06e0,_0x15774a['join']()+'\x0a');}_0x15774a=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x2dc2f1,stats);stats[_0xaadf('0x5c')]=[];}}if(stopped){logger[_0xaadf('0x5a')](_0xaadf('0x7e'));_0x2884eb[_0xaadf('0x7f')]();}}catch(_0x5efb19){handleError(_0x2008fa[_0xaadf('0x6d')][_0x160dea],{'code':_0xaadf('0x80'),'message':_0x5efb19[_0xaadf('0x1d')]});logger[_0xaadf('0x1c')](_0xaadf('0x81'),_0x5efb19['message']);}},'complete':function(){try{var _0x22ec89=[];var _0x58e4ea=tempTableName;_0x22ec89[_0xaadf('0x1a')](_0xaadf('0x82')+_0x58e4ea+_0xaadf('0x83'));logger['info'](_0xaadf('0x84'),contactItemTypes[_0xaadf('0x20')]);var _0x3364e5=util[_0xaadf('0xc')](_0xaadf('0x85'),_0x1b06e0,_0x58e4ea,_0x5b9eff,_0x327d45[_0xaadf('0x33')],_0x327d45[_0xaadf('0x54')]||null,NOW,NOW);if(_[_0xaadf('0x19')](_0x598bf3['scheduledat'])){_0x3364e5+=_0xaadf('0x86');}_0x22ec89['push'](_0x3364e5);BPromise['each'](_0x22ec89,handleQuery)[_0xaadf('0x1b')](function(_0x59373a){BPromise[_0xaadf('0x21')]([handleAdditionalPhones()])[_0xaadf('0x1b')](function(){_0x22ec89=[];for(var _0x5b2344=0x0;_0x5b2344\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','field','phone','from'];(function(_0x4778a9,_0x25fc7b){var _0x42ddb3=function(_0x4f72d6){while(--_0x4f72d6){_0x4778a9['push'](_0x4778a9['shift']());}};_0x42ddb3(++_0x25fc7b);}(_0xe4fb,0x1d8));var _0xbe4f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe4fb[_0x2dafbe];return _0x58a45a;};'use strict';var fs=require('fs');var path=require(_0xbe4f('0x0'));var _=require(_0xbe4f('0x1'));var Papa=require(_0xbe4f('0x2'));var util=require(_0xbe4f('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xbe4f('0x4'));var Redis=require(_0xbe4f('0x5'));var db=require(_0xbe4f('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0xbe4f('0x7'))(_0xbe4f('0x8'));config['redis']=_[_0xbe4f('0x9')](config[_0xbe4f('0xa')],{'host':_0xbe4f('0xb'),'port':0x18eb});var socket=require(_0xbe4f('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xbe4f('0xd')](_0xbe4f('0xe'));var tempTableName='cm_contacts_temp_'+moment()[_0xbe4f('0xd')](_0xbe4f('0xf'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x1c8a81){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))*$/[_0xbe4f('0x10')](_0x1c8a81);}function selectNotIn(_0x104cab,_0x59ca9b,_0x2b6dd7,_0x25e3da,_0x5564e9){return squel['select']()[_0xbe4f('0x11')](_0xbe4f('0x12'))[_0xbe4f('0x13')](_0x25e3da)[_0xbe4f('0x14')](_0x59ca9b,null,_0x59ca9b+_0xbe4f('0x15')+_0x25e3da+'.'+_0x2b6dd7)[_0xbe4f('0x16')](_0x25e3da+'.'+_0x2b6dd7+_0xbe4f('0x17')+_0x104cab+'.'+_0x2b6dd7)[_0xbe4f('0x16')](_0x59ca9b+_0xbe4f('0x18')+_0x5564e9['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3fa4d8,_0x47ef7c){promisesAdditionalPhones=[];promisesContact=[];return db[_0xbe4f('0x19')][_0xbe4f('0x1a')](_0xbe4f('0x1b')+tempTableName)['spread'](function(_0x128ce3){if(_0x128ce3!==null){var _0x560bc2=[];for(var _0x20adc1=0x0;_0x20adc1<_0x128ce3[_0xbe4f('0x1c')];_0x20adc1++){var _0x129efb=_0x128ce3[_0x20adc1];if(!_[_0xbe4f('0x1d')](_0x129efb[_0xbe4f('0x12')])){if(!_['isNil'](_0x129efb['AdditionalPhones']))_0x560bc2[_0xbe4f('0x1e')](insertAdditionalPhones(_0x129efb));promisesContact[_0xbe4f('0x1e')]({'contact':_0x129efb});}}}Promise[_0xbe4f('0x1f')](_0x560bc2)[_0xbe4f('0x20')](function(){_0x3fa4d8({'val':0x1});});})[_0xbe4f('0x21')](function(_0x28def2){logger[_0xbe4f('0x22')](_0x28def2[_0xbe4f('0x23')]);});});}function insertAdditionalPhones(_0xbfd83e){return new Promise(function(_0x41d605,_0xaf2aa1){var _0x23446c=_0xbfd83e[_0xbe4f('0x24')];if(_['isNil'](_0x23446c))_0xaf2aa1({'val':0x0});else{var _0xe3adad=_0x23446c[_0xbe4f('0x25')](';');var _0x4609e2=[];orderBy=0x0;for(var _0x59df1e=0x0;_0x59df1e<_0xe3adad[_0xbe4f('0x1c')];_0x59df1e++){_0x4609e2[_0xbe4f('0x1e')](splitAdditionalPhone(_0xbfd83e['id'],_0xe3adad[_0x59df1e]));}Promise[_0xbe4f('0x1f')](_0x4609e2)['then'](function(){_0x41d605({'val':_0xe3adad[_0xbe4f('0x1c')]});});}});}function splitAdditionalPhone(_0x15dbca,_0x5c099a){return new Promise(function(_0x4cc633,_0x5660f0){var _0xe2bf31=_0x5c099a[_0xbe4f('0x25')](':');var _0x1b95dc=_0xe2bf31[0x0];var _0x43220a=_0xe2bf31[0x1];if(_0x43220a!==''){var _0x18699f=_0x43220a[_0xbe4f('0x25')]('|');var _0x37f40f=[];for(var _0x50f8e1=0x0;_0x50f8e1<_0x18699f[_0xbe4f('0x1c')];_0x50f8e1++){if(_0x18699f[_0x50f8e1]!==''){var _0x14fdda=_[_0xbe4f('0x26')](promisesAdditionalPhones,{'contactId':_0x15dbca,'phone':_0x18699f[_0x50f8e1]});if(_0x14fdda['length']==0x0){orderBy++;promisesAdditionalPhones[_0xbe4f('0x1e')]({'contactId':_0x15dbca,'contactTypeId':_0x1b95dc,'phone':_0x18699f[_0x50f8e1],'orderBy':orderBy});}}}_0x4cc633({'ok':0x1});}else _0x4cc633({'res':0x0});});}function createAdditionalPhone(_0x446d7c,_0x43334a,_0x2cd274,_0xd5d455){return new Promise(function(_0x154302,_0x3c09eb){return db[_0xbe4f('0x27')][_0xbe4f('0x28')]({'where':{'CmContactId':_0x446d7c,'item':_0x2cd274}})[_0xbe4f('0x20')](function(_0x17b89d){if(_0x17b89d){return db['CmContactHasItem'][_0xbe4f('0x29')]({'ItemTypeId':_0x43334a,'OrderBy':_0xd5d455},{'where':{'CmContactId':_0x446d7c,'item':_0x2cd274}})['then'](function(_0x404967){_0x154302({'res':_0xbe4f('0x2a')});});}else{return db['CmContactHasItem'][_0xbe4f('0x2b')]({'CmContactId':_0x446d7c,'item':_0x2cd274,'ItemTypeId':_0x43334a,'OrderBy':_0xd5d455,'ItemClass':'PHONE'})[_0xbe4f('0x20')](function(_0x10ee7a){_0x154302({'res':_0xbe4f('0x2c')});});}});});}function updateContact(_0x3d4f42){return new Promise(function(_0x1a3f37,_0xa028d2){var _0x46a401=_0x3d4f42['id'];delete _0x3d4f42['id'];return db['CmContact']['update'](_0x3d4f42,{'where':{'id':_0x46a401}})['then'](function(_0x37ab4a){updatedRows+=0x1;return db[_0xbe4f('0x2d')][_0xbe4f('0x29')]({'phone':_0x3d4f42[_0xbe4f('0x12')]},{'where':{'ContactId':_0x46a401}})[_0xbe4f('0x20')](function(_0x2efcef){_0x1a3f37({'ret':'OK'});});});});}function insertCmHopper(_0x7b0a58,_0x4bab84,_0x506a80,_0x5171f9,_0x2ebc05){var _0x53fa46=[_0xbe4f('0x2e'),_0xbe4f('0x2f'),_0xbe4f('0x30'),_0xbe4f('0x31'),_0x4bab84+'.'+_0x5171f9,_0xbe4f('0x32'),'cm_contacts.updatedAt',_0xbe4f('0x33'),_0xbe4f('0x34'),'\x22'+_0x2ebc05+'\x22'];return squel[_0xbe4f('0x35')]()['into'](_0xbe4f('0x36'))['fromQuery']([_0xbe4f('0x12'),'scheduledat',_0xbe4f('0x37'),_0xbe4f('0x38'),_0x5171f9,_0xbe4f('0x39'),_0xbe4f('0x3a'),_0xbe4f('0x3b'),'UserId','recallme'],squel[_0xbe4f('0x3c')]()['fields'](_0x53fa46)[_0xbe4f('0x13')](_0x4bab84)[_0xbe4f('0x14')]('cm_contacts',null,_0xbe4f('0x3d')+_0x4bab84+_0xbe4f('0x3e'))[_0xbe4f('0x14')](_0x506a80,null,_0x506a80+_0xbe4f('0x15')+_0x4bab84+'.'+_0x5171f9)['where'](_0x4bab84+_0xbe4f('0x3f'),_0x7b0a58)[_0xbe4f('0x16')](_0xbe4f('0x40'),NOW)['where'](_0xbe4f('0x41'),selectNotIn(_0x4bab84,_0x506a80,_0x5171f9,_0xbe4f('0x36'),[_0xbe4f('0x42'),_0xbe4f('0x43')]))[_0xbe4f('0x16')](_0xbe4f('0x41'),selectNotIn(_0x4bab84,_0x506a80,_0x5171f9,_0xbe4f('0x36'),['\x22always\x22'])))[_0xbe4f('0x44')]();}function insertCmHopperBlack(_0x269452,_0x3b2d04,_0x453196,_0x58f8f7){var _0x495096=[_0xbe4f('0x2e'),_0xbe4f('0x30'),_0xbe4f('0x31'),_0x3b2d04+'.'+_0x58f8f7,_0xbe4f('0x32'),_0xbe4f('0x45')];return squel[_0xbe4f('0x35')]()[_0xbe4f('0x46')]('cm_hopper_black')[_0xbe4f('0x47')]([_0xbe4f('0x12'),'ContactId',_0xbe4f('0x38'),_0x58f8f7,'createdAt','updatedAt'],squel[_0xbe4f('0x3c')]()[_0xbe4f('0x48')](_0x495096)['from'](_0x3b2d04)[_0xbe4f('0x14')]('cm_contacts',null,_0xbe4f('0x3d')+_0x3b2d04+'.CmListId')[_0xbe4f('0x14')](_0x453196,null,_0x453196+'.id\x20=\x20'+_0x3b2d04+'.'+_0x58f8f7)['where'](_0x3b2d04+_0xbe4f('0x3f'),_0x269452)[_0xbe4f('0x16')](_0xbe4f('0x40'),NOW)[_0xbe4f('0x16')](_0xbe4f('0x41'),squel[_0xbe4f('0x3c')]()[_0xbe4f('0x11')](_0xbe4f('0x12'))[_0xbe4f('0x13')](_0xbe4f('0x49'))[_0xbe4f('0x16')](_0xbe4f('0x4a'),_0x269452)['where'](_0x58f8f7+'\x20=\x20?',_0x3b2d04+'.'+_0x58f8f7)))[_0xbe4f('0x44')]();}function insertCmHopperAdditionalPhones(_0x5c6974){var _0x4a49cd=[_0xbe4f('0x4b'),_0xbe4f('0x4c'),_0xbe4f('0x4d'),_0xbe4f('0x4e'),_0xbe4f('0x4f')];return squel[_0xbe4f('0x35')]()[_0xbe4f('0x46')](_0xbe4f('0x50'))[_0xbe4f('0x47')]([_0xbe4f('0x51'),'phone',_0xbe4f('0x52'),_0xbe4f('0x39'),'updatedAt'],squel['select']()[_0xbe4f('0x48')](_0x4a49cd)[_0xbe4f('0x13')](_0xbe4f('0x36'))[_0xbe4f('0x14')](_0xbe4f('0x53'),null,_0xbe4f('0x54'))['join'](_0xbe4f('0x55'),null,_0xbe4f('0x56'))[_0xbe4f('0x16')](_0xbe4f('0x57'),_0x5c6974)[_0xbe4f('0x16')](_0xbe4f('0x40'),NOW))['toString']();}function insertCmContact(_0x2e3b22,_0x17c840,_0x2cce8e,_0x3320f8){var _0x97870f=_[_0xbe4f('0x58')](_[_0xbe4f('0x59')](_0x3320f8),[_0xbe4f('0x38'),'CompanyId',_0xbe4f('0x39'),_0xbe4f('0x3a')]);return squel[_0xbe4f('0x35')]()[_0xbe4f('0x46')](_0xbe4f('0x53'))[_0xbe4f('0x47')](_0x97870f,squel[_0xbe4f('0x3c')]()['fields'](_0x97870f)['from'](_0x17c840)['where']('('+_0x2cce8e[_0xbe4f('0x14')](',')+_0xbe4f('0x5a'),squel['select']()[_0xbe4f('0x48')](_0x2cce8e)[_0xbe4f('0x13')](_0xbe4f('0x53'))['where']('ListId\x20=\x20?',_0x2e3b22))[_0xbe4f('0x16')]('id\x20IN\x20?',squel['select']()[_0xbe4f('0x11')](_0xbe4f('0x5b'),_0xbe4f('0x5c'))['from'](_0x17c840)[_0xbe4f('0x5d')](_0x2cce8e['join'](','))))[_0xbe4f('0x44')]();}function handleStop(){logger[_0xbe4f('0x5e')](_0xbe4f('0x5f'));stopped=!![];}function handleUncaughtException(_0x1704fd){logger[_0xbe4f('0x22')](_0x1704fd[_0xbe4f('0x23')]);process[_0xbe4f('0x60')](0x1);}function handleError(_0x522457,_0x437428){stats['errors']['push']({'name':_0x437428[_0xbe4f('0x61')],'message':_0x437428[_0xbe4f('0x23')],'row':_0x522457});}function handleQuery(_0x129de8){logger['info'](_0x129de8);return db['sequelize'][_0xbe4f('0x1a')](_0x129de8)[_0xbe4f('0x62')](function(_0x24d545){results[_0xbe4f('0x1e')](_0x24d545);})[_0xbe4f('0x21')](function(_0x475a8e){logger[_0xbe4f('0x22')](_0x475a8e[_0xbe4f('0x23')]);});}function main(_0x498456,_0x32d9b8,_0x543ac3,_0x5ba99d){logger['info']('main',_0x498456,JSON[_0xbe4f('0x63')](_0x32d9b8));process[_0xbe4f('0x64')](_0xbe4f('0x65'));var _0x5e7c5f=_0x32d9b8['binding'];var _0x1d9906=_[_0xbe4f('0x66')](_0x5e7c5f);var _0x217905=_0x32d9b8[_0xbe4f('0x67')];var _0x4384b2=path[_0xbe4f('0x14')](config[_0xbe4f('0x68')],_0xbe4f('0x69'),_0x217905+_0xbe4f('0x6a'));logger[_0xbe4f('0x5e')](_0xbe4f('0x6b'),_0x32d9b8);db[_0xbe4f('0x6c')][_0xbe4f('0x6d')]({'raw':!![],'attributes':['id',_0xbe4f('0x6e')]})[_0xbe4f('0x20')](function(_0x9974b7){for(var _0x20a1c8=0x0;_0x20a1c8<_0x9974b7[_0xbe4f('0x1c')];_0x20a1c8++){if(_0x9974b7[_0x20a1c8][_0xbe4f('0x6e')]in _0x5e7c5f){contactItemTypes['push'](_0x9974b7[_0x20a1c8]);delete _0x1d9906[_0x9974b7[_0x20a1c8]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x1d9906[_0xbe4f('0x24')]='';var _0x5be69b=_[_0xbe4f('0x59')](_0x1d9906)[_0xbe4f('0x14')]();logger[_0xbe4f('0x5e')](_0xbe4f('0x6f'),_0x5be69b);fs['writeFileSync'](_0x4384b2,_0x5be69b+'\x0a');Papa[_0xbe4f('0x70')](fs[_0xbe4f('0x71')](_0x498456),{'header':!![],'skipEmptyLines':!![],'step':function(_0x49fc40,_0x26a007){try{for(var _0x5d7a76=0x0,_0x468258=[];_0x5d7a76<_0x49fc40[_0xbe4f('0x72')][_0xbe4f('0x1c')];_0x5d7a76++){stats[_0xbe4f('0x73')]+=0x1;if(_0x49fc40['errors'][_0x5d7a76]){handleError(_0x49fc40[_0xbe4f('0x72')][_0x5d7a76],_0x49fc40[_0xbe4f('0x74')][_0x5d7a76]);}else{var _0x8a18dc=[];var _0x39ae86=[];for(var _0x57c559 in _0x5e7c5f){let _0x454ae5=contactItemTypes['find'](_0x518e3f=>_0x518e3f['name']===_0x57c559);if(_[_0xbe4f('0x1d')](_0x454ae5)){if(_0x5e7c5f[_0xbe4f('0x75')](_0x57c559)){if(_0x49fc40[_0xbe4f('0x72')][_0x5d7a76][_0x5e7c5f[_0x57c559]]){var _0xede7b9=_[_0xbe4f('0x76')](_0x49fc40[_0xbe4f('0x72')][_0x5d7a76][_0x5e7c5f[_0x57c559]][_0xbe4f('0x77')](/"/g,'\x27'));switch(_0x57c559){case _0xbe4f('0x78'):var _0x4ed9bc=moment(_0xede7b9,_0xbe4f('0xe'),!![]);if(_0x4ed9bc[_0xbe4f('0x79')]()){_0x468258['push']('\x22'+_0xede7b9+'\x22');}else{_0x8a18dc[_0xbe4f('0x1e')](_0xbe4f('0x7a'));}break;case _0xbe4f('0x3b'):var _0x5e7a5b=parseInt(_0xede7b9);_0xede7b9=_['isNaN'](_0x5e7a5b)||_0x5e7a5b<0x0||_0x5e7a5b>0x4?_0x5ba99d?0x3:0x2:_0x5e7a5b;_0x468258[_0xbe4f('0x1e')]('\x22'+_0xede7b9+'\x22');break;case'UserId':var _0x163e1c=parseInt(_0xede7b9);if(_['isNumber'](_0x163e1c)&&_['includes'](_0x543ac3,_0x163e1c)){_0x468258[_0xbe4f('0x1e')]('\x22'+_0x163e1c+'\x22');}else{_0x8a18dc[_0xbe4f('0x1e')](_0xbe4f('0x7b'));}break;case _0xbe4f('0x7c'):if(isEmail(_0xede7b9)){_0x468258['push']('\x22'+_0xede7b9+'\x22');}else{_0x8a18dc['push'](_0xbe4f('0x7d'));}break;case _0xbe4f('0x7e'):var _0x279fee=moment(_0xede7b9,_0xbe4f('0x7f'),!![]);if(_0x279fee[_0xbe4f('0x79')]()){_0x468258[_0xbe4f('0x1e')]('\x22'+_0xede7b9+'\x22');}else{_0x8a18dc[_0xbe4f('0x1e')](_0xbe4f('0x80'));}break;default:_0x468258[_0xbe4f('0x1e')]('\x22'+_0xede7b9+'\x22');}}else{switch(_0x57c559){case _0xbe4f('0x81'):case _0xbe4f('0x12'):_0x8a18dc[_0xbe4f('0x1e')](_0x57c559+_0xbe4f('0x82'));break;default:_0x468258[_0xbe4f('0x1e')]('\x22\x22');}}}}else{var _0x139940='';for(var _0x351053=0x0;_0x351053<_0x5e7c5f[_0x57c559][_0xbe4f('0x1c')];_0x351053++){var _0xede7b9=_[_0xbe4f('0x76')](_0x49fc40[_0xbe4f('0x72')][_0x5d7a76][_0x5e7c5f[_0x57c559][_0x351053]][_0xbe4f('0x77')](/"/g,'\x27'));if(_0x139940=='')_0x139940=_0xede7b9;else _0x139940+='|'+_0xede7b9;}_0x39ae86[_0xbe4f('0x1e')](_0x454ae5['id']+':'+_0x139940);}}if(hasAdditionalPhones){_0x468258[_0xbe4f('0x1e')]('\x22'+_0x39ae86[_0xbe4f('0x14')](';')+'\x22');}if(_0x8a18dc['length']){handleError(_0x49fc40[_0xbe4f('0x72')][_0x5d7a76],{'code':'SystemRow','message':_0x8a18dc['join']()});}else{fs[_0xbe4f('0x83')](_0x4384b2,_0x468258['join']()+'\x0a');}_0x468258=[];}if(!(stats[_0xbe4f('0x73')]%0xc8)){socket[_0xbe4f('0x84')](_0xbe4f('0x85')+_0x217905,stats);stats[_0xbe4f('0x74')]=[];}}if(stopped){logger['info'](_0xbe4f('0x86'));_0x26a007[_0xbe4f('0x87')]();}}catch(_0x3d3836){handleError(_0x49fc40[_0xbe4f('0x72')][_0x5d7a76],{'code':_0xbe4f('0x88'),'message':_0x3d3836['message']});logger[_0xbe4f('0x22')](_0xbe4f('0x89'),_0x3d3836[_0xbe4f('0x23')]);}},'complete':function(){try{var _0x503791=[];var _0x52451e=tempTableName;_0x503791[_0xbe4f('0x1e')](_0xbe4f('0x8a')+_0x52451e+_0xbe4f('0x8b'));logger[_0xbe4f('0x5e')](_0xbe4f('0x8c'),contactItemTypes[_0xbe4f('0x1c')]);var _0x131f2c=util[_0xbe4f('0xd')](_0xbe4f('0x8d'),_0x4384b2,_0x52451e,_0x5be69b,_0x32d9b8[_0xbe4f('0x38')],_0x32d9b8[_0xbe4f('0x8e')]||null,NOW,NOW);if(_[_0xbe4f('0x1d')](_0x5e7c5f[_0xbe4f('0x78')])){_0x131f2c+=_0xbe4f('0x8f');}_0x503791[_0xbe4f('0x1e')](_0x131f2c);BPromise[_0xbe4f('0x90')](_0x503791,handleQuery)[_0xbe4f('0x20')](function(_0xea198f){BPromise[_0xbe4f('0x1f')]([handleAdditionalPhones()])[_0xbe4f('0x20')](function(){_0x503791=[];for(var _0x53df43=0x0;_0x53df43=_0x125e9b){return _0x407fa2[_0xe370('0x15')](0x193)['json']({'message':util[_0xe370('0x9')](_0xe370('0x16'),_0x5afd7c)});}_0x22574a();})[_0xe370('0x17')](function(_0x3547d8){_0x22574a(_0x3547d8);});});}function isUserLimit(){return isLimit(_0xe370('0x18'),0x1,db['User'],{'where':{'$or':[{'role':_0xe370('0x19')},{'role':_0xe370('0x1a')}]}});}exports[_0xe370('0x1b')]=isUserLimit; \ No newline at end of file +var _0x1343=['then','catch','users','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','final','utf8','hasOwnProperty','use','License','findOne','count'];(function(_0x5395a,_0x4bbdbc){var _0x1328e4=function(_0x45954c){while(--_0x45954c){_0x5395a['push'](_0x5395a['shift']());}};_0x1328e4(++_0x4bbdbc);}(_0x1343,0x174));var _0x3134=function(_0x4b60ae,_0x4ea45c){_0x4b60ae=_0x4b60ae-0x0;var _0x11ddbe=_0x1343[_0x4b60ae];return _0x11ddbe;};'use strict';var crypto=require('crypto');var util=require(_0x3134('0x0'));var compose=require(_0x3134('0x1'));var db=require(_0x3134('0x2'))['db'];var config=require(_0x3134('0x3'));function getValueFromLicense(_0x16a88b,_0x47c485){if(_0x16a88b&&_0x47c485){if(_0x47c485[_0x3134('0x4')]&&_0x47c485[_0x3134('0x5')]){var _0x51add1=_0x47c485[_0x3134('0x4')];var _0x2a480d=_0x47c485[_0x3134('0x5')];var _0x3f0f9e=_0x51add1['split']('-')[0x4];var _0x1b21d6=_0x51add1[_0x3134('0x6')]('-')[0x0];var _0x2ad88a=crypto[_0x3134('0x7')](_0x3134('0x8'),util[_0x3134('0x9')](_0x3134('0xa'),_0x3f0f9e,_0x51add1,_0x1b21d6));var _0x5c443c=_0x2ad88a['update'](_0x2a480d,_0x3134('0xb'),'utf8');_0x5c443c+=_0x2ad88a[_0x3134('0xc')](_0x3134('0xd'));var _0x3cf78f=JSON['parse'](_0x5c443c);return _0x3cf78f[_0x3134('0xe')](_0x16a88b)?_0x3cf78f[_0x16a88b]:null;}}return null;}function isLimit(_0x51e5fb,_0x2bceee,_0x239ec3,_0xfb3c33){var _0x56fdab=_0x2bceee;return compose()[_0x3134('0xf')](function(_0x3061e1,_0x4dc8e9,_0x1d551b){return db[_0x3134('0x10')][_0x3134('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x284aac){var _0x44e2c0=getValueFromLicense(_0x51e5fb,_0x284aac);return _0x44e2c0?_0x44e2c0:_0x56fdab;})['then'](function(_0x1552f0){_0x56fdab=_0x1552f0;return _0x239ec3[_0x3134('0x12')](_0xfb3c33);})[_0x3134('0x13')](function(_0x47d439){if(_0x47d439>=_0x56fdab){return _0x4dc8e9['status'](0x193)['json']({'message':util[_0x3134('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x51e5fb)});}_0x1d551b();})[_0x3134('0x14')](function(_0x56fcda){_0x1d551b(_0x56fcda);});});}function isUserLimit(){return isLimit(_0x3134('0x15'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x3134('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 68f52cf..951430f 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 _0xe999=['[$or]','and','replace','split','length','forEach','filter','indexOf','map','conditions','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','hours','minutes','seconds','moment'];(function(_0x55c120,_0x3c7bfe){var _0x52dc57=function(_0x68432f){while(--_0x68432f){_0x55c120['push'](_0x55c120['shift']());}};_0x52dc57(++_0x3c7bfe);}(_0xe999,0x1e5));var _0x9e99=function(_0x26c7d3,_0x31be42){_0x26c7d3=_0x26c7d3-0x0;var _0x430566=_0xe999[_0x26c7d3];return _0x430566;};'use strict';var _=require('lodash');var moment=require(_0x9e99('0x0'));exports['parseSearch']=function(_0xc0f93){var _0x34723b={'conditions':[]};_0x34723b['sqlOperator']=_['startsWith'](_0xc0f93,_0x9e99('0x1'))?'or':_0x9e99('0x2');var _0x56d99e=_0xc0f93[_0x9e99('0x3')]('[$and]','')[_0x9e99('0x3')](_0x9e99('0x1'),'')[_0x9e99('0x4')]('||');for(var _0x507308=0x0;_0x507308<_0x56d99e[_0x9e99('0x5')];_0x507308++){var _0x1debb5=_0x56d99e[_0x507308]['split'](':=');var _0x156a89=_0x1debb5[0x0];var _0x32d636=_0x1debb5['slice'](0x1);_0x32d636[_0x9e99('0x6')](function(_0x39f139){var _0x5ab581=_0x39f139[_0x9e99('0x4')]('[')['shift']();var _0xbc5bd6=_0x39f139['match'](/\[(.*?)\]/g);_0xbc5bd6[_0x9e99('0x6')](function(_0x1f6955){var _0x4255f3=_0x1f6955[_0x9e99('0x4')]('[')[_0x9e99('0x7')](function(_0x349cc1){return _0x349cc1[_0x9e99('0x8')](']')>-0x1;})[_0x9e99('0x9')](function(_0x3d4279){return _0x3d4279[_0x9e99('0x4')](']')[0x0];})[0x0];_0x34723b[_0x9e99('0xa')]['push']({'field':_0x156a89,'operator':_0x5ab581,'value':_0x4255f3});});});}return _0x34723b;};exports[_0x9e99('0xb')]=function(_0x52e766,_0x39f4d0,_0x176ea7){var _0x556613={};if(_0x39f4d0===_0x9e99('0xc')){if(_0x176ea7[_0x9e99('0xd')]===_0x9e99('0xe')){_0x176ea7[_0x9e99('0xd')]=_0x9e99('0xf');_0x176ea7[_0x9e99('0x10')]+=','+_0x176ea7[_0x9e99('0x10')];}else if(_[_0x9e99('0x11')](['$gt',_0x9e99('0x12')],_0x176ea7['operator'])){_0x176ea7['value']=moment(_0x176ea7[_0x9e99('0x10')])[_0x9e99('0x13')](0x1,_0x9e99('0x14'))[_0x9e99('0x15')](_0x9e99('0x16'));}}if(_0x176ea7[_0x9e99('0x17')]){_0x39f4d0=_0x176ea7[_0x9e99('0x17')];_0x556613[_0x9e99('0x18')]='CAST('+_0x52e766+'.'+_0x176ea7[_0x9e99('0x19')]+_0x9e99('0x1a')+_0x176ea7[_0x9e99('0x17')]+')\x20'+parseOperator(_0x176ea7[_0x9e99('0xd')]);}else{_0x556613[_0x9e99('0x18')]=_0x52e766+'.'+_0x176ea7[_0x9e99('0x19')]+'\x20'+parseOperator(_0x176ea7[_0x9e99('0xd')]);}if(_[_0x9e99('0x11')](['$ne',_0x9e99('0x1b')],_0x176ea7[_0x9e99('0xd')]))_0x556613['text']='('+_0x556613[_0x9e99('0x18')]+_0x9e99('0x1c')+_0x52e766+'.'+_0x176ea7[_0x9e99('0x19')]+_0x9e99('0x1d');_0x556613[_0x9e99('0x10')]=parseValue(_0x39f4d0,_0x176ea7[_0x9e99('0xd')],_0x176ea7[_0x9e99('0x10')]);return _0x556613;};function parseOperator(_0x436041){var _0x5f15df;switch(_0x436041){case _0x9e99('0x1e'):_0x5f15df=_0x9e99('0x1f');break;case _0x9e99('0x1b'):_0x5f15df=_0x9e99('0x20');break;case _0x9e99('0xe'):_0x5f15df=_0x9e99('0x21');break;case _0x9e99('0x22'):_0x5f15df=_0x9e99('0x23');break;case _0x9e99('0x24'):case _0x9e99('0x25'):case'$endsWith':_0x5f15df=_0x9e99('0x26');break;case _0x9e99('0x27'):_0x5f15df=_0x9e99('0x28');break;case _0x9e99('0x29'):_0x5f15df=_0x9e99('0x2a');break;case _0x9e99('0x12'):_0x5f15df=_0x9e99('0x2b');break;case _0x9e99('0x2c'):_0x5f15df=_0x9e99('0x2d');break;case _0x9e99('0xf'):_0x5f15df=_0x9e99('0x2e');break;}return _0x5f15df;}function parseValue(_0x4f1cdc,_0x168e74,_0x3251b0){var _0x393dbc={'start':undefined,'end':undefined};switch(_0x168e74){case _0x9e99('0x1e'):case _0x9e99('0x1b'):_0x393dbc[_0x9e99('0x2f')]=_0x3251b0[_0x9e99('0x4')](',');break;case _0x9e99('0x24'):_0x393dbc[_0x9e99('0x2f')]='%'+_0x3251b0+'%';break;case'$startsWith':_0x393dbc['start']=_0x3251b0+'%';break;case _0x9e99('0x30'):_0x393dbc[_0x9e99('0x2f')]='%'+_0x3251b0;break;case _0x9e99('0xf'):var _0x1f1d98=_0x3251b0[_0x9e99('0x4')](',');var _0x3251b0=_0x1f1d98['shift']();var _0x2a139e=_0x1f1d98[_0x9e99('0x31')]();if(_0x4f1cdc===_0x9e99('0xc')){_0x3251b0=moment(_0x3251b0)[_0x9e99('0x32')](0x0,!![])[_0x9e99('0x15')]();_0x2a139e=moment(_0x2a139e)[_0x9e99('0x32')](0x0,!![])[_0x9e99('0x13')](0x17,_0x9e99('0x33'))[_0x9e99('0x13')](0x3b,_0x9e99('0x34'))[_0x9e99('0x13')](0x3b,_0x9e99('0x35'))[_0x9e99('0x15')]();}_0x393dbc={'start':_0x3251b0,'end':_0x2a139e};break;default:_0x393dbc[_0x9e99('0x2f')]=_0x3251b0;break;}return _0x393dbc;} \ No newline at end of file +var _0xf3f7=['shift','match','indexOf','map','conditions','push','DATE','value','includes','$gt','$lte','operator','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','$between','start','utcOffset','format','hours','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach'];(function(_0x5d82ad,_0x2a734a){var _0x4ab31f=function(_0x4c9098){while(--_0x4c9098){_0x5d82ad['push'](_0x5d82ad['shift']());}};_0x4ab31f(++_0x2a734a);}(_0xf3f7,0x1d1));var _0x7f3f=function(_0x5f1a3c,_0x62321e){_0x5f1a3c=_0x5f1a3c-0x0;var _0x3e8fd9=_0xf3f7[_0x5f1a3c];return _0x3e8fd9;};'use strict';var _=require(_0x7f3f('0x0'));var moment=require('moment');exports[_0x7f3f('0x1')]=function(_0x388cea){var _0x2c99fc={'conditions':[]};_0x2c99fc[_0x7f3f('0x2')]=_[_0x7f3f('0x3')](_0x388cea,_0x7f3f('0x4'))?'or':_0x7f3f('0x5');var _0x4c5d84=_0x388cea[_0x7f3f('0x6')](_0x7f3f('0x7'),'')['replace'](_0x7f3f('0x4'),'')[_0x7f3f('0x8')]('||');for(var _0x28b566=0x0;_0x28b566<_0x4c5d84[_0x7f3f('0x9')];_0x28b566++){var _0x3aa41a=_0x4c5d84[_0x28b566][_0x7f3f('0x8')](':=');var _0x50de24=_0x3aa41a[0x0];var _0x5a592d=_0x3aa41a[_0x7f3f('0xa')](0x1);_0x5a592d[_0x7f3f('0xb')](function(_0x3bb8ff){var _0x13a7ab=_0x3bb8ff[_0x7f3f('0x8')]('[')[_0x7f3f('0xc')]();var _0x88122a=_0x3bb8ff[_0x7f3f('0xd')](/\[(.*?)\]/g);_0x88122a[_0x7f3f('0xb')](function(_0x55e904){var _0x141ac9=_0x55e904[_0x7f3f('0x8')]('[')['filter'](function(_0x4657a4){return _0x4657a4[_0x7f3f('0xe')](']')>-0x1;})[_0x7f3f('0xf')](function(_0x2d2aa8){return _0x2d2aa8[_0x7f3f('0x8')](']')[0x0];})[0x0];_0x2c99fc[_0x7f3f('0x10')][_0x7f3f('0x11')]({'field':_0x50de24,'operator':_0x13a7ab,'value':_0x141ac9});});});}return _0x2c99fc;};exports['buildExpression']=function(_0x586e44,_0x2e3286,_0x249b79){var _0x3b8ac7={};if(_0x2e3286===_0x7f3f('0x12')){if(_0x249b79['operator']==='$eq'){_0x249b79['operator']='$between';_0x249b79['value']+=','+_0x249b79[_0x7f3f('0x13')];}else if(_[_0x7f3f('0x14')]([_0x7f3f('0x15'),_0x7f3f('0x16')],_0x249b79[_0x7f3f('0x17')])){_0x249b79[_0x7f3f('0x13')]=moment(_0x249b79['value'])[_0x7f3f('0x18')](0x1,_0x7f3f('0x19'))['format'](_0x7f3f('0x1a'));}}if(_0x249b79[_0x7f3f('0x1b')]){_0x2e3286=_0x249b79[_0x7f3f('0x1b')];_0x3b8ac7[_0x7f3f('0x1c')]=_0x7f3f('0x1d')+_0x586e44+'.'+_0x249b79[_0x7f3f('0x1e')]+_0x7f3f('0x1f')+_0x249b79[_0x7f3f('0x1b')]+')\x20'+parseOperator(_0x249b79[_0x7f3f('0x17')]);}else{_0x3b8ac7[_0x7f3f('0x1c')]=_0x586e44+'.'+_0x249b79[_0x7f3f('0x1e')]+'\x20'+parseOperator(_0x249b79[_0x7f3f('0x17')]);}if(_['includes']([_0x7f3f('0x20'),_0x7f3f('0x21')],_0x249b79[_0x7f3f('0x17')]))_0x3b8ac7[_0x7f3f('0x1c')]='('+_0x3b8ac7['text']+_0x7f3f('0x22')+_0x586e44+'.'+_0x249b79['field']+_0x7f3f('0x23');_0x3b8ac7[_0x7f3f('0x13')]=parseValue(_0x2e3286,_0x249b79[_0x7f3f('0x17')],_0x249b79['value']);return _0x3b8ac7;};function parseOperator(_0x42ff0f){var _0x23985d;switch(_0x42ff0f){case _0x7f3f('0x24'):_0x23985d=_0x7f3f('0x25');break;case _0x7f3f('0x21'):_0x23985d=_0x7f3f('0x26');break;case _0x7f3f('0x27'):_0x23985d='=\x20?';break;case _0x7f3f('0x20'):_0x23985d=_0x7f3f('0x28');break;case _0x7f3f('0x29'):case _0x7f3f('0x2a'):case'$endsWith':_0x23985d=_0x7f3f('0x2b');break;case _0x7f3f('0x2c'):_0x23985d=_0x7f3f('0x2d');break;case _0x7f3f('0x15'):_0x23985d=_0x7f3f('0x2e');break;case _0x7f3f('0x16'):_0x23985d='<=\x20?';break;case _0x7f3f('0x2f'):_0x23985d='>=\x20?';break;case _0x7f3f('0x30'):_0x23985d='BETWEEN\x20?\x20AND\x20?';break;}return _0x23985d;}function parseValue(_0x2b1e8e,_0x202f46,_0x363890){var _0x3e359a={'start':undefined,'end':undefined};switch(_0x202f46){case _0x7f3f('0x24'):case _0x7f3f('0x21'):_0x3e359a[_0x7f3f('0x31')]=_0x363890['split'](',');break;case _0x7f3f('0x29'):_0x3e359a[_0x7f3f('0x31')]='%'+_0x363890+'%';break;case _0x7f3f('0x2a'):_0x3e359a[_0x7f3f('0x31')]=_0x363890+'%';break;case'$endsWith':_0x3e359a[_0x7f3f('0x31')]='%'+_0x363890;break;case _0x7f3f('0x30'):var _0x15605d=_0x363890[_0x7f3f('0x8')](',');var _0x363890=_0x15605d[_0x7f3f('0xc')]();var _0xb2efda=_0x15605d['pop']();if(_0x2b1e8e===_0x7f3f('0x12')){_0x363890=moment(_0x363890)[_0x7f3f('0x32')](0x0,!![])[_0x7f3f('0x33')]();_0xb2efda=moment(_0xb2efda)[_0x7f3f('0x32')](0x0,!![])['add'](0x17,_0x7f3f('0x34'))[_0x7f3f('0x18')](0x3b,'minutes')[_0x7f3f('0x18')](0x3b,'seconds')['format']();}_0x3e359a={'start':_0x363890,'end':_0xb2efda};break;default:_0x3e359a[_0x7f3f('0x31')]=_0x363890;break;}return _0x3e359a;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4407c1e..0bd1a27 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 _0xa547=['format','$lte','YYYY-MM-DD','subtract','isArray','limit','offset','priority','cast','unsigned','DESC','col','ASC','omit','isEmpty','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','getFullTextValue','forEach','push','toString','join','sequelize','fields','split','filters','forOwn','DATE','isPlainObject','parse','utc'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xa547,0xb0));var _0x7a54=function(_0x42d966,_0x4888f3){_0x42d966=_0x42d966-0x0;var _0x50e3b6=_0xa547[_0x42d966];return _0x50e3b6;};'use strict';var _=require('lodash');var sequelize=require(_0x7a54('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0x7a54('0x1')]=function(_0x5b6b4d){var _0x1908ee=null;if(_0x5b6b4d){_0x1908ee=_0x5b6b4d[_0x7a54('0x2')](',');}return _0x1908ee;};exports[_0x7a54('0x3')]=function(_0x335731,_0x2e210c){var _0xe681d1={};if(!_['isEmpty'](_0x335731)){_[_0x7a54('0x4')](_0x335731,function(_0x2a6b1a,_0xdeaa1c){try{if(_0x2e210c){var _0x3f5dd7=_['find'](_0x2e210c,{'name':_0xdeaa1c})||{};if(_0x3f5dd7['type']===_0x7a54('0x5')&&_[_0x7a54('0x6')](_0x2a6b1a)){var _0x97f971=JSON[_0x7a54('0x7')](_0x2a6b1a);var _0x226d36={'$gte':moment(moment(_0x97f971['$gte'])['format']('YYYY-MM-DD'))[_0x7a54('0x8')]()[_0x7a54('0x9')](),'$lte':moment(moment(_0x97f971[_0x7a54('0xa')])[_0x7a54('0x9')](_0x7a54('0xb')))[_0x7a54('0x8')]()[_0x7a54('0xc')](0x1,'s')[_0x7a54('0x9')]()};_0xe681d1[_0xdeaa1c]=_0x226d36;}else{_0xe681d1[_0xdeaa1c]=_[_0x7a54('0xd')](_0x2a6b1a)?_0x2a6b1a:JSON[_0x7a54('0x7')](_0x2a6b1a);}}else{_0xe681d1[_0xdeaa1c]=_[_0x7a54('0xd')](_0x2a6b1a)?_0x2a6b1a:JSON[_0x7a54('0x7')](_0x2a6b1a);}}catch(_0x545363){_0xe681d1[_0xdeaa1c]=_0x2a6b1a[_0x7a54('0x2')](',');}});}return _0xe681d1;};exports[_0x7a54('0xe')]=function(_0x2fb211){_0x2fb211=parseInt(_0x2fb211,0xa);if(!_0x2fb211||_0x2fb211<0x0){_0x2fb211=LIMIT_VALUE;}return _0x2fb211;};exports[_0x7a54('0xf')]=function(_0x5c13bc){_0x5c13bc=parseInt(_0x5c13bc,0xa);if(!_0x5c13bc||_0x5c13bc<0x0){_0x5c13bc=0x0;}return _0x5c13bc;};exports['sort']=function(_0x5adf0d){var _0x5e567f,_0x3c63ad=null;if(_0x5adf0d){_0x5e567f=_0x5adf0d[_0x7a54('0x2')](',');_0x3c63ad=_['map'](_0x5e567f,function(_0x1fcc0d){if(_0x1fcc0d['indexOf']('-')===0x0){return[_0x1fcc0d===_0x7a54('0x10')?sequelize[_0x7a54('0x11')](sequelize['col'](_0x7a54('0x10')),_0x7a54('0x12')):_0x1fcc0d['substr'](0x1),_0x7a54('0x13')];}else{return[_0x1fcc0d==='priority'?sequelize[_0x7a54('0x11')](sequelize[_0x7a54('0x14')](_0x7a54('0x10')),_0x7a54('0x12')):_0x1fcc0d,_0x7a54('0x15')];}});}return _0x3c63ad;};exports[_0x7a54('0x16')]=function(_0x11bc93,_0x3c2b51){if(_[_0x7a54('0x17')](_0x11bc93)){return _0x11bc93;}if(_[_0x7a54('0xd')](_0x11bc93)){for(var _0x5049a0=0x0;_0x5049a0<_0x11bc93[_0x7a54('0x18')];_0x5049a0+=0x1){_0x11bc93[_0x5049a0]=this[_0x7a54('0x16')](_0x11bc93[_0x5049a0],_0x3c2b51);}return _0x11bc93;}if(!_[_0x7a54('0x19')](_0x11bc93)){return _0x11bc93;}if(_[_0x7a54('0x1a')](_0x3c2b51)){_0x3c2b51=[_0x3c2b51];}if(!_[_0x7a54('0xd')](_0x3c2b51)){return _0x11bc93;}for(var _0x3e4d04=0x0;_0x3e4d04<_0x3c2b51[_0x7a54('0x18')];_0x3e4d04+=0x1){_[_0x7a54('0x1b')](_0x11bc93,_0x3c2b51[_0x3e4d04]);}for(var _0x4d5dfc in _0x11bc93){if(_0x11bc93[_0x7a54('0x1c')](_0x4d5dfc)){_0x11bc93[_0x4d5dfc]=this[_0x7a54('0x16')](_0x11bc93[_0x4d5dfc],_0x3c2b51);}}return _0x11bc93;};exports[_0x7a54('0x1d')]=function(_0xfd3021){return _0xfd3021[_0x7a54('0x1e')](RegExp(_0x7a54('0x1f')))?!![]:![];};exports['isEmail']=function(_0x223d3a){return _0x223d3a[_0x7a54('0x1e')](/^\S+@\S+$/)?!![]:![];};exports[_0x7a54('0x20')]=function(_0x1010b2){var _0x11f927=[];_0x1010b2[_0x7a54('0x2')]('\x20')[_0x7a54('0x21')](function(_0x150577){_0x11f927[_0x7a54('0x22')]('+'+_0x150577[_0x7a54('0x23')]()+'*');});return _0x11f927[_0x7a54('0x24')]('\x20');}; \ No newline at end of file +var _0x47b4=['isPlainObject','$gte','YYYY-MM-DD','utc','format','isArray','parse','split','limit','sort','cast','col','unsigned','priority','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','toString','fields','isEmpty','forOwn','find','type','DATE'];(function(_0x59f228,_0x57e995){var _0x364c5f=function(_0x34ff82){while(--_0x34ff82){_0x59f228['push'](_0x59f228['shift']());}};_0x364c5f(++_0x57e995);}(_0x47b4,0x144));var _0x447b=function(_0x537fd7,_0x5c3379){_0x537fd7=_0x537fd7-0x0;var _0x45903a=_0x47b4[_0x537fd7];return _0x45903a;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0x447b('0x0')]=function(_0xf39100){var _0x1aa6d2=null;if(_0xf39100){_0x1aa6d2=_0xf39100['split'](',');}return _0x1aa6d2;};exports['filters']=function(_0x4ae779,_0x362eb6){var _0x85216={};if(!_[_0x447b('0x1')](_0x4ae779)){_[_0x447b('0x2')](_0x4ae779,function(_0x5736a7,_0x5a62cc){try{if(_0x362eb6){var _0x182a5a=_[_0x447b('0x3')](_0x362eb6,{'name':_0x5a62cc})||{};if(_0x182a5a[_0x447b('0x4')]===_0x447b('0x5')&&_[_0x447b('0x6')](_0x5736a7)){var _0x29e9dd=JSON['parse'](_0x5736a7);var _0x3bda09={'$gte':moment(moment(_0x29e9dd[_0x447b('0x7')])['format'](_0x447b('0x8')))[_0x447b('0x9')]()[_0x447b('0xa')](),'$lte':moment(moment(_0x29e9dd['$lte'])[_0x447b('0xa')]('YYYY-MM-DD'))[_0x447b('0x9')]()['subtract'](0x1,'s')[_0x447b('0xa')]()};_0x85216[_0x5a62cc]=_0x3bda09;}else{_0x85216[_0x5a62cc]=_[_0x447b('0xb')](_0x5736a7)?_0x5736a7:JSON['parse'](_0x5736a7);}}else{_0x85216[_0x5a62cc]=_[_0x447b('0xb')](_0x5736a7)?_0x5736a7:JSON[_0x447b('0xc')](_0x5736a7);}}catch(_0x3f0a5f){_0x85216[_0x5a62cc]=_0x5736a7[_0x447b('0xd')](',');}});}return _0x85216;};exports[_0x447b('0xe')]=function(_0x2f0f39){_0x2f0f39=parseInt(_0x2f0f39,0xa);if(!_0x2f0f39||_0x2f0f39<0x0){_0x2f0f39=LIMIT_VALUE;}return _0x2f0f39;};exports['offset']=function(_0x3df952){_0x3df952=parseInt(_0x3df952,0xa);if(!_0x3df952||_0x3df952<0x0){_0x3df952=0x0;}return _0x3df952;};exports[_0x447b('0xf')]=function(_0x4b4d64){var _0x531309,_0x4cbd0b=null;if(_0x4b4d64){_0x531309=_0x4b4d64[_0x447b('0xd')](',');_0x4cbd0b=_['map'](_0x531309,function(_0xdd5016){if(_0xdd5016['indexOf']('-')===0x0){return[_0xdd5016==='priority'?sequelize[_0x447b('0x10')](sequelize[_0x447b('0x11')]('priority'),_0x447b('0x12')):_0xdd5016['substr'](0x1),'DESC'];}else{return[_0xdd5016===_0x447b('0x13')?sequelize['cast'](sequelize['col'](_0x447b('0x13')),'unsigned'):_0xdd5016,_0x447b('0x14')];}});}return _0x4cbd0b;};exports[_0x447b('0x15')]=function(_0x45a9d9,_0x26990c){if(_[_0x447b('0x1')](_0x45a9d9)){return _0x45a9d9;}if(_[_0x447b('0xb')](_0x45a9d9)){for(var _0x3a7b3a=0x0;_0x3a7b3a<_0x45a9d9[_0x447b('0x16')];_0x3a7b3a+=0x1){_0x45a9d9[_0x3a7b3a]=this[_0x447b('0x15')](_0x45a9d9[_0x3a7b3a],_0x26990c);}return _0x45a9d9;}if(!_[_0x447b('0x17')](_0x45a9d9)){return _0x45a9d9;}if(_[_0x447b('0x18')](_0x26990c)){_0x26990c=[_0x26990c];}if(!_['isArray'](_0x26990c)){return _0x45a9d9;}for(var _0x5ed61a=0x0;_0x5ed61a<_0x26990c[_0x447b('0x16')];_0x5ed61a+=0x1){_[_0x447b('0x19')](_0x45a9d9,_0x26990c[_0x5ed61a]);}for(var _0x3b5cf2 in _0x45a9d9){if(_0x45a9d9[_0x447b('0x1a')](_0x3b5cf2)){_0x45a9d9[_0x3b5cf2]=this[_0x447b('0x15')](_0x45a9d9[_0x3b5cf2],_0x26990c);}}return _0x45a9d9;};exports[_0x447b('0x1b')]=function(_0x443ac3){return _0x443ac3[_0x447b('0x1c')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0x447b('0x1d')]=function(_0x4b4eed){return _0x4b4eed[_0x447b('0x1c')](/^\S+@\S+$/)?!![]:![];};exports[_0x447b('0x1e')]=function(_0x21bd0a){var _0x1c9356=[];_0x21bd0a[_0x447b('0xd')]('\x20')[_0x447b('0x1f')](function(_0x211677){_0x1c9356['push']('+'+_0x211677[_0x447b('0x20')]()+'*');});return _0x1c9356['join']('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 78e6215..a534092 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56e7=['method-override','cookie-parser','errorhandler','path','cors','moment','./environment','../mysqldb','get','production','set','appPath','join','public','development','test','root','client','use','json\x20replacer','toISOString','split','static','views','engine','html','view\x20engine','urlencoded','50mb','initialize','express','serve-favicon','body-parser'];(function(_0x1db505,_0xe59764){var _0x4d71ea=function(_0x24bb63){while(--_0x24bb63){_0x1db505['push'](_0x1db505['shift']());}};_0x4d71ea(++_0xe59764);}(_0x56e7,0x147));var _0x756e=function(_0xb4fe2c,_0x3d2be6){_0xb4fe2c=_0xb4fe2c-0x0;var _0x460a1a=_0x56e7[_0xb4fe2c];return _0x460a1a;};'use strict';var express=require(_0x756e('0x0'));var favicon=require(_0x756e('0x1'));var bodyParser=require(_0x756e('0x2'));var methodOverride=require(_0x756e('0x3'));var cookieParser=require(_0x756e('0x4'));var errorHandler=require(_0x756e('0x5'));var path=require(_0x756e('0x6'));var passport=require('passport');var cors=require(_0x756e('0x7'));var moment=require(_0x756e('0x8'));var config=require(_0x756e('0x9'));var db=require(_0x756e('0xa'))['db'];exports['default']=function(_0x16bb81){var _0x5b59b9=_0x16bb81[_0x756e('0xb')]('env');if(_0x5b59b9===_0x756e('0xc')){_0x16bb81[_0x756e('0xd')](_0x756e('0xe'),path[_0x756e('0xf')](config['root'],_0x756e('0x10')));}if(_0x5b59b9===_0x756e('0x11')||_0x5b59b9===_0x756e('0x12')){_0x16bb81[_0x756e('0xd')]('appPath',path[_0x756e('0xf')](config[_0x756e('0x13')],_0x756e('0x14')));_0x16bb81[_0x756e('0x15')](errorHandler());}_0x16bb81['set'](_0x756e('0x16'),function(_0x1a916a,_0x8f8c77){if(this[_0x1a916a]instanceof Date){_0x8f8c77=this[_0x1a916a][_0x756e('0x17')]()[_0x756e('0x18')]('.')[0x0]+'Z';}return _0x8f8c77;});_0x16bb81[_0x756e('0x15')](express[_0x756e('0x19')](_0x16bb81[_0x756e('0xb')]('appPath')));_0x16bb81[_0x756e('0xd')](_0x756e('0x1a'),config[_0x756e('0x13')]+'/server/views');_0x16bb81[_0x756e('0x1b')](_0x756e('0x1c'),require('ejs')['renderFile']);_0x16bb81[_0x756e('0xd')](_0x756e('0x1d'),_0x756e('0x1c'));_0x16bb81[_0x756e('0x15')](bodyParser[_0x756e('0x1e')]({'limit':_0x756e('0x1f'),'extended':!![]}));_0x16bb81['use'](bodyParser['json']({'limit':_0x756e('0x1f')}));_0x16bb81[_0x756e('0x15')](cors());_0x16bb81[_0x756e('0x15')](methodOverride());_0x16bb81[_0x756e('0x15')](cookieParser());_0x16bb81[_0x756e('0x15')](passport[_0x756e('0x20')]());}; \ No newline at end of file +var _0x2df0=['serve-favicon','method-override','cookie-parser','errorhandler','passport','cors','moment','../mysqldb','default','production','set','appPath','join','root','test','client','use','toISOString','split','static','get','views','engine','ejs','renderFile','html','urlencoded','50mb','json'];(function(_0x3e6d80,_0x42d3ff){var _0x3e3fd1=function(_0x14acb8){while(--_0x14acb8){_0x3e6d80['push'](_0x3e6d80['shift']());}};_0x3e3fd1(++_0x42d3ff);}(_0x2df0,0x91));var _0x02df=function(_0x16ace0,_0x5a64c8){_0x16ace0=_0x16ace0-0x0;var _0x2748d8=_0x2df0[_0x16ace0];return _0x2748d8;};'use strict';var express=require('express');var favicon=require(_0x02df('0x0'));var bodyParser=require('body-parser');var methodOverride=require(_0x02df('0x1'));var cookieParser=require(_0x02df('0x2'));var errorHandler=require(_0x02df('0x3'));var path=require('path');var passport=require(_0x02df('0x4'));var cors=require(_0x02df('0x5'));var moment=require(_0x02df('0x6'));var config=require('./environment');var db=require(_0x02df('0x7'))['db'];exports[_0x02df('0x8')]=function(_0x5875bd){var _0x2bce2d=_0x5875bd['get']('env');if(_0x2bce2d===_0x02df('0x9')){_0x5875bd[_0x02df('0xa')](_0x02df('0xb'),path[_0x02df('0xc')](config[_0x02df('0xd')],'public'));}if(_0x2bce2d==='development'||_0x2bce2d===_0x02df('0xe')){_0x5875bd[_0x02df('0xa')](_0x02df('0xb'),path[_0x02df('0xc')](config[_0x02df('0xd')],_0x02df('0xf')));_0x5875bd[_0x02df('0x10')](errorHandler());}_0x5875bd[_0x02df('0xa')]('json\x20replacer',function(_0x2225c,_0x13e280){if(this[_0x2225c]instanceof Date){_0x13e280=this[_0x2225c][_0x02df('0x11')]()[_0x02df('0x12')]('.')[0x0]+'Z';}return _0x13e280;});_0x5875bd['use'](express[_0x02df('0x13')](_0x5875bd[_0x02df('0x14')](_0x02df('0xb'))));_0x5875bd[_0x02df('0xa')](_0x02df('0x15'),config['root']+'/server/views');_0x5875bd[_0x02df('0x16')]('html',require(_0x02df('0x17'))[_0x02df('0x18')]);_0x5875bd['set']('view\x20engine',_0x02df('0x19'));_0x5875bd['use'](bodyParser[_0x02df('0x1a')]({'limit':_0x02df('0x1b'),'extended':!![]}));_0x5875bd['use'](bodyParser[_0x02df('0x1c')]({'limit':_0x02df('0x1b')}));_0x5875bd[_0x02df('0x10')](cors());_0x5875bd[_0x02df('0x10')](methodOverride());_0x5875bd['use'](cookieParser());_0x5875bd[_0x02df('0x10')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 9608755..1b4cab9 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 _0x2a3a=['child_process','execSync','networkInterfaces','orderBy','keys','length','family','IPv4','head','mac','address','127.0.0.1','getFirstInterface','cpus','model','createHash','md5','update','digest','hex','getUuid','platform','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','substring','lodash','crypto','bimedia-machine-uuid'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x2b0bf8,_0x487492){_0x2b0bf8=_0x2b0bf8-0x0;var _0x55b4b4=_0x2a3a[_0x2b0bf8];return _0x55b4b4;};'use strict';var _=require(_0xa2a3('0x0'));var os=require('os');var crypto=require(_0xa2a3('0x1'));var machine=require(_0xa2a3('0x2'));var exec=require(_0xa2a3('0x3'))[_0xa2a3('0x4')];function getInterfaces(){var _0x4caf0f=[];var _0x531167=os[_0xa2a3('0x5')]();var _0x34d7f9=_[_0xa2a3('0x6')](_[_0xa2a3('0x7')](_0x531167));for(var _0xb4826a=0x0;_0xb4826a<_0x34d7f9[_0xa2a3('0x8')];_0xb4826a++){var _0x186655=_0x531167[_0x34d7f9[_0xb4826a]]['filter'](function(_0x3c4004){return _0x3c4004[_0xa2a3('0x9')]===_0xa2a3('0xa')&&_0x3c4004['internal']===![];});_0x4caf0f=_0x4caf0f['concat'](_0x186655);}return _0x4caf0f;}function getFirstInterface(){var _0x5dbe0f=_[_0xa2a3('0xb')](getInterfaces());return{'macAddress':_0x5dbe0f&&_0x5dbe0f[_0xa2a3('0xc')]?_0x5dbe0f[_0xa2a3('0xc')]:'00:00:00:00:00:00','ipAddress':_0x5dbe0f&&_0x5dbe0f[_0xa2a3('0xd')]?_0x5dbe0f[_0xa2a3('0xd')]:_0xa2a3('0xe')};}exports[_0xa2a3('0xf')]=getFirstInterface;function getCPUhash(){var _0x3186cb=_['orderBy'](os[_0xa2a3('0x10')]()['map'](function(_0x80ac46){return _0x80ac46[_0xa2a3('0x11')];}))['join'](':');return crypto[_0xa2a3('0x12')](_0xa2a3('0x13'))[_0xa2a3('0x14')](_0x3186cb)[_0xa2a3('0x15')](_0xa2a3('0x16'));}exports[_0xa2a3('0x17')]=function(){switch(os[_0xa2a3('0x18')]()){case'win32':return exec(_0xa2a3('0x19'),{'encoding':_0xa2a3('0x1a')})['replace']('\x0d\x0a','');default:var _0x3debd2=getFirstInterface();var _0x239716=getCPUhash();var _0x19c3c5=_0x239716+'|'+os[_0xa2a3('0x1b')]()+'|'+_0x3debd2[_0xa2a3('0x1c')]+'|'+_0x3debd2['ipAddress'];var _0x2bc9fb=crypto[_0xa2a3('0x12')](_0xa2a3('0x13'))[_0xa2a3('0x14')](_0x19c3c5)[_0xa2a3('0x15')](_0xa2a3('0x16'));return _0x2bc9fb[_0xa2a3('0x1d')](0x0,0x8)+'-'+_0x2bc9fb[_0xa2a3('0x1d')](0x8,0xc)+'-'+_0x2bc9fb[_0xa2a3('0x1d')](0xc,0x10)+'-'+_0x2bc9fb[_0xa2a3('0x1d')](0x10,0x14)+'-'+_0x2bc9fb['substring'](0x14);}}; \ No newline at end of file +var _0x6d19=['lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','filter','IPv4','internal','concat','head','mac','address','getFirstInterface','cpus','map','model','join','md5','update','digest','hex','getUuid','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','substring'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x6d19,0x160));var _0x96d1=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x6d19[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require(_0x96d1('0x0'));var os=require('os');var crypto=require(_0x96d1('0x1'));var machine=require(_0x96d1('0x2'));var exec=require(_0x96d1('0x3'))[_0x96d1('0x4')];function getInterfaces(){var _0x31518c=[];var _0x36405d=os['networkInterfaces']();var _0x186315=_[_0x96d1('0x5')](_[_0x96d1('0x6')](_0x36405d));for(var _0x4704b3=0x0;_0x4704b3<_0x186315['length'];_0x4704b3++){var _0x32b7d9=_0x36405d[_0x186315[_0x4704b3]][_0x96d1('0x7')](function(_0x61e0f5){return _0x61e0f5['family']===_0x96d1('0x8')&&_0x61e0f5[_0x96d1('0x9')]===![];});_0x31518c=_0x31518c[_0x96d1('0xa')](_0x32b7d9);}return _0x31518c;}function getFirstInterface(){var _0x4e1e7a=_[_0x96d1('0xb')](getInterfaces());return{'macAddress':_0x4e1e7a&&_0x4e1e7a[_0x96d1('0xc')]?_0x4e1e7a['mac']:'00:00:00:00:00:00','ipAddress':_0x4e1e7a&&_0x4e1e7a[_0x96d1('0xd')]?_0x4e1e7a[_0x96d1('0xd')]:'127.0.0.1'};}exports[_0x96d1('0xe')]=getFirstInterface;function getCPUhash(){var _0x51b089=_[_0x96d1('0x5')](os[_0x96d1('0xf')]()[_0x96d1('0x10')](function(_0xb019fb){return _0xb019fb[_0x96d1('0x11')];}))[_0x96d1('0x12')](':');return crypto['createHash'](_0x96d1('0x13'))[_0x96d1('0x14')](_0x51b089)[_0x96d1('0x15')](_0x96d1('0x16'));}exports[_0x96d1('0x17')]=function(){switch(os['platform']()){case'win32':return exec(_0x96d1('0x18'),{'encoding':_0x96d1('0x19')})[_0x96d1('0x1a')]('\x0d\x0a','');default:var _0x9eb2c4=getFirstInterface();var _0x2d521d=getCPUhash();var _0x3e9a0=_0x2d521d+'|'+os[_0x96d1('0x1b')]()+'|'+_0x9eb2c4[_0x96d1('0x1c')]+'|'+_0x9eb2c4[_0x96d1('0x1d')];var _0x5853f0=crypto[_0x96d1('0x1e')](_0x96d1('0x13'))[_0x96d1('0x14')](_0x3e9a0)[_0x96d1('0x15')](_0x96d1('0x16'));return _0x5853f0['substring'](0x0,0x8)+'-'+_0x5853f0[_0x96d1('0x1f')](0x8,0xc)+'-'+_0x5853f0[_0x96d1('0x1f')](0xc,0x10)+'-'+_0x5853f0[_0x96d1('0x1f')](0x10,0x14)+'-'+_0x5853f0[_0x96d1('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7c8d69e..dc7c3f4 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 _0x6931=['update','base64','final','utf8','findOne','admin','email','|reason|','|uuid|','|name|','fullname','|email|','getFirstInterface','openIssue','MOTLICENSE','Motion\x20License\x20Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','createCipher','aes-256-ctr','secrets','session'];(function(_0x39d0ab,_0x513e13){var _0x518c31=function(_0x35e7be){while(--_0x35e7be){_0x39d0ab['push'](_0x39d0ab['shift']());}};_0x518c31(++_0x513e13);}(_0x6931,0x1a9));var _0x1693=function(_0x533a01,_0x14c083){_0x533a01=_0x533a01-0x0;var _0x45c332=_0x6931[_0x533a01];return _0x45c332;};'use strict';var util=require(_0x1693('0x0'));var crypto=require(_0x1693('0x1'));var moment=require(_0x1693('0x2'));var rp=require(_0x1693('0x3'));var BPromise=require(_0x1693('0x4'));var pkginfo=require(_0x1693('0x5'))(module,_0x1693('0x6'));var db=require(_0x1693('0x7'))['db'];var config=require('../environment');var hardware=require(_0x1693('0x8'));var logger=require(_0x1693('0x9'))(_0x1693('0xa'));var jira=require(_0x1693('0xb'));var HOST=_0x1693('0xc');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x5de567){return new BPromise(function(_0x3ab149,_0x2ec499){var _0x18e32e=util['format'](_0x1693('0xd'),HOST,_0x5de567,module[_0x1693('0xe')][_0x1693('0x6')]);if(oldToken){_0x18e32e=util[_0x1693('0xf')](_0x1693('0x10'),HOST,_0x5de567,module[_0x1693('0xe')][_0x1693('0x6')],oldToken);}var _0x3807dd={'uri':_0x18e32e,'method':_0x1693('0x11'),'timeout':0xea60,'json':!![]};return rp(_0x3807dd)[_0x1693('0x12')](function(_0x1ba755){_0x3ab149(_0x1ba755);})['catch'](function(_0x24f22f){_0x2ec499(_0x24f22f);});});}function encryptDate(_0x83c817){var _0x280986=crypto[_0x1693('0x13')](_0x1693('0x14'),config[_0x1693('0x15')][_0x1693('0x16')]);var _0x5cede5=_0x280986[_0x1693('0x17')](_0x83c817,'utf8',_0x1693('0x18'));_0x5cede5+=_0x280986['final'](_0x1693('0x18'));return _0x5cede5;}function decryptDate(_0x380cf5){var _0x4db220=crypto['createDecipher'](_0x1693('0x14'),config['secrets']['session']);var _0x54724d=_0x4db220[_0x1693('0x17')](_0x380cf5,'base64','utf8');_0x54724d+=_0x4db220[_0x1693('0x19')](_0x1693('0x1a'));return _0x54724d;}function sendJiraAlert(_0x7ef2,_0xdd00ed,_0x28edfe){var _0x7a19ae='||FIELD||VALUE||\x0a';return db['User'][_0x1693('0x1b')]({'where':{'role':_0x1693('0x1c')},'attributes':['fullname',_0x1693('0x1d')],'raw':!![]})[_0x1693('0x12')](function(_0x1e541a){ADMIN=_0x1e541a;_0x7a19ae+=_0x1693('0x1e')+_0x28edfe+'|\x0a';_0x7a19ae+=_0x1693('0x1f')+_0x7ef2+'|\x0a';_0x7a19ae+='|machineUuid|'+_0xdd00ed+'|\x0a';_0x7a19ae+=_0x1693('0x20')+ADMIN[_0x1693('0x21')]+'|\x0a';_0x7a19ae+=_0x1693('0x22')+ADMIN[_0x1693('0x1d')]+'|\x0a';return _0x7a19ae;})[_0x1693('0x12')](function(_0x2fa64c){var _0x56655d=hardware[_0x1693('0x23')]()['ipAddress'];return jira[_0x1693('0x24')]({'key':_0x1693('0x25'),'summary':_0x1693('0x26'),'description':_0x2fa64c,'issuetype':'Alert','oldToken':_0x7ef2,'newToken':_0xdd00ed,'email':ADMIN[_0x1693('0x1d')],'name':ADMIN[_0x1693('0x21')],'reason':GRAY_PERIOD_REASON,'ip':_0x56655d});});}function manageLicense(_0x43cfb6,_0x4142e7){var _0x4612e0=_0x4142e7[_0x1693('0x27')]({'plain':!![]});httpRequest(_0x43cfb6)[_0x1693('0x12')](function(_0x47cfb4){if(oldToken){oldToken=undefined;}if(_0x47cfb4[_0x1693('0x28')]){if(!_0x4612e0['license']&&_0x4612e0[_0x1693('0xa')]!=_0x47cfb4['license']||_0x4612e0[_0x1693('0xa')]&&_0x4612e0[_0x1693('0x29')]){logger[_0x1693('0x2a')](_0x1693('0x2b'));}if(_0x4612e0['license']&&!_0x4612e0[_0x1693('0x29')]&&_0x4612e0[_0x1693('0xa')]!=_0x47cfb4['license']){logger['info'](_0x1693('0x2c'));}if(_0x4612e0['license']&&!_0x4612e0['data2']&&_0x4612e0['license']==_0x47cfb4[_0x1693('0xa')]){return _0x4142e7;}return _0x4142e7[_0x1693('0x17')]({'data1':_0x43cfb6,'data2':null,'license':_0x47cfb4['license']});}else{if(_0x47cfb4[_0x1693('0xa')]||_0x4612e0['license']){if(!_0x4612e0[_0x1693('0x29')]){if(_0x4612e0['data1']==_0x43cfb6){GRAY_PERIOD_REASON=_0x1693('0x2d');logger[_0x1693('0x2a')](_0x1693('0x2e'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x4612e0[_0x1693('0x2f')];logger[_0x1693('0x2a')](_0x1693('0x30'),_0x4612e0[_0x1693('0x2f')],_0x43cfb6);}sendJiraAlert(_0x4612e0[_0x1693('0x2f')],_0x47cfb4[_0x1693('0x31')],GRAY_PERIOD_REASON);logger[_0x1693('0x2a')](_0x1693('0x32'),GRAY_PERIOD_REASON[_0x1693('0x33')](),moment()[_0x1693('0xf')](_0x1693('0x34')));return _0x4142e7[_0x1693('0x17')]({'data2':encryptDate(moment()['format'](_0x1693('0x34')))});}else{if(moment()['diff'](decryptDate(_0x4612e0[_0x1693('0x29')]),_0x1693('0x35'))>DAYS){logger[_0x1693('0x2a')](_0x1693('0x36'),moment()[_0x1693('0xf')](_0x1693('0x34')));return _0x4142e7[_0x1693('0x17')]({'data1':_0x43cfb6,'data2':null,'license':null});}}}else{if(_0x4612e0[_0x1693('0x2f')]!=_0x43cfb6){logger[_0x1693('0x2a')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4612e0[_0x1693('0x2f')],_0x43cfb6);return _0x4142e7[_0x1693('0x17')]({'data1':_0x43cfb6,'data2':null,'license':null});}}}return _0x4142e7;})[_0x1693('0x12')](function(_0x3c7fe5){_0x4142e7=_0x3c7fe5;})[_0x1693('0x37')](function(_0x3b37a1){logger[_0x1693('0x38')](_0x3b37a1[_0x1693('0x39')]);})[_0x1693('0x3a')](function(){setTimeout(function(){manageLicense(hardware[_0x1693('0x3b')](),_0x4142e7);},TIME);});}function defaultLicense(){var _0x58bf2a=hardware['getUuid']();if(_0x58bf2a){return db['License'][_0x1693('0x3c')]({'where':{'id':0x1},'defaults':{'data1':_0x58bf2a}})[_0x1693('0x3d')](function(_0x36ce16,_0x2eb8da){logger[_0x1693('0x2a')](_0x1693('0x3e'),_0x58bf2a);manageLicense(_0x58bf2a,_0x36ce16);})[_0x1693('0x37')](function(_0xda9fd3){logger[_0x1693('0x38')](_0xda9fd3[_0x1693('0x39')]);});}}exports[_0x1693('0x3f')]=defaultLicense; \ No newline at end of file +var _0xb98e=['days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','bluebird','pkginfo','version','../environment','./hardware','../logger','../../api/jira/jira.controller','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','session','base64','final','createDecipher','secrets','update','utf8','||FIELD||VALUE||\x0a','findOne','admin','|machineUuid|','fullname','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','email','get','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff'];(function(_0x4c0f0a,_0x1899ff){var _0x429d23=function(_0x58cf44){while(--_0x58cf44){_0x4c0f0a['push'](_0x4c0f0a['shift']());}};_0x429d23(++_0x1899ff);}(_0xb98e,0x184));var _0xeb98=function(_0x1ca7ee,_0x73137b){_0x1ca7ee=_0x1ca7ee-0x0;var _0x72152c=_0xb98e[_0x1ca7ee];return _0x72152c;};'use strict';var util=require(_0xeb98('0x0'));var crypto=require(_0xeb98('0x1'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0xeb98('0x2'));var pkginfo=require(_0xeb98('0x3'))(module,_0xeb98('0x4'));var db=require('../../mysqldb')['db'];var config=require(_0xeb98('0x5'));var hardware=require(_0xeb98('0x6'));var logger=require(_0xeb98('0x7'))('license');var jira=require(_0xeb98('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x4a7e79){return new BPromise(function(_0x47c83f,_0x41309a){var _0x16a195=util[_0xeb98('0x9')](_0xeb98('0xa'),HOST,_0x4a7e79,module[_0xeb98('0xb')][_0xeb98('0x4')]);if(oldToken){_0x16a195=util[_0xeb98('0x9')](_0xeb98('0xc'),HOST,_0x4a7e79,module['exports'][_0xeb98('0x4')],oldToken);}var _0x8b537e={'uri':_0x16a195,'method':_0xeb98('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x8b537e)[_0xeb98('0xe')](function(_0x1c8990){_0x47c83f(_0x1c8990);})[_0xeb98('0xf')](function(_0x15372d){_0x41309a(_0x15372d);});});}function encryptDate(_0x30cf5b){var _0x2b3f9f=crypto[_0xeb98('0x10')](_0xeb98('0x11'),config['secrets'][_0xeb98('0x12')]);var _0x3ee150=_0x2b3f9f['update'](_0x30cf5b,'utf8',_0xeb98('0x13'));_0x3ee150+=_0x2b3f9f[_0xeb98('0x14')](_0xeb98('0x13'));return _0x3ee150;}function decryptDate(_0x31ff03){var _0xac14bc=crypto[_0xeb98('0x15')](_0xeb98('0x11'),config[_0xeb98('0x16')][_0xeb98('0x12')]);var _0x2fd9c8=_0xac14bc[_0xeb98('0x17')](_0x31ff03,_0xeb98('0x13'),_0xeb98('0x18'));_0x2fd9c8+=_0xac14bc[_0xeb98('0x14')](_0xeb98('0x18'));return _0x2fd9c8;}function sendJiraAlert(_0x1caff9,_0x38b7be,_0x25a13d){var _0xbe8e08=_0xeb98('0x19');return db['User'][_0xeb98('0x1a')]({'where':{'role':_0xeb98('0x1b')},'attributes':['fullname','email'],'raw':!![]})[_0xeb98('0xe')](function(_0x10790d){ADMIN=_0x10790d;_0xbe8e08+='|reason|'+_0x25a13d+'|\x0a';_0xbe8e08+='|uuid|'+_0x1caff9+'|\x0a';_0xbe8e08+=_0xeb98('0x1c')+_0x38b7be+'|\x0a';_0xbe8e08+='|name|'+ADMIN[_0xeb98('0x1d')]+'|\x0a';_0xbe8e08+=_0xeb98('0x1e')+ADMIN['email']+'|\x0a';return _0xbe8e08;})[_0xeb98('0xe')](function(_0xb561eb){var _0x3a3566=hardware[_0xeb98('0x1f')]()[_0xeb98('0x20')];return jira[_0xeb98('0x21')]({'key':_0xeb98('0x22'),'summary':_0xeb98('0x23'),'description':_0xb561eb,'issuetype':_0xeb98('0x24'),'oldToken':_0x1caff9,'newToken':_0x38b7be,'email':ADMIN[_0xeb98('0x25')],'name':ADMIN[_0xeb98('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x3a3566});});}function manageLicense(_0x499ae8,_0x19f31d){var _0x29fecd=_0x19f31d[_0xeb98('0x26')]({'plain':!![]});httpRequest(_0x499ae8)[_0xeb98('0xe')](function(_0x296f65){if(oldToken){oldToken=undefined;}if(_0x296f65[_0xeb98('0x27')]){if(!_0x29fecd[_0xeb98('0x28')]&&_0x29fecd[_0xeb98('0x28')]!=_0x296f65[_0xeb98('0x28')]||_0x29fecd[_0xeb98('0x28')]&&_0x29fecd[_0xeb98('0x29')]){logger[_0xeb98('0x2a')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x29fecd[_0xeb98('0x28')]&&!_0x29fecd[_0xeb98('0x29')]&&_0x29fecd[_0xeb98('0x28')]!=_0x296f65[_0xeb98('0x28')]){logger['info'](_0xeb98('0x2b'));}if(_0x29fecd[_0xeb98('0x28')]&&!_0x29fecd[_0xeb98('0x29')]&&_0x29fecd[_0xeb98('0x28')]==_0x296f65[_0xeb98('0x28')]){return _0x19f31d;}return _0x19f31d[_0xeb98('0x17')]({'data1':_0x499ae8,'data2':null,'license':_0x296f65['license']});}else{if(_0x296f65['license']||_0x29fecd[_0xeb98('0x28')]){if(!_0x29fecd[_0xeb98('0x29')]){if(_0x29fecd[_0xeb98('0x2c')]==_0x499ae8){GRAY_PERIOD_REASON=_0xeb98('0x2d');logger[_0xeb98('0x2a')](_0xeb98('0x2e'));}else{GRAY_PERIOD_REASON=_0xeb98('0x2f');oldToken=_0x29fecd[_0xeb98('0x2c')];logger[_0xeb98('0x2a')](_0xeb98('0x30'),_0x29fecd[_0xeb98('0x2c')],_0x499ae8);}sendJiraAlert(_0x29fecd[_0xeb98('0x2c')],_0x296f65[_0xeb98('0x31')],GRAY_PERIOD_REASON);logger[_0xeb98('0x2a')](_0xeb98('0x32'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xeb98('0x9')](_0xeb98('0x33')));return _0x19f31d[_0xeb98('0x17')]({'data2':encryptDate(moment()['format'](_0xeb98('0x33')))});}else{if(moment()[_0xeb98('0x34')](decryptDate(_0x29fecd['data2']),_0xeb98('0x35'))>DAYS){logger[_0xeb98('0x2a')](_0xeb98('0x36'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x19f31d[_0xeb98('0x17')]({'data1':_0x499ae8,'data2':null,'license':null});}}}else{if(_0x29fecd[_0xeb98('0x2c')]!=_0x499ae8){logger[_0xeb98('0x2a')](_0xeb98('0x30'),_0x29fecd['data1'],_0x499ae8);return _0x19f31d[_0xeb98('0x17')]({'data1':_0x499ae8,'data2':null,'license':null});}}}return _0x19f31d;})[_0xeb98('0xe')](function(_0x5b6693){_0x19f31d=_0x5b6693;})[_0xeb98('0xf')](function(_0x59e14c){logger[_0xeb98('0x37')](_0x59e14c[_0xeb98('0x38')]);})[_0xeb98('0x39')](function(){setTimeout(function(){manageLicense(hardware[_0xeb98('0x3a')](),_0x19f31d);},TIME);});}function defaultLicense(){var _0x256737=hardware['getUuid']();if(_0x256737){return db['License'][_0xeb98('0x3b')]({'where':{'id':0x1},'defaults':{'data1':_0x256737}})[_0xeb98('0x3c')](function(_0x1ae437,_0xa4d8aa){logger[_0xeb98('0x2a')](_0xeb98('0x3d'),_0x256737);manageLicense(_0x256737,_0x1ae437);})[_0xeb98('0xf')](function(_0x23610c){logger[_0xeb98('0x37')](_0x23610c[_0xeb98('0x38')]);});}}exports[_0xeb98('0x3e')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index cf76b31..afc51cf 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 _0x87e7=['getUuid','secrets','session','final','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','Breaking\x20license','message','Demo\x20license','getLicense','find','defaults','then','checkLicense','crypto','lodash','moment','../environment','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','format','%s:%s:%s','update','base64','utf8','parse','demo'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x87e7,0x11e));var _0x787e=function(_0x5a18fc,_0xb1a4aa){_0x5a18fc=_0x5a18fc-0x0;var _0x57b441=_0x87e7[_0x5a18fc];return _0x57b441;};'use strict';var crypto=require(_0x787e('0x0'));var util=require('util');var _=require(_0x787e('0x1'));var moment=require(_0x787e('0x2'));var hardware=require('./hardware');var config=require(_0x787e('0x3'));var db=require('../../mysqldb')['db'];function checkLicense(_0x29ee76,_0x3c571d){if(_0x29ee76){try{var _0x26e9ec=_0x3c571d||_0x29ee76[_0x787e('0x4')];if(_[_0x787e('0x5')](_0x26e9ec)){throw new Error(_0x787e('0x6'));}var _0x14b6bf=_0x29ee76[_0x787e('0x7')];var _0x1cc95e=_0x29ee76[_0x787e('0x8')];var _0x5dd8e6=_0x14b6bf[_0x787e('0x9')]('-')[0x4];var _0x4d274d=_0x14b6bf[_0x787e('0x9')]('-')[0x0];var _0x3fccba=crypto[_0x787e('0xa')]('aes-256-ctr',util[_0x787e('0xb')](_0x787e('0xc'),_0x5dd8e6,_0x14b6bf,_0x4d274d));var _0x48ea4a=_0x3fccba[_0x787e('0xd')](_0x26e9ec,_0x787e('0xe'),'utf8');_0x48ea4a+=_0x3fccba['final'](_0x787e('0xf'));var _0x10a88c=JSON[_0x787e('0x10')](_0x48ea4a);_0x10a88c[_0x787e('0x11')]=![];_0x10a88c['uuid']=_0x14b6bf;_0x10a88c['machineUuid']=hardware[_0x787e('0x12')]();if(_0x1cc95e){var _0x341fd3=crypto['createDecipher']('aes-256-ctr',config[_0x787e('0x13')][_0x787e('0x14')]);var _0x15ec44=_0x341fd3['update'](_0x1cc95e,'base64',_0x787e('0xf'));_0x15ec44+=_0x341fd3[_0x787e('0x15')](_0x787e('0xf'));_0x10a88c[_0x787e('0x16')]=_0x15ec44;_0x10a88c[_0x787e('0x17')]=moment(_0x15ec44)[_0x787e('0x18')](0x7,_0x787e('0x19'))[_0x787e('0xb')]();_0x10a88c[_0x787e('0x1a')]=_0x10a88c['uuid']!=_0x10a88c[_0x787e('0x1b')]?_0x787e('0x1c'):_0x787e('0x1d');}return _0x10a88c;}catch(_0x40109c){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x787e('0x1e'),'uuid':_0x29ee76['data1'],'machineUuid':hardware[_0x787e('0x12')](),'message':_0x40109c[_0x787e('0x1f')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x787e('0x20'),'uuid':_0x29ee76[_0x787e('0x7')],'machineUuid':hardware[_0x787e('0x12')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x787e('0x21')]=function(_0x6a672f){return db['License'][_0x787e('0x22')](_[_0x787e('0x23')](_0x6a672f,{'raw':!![],'where':{'id':0x1}}))[_0x787e('0x24')](function(_0x5b39ce){return checkLicense(_0x5b39ce,null);});};exports[_0x787e('0x25')]=checkLicense; \ No newline at end of file +var _0xfa12=['Demo\x20license','defaults','checkLicense','crypto','util','lodash','../environment','../../mysqldb','license','isEmpty','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','uuid','machineUuid','getUuid','session','final','gray','deadline','add','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message'];(function(_0x2f5b22,_0x37a632){var _0x1db4f1=function(_0x27fd45){while(--_0x27fd45){_0x2f5b22['push'](_0x2f5b22['shift']());}};_0x1db4f1(++_0x37a632);}(_0xfa12,0x1bd));var _0x2fa1=function(_0x171b1b,_0x57c370){_0x171b1b=_0x171b1b-0x0;var _0x5429ec=_0xfa12[_0x171b1b];return _0x5429ec;};'use strict';var crypto=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var _=require(_0x2fa1('0x2'));var moment=require('moment');var hardware=require('./hardware');var config=require(_0x2fa1('0x3'));var db=require(_0x2fa1('0x4'))['db'];function checkLicense(_0x4b6cd7,_0x4ec644){if(_0x4b6cd7){try{var _0x41eaf6=_0x4ec644||_0x4b6cd7[_0x2fa1('0x5')];if(_[_0x2fa1('0x6')](_0x41eaf6)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x19a57a=_0x4b6cd7['data1'];var _0xfa25d9=_0x4b6cd7[_0x2fa1('0x7')];var _0x3ee801=_0x19a57a[_0x2fa1('0x8')]('-')[0x4];var _0x1c2df0=_0x19a57a[_0x2fa1('0x8')]('-')[0x0];var _0x4e3028=crypto[_0x2fa1('0x9')](_0x2fa1('0xa'),util[_0x2fa1('0xb')](_0x2fa1('0xc'),_0x3ee801,_0x19a57a,_0x1c2df0));var _0xa714a=_0x4e3028[_0x2fa1('0xd')](_0x41eaf6,_0x2fa1('0xe'),_0x2fa1('0xf'));_0xa714a+=_0x4e3028['final'](_0x2fa1('0xf'));var _0x4ad9b1=JSON[_0x2fa1('0x10')](_0xa714a);_0x4ad9b1['demo']=![];_0x4ad9b1[_0x2fa1('0x11')]=_0x19a57a;_0x4ad9b1[_0x2fa1('0x12')]=hardware[_0x2fa1('0x13')]();if(_0xfa25d9){var _0x17ae9f=crypto[_0x2fa1('0x9')](_0x2fa1('0xa'),config['secrets'][_0x2fa1('0x14')]);var _0x583134=_0x17ae9f[_0x2fa1('0xd')](_0xfa25d9,_0x2fa1('0xe'),'utf8');_0x583134+=_0x17ae9f[_0x2fa1('0x15')](_0x2fa1('0xf'));_0x4ad9b1[_0x2fa1('0x16')]=_0x583134;_0x4ad9b1[_0x2fa1('0x17')]=moment(_0x583134)[_0x2fa1('0x18')](0x7,'days')['format']();_0x4ad9b1[_0x2fa1('0x19')]=_0x4ad9b1['uuid']!=_0x4ad9b1[_0x2fa1('0x12')]?_0x2fa1('0x1a'):_0x2fa1('0x1b');}return _0x4ad9b1;}catch(_0x5bfcd9){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2fa1('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x2fa1('0x1d'),'uuid':_0x4b6cd7['data1'],'machineUuid':hardware[_0x2fa1('0x13')](),'message':_0x5bfcd9[_0x2fa1('0x1e')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2fa1('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x2fa1('0x1f'),'uuid':_0x4b6cd7['data1'],'machineUuid':hardware[_0x2fa1('0x13')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x2ffe87){return db['License']['find'](_[_0x2fa1('0x20')](_0x2ffe87,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x1c4f31){return checkLicense(_0x1c4f31,null);});};exports[_0x2fa1('0x21')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index a8410f3..30e35f3 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 _0x793a=['secret'];(function(_0xa3e0f7,_0x1b06db){var _0x4ce604=function(_0x29df1e){while(--_0x29df1e){_0xa3e0f7['push'](_0xa3e0f7['shift']());}};_0x4ce604(++_0x1b06db);}(_0x793a,0x86));var _0xa793=function(_0x4c187c,_0x5c008f){_0x4c187c=_0x4c187c-0x0;var _0x5055b1=_0x793a[_0x4c187c];return _0x5055b1;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xa793('0x0'),'DEBUG':''}; \ No newline at end of file +var _0x6e90=['secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6e90,0xf5));var _0x06e9=function(_0xeab9a7,_0x167d13){_0xeab9a7=_0xeab9a7-0x0;var _0xfb6691=_0x6e90[_0xeab9a7];return _0xfb6691;};'use strict';module[_0x06e9('0x0')]={'DOMAIN':_0x06e9('0x1'),'SESSION_SECRET':_0x06e9('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x06e9('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index d91e43e..bd631fb 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc104=['exports','Logger','transports','error','%s-%s','info','env','moment','util','path','INFO','/var','log','xcally','format','%s-%s.log','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x1ff414,_0x12c95d){var _0x52c0fa=function(_0x57f936){while(--_0x57f936){_0x1ff414['push'](_0x1ff414['shift']());}};_0x52c0fa(++_0x12c95d);}(_0xc104,0xd8));var _0x4c10=function(_0x1b2e6b,_0x2f97fb){_0x1b2e6b=_0x1b2e6b-0x0;var _0x1dd2aa=_0xc104[_0x1b2e6b];return _0x1dd2aa;};'use strict';var moment=require(_0x4c10('0x0'));var winston=require('winston');var util=require(_0x4c10('0x1'));var path=require(_0x4c10('0x2'));var debugLevel=_0x4c10('0x3');function filename(_0x53bc39,_0x5da797){return path['join'](_0x4c10('0x4'),_0x4c10('0x5'),_0x4c10('0x6'),util[_0x4c10('0x7')](_0x4c10('0x8'),_0x53bc39,_0x5da797));}function formatter(_0xe737e0,_0x2073c8){return util[_0x4c10('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0x4c10('0x9')),_0x2073c8[_0x4c10('0xa')][_0x4c10('0xb')](),_0xe737e0,_0x2073c8['message']);}module[_0x4c10('0xc')]=function(_0x3f56a7){return new winston[(_0x4c10('0xd'))]({'transports':[new winston[(_0x4c10('0xe'))]['File']({'name':util[_0x4c10('0x7')]('%s-%s',_0x3f56a7,'error'),'filename':filename(_0x3f56a7,'error'),'level':_0x4c10('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x7a0e){return formatter(_0x3f56a7,_0x7a0e);}}),new winston[(_0x4c10('0xe'))]['File']({'name':util[_0x4c10('0x7')](_0x4c10('0x10'),_0x3f56a7,_0x4c10('0x11')),'filename':filename(_0x3f56a7,_0x4c10('0x11')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x181c15){return formatter(_0x3f56a7,_0x181c15);}}),new winston[(_0x4c10('0xe'))]['Console']({'level':process[_0x4c10('0x12')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x45a6bc){return formatter(_0x3f56a7,_0x45a6bc);}})]});}; \ No newline at end of file +var _0xf216=['%s-%s','error','transports','info','env','debugLevel','moment','winston','util','path','INFO','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','message','exports','File'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf216,0x9e));var _0x6f21=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xf216[_0x411017];return _0x2adeea;};'use strict';var moment=require(_0x6f21('0x0'));var winston=require(_0x6f21('0x1'));var util=require(_0x6f21('0x2'));var path=require(_0x6f21('0x3'));var debugLevel=_0x6f21('0x4');function filename(_0x250d3e,_0x1e1435){return path['join']('/var',_0x6f21('0x5'),_0x6f21('0x6'),util[_0x6f21('0x7')]('%s-%s.log',_0x250d3e,_0x1e1435));}function formatter(_0x18e85e,_0x23b6a6){return util['format'](_0x6f21('0x8'),moment()[_0x6f21('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x23b6a6[_0x6f21('0x9')]['toUpperCase'](),_0x18e85e,_0x23b6a6[_0x6f21('0xa')]);}module[_0x6f21('0xb')]=function(_0x5f1acc){return new winston['Logger']({'transports':[new winston['transports'][(_0x6f21('0xc'))]({'name':util[_0x6f21('0x7')](_0x6f21('0xd'),_0x5f1acc,_0x6f21('0xe')),'filename':filename(_0x5f1acc,'error'),'level':_0x6f21('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x79372c){return formatter(_0x5f1acc,_0x79372c);}}),new winston[(_0x6f21('0xf'))][(_0x6f21('0xc'))]({'name':util['format'](_0x6f21('0xd'),_0x5f1acc,'info'),'filename':filename(_0x5f1acc,_0x6f21('0x10')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x55d0c2){return formatter(_0x5f1acc,_0x55d0c2);}}),new winston[(_0x6f21('0xf'))]['Console']({'level':process[_0x6f21('0x11')][_0x6f21('0x12')]||debugLevel,'json':![],'formatter':function(_0x837862){return formatter(_0x5f1acc,_0x837862);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 75be27b..d5e39ff 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 _0x4fe5=['ami','join','../../services/ami/index.js','agi','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','../../services/express/index.js'];(function(_0x438069,_0x2cccd2){var _0x47f508=function(_0x3dc455){while(--_0x3dc455){_0x438069['push'](_0x438069['shift']());}};_0x47f508(++_0x2cccd2);}(_0x4fe5,0x65));var _0x54fe=function(_0x4429eb,_0x59f631){_0x4429eb=_0x4429eb-0x0;var _0xa45855=_0x4fe5[_0x4429eb];return _0xa45855;};'use strict';var path=require(_0x54fe('0x0'));var os=require('os');var config={'apps':[{'name':_0x54fe('0x1'),'script':path['join'](__dirname,_0x54fe('0x2'))},{'name':_0x54fe('0x3'),'script':path[_0x54fe('0x4')](__dirname,_0x54fe('0x5'))},{'name':_0x54fe('0x6'),'script':path[_0x54fe('0x4')](__dirname,'../../services/agi/index.js')},{'name':_0x54fe('0x7'),'script':path[_0x54fe('0x4')](__dirname,'../../services/email/index.js')},{'name':_0x54fe('0x8'),'script':path[_0x54fe('0x4')](__dirname,_0x54fe('0x9'))},{'name':_0x54fe('0xa'),'script':path[_0x54fe('0x4')](__dirname,_0x54fe('0xb'))}]};module[_0x54fe('0xc')]=config; \ No newline at end of file +var _0xd851=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','ami','join','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x353b63,_0x456db0){var _0x361bc6=function(_0x174bfa){while(--_0x174bfa){_0x353b63['push'](_0x353b63['shift']());}};_0x361bc6(++_0x456db0);}(_0xd851,0x148));var _0x1d85=function(_0x69a451,_0x49fd37){_0x69a451=_0x69a451-0x0;var _0x3d6ef5=_0xd851[_0x69a451];return _0x3d6ef5;};'use strict';var path=require(_0x1d85('0x0'));var os=require('os');var config={'apps':[{'name':_0x1d85('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x1d85('0x2'),'script':path[_0x1d85('0x3')](__dirname,'../../services/ami/index.js')},{'name':_0x1d85('0x4'),'script':path['join'](__dirname,_0x1d85('0x5'))},{'name':_0x1d85('0x6'),'script':path[_0x1d85('0x3')](__dirname,_0x1d85('0x7'))},{'name':'routing','script':path[_0x1d85('0x3')](__dirname,_0x1d85('0x8'))},{'name':_0x1d85('0x9'),'script':path[_0x1d85('0x3')](__dirname,_0x1d85('0xa'))}]};module[_0x1d85('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 8545f2c..90c4fa0 100644 --- a/server/config/pm2/index.js +++ b/server/config/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4074=['pm2','bluebird','./config','connect','connected','start','then','stop','disconnect','restart','list','describe','delete','dump','saved'];(function(_0x827a1,_0x71ad9f){var _0x4fada5=function(_0x28166a){while(--_0x28166a){_0x827a1['push'](_0x827a1['shift']());}};_0x4fada5(++_0x71ad9f);}(_0x4074,0xf0));var _0x4407=function(_0x50db44,_0x473ba1){_0x50db44=_0x50db44-0x0;var _0x1b52d1=_0x4074[_0x50db44];return _0x1b52d1;};'use strict';var pm2=require(_0x4407('0x0'));var BPromise=require(_0x4407('0x1'));var config=require(_0x4407('0x2'));function connect(){return new BPromise(function(_0x52977e,_0x1021e6){return pm2[_0x4407('0x3')](function(_0x14c0bc){if(_0x14c0bc){return _0x1021e6(_0x14c0bc);}return _0x52977e(_0x4407('0x4'));});});};exports[_0x4407('0x5')]=function(_0x3c9f5c){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x2495d2,_0x3f085d){return pm2[_0x4407('0x5')](_0x3c9f5c,function(_0x4933cf,_0x988538){if(_0x4933cf){return _0x3f085d(_0x4933cf);}pm2['disconnect']();return _0x2495d2(_0x988538);});});});};exports[_0x4407('0x7')]=function(_0x3c1aee){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x54b465,_0x5e70a5){return pm2['stop'](_0x3c1aee,function(_0x801db8,_0x74e6f8){if(_0x801db8){return _0x5e70a5(_0x801db8);}pm2[_0x4407('0x8')]();return _0x54b465(_0x74e6f8);});});});};exports[_0x4407('0x9')]=function(_0x36cde5){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x167f9f,_0x2c5b86){return pm2[_0x4407('0x9')](_0x36cde5,function(_0x332243,_0x14f398){if(_0x332243){return _0x2c5b86(_0x332243);}pm2['disconnect']();return _0x167f9f(_0x14f398);});});});};exports[_0x4407('0xa')]=function(){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x52cd11,_0x3ee793){return pm2['list'](function(_0x1d2ec8,_0x27724a){if(_0x1d2ec8){return _0x3ee793(_0x1d2ec8);}pm2[_0x4407('0x8')]();return _0x52cd11(_0x27724a);});});});};exports[_0x4407('0xb')]=function(_0x1840dd){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x1c5a0c,_0x2e709f){return pm2['describe'](_0x1840dd,function(_0x474e6a,_0x65b20b){if(_0x474e6a){return _0x2e709f(_0x474e6a);}pm2[_0x4407('0x8')]();return _0x1c5a0c(_0x65b20b);});});});};exports[_0x4407('0xc')]=function(_0x12952e){return connect()['then'](function(){return new BPromise(function(_0x2d6fb9,_0x54caa1){return pm2[_0x4407('0xc')](_0x12952e,function(_0x257d33,_0x1db373){if(_0x257d33){return _0x54caa1(_0x257d33);}pm2[_0x4407('0x8')]();return _0x2d6fb9(_0x1db373);});});});};exports[_0x4407('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x451897,_0x55ee6d){return pm2[_0x4407('0xd')](function(_0x28bb2c){if(_0x28bb2c){return _0x55ee6d(_0x28bb2c);}return _0x451897(_0x4407('0xe'));});});});}; \ No newline at end of file +var _0xd90b=['start','then','disconnect','stop','restart','describe','delete','dump','saved','pm2'];(function(_0x32093d,_0x894489){var _0x3a9574=function(_0x21aac4){while(--_0x21aac4){_0x32093d['push'](_0x32093d['shift']());}};_0x3a9574(++_0x894489);}(_0xd90b,0xbd));var _0xbd90=function(_0x1dacbe,_0x2533f5){_0x1dacbe=_0x1dacbe-0x0;var _0x5c2ffe=_0xd90b[_0x1dacbe];return _0x5c2ffe;};'use strict';var pm2=require(_0xbd90('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x2f8d43,_0x5a9a50){return pm2['connect'](function(_0x40bb8c){if(_0x40bb8c){return _0x5a9a50(_0x40bb8c);}return _0x2f8d43('connected');});});};exports[_0xbd90('0x1')]=function(_0x1813c7){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x948d45,_0x448c24){return pm2[_0xbd90('0x1')](_0x1813c7,function(_0x524ad0,_0x3c1098){if(_0x524ad0){return _0x448c24(_0x524ad0);}pm2[_0xbd90('0x3')]();return _0x948d45(_0x3c1098);});});});};exports[_0xbd90('0x4')]=function(_0x21b464){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x3da600,_0x45f5af){return pm2[_0xbd90('0x4')](_0x21b464,function(_0x35b7cb,_0x3eec4a){if(_0x35b7cb){return _0x45f5af(_0x35b7cb);}pm2[_0xbd90('0x3')]();return _0x3da600(_0x3eec4a);});});});};exports['restart']=function(_0x32cfca){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x546fef,_0x57eb75){return pm2[_0xbd90('0x5')](_0x32cfca,function(_0x17adb4,_0x289891){if(_0x17adb4){return _0x57eb75(_0x17adb4);}pm2[_0xbd90('0x3')]();return _0x546fef(_0x289891);});});});};exports['list']=function(){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x5c7d96,_0x5ef084){return pm2['list'](function(_0xcb2f72,_0xdbdbf9){if(_0xcb2f72){return _0x5ef084(_0xcb2f72);}pm2[_0xbd90('0x3')]();return _0x5c7d96(_0xdbdbf9);});});});};exports[_0xbd90('0x6')]=function(_0x75d333){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x5eea50,_0x15f3ac){return pm2[_0xbd90('0x6')](_0x75d333,function(_0x4c6b76,_0x172871){if(_0x4c6b76){return _0x15f3ac(_0x4c6b76);}pm2[_0xbd90('0x3')]();return _0x5eea50(_0x172871);});});});};exports[_0xbd90('0x7')]=function(_0x516f4b){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x8fd858,_0xb23a81){return pm2[_0xbd90('0x7')](_0x516f4b,function(_0x5baabe,_0x57811c){if(_0x5baabe){return _0xb23a81(_0x5baabe);}pm2[_0xbd90('0x3')]();return _0x8fd858(_0x57811c);});});});};exports['dump']=function(){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x35a139,_0x1793c5){return pm2[_0xbd90('0x8')](function(_0x433101){if(_0x433101){return _0x1793c5(_0x433101);}return _0x35a139(_0xbd90('0x9'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index b603cdf..394ddda 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 _0x280c=['findAll','lastMsgAt','subtract','then','update','system','timeout','format','length','emit','catch','error','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis','socket.io-emitter','chatTimeout','ChatInteraction'];(function(_0x5b791d,_0x49cc81){var _0xdd1c36=function(_0x46f98b){while(--_0x46f98b){_0x5b791d['push'](_0x5b791d['shift']());}};_0xdd1c36(++_0x49cc81);}(_0x280c,0x1f1));var _0xc280=function(_0x248831,_0x5969a3){_0x248831=_0x248831-0x0;var _0x51bb37=_0x280c[_0x248831];return _0x51bb37;};'use strict';var _=require(_0xc280('0x0'));var moment=require(_0xc280('0x1'));var Redis=require(_0xc280('0x2'));var db=require(_0xc280('0x3'))['db'];var config=require(_0xc280('0x4'));config[_0xc280('0x5')]=_['defaults'](config[_0xc280('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xc280('0x6'))(new Redis(config[_0xc280('0x5')]));function closeInteractions(){var _0x209724=0x0;var _0x36908c=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x6bf051){_0x209724=_0x6bf051[_0xc280('0x7')];if(_0x209724){return db[_0xc280('0x8')][_0xc280('0x9')]({'raw':!![],'attributes':['id',_0xc280('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc280('0xb')](_0x6bf051[_0xc280('0x7')],'minutes')}}});}else{return[];}})[_0xc280('0xc')](function(_0x588341){_0x36908c=_0x588341;if(_0x209724){return db['ChatInteraction'][_0xc280('0xd')]({'closeReason':_0xc280('0xe'),'disposition':_0xc280('0xf'),'closed':!![],'closedAt':moment()[_0xc280('0x10')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_['map'](_0x36908c||[],'id')}});}})['then'](function(_0x5920f6){for(var _0x32557f=0x0;_0x32557f<_0x36908c[_0xc280('0x11')];_0x32557f++){io[_0xc280('0x12')]('chatInteraction:update',{'id':_0x36908c[_0x32557f]['id'],'closed':!![]});}})[_0xc280('0x13')](function(_0x33f979){console[_0xc280('0x14')](_0x33f979);});}exports[_0xc280('0x15')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xcfad=['error','start','lodash','ioredis','../../mysqldb','../../config/environment','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','system','timeout','YYYY-MM-DD\x20HH:mm:ss','map','length','chatInteraction:update','catch'];(function(_0x118e31,_0x2c3d3f){var _0x13c8c0=function(_0x1d2943){while(--_0x1d2943){_0x118e31['push'](_0x118e31['shift']());}};_0x13c8c0(++_0x2c3d3f);}(_0xcfad,0x12e));var _0xdcfa=function(_0xe5ba6e,_0x57e369){_0xe5ba6e=_0xe5ba6e-0x0;var _0x8046b6=_0xcfad[_0xe5ba6e];return _0x8046b6;};'use strict';var _=require(_0xdcfa('0x0'));var moment=require('moment');var Redis=require(_0xdcfa('0x1'));var db=require(_0xdcfa('0x2'))['db'];var config=require(_0xdcfa('0x3'));config[_0xdcfa('0x4')]=_['defaults'](config[_0xdcfa('0x4')],{'host':_0xdcfa('0x5'),'port':0x18eb});var io=require(_0xdcfa('0x6'))(new Redis(config[_0xdcfa('0x4')]));function closeInteractions(){var _0x2679ee=0x0;var _0x3cb839=[];return db[_0xdcfa('0x7')][_0xdcfa('0x8')]({'raw':!![],'attributes':['id',_0xdcfa('0x9')],'where':{'id':0x1}})[_0xdcfa('0xa')](function(_0x3ab31e){_0x2679ee=_0x3ab31e[_0xdcfa('0x9')];if(_0x2679ee){return db[_0xdcfa('0xb')][_0xdcfa('0xc')]({'raw':!![],'attributes':['id',_0xdcfa('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xdcfa('0xe')](_0x3ab31e[_0xdcfa('0x9')],_0xdcfa('0xf'))}}});}else{return[];}})['then'](function(_0x5bc13d){_0x3cb839=_0x5bc13d;if(_0x2679ee){return db[_0xdcfa('0xb')]['update']({'closeReason':_0xdcfa('0x10'),'disposition':_0xdcfa('0x11'),'closed':!![],'closedAt':moment()['format'](_0xdcfa('0x12'))},{'where':{'id':_[_0xdcfa('0x13')](_0x3cb839||[],'id')}});}})[_0xdcfa('0xa')](function(_0x2c830b){for(var _0x196e3d=0x0;_0x196e3d<_0x3cb839[_0xdcfa('0x14')];_0x196e3d++){io['emit'](_0xdcfa('0x15'),{'id':_0x3cb839[_0x196e3d]['id'],'closed':!![]});}})[_0xdcfa('0x16')](function(_0x1cfd04){console[_0xdcfa('0x17')](_0x1cfd04);});}exports[_0xdcfa('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 8448ed4..6c39597 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 _0xb0e6=['difference','intersection','exists','resolve','run\x20job','cron','active','isBetween','startAt','start','add\x20cron','stop','deleteJob','length','update','update\x20cron','stop\x20cron','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','secure','authentication','user','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','../../files/reports','savename','%s.%s','extname','join','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','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','error\x20mail','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','DefaultReportId','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','findAll','MailServerOut','keys','jobs','map','toString','keyBy'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb0e6,0x66));var _0x6b0e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb0e6[_0x4b055c];return _0x4b62bb;};'use strict';var fs=require('fs');var util=require(_0x6b0e('0x0'));var path=require(_0x6b0e('0x1'));var _=require(_0x6b0e('0x2'));var moment=require(_0x6b0e('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x6b0e('0x4'));var BPromise=require(_0x6b0e('0x5'));var logger=require(_0x6b0e('0x6'))(_0x6b0e('0x7'));var db=require(_0x6b0e('0x8'))['db'];var analyticCustomReportController=require(_0x6b0e('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x6b0e('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xd50a3b,_0x179559){return function(){logger[_0x6b0e('0xb')](_0x6b0e('0xc'),_0xd50a3b[_0x6b0e('0xd')]);var _0x5bfd9c=!![];var _0x5be51b={'tls':{'rejectUnauthorized':![]}};if(_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xf')][_0x6b0e('0x10')]){_0x5be51b[_0x6b0e('0x10')]=_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xf')][_0x6b0e('0x10')];}else{_0x5be51b['host']=_0xd50a3b[_0x6b0e('0xe')]['Smtp'][_0x6b0e('0x11')];_0x5be51b['port']=_0xd50a3b[_0x6b0e('0xe')]['Smtp']['port'];_0x5be51b[_0x6b0e('0x12')]=_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xf')][_0x6b0e('0x12')];}if(_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xf')][_0x6b0e('0x13')]){_0x5be51b['auth']={'user':_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xf')][_0x6b0e('0x14')],'pass':_0xd50a3b[_0x6b0e('0xe')]['Smtp']['pass']};}var _0x5c20e7={'account':_0x5be51b,'message':{'from':util[_0x6b0e('0x15')](_0x6b0e('0x16'),_0xd50a3b[_0x6b0e('0xe')]['name'],_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xd')]||_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xf')][_0x6b0e('0x14')]),'to':_0xd50a3b['email'],'cc':_0xd50a3b['cc'],'bcc':_0xd50a3b[_0x6b0e('0x17')],'subject':util['format'](_0x6b0e('0x18'),_0x179559[_0x6b0e('0x19')],_0xd50a3b['subtractNumber'],_0xd50a3b[_0x6b0e('0x1a')])}};var _0x1f5980=path['join'](__dirname,_0x6b0e('0x1b'));var _0x478188=_0x179559[_0x6b0e('0x1c')];var _0x34910e=util['format'](_0x6b0e('0x1d'),path['basename'](_0x179559[_0x6b0e('0x1c')],path[_0x6b0e('0x1e')](_0x179559[_0x6b0e('0x1c')])),'zip');var _0x4f52ef=path[_0x6b0e('0x1f')](_0x1f5980,_0x478188);var _0x502d0d=path[_0x6b0e('0x1f')](_0x1f5980,_0x34910e);if(fs[_0x6b0e('0x20')](_0x4f52ef)){_0x179559[_0x6b0e('0x21')]=_0x6b0e('0x22');_0x5c20e7[_0x6b0e('0x23')][_0x6b0e('0x24')]=[{'filename':_0x478188,'path':_0x4f52ef}];_0x5c20e7[_0x6b0e('0x23')][_0x6b0e('0x25')]=util[_0x6b0e('0x15')](_0x6b0e('0x26'),JSON[_0x6b0e('0x27')](_0x179559,null,0x2));}else if(fs[_0x6b0e('0x20')](_0x502d0d)){_0x179559[_0x6b0e('0x21')]=_0x6b0e('0x22');_0x5c20e7[_0x6b0e('0x23')]['attachments']=[{'filename':_0x34910e,'path':_0x502d0d}];}else{_0x5c20e7[_0x6b0e('0x23')]['text']=_0x6b0e('0x28');if(!_0xd50a3b[_0x6b0e('0x29')]){_0x5bfd9c=![];logger[_0x6b0e('0xb')](_0x6b0e('0x2a'));}}if(_0x5bfd9c){return client[_0x6b0e('0x2b')](_0x6b0e('0x2c'),_0x5c20e7)[_0x6b0e('0x2d')](function(_0x42df96){if(_0x42df96['error']){return logger[_0x6b0e('0x2e')](_0x6b0e('0x2f'),JSON[_0x6b0e('0x27')](_0x42df96));}return logger[_0x6b0e('0xb')]('email\x20sent');})[_0x6b0e('0x30')](function(_0x34214d){return logger[_0x6b0e('0x2e')]('error\x20mail',JSON['stringify'](_0x34214d));});}};}function handleError(){return function(_0x52276c){return logger[_0x6b0e('0x2e')](JSON[_0x6b0e('0x27')](_0x52276c));};}function handleResult(_0x156387){return function(_0xab68b4){logger[_0x6b0e('0xb')](_0x6b0e('0x31'),JSON[_0x6b0e('0x27')](_0xab68b4));if(_0x156387[_0x6b0e('0xe')]&&_0x156387[_0x6b0e('0xe')][_0x6b0e('0xf')]&&!_['isNil'](_0x156387[_0x6b0e('0xd')])){setTimeout(handleSendEmail(_0x156387,_0xab68b4),0x3c*0x3e8);}};}function handleJob(_0x2bfb88){return function(){try{if(_[_0x6b0e('0x32')](_0x2bfb88['subtractNumber'])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x2bfb88['subtractUnit'])){return logger[_0x6b0e('0xb')](_0x6b0e('0x33'));}var _0x5c09a7={'startDate':moment()[_0x6b0e('0x34')](_0x2bfb88[_0x6b0e('0x35')],_0x2bfb88[_0x6b0e('0x1a')])[_0x6b0e('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x6b0e('0x15')](_0x6b0e('0x36')),'type':_0x6b0e('0x37'),'output':_0x2bfb88['output'],'name':_0x2bfb88[_0x6b0e('0x19')]};if(!_[_0x6b0e('0x32')](_0x2bfb88['DefaultReportId'])){logger[_0x6b0e('0xb')](_0x6b0e('0x38'),_0x2bfb88[_0x6b0e('0x39')]);return analyticDefaultReportController['runReport']({'id':_0x2bfb88['DefaultReportId']},_0x5c09a7)['then'](handleResult(_0x2bfb88))[_0x6b0e('0x30')](handleError());}if(!_[_0x6b0e('0x32')](_0x2bfb88['CustomReportId'])){logger[_0x6b0e('0xb')](_0x6b0e('0x3a'),_0x2bfb88[_0x6b0e('0x3b')]);return analyticCustomReportController[_0x6b0e('0x3c')]({'id':_0x2bfb88[_0x6b0e('0x3b')]},_0x5c09a7)[_0x6b0e('0x2d')](handleResult(_0x2bfb88))[_0x6b0e('0x30')](handleError());}}catch(_0x5aacdc){logger[_0x6b0e('0x2e')](JSON[_0x6b0e('0x27')](_0x5aacdc));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x54b837){var _0x3907f9={};if(_0x54b837){_0x3907f9['id']=_0x54b837;}return db['Schedule'][_0x6b0e('0x3d')]({'where':_0x3907f9,'include':[{'model':db[_0x6b0e('0xe')],'attributes':['id',_0x6b0e('0x19'),_0x6b0e('0xd')],'include':[{'model':db[_0x6b0e('0x3e')],'as':_0x6b0e('0xf')}]}]})['then'](function(_0x512ad0){var _0x49fc5c=_[_0x6b0e('0x3f')](manager[_0x6b0e('0x40')]);var _0xd18bc1=_[_0x6b0e('0x41')](_0x512ad0,function(_0x1d17aa){return _0x1d17aa['id'][_0x6b0e('0x42')]();});var _0x2dad06=_[_0x6b0e('0x43')](_0x512ad0,function(_0x4742a2){return _0x4742a2['id'][_0x6b0e('0x42')]();});var _0x1a36e5=_0x54b837?_0xd18bc1:_[_0x6b0e('0x44')](_0xd18bc1,_0x49fc5c);var _0x4e279c=_[_0x6b0e('0x45')](_0xd18bc1,_0x49fc5c);var _0x3d215f=_['difference'](_0x49fc5c,_0xd18bc1);var _0x23edf2;var _0x3ad164;for(_0x23edf2=0x0;_0x23edf2<_0x3d215f['length']&&!_0x54b837;_0x23edf2+=0x1){_0x3ad164=_0x3d215f[_0x23edf2][_0x6b0e('0x42')]();if(manager[_0x6b0e('0x46')](_0x3ad164)){manager['stop'](_0x3ad164);manager['deleteJob'](_0x3ad164);logger[_0x6b0e('0xb')]('delete\x20cron',_0x3ad164);}}logger[_0x6b0e('0xb')]('toRun',JSON[_0x6b0e('0x27')](_0x1a36e5));for(_0x23edf2=0x0;_0x23edf2<_0x1a36e5['length'];_0x23edf2+=0x1){_0x3ad164=_0x1a36e5[_0x23edf2][_0x6b0e('0x42')]();logger[_0x6b0e('0xb')]('index',_0x3ad164);if(_0x54b837){logger[_0x6b0e('0xb')]('my\x20id',_0x54b837);logger[_0x6b0e('0xb')](JSON['stringify'](_0x2dad06[_0x3ad164]));BPromise[_0x6b0e('0x47')]()[_0x6b0e('0x2d')](handleJob(_0x2dad06[_0x3ad164]));logger[_0x6b0e('0xb')](_0x6b0e('0x48'),_0x2dad06[_0x3ad164][_0x6b0e('0x19')],_0x2dad06[_0x3ad164][_0x6b0e('0x49')]);}else if(_0x2dad06[_0x3ad164][_0x6b0e('0x49')]&&_0x2dad06[_0x3ad164][_0x6b0e('0x4a')]&&moment()[_0x6b0e('0x4b')](_0x2dad06[_0x3ad164][_0x6b0e('0x4c')],_0x2dad06[_0x3ad164]['endAt'])){manager['add'](_0x3ad164,_0x2dad06[_0x3ad164][_0x6b0e('0x49')],handleJob(_0x2dad06[_0x3ad164]));manager[_0x6b0e('0x4d')](_0x3ad164);logger[_0x6b0e('0xb')](_0x6b0e('0x4e'),_0x2dad06[_0x3ad164]['name'],_0x2dad06[_0x3ad164][_0x6b0e('0x49')]);}else if(manager['exists'](_0x3ad164)){manager[_0x6b0e('0x4f')](_0x3ad164);manager[_0x6b0e('0x50')](_0x3ad164);logger[_0x6b0e('0xb')]('stop\x20cron',_0x2dad06[_0x3ad164]['name'],_0x2dad06[_0x3ad164][_0x6b0e('0x49')]);}}for(_0x23edf2=0x0,_0x3ad164;_0x23edf2<_0x4e279c[_0x6b0e('0x51')]&&!_0x54b837;_0x23edf2+=0x1){_0x3ad164=_0x4e279c[_0x23edf2]['toString']();if(manager[_0x6b0e('0x46')](_0x3ad164)){if(_0x2dad06[_0x3ad164]['cron']&&_0x2dad06[_0x3ad164][_0x6b0e('0x4a')]&&moment()[_0x6b0e('0x4b')](_0x2dad06[_0x3ad164][_0x6b0e('0x4c')],_0x2dad06[_0x3ad164]['endAt'])){manager[_0x6b0e('0x52')](_0x3ad164,_0x2dad06[_0x3ad164][_0x6b0e('0x49')],handleJob(_0x2dad06[_0x3ad164]));logger[_0x6b0e('0xb')](_0x6b0e('0x53'),_0x2dad06[_0x3ad164][_0x6b0e('0x19')],_0x2dad06[_0x3ad164][_0x6b0e('0x49')]);}else{manager[_0x6b0e('0x4f')](_0x3ad164);manager['deleteJob'](_0x3ad164);logger[_0x6b0e('0xb')](_0x6b0e('0x54'),_0x2dad06[_0x3ad164][_0x6b0e('0x19')],_0x2dad06[_0x3ad164]['cron']);}}}})[_0x6b0e('0x30')](function(_0xd6e812){logger[_0x6b0e('0x2e')](JSON[_0x6b0e('0x27')](_0xd6e812));});}exports['run']=function(_0x4b2808){return getJobs(_0x4b2808);};exports[_0x6b0e('0x4d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6242=['catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','jobs','map','toString','keyBy','difference','exists','stop','deleteJob','delete\x20cron','length','index','run\x20job','cron','isBetween','startAt','endAt','start','add\x20cron','active','update','update\x20cron','stop\x20cron','run','util','lodash','moment','jayson/promise','bluebird','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','MailAccount','Smtp','service','host','port','secure','auth','user','pass','format','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','error','error\x20mail','email\x20sent'];(function(_0x33fd3a,_0x1cf330){var _0x22687a=function(_0x5cd3b2){while(--_0x5cd3b2){_0x33fd3a['push'](_0x33fd3a['shift']());}};_0x22687a(++_0x1cf330);}(_0x6242,0x127));var _0x2624=function(_0x2f38cd,_0x5427bc){_0x2f38cd=_0x2f38cd-0x0;var _0x2cca67=_0x6242[_0x2f38cd];return _0x2cca67;};'use strict';var fs=require('fs');var util=require(_0x2624('0x0'));var path=require('path');var _=require(_0x2624('0x1'));var moment=require(_0x2624('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x2624('0x3'));var BPromise=require(_0x2624('0x4'));var logger=require(_0x2624('0x5'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x2624('0x6'));var analyticDefaultReportController=require(_0x2624('0x7'));var client=jayson['client'][_0x2624('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4819dd,_0x509706){return function(){logger[_0x2624('0x9')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x4819dd[_0x2624('0xa')]);var _0x3f383a=!![];var _0x5b04b1={'tls':{'rejectUnauthorized':![]}};if(_0x4819dd[_0x2624('0xb')][_0x2624('0xc')][_0x2624('0xd')]){_0x5b04b1['service']=_0x4819dd[_0x2624('0xb')][_0x2624('0xc')]['service'];}else{_0x5b04b1[_0x2624('0xe')]=_0x4819dd[_0x2624('0xb')]['Smtp'][_0x2624('0xe')];_0x5b04b1[_0x2624('0xf')]=_0x4819dd[_0x2624('0xb')][_0x2624('0xc')]['port'];_0x5b04b1['secure']=_0x4819dd[_0x2624('0xb')]['Smtp'][_0x2624('0x10')];}if(_0x4819dd[_0x2624('0xb')][_0x2624('0xc')]['authentication']){_0x5b04b1[_0x2624('0x11')]={'user':_0x4819dd[_0x2624('0xb')][_0x2624('0xc')][_0x2624('0x12')],'pass':_0x4819dd[_0x2624('0xb')]['Smtp'][_0x2624('0x13')]};}var _0x297e64={'account':_0x5b04b1,'message':{'from':util[_0x2624('0x14')]('\x22%s\x22\x20<%s>',_0x4819dd['MailAccount']['name'],_0x4819dd[_0x2624('0xb')]['email']||_0x4819dd[_0x2624('0xb')][_0x2624('0xc')][_0x2624('0x12')]),'to':_0x4819dd[_0x2624('0xa')],'cc':_0x4819dd['cc'],'bcc':_0x4819dd[_0x2624('0x15')],'subject':util[_0x2624('0x14')](_0x2624('0x16'),_0x509706[_0x2624('0x17')],_0x4819dd[_0x2624('0x18')],_0x4819dd['subtractUnit'])}};var _0x4012cc=path[_0x2624('0x19')](__dirname,_0x2624('0x1a'));var _0x4c814b=_0x509706[_0x2624('0x1b')];var _0x4c2365=util['format'](_0x2624('0x1c'),path[_0x2624('0x1d')](_0x509706[_0x2624('0x1b')],path['extname'](_0x509706[_0x2624('0x1b')])),_0x2624('0x1e'));var _0x45a9f9=path[_0x2624('0x19')](_0x4012cc,_0x4c814b);var _0x446c1d=path[_0x2624('0x19')](_0x4012cc,_0x4c2365);if(fs[_0x2624('0x1f')](_0x45a9f9)){_0x509706[_0x2624('0x20')]=_0x2624('0x21');_0x297e64[_0x2624('0x22')][_0x2624('0x23')]=[{'filename':_0x4c814b,'path':_0x45a9f9}];_0x297e64[_0x2624('0x22')][_0x2624('0x24')]=util['format'](_0x2624('0x25'),JSON[_0x2624('0x26')](_0x509706,null,0x2));}else if(fs['existsSync'](_0x446c1d)){_0x509706[_0x2624('0x20')]='Sent';_0x297e64[_0x2624('0x22')][_0x2624('0x23')]=[{'filename':_0x4c2365,'path':_0x446c1d}];}else{_0x297e64[_0x2624('0x22')][_0x2624('0x24')]=_0x2624('0x27');if(!_0x4819dd[_0x2624('0x28')]){_0x3f383a=![];logger[_0x2624('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3f383a){return client[_0x2624('0x29')]('SendMail',_0x297e64)['then'](function(_0x18a24a){if(_0x18a24a['error']){return logger[_0x2624('0x2a')](_0x2624('0x2b'),JSON[_0x2624('0x26')](_0x18a24a));}return logger[_0x2624('0x9')](_0x2624('0x2c'));})[_0x2624('0x2d')](function(_0x168020){return logger[_0x2624('0x2a')](_0x2624('0x2b'),JSON[_0x2624('0x26')](_0x168020));});}};}function handleError(){return function(_0x3d4769){return logger[_0x2624('0x2a')](JSON[_0x2624('0x26')](_0x3d4769));};}function handleResult(_0x412100){return function(_0x3a82d0){logger[_0x2624('0x9')](_0x2624('0x2e'),JSON[_0x2624('0x26')](_0x3a82d0));if(_0x412100[_0x2624('0xb')]&&_0x412100[_0x2624('0xb')][_0x2624('0xc')]&&!_[_0x2624('0x2f')](_0x412100[_0x2624('0xa')])){setTimeout(handleSendEmail(_0x412100,_0x3a82d0),0x3c*0x3e8);}};}function handleJob(_0x4312d7){return function(){try{if(_[_0x2624('0x2f')](_0x4312d7[_0x2624('0x18')])){return logger[_0x2624('0x9')](_0x2624('0x30'));}if(_[_0x2624('0x2f')](_0x4312d7['subtractUnit'])){return logger[_0x2624('0x9')](_0x2624('0x31'));}var _0x2f2e9d={'startDate':moment()['subtract'](_0x4312d7[_0x2624('0x18')],_0x4312d7[_0x2624('0x32')])[_0x2624('0x14')](_0x2624('0x33')),'endDate':moment()[_0x2624('0x14')](_0x2624('0x33')),'type':_0x2624('0x34'),'output':_0x4312d7[_0x2624('0x35')],'name':_0x4312d7['name']};if(!_['isNil'](_0x4312d7[_0x2624('0x36')])){logger['info'](_0x2624('0x37'),_0x4312d7['DefaultReportId']);return analyticDefaultReportController[_0x2624('0x38')]({'id':_0x4312d7['DefaultReportId']},_0x2f2e9d)[_0x2624('0x39')](handleResult(_0x4312d7))[_0x2624('0x2d')](handleError());}if(!_['isNil'](_0x4312d7[_0x2624('0x3a')])){logger[_0x2624('0x9')]('exec\x20custom\x20report\x20id:%s',_0x4312d7[_0x2624('0x3a')]);return analyticCustomReportController[_0x2624('0x38')]({'id':_0x4312d7[_0x2624('0x3a')]},_0x2f2e9d)[_0x2624('0x39')](handleResult(_0x4312d7))[_0x2624('0x2d')](handleError());}}catch(_0x41e62e){logger['error'](JSON['stringify'](_0x41e62e));}return logger[_0x2624('0x9')](_0x2624('0x3b'));};}function getJobs(_0x477d93){var _0x49e2c4={};if(_0x477d93){_0x49e2c4['id']=_0x477d93;}return db[_0x2624('0x3c')]['findAll']({'where':_0x49e2c4,'include':[{'model':db[_0x2624('0xb')],'attributes':['id',_0x2624('0x17'),_0x2624('0xa')],'include':[{'model':db[_0x2624('0x3d')],'as':_0x2624('0xc')}]}]})['then'](function(_0x256228){var _0x472e9c=_['keys'](manager[_0x2624('0x3e')]);var _0x28f417=_[_0x2624('0x3f')](_0x256228,function(_0x4f6916){return _0x4f6916['id'][_0x2624('0x40')]();});var _0x3c95e5=_[_0x2624('0x41')](_0x256228,function(_0x4f4e39){return _0x4f4e39['id'][_0x2624('0x40')]();});var _0x2e8d32=_0x477d93?_0x28f417:_[_0x2624('0x42')](_0x28f417,_0x472e9c);var _0xbd8433=_['intersection'](_0x28f417,_0x472e9c);var _0x5dcc92=_[_0x2624('0x42')](_0x472e9c,_0x28f417);var _0x9410f9;var _0xe47404;for(_0x9410f9=0x0;_0x9410f9<_0x5dcc92['length']&&!_0x477d93;_0x9410f9+=0x1){_0xe47404=_0x5dcc92[_0x9410f9][_0x2624('0x40')]();if(manager[_0x2624('0x43')](_0xe47404)){manager[_0x2624('0x44')](_0xe47404);manager[_0x2624('0x45')](_0xe47404);logger[_0x2624('0x9')](_0x2624('0x46'),_0xe47404);}}logger[_0x2624('0x9')]('toRun',JSON[_0x2624('0x26')](_0x2e8d32));for(_0x9410f9=0x0;_0x9410f9<_0x2e8d32[_0x2624('0x47')];_0x9410f9+=0x1){_0xe47404=_0x2e8d32[_0x9410f9][_0x2624('0x40')]();logger[_0x2624('0x9')](_0x2624('0x48'),_0xe47404);if(_0x477d93){logger[_0x2624('0x9')]('my\x20id',_0x477d93);logger[_0x2624('0x9')](JSON[_0x2624('0x26')](_0x3c95e5[_0xe47404]));BPromise['resolve']()['then'](handleJob(_0x3c95e5[_0xe47404]));logger['info'](_0x2624('0x49'),_0x3c95e5[_0xe47404][_0x2624('0x17')],_0x3c95e5[_0xe47404][_0x2624('0x4a')]);}else if(_0x3c95e5[_0xe47404][_0x2624('0x4a')]&&_0x3c95e5[_0xe47404]['active']&&moment()[_0x2624('0x4b')](_0x3c95e5[_0xe47404][_0x2624('0x4c')],_0x3c95e5[_0xe47404][_0x2624('0x4d')])){manager['add'](_0xe47404,_0x3c95e5[_0xe47404][_0x2624('0x4a')],handleJob(_0x3c95e5[_0xe47404]));manager[_0x2624('0x4e')](_0xe47404);logger[_0x2624('0x9')](_0x2624('0x4f'),_0x3c95e5[_0xe47404][_0x2624('0x17')],_0x3c95e5[_0xe47404][_0x2624('0x4a')]);}else if(manager[_0x2624('0x43')](_0xe47404)){manager[_0x2624('0x44')](_0xe47404);manager['deleteJob'](_0xe47404);logger[_0x2624('0x9')]('stop\x20cron',_0x3c95e5[_0xe47404][_0x2624('0x17')],_0x3c95e5[_0xe47404][_0x2624('0x4a')]);}}for(_0x9410f9=0x0,_0xe47404;_0x9410f9<_0xbd8433[_0x2624('0x47')]&&!_0x477d93;_0x9410f9+=0x1){_0xe47404=_0xbd8433[_0x9410f9][_0x2624('0x40')]();if(manager['exists'](_0xe47404)){if(_0x3c95e5[_0xe47404][_0x2624('0x4a')]&&_0x3c95e5[_0xe47404][_0x2624('0x50')]&&moment()[_0x2624('0x4b')](_0x3c95e5[_0xe47404][_0x2624('0x4c')],_0x3c95e5[_0xe47404][_0x2624('0x4d')])){manager[_0x2624('0x51')](_0xe47404,_0x3c95e5[_0xe47404][_0x2624('0x4a')],handleJob(_0x3c95e5[_0xe47404]));logger[_0x2624('0x9')](_0x2624('0x52'),_0x3c95e5[_0xe47404][_0x2624('0x17')],_0x3c95e5[_0xe47404][_0x2624('0x4a')]);}else{manager[_0x2624('0x44')](_0xe47404);manager[_0x2624('0x45')](_0xe47404);logger['info'](_0x2624('0x53'),_0x3c95e5[_0xe47404][_0x2624('0x17')],_0x3c95e5[_0xe47404][_0x2624('0x4a')]);}}}})[_0x2624('0x2d')](function(_0x30f5e9){logger['error'](JSON[_0x2624('0x26')](_0x30f5e9));});}exports[_0x2624('0x54')]=function(_0x24a89c){return getJobs(_0x24a89c);};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 08d8688..b6154a4 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 _0x4a07=['push','all','SequelizeValidationError','error','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured'];(function(_0x1f7aee,_0x215f9a){var _0x4e6f66=function(_0x33c6e0){while(--_0x33c6e0){_0x1f7aee['push'](_0x1f7aee['shift']());}};_0x4e6f66(++_0x215f9a);}(_0x4a07,0x129));var _0x74a0=function(_0xc9de77,_0x555652){_0xc9de77=_0xc9de77-0x0;var _0x554679=_0x4a07[_0xc9de77];return _0x554679;};var _=require(_0x74a0('0x0'));var AWS=require(_0x74a0('0x1'));var rp=require(_0x74a0('0x2'));var util=require(_0x74a0('0x3'));var BPromise=require(_0x74a0('0x4'));var db=require(_0x74a0('0x5'))['db'];var logger=require(_0x74a0('0x6'))(_0x74a0('0x7'));function getTranscriptionJob(_0x1acbaa,_0x417401,_0x3d7aa0,_0x5cd603){return new Promise(function(_0x258cce,_0x25b359){var _0x25eb1e=new AWS[(_0x74a0('0x8'))]({'accessKeyId':_0x417401,'secretAccessKey':_0x1acbaa,'region':_0x3d7aa0});_0x25eb1e[_0x74a0('0x9')]({'TranscriptionJobName':_0x5cd603},function(_0x298da8,_0x367c94){if(_0x298da8){return _0x25b359(_0x298da8);}else{return _0x258cce(_0x367c94);}});});}function sentiment(_0x42693d,_0x357316,_0x8d0468,_0x2bbec2,_0x20ffef){return new Promise(function(_0x40b1bf,_0x33b07a){var _0x6d1c7a=new AWS[(_0x74a0('0xa'))]({'accessKeyId':_0x357316,'secretAccessKey':_0x42693d,'region':_0x8d0468});_0x6d1c7a[_0x74a0('0xb')]({'Text':_0x2bbec2,'LanguageCode':_0x20ffef['substring'](0x0,0x2)},function(_0x242866,_0x31e456){if(_0x242866){return _0x33b07a(_0x242866);}else{return _0x40b1bf(_0x31e456);}});});}function checkTranscribeJob(_0x71e7f7,_0x59e022,_0x460892){var _0x4fc9a4;return new BPromise(function(_0x1d908f,_0x2be30a){logger['info'](util[_0x74a0('0xc')](_0x74a0('0xd'),_0x71e7f7['id'],_0x71e7f7[_0x74a0('0xe')]));return getTranscriptionJob(_0x460892[_0x74a0('0xf')],_0x460892[_0x74a0('0x10')],_0x59e022['transcribeRegion'],_0x71e7f7[_0x74a0('0xe')])[_0x74a0('0x11')](function(_0x25153b){logger['info'](util[_0x74a0('0xc')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x71e7f7['id'],_0x71e7f7[_0x74a0('0xe')],_0x25153b[_0x74a0('0x12')]['TranscriptionJobStatus']));if(!_0x71e7f7[_0x74a0('0x13')]){switch(_0x25153b['TranscriptionJob'][_0x74a0('0x14')]){case _0x74a0('0x15'):var _0x231451={'transcribeStatus':_0x25153b[_0x74a0('0x12')][_0x74a0('0x14')],'fileUri':_0x25153b[_0x74a0('0x12')][_0x74a0('0x16')][_0x74a0('0x17')]};logger[_0x74a0('0x18')](util['format'](_0x74a0('0x19'),_0x71e7f7['id']));return rp({'uri':_0x25153b[_0x74a0('0x12')][_0x74a0('0x16')][_0x74a0('0x17')],'json':!![]})[_0x74a0('0x11')](function(_0x329cce){logger[_0x74a0('0x18')](util[_0x74a0('0xc')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x71e7f7['id']));if(_0x329cce&&_0x329cce['results']&&_0x329cce[_0x74a0('0x1a')][_0x74a0('0x1b')]&&_0x329cce[_0x74a0('0x1a')]['transcripts'][_0x74a0('0x1c')]){_0x231451[_0x74a0('0x13')]='';for(var _0x4c26a3=0x0;_0x4c26a3<_0x329cce[_0x74a0('0x1a')][_0x74a0('0x1b')][_0x74a0('0x1c')];_0x4c26a3++){_0x231451[_0x74a0('0x13')]+=_0x329cce[_0x74a0('0x1a')][_0x74a0('0x1b')][_0x4c26a3][_0x74a0('0x1d')]+'';}}return _0x71e7f7[_0x74a0('0x1e')](_0x231451);})[_0x74a0('0x11')](function(){logger[_0x74a0('0x18')](util[_0x74a0('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x71e7f7['id']));if(!_0x71e7f7[_0x74a0('0x1f')]){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))](_0x74a0('0x22'));}if(!_0x59e022[_0x74a0('0x23')]||!_0x59e022[_0x74a0('0x24')]||!_0x59e022[_0x74a0('0x25')]||!_0x59e022['language']||!_0x59e022[_0x74a0('0x26')]){throw new db['Sequelize'][(_0x74a0('0x21'))](_0x74a0('0x27'));}if(!_0x231451['fileText']){throw new Error(_0x74a0('0x28'));}if(_0x59e022[_0x74a0('0x24')]===_0x460892['id']){return _0x460892;}else{return db[_0x74a0('0x29')][_0x74a0('0x2a')]({'where':{'id':_settings[_0x74a0('0x24')]}});}})['then'](function(_0x2e306c){if(!_0x2e306c){throw new db['Sequelize'][(_0x74a0('0x21'))](_0x74a0('0x2b'));}if(!_0x2e306c[_0x74a0('0xf')]||!_0x2e306c[_0x74a0('0x10')]){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x4fc9a4=_0x2e306c;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x71e7f7['id']));return sentiment(_0x4fc9a4[_0x74a0('0xf')],_0x4fc9a4[_0x74a0('0x10')],_0x59e022[_0x74a0('0x25')],_0x231451['fileText'],_0x59e022[_0x74a0('0x2c')]);})[_0x74a0('0x11')](function(_0x3d519a){logger[_0x74a0('0x18')](util[_0x74a0('0xc')](_0x74a0('0x2d'),_0x71e7f7['id']));return _0x71e7f7['update']({'sentiment':_0x3d519a[_0x74a0('0x2e')],'sPositive':_0x3d519a['SentimentScore']['Positive'],'sNegative':_0x3d519a[_0x74a0('0x2f')][_0x74a0('0x30')],'sMixed':_0x3d519a['SentimentScore'][_0x74a0('0x31')],'sNeutral':_0x3d519a['SentimentScore'][_0x74a0('0x32')]});})[_0x74a0('0x11')](function(){logger[_0x74a0('0x18')](util[_0x74a0('0xc')](_0x74a0('0x33'),_0x71e7f7['id']));_0x1d908f();});case _0x74a0('0x34'):return _0x71e7f7[_0x74a0('0x1e')]({'transcribeStatus':_0x74a0('0x34'),'failureReason':_0x25153b[_0x74a0('0x12')][_0x74a0('0x35')]})[_0x74a0('0x11')](function(){logger[_0x74a0('0x18')](util[_0x74a0('0xc')](_0x74a0('0x33'),_0x71e7f7['id']));_0x1d908f();});default:logger[_0x74a0('0x18')](util[_0x74a0('0xc')](_0x74a0('0x36'),_0x71e7f7['id']));break;}}else{return BPromise[_0x74a0('0x37')]()[_0x74a0('0x11')](function(){if(!_0x71e7f7[_0x74a0('0x1f')]){throw new db['Sequelize'][(_0x74a0('0x21'))](_0x74a0('0x22'));}if(!_0x59e022[_0x74a0('0x23')]||!_0x59e022[_0x74a0('0x24')]||!_0x59e022[_0x74a0('0x25')]||!_0x59e022['language']||!_0x59e022[_0x74a0('0x26')]){throw new db['Sequelize'][(_0x74a0('0x21'))](_0x74a0('0x27'));}if(!_0x71e7f7[_0x74a0('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x59e022[_0x74a0('0x24')]===_0x460892['id']){return _0x460892;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x74a0('0x24')]}});}})['then'](function(_0xc3aa2){if(!_0xc3aa2){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))](_0x74a0('0x2b'));}if(!_0xc3aa2['data1']||!_0xc3aa2[_0x74a0('0x10')]){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))](_0x74a0('0x38'));}_0x4fc9a4=_0xc3aa2;logger[_0x74a0('0x18')](util[_0x74a0('0xc')](_0x74a0('0x39'),_0x71e7f7['id']));return sentiment(_0x4fc9a4['data1'],_0x4fc9a4['data2'],_0x59e022[_0x74a0('0x25')],_0x71e7f7[_0x74a0('0x13')],_0x59e022[_0x74a0('0x2c')]);})[_0x74a0('0x11')](function(_0x141d2e){logger['info'](util[_0x74a0('0xc')](_0x74a0('0x2d'),_0x71e7f7['id']));return _0x71e7f7[_0x74a0('0x1e')]({'sentiment':_0x141d2e[_0x74a0('0x2e')],'sPositive':_0x141d2e['SentimentScore'][_0x74a0('0x3a')],'sNegative':_0x141d2e['SentimentScore'][_0x74a0('0x30')],'sMixed':_0x141d2e[_0x74a0('0x2f')][_0x74a0('0x31')],'sNeutral':_0x141d2e[_0x74a0('0x2f')][_0x74a0('0x32')],'transcribeStatus':_0x74a0('0x15')});})['then'](function(){logger[_0x74a0('0x18')](util[_0x74a0('0xc')](_0x74a0('0x33'),_0x71e7f7['id']));_0x1d908f();});}})[_0x74a0('0x3b')](function(_0x475387){if(_0x475387){if(!_0x475387[_0x74a0('0x3c')]||_0x475387[_0x74a0('0x3c')]!=='SequelizeValidationError'){logger['error'](util[_0x74a0('0xc')](_0x74a0('0x3d'),_0x71e7f7['id']),util[_0x74a0('0x3e')](_0x475387,{'showHidden':![],'depth':null}));}}_0x1d908f();});});}function checkTranscribe(){var _0x42a318;var _0xdd4e10;var _0x267084;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x74a0('0x11')](function(_0x4929b7){if(!_0x4929b7||!_0x4929b7[_0x74a0('0x1c')]){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))](_0x74a0('0x3f'));}_0x42a318=_0x4929b7;return db[_0x74a0('0x40')][_0x74a0('0x2a')]({'where':{'id':0x1}});})[_0x74a0('0x11')](function(_0x1e392c){if(!_0x1e392c){throw new db['Sequelize']['ValidationError']('Settings\x20not\x20available');}_0xdd4e10=_0x1e392c;if(!_0xdd4e10[_0x74a0('0x7')]||!_0xdd4e10[_0x74a0('0x41')]||!_0xdd4e10[_0x74a0('0x42')]||!_0xdd4e10[_0x74a0('0x2c')]||!_0xdd4e10[_0x74a0('0x26')]){throw new db[(_0x74a0('0x20'))]['ValidationError'](_0x74a0('0x43'));}return db[_0x74a0('0x29')][_0x74a0('0x2a')]({'where':{'id':_0xdd4e10[_0x74a0('0x41')]}});})[_0x74a0('0x11')](function(_0x19c44c){if(!_0x19c44c){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))](_0x74a0('0x2b'));}if(!_0x19c44c[_0x74a0('0xf')]||!_0x19c44c[_0x74a0('0x10')]){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x267084=_0x19c44c;var _0x5f6950=[];_0x42a318['forEach'](function(_0x525eec){_0x5f6950[_0x74a0('0x44')](checkTranscribeJob(_0x525eec,_0xdd4e10,_0x267084));});return BPromise[_0x74a0('0x45')](_0x5f6950);})[_0x74a0('0x3b')](function(_0x1a0c07){if(_0x1a0c07){if(!_0x1a0c07['name']||_0x1a0c07[_0x74a0('0x3c')]!==_0x74a0('0x46')){logger[_0x74a0('0x47')](util[_0x74a0('0x3e')](_0x1a0c07,{'showHidden':![],'depth':null}));}}});}exports[_0x74a0('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xf686=['info','format','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sequelize','ValidationError','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','sentimentRegion','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20configured','findOne','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','catch','name','error','inspect','VoiceRecording','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','CloudProvider','forEach','push','all','SequelizeValidationError','start','lodash','request-promise','util','bluebird','../../mysqldb','TranscribeService','getTranscriptionJob','detectSentiment'];(function(_0x541927,_0x524230){var _0x15636a=function(_0x3f19f3){while(--_0x3f19f3){_0x541927['push'](_0x541927['shift']());}};_0x15636a(++_0x524230);}(_0xf686,0x196));var _0x6f68=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf686[_0x321bb2];return _0x9c12ed;};var _=require(_0x6f68('0x0'));var AWS=require('aws-sdk');var rp=require(_0x6f68('0x1'));var util=require(_0x6f68('0x2'));var BPromise=require(_0x6f68('0x3'));var db=require(_0x6f68('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x231d2f,_0x4f51e2,_0x5741b3,_0x133a21){return new Promise(function(_0x526995,_0x2420c3){var _0x1a3f23=new AWS[(_0x6f68('0x5'))]({'accessKeyId':_0x4f51e2,'secretAccessKey':_0x231d2f,'region':_0x5741b3});_0x1a3f23[_0x6f68('0x6')]({'TranscriptionJobName':_0x133a21},function(_0x28bf93,_0x301b12){if(_0x28bf93){return _0x2420c3(_0x28bf93);}else{return _0x526995(_0x301b12);}});});}function sentiment(_0x23db13,_0x57c60d,_0x77e858,_0x1bdce4,_0x271a12){return new Promise(function(_0x5c7d58,_0x81364d){var _0x91da1b=new AWS['Comprehend']({'accessKeyId':_0x57c60d,'secretAccessKey':_0x23db13,'region':_0x77e858});_0x91da1b[_0x6f68('0x7')]({'Text':_0x1bdce4,'LanguageCode':_0x271a12['substring'](0x0,0x2)},function(_0x3c7657,_0x47d2e1){if(_0x3c7657){return _0x81364d(_0x3c7657);}else{return _0x5c7d58(_0x47d2e1);}});});}function checkTranscribeJob(_0x5972af,_0x2f2043,_0x1ab9fb){var _0x2ce20c;return new BPromise(function(_0x3881db,_0x2d3d4a){logger[_0x6f68('0x8')](util[_0x6f68('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5972af['id'],_0x5972af['transcribeName']));return getTranscriptionJob(_0x1ab9fb['data1'],_0x1ab9fb[_0x6f68('0xa')],_0x2f2043[_0x6f68('0xb')],_0x5972af[_0x6f68('0xc')])[_0x6f68('0xd')](function(_0x906e9a){logger[_0x6f68('0x8')](util[_0x6f68('0x9')](_0x6f68('0xe'),_0x5972af['id'],_0x5972af['transcribeName'],_0x906e9a[_0x6f68('0xf')]['TranscriptionJobStatus']));if(!_0x5972af[_0x6f68('0x10')]){switch(_0x906e9a['TranscriptionJob']['TranscriptionJobStatus']){case _0x6f68('0x11'):var _0x50c813={'transcribeStatus':_0x906e9a[_0x6f68('0xf')]['TranscriptionJobStatus'],'fileUri':_0x906e9a[_0x6f68('0xf')]['Transcript'][_0x6f68('0x12')]};logger[_0x6f68('0x8')](util[_0x6f68('0x9')](_0x6f68('0x13'),_0x5972af['id']));return rp({'uri':_0x906e9a[_0x6f68('0xf')][_0x6f68('0x14')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x1f4ddc){logger[_0x6f68('0x8')](util[_0x6f68('0x9')](_0x6f68('0x15'),_0x5972af['id']));if(_0x1f4ddc&&_0x1f4ddc[_0x6f68('0x16')]&&_0x1f4ddc['results'][_0x6f68('0x17')]&&_0x1f4ddc[_0x6f68('0x16')][_0x6f68('0x17')]['length']){_0x50c813[_0x6f68('0x10')]='';for(var _0x10d6ee=0x0;_0x10d6ee<_0x1f4ddc['results'][_0x6f68('0x17')]['length'];_0x10d6ee++){_0x50c813[_0x6f68('0x10')]+=_0x1f4ddc[_0x6f68('0x16')][_0x6f68('0x17')][_0x10d6ee]['transcript']+'';}}return _0x5972af[_0x6f68('0x18')](_0x50c813);})['then'](function(){logger[_0x6f68('0x8')](util[_0x6f68('0x9')](_0x6f68('0x19'),_0x5972af['id']));if(!_0x5972af[_0x6f68('0x1a')]){throw new db['Sequelize']['ValidationError'](_0x6f68('0x1b'));}if(!_0x2f2043[_0x6f68('0x1c')]||!_0x2f2043[_0x6f68('0x1d')]||!_0x2f2043['sentimentRegion']||!_0x2f2043[_0x6f68('0x1e')]||!_0x2f2043[_0x6f68('0x1f')]){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x50c813[_0x6f68('0x10')]){throw new Error(_0x6f68('0x22'));}if(_0x2f2043[_0x6f68('0x1d')]===_0x1ab9fb['id']){return _0x1ab9fb;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x6f68('0x1d')]}});}})['then'](function(_0x87bb1f){if(!_0x87bb1f){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))](_0x6f68('0x23'));}if(!_0x87bb1f['data1']||!_0x87bb1f[_0x6f68('0xa')]){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))](_0x6f68('0x24'));}_0x2ce20c=_0x87bb1f;logger[_0x6f68('0x8')](util[_0x6f68('0x9')](_0x6f68('0x25'),_0x5972af['id']));return sentiment(_0x2ce20c[_0x6f68('0x26')],_0x2ce20c[_0x6f68('0xa')],_0x2f2043[_0x6f68('0x27')],_0x50c813[_0x6f68('0x10')],_0x2f2043[_0x6f68('0x1e')]);})[_0x6f68('0xd')](function(_0x3325ae){logger[_0x6f68('0x8')](util[_0x6f68('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5972af['id']));return _0x5972af[_0x6f68('0x18')]({'sentiment':_0x3325ae['Sentiment'],'sPositive':_0x3325ae[_0x6f68('0x28')][_0x6f68('0x29')],'sNegative':_0x3325ae[_0x6f68('0x28')][_0x6f68('0x2a')],'sMixed':_0x3325ae['SentimentScore'][_0x6f68('0x2b')],'sNeutral':_0x3325ae[_0x6f68('0x28')][_0x6f68('0x2c')]});})[_0x6f68('0xd')](function(){logger[_0x6f68('0x8')](util[_0x6f68('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5972af['id']));_0x3881db();});case'FAILED':return _0x5972af[_0x6f68('0x18')]({'transcribeStatus':'FAILED','failureReason':_0x906e9a[_0x6f68('0xf')]['FailureReason']})['then'](function(){logger[_0x6f68('0x8')](util[_0x6f68('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5972af['id']));_0x3881db();});default:logger['info'](util[_0x6f68('0x9')](_0x6f68('0x2d'),_0x5972af['id']));break;}}else{return BPromise['resolve']()[_0x6f68('0xd')](function(){if(!_0x5972af[_0x6f68('0x1a')]){throw new db['Sequelize']['ValidationError'](_0x6f68('0x1b'));}if(!_0x2f2043[_0x6f68('0x1c')]||!_0x2f2043[_0x6f68('0x1d')]||!_0x2f2043[_0x6f68('0x27')]||!_0x2f2043[_0x6f68('0x1e')]||!_0x2f2043['bucket']){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))](_0x6f68('0x2e'));}if(!_0x5972af[_0x6f68('0x10')]){throw new Error('Transcript\x20not\x20available');}if(_0x2f2043['sentimentAccountId']===_0x1ab9fb['id']){return _0x1ab9fb;}else{return db['CloudProvider'][_0x6f68('0x2f')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x9df8d2){if(!_0x9df8d2){throw new db['Sequelize'][(_0x6f68('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x9df8d2['data1']||!_0x9df8d2[_0x6f68('0xa')]){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))](_0x6f68('0x24'));}_0x2ce20c=_0x9df8d2;logger[_0x6f68('0x8')](util[_0x6f68('0x9')](_0x6f68('0x25'),_0x5972af['id']));return sentiment(_0x2ce20c[_0x6f68('0x26')],_0x2ce20c[_0x6f68('0xa')],_0x2f2043['sentimentRegion'],_0x5972af[_0x6f68('0x10')],_0x2f2043[_0x6f68('0x1e')]);})[_0x6f68('0xd')](function(_0x1e6a7f){logger[_0x6f68('0x8')](util['format'](_0x6f68('0x30'),_0x5972af['id']));return _0x5972af[_0x6f68('0x18')]({'sentiment':_0x1e6a7f[_0x6f68('0x31')],'sPositive':_0x1e6a7f['SentimentScore'][_0x6f68('0x29')],'sNegative':_0x1e6a7f['SentimentScore'][_0x6f68('0x2a')],'sMixed':_0x1e6a7f[_0x6f68('0x28')][_0x6f68('0x2b')],'sNeutral':_0x1e6a7f[_0x6f68('0x28')][_0x6f68('0x2c')],'transcribeStatus':_0x6f68('0x11')});})[_0x6f68('0xd')](function(){logger['info'](util[_0x6f68('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5972af['id']));_0x3881db();});}})[_0x6f68('0x32')](function(_0x2af44a){if(_0x2af44a){if(!_0x2af44a['name']||_0x2af44a[_0x6f68('0x33')]!=='SequelizeValidationError'){logger[_0x6f68('0x34')](util[_0x6f68('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x5972af['id']),util[_0x6f68('0x35')](_0x2af44a,{'showHidden':![],'depth':null}));}}_0x3881db();});});}function checkTranscribe(){var _0x41720b;var _0x12c148;var _0x18eb93;return db[_0x6f68('0x36')]['findAll']({'where':{'transcribeStatus':_0x6f68('0x37')}})[_0x6f68('0xd')](function(_0x85de0b){if(!_0x85de0b||!_0x85de0b[_0x6f68('0x38')]){throw new db['Sequelize']['ValidationError'](_0x6f68('0x39'));}_0x41720b=_0x85de0b;return db[_0x6f68('0x3a')][_0x6f68('0x2f')]({'where':{'id':0x1}});})[_0x6f68('0xd')](function(_0x22ba80){if(!_0x22ba80){throw new db[(_0x6f68('0x20'))]['ValidationError'](_0x6f68('0x3b'));}_0x12c148=_0x22ba80;if(!_0x12c148[_0x6f68('0x3c')]||!_0x12c148[_0x6f68('0x3d')]||!_0x12c148[_0x6f68('0xb')]||!_0x12c148[_0x6f68('0x1e')]||!_0x12c148['bucket']){throw new db[(_0x6f68('0x20'))]['ValidationError'](_0x6f68('0x3e'));}return db[_0x6f68('0x3f')][_0x6f68('0x2f')]({'where':{'id':_0x12c148[_0x6f68('0x3d')]}});})[_0x6f68('0xd')](function(_0x202b4d){if(!_0x202b4d){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))](_0x6f68('0x23'));}if(!_0x202b4d[_0x6f68('0x26')]||!_0x202b4d[_0x6f68('0xa')]){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))](_0x6f68('0x24'));}_0x18eb93=_0x202b4d;var _0x1a49b0=[];_0x41720b[_0x6f68('0x40')](function(_0x3c0587){_0x1a49b0[_0x6f68('0x41')](checkTranscribeJob(_0x3c0587,_0x12c148,_0x18eb93));});return BPromise[_0x6f68('0x42')](_0x1a49b0);})[_0x6f68('0x32')](function(_0x5242f7){if(_0x5242f7){if(!_0x5242f7[_0x6f68('0x33')]||_0x5242f7['name']!==_0x6f68('0x43')){logger[_0x6f68('0x34')](util[_0x6f68('0x35')](_0x5242f7,{'showHidden':![],'depth':null}));}}});}exports[_0x6f68('0x44')]=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 bedcba4..6e11462 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dfc=['hopper1','hopper2','catch','util','../mysqldb','push','Innocenzo','now','Biondo','@xcally.com','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy'];(function(_0x2e0a25,_0x2da7a6){var _0x359873=function(_0x47fb4b){while(--_0x47fb4b){_0x2e0a25['push'](_0x2e0a25['shift']());}};_0x359873(++_0x2da7a6);}(_0x4dfc,0xdb));var _0xc4df=function(_0x7148b6,_0xa61534){_0x7148b6=_0x7148b6-0x0;var _0x111019=_0x4dfc[_0x7148b6];return _0x111019;};'use strict';var util=require(_0xc4df('0x0'));var db=require(_0xc4df('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc4df('0x2')]({'id':i,'firstName':_0xc4df('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc4df('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc4df('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc4df('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc4df('0x2')]({'id':i,'firstName':_0xc4df('0x3')+i,'lastName':_0xc4df('0x5')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc4df('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc4df('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc4df('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc4df('0x4')](),'updatedAt':Date['now']()});}db[_0xc4df('0x7')]['destroy']({'where':{}})[_0xc4df('0x8')](function(){return db[_0xc4df('0x7')][_0xc4df('0x9')](contacts);})[_0xc4df('0x8')](function(){console[_0xc4df('0xa')](_0xc4df('0xb'),_0xc4df('0xc'));return db[_0xc4df('0xd')][_0xc4df('0xe')]({'where':{}});})[_0xc4df('0x8')](function(){return db[_0xc4df('0xd')]['bulkCreate'](hopper);})[_0xc4df('0x8')](function(){console[_0xc4df('0xa')](_0xc4df('0xb'),_0xc4df('0xf'));return db[_0xc4df('0x7')][_0xc4df('0x9')](contacts2);})[_0xc4df('0x8')](function(){console[_0xc4df('0xa')](_0xc4df('0xb'),'contacts2');return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console[_0xc4df('0xa')](_0xc4df('0xb'),_0xc4df('0x10'));})[_0xc4df('0x11')](function(_0x3f74bf){console[_0xc4df('0xa')](_0x3f74bf);}); \ No newline at end of file +var _0x0b6e=['now','destroy','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0x0b6e,0x1e0));var _0xe0b6=function(_0x49652f,_0x1f44cf){_0x49652f=_0x49652f-0x0;var _0x44ab95=_0x0b6e[_0x49652f];return _0x44ab95;};'use strict';var util=require(_0xe0b6('0x0'));var db=require(_0xe0b6('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe0b6('0x2')]({'id':i,'firstName':_0xe0b6('0x3')+i,'lastName':_0xe0b6('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xe0b6('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xe0b6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe0b6('0x6')](),'updatedAt':Date[_0xe0b6('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xe0b6('0x3')+i,'lastName':_0xe0b6('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xe0b6('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xe0b6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe0b6('0x6')](),'updatedAt':Date[_0xe0b6('0x6')]()});}db['CmContact'][_0xe0b6('0x7')]({'where':{}})['then'](function(){return db[_0xe0b6('0x8')][_0xe0b6('0x9')](contacts);})[_0xe0b6('0xa')](function(){console[_0xe0b6('0xb')](_0xe0b6('0xc'),_0xe0b6('0xd'));return db[_0xe0b6('0xe')][_0xe0b6('0x7')]({'where':{}});})[_0xe0b6('0xa')](function(){return db[_0xe0b6('0xe')][_0xe0b6('0x9')](hopper);})['then'](function(){console['log'](_0xe0b6('0xc'),_0xe0b6('0xf'));return db[_0xe0b6('0x8')][_0xe0b6('0x9')](contacts2);})['then'](function(){console[_0xe0b6('0xb')]('finished\x20populating','contacts2');return db[_0xe0b6('0xe')]['bulkCreate'](hopper2);})['then'](function(){console['log']('finished\x20populating',_0xe0b6('0x10'));})[_0xe0b6('0x11')](function(_0x5e204a){console['log'](_0x5e204a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 72f375f..9217603 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x615d=['../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','add\x20user','catch','log'];(function(_0x3c30aa,_0x24c2b9){var _0x228198=function(_0xa6f556){while(--_0xa6f556){_0x3c30aa['push'](_0x3c30aa['shift']());}};_0x228198(++_0x24c2b9);}(_0x615d,0xbd));var _0xd615=function(_0x13f257,_0x3c3d67){_0x13f257=_0x13f257-0x0;var _0x455f37=_0x615d[_0x13f257];return _0x455f37;};'use strict';var util=require('util');var db=require(_0xd615('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd615('0x1')]({'name':util['format'](_0xd615('0x2'),_0xd615('0x3'),i),'fullname':util['format'](_0xd615('0x2'),_0xd615('0x3'),i),'email':util[_0xd615('0x4')](_0xd615('0x5'),'agent',i),'role':_0xd615('0x3'),'password':_0xd615('0x6'),'internal':0xfa0+i,'type':_0xd615('0x7'),'transport':[_0xd615('0x8'),'ws',_0xd615('0x9')],'disallow':[_0xd615('0xa')],'allow':[_0xd615('0xb')],'defaultuser':util[_0xd615('0x4')](_0xd615('0x2'),'agent',i),'encryption':_0xd615('0xc'),'avpf':_0xd615('0xc'),'force_avp':_0xd615('0xc'),'icesupport':_0xd615('0xc'),'dtlsenable':_0xd615('0xc'),'dtlsverify':'no','dtlscertfile':_0xd615('0xd'),'dtlsprivatekey':_0xd615('0xe'),'dtlssetup':_0xd615('0xf'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0xd615('0x2'),_0xd615('0x3'),i),0xfa0+i)});}db[_0xd615('0x10')][_0xd615('0x11')](users)['then'](function(){console['log'](_0xd615('0x12'));})[_0xd615('0x13')](function(_0x5b4c3a){console[_0xd615('0x14')](_0x5b4c3a);}); \ No newline at end of file +var _0xf1f9=['%s%s','%s%s@xcally.com','password','udp','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','agent','format'];(function(_0x14090e,_0x30c2f7){var _0x554da7=function(_0x165d16){while(--_0x165d16){_0x14090e['push'](_0x14090e['shift']());}};_0x554da7(++_0x30c2f7);}(_0xf1f9,0xcd));var _0x9f1f=function(_0x215ee7,_0x1ea789){_0x215ee7=_0x215ee7-0x0;var _0x2ce8e8=_0xf1f9[_0x215ee7];return _0x2ce8e8;};'use strict';var util=require(_0x9f1f('0x0'));var db=require(_0x9f1f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9f1f('0x2')]({'name':util['format']('%s%s',_0x9f1f('0x3'),i),'fullname':util[_0x9f1f('0x4')](_0x9f1f('0x5'),_0x9f1f('0x3'),i),'email':util[_0x9f1f('0x4')](_0x9f1f('0x6'),_0x9f1f('0x3'),i),'role':_0x9f1f('0x3'),'password':_0x9f1f('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x9f1f('0x8'),'ws','wss'],'disallow':['all'],'allow':[_0x9f1f('0x9')],'defaultuser':util[_0x9f1f('0x4')](_0x9f1f('0x5'),_0x9f1f('0x3'),i),'encryption':'yes','avpf':_0x9f1f('0xa'),'force_avp':_0x9f1f('0xa'),'icesupport':_0x9f1f('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x9f1f('0xb'),'dtlsprivatekey':_0x9f1f('0xc'),'dtlssetup':_0x9f1f('0xd'),'callerid':util[_0x9f1f('0x4')](_0x9f1f('0xe'),util['format'](_0x9f1f('0x5'),'agent',i),0xfa0+i)});}db[_0x9f1f('0xf')][_0x9f1f('0x10')](users)[_0x9f1f('0x11')](function(){console[_0x9f1f('0x12')](_0x9f1f('0x13'));})[_0x9f1f('0x14')](function(_0x27ce73){console[_0x9f1f('0x12')](_0x27ce73);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b3c17e9..d13905e 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x536f=['FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','type','format','%s:queue:%s','handshake','find','userProfileId','query','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','ChatQueue','SmsQueue','WhatsappQueues','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','Agents','User','name','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues'];(function(_0x5998aa,_0x44cbd0){var _0x2cbab6=function(_0x533c34){while(--_0x533c34){_0x5998aa['push'](_0x5998aa['shift']());}};_0x2cbab6(++_0x44cbd0);}(_0x536f,0x12b));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require(_0xf536('0x1'));var BPromise=require(_0xf536('0x2'));var db=require(_0xf536('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0xf536('0x4'),'model':db[_0xf536('0x5')],'attributes':['id',_0xf536('0x6'),_0xf536('0x7')],'raw':!![],'where':{'role':_0xf536('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xf536('0x6')],'where':{'role':_0xf536('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xf536('0x6')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xf536('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf536('0x6'),'type'],'where':{'type':_0xf536('0xa')}};function getAssociatedResources(_0x24ffb0,_0x187e72,_0x4fd285){return db[_0xf536('0xb')][_0xf536('0xc')]({'where':{'name':_0x24ffb0,'userProfileId':_0x187e72},'raw':!![]})[_0xf536('0xd')](function(_0x2d5708){if(_0x2d5708){if(_0x2d5708[_0xf536('0xe')]){switch(_0x24ffb0){case _0xf536('0xf'):case'ChatQueues':case _0xf536('0x10'):case _0xf536('0x11'):case _0xf536('0x12'):case _0xf536('0x13'):case'WhatsappQueues':return db[_0x4fd285][_0xf536('0x14')](queryQueues);case _0xf536('0x15'):return db[_0x4fd285][_0xf536('0x14')](queryTelephones);case _0xf536('0x16'):return db[_0x4fd285][_0xf536('0x14')](queryTrunks);case _0xf536('0x17'):return db[_0x4fd285][_0xf536('0x14')](queryCampaigns);}}else{return db[_0xf536('0x18')][_0xf536('0x14')]({'attributes':[_0xf536('0x19')],'where':{'sectionId':_0x2d5708['id']},'raw':!![]})[_0xf536('0xd')](function(_0x2ec62e){if(_0x2ec62e){var _0x326bdb={'where':{'id':_[_0xf536('0x1a')](_0x2ec62e,_0xf536('0x19'))},'raw':!![]};switch(_0x4fd285){case _0xf536('0x5'):_0x326bdb[_0xf536('0x1b')][_0xf536('0x7')]=_0xf536('0x9');break;case'Campaign':_0x326bdb[_0xf536('0x1b')][_0xf536('0x1c')]=_0xf536('0xa');break;}return db[_0x4fd285][_0xf536('0x14')](_0x326bdb);}else{return[];}});}}else{return[];}})[_0xf536('0xd')](function(_0xd7d2f2){return _0xd7d2f2;});}function joinOrLeaveQueues(_0x259be9,_0x214977,_0x3b8974,_0x4915fe){_0x259be9[_0x214977](util[_0xf536('0x1d')](_0xf536('0x1e'),_0x3b8974,_0x4915fe['name']));if(_0x4915fe[_0xf536('0x4')]){for(var _0x24c8a6=0x0;_0x24c8a6<_0x4915fe['Agents']['length'];_0x24c8a6+=0x1){_0x259be9[_0x214977](util[_0xf536('0x1d')]('user:%s',_0x4915fe[_0xf536('0x4')][_0x24c8a6][_0xf536('0x6')]));}}}function joinOrLeave(_0x138903,_0x3ea45f,_0x14e5c9){var _0x32aa25;if(_0x138903[_0xf536('0x1f')]['query']['id']){db[_0xf536('0x5')][_0xf536('0x20')]({'attributes':['id',_0xf536('0x6'),_0xf536('0x7'),_0xf536('0x21')],'where':{'id':_0x138903[_0xf536('0x1f')][_0xf536('0x22')]['id']},'include':[{'model':db[_0xf536('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf536('0x24')],'as':_0xf536('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xf536('0x26')],'as':_0xf536('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xf536('0x28')],'as':_0xf536('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xf536('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf536('0x2b')],'as':_0xf536('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xf536('0xd')](function(_0x2b2d05){if(_0x2b2d05){_0x32aa25=_0x2b2d05;_0x138903[_0x3ea45f](util[_0xf536('0x1d')](_0xf536('0x2d'),_0x2b2d05[_0xf536('0x6')]));var _0x1cc987=[];switch(_0x2b2d05[_0xf536('0x7')]){case _0xf536('0x2e'):_0x138903[_0x3ea45f](_0xf536('0x2f'));_0x138903[_0x3ea45f](_0xf536('0x30'));if(queryQueues[_0xf536('0x31')]('include')){delete queryQueues[_0xf536('0x32')];}_0x1cc987[_0xf536('0x33')](db[_0xf536('0x34')][_0xf536('0x14')](queryQueues));_0x1cc987[_0xf536('0x33')](db['ChatQueue'][_0xf536('0x14')](queryQueues));_0x1cc987[_0xf536('0x33')](db['FaxQueue'][_0xf536('0x14')](queryQueues));_0x1cc987[_0xf536('0x33')](db['SmsQueue'][_0xf536('0x14')](queryQueues));_0x1cc987[_0xf536('0x33')](db[_0xf536('0x35')][_0xf536('0x14')](queryQueues));_0x1cc987[_0xf536('0x33')](db[_0xf536('0x36')]['findAll'](queryQueues));_0x1cc987[_0xf536('0x33')](db[_0xf536('0x37')][_0xf536('0x14')](queryQueues));_0x1cc987[_0xf536('0x33')](db['User']['findAll'](queryTelephones));_0x1cc987[_0xf536('0x33')](db[_0xf536('0x38')][_0xf536('0x14')](queryTrunks));_0x1cc987['push'](db[_0xf536('0x39')][_0xf536('0x14')](queryCampaigns));_0x1cc987[_0xf536('0x33')](db[_0xf536('0x5')][_0xf536('0x14')](queryAgents));break;case _0xf536('0x3a'):_0x138903[_0x3ea45f](_0xf536('0x2f'));_0x138903[_0x3ea45f](_0xf536('0x30'));_0x1cc987[_0xf536('0x33')](getAssociatedResources(_0xf536('0xf'),_0x2b2d05[_0xf536('0x21')],'VoiceQueue'));_0x1cc987[_0xf536('0x33')](getAssociatedResources('ChatQueues',_0x2b2d05['userProfileId'],_0xf536('0x3b')));_0x1cc987[_0xf536('0x33')](getAssociatedResources(_0xf536('0x10'),_0x2b2d05[_0xf536('0x21')],'FaxQueue'));_0x1cc987['push'](getAssociatedResources(_0xf536('0x11'),_0x2b2d05[_0xf536('0x21')],_0xf536('0x3c')));_0x1cc987[_0xf536('0x33')](getAssociatedResources(_0xf536('0x12'),_0x2b2d05[_0xf536('0x21')],_0xf536('0x35')));_0x1cc987['push'](getAssociatedResources(_0xf536('0x13'),_0x2b2d05[_0xf536('0x21')],_0xf536('0x36')));_0x1cc987['push'](getAssociatedResources(_0xf536('0x3d'),_0x2b2d05['userProfileId'],'WhatsappQueue'));_0x1cc987['push'](getAssociatedResources('Telephones',_0x2b2d05[_0xf536('0x21')],_0xf536('0x5')));_0x1cc987['push'](getAssociatedResources(_0xf536('0x16'),_0x2b2d05['userProfileId'],_0xf536('0x38')));_0x1cc987[_0xf536('0x33')](getAssociatedResources(_0xf536('0x17'),_0x2b2d05[_0xf536('0x21')],_0xf536('0x39')));_0x1cc987[_0xf536('0x33')](db[_0xf536('0x5')][_0xf536('0x14')](queryAgents));break;case _0xf536('0x8'):_0x138903[_0x3ea45f]('voice:inbound');_0x138903[_0x3ea45f](_0xf536('0x30'));_0x1cc987[_0xf536('0x33')](_0x2b2d05[_0xf536('0x3e')]({'attributes':['id',_0xf536('0x6')]}));_0x1cc987[_0xf536('0x33')](_0x2b2d05['getChatQueues']({'attributes':['id','name']}));_0x1cc987[_0xf536('0x33')](_0x2b2d05[_0xf536('0x3f')]({'attributes':['id',_0xf536('0x6')]}));_0x1cc987[_0xf536('0x33')](_0x2b2d05[_0xf536('0x40')]({'attributes':['id',_0xf536('0x6')]}));_0x1cc987[_0xf536('0x33')](_0x2b2d05[_0xf536('0x41')]({'attributes':['id','name']}));_0x1cc987[_0xf536('0x33')](_0x2b2d05[_0xf536('0x42')]({'attributes':['id',_0xf536('0x6')]}));_0x1cc987['push'](_0x2b2d05[_0xf536('0x43')]({'attributes':['id','name']}));break;}return BPromise[_0xf536('0x44')](_0x1cc987);}})[_0xf536('0xd')](function(_0x4a161c){if(_0x4a161c&&_0x4a161c['length']){for(var _0x2ab459=0x0;_0x2ab459<_0x4a161c[_0xf536('0x45')];_0x2ab459+=0x1){for(var _0x2778fa=0x0;_0x2778fa<_0x4a161c[_0x2ab459][_0xf536('0x45')];_0x2778fa+=0x1){switch(_0x2ab459){case 0x0:joinOrLeaveQueues(_0x138903,_0x3ea45f,_0xf536('0x46'),_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x1:joinOrLeaveQueues(_0x138903,_0x3ea45f,'chat',_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x2:joinOrLeaveQueues(_0x138903,_0x3ea45f,_0xf536('0x47'),_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x3:joinOrLeaveQueues(_0x138903,_0x3ea45f,_0xf536('0x48'),_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x4:joinOrLeaveQueues(_0x138903,_0x3ea45f,_0xf536('0x49'),_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x5:joinOrLeaveQueues(_0x138903,_0x3ea45f,_0xf536('0x4a'),_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x6:joinOrLeaveQueues(_0x138903,_0x3ea45f,'whatsapp',_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x7:_0x138903[_0x3ea45f](util['format'](_0xf536('0x4b'),_0x4a161c[_0x2ab459][_0x2778fa][_0xf536('0x6')]));break;case 0x8:_0x138903[_0x3ea45f](util[_0xf536('0x1d')](_0xf536('0x4c'),_0x4a161c[_0x2ab459][_0x2778fa]['name']));break;case 0x9:_0x138903[_0x3ea45f](util[_0xf536('0x1d')](_0xf536('0x4d'),_0x4a161c[_0x2ab459][_0x2778fa]['type'],_0x4a161c[_0x2ab459][_0x2778fa][_0xf536('0x6')]));break;case 0xa:_0x138903[_0x3ea45f](util['format']('user:%s',_0x4a161c[_0x2ab459][_0x2778fa][_0xf536('0x6')]));break;}}}}})['then'](function(){if(_0x3ea45f==='leave'){var _0xb1812=_['map'](_0x32aa25['ChatInteractions'],'id');return _0x32aa25[_0xf536('0x4e')](_0xb1812)[_0xf536('0xd')](function(){for(var _0x50a080=0x0;_0x50a080<_0xb1812[_0xf536('0x45')];_0x50a080+=0x1){_0x14e5c9[_0xf536('0x4f')](_0xf536('0x50'),{'ChatInteractionId':Number(_0xb1812[_0x50a080]),'UserId':Number(_0x32aa25['id'])});}});}})[_0xf536('0xd')](function(){if(_0x3ea45f===_0xf536('0x51')){var _0x33cba5=_['map'](_0x32aa25[_0xf536('0x25')],'id');return _0x32aa25[_0xf536('0x52')](_0x33cba5)[_0xf536('0xd')](function(){for(var _0x3379b5=0x0;_0x3379b5<_0x33cba5[_0xf536('0x45')];_0x3379b5+=0x1){_0x14e5c9['emit'](_0xf536('0x53'),{'MailInteractionId':Number(_0x33cba5[_0x3379b5]),'UserId':Number(_0x32aa25['id'])});}});}})[_0xf536('0xd')](function(){if(_0x3ea45f===_0xf536('0x51')){var _0x105b31=_[_0xf536('0x1a')](_0x32aa25[_0xf536('0x27')],'id');return _0x32aa25['removeFaxInteractions'](_0x105b31)[_0xf536('0xd')](function(){for(var _0x566e38=0x0;_0x566e38<_0x105b31['length'];_0x566e38+=0x1){_0x14e5c9['emit'](_0xf536('0x54'),{'FaxInteractionId':Number(_0x105b31[_0x566e38]),'UserId':Number(_0x32aa25['id'])});}});}})['then'](function(){if(_0x3ea45f===_0xf536('0x51')){var _0x59fd1f=_['map'](_0x32aa25[_0xf536('0x29')],'id');return _0x32aa25[_0xf536('0x55')](_0x59fd1f)[_0xf536('0xd')](function(){for(var _0xd6c024=0x0;_0xd6c024<_0x59fd1f[_0xf536('0x45')];_0xd6c024+=0x1){_0x14e5c9[_0xf536('0x4f')](_0xf536('0x56'),{'SmsInteractionId':Number(_0x59fd1f[_0xd6c024]),'UserId':Number(_0x32aa25['id'])});}});}})[_0xf536('0xd')](function(){if(_0x3ea45f===_0xf536('0x51')){var _0x14b26e=_[_0xf536('0x1a')](_0x32aa25[_0xf536('0x57')],'id');return _0x32aa25[_0xf536('0x58')](_0x14b26e)[_0xf536('0xd')](function(){for(var _0x5a46f6=0x0;_0x5a46f6<_0x14b26e[_0xf536('0x45')];_0x5a46f6+=0x1){_0x14e5c9[_0xf536('0x4f')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x14b26e[_0x5a46f6]),'UserId':Number(_0x32aa25['id'])});}});}})[_0xf536('0xd')](function(){if(_0x3ea45f==='leave'){var _0x3d95af=_[_0xf536('0x1a')](_0x32aa25[_0xf536('0x2c')],'id');return _0x32aa25[_0xf536('0x59')](_0x3d95af)[_0xf536('0xd')](function(){for(var _0x1c6e70=0x0;_0x1c6e70<_0x3d95af[_0xf536('0x45')];_0x1c6e70+=0x1){_0x14e5c9[_0xf536('0x4f')](_0xf536('0x5a'),{'WhatsappInteractionId':Number(_0x3d95af[_0x1c6e70]),'UserId':Number(_0x32aa25['id'])});}});}})['catch'](function(_0x2d22a7){_0x138903['log'](_0x2d22a7);});}}function onDisconnect(_0x126783,_0x276c4a){joinOrLeave(_0x126783,_0xf536('0x51'),_0x276c4a);}function onConnect(_0x27010e){joinOrLeave(_0x27010e,_0xf536('0x5b'));}exports[_0xf536('0x5c')]=function(_0x1ae035){_0x1ae035['on'](_0xf536('0x5d'),function(_0x328acf){_0x328acf['setMaxListeners'](0x0);_0x328acf[_0xf536('0x5e')]=_0x328acf[_0xf536('0x5f')][_0xf536('0x5d')][_0xf536('0x60')]+':'+_0x328acf[_0xf536('0x5f')]['connection'][_0xf536('0x61')];_0x328acf[_0xf536('0x62')]=new Date();_0x328acf[_0xf536('0x63')]=function(_0xaadf05){console[_0xf536('0x63')](_0xf536('0x64')+_0x328acf[_0xf536('0x65')][_0xf536('0x6')]+'['+_0x328acf['address']+']',_0xaadf05);};_0x328acf['on'](_0xf536('0x66'),function(){onDisconnect(_0x328acf,_0x1ae035);_0x328acf[_0xf536('0x63')](_0xf536('0x67'));});onConnect(_0x328acf);_0x328acf['log'](_0xf536('0x68'));});}; \ No newline at end of file +var _0xc158=['MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','role','Campaign','handshake','query','find','userProfileId','ChatInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','format','admin','voice:inbound','voice:outbound','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','SmsQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues'];(function(_0xa6aed6,_0x203d83){var _0x440b5c=function(_0x329a70){while(--_0x329a70){_0xa6aed6['push'](_0xa6aed6['shift']());}};_0x440b5c(++_0x203d83);}(_0xc158,0x113));var _0x8c15=function(_0x1e3fac,_0x4fa3b0){_0x1e3fac=_0x1e3fac-0x0;var _0x5b753f=_0xc158[_0x1e3fac];return _0x5b753f;};'use strict';var _=require(_0x8c15('0x0'));var util=require(_0x8c15('0x1'));var BPromise=require(_0x8c15('0x2'));var db=require(_0x8c15('0x3'))['db'];var config=require(_0x8c15('0x4'));var queryQueues={'attributes':['id',_0x8c15('0x5')],'include':[{'as':_0x8c15('0x6'),'model':db[_0x8c15('0x7')],'attributes':['id',_0x8c15('0x5'),'role'],'raw':!![],'where':{'role':_0x8c15('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8c15('0x5')],'where':{'role':_0x8c15('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x8c15('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8c15('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8c15('0x5'),_0x8c15('0xa')],'where':{'type':_0x8c15('0xb')}};function getAssociatedResources(_0x97efc6,_0x350453,_0x2559c1){return db[_0x8c15('0xc')][_0x8c15('0xd')]({'where':{'name':_0x97efc6,'userProfileId':_0x350453},'raw':!![]})['then'](function(_0x61d4e1){if(_0x61d4e1){if(_0x61d4e1[_0x8c15('0xe')]){switch(_0x97efc6){case _0x8c15('0xf'):case _0x8c15('0x10'):case _0x8c15('0x11'):case _0x8c15('0x12'):case _0x8c15('0x13'):case _0x8c15('0x14'):case _0x8c15('0x15'):return db[_0x2559c1][_0x8c15('0x16')](queryQueues);case _0x8c15('0x17'):return db[_0x2559c1][_0x8c15('0x16')](queryTelephones);case _0x8c15('0x18'):return db[_0x2559c1][_0x8c15('0x16')](queryTrunks);case _0x8c15('0x19'):return db[_0x2559c1][_0x8c15('0x16')](queryCampaigns);}}else{return db[_0x8c15('0x1a')]['findAll']({'attributes':[_0x8c15('0x1b')],'where':{'sectionId':_0x61d4e1['id']},'raw':!![]})[_0x8c15('0x1c')](function(_0x44fffc){if(_0x44fffc){var _0x3b6ac6={'where':{'id':_[_0x8c15('0x1d')](_0x44fffc,'resourceId')},'raw':!![]};switch(_0x2559c1){case _0x8c15('0x7'):_0x3b6ac6[_0x8c15('0x1e')][_0x8c15('0x1f')]=_0x8c15('0x9');break;case _0x8c15('0x20'):_0x3b6ac6[_0x8c15('0x1e')][_0x8c15('0xa')]='ivr';break;}return db[_0x2559c1]['findAll'](_0x3b6ac6);}else{return[];}});}}else{return[];}})[_0x8c15('0x1c')](function(_0x113054){return _0x113054;});}function joinOrLeaveQueues(_0x19170c,_0xa18520,_0x3c2760,_0x4b4505){_0x19170c[_0xa18520](util['format']('%s:queue:%s',_0x3c2760,_0x4b4505['name']));if(_0x4b4505[_0x8c15('0x6')]){for(var _0x430a1f=0x0;_0x430a1f<_0x4b4505[_0x8c15('0x6')]['length'];_0x430a1f+=0x1){_0x19170c[_0xa18520](util['format']('user:%s',_0x4b4505['Agents'][_0x430a1f][_0x8c15('0x5')]));}}}function joinOrLeave(_0x3a3e8d,_0x56e4e6,_0x1dd399){var _0x512c4c;if(_0x3a3e8d[_0x8c15('0x21')][_0x8c15('0x22')]['id']){db[_0x8c15('0x7')][_0x8c15('0x23')]({'attributes':['id','name',_0x8c15('0x1f'),_0x8c15('0x24')],'where':{'id':_0x3a3e8d[_0x8c15('0x21')][_0x8c15('0x22')]['id']},'include':[{'model':db[_0x8c15('0x25')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x8c15('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x8c15('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x8c15('0x28')],'as':_0x8c15('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x8c15('0x2a')],'as':_0x8c15('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x8c15('0x2c')],'as':_0x8c15('0x2d'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x85fd05){if(_0x85fd05){_0x512c4c=_0x85fd05;_0x3a3e8d[_0x56e4e6](util[_0x8c15('0x2e')]('user:%s',_0x85fd05[_0x8c15('0x5')]));var _0x494079=[];switch(_0x85fd05[_0x8c15('0x1f')]){case _0x8c15('0x2f'):_0x3a3e8d[_0x56e4e6](_0x8c15('0x30'));_0x3a3e8d[_0x56e4e6](_0x8c15('0x31'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x494079[_0x8c15('0x32')](db[_0x8c15('0x33')][_0x8c15('0x16')](queryQueues));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x34')][_0x8c15('0x16')](queryQueues));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x35')][_0x8c15('0x16')](queryQueues));_0x494079['push'](db['SmsQueue'][_0x8c15('0x16')](queryQueues));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x36')][_0x8c15('0x16')](queryQueues));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x37')][_0x8c15('0x16')](queryQueues));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x38')][_0x8c15('0x16')](queryQueues));_0x494079['push'](db['User'][_0x8c15('0x16')](queryTelephones));_0x494079['push'](db[_0x8c15('0x39')]['findAll'](queryTrunks));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x20')]['findAll'](queryCampaigns));_0x494079['push'](db[_0x8c15('0x7')][_0x8c15('0x16')](queryAgents));break;case _0x8c15('0x3a'):_0x3a3e8d[_0x56e4e6](_0x8c15('0x30'));_0x3a3e8d[_0x56e4e6](_0x8c15('0x31'));_0x494079[_0x8c15('0x32')](getAssociatedResources(_0x8c15('0xf'),_0x85fd05['userProfileId'],_0x8c15('0x33')));_0x494079[_0x8c15('0x32')](getAssociatedResources('ChatQueues',_0x85fd05[_0x8c15('0x24')],_0x8c15('0x34')));_0x494079[_0x8c15('0x32')](getAssociatedResources(_0x8c15('0x11'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x35')));_0x494079[_0x8c15('0x32')](getAssociatedResources(_0x8c15('0x12'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x3b')));_0x494079[_0x8c15('0x32')](getAssociatedResources('MailQueues',_0x85fd05[_0x8c15('0x24')],_0x8c15('0x36')));_0x494079['push'](getAssociatedResources(_0x8c15('0x14'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x37')));_0x494079[_0x8c15('0x32')](getAssociatedResources(_0x8c15('0x15'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x38')));_0x494079[_0x8c15('0x32')](getAssociatedResources(_0x8c15('0x17'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x7')));_0x494079['push'](getAssociatedResources(_0x8c15('0x18'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x39')));_0x494079[_0x8c15('0x32')](getAssociatedResources(_0x8c15('0x19'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x20')));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x7')]['findAll'](queryAgents));break;case _0x8c15('0x8'):_0x3a3e8d[_0x56e4e6](_0x8c15('0x30'));_0x3a3e8d[_0x56e4e6](_0x8c15('0x31'));_0x494079['push'](_0x85fd05[_0x8c15('0x3c')]({'attributes':['id',_0x8c15('0x5')]}));_0x494079['push'](_0x85fd05[_0x8c15('0x3d')]({'attributes':['id','name']}));_0x494079[_0x8c15('0x32')](_0x85fd05[_0x8c15('0x3e')]({'attributes':['id',_0x8c15('0x5')]}));_0x494079[_0x8c15('0x32')](_0x85fd05[_0x8c15('0x3f')]({'attributes':['id','name']}));_0x494079['push'](_0x85fd05['getMailQueues']({'attributes':['id',_0x8c15('0x5')]}));_0x494079[_0x8c15('0x32')](_0x85fd05[_0x8c15('0x40')]({'attributes':['id',_0x8c15('0x5')]}));_0x494079[_0x8c15('0x32')](_0x85fd05[_0x8c15('0x41')]({'attributes':['id',_0x8c15('0x5')]}));break;}return BPromise['all'](_0x494079);}})['then'](function(_0x59f990){if(_0x59f990&&_0x59f990[_0x8c15('0x42')]){for(var _0x423dc7=0x0;_0x423dc7<_0x59f990[_0x8c15('0x42')];_0x423dc7+=0x1){for(var _0x1e324b=0x0;_0x1e324b<_0x59f990[_0x423dc7]['length'];_0x1e324b+=0x1){switch(_0x423dc7){case 0x0:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,_0x8c15('0x43'),_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x1:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,_0x8c15('0x44'),_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x2:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,_0x8c15('0x45'),_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x3:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,_0x8c15('0x46'),_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x4:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,_0x8c15('0x47'),_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x5:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,'openchannel',_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x6:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,_0x8c15('0x48'),_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x7:_0x3a3e8d[_0x56e4e6](util[_0x8c15('0x2e')](_0x8c15('0x49'),_0x59f990[_0x423dc7][_0x1e324b][_0x8c15('0x5')]));break;case 0x8:_0x3a3e8d[_0x56e4e6](util[_0x8c15('0x2e')](_0x8c15('0x4a'),_0x59f990[_0x423dc7][_0x1e324b]['name']));break;case 0x9:_0x3a3e8d[_0x56e4e6](util[_0x8c15('0x2e')](_0x8c15('0x4b'),_0x59f990[_0x423dc7][_0x1e324b][_0x8c15('0xa')],_0x59f990[_0x423dc7][_0x1e324b]['name']));break;case 0xa:_0x3a3e8d[_0x56e4e6](util[_0x8c15('0x2e')](_0x8c15('0x4c'),_0x59f990[_0x423dc7][_0x1e324b][_0x8c15('0x5')]));break;}}}}})[_0x8c15('0x1c')](function(){if(_0x56e4e6===_0x8c15('0x4d')){var _0x2f83ca=_[_0x8c15('0x1d')](_0x512c4c['ChatInteractions'],'id');return _0x512c4c[_0x8c15('0x4e')](_0x2f83ca)[_0x8c15('0x1c')](function(){for(var _0xe887b5=0x0;_0xe887b5<_0x2f83ca[_0x8c15('0x42')];_0xe887b5+=0x1){_0x1dd399[_0x8c15('0x4f')](_0x8c15('0x50'),{'ChatInteractionId':Number(_0x2f83ca[_0xe887b5]),'UserId':Number(_0x512c4c['id'])});}});}})['then'](function(){if(_0x56e4e6==='leave'){var _0x256e17=_[_0x8c15('0x1d')](_0x512c4c[_0x8c15('0x26')],'id');return _0x512c4c[_0x8c15('0x51')](_0x256e17)[_0x8c15('0x1c')](function(){for(var _0x1bdd6e=0x0;_0x1bdd6e<_0x256e17[_0x8c15('0x42')];_0x1bdd6e+=0x1){_0x1dd399['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x256e17[_0x1bdd6e]),'UserId':Number(_0x512c4c['id'])});}});}})[_0x8c15('0x1c')](function(){if(_0x56e4e6===_0x8c15('0x4d')){var _0x174255=_[_0x8c15('0x1d')](_0x512c4c['FaxInteractions'],'id');return _0x512c4c['removeFaxInteractions'](_0x174255)[_0x8c15('0x1c')](function(){for(var _0x3f0161=0x0;_0x3f0161<_0x174255[_0x8c15('0x42')];_0x3f0161+=0x1){_0x1dd399[_0x8c15('0x4f')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x174255[_0x3f0161]),'UserId':Number(_0x512c4c['id'])});}});}})[_0x8c15('0x1c')](function(){if(_0x56e4e6===_0x8c15('0x4d')){var _0xf97dc3=_[_0x8c15('0x1d')](_0x512c4c['SmsInteractions'],'id');return _0x512c4c['removeSmsInteractions'](_0xf97dc3)['then'](function(){for(var _0x436aa8=0x0;_0x436aa8<_0xf97dc3[_0x8c15('0x42')];_0x436aa8+=0x1){_0x1dd399[_0x8c15('0x4f')](_0x8c15('0x52'),{'SmsInteractionId':Number(_0xf97dc3[_0x436aa8]),'UserId':Number(_0x512c4c['id'])});}});}})['then'](function(){if(_0x56e4e6===_0x8c15('0x4d')){var _0x43f455=_['map'](_0x512c4c[_0x8c15('0x2b')],'id');return _0x512c4c[_0x8c15('0x53')](_0x43f455)[_0x8c15('0x1c')](function(){for(var _0xf6b540=0x0;_0xf6b540<_0x43f455[_0x8c15('0x42')];_0xf6b540+=0x1){_0x1dd399[_0x8c15('0x4f')](_0x8c15('0x54'),{'OpenchannelInteractionId':Number(_0x43f455[_0xf6b540]),'UserId':Number(_0x512c4c['id'])});}});}})[_0x8c15('0x1c')](function(){if(_0x56e4e6==='leave'){var _0x179fc9=_['map'](_0x512c4c[_0x8c15('0x2d')],'id');return _0x512c4c[_0x8c15('0x55')](_0x179fc9)[_0x8c15('0x1c')](function(){for(var _0x29df21=0x0;_0x29df21<_0x179fc9[_0x8c15('0x42')];_0x29df21+=0x1){_0x1dd399['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x179fc9[_0x29df21]),'UserId':Number(_0x512c4c['id'])});}});}})[_0x8c15('0x56')](function(_0x1ae1e3){_0x3a3e8d[_0x8c15('0x57')](_0x1ae1e3);});}}function onDisconnect(_0x49af26,_0x49dfd9){joinOrLeave(_0x49af26,_0x8c15('0x4d'),_0x49dfd9);}function onConnect(_0x1c62fe){joinOrLeave(_0x1c62fe,'join');}exports[_0x8c15('0x58')]=function(_0x2608b){_0x2608b['on'](_0x8c15('0x59'),function(_0x395479){_0x395479[_0x8c15('0x5a')](0x0);_0x395479[_0x8c15('0x5b')]=_0x395479[_0x8c15('0x5c')][_0x8c15('0x59')][_0x8c15('0x5d')]+':'+_0x395479[_0x8c15('0x5c')][_0x8c15('0x59')]['remotePort'];_0x395479[_0x8c15('0x5e')]=new Date();_0x395479[_0x8c15('0x57')]=function(_0x480a4e){console[_0x8c15('0x57')](_0x8c15('0x5f')+_0x395479['nsp'][_0x8c15('0x5')]+'['+_0x395479[_0x8c15('0x5b')]+']',_0x480a4e);};_0x395479['on']('disconnect',function(){onDisconnect(_0x395479,_0x2608b);_0x395479[_0x8c15('0x57')](_0x8c15('0x60'));});onConnect(_0x395479);_0x395479[_0x8c15('0x57')](_0x8c15('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index d0f7044..79fc4b9 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 _0xa508=['model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','ChatInteraction','afterUpdate','closedinteraction','afterCreate','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','newinteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','then','info','error','Trigger,\x20%s','get','channel','direction','UserId','User','find','name','SIP/%s','incomingmessage','catch','outgoingmessage','event','opened','changed','closed','interface','format','length','hasOwnProperty'];(function(_0xa327e0,_0x384f8c){var _0x48f5fe=function(_0x319758){while(--_0x319758){_0xa327e0['push'](_0xa327e0['shift']());}};_0x48f5fe(++_0x384f8c);}(_0xa508,0x77));var _0x8a50=function(_0x526528,_0x13125f){_0x526528=_0x526528-0x0;var _0x40b576=_0xa508[_0x526528];return _0x40b576;};'use strict';var util=require(_0x8a50('0x0'));var db=require(_0x8a50('0x1'))['db'];var jayson=require(_0x8a50('0x2'));var logger=require(_0x8a50('0x3'))(_0x8a50('0x4'));var client=jayson[_0x8a50('0x5')]['http']({'port':0x232a});var triggers=[{'channel':_0x8a50('0x6'),'model':_0x8a50('0x7'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x8a50('0x6'),'model':_0x8a50('0x7'),'event':_0x8a50('0x8'),'condition':_0x8a50('0x9'),'callback':afterUpdate},{'channel':_0x8a50('0x6'),'model':'ChatMessage','event':_0x8a50('0xa'),'condition':_0x8a50('0xb'),'callback':afterCreateMessage},{'channel':_0x8a50('0xc'),'model':_0x8a50('0xd'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0x8a50('0xd'),'event':_0x8a50('0x8'),'condition':_0x8a50('0x9'),'callback':afterUpdate},{'channel':_0x8a50('0xc'),'model':_0x8a50('0xe'),'event':_0x8a50('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8a50('0xf'),'model':_0x8a50('0x10'),'event':_0x8a50('0xa'),'condition':_0x8a50('0x11'),'callback':afterCreate},{'channel':_0x8a50('0xf'),'model':_0x8a50('0x10'),'event':'afterUpdate','condition':_0x8a50('0x9'),'callback':afterUpdate},{'channel':_0x8a50('0xf'),'model':_0x8a50('0x12'),'event':_0x8a50('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8a50('0x13'),'model':_0x8a50('0x14'),'event':_0x8a50('0xa'),'condition':_0x8a50('0x11'),'callback':afterCreate},{'channel':'Fax','model':_0x8a50('0x14'),'event':'afterUpdate','condition':_0x8a50('0x9'),'callback':afterUpdate},{'channel':_0x8a50('0x13'),'model':_0x8a50('0x15'),'event':_0x8a50('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8a50('0x16'),'model':_0x8a50('0x17'),'event':_0x8a50('0xa'),'condition':_0x8a50('0x11'),'callback':afterCreate},{'channel':_0x8a50('0x16'),'model':_0x8a50('0x17'),'event':_0x8a50('0x8'),'condition':_0x8a50('0x9'),'callback':afterUpdate},{'channel':'Mail','model':_0x8a50('0x18'),'event':_0x8a50('0xa'),'condition':_0x8a50('0xb'),'callback':afterCreateMessage},{'channel':_0x8a50('0x19'),'model':'OpenchannelInteraction','event':_0x8a50('0xa'),'condition':_0x8a50('0x11'),'callback':afterCreate},{'channel':_0x8a50('0x19'),'model':_0x8a50('0x1a'),'event':'afterUpdate','condition':_0x8a50('0x9'),'callback':afterUpdate},{'channel':_0x8a50('0x19'),'model':'OpenchannelMessage','event':_0x8a50('0xa'),'condition':_0x8a50('0xb'),'callback':afterCreateMessage}];function request(_0x541074){return client[_0x8a50('0x1b')](_0x8a50('0x1c'),_0x541074)[_0x8a50('0x1d')](function(_0x59487e){logger[_0x8a50('0x1e')]('Trigger,\x20%s','EventManager',_0x59487e);if(_0x59487e[_0x8a50('0x1f')]){if(_0x59487e[_0x8a50('0x1f')]['code']===0x1f4){logger['error'](_0x8a50('0x20'),_0x8a50('0x1c'),_0x59487e[_0x8a50('0x1f')]);}}})['catch'](function(_0xa01a46){logger[_0x8a50('0x1f')](_0x8a50('0x20'),_0x8a50('0x1c'),_0xa01a46);});}function afterCreateMessage(_0x5303d3,_0x5bd34a){return function(_0x1c044a,_0xdd8860){_0x1c044a=_0x1c044a[_0x8a50('0x21')]({'plain':!![]});_0x1c044a[_0x8a50('0x22')]=_0x5303d3;_0x1c044a['event']=_0x1c044a[_0x8a50('0x23')];if(_0x1c044a[_0x8a50('0x24')]){return db[_0x8a50('0x25')][_0x8a50('0x26')]({'where':{'id':_0x1c044a[_0x8a50('0x24')]},'attributes':['id',_0x8a50('0x27')],'raw':!![]})[_0x8a50('0x1d')](function(_0x3ba61a){_0x1c044a['interface']=util['format'](_0x8a50('0x28'),_0x3ba61a[_0x8a50('0x27')]);_0x1c044a[_0x8a50('0x22')]=_0x5303d3;return request({'event':_0x8a50('0x29'),'message':_0x1c044a});})[_0x8a50('0x2a')](function(_0x2122d0){console[_0x8a50('0x1f')](_0x2122d0);});}else{return request({'event':_0x8a50('0x2b'),'message':_0x1c044a});}};}function afterCreate(_0x5e1576,_0x290df3){return function(_0x59d3db,_0x280958){_0x59d3db=_0x59d3db['get']({'plain':!![]});_0x59d3db[_0x8a50('0x22')]=_0x5e1576;_0x59d3db[_0x8a50('0x2c')]=_0x8a50('0x2d');return request({'event':_0x290df3,'message':_0x59d3db});};}function afterUpdate(_0x1b266a,_0x1439f9){return function(_0x2c2004,_0x55714c){if(_0x2c2004[_0x8a50('0x2e')](_0x8a50('0x2f'))&&_0x2c2004[_0x8a50('0x2f')]){_0x2c2004=_0x2c2004[_0x8a50('0x21')]({'plain':!![]});_0x2c2004['channel']=_0x1b266a;_0x2c2004[_0x8a50('0x2c')]=_0x8a50('0x2f');if(_0x2c2004[_0x8a50('0x24')]){return db[_0x8a50('0x25')][_0x8a50('0x26')]({'where':{'id':_0x2c2004[_0x8a50('0x24')]},'attributes':['id',_0x8a50('0x27')],'raw':!![]})[_0x8a50('0x1d')](function(_0x5523f6){_0x2c2004[_0x8a50('0x30')]=util[_0x8a50('0x31')](_0x8a50('0x28'),_0x5523f6['name']);return request({'event':_0x1439f9,'message':_0x2c2004});})[_0x8a50('0x2a')](function(_0x9f1e12){console[_0x8a50('0x1f')](_0x9f1e12);});}else{return request({'event':_0x1439f9,'message':_0x2c2004});}}};}exports['default']=function(){for(var _0x11d66e=0x0;_0x11d66e=_0x44ed67['agents']){throw Error(_0xd79c('0x13'));}_0x1effb5(_0x5f09e7);})[_0xd79c('0x14')](function(_0x19dac7){_0x3855ca(_0x19dac7);});});}; \ No newline at end of file +var _0xef8a=['then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util','voice','mail','fax','sms','whatsapp','openchannel','isValidChannel','includes','isUndefined','blockedAt','getLicense','role','agent','User','count'];(function(_0x519f3b,_0x2b2ccf){var _0x198cdc=function(_0x1964eb){while(--_0x1964eb){_0x519f3b['push'](_0x519f3b['shift']());}};_0x198cdc(++_0x2b2ccf);}(_0xef8a,0xb4));var _0xaef8=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xef8a[_0x279d37];return _0x530173;};'use strict';var _=require(_0xaef8('0x0'));var BPromise=require(_0xaef8('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xaef8('0x2'));var channels=[_0xaef8('0x3'),_0xaef8('0x4'),'chat',_0xaef8('0x5'),_0xaef8('0x6'),_0xaef8('0x7'),_0xaef8('0x8')];exports['getChannels']=function(){return channels;};exports[_0xaef8('0x9')]=function(_0x248029){_0x248029=_0x248029['toLowerCase']();return _[_0xaef8('0xa')](channels,_0x248029);};exports['clearBlockUser']=function(_0x30251a,_0x3c27da,_0x28360a,_0x491f5b){var _0x38acd0={'loginAttempts':_0x3c27da,'blocked':_0x28360a};if(!_[_0xaef8('0xb')](_0x491f5b)){_0x38acd0[_0xaef8('0xc')]=_0x491f5b;}return _0x30251a['updateAttributes'](_0x38acd0);};exports[_0xaef8('0xd')]=function(_0x1b0a69){return new BPromise(function(_0x5b1802,_0x321020){var _0x271bce=0x0;if(_0x1b0a69[_0xaef8('0xe')]!==_0xaef8('0xf')){_0x5b1802(_0x1b0a69);}db[_0xaef8('0x10')][_0xaef8('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1b0a69['id']}}})['then'](function(_0x5cdab5){_0x271bce=_0x5cdab5;return util['getLicense']();})[_0xaef8('0x12')](function(_0x28733f){if(_0x28733f&&_0x28733f[_0xaef8('0x13')]&&_0x271bce>=_0x28733f['agents']){throw Error(_0xaef8('0x14'));}_0x5b1802(_0x1b0a69);})[_0xaef8('0x15')](function(_0x441779){_0x321020(_0x441779);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 52d16f7..a2a4789 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d51=['404','status','send'];(function(_0x39aae5,_0xfd2f27){var _0x266f9f=function(_0xe3e842){while(--_0xe3e842){_0x39aae5['push'](_0x39aae5['shift']());}};_0x266f9f(++_0xfd2f27);}(_0x1d51,0x183));var _0x11d5=function(_0x5cb1f0,_0x2d61f6){_0x5cb1f0=_0x5cb1f0-0x0;var _0x28c2fe=_0x1d51[_0x5cb1f0];return _0x28c2fe;};'use strict';module['exports'][0x194]=function pageNotFound(_0x3fe7b9,_0x1f82f6){var _0x32f0b0=_0x11d5('0x0');var _0x5b54f3=0x194;var _0x32c88b={'status':_0x5b54f3};_0x1f82f6[_0x11d5('0x1')](_0x32c88b[_0x11d5('0x1')]);_0x1f82f6['render'](_0x32f0b0,{},function(_0x15708d,_0x565071){if(_0x15708d){return _0x1f82f6[_0x11d5('0x1')](_0x32c88b[_0x11d5('0x1')])['json'](_0x32c88b);}_0x1f82f6[_0x11d5('0x2')](_0x565071);});}; \ No newline at end of file +var _0xf68d=['status','render','json','exports'];(function(_0x26fde2,_0x2fda50){var _0x54e3ed=function(_0x54f8cb){while(--_0x54f8cb){_0x26fde2['push'](_0x26fde2['shift']());}};_0x54e3ed(++_0x2fda50);}(_0xf68d,0xff));var _0xdf68=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xf68d[_0x33032e];return _0x13316b;};'use strict';module[_0xdf68('0x0')][0x194]=function pageNotFound(_0x2a3a48,_0x4b6cf6){var _0x1ffb35='404';var _0xeabb00=0x194;var _0x342ecd={'status':_0xeabb00};_0x4b6cf6[_0xdf68('0x1')](_0x342ecd[_0xdf68('0x1')]);_0x4b6cf6[_0xdf68('0x2')](_0x1ffb35,{},function(_0x1e9ff3,_0x1fa398){if(_0x1e9ff3){return _0x4b6cf6[_0xdf68('0x1')](_0x342ecd[_0xdf68('0x1')])[_0xdf68('0x3')](_0x342ecd);}_0x4b6cf6['send'](_0x1fa398);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 0382212..44136b2 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a9f=['All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Intervals','MailApplications','ChatApplications','FaxApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','AnyCondition','TriggerAnyId','Actions','TriggerId','AnalyticCustomReport','Fields','AnalyticDefaultReport','AnalyticFieldReport','AnalyticMetric','MetricId','AccountId','SubjectId','DescriptionId','FieldId','Subject','Description','Field','VariableId','Subjects','DeskAccount','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','Descriptions','ZendeskAccount','int_zendesk_configuration_has_tags','Configurations','VtigerAccount','FreshsalesAccount','FreshsalesField','FromId','SessionId','ProjectId','user_has_teams','VoiceQueues','SmsQueues','team_has_whatsapp_queues','WhatsappQueues','HopperBlacks','TrunkId','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAccount','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSection','UserProfileSections','WhatsappAccountId','WhatsappApplication','WhatsappMessage','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','../config/environment','sequelize','determine','defaultsDeep','127.0.0.1','mysql','name','utf8_general_ci','sequelizeHistory','motion2','xcall','utf8mb4','utf8','database','username','options','password','User','../api/user/user.model','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.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/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','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','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','hasMany','Recordings','Extensions','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','ChatInteraction','ChatInteractions','user_has_sms_interactions','VoiceQueue','MailQueues','UserMailQueue','ChatQueue','ChatQueues','UserChatQueue','FaxQueues','OpenchannelQueue','OpenchannelQueues','UserOpenchannelQueue','VoicePrefix','user_has_voice_prefixes','ChatWebsite','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sound','moh_has_sounds','UserVoiceQueueRt','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','Contact','ContactId','MailAccountId','Smtp','Disposition','Answers','MailMessage','Messages','Interactions','List','ListId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','restrict','TagId','Items','Dispositions','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsApplication','SmsInteractionId','Owner','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelAccount','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatWebsiteId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','HopperFinals','Company','cm_contact_has_tags','CampaignId'];(function(_0x29a3df,_0x442bf5){var _0x5793f7=function(_0x133c8d){while(--_0x133c8d){_0x29a3df['push'](_0x29a3df['shift']());}};_0x5793f7(++_0x442bf5);}(_0x0a9f,0x64));var _0xf0a9=function(_0x26bb3f,_0x25cd1f){_0x26bb3f=_0x26bb3f-0x0;var _0x2cbd3f=_0x0a9f[_0x26bb3f];return _0x2cbd3f;};'use strict';var path=require('path');var config=require(_0xf0a9('0x0'));var Sequelize=require(_0xf0a9('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0xf0a9('0x2')]();config['sequelize']=_[_0xf0a9('0x3')](config['sequelize'],{'database':'motion2','username':'xcall','password':'xC@LL1234','options':{'host':_0xf0a9('0x4'),'port':0xcea,'dialect':_0xf0a9('0x5'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xf0a9('0x6')](),'define':{'charset':'utf8','collate':_0xf0a9('0x7')}}});config[_0xf0a9('0x8')]=_['defaultsDeep'](config[_0xf0a9('0x8')],{'database':_0xf0a9('0x9'),'username':_0xf0a9('0xa'),'password':'xC@LL1234','options':{'host':_0xf0a9('0x4'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xf0a9('0xb')},'logging':![],'timezone':timezone[_0xf0a9('0x6')](),'define':{'charset':_0xf0a9('0xc'),'collate':_0xf0a9('0x7')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xf0a9('0xd')],config[_0xf0a9('0x1')][_0xf0a9('0xe')],config[_0xf0a9('0x1')]['password'],config['sequelize'][_0xf0a9('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf0a9('0x8')][_0xf0a9('0xd')],config[_0xf0a9('0x8')][_0xf0a9('0xe')],config[_0xf0a9('0x8')][_0xf0a9('0x10')],config['sequelizeHistory'][_0xf0a9('0xf')])};db[_0xf0a9('0x11')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x12'));db['VoiceChanSpy']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x14'));db[_0xf0a9('0x15')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x16'));db[_0xf0a9('0x17')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x18'));db[_0xf0a9('0x19')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x1a'));db['VoiceQueue']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0xf0a9('0x1b')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0xf0a9('0x1c')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x1d'));db[_0xf0a9('0x1e')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x1f'));db[_0xf0a9('0x20')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x21'));db[_0xf0a9('0x22')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x23'));db['VoiceAgentReport']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x24'));db[_0xf0a9('0x25')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x26'));db['MemberReport']=db['sequelize']['import']('../api/memberReport/memberReport.model');db[_0xf0a9('0x27')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/trunk/trunk.model');db[_0xf0a9('0x28')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x29'));db['UserVoiceQueueRt']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x2a'));db[_0xf0a9('0x2b')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db['sequelize']['import'](_0xf0a9('0x2c'));db['UserMailQueue']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x2d'));db[_0xf0a9('0x2e')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x2f'));db[_0xf0a9('0x30')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x31'));db['UserOpenchannelQueue']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x32'));db[_0xf0a9('0x33')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xf0a9('0x34')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x35'));db[_0xf0a9('0x36')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x37'));db[_0xf0a9('0x38')]=db[_0xf0a9('0x1')]['import']('../api/mailAccount/mailAccount.model');db[_0xf0a9('0x39')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x3a'));db[_0xf0a9('0x3b')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x3c'));db[_0xf0a9('0x3d')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x3e'));db[_0xf0a9('0x3f')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/mailApplication/mailApplication.model');db[_0xf0a9('0x40')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x41'));db[_0xf0a9('0x42')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x43'));db[_0xf0a9('0x44')]=db[_0xf0a9('0x1')]['import']('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x45'));db[_0xf0a9('0x46')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x47'));db[_0xf0a9('0x48')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x49'));db[_0xf0a9('0x4a')]=db['sequelize']['import'](_0xf0a9('0x4b'));db[_0xf0a9('0x4c')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/faxQueue/faxQueue.model');db[_0xf0a9('0x4d')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x4e'));db[_0xf0a9('0x4f')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x50'));db['SmsApplication']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x51'));db[_0xf0a9('0x52')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x53'));db[_0xf0a9('0x54')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x55'));db['OpenchannelAccount']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x56'));db[_0xf0a9('0x57')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x58'));db[_0xf0a9('0x59')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x5a'));db[_0xf0a9('0x5b')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x5c'));db['OpenchannelQueue']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x5d'));db['ChatWebsite']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x5e'));db[_0xf0a9('0x5f')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x60'));db[_0xf0a9('0x61')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x62'));db['ChatInteraction']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x63'));db[_0xf0a9('0x64')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x65'));db[_0xf0a9('0x66')]=db['sequelize']['import'](_0xf0a9('0x67'));db['ChatQueue']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x68'));db[_0xf0a9('0x69')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x6a'));db['CmCompany']=db[_0xf0a9('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0xf0a9('0x6b')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x6c'));db[_0xf0a9('0x6d')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x6e'));db[_0xf0a9('0x6f')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x70'));db[_0xf0a9('0x71')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x72'));db[_0xf0a9('0x73')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x74'));db[_0xf0a9('0x75')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x76'));db[_0xf0a9('0x77')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x78'));db[_0xf0a9('0x79')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x7a'));db[_0xf0a9('0x7b')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x7c'));db['Disposition']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x7d'));db[_0xf0a9('0x7e')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/condition/condition.model');db[_0xf0a9('0x7f')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x80'));db[_0xf0a9('0x81')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x82'));db[_0xf0a9('0x83')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x84'));db['VoiceQueuesLog']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x85'));db['Schedule']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x86'));db['Sound']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x87'));db[_0xf0a9('0x88')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x89'));db[_0xf0a9('0x8a')]=db[_0xf0a9('0x1')]['import']('../api/template/template.model');db[_0xf0a9('0x8b')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/trigger/trigger.model');db[_0xf0a9('0x8c')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x8d'));db[_0xf0a9('0x8e')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x8f'));db[_0xf0a9('0x90')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x91'));db['AnalyticCustomReport']=db['sequelize'][_0xf0a9('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xf0a9('0x92')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x93'));db['AnalyticMetric']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x94'));db['AnalyticFieldReport']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x95'));db[_0xf0a9('0x96')]=db['sequelize']['import'](_0xf0a9('0x97'));db[_0xf0a9('0x98')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x99'));db[_0xf0a9('0x9a')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xf0a9('0x9b')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0xf0a9('0x9c')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x9d'));db[_0xf0a9('0x9e')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x9f'));db[_0xf0a9('0xa0')]=db['sequelize']['import'](_0xf0a9('0xa1'));db['DeskAccount']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0xa2'));db['DeskConfiguration']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xa3'));db['ZohoConfiguration']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xa4'));db[_0xf0a9('0xa5')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xa6'));db['ZendeskAccount']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0xa7'));db[_0xf0a9('0xa8')]=db['sequelize']['import'](_0xf0a9('0xa9'));db[_0xf0a9('0xaa')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xab'));db[_0xf0a9('0xac')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xf0a9('0xad')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xf0a9('0xae')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xaf'));db['VtigerAccount']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xb0'));db[_0xf0a9('0xb1')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xb2'));db[_0xf0a9('0xb3')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xb4'));db[_0xf0a9('0xb5')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0xb6'));db[_0xf0a9('0xb7')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xb8'));db[_0xf0a9('0xb9')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0xf0a9('0xba')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xbb'));db[_0xf0a9('0xbc')]=db[_0xf0a9('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xf0a9('0xbd')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xbe'));db['FreshsalesAccount']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xf0a9('0xbf')]=db['sequelize'][_0xf0a9('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xc0'));db['Integration']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x8f'));db[_0xf0a9('0xc1')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xc2'));db[_0xf0a9('0xc3')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xc4'));db[_0xf0a9('0xc5')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xc6'));db[_0xf0a9('0xc7')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xf0a9('0xc8')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xf0a9('0xc9')]=db['sequelize']['import'](_0xf0a9('0xca'));db[_0xf0a9('0xcb')]=db[_0xf0a9('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xcc'));db[_0xf0a9('0xcd')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0xce'));db[_0xf0a9('0xcf')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xd0'));db['Setting']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0xd1'));db[_0xf0a9('0xd2')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0xf0a9('0xd3')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/squareProject/squareProject.model');db[_0xf0a9('0xd4')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xd5'));db['SquareMessage']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xd6'));db[_0xf0a9('0xd7')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xd8'));db['License']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xd9'));db[_0xf0a9('0xda')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/campaign/campaign.model');db[_0xf0a9('0xdb')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/migration/migration.model');db[_0xf0a9('0xdc')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xdd'));db[_0xf0a9('0xde')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xdf'));db[_0xf0a9('0xe0')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xe1'));db['ChatTransferReport']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xe2'));db[_0xf0a9('0xe3')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xe4'));db[_0xf0a9('0xe5')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0xf0a9('0xe6')]=db['sequelize']['import'](_0xf0a9('0xe7'));db['VoicePrefix']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xe8'));db[_0xf0a9('0xe9')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xea'));db['UserProfileSection']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xeb'));db[_0xf0a9('0xec')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xed'));db[_0xf0a9('0xee')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xef'));db[_0xf0a9('0xf0')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xf1'));db['WhatsappApplication']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xf2'));db[_0xf0a9('0xf3')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xf4'));db['WhatsappMessage']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xf5'));db[_0xf0a9('0xf6')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xf7'));db[_0xf0a9('0xf8')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xf9'));db[_0xf0a9('0xfa')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xfb'));db[_0xf0a9('0xfc')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xfd'));db[_0xf0a9('0x11')][_0xf0a9('0xfe')](db['VoiceMail'],{'as':_0xf0a9('0x1e'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db[_0xf0a9('0x1b')],{'as':_0xf0a9('0x102'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db['VoiceExtension'],{'as':_0xf0a9('0x103'),'onDelete':_0xf0a9('0xff'),'hooks':!![]});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db[_0xf0a9('0x71')],{'as':'HopperFinals','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db[_0xf0a9('0x73')],{'as':'HopperHistory','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xf0a9('0x100')});db['User'][_0xf0a9('0x101')](db[_0xf0a9('0x59')],{'as':_0xf0a9('0x104'),'foreignKey':_0xf0a9('0x100')});db['User'][_0xf0a9('0x101')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db['SmsInteraction'],{'as':_0xf0a9('0x105'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')]['hasMany'](db[_0xf0a9('0x48')],{'as':_0xf0a9('0x106'),'foreignKey':'UserId'});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db['MailInteraction'],{'as':_0xf0a9('0x107'),'foreignKey':'UserId'});db[_0xf0a9('0x11')]['hasMany'](db[_0xf0a9('0xf3')],{'as':_0xf0a9('0x108'),'foreignKey':'UserId'});db[_0xf0a9('0x11')]['hasMany'](db['Notification'],{'as':_0xf0a9('0x109'),'foreignKey':_0xf0a9('0x10a')});db[_0xf0a9('0x11')][_0xf0a9('0x10b')](db[_0xf0a9('0xe9')],{'as':_0xf0a9('0xe9'),'foreignKey':_0xf0a9('0x10c')});db['User'][_0xf0a9('0x10d')](db[_0xf0a9('0x10e')],{'as':'Groups','through':_0xf0a9('0x10f')});db['User'][_0xf0a9('0x10d')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x110'),'through':_0xf0a9('0x111')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db['CmList'],{'as':_0xf0a9('0x112'),'through':_0xf0a9('0x113')});db['User'][_0xf0a9('0x10d')](db['Team'],{'through':'user_has_teams'});db[_0xf0a9('0x11')]['belongsToMany'](db[_0xf0a9('0x3d')],{'as':'MailInteractions','through':_0xf0a9('0x114')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x115')],{'as':_0xf0a9('0x116'),'through':'user_has_chat_interactions'});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x48')],{'as':_0xf0a9('0x106'),'through':'user_has_fax_interactions'});db[_0xf0a9('0x11')]['belongsToMany'](db['SmsInteraction'],{'as':_0xf0a9('0x105'),'through':_0xf0a9('0x117')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x59')],{'as':_0xf0a9('0x104'),'through':'user_has_openchannel_interactions'});db['User'][_0xf0a9('0x10d')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x118')],{'as':'VoiceQueues','through':_0xf0a9('0x2b'),'required':![]});db[_0xf0a9('0x11')]['belongsToMany'](db[_0xf0a9('0x39')],{'as':_0xf0a9('0x119'),'through':_0xf0a9('0x11a'),'required':![]});db['User'][_0xf0a9('0x10d')](db[_0xf0a9('0x11b')],{'as':_0xf0a9('0x11c'),'through':_0xf0a9('0x11d'),'required':![],'hooks':!![]});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x4c')],{'as':_0xf0a9('0x11e'),'through':'UserFaxQueue','required':![]});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x54')],{'as':'SmsQueues','through':_0xf0a9('0x30'),'required':![]});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x11f')],{'as':_0xf0a9('0x120'),'through':_0xf0a9('0x121'),'required':![]});db['User']['belongsToMany'](db[_0xf0a9('0xfa')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0xf0a9('0x11')]['belongsToMany'](db[_0xf0a9('0xe6')],{'through':'cm_user_has_lists'});db['User'][_0xf0a9('0x10d')](db[_0xf0a9('0x122')],{'as':'VoicePrefixes','through':_0xf0a9('0x123'),'required':![]});db['User'][_0xf0a9('0x10d')](db[_0xf0a9('0x124')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0xf0a9('0x11')]['belongsToMany'](db[_0xf0a9('0x125')],{'as':_0xf0a9('0x126'),'through':_0xf0a9('0x127')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db['MailAccount'],{'as':_0xf0a9('0x128'),'through':_0xf0a9('0x129')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0xf0a9('0x12a')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x4f')],{'as':_0xf0a9('0x12b'),'through':_0xf0a9('0x12c')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0xf0')],{'as':_0xf0a9('0x12d'),'through':_0xf0a9('0x12e')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db['SquareProject'],{'as':_0xf0a9('0x12f'),'through':_0xf0a9('0x130')});db[_0xf0a9('0x131')][_0xf0a9('0x101')](db[_0xf0a9('0x17')],{'as':_0xf0a9('0x132'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x133')});db[_0xf0a9('0x15')][_0xf0a9('0x101')](db[_0xf0a9('0x17')],{'onDelete':'cascade'});db[_0xf0a9('0x17')][_0xf0a9('0x101')](db[_0xf0a9('0x17')],{'as':_0xf0a9('0x134'),'onDelete':'cascade'});db[_0xf0a9('0x19')][_0xf0a9('0x10d')](db[_0xf0a9('0x135')],{'as':'Sounds','through':_0xf0a9('0x136')});db[_0xf0a9('0x118')][_0xf0a9('0x101')](db[_0xf0a9('0x137')],{'as':'Members','foreignKey':_0xf0a9('0x138')});db[_0xf0a9('0x118')]['hasMany'](db['CmHopper'],{'as':_0xf0a9('0x139'),'foreignKey':_0xf0a9('0x138')});db[_0xf0a9('0x118')][_0xf0a9('0x101')](db[_0xf0a9('0x71')],{'as':'HopperFinals','foreignKey':_0xf0a9('0x138')});db['VoiceQueue']['hasMany'](db[_0xf0a9('0x73')],{'as':_0xf0a9('0x13a'),'foreignKey':_0xf0a9('0x138')});db['VoiceQueue']['hasMany'](db['ReportAgentPreview'],{'as':_0xf0a9('0x75'),'foreignKey':_0xf0a9('0x138')});db[_0xf0a9('0x118')][_0xf0a9('0x101')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xf0a9('0x138')});db[_0xf0a9('0x118')][_0xf0a9('0x101')](db[_0xf0a9('0xc9')],{'as':_0xf0a9('0x13b'),'foreignKey':_0xf0a9('0x138')});db[_0xf0a9('0x118')]['belongsTo'](db[_0xf0a9('0x27')],{'as':_0xf0a9('0x27'),'foreignKey':'TrunkId'});db[_0xf0a9('0x118')][_0xf0a9('0x10b')](db[_0xf0a9('0x27')],{'as':'TrunkBackup','foreignKey':_0xf0a9('0x13c')});db[_0xf0a9('0x118')][_0xf0a9('0x10b')](db['Interval'],{'as':_0xf0a9('0x7f'),'foreignKey':_0xf0a9('0x13d')});db[_0xf0a9('0x118')][_0xf0a9('0x10b')](db[_0xf0a9('0x81')],{'as':_0xf0a9('0x13e'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xf0a9('0x10d')](db['CmList'],{'as':_0xf0a9('0x112'),'through':_0xf0a9('0x13f')});db['VoiceQueue'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x2b')});db[_0xf0a9('0x118')][_0xf0a9('0x10d')](db['Team'],{'as':_0xf0a9('0x141'),'through':_0xf0a9('0x142')});db[_0xf0a9('0x118')][_0xf0a9('0x10d')](db['CmList'],{'as':_0xf0a9('0x143'),'through':_0xf0a9('0x144')});db[_0xf0a9('0x1b')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'as':'User','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x1c')][_0xf0a9('0x10b')](db['User'],{'as':_0xf0a9('0x11'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x1e')][_0xf0a9('0x101')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x145'),'sourceKey':_0xf0a9('0x146')});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0xf0a9('0x145'),'targetKey':_0xf0a9('0x146')});db['VoiceCallReport'][_0xf0a9('0x101')](db[_0xf0a9('0x25')],{'as':_0xf0a9('0x147'),'foreignKey':_0xf0a9('0x148'),'constraints':![]});db[_0xf0a9('0x20')][_0xf0a9('0x101')](db[_0xf0a9('0x149')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x11'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x20')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x34')]['belongsTo'](db['MailAccount'],{'as':_0xf0a9('0x38'),'foreignKey':'MailAccountId'});db[_0xf0a9('0x36')][_0xf0a9('0x10b')](db[_0xf0a9('0x38')],{'as':_0xf0a9('0x38'),'foreignKey':_0xf0a9('0x14c')});db['MailAccount'][_0xf0a9('0xfe')](db[_0xf0a9('0x34')],{'as':'Imap','onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x38')][_0xf0a9('0xfe')](db['MailServerOut'],{'as':_0xf0a9('0x14d'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x38')]['hasMany'](db[_0xf0a9('0x14e')],{'as':'Dispositions','foreignKey':'MailAccountId'});db[_0xf0a9('0x38')][_0xf0a9('0x101')](db[_0xf0a9('0x7b')],{'as':_0xf0a9('0x14f'),'foreignKey':_0xf0a9('0x14c')});db[_0xf0a9('0x38')][_0xf0a9('0x101')](db[_0xf0a9('0x150')],{'as':_0xf0a9('0x151'),'foreignKey':'MailAccountId'});db[_0xf0a9('0x38')]['hasMany'](db[_0xf0a9('0x3d')],{'as':_0xf0a9('0x152')});db[_0xf0a9('0x38')][_0xf0a9('0x101')](db[_0xf0a9('0x3f')],{'as':_0xf0a9('0x134')});db['MailAccount'][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0x38')][_0xf0a9('0x10b')](db['Template'],{'as':_0xf0a9('0x8a'),'foreignKey':'TemplateId'});db[_0xf0a9('0x38')][_0xf0a9('0x10b')](db[_0xf0a9('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xf0a9('0x155')});db['MailAccount'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x129')});db[_0xf0a9('0x39')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':'UserMailQueue'});db[_0xf0a9('0x39')]['belongsToMany'](db[_0xf0a9('0xd7')],{'through':_0xf0a9('0x156'),'as':_0xf0a9('0x141')});db[_0xf0a9('0x3d')][_0xf0a9('0x101')](db['MailMessage'],{'as':_0xf0a9('0x151'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x157')});db['MailInteraction'][_0xf0a9('0x10b')](db[_0xf0a9('0x38')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x14c')});db[_0xf0a9('0x3d')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':'ContactId'});db[_0xf0a9('0x3d')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'as':'Owner','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x3d')][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x159'),'as':_0xf0a9('0x15a')});db['MailInteraction'][_0xf0a9('0x10d')](db['Tag'],{'through':_0xf0a9('0x159'),'as':_0xf0a9('0x15b')});db[_0xf0a9('0x3d')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x15c'),'through':_0xf0a9('0x114'),'foreignKey':_0xf0a9('0x157')});db[_0xf0a9('0x150')][_0xf0a9('0x101')](db[_0xf0a9('0xdc')],{'as':_0xf0a9('0x15d'),'onDelete':_0xf0a9('0xff')});db['MailMessage'][_0xf0a9('0x10b')](db['User'],{'as':'User'});db[_0xf0a9('0x150')]['belongsTo'](db[_0xf0a9('0x6b')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x14a')});db[_0xf0a9('0x150')][_0xf0a9('0x10b')](db['MailInteraction'],{'as':_0xf0a9('0x15e'),'foreignKey':_0xf0a9('0x157')});db[_0xf0a9('0x150')][_0xf0a9('0x10b')](db[_0xf0a9('0x38')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x14c')});db['MailApplication'][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x3f')][_0xf0a9('0x10b')](db[_0xf0a9('0x39')],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x3f')]['belongsTo'](db['MailAccount'],{'onDelete':_0xf0a9('0x15f')});db['MailApplication']['belongsTo'](db[_0xf0a9('0x7f')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':_0xf0a9('0x13d')});db[_0xf0a9('0x3f')]['belongsTo'](db[_0xf0a9('0x88')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':_0xf0a9('0x160')});db[_0xf0a9('0x40')][_0xf0a9('0x10b')](db[_0xf0a9('0x38')],{});db['MailQueueReport'][_0xf0a9('0x10b')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xf0a9('0x40')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x40')]['belongsTo'](db[_0xf0a9('0x3d')],{});db[_0xf0a9('0x40')][_0xf0a9('0x10b')](db[_0xf0a9('0x150')],{});db[_0xf0a9('0x40')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{});db['MailQueueReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x39')],{});db['Dashboard'][_0xf0a9('0x101')](db[_0xf0a9('0x44')],{'as':_0xf0a9('0x161'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x125')]['hasMany'](db[_0xf0a9('0x14e')],{'as':_0xf0a9('0x162'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0xf0a9('0x101')](db[_0xf0a9('0x7b')],{'as':'Answers','foreignKey':_0xf0a9('0x163')});db[_0xf0a9('0x125')]['hasMany'](db[_0xf0a9('0x48')],{'as':'Interactions'});db['FaxAccount'][_0xf0a9('0x101')](db[_0xf0a9('0x46')],{'as':_0xf0a9('0x134')});db['FaxAccount'][_0xf0a9('0x101')](db[_0xf0a9('0x17')],{'as':_0xf0a9('0x164'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x125')][_0xf0a9('0x101')](db[_0xf0a9('0x4a')],{'as':_0xf0a9('0x151')});db['FaxAccount'][_0xf0a9('0x10b')](db[_0xf0a9('0x27')],{'as':_0xf0a9('0x27')});db[_0xf0a9('0x125')][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0x125')]['belongsTo'](db[_0xf0a9('0x81')],{'as':_0xf0a9('0x13e'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Agents','through':_0xf0a9('0x127')});db[_0xf0a9('0x46')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':_0xf0a9('0x15f')});db['FaxApplication'][_0xf0a9('0x10b')](db['FaxQueue'],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x46')]['belongsTo'](db[_0xf0a9('0x125')],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x46')][_0xf0a9('0x10b')](db[_0xf0a9('0x88')],{'onDelete':'restrict','foreignKey':_0xf0a9('0x160')});db['FaxInteraction'][_0xf0a9('0x101')](db[_0xf0a9('0x4a')],{'as':_0xf0a9('0x151'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x165')});db[_0xf0a9('0x48')][_0xf0a9('0x10b')](db[_0xf0a9('0x125')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xf0a9('0x48')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x48')][_0xf0a9('0x10b')](db['User'],{'as':'Owner','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x48')]['belongsToMany'](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x166'),'as':'Tags'});db[_0xf0a9('0x48')][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x166'),'as':_0xf0a9('0x15b')});db[_0xf0a9('0x48')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x15c'),'through':_0xf0a9('0x167'),'foreignKey':_0xf0a9('0x165')});db[_0xf0a9('0x4a')][_0xf0a9('0x10b')](db['User'],{'onDelete':_0xf0a9('0xff'),'as':'User'});db['FaxMessage'][_0xf0a9('0x10b')](db[_0xf0a9('0x48')],{'as':_0xf0a9('0x15e'),'foreignKey':_0xf0a9('0x165')});db[_0xf0a9('0x4a')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'onDelete':'cascade','as':'Contact'});db[_0xf0a9('0x4a')][_0xf0a9('0x10b')](db[_0xf0a9('0xdc')],{'as':_0xf0a9('0xdc'),'foreignKey':_0xf0a9('0x168')});db[_0xf0a9('0x4a')][_0xf0a9('0x10b')](db[_0xf0a9('0x125')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x163')});db[_0xf0a9('0x4c')]['belongsToMany'](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':'UserFaxQueue'});db[_0xf0a9('0x4c')][_0xf0a9('0x10d')](db[_0xf0a9('0xd7')],{'through':_0xf0a9('0x169'),'as':_0xf0a9('0x141')});db['FaxQueueReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x125')],{});db[_0xf0a9('0x4d')][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db['FaxQueueReport']['belongsTo'](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x4d')]['belongsTo'](db[_0xf0a9('0x48')],{});db[_0xf0a9('0x4d')][_0xf0a9('0x10b')](db[_0xf0a9('0x4a')],{});db[_0xf0a9('0x4d')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{});db[_0xf0a9('0x4d')][_0xf0a9('0x10b')](db[_0xf0a9('0x4c')],{});db['SmsAccount']['hasMany'](db[_0xf0a9('0x14e')],{'as':_0xf0a9('0x162'),'foreignKey':_0xf0a9('0x16a')});db[_0xf0a9('0x4f')][_0xf0a9('0x101')](db[_0xf0a9('0x7b')],{'as':'Answers','foreignKey':_0xf0a9('0x16a')});db[_0xf0a9('0x4f')]['hasMany'](db[_0xf0a9('0x16b')],{'as':_0xf0a9('0x151'),'foreignKey':'SmsAccountId'});db[_0xf0a9('0x4f')][_0xf0a9('0x101')](db['SmsInteraction'],{'as':'Interactions'});db[_0xf0a9('0x4f')][_0xf0a9('0x101')](db[_0xf0a9('0x16c')],{'as':_0xf0a9('0x134')});db[_0xf0a9('0x4f')]['belongsTo'](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db['SmsAccount'][_0xf0a9('0x10b')](db[_0xf0a9('0x81')],{'as':_0xf0a9('0x13e'),'foreignKey':_0xf0a9('0x155')});db['SmsAccount'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x12c')});db['SmsApplication'][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':'restrict'});db[_0xf0a9('0x16c')][_0xf0a9('0x10b')](db['SmsQueue'],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x16c')][_0xf0a9('0x10b')](db['SmsAccount'],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x16c')]['belongsTo'](db[_0xf0a9('0x7f')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':'IntervalId'});db[_0xf0a9('0x16c')]['belongsTo'](db[_0xf0a9('0x88')],{'onDelete':'restrict','foreignKey':_0xf0a9('0x160')});db[_0xf0a9('0x52')]['hasMany'](db[_0xf0a9('0x16b')],{'as':_0xf0a9('0x151'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x16d')});db['SmsInteraction'][_0xf0a9('0x10b')](db[_0xf0a9('0x4f')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x16a')});db[_0xf0a9('0x52')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x52')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x16e'),'foreignKey':_0xf0a9('0x100')});db['SmsInteraction']['belongsToMany'](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x16f'),'as':'Tags'});db[_0xf0a9('0x52')][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x16f'),'as':_0xf0a9('0x15b')});db['SmsInteraction'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Users','through':_0xf0a9('0x117'),'foreignKey':_0xf0a9('0x16d')});db[_0xf0a9('0x16b')][_0xf0a9('0x10b')](db['User'],{'as':'User'});db[_0xf0a9('0x16b')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x14a')});db['SmsMessage']['belongsTo'](db[_0xf0a9('0x52')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x15e'),'foreignKey':_0xf0a9('0x16d')});db[_0xf0a9('0x16b')]['belongsTo'](db[_0xf0a9('0x4f')],{'as':'Account','foreignKey':_0xf0a9('0x16a')});db[_0xf0a9('0x54')]['belongsToMany'](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x30'),'foreignKey':_0xf0a9('0x170')});db[_0xf0a9('0x54')][_0xf0a9('0x10d')](db[_0xf0a9('0xd7')],{'through':_0xf0a9('0x171'),'as':'Teams'});db['OpenchannelAccount'][_0xf0a9('0x101')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xf0a9('0x172')});db[_0xf0a9('0x173')]['hasMany'](db[_0xf0a9('0x7b')],{'as':_0xf0a9('0x14f'),'foreignKey':'OpenchannelAccountId'});db[_0xf0a9('0x173')][_0xf0a9('0x101')](db['OpenchannelInteraction'],{'as':_0xf0a9('0x152'),'foreignKey':_0xf0a9('0x172')});db[_0xf0a9('0x173')]['hasMany'](db[_0xf0a9('0x5b')],{'as':_0xf0a9('0x151'),'foreignKey':_0xf0a9('0x172')});db[_0xf0a9('0x173')][_0xf0a9('0x101')](db['OpenchannelApplication'],{'as':_0xf0a9('0x134'),'foreignKey':_0xf0a9('0x172')});db[_0xf0a9('0x173')][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0x173')][_0xf0a9('0x10b')](db[_0xf0a9('0x81')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xf0a9('0x173')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':'user_has_openchannel_accounts'});db[_0xf0a9('0x57')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':_0xf0a9('0x15f')});db['OpenchannelApplication'][_0xf0a9('0x10b')](db[_0xf0a9('0x11f')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':_0xf0a9('0x174')});db[_0xf0a9('0x57')]['belongsTo'](db[_0xf0a9('0x173')],{'onDelete':'restrict','foreignKey':_0xf0a9('0x172')});db[_0xf0a9('0x57')][_0xf0a9('0x10b')](db['Interval'],{'onDelete':_0xf0a9('0x15f'),'foreignKey':'IntervalId'});db['OpenchannelApplication'][_0xf0a9('0x10b')](db['Tag'],{'onDelete':_0xf0a9('0x15f'),'foreignKey':_0xf0a9('0x160')});db[_0xf0a9('0x59')]['hasMany'](db[_0xf0a9('0x5b')],{'as':_0xf0a9('0x151'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x175')});db[_0xf0a9('0x59')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xf0a9('0x158'),'foreignKey':'OpenchannelAccountId'});db[_0xf0a9('0x59')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x16e'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x59')]['belongsToMany'](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x176'),'as':_0xf0a9('0x15a')});db[_0xf0a9('0x59')][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x176'),'as':_0xf0a9('0x15b')});db[_0xf0a9('0x59')]['belongsToMany'](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x15c'),'through':_0xf0a9('0x177'),'foreignKey':_0xf0a9('0x175')});db[_0xf0a9('0x5b')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x11')});db[_0xf0a9('0x5b')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x14a')});db[_0xf0a9('0x5b')][_0xf0a9('0x10b')](db[_0xf0a9('0x59')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x15e'),'foreignKey':_0xf0a9('0x175')});db[_0xf0a9('0x5b')][_0xf0a9('0x10b')](db[_0xf0a9('0xdc')],{'as':_0xf0a9('0xdc'),'foreignKey':_0xf0a9('0x168')});db[_0xf0a9('0x5b')][_0xf0a9('0x10b')](db[_0xf0a9('0x173')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x172')});db[_0xf0a9('0x11f')]['belongsToMany'](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':'UserOpenchannelQueue','foreignKey':_0xf0a9('0x174')});db[_0xf0a9('0x11f')]['belongsToMany'](db[_0xf0a9('0xd7')],{'through':_0xf0a9('0x178'),'as':_0xf0a9('0x141')});db[_0xf0a9('0x124')][_0xf0a9('0x101')](db[_0xf0a9('0x14e')],{'as':_0xf0a9('0x162'),'foreignKey':'ChatWebsiteId'});db[_0xf0a9('0x124')][_0xf0a9('0x101')](db[_0xf0a9('0x7b')],{'as':_0xf0a9('0x14f'),'foreignKey':'ChatWebsiteId'});db[_0xf0a9('0x124')][_0xf0a9('0x101')](db[_0xf0a9('0x69')],{'as':_0xf0a9('0x179')});db['ChatWebsite']['hasMany'](db[_0xf0a9('0x115')],{'as':_0xf0a9('0x152')});db['ChatWebsite']['hasMany'](db[_0xf0a9('0x61')],{'as':'Applications'});db[_0xf0a9('0x124')][_0xf0a9('0x101')](db[_0xf0a9('0x64')],{'as':_0xf0a9('0x151')});db[_0xf0a9('0x124')][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0x124')][_0xf0a9('0x10b')](db[_0xf0a9('0x7f')],{'as':_0xf0a9('0x7f'),'foreignKey':_0xf0a9('0x13d')});db[_0xf0a9('0x124')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xf0a9('0x124')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Agents','through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xf0a9('0x10b')](db['OpenchannelAccount'],{});db[_0xf0a9('0x5f')][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0x5f')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x5f')][_0xf0a9('0x10b')](db[_0xf0a9('0x59')],{});db[_0xf0a9('0x5f')][_0xf0a9('0x10b')](db[_0xf0a9('0x5b')],{});db[_0xf0a9('0x5f')]['belongsTo'](db[_0xf0a9('0x11')],{});db[_0xf0a9('0x5f')]['belongsTo'](db[_0xf0a9('0x11f')],{});db[_0xf0a9('0x61')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x17a'),'foreignKey':_0xf0a9('0x100'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xf0a9('0x11b')],{'as':_0xf0a9('0x17b'),'foreignKey':_0xf0a9('0x17c'),'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x61')][_0xf0a9('0x10b')](db['ChatWebsite'],{'as':_0xf0a9('0x17d'),'foreignKey':_0xf0a9('0x17e'),'onDelete':_0xf0a9('0x15f')});db['ChatApplication'][_0xf0a9('0x10b')](db[_0xf0a9('0x88')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':'TagId'});db['ChatInteraction'][_0xf0a9('0x101')](db[_0xf0a9('0x64')],{'as':'Messages','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x17f')});db[_0xf0a9('0x115')][_0xf0a9('0x10b')](db[_0xf0a9('0x124')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x17e')});db['ChatInteraction'][_0xf0a9('0x10b')](db['CmContact'],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db['ChatInteraction'][_0xf0a9('0x10b')](db['User'],{'as':_0xf0a9('0x16e'),'foreignKey':_0xf0a9('0x100')});db['ChatInteraction'][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x180'),'as':_0xf0a9('0x15a')});db['ChatInteraction'][_0xf0a9('0x10d')](db['Tag'],{'through':_0xf0a9('0x180'),'as':_0xf0a9('0x15b')});db[_0xf0a9('0x115')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0xf0a9('0x64')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x11')});db[_0xf0a9('0x64')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x14a'),'foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x64')]['belongsTo'](db[_0xf0a9('0x115')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xf0a9('0x17f')});db[_0xf0a9('0x64')][_0xf0a9('0x10b')](db[_0xf0a9('0xdc')],{'as':_0xf0a9('0xdc'),'foreignKey':_0xf0a9('0x168')});db[_0xf0a9('0x64')][_0xf0a9('0x10b')](db[_0xf0a9('0x124')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xf0a9('0x66')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'onDelete':_0xf0a9('0xff'),'as':'Contact','foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x66')][_0xf0a9('0x10b')](db[_0xf0a9('0x124')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x17e')});db[_0xf0a9('0x11b')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0xf0a9('0x11b')]['belongsToMany'](db['Team'],{'through':_0xf0a9('0x181'),'as':_0xf0a9('0x141')});db['ChatGroup'][_0xf0a9('0x101')](db['ChatInternalMessage'],{'as':_0xf0a9('0x151'),'foreignKey':_0xf0a9('0x182'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x10e')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Members','through':'chat_group_has_users'});db['ChatProactiveAction'][_0xf0a9('0x10b')](db[_0xf0a9('0x124')],{'as':_0xf0a9('0x17d'),'foreignKey':_0xf0a9('0x17e')});db[_0xf0a9('0x183')][_0xf0a9('0x101')](db[_0xf0a9('0x6b')],{'as':'Contacts','foreignKey':_0xf0a9('0x184')});db[_0xf0a9('0x6b')][_0xf0a9('0x101')](db['CmHopper'],{'as':_0xf0a9('0x139'),'foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x6b')][_0xf0a9('0x101')](db[_0xf0a9('0x71')],{'as':_0xf0a9('0x185'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xf0a9('0x73')],{'as':_0xf0a9('0x13a'),'foreignKey':_0xf0a9('0x14b')});db['CmContact'][_0xf0a9('0x101')](db[_0xf0a9('0x75')],{'as':_0xf0a9('0x75'),'foreignKey':'ContactId'});db[_0xf0a9('0x6b')]['hasMany'](db[_0xf0a9('0xc9')],{'as':_0xf0a9('0x13b'),'foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x6b')]['hasMany'](db[_0xf0a9('0x59')],{'as':'OpenchannelInteractions','foreignKey':_0xf0a9('0x14b'),'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x6b')][_0xf0a9('0x101')](db[_0xf0a9('0x115')],{'as':_0xf0a9('0x116'),'foreignKey':_0xf0a9('0x14b'),'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x6b')][_0xf0a9('0x101')](db[_0xf0a9('0x52')],{'as':'SmsInteractions','foreignKey':_0xf0a9('0x14b'),'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x6b')][_0xf0a9('0x101')](db[_0xf0a9('0x48')],{'as':_0xf0a9('0x106'),'foreignKey':_0xf0a9('0x14b'),'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x6b')][_0xf0a9('0x101')](db[_0xf0a9('0x3d')],{'as':_0xf0a9('0x107'),'foreignKey':_0xf0a9('0x14b'),'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x6b')]['belongsTo'](db[_0xf0a9('0x183')],{'as':_0xf0a9('0x186'),'foreignKey':_0xf0a9('0x184')});db[_0xf0a9('0x6b')]['belongsTo'](db['CmList'],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154'),'onDelete':'cascade'});db[_0xf0a9('0x6b')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x15c'),'through':_0xf0a9('0x111')});db['CmContact'][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'as':_0xf0a9('0x15a'),'through':_0xf0a9('0x187')});db[_0xf0a9('0x6b')]['belongsToMany'](db[_0xf0a9('0x88')],{'through':'cm_contact_has_tags','as':_0xf0a9('0x15b')});db[_0xf0a9('0x6d')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':_0xf0a9('0x14b'),'onDelete':'cascade'});db[_0xf0a9('0x6d')][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':'List','foreignKey':_0xf0a9('0x154'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x6d')]['belongsTo'](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x17a'),'foreignKey':_0xf0a9('0x100')});db['CmHopper'][_0xf0a9('0x10b')](db[_0xf0a9('0x118')],{'as':'Queue','foreignKey':_0xf0a9('0x138'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x6d')]['belongsTo'](db['Campaign'],{'as':_0xf0a9('0xda'),'foreignKey':_0xf0a9('0x188'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x6d')][_0xf0a9('0x10b')](db['User'],{'as':_0xf0a9('0x16e'),'foreignKey':'OwnerId'});db[_0xf0a9('0x6f')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopperBlack'][_0xf0a9('0x10b')](db['CmList'],{'as':_0xf0a9('0x153'),'foreignKey':'ListId','onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x6f')][_0xf0a9('0x10b')](db[_0xf0a9('0x118')],{'as':_0xf0a9('0x17b'),'foreignKey':_0xf0a9('0x138'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x6f')][_0xf0a9('0x10b')](db[_0xf0a9('0xda')],{'as':_0xf0a9('0xda'),'foreignKey':_0xf0a9('0x188'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x79')][_0xf0a9('0x101')](db[_0xf0a9('0x7e')],{'as':{'plural':_0xf0a9('0x189'),'singular':_0xf0a9('0x18a')},'foreignKey':_0xf0a9('0x18b'),'onDelete':_0xf0a9('0xff'),'hooks':!![]});db[_0xf0a9('0x79')][_0xf0a9('0x101')](db['Condition'],{'as':{'plural':_0xf0a9('0x18c'),'singular':_0xf0a9('0x18d')},'foreignKey':_0xf0a9('0x18e'),'onDelete':_0xf0a9('0xff'),'hooks':!![]});db[_0xf0a9('0x79')][_0xf0a9('0x101')](db[_0xf0a9('0x18f')],{'as':'Actions','foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0xf0a9('0x7f')]['hasMany'](db['Interval'],{'as':_0xf0a9('0x190'),'foreignKey':_0xf0a9('0x13d'),'onDelete':_0xf0a9('0xff'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db['VoiceExtension'],{'as':_0xf0a9('0x103'),'foreignKey':_0xf0a9('0x13d'),'onDelete':_0xf0a9('0x15f')});db['Interval'][_0xf0a9('0x101')](db[_0xf0a9('0x3f')],{'as':_0xf0a9('0x191'),'foreignKey':_0xf0a9('0x13d')});db['Interval']['hasMany'](db['ChatApplication'],{'as':_0xf0a9('0x192'),'foreignKey':'IntervalId'});db[_0xf0a9('0x7f')][_0xf0a9('0x101')](db[_0xf0a9('0x46')],{'as':_0xf0a9('0x193'),'foreignKey':'IntervalId'});db[_0xf0a9('0x7f')]['hasMany'](db[_0xf0a9('0x16c')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0xf0a9('0x194')][_0xf0a9('0x10b')](db[_0xf0a9('0x38')],{});db[_0xf0a9('0x194')][_0xf0a9('0x10b')](db['AnalyticDefaultReport'],{'foreignKey':_0xf0a9('0x195')});db[_0xf0a9('0x194')][_0xf0a9('0x10b')](db['AnalyticCustomReport'],{'foreignKey':_0xf0a9('0x196')});db['Sound'][_0xf0a9('0x10d')](db[_0xf0a9('0x19')],{'as':_0xf0a9('0x197'),'through':'moh_has_sounds','onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x88')][_0xf0a9('0x10d')](db[_0xf0a9('0x6b')],{'through':_0xf0a9('0x187')});db[_0xf0a9('0x88')][_0xf0a9('0x10d')](db[_0xf0a9('0x115')],{'through':_0xf0a9('0x180')});db[_0xf0a9('0x88')][_0xf0a9('0x10d')](db[_0xf0a9('0x3d')],{'through':_0xf0a9('0x159')});db['Tag'][_0xf0a9('0x10d')](db[_0xf0a9('0x52')],{'through':_0xf0a9('0x16f')});db[_0xf0a9('0x88')][_0xf0a9('0x10d')](db[_0xf0a9('0x48')],{'through':_0xf0a9('0x166')});db[_0xf0a9('0x88')][_0xf0a9('0x10d')](db['OpenchannelInteraction'],{'through':_0xf0a9('0x176')});db[_0xf0a9('0x88')][_0xf0a9('0x10d')](db['WhatsappInteraction'],{'through':_0xf0a9('0x198')});db[_0xf0a9('0x8b')][_0xf0a9('0x101')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xf0a9('0x199')},'foreignKey':'TriggerAllId','onDelete':_0xf0a9('0xff'),'hooks':!![]});db[_0xf0a9('0x8b')][_0xf0a9('0x101')](db[_0xf0a9('0x7e')],{'as':{'plural':'AnyConditions','singular':_0xf0a9('0x19a')},'foreignKey':_0xf0a9('0x19b'),'onDelete':_0xf0a9('0xff'),'hooks':!![]});db[_0xf0a9('0x8b')][_0xf0a9('0x101')](db['Action'],{'as':_0xf0a9('0x19c'),'foreignKey':_0xf0a9('0x19d'),'onDelete':_0xf0a9('0xff'),'hooks':!![]});db[_0xf0a9('0x19e')][_0xf0a9('0x101')](db['AnalyticFieldReport'],{'as':_0xf0a9('0x19f'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x196'),'hooks':!![]});db[_0xf0a9('0x1a0')][_0xf0a9('0x101')](db[_0xf0a9('0x1a1')],{'as':_0xf0a9('0x19f'),'onDelete':'cascade','foreignKey':_0xf0a9('0x195')});db[_0xf0a9('0x1a2')][_0xf0a9('0x101')](db[_0xf0a9('0x1a1')],{'as':_0xf0a9('0x19f'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a3')});db[_0xf0a9('0x1a1')][_0xf0a9('0x10b')](db[_0xf0a9('0x1a2')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0xf0a9('0x101')](db[_0xf0a9('0x9a')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x9a')][_0xf0a9('0x101')](db[_0xf0a9('0x9b')],{'as':'Subjects','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0x9a')][_0xf0a9('0x101')](db[_0xf0a9('0x9b')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0x9a')][_0xf0a9('0x101')](db[_0xf0a9('0x9b')],{'as':_0xf0a9('0x19f'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0x9a')][_0xf0a9('0x10b')](db[_0xf0a9('0x98')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x9b')][_0xf0a9('0x101')](db[_0xf0a9('0x9b')],{'as':_0xf0a9('0x1a8'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0x9b')][_0xf0a9('0x101')](db[_0xf0a9('0x9b')],{'as':_0xf0a9('0x1a9'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0x9b')][_0xf0a9('0x101')](db[_0xf0a9('0x9b')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0x9b')][_0xf0a9('0x10b')](db[_0xf0a9('0x8c')],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0x9c')][_0xf0a9('0x101')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x9e')][_0xf0a9('0x101')](db[_0xf0a9('0xa0')],{'as':_0xf0a9('0x1ac'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0x9e')][_0xf0a9('0x101')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0x9e')][_0xf0a9('0x101')](db[_0xf0a9('0xa0')],{'as':'Fields','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0x9e')]['belongsTo'](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xa0')][_0xf0a9('0x101')](db[_0xf0a9('0xa0')],{'as':_0xf0a9('0x1a8'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0xa0')][_0xf0a9('0x101')](db[_0xf0a9('0xa0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xf0a9('0xa0')][_0xf0a9('0x101')](db[_0xf0a9('0xa0')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0xa0')][_0xf0a9('0x10b')](db['Variable'],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0x1ad')][_0xf0a9('0x101')](db[_0xf0a9('0x1ae')],{'as':'Configurations','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x1ae')]['hasMany'](db[_0xf0a9('0x1af')],{'as':_0xf0a9('0x1ac'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0x1ae')][_0xf0a9('0x101')](db[_0xf0a9('0x1af')],{'as':'Descriptions','onDelete':_0xf0a9('0xff'),'foreignKey':'DescriptionId'});db[_0xf0a9('0x1ae')][_0xf0a9('0x101')](db[_0xf0a9('0x1af')],{'as':_0xf0a9('0x19f'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0x1ae')]['belongsTo'](db['DeskAccount'],{'as':'Account','foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x1ae')]['belongsToMany'](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x1b0')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0xf0a9('0x1a8'),'foreignKey':_0xf0a9('0x1a5')});db['DeskField'][_0xf0a9('0x101')](db[_0xf0a9('0x1af')],{'as':_0xf0a9('0x1a9'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0x1af')][_0xf0a9('0x101')](db[_0xf0a9('0x1af')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db['DeskField'][_0xf0a9('0x10b')](db[_0xf0a9('0x8c')],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0x1b1')][_0xf0a9('0x101')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x1b2')][_0xf0a9('0x101')](db[_0xf0a9('0xa5')],{'as':_0xf0a9('0x1ac'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a5')});db['ZohoConfiguration'][_0xf0a9('0x101')](db[_0xf0a9('0xa5')],{'as':_0xf0a9('0x1b3'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0x1b2')][_0xf0a9('0x101')](db[_0xf0a9('0xa5')],{'as':_0xf0a9('0x19f'),'onDelete':_0xf0a9('0xff'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0xf0a9('0x10b')](db['ZohoAccount'],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xa5')][_0xf0a9('0x101')](db[_0xf0a9('0xa5')],{'as':_0xf0a9('0x1a8'),'foreignKey':_0xf0a9('0x1a5')});db['ZohoField']['hasMany'](db[_0xf0a9('0xa5')],{'as':_0xf0a9('0x1a9'),'foreignKey':'DescriptionId'});db[_0xf0a9('0xa5')][_0xf0a9('0x101')](db[_0xf0a9('0xa5')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db['ZohoField'][_0xf0a9('0x10b')](db['Variable'],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db['ZendeskAccount'][_0xf0a9('0x101')](db[_0xf0a9('0xa8')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xa8')][_0xf0a9('0x101')](db[_0xf0a9('0xaa')],{'as':_0xf0a9('0x1ac'),'foreignKey':'SubjectId'});db[_0xf0a9('0xa8')][_0xf0a9('0x101')](db['ZendeskField'],{'as':_0xf0a9('0x1b3'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xa8')][_0xf0a9('0x101')](db[_0xf0a9('0xaa')],{'as':_0xf0a9('0x19f'),'foreignKey':'FieldId'});db[_0xf0a9('0xa8')][_0xf0a9('0x10b')](db[_0xf0a9('0x1b4')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xa8')][_0xf0a9('0x10d')](db['Tag'],{'through':_0xf0a9('0x1b5')});db['ZendeskField'][_0xf0a9('0x101')](db[_0xf0a9('0xaa')],{'as':_0xf0a9('0x1a8'),'foreignKey':'SubjectId'});db[_0xf0a9('0xaa')]['hasMany'](db[_0xf0a9('0xaa')],{'as':'Description','foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xaa')][_0xf0a9('0x101')](db[_0xf0a9('0xaa')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db['ZendeskField']['belongsTo'](db['Variable'],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0xac')][_0xf0a9('0x101')](db['FreshdeskConfiguration'],{'as':_0xf0a9('0x1b6'),'onDelete':'cascade','foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xad')]['hasMany'](db[_0xf0a9('0xae')],{'as':'Subjects','onDelete':_0xf0a9('0xff'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration']['hasMany'](db[_0xf0a9('0xae')],{'as':_0xf0a9('0x1b3'),'onDelete':'cascade','foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xad')]['hasMany'](db[_0xf0a9('0xae')],{'as':_0xf0a9('0x19f'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0xad')][_0xf0a9('0x10b')](db[_0xf0a9('0xac')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xad')][_0xf0a9('0x10d')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0xf0a9('0x101')](db['FreshdeskField'],{'as':'Subject','foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0xae')][_0xf0a9('0x101')](db['FreshdeskField'],{'as':_0xf0a9('0x1a9'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xae')][_0xf0a9('0x101')](db[_0xf0a9('0xae')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0xae')][_0xf0a9('0x10b')](db[_0xf0a9('0x8c')],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0x1b7')]['hasMany'](db[_0xf0a9('0xb1')],{'as':'Configurations','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xb1')]['hasMany'](db[_0xf0a9('0xb3')],{'as':_0xf0a9('0x1ac'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0xb1')][_0xf0a9('0x101')](db[_0xf0a9('0xb3')],{'as':_0xf0a9('0x1b3'),'foreignKey':_0xf0a9('0x1a6')});db['VtigerConfiguration'][_0xf0a9('0x101')](db[_0xf0a9('0xb3')],{'as':_0xf0a9('0x19f'),'foreignKey':'FieldId'});db[_0xf0a9('0xb1')]['belongsTo'](db[_0xf0a9('0x1b7')],{'as':'Account','foreignKey':_0xf0a9('0x1a4')});db['VtigerField'][_0xf0a9('0x101')](db[_0xf0a9('0xb3')],{'as':_0xf0a9('0x1a8'),'foreignKey':'SubjectId'});db[_0xf0a9('0xb3')][_0xf0a9('0x101')](db[_0xf0a9('0xb3')],{'as':'Description','foreignKey':_0xf0a9('0x1a6')});db['VtigerField'][_0xf0a9('0x101')](db[_0xf0a9('0xb3')],{'as':'Field','foreignKey':'FieldId'});db[_0xf0a9('0xb3')]['belongsTo'](db[_0xf0a9('0x8c')],{'as':_0xf0a9('0x8c'),'foreignKey':'VariableId'});db[_0xf0a9('0xb5')]['hasMany'](db['ServicenowConfiguration'],{'as':_0xf0a9('0x1b6'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xb7')]['hasMany'](db[_0xf0a9('0xb9')],{'as':'Subjects','foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0xb7')][_0xf0a9('0x101')](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xb7')]['hasMany'](db[_0xf0a9('0xb9')],{'as':_0xf0a9('0x19f'),'foreignKey':'FieldId'});db[_0xf0a9('0xb7')]['belongsTo'](db[_0xf0a9('0xb5')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xb9')]['hasMany'](db[_0xf0a9('0xb9')],{'as':'Subject','foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0xb9')][_0xf0a9('0x101')](db['ServicenowField'],{'as':_0xf0a9('0x1a9'),'foreignKey':_0xf0a9('0x1a6')});db['ServicenowField'][_0xf0a9('0x101')](db[_0xf0a9('0xb9')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0xb9')]['belongsTo'](db[_0xf0a9('0x8c')],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db['Dynamics365Account'][_0xf0a9('0x101')](db[_0xf0a9('0xbc')],{'as':_0xf0a9('0x1b6'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db['Dynamics365Configuration']['hasMany'](db[_0xf0a9('0xbd')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0xf0a9('0x101')](db[_0xf0a9('0xbd')],{'as':_0xf0a9('0x1b3'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xbc')][_0xf0a9('0x101')](db['Dynamics365Field'],{'as':_0xf0a9('0x19f'),'onDelete':'cascade','foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0xbc')][_0xf0a9('0x10b')](db[_0xf0a9('0xba')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xbd')]['hasMany'](db['Dynamics365Field'],{'as':_0xf0a9('0x1a8'),'foreignKey':'SubjectId'});db[_0xf0a9('0xbd')][_0xf0a9('0x101')](db[_0xf0a9('0xbd')],{'as':_0xf0a9('0x1a9'),'foreignKey':'DescriptionId'});db[_0xf0a9('0xbd')][_0xf0a9('0x101')](db['Dynamics365Field'],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db['Dynamics365Field'][_0xf0a9('0x10b')](db['Variable'],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0x1b8')][_0xf0a9('0x101')](db['FreshsalesConfiguration'],{'as':_0xf0a9('0x1b6'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db['FreshsalesConfiguration'][_0xf0a9('0x101')](db[_0xf0a9('0x1b9')],{'as':_0xf0a9('0x1ac'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0xbf')]['hasMany'](db[_0xf0a9('0x1b9')],{'as':_0xf0a9('0x1b3'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xbf')]['hasMany'](db[_0xf0a9('0x1b9')],{'as':_0xf0a9('0x19f'),'foreignKey':'FieldId'});db[_0xf0a9('0xbf')][_0xf0a9('0x10b')](db['FreshsalesAccount'],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x1b9')]['hasMany'](db[_0xf0a9('0x1b9')],{'as':_0xf0a9('0x1a8'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0x1b9')]['hasMany'](db[_0xf0a9('0x1b9')],{'as':_0xf0a9('0x1a9'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0xf0a9('0x101')](db[_0xf0a9('0x1b9')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0x1b9')][_0xf0a9('0x10b')](db['Variable'],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0xc3')][_0xf0a9('0x10b')](db[_0xf0a9('0x124')],{});db['ChatQueueReport'][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0xc3')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':'ContactId'});db[_0xf0a9('0xc3')][_0xf0a9('0x10b')](db['ChatInteraction'],{});db['ChatQueueReport']['belongsTo'](db[_0xf0a9('0x64')],{});db[_0xf0a9('0xc3')]['belongsTo'](db[_0xf0a9('0x11')],{});db[_0xf0a9('0xc3')]['belongsTo'](db[_0xf0a9('0x11b')],{});db[_0xf0a9('0xc5')][_0xf0a9('0x10b')](db['User'],{'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1ba')});db['ChatInternalMessage'][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':_0xf0a9('0xff'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0xf0a9('0x101')](db[_0xf0a9('0xc8')],{'foreignKey':_0xf0a9('0x1bb'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0xc9')][_0xf0a9('0x101')](db[_0xf0a9('0xc7')],{'foreignKey':_0xf0a9('0x1bb'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0xcb')][_0xf0a9('0x10b')](db[_0xf0a9('0x4f')],{});db[_0xf0a9('0xcb')][_0xf0a9('0x10b')](db['CmList'],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db['SmsQueueReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db['SmsQueueReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x52')],{});db[_0xf0a9('0xcb')][_0xf0a9('0x10b')](db['SmsMessage'],{});db[_0xf0a9('0xcb')]['belongsTo'](db['User'],{});db[_0xf0a9('0xcb')]['belongsTo'](db[_0xf0a9('0x54')],{});db['JscriptyProject'][_0xf0a9('0x101')](db[_0xf0a9('0xc9')],{'foreignKey':_0xf0a9('0x1bc')});db[_0xf0a9('0xcf')][_0xf0a9('0x101')](db['JscriptyQuestionReport'],{'foreignKey':_0xf0a9('0x1bc')});db['JscriptyProject'][_0xf0a9('0x101')](db[_0xf0a9('0xc7')],{'foreignKey':'ProjectId'});db[_0xf0a9('0xd3')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Users','through':_0xf0a9('0x130')});db[_0xf0a9('0xd7')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x1bd')});db['Team'][_0xf0a9('0x10d')](db['VoiceQueue'],{'through':'team_has_voice_queues','as':_0xf0a9('0x1be')});db[_0xf0a9('0xd7')]['belongsToMany'](db['MailQueue'],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0xf0a9('0xd7')][_0xf0a9('0x10d')](db[_0xf0a9('0x11b')],{'through':_0xf0a9('0x181'),'as':_0xf0a9('0x11c')});db[_0xf0a9('0xd7')][_0xf0a9('0x10d')](db[_0xf0a9('0x4c')],{'through':_0xf0a9('0x169'),'as':_0xf0a9('0x11e')});db['Team'][_0xf0a9('0x10d')](db['SmsQueue'],{'through':_0xf0a9('0x171'),'as':_0xf0a9('0x1bf')});db[_0xf0a9('0xd7')][_0xf0a9('0x10d')](db[_0xf0a9('0x11f')],{'through':'team_has_openchannel_queues','as':_0xf0a9('0x120')});db[_0xf0a9('0xd7')][_0xf0a9('0x10d')](db[_0xf0a9('0xfa')],{'through':_0xf0a9('0x1c0'),'as':_0xf0a9('0x1c1')});db[_0xf0a9('0xda')]['hasMany'](db[_0xf0a9('0x6d')],{'as':'Hoppers','foreignKey':_0xf0a9('0x188')});db[_0xf0a9('0xda')][_0xf0a9('0x101')](db[_0xf0a9('0x71')],{'as':_0xf0a9('0x185'),'foreignKey':'CampaignId'});db[_0xf0a9('0xda')]['hasMany'](db[_0xf0a9('0x73')],{'as':_0xf0a9('0x13a'),'foreignKey':'CampaignId'});db[_0xf0a9('0xda')]['hasMany'](db[_0xf0a9('0x6f')],{'as':_0xf0a9('0x1c2'),'foreignKey':_0xf0a9('0x188')});db[_0xf0a9('0xda')][_0xf0a9('0x10b')](db['Trunk'],{'as':_0xf0a9('0x27'),'foreignKey':_0xf0a9('0x1c3')});db['Campaign']['belongsTo'](db[_0xf0a9('0x27')],{'as':_0xf0a9('0x1c4'),'foreignKey':_0xf0a9('0x13c')});db[_0xf0a9('0xda')][_0xf0a9('0x10b')](db['Interval'],{'as':'Interval','foreignKey':_0xf0a9('0x13d')});db[_0xf0a9('0xda')][_0xf0a9('0x10b')](db[_0xf0a9('0xd3')],{'as':_0xf0a9('0xd3'),'foreignKey':_0xf0a9('0x1c5')});db[_0xf0a9('0xda')]['belongsToMany'](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x112'),'through':_0xf0a9('0x1c6')});db[_0xf0a9('0xda')]['belongsToMany'](db[_0xf0a9('0xe6')],{'as':'BlackLists','through':_0xf0a9('0x1c7')});db[_0xf0a9('0xe0')][_0xf0a9('0x10b')](db[_0xf0a9('0x150')],{});db[_0xf0a9('0xe0')][_0xf0a9('0x10b')](db['MailInteraction'],{});db[_0xf0a9('0xe0')][_0xf0a9('0x10b')](db[_0xf0a9('0x38')],{'foreignKey':_0xf0a9('0x1c8'),'as':'FromAccount'});db['MailTransferReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1c9'),'as':_0xf0a9('0x1ca')});db['MailTransferReport']['belongsTo'](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1cb'),'as':_0xf0a9('0x1cc')});db['MailTransferReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x39')],{'foreignKey':_0xf0a9('0x1cd'),'as':'ToQueue'});db[_0xf0a9('0xe0')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xf0a9('0x1ce'),'as':_0xf0a9('0x1cf')});db[_0xf0a9('0x1d0')][_0xf0a9('0x10b')](db[_0xf0a9('0x64')],{});db[_0xf0a9('0x1d0')][_0xf0a9('0x10b')](db[_0xf0a9('0x115')],{});db[_0xf0a9('0x1d0')]['belongsTo'](db[_0xf0a9('0x124')],{'foreignKey':_0xf0a9('0x1d1'),'as':_0xf0a9('0x1d2')});db[_0xf0a9('0x1d0')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':'FromUserId','as':_0xf0a9('0x1ca')});db[_0xf0a9('0x1d0')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1cb'),'as':_0xf0a9('0x1cc')});db[_0xf0a9('0x1d0')][_0xf0a9('0x10b')](db['ChatQueue'],{'foreignKey':_0xf0a9('0x1d3'),'as':_0xf0a9('0x1d4')});db[_0xf0a9('0x1d0')][_0xf0a9('0x10b')](db['ChatWebsite'],{'foreignKey':_0xf0a9('0x1d5'),'as':_0xf0a9('0x1cf')});db['FaxTransferReport']['belongsTo'](db[_0xf0a9('0x4a')],{});db['FaxTransferReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x48')],{});db[_0xf0a9('0xe3')][_0xf0a9('0x10b')](db[_0xf0a9('0x125')],{'foreignKey':_0xf0a9('0x1d6'),'as':_0xf0a9('0x1d2')});db[_0xf0a9('0xe3')][_0xf0a9('0x10b')](db['User'],{'foreignKey':_0xf0a9('0x1c9'),'as':_0xf0a9('0x1ca')});db[_0xf0a9('0xe3')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1cb'),'as':_0xf0a9('0x1cc')});db[_0xf0a9('0xe3')][_0xf0a9('0x10b')](db['FaxQueue'],{'foreignKey':_0xf0a9('0x1d7'),'as':_0xf0a9('0x1d4')});db[_0xf0a9('0xe3')][_0xf0a9('0x10b')](db[_0xf0a9('0x125')],{'foreignKey':_0xf0a9('0x1d8'),'as':'ToAccount'});db[_0xf0a9('0xe5')][_0xf0a9('0x10b')](db[_0xf0a9('0x5b')],{});db[_0xf0a9('0xe5')][_0xf0a9('0x10b')](db[_0xf0a9('0x59')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0xf0a9('0x173')],{'foreignKey':_0xf0a9('0x1d9'),'as':'FromAccount'});db[_0xf0a9('0xe5')]['belongsTo'](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1c9'),'as':_0xf0a9('0x1ca')});db[_0xf0a9('0xe5')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1cb'),'as':_0xf0a9('0x1cc')});db[_0xf0a9('0xe5')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0xf0a9('0x1d4')});db[_0xf0a9('0xe5')][_0xf0a9('0x10b')](db[_0xf0a9('0x173')],{'foreignKey':_0xf0a9('0x1da'),'as':_0xf0a9('0x1cf')});db[_0xf0a9('0x1db')][_0xf0a9('0x10b')](db[_0xf0a9('0x16b')],{});db[_0xf0a9('0x1db')]['belongsTo'](db['SmsInteraction'],{});db[_0xf0a9('0x1db')]['belongsTo'](db[_0xf0a9('0x4f')],{'foreignKey':_0xf0a9('0x1dc'),'as':'FromAccount'});db[_0xf0a9('0x1db')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1c9'),'as':_0xf0a9('0x1ca')});db[_0xf0a9('0x1db')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xf0a9('0x1db')][_0xf0a9('0x10b')](db[_0xf0a9('0x54')],{'foreignKey':_0xf0a9('0x1dd'),'as':_0xf0a9('0x1d4')});db[_0xf0a9('0x1db')][_0xf0a9('0x10b')](db['SmsAccount'],{'foreignKey':_0xf0a9('0x1de'),'as':_0xf0a9('0x1cf')});db[_0xf0a9('0xe6')][_0xf0a9('0x101')](db[_0xf0a9('0x14e')],{'as':_0xf0a9('0x162'),'foreignKey':_0xf0a9('0x154')});db['CmList'][_0xf0a9('0x101')](db[_0xf0a9('0x77')],{'as':_0xf0a9('0x1df'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0xe6')][_0xf0a9('0x101')](db[_0xf0a9('0x6b')],{'as':'Contacts','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x154')});db['CmList']['hasMany'](db[_0xf0a9('0x71')],{'as':_0xf0a9('0x185'),'foreignKey':_0xf0a9('0x154')});db['CmList'][_0xf0a9('0x101')](db[_0xf0a9('0x73')],{'as':_0xf0a9('0x1e0'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0xe6')][_0xf0a9('0x101')](db['ReportAgentPreview'],{'as':_0xf0a9('0x75'),'foreignKey':'ListId'});db[_0xf0a9('0xe6')][_0xf0a9('0x10d')](db[_0xf0a9('0x118')],{'as':_0xf0a9('0x1e1'),'through':'voice_queues_has_cm_lists'});db[_0xf0a9('0xe6')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Agents','through':_0xf0a9('0x113')});db[_0xf0a9('0x122')]['hasMany'](db[_0xf0a9('0x17')],{'as':_0xf0a9('0x103'),'onDelete':'cascade'});db[_0xf0a9('0x122')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x123')});db[_0xf0a9('0xe9')][_0xf0a9('0x101')](db[_0xf0a9('0x11')],{'as':'Users','foreignKey':_0xf0a9('0x10c')});db[_0xf0a9('0xe9')][_0xf0a9('0x101')](db[_0xf0a9('0x1e2')],{'as':_0xf0a9('0x1e3'),'foreignKey':'userProfileId','onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x1e2')][_0xf0a9('0x101')](db[_0xf0a9('0xec')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0xf0a9('0xff')});db[_0xf0a9('0xf0')][_0xf0a9('0x101')](db[_0xf0a9('0x14e')],{'as':_0xf0a9('0x162'),'foreignKey':_0xf0a9('0x1e4')});db[_0xf0a9('0xf0')]['hasMany'](db[_0xf0a9('0x7b')],{'as':_0xf0a9('0x14f'),'foreignKey':'WhatsappAccountId'});db[_0xf0a9('0xf0')][_0xf0a9('0x101')](db['WhatsappMessage'],{'as':_0xf0a9('0x151'),'foreignKey':'WhatsappAccountId'});db[_0xf0a9('0xf0')][_0xf0a9('0x101')](db[_0xf0a9('0xf3')],{'as':_0xf0a9('0x152')});db[_0xf0a9('0xf0')][_0xf0a9('0x101')](db[_0xf0a9('0x1e5')],{'as':_0xf0a9('0x134')});db[_0xf0a9('0xf0')]['belongsTo'](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0xf0')][_0xf0a9('0x10b')](db[_0xf0a9('0x81')],{'as':_0xf0a9('0x13e'),'foreignKey':_0xf0a9('0x155')});db['WhatsappAccount'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x12e')});db[_0xf0a9('0x1e5')][_0xf0a9('0x10b')](db['User'],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x1e5')]['belongsTo'](db[_0xf0a9('0xfa')],{'onDelete':'restrict'});db[_0xf0a9('0x1e5')][_0xf0a9('0x10b')](db[_0xf0a9('0xf0')],{'onDelete':_0xf0a9('0x15f')});db['WhatsappApplication'][_0xf0a9('0x10b')](db[_0xf0a9('0x7f')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':_0xf0a9('0x13d')});db['WhatsappApplication'][_0xf0a9('0x10b')](db[_0xf0a9('0x88')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':'TagId'});db[_0xf0a9('0xf3')][_0xf0a9('0x101')](db[_0xf0a9('0x1e6')],{'as':_0xf0a9('0x151'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1e7')});db['WhatsappInteraction'][_0xf0a9('0x10b')](db[_0xf0a9('0xf0')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1e4')});db[_0xf0a9('0xf3')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db['WhatsappInteraction'][_0xf0a9('0x10b')](db['User'],{'as':_0xf0a9('0x16e'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0xf3')][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x198'),'as':_0xf0a9('0x15a')});db['WhatsappInteraction'][_0xf0a9('0x10d')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0xf0a9('0xf3')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x15c'),'through':_0xf0a9('0x1e8'),'foreignKey':_0xf0a9('0x1e7')});db[_0xf0a9('0x1e6')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'as':'User'});db[_0xf0a9('0x1e6')][_0xf0a9('0x10b')](db['CmContact'],{'onDelete':'cascade','as':_0xf0a9('0x14a')});db[_0xf0a9('0x1e6')]['belongsTo'](db[_0xf0a9('0xf3')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x15e'),'foreignKey':_0xf0a9('0x1e7')});db[_0xf0a9('0x1e6')][_0xf0a9('0x10b')](db[_0xf0a9('0xf0')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1e4')});db[_0xf0a9('0xf6')][_0xf0a9('0x10b')](db[_0xf0a9('0xf0')],{});db[_0xf0a9('0xf6')][_0xf0a9('0x10b')](db['CmList'],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0xf6')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0xf6')][_0xf0a9('0x10b')](db[_0xf0a9('0xf3')],{});db['WhatsappQueueReport'][_0xf0a9('0x10b')](db[_0xf0a9('0xfa')],{});db[_0xf0a9('0xf6')][_0xf0a9('0x10b')](db[_0xf0a9('0x1e6')],{});db[_0xf0a9('0xf6')]['belongsTo'](db[_0xf0a9('0x11')],{});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db['WhatsappMessage'],{});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db[_0xf0a9('0xf3')],{});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db[_0xf0a9('0xf0')],{'foreignKey':_0xf0a9('0x1e9'),'as':_0xf0a9('0x1d2')});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db['WhatsappAccount'],{'foreignKey':_0xf0a9('0x1ea'),'as':'ToAccount'});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':'FromUserId','as':_0xf0a9('0x1ca')});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db['User'],{'foreignKey':_0xf0a9('0x1cb'),'as':_0xf0a9('0x1cc')});db['WhatsappQueue'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x33'),'foreignKey':_0xf0a9('0x1eb')});db[_0xf0a9('0xfa')][_0xf0a9('0x10d')](db['Team'],{'through':_0xf0a9('0x1c0'),'as':_0xf0a9('0x141')});module[_0xf0a9('0x1ec')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xd634=['../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','UserId','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','belongsToMany','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','SmsInteractions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','ChatQueues','UserChatQueue','FaxQueue','OpenchannelQueue','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Team','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','Contact','ContactId','MailAccount','MailAccountId','MailServerOut','Dispositions','Answers','Interactions','Applications','ListId','Template','TemplateId','mandatoryDispositionPause','UserMailQueue','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','restrict','TagId','List','Dashboard','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','Owner','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','openchannel_interaction_has_tags','OpenchannelInteractionId','OpenchannelQueueId','ChatWebsiteId','ProactiveActions','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','CompanyId','JscriptySessions','cm_contact_has_tags','Agent','Queue','Campaign','CampaignId','OwnerId','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','SalesforceAccount','Description','Field','SugarcrmAccount','Subject','DeskAccount','int_desk_configuration_has_tags','VariableId','int_zendesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','Dynamics365Account','Dynamics365Field','FreshsalesConfiguration','FreshsalesField','FromId','SessionId','ProjectId','team_has_chat_queues','FaxQueues','SmsQueues','team_has_whatsapp_queues','Hoppers','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','FromChatWebsiteId','ToAgent','ToChatQueueId','ToQueue','ToAccount','FaxTransferReport','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','UserProfileSections','UserProfileSection','Resources','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','exports','../config/environment','sequelize','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','username','password','options','sequelizeHistory','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../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','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../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','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0xd634,0xf4));var _0x4d63=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0xd634[_0x1488cd];return _0x63fa13;};'use strict';var path=require('path');var config=require(_0x4d63('0x0'));var Sequelize=require(_0x4d63('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x4d63('0x2')]();config[_0x4d63('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':_0x4d63('0x3'),'username':_0x4d63('0x4'),'password':_0x4d63('0x5'),'options':{'host':_0x4d63('0x6'),'port':0xcea,'dialect':_0x4d63('0x7'),'dialectOptions':{'charset':_0x4d63('0x8')},'logging':![],'timezone':timezone[_0x4d63('0x9')](),'define':{'charset':_0x4d63('0xa'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':'motion2','username':_0x4d63('0x4'),'password':_0x4d63('0x5'),'options':{'host':_0x4d63('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x4d63('0x8')},'logging':![],'timezone':timezone[_0x4d63('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4d63('0x1')]['database'],config[_0x4d63('0x1')][_0x4d63('0xb')],config[_0x4d63('0x1')][_0x4d63('0xc')],config[_0x4d63('0x1')][_0x4d63('0xd')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config['sequelizeHistory'][_0x4d63('0xb')],config[_0x4d63('0xe')][_0x4d63('0xc')],config[_0x4d63('0xe')]['options'])};db[_0x4d63('0xf')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x11'));db[_0x4d63('0x12')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x13'));db['VoiceContext']=db['sequelize'][_0x4d63('0x10')]('../api/voiceContext/voiceContext.model');db[_0x4d63('0x14')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x15'));db[_0x4d63('0x16')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x17'));db['VoiceQueue']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x18'));db['VoiceRecording']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x19'));db[_0x4d63('0x1a')]=db['sequelize'][_0x4d63('0x10')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x1b'));db[_0x4d63('0x1c')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x1d'));db[_0x4d63('0x1e')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/voiceCallReport/voiceCallReport.model');db[_0x4d63('0x1f')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x20'));db[_0x4d63('0x21')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x22'));db[_0x4d63('0x23')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x24'));db[_0x4d63('0x25')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x26'));db['Trunk']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x27'));db[_0x4d63('0x28')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x4d63('0x29')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x2a'));db[_0x4d63('0x2b')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x2c'));db['UserChatQueue']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x2d'));db['UserMailQueue']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/userMailQueue/userMailQueue.model');db[_0x4d63('0x2e')]=db['sequelize']['import'](_0x4d63('0x2f'));db[_0x4d63('0x30')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x31'));db[_0x4d63('0x32')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x33'));db[_0x4d63('0x34')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x35'));db[_0x4d63('0x36')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x37'));db['MailServerOut']=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x38'));db['MailAccount']=db['sequelize'][_0x4d63('0x10')]('../api/mailAccount/mailAccount.model');db[_0x4d63('0x39')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/mailQueue/mailQueue.model');db[_0x4d63('0x3a')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x3b'));db[_0x4d63('0x3c')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x3d'));db[_0x4d63('0x3e')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x3f'));db[_0x4d63('0x40')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x41'));db[_0x4d63('0x42')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x43'));db['Dashboard']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x44'));db['DashboardItem']=db[_0x4d63('0x1')]['import'](_0x4d63('0x45'));db[_0x4d63('0x46')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x47'));db[_0x4d63('0x48')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x49'));db[_0x4d63('0x4a')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x4b'));db[_0x4d63('0x4c')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x4d'));db['FaxQueue']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x4e'));db[_0x4d63('0x4f')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x50'));db['SmsAccount']=db[_0x4d63('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0x4d63('0x51')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x52'));db[_0x4d63('0x53')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x54'));db[_0x4d63('0x55')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x56'));db[_0x4d63('0x57')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x58'));db[_0x4d63('0x59')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x5a'));db['OpenchannelApplication']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x4d63('0x1')]['import'](_0x4d63('0x5b'));db[_0x4d63('0x5c')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x5d'));db['OpenchannelQueue']=db[_0x4d63('0x1')]['import'](_0x4d63('0x5e'));db[_0x4d63('0x5f')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/chatWebsite/chatWebsite.model');db[_0x4d63('0x60')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x61'));db[_0x4d63('0x62')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/chatApplication/chatApplication.model');db[_0x4d63('0x63')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x64'));db[_0x4d63('0x65')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x66'));db[_0x4d63('0x67')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x68'));db[_0x4d63('0x69')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x6a'));db[_0x4d63('0x6b')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x6c'));db[_0x4d63('0x6d')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x6e'));db[_0x4d63('0x6f')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x70'));db[_0x4d63('0x71')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x72'));db[_0x4d63('0x73')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x74'));db[_0x4d63('0x75')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x76'));db[_0x4d63('0x77')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x78'));db[_0x4d63('0x79')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x7a'));db[_0x4d63('0x7b')]=db['sequelize'][_0x4d63('0x10')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x4d63('0x7c')]=db['sequelize']['import'](_0x4d63('0x7d'));db[_0x4d63('0x7e')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x7f'));db[_0x4d63('0x80')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x81'));db[_0x4d63('0x82')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x83'));db[_0x4d63('0x84')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x85'));db[_0x4d63('0x86')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x87'));db[_0x4d63('0x88')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x89'));db[_0x4d63('0x8a')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x8b'));db['Cdr']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/cdr/cdr.model');db[_0x4d63('0x8c')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x8d'));db[_0x4d63('0x8e')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x8f'));db[_0x4d63('0x90')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x91'));db[_0x4d63('0x92')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x93'));db['Template']=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x94'));db[_0x4d63('0x95')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x96'));db[_0x4d63('0x97')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x98'));db[_0x4d63('0x99')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x9a'));db[_0x4d63('0x9b')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x9c'));db[_0x4d63('0x9d')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x9e'));db[_0x4d63('0x9f')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xa0'));db[_0x4d63('0xa1')]=db[_0x4d63('0x1')]['import'](_0x4d63('0xa2'));db['AnalyticMetric']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xa3'));db[_0x4d63('0xa4')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xa5'));db['AnalyticTreeReport']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xa6'));db['SalesforceAccount']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xa7'));db[_0x4d63('0xa8')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xa9'));db[_0x4d63('0xaa')]=db[_0x4d63('0x1')]['import'](_0x4d63('0xab'));db['SugarcrmAccount']=db[_0x4d63('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x4d63('0xac')]=db[_0x4d63('0x1')]['import'](_0x4d63('0xad'));db[_0x4d63('0xae')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xaf'));db['DeskAccount']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/intDeskAccount/intDeskAccount.model');db[_0x4d63('0xb0')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xb1'));db[_0x4d63('0xb2')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xb3'));db[_0x4d63('0xb4')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/intZohoAccount/intZohoAccount.model');db[_0x4d63('0xb5')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xb6'));db[_0x4d63('0xb7')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xb8'));db[_0x4d63('0xb9')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xba'));db[_0x4d63('0xbb')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xbc'));db[_0x4d63('0xbd')]=db['sequelize'][_0x4d63('0x10')]('../api/intZendeskField/intZendeskField.model');db[_0x4d63('0xbe')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xbf'));db[_0x4d63('0xc0')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xc1'));db[_0x4d63('0xc2')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xc3'));db[_0x4d63('0xc4')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xc5'));db['VtigerConfiguration']=db[_0x4d63('0x1')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x4d63('0xc6')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xc7'));db['ServicenowAccount']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x4d63('0xc8')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xc9'));db[_0x4d63('0xca')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xcb'));db['Dynamics365Account']=db[_0x4d63('0x1')]['import'](_0x4d63('0xcc'));db[_0x4d63('0xcd')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xce'));db['Dynamics365Field']=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xcf'));db[_0x4d63('0xd0')]=db[_0x4d63('0x1')]['import'](_0x4d63('0xd1'));db['FreshsalesConfiguration']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x4d63('0x1')]['import'](_0x4d63('0xd2'));db[_0x4d63('0x99')]=db[_0x4d63('0x1')]['import']('../api/integration/integration.model');db[_0x4d63('0xd3')]=db[_0x4d63('0x1')]['import']('../api/network/network.model');db[_0x4d63('0xd4')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xd5'));db[_0x4d63('0xd6')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xd7'));db[_0x4d63('0xd8')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xd9'));db[_0x4d63('0xda')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xdb'));db[_0x4d63('0xdc')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/smsQueueReport/smsQueueReport.model');db[_0x4d63('0xdd')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xde'));db['SquareDetailsReport']=db[_0x4d63('0x1')]['import'](_0x4d63('0xdf'));db[_0x4d63('0xe0')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xe1'));db['Setting']=db[_0x4d63('0x1')]['import'](_0x4d63('0xe2'));db['SquareOdbc']=db[_0x4d63('0x1')]['import'](_0x4d63('0xe3'));db[_0x4d63('0xe4')]=db[_0x4d63('0x1')]['import'](_0x4d63('0xe5'));db[_0x4d63('0xe6')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xe7'));db[_0x4d63('0xe8')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xe9'));db['Team']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xea'));db[_0x4d63('0xeb')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xec'));db['Campaign']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xed'));db['Migration']=db[_0x4d63('0x1')]['import'](_0x4d63('0xee'));db['Attachment']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xef'));db[_0x4d63('0xf0')]=db['sequelize']['import'](_0x4d63('0xf1'));db['MailTransferReport']=db[_0x4d63('0x1')]['import'](_0x4d63('0xf2'));db[_0x4d63('0xf3')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xf4'));db['FaxTransferReport']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db['sequelize']['import'](_0x4d63('0xf5'));db[_0x4d63('0xf6')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xf7'));db[_0x4d63('0xf8')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xf9'));db[_0x4d63('0xfa')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/voicePrefix/voicePrefix.model');db[_0x4d63('0xfb')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xfc'));db['UserProfileSection']=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xfd'));db[_0x4d63('0xfe')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xff'));db[_0x4d63('0x100')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x101'));db[_0x4d63('0x102')]=db['sequelize']['import'](_0x4d63('0x103'));db[_0x4d63('0x104')]=db['sequelize']['import'](_0x4d63('0x105'));db[_0x4d63('0x106')]=db['sequelize']['import'](_0x4d63('0x107'));db[_0x4d63('0x108')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x109'));db['WhatsappQueueReport']=db['sequelize']['import'](_0x4d63('0x10a'));db[_0x4d63('0x10b')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x10c'));db[_0x4d63('0x10d')]=db['sequelize'][_0x4d63('0x10')]('../api/whatsappQueue/whatsappQueue.model');db[_0x4d63('0x10e')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x10f'));db[_0x4d63('0xf')][_0x4d63('0x110')](db[_0x4d63('0x111')],{'as':_0x4d63('0x111'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x113')});db['User']['hasMany'](db['VoiceRecording'],{'as':_0x4d63('0x114'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')][_0x4d63('0x115')](db['UserVoiceQueueRt'],{'as':_0x4d63('0x116'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')]['hasMany'](db['VoiceExtension'],{'as':_0x4d63('0x117'),'onDelete':'cascade','hooks':!![]});db[_0x4d63('0xf')][_0x4d63('0x115')](db[_0x4d63('0x77')],{'as':_0x4d63('0x118'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')][_0x4d63('0x115')](db['CmHopperHistory'],{'as':_0x4d63('0x119'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')][_0x4d63('0x115')](db[_0x4d63('0x7b')],{'as':'ReportAgentPreview','foreignKey':_0x4d63('0x113')});db['User']['hasMany'](db[_0x4d63('0x11a')],{'as':'OpenchannelInteractions','foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')][_0x4d63('0x115')](db[_0x4d63('0x63')],{'as':'ChatInteractions','foreignKey':_0x4d63('0x113')});db['User'][_0x4d63('0x115')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')][_0x4d63('0x115')](db[_0x4d63('0x4a')],{'as':_0x4d63('0x11b'),'foreignKey':_0x4d63('0x113')});db['User'][_0x4d63('0x115')](db[_0x4d63('0x3c')],{'as':_0x4d63('0x11c'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')][_0x4d63('0x115')](db[_0x4d63('0x106')],{'as':_0x4d63('0x11d'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')]['hasMany'](db[_0x4d63('0x100')],{'as':_0x4d63('0x11e'),'foreignKey':_0x4d63('0x11f')});db['User'][_0x4d63('0x120')](db[_0x4d63('0xfb')],{'as':_0x4d63('0xfb'),'foreignKey':_0x4d63('0x121')});db[_0x4d63('0xf')]['belongsToMany'](db[_0x4d63('0x6b')],{'as':_0x4d63('0x122'),'through':_0x4d63('0x123')});db[_0x4d63('0xf')]['belongsToMany'](db['CmContact'],{'as':_0x4d63('0x124'),'through':_0x4d63('0x125')});db['User'][_0x4d63('0x126')](db[_0x4d63('0xf8')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x4d63('0xf')][_0x4d63('0x126')](db['Team'],{'through':_0x4d63('0x127')});db[_0x4d63('0xf')]['belongsToMany'](db[_0x4d63('0x3c')],{'as':_0x4d63('0x11c'),'through':_0x4d63('0x128')});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x63')],{'as':_0x4d63('0x129'),'through':_0x4d63('0x12a')});db[_0x4d63('0xf')][_0x4d63('0x126')](db['FaxInteraction'],{'as':_0x4d63('0x11b'),'through':'user_has_fax_interactions'});db[_0x4d63('0xf')][_0x4d63('0x126')](db['SmsInteraction'],{'as':_0x4d63('0x12b'),'through':'user_has_sms_interactions'});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x11a')],{'as':_0x4d63('0x12c'),'through':_0x4d63('0x12d')});db[_0x4d63('0xf')]['belongsToMany'](db[_0x4d63('0x106')],{'as':_0x4d63('0x11d'),'through':_0x4d63('0x12e')});db[_0x4d63('0xf')]['belongsToMany'](db[_0x4d63('0x12f')],{'as':_0x4d63('0x130'),'through':_0x4d63('0x2b'),'required':![]});db[_0x4d63('0xf')]['belongsToMany'](db[_0x4d63('0x39')],{'as':'MailQueues','through':'UserMailQueue','required':![]});db['User']['belongsToMany'](db['ChatQueue'],{'as':_0x4d63('0x131'),'through':_0x4d63('0x132'),'required':![],'hooks':!![]});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x133')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x57')],{'as':'SmsQueues','through':_0x4d63('0x30'),'required':![]});db['User'][_0x4d63('0x126')](db[_0x4d63('0x134')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db['User'][_0x4d63('0x126')](db[_0x4d63('0x10d')],{'as':_0x4d63('0x135'),'through':_0x4d63('0x34'),'required':![]});db['User'][_0x4d63('0x126')](db[_0x4d63('0xf8')],{'through':_0x4d63('0x136')});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0xfa')],{'as':_0x4d63('0x137'),'through':_0x4d63('0x138'),'required':![]});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x5f')],{'as':_0x4d63('0x139'),'through':_0x4d63('0x13a')});db['User'][_0x4d63('0x126')](db['FaxAccount'],{'as':'FaxAccounts','through':_0x4d63('0x13b')});db['User'][_0x4d63('0x126')](db['MailAccount'],{'as':_0x4d63('0x13c'),'through':_0x4d63('0x13d')});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x59')],{'as':_0x4d63('0x13e'),'through':_0x4d63('0x13f')});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x140')],{'as':'SmsAccounts','through':_0x4d63('0x141')});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x102')],{'as':_0x4d63('0x142'),'through':_0x4d63('0x143')});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0xe4')],{'as':_0x4d63('0x144'),'through':_0x4d63('0x145')});db['VoiceChanSpy'][_0x4d63('0x115')](db['VoiceExtension'],{'as':_0x4d63('0x146'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x147')});db['VoiceContext'][_0x4d63('0x115')](db[_0x4d63('0x14')],{'onDelete':_0x4d63('0x112')});db[_0x4d63('0x14')]['hasMany'](db['VoiceExtension'],{'as':'Applications','onDelete':_0x4d63('0x112')});db[_0x4d63('0x16')][_0x4d63('0x126')](db[_0x4d63('0x90')],{'as':'Sounds','through':_0x4d63('0x148')});db['VoiceQueue'][_0x4d63('0x115')](db[_0x4d63('0x29')],{'as':_0x4d63('0x149'),'foreignKey':_0x4d63('0x14a')});db['VoiceQueue']['hasMany'](db[_0x4d63('0x73')],{'as':'Hoppers','foreignKey':_0x4d63('0x14a')});db[_0x4d63('0x12f')][_0x4d63('0x115')](db['CmHopperFinal'],{'as':_0x4d63('0x118'),'foreignKey':_0x4d63('0x14a')});db[_0x4d63('0x12f')]['hasMany'](db[_0x4d63('0x79')],{'as':_0x4d63('0x14b'),'foreignKey':_0x4d63('0x14a')});db[_0x4d63('0x12f')][_0x4d63('0x115')](db[_0x4d63('0x7b')],{'as':'ReportAgentPreview','foreignKey':_0x4d63('0x14a')});db[_0x4d63('0x12f')][_0x4d63('0x115')](db[_0x4d63('0x75')],{'as':_0x4d63('0x14c'),'foreignKey':_0x4d63('0x14a')});db[_0x4d63('0x12f')][_0x4d63('0x115')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x4d63('0x14a')});db['VoiceQueue'][_0x4d63('0x120')](db[_0x4d63('0x14d')],{'as':_0x4d63('0x14d'),'foreignKey':_0x4d63('0x14e')});db[_0x4d63('0x12f')][_0x4d63('0x120')](db['Trunk'],{'as':_0x4d63('0x14f'),'foreignKey':_0x4d63('0x150')});db[_0x4d63('0x12f')][_0x4d63('0x120')](db[_0x4d63('0x88')],{'as':_0x4d63('0x88'),'foreignKey':_0x4d63('0x151')});db[_0x4d63('0x12f')][_0x4d63('0x120')](db[_0x4d63('0x8a')],{'as':'mandatoryDispositionPause','foreignKey':_0x4d63('0x152')});db[_0x4d63('0x12f')][_0x4d63('0x126')](db['CmList'],{'as':_0x4d63('0x153'),'through':_0x4d63('0x154')});db[_0x4d63('0x12f')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x2b')});db[_0x4d63('0x12f')]['belongsToMany'](db[_0x4d63('0x156')],{'as':_0x4d63('0x157'),'through':_0x4d63('0x158')});db[_0x4d63('0x12f')][_0x4d63('0x126')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x159'),'through':_0x4d63('0x15a')});db[_0x4d63('0x15b')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':_0x4d63('0xf'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0x1a')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':'User','foreignKey':'UserId'});db[_0x4d63('0x111')][_0x4d63('0x115')](db[_0x4d63('0x1c')],{'as':_0x4d63('0x15c'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x4d63('0x15d')});db[_0x4d63('0x1c')][_0x4d63('0x120')](db[_0x4d63('0x111')],{'foreignKey':_0x4d63('0x15e'),'targetKey':_0x4d63('0x15d')});db[_0x4d63('0x1e')][_0x4d63('0x115')](db['VoiceQueueReport'],{'as':_0x4d63('0x15f'),'foreignKey':_0x4d63('0x160'),'constraints':![]});db[_0x4d63('0x1e')][_0x4d63('0x115')](db[_0x4d63('0x21')],{'as':'AgentReports','foreignKey':_0x4d63('0x160'),'constraints':![]});db[_0x4d63('0x1e')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':_0x4d63('0xf'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0x1e')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x36')][_0x4d63('0x120')](db[_0x4d63('0x163')],{'as':_0x4d63('0x163'),'foreignKey':_0x4d63('0x164')});db['MailServerOut'][_0x4d63('0x120')](db[_0x4d63('0x163')],{'as':_0x4d63('0x163'),'foreignKey':_0x4d63('0x164')});db['MailAccount'][_0x4d63('0x110')](db[_0x4d63('0x36')],{'as':'Imap','onDelete':_0x4d63('0x112')});db[_0x4d63('0x163')][_0x4d63('0x110')](db[_0x4d63('0x165')],{'as':'Smtp','onDelete':_0x4d63('0x112')});db[_0x4d63('0x163')][_0x4d63('0x115')](db['Disposition'],{'as':_0x4d63('0x166'),'foreignKey':_0x4d63('0x164')});db[_0x4d63('0x163')]['hasMany'](db[_0x4d63('0x82')],{'as':_0x4d63('0x167'),'foreignKey':_0x4d63('0x164')});db[_0x4d63('0x163')][_0x4d63('0x115')](db[_0x4d63('0x3e')],{'as':'Messages','foreignKey':_0x4d63('0x164')});db[_0x4d63('0x163')][_0x4d63('0x115')](db[_0x4d63('0x3c')],{'as':_0x4d63('0x168')});db['MailAccount'][_0x4d63('0x115')](db[_0x4d63('0x40')],{'as':_0x4d63('0x169')});db['MailAccount'][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':'List','foreignKey':_0x4d63('0x16a')});db[_0x4d63('0x163')][_0x4d63('0x120')](db[_0x4d63('0x16b')],{'as':_0x4d63('0x16b'),'foreignKey':_0x4d63('0x16c')});db[_0x4d63('0x163')]['belongsTo'](db[_0x4d63('0x8a')],{'as':_0x4d63('0x16d'),'foreignKey':_0x4d63('0x152')});db[_0x4d63('0x163')]['belongsToMany'](db[_0x4d63('0xf')],{'as':'Agents','through':_0x4d63('0x13d')});db[_0x4d63('0x39')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':'Agents','through':_0x4d63('0x16e')});db[_0x4d63('0x39')][_0x4d63('0x126')](db[_0x4d63('0x156')],{'through':_0x4d63('0x16f'),'as':_0x4d63('0x157')});db[_0x4d63('0x3c')][_0x4d63('0x115')](db[_0x4d63('0x3e')],{'as':_0x4d63('0x15c'),'onDelete':'cascade','foreignKey':_0x4d63('0x170')});db[_0x4d63('0x3c')][_0x4d63('0x120')](db['MailAccount'],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x164')});db[_0x4d63('0x3c')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x3c')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':'Owner','foreignKey':'UserId'});db['MailInteraction']['belongsToMany'](db[_0x4d63('0x92')],{'through':_0x4d63('0x172'),'as':_0x4d63('0x173')});db[_0x4d63('0x3c')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x172'),'as':_0x4d63('0x174')});db[_0x4d63('0x3c')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x175'),'through':_0x4d63('0x128'),'foreignKey':_0x4d63('0x170')});db['MailMessage'][_0x4d63('0x115')](db[_0x4d63('0x176')],{'as':_0x4d63('0x177'),'onDelete':_0x4d63('0x112')});db[_0x4d63('0x3e')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':_0x4d63('0xf')});db[_0x4d63('0x3e')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x161')});db[_0x4d63('0x3e')][_0x4d63('0x120')](db['MailInteraction'],{'as':_0x4d63('0x178'),'foreignKey':_0x4d63('0x170')});db[_0x4d63('0x3e')][_0x4d63('0x120')](db[_0x4d63('0x163')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x4d63('0x40')][_0x4d63('0x120')](db['User'],{'onDelete':'restrict'});db['MailApplication'][_0x4d63('0x120')](db[_0x4d63('0x39')],{'onDelete':_0x4d63('0x179')});db['MailApplication'][_0x4d63('0x120')](db[_0x4d63('0x163')],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x40')][_0x4d63('0x120')](db[_0x4d63('0x88')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['MailApplication'][_0x4d63('0x120')](db[_0x4d63('0x92')],{'onDelete':_0x4d63('0x179'),'foreignKey':_0x4d63('0x17a')});db[_0x4d63('0x42')][_0x4d63('0x120')](db[_0x4d63('0x163')],{});db[_0x4d63('0x42')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':'ListId'});db['MailQueueReport']['belongsTo'](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x42')][_0x4d63('0x120')](db[_0x4d63('0x3c')],{});db[_0x4d63('0x42')][_0x4d63('0x120')](db[_0x4d63('0x3e')],{});db['MailQueueReport'][_0x4d63('0x120')](db['User'],{});db[_0x4d63('0x42')][_0x4d63('0x120')](db['MailQueue'],{});db[_0x4d63('0x17c')]['hasMany'](db['DashboardItem'],{'as':_0x4d63('0x17d'),'onDelete':'cascade'});db[_0x4d63('0x46')][_0x4d63('0x115')](db[_0x4d63('0x84')],{'as':_0x4d63('0x166'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0x4d63('0x115')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4d63('0x17e')});db[_0x4d63('0x46')][_0x4d63('0x115')](db['FaxInteraction'],{'as':_0x4d63('0x168')});db[_0x4d63('0x46')][_0x4d63('0x115')](db[_0x4d63('0x48')],{'as':_0x4d63('0x169')});db[_0x4d63('0x46')]['hasMany'](db[_0x4d63('0x14')],{'as':_0x4d63('0x17f'),'onDelete':'cascade'});db['FaxAccount'][_0x4d63('0x115')](db[_0x4d63('0x4c')],{'as':_0x4d63('0x15c')});db[_0x4d63('0x46')][_0x4d63('0x120')](db[_0x4d63('0x14d')],{'as':_0x4d63('0x14d')});db[_0x4d63('0x46')][_0x4d63('0x120')](db['CmList'],{'as':'List','foreignKey':_0x4d63('0x16a')});db[_0x4d63('0x46')][_0x4d63('0x120')](db['Pause'],{'as':_0x4d63('0x16d'),'foreignKey':_0x4d63('0x152')});db[_0x4d63('0x46')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':'user_has_fax_accounts'});db[_0x4d63('0x48')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x48')][_0x4d63('0x120')](db['FaxQueue'],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x48')]['belongsTo'](db[_0x4d63('0x46')],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x48')][_0x4d63('0x120')](db[_0x4d63('0x92')],{'onDelete':_0x4d63('0x179'),'foreignKey':'TagId'});db['FaxInteraction']['hasMany'](db[_0x4d63('0x4c')],{'as':_0x4d63('0x15c'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x180')});db[_0x4d63('0x4a')][_0x4d63('0x120')](db[_0x4d63('0x46')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x4d63('0x4a')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':'Contact','foreignKey':_0x4d63('0x162')});db[_0x4d63('0x4a')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':'Owner','foreignKey':_0x4d63('0x113')});db[_0x4d63('0x4a')]['belongsToMany'](db['Tag'],{'through':_0x4d63('0x181'),'as':_0x4d63('0x173')});db[_0x4d63('0x4a')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x181'),'as':'ThroughTags'});db[_0x4d63('0x4a')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x175'),'through':_0x4d63('0x182'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x4d63('0x120')](db[_0x4d63('0xf')],{'onDelete':_0x4d63('0x112'),'as':'User'});db['FaxMessage'][_0x4d63('0x120')](db[_0x4d63('0x4a')],{'as':_0x4d63('0x178'),'foreignKey':_0x4d63('0x180')});db['FaxMessage'][_0x4d63('0x120')](db[_0x4d63('0x71')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x161')});db[_0x4d63('0x4c')][_0x4d63('0x120')](db[_0x4d63('0x176')],{'as':_0x4d63('0x176'),'foreignKey':_0x4d63('0x183')});db[_0x4d63('0x4c')]['belongsTo'](db[_0x4d63('0x46')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x17e')});db[_0x4d63('0x133')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':'UserFaxQueue'});db[_0x4d63('0x133')][_0x4d63('0x126')](db[_0x4d63('0x156')],{'through':_0x4d63('0x184'),'as':_0x4d63('0x157')});db[_0x4d63('0x4f')][_0x4d63('0x120')](db[_0x4d63('0x46')],{});db[_0x4d63('0x4f')]['belongsTo'](db['CmList'],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a')});db['FaxQueueReport'][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':'Contact','foreignKey':'ContactId'});db['FaxQueueReport'][_0x4d63('0x120')](db[_0x4d63('0x4a')],{});db[_0x4d63('0x4f')]['belongsTo'](db[_0x4d63('0x4c')],{});db[_0x4d63('0x4f')]['belongsTo'](db[_0x4d63('0xf')],{});db[_0x4d63('0x4f')][_0x4d63('0x120')](db[_0x4d63('0x133')],{});db[_0x4d63('0x140')][_0x4d63('0x115')](db[_0x4d63('0x84')],{'as':_0x4d63('0x166'),'foreignKey':_0x4d63('0x185')});db[_0x4d63('0x140')][_0x4d63('0x115')](db[_0x4d63('0x82')],{'as':_0x4d63('0x167'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db['SmsMessage'],{'as':'Messages','foreignKey':_0x4d63('0x185')});db['SmsAccount'][_0x4d63('0x115')](db[_0x4d63('0x53')],{'as':_0x4d63('0x168')});db[_0x4d63('0x140')]['hasMany'](db[_0x4d63('0x51')],{'as':_0x4d63('0x169')});db[_0x4d63('0x140')]['belongsTo'](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a')});db['SmsAccount'][_0x4d63('0x120')](db['Pause'],{'as':_0x4d63('0x16d'),'foreignKey':_0x4d63('0x152')});db[_0x4d63('0x140')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x4d63('0x51')]['belongsTo'](db[_0x4d63('0xf')],{'onDelete':'restrict'});db[_0x4d63('0x51')][_0x4d63('0x120')](db['SmsQueue'],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x51')][_0x4d63('0x120')](db[_0x4d63('0x140')],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x51')][_0x4d63('0x120')](db['Interval'],{'onDelete':_0x4d63('0x179'),'foreignKey':_0x4d63('0x151')});db[_0x4d63('0x51')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x4d63('0x53')][_0x4d63('0x115')](db[_0x4d63('0x55')],{'as':_0x4d63('0x15c'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x186')});db[_0x4d63('0x53')][_0x4d63('0x120')](db['SmsAccount'],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x185')});db[_0x4d63('0x53')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x53')][_0x4d63('0x120')](db['User'],{'as':_0x4d63('0x187'),'foreignKey':_0x4d63('0x113')});db['SmsInteraction'][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x188'),'as':_0x4d63('0x173')});db[_0x4d63('0x53')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':'sms_interaction_has_tags','as':_0x4d63('0x174')});db[_0x4d63('0x53')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x175'),'through':'user_has_sms_interactions','foreignKey':_0x4d63('0x186')});db[_0x4d63('0x55')][_0x4d63('0x120')](db['User'],{'as':_0x4d63('0xf')});db[_0x4d63('0x55')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'onDelete':'cascade','as':'Contact'});db[_0x4d63('0x55')][_0x4d63('0x120')](db[_0x4d63('0x53')],{'onDelete':_0x4d63('0x112'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0x4d63('0x55')][_0x4d63('0x120')](db[_0x4d63('0x140')],{'as':'Account','foreignKey':_0x4d63('0x185')});db[_0x4d63('0x57')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x30'),'foreignKey':_0x4d63('0x189')});db['SmsQueue'][_0x4d63('0x126')](db['Team'],{'through':'team_has_sms_queues','as':_0x4d63('0x157')});db['OpenchannelAccount'][_0x4d63('0x115')](db[_0x4d63('0x84')],{'as':_0x4d63('0x166'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x59')][_0x4d63('0x115')](db[_0x4d63('0x82')],{'as':_0x4d63('0x167'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x59')][_0x4d63('0x115')](db[_0x4d63('0x11a')],{'as':_0x4d63('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x4d63('0x59')]['hasMany'](db[_0x4d63('0x5c')],{'as':_0x4d63('0x15c'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x59')][_0x4d63('0x115')](db['OpenchannelApplication'],{'as':_0x4d63('0x169'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x59')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':'ListId'});db[_0x4d63('0x59')][_0x4d63('0x120')](db['Pause'],{'as':_0x4d63('0x16d'),'foreignKey':_0x4d63('0x152')});db[_0x4d63('0x59')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x13f')});db[_0x4d63('0x18b')]['belongsTo'](db[_0x4d63('0xf')],{'onDelete':'restrict'});db[_0x4d63('0x18b')][_0x4d63('0x120')](db['OpenchannelQueue'],{'onDelete':_0x4d63('0x179'),'foreignKey':'OpenchannelQueueId'});db[_0x4d63('0x18b')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x4d63('0x179'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x18b')][_0x4d63('0x120')](db['Interval'],{'onDelete':_0x4d63('0x179'),'foreignKey':_0x4d63('0x151')});db[_0x4d63('0x18b')][_0x4d63('0x120')](db[_0x4d63('0x92')],{'onDelete':_0x4d63('0x179'),'foreignKey':_0x4d63('0x17a')});db['OpenchannelInteraction'][_0x4d63('0x115')](db[_0x4d63('0x5c')],{'as':_0x4d63('0x15c'),'onDelete':_0x4d63('0x112'),'foreignKey':'OpenchannelInteractionId'});db[_0x4d63('0x11a')][_0x4d63('0x120')](db[_0x4d63('0x59')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x11a')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x11a')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':_0x4d63('0x187'),'foreignKey':_0x4d63('0x113')});db['OpenchannelInteraction'][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x18c'),'as':_0x4d63('0x173')});db[_0x4d63('0x11a')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x18c'),'as':_0x4d63('0x174')});db['OpenchannelInteraction'][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':'Users','through':_0x4d63('0x12d'),'foreignKey':'OpenchannelInteractionId'});db[_0x4d63('0x5c')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0xf')});db[_0x4d63('0x5c')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x161')});db[_0x4d63('0x5c')][_0x4d63('0x120')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x4d63('0x178'),'foreignKey':_0x4d63('0x18d')});db[_0x4d63('0x5c')][_0x4d63('0x120')](db[_0x4d63('0x176')],{'as':'Attachment','foreignKey':_0x4d63('0x183')});db[_0x4d63('0x5c')][_0x4d63('0x120')](db[_0x4d63('0x59')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x134')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x32'),'foreignKey':_0x4d63('0x18e')});db[_0x4d63('0x134')]['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':_0x4d63('0x157')});db['ChatWebsite'][_0x4d63('0x115')](db[_0x4d63('0x84')],{'as':_0x4d63('0x166'),'foreignKey':_0x4d63('0x18f')});db[_0x4d63('0x5f')][_0x4d63('0x115')](db[_0x4d63('0x82')],{'as':_0x4d63('0x167'),'foreignKey':_0x4d63('0x18f')});db[_0x4d63('0x5f')]['hasMany'](db[_0x4d63('0x6d')],{'as':_0x4d63('0x190')});db[_0x4d63('0x5f')][_0x4d63('0x115')](db['ChatInteraction'],{'as':_0x4d63('0x168')});db[_0x4d63('0x5f')][_0x4d63('0x115')](db[_0x4d63('0x62')],{'as':_0x4d63('0x169')});db[_0x4d63('0x5f')][_0x4d63('0x115')](db[_0x4d63('0x65')],{'as':_0x4d63('0x15c')});db[_0x4d63('0x5f')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a')});db[_0x4d63('0x5f')][_0x4d63('0x120')](db['Interval'],{'as':'Interval','foreignKey':_0x4d63('0x151')});db['ChatWebsite'][_0x4d63('0x120')](db[_0x4d63('0x8a')],{'as':_0x4d63('0x16d'),'foreignKey':_0x4d63('0x152')});db[_0x4d63('0x5f')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':'user_has_chat_websites'});db[_0x4d63('0x60')][_0x4d63('0x120')](db[_0x4d63('0x59')],{});db[_0x4d63('0x60')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a')});db['OpenchannelQueueReport'][_0x4d63('0x120')](db['CmContact'],{'as':_0x4d63('0x161'),'foreignKey':'ContactId'});db[_0x4d63('0x60')][_0x4d63('0x120')](db[_0x4d63('0x11a')],{});db['OpenchannelQueueReport'][_0x4d63('0x120')](db[_0x4d63('0x5c')],{});db[_0x4d63('0x60')][_0x4d63('0x120')](db['User'],{});db[_0x4d63('0x60')][_0x4d63('0x120')](db[_0x4d63('0x134')],{});db[_0x4d63('0x62')][_0x4d63('0x120')](db['User'],{'as':'Agent','foreignKey':_0x4d63('0x113'),'onDelete':'restrict'});db[_0x4d63('0x62')][_0x4d63('0x120')](db[_0x4d63('0x69')],{'as':'Queue','foreignKey':_0x4d63('0x191'),'onDelete':_0x4d63('0x179')});db[_0x4d63('0x62')]['belongsTo'](db['ChatWebsite'],{'as':_0x4d63('0x192'),'foreignKey':'ChatWebsiteId','onDelete':_0x4d63('0x179')});db[_0x4d63('0x62')][_0x4d63('0x120')](db['Tag'],{'onDelete':_0x4d63('0x179'),'foreignKey':'TagId'});db[_0x4d63('0x63')][_0x4d63('0x115')](db['ChatMessage'],{'as':_0x4d63('0x15c'),'onDelete':'cascade','foreignKey':_0x4d63('0x193')});db[_0x4d63('0x63')][_0x4d63('0x120')](db[_0x4d63('0x5f')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x18f')});db[_0x4d63('0x63')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x63')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':_0x4d63('0x187'),'foreignKey':'UserId'});db[_0x4d63('0x63')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x194'),'as':_0x4d63('0x173')});db[_0x4d63('0x63')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':'chat_interaction_has_tags','as':_0x4d63('0x174')});db[_0x4d63('0x63')]['belongsToMany'](db[_0x4d63('0xf')],{'as':_0x4d63('0x175'),'through':_0x4d63('0x12a'),'foreignKey':_0x4d63('0x193')});db[_0x4d63('0x65')]['belongsTo'](db[_0x4d63('0xf')],{'onDelete':'cascade','as':_0x4d63('0xf')});db[_0x4d63('0x65')]['belongsTo'](db[_0x4d63('0x71')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x65')][_0x4d63('0x120')](db[_0x4d63('0x63')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x178'),'foreignKey':_0x4d63('0x193')});db[_0x4d63('0x65')][_0x4d63('0x120')](db[_0x4d63('0x176')],{'as':_0x4d63('0x176'),'foreignKey':_0x4d63('0x183')});db[_0x4d63('0x65')]['belongsTo'](db[_0x4d63('0x5f')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x18f')});db[_0x4d63('0x67')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x67')]['belongsTo'](db[_0x4d63('0x5f')],{'as':'Account','foreignKey':_0x4d63('0x18f')});db[_0x4d63('0x69')][_0x4d63('0x126')](db['User'],{'as':_0x4d63('0x155'),'through':_0x4d63('0x132'),'hooks':!![]});db[_0x4d63('0x69')][_0x4d63('0x126')](db[_0x4d63('0x156')],{'through':'team_has_chat_queues','as':_0x4d63('0x157')});db[_0x4d63('0x6b')][_0x4d63('0x115')](db[_0x4d63('0xd6')],{'as':_0x4d63('0x15c'),'foreignKey':_0x4d63('0x195'),'onDelete':'cascade'});db[_0x4d63('0x6b')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x149'),'through':_0x4d63('0x123')});db[_0x4d63('0x6d')]['belongsTo'](db[_0x4d63('0x5f')],{'as':'Website','foreignKey':_0x4d63('0x18f')});db[_0x4d63('0x6f')]['hasMany'](db[_0x4d63('0x71')],{'as':_0x4d63('0x124'),'foreignKey':_0x4d63('0x196')});db[_0x4d63('0x71')][_0x4d63('0x115')](db[_0x4d63('0x73')],{'as':'Hoppers','foreignKey':_0x4d63('0x162')});db['CmContact'][_0x4d63('0x115')](db[_0x4d63('0x77')],{'as':_0x4d63('0x118'),'foreignKey':_0x4d63('0x162')});db['CmContact'][_0x4d63('0x115')](db[_0x4d63('0x79')],{'as':_0x4d63('0x14b'),'foreignKey':'ContactId'});db[_0x4d63('0x71')]['hasMany'](db[_0x4d63('0x7b')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0x4d63('0x71')][_0x4d63('0x115')](db['JscriptySessionReport'],{'as':_0x4d63('0x197'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x71')]['hasMany'](db[_0x4d63('0x11a')],{'as':_0x4d63('0x12c'),'foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x179')});db[_0x4d63('0x71')][_0x4d63('0x115')](db['ChatInteraction'],{'as':_0x4d63('0x129'),'foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x179')});db[_0x4d63('0x71')][_0x4d63('0x115')](db[_0x4d63('0x53')],{'as':_0x4d63('0x12b'),'foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x179')});db[_0x4d63('0x71')][_0x4d63('0x115')](db[_0x4d63('0x4a')],{'as':_0x4d63('0x11b'),'foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x179')});db[_0x4d63('0x71')][_0x4d63('0x115')](db[_0x4d63('0x3c')],{'as':_0x4d63('0x11c'),'foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x179')});db['CmContact'][_0x4d63('0x120')](db[_0x4d63('0x6f')],{'as':'Company','foreignKey':_0x4d63('0x196')});db[_0x4d63('0x71')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':'ListId','onDelete':_0x4d63('0x112')});db[_0x4d63('0x71')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x175'),'through':_0x4d63('0x125')});db['CmContact'][_0x4d63('0x126')](db['Tag'],{'as':_0x4d63('0x173'),'through':_0x4d63('0x198')});db[_0x4d63('0x71')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x198'),'as':'ThroughTags'});db[_0x4d63('0x73')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':'Contact','foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x112')});db[_0x4d63('0x73')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x4d63('0x73')][_0x4d63('0x120')](db['User'],{'as':_0x4d63('0x199'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0x73')]['belongsTo'](db[_0x4d63('0x12f')],{'as':_0x4d63('0x19a'),'foreignKey':_0x4d63('0x14a'),'onDelete':'cascade'});db['CmHopper'][_0x4d63('0x120')](db[_0x4d63('0x19b')],{'as':_0x4d63('0x19b'),'foreignKey':_0x4d63('0x19c'),'onDelete':_0x4d63('0x112')});db[_0x4d63('0x73')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':'Owner','foreignKey':_0x4d63('0x19d')});db['CmHopperBlack']['belongsTo'](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x112')});db[_0x4d63('0x75')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a'),'onDelete':_0x4d63('0x112')});db['CmHopperBlack'][_0x4d63('0x120')](db['VoiceQueue'],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x4d63('0x112')});db[_0x4d63('0x75')][_0x4d63('0x120')](db[_0x4d63('0x19b')],{'as':'Campaign','foreignKey':_0x4d63('0x19c'),'onDelete':'cascade'});db[_0x4d63('0x80')][_0x4d63('0x115')](db[_0x4d63('0x86')],{'as':{'plural':'All','singular':_0x4d63('0x19e')},'foreignKey':_0x4d63('0x19f'),'onDelete':_0x4d63('0x112'),'hooks':!![]});db[_0x4d63('0x80')][_0x4d63('0x115')](db[_0x4d63('0x86')],{'as':{'plural':'Any','singular':_0x4d63('0x1a0')},'foreignKey':_0x4d63('0x1a1'),'onDelete':_0x4d63('0x112'),'hooks':!![]});db[_0x4d63('0x80')][_0x4d63('0x115')](db[_0x4d63('0x7e')],{'as':_0x4d63('0x1a2'),'foreignKey':_0x4d63('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0x4d63('0x88')]['hasMany'](db[_0x4d63('0x88')],{'as':_0x4d63('0x1a4'),'foreignKey':_0x4d63('0x151'),'onDelete':_0x4d63('0x112'),'hooks':!![],'required':![]});db[_0x4d63('0x88')]['hasMany'](db['VoiceExtension'],{'as':_0x4d63('0x117'),'foreignKey':_0x4d63('0x151'),'onDelete':'restrict'});db['Interval']['hasMany'](db[_0x4d63('0x40')],{'as':_0x4d63('0x1a5'),'foreignKey':'IntervalId'});db[_0x4d63('0x88')][_0x4d63('0x115')](db[_0x4d63('0x62')],{'as':_0x4d63('0x1a6'),'foreignKey':_0x4d63('0x151')});db[_0x4d63('0x88')][_0x4d63('0x115')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0x4d63('0x151')});db[_0x4d63('0x88')][_0x4d63('0x115')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x4d63('0x151')});db[_0x4d63('0x8e')][_0x4d63('0x120')](db[_0x4d63('0x163')],{});db['Schedule']['belongsTo'](db[_0x4d63('0x9f')],{'foreignKey':_0x4d63('0x1a7')});db[_0x4d63('0x8e')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x4d63('0x1a8')});db[_0x4d63('0x90')][_0x4d63('0x126')](db[_0x4d63('0x16')],{'as':_0x4d63('0x1a9'),'through':_0x4d63('0x148'),'onDelete':_0x4d63('0x179')});db[_0x4d63('0x92')][_0x4d63('0x126')](db[_0x4d63('0x71')],{'through':_0x4d63('0x198')});db[_0x4d63('0x92')][_0x4d63('0x126')](db['ChatInteraction'],{'through':_0x4d63('0x194')});db[_0x4d63('0x92')][_0x4d63('0x126')](db['MailInteraction'],{'through':_0x4d63('0x172')});db[_0x4d63('0x92')][_0x4d63('0x126')](db['SmsInteraction'],{'through':_0x4d63('0x188')});db['Tag']['belongsToMany'](db[_0x4d63('0x4a')],{'through':_0x4d63('0x181')});db[_0x4d63('0x92')][_0x4d63('0x126')](db['OpenchannelInteraction'],{'through':_0x4d63('0x18c')});db[_0x4d63('0x92')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x4d63('0x1aa')});db[_0x4d63('0x95')][_0x4d63('0x115')](db[_0x4d63('0x86')],{'as':{'plural':_0x4d63('0x1ab'),'singular':_0x4d63('0x1ac')},'foreignKey':_0x4d63('0x1ad'),'onDelete':_0x4d63('0x112'),'hooks':!![]});db[_0x4d63('0x95')][_0x4d63('0x115')](db[_0x4d63('0x86')],{'as':{'plural':_0x4d63('0x1ae'),'singular':_0x4d63('0x1af')},'foreignKey':'TriggerAnyId','onDelete':_0x4d63('0x112'),'hooks':!![]});db[_0x4d63('0x95')]['hasMany'](db[_0x4d63('0x7e')],{'as':_0x4d63('0x1a2'),'foreignKey':_0x4d63('0x1b0'),'onDelete':_0x4d63('0x112'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x4d63('0xa4')],{'as':_0x4d63('0x1b1'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1a8'),'hooks':!![]});db[_0x4d63('0x9f')][_0x4d63('0x115')](db[_0x4d63('0xa4')],{'as':_0x4d63('0x1b1'),'onDelete':'cascade','foreignKey':_0x4d63('0x1a7')});db[_0x4d63('0x1b2')][_0x4d63('0x115')](db[_0x4d63('0xa4')],{'as':_0x4d63('0x1b1'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b3')});db[_0x4d63('0xa4')]['belongsTo'](db[_0x4d63('0x1b2')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0x4d63('0x115')](db[_0x4d63('0xa8')],{'as':_0x4d63('0x1b4'),'onDelete':'cascade','foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0xa8')][_0x4d63('0x115')](db[_0x4d63('0xaa')],{'as':_0x4d63('0x1b6'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xa8')][_0x4d63('0x115')](db['SalesforceField'],{'as':_0x4d63('0x1b8'),'onDelete':'cascade','foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xa8')][_0x4d63('0x115')](db[_0x4d63('0xaa')],{'as':_0x4d63('0x1b1'),'onDelete':'cascade','foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xa8')][_0x4d63('0x120')](db[_0x4d63('0x1bb')],{'as':'Account','foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0xaa')][_0x4d63('0x115')](db[_0x4d63('0xaa')],{'as':'Subject','foreignKey':_0x4d63('0x1b7')});db['SalesforceField'][_0x4d63('0x115')](db['SalesforceField'],{'as':_0x4d63('0x1bc'),'foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xaa')]['hasMany'](db[_0x4d63('0xaa')],{'as':_0x4d63('0x1bd'),'foreignKey':'FieldId'});db[_0x4d63('0xaa')]['belongsTo'](db[_0x4d63('0x97')],{'as':_0x4d63('0x97'),'foreignKey':'VariableId'});db[_0x4d63('0x1be')][_0x4d63('0x115')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0xac')]['hasMany'](db[_0x4d63('0xae')],{'as':'Subjects','onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xac')][_0x4d63('0x115')](db[_0x4d63('0xae')],{'as':_0x4d63('0x1b8'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b9')});db['SugarcrmConfiguration'][_0x4d63('0x115')](db[_0x4d63('0xae')],{'as':_0x4d63('0x1b1'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xac')][_0x4d63('0x120')](db['SugarcrmAccount'],{'as':_0x4d63('0x171'),'foreignKey':'AccountId'});db[_0x4d63('0xae')][_0x4d63('0x115')](db[_0x4d63('0xae')],{'as':_0x4d63('0x1bf'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xae')][_0x4d63('0x115')](db[_0x4d63('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x4d63('0x1bd'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xae')][_0x4d63('0x120')](db[_0x4d63('0x97')],{'as':_0x4d63('0x97'),'foreignKey':'VariableId'});db[_0x4d63('0x1c0')]['hasMany'](db['DeskConfiguration'],{'as':_0x4d63('0x1b4'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b5')});db['DeskConfiguration'][_0x4d63('0x115')](db[_0x4d63('0xb2')],{'as':_0x4d63('0x1b6'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xb0')][_0x4d63('0x115')](db[_0x4d63('0xb2')],{'as':'Descriptions','onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xb0')][_0x4d63('0x115')](db[_0x4d63('0xb2')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x4d63('0x1ba')});db['DeskConfiguration'][_0x4d63('0x120')](db[_0x4d63('0x1c0')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db['DeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0x4d63('0x1c1')});db[_0x4d63('0xb2')][_0x4d63('0x115')](db[_0x4d63('0xb2')],{'as':_0x4d63('0x1bf'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xb2')]['hasMany'](db['DeskField'],{'as':_0x4d63('0x1bc'),'foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xb2')][_0x4d63('0x115')](db[_0x4d63('0xb2')],{'as':_0x4d63('0x1bd'),'foreignKey':'FieldId'});db[_0x4d63('0xb2')][_0x4d63('0x120')](db[_0x4d63('0x97')],{'as':_0x4d63('0x97'),'foreignKey':_0x4d63('0x1c2')});db[_0x4d63('0xb4')][_0x4d63('0x115')](db[_0x4d63('0xb5')],{'as':_0x4d63('0x1b4'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b5')});db['ZohoConfiguration']['hasMany'](db[_0x4d63('0xb7')],{'as':'Subjects','onDelete':_0x4d63('0x112'),'foreignKey':'SubjectId'});db[_0x4d63('0xb5')]['hasMany'](db[_0x4d63('0xb7')],{'as':_0x4d63('0x1b8'),'onDelete':'cascade','foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xb5')][_0x4d63('0x115')](db['ZohoField'],{'as':_0x4d63('0x1b1'),'onDelete':_0x4d63('0x112'),'foreignKey':'FieldId'});db[_0x4d63('0xb5')][_0x4d63('0x120')](db[_0x4d63('0xb4')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db['ZohoField']['hasMany'](db[_0x4d63('0xb7')],{'as':'Subject','foreignKey':_0x4d63('0x1b7')});db['ZohoField'][_0x4d63('0x115')](db[_0x4d63('0xb7')],{'as':_0x4d63('0x1bc'),'foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xb7')]['hasMany'](db[_0x4d63('0xb7')],{'as':_0x4d63('0x1bd'),'foreignKey':'FieldId'});db[_0x4d63('0xb7')][_0x4d63('0x120')](db['Variable'],{'as':_0x4d63('0x97'),'foreignKey':_0x4d63('0x1c2')});db[_0x4d63('0xb9')]['hasMany'](db['ZendeskConfiguration'],{'as':_0x4d63('0x1b4'),'onDelete':'cascade','foreignKey':_0x4d63('0x1b5')});db['ZendeskConfiguration'][_0x4d63('0x115')](db[_0x4d63('0xbd')],{'as':_0x4d63('0x1b6'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xbb')][_0x4d63('0x115')](db['ZendeskField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x4d63('0xbb')][_0x4d63('0x115')](db[_0x4d63('0xbd')],{'as':_0x4d63('0x1b1'),'foreignKey':'FieldId'});db[_0x4d63('0xbb')]['belongsTo'](db['ZendeskAccount'],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db['ZendeskConfiguration'][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x1c3')});db[_0x4d63('0xbd')][_0x4d63('0x115')](db[_0x4d63('0xbd')],{'as':'Subject','foreignKey':_0x4d63('0x1b7')});db['ZendeskField']['hasMany'](db[_0x4d63('0xbd')],{'as':_0x4d63('0x1bc'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x4d63('0x115')](db[_0x4d63('0xbd')],{'as':_0x4d63('0x1bd'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xbd')]['belongsTo'](db['Variable'],{'as':_0x4d63('0x97'),'foreignKey':_0x4d63('0x1c2')});db[_0x4d63('0xbe')][_0x4d63('0x115')](db[_0x4d63('0xc0')],{'as':_0x4d63('0x1b4'),'onDelete':_0x4d63('0x112'),'foreignKey':'AccountId'});db[_0x4d63('0xc0')]['hasMany'](db['FreshdeskField'],{'as':_0x4d63('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x4d63('0xc0')][_0x4d63('0x115')](db[_0x4d63('0xc2')],{'as':'Descriptions','onDelete':_0x4d63('0x112'),'foreignKey':'DescriptionId'});db[_0x4d63('0xc0')][_0x4d63('0x115')](db[_0x4d63('0xc2')],{'as':_0x4d63('0x1b1'),'onDelete':'cascade','foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xc0')][_0x4d63('0x120')](db[_0x4d63('0xbe')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0xc0')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x4d63('0xc2')]['hasMany'](db[_0x4d63('0xc2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4d63('0xc2')][_0x4d63('0x115')](db['FreshdeskField'],{'as':'Description','foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xc2')][_0x4d63('0x115')](db['FreshdeskField'],{'as':_0x4d63('0x1bd'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xc2')][_0x4d63('0x120')](db[_0x4d63('0x97')],{'as':'Variable','foreignKey':_0x4d63('0x1c2')});db[_0x4d63('0xc4')]['hasMany'](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0x1c4')][_0x4d63('0x115')](db[_0x4d63('0xc6')],{'as':'Subjects','foreignKey':_0x4d63('0x1b7')});db['VtigerConfiguration']['hasMany'](db[_0x4d63('0xc6')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x4d63('0x1c4')][_0x4d63('0x115')](db[_0x4d63('0xc6')],{'as':_0x4d63('0x1b1'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0x1c4')][_0x4d63('0x120')](db['VtigerAccount'],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0xc6')][_0x4d63('0x115')](db[_0x4d63('0xc6')],{'as':_0x4d63('0x1bf'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xc6')][_0x4d63('0x115')](db[_0x4d63('0xc6')],{'as':_0x4d63('0x1bc'),'foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xc6')][_0x4d63('0x115')](db[_0x4d63('0xc6')],{'as':_0x4d63('0x1bd'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0x4d63('0x97')],{'as':_0x4d63('0x97'),'foreignKey':'VariableId'});db[_0x4d63('0x1c5')][_0x4d63('0x115')](db[_0x4d63('0xc8')],{'as':_0x4d63('0x1b4'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b5')});db['ServicenowConfiguration'][_0x4d63('0x115')](db[_0x4d63('0xca')],{'as':'Subjects','foreignKey':_0x4d63('0x1b7')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x4d63('0x1b8'),'foreignKey':'DescriptionId'});db[_0x4d63('0xc8')][_0x4d63('0x115')](db[_0x4d63('0xca')],{'as':_0x4d63('0x1b1'),'foreignKey':_0x4d63('0x1ba')});db['ServicenowConfiguration'][_0x4d63('0x120')](db[_0x4d63('0x1c5')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0xca')][_0x4d63('0x115')](db['ServicenowField'],{'as':_0x4d63('0x1bf'),'foreignKey':'SubjectId'});db[_0x4d63('0xca')][_0x4d63('0x115')](db[_0x4d63('0xca')],{'as':'Description','foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xca')]['hasMany'](db['ServicenowField'],{'as':_0x4d63('0x1bd'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xca')]['belongsTo'](db[_0x4d63('0x97')],{'as':_0x4d63('0x97'),'foreignKey':_0x4d63('0x1c2')});db[_0x4d63('0x1c6')][_0x4d63('0x115')](db[_0x4d63('0xcd')],{'as':_0x4d63('0x1b4'),'onDelete':'cascade','foreignKey':_0x4d63('0x1b5')});db['Dynamics365Configuration'][_0x4d63('0x115')](db['Dynamics365Field'],{'as':_0x4d63('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x4d63('0xcd')]['hasMany'](db[_0x4d63('0x1c7')],{'as':_0x4d63('0x1b8'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xcd')][_0x4d63('0x115')](db['Dynamics365Field'],{'as':_0x4d63('0x1b1'),'onDelete':'cascade','foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xcd')][_0x4d63('0x120')](db[_0x4d63('0x1c6')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0x1c7')][_0x4d63('0x115')](db[_0x4d63('0x1c7')],{'as':_0x4d63('0x1bf'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0x1c7')]['hasMany'](db[_0x4d63('0x1c7')],{'as':_0x4d63('0x1bc'),'foreignKey':'DescriptionId'});db[_0x4d63('0x1c7')][_0x4d63('0x115')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x4d63('0x1ba')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0x4d63('0x97'),'foreignKey':'VariableId'});db[_0x4d63('0xd0')][_0x4d63('0x115')](db[_0x4d63('0x1c8')],{'as':_0x4d63('0x1b4'),'onDelete':_0x4d63('0x112'),'foreignKey':'AccountId'});db[_0x4d63('0x1c8')][_0x4d63('0x115')](db[_0x4d63('0x1c9')],{'as':'Subjects','foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0x1c8')]['hasMany'](db['FreshsalesField'],{'as':_0x4d63('0x1b8'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db[_0x4d63('0x1c9')],{'as':_0x4d63('0x1b1'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0x1c8')][_0x4d63('0x120')](db[_0x4d63('0xd0')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db['FreshsalesField'][_0x4d63('0x115')](db[_0x4d63('0x1c9')],{'as':_0x4d63('0x1bf'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0x1c9')][_0x4d63('0x115')](db[_0x4d63('0x1c9')],{'as':'Description','foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0x1c9')][_0x4d63('0x115')](db[_0x4d63('0x1c9')],{'as':'Field','foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0x1c9')][_0x4d63('0x120')](db[_0x4d63('0x97')],{'as':_0x4d63('0x97'),'foreignKey':_0x4d63('0x1c2')});db[_0x4d63('0xd4')][_0x4d63('0x120')](db[_0x4d63('0x5f')],{});db[_0x4d63('0xd4')]['belongsTo'](db[_0x4d63('0xf8')],{'as':'List','foreignKey':_0x4d63('0x16a')});db[_0x4d63('0xd4')]['belongsTo'](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0xd4')][_0x4d63('0x120')](db[_0x4d63('0x63')],{});db[_0x4d63('0xd4')]['belongsTo'](db[_0x4d63('0x65')],{});db['ChatQueueReport']['belongsTo'](db['User'],{});db[_0x4d63('0xd4')][_0x4d63('0x120')](db[_0x4d63('0x69')],{});db['ChatInternalMessage'][_0x4d63('0x120')](db[_0x4d63('0xf')],{'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1ca')});db[_0x4d63('0xd6')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'onDelete':_0x4d63('0x112'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0x4d63('0x115')](db[_0x4d63('0xda')],{'foreignKey':_0x4d63('0x1cb'),'onDelete':_0x4d63('0x112')});db['JscriptySessionReport'][_0x4d63('0x115')](db[_0x4d63('0xd8')],{'foreignKey':_0x4d63('0x1cb'),'onDelete':_0x4d63('0x112')});db['SmsQueueReport']['belongsTo'](db[_0x4d63('0x140')],{});db['SmsQueueReport'][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a')});db['SmsQueueReport']['belongsTo'](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0xdc')][_0x4d63('0x120')](db[_0x4d63('0x53')],{});db[_0x4d63('0xdc')][_0x4d63('0x120')](db[_0x4d63('0x55')],{});db[_0x4d63('0xdc')]['belongsTo'](db[_0x4d63('0xf')],{});db[_0x4d63('0xdc')][_0x4d63('0x120')](db[_0x4d63('0x57')],{});db['JscriptyProject'][_0x4d63('0x115')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db[_0x4d63('0xe0')][_0x4d63('0x115')](db[_0x4d63('0xda')],{'foreignKey':_0x4d63('0x1cc')});db[_0x4d63('0xe0')][_0x4d63('0x115')](db[_0x4d63('0xd8')],{'foreignKey':_0x4d63('0x1cc')});db[_0x4d63('0xe4')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x175'),'through':_0x4d63('0x145')});db[_0x4d63('0x156')]['belongsToMany'](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x127')});db['Team'][_0x4d63('0x126')](db[_0x4d63('0x12f')],{'through':_0x4d63('0x158'),'as':_0x4d63('0x130')});db[_0x4d63('0x156')]['belongsToMany'](db[_0x4d63('0x39')],{'through':_0x4d63('0x16f'),'as':'MailQueues'});db[_0x4d63('0x156')][_0x4d63('0x126')](db['ChatQueue'],{'through':_0x4d63('0x1cd'),'as':'ChatQueues'});db[_0x4d63('0x156')]['belongsToMany'](db[_0x4d63('0x133')],{'through':'team_has_fax_queues','as':_0x4d63('0x1ce')});db[_0x4d63('0x156')][_0x4d63('0x126')](db[_0x4d63('0x57')],{'through':'team_has_sms_queues','as':_0x4d63('0x1cf')});db[_0x4d63('0x156')]['belongsToMany'](db[_0x4d63('0x134')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x4d63('0x156')][_0x4d63('0x126')](db[_0x4d63('0x10d')],{'through':_0x4d63('0x1d0'),'as':_0x4d63('0x135')});db['Campaign'][_0x4d63('0x115')](db[_0x4d63('0x73')],{'as':_0x4d63('0x1d1'),'foreignKey':_0x4d63('0x19c')});db[_0x4d63('0x19b')][_0x4d63('0x115')](db[_0x4d63('0x77')],{'as':_0x4d63('0x118'),'foreignKey':_0x4d63('0x19c')});db['Campaign'][_0x4d63('0x115')](db[_0x4d63('0x79')],{'as':_0x4d63('0x14b'),'foreignKey':_0x4d63('0x19c')});db['Campaign'][_0x4d63('0x115')](db[_0x4d63('0x75')],{'as':_0x4d63('0x14c'),'foreignKey':_0x4d63('0x19c')});db[_0x4d63('0x19b')][_0x4d63('0x120')](db[_0x4d63('0x14d')],{'as':'Trunk','foreignKey':_0x4d63('0x14e')});db[_0x4d63('0x19b')][_0x4d63('0x120')](db[_0x4d63('0x14d')],{'as':_0x4d63('0x14f'),'foreignKey':_0x4d63('0x150')});db[_0x4d63('0x19b')][_0x4d63('0x120')](db[_0x4d63('0x88')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x4d63('0x19b')]['belongsTo'](db[_0x4d63('0xe4')],{'as':_0x4d63('0xe4'),'foreignKey':_0x4d63('0x1d2')});db['Campaign'][_0x4d63('0x126')](db['CmList'],{'as':_0x4d63('0x153'),'through':_0x4d63('0x1d3')});db[_0x4d63('0x19b')][_0x4d63('0x126')](db['CmList'],{'as':_0x4d63('0x159'),'through':'campaigns_has_cm_blacklists'});db['MailTransferReport'][_0x4d63('0x120')](db[_0x4d63('0x3e')],{});db[_0x4d63('0x1d4')][_0x4d63('0x120')](db[_0x4d63('0x3c')],{});db[_0x4d63('0x1d4')][_0x4d63('0x120')](db[_0x4d63('0x163')],{'foreignKey':_0x4d63('0x1d5'),'as':_0x4d63('0x1d6')});db[_0x4d63('0x1d4')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'foreignKey':_0x4d63('0x1d7'),'as':_0x4d63('0x1d8')});db[_0x4d63('0x1d4')][_0x4d63('0x120')](db['User'],{'foreignKey':_0x4d63('0x1d9'),'as':'ToAgent'});db[_0x4d63('0x1d4')][_0x4d63('0x120')](db['MailQueue'],{'foreignKey':_0x4d63('0x1da'),'as':'ToQueue'});db[_0x4d63('0x1d4')][_0x4d63('0x120')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x4d63('0xf3')]['belongsTo'](db[_0x4d63('0x65')],{});db[_0x4d63('0xf3')][_0x4d63('0x120')](db[_0x4d63('0x63')],{});db[_0x4d63('0xf3')][_0x4d63('0x120')](db[_0x4d63('0x5f')],{'foreignKey':_0x4d63('0x1db'),'as':_0x4d63('0x1d6')});db[_0x4d63('0xf3')]['belongsTo'](db[_0x4d63('0xf')],{'foreignKey':'FromUserId','as':_0x4d63('0x1d8')});db[_0x4d63('0xf3')][_0x4d63('0x120')](db['User'],{'foreignKey':_0x4d63('0x1d9'),'as':_0x4d63('0x1dc')});db[_0x4d63('0xf3')][_0x4d63('0x120')](db['ChatQueue'],{'foreignKey':_0x4d63('0x1dd'),'as':_0x4d63('0x1de')});db['ChatTransferReport']['belongsTo'](db[_0x4d63('0x5f')],{'foreignKey':'ToChatWebsiteId','as':_0x4d63('0x1df')});db[_0x4d63('0x1e0')]['belongsTo'](db[_0x4d63('0x4c')],{});db[_0x4d63('0x1e0')][_0x4d63('0x120')](db[_0x4d63('0x4a')],{});db[_0x4d63('0x1e0')][_0x4d63('0x120')](db[_0x4d63('0x46')],{'foreignKey':'FromFaxAccountId','as':_0x4d63('0x1d6')});db[_0x4d63('0x1e0')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'foreignKey':'FromUserId','as':'FromAgent'});db['FaxTransferReport']['belongsTo'](db[_0x4d63('0xf')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x4d63('0x1e0')][_0x4d63('0x120')](db[_0x4d63('0x133')],{'foreignKey':_0x4d63('0x1e1'),'as':_0x4d63('0x1de')});db[_0x4d63('0x1e0')][_0x4d63('0x120')](db[_0x4d63('0x46')],{'foreignKey':_0x4d63('0x1e2'),'as':_0x4d63('0x1df')});db[_0x4d63('0x1e3')][_0x4d63('0x120')](db[_0x4d63('0x5c')],{});db[_0x4d63('0x1e3')][_0x4d63('0x120')](db[_0x4d63('0x11a')],{});db['OpenchannelTransferReport'][_0x4d63('0x120')](db[_0x4d63('0x59')],{'foreignKey':_0x4d63('0x1e4'),'as':_0x4d63('0x1d6')});db[_0x4d63('0x1e3')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'foreignKey':_0x4d63('0x1d7'),'as':_0x4d63('0x1d8')});db[_0x4d63('0x1e3')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'foreignKey':_0x4d63('0x1d9'),'as':_0x4d63('0x1dc')});db[_0x4d63('0x1e3')][_0x4d63('0x120')](db[_0x4d63('0x134')],{'foreignKey':_0x4d63('0x1e5'),'as':_0x4d63('0x1de')});db[_0x4d63('0x1e3')][_0x4d63('0x120')](db['OpenchannelAccount'],{'foreignKey':_0x4d63('0x1e6'),'as':_0x4d63('0x1df')});db['SmsTransferReport'][_0x4d63('0x120')](db['SmsMessage'],{});db[_0x4d63('0xf6')][_0x4d63('0x120')](db[_0x4d63('0x53')],{});db[_0x4d63('0xf6')]['belongsTo'](db[_0x4d63('0x140')],{'foreignKey':_0x4d63('0x1e7'),'as':_0x4d63('0x1d6')});db['SmsTransferReport'][_0x4d63('0x120')](db[_0x4d63('0xf')],{'foreignKey':'FromUserId','as':_0x4d63('0x1d8')});db['SmsTransferReport'][_0x4d63('0x120')](db[_0x4d63('0xf')],{'foreignKey':_0x4d63('0x1d9'),'as':_0x4d63('0x1dc')});db[_0x4d63('0xf6')]['belongsTo'](db[_0x4d63('0x57')],{'foreignKey':_0x4d63('0x1e8'),'as':_0x4d63('0x1de')});db[_0x4d63('0xf6')][_0x4d63('0x120')](db[_0x4d63('0x140')],{'foreignKey':_0x4d63('0x1e9'),'as':_0x4d63('0x1df')});db['CmList'][_0x4d63('0x115')](db[_0x4d63('0x84')],{'as':_0x4d63('0x166'),'foreignKey':_0x4d63('0x16a')});db[_0x4d63('0xf8')][_0x4d63('0x115')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x4d63('0x16a')});db[_0x4d63('0xf8')][_0x4d63('0x115')](db[_0x4d63('0x71')],{'as':_0x4d63('0x124'),'onDelete':_0x4d63('0x112'),'foreignKey':'ListId'});db[_0x4d63('0xf8')][_0x4d63('0x115')](db[_0x4d63('0x77')],{'as':'HopperFinals','foreignKey':_0x4d63('0x16a')});db[_0x4d63('0xf8')][_0x4d63('0x115')](db[_0x4d63('0x79')],{'as':'HopperHistory','foreignKey':_0x4d63('0x16a')});db[_0x4d63('0xf8')][_0x4d63('0x115')](db[_0x4d63('0x7b')],{'as':_0x4d63('0x7b'),'foreignKey':_0x4d63('0x16a')});db[_0x4d63('0xf8')][_0x4d63('0x126')](db['VoiceQueue'],{'as':_0x4d63('0x1ea'),'through':_0x4d63('0x154')});db[_0x4d63('0xf8')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x136')});db[_0x4d63('0xfa')][_0x4d63('0x115')](db[_0x4d63('0x14')],{'as':_0x4d63('0x117'),'onDelete':_0x4d63('0x112')});db[_0x4d63('0xfa')]['belongsToMany'](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x138')});db[_0x4d63('0xfb')][_0x4d63('0x115')](db['User'],{'as':_0x4d63('0x175'),'foreignKey':'userProfileId'});db[_0x4d63('0xfb')]['hasMany'](db['UserProfileSection'],{'as':_0x4d63('0x1eb'),'foreignKey':_0x4d63('0x121'),'onDelete':'cascade'});db[_0x4d63('0x1ec')][_0x4d63('0x115')](db[_0x4d63('0xfe')],{'as':_0x4d63('0x1ed'),'foreignKey':'sectionId','onDelete':_0x4d63('0x112')});db['WhatsappAccount'][_0x4d63('0x115')](db[_0x4d63('0x84')],{'as':_0x4d63('0x166'),'foreignKey':_0x4d63('0x1ee')});db[_0x4d63('0x102')][_0x4d63('0x115')](db[_0x4d63('0x82')],{'as':_0x4d63('0x167'),'foreignKey':_0x4d63('0x1ee')});db[_0x4d63('0x102')][_0x4d63('0x115')](db[_0x4d63('0x108')],{'as':_0x4d63('0x15c'),'foreignKey':_0x4d63('0x1ee')});db[_0x4d63('0x102')][_0x4d63('0x115')](db[_0x4d63('0x106')],{'as':_0x4d63('0x168')});db[_0x4d63('0x102')][_0x4d63('0x115')](db[_0x4d63('0x104')],{'as':_0x4d63('0x169')});db['WhatsappAccount'][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':'ListId'});db[_0x4d63('0x102')]['belongsTo'](db[_0x4d63('0x8a')],{'as':_0x4d63('0x16d'),'foreignKey':_0x4d63('0x152')});db[_0x4d63('0x102')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x143')});db['WhatsappApplication'][_0x4d63('0x120')](db[_0x4d63('0xf')],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x104')]['belongsTo'](db[_0x4d63('0x10d')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x4d63('0x120')](db[_0x4d63('0x102')],{'onDelete':_0x4d63('0x179')});db['WhatsappApplication'][_0x4d63('0x120')](db[_0x4d63('0x88')],{'onDelete':_0x4d63('0x179'),'foreignKey':'IntervalId'});db[_0x4d63('0x104')][_0x4d63('0x120')](db[_0x4d63('0x92')],{'onDelete':_0x4d63('0x179'),'foreignKey':_0x4d63('0x17a')});db[_0x4d63('0x106')]['hasMany'](db['WhatsappMessage'],{'as':_0x4d63('0x15c'),'onDelete':'cascade','foreignKey':_0x4d63('0x1ef')});db[_0x4d63('0x106')]['belongsTo'](db[_0x4d63('0x102')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1ee')});db[_0x4d63('0x106')][_0x4d63('0x120')](db['CmContact'],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x106')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':_0x4d63('0x187'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0x106')][_0x4d63('0x126')](db['Tag'],{'through':_0x4d63('0x1aa'),'as':_0x4d63('0x173')});db[_0x4d63('0x106')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x1aa'),'as':_0x4d63('0x174')});db[_0x4d63('0x106')][_0x4d63('0x126')](db['User'],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0x4d63('0x1ef')});db[_0x4d63('0x108')][_0x4d63('0x120')](db['User'],{'as':'User'});db['WhatsappMessage'][_0x4d63('0x120')](db[_0x4d63('0x71')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x161')});db[_0x4d63('0x108')][_0x4d63('0x120')](db[_0x4d63('0x106')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x178'),'foreignKey':_0x4d63('0x1ef')});db['WhatsappMessage'][_0x4d63('0x120')](db['WhatsappAccount'],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1ee')});db[_0x4d63('0x1f0')][_0x4d63('0x120')](db['WhatsappAccount'],{});db[_0x4d63('0x1f0')]['belongsTo'](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a')});db[_0x4d63('0x1f0')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4d63('0x1f0')][_0x4d63('0x120')](db[_0x4d63('0x106')],{});db['WhatsappQueueReport']['belongsTo'](db['WhatsappQueue'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x4d63('0x108')],{});db[_0x4d63('0x1f0')][_0x4d63('0x120')](db[_0x4d63('0xf')],{});db[_0x4d63('0x10b')][_0x4d63('0x120')](db[_0x4d63('0x108')],{});db[_0x4d63('0x10b')]['belongsTo'](db[_0x4d63('0x106')],{});db[_0x4d63('0x10b')][_0x4d63('0x120')](db[_0x4d63('0x102')],{'foreignKey':_0x4d63('0x1f1'),'as':_0x4d63('0x1d6')});db[_0x4d63('0x10b')][_0x4d63('0x120')](db[_0x4d63('0x102')],{'foreignKey':_0x4d63('0x1f2'),'as':_0x4d63('0x1df')});db[_0x4d63('0x10b')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x4d63('0x1f3'),'as':_0x4d63('0x1de')});db[_0x4d63('0x10b')][_0x4d63('0x120')](db['User'],{'foreignKey':_0x4d63('0x1d7'),'as':_0x4d63('0x1d8')});db[_0x4d63('0x10b')]['belongsTo'](db[_0x4d63('0xf')],{'foreignKey':_0x4d63('0x1d9'),'as':_0x4d63('0x1dc')});db[_0x4d63('0x10d')]['belongsToMany'](db[_0x4d63('0xf')],{'as':'Agents','through':_0x4d63('0x34'),'foreignKey':'WhatsappQueueId'});db[_0x4d63('0x10d')][_0x4d63('0x126')](db[_0x4d63('0x156')],{'through':_0x4d63('0x1d0'),'as':_0x4d63('0x157')});module[_0x4d63('0x1f4')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 723653e..194d8cf 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ae3=['agent_id','agent_name','test','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','/api/notifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/apidoc','join','root','/www','/demo','static','/snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','path','util','./errors','./config/logger','auth','default','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other'];(function(_0x26963d,_0xbe7a42){var _0x1f5b75=function(_0x37d36c){while(--_0x37d36c){_0x26963d['push'](_0x26963d['shift']());}};_0x1f5b75(++_0xbe7a42);}(_0x9ae3,0xfa));var _0x39ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ae3[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0x39ae('0x0'));var express=require('express');var ewinston=require('express-winston');var util=require(_0x39ae('0x1'));var errors=require(_0x39ae('0x2'));var config=require('./config/environment');var logger=require(_0x39ae('0x3'))('api');var authLogger=require('./config/logger')(_0x39ae('0x4'));exports[_0x39ae('0x5')]=function(_0x190af8){_0x190af8['use'](ewinston[_0x39ae('0x6')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3bd050,_0x5e5ac6){return util[_0x39ae('0x7')](_0x39ae('0x8'),_0x3bd050['method'],_0x3bd050['headers'][_0x39ae('0x9')]?_0x3bd050[_0x39ae('0xa')][_0x39ae('0x9')]:_0x3bd050[_0x39ae('0xb')][_0x39ae('0xc')]||_0x3bd050['ip'],_0x3bd050[_0x39ae('0xd')],_0x5e5ac6[_0x39ae('0xe')],_0x5e5ac6[_0x39ae('0xf')],_0x3bd050['user']?_0x3bd050[_0x39ae('0x10')]['id']:null,_0x3bd050[_0x39ae('0x10')]?_0x3bd050[_0x39ae('0x10')][_0x39ae('0x11')]:null,_0x3bd050[_0x39ae('0x10')]?_0x3bd050[_0x39ae('0x10')][_0x39ae('0x12')]:null);}}));_0x190af8['use'](ewinston[_0x39ae('0x6')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2e3ac8,_0x8cd4fd){var _0x42b847=_0x39ae('0x13');if(_0x2e3ac8[_0x39ae('0x14')]&&_0x2e3ac8[_0x39ae('0x14')][_0x39ae('0x15')]&&_0x2e3ac8[_0x39ae('0x14')]['agent_id']){_0x42b847=_0x39ae('0x16');}return util['format'](_0x42b847,_0x2e3ac8['method'],_0x2e3ac8['headers'][_0x39ae('0x9')]?_0x2e3ac8[_0x39ae('0xa')][_0x39ae('0x9')]:_0x2e3ac8['connection'][_0x39ae('0xc')]||_0x2e3ac8['ip'],_0x2e3ac8['url'],_0x8cd4fd[_0x39ae('0xe')],_0x8cd4fd[_0x39ae('0xf')],_0x2e3ac8[_0x39ae('0x10')]?_0x2e3ac8[_0x39ae('0x10')]['id']:null,_0x2e3ac8['user']?_0x2e3ac8[_0x39ae('0x10')][_0x39ae('0x11')]:null,_0x2e3ac8[_0x39ae('0x10')]?_0x2e3ac8['user'][_0x39ae('0x12')]:null,_0x2e3ac8['body']&&_0x2e3ac8[_0x39ae('0x14')][_0x39ae('0x15')]?_0x2e3ac8[_0x39ae('0x14')]['device']:_0x39ae('0x17'),_0x2e3ac8[_0x39ae('0x14')]&&_0x2e3ac8[_0x39ae('0x14')][_0x39ae('0x18')]?_0x2e3ac8['body']['agent_id']:'',_0x2e3ac8[_0x39ae('0x14')]&&_0x2e3ac8['body']['agent_name']?_0x2e3ac8[_0x39ae('0x14')][_0x39ae('0x19')]:'');},'ignoreRoute':function(_0x149506){var _0x42734c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x42734c[_0x39ae('0x1a')](_0x149506[_0x39ae('0xd')]);}}));_0x190af8['use'](_0x39ae('0x1b'),require(_0x39ae('0x1c')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x1e'),require(_0x39ae('0x1f')));_0x190af8[_0x39ae('0x1d')]('/api/voice/contexts',require('./api/voiceContext'));_0x190af8[_0x39ae('0x1d')]('/api/voice/extensions',require(_0x39ae('0x20')));_0x190af8['use'](_0x39ae('0x21'),require(_0x39ae('0x22')));_0x190af8['use'](_0x39ae('0x23'),require(_0x39ae('0x24')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x25'),require(_0x39ae('0x26')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x27'),require(_0x39ae('0x28')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x29'),require(_0x39ae('0x2a')));_0x190af8['use']('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x2b'),require(_0x39ae('0x2c')));_0x190af8['use'](_0x39ae('0x2d'),require(_0x39ae('0x2e')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x2f'),require(_0x39ae('0x30')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x31'),require(_0x39ae('0x32')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x33'),require(_0x39ae('0x34')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x35'),require(_0x39ae('0x36')));_0x190af8[_0x39ae('0x1d')]('/api/voice/transfers/reports',require(_0x39ae('0x37')));_0x190af8[_0x39ae('0x1d')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x190af8['use'](_0x39ae('0x38'),require(_0x39ae('0x39')));_0x190af8[_0x39ae('0x1d')]('/api/mail/queues',require('./api/mailQueue'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x3a'),require(_0x39ae('0x3b')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x3c'),require(_0x39ae('0x3d')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x3e'),require(_0x39ae('0x3f')));_0x190af8['use']('/api/mail/applications',require(_0x39ae('0x40')));_0x190af8[_0x39ae('0x1d')]('/api/mail/reports/queue',require(_0x39ae('0x41')));_0x190af8['use'](_0x39ae('0x42'),require(_0x39ae('0x43')));_0x190af8['use'](_0x39ae('0x44'),require(_0x39ae('0x45')));_0x190af8[_0x39ae('0x1d')]('/api/fax/accounts',require('./api/faxAccount'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x46'),require(_0x39ae('0x47')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x48'),require(_0x39ae('0x49')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x4a'),require('./api/faxMessage'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x4b'),require(_0x39ae('0x4c')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x4d'),require(_0x39ae('0x4e')));_0x190af8[_0x39ae('0x1d')]('/api/sms/accounts',require(_0x39ae('0x4f')));_0x190af8['use']('/api/sms/applications',require(_0x39ae('0x50')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x51'),require('./api/smsInteraction'));_0x190af8['use'](_0x39ae('0x52'),require(_0x39ae('0x53')));_0x190af8['use'](_0x39ae('0x54'),require(_0x39ae('0x55')));_0x190af8[_0x39ae('0x1d')]('/api/openchannel/accounts',require(_0x39ae('0x56')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x57'),require(_0x39ae('0x58')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x59'),require(_0x39ae('0x5a')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x5b'),require('./api/openchannelMessage'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x5c'),require('./api/openchannelQueue'));_0x190af8[_0x39ae('0x1d')]('/api/chat/websites',require('./api/chatWebsite'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x5d'),require(_0x39ae('0x5e')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x5f'),require(_0x39ae('0x60')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x61'),require('./api/chatInteraction'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x62'),require(_0x39ae('0x63')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x64'),require('./api/chatOfflineMessage'));_0x190af8['use'](_0x39ae('0x65'),require('./api/chatQueue'));_0x190af8['use']('/api/chat/groups',require(_0x39ae('0x66')));_0x190af8[_0x39ae('0x1d')]('/api/chat/proactive_actions',require(_0x39ae('0x67')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x68'),require(_0x39ae('0x69')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x6a'),require(_0x39ae('0x6b')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x6c'),require(_0x39ae('0x6d')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x6e'),require(_0x39ae('0x6f')));_0x190af8[_0x39ae('0x1d')]('/api/cm/hopper_final',require(_0x39ae('0x70')));_0x190af8[_0x39ae('0x1d')]('/api/cm/hopper_history',require(_0x39ae('0x71')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x72'),require(_0x39ae('0x73')));_0x190af8['use'](_0x39ae('0x74'),require(_0x39ae('0x75')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x76'),require('./api/automation'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x77'),require(_0x39ae('0x78')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x79'),require('./api/disposition'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x7a'),require(_0x39ae('0x7b')));_0x190af8[_0x39ae('0x1d')]('/api/intervals',require(_0x39ae('0x7c')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x7d'),require(_0x39ae('0x7e')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x7f'),require('./api/cdr'));_0x190af8[_0x39ae('0x1d')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x80'),require(_0x39ae('0x81')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x82'),require(_0x39ae('0x83')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x84'),require(_0x39ae('0x85')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x86'),require(_0x39ae('0x87')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x88'),require(_0x39ae('0x89')));_0x190af8['use'](_0x39ae('0x8a'),require('./api/variable'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x8b'),require(_0x39ae('0x8c')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x8d'),require(_0x39ae('0x8e')));_0x190af8[_0x39ae('0x1d')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x8f'),require('./api/analyticDefaultReport'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x90'),require('./api/analyticExtractedReport'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x91'),require('./api/analyticMetric'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x92'),require(_0x39ae('0x93')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x94'),require(_0x39ae('0x95')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/salesforce/accounts',require(_0x39ae('0x96')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x97'),require(_0x39ae('0x98')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x99'),require(_0x39ae('0x9a')));_0x190af8['use'](_0x39ae('0x9b'),require(_0x39ae('0x9c')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x9d'),require(_0x39ae('0x9e')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/desk/accounts',require(_0x39ae('0x9f')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/desk/configurations',require(_0x39ae('0xa0')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/desk/fields',require(_0x39ae('0xa1')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/zoho/accounts',require(_0x39ae('0xa2')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xa3'),require(_0x39ae('0xa4')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xa5'),require(_0x39ae('0xa6')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xa7'),require(_0x39ae('0xa8')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xa9'),require('./api/intZendeskConfiguration'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xaa'),require(_0x39ae('0xab')));_0x190af8['use'](_0x39ae('0xac'),require(_0x39ae('0xad')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xae'),require(_0x39ae('0xaf')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/freshdesk/fields',require(_0x39ae('0xb0')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xb1'),require('./api/intVtigerAccount'));_0x190af8[_0x39ae('0x1d')]('/api/integrations/vtiger/configurations',require(_0x39ae('0xb2')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xb3'),require(_0x39ae('0xb4')));_0x190af8['use'](_0x39ae('0xb5'),require('./api/intServicenowAccount'));_0x190af8['use'](_0x39ae('0xb6'),require('./api/intServicenowConfiguration'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xb7'),require('./api/intServicenowField'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xb8'),require('./api/intDynamics365Account'));_0x190af8[_0x39ae('0x1d')]('/api/integrations/dynamics365/configurations',require(_0x39ae('0xb9')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xba'),require(_0x39ae('0xbb')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/freshsales/accounts',require(_0x39ae('0xbc')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xbd'),require('./api/intFreshsalesConfiguration'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xbe'),require('./api/intFreshsalesField'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xbf'),require(_0x39ae('0xc0')));_0x190af8[_0x39ae('0x1d')]('/api/chat/reports/queue',require(_0x39ae('0xc1')));_0x190af8['use'](_0x39ae('0xc2'),require('./api/chatInternalMessage'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xc3'),require(_0x39ae('0xc4')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xc5'),require(_0x39ae('0xc6')));_0x190af8[_0x39ae('0x1d')]('/api/jscripty/sessions/reports',require(_0x39ae('0xc7')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xc8'),require(_0x39ae('0xc9')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xca'),require(_0x39ae('0xcb')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xcc'),require(_0x39ae('0xcd')));_0x190af8['use']('/api/jscripty/projects',require(_0x39ae('0xce')));_0x190af8[_0x39ae('0x1d')]('/api/settings',require(_0x39ae('0xcf')));_0x190af8['use'](_0x39ae('0xd0'),require(_0x39ae('0xd1')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xd2'),require(_0x39ae('0xd3')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xd4'),require(_0x39ae('0xd5')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xd6'),require('./api/squareMessage'));_0x190af8[_0x39ae('0x1d')]('/api/teams',require(_0x39ae('0xd7')));_0x190af8['use'](_0x39ae('0xd8'),require(_0x39ae('0xd9')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xda'),require(_0x39ae('0xdb')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xdc'),require('./api/migration'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xdd'),require('./api/attachment'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xde'),require(_0x39ae('0xdf')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xe0'),require('./api/mailTransferReport'));_0x190af8[_0x39ae('0x1d')]('/api/chat/reports/transfer',require(_0x39ae('0xe1')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xe2'),require(_0x39ae('0xe3')));_0x190af8['use'](_0x39ae('0xe4'),require(_0x39ae('0xe5')));_0x190af8[_0x39ae('0x1d')]('/api/sms/reports/transfer',require(_0x39ae('0xe6')));_0x190af8[_0x39ae('0x1d')]('/api/cm/lists',require('./api/cmList'));_0x190af8['use'](_0x39ae('0xe7'),require(_0x39ae('0xe8')));_0x190af8[_0x39ae('0x1d')]('/api/userProfiles',require(_0x39ae('0xe9')));_0x190af8['use']('/api/userProfile/sections',require(_0x39ae('0xea')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xeb'),require('./api/userProfileResource'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xec'),require('./api/notification'));_0x190af8['use'](_0x39ae('0xed'),require(_0x39ae('0xee')));_0x190af8['use'](_0x39ae('0xef'),require(_0x39ae('0xf0')));_0x190af8[_0x39ae('0x1d')]('/api/whatsapp/interactions',require(_0x39ae('0xf1')));_0x190af8['use'](_0x39ae('0xf2'),require('./api/whatsappMessage'));_0x190af8['use']('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x190af8['use'](_0x39ae('0xf3'),require(_0x39ae('0xf4')));_0x190af8['use'](_0x39ae('0xf5'),require(_0x39ae('0xf6')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xf7'),require('./api/cloudProvider'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xf8'),require(_0x39ae('0xf9')));_0x190af8[_0x39ae('0x1d')]('/api/auth/google',require(_0x39ae('0xfa')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xfb'),require('./api/jira'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xfc'),require(_0x39ae('0xfd')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xfe'),require(_0x39ae('0xff')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x100'),require(_0x39ae('0x101')));_0x190af8[_0x39ae('0x1d')]('/api/pm2',require(_0x39ae('0x102')));_0x190af8['use']('/api/webbar',require('./api/webbar'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x103'),express['static'](path[_0x39ae('0x104')](config[_0x39ae('0x105')],_0x39ae('0x103'))));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x106'),express['static'](path[_0x39ae('0x104')](config['root'],_0x39ae('0x106'))));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x107'),express[_0x39ae('0x108')](path[_0x39ae('0x104')](config[_0x39ae('0x105')],_0x39ae('0x107'))));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x109'),express[_0x39ae('0x108')](path[_0x39ae('0x104')](config[_0x39ae('0x105')],'snippet',_0x39ae('0x10a'))));_0x190af8['use'](_0x39ae('0x10b'),express[_0x39ae('0x108')](path[_0x39ae('0x104')](config[_0x39ae('0x105')],_0x39ae('0x10c'))));_0x190af8[_0x39ae('0x10d')](_0x39ae('0x10e'))[_0x39ae('0x10f')](errors[0x194]);_0x190af8['route']('/*')[_0x39ae('0x10f')](function(_0x86932d,_0x5891d5){_0x5891d5['sendFile'](path[_0x39ae('0x110')](_0x190af8[_0x39ae('0x10f')]('appPath')+_0x39ae('0x111')));});}; \ No newline at end of file +var _0x9eb0=['./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','./api/campaign','/api/migrations','./api/migration','/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/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','1.0.16','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','express','express-winston','util','./errors','./config/logger','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','user','name','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','role','agent_id','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./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/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','./api/template','/api/triggers','./api/trigger','/api/variables','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/configurations'];(function(_0x2d5938,_0x200e7d){var _0x5d0814=function(_0x44cbe8){while(--_0x44cbe8){_0x2d5938['push'](_0x2d5938['shift']());}};_0x5d0814(++_0x200e7d);}(_0x9eb0,0x1a9));var _0x09eb=function(_0x134bf8,_0x26b3a3){_0x134bf8=_0x134bf8-0x0;var _0x504b1f=_0x9eb0[_0x134bf8];return _0x504b1f;};'use strict';var path=require('path');var express=require(_0x09eb('0x0'));var ewinston=require(_0x09eb('0x1'));var util=require(_0x09eb('0x2'));var errors=require(_0x09eb('0x3'));var config=require('./config/environment');var logger=require(_0x09eb('0x4'))('api');var authLogger=require(_0x09eb('0x4'))(_0x09eb('0x5'));exports[_0x09eb('0x6')]=function(_0x243373){_0x243373[_0x09eb('0x7')](ewinston[_0x09eb('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4e6c77,_0x1bb0f8){return util[_0x09eb('0x9')](_0x09eb('0xa'),_0x4e6c77[_0x09eb('0xb')],_0x4e6c77[_0x09eb('0xc')][_0x09eb('0xd')]?_0x4e6c77[_0x09eb('0xc')][_0x09eb('0xd')]:_0x4e6c77[_0x09eb('0xe')][_0x09eb('0xf')]||_0x4e6c77['ip'],_0x4e6c77[_0x09eb('0x10')],_0x1bb0f8['statusCode'],_0x1bb0f8[_0x09eb('0x11')],_0x4e6c77[_0x09eb('0x12')]?_0x4e6c77[_0x09eb('0x12')]['id']:null,_0x4e6c77[_0x09eb('0x12')]?_0x4e6c77[_0x09eb('0x12')][_0x09eb('0x13')]:null,_0x4e6c77[_0x09eb('0x12')]?_0x4e6c77['user']['role']:null);}}));_0x243373[_0x09eb('0x7')](ewinston[_0x09eb('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xbd1ec4,_0x2e6384){var _0x2b1334=_0x09eb('0x14');if(_0xbd1ec4['body']&&_0xbd1ec4[_0x09eb('0x15')][_0x09eb('0x16')]&&_0xbd1ec4[_0x09eb('0x15')]['agent_id']){_0x2b1334=_0x09eb('0x17');}return util[_0x09eb('0x9')](_0x2b1334,_0xbd1ec4['method'],_0xbd1ec4[_0x09eb('0xc')][_0x09eb('0xd')]?_0xbd1ec4['headers'][_0x09eb('0xd')]:_0xbd1ec4['connection'][_0x09eb('0xf')]||_0xbd1ec4['ip'],_0xbd1ec4[_0x09eb('0x10')],_0x2e6384['statusCode'],_0x2e6384[_0x09eb('0x11')],_0xbd1ec4['user']?_0xbd1ec4[_0x09eb('0x12')]['id']:null,_0xbd1ec4[_0x09eb('0x12')]?_0xbd1ec4[_0x09eb('0x12')][_0x09eb('0x13')]:null,_0xbd1ec4['user']?_0xbd1ec4[_0x09eb('0x12')][_0x09eb('0x18')]:null,_0xbd1ec4[_0x09eb('0x15')]&&_0xbd1ec4[_0x09eb('0x15')][_0x09eb('0x16')]?_0xbd1ec4[_0x09eb('0x15')][_0x09eb('0x16')]:'other',_0xbd1ec4[_0x09eb('0x15')]&&_0xbd1ec4[_0x09eb('0x15')]['agent_id']?_0xbd1ec4[_0x09eb('0x15')][_0x09eb('0x19')]:'',_0xbd1ec4[_0x09eb('0x15')]&&_0xbd1ec4[_0x09eb('0x15')][_0x09eb('0x1a')]?_0xbd1ec4[_0x09eb('0x15')][_0x09eb('0x1a')]:'');},'ignoreRoute':function(_0x13c8c){var _0x20bcf9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x20bcf9[_0x09eb('0x1b')](_0x13c8c['url']);}}));_0x243373[_0x09eb('0x7')]('/api/users',require(_0x09eb('0x1c')));_0x243373['use'](_0x09eb('0x1d'),require(_0x09eb('0x1e')));_0x243373['use'](_0x09eb('0x1f'),require(_0x09eb('0x20')));_0x243373[_0x09eb('0x7')](_0x09eb('0x21'),require(_0x09eb('0x22')));_0x243373[_0x09eb('0x7')]('/api/voice/mohs',require(_0x09eb('0x23')));_0x243373[_0x09eb('0x7')](_0x09eb('0x24'),require(_0x09eb('0x25')));_0x243373['use'](_0x09eb('0x26'),require(_0x09eb('0x27')));_0x243373[_0x09eb('0x7')](_0x09eb('0x28'),require(_0x09eb('0x29')));_0x243373[_0x09eb('0x7')]('/api/voice/mails',require(_0x09eb('0x2a')));_0x243373[_0x09eb('0x7')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x243373['use'](_0x09eb('0x2b'),require(_0x09eb('0x2c')));_0x243373['use'](_0x09eb('0x2d'),require(_0x09eb('0x2e')));_0x243373[_0x09eb('0x7')](_0x09eb('0x2f'),require(_0x09eb('0x30')));_0x243373[_0x09eb('0x7')](_0x09eb('0x31'),require(_0x09eb('0x32')));_0x243373['use']('/api/members/reports',require('./api/memberReport'));_0x243373['use'](_0x09eb('0x33'),require(_0x09eb('0x34')));_0x243373[_0x09eb('0x7')]('/api/voice/transfers/reports',require(_0x09eb('0x35')));_0x243373[_0x09eb('0x7')]('/api/mail/out_servers',require(_0x09eb('0x36')));_0x243373[_0x09eb('0x7')](_0x09eb('0x37'),require(_0x09eb('0x38')));_0x243373[_0x09eb('0x7')]('/api/mail/queues',require(_0x09eb('0x39')));_0x243373[_0x09eb('0x7')](_0x09eb('0x3a'),require(_0x09eb('0x3b')));_0x243373[_0x09eb('0x7')](_0x09eb('0x3c'),require(_0x09eb('0x3d')));_0x243373[_0x09eb('0x7')](_0x09eb('0x3e'),require('./api/mailMessage'));_0x243373[_0x09eb('0x7')](_0x09eb('0x3f'),require('./api/mailApplication'));_0x243373[_0x09eb('0x7')](_0x09eb('0x40'),require('./api/mailQueueReport'));_0x243373['use']('/api/dashboards',require('./api/dashboard'));_0x243373['use'](_0x09eb('0x41'),require(_0x09eb('0x42')));_0x243373['use'](_0x09eb('0x43'),require(_0x09eb('0x44')));_0x243373['use'](_0x09eb('0x45'),require(_0x09eb('0x46')));_0x243373[_0x09eb('0x7')](_0x09eb('0x47'),require(_0x09eb('0x48')));_0x243373[_0x09eb('0x7')](_0x09eb('0x49'),require(_0x09eb('0x4a')));_0x243373[_0x09eb('0x7')](_0x09eb('0x4b'),require(_0x09eb('0x4c')));_0x243373[_0x09eb('0x7')](_0x09eb('0x4d'),require('./api/faxQueueReport'));_0x243373[_0x09eb('0x7')](_0x09eb('0x4e'),require(_0x09eb('0x4f')));_0x243373[_0x09eb('0x7')]('/api/sms/applications',require(_0x09eb('0x50')));_0x243373['use'](_0x09eb('0x51'),require(_0x09eb('0x52')));_0x243373[_0x09eb('0x7')](_0x09eb('0x53'),require('./api/smsMessage'));_0x243373[_0x09eb('0x7')]('/api/sms/queues',require(_0x09eb('0x54')));_0x243373[_0x09eb('0x7')](_0x09eb('0x55'),require(_0x09eb('0x56')));_0x243373['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0x243373[_0x09eb('0x7')](_0x09eb('0x57'),require(_0x09eb('0x58')));_0x243373['use'](_0x09eb('0x59'),require('./api/openchannelMessage'));_0x243373[_0x09eb('0x7')](_0x09eb('0x5a'),require('./api/openchannelQueue'));_0x243373[_0x09eb('0x7')]('/api/chat/websites',require(_0x09eb('0x5b')));_0x243373[_0x09eb('0x7')](_0x09eb('0x5c'),require(_0x09eb('0x5d')));_0x243373['use'](_0x09eb('0x5e'),require(_0x09eb('0x5f')));_0x243373[_0x09eb('0x7')]('/api/chat/interactions',require(_0x09eb('0x60')));_0x243373[_0x09eb('0x7')](_0x09eb('0x61'),require('./api/chatMessage'));_0x243373[_0x09eb('0x7')]('/api/chat/offline_messages',require(_0x09eb('0x62')));_0x243373[_0x09eb('0x7')](_0x09eb('0x63'),require(_0x09eb('0x64')));_0x243373[_0x09eb('0x7')]('/api/chat/groups',require(_0x09eb('0x65')));_0x243373[_0x09eb('0x7')](_0x09eb('0x66'),require(_0x09eb('0x67')));_0x243373[_0x09eb('0x7')](_0x09eb('0x68'),require(_0x09eb('0x69')));_0x243373[_0x09eb('0x7')](_0x09eb('0x6a'),require(_0x09eb('0x6b')));_0x243373[_0x09eb('0x7')]('/api/cm/hopper',require(_0x09eb('0x6c')));_0x243373[_0x09eb('0x7')](_0x09eb('0x6d'),require(_0x09eb('0x6e')));_0x243373['use'](_0x09eb('0x6f'),require('./api/cmHopperFinal'));_0x243373[_0x09eb('0x7')](_0x09eb('0x70'),require('./api/cmHopperHistory'));_0x243373['use'](_0x09eb('0x71'),require(_0x09eb('0x72')));_0x243373[_0x09eb('0x7')]('/api/actions',require(_0x09eb('0x73')));_0x243373[_0x09eb('0x7')](_0x09eb('0x74'),require(_0x09eb('0x75')));_0x243373[_0x09eb('0x7')](_0x09eb('0x76'),require(_0x09eb('0x77')));_0x243373['use'](_0x09eb('0x78'),require('./api/disposition'));_0x243373[_0x09eb('0x7')](_0x09eb('0x79'),require(_0x09eb('0x7a')));_0x243373[_0x09eb('0x7')](_0x09eb('0x7b'),require(_0x09eb('0x7c')));_0x243373[_0x09eb('0x7')](_0x09eb('0x7d'),require('./api/pause'));_0x243373[_0x09eb('0x7')](_0x09eb('0x7e'),require(_0x09eb('0x7f')));_0x243373['use'](_0x09eb('0x80'),require(_0x09eb('0x81')));_0x243373['use'](_0x09eb('0x82'),require(_0x09eb('0x83')));_0x243373[_0x09eb('0x7')](_0x09eb('0x84'),require(_0x09eb('0x85')));_0x243373[_0x09eb('0x7')]('/api/tags',require(_0x09eb('0x86')));_0x243373[_0x09eb('0x7')]('/api/templates',require(_0x09eb('0x87')));_0x243373['use'](_0x09eb('0x88'),require(_0x09eb('0x89')));_0x243373[_0x09eb('0x7')](_0x09eb('0x8a'),require('./api/variable'));_0x243373[_0x09eb('0x7')]('/api/integrations',require(_0x09eb('0x8b')));_0x243373[_0x09eb('0x7')](_0x09eb('0x8c'),require(_0x09eb('0x8d')));_0x243373['use']('/api/analytics/custom_reports',require(_0x09eb('0x8e')));_0x243373[_0x09eb('0x7')](_0x09eb('0x8f'),require(_0x09eb('0x90')));_0x243373[_0x09eb('0x7')](_0x09eb('0x91'),require(_0x09eb('0x92')));_0x243373[_0x09eb('0x7')](_0x09eb('0x93'),require(_0x09eb('0x94')));_0x243373[_0x09eb('0x7')](_0x09eb('0x95'),require(_0x09eb('0x96')));_0x243373[_0x09eb('0x7')](_0x09eb('0x97'),require(_0x09eb('0x98')));_0x243373['use'](_0x09eb('0x99'),require(_0x09eb('0x9a')));_0x243373[_0x09eb('0x7')](_0x09eb('0x9b'),require(_0x09eb('0x9c')));_0x243373[_0x09eb('0x7')](_0x09eb('0x9d'),require(_0x09eb('0x9e')));_0x243373[_0x09eb('0x7')](_0x09eb('0x9f'),require(_0x09eb('0xa0')));_0x243373[_0x09eb('0x7')](_0x09eb('0xa1'),require(_0x09eb('0xa2')));_0x243373['use'](_0x09eb('0xa3'),require('./api/intSugarcrmField'));_0x243373[_0x09eb('0x7')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x243373[_0x09eb('0x7')](_0x09eb('0xa4'),require(_0x09eb('0xa5')));_0x243373[_0x09eb('0x7')](_0x09eb('0xa6'),require('./api/intDeskField'));_0x243373['use'](_0x09eb('0xa7'),require(_0x09eb('0xa8')));_0x243373[_0x09eb('0x7')](_0x09eb('0xa9'),require(_0x09eb('0xaa')));_0x243373[_0x09eb('0x7')](_0x09eb('0xab'),require(_0x09eb('0xac')));_0x243373[_0x09eb('0x7')](_0x09eb('0xad'),require(_0x09eb('0xae')));_0x243373[_0x09eb('0x7')](_0x09eb('0xaf'),require(_0x09eb('0xb0')));_0x243373[_0x09eb('0x7')](_0x09eb('0xb1'),require(_0x09eb('0xb2')));_0x243373[_0x09eb('0x7')](_0x09eb('0xb3'),require('./api/intFreshdeskAccount'));_0x243373['use'](_0x09eb('0xb4'),require('./api/intFreshdeskConfiguration'));_0x243373[_0x09eb('0x7')](_0x09eb('0xb5'),require('./api/intFreshdeskField'));_0x243373[_0x09eb('0x7')](_0x09eb('0xb6'),require('./api/intVtigerAccount'));_0x243373[_0x09eb('0x7')]('/api/integrations/vtiger/configurations',require(_0x09eb('0xb7')));_0x243373[_0x09eb('0x7')](_0x09eb('0xb8'),require(_0x09eb('0xb9')));_0x243373['use'](_0x09eb('0xba'),require('./api/intServicenowAccount'));_0x243373[_0x09eb('0x7')](_0x09eb('0xbb'),require(_0x09eb('0xbc')));_0x243373['use'](_0x09eb('0xbd'),require(_0x09eb('0xbe')));_0x243373[_0x09eb('0x7')](_0x09eb('0xbf'),require(_0x09eb('0xc0')));_0x243373['use']('/api/integrations/dynamics365/configurations',require(_0x09eb('0xc1')));_0x243373[_0x09eb('0x7')](_0x09eb('0xc2'),require(_0x09eb('0xc3')));_0x243373[_0x09eb('0x7')](_0x09eb('0xc4'),require(_0x09eb('0xc5')));_0x243373[_0x09eb('0x7')](_0x09eb('0xc6'),require(_0x09eb('0xc7')));_0x243373[_0x09eb('0x7')]('/api/integrations/freshsales/fields',require(_0x09eb('0xc8')));_0x243373[_0x09eb('0x7')](_0x09eb('0xc9'),require(_0x09eb('0xca')));_0x243373[_0x09eb('0x7')](_0x09eb('0xcb'),require(_0x09eb('0xcc')));_0x243373[_0x09eb('0x7')](_0x09eb('0xcd'),require(_0x09eb('0xce')));_0x243373[_0x09eb('0x7')](_0x09eb('0xcf'),require('./api/jscriptyAnswerReport'));_0x243373['use'](_0x09eb('0xd0'),require(_0x09eb('0xd1')));_0x243373[_0x09eb('0x7')](_0x09eb('0xd2'),require('./api/jscriptySessionReport'));_0x243373[_0x09eb('0x7')](_0x09eb('0xd3'),require(_0x09eb('0xd4')));_0x243373[_0x09eb('0x7')](_0x09eb('0xd5'),require('./api/squareReport'));_0x243373['use'](_0x09eb('0xd6'),require(_0x09eb('0xd7')));_0x243373[_0x09eb('0x7')](_0x09eb('0xd8'),require(_0x09eb('0xd9')));_0x243373['use']('/api/settings',require(_0x09eb('0xda')));_0x243373[_0x09eb('0x7')]('/api/square/odbc',require('./api/squareOdbc'));_0x243373[_0x09eb('0x7')](_0x09eb('0xdb'),require(_0x09eb('0xdc')));_0x243373['use'](_0x09eb('0xdd'),require(_0x09eb('0xde')));_0x243373[_0x09eb('0x7')](_0x09eb('0xdf'),require(_0x09eb('0xe0')));_0x243373[_0x09eb('0x7')](_0x09eb('0xe1'),require(_0x09eb('0xe2')));_0x243373['use']('/api/license',require(_0x09eb('0xe3')));_0x243373['use']('/api/campaigns',require(_0x09eb('0xe4')));_0x243373[_0x09eb('0x7')](_0x09eb('0xe5'),require(_0x09eb('0xe6')));_0x243373['use'](_0x09eb('0xe7'),require(_0x09eb('0xe8')));_0x243373[_0x09eb('0x7')](_0x09eb('0xe9'),require(_0x09eb('0xea')));_0x243373[_0x09eb('0x7')](_0x09eb('0xeb'),require(_0x09eb('0xec')));_0x243373[_0x09eb('0x7')]('/api/chat/reports/transfer',require(_0x09eb('0xed')));_0x243373[_0x09eb('0x7')](_0x09eb('0xee'),require(_0x09eb('0xef')));_0x243373['use'](_0x09eb('0xf0'),require(_0x09eb('0xf1')));_0x243373[_0x09eb('0x7')](_0x09eb('0xf2'),require(_0x09eb('0xf3')));_0x243373[_0x09eb('0x7')]('/api/cm/lists',require(_0x09eb('0xf4')));_0x243373['use'](_0x09eb('0xf5'),require(_0x09eb('0xf6')));_0x243373['use'](_0x09eb('0xf7'),require(_0x09eb('0xf8')));_0x243373[_0x09eb('0x7')](_0x09eb('0xf9'),require('./api/userProfileSection'));_0x243373[_0x09eb('0x7')](_0x09eb('0xfa'),require(_0x09eb('0xfb')));_0x243373[_0x09eb('0x7')](_0x09eb('0xfc'),require(_0x09eb('0xfd')));_0x243373[_0x09eb('0x7')](_0x09eb('0xfe'),require(_0x09eb('0xff')));_0x243373[_0x09eb('0x7')]('/api/whatsapp/applications',require(_0x09eb('0x100')));_0x243373[_0x09eb('0x7')](_0x09eb('0x101'),require(_0x09eb('0x102')));_0x243373[_0x09eb('0x7')](_0x09eb('0x103'),require(_0x09eb('0x104')));_0x243373[_0x09eb('0x7')](_0x09eb('0x105'),require(_0x09eb('0x106')));_0x243373[_0x09eb('0x7')]('/api/whatsapp/reports/transfer',require(_0x09eb('0x107')));_0x243373[_0x09eb('0x7')](_0x09eb('0x108'),require(_0x09eb('0x109')));_0x243373[_0x09eb('0x7')](_0x09eb('0x10a'),require(_0x09eb('0x10b')));_0x243373[_0x09eb('0x7')](_0x09eb('0x10c'),require(_0x09eb('0x10d')));_0x243373[_0x09eb('0x7')](_0x09eb('0x10e'),require('./api/authGoogle'));_0x243373[_0x09eb('0x7')](_0x09eb('0x10f'),require(_0x09eb('0x110')));_0x243373[_0x09eb('0x7')](_0x09eb('0x111'),require('./api/rpc'));_0x243373[_0x09eb('0x7')](_0x09eb('0x112'),require(_0x09eb('0x113')));_0x243373['use'](_0x09eb('0x114'),require(_0x09eb('0x115')));_0x243373[_0x09eb('0x7')](_0x09eb('0x116'),require('./api/pm2'));_0x243373[_0x09eb('0x7')]('/api/webbar',require(_0x09eb('0x117')));_0x243373['use']('/apidoc',express[_0x09eb('0x118')](path[_0x09eb('0x119')](config[_0x09eb('0x11a')],_0x09eb('0x11b'))));_0x243373[_0x09eb('0x7')](_0x09eb('0x11c'),express[_0x09eb('0x118')](path[_0x09eb('0x119')](config[_0x09eb('0x11a')],'/www')));_0x243373[_0x09eb('0x7')](_0x09eb('0x11d'),express['static'](path[_0x09eb('0x119')](config[_0x09eb('0x11a')],_0x09eb('0x11d'))));_0x243373['use'](_0x09eb('0x11e'),express[_0x09eb('0x118')](path[_0x09eb('0x119')](config[_0x09eb('0x11a')],'snippet',_0x09eb('0x11f'))));_0x243373[_0x09eb('0x7')]('/plugins',express['static'](path[_0x09eb('0x119')](config[_0x09eb('0x11a')],'/server/files/plugins')));_0x243373['route'](_0x09eb('0x120'))[_0x09eb('0x121')](errors[0x194]);_0x243373[_0x09eb('0x122')]('/*')[_0x09eb('0x121')](function(_0x58abac,_0x37b3a0){_0x37b3a0[_0x09eb('0x123')](path[_0x09eb('0x124')](_0x243373['get'](_0x09eb('0x125'))+_0x09eb('0x126')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 97d5a44..b9d992b 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfc3=['listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.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/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.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/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error'];(function(_0x3efb27,_0x2c6200){var _0x37525a=function(_0x472fd7){while(--_0x472fd7){_0x3efb27['push'](_0x3efb27['shift']());}};_0x37525a(++_0x2c6200);}(_0xdfc3,0x1e8));var _0x3dfc=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xdfc3[_0x1deb03];return _0x189fe7;};'use strict';var jayson=require(_0x3dfc('0x0'));var BPromise=require(_0x3dfc('0x1'));var _=require('lodash');var config=require(_0x3dfc('0x2'));exports['listen']=function(){return new BPromise(function(_0x1c0f38,_0x59c812){var _0x19257e={};_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x4')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x5')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x6')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x7')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x8')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x9')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0xa')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0xb')));_0x19257e=_['merge'](_0x19257e,require('../api/trunk/trunk.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0xc')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0xd')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/mailAccount/mailAccount.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0xe')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0xf')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/mailMessage/mailMessage.rpc'));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x10')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x11')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/faxAccount/faxAccount.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/faxApplication/faxApplication.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x12')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/faxMessage/faxMessage.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x13')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/smsAccount/smsAccount.rpc'));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x14')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x15')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x16')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x17')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x18')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x19')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x1a')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x1b')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x1c')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/chatMessage/chatMessage.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x1d')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x1e')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x1f')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x20')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x21')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x22')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x23')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x24')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x25')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/template/template.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x26')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x27')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x28')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x29')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x2a')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x2b')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x2c')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x2d')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x2e')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x2f')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x30')));_0x19257e=_['merge'](_0x19257e,require('../api/squareReport/squareReport.rpc'));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x31')));_0x19257e=_['merge'](_0x19257e,require('../api/squareOdbc/squareOdbc.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x32')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x33')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/squareMessage/squareMessage.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x34')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x35')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/plugin/plugin.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x36')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x37')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x38')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x39')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x3a')));var _0x5e8a6f=jayson['server'](_0x19257e)[_0x3dfc('0x3b')]();var _0x705c43=config[_0x3dfc('0x3c')][_0x3dfc('0x3d')]||config[_0x3dfc('0x3d')]+0x1;var _0x53c3d5=config[_0x3dfc('0x3c')]['ip']||_0x3dfc('0x3e');_0x5e8a6f['on'](_0x3dfc('0x3f'),function(_0x466cb1){return _0x59c812(_0x466cb1);});_0x5e8a6f[_0x3dfc('0x40')](_0x705c43,_0x53c3d5,function(){console[_0x3dfc('0x41')](_0x3dfc('0x42'),_0x53c3d5,_0x705c43);require(_0x3dfc('0x43'))['default']();return _0x1c0f38(_0x3dfc('0x44')+_0x53c3d5+':'+_0x705c43);});});}; \ No newline at end of file +var _0x439c=['../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.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/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc'];(function(_0x3b5175,_0x2ee9ba){var _0x4138c4=function(_0x496a34){while(--_0x496a34){_0x3b5175['push'](_0x3b5175['shift']());}};_0x4138c4(++_0x2ee9ba);}(_0x439c,0xe4));var _0xc439=function(_0x1313f0,_0x20b46b){_0x1313f0=_0x1313f0-0x0;var _0x43f926=_0x439c[_0x1313f0];return _0x43f926;};'use strict';var jayson=require(_0xc439('0x0'));var BPromise=require(_0xc439('0x1'));var _=require(_0xc439('0x2'));var config=require('../config/environment');exports[_0xc439('0x3')]=function(){return new BPromise(function(_0x33103e,_0x20df16){var _0x41517e={};_0x41517e=_['merge'](_0x41517e,require('../api/user/user.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x5')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x6')));_0x41517e=_['merge'](_0x41517e,require('../api/voiceRecording/voiceRecording.rpc'));_0x41517e=_['merge'](_0x41517e,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x7')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x8')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x9')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/memberReport/memberReport.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/trunk/trunk.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0xa')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0xb')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0xc')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0xd')));_0x41517e=_['merge'](_0x41517e,require('../api/mailQueue/mailQueue.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0xe')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0xf')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x10')));_0x41517e=_['merge'](_0x41517e,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x11')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x12')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/faxInteraction/faxInteraction.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x13')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x14')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/smsAccount/smsAccount.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x15')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x16')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x17')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x18')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x19')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x1a')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x1b')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x1c')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x1d')));_0x41517e=_['merge'](_0x41517e,require('../api/chatMessage/chatMessage.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x1e')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x1f')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x20')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x21')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x22')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x23')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x24')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x25')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x26')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x27')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/template/template.rpc'));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x28')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x29')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x2a')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x2b')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x2c')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x2d')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x2e')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x2f')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x30')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x31')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x32')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x33')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x34')));_0x41517e=_['merge'](_0x41517e,require('../api/squareOdbc/squareOdbc.rpc'));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x35')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x36')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x37')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x38')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x39')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x3a')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x3b')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x3c')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x3d')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x3e')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x3f')));var _0x21ef57=jayson['server'](_0x41517e)['http']();var _0x44164f=config[_0xc439('0x40')][_0xc439('0x41')]||config['port']+0x1;var _0x274010=config['rpc']['ip']||'localhost';_0x21ef57['on']('error',function(_0x263dfa){return _0x20df16(_0x263dfa);});_0x21ef57['listen'](_0x44164f,_0x274010,function(){console[_0xc439('0x42')](_0xc439('0x43'),_0x274010,_0x44164f);require(_0xc439('0x44'))['default']();return _0x33103e(_0xc439('0x45')+_0x274010+':'+_0x44164f);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 82ad2a2..28e24e5 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 _0x82b7=['exec','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','getvariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','ready','line','toLowerCase','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','command=','write','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22'];(function(_0x2a557a,_0x585b4a){var _0x439f83=function(_0x23f445){while(--_0x23f445){_0x2a557a['push'](_0x2a557a['shift']());}};_0x439f83(++_0x585b4a);}(_0x82b7,0x111));var _0x782b=function(_0x57c91e,_0x4cad2a){_0x57c91e=_0x57c91e-0x0;var _0x158116=_0x82b7[_0x57c91e];return _0x158116;};'use strict';var util=require(_0x782b('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0x782b('0x1')];var AGIReply=require(_0x782b('0x2'));var AGIError=require(_0x782b('0x3'));function AGIChannel(_0x495f12){var _0x2b5024=this,_0x3b525c=new AGIReply(),_0x32d4fd=![],_0x4ba4b2={};EventEmitter[_0x782b('0x4')](_0x2b5024);_0x495f12['setEncoding'](_0x782b('0x5'));_0x495f12[_0x782b('0x6')](0x8*0x3c*0x3c*0x3e8);_0x3b525c[_0x782b('0x7')]('utf8');_0x3b525c['on'](_0x782b('0x8'),function(_0x587d6d){for(var _0x3cb7b7 in _0x587d6d){_0x2b5024[_0x3cb7b7]=_0x587d6d[_0x3cb7b7];}_0x2b5024['emit'](_0x782b('0x9'));});_0x3b525c['on'](_0x782b('0xa'),function(_0x30160d){if(_0x30160d[_0x782b('0xb')]()=='hangup'){_0x2b5024[_0x782b('0xc')]('hangup');return;}if(_0x30160d[_0x782b('0xd')](0x0,0xb)==_0x782b('0xe')){_0x32d4fd=!![];}if(_0x32d4fd){_0x4ba4b2['rx']+=_0x30160d+'\x0a';if(_0x30160d[_0x782b('0xf')](_0x782b('0x10'))!=-0x1){_0x32d4fd=![];}}else{_0x4ba4b2['rx']=_0x30160d;}if(_0x32d4fd){return;}if(typeof _0x4ba4b2['cb']==_0x782b('0x11')){var _0x1b95a3=_0x4ba4b2['rx'][_0x782b('0xd')](0x0,0x3),_0x523b5e=null,_0x3585ec=null;_0x1b95a3=parseInt(_0x1b95a3);if(isNaN(_0x1b95a3)){_0x4ba4b2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x782b('0x12')});return;}if(_0x1b95a3!=0xc8){_0x4ba4b2['cb'](null,{'code':_0x1b95a3,'result':-0x1,'extra':'KO'});return;}_0x523b5e=_0x4ba4b2['rx']['substring'](0x4)[_0x782b('0x13')](_0x782b('0x14'),'');if(_0x523b5e['indexOf']('\x20')!=-0x1){_0x523b5e=_0x523b5e[_0x782b('0x15')](0x0,_0x523b5e['indexOf']('\x20'));}if(_[_0x782b('0x16')](_0x523b5e,'-1')){_0x523b5e=parseInt(_0x523b5e);}_0x3585ec=_0x4ba4b2['rx'][_0x782b('0x17')]('\x20');if(_0x3585ec['length']==0x3){_0x3585ec=_0x3585ec[0x2]['substring'](0x1,_0x3585ec[0x2]['length']-0x1);}else if(_0x3585ec[_0x782b('0x18')]>0x3){var _0x39e2b4=/\((.+)\)/;var _0x3307fb=_0x4ba4b2['rx'][_0x782b('0x19')](_0x39e2b4);if(_0x3307fb){_0x3585ec=_0x3307fb[0x1];}else{_0x3585ec=null;}}else{_0x3585ec=null;}_0x4ba4b2['cb'](null,{'code':_0x1b95a3,'result':_0x523b5e,'extra':_0x3585ec});}});_0x495f12['on']('error',function(_0x3cadac){_0x2b5024['emit'](_0x782b('0x1a'),new AGIError(_0x782b('0x1b'),_0x3cadac['code']));});_0x495f12['on'](_0x782b('0x1c'),function(){_0x2b5024[_0x782b('0xc')]('close',new AGIError(_0x782b('0x1d')));});_0x495f12['on'](_0x782b('0x1e'),function(){_0x2b5024[_0x782b('0xc')](_0x782b('0x1e'),new AGIError(_0x782b('0x1f')));_0x495f12[_0x782b('0x20')]();});_0x495f12[_0x782b('0x21')](_0x3b525c);this[_0x782b('0x22')]=function(_0x51fb93,_0x542b57){console['log'](_0x782b('0x23'),_0x51fb93);var _0x51fb93=_0x51fb93||'',_0x542b57=typeof _0x542b57==_0x782b('0x11')?_0x542b57:new Function();_0x4ba4b2={'tx':_0x51fb93,'rx':'','cb':_0x542b57};_0x495f12[_0x782b('0x24')](_0x51fb93+'\x0a');},this[_0x782b('0x1c')]=function(){_0x495f12['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x782b('0x25')][_0x782b('0x26')]=function(_0x32296f){return this[_0x782b('0x22')][_0x782b('0x27')](this,_0x32296f);};AGIChannel[_0x782b('0x25')][_0x782b('0x28')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x782b('0x25')][_0x782b('0x29')]=function(_0x578c5b,_0x682056,_0x4b4490){_0x578c5b=_0x578c5b===undefined?_0x782b('0x2a'):_0x578c5b;_0x682056=_0x682056===undefined?'5':_0x682056;_0x4b4490=_0x4b4490===undefined?'1':_0x4b4490;return this['sendRequest'](util[_0x782b('0x2b')](_0x782b('0x2c'),_0x578c5b,_0x682056*0x3e8,_0x4b4490));};AGIChannel[_0x782b('0x25')]['noop']=function(_0x328202){_0x328202=_0x328202||_0x782b('0x2d');return this['sendRequest'](util[_0x782b('0x2b')](_0x782b('0x2e'),_0x328202));};AGIChannel['prototype'][_0x782b('0x2f')]=function(_0x135f41,_0x1503ef){if(_['isArray'](_0x1503ef)){return this[_0x782b('0x26')](util[_0x782b('0x2b')]('EXEC\x20%s\x20%s',_0x135f41,_0x1503ef['join'](',')));}return this[_0x782b('0x26')](util[_0x782b('0x2b')]('EXEC\x20%s\x20%s',_0x135f41,_0x1503ef));};AGIChannel[_0x782b('0x25')][_0x782b('0x30')]=function(_0xb26d5){return this[_0x782b('0x26')](util['format'](_0x782b('0x31'),_0xb26d5));};AGIChannel[_0x782b('0x25')][_0x782b('0x32')]=function(_0x54bfb9){return this[_0x782b('0x26')](util['format'](_0x782b('0x33'),_0x54bfb9));};AGIChannel[_0x782b('0x25')][_0x782b('0x34')]=function(_0x343d67){return this[_0x782b('0x26')](util['format'](_0x782b('0x35'),_0x343d67));};AGIChannel[_0x782b('0x25')]['hangup']=function(){return this[_0x782b('0x26')](_0x782b('0x36'));};AGIChannel['prototype']['setVariable']=function(_0x39cb0e,_0x39349e){var _0x5ec1d6=_[_0x782b('0x37')](_0x39349e)||_['isNumber'](_0x39349e)?_0x39349e[_0x782b('0x38')]():_0x39349e;return this['sendRequest'](util['format'](_0x782b('0x39'),_0x39cb0e,_0x5ec1d6?_0x5ec1d6[_0x782b('0x38')]()[_0x782b('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x782b('0x3a')]=function(_0x5a3af6,_0xe3db5f){return this[_0x782b('0x26')](util[_0x782b('0x2b')]('SAY\x20NUMBER\x20%s\x20%s',_0x5a3af6,_0xe3db5f));};AGIChannel[_0x782b('0x25')][_0x782b('0x3b')]=function(_0x4cbec2,_0x4f2ed3){return this[_0x782b('0x26')](util[_0x782b('0x2b')](_0x782b('0x3c'),_0x4cbec2,_0x4f2ed3));};AGIChannel[_0x782b('0x25')][_0x782b('0x3d')]=function(_0x267e19,_0x2a2804){return this[_0x782b('0x26')](util['format'](_0x782b('0x3e'),_0x267e19,_0x2a2804));};AGIChannel[_0x782b('0x25')]['continueAt']=function(_0x58751d,_0x2a0453,_0x48c466){_0x2a0453=_0x2a0453||this[_0x782b('0x3f')];_0x48c466=_0x48c466||0x1;this[_0x782b('0x30')](_0x58751d);this[_0x782b('0x32')](_0x2a0453);this['setPriority'](_0x48c466);return this[_0x782b('0x40')](util[_0x782b('0x2b')](_0x782b('0x41'),_0x58751d,_0x2a0453,_0x48c466));};AGIChannel['prototype'][_0x782b('0x42')]=function(_0x575a7d){console['log'](_0x782b('0x43'),_0x575a7d);return this[_0x782b('0x26')](util[_0x782b('0x2b')](_0x782b('0x44'),_0x575a7d));};AGIChannel[_0x782b('0x25')][_0x782b('0x45')]=function(_0x2b8839,_0x178895,_0x3c12aa,_0x1657e,_0x20a08a,_0x5460ff){_0x178895=_0x178895||'wav';_0x3c12aa=_0x3c12aa||'';_0x1657e=_0x1657e===undefined?-0x1:_0x1657e==='-1'?-0x1:_0x1657e*0x3e8;_0x20a08a=_0x20a08a===undefined?'':'s='+_0x20a08a;_0x5460ff=_0x5460ff?_0x782b('0x46'):'';return this[_0x782b('0x26')](util[_0x782b('0x2b')](_0x782b('0x47'),_0x2b8839,_0x178895,_0x3c12aa,_0x1657e,_0x5460ff,_0x20a08a));};AGIChannel[_0x782b('0x25')]['streamFile']=function(_0x159b50,_0x4a65af){_0x4a65af=_0x4a65af||'';return this[_0x782b('0x26')](util[_0x782b('0x2b')](_0x782b('0x48'),_0x159b50,_0x4a65af));};AGIChannel['prototype'][_0x782b('0x49')]=function(_0x2f7ced){return this[_0x782b('0x2f')](_0x782b('0x4a'),_0x2f7ced);};AGIChannel[_0x782b('0x25')][_0x782b('0x4b')]=function(_0x452d07){return this[_0x782b('0x2f')](_0x782b('0x4c'),_0x452d07);};AGIChannel['prototype'][_0x782b('0x1a')]=function(_0x40d47a,_0x64fd73){this[_0x782b('0x40')](util[_0x782b('0x2b')](_0x782b('0x4d'),_0x40d47a['id'],_0x40d47a[_0x782b('0x4e')],_0x64fd73));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x782b('0x4f')]=AGIChannel; \ No newline at end of file +var _0xf261=['destroy','pipe','command','log','write','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','toString','sayNumber','sayDigits','sayPhonetic','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','getvariable','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT'];(function(_0xa26647,_0xe25a78){var _0x33e921=function(_0x5632c0){while(--_0x5632c0){_0xa26647['push'](_0xa26647['shift']());}};_0x33e921(++_0xe25a78);}(_0xf261,0x11a));var _0x1f26=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf261[_0x167cc1];return _0x10bc4b;};'use strict';var util=require('util');var _=require(_0x1f26('0x0'));var EventEmitter=require(_0x1f26('0x1'))[_0x1f26('0x2')];var AGIReply=require(_0x1f26('0x3'));var AGIError=require(_0x1f26('0x4'));function AGIChannel(_0x3ed9c8){var _0x1a35c1=this,_0x2b259f=new AGIReply(),_0x5827c8=![],_0x381f0b={};EventEmitter[_0x1f26('0x5')](_0x1a35c1);_0x3ed9c8[_0x1f26('0x6')](_0x1f26('0x7'));_0x3ed9c8['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2b259f['setEncoding']('utf8');_0x2b259f['on'](_0x1f26('0x8'),function(_0xddc93b){for(var _0xd9bae6 in _0xddc93b){_0x1a35c1[_0xd9bae6]=_0xddc93b[_0xd9bae6];}_0x1a35c1['emit'](_0x1f26('0x9'));});_0x2b259f['on'](_0x1f26('0xa'),function(_0x555a98){if(_0x555a98[_0x1f26('0xb')]()==_0x1f26('0xc')){_0x1a35c1[_0x1f26('0xd')](_0x1f26('0xc'));return;}if(_0x555a98[_0x1f26('0xe')](0x0,0xb)==_0x1f26('0xf')){_0x5827c8=!![];}if(_0x5827c8){_0x381f0b['rx']+=_0x555a98+'\x0a';if(_0x555a98[_0x1f26('0x10')](_0x1f26('0x11'))!=-0x1){_0x5827c8=![];}}else{_0x381f0b['rx']=_0x555a98;}if(_0x5827c8){return;}if(typeof _0x381f0b['cb']==_0x1f26('0x12')){var _0x2e5b0b=_0x381f0b['rx']['substring'](0x0,0x3),_0x2bc876=null,_0x3b4ef5=null;_0x2e5b0b=parseInt(_0x2e5b0b);if(isNaN(_0x2e5b0b)){_0x381f0b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1f26('0x13')});return;}if(_0x2e5b0b!=0xc8){_0x381f0b['cb'](null,{'code':_0x2e5b0b,'result':-0x1,'extra':'KO'});return;}_0x2bc876=_0x381f0b['rx'][_0x1f26('0xe')](0x4)[_0x1f26('0x14')](_0x1f26('0x15'),'');if(_0x2bc876[_0x1f26('0x16')]('\x20')!=-0x1){_0x2bc876=_0x2bc876[_0x1f26('0x17')](0x0,_0x2bc876[_0x1f26('0x16')]('\x20'));}if(_[_0x1f26('0x18')](_0x2bc876,'-1')){_0x2bc876=parseInt(_0x2bc876);}_0x3b4ef5=_0x381f0b['rx'][_0x1f26('0x19')]('\x20');if(_0x3b4ef5['length']==0x3){_0x3b4ef5=_0x3b4ef5[0x2][_0x1f26('0xe')](0x1,_0x3b4ef5[0x2]['length']-0x1);}else if(_0x3b4ef5[_0x1f26('0x1a')]>0x3){var _0x5d8b29=/\((.+)\)/;var _0xa44065=_0x381f0b['rx'][_0x1f26('0x1b')](_0x5d8b29);if(_0xa44065){_0x3b4ef5=_0xa44065[0x1];}else{_0x3b4ef5=null;}}else{_0x3b4ef5=null;}_0x381f0b['cb'](null,{'code':_0x2e5b0b,'result':_0x2bc876,'extra':_0x3b4ef5});}});_0x3ed9c8['on'](_0x1f26('0x1c'),function(_0x4b4d25){_0x1a35c1[_0x1f26('0xd')](_0x1f26('0x1c'),new AGIError('E_AGI_SOCKET_ERROR',_0x4b4d25[_0x1f26('0x1d')]));});_0x3ed9c8['on'](_0x1f26('0x1e'),function(){_0x1a35c1[_0x1f26('0xd')]('close',new AGIError(_0x1f26('0x1f')));});_0x3ed9c8['on'](_0x1f26('0x20'),function(){_0x1a35c1[_0x1f26('0xd')](_0x1f26('0x20'),new AGIError(_0x1f26('0x21')));_0x3ed9c8[_0x1f26('0x22')]();});_0x3ed9c8[_0x1f26('0x23')](_0x2b259f);this[_0x1f26('0x24')]=function(_0x40e594,_0x11b1c3){console[_0x1f26('0x25')]('command=',_0x40e594);var _0x40e594=_0x40e594||'',_0x11b1c3=typeof _0x11b1c3==_0x1f26('0x12')?_0x11b1c3:new Function();_0x381f0b={'tx':_0x40e594,'rx':'','cb':_0x11b1c3};_0x3ed9c8[_0x1f26('0x26')](_0x40e594+'\x0a');},this['close']=function(){_0x3ed9c8[_0x1f26('0x22')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x1f26('0x27')][_0x1f26('0x28')]=function(_0x497333){return this[_0x1f26('0x24')][_0x1f26('0x29')](this,_0x497333);};AGIChannel[_0x1f26('0x27')][_0x1f26('0x2a')]=function(){return this[_0x1f26('0x28')](_0x1f26('0x2b'));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x2c')]=function(_0x3764c9,_0x5bb071,_0x18d0f0){_0x3764c9=_0x3764c9===undefined?_0x1f26('0x2d'):_0x3764c9;_0x5bb071=_0x5bb071===undefined?'5':_0x5bb071;_0x18d0f0=_0x18d0f0===undefined?'1':_0x18d0f0;return this['sendRequest'](util[_0x1f26('0x2e')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x3764c9,_0x5bb071*0x3e8,_0x18d0f0));};AGIChannel['prototype'][_0x1f26('0x2f')]=function(_0x7ea1b6){_0x7ea1b6=_0x7ea1b6||_0x1f26('0x30');return this[_0x1f26('0x28')](util[_0x1f26('0x2e')](_0x1f26('0x31'),_0x7ea1b6));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x32')]=function(_0x2b63fd,_0x21c104){if(_['isArray'](_0x21c104)){return this[_0x1f26('0x28')](util[_0x1f26('0x2e')]('EXEC\x20%s\x20%s',_0x2b63fd,_0x21c104['join'](',')));}return this[_0x1f26('0x28')](util[_0x1f26('0x2e')](_0x1f26('0x33'),_0x2b63fd,_0x21c104));};AGIChannel['prototype'][_0x1f26('0x34')]=function(_0x231ecf){return this[_0x1f26('0x28')](util[_0x1f26('0x2e')](_0x1f26('0x35'),_0x231ecf));};AGIChannel[_0x1f26('0x27')]['setExtension']=function(_0x5b6954){return this[_0x1f26('0x28')](util[_0x1f26('0x2e')](_0x1f26('0x36'),_0x5b6954));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x37')]=function(_0xe5a7fc){return this[_0x1f26('0x28')](util[_0x1f26('0x2e')](_0x1f26('0x38'),_0xe5a7fc));};AGIChannel[_0x1f26('0x27')]['hangup']=function(){return this[_0x1f26('0x28')](_0x1f26('0x39'));};AGIChannel[_0x1f26('0x27')]['setVariable']=function(_0x46a46d,_0x473526){var _0x3cc8d5=_[_0x1f26('0x3a')](_0x473526)||_['isNumber'](_0x473526)?_0x473526[_0x1f26('0x3b')]():_0x473526;return this[_0x1f26('0x28')](util[_0x1f26('0x2e')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x46a46d,_0x3cc8d5?_0x3cc8d5[_0x1f26('0x3b')]()[_0x1f26('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x3c')]=function(_0x2aa0a0,_0x2f12ca){return this[_0x1f26('0x28')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x2aa0a0,_0x2f12ca));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x3d')]=function(_0x492217,_0xc5988d){return this[_0x1f26('0x28')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x492217,_0xc5988d));};AGIChannel['prototype'][_0x1f26('0x3e')]=function(_0x52ce8d,_0x2c7ab8){return this[_0x1f26('0x28')](util[_0x1f26('0x2e')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x52ce8d,_0x2c7ab8));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x3f')]=function(_0x1ca3b9,_0x487815,_0x55c54b){_0x487815=_0x487815||this[_0x1f26('0x40')];_0x55c54b=_0x55c54b||0x1;this['setContext'](_0x1ca3b9);this[_0x1f26('0x41')](_0x487815);this[_0x1f26('0x37')](_0x55c54b);return this[_0x1f26('0x2f')](util['format'](_0x1f26('0x42'),_0x1ca3b9,_0x487815,_0x55c54b));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x43')]=function(_0x33e017){console[_0x1f26('0x25')](_0x1f26('0x44'),_0x33e017);return this[_0x1f26('0x28')](util[_0x1f26('0x2e')]('GET\x20VARIABLE\x20\x22%s\x22',_0x33e017));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x45')]=function(_0x46677d,_0x11d522,_0xf6661a,_0x586a04,_0x36f92c,_0x1902d1){_0x11d522=_0x11d522||_0x1f26('0x46');_0xf6661a=_0xf6661a||'';_0x586a04=_0x586a04===undefined?-0x1:_0x586a04==='-1'?-0x1:_0x586a04*0x3e8;_0x36f92c=_0x36f92c===undefined?'':'s='+_0x36f92c;_0x1902d1=_0x1902d1?'BEEP':'';return this[_0x1f26('0x28')](util['format'](_0x1f26('0x47'),_0x46677d,_0x11d522,_0xf6661a,_0x586a04,_0x1902d1,_0x36f92c));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x48')]=function(_0x87094d,_0x5710d2){_0x5710d2=_0x5710d2||'';return this[_0x1f26('0x28')](util['format'](_0x1f26('0x49'),_0x87094d,_0x5710d2));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x4a')]=function(_0x5117b3){return this[_0x1f26('0x32')]('AGI',_0x5117b3);};AGIChannel['prototype'][_0x1f26('0x4b')]=function(_0xb2b8ab){return this[_0x1f26('0x32')](_0x1f26('0x4c'),_0xb2b8ab);};AGIChannel['prototype'][_0x1f26('0x1c')]=function(_0x415f07,_0x2c56ec){this[_0x1f26('0x2f')](util[_0x1f26('0x2e')](_0x1f26('0x4d'),_0x415f07['id'],_0x415f07['label'],_0x2c56ec));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1f26('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9d6d8a4..e588ff4 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 _0xeb79=['push','format','apply','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xeb79,0x87));var _0x9eb7=function(_0xa61f52,_0xabc2af){_0xa61f52=_0xa61f52-0x0;var _0x31ab39=_0xeb79[_0xa61f52];return _0x31ab39;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x9eb7('0x0'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x9eb7('0x1'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x9eb7('0x2'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x9eb7('0x3'),'E_AGI_SOCKET_TIMEOUT':_0x9eb7('0x4'),'E_AGI_COMMAND_EMPTY':_0x9eb7('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x9eb7('0x6'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x501d0c){var _0x501d0c=_0x501d0c||null,_0x5ae8e6=_0x5ae8e6||[],_0x152a72=0x1,_0x127fb9='';if(!error[_0x501d0c]){_0x501d0c=_0x9eb7('0x7');}_0x5ae8e6[_0x9eb7('0x8')](error[_0x501d0c]);while(arguments[_0x152a72]){_0x5ae8e6[_0x9eb7('0x8')](arguments[_0x152a72]);_0x152a72++;}_0x127fb9=util[_0x9eb7('0x9')][_0x9eb7('0xa')](util,_0x5ae8e6);this['message']=_0x127fb9;this[_0x9eb7('0xb')]=_0x501d0c;}module[_0x9eb7('0xc')]=AGIError; \ No newline at end of file +var _0xb700=['apply','message','name','util','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.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x435b01,_0x64cb90){var _0x100b0e=function(_0x39bc79){while(--_0x39bc79){_0x435b01['push'](_0x435b01['shift']());}};_0x100b0e(++_0x64cb90);}(_0xb700,0x1d3));var _0x0b70=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0xb700[_0x2fd160];return _0x5c2031;};'use strict';var util=require(_0x0b70('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x0b70('0x1'),'E_AGI_SERVER_ERROR':_0x0b70('0x2'),'E_AGI_SERVER_CLOSE':_0x0b70('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x0b70('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x0b70('0x5'),'E_AGI_SOCKET_ERROR':_0x0b70('0x6'),'E_AGI_SOCKET_CLOSE':_0x0b70('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x0b70('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0b70('0x9')};function AGIError(_0x186d93){var _0x186d93=_0x186d93||null,_0x17cc6d=_0x17cc6d||[],_0x12fd11=0x1,_0x51e82a='';if(!error[_0x186d93]){_0x186d93=_0x0b70('0xa');}_0x17cc6d[_0x0b70('0xb')](error[_0x186d93]);while(arguments[_0x12fd11]){_0x17cc6d[_0x0b70('0xb')](arguments[_0x12fd11]);_0x12fd11++;}_0x51e82a=util[_0x0b70('0xc')][_0x0b70('0xd')](util,_0x17cc6d);this[_0x0b70('0xe')]=_0x51e82a;this[_0x0b70('0xf')]=_0x186d93;}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 feccc6e..18686fd 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 _0x5c00=['getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','default','menu','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','lodash','../../../config/logger','agi','getdigits','vertices','edges','numberOfEdges','prototype','push','size'];(function(_0x4ad9ca,_0xc8d326){var _0x3695b9=function(_0x62b804){while(--_0x62b804){_0x4ad9ca['push'](_0x4ad9ca['shift']());}};_0x3695b9(++_0xc8d326);}(_0x5c00,0x17e));var _0x05c0=function(_0x3e478c,_0x3afee8){_0x3e478c=_0x3e478c-0x0;var _0x3a0906=_0x5c00[_0x3e478c];return _0x3a0906;};'use strict';var _=require(_0x05c0('0x0'));var logger=require(_0x05c0('0x1'))(_0x05c0('0x2'));var verticesWithRetry=['menu',_0x05c0('0x3'),'getsecretdigits'];var Graph=function(){this[_0x05c0('0x4')]={};this[_0x05c0('0x5')]={};this[_0x05c0('0x6')]=0x0;};Graph[_0x05c0('0x7')]['addVertex']=function(_0x145973){this[_0x05c0('0x4')][_0x145973['id']]=_0x145973;this[_0x05c0('0x5')][_0x145973['id']]=[];};Graph[_0x05c0('0x7')]['addEdge']=function(_0x3a3b1b,_0x34eb5f,_0x3ad5b7){this['edges'][_0x3a3b1b][_0x05c0('0x8')]({'target':_0x34eb5f,'condition':_0x3ad5b7});this[_0x05c0('0x6')]+=0x1;};Graph[_0x05c0('0x7')][_0x05c0('0x9')]=function(){return _[_0x05c0('0x9')](this[_0x05c0('0x4')]);};Graph['prototype']['relations']=function(){return this[_0x05c0('0x6')];};Graph['prototype'][_0x05c0('0xa')]=function(_0x11cf03){return this[_0x05c0('0x4')][_0x11cf03];};Graph['prototype'][_0x05c0('0xb')]=function(_0x5eec41,_0x16a290){if(!this[_0x05c0('0x4')][_0x5eec41]){return logger[_0x05c0('0xc')](_0x05c0('0xd'));}var _0x25764b=_0x16a290(this[_0x05c0('0x4')][_0x5eec41]);if(!_0x25764b){return logger[_0x05c0('0xc')](_0x05c0('0xe'));}if(this['edges'][_0x5eec41][_0x05c0('0xf')]===0x0){return logger[_0x05c0('0xc')](_0x05c0('0x10'));}for(var _0x29e6b0=0x0,_0x27c7bd=[],_0x40153e=![];_0x29e6b0\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','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','message','[%s]\x20%s','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','catch','createSquareReport','then','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','sync','production','SQUAREROOT','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','LOOP\x20through\x20graph','start','clear','vertex','VERTEX','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','response','code','result'];(function(_0x42add0,_0x40f641){var _0x5ef7b4=function(_0x42ed02){while(--_0x42ed02){_0x42add0['push'](_0x42add0['shift']());}};_0x5ef7b4(++_0x40f641);}(_0x1e8c,0xd3));var _0xc1e8=function(_0x1c73ee,_0x49a9c9){_0x1c73ee=_0x1c73ee-0x0;var _0x154f05=_0x1e8c[_0x1c73ee];return _0x154f05;};'use strict';var parser=require('xml2json');var _=require(_0xc1e8('0x0'));var syncho=require(_0xc1e8('0x1'));var util=require(_0xc1e8('0x2'));var moment=require(_0xc1e8('0x3'));var config=require(_0xc1e8('0x4'));var logger=require(_0xc1e8('0x5'))('agi');var utilLicense=require(_0xc1e8('0x6'));var rpc=require(_0xc1e8('0x7'));var mailRpc=require(_0xc1e8('0x8'));var Graph=require(_0xc1e8('0x9'));var Vertices=require(_0xc1e8('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xc1e8('0xb')]=_['defaults'](config[_0xc1e8('0xb')],{'ip':_0xc1e8('0xc'),'port':0x11dd});function connectionHandler(_0x3b5001){process[_0xc1e8('0xd')](function(){syncho(function(){try{setChannelVariables(_0x3b5001);agiHandler(_0x3b5001);}catch(_0x46c1c7){logger[_0xc1e8('0xe')](_0x46c1c7[_0xc1e8('0xf')]);}});});}function listeningHandler(){console[_0xc1e8('0x10')](_0xc1e8('0x11'),config['agi'][_0xc1e8('0x12')]);logger[_0xc1e8('0x13')](util[_0xc1e8('0x14')](_0xc1e8('0x15'),config[_0xc1e8('0xb')]['ip'],config[_0xc1e8('0xb')][_0xc1e8('0x12')]));}function errorHandler(_0x2e2a05){if(_0x2e2a05&&_0x2e2a05['name']&&_0x2e2a05[_0xc1e8('0x16')]){logger[_0xc1e8('0xe')](util[_0xc1e8('0x14')](_0xc1e8('0x17'),_0x2e2a05[_0xc1e8('0x18')],_0x2e2a05[_0xc1e8('0x16')]));}else{logger[_0xc1e8('0xe')](util['format'](_0xc1e8('0x19'),_0x2e2a05[_0xc1e8('0xf')]));}}function closeHandler(){logger['info'](util['format'](_0xc1e8('0x1a'),this[_0xc1e8('0x1b')],this[_0xc1e8('0x1c')],this[_0xc1e8('0x1d')],this[_0xc1e8('0x1e')],this['uniqueid']));try{createSquareReport(this);}catch(_0x126d90){logger[_0xc1e8('0xe')](_0x126d90[_0xc1e8('0xf')]);}}function timeoutHandler(){logger['info'](util[_0xc1e8('0x14')](_0xc1e8('0x1f'),this[_0xc1e8('0x1b')],this[_0xc1e8('0x1c')],this[_0xc1e8('0x1d')],this['dnid'],this[_0xc1e8('0x20')]));}function hangupHandler(){logger['info'](util['format'](_0xc1e8('0x21'),this[_0xc1e8('0x1b')],this[_0xc1e8('0x1c')],this[_0xc1e8('0x1d')],this[_0xc1e8('0x1e')],this[_0xc1e8('0x20')]));this[_0xc1e8('0x22')]=!![];}function getRoot(_0x6f05e1){return parser[_0xc1e8('0x23')](_0x6f05e1,{'object':!![]})[_0xc1e8('0x24')][_0xc1e8('0x25')];}function addVertex(_0x3e8e99,_0x172712,_0x498b86){_0x172712[_0xc1e8('0x26')]=_0x498b86;if(_0x172712[_0xc1e8('0x27')](_0xc1e8('0x28'))){_0x172712[_0xc1e8('0x29')]=parseInt(_0x172712[_0xc1e8('0x28')],0xa);}_0x3e8e99[_0xc1e8('0x2a')](_[_0xc1e8('0x2b')](_0x172712,'mxCell'));}function initGraph(_0x10af8c,_0x3e4af0){var _0x5da3b7=new Graph();for(var _0x55f214 in _0x10af8c){if(_0x10af8c['hasOwnProperty'](_0x55f214)){if(_[_0xc1e8('0x2c')](_0x10af8c[_0x55f214])){for(var _0x116682=0x0;_0x116682<_0x10af8c[_0x55f214][_0xc1e8('0x2d')];_0x116682+=0x1){addVertex(_0x5da3b7,_0x10af8c[_0x55f214][_0x116682],_0x55f214);}}else{addVertex(_0x5da3b7,_0x10af8c[_0x55f214],_0x55f214);}}}for(var _0x5761a5=0x0;_0x5761a5<_0x3e4af0[_0xc1e8('0x2d')];_0x5761a5+=0x1){if(_0x3e4af0[_0x5761a5][_0xc1e8('0x2e')]&&_0x3e4af0[_0x5761a5][_0xc1e8('0x2f')]){_0x5da3b7['addEdge'](_0x3e4af0[_0x5761a5]['source'],_0x3e4af0[_0x5761a5][_0xc1e8('0x2f')],_0x3e4af0[_0x5761a5]['value']);}}return _0x5da3b7;}function getSquareProject(_0x450fd2,_0x16ada4){rpc['getSquareProject'](_0x450fd2)['then'](function(_0x23a4d8){_0x16ada4(null,_0x23a4d8);})[_0xc1e8('0x30')](function(_0x5c5c92){_0x16ada4(null,_0x5c5c92);});}function createSquareReport(_0x5c0316,_0x3a2fc2){rpc[_0xc1e8('0x31')](_0x5c0316)[_0xc1e8('0x32')](function(_0x113256){if(_0x3a2fc2){_0x3a2fc2(null,_0x113256);}})[_0xc1e8('0x30')](function(_0x2cc7aa){if(_0x3a2fc2){_0x3a2fc2(null,_0x2cc7aa);}});}function setChannelVariables(_0x3bcff5){for(var _0x212623 in _0x3bcff5){if(_0x3bcff5[_0xc1e8('0x27')](_0x212623)){if(_0x212623[_0xc1e8('0x33')](_0xc1e8('0x34'))===0x0){_0x3bcff5[_0x212623[_0xc1e8('0x35')](0x4)]=_0x3bcff5[_0x212623];delete _0x3bcff5[_0x212623];}}}}function getLogFromObject(_0x35cea7){return util['inspect'](_0x35cea7,{'showHidden':![],'depth':null});}function agiHandler(_0x280d14){var _0x18495e,_0x5aa14e,_0x549d68,_0x29e09a,_0x487e71;logger[_0xc1e8('0x36')](_0xc1e8('0x37'),JSON[_0xc1e8('0x38')](_0x280d14,null,0x2));logger['info'](util['format'](_0xc1e8('0x39'),_0x280d14['arg_1'],_0x280d14[_0xc1e8('0x1c')],_0x280d14['callerid'],_0x280d14['dnid'],_0x280d14[_0xc1e8('0x20')]));_0x280d14['on'](_0xc1e8('0xe'),errorHandler);_0x280d14['on'](_0xc1e8('0x3a'),closeHandler);_0x280d14['on'](_0xc1e8('0x3b'),timeoutHandler);_0x280d14[_0xc1e8('0x22')]=![];_0x280d14['on']('hangup',hangupHandler);var _0x5be106=getSquareProject[_0xc1e8('0x3c')](null,_0x280d14['arg_1']);if(_0x5be106){if(_0x5be106[_0xc1e8('0x3d')]){_0x18495e=getRoot(_0x5be106[_0xc1e8('0x3d')]);console[_0xc1e8('0x10')](_0xc1e8('0x3e'),_0x18495e);if(_0x18495e&&_0x18495e['start']){logger['debug']('root',JSON[_0xc1e8('0x38')](_0x18495e,null,0x2));_0x280d14[_0xc1e8('0x3f')]=moment()[_0xc1e8('0x14')](_0xc1e8('0x40'));_0x5aa14e=initGraph(_[_0xc1e8('0x2b')](_0x18495e,_0xc1e8('0x41')),_0x18495e['mxCell']);_0x549d68=new Vertices(_0x280d14,rpc,mailRpc);console['log']('vertices',_0x549d68);logger[_0xc1e8('0x13')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x280d14[_0xc1e8('0x1b')],_0x280d14[_0xc1e8('0x1c')],_0x280d14[_0xc1e8('0x1d')],_0x280d14[_0xc1e8('0x1e')],_0x280d14[_0xc1e8('0x20')]));console['log'](_0xc1e8('0x42'));_0x5aa14e['traverseBFS'](_0x18495e[_0xc1e8('0x43')]['id'],function(_0x2484c5){try{_0x2484c5=_0x549d68[_0xc1e8('0x44')](_0x2484c5);logger[_0xc1e8('0x36')](_0xc1e8('0x45'),JSON[_0xc1e8('0x38')](_0x2484c5,null,0x2));console[_0xc1e8('0x10')](_0xc1e8('0x46'),_0x2484c5);if(_0x2484c5[_0xc1e8('0x26')]===_0xc1e8('0x47')){logger['info'](_0xc1e8('0x48'));_0x280d14[_0xc1e8('0x49')]=_0x2484c5[_0xc1e8('0x49')]||_0x280d14[_0xc1e8('0x49')];_0x280d14[_0xc1e8('0x4a')]=_0x2484c5['extension'];_0x280d14[_0xc1e8('0x4b')]=_0x2484c5[_0xc1e8('0x4b')]?_0x2484c5[_0xc1e8('0x4b')]-0x1:0x1;return null;}else if(_0x2484c5&&_0x549d68[_0x2484c5[_0xc1e8('0x26')]]){_0x487e71=_0x549d68[_0x2484c5['agicommand']](_0x2484c5);console[_0xc1e8('0x10')](_0xc1e8('0x4c'),_0x487e71);logger[_0xc1e8('0x13')](_0xc1e8('0x4d'),JSON['stringify'](_0x487e71,null,0x2));if(_0x487e71&&_0x487e71[_0xc1e8('0x4e')]===AGI_CODE_SUCCESS&&_0x487e71[_0xc1e8('0x4f')]!==AGI_RESULT_ERROR&&!_0x280d14[_0xc1e8('0x22')]){logger['debug'](_0xc1e8('0x4d'),getLogFromObject(_0x487e71));return _[_0xc1e8('0x50')](_0x487e71[_0xc1e8('0x4f')])?null:_0x487e71['result'][_0xc1e8('0x51')]();}else{logger[_0xc1e8('0xe')]('response',getLogFromObject(_0x487e71));return null;}}else{logger[_0xc1e8('0xe')](_0xc1e8('0x52'));return null;}}catch(_0x57fedb){logger[_0xc1e8('0xe')](_0x57fedb[_0xc1e8('0xf')]);return null;}});if(_0x18495e[_0xc1e8('0x53')]){logger[_0xc1e8('0x13')](util[_0xc1e8('0x14')](_0xc1e8('0x54'),_0x280d14['arg_1'],_0x280d14['calleridname'],_0x280d14['callerid'],_0x280d14['dnid'],_0x280d14[_0xc1e8('0x20')]));_0x5aa14e['traverseBFS'](_0x18495e[_0xc1e8('0x53')]['id'],function(_0x18c9b0){try{_0x18c9b0=_0x549d68[_0xc1e8('0x44')](_0x18c9b0);logger['debug']('vertex',JSON[_0xc1e8('0x38')](_0x18c9b0,null,0x2));if(_0x18c9b0&&_0x549d68[_0x18c9b0[_0xc1e8('0x26')]]){_0x487e71=_0x549d68[_0x18c9b0[_0xc1e8('0x26')]](_0x18c9b0);if(_0x487e71){logger[_0xc1e8('0x36')](_0xc1e8('0x4d'),getLogFromObject(_0x487e71));return _[_0xc1e8('0x50')](_0x487e71[_0xc1e8('0x4f')])?null:_0x487e71[_0xc1e8('0x4f')]['toString']();}else{logger['error'](_0xc1e8('0x4d'),getLogFromObject(_0x487e71));return null;}}else{logger['error'](_0xc1e8('0x52'));return null;}}catch(_0x30d721){logger[_0xc1e8('0xe')](_0x30d721['stack']);return null;}});}logger[_0xc1e8('0x13')](util[_0xc1e8('0x14')](_0xc1e8('0x55'),_0x280d14['arg_1'],_0x280d14['calleridname'],_0x280d14[_0xc1e8('0x1d')],_0x280d14[_0xc1e8('0x1e')],_0x280d14[_0xc1e8('0x20')]));logger[_0xc1e8('0x13')](util[_0xc1e8('0x14')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x280d14[_0xc1e8('0x49')],_0x280d14[_0xc1e8('0x4a')],parseInt(_0x280d14[_0xc1e8('0x4b')],0xa)+0x1));_0x280d14[_0xc1e8('0x56')](_0x280d14[_0xc1e8('0x49')],_0x280d14[_0xc1e8('0x4a')],parseInt(_0x280d14[_0xc1e8('0x4b')],0xa)+0x1);_0x280d14[_0xc1e8('0x3a')]();}}else{logger[_0xc1e8('0xe')](util[_0xc1e8('0x14')](_0xc1e8('0x57'),_0x280d14['arg_1']));_0x280d14['continueAt'](_0x280d14['context'],_0x280d14[_0xc1e8('0x4a')],parseInt(_0x280d14[_0xc1e8('0x4b')],0xa)+0x1);_0x280d14[_0xc1e8('0x3a')]();}}else{logger['error'](util[_0xc1e8('0x14')]('Project\x20%s\x20not\x20found',_0x280d14[_0xc1e8('0x1b')]));_0x280d14[_0xc1e8('0x56')](_0x280d14[_0xc1e8('0x49')],_0x280d14[_0xc1e8('0x4a')],parseInt(_0x280d14['priority'],0xa)+0x1);_0x280d14[_0xc1e8('0x3a')]();}}function main(){var _0x2b0d82;return utilLicense[_0xc1e8('0x58')]()[_0xc1e8('0x32')](function(_0xe0e993){if(_0xe0e993){if(_0xe0e993[_0xc1e8('0x59')]){if(_0xe0e993['callysquare']&&_0xe0e993[_0xc1e8('0x5a')]>0x0){logger[_0xc1e8('0x13')](util[_0xc1e8('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0xe0e993['callysquare']));_0x2b0d82=_0xe0e993[_0xc1e8('0x5a')];}else{logger[_0xc1e8('0x13')](_0xc1e8('0x5b'));}}else{logger[_0xc1e8('0x13')](_0xc1e8('0x5c'));_0x2b0d82=-0x1;}}})[_0xc1e8('0x30')](function(_0x58308d){logger['error'](_0xc1e8('0x5d'),_0x58308d[_0xc1e8('0xf')]);})['finally'](function(){var _0x2c3169=require(_0xc1e8('0x5e'))(config[_0xc1e8('0xb')]['port'],config[_0xc1e8('0xb')]['ip'],_0x2b0d82);_0x2c3169['on']('error',errorHandler);_0x2c3169['on'](_0xc1e8('0x5f'),listeningHandler);_0x2c3169['on'](_0xc1e8('0x60'),connectionHandler);_0x2c3169['on'](_0xc1e8('0x3a'),closeHandler);});}main(); \ No newline at end of file +var _0x7aa1=['[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./rpc','./vertices','defaults','nextTick','error','log','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','info','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','mxGraphModel','root','agicommand','hasOwnProperty','retry','omit','isArray','length','target','addEdge','source','value','getSquareProject','then','createSquareReport','catch','indexOf','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','SQUAREROOT','start','debug','YYYY-MM-DD\x20HH:mm:ss','mxCell','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','clear','vertex','VERTEX','gotoc','context','extension','priority','vresponse','code','result','response','toString','agicommand\x20not\x20found','finally'];(function(_0x1f3591,_0x1270e9){var _0x3ffcd8=function(_0x1898ac){while(--_0x1898ac){_0x1f3591['push'](_0x1f3591['shift']());}};_0x3ffcd8(++_0x1270e9);}(_0x7aa1,0x6e));var _0x17aa=function(_0x504637,_0x6ca85c){_0x504637=_0x504637-0x0;var _0x2cfe27=_0x7aa1[_0x504637];return _0x2cfe27;};'use strict';var parser=require(_0x17aa('0x0'));var _=require(_0x17aa('0x1'));var syncho=require(_0x17aa('0x2'));var util=require(_0x17aa('0x3'));var moment=require(_0x17aa('0x4'));var config=require(_0x17aa('0x5'));var logger=require('../../config/logger')(_0x17aa('0x6'));var utilLicense=require(_0x17aa('0x7'));var rpc=require(_0x17aa('0x8'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x17aa('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x17aa('0x6')]=_[_0x17aa('0xa')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x28811b){process[_0x17aa('0xb')](function(){syncho(function(){try{setChannelVariables(_0x28811b);agiHandler(_0x28811b);}catch(_0x5997c9){logger[_0x17aa('0xc')](_0x5997c9['stack']);}});});}function listeningHandler(){console[_0x17aa('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x17aa('0x6')][_0x17aa('0xe')]);logger['info'](util[_0x17aa('0xf')](_0x17aa('0x10'),config[_0x17aa('0x6')]['ip'],config[_0x17aa('0x6')][_0x17aa('0xe')]));}function errorHandler(_0x262036){if(_0x262036&&_0x262036[_0x17aa('0x11')]&&_0x262036[_0x17aa('0x12')]){logger[_0x17aa('0xc')](util[_0x17aa('0xf')](_0x17aa('0x13'),_0x262036[_0x17aa('0x11')],_0x262036['message']));}else{logger[_0x17aa('0xc')](util[_0x17aa('0xf')](_0x17aa('0x14'),_0x262036[_0x17aa('0x15')]));}}function closeHandler(){logger['info'](util['format'](_0x17aa('0x16'),this[_0x17aa('0x17')],this['calleridname'],this['callerid'],this[_0x17aa('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x5c9d2e){logger[_0x17aa('0xc')](_0x5c9d2e['stack']);}}function timeoutHandler(){logger['info'](util['format'](_0x17aa('0x19'),this[_0x17aa('0x17')],this['calleridname'],this[_0x17aa('0x1a')],this['dnid'],this[_0x17aa('0x1b')]));}function hangupHandler(){logger[_0x17aa('0x1c')](util[_0x17aa('0xf')](_0x17aa('0x1d'),this[_0x17aa('0x17')],this[_0x17aa('0x1e')],this[_0x17aa('0x1a')],this[_0x17aa('0x18')],this[_0x17aa('0x1b')]));this[_0x17aa('0x1f')]=!![];}function getRoot(_0x2bce11){return parser['toJson'](_0x2bce11,{'object':!![]})[_0x17aa('0x20')][_0x17aa('0x21')];}function addVertex(_0xb0f4d4,_0x49d235,_0x5883e3){_0x49d235[_0x17aa('0x22')]=_0x5883e3;if(_0x49d235[_0x17aa('0x23')](_0x17aa('0x24'))){_0x49d235['maxRetry']=parseInt(_0x49d235[_0x17aa('0x24')],0xa);}_0xb0f4d4['addVertex'](_[_0x17aa('0x25')](_0x49d235,'mxCell'));}function initGraph(_0x37f195,_0x566c0b){var _0xf637cf=new Graph();for(var _0x517a78 in _0x37f195){if(_0x37f195[_0x17aa('0x23')](_0x517a78)){if(_[_0x17aa('0x26')](_0x37f195[_0x517a78])){for(var _0x542e0b=0x0;_0x542e0b<_0x37f195[_0x517a78][_0x17aa('0x27')];_0x542e0b+=0x1){addVertex(_0xf637cf,_0x37f195[_0x517a78][_0x542e0b],_0x517a78);}}else{addVertex(_0xf637cf,_0x37f195[_0x517a78],_0x517a78);}}}for(var _0xf8dfaf=0x0;_0xf8dfaf<_0x566c0b['length'];_0xf8dfaf+=0x1){if(_0x566c0b[_0xf8dfaf]['source']&&_0x566c0b[_0xf8dfaf][_0x17aa('0x28')]){_0xf637cf[_0x17aa('0x29')](_0x566c0b[_0xf8dfaf][_0x17aa('0x2a')],_0x566c0b[_0xf8dfaf][_0x17aa('0x28')],_0x566c0b[_0xf8dfaf][_0x17aa('0x2b')]);}}return _0xf637cf;}function getSquareProject(_0x27d215,_0x4a4357){rpc[_0x17aa('0x2c')](_0x27d215)[_0x17aa('0x2d')](function(_0x13a2b5){_0x4a4357(null,_0x13a2b5);})['catch'](function(_0x4bf10a){_0x4a4357(null,_0x4bf10a);});}function createSquareReport(_0x1b3a5d,_0x18f56b){rpc[_0x17aa('0x2e')](_0x1b3a5d)[_0x17aa('0x2d')](function(_0x1f0606){if(_0x18f56b){_0x18f56b(null,_0x1f0606);}})[_0x17aa('0x2f')](function(_0x1bbc42){if(_0x18f56b){_0x18f56b(null,_0x1bbc42);}});}function setChannelVariables(_0x2a1d1d){for(var _0x5c82f0 in _0x2a1d1d){if(_0x2a1d1d[_0x17aa('0x23')](_0x5c82f0)){if(_0x5c82f0[_0x17aa('0x30')]('agi_')===0x0){_0x2a1d1d[_0x5c82f0[_0x17aa('0x31')](0x4)]=_0x2a1d1d[_0x5c82f0];delete _0x2a1d1d[_0x5c82f0];}}}}function getLogFromObject(_0x5e56a5){return util[_0x17aa('0x32')](_0x5e56a5,{'showHidden':![],'depth':null});}function agiHandler(_0x507a86){var _0x305c31,_0x1f5e2d,_0x1007a9,_0x45006b,_0x20bee2;logger['debug'](_0x17aa('0x33'),JSON[_0x17aa('0x34')](_0x507a86,null,0x2));logger[_0x17aa('0x1c')](util[_0x17aa('0xf')](_0x17aa('0x35'),_0x507a86['arg_1'],_0x507a86[_0x17aa('0x1e')],_0x507a86['callerid'],_0x507a86[_0x17aa('0x18')],_0x507a86[_0x17aa('0x1b')]));_0x507a86['on'](_0x17aa('0xc'),errorHandler);_0x507a86['on'](_0x17aa('0x36'),closeHandler);_0x507a86['on']('timeout',timeoutHandler);_0x507a86[_0x17aa('0x1f')]=![];_0x507a86['on'](_0x17aa('0x37'),hangupHandler);var _0x113a9d=getSquareProject[_0x17aa('0x38')](null,_0x507a86['arg_1']);if(_0x113a9d){if(_0x113a9d[_0x17aa('0x39')]){_0x305c31=getRoot(_0x113a9d[_0x17aa('0x39')]);console[_0x17aa('0xd')](_0x17aa('0x3a'),_0x305c31);if(_0x305c31&&_0x305c31[_0x17aa('0x3b')]){logger[_0x17aa('0x3c')](_0x17aa('0x21'),JSON['stringify'](_0x305c31,null,0x2));_0x507a86['joinAt']=moment()[_0x17aa('0xf')](_0x17aa('0x3d'));_0x1f5e2d=initGraph(_[_0x17aa('0x25')](_0x305c31,_0x17aa('0x3e')),_0x305c31[_0x17aa('0x3e')]);_0x1007a9=new Vertices(_0x507a86,rpc,mailRpc);console[_0x17aa('0xd')](_0x17aa('0x3f'),_0x1007a9);logger[_0x17aa('0x1c')](util[_0x17aa('0xf')](_0x17aa('0x40'),_0x507a86[_0x17aa('0x17')],_0x507a86[_0x17aa('0x1e')],_0x507a86[_0x17aa('0x1a')],_0x507a86[_0x17aa('0x18')],_0x507a86[_0x17aa('0x1b')]));console[_0x17aa('0xd')](_0x17aa('0x41'));_0x1f5e2d['traverseBFS'](_0x305c31[_0x17aa('0x3b')]['id'],function(_0x5921e6){try{_0x5921e6=_0x1007a9[_0x17aa('0x42')](_0x5921e6);logger[_0x17aa('0x3c')](_0x17aa('0x43'),JSON[_0x17aa('0x34')](_0x5921e6,null,0x2));console[_0x17aa('0xd')](_0x17aa('0x44'),_0x5921e6);if(_0x5921e6[_0x17aa('0x22')]===_0x17aa('0x45')){logger[_0x17aa('0x1c')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x507a86['context']=_0x5921e6[_0x17aa('0x46')]||_0x507a86['context'];_0x507a86[_0x17aa('0x47')]=_0x5921e6[_0x17aa('0x47')];_0x507a86[_0x17aa('0x48')]=_0x5921e6[_0x17aa('0x48')]?_0x5921e6[_0x17aa('0x48')]-0x1:0x1;return null;}else if(_0x5921e6&&_0x1007a9[_0x5921e6[_0x17aa('0x22')]]){_0x20bee2=_0x1007a9[_0x5921e6[_0x17aa('0x22')]](_0x5921e6);console[_0x17aa('0xd')](_0x17aa('0x49'),_0x20bee2);logger[_0x17aa('0x1c')]('response',JSON[_0x17aa('0x34')](_0x20bee2,null,0x2));if(_0x20bee2&&_0x20bee2[_0x17aa('0x4a')]===AGI_CODE_SUCCESS&&_0x20bee2[_0x17aa('0x4b')]!==AGI_RESULT_ERROR&&!_0x507a86[_0x17aa('0x1f')]){logger[_0x17aa('0x3c')](_0x17aa('0x4c'),getLogFromObject(_0x20bee2));return _['isUndefined'](_0x20bee2[_0x17aa('0x4b')])?null:_0x20bee2[_0x17aa('0x4b')][_0x17aa('0x4d')]();}else{logger[_0x17aa('0xc')](_0x17aa('0x4c'),getLogFromObject(_0x20bee2));return null;}}else{logger[_0x17aa('0xc')](_0x17aa('0x4e'));return null;}}catch(_0x1940d5){logger[_0x17aa('0xc')](_0x1940d5['stack']);return null;}});if(_0x305c31[_0x17aa('0x4f')]){logger['info'](util[_0x17aa('0xf')](_0x17aa('0x50'),_0x507a86[_0x17aa('0x17')],_0x507a86[_0x17aa('0x1e')],_0x507a86[_0x17aa('0x1a')],_0x507a86[_0x17aa('0x18')],_0x507a86['uniqueid']));_0x1f5e2d[_0x17aa('0x51')](_0x305c31['finally']['id'],function(_0x4ae6a5){try{_0x4ae6a5=_0x1007a9[_0x17aa('0x42')](_0x4ae6a5);logger[_0x17aa('0x3c')](_0x17aa('0x43'),JSON['stringify'](_0x4ae6a5,null,0x2));if(_0x4ae6a5&&_0x1007a9[_0x4ae6a5[_0x17aa('0x22')]]){_0x20bee2=_0x1007a9[_0x4ae6a5[_0x17aa('0x22')]](_0x4ae6a5);if(_0x20bee2){logger['debug'](_0x17aa('0x4c'),getLogFromObject(_0x20bee2));return _[_0x17aa('0x52')](_0x20bee2['result'])?null:_0x20bee2[_0x17aa('0x4b')]['toString']();}else{logger[_0x17aa('0xc')](_0x17aa('0x4c'),getLogFromObject(_0x20bee2));return null;}}else{logger[_0x17aa('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x91f4e1){logger[_0x17aa('0xc')](_0x91f4e1[_0x17aa('0x15')]);return null;}});}logger[_0x17aa('0x1c')](util[_0x17aa('0xf')](_0x17aa('0x53'),_0x507a86[_0x17aa('0x17')],_0x507a86['calleridname'],_0x507a86[_0x17aa('0x1a')],_0x507a86[_0x17aa('0x18')],_0x507a86[_0x17aa('0x1b')]));logger[_0x17aa('0x1c')](util[_0x17aa('0xf')](_0x17aa('0x54'),_0x507a86[_0x17aa('0x46')],_0x507a86[_0x17aa('0x47')],parseInt(_0x507a86[_0x17aa('0x48')],0xa)+0x1));_0x507a86[_0x17aa('0x55')](_0x507a86[_0x17aa('0x46')],_0x507a86['extension'],parseInt(_0x507a86['priority'],0xa)+0x1);_0x507a86[_0x17aa('0x36')]();}}else{logger[_0x17aa('0xc')](util['format']('Project\x20%s\x20not\x20published',_0x507a86[_0x17aa('0x17')]));_0x507a86[_0x17aa('0x55')](_0x507a86[_0x17aa('0x46')],_0x507a86[_0x17aa('0x47')],parseInt(_0x507a86[_0x17aa('0x48')],0xa)+0x1);_0x507a86[_0x17aa('0x36')]();}}else{logger[_0x17aa('0xc')](util[_0x17aa('0xf')]('Project\x20%s\x20not\x20found',_0x507a86['arg_1']));_0x507a86[_0x17aa('0x55')](_0x507a86[_0x17aa('0x46')],_0x507a86['extension'],parseInt(_0x507a86['priority'],0xa)+0x1);_0x507a86[_0x17aa('0x36')]();}}function main(){var _0x4fe2f7;return utilLicense[_0x17aa('0x56')]()['then'](function(_0x2c0ef5){if(_0x2c0ef5){if(_0x2c0ef5[_0x17aa('0x57')]){if(_0x2c0ef5[_0x17aa('0x58')]&&_0x2c0ef5[_0x17aa('0x58')]>0x0){logger[_0x17aa('0x1c')](util[_0x17aa('0xf')](_0x17aa('0x59'),_0x2c0ef5[_0x17aa('0x58')]));_0x4fe2f7=_0x2c0ef5['callysquare'];}else{logger['info'](_0x17aa('0x5a'));}}else{logger[_0x17aa('0x1c')](_0x17aa('0x5b'));_0x4fe2f7=-0x1;}}})[_0x17aa('0x2f')](function(_0x1dbf43){logger['error']('[LICENSE]',_0x1dbf43[_0x17aa('0x15')]);})[_0x17aa('0x4f')](function(){var _0x26f7ba=require(_0x17aa('0x5c'))(config[_0x17aa('0x6')][_0x17aa('0xe')],config[_0x17aa('0x6')]['ip'],_0x4fe2f7);_0x26f7ba['on'](_0x17aa('0xc'),errorHandler);_0x26f7ba['on'](_0x17aa('0x5d'),listeningHandler);_0x26f7ba['on'](_0x17aa('0x5e'),connectionHandler);_0x26f7ba['on'](_0x17aa('0x36'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 0e79e64..5a5d04d 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x27ec7c,_0x3e2a52){var _0xd88bcb=function(_0x1fbd90){while(--_0x1fbd90){_0x27ec7c['push'](_0x27ec7c['shift']());}};_0xd88bcb(++_0x3e2a52);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0xfcf655,_0x5ae91a){var _0x356485=function(_0xabc736){while(--_0xabc736){_0xfcf655['push'](_0xfcf655['shift']());}};_0x356485(++_0x5ae91a);}(_0x34e8,0x12c));var _0x834e=function(_0x5dfa3c,_0x352a60){_0x5dfa3c=_0x5dfa3c-0x0;var _0x4b3c6b=_0x34e8[_0x5dfa3c];return _0x4b3c6b;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 5ee34a9..47e7434 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(_0x12dadd,_0x4609ee){var _0x13f4fb=function(_0x1cbd57){while(--_0x1cbd57){_0x12dadd['push'](_0x12dadd['shift']());}};_0x13f4fb(++_0x4609ee);}(_0x7a54,0x106));var _0x47a5=function(_0x43fd17,_0x1e9465){_0x43fd17=_0x43fd17-0x0;var _0x424c2e=_0x7a54[_0x43fd17];return _0x424c2e;};'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(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0xb10b,0x12a));var _0xbb10=function(_0x346e6b,_0x1f4479){_0x346e6b=_0x346e6b-0x0;var _0x15f973=_0xb10b[_0x346e6b];return _0x15f973;};'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 d306e49..c921430 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 _0x9612=['production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','name','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','log','rpcreq','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','phone','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','client','request','then','error','message','catch','ShowSquareProject'];(function(_0x17e40c,_0x528987){var _0x3a97a4=function(_0x2cea22){while(--_0x2cea22){_0x17e40c['push'](_0x17e40c['shift']());}};_0x3a97a4(++_0x528987);}(_0x9612,0x1dd));var _0x2961=function(_0x2fa357,_0xc14637){_0x2fa357=_0x2fa357-0x0;var _0x528a40=_0x9612[_0x2fa357];return _0x528a40;};'use strict';var BPromise=require('bluebird');var moment=require(_0x2961('0x0'));var _=require(_0x2961('0x1'));var util=require(_0x2961('0x2'));var jayson=require(_0x2961('0x3'));var client=jayson[_0x2961('0x4')]['http']({'port':0x2329});function request(_0x14782f,_0x546176){return new BPromise(function(_0x5b8440,_0x46158c){return client[_0x2961('0x5')](_0x14782f,_0x546176)[_0x2961('0x6')](function(_0x38f343){if(_0x38f343[_0x2961('0x7')]){return _0x46158c(_0x38f343[_0x2961('0x7')][_0x2961('0x8')]);}else{return _0x5b8440(_0x38f343['result']);}})[_0x2961('0x9')](function(_0x15ce4f){return _0x46158c(_0x15ce4f);});});}exports['getSquareProject']=function(_0x3ae182){return request(_0x2961('0xa'),{'options':{'raw':![],'where':{'name':_0x3ae182},'attributes':[_0x2961('0xb')]}});};exports[_0x2961('0xc')]=function(_0x124c2c){return request(_0x2961('0xd'),{'options':{'raw':![],'where':{'id':_0x124c2c},'include':[{'model':_0x2961('0xe'),'as':_0x2961('0xf')}],'attributes':['id','name',_0x2961('0x10')]}});};exports[_0x2961('0x11')]=function(_0x5134ef){return request('ShowSquareProject',{'options':{'where':{'id':_0x5134ef},'attributes':['name']}});};exports[_0x2961('0x12')]=function(_0x1a6a1e){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1a6a1e},'attributes':['name']}});};exports[_0x2961('0x13')]=function(_0x232b47){return request(_0x2961('0x14'),{'options':{'where':{'id':_0x232b47},'attributes':[_0x2961('0x15')]}});};exports[_0x2961('0x16')]=function(_0x28b473){return request(_0x2961('0x17'),{'options':{'where':{'id':_0x28b473},'attributes':[_0x2961('0x18')]}});};exports[_0x2961('0x19')]=function(_0x1d513d){return request('ShowUser',{'options':{'where':{'id':_0x1d513d},'attributes':['name']}});};exports[_0x2961('0x1a')]=function(_0x5eab94){console[_0x2961('0x1b')](_0x2961('0x1c'),_0x5eab94);return request('GetContactByPhone',{'options':{'where':{'phone':_0x5eab94['phone']},'attributes':['id']}});};exports[_0x2961('0x1d')]=function(_0x29545c){return request(_0x2961('0x1e'),{'options':{'where':{'id':_0x29545c},'attributes':[_0x2961('0x15')]}});};exports[_0x2961('0x1f')]=function(_0x17c952){return request(_0x2961('0x20'),{'options':{'where':{'id':_0x17c952},'attributes':[_0x2961('0x21')]}});};exports[_0x2961('0x22')]=function(_0x271a99){return request(_0x2961('0x23'),{'options':{'raw':![],'where':{'id':_0x271a99},'include':[{'model':_0x2961('0x24'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x1fde76){return request(_0x2961('0x25'),{'options':{'where':{'id':_0x1fde76},'attributes':['id',_0x2961('0x15')]}});};exports[_0x2961('0x26')]=function(_0x93d49a){return request('CreateSmsMessage',{'body':_0x93d49a});};exports[_0x2961('0x27')]=function(_0x41f324){return request(_0x2961('0x28'),{'body':_0x41f324});};exports[_0x2961('0x29')]=function(_0x304a3e){return request(_0x2961('0x2a'),{'body':_[_0x2961('0x2b')](_0x304a3e,{'project_name':_0x304a3e[_0x2961('0x2c')],'prev_project_name':_0x304a3e[_0x2961('0x2d')]||'','is_subproject':_0x304a3e[_0x2961('0x2d')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x2961('0x2e')]=function(_0x5df297){return request(_0x2961('0x2f'),{'body':_0x5df297});};exports['createSquareMessage']=function(_0x2f1d09){return request(_0x2961('0x30'),{'body':_0x2f1d09});};exports[_0x2961('0x31')]=function(_0x5007fa){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x5007fa[_0x2961('0x32')],'ListId':_0x5007fa[_0x2961('0x33')]}}})[_0x2961('0x6')](function(_0x54532f){if(_0x54532f){return _0x54532f;}return request(_0x2961('0x34'),{'body':_0x5007fa});});};exports[_0x2961('0x35')]=function(_0x58313d){return request('ShowPause',{'options':{'where':{'id':_0x58313d},'attributes':[_0x2961('0x15')]}});};exports[_0x2961('0x36')]=function(_0x3ea5b5,_0x280a42){return request(_0x2961('0x37'),{'body':{'interface':_0x280a42},'options':{'where':_0x3ea5b5}});};exports['agentPause']=function(_0x379b80,_0xa294d3,_0x151057){return request(_0x2961('0x38'),{'body':{'type':_0xa294d3,'uniqueid':_0x151057},'options':{'where':_0x379b80}});};exports[_0x2961('0x39')]=function(_0x3ce62c){return request(_0x2961('0x3a'),{'body':{},'options':{'where':_0x3ce62c}});};exports[_0x2961('0x3b')]=function(_0x4de06d){return request(_0x2961('0x3c'),{'body':{},'options':{'where':_0x4de06d}});}; \ No newline at end of file +var _0x60eb=['CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','client','http','then','error','message','result','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','dsn','getUserById','ShowUser','getContactByPhone','rpcreq','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x60eb,0x17e));var _0xb60e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x60eb[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0xb60e('0x0'));var moment=require(_0xb60e('0x1'));var _=require('lodash');var util=require(_0xb60e('0x2'));var jayson=require(_0xb60e('0x3'));var client=jayson[_0xb60e('0x4')][_0xb60e('0x5')]({'port':0x2329});function request(_0x18e900,_0x270f19){return new BPromise(function(_0x57c830,_0xf6b228){return client['request'](_0x18e900,_0x270f19)[_0xb60e('0x6')](function(_0x4fc548){if(_0x4fc548[_0xb60e('0x7')]){return _0xf6b228(_0x4fc548['error'][_0xb60e('0x8')]);}else{return _0x57c830(_0x4fc548[_0xb60e('0x9')]);}})['catch'](function(_0x5abde7){return _0xf6b228(_0x5abde7);});});}exports['getSquareProject']=function(_0x4c4b51){return request(_0xb60e('0xa'),{'options':{'raw':![],'where':{'name':_0x4c4b51},'attributes':['production']}});};exports[_0xb60e('0xb')]=function(_0x52571d){return request(_0xb60e('0xc'),{'options':{'raw':![],'where':{'id':_0x52571d},'include':[{'model':_0xb60e('0xd'),'as':_0xb60e('0xe')}],'attributes':['id',_0xb60e('0xf'),_0xb60e('0x10')]}});};exports[_0xb60e('0x11')]=function(_0x46a611){return request(_0xb60e('0xa'),{'options':{'where':{'id':_0x46a611},'attributes':[_0xb60e('0xf')]}});};exports[_0xb60e('0x12')]=function(_0x472aa3){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x472aa3},'attributes':[_0xb60e('0xf')]}});};exports[_0xb60e('0x13')]=function(_0x4bca2a){return request(_0xb60e('0x14'),{'options':{'where':{'id':_0x4bca2a},'attributes':[_0xb60e('0xf')]}});};exports['getSquareOdbcById']=function(_0x29e0d7){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x29e0d7},'attributes':[_0xb60e('0x15')]}});};exports[_0xb60e('0x16')]=function(_0x361eae){return request(_0xb60e('0x17'),{'options':{'where':{'id':_0x361eae},'attributes':[_0xb60e('0xf')]}});};exports[_0xb60e('0x18')]=function(_0x4e3c3d){console['log'](_0xb60e('0x19'),_0x4e3c3d);return request(_0xb60e('0x1a'),{'options':{'where':{'phone':_0x4e3c3d[_0xb60e('0x1b')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x11fa42){return request(_0xb60e('0x1c'),{'options':{'where':{'id':_0x11fa42},'attributes':[_0xb60e('0xf')]}});};exports[_0xb60e('0x1d')]=function(_0x14ecdc){return request(_0xb60e('0x1e'),{'options':{'where':{'id':_0x14ecdc},'attributes':[_0xb60e('0x1f')]}});};exports[_0xb60e('0x20')]=function(_0x1360e0){return request(_0xb60e('0x21'),{'options':{'raw':![],'where':{'id':_0x1360e0},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0xb60e('0x22')]=function(_0x203797){return request(_0xb60e('0x23'),{'options':{'where':{'id':_0x203797},'attributes':['id',_0xb60e('0xf')]}});};exports['createSmsMessage']=function(_0x5106fd){return request(_0xb60e('0x24'),{'body':_0x5106fd});};exports[_0xb60e('0x25')]=function(_0x1e9370){return request('CreateSquareDetailsReport',{'body':_0x1e9370});};exports[_0xb60e('0x26')]=function(_0x400088){return request(_0xb60e('0x27'),{'body':_[_0xb60e('0x28')](_0x400088,{'project_name':_0x400088[_0xb60e('0x29')],'prev_project_name':_0x400088[_0xb60e('0x2a')]||'','is_subproject':_0x400088['arg_2']?!![]:![],'leaveAt':moment()[_0xb60e('0x2b')](_0xb60e('0x2c'))})});};exports[_0xb60e('0x2d')]=function(_0x515499){return request(_0xb60e('0x2e'),{'body':_0x515499});};exports[_0xb60e('0x2f')]=function(_0xb04028){return request(_0xb60e('0x30'),{'body':_0xb04028});};exports[_0xb60e('0x31')]=function(_0x21b245){return request(_0xb60e('0x32'),{'options':{'raw':![],'where':{'phone':_0x21b245[_0xb60e('0x1b')],'ListId':_0x21b245[_0xb60e('0x33')]}}})[_0xb60e('0x6')](function(_0x3b4b81){if(_0x3b4b81){return _0x3b4b81;}return request(_0xb60e('0x34'),{'body':_0x21b245});});};exports[_0xb60e('0x35')]=function(_0x1452bb){return request(_0xb60e('0x36'),{'options':{'where':{'id':_0x1452bb},'attributes':[_0xb60e('0xf')]}});};exports[_0xb60e('0x37')]=function(_0x17199e,_0x416d33){return request(_0xb60e('0x38'),{'body':{'interface':_0x416d33},'options':{'where':_0x17199e}});};exports[_0xb60e('0x39')]=function(_0x56d9ee,_0x144bb3,_0x5e3be8){return request('PauseUser',{'body':{'type':_0x144bb3,'uniqueid':_0x5e3be8},'options':{'where':_0x56d9ee}});};exports[_0xb60e('0x3a')]=function(_0x526e60){return request(_0xb60e('0x3b'),{'body':{},'options':{'where':_0x526e60}});};exports[_0xb60e('0x3c')]=function(_0x41ec3f){return request(_0xb60e('0x3d'),{'body':{},'options':{'where':_0x41ec3f}});}; \ 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 a04f719..3a1570f 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 _0x29d4=['exports','./polly'];(function(_0x3eefcb,_0xfcbdfb){var _0x2a35ca=function(_0x5901de){while(--_0x5901de){_0x3eefcb['push'](_0x3eefcb['shift']());}};_0x2a35ca(++_0xfcbdfb);}(_0x29d4,0x1a1));var _0x429d=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x29d4[_0x3e112d];return _0x531c31;};var polly=require(_0x429d('0x0'));var lex=require('./lex');module[_0x429d('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x8ce3=['./lex','./polly'];(function(_0x1e475c,_0x3bf7b4){var _0x2bf368=function(_0x4caefd){while(--_0x4caefd){_0x1e475c['push'](_0x1e475c['shift']());}};_0x2bf368(++_0x3bf7b4);}(_0x8ce3,0xc3));var _0x38ce=function(_0x4cce81,_0x252735){_0x4cce81=_0x4cce81-0x0;var _0xad14bc=_0x8ce3[_0x4cce81];return _0xad14bc;};var polly=require(_0x38ce('0x0'));var lex=require(_0x38ce('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 54e40f7..ff56406 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 _0xee39=['./lib/api','exports'];(function(_0x32342b,_0x50e7e6){var _0x305ec6=function(_0x5291db){while(--_0x5291db){_0x32342b['push'](_0x32342b['shift']());}};_0x305ec6(++_0x50e7e6);}(_0xee39,0x1e6));var _0x9ee3=function(_0x55e846,_0x1c4bea){_0x55e846=_0x55e846-0x0;var _0x56a7e0=_0xee39[_0x55e846];return _0x56a7e0;};'use strict';var lex=require(_0x9ee3('0x0'));module[_0x9ee3('0x1')]=function(_0xe604cf,_0x58cf62,_0x39e617,_0x64784f,_0x18357f,_0x3cdeaf){return lex(_0xe604cf,_0x58cf62,_0x39e617,_0x64784f,_0x18357f,_0x3cdeaf);}; \ No newline at end of file +var _0xd0bb=['exports','./lib/api'];(function(_0x171520,_0x1cee8c){var _0x3cc729=function(_0x201c4a){while(--_0x201c4a){_0x171520['push'](_0x171520['shift']());}};_0x3cc729(++_0x1cee8c);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x8bca3f,_0x158cf8){_0x8bca3f=_0x8bca3f-0x0;var _0x448ab5=_0xd0bb[_0x8bca3f];return _0x448ab5;};'use strict';var lex=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]=function(_0x43bfb8,_0x5793c9,_0x68ea36,_0x4ab08f,_0x39b03a,_0x1f6ec3){return lex(_0x43bfb8,_0x5793c9,_0x68ea36,_0x4ab08f,_0x39b03a,_0x1f6ec3);}; \ 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 f08e927..9a0a737 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 _0x0b9b=['slots','exports','LexRuntime','bluebird','aws-sdk','postText'];(function(_0x12fd63,_0x46fb87){var _0x517411=function(_0x35fc42){while(--_0x35fc42){_0x12fd63['push'](_0x12fd63['shift']());}};_0x517411(++_0x46fb87);}(_0x0b9b,0xf3));var _0xb0b9=function(_0x1c8820,_0x199f64){_0x1c8820=_0x1c8820-0x0;var _0x48e84d=_0x0b9b[_0x1c8820];return _0x48e84d;};'use strict';var BPromise=require(_0xb0b9('0x0'));var AWS=require(_0xb0b9('0x1'));function lexResult(_0x4d0f2b,_0x1f65cc){return new BPromise(function(_0x2a1f34,_0x14b953){_0x4d0f2b[_0xb0b9('0x2')](_0x1f65cc,function(_0x11e599,_0x2f4f66){if(_0x11e599){_0x14b953(_0x11e599);}if(_0x2f4f66[_0xb0b9('0x3')]){for(const _0x437216 in _0x2f4f66['slots']){if(_0x2f4f66['slots']['hasOwnProperty'](_0x437216)){var _0x26448c=_0x2f4f66[_0xb0b9('0x3')][_0x437216];_0x2f4f66['slot_'+_0x437216]=_0x26448c;}}}_0x2a1f34(_0x2f4f66);});});}module[_0xb0b9('0x4')]=function(_0x15c915,_0x2e7337,_0x2b4c25,_0x183e6e,_0x123338,_0x20adfa){var _0x5a0351=new AWS[(_0xb0b9('0x5'))]({'accessKeyId':_0x2e7337,'secretAccessKey':_0x2b4c25,'region':_0x183e6e});var _0x4ea14e={'botAlias':'$LATEST','botName':_0x20adfa,'inputText':_0x123338,'userId':_0x15c915};return lexResult(_0x5a0351,_0x4ea14e);}; \ No newline at end of file +var _0xd191=['exports','LexRuntime','bluebird','aws-sdk','postText','slots','hasOwnProperty','slot_'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xd191,0xe2));var _0x1d19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd191[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x1d19('0x0'));var AWS=require(_0x1d19('0x1'));function lexResult(_0x32fb2c,_0x441e67){return new BPromise(function(_0x48f927,_0x5230e2){_0x32fb2c[_0x1d19('0x2')](_0x441e67,function(_0x3495f5,_0x2b1f5b){if(_0x3495f5){_0x5230e2(_0x3495f5);}if(_0x2b1f5b[_0x1d19('0x3')]){for(const _0x523e81 in _0x2b1f5b[_0x1d19('0x3')]){if(_0x2b1f5b['slots'][_0x1d19('0x4')](_0x523e81)){var _0x568932=_0x2b1f5b[_0x1d19('0x3')][_0x523e81];_0x2b1f5b[_0x1d19('0x5')+_0x523e81]=_0x568932;}}}_0x48f927(_0x2b1f5b);});});}module[_0x1d19('0x6')]=function(_0x25d07d,_0x51febb,_0x35c64b,_0x179ea5,_0x3906b6,_0x3a2036){var _0xb7d00a=new AWS[(_0x1d19('0x7'))]({'accessKeyId':_0x51febb,'secretAccessKey':_0x35c64b,'region':_0x179ea5});var _0x5d5737={'botAlias':'$LATEST','botName':_0x3a2036,'inputText':_0x3906b6,'userId':_0x25d07d};return lexResult(_0xb7d00a,_0x5d5737);}; \ 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 c123ddb..a2214ad 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 _0x499c=['exports'];(function(_0x225d43,_0x22f803){var _0x213152=function(_0x16634e){while(--_0x16634e){_0x225d43['push'](_0x225d43['shift']());}};_0x213152(++_0x22f803);}(_0x499c,0x1ba));var _0xc499=function(_0x129253,_0x58e440){_0x129253=_0x129253-0x0;var _0x2e8565=_0x499c[_0x129253];return _0x2e8565;};'use strict';var polly=require('./lib/api');module[_0xc499('0x0')]=function(_0x403bf4,_0x406e09,_0x1b1ff1,_0x451ed7,_0x345aee,_0x20e50d,_0x2f3911){return polly(_0x403bf4,_0x406e09,_0x1b1ff1,_0x451ed7,_0x345aee,_0x20e50d,_0x2f3911);}; \ No newline at end of file +var _0x43b3=['./lib/api','exports'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x43b3,0x1be));var _0x343b=function(_0x34a278,_0x28a04d){_0x34a278=_0x34a278-0x0;var _0x1f38bb=_0x43b3[_0x34a278];return _0x1f38bb;};'use strict';var polly=require(_0x343b('0x0'));module[_0x343b('0x1')]=function(_0x270336,_0x5e69cb,_0x359a96,_0x4002bb,_0x5136e5,_0x4a1d43,_0x28ea0d){return polly(_0x270336,_0x5e69cb,_0x359a96,_0x4002bb,_0x5136e5,_0x4a1d43,_0x28ea0d);}; \ 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 49280e7..174a9ac 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 _0xc655=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0xc655,0x1df));var _0x5c65=function(_0x2315b9,_0x995911){_0x2315b9=_0x2315b9-0x0;var _0x518780=_0xc655[_0x2315b9];return _0x518780;};'use strict';var fs=require('fs');var path=require(_0x5c65('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x5c65('0x1'));function pollyResult(_0x25c2db,_0x470b7e,_0x491764){return new BPromise(function(_0x82abcc,_0x3e85c7){_0x25c2db[_0x5c65('0x2')](_0x470b7e,function(_0x282b6e,_0x1e6103){if(_0x282b6e){_0x3e85c7(_0x282b6e);}else if(_0x1e6103){if(_0x1e6103[_0x5c65('0x3')]instanceof Buffer){fs[_0x5c65('0x4')](_0x491764,_0x1e6103[_0x5c65('0x3')],function(_0x43d9c6){if(_0x43d9c6){_0x3e85c7(_0x43d9c6);}else{_0x82abcc();}});}else{_0x3e85c7(new Error(_0x5c65('0x5')));}}else{_0x3e85c7(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x3b32b7,_0x5db219,_0x15d42,_0x51f23c,_0x3ff4c6,_0x223100,_0x5bdf57){var _0x161f1f=new AWS[(_0x5c65('0x6'))]({'accessKeyId':_0x3b32b7,'secretAccessKey':_0x5db219,'region':_0x15d42});var _0x4e2b08={'Text':_0x3ff4c6,'TextType':_0x223100||_0x5c65('0x7'),'OutputFormat':'mp3','VoiceId':_0x51f23c};return pollyResult(_0x161f1f,_0x4e2b08,_0x5bdf57);}; \ No newline at end of file +var _0x1664=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x5836d8,_0x4a568a){var _0x49a100=function(_0x4f817a){while(--_0x4f817a){_0x5836d8['push'](_0x5836d8['shift']());}};_0x49a100(++_0x4a568a);}(_0x1664,0x1a4));var _0x4166=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x1664[_0x26462c];return _0x509a42;};'use strict';var fs=require('fs');var path=require(_0x4166('0x0'));var BPromise=require(_0x4166('0x1'));var rs=require(_0x4166('0x2'));var AWS=require(_0x4166('0x3'));function pollyResult(_0x429f0c,_0x181ab2,_0x1e3580){return new BPromise(function(_0xad4812,_0xffa71e){_0x429f0c[_0x4166('0x4')](_0x181ab2,function(_0x4fd9b7,_0x467f3a){if(_0x4fd9b7){_0xffa71e(_0x4fd9b7);}else if(_0x467f3a){if(_0x467f3a[_0x4166('0x5')]instanceof Buffer){fs[_0x4166('0x6')](_0x1e3580,_0x467f3a['AudioStream'],function(_0x4c1bbf){if(_0x4c1bbf){_0xffa71e(_0x4c1bbf);}else{_0xad4812();}});}else{_0xffa71e(new Error(_0x4166('0x7')));}}else{_0xffa71e(new Error(_0x4166('0x8')));}});});}module[_0x4166('0x9')]=function(_0x36c3d0,_0x5d3b78,_0x2b1799,_0x1effd9,_0x323ac8,_0x212e95,_0x360359){var _0x33e330=new AWS[(_0x4166('0xa'))]({'accessKeyId':_0x36c3d0,'secretAccessKey':_0x5d3b78,'region':_0x2b1799});var _0x5eb427={'Text':_0x323ac8,'TextType':_0x212e95||_0x4166('0xb'),'OutputFormat':'mp3','VoiceId':_0x1effd9};return pollyResult(_0x33e330,_0x5eb427,_0x360359);}; \ 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 e7669cb..c350143 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 _0xb778=['exports','./lib/api'];(function(_0x5e66f6,_0x1d5092){var _0x14e47c=function(_0x42bb0e){while(--_0x42bb0e){_0x5e66f6['push'](_0x5e66f6['shift']());}};_0x14e47c(++_0x1d5092);}(_0xb778,0x127));var _0x8b77=function(_0x161f59,_0x42e9ff){_0x161f59=_0x161f59-0x0;var _0x3ffa0e=_0xb778[_0x161f59];return _0x3ffa0e;};'use strict';var asr=require(_0x8b77('0x0'));module[_0x8b77('0x1')]=function(_0x5de6f5,_0x590788,_0x129fda,_0x27a5e0){return asr(_0x5de6f5,_0x590788,_0x129fda);}; \ No newline at end of file +var _0x43b4=['exports'];(function(_0x34a087,_0x4bd68e){var _0x5c15d7=function(_0x152823){while(--_0x152823){_0x34a087['push'](_0x34a087['shift']());}};_0x5c15d7(++_0x4bd68e);}(_0x43b4,0x11e));var _0x443b=function(_0x169879,_0x13ae35){_0x169879=_0x169879-0x0;var _0x1973ff=_0x43b4[_0x169879];return _0x1973ff;};'use strict';var asr=require('./lib/api');module[_0x443b('0x0')]=function(_0x14b5dc,_0xc74c53,_0x5ae52c,_0xcbd80d){return asr(_0x14b5dc,_0xc74c53,_0x5ae52c);}; \ 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 1c10efc..0e66d16 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 _0x683f=['key\x20should\x20be\x20a\x20string','undefined','readFileSync','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x3c858f,_0x235201){var _0x198090=function(_0xc4c406){while(--_0xc4c406){_0x3c858f['push'](_0x3c858f['shift']());}};_0x198090(++_0x235201);}(_0x683f,0x149));var _0xf683=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x683f[_0x3b76f7];return _0x43984e;};'use strict';var url=require(_0xf683('0x0'));var BPromise=require(_0xf683('0x1'));var fs=require('fs');var host=_0xf683('0x2');module[_0xf683('0x3')]=function(_0x4d1c56,_0x56a31b,_0x576b82){return new BPromise(function(_0x51872d,_0xa914d5){var _0x22981c;if(typeof _0x4d1c56!==_0xf683('0x4')||_0x4d1c56[_0xf683('0x5')]===0x0){return _0xa914d5(_0xf683('0x6'));}if(typeof _0x56a31b!==_0xf683('0x4')||_0x56a31b['length']===0x0){return _0xa914d5(_0xf683('0x7'));}if(typeof _0x576b82!==_0xf683('0x8')&&(typeof _0x576b82!==_0xf683('0x4')||_0x576b82[_0xf683('0x5')]===0x0)){return _0xa914d5('lang\x20should\x20be\x20a\x20string');}try{_0x22981c=fs[_0xf683('0x9')](_0x4d1c56)['toString']('base64');}catch(_0x5e7a06){return _0xa914d5(_0x5e7a06);}return _0x51872d({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x56a31b,'body':{'config':{'encoding':_0xf683('0xa'),'sampleRateHertz':_0xf683('0xb'),'languageCode':_0x576b82},'audio':{'content':_0x22981c}},'json':!![]});});}; \ No newline at end of file +var _0x8a29=['toString','base64','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x8a29,0x113));var _0x98a2=function(_0x511021,_0x39d3d8){_0x511021=_0x511021-0x0;var _0xdb1bd9=_0x8a29[_0x511021];return _0xdb1bd9;};'use strict';var url=require(_0x98a2('0x0'));var BPromise=require(_0x98a2('0x1'));var fs=require('fs');var host=_0x98a2('0x2');module[_0x98a2('0x3')]=function(_0x131882,_0x36d074,_0xe02886){return new BPromise(function(_0x510450,_0x158719){var _0x3d8e53;if(typeof _0x131882!==_0x98a2('0x4')||_0x131882[_0x98a2('0x5')]===0x0){return _0x158719(_0x98a2('0x6'));}if(typeof _0x36d074!==_0x98a2('0x4')||_0x36d074[_0x98a2('0x5')]===0x0){return _0x158719(_0x98a2('0x7'));}if(typeof _0xe02886!==_0x98a2('0x8')&&(typeof _0xe02886!==_0x98a2('0x4')||_0xe02886[_0x98a2('0x5')]===0x0)){return _0x158719(_0x98a2('0x9'));}try{_0x3d8e53=fs['readFileSync'](_0x131882)[_0x98a2('0xa')](_0x98a2('0xb'));}catch(_0x98a8b8){return _0x158719(_0x98a8b8);}return _0x510450({'method':_0x98a2('0xc'),'uri':host+_0x98a2('0xd')+_0x36d074,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x98a2('0xe'),'languageCode':_0xe02886},'audio':{'content':_0x3d8e53}},'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 55a487f..10cb4be 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfe9=['./asr','exports'];(function(_0x3ccbbe,_0xd9fb14){var _0x267b02=function(_0x547ed5){while(--_0x547ed5){_0x3ccbbe['push'](_0x3ccbbe['shift']());}};_0x267b02(++_0xd9fb14);}(_0xdfe9,0x8a));var _0x9dfe=function(_0x3deee5,_0x2731d0){_0x3deee5=_0x3deee5-0x0;var _0x1c92fb=_0xdfe9[_0x3deee5];return _0x1c92fb;};var asr=require(_0x9dfe('0x0'));module[_0x9dfe('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index d32e530..42810bb 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 _0x2636=['https:','WHAT_EVER','get','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','finish','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','protocol','host','data','end','transcode','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','.wav','base64','then','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','chmodSync','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','path','http','bluebird','randomstring','sox','util','querystring','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','./sestek','../../../config/logger','agi'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2636,0x1c0));var _0x6263=function(_0x4993f8,_0x29b20d){_0x4993f8=_0x4993f8-0x0;var _0x10a52c=_0x2636[_0x4993f8];return _0x10a52c;};'use strict';var fs=require('fs');var path=require(_0x6263('0x0'));var http=require(_0x6263('0x1'));var https=require('https');var urlParse=require('url')['parse'];var BPromise=require(_0x6263('0x2'));var rs=require(_0x6263('0x3'));var sox=require(_0x6263('0x4'));var rp=require('request-promise');var util=require(_0x6263('0x5'));var querystring=require(_0x6263('0x6'));var tts=require(_0x6263('0x7'));var apiai=require(_0x6263('0x8'));var md5=require(_0x6263('0x9'));var google=require(_0x6263('0xa'));var aws=require(_0x6263('0xb'));var tilde=require(_0x6263('0xc'));var sestek=require(_0x6263('0xd'));var logger=require(_0x6263('0xe'))(_0x6263('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x13ba36,_0x54b494){return new BPromise(function(_0x4ff9ce,_0x28fd24){var _0xc1f731=urlParse(_0x13ba36);var _0x83979a=_0xc1f731['protocol']===_0x6263('0x10')?https:http;var _0xb93170={'host':_0xc1f731['host'],'path':_0xc1f731[_0x6263('0x0')],'headers':{'user-agent':_0x6263('0x11')}};_0x83979a[_0x6263('0x12')](_0xb93170,function(_0x311a7d){if(_0x311a7d['statusCode']!==0xc8){logger['error'](_0x6263('0x13')+_0x13ba36+'\x20failed,\x20status\x20code\x20=\x20'+_0x311a7d[_0x6263('0x14')]+'\x20('+_0x311a7d[_0x6263('0x15')]+')');_0x28fd24(new Error('request\x20to\x20'+_0x13ba36+_0x6263('0x16')+_0x311a7d[_0x6263('0x14')]+'\x20('+_0x311a7d[_0x6263('0x15')]+')'));return;}var _0x45c180=fs['createWriteStream'](_0x54b494);_0x45c180['on'](_0x6263('0x17'),function(){logger['info'](_0x6263('0x18'));_0x45c180[_0x6263('0x19')](_0x4ff9ce);});_0x45c180['on'](_0x6263('0x1a'),function(_0x5d3d8d){fs[_0x6263('0x1b')](_0x54b494);logger['error'](_0x6263('0x1c'),_0x5d3d8d);_0x28fd24(_0x5d3d8d);});_0x311a7d[_0x6263('0x1d')](_0x45c180);})['on']('error',function(_0xc99f08){logger['error'](_0xc99f08);_0x28fd24(_0xc99f08);})['end']();});}function uploadFile(_0x2f6ef4){return new BPromise(function(_0x54f406,_0x5bc71a){var _0x3699c0=urlParse(_0x2f6ef4);var _0x4489fa=_0x3699c0[_0x6263('0x1e')]===_0x6263('0x10')?https:http;var _0x1e660c={'host':_0x3699c0[_0x6263('0x1f')],'path':_0x3699c0[_0x6263('0x0')],'headers':{'user-agent':_0x6263('0x11')}};_0x4489fa[_0x6263('0x12')](_0x1e660c,function(_0x472910){if(_0x472910[_0x6263('0x14')]!==0xc8){_0x5bc71a(new Error(_0x6263('0x13')+_0x2f6ef4+_0x6263('0x16')+_0x472910[_0x6263('0x14')]+'\x20('+_0x472910[_0x6263('0x15')]+')'));return;}var _0x1255d3='';_0x472910['on'](_0x6263('0x20'),function(_0x5150fa){_0x1255d3+=_0x5150fa;});_0x472910['on']('end',function(){_0x54f406(_0x1255d3);});})['on'](_0x6263('0x1a'),function(_0x2c013e){_0x5bc71a(_0x2c013e);})[_0x6263('0x21')]();});}function convertFile(_0x340944,_0x2d8768){return new BPromise(function(_0x30742b,_0x380412){var _0x5e47f6=sox[_0x6263('0x22')](_0x340944,_0x2d8768,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5e47f6['on'](_0x6263('0x1a'),function(_0x441538){logger['error'](_0x6263('0x23'),_0x441538);_0x380412(_0x441538);});_0x5e47f6['on']('end',function(){logger[_0x6263('0x24')](_0x6263('0x25'));_0x30742b();});_0x5e47f6[_0x6263('0x26')]();});}function base64Decode(_0x113083,_0x5999ae){var _0xe218d4=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs['generate'](0x4)+_0x6263('0x29'));fs['writeFileSync'](_0xe218d4,_0x113083,_0x6263('0x2a'));return convertFile(_0xe218d4,_0x5999ae)[_0x6263('0x2b')](function(){try{fs[_0x6263('0x1b')](_0xe218d4);fs['chmodSync'](_0x5999ae,_0x6263('0x2c'));}catch(_0x3f4b0f){logger[_0x6263('0x1a')](_0x3f4b0f);}return _0x5999ae[_0x6263('0x2d')]('.')[0x0];});}function base64Encode(_0x129fc9){var _0x347ef7=fs[_0x6263('0x2e')](_0x129fc9);return new Buffer(_0x347ef7)[_0x6263('0x2f')](_0x6263('0x2a'));}exports['googleCloudTTS']=function(_0x445d7d,_0x3c8a62,_0x3c866b,_0x30461d,_0x13271c,_0x175c18){var _0x38c4dd,_0x302c08;var _0x202582=_0x6263('0x30');var _0x5af27b=_0x6263('0x31')+_0x445d7d;var _0x1231bb={};if(_0x3c8a62===_0x6263('0x32')){_0x1231bb[_0x6263('0x33')]={'ssml':_0x3c866b};}else{_0x1231bb[_0x6263('0x33')]={'text':_0x3c866b};};_0x1231bb[_0x6263('0x34')]={'languageCode':_0x30461d,'ssmlGender':_0x13271c};_0x1231bb[_0x6263('0x35')]={'audioEncoding':_0x6263('0x36'),'sampleRateHertz':0x1f40};var _0xb515fd={'url':_0x202582+_0x6263('0x37')+_0x5af27b,'method':_0x6263('0x38'),'json':!![],'body':_0x1231bb};return rp(_0xb515fd)[_0x6263('0x2b')](function(_0x187247){return new BPromise(function(_0x577d41,_0x27910b){_0x38c4dd=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+_0x6263('0x3a'));var _0x49c4bd=Buffer[_0x6263('0x3b')](_0x187247['audioContent'],'base64');return fs['writeFile'](_0x38c4dd,_0x49c4bd,function(_0x5400d4){_0x27910b(_0x5400d4);},function(_0x15e6bf){fs[_0x6263('0x3c')](_0x38c4dd,'777');_0x577d41(_0x15e6bf);});});})['then'](function(_0x5b4ba8){_0x302c08=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+'.wav');return convertFile(_0x38c4dd,_0x302c08);})['then'](function(){try{fs[_0x6263('0x1b')](_0x38c4dd);fs[_0x6263('0x3c')](_0x302c08,_0x6263('0x2c'));}catch(_0x1f8862){logger[_0x6263('0x1a')](_0x1f8862);}logger['info'](_0x6263('0x3d'),_0x302c08[_0x6263('0x2d')]('.')[0x0]);return _0x302c08[_0x6263('0x2d')]('.')[0x0];});};exports[_0x6263('0x3e')]=function(_0x3f3b21,_0x80ea00){var _0x2708e0,_0x46cb93;return tts(_0x3f3b21,_0x80ea00||'en',0x1)[_0x6263('0x2b')](function(_0x3f8ed0){logger[_0x6263('0x24')](_0x3f8ed0);_0x2708e0=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+_0x6263('0x3a'));return downloadFile(_0x3f8ed0,_0x2708e0);})[_0x6263('0x2b')](function(){_0x46cb93=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+'.wav');return convertFile(_0x2708e0,_0x46cb93);})[_0x6263('0x2b')](function(){try{fs[_0x6263('0x1b')](_0x2708e0);fs[_0x6263('0x3c')](_0x46cb93,'777');}catch(_0x1974a4){logger[_0x6263('0x1a')](_0x1974a4);}logger[_0x6263('0x24')](_0x6263('0x3f'),_0x46cb93['split']('.')[0x0]);return _0x46cb93['split']('.')[0x0];});};exports[_0x6263('0x40')]=function(_0x4dbab9,_0x5da030,_0x98f21e){return google[_0x6263('0x41')](_0x4dbab9,_0x5da030,_0x98f21e)[_0x6263('0x2b')](function(_0x5c2164){logger['info'](_0x5c2164[_0x6263('0x42')]);return rp(_0x5c2164);})[_0x6263('0x2b')](function(_0x2b5c13){var _0x547abc='';var _0x200b19=0x0;try{fs[_0x6263('0x1b')](_0x4dbab9);}catch(_0x5dadc1){logger[_0x6263('0x1a')](_0x5dadc1);}if(_0x2b5c13&&_0x2b5c13[_0x6263('0x43')]){_0x547abc=_0x2b5c13[_0x6263('0x43')][_0x6263('0x44')](function(_0x3a345e){return _0x3a345e&&_0x3a345e[_0x6263('0x45')][0x0]&&_0x3a345e[_0x6263('0x45')][0x0][_0x6263('0x46')]?_0x3a345e['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x200b19=_0x2b5c13[_0x6263('0x43')]['map'](function(_0x2c7c9a){return _0x2c7c9a&&_0x2c7c9a[_0x6263('0x45')][0x0]&&_0x2c7c9a[_0x6263('0x45')][0x0][_0x6263('0x47')]?_0x2c7c9a[_0x6263('0x45')][0x0][_0x6263('0x47')]:0x0;})[_0x6263('0x48')]('\x0a');}logger['info'](_0x6263('0x49'),_0x547abc);logger[_0x6263('0x24')](_0x6263('0x4a'),_0x200b19);return{'transcript':_0x547abc,'confidence':_0x200b19};})[_0x6263('0x4b')](function(_0x6adf5c){logger[_0x6263('0x1a')](_0x6263('0x4c'),_0x6adf5c[_0x6263('0x14')],_0x6adf5c[_0x6263('0x4d')],_0x6adf5c[_0x6263('0x4e')]);});};exports[_0x6263('0x4f')]=function(_0x344d18,_0x4d012a,_0x27cd27,_0x23a098){var _0x1b6f51=apiai(_0x4d012a,{'language':_0x23a098||'en'});return _0x1b6f51[_0x6263('0x50')](_0x27cd27,{'sessionId':md5(_0x344d18)})[_0x6263('0x2b')](function(_0xb8ecd8){logger[_0x6263('0x24')](JSON[_0x6263('0x51')](_0xb8ecd8));return{'source':_0xb8ecd8[_0x6263('0x52')][_0x6263('0x53')],'resolvedQuery':_0xb8ecd8['result'][_0x6263('0x54')],'action':_0xb8ecd8[_0x6263('0x52')]['action'],'actionIncomplete':_0xb8ecd8['result'][_0x6263('0x55')],'speech':_0xb8ecd8[_0x6263('0x52')][_0x6263('0x56')][_0x6263('0x57')],'score':_0xb8ecd8['result'][_0x6263('0x58')],'statusCode':_0xb8ecd8[_0x6263('0x59')][_0x6263('0x5a')],'endConversation':_0xb8ecd8[_0x6263('0x52')][_0x6263('0x5b')][_0x6263('0x5c')]||![],'isFallbackIntent':_0xb8ecd8[_0x6263('0x52')][_0x6263('0x5b')][_0x6263('0x5d')]};});};exports[_0x6263('0x5e')]=function(_0x42f482,_0x47be39,_0x1874ea,_0x4213bf){return tilde[_0x6263('0x41')](_0x42f482,_0x47be39,_0x1874ea,_0x4213bf)[_0x6263('0x2b')](function(_0x51b675){try{fs[_0x6263('0x1b')](_0x42f482);}catch(_0x15dcf2){logger[_0x6263('0x1a')](_0x15dcf2);}logger[_0x6263('0x24')](_0x6263('0x5f'),_0x51b675[_0x6263('0x46')]);logger['info'](_0x6263('0x60'),_0x51b675['confidence']);return _0x51b675;});};exports[_0x6263('0x61')]=function(_0x316b28,_0x399484,_0x58cc8c,_0x30f6c5,_0x57a40b,_0x4a8f){var _0x119d5a=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+_0x6263('0x3a'));var _0x4d357a;return aws[_0x6263('0x62')](_0x316b28,_0x399484,_0x58cc8c,_0x30f6c5,_0x57a40b,_0x4a8f,_0x119d5a)[_0x6263('0x2b')](function(){_0x4d357a=path['resolve'](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+'.wav');return convertFile(_0x119d5a,_0x4d357a);})[_0x6263('0x2b')](function(){try{fs['unlink'](_0x119d5a);fs[_0x6263('0x3c')](_0x4d357a,_0x6263('0x2c'));}catch(_0x57c65f){logger[_0x6263('0x1a')](_0x57c65f);}return _0x4d357a[_0x6263('0x2d')]('.')[0x0];});};exports[_0x6263('0x63')]=function(_0x44a897,_0x2479e1,_0x3f13dc,_0x447102,_0x219421,_0x492709){return aws[_0x6263('0x64')](_0x44a897,_0x2479e1,_0x3f13dc,_0x447102,_0x219421,_0x492709)[_0x6263('0x2b')](function(_0x505c73){logger[_0x6263('0x24')](JSON[_0x6263('0x51')](_0x505c73));return _0x505c73;});};exports[_0x6263('0x65')]=function(_0x2eb29f,_0x554a2b,_0x320549,_0x33e043){var _0x5a45e5=util[_0x6263('0x66')](_0x6263('0x67'),ISPEECH_API,_0x2eb29f,encodeURIComponent(_0x554a2b),_0x320549,_0x33e043);var _0x1f684b=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs['generate'](0x4)+_0x6263('0x3a'));var _0x15e9a2;return downloadFile(_0x5a45e5,_0x1f684b)['then'](function(){_0x15e9a2=path[_0x6263('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x6263('0x29'));return convertFile(_0x1f684b,_0x15e9a2);})[_0x6263('0x2b')](function(){try{fs['unlink'](_0x1f684b);fs[_0x6263('0x3c')](_0x15e9a2,_0x6263('0x2c'));}catch(_0x4a6965){logger[_0x6263('0x1a')](_0x4a6965);}return _0x15e9a2[_0x6263('0x2d')]('.')[0x0];});};exports[_0x6263('0x68')]=function(_0x171c6e,_0x3ca62c,_0x2bccdd,_0x26fbbe){var _0x2b66b1=util[_0x6263('0x66')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3ca62c,_0x2bccdd,base64Encode(_0x171c6e),_0x26fbbe?util[_0x6263('0x66')]('model=%s',encodeURIComponent(_0x26fbbe)):_0x6263('0x69'));return uploadFile(_0x2b66b1)[_0x6263('0x2b')](function(_0x4f2bca){return querystring[_0x6263('0x6a')](_0x4f2bca);});};exports[_0x6263('0x6b')]=function(_0x1d84ae,_0x334409){return sestek[_0x6263('0x6c')](_0x1d84ae,_0x334409)[_0x6263('0x2b')](function(_0x5baf18){logger[_0x6263('0x24')](JSON[_0x6263('0x51')](_0x5baf18));var _0x52258b={'speech':_0x5baf18[_0x6263('0x6d')],'action':_0x5baf18['channelData']?_0x5baf18[_0x6263('0x6e')][_0x6263('0x6f')]:undefined,'actiondata':_0x5baf18[_0x6263('0x6e')]?_0x5baf18[_0x6263('0x6e')][_0x6263('0x70')]:undefined};if(_0x5baf18[_0x6263('0x6e')]&&_0x5baf18[_0x6263('0x6e')][_0x6263('0x71')]){return base64Decode(_0x5baf18[_0x6263('0x6e')]['AudioFromTts'][_0x6263('0x72')],path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+_0x6263('0x29')))['then'](function(_0x3d19fe){_0x52258b[_0x6263('0x73')]=_0x3d19fe;return _0x52258b;});}return _0x52258b;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xf232=['text:synthesize','POST','generate','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','stringify','result','source','fulfillment','speech','status','metadata','endConversation','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','http','https','parse','bluebird','randomstring','sox','request-promise','google-tts-api','apiai-promise','md5','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','info','finish\x20download\x20file','close','unlink','end','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','audioConfig','MP3'];(function(_0x1f5a29,_0x3f8434){var _0x52e837=function(_0x712c90){while(--_0x712c90){_0x1f5a29['push'](_0x1f5a29['shift']());}};_0x52e837(++_0x3f8434);}(_0xf232,0x1d5));var _0x2f23=function(_0x20c449,_0x3cd6a1){_0x20c449=_0x20c449-0x0;var _0x272a63=_0xf232[_0x20c449];return _0x272a63;};'use strict';var fs=require('fs');var path=require(_0x2f23('0x0'));var http=require(_0x2f23('0x1'));var https=require(_0x2f23('0x2'));var urlParse=require('url')[_0x2f23('0x3')];var BPromise=require(_0x2f23('0x4'));var rs=require(_0x2f23('0x5'));var sox=require(_0x2f23('0x6'));var rp=require(_0x2f23('0x7'));var util=require('util');var querystring=require('querystring');var tts=require(_0x2f23('0x8'));var apiai=require(_0x2f23('0x9'));var md5=require(_0x2f23('0xa'));var google=require('./google');var aws=require(_0x2f23('0xb'));var tilde=require(_0x2f23('0xc'));var sestek=require(_0x2f23('0xd'));var logger=require(_0x2f23('0xe'))(_0x2f23('0xf'));var ISPEECH_API=_0x2f23('0x10');function downloadFile(_0x3280df,_0x475c4d){return new BPromise(function(_0x1f6ca9,_0x11c5de){var _0xdd8618=urlParse(_0x3280df);var _0xa0c84c=_0xdd8618[_0x2f23('0x11')]===_0x2f23('0x12')?https:http;var _0x42c7a3={'host':_0xdd8618[_0x2f23('0x13')],'path':_0xdd8618[_0x2f23('0x0')],'headers':{'user-agent':_0x2f23('0x14')}};_0xa0c84c[_0x2f23('0x15')](_0x42c7a3,function(_0x291236){if(_0x291236[_0x2f23('0x16')]!==0xc8){logger[_0x2f23('0x17')]('request\x20to\x20'+_0x3280df+_0x2f23('0x18')+_0x291236[_0x2f23('0x16')]+'\x20('+_0x291236[_0x2f23('0x19')]+')');_0x11c5de(new Error(_0x2f23('0x1a')+_0x3280df+_0x2f23('0x18')+_0x291236[_0x2f23('0x16')]+'\x20('+_0x291236[_0x2f23('0x19')]+')'));return;}var _0x17b13c=fs['createWriteStream'](_0x475c4d);_0x17b13c['on']('finish',function(){logger[_0x2f23('0x1b')](_0x2f23('0x1c'));_0x17b13c[_0x2f23('0x1d')](_0x1f6ca9);});_0x17b13c['on'](_0x2f23('0x17'),function(_0x437992){fs[_0x2f23('0x1e')](_0x475c4d);logger[_0x2f23('0x17')]('download\x20error',_0x437992);_0x11c5de(_0x437992);});_0x291236['pipe'](_0x17b13c);})['on'](_0x2f23('0x17'),function(_0x2efa93){logger[_0x2f23('0x17')](_0x2efa93);_0x11c5de(_0x2efa93);})[_0x2f23('0x1f')]();});}function uploadFile(_0x4cc013){return new BPromise(function(_0x273437,_0x3eeaab){var _0x1742e3=urlParse(_0x4cc013);var _0x7aade9=_0x1742e3['protocol']===_0x2f23('0x12')?https:http;var _0x27fbe7={'host':_0x1742e3['host'],'path':_0x1742e3['path'],'headers':{'user-agent':_0x2f23('0x14')}};_0x7aade9['get'](_0x27fbe7,function(_0x11e3cc){if(_0x11e3cc['statusCode']!==0xc8){_0x3eeaab(new Error(_0x2f23('0x1a')+_0x4cc013+_0x2f23('0x18')+_0x11e3cc[_0x2f23('0x16')]+'\x20('+_0x11e3cc[_0x2f23('0x19')]+')'));return;}var _0x5970ad='';_0x11e3cc['on'](_0x2f23('0x20'),function(_0xedcfb2){_0x5970ad+=_0xedcfb2;});_0x11e3cc['on'](_0x2f23('0x1f'),function(){_0x273437(_0x5970ad);});})['on'](_0x2f23('0x17'),function(_0x1d450f){_0x3eeaab(_0x1d450f);})[_0x2f23('0x1f')]();});}function convertFile(_0x106e69,_0x5232e9){return new BPromise(function(_0x1d5de0,_0x3a38da){var _0x4d658b=sox['transcode'](_0x106e69,_0x5232e9,{'sampleRate':0x1f40,'format':_0x2f23('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d658b['on'](_0x2f23('0x17'),function(_0x58374d){logger[_0x2f23('0x17')](_0x2f23('0x22'),_0x58374d);_0x3a38da(_0x58374d);});_0x4d658b['on']('end',function(){logger['info'](_0x2f23('0x23'));_0x1d5de0();});_0x4d658b[_0x2f23('0x24')]();});}function base64Decode(_0xf11a40,_0x55955a){var _0x515350=path[_0x2f23('0x25')](__dirname,_0x2f23('0x26'),rs['generate'](0x4)+_0x2f23('0x27'));fs['writeFileSync'](_0x515350,_0xf11a40,_0x2f23('0x28'));return convertFile(_0x515350,_0x55955a)[_0x2f23('0x29')](function(){try{fs[_0x2f23('0x1e')](_0x515350);fs[_0x2f23('0x2a')](_0x55955a,_0x2f23('0x2b'));}catch(_0x57b6d6){logger['error'](_0x57b6d6);}return _0x55955a[_0x2f23('0x2c')]('.')[0x0];});}function base64Encode(_0xf06ed6){var _0x3f1220=fs[_0x2f23('0x2d')](_0xf06ed6);return new Buffer(_0x3f1220)['toString'](_0x2f23('0x28'));}exports[_0x2f23('0x2e')]=function(_0x12378b,_0x363006,_0x381b32,_0x199bf8,_0x3e5f08,_0x2dc8ad){var _0x421855,_0x5e9c6d;var _0x518a6a=_0x2f23('0x2f');var _0x5cacbe='?key='+_0x12378b;var _0x34e730={};if(_0x363006==='ssml'){_0x34e730[_0x2f23('0x30')]={'ssml':_0x381b32};}else{_0x34e730['input']={'text':_0x381b32};};_0x34e730['voice']={'languageCode':_0x199bf8,'ssmlGender':_0x3e5f08};_0x34e730[_0x2f23('0x31')]={'audioEncoding':_0x2f23('0x32'),'sampleRateHertz':0x1f40};var _0x57b292={'url':_0x518a6a+_0x2f23('0x33')+_0x5cacbe,'method':_0x2f23('0x34'),'json':!![],'body':_0x34e730};return rp(_0x57b292)[_0x2f23('0x29')](function(_0x2ab550){return new BPromise(function(_0x1d9364,_0x9ac68){_0x421855=path[_0x2f23('0x25')](__dirname,'tmp',rs[_0x2f23('0x35')](0x4)+_0x2f23('0x36'));var _0x13e5bb=Buffer['from'](_0x2ab550[_0x2f23('0x37')],_0x2f23('0x28'));return fs[_0x2f23('0x38')](_0x421855,_0x13e5bb,function(_0x137adc){_0x9ac68(_0x137adc);},function(_0x42da25){fs[_0x2f23('0x2a')](_0x421855,_0x2f23('0x2b'));_0x1d9364(_0x42da25);});});})['then'](function(_0x1b1bc2){_0x5e9c6d=path['resolve'](__dirname,_0x2f23('0x26'),rs['generate'](0x4)+_0x2f23('0x27'));return convertFile(_0x421855,_0x5e9c6d);})[_0x2f23('0x29')](function(){try{fs[_0x2f23('0x1e')](_0x421855);fs[_0x2f23('0x2a')](_0x5e9c6d,'777');}catch(_0x2f455b){logger[_0x2f23('0x17')](_0x2f455b);}logger[_0x2f23('0x1b')](_0x2f23('0x39'),_0x5e9c6d['split']('.')[0x0]);return _0x5e9c6d[_0x2f23('0x2c')]('.')[0x0];});};exports[_0x2f23('0x3a')]=function(_0x583ac6,_0x5f09d0){var _0x12f7fb,_0x314847;return tts(_0x583ac6,_0x5f09d0||'en',0x1)[_0x2f23('0x29')](function(_0x88edab){logger[_0x2f23('0x1b')](_0x88edab);_0x12f7fb=path[_0x2f23('0x25')](__dirname,'tmp',rs[_0x2f23('0x35')](0x4)+_0x2f23('0x36'));return downloadFile(_0x88edab,_0x12f7fb);})[_0x2f23('0x29')](function(){_0x314847=path[_0x2f23('0x25')](__dirname,'tmp',rs[_0x2f23('0x35')](0x4)+_0x2f23('0x27'));return convertFile(_0x12f7fb,_0x314847);})[_0x2f23('0x29')](function(){try{fs[_0x2f23('0x1e')](_0x12f7fb);fs[_0x2f23('0x2a')](_0x314847,'777');}catch(_0x398df2){logger[_0x2f23('0x17')](_0x398df2);}logger[_0x2f23('0x1b')](_0x2f23('0x3b'),_0x314847[_0x2f23('0x2c')]('.')[0x0]);return _0x314847[_0x2f23('0x2c')]('.')[0x0];});};exports[_0x2f23('0x3c')]=function(_0xe38e7c,_0x36f736,_0x8240c6){return google[_0x2f23('0x3d')](_0xe38e7c,_0x36f736,_0x8240c6)[_0x2f23('0x29')](function(_0x2d57e9){logger['info'](_0x2d57e9[_0x2f23('0x3e')]);return rp(_0x2d57e9);})['then'](function(_0x5cd740){var _0x25d9a6='';var _0x2f86e9=0x0;try{fs[_0x2f23('0x1e')](_0xe38e7c);}catch(_0x8eb220){logger[_0x2f23('0x17')](_0x8eb220);}if(_0x5cd740&&_0x5cd740[_0x2f23('0x3f')]){_0x25d9a6=_0x5cd740[_0x2f23('0x3f')][_0x2f23('0x40')](function(_0x563fd3){return _0x563fd3&&_0x563fd3[_0x2f23('0x41')][0x0]&&_0x563fd3[_0x2f23('0x41')][0x0][_0x2f23('0x42')]?_0x563fd3[_0x2f23('0x41')][0x0]['transcript']:'';})[_0x2f23('0x43')]('\x0a');_0x2f86e9=_0x5cd740[_0x2f23('0x3f')][_0x2f23('0x40')](function(_0x424e73){return _0x424e73&&_0x424e73['alternatives'][0x0]&&_0x424e73[_0x2f23('0x41')][0x0][_0x2f23('0x44')]?_0x424e73[_0x2f23('0x41')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x2f23('0x1b')]('googleASR\x20transcription',_0x25d9a6);logger[_0x2f23('0x1b')](_0x2f23('0x45'),_0x2f86e9);return{'transcript':_0x25d9a6,'confidence':_0x2f86e9};})[_0x2f23('0x46')](function(_0x1c42bd){logger[_0x2f23('0x17')](_0x2f23('0x47'),_0x1c42bd[_0x2f23('0x16')],_0x1c42bd[_0x2f23('0x48')],_0x1c42bd[_0x2f23('0x49')]);});};exports['googleDialogflow']=function(_0x308f3c,_0x20c3cb,_0x211e90,_0x4b4e10){var _0x287b7b=apiai(_0x20c3cb,{'language':_0x4b4e10||'en'});return _0x287b7b[_0x2f23('0x4a')](_0x211e90,{'sessionId':md5(_0x308f3c)})['then'](function(_0x30079e){logger[_0x2f23('0x1b')](JSON[_0x2f23('0x4b')](_0x30079e));return{'source':_0x30079e[_0x2f23('0x4c')][_0x2f23('0x4d')],'resolvedQuery':_0x30079e[_0x2f23('0x4c')]['resolvedQuery'],'action':_0x30079e[_0x2f23('0x4c')]['action'],'actionIncomplete':_0x30079e[_0x2f23('0x4c')]['actionIncomplete'],'speech':_0x30079e[_0x2f23('0x4c')][_0x2f23('0x4e')][_0x2f23('0x4f')],'score':_0x30079e[_0x2f23('0x4c')]['score'],'statusCode':_0x30079e[_0x2f23('0x50')]['code'],'endConversation':_0x30079e[_0x2f23('0x4c')][_0x2f23('0x51')][_0x2f23('0x52')]||![],'isFallbackIntent':_0x30079e['result'][_0x2f23('0x51')]['isFallbackIntent']};});};exports[_0x2f23('0x53')]=function(_0x34b495,_0x55be5c,_0x24d721,_0x132c10){return tilde[_0x2f23('0x3d')](_0x34b495,_0x55be5c,_0x24d721,_0x132c10)[_0x2f23('0x29')](function(_0x31edcc){try{fs[_0x2f23('0x1e')](_0x34b495);}catch(_0x6b6c17){logger[_0x2f23('0x17')](_0x6b6c17);}logger[_0x2f23('0x1b')](_0x2f23('0x54'),_0x31edcc[_0x2f23('0x42')]);logger[_0x2f23('0x1b')](_0x2f23('0x55'),_0x31edcc['confidence']);return _0x31edcc;});};exports[_0x2f23('0x56')]=function(_0x2bfb5f,_0x51f630,_0x3cc066,_0xfd709c,_0x41d97c,_0x56fe1e){var _0x3d5c17=path[_0x2f23('0x25')](__dirname,'tmp',rs[_0x2f23('0x35')](0x4)+_0x2f23('0x36'));var _0x472069;return aws[_0x2f23('0x57')](_0x2bfb5f,_0x51f630,_0x3cc066,_0xfd709c,_0x41d97c,_0x56fe1e,_0x3d5c17)['then'](function(){_0x472069=path['resolve'](__dirname,_0x2f23('0x26'),rs['generate'](0x4)+_0x2f23('0x27'));return convertFile(_0x3d5c17,_0x472069);})['then'](function(){try{fs[_0x2f23('0x1e')](_0x3d5c17);fs[_0x2f23('0x2a')](_0x472069,'777');}catch(_0x152d96){logger[_0x2f23('0x17')](_0x152d96);}return _0x472069[_0x2f23('0x2c')]('.')[0x0];});};exports[_0x2f23('0x58')]=function(_0x4091b9,_0x43eed,_0x3d243f,_0x25c64b,_0x5de037,_0x370717){return aws['lex'](_0x4091b9,_0x43eed,_0x3d243f,_0x25c64b,_0x5de037,_0x370717)['then'](function(_0x29c0e6){logger[_0x2f23('0x1b')](JSON['stringify'](_0x29c0e6));return _0x29c0e6;});};exports[_0x2f23('0x59')]=function(_0x37568f,_0x40c2b7,_0x142bb0,_0x48c65f){var _0x383dab=util[_0x2f23('0x5a')](_0x2f23('0x5b'),ISPEECH_API,_0x37568f,encodeURIComponent(_0x40c2b7),_0x142bb0,_0x48c65f);var _0x4cf03f=path[_0x2f23('0x25')](__dirname,_0x2f23('0x26'),rs[_0x2f23('0x35')](0x4)+_0x2f23('0x36'));var _0x2cd863;return downloadFile(_0x383dab,_0x4cf03f)[_0x2f23('0x29')](function(){_0x2cd863=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x2f23('0x27'));return convertFile(_0x4cf03f,_0x2cd863);})[_0x2f23('0x29')](function(){try{fs[_0x2f23('0x1e')](_0x4cf03f);fs[_0x2f23('0x2a')](_0x2cd863,_0x2f23('0x2b'));}catch(_0x3bd1bf){logger[_0x2f23('0x17')](_0x3bd1bf);}return _0x2cd863[_0x2f23('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x544b7b,_0x2a2a14,_0x52e3b3,_0x2a1f83){var _0x571f42=util[_0x2f23('0x5a')](_0x2f23('0x5c'),ISPEECH_API,_0x2a2a14,_0x52e3b3,base64Encode(_0x544b7b),_0x2a1f83?util['format'](_0x2f23('0x5d'),encodeURIComponent(_0x2a1f83)):'freeform=3');return uploadFile(_0x571f42)[_0x2f23('0x29')](function(_0x2801bf){return querystring[_0x2f23('0x3')](_0x2801bf);});};exports[_0x2f23('0x5e')]=function(_0x4ae969,_0x1c0638){return sestek[_0x2f23('0x5f')](_0x4ae969,_0x1c0638)[_0x2f23('0x29')](function(_0x5b5007){logger['info'](JSON['stringify'](_0x5b5007));var _0x35f7a6={'speech':_0x5b5007[_0x2f23('0x60')],'action':_0x5b5007['channelData']?_0x5b5007[_0x2f23('0x61')][_0x2f23('0x62')]:undefined,'actiondata':_0x5b5007['channelData']?_0x5b5007[_0x2f23('0x61')][_0x2f23('0x63')]:undefined};if(_0x5b5007[_0x2f23('0x61')]&&_0x5b5007['channelData'][_0x2f23('0x64')]){return base64Decode(_0x5b5007[_0x2f23('0x61')][_0x2f23('0x64')][_0x2f23('0x65')],path[_0x2f23('0x25')](__dirname,'tmp',rs[_0x2f23('0x35')](0x4)+'.wav'))[_0x2f23('0x29')](function(_0x145816){_0x35f7a6[_0x2f23('0x66')]=_0x145816;return _0x35f7a6;});}return _0x35f7a6;});};exports[_0x2f23('0x67')]=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 c953254..fe63f50 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 _0xff3c=['./nda'];(function(_0x37a2a5,_0xac0ca2){var _0x54f3b1=function(_0x5a0c7a){while(--_0x5a0c7a){_0x37a2a5['push'](_0x37a2a5['shift']());}};_0x54f3b1(++_0xac0ca2);}(_0xff3c,0x178));var _0xcff3=function(_0x19f048,_0x4fe3fa){_0x19f048=_0x19f048-0x0;var _0xda5df8=_0xff3c[_0x19f048];return _0xda5df8;};var nda=require(_0xcff3('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x293b=['./nda'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x293b,0x141));var _0xb293=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x293b[_0x3dd15e];return _0x231fd0;};var nda=require(_0xb293('0x0'));module['exports']={'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 7d1ce19..f2b99a5 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 _0x7a22=['ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','access_token','channelData','ProjectName','project'];(function(_0x3a0d64,_0xa99d32){var _0xd2b8dc=function(_0x4aeb2d){while(--_0x4aeb2d){_0x3a0d64['push'](_0x3a0d64['shift']());}};_0xd2b8dc(++_0xa99d32);}(_0x7a22,0x153));var _0x27a2=function(_0x73fdfe,_0x160a9c){_0x73fdfe=_0x73fdfe-0x0;var _0x2854b7=_0x7a22[_0x73fdfe];return _0x2854b7;};'use strict';var rp=require(_0x27a2('0x0'));var url=require(_0x27a2('0x1'));var logger=require(_0x27a2('0x2'))(_0x27a2('0x3'));module[_0x27a2('0x4')]=function(_0x83f28f,_0x12dda9){var _0x1fc73c={'method':_0x27a2('0x5'),'uri':url[_0x27a2('0x6')](_0x12dda9[_0x27a2('0x7')],'/token'),'form':{'grant_type':_0x27a2('0x8'),'username':_0x12dda9['username'],'password':_0x12dda9['password']},'json':!![]};return rp(_0x1fc73c)[_0x27a2('0x9')](function(_0x451701){var _0x4c7021={'method':_0x27a2('0x5'),'uri':url[_0x27a2('0x6')](_0x12dda9[_0x27a2('0xa')],_0x27a2('0xb')),'body':{'type':_0x12dda9['ndaactivity_type']||_0x27a2('0xc'),'channelId':_0x27a2('0xd'),'conversation':{'id':_0x83f28f[_0x27a2('0xe')]},'from':{'id':_0x83f28f[_0x27a2('0xf')],'name':_0x83f28f[_0x27a2('0x10')]},'recipient':{'id':_0x83f28f[_0x27a2('0x11')],'name':_0x83f28f[_0x27a2('0x12')]},'text':_0x12dda9[_0x27a2('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x451701[_0x27a2('0x14')]},'json':!![]};if(_0x12dda9['project']){_0x4c7021['body'][_0x27a2('0x15')][_0x27a2('0x16')]=_0x12dda9[_0x27a2('0x17')];}if(_0x12dda9[_0x27a2('0x18')]=='1'){_0x4c7021[_0x27a2('0x19')][_0x27a2('0x15')][_0x27a2('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x27a2('0x1b')};}if(_0x12dda9[_0x27a2('0x1c')]){_0x4c7021[_0x27a2('0x19')]['channelData'][_0x27a2('0x1d')]=_0x12dda9[_0x27a2('0x1c')];if(_0x12dda9[_0x27a2('0x1e')]){_0x4c7021[_0x27a2('0x19')][_0x27a2('0x15')]['CustomActionData']=_0x12dda9[_0x27a2('0x1e')];}}logger[_0x27a2('0x1f')](JSON[_0x27a2('0x20')](_0x4c7021));return rp(_0x4c7021);});}; \ No newline at end of file +var _0xdcbd=['custom_action','CustomAction','custom_action_data','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','AudioOutputSettings','audio/wav'];(function(_0x4ee698,_0x4b588f){var _0x503343=function(_0x385a5){while(--_0x385a5){_0x4ee698['push'](_0x4ee698['shift']());}};_0x503343(++_0x4b588f);}(_0xdcbd,0x104));var _0xddcb=function(_0x16491d,_0x46db64){_0x16491d=_0x16491d-0x0;var _0x4d471b=_0xdcbd[_0x16491d];return _0x4d471b;};'use strict';var rp=require('request-promise');var url=require(_0xddcb('0x0'));var logger=require(_0xddcb('0x1'))(_0xddcb('0x2'));module[_0xddcb('0x3')]=function(_0x3cc80b,_0x14225f){var _0x3009fe={'method':_0xddcb('0x4'),'uri':url[_0xddcb('0x5')](_0x14225f[_0xddcb('0x6')],_0xddcb('0x7')),'form':{'grant_type':_0xddcb('0x8'),'username':_0x14225f[_0xddcb('0x9')],'password':_0x14225f['password']},'json':!![]};return rp(_0x3009fe)['then'](function(_0x3f86be){var _0x146729={'method':_0xddcb('0x4'),'uri':url[_0xddcb('0x5')](_0x14225f['ndassistant_url'],_0xddcb('0xa')),'body':{'type':_0x14225f[_0xddcb('0xb')]||_0xddcb('0xc'),'channelId':_0xddcb('0xd'),'conversation':{'id':_0x3cc80b[_0xddcb('0xe')]},'from':{'id':_0x3cc80b[_0xddcb('0xf')],'name':_0x3cc80b[_0xddcb('0x10')]},'recipient':{'id':_0x3cc80b[_0xddcb('0x11')],'name':_0x3cc80b[_0xddcb('0x12')]},'text':_0x14225f[_0xddcb('0x13')],'channelData':{}},'headers':{'Authorization':_0xddcb('0x14')+_0x3f86be[_0xddcb('0x15')]},'json':!![]};if(_0x14225f['project']){_0x146729[_0xddcb('0x16')][_0xddcb('0x17')][_0xddcb('0x18')]=_0x14225f[_0xddcb('0x19')];}if(_0x14225f['ndagenerate_audio']=='1'){_0x146729[_0xddcb('0x16')][_0xddcb('0x17')][_0xddcb('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xddcb('0x1b')};}if(_0x14225f[_0xddcb('0x1c')]){_0x146729['body'][_0xddcb('0x17')][_0xddcb('0x1d')]=_0x14225f[_0xddcb('0x1c')];if(_0x14225f[_0xddcb('0x1e')]){_0x146729[_0xddcb('0x16')][_0xddcb('0x17')]['CustomActionData']=_0x14225f[_0xddcb('0x1e')];}}logger['info'](JSON[_0xddcb('0x1f')](_0x146729));return rp(_0x146729);});}; \ 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 ae3e08f..ee6bc91 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 _0x7fcd=['exports','./lib/api'];(function(_0x29b1b8,_0x1ee51a){var _0xcd1de2=function(_0x2ef57d){while(--_0x2ef57d){_0x29b1b8['push'](_0x29b1b8['shift']());}};_0xcd1de2(++_0x1ee51a);}(_0x7fcd,0x195));var _0xd7fc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7fcd[_0x2641f9];return _0x585741;};'use strict';var asr=require(_0xd7fc('0x0'));module[_0xd7fc('0x1')]=function(_0x5ea659,_0xf75eb4,_0x873935,_0x504a65){return asr(_0x5ea659,_0xf75eb4,_0x873935,_0x504a65);}; \ No newline at end of file +var _0x4350=['./lib/api','exports'];(function(_0x520a2d,_0x2e77b7){var _0x179c82=function(_0x14d3c6){while(--_0x14d3c6){_0x520a2d['push'](_0x520a2d['shift']());}};_0x179c82(++_0x2e77b7);}(_0x4350,0x1d0));var _0x0435=function(_0x1a1f22,_0x5e3378){_0x1a1f22=_0x1a1f22-0x0;var _0x299d41=_0x4350[_0x1a1f22];return _0x299d41;};'use strict';var asr=require(_0x0435('0x0'));module[_0x0435('0x1')]=function(_0x4970c7,_0x165bec,_0x57ff95,_0x1527f9){return asr(_0x4970c7,_0x165bec,_0x57ff95,_0x1527f9);}; \ 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 60cd41c..3b3b6d9 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 _0x7276=['info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7276,0x16a));var _0x6727=function(_0x23a50c,_0x58fd75){_0x23a50c=_0x23a50c-0x0;var _0x157481=_0x7276[_0x23a50c];return _0x157481;};'use strict';var BPromise=require(_0x6727('0x0'));var _=require(_0x6727('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6727('0x2'));var crypto=require(_0x6727('0x3'));var logger=require(_0x6727('0x4'))(_0x6727('0x5'));module[_0x6727('0x6')]=function(_0x37a3ab,_0x48948f,_0x3f509a,_0x49f0c8){return new BPromise(function(_0x1fc5cf,_0x3a7b4f){logger[_0x6727('0x7')](_0x6727('0x8'),_0x49f0c8||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3a8e29=new WebSocket(_0x49f0c8||_0x6727('0x9'),{'perMessageDeflate':![]});var _0x261a3b='';var _0x18e976='0';var _0x741c27='1';var _0x4bb0ba=_0x6727('0xa');function _0xa37ba(_0x1f7b8e){var _0x4d5404=crypto[_0x6727('0xb')](_0x6727('0xc'));_0x4d5404[_0x6727('0xd')](_0x1f7b8e);return _0x4d5404[_0x6727('0xe')](_0x6727('0xf'));}function _0x702585(){try{logger[_0x6727('0x7')]('Open\x20Tilde\x20ASR\x20socket');var _0x4eaaee=moment()[_0x6727('0x10')]();var _0x29f57f=_0xa37ba(_0x4eaaee+_0x48948f+_0x3f509a);_0x3a8e29[_0x6727('0x11')](JSON[_0x6727('0x12')]({'appID':_0x48948f,'timestamp':_0x4eaaee,'appKey':_0x29f57f}));var _0x1feef6=fs[_0x6727('0x13')](_0x37a3ab);_0x1feef6['on']('data',function(_0x344cdd){_0x3a8e29[_0x6727('0x11')](_0x344cdd);});_0x1feef6['on'](_0x6727('0x14'),function(){_0x3a8e29[_0x6727('0x11')](_0x6727('0x15'));});}catch(_0x5f00e4){logger[_0x6727('0x16')](_0x6727('0x17'),JSON[_0x6727('0x12')](_0x5f00e4));_0x3a8e29[_0x6727('0x18')]();}}function _0x1f639b(_0x5c403b){try{if(_0x5c403b){var _0x12563f=JSON['parse'](_0x5c403b);switch(_0x12563f[_0x6727('0x19')]){case 0x0:if(_0x12563f[_0x6727('0x1a')]){if(_0x12563f[_0x6727('0x1a')][_0x6727('0x1b')]){logger[_0x6727('0x7')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x12563f[_0x6727('0x1a')][_0x6727('0x1c')]));_0x261a3b=_0x12563f['result'][_0x6727('0x1c')][0x0][_0x6727('0x1d')];_0x18e976=_0x12563f['result'][_0x6727('0x1c')][0x0][_0x6727('0x1e')];_0x741c27='0';_0x4bb0ba=_0x6727('0x1f');_0x3a8e29[_0x6727('0x18')]();}}break;case 0x1:logger['info'](_0x6727('0xa'));_0x741c27='1';_0x4bb0ba=_0x6727('0xa');break;case 0x2:logger['info'](_0x6727('0x20'));_0x741c27='2';_0x4bb0ba=_0x6727('0x20');break;case 0x9:logger[_0x6727('0x7')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x741c27='9';_0x4bb0ba=_0x6727('0x21');break;case 0xa:logger['info'](_0x6727('0x22'));_0x741c27='10';_0x4bb0ba=_0x6727('0x22');break;case 0xb:logger[_0x6727('0x7')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x741c27='11';_0x4bb0ba=_0x6727('0x23');}}}catch(_0x51a8c1){logger[_0x6727('0x16')](_0x6727('0x24'),JSON['stringify'](_0x51a8c1));_0x3a8e29[_0x6727('0x18')]();}}function _0x35c6ea(){logger[_0x6727('0x7')]('Close\x20Tilde\x20ASR\x20socket');_0x1fc5cf({'transcript':_0x261a3b,'confidence':_0x18e976,'status':_0x741c27,'status_message':_0x4bb0ba});}function _0x45bfc7(_0x503c04){logger['error'](_0x6727('0x25'));if(!_[_0x6727('0x26')](_0x503c04)){logger[_0x6727('0x16')](_['isObject'](_0x503c04)?JSON['stringify'](_0x503c04):_0x503c04);}}_0x3a8e29['on'](_0x6727('0x27'),_0x702585);_0x3a8e29['on'](_0x6727('0x28'),_0x1f639b);_0x3a8e29['on'](_0x6727('0x14'),_0x35c6ea);_0x3a8e29['on'](_0x6727('0x16'),_0x45bfc7);});}; \ No newline at end of file +var _0x6d96=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','lodash','moment','crypto','../../../../../../config/logger','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','send','stringify','createReadStream','data','close','EOS','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.'];(function(_0x39daac,_0x2075fd){var _0x522cb2=function(_0x1fbf04){while(--_0x1fbf04){_0x39daac['push'](_0x39daac['shift']());}};_0x522cb2(++_0x2075fd);}(_0x6d96,0x1ce));var _0x66d9=function(_0x3a88a2,_0x4d1357){_0x3a88a2=_0x3a88a2-0x0;var _0x10fb3b=_0x6d96[_0x3a88a2];return _0x10fb3b;};'use strict';var BPromise=require('bluebird');var _=require(_0x66d9('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x66d9('0x1'));var crypto=require(_0x66d9('0x2'));var logger=require(_0x66d9('0x3'))('agi');module['exports']=function(_0x4f2104,_0x447616,_0x25a6fd,_0x201a01){return new BPromise(function(_0x404711,_0x210e2f){logger[_0x66d9('0x4')](_0x66d9('0x5'),_0x201a01||_0x66d9('0x6'));var _0x1da611=new WebSocket(_0x201a01||_0x66d9('0x6'),{'perMessageDeflate':![]});var _0x496602='';var _0x2a5d48='0';var _0x7505f0='1';var _0x52ad22=_0x66d9('0x7');function _0x3499cb(_0x3b50b2){var _0xd6eaa8=crypto[_0x66d9('0x8')](_0x66d9('0x9'));_0xd6eaa8[_0x66d9('0xa')](_0x3b50b2);return _0xd6eaa8[_0x66d9('0xb')](_0x66d9('0xc'));}function _0x2e04b2(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0xccc81c=moment()[_0x66d9('0xd')]();var _0x17102a=_0x3499cb(_0xccc81c+_0x447616+_0x25a6fd);_0x1da611[_0x66d9('0xe')](JSON[_0x66d9('0xf')]({'appID':_0x447616,'timestamp':_0xccc81c,'appKey':_0x17102a}));var _0x476952=fs[_0x66d9('0x10')](_0x4f2104);_0x476952['on'](_0x66d9('0x11'),function(_0x524463){_0x1da611[_0x66d9('0xe')](_0x524463);});_0x476952['on'](_0x66d9('0x12'),function(){_0x1da611['send'](_0x66d9('0x13'));});}catch(_0x1ad66f){logger['error'](_0x66d9('0x14'),JSON['stringify'](_0x1ad66f));_0x1da611['terminate']();}}function _0x2fbd68(_0x1bf556){try{if(_0x1bf556){var _0x2e9c93=JSON['parse'](_0x1bf556);switch(_0x2e9c93[_0x66d9('0x15')]){case 0x0:if(_0x2e9c93[_0x66d9('0x16')]){if(_0x2e9c93[_0x66d9('0x16')][_0x66d9('0x17')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x2e9c93[_0x66d9('0x16')][_0x66d9('0x18')]));_0x496602=_0x2e9c93[_0x66d9('0x16')][_0x66d9('0x18')][0x0][_0x66d9('0x19')];_0x2a5d48=_0x2e9c93[_0x66d9('0x16')][_0x66d9('0x18')][0x0][_0x66d9('0x1a')];_0x7505f0='0';_0x52ad22=_0x66d9('0x1b');_0x1da611[_0x66d9('0x1c')]();}}break;case 0x1:logger[_0x66d9('0x4')](_0x66d9('0x7'));_0x7505f0='1';_0x52ad22='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x66d9('0x4')](_0x66d9('0x1d'));_0x7505f0='2';_0x52ad22=_0x66d9('0x1d');break;case 0x9:logger['info'](_0x66d9('0x1e'));_0x7505f0='9';_0x52ad22=_0x66d9('0x1e');break;case 0xa:logger[_0x66d9('0x4')](_0x66d9('0x1f'));_0x7505f0='10';_0x52ad22=_0x66d9('0x1f');break;case 0xb:logger[_0x66d9('0x4')](_0x66d9('0x20'));_0x7505f0='11';_0x52ad22=_0x66d9('0x20');}}}catch(_0x2c4084){logger[_0x66d9('0x21')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x66d9('0xf')](_0x2c4084));_0x1da611[_0x66d9('0x1c')]();}}function _0x13823d(){logger[_0x66d9('0x4')](_0x66d9('0x22'));_0x404711({'transcript':_0x496602,'confidence':_0x2a5d48,'status':_0x7505f0,'status_message':_0x52ad22});}function _0x3013d6(_0x4b2cb7){logger['error'](_0x66d9('0x23'));if(!_['isNil'](_0x4b2cb7)){logger[_0x66d9('0x21')](_[_0x66d9('0x24')](_0x4b2cb7)?JSON[_0x66d9('0xf')](_0x4b2cb7):_0x4b2cb7);}}_0x1da611['on'](_0x66d9('0x25'),_0x2e04b2);_0x1da611['on']('message',_0x2fbd68);_0x1da611['on']('close',_0x13823d);_0x1da611['on'](_0x66d9('0x21'),_0x3013d6);});}; \ 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 61d8673..4180898 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 _0xe296=['exports','./asr'];(function(_0x49ed35,_0x12ec79){var _0xe5e136=function(_0x4592d8){while(--_0x4592d8){_0x49ed35['push'](_0x49ed35['shift']());}};_0xe5e136(++_0x12ec79);}(_0xe296,0x1d1));var _0x6e29=function(_0x3a49b1,_0x29d467){_0x3a49b1=_0x3a49b1-0x0;var _0x438755=_0xe296[_0x3a49b1];return _0x438755;};var asr=require(_0x6e29('0x0'));module[_0x6e29('0x1')]={'asr':asr}; \ No newline at end of file +var _0xb999=['./asr'];(function(_0xe2307f,_0x38bb26){var _0x2f4fb1=function(_0x25bee1){while(--_0x25bee1){_0xe2307f['push'](_0xe2307f['shift']());}};_0x2f4fb1(++_0x38bb26);}(_0xb999,0xad));var _0x9b99=function(_0x15df3a,_0x45270c){_0x15df3a=_0x15df3a-0x0;var _0x4b2e7d=_0xb999[_0x15df3a];return _0x4b2e7d;};var asr=require(_0x9b99('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 2ae26e2..8abdc4a 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 _0xb634=['destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','exports','util','events','EventEmitter','./error','127.0.0.1','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED'];(function(_0x5956a3,_0x3304c3){var _0x5bafcc=function(_0x44846e){while(--_0x44846e){_0x5956a3['push'](_0x5956a3['shift']());}};_0x5bafcc(++_0x3304c3);}(_0xb634,0x1c0));var _0x4b63=function(_0x290897,_0x38c217){_0x290897=_0x290897-0x0;var _0x148b43=_0xb634[_0x290897];return _0x148b43;};'use strict';var util=require(_0x4b63('0x0'));var net=require('net');var EventEmitter=require(_0x4b63('0x1'))[_0x4b63('0x2')];var AGIError=require(_0x4b63('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x4275a4,_0x44edec,_0x46f93e){var _0x354f62=this,_0x4275a4=_0x4275a4||0x11dd,_0x44edec=_0x44edec||_0x4b63('0x4'),_0x47abe1=null,_0x57fba1=0x0;EventEmitter['call'](_0x354f62);function _0x315fa5(){if(!_0x4275a4){_0x354f62['emit'](_0x4b63('0x5'),new AGIError(_0x4b63('0x6')));return![];}_0x47abe1=net['createServer']();_0x47abe1[_0x4b63('0x7')](_0x4275a4,_0x44edec);_0x47abe1['on'](_0x4b63('0x8'),function(){_0x354f62[_0x4b63('0x9')]('listening');});_0x47abe1['on'](_0x4b63('0xa'),function(_0x31fb1d){_0x47abe1[_0x4b63('0xb')](function(_0x217de0,_0x27f75b){if(_0x217de0){_0x354f62[_0x4b63('0x9')](_0x4b63('0x5'),new AGIError(_0x4b63('0xc'),_0x217de0));}else if(_0x46f93e&&_0x46f93e<0x0){_0x354f62[_0x4b63('0x9')](_0x4b63('0x5'),new AGIError(_0x4b63('0xd')));_0x31fb1d[_0x4b63('0xe')]();}else if(_0x46f93e&&_0x46f93e>0x0&&_0x46f93e<_0x27f75b){_0x57fba1+=0x1;_0x354f62['emit'](_0x4b63('0x5'),new AGIError(_0x4b63('0xf'),_0x57fba1));_0x31fb1d[_0x4b63('0xe')]();}else{var _0x1d0374=new AGIChannel(_0x31fb1d);_0x1d0374['on'](_0x4b63('0x10'),function(){_0x354f62[_0x4b63('0x9')](_0x4b63('0xa'),_0x1d0374);});}});});_0x47abe1['on']('error',function(_0x975c4b){_0x354f62['emit'](_0x4b63('0x5'),new AGIError(_0x4b63('0xc'),_0x975c4b[_0x4b63('0x11')]));});_0x47abe1['on'](_0x4b63('0x12'),function(){_0x354f62[_0x4b63('0x9')](_0x4b63('0x12'),new AGIError(_0x4b63('0x13')));});}process['nextTick'](function(){_0x315fa5();});};util['inherits'](AGIServer,EventEmitter);module[_0x4b63('0x14')]=function(_0x54ad7b,_0x2b58a8,_0x4021cf){return new AGIServer(_0x54ad7b,_0x2b58a8,_0x4021cf);}; \ No newline at end of file +var _0x5712=['events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net'];(function(_0x5236cc,_0x477839){var _0x287559=function(_0x44cd67){while(--_0x44cd67){_0x5236cc['push'](_0x5236cc['shift']());}};_0x287559(++_0x477839);}(_0x5712,0x140));var _0x2571=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5712[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x2571('0x0'));var net=require(_0x2571('0x1'));var EventEmitter=require(_0x2571('0x2'))[_0x2571('0x3')];var AGIError=require(_0x2571('0x4'));var AGIChannel=require(_0x2571('0x5'));var AGIServer=function(_0x29c464,_0x1b044e,_0x102dd6){var _0x42459b=this,_0x29c464=_0x29c464||0x11dd,_0x1b044e=_0x1b044e||_0x2571('0x6'),_0x4713ad=null,_0x50fc72=0x0;EventEmitter[_0x2571('0x7')](_0x42459b);function _0x3ca885(){if(!_0x29c464){_0x42459b[_0x2571('0x8')](_0x2571('0x9'),new AGIError(_0x2571('0xa')));return![];}_0x4713ad=net['createServer']();_0x4713ad[_0x2571('0xb')](_0x29c464,_0x1b044e);_0x4713ad['on']('listening',function(){_0x42459b[_0x2571('0x8')](_0x2571('0xc'));});_0x4713ad['on'](_0x2571('0xd'),function(_0x42bf6e){_0x4713ad[_0x2571('0xe')](function(_0x366f74,_0x4fce3){if(_0x366f74){_0x42459b[_0x2571('0x8')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x366f74));}else if(_0x102dd6&&_0x102dd6<0x0){_0x42459b[_0x2571('0x8')](_0x2571('0x9'),new AGIError(_0x2571('0xf')));_0x42bf6e[_0x2571('0x10')]();}else if(_0x102dd6&&_0x102dd6>0x0&&_0x102dd6<_0x4fce3){_0x50fc72+=0x1;_0x42459b[_0x2571('0x8')](_0x2571('0x9'),new AGIError(_0x2571('0x11'),_0x50fc72));_0x42bf6e[_0x2571('0x10')]();}else{var _0xdf8c3a=new AGIChannel(_0x42bf6e);_0xdf8c3a['on'](_0x2571('0x12'),function(){_0x42459b[_0x2571('0x8')](_0x2571('0xd'),_0xdf8c3a);});}});});_0x4713ad['on']('error',function(_0x30b0f2){_0x42459b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x30b0f2['code']));});_0x4713ad['on'](_0x2571('0x13'),function(){_0x42459b[_0x2571('0x8')](_0x2571('0x13'),new AGIError(_0x2571('0x14')));});}process['nextTick'](function(){_0x3ca885();});};util[_0x2571('0x15')](AGIServer,EventEmitter);module[_0x2571('0x16')]=function(_0x5e4995,_0x185df2,_0x7303ad){return new AGIServer(_0x5e4995,_0x185df2,_0x7303ad);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index e5234f3..131ba16 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 _0x4156=['Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','SESTEK_NDA_%s','audiofile','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','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','streamFile','unlink','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%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\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','forEach','%s[%s]','variable\x20%s[key]\x20set','file_id','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','bcc','subject','service','host','port','secure','user','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','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','Google\x20Cloud\x20TTS\x20is\x20unreachable','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawBody','menu','getsecretdigits','rpc','getVariable','getVariableById','then','prototype','getVoiceQueue','catch','getSquareProjectById','name','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','format','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','error','getSmsAccountById','createSmsMessage','channel','uniqueid','label','agicommand','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','has','dialTimezone','isNil','VALUE\x20TZ','CALLERID(dialTimezone)','phone','RETVALRPC','TZ\x20found\x20in\x20shared:','isEmpty','callback_','random','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agent','agentUnpause','agentLogout','agentLogin','internal','shellCommand','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','text','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','replaceall\x20init','split','nextbracket','replaceAll','replaceall\x20end','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','createSquareDetailsReport','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','exec','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts'];(function(_0x1f5c6d,_0x18704b){var _0x531ee2=function(_0x4d2310){while(--_0x4d2310){_0x1f5c6d['push'](_0x1f5c6d['shift']());}};_0x531ee2(++_0x18704b);}(_0x4156,0xf1));var _0x6415=function(_0x42605f,_0x10e375){_0x42605f=_0x42605f-0x0;var _0x4391ff=_0x4156[_0x42605f];return _0x4391ff;};'use strict';var fs=require('fs');var path=require(_0x6415('0x0'));var util=require(_0x6415('0x1'));var _=require(_0x6415('0x2'));var sh=require(_0x6415('0x3'));var odbc=require(_0x6415('0x4'))();var rs=require('randomstring');var moment=require(_0x6415('0x5'));var Mustache=require(_0x6415('0x6'));var rp=require(_0x6415('0x7'));var logger=require(_0x6415('0x8'))(_0x6415('0x9'));var config=require(_0x6415('0xa'));var shared=require(_0x6415('0xb'));var scripts=require('./scripts');var FILES_PATH=_0x6415('0xc');var recursiveMapAttributes=['rawHeaders',_0x6415('0xd')];var verticesWithRetry=[_0x6415('0xe'),'getdigits',_0x6415('0xf')];var AGIVertices=function(_0x224e7b,_0x3383d2,_0x1b702a){this['channel']=_0x224e7b;this[_0x6415('0x10')]=_0x3383d2;this['mailRpc']=_0x1b702a;};AGIVertices['prototype'][_0x6415('0x11')]=function(_0x153336,_0x2ff916){this[_0x6415('0x10')][_0x6415('0x12')](_0x153336)[_0x6415('0x13')](function(_0x455f44){_0x2ff916(null,_0x455f44?_0x455f44['name']:![]);})['catch'](function(_0x8e7067){_0x2ff916(_0x8e7067);});};AGIVertices[_0x6415('0x14')][_0x6415('0x15')]=function(_0xf75bec,_0x21ae74){this['rpc']['getVoiceQueueById'](_0xf75bec)[_0x6415('0x13')](function(_0x780643){_0x21ae74(null,_0x780643?_0x780643['name']:![]);})[_0x6415('0x16')](function(_0x41f9b0){_0x21ae74(_0x41f9b0);});};AGIVertices['prototype']['getSquareProject']=function(_0x352a04,_0x4216c8){this[_0x6415('0x10')][_0x6415('0x17')](_0x352a04)[_0x6415('0x13')](function(_0xa3d00a){_0x4216c8(null,_0xa3d00a?_0xa3d00a[_0x6415('0x18')]:![]);})[_0x6415('0x16')](function(_0x20dbd8){_0x4216c8(_0x20dbd8);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x515dc7,_0x3e3685){this[_0x6415('0x10')][_0x6415('0x19')](_0x515dc7)[_0x6415('0x13')](function(_0x551632){_0x3e3685(null,_0x551632?_0x551632[_0x6415('0x1a')]:![]);})[_0x6415('0x16')](function(_0x157ec8){_0x3e3685(_0x157ec8);});};AGIVertices['prototype'][_0x6415('0x1b')]=function(_0x266f97,_0x7c567f){this[_0x6415('0x10')][_0x6415('0x1c')](_0x266f97)[_0x6415('0x13')](function(_0x339c50){_0x7c567f(null,_0x339c50?_0x339c50[_0x6415('0x18')]:![]);})[_0x6415('0x16')](function(_0x54259f){_0x7c567f(_0x54259f);});};AGIVertices[_0x6415('0x14')][_0x6415('0x1d')]=function(_0x53646e,_0x15be31){this[_0x6415('0x10')][_0x6415('0x1e')](_0x53646e)[_0x6415('0x13')](function(_0x31dabc){_0x15be31(null,_0x31dabc?_0x31dabc['name']:![]);})[_0x6415('0x16')](function(_0x561586){_0x15be31(_0x561586);});};AGIVertices[_0x6415('0x14')][_0x6415('0x1f')]=function(_0x25d459,_0x4d66d0){var _0x4dea9d=this;this['rpc'][_0x6415('0x20')](_0x25d459)[_0x6415('0x13')](function(_0x581bc7){_0x4d66d0(null,_0x581bc7?_0x4dea9d['getSoundPath'](_0x581bc7[_0x6415('0x21')]):![]);})[_0x6415('0x16')](function(_0x162889){_0x4d66d0(_0x162889);});};AGIVertices[_0x6415('0x14')][_0x6415('0x22')]=function(_0x2ba17d,_0x5b15fd){this[_0x6415('0x10')][_0x6415('0x23')](_0x2ba17d)[_0x6415('0x13')](function(_0x1a9069){_0x5b15fd(null,_0x1a9069?_0x1a9069:![]);})['catch'](function(_0x4fc558){_0x5b15fd(_0x4fc558);});};AGIVertices['prototype'][_0x6415('0x24')]=function(_0x4880ee,_0x2a4346,_0x51253e){this[_0x6415('0x25')][_0x6415('0x24')](_0x4880ee,_0x2a4346)[_0x6415('0x13')](function(){_0x51253e(null);})[_0x6415('0x16')](function(_0x5e851d){_0x51253e(_0x5e851d);});};AGIVertices['prototype'][_0x6415('0x26')]=function(_0x40d7b7,_0x87d807){this[_0x6415('0x10')][_0x6415('0x27')](_0x40d7b7)[_0x6415('0x13')](function(_0x551dda){if(_0x551dda){if(_0x551dda[_0x6415('0x28')]){_0x87d807(null,[_0x551dda['interval']]);}else{_0x87d807(null,_['map'](_0x551dda['Intervals'],'interval'));}}else{_0x87d807(null,![]);}})[_0x6415('0x16')](function(_0x1444d0){_0x87d807(_0x1444d0);});};AGIVertices[_0x6415('0x14')]['getSoundPath']=function(_0x29223d){return util[_0x6415('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0x29223d);};AGIVertices[_0x6415('0x14')][_0x6415('0x2a')]=function(_0x2e94a2,_0x122fd8,_0x248a5e){odbc['open'](_0x2e94a2,function(_0x15c32f){if(_0x15c32f){logger['error'](_0x6415('0x2b'),_0x15c32f);_0x248a5e(_0x15c32f);}else{logger[_0x6415('0x2c')]('ODBC\x20connection\x20successfully');odbc[_0x6415('0x2d')](_0x122fd8,function(_0x4b3973,_0x51b0f1){if(_0x4b3973){logger['info'](_0x6415('0x2e'),_0x122fd8);_0x248a5e(_0x4b3973);}else{logger['info'](_0x6415('0x2f'),_0x122fd8);odbc['close'](function(_0x3df19a){if(_0x3df19a){logger[_0x6415('0x30')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3df19a);}_0x248a5e(null,_0x51b0f1);});}});}});};AGIVertices[_0x6415('0x14')]['getSmsAccount']=function(_0x37b93f,_0xe4c4f0){this[_0x6415('0x10')][_0x6415('0x31')](_0x37b93f)[_0x6415('0x13')](function(_0x11ba2e){_0xe4c4f0(null,_0x11ba2e?_0x11ba2e:![]);})[_0x6415('0x16')](function(_0x9f3cc){_0xe4c4f0(_0x9f3cc);});};AGIVertices[_0x6415('0x14')][_0x6415('0x32')]=function(_0x205bdb,_0x35b203){this[_0x6415('0x10')][_0x6415('0x32')](_0x205bdb)[_0x6415('0x13')](function(_0x420c6c){_0x35b203(null,_0x420c6c);})[_0x6415('0x16')](function(_0x368e52){_0x35b203(_0x368e52);});};AGIVertices[_0x6415('0x14')]['createSquareDetailsReport']=function(_0x21b5d0,_0x4c7244,_0x2d36df){this[_0x6415('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x6415('0x33')][_0x6415('0x34')],'node':_0x21b5d0[_0x6415('0x35')],'application':_0x21b5d0[_0x6415('0x36')],'data':_0x4c7244||null,'project_name':this['channel']['arg_1'],'callerid':this[_0x6415('0x33')]['callerid']})[_0x6415('0x13')](function(_0x507436){if(_0x2d36df){_0x2d36df(null,_0x507436);}})[_0x6415('0x16')](function(_0x198f24){if(_0x2d36df){_0x2d36df(_0x198f24);}});};AGIVertices[_0x6415('0x14')][_0x6415('0x37')]=function(_0x87d56b,_0x208da9,_0xba2047,_0x5278d4){this[_0x6415('0x10')][_0x6415('0x37')]({'uniqueid':this['channel'][_0x6415('0x34')],'callerid':this['channel'][_0x6415('0x38')],'calleridname':this[_0x6415('0x33')][_0x6415('0x39')],'context':this[_0x6415('0x33')][_0x6415('0x3a')],'extension':this['channel'][_0x6415('0x3b')],'priority':this['channel'][_0x6415('0x3c')],'accountcode':this[_0x6415('0x33')][_0x6415('0x3d')],'dnid':this[_0x6415('0x33')]['dnid'],'projectName':this[_0x6415('0x33')]['arg_1'],'saveName':_0x208da9,'filename':_0x87d56b[_0x6415('0x3e')]||_0x208da9,'savePath':_0xba2047})[_0x6415('0x13')](function(_0x55a350){_0x5278d4(null,_0x55a350);})[_0x6415('0x16')](function(_0x1ff82a){_0x5278d4(_0x1ff82a);});};AGIVertices[_0x6415('0x14')]['createSquareMessage']=function(_0x3bc9db,_0x1d89c1,_0xd46b1b){this[_0x6415('0x10')][_0x6415('0x3f')]({'uniqueid':this[_0x6415('0x33')][_0x6415('0x34')],'body':_0x3bc9db,'direction':_0x1d89c1})[_0x6415('0x13')](function(_0x4aacdc){if(_0xd46b1b){_0xd46b1b(null,_0x4aacdc);}})[_0x6415('0x16')](function(_0x1e3c85){if(_0xd46b1b){_0xd46b1b(_0x1e3c85);}});};AGIVertices[_0x6415('0x14')][_0x6415('0x40')]=function(_0xdac05d,_0x48f4fa){console[_0x6415('0x41')](_0x6415('0x42'),_0xdac05d);console[_0x6415('0x41')](_0x6415('0x43'),_0x48f4fa);var _0x15f734=0x0;if(_[_0x6415('0x44')](_0xdac05d,_0x6415('0x45'))){if(!_[_0x6415('0x46')](_0xdac05d[_0x6415('0x45')])){var _0x3ad31b=_0xdac05d['dialTimezone'];console[_0x6415('0x41')](_0x6415('0x47'),_0x3ad31b);if(_0xdac05d[_0x6415('0x45')]==_0x6415('0x48')){this[_0x6415('0x10')]['getContactByPhone']({'phone':_0xdac05d[_0x6415('0x49')]})[_0x6415('0x13')](function(_0x2d141e){console['log'](_0x6415('0x4a'),_0x2d141e);_0x48f4fa(null,_0x2d141e);});}else{console[_0x6415('0x41')](_0x6415('0x4b'),shared[_0x3ad31b]);}}}this[_0x6415('0x10')][_0x6415('0x40')]({'firstName':_[_0x6415('0x4c')](_0xdac05d['name'])||_[_0x6415('0x46')](_0xdac05d['name'])?_0x6415('0x4d')+Math[_0x6415('0x4e')]():_0xdac05d['name'],'lastName':_[_0x6415('0x4c')](_0xdac05d[_0x6415('0x4f')])||_[_0x6415('0x46')](_0xdac05d[_0x6415('0x4f')])?null:_0xdac05d[_0x6415('0x4f')],'phone':_0xdac05d[_0x6415('0x49')],'ListId':_0xdac05d['list_id'],'scheduledat':_0xdac05d[_0x6415('0x50')],'callbackUniqueid':this[_0x6415('0x33')][_0x6415('0x34')],'tags':_0x6415('0x51'),'description':_0x6415('0x52')+_0xdac05d[_0x6415('0x50')][_0x6415('0x53')](),'priority':_0xdac05d[_0x6415('0x54')]})[_0x6415('0x13')](function(_0x5f4d04){_0x48f4fa(null,_0x5f4d04);})['catch'](function(_0x241594){_0x48f4fa(_0x241594);});};AGIVertices[_0x6415('0x14')]['getPause']=function(_0x2ef816,_0x18554e){this[_0x6415('0x10')][_0x6415('0x55')](_0x2ef816)[_0x6415('0x13')](function(_0x4c9005){_0x18554e(null,_0x4c9005?_0x4c9005[_0x6415('0x18')]:![]);})['catch'](function(_0x3b97bc){_0x18554e(_0x3b97bc);});};AGIVertices[_0x6415('0x14')]['agentPause']=function(_0x408be4,_0x275340,_0xe075ed){var _0x46c4c9={'role':_0x6415('0x56')};_0x46c4c9[_0x408be4]=this[_0x6415('0x33')][_0x6415('0x38')];this['rpc']['agentPause'](_0x46c4c9,_0x275340,this[_0x6415('0x33')][_0x6415('0x34')])[_0x6415('0x13')](function(_0x1c49af){_0xe075ed(null,_['isNil'](_0x1c49af)?![]:!![]);})[_0x6415('0x16')](function(_0x4c39fd){logger[_0x6415('0x30')](_0x4c39fd);_0xe075ed(null,![]);});};AGIVertices[_0x6415('0x14')][_0x6415('0x57')]=function(_0x7f1871,_0x34ed0f){var _0x19435b={'role':_0x6415('0x56')};_0x19435b[_0x7f1871]=this[_0x6415('0x33')][_0x6415('0x38')];this[_0x6415('0x10')][_0x6415('0x57')](_0x19435b)[_0x6415('0x13')](function(_0x13d4d7){_0x34ed0f(null,_[_0x6415('0x46')](_0x13d4d7)?![]:!![]);})[_0x6415('0x16')](function(_0x1ba608){logger[_0x6415('0x30')](_0x1ba608);_0x34ed0f(null,![]);});};AGIVertices[_0x6415('0x14')][_0x6415('0x58')]=function(_0x445d4d,_0x100343){var _0x1fb569={'role':_0x6415('0x56')};_0x1fb569[_0x445d4d]=this['channel'][_0x6415('0x38')];this['rpc']['agentLogout'](_0x1fb569)[_0x6415('0x13')](function(_0x54d12f){_0x100343(null,_['isNil'](_0x54d12f)?![]:!![]);})[_0x6415('0x16')](function(_0x2b059e){logger[_0x6415('0x30')](_0x2b059e);_0x100343(null,![]);});};AGIVertices['prototype'][_0x6415('0x59')]=function(_0x1fcaf6,_0x2e0a91){var _0x4d1b15={'role':'agent'};_0x4d1b15[_0x1fcaf6]=this['channel']['callerid'];var _0x22ff9e=_0x1fcaf6!=_0x6415('0x5a')?util[_0x6415('0x29')]('%s/%s@from-sip/n','LOCAL',this[_0x6415('0x33')][_0x6415('0x38')]):undefined;this[_0x6415('0x10')][_0x6415('0x59')](_0x4d1b15,_0x22ff9e)[_0x6415('0x13')](function(_0x3952eb){_0x2e0a91(null,_['isNil'](_0x3952eb)?![]:!![]);})[_0x6415('0x16')](function(_0x2b1688){logger['error'](_0x2b1688);_0x2e0a91(null,![]);});};AGIVertices['prototype'][_0x6415('0x5b')]=function(_0x3963b0,_0x474a81){sh['exec'](_[_0x6415('0x5c')](_0x3963b0),function(_0x36bcee,_0xe000f0){var _0x441647=_0xe000f0['replace'](/(\r\n|\n|\r)/gm,'');_0x474a81(null,_0x441647);});};AGIVertices['prototype'][_0x6415('0x5d')]=function(_0x4c227b,_0xe2d65d){scripts[_0x6415('0x5d')](_0x4c227b[_0x6415('0x5e')],_0x4c227b[_0x6415('0x5f')]||'text',_0x4c227b['text'],_0x4c227b[_0x6415('0x60')]||_0x6415('0x61'),_0x4c227b[_0x6415('0x62')]||'MALE',_0x4c227b[_0x6415('0x63')]||_0x6415('0x64'))['then'](function(_0x4123f8){_0xe2d65d(null,_0x4123f8);})[_0x6415('0x16')](function(_0x5e2e49){_0xe2d65d(_0x5e2e49);});};AGIVertices[_0x6415('0x14')][_0x6415('0x65')]=function(_0x37cea4,_0x4cc2d8){scripts[_0x6415('0x65')](_0x37cea4[_0x6415('0x66')],_0x37cea4['google_tts_language']||'en',0x1)[_0x6415('0x13')](function(_0x13ebdd){_0x4cc2d8(null,_0x13ebdd);})[_0x6415('0x16')](function(_0x4d45cb){_0x4cc2d8(_0x4d45cb);});};AGIVertices[_0x6415('0x14')][_0x6415('0x67')]=function(_0xfe5a24,_0x163673){var _0x1fd5ce={'uri':_0xfe5a24[_0x6415('0x68')],'method':_0xfe5a24[_0x6415('0x69')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xfe5a24[_0x6415('0x6a')])===_0x6415('0x6b')&&parseInt(_0xfe5a24['timeout'])>=0x1?parseInt(_0xfe5a24[_0x6415('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x6415('0x6c')]([_0x6415('0x6d'),_0x6415('0x6e')],_0x1fd5ce[_0x6415('0x69')][_0x6415('0x6f')]())){try{_0x1fd5ce[_0x6415('0x70')]=_0xfe5a24[_0x6415('0xd')]?JSON[_0x6415('0x71')](_0xfe5a24['rawBody']):{};}catch(_0x2e86e2){logger[_0x6415('0x30')](_0x6415('0x72'),_0x2e86e2);}}try{_0x1fd5ce[_0x6415('0x73')]=_0xfe5a24[_0x6415('0x74')]?JSON[_0x6415('0x71')](_0xfe5a24[_0x6415('0x74')]):{};}catch(_0x4085e8){logger[_0x6415('0x30')](_0x6415('0x75'),_0x4085e8);}if(_0xfe5a24[_0x6415('0x76')]){try{var _0x555a55=require(_0xfe5a24['computedVariables'])[_0x6415('0x77')](this,_0x1fd5ce);_0x1fd5ce[_0x6415('0x78')]=Mustache[_0x6415('0x79')](_0xfe5a24[_0x6415('0x68')],_0x555a55,{},['$$','$$']);if(_0x1fd5ce[_0x6415('0x73')]){_0x1fd5ce[_0x6415('0x73')]=JSON[_0x6415('0x71')](Mustache['render'](JSON[_0x6415('0x7a')](_0x1fd5ce['headers']),_0x555a55,{},['$$','$$']));}if(_0x1fd5ce['body']){_0x1fd5ce[_0x6415('0x70')]=JSON[_0x6415('0x71')](Mustache[_0x6415('0x79')](JSON[_0x6415('0x7a')](_0x1fd5ce['body']),_0x555a55,{},['$$','$$']));}}catch(_0x4b9a95){logger['error'](_0x6415('0x7b'),_0x4b9a95);}}rp(_0x1fd5ce)[_0x6415('0x13')](function(_0x183c88){var _0xdcdde0={'statusCode':_0x183c88['statusCode']||0xc8,'statusMessage':_0x183c88[_0x6415('0x7c')]||'OK','headers':_0x183c88[_0x6415('0x73')]||{},'body':_0x183c88['body']||{}};_0x163673(null,_0xdcdde0);})['catch'](function(_0x562b07){var _0x1aa163={'statusCode':_0x562b07[_0x6415('0x7d')]||0x1f4,'statusMessage':_0x562b07[_0x6415('0x7e')]||_0x6415('0x7f'),'headers':_0x562b07['options'][_0x6415('0x73')]||{},'body':_0x562b07[_0x6415('0x80')][_0x6415('0x70')]||{}};_0x163673(null,_0x1aa163);});};AGIVertices['prototype'][_0x6415('0x81')]=function(_0x3bbaaa,_0x33c57f){scripts['googleDialogflow'](this[_0x6415('0x33')][_0x6415('0x34')],_0x3bbaaa[_0x6415('0x82')],_0x3bbaaa[_0x6415('0x66')],_0x3bbaaa['dialogflow_language']||'en')[_0x6415('0x13')](function(_0x2a60f1){_0x33c57f(null,_0x2a60f1);})[_0x6415('0x16')](function(_0x418957){_0x33c57f(_0x418957);});};AGIVertices[_0x6415('0x14')][_0x6415('0x83')]=function(_0x3d63a6,_0x5e9cca){scripts[_0x6415('0x83')](this[_0x6415('0x33')],_0x3d63a6)['then'](function(_0xf5f473){_0x5e9cca(null,_0xf5f473);})[_0x6415('0x16')](function(_0x8de8f2){_0x5e9cca(_0x8de8f2);});};AGIVertices[_0x6415('0x14')][_0x6415('0x84')]=function(_0x8f1ff4,_0x1eeb7f){scripts[_0x6415('0x84')](_0x8f1ff4['key'],_0x8f1ff4[_0x6415('0x66')],_0x8f1ff4[_0x6415('0x85')]||_0x6415('0x61'),_0x8f1ff4['speed'])[_0x6415('0x13')](function(_0x474857){_0x1eeb7f(null,_0x474857);})[_0x6415('0x16')](function(_0x2a7096){_0x1eeb7f(_0x2a7096);});};AGIVertices[_0x6415('0x14')][_0x6415('0x86')]=function(_0x1ab470,_0x1c0fb4,_0x508b3b){scripts[_0x6415('0x86')](_0x1c0fb4,_0x1ab470[_0x6415('0x82')],_0x1ab470[_0x6415('0x87')]||'en-US',this[_0x6415('0x88')](_0x1ab470['model'])?_0x1ab470[_0x6415('0x89')]:undefined)[_0x6415('0x13')](function(_0x1c0a0b){_0x508b3b(null,_0x1c0a0b);})[_0x6415('0x16')](function(_0x1dfe14){_0x508b3b(_0x1dfe14);});};AGIVertices['prototype'][_0x6415('0x8a')]=function(_0x550327,_0x3b33bd){scripts[_0x6415('0x8a')](_0x550327['aws_access_key_id'],_0x550327[_0x6415('0x8b')],_0x550327[_0x6415('0x8c')],_0x550327[_0x6415('0x8d')]||_0x6415('0x8e'),_0x550327['text'],_0x550327[_0x6415('0x8f')]||_0x6415('0x66'))[_0x6415('0x13')](function(_0x1d443c){_0x3b33bd(null,_0x1d443c);})['catch'](function(_0x1e4a7d){_0x3b33bd(_0x1e4a7d);});};AGIVertices['prototype'][_0x6415('0x90')]=function(_0x3af836,_0x5a77c4){scripts[_0x6415('0x90')](this[_0x6415('0x33')][_0x6415('0x34')],_0x3af836[_0x6415('0x91')],_0x3af836[_0x6415('0x8b')],_0x3af836[_0x6415('0x92')],_0x3af836['text'],_0x3af836['aws_bot_name'])['then'](function(_0x561558){_0x5a77c4(null,_0x561558);})[_0x6415('0x16')](function(_0xce1cc9){_0x5a77c4(_0xce1cc9);});};AGIVertices[_0x6415('0x14')][_0x6415('0x93')]=function(_0x39e6b3,_0x1fd582,_0x2664fb){scripts['googleASR'](_0x1fd582,_0x39e6b3[_0x6415('0x82')],_0x39e6b3[_0x6415('0x94')]||_0x6415('0x61'))[_0x6415('0x13')](function(_0x2ae6cd){_0x2664fb(null,_0x2ae6cd);})['catch'](function(_0x43fb0d){_0x2664fb(_0x43fb0d);});};AGIVertices['prototype'][_0x6415('0x95')]=function(_0x330a34,_0x1488d3,_0x401028){scripts['tildeASR'](_0x1488d3,_0x330a34[_0x6415('0x96')],_0x330a34[_0x6415('0x97')],_0x330a34['uri'])['then'](function(_0x1f8c92){_0x401028(null,_0x1f8c92);})[_0x6415('0x16')](function(_0x3a3e38){_0x401028(_0x3a3e38);});};AGIVertices['prototype'][_0x6415('0x98')]=function(_0x530c05){var _0x2d93ed=_[_0x6415('0x6c')](verticesWithRetry,_0x530c05[_0x6415('0x36')])?_0x530c05:_['clone'](_0x530c05);for(var _0x1f3ec9 in _0x2d93ed){if(_0x2d93ed[_0x6415('0x99')](_0x1f3ec9)){if(_0x2d93ed[_0x1f3ec9]&&_[_0x6415('0x9a')](_0x2d93ed[_0x1f3ec9])){if(_[_0x6415('0x6c')](recursiveMapAttributes,_0x1f3ec9)){_0x2d93ed[_0x1f3ec9]=this[_0x6415('0x9b')](_0x2d93ed[_0x1f3ec9]);}else{_0x2d93ed[_0x1f3ec9]=this['replaceAllVariables'](_0x2d93ed[_0x1f3ec9]);}}}}return _0x2d93ed;};AGIVertices[_0x6415('0x14')][_0x6415('0x9c')]=function(_0x23e597){for(var _0x4c69ee in _0x23e597){if(_0x23e597[_0x6415('0x99')](_0x4c69ee)){if(_[_0x6415('0x9d')](_0x23e597[_0x4c69ee])){this[_0x6415('0x9c')](_0x23e597[_0x4c69ee]);}else if(_[_0x6415('0x9e')](_0x23e597[_0x4c69ee])){for(var _0x1dc1ba=0x0;_0x1dc1ba<_0x23e597[_0x4c69ee][_0x6415('0x9f')];_0x1dc1ba++){this[_0x6415('0x9c')](_0x23e597[_0x4c69ee][_0x1dc1ba]);}}else if(_[_0x6415('0x9a')](_0x23e597[_0x4c69ee])){_0x23e597[_0x4c69ee]=this[_0x6415('0xa0')](_0x23e597[_0x4c69ee]);}}}};AGIVertices['prototype'][_0x6415('0xa1')]=function(_0x49a995,_0xd1e060){for(var _0x463af1 in _0x49a995){if(_0x49a995[_0x6415('0x99')](_0x463af1)){if(_[_0x6415('0x9d')](_0x49a995[_0x463af1])){if(!_[_0x6415('0x4c')](_0x49a995[_0x463af1])){this[_0x6415('0xa1')](_0x49a995[_0x463af1],util[_0x6415('0x29')](_0x6415('0xa2'),_0xd1e060,_0x463af1));}}else if(_['isArray'](_0x49a995[_0x463af1])){for(var _0x486a68=0x0;_0x486a68<_0x49a995[_0x463af1][_0x6415('0x9f')];_0x486a68++){this[_0x6415('0xa1')](_0x49a995[_0x463af1][_0x486a68],util[_0x6415('0x29')](_0x6415('0xa2'),_0xd1e060,_0x463af1+'['+_0x486a68+']'));}}else{if(!_[_0x6415('0x46')](_0x49a995[_0x463af1])){this[_0x6415('0x33')][_0x6415('0xa3')](util[_0x6415('0x29')](_0x6415('0xa2'),_0xd1e060,_0x463af1),_0x49a995[_0x463af1]);}}}}};AGIVertices[_0x6415('0x14')][_0x6415('0x9b')]=function(_0x573be3){try{var _0xe17dc7=JSON[_0x6415('0x71')](_0x573be3);this['recursiveNodeIndex'](_0xe17dc7);return JSON[_0x6415('0x7a')](_0xe17dc7);}catch(_0x37f5af){return this[_0x6415('0xa0')](_0x573be3);}};AGIVertices[_0x6415('0x14')][_0x6415('0xa0')]=function(_0x1c2cfa){console[_0x6415('0x41')](_0x6415('0xa4'),_0x1c2cfa);var _0x4e5496=_0x1c2cfa[_0x6415('0xa5')]('{');for(var _0x5c53b3=0x1;_0x5c53b3<_0x4e5496[_0x6415('0x9f')];_0x5c53b3+=0x1){var _0x5eb263=_0x4e5496[_0x5c53b3][_0x6415('0xa5')]('}');console[_0x6415('0x41')](_0x6415('0xa6'),_0x5eb263);if(_0x5eb263[_0x6415('0x9f')]>0x1){_0x1c2cfa=_0x1c2cfa[_0x6415('0xa7')]('{'+_0x5eb263[0x0]+'}',this[_0x6415('0x33')][_0x6415('0x11')](_0x5eb263[0x0])['extra']||_0x5eb263[0x0]);}}if(_0x4e5496[_0x6415('0x9f')]===0x1){return _0x1c2cfa[_0x6415('0x53')]();}console['log'](_0x6415('0xa8'),_0x1c2cfa);return this[_0x6415('0xa0')](_0x1c2cfa);};AGIVertices['prototype'][_0x6415('0xa9')]=function(_0x51791b,_0x1bbd88){var _0x48c975=this[_0x6415('0x33')][_0x6415('0x11')](_0x51791b);if(_0x48c975['result']===-0x1){return _0x48c975;}logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xaa'),_0x1bbd88,_0x48c975['extra']));return this[_0x6415('0x33')][_0x6415('0xa3')](_0x1bbd88,_0x48c975[_0x6415('0xab')]);};AGIVertices[_0x6415('0x14')][_0x6415('0x88')]=function(_0x155c02){return _0x155c02&&_0x155c02!=='0'&&_0x155c02!=='-1'&&_0x155c02!=='';};AGIVertices[_0x6415('0x14')][_0x6415('0xac')]=function(_0x2c235e){this[_0x6415('0xad')][_0x6415('0x77')](this,_0x2c235e,'-');_0x2c235e[_0x6415('0xae')]=_0x2c235e[_0x6415('0xac')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x6415('0xaf')]=function(_0x1847ec){logger['info'](util[_0x6415('0x29')](_0x6415('0xb0'),_0x1847ec['label']));if(!this[_0x6415('0x88')](_0x1847ec[_0x6415('0x66')])){return this[_0x6415('0x33')]['noop'](_0x6415('0xb1'));}var _0x4a22c3='\x22'+_0x1847ec[_0x6415('0x66')]+'\x22';if(this[_0x6415('0x88')](_0x1847ec[_0x6415('0x80')])){_0x4a22c3+=','+_0x1847ec[_0x6415('0x80')];}var _0x30bbec=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0xb3'),_0x4a22c3);if(_0x30bbec[_0x6415('0xb4')]===-0x1){return _0x30bbec;}return this['channel']['noop'](util[_0x6415('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4a22c3));};AGIVertices[_0x6415('0x14')][_0x6415('0xb5')]=function(_0x147fa8){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xb6'),_0x147fa8[_0x6415('0x35')]));if(!this['isConfigured'](_0x147fa8['grammar'])){return this['channel'][_0x6415('0xb7')](_0x6415('0xb8'));}var _0x6927a9=_0x147fa8[_0x6415('0xb9')];if(this[_0x6415('0x88')](_0x147fa8[_0x6415('0x80')])){_0x6927a9+=','+_0x147fa8[_0x6415('0x80')];}var _0x278a69=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0xba'),_0x6927a9);if(_0x278a69[_0x6415('0xb4')]===-0x1){return _0x278a69;}var _0x2a40ce=this[_0x6415('0xa9')](_0x6415('0xbb'),_0x6415('0xbc'));if(_0x2a40ce[_0x6415('0xb4')]===-0x1){return _0x2a40ce;}var _0x44fd72=this[_0x6415('0xa9')]('RECOG_INPUT()',_0x6415('0xbd'));if(_0x44fd72['result']===-0x1){return _0x44fd72;}var _0x28791f=this[_0x6415('0xa9')](_0x6415('0xbe'),_0x6415('0xbf'));if(_0x28791f[_0x6415('0xb4')]===-0x1){return _0x28791f;}return this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0xc0'),_0x6927a9));};AGIVertices[_0x6415('0x14')][_0x6415('0x9')]=function(_0x4224b8){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xc1'),_0x4224b8[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0x9')]([_0x4224b8['command'],_0x4224b8[_0x6415('0xc2')]]);};AGIVertices[_0x6415('0x14')][_0x6415('0xc3')]=function(_0x50a6b0){logger[_0x6415('0x2c')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x50a6b0[_0x6415('0x35')]));if(this[_0x6415('0x88')](_0x50a6b0['timeout'])){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xc4'),_0x50a6b0[_0x6415('0x6a')]));var _0x1b2851=this[_0x6415('0x33')][_0x6415('0xc5')](_0x50a6b0[_0x6415('0x6a')]);if(_0x1b2851[_0x6415('0xb4')]===-0x1){return _0x1b2851;}}return this[_0x6415('0x33')][_0x6415('0xc3')]();};AGIVertices[_0x6415('0x14')]['callback']=function(_0x107539){console['log'](_0x6415('0xc6'),_0x107539);logger[_0x6415('0x2c')](util['format'](_0x6415('0xc7'),_0x107539[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x107539[_0x6415('0xc8')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x107539,'no\x20list\x20selected');}_0x107539[_0x6415('0x50')]=moment();if(this['isConfigured'](_0x107539[_0x6415('0xc9')])){_0x107539[_0x6415('0x50')]=moment()[_0x6415('0xca')](_0x107539['delay'],_0x6415('0xcb'));}if(!this[_0x6415('0x88')](_0x107539[_0x6415('0x54')])){_0x107539[_0x6415('0x54')]=0x2;}console[_0x6415('0x41')]('before\x20createcmcontact',_0x107539);this['createCmContact'][_0x6415('0x77')](this,_0x107539);return this[_0x6415('0x33')]['noop'](util['format'](_0x6415('0xcc'),_0x107539[_0x6415('0x49')],_0x107539['list_id'],_0x107539['scheduledAt']));};AGIVertices[_0x6415('0x14')][_0x6415('0xcd')]=function(_0x2640d8){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2640d8[_0x6415('0x35')]));var _0x2439c7=this[_0x6415('0x33')][_0x6415('0xb2')](_0x2640d8[_0x6415('0xce')],_0x2640d8[_0x6415('0x80')]);if(_0x2439c7[_0x6415('0xb4')]===-0x1){return _0x2439c7;}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xcf'),_0x2640d8[_0x6415('0xce')],_0x2640d8['options']));};AGIVertices['prototype'][_0x6415('0xd0')]=function(_0x1b89ec){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xd1'),_0x1b89ec['label']));if(!this[_0x6415('0x88')](_0x1b89ec[_0x6415('0x66')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xb1'));}var _0x2a5a78='\x22'+_0x1b89ec[_0x6415('0x66')]+'\x22';if(this[_0x6415('0x88')](_0x1b89ec['options'])){_0x2a5a78+=','+_0x1b89ec[_0x6415('0x80')];}var _0x7ea177=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0xb3'),_0x2a5a78);if(_0x7ea177[_0x6415('0xb4')]===-0x1){return _0x7ea177;}return this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')](_0x6415('0xd2'),_0x2a5a78));};AGIVertices[_0x6415('0x14')][_0x6415('0xd3')]=function(_0x224a94){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xd4'),_0x224a94[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x224a94['text'])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xb1'));}var _0x10e751='\x22'+_0x224a94[_0x6415('0x66')]+'\x22';if(this[_0x6415('0x88')](_0x224a94[_0x6415('0x80')])){_0x10e751+=','+_0x224a94[_0x6415('0x80')];}var _0x48de55=this[_0x6415('0x33')][_0x6415('0xb2')]('MRCPSynth',_0x10e751);if(_0x48de55[_0x6415('0xb4')]===-0x1){return _0x48de55;}return this['channel']['noop'](util[_0x6415('0x29')](_0x6415('0xd2'),_0x10e751));};AGIVertices['prototype']['lumenvoxasr']=function(_0x34cb32){logger[_0x6415('0x2c')](util['format'](_0x6415('0xd5'),_0x34cb32[_0x6415('0x35')]));if(!this['isConfigured'](_0x34cb32['grammar'])){return this[_0x6415('0x33')]['noop'](_0x6415('0xb8'));}var _0x2e869d=_0x34cb32[_0x6415('0xb9')];if(this['isConfigured'](_0x34cb32[_0x6415('0x80')])){_0x2e869d+=','+_0x34cb32['options'];}var _0x1d9940=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0xba'),_0x2e869d);if(_0x1d9940['result']===-0x1){return _0x1d9940;}var _0x4e640e=this[_0x6415('0xa9')]('RECOG_CONFIDENCE()',_0x6415('0xd6'));if(_0x4e640e[_0x6415('0xb4')]===-0x1){return _0x4e640e;}var _0x50eb9f=this[_0x6415('0xa9')](_0x6415('0xd7'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x50eb9f[_0x6415('0xb4')]===-0x1){return _0x50eb9f;}var _0x4d0afa=this['getAndSetVariable'](_0x6415('0xbe'),_0x6415('0xd8'));if(_0x4d0afa[_0x6415('0xb4')]===-0x1){return _0x4d0afa;}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xc0'),_0x2e869d));};AGIVertices[_0x6415('0x14')][_0x6415('0xd9')]=function(_0x32dfba){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x32dfba[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x32dfba[_0x6415('0xb9')])){return this[_0x6415('0x33')]['noop']('no\x20grammar\x20configured');}var _0x46d118=_0x32dfba[_0x6415('0xb9')];if(this[_0x6415('0x88')](_0x32dfba[_0x6415('0x80')])){_0x46d118+=','+_0x32dfba[_0x6415('0x80')];}var _0x2dd560=this[_0x6415('0x33')][_0x6415('0xb2')]('MRCPRecog',_0x46d118);if(_0x2dd560[_0x6415('0xb4')]===-0x1){return _0x2dd560;}var _0x3543de=this[_0x6415('0xa9')](_0x6415('0xbb'),_0x6415('0xda'));if(_0x3543de[_0x6415('0xb4')]===-0x1){return _0x3543de;}var _0x1e9873=this[_0x6415('0xa9')](_0x6415('0xd7'),_0x6415('0xdb'));if(_0x1e9873[_0x6415('0xb4')]===-0x1){return _0x1e9873;}var _0x249fa7=this[_0x6415('0xa9')](_0x6415('0xbe'),'SESTEK_ASR_INSTANCE');if(_0x249fa7[_0x6415('0xb4')]===-0x1){return _0x249fa7;}return this['channel'][_0x6415('0xb7')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x46d118));};AGIVertices[_0x6415('0x14')][_0x6415('0xdc')]=function(_0x25f043){logger['info'](util[_0x6415('0x29')](_0x6415('0xdd'),_0x25f043[_0x6415('0x35')]));if(!this['isConfigured'](_0x25f043[_0x6415('0xde')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x25f043,'no\x20database\x20selected');}var _0x497542=this[_0x6415('0xdf')][_0x6415('0x77')](this,_0x25f043[_0x6415('0xde')]);if(!_0x497542){return this['channel']['error'](_0x25f043,_0x6415('0xe0'));}if(!this[_0x6415('0x88')](_0x25f043[_0x6415('0x2d')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x25f043,_0x6415('0xe1'));}var _0x5b6b47=_0x25f043[_0x6415('0x2d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0xe2'),_0x5b6b47));var _0x4443eb=this['getQueryOdbc'][_0x6415('0x77')](this,_0x497542,_0x5b6b47);this['createSquareDetailsReport'][_0x6415('0x77')](this,_0x25f043,_0x5b6b47);if(!this[_0x6415('0x88')](_0x25f043['variable_id'])){return this[_0x6415('0x33')][_0x6415('0xb7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1ad0f8=this['getVariable'][_0x6415('0x77')](this,_0x25f043[_0x6415('0xe3')]);if(!_0x1ad0f8){return this[_0x6415('0x33')][_0x6415('0x30')](_0x25f043,_0x6415('0xe4'));}var _0x363a33=this;_0x4443eb['forEach'](function(_0x131497,_0x59c04c){Object['keys'](_0x131497)['forEach'](function(_0x2617f5){_0x363a33[_0x6415('0x33')][_0x6415('0xa3')](util[_0x6415('0x29')](_0x6415('0xe5'),_0x1ad0f8,_0x59c04c,_0x2617f5),_0x131497[_0x2617f5]);});});this[_0x6415('0x33')][_0x6415('0xa3')](util[_0x6415('0x29')](_0x6415('0xe6'),_0x1ad0f8),_0x4443eb['length']);return this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')](_0x6415('0xe7'),_0x1ad0f8));};AGIVertices[_0x6415('0x14')][_0x6415('0xe8')]=function(_0x5555e3){logger['debug'](util[_0x6415('0x29')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x5555e3['label']));if(!this[_0x6415('0x88')](_0x5555e3[_0x6415('0xe9')])){return this['channel'][_0x6415('0x30')](_0x5555e3,_0x6415('0xea'));}var _0x44f37c=this[_0x6415('0x1b')]['sync'](this,_0x5555e3[_0x6415('0xe9')]);if(!_0x44f37c){return this['channel'][_0x6415('0x30')](_0x5555e3,'no\x20user\x20found');}var _0x44b20a=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0xeb'),[util['format']('SIP/%s',_0x44f37c),_0x5555e3['timeout'],_0x5555e3[_0x6415('0xec')],_0x5555e3[_0x6415('0x68')]]);if(_0x44b20a['result']===-0x1){return _0x44b20a;}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xed'),'DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x234c52){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xee'),_0x234c52[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x234c52['key'])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xef'));}if(!this['isConfigured'](_0x234c52['text'])){return this[_0x6415('0x33')][_0x6415('0xb7')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x6415('0xad')](_0x234c52);this[_0x6415('0x3f')](_0x234c52[_0x6415('0x66')],'in');this['channel'][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xf0'),_0x234c52[_0x6415('0x66')]));var _0x567463=this[_0x6415('0x81')][_0x6415('0x77')](this,_0x234c52);if(_0x567463){for(var _0x17cbee in _0x567463){if(_0x567463[_0x6415('0x99')](_0x17cbee)){this[_0x6415('0x33')][_0x6415('0xa3')](util['format']('DIALOGFLOW_%s',_0x17cbee[_0x6415('0x6f')]()),_0x567463[_0x17cbee]);}}this[_0x6415('0x3f')](_0x567463[_0x6415('0xf1')],_0x6415('0xf2'));return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xf3'),_0x567463[_0x6415('0xf1')]));}return this['channel'][_0x6415('0x30')](_0x234c52,_0x6415('0xf4'));};AGIVertices[_0x6415('0x14')]['sesteknda']=function(_0x18635e){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xf5'),_0x18635e['label']));if(!this['isConfigured'](_0x18635e[_0x6415('0xf6')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xf7'));}if(!this['isConfigured'](_0x18635e['username'])){return this['channel'][_0x6415('0xb7')](_0x6415('0xf8'));}if(!this['isConfigured'](_0x18635e[_0x6415('0xf9')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xfa'));}if(!this['isConfigured'](_0x18635e[_0x6415('0xfb')])){return this[_0x6415('0x33')][_0x6415('0xb7')]('no\x20text\x20configured');}this[_0x6415('0x33')][_0x6415('0xfc')]=!![];this[_0x6415('0xad')](_0x18635e);this[_0x6415('0x3f')](_0x18635e['text'],'in');this['channel']['noop'](util[_0x6415('0x29')]('Trying\x20SestekNDA:\x20%s',_0x18635e[_0x6415('0x66')]));var _0x571de5=this['sestekNDA'][_0x6415('0x77')](this,_0x18635e);if(_0x571de5){for(var _0x3e94e9 in _0x571de5){if(_0x571de5[_0x6415('0x99')](_0x3e94e9)){this[_0x6415('0x33')][_0x6415('0xa3')](util[_0x6415('0x29')](_0x6415('0xfd'),_0x3e94e9['toUpperCase']()),_0x571de5[_0x3e94e9]);}}this[_0x6415('0x3f')](_0x571de5['speech'],'out');if(_0x571de5[_0x6415('0xfe')]){this[_0x6415('0x33')][_0x6415('0xb7')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x571de5[_0x6415('0xfe')]));var _0xebc6d3=this[_0x6415('0x33')]['streamFile'](_0x571de5[_0x6415('0xfe')]);try{fs['unlink'](_0x571de5[_0x6415('0xfe')]+'.wav');}catch(_0x26d8d6){logger[_0x6415('0x30')](_0x26d8d6);}return _0xebc6d3;}else{return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xff'),_0x571de5[_0x6415('0xf1')]));}}return this['channel']['error'](_0x18635e,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x6415('0x14')][_0x6415('0x100')]=function(_0x37f4e5){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x101'),_0x37f4e5[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x100'));};AGIVertices[_0x6415('0x14')][_0x6415('0x102')]=function(_0x14ef53){logger['info'](util[_0x6415('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x14ef53[_0x6415('0x35')]));var _0x105a4a='';if(_0x14ef53['trunk_id']){if(!this[_0x6415('0x88')](_0x14ef53[_0x6415('0x103')])){return this[_0x6415('0x33')]['error'](_0x14ef53,_0x6415('0x104'));}else{var _0x45221b=parseInt(_0x14ef53['trunk_id'],0xa);if(isNaN(_0x45221b)){_0x105a4a=_0x14ef53[_0x6415('0x103')];}else{_0x105a4a=this['getTrunk'][_0x6415('0x77')](this,_0x14ef53[_0x6415('0x103')]);if(!_0x105a4a){return this[_0x6415('0x33')][_0x6415('0x30')](_0x14ef53,'no\x20trunk\x20found');}}}}else if(_0x14ef53['trunk_name']){_0x105a4a=_0x14ef53['trunk_name'];}else{return this[_0x6415('0x33')]['error'](_0x14ef53,_0x6415('0x104'));}var _0x351c51=this[_0x6415('0x33')]['exec'](_0x6415('0xeb'),[util[_0x6415('0x29')]('SIP/%s/%s',_0x105a4a,_0x14ef53[_0x6415('0x49')]),_0x14ef53[_0x6415('0x6a')],_0x14ef53[_0x6415('0xec')],_0x14ef53[_0x6415('0x68')]]);if(_0x351c51[_0x6415('0xb4')]===-0x1){return _0x351c51;}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xed'),_0x6415('0xeb')));};AGIVertices[_0x6415('0x14')][_0x6415('0x105')]=function(_0x5c4f34){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x106'),_0x5c4f34[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x105'));};AGIVertices[_0x6415('0x14')][_0x6415('0x107')]=function(_0x53661a){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x108'),_0x53661a[_0x6415('0x35')]));if(_0x53661a[_0x6415('0xae')]===0x0){return this[_0x6415('0xac')](_0x53661a);}_0x53661a[_0x6415('0xae')]-=0x1;if(!this[_0x6415('0x88')](_0x53661a['file_id'])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x53661a,_0x6415('0x109'));}var _0x555c29=this['getSound']['sync'](this,_0x53661a['file_id']);if(!_0x555c29){return this[_0x6415('0x33')][_0x6415('0x30')](_0x53661a,_0x6415('0x10a'));}if(!this[_0x6415('0x88')](_0x53661a[_0x6415('0xe3')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x6415('0x10b'));}var _0x2cb052=this[_0x6415('0x33')][_0x6415('0x10c')](_0x555c29,_0x53661a[_0x6415('0x10d')],_0x53661a[_0x6415('0x10e')]);var _0x167c92=_0x2cb052[_0x6415('0xb4')]?_0x2cb052[_0x6415('0xb4')][_0x6415('0x53')]():'';logger['info']('test',JSON[_0x6415('0x7a')](_0x2cb052));if(_0x2cb052[_0x6415('0xb4')]===-0x1){this[_0x6415('0xad')][_0x6415('0x77')](this,_0x53661a,_0x167c92);return _0x2cb052;}else if(_0x2cb052['extra']===_0x6415('0x6a')){_0x2cb052[_0x6415('0xb4')]=_0x167c92[_0x6415('0x9f')]>=parseInt(_0x53661a['mindigit'])?'x':'i';}else{_0x2cb052[_0x6415('0xb4')]=_0x167c92[_0x6415('0x9f')]>=parseInt(_0x53661a[_0x6415('0x10f')])&&_0x167c92[_0x6415('0x9f')]<=parseInt(_0x53661a[_0x6415('0x10e')])?'x':'i';}var _0x1f8489=this['getVariable'][_0x6415('0x77')](this,_0x53661a[_0x6415('0xe3')]);if(!_0x1f8489){return this[_0x6415('0x33')][_0x6415('0x30')](_0x53661a,'no\x20variable\x20found');}this[_0x6415('0x33')][_0x6415('0xa3')](_0x1f8489,_0x167c92);if(this['isConfigured'](_0x53661a[_0x6415('0x110')])){var _0x19dd4b=parseInt(_0x53661a[_0x6415('0x110')],0xa);var _0x2b79d0=rs[_0x6415('0x111')]({'charset':'*','length':_0x19dd4b});var _0x3b6152=_0x167c92[_0x6415('0x9f')];if(_0x3b6152>0x0){if(_0x3b6152>_0x19dd4b){this[_0x6415('0xad')][_0x6415('0x77')](this,_0x53661a,_0x53661a[_0x6415('0x112')]==='first'?_0x2b79d0+_0x167c92[_0x6415('0x113')](_0x19dd4b):_0x167c92['substr'](0x0,_0x3b6152-_0x19dd4b)+_0x2b79d0);}else{this[_0x6415('0xad')][_0x6415('0x77')](this,_0x53661a,rs[_0x6415('0x111')]({'charset':'*','length':_0x3b6152}));}}else{this[_0x6415('0xad')][_0x6415('0x77')](this,_0x53661a,'');}}else{this[_0x6415('0xad')][_0x6415('0x77')](this,_0x53661a,_0x167c92);}return _0x2cb052;};AGIVertices[_0x6415('0x14')]['getsecretdigits']=function(_0x511b33){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x114'),_0x511b33[_0x6415('0x35')]));return this[_0x6415('0x107')](_0x511b33);};AGIVertices[_0x6415('0x14')]['goal']=function(_0x5b6299){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x115'),_0x5b6299[_0x6415('0x35')]));this['createSquareDetailsReport'][_0x6415('0x77')](this,_0x5b6299,_0x5b6299['goalname']);return this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')]('GOAL\x20%s',_0x5b6299[_0x6415('0x116')]));};AGIVertices[_0x6415('0x14')][_0x6415('0x117')]=function(_0x15c558){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x118'),_0x15c558[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x15c558[_0x6415('0x91')])||!this['isConfigured'](_0x15c558[_0x6415('0x8b')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x119'));}if(!this[_0x6415('0x88')](_0x15c558[_0x6415('0x66')])){return this[_0x6415('0x33')][_0x6415('0xb7')]('no\x20text\x20configured');}this['channel'][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x11a'),_0x15c558[_0x6415('0x66')]));var _0x404815=this[_0x6415('0x8a')]['sync'](this,_0x15c558);if(_0x404815){this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x11b'),_0x404815));var _0x4cf33d=this['channel'][_0x6415('0x11c')](_0x404815);try{fs[_0x6415('0x11d')](_0x404815+_0x6415('0x11e'));}catch(_0x47c9c2){logger[_0x6415('0x30')](_0x47c9c2);}return _0x4cf33d;}return this[_0x6415('0x33')][_0x6415('0x30')](_0x15c558,_0x6415('0x11f'));};AGIVertices['prototype']['awslex']=function(_0x3a3ee8){logger[_0x6415('0x2c')](util['format'](_0x6415('0x120'),_0x3a3ee8['label']));if(!this[_0x6415('0x88')](_0x3a3ee8['aws_access_key_id'])||!this['isConfigured'](_0x3a3ee8['aws_secret_access_key'])){return this['channel'][_0x6415('0xb7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x6415('0x88')](_0x3a3ee8[_0x6415('0x121')])){return this[_0x6415('0x33')]['noop'](_0x6415('0x122'));}if(!this[_0x6415('0x88')](_0x3a3ee8[_0x6415('0x66')])){return this[_0x6415('0x33')][_0x6415('0xb7')]('no\x20text\x20configured');}this[_0x6415('0x33')][_0x6415('0xfc')]=!![];this[_0x6415('0xad')](_0x3a3ee8);this['createSquareMessage'](_0x3a3ee8[_0x6415('0x66')],'in');this[_0x6415('0x33')][_0x6415('0xb7')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x3a3ee8[_0x6415('0x66')]));var _0x2ac95f=this[_0x6415('0x90')][_0x6415('0x77')](this,_0x3a3ee8);if(_0x2ac95f){for(var _0x43f730 in _0x2ac95f){if(_0x2ac95f[_0x6415('0x99')](_0x43f730)&&_[_0x6415('0x9a')](_0x2ac95f[_0x43f730])){this[_0x6415('0x33')][_0x6415('0xa3')](util[_0x6415('0x29')](_0x6415('0x123'),_0x43f730[_0x6415('0x6f')]()),_0x2ac95f[_0x43f730]);}}if(_[_0x6415('0x46')](_0x2ac95f[_0x6415('0x7e')])){return this['channel'][_0x6415('0xb7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x6415('0x3f')](_0x2ac95f[_0x6415('0x7e')],_0x6415('0xf2'));return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x124'),_0x2ac95f['message']));}}return this[_0x6415('0x33')][_0x6415('0x30')](_0x3a3ee8,_0x6415('0x125'));};AGIVertices[_0x6415('0x14')][_0x6415('0x126')]=function(_0x290157){logger['info'](util['format'](_0x6415('0x127'),_0x290157[_0x6415('0x35')],_0x290157[_0x6415('0x6a')]));if(!this[_0x6415('0x88')](_0x290157[_0x6415('0x82')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xef'));}var _0x236f8a=_0x6415('0x128');var _0x35b1d1=util[_0x6415('0x29')](_0x6415('0x129'),FILES_PATH,rs[_0x6415('0x111')](0x4));var _0x22bc96=util['format'](_0x6415('0xa2'),_0x35b1d1,_0x236f8a);var _0x14643c=!![];if(_0x290157[_0x6415('0x12a')]===_0x6415('0x12b')){_0x14643c=![];}var _0x56a91=this['channel'][_0x6415('0x12c')](_0x35b1d1,_0x236f8a,_0x290157[_0x6415('0x12d')],_0x290157[_0x6415('0x6a')],undefined,_0x14643c);if(_0x56a91[_0x6415('0xb4')]!==-0x1){this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')]('google\x20%s\x20file\x20created',_0x22bc96));var _0x39a97c=this[_0x6415('0x93')][_0x6415('0x77')](this,_0x290157,_0x22bc96);if(_0x39a97c){for(var _0x3b61d4 in _0x39a97c){if(_0x39a97c[_0x6415('0x99')](_0x3b61d4)){this[_0x6415('0x33')][_0x6415('0xa3')](util[_0x6415('0x29')](_0x6415('0x12e'),_0x3b61d4[_0x6415('0x6f')]()),_0x39a97c[_0x3b61d4]);}}return this['channel'][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x12f'),JSON['stringify'](_0x39a97c)));}}return _0x56a91;};AGIVertices[_0x6415('0x14')][_0x6415('0x130')]=function(_0x330bc1){logger[_0x6415('0x2c')](util['format'](_0x6415('0x131'),_0x330bc1[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x330bc1[_0x6415('0x96')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x132'));}if(!this[_0x6415('0x88')](_0x330bc1[_0x6415('0x97')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x133'));}var _0x303831=_0x6415('0x128');var _0xc75595=util['format'](_0x6415('0x129'),FILES_PATH,rs[_0x6415('0x111')](0x4));var _0x25601c=util[_0x6415('0x29')](_0x6415('0xa2'),_0xc75595,_0x303831);var _0xc2eda=!![];if(_0x330bc1[_0x6415('0x12a')]===_0x6415('0x12b')){_0xc2eda=![];}var _0x5de4ad=this[_0x6415('0x33')][_0x6415('0x12c')](_0xc75595,_0x303831,_0x330bc1[_0x6415('0x12d')],_0x330bc1[_0x6415('0x6a')],undefined,_0xc2eda);if(_0x5de4ad[_0x6415('0xb4')]!==-0x1){this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0x134'),_0x25601c));var _0x27f14c=this[_0x6415('0x95')][_0x6415('0x77')](this,_0x330bc1,_0x25601c);if(_0x27f14c){for(var _0xd08eec in _0x27f14c){if(_0x27f14c['hasOwnProperty'](_0xd08eec)){this[_0x6415('0x33')]['setVariable'](util['format'](_0x6415('0x135'),_0xd08eec[_0x6415('0x6f')]()),_0x27f14c[_0xd08eec]);}}return this[_0x6415('0x33')]['noop'](util['format'](_0x6415('0x136'),JSON[_0x6415('0x7a')](_0x27f14c)));}}return _0x5de4ad;};AGIVertices[_0x6415('0x14')][_0x6415('0x137')]=function(_0x49b7fd){logger['info'](util[_0x6415('0x29')](_0x6415('0x138'),_0x49b7fd['label']));return this[_0x6415('0x33')]['continueAt'](_0x49b7fd[_0x6415('0x3a')],_0x49b7fd['extension'],_0x49b7fd[_0x6415('0x3c')]);};AGIVertices[_0x6415('0x14')]['gotoif']=function(_0x4104c1){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4104c1[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x4104c1[_0x6415('0x139')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x4104c1,_0x6415('0x13a'));}try{var _0x165a87=eval(_0x4104c1[_0x6415('0x139')])?_0x6415('0x13b'):'false';this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x13c'),_0x4104c1[_0x6415('0x139')],_0x165a87));return{'code':0xc8,'result':_0x165a87};}catch(_0xe217e9){return{'code':0xc8,'result':_0x6415('0x13d')};}};AGIVertices['prototype'][_0x6415('0x13e')]=function(_0x59f009){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x13f'),_0x59f009[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x59f009[_0x6415('0x140')])){return this[_0x6415('0x33')]['error'](_0x59f009,_0x6415('0x141'));}var _0x36c50d=this[_0x6415('0x26')][_0x6415('0x77')](this,_0x59f009[_0x6415('0x140')]);if(!_0x36c50d){return this[_0x6415('0x33')]['error'](_0x59f009,'no\x20intervals\x20found');}for(var _0x3cb187=0x0;_0x3cb187<_0x36c50d[_0x6415('0x9f')];_0x3cb187+=0x1){var _0x3c08dc=this[_0x6415('0x33')][_0x6415('0x11')](util[_0x6415('0x29')](_0x6415('0x142'),_0x36c50d[_0x3cb187]));if(_0x3c08dc['result']===-0x1){return _0x3c08dc;}logger[_0x6415('0x2c')](util['format'](_0x6415('0x143'),_0x36c50d[_0x3cb187],_0x3c08dc[_0x6415('0xab')]));if(_0x3c08dc[_0x6415('0xab')]===_0x6415('0x13b')){logger[_0x6415('0x2c')](util['format'](_0x6415('0x143'),_0x36c50d[_0x3cb187],_0x6415('0x13b')));this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')]('IFTIME\x20%s\x20%s',_0x36c50d[_0x3cb187],_0x6415('0x13b')));return{'code':0xc8,'result':_0x6415('0x13b')};}else{logger[_0x6415('0x2c')](util['format'](_0x6415('0x143'),_0x36c50d[_0x3cb187],_0x6415('0x13d')));this[_0x6415('0x33')][_0x6415('0xb7')](util['format']('IFTIME\x20%s\x20%s',_0x36c50d[_0x3cb187],_0x6415('0x13d')));}}return{'code':0xc8,'result':_0x6415('0x13d')};};AGIVertices['prototype'][_0x6415('0x144')]=function(_0x2376ff){logger[_0x6415('0x2c')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2376ff[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0x144')]();};AGIVertices[_0x6415('0x14')][_0x6415('0x145')]=function(_0x2a0322){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x2a0322[_0x6415('0x35')]));if(!this['isConfigured'](_0x2a0322['key'])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xef'));}var _0x3ee026='wav';var _0x778395=util[_0x6415('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x6415('0x111')](0x4));var _0x6ebe5a=util[_0x6415('0x29')]('%s.%s',_0x778395,_0x3ee026);var _0x3d2ffe=!![];if(_0x2a0322[_0x6415('0x12a')]===_0x6415('0x12b')){_0x3d2ffe=![];}var _0x236bf9=this['channel'][_0x6415('0x12c')](_0x778395,_0x3ee026,_0x2a0322[_0x6415('0x12d')],_0x2a0322[_0x6415('0x6a')],undefined,_0x3d2ffe);if(_0x236bf9[_0x6415('0xb4')]!==-0x1){this['channel'][_0x6415('0xb7')](util['format']('ispeech\x20%s\x20file\x20created',_0x6ebe5a));var _0x2c815a=this[_0x6415('0x86')]['sync'](this,_0x2a0322,_0x6ebe5a);if(_0x2c815a){for(var _0x51f8d4 in _0x2c815a){if(_0x2c815a[_0x6415('0x99')](_0x51f8d4)){this['channel']['setVariable'](util[_0x6415('0x29')](_0x6415('0x146'),_0x51f8d4[_0x6415('0x6f')]()),_0x2c815a[_0x51f8d4]);}}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x147'),JSON[_0x6415('0x7a')](_0x2c815a)));}}return _0x236bf9;};AGIVertices['prototype'][_0x6415('0x148')]=function(_0x553b0c){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x149'),_0x553b0c['label']));if(!this[_0x6415('0x88')](_0x553b0c[_0x6415('0x82')])){return this[_0x6415('0x33')]['noop'](_0x6415('0xef'));}if(!this[_0x6415('0x88')](_0x553b0c[_0x6415('0x66')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xb1'));}this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x14a'),_0x553b0c[_0x6415('0x66')]));var _0x410ace=this[_0x6415('0x84')][_0x6415('0x77')](this,_0x553b0c);if(_0x410ace){this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x14b'),_0x410ace));var _0x24796e=this[_0x6415('0x33')]['streamFile'](_0x410ace,_0x553b0c[_0x6415('0x12d')]);try{fs[_0x6415('0x11d')](_0x410ace+_0x6415('0x11e'));}catch(_0x1337f7){logger[_0x6415('0x30')](_0x1337f7);}return _0x24796e;}return this[_0x6415('0x33')][_0x6415('0x30')](_0x553b0c,_0x6415('0x14c'));};AGIVertices['prototype'][_0x6415('0x14d')]=function(_0x23adf7){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x23adf7[_0x6415('0x35')]));if(!this['isConfigured'](_0x23adf7['findBy'])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x23adf7,_0x6415('0x14e'));}logger['info'](util['format'](_0x6415('0x14f'),this[_0x6415('0x33')][_0x6415('0x38')],_0x23adf7['findBy']));var _0x4dcd87=this[_0x6415('0x59')][_0x6415('0x77')](this,_0x23adf7['findBy']);if(_0x4dcd87){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x23adf7[_0x6415('0x150')]));this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x23adf7[_0x6415('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0x6415('0x2c')](util[_0x6415('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x23adf7[_0x6415('0x150')]));this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0x151'),this['channel'][_0x6415('0x38')],_0x23adf7[_0x6415('0x150')]));return{'code':0xc8,'result':_0x6415('0x152')};}};AGIVertices[_0x6415('0x14')]['logout']=function(_0x98cbe7){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x153'),_0x98cbe7[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x98cbe7[_0x6415('0x150')])){return this['channel'][_0x6415('0x30')](_0x98cbe7,_0x6415('0x14e'));}logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x14f'),this[_0x6415('0x33')][_0x6415('0x38')],_0x98cbe7[_0x6415('0x150')]));var _0x2fd711=this['agentLogout']['sync'](this,_0x98cbe7[_0x6415('0x150')]);if(_0x2fd711){logger['info'](util[_0x6415('0x29')](_0x6415('0x154'),this[_0x6415('0x33')][_0x6415('0x38')],_0x98cbe7['findBy']));this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x154'),this[_0x6415('0x33')][_0x6415('0x38')],_0x98cbe7['findBy']));return{'code':0xc8,'result':_0x6415('0x155')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x98cbe7['findBy']));this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x98cbe7[_0x6415('0x150')]));return{'code':0xc8,'result':_0x6415('0x152')};}};AGIVertices[_0x6415('0x14')][_0x6415('0x156')]=function(_0x4fd11e){logger['info'](util['format'](_0x6415('0x157'),_0x4fd11e[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x4fd11e[_0x6415('0x158')])){return this[_0x6415('0x33')]['error'](_0x4fd11e,_0x6415('0x159'));}this['channel'][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x15a'),_0x4fd11e[_0x6415('0x158')]));var _0x6366c7=eval(_0x4fd11e['operation']);if(!this[_0x6415('0x88')](_0x4fd11e[_0x6415('0xe3')])){return this['channel']['noop'](_0x6415('0x10b'));}var _0x568dfe=this[_0x6415('0x11')][_0x6415('0x77')](this,_0x4fd11e[_0x6415('0xe3')]);if(!_0x568dfe){return this[_0x6415('0x33')][_0x6415('0x30')](_0x4fd11e,_0x6415('0xe4'));}if(_[_0x6415('0x9e')](_0x6366c7)){var _0x3f853b=this;_0x6366c7[_0x6415('0x15b')](function(_0x36e639,_0x83a41a){_0x3f853b[_0x6415('0x33')][_0x6415('0xa3')](util['format'](_0x6415('0x15c'),_0x568dfe,_0x83a41a),_0x36e639);});return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x15d'),_0x568dfe));}else{return this[_0x6415('0x33')][_0x6415('0xa3')](_0x568dfe,_0x6366c7);}};AGIVertices[_0x6415('0x14')][_0x6415('0xe')]=function(_0x523a3c){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x523a3c[_0x6415('0x35')]));if(_0x523a3c[_0x6415('0xae')]===0x0){return this[_0x6415('0xac')](_0x523a3c);}_0x523a3c[_0x6415('0xae')]-=0x1;if(!this[_0x6415('0x88')](_0x523a3c[_0x6415('0x15e')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x523a3c,_0x6415('0x109'));}var _0x533007=this[_0x6415('0x1f')]['sync'](this,_0x523a3c[_0x6415('0x15e')]);if(!_0x533007){return this[_0x6415('0x33')][_0x6415('0x30')](_0x523a3c,_0x6415('0x10a'));}var _0x32c112=this[_0x6415('0x33')][_0x6415('0x10c')](_0x533007,_0x523a3c['response'],_0x523a3c[_0x6415('0x15f')]);var _0x1d9cc1=_0x32c112[_0x6415('0xb4')];if(_0x32c112['result']===-0x1){this[_0x6415('0xad')][_0x6415('0x77')](this,_0x523a3c,'-1');return _0x32c112;}else if(_0x32c112[_0x6415('0xab')]==='timeout'){_0x32c112[_0x6415('0xb4')]=_0x32c112[_0x6415('0xb4')][_0x6415('0x9f')]>0x0?_0x32c112[_0x6415('0xb4')]:'t';}else if(_[_0x6415('0x4c')](_0x32c112[_0x6415('0xb4')])){_0x32c112['result']='#';_0x1d9cc1='#';}if(!this['isConfigured'](_0x523a3c[_0x6415('0xe3')])){this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x10b'));}else{var _0x2aea18=this[_0x6415('0x11')]['sync'](this,_0x523a3c[_0x6415('0xe3')]);if(!_0x2aea18){return this[_0x6415('0x33')][_0x6415('0x30')](_0x523a3c,_0x6415('0xe4'));}this[_0x6415('0x33')][_0x6415('0xa3')](_0x2aea18,_0x1d9cc1);}this[_0x6415('0xad')][_0x6415('0x77')](this,_0x523a3c,_0x1d9cc1);return _0x32c112;};AGIVertices['prototype']['noop']=function(_0x581073){logger['info'](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x581073[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0xb7')](_0x581073[_0x6415('0x160')]||_0x581073[_0x6415('0x35')]);};AGIVertices[_0x6415('0x14')][_0x6415('0x161')]=function(_0x506023){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x162'),_0x506023['label']));if(!this[_0x6415('0x88')](_0x506023['findBy'])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x506023,'no\x20find\x20by\x20configured');}logger[_0x6415('0x2c')](util[_0x6415('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x6415('0x33')][_0x6415('0x38')],_0x506023[_0x6415('0x150')]));var _0x201d0b=this[_0x6415('0x163')][_0x6415('0x77')](this,_0x506023[_0x6415('0x164')]);var _0x58cac7=this[_0x6415('0x165')]['sync'](this,_0x506023[_0x6415('0x150')],_0x201d0b);if(_0x58cac7){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x154'),this[_0x6415('0x33')][_0x6415('0x38')],_0x506023[_0x6415('0x150')]));this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x506023[_0x6415('0x150')]));return{'code':0xc8,'result':_0x6415('0x155')};}else{logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x151'),this['channel'][_0x6415('0x38')],_0x506023[_0x6415('0x150')]));this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')](_0x6415('0x154'),this[_0x6415('0x33')]['callerid'],_0x506023[_0x6415('0x150')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6415('0x14')][_0x6415('0x166')]=function(_0x384fd6){logger[_0x6415('0x2c')](util['format'](_0x6415('0x167'),_0x384fd6[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x384fd6[_0x6415('0x15e')])){return this[_0x6415('0x33')]['error'](_0x384fd6,_0x6415('0x109'));}var _0x1b012a=this[_0x6415('0x1f')]['sync'](this,_0x384fd6[_0x6415('0x15e')]);if(!_0x1b012a){return this['channel'][_0x6415('0x30')](_0x384fd6,_0x6415('0x10a'));}var _0x4580fa=this['channel']['exec'](_0x6415('0x168'),[_0x1b012a,_0x384fd6[_0x6415('0xec')]]);if(_0x4580fa[_0x6415('0xb4')]===-0x1){return _0x4580fa;}return this['channel'][_0x6415('0xb7')](util['format'](_0x6415('0xcf'),_0x6415('0x168'),_0x1b012a));};AGIVertices[_0x6415('0x14')][_0x6415('0x169')]=function(_0x34159b){logger['info'](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x34159b[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x34159b[_0x6415('0x16a')])){return this['channel'][_0x6415('0x30')](_0x34159b,'no\x20queue\x20selected');}var _0x5b7f0c='';var _0x461ba2=parseInt(_0x34159b['queue_id'],0xa);if(isNaN(_0x461ba2)){_0x5b7f0c=_0x34159b[_0x6415('0x16a')];}else{_0x5b7f0c=this[_0x6415('0x15')]['sync'](this,_0x34159b[_0x6415('0x16a')]);if(!_0x5b7f0c){return this[_0x6415('0x33')]['error'](_0x34159b,_0x6415('0x16b'));}}var _0x814639='';if(this[_0x6415('0x88')](_0x34159b[_0x6415('0x15e')])){var _0x5e1ff4=this[_0x6415('0x1f')][_0x6415('0x77')](this,_0x34159b['file_id']);if(_0x5e1ff4){_0x814639=_0x5e1ff4;}}this['createSquareDetailsReport'][_0x6415('0x77')](this,_0x34159b,_0x5b7f0c);if(_0x34159b[_0x6415('0xec')][_0x6415('0x16c')]('x')<0x0){_0x34159b[_0x6415('0xec')]+='x';}if(_0x34159b['opts'][_0x6415('0x16c')]('X')<0x0){_0x34159b['opts']+='X';}this['channel']['setVariable'](_0x6415('0x16d'),_0x5b7f0c?_0x5b7f0c[_0x6415('0x16e')]():'');var _0x1cf42b=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0x16f'),[_0x5b7f0c,_0x34159b[_0x6415('0xec')],_0x34159b[_0x6415('0x68')],_0x814639,_0x34159b[_0x6415('0x6a')],_0x34159b[_0x6415('0x9')],_0x34159b[_0x6415('0x170')],_0x34159b[_0x6415('0x171')],'',_0x34159b[_0x6415('0x172')]]);if(_0x1cf42b[_0x6415('0xb4')]===-0x1){return _0x1cf42b;}return this['channel']['noop'](util['format'](_0x6415('0xcf'),'QUEUE',_0x5b7f0c));};AGIVertices['prototype'][_0x6415('0x173')]=function(_0xd6e4a){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0xd6e4a[_0x6415('0x35')]));var _0x16b61b=_0xd6e4a[_0x6415('0x174')]||_0x6415('0x128');var _0x1a5bff=util[_0x6415('0x29')]('%s_%s',this['channel'][_0x6415('0x34')],rs[_0x6415('0x111')](0x5));var _0x8086bd=util[_0x6415('0x29')](_0x6415('0x175'),FILES_PATH,_0x1a5bff,_0x16b61b);var _0x286eae=util[_0x6415('0x29')](_0x6415('0x129'),FILES_PATH,_0x1a5bff);this[_0x6415('0x37')][_0x6415('0x77')](this,_0xd6e4a,_0x1a5bff,_0x8086bd);this['channel']['setVariable'](_0x6415('0x176'),_0x1a5bff);logger[_0x6415('0x2c')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x286eae,_0x16b61b,_0xd6e4a[_0x6415('0x177')],_0xd6e4a[_0x6415('0x6a')]);return this[_0x6415('0x33')][_0x6415('0x12c')](_0x286eae,_0x16b61b,_0xd6e4a[_0x6415('0x177')],_0xd6e4a[_0x6415('0x6a')],undefined,!![]);};AGIVertices[_0x6415('0x14')][_0x6415('0x178')]=function(_0x2f9e4c){logger['info'](util[_0x6415('0x29')](_0x6415('0x179'),_0x2f9e4c[_0x6415('0x35')]));if(!this['isConfigured'](_0x2f9e4c['url'])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x17a'));}var _0x9ad662=this[_0x6415('0x67')][_0x6415('0x77')](this,_0x2f9e4c);logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Response:',util[_0x6415('0x17b')](_0x9ad662,{'showHidden':![],'depth':null})));if(!this[_0x6415('0x88')](_0x2f9e4c[_0x6415('0xe3')])){return this['channel']['noop'](_0x6415('0x17c'));}var _0x403ab7=this[_0x6415('0x11')][_0x6415('0x77')](this,_0x2f9e4c['variable_id']);if(!_0x403ab7){return this['channel'][_0x6415('0x30')](_0x2f9e4c,_0x6415('0xe4'));}this[_0x6415('0x33')][_0x6415('0xa3')](util['format']('%s_STATUS_CODE',_0x403ab7),_0x9ad662['statusCode']?_0x9ad662[_0x6415('0x7d')]:'200');this[_0x6415('0x33')]['setVariable'](util['format']('%s_STATUS_MESSAGE',_0x403ab7),_0x9ad662[_0x6415('0x7c')]?_0x9ad662['statusMessage']:'OK');if(_0x9ad662[_0x6415('0x70')]){try{this[_0x6415('0xa1')](_0x9ad662['body'],_0x403ab7);}catch(_0x29d9f4){logger['error'](util[_0x6415('0x29')](_0x6415('0x17d'),_0x403ab7));}}return this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0xe7'),_0x403ab7));};AGIVertices[_0x6415('0x14')][_0x6415('0x17e')]=function(_0x7e2d85){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x17f'),_0x7e2d85[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0x180')](_0x7e2d85[_0x6415('0x181')][_0x6415('0x182')](/\s+/g,''),_0x7e2d85[_0x6415('0x177')]);};AGIVertices['prototype'][_0x6415('0x183')]=function(_0x12027e){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x184'),_0x12027e['label']));return this[_0x6415('0x33')][_0x6415('0x185')](_0x12027e[_0x6415('0x6b')][_0x6415('0x182')](/\s+/g,''),_0x12027e[_0x6415('0x177')]);};AGIVertices[_0x6415('0x14')][_0x6415('0x186')]=function(_0x199f3f){logger['info'](util[_0x6415('0x29')](_0x6415('0x187'),_0x199f3f[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0x188')](_0x199f3f['text'],_0x199f3f['escape_digits']);};AGIVertices[_0x6415('0x14')]['sendMail']=function(_0x522ebb){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x189'),_0x522ebb[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x522ebb[_0x6415('0x18a')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x18b'));}var _0x74b1d4=this['getMailAccount']['sync'](this,_0x522ebb['account_id']);if(!_0x74b1d4||!_0x74b1d4['Smtp']){return this[_0x6415('0x33')][_0x6415('0x30')](_0x522ebb,'no\x20mail\x20account\x20found');}var _0x3d3d12={'from':util[_0x6415('0x29')](_0x6415('0x18c'),_0x74b1d4['name'],_0x74b1d4[_0x6415('0x18d')]||_0x74b1d4[_0x6415('0x18e')]['user']),'to':_0x522ebb['to']||'','cc':_0x522ebb['cc']||'','bcc':_0x522ebb[_0x6415('0x18f')]||'','subject':_0x522ebb[_0x6415('0x190')],'html':_0x522ebb['text'],'text':_0x522ebb[_0x6415('0x66')]};var _0xf2459a={'tls':{'rejectUnauthorized':![]}};if(_0x74b1d4[_0x6415('0x18e')][_0x6415('0x191')]){_0xf2459a[_0x6415('0x191')]=_0x74b1d4['Smtp'][_0x6415('0x191')];}else{_0xf2459a[_0x6415('0x192')]=_0x74b1d4[_0x6415('0x18e')][_0x6415('0x192')];_0xf2459a['port']=_0x74b1d4['Smtp'][_0x6415('0x193')];_0xf2459a[_0x6415('0x194')]=_0x74b1d4['Smtp'][_0x6415('0x194')];}if(_0x74b1d4['Smtp']['authentication']){_0xf2459a['auth']={'user':_0x74b1d4[_0x6415('0x18e')][_0x6415('0x195')],'pass':_0x74b1d4[_0x6415('0x18e')]['pass']};}if(this['isConfigured'](_0x522ebb['template_id'])){}logger[_0x6415('0x196')](_0x6415('0x197'),JSON[_0x6415('0x7a')](_0x3d3d12));this[_0x6415('0xad')][_0x6415('0x77')](this,_0x522ebb,_0x522ebb[_0x6415('0x18a')]);this['channel'][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x198'),_0x74b1d4[_0x6415('0x18')]));this['sendMailMessage'][_0x6415('0x77')](this,_0xf2459a,_0x3d3d12);return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x199'));};AGIVertices[_0x6415('0x14')][_0x6415('0x19a')]=function(_0x3f79e0){logger['info'](util[_0x6415('0x29')](_0x6415('0x19b'),_0x3f79e0[_0x6415('0x35')]));return this[_0x6415('0x33')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0x6415('0x19c')]=function(_0x5f04ca){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x19d'),_0x5f04ca[_0x6415('0x35')]));if(!this['isConfigured'](_0x5f04ca['sms_account_id'])){return this['channel']['noop']('no\x20sms\x20account\x20configured');}var _0x5a820b=this[_0x6415('0x19e')][_0x6415('0x77')](this,_0x5f04ca[_0x6415('0x19f')]);if(!_0x5a820b){return this[_0x6415('0x33')][_0x6415('0x30')](_0x5f04ca,_0x6415('0x1a0'));}var _0xdf9c35={'body':_0x5f04ca[_0x6415('0x1a1')],'phone':_0x5f04ca['to']||'','SmsAccountId':_0x5a820b['id']};logger[_0x6415('0x196')](_0x6415('0x1a2'),JSON['stringify'](_0xdf9c35));this[_0x6415('0xad')][_0x6415('0x77')](this,_0x5f04ca,_0x5f04ca[_0x6415('0x19f')]);this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0x1a3'),_0x5a820b[_0x6415('0x18')]));this[_0x6415('0x32')][_0x6415('0x77')](this,_0xdf9c35);return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x1a4'));};AGIVertices[_0x6415('0x14')][_0x6415('0x1a5')]=function(_0x57e834){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x1a6'),_0x57e834[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x57e834[_0x6415('0xe3')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x57e834,_0x6415('0x1a7'));}var _0x1520e9=this[_0x6415('0x11')]['sync'](this,_0x57e834[_0x6415('0xe3')]);if(!_0x1520e9){return this[_0x6415('0x33')][_0x6415('0x30')](_0x57e834,'no\x20variable\x20found');}return this['channel'][_0x6415('0xa3')](_0x1520e9,_0x57e834[_0x6415('0x1a8')]);};AGIVertices[_0x6415('0x14')][_0x6415('0x1a9')]=function(_0x169222){logger['info'](util[_0x6415('0x29')]('Enter\x20in\x20START\x20(%s)\x20block',_0x169222['label']));this[_0x6415('0x33')]['noop'](_0x6415('0x1aa'));if(_0x169222[_0x6415('0xc3')]==='yes'){this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x1ab'));return this[_0x6415('0x33')][_0x6415('0xc3')]();}return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x1ac'));};AGIVertices[_0x6415('0x14')][_0x6415('0x1ad')]=function(_0x10fc8b){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x1ae'),_0x10fc8b[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x10fc8b['project_id'])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x10fc8b,'no\x20subproject\x20selected');}var _0x2d2032=this['getSquareProject']['sync'](this,_0x10fc8b[_0x6415('0x1af')]);if(!this[_0x6415('0x88')](_0x2d2032)){return this['channel'][_0x6415('0x30')](_0x10fc8b,util[_0x6415('0x29')](_0x6415('0x1b0'),_0x10fc8b[_0x6415('0x1af')]));}if(_0x2d2032===this['channel'][_0x6415('0x1b1')]){return this[_0x6415('0x33')][_0x6415('0x30')](_0x10fc8b,_0x6415('0x1b2'));}this[_0x6415('0xad')][_0x6415('0x77')](this,_0x10fc8b,_0x2d2032);var _0x1c4e36=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0x1b3'),util[_0x6415('0x29')](_0x6415('0x1b4'),config[_0x6415('0x9')][_0x6415('0x192')]||_0x6415('0x1b5'),_0x2d2032,this[_0x6415('0x33')]['arg_1']));if(_0x1c4e36[_0x6415('0xb4')]===-0x1){return _0x1c4e36;}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')]('Executed\x20command\x20%s\x20%s','AGI',_0x2d2032));};AGIVertices[_0x6415('0x14')]['system']=function(_0x1e7b5e){logger[_0x6415('0x2c')](util['format'](_0x6415('0x1b6'),_0x1e7b5e[_0x6415('0x35')]));var _0x2c737a=this[_0x6415('0x5b')]['sync'](this,_0x1e7b5e[_0x6415('0x1b7')]);this[_0x6415('0xad')]['sync'](this,_0x1e7b5e,_0x1e7b5e[_0x6415('0x1b7')]);if(this[_0x6415('0x88')](_0x1e7b5e[_0x6415('0xe3')])){var _0x5f4c1c=this[_0x6415('0x11')]['sync'](this,_0x1e7b5e[_0x6415('0xe3')]);if(_0x5f4c1c){this[_0x6415('0x33')][_0x6415('0xa3')](_0x5f4c1c,_0x2c737a);return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x1b8'),_0x1e7b5e[_0x6415('0x1b7')],_0x5f4c1c));}}return this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0x1b9'),_0x1e7b5e['command']));};AGIVertices[_0x6415('0x14')][_0x6415('0x1ba')]=function(_0x3c9a58){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x1bb'),_0x3c9a58[_0x6415('0x35')]));_0x3c9a58[_0x6415('0x66')]=_0x3c9a58['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6415('0x88')](_0x3c9a58[_0x6415('0x5e')])){return this[_0x6415('0x33')][_0x6415('0xb7')]('no\x20apiKey\x20configured');}if(!this[_0x6415('0x88')](_0x3c9a58[_0x6415('0x66')])){return this['channel'][_0x6415('0xb7')](_0x6415('0xb1'));}this['channel'][_0x6415('0xb7')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x3c9a58['text']));var _0x454595=this[_0x6415('0x5d')][_0x6415('0x77')](this,_0x3c9a58);if(_0x454595){this['channel'][_0x6415('0xb7')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x454595));var _0xa4575=this['channel'][_0x6415('0x11c')](_0x454595);try{fs[_0x6415('0x11d')](_0x454595+_0x6415('0x11e'));}catch(_0x40bca5){logger[_0x6415('0x30')](_0x40bca5);}return _0xa4575;}return this[_0x6415('0x33')]['error'](_0x3c9a58,_0x6415('0x1bc'));};AGIVertices['prototype']['tts']=function(_0x1f806d){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1f806d[_0x6415('0x35')]));_0x1f806d[_0x6415('0x66')]=_0x1f806d[_0x6415('0x66')][_0x6415('0x182')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6415('0x88')](_0x1f806d[_0x6415('0x66')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xb1'));}this['channel']['noop'](util[_0x6415('0x29')]('Trying\x20Google\x20TTS\x20%s',_0x1f806d['text']));var _0x232297=this[_0x6415('0x65')][_0x6415('0x77')](this,_0x1f806d);if(_0x232297){this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x1bd'),_0x232297));var _0x5bb1b6=this[_0x6415('0x33')]['streamFile'](_0x232297);try{fs['unlink'](_0x232297+_0x6415('0x11e'));}catch(_0x1a05b7){logger['error'](_0x1a05b7);}return _0x5bb1b6;}return this[_0x6415('0x33')]['error'](_0x1f806d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6415('0x14')][_0x6415('0x1be')]=function(_0x4b5612){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x1bf'),_0x4b5612['label']));if(!this[_0x6415('0x88')](_0x4b5612[_0x6415('0x150')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x4b5612,_0x6415('0x14e'));}logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x14f'),this[_0x6415('0x33')][_0x6415('0x38')],_0x4b5612['findBy']));var _0x1c8ccb=this[_0x6415('0x57')]['sync'](this,_0x4b5612[_0x6415('0x150')]);if(_0x1c8ccb){logger['info'](util[_0x6415('0x29')](_0x6415('0x154'),this[_0x6415('0x33')][_0x6415('0x38')],_0x4b5612[_0x6415('0x150')]));this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x4b5612['findBy']));return{'code':0xc8,'result':_0x6415('0x155')};}else{logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x151'),this[_0x6415('0x33')][_0x6415('0x38')],_0x4b5612[_0x6415('0x150')]));this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x4b5612[_0x6415('0x150')]));return{'code':0xc8,'result':_0x6415('0x152')};}};AGIVertices[_0x6415('0x14')][_0x6415('0x1c0')]=function(_0x256cea){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x256cea['label']));var _0x162683=this['channel']['exec'](_0x6415('0x1c1'),[_0x256cea[_0x6415('0x1c2')],_0x256cea[_0x6415('0x80')]]);if(_0x162683[_0x6415('0xb4')]===-0x1){return _0x162683;}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xcf'),_0x6415('0x1c1'),_0x256cea[_0x6415('0x1c2')]));};AGIVertices[_0x6415('0x14')]['vswitch']=function(_0x380b44){logger[_0x6415('0x2c')](util['format'](_0x6415('0x1c3'),_0x380b44[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x380b44[_0x6415('0xe3')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x380b44,_0x6415('0x1a7'));}var _0x47e5c2=this[_0x6415('0x11')]['sync'](this,_0x380b44[_0x6415('0xe3')]);if(!_0x47e5c2){return this[_0x6415('0x33')][_0x6415('0x30')](_0x380b44,_0x6415('0xe4'));}var _0x2e7e75=this['channel'][_0x6415('0x11')](_0x47e5c2);return{'code':0xc8,'result':_0x2e7e75[_0x6415('0xab')]?_0x2e7e75[_0x6415('0xab')]:'-'};};String[_0x6415('0x14')][_0x6415('0xa7')]=function(_0xfc2d14,_0x4cd3df){return this[_0x6415('0xa5')](_0xfc2d14)['join'](_0x4cd3df);};module[_0x6415('0x1c4')]=AGIVertices; \ No newline at end of file +var _0x0284=['aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','%s.%s','replaceall\x20init','split','getVariable','extra','replaceall\x20end','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','grammar','noop','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','setVariable','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','false','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','math','no\x20operation\x20configured','operation','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saveRestApiResult','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','bcc','subject','service','host','port','secure','authentication','auth','user','pass','template_id','sendMail\x20message','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','mailRpc','then','name','catch','prototype','getSquareProject','rpc','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSoundById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','arg_1','file','createSquareMessage','createCmContact','in\x20createcmcontact','in\x20createcmcontact\x20callback','isEmpty','isNil','callback_','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','has','dialTimezone','log','VALUE\x20TZ','CALLERID(dialTimezone)','getContactByPhone','phone','utcOffset','minutestoadd','scheduledat\x20before','add','minutes','scheduledat\x20after','insertContact','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','audioEncoding','googleTTS','google_tts_language','url','method','timeout','number','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','stringify','render','statusCode','statusMessage','options','googleDialogflow','dialogflow_language','sestekNDA','ispeechTTS','key','speed','ispeechASR','isConfigured','model','awsPolly'];(function(_0x3b8db4,_0x57a9df){var _0x4ed597=function(_0x3ce5bd){while(--_0x3ce5bd){_0x3b8db4['push'](_0x3b8db4['shift']());}};_0x4ed597(++_0x57a9df);}(_0x0284,0x14f));var _0x4028=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x0284[_0x28f32c];return _0x355402;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x4028('0x0'));var _=require(_0x4028('0x1'));var sh=require(_0x4028('0x2'));var odbc=require(_0x4028('0x3'))();var rs=require(_0x4028('0x4'));var moment=require(_0x4028('0x5'));var Mustache=require(_0x4028('0x6'));var rp=require(_0x4028('0x7'));var logger=require(_0x4028('0x8'))(_0x4028('0x9'));var config=require(_0x4028('0xa'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0x4028('0xb');var recursiveMapAttributes=[_0x4028('0xc'),_0x4028('0xd')];var verticesWithRetry=[_0x4028('0xe'),_0x4028('0xf'),'getsecretdigits'];var AGIVertices=function(_0x541de5,_0x5e1cd8,_0xbdb688){this['channel']=_0x541de5;this['rpc']=_0x5e1cd8;this[_0x4028('0x10')]=_0xbdb688;};AGIVertices['prototype']['getVariable']=function(_0x251fab,_0x1276de){this['rpc']['getVariableById'](_0x251fab)[_0x4028('0x11')](function(_0x31893f){_0x1276de(null,_0x31893f?_0x31893f[_0x4028('0x12')]:![]);})[_0x4028('0x13')](function(_0x555118){_0x1276de(_0x555118);});};AGIVertices[_0x4028('0x14')]['getVoiceQueue']=function(_0x3560c4,_0x357724){this['rpc']['getVoiceQueueById'](_0x3560c4)[_0x4028('0x11')](function(_0x313368){_0x357724(null,_0x313368?_0x313368[_0x4028('0x12')]:![]);})[_0x4028('0x13')](function(_0x1ff126){_0x357724(_0x1ff126);});};AGIVertices[_0x4028('0x14')][_0x4028('0x15')]=function(_0x4adde4,_0x2696da){this[_0x4028('0x16')][_0x4028('0x17')](_0x4adde4)[_0x4028('0x11')](function(_0x39170a){_0x2696da(null,_0x39170a?_0x39170a[_0x4028('0x12')]:![]);})[_0x4028('0x13')](function(_0x1d63d5){_0x2696da(_0x1d63d5);});};AGIVertices[_0x4028('0x14')][_0x4028('0x18')]=function(_0x4f0c89,_0x558518){this['rpc'][_0x4028('0x19')](_0x4f0c89)[_0x4028('0x11')](function(_0x409ce1){_0x558518(null,_0x409ce1?_0x409ce1['dsn']:![]);})['catch'](function(_0x1e6388){_0x558518(_0x1e6388);});};AGIVertices[_0x4028('0x14')][_0x4028('0x1a')]=function(_0xbc445d,_0x124f33){this['rpc'][_0x4028('0x1b')](_0xbc445d)[_0x4028('0x11')](function(_0x43f796){_0x124f33(null,_0x43f796?_0x43f796[_0x4028('0x12')]:![]);})[_0x4028('0x13')](function(_0x15c7a9){_0x124f33(_0x15c7a9);});};AGIVertices[_0x4028('0x14')][_0x4028('0x1c')]=function(_0xa78d97,_0x429e14){this[_0x4028('0x16')][_0x4028('0x1d')](_0xa78d97)[_0x4028('0x11')](function(_0x3069e4){_0x429e14(null,_0x3069e4?_0x3069e4[_0x4028('0x12')]:![]);})[_0x4028('0x13')](function(_0x371dda){_0x429e14(_0x371dda);});};AGIVertices[_0x4028('0x14')]['getSound']=function(_0x468363,_0x5a22eb){var _0xcf8b45=this;this[_0x4028('0x16')][_0x4028('0x1e')](_0x468363)[_0x4028('0x11')](function(_0x4030ed){_0x5a22eb(null,_0x4030ed?_0xcf8b45['getSoundPath'](_0x4030ed['save_name']):![]);})[_0x4028('0x13')](function(_0x1763c6){_0x5a22eb(_0x1763c6);});};AGIVertices[_0x4028('0x14')]['getMailAccount']=function(_0x44f723,_0x238c75){this['rpc']['getMailAccountById'](_0x44f723)[_0x4028('0x11')](function(_0x1da132){_0x238c75(null,_0x1da132?_0x1da132:![]);})[_0x4028('0x13')](function(_0x582d9e){_0x238c75(_0x582d9e);});};AGIVertices['prototype'][_0x4028('0x1f')]=function(_0x29954d,_0x221b69,_0x304846){this['mailRpc']['sendMailMessage'](_0x29954d,_0x221b69)[_0x4028('0x11')](function(){_0x304846(null);})[_0x4028('0x13')](function(_0x3be6bc){_0x304846(_0x3be6bc);});};AGIVertices['prototype']['getIntervals']=function(_0x25efae,_0x491cc6){this['rpc'][_0x4028('0x20')](_0x25efae)[_0x4028('0x11')](function(_0x510ef5){if(_0x510ef5){if(_0x510ef5[_0x4028('0x21')]){_0x491cc6(null,[_0x510ef5[_0x4028('0x22')]]);}else{_0x491cc6(null,_[_0x4028('0x23')](_0x510ef5[_0x4028('0x24')],'interval'));}}else{_0x491cc6(null,![]);}})['catch'](function(_0x219e36){_0x491cc6(_0x219e36);});};AGIVertices['prototype'][_0x4028('0x25')]=function(_0x2bd8b2){return util[_0x4028('0x26')](_0x4028('0x27'),FILES_PATH,_0x2bd8b2);};AGIVertices[_0x4028('0x14')][_0x4028('0x28')]=function(_0x2f1019,_0xd2a631,_0x27ef7e){odbc[_0x4028('0x29')](_0x2f1019,function(_0x5c5970){if(_0x5c5970){logger[_0x4028('0x2a')](_0x4028('0x2b'),_0x5c5970);_0x27ef7e(_0x5c5970);}else{logger[_0x4028('0x2c')](_0x4028('0x2d'));odbc['query'](_0xd2a631,function(_0x563d42,_0x4a501d){if(_0x563d42){logger[_0x4028('0x2c')](_0x4028('0x2e'),_0xd2a631);_0x27ef7e(_0x563d42);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0xd2a631);odbc['close'](function(_0x52affd){if(_0x52affd){logger[_0x4028('0x2a')](_0x4028('0x2f'),_0x52affd);}_0x27ef7e(null,_0x4a501d);});}});}});};AGIVertices[_0x4028('0x14')][_0x4028('0x30')]=function(_0x48e508,_0x15906b){this[_0x4028('0x16')][_0x4028('0x31')](_0x48e508)[_0x4028('0x11')](function(_0x45a301){_0x15906b(null,_0x45a301?_0x45a301:![]);})['catch'](function(_0x2e3471){_0x15906b(_0x2e3471);});};AGIVertices[_0x4028('0x14')]['createSmsMessage']=function(_0x18efda,_0x3404e3){this['rpc'][_0x4028('0x32')](_0x18efda)[_0x4028('0x11')](function(_0x1db4c3){_0x3404e3(null,_0x1db4c3);})[_0x4028('0x13')](function(_0x55ec4e){_0x3404e3(_0x55ec4e);});};AGIVertices[_0x4028('0x14')][_0x4028('0x33')]=function(_0xe7f721,_0x4a9f82,_0x2d2803){this[_0x4028('0x16')][_0x4028('0x33')]({'uniqueid':this[_0x4028('0x34')][_0x4028('0x35')],'node':_0xe7f721[_0x4028('0x36')],'application':_0xe7f721[_0x4028('0x37')],'data':_0x4a9f82||null,'project_name':this[_0x4028('0x34')]['arg_1'],'callerid':this[_0x4028('0x34')][_0x4028('0x38')]})['then'](function(_0x25b8a0){if(_0x2d2803){_0x2d2803(null,_0x25b8a0);}})[_0x4028('0x13')](function(_0x1c109b){if(_0x2d2803){_0x2d2803(_0x1c109b);}});};AGIVertices['prototype'][_0x4028('0x39')]=function(_0x1a11af,_0x144ed5,_0x40d535,_0x4f2ca3){this[_0x4028('0x16')][_0x4028('0x39')]({'uniqueid':this[_0x4028('0x34')][_0x4028('0x35')],'callerid':this[_0x4028('0x34')]['callerid'],'calleridname':this[_0x4028('0x34')][_0x4028('0x3a')],'context':this[_0x4028('0x34')][_0x4028('0x3b')],'extension':this[_0x4028('0x34')][_0x4028('0x3c')],'priority':this[_0x4028('0x34')][_0x4028('0x3d')],'accountcode':this[_0x4028('0x34')]['accountcode'],'dnid':this[_0x4028('0x34')][_0x4028('0x3e')],'projectName':this['channel'][_0x4028('0x3f')],'saveName':_0x144ed5,'filename':_0x1a11af[_0x4028('0x40')]||_0x144ed5,'savePath':_0x40d535})[_0x4028('0x11')](function(_0x595aa4){_0x4f2ca3(null,_0x595aa4);})[_0x4028('0x13')](function(_0x27f357){_0x4f2ca3(_0x27f357);});};AGIVertices[_0x4028('0x14')]['createSquareMessage']=function(_0xb2ec71,_0x149283,_0x40fa31){this['rpc'][_0x4028('0x41')]({'uniqueid':this[_0x4028('0x34')]['uniqueid'],'body':_0xb2ec71,'direction':_0x149283})[_0x4028('0x11')](function(_0xc23708){if(_0x40fa31){_0x40fa31(null,_0xc23708);}})[_0x4028('0x13')](function(_0x3aeac6){if(_0x40fa31){_0x40fa31(_0x3aeac6);}});};AGIVertices[_0x4028('0x14')][_0x4028('0x42')]=function(_0x5addc0,_0x245a1e){console['log'](_0x4028('0x43'),_0x5addc0);console['log'](_0x4028('0x44'),_0x245a1e);var _0x2f909a=0x0;var _0x3ebe9a={'firstName':_[_0x4028('0x45')](_0x5addc0['name'])||_[_0x4028('0x46')](_0x5addc0[_0x4028('0x12')])?_0x4028('0x47')+Math['random']():_0x5addc0[_0x4028('0x12')],'lastName':_[_0x4028('0x45')](_0x5addc0[_0x4028('0x48')])||_[_0x4028('0x46')](_0x5addc0['lastName'])?null:_0x5addc0[_0x4028('0x48')],'phone':_0x5addc0['phone'],'ListId':_0x5addc0['list_id'],'scheduledat':_0x5addc0[_0x4028('0x49')],'callbackUniqueid':this[_0x4028('0x34')][_0x4028('0x35')],'tags':_0x4028('0x4a'),'description':_0x4028('0x4b')+_0x5addc0['scheduledAt'][_0x4028('0x4c')](),'priority':_0x5addc0[_0x4028('0x4d')]};if(_[_0x4028('0x4e')](_0x5addc0,_0x4028('0x4f'))){if(!_[_0x4028('0x46')](_0x5addc0['dialTimezone'])){var _0x281110=_0x5addc0[_0x4028('0x4f')];console[_0x4028('0x50')](_0x4028('0x51'),_0x281110);if(_0x5addc0['dialTimezone']==_0x4028('0x52')){this[_0x4028('0x16')][_0x4028('0x53')]({'phone':_0x5addc0[_0x4028('0x54')]})[_0x4028('0x11')](function(_0x4cd0cb){console[_0x4028('0x50')]('RES1',_0x4cd0cb);var _0x1c6dc4=_0x4cd0cb[_0x4028('0x4f')];console[_0x4028('0x50')]('dialtimezone',_0x1c6dc4);if(!_[_0x4028('0x46')](_0x1c6dc4)){var _0x17b053=shared[_0x1c6dc4];console[_0x4028('0x50')]('tz',_0x17b053);if(!_[_0x4028('0x46')](_0x17b053)){var _0x41ac40=-0x1*_0x17b053[_0x4028('0x55')];console[_0x4028('0x50')](_0x4028('0x56'),_0x41ac40);console['log'](_0x4028('0x57'),_0x3ebe9a[_0x4028('0x49')]);_0x3ebe9a[_0x4028('0x49')]=moment(_0x5addc0[_0x4028('0x49')])[_0x4028('0x58')](_0x41ac40,_0x4028('0x59'));console['log'](_0x4028('0x5a'),_0x3ebe9a['scheduledAt']);this[_0x4028('0x16')][_0x4028('0x5b')](_0x3ebe9a,_0x5addc0,_0x245a1e)['then'](function(_0x5bc8c5){_0x245a1e(null,_0x5bc8c5);})[_0x4028('0x13')](function(_0x197dc1){_0x245a1e(_0x197dc1);});}else{this[_0x4028('0x16')][_0x4028('0x5b')](_0x3ebe9a,_0x5addc0,_0x245a1e)[_0x4028('0x11')](function(_0x41f5a9){_0x245a1e(null,_0x41f5a9);})['catch'](function(_0x2131b1){_0x245a1e(_0x2131b1);});}}else{this[_0x4028('0x16')][_0x4028('0x5b')](_0x3ebe9a,_0x5addc0,_0x245a1e)[_0x4028('0x11')](function(_0x30346f){_0x245a1e(null,_0x30346f);})[_0x4028('0x13')](function(_0x2b46ad){_0x245a1e(_0x2b46ad);});}});}else{var _0x2f909a=shared[_0x281110];if(!_[_0x4028('0x46')](_0x2f909a)){var _0xbbf0fe=-0x1*_0x2f909a[_0x4028('0x55')];_0x3ebe9a['scheduledAt']=moment(_0x5addc0[_0x4028('0x49')])[_0x4028('0x58')](_0xbbf0fe,_0x4028('0x59'));this[_0x4028('0x16')][_0x4028('0x5b')](_0x3ebe9a,_0x5addc0,_0x245a1e)[_0x4028('0x11')](function(_0x53b478){_0x245a1e(null,_0x53b478);})[_0x4028('0x13')](function(_0x48d861){_0x245a1e(_0x48d861);});}else{this[_0x4028('0x16')]['insertContact'](_0x3ebe9a,_0x5addc0,_0x245a1e)[_0x4028('0x11')](function(_0x97bb72){_0x245a1e(null,_0x97bb72);})['catch'](function(_0x33d039){_0x245a1e(_0x33d039);});}}}else{this[_0x4028('0x16')][_0x4028('0x5b')](_0x3ebe9a,_0x5addc0,_0x245a1e)[_0x4028('0x11')](function(_0x1df7d9){_0x245a1e(null,_0x1df7d9);})[_0x4028('0x13')](function(_0x815dea){_0x245a1e(_0x815dea);});}}else{this[_0x4028('0x16')][_0x4028('0x5b')](_0x3ebe9a,_0x5addc0,_0x245a1e)[_0x4028('0x11')](function(_0x48e306){_0x245a1e(null,_0x48e306);})[_0x4028('0x13')](function(_0x40e276){_0x245a1e(_0x40e276);});}};AGIVertices['prototype']['insertContact']=function(_0x1744e6,_0x44d2e8,_0x33df99){this['rpc'][_0x4028('0x42')](_0x1744e6)[_0x4028('0x11')](function(_0x50f8e7){_0x33df99(null,_0x50f8e7);})[_0x4028('0x13')](function(_0x256c29){_0x33df99(_0x256c29);});};AGIVertices[_0x4028('0x14')][_0x4028('0x5c')]=function(_0x140406,_0x54b253){this['rpc'][_0x4028('0x5d')](_0x140406)[_0x4028('0x11')](function(_0x4a5953){_0x54b253(null,_0x4a5953?_0x4a5953[_0x4028('0x12')]:![]);})['catch'](function(_0xbdc870){_0x54b253(_0xbdc870);});};AGIVertices[_0x4028('0x14')][_0x4028('0x5e')]=function(_0x1b4ece,_0x50e89a,_0x1bcfa8){var _0x1da502={'role':_0x4028('0x5f')};_0x1da502[_0x1b4ece]=this['channel']['callerid'];this[_0x4028('0x16')][_0x4028('0x5e')](_0x1da502,_0x50e89a,this['channel']['uniqueid'])[_0x4028('0x11')](function(_0x4b9a92){_0x1bcfa8(null,_[_0x4028('0x46')](_0x4b9a92)?![]:!![]);})[_0x4028('0x13')](function(_0x13b5a6){logger['error'](_0x13b5a6);_0x1bcfa8(null,![]);});};AGIVertices[_0x4028('0x14')][_0x4028('0x60')]=function(_0x505406,_0x24f8e6){var _0x14a448={'role':_0x4028('0x5f')};_0x14a448[_0x505406]=this['channel']['callerid'];this[_0x4028('0x16')]['agentUnpause'](_0x14a448)['then'](function(_0x5b2390){_0x24f8e6(null,_[_0x4028('0x46')](_0x5b2390)?![]:!![]);})['catch'](function(_0x2dbc59){logger['error'](_0x2dbc59);_0x24f8e6(null,![]);});};AGIVertices[_0x4028('0x14')]['agentLogout']=function(_0x2c290e,_0x11c414){var _0x5e2c3f={'role':_0x4028('0x5f')};_0x5e2c3f[_0x2c290e]=this[_0x4028('0x34')]['callerid'];this[_0x4028('0x16')][_0x4028('0x61')](_0x5e2c3f)['then'](function(_0x52e823){_0x11c414(null,_[_0x4028('0x46')](_0x52e823)?![]:!![]);})['catch'](function(_0x89e5ba){logger['error'](_0x89e5ba);_0x11c414(null,![]);});};AGIVertices[_0x4028('0x14')][_0x4028('0x62')]=function(_0x5eb955,_0x44d126){var _0x322a51={'role':_0x4028('0x5f')};_0x322a51[_0x5eb955]=this[_0x4028('0x34')][_0x4028('0x38')];var _0x500900=_0x5eb955!=_0x4028('0x63')?util[_0x4028('0x26')](_0x4028('0x64'),_0x4028('0x65'),this[_0x4028('0x34')][_0x4028('0x38')]):undefined;this['rpc'][_0x4028('0x62')](_0x322a51,_0x500900)[_0x4028('0x11')](function(_0x215edb){_0x44d126(null,_[_0x4028('0x46')](_0x215edb)?![]:!![]);})[_0x4028('0x13')](function(_0x5504b0){logger[_0x4028('0x2a')](_0x5504b0);_0x44d126(null,![]);});};AGIVertices[_0x4028('0x14')]['shellCommand']=function(_0x10dbc4,_0x3bbf2b){sh['exec'](_[_0x4028('0x66')](_0x10dbc4),function(_0x332876,_0x474c6b){var _0x31eea2=_0x474c6b[_0x4028('0x67')](/(\r\n|\n|\r)/gm,'');_0x3bbf2b(null,_0x31eea2);});};AGIVertices['prototype'][_0x4028('0x68')]=function(_0x2fada5,_0x521582){scripts[_0x4028('0x68')](_0x2fada5[_0x4028('0x69')],_0x2fada5[_0x4028('0x6a')]||'text',_0x2fada5[_0x4028('0x6b')],_0x2fada5['languageCode']||_0x4028('0x6c'),_0x2fada5[_0x4028('0x6d')]||'MALE',_0x2fada5[_0x4028('0x6e')]||'MP3')['then'](function(_0x4111c4){_0x521582(null,_0x4111c4);})[_0x4028('0x13')](function(_0x39466c){_0x521582(_0x39466c);});};AGIVertices[_0x4028('0x14')][_0x4028('0x6f')]=function(_0x328bfc,_0x402347){scripts['googleTTS'](_0x328bfc[_0x4028('0x6b')],_0x328bfc[_0x4028('0x70')]||'en',0x1)['then'](function(_0x334877){_0x402347(null,_0x334877);})[_0x4028('0x13')](function(_0x1443cb){_0x402347(_0x1443cb);});};AGIVertices[_0x4028('0x14')]['restAPI']=function(_0xa41004,_0x305051){var _0x49517a={'uri':_0xa41004[_0x4028('0x71')],'method':_0xa41004[_0x4028('0x72')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xa41004[_0x4028('0x73')])===_0x4028('0x74')&&parseInt(_0xa41004[_0x4028('0x73')])>=0x1?parseInt(_0xa41004[_0x4028('0x73')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x4028('0x75'),_0x4028('0x76')],_0x49517a[_0x4028('0x72')][_0x4028('0x77')]())){try{_0x49517a[_0x4028('0x78')]=_0xa41004[_0x4028('0xd')]?JSON[_0x4028('0x79')](_0xa41004['rawBody']):{};}catch(_0x47583a){logger[_0x4028('0x2a')](_0x4028('0x7a'),_0x47583a);}}try{_0x49517a['headers']=_0xa41004[_0x4028('0xc')]?JSON['parse'](_0xa41004['rawHeaders']):{};}catch(_0x522a4a){logger[_0x4028('0x2a')](_0x4028('0x7b'),_0x522a4a);}if(_0xa41004[_0x4028('0x7c')]){try{var _0x58651b=require(_0xa41004['computedVariables'])[_0x4028('0x7d')](this,_0x49517a);_0x49517a[_0x4028('0x7e')]=Mustache['render'](_0xa41004[_0x4028('0x71')],_0x58651b,{},['$$','$$']);if(_0x49517a[_0x4028('0x7f')]){_0x49517a[_0x4028('0x7f')]=JSON[_0x4028('0x79')](Mustache['render'](JSON[_0x4028('0x80')](_0x49517a[_0x4028('0x7f')]),_0x58651b,{},['$$','$$']));}if(_0x49517a['body']){_0x49517a['body']=JSON[_0x4028('0x79')](Mustache[_0x4028('0x81')](JSON[_0x4028('0x80')](_0x49517a[_0x4028('0x78')]),_0x58651b,{},['$$','$$']));}}catch(_0x252fda){logger[_0x4028('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x252fda);}}rp(_0x49517a)[_0x4028('0x11')](function(_0x153bd9){var _0x41e01f={'statusCode':_0x153bd9[_0x4028('0x82')]||0xc8,'statusMessage':_0x153bd9[_0x4028('0x83')]||'OK','headers':_0x153bd9[_0x4028('0x7f')]||{},'body':_0x153bd9['body']||{}};_0x305051(null,_0x41e01f);})['catch'](function(_0x31b664){var _0x4dfeca={'statusCode':_0x31b664[_0x4028('0x82')]||0x1f4,'statusMessage':_0x31b664['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x31b664['options'][_0x4028('0x7f')]||{},'body':_0x31b664[_0x4028('0x84')][_0x4028('0x78')]||{}};_0x305051(null,_0x4dfeca);});};AGIVertices[_0x4028('0x14')][_0x4028('0x85')]=function(_0xaa48da,_0x4d71bc){scripts['googleDialogflow'](this['channel'][_0x4028('0x35')],_0xaa48da['key'],_0xaa48da['text'],_0xaa48da[_0x4028('0x86')]||'en')[_0x4028('0x11')](function(_0x15628e){_0x4d71bc(null,_0x15628e);})['catch'](function(_0x21ec13){_0x4d71bc(_0x21ec13);});};AGIVertices[_0x4028('0x14')][_0x4028('0x87')]=function(_0x4028c0,_0x34fb20){scripts[_0x4028('0x87')](this[_0x4028('0x34')],_0x4028c0)['then'](function(_0x1339df){_0x34fb20(null,_0x1339df);})[_0x4028('0x13')](function(_0xba08ab){_0x34fb20(_0xba08ab);});};AGIVertices['prototype'][_0x4028('0x88')]=function(_0x30f2c7,_0x16dc70){scripts[_0x4028('0x88')](_0x30f2c7[_0x4028('0x89')],_0x30f2c7[_0x4028('0x6b')],_0x30f2c7['ispeech_tts_language']||'en-US',_0x30f2c7[_0x4028('0x8a')])[_0x4028('0x11')](function(_0x16ef40){_0x16dc70(null,_0x16ef40);})[_0x4028('0x13')](function(_0x44ef6c){_0x16dc70(_0x44ef6c);});};AGIVertices[_0x4028('0x14')][_0x4028('0x8b')]=function(_0x3a21ae,_0x1ae3f0,_0x4aeb67){scripts[_0x4028('0x8b')](_0x1ae3f0,_0x3a21ae[_0x4028('0x89')],_0x3a21ae['ispeech_asr_language']||_0x4028('0x6c'),this[_0x4028('0x8c')](_0x3a21ae[_0x4028('0x8d')])?_0x3a21ae[_0x4028('0x8d')]:undefined)[_0x4028('0x11')](function(_0x42a846){_0x4aeb67(null,_0x42a846);})['catch'](function(_0x5d5044){_0x4aeb67(_0x5d5044);});};AGIVertices[_0x4028('0x14')]['awsPolly']=function(_0x22c6e8,_0x40c19d){scripts[_0x4028('0x8e')](_0x22c6e8[_0x4028('0x8f')],_0x22c6e8[_0x4028('0x90')],_0x22c6e8[_0x4028('0x91')],_0x22c6e8[_0x4028('0x92')]||_0x4028('0x93'),_0x22c6e8[_0x4028('0x6b')],_0x22c6e8[_0x4028('0x94')]||_0x4028('0x6b'))[_0x4028('0x11')](function(_0x275231){_0x40c19d(null,_0x275231);})[_0x4028('0x13')](function(_0x35a9ae){_0x40c19d(_0x35a9ae);});};AGIVertices[_0x4028('0x14')][_0x4028('0x95')]=function(_0xbe054f,_0x4560f5){scripts[_0x4028('0x95')](this[_0x4028('0x34')][_0x4028('0x35')],_0xbe054f['aws_access_key_id'],_0xbe054f['aws_secret_access_key'],_0xbe054f['aws_lex_region'],_0xbe054f['text'],_0xbe054f[_0x4028('0x96')])[_0x4028('0x11')](function(_0x318936){_0x4560f5(null,_0x318936);})[_0x4028('0x13')](function(_0x10b17f){_0x4560f5(_0x10b17f);});};AGIVertices[_0x4028('0x14')][_0x4028('0x97')]=function(_0x47db04,_0x2ec481,_0x4985a6){scripts[_0x4028('0x97')](_0x2ec481,_0x47db04[_0x4028('0x89')],_0x47db04[_0x4028('0x98')]||_0x4028('0x6c'))[_0x4028('0x11')](function(_0x391b6d){_0x4985a6(null,_0x391b6d);})[_0x4028('0x13')](function(_0x102a9d){_0x4985a6(_0x102a9d);});};AGIVertices[_0x4028('0x14')]['tildeASR']=function(_0x18ddfa,_0x191fa9,_0x39dc49){scripts[_0x4028('0x99')](_0x191fa9,_0x18ddfa[_0x4028('0x9a')],_0x18ddfa[_0x4028('0x9b')],_0x18ddfa['uri'])[_0x4028('0x11')](function(_0x477327){_0x39dc49(null,_0x477327);})['catch'](function(_0x48458e){_0x39dc49(_0x48458e);});};AGIVertices['prototype'][_0x4028('0x9c')]=function(_0x24d572){var _0x5235fb=_[_0x4028('0x9d')](verticesWithRetry,_0x24d572[_0x4028('0x37')])?_0x24d572:_[_0x4028('0x9e')](_0x24d572);for(var _0xbcd60a in _0x5235fb){if(_0x5235fb[_0x4028('0x9f')](_0xbcd60a)){if(_0x5235fb[_0xbcd60a]&&_['isString'](_0x5235fb[_0xbcd60a])){if(_[_0x4028('0x9d')](recursiveMapAttributes,_0xbcd60a)){_0x5235fb[_0xbcd60a]=this[_0x4028('0xa0')](_0x5235fb[_0xbcd60a]);}else{_0x5235fb[_0xbcd60a]=this[_0x4028('0xa1')](_0x5235fb[_0xbcd60a]);}}}}return _0x5235fb;};AGIVertices[_0x4028('0x14')][_0x4028('0xa2')]=function(_0x136014){for(var _0x537adf in _0x136014){if(_0x136014[_0x4028('0x9f')](_0x537adf)){if(_[_0x4028('0xa3')](_0x136014[_0x537adf])){this[_0x4028('0xa2')](_0x136014[_0x537adf]);}else if(_[_0x4028('0xa4')](_0x136014[_0x537adf])){for(var _0x1744a2=0x0;_0x1744a2<_0x136014[_0x537adf][_0x4028('0xa5')];_0x1744a2++){this[_0x4028('0xa2')](_0x136014[_0x537adf][_0x1744a2]);}}else if(_[_0x4028('0xa6')](_0x136014[_0x537adf])){_0x136014[_0x537adf]=this[_0x4028('0xa1')](_0x136014[_0x537adf]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x38c9f4,_0x3413ef){for(var _0x4de204 in _0x38c9f4){if(_0x38c9f4[_0x4028('0x9f')](_0x4de204)){if(_['isPlainObject'](_0x38c9f4[_0x4de204])){if(!_[_0x4028('0x45')](_0x38c9f4[_0x4de204])){this['saveRestApiResult'](_0x38c9f4[_0x4de204],util[_0x4028('0x26')](_0x4028('0xa7'),_0x3413ef,_0x4de204));}}else if(_[_0x4028('0xa4')](_0x38c9f4[_0x4de204])){for(var _0x3b36d8=0x0;_0x3b36d8<_0x38c9f4[_0x4de204]['length'];_0x3b36d8++){this['saveRestApiResult'](_0x38c9f4[_0x4de204][_0x3b36d8],util[_0x4028('0x26')](_0x4028('0xa7'),_0x3413ef,_0x4de204+'['+_0x3b36d8+']'));}}else{if(!_[_0x4028('0x46')](_0x38c9f4[_0x4de204])){this['channel']['setVariable'](util[_0x4028('0x26')](_0x4028('0xa7'),_0x3413ef,_0x4de204),_0x38c9f4[_0x4de204]);}}}}};AGIVertices[_0x4028('0x14')][_0x4028('0xa0')]=function(_0x2c2306){try{var _0x3d6bc2=JSON['parse'](_0x2c2306);this[_0x4028('0xa2')](_0x3d6bc2);return JSON[_0x4028('0x80')](_0x3d6bc2);}catch(_0x46cc24){return this[_0x4028('0xa1')](_0x2c2306);}};AGIVertices['prototype'][_0x4028('0xa1')]=function(_0x5ed059){console[_0x4028('0x50')](_0x4028('0xa8'),_0x5ed059);var _0x31a6d3=_0x5ed059[_0x4028('0xa9')]('{');for(var _0x20146b=0x1;_0x20146b<_0x31a6d3['length'];_0x20146b+=0x1){var _0x113e97=_0x31a6d3[_0x20146b][_0x4028('0xa9')]('}');console[_0x4028('0x50')]('nextbracket',_0x113e97);if(_0x113e97[_0x4028('0xa5')]>0x1){_0x5ed059=_0x5ed059['replaceAll']('{'+_0x113e97[0x0]+'}',this[_0x4028('0x34')][_0x4028('0xaa')](_0x113e97[0x0])[_0x4028('0xab')]||_0x113e97[0x0]);}}if(_0x31a6d3['length']===0x1){return _0x5ed059['toString']();}console[_0x4028('0x50')](_0x4028('0xac'),_0x5ed059);return this['replaceAllVariables'](_0x5ed059);};AGIVertices[_0x4028('0x14')]['getAndSetVariable']=function(_0x6d7e3e,_0x457d24){var _0x480a47=this[_0x4028('0x34')]['getVariable'](_0x6d7e3e);if(_0x480a47[_0x4028('0xad')]===-0x1){return _0x480a47;}logger[_0x4028('0x2c')](util['format'](_0x4028('0xae'),_0x457d24,_0x480a47[_0x4028('0xab')]));return this['channel']['setVariable'](_0x457d24,_0x480a47[_0x4028('0xab')]);};AGIVertices[_0x4028('0x14')][_0x4028('0x8c')]=function(_0x72cb17){return _0x72cb17&&_0x72cb17!=='0'&&_0x72cb17!=='-1'&&_0x72cb17!=='';};AGIVertices[_0x4028('0x14')][_0x4028('0xaf')]=function(_0x190557){this[_0x4028('0x33')][_0x4028('0x7d')](this,_0x190557,'-');_0x190557['retry']=_0x190557['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4028('0x14')][_0x4028('0xb0')]=function(_0x555df4){logger[_0x4028('0x2c')](util['format'](_0x4028('0xb1'),_0x555df4[_0x4028('0x36')]));if(!this['isConfigured'](_0x555df4[_0x4028('0x6b')])){return this[_0x4028('0x34')]['noop']('no\x20text\x20configured');}var _0x18c9ce='\x22'+_0x555df4[_0x4028('0x6b')]+'\x22';if(this[_0x4028('0x8c')](_0x555df4[_0x4028('0x84')])){_0x18c9ce+=','+_0x555df4[_0x4028('0x84')];}var _0x4cf1af=this[_0x4028('0x34')][_0x4028('0xb2')](_0x4028('0xb3'),_0x18c9ce);if(_0x4cf1af[_0x4028('0xad')]===-0x1){return _0x4cf1af;}return this[_0x4028('0x34')]['noop'](util['format'](_0x4028('0xb4'),_0x18c9ce));};AGIVertices[_0x4028('0x14')]['mrcprecog']=function(_0x4f9600){logger[_0x4028('0x2c')](util[_0x4028('0x26')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4f9600['label']));if(!this[_0x4028('0x8c')](_0x4f9600[_0x4028('0xb5')])){return this[_0x4028('0x34')][_0x4028('0xb6')]('no\x20grammar\x20configured');}var _0x4ca102=_0x4f9600[_0x4028('0xb5')];if(this[_0x4028('0x8c')](_0x4f9600[_0x4028('0x84')])){_0x4ca102+=','+_0x4f9600[_0x4028('0x84')];}var _0x6d70c0=this[_0x4028('0x34')]['exec']('MRCPRecog',_0x4ca102);if(_0x6d70c0[_0x4028('0xad')]===-0x1){return _0x6d70c0;}var _0x29c31e=this[_0x4028('0xb7')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x29c31e[_0x4028('0xad')]===-0x1){return _0x29c31e;}var _0xf8b878=this[_0x4028('0xb7')](_0x4028('0xb8'),_0x4028('0xb9'));if(_0xf8b878[_0x4028('0xad')]===-0x1){return _0xf8b878;}var _0x17dfdb=this[_0x4028('0xb7')](_0x4028('0xba'),_0x4028('0xbb'));if(_0x17dfdb['result']===-0x1){return _0x17dfdb;}return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xbc'),_0x4ca102));};AGIVertices[_0x4028('0x14')][_0x4028('0x9')]=function(_0x5f3999){logger['info'](util['format'](_0x4028('0xbd'),_0x5f3999[_0x4028('0x36')]));return this['channel'][_0x4028('0x9')]([_0x5f3999[_0x4028('0xbe')],_0x5f3999['args']]);};AGIVertices[_0x4028('0x14')][_0x4028('0xbf')]=function(_0x1b8364){logger['info'](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x1b8364[_0x4028('0x36')]));if(this[_0x4028('0x8c')](_0x1b8364[_0x4028('0x73')])){logger['info'](util[_0x4028('0x26')](_0x4028('0xc0'),_0x1b8364[_0x4028('0x73')]));var _0x1b9689=this['channel'][_0x4028('0xc1')](_0x1b8364[_0x4028('0x73')]);if(_0x1b9689[_0x4028('0xad')]===-0x1){return _0x1b9689;}}return this[_0x4028('0x34')][_0x4028('0xbf')]();};AGIVertices['prototype']['callback']=function(_0x2a76d7){console[_0x4028('0x50')](_0x4028('0xc2'),_0x2a76d7);logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xc3'),_0x2a76d7[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x2a76d7[_0x4028('0xc4')])){return this['channel']['error'](_0x2a76d7,'no\x20list\x20selected');}_0x2a76d7['scheduledAt']=moment();if(this['isConfigured'](_0x2a76d7[_0x4028('0xc5')])){_0x2a76d7[_0x4028('0x49')]=moment()[_0x4028('0x58')](_0x2a76d7['delay'],_0x4028('0x59'));}if(!this['isConfigured'](_0x2a76d7[_0x4028('0x4d')])){_0x2a76d7[_0x4028('0x4d')]=0x2;}console['log'](_0x4028('0xc6'),_0x2a76d7);this[_0x4028('0x42')]['sync'](this,_0x2a76d7);return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xc7'),_0x2a76d7['phone'],_0x2a76d7['list_id'],_0x2a76d7[_0x4028('0x49')]));};AGIVertices[_0x4028('0x14')][_0x4028('0xc8')]=function(_0x140061){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xc9'),_0x140061[_0x4028('0x36')]));var _0x161ea8=this[_0x4028('0x34')][_0x4028('0xb2')](_0x140061[_0x4028('0xca')],_0x140061[_0x4028('0x84')]);if(_0x161ea8['result']===-0x1){return _0x161ea8;}return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')]('Executed\x20command\x20%s\x20%s',_0x140061[_0x4028('0xca')],_0x140061[_0x4028('0x84')]));};AGIVertices['prototype'][_0x4028('0xcb')]=function(_0x217681){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xcc'),_0x217681[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x217681[_0x4028('0x6b')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}var _0xe4f516='\x22'+_0x217681[_0x4028('0x6b')]+'\x22';if(this[_0x4028('0x8c')](_0x217681[_0x4028('0x84')])){_0xe4f516+=','+_0x217681[_0x4028('0x84')];}var _0x110e8f=this[_0x4028('0x34')][_0x4028('0xb2')](_0x4028('0xb3'),_0xe4f516);if(_0x110e8f['result']===-0x1){return _0x110e8f;}return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xb4'),_0xe4f516));};AGIVertices['prototype'][_0x4028('0xce')]=function(_0x3c157c){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xcf'),_0x3c157c['label']));if(!this[_0x4028('0x8c')](_0x3c157c['text'])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}var _0x5932ca='\x22'+_0x3c157c[_0x4028('0x6b')]+'\x22';if(this['isConfigured'](_0x3c157c[_0x4028('0x84')])){_0x5932ca+=','+_0x3c157c[_0x4028('0x84')];}var _0x5935cd=this[_0x4028('0x34')][_0x4028('0xb2')]('MRCPSynth',_0x5932ca);if(_0x5935cd[_0x4028('0xad')]===-0x1){return _0x5935cd;}return this['channel']['noop'](util['format'](_0x4028('0xb4'),_0x5932ca));};AGIVertices[_0x4028('0x14')][_0x4028('0xd0')]=function(_0x4b44b6){logger['info'](util[_0x4028('0x26')](_0x4028('0xd1'),_0x4b44b6['label']));if(!this[_0x4028('0x8c')](_0x4b44b6[_0x4028('0xb5')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xd2'));}var _0x28b03d=_0x4b44b6[_0x4028('0xb5')];if(this[_0x4028('0x8c')](_0x4b44b6['options'])){_0x28b03d+=','+_0x4b44b6['options'];}var _0x336968=this[_0x4028('0x34')][_0x4028('0xb2')](_0x4028('0xd3'),_0x28b03d);if(_0x336968[_0x4028('0xad')]===-0x1){return _0x336968;}var _0x44e8f1=this['getAndSetVariable'](_0x4028('0xd4'),_0x4028('0xd5'));if(_0x44e8f1[_0x4028('0xad')]===-0x1){return _0x44e8f1;}var _0x2463b9=this['getAndSetVariable']('RECOG_INPUT()',_0x4028('0xd6'));if(_0x2463b9['result']===-0x1){return _0x2463b9;}var _0x5db3e=this[_0x4028('0xb7')](_0x4028('0xba'),_0x4028('0xd7'));if(_0x5db3e[_0x4028('0xad')]===-0x1){return _0x5db3e;}return this['channel'][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xbc'),_0x28b03d));};AGIVertices['prototype'][_0x4028('0xd8')]=function(_0x56c1b1){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xd9'),_0x56c1b1['label']));if(!this[_0x4028('0x8c')](_0x56c1b1[_0x4028('0xb5')])){return this[_0x4028('0x34')]['noop']('no\x20grammar\x20configured');}var _0x14914a=_0x56c1b1[_0x4028('0xb5')];if(this['isConfigured'](_0x56c1b1[_0x4028('0x84')])){_0x14914a+=','+_0x56c1b1[_0x4028('0x84')];}var _0x5b552d=this[_0x4028('0x34')]['exec'](_0x4028('0xd3'),_0x14914a);if(_0x5b552d[_0x4028('0xad')]===-0x1){return _0x5b552d;}var _0x233e0d=this[_0x4028('0xb7')](_0x4028('0xd4'),'SESTEK_ASR_CONFIDENCE');if(_0x233e0d[_0x4028('0xad')]===-0x1){return _0x233e0d;}var _0x43e281=this[_0x4028('0xb7')](_0x4028('0xb8'),'SESTEK_ASR_TRANSCRIPT');if(_0x43e281[_0x4028('0xad')]===-0x1){return _0x43e281;}var _0x1bc8a7=this['getAndSetVariable']('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x1bc8a7['result']===-0x1){return _0x1bc8a7;}return this['channel'][_0x4028('0xb6')](util['format'](_0x4028('0xbc'),_0x14914a));};AGIVertices[_0x4028('0x14')]['database']=function(_0x2c2725){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xda'),_0x2c2725[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x2c2725['odbc_id'])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x2c2725,_0x4028('0xdb'));}var _0x5d99e0=this[_0x4028('0x18')][_0x4028('0x7d')](this,_0x2c2725[_0x4028('0xdc')]);if(!_0x5d99e0){return this['channel']['error'](_0x2c2725,_0x4028('0xdd'));}if(!this[_0x4028('0x8c')](_0x2c2725['query'])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x2c2725,_0x4028('0xde'));}var _0x4bd67a=_0x2c2725[_0x4028('0xdf')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xe0'),_0x4bd67a));var _0x16d77c=this[_0x4028('0x28')][_0x4028('0x7d')](this,_0x5d99e0,_0x4bd67a);this[_0x4028('0x33')][_0x4028('0x7d')](this,_0x2c2725,_0x4bd67a);if(!this[_0x4028('0x8c')](_0x2c2725[_0x4028('0xe1')])){return this['channel'][_0x4028('0xb6')](_0x4028('0xe2'));}var _0x8f8273=this[_0x4028('0xaa')][_0x4028('0x7d')](this,_0x2c2725['variable_id']);if(!_0x8f8273){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x2c2725,'no\x20variable\x20found');}var _0x29642e=this;_0x16d77c[_0x4028('0xe3')](function(_0x242916,_0x3735f5){Object['keys'](_0x242916)[_0x4028('0xe3')](function(_0x3e5bec){_0x29642e['channel'][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0xe5'),_0x8f8273,_0x3735f5,_0x3e5bec),_0x242916[_0x3e5bec]);});});this[_0x4028('0x34')][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0xe6'),_0x8f8273),_0x16d77c[_0x4028('0xa5')]);return this['channel'][_0x4028('0xb6')](util[_0x4028('0x26')]('variable\x20%s\x20set',_0x8f8273));};AGIVertices[_0x4028('0x14')][_0x4028('0xe7')]=function(_0x7d3335){logger[_0x4028('0xe8')](util[_0x4028('0x26')](_0x4028('0xe9'),_0x7d3335[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x7d3335[_0x4028('0xea')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x7d3335,_0x4028('0xeb'));}var _0x15b33a=this[_0x4028('0x1a')]['sync'](this,_0x7d3335[_0x4028('0xea')]);if(!_0x15b33a){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x7d3335,_0x4028('0xec'));}var _0x1f94c0=this['channel'][_0x4028('0xb2')]('DIAL',[util[_0x4028('0x26')]('SIP/%s',_0x15b33a),_0x7d3335['timeout'],_0x7d3335[_0x4028('0xed')],_0x7d3335[_0x4028('0x71')]]);if(_0x1f94c0[_0x4028('0xad')]===-0x1){return _0x1f94c0;}return this[_0x4028('0x34')][_0x4028('0xb6')](util['format']('Executed\x20command\x20%s',_0x4028('0xee')));};AGIVertices[_0x4028('0x14')][_0x4028('0xef')]=function(_0x5858a5){logger['info'](util[_0x4028('0x26')](_0x4028('0xf0'),_0x5858a5[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x5858a5['key'])){return this[_0x4028('0x34')][_0x4028('0xb6')]('no\x20key\x20configured');}if(!this[_0x4028('0x8c')](_0x5858a5[_0x4028('0x6b')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}this['channel'][_0x4028('0xf1')]=!![];this['createSquareDetailsReport'](_0x5858a5);this['createSquareMessage'](_0x5858a5['text'],'in');this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xf2'),_0x5858a5[_0x4028('0x6b')]));var _0x4f32c7=this[_0x4028('0x85')][_0x4028('0x7d')](this,_0x5858a5);if(_0x4f32c7){for(var _0x4c509f in _0x4f32c7){if(_0x4f32c7[_0x4028('0x9f')](_0x4c509f)){this[_0x4028('0x34')][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0xf3'),_0x4c509f['toUpperCase']()),_0x4f32c7[_0x4c509f]);}}this[_0x4028('0x41')](_0x4f32c7[_0x4028('0xf4')],_0x4028('0xf5'));return this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')](_0x4028('0xf6'),_0x4f32c7[_0x4028('0xf4')]));}return this['channel']['error'](_0x5858a5,_0x4028('0xf7'));};AGIVertices[_0x4028('0x14')]['sesteknda']=function(_0x45998d){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xf8'),_0x45998d[_0x4028('0x36')]));if(!this['isConfigured'](_0x45998d['ndauth_url'])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xf9'));}if(!this['isConfigured'](_0x45998d[_0x4028('0xfa')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xfb'));}if(!this[_0x4028('0x8c')](_0x45998d[_0x4028('0xfc')])){return this[_0x4028('0x34')][_0x4028('0xb6')]('no\x20password\x20configured');}if(!this[_0x4028('0x8c')](_0x45998d[_0x4028('0xfd')])){return this['channel'][_0x4028('0xb6')](_0x4028('0xcd'));}this[_0x4028('0x34')]['bot']=!![];this['createSquareDetailsReport'](_0x45998d);this['createSquareMessage'](_0x45998d[_0x4028('0x6b')],'in');this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xfe'),_0x45998d[_0x4028('0x6b')]));var _0x5e657d=this[_0x4028('0x87')][_0x4028('0x7d')](this,_0x45998d);if(_0x5e657d){for(var _0x2ce8a0 in _0x5e657d){if(_0x5e657d[_0x4028('0x9f')](_0x2ce8a0)){this['channel'][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0xff'),_0x2ce8a0[_0x4028('0x77')]()),_0x5e657d[_0x2ce8a0]);}}this[_0x4028('0x41')](_0x5e657d[_0x4028('0xf4')],'out');if(_0x5e657d[_0x4028('0x100')]){this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x101'),_0x5e657d[_0x4028('0x100')]));var _0x55acde=this[_0x4028('0x34')][_0x4028('0x102')](_0x5e657d[_0x4028('0x100')]);try{fs[_0x4028('0x103')](_0x5e657d['audiofile']+_0x4028('0x104'));}catch(_0x5e4072){logger[_0x4028('0x2a')](_0x5e4072);}return _0x55acde;}else{return this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x105'),_0x5e657d[_0x4028('0xf4')]));}}return this[_0x4028('0x34')][_0x4028('0x2a')](_0x45998d,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x4028('0x14')][_0x4028('0x106')]=function(_0x27f119){logger[_0x4028('0x2c')](util['format'](_0x4028('0x107'),_0x27f119[_0x4028('0x36')]));return this[_0x4028('0x34')][_0x4028('0xb6')]('end');};AGIVertices[_0x4028('0x14')][_0x4028('0x108')]=function(_0x50af4d){logger[_0x4028('0x2c')](util['format'](_0x4028('0x109'),_0x50af4d['label']));var _0x50547c='';if(_0x50af4d[_0x4028('0x10a')]){if(!this[_0x4028('0x8c')](_0x50af4d[_0x4028('0x10a')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x50af4d,_0x4028('0x10b'));}else{var _0x3940d3=parseInt(_0x50af4d['trunk_id'],0xa);if(isNaN(_0x3940d3)){_0x50547c=_0x50af4d['trunk_id'];}else{_0x50547c=this[_0x4028('0x1c')][_0x4028('0x7d')](this,_0x50af4d[_0x4028('0x10a')]);if(!_0x50547c){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x50af4d,'no\x20trunk\x20found');}}}}else if(_0x50af4d[_0x4028('0x10c')]){_0x50547c=_0x50af4d[_0x4028('0x10c')];}else{return this[_0x4028('0x34')][_0x4028('0x2a')](_0x50af4d,_0x4028('0x10b'));}var _0x8e701a=this['channel'][_0x4028('0xb2')](_0x4028('0xee'),[util['format'](_0x4028('0x10d'),_0x50547c,_0x50af4d[_0x4028('0x54')]),_0x50af4d[_0x4028('0x73')],_0x50af4d['opts'],_0x50af4d[_0x4028('0x71')]]);if(_0x8e701a['result']===-0x1){return _0x8e701a;}return this['channel']['noop'](util[_0x4028('0x26')](_0x4028('0x10e'),_0x4028('0xee')));};AGIVertices['prototype'][_0x4028('0x10f')]=function(_0x27c830){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x110'),_0x27c830[_0x4028('0x36')]));return this[_0x4028('0x34')][_0x4028('0xb6')]('finally');};AGIVertices[_0x4028('0x14')][_0x4028('0xf')]=function(_0x770506){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x111'),_0x770506['label']));if(_0x770506[_0x4028('0x112')]===0x0){return this[_0x4028('0xaf')](_0x770506);}_0x770506['retry']-=0x1;if(!this[_0x4028('0x8c')](_0x770506[_0x4028('0x113')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x770506,_0x4028('0x114'));}var _0x3ef2bb=this[_0x4028('0x115')][_0x4028('0x7d')](this,_0x770506['file_id']);if(!_0x3ef2bb){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x770506,_0x4028('0x116'));}if(!this[_0x4028('0x8c')](_0x770506['variable_id'])){return this['channel'][_0x4028('0x2a')](_0x4028('0xe2'));}var _0x58ba90=this[_0x4028('0x34')][_0x4028('0x117')](_0x3ef2bb,_0x770506['response'],_0x770506[_0x4028('0x118')]);var _0x1aac5f=_0x58ba90[_0x4028('0xad')]?_0x58ba90['result'][_0x4028('0x4c')]():'';logger[_0x4028('0x2c')](_0x4028('0x119'),JSON[_0x4028('0x80')](_0x58ba90));if(_0x58ba90[_0x4028('0xad')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x770506,_0x1aac5f);return _0x58ba90;}else if(_0x58ba90[_0x4028('0xab')]===_0x4028('0x73')){_0x58ba90[_0x4028('0xad')]=_0x1aac5f[_0x4028('0xa5')]>=parseInt(_0x770506[_0x4028('0x11a')])?'x':'i';}else{_0x58ba90[_0x4028('0xad')]=_0x1aac5f['length']>=parseInt(_0x770506['mindigit'])&&_0x1aac5f['length']<=parseInt(_0x770506['maxdigit'])?'x':'i';}var _0x2c5f28=this[_0x4028('0xaa')]['sync'](this,_0x770506['variable_id']);if(!_0x2c5f28){return this[_0x4028('0x34')]['error'](_0x770506,_0x4028('0x11b'));}this['channel'][_0x4028('0xe4')](_0x2c5f28,_0x1aac5f);if(this[_0x4028('0x8c')](_0x770506['hiddendigitsnum'])){var _0x37b49d=parseInt(_0x770506[_0x4028('0x11c')],0xa);var _0x909f7c=rs[_0x4028('0x11d')]({'charset':'*','length':_0x37b49d});var _0x3db4e6=_0x1aac5f['length'];if(_0x3db4e6>0x0){if(_0x3db4e6>_0x37b49d){this['createSquareDetailsReport'][_0x4028('0x7d')](this,_0x770506,_0x770506[_0x4028('0x11e')]===_0x4028('0x11f')?_0x909f7c+_0x1aac5f[_0x4028('0x120')](_0x37b49d):_0x1aac5f[_0x4028('0x120')](0x0,_0x3db4e6-_0x37b49d)+_0x909f7c);}else{this['createSquareDetailsReport'][_0x4028('0x7d')](this,_0x770506,rs['generate']({'charset':'*','length':_0x3db4e6}));}}else{this['createSquareDetailsReport'][_0x4028('0x7d')](this,_0x770506,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x770506,_0x1aac5f);}return _0x58ba90;};AGIVertices[_0x4028('0x14')][_0x4028('0x121')]=function(_0x41e7ba){logger[_0x4028('0x2c')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x41e7ba['label']));return this[_0x4028('0xf')](_0x41e7ba);};AGIVertices['prototype']['goal']=function(_0x1188d7){logger['info'](util[_0x4028('0x26')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1188d7[_0x4028('0x36')]));this[_0x4028('0x33')]['sync'](this,_0x1188d7,_0x1188d7[_0x4028('0x122')]);return this[_0x4028('0x34')][_0x4028('0xb6')](util['format']('GOAL\x20%s',_0x1188d7[_0x4028('0x122')]));};AGIVertices[_0x4028('0x14')]['awspolly']=function(_0x44de61){logger[_0x4028('0x2c')](util['format'](_0x4028('0x123'),_0x44de61[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x44de61[_0x4028('0x8f')])||!this[_0x4028('0x8c')](_0x44de61[_0x4028('0x90')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x124'));}if(!this[_0x4028('0x8c')](_0x44de61[_0x4028('0x6b')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}this['channel']['noop'](util[_0x4028('0x26')](_0x4028('0x125'),_0x44de61[_0x4028('0x6b')]));var _0x157c3e=this[_0x4028('0x8e')]['sync'](this,_0x44de61);if(_0x157c3e){this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x126'),_0x157c3e));var _0x2bbf4c=this[_0x4028('0x34')][_0x4028('0x102')](_0x157c3e);try{fs[_0x4028('0x103')](_0x157c3e+_0x4028('0x104'));}catch(_0x420589){logger['error'](_0x420589);}return _0x2bbf4c;}return this[_0x4028('0x34')][_0x4028('0x2a')](_0x44de61,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x4028('0x14')][_0x4028('0x127')]=function(_0x1cd698){logger[_0x4028('0x2c')](util['format'](_0x4028('0x128'),_0x1cd698[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x1cd698['aws_access_key_id'])||!this[_0x4028('0x8c')](_0x1cd698[_0x4028('0x90')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x124'));}if(!this['isConfigured'](_0x1cd698[_0x4028('0x96')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x129'));}if(!this[_0x4028('0x8c')](_0x1cd698['text'])){return this[_0x4028('0x34')]['noop'](_0x4028('0xcd'));}this[_0x4028('0x34')]['bot']=!![];this[_0x4028('0x33')](_0x1cd698);this['createSquareMessage'](_0x1cd698[_0x4028('0x6b')],'in');this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')](_0x4028('0x12a'),_0x1cd698[_0x4028('0x6b')]));var _0x118434=this['awsLex'][_0x4028('0x7d')](this,_0x1cd698);if(_0x118434){for(var _0x29bee6 in _0x118434){if(_0x118434[_0x4028('0x9f')](_0x29bee6)&&_['isString'](_0x118434[_0x29bee6])){this[_0x4028('0x34')][_0x4028('0xe4')](util['format'](_0x4028('0x12b'),_0x29bee6[_0x4028('0x77')]()),_0x118434[_0x29bee6]);}}if(_[_0x4028('0x46')](_0x118434[_0x4028('0x12c')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x12d'));}else{this['createSquareMessage'](_0x118434['message'],_0x4028('0xf5'));return this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')](_0x4028('0x12e'),_0x118434[_0x4028('0x12c')]));}}return this[_0x4028('0x34')][_0x4028('0x2a')](_0x1cd698,_0x4028('0x12f'));};AGIVertices[_0x4028('0x14')][_0x4028('0x130')]=function(_0xa8c1e){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x131'),_0xa8c1e['label'],_0xa8c1e[_0x4028('0x73')]));if(!this[_0x4028('0x8c')](_0xa8c1e['key'])){return this['channel'][_0x4028('0xb6')](_0x4028('0x132'));}var _0x3b38f0=_0x4028('0x133');var _0x5d2edf=util[_0x4028('0x26')](_0x4028('0x134'),FILES_PATH,rs[_0x4028('0x11d')](0x4));var _0x2e1d6a=util[_0x4028('0x26')](_0x4028('0xa7'),_0x5d2edf,_0x3b38f0);var _0x1b7a8a=!![];if(_0xa8c1e[_0x4028('0x135')]===_0x4028('0x136')){_0x1b7a8a=![];}var _0x25b141=this['channel']['recordFile'](_0x5d2edf,_0x3b38f0,_0xa8c1e[_0x4028('0x137')],_0xa8c1e['timeout'],undefined,_0x1b7a8a);if(_0x25b141['result']!==-0x1){this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x138'),_0x2e1d6a));var _0x66657d=this[_0x4028('0x97')][_0x4028('0x7d')](this,_0xa8c1e,_0x2e1d6a);if(_0x66657d){for(var _0x4b4065 in _0x66657d){if(_0x66657d[_0x4028('0x9f')](_0x4b4065)){this[_0x4028('0x34')][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0x139'),_0x4b4065['toUpperCase']()),_0x66657d[_0x4b4065]);}}return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x13a'),JSON['stringify'](_0x66657d)));}}return _0x25b141;};AGIVertices[_0x4028('0x14')][_0x4028('0x13b')]=function(_0x2e6481){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x13c'),_0x2e6481['label']));if(!this[_0x4028('0x8c')](_0x2e6481[_0x4028('0x9a')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x13d'));}if(!this[_0x4028('0x8c')](_0x2e6481[_0x4028('0x9b')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x13e'));}var _0x4e9c42=_0x4028('0x133');var _0x310d3a=util['format'](_0x4028('0x134'),FILES_PATH,rs['generate'](0x4));var _0x39e2d6=util[_0x4028('0x26')](_0x4028('0xa7'),_0x310d3a,_0x4e9c42);var _0x54e39b=!![];if(_0x2e6481['beep']==='NOBEEP'){_0x54e39b=![];}var _0x100363=this['channel'][_0x4028('0x13f')](_0x310d3a,_0x4e9c42,_0x2e6481[_0x4028('0x137')],_0x2e6481[_0x4028('0x73')],undefined,_0x54e39b);if(_0x100363[_0x4028('0xad')]!==-0x1){this['channel'][_0x4028('0xb6')](util['format']('tilde\x20%s\x20file\x20created',_0x39e2d6));var _0x3248bc=this['tildeASR'][_0x4028('0x7d')](this,_0x2e6481,_0x39e2d6);if(_0x3248bc){for(var _0x2e3cef in _0x3248bc){if(_0x3248bc['hasOwnProperty'](_0x2e3cef)){this['channel'][_0x4028('0xe4')](util[_0x4028('0x26')]('TILDE_ASR_%s',_0x2e3cef[_0x4028('0x77')]()),_0x3248bc[_0x2e3cef]);}}return this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x140'),JSON[_0x4028('0x80')](_0x3248bc)));}}return _0x100363;};AGIVertices[_0x4028('0x14')][_0x4028('0x141')]=function(_0x2e0054){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x142'),_0x2e0054[_0x4028('0x36')]));return this[_0x4028('0x34')][_0x4028('0x143')](_0x2e0054[_0x4028('0x3b')],_0x2e0054[_0x4028('0x3c')],_0x2e0054['priority']);};AGIVertices[_0x4028('0x14')][_0x4028('0x144')]=function(_0x124bec){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x145'),_0x124bec[_0x4028('0x36')]));if(!this['isConfigured'](_0x124bec['condition'])){return this['channel']['error'](_0x124bec,_0x4028('0x146'));}try{var _0x429f15=eval(_0x124bec['condition'])?_0x4028('0x147'):_0x4028('0x148');this['channel'][_0x4028('0xb6')](util[_0x4028('0x26')]('EVAL\x20CONDITION\x20%s\x20%s',_0x124bec[_0x4028('0x149')],_0x429f15));return{'code':0xc8,'result':_0x429f15};}catch(_0x4aca5d){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x4028('0x14')][_0x4028('0x14a')]=function(_0x3eeb67){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x14b'),_0x3eeb67[_0x4028('0x36')]));if(!this['isConfigured'](_0x3eeb67[_0x4028('0x14c')])){return this[_0x4028('0x34')]['error'](_0x3eeb67,_0x4028('0x14d'));}var _0x4368a1=this[_0x4028('0x14e')][_0x4028('0x7d')](this,_0x3eeb67[_0x4028('0x14c')]);if(!_0x4368a1){return this['channel'][_0x4028('0x2a')](_0x3eeb67,_0x4028('0x14f'));}for(var _0x35d50c=0x0;_0x35d50c<_0x4368a1['length'];_0x35d50c+=0x1){var _0xc9b76c=this[_0x4028('0x34')][_0x4028('0xaa')](util[_0x4028('0x26')](_0x4028('0x150'),_0x4368a1[_0x35d50c]));if(_0xc9b76c[_0x4028('0xad')]===-0x1){return _0xc9b76c;}logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x151'),_0x4368a1[_0x35d50c],_0xc9b76c[_0x4028('0xab')]));if(_0xc9b76c[_0x4028('0xab')]===_0x4028('0x147')){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x151'),_0x4368a1[_0x35d50c],_0x4028('0x147')));this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x151'),_0x4368a1[_0x35d50c],_0x4028('0x147')));return{'code':0xc8,'result':_0x4028('0x147')};}else{logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x151'),_0x4368a1[_0x35d50c],'false'));this['channel'][_0x4028('0xb6')](util[_0x4028('0x26')]('IFTIME\x20%s\x20%s',_0x4368a1[_0x35d50c],_0x4028('0x148')));}}return{'code':0xc8,'result':_0x4028('0x148')};};AGIVertices[_0x4028('0x14')]['hangup']=function(_0x35b97c){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x152'),_0x35b97c[_0x4028('0x36')]));return this[_0x4028('0x34')]['hangup']();};AGIVertices[_0x4028('0x14')][_0x4028('0x153')]=function(_0x5910bb){logger[_0x4028('0x2c')](util['format'](_0x4028('0x154'),_0x5910bb[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x5910bb[_0x4028('0x89')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x132'));}var _0x1ed6ee=_0x4028('0x133');var _0x21ec12=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x327851=util['format'](_0x4028('0xa7'),_0x21ec12,_0x1ed6ee);var _0x50aca4=!![];if(_0x5910bb[_0x4028('0x135')]===_0x4028('0x136')){_0x50aca4=![];}var _0x32b01a=this[_0x4028('0x34')][_0x4028('0x13f')](_0x21ec12,_0x1ed6ee,_0x5910bb[_0x4028('0x137')],_0x5910bb[_0x4028('0x73')],undefined,_0x50aca4);if(_0x32b01a['result']!==-0x1){this['channel']['noop'](util[_0x4028('0x26')]('ispeech\x20%s\x20file\x20created',_0x327851));var _0x231e24=this['ispeechASR']['sync'](this,_0x5910bb,_0x327851);if(_0x231e24){for(var _0x1d6a55 in _0x231e24){if(_0x231e24[_0x4028('0x9f')](_0x1d6a55)){this['channel'][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0x155'),_0x1d6a55[_0x4028('0x77')]()),_0x231e24[_0x1d6a55]);}}return this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x156'),JSON['stringify'](_0x231e24)));}}return _0x32b01a;};AGIVertices[_0x4028('0x14')][_0x4028('0x157')]=function(_0x42e58a){logger['info'](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x42e58a['label']));if(!this['isConfigured'](_0x42e58a[_0x4028('0x89')])){return this[_0x4028('0x34')]['noop'](_0x4028('0x132'));}if(!this['isConfigured'](_0x42e58a['text'])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')]('Trying\x20ispeech\x20TTS\x20%s',_0x42e58a[_0x4028('0x6b')]));var _0x1d62b5=this['ispeechTTS'][_0x4028('0x7d')](this,_0x42e58a);if(_0x1d62b5){this['channel']['noop'](util[_0x4028('0x26')](_0x4028('0x158'),_0x1d62b5));var _0x5b77d7=this['channel'][_0x4028('0x102')](_0x1d62b5,_0x42e58a['intKey']);try{fs[_0x4028('0x103')](_0x1d62b5+_0x4028('0x104'));}catch(_0x1a7420){logger[_0x4028('0x2a')](_0x1a7420);}return _0x5b77d7;}return this[_0x4028('0x34')][_0x4028('0x2a')](_0x42e58a,_0x4028('0x159'));};AGIVertices['prototype'][_0x4028('0x15a')]=function(_0x2204dd){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x15b'),_0x2204dd[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x2204dd['findBy'])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x2204dd,'no\x20find\x20by\x20configured');}logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x15c'),this[_0x4028('0x34')][_0x4028('0x38')],_0x2204dd[_0x4028('0x15d')]));var _0x1df2dd=this[_0x4028('0x62')][_0x4028('0x7d')](this,_0x2204dd[_0x4028('0x15d')]);if(_0x1df2dd){logger[_0x4028('0x2c')](util[_0x4028('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4028('0x34')][_0x4028('0x38')],_0x2204dd[_0x4028('0x15d')]));this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x15e'),this[_0x4028('0x34')][_0x4028('0x38')],_0x2204dd['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x4028('0x26')](_0x4028('0x15f'),this[_0x4028('0x34')][_0x4028('0x38')],_0x2204dd['findBy']));this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x2204dd['findBy']));return{'code':0xc8,'result':_0x4028('0x160')};}};AGIVertices['prototype'][_0x4028('0x161')]=function(_0x5ab8f8){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x162'),_0x5ab8f8[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x5ab8f8[_0x4028('0x15d')])){return this['channel']['error'](_0x5ab8f8,_0x4028('0x163'));}logger[_0x4028('0x2c')](util[_0x4028('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4028('0x34')][_0x4028('0x38')],_0x5ab8f8['findBy']));var _0x4428a8=this['agentLogout']['sync'](this,_0x5ab8f8[_0x4028('0x15d')]);if(_0x4428a8){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x15e'),this[_0x4028('0x34')]['callerid'],_0x5ab8f8[_0x4028('0x15d')]));this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x15e'),this[_0x4028('0x34')][_0x4028('0x38')],_0x5ab8f8[_0x4028('0x15d')]));return{'code':0xc8,'result':_0x4028('0x164')};}else{logger[_0x4028('0x2c')](util[_0x4028('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x4028('0x38')],_0x5ab8f8['findBy']));this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x15f'),this[_0x4028('0x34')][_0x4028('0x38')],_0x5ab8f8[_0x4028('0x15d')]));return{'code':0xc8,'result':_0x4028('0x160')};}};AGIVertices[_0x4028('0x14')][_0x4028('0x165')]=function(_0x25f3d2){logger[_0x4028('0x2c')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x25f3d2[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x25f3d2['operation'])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x25f3d2,_0x4028('0x166'));}this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')]('math\x20%s',_0x25f3d2[_0x4028('0x167')]));var _0x2ce384=eval(_0x25f3d2[_0x4028('0x167')]);if(!this[_0x4028('0x8c')](_0x25f3d2[_0x4028('0xe1')])){return this[_0x4028('0x34')]['noop'](_0x4028('0xe2'));}var _0x4784fc=this[_0x4028('0xaa')][_0x4028('0x7d')](this,_0x25f3d2[_0x4028('0xe1')]);if(!_0x4784fc){return this[_0x4028('0x34')]['error'](_0x25f3d2,_0x4028('0x11b'));}if(_[_0x4028('0xa4')](_0x2ce384)){var _0x111748=this;_0x2ce384[_0x4028('0xe3')](function(_0x44a220,_0x4b95d1){_0x111748[_0x4028('0x34')][_0x4028('0xe4')](util[_0x4028('0x26')]('%s[%s]',_0x4784fc,_0x4b95d1),_0x44a220);});return this['channel'][_0x4028('0xb6')](util['format']('variable\x20%s[key]\x20set',_0x4784fc));}else{return this['channel'][_0x4028('0xe4')](_0x4784fc,_0x2ce384);}};AGIVertices['prototype'][_0x4028('0xe')]=function(_0x55e9c5){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x168'),_0x55e9c5[_0x4028('0x36')]));if(_0x55e9c5[_0x4028('0x112')]===0x0){return this['maxRetry'](_0x55e9c5);}_0x55e9c5[_0x4028('0x112')]-=0x1;if(!this[_0x4028('0x8c')](_0x55e9c5[_0x4028('0x113')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x55e9c5,_0x4028('0x114'));}var _0x22f06b=this['getSound'][_0x4028('0x7d')](this,_0x55e9c5['file_id']);if(!_0x22f06b){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x55e9c5,_0x4028('0x116'));}var _0xa6e4d4=this[_0x4028('0x34')]['getData'](_0x22f06b,_0x55e9c5[_0x4028('0x169')],_0x55e9c5[_0x4028('0x16a')]);var _0x525efa=_0xa6e4d4['result'];if(_0xa6e4d4[_0x4028('0xad')]===-0x1){this[_0x4028('0x33')][_0x4028('0x7d')](this,_0x55e9c5,'-1');return _0xa6e4d4;}else if(_0xa6e4d4[_0x4028('0xab')]===_0x4028('0x73')){_0xa6e4d4[_0x4028('0xad')]=_0xa6e4d4[_0x4028('0xad')][_0x4028('0xa5')]>0x0?_0xa6e4d4[_0x4028('0xad')]:'t';}else if(_[_0x4028('0x45')](_0xa6e4d4['result'])){_0xa6e4d4['result']='#';_0x525efa='#';}if(!this['isConfigured'](_0x55e9c5['variable_id'])){this[_0x4028('0x34')][_0x4028('0xb6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x540a9e=this['getVariable']['sync'](this,_0x55e9c5[_0x4028('0xe1')]);if(!_0x540a9e){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x55e9c5,_0x4028('0x11b'));}this[_0x4028('0x34')][_0x4028('0xe4')](_0x540a9e,_0x525efa);}this[_0x4028('0x33')][_0x4028('0x7d')](this,_0x55e9c5,_0x525efa);return _0xa6e4d4;};AGIVertices[_0x4028('0x14')]['noop']=function(_0x127079){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x16b'),_0x127079['label']));return this[_0x4028('0x34')][_0x4028('0xb6')](_0x127079[_0x4028('0x16c')]||_0x127079['label']);};AGIVertices[_0x4028('0x14')]['pause']=function(_0x4aaf25){logger['info'](util[_0x4028('0x26')](_0x4028('0x16d'),_0x4aaf25[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x4aaf25[_0x4028('0x15d')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x4aaf25,'no\x20find\x20by\x20configured');}logger[_0x4028('0x2c')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4028('0x34')][_0x4028('0x38')],_0x4aaf25[_0x4028('0x15d')]));var _0x3b0b6e=this[_0x4028('0x5c')][_0x4028('0x7d')](this,_0x4aaf25[_0x4028('0x16e')]);var _0x1e5e83=this[_0x4028('0x5e')][_0x4028('0x7d')](this,_0x4aaf25[_0x4028('0x15d')],_0x3b0b6e);if(_0x1e5e83){logger['info'](util[_0x4028('0x26')](_0x4028('0x15e'),this[_0x4028('0x34')][_0x4028('0x38')],_0x4aaf25[_0x4028('0x15d')]));this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')](_0x4028('0x15e'),this['channel'][_0x4028('0x38')],_0x4aaf25[_0x4028('0x15d')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4028('0x2c')](util[_0x4028('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4028('0x34')][_0x4028('0x38')],_0x4aaf25[_0x4028('0x15d')]));this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x15e'),this[_0x4028('0x34')][_0x4028('0x38')],_0x4aaf25[_0x4028('0x15d')]));return{'code':0xc8,'result':_0x4028('0x160')};}};AGIVertices['prototype'][_0x4028('0x16f')]=function(_0x3f47a){logger['info'](util[_0x4028('0x26')](_0x4028('0x170'),_0x3f47a[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x3f47a[_0x4028('0x113')])){return this[_0x4028('0x34')]['error'](_0x3f47a,_0x4028('0x114'));}var _0x33ed21=this[_0x4028('0x115')]['sync'](this,_0x3f47a[_0x4028('0x113')]);if(!_0x33ed21){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x3f47a,'no\x20file\x20audio\x20found');}var _0x19c5ec=this[_0x4028('0x34')][_0x4028('0xb2')](_0x4028('0x171'),[_0x33ed21,_0x3f47a[_0x4028('0xed')]]);if(_0x19c5ec[_0x4028('0xad')]===-0x1){return _0x19c5ec;}return this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x172'),_0x4028('0x171'),_0x33ed21));};AGIVertices[_0x4028('0x14')][_0x4028('0x173')]=function(_0x5741c0){logger['info'](util[_0x4028('0x26')](_0x4028('0x174'),_0x5741c0[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x5741c0[_0x4028('0x175')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x5741c0,_0x4028('0x176'));}var _0x76f8d0='';var _0x1b78c1=parseInt(_0x5741c0[_0x4028('0x175')],0xa);if(isNaN(_0x1b78c1)){_0x76f8d0=_0x5741c0[_0x4028('0x175')];}else{_0x76f8d0=this['getVoiceQueue'][_0x4028('0x7d')](this,_0x5741c0[_0x4028('0x175')]);if(!_0x76f8d0){return this[_0x4028('0x34')]['error'](_0x5741c0,_0x4028('0x177'));}}var _0x1613bc='';if(this[_0x4028('0x8c')](_0x5741c0[_0x4028('0x113')])){var _0x43b387=this['getSound'][_0x4028('0x7d')](this,_0x5741c0[_0x4028('0x113')]);if(_0x43b387){_0x1613bc=_0x43b387;}}this['createSquareDetailsReport'][_0x4028('0x7d')](this,_0x5741c0,_0x76f8d0);if(_0x5741c0[_0x4028('0xed')][_0x4028('0x178')]('x')<0x0){_0x5741c0[_0x4028('0xed')]+='x';}if(_0x5741c0['opts'][_0x4028('0x178')]('X')<0x0){_0x5741c0['opts']+='X';}this[_0x4028('0x34')][_0x4028('0xe4')](_0x4028('0x179'),_0x76f8d0?_0x76f8d0[_0x4028('0x17a')]():'');var _0x52e41a=this['channel'][_0x4028('0xb2')](_0x4028('0x17b'),[_0x76f8d0,_0x5741c0[_0x4028('0xed')],_0x5741c0['url'],_0x1613bc,_0x5741c0['timeout'],_0x5741c0[_0x4028('0x9')],_0x5741c0[_0x4028('0x17c')],_0x5741c0[_0x4028('0x17d')],'',_0x5741c0['position']]);if(_0x52e41a[_0x4028('0xad')]===-0x1){return _0x52e41a;}return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x172'),_0x4028('0x17b'),_0x76f8d0));};AGIVertices[_0x4028('0x14')][_0x4028('0x17e')]=function(_0x559a2d){logger['info'](util[_0x4028('0x26')](_0x4028('0x17f'),_0x559a2d[_0x4028('0x36')]));var _0x10db27=_0x559a2d[_0x4028('0x180')]||'wav';var _0x3018f2=util[_0x4028('0x26')](_0x4028('0x181'),this[_0x4028('0x34')][_0x4028('0x35')],rs[_0x4028('0x11d')](0x5));var _0x3742c4=util['format'](_0x4028('0x182'),FILES_PATH,_0x3018f2,_0x10db27);var _0x26a2e9=util[_0x4028('0x26')]('%s/recordings/%s',FILES_PATH,_0x3018f2);this['createSquareRecording']['sync'](this,_0x559a2d,_0x3018f2,_0x3742c4);this['channel']['setVariable'](_0x4028('0x183'),_0x3018f2);logger[_0x4028('0x2c')](_0x4028('0x184'),_0x26a2e9,_0x10db27,_0x559a2d[_0x4028('0x185')],_0x559a2d[_0x4028('0x73')]);return this[_0x4028('0x34')][_0x4028('0x13f')](_0x26a2e9,_0x10db27,_0x559a2d[_0x4028('0x185')],_0x559a2d[_0x4028('0x73')],undefined,!![]);};AGIVertices[_0x4028('0x14')][_0x4028('0x186')]=function(_0x31df9e){logger[_0x4028('0x2c')](util['format'](_0x4028('0x187'),_0x31df9e['label']));if(!this[_0x4028('0x8c')](_0x31df9e['url'])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x188'));}var _0x54d6ef=this[_0x4028('0x189')][_0x4028('0x7d')](this,_0x31df9e);logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x18a'),util[_0x4028('0x18b')](_0x54d6ef,{'showHidden':![],'depth':null})));if(!this[_0x4028('0x8c')](_0x31df9e[_0x4028('0xe1')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x18c'));}var _0x339079=this['getVariable'][_0x4028('0x7d')](this,_0x31df9e['variable_id']);if(!_0x339079){return this[_0x4028('0x34')]['error'](_0x31df9e,'no\x20variable\x20found');}this['channel'][_0x4028('0xe4')](util['format'](_0x4028('0x18d'),_0x339079),_0x54d6ef[_0x4028('0x82')]?_0x54d6ef[_0x4028('0x82')]:_0x4028('0x18e'));this['channel'][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0x18f'),_0x339079),_0x54d6ef[_0x4028('0x83')]?_0x54d6ef[_0x4028('0x83')]:'OK');if(_0x54d6ef[_0x4028('0x78')]){try{this[_0x4028('0x190')](_0x54d6ef[_0x4028('0x78')],_0x339079);}catch(_0x288dbc){logger[_0x4028('0x2a')](util[_0x4028('0x26')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x339079));}}return this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')]('variable\x20%s\x20set',_0x339079));};AGIVertices[_0x4028('0x14')]['saydigits']=function(_0xee13ce){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x191'),_0xee13ce[_0x4028('0x36')]));return this[_0x4028('0x34')][_0x4028('0x192')](_0xee13ce[_0x4028('0x193')][_0x4028('0x67')](/\s+/g,''),_0xee13ce[_0x4028('0x185')]);};AGIVertices[_0x4028('0x14')][_0x4028('0x194')]=function(_0x149ad0){logger['info'](util[_0x4028('0x26')](_0x4028('0x195'),_0x149ad0[_0x4028('0x36')]));return this[_0x4028('0x34')][_0x4028('0x196')](_0x149ad0[_0x4028('0x74')][_0x4028('0x67')](/\s+/g,''),_0x149ad0[_0x4028('0x185')]);};AGIVertices['prototype'][_0x4028('0x197')]=function(_0x3da9eb){logger[_0x4028('0x2c')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x3da9eb[_0x4028('0x36')]));return this[_0x4028('0x34')]['sayPhonetic'](_0x3da9eb['text'],_0x3da9eb[_0x4028('0x185')]);};AGIVertices[_0x4028('0x14')][_0x4028('0x198')]=function(_0x2e6e5c){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x199'),_0x2e6e5c[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x2e6e5c[_0x4028('0x19a')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x19b'));}var _0x137c2a=this[_0x4028('0x19c')][_0x4028('0x7d')](this,_0x2e6e5c['account_id']);if(!_0x137c2a||!_0x137c2a['Smtp']){return this['channel'][_0x4028('0x2a')](_0x2e6e5c,_0x4028('0x19d'));}var _0x53e8ea={'from':util['format'](_0x4028('0x19e'),_0x137c2a[_0x4028('0x12')],_0x137c2a[_0x4028('0x19f')]||_0x137c2a[_0x4028('0x1a0')]['user']),'to':_0x2e6e5c['to']||'','cc':_0x2e6e5c['cc']||'','bcc':_0x2e6e5c[_0x4028('0x1a1')]||'','subject':_0x2e6e5c[_0x4028('0x1a2')],'html':_0x2e6e5c[_0x4028('0x6b')],'text':_0x2e6e5c[_0x4028('0x6b')]};var _0x44be2e={'tls':{'rejectUnauthorized':![]}};if(_0x137c2a[_0x4028('0x1a0')][_0x4028('0x1a3')]){_0x44be2e[_0x4028('0x1a3')]=_0x137c2a[_0x4028('0x1a0')][_0x4028('0x1a3')];}else{_0x44be2e[_0x4028('0x1a4')]=_0x137c2a['Smtp'][_0x4028('0x1a4')];_0x44be2e[_0x4028('0x1a5')]=_0x137c2a[_0x4028('0x1a0')]['port'];_0x44be2e['secure']=_0x137c2a[_0x4028('0x1a0')][_0x4028('0x1a6')];}if(_0x137c2a['Smtp'][_0x4028('0x1a7')]){_0x44be2e[_0x4028('0x1a8')]={'user':_0x137c2a['Smtp'][_0x4028('0x1a9')],'pass':_0x137c2a[_0x4028('0x1a0')][_0x4028('0x1aa')]};}if(this[_0x4028('0x8c')](_0x2e6e5c[_0x4028('0x1ab')])){}logger[_0x4028('0xe8')](_0x4028('0x1ac'),JSON[_0x4028('0x80')](_0x53e8ea));this[_0x4028('0x33')][_0x4028('0x7d')](this,_0x2e6e5c,_0x2e6e5c[_0x4028('0x19a')]);this['channel']['noop'](util[_0x4028('0x26')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x137c2a[_0x4028('0x12')]));this['sendMailMessage'][_0x4028('0x7d')](this,_0x44be2e,_0x53e8ea);return this[_0x4028('0x34')][_0x4028('0xb6')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['sendFax']=function(_0x1bf9d2){logger['info'](util[_0x4028('0x26')](_0x4028('0x1ad'),_0x1bf9d2[_0x4028('0x36')]));return this['channel'][_0x4028('0xb6')](_0x4028('0x1ae'));};AGIVertices[_0x4028('0x14')][_0x4028('0x1af')]=function(_0x50a2e5){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x1b0'),_0x50a2e5[_0x4028('0x36')]));if(!this['isConfigured'](_0x50a2e5[_0x4028('0x1b1')])){return this['channel'][_0x4028('0xb6')](_0x4028('0x1b2'));}var _0x59399b=this[_0x4028('0x30')][_0x4028('0x7d')](this,_0x50a2e5[_0x4028('0x1b1')]);if(!_0x59399b){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x50a2e5,_0x4028('0x1b3'));}var _0x412e5a={'body':_0x50a2e5[_0x4028('0x1b4')],'phone':_0x50a2e5['to']||'','SmsAccountId':_0x59399b['id']};logger['debug'](_0x4028('0x1b5'),JSON[_0x4028('0x80')](_0x412e5a));this['createSquareDetailsReport'][_0x4028('0x7d')](this,_0x50a2e5,_0x50a2e5['sms_account_id']);this[_0x4028('0x34')][_0x4028('0xb6')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x59399b[_0x4028('0x12')]));this[_0x4028('0x32')][_0x4028('0x7d')](this,_0x412e5a);return this['channel']['noop'](_0x4028('0x1b6'));};AGIVertices[_0x4028('0x14')][_0x4028('0x1b7')]=function(_0x21ed5d){logger[_0x4028('0x2c')](util['format'](_0x4028('0x1b8'),_0x21ed5d[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x21ed5d[_0x4028('0xe1')])){return this['channel']['error'](_0x21ed5d,'no\x20variable\x20selected');}var _0x3cdca5=this[_0x4028('0xaa')][_0x4028('0x7d')](this,_0x21ed5d['variable_id']);if(!_0x3cdca5){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x21ed5d,_0x4028('0x11b'));}return this['channel'][_0x4028('0xe4')](_0x3cdca5,_0x21ed5d[_0x4028('0x1b9')]);};AGIVertices['prototype'][_0x4028('0x1ba')]=function(_0x3aaff0){logger['info'](util['format'](_0x4028('0x1bb'),_0x3aaff0['label']));this['channel']['noop'](_0x4028('0x1bc'));if(_0x3aaff0[_0x4028('0xbf')]===_0x4028('0x1bd')){this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x1be'));return this[_0x4028('0x34')][_0x4028('0xbf')]();}return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x1bf'));};AGIVertices[_0x4028('0x14')][_0x4028('0x1c0')]=function(_0x11271f){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x1c1'),_0x11271f[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x11271f[_0x4028('0x1c2')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x11271f,_0x4028('0x1c3'));}var _0x2a53ff=this[_0x4028('0x15')][_0x4028('0x7d')](this,_0x11271f[_0x4028('0x1c2')]);if(!this[_0x4028('0x8c')](_0x2a53ff)){return this['channel'][_0x4028('0x2a')](_0x11271f,util[_0x4028('0x26')](_0x4028('0x1c4'),_0x11271f[_0x4028('0x1c2')]));}if(_0x2a53ff===this[_0x4028('0x34')][_0x4028('0x3f')]){return this[_0x4028('0x34')]['error'](_0x11271f,_0x4028('0x1c5'));}this[_0x4028('0x33')]['sync'](this,_0x11271f,_0x2a53ff);var _0x246b1e=this[_0x4028('0x34')][_0x4028('0xb2')](_0x4028('0x1c6'),util[_0x4028('0x26')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x4028('0x9')]['host']||_0x4028('0x1c7'),_0x2a53ff,this['channel'][_0x4028('0x3f')]));if(_0x246b1e[_0x4028('0xad')]===-0x1){return _0x246b1e;}return this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')]('Executed\x20command\x20%s\x20%s',_0x4028('0x1c6'),_0x2a53ff));};AGIVertices[_0x4028('0x14')][_0x4028('0x1c8')]=function(_0x51c060){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x1c9'),_0x51c060[_0x4028('0x36')]));var _0x259ef0=this[_0x4028('0x1ca')][_0x4028('0x7d')](this,_0x51c060[_0x4028('0xbe')]);this[_0x4028('0x33')][_0x4028('0x7d')](this,_0x51c060,_0x51c060[_0x4028('0xbe')]);if(this[_0x4028('0x8c')](_0x51c060[_0x4028('0xe1')])){var _0x58a735=this[_0x4028('0xaa')][_0x4028('0x7d')](this,_0x51c060[_0x4028('0xe1')]);if(_0x58a735){this[_0x4028('0x34')]['setVariable'](_0x58a735,_0x259ef0);return this['channel'][_0x4028('0xb6')](util['format'](_0x4028('0x1cb'),_0x51c060[_0x4028('0xbe')],_0x58a735));}}return this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x51c060['command']));};AGIVertices[_0x4028('0x14')][_0x4028('0x1cc')]=function(_0x2207ce){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x1cd'),_0x2207ce['label']));_0x2207ce[_0x4028('0x6b')]=_0x2207ce[_0x4028('0x6b')][_0x4028('0x67')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4028('0x8c')](_0x2207ce[_0x4028('0x69')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x1ce'));}if(!this[_0x4028('0x8c')](_0x2207ce['text'])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}this['channel'][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x1cf'),_0x2207ce[_0x4028('0x6b')]));var _0x5aca9a=this[_0x4028('0x68')][_0x4028('0x7d')](this,_0x2207ce);if(_0x5aca9a){this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x1d0'),_0x5aca9a));var _0x9133c9=this['channel'][_0x4028('0x102')](_0x5aca9a);try{fs[_0x4028('0x103')](_0x5aca9a+_0x4028('0x104'));}catch(_0x5b956c){logger[_0x4028('0x2a')](_0x5b956c);}return _0x9133c9;}return this[_0x4028('0x34')]['error'](_0x2207ce,_0x4028('0x1d1'));};AGIVertices[_0x4028('0x14')][_0x4028('0x1d2')]=function(_0x51c246){logger[_0x4028('0x2c')](util[_0x4028('0x26')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x51c246[_0x4028('0x36')]));_0x51c246['text']=_0x51c246['text'][_0x4028('0x67')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x51c246['text'])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')](_0x4028('0x1d3'),_0x51c246['text']));var _0x197856=this[_0x4028('0x6f')][_0x4028('0x7d')](this,_0x51c246);if(_0x197856){this['channel']['noop'](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x197856));var _0x485dd2=this[_0x4028('0x34')][_0x4028('0x102')](_0x197856);try{fs[_0x4028('0x103')](_0x197856+_0x4028('0x104'));}catch(_0x33a452){logger[_0x4028('0x2a')](_0x33a452);}return _0x485dd2;}return this[_0x4028('0x34')][_0x4028('0x2a')](_0x51c246,_0x4028('0x1d4'));};AGIVertices[_0x4028('0x14')][_0x4028('0x1d5')]=function(_0x2b9d61){logger[_0x4028('0x2c')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x2b9d61[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x2b9d61[_0x4028('0x15d')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x2b9d61,_0x4028('0x163'));}logger[_0x4028('0x2c')](util[_0x4028('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x4028('0x38')],_0x2b9d61[_0x4028('0x15d')]));var _0x5eb6b6=this[_0x4028('0x60')][_0x4028('0x7d')](this,_0x2b9d61[_0x4028('0x15d')]);if(_0x5eb6b6){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x15e'),this[_0x4028('0x34')][_0x4028('0x38')],_0x2b9d61['findBy']));this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x4028('0x38')],_0x2b9d61[_0x4028('0x15d')]));return{'code':0xc8,'result':_0x4028('0x164')};}else{logger['info'](util[_0x4028('0x26')](_0x4028('0x15f'),this[_0x4028('0x34')][_0x4028('0x38')],_0x2b9d61[_0x4028('0x15d')]));this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x15f'),this[_0x4028('0x34')][_0x4028('0x38')],_0x2b9d61[_0x4028('0x15d')]));return{'code':0xc8,'result':_0x4028('0x160')};}};AGIVertices[_0x4028('0x14')][_0x4028('0x1d6')]=function(_0x76ec10){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x1d7'),_0x76ec10[_0x4028('0x36')]));var _0x1b2626=this[_0x4028('0x34')]['exec']('VOICEMAIL',[_0x76ec10['mailbox'],_0x76ec10[_0x4028('0x84')]]);if(_0x1b2626['result']===-0x1){return _0x1b2626;}return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x172'),_0x4028('0x1d8'),_0x76ec10['mailbox']));};AGIVertices[_0x4028('0x14')][_0x4028('0x1d9')]=function(_0x9aa11b){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x1da'),_0x9aa11b['label']));if(!this[_0x4028('0x8c')](_0x9aa11b[_0x4028('0xe1')])){return this[_0x4028('0x34')]['error'](_0x9aa11b,_0x4028('0x1db'));}var _0x46bc5b=this[_0x4028('0xaa')][_0x4028('0x7d')](this,_0x9aa11b['variable_id']);if(!_0x46bc5b){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x9aa11b,_0x4028('0x11b'));}var _0x2dbb1f=this[_0x4028('0x34')]['getVariable'](_0x46bc5b);return{'code':0xc8,'result':_0x2dbb1f[_0x4028('0xab')]?_0x2dbb1f[_0x4028('0xab')]:'-'};};String[_0x4028('0x14')]['replaceAll']=function(_0x38c76f,_0x107585){return this[_0x4028('0xa9')](_0x38c76f)[_0x4028('0x1dc')](_0x107585);};module[_0x4028('0x1dd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 09cfdf5..20572a4 100644 --- a/server/services/ami/acw/index.js +++ b/server/services/ami/acw/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d17=['catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','queue','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','info','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid'];(function(_0x4f99e0,_0x485134){var _0x2d20ca=function(_0xf106a3){while(--_0xf106a3){_0x4f99e0['push'](_0x4f99e0['shift']());}};_0x2d20ca(++_0x485134);}(_0x2d17,0x17e));var _0x72d1=function(_0x498a38,_0x100b9d){_0x498a38=_0x498a38-0x0;var _0x2a7d3b=_0x2d17[_0x498a38];return _0x2a7d3b;};'use strict';var util=require(_0x72d1('0x0'));var _=require(_0x72d1('0x1'));var moment=require('moment');var ami=require(_0x72d1('0x2'));var logger=require(_0x72d1('0x3'))('acw');var RpcUser=require(_0x72d1('0x4'));var RpcVoiceAgentReport=require(_0x72d1('0x5'));function Acw(_0x55b722){this[_0x72d1('0x6')]=_0x55b722['voiceQueues'];this[_0x72d1('0x7')]=_0x55b722['agents'];this[_0x72d1('0x8')]=_0x55b722[_0x72d1('0x8')];this['channels']={};ami['on'](_0x72d1('0x9'),this[_0x72d1('0xa')][_0x72d1('0xb')](this));ami['on']('hanguprequest',this[_0x72d1('0xc')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0xd'),this['syncHangup'][_0x72d1('0xb')](this));ami['on'](_0x72d1('0xe'),this[_0x72d1('0xf')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0x10'),this[_0x72d1('0x11')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0x12'),this[_0x72d1('0x13')][_0x72d1('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x72d1('0x14')][_0x72d1('0xb')](this));}function getDiff(_0x4c1038){var _0x115cd7=moment()[_0x72d1('0x15')](0x0);var _0x685a27=moment(_0x4c1038)[_0x72d1('0x15')](0x0);return _0x115cd7[_0x72d1('0x16')](_0x685a27,_0x72d1('0x17'));}Acw[_0x72d1('0x18')][_0x72d1('0x19')]=function(_0x23a238){try{var _0x8d458=this;var _0x491af4=this[_0x72d1('0x1a')][_0x23a238]['interface'];var _0x3885b2=this[_0x72d1('0x1a')][_0x23a238]['queue'];var _0x1061b7=this[_0x72d1('0x6')][_0x3885b2];var _0x1ca18d=![];var _0x49caf4='ACW';if(_0x1061b7[_0x72d1('0x1b')]){if(_0x1061b7[_0x72d1('0x1c')][_0x72d1('0x1d')]){_0x1ca18d=!![];_0x49caf4=_0x1061b7[_0x72d1('0x1c')][_0x72d1('0x1d')];}}ami[_0x72d1('0x1e')]({'action':_0x72d1('0x1f'),'interface':_0x491af4,'paused':!![],'reason':_0x49caf4})['then'](function(_0x1c695c){if(_0x8d458['agents'][_0x491af4]){return RpcUser['getAgent'](_0x8d458['agents'][_0x491af4]['id'])['then'](function(_0x445985){if(_0x445985&&!_0x445985[_0x72d1('0x20')]){logger['info'](_0x72d1('0x21'),_0x23a238,_0x491af4,_0x3885b2);var _0x256dc1=_0x8d458[_0x72d1('0x1a')][_0x23a238][_0x72d1('0x22')]&&_0x8d458[_0x72d1('0x1a')][_0x23a238]['destlinkedid']?_0x8d458['channels'][_0x23a238][_0x72d1('0x23')]:_0x23a238;return RpcUser[_0x72d1('0x24')](_0x8d458[_0x72d1('0x7')][_0x491af4],_0x49caf4,_0x256dc1)[_0x72d1('0x25')](function(_0xdf6a69){if(!_0x1ca18d){_0x8d458[_0x72d1('0x8')][_0x491af4]={};logger[_0x72d1('0x26')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x23a238,_0x8d458['voiceQueues'][_0x3885b2][_0x72d1('0x27')],_0x491af4,_0x3885b2);_0x8d458['timers'][_0x491af4][_0x72d1('0x28')]=setTimeout(_0x8d458[_0x72d1('0x29')][_0x72d1('0xb')](_0x8d458,_0x491af4),_0x8d458['voiceQueues'][_0x3885b2][_0x72d1('0x27')]*0x3e8);_0x8d458['timers'][_0x491af4][_0x72d1('0x2a')]=moment()[_0x72d1('0x2b')](_0x72d1('0x2c'));_0x8d458[_0x72d1('0x8')][_0x491af4]['uniqueid']=_0x23a238;_0x8d458[_0x72d1('0x8')][_0x491af4]['queue']=_0x3885b2;_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2d')]=function(){var _0x5cec3f=getDiff(_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2a')]);clearTimeout(_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x28')]);_0x8d458[_0x72d1('0x8')][_0x491af4]['timer']=![];RpcVoiceAgentReport[_0x72d1('0x2e')]({'acwtime':_0x5cec3f},_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2f')],_0x491af4)['then'](function(_0x244f4a){logger[_0x72d1('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x23a238,_0x5cec3f,_0x244f4a);})[_0x72d1('0x30')](function(_0x750de6){logger[_0x72d1('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x23a238,_0x750de6);});delete _0x8d458[_0x72d1('0x8')][_0x491af4];};}});}else{logger['info'](_0x72d1('0x32'),_0x23a238,_0x491af4,_0x3885b2);}});}})[_0x72d1('0x30')](function(_0x23418d){logger[_0x72d1('0x31')](_0x72d1('0x33'),_0x23a238,_0x8d458[_0x72d1('0x6')][_0x3885b2][_0x72d1('0x27')],_0x491af4,_0x3885b2);})[_0x72d1('0x34')](function(){delete _0x8d458[_0x72d1('0x1a')][_0x23a238];});}catch(_0x24be04){logger[_0x72d1('0x31')]('[ACW][START]\x20%s',_0x24be04[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0x29')]=function(_0x325209){try{var _0x49e074=this;if(_0x49e074[_0x72d1('0x8')][_0x325209]){_0x49e074[_0x72d1('0x8')][_0x325209][_0x72d1('0x28')]=![];var _0x4fb07b=_0x49e074[_0x72d1('0x8')][_0x325209][_0x72d1('0x2f')];var _0x163538=_0x49e074['timers'][_0x325209][_0x72d1('0x36')];var _0x117440=_0x49e074[_0x72d1('0x6')][_0x163538]['acwTimeout'];logger[_0x72d1('0x26')](_0x72d1('0x37'),_0x325209);RpcUser[_0x72d1('0x38')](this[_0x72d1('0x7')][_0x325209]);RpcVoiceAgentReport[_0x72d1('0x2e')]({'acwtime':_0x117440,'agentacw':!![]},_0x4fb07b,_0x325209)[_0x72d1('0x25')](function(_0xd7ec0f){logger['info'](_0x72d1('0x39'),_0x4fb07b,_0x117440,_0xd7ec0f);})[_0x72d1('0x30')](function(_0x440ac5){logger[_0x72d1('0x31')](_0x72d1('0x3a'),_0x4fb07b,_0x440ac5);});}else{logger[_0x72d1('0x31')](_0x72d1('0x3b'),_0x325209);if(_0x49e074[_0x72d1('0x8')]){logger['info'](_0x72d1('0x3c'),JSON[_0x72d1('0x3d')](_0x49e074[_0x72d1('0x8')]));}}}catch(_0x1d6704){logger[_0x72d1('0x31')](_0x72d1('0x3e'),_0x1d6704[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')]['syncAgentConnect']=function(_0x563c5a){try{if(this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]&&(this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]['acw']||this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]['mandatoryDisposition'])){if(this[_0x72d1('0x7')][_0x563c5a['interface']]){this[_0x72d1('0x1a')][_0x563c5a[_0x72d1('0x2f')]]={'queue':_0x563c5a['queue'],'interface':_0x563c5a[_0x72d1('0x3f')],'destlinkedid':_0x563c5a['destlinkedid']};}}}catch(_0x527223){logger['error'](_0x72d1('0x40'),_0x527223['message']);}};Acw[_0x72d1('0x18')][_0x72d1('0x14')]=function(_0x28332b){try{if(this['voiceQueues'][_0x28332b['queue']]&&(this[_0x72d1('0x6')][_0x28332b['queue']]['acw']||this[_0x72d1('0x6')][_0x28332b[_0x72d1('0x36')]][_0x72d1('0x1b')])){if(this['agents'][_0x28332b['interface']]){this['channels'][_0x28332b['uniqueid']]={'queue':_0x28332b[_0x72d1('0x36')],'interface':_0x28332b[_0x72d1('0x3f')]};}}}catch(_0x197483){logger[_0x72d1('0x31')](_0x72d1('0x41'),_0x197483[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0xc')]=function(_0x1e2c11){try{if(this['channels'][_0x1e2c11[_0x72d1('0x2f')]]&&_[_0x72d1('0x42')](this[_0x72d1('0x1a')][_0x1e2c11['uniqueid']][_0x72d1('0x22')])){logger[_0x72d1('0x26')](_0x72d1('0x43'),_0x1e2c11['uniqueid']);this[_0x72d1('0x19')](_0x1e2c11[_0x72d1('0x2f')]);}else if(this[_0x72d1('0x1a')][_0x1e2c11[_0x72d1('0x44')]]&&_['isUndefined'](this['channels'][_0x1e2c11[_0x72d1('0x44')]][_0x72d1('0x22')])){logger[_0x72d1('0x26')]('[%s][HANGUP:LINKEDID]',_0x1e2c11[_0x72d1('0x44')]);this[_0x72d1('0x19')](_0x1e2c11[_0x72d1('0x44')]);}}catch(_0x463670){logger[_0x72d1('0x31')](_0x72d1('0x45'),_0x463670[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0x46')]=function(_0x18f986){try{if(this[_0x72d1('0x1a')][_0x18f986['uniqueid']]&&this[_0x72d1('0x1a')][_0x18f986['uniqueid']]['attended']){logger[_0x72d1('0x26')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x18f986[_0x72d1('0x2f')]);this[_0x72d1('0x19')](_0x18f986[_0x72d1('0x2f')]);}else if(this[_0x72d1('0x1a')][_0x18f986[_0x72d1('0x44')]]&&this[_0x72d1('0x1a')][_0x18f986[_0x72d1('0x44')]][_0x72d1('0x22')]){logger[_0x72d1('0x26')](_0x72d1('0x47'),_0x18f986[_0x72d1('0x44')]);this['startAcw'](_0x18f986[_0x72d1('0x44')]);}}catch(_0x3da39a){logger[_0x72d1('0x31')]('[ACW][syncHangup]\x20%s',_0x3da39a['message']);}};Acw[_0x72d1('0x18')][_0x72d1('0x11')]=function(_0x16e9e7){try{if(!_[_0x72d1('0x48')](this[_0x72d1('0x1a')][_0x16e9e7['transfereeuniqueid']])){this[_0x72d1('0x19')](_0x16e9e7['transfereeuniqueid']);if(this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]]){this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]][_0x72d1('0x22')]=!![];this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4a')]]=this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]];delete this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]];}}else if(!_[_0x72d1('0x48')](this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4a')]])){this[_0x72d1('0x19')](_0x16e9e7[_0x72d1('0x4a')]);if(this[_0x72d1('0x1a')][_0x16e9e7['origtransfereruniqueid']]){this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4b')]][_0x72d1('0x22')]=!![];this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4c')]]=this[_0x72d1('0x1a')][_0x16e9e7['origtransfereruniqueid']];delete this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4b')]];}}}catch(_0xb05cd9){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0xb05cd9[_0x72d1('0x35')]);}};Acw['prototype'][_0x72d1('0x13')]=function(_0x359176){try{if(this[_0x72d1('0x1a')][_0x359176[_0x72d1('0x4d')]]){logger[_0x72d1('0x26')](_0x72d1('0x4e'),JSON[_0x72d1('0x3d')](_0x359176[_0x72d1('0x4d')]));this[_0x72d1('0x19')](_0x359176['transfereruniqueid']);}else if(this['channels'][_0x359176[_0x72d1('0x4f')]]){logger[_0x72d1('0x26')](_0x72d1('0x50'),JSON['stringify'](_0x359176[_0x72d1('0x4f')]));this[_0x72d1('0x19')](_0x359176['transfererlinkedid']);}}catch(_0x39d7f9){logger[_0x72d1('0x31')](_0x72d1('0x51'),_0x39d7f9[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0xf')]=function(_0x102574){try{if(this[_0x72d1('0x6')][_0x102574[_0x72d1('0x36')]]&&this[_0x72d1('0x6')][_0x102574[_0x72d1('0x36')]][_0x72d1('0x52')]==='all'){if(this['agents'][_0x102574[_0x72d1('0x3f')]]){logger[_0x72d1('0x26')](_0x72d1('0x53'),_0x102574[_0x72d1('0x2f')],_0x102574[_0x72d1('0x3f')],_0x102574[_0x72d1('0x36')]);return RpcUser[_0x72d1('0x24')](this[_0x72d1('0x7')][_0x102574['interface']],_0x72d1('0x54'),_0x102574['uniqueid']);}}}catch(_0x475016){logger[_0x72d1('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x475016['message']);}};module[_0x72d1('0x55')]=Acw; \ No newline at end of file +var _0x33c5=['Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x33c5,0xe6));var _0x533c=function(_0x53d3b0,_0x62aa42){_0x53d3b0=_0x53d3b0-0x0;var _0x44f608=_0x33c5[_0x53d3b0];return _0x44f608;};'use strict';var util=require('util');var _=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var ami=require('../ami');var logger=require(_0x533c('0x2'))(_0x533c('0x3'));var RpcUser=require(_0x533c('0x4'));var RpcVoiceAgentReport=require(_0x533c('0x5'));function Acw(_0x358127){this['voiceQueues']=_0x358127[_0x533c('0x6')];this[_0x533c('0x7')]=_0x358127[_0x533c('0x7')];this[_0x533c('0x8')]=_0x358127[_0x533c('0x8')];this[_0x533c('0x9')]={};ami['on'](_0x533c('0xa'),this[_0x533c('0xb')][_0x533c('0xc')](this));ami['on'](_0x533c('0xd'),this[_0x533c('0xe')][_0x533c('0xc')](this));ami['on'](_0x533c('0xf'),this[_0x533c('0x10')][_0x533c('0xc')](this));ami['on'](_0x533c('0x11'),this['syncAgentRingNoAnswer'][_0x533c('0xc')](this));ami['on'](_0x533c('0x12'),this[_0x533c('0x13')][_0x533c('0xc')](this));ami['on'](_0x533c('0x14'),this[_0x533c('0x15')]['bind'](this));ami['on'](_0x533c('0x16'),this[_0x533c('0x17')][_0x533c('0xc')](this));}function getDiff(_0x12ecae){var _0x2d5bc8=moment()[_0x533c('0x18')](0x0);var _0x8d7c66=moment(_0x12ecae)[_0x533c('0x18')](0x0);return _0x2d5bc8['diff'](_0x8d7c66,_0x533c('0x19'));}Acw[_0x533c('0x1a')][_0x533c('0x1b')]=function(_0x3e544f){try{var _0x56dfb7=this;var _0x1031e7=this[_0x533c('0x9')][_0x3e544f][_0x533c('0x1c')];var _0x311700=this[_0x533c('0x9')][_0x3e544f][_0x533c('0x1d')];var _0x1f0a72=this[_0x533c('0x6')][_0x311700];var _0x1f9f85=![];var _0x12e126=_0x533c('0x1e');if(_0x1f0a72[_0x533c('0x1f')]){if(_0x1f0a72[_0x533c('0x20')][_0x533c('0x21')]){_0x1f9f85=!![];_0x12e126=_0x1f0a72[_0x533c('0x20')][_0x533c('0x21')];}}ami[_0x533c('0x22')]({'action':_0x533c('0x23'),'interface':_0x1031e7,'paused':!![],'reason':_0x12e126})['then'](function(_0xce8d9){if(_0x56dfb7['agents'][_0x1031e7]){return RpcUser['getAgent'](_0x56dfb7[_0x533c('0x7')][_0x1031e7]['id'])[_0x533c('0x24')](function(_0x5f5090){if(_0x5f5090&&!_0x5f5090[_0x533c('0x25')]){logger[_0x533c('0x26')](_0x533c('0x27'),_0x3e544f,_0x1031e7,_0x311700);var _0x3dd249=_0x56dfb7['channels'][_0x3e544f][_0x533c('0x28')]&&_0x56dfb7[_0x533c('0x9')][_0x3e544f][_0x533c('0x29')]?_0x56dfb7[_0x533c('0x9')][_0x3e544f][_0x533c('0x29')]:_0x3e544f;return RpcUser[_0x533c('0x2a')](_0x56dfb7[_0x533c('0x7')][_0x1031e7],_0x12e126,_0x3dd249)[_0x533c('0x24')](function(_0xb1c937){if(!_0x1f9f85){_0x56dfb7[_0x533c('0x8')][_0x1031e7]={};logger['info'](_0x533c('0x2b'),_0x3e544f,_0x56dfb7[_0x533c('0x6')][_0x311700]['acwTimeout'],_0x1031e7,_0x311700);_0x56dfb7[_0x533c('0x8')][_0x1031e7]['timer']=setTimeout(_0x56dfb7[_0x533c('0x2c')][_0x533c('0xc')](_0x56dfb7,_0x1031e7),_0x56dfb7[_0x533c('0x6')][_0x311700][_0x533c('0x2d')]*0x3e8);_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x2e')]=moment()[_0x533c('0x2f')](_0x533c('0x30'));_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x31')]=_0x3e544f;_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x1d')]=_0x311700;_0x56dfb7['timers'][_0x1031e7][_0x533c('0x32')]=function(){var _0x591499=getDiff(_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x2e')]);clearTimeout(_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x33')]);_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x33')]=![];RpcVoiceAgentReport[_0x533c('0x34')]({'acwtime':_0x591499},_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x31')],_0x1031e7)[_0x533c('0x24')](function(_0x1bbcb7){logger[_0x533c('0x26')](_0x533c('0x35'),_0x3e544f,_0x591499,_0x1bbcb7);})[_0x533c('0x36')](function(_0x3803d0){logger['error'](_0x533c('0x37'),_0x3e544f,_0x3803d0);});delete _0x56dfb7[_0x533c('0x8')][_0x1031e7];};}});}else{logger[_0x533c('0x26')](_0x533c('0x38'),_0x3e544f,_0x1031e7,_0x311700);}});}})['catch'](function(_0x3f1db9){logger[_0x533c('0x39')](_0x533c('0x2b'),_0x3e544f,_0x56dfb7[_0x533c('0x6')][_0x311700][_0x533c('0x2d')],_0x1031e7,_0x311700);})['finally'](function(){delete _0x56dfb7['channels'][_0x3e544f];});}catch(_0x538bc0){logger['error']('[ACW][START]\x20%s',_0x538bc0[_0x533c('0x3a')]);}};Acw['prototype'][_0x533c('0x2c')]=function(_0x55726a){try{var _0x34243d=this;if(_0x34243d[_0x533c('0x8')][_0x55726a]){_0x34243d[_0x533c('0x8')][_0x55726a]['timer']=![];var _0x44a18d=_0x34243d[_0x533c('0x8')][_0x55726a][_0x533c('0x31')];var _0x55b010=_0x34243d[_0x533c('0x8')][_0x55726a][_0x533c('0x1d')];var _0x30e5eb=_0x34243d['voiceQueues'][_0x55b010][_0x533c('0x2d')];logger[_0x533c('0x26')](_0x533c('0x3b'),_0x55726a);RpcUser[_0x533c('0x3c')](this[_0x533c('0x7')][_0x55726a]);RpcVoiceAgentReport[_0x533c('0x34')]({'acwtime':_0x30e5eb,'agentacw':!![]},_0x44a18d,_0x55726a)[_0x533c('0x24')](function(_0x2dbd81){logger[_0x533c('0x26')](_0x533c('0x35'),_0x44a18d,_0x30e5eb,_0x2dbd81);})[_0x533c('0x36')](function(_0x55af6e){logger[_0x533c('0x39')](_0x533c('0x37'),_0x44a18d,_0x55af6e);});}else{logger[_0x533c('0x39')](_0x533c('0x3d'),_0x55726a);if(_0x34243d[_0x533c('0x8')]){logger[_0x533c('0x26')]('[ACW][TIMERS]',JSON[_0x533c('0x3e')](_0x34243d[_0x533c('0x8')]));}}}catch(_0x41f5a2){logger['error'](_0x533c('0x3f'),_0x41f5a2[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0xb')]=function(_0x502a67){try{if(this[_0x533c('0x6')][_0x502a67['queue']]&&(this[_0x533c('0x6')][_0x502a67[_0x533c('0x1d')]]['acw']||this[_0x533c('0x6')][_0x502a67[_0x533c('0x1d')]][_0x533c('0x1f')])){if(this['agents'][_0x502a67['interface']]){this['channels'][_0x502a67['uniqueid']]={'queue':_0x502a67[_0x533c('0x1d')],'interface':_0x502a67['interface'],'destlinkedid':_0x502a67[_0x533c('0x29')]};}}}catch(_0x503852){logger[_0x533c('0x39')]('[ACW][syncAgentConnect]\x20%s',_0x503852[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')]['syncAgentConnectPreview']=function(_0x132e42){try{if(this[_0x533c('0x6')][_0x132e42[_0x533c('0x1d')]]&&(this[_0x533c('0x6')][_0x132e42[_0x533c('0x1d')]]['acw']||this[_0x533c('0x6')][_0x132e42[_0x533c('0x1d')]][_0x533c('0x1f')])){if(this[_0x533c('0x7')][_0x132e42['interface']]){this[_0x533c('0x9')][_0x132e42[_0x533c('0x31')]]={'queue':_0x132e42['queue'],'interface':_0x132e42['interface']};}}}catch(_0x1dc963){logger['error'](_0x533c('0x40'),_0x1dc963[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0xe')]=function(_0xe9354a){try{if(this[_0x533c('0x9')][_0xe9354a[_0x533c('0x31')]]&&_[_0x533c('0x41')](this['channels'][_0xe9354a[_0x533c('0x31')]][_0x533c('0x28')])){logger[_0x533c('0x26')]('[%s][HANGUP:UNIQUEID]',_0xe9354a[_0x533c('0x31')]);this[_0x533c('0x1b')](_0xe9354a['uniqueid']);}else if(this[_0x533c('0x9')][_0xe9354a['linkedid']]&&_[_0x533c('0x41')](this[_0x533c('0x9')][_0xe9354a[_0x533c('0x42')]][_0x533c('0x28')])){logger[_0x533c('0x26')](_0x533c('0x43'),_0xe9354a[_0x533c('0x42')]);this['startAcw'](_0xe9354a[_0x533c('0x42')]);}}catch(_0x24c2f4){logger[_0x533c('0x39')](_0x533c('0x44'),_0x24c2f4[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0x10')]=function(_0x50d5a2){try{if(this['channels'][_0x50d5a2['uniqueid']]&&this['channels'][_0x50d5a2[_0x533c('0x31')]][_0x533c('0x28')]){logger['info'](_0x533c('0x45'),_0x50d5a2[_0x533c('0x31')]);this[_0x533c('0x1b')](_0x50d5a2['uniqueid']);}else if(this[_0x533c('0x9')][_0x50d5a2['linkedid']]&&this['channels'][_0x50d5a2[_0x533c('0x42')]][_0x533c('0x28')]){logger[_0x533c('0x26')](_0x533c('0x46'),_0x50d5a2[_0x533c('0x42')]);this[_0x533c('0x1b')](_0x50d5a2[_0x533c('0x42')]);}}catch(_0x51190c){logger[_0x533c('0x39')]('[ACW][syncHangup]\x20%s',_0x51190c[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0x13')]=function(_0x2c7600){try{if(!_[_0x533c('0x47')](this[_0x533c('0x9')][_0x2c7600[_0x533c('0x48')]])){this[_0x533c('0x1b')](_0x2c7600['transfereeuniqueid']);if(this[_0x533c('0x9')][_0x2c7600[_0x533c('0x49')]]){this[_0x533c('0x9')][_0x2c7600[_0x533c('0x49')]][_0x533c('0x28')]=!![];this[_0x533c('0x9')][_0x2c7600['transfertargetuniqueid']]=this[_0x533c('0x9')][_0x2c7600['secondtransfereruniqueid']];delete this[_0x533c('0x9')][_0x2c7600[_0x533c('0x49')]];}}else if(!_[_0x533c('0x47')](this[_0x533c('0x9')][_0x2c7600[_0x533c('0x4a')]])){this[_0x533c('0x1b')](_0x2c7600['transfertargetuniqueid']);if(this['channels'][_0x2c7600[_0x533c('0x4b')]]){this[_0x533c('0x9')][_0x2c7600[_0x533c('0x4b')]][_0x533c('0x28')]=!![];this['channels'][_0x2c7600[_0x533c('0x48')]]=this[_0x533c('0x9')][_0x2c7600[_0x533c('0x4b')]];delete this[_0x533c('0x9')][_0x2c7600[_0x533c('0x4b')]];}}}catch(_0x2f2863){logger[_0x533c('0x39')](_0x533c('0x4c'),_0x2f2863[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0x15')]=function(_0xb8a24b){try{if(this[_0x533c('0x9')][_0xb8a24b[_0x533c('0x4d')]]){logger[_0x533c('0x26')](_0x533c('0x4e'),JSON[_0x533c('0x3e')](_0xb8a24b['transfereruniqueid']));this[_0x533c('0x1b')](_0xb8a24b['transfereruniqueid']);}else if(this['channels'][_0xb8a24b[_0x533c('0x4f')]]){logger[_0x533c('0x26')](_0x533c('0x50'),JSON[_0x533c('0x3e')](_0xb8a24b[_0x533c('0x4f')]));this[_0x533c('0x1b')](_0xb8a24b[_0x533c('0x4f')]);}}catch(_0x50df3a){logger[_0x533c('0x39')](_0x533c('0x51'),_0x50df3a['message']);}};Acw[_0x533c('0x1a')][_0x533c('0x52')]=function(_0x8174d0){try{if(this[_0x533c('0x6')][_0x8174d0['queue']]&&this[_0x533c('0x6')][_0x8174d0[_0x533c('0x1d')]]['autopause']===_0x533c('0x53')){if(this[_0x533c('0x7')][_0x8174d0['interface']]){logger[_0x533c('0x26')](_0x533c('0x54'),_0x8174d0['uniqueid'],_0x8174d0[_0x533c('0x1c')],_0x8174d0['queue']);return RpcUser['savePause'](this[_0x533c('0x7')][_0x8174d0[_0x533c('0x1c')]],_0x533c('0x55'),_0x8174d0[_0x533c('0x31')]);}}}catch(_0x5f233c){logger[_0x533c('0x39')](_0x533c('0x56'),_0x5f233c[_0x533c('0x3a')]);}};module[_0x533c('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f7d6801..4ff5bbe 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 _0xe881=['Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','close','exports','asterisk-manager','moment','util','lodash','ami','asterisk','port','username','password','keepConnected','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','Action','actionDeviceStateList','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0xe881,0x1af));var _0x1e88=function(_0x29a134,_0x194c27){_0x29a134=_0x29a134-0x0;var _0x136398=_0xe881[_0x29a134];return _0x136398;};'use strict';var Manager=require(_0x1e88('0x0'));var BPromise=require('bluebird');var moment=require(_0x1e88('0x1'));var util=require(_0x1e88('0x2'));var _=require(_0x1e88('0x3'));var logger=require('../../config/logger')(_0x1e88('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x1e88('0x5')][_0x1e88('0x6')],config[_0x1e88('0x5')]['ip'],config['asterisk'][_0x1e88('0x7')],config[_0x1e88('0x5')][_0x1e88('0x8')],!![]);ami[_0x1e88('0x9')]();ami['Action']=BPromise['promisify'](ami[_0x1e88('0xa')]);function error(_0x3f3590){logger[_0x1e88('0xb')](util[_0x1e88('0xc')](_0x1e88('0xd'),config['asterisk'][_0x1e88('0x7')],config[_0x1e88('0x5')]['ip'],config[_0x1e88('0x5')]['port'],util[_0x1e88('0xe')](_0x3f3590,![],null)));}function close(){logger[_0x1e88('0xb')](util[_0x1e88('0xc')](_0x1e88('0xf'),config[_0x1e88('0x5')][_0x1e88('0x7')],config[_0x1e88('0x5')]['ip'],config[_0x1e88('0x5')][_0x1e88('0x6')]));}ami[_0x1e88('0x10')]=function(){return function(){return ami[_0x1e88('0x11')]({'action':'sipshowregistry'});};};ami[_0x1e88('0x12')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x1e88('0x13')]=function(){return function(){return ami[_0x1e88('0x11')]({'action':'sippeerstatus'});};};ami[_0x1e88('0x14')]=function(){return function(){return ami['Action']({'action':_0x1e88('0x15')});};};ami[_0x1e88('0x16')]=function(){return function(){return ami[_0x1e88('0x11')]({'action':'coreshowchannels'});};};function connect(_0x322ded){logger[_0x1e88('0x17')](util['format'](_0x1e88('0x18'),config[_0x1e88('0x5')][_0x1e88('0x7')],config[_0x1e88('0x5')]['ip'],config[_0x1e88('0x5')][_0x1e88('0x6')]));ami['once'](_0x1e88('0xb'),error);ami[_0x1e88('0x19')]('close',close);}ami['on']('connect',connect);ami['on'](_0x1e88('0x1a'),function(_0xc217b2){logger[_0x1e88('0x17')](util[_0x1e88('0xc')](_0x1e88('0x1b'),config[_0x1e88('0x5')]['username'],config[_0x1e88('0x5')]['ip'],config[_0x1e88('0x5')][_0x1e88('0x6')],util[_0x1e88('0xe')](_0xc217b2,![],null)));});ami['on']('fullybooted',function(_0x4d5793){logger[_0x1e88('0x17')](util[_0x1e88('0xc')](_0x1e88('0x1c'),config[_0x1e88('0x5')][_0x1e88('0x7')],config[_0x1e88('0x5')]['ip'],config[_0x1e88('0x5')]['port']));return BPromise[_0x1e88('0x1d')]()[_0x1e88('0x1e')](ami[_0x1e88('0x10')]())[_0x1e88('0x1e')](ami['actionDeviceStateList']())[_0x1e88('0x1e')](ami[_0x1e88('0x13')]())[_0x1e88('0x1e')](ami[_0x1e88('0x14')]())['then'](ami[_0x1e88('0x16')]())[_0x1e88('0x1f')](function(_0x2da444){console[_0x1e88('0x20')](_0x2da444);});});ami[_0x1e88('0x19')]('error',error);ami[_0x1e88('0x19')](_0x1e88('0x21'),close);module[_0x1e88('0x22')]=ami; \ No newline at end of file +var _0xe96f=['exports','asterisk-manager','bluebird','moment','util','../../config/logger','asterisk','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','actionSipShowRegistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','username','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList'];(function(_0xee2ff7,_0x19a2fe){var _0x23ea75=function(_0x4bae01){while(--_0x4bae01){_0xee2ff7['push'](_0xee2ff7['shift']());}};_0x23ea75(++_0x19a2fe);}(_0xe96f,0xb5));var _0xfe96=function(_0x2273ba,_0x326011){_0x2273ba=_0x2273ba-0x0;var _0x2415b3=_0xe96f[_0x2273ba];return _0x2415b3;};'use strict';var Manager=require(_0xfe96('0x0'));var BPromise=require(_0xfe96('0x1'));var moment=require(_0xfe96('0x2'));var util=require(_0xfe96('0x3'));var _=require('lodash');var logger=require(_0xfe96('0x4'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0xfe96('0x5')]['port'],config['asterisk']['ip'],config[_0xfe96('0x5')]['username'],config[_0xfe96('0x5')][_0xfe96('0x6')],!![]);ami[_0xfe96('0x7')]();ami[_0xfe96('0x8')]=BPromise[_0xfe96('0x9')](ami[_0xfe96('0xa')]);function error(_0xed6dbe){logger[_0xfe96('0xb')](util[_0xfe96('0xc')](_0xfe96('0xd'),config['asterisk']['username'],config[_0xfe96('0x5')]['ip'],config[_0xfe96('0x5')][_0xfe96('0xe')],util[_0xfe96('0xf')](_0xed6dbe,![],null)));}function close(){logger['error'](util[_0xfe96('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xfe96('0x5')]['username'],config['asterisk']['ip'],config[_0xfe96('0x5')]['port']));}ami[_0xfe96('0x10')]=function(){return function(){return ami[_0xfe96('0x8')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xfe96('0x8')]({'action':'devicestatelist'});};};ami[_0xfe96('0x11')]=function(){return function(){return ami[_0xfe96('0x8')]({'action':_0xfe96('0x12')});};};ami[_0xfe96('0x13')]=function(){return function(){return ami[_0xfe96('0x8')]({'action':_0xfe96('0x14')});};};ami[_0xfe96('0x15')]=function(){return function(){return ami[_0xfe96('0x8')]({'action':'coreshowchannels'});};};function connect(_0x308f54){logger[_0xfe96('0x16')](util[_0xfe96('0xc')](_0xfe96('0x17'),config[_0xfe96('0x5')][_0xfe96('0x18')],config[_0xfe96('0x5')]['ip'],config[_0xfe96('0x5')]['port']));ami[_0xfe96('0x19')](_0xfe96('0xb'),error);ami['once'](_0xfe96('0x1a'),close);}ami['on'](_0xfe96('0x1b'),connect);ami['on'](_0xfe96('0x1c'),function(_0x2294d1){logger[_0xfe96('0x16')](util[_0xfe96('0xc')](_0xfe96('0x1d'),config[_0xfe96('0x5')]['username'],config[_0xfe96('0x5')]['ip'],config['asterisk'][_0xfe96('0xe')],util[_0xfe96('0xf')](_0x2294d1,![],null)));});ami['on'](_0xfe96('0x1e'),function(_0x37ddc3){logger[_0xfe96('0x16')](util[_0xfe96('0xc')](_0xfe96('0x1f'),config[_0xfe96('0x5')][_0xfe96('0x18')],config[_0xfe96('0x5')]['ip'],config[_0xfe96('0x5')]['port']));return BPromise[_0xfe96('0x20')]()[_0xfe96('0x21')](ami[_0xfe96('0x10')]())[_0xfe96('0x21')](ami[_0xfe96('0x22')]())['then'](ami[_0xfe96('0x11')]())[_0xfe96('0x21')](ami[_0xfe96('0x13')]())['then'](ami[_0xfe96('0x15')]())['catch'](function(_0x45dd65){console['log'](_0x45dd65);});});ami[_0xfe96('0x19')](_0xfe96('0xb'),error);ami[_0xfe96('0x19')](_0xfe96('0x1a'),close);module[_0xfe96('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 9302081..cca8616 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 _0x55c0=['error','message','result','catch','exports','bluebird','../../config/logger','ami','client','http','request','then','rpc','memberReport'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0x55c0,0x10f));var _0x055c=function(_0x21cbcd,_0x4ba851){_0x21cbcd=_0x21cbcd-0x0;var _0x59a138=_0x55c0[_0x21cbcd];return _0x59a138;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x055c('0x0'));var logger=require(_0x055c('0x1'))(_0x055c('0x2'));var client=jayson[_0x055c('0x3')][_0x055c('0x4')]({'port':0x2329});client['Request']=function(_0x18dd15,_0x3e3d5e){return new BPromise(function(_0x593133,_0x1d7560){return client[_0x055c('0x5')](_0x18dd15,_0x3e3d5e)[_0x055c('0x6')](function(_0xcbd820){logger['debug'](_0x055c('0x7'),_0x055c('0x8'),_0x18dd15,_0x3e3d5e,_0xcbd820);if(_0xcbd820[_0x055c('0x9')]){logger['error'](_0x055c('0x7'),_0x055c('0x8'),_0x18dd15,_0xcbd820[_0x055c('0x9')][_0x055c('0xa')],_0x3e3d5e);return _0x1d7560(_0xcbd820['error']['message']);}else{return _0x593133(_0xcbd820[_0x055c('0xb')]);}})[_0x055c('0xc')](function(_0x339c0e){logger['error'](_0x055c('0x7'),_0x055c('0x8'),_0x18dd15,_0x339c0e,_0x3e3d5e);return _0x1d7560(_0x339c0e);});});};module[_0x055c('0xd')]=client; \ No newline at end of file +var _0xae18=['memberReport','error','rpc','message','result','exports','jayson/promise','bluebird','../../config/logger','ami','client','http','request','then'];(function(_0x322e2f,_0x21ba28){var _0xedcce2=function(_0x593029){while(--_0x593029){_0x322e2f['push'](_0x322e2f['shift']());}};_0xedcce2(++_0x21ba28);}(_0xae18,0xe6));var _0x8ae1=function(_0x78b7dd,_0x5d2ad1){_0x78b7dd=_0x78b7dd-0x0;var _0xf91e1d=_0xae18[_0x78b7dd];return _0xf91e1d;};'use strict';var jayson=require(_0x8ae1('0x0'));var BPromise=require(_0x8ae1('0x1'));var logger=require(_0x8ae1('0x2'))(_0x8ae1('0x3'));var client=jayson[_0x8ae1('0x4')][_0x8ae1('0x5')]({'port':0x2329});client['Request']=function(_0x4be52a,_0x255f4b){return new BPromise(function(_0x3bd02e,_0x3b522e){return client[_0x8ae1('0x6')](_0x4be52a,_0x255f4b)[_0x8ae1('0x7')](function(_0x238dd8){logger['debug']('rpc',_0x8ae1('0x8'),_0x4be52a,_0x255f4b,_0x238dd8);if(_0x238dd8['error']){logger[_0x8ae1('0x9')](_0x8ae1('0xa'),_0x8ae1('0x8'),_0x4be52a,_0x238dd8[_0x8ae1('0x9')][_0x8ae1('0xb')],_0x255f4b);return _0x3b522e(_0x238dd8['error']['message']);}else{return _0x3bd02e(_0x238dd8[_0x8ae1('0xc')]);}})['catch'](function(_0x4ae71a){logger[_0x8ae1('0x9')](_0x8ae1('0xa'),_0x8ae1('0x8'),_0x4be52a,_0x4ae71a,_0x255f4b);return _0x3b522e(_0x4ae71a);});});};module[_0x8ae1('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 233af54..4ce43e6 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 _0x2f8b=['VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','voiceQueue','getQueue','exports','util','lodash','isNil','string','uniqueid','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x17de72,_0x3981ec){var _0x3ecb59=function(_0x25c146){while(--_0x25c146){_0x17de72['push'](_0x17de72['shift']());}};_0x3ecb59(++_0x3981ec);}(_0x2f8b,0x96));var _0xb2f8=function(_0x1f9ee6,_0x7255cb){_0x1f9ee6=_0x1f9ee6-0x0;var _0x101b73=_0x2f8b[_0x1f9ee6];return _0x101b73;};'use strict';var util=require(_0xb2f8('0x0'));var _=require(_0xb2f8('0x1'));var moment=require('moment');function checkNameSurname(_0x245c31,_0x1df4e3,_0x3211f4){var _0x7e5e83='';if(!_[_0xb2f8('0x2')](_0x1df4e3)&&_0xb2f8('0x3')===typeof _0x1df4e3){_0x7e5e83+=_0x1df4e3;}if(!_[_0xb2f8('0x2')](_0x3211f4)&&'string'===typeof _0x3211f4){_0x7e5e83+='\x20'+_0x3211f4;}if(_0x7e5e83!==''){return _0x7e5e83;}return _0x245c31;}function Action(_0x2d4d99,_0x1e4cfa,_0x21b104){this['voiceQueue']=_0x2d4d99;this[_0xb2f8('0x4')]=_0x21b104||undefined;this['name']=checkNameSurname(_0x1e4cfa[_0xb2f8('0x5')][_0xb2f8('0x6')],_0x1e4cfa[_0xb2f8('0x5')][_0xb2f8('0x7')],_0x1e4cfa[_0xb2f8('0x5')][_0xb2f8('0x8')]);this[_0xb2f8('0x9')]=_0x1e4cfa['Contact'][_0xb2f8('0x6')];this[_0xb2f8('0xa')]=_0x2d4d99[_0xb2f8('0xb')];this[_0xb2f8('0xc')]=_0x1e4cfa[_0xb2f8('0xc')]||![];this[_0xb2f8('0xd')]=_0x2d4d99[_0xb2f8('0xd')];this[_0xb2f8('0xe')]=_0x2d4d99[_0xb2f8('0xe')]||0x3;this[_0xb2f8('0xf')]=_0x1e4cfa[_0xb2f8('0xf')];this[_0xb2f8('0x10')]=_0x1e4cfa[_0xb2f8('0x10')];this['countcongestionretry']=_0x1e4cfa['countcongestionretry'];this[_0xb2f8('0x11')]=_0x1e4cfa[_0xb2f8('0x11')];this['countnosuchnumberretry']=_0x1e4cfa[_0xb2f8('0x12')];this[_0xb2f8('0x13')]=_0x1e4cfa[_0xb2f8('0x13')];this[_0xb2f8('0x14')]=_0x1e4cfa['countabandonedretry'];this['countmachineretry']=_0x1e4cfa[_0xb2f8('0x15')];this[_0xb2f8('0x16')]=_0x1e4cfa['countagentrejectretry'];this[_0xb2f8('0x17')]=_0x1e4cfa[_0xb2f8('0x17')];this['ListId']=_0x1e4cfa[_0xb2f8('0x18')];this['UserId']=_0x1e4cfa[_0xb2f8('0x19')];this[_0xb2f8('0x1a')]=_0x1e4cfa[_0xb2f8('0x1a')];this[_0xb2f8('0x1b')]=_0x1e4cfa[_0xb2f8('0x1b')];this[_0xb2f8('0x1c')]=_0x1e4cfa['id'];this[_0xb2f8('0x1d')]=_0x1e4cfa[_0xb2f8('0x5')][_0xb2f8('0x7')]||'';this[_0xb2f8('0x1e')]=moment()['format'](_0xb2f8('0x1f'));this['callback']=_0x1e4cfa[_0xb2f8('0x20')];this[_0xb2f8('0x21')]=_0x1e4cfa[_0xb2f8('0x21')];this[_0xb2f8('0x22')]=_0x1e4cfa['callbackat'];this[_0xb2f8('0x23')]=_0x1e4cfa[_0xb2f8('0x23')];this[_0xb2f8('0x24')]='';this['originatecalleridname']='';}Action[_0xb2f8('0x25')]['getCaller']=function(){return util['format'](_0xb2f8('0x26'),this[_0xb2f8('0xb')],this['voiceQueue'][_0xb2f8('0x27')]>0x0?this[_0xb2f8('0x9')][_0xb2f8('0x28')](this[_0xb2f8('0x29')][_0xb2f8('0x27')]):this[_0xb2f8('0x9')]);};Action['prototype'][_0xb2f8('0x2a')]=function(){return this[_0xb2f8('0xa')];};module[_0xb2f8('0x2b')]=Action; \ No newline at end of file +var _0xa6e2=['\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','string','voiceQueue','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype'];(function(_0x3fba08,_0x31894a){var _0x54ff2f=function(_0x424a38){while(--_0x424a38){_0x3fba08['push'](_0x3fba08['shift']());}};_0x54ff2f(++_0x31894a);}(_0xa6e2,0x132));var _0x2a6e=function(_0x324219,_0x1ceb38){_0x324219=_0x324219-0x0;var _0xef373e=_0xa6e2[_0x324219];return _0xef373e;};'use strict';var util=require(_0x2a6e('0x0'));var _=require(_0x2a6e('0x1'));var moment=require('moment');function checkNameSurname(_0x144192,_0x1286dd,_0x314611){var _0x4e74b6='';if(!_['isNil'](_0x1286dd)&&_0x2a6e('0x2')===typeof _0x1286dd){_0x4e74b6+=_0x1286dd;}if(!_['isNil'](_0x314611)&&'string'===typeof _0x314611){_0x4e74b6+='\x20'+_0x314611;}if(_0x4e74b6!==''){return _0x4e74b6;}return _0x144192;}function Action(_0x2bb3fa,_0x17b0f4,_0x29fd48){this[_0x2a6e('0x3')]=_0x2bb3fa;this['uniqueid']=_0x29fd48||undefined;this[_0x2a6e('0x4')]=checkNameSurname(_0x17b0f4[_0x2a6e('0x5')]['phone'],_0x17b0f4[_0x2a6e('0x5')][_0x2a6e('0x6')],_0x17b0f4[_0x2a6e('0x5')][_0x2a6e('0x7')]);this[_0x2a6e('0x8')]=_0x17b0f4[_0x2a6e('0x5')][_0x2a6e('0x9')];this[_0x2a6e('0xa')]=_0x2bb3fa[_0x2a6e('0x4')];this[_0x2a6e('0xb')]=_0x17b0f4['active']||![];this[_0x2a6e('0xc')]=_0x2bb3fa['type'];this[_0x2a6e('0xd')]=_0x2bb3fa[_0x2a6e('0xd')]||0x3;this[_0x2a6e('0xe')]=_0x17b0f4[_0x2a6e('0xe')];this[_0x2a6e('0xf')]=_0x17b0f4[_0x2a6e('0xf')];this[_0x2a6e('0x10')]=_0x17b0f4['countcongestionretry'];this[_0x2a6e('0x11')]=_0x17b0f4[_0x2a6e('0x11')];this['countnosuchnumberretry']=_0x17b0f4[_0x2a6e('0x12')];this[_0x2a6e('0x13')]=_0x17b0f4[_0x2a6e('0x13')];this[_0x2a6e('0x14')]=_0x17b0f4['countabandonedretry'];this[_0x2a6e('0x15')]=_0x17b0f4[_0x2a6e('0x15')];this[_0x2a6e('0x16')]=_0x17b0f4[_0x2a6e('0x16')];this[_0x2a6e('0x17')]=_0x17b0f4['ContactId'];this[_0x2a6e('0x18')]=_0x17b0f4[_0x2a6e('0x18')];this[_0x2a6e('0x19')]=_0x17b0f4[_0x2a6e('0x19')];this[_0x2a6e('0x1a')]=_0x17b0f4[_0x2a6e('0x1a')];this['CampaignId']=_0x17b0f4[_0x2a6e('0x1b')];this[_0x2a6e('0x1c')]=_0x17b0f4['id'];this[_0x2a6e('0x1d')]=_0x17b0f4[_0x2a6e('0x5')][_0x2a6e('0x6')]||'';this[_0x2a6e('0x1e')]=moment()['format'](_0x2a6e('0x1f'));this[_0x2a6e('0x20')]=_0x17b0f4[_0x2a6e('0x20')];this[_0x2a6e('0x21')]=_0x17b0f4[_0x2a6e('0x21')];this['callbackat']=_0x17b0f4[_0x2a6e('0x22')];this['recallme']=_0x17b0f4[_0x2a6e('0x23')];this[_0x2a6e('0x24')]='';this['originatecalleridname']='';}Action[_0x2a6e('0x25')]['getCaller']=function(){return util['format'](_0x2a6e('0x26'),this[_0x2a6e('0x4')],this[_0x2a6e('0x3')][_0x2a6e('0x27')]>0x0?this[_0x2a6e('0x8')][_0x2a6e('0x28')](this[_0x2a6e('0x3')]['dialCutDigit']):this[_0x2a6e('0x8')]);};Action[_0x2a6e('0x25')][_0x2a6e('0x29')]=function(){return this[_0x2a6e('0xa')];};module[_0x2a6e('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 5e2d537..73357c6 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd358=['util','lodash','moment','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x361945,_0x5a1358){var _0x14e349=function(_0x3ecedf){while(--_0x3ecedf){_0x361945['push'](_0x361945['shift']());}};_0x14e349(++_0x5a1358);}(_0xd358,0xe4));var _0x8d35=function(_0x4e8f08,_0x3b2fb9){_0x4e8f08=_0x4e8f08-0x0;var _0x38aef4=_0xd358[_0x4e8f08];return _0x38aef4;};'use strict';var util=require(_0x8d35('0x0'));var _=require(_0x8d35('0x1'));var moment=require(_0x8d35('0x2'));function getSeconds(_0x2317a7,_0x407fba){var _0x2bdd88=moment(_0x2317a7)['milliseconds'](0x0);var _0x5dcc85=moment(_0x407fba)['milliseconds'](0x0);return _0x2bdd88[_0x8d35('0x3')](_0x5dcc85,'seconds');}function AdditionalPhone(_0x3ff0ce){this[_0x8d35('0x4')]=_0x3ff0ce[_0x8d35('0x4')];this[_0x8d35('0x5')]=_0x3ff0ce['scheduledat']||undefined;this[_0x8d35('0x6')]=_0x3ff0ce[_0x8d35('0x6')];this['campaigntype']=_0x3ff0ce[_0x8d35('0x6')]===_0x8d35('0x7')?_0x8d35('0x8'):_0x3ff0ce[_0x8d35('0x6')];this['countbusyretry']=_0x3ff0ce[_0x8d35('0x9')];this[_0x8d35('0xa')]=_0x3ff0ce[_0x8d35('0xa')];this[_0x8d35('0xb')]=_0x3ff0ce[_0x8d35('0xb')];this[_0x8d35('0xc')]=_0x3ff0ce[_0x8d35('0x9')]+_0x3ff0ce[_0x8d35('0xa')]+_0x3ff0ce[_0x8d35('0xb')]+_0x3ff0ce[_0x8d35('0xd')]+_0x3ff0ce[_0x8d35('0xe')]+_0x3ff0ce['countabandonedretry']+_0x3ff0ce['countmachineretry']+_0x3ff0ce[_0x8d35('0xf')];this[_0x8d35('0xd')]=_0x3ff0ce[_0x8d35('0xd')];this[_0x8d35('0xe')]=_0x3ff0ce['countdropretry'];this[_0x8d35('0x10')]=_0x3ff0ce[_0x8d35('0x10')];this[_0x8d35('0x11')]=_0x3ff0ce[_0x8d35('0x11')];this[_0x8d35('0xf')]=_0x3ff0ce[_0x8d35('0xf')];this[_0x8d35('0x8')]=_0x3ff0ce['queue'];this[_0x8d35('0x12')]=_0x3ff0ce[_0x8d35('0x13')];this['calleridnum']=_0x3ff0ce[_0x8d35('0x14')];this[_0x8d35('0x15')]=_0x3ff0ce[_0x8d35('0x15')];this['responsetime']=_0x3ff0ce[_0x8d35('0x16')];this[_0x8d35('0x17')]=_0x3ff0ce[_0x8d35('0x16')];this[_0x8d35('0x18')]=getSeconds(_0x3ff0ce[_0x8d35('0x16')],_0x3ff0ce['starttime']);this[_0x8d35('0x19')]=0x0;this[_0x8d35('0x1a')]=0x0;this[_0x8d35('0x1b')]=_0x3ff0ce[_0x8d35('0x1b')];this[_0x8d35('0x1c')]=_0x3ff0ce['callbackuniqueid'];this[_0x8d35('0x1d')]=_0x3ff0ce[_0x8d35('0x1d')];this[_0x8d35('0x1e')]=_0x3ff0ce[_0x8d35('0x1e')];this[_0x8d35('0x1f')]=_0x3ff0ce[_0x8d35('0x1f')];this[_0x8d35('0x20')]=_0x3ff0ce['ListId'];this['UserId']=_0x3ff0ce['UserId'];this[_0x8d35('0x21')]=_0x3ff0ce[_0x8d35('0x21')];this[_0x8d35('0x22')]=_0x3ff0ce[_0x8d35('0x22')];this[_0x8d35('0x23')]=_0x3ff0ce[_0x8d35('0x23')]||'';this[_0x8d35('0x24')]=_0x3ff0ce['originatecalleridname']||'';}module[_0x8d35('0x25')]=History; \ No newline at end of file +var _0x3e06=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type'];(function(_0x35e362,_0x38c9e2){var _0x5e9011=function(_0x53ccfd){while(--_0x53ccfd){_0x35e362['push'](_0x35e362['shift']());}};_0x5e9011(++_0x38c9e2);}(_0x3e06,0x13f));var _0x63e0=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3e06[_0xfae23b];return _0x200640;};'use strict';var util=require(_0x63e0('0x0'));var _=require(_0x63e0('0x1'));var moment=require(_0x63e0('0x2'));function getSeconds(_0x33ac53,_0x301610){var _0x56bd93=moment(_0x33ac53)[_0x63e0('0x3')](0x0);var _0x397494=moment(_0x301610)[_0x63e0('0x3')](0x0);return _0x56bd93[_0x63e0('0x4')](_0x397494,_0x63e0('0x5'));}function AdditionalPhone(_0x4e304d){this[_0x63e0('0x6')]=_0x4e304d[_0x63e0('0x6')];this[_0x63e0('0x7')]=_0x4e304d[_0x63e0('0x7')]||undefined;this['type']=_0x4e304d[_0x63e0('0x8')];this[_0x63e0('0x9')]=_0x4e304d['type']===_0x63e0('0xa')?_0x63e0('0xb'):_0x4e304d[_0x63e0('0x8')];this[_0x63e0('0xc')]=_0x4e304d[_0x63e0('0xc')];this[_0x63e0('0xd')]=_0x4e304d[_0x63e0('0xd')];this['countnoanswerretry']=_0x4e304d[_0x63e0('0xe')];this[_0x63e0('0xf')]=_0x4e304d['countbusyretry']+_0x4e304d[_0x63e0('0xd')]+_0x4e304d[_0x63e0('0xe')]+_0x4e304d[_0x63e0('0x10')]+_0x4e304d[_0x63e0('0x11')]+_0x4e304d[_0x63e0('0x12')]+_0x4e304d[_0x63e0('0x13')]+_0x4e304d[_0x63e0('0x14')];this[_0x63e0('0x10')]=_0x4e304d['countnosuchnumberretry'];this[_0x63e0('0x11')]=_0x4e304d[_0x63e0('0x11')];this[_0x63e0('0x12')]=_0x4e304d['countabandonedretry'];this['countmachineretry']=_0x4e304d['countmachineretry'];this[_0x63e0('0x14')]=_0x4e304d['countagentrejectretry'];this[_0x63e0('0xb')]=_0x4e304d['queue'];this[_0x63e0('0x15')]=_0x4e304d[_0x63e0('0x16')];this[_0x63e0('0x17')]=_0x4e304d['number'];this[_0x63e0('0x18')]=_0x4e304d[_0x63e0('0x18')];this[_0x63e0('0x19')]=_0x4e304d[_0x63e0('0x19')];this['endtime']=_0x4e304d['responsetime'];this[_0x63e0('0x1a')]=getSeconds(_0x4e304d['responsetime'],_0x4e304d['starttime']);this[_0x63e0('0x1b')]=0x0;this[_0x63e0('0x1c')]=0x0;this['callback']=_0x4e304d[_0x63e0('0x1d')];this['callbackuniqueid']=_0x4e304d[_0x63e0('0x1e')];this[_0x63e0('0x1f')]=_0x4e304d[_0x63e0('0x1f')];this['recallme']=_0x4e304d[_0x63e0('0x20')];this[_0x63e0('0x21')]=_0x4e304d[_0x63e0('0x21')];this[_0x63e0('0x22')]=_0x4e304d[_0x63e0('0x22')];this['UserId']=_0x4e304d[_0x63e0('0x23')];this[_0x63e0('0x24')]=_0x4e304d[_0x63e0('0x24')];this['CampaignId']=_0x4e304d[_0x63e0('0x25')];this[_0x63e0('0x26')]=_0x4e304d['originatecalleridnum']||'';this[_0x63e0('0x27')]=_0x4e304d[_0x63e0('0x27')]||'';}module[_0x63e0('0x28')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index a18f67a..24d8afe 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 _0x2ae2=['diff','seconds','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds'];(function(_0x4bd6c6,_0x1b70ff){var _0x26da74=function(_0x5ea217){while(--_0x5ea217){_0x4bd6c6['push'](_0x4bd6c6['shift']());}};_0x26da74(++_0x1b70ff);}(_0x2ae2,0x132));var _0x22ae=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x2ae2[_0x40df5f];return _0x1573f1;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x22ae('0x0'));function getSeconds(_0x11c509,_0x3250a8){var _0x55e40b=moment(_0x11c509)['milliseconds'](0x0);var _0x1324d9=moment(_0x3250a8)[_0x22ae('0x1')](0x0);return _0x55e40b[_0x22ae('0x2')](_0x1324d9,_0x22ae('0x3'));}function AgentComplete(_0x51ecae,_0x5eac93){this['state']=0x4;this[_0x22ae('0x4')]='Answer';this[_0x22ae('0x5')]=_0x51ecae[_0x22ae('0x5')];this[_0x22ae('0x6')]=_0x51ecae[_0x22ae('0x6')];this[_0x22ae('0x7')]=_0x51ecae[_0x22ae('0x6')]===_0x22ae('0x8')?'queue':_0x51ecae[_0x22ae('0x6')];this['countbusyretry']=_0x51ecae[_0x22ae('0x9')];this[_0x22ae('0xa')]=_0x51ecae[_0x22ae('0xa')];this[_0x22ae('0xb')]=_0x51ecae[_0x22ae('0xb')];this[_0x22ae('0xc')]=_0x51ecae[_0x22ae('0x9')]+_0x51ecae[_0x22ae('0xa')]+_0x51ecae[_0x22ae('0xb')]+_0x51ecae[_0x22ae('0xd')]+_0x51ecae[_0x22ae('0xe')]+_0x51ecae['countabandonedretry']+_0x51ecae[_0x22ae('0xf')]+_0x51ecae['countagentrejectretry'];this[_0x22ae('0xd')]=_0x51ecae['countnosuchnumberretry'];this[_0x22ae('0xe')]=_0x51ecae[_0x22ae('0xe')];this[_0x22ae('0x10')]=_0x51ecae[_0x22ae('0x10')];this[_0x22ae('0xf')]=_0x51ecae[_0x22ae('0xf')];this[_0x22ae('0x11')]=_0x51ecae[_0x22ae('0x11')];this[_0x22ae('0x12')]=_0x5eac93[_0x22ae('0x12')];this[_0x22ae('0x13')]=_0x51ecae[_0x22ae('0x14')];this['calleridnum']=_0x51ecae[_0x22ae('0x15')];this[_0x22ae('0x16')]=_0x51ecae[_0x22ae('0x16')];this[_0x22ae('0x17')]=_0x51ecae[_0x22ae('0x17')];this[_0x22ae('0x18')]=_0x51ecae[_0x22ae('0x18')];this[_0x22ae('0x19')]=moment()[_0x22ae('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x22ae('0x1b')]=getSeconds(_0x51ecae[_0x22ae('0x17')],_0x51ecae[_0x22ae('0x16')]);this[_0x22ae('0x1c')]=getSeconds(_0x51ecae[_0x22ae('0x18')],_0x51ecae[_0x22ae('0x17')]);this[_0x22ae('0x1d')]=getSeconds(this[_0x22ae('0x19')],_0x51ecae['answertime']);this[_0x22ae('0x1e')]=_0x5eac93[_0x22ae('0x1e')];this[_0x22ae('0x1f')]=_0x5eac93[_0x22ae('0x1f')];this['reason']=_0x5eac93[_0x22ae('0x20')];this[_0x22ae('0x21')]=_0x51ecae['callback'];this['callbackuniqueid']=_0x51ecae['callbackuniqueid'];this[_0x22ae('0x22')]=_0x51ecae[_0x22ae('0x22')];this[_0x22ae('0x23')]=_0x51ecae[_0x22ae('0x23')];this[_0x22ae('0x24')]=_0x51ecae['ContactId'];this[_0x22ae('0x25')]=_0x51ecae[_0x22ae('0x25')];this[_0x22ae('0x26')]=_0x51ecae['UserId'];this[_0x22ae('0x27')]=_0x51ecae['VoiceQueueId'];this[_0x22ae('0x28')]=_0x51ecae['CampaignId'];this[_0x22ae('0x29')]=_0x51ecae[_0x22ae('0x29')]||'';this[_0x22ae('0x2a')]=_0x51ecae['originatecalleridname']||'';}module[_0x22ae('0x2b')]=AgentComplete; \ No newline at end of file +var _0x665d=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','ringtime','holdtime','talktime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','util','moment','milliseconds','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countnoanswerretry','countglobal'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0x665d,0x144));var _0xd665=function(_0x47878f,_0x48d3bf){_0x47878f=_0x47878f-0x0;var _0x4b05b8=_0x665d[_0x47878f];return _0x4b05b8;};'use strict';var util=require(_0xd665('0x0'));var _=require('lodash');var moment=require(_0xd665('0x1'));function getSeconds(_0x346ef2,_0x52034f){var _0x10670e=moment(_0x346ef2)[_0xd665('0x2')](0x0);var _0x2f27ab=moment(_0x52034f)[_0xd665('0x2')](0x0);return _0x10670e['diff'](_0x2f27ab,'seconds');}function AgentComplete(_0x19b06f,_0x4bdcd8){this[_0xd665('0x3')]=0x4;this[_0xd665('0x4')]=_0xd665('0x5');this[_0xd665('0x6')]=_0x19b06f[_0xd665('0x6')];this['type']=_0x19b06f[_0xd665('0x7')];this['campaigntype']=_0x19b06f[_0xd665('0x7')]===_0xd665('0x8')?'queue':_0x19b06f[_0xd665('0x7')];this[_0xd665('0x9')]=_0x19b06f['countbusyretry'];this['countcongestionretry']=_0x19b06f['countcongestionretry'];this[_0xd665('0xa')]=_0x19b06f[_0xd665('0xa')];this[_0xd665('0xb')]=_0x19b06f[_0xd665('0x9')]+_0x19b06f['countcongestionretry']+_0x19b06f[_0xd665('0xa')]+_0x19b06f[_0xd665('0xc')]+_0x19b06f[_0xd665('0xd')]+_0x19b06f[_0xd665('0xe')]+_0x19b06f[_0xd665('0xf')]+_0x19b06f[_0xd665('0x10')];this['countnosuchnumberretry']=_0x19b06f[_0xd665('0xc')];this[_0xd665('0xd')]=_0x19b06f[_0xd665('0xd')];this[_0xd665('0xe')]=_0x19b06f[_0xd665('0xe')];this[_0xd665('0xf')]=_0x19b06f[_0xd665('0xf')];this['countagentrejectretry']=_0x19b06f[_0xd665('0x10')];this[_0xd665('0x11')]=_0x4bdcd8['uniqueid'];this[_0xd665('0x12')]=_0x19b06f[_0xd665('0x13')];this[_0xd665('0x14')]=_0x19b06f[_0xd665('0x15')];this['starttime']=_0x19b06f[_0xd665('0x16')];this['responsetime']=_0x19b06f[_0xd665('0x17')];this[_0xd665('0x18')]=_0x19b06f[_0xd665('0x18')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xd665('0x19')]=getSeconds(_0x19b06f[_0xd665('0x17')],_0x19b06f[_0xd665('0x16')]);this[_0xd665('0x1a')]=getSeconds(_0x19b06f[_0xd665('0x18')],_0x19b06f[_0xd665('0x17')]);this[_0xd665('0x1b')]=getSeconds(this[_0xd665('0x1c')],_0x19b06f[_0xd665('0x18')]);this[_0xd665('0x1d')]=_0x4bdcd8['queue'];this['membername']=_0x4bdcd8[_0xd665('0x1e')];this[_0xd665('0x1f')]=_0x4bdcd8['reason'];this['callback']=_0x19b06f[_0xd665('0x20')];this[_0xd665('0x21')]=_0x19b06f[_0xd665('0x21')];this[_0xd665('0x22')]=_0x19b06f[_0xd665('0x22')];this[_0xd665('0x23')]=_0x19b06f['recallme'];this['ContactId']=_0x19b06f[_0xd665('0x24')];this[_0xd665('0x25')]=_0x19b06f[_0xd665('0x25')];this[_0xd665('0x26')]=_0x19b06f['UserId'];this[_0xd665('0x27')]=_0x19b06f[_0xd665('0x27')];this['CampaignId']=_0x19b06f[_0xd665('0x28')];this[_0xd665('0x29')]=_0x19b06f['originatecalleridnum']||'';this['originatecalleridname']=_0x19b06f['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 46c4341..3e59b82 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 _0xd38f=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x51e1e7,_0x3a8896){var _0x1ba4f3=function(_0x5954d9){while(--_0x5954d9){_0x51e1e7['push'](_0x51e1e7['shift']());}};_0x1ba4f3(++_0x3a8896);}(_0xd38f,0x1a0));var _0xfd38=function(_0x38131b,_0x140809){_0x38131b=_0x38131b-0x0;var _0x3dcf55=_0xd38f[_0x38131b];return _0x3dcf55;};'use strict';var util=require(_0xfd38('0x0'));var _=require(_0xfd38('0x1'));var moment=require(_0xfd38('0x2'));function getSeconds(_0x2e7403,_0x5e12a2){var _0x42e307=moment(_0x2e7403)[_0xfd38('0x3')](0x0);var _0x4986fb=moment(_0x5e12a2)[_0xfd38('0x3')](0x0);return _0x42e307[_0xfd38('0x4')](_0x4986fb,_0xfd38('0x5'));}function Final(_0x2ac0b9){this[_0xfd38('0x6')]=_0x2ac0b9['uniqueid'];this[_0xfd38('0x7')]=_0x2ac0b9['scheduledat'];this[_0xfd38('0x8')]=_0x2ac0b9['type'];this[_0xfd38('0x9')]=_0x2ac0b9['type']===_0xfd38('0xa')?_0xfd38('0xb'):_0x2ac0b9['type'];this[_0xfd38('0xc')]=_0x2ac0b9[_0xfd38('0xc')];this[_0xfd38('0xd')]=_0x2ac0b9[_0xfd38('0xd')];this[_0xfd38('0xe')]=_0x2ac0b9['countnoanswerretry'];this['countglobal']=_0x2ac0b9[_0xfd38('0xc')]+_0x2ac0b9[_0xfd38('0xd')]+_0x2ac0b9['countnoanswerretry']+_0x2ac0b9[_0xfd38('0xf')]+_0x2ac0b9['countdropretry']+_0x2ac0b9[_0xfd38('0x10')]+_0x2ac0b9[_0xfd38('0x11')]+_0x2ac0b9['countagentrejectretry'];this[_0xfd38('0xf')]=_0x2ac0b9[_0xfd38('0xf')];this['countdropretry']=_0x2ac0b9[_0xfd38('0x12')];this['countabandonedretry']=_0x2ac0b9[_0xfd38('0x10')];this['countmachineretry']=_0x2ac0b9[_0xfd38('0x11')];this['countagentrejectretry']=_0x2ac0b9[_0xfd38('0x13')];this[_0xfd38('0xb')]=_0x2ac0b9[_0xfd38('0xb')];this[_0xfd38('0x14')]=_0x2ac0b9[_0xfd38('0x14')];this[_0xfd38('0x15')]=_0x2ac0b9[_0xfd38('0x15')];this['starttime']=_0x2ac0b9['starttime'];this['responsetime']=_0x2ac0b9[_0xfd38('0x16')];this[_0xfd38('0x17')]=_0x2ac0b9['responsetime'];this['ringtime']=_0x2ac0b9[_0xfd38('0x18')]||0x0;this[_0xfd38('0x19')]=_0x2ac0b9[_0xfd38('0x19')]||0x0;this['talktime']=_0x2ac0b9[_0xfd38('0x1a')]||0x0;this['callback']=_0x2ac0b9[_0xfd38('0x1b')];this[_0xfd38('0x1c')]=_0x2ac0b9['callbackuniqueid'];this[_0xfd38('0x1d')]=_0x2ac0b9[_0xfd38('0x1d')];this[_0xfd38('0x1e')]=_0x2ac0b9[_0xfd38('0x1e')];this[_0xfd38('0x1f')]=_0x2ac0b9['ContactId'];this[_0xfd38('0x20')]=_0x2ac0b9[_0xfd38('0x20')];this[_0xfd38('0x21')]=_0x2ac0b9[_0xfd38('0x21')];this[_0xfd38('0x22')]=_0x2ac0b9[_0xfd38('0x22')];this['CampaignId']=_0x2ac0b9[_0xfd38('0x23')];this[_0xfd38('0x24')]=_0x2ac0b9[_0xfd38('0x24')]||'';this[_0xfd38('0x25')]=_0x2ac0b9[_0xfd38('0x25')]||'';}module[_0xfd38('0x26')]=Final; \ No newline at end of file +var _0xbd96=['UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x40b4da,_0x4765f4){var _0x1c72b8=function(_0x13368a){while(--_0x13368a){_0x40b4da['push'](_0x40b4da['shift']());}};_0x1c72b8(++_0x4765f4);}(_0xbd96,0x152));var _0x6bd9=function(_0x23f98f,_0xcf4c1c){_0x23f98f=_0x23f98f-0x0;var _0x3b4758=_0xbd96[_0x23f98f];return _0x3b4758;};'use strict';var util=require(_0x6bd9('0x0'));var _=require(_0x6bd9('0x1'));var moment=require('moment');function getSeconds(_0x246e5a,_0x3bc5ea){var _0x4adb0c=moment(_0x246e5a)['milliseconds'](0x0);var _0x4869a4=moment(_0x3bc5ea)[_0x6bd9('0x2')](0x0);return _0x4adb0c[_0x6bd9('0x3')](_0x4869a4,_0x6bd9('0x4'));}function Final(_0x5e4856){this[_0x6bd9('0x5')]=_0x5e4856[_0x6bd9('0x5')];this[_0x6bd9('0x6')]=_0x5e4856[_0x6bd9('0x6')];this[_0x6bd9('0x7')]=_0x5e4856['type'];this[_0x6bd9('0x8')]=_0x5e4856[_0x6bd9('0x7')]==='outbound'?_0x6bd9('0x9'):_0x5e4856[_0x6bd9('0x7')];this[_0x6bd9('0xa')]=_0x5e4856[_0x6bd9('0xa')];this[_0x6bd9('0xb')]=_0x5e4856[_0x6bd9('0xb')];this[_0x6bd9('0xc')]=_0x5e4856['countnoanswerretry'];this[_0x6bd9('0xd')]=_0x5e4856['countbusyretry']+_0x5e4856[_0x6bd9('0xb')]+_0x5e4856['countnoanswerretry']+_0x5e4856[_0x6bd9('0xe')]+_0x5e4856[_0x6bd9('0xf')]+_0x5e4856[_0x6bd9('0x10')]+_0x5e4856[_0x6bd9('0x11')]+_0x5e4856[_0x6bd9('0x12')];this['countnosuchnumberretry']=_0x5e4856['countnosuchnumberretry'];this['countdropretry']=_0x5e4856[_0x6bd9('0xf')];this[_0x6bd9('0x10')]=_0x5e4856[_0x6bd9('0x10')];this[_0x6bd9('0x11')]=_0x5e4856[_0x6bd9('0x11')];this[_0x6bd9('0x12')]=_0x5e4856[_0x6bd9('0x12')];this[_0x6bd9('0x9')]=_0x5e4856[_0x6bd9('0x9')];this[_0x6bd9('0x13')]=_0x5e4856[_0x6bd9('0x13')];this['calleridnum']=_0x5e4856[_0x6bd9('0x14')];this['starttime']=_0x5e4856['starttime'];this[_0x6bd9('0x15')]=_0x5e4856['responsetime'];this[_0x6bd9('0x16')]=_0x5e4856[_0x6bd9('0x15')];this['ringtime']=_0x5e4856[_0x6bd9('0x17')]||0x0;this[_0x6bd9('0x18')]=_0x5e4856[_0x6bd9('0x18')]||0x0;this['talktime']=_0x5e4856[_0x6bd9('0x19')]||0x0;this[_0x6bd9('0x1a')]=_0x5e4856[_0x6bd9('0x1a')];this[_0x6bd9('0x1b')]=_0x5e4856[_0x6bd9('0x1b')];this[_0x6bd9('0x1c')]=_0x5e4856[_0x6bd9('0x1c')];this[_0x6bd9('0x1d')]=_0x5e4856[_0x6bd9('0x1d')];this[_0x6bd9('0x1e')]=_0x5e4856['ContactId'];this['ListId']=_0x5e4856[_0x6bd9('0x1f')];this[_0x6bd9('0x20')]=_0x5e4856['UserId'];this[_0x6bd9('0x21')]=_0x5e4856[_0x6bd9('0x21')];this[_0x6bd9('0x22')]=_0x5e4856['CampaignId'];this['originatecalleridnum']=_0x5e4856['originatecalleridnum']||'';this[_0x6bd9('0x23')]=_0x5e4856[_0x6bd9('0x23')]||'';}module[_0x6bd9('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 031442c..da729a3 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 _0x9e27=['endtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime'];(function(_0x6754df,_0xda05e2){var _0x593a77=function(_0x10482b){while(--_0x10482b){_0x6754df['push'](_0x6754df['shift']());}};_0x593a77(++_0xda05e2);}(_0x9e27,0x141));var _0x79e2=function(_0xfbc375,_0x5b7a61){_0xfbc375=_0xfbc375-0x0;var _0x437441=_0x9e27[_0xfbc375];return _0x437441;};'use strict';var util=require('util');var _=require(_0x79e2('0x0'));var moment=require(_0x79e2('0x1'));function getSeconds(_0x237b42,_0x427236){var _0x18de8a=moment(_0x237b42)[_0x79e2('0x2')](0x0);var _0x28c148=moment(_0x427236)[_0x79e2('0x2')](0x0);return _0x18de8a[_0x79e2('0x3')](_0x28c148,_0x79e2('0x4'));}function Hangup(_0x6ecaf,_0x1f1bdf){this[_0x79e2('0x5')]=0x4;this[_0x79e2('0x6')]='Answer';this['scheduledat']=_0x6ecaf[_0x79e2('0x7')];this[_0x79e2('0x8')]=_0x6ecaf['type'];this[_0x79e2('0x9')]=_0x6ecaf['type']===_0x79e2('0xa')?_0x79e2('0xb'):_0x6ecaf['type'];this[_0x79e2('0xc')]=_0x6ecaf[_0x79e2('0xc')];this[_0x79e2('0xd')]=_0x6ecaf[_0x79e2('0xd')];this[_0x79e2('0xe')]=_0x6ecaf[_0x79e2('0xe')];this[_0x79e2('0xf')]=_0x6ecaf[_0x79e2('0xc')]+_0x6ecaf[_0x79e2('0xd')]+_0x6ecaf['countnoanswerretry']+_0x6ecaf[_0x79e2('0x10')]+_0x6ecaf[_0x79e2('0x11')]+_0x6ecaf[_0x79e2('0x12')]+_0x6ecaf[_0x79e2('0x13')]+_0x6ecaf[_0x79e2('0x14')];this['countnosuchnumberretry']=_0x6ecaf[_0x79e2('0x10')];this[_0x79e2('0x11')]=_0x6ecaf[_0x79e2('0x11')];this[_0x79e2('0x12')]=_0x6ecaf['countabandonedretry'];this['countmachineretry']=_0x6ecaf[_0x79e2('0x13')];this[_0x79e2('0x14')]=_0x6ecaf['countagentrejectretry'];this[_0x79e2('0x15')]=_0x1f1bdf['uniqueid'];this[_0x79e2('0x16')]=_0x6ecaf['name'];this[_0x79e2('0x17')]=_0x6ecaf[_0x79e2('0x18')];this['starttime']=_0x6ecaf['starttime'];this['responsetime']=_0x6ecaf['responsetime'];this['endtime']=moment()[_0x79e2('0x19')](_0x79e2('0x1a'));this[_0x79e2('0x1b')]=getSeconds(_0x6ecaf[_0x79e2('0x1c')],_0x6ecaf['starttime']);this[_0x79e2('0x1d')]=0x0;this[_0x79e2('0x1e')]=getSeconds(this[_0x79e2('0x1f')],_0x6ecaf[_0x79e2('0x1c')]);this[_0x79e2('0xb')]=_0x6ecaf[_0x79e2('0xb')];this[_0x79e2('0x20')]=_0x79e2('0x21');this[_0x79e2('0x22')]=_0x1f1bdf['cause-txt'];this[_0x79e2('0x23')]=_0x6ecaf[_0x79e2('0x23')];this['callbackuniqueid']=_0x6ecaf[_0x79e2('0x24')];this[_0x79e2('0x25')]=_0x6ecaf[_0x79e2('0x25')];this[_0x79e2('0x26')]=_0x6ecaf[_0x79e2('0x26')];this['ContactId']=_0x6ecaf[_0x79e2('0x27')];this[_0x79e2('0x28')]=_0x6ecaf[_0x79e2('0x28')];this['UserId']=_0x6ecaf['UserId'];this[_0x79e2('0x29')]=_0x6ecaf[_0x79e2('0x29')];this['CampaignId']=_0x6ecaf[_0x79e2('0x2a')];}module[_0x79e2('0x2b')]=Hangup; \ No newline at end of file +var _0x1fe0=['uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','reason','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','util','lodash','moment','milliseconds','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry'];(function(_0x2df23b,_0x447c05){var _0x27bf3e=function(_0x20b32d){while(--_0x20b32d){_0x2df23b['push'](_0x2df23b['shift']());}};_0x27bf3e(++_0x447c05);}(_0x1fe0,0x1a5));var _0x01fe=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x1fe0[_0x565ed7];return _0x183ad7;};'use strict';var util=require(_0x01fe('0x0'));var _=require(_0x01fe('0x1'));var moment=require(_0x01fe('0x2'));function getSeconds(_0x267479,_0xc90fba){var _0x25f28c=moment(_0x267479)[_0x01fe('0x3')](0x0);var _0x26806c=moment(_0xc90fba)[_0x01fe('0x3')](0x0);return _0x25f28c['diff'](_0x26806c,_0x01fe('0x4'));}function Hangup(_0x1ea89a,_0x2a5b83){this[_0x01fe('0x5')]=0x4;this[_0x01fe('0x6')]='Answer';this['scheduledat']=_0x1ea89a[_0x01fe('0x7')];this['type']=_0x1ea89a[_0x01fe('0x8')];this[_0x01fe('0x9')]=_0x1ea89a['type']===_0x01fe('0xa')?_0x01fe('0xb'):_0x1ea89a['type'];this[_0x01fe('0xc')]=_0x1ea89a['countbusyretry'];this[_0x01fe('0xd')]=_0x1ea89a['countcongestionretry'];this[_0x01fe('0xe')]=_0x1ea89a[_0x01fe('0xe')];this['countglobal']=_0x1ea89a[_0x01fe('0xc')]+_0x1ea89a[_0x01fe('0xd')]+_0x1ea89a[_0x01fe('0xe')]+_0x1ea89a[_0x01fe('0xf')]+_0x1ea89a['countdropretry']+_0x1ea89a[_0x01fe('0x10')]+_0x1ea89a[_0x01fe('0x11')]+_0x1ea89a['countagentrejectretry'];this['countnosuchnumberretry']=_0x1ea89a[_0x01fe('0xf')];this[_0x01fe('0x12')]=_0x1ea89a[_0x01fe('0x12')];this[_0x01fe('0x10')]=_0x1ea89a[_0x01fe('0x10')];this[_0x01fe('0x11')]=_0x1ea89a[_0x01fe('0x11')];this['countagentrejectretry']=_0x1ea89a['countagentrejectretry'];this[_0x01fe('0x13')]=_0x2a5b83[_0x01fe('0x13')];this[_0x01fe('0x14')]=_0x1ea89a[_0x01fe('0x15')];this['calleridnum']=_0x1ea89a[_0x01fe('0x16')];this[_0x01fe('0x17')]=_0x1ea89a[_0x01fe('0x17')];this[_0x01fe('0x18')]=_0x1ea89a['responsetime'];this[_0x01fe('0x19')]=moment()[_0x01fe('0x1a')](_0x01fe('0x1b'));this['ringtime']=getSeconds(_0x1ea89a['responsetime'],_0x1ea89a[_0x01fe('0x17')]);this['holdtime']=0x0;this[_0x01fe('0x1c')]=getSeconds(this['endtime'],_0x1ea89a[_0x01fe('0x18')]);this[_0x01fe('0xb')]=_0x1ea89a['queue'];this[_0x01fe('0x1d')]=_0x01fe('0x1e');this[_0x01fe('0x1f')]=_0x2a5b83[_0x01fe('0x20')];this['callback']=_0x1ea89a['callback'];this[_0x01fe('0x21')]=_0x1ea89a[_0x01fe('0x21')];this['callbackat']=_0x1ea89a[_0x01fe('0x22')];this['recallme']=_0x1ea89a[_0x01fe('0x23')];this[_0x01fe('0x24')]=_0x1ea89a[_0x01fe('0x24')];this[_0x01fe('0x25')]=_0x1ea89a['ListId'];this['UserId']=_0x1ea89a[_0x01fe('0x26')];this['VoiceQueueId']=_0x1ea89a['VoiceQueueId'];this[_0x01fe('0x27')]=_0x1ea89a['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index b29ac03..a7b2e07 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 _0xca4b=['scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid'];(function(_0x1c78d1,_0x550e85){var _0x281691=function(_0x228c48){while(--_0x228c48){_0x1c78d1['push'](_0x1c78d1['shift']());}};_0x281691(++_0x550e85);}(_0xca4b,0x132));var _0xbca4=function(_0xef22ce,_0x49c0aa){_0xef22ce=_0xef22ce-0x0;var _0x5ccac6=_0xca4b[_0xef22ce];return _0x5ccac6;};'use strict';var util=require('util');var _=require(_0xbca4('0x0'));var moment=require(_0xbca4('0x1'));function getSeconds(_0x1853ad,_0x21268c){var _0x422fe8=moment(_0x1853ad)[_0xbca4('0x2')](0x0);var _0x56f732=moment(_0x21268c)[_0xbca4('0x2')](0x0);return _0x422fe8[_0xbca4('0x3')](_0x56f732,_0xbca4('0x4'));}function History(_0x760245){this['uniqueid']=_0x760245[_0xbca4('0x5')];this[_0xbca4('0x6')]=_0x760245['scheduledat']||undefined;this[_0xbca4('0x7')]=_0x760245[_0xbca4('0x7')];this[_0xbca4('0x8')]=_0x760245[_0xbca4('0x7')]==='outbound'?_0xbca4('0x9'):_0x760245[_0xbca4('0x7')];this['countbusyretry']=_0x760245[_0xbca4('0xa')];this[_0xbca4('0xb')]=_0x760245[_0xbca4('0xb')];this[_0xbca4('0xc')]=_0x760245['countnoanswerretry'];this['countglobal']=_0x760245['countbusyretry']+_0x760245['countcongestionretry']+_0x760245[_0xbca4('0xc')]+_0x760245[_0xbca4('0xd')]+_0x760245[_0xbca4('0xe')]+_0x760245[_0xbca4('0xf')]+_0x760245[_0xbca4('0x10')]+_0x760245['countagentrejectretry'];this[_0xbca4('0xd')]=_0x760245[_0xbca4('0xd')];this[_0xbca4('0xe')]=_0x760245[_0xbca4('0xe')];this[_0xbca4('0xf')]=_0x760245['countabandonedretry'];this[_0xbca4('0x10')]=_0x760245[_0xbca4('0x10')];this[_0xbca4('0x11')]=_0x760245['countagentrejectretry'];this[_0xbca4('0x9')]=_0x760245[_0xbca4('0x9')];this[_0xbca4('0x12')]=_0x760245[_0xbca4('0x13')];this[_0xbca4('0x14')]=_0x760245[_0xbca4('0x15')];this[_0xbca4('0x16')]=_0x760245['starttime'];this['responsetime']=_0x760245[_0xbca4('0x17')];this[_0xbca4('0x18')]=_0x760245[_0xbca4('0x17')];this['ringtime']=getSeconds(_0x760245['responsetime'],_0x760245[_0xbca4('0x16')]);this[_0xbca4('0x19')]=0x0;this[_0xbca4('0x1a')]=0x0;this[_0xbca4('0x1b')]=_0x760245[_0xbca4('0x1b')];this[_0xbca4('0x1c')]=_0x760245[_0xbca4('0x1c')];this[_0xbca4('0x1d')]=_0x760245[_0xbca4('0x1d')];this[_0xbca4('0x1e')]=_0x760245[_0xbca4('0x1e')];this['ContactId']=_0x760245[_0xbca4('0x1f')];this[_0xbca4('0x20')]=_0x760245['ListId'];this['UserId']=_0x760245[_0xbca4('0x21')];this[_0xbca4('0x22')]=_0x760245[_0xbca4('0x22')];this[_0xbca4('0x23')]=_0x760245['CampaignId'];this[_0xbca4('0x24')]=_0x760245['originatecalleridnum']||'';this['originatecalleridname']=_0x760245[_0xbca4('0x25')]||'';}module[_0xbca4('0x26')]=History; \ No newline at end of file +var _0x0a34=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','number'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0a34,0x12a));var _0x40a3=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x0a34[_0x50a0c2];return _0x5ebadd;};'use strict';var util=require(_0x40a3('0x0'));var _=require(_0x40a3('0x1'));var moment=require('moment');function getSeconds(_0x33897b,_0x37ccb2){var _0x1649d9=moment(_0x33897b)['milliseconds'](0x0);var _0x13fe1b=moment(_0x37ccb2)[_0x40a3('0x2')](0x0);return _0x1649d9[_0x40a3('0x3')](_0x13fe1b,'seconds');}function History(_0x347dbf){this[_0x40a3('0x4')]=_0x347dbf[_0x40a3('0x4')];this[_0x40a3('0x5')]=_0x347dbf[_0x40a3('0x5')]||undefined;this[_0x40a3('0x6')]=_0x347dbf['type'];this[_0x40a3('0x7')]=_0x347dbf[_0x40a3('0x6')]===_0x40a3('0x8')?_0x40a3('0x9'):_0x347dbf[_0x40a3('0x6')];this[_0x40a3('0xa')]=_0x347dbf['countbusyretry'];this[_0x40a3('0xb')]=_0x347dbf[_0x40a3('0xb')];this[_0x40a3('0xc')]=_0x347dbf['countnoanswerretry'];this[_0x40a3('0xd')]=_0x347dbf[_0x40a3('0xa')]+_0x347dbf['countcongestionretry']+_0x347dbf[_0x40a3('0xc')]+_0x347dbf[_0x40a3('0xe')]+_0x347dbf['countdropretry']+_0x347dbf[_0x40a3('0xf')]+_0x347dbf[_0x40a3('0x10')]+_0x347dbf['countagentrejectretry'];this[_0x40a3('0xe')]=_0x347dbf[_0x40a3('0xe')];this[_0x40a3('0x11')]=_0x347dbf[_0x40a3('0x11')];this['countabandonedretry']=_0x347dbf['countabandonedretry'];this['countmachineretry']=_0x347dbf[_0x40a3('0x10')];this[_0x40a3('0x12')]=_0x347dbf[_0x40a3('0x12')];this['queue']=_0x347dbf[_0x40a3('0x9')];this[_0x40a3('0x13')]=_0x347dbf['name'];this[_0x40a3('0x14')]=_0x347dbf[_0x40a3('0x15')];this[_0x40a3('0x16')]=_0x347dbf[_0x40a3('0x16')];this[_0x40a3('0x17')]=_0x347dbf['responsetime'];this[_0x40a3('0x18')]=_0x347dbf[_0x40a3('0x17')];this[_0x40a3('0x19')]=getSeconds(_0x347dbf[_0x40a3('0x17')],_0x347dbf[_0x40a3('0x16')]);this[_0x40a3('0x1a')]=0x0;this[_0x40a3('0x1b')]=0x0;this[_0x40a3('0x1c')]=_0x347dbf[_0x40a3('0x1c')];this[_0x40a3('0x1d')]=_0x347dbf[_0x40a3('0x1d')];this[_0x40a3('0x1e')]=_0x347dbf[_0x40a3('0x1e')];this[_0x40a3('0x1f')]=_0x347dbf[_0x40a3('0x1f')];this[_0x40a3('0x20')]=_0x347dbf['ContactId'];this[_0x40a3('0x21')]=_0x347dbf[_0x40a3('0x21')];this[_0x40a3('0x22')]=_0x347dbf[_0x40a3('0x22')];this[_0x40a3('0x23')]=_0x347dbf[_0x40a3('0x23')];this['CampaignId']=_0x347dbf[_0x40a3('0x24')];this['originatecalleridnum']=_0x347dbf[_0x40a3('0x25')]||'';this[_0x40a3('0x26')]=_0x347dbf['originatecalleridname']||'';}module[_0x40a3('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 2a14368..5a3f888 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 _0x5e1f=['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','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','ivr','string','format','\x22%s\x22\x20<%s>','error','inspect','stack','hasOwnProperty','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','talking','pTalking','NOT_ACTIVE','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','endtime','starttime','loopClearZombieChannels','[uniqueid]','clearZombieChannels','actions','status','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','countReScheduled','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','merge','ListId','UserId','VoiceQueueId','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','unmonitored','syncVarSet','uniqueId','uniqueid','isNil','variable','amdstatus','dialAMDActive','value','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','ContactId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr]','Machine','countglobal','amd','countdropretry','reason19\x20machine....','YYYY-MM-DD\x20HH:mm:ss','CampaignId','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','locked','stateinterface','push','pick','idHopper','paused','queueStatusComplete','[booked][unlockQueueStatus]','stringify','syncQueueStatusComplete','run','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','isArray','length','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','originate','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','OriginateError','[originate][error]','originate\x20action\x20Error','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','buildObj','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','[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','Max\x20Drop\x20','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(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','busyFactor','floor','fail\x20to\x20scheduled\x20calls','recallme','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','Agent','voicePause','log','Contact\x20updated','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','limitCalls','temp','getContactDialerIvr','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','emptyContact','checkContactBlack','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','loopCampaigns','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','sumHoldTime','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','campaign:ivr:%s'];(function(_0x3dbbf1,_0x2ee135){var _0x1ff2b1=function(_0x365573){while(--_0x365573){_0x3dbbf1['push'](_0x3dbbf1['shift']());}};_0x1ff2b1(++_0x2ee135);}(_0x5e1f,0x19f));var _0xf5e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e1f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xf5e1('0x0'));var _=require(_0xf5e1('0x1'));var BPromise=require(_0xf5e1('0x2'));var uuid=require(_0xf5e1('0x3'));var moment=require(_0xf5e1('0x4'));var rr=require('rr');var md5=require(_0xf5e1('0x5'));var Redis=require(_0xf5e1('0x6'));var ut=require(_0xf5e1('0x7'));var config=require(_0xf5e1('0x8'));var logger=require(_0xf5e1('0x9'))(_0xf5e1('0xa'));var loggerBooked=require(_0xf5e1('0x9'))('booked');var loggerPredictive=require(_0xf5e1('0x9'))(_0xf5e1('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0xf5e1('0xc'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0xf5e1('0xd'));config[_0xf5e1('0xe')]=_[_0xf5e1('0xf')](config[_0xf5e1('0xe')],{'host':_0xf5e1('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf5e1('0xe')]));var cmHopper=require(_0xf5e1('0x11'));var cmHopperFinal=require(_0xf5e1('0x12'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xf5e1('0x13'));var voiceQueueRt=require(_0xf5e1('0x14'));var Action=require(_0xf5e1('0x15'));var History=require(_0xf5e1('0x16'));var Final=require(_0xf5e1('0x17'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process['env'][_0xf5e1('0x18')]||_0xf5e1('0x19');var strategy={'rrmemory':_0xf5e1('0x1a'),'roundrobin':_0xf5e1('0x1b')};var Sequence=function(){};Sequence[_0xf5e1('0x1c')][_0xf5e1('0x1d')]=function(_0x2a5b5f){this['tail']=this['tail']?this[_0xf5e1('0x1e')]['finally'](_0x2a5b5f):_0x2a5b5f();};function Dialer(_0x3a9f7a,_0x326fc4){this[_0xf5e1('0x1f')]=new Sequence();this['preview']=_0x326fc4;this[_0xf5e1('0x20')]=_0x3a9f7a[_0xf5e1('0x20')];this[_0xf5e1('0x21')]=_0x3a9f7a[_0xf5e1('0x21')];this[_0xf5e1('0x22')]=_0x3a9f7a[_0xf5e1('0x22')];this[_0xf5e1('0x23')]=_0x3a9f7a['trunks'];this[_0xf5e1('0x24')]=config['maxNumberOriginate']||0x2;this[_0xf5e1('0x25')]={};this['actions']={};this[_0xf5e1('0x26')]={};this['uniqueId']={};this[_0xf5e1('0x27')]={};this['startPredictive']={};this['startProgressive']={};this['ivrOriginated']={};this[_0xf5e1('0x28')]={};this[_0xf5e1('0x29')]={};ami['on'](_0xf5e1('0x2a'),this[_0xf5e1('0x2b')][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x2d'),this['syncQueueCallerAbandon'][_0xf5e1('0x2c')](this));ami['on']('originateresponse',this[_0xf5e1('0x2e')][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x2f'),this[_0xf5e1('0x30')][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x31'),this[_0xf5e1('0x32')][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x33'),this['syncHangup'][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x34'),this[_0xf5e1('0x35')][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x36'),this['syncVarSet'][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x37'),this['syncQueueMember'][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x38'),this['syncQueueStatusComplete'][_0xf5e1('0x2c')](this));this[_0xf5e1('0x39')]();this['loopClearZombieChannels']();}function isNotNull(_0x23db01){return _0x23db01!==null&&!_[_0xf5e1('0x3a')](_0x23db01);}function checkIsLoggedIn(_0x533560,_0x306750){return function(){if(_0x306750<=0x0){_0x533560['message']=_0xf5e1('0x3b');throw _0x533560[_0xf5e1('0x3c')]+_0xf5e1('0x3d');}};}function isActive(_0x4baa16){return _0x4baa16;}function checkIsActive(_0x3dbd1a,_0x60e46c){return function(){if(!isActive(_0x60e46c)){_0x3dbd1a[_0xf5e1('0x3e')]='NOT_ACTIVE';throw _0x3dbd1a[_0xf5e1('0x3c')]+_0xf5e1('0x3f');}};}function checkInterval(_0x1ef0b9){return function(){if(!isNotNull(_0x1ef0b9[_0xf5e1('0x40')])){_0x1ef0b9[_0xf5e1('0x3e')]=_0xf5e1('0x41');throw _0x1ef0b9[_0xf5e1('0x3c')]+_0xf5e1('0x42');}if(!isNotNull(_0x1ef0b9[_0xf5e1('0x40')][_0xf5e1('0x43')])){_0x1ef0b9[_0xf5e1('0x3e')]='INTERVAL_IS_NULL';throw _0x1ef0b9['name']+_0xf5e1('0x42');}if(!isNotNull(_[_0xf5e1('0x44')](_0x1ef0b9[_0xf5e1('0x40')][_0xf5e1('0x43')]))){_0x1ef0b9['message']='INTERVAL_IS_NULL';throw _0x1ef0b9['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x323218,_0x3e1405,_0x3c296f){return{'action':_0x323218,'response':_0x3e1405,'message':_0x3c296f,'stack':_0x3c296f};}function myreject(_0x4f25ba){return function(_0x336ef3){return _0x4f25ba(msgResponse(_0xf5e1('0x45'),_0xf5e1('0x46'),JSON['stringify'](_0x336ef3)));};}function getSeconds(_0x2520af,_0x43dd83){var _0xf8ed19=moment(_0x2520af)[_0xf5e1('0x47')](0x0);var _0x3b93bb=moment(_0x43dd83)['milliseconds'](0x0);return _0xf8ed19[_0xf5e1('0x48')](_0x3b93bb,_0xf5e1('0x49'));}function emit(_0xb2b10e,_0x1b40d4,_0x3f2075){io['to'](_0xb2b10e)[_0xf5e1('0x4a')](_0x1b40d4,_0x3f2075);}function emitVoiceQueueSummary(_0x5d6be2){if(_0x5d6be2[_0xf5e1('0x4b')]===_0xf5e1('0x4c')){var _0x23507c={'id':_0x5d6be2['id'],'name':_0x5d6be2[_0xf5e1('0x3c')],'strategy':_0x5d6be2[_0xf5e1('0x4d')],'answered':_0x5d6be2[_0xf5e1('0x4e')],'available':_0x5d6be2['available'],'loggedIn':_0x5d6be2[_0xf5e1('0x4f')],'pTalking':_0x5d6be2['pTalking'],'sumBillable':_0x5d6be2['sumBillable'],'sumDuration':_0x5d6be2['sumDuration'],'sumHoldTime':_0x5d6be2[_0xf5e1('0x50')]||0x0,'talking':_0x5d6be2['talking'],'total':_0x5d6be2['total'],'type':_0x5d6be2[_0xf5e1('0x4b')],'unmanaged':_0x5d6be2[_0xf5e1('0x51')],'abandoned':_0x5d6be2[_0xf5e1('0x52')],'waiting':_0x5d6be2[_0xf5e1('0x53')],'loggedInDb':_0x5d6be2['loggedInDb'],'dialActive':_0x5d6be2[_0xf5e1('0x54')],'dialMethod':_0x5d6be2[_0xf5e1('0x55')],'dialOriginateCallerIdName':_0x5d6be2[_0xf5e1('0x56')],'dialOriginateCallerIdNumber':_0x5d6be2['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x5d6be2['dialOriginateTimeout'],'dialPrefix':_0x5d6be2['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5d6be2[_0xf5e1('0x57')],'outboundAnswerCallsDay':_0x5d6be2[_0xf5e1('0x58')],'outboundBlacklistCallsDay':_0x5d6be2[_0xf5e1('0x59')],'outboundBusyCallsDay':_0x5d6be2[_0xf5e1('0x5a')],'outboundCongestionCallsDay':_0x5d6be2['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x5d6be2[_0xf5e1('0x5b')],'outboundDropCallsDayCallersExit':_0x5d6be2[_0xf5e1('0x5c')],'outboundDropCallsDayTimeout':_0x5d6be2['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5d6be2[_0xf5e1('0x5d')],'outboundNoSuchCallsDay':_0x5d6be2[_0xf5e1('0x5e')],'outboundOriginateFailureCallsDay':_0x5d6be2[_0xf5e1('0x5f')],'outboundReCallsDay':_0x5d6be2['outboundReCallsDay'],'outboundRejectCallsDay':_0x5d6be2[_0xf5e1('0x60')],'outboundUnknownCallsDay':_0x5d6be2[_0xf5e1('0x61')],'predictiveIntervalAnsweredCalls':_0x5d6be2[_0xf5e1('0x62')],'predictiveIntervalAvgHoldtime':_0x5d6be2[_0xf5e1('0x63')],'predictiveIntervalAvgTalktime':_0x5d6be2[_0xf5e1('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0x5d6be2[_0xf5e1('0x65')],'predictiveIntervalDroppedCallsTimeout':_0x5d6be2[_0xf5e1('0x66')],'predictiveIntervalErlangCalls':_0x5d6be2[_0xf5e1('0x67')],'predictiveIntervalErlangCallsDroppedCalls':_0x5d6be2[_0xf5e1('0x68')],'predictiveIntervalHitRate':_0x5d6be2[_0xf5e1('0x69')],'predictiveIntervalMultiplicativeFactor':_0x5d6be2[_0xf5e1('0x6a')],'predictiveIntervalPauses':_0x5d6be2[_0xf5e1('0x6b')],'predictiveIntervalAvailable':_0x5d6be2[_0xf5e1('0x6c')],'predictiveIntervalTotalCalls':_0x5d6be2[_0xf5e1('0x6d')],'message':_0x5d6be2['message'],'originated':_0x5d6be2['originated'],'erlangCalls':_0x5d6be2[_0xf5e1('0x6e')],'erlangCallToSecond':_0x5d6be2[_0xf5e1('0x6f')],'erlangAbandonmentRate':_0x5d6be2[_0xf5e1('0x70')],'erlangBusyFactor':_0x5d6be2[_0xf5e1('0x71')],'startPredictive':_0x5d6be2['startPredictive'],'startProgressive':_0x5d6be2[_0xf5e1('0x72')]};if(_0x5d6be2[_0xf5e1('0x73')]){_0x23507c['Trunk']={'id':_0x5d6be2[_0xf5e1('0x73')]['id'],'name':_0x5d6be2[_0xf5e1('0x73')][_0xf5e1('0x3c')],'active':_0x5d6be2[_0xf5e1('0x73')][_0xf5e1('0x74')],'callerid':_0x5d6be2['Trunk'][_0xf5e1('0x75')]};}if(_0x5d6be2[_0xf5e1('0x40')]){_0x23507c[_0xf5e1('0x40')]={'id':_0x5d6be2[_0xf5e1('0x40')]['id'],'name':_0x5d6be2[_0xf5e1('0x40')][_0xf5e1('0x3c')]};}var _0x237791=md5(JSON['stringify'](_0x23507c));if(_0x5d6be2[_0xf5e1('0x5')]!==_0x237791){_0x5d6be2[_0xf5e1('0x5')]=_0x237791;emit(util['format']('voice:queue:%s',_0x23507c[_0xf5e1('0x3c')]),'voice_queue:save',_0x23507c);}}}function emitCampaignSummary(_0x269181){if(_0x269181[_0xf5e1('0x4b')]==='ivr'){emit(util['format'](_0xf5e1('0x76'),_0x269181['name']),_0xf5e1('0x77'),_0x269181);}}function checkGetDataPredictive(_0x14d430){if(isNotNull(_0x14d430)){if(!_[_0xf5e1('0x44')](_0x14d430)){loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x79'));loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x7a'),_0x14d430['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0xf5e1('0x7b'),_0x14d430[_0xf5e1('0x62')]);loggerPredictive[_0xf5e1('0x78')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14d430[_0xf5e1('0x66')]);loggerPredictive[_0xf5e1('0x78')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14d430[_0xf5e1('0x65')]);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x7c'),_0x14d430['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x7d'),_0x14d430[_0xf5e1('0x64')]);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x7e'));if(_0x14d430[_0xf5e1('0x6d')]>0x0){if(!_['isUndefined'](_0x14d430['predictiveIntervalAvgTalktime'])&&_0x14d430['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0xf5e1('0x78')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0xf5e1('0x3a')](_0x14d430['predictiveIntervalAvgHoldtime'])&&_0x14d430[_0xf5e1('0x63')]>0x0){return!![];}else{loggerPredictive['info'](_0xf5e1('0x7f'));}}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x80'));}}else{loggerPredictive[_0xf5e1('0x78')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x1a49c9){return function(_0x103f8d){loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x81'));loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x82'),_0x103f8d['erlangCalls']);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x83'),_0x103f8d[_0xf5e1('0x6f')]);loggerPredictive['info'](_0xf5e1('0x84'),_0x103f8d[_0xf5e1('0x70')]);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x85'),_0x103f8d[_0xf5e1('0x71')]);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x84'),_0x103f8d[_0xf5e1('0x70')]);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x7e'));_['merge'](_0x1a49c9,_0x103f8d);};}function getDiff(_0xf20e05){var _0x27e387=moment()[_0xf5e1('0x47')](0x0);var _0x2b32ec=moment(_0xf20e05)['milliseconds'](0x0);return _0x27e387[_0xf5e1('0x48')](_0x2b32ec,_0xf5e1('0x49'));}function ifInterval(_0x1cd2b4,_0x21c472){if(_['isUndefined'](_0x21c472)){return![];}if(getDiff(_0x21c472)<_0x1cd2b4*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x726c09){if(isNotNull(_0x726c09)){if(!_['isUndefined'](_0x726c09[_0xf5e1('0x72')])){_0x726c09['startProgressive']=undefined;loggerPredictive[_0xf5e1('0x78')](_0x726c09['name'],_0xf5e1('0x86'));}if(!_[_0xf5e1('0x3a')](_0x726c09['startPredictive'])){_0x726c09[_0xf5e1('0x87')]=undefined;loggerPredictive['info'](_0x726c09[_0xf5e1('0x3c')],_0xf5e1('0x88'));}if(!_[_0xf5e1('0x3a')](_0x726c09[_0xf5e1('0x89')])){clearInterval(_0x726c09['handlePredictive']);_0x726c09['handlePredictive']=undefined;loggerPredictive['info'](_0x726c09[_0xf5e1('0x3c')],_0xf5e1('0x8a'));}}}function erlangb(_0x3d725a,_0x423b62){if(_0x423b62===0x0){return 0x0;}var _0x443adb=0x1;for(var _0x502997=0x1;_0x502997<=_0x423b62;_0x502997+=0x1){_0x443adb=0x1+_0x443adb*_0x502997/_0x3d725a;}return 0x1/_0x443adb;}function isVoiceQueueOutbound(_0x331705){return _0x331705===_0xf5e1('0x4c');}function isNotPreview(_0x59c6aa){return _0x59c6aa!==_0xf5e1('0x8b');}function isCampaignIvr(_0x29b1d5){return _0x29b1d5===_0xf5e1('0x8c');}function getCallerId(_0x1f520e,_0x34dd92,_0x4cd849){if(!_[_0xf5e1('0x3a')](_0x4cd849)&&_0xf5e1('0x8d')===typeof _0x4cd849&&!_[_0xf5e1('0x44')](_0x4cd849)){if(!_['isUndefined'](_0x34dd92)&&_0xf5e1('0x8d')===typeof _0x34dd92&&!_[_0xf5e1('0x44')](_0x34dd92)){return util[_0xf5e1('0x8e')](_0xf5e1('0x8f'),_0x34dd92,_0x4cd849);}return util[_0xf5e1('0x8e')](_0xf5e1('0x8f'),_0x4cd849,_0x4cd849);}if(!_[_0xf5e1('0x3a')](_0x1f520e)&&_0xf5e1('0x8d')===typeof _0x1f520e&&!_[_0xf5e1('0x44')](_0x1f520e)){return _0x1f520e;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x1cdbb3,_0x1acf2d){return function(_0x4f0974){freeVariablesPredictive(_0x1acf2d);emitVoiceQueueSummary(_0x1acf2d);emitCampaignSummary(_0x1acf2d);loggerSyncQueueSummary[_0xf5e1('0x90')](_0x1cdbb3,util[_0xf5e1('0x91')](_0x4f0974,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2fcd2c,_0x4d42f9){return function(_0x22ed40){loggerPredictive[_0xf5e1('0x90')](_0x4d42f9['name'],_0x2fcd2c);loggerPredictive[_0xf5e1('0x90')](_0x22ed40[_0xf5e1('0x92')]);freeVariablesPredictive(_0x4d42f9);};}function loggerCatch(_0x5329a3){return function(_0x5386d2){logger[_0xf5e1('0x90')](_0x5329a3,util['inspect'](_0x5386d2,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5de729){return _0x5de729&&!_[_0xf5e1('0x3a')](_0x5de729)&&_0x5de729['length']>0x0;}function decremetOriginate(_0x2037e8){if(!_[_0xf5e1('0x3a')](_0x2037e8)&&_0x2037e8!==null){if(_0x2037e8[_0xf5e1('0x93')](_0xf5e1('0x94'))){if(_0x2037e8[_0xf5e1('0x94')]>0x0){_0x2037e8[_0xf5e1('0x94')]-=0x1;}else{logger[_0xf5e1('0x90')](_0xf5e1('0x95'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x5b9f47,_0x3b09db,_0x5e64c7){if(_0x3b09db>_0x5e64c7){for(var _0x3f913c=0x0;_0x3f913c<_0x3b09db-_0x5e64c7;_0x3f913c+=0x1){decremetOriginate(_0x5b9f47);}}}function loggerGetContactDialer(_0xa7a154,_0x33fd50,_0x2316ae){return function(_0x25779c){checkContactLowerLimitOriginate(_0x33fd50,_0x2316ae,0x0);logger['error'](_0xa7a154,util['inspect'](_0x25779c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x479d6a){return function(_0x5aa288){if(isNotNull(_0x5aa288)&&isNotNull(_0x5aa288[0x0])){if(_0x5aa288[0x0][_0xf5e1('0x96')]>0x0){_0x479d6a[_0xf5e1('0x3e')]=_0xf5e1('0x97');logger[_0xf5e1('0x78')](_0xf5e1('0x98')+_0x479d6a[_0xf5e1('0x3c')],_0x5aa288[0x0][_0xf5e1('0x96')],_0xf5e1('0x99'));}else{_0x479d6a['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xf5e1('0x78')]('[getContactDialer2][Empty]'+_0x479d6a[_0xf5e1('0x3c')]);}}};}function notSendMessagesQueue(_0x47c945){if(_0x47c945[_0xf5e1('0x9a')]){freeVariablesPredictive(_0x47c945);if(_0x47c945[_0xf5e1('0x94')]===0x0&&_0x47c945[_0xf5e1('0x9b')]===0x0&&_0x47c945[_0xf5e1('0x53')]===0x0&&(_0x47c945[_0xf5e1('0x9c')]||0x0)===0x0){_0x47c945[_0xf5e1('0x9a')]=![];_0x47c945['available']=0x0;_0x47c945[_0xf5e1('0x3e')]=_0xf5e1('0x9d');loggerSyncQueueSummary[_0xf5e1('0x90')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x47c945[_0xf5e1('0x3c')],'is\x20not\x20active');}else{_0x47c945['message']=_0xf5e1('0x9e');loggerSyncQueueSummary[_0xf5e1('0x90')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x47c945[_0xf5e1('0x3c')],'is\x20disactive');}emitVoiceQueueSummary(_0x47c945);}}function notSendMessagesCampaign(_0x3c7773){if(_0x3c7773[_0xf5e1('0x9a')]){if(_0x3c7773[_0xf5e1('0x94')]===0x0){_0x3c7773[_0xf5e1('0x9a')]=![];_0x3c7773[_0xf5e1('0x3e')]=_0xf5e1('0x9d');loggerSyncQueueSummary[_0xf5e1('0x90')](_0xf5e1('0x9f'),_0x3c7773['name'],_0xf5e1('0xa0'));}else{_0x3c7773[_0xf5e1('0x3e')]=_0xf5e1('0x9e');loggerSyncQueueSummary[_0xf5e1('0x90')](_0xf5e1('0x9f'),_0x3c7773[_0xf5e1('0x3c')],'is\x20disactive');}emitCampaignSummary(_0x3c7773);}}function createObjHistory(_0x3d1a44,_0x41b7de,_0x2b9aaa,_0x24fed2,_0x56a801){_0x3d1a44['message']=_0x2b9aaa;var _0x1e84d5=new Action(_0x3d1a44,_0x41b7de);var _0x16b710=new History(_0x1e84d5);_0x16b710[_0xf5e1('0xa1')]=_0x24fed2;_0x16b710[_0xf5e1('0xa2')]=_0x56a801;_0x16b710[_0xf5e1('0xa3')]=_0x1e84d5[_0xf5e1('0xa4')];return _0x16b710;}Dialer[_0xf5e1('0x1c')][_0xf5e1('0xa5')]=function(){var _0x32b184=this;setInterval(function(){_0x32b184['clearZombieChannels'](_0x32b184['uniqueId'],_0xf5e1('0xa6'));_0x32b184[_0xf5e1('0xa7')](_0x32b184[_0xf5e1('0xa8')],'[actions]');},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x5c86f0,_0x298636){var _0x25af96=this;for(var _0x6be0 in _0x5c86f0){if(_0x5c86f0[_0xf5e1('0x93')](_0x6be0)){this[_0xf5e1('0x1f')][_0xf5e1('0x1d')](function(){if(!_['isNil'](_0x5c86f0[_0x6be0])){return ami['Action']({'action':_0xf5e1('0xa9'),'channel':_0x5c86f0[_0x6be0]['channel']})[_0xf5e1('0xaa')](function(_0x13cd57){if(_0x13cd57[_0xf5e1('0x3e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5c86f0[_0x6be0]&&_0x5c86f0[_0x6be0][_0xf5e1('0x4b')]!==_0xf5e1('0x8c')){_0x25af96[_0xf5e1('0xab')](_0x25af96[_0xf5e1('0x20')][_0x5c86f0[_0x6be0][_0xf5e1('0xac')]]);logger['error'](_0xf5e1('0xad'),_0x298636,_0x6be0,_0x5c86f0[_0x6be0][_0xf5e1('0xac')]);delete _0x5c86f0[_0x6be0];}if(_0x5c86f0[_0x6be0]&&_0x5c86f0[_0x6be0]['type']==='ivr'){_0x25af96[_0xf5e1('0xab')](_0x25af96['campaigns'][_0x5c86f0[_0x6be0][_0xf5e1('0xac')]]);logger[_0xf5e1('0x90')](_0xf5e1('0xae'),_0x298636,_0x6be0,_0x5c86f0[_0x6be0]['queue']);delete _0x5c86f0[_0x6be0];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x36df0d){return BPromise[_0xf5e1('0xaf')]()['then'](cmHopper[_0xf5e1('0xb0')](_0x36df0d))[_0xf5e1('0xaa')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0xf5e1('0xb1')]=function(_0x3c7d76){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopperBlack[_0xf5e1('0xb1')](_0x3c7d76))[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xb3')));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xb4')]=function(_0x6807ac){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopperBlack[_0xf5e1('0xb4')](_0x6807ac))[_0xf5e1('0xaa')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xb5')]=function(_0x1b61f6){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopperHistory[_0xf5e1('0xb6')](_0x1b61f6))[_0xf5e1('0xaa')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xb7')]=function(_0x38d844){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopper['rescheduleContact'](_0x38d844))[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xb8')));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xb9')]=function(_0xca7ac,_0x19c7ad,_0x400332){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopper['unlockContact'](_0xca7ac,_0x19c7ad,_0x400332))[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xba')));};Dialer[_0xf5e1('0x1c')]['getContactDialer']=function(_0x4e71df,_0x39f11a,_0x4182e7,_0x3e82b3){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopper[_0xf5e1('0xbb')](_0x4e71df,_0x39f11a,_0x4182e7,_0x3e82b3))[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xbc')));};Dialer['prototype']['getContactDialerIvr']=function(_0x357514,_0x1d4496,_0x4e330b){return BPromise[_0xf5e1('0xaf')]()['then'](cmHopper['getContactDialerIvr'](_0x357514,_0x1d4496,_0x4e330b))[_0xf5e1('0xaa')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xf5e1('0x1c')]['getVoiceQueueRtPauses']=function(_0x16ada3){return BPromise['resolve']()[_0xf5e1('0xb2')](voiceQueueRt[_0xf5e1('0xbd')](_0x16ada3))[_0xf5e1('0xaa')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0xf5e1('0xbe')]=function(_0x1649e8){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopper[_0xf5e1('0xbe')](_0x1649e8))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xbf')]=function(_0x32b186){return BPromise[_0xf5e1('0xaf')]()['then'](cmHopperHistory[_0xf5e1('0xbf')](_0x32b186))[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xc0')));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xab')]=function(_0x12502e){if(!_[_0xf5e1('0x3a')](_0x12502e)&&_0x12502e!==null){if(_0x12502e[_0xf5e1('0x93')](_0xf5e1('0x94'))){if(_0x12502e[_0xf5e1('0x94')]>0x0){_0x12502e[_0xf5e1('0x94')]-=0x1;}else{logger[_0xf5e1('0x90')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0xf5e1('0xc1'));}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xc2')]=function(_0x5dd1d4,_0x6fe083){var _0x109d72=this;return function(_0x35674b){_0x109d72[_0xf5e1('0xab')](_0x6fe083);logger[_0xf5e1('0x90')](_0x5dd1d4,util['inspect'](_0x35674b,{'showHidden':![],'depth':null}));};};Dialer[_0xf5e1('0x1c')]['emptyContact']=function(_0x31fdf7,_0x115da1,_0x45b65b){var _0x55f7b4={'state':0x19,'statedesc':_0xf5e1('0xc3')};this[_0xf5e1('0xab')](_0x115da1);this[_0xf5e1('0xc4')](_[_0xf5e1('0xc5')](_0x55f7b4,_['pick'](_0x45b65b,['ContactId',_0xf5e1('0xc6'),_0xf5e1('0xc7'),_0xf5e1('0xc8'),'CampaignId'])),'[emptyContact][createHistory]',_0xf5e1('0xc9'));logger[_0xf5e1('0x90')](_0x31fdf7);};Dialer['prototype'][_0xf5e1('0xca')]=function(_0x2cfc57){return _0x2cfc57===_0xf5e1('0xcb');};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xcc')]=function(_0x399536){return!_['isUndefined'](_0x399536)&&_0x399536&&!_[_0xf5e1('0x3a')](_0x399536['name'])&&!_[_0xf5e1('0x3a')](_0x399536[_0xf5e1('0x74')])&&_0x399536[_0xf5e1('0x74')]&&(this['trunks'][util[_0xf5e1('0x8e')]('SIP/%s',_0x399536[_0xf5e1('0x3c')])][_0xf5e1('0xa9')]===_0xf5e1('0xcd')||this[_0xf5e1('0x23')][util['format']('SIP/%s',_0x399536[_0xf5e1('0x3c')])][_0xf5e1('0xa9')]===_0xf5e1('0xce'));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xc4')]=function(_0x35b7f4,_0x781ad0,_0x3636d2){this[_0xf5e1('0xbf')](_0x35b7f4)[_0xf5e1('0xaa')](loggerCatch(_0x781ad0));this[_0xf5e1('0xbe')](_0x35b7f4)[_0xf5e1('0xaa')](loggerCatch(_0x3636d2));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xcf')]=function(_0x36bc0f){var _0x356e1f=this[_0xf5e1('0xd0')][_0x36bc0f[_0xf5e1('0xd1')]];var _0x151bb5;if(!_[_0xf5e1('0xd2')](_0x36bc0f)&&!_[_0xf5e1('0xd2')](_0x36bc0f['variable'])&&!_['isNil'](_0x36bc0f[_0xf5e1('0xd3')][_0xf5e1('0xd4')])&&_0x36bc0f['exten']==='xcally-motion-dialer'&&_0x356e1f){if(_0x356e1f['type']!=='ivr'&&this[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0xd5')]&&_0x36bc0f[_0xf5e1('0xd6')]==='HANGUP'){delete this['uniqueId'][_0x36bc0f[_0xf5e1('0xd1')]];this[_0xf5e1('0xab')](this[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]]);this[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0x58')]+=0x1;this[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0x57')]+=0x1;_0x151bb5=new Hangup(_0x356e1f,_0x36bc0f);_0x151bb5[_0xf5e1('0xa1')]=0x12;_0x151bb5[_0xf5e1('0xa2')]=_0xf5e1('0xd7');_0x151bb5[_0xf5e1('0xd8')]=_0xf5e1('0xd9');this[_0xf5e1('0xc4')](_0x151bb5,_0xf5e1('0xda'),_0xf5e1('0xdb'));}if(_0x356e1f[_0xf5e1('0x4b')]!==_0xf5e1('0x8c')&&this[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0xd5')]&&_0x36bc0f[_0xf5e1('0xd6')]===_0xf5e1('0xdc')){var _0x27aec3=this;return new BPromise(function(_0x1d8145,_0x5e58e2){delete _0x27aec3['uniqueId'][_0x36bc0f[_0xf5e1('0xd1')]];_0x27aec3[_0xf5e1('0xab')](_0x27aec3[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]]);_0x27aec3[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0x58')]+=0x1;_0x27aec3[_0xf5e1('0x20')][_0x356e1f['queue']][_0xf5e1('0x57')]+=0x1;var _0x32bfd0=_0x27aec3['voiceQueues'][_0x356e1f[_0xf5e1('0xac')]];var _0x2a3a9d=new Hangup(_0x356e1f,_0x36bc0f);_0x2a3a9d[_0xf5e1('0xa1')]=0x13;_0x2a3a9d[_0xf5e1('0xa2')]='Machine';_0x2a3a9d[_0xf5e1('0xd8')]=_0xf5e1('0xd9');_0x2a3a9d[_0xf5e1('0xdd')]+=0x1;_0x2a3a9d['countglobal']+=0x1;_0x2a3a9d['amd']=!![];_0x27aec3[_0xf5e1('0xbf')](_0x2a3a9d)['catch'](loggerCatch(_0xf5e1('0xde')));if(_0x2a3a9d[_0xf5e1('0xdf')]+_0x2a3a9d[_0xf5e1('0xe0')]+_0x2a3a9d[_0xf5e1('0xe1')]+_0x2a3a9d[_0xf5e1('0xe2')]+_0x2a3a9d['countdropretry']+_0x2a3a9d['countabandonedretry']+_0x2a3a9d[_0xf5e1('0xdd')]+_0x2a3a9d[_0xf5e1('0xe3')]>=_0x32bfd0[_0xf5e1('0xe4')]){_0x27aec3[_0xf5e1('0xe5')](_0x2a3a9d,_0x1d8145,_0x5e58e2,'reason19\x20machine....');}else{if(_0x2a3a9d[_0xf5e1('0xdd')]>=_0x32bfd0[_0xf5e1('0xe6')]){_0x27aec3[_0xf5e1('0xe7')](_0x2a3a9d,_0x1d8145,_0x5e58e2,_0xf5e1('0xe8'));}else{_0x27aec3[_0xf5e1('0xb7')]({'active':![],'countmachineretry':_0x2a3a9d[_0xf5e1('0xdd')],'scheduledat':moment()[_0xf5e1('0xe9')](_0x32bfd0[_0xf5e1('0xea')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a3a9d[_0xf5e1('0xec')],'ListId':_0x2a3a9d[_0xf5e1('0xc6')],'VoiceQueueId':_0x2a3a9d[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2a3a9d['CampaignId']||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xed')));_0x1d8145({'reschedule':0x1});}}});}if(_0x356e1f[_0xf5e1('0x4b')]===_0xf5e1('0x8c')&&this['campaigns'][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0xd5')]&&_0x36bc0f[_0xf5e1('0xd6')]===_0xf5e1('0xee')){delete this[_0xf5e1('0xd0')][_0x36bc0f[_0xf5e1('0xd1')]];this[_0xf5e1('0xab')](this[_0xf5e1('0x21')][_0x356e1f['queue']]);_0x151bb5=new Hangup(_0x356e1f,_0x36bc0f);_0x151bb5['state']=0x12;_0x151bb5[_0xf5e1('0xa2')]='HangupInAMD';_0x151bb5[_0xf5e1('0xd8')]=_0xf5e1('0xd9');this[_0xf5e1('0xc4')](_0x151bb5,'[syncHangupInAMDIvr][createHistory]',_0xf5e1('0xef'));}if(_0x356e1f[_0xf5e1('0x4b')]==='ivr'&&this['campaigns'][_0x356e1f['queue']]['dialAMDActive']&&_0x36bc0f[_0xf5e1('0xd6')]===_0xf5e1('0xdc')){var _0x27aec3=this;return new BPromise(function(_0x50b08d,_0x3918e7){delete _0x27aec3['uniqueId'][_0x36bc0f[_0xf5e1('0xd1')]];_0x27aec3['updateOriginated'](_0x27aec3['campaigns'][_0x356e1f[_0xf5e1('0xac')]]);_0x27aec3[_0xf5e1('0x21')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0x58')]+=0x1;_0x27aec3[_0xf5e1('0x21')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0x57')]+=0x1;var _0x18ee9c=_0x27aec3['campaigns'][_0x356e1f[_0xf5e1('0xac')]];var _0x5b6176=new Hangup(_0x356e1f,_0x36bc0f);_0x5b6176[_0xf5e1('0xa1')]=0x13;_0x5b6176['statedesc']=_0xf5e1('0xf0');_0x5b6176['membername']=_0xf5e1('0xd9');_0x5b6176[_0xf5e1('0xdd')]+=0x1;_0x5b6176[_0xf5e1('0xf1')]+=0x1;_0x5b6176[_0xf5e1('0xf2')]=!![];_0x27aec3['createHistory'](_0x5b6176)[_0xf5e1('0xaa')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5b6176['countbusyretry']+_0x5b6176['countcongestionretry']+_0x5b6176[_0xf5e1('0xe1')]+_0x5b6176[_0xf5e1('0xe2')]+_0x5b6176[_0xf5e1('0xf3')]+_0x5b6176['countabandonedretry']+_0x5b6176['countmachineretry']+_0x5b6176[_0xf5e1('0xe3')]>=_0x18ee9c[_0xf5e1('0xe4')]){_0x27aec3[_0xf5e1('0xe5')](_0x5b6176,_0x50b08d,_0x3918e7,_0xf5e1('0xf4'));}else{if(_0x5b6176['countmachineretry']>=_0x18ee9c[_0xf5e1('0xe6')]){_0x27aec3['createStateFinal'](_0x5b6176,_0x50b08d,_0x3918e7,_0xf5e1('0xe8'));}else{_0x27aec3[_0xf5e1('0xb7')]({'active':![],'countmachineretry':_0x5b6176[_0xf5e1('0xdd')],'scheduledat':moment()[_0xf5e1('0xe9')](_0x18ee9c[_0xf5e1('0xea')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x5b6176[_0xf5e1('0xec')],'ListId':_0x5b6176[_0xf5e1('0xc6')],'VoiceQueueId':_0x5b6176['VoiceQueueId']||undefined,'CampaignId':_0x5b6176[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xed')));_0x50b08d({'reschedule':0x1});}}});}}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xf7')]=function(_0x50112e){var _0x4dd3f6=this['uniqueId'][_0x50112e[_0xf5e1('0xd1')]];var _0x461af8=this;var _0x5c4de3;if(_0x4dd3f6&&_0x4dd3f6[_0xf5e1('0x4b')]==='ivr'){delete this[_0xf5e1('0xd0')][_0x50112e[_0xf5e1('0xd1')]];this[_0xf5e1('0xab')](this[_0xf5e1('0x21')][_0x4dd3f6['queue']]);this[_0xf5e1('0x21')][_0x4dd3f6[_0xf5e1('0xac')]][_0xf5e1('0xf8')]+=0x1;_0x5c4de3=new Hangup(_0x4dd3f6,_0x50112e);this[_0xf5e1('0xbf')](_0x5c4de3)['catch'](loggerCatch(_0xf5e1('0xf9')));this[_0xf5e1('0xbe')](_0x5c4de3)['catch'](loggerCatch(_0xf5e1('0xfa')));}if(_0x4dd3f6&&_0x4dd3f6['type']!==_0xf5e1('0x8c')&&isNotNull(this[_0xf5e1('0x20')][_0x4dd3f6['queue']][_0xf5e1('0xfb')])){delete this[_0xf5e1('0xd0')][_0x50112e[_0xf5e1('0xd1')]];this[_0xf5e1('0xab')](this[_0xf5e1('0x20')][_0x4dd3f6[_0xf5e1('0xac')]]);this[_0xf5e1('0x20')][_0x4dd3f6[_0xf5e1('0xac')]][_0xf5e1('0x58')]+=0x1;this[_0xf5e1('0x20')][_0x4dd3f6[_0xf5e1('0xac')]][_0xf5e1('0x57')]+=0x1;_0x5c4de3=new Hangup(_0x4dd3f6,_0x50112e);_0x5c4de3[_0xf5e1('0xa1')]=0x10;_0x5c4de3[_0xf5e1('0xa2')]=_0xf5e1('0xfc');_0x5c4de3[_0xf5e1('0xd8')]=_0xf5e1('0xfd');this[_0xf5e1('0xbf')](_0x5c4de3)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xf9')));this[_0xf5e1('0xbe')](_0x5c4de3)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xfa')));}if(_0x4dd3f6&&_0x4dd3f6[_0xf5e1('0x4b')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x4dd3f6[_0xf5e1('0xac')]][_0xf5e1('0xfb')])){delete this['uniqueId'][_0x50112e[_0xf5e1('0xd1')]];this['updateOriginated'](this[_0xf5e1('0x20')][_0x4dd3f6['queue']]);this[_0xf5e1('0x20')][_0x4dd3f6['queue']][_0xf5e1('0x61')]+=0x1;_0x5c4de3=new Hangup(_0x4dd3f6,_0x50112e);_0x5c4de3[_0xf5e1('0xa1')]=0xc;_0x5c4de3['statedesc']=_0x50112e[_0xf5e1('0xfe')];_0x5c4de3[_0xf5e1('0xd8')]='Unknow';this[_0xf5e1('0xbf')](_0x5c4de3)[_0xf5e1('0xaa')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xf5e1('0xbe')](_0x5c4de3)['catch'](loggerCatch(_0xf5e1('0xfa')));}};Dialer[_0xf5e1('0x1c')]['syncAgentComplete']=function(_0x31b40f){var _0xc75e3c=this[_0xf5e1('0xd0')][_0x31b40f[_0xf5e1('0xd1')]];var _0x57e425=this;if(this[_0xf5e1('0x20')][_0x31b40f['queue']]){if(_0xc75e3c&&_0xc75e3c[_0xf5e1('0x4b')]!==_0xf5e1('0x8c')){delete this[_0xf5e1('0xd0')][_0x31b40f[_0xf5e1('0xd1')]];this['voiceQueues'][_0x31b40f['queue']][_0xf5e1('0x58')]+=0x1;var _0x48eb1d=new AgentComplete(_0xc75e3c,_0x31b40f);if(_0x31b40f[_0xf5e1('0xff')]===_0xf5e1('0x100')){_0x48eb1d['agiafterat']=this[_0xf5e1('0x20')][_0x31b40f['queue']][_0xf5e1('0x101')]&&this[_0xf5e1('0x20')][_0x31b40f[_0xf5e1('0xac')]][_0xf5e1('0x102')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xf5e1('0xbf')](_0x48eb1d)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x103')));this['moveContactManagedDialer'](_0x48eb1d)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x104')));}}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x2b')]=function(_0x5daab7){if(this[_0xf5e1('0x20')][_0x5daab7[_0xf5e1('0xac')]]){if(this[_0xf5e1('0xd0')][_0x5daab7['uniqueid']]&&this['uniqueId'][_0x5daab7[_0xf5e1('0xd1')]]['type']!==_0xf5e1('0x8c')){this[_0xf5e1('0xab')](this[_0xf5e1('0x20')][_0x5daab7[_0xf5e1('0xac')]]);this[_0xf5e1('0xd0')][_0x5daab7['uniqueid']][_0xf5e1('0x105')]=moment()[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xf5e1('0x1c')]['queueCallerAbandonCreateState']=function(_0x491fed){this[_0xf5e1('0xbf')](_0x491fed)['catch'](loggerCatch(_0xf5e1('0x103')));this[_0xf5e1('0xbe')](_0x491fed)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x106')));};Dialer[_0xf5e1('0x1c')]['syncQueueCallerAbandon']=function(_0x336b31){var _0x722ea1=this['uniqueId'][_0x336b31[_0xf5e1('0xd1')]];var _0x2db441=this;if(this[_0xf5e1('0x20')][_0x336b31[_0xf5e1('0xac')]]){if(_0x722ea1&&_0x722ea1[_0xf5e1('0x4b')]!==_0xf5e1('0x8c')){delete this['uniqueId'][_0x336b31[_0xf5e1('0xd1')]];this[_0xf5e1('0xab')](this[_0xf5e1('0x20')][_0x336b31[_0xf5e1('0xac')]]);_0x722ea1[_0xf5e1('0x107')]=moment()['format'](_0xf5e1('0xf5'));var _0x3eceda=new QueueCallerAbandon(_0x722ea1,_0x336b31);if(getSeconds(_0x722ea1[_0xf5e1('0x107')],_0x722ea1[_0xf5e1('0x108')])>=_0x722ea1['dialQueueTimeout']){this[_0xf5e1('0x20')][_0x336b31[_0xf5e1('0xac')]][_0xf5e1('0x66')]+=0x1;this['voiceQueues'][_0x336b31[_0xf5e1('0xac')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xf5e1('0x20')][_0x336b31[_0xf5e1('0xac')]][_0xf5e1('0x68')]+=0x1;_0x3eceda[_0xf5e1('0xa1')]=0xa;_0x3eceda[_0xf5e1('0xa2')]=_0xf5e1('0x109');_0x3eceda[_0xf5e1('0x10a')]=_0xf5e1('0x10b');_0x3eceda[_0xf5e1('0x10c')]=this[_0xf5e1('0x20')][_0x336b31['queue']]['dialQueueProject2']?moment()['format'](_0xf5e1('0xf5')):undefined;_0x3eceda['countdropretry']+=0x1;_0x3eceda[_0xf5e1('0xf1')]+=0x1;if(_0x3eceda[_0xf5e1('0xf3')]>=this['voiceQueues'][_0x336b31['queue']][_0xf5e1('0x10d')]){this[_0xf5e1('0x10e')](_0x3eceda);}else{this[_0xf5e1('0xb7')]({'active':![],'countdropretry':_0x3eceda['countdropretry'],'scheduledat':moment()[_0xf5e1('0xe9')](this[_0xf5e1('0x20')][_0x336b31[_0xf5e1('0xac')]][_0xf5e1('0x10f')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x722ea1[_0xf5e1('0xec')],'ListId':_0x722ea1[_0xf5e1('0xc6')],'VoiceQueueId':_0x722ea1[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x722ea1[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x110')));var _0x29b74d=new History(_0x3eceda);_0x29b74d[_0xf5e1('0xa1')]=0xa;_0x29b74d[_0xf5e1('0xa2')]=_0xf5e1('0x109');_0x29b74d[_0xf5e1('0xa4')]=moment()[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');_0x29b74d[_0xf5e1('0xa3')]=_0x29b74d['starttime'];_0x29b74d['calleridname']=_0x3eceda['calleridname'];_0x29b74d[_0xf5e1('0x111')]=_0x3eceda[_0xf5e1('0x111')];this[_0xf5e1('0xbf')](_0x29b74d)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x112')));}}else{this[_0xf5e1('0x20')][_0x336b31['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xf5e1('0x20')][_0x336b31[_0xf5e1('0xac')]][_0xf5e1('0x5c')]+=0x1;_0x3eceda[_0xf5e1('0xa1')]=0xb;_0x3eceda[_0xf5e1('0xa2')]=_0xf5e1('0x113');_0x3eceda['dropreason']='CALLEREXIT';_0x3eceda[_0xf5e1('0x114')]+=0x1;_0x3eceda[_0xf5e1('0xf1')]+=0x1;if(_0x3eceda[_0xf5e1('0x114')]>=this['voiceQueues'][_0x336b31[_0xf5e1('0xac')]][_0xf5e1('0x115')]){this['queueCallerAbandonCreateState'](_0x3eceda);}else{this[_0xf5e1('0xb7')]({'active':![],'countabandonedretry':_0x3eceda['countabandonedretry'],'scheduledat':moment()[_0xf5e1('0xe9')](this['voiceQueues'][_0x336b31[_0xf5e1('0xac')]][_0xf5e1('0x116')],'minutes')[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x722ea1[_0xf5e1('0xec')],'ListId':_0x722ea1['ListId'],'VoiceQueueId':_0x722ea1[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x722ea1[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x117')));var _0x29b74d=new History(_0x3eceda);_0x29b74d[_0xf5e1('0xa1')]=0xb;_0x29b74d[_0xf5e1('0xa2')]=_0xf5e1('0x113');_0x29b74d[_0xf5e1('0xa4')]=moment()[_0xf5e1('0x8e')](_0xf5e1('0xf5'));_0x29b74d[_0xf5e1('0xa3')]=_0x29b74d[_0xf5e1('0xa4')];_0x29b74d[_0xf5e1('0x118')]=_0x3eceda[_0xf5e1('0x118')];_0x29b74d[_0xf5e1('0x111')]=_0x3eceda['calleridnum'];this[_0xf5e1('0xbf')](_0x29b74d)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x119')));}}}}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x35')]=function(_0x29b2f1){if(this[_0xf5e1('0xa8')][_0x29b2f1['uniqueid']]){this['actions'][_0x29b2f1['uniqueid']][_0xf5e1('0x11a')]=_0x29b2f1[_0xf5e1('0x11a')];}if(this[_0xf5e1('0xd0')][_0x29b2f1[_0xf5e1('0xd1')]]){this[_0xf5e1('0xd0')][_0x29b2f1[_0xf5e1('0xd1')]][_0xf5e1('0x11a')]=_0x29b2f1[_0xf5e1('0x11a')];}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x11b')]=function(_0x30d74e){if(strategy[this['voiceQueues'][this[_0xf5e1('0xa8')][_0x30d74e[_0xf5e1('0x11c')]]['queue']][_0xf5e1('0x4d')]]===_0xf5e1('0x1b')){if(this['actions'][_0x30d74e[_0xf5e1('0x11c')]]&&_[_0xf5e1('0xd2')](this['actions'][_0x30d74e[_0xf5e1('0x11c')]][_0xf5e1('0x11d')])&&_0x30d74e[_0xf5e1('0xa9')]==='1'&&_0x30d74e['paused']==='0'){if(this[_0xf5e1('0x22')][_0x30d74e['stateinterface']]){if(!this[_0xf5e1('0x22')][_0x30d74e[_0xf5e1('0x11e')]][_0xf5e1('0x11d')]){this['agents'][_0x30d74e[_0xf5e1('0x11e')]]['locked']=!![];this['actions'][_0x30d74e['actionid']]['locked']=!![];this[_0xf5e1('0xa8')][_0x30d74e[_0xf5e1('0x11c')]][_0xf5e1('0x11e')]=_0x30d74e[_0xf5e1('0x11e')];}}}}else if((strategy[this[_0xf5e1('0x20')][this[_0xf5e1('0xa8')][_0x30d74e[_0xf5e1('0x11c')]][_0xf5e1('0xac')]][_0xf5e1('0x4d')]]||_0xf5e1('0x1a'))===_0xf5e1('0x1a')){if(this[_0xf5e1('0xa8')][_0x30d74e[_0xf5e1('0x11c')]]){if(this[_0xf5e1('0x22')][_0x30d74e[_0xf5e1('0x11e')]]){this['actions'][_0x30d74e[_0xf5e1('0x11c')]]['stateinterface']=_0x30d74e['stateinterface'];if(_[_0xf5e1('0xd2')](this[_0xf5e1('0x28')][this[_0xf5e1('0xa8')][_0x30d74e[_0xf5e1('0x11c')]][_0xf5e1('0xac')]])){this[_0xf5e1('0x28')][this[_0xf5e1('0xa8')][_0x30d74e['actionid']]['queue']]=[];}this[_0xf5e1('0x28')][this['actions'][_0x30d74e[_0xf5e1('0x11c')]][_0xf5e1('0xac')]][_0xf5e1('0x11f')](_[_0xf5e1('0xc5')](_[_0xf5e1('0x120')](this[_0xf5e1('0xa8')][_0x30d74e['actionid']],[_0xf5e1('0x121'),_0xf5e1('0x11e')]),{'status':_0x30d74e['status'],'paused':_0x30d74e[_0xf5e1('0x122')]}));}}}};function unlockQueueStatus(_0xa94dc5,_0x465178){setTimeout(function(){if(_[_0xf5e1('0x3a')](_0xa94dc5[_0xf5e1('0x123')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x465178);}_0xa94dc5['queueStatusComplete']=!![];loggerBooked['info'](_0xf5e1('0x124'),_0x465178,JSON[_0xf5e1('0x125')](_[_0xf5e1('0x120')](_0xa94dc5,[_0xf5e1('0x3c'),_0xf5e1('0x123')])));},0x1f3);}Dialer['prototype'][_0xf5e1('0x126')]=function(_0x25108a){var _0x571413=this;var _0x52be65=_0x571413['voiceQueues'][_0x571413['actions'][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]];if(strategy[this[_0xf5e1('0x20')][this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]]['strategy']]===_0xf5e1('0x1b')){if(this['actions'][_0x25108a[_0xf5e1('0x11c')]]&&this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0x11e')]){this[_0xf5e1('0x8b')][_0xf5e1('0x127')](this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0x121')],this[_0xf5e1('0xa8')][_0x25108a['actionid']][_0xf5e1('0x11e')])[_0xf5e1('0xaa')](function(_0x113c75){logger[_0xf5e1('0x90')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xf5e1('0x91')](_0x113c75,{'showHidden':![],'depth':null}));})[_0xf5e1('0x128')](function(){_0x571413[_0xf5e1('0xab')](_0x571413['voiceQueues'][_0x571413[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]]);_0x571413[_0xf5e1('0x22')][_0x571413['actions'][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0x11e')]]['locked']=![];delete _0x571413[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]];unlockQueueStatus(_0x52be65);});}else{this[_0xf5e1('0xab')](this['voiceQueues'][this['actions'][_0x25108a['actionid']][_0xf5e1('0xac')]]);this[_0xf5e1('0xb7')]({'active':![],'ContactId':this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xec')],'ListId':this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]]['ListId'],'VoiceQueueId':this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xc8')]||undefined,'CampaignId':this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]]['CampaignId']||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x129')));delete this[_0xf5e1('0xa8')][_0x25108a['actionid']];unlockQueueStatus(_0x52be65);}}else if((strategy[this[_0xf5e1('0x20')][this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]][_0xf5e1('0x4d')]]||'rrmemory')===_0xf5e1('0x1a')){var _0x1df5ce;if(this['actions'][_0x25108a['actionid']]&&!_[_0xf5e1('0x44')](this[_0xf5e1('0x28')][this['actions'][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]])){if(this['queueBookedRR'][_0x571413[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]]['queue']]){this[_0xf5e1('0x29')][_0x571413['actions'][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]]=this[_0xf5e1('0x29')][this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]]?this[_0xf5e1('0x29')][this['actions'][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]]:this[_0xf5e1('0x28')][this[_0xf5e1('0xa8')][_0x25108a['actionid']]['queue']]?this[_0xf5e1('0x28')][this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]][_0xf5e1('0x12a')]||0x0:0x0;}this[_0xf5e1('0x28')][this['actions'][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]]['_rr']=this[_0xf5e1('0x29')][this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]];for(var _0x4a14b1=0x0;_0x4a14b1=0x0?!![]:![];})[_0xf5e1('0xaa')](myreject(_0xcec10f)));}}else{_0x48ae28[_0xf5e1('0x11f')](ami['Action']({'action':_0xf5e1('0x141'),'command':util[_0xf5e1('0x8e')](_0xf5e1('0x142'),_0x405306,!_[_0xf5e1('0x3a')](config[_0xf5e1('0x13d')][_0x3a49cf])?_0x3a49cf:'')})['then'](function(_0x697470){return _0x697470[_0xf5e1('0x144')][_0xf5e1('0x145')](_0xf5e1('0x146'))>=0x0?!![]:![];})[_0xf5e1('0xaa')](myreject(_0xcec10f)));}BPromise[_0xf5e1('0x147')](_0x48ae28)[_0xf5e1('0xb2')](function(_0x83ed10){var _0x4dec40=_['some'](_0x83ed10);if(_0x4dec40){return _0x242437(_0x4dec40);}else{_0x31d5c8[_0xf5e1('0x3e')]=_0x2a0d5e?_0xf5e1('0x148'):_0xf5e1('0x149');return _0xcec10f(msgResponse(_0xf5e1('0x14a'),_0xf5e1('0x13a'),'Global:\x20'+_0x2a0d5e+'\x20'+_0x2931be+'\x20Interval\x20is\x20overtime:\x20'+util[_0xf5e1('0x91')](_0x405306,{'showHidden':![],'depth':null})+_0xf5e1('0x14b')+_0x3a49cf));}})[_0xf5e1('0xaa')](function(_0x58591e){return _0xcec10f(msgResponse(_0xf5e1('0x139'),'Failure',JSON[_0xf5e1('0x125')](_0x58591e)));});});};Dialer['prototype'][_0xf5e1('0x14c')]=function(_0x4788dc){var _0x41b083=this;return function(){switch(_0x4788dc['dialMethod']){case _0xf5e1('0x14d'):freeVariablesPredictive(_0x4788dc);_0x41b083[_0xf5e1('0x14e')](_0x4788dc,0x1);break;case _0xf5e1('0x14f'):freeVariablesPredictive(_0x4788dc);_0x41b083['handlePower'](_0x4788dc,_0x4788dc[_0xf5e1('0x150')]);break;case _0xf5e1('0xb'):_0x41b083['predictive'](_0x4788dc);break;case'booked':freeVariablesPredictive(_0x4788dc);_0x41b083[_0xf5e1('0x14e')](_0x4788dc,0x1);break;default:freeVariablesPredictive(_0x4788dc);logger[_0xf5e1('0x90')](_0xf5e1('0x151'),_0x4788dc[_0xf5e1('0x3c')],_0xf5e1('0x152'));}};};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x153')]=function(_0x179afb){var _0x2c0cf8=this;return function(){_0x2c0cf8[_0xf5e1('0x154')](_0x179afb);};};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x32')]=function(_0x253643){var _0x1faf12=this;if(isNotPreview(_0x253643['dialMethod'])){if(isVoiceQueueOutbound(_0x253643[_0xf5e1('0x4b')])&&isActive(_0x253643['dialActive'])){_0x253643[_0xf5e1('0x9a')]=!![];BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](checkIsLoggedIn(_0x253643,_0x253643[_0xf5e1('0x4f')]))['then'](checkIsActive(_0x253643,_0x253643[_0xf5e1('0x54')]))[_0xf5e1('0xb2')](checkInterval(_0x253643))[_0xf5e1('0xb2')](_0x1faf12['checkIsTrunkReachable'](_0x253643))[_0xf5e1('0xb2')](_0x1faf12[_0xf5e1('0x138')](_0x253643[_0xf5e1('0x155')],_0x253643['dialTimezone'],_0x253643['name'],_0x253643))[_0xf5e1('0xb2')](_0x1faf12[_0xf5e1('0x156')](_0x253643[_0xf5e1('0x40')],_0x253643[_0xf5e1('0x157')],_0x253643[_0xf5e1('0x3c')],_0x253643))[_0xf5e1('0xb2')](_0x1faf12[_0xf5e1('0x14c')](_0x253643))[_0xf5e1('0xaa')](loggerCatchQueueSummary(_0xf5e1('0x158'),_0x253643));}else{notSendMessagesQueue(_0x253643);}}else{freeVariablesPredictive(_0x253643);}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x134')]=function(){var _0x15b095=this;var _0x9444b8;for(var _0x58f9df in this['campaigns']){if(this[_0xf5e1('0x21')][_0xf5e1('0x93')](_0x58f9df)){_0x9444b8=this[_0xf5e1('0x21')][_0x58f9df];if(isCampaignIvr(_0x9444b8[_0xf5e1('0x4b')])&&isActive(_0x9444b8[_0xf5e1('0x74')])){_0x9444b8[_0xf5e1('0x9a')]=!![];BPromise[_0xf5e1('0xaf')]()['then'](checkIsActive(_0x9444b8,_0x9444b8[_0xf5e1('0x74')]))[_0xf5e1('0xb2')](checkInterval(_0x9444b8))['then'](_0x15b095['checkIsTrunkReachable'](_0x9444b8))[_0xf5e1('0xb2')](_0x15b095[_0xf5e1('0x138')](_0x9444b8['dialGlobalInterval'],_0x9444b8[_0xf5e1('0x157')],_0x9444b8[_0xf5e1('0x3c')],_0x9444b8))[_0xf5e1('0xb2')](_0x15b095['checkIfTimeIntervals'](_0x9444b8[_0xf5e1('0x40')],_0x9444b8[_0xf5e1('0x157')],_0x9444b8[_0xf5e1('0x3c')],_0x9444b8))[_0xf5e1('0xb2')](_0x15b095['launchHandleIvr'](_0x9444b8))['catch'](loggerCatchQueueSummary(_0xf5e1('0x159'),_0x9444b8));}else{notSendMessagesCampaign(_0x9444b8);}}}};function getCallerIdRandom(_0x2cd7b4,_0x70bdc9){var _0x22a03b,_0x1ddae7,_0x34fad9;if(_0x70bdc9<=0x0){_0x70bdc9=0x1;}_0x22a03b=new RegExp('\x5cw{0,'+_0x70bdc9+'}$');_0x1ddae7=Math['pow'](0xa,_0x70bdc9-0x1);_0x34fad9=Math[_0xf5e1('0x15a')](0xa,_0x70bdc9)-0x1;return util[_0xf5e1('0x8e')]('%s',_[_0xf5e1('0x15b')](_0x2cd7b4,_0x22a03b,_[_0xf5e1('0x15c')](_0x1ddae7,_0x34fad9)));}function extractCalleridName(_0x44becd){var _0x2a9bf0=_0x44becd[_0xf5e1('0x15d')](/"(.*?)"/);return _0x2a9bf0?_0x2a9bf0[0x1]:_0x44becd;}function extractCalleridNumber(_0x8e658b){var _0x5f0c9e=_0x8e658b['match'](/<(.*?)>/);return _0x5f0c9e?_0x5f0c9e[0x1]:_0x8e658b;}Dialer[_0xf5e1('0x1c')][_0xf5e1('0x15e')]=function(_0x4e5959,_0x4573b9){var _0x441246=this;var _0x1630e6=uuid['v4']();this['actions'][_0x1630e6]=new Action(_0x4e5959,_0x4573b9,_0x1630e6);return new BPromise(function(_0x4d4eed,_0x3a76a7){if(_['isUndefined'](_0x4e5959)&&_0xf5e1('0x15f')!==typeof _0x4e5959){return _0x3a76a7(msgResponse('originate',_0xf5e1('0x13a'),_0xf5e1('0x160')));}if(_[_0xf5e1('0x3a')](_0x4573b9[_0xf5e1('0x161')]['phone'])||_0x4573b9[_0xf5e1('0x161')][_0xf5e1('0x162')]===null){return _0x3a76a7(msgResponse('originate',_0xf5e1('0x13a'),'contact\x20is\x20undefine'));}var _0x204781={'XMD-CALLERID':_0x441246[_0xf5e1('0xa8')][_0x1630e6][_0xf5e1('0x163')](),'XMD-AGI':_0x4e5959[_0xf5e1('0xfb')]?util[_0xf5e1('0x8e')](_0xf5e1('0x164'),ipAgi,_0x4e5959[_0xf5e1('0xfb')]):_0xf5e1('0x165'),'XMD-AGIAFTER':_0x4e5959[_0xf5e1('0x101')]?util[_0xf5e1('0x8e')](_0xf5e1('0x164'),ipAgi,_0x4e5959[_0xf5e1('0x101')]):_0xf5e1('0x165'),'XMD-QUEUE':_0x4e5959['type']==='outbound'?util[_0xf5e1('0x8e')](_0xf5e1('0x166'),_0x4e5959[_0xf5e1('0x3c')],_0x4e5959[_0xf5e1('0x167')]||'',_0x4e5959['dialAgiAfterHangupAgent']?'c':'',_0x4e5959[_0xf5e1('0x168')]||0x3):_0xf5e1('0x165'),'XMD-CONTACTID':_0x4573b9[_0xf5e1('0xec')],'XMD-CDRTYPE':_0xf5e1('0xa'),'CALLERID(all)':_0x441246[_0xf5e1('0xa8')][_0x1630e6][_0xf5e1('0x163')](),'XMD-AMD':_0x4e5959[_0xf5e1('0xd5')]?_0xf5e1('0x169'):_0xf5e1('0x165'),'XMD-DESTINATION':_0xf5e1('0x16a')};if(_0x4e5959['dialAMDActive']){_0x204781[_0xf5e1('0x16b')]=_0x4e5959[_0xf5e1('0x16c')]||0x9c4;_0x204781[_0xf5e1('0x16d')]=_0x4e5959['dialAMDGreeting']||0x5dc;_0x204781[_0xf5e1('0x16e')]=_0x4e5959[_0xf5e1('0x16f')]||0x320;_0x204781[_0xf5e1('0x170')]=_0x4e5959[_0xf5e1('0x171')]||0x1388;_0x204781[_0xf5e1('0x172')]=_0x4e5959['dialAMDMinWordLength']||0x64;_0x204781[_0xf5e1('0x173')]=_0x4e5959['dialAMDBetweenWordsSilence']||0x32;_0x204781[_0xf5e1('0x174')]=_0x4e5959[_0xf5e1('0x175')]||0x3;_0x204781[_0xf5e1('0x176')]=_0x4e5959[_0xf5e1('0x177')]||0x100;_0x204781[_0xf5e1('0x178')]=_0x4e5959[_0xf5e1('0x179')]||0x1388;}if(_0x4e5959[_0xf5e1('0x4b')]==='outbound'){_0x204781[_0xf5e1('0x17a')]=_0x4573b9['VoiceQueueId'];}else{_0x204781[_0xf5e1('0x17b')]=_0x4573b9[_0xf5e1('0xf6')];}for(var _0x220858 in _0x4573b9[_0xf5e1('0x161')]){if(_0x4573b9[_0xf5e1('0x161')]['hasOwnProperty'](_0x220858)){if(isNotNull(_0x4573b9[_0xf5e1('0x161')][_0x220858])&&_0x220858!=='id'&&_0x220858!=='tags'&&_0x220858!==_0xf5e1('0x17c')&&_0x220858!==_0xf5e1('0x17d')){_0x204781[util[_0xf5e1('0x8e')](_0xf5e1('0x17e'),'XMD-',_[_0xf5e1('0x17f')](_0x220858))]=_0x4573b9[_0xf5e1('0x161')][_0x220858];}}}var _0x5ebc92=_0x441246[_0xf5e1('0xcc')](_0x4e5959['Trunk'])?getCallerId(_0x4e5959[_0xf5e1('0x73')]['callerid'],_0x4e5959[_0xf5e1('0x56')],_0x4e5959[_0xf5e1('0x180')]>0x0?getCallerIdRandom(_0x4e5959[_0xf5e1('0x181')],_0x4e5959[_0xf5e1('0x180')]):_0x4e5959['dialOriginateCallerIdNumber']):getCallerId(_[_0xf5e1('0xd2')](_0x4e5959[_0xf5e1('0x136')])?_0x4e5959[_0xf5e1('0x73')][_0xf5e1('0x75')]:_0x4e5959[_0xf5e1('0x136')][_0xf5e1('0x75')],_0x4e5959[_0xf5e1('0x56')],_0x4e5959[_0xf5e1('0x180')]>0x0?getCallerIdRandom(_0x4e5959[_0xf5e1('0x181')],_0x4e5959[_0xf5e1('0x180')]):_0x4e5959[_0xf5e1('0x181')]);if(_0x5ebc92){_0x204781[_0xf5e1('0x182')]=_0x441246[_0xf5e1('0xa8')][_0x1630e6][_0xf5e1('0x183')]=extractCalleridName(_0x5ebc92);_0x204781[_0xf5e1('0x184')]=_0x441246[_0xf5e1('0xa8')][_0x1630e6][_0xf5e1('0x185')]=extractCalleridNumber(_0x5ebc92);}return ami[_0xf5e1('0x140')]({'actionid':_0x1630e6,'action':_0xf5e1('0x186'),'channel':_0x441246[_0xf5e1('0xcc')](_0x4e5959[_0xf5e1('0x73')])?util['format'](_0xf5e1('0x187'),_0x4e5959[_0xf5e1('0x73')][_0xf5e1('0x3c')],isNotNull(_0x4e5959[_0xf5e1('0x188')])?_0x4e5959[_0xf5e1('0x188')]['trim']()||'':'',_0x4e5959[_0xf5e1('0x189')]>0x0?_0x4573b9[_0xf5e1('0x161')][_0xf5e1('0x162')][_0xf5e1('0x18a')](_0x4e5959[_0xf5e1('0x189')]):_0x4573b9[_0xf5e1('0x161')]['phone']):util['format']('SIP/%s/%s%s',_[_0xf5e1('0xd2')](_0x4e5959[_0xf5e1('0x136')])?_0x4e5959[_0xf5e1('0x73')][_0xf5e1('0x3c')]:_0x4e5959[_0xf5e1('0x136')][_0xf5e1('0x3c')],isNotNull(_0x4e5959[_0xf5e1('0x188')])?_0x4e5959[_0xf5e1('0x188')][_0xf5e1('0x18b')]()||'':'',_0x4e5959[_0xf5e1('0x189')]>0x0?_0x4573b9['Contact'][_0xf5e1('0x162')]['substring'](_0x4e5959[_0xf5e1('0x189')]):_0x4573b9['Contact']['phone']),'callerid':_0x5ebc92,'Exten':_0xf5e1('0x16a'),'Context':_0xf5e1('0x18c'),'Priority':'1','variable':_0x204781,'timeout':(_0x4e5959[_0xf5e1('0x18d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1630e6})[_0xf5e1('0xb2')](function(_0x443b11){return _0x4d4eed(_0x443b11);})[_0xf5e1('0xaa')](function(_0x1f5cdd){_0x4e5959[_0xf5e1('0x5f')]+=0x1;var _0x36e276=new History(_0x441246[_0xf5e1('0xa8')][_0x1630e6]);logger[_0xf5e1('0x90')](util[_0xf5e1('0x8e')]('[originateError]:\x20%s',JSON[_0xf5e1('0x125')](_0x1f5cdd)));_0x36e276['state']=0xe;_0x36e276['statedesc']=_0xf5e1('0x18e');_0x36e276['starttime']=moment()[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');_0x36e276['endtime']=_0x36e276[_0xf5e1('0xa4')];_0x441246[_0xf5e1('0xbf')](_0x36e276)[_0xf5e1('0xaa')](loggerCatch('[originate][error]'));_0x441246['moveContactManagedDialer'](_0x36e276)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x18f')))[_0xf5e1('0x128')](function(){delete _0x441246[_0xf5e1('0xa8')][_0x1630e6];return _0x3a76a7(msgResponse(_0xf5e1('0x186'),_0xf5e1('0x46'),_0xf5e1('0x190')));});});});};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x2e')]=function(_0x2a3e99){var _0x3e0d2f=this[_0xf5e1('0xa8')][_0x2a3e99[_0xf5e1('0x11c')]];var _0x53e770=this;if(_0x3e0d2f){delete this[_0xf5e1('0xa8')][_0x2a3e99[_0xf5e1('0x11c')]];_0x3e0d2f[_0xf5e1('0x108')]=moment()[_0xf5e1('0x8e')](_0xf5e1('0xf5'));var _0x10c73f=_0x3e0d2f['type']===_0xf5e1('0x8c')?this[_0xf5e1('0x21')][_0x3e0d2f['queue']]:this[_0xf5e1('0x20')][_0x3e0d2f['getQueue']()];if(!this['isSuccess'](_0x2a3e99['response'])){this['updateOriginated'](_0x10c73f);return this[_0xf5e1('0x191')](_0x3e0d2f,_0x10c73f,_0x2a3e99)[_0xf5e1('0xb2')](function(_0x21e109){})['catch'](loggerCatch(_0xf5e1('0x192')));}else{this[_0xf5e1('0xd0')][_0x2a3e99[_0xf5e1('0xd1')]]=_0x3e0d2f;}}};Dialer[_0xf5e1('0x1c')]['checkRetriveMax']=function(_0x1fc793,_0x4d7449,_0x26e35a){var _0x2df2ff=new History(_0x4d7449);if(_0x2df2ff['countbusyretry']+_0x2df2ff[_0xf5e1('0xe0')]+_0x2df2ff[_0xf5e1('0xe1')]+_0x2df2ff[_0xf5e1('0xe2')]+_0x2df2ff['countdropretry']+_0x2df2ff[_0xf5e1('0x114')]+_0x2df2ff[_0xf5e1('0xdd')]+_0x2df2ff[_0xf5e1('0xe3')]>=_0x26e35a[_0xf5e1('0xe4')]-0x1){return!![];}switch(_0x1fc793){case 0x3:if(_0x2df2ff[_0xf5e1('0xe1')]>=_0x26e35a[_0xf5e1('0x193')]-0x1){return!![];}else{this[_0xf5e1('0xb7')]({'active':![],'countnoanswerretry':_0x2df2ff[_0xf5e1('0xe1')]+=0x1,'scheduledat':moment()[_0xf5e1('0xe9')](_0x26e35a[_0xf5e1('0x194')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2df2ff['ContactId'],'ListId':_0x2df2ff['ListId'],'VoiceQueueId':_0x2df2ff[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2df2ff[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x195')));}break;case 0x5:if(_0x2df2ff[_0xf5e1('0xdf')]>=_0x26e35a[_0xf5e1('0x196')]-0x1){return!![];}else{this[_0xf5e1('0xb7')]({'active':![],'countbusyretry':_0x2df2ff[_0xf5e1('0xdf')]+=0x1,'scheduledat':moment()[_0xf5e1('0xe9')](_0x26e35a[_0xf5e1('0x197')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2df2ff[_0xf5e1('0xec')],'ListId':_0x2df2ff[_0xf5e1('0xc6')],'VoiceQueueId':_0x2df2ff[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2df2ff['CampaignId']||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x198')));}break;case 0x8:if(_0x2df2ff['countcongestionretry']>=_0x26e35a[_0xf5e1('0x199')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x2df2ff[_0xf5e1('0xe0')]+=0x1,'scheduledat':moment()['add'](_0x26e35a[_0xf5e1('0x19a')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x2df2ff['ContactId'],'ListId':_0x2df2ff['ListId'],'VoiceQueueId':_0x2df2ff[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2df2ff[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x2df2ff[_0xf5e1('0xe2')]>=_0x26e35a['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xf5e1('0xb7')]({'active':![],'countnosuchnumberretry':_0x2df2ff[_0xf5e1('0xe2')]+=0x1,'scheduledat':moment()[_0xf5e1('0xe9')](_0x26e35a['dialNoSuchNumberRetryFrequency'],_0xf5e1('0xeb'))[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x2df2ff['ContactId'],'ListId':_0x2df2ff[_0xf5e1('0xc6')],'VoiceQueueId':_0x2df2ff[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2df2ff[_0xf5e1('0xf6')]||undefined})['catch'](loggerCatch(_0xf5e1('0x19b')));}break;case 0xa:if(_0x2df2ff[_0xf5e1('0xf3')]>=_0x26e35a[_0xf5e1('0x10d')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x2df2ff['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x26e35a[_0xf5e1('0x10f')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x2df2ff[_0xf5e1('0xec')],'ListId':_0x2df2ff[_0xf5e1('0xc6')],'VoiceQueueId':_0x2df2ff['VoiceQueueId']||undefined,'CampaignId':_0x2df2ff[_0xf5e1('0xf6')]||undefined})['catch'](loggerCatch(_0xf5e1('0x110')));}break;case 0xb:if(_0x2df2ff['countabandonedretry']>=_0x26e35a[_0xf5e1('0x115')]-0x1){return!![];}else{this[_0xf5e1('0xb7')]({'active':![],'countabandonedretry':_0x2df2ff[_0xf5e1('0x114')]+=0x1,'scheduledat':moment()[_0xf5e1('0xe9')](_0x26e35a['dialAbandonedRetryFrequency'],_0xf5e1('0xeb'))['format'](_0xf5e1('0xf5')),'ContactId':_0x2df2ff[_0xf5e1('0xec')],'ListId':_0x2df2ff[_0xf5e1('0xc6')],'VoiceQueueId':_0x2df2ff[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2df2ff[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x2df2ff[_0xf5e1('0xdd')]>=_0x26e35a['dialMachineMaxRetry']-0x1){return!![];}else{this[_0xf5e1('0xb7')]({'active':![],'countmachineretry':_0x2df2ff[_0xf5e1('0xdd')]+=0x1,'scheduledat':moment()[_0xf5e1('0xe9')](_0x26e35a[_0xf5e1('0xea')],'minutes')[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x2df2ff[_0xf5e1('0xec')],'ListId':_0x2df2ff[_0xf5e1('0xc6')],'VoiceQueueId':_0x2df2ff[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2df2ff['CampaignId']||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xed')));}break;case 0x14:if(_0x2df2ff[_0xf5e1('0xe3')]>=_0x26e35a[_0xf5e1('0x19c')]-0x1){return!![];}else{this[_0xf5e1('0xb7')]({'active':![],'countagentrejectretry':_0x2df2ff[_0xf5e1('0xe3')]+=0x1,'scheduledat':moment()[_0xf5e1('0xe9')](_0x26e35a['dialAgentRejectRetryFrequency'],'minutes')[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x2df2ff[_0xf5e1('0xec')],'ListId':_0x2df2ff[_0xf5e1('0xc6')],'VoiceQueueId':_0x2df2ff['VoiceQueueId']||undefined,'CampaignId':_0x2df2ff[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x19d')));}break;default:return!![];}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x191')]=function(_0x90df4a,_0x432b51,_0x26c034){var _0xda0813=this;var _0x2e22bb=new History(_0x90df4a);return new BPromise(function(_0x3c8b33,_0x1f51d1){if(_[_0xf5e1('0x3a')](_0x432b51)&&'object'!==typeof _0x432b51){return _0x1f51d1(msgResponse(_0xf5e1('0x19e'),_0xf5e1('0x13a'),_0xf5e1('0x19f')));}if(_[_0xf5e1('0x3a')](_0x26c034)&&_0xf5e1('0x15f')!==typeof _0x26c034){return _0x1f51d1(msgResponse(_0xf5e1('0x19e'),_0xf5e1('0x13a'),'evt\x20is\x20undefine'));}switch(_0x26c034['reason']){case'0':_0x432b51[_0xf5e1('0x5e')]+=0x1;_0x2e22bb[_0xf5e1('0xa1')]=0x0;_0x2e22bb[_0xf5e1('0xa2')]=_0xf5e1('0x1a0');_0x2e22bb['countnosuchnumberretry']+=0x1;_0x2e22bb['countglobal']+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0xf5e1('0x1a1')](_0x90df4a,'nosuchnumber'));_0xda0813[_0xf5e1('0xbf')](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xde')));if(_0xda0813[_0xf5e1('0x1a2')](0x0,_0x90df4a,_0x432b51)){if(_0x2e22bb[_0xf5e1('0xe2')]>=_0x432b51[_0xf5e1('0x1a3')]){_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1a4'));}else{_0xda0813[_0xf5e1('0xe5')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1a4'));}}break;case'3':_0x432b51['outboundNoAnswerCallsDay']+=0x1;_0x2e22bb[_0xf5e1('0xa1')]=0x3;_0x2e22bb[_0xf5e1('0xa2')]='NoAnswer';_0x2e22bb[_0xf5e1('0xe1')]+=0x1;_0x2e22bb[_0xf5e1('0xf1')]+=0x1;ami[_0xf5e1('0x4a')]('custom:agentnoanswer',ut[_0xf5e1('0x1a1')](_0x90df4a,_0xf5e1('0x1a5')));_0xda0813[_0xf5e1('0xbf')](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0xda0813[_0xf5e1('0x1a2')](0x3,_0x90df4a,_0x432b51)){if(_0x2e22bb['countnoanswerretry']>=_0x432b51[_0xf5e1('0x193')]){_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1a6'));}else{_0xda0813[_0xf5e1('0xe5')](_0x2e22bb,_0x3c8b33,_0x1f51d1,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x432b51[_0xf5e1('0x5a')]+=0x1;_0x2e22bb[_0xf5e1('0xa1')]=0x5;_0x2e22bb[_0xf5e1('0xa2')]=_0xf5e1('0x1a7');_0x2e22bb[_0xf5e1('0xdf')]+=0x1;_0x2e22bb[_0xf5e1('0xf1')]+=0x1;ami[_0xf5e1('0x4a')](_0xf5e1('0x1a8'),ut['buildObj'](_0x90df4a,'busy'));_0xda0813[_0xf5e1('0xbf')](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x1a9')));if(_0xda0813[_0xf5e1('0x1a2')](0x5,_0x90df4a,_0x432b51)){if(_0x2e22bb['countbusyretry']>=_0x432b51[_0xf5e1('0x196')]){_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1aa'));}else{_0xda0813[_0xf5e1('0xe5')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1aa'));}}break;case'8':_0x432b51[_0xf5e1('0x1ab')]+=0x1;_0x2e22bb['state']=0x8;_0x2e22bb[_0xf5e1('0xa2')]=_0xf5e1('0x1ac');_0x2e22bb[_0xf5e1('0xe0')]+=0x1;_0x2e22bb[_0xf5e1('0xf1')]+=0x1;ami[_0xf5e1('0x4a')](_0xf5e1('0x1ad'),ut[_0xf5e1('0x1a1')](_0x90df4a,_0xf5e1('0x1ae')));_0xda0813[_0xf5e1('0xbf')](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x1af')));if(_0xda0813[_0xf5e1('0x1a2')](0x8,_0x90df4a,_0x432b51)){if(_0x2e22bb['countcongestionretry']>=_0x432b51[_0xf5e1('0x199')]){_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1b0'));}else{_0xda0813['stateGlobal'](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1b0'));}}break;case'11':_0x432b51[_0xf5e1('0x1b1')]+=0x1;_0x2e22bb[_0xf5e1('0xa1')]=0xb;_0x2e22bb['statedesc']=_0xf5e1('0x113');_0x2e22bb[_0xf5e1('0x114')]+=0x1;_0x2e22bb[_0xf5e1('0xf1')]+=0x1;_0xda0813['createHistory'](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x119')));if(_0xda0813[_0xf5e1('0x1a2')](0xb,_0x90df4a,_0x432b51)){if(_0x2e22bb[_0xf5e1('0x114')]>=_0x432b51[_0xf5e1('0x115')]){_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1b2'));}else{_0xda0813[_0xf5e1('0xe5')](_0x2e22bb,_0x3c8b33,_0x1f51d1,'reason\x2011\x20abandoned');}}break;case'20':_0x432b51[_0xf5e1('0x60')]+=0x1;_0x2e22bb[_0xf5e1('0xa1')]=0x14;_0x2e22bb['statedesc']='AgentReject';_0x2e22bb[_0xf5e1('0xe3')]+=0x1;_0x2e22bb['countglobal']+=0x1;ami[_0xf5e1('0x4a')]('custom:agentreject',ut[_0xf5e1('0x1a1')](_0x90df4a,_0xf5e1('0x1b3')));_0xda0813[_0xf5e1('0xbf')](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x1b4')));if(_0xda0813['checkRetriveMax'](0x14,_0x90df4a,_0x432b51)){if(_0x2e22bb[_0xf5e1('0xe3')]>=_0x432b51[_0xf5e1('0x19c')]){_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1b5'));}else{_0xda0813[_0xf5e1('0xe5')](_0x2e22bb,_0x3c8b33,_0x1f51d1,'reason\x2020\x20agentreject');}}break;default:_0x432b51[_0xf5e1('0x61')]+=0x1;_0x2e22bb[_0xf5e1('0xa1')]=0xc;_0x2e22bb[_0xf5e1('0xa2')]=_0x26c034[_0xf5e1('0xff')];_0xda0813[_0xf5e1('0xbf')](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x1b6')));if(_0xda0813[_0xf5e1('0x1a2')](_0x26c034['reason'],_0x90df4a,_0x432b51)){if(_0x2e22bb[_0xf5e1('0xdf')]+_0x2e22bb['countcongestionretry']+_0x2e22bb['countnoanswerretry']+_0x2e22bb[_0xf5e1('0xe2')]+_0x2e22bb[_0xf5e1('0xf3')]+_0x2e22bb['countabandonedretry']+_0x2e22bb[_0xf5e1('0xdd')]+_0x2e22bb[_0xf5e1('0xe3')]>=_0x432b51[_0xf5e1('0xe4')]){_0xda0813[_0xf5e1('0xe5')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0x26c034[_0xf5e1('0xff')]);}else{_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0x26c034[_0xf5e1('0xff')]);}}}});};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xe5')]=function(_0x3da6d2,_0x3f89b8,_0x525b3b,_0x5bb564){var _0xf2124=new Final(_0x3da6d2);_0xf2124[_0xf5e1('0xa1')]=0xf;_0xf2124[_0xf5e1('0xa2')]='Global';this[_0xf5e1('0xe7')](_0xf2124,_0x3f89b8,_0x525b3b,_0x5bb564);};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xe7')]=function(_0x984b4d,_0x3b22e4,_0x2354a6,_0x4d8a50){this['moveContactManagedDialer'](_0x984b4d)['then'](function(_0x351144){return _0x3b22e4(msgResponse(_0xf5e1('0x19e'),_0xf5e1('0xcb'),_0x4d8a50));})['catch'](function(_0x3144a9){return _0x2354a6(msgResponse(_0xf5e1('0x1b7'),_0xf5e1('0x13a'),_0xf5e1('0x1b8')));});};Dialer['prototype'][_0xf5e1('0xb')]=function(_0x315bf7){var _0x1c21b7=this;var _0x488c14=_0x315bf7[_0xf5e1('0x1b9')]/0x64;var _0xbedcd2=_0x315bf7[_0xf5e1('0x1ba')]/(_0x315bf7['outboundDropCallsDayTimeout']+_0x315bf7[_0xf5e1('0x58')]);var _0x56fe67=Math[_0xf5e1('0x1bb')](_0x315bf7[_0xf5e1('0x6c')]*(_0x315bf7[_0xf5e1('0x1bc')]/0x64));var _0x8b7d0a=Math['round'](_0x315bf7[_0xf5e1('0x6c')]*(_0x315bf7[_0xf5e1('0x1bd')]/0x64));var _0x5d51c4=_0x315bf7[_0xf5e1('0x1be')]+_0x315bf7[_0xf5e1('0x9b')];var _0x330b50=Math['floor'](_0x315bf7[_0xf5e1('0x6e')]*_0x315bf7['erlangAbandonmentRate']*_0x315bf7['predictiveIntervalHitRate']*_0x315bf7['predictiveIntervalMultiplicativeFactor']);if(_[_0xf5e1('0x3a')](_0x315bf7['startProgressive'])){if(!_[_0xf5e1('0x3a')](_0x315bf7['startPredictive'])){_0x315bf7['startPredictive']=undefined;loggerPredictive[_0xf5e1('0x90')](_0xf5e1('0x1bf'),_0xf5e1('0x1c0'));}if(!_[_0xf5e1('0x3a')](_0x315bf7['handlePredictive'])){loggerPredictive[_0xf5e1('0x90')](_0xf5e1('0x1bf'),_0xf5e1('0x1c1'));clearInterval(_0x315bf7[_0xf5e1('0x89')]);_0x315bf7[_0xf5e1('0x89')]=undefined;}_0x315bf7['startProgressive']=moment()[_0xf5e1('0x8e')](_0xf5e1('0xf5'));loggerPredictive[_0xf5e1('0x78')](_0x315bf7[_0xf5e1('0x3c')],_0xf5e1('0x1c2'),_0x315bf7[_0xf5e1('0x72')]);this[_0xf5e1('0x14e')](_0x315bf7,0x1);}else if(ifInterval(_0x315bf7[_0xf5e1('0x1c3')],_0x315bf7[_0xf5e1('0x72')])){this[_0xf5e1('0x14e')](_0x315bf7,0x1);loggerPredictiveCalls[_0xf5e1('0x78')](_0xf5e1('0x1c4'),_0x315bf7[_0xf5e1('0x72')],_0x315bf7[_0xf5e1('0x3c')]);_0x315bf7[_0xf5e1('0x6e')]=0x0;_0x315bf7[_0xf5e1('0x68')]=0x0;}else if(_0x488c14<_0xbedcd2&&_0x315bf7[_0xf5e1('0x1c5')]===_0xf5e1('0x1c6')){freeVariablesPredictive(_0x315bf7);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x1c7'),_0xf5e1('0x1c8'),_0xbedcd2,_0xf5e1('0x72'),_0x315bf7['name']);}else if(_0x330b50<_0x315bf7[_0xf5e1('0x68')]&&_0x315bf7[_0xf5e1('0x1c5')]===_0xf5e1('0x1c6')){freeVariablesPredictive(_0x315bf7);loggerPredictive[_0xf5e1('0x78')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xf5e1('0x1c9'),_0x330b50,_0xf5e1('0x1ca'),_0x315bf7['predictiveIntervalErlangCallsDroppedCalls'],_0xf5e1('0x72'),_0x315bf7['name']);}else if(!ifInterval(_0x315bf7[_0xf5e1('0x1c3')],_0x315bf7[_0xf5e1('0x72')])&&_[_0xf5e1('0x3a')](_0x315bf7[_0xf5e1('0x87')])&&!_[_0xf5e1('0x3a')](_0x315bf7[_0xf5e1('0x72')])){_0x315bf7['startPredictive']=moment()['format'](_0xf5e1('0xf5'));loggerPredictive['info'](_0x315bf7[_0xf5e1('0x3c')],_0xf5e1('0x1cb'),_0x315bf7['startPredictive']);this[_0xf5e1('0xb5')](_0x315bf7[_0xf5e1('0x1c3')])['then'](this[_0xf5e1('0x1cc')](_0x315bf7))['then'](mergeDataErlangB(_0x315bf7))[_0xf5e1('0xb2')](this[_0xf5e1('0x1cd')](_0x315bf7))[_0xf5e1('0xaa')](loggerCatchPredictive(_0xf5e1('0x1ce'),_0x315bf7));}else if(!ifInterval(_0x315bf7['dialPredictiveInterval'],_0x315bf7[_0xf5e1('0x87')])){_0x315bf7[_0xf5e1('0x68')]=0x0;_0x315bf7['startPredictive']=moment()['format'](_0xf5e1('0xf5'));loggerPredictive[_0xf5e1('0x78')](_0x315bf7[_0xf5e1('0x3c')],_0xf5e1('0x1cf'),_0x315bf7['startPredictive']);clearInterval(_0x315bf7[_0xf5e1('0x89')]);_0x315bf7[_0xf5e1('0x89')]=undefined;this[_0xf5e1('0xb5')](_0x315bf7[_0xf5e1('0x1c3')])[_0xf5e1('0xb2')](this[_0xf5e1('0x1cc')](_0x315bf7))[_0xf5e1('0xb2')](mergeDataErlangB(_0x315bf7))[_0xf5e1('0xb2')](this[_0xf5e1('0x1cd')](_0x315bf7))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x315bf7));}else if(_0x315bf7[_0xf5e1('0x6c')]&&_0x5d51c4<_0x315bf7['predictiveIntervalAvailable']-_0x8b7d0a){freeVariablesPredictive(_0x315bf7);loggerPredictive['info'](_0x315bf7[_0xf5e1('0x3c')],_0xf5e1('0x1d0'),_0x5d51c4,_0xf5e1('0x1d1'),_0x315bf7[_0xf5e1('0x6c')],'-',_0x8b7d0a,'=',_0x315bf7[_0xf5e1('0x6c')]-_0x8b7d0a,')');}else if(_0x315bf7['predictiveIntervalAvailable']&&_0x5d51c4>_0x315bf7[_0xf5e1('0x6c')]+_0x56fe67){freeVariablesPredictive(_0x315bf7);loggerPredictive[_0xf5e1('0x78')](_0x315bf7['name'],_0xf5e1('0x1d0'),_0x5d51c4,_0xf5e1('0x1d2'),_0x315bf7[_0xf5e1('0x6c')],'+',_0x56fe67,'=',_0x315bf7[_0xf5e1('0x6c')]+_0x56fe67,')');}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x1cc')]=function(_0x184587){var _0x31dfc0=this;return function(_0x14280){return new BPromise(function(_0x47ea73,_0x1a66c3){_['merge'](_0x184587,_0x14280[0x0]);if(checkGetDataPredictive(_0x14280[0x0])){var _0x3f292d=_0x184587['predictiveIntervalAvailable']=_0x184587[_0xf5e1('0x9b')]+_0x184587[_0xf5e1('0x1be')];var _0x19a432=_0x184587[_0xf5e1('0x1c3')]*0x3c;var _0x462917=_0x14280[0x0][_0xf5e1('0x64')]+_0x14280[0x0]['predictiveIntervalAvgHoldtime'];var _0x2e52a6=(_0x14280[0x0][_0xf5e1('0x62')]+_0x14280[0x0][_0xf5e1('0x66')]+_0x14280[0x0][_0xf5e1('0x65')])/_0x14280[0x0][_0xf5e1('0x6d')];_0x184587[_0xf5e1('0x69')]=_0x2e52a6>0x0?_0x2e52a6:0x1;switch(_0x184587[_0xf5e1('0x1c5')]){case _0xf5e1('0x1c6'):var _0x141a04=_0x184587['dialPredictiveOptimizationPercentage']/0x64;return _0x31dfc0[_0xf5e1('0x1d3')](_0x3f292d,_0x19a432,_0x462917,_0x2e52a6,_0x141a04)['then'](function(_0x7514ec){return _0x47ea73(_0x7514ec);});case'agentBusyFactor':var _0x3a5a59=_0x184587['dialPredictiveOptimizationPercentage']/0x64;return _0x31dfc0['busyFactor'](_0x3f292d,_0x19a432,_0x462917,_0x2e52a6,_0x3a5a59)['then'](function(_0x43a9b0){return _0x47ea73(_0x43a9b0);});default:return _0x1a66c3(msgResponse(_0xf5e1('0x1d4'),_0xf5e1('0x13a'),_0xf5e1('0x1d5')));}}else{return _0x1a66c3(msgResponse(_0xf5e1('0x1d4'),_0xf5e1('0x13a'),_0xf5e1('0x1d6')));}});};};Dialer[_0xf5e1('0x1c')]['getDataPredictiveOld']=function(_0x56a867){var _0x516d4b=this;return function(_0x52e012){return new BPromise(function(_0x19d44f,_0x86edd){_[_0xf5e1('0xc5')](_0x56a867,_0x52e012[0x0]);if(checkGetDataPredictive(_0x52e012[0x0])){loggerPredictive[_0xf5e1('0x78')](JSON[_0xf5e1('0x125')](_0x52e012[0x0]));if(_0x56a867[_0xf5e1('0x1c5')]===_0xf5e1('0x1c6')){return _0x516d4b[_0xf5e1('0xbd')](_0x56a867['id'])[_0xf5e1('0xb2')](function(_0x1415d5){var _0x548136=_0x56a867[_0xf5e1('0x4f')]-_0x1415d5[0x0][_0xf5e1('0x1d7')];var _0xe28540=_0x56a867['dialPredictiveInterval']*0x3c;var _0x3e7d63=_0x52e012[0x0][_0xf5e1('0x64')]+_0x52e012[0x0]['predictiveIntervalAvgHoldtime'];var _0x8be67f=(_0x52e012[0x0][_0xf5e1('0x62')]+_0x52e012[0x0][_0xf5e1('0x66')]+_0x52e012[0x0][_0xf5e1('0x65')])/_0x52e012[0x0]['predictiveIntervalTotalCalls'];var _0x26f12a=_0x56a867[_0xf5e1('0x1b9')]/0x64;_0x56a867['predictiveIntervalPauses']=_0x1415d5[0x0][_0xf5e1('0x1d7')]||0x0;_0x56a867[_0xf5e1('0x69')]=_0x8be67f>0x0?_0x8be67f:0x1;return _0x516d4b[_0xf5e1('0x1d3')](_0x548136,_0xe28540,_0x3e7d63,_0x8be67f,_0x26f12a);})[_0xf5e1('0xb2')](function(_0x56303e){return _0x19d44f(_0x56303e);})[_0xf5e1('0xaa')](function(_0x41ccaf){return _0x86edd(msgResponse(_0xf5e1('0x1d8'),_0xf5e1('0x13a'),JSON[_0xf5e1('0x125')](_0x41ccaf)));});}if(_0x56a867[_0xf5e1('0x1c5')]==='agentBusyFactor'){return _0x516d4b[_0xf5e1('0xbd')](_0x56a867['id'])['then'](function(_0x2d3cf1){var _0x31e79f=_0x56a867[_0xf5e1('0x4f')]-_0x2d3cf1[0x0][_0xf5e1('0x1d7')];var _0x2696f8=_0x56a867[_0xf5e1('0x1c3')]*0x3c;var _0x580e37=_0x52e012[0x0][_0xf5e1('0x64')]+_0x52e012[0x0][_0xf5e1('0x63')];var _0x140132=(_0x52e012[0x0]['predictiveIntervalAnsweredCalls']+_0x52e012[0x0][_0xf5e1('0x66')]+_0x52e012[0x0][_0xf5e1('0x65')])/_0x52e012[0x0][_0xf5e1('0x6d')];var _0x29f90e=_0x56a867['dialPredictiveOptimizationPercentage']/0x64;_0x56a867[_0xf5e1('0x6b')]=_0x2d3cf1[0x0][_0xf5e1('0x1d7')]||0x0;_0x56a867[_0xf5e1('0x69')]=_0x140132>0x0?_0x140132:0x1;return _0x516d4b[_0xf5e1('0x1d9')](_0x31e79f,_0x2696f8,_0x580e37,_0x140132,_0x29f90e);})['then'](function(_0xd2201d){return _0x19d44f(_0xd2201d);})['catch'](function(_0x4c1d98){return _0x86edd(msgResponse(_0xf5e1('0x1d8'),_0xf5e1('0x13a'),JSON[_0xf5e1('0x125')](_0x4c1d98)));});}}else{return _0x86edd(msgResponse(_0xf5e1('0x1d4'),_0xf5e1('0x13a'),_0xf5e1('0x1d6')));}});};};Dialer['prototype'][_0xf5e1('0x1cd')]=function(_0x5e9f9c){var _0x3d32a5=this;return function(){var _0x39cd4d=0x0;var _0x11d6a9=Math[_0xf5e1('0x1da')](_0x5e9f9c['erlangCallToSecond']*0x3e8);if(_0x11d6a9>0x0){_0x11d6a9=_0x11d6a9<0x64?0x64:_0x11d6a9;loggerPredictive[_0xf5e1('0x78')](_0x5e9f9c[_0xf5e1('0x3c')],'one\x20call\x20every:',_0x11d6a9,'milliseconds');_0x5e9f9c['handlePredictive']=setInterval(function(){_0x3d32a5[_0xf5e1('0x89')](_0x5e9f9c);loggerPredictiveCalls[_0xf5e1('0x78')]('[handlePredictive]',_0x39cd4d+=0x1);},_0x11d6a9);}else{loggerPredictive['info'](_0x5e9f9c[_0xf5e1('0x3c')],_0xf5e1('0x1db'));}};};Dialer['prototype']['checkContactBlack']=function(_0x5d3316,_0x4e12eb){var _0x6a2aa3=this;return function(_0x2852e8){if(_[_0xf5e1('0x44')](_0x2852e8)){if(_[_0xf5e1('0xd2')](_0x4e12eb[_0xf5e1('0xc7')])||!_0x4e12eb[_0xf5e1('0x1dc')]){if(_0x5d3316[_0xf5e1('0x55')]===_0xf5e1('0x1dd')){_0x5d3316[_0xf5e1('0x123')]=_[_0xf5e1('0x3a')](_0x5d3316[_0xf5e1('0x123')])?!![]:_0x5d3316['queueStatusComplete'];var _0x4b6179=uuid['v4']();_0x6a2aa3['actions'][_0x4b6179]=new Action(_0x5d3316,_0x4e12eb,_0x4b6179);loggerBooked[_0xf5e1('0x78')](_0xf5e1('0x1de'),_0x4b6179,_0xf5e1('0x1df'),JSON[_0xf5e1('0x125')](_0x5d3316[_0xf5e1('0x123')]),'Queue:\x20',_0x5d3316[_0xf5e1('0x3c')]);if(_0x5d3316[_0xf5e1('0x123')]){_0x5d3316[_0xf5e1('0x123')]=![];_0x6a2aa3[_0xf5e1('0x28')][_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179]['queue']]=[];ami['Action']({'actionid':_0x4b6179,'action':_0xf5e1('0x1e0'),'queue':_0x5d3316[_0xf5e1('0x3c')]})[_0xf5e1('0xaa')](function(_0x2bcca9){_0x6a2aa3[_0xf5e1('0xab')](_0x5d3316);_0x6a2aa3[_0xf5e1('0xb7')]({'active':![],'ContactId':_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179]['ContactId'],'ListId':_0x6a2aa3['actions'][_0x4b6179]['ListId'],'VoiceQueueId':_0x6a2aa3['actions'][_0x4b6179][_0xf5e1('0xc8')]||undefined,'CampaignId':_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179][_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x1e1')));delete _0x6a2aa3['actions'][_0x4b6179];});}else{loggerBooked[_0xf5e1('0x78')](_0xf5e1('0x1e2'),JSON[_0xf5e1('0x125')](_0x5d3316[_0xf5e1('0x123')]),_0xf5e1('0x1e3'),_0x5d3316['name']);_0x6a2aa3[_0xf5e1('0xab')](_0x5d3316);_0x6a2aa3['rescheduleContact']({'active':![],'ContactId':_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179][_0xf5e1('0xec')],'ListId':_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179][_0xf5e1('0xc6')],'VoiceQueueId':_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179][_0xf5e1('0xc8')]||undefined,'CampaignId':_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179][_0xf5e1('0xf6')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179];}}else{return _0x6a2aa3[_0xf5e1('0x15e')](_0x5d3316,_0x4e12eb);}}else{if(getDiff(_0x4e12eb['scheduledat'])<_0x5d3316['dialRecallMeTimeout']*0x3c){if(_0x4e12eb[_0xf5e1('0x1e4')]&&!_0x4e12eb[_0xf5e1('0x1e4')][_0xf5e1('0x1e5')]){_0x6a2aa3['preview'][_0xf5e1('0x127')](_0x4e12eb['id'])[_0xf5e1('0x128')](function(){_0x6a2aa3[_0xf5e1('0xab')](_0x5d3316);});}else{_0x6a2aa3[_0xf5e1('0xb9')]({'active':![]},_0x4e12eb['id'],0x1)['finally'](function(){console[_0xf5e1('0x1e6')](_0xf5e1('0x1e7'));_0x6a2aa3[_0xf5e1('0xab')](_0x5d3316);});}}else{_0x5d3316[_0xf5e1('0x1e8')]+=0x1;_0x6a2aa3['updateOriginated'](_0x5d3316);if(_0x5d3316[_0xf5e1('0x1e9')]){_0x6a2aa3[_0xf5e1('0xb7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e12eb[_0xf5e1('0xec')],'ListId':_0x4e12eb[_0xf5e1('0xc6')],'VoiceQueueId':_0x4e12eb[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x4e12eb[_0xf5e1('0xf6')]||undefined})['catch'](loggerCatch(_0xf5e1('0x1ea')));_0x6a2aa3[_0xf5e1('0xbf')](createObjHistory(_0x5d3316,_0x4e12eb,_0xf5e1('0x1eb'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0xf5e1('0x1ec')));}else{_0x6a2aa3['saveInDb'](createObjHistory(_0x5d3316,_0x4e12eb,_0xf5e1('0x1ed'),0x16,_0xf5e1('0x1ee')),'[Originate][HistoryRecallClose][historyCatch]',_0xf5e1('0x1ef'));}}}}else{_0x5d3316['outboundBlacklistCallsDay']+=0x1;_0x6a2aa3[_0xf5e1('0xc4')](createObjHistory(_0x5d3316,_0x4e12eb,_0xf5e1('0x1f0'),0xd,_0xf5e1('0x1f1')),_0xf5e1('0x1f2'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x154')]=function(_0x13c14a){var _0x17f1d4=this;var _0x595bc7=[];var _0x50adb3=_0x13c14a[_0xf5e1('0x1f3')]-_0x13c14a[_0xf5e1('0x94')]-_0x13c14a[_0xf5e1('0x1f4')];emitCampaignSummary(_0x13c14a);if(_0x50adb3>0x0){if(_0x50adb3>this[_0xf5e1('0x24')]){_0x50adb3=this['maxNumberOriginate'];}_0x13c14a[_0xf5e1('0x1f4')]+=_0x50adb3;this[_0xf5e1('0x1f5')](_0x13c14a['id'],_0x50adb3,_0x13c14a['dialOrderByScheduledAt'])['then'](function(_0xa783b0){_0x13c14a['temp']-=_0x50adb3;_0x13c14a['temp']=_0x13c14a[_0xf5e1('0x1f4')]>0x0?_0x13c14a[_0xf5e1('0x1f4')]:0x0;if(!checkContactEmpty(_0xa783b0)){_0x13c14a[_0xf5e1('0x3e')]=_0xf5e1('0x1f6');logger['info'](_0xf5e1('0x1f7')+_0x13c14a[_0xf5e1('0x3c')]);}else{_0x13c14a['originated']+=_0xa783b0[_0xf5e1('0x13f')];_0x13c14a[_0xf5e1('0x3e')]=_0xf5e1('0x1f8');for(var _0x4570fb=0x0;_0x4570fb<_0xa783b0[_0xf5e1('0x13f')];_0x4570fb+=0x1){_0x13c14a['ivrTotalCallsDays']+=0x1;if(_[_0xf5e1('0xd2')](_0xa783b0[_0x4570fb])||_[_0xf5e1('0xd2')](_0xa783b0[_0x4570fb][_0xf5e1('0x161')])||_['isNil'](_0xa783b0[_0x4570fb][_0xf5e1('0x161')]['phone'])){_0x17f1d4['emptyContact'](_0xf5e1('0x1f9'),_0x13c14a,_0xa783b0[_0x4570fb]);}else{_0x17f1d4[_0xf5e1('0xb4')](_[_0xf5e1('0x120')](_0xa783b0[_0x4570fb],['CampaignId',_0xf5e1('0x1fa')]))['then'](_0x17f1d4['checkContactBlack'](_0x13c14a,_0xa783b0[_0x4570fb]))[_0xf5e1('0xaa')](_0x17f1d4[_0xf5e1('0xc2')](_0xf5e1('0x1fb'),_0x13c14a));}}}})['catch'](loggerGetContactDialer(_0xf5e1('0x1fc'),_0x13c14a,_0x50adb3));}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x14e')]=function(_0x298f83,_0xc75aad){var _0x385b28=this;var _0x61f617=[];var _0x908c67=_0xc75aad>=0x1?_0xc75aad:0x1;var _0x35a381=[];if(_0x298f83['dialMethod']===_0xf5e1('0x1dd')){_0x908c67=0x1;}var _0x4b8214=Math[_0xf5e1('0x1da')](_0x298f83['available']*_0x908c67)-_0x298f83[_0xf5e1('0x94')]-_0x298f83[_0xf5e1('0x1f4')];emitVoiceQueueSummary(_0x298f83);if(_0x298f83[_0xf5e1('0x1fd')]>0x0){var _0x507f9b=_0x298f83['dialLimitQueue']-_0x298f83['originated']-_0x298f83[_0xf5e1('0x9b')]-_0x298f83[_0xf5e1('0x1f4')]-_0x298f83[_0xf5e1('0x9c')];if(_0x4b8214>_0x507f9b){_0x4b8214=_0x507f9b;}}if(_0x4b8214>0x0){if(_0x298f83[_0xf5e1('0x55')]==='booked'){_0x4b8214=0x1;}if(_0x4b8214>this[_0xf5e1('0x24')]){_0x4b8214=this[_0xf5e1('0x24')];}_0x298f83['temp']+=_0x4b8214;for(var _0x3d19cc in this[_0xf5e1('0x22')]){if(this[_0xf5e1('0x22')]['hasOwnProperty'](_0x3d19cc)){if(this[_0xf5e1('0x22')][_0x3d19cc][_0xf5e1('0xa1')]===_0xf5e1('0x1fe')&&this['agents'][_0x3d19cc]['status']==='reachable'){_0x61f617[_0xf5e1('0x11f')](this[_0xf5e1('0x22')][_0x3d19cc]['id']);}}}this['getContactDialer'](_0x298f83['id'],_0x61f617,_0x4b8214,_0x298f83[_0xf5e1('0x1ff')])[_0xf5e1('0xb2')](function(_0x295e42){_0x298f83[_0xf5e1('0x1f4')]-=_0x4b8214;_0x298f83[_0xf5e1('0x1f4')]=_0x298f83[_0xf5e1('0x1f4')]>0x0?_0x298f83[_0xf5e1('0x1f4')]:0x0;if(!checkContactEmpty(_0x295e42)){_0x385b28['countReScheduled'](_0x298f83)['then'](sendMessageReschedule(_0x298f83))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x298f83[_0xf5e1('0x94')]+=_0x295e42[_0xf5e1('0x13f')];_0x298f83['message']=_0x298f83[_0xf5e1('0x55')]===_0xf5e1('0x1dd')?_0xf5e1('0x169'):_0xf5e1('0x1f8');for(var _0x1b23a5=0x0;_0x1b23a5<_0x295e42[_0xf5e1('0x13f')];_0x1b23a5+=0x1){if(_['isNil'](_0x295e42[_0x1b23a5])||_[_0xf5e1('0xd2')](_0x295e42[_0x1b23a5][_0xf5e1('0x161')])||_[_0xf5e1('0xd2')](_0x295e42[_0x1b23a5]['Contact'][_0xf5e1('0x162')])){_0x385b28[_0xf5e1('0x200')](_0xf5e1('0x1f9'),_0x298f83,_0x295e42[_0x1b23a5]);}else{_0x385b28[_0xf5e1('0xb1')](_[_0xf5e1('0x120')](_0x295e42[_0x1b23a5],['VoiceQueueId',_0xf5e1('0x1fa')]))['then'](_0x385b28[_0xf5e1('0x201')](_0x298f83,_0x295e42[_0x1b23a5]))[_0xf5e1('0xaa')](_0x385b28['loggerHandler']('[actionOriginate]\x20',_0x298f83));}}}})[_0xf5e1('0xaa')](loggerGetContactDialer(_0xf5e1('0x202'),_0x298f83,_0x4b8214));}};Dialer[_0xf5e1('0x1c')]['handlePredictive']=function(_0x4cca53){var _0x46492f=this;if(_0x4cca53[_0xf5e1('0x1fd')]>0x0){var _0x43fda8=_0x4cca53[_0xf5e1('0x1fd')]-_0x4cca53[_0xf5e1('0x94')]-_0x4cca53[_0xf5e1('0x9b')];if(_0x43fda8>0x0){this[_0xf5e1('0x203')](_0x4cca53);}else{loggerPredictiveCalls[_0xf5e1('0x78')](_0xf5e1('0x204'));}}else{this[_0xf5e1('0x203')](_0x4cca53);}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x203')]=function(_0x4b5442){var _0x1e573f=this;var _0x492a1c=[];_0x4b5442[_0xf5e1('0x94')]+=0x1;for(var _0x5a721e in this[_0xf5e1('0x22')]){if(this['agents'][_0xf5e1('0x93')](_0x5a721e)){if(this[_0xf5e1('0x22')][_0x5a721e][_0xf5e1('0xa1')]==='not_inuse'&&this[_0xf5e1('0x22')][_0x5a721e]['status']===_0xf5e1('0xcd')){_0x492a1c['push'](this[_0xf5e1('0x22')][_0x5a721e]['id']);}}}this[_0xf5e1('0xbb')](_0x4b5442['id'],_0x492a1c,0x1,_0x4b5442[_0xf5e1('0x1ff')])[_0xf5e1('0xb2')](function(_0x513bdc){if(!checkContactEmpty(_0x513bdc)){checkContactLowerLimitOriginate(_0x4b5442,0x1,0x0);_0x1e573f[_0xf5e1('0xb0')](_0x4b5442)[_0xf5e1('0xb2')](sendMessageReschedule(_0x4b5442))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x4b5442['message']=_0xf5e1('0x1f8');if(_[_0xf5e1('0xd2')](_0x513bdc[0x0])||_[_0xf5e1('0xd2')](_0x513bdc[0x0][_0xf5e1('0x161')])||_['isNil'](_0x513bdc[0x0][_0xf5e1('0x161')][_0xf5e1('0x162')])){_0x1e573f[_0xf5e1('0x200')](_0xf5e1('0x1f9'),_0x4b5442,_0x513bdc[0x0]);}else{_0x1e573f[_0xf5e1('0xb1')](_[_0xf5e1('0x120')](_0x513bdc[0x0],[_0xf5e1('0xc8'),_0xf5e1('0x1fa')]))[_0xf5e1('0xb2')](_0x1e573f[_0xf5e1('0x201')](_0x4b5442,_0x513bdc[0x0]))[_0xf5e1('0xaa')](_0x1e573f[_0xf5e1('0xc2')](_0xf5e1('0x205'),_0x4b5442));}}})['catch'](loggerGetContactDialer(_0xf5e1('0x206'),_0x4b5442,0x1));emitVoiceQueueSummary(_0x4b5442);};Dialer['prototype'][_0xf5e1('0x1d3')]=function(_0x112356,_0x1533bf,_0x5877da,_0x35ef8d,_0x8b3926,_0x1925ac){loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x207'));loggerPredictive[_0xf5e1('0x78')]('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',_0x112356);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x208'),_0x1533bf);loggerPredictive[_0xf5e1('0x78')]('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',_0x5877da);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x209'),_0x35ef8d);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x20a'),_0x8b3926);loggerPredictive[_0xf5e1('0x78')]('---------------------------');return new BPromise(function(_0x3fb54e,_0x3feb95){if(_0x112356<=0x0||isNaN(_0x112356)){return _0x3feb95(msgResponse(_0xf5e1('0x20b'),_0xf5e1('0x46'),_0xf5e1('0x20c')+_0x112356));}if(_0x5877da<=0x0||isNaN(_0x5877da)){return _0x3feb95(msgResponse(_0xf5e1('0x20b'),'Error',_0xf5e1('0x20d')+_0x5877da));}if(_0x35ef8d<=0x0||isNaN(_0x35ef8d)){return _0x3feb95(msgResponse(_0xf5e1('0x20b'),_0xf5e1('0x46'),_0xf5e1('0x20e')+_0x35ef8d));}if(_0x1533bf<=0x0||isNaN(_0x1533bf)){return _0x3feb95(msgResponse(_0xf5e1('0x20b'),'Error',_0xf5e1('0x20f')+_0x1533bf));}if(_0x8b3926<=0x0||isNaN(_0x8b3926)){return _0x3feb95(msgResponse(_0xf5e1('0x20b'),_0xf5e1('0x46'),_0xf5e1('0x210')+_0x8b3926));}_0x1925ac=_0x1925ac||0x0;var _0x472199=0x1/_0x5877da;var _0x59dfc9=0x0;var _0x2833c3=0x0;var _0x172f48=0x0;var _0x2b8945=0x0;for(var _0x56d075=0x0;_0x172f48<_0x8b3926;_0x56d075+=0x1){_0x2833c3=_0x56d075/_0x1533bf;_0x59dfc9=(_0x35ef8d*_0x2833c3+_0x1925ac)/_0x472199;_0x172f48=erlangb(_0x59dfc9,_0x112356);_0x2b8945=_0x59dfc9/_0x112356*(0x1-erlangb(_0x59dfc9,_0x112356));}return _0x3fb54e({'erlangCalls':_0x56d075,'erlangCallToSecond':_0x1533bf/_0x56d075,'erlangAbandonmentRate':_0x172f48,'erlangBusyFactor':_0x2b8945});});};Dialer['prototype'][_0xf5e1('0x1d9')]=function(_0x88dae0,_0x2a07a6,_0x18575b,_0x548adf,_0x203196,_0x19bba7){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x211'),_0x88dae0);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x208'),_0x2a07a6);loggerPredictive[_0xf5e1('0x78')]('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',_0x18575b);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x209'),_0x548adf);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x212'),_0x203196);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x7e'));return new BPromise(function(_0x1ed0ca,_0x509225){if(_0x88dae0<=0x0||isNaN(_0x88dae0)){return _0x509225(msgResponse('[busyFactor]','Error',_0xf5e1('0x20c')+_0x88dae0));}if(_0x18575b<=0x0||isNaN(_0x18575b)){return _0x509225(msgResponse(_0xf5e1('0x213'),_0xf5e1('0x46'),_0xf5e1('0x20d')+_0x18575b));}if(_0x548adf<=0x0||isNaN(_0x548adf)){return _0x509225(msgResponse('[busyFactor]',_0xf5e1('0x46'),_0xf5e1('0x20e')+_0x548adf));}if(_0x2a07a6<=0x0||isNaN(_0x2a07a6)){return _0x509225(msgResponse(_0xf5e1('0x213'),_0xf5e1('0x46'),_0xf5e1('0x20f')+_0x2a07a6));}if(_0x203196<=0x0||isNaN(_0x203196)){return _0x509225(msgResponse('[busyFactor]',_0xf5e1('0x46'),_0xf5e1('0x214')+_0x203196));}_0x19bba7=_0x19bba7||0x0;var _0x10e98f=0x1/_0x18575b;var _0x5073dd=0x0;var _0x4f61cf=0x0;var _0x218a7e=0x0;var _0x4aec77=0x0;for(var _0x1c997b=0x0;_0x4aec77<_0x203196;_0x1c997b+=0x1){_0x4f61cf=_0x1c997b/_0x2a07a6;_0x5073dd=(_0x548adf*_0x4f61cf+_0x19bba7)/_0x10e98f;_0x218a7e=erlangb(_0x5073dd,_0x88dae0);_0x4aec77=_0x5073dd/_0x88dae0*(0x1-erlangb(_0x5073dd,_0x88dae0));}return _0x1ed0ca({'erlangCalls':_0x1c997b,'erlangCallToSecond':_0x2a07a6/_0x1c997b,'erlangAbandonmentRate':_0x218a7e,'erlangBusyFactor':_0x4aec77});});};module[_0xf5e1('0x215')]=Dialer; \ No newline at end of file +var _0xc56b=['iftime\x20%s,%s','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','launchHandleIvr','handleIvr','loggedIn','dialGlobalInterval','dialTimezone','checkIsTrunkReachable','[syncCampaigns]','\x5cw{0,','pow','replace','match','object','voiceQueue\x20is\x20undefine','phone','Contact','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','dialNoSuchNumberMaxRetry','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','predictiveIntervalErlangCallsDroppedCalls','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[handlePredictive][limitChannel]','tryOriginatePredictive','[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','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','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','hangup','syncHangup','newexten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','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\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','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','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','string','\x22%s\x22\x20<%s>','inspect','error','stack','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[actions]','isNil','Action','status','channel','catch','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','countglobal','amd','countnoanswerretry','dialGlobalMaxRetry','stateGlobal','CampaignId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','dialQueueProject','Unknow','syncAgentComplete','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','queueBooked','push','idHopper','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','length','command','timezones','content','indexOf','true'];(function(_0x3cdbec,_0x45eba3){var _0x1894a3=function(_0x613575){while(--_0x613575){_0x3cdbec['push'](_0x3cdbec['shift']());}};_0x1894a3(++_0x45eba3);}(_0xc56b,0xd0));var _0xbc56=function(_0x14e8b8,_0x2f7af7){_0x14e8b8=_0x14e8b8-0x0;var _0x2e136b=_0xc56b[_0x14e8b8];return _0x2e136b;};'use strict';var util=require('util');var _=require(_0xbc56('0x0'));var BPromise=require(_0xbc56('0x1'));var uuid=require(_0xbc56('0x2'));var moment=require(_0xbc56('0x3'));var rr=require('rr');var md5=require(_0xbc56('0x4'));var Redis=require(_0xbc56('0x5'));var ut=require('../preview/util/util');var config=require(_0xbc56('0x6'));var logger=require(_0xbc56('0x7'))('dialer');var loggerBooked=require(_0xbc56('0x7'))(_0xbc56('0x8'));var loggerPredictive=require('../../../config/logger')(_0xbc56('0x9'));var loggerPredictiveCalls=require(_0xbc56('0x7'))(_0xbc56('0xa'));var loggerSyncQueueSummary=require(_0xbc56('0x7'))(_0xbc56('0xb'));var ami=require(_0xbc56('0xc'));config['redis']=_[_0xbc56('0xd')](config[_0xbc56('0xe')],{'host':_0xbc56('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xbc56('0x10'));var voiceQueueRt=require(_0xbc56('0x11'));var Action=require(_0xbc56('0x12'));var History=require(_0xbc56('0x13'));var Final=require(_0xbc56('0x14'));var AgentComplete=require(_0xbc56('0x15'));var QueueCallerAbandon=require(_0xbc56('0x16'));var Hangup=require(_0xbc56('0x17'));var ipAgi=process[_0xbc56('0x18')][_0xbc56('0x19')]||_0xbc56('0x1a');var strategy={'rrmemory':'rrmemory','roundrobin':_0xbc56('0x1b')};var Sequence=function(){};Sequence[_0xbc56('0x1c')][_0xbc56('0x1d')]=function(_0x746270){this[_0xbc56('0x1e')]=this[_0xbc56('0x1e')]?this[_0xbc56('0x1e')][_0xbc56('0x1f')](_0x746270):_0x746270();};function Dialer(_0x412ed9,_0xf69bb3){this[_0xbc56('0x20')]=new Sequence();this[_0xbc56('0x21')]=_0xf69bb3;this[_0xbc56('0x22')]=_0x412ed9[_0xbc56('0x22')];this[_0xbc56('0x23')]=_0x412ed9[_0xbc56('0x23')];this['agents']=_0x412ed9[_0xbc56('0x24')];this['trunks']=_0x412ed9[_0xbc56('0x25')];this[_0xbc56('0x26')]=config[_0xbc56('0x26')]||0x2;this[_0xbc56('0x27')]={};this[_0xbc56('0x28')]={};this[_0xbc56('0x29')]={};this[_0xbc56('0x2a')]={};this['optionPredictive']={};this[_0xbc56('0x2b')]={};this[_0xbc56('0x2c')]={};this[_0xbc56('0x2d')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0xbc56('0x2e')][_0xbc56('0x2f')](this));ami['on'](_0xbc56('0x30'),this[_0xbc56('0x31')][_0xbc56('0x2f')](this));ami['on'](_0xbc56('0x32'),this[_0xbc56('0x33')][_0xbc56('0x2f')](this));ami['on'](_0xbc56('0x34'),this['syncAgentComplete'][_0xbc56('0x2f')](this));ami['on']('custom:queuesummary',this[_0xbc56('0xb')]['bind'](this));ami['on'](_0xbc56('0x35'),this[_0xbc56('0x36')]['bind'](this));ami['on'](_0xbc56('0x37'),this['syncNewExten'][_0xbc56('0x2f')](this));ami['on']('varset',this[_0xbc56('0x38')][_0xbc56('0x2f')](this));ami['on'](_0xbc56('0x39'),this['syncQueueMember'][_0xbc56('0x2f')](this));ami['on'](_0xbc56('0x3a'),this[_0xbc56('0x3b')][_0xbc56('0x2f')](this));this[_0xbc56('0x3c')]();this['loopClearZombieChannels']();}function isNotNull(_0x5963f7){return _0x5963f7!==null&&!_[_0xbc56('0x3d')](_0x5963f7);}function checkIsLoggedIn(_0x33540e,_0x4433e3){return function(){if(_0x4433e3<=0x0){_0x33540e[_0xbc56('0x3e')]=_0xbc56('0x3f');throw _0x33540e[_0xbc56('0x40')]+_0xbc56('0x41');}};}function isActive(_0x5ba377){return _0x5ba377;}function checkIsActive(_0x876ede,_0x43bb71){return function(){if(!isActive(_0x43bb71)){_0x876ede[_0xbc56('0x3e')]='NOT_ACTIVE';throw _0x876ede[_0xbc56('0x40')]+'\x20NOT\x20Active';}};}function checkInterval(_0x39d19f){return function(){if(!isNotNull(_0x39d19f['Interval'])){_0x39d19f[_0xbc56('0x3e')]=_0xbc56('0x42');throw _0x39d19f[_0xbc56('0x40')]+_0xbc56('0x43');}if(!isNotNull(_0x39d19f[_0xbc56('0x44')]['Intervals'])){_0x39d19f[_0xbc56('0x3e')]=_0xbc56('0x42');throw _0x39d19f[_0xbc56('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xbc56('0x45')](_0x39d19f[_0xbc56('0x44')][_0xbc56('0x46')]))){_0x39d19f['message']=_0xbc56('0x42');throw _0x39d19f[_0xbc56('0x40')]+_0xbc56('0x43');}};}function msgResponse(_0x9b0fd1,_0x1a4c89,_0x20ee9c){return{'action':_0x9b0fd1,'response':_0x1a4c89,'message':_0x20ee9c,'stack':_0x20ee9c};}function myreject(_0x22b0fd){return function(_0x1d4af2){return _0x22b0fd(msgResponse(_0xbc56('0x47'),_0xbc56('0x48'),JSON[_0xbc56('0x49')](_0x1d4af2)));};}function getSeconds(_0x173ccc,_0x240f25){var _0x45dadd=moment(_0x173ccc)[_0xbc56('0x4a')](0x0);var _0xff6a3=moment(_0x240f25)[_0xbc56('0x4a')](0x0);return _0x45dadd[_0xbc56('0x4b')](_0xff6a3,_0xbc56('0x4c'));}function emit(_0x131003,_0x30387a,_0x2652e1){io['to'](_0x131003)[_0xbc56('0x4d')](_0x30387a,_0x2652e1);}function emitVoiceQueueSummary(_0x529bd7){if(_0x529bd7['type']===_0xbc56('0x4e')){var _0x6e0601={'id':_0x529bd7['id'],'name':_0x529bd7[_0xbc56('0x40')],'strategy':_0x529bd7[_0xbc56('0x4f')],'answered':_0x529bd7[_0xbc56('0x50')],'available':_0x529bd7[_0xbc56('0x51')],'loggedIn':_0x529bd7['loggedIn'],'pTalking':_0x529bd7[_0xbc56('0x52')],'sumBillable':_0x529bd7['sumBillable'],'sumDuration':_0x529bd7[_0xbc56('0x53')],'sumHoldTime':_0x529bd7[_0xbc56('0x54')]||0x0,'talking':_0x529bd7[_0xbc56('0x55')],'total':_0x529bd7[_0xbc56('0x56')],'type':_0x529bd7[_0xbc56('0x57')],'unmanaged':_0x529bd7[_0xbc56('0x58')],'abandoned':_0x529bd7[_0xbc56('0x59')],'waiting':_0x529bd7[_0xbc56('0x5a')],'loggedInDb':_0x529bd7[_0xbc56('0x5b')],'dialActive':_0x529bd7[_0xbc56('0x5c')],'dialMethod':_0x529bd7[_0xbc56('0x5d')],'dialOriginateCallerIdName':_0x529bd7[_0xbc56('0x5e')],'dialOriginateCallerIdNumber':_0x529bd7[_0xbc56('0x5f')],'dialOriginateTimeout':_0x529bd7[_0xbc56('0x60')],'dialPrefix':_0x529bd7['dialPrefix'],'outboundAnswerAgiCallsDay':_0x529bd7[_0xbc56('0x61')],'outboundAnswerCallsDay':_0x529bd7[_0xbc56('0x62')],'outboundBlacklistCallsDay':_0x529bd7['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x529bd7[_0xbc56('0x63')],'outboundCongestionCallsDay':_0x529bd7[_0xbc56('0x64')],'outboundDropCallsDayACS':_0x529bd7['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x529bd7[_0xbc56('0x65')],'outboundDropCallsDayTimeout':_0x529bd7['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x529bd7['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x529bd7[_0xbc56('0x66')],'outboundOriginateFailureCallsDay':_0x529bd7[_0xbc56('0x67')],'outboundReCallsDay':_0x529bd7[_0xbc56('0x68')],'outboundRejectCallsDay':_0x529bd7['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x529bd7[_0xbc56('0x69')],'predictiveIntervalAnsweredCalls':_0x529bd7[_0xbc56('0x6a')],'predictiveIntervalAvgHoldtime':_0x529bd7[_0xbc56('0x6b')],'predictiveIntervalAvgTalktime':_0x529bd7[_0xbc56('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x529bd7[_0xbc56('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x529bd7[_0xbc56('0x6e')],'predictiveIntervalErlangCalls':_0x529bd7[_0xbc56('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x529bd7['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x529bd7[_0xbc56('0x70')],'predictiveIntervalMultiplicativeFactor':_0x529bd7[_0xbc56('0x71')],'predictiveIntervalPauses':_0x529bd7[_0xbc56('0x72')],'predictiveIntervalAvailable':_0x529bd7[_0xbc56('0x73')],'predictiveIntervalTotalCalls':_0x529bd7[_0xbc56('0x74')],'message':_0x529bd7[_0xbc56('0x3e')],'originated':_0x529bd7[_0xbc56('0x75')],'erlangCalls':_0x529bd7[_0xbc56('0x76')],'erlangCallToSecond':_0x529bd7['erlangCallToSecond'],'erlangAbandonmentRate':_0x529bd7[_0xbc56('0x77')],'erlangBusyFactor':_0x529bd7[_0xbc56('0x78')],'startPredictive':_0x529bd7[_0xbc56('0x2b')],'startProgressive':_0x529bd7[_0xbc56('0x2c')]};if(_0x529bd7[_0xbc56('0x79')]){_0x6e0601[_0xbc56('0x79')]={'id':_0x529bd7['Trunk']['id'],'name':_0x529bd7[_0xbc56('0x79')][_0xbc56('0x40')],'active':_0x529bd7['Trunk'][_0xbc56('0x7a')],'callerid':_0x529bd7[_0xbc56('0x79')][_0xbc56('0x7b')]};}if(_0x529bd7['Interval']){_0x6e0601[_0xbc56('0x44')]={'id':_0x529bd7[_0xbc56('0x44')]['id'],'name':_0x529bd7[_0xbc56('0x44')][_0xbc56('0x40')]};}var _0x5928c7=md5(JSON[_0xbc56('0x49')](_0x6e0601));if(_0x529bd7[_0xbc56('0x4')]!==_0x5928c7){_0x529bd7[_0xbc56('0x4')]=_0x5928c7;emit(util[_0xbc56('0x7c')](_0xbc56('0x7d'),_0x6e0601['name']),_0xbc56('0x7e'),_0x6e0601);}}}function emitCampaignSummary(_0xfe2a76){if(_0xfe2a76[_0xbc56('0x57')]===_0xbc56('0x7f')){emit(util[_0xbc56('0x7c')](_0xbc56('0x80'),_0xfe2a76[_0xbc56('0x40')]),_0xbc56('0x81'),_0xfe2a76);}}function checkGetDataPredictive(_0xb0ad04){if(isNotNull(_0xb0ad04)){if(!_[_0xbc56('0x45')](_0xb0ad04)){loggerPredictive[_0xbc56('0x82')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xbc56('0x82')](_0xbc56('0x83'),_0xb0ad04[_0xbc56('0x74')]);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x84'),_0xb0ad04[_0xbc56('0x6a')]);loggerPredictive[_0xbc56('0x82')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xb0ad04[_0xbc56('0x6e')]);loggerPredictive['info'](_0xbc56('0x85'),_0xb0ad04[_0xbc56('0x6d')]);loggerPredictive['info'](_0xbc56('0x86'),_0xb0ad04['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x87'),_0xb0ad04[_0xbc56('0x6c')]);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x88'));if(_0xb0ad04[_0xbc56('0x74')]>0x0){if(!_[_0xbc56('0x3d')](_0xb0ad04['predictiveIntervalAvgTalktime'])&&_0xb0ad04[_0xbc56('0x6c')]>0x0){return!![];}else{loggerPredictive[_0xbc56('0x82')](_0xbc56('0x89'));}if(!_['isUndefined'](_0xb0ad04[_0xbc56('0x6b')])&&_0xb0ad04['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0xbc56('0x82')](_0xbc56('0x8a'));}}else{loggerPredictive['info'](_0xbc56('0x8b'));}}else{loggerPredictive['info'](_0xbc56('0x8c'));}}else{loggerPredictive[_0xbc56('0x82')](_0xbc56('0x8c'));}return![];}function mergeDataErlangB(_0x19135e){return function(_0xfebd62){loggerPredictive[_0xbc56('0x82')](_0xbc56('0x8d'));loggerPredictive['info'](_0xbc56('0x8e'),_0xfebd62[_0xbc56('0x76')]);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x8f'),_0xfebd62[_0xbc56('0x90')]);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x91'),_0xfebd62[_0xbc56('0x77')]);loggerPredictive['info'](_0xbc56('0x92'),_0xfebd62[_0xbc56('0x78')]);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x91'),_0xfebd62[_0xbc56('0x77')]);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x88'));_[_0xbc56('0x93')](_0x19135e,_0xfebd62);};}function getDiff(_0x557ffc){var _0xb138d7=moment()['milliseconds'](0x0);var _0x5865a5=moment(_0x557ffc)[_0xbc56('0x4a')](0x0);return _0xb138d7[_0xbc56('0x4b')](_0x5865a5,'seconds');}function ifInterval(_0x55c5ef,_0x3457b8){if(_[_0xbc56('0x3d')](_0x3457b8)){return![];}if(getDiff(_0x3457b8)<_0x55c5ef*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x129936){if(isNotNull(_0x129936)){if(!_[_0xbc56('0x3d')](_0x129936[_0xbc56('0x2c')])){_0x129936[_0xbc56('0x2c')]=undefined;loggerPredictive[_0xbc56('0x82')](_0x129936['name'],_0xbc56('0x94'));}if(!_['isUndefined'](_0x129936[_0xbc56('0x2b')])){_0x129936[_0xbc56('0x2b')]=undefined;loggerPredictive[_0xbc56('0x82')](_0x129936['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xbc56('0x3d')](_0x129936[_0xbc56('0x95')])){clearInterval(_0x129936[_0xbc56('0x95')]);_0x129936[_0xbc56('0x95')]=undefined;loggerPredictive[_0xbc56('0x82')](_0x129936[_0xbc56('0x40')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x1716c8,_0x2011e9){if(_0x2011e9===0x0){return 0x0;}var _0x4685e5=0x1;for(var _0x5b5fcf=0x1;_0x5b5fcf<=_0x2011e9;_0x5b5fcf+=0x1){_0x4685e5=0x1+_0x4685e5*_0x5b5fcf/_0x1716c8;}return 0x1/_0x4685e5;}function isVoiceQueueOutbound(_0x1027c9){return _0x1027c9===_0xbc56('0x4e');}function isNotPreview(_0x468b27){return _0x468b27!==_0xbc56('0x21');}function isCampaignIvr(_0x35e3d4){return _0x35e3d4===_0xbc56('0x7f');}function getCallerId(_0x13324e,_0x3c70ad,_0x399344){if(!_[_0xbc56('0x3d')](_0x399344)&&_0xbc56('0x96')===typeof _0x399344&&!_['isEmpty'](_0x399344)){if(!_[_0xbc56('0x3d')](_0x3c70ad)&&_0xbc56('0x96')===typeof _0x3c70ad&&!_[_0xbc56('0x45')](_0x3c70ad)){return util[_0xbc56('0x7c')](_0xbc56('0x97'),_0x3c70ad,_0x399344);}return util['format'](_0xbc56('0x97'),_0x399344,_0x399344);}if(!_[_0xbc56('0x3d')](_0x13324e)&&'string'===typeof _0x13324e&&!_[_0xbc56('0x45')](_0x13324e)){return _0x13324e;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x261925,_0x43694f){return function(_0x2d65d4){freeVariablesPredictive(_0x43694f);emitVoiceQueueSummary(_0x43694f);emitCampaignSummary(_0x43694f);loggerSyncQueueSummary['error'](_0x261925,util[_0xbc56('0x98')](_0x2d65d4,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3a9a20,_0x540210){return function(_0x32bec5){loggerPredictive[_0xbc56('0x99')](_0x540210[_0xbc56('0x40')],_0x3a9a20);loggerPredictive[_0xbc56('0x99')](_0x32bec5[_0xbc56('0x9a')]);freeVariablesPredictive(_0x540210);};}function loggerCatch(_0x2ae0b8){return function(_0x38c191){logger[_0xbc56('0x99')](_0x2ae0b8,util[_0xbc56('0x98')](_0x38c191,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x154a52){return _0x154a52&&!_['isUndefined'](_0x154a52)&&_0x154a52['length']>0x0;}function decremetOriginate(_0xbc2cc7){if(!_['isUndefined'](_0xbc2cc7)&&_0xbc2cc7!==null){if(_0xbc2cc7[_0xbc56('0x9b')]('originated')){if(_0xbc2cc7['originated']>0x0){_0xbc2cc7[_0xbc56('0x75')]-=0x1;}else{logger[_0xbc56('0x99')](_0xbc56('0x9c'));}}}else{logger[_0xbc56('0x99')](_0xbc56('0x9d'));}}function checkContactLowerLimitOriginate(_0x389353,_0x1ebba1,_0x1a4c38){if(_0x1ebba1>_0x1a4c38){for(var _0x3766d0=0x0;_0x3766d0<_0x1ebba1-_0x1a4c38;_0x3766d0+=0x1){decremetOriginate(_0x389353);}}}function loggerGetContactDialer(_0x3e59ef,_0x3efc10,_0x484322){return function(_0x535ba8){checkContactLowerLimitOriginate(_0x3efc10,_0x484322,0x0);logger[_0xbc56('0x99')](_0x3e59ef,util[_0xbc56('0x98')](_0x535ba8,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2c87bb){return function(_0x1422c5){if(isNotNull(_0x1422c5)&&isNotNull(_0x1422c5[0x0])){if(_0x1422c5[0x0][_0xbc56('0x9e')]>0x0){_0x2c87bb[_0xbc56('0x3e')]=_0xbc56('0x9f');logger[_0xbc56('0x82')]('[getContactDialer2][ReScheduled]'+_0x2c87bb['name'],_0x1422c5[0x0][_0xbc56('0x9e')],_0xbc56('0xa0'));}else{_0x2c87bb[_0xbc56('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xbc56('0x82')]('[getContactDialer2][Empty]'+_0x2c87bb[_0xbc56('0x40')]);}}};}function notSendMessagesQueue(_0x52e83b){if(_0x52e83b['sendMessageOneNotActive']){freeVariablesPredictive(_0x52e83b);if(_0x52e83b[_0xbc56('0x75')]===0x0&&_0x52e83b['talking']===0x0&&_0x52e83b['waiting']===0x0&&(_0x52e83b[_0xbc56('0x52')]||0x0)===0x0){_0x52e83b[_0xbc56('0xa1')]=![];_0x52e83b[_0xbc56('0x51')]=0x0;_0x52e83b['message']=_0xbc56('0xa2');loggerSyncQueueSummary[_0xbc56('0x99')](_0xbc56('0xa3'),_0x52e83b['name'],_0xbc56('0xa4'));}else{_0x52e83b['message']=_0xbc56('0xa5');loggerSyncQueueSummary[_0xbc56('0x99')](_0xbc56('0xa3'),_0x52e83b[_0xbc56('0x40')],_0xbc56('0xa6'));}emitVoiceQueueSummary(_0x52e83b);}}function notSendMessagesCampaign(_0x586c49){if(_0x586c49[_0xbc56('0xa1')]){if(_0x586c49['originated']===0x0){_0x586c49['sendMessageOneNotActive']=![];_0x586c49['message']=_0xbc56('0xa2');loggerSyncQueueSummary[_0xbc56('0x99')](_0xbc56('0xa7'),_0x586c49[_0xbc56('0x40')],_0xbc56('0xa4'));}else{_0x586c49[_0xbc56('0x3e')]=_0xbc56('0xa5');loggerSyncQueueSummary[_0xbc56('0x99')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x586c49['name'],_0xbc56('0xa6'));}emitCampaignSummary(_0x586c49);}}function createObjHistory(_0x518677,_0x5ba4f6,_0x55bf71,_0x22cdec,_0x619889){_0x518677[_0xbc56('0x3e')]=_0x55bf71;var _0x56f8ac=new Action(_0x518677,_0x5ba4f6);var _0x896914=new History(_0x56f8ac);_0x896914[_0xbc56('0xa8')]=_0x22cdec;_0x896914[_0xbc56('0xa9')]=_0x619889;_0x896914[_0xbc56('0xaa')]=_0x56f8ac[_0xbc56('0xab')];return _0x896914;}Dialer['prototype'][_0xbc56('0xac')]=function(){var _0x315d1f=this;setInterval(function(){_0x315d1f[_0xbc56('0xad')](_0x315d1f[_0xbc56('0x2a')],'[uniqueid]');_0x315d1f[_0xbc56('0xad')](_0x315d1f[_0xbc56('0x28')],_0xbc56('0xae'));},0x32c8);};Dialer[_0xbc56('0x1c')][_0xbc56('0xad')]=function(_0x19cb61,_0x175c52){var _0x513c8c=this;for(var _0x196cb7 in _0x19cb61){if(_0x19cb61[_0xbc56('0x9b')](_0x196cb7)){this[_0xbc56('0x20')][_0xbc56('0x1d')](function(){if(!_[_0xbc56('0xaf')](_0x19cb61[_0x196cb7])){return ami[_0xbc56('0xb0')]({'action':_0xbc56('0xb1'),'channel':_0x19cb61[_0x196cb7][_0xbc56('0xb2')]})[_0xbc56('0xb3')](function(_0x398b38){if(_0x398b38[_0xbc56('0x3e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x19cb61[_0x196cb7]&&_0x19cb61[_0x196cb7][_0xbc56('0x57')]!==_0xbc56('0x7f')){_0x513c8c['updateOriginated'](_0x513c8c[_0xbc56('0x22')][_0x19cb61[_0x196cb7][_0xbc56('0xb4')]]);logger['error']('[Dialer][checkChannel]',_0x175c52,_0x196cb7,_0x19cb61[_0x196cb7][_0xbc56('0xb4')]);delete _0x19cb61[_0x196cb7];}if(_0x19cb61[_0x196cb7]&&_0x19cb61[_0x196cb7]['type']===_0xbc56('0x7f')){_0x513c8c['updateOriginated'](_0x513c8c[_0xbc56('0x23')][_0x19cb61[_0x196cb7]['queue']]);logger[_0xbc56('0x99')](_0xbc56('0xb5'),_0x175c52,_0x196cb7,_0x19cb61[_0x196cb7][_0xbc56('0xb4')]);delete _0x19cb61[_0x196cb7];}},0x2328);}});}});}}};Dialer[_0xbc56('0x1c')][_0xbc56('0xb6')]=function(_0x869831){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopper[_0xbc56('0xb6')](_0x869831))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xb9')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xba')]=function(_0x135e76){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopperBlack['checkIsBlackList'](_0x135e76))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xbb')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xbc')]=function(_0x5f55c5){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopperBlack[_0xbc56('0xbc')](_0x5f55c5))['catch'](loggerCatch(_0xbc56('0xbd')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xbe')]=function(_0x14205e){return BPromise['resolve']()[_0xbc56('0xb8')](cmHopperHistory[_0xbc56('0xbf')](_0x14205e))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xc0')));};Dialer['prototype']['rescheduleContact']=function(_0x41a404){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopper[_0xbc56('0xc1')](_0x41a404))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xc2')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xc3')]=function(_0x3be37e,_0x1e4f9e,_0x590493){return BPromise['resolve']()[_0xbc56('0xb8')](cmHopper[_0xbc56('0xc3')](_0x3be37e,_0x1e4f9e,_0x590493))['catch'](loggerCatch(_0xbc56('0xc4')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xc5')]=function(_0x11a35b,_0x862ce1,_0x24352b,_0x5e90e5){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopper['getContactDialer'](_0x11a35b,_0x862ce1,_0x24352b,_0x5e90e5))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xc6')));};Dialer['prototype']['getContactDialerIvr']=function(_0x866577,_0x2f2b59,_0x4fec31){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopper[_0xbc56('0xc7')](_0x866577,_0x2f2b59,_0x4fec31))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xc6')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xc8')]=function(_0x23f4e5){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](voiceQueueRt[_0xbc56('0xc8')](_0x23f4e5))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xc9')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xca')]=function(_0x4de0c7){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopper['moveContactManagedDialer'](_0x4de0c7))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xcb')));};Dialer['prototype'][_0xbc56('0xcc')]=function(_0x4b6830){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopperHistory[_0xbc56('0xcc')](_0x4b6830))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xcd')));};Dialer['prototype'][_0xbc56('0xce')]=function(_0x87465a){if(!_[_0xbc56('0x3d')](_0x87465a)&&_0x87465a!==null){if(_0x87465a[_0xbc56('0x9b')](_0xbc56('0x75'))){if(_0x87465a['originated']>0x0){_0x87465a['originated']-=0x1;}else{logger['error'](_0xbc56('0xcf'));}}}else{logger['error'](_0xbc56('0xd0'));}};Dialer[_0xbc56('0x1c')][_0xbc56('0xd1')]=function(_0x2d6262,_0x371aad){var _0x1ddf60=this;return function(_0x15b0f8){_0x1ddf60['updateOriginated'](_0x371aad);logger[_0xbc56('0x99')](_0x2d6262,util[_0xbc56('0x98')](_0x15b0f8,{'showHidden':![],'depth':null}));};};Dialer[_0xbc56('0x1c')][_0xbc56('0xd2')]=function(_0x1cf9c5,_0x27da2f,_0x3dc238){var _0x2add9a={'state':0x19,'statedesc':_0xbc56('0xd3')};this[_0xbc56('0xce')](_0x27da2f);this[_0xbc56('0xd4')](_[_0xbc56('0x93')](_0x2add9a,_[_0xbc56('0xd5')](_0x3dc238,[_0xbc56('0xd6'),_0xbc56('0xd7'),'UserId','VoiceQueueId','CampaignId'])),'[emptyContact][createHistory]',_0xbc56('0xd8'));logger[_0xbc56('0x99')](_0x1cf9c5);};Dialer['prototype'][_0xbc56('0xd9')]=function(_0x445beb){return _0x445beb===_0xbc56('0xda');};Dialer[_0xbc56('0x1c')][_0xbc56('0xdb')]=function(_0x3122c6){return!_[_0xbc56('0x3d')](_0x3122c6)&&_0x3122c6&&!_[_0xbc56('0x3d')](_0x3122c6[_0xbc56('0x40')])&&!_[_0xbc56('0x3d')](_0x3122c6['active'])&&_0x3122c6['active']&&(this['trunks'][util[_0xbc56('0x7c')](_0xbc56('0xdc'),_0x3122c6[_0xbc56('0x40')])][_0xbc56('0xb1')]===_0xbc56('0xdd')||this[_0xbc56('0x25')][util[_0xbc56('0x7c')](_0xbc56('0xdc'),_0x3122c6['name'])][_0xbc56('0xb1')]===_0xbc56('0xde'));};Dialer[_0xbc56('0x1c')][_0xbc56('0xd4')]=function(_0x184b19,_0x1b8e03,_0x363591){this[_0xbc56('0xcc')](_0x184b19)[_0xbc56('0xb3')](loggerCatch(_0x1b8e03));this['moveContactManagedDialer'](_0x184b19)[_0xbc56('0xb3')](loggerCatch(_0x363591));};Dialer[_0xbc56('0x1c')][_0xbc56('0x38')]=function(_0x2aba1f){var _0x45106c=this[_0xbc56('0x2a')][_0x2aba1f[_0xbc56('0xdf')]];var _0x5f1948;if(!_[_0xbc56('0xaf')](_0x2aba1f)&&!_[_0xbc56('0xaf')](_0x2aba1f['variable'])&&!_['isNil'](_0x2aba1f[_0xbc56('0xe0')][_0xbc56('0xe1')])&&_0x2aba1f[_0xbc56('0xe2')]===_0xbc56('0xe3')&&_0x45106c){if(_0x45106c['type']!==_0xbc56('0x7f')&&this['voiceQueues'][_0x45106c[_0xbc56('0xb4')]]['dialAMDActive']&&_0x2aba1f[_0xbc56('0xe4')]==='HANGUP'){delete this[_0xbc56('0x2a')][_0x2aba1f[_0xbc56('0xdf')]];this[_0xbc56('0xce')](this[_0xbc56('0x22')][_0x45106c[_0xbc56('0xb4')]]);this[_0xbc56('0x22')][_0x45106c['queue']][_0xbc56('0x62')]+=0x1;this[_0xbc56('0x22')][_0x45106c[_0xbc56('0xb4')]][_0xbc56('0x61')]+=0x1;_0x5f1948=new Hangup(_0x45106c,_0x2aba1f);_0x5f1948['state']=0x12;_0x5f1948[_0xbc56('0xa9')]=_0xbc56('0xe5');_0x5f1948[_0xbc56('0xe6')]=_0xbc56('0xe7');this[_0xbc56('0xd4')](_0x5f1948,_0xbc56('0xe8'),_0xbc56('0xe9'));}if(_0x45106c[_0xbc56('0x57')]!==_0xbc56('0x7f')&&this['voiceQueues'][_0x45106c[_0xbc56('0xb4')]][_0xbc56('0xea')]&&_0x2aba1f[_0xbc56('0xe4')]==='MACHINE'){var _0x430bad=this;return new BPromise(function(_0x1945c9,_0x5b11be){delete _0x430bad[_0xbc56('0x2a')][_0x2aba1f[_0xbc56('0xdf')]];_0x430bad['updateOriginated'](_0x430bad[_0xbc56('0x22')][_0x45106c[_0xbc56('0xb4')]]);_0x430bad['voiceQueues'][_0x45106c[_0xbc56('0xb4')]][_0xbc56('0x62')]+=0x1;_0x430bad[_0xbc56('0x22')][_0x45106c[_0xbc56('0xb4')]][_0xbc56('0x61')]+=0x1;var _0x57e2eb=_0x430bad[_0xbc56('0x22')][_0x45106c[_0xbc56('0xb4')]];var _0x582b70=new Hangup(_0x45106c,_0x2aba1f);_0x582b70[_0xbc56('0xa8')]=0x13;_0x582b70[_0xbc56('0xa9')]='Machine';_0x582b70[_0xbc56('0xe6')]=_0xbc56('0xe7');_0x582b70[_0xbc56('0xeb')]+=0x1;_0x582b70['countglobal']+=0x1;_0x582b70['amd']=!![];_0x430bad[_0xbc56('0xcc')](_0x582b70)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xec')));if(_0x582b70[_0xbc56('0xed')]+_0x582b70[_0xbc56('0xee')]+_0x582b70['countnoanswerretry']+_0x582b70[_0xbc56('0xef')]+_0x582b70[_0xbc56('0xf0')]+_0x582b70[_0xbc56('0xf1')]+_0x582b70[_0xbc56('0xeb')]+_0x582b70[_0xbc56('0xf2')]>=_0x57e2eb['dialGlobalMaxRetry']){_0x430bad['stateGlobal'](_0x582b70,_0x1945c9,_0x5b11be,_0xbc56('0xf3'));}else{if(_0x582b70[_0xbc56('0xeb')]>=_0x57e2eb[_0xbc56('0xf4')]){_0x430bad[_0xbc56('0xf5')](_0x582b70,_0x1945c9,_0x5b11be,_0xbc56('0xf6'));}else{_0x430bad[_0xbc56('0xc1')]({'active':![],'countmachineretry':_0x582b70[_0xbc56('0xeb')],'scheduledat':moment()[_0xbc56('0xf7')](_0x57e2eb[_0xbc56('0xf8')],_0xbc56('0xf9'))['format'](_0xbc56('0xfa')),'ContactId':_0x582b70['ContactId'],'ListId':_0x582b70[_0xbc56('0xd7')],'VoiceQueueId':_0x582b70[_0xbc56('0xfb')]||undefined,'CampaignId':_0x582b70['CampaignId']||undefined})['catch'](loggerCatch(_0xbc56('0xfc')));_0x1945c9({'reschedule':0x1});}}});}if(_0x45106c[_0xbc56('0x57')]===_0xbc56('0x7f')&&this[_0xbc56('0x23')][_0x45106c[_0xbc56('0xb4')]]['dialAMDActive']&&_0x2aba1f[_0xbc56('0xe4')]===_0xbc56('0xfd')){delete this[_0xbc56('0x2a')][_0x2aba1f['uniqueid']];this[_0xbc56('0xce')](this['campaigns'][_0x45106c[_0xbc56('0xb4')]]);_0x5f1948=new Hangup(_0x45106c,_0x2aba1f);_0x5f1948[_0xbc56('0xa8')]=0x12;_0x5f1948['statedesc']='HangupInAMD';_0x5f1948[_0xbc56('0xe6')]='AMD';this['saveInDb'](_0x5f1948,_0xbc56('0xfe'),_0xbc56('0xff'));}if(_0x45106c['type']===_0xbc56('0x7f')&&this[_0xbc56('0x23')][_0x45106c[_0xbc56('0xb4')]]['dialAMDActive']&&_0x2aba1f['value']===_0xbc56('0x100')){var _0x430bad=this;return new BPromise(function(_0x56f690,_0x4c1c65){delete _0x430bad[_0xbc56('0x2a')][_0x2aba1f[_0xbc56('0xdf')]];_0x430bad[_0xbc56('0xce')](_0x430bad[_0xbc56('0x23')][_0x45106c['queue']]);_0x430bad[_0xbc56('0x23')][_0x45106c[_0xbc56('0xb4')]]['outboundAnswerCallsDay']+=0x1;_0x430bad[_0xbc56('0x23')][_0x45106c['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x4bd3d8=_0x430bad[_0xbc56('0x23')][_0x45106c[_0xbc56('0xb4')]];var _0x3f1f6c=new Hangup(_0x45106c,_0x2aba1f);_0x3f1f6c[_0xbc56('0xa8')]=0x13;_0x3f1f6c['statedesc']=_0xbc56('0x101');_0x3f1f6c[_0xbc56('0xe6')]=_0xbc56('0xe7');_0x3f1f6c[_0xbc56('0xeb')]+=0x1;_0x3f1f6c[_0xbc56('0x102')]+=0x1;_0x3f1f6c[_0xbc56('0x103')]=!![];_0x430bad[_0xbc56('0xcc')](_0x3f1f6c)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xec')));if(_0x3f1f6c[_0xbc56('0xed')]+_0x3f1f6c['countcongestionretry']+_0x3f1f6c[_0xbc56('0x104')]+_0x3f1f6c[_0xbc56('0xef')]+_0x3f1f6c[_0xbc56('0xf0')]+_0x3f1f6c[_0xbc56('0xf1')]+_0x3f1f6c[_0xbc56('0xeb')]+_0x3f1f6c[_0xbc56('0xf2')]>=_0x4bd3d8[_0xbc56('0x105')]){_0x430bad[_0xbc56('0x106')](_0x3f1f6c,_0x56f690,_0x4c1c65,_0xbc56('0xf3'));}else{if(_0x3f1f6c[_0xbc56('0xeb')]>=_0x4bd3d8[_0xbc56('0xf4')]){_0x430bad[_0xbc56('0xf5')](_0x3f1f6c,_0x56f690,_0x4c1c65,_0xbc56('0xf6'));}else{_0x430bad['rescheduleContact']({'active':![],'countmachineretry':_0x3f1f6c[_0xbc56('0xeb')],'scheduledat':moment()[_0xbc56('0xf7')](_0x4bd3d8[_0xbc56('0xf8')],_0xbc56('0xf9'))[_0xbc56('0x7c')](_0xbc56('0xfa')),'ContactId':_0x3f1f6c['ContactId'],'ListId':_0x3f1f6c[_0xbc56('0xd7')],'VoiceQueueId':_0x3f1f6c[_0xbc56('0xfb')]||undefined,'CampaignId':_0x3f1f6c[_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xfc')));_0x56f690({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xbc56('0x36')]=function(_0x53569e){var _0x11eef5=this[_0xbc56('0x2a')][_0x53569e[_0xbc56('0xdf')]];var _0x94fb47=this;var _0x4ec0d0;if(_0x11eef5&&_0x11eef5[_0xbc56('0x57')]===_0xbc56('0x7f')){delete this['uniqueId'][_0x53569e[_0xbc56('0xdf')]];this[_0xbc56('0xce')](this[_0xbc56('0x23')][_0x11eef5['queue']]);this['campaigns'][_0x11eef5[_0xbc56('0xb4')]][_0xbc56('0x108')]+=0x1;_0x4ec0d0=new Hangup(_0x11eef5,_0x53569e);this[_0xbc56('0xcc')](_0x4ec0d0)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x109')));this['moveContactManagedDialer'](_0x4ec0d0)['catch'](loggerCatch(_0xbc56('0x10a')));}if(_0x11eef5&&_0x11eef5[_0xbc56('0x57')]!==_0xbc56('0x7f')&&isNotNull(this['voiceQueues'][_0x11eef5[_0xbc56('0xb4')]]['dialQueueProject'])){delete this[_0xbc56('0x2a')][_0x53569e[_0xbc56('0xdf')]];this['updateOriginated'](this['voiceQueues'][_0x11eef5[_0xbc56('0xb4')]]);this['voiceQueues'][_0x11eef5[_0xbc56('0xb4')]][_0xbc56('0x62')]+=0x1;this['voiceQueues'][_0x11eef5[_0xbc56('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4ec0d0=new Hangup(_0x11eef5,_0x53569e);_0x4ec0d0['state']=0x10;_0x4ec0d0[_0xbc56('0xa9')]=_0xbc56('0x10b');_0x4ec0d0[_0xbc56('0xe6')]='AGI';this['createHistory'](_0x4ec0d0)['catch'](loggerCatch(_0xbc56('0x109')));this[_0xbc56('0xca')](_0x4ec0d0)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x10a')));}if(_0x11eef5&&_0x11eef5[_0xbc56('0x57')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x11eef5[_0xbc56('0xb4')]][_0xbc56('0x10c')])){delete this[_0xbc56('0x2a')][_0x53569e[_0xbc56('0xdf')]];this[_0xbc56('0xce')](this[_0xbc56('0x22')][_0x11eef5[_0xbc56('0xb4')]]);this[_0xbc56('0x22')][_0x11eef5[_0xbc56('0xb4')]][_0xbc56('0x69')]+=0x1;_0x4ec0d0=new Hangup(_0x11eef5,_0x53569e);_0x4ec0d0[_0xbc56('0xa8')]=0xc;_0x4ec0d0[_0xbc56('0xa9')]=_0x53569e['cause-txt'];_0x4ec0d0['membername']=_0xbc56('0x10d');this[_0xbc56('0xcc')](_0x4ec0d0)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x109')));this[_0xbc56('0xca')](_0x4ec0d0)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x10a')));}};Dialer[_0xbc56('0x1c')][_0xbc56('0x10e')]=function(_0x2b168a){var _0x517528=this['uniqueId'][_0x2b168a[_0xbc56('0xdf')]];var _0x3ac891=this;if(this[_0xbc56('0x22')][_0x2b168a[_0xbc56('0xb4')]]){if(_0x517528&&_0x517528['type']!==_0xbc56('0x7f')){delete this[_0xbc56('0x2a')][_0x2b168a[_0xbc56('0xdf')]];this[_0xbc56('0x22')][_0x2b168a[_0xbc56('0xb4')]][_0xbc56('0x62')]+=0x1;var _0x18568c=new AgentComplete(_0x517528,_0x2b168a);if(_0x2b168a[_0xbc56('0x10f')]===_0xbc56('0x110')){_0x18568c['agiafterat']=this[_0xbc56('0x22')][_0x2b168a[_0xbc56('0xb4')]][_0xbc56('0x111')]&&this[_0xbc56('0x22')][_0x2b168a[_0xbc56('0xb4')]][_0xbc56('0x112')]?moment()['format'](_0xbc56('0xfa')):undefined;}this['createHistory'](_0x18568c)['catch'](loggerCatch(_0xbc56('0x113')));this[_0xbc56('0xca')](_0x18568c)[_0xbc56('0xb3')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xbc56('0x1c')][_0xbc56('0x2e')]=function(_0x1e21e5){if(this[_0xbc56('0x22')][_0x1e21e5[_0xbc56('0xb4')]]){if(this['uniqueId'][_0x1e21e5[_0xbc56('0xdf')]]&&this[_0xbc56('0x2a')][_0x1e21e5[_0xbc56('0xdf')]]['type']!==_0xbc56('0x7f')){this['updateOriginated'](this[_0xbc56('0x22')][_0x1e21e5[_0xbc56('0xb4')]]);this[_0xbc56('0x2a')][_0x1e21e5['uniqueid']][_0xbc56('0x114')]=moment()[_0xbc56('0x7c')](_0xbc56('0xfa'));}}};Dialer['prototype'][_0xbc56('0x115')]=function(_0x5d4d71){this[_0xbc56('0xcc')](_0x5d4d71)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x113')));this[_0xbc56('0xca')](_0x5d4d71)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x116')));};Dialer[_0xbc56('0x1c')]['syncQueueCallerAbandon']=function(_0x2785ee){var _0x4e457f=this['uniqueId'][_0x2785ee[_0xbc56('0xdf')]];var _0x464647=this;if(this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]]){if(_0x4e457f&&_0x4e457f[_0xbc56('0x57')]!==_0xbc56('0x7f')){delete this[_0xbc56('0x2a')][_0x2785ee[_0xbc56('0xdf')]];this['updateOriginated'](this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]]);_0x4e457f[_0xbc56('0x117')]=moment()[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4aaa98=new QueueCallerAbandon(_0x4e457f,_0x2785ee);if(getSeconds(_0x4e457f['droptime'],_0x4e457f['responsetime'])>=_0x4e457f[_0xbc56('0x118')]){this['voiceQueues'][_0x2785ee[_0xbc56('0xb4')]][_0xbc56('0x6e')]+=0x1;this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]][_0xbc56('0x119')]+=0x1;this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4aaa98[_0xbc56('0xa8')]=0xa;_0x4aaa98[_0xbc56('0xa9')]='Drop';_0x4aaa98[_0xbc56('0x11a')]=_0xbc56('0x11b');_0x4aaa98[_0xbc56('0x11c')]=this[_0xbc56('0x22')][_0x2785ee['queue']][_0xbc56('0x111')]?moment()[_0xbc56('0x7c')](_0xbc56('0xfa')):undefined;_0x4aaa98['countdropretry']+=0x1;_0x4aaa98[_0xbc56('0x102')]+=0x1;if(_0x4aaa98[_0xbc56('0xf0')]>=this[_0xbc56('0x22')][_0x2785ee['queue']][_0xbc56('0x11d')]){this['queueCallerAbandonCreateState'](_0x4aaa98);}else{this[_0xbc56('0xc1')]({'active':![],'countdropretry':_0x4aaa98[_0xbc56('0xf0')],'scheduledat':moment()[_0xbc56('0xf7')](this['voiceQueues'][_0x2785ee['queue']][_0xbc56('0x11e')],_0xbc56('0xf9'))[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e457f[_0xbc56('0xd6')],'ListId':_0x4e457f[_0xbc56('0xd7')],'VoiceQueueId':_0x4e457f['VoiceQueueId']||undefined,'CampaignId':_0x4e457f[_0xbc56('0x107')]||undefined})['catch'](loggerCatch(_0xbc56('0x11f')));var _0xec25c3=new History(_0x4aaa98);_0xec25c3[_0xbc56('0xa8')]=0xa;_0xec25c3[_0xbc56('0xa9')]=_0xbc56('0x120');_0xec25c3[_0xbc56('0xab')]=moment()[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');_0xec25c3[_0xbc56('0xaa')]=_0xec25c3[_0xbc56('0xab')];_0xec25c3[_0xbc56('0x121')]=_0x4aaa98['calleridname'];_0xec25c3[_0xbc56('0x122')]=_0x4aaa98[_0xbc56('0x122')];this[_0xbc56('0xcc')](_0xec25c3)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]][_0xbc56('0x6d')]+=0x1;this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]][_0xbc56('0x65')]+=0x1;_0x4aaa98['state']=0xb;_0x4aaa98[_0xbc56('0xa9')]=_0xbc56('0x123');_0x4aaa98[_0xbc56('0x11a')]=_0xbc56('0x124');_0x4aaa98[_0xbc56('0xf1')]+=0x1;_0x4aaa98['countglobal']+=0x1;if(_0x4aaa98['countabandonedretry']>=this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]][_0xbc56('0x125')]){this[_0xbc56('0x115')](_0x4aaa98);}else{this[_0xbc56('0xc1')]({'active':![],'countabandonedretry':_0x4aaa98[_0xbc56('0xf1')],'scheduledat':moment()[_0xbc56('0xf7')](this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]]['dialAbandonedRetryFrequency'],_0xbc56('0xf9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e457f[_0xbc56('0xd6')],'ListId':_0x4e457f[_0xbc56('0xd7')],'VoiceQueueId':_0x4e457f[_0xbc56('0xfb')]||undefined,'CampaignId':_0x4e457f[_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x126')));var _0xec25c3=new History(_0x4aaa98);_0xec25c3[_0xbc56('0xa8')]=0xb;_0xec25c3[_0xbc56('0xa9')]=_0xbc56('0x123');_0xec25c3[_0xbc56('0xab')]=moment()[_0xbc56('0x7c')](_0xbc56('0xfa'));_0xec25c3[_0xbc56('0xaa')]=_0xec25c3[_0xbc56('0xab')];_0xec25c3[_0xbc56('0x121')]=_0x4aaa98[_0xbc56('0x121')];_0xec25c3[_0xbc56('0x122')]=_0x4aaa98[_0xbc56('0x122')];this[_0xbc56('0xcc')](_0xec25c3)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x127')));}}}}};Dialer[_0xbc56('0x1c')]['syncNewExten']=function(_0xc6afc1){if(this[_0xbc56('0x28')][_0xc6afc1['uniqueid']]){this[_0xbc56('0x28')][_0xc6afc1[_0xbc56('0xdf')]][_0xbc56('0xb2')]=_0xc6afc1[_0xbc56('0xb2')];}if(this['uniqueId'][_0xc6afc1[_0xbc56('0xdf')]]){this[_0xbc56('0x2a')][_0xc6afc1[_0xbc56('0xdf')]][_0xbc56('0xb2')]=_0xc6afc1[_0xbc56('0xb2')];}};Dialer[_0xbc56('0x1c')]['syncQueueMember']=function(_0x19dbb2){if(strategy[this['voiceQueues'][this[_0xbc56('0x28')][_0x19dbb2[_0xbc56('0x128')]][_0xbc56('0xb4')]][_0xbc56('0x4f')]]===_0xbc56('0x1b')){if(this[_0xbc56('0x28')][_0x19dbb2['actionid']]&&_['isNil'](this[_0xbc56('0x28')][_0x19dbb2[_0xbc56('0x128')]][_0xbc56('0x129')])&&_0x19dbb2[_0xbc56('0xb1')]==='1'&&_0x19dbb2[_0xbc56('0x12a')]==='0'){if(this[_0xbc56('0x24')][_0x19dbb2['stateinterface']]){if(!this[_0xbc56('0x24')][_0x19dbb2[_0xbc56('0x12b')]][_0xbc56('0x129')]){this['agents'][_0x19dbb2['stateinterface']]['locked']=!![];this[_0xbc56('0x28')][_0x19dbb2[_0xbc56('0x128')]][_0xbc56('0x129')]=!![];this[_0xbc56('0x28')][_0x19dbb2[_0xbc56('0x128')]][_0xbc56('0x12b')]=_0x19dbb2[_0xbc56('0x12b')];}}}}else if((strategy[this['voiceQueues'][this[_0xbc56('0x28')][_0x19dbb2[_0xbc56('0x128')]][_0xbc56('0xb4')]]['strategy']]||_0xbc56('0x12c'))===_0xbc56('0x12c')){if(this[_0xbc56('0x28')][_0x19dbb2['actionid']]){if(this[_0xbc56('0x24')][_0x19dbb2[_0xbc56('0x12b')]]){this['actions'][_0x19dbb2[_0xbc56('0x128')]]['stateinterface']=_0x19dbb2['stateinterface'];if(_['isNil'](this['queueBooked'][this['actions'][_0x19dbb2[_0xbc56('0x128')]]['queue']])){this[_0xbc56('0x12d')][this[_0xbc56('0x28')][_0x19dbb2[_0xbc56('0x128')]]['queue']]=[];}this['queueBooked'][this[_0xbc56('0x28')][_0x19dbb2['actionid']][_0xbc56('0xb4')]][_0xbc56('0x12e')](_[_0xbc56('0x93')](_[_0xbc56('0xd5')](this[_0xbc56('0x28')][_0x19dbb2['actionid']],[_0xbc56('0x12f'),'stateinterface']),{'status':_0x19dbb2['status'],'paused':_0x19dbb2[_0xbc56('0x12a')]}));}}}};function unlockQueueStatus(_0x4a8821,_0x3eba1e){setTimeout(function(){if(_['isUndefined'](_0x4a8821['queueStatusComplete'])){loggerBooked[_0xbc56('0x99')](_0xbc56('0x130'),_0x3eba1e);}_0x4a8821['queueStatusComplete']=!![];loggerBooked[_0xbc56('0x82')](_0xbc56('0x131'),_0x3eba1e,JSON[_0xbc56('0x49')](_[_0xbc56('0xd5')](_0x4a8821,[_0xbc56('0x40'),_0xbc56('0x132')])));},0x1f3);}Dialer['prototype'][_0xbc56('0x3b')]=function(_0x52846a){var _0x161245=this;var _0x107e07=_0x161245['voiceQueues'][_0x161245['actions'][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]];if(strategy[this[_0xbc56('0x22')][this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]]['strategy']]===_0xbc56('0x1b')){if(this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]]&&this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]]['stateinterface']){this['preview'][_0xbc56('0x133')](this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0x12f')],this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0x12b')])['catch'](function(_0x21b789){logger['error'](_0xbc56('0x134'),util[_0xbc56('0x98')](_0x21b789,{'showHidden':![],'depth':null}));})[_0xbc56('0x1f')](function(){_0x161245[_0xbc56('0xce')](_0x161245[_0xbc56('0x22')][_0x161245[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]]['queue']]);_0x161245[_0xbc56('0x24')][_0x161245[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0x12b')]]['locked']=![];delete _0x161245[_0xbc56('0x28')][_0x52846a['actionid']];unlockQueueStatus(_0x107e07);});}else{this[_0xbc56('0xce')](this[_0xbc56('0x22')][this['actions'][_0x52846a[_0xbc56('0x128')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this[_0xbc56('0x28')][_0x52846a['actionid']]['ContactId'],'ListId':this['actions'][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xd7')],'VoiceQueueId':this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xfb')]||undefined,'CampaignId':this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x135')));delete this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]];unlockQueueStatus(_0x107e07);}}else if((strategy[this[_0xbc56('0x22')][this['actions'][_0x52846a[_0xbc56('0x128')]]['queue']][_0xbc56('0x4f')]]||'rrmemory')===_0xbc56('0x12c')){var _0x1420a7;if(this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]]&&!_[_0xbc56('0x45')](this[_0xbc56('0x12d')][this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]])){if(this[_0xbc56('0x136')][_0x161245[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]]){this[_0xbc56('0x136')][_0x161245[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]]=this[_0xbc56('0x136')][this['actions'][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]]?this[_0xbc56('0x136')][this['actions'][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]]:this[_0xbc56('0x12d')][this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]]['queue']]?this['queueBooked'][this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]]['queue']][_0xbc56('0x137')]||0x0:0x0;}this[_0xbc56('0x12d')][this[_0xbc56('0x28')][_0x52846a['actionid']][_0xbc56('0xb4')]][_0xbc56('0x137')]=this[_0xbc56('0x136')][this[_0xbc56('0x28')][_0x52846a['actionid']][_0xbc56('0xb4')]];for(var _0x25a802=0x0;_0x25a802=0x0?!![]:![];})[_0xbc56('0xb3')](myreject(_0x75f8bd)));}}else{_0x2d0ab7[_0xbc56('0x12e')](ami['Action']({'action':_0xbc56('0x150'),'command':util[_0xbc56('0x7c')](_0xbc56('0x155'),_0x4cb286,!_['isUndefined'](config[_0xbc56('0x151')][_0x1571e4])?_0x1571e4:'')})[_0xbc56('0xb8')](function(_0xa04add){return _0xa04add[_0xbc56('0x152')][_0xbc56('0x153')](_0xbc56('0x154'))>=0x0?!![]:![];})[_0xbc56('0xb3')](myreject(_0x75f8bd)));}BPromise['all'](_0x2d0ab7)[_0xbc56('0xb8')](function(_0x175cd6){var _0xc6c64f=_[_0xbc56('0x156')](_0x175cd6);if(_0xc6c64f){return _0x57c737(_0xc6c64f);}else{_0x390ac1[_0xbc56('0x3e')]=_0x3cd5c0?'GLOBAL_INTERVAL_IS_OVERTIME':_0xbc56('0x157');return _0x75f8bd(msgResponse(_0xbc56('0x158'),_0xbc56('0x148'),_0xbc56('0x159')+_0x3cd5c0+'\x20'+_0x433d56+_0xbc56('0x15a')+util[_0xbc56('0x98')](_0x4cb286,{'showHidden':![],'depth':null})+_0xbc56('0x15b')+_0x1571e4));}})[_0xbc56('0xb3')](function(_0x24fa84){return _0x75f8bd(msgResponse(_0xbc56('0x146'),_0xbc56('0x148'),JSON[_0xbc56('0x49')](_0x24fa84)));});});};Dialer[_0xbc56('0x1c')][_0xbc56('0x15c')]=function(_0x5825db){var _0x45e137=this;return function(){switch(_0x5825db['dialMethod']){case _0xbc56('0x15d'):freeVariablesPredictive(_0x5825db);_0x45e137[_0xbc56('0x15e')](_0x5825db,0x1);break;case _0xbc56('0x15f'):freeVariablesPredictive(_0x5825db);_0x45e137['handlePower'](_0x5825db,_0x5825db[_0xbc56('0x160')]);break;case _0xbc56('0x9'):_0x45e137[_0xbc56('0x9')](_0x5825db);break;case _0xbc56('0x8'):freeVariablesPredictive(_0x5825db);_0x45e137[_0xbc56('0x15e')](_0x5825db,0x1);break;default:freeVariablesPredictive(_0x5825db);logger[_0xbc56('0x99')](_0xbc56('0x161'),_0x5825db['name'],'method\x20not\x20recognized');}};};Dialer[_0xbc56('0x1c')][_0xbc56('0x162')]=function(_0x829c1b){var _0x31aeff=this;return function(){_0x31aeff[_0xbc56('0x163')](_0x829c1b);};};Dialer[_0xbc56('0x1c')]['syncQueueSummary']=function(_0x4ae1ab){var _0x4bd8c7=this;if(isNotPreview(_0x4ae1ab[_0xbc56('0x5d')])){if(isVoiceQueueOutbound(_0x4ae1ab['type'])&&isActive(_0x4ae1ab['dialActive'])){_0x4ae1ab['sendMessageOneNotActive']=!![];BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](checkIsLoggedIn(_0x4ae1ab,_0x4ae1ab[_0xbc56('0x164')]))['then'](checkIsActive(_0x4ae1ab,_0x4ae1ab['dialActive']))[_0xbc56('0xb8')](checkInterval(_0x4ae1ab))[_0xbc56('0xb8')](_0x4bd8c7['checkIsTrunkReachable'](_0x4ae1ab))[_0xbc56('0xb8')](_0x4bd8c7[_0xbc56('0x145')](_0x4ae1ab[_0xbc56('0x165')],_0x4ae1ab[_0xbc56('0x166')],_0x4ae1ab[_0xbc56('0x40')],_0x4ae1ab))[_0xbc56('0xb8')](_0x4bd8c7[_0xbc56('0x147')](_0x4ae1ab[_0xbc56('0x44')],_0x4ae1ab[_0xbc56('0x166')],_0x4ae1ab[_0xbc56('0x40')],_0x4ae1ab))[_0xbc56('0xb8')](_0x4bd8c7[_0xbc56('0x15c')](_0x4ae1ab))[_0xbc56('0xb3')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4ae1ab));}else{notSendMessagesQueue(_0x4ae1ab);}}else{freeVariablesPredictive(_0x4ae1ab);}};Dialer[_0xbc56('0x1c')][_0xbc56('0x141')]=function(){var _0x8d958c=this;var _0x3a0d1b;for(var _0x513d94 in this[_0xbc56('0x23')]){if(this[_0xbc56('0x23')][_0xbc56('0x9b')](_0x513d94)){_0x3a0d1b=this[_0xbc56('0x23')][_0x513d94];if(isCampaignIvr(_0x3a0d1b[_0xbc56('0x57')])&&isActive(_0x3a0d1b['active'])){_0x3a0d1b[_0xbc56('0xa1')]=!![];BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](checkIsActive(_0x3a0d1b,_0x3a0d1b['active']))['then'](checkInterval(_0x3a0d1b))['then'](_0x8d958c[_0xbc56('0x167')](_0x3a0d1b))[_0xbc56('0xb8')](_0x8d958c['checkIfTime'](_0x3a0d1b[_0xbc56('0x165')],_0x3a0d1b['dialTimezone'],_0x3a0d1b[_0xbc56('0x40')],_0x3a0d1b))[_0xbc56('0xb8')](_0x8d958c[_0xbc56('0x147')](_0x3a0d1b[_0xbc56('0x44')],_0x3a0d1b['dialTimezone'],_0x3a0d1b[_0xbc56('0x40')],_0x3a0d1b))[_0xbc56('0xb8')](_0x8d958c['launchHandleIvr'](_0x3a0d1b))[_0xbc56('0xb3')](loggerCatchQueueSummary(_0xbc56('0x168'),_0x3a0d1b));}else{notSendMessagesCampaign(_0x3a0d1b);}}}};function getCallerIdRandom(_0x3c4a33,_0xef4cc9){var _0x227828,_0x2a3e8d,_0x26fdf9;if(_0xef4cc9<=0x0){_0xef4cc9=0x1;}_0x227828=new RegExp(_0xbc56('0x169')+_0xef4cc9+'}$');_0x2a3e8d=Math[_0xbc56('0x16a')](0xa,_0xef4cc9-0x1);_0x26fdf9=Math['pow'](0xa,_0xef4cc9)-0x1;return util[_0xbc56('0x7c')]('%s',_[_0xbc56('0x16b')](_0x3c4a33,_0x227828,_['random'](_0x2a3e8d,_0x26fdf9)));}function extractCalleridName(_0xba5a18){var _0x510cd3=_0xba5a18['match'](/"(.*?)"/);return _0x510cd3?_0x510cd3[0x1]:_0xba5a18;}function extractCalleridNumber(_0x520e28){var _0x1b46ee=_0x520e28[_0xbc56('0x16c')](/<(.*?)>/);return _0x1b46ee?_0x1b46ee[0x1]:_0x520e28;}Dialer[_0xbc56('0x1c')]['actionOriginate']=function(_0x57a3fd,_0x43e597){var _0xf446ed=this;var _0x201d6f=uuid['v4']();this[_0xbc56('0x28')][_0x201d6f]=new Action(_0x57a3fd,_0x43e597,_0x201d6f);return new BPromise(function(_0x4c8a39,_0x97f578){if(_[_0xbc56('0x3d')](_0x57a3fd)&&_0xbc56('0x16d')!==typeof _0x57a3fd){return _0x97f578(msgResponse('originate',_0xbc56('0x148'),_0xbc56('0x16e')));}if(_[_0xbc56('0x3d')](_0x43e597['Contact'][_0xbc56('0x16f')])||_0x43e597[_0xbc56('0x170')][_0xbc56('0x16f')]===null){return _0x97f578(msgResponse(_0xbc56('0x171'),'Failure',_0xbc56('0x172')));}var _0x583fd8={'XMD-CALLERID':_0xf446ed[_0xbc56('0x28')][_0x201d6f]['getCaller'](),'XMD-AGI':_0x57a3fd[_0xbc56('0x10c')]?util['format'](_0xbc56('0x173'),ipAgi,_0x57a3fd['dialQueueProject']):_0xbc56('0x174'),'XMD-AGIAFTER':_0x57a3fd[_0xbc56('0x111')]?util[_0xbc56('0x7c')]('\x22agi://%s/square,%s\x22',ipAgi,_0x57a3fd['dialQueueProject2']):_0xbc56('0x174'),'XMD-QUEUE':_0x57a3fd['type']===_0xbc56('0x4e')?util['format'](_0xbc56('0x175'),_0x57a3fd[_0xbc56('0x40')],_0x57a3fd[_0xbc56('0x176')]||'',_0x57a3fd[_0xbc56('0x112')]?'c':'',_0x57a3fd[_0xbc56('0x118')]||0x3):_0xbc56('0x174'),'XMD-CONTACTID':_0x43e597['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xf446ed[_0xbc56('0x28')][_0x201d6f][_0xbc56('0x177')](),'XMD-AMD':_0x57a3fd[_0xbc56('0xea')]?_0xbc56('0x178'):'NONE','XMD-DESTINATION':_0xbc56('0xe3')};if(_0x57a3fd[_0xbc56('0xea')]){_0x583fd8[_0xbc56('0x179')]=_0x57a3fd[_0xbc56('0x17a')]||0x9c4;_0x583fd8[_0xbc56('0x17b')]=_0x57a3fd[_0xbc56('0x17c')]||0x5dc;_0x583fd8['XMD-AMDAFTERGREETINGSILENCE']=_0x57a3fd[_0xbc56('0x17d')]||0x320;_0x583fd8[_0xbc56('0x17e')]=_0x57a3fd[_0xbc56('0x17f')]||0x1388;_0x583fd8['XMD-AMDMINWORDLENGTH']=_0x57a3fd['dialAMDMinWordLength']||0x64;_0x583fd8['XMD-AMDBETWEENWORDSSILENCE']=_0x57a3fd[_0xbc56('0x180')]||0x32;_0x583fd8[_0xbc56('0x181')]=_0x57a3fd[_0xbc56('0x182')]||0x3;_0x583fd8[_0xbc56('0x183')]=_0x57a3fd[_0xbc56('0x184')]||0x100;_0x583fd8[_0xbc56('0x185')]=_0x57a3fd[_0xbc56('0x186')]||0x1388;}if(_0x57a3fd[_0xbc56('0x57')]===_0xbc56('0x4e')){_0x583fd8[_0xbc56('0x187')]=_0x43e597[_0xbc56('0xfb')];}else{_0x583fd8[_0xbc56('0x188')]=_0x43e597[_0xbc56('0x107')];}for(var _0x488dfd in _0x43e597[_0xbc56('0x170')]){if(_0x43e597[_0xbc56('0x170')][_0xbc56('0x9b')](_0x488dfd)){if(isNotNull(_0x43e597[_0xbc56('0x170')][_0x488dfd])&&_0x488dfd!=='id'&&_0x488dfd!==_0xbc56('0x189')&&_0x488dfd!=='createdAt'&&_0x488dfd!==_0xbc56('0x18a')){_0x583fd8[util['format'](_0xbc56('0x18b'),_0xbc56('0x18c'),_[_0xbc56('0x18d')](_0x488dfd))]=_0x43e597['Contact'][_0x488dfd];}}}var _0x49717b=_0xf446ed[_0xbc56('0xdb')](_0x57a3fd[_0xbc56('0x79')])?getCallerId(_0x57a3fd[_0xbc56('0x79')][_0xbc56('0x7b')],_0x57a3fd[_0xbc56('0x5e')],_0x57a3fd[_0xbc56('0x18e')]>0x0?getCallerIdRandom(_0x57a3fd[_0xbc56('0x5f')],_0x57a3fd[_0xbc56('0x18e')]):_0x57a3fd[_0xbc56('0x5f')]):getCallerId(_['isNil'](_0x57a3fd[_0xbc56('0x142')])?_0x57a3fd['Trunk'][_0xbc56('0x7b')]:_0x57a3fd[_0xbc56('0x142')][_0xbc56('0x7b')],_0x57a3fd[_0xbc56('0x5e')],_0x57a3fd['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x57a3fd[_0xbc56('0x5f')],_0x57a3fd[_0xbc56('0x18e')]):_0x57a3fd['dialOriginateCallerIdNumber']);if(_0x49717b){_0x583fd8[_0xbc56('0x18f')]=_0xf446ed[_0xbc56('0x28')][_0x201d6f][_0xbc56('0x190')]=extractCalleridName(_0x49717b);_0x583fd8[_0xbc56('0x191')]=_0xf446ed[_0xbc56('0x28')][_0x201d6f][_0xbc56('0x192')]=extractCalleridNumber(_0x49717b);}return ami[_0xbc56('0xb0')]({'actionid':_0x201d6f,'action':'originate','channel':_0xf446ed['isTrunkReachable'](_0x57a3fd[_0xbc56('0x79')])?util[_0xbc56('0x7c')]('SIP/%s/%s%s',_0x57a3fd['Trunk'][_0xbc56('0x40')],isNotNull(_0x57a3fd['dialPrefix'])?_0x57a3fd[_0xbc56('0x193')]['trim']()||'':'',_0x57a3fd[_0xbc56('0x194')]>0x0?_0x43e597[_0xbc56('0x170')][_0xbc56('0x16f')][_0xbc56('0x195')](_0x57a3fd[_0xbc56('0x194')]):_0x43e597[_0xbc56('0x170')]['phone']):util[_0xbc56('0x7c')](_0xbc56('0x196'),_[_0xbc56('0xaf')](_0x57a3fd['TrunkBackup'])?_0x57a3fd['Trunk']['name']:_0x57a3fd[_0xbc56('0x142')][_0xbc56('0x40')],isNotNull(_0x57a3fd['dialPrefix'])?_0x57a3fd[_0xbc56('0x193')][_0xbc56('0x197')]()||'':'',_0x57a3fd[_0xbc56('0x194')]>0x0?_0x43e597[_0xbc56('0x170')]['phone'][_0xbc56('0x195')](_0x57a3fd[_0xbc56('0x194')]):_0x43e597[_0xbc56('0x170')]['phone']),'callerid':_0x49717b,'Exten':_0xbc56('0xe3'),'Context':_0xbc56('0x198'),'Priority':'1','variable':_0x583fd8,'timeout':(_0x57a3fd['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x201d6f})[_0xbc56('0xb8')](function(_0x428144){return _0x4c8a39(_0x428144);})[_0xbc56('0xb3')](function(_0x386f4d){_0x57a3fd[_0xbc56('0x67')]+=0x1;var _0x1b056b=new History(_0xf446ed[_0xbc56('0x28')][_0x201d6f]);logger[_0xbc56('0x99')](util[_0xbc56('0x7c')]('[originateError]:\x20%s',JSON[_0xbc56('0x49')](_0x386f4d)));_0x1b056b['state']=0xe;_0x1b056b[_0xbc56('0xa9')]=_0xbc56('0x199');_0x1b056b[_0xbc56('0xab')]=moment()[_0xbc56('0x7c')](_0xbc56('0xfa'));_0x1b056b['endtime']=_0x1b056b[_0xbc56('0xab')];_0xf446ed[_0xbc56('0xcc')](_0x1b056b)[_0xbc56('0xb3')](loggerCatch('[originate][error]'));_0xf446ed[_0xbc56('0xca')](_0x1b056b)['catch'](loggerCatch(_0xbc56('0x19a')))[_0xbc56('0x1f')](function(){delete _0xf446ed[_0xbc56('0x28')][_0x201d6f];return _0x97f578(msgResponse(_0xbc56('0x171'),_0xbc56('0x48'),_0xbc56('0x19b')));});});});};Dialer['prototype'][_0xbc56('0x33')]=function(_0x5701e6){var _0x50adf4=this[_0xbc56('0x28')][_0x5701e6['actionid']];var _0x418fde=this;if(_0x50adf4){delete this[_0xbc56('0x28')][_0x5701e6[_0xbc56('0x128')]];_0x50adf4['responsetime']=moment()[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x138ab9=_0x50adf4[_0xbc56('0x57')]===_0xbc56('0x7f')?this[_0xbc56('0x23')][_0x50adf4['queue']]:this[_0xbc56('0x22')][_0x50adf4[_0xbc56('0x19c')]()];if(!this[_0xbc56('0xd9')](_0x5701e6[_0xbc56('0x19d')])){this['updateOriginated'](_0x138ab9);return this[_0xbc56('0x19e')](_0x50adf4,_0x138ab9,_0x5701e6)[_0xbc56('0xb8')](function(_0xbb438c){})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x19f')));}else{this['uniqueId'][_0x5701e6[_0xbc56('0xdf')]]=_0x50adf4;}}};Dialer[_0xbc56('0x1c')][_0xbc56('0x1a0')]=function(_0x1b4eb2,_0x1712c7,_0x46d427){var _0x202c91=new History(_0x1712c7);if(_0x202c91[_0xbc56('0xed')]+_0x202c91[_0xbc56('0xee')]+_0x202c91['countnoanswerretry']+_0x202c91[_0xbc56('0xef')]+_0x202c91[_0xbc56('0xf0')]+_0x202c91[_0xbc56('0xf1')]+_0x202c91[_0xbc56('0xeb')]+_0x202c91['countagentrejectretry']>=_0x46d427[_0xbc56('0x105')]-0x1){return!![];}switch(_0x1b4eb2){case 0x3:if(_0x202c91[_0xbc56('0x104')]>=_0x46d427['dialNoAnswerMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x202c91[_0xbc56('0x104')]+=0x1,'scheduledat':moment()[_0xbc56('0xf7')](_0x46d427[_0xbc56('0x1a1')],_0xbc56('0xf9'))[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x202c91[_0xbc56('0xed')]>=_0x46d427[_0xbc56('0x1a2')]-0x1){return!![];}else{this[_0xbc56('0xc1')]({'active':![],'countbusyretry':_0x202c91[_0xbc56('0xed')]+=0x1,'scheduledat':moment()['add'](_0x46d427[_0xbc56('0x1a3')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91['ListId'],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1a4')));}break;case 0x8:if(_0x202c91[_0xbc56('0xee')]>=_0x46d427[_0xbc56('0x1a5')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x202c91[_0xbc56('0xee')]+=0x1,'scheduledat':moment()['add'](_0x46d427['dialCongestionRetryFrequency'],'minutes')['format'](_0xbc56('0xfa')),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x202c91[_0xbc56('0xef')]>=_0x46d427['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xbc56('0xc1')]({'active':![],'countnosuchnumberretry':_0x202c91[_0xbc56('0xef')]+=0x1,'scheduledat':moment()[_0xbc56('0xf7')](_0x46d427[_0xbc56('0x1a6')],_0xbc56('0xf9'))[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1a7')));}break;case 0xa:if(_0x202c91['countdropretry']>=_0x46d427[_0xbc56('0x11d')]-0x1){return!![];}else{this[_0xbc56('0xc1')]({'active':![],'countdropretry':_0x202c91[_0xbc56('0xf0')]+=0x1,'scheduledat':moment()[_0xbc56('0xf7')](_0x46d427['dialDropRetryFrequency'],_0xbc56('0xf9'))['format'](_0xbc56('0xfa')),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91['CampaignId']||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x11f')));}break;case 0xb:if(_0x202c91[_0xbc56('0xf1')]>=_0x46d427[_0xbc56('0x125')]-0x1){return!![];}else{this[_0xbc56('0xc1')]({'active':![],'countabandonedretry':_0x202c91[_0xbc56('0xf1')]+=0x1,'scheduledat':moment()[_0xbc56('0xf7')](_0x46d427[_0xbc56('0x1a8')],_0xbc56('0xf9'))[_0xbc56('0x7c')](_0xbc56('0xfa')),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})['catch'](loggerCatch(_0xbc56('0x126')));}break;case 0x13:if(_0x202c91[_0xbc56('0xeb')]>=_0x46d427['dialMachineMaxRetry']-0x1){return!![];}else{this[_0xbc56('0xc1')]({'active':![],'countmachineretry':_0x202c91[_0xbc56('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x46d427[_0xbc56('0xf8')],'minutes')[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x202c91[_0xbc56('0xf2')]>=_0x46d427[_0xbc56('0x1a9')]-0x1){return!![];}else{this[_0xbc56('0xc1')]({'active':![],'countagentrejectretry':_0x202c91[_0xbc56('0xf2')]+=0x1,'scheduledat':moment()[_0xbc56('0xf7')](_0x46d427[_0xbc56('0x1aa')],_0xbc56('0xf9'))['format'](_0xbc56('0xfa')),'ContactId':_0x202c91['ContactId'],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})['catch'](loggerCatch(_0xbc56('0x1ab')));}break;default:return!![];}};Dialer[_0xbc56('0x1c')]['callProgressDetecting']=function(_0x523c71,_0x20c573,_0x358eeb){var _0x16b917=this;var _0x1e45e1=new History(_0x523c71);return new BPromise(function(_0x360dde,_0x1a8710){if(_[_0xbc56('0x3d')](_0x20c573)&&_0xbc56('0x16d')!==typeof _0x20c573){return _0x1a8710(msgResponse(_0xbc56('0x1ac'),_0xbc56('0x148'),_0xbc56('0x1ad')));}if(_['isUndefined'](_0x358eeb)&&_0xbc56('0x16d')!==typeof _0x358eeb){return _0x1a8710(msgResponse(_0xbc56('0x1ac'),_0xbc56('0x148'),_0xbc56('0x1ae')));}switch(_0x358eeb[_0xbc56('0x10f')]){case'0':_0x20c573[_0xbc56('0x66')]+=0x1;_0x1e45e1['state']=0x0;_0x1e45e1[_0xbc56('0xa9')]=_0xbc56('0x1af');_0x1e45e1[_0xbc56('0xef')]+=0x1;_0x1e45e1[_0xbc56('0x102')]+=0x1;ami[_0xbc56('0x4d')](_0xbc56('0x1b0'),ut[_0xbc56('0x1b1')](_0x523c71,_0xbc56('0x1b2')));_0x16b917[_0xbc56('0xcc')](_0x1e45e1)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x16b917[_0xbc56('0x1a0')](0x0,_0x523c71,_0x20c573)){if(_0x1e45e1[_0xbc56('0xef')]>=_0x20c573[_0xbc56('0x1b3')]){_0x16b917['createStateFinal'](_0x1e45e1,_0x360dde,_0x1a8710,'reason\x200\x20no\x20such\x20number....');}else{_0x16b917[_0xbc56('0x106')](_0x1e45e1,_0x360dde,_0x1a8710,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x20c573[_0xbc56('0x1b4')]+=0x1;_0x1e45e1['state']=0x3;_0x1e45e1[_0xbc56('0xa9')]=_0xbc56('0x1b5');_0x1e45e1[_0xbc56('0x104')]+=0x1;_0x1e45e1['countglobal']+=0x1;ami[_0xbc56('0x4d')](_0xbc56('0x1b6'),ut[_0xbc56('0x1b1')](_0x523c71,'noanswer'));_0x16b917[_0xbc56('0xcc')](_0x1e45e1)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1b7')));if(_0x16b917[_0xbc56('0x1a0')](0x3,_0x523c71,_0x20c573)){if(_0x1e45e1['countnoanswerretry']>=_0x20c573[_0xbc56('0x1b8')]){_0x16b917[_0xbc56('0xf5')](_0x1e45e1,_0x360dde,_0x1a8710,_0xbc56('0x1b9'));}else{_0x16b917[_0xbc56('0x106')](_0x1e45e1,_0x360dde,_0x1a8710,_0xbc56('0x1b9'));}}break;case'5':_0x20c573[_0xbc56('0x63')]+=0x1;_0x1e45e1['state']=0x5;_0x1e45e1[_0xbc56('0xa9')]=_0xbc56('0x1ba');_0x1e45e1[_0xbc56('0xed')]+=0x1;_0x1e45e1[_0xbc56('0x102')]+=0x1;ami['emit'](_0xbc56('0x1bb'),ut[_0xbc56('0x1b1')](_0x523c71,_0xbc56('0x1bc')));_0x16b917[_0xbc56('0xcc')](_0x1e45e1)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1bd')));if(_0x16b917['checkRetriveMax'](0x5,_0x523c71,_0x20c573)){if(_0x1e45e1['countbusyretry']>=_0x20c573[_0xbc56('0x1a2')]){_0x16b917[_0xbc56('0xf5')](_0x1e45e1,_0x360dde,_0x1a8710,_0xbc56('0x1be'));}else{_0x16b917[_0xbc56('0x106')](_0x1e45e1,_0x360dde,_0x1a8710,'reason\x205\x20busy');}}break;case'8':_0x20c573['outboundCongestionCallsDay']+=0x1;_0x1e45e1[_0xbc56('0xa8')]=0x8;_0x1e45e1['statedesc']='Congestion';_0x1e45e1[_0xbc56('0xee')]+=0x1;_0x1e45e1['countglobal']+=0x1;ami[_0xbc56('0x4d')](_0xbc56('0x1bf'),ut['buildObj'](_0x523c71,_0xbc56('0x1c0')));_0x16b917[_0xbc56('0xcc')](_0x1e45e1)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1c1')));if(_0x16b917[_0xbc56('0x1a0')](0x8,_0x523c71,_0x20c573)){if(_0x1e45e1[_0xbc56('0xee')]>=_0x20c573['dialCongestionMaxRetry']){_0x16b917['createStateFinal'](_0x1e45e1,_0x360dde,_0x1a8710,'reason\x208\x20congestion');}else{_0x16b917[_0xbc56('0x106')](_0x1e45e1,_0x360dde,_0x1a8710,_0xbc56('0x1c2'));}}break;case'11':_0x20c573[_0xbc56('0x1c3')]+=0x1;_0x1e45e1['state']=0xb;_0x1e45e1[_0xbc56('0xa9')]=_0xbc56('0x123');_0x1e45e1[_0xbc56('0xf1')]+=0x1;_0x1e45e1[_0xbc56('0x102')]+=0x1;_0x16b917[_0xbc56('0xcc')](_0x1e45e1)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x127')));if(_0x16b917[_0xbc56('0x1a0')](0xb,_0x523c71,_0x20c573)){if(_0x1e45e1[_0xbc56('0xf1')]>=_0x20c573[_0xbc56('0x125')]){_0x16b917[_0xbc56('0xf5')](_0x1e45e1,_0x360dde,_0x1a8710,_0xbc56('0x1c4'));}else{_0x16b917['stateGlobal'](_0x1e45e1,_0x360dde,_0x1a8710,'reason\x2011\x20abandoned');}}break;case'20':_0x20c573[_0xbc56('0x1c5')]+=0x1;_0x1e45e1['state']=0x14;_0x1e45e1['statedesc']=_0xbc56('0x1c6');_0x1e45e1[_0xbc56('0xf2')]+=0x1;_0x1e45e1[_0xbc56('0x102')]+=0x1;ami[_0xbc56('0x4d')](_0xbc56('0x1c7'),ut[_0xbc56('0x1b1')](_0x523c71,_0xbc56('0x1c8')));_0x16b917[_0xbc56('0xcc')](_0x1e45e1)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1c9')));if(_0x16b917[_0xbc56('0x1a0')](0x14,_0x523c71,_0x20c573)){if(_0x1e45e1[_0xbc56('0xf2')]>=_0x20c573['dialAgentRejectMaxRetry']){_0x16b917[_0xbc56('0xf5')](_0x1e45e1,_0x360dde,_0x1a8710,_0xbc56('0x1ca'));}else{_0x16b917[_0xbc56('0x106')](_0x1e45e1,_0x360dde,_0x1a8710,'reason\x2020\x20agentreject');}}break;default:_0x20c573[_0xbc56('0x69')]+=0x1;_0x1e45e1[_0xbc56('0xa8')]=0xc;_0x1e45e1[_0xbc56('0xa9')]=_0x358eeb['reason'];_0x16b917['createHistory'](_0x1e45e1)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1cb')));if(_0x16b917['checkRetriveMax'](_0x358eeb[_0xbc56('0x10f')],_0x523c71,_0x20c573)){if(_0x1e45e1[_0xbc56('0xed')]+_0x1e45e1[_0xbc56('0xee')]+_0x1e45e1['countnoanswerretry']+_0x1e45e1[_0xbc56('0xef')]+_0x1e45e1['countdropretry']+_0x1e45e1[_0xbc56('0xf1')]+_0x1e45e1[_0xbc56('0xeb')]+_0x1e45e1[_0xbc56('0xf2')]>=_0x20c573[_0xbc56('0x105')]){_0x16b917[_0xbc56('0x106')](_0x1e45e1,_0x360dde,_0x1a8710,_0x358eeb[_0xbc56('0x10f')]);}else{_0x16b917[_0xbc56('0xf5')](_0x1e45e1,_0x360dde,_0x1a8710,_0x358eeb[_0xbc56('0x10f')]);}}}});};Dialer[_0xbc56('0x1c')][_0xbc56('0x106')]=function(_0xb8f612,_0x3b5540,_0x5bb9b4,_0x2001fb){var _0x1f5038=new Final(_0xb8f612);_0x1f5038[_0xbc56('0xa8')]=0xf;_0x1f5038['statedesc']=_0xbc56('0x1cc');this['createStateFinal'](_0x1f5038,_0x3b5540,_0x5bb9b4,_0x2001fb);};Dialer[_0xbc56('0x1c')][_0xbc56('0xf5')]=function(_0x1317a3,_0x1b69f5,_0x4257b0,_0x5ac784){this[_0xbc56('0xca')](_0x1317a3)['then'](function(_0x23f60b){return _0x1b69f5(msgResponse(_0xbc56('0x1ac'),'Success',_0x5ac784));})[_0xbc56('0xb3')](function(_0x5ab424){return _0x4257b0(msgResponse(_0xbc56('0x1cd'),_0xbc56('0x148'),_0xbc56('0x1ce')));});};Dialer[_0xbc56('0x1c')][_0xbc56('0x9')]=function(_0x3d7dff){var _0x1aa9ba=this;var _0x1bcc4c=_0x3d7dff['dialPredictiveOptimizationPercentage']/0x64;var _0x26b7c3=_0x3d7dff[_0xbc56('0x119')]/(_0x3d7dff[_0xbc56('0x119')]+_0x3d7dff[_0xbc56('0x62')]);var _0x474caa=Math['round'](_0x3d7dff[_0xbc56('0x73')]*(_0x3d7dff[_0xbc56('0x1cf')]/0x64));var _0xf4a36e=Math[_0xbc56('0x1d0')](_0x3d7dff[_0xbc56('0x73')]*(_0x3d7dff[_0xbc56('0x1d1')]/0x64));var _0x2f8317=_0x3d7dff[_0xbc56('0x51')]+_0x3d7dff['talking'];var _0x3fe1b8=Math[_0xbc56('0x1d2')](_0x3d7dff[_0xbc56('0x76')]*_0x3d7dff[_0xbc56('0x77')]*_0x3d7dff[_0xbc56('0x70')]*_0x3d7dff['predictiveIntervalMultiplicativeFactor']);if(_[_0xbc56('0x3d')](_0x3d7dff[_0xbc56('0x2c')])){if(!_['isUndefined'](_0x3d7dff['startPredictive'])){_0x3d7dff[_0xbc56('0x2b')]=undefined;loggerPredictive['error'](_0xbc56('0x1d3'),_0xbc56('0x1d4'));}if(!_[_0xbc56('0x3d')](_0x3d7dff[_0xbc56('0x95')])){loggerPredictive['error'](_0xbc56('0x1d3'),_0xbc56('0x1d5'));clearInterval(_0x3d7dff[_0xbc56('0x95')]);_0x3d7dff[_0xbc56('0x95')]=undefined;}_0x3d7dff[_0xbc56('0x2c')]=moment()[_0xbc56('0x7c')](_0xbc56('0xfa'));loggerPredictive[_0xbc56('0x82')](_0x3d7dff[_0xbc56('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x3d7dff[_0xbc56('0x2c')]);this[_0xbc56('0x15e')](_0x3d7dff,0x1);}else if(ifInterval(_0x3d7dff['dialPredictiveInterval'],_0x3d7dff['startProgressive'])){this[_0xbc56('0x15e')](_0x3d7dff,0x1);loggerPredictiveCalls[_0xbc56('0x82')](_0xbc56('0x1d6'),_0x3d7dff[_0xbc56('0x2c')],_0x3d7dff[_0xbc56('0x40')]);_0x3d7dff[_0xbc56('0x76')]=0x0;_0x3d7dff['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x1bcc4c<_0x26b7c3&&_0x3d7dff[_0xbc56('0x1d7')]==='dropRate'){freeVariablesPredictive(_0x3d7dff);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x1d8'),'Dropped\x20calls\x20day',_0x26b7c3,_0xbc56('0x2c'),_0x3d7dff[_0xbc56('0x40')]);}else if(_0x3fe1b8<_0x3d7dff[_0xbc56('0x1d9')]&&_0x3d7dff['dialPredictiveOptimization']===_0xbc56('0x1da')){freeVariablesPredictive(_0x3d7dff);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x1db'),_0xbc56('0x1dc'),_0x3fe1b8,'Drop\x20in\x20this\x20interval',_0x3d7dff[_0xbc56('0x1d9')],'startProgressive',_0x3d7dff[_0xbc56('0x40')]);}else if(!ifInterval(_0x3d7dff[_0xbc56('0x1dd')],_0x3d7dff['startProgressive'])&&_[_0xbc56('0x3d')](_0x3d7dff['startPredictive'])&&!_['isUndefined'](_0x3d7dff['startProgressive'])){_0x3d7dff[_0xbc56('0x2b')]=moment()[_0xbc56('0x7c')](_0xbc56('0xfa'));loggerPredictive[_0xbc56('0x82')](_0x3d7dff[_0xbc56('0x40')],'started\x20in\x20predictive\x20at',_0x3d7dff['startPredictive']);this[_0xbc56('0xbe')](_0x3d7dff['dialPredictiveInterval'])[_0xbc56('0xb8')](this[_0xbc56('0x1de')](_0x3d7dff))[_0xbc56('0xb8')](mergeDataErlangB(_0x3d7dff))[_0xbc56('0xb8')](this[_0xbc56('0x1df')](_0x3d7dff))[_0xbc56('0xb3')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x3d7dff));}else if(!ifInterval(_0x3d7dff[_0xbc56('0x1dd')],_0x3d7dff[_0xbc56('0x2b')])){_0x3d7dff[_0xbc56('0x1d9')]=0x0;_0x3d7dff[_0xbc56('0x2b')]=moment()[_0xbc56('0x7c')](_0xbc56('0xfa'));loggerPredictive[_0xbc56('0x82')](_0x3d7dff[_0xbc56('0x40')],_0xbc56('0x1e0'),_0x3d7dff[_0xbc56('0x2b')]);clearInterval(_0x3d7dff['handlePredictive']);_0x3d7dff[_0xbc56('0x95')]=undefined;this['averageHandleTime'](_0x3d7dff[_0xbc56('0x1dd')])[_0xbc56('0xb8')](this[_0xbc56('0x1de')](_0x3d7dff))[_0xbc56('0xb8')](mergeDataErlangB(_0x3d7dff))['then'](this['startMethodPredictive'](_0x3d7dff))[_0xbc56('0xb3')](loggerCatchPredictive(_0xbc56('0x1e1'),_0x3d7dff));}else if(_0x3d7dff['predictiveIntervalAvailable']&&_0x2f8317<_0x3d7dff[_0xbc56('0x73')]-_0xf4a36e){freeVariablesPredictive(_0x3d7dff);loggerPredictive[_0xbc56('0x82')](_0x3d7dff[_0xbc56('0x40')],_0xbc56('0x1e2'),_0x2f8317,')\x20are\x20less\x20than\x20threshold\x20(',_0x3d7dff[_0xbc56('0x73')],'-',_0xf4a36e,'=',_0x3d7dff[_0xbc56('0x73')]-_0xf4a36e,')');}else if(_0x3d7dff[_0xbc56('0x73')]&&_0x2f8317>_0x3d7dff[_0xbc56('0x73')]+_0x474caa){freeVariablesPredictive(_0x3d7dff);loggerPredictive[_0xbc56('0x82')](_0x3d7dff[_0xbc56('0x40')],_0xbc56('0x1e2'),_0x2f8317,_0xbc56('0x1e3'),_0x3d7dff['predictiveIntervalAvailable'],'+',_0x474caa,'=',_0x3d7dff['predictiveIntervalAvailable']+_0x474caa,')');}};Dialer[_0xbc56('0x1c')][_0xbc56('0x1de')]=function(_0x6310b2){var _0x60a843=this;return function(_0x352f4a){return new BPromise(function(_0xb2121f,_0x58a4b0){_[_0xbc56('0x93')](_0x6310b2,_0x352f4a[0x0]);if(checkGetDataPredictive(_0x352f4a[0x0])){var _0x3030ff=_0x6310b2[_0xbc56('0x73')]=_0x6310b2[_0xbc56('0x55')]+_0x6310b2[_0xbc56('0x51')];var _0x305433=_0x6310b2[_0xbc56('0x1dd')]*0x3c;var _0x534e8e=_0x352f4a[0x0][_0xbc56('0x6c')]+_0x352f4a[0x0][_0xbc56('0x6b')];var _0x34f78f=(_0x352f4a[0x0]['predictiveIntervalAnsweredCalls']+_0x352f4a[0x0][_0xbc56('0x6e')]+_0x352f4a[0x0][_0xbc56('0x6d')])/_0x352f4a[0x0]['predictiveIntervalTotalCalls'];_0x6310b2[_0xbc56('0x70')]=_0x34f78f>0x0?_0x34f78f:0x1;switch(_0x6310b2[_0xbc56('0x1d7')]){case'dropRate':var _0x9b0192=_0x6310b2['dialPredictiveOptimizationPercentage']/0x64;return _0x60a843[_0xbc56('0x1e4')](_0x3030ff,_0x305433,_0x534e8e,_0x34f78f,_0x9b0192)[_0xbc56('0xb8')](function(_0x431db0){return _0xb2121f(_0x431db0);});case _0xbc56('0x1e5'):var _0x1bb38a=_0x6310b2[_0xbc56('0x1e6')]/0x64;return _0x60a843[_0xbc56('0x1e7')](_0x3030ff,_0x305433,_0x534e8e,_0x34f78f,_0x1bb38a)[_0xbc56('0xb8')](function(_0x3b0a8c){return _0xb2121f(_0x3b0a8c);});default:return _0x58a4b0(msgResponse(_0xbc56('0x1e8'),'Failure',_0xbc56('0x1e9')));}}else{return _0x58a4b0(msgResponse(_0xbc56('0x1e8'),_0xbc56('0x148'),_0xbc56('0x1ea')));}});};};Dialer['prototype'][_0xbc56('0x1eb')]=function(_0xc9532){var _0x3b40dc=this;return function(_0x31d288){return new BPromise(function(_0x228590,_0x29707b){_['merge'](_0xc9532,_0x31d288[0x0]);if(checkGetDataPredictive(_0x31d288[0x0])){loggerPredictive[_0xbc56('0x82')](JSON[_0xbc56('0x49')](_0x31d288[0x0]));if(_0xc9532[_0xbc56('0x1d7')]==='dropRate'){return _0x3b40dc['getVoiceQueueRtPauses'](_0xc9532['id'])[_0xbc56('0xb8')](function(_0x4efc66){var _0x5709c7=_0xc9532[_0xbc56('0x164')]-_0x4efc66[0x0][_0xbc56('0x1ec')];var _0x188064=_0xc9532[_0xbc56('0x1dd')]*0x3c;var _0x2d27e4=_0x31d288[0x0][_0xbc56('0x6c')]+_0x31d288[0x0][_0xbc56('0x6b')];var _0x5626fb=(_0x31d288[0x0][_0xbc56('0x6a')]+_0x31d288[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x31d288[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x31d288[0x0][_0xbc56('0x74')];var _0x51ac8c=_0xc9532['dialPredictiveOptimizationPercentage']/0x64;_0xc9532['predictiveIntervalPauses']=_0x4efc66[0x0]['outboundQueuePauses']||0x0;_0xc9532[_0xbc56('0x70')]=_0x5626fb>0x0?_0x5626fb:0x1;return _0x3b40dc[_0xbc56('0x1e4')](_0x5709c7,_0x188064,_0x2d27e4,_0x5626fb,_0x51ac8c);})[_0xbc56('0xb8')](function(_0x3f4eaa){return _0x228590(_0x3f4eaa);})[_0xbc56('0xb3')](function(_0x1b2d87){return _0x29707b(msgResponse('[CatchErlangB]','Failure',JSON[_0xbc56('0x49')](_0x1b2d87)));});}if(_0xc9532[_0xbc56('0x1d7')]===_0xbc56('0x1e5')){return _0x3b40dc[_0xbc56('0xc8')](_0xc9532['id'])[_0xbc56('0xb8')](function(_0x319f0d){var _0x42accf=_0xc9532[_0xbc56('0x164')]-_0x319f0d[0x0][_0xbc56('0x1ec')];var _0x58b7a2=_0xc9532[_0xbc56('0x1dd')]*0x3c;var _0x14a33a=_0x31d288[0x0][_0xbc56('0x6c')]+_0x31d288[0x0][_0xbc56('0x6b')];var _0x1498f6=(_0x31d288[0x0]['predictiveIntervalAnsweredCalls']+_0x31d288[0x0][_0xbc56('0x6e')]+_0x31d288[0x0][_0xbc56('0x6d')])/_0x31d288[0x0][_0xbc56('0x74')];var _0x1391b2=_0xc9532[_0xbc56('0x1e6')]/0x64;_0xc9532[_0xbc56('0x72')]=_0x319f0d[0x0][_0xbc56('0x1ec')]||0x0;_0xc9532[_0xbc56('0x70')]=_0x1498f6>0x0?_0x1498f6:0x1;return _0x3b40dc[_0xbc56('0x1e7')](_0x42accf,_0x58b7a2,_0x14a33a,_0x1498f6,_0x1391b2);})[_0xbc56('0xb8')](function(_0x37b73c){return _0x228590(_0x37b73c);})[_0xbc56('0xb3')](function(_0x1d0c92){return _0x29707b(msgResponse(_0xbc56('0x1ed'),'Failure',JSON[_0xbc56('0x49')](_0x1d0c92)));});}}else{return _0x29707b(msgResponse(_0xbc56('0x1e8'),_0xbc56('0x148'),'check\x20failure'));}});};};Dialer[_0xbc56('0x1c')][_0xbc56('0x1df')]=function(_0x5307b8){var _0x353483=this;return function(){var _0x50b302=0x0;var _0x5101a9=Math[_0xbc56('0x1d2')](_0x5307b8[_0xbc56('0x90')]*0x3e8);if(_0x5101a9>0x0){_0x5101a9=_0x5101a9<0x64?0x64:_0x5101a9;loggerPredictive[_0xbc56('0x82')](_0x5307b8['name'],'one\x20call\x20every:',_0x5101a9,'milliseconds');_0x5307b8[_0xbc56('0x95')]=setInterval(function(){_0x353483[_0xbc56('0x95')](_0x5307b8);loggerPredictiveCalls[_0xbc56('0x82')](_0xbc56('0x1ee'),_0x50b302+=0x1);},_0x5101a9);}else{loggerPredictive[_0xbc56('0x82')](_0x5307b8['name'],_0xbc56('0x1ef'));}};};Dialer[_0xbc56('0x1c')][_0xbc56('0x1f0')]=function(_0x2f616e,_0x3ab5d8){var _0x439957=this;return function(_0x2e27fc){if(_[_0xbc56('0x45')](_0x2e27fc)){if(_['isNil'](_0x3ab5d8['UserId'])||!_0x3ab5d8[_0xbc56('0x1f1')]){if(_0x2f616e[_0xbc56('0x5d')]===_0xbc56('0x8')){_0x2f616e[_0xbc56('0x132')]=_[_0xbc56('0x3d')](_0x2f616e['queueStatusComplete'])?!![]:_0x2f616e['queueStatusComplete'];var _0x7eb6ad=uuid['v4']();_0x439957[_0xbc56('0x28')][_0x7eb6ad]=new Action(_0x2f616e,_0x3ab5d8,_0x7eb6ad);loggerBooked[_0xbc56('0x82')](_0xbc56('0x1f2'),_0x7eb6ad,'queueStatusComplete:\x20',JSON[_0xbc56('0x49')](_0x2f616e[_0xbc56('0x132')]),_0xbc56('0x1f3'),_0x2f616e['name']);if(_0x2f616e[_0xbc56('0x132')]){_0x2f616e[_0xbc56('0x132')]=![];_0x439957['queueBooked'][_0x439957['actions'][_0x7eb6ad]['queue']]=[];ami[_0xbc56('0xb0')]({'actionid':_0x7eb6ad,'action':_0xbc56('0x1f4'),'queue':_0x2f616e[_0xbc56('0x40')]})[_0xbc56('0xb3')](function(_0x2cf9c7){_0x439957[_0xbc56('0xce')](_0x2f616e);_0x439957[_0xbc56('0xc1')]({'active':![],'ContactId':_0x439957[_0xbc56('0x28')][_0x7eb6ad]['ContactId'],'ListId':_0x439957[_0xbc56('0x28')][_0x7eb6ad][_0xbc56('0xd7')],'VoiceQueueId':_0x439957[_0xbc56('0x28')][_0x7eb6ad][_0xbc56('0xfb')]||undefined,'CampaignId':_0x439957[_0xbc56('0x28')][_0x7eb6ad][_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1f5')));delete _0x439957[_0xbc56('0x28')][_0x7eb6ad];});}else{loggerBooked[_0xbc56('0x82')]('[booked][checkContactBlack][else]',JSON[_0xbc56('0x49')](_0x2f616e[_0xbc56('0x132')]),_0xbc56('0x1f3'),_0x2f616e['name']);_0x439957[_0xbc56('0xce')](_0x2f616e);_0x439957['rescheduleContact']({'active':![],'ContactId':_0x439957[_0xbc56('0x28')][_0x7eb6ad][_0xbc56('0xd6')],'ListId':_0x439957['actions'][_0x7eb6ad][_0xbc56('0xd7')],'VoiceQueueId':_0x439957[_0xbc56('0x28')][_0x7eb6ad]['VoiceQueueId']||undefined,'CampaignId':_0x439957[_0xbc56('0x28')][_0x7eb6ad][_0xbc56('0x107')]||undefined})['catch'](loggerCatch(_0xbc56('0x1f5')));delete _0x439957[_0xbc56('0x28')][_0x7eb6ad];}}else{return _0x439957['actionOriginate'](_0x2f616e,_0x3ab5d8);}}else{if(getDiff(_0x3ab5d8[_0xbc56('0x1f6')])<_0x2f616e[_0xbc56('0x1f7')]*0x3c){if(_0x3ab5d8[_0xbc56('0x1f8')]&&!_0x3ab5d8[_0xbc56('0x1f8')][_0xbc56('0x1f9')]){_0x439957[_0xbc56('0x21')][_0xbc56('0x133')](_0x3ab5d8['id'])[_0xbc56('0x1f')](function(){_0x439957['updateOriginated'](_0x2f616e);});}else{_0x439957[_0xbc56('0xc3')]({'active':![]},_0x3ab5d8['id'],0x1)[_0xbc56('0x1f')](function(){console[_0xbc56('0x1fa')](_0xbc56('0x1fb'));_0x439957[_0xbc56('0xce')](_0x2f616e);});}}else{_0x2f616e[_0xbc56('0x68')]+=0x1;_0x439957[_0xbc56('0xce')](_0x2f616e);if(_0x2f616e[_0xbc56('0x1fc')]){_0x439957[_0xbc56('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ab5d8[_0xbc56('0xd6')],'ListId':_0x3ab5d8[_0xbc56('0xd7')],'VoiceQueueId':_0x3ab5d8[_0xbc56('0xfb')]||undefined,'CampaignId':_0x3ab5d8[_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1fd')));_0x439957['createHistory'](createObjHistory(_0x2f616e,_0x3ab5d8,_0xbc56('0x1fe'),0x17,_0xbc56('0x1ff')))[_0xbc56('0xb3')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x439957[_0xbc56('0xd4')](createObjHistory(_0x2f616e,_0x3ab5d8,_0xbc56('0x200'),0x16,_0xbc56('0x201')),_0xbc56('0x202'),_0xbc56('0x203'));}}}}else{_0x2f616e['outboundBlacklistCallsDay']+=0x1;_0x439957[_0xbc56('0xd4')](createObjHistory(_0x2f616e,_0x3ab5d8,_0xbc56('0x204'),0xd,_0xbc56('0x205')),_0xbc56('0x206'),_0xbc56('0x207'));throw _0xbc56('0x208');}};};Dialer['prototype'][_0xbc56('0x163')]=function(_0xf84f2a){var _0x4c83de=this;var _0x3085d3=[];var _0x1b3db1=_0xf84f2a[_0xbc56('0x209')]-_0xf84f2a[_0xbc56('0x75')]-_0xf84f2a[_0xbc56('0x20a')];emitCampaignSummary(_0xf84f2a);if(_0x1b3db1>0x0){if(_0x1b3db1>this[_0xbc56('0x26')]){_0x1b3db1=this['maxNumberOriginate'];}_0xf84f2a[_0xbc56('0x20a')]+=_0x1b3db1;this[_0xbc56('0xc7')](_0xf84f2a['id'],_0x1b3db1,_0xf84f2a[_0xbc56('0x20b')])[_0xbc56('0xb8')](function(_0x1832b2){_0xf84f2a[_0xbc56('0x20a')]-=_0x1b3db1;_0xf84f2a[_0xbc56('0x20a')]=_0xf84f2a[_0xbc56('0x20a')]>0x0?_0xf84f2a[_0xbc56('0x20a')]:0x0;if(!checkContactEmpty(_0x1832b2)){_0xf84f2a[_0xbc56('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xbc56('0x82')]('[getContactCampaign2][Empty]'+_0xf84f2a[_0xbc56('0x40')]);}else{_0xf84f2a['originated']+=_0x1832b2[_0xbc56('0x14f')];_0xf84f2a['message']=_0xbc56('0x20c');for(var _0x5fb8df=0x0;_0x5fb8df<_0x1832b2[_0xbc56('0x14f')];_0x5fb8df+=0x1){_0xf84f2a[_0xbc56('0x20d')]+=0x1;if(_[_0xbc56('0xaf')](_0x1832b2[_0x5fb8df])||_[_0xbc56('0xaf')](_0x1832b2[_0x5fb8df]['Contact'])||_['isNil'](_0x1832b2[_0x5fb8df][_0xbc56('0x170')]['phone'])){_0x4c83de['emptyContact'](_0xbc56('0x20e'),_0xf84f2a,_0x1832b2[_0x5fb8df]);}else{_0x4c83de[_0xbc56('0xbc')](_['pick'](_0x1832b2[_0x5fb8df],[_0xbc56('0x107'),_0xbc56('0x20f')]))[_0xbc56('0xb8')](_0x4c83de[_0xbc56('0x1f0')](_0xf84f2a,_0x1832b2[_0x5fb8df]))[_0xbc56('0xb3')](_0x4c83de[_0xbc56('0xd1')](_0xbc56('0x210'),_0xf84f2a));}}}})[_0xbc56('0xb3')](loggerGetContactDialer(_0xbc56('0x211'),_0xf84f2a,_0x1b3db1));}};Dialer[_0xbc56('0x1c')][_0xbc56('0x15e')]=function(_0x5b67ab,_0x47200e){var _0x346f2c=this;var _0x438f19=[];var _0x1e37db=_0x47200e>=0x1?_0x47200e:0x1;var _0x408eb5=[];if(_0x5b67ab[_0xbc56('0x5d')]===_0xbc56('0x8')){_0x1e37db=0x1;}var _0xa24d29=Math[_0xbc56('0x1d2')](_0x5b67ab[_0xbc56('0x51')]*_0x1e37db)-_0x5b67ab['originated']-_0x5b67ab[_0xbc56('0x20a')];emitVoiceQueueSummary(_0x5b67ab);if(_0x5b67ab[_0xbc56('0x212')]>0x0){var _0x2024bf=_0x5b67ab[_0xbc56('0x212')]-_0x5b67ab['originated']-_0x5b67ab[_0xbc56('0x55')]-_0x5b67ab[_0xbc56('0x20a')]-_0x5b67ab[_0xbc56('0x52')];if(_0xa24d29>_0x2024bf){_0xa24d29=_0x2024bf;}}if(_0xa24d29>0x0){if(_0x5b67ab[_0xbc56('0x5d')]===_0xbc56('0x8')){_0xa24d29=0x1;}if(_0xa24d29>this[_0xbc56('0x26')]){_0xa24d29=this['maxNumberOriginate'];}_0x5b67ab[_0xbc56('0x20a')]+=_0xa24d29;for(var _0x27a5f5 in this[_0xbc56('0x24')]){if(this[_0xbc56('0x24')][_0xbc56('0x9b')](_0x27a5f5)){if(this[_0xbc56('0x24')][_0x27a5f5][_0xbc56('0xa8')]===_0xbc56('0x213')&&this['agents'][_0x27a5f5][_0xbc56('0xb1')]===_0xbc56('0xdd')){_0x438f19[_0xbc56('0x12e')](this[_0xbc56('0x24')][_0x27a5f5]['id']);}}}this[_0xbc56('0xc5')](_0x5b67ab['id'],_0x438f19,_0xa24d29,_0x5b67ab[_0xbc56('0x20b')])['then'](function(_0x27e011){_0x5b67ab[_0xbc56('0x20a')]-=_0xa24d29;_0x5b67ab[_0xbc56('0x20a')]=_0x5b67ab[_0xbc56('0x20a')]>0x0?_0x5b67ab[_0xbc56('0x20a')]:0x0;if(!checkContactEmpty(_0x27e011)){_0x346f2c[_0xbc56('0xb6')](_0x5b67ab)[_0xbc56('0xb8')](sendMessageReschedule(_0x5b67ab))[_0xbc56('0xb3')](loggerCatch('[countReScheduled]\x20'));}else{_0x5b67ab[_0xbc56('0x75')]+=_0x27e011[_0xbc56('0x14f')];_0x5b67ab['message']=_0x5b67ab[_0xbc56('0x5d')]==='booked'?_0xbc56('0x178'):_0xbc56('0x20c');for(var _0x4ad474=0x0;_0x4ad474<_0x27e011[_0xbc56('0x14f')];_0x4ad474+=0x1){if(_['isNil'](_0x27e011[_0x4ad474])||_[_0xbc56('0xaf')](_0x27e011[_0x4ad474][_0xbc56('0x170')])||_[_0xbc56('0xaf')](_0x27e011[_0x4ad474]['Contact']['phone'])){_0x346f2c['emptyContact'](_0xbc56('0x20e'),_0x5b67ab,_0x27e011[_0x4ad474]);}else{_0x346f2c['checkIsBlackList'](_[_0xbc56('0xd5')](_0x27e011[_0x4ad474],['VoiceQueueId',_0xbc56('0x20f')]))['then'](_0x346f2c[_0xbc56('0x1f0')](_0x5b67ab,_0x27e011[_0x4ad474]))[_0xbc56('0xb3')](_0x346f2c[_0xbc56('0xd1')]('[actionOriginate]\x20',_0x5b67ab));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x5b67ab,_0xa24d29));}};Dialer[_0xbc56('0x1c')][_0xbc56('0x95')]=function(_0x2f85da){var _0x22669d=this;if(_0x2f85da[_0xbc56('0x212')]>0x0){var _0x130f1d=_0x2f85da[_0xbc56('0x212')]-_0x2f85da[_0xbc56('0x75')]-_0x2f85da[_0xbc56('0x55')];if(_0x130f1d>0x0){this['tryOriginatePredictive'](_0x2f85da);}else{loggerPredictiveCalls[_0xbc56('0x82')](_0xbc56('0x214'));}}else{this[_0xbc56('0x215')](_0x2f85da);}};Dialer[_0xbc56('0x1c')]['tryOriginatePredictive']=function(_0xc25c75){var _0x14e305=this;var _0x553f56=[];_0xc25c75[_0xbc56('0x75')]+=0x1;for(var _0x176204 in this[_0xbc56('0x24')]){if(this[_0xbc56('0x24')]['hasOwnProperty'](_0x176204)){if(this[_0xbc56('0x24')][_0x176204][_0xbc56('0xa8')]===_0xbc56('0x213')&&this[_0xbc56('0x24')][_0x176204]['status']===_0xbc56('0xdd')){_0x553f56['push'](this['agents'][_0x176204]['id']);}}}this[_0xbc56('0xc5')](_0xc25c75['id'],_0x553f56,0x1,_0xc25c75[_0xbc56('0x20b')])[_0xbc56('0xb8')](function(_0x39f419){if(!checkContactEmpty(_0x39f419)){checkContactLowerLimitOriginate(_0xc25c75,0x1,0x0);_0x14e305[_0xbc56('0xb6')](_0xc25c75)[_0xbc56('0xb8')](sendMessageReschedule(_0xc25c75))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xb9')));}else{_0xc25c75[_0xbc56('0x3e')]=_0xbc56('0x20c');if(_['isNil'](_0x39f419[0x0])||_[_0xbc56('0xaf')](_0x39f419[0x0][_0xbc56('0x170')])||_[_0xbc56('0xaf')](_0x39f419[0x0][_0xbc56('0x170')][_0xbc56('0x16f')])){_0x14e305[_0xbc56('0xd2')](_0xbc56('0x20e'),_0xc25c75,_0x39f419[0x0]);}else{_0x14e305[_0xbc56('0xba')](_[_0xbc56('0xd5')](_0x39f419[0x0],[_0xbc56('0xfb'),_0xbc56('0x20f')]))[_0xbc56('0xb8')](_0x14e305[_0xbc56('0x1f0')](_0xc25c75,_0x39f419[0x0]))[_0xbc56('0xb3')](_0x14e305['loggerHandler'](_0xbc56('0x216'),_0xc25c75));}}})['catch'](loggerGetContactDialer(_0xbc56('0x217'),_0xc25c75,0x1));emitVoiceQueueSummary(_0xc25c75);};Dialer['prototype'][_0xbc56('0x1e4')]=function(_0x2e5be7,_0xaf54e8,_0x4547df,_0x265300,_0x2f54e3,_0x5c2f3d){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0xbc56('0x218'),_0x2e5be7);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x219'),_0xaf54e8);loggerPredictive['info'](_0xbc56('0x21a'),_0x4547df);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x21b'),_0x265300);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x21c'),_0x2f54e3);loggerPredictive[_0xbc56('0x82')]('---------------------------');return new BPromise(function(_0x4c0573,_0x4c597b){if(_0x2e5be7<=0x0||isNaN(_0x2e5be7)){return _0x4c597b(msgResponse(_0xbc56('0x21d'),'Error',_0xbc56('0x21e')+_0x2e5be7));}if(_0x4547df<=0x0||isNaN(_0x4547df)){return _0x4c597b(msgResponse(_0xbc56('0x21d'),_0xbc56('0x48'),'Ts\x20=\x20'+_0x4547df));}if(_0x265300<=0x0||isNaN(_0x265300)){return _0x4c597b(msgResponse(_0xbc56('0x21d'),_0xbc56('0x48'),'p\x20=\x20'+_0x265300));}if(_0xaf54e8<=0x0||isNaN(_0xaf54e8)){return _0x4c597b(msgResponse(_0xbc56('0x21d'),_0xbc56('0x48'),_0xbc56('0x21f')+_0xaf54e8));}if(_0x2f54e3<=0x0||isNaN(_0x2f54e3)){return _0x4c597b(msgResponse(_0xbc56('0x21d'),'Error','Amax\x20=\x20'+_0x2f54e3));}_0x5c2f3d=_0x5c2f3d||0x0;var _0x5175e7=0x1/_0x4547df;var _0x29c03a=0x0;var _0x59c798=0x0;var _0x14c69f=0x0;var _0x4301a9=0x0;for(var _0x2b476e=0x0;_0x14c69f<_0x2f54e3;_0x2b476e+=0x1){_0x59c798=_0x2b476e/_0xaf54e8;_0x29c03a=(_0x265300*_0x59c798+_0x5c2f3d)/_0x5175e7;_0x14c69f=erlangb(_0x29c03a,_0x2e5be7);_0x4301a9=_0x29c03a/_0x2e5be7*(0x1-erlangb(_0x29c03a,_0x2e5be7));}return _0x4c0573({'erlangCalls':_0x2b476e,'erlangCallToSecond':_0xaf54e8/_0x2b476e,'erlangAbandonmentRate':_0x14c69f,'erlangBusyFactor':_0x4301a9});});};Dialer['prototype'][_0xbc56('0x1e7')]=function(_0x5d37c2,_0x35f525,_0x36b4ab,_0x425002,_0x3cb6a1,_0x570606){loggerPredictive['info'](_0xbc56('0x220'));loggerPredictive[_0xbc56('0x82')]('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',_0x5d37c2);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x219'),_0x35f525);loggerPredictive['info'](_0xbc56('0x21a'),_0x36b4ab);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x21b'),_0x425002);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',_0x3cb6a1);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x88'));return new BPromise(function(_0x171676,_0x3fbd70){if(_0x5d37c2<=0x0||isNaN(_0x5d37c2)){return _0x3fbd70(msgResponse(_0xbc56('0x221'),'Error','m\x20=\x20'+_0x5d37c2));}if(_0x36b4ab<=0x0||isNaN(_0x36b4ab)){return _0x3fbd70(msgResponse(_0xbc56('0x221'),_0xbc56('0x48'),'Ts\x20=\x20'+_0x36b4ab));}if(_0x425002<=0x0||isNaN(_0x425002)){return _0x3fbd70(msgResponse(_0xbc56('0x221'),'Error',_0xbc56('0x222')+_0x425002));}if(_0x35f525<=0x0||isNaN(_0x35f525)){return _0x3fbd70(msgResponse(_0xbc56('0x221'),'Error',_0xbc56('0x21f')+_0x35f525));}if(_0x3cb6a1<=0x0||isNaN(_0x3cb6a1)){return _0x3fbd70(msgResponse(_0xbc56('0x221'),_0xbc56('0x48'),_0xbc56('0x223')+_0x3cb6a1));}_0x570606=_0x570606||0x0;var _0x1694bc=0x1/_0x36b4ab;var _0x1b4f92=0x0;var _0x4afaa9=0x0;var _0x310d1a=0x0;var _0x53960e=0x0;for(var _0x1c8521=0x0;_0x53960e<_0x3cb6a1;_0x1c8521+=0x1){_0x4afaa9=_0x1c8521/_0x35f525;_0x1b4f92=(_0x425002*_0x4afaa9+_0x570606)/_0x1694bc;_0x310d1a=erlangb(_0x1b4f92,_0x5d37c2);_0x53960e=_0x1b4f92/_0x5d37c2*(0x1-erlangb(_0x1b4f92,_0x5d37c2));}return _0x171676({'erlangCalls':_0x1c8521,'erlangCallToSecond':_0x35f525/_0x1c8521,'erlangAbandonmentRate':_0x310d1a,'erlangBusyFactor':_0x53960e});});};module[_0xbc56('0x224')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 01fc26c..94a880d 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 _0x969d=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue'];(function(_0x23ac30,_0x2a1d00){var _0x208fec=function(_0x23213a){while(--_0x23213a){_0x23ac30['push'](_0x23ac30['shift']());}};_0x208fec(++_0x2a1d00);}(_0x969d,0xd1));var _0xd969=function(_0x1042ae,_0x464a59){_0x1042ae=_0x1042ae-0x0;var _0x23eccd=_0x969d[_0x1042ae];return _0x23eccd;};'use strict';var util=require(_0xd969('0x0'));var _=require(_0xd969('0x1'));var moment=require(_0xd969('0x2'));function getSeconds(_0x1d38cc,_0x466c66){var _0x1c82cc=moment(_0x1d38cc)[_0xd969('0x3')](0x0);var _0x2a0a3f=moment(_0x466c66)[_0xd969('0x3')](0x0);return _0x1c82cc[_0xd969('0x4')](_0x2a0a3f,_0xd969('0x5'));}function QueueCallerAbandon(_0x8c56c7,_0x4014e7){this['scheduledat']=_0x8c56c7[_0xd969('0x6')];this[_0xd969('0x7')]=_0x8c56c7[_0xd969('0x7')];this[_0xd969('0x8')]=_0x8c56c7['type']===_0xd969('0x9')?_0xd969('0xa'):_0x8c56c7['type'];this['countbusyretry']=_0x8c56c7['countbusyretry'];this[_0xd969('0xb')]=_0x8c56c7[_0xd969('0xb')];this[_0xd969('0xc')]=_0x8c56c7[_0xd969('0xc')];this[_0xd969('0xd')]=_0x8c56c7['countbusyretry']+_0x8c56c7['countcongestionretry']+_0x8c56c7[_0xd969('0xc')]+_0x8c56c7[_0xd969('0xe')]+_0x8c56c7[_0xd969('0xf')]+_0x8c56c7[_0xd969('0x10')]+_0x8c56c7[_0xd969('0x11')]+_0x8c56c7['countagentrejectretry'];this[_0xd969('0xe')]=_0x8c56c7[_0xd969('0xe')];this['countdropretry']=_0x8c56c7[_0xd969('0xf')];this[_0xd969('0x10')]=_0x8c56c7[_0xd969('0x10')];this[_0xd969('0x11')]=_0x8c56c7['countmachineretry'];this[_0xd969('0x12')]=_0x8c56c7[_0xd969('0x12')];this[_0xd969('0x13')]=_0x4014e7[_0xd969('0x13')];this[_0xd969('0x14')]=_0x8c56c7[_0xd969('0x15')];this[_0xd969('0x16')]=_0x8c56c7[_0xd969('0x17')];this[_0xd969('0x18')]=_0x8c56c7[_0xd969('0x18')];this[_0xd969('0x19')]=_0x8c56c7[_0xd969('0x19')];this[_0xd969('0x1a')]=_0x8c56c7['droptime'];this[_0xd969('0x1b')]=this[_0xd969('0x1a')];this[_0xd969('0x1c')]=getSeconds(_0x8c56c7['responsetime'],_0x8c56c7[_0xd969('0x18')]);this[_0xd969('0x1d')]=getSeconds(this['droptime'],_0x8c56c7['responsetime']);this[_0xd969('0x1e')]=0x0;this[_0xd969('0xa')]=_0x4014e7[_0xd969('0xa')];this['membername']=_0x4014e7[_0xd969('0x1f')];this[_0xd969('0x20')]=_0x4014e7[_0xd969('0x20')];this['callback']=_0x8c56c7[_0xd969('0x21')];this[_0xd969('0x22')]=_0x8c56c7[_0xd969('0x22')];this[_0xd969('0x23')]=_0x8c56c7['callbackat'];this[_0xd969('0x24')]=_0x8c56c7[_0xd969('0x24')];this[_0xd969('0x25')]=_0x8c56c7[_0xd969('0x25')];this[_0xd969('0x26')]=_0x8c56c7[_0xd969('0x26')];this[_0xd969('0x27')]=_0x8c56c7[_0xd969('0x27')];this['VoiceQueueId']=_0x8c56c7[_0xd969('0x28')];this['CampaignId']=_0x8c56c7['CampaignId'];this[_0xd969('0x29')]=_0x8c56c7[_0xd969('0x29')]||'';this[_0xd969('0x2a')]=_0x8c56c7[_0xd969('0x2a')]||'';}module[_0xd969('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0x902e=['moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','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','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash'];(function(_0x30f6c1,_0x2ab231){var _0x52bcd0=function(_0x2bbdd6){while(--_0x2bbdd6){_0x30f6c1['push'](_0x30f6c1['shift']());}};_0x52bcd0(++_0x2ab231);}(_0x902e,0x7c));var _0xe902=function(_0x224ab3,_0x12a2f6){_0x224ab3=_0x224ab3-0x0;var _0x588969=_0x902e[_0x224ab3];return _0x588969;};'use strict';var util=require(_0xe902('0x0'));var _=require(_0xe902('0x1'));var moment=require(_0xe902('0x2'));function getSeconds(_0x51e768,_0x4e5313){var _0x81ccac=moment(_0x51e768)['milliseconds'](0x0);var _0x5d2d21=moment(_0x4e5313)[_0xe902('0x3')](0x0);return _0x81ccac[_0xe902('0x4')](_0x5d2d21,_0xe902('0x5'));}function QueueCallerAbandon(_0x12ea8b,_0xc42a3e){this[_0xe902('0x6')]=_0x12ea8b[_0xe902('0x6')];this[_0xe902('0x7')]=_0x12ea8b[_0xe902('0x7')];this[_0xe902('0x8')]=_0x12ea8b['type']==='outbound'?'queue':_0x12ea8b[_0xe902('0x7')];this['countbusyretry']=_0x12ea8b[_0xe902('0x9')];this[_0xe902('0xa')]=_0x12ea8b['countcongestionretry'];this['countnoanswerretry']=_0x12ea8b['countnoanswerretry'];this['countglobal']=_0x12ea8b[_0xe902('0x9')]+_0x12ea8b[_0xe902('0xa')]+_0x12ea8b['countnoanswerretry']+_0x12ea8b[_0xe902('0xb')]+_0x12ea8b[_0xe902('0xc')]+_0x12ea8b[_0xe902('0xd')]+_0x12ea8b[_0xe902('0xe')]+_0x12ea8b[_0xe902('0xf')];this[_0xe902('0xb')]=_0x12ea8b[_0xe902('0xb')];this[_0xe902('0xc')]=_0x12ea8b[_0xe902('0xc')];this[_0xe902('0xd')]=_0x12ea8b[_0xe902('0xd')];this[_0xe902('0xe')]=_0x12ea8b[_0xe902('0xe')];this[_0xe902('0xf')]=_0x12ea8b[_0xe902('0xf')];this[_0xe902('0x10')]=_0xc42a3e[_0xe902('0x10')];this[_0xe902('0x11')]=_0x12ea8b[_0xe902('0x12')];this[_0xe902('0x13')]=_0x12ea8b[_0xe902('0x14')];this['starttime']=_0x12ea8b[_0xe902('0x15')];this[_0xe902('0x16')]=_0x12ea8b[_0xe902('0x16')];this[_0xe902('0x17')]=_0x12ea8b['droptime'];this[_0xe902('0x18')]=this[_0xe902('0x17')];this[_0xe902('0x19')]=getSeconds(_0x12ea8b[_0xe902('0x16')],_0x12ea8b['starttime']);this[_0xe902('0x1a')]=getSeconds(this[_0xe902('0x17')],_0x12ea8b['responsetime']);this[_0xe902('0x1b')]=0x0;this[_0xe902('0x1c')]=_0xc42a3e['queue'];this[_0xe902('0x1d')]=_0xc42a3e[_0xe902('0x1e')];this[_0xe902('0x1f')]=_0xc42a3e[_0xe902('0x1f')];this[_0xe902('0x20')]=_0x12ea8b[_0xe902('0x20')];this[_0xe902('0x21')]=_0x12ea8b[_0xe902('0x21')];this[_0xe902('0x22')]=_0x12ea8b[_0xe902('0x22')];this[_0xe902('0x23')]=_0x12ea8b[_0xe902('0x23')];this['ContactId']=_0x12ea8b['ContactId'];this[_0xe902('0x24')]=_0x12ea8b['ListId'];this['UserId']=_0x12ea8b['UserId'];this[_0xe902('0x25')]=_0x12ea8b[_0xe902('0x25')];this[_0xe902('0x26')]=_0x12ea8b[_0xe902('0x26')];this[_0xe902('0x27')]=_0x12ea8b[_0xe902('0x27')]||'';this[_0xe902('0x28')]=_0x12ea8b[_0xe902('0x28')]||'';}module[_0xe902('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 9b80e02..29d9f77 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 _0x81dc=['lodash','moment','uniqueid','format','tech','Trunk','name','fax','headerinfo','path','AttachmentId','exports'];(function(_0x14aee9,_0x596a94){var _0x6de2f7=function(_0x4561e3){while(--_0x4561e3){_0x14aee9['push'](_0x14aee9['shift']());}};_0x6de2f7(++_0x596a94);}(_0x81dc,0xf0));var _0xc81d=function(_0x48cb1f,_0x5ca68d){_0x48cb1f=_0x48cb1f-0x0;var _0x172c4d=_0x81dc[_0x48cb1f];return _0x172c4d;};'use strict';var util=require('util');var _=require(_0xc81d('0x0'));var moment=require(_0xc81d('0x1'));function Action(_0x3182ea,_0x16c357,_0x37eacb){this[_0xc81d('0x2')]=_0x3182ea||undefined;this['channel']=util[_0xc81d('0x3')]('%s/%s/%s',_0x16c357[_0xc81d('0x4')],_0x16c357[_0xc81d('0x5')][_0xc81d('0x6')],_0x37eacb[_0xc81d('0x7')]);this['localstationid']=_0x16c357['localstationid'];this[_0xc81d('0x8')]=_0x16c357['headerinfo'];this[_0xc81d('0x9')]=_0x37eacb[_0xc81d('0x9')];this['AttachmentId']=_0x37eacb[_0xc81d('0xa')];}module[_0xc81d('0xb')]=Action; \ No newline at end of file +var _0xe57f=['headerinfo','path','AttachmentId','exports','lodash','moment','uniqueid','channel','%s/%s/%s','tech','Trunk','name','fax','localstationid'];(function(_0x292162,_0x29b023){var _0x189258=function(_0x1365ea){while(--_0x1365ea){_0x292162['push'](_0x292162['shift']());}};_0x189258(++_0x29b023);}(_0xe57f,0x74));var _0xfe57=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe57f[_0x4565bf];return _0x5610ba;};'use strict';var util=require('util');var _=require(_0xfe57('0x0'));var moment=require(_0xfe57('0x1'));function Action(_0x25c382,_0x302c1a,_0x295bb7){this[_0xfe57('0x2')]=_0x25c382||undefined;this[_0xfe57('0x3')]=util['format'](_0xfe57('0x4'),_0x302c1a[_0xfe57('0x5')],_0x302c1a[_0xfe57('0x6')][_0xfe57('0x7')],_0x295bb7[_0xfe57('0x8')]);this[_0xfe57('0x9')]=_0x302c1a['localstationid'];this[_0xfe57('0xa')]=_0x302c1a['headerinfo'];this[_0xfe57('0xb')]=_0x295bb7[_0xfe57('0xb')];this[_0xfe57('0xc')]=_0x295bb7[_0xfe57('0xc')];}module[_0xfe57('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 d329298..1d20422 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 _0xa31c=['./util/gs','../../../config/logger','fax','./rpcDb','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','faxstatus','syncFaxStatus','hangup','originateresponse','syncOriginateResponse','context','hasOwnProperty','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','actions','info','syncVarSet','variable','value','prototype','channelstatedesc','operation','filename','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','error','stringify','catch','\x20receiveFax\x20','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','then','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','status','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','moment','tiff2pdf'];(function(_0x1dac60,_0xcd3a9d){var _0x1dbef2=function(_0x29bc76){while(--_0x29bc76){_0x1dac60['push'](_0x1dac60['shift']());}};_0x1dbef2(++_0xcd3a9d);}(_0xa31c,0x13a));var _0xca31=function(_0x27fdcc,_0x421cb5){_0x27fdcc=_0x27fdcc-0x0;var _0x17c2de=_0xa31c[_0x27fdcc];return _0x17c2de;};'use strict';var util=require(_0xca31('0x0'));var _=require(_0xca31('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xca31('0x2'));var path=require('path');var tiff2pdf=require(_0xca31('0x3'));var gs=require(_0xca31('0x4'));var logger=require(_0xca31('0x5'))(_0xca31('0x6'));var ami=require('../ami');var rpcDb=require(_0xca31('0x7'));var Channel=require('./channel');var ut=require(_0xca31('0x8'));var Action=require('./action');var faxAccount=require(_0xca31('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xca31('0xa'));function Fax(_0x4695e5){this[_0xca31('0xb')]={};this[_0xca31('0xc')]=_0x4695e5[_0xca31('0xc')];this[_0xca31('0xd')]=_0x4695e5['trunks'];this['actions']={};ami['on'](_0xca31('0xe'),this[_0xca31('0xf')][_0xca31('0x10')](this));ami['on'](_0xca31('0x11'),this['syncVarSet'][_0xca31('0x10')](this));ami['on'](_0xca31('0x12'),this[_0xca31('0x13')][_0xca31('0x10')](this));ami['on']('newexten',this['syncNewExten'][_0xca31('0x10')](this));ami['on'](_0xca31('0x14'),this[_0xca31('0x15')][_0xca31('0x10')](this));ami['on']('receivefax',this['syncReceiveFax'][_0xca31('0x10')](this));ami['on'](_0xca31('0x16'),this['syncHangup'][_0xca31('0x10')](this));ami['on'](_0xca31('0x17'),this[_0xca31('0x18')][_0xca31('0x10')](this));}Fax['prototype'][_0xca31('0xf')]=function(_0x4c5ebb){if(_0x4c5ebb[_0xca31('0x19')]==='from-voip-provider'){for(var _0x400e60 in this[_0xca31('0xc')]){if(this[_0xca31('0xc')][_0xca31('0x1a')](_0x400e60)){if(_0x4c5ebb['exten']===this[_0xca31('0xc')][_0x400e60][_0xca31('0x1b')]){this[_0xca31('0xb')][_0x4c5ebb[_0xca31('0x1c')]]={};this[_0xca31('0xb')][_0x4c5ebb[_0xca31('0x1c')]]['channel']=_0x4c5ebb[_0xca31('0x1d')];this[_0xca31('0xb')][_0x4c5ebb[_0xca31('0x1c')]]['id']=this[_0xca31('0xc')][_0x400e60]['id'];this[_0xca31('0xb')][_0x4c5ebb[_0xca31('0x1c')]][_0xca31('0x1e')]=this[_0xca31('0xc')][_0x400e60][_0xca31('0x1e')];logger['info'](_0x4c5ebb['uniqueid'],_0xca31('0x1f'));}}}}if(this[_0xca31('0x20')][_0x4c5ebb['uniqueid']]){this[_0xca31('0xb')][_0x4c5ebb['uniqueid']]={};this['channels'][_0x4c5ebb[_0xca31('0x1c')]][_0xca31('0x1d')]=_0x4c5ebb[_0xca31('0x1d')];logger[_0xca31('0x21')](_0x4c5ebb[_0xca31('0x1c')],_0xca31('0x1f'));}};Fax['prototype'][_0xca31('0x22')]=function(_0x119956){if(this[_0xca31('0xb')][_0x119956[_0xca31('0x1c')]]){for(var _0x1956ed in _0x119956['variable']){if(_0x119956[_0xca31('0x23')][_0xca31('0x1a')](_0x1956ed)){this[_0xca31('0xb')][_0x119956[_0xca31('0x1c')]][_0x1956ed]=_0x119956[_0xca31('0x24')];}}}};Fax[_0xca31('0x25')][_0xca31('0x13')]=function(_0x474b49){if(this['channels'][_0x474b49[_0xca31('0x1c')]]){this['channels'][_0x474b49['uniqueid']]['channelstate']=_0x474b49['channelstate'];this[_0xca31('0xb')][_0x474b49[_0xca31('0x1c')]][_0xca31('0x26')]=_0x474b49['channelstatedesc'];}};Fax[_0xca31('0x25')]['syncNewExten']=function(_0xe6ba5){if(this['channels'][_0xe6ba5[_0xca31('0x1c')]]){for(var _0xa4e915 in _0xe6ba5[_0xca31('0x23')]){if(_0xe6ba5[_0xca31('0x23')][_0xca31('0x1a')](_0xa4e915)){this[_0xca31('0xb')][_0xe6ba5['uniqueid']][_0xa4e915]=_0xe6ba5[_0xca31('0x24')];}}}};Fax['prototype'][_0xca31('0x15')]=function(_0x43a58f){if(this[_0xca31('0xb')][_0x43a58f['uniqueid']]){this[_0xca31('0xb')][_0x43a58f[_0xca31('0x1c')]]['operation']=_0x43a58f[_0xca31('0x27')];this[_0xca31('0xb')][_0x43a58f[_0xca31('0x1c')]]['status']=_0x43a58f['status'];this[_0xca31('0xb')][_0x43a58f[_0xca31('0x1c')]][_0xca31('0x1b')]=_0x43a58f[_0xca31('0x1b')];this[_0xca31('0xb')][_0x43a58f[_0xca31('0x1c')]][_0xca31('0x28')]=_0x43a58f[_0xca31('0x28')];logger[_0xca31('0x21')](_0x43a58f['uniqueid'],'\x20syncFaxStatus\x20');}};Fax['prototype']['syncReceiveFax']=function(_0x504956){var _0x282179=this;if(this[_0xca31('0xb')][_0x504956[_0xca31('0x1c')]]){var _0x1b31eb=this['channels'][_0x504956[_0xca31('0x1c')]]['id'];this[_0xca31('0xb')][_0x504956[_0xca31('0x1c')]]['remotestationid']=_0x504956['remotestationid'];this[_0xca31('0xb')][_0x504956['uniqueid']][_0xca31('0x29')]=_0x504956['pagestransferred'];this[_0xca31('0xb')][_0x504956[_0xca31('0x1c')]][_0xca31('0x1b')]=_0x504956[_0xca31('0x1b')];this[_0xca31('0xb')][_0x504956[_0xca31('0x1c')]][_0xca31('0x2a')]=_0x504956[_0xca31('0x2a')];this[_0xca31('0xb')][_0x504956[_0xca31('0x1c')]]['transferrate']=_0x504956[_0xca31('0x2b')];this['channels'][_0x504956['uniqueid']][_0xca31('0x28')]=_0x504956[_0xca31('0x28')];this[_0xca31('0xb')][_0x504956[_0xca31('0x1c')]][_0xca31('0x2c')]=_0x504956[_0xca31('0x2c')];if(this[_0xca31('0xb')][_0x504956['uniqueid']][_0xca31('0x29')]>0x0){tiff2pdf(_0x504956[_0xca31('0x28')],_0xca31('0x2d'),function(_0x16d862){logger[_0xca31('0x21')](_0x504956[_0xca31('0x1c')],_0xca31('0x2e'),_0x16d862[_0xca31('0x2f')]);attachment[_0xca31('0x30')]({'name':path[_0xca31('0x31')](_0x504956[_0xca31('0x28')])[_0xca31('0x1e')],'basename':path[_0xca31('0x31')](_0x504956[_0xca31('0x28')])[_0xca31('0x1e')]+_0xca31('0x32'),'type':'application/pdf'})['then'](function(_0x17928f){faxAccount[_0xca31('0x33')](_0x1b31eb,{'from':_0x504956[_0xca31('0x2c')],'mapKey':'fax','body':path['parse'](_0x504956[_0xca31('0x28')])[_0xca31('0x1e')]+'.pdf','AttachmentId':_0x17928f['id']})['catch'](function(_0x299a92){logger[_0xca31('0x34')](_0x504956['uniqueid'],'\x20notify\x20',JSON[_0xca31('0x35')](_0x299a92));});})[_0xca31('0x36')](function(_0x28b150){logger[_0xca31('0x34')](_0x504956[_0xca31('0x1c')],_0xca31('0x37'),JSON[_0xca31('0x35')](_0x28b150));});});}logger['info'](_0x504956[_0xca31('0x1c')],'\x20receiveFax\x20');}};Fax[_0xca31('0x25')][_0xca31('0x18')]=function(_0x1bb4aa){if(this['actions'][_0x1bb4aa[_0xca31('0x1c')]]){_[_0xca31('0x38')](this['channels'][_0x1bb4aa[_0xca31('0x1c')]],_[_0xca31('0x39')](_0x1bb4aa,[_0xca31('0x3a'),'reason']));}};function updateStatus(_0x698755){if(_0x698755[_0xca31('0x3b')]){faxMessage[_0xca31('0x3c')](_0x698755[_0xca31('0x3b')],{'failMessage':_0xca31('0x3d')})['then'](function(_0x18ff48){ut[_0xca31('0x3e')](_0xca31('0x3f'),_0x18ff48);})[_0xca31('0x36')](function(_0x95bd74){ut[_0xca31('0x3e')](_0xca31('0x40'),_0x95bd74);});}else{ut[_0xca31('0x3e')](_0xca31('0x41'));}}Fax[_0xca31('0x25')][_0xca31('0x42')]=function(_0x3ef7ea,_0x3f0400,_0x1197e3){var _0x272824=this;var _0x175f82={};if(_0x3f0400){_0x175f82={'read':_0x3f0400};}else{_0x175f82={'failMessage':_0x1197e3};}if(this[_0xca31('0x20')][_0x3ef7ea][_0xca31('0x3b')]){faxMessage[_0xca31('0x3c')](this[_0xca31('0x20')][_0x3ef7ea][_0xca31('0x3b')],_0x175f82)[_0xca31('0x43')](function(_0x5a9795){ut[_0xca31('0x3e')](_0xca31('0x44'),_0x5a9795);})['catch'](function(_0x1a1d2e){ut[_0xca31('0x3e')]('[Fax][Message][NoUpdate1]',_0x1a1d2e);})[_0xca31('0x45')](function(){delete _0x272824[_0xca31('0xb')][_0x3ef7ea];delete _0x272824[_0xca31('0x20')][_0x3ef7ea];});}else{ut['logger'](_0xca31('0x46'));delete this[_0xca31('0xb')][_0x3ef7ea];delete this[_0xca31('0x20')][_0x3ef7ea];}};Fax[_0xca31('0x25')]['syncHangup']=function(_0x192cbc){var _0x36b8ac=this;if(this[_0xca31('0xb')][_0x192cbc[_0xca31('0x1c')]]){if(this['actions'][_0x192cbc[_0xca31('0x1c')]]){this['channels'][_0x192cbc[_0xca31('0x1c')]]['id']=this['actions'][_0x192cbc[_0xca31('0x1c')]]['id'];this[_0xca31('0xb')][_0x192cbc['uniqueid']][_0xca31('0x1e')]=this[_0xca31('0x20')][_0x192cbc[_0xca31('0x1c')]][_0xca31('0x1e')];}logger[_0xca31('0x21')](_0x192cbc[_0xca31('0x1c')],this[_0xca31('0x20')][_0x192cbc[_0xca31('0x1c')]]?_0xca31('0x47'):_0xca31('0x48'),JSON[_0xca31('0x35')](this[_0xca31('0xb')][_0x192cbc[_0xca31('0x1c')]]));if(this['actions'][_0x192cbc[_0xca31('0x1c')]]){if(this[_0xca31('0xb')][_0x192cbc[_0xca31('0x1c')]][_0xca31('0x49')]>0x0&&this[_0xca31('0xb')][_0x192cbc[_0xca31('0x1c')]][_0xca31('0x14')]===_0xca31('0x4a')){this['updateStatus'](_0x192cbc[_0xca31('0x1c')],!![]);}else{this[_0xca31('0x42')](_0x192cbc['uniqueid'],![],this[_0xca31('0xb')][_0x192cbc[_0xca31('0x1c')]][_0xca31('0x4b')]?_0xca31('0x4c')+this[_0xca31('0xb')][_0x192cbc['uniqueid']][_0xca31('0x4b')]:'SENDING\x20FAILED');}}}};Fax['prototype']['send']=function(_0x3d6a23){var _0x4d8658=this;return new BPromise(function(_0xc1531d,_0x5eafef){_0x4d8658[_0xca31('0x4d')](_0x3d6a23,_0x4d8658['faxAccounts'][_0x3d6a23[_0xca31('0x4e')]])[_0xca31('0x43')](function(_0xdc3673){ut[_0xca31('0x3e')](_0xca31('0x4f'),_0xdc3673);_0xc1531d(ut[_0xca31('0x2f')]('Fax\x20received'));})[_0xca31('0x36')](function(_0x548a12){ut[_0xca31('0x3e')](_0xca31('0x50'),_0x548a12);updateStatus(_0x3d6a23);_0x5eafef(ut[_0xca31('0x2f')]('Fax\x20failed'));});});};Fax['prototype'][_0xca31('0x51')]=function(_0x46a719){var _0x42f83d=this;return new BPromise(function(_0x21809a,_0x15e6c3){var _0x384c02=_0x42f83d['checkTrunk'](_0x42f83d[_0xca31('0xc')][_0x46a719[_0xca31('0x4e')]][_0xca31('0x52')],_0x46a719);if(_0x384c02['isValid']){_0x21809a(ut['message'](_0xca31('0x53')));}else{_0x15e6c3(ut['message'](_0x384c02[_0xca31('0x2f')]));}});};function originate(_0x4c66c5,_0x357923,_0x38cac){return new BPromise(function(_0x2008a6,_0x9e0518){if(_0x38cac){var _0x237ec0=util[_0xca31('0x54')](_0xca31('0x55'),path[_0xca31('0x31')](_0x4c66c5[_0xca31('0x56')])[_0xca31('0x1e')],_0x4c66c5[_0xca31('0x56')]);gs['execute'](_0x237ec0)[_0xca31('0x43')](function(){_0x4c66c5[_0xca31('0x56')]=util['format'](_0xca31('0x57'),path['parse'](_0x4c66c5[_0xca31('0x56')])['dir'],path[_0xca31('0x31')](_0x4c66c5[_0xca31('0x56')])[_0xca31('0x1e')]);_0x357923[_0xca31('0x58')]=_0x4c66c5[_0xca31('0x56')];ut[_0xca31('0x3e')](_0xca31('0x59'),'');ami[_0xca31('0x5a')](ut['variablesAction'](_0x4c66c5,_0x357923))['then'](function(_0x1636ad){_0x2008a6(_0x1636ad);})[_0xca31('0x36')](function(_0x302144){_0x9e0518(_0x302144);});})[_0xca31('0x36')](function(_0x33e75f){_0x9e0518(_0x33e75f);});}else{ami['Action'](ut['variablesAction'](_0x4c66c5,_0x357923))['then'](function(_0x2e9337){_0x2008a6(_0x2e9337);})['catch'](function(_0x46a3bb){_0x9e0518(_0x46a3bb);});}});}Fax[_0xca31('0x25')][_0xca31('0x4d')]=function(_0x3b5516,_0x30aebd){var _0x475845=this;return new BPromise(function(_0x3cafa7,_0x3183c7){var _0x250a63=uuid['v4']();var _0xc56d1b=ut[_0xca31('0x5b')](_0x3b5516,_0x30aebd);_0x475845[_0xca31('0x20')][_0x250a63]=new Action(_0x250a63,_0x30aebd,_0x3b5516);var _0x5a8535=_0x475845[_0xca31('0x20')][_0x250a63];if(path[_0xca31('0x31')](_0x3b5516[_0xca31('0x56')])[_0xca31('0x5c')]===_0xca31('0x32')){originate(_0x5a8535,_0xc56d1b,!![])[_0xca31('0x43')](function(_0x553b14){_0x3cafa7(_0x553b14);})[_0xca31('0x36')](function(_0x44f3d8){_0x3183c7(_0x44f3d8);});}else{originate(_0x5a8535,_0xc56d1b,![])[_0xca31('0x43')](function(_0x376737){_0x3cafa7(_0x376737);})[_0xca31('0x36')](function(_0xe27372){_0x3183c7(_0xe27372);});}});};Fax[_0xca31('0x25')][_0xca31('0x5d')]=function(_0x581f30){return!_[_0xca31('0x5e')](_0x581f30)&&!_[_0xca31('0x5e')](_0x581f30[_0xca31('0x1e')])&&!_[_0xca31('0x5e')](_0x581f30[_0xca31('0x5f')])&&_0x581f30['active']&&!_['isNil'](this['trunks'][util[_0xca31('0x54')](_0xca31('0x60'),_0x581f30[_0xca31('0x1e')])])&&!_[_0xca31('0x5e')](this['trunks'][util[_0xca31('0x54')](_0xca31('0x60'),_0x581f30[_0xca31('0x1e')])][_0xca31('0x61')])&&(this[_0xca31('0xd')][util[_0xca31('0x54')]('SIP/%s',_0x581f30[_0xca31('0x1e')])][_0xca31('0x61')]===_0xca31('0x62')||this[_0xca31('0xd')][util[_0xca31('0x54')](_0xca31('0x60'),_0x581f30[_0xca31('0x1e')])]['status']==='unmonitored');};Fax[_0xca31('0x25')][_0xca31('0x63')]=function(_0x4c9a9b,_0x204949){if(!this[_0xca31('0x5d')](_0x4c9a9b)){ut[_0xca31('0x3e')](_0xca31('0x64'),_[_0xca31('0x5e')](_0x4c9a9b)?'':_0x4c9a9b[_0xca31('0x1e')]+_0xca31('0x65'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xca31('0x5e')](_0x204949[_0xca31('0x6')])){ut[_0xca31('0x3e')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xca31('0x35')](_0x204949));return{'isValid':![],'message':_0xca31('0x66')};}if(_[_0xca31('0x5e')](_0x204949[_0xca31('0x56')])){ut['logger'](_0xca31('0x67'),JSON[_0xca31('0x35')](_0x204949));return{'isValid':![],'message':_0xca31('0x68')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xca31('0x69')]=Fax; \ No newline at end of file +var _0x58c2=['syncNewExten','faxstatus','syncFaxStatus','receivefax','originateresponse','prototype','context','from-voip-provider','exten','localstationid','channels','uniqueid','info','\x20syncNewchannel\x20','channel','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','name','.pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','lodash','bluebird','path','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten'];(function(_0x5c9a52,_0xbd9770){var _0x69dc1a=function(_0x47d041){while(--_0x47d041){_0x5c9a52['push'](_0x5c9a52['shift']());}};_0x69dc1a(++_0xbd9770);}(_0x58c2,0x148));var _0x258c=function(_0x4e623c,_0x110ef0){_0x4e623c=_0x4e623c-0x0;var _0x43fbbf=_0x58c2[_0x4e623c];return _0x43fbbf;};'use strict';var util=require('util');var _=require(_0x258c('0x0'));var BPromise=require(_0x258c('0x1'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x258c('0x2'));var tiff2pdf=require(_0x258c('0x3'));var gs=require(_0x258c('0x4'));var logger=require(_0x258c('0x5'))(_0x258c('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x258c('0x7'));var ut=require(_0x258c('0x8'));var Action=require(_0x258c('0x9'));var faxAccount=require(_0x258c('0xa'));var attachment=require(_0x258c('0xb'));var faxMessage=require(_0x258c('0xc'));function Fax(_0x520d12){this['channels']={};this[_0x258c('0xd')]=_0x520d12[_0x258c('0xd')];this[_0x258c('0xe')]=_0x520d12['trunks'];this[_0x258c('0xf')]={};ami['on'](_0x258c('0x10'),this[_0x258c('0x11')][_0x258c('0x12')](this));ami['on'](_0x258c('0x13'),this['syncVarSet'][_0x258c('0x12')](this));ami['on'](_0x258c('0x14'),this[_0x258c('0x15')][_0x258c('0x12')](this));ami['on'](_0x258c('0x16'),this[_0x258c('0x17')]['bind'](this));ami['on'](_0x258c('0x18'),this[_0x258c('0x19')][_0x258c('0x12')](this));ami['on'](_0x258c('0x1a'),this['syncReceiveFax'][_0x258c('0x12')](this));ami['on']('hangup',this['syncHangup'][_0x258c('0x12')](this));ami['on'](_0x258c('0x1b'),this['syncOriginateResponse'][_0x258c('0x12')](this));}Fax[_0x258c('0x1c')]['syncNewchannel']=function(_0x1c7092){if(_0x1c7092[_0x258c('0x1d')]===_0x258c('0x1e')){for(var _0xcecef2 in this[_0x258c('0xd')]){if(this[_0x258c('0xd')]['hasOwnProperty'](_0xcecef2)){if(_0x1c7092[_0x258c('0x1f')]===this[_0x258c('0xd')][_0xcecef2][_0x258c('0x20')]){this[_0x258c('0x21')][_0x1c7092['uniqueid']]={};this[_0x258c('0x21')][_0x1c7092[_0x258c('0x22')]]['channel']=_0x1c7092['channel'];this[_0x258c('0x21')][_0x1c7092[_0x258c('0x22')]]['id']=this[_0x258c('0xd')][_0xcecef2]['id'];this[_0x258c('0x21')][_0x1c7092['uniqueid']]['name']=this[_0x258c('0xd')][_0xcecef2]['name'];logger[_0x258c('0x23')](_0x1c7092[_0x258c('0x22')],_0x258c('0x24'));}}}}if(this[_0x258c('0xf')][_0x1c7092['uniqueid']]){this['channels'][_0x1c7092['uniqueid']]={};this[_0x258c('0x21')][_0x1c7092[_0x258c('0x22')]]['channel']=_0x1c7092[_0x258c('0x25')];logger[_0x258c('0x23')](_0x1c7092[_0x258c('0x22')],'\x20syncNewchannel\x20');}};Fax['prototype']['syncVarSet']=function(_0x4339c4){if(this[_0x258c('0x21')][_0x4339c4[_0x258c('0x22')]]){for(var _0x186446 in _0x4339c4[_0x258c('0x26')]){if(_0x4339c4[_0x258c('0x26')][_0x258c('0x27')](_0x186446)){this['channels'][_0x4339c4[_0x258c('0x22')]][_0x186446]=_0x4339c4[_0x258c('0x28')];}}}};Fax[_0x258c('0x1c')][_0x258c('0x15')]=function(_0xadbdc5){if(this[_0x258c('0x21')][_0xadbdc5[_0x258c('0x22')]]){this[_0x258c('0x21')][_0xadbdc5[_0x258c('0x22')]]['channelstate']=_0xadbdc5[_0x258c('0x29')];this[_0x258c('0x21')][_0xadbdc5['uniqueid']][_0x258c('0x2a')]=_0xadbdc5[_0x258c('0x2a')];}};Fax['prototype'][_0x258c('0x17')]=function(_0x423c92){if(this[_0x258c('0x21')][_0x423c92['uniqueid']]){for(var _0x1afba9 in _0x423c92[_0x258c('0x26')]){if(_0x423c92['variable'][_0x258c('0x27')](_0x1afba9)){this[_0x258c('0x21')][_0x423c92['uniqueid']][_0x1afba9]=_0x423c92[_0x258c('0x28')];}}}};Fax['prototype'][_0x258c('0x19')]=function(_0x240670){if(this['channels'][_0x240670['uniqueid']]){this[_0x258c('0x21')][_0x240670[_0x258c('0x22')]][_0x258c('0x2b')]=_0x240670['operation'];this[_0x258c('0x21')][_0x240670[_0x258c('0x22')]]['status']=_0x240670[_0x258c('0x2c')];this['channels'][_0x240670[_0x258c('0x22')]]['localstationid']=_0x240670[_0x258c('0x20')];this[_0x258c('0x21')][_0x240670[_0x258c('0x22')]]['filename']=_0x240670[_0x258c('0x2d')];logger[_0x258c('0x23')](_0x240670[_0x258c('0x22')],_0x258c('0x2e'));}};Fax[_0x258c('0x1c')][_0x258c('0x2f')]=function(_0x506b6f){var _0x42e2c0=this;if(this[_0x258c('0x21')][_0x506b6f[_0x258c('0x22')]]){var _0x5b4794=this[_0x258c('0x21')][_0x506b6f[_0x258c('0x22')]]['id'];this['channels'][_0x506b6f[_0x258c('0x22')]][_0x258c('0x30')]=_0x506b6f[_0x258c('0x30')];this['channels'][_0x506b6f[_0x258c('0x22')]][_0x258c('0x31')]=_0x506b6f[_0x258c('0x31')];this[_0x258c('0x21')][_0x506b6f[_0x258c('0x22')]][_0x258c('0x20')]=_0x506b6f[_0x258c('0x20')];this['channels'][_0x506b6f['uniqueid']][_0x258c('0x32')]=_0x506b6f[_0x258c('0x32')];this[_0x258c('0x21')][_0x506b6f[_0x258c('0x22')]][_0x258c('0x33')]=_0x506b6f[_0x258c('0x33')];this['channels'][_0x506b6f[_0x258c('0x22')]]['filename']=_0x506b6f[_0x258c('0x2d')];this[_0x258c('0x21')][_0x506b6f[_0x258c('0x22')]][_0x258c('0x34')]=_0x506b6f[_0x258c('0x34')];if(this[_0x258c('0x21')][_0x506b6f['uniqueid']][_0x258c('0x31')]>0x0){tiff2pdf(_0x506b6f[_0x258c('0x2d')],'/var/opt/motion2/server/files/attachments/',function(_0x223b4e){logger[_0x258c('0x23')](_0x506b6f[_0x258c('0x22')],_0x258c('0x35'),_0x223b4e[_0x258c('0x36')]);attachment['create']({'name':path[_0x258c('0x37')](_0x506b6f['filename'])[_0x258c('0x38')],'basename':path[_0x258c('0x37')](_0x506b6f[_0x258c('0x2d')])[_0x258c('0x38')]+_0x258c('0x39'),'type':'application/pdf'})[_0x258c('0x3a')](function(_0x4b2b05){faxAccount['notify'](_0x5b4794,{'from':_0x506b6f[_0x258c('0x34')],'mapKey':_0x258c('0x6'),'body':path[_0x258c('0x37')](_0x506b6f['filename'])[_0x258c('0x38')]+_0x258c('0x39'),'AttachmentId':_0x4b2b05['id']})[_0x258c('0x3b')](function(_0x21f529){logger[_0x258c('0x3c')](_0x506b6f['uniqueid'],_0x258c('0x3d'),JSON[_0x258c('0x3e')](_0x21f529));});})[_0x258c('0x3b')](function(_0x25a3fd){logger[_0x258c('0x3c')](_0x506b6f[_0x258c('0x22')],_0x258c('0x3f'),JSON[_0x258c('0x3e')](_0x25a3fd));});});}logger[_0x258c('0x23')](_0x506b6f[_0x258c('0x22')],_0x258c('0x3f'));}};Fax['prototype'][_0x258c('0x40')]=function(_0x31bb23){if(this[_0x258c('0xf')][_0x31bb23['uniqueid']]){_[_0x258c('0x41')](this[_0x258c('0x21')][_0x31bb23[_0x258c('0x22')]],_[_0x258c('0x42')](_0x31bb23,[_0x258c('0x43'),_0x258c('0x44')]));}};function updateStatus(_0x256f58){if(_0x256f58['AttachmentId']){faxMessage['update'](_0x256f58[_0x258c('0x45')],{'failMessage':_0x258c('0x46')})[_0x258c('0x3a')](function(_0x198e6b){ut['logger']('[Fax][Message][Error][Updated]',_0x198e6b);})['catch'](function(_0x487694){ut['logger'](_0x258c('0x47'),_0x487694);});}else{ut[_0x258c('0x48')](_0x258c('0x49'));}}Fax[_0x258c('0x1c')]['updateStatus']=function(_0x4cc429,_0x50f290,_0x140a4b){var _0x2dced0=this;var _0x31297a={};if(_0x50f290){_0x31297a={'read':_0x50f290};}else{_0x31297a={'failMessage':_0x140a4b};}if(this['actions'][_0x4cc429][_0x258c('0x45')]){faxMessage[_0x258c('0x4a')](this['actions'][_0x4cc429]['AttachmentId'],_0x31297a)[_0x258c('0x3a')](function(_0x2ad952){ut[_0x258c('0x48')](_0x258c('0x4b'),_0x2ad952);})[_0x258c('0x3b')](function(_0x4df037){ut[_0x258c('0x48')](_0x258c('0x4c'),_0x4df037);})[_0x258c('0x4d')](function(){delete _0x2dced0[_0x258c('0x21')][_0x4cc429];delete _0x2dced0[_0x258c('0xf')][_0x4cc429];});}else{ut[_0x258c('0x48')](_0x258c('0x4e'));delete this[_0x258c('0x21')][_0x4cc429];delete this[_0x258c('0xf')][_0x4cc429];}};Fax['prototype'][_0x258c('0x4f')]=function(_0x113420){var _0xfcdaa3=this;if(this[_0x258c('0x21')][_0x113420[_0x258c('0x22')]]){if(this[_0x258c('0xf')][_0x113420[_0x258c('0x22')]]){this[_0x258c('0x21')][_0x113420[_0x258c('0x22')]]['id']=this[_0x258c('0xf')][_0x113420[_0x258c('0x22')]]['id'];this['channels'][_0x113420[_0x258c('0x22')]][_0x258c('0x38')]=this[_0x258c('0xf')][_0x113420[_0x258c('0x22')]][_0x258c('0x38')];}logger[_0x258c('0x23')](_0x113420[_0x258c('0x22')],this[_0x258c('0xf')][_0x113420['uniqueid']]?_0x258c('0x50'):_0x258c('0x51'),JSON[_0x258c('0x3e')](this[_0x258c('0x21')][_0x113420[_0x258c('0x22')]]));if(this[_0x258c('0xf')][_0x113420['uniqueid']]){if(this[_0x258c('0x21')][_0x113420['uniqueid']][_0x258c('0x52')]>0x0&&this[_0x258c('0x21')][_0x113420[_0x258c('0x22')]]['faxstatus']==='SUCCESS'){this['updateStatus'](_0x113420[_0x258c('0x22')],!![]);}else{this[_0x258c('0x53')](_0x113420['uniqueid'],![],this['channels'][_0x113420['uniqueid']][_0x258c('0x54')]?_0x258c('0x55')+this['channels'][_0x113420['uniqueid']][_0x258c('0x54')]:_0x258c('0x56'));}}}};Fax['prototype'][_0x258c('0x57')]=function(_0x372ce6){var _0x2c682f=this;return new BPromise(function(_0x29003e,_0x61fb8f){_0x2c682f[_0x258c('0x58')](_0x372ce6,_0x2c682f['faxAccounts'][_0x372ce6[_0x258c('0x59')]])[_0x258c('0x3a')](function(_0x3d4373){ut['logger']('[Fax][execOriginate][success]',_0x3d4373);_0x29003e(ut[_0x258c('0x36')]('Fax\x20received'));})['catch'](function(_0x61d7b5){ut[_0x258c('0x48')](_0x258c('0x5a'),_0x61d7b5);updateStatus(_0x372ce6);_0x61fb8f(ut[_0x258c('0x36')](_0x258c('0x5b')));});});};Fax[_0x258c('0x1c')][_0x258c('0x5c')]=function(_0x2c7597){var _0x4cc5cd=this;return new BPromise(function(_0x22610a,_0x43e4cc){var _0x475a1f=_0x4cc5cd['checkTrunk'](_0x4cc5cd[_0x258c('0xd')][_0x2c7597[_0x258c('0x59')]][_0x258c('0x5d')],_0x2c7597);if(_0x475a1f[_0x258c('0x5e')]){_0x22610a(ut[_0x258c('0x36')]('Trunk\x20Reachable'));}else{_0x43e4cc(ut[_0x258c('0x36')](_0x475a1f['message']));}});};function originate(_0x3451e4,_0x1ab571,_0x5b19c7){return new BPromise(function(_0x54cc57,_0x20a1b5){if(_0x5b19c7){var _0x5a01c0=util['format'](_0x258c('0x5f'),path[_0x258c('0x37')](_0x3451e4[_0x258c('0x2')])[_0x258c('0x38')],_0x3451e4[_0x258c('0x2')]);gs[_0x258c('0x60')](_0x5a01c0)[_0x258c('0x3a')](function(){_0x3451e4['path']=util[_0x258c('0x61')]('%s/%s.tif',path[_0x258c('0x37')](_0x3451e4[_0x258c('0x2')])[_0x258c('0x62')],path[_0x258c('0x37')](_0x3451e4[_0x258c('0x2')])[_0x258c('0x38')]);_0x1ab571[_0x258c('0x63')]=_0x3451e4[_0x258c('0x2')];ut[_0x258c('0x48')](_0x258c('0x64'),'');ami[_0x258c('0x65')](ut[_0x258c('0x66')](_0x3451e4,_0x1ab571))['then'](function(_0x5f1ac3){_0x54cc57(_0x5f1ac3);})['catch'](function(_0x1374f6){_0x20a1b5(_0x1374f6);});})['catch'](function(_0x108c36){_0x20a1b5(_0x108c36);});}else{ami[_0x258c('0x65')](ut[_0x258c('0x66')](_0x3451e4,_0x1ab571))[_0x258c('0x3a')](function(_0x54d225){_0x54cc57(_0x54d225);})[_0x258c('0x3b')](function(_0x2eac38){_0x20a1b5(_0x2eac38);});}});}Fax[_0x258c('0x1c')][_0x258c('0x58')]=function(_0x302507,_0x1a21b6){var _0x4191fb=this;return new BPromise(function(_0x318b43,_0x64208e){var _0x3f03cc=uuid['v4']();var _0x765ea2=ut[_0x258c('0x67')](_0x302507,_0x1a21b6);_0x4191fb[_0x258c('0xf')][_0x3f03cc]=new Action(_0x3f03cc,_0x1a21b6,_0x302507);var _0x2ad322=_0x4191fb[_0x258c('0xf')][_0x3f03cc];if(path[_0x258c('0x37')](_0x302507[_0x258c('0x2')])[_0x258c('0x68')]==='.pdf'){originate(_0x2ad322,_0x765ea2,!![])[_0x258c('0x3a')](function(_0x5db0d7){_0x318b43(_0x5db0d7);})[_0x258c('0x3b')](function(_0xdb9476){_0x64208e(_0xdb9476);});}else{originate(_0x2ad322,_0x765ea2,![])[_0x258c('0x3a')](function(_0x5a9ccf){_0x318b43(_0x5a9ccf);})[_0x258c('0x3b')](function(_0x572be0){_0x64208e(_0x572be0);});}});};Fax[_0x258c('0x1c')][_0x258c('0x69')]=function(_0x47cd3d){return!_[_0x258c('0x6a')](_0x47cd3d)&&!_[_0x258c('0x6a')](_0x47cd3d['name'])&&!_[_0x258c('0x6a')](_0x47cd3d[_0x258c('0x6b')])&&_0x47cd3d[_0x258c('0x6b')]&&!_['isNil'](this[_0x258c('0xe')][util[_0x258c('0x61')]('SIP/%s',_0x47cd3d['name'])])&&!_[_0x258c('0x6a')](this[_0x258c('0xe')][util[_0x258c('0x61')]('SIP/%s',_0x47cd3d[_0x258c('0x38')])]['status'])&&(this[_0x258c('0xe')][util[_0x258c('0x61')](_0x258c('0x6c'),_0x47cd3d[_0x258c('0x38')])][_0x258c('0x2c')]===_0x258c('0x6d')||this['trunks'][util[_0x258c('0x61')](_0x258c('0x6c'),_0x47cd3d[_0x258c('0x38')])]['status']===_0x258c('0x6e'));};Fax[_0x258c('0x1c')]['checkTrunk']=function(_0x3e68f3,_0x3d0797){if(!this[_0x258c('0x69')](_0x3e68f3)){ut[_0x258c('0x48')](_0x258c('0x6f'),_[_0x258c('0x6a')](_0x3e68f3)?'':_0x3e68f3[_0x258c('0x38')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x258c('0x70')};}if(_[_0x258c('0x6a')](_0x3d0797[_0x258c('0x6')])){ut[_0x258c('0x48')](_0x258c('0x71'),JSON[_0x258c('0x3e')](_0x3d0797));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x3d0797[_0x258c('0x2')])){ut[_0x258c('0x48')](_0x258c('0x72'),JSON['stringify'](_0x3d0797));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x258c('0x73')};};module[_0x258c('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 5eb7aec..168e8f0 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 _0x6c6d=['lodash','../rpc/faxAccount','error','inspect','resolve','then','notify','catch','[Notify]\x20','bluebird','preview'];(function(_0x3f553b,_0x49a9c2){var _0x183c4e=function(_0x873b22){while(--_0x873b22){_0x3f553b['push'](_0x3f553b['shift']());}};_0x183c4e(++_0x49a9c2);}(_0x6c6d,0x1c1));var _0xd6c6=function(_0x4d99bb,_0x4ce36c){_0x4d99bb=_0x4d99bb-0x0;var _0x2593ca=_0x6c6d[_0x4d99bb];return _0x2593ca;};'use strict';var util=require('util');var BPromise=require(_0xd6c6('0x0'));var logger=require('../../../config/logger')(_0xd6c6('0x1'));var _=require(_0xd6c6('0x2'));var faxAccount=require(_0xd6c6('0x3'));function loggerCatch(_0x56e563){return function(_0x5139f9){logger[_0xd6c6('0x4')](_0x56e563,util[_0xd6c6('0x5')](_0x5139f9,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x47fae2,_0x59c49a){return BPromise[_0xd6c6('0x6')]()[_0xd6c6('0x7')](faxAccount[_0xd6c6('0x8')](_0x47fae2,_0x59c49a))[_0xd6c6('0x9')](loggerCatch(_0xd6c6('0xa')));}; \ No newline at end of file +var _0xe3bd=['inspect','notify','then','[Notify]\x20','bluebird','../../../config/logger','lodash','error'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xe3bd,0x1ec));var _0xde3b=function(_0x2c602e,_0x1d26f5){_0x2c602e=_0x2c602e-0x0;var _0x1a2650=_0xe3bd[_0x2c602e];return _0x1a2650;};'use strict';var util=require('util');var BPromise=require(_0xde3b('0x0'));var logger=require(_0xde3b('0x1'))('preview');var _=require(_0xde3b('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x46ec71){return function(_0x5ec212){logger[_0xde3b('0x3')](_0x46ec71,util[_0xde3b('0x4')](_0x5ec212,{'showHidden':![],'depth':null}));};}exports[_0xde3b('0x5')]=function(_0x213f06,_0x2cd261){return BPromise['resolve']()[_0xde3b('0x6')](faxAccount[_0xde3b('0x5')](_0x213f06,_0x2cd261))['catch'](loggerCatch(_0xde3b('0x7')));}; \ 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 7e6624b..18ba706 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 _0xcb01=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xcb01,0x69));var _0x1cb0=function(_0x3eb267,_0x441384){_0x3eb267=_0x3eb267-0x0;var _0x55b58f=_0xcb01[_0x3eb267];return _0x55b58f;};'use strict';var util=require('util');var logger=require(_0x1cb0('0x0'))(_0x1cb0('0x1'));var BPromise=require(_0x1cb0('0x2'));var exec=require(_0x1cb0('0x3'))[_0x1cb0('0x4')];exports[_0x1cb0('0x5')]=function(_0x4ce33c){return new BPromise(function(_0x288d56,_0x54379a){exec(_0x4ce33c,function(_0x23900b,_0x5b7835,_0x447550){logger[_0x1cb0('0x6')](_0x1cb0('0x7'),_0x5b7835);if(_0x23900b){logger[_0x1cb0('0x6')](_0x1cb0('0x7'),_0x1cb0('0x8'),util[_0x1cb0('0x9')](_0x23900b,{'showHidden':![],'depth':null}),_0x5b7835,_0x447550);_0x54379a(_0x23900b);}_0x288d56(_0x5b7835);});});}; \ No newline at end of file +var _0x4cfd=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute'];(function(_0x22a6ec,_0x40571b){var _0x58aab4=function(_0x52ca9c){while(--_0x52ca9c){_0x22a6ec['push'](_0x22a6ec['shift']());}};_0x58aab4(++_0x40571b);}(_0x4cfd,0xa9));var _0xd4cf=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x4cfd[_0x3e44fa];return _0x2a0aba;};'use strict';var util=require(_0xd4cf('0x0'));var logger=require(_0xd4cf('0x1'))(_0xd4cf('0x2'));var BPromise=require(_0xd4cf('0x3'));var exec=require(_0xd4cf('0x4'))[_0xd4cf('0x5')];exports[_0xd4cf('0x6')]=function(_0x128d1d){return new BPromise(function(_0x45a864,_0x41616a){exec(_0x128d1d,function(_0x1d46fc,_0x1ebe08,_0x13aeaf){logger[_0xd4cf('0x7')](_0xd4cf('0x8'),_0x1ebe08);if(_0x1d46fc){logger[_0xd4cf('0x7')]('Exec\x20gs',_0xd4cf('0x9'),util[_0xd4cf('0xa')](_0x1d46fc,{'showHidden':![],'depth':null}),_0x1ebe08,_0x13aeaf);_0x41616a(_0x1d46fc);}_0x45a864(_0x1ebe08);});});}; \ 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 0af4f38..5db422c 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 _0xb821=['format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','message','info','inspect','ecm','headerinfo','minrate','maxrate'];(function(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0xb821,0xa7));var _0x1b82=function(_0x251f5d,_0x5ce3ba){_0x251f5d=_0x251f5d-0x0;var _0x354c31=_0xb821[_0x251f5d];return _0x354c31;};'use strict';var util=require('util');var _=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var logger=require('../../../../config/logger')('fax');exports[_0x1b82('0x2')]=function(_0x578a10){return{'message':_0x578a10};};exports['logger']=function(_0x3b1d14,_0x1403ab){logger[_0x1b82('0x3')](_0x3b1d14,util[_0x1b82('0x4')](_0x1403ab,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3e27c4,_0x192434){var _0x202a5f={'XMF-ECM':_0x192434[_0x1b82('0x5')],'XMF-HEADERINFO':_0x192434[_0x1b82('0x6')],'XMF-MINRATE':_0x192434[_0x1b82('0x7')],'XMF-MAXRATE':_0x192434[_0x1b82('0x8')],'XMF-MODEM':util[_0x1b82('0x9')](_0x1b82('0xa'),_0x192434['modem']),'XMF-GATEWAY':_0x192434[_0x1b82('0xb')],'XMF-FAXDETECT':_0x192434[_0x1b82('0xc')],'XMF-T38TIMEOUT':_0x192434[_0x1b82('0xd')],'XMF-LOCALSTATIONID':_0x192434[_0x1b82('0xe')],'XMF-PATH':_0x3e27c4[_0x1b82('0xf')]};return _0x202a5f;};exports[_0x1b82('0x10')]=function(_0x739f99,_0x1ce719){return{'actionid':_0x739f99['uniqueid'],'action':_0x1b82('0x11'),'channel':_0x739f99[_0x1b82('0x12')],'Exten':_0x1b82('0x13'),'Context':_0x1b82('0x14'),'Priority':'1','callerid':util['format'](_0x1b82('0x15'),_0x739f99['headerinfo']?_0x739f99['headerinfo']:'',_0x739f99[_0x1b82('0xe')]),'variable':_0x1ce719,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x739f99['uniqueid']};}; \ No newline at end of file +var _0xaa88=['message','logger','info','ecm','headerinfo','minrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaa88,0x137));var _0x8aa8=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xaa88[_0xf71120];return _0xbe2fd3;};'use strict';var util=require(_0x8aa8('0x0'));var _=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var logger=require(_0x8aa8('0x3'))('fax');exports[_0x8aa8('0x4')]=function(_0x3a5b12){return{'message':_0x3a5b12};};exports[_0x8aa8('0x5')]=function(_0x3b2c88,_0x3e3b70){logger[_0x8aa8('0x6')](_0x3b2c88,util['inspect'](_0x3e3b70,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x460042,_0x5264ff){var _0x449d2d={'XMF-ECM':_0x5264ff[_0x8aa8('0x7')],'XMF-HEADERINFO':_0x5264ff[_0x8aa8('0x8')],'XMF-MINRATE':_0x5264ff[_0x8aa8('0x9')],'XMF-MAXRATE':_0x5264ff['maxrate'],'XMF-MODEM':util[_0x8aa8('0xa')](_0x8aa8('0xb'),_0x5264ff[_0x8aa8('0xc')]),'XMF-GATEWAY':_0x5264ff['gateway'],'XMF-FAXDETECT':_0x5264ff[_0x8aa8('0xd')],'XMF-T38TIMEOUT':_0x5264ff[_0x8aa8('0xe')],'XMF-LOCALSTATIONID':_0x5264ff[_0x8aa8('0xf')],'XMF-PATH':_0x460042[_0x8aa8('0x10')]};return _0x449d2d;};exports['variablesAction']=function(_0x3f8100,_0x30c114){return{'actionid':_0x3f8100['uniqueid'],'action':_0x8aa8('0x11'),'channel':_0x3f8100[_0x8aa8('0x12')],'Exten':_0x8aa8('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x8aa8('0xa')](_0x8aa8('0x14'),_0x3f8100[_0x8aa8('0x8')]?_0x3f8100['headerinfo']:'',_0x3f8100[_0x8aa8('0xf')]),'variable':_0x30c114,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3f8100['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index f8812b7..bac096b 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 _0xdda8=['initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','sync','catch','log','bluebird','util','moment','./server','./realtime','./report','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getVoiceQueues','initVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xdda8,0xc2));var _0x8dda=function(_0x582aaf,_0x54dddb){_0x582aaf=_0x582aaf-0x0;var _0x8ef3ef=_0xdda8[_0x582aaf];return _0x8ef3ef;};'use strict';var BPromise=require(_0x8dda('0x0'));var util=require(_0x8dda('0x1'));var moment=require(_0x8dda('0x2'));var server=require(_0x8dda('0x3'));var Realtime=require(_0x8dda('0x4'));var Report=require(_0x8dda('0x5'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x8dda('0x6'));var Preview=require(_0x8dda('0x7'));var Fax=require('./fax');var user=require(_0x8dda('0x8'));var voiceQueue=require(_0x8dda('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x8dda('0xa'));var trunk=require(_0x8dda('0xb'));var trigger=require(_0x8dda('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0x8dda('0xd'));var campaign=require(_0x8dda('0xe'));var voiceExtension=require(_0x8dda('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x8dda('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x8dda('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x8dda('0x12'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x8dda('0x13'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x8dda('0x14'));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()[_0x8dda('0x15')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x8dda('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x8dda('0x17')]()[_0x8dda('0x18')](user[_0x8dda('0x19')]())[_0x8dda('0x18')](realtime[_0x8dda('0x1a')]())[_0x8dda('0x18')](user[_0x8dda('0x1b')]())[_0x8dda('0x18')](realtime[_0x8dda('0x1c')]())[_0x8dda('0x18')](trunk['getTrunks']())[_0x8dda('0x18')](realtime['initTrunks']())[_0x8dda('0x18')](voiceQueue[_0x8dda('0x1d')]())[_0x8dda('0x18')](realtime[_0x8dda('0x1e')]())[_0x8dda('0x18')](trigger['getTriggers']())[_0x8dda('0x18')](realtime['initTriggers']())[_0x8dda('0x18')](template[_0x8dda('0x1f')]())[_0x8dda('0x18')](realtime[_0x8dda('0x20')]())[_0x8dda('0x18')](zendesk[_0x8dda('0x21')]())[_0x8dda('0x18')](realtime[_0x8dda('0x22')]())['then'](salesforce['getSalesforceAccounts']())[_0x8dda('0x18')](realtime['initSalesforceAccounts']())[_0x8dda('0x18')](sugarcrm['getSugarcrmAccounts']())[_0x8dda('0x18')](realtime[_0x8dda('0x23')]())[_0x8dda('0x18')](freshdesk[_0x8dda('0x24')]())[_0x8dda('0x18')](realtime[_0x8dda('0x25')]())[_0x8dda('0x18')](desk['getDeskAccounts']())[_0x8dda('0x18')](realtime[_0x8dda('0x26')]())[_0x8dda('0x18')](zoho['getZohoAccounts']())['then'](realtime[_0x8dda('0x27')]())[_0x8dda('0x18')](vtiger[_0x8dda('0x28')]())[_0x8dda('0x18')](realtime[_0x8dda('0x29')]())[_0x8dda('0x18')](freshsales[_0x8dda('0x2a')]())[_0x8dda('0x18')](realtime[_0x8dda('0x2b')]())['then'](servicenow[_0x8dda('0x2c')]())[_0x8dda('0x18')](realtime['initServicenowAccounts']())[_0x8dda('0x18')](dynamics365['getDynamics365Accounts']())[_0x8dda('0x18')](realtime[_0x8dda('0x2d')]())[_0x8dda('0x18')](campaign[_0x8dda('0x2e')]())['then'](realtime[_0x8dda('0x2f')]())['then'](voiceExtension[_0x8dda('0x30')]())[_0x8dda('0x18')](realtime[_0x8dda('0x31')]())['then'](faxAccount[_0x8dda('0x32')]())[_0x8dda('0x18')](realtime['initFaxAccounts']())[_0x8dda('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x8dda('0x17')]()[_0x8dda('0x18')](voiceQueueReport[_0x8dda('0x33')]())[_0x8dda('0x18')](realtime[_0x8dda('0x34')]())[_0x8dda('0x18')](cmHopperHistory[_0x8dda('0x35')]())[_0x8dda('0x18')](realtime[_0x8dda('0x36')]())['then'](cmHopperHistory[_0x8dda('0x37')]())[_0x8dda('0x18')](realtime[_0x8dda('0x38')]())[_0x8dda('0x18')](voiceCallReport[_0x8dda('0x39')]())[_0x8dda('0x18')](realtime[_0x8dda('0x3a')]())[_0x8dda('0x18')](function(_0x6e73dd){})['catch'](function(_0x3cb16e){console['log'](_0x3cb16e);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x41fc59){return initRealtime();})['then'](function(){return initParams();})[_0x8dda('0x18')](function(){report[_0x8dda('0x3b')]();setInterval(initRealtime,0x1388);})[_0x8dda('0x3c')](function(_0x4c0e60){console[_0x8dda('0x3d')](_0x4c0e60);});}main(); \ No newline at end of file +var _0x5e35=['initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','log','listen','sync','catch','bluebird','util','moment','./realtime','./report','./acw','./dialer','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initTriggers','initTemplates','initZendeskAccounts','getSalesforceAccounts'];(function(_0xd1fff0,_0x2f3df0){var _0x1fedcf=function(_0x54df7f){while(--_0x54df7f){_0xd1fff0['push'](_0xd1fff0['shift']());}};_0x1fedcf(++_0x2f3df0);}(_0x5e35,0x1af));var _0x55e3=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x5e35[_0x1e4360];return _0x31e6b4;};'use strict';var BPromise=require(_0x55e3('0x0'));var util=require(_0x55e3('0x1'));var moment=require(_0x55e3('0x2'));var server=require('./server');var Realtime=require(_0x55e3('0x3'));var Report=require(_0x55e3('0x4'));var Acw=require(_0x55e3('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x55e3('0x6'));var Preview=require('./preview');var Fax=require(_0x55e3('0x7'));var user=require(_0x55e3('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x55e3('0x9'));var voiceCallReport=require(_0x55e3('0xa'));var trunk=require(_0x55e3('0xb'));var trigger=require(_0x55e3('0xc'));var template=require(_0x55e3('0xd'));var cmHopperHistory=require(_0x55e3('0xe'));var campaign=require(_0x55e3('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x55e3('0x10'));var zendesk=require(_0x55e3('0x11'));var salesforce=require(_0x55e3('0x12'));var sugarcrm=require(_0x55e3('0x13'));var freshdesk=require(_0x55e3('0x14'));var desk=require(_0x55e3('0x15'));var zoho=require(_0x55e3('0x16'));var vtiger=require(_0x55e3('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x55e3('0x18')](_0x55e3('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x55e3('0x18')](_0x55e3('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x55e3('0x1a')]()[_0x55e3('0x1b')](user[_0x55e3('0x1c')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x1d')]())[_0x55e3('0x1b')](user[_0x55e3('0x1e')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x1f')]())[_0x55e3('0x1b')](trunk[_0x55e3('0x20')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x21')]())[_0x55e3('0x1b')](voiceQueue['getVoiceQueues']())[_0x55e3('0x1b')](realtime['initVoiceQueues']())[_0x55e3('0x1b')](trigger['getTriggers']())['then'](realtime[_0x55e3('0x22')]())[_0x55e3('0x1b')](template['getTemplates']())[_0x55e3('0x1b')](realtime[_0x55e3('0x23')]())['then'](zendesk['getZendeskAccounts']())[_0x55e3('0x1b')](realtime[_0x55e3('0x24')]())['then'](salesforce[_0x55e3('0x25')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x26')]())[_0x55e3('0x1b')](sugarcrm[_0x55e3('0x27')]())['then'](realtime[_0x55e3('0x28')]())[_0x55e3('0x1b')](freshdesk['getFreshdeskAccounts']())[_0x55e3('0x1b')](realtime[_0x55e3('0x29')]())[_0x55e3('0x1b')](desk[_0x55e3('0x2a')]())['then'](realtime[_0x55e3('0x2b')]())[_0x55e3('0x1b')](zoho[_0x55e3('0x2c')]())[_0x55e3('0x1b')](realtime['initZohoAccounts']())['then'](vtiger[_0x55e3('0x2d')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x2e')]())[_0x55e3('0x1b')](freshsales[_0x55e3('0x2f')]())['then'](realtime[_0x55e3('0x30')]())[_0x55e3('0x1b')](servicenow[_0x55e3('0x31')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x32')]())[_0x55e3('0x1b')](dynamics365[_0x55e3('0x33')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x34')]())[_0x55e3('0x1b')](campaign['getCampaigns']())[_0x55e3('0x1b')](realtime[_0x55e3('0x35')]())[_0x55e3('0x1b')](voiceExtension[_0x55e3('0x36')]())['then'](realtime[_0x55e3('0x37')]())[_0x55e3('0x1b')](faxAccount[_0x55e3('0x38')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x39')]())[_0x55e3('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x55e3('0x1a')]()[_0x55e3('0x1b')](voiceQueueReport['getVoiceQueueReports']())[_0x55e3('0x1b')](realtime[_0x55e3('0x3a')]())[_0x55e3('0x1b')](cmHopperHistory[_0x55e3('0x3b')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x3c')]())[_0x55e3('0x1b')](cmHopperHistory['getCampaignHopperHistory']())[_0x55e3('0x1b')](realtime[_0x55e3('0x3d')]())[_0x55e3('0x1b')](voiceCallReport[_0x55e3('0x3e')]())['then'](realtime['initVoiceCallReports']())[_0x55e3('0x1b')](function(_0x2a9172){})['catch'](function(_0x1cce44){console[_0x55e3('0x3f')](_0x1cce44);});}function main(){return server[_0x55e3('0x40')](realtime,preview,fax)[_0x55e3('0x1b')](function(_0x28c680){return initRealtime();})[_0x55e3('0x1b')](function(){return initParams();})[_0x55e3('0x1b')](function(){report[_0x55e3('0x41')]();setInterval(initRealtime,0x1388);})[_0x55e3('0x42')](function(_0x51f8c9){console[_0x55e3('0x3f')](_0x51f8c9);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 6dd3a14..96210b9 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 _0xeb75=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','state','toLowerCase','not_inuse','idle','talking','statePause','toNumber','stringify','format','emit','user:save','exports','util','moment','md5','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x226adc,_0x361a3c){var _0x154b10=function(_0x8578b4){while(--_0x8578b4){_0x226adc['push'](_0x226adc['shift']());}};_0x154b10(++_0x361a3c);}(_0xeb75,0x119));var _0x5eb7=function(_0x3f6a5a,_0x41108a){_0x3f6a5a=_0x3f6a5a-0x0;var _0x54d9e3=_0xeb75[_0x3f6a5a];return _0x54d9e3;};'use strict';var _=require('lodash');var util=require(_0x5eb7('0x0'));var moment=require(_0x5eb7('0x1'));var md5=require(_0x5eb7('0x2'));var Redis=require('ioredis');var config=require(_0x5eb7('0x3'));config['redis']=_[_0x5eb7('0x4')](config[_0x5eb7('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x5eb7('0x6'))(new Redis(config[_0x5eb7('0x5')]));function Agent(_0x4ba4d3){this['id']=_0x4ba4d3['id']||0x0;this[_0x5eb7('0x7')]=_0x4ba4d3['name']||'';this[_0x5eb7('0x8')]=_0x4ba4d3[_0x5eb7('0x8')]||'';this[_0x5eb7('0x9')]=_0x4ba4d3[_0x5eb7('0x9')]||'';this[_0x5eb7('0xa')]=_0x4ba4d3[_0x5eb7('0xa')]||'';this['state']=_0x5eb7('0xb');this[_0x5eb7('0xc')]=0x0;this[_0x5eb7('0xd')]=_0x5eb7('0xb');this[_0x5eb7('0xe')]='';this['phone']='';this[_0x5eb7('0xf')]='';this['interface']='';this[_0x5eb7('0x10')]=_0x4ba4d3[_0x5eb7('0x10')]||![];this[_0x5eb7('0x11')]=_0x5eb7('0xb');this[_0x5eb7('0x12')]=0x0;this[_0x5eb7('0x13')]='';this[_0x5eb7('0x14')]='';this[_0x5eb7('0x15')]=![];this[_0x5eb7('0x16')]=![];this[_0x5eb7('0x2')]='';}Agent[_0x5eb7('0x17')]['updateStatusRealtime']=function(_0x5965b9){var _0x12290d;if(_0x5965b9&&_0x5965b9[_0x5eb7('0x18')]){_0x12290d=_0x5965b9[_0x5eb7('0x18')][_0x5eb7('0x19')]();switch(_0x12290d){case _0x5eb7('0x1a'):_0x12290d=_0x5eb7('0x1b');break;case'inuse':_0x12290d=_0x5eb7('0x1c');break;}}if(_0x12290d&&this['voiceStatus']!==_0x12290d||_0x5965b9[_0x5eb7('0x1d')]){this[_0x5eb7('0x12')]=_[_0x5eb7('0x1e')](moment()['format']('x'));}if(_0x12290d){this[_0x5eb7('0x11')]=_0x12290d;}var _0x3e1f8e={'id':this['id'],'name':this[_0x5eb7('0x7')],'email':this[_0x5eb7('0x8')],'accountcode':this[_0x5eb7('0x9')],'fullname':this[_0x5eb7('0xa')],'state':this[_0x5eb7('0x18')],'stateTime':this[_0x5eb7('0xc')],'status':this['status'],'address':this[_0x5eb7('0xe')],'online':this[_0x5eb7('0x10')],'voiceStatus':this[_0x5eb7('0x11')],'voiceStatusTime':this[_0x5eb7('0x12')],'voiceStatusCallerIdNumber':this[_0x5eb7('0x13')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x5eb7('0x15')]};var _0xa3c164=md5(JSON[_0x5eb7('0x1f')](_0x3e1f8e));if(this['md5']!==_0xa3c164){this[_0x5eb7('0x2')]=_0xa3c164;io['to'](util[_0x5eb7('0x20')]('user:%s',_0x3e1f8e[_0x5eb7('0x7')]))[_0x5eb7('0x21')](_0x5eb7('0x22'),_0x3e1f8e);}};module[_0x5eb7('0x23')]=Agent; \ No newline at end of file +var _0x32f4=['localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','toNumber','format','voiceStatusCallerIdNumber','voiceStatusQueue','stringify','user:%s','emit','user:save','lodash','util','moment','md5','ioredis','redis','defaults'];(function(_0x1002b4,_0x3f09fb){var _0x3a4e7f=function(_0x169d02){while(--_0x169d02){_0x1002b4['push'](_0x1002b4['shift']());}};_0x3a4e7f(++_0x3f09fb);}(_0x32f4,0x74));var _0x432f=function(_0x58d25c,_0x4e9bdf){_0x58d25c=_0x58d25c-0x0;var _0xf17b59=_0x32f4[_0x58d25c];return _0xf17b59;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var md5=require(_0x432f('0x3'));var Redis=require(_0x432f('0x4'));var config=require('../../../config/environment');config[_0x432f('0x5')]=_[_0x432f('0x6')](config[_0x432f('0x5')],{'host':_0x432f('0x7'),'port':0x18eb});var io=require(_0x432f('0x8'))(new Redis(config[_0x432f('0x5')]));function Agent(_0xe36511){this['id']=_0xe36511['id']||0x0;this[_0x432f('0x9')]=_0xe36511[_0x432f('0x9')]||'';this['email']=_0xe36511[_0x432f('0xa')]||'';this[_0x432f('0xb')]=_0xe36511[_0x432f('0xb')]||'';this[_0x432f('0xc')]=_0xe36511[_0x432f('0xc')]||'';this[_0x432f('0xd')]=_0x432f('0xe');this[_0x432f('0xf')]=0x0;this[_0x432f('0x10')]='unknown';this[_0x432f('0x11')]='';this[_0x432f('0x12')]='';this[_0x432f('0x13')]='';this[_0x432f('0x14')]='';this[_0x432f('0x15')]=_0xe36511[_0x432f('0x15')]||![];this[_0x432f('0x16')]='unknown';this[_0x432f('0x17')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x432f('0x18')]=![];this[_0x432f('0x19')]=![];this['md5']='';}Agent[_0x432f('0x1a')][_0x432f('0x1b')]=function(_0x116529){var _0x22f2b6;if(_0x116529&&_0x116529[_0x432f('0xd')]){_0x22f2b6=_0x116529[_0x432f('0xd')][_0x432f('0x1c')]();switch(_0x22f2b6){case _0x432f('0x1d'):_0x22f2b6=_0x432f('0x1e');break;case _0x432f('0x1f'):_0x22f2b6=_0x432f('0x20');break;}}if(_0x22f2b6&&this[_0x432f('0x16')]!==_0x22f2b6||_0x116529['statePause']){this[_0x432f('0x17')]=_[_0x432f('0x21')](moment()[_0x432f('0x22')]('x'));}if(_0x22f2b6){this['voiceStatus']=_0x22f2b6;}var _0x24cd50={'id':this['id'],'name':this[_0x432f('0x9')],'email':this[_0x432f('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x432f('0xc')],'state':this[_0x432f('0xd')],'stateTime':this[_0x432f('0xf')],'status':this[_0x432f('0x10')],'address':this['address'],'online':this[_0x432f('0x15')],'voiceStatus':this[_0x432f('0x16')],'voiceStatusTime':this[_0x432f('0x17')],'voiceStatusCallerIdNumber':this[_0x432f('0x23')],'voiceStatusQueue':this[_0x432f('0x24')],'interface':this[_0x432f('0x14')],'onhold':this[_0x432f('0x18')]};var _0x2b22d2=md5(JSON[_0x432f('0x25')](_0x24cd50));if(this[_0x432f('0x3')]!==_0x2b22d2){this['md5']=_0x2b22d2;io['to'](util['format'](_0x432f('0x26'),_0x24cd50[_0x432f('0x9')]))[_0x432f('0x27')](_0x432f('0x28'),_0x24cd50);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 15af07a..79a8bd0 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 _0x64b3=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName'];(function(_0x3ebf02,_0xf76869){var _0x346dcb=function(_0x710aad){while(--_0x710aad){_0x3ebf02['push'](_0x3ebf02['shift']());}};_0x346dcb(++_0xf76869);}(_0x64b3,0xe6));var _0x364b=function(_0x30d31d,_0x2b11bf){_0x30d31d=_0x30d31d-0x0;var _0x3c2ffb=_0x64b3[_0x30d31d];return _0x3c2ffb;};'use strict';function Campaign(_0x24cb41){this['id']=_0x24cb41['id']||0x0;this[_0x364b('0x0')]=_0x24cb41[_0x364b('0x0')]||'';this['type']=_0x24cb41[_0x364b('0x1')]||_0x364b('0x2');this[_0x364b('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x364b('0x4')]=!![];this[_0x364b('0x5')]=_0x24cb41[_0x364b('0x5')];this[_0x364b('0x6')]=_0x24cb41[_0x364b('0x6')];this[_0x364b('0x7')]=_0x24cb41[_0x364b('0x7')]||null;this[_0x364b('0x8')]=_0x24cb41[_0x364b('0x8')]?_0x24cb41[_0x364b('0x8')]:null;this[_0x364b('0x9')]=_0x24cb41[_0x364b('0x9')];this['dialOriginateCallerIdNumber']=_0x24cb41[_0x364b('0xa')];this[_0x364b('0xb')]=_0x24cb41[_0x364b('0xb')]||0x1e;this[_0x364b('0xc')]=_0x24cb41[_0x364b('0xc')];this[_0x364b('0xd')]=_0x24cb41['dialCongestionRetryFrequency'];this[_0x364b('0xe')]=_0x24cb41['dialBusyMaxRetry'];this[_0x364b('0xf')]=_0x24cb41[_0x364b('0xf')];this[_0x364b('0x10')]=_0x24cb41[_0x364b('0x10')];this[_0x364b('0x11')]=_0x24cb41[_0x364b('0x11')];this[_0x364b('0x12')]=_0x24cb41[_0x364b('0x12')];this[_0x364b('0x13')]=_0x24cb41[_0x364b('0x13')]||0x3;this[_0x364b('0x14')]=_0x24cb41['dialNoSuchNumberRetryFrequency']||0x96;this[_0x364b('0x15')]=_0x24cb41[_0x364b('0x15')]||0x3;this['dialDropRetryFrequency']=_0x24cb41[_0x364b('0x16')]||0x96;this[_0x364b('0x17')]=_0x24cb41[_0x364b('0x17')]||0x3;this[_0x364b('0x18')]=_0x24cb41[_0x364b('0x18')]||0x96;this[_0x364b('0x19')]=_0x24cb41[_0x364b('0x19')]||0x3;this[_0x364b('0x1a')]=_0x24cb41['dialMachineRetryFrequency']||0x96;this[_0x364b('0x1b')]=_0x24cb41['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x24cb41[_0x364b('0x1c')]||0x96;this[_0x364b('0x1d')]=_0x24cb41['dialOrderByScheduledAt']||_0x364b('0x1e');this['dialPrefix']=_0x24cb41[_0x364b('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x24cb41['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x364b('0x20')]=_0x24cb41['dialCutDigit']||undefined;this[_0x364b('0x21')]=_0x24cb41[_0x364b('0x21')]?_0x24cb41[_0x364b('0x21')]:undefined;this[_0x364b('0x22')]=_0x24cb41['Trunk']?_0x24cb41[_0x364b('0x22')]:undefined;this['Interval']=_0x24cb41[_0x364b('0x23')]?_0x24cb41['Interval']:undefined;this[_0x364b('0x24')]=_0x24cb41['SquareProject']?_0x24cb41[_0x364b('0x24')]:undefined;this[_0x364b('0x25')]=_0x24cb41[_0x364b('0x24')]?_0x24cb41[_0x364b('0x24')][_0x364b('0x0')]:undefined;this['dialAMDActive']=_0x24cb41[_0x364b('0x26')]||![];this[_0x364b('0x27')]=_0x24cb41[_0x364b('0x27')];this[_0x364b('0x28')]=_0x24cb41['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x24cb41[_0x364b('0x29')];this[_0x364b('0x2a')]=_0x24cb41[_0x364b('0x2a')];this['dialAMDMinWordLength']=_0x24cb41['dialAMDMinWordLength'];this[_0x364b('0x2b')]=_0x24cb41['dialAMDBetweenWordsSilence'];this[_0x364b('0x2c')]=_0x24cb41[_0x364b('0x2c')];this[_0x364b('0x2d')]=_0x24cb41['dialAMDSilenceThreshold'];this[_0x364b('0x2e')]=_0x24cb41[_0x364b('0x2e')];}module[_0x364b('0x2f')]=Campaign; \ No newline at end of file +var _0xb731=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x449a3d,_0x122735){var _0x41ec24=function(_0x12de68){while(--_0x12de68){_0x449a3d['push'](_0x449a3d['shift']());}};_0x41ec24(++_0x122735);}(_0xb731,0x15e));var _0x1b73=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xb731[_0x5c9307];return _0x373e29;};'use strict';function Campaign(_0x5a239b){this['id']=_0x5a239b['id']||0x0;this[_0x1b73('0x0')]=_0x5a239b[_0x1b73('0x0')]||'';this[_0x1b73('0x1')]=_0x5a239b[_0x1b73('0x1')]||'campaign';this['originated']=0x0;this[_0x1b73('0x2')]=0x0;this[_0x1b73('0x3')]=0x0;this[_0x1b73('0x4')]=0x0;this[_0x1b73('0x5')]='';this[_0x1b73('0x6')]=!![];this[_0x1b73('0x7')]=_0x5a239b[_0x1b73('0x7')];this[_0x1b73('0x8')]=_0x5a239b[_0x1b73('0x8')];this[_0x1b73('0x9')]=_0x5a239b[_0x1b73('0x9')]||null;this[_0x1b73('0xa')]=_0x5a239b[_0x1b73('0xa')]?_0x5a239b[_0x1b73('0xa')]:null;this['dialOriginateCallerIdName']=_0x5a239b[_0x1b73('0xb')];this[_0x1b73('0xc')]=_0x5a239b[_0x1b73('0xc')];this['dialOriginateTimeout']=_0x5a239b[_0x1b73('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x5a239b[_0x1b73('0xe')];this[_0x1b73('0xf')]=_0x5a239b[_0x1b73('0xf')];this[_0x1b73('0x10')]=_0x5a239b[_0x1b73('0x10')];this[_0x1b73('0x11')]=_0x5a239b[_0x1b73('0x11')];this['dialNoAnswerMaxRetry']=_0x5a239b['dialNoAnswerMaxRetry'];this[_0x1b73('0x12')]=_0x5a239b['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x5a239b[_0x1b73('0x13')];this['dialNoSuchNumberMaxRetry']=_0x5a239b[_0x1b73('0x14')]||0x3;this[_0x1b73('0x15')]=_0x5a239b[_0x1b73('0x15')]||0x96;this[_0x1b73('0x16')]=_0x5a239b[_0x1b73('0x16')]||0x3;this[_0x1b73('0x17')]=_0x5a239b[_0x1b73('0x17')]||0x96;this[_0x1b73('0x18')]=_0x5a239b[_0x1b73('0x18')]||0x3;this[_0x1b73('0x19')]=_0x5a239b[_0x1b73('0x19')]||0x96;this[_0x1b73('0x1a')]=_0x5a239b[_0x1b73('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x5a239b[_0x1b73('0x1b')]||0x96;this[_0x1b73('0x1c')]=_0x5a239b['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x5a239b[_0x1b73('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x5a239b['dialOrderByScheduledAt']||'DESC';this['dialPrefix']=_0x5a239b['dialPrefix']||undefined;this[_0x1b73('0x1e')]=_0x5a239b['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x1b73('0x1f')]=_0x5a239b[_0x1b73('0x1f')]||undefined;this['TrunkBackup']=_0x5a239b[_0x1b73('0x20')]?_0x5a239b[_0x1b73('0x20')]:undefined;this[_0x1b73('0x21')]=_0x5a239b[_0x1b73('0x21')]?_0x5a239b[_0x1b73('0x21')]:undefined;this[_0x1b73('0x22')]=_0x5a239b[_0x1b73('0x22')]?_0x5a239b[_0x1b73('0x22')]:undefined;this[_0x1b73('0x23')]=_0x5a239b[_0x1b73('0x23')]?_0x5a239b[_0x1b73('0x23')]:undefined;this[_0x1b73('0x24')]=_0x5a239b['SquareProject']?_0x5a239b['SquareProject'][_0x1b73('0x0')]:undefined;this['dialAMDActive']=_0x5a239b[_0x1b73('0x25')]||![];this['dialAMDInitialSilence']=_0x5a239b[_0x1b73('0x26')];this[_0x1b73('0x27')]=_0x5a239b[_0x1b73('0x27')];this[_0x1b73('0x28')]=_0x5a239b[_0x1b73('0x28')];this['dialAMDTotalAnalysisTime']=_0x5a239b['dialAMDTotalAnalysisTime'];this[_0x1b73('0x29')]=_0x5a239b[_0x1b73('0x29')];this[_0x1b73('0x2a')]=_0x5a239b[_0x1b73('0x2a')];this[_0x1b73('0x2b')]=_0x5a239b['dialAMDMaximumNumberOfWords'];this[_0x1b73('0x2c')]=_0x5a239b[_0x1b73('0x2c')];this[_0x1b73('0x2d')]=_0x5a239b[_0x1b73('0x2d')];}module[_0x1b73('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index fc8dcd2..d71f3ed 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 _0x29b1=['accountcode','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','holdtime','type','disposition','monitorFilename','monitors','mohtime','channel','connectedlinenum','connectedlinename'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0x29b1,0xbb));var _0x129b=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x29b1[_0x1b828b];return _0x98da1a;};'use strict';function Channel(){this['starttime']=null;this[_0x129b('0x0')]='';this['destinationchannel']='';this['calleridnum']=0x0;this['calleridname']='';this[_0x129b('0x1')]=undefined;this[_0x129b('0x2')]=undefined;this[_0x129b('0x3')]=0x0;this['context']='';this[_0x129b('0x4')]=0x0;this[_0x129b('0x5')]=0x0;this[_0x129b('0x6')]=0x0;this[_0x129b('0x7')]=![];this['answertime']=null;this[_0x129b('0x8')]=null;this[_0x129b('0x9')]=![];this[_0x129b('0xa')]=![];this[_0x129b('0xb')]='';this[_0x129b('0xc')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x129b('0xd')]=0x0;this[_0x129b('0xe')]=null;this['tag']=null;this[_0x129b('0xf')]=null;this['monitor']=![];this[_0x129b('0x10')]=null;this['queue']=null;this[_0x129b('0x11')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x129b('0x12')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x9d01=['destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','queue','monitors','transfercalleridnum','transferconnectedlinenum','starttime','channel'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x9d01,0x1ec));var _0x19d0=function(_0x155e04,_0x28cd61){_0x155e04=_0x155e04-0x0;var _0x4590d0=_0x9d01[_0x155e04];return _0x4590d0;};'use strict';function Channel(){this[_0x19d0('0x0')]=null;this[_0x19d0('0x1')]='';this[_0x19d0('0x2')]='';this[_0x19d0('0x3')]=0x0;this[_0x19d0('0x4')]='';this[_0x19d0('0x5')]=undefined;this[_0x19d0('0x6')]=undefined;this[_0x19d0('0x7')]=0x0;this['context']='';this[_0x19d0('0x8')]=0x0;this['linkedid']=0x0;this[_0x19d0('0x9')]=0x0;this[_0x19d0('0xa')]=![];this[_0x19d0('0xb')]=null;this['endtime']=null;this[_0x19d0('0xc')]=![];this[_0x19d0('0xd')]=![];this[_0x19d0('0xe')]='';this[_0x19d0('0xf')]='';this[_0x19d0('0x10')]=0x0;this[_0x19d0('0x11')]=0x0;this[_0x19d0('0x12')]=0x0;this[_0x19d0('0x13')]=null;this[_0x19d0('0x14')]=null;this[_0x19d0('0x15')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x19d0('0x16')]=null;this[_0x19d0('0x17')]=[];this[_0x19d0('0x18')]=undefined;this[_0x19d0('0x19')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index a55e5f3..23fe2b1 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 _0x1670=['name','username','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports'];(function(_0x513693,_0x49979c){var _0x5d531b=function(_0x2efa51){while(--_0x2efa51){_0x513693['push'](_0x513693['shift']());}};_0x5d531b(++_0x49979c);}(_0x1670,0x9a));var _0x0167=function(_0x3063d2,_0x587566){_0x3063d2=_0x3063d2-0x0;var _0x3c99d6=_0x1670[_0x3063d2];return _0x3c99d6;};'use strict';function DeskAccount(_0x2a4634){this['id']=_0x2a4634['id']||0x0;this[_0x0167('0x0')]=_0x2a4634['name']||'';this[_0x0167('0x1')]=_0x2a4634['username']||'';this[_0x0167('0x2')]=_0x2a4634[_0x0167('0x2')]||'';this[_0x0167('0x3')]=_0x2a4634[_0x0167('0x3')]||'';this['password']=_0x2a4634['password']||'';this[_0x0167('0x4')]=_0x2a4634[_0x0167('0x4')]||'';this[_0x0167('0x5')]=_0x2a4634[_0x0167('0x5')]||'';this[_0x0167('0x6')]=_0x2a4634[_0x0167('0x6')]||'';this[_0x0167('0x7')]=_0x2a4634[_0x0167('0x7')]||'';this['type']=_0x2a4634['type']||'';this[_0x0167('0x8')]=_0x2a4634[_0x0167('0x8')]||'';this[_0x0167('0x9')]=_0x2a4634[_0x0167('0x9')]||{};}module[_0x0167('0xa')]=DeskAccount; \ No newline at end of file +var _0xc01b=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','password','consumerKey','consumerSecret','token'];(function(_0x3ec209,_0x36dea6){var _0x248999=function(_0x2c3998){while(--_0x2c3998){_0x3ec209['push'](_0x3ec209['shift']());}};_0x248999(++_0x36dea6);}(_0xc01b,0x65));var _0xbc01=function(_0x4f0464,_0x2b747f){_0x4f0464=_0x4f0464-0x0;var _0x5d072d=_0xc01b[_0x4f0464];return _0x5d072d;};'use strict';function DeskAccount(_0x1a44cb){this['id']=_0x1a44cb['id']||0x0;this[_0xbc01('0x0')]=_0x1a44cb[_0xbc01('0x0')]||'';this[_0xbc01('0x1')]=_0x1a44cb['username']||'';this[_0xbc01('0x2')]=_0x1a44cb[_0xbc01('0x2')]||'';this['authType']=_0x1a44cb['authType']||'';this['password']=_0x1a44cb[_0xbc01('0x3')]||'';this[_0xbc01('0x4')]=_0x1a44cb['consumerKey']||'';this['consumerSecret']=_0x1a44cb[_0xbc01('0x5')]||'';this[_0xbc01('0x6')]=_0x1a44cb[_0xbc01('0x6')]||'';this[_0xbc01('0x7')]=_0x1a44cb[_0xbc01('0x7')]||'';this[_0xbc01('0x8')]=_0x1a44cb[_0xbc01('0x8')]||'';this['serverUrl']=_0x1a44cb[_0xbc01('0x9')]||'';this[_0xbc01('0xa')]=_0x1a44cb[_0xbc01('0xa')]||{};}module[_0xbc01('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 16ec302..d78a7ce 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 _0x6b97=['username','password','remoteUri','tenantId','clientId','serverUrl','Configurations','exports','name'];(function(_0x44878f,_0x318b51){var _0x12c603=function(_0x56f15a){while(--_0x56f15a){_0x44878f['push'](_0x44878f['shift']());}};_0x12c603(++_0x318b51);}(_0x6b97,0x7d));var _0x76b9=function(_0x4f2e9a,_0x4507b3){_0x4f2e9a=_0x4f2e9a-0x0;var _0x36325b=_0x6b97[_0x4f2e9a];return _0x36325b;};'use strict';function Dynamics365Account(_0x39ad79){this['id']=_0x39ad79['id']||0x0;this[_0x76b9('0x0')]=_0x39ad79[_0x76b9('0x0')]||'';this[_0x76b9('0x1')]=_0x39ad79['username']||'';this['password']=_0x39ad79[_0x76b9('0x2')]||'';this['remoteUri']=_0x39ad79[_0x76b9('0x3')]||'';this[_0x76b9('0x4')]=_0x39ad79[_0x76b9('0x4')]||'';this[_0x76b9('0x5')]=_0x39ad79['clientId']||'';this['clientSecret']=_0x39ad79['clientSecret']||{};this[_0x76b9('0x6')]=_0x39ad79[_0x76b9('0x6')]||'';this[_0x76b9('0x7')]=_0x39ad79[_0x76b9('0x7')]||{};}module[_0x76b9('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xc86a=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name'];(function(_0x23485b,_0x49ee2a){var _0x4fa124=function(_0x85c3f1){while(--_0x85c3f1){_0x23485b['push'](_0x23485b['shift']());}};_0x4fa124(++_0x49ee2a);}(_0xc86a,0x128));var _0xac86=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xc86a[_0x1e3671];return _0x48d5f5;};'use strict';function Dynamics365Account(_0x4aad09){this['id']=_0x4aad09['id']||0x0;this[_0xac86('0x0')]=_0x4aad09['name']||'';this[_0xac86('0x1')]=_0x4aad09['username']||'';this[_0xac86('0x2')]=_0x4aad09[_0xac86('0x2')]||'';this['remoteUri']=_0x4aad09[_0xac86('0x3')]||'';this['tenantId']=_0x4aad09[_0xac86('0x4')]||'';this[_0xac86('0x5')]=_0x4aad09[_0xac86('0x5')]||'';this[_0xac86('0x6')]=_0x4aad09[_0xac86('0x6')]||{};this[_0xac86('0x7')]=_0x4aad09[_0xac86('0x7')]||'';this['Configurations']=_0x4aad09[_0xac86('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 30d1f6e..b8e09bb 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 _0xcd2f=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcd2f[_0x17d9e3];return _0x14192d;};'use strict';function FaxAccount(_0x26ff95){this['id']=_0x26ff95['id']||0x0;this['name']=_0x26ff95['name']||'';this[_0xfcd2('0x0')]=_0x26ff95[_0xfcd2('0x0')];this[_0xfcd2('0x1')]=_0x26ff95[_0xfcd2('0x1')];this[_0xfcd2('0x2')]=_0x26ff95[_0xfcd2('0x2')];this[_0xfcd2('0x3')]=_0x26ff95[_0xfcd2('0x3')];this['minrate']=_0x26ff95[_0xfcd2('0x4')]||0x960;this[_0xfcd2('0x5')]=_0x26ff95[_0xfcd2('0x5')]||0x3840;this[_0xfcd2('0x6')]=_0x26ff95[_0xfcd2('0x6')]||_0xfcd2('0x7');this[_0xfcd2('0x8')]=_0x26ff95[_0xfcd2('0x8')]||'no';this[_0xfcd2('0x9')]=_0x26ff95[_0xfcd2('0x9')]||'no';this[_0xfcd2('0xa')]=_0x26ff95['t38timeout']||0x1388;this[_0xfcd2('0xb')]=_0x26ff95[_0xfcd2('0xb')]||_0xfcd2('0xc');this[_0xfcd2('0xd')]=_0x26ff95[_0xfcd2('0xd')]?_0x26ff95['Trunk']:undefined;this['ListId']=_0x26ff95['ListId'];this['key']=_0x26ff95['key'];}module[_0xfcd2('0xe')]=FaxAccount; \ No newline at end of file +var _0xaeff=['name','description','headerinfo','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports'];(function(_0x52a9a6,_0x24737c){var _0x14b05a=function(_0x7c26eb){while(--_0x7c26eb){_0x52a9a6['push'](_0x52a9a6['shift']());}};_0x14b05a(++_0x24737c);}(_0xaeff,0x179));var _0xfaef=function(_0x2fb34a,_0x4938e8){_0x2fb34a=_0x2fb34a-0x0;var _0x2f022b=_0xaeff[_0x2fb34a];return _0x2f022b;};'use strict';function FaxAccount(_0x1dfd25){this['id']=_0x1dfd25['id']||0x0;this[_0xfaef('0x0')]=_0x1dfd25[_0xfaef('0x0')]||'';this[_0xfaef('0x1')]=_0x1dfd25[_0xfaef('0x1')];this['ecm']=_0x1dfd25['ecm'];this['headerinfo']=_0x1dfd25[_0xfaef('0x2')];this['localstationid']=_0x1dfd25['localstationid'];this['minrate']=_0x1dfd25['minrate']||0x960;this[_0xfaef('0x3')]=_0x1dfd25['maxrate']||0x3840;this[_0xfaef('0x4')]=_0x1dfd25['modem']||'v17,v27,v29';this[_0xfaef('0x5')]=_0x1dfd25[_0xfaef('0x5')]||'no';this[_0xfaef('0x6')]=_0x1dfd25[_0xfaef('0x6')]||'no';this['t38timeout']=_0x1dfd25[_0xfaef('0x7')]||0x1388;this[_0xfaef('0x8')]=_0x1dfd25[_0xfaef('0x8')]||'SIP';this[_0xfaef('0x9')]=_0x1dfd25[_0xfaef('0x9')]?_0x1dfd25[_0xfaef('0x9')]:undefined;this[_0xfaef('0xa')]=_0x1dfd25['ListId'];this[_0xfaef('0xb')]=_0x1dfd25[_0xfaef('0xb')];}module[_0xfaef('0xc')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 7cb4857..15f584e 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 _0x23a0=['serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x2f6914,_0x5589d2){var _0x421fd6=function(_0x4b4ac1){while(--_0x4b4ac1){_0x2f6914['push'](_0x2f6914['shift']());}};_0x421fd6(++_0x5589d2);}(_0x23a0,0x1d1));var _0x023a=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x23a0[_0x15b399];return _0x199f2d;};'use strict';function FreshdeskAccount(_0x3f2a7f){this['id']=_0x3f2a7f['id']||0x0;this[_0x023a('0x0')]=_0x3f2a7f[_0x023a('0x0')]||'';this[_0x023a('0x1')]=_0x3f2a7f['username']||'';this[_0x023a('0x2')]=_0x3f2a7f['token']||'';this['remoteUri']=_0x3f2a7f['remoteUri']||'';this[_0x023a('0x3')]=_0x3f2a7f[_0x023a('0x3')]||'';this[_0x023a('0x4')]=_0x3f2a7f[_0x023a('0x4')]||{};}module[_0x023a('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xd46f=['remoteUri','serverUrl','Configurations','name','username','apiKey','token'];(function(_0x328a2a,_0x16e1b7){var _0x36bd51=function(_0x249917){while(--_0x249917){_0x328a2a['push'](_0x328a2a['shift']());}};_0x36bd51(++_0x16e1b7);}(_0xd46f,0xe3));var _0xfd46=function(_0x4dd759,_0x1ee8c0){_0x4dd759=_0x4dd759-0x0;var _0x53177e=_0xd46f[_0x4dd759];return _0x53177e;};'use strict';function FreshdeskAccount(_0xc61ca9){this['id']=_0xc61ca9['id']||0x0;this[_0xfd46('0x0')]=_0xc61ca9['name']||'';this[_0xfd46('0x1')]=_0xc61ca9['username']||'';this[_0xfd46('0x2')]=_0xc61ca9[_0xfd46('0x3')]||'';this[_0xfd46('0x4')]=_0xc61ca9[_0xfd46('0x4')]||'';this[_0xfd46('0x5')]=_0xc61ca9[_0xfd46('0x5')]||'';this[_0xfd46('0x6')]=_0xc61ca9[_0xfd46('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 73b3314..98be750 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 _0xe0b6=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x33d67e,_0x2c5a4b){var _0x138fae=function(_0x431b55){while(--_0x431b55){_0x33d67e['push'](_0x33d67e['shift']());}};_0x138fae(++_0x2c5a4b);}(_0xe0b6,0x1b2));var _0x6e0b=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0xe0b6[_0x58a4fe];return _0x697de2;};'use strict';function FreshsalesAccount(_0x47fe32){this['id']=_0x47fe32['id']||0x0;this['name']=_0x47fe32[_0x6e0b('0x0')]||'';this[_0x6e0b('0x1')]=_0x47fe32['username']||'';this[_0x6e0b('0x2')]=_0x47fe32[_0x6e0b('0x3')]||'';this['remoteUri']=_0x47fe32[_0x6e0b('0x4')]||'';this[_0x6e0b('0x5')]=_0x47fe32['serverUrl']||'';this[_0x6e0b('0x6')]=_0x47fe32[_0x6e0b('0x6')]||{};}module[_0x6e0b('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x4477=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x263a71,_0x3a917a){var _0x2d5a72=function(_0x709c6){while(--_0x709c6){_0x263a71['push'](_0x263a71['shift']());}};_0x2d5a72(++_0x3a917a);}(_0x4477,0xb1));var _0x7447=function(_0x30aa58,_0xf0491){_0x30aa58=_0x30aa58-0x0;var _0x31a094=_0x4477[_0x30aa58];return _0x31a094;};'use strict';function FreshsalesAccount(_0x43960a){this['id']=_0x43960a['id']||0x0;this[_0x7447('0x0')]=_0x43960a[_0x7447('0x0')]||'';this[_0x7447('0x1')]=_0x43960a[_0x7447('0x1')]||'';this[_0x7447('0x2')]=_0x43960a[_0x7447('0x3')]||'';this[_0x7447('0x4')]=_0x43960a[_0x7447('0x4')]||'';this['serverUrl']=_0x43960a[_0x7447('0x5')]||'';this[_0x7447('0x6')]=_0x43960a[_0x7447('0x6')]||{};}module[_0x7447('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 07535b5..91288a2 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 _0xe61a=['variables','exports','type','inbound','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','priority','holdtime','assigned','lastAssignedTo'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe61a,0x120));var _0xae61=function(_0x46565c,_0x461ee3){_0x46565c=_0x46565c-0x0;var _0x5f2898=_0xe61a[_0x46565c];return _0x5f2898;};'use strict';function QueueReport(){this[_0xae61('0x0')]=_0xae61('0x1');this['uniqueid']='';this[_0xae61('0x2')]='';this['calleridname']='';this[_0xae61('0x3')]='';this[_0xae61('0x4')]=null;this[_0xae61('0x5')]=null;this['position']=0x1;this[_0xae61('0x6')]=0x1;this[_0xae61('0x7')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0xae61('0x8')]=null;this[_0xae61('0x9')]=![];this[_0xae61('0xa')]=null;this[_0xae61('0xb')]=0x1;this[_0xae61('0xc')]='';this['connectedlinenum']='';this[_0xae61('0xd')]='';this[_0xae61('0xe')]='';this[_0xae61('0xf')]='';this['exten']='';this[_0xae61('0x10')]='';this[_0xae61('0x11')]=0x0;this[_0xae61('0x12')]=![];this[_0xae61('0x13')]='';this['mohtime']=0x0;this[_0xae61('0x14')]={};}module[_0xae61('0x15')]=QueueReport; \ No newline at end of file +var _0x0f98=['queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','lastAssignedTo','variables','exports','type','inbound','calleridnum','calleridname','queue'];(function(_0xf8f775,_0x3a58aa){var _0xff22ad=function(_0x224464){while(--_0x224464){_0xf8f775['push'](_0xf8f775['shift']());}};_0xff22ad(++_0x3a58aa);}(_0x0f98,0xc3));var _0x80f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f98[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0x80f9('0x0')]=_0x80f9('0x1');this['uniqueid']='';this[_0x80f9('0x2')]='';this[_0x80f9('0x3')]='';this[_0x80f9('0x4')]='';this['queuecallerjoinAt']=null;this[_0x80f9('0x5')]=null;this[_0x80f9('0x6')]=0x1;this[_0x80f9('0x7')]=0x1;this[_0x80f9('0x8')]=![];this[_0x80f9('0x9')]=null;this[_0x80f9('0xa')]=![];this[_0x80f9('0xb')]=null;this[_0x80f9('0xc')]=![];this[_0x80f9('0xd')]=null;this[_0x80f9('0xe')]=0x1;this[_0x80f9('0xf')]='';this[_0x80f9('0x10')]='';this[_0x80f9('0x11')]='';this[_0x80f9('0x12')]='';this[_0x80f9('0x13')]='';this[_0x80f9('0x14')]='';this['priority']='';this[_0x80f9('0x15')]=0x0;this['assigned']=![];this[_0x80f9('0x16')]='';this['mohtime']=0x0;this[_0x80f9('0x17')]={};}module[_0x80f9('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 703422a..1ab7f49 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 _0x10ce=['password','clientId','clientSecret','securityToken','type','integrationTab','Configurations','exports','name','username','remoteUri'];(function(_0x3a7dd6,_0x8a0697){var _0x495b1a=function(_0x36d61b){while(--_0x36d61b){_0x3a7dd6['push'](_0x3a7dd6['shift']());}};_0x495b1a(++_0x8a0697);}(_0x10ce,0x147));var _0xe10c=function(_0x29ecad,_0x3ba494){_0x29ecad=_0x29ecad-0x0;var _0x7824de=_0x10ce[_0x29ecad];return _0x7824de;};'use strict';function SalesforceAccount(_0x2a42bb){this['id']=_0x2a42bb['id']||0x0;this[_0xe10c('0x0')]=_0x2a42bb[_0xe10c('0x0')]||'';this[_0xe10c('0x1')]=_0x2a42bb[_0xe10c('0x1')]||'';this[_0xe10c('0x2')]=_0x2a42bb[_0xe10c('0x2')]||'';this[_0xe10c('0x3')]=_0x2a42bb['password']||'';this['clientId']=_0x2a42bb[_0xe10c('0x4')]||'';this['clientSecret']=_0x2a42bb[_0xe10c('0x5')]||'';this[_0xe10c('0x6')]=_0x2a42bb[_0xe10c('0x6')]||'';this['type']=_0x2a42bb[_0xe10c('0x7')]||_0xe10c('0x8');this['serverUrl']=_0x2a42bb['serverUrl']||'';this[_0xe10c('0x9')]=_0x2a42bb[_0xe10c('0x9')]||{};}module[_0xe10c('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x37a5=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','username','remoteUri','password','clientId'];(function(_0x534ee1,_0x3cc0a6){var _0x43abcb=function(_0x18b5eb){while(--_0x18b5eb){_0x534ee1['push'](_0x534ee1['shift']());}};_0x43abcb(++_0x3cc0a6);}(_0x37a5,0x167));var _0x537a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x37a5[_0x68c979];return _0x4f0001;};'use strict';function SalesforceAccount(_0x55284a){this['id']=_0x55284a['id']||0x0;this['name']=_0x55284a['name']||'';this[_0x537a('0x0')]=_0x55284a['username']||'';this[_0x537a('0x1')]=_0x55284a[_0x537a('0x1')]||'';this[_0x537a('0x2')]=_0x55284a[_0x537a('0x2')]||'';this['clientId']=_0x55284a[_0x537a('0x3')]||'';this[_0x537a('0x4')]=_0x55284a[_0x537a('0x4')]||'';this['securityToken']=_0x55284a[_0x537a('0x5')]||'';this[_0x537a('0x6')]=_0x55284a[_0x537a('0x6')]||_0x537a('0x7');this[_0x537a('0x8')]=_0x55284a['serverUrl']||'';this[_0x537a('0x9')]=_0x55284a['Configurations']||{};}module[_0x537a('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a262b2a..29a41a2 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 _0x2882=['username','password','remoteUri','serverUrl','name'];(function(_0x45697a,_0x2a1667){var _0x1128b1=function(_0x1c718f){while(--_0x1c718f){_0x45697a['push'](_0x45697a['shift']());}};_0x1128b1(++_0x2a1667);}(_0x2882,0xb8));var _0x2288=function(_0x593496,_0x12f14){_0x593496=_0x593496-0x0;var _0x5208a2=_0x2882[_0x593496];return _0x5208a2;};'use strict';function ServicenowAccount(_0x14499a){this['id']=_0x14499a['id']||0x0;this[_0x2288('0x0')]=_0x14499a[_0x2288('0x0')]||'';this[_0x2288('0x1')]=_0x14499a[_0x2288('0x1')]||'';this[_0x2288('0x2')]=_0x14499a[_0x2288('0x2')]||'';this['remoteUri']=_0x14499a[_0x2288('0x3')]||'';this[_0x2288('0x4')]=_0x14499a[_0x2288('0x4')]||'';this['Configurations']=_0x14499a['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xc888=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0xc888,0x9d));var _0x8c88=function(_0x11f418,_0x16283a){_0x11f418=_0x11f418-0x0;var _0x5d7f70=_0xc888[_0x11f418];return _0x5d7f70;};'use strict';function ServicenowAccount(_0x44e1ef){this['id']=_0x44e1ef['id']||0x0;this[_0x8c88('0x0')]=_0x44e1ef['name']||'';this[_0x8c88('0x1')]=_0x44e1ef[_0x8c88('0x1')]||'';this['password']=_0x44e1ef[_0x8c88('0x2')]||'';this['remoteUri']=_0x44e1ef[_0x8c88('0x3')]||'';this[_0x8c88('0x4')]=_0x44e1ef[_0x8c88('0x4')]||'';this[_0x8c88('0x5')]=_0x44e1ef[_0x8c88('0x5')]||{};}module[_0x8c88('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 2372926..9451510 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 _0x7cf8=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x2eab33,_0x10215f){var _0x4f5b7c=function(_0xe958a0){while(--_0xe958a0){_0x2eab33['push'](_0x2eab33['shift']());}};_0x4f5b7c(++_0x10215f);}(_0x7cf8,0x191));var _0x87cf=function(_0x2538b6,_0x4eac61){_0x2538b6=_0x2538b6-0x0;var _0x476a16=_0x7cf8[_0x2538b6];return _0x476a16;};'use strict';function SugarcrmAccount(_0x213267){this['id']=_0x213267['id']||0x0;this[_0x87cf('0x0')]=_0x213267[_0x87cf('0x0')]||'';this[_0x87cf('0x1')]=_0x213267[_0x87cf('0x1')]||'';this[_0x87cf('0x2')]=_0x213267[_0x87cf('0x2')]||'';this[_0x87cf('0x3')]=_0x213267[_0x87cf('0x3')]||'';this[_0x87cf('0x4')]=_0x213267[_0x87cf('0x4')]||'';this['Configurations']=_0x213267[_0x87cf('0x5')]||{};}module[_0x87cf('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x8bfa=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x54bf73,_0x5ed440){var _0x579aea=function(_0x18e0ee){while(--_0x18e0ee){_0x54bf73['push'](_0x54bf73['shift']());}};_0x579aea(++_0x5ed440);}(_0x8bfa,0x14e));var _0xa8bf=function(_0x1c9721,_0x3f83a4){_0x1c9721=_0x1c9721-0x0;var _0x5b1a4c=_0x8bfa[_0x1c9721];return _0x5b1a4c;};'use strict';function SugarcrmAccount(_0x19c606){this['id']=_0x19c606['id']||0x0;this[_0xa8bf('0x0')]=_0x19c606[_0xa8bf('0x0')]||'';this[_0xa8bf('0x1')]=_0x19c606[_0xa8bf('0x1')]||'';this[_0xa8bf('0x2')]=_0x19c606[_0xa8bf('0x2')]||'';this['remoteUri']=_0x19c606[_0xa8bf('0x3')]||'';this[_0xa8bf('0x4')]=_0x19c606[_0xa8bf('0x4')]||'';this[_0xa8bf('0x5')]=_0x19c606[_0xa8bf('0x5')]||{};}module[_0xa8bf('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 841da6a..ec20377 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 _0x947c=['status','address','exports','name','unknown','stateTime'];(function(_0x59b3c6,_0x451c24){var _0x1d1cb3=function(_0x285bfb){while(--_0x285bfb){_0x59b3c6['push'](_0x59b3c6['shift']());}};_0x1d1cb3(++_0x451c24);}(_0x947c,0x105));var _0xc947=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0x947c[_0x2c2980];return _0x2a20a9;};'use strict';function Telephone(_0x10ebb7){this['id']=_0x10ebb7['id']||0x0;this['name']=_0x10ebb7[_0xc947('0x0')]||'';this['accountcode']=_0x10ebb7['accountcode']||'';this['state']=_0xc947('0x1');this[_0xc947('0x2')]=0x0;this[_0xc947('0x3')]=_0xc947('0x1');this[_0xc947('0x4')]='';}module[_0xc947('0x5')]=Telephone; \ No newline at end of file +var _0x9088=['status','address','exports','name','state','unknown','stateTime'];(function(_0x9a330d,_0x528268){var _0x202e33=function(_0x3fed1b){while(--_0x3fed1b){_0x9a330d['push'](_0x9a330d['shift']());}};_0x202e33(++_0x528268);}(_0x9088,0xce));var _0x8908=function(_0xd1eb2d,_0x57f262){_0xd1eb2d=_0xd1eb2d-0x0;var _0x2901ae=_0x9088[_0xd1eb2d];return _0x2901ae;};'use strict';function Telephone(_0x4bb7d2){this['id']=_0x4bb7d2['id']||0x0;this[_0x8908('0x0')]=_0x4bb7d2[_0x8908('0x0')]||'';this['accountcode']=_0x4bb7d2['accountcode']||'';this[_0x8908('0x1')]=_0x8908('0x2');this[_0x8908('0x3')]=0x0;this[_0x8908('0x4')]=_0x8908('0x2');this[_0x8908('0x5')]='';}module[_0x8908('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 54eccbd..13232de 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 _0x8498=['exports','name','html'];(function(_0x3b25c7,_0x2597e1){var _0x42ce48=function(_0x17d07e){while(--_0x17d07e){_0x3b25c7['push'](_0x3b25c7['shift']());}};_0x42ce48(++_0x2597e1);}(_0x8498,0x70));var _0x8849=function(_0x2c48b2,_0x3e0a28){_0x2c48b2=_0x2c48b2-0x0;var _0x4c12c2=_0x8498[_0x2c48b2];return _0x4c12c2;};'use strict';function template(_0x6b4ba){this['id']=_0x6b4ba['id']||0x0;this['name']=_0x6b4ba[_0x8849('0x0')]||'';this['html']=_0x6b4ba[_0x8849('0x1')]||'';}module[_0x8849('0x2')]=template; \ No newline at end of file +var _0xfef5=['exports','name','html'];(function(_0x287f12,_0xc8fa2d){var _0x30834e=function(_0x4d7d25){while(--_0x4d7d25){_0x287f12['push'](_0x287f12['shift']());}};_0x30834e(++_0xc8fa2d);}(_0xfef5,0x6d));var _0x5fef=function(_0x48563f,_0x1868f7){_0x48563f=_0x48563f-0x0;var _0x2ee6db=_0xfef5[_0x48563f];return _0x2ee6db;};'use strict';function template(_0x5b9570){this['id']=_0x5b9570['id']||0x0;this['name']=_0x5b9570[_0x5fef('0x0')]||'';this[_0x5fef('0x1')]=_0x5b9570[_0x5fef('0x1')]||'';}module[_0x5fef('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 05dde88..c980122 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 _0xf3cd=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x132b20,_0x25ee9d){var _0x292899=function(_0x1dcfe3){while(--_0x1dcfe3){_0x132b20['push'](_0x132b20['shift']());}};_0x292899(++_0x25ee9d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xcfed91,_0x29b51b){_0xcfed91=_0xcfed91-0x0;var _0x42e245=_0xf3cd[_0xcfed91];return _0x42e245;};'use strict';function Trigger(_0x13cb67){this['id']=_0x13cb67['id']||0x0;this[_0xdf3c('0x0')]=_0x13cb67[_0xdf3c('0x0')]||'';this[_0xdf3c('0x1')]=_0x13cb67[_0xdf3c('0x1')]||_0xdf3c('0x2');this['status']=_0x13cb67[_0xdf3c('0x3')]||![];this[_0xdf3c('0x4')]=_0x13cb67[_0xdf3c('0x4')]||[];this['AnyConditions']=_0x13cb67[_0xdf3c('0x5')]||[];this[_0xdf3c('0x6')]=_0x13cb67[_0xdf3c('0x6')]||[];}module[_0xdf3c('0x7')]=Trigger; \ No newline at end of file +var _0x4b84=['name','channel','status','AllConditions','Actions'];(function(_0x4c659c,_0x12c83e){var _0x2cc14b=function(_0x219efa){while(--_0x219efa){_0x4c659c['push'](_0x4c659c['shift']());}};_0x2cc14b(++_0x12c83e);}(_0x4b84,0x1cc));var _0x44b8=function(_0x7b5cdd,_0x8c88d8){_0x7b5cdd=_0x7b5cdd-0x0;var _0x3a29ae=_0x4b84[_0x7b5cdd];return _0x3a29ae;};'use strict';function Trigger(_0x90ff31){this['id']=_0x90ff31['id']||0x0;this[_0x44b8('0x0')]=_0x90ff31['name']||'';this['channel']=_0x90ff31[_0x44b8('0x1')]||'voice';this['status']=_0x90ff31[_0x44b8('0x2')]||![];this[_0x44b8('0x3')]=_0x90ff31[_0x44b8('0x3')]||[];this['AnyConditions']=_0x90ff31['AnyConditions']||[];this['Actions']=_0x90ff31[_0x44b8('0x4')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index d8de170..6945521 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 _0x15ba=['host','port','domain','domainport','refresh','active','name','state','unknown','stateTime','status','registry','split'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x15ba,0x1cc));var _0xa15b=function(_0x37d3e0,_0x51d1f4){_0x37d3e0=_0x37d3e0-0x0;var _0x5512a3=_0x15ba[_0x37d3e0];return _0x5512a3;};'use strict';function Trunk(_0x1cf377){this['id']=_0x1cf377['id']||0x0;this[_0xa15b('0x0')]=_0x1cf377[_0xa15b('0x0')]||![];this['name']=_0x1cf377[_0xa15b('0x1')]||'';this[_0xa15b('0x2')]=_0xa15b('0x3');this[_0xa15b('0x4')]=0x0;this[_0xa15b('0x5')]='unknown';this[_0xa15b('0x6')]=_0x1cf377[_0xa15b('0x6')]&&_0x1cf377[_0xa15b('0x6')]['indexOf'](':')?_0x1cf377[_0xa15b('0x6')][_0xa15b('0x7')](':')[0x0]:'';this[_0xa15b('0x8')]='';this[_0xa15b('0x9')]='';this[_0xa15b('0xa')]='';this[_0xa15b('0xb')]='';this[_0xa15b('0xc')]='';this['stateRegistry']='unknown';this['registrationtime']='';this['address']='';}module['exports']=Trunk; \ No newline at end of file +var _0x09ff=['port','domain','domainport','stateRegistry','address','exports','active','name','unknown','status','registry','indexOf','split'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x09ff,0x165));var _0xf09f=function(_0x4875c0,_0x312611){_0x4875c0=_0x4875c0-0x0;var _0x4453de=_0x09ff[_0x4875c0];return _0x4453de;};'use strict';function Trunk(_0x78aed){this['id']=_0x78aed['id']||0x0;this[_0xf09f('0x0')]=_0x78aed[_0xf09f('0x0')]||![];this[_0xf09f('0x1')]=_0x78aed[_0xf09f('0x1')]||'';this['state']=_0xf09f('0x2');this['stateTime']=0x0;this[_0xf09f('0x3')]='unknown';this[_0xf09f('0x4')]=_0x78aed['registry']&&_0x78aed[_0xf09f('0x4')][_0xf09f('0x5')](':')?_0x78aed[_0xf09f('0x4')][_0xf09f('0x6')](':')[0x0]:'';this['host']='';this[_0xf09f('0x7')]='';this[_0xf09f('0x8')]='';this[_0xf09f('0x9')]='';this['refresh']='';this[_0xf09f('0xa')]=_0xf09f('0x2');this['registrationtime']='';this[_0xf09f('0xb')]='';}module[_0xf09f('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index d2a4c0b..2b79873 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 _0x101a=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x101a,0xc5));var _0xa101=function(_0x4ac8e8,_0x312a84){_0x4ac8e8=_0x4ac8e8-0x0;var _0x5753bd=_0x101a[_0x4ac8e8];return _0x5753bd;};'use strict';function voiceExtension(_0x1eb505){this['id']=_0x1eb505['id']||0x0;this['exten']=_0x1eb505[_0xa101('0x0')]||'';this['recordingFormat']=_0x1eb505[_0xa101('0x1')]||_0xa101('0x2');this[_0xa101('0x3')]=_0x1eb505[_0xa101('0x3')]||![];}module[_0xa101('0x4')]=voiceExtension; \ No newline at end of file +var _0xe155=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x94f45d,_0x13cd3d){var _0x3e7072=function(_0x5f4234){while(--_0x5f4234){_0x94f45d['push'](_0x94f45d['shift']());}};_0x3e7072(++_0x13cd3d);}(_0xe155,0x105));var _0x5e15=function(_0x456927,_0x27b202){_0x456927=_0x456927-0x0;var _0xa4b14d=_0xe155[_0x456927];return _0xa4b14d;};'use strict';function voiceExtension(_0x3f96ff){this['id']=_0x3f96ff['id']||0x0;this[_0x5e15('0x0')]=_0x3f96ff['exten']||'';this[_0x5e15('0x1')]=_0x3f96ff[_0x5e15('0x1')]||_0x5e15('0x2');this['mandatoryDisposition']=_0x3f96ff[_0x5e15('0x3')]||![];}module[_0x5e15('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 1c8e06a..4a0b349 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 _0xa10a=['Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix'];(function(_0x1fd155,_0x340af9){var _0x250e2f=function(_0x3cef99){while(--_0x3cef99){_0x1fd155['push'](_0x1fd155['shift']());}};_0x250e2f(++_0x340af9);}(_0xa10a,0x1a5));var _0xaa10=function(_0x76d0dd,_0x16716d){_0x76d0dd=_0x76d0dd-0x0;var _0x508d20=_0xa10a[_0x76d0dd];return _0x508d20;};'use strict';var statusDesc=[_0xaa10('0x0'),_0xaa10('0x1'),_0xaa10('0x2'),_0xaa10('0x3'),_0xaa10('0x4'),'unavailable',_0xaa10('0x5'),_0xaa10('0x6'),_0xaa10('0x7')];var monitorFormat={'wav':_0xaa10('0x8'),'wav49':_0xaa10('0x9'),'gsm':_0xaa10('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x2e3b5e){this['id']=_0x2e3b5e['id']||0x0;this[_0xaa10('0xb')]=_0x2e3b5e[_0xaa10('0xb')]||'';this['monitor_format']=_0x2e3b5e[_0xaa10('0xc')]||'';this['type']=_0x2e3b5e[_0xaa10('0xd')]||_0xaa10('0xe');this[_0xaa10('0xf')]=0x0;this['talking']=0x0;this[_0xaa10('0x10')]=0x0;this[_0xaa10('0x11')]=0x0;this['sumDuration']=0x0;this[_0xaa10('0x12')]=0x0;this[_0xaa10('0x13')]=0x0;this[_0xaa10('0x14')]=0x0;this[_0xaa10('0x15')]=0x0;this[_0xaa10('0x16')]=0x0;this[_0xaa10('0x17')]=0x0;this[_0xaa10('0x18')]=_0x2e3b5e['acw']||![];this['acwTimeout']=_0x2e3b5e[_0xaa10('0x19')]||0xa;this[_0xaa10('0x1a')]=_0x2e3b5e[_0xaa10('0x1a')]||'no';this[_0xaa10('0x1b')]=!![];this[_0xaa10('0x1c')]='';this[_0xaa10('0x1d')]=0x0;this['temp']=0x0;this[_0xaa10('0x1e')]=_0x2e3b5e[_0xaa10('0x1e')]||null;this[_0xaa10('0x1f')]=_0x2e3b5e[_0xaa10('0x1f')]?_0x2e3b5e['dialGlobalInterval']:null;this[_0xaa10('0x20')]=_0x2e3b5e[_0xaa10('0x20')];this[_0xaa10('0x21')]=_0x2e3b5e['dialMethod']||_0xaa10('0x22');this[_0xaa10('0x23')]=_0x2e3b5e['dialLimitChannel']||0x0;this[_0xaa10('0x24')]=_0x2e3b5e['dialLimitQueue']||0x0;this[_0xaa10('0x25')]=_0x2e3b5e[_0xaa10('0x25')]||0x1;this[_0xaa10('0x26')]=_0x2e3b5e[_0xaa10('0x26')]||'dropRate';this[_0xaa10('0x27')]=_0x2e3b5e['dialPredictiveOptimizationPercentage']||0.03;this[_0xaa10('0x28')]=_0x2e3b5e[_0xaa10('0x28')]||0x258;this['dialOriginateCallerIdName']=_0x2e3b5e[_0xaa10('0x29')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x2e3b5e[_0xaa10('0x2a')]||_0xaa10('0x2b');this[_0xaa10('0x2c')]=_0x2e3b5e[_0xaa10('0x2c')]||0x1e;this[_0xaa10('0x2d')]=_0x2e3b5e['dialQueueOptions']||'tTxX';this[_0xaa10('0x2e')]=_0x2e3b5e[_0xaa10('0x2e')]||0x3;this['dialQueueProject']=_0x2e3b5e['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x2e3b5e[_0xaa10('0x2f')]||0x3;this[_0xaa10('0x30')]=_0x2e3b5e[_0xaa10('0x30')]||0x96;this['dialBusyMaxRetry']=_0x2e3b5e[_0xaa10('0x31')]||0x3;this[_0xaa10('0x32')]=_0x2e3b5e[_0xaa10('0x32')]||0x96;this[_0xaa10('0x33')]=_0x2e3b5e['dialNoAnswerMaxRetry']||0x3;this[_0xaa10('0x34')]=_0x2e3b5e[_0xaa10('0x34')]||0x96;this[_0xaa10('0x35')]=_0x2e3b5e['dialNoSuchNumberMaxRetry']||0x3;this[_0xaa10('0x36')]=_0x2e3b5e['dialNoSuchNumberRetryFrequency']||0x96;this[_0xaa10('0x37')]=_0x2e3b5e[_0xaa10('0x37')]||0x3;this[_0xaa10('0x38')]=_0x2e3b5e[_0xaa10('0x38')]||0x96;this[_0xaa10('0x39')]=_0x2e3b5e['dialAbandonedMaxRetry']||0x3;this[_0xaa10('0x3a')]=_0x2e3b5e[_0xaa10('0x3a')]||0x96;this[_0xaa10('0x3b')]=_0x2e3b5e[_0xaa10('0x3b')]||0x3;this[_0xaa10('0x3c')]=_0x2e3b5e[_0xaa10('0x3c')]||0x96;this[_0xaa10('0x3d')]=_0x2e3b5e[_0xaa10('0x3d')]||0x3;this[_0xaa10('0x3e')]=_0x2e3b5e[_0xaa10('0x3e')]||0x96;this[_0xaa10('0x3f')]=_0x2e3b5e[_0xaa10('0x3f')]||0x4;this[_0xaa10('0x40')]=_0x2e3b5e[_0xaa10('0x40')]?_0x2e3b5e[_0xaa10('0x40')]:undefined;this[_0xaa10('0x41')]=_0x2e3b5e[_0xaa10('0x41')]?_0x2e3b5e[_0xaa10('0x41')]:undefined;this[_0xaa10('0x42')]=_0x2e3b5e[_0xaa10('0x42')]||undefined;this[_0xaa10('0x43')]=_0x2e3b5e[_0xaa10('0x43')]?_0x2e3b5e['Interval']:undefined;this[_0xaa10('0x44')]=_0x2e3b5e[_0xaa10('0x44')]||_0xaa10('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x2e3b5e[_0xaa10('0x46')]||undefined;this[_0xaa10('0x47')]=_0x2e3b5e[_0xaa10('0x47')]||undefined;this[_0xaa10('0x48')]=strategy[_0x2e3b5e[_0xaa10('0x48')]]||_0xaa10('0x49');this[_0xaa10('0x4a')]=!![];this[_0xaa10('0x4b')]=_0x2e3b5e[_0xaa10('0x4b')]||![];this[_0xaa10('0x4c')]=_0x2e3b5e['dialAMDInitialSilence'];this[_0xaa10('0x4d')]=_0x2e3b5e['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x2e3b5e[_0xaa10('0x4e')];this[_0xaa10('0x4f')]=_0x2e3b5e[_0xaa10('0x4f')];this['dialAMDMinWordLength']=_0x2e3b5e[_0xaa10('0x50')];this[_0xaa10('0x51')]=_0x2e3b5e[_0xaa10('0x51')];this[_0xaa10('0x52')]=_0x2e3b5e[_0xaa10('0x52')];this[_0xaa10('0x53')]=_0x2e3b5e[_0xaa10('0x53')];this['dialAMDMaximumWordLength']=_0x2e3b5e['dialAMDMaximumWordLength'];this[_0xaa10('0x54')]=0x0;this[_0xaa10('0x55')]=0x0;this[_0xaa10('0x56')]=_0x2e3b5e[_0xaa10('0x56')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xaa10('0x57')]=0x0;this[_0xaa10('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xaa10('0x59')]=0x0;this[_0xaa10('0x5a')]=0x0;this[_0xaa10('0x5b')]=0x0;this[_0xaa10('0x5c')]=0x0;this[_0xaa10('0x5d')]=0x0;this[_0xaa10('0x5e')]=0x0;this[_0xaa10('0x5f')]=0x0;this[_0xaa10('0x60')]=0x0;this[_0xaa10('0x61')]=0x0;this[_0xaa10('0x62')]=undefined;this['startPredictive']=undefined;this[_0xaa10('0x63')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xaa10('0x64')]=0x0;this[_0xaa10('0x65')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xaa10('0x66')]=0x0;this[_0xaa10('0x67')]=0x0;this[_0xaa10('0x68')]=0x0;this[_0xaa10('0x69')]=0x0;this[_0xaa10('0x6a')]=_0x2e3b5e[_0xaa10('0x6b')]||0x14;this[_0xaa10('0x6c')]=_0x2e3b5e['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xaa10('0x6d')]=0x0;this[_0xaa10('0x6e')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xaa10('0x6f')]=0x0;this[_0xaa10('0x70')]=0x0;this[_0xaa10('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0xaa10('0x72')]=_0x2e3b5e[_0xaa10('0x72')]||0x1e;this[_0xaa10('0x73')]=_0x2e3b5e[_0xaa10('0x73')]||![];this[_0xaa10('0x74')]=_0x2e3b5e[_0xaa10('0x74')]||undefined;this[_0xaa10('0x75')]=_0x2e3b5e[_0xaa10('0x75')]||![];this[_0xaa10('0x76')]=_0x2e3b5e[_0xaa10('0x76')]||![];this[_0xaa10('0xc')]=monitorFormat[_0x2e3b5e[_0xaa10('0xc')]]?monitorFormat[_0x2e3b5e[_0xaa10('0xc')]]:undefined;this[_0xaa10('0x77')]=_0x2e3b5e[_0xaa10('0x77')]||![];this[_0xaa10('0x78')]=_0x2e3b5e['mandatoryDispositionPause']?_0x2e3b5e[_0xaa10('0x78')]:undefined;}module[_0xaa10('0x79')]=VoiceQueue; \ No newline at end of file +var _0x7796=['dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','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','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','available','acw','acwTimeout','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive'];(function(_0x243b03,_0x1d93c1){var _0x4d7902=function(_0x5ba3){while(--_0x5ba3){_0x243b03['push'](_0x243b03['shift']());}};_0x4d7902(++_0x1d93c1);}(_0x7796,0x148));var _0x6779=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7796[_0x3dd15e];return _0x231fd0;};'use strict';var statusDesc=['unknown',_0x6779('0x0'),_0x6779('0x1'),'busy',_0x6779('0x2'),_0x6779('0x3'),_0x6779('0x4'),_0x6779('0x5'),_0x6779('0x6')];var monitorFormat={'wav':'wav','wav49':_0x6779('0x7'),'gsm':_0x6779('0x8')};var strategy={'rrmemory':_0x6779('0x9'),'roundrobin':_0x6779('0xa')};function VoiceQueue(_0xdf83d7){this['id']=_0xdf83d7['id']||0x0;this[_0x6779('0xb')]=_0xdf83d7[_0x6779('0xb')]||'';this['monitor_format']=_0xdf83d7[_0x6779('0xc')]||'';this[_0x6779('0xd')]=_0xdf83d7[_0x6779('0xd')]||_0x6779('0xe');this[_0x6779('0xf')]=0x0;this[_0x6779('0x10')]=0x0;this[_0x6779('0x11')]=0x0;this[_0x6779('0x12')]=0x0;this[_0x6779('0x13')]=0x0;this[_0x6779('0x14')]=0x0;this[_0x6779('0x15')]=0x0;this['unmanaged']=0x0;this[_0x6779('0x16')]=0x0;this['loggedIn']=0x0;this[_0x6779('0x17')]=0x0;this['acw']=_0xdf83d7[_0x6779('0x18')]||![];this[_0x6779('0x19')]=_0xdf83d7[_0x6779('0x19')]||0xa;this['autopause']=_0xdf83d7['autopause']||'no';this[_0x6779('0x1a')]=!![];this[_0x6779('0x1b')]='';this[_0x6779('0x1c')]=0x0;this['temp']=0x0;this[_0x6779('0x1d')]=_0xdf83d7[_0x6779('0x1d')]||null;this[_0x6779('0x1e')]=_0xdf83d7[_0x6779('0x1e')]?_0xdf83d7['dialGlobalInterval']:null;this[_0x6779('0x1f')]=_0xdf83d7[_0x6779('0x1f')];this[_0x6779('0x20')]=_0xdf83d7['dialMethod']||_0x6779('0x21');this[_0x6779('0x22')]=_0xdf83d7[_0x6779('0x22')]||0x0;this[_0x6779('0x23')]=_0xdf83d7[_0x6779('0x23')]||0x0;this[_0x6779('0x24')]=_0xdf83d7[_0x6779('0x24')]||0x1;this['dialPredictiveOptimization']=_0xdf83d7[_0x6779('0x25')]||_0x6779('0x26');this[_0x6779('0x27')]=_0xdf83d7['dialPredictiveOptimizationPercentage']||0.03;this[_0x6779('0x28')]=_0xdf83d7[_0x6779('0x28')]||0x258;this[_0x6779('0x29')]=_0xdf83d7[_0x6779('0x29')]||'anonymous';this[_0x6779('0x2a')]=_0xdf83d7['dialOriginateCallerIdNumber']||_0x6779('0x2b');this[_0x6779('0x2c')]=_0xdf83d7[_0x6779('0x2c')]||0x1e;this[_0x6779('0x2d')]=_0xdf83d7['dialQueueOptions']||_0x6779('0x2e');this[_0x6779('0x2f')]=_0xdf83d7['dialQueueTimeout']||0x3;this[_0x6779('0x30')]=_0xdf83d7[_0x6779('0x30')]||undefined;this['dialCongestionMaxRetry']=_0xdf83d7['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0xdf83d7[_0x6779('0x31')]||0x96;this[_0x6779('0x32')]=_0xdf83d7['dialBusyMaxRetry']||0x3;this[_0x6779('0x33')]=_0xdf83d7['dialBusyRetryFrequency']||0x96;this[_0x6779('0x34')]=_0xdf83d7[_0x6779('0x34')]||0x3;this[_0x6779('0x35')]=_0xdf83d7['dialNoAnswerRetryFrequency']||0x96;this[_0x6779('0x36')]=_0xdf83d7[_0x6779('0x36')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xdf83d7[_0x6779('0x37')]||0x96;this[_0x6779('0x38')]=_0xdf83d7[_0x6779('0x38')]||0x3;this['dialDropRetryFrequency']=_0xdf83d7['dialDropRetryFrequency']||0x96;this[_0x6779('0x39')]=_0xdf83d7[_0x6779('0x39')]||0x3;this[_0x6779('0x3a')]=_0xdf83d7[_0x6779('0x3a')]||0x96;this[_0x6779('0x3b')]=_0xdf83d7[_0x6779('0x3b')]||0x3;this[_0x6779('0x3c')]=_0xdf83d7[_0x6779('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0xdf83d7[_0x6779('0x3d')]||0x3;this[_0x6779('0x3e')]=_0xdf83d7[_0x6779('0x3e')]||0x96;this[_0x6779('0x3f')]=_0xdf83d7[_0x6779('0x3f')]||0x4;this[_0x6779('0x40')]=_0xdf83d7['Trunk']?_0xdf83d7[_0x6779('0x40')]:undefined;this['TrunkBackup']=_0xdf83d7[_0x6779('0x41')]?_0xdf83d7[_0x6779('0x41')]:undefined;this[_0x6779('0x42')]=_0xdf83d7[_0x6779('0x42')]||undefined;this[_0x6779('0x43')]=_0xdf83d7['Interval']?_0xdf83d7['Interval']:undefined;this['dialOrderByScheduledAt']=_0xdf83d7[_0x6779('0x44')]||'DESC';this[_0x6779('0x45')]=_0xdf83d7[_0x6779('0x45')]||undefined;this[_0x6779('0x46')]=_0xdf83d7[_0x6779('0x46')]||undefined;this[_0x6779('0x47')]=strategy[_0xdf83d7['strategy']]||_0x6779('0x9');this[_0x6779('0x48')]=!![];this[_0x6779('0x49')]=_0xdf83d7['dialAMDActive']||![];this[_0x6779('0x4a')]=_0xdf83d7[_0x6779('0x4a')];this[_0x6779('0x4b')]=_0xdf83d7[_0x6779('0x4b')];this['dialAMDAfterGreetingSilence']=_0xdf83d7[_0x6779('0x4c')];this[_0x6779('0x4d')]=_0xdf83d7[_0x6779('0x4d')];this[_0x6779('0x4e')]=_0xdf83d7['dialAMDMinWordLength'];this[_0x6779('0x4f')]=_0xdf83d7[_0x6779('0x4f')];this[_0x6779('0x50')]=_0xdf83d7[_0x6779('0x50')];this['dialAMDSilenceThreshold']=_0xdf83d7[_0x6779('0x51')];this[_0x6779('0x52')]=_0xdf83d7[_0x6779('0x52')];this[_0x6779('0x53')]=0x0;this[_0x6779('0x54')]=0x0;this['timeout']=_0xdf83d7[_0x6779('0x55')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x6779('0x56')]=0x0;this[_0x6779('0x57')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x6779('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x6779('0x59')]=0x0;this[_0x6779('0x5a')]=0x0;this[_0x6779('0x5b')]=0x0;this[_0x6779('0x5c')]=0x0;this[_0x6779('0x5d')]=0x0;this[_0x6779('0x5e')]=0x0;this[_0x6779('0x5f')]=0x0;this[_0x6779('0x60')]=undefined;this['startPredictive']=undefined;this[_0x6779('0x61')]=undefined;this[_0x6779('0x62')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x6779('0x63')]=0x0;this[_0x6779('0x64')]=0x0;this[_0x6779('0x65')]=0x0;this[_0x6779('0x66')]=0x0;this[_0x6779('0x67')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x6779('0x68')]=0x0;this[_0x6779('0x69')]=_0xdf83d7[_0x6779('0x6a')]||0x14;this[_0x6779('0x6b')]=_0xdf83d7[_0x6779('0x6a')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x6779('0x6c')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x6779('0x6d')]=0x0;this[_0x6779('0x6e')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x6779('0x6f')]=0x0;this[_0x6779('0x70')]=_0xdf83d7[_0x6779('0x70')]||0x1e;this[_0x6779('0x71')]=_0xdf83d7[_0x6779('0x71')]||![];this[_0x6779('0x72')]=_0xdf83d7[_0x6779('0x72')]||undefined;this[_0x6779('0x73')]=_0xdf83d7[_0x6779('0x73')]||![];this[_0x6779('0x74')]=_0xdf83d7[_0x6779('0x74')]||![];this['monitor_format']=monitorFormat[_0xdf83d7['monitor_format']]?monitorFormat[_0xdf83d7['monitor_format']]:undefined;this[_0x6779('0x75')]=_0xdf83d7[_0x6779('0x75')]||![];this['mandatoryDispositionPause']=_0xdf83d7[_0x6779('0x76')]?_0xdf83d7['mandatoryDispositionPause']:undefined;}module[_0x6779('0x77')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 17c8187..a43fbfd 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 _0x419c=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x7758b9,_0x28c2a5){var _0x314421=function(_0x10a5bb){while(--_0x10a5bb){_0x7758b9['push'](_0x7758b9['shift']());}};_0x314421(++_0x28c2a5);}(_0x419c,0xd2));var _0xc419=function(_0x68c4e3,_0x5b18b0){_0x68c4e3=_0x68c4e3-0x0;var _0xaca048=_0x419c[_0x68c4e3];return _0xaca048;};'use strict';function VtigerAccount(_0x251da){this['id']=_0x251da['id']||0x0;this[_0xc419('0x0')]=_0x251da[_0xc419('0x0')]||'';this[_0xc419('0x1')]=_0x251da[_0xc419('0x1')]||'';this[_0xc419('0x2')]=_0x251da[_0xc419('0x2')]||'';this[_0xc419('0x3')]=_0x251da[_0xc419('0x3')]||'';this[_0xc419('0x4')]=_0x251da[_0xc419('0x4')]||'';this[_0xc419('0x5')]=_0x251da['Configurations']||{};}module[_0xc419('0x6')]=VtigerAccount; \ No newline at end of file +var _0x07a5=['accessKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x1eaae4,_0x37e35b){var _0x1f92ce=function(_0x3edbf7){while(--_0x3edbf7){_0x1eaae4['push'](_0x1eaae4['shift']());}};_0x1f92ce(++_0x37e35b);}(_0x07a5,0xd0));var _0x507a=function(_0x4ea571,_0x524bc2){_0x4ea571=_0x4ea571-0x0;var _0x122eba=_0x07a5[_0x4ea571];return _0x122eba;};'use strict';function VtigerAccount(_0x2b3def){this['id']=_0x2b3def['id']||0x0;this[_0x507a('0x0')]=_0x2b3def[_0x507a('0x0')]||'';this[_0x507a('0x1')]=_0x2b3def[_0x507a('0x1')]||'';this[_0x507a('0x2')]=_0x2b3def[_0x507a('0x2')]||'';this[_0x507a('0x3')]=_0x2b3def[_0x507a('0x3')]||'';this[_0x507a('0x4')]=_0x2b3def[_0x507a('0x4')]||'';this[_0x507a('0x5')]=_0x2b3def[_0x507a('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 9cb8485..d18a342 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(_0x3eecbe,_0x58a78f){var _0x7d3d91=function(_0xe40279){while(--_0xe40279){_0x3eecbe['push'](_0x3eecbe['shift']());}};_0x7d3d91(++_0x58a78f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'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 _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x5c0c26,_0x32a9c8){_0x5c0c26=_0x5c0c26-0x0;var _0x2015be=_0xadb5[_0x5c0c26];return _0x2015be;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 052e752..056bd83 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 _0xb6a6=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone'];(function(_0x5a2a22,_0x1f3dc8){var _0xf9f942=function(_0xa0aad2){while(--_0xa0aad2){_0x5a2a22['push'](_0x5a2a22['shift']());}};_0xf9f942(++_0x1f3dc8);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x3fbea1,_0x5e7e56){_0x3fbea1=_0x3fbea1-0x0;var _0x56ed08=_0xb6a6[_0x3fbea1];return _0x56ed08;};'use strict';function ZohoAccount(_0x44400f){this['id']=_0x44400f['id']||0x0;this[_0x6b6a('0x0')]=_0x44400f['name']||'';this['description']=_0x44400f[_0x6b6a('0x1')]||'';this[_0x6b6a('0x2')]=_0x44400f[_0x6b6a('0x2')]||'';this[_0x6b6a('0x3')]=_0x44400f[_0x6b6a('0x3')]||'';this['clientId']=_0x44400f[_0x6b6a('0x4')]||'';this[_0x6b6a('0x5')]=_0x44400f[_0x6b6a('0x5')]||'';this['serverUrl']=_0x44400f[_0x6b6a('0x6')]||'';this[_0x6b6a('0x7')]=_0x44400f['code']||'';this[_0x6b6a('0x8')]=_0x44400f[_0x6b6a('0x8')]||'';this['Configurations']=_0x44400f[_0x6b6a('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x457b=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x4d051b,_0x4899bb){var _0x4c6741=function(_0x499ba4){while(--_0x499ba4){_0x4d051b['push'](_0x4d051b['shift']());}};_0x4c6741(++_0x4899bb);}(_0x457b,0xca));var _0xb457=function(_0x241099,_0x2997a9){_0x241099=_0x241099-0x0;var _0x164e96=_0x457b[_0x241099];return _0x164e96;};'use strict';function ZohoAccount(_0x404021){this['id']=_0x404021['id']||0x0;this[_0xb457('0x0')]=_0x404021['name']||'';this[_0xb457('0x1')]=_0x404021[_0xb457('0x1')]||'';this[_0xb457('0x2')]=_0x404021[_0xb457('0x2')]||'';this[_0xb457('0x3')]=_0x404021['zone']||'';this[_0xb457('0x4')]=_0x404021[_0xb457('0x4')]||'';this[_0xb457('0x5')]=_0x404021[_0xb457('0x5')]||'';this[_0xb457('0x6')]=_0x404021['serverUrl']||'';this[_0xb457('0x7')]=_0x404021[_0xb457('0x7')]||'';this[_0xb457('0x8')]=_0x404021['refreshToken']||'';this['Configurations']=_0x404021[_0xb457('0x9')]||{};}module[_0xb457('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index f139f1b..a67b72a 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 _0x14f4=['scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','calleridname','lodash','moment','string','isNil','idContact','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','Contact','phone','firstName','lastName','active','calleridnum'];(function(_0x6afa2d,_0x8c0e0f){var _0x1698ee=function(_0x3b9313){while(--_0x3b9313){_0x6afa2d['push'](_0x6afa2d['shift']());}};_0x1698ee(++_0x8c0e0f);}(_0x14f4,0x1d9));var _0x414f=function(_0x7f578b,_0x2d4682){_0x7f578b=_0x7f578b-0x0;var _0x7fc55e=_0x14f4[_0x7f578b];return _0x7fc55e;};'use strict';var util=require('util');var _=require(_0x414f('0x0'));var moment=require(_0x414f('0x1'));function checkNameSurname(_0x2f96d8,_0x3da2a2,_0x173448){var _0x25492a='';if(!_['isNil'](_0x3da2a2)&&_0x414f('0x2')===typeof _0x3da2a2){_0x25492a+=_0x3da2a2;}if(!_[_0x414f('0x3')](_0x173448)&&_0x414f('0x2')===typeof _0x173448){_0x25492a+='\x20'+_0x173448;}if(_0x25492a!==''){return _0x25492a;}return _0x2f96d8;}function Action(_0x34e09f,_0x49b714,_0x273f8b,_0xf2592,_0x290187){this['uniqueid']=_0x273f8b||undefined;this[_0x414f('0x4')]=_0x34e09f['id'];this[_0x414f('0x5')]=_0x49b714[_0x414f('0x6')];this[_0x414f('0x7')]=_0x49b714[_0x414f('0x7')];this['campaigntype']=_0x414f('0x5');this[_0x414f('0x8')]=![];this[_0x414f('0x9')]=_[_0x414f('0x3')](_0x34e09f[_0x414f('0xa')])?undefined:_0x34e09f['Agent'][_0x414f('0x6')];this[_0x414f('0xb')]=this[_0x414f('0x9')]?util[_0x414f('0xc')]('SIP/%s',this[_0x414f('0x9')]):_0xf2592||undefined;this['calleridname']=checkNameSurname(_0x34e09f[_0x414f('0xd')][_0x414f('0xe')],_0x34e09f[_0x414f('0xd')][_0x414f('0xf')],_0x34e09f[_0x414f('0xd')][_0x414f('0x10')]);this['active']=_0x34e09f[_0x414f('0x11')]||![];this[_0x414f('0x12')]=_0x34e09f['Contact'][_0x414f('0xe')];this[_0x414f('0x13')]=_0x34e09f['scheduledat'];this[_0x414f('0x14')]=_0x34e09f['countbusyretry']||0x0;this['countcongestionretry']=_0x34e09f['countcongestionretry']||0x0;this[_0x414f('0x15')]=_0x34e09f[_0x414f('0x15')]||0x0;this[_0x414f('0x16')]=(_0x34e09f[_0x414f('0x14')]||0x0)+(_0x34e09f[_0x414f('0x17')]||0x0)+(_0x34e09f[_0x414f('0x15')]||0x0)+(_0x34e09f['countnosuchnumberretry']||0x0)+(_0x34e09f[_0x414f('0x18')]||0x0)+(_0x34e09f[_0x414f('0x19')]||0x0)+(_0x34e09f[_0x414f('0x1a')]||0x0)+(_0x34e09f['countagentrejectretry']||0x0);this[_0x414f('0x1b')]=_0x34e09f[_0x414f('0x1b')]||0x0;this[_0x414f('0x18')]=_0x34e09f[_0x414f('0x18')]||0x0;this[_0x414f('0x19')]=_0x34e09f[_0x414f('0x19')]||0x0;this['countmachineretry']=_0x34e09f[_0x414f('0x1a')]||0x0;this[_0x414f('0x1c')]=_0x34e09f[_0x414f('0x1c')]||0x0;this[_0x414f('0x1d')]=_0x34e09f[_0x414f('0x1d')];this[_0x414f('0x1e')]=_0x34e09f['callbackuniqueid'];this[_0x414f('0x1f')]=_0x34e09f[_0x414f('0x1f')];this['recallme']=_0x34e09f[_0x414f('0x20')];this[_0x414f('0x21')]=_0x34e09f[_0x414f('0x21')];this[_0x414f('0x22')]=_0x34e09f['ListId'];this[_0x414f('0x23')]=_[_0x414f('0x3')](_0x34e09f[_0x414f('0xa')])?_0x34e09f[_0x414f('0x23')]:_0x34e09f[_0x414f('0xa')]['id'];this[_0x414f('0x24')]=_0x34e09f['VoiceQueueId'];this[_0x414f('0x25')]='';this[_0x414f('0x26')]='';}Action[_0x414f('0x27')]['getCaller']=function(){return util[_0x414f('0xc')]('\x22%s\x22\x20<%s>',this[_0x414f('0x28')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0xcec9=['uniqueid','idContact','queue','name','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','moment','isNil','string'];(function(_0x286ae6,_0x32f6b7){var _0x3d828f=function(_0x28007e){while(--_0x28007e){_0x286ae6['push'](_0x286ae6['shift']());}};_0x3d828f(++_0x32f6b7);}(_0xcec9,0x7b));var _0x9cec=function(_0x487bce,_0xd11228){_0x487bce=_0x487bce-0x0;var _0x17ba7a=_0xcec9[_0x487bce];return _0x17ba7a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9cec('0x0'));function checkNameSurname(_0x56bc1f,_0x5aec8d,_0xf69a20){var _0x15d448='';if(!_[_0x9cec('0x1')](_0x5aec8d)&&_0x9cec('0x2')===typeof _0x5aec8d){_0x15d448+=_0x5aec8d;}if(!_[_0x9cec('0x1')](_0xf69a20)&&_0x9cec('0x2')===typeof _0xf69a20){_0x15d448+='\x20'+_0xf69a20;}if(_0x15d448!==''){return _0x15d448;}return _0x56bc1f;}function Action(_0x18aec4,_0x300fd0,_0x45aedc,_0x418edd,_0x30bfbd){this[_0x9cec('0x3')]=_0x45aedc||undefined;this[_0x9cec('0x4')]=_0x18aec4['id'];this[_0x9cec('0x5')]=_0x300fd0[_0x9cec('0x6')];this['type']=_0x300fd0['type'];this['campaigntype']=_0x9cec('0x5');this[_0x9cec('0x7')]=![];this[_0x9cec('0x8')]=_[_0x9cec('0x1')](_0x18aec4[_0x9cec('0x9')])?undefined:_0x18aec4['Agent'][_0x9cec('0x6')];this[_0x9cec('0xa')]=this[_0x9cec('0x8')]?util[_0x9cec('0xb')](_0x9cec('0xc'),this[_0x9cec('0x8')]):_0x418edd||undefined;this[_0x9cec('0xd')]=checkNameSurname(_0x18aec4[_0x9cec('0xe')][_0x9cec('0xf')],_0x18aec4[_0x9cec('0xe')][_0x9cec('0x10')],_0x18aec4[_0x9cec('0xe')]['lastName']);this[_0x9cec('0x11')]=_0x18aec4[_0x9cec('0x11')]||![];this[_0x9cec('0x12')]=_0x18aec4['Contact'][_0x9cec('0xf')];this[_0x9cec('0x13')]=_0x18aec4['scheduledat'];this[_0x9cec('0x14')]=_0x18aec4[_0x9cec('0x14')]||0x0;this['countcongestionretry']=_0x18aec4[_0x9cec('0x15')]||0x0;this[_0x9cec('0x16')]=_0x18aec4[_0x9cec('0x16')]||0x0;this[_0x9cec('0x17')]=(_0x18aec4[_0x9cec('0x14')]||0x0)+(_0x18aec4[_0x9cec('0x15')]||0x0)+(_0x18aec4[_0x9cec('0x16')]||0x0)+(_0x18aec4[_0x9cec('0x18')]||0x0)+(_0x18aec4[_0x9cec('0x19')]||0x0)+(_0x18aec4[_0x9cec('0x1a')]||0x0)+(_0x18aec4[_0x9cec('0x1b')]||0x0)+(_0x18aec4[_0x9cec('0x1c')]||0x0);this[_0x9cec('0x18')]=_0x18aec4[_0x9cec('0x18')]||0x0;this[_0x9cec('0x19')]=_0x18aec4['countdropretry']||0x0;this[_0x9cec('0x1a')]=_0x18aec4[_0x9cec('0x1a')]||0x0;this[_0x9cec('0x1b')]=_0x18aec4[_0x9cec('0x1b')]||0x0;this[_0x9cec('0x1c')]=_0x18aec4['countagentrejectretry']||0x0;this['callback']=_0x18aec4[_0x9cec('0x1d')];this[_0x9cec('0x1e')]=_0x18aec4['callbackuniqueid'];this[_0x9cec('0x1f')]=_0x18aec4[_0x9cec('0x1f')];this[_0x9cec('0x20')]=_0x18aec4[_0x9cec('0x20')];this['ContactId']=_0x18aec4[_0x9cec('0x21')];this[_0x9cec('0x22')]=_0x18aec4[_0x9cec('0x22')];this[_0x9cec('0x23')]=_['isNil'](_0x18aec4[_0x9cec('0x9')])?_0x18aec4[_0x9cec('0x23')]:_0x18aec4['Agent']['id'];this['VoiceQueueId']=_0x18aec4[_0x9cec('0x24')];this['originatecalleridnum']='';this[_0x9cec('0x25')]='';}Action['prototype'][_0x9cec('0x26')]=function(){return util[_0x9cec('0xb')](_0x9cec('0x27'),this[_0x9cec('0xd')],this[_0x9cec('0x28')]);};module[_0x9cec('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 4d451dd..6eb5f47 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 _0xe47c=['sumBillable','[syncHangup][talking][decrement]','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','logAgent','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','originated:\x20','Contact','phone','Contact\x20is\x20undefined','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','run','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','TrunkBackup','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','substring','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','merge','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','starttime','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','destuniqueid','dialstatus','addVariable','keys','variable','value','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','talking','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','clearZombieChannels','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','responsetime','answertime','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe47c,0x1d9));var _0xce47=function(_0x397d60,_0x3dea76){_0x397d60=_0x397d60-0x0;var _0x4a0523=_0xe47c[_0x397d60];return _0x4a0523;};'use strict';var util=require('util');var _=require(_0xce47('0x0'));var BPromise=require(_0xce47('0x1'));var uuid=require(_0xce47('0x2'));var moment=require('moment');var md5=require(_0xce47('0x3'));var Redis=require(_0xce47('0x4'));var config=require(_0xce47('0x5'));var logger=require(_0xce47('0x6'))(_0xce47('0x7'));var loggerAction=require(_0xce47('0x6'))(_0xce47('0x8'));var ami=require(_0xce47('0x9'));var rpcDb=require(_0xce47('0xa'));var Action=require(_0xce47('0xb'));var ut=require(_0xce47('0xc'));config[_0xce47('0xd')]=_[_0xce47('0xe')](config['redis'],{'host':_0xce47('0xf'),'port':0x18eb});var io=require(_0xce47('0x10'))(new Redis(config[_0xce47('0xd')]));var Sequence=function(){};Sequence[_0xce47('0x11')][_0xce47('0x12')]=function(_0x231059){this[_0xce47('0x13')]=this[_0xce47('0x13')]?this[_0xce47('0x13')]['finally'](_0x231059):_0x231059();};function Preview(_0x3b3981){this[_0xce47('0x14')]=new Sequence();this[_0xce47('0x15')]=_0x3b3981[_0xce47('0x16')];this[_0xce47('0x17')]=_0x3b3981[_0xce47('0x17')];this['actions']={};this[_0xce47('0x18')]=_0x3b3981[_0xce47('0x18')];this[_0xce47('0x19')]=0x0;ami['on'](_0xce47('0x1a'),this[_0xce47('0x1b')][_0xce47('0x1c')](this));ami['on'](_0xce47('0x1d'),this[_0xce47('0x1e')][_0xce47('0x1c')](this));ami['on'](_0xce47('0x1f'),this[_0xce47('0x20')][_0xce47('0x1c')](this));ami['on'](_0xce47('0x21'),this[_0xce47('0x22')]['bind'](this));ami['on'](_0xce47('0x23'),this[_0xce47('0x24')][_0xce47('0x1c')](this));ami['on'](_0xce47('0x25'),this[_0xce47('0x26')][_0xce47('0x1c')](this));ami['on'](_0xce47('0x27'),this[_0xce47('0x28')][_0xce47('0x1c')](this));ami['on'](_0xce47('0x29'),this[_0xce47('0x2a')][_0xce47('0x1c')](this));this[_0xce47('0x2b')](this[_0xce47('0x15')]);}function emit(_0x7ed2d1,_0x39d571,_0x3c60c8){io['to'](_0x7ed2d1)[_0xce47('0x2c')](_0x39d571,_0x3c60c8);}function emitCampaignPreview(_0x5cd6f8){if(_0x5cd6f8[_0xce47('0x2d')]===_0xce47('0x2e')){var _0x3ed0a0={'id':_0x5cd6f8['id'],'name':_0x5cd6f8[_0xce47('0x2f')],'strategy':_0x5cd6f8[_0xce47('0x30')],'answered':_0x5cd6f8[_0xce47('0x31')],'available':_0x5cd6f8[_0xce47('0x32')],'loggedIn':_0x5cd6f8[_0xce47('0x33')],'pTalking':_0x5cd6f8['pTalking'],'sumBillable':_0x5cd6f8['sumBillable'],'sumDuration':_0x5cd6f8[_0xce47('0x34')],'sumHoldTime':_0x5cd6f8[_0xce47('0x35')]||0x0,'talking':_0x5cd6f8[_0xce47('0x36')],'total':_0x5cd6f8['total'],'type':_0x5cd6f8[_0xce47('0x2d')],'unmanaged':_0x5cd6f8['unmanaged'],'abandoned':_0x5cd6f8[_0xce47('0x37')],'waiting':_0x5cd6f8[_0xce47('0x38')],'loggedInDb':_0x5cd6f8[_0xce47('0x39')],'dialActive':_0x5cd6f8[_0xce47('0x3a')],'dialMethod':_0x5cd6f8[_0xce47('0x3b')],'dialOriginateCallerIdName':_0x5cd6f8[_0xce47('0x3c')],'dialOriginateCallerIdNumber':_0x5cd6f8[_0xce47('0x3d')],'dialOriginateTimeout':_0x5cd6f8['dialOriginateTimeout'],'dialPrefix':_0x5cd6f8[_0xce47('0x3e')],'outboundAnswerAgiCallsDay':_0x5cd6f8[_0xce47('0x3f')],'outboundAnswerCallsDay':_0x5cd6f8[_0xce47('0x40')],'outboundBlacklistCallsDay':_0x5cd6f8[_0xce47('0x41')],'outboundBusyCallsDay':_0x5cd6f8['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x5cd6f8[_0xce47('0x42')],'outboundDropCallsDayACS':_0x5cd6f8[_0xce47('0x43')],'outboundDropCallsDayCallersExit':_0x5cd6f8[_0xce47('0x44')],'outboundDropCallsDayTimeout':_0x5cd6f8[_0xce47('0x45')],'outboundNoAnswerCallsDay':_0x5cd6f8[_0xce47('0x46')],'outboundNoSuchCallsDay':_0x5cd6f8[_0xce47('0x47')],'outboundOriginateFailureCallsDay':_0x5cd6f8[_0xce47('0x48')],'outboundReCallsDay':_0x5cd6f8['outboundReCallsDay'],'outboundRejectCallsDay':_0x5cd6f8[_0xce47('0x49')],'outboundUnknownCallsDay':_0x5cd6f8[_0xce47('0x4a')],'outboundAbandonedCallsDay':_0x5cd6f8[_0xce47('0x4b')],'predictiveIntervalAnsweredCalls':_0x5cd6f8[_0xce47('0x4c')],'predictiveIntervalAvgHoldtime':_0x5cd6f8[_0xce47('0x4d')],'predictiveIntervalAvgTalktime':_0x5cd6f8['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5cd6f8['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x5cd6f8[_0xce47('0x4e')],'predictiveIntervalErlangCalls':_0x5cd6f8[_0xce47('0x4f')],'predictiveIntervalErlangCallsDroppedCalls':_0x5cd6f8[_0xce47('0x50')],'predictiveIntervalHitRate':_0x5cd6f8[_0xce47('0x51')],'predictiveIntervalMultiplicativeFactor':_0x5cd6f8[_0xce47('0x52')],'predictiveIntervalPauses':_0x5cd6f8[_0xce47('0x53')],'predictiveIntervalAvailable':_0x5cd6f8[_0xce47('0x54')],'predictiveIntervalTotalCalls':_0x5cd6f8[_0xce47('0x55')],'message':_0x5cd6f8[_0xce47('0x56')],'originated':_0x5cd6f8[_0xce47('0x57')],'erlangCalls':_0x5cd6f8[_0xce47('0x58')],'erlangCallToSecond':_0x5cd6f8[_0xce47('0x59')],'erlangAbandonmentRate':_0x5cd6f8[_0xce47('0x5a')],'erlangBusyFactor':_0x5cd6f8[_0xce47('0x5b')],'startPredictive':_0x5cd6f8[_0xce47('0x5c')],'startProgressive':_0x5cd6f8[_0xce47('0x5d')]};if(_0x5cd6f8['Trunk']){_0x3ed0a0[_0xce47('0x5e')]={'id':_0x5cd6f8[_0xce47('0x5e')]['id'],'name':_0x5cd6f8[_0xce47('0x5e')]['name'],'active':_0x5cd6f8[_0xce47('0x5e')][_0xce47('0x5f')],'callerid':_0x5cd6f8[_0xce47('0x5e')]['callerid']};}if(_0x5cd6f8[_0xce47('0x60')]){_0x3ed0a0[_0xce47('0x60')]={'id':_0x5cd6f8[_0xce47('0x60')]['id'],'name':_0x5cd6f8['Interval'][_0xce47('0x2f')]};}var _0x22da7b=md5(JSON[_0xce47('0x61')](_0x3ed0a0));if(_0x5cd6f8[_0xce47('0x3')]!==_0x22da7b){_0x5cd6f8[_0xce47('0x3')]=_0x22da7b;emit(util[_0xce47('0x62')](_0xce47('0x63'),_0x3ed0a0['name']),_0xce47('0x64'),_0x3ed0a0);}}}function emitVoiceQueueChannelRemove(_0x387601){logger[_0xce47('0x65')](_0xce47('0x66'),JSON[_0xce47('0x61')](_0x387601));emit(util[_0xce47('0x62')](_0xce47('0x63'),_0x387601[_0xce47('0x2f')]),'voice_queue_channel:remove',_0x387601);}function notSendMessagesQueue(_0x3f9151){if(_0x3f9151[_0xce47('0x67')]){if(_0x3f9151['originated']===0x0&&_0x3f9151[_0xce47('0x68')]===0x0){_0x3f9151[_0xce47('0x67')]=![];_0x3f9151[_0xce47('0x32')]=0x0;_0x3f9151[_0xce47('0x69')]=0x0;_0x3f9151['message']=_0xce47('0x6a');ut[_0xce47('0x6b')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3f9151[_0xce47('0x2f')]+_0xce47('0x6c'));}else{_0x3f9151[_0xce47('0x56')]=_0xce47('0x6d');ut[_0xce47('0x6b')](_0xce47('0x6e'),_0x3f9151['name']+_0xce47('0x6f'));}emitCampaignPreview(_0x3f9151);}}Preview['prototype'][_0xce47('0x2b')]=function(){var _0x2d1462=this;setInterval(function(){_0x2d1462[_0xce47('0x70')]();},0x7cf);};Preview[_0xce47('0x11')][_0xce47('0x70')]=function(){var _0xfcf8e6=this['campaignsPreview'];this[_0xce47('0x19')]+=0x1;for(var _0x1b0cfd in _0xfcf8e6){if(_0xfcf8e6[_0xce47('0x71')](_0x1b0cfd)&&(_0xfcf8e6[_0x1b0cfd]['dialMethod']===_0xce47('0x7')||_0xfcf8e6[_0x1b0cfd]['dialMethod']==='booked')&&_0xfcf8e6[_0x1b0cfd][_0xce47('0x2d')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xce47('0x19')]=0x0;this[_0xce47('0x72')]();}}if(_0xfcf8e6[_0xce47('0x71')](_0x1b0cfd)&&_0xfcf8e6[_0x1b0cfd][_0xce47('0x3b')]===_0xce47('0x7')&&_0xfcf8e6[_0x1b0cfd][_0xce47('0x2d')]==='outbound'){if(_0xfcf8e6[_0x1b0cfd][_0xce47('0x3a')]){this['setMessage'](_0xfcf8e6[_0x1b0cfd]);this[_0xce47('0x73')](_0xfcf8e6[_0x1b0cfd]);}else{notSendMessagesQueue(_0xfcf8e6[_0x1b0cfd]);}}}};Preview['prototype'][_0xce47('0x74')]=function(_0x32f044){var _0x2ee319=this;this[_0xce47('0x14')]['enqueue'](function(){if(!_[_0xce47('0x75')](_0x2ee319[_0xce47('0x76')][_0x32f044])){loggerAction[_0xce47('0x65')](_0xce47('0x77'),_0x32f044,_0xce47('0x78'),_0x2ee319['actions'][_0x32f044]['queue'],'originated:\x20',JSON['stringify'](_0x2ee319[_0xce47('0x15')][_0x2ee319[_0xce47('0x76')][_0x32f044][_0xce47('0x79')]][_0xce47('0x57')]),'pTalking:\x20',JSON[_0xce47('0x61')](_0x2ee319['campaignsPreview'][_0x2ee319[_0xce47('0x76')][_0x32f044][_0xce47('0x79')]][_0xce47('0x68')]),JSON['stringify'](_0x2ee319[_0xce47('0x76')][_0x32f044][_0xce47('0x7a')]),JSON['stringify'](_[_0xce47('0x7b')](_0x2ee319[_0xce47('0x76')][_0x32f044],['contactId',_0xce47('0x7c'),_0xce47('0x7d'),_0xce47('0x7e')])));return ami[_0xce47('0x7f')]({'action':'status','channel':_0x2ee319['actions'][_0x32f044][_0xce47('0x80')]})[_0xce47('0x81')](function(_0x1ace8f){if(_0x1ace8f[_0xce47('0x56')]===_0xce47('0x82')){setTimeout(function(){if(_0x2ee319[_0xce47('0x76')][_0x32f044]){ut['updateOriginated'](_0x2ee319['campaignsPreview'][_0x2ee319[_0xce47('0x76')][_0x32f044][_0xce47('0x79')]],_0xce47('0x83'));if(_0x2ee319['actions'][_0x32f044][_0xce47('0x7a')]===!![]){ut[_0xce47('0x84')](_0x2ee319[_0xce47('0x15')][_0x2ee319['actions'][_0x32f044][_0xce47('0x79')]],_0xce47('0x83'));ut['loggerError'](_0xce47('0x85')+_0x32f044,_0x2ee319['actions'][_0x32f044][_0xce47('0x79')]);}ut[_0xce47('0x86')]('[Dialer][checkChannel][Preview]'+_0x32f044,_0x2ee319[_0xce47('0x76')][_0x32f044]['queue']);delete _0x2ee319['actions'][_0x32f044];}},0x2328);}});}});};Preview[_0xce47('0x11')]['clearZombieChannels']=function(){var _0x4478e0=this;loggerAction[_0xce47('0x65')]('[action]',_[_0xce47('0x87')](this[_0xce47('0x76')]));for(var _0x2ddd9f in this[_0xce47('0x76')]){if(_0x4478e0[_0xce47('0x76')][_0xce47('0x71')](_0x2ddd9f)){_0x4478e0[_0xce47('0x74')](_0x2ddd9f);}}};Preview[_0xce47('0x11')][_0xce47('0x73')]=function(_0x212a9d){var _0x444054=this;rpcDb[_0xce47('0x88')](_0x212a9d['id'],ut[_0xce47('0x89')](this[_0xce47('0x18')]))[_0xce47('0x8a')](function(_0x40b499){if(!_[_0xce47('0x75')](_0x40b499)){for(var _0x2ed852=0x0;_0x2ed852<_0x40b499['length'];_0x2ed852+=0x1){if(ut[_0xce47('0x8b')](_0x40b499[_0x2ed852][_0xce47('0x8c')])<_0x212a9d['dialRecallMeTimeout']*0x3c){if(_0x40b499[_0x2ed852][_0xce47('0x8d')]&&!_0x40b499[_0x2ed852]['Agent']['voicePause']){_0x444054['run'](_0x40b499[_0x2ed852]['id'])[_0xce47('0x8a')](ut[_0xce47('0x8e')](_0xce47('0x8f')))['catch'](ut[_0xce47('0x8e')](_0xce47('0x8f')));}else{rpcDb['disableContact'](_0x40b499[_0x2ed852]['id']);}}else{var _0x143f08=new Action(_0x40b499[_0x2ed852],_0x212a9d);_0x143f08['starttime']=moment()[_0xce47('0x62')](_0xce47('0x90'));_0x212a9d[_0xce47('0x91')]+=0x1;ut[_0xce47('0x92')](_0x143f08,0x17,_0xce47('0x93'));if(_0x212a9d[_0xce47('0x94')]){rpcDb[_0xce47('0x95')](ut['createBody'](_0x40b499[_0x2ed852]));rpcDb[_0xce47('0x96')](_0x143f08,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x143f08,0x16,_0xce47('0x97'));rpcDb[_0xce47('0x96')](_0x143f08,_0xce47('0x98'));rpcDb[_0xce47('0x99')](_0x143f08,_0xce47('0x98'));}}}}})[_0xce47('0x81')](ut['logger2']('[getContactRecallMe]'));};Preview[_0xce47('0x11')][_0xce47('0x9a')]=function(_0x386c44){_0x386c44['sendMessageOneNotActive']=!![];if(ut[_0xce47('0x9b')](_0x386c44['loggedIn'])){_0x386c44[_0xce47('0x56')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xce47('0x9c')](_0x386c44[_0xce47('0x3a')])){_0x386c44['message']=_0xce47('0x6a');}else if(!this[_0xce47('0x9d')](_0x386c44[_0xce47('0x5e')])){if(!this[_0xce47('0x9d')](_0x386c44['TrunkBackup'])){_0x386c44['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x386c44[_0xce47('0x56')]=_0xce47('0x9e');}}else{_0x386c44[_0xce47('0x56')]=_0xce47('0x9e');}emitCampaignPreview(_0x386c44);};Preview['prototype'][_0xce47('0x9f')]=function(_0x4556ae,_0x22e0c7,_0x3c765f){var _0x5856dd=this;var _0x4e78d7=this[_0xce47('0x76')][_0x22e0c7];var _0x48844c=this[_0xce47('0x15')][_0x4e78d7[_0xce47('0x79')]];var _0x39ae13;if(_0x48844c){switch(_0x3c765f){case'1':_0x48844c[_0xce47('0x47')]+=0x1;_0x4e78d7[_0xce47('0xa0')]+=0x1;_0x4e78d7[_0xce47('0xa1')]=ut[_0xce47('0xa2')](_0x4e78d7);ut[_0xce47('0x92')](_0x4e78d7,0x0,_0xce47('0xa3'));ami[_0xce47('0x2c')](_0xce47('0xa4'),ut[_0xce47('0xa5')](_0x4e78d7,_0xce47('0xa6')));rpcDb[_0xce47('0x96')](_0x4e78d7,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c[_0xce47('0xa7')]){_0x39ae13=ut[_0xce47('0xa8')](_0x4e78d7,0xf,_0xce47('0xa9'));rpcDb[_0xce47('0x99')](_0x39ae13,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x4e78d7[_0xce47('0xa0')]>=_0x48844c[_0xce47('0xaa')]){rpcDb[_0xce47('0x99')](_0x4e78d7,_0xce47('0xab'));}else{rpcDb['rescheduleContact'](ut[_0xce47('0xac')](_0x4e78d7,'countnosuchnumberretry',_0x48844c[_0xce47('0xad')]),_0x4e78d7['unlockAgent'],_0x4e78d7[_0xce47('0xae')]);}}delete this[_0xce47('0x76')][_0x4556ae[_0xce47('0xaf')]];break;case _0xce47('0xb0'):var _0x249a61=moment()['format'](_0xce47('0x90'));_0x4e78d7[_0xce47('0xb1')]=_0x249a61;_0x4e78d7[_0xce47('0xb2')]=_0x249a61;_0x4e78d7[_0xce47('0x7a')]=!![];_0x48844c[_0xce47('0x68')]+=0x1;logger[_0xce47('0x65')]('[syncHangup][talking][increment]',_0x4e78d7[_0xce47('0xb3')],_0xce47('0xb4'),_0x48844c['name'],_0xce47('0xb5'),_0x48844c[_0xce47('0x68')]);ami[_0xce47('0x2c')](_0xce47('0xb6'),ut[_0xce47('0xa5')](_0x4e78d7,_0xce47('0xb7')));if(_0x48844c[_0xce47('0xb8')]){ami[_0xce47('0x2c')](_0xce47('0xb9'),ut[_0xce47('0xba')](_0x4e78d7));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0xce47('0xa5')](_0x4e78d7,'complete'));emitVoiceQueueChannelRemove(ut[_0xce47('0xa5')](_0x4e78d7,_0xce47('0xbb')));_0x48844c[_0xce47('0x40')]+=0x1;_0x48844c['total']+=0x1;_0x48844c['answered']+=0x1;ut['decrementTalkink'](_0x48844c,'[16]');_0x4e78d7['countglobal']=ut[_0xce47('0xa2')](_0x4e78d7);ut['logCustomer'](_0x4e78d7,0x4,_0xce47('0xbc'));rpcDb[_0xce47('0x96')](_0x4e78d7,_0xce47('0xbd'));rpcDb[_0xce47('0x99')](_0x4e78d7,_0xce47('0xbe'));rpcDb[_0xce47('0xbf')](_0x4e78d7);_0x48844c['sumDuration']+=_0x4e78d7[_0xce47('0xc0')];_0x48844c[_0xce47('0xc1')]+=_0x4e78d7[_0xce47('0xc0')];logger[_0xce47('0x65')](_0xce47('0xc2'),_0x4e78d7['uniqueid'],'\x20Queue',_0x48844c['name'],_0xce47('0xb5'),_0x48844c['pTalking']);delete this['actions'][_0x4556ae[_0xce47('0xaf')]];break;case'BUSY':_0x48844c[_0xce47('0xc3')]+=0x1;_0x4e78d7['countbusyretry']+=0x1;_0x4e78d7[_0xce47('0xa1')]=ut['totalGlobal'](_0x4e78d7);ut[_0xce47('0x92')](_0x4e78d7,0x5,_0xce47('0xc4'));ami[_0xce47('0x2c')](_0xce47('0xc5'),ut[_0xce47('0xa5')](_0x4e78d7,_0xce47('0xc6')));rpcDb[_0xce47('0x96')](_0x4e78d7,_0xce47('0xc7'));if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c[_0xce47('0xa7')]){_0x39ae13=ut[_0xce47('0xa8')](_0x4e78d7,0xf,'Global');rpcDb[_0xce47('0x99')](_0x39ae13,_0xce47('0xc8'));}else{if(_0x4e78d7[_0xce47('0xc9')]>=_0x48844c[_0xce47('0xca')]){rpcDb[_0xce47('0x99')](_0x4e78d7,_0xce47('0xc7'));}else{rpcDb[_0xce47('0xcb')](ut['scheduledAt'](_0x4e78d7,_0xce47('0xc9'),_0x48844c[_0xce47('0xcc')]),_0x4e78d7[_0xce47('0xcd')],_0x4e78d7[_0xce47('0xae')]);}}break;case _0xce47('0xce'):_0x48844c['outboundNoAnswerCallsDay']+=0x1;_0x4e78d7[_0xce47('0xcf')]+=0x1;_0x4e78d7['countglobal']=ut[_0xce47('0xa2')](_0x4e78d7);ut[_0xce47('0x92')](_0x4e78d7,0x3,_0xce47('0xd0'));ami[_0xce47('0x2c')](_0xce47('0xd1'),ut['buildObj'](_0x4e78d7,_0xce47('0xd2')));rpcDb[_0xce47('0x96')](_0x4e78d7,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c['dialGlobalMaxRetry']){_0x39ae13=ut[_0xce47('0xa8')](_0x4e78d7,0xf,_0xce47('0xa9'));rpcDb[_0xce47('0x99')](_0x39ae13,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x4e78d7[_0xce47('0xcf')]>=_0x48844c[_0xce47('0xd3')]){rpcDb[_0xce47('0x99')](_0x4e78d7,_0xce47('0xd4'));}else{rpcDb[_0xce47('0xcb')](ut[_0xce47('0xac')](_0x4e78d7,_0xce47('0xcf'),_0x48844c[_0xce47('0xd5')]),_0x4e78d7[_0xce47('0xcd')],_0x4e78d7[_0xce47('0xae')]);}}break;case'CONGESTION':_0x48844c[_0xce47('0x42')]+=0x1;_0x4e78d7['countcongestionretry']+=0x1;_0x4e78d7[_0xce47('0xa1')]=ut[_0xce47('0xa2')](_0x4e78d7);ut[_0xce47('0x92')](_0x4e78d7,0x8,_0xce47('0xd6'));ami[_0xce47('0x2c')](_0xce47('0xd7'),ut[_0xce47('0xa5')](_0x4e78d7,'congestion'));rpcDb[_0xce47('0x96')](_0x4e78d7,_0xce47('0xd8'));if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c['dialGlobalMaxRetry']){_0x39ae13=ut[_0xce47('0xa8')](_0x4e78d7,0xf,_0xce47('0xa9'));rpcDb[_0xce47('0x99')](_0x39ae13,_0xce47('0xd9'));}else{if(_0x4e78d7['countcongestionretry']>=_0x48844c[_0xce47('0xda')]){rpcDb['createCustomerFinal'](_0x4e78d7,_0xce47('0xd8'));}else{rpcDb[_0xce47('0xcb')](ut[_0xce47('0xac')](_0x4e78d7,_0xce47('0xdb'),_0x48844c[_0xce47('0xcc')]),_0x4e78d7[_0xce47('0xcd')],_0x4e78d7[_0xce47('0xae')]);}}break;case'CANCEL':_0x48844c[_0xce47('0x49')]+=0x1;_0x4e78d7[_0xce47('0xdc')]+=0x1;_0x4e78d7[_0xce47('0xa1')]=ut[_0xce47('0xa2')](_0x4e78d7);ut['logCustomer'](_0x4e78d7,0x14,_0xce47('0xdd'));ami['emit'](_0xce47('0xde'),ut[_0xce47('0xa5')](_0x4e78d7,_0xce47('0xdf')));rpcDb[_0xce47('0x96')](_0x4e78d7,_0xce47('0xe0'));if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c[_0xce47('0xa7')]){_0x39ae13=ut[_0xce47('0xa8')](_0x4e78d7,0x14,'AgentReject');rpcDb[_0xce47('0x99')](_0x39ae13,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4e78d7[_0xce47('0xdc')]>=_0x48844c['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x4e78d7,_0xce47('0xe1'));}else{rpcDb[_0xce47('0xcb')](ut['scheduledAt'](_0x4e78d7,'countagentrejectretry',_0x48844c[_0xce47('0xe2')]),_0x4e78d7[_0xce47('0xcd')],_0x4e78d7['activeContact']);}}break;case'ABANDONED':_0x48844c[_0xce47('0x4b')]+=0x1;_0x4e78d7[_0xce47('0xe3')]+=0x1;_0x4e78d7[_0xce47('0xa1')]=ut[_0xce47('0xa2')](_0x4e78d7);ut[_0xce47('0x92')](_0x4e78d7,0xb,_0xce47('0xe4'));rpcDb['createCustomerHistory'](_0x4e78d7,_0xce47('0xe5'));if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c[_0xce47('0xa7')]){_0x39ae13=ut['cloneAction'](_0x4e78d7,0xf,_0xce47('0xa9'));rpcDb[_0xce47('0x99')](_0x39ae13,_0xce47('0xe5'));}else{if(_0x4e78d7['countabandonedetry']>=_0x48844c[_0xce47('0xe6')]){rpcDb[_0xce47('0x99')](_0x4e78d7,_0xce47('0xe5'));}else{rpcDb[_0xce47('0xcb')](ut[_0xce47('0xac')](_0x4e78d7,'countabandonedretry',_0x48844c[_0xce47('0xe7')]),_0x4e78d7[_0xce47('0xcd')],_0x4e78d7[_0xce47('0xae')]);}}break;default:if(_0x4e78d7['dialAnswer']){ut['decrementTalkink'](_0x48844c,_0xce47('0xe8'));ut[_0xce47('0x86')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x48844c[_0xce47('0x2f')],_0x4556ae);}_0x48844c[_0xce47('0x4a')]+=0x1;_0x4e78d7[_0xce47('0xa1')]=ut[_0xce47('0xa2')](_0x4e78d7);ut['logCustomer'](_0x4e78d7,0xc,_0x4556ae[_0xce47('0xe9')]||_0x4556ae['dialstatus']);rpcDb[_0xce47('0x96')](_0x4e78d7,_0xce47('0xea'));if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c[_0xce47('0xa7')]){_0x39ae13=ut[_0xce47('0xa8')](_0x4e78d7,0xf,_0xce47('0xa9'));rpcDb[_0xce47('0x99')](_0x39ae13,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xce47('0x99')](_0x4e78d7,_0xce47('0xeb'));}delete this[_0xce47('0x76')][_0x4556ae[_0xce47('0xaf')]];}if(!(_0x4e78d7['dialAnswer']&&_0x3c765f==='16')){ut[_0xce47('0xec')](_0x48844c,_0xce47('0xed'));logger[_0xce47('0x65')](_0xce47('0xee'),_0x4e78d7[_0xce47('0xb3')],_0xce47('0xb4'),_0x48844c[_0xce47('0x2f')],'originated:\x20',_0x48844c[_0xce47('0x57')]);}if(_0x3c765f!==_0xce47('0xb0')){delete this['actions'][_0x4556ae[_0xce47('0xaf')]];delete this[_0xce47('0x76')][_0x4556ae[_0xce47('0xef')]];}}};Preview[_0xce47('0x11')][_0xce47('0xf0')]=function(_0x53d986,_0x10a05f,_0x49cbc4){if(_['isUndefined'](_0x10a05f)&&'object'!==typeof _0x10a05f){return;}if(_[_0xce47('0xf1')](_0x49cbc4)&&_0xce47('0xf2')!==typeof _0x49cbc4){return;}switch(_0x49cbc4['reason']){case'0':ut['logAgent'](_0x53d986,0x0,_0xce47('0xa3'));rpcDb['createAgentHistory'](_0x53d986,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x53d986,0x3,_0xce47('0xd0'));rpcDb[_0xce47('0xf3')](_0x53d986,_0xce47('0xf4'));break;case'5':ut['logAgent'](_0x53d986,0x5,'Busy');rpcDb[_0xce47('0xf3')](_0x53d986,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xce47('0xf5')](_0x53d986,0x8,_0xce47('0xd6'));rpcDb[_0xce47('0xf3')](_0x53d986,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xce47('0xf5')](_0x53d986,0x16,_0xce47('0xf6'));rpcDb[_0xce47('0xf3')](_0x53d986,_0xce47('0xf7'));break;default:ut['logAgent'](_0x53d986,0xc,_0x49cbc4[_0xce47('0xf8')]);rpcDb[_0xce47('0xf3')](_0x53d986,_0xce47('0xf9'));}ut[_0xce47('0xec')](_0x10a05f,_0xce47('0xfa'));logger['info'](_0xce47('0xfb'),_0x53d986[_0xce47('0xb3')],_0xce47('0xb4'),_0x10a05f[_0xce47('0x2f')],_0xce47('0xfc'),_0x10a05f[_0xce47('0x57')]);delete this['actions'][_0x53d986[_0xce47('0xb3')]];};Preview['prototype']['checkInBlack']=function(_0x250dfd,_0x27d8be,_0x5e2b86,_0x3efba9,_0x32a9d5){var _0x230b28=this;return new BPromise(function(_0x4a01a4,_0xefecaa){if(_[_0xce47('0x75')](_0x27d8be)||_[_0xce47('0x75')](_0x27d8be[_0xce47('0xfd')])||_[_0xce47('0x75')](_0x27d8be[_0xce47('0xfd')][_0xce47('0xfe')])||_[_0xce47('0x75')](_0x27d8be['VoiceQueueId'])){_0xefecaa(ut[_0xce47('0x56')](_0xce47('0xff'),_0x3efba9,_0x32a9d5));return;}var _0x4aff99=uuid['v4']();var _0x6b3ed4=_0x230b28['campaignsPreview'][_0x27d8be[_0xce47('0x78')][_0xce47('0x2f')]];var _0xf39bfe=_0x5e2b86?_0x230b28[_0xce47('0x18')][_0x5e2b86]['id']:undefined;_0x230b28[_0xce47('0x76')][_0x4aff99]=new Action(_0x27d8be,_0x6b3ed4,_0x4aff99,_0x5e2b86,_0xf39bfe);var _0x462e29=_0x230b28[_0xce47('0x76')][_0x4aff99];_0x462e29[_0xce47('0xcd')]=_0x3efba9;_0x462e29[_0xce47('0xae')]=_0x32a9d5;_0x462e29['lookAgent']=_0x5e2b86;if(_[_0xce47('0x100')](_0x250dfd)){_0x230b28['execCall'](_0x462e29,_0x6b3ed4,_0x27d8be,_0x5e2b86)[_0xce47('0x8a')](function(_0x14b590){logger[_0xce47('0x65')](_0xce47('0x101'),'Queue:\x20'+_0x462e29[_0xce47('0x79')]+_0xce47('0x102')+_0x462e29[_0xce47('0x103')],JSON[_0xce47('0x61')](_0x14b590));ami['emit'](_0xce47('0x104'),ut['buildObj'](_0x462e29,_0xce47('0x105')));_0x4a01a4(ut['message'](_0xce47('0x106')));})['catch'](function(_0xa85363){ut['logger'](_0xce47('0x107'),_0xa85363);_0xefecaa(ut[_0xce47('0x56')](_0xce47('0x108'),_0x3efba9,_0x32a9d5));});}else{_0x6b3ed4[_0xce47('0x41')]+=0x1;ut[_0xce47('0x109')](_0x462e29);rpcDb[_0xce47('0x10a')](_0x462e29,_0xce47('0x10b'));delete _0x230b28['actions'][_0x4aff99];_0xefecaa(ut[_0xce47('0x56')](_0xce47('0x10c'),_0x3efba9,_0x32a9d5));}});};Preview[_0xce47('0x11')][_0xce47('0x9d')]=function(_0x2ca866){return!_['isNil'](_0x2ca866)&&!_[_0xce47('0x75')](_0x2ca866[_0xce47('0x2f')])&&!_[_0xce47('0x75')](_0x2ca866[_0xce47('0x5f')])&&_0x2ca866[_0xce47('0x5f')]&&!_[_0xce47('0x75')](this['trunks'][util[_0xce47('0x62')](_0xce47('0x10d'),_0x2ca866[_0xce47('0x2f')])])&&!_[_0xce47('0x75')](this[_0xce47('0x17')][util[_0xce47('0x62')](_0xce47('0x10d'),_0x2ca866[_0xce47('0x2f')])]['status'])&&(this['trunks'][util['format']('SIP/%s',_0x2ca866['name'])][_0xce47('0x10e')]===_0xce47('0x10f')||this[_0xce47('0x17')][util[_0xce47('0x62')](_0xce47('0x10d'),_0x2ca866[_0xce47('0x2f')])]['status']==='unmonitored');};Preview[_0xce47('0x11')][_0xce47('0x110')]=function(_0x5749b5,_0xcf16a7){var _0x284d45=this;return new BPromise(function(_0x1932c2,_0x12ae82){_0x284d45[_0xce47('0x111')](_0x5749b5,_0xcf16a7)['then'](function(_0xf05518){_0x1932c2(_[_0xce47('0x7b')](_0xf05518,[_0xce47('0x56')]));})[_0xce47('0x81')](function(_0x420794){if(_0x420794[_0xce47('0x112')]){rpcDb[_0xce47('0x113')](_0x5749b5);}if(_0x420794[_0xce47('0x5f')]){rpcDb[_0xce47('0x114')](_0x5749b5);}_0x12ae82(_[_0xce47('0x7b')](_0x420794,['message']));});});};Preview[_0xce47('0x11')][_0xce47('0x111')]=function(_0x569b0b,_0x252aaf){var _0x289b58=this;return new BPromise(function(_0x113cb1,_0x19d0e2){var _0x54f55a,_0x300745;rpcDb[_0xce47('0x115')](_0x569b0b)[_0xce47('0x8a')](function(_0x30c4f3){if(!_[_0xce47('0x75')](_0x30c4f3[0x0])){_0x300745=_0x30c4f3[0x0][_0xce47('0x116')]?![]:!![];_0x54f55a=_0x30c4f3[0x0][_0xce47('0x116')]?!![]:![];_0x54f55a=_0x252aaf?!![]:_0x54f55a;}var _0x13cf51=_0x289b58[_0xce47('0x117')](_0x30c4f3);if(_0x13cf51[_0xce47('0x118')]){rpcDb['checkIsBlackList'](_[_0xce47('0x7b')](_0x30c4f3[0x0],[_0xce47('0x7d'),_0xce47('0x119')]))[_0xce47('0x8a')](function(_0x5e0756){_0x289b58[_0xce47('0x11a')](_0x5e0756,_0x30c4f3[0x0],_0x252aaf,_0x300745,_0x54f55a)[_0xce47('0x8a')](function(_0x562fc8){_0x113cb1(_0x562fc8);})[_0xce47('0x81')](function(_0x437588){_0x19d0e2(_0x437588);});})['catch'](function(_0x41c067){ut[_0xce47('0x6b')](_0xce47('0x11b'),_0x41c067);_0x19d0e2(ut[_0xce47('0x56')]('Call\x20unsuccessful',_0x300745,_0x54f55a));});}else{_0x19d0e2(ut['message'](_0x13cf51['message'],_0x300745,_0x54f55a));}})[_0xce47('0x81')](function(_0x145eed){ut[_0xce47('0x6b')](_0xce47('0x11c'),_0x145eed);_0x19d0e2(ut[_0xce47('0x56')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xce47('0x11')][_0xce47('0x117')]=function(_0x1ca101){if(_[_0xce47('0x75')](_0x1ca101)||_['isEmpty'](_0x1ca101)||!_['isNil'](_0x1ca101[0x0][_0xce47('0x8d')])&&_['isNil'](_0x1ca101[0x0]['Agent'][_0xce47('0x2f')])){ut[_0xce47('0x6b')]('[Preview][validateContact][Empty\x20Contact]',_0x1ca101);return{'isValid':![],'message':_0xce47('0x11d')};}var _0x247f00=this[_0xce47('0x15')][_0x1ca101[0x0]['Queue'][_0xce47('0x2f')]];_0x247f00[_0xce47('0x56')]=_0xce47('0x9e');if(_[_0xce47('0x75')](_0x247f00)){ut['logger'](_0xce47('0x11e'),_0x247f00);return{'isValid':![],'message':_0xce47('0x11f')};}if(!this[_0xce47('0x9d')](_0x247f00[_0xce47('0x5e')])){ut['logger'](_0xce47('0x120'),'campaign\x20Name:\x20'+_0x247f00['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xce47('0x9d')](_0x247f00[_0xce47('0x121')])){ut[_0xce47('0x6b')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x247f00[_0xce47('0x2f')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xce47('0x122')};}}if(!ut[_0xce47('0x9c')](_0x247f00[_0xce47('0x3a')])){ut[_0xce47('0x6b')](_0xce47('0x123'),_0x247f00[_0xce47('0x2f')]+_0xce47('0x124'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x247f00[_0xce47('0x2f')]+_0xce47('0x124')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xce47('0x11')]['execCall']=function(_0x3f518b,_0x27228f,_0x1555d0,_0x5067d1){var _0x2ae0da=this;return new BPromise(function(_0x18f145,_0x338ff0){var _0x2ef21f=_0x3f518b[_0xce47('0xb3')];var _0x22d52b=_0x2ae0da['isTrunkReachable'](_0x27228f[_0xce47('0x5e')])?util[_0xce47('0x62')](_0xce47('0x125'),_0x27228f[_0xce47('0x5e')][_0xce47('0x2f')],_[_0xce47('0x75')](_0x27228f[_0xce47('0x3e')])?'':_0x27228f[_0xce47('0x3e')][_0xce47('0x126')]()||'',_0x27228f[_0xce47('0x127')]>0x0?_0x1555d0['Contact'][_0xce47('0xfe')][_0xce47('0x128')](_0x27228f[_0xce47('0x127')]):_0x1555d0[_0xce47('0xfd')][_0xce47('0xfe')]):util[_0xce47('0x62')](_0xce47('0x125'),_['isNil'](_0x27228f[_0xce47('0x121')])?_0x27228f['Trunk'][_0xce47('0x2f')]:_0x27228f[_0xce47('0x121')]['name'],_['isNil'](_0x27228f[_0xce47('0x3e')])?'':_0x27228f[_0xce47('0x3e')][_0xce47('0x126')]()||'',_0x27228f[_0xce47('0x127')]>0x0?_0x1555d0[_0xce47('0xfd')]['phone'][_0xce47('0x128')](_0x27228f[_0xce47('0x127')]):_0x1555d0[_0xce47('0xfd')]['phone']);var _0x388dcc=_0x2ae0da[_0xce47('0x9d')](_0x27228f[_0xce47('0x5e')])?ut['getCallerId'](_0x27228f[_0xce47('0x5e')][_0xce47('0x129')],_0x27228f[_0xce47('0x3c')],_0x27228f[_0xce47('0x12a')]>0x0?ut[_0xce47('0x12b')](_0x27228f[_0xce47('0x3d')],_0x27228f[_0xce47('0x12a')]):_0x27228f[_0xce47('0x3d')]):ut[_0xce47('0x12c')](_[_0xce47('0x75')](_0x27228f[_0xce47('0x121')])?_0x27228f[_0xce47('0x5e')]['callerid']:_0x27228f[_0xce47('0x121')][_0xce47('0x129')],_0x27228f[_0xce47('0x3c')],_0x27228f[_0xce47('0x12a')]>0x0?ut['getCallerIdRandom'](_0x27228f[_0xce47('0x3d')],_0x27228f[_0xce47('0x12a')]):_0x27228f[_0xce47('0x3d')]);if(_0x388dcc){_0x3f518b[_0xce47('0x12d')]=ut[_0xce47('0x12e')](_0x388dcc);_0x3f518b[_0xce47('0x12f')]=ut['extractCalleridNumber'](_0x388dcc);}var _0x28e259=ut['addVariables'](_0x27228f,_0x1555d0,_0x22d52b,_0x388dcc,_0x2ef21f,_0x3f518b);_[_0xce47('0x130')](_0x3f518b,ut[_0xce47('0x131')](_0x28e259));_0x3f518b['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0xce47('0x7f')](ut['variablesAction'](_0x3f518b,_0x27228f,_0x28e259,_0x3f518b[_0xce47('0xae')],_0x5067d1))[_0xce47('0x8a')](function(_0x45e1e2){_0x27228f[_0xce47('0x57')]+=0x1;logger['info'](_0xce47('0x132'),_0x2ef21f,_0xce47('0xb4'),_0x27228f[_0xce47('0x2f')],_0xce47('0xfc'),_0x27228f[_0xce47('0x57')]);_0x18f145(_0x45e1e2);})['catch'](function(_0x487ae9){ut[_0xce47('0xf5')](_0x3f518b,0xe,_0xce47('0x133'));rpcDb[_0xce47('0xf3')](_0x3f518b,_0xce47('0x134'));_0x338ff0(_0x487ae9);});});};Preview[_0xce47('0x11')]['syncNewExten']=function(_0x4553fb){if(this[_0xce47('0x76')][_0x4553fb[_0xce47('0xaf')]]){this[_0xce47('0x76')][_0x4553fb[_0xce47('0xaf')]][_0xce47('0x80')]=_0x4553fb[_0xce47('0x80')];}};Preview[_0xce47('0x11')]['syncOriginateResponse']=function(_0x67148f){var _0x606ad7=this;var _0x114438=this[_0xce47('0x76')][_0x67148f[_0xce47('0x135')]];if(_0x114438){if(_0x114438[_0xce47('0x136')]&&this[_0xce47('0x18')][_0x114438[_0xce47('0x136')]]){ut['logLookAgent'](_0x114438,this[_0xce47('0x18')][_0x114438[_0xce47('0x136')]][_0xce47('0x2f')],this['agents'][_0x114438['lookAgent']]['id']);}var _0x61d0f5=_[_0xce47('0x137')](_0x114438);_0x61d0f5[_0xce47('0xb1')]=moment()[_0xce47('0x62')](_0xce47('0x90'));var _0x1c5a53=_0x606ad7[_0xce47('0x15')][_0x114438[_0xce47('0x79')]];if(ut[_0xce47('0x138')](_0x67148f[_0xce47('0x139')])){if(_0x114438[_0xce47('0xcd')]){rpcDb[_0xce47('0x113')](_0x114438[_0xce47('0x103')]);}if(_0x114438[_0xce47('0xae')]){rpcDb[_0xce47('0x114')](_0x114438[_0xce47('0x103')]);}ami['emit'](_0xce47('0x13a'),ut[_0xce47('0xa5')](_0x114438,_0xce47('0x13b')));this[_0xce47('0xf0')](_0x61d0f5,_0x1c5a53,_0x67148f);}else{_0x114438[_0xce47('0x13c')]=moment()[_0xce47('0x62')](_0xce47('0x90'));ut[_0xce47('0xf5')](_0x61d0f5,0x4,_0xce47('0xbc'));rpcDb[_0xce47('0xf3')](_0x61d0f5,_0xce47('0x13d'));}}};Preview[_0xce47('0x11')]['syncHangup']=function(_0x5e8151){var _0x1a8786=this;var _0x1fc872=this[_0xce47('0x76')][_0x5e8151['linkedid']];var _0x56a399;if(_0x1fc872){_0x56a399=this[_0xce47('0x15')][_0x1fc872['queue']];logger[_0xce47('0x65')](_0xce47('0x13e'),_0x5e8151[_0xce47('0xaf')],_0xce47('0xb4'),_0x56a399[_0xce47('0x2f')],_0xce47('0xb5'),_0x56a399[_0xce47('0x68')]);}if(this[_0xce47('0x76')][_0x5e8151['linkedid']]&&_0x5e8151[_0xce47('0xaf')]!==_0x5e8151['uniqueid']){if(_0x5e8151[_0xce47('0x13f')]==='16'&&this[_0xce47('0x76')][_0x5e8151[_0xce47('0xaf')]][_0xce47('0x7a')]){this[_0xce47('0x9f')](_0x5e8151,_0x5e8151['linkedid'],_0x5e8151[_0xce47('0x13f')]);}else if(this['actions'][_0x5e8151['linkedid']][_0xce47('0x7a')]){logger[_0xce47('0x65')](_0xce47('0x140'),_0x5e8151[_0xce47('0xaf')],_0x5e8151[_0xce47('0x13f')],_0xce47('0xb4'),_0x56a399['name'],_0xce47('0xb5'),_0x56a399[_0xce47('0x68')]);this[_0xce47('0x9f')](_0x5e8151,_0x5e8151[_0xce47('0xaf')],_0x5e8151[_0xce47('0x13f')]);}}else if(_0x1fc872&&_[_0xce47('0x75')](_0x1fc872[_0xce47('0x141')])&&_0x56a399['dialQueueProject']&&_0x5e8151[_0xce47('0xaf')]===_0x5e8151[_0xce47('0xb3')]&&_[_0xce47('0x75')](_0x5e8151[_0xce47('0xf8')])&&_0x5e8151['cause']==='16'&&_0x5e8151[_0xce47('0x142')]==='6'&&_[_0xce47('0xf1')](_0x1fc872[_0xce47('0x143')])){if(_0x1fc872['unlockAgent']){rpcDb['unlockContact'](_0x1fc872['idContact']);}if(_0x1fc872[_0xce47('0xae')]){rpcDb[_0xce47('0x114')](_0x1fc872[_0xce47('0x103')]);}_0x5e8151[_0xce47('0xf8')]='22';this[_0xce47('0xf0')](_0x1fc872,_0x56a399,_0x5e8151);}else if(_0x1fc872&&_0x1fc872[_0xce47('0x143')]){if(_0x5e8151[_0xce47('0x13f')]==='16'&&this['actions'][_0x5e8151[_0xce47('0xaf')]][_0xce47('0x7a')]){logger['info']('[syncHangup][talking][transfer]',_0x5e8151[_0xce47('0xaf')],_0x5e8151[_0xce47('0x13f')],_0xce47('0xb4'),_0x56a399[_0xce47('0x2f')],_0xce47('0xb5'),_0x56a399[_0xce47('0x68')]);this[_0xce47('0x9f')](_0x5e8151,_0x5e8151[_0xce47('0xaf')],_0x5e8151[_0xce47('0x13f')]);}else if(this[_0xce47('0x76')][_0x5e8151[_0xce47('0xaf')]][_0xce47('0x7a')]){logger[_0xce47('0x65')](_0xce47('0x140'),_0x5e8151['linkedid'],_0x5e8151[_0xce47('0x13f')],_0xce47('0xb4'),_0x56a399[_0xce47('0x2f')],_0xce47('0xb5'),_0x56a399[_0xce47('0x68')]);this[_0xce47('0x9f')](_0x5e8151,_0x5e8151['linkedid'],_0x5e8151[_0xce47('0x13f')]);}}};Preview[_0xce47('0x11')][_0xce47('0x22')]=function(_0x4b8961){if(this[_0xce47('0x76')][_0x4b8961[_0xce47('0xef')]]&&_0x4b8961[_0xce47('0xef')]!==_0x4b8961[_0xce47('0x144')]){this['callProgressDetectingCustomer'](_0x4b8961,_0x4b8961[_0xce47('0xef')],_0x4b8961[_0xce47('0x145')]);}};Preview[_0xce47('0x11')][_0xce47('0x20')]=function(_0x457b80){if(this[_0xce47('0x76')][_0x457b80[_0xce47('0xaf')]]&&_0x457b80[_0xce47('0xaf')]!==_0x457b80[_0xce47('0xb3')]&&!this[_0xce47('0x76')][_0x457b80[_0xce47('0xaf')]]['dialAnswer']){if(_0x457b80['cause']==='1'){this[_0xce47('0x9f')](_0x457b80,_0x457b80[_0xce47('0xaf')],_0x457b80['cause']);}}};Preview[_0xce47('0x11')][_0xce47('0x146')]=function(_0xfca4f1,_0x7939b2,_0x2a0447){if(this[_0xce47('0x76')][_0xfca4f1]){if(_['isNil'](this[_0xce47('0x76')][_0xfca4f1]['variables'])){this['actions'][_0xfca4f1]['variables']={};}this['actions'][_0xfca4f1]['variables'][_0x7939b2]=_0x2a0447;}};Preview[_0xce47('0x11')][_0xce47('0x26')]=function(_0x53ab2f){try{if(!_[_0xce47('0x75')](_0x53ab2f)){if(ut['filterKey'](_[_0xce47('0x147')](_0x53ab2f['variable'])[0x0])){this[_0xce47('0x146')](_0x53ab2f[_0xce47('0xb3')],_['keys'](_0x53ab2f[_0xce47('0x148')])[0x0],_0x53ab2f[_0xce47('0x149')]);}}}catch(_0x2e1a74){logger['error'](_0xce47('0x14a'),util['inspect'](_0x2e1a74,{'showHidden':![],'depth':null}));}};Preview[_0xce47('0x11')][_0xce47('0x28')]=function(_0x46aa50){if(_0x46aa50){if(this[_0xce47('0x76')][_0x46aa50[_0xce47('0x14b')]]){this['actions'][_0x46aa50[_0xce47('0x14b')]][_0xce47('0x143')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x5d920a){if(_0x5d920a){if(this[_0xce47('0x76')][_0x5d920a['transfererlinkedid']]){this[_0xce47('0x76')][_0x5d920a[_0xce47('0x14c')]][_0xce47('0x143')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x2504=['[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','\x20Queue','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','originated:\x20','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','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','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','variablesAction','[originateFailure][logOriginateFailure]','clone','isFailure','response','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','syncBlindTransfer','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','preview','../../../config/logger','actionPreview','./rpcDb','./util/util','redis','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','loopCampaigns','emit','type','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','sendMessageOneNotActive','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','outbound','dialActive','setMessage','isNil','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','UserId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','recallMe','agentReadyId','length','getDiff','Agent','run','then','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','responsetime','[syncHangup][talking][increment]','uniqueid','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','buildObj','complete','total','countglobal','totalGlobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]'];(function(_0x20e81e,_0x2ad41f){var _0x3e6654=function(_0x3f2904){while(--_0x3f2904){_0x20e81e['push'](_0x20e81e['shift']());}};_0x3e6654(++_0x2ad41f);}(_0x2504,0x1cf));var _0x4250=function(_0x308fd9,_0x36f728){_0x308fd9=_0x308fd9-0x0;var _0xadbb4=_0x2504[_0x308fd9];return _0xadbb4;};'use strict';var util=require(_0x4250('0x0'));var _=require(_0x4250('0x1'));var BPromise=require(_0x4250('0x2'));var uuid=require(_0x4250('0x3'));var moment=require(_0x4250('0x4'));var md5=require(_0x4250('0x5'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4250('0x6'));var loggerAction=require(_0x4250('0x7'))(_0x4250('0x8'));var ami=require('../ami');var rpcDb=require(_0x4250('0x9'));var Action=require('./action');var ut=require(_0x4250('0xa'));config[_0x4250('0xb')]=_['defaults'](config[_0x4250('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4250('0xb')]));var Sequence=function(){};Sequence[_0x4250('0xc')][_0x4250('0xd')]=function(_0x441962){this[_0x4250('0xe')]=this[_0x4250('0xe')]?this[_0x4250('0xe')]['finally'](_0x441962):_0x441962();};function Preview(_0xc98878){this[_0x4250('0xf')]=new Sequence();this[_0x4250('0x10')]=_0xc98878[_0x4250('0x11')];this[_0x4250('0x12')]=_0xc98878['trunks'];this[_0x4250('0x13')]={};this[_0x4250('0x14')]=_0xc98878[_0x4250('0x14')];this[_0x4250('0x15')]=0x0;ami['on'](_0x4250('0x16'),this[_0x4250('0x17')][_0x4250('0x18')](this));ami['on'](_0x4250('0x19'),this[_0x4250('0x1a')][_0x4250('0x18')](this));ami['on'](_0x4250('0x1b'),this[_0x4250('0x1c')][_0x4250('0x18')](this));ami['on']('dialend',this[_0x4250('0x1d')][_0x4250('0x18')](this));ami['on'](_0x4250('0x1e'),this[_0x4250('0x1f')][_0x4250('0x18')](this));ami['on'](_0x4250('0x20'),this[_0x4250('0x21')][_0x4250('0x18')](this));ami['on'](_0x4250('0x22'),this['syncAttendedTransfer'][_0x4250('0x18')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x4250('0x18')](this));this[_0x4250('0x23')](this[_0x4250('0x10')]);}function emit(_0x35549a,_0x5807b3,_0x2e6969){io['to'](_0x35549a)[_0x4250('0x24')](_0x5807b3,_0x2e6969);}function emitCampaignPreview(_0x530a84){if(_0x530a84[_0x4250('0x25')]==='outbound'){var _0x4a1625={'id':_0x530a84['id'],'name':_0x530a84[_0x4250('0x26')],'strategy':_0x530a84[_0x4250('0x27')],'answered':_0x530a84[_0x4250('0x28')],'available':_0x530a84['available'],'loggedIn':_0x530a84[_0x4250('0x29')],'pTalking':_0x530a84[_0x4250('0x2a')],'sumBillable':_0x530a84[_0x4250('0x2b')],'sumDuration':_0x530a84[_0x4250('0x2c')],'sumHoldTime':_0x530a84[_0x4250('0x2d')]||0x0,'talking':_0x530a84['talking'],'total':_0x530a84['total'],'type':_0x530a84[_0x4250('0x25')],'unmanaged':_0x530a84['unmanaged'],'abandoned':_0x530a84[_0x4250('0x2e')],'waiting':_0x530a84['waiting'],'loggedInDb':_0x530a84[_0x4250('0x2f')],'dialActive':_0x530a84['dialActive'],'dialMethod':_0x530a84[_0x4250('0x30')],'dialOriginateCallerIdName':_0x530a84['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x530a84[_0x4250('0x31')],'dialOriginateTimeout':_0x530a84[_0x4250('0x32')],'dialPrefix':_0x530a84[_0x4250('0x33')],'outboundAnswerAgiCallsDay':_0x530a84[_0x4250('0x34')],'outboundAnswerCallsDay':_0x530a84[_0x4250('0x35')],'outboundBlacklistCallsDay':_0x530a84[_0x4250('0x36')],'outboundBusyCallsDay':_0x530a84[_0x4250('0x37')],'outboundCongestionCallsDay':_0x530a84[_0x4250('0x38')],'outboundDropCallsDayACS':_0x530a84[_0x4250('0x39')],'outboundDropCallsDayCallersExit':_0x530a84[_0x4250('0x3a')],'outboundDropCallsDayTimeout':_0x530a84[_0x4250('0x3b')],'outboundNoAnswerCallsDay':_0x530a84[_0x4250('0x3c')],'outboundNoSuchCallsDay':_0x530a84[_0x4250('0x3d')],'outboundOriginateFailureCallsDay':_0x530a84[_0x4250('0x3e')],'outboundReCallsDay':_0x530a84['outboundReCallsDay'],'outboundRejectCallsDay':_0x530a84[_0x4250('0x3f')],'outboundUnknownCallsDay':_0x530a84[_0x4250('0x40')],'outboundAbandonedCallsDay':_0x530a84[_0x4250('0x41')],'predictiveIntervalAnsweredCalls':_0x530a84['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x530a84[_0x4250('0x42')],'predictiveIntervalAvgTalktime':_0x530a84[_0x4250('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x530a84[_0x4250('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x530a84[_0x4250('0x45')],'predictiveIntervalErlangCalls':_0x530a84[_0x4250('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x530a84[_0x4250('0x47')],'predictiveIntervalHitRate':_0x530a84[_0x4250('0x48')],'predictiveIntervalMultiplicativeFactor':_0x530a84[_0x4250('0x49')],'predictiveIntervalPauses':_0x530a84['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x530a84['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x530a84[_0x4250('0x4a')],'message':_0x530a84[_0x4250('0x4b')],'originated':_0x530a84[_0x4250('0x4c')],'erlangCalls':_0x530a84[_0x4250('0x4d')],'erlangCallToSecond':_0x530a84[_0x4250('0x4e')],'erlangAbandonmentRate':_0x530a84[_0x4250('0x4f')],'erlangBusyFactor':_0x530a84[_0x4250('0x50')],'startPredictive':_0x530a84[_0x4250('0x51')],'startProgressive':_0x530a84['startProgressive']};if(_0x530a84[_0x4250('0x52')]){_0x4a1625[_0x4250('0x52')]={'id':_0x530a84[_0x4250('0x52')]['id'],'name':_0x530a84['Trunk'][_0x4250('0x26')],'active':_0x530a84[_0x4250('0x52')][_0x4250('0x53')],'callerid':_0x530a84['Trunk'][_0x4250('0x54')]};}if(_0x530a84[_0x4250('0x55')]){_0x4a1625[_0x4250('0x55')]={'id':_0x530a84[_0x4250('0x55')]['id'],'name':_0x530a84[_0x4250('0x55')][_0x4250('0x26')]};}var _0x56926a=md5(JSON[_0x4250('0x56')](_0x4a1625));if(_0x530a84[_0x4250('0x5')]!==_0x56926a){_0x530a84[_0x4250('0x5')]=_0x56926a;emit(util[_0x4250('0x57')](_0x4250('0x58'),_0x4a1625[_0x4250('0x26')]),_0x4250('0x59'),_0x4a1625);}}}function emitVoiceQueueChannelRemove(_0x8c8251){logger[_0x4250('0x5a')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x4250('0x56')](_0x8c8251));emit(util[_0x4250('0x57')](_0x4250('0x58'),_0x8c8251[_0x4250('0x26')]),'voice_queue_channel:remove',_0x8c8251);}function notSendMessagesQueue(_0x348a00){if(_0x348a00[_0x4250('0x5b')]){if(_0x348a00[_0x4250('0x4c')]===0x0&&_0x348a00['pTalking']===0x0){_0x348a00[_0x4250('0x5b')]=![];_0x348a00[_0x4250('0x5c')]=0x0;_0x348a00[_0x4250('0x5d')]=0x0;_0x348a00[_0x4250('0x4b')]=_0x4250('0x5e');ut['logger'](_0x4250('0x5f'),_0x348a00['name']+_0x4250('0x60'));}else{_0x348a00['message']=_0x4250('0x61');ut[_0x4250('0x62')](_0x4250('0x5f'),_0x348a00['name']+_0x4250('0x63'));}emitCampaignPreview(_0x348a00);}}Preview['prototype'][_0x4250('0x23')]=function(){var _0x4f085d=this;setInterval(function(){_0x4f085d['syncCampaigns']();},0x7cf);};Preview[_0x4250('0xc')][_0x4250('0x64')]=function(){var _0x1527bb=this[_0x4250('0x10')];this[_0x4250('0x15')]+=0x1;for(var _0x286fdd in _0x1527bb){if(_0x1527bb[_0x4250('0x65')](_0x286fdd)&&(_0x1527bb[_0x286fdd][_0x4250('0x30')]==='preview'||_0x1527bb[_0x286fdd][_0x4250('0x30')]===_0x4250('0x66'))&&_0x1527bb[_0x286fdd][_0x4250('0x25')]==='outbound'){if(this[_0x4250('0x15')]>0x7){this[_0x4250('0x15')]=0x0;this[_0x4250('0x67')]();}}if(_0x1527bb[_0x4250('0x65')](_0x286fdd)&&_0x1527bb[_0x286fdd][_0x4250('0x30')]===_0x4250('0x6')&&_0x1527bb[_0x286fdd][_0x4250('0x25')]===_0x4250('0x68')){if(_0x1527bb[_0x286fdd][_0x4250('0x69')]){this[_0x4250('0x6a')](_0x1527bb[_0x286fdd]);this['recallMe'](_0x1527bb[_0x286fdd]);}else{notSendMessagesQueue(_0x1527bb[_0x286fdd]);}}}};Preview[_0x4250('0xc')]['clearZombieChannel']=function(_0x3dc8bf){var _0x3bcdf0=this;this[_0x4250('0xf')][_0x4250('0xd')](function(){if(!_[_0x4250('0x6b')](_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf])){loggerAction[_0x4250('0x5a')](_0x4250('0x6c'),_0x3dc8bf,'Queue',_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf][_0x4250('0x6d')],'originated:\x20',JSON['stringify'](_0x3bcdf0[_0x4250('0x10')][_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf][_0x4250('0x6d')]][_0x4250('0x4c')]),_0x4250('0x6e'),JSON[_0x4250('0x56')](_0x3bcdf0[_0x4250('0x10')][_0x3bcdf0['actions'][_0x3dc8bf][_0x4250('0x6d')]]['pTalking']),JSON[_0x4250('0x56')](_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf][_0x4250('0x6f')]),JSON[_0x4250('0x56')](_['pick'](_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf],['contactId',_0x4250('0x70'),'VoiceQueueId',_0x4250('0x71')])));return ami[_0x4250('0x72')]({'action':_0x4250('0x73'),'channel':_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf][_0x4250('0x74')]})[_0x4250('0x75')](function(_0x3b019d){if(_0x3b019d['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf]){ut[_0x4250('0x76')](_0x3bcdf0['campaignsPreview'][_0x3bcdf0['actions'][_0x3dc8bf][_0x4250('0x6d')]],_0x4250('0x77'));if(_0x3bcdf0['actions'][_0x3dc8bf][_0x4250('0x6f')]===!![]){ut[_0x4250('0x78')](_0x3bcdf0[_0x4250('0x10')][_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf][_0x4250('0x6d')]],_0x4250('0x77'));ut[_0x4250('0x79')](_0x4250('0x7a')+_0x3dc8bf,_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf]['queue']);}ut['loggerError'](_0x4250('0x7b')+_0x3dc8bf,_0x3bcdf0['actions'][_0x3dc8bf][_0x4250('0x6d')]);delete _0x3bcdf0[_0x4250('0x13')][_0x3dc8bf];}},0x2328);}});}});};Preview[_0x4250('0xc')][_0x4250('0x67')]=function(){var _0x1d5156=this;loggerAction['info'](_0x4250('0x7c'),_[_0x4250('0x7d')](this[_0x4250('0x13')]));for(var _0x15d6ac in this[_0x4250('0x13')]){if(_0x1d5156[_0x4250('0x13')][_0x4250('0x65')](_0x15d6ac)){_0x1d5156[_0x4250('0x7e')](_0x15d6ac);}}};Preview[_0x4250('0xc')][_0x4250('0x7f')]=function(_0x335ab7){var _0x430da3=this;rpcDb['getContactRecallMe'](_0x335ab7['id'],ut[_0x4250('0x80')](this[_0x4250('0x14')]))['then'](function(_0x5ca52c){if(!_[_0x4250('0x6b')](_0x5ca52c)){for(var _0x56f6d6=0x0;_0x56f6d6<_0x5ca52c[_0x4250('0x81')];_0x56f6d6+=0x1){if(ut[_0x4250('0x82')](_0x5ca52c[_0x56f6d6]['scheduledat'])<_0x335ab7['dialRecallMeTimeout']*0x3c){if(_0x5ca52c[_0x56f6d6][_0x4250('0x83')]&&!_0x5ca52c[_0x56f6d6][_0x4250('0x83')]['voicePause']){_0x430da3[_0x4250('0x84')](_0x5ca52c[_0x56f6d6]['id'])[_0x4250('0x85')](ut[_0x4250('0x86')]('[RecallMe]'))[_0x4250('0x75')](ut[_0x4250('0x86')](_0x4250('0x87')));}else{rpcDb[_0x4250('0x88')](_0x5ca52c[_0x56f6d6]['id']);}}else{var _0x3ea999=new Action(_0x5ca52c[_0x56f6d6],_0x335ab7);_0x3ea999['starttime']=moment()['format'](_0x4250('0x89'));_0x335ab7[_0x4250('0x8a')]+=0x1;ut[_0x4250('0x8b')](_0x3ea999,0x17,_0x4250('0x8c'));if(_0x335ab7[_0x4250('0x8d')]){rpcDb[_0x4250('0x8e')](ut[_0x4250('0x8f')](_0x5ca52c[_0x56f6d6]));rpcDb[_0x4250('0x90')](_0x3ea999,_0x4250('0x91'));}else{ut['logCustomer'](_0x3ea999,0x16,_0x4250('0x92'));rpcDb[_0x4250('0x90')](_0x3ea999,_0x4250('0x93'));rpcDb[_0x4250('0x94')](_0x3ea999,'[HistoryRecallClose]');}}}}})[_0x4250('0x75')](ut['logger2'](_0x4250('0x95')));};Preview[_0x4250('0xc')][_0x4250('0x6a')]=function(_0x45521e){_0x45521e[_0x4250('0x5b')]=!![];if(ut[_0x4250('0x96')](_0x45521e['loggedIn'])){_0x45521e[_0x4250('0x4b')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x4250('0x97')](_0x45521e[_0x4250('0x69')])){_0x45521e[_0x4250('0x4b')]=_0x4250('0x5e');}else if(!this[_0x4250('0x98')](_0x45521e['Trunk'])){if(!this[_0x4250('0x98')](_0x45521e['TrunkBackup'])){_0x45521e['message']=_0x4250('0x99');}else{_0x45521e[_0x4250('0x4b')]=_0x4250('0x9a');}}else{_0x45521e[_0x4250('0x4b')]=_0x4250('0x9a');}emitCampaignPreview(_0x45521e);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x36121a,_0x18c318,_0x4f2dd4){var _0x3aa02a=this;var _0x2bd5ec=this[_0x4250('0x13')][_0x18c318];var _0x3f0eda=this[_0x4250('0x10')][_0x2bd5ec[_0x4250('0x6d')]];var _0x1a2f12;if(_0x3f0eda){switch(_0x4f2dd4){case'1':_0x3f0eda[_0x4250('0x3d')]+=0x1;_0x2bd5ec[_0x4250('0x9b')]+=0x1;_0x2bd5ec['countglobal']=ut['totalGlobal'](_0x2bd5ec);ut['logCustomer'](_0x2bd5ec,0x0,_0x4250('0x9c'));ami[_0x4250('0x24')](_0x4250('0x9d'),ut['buildObj'](_0x2bd5ec,_0x4250('0x9e')));rpcDb[_0x4250('0x90')](_0x2bd5ec,'[callProgressDetectingCustomer][logNoSuch]');if(ut['totalGlobal'](_0x2bd5ec)>=_0x3f0eda[_0x4250('0x9f')]){_0x1a2f12=ut[_0x4250('0xa0')](_0x2bd5ec,0xf,'Global');rpcDb[_0x4250('0x94')](_0x1a2f12,_0x4250('0xa1'));}else{if(_0x2bd5ec[_0x4250('0x9b')]>=_0x3f0eda['dialNoSuchNumberMaxRetry']){rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xa1'));}else{rpcDb[_0x4250('0xa2')](ut[_0x4250('0xa3')](_0x2bd5ec,'countnosuchnumberretry',_0x3f0eda[_0x4250('0xa4')]),_0x2bd5ec[_0x4250('0xa5')],_0x2bd5ec['activeContact']);}}delete this[_0x4250('0x13')][_0x36121a[_0x4250('0xa6')]];break;case'ANSWER':var _0x112d66=moment()[_0x4250('0x57')](_0x4250('0x89'));_0x2bd5ec[_0x4250('0xa7')]=_0x112d66;_0x2bd5ec['answertime']=_0x112d66;_0x2bd5ec[_0x4250('0x6f')]=!![];_0x3f0eda[_0x4250('0x2a')]+=0x1;logger[_0x4250('0x5a')](_0x4250('0xa8'),_0x2bd5ec[_0x4250('0xa9')],'\x20Queue',_0x3f0eda[_0x4250('0x26')],_0x4250('0x6e'),_0x3f0eda[_0x4250('0x2a')]);ami[_0x4250('0x24')]('custom:agentconnect',ut['buildObj'](_0x2bd5ec,_0x4250('0xaa')));if(_0x3f0eda['acw']){ami[_0x4250('0x24')](_0x4250('0xab'),ut[_0x4250('0xac')](_0x2bd5ec));}break;case'16':ami[_0x4250('0x24')](_0x4250('0xad'),ut[_0x4250('0xae')](_0x2bd5ec,_0x4250('0xaf')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2bd5ec,_0x4250('0xaf')));_0x3f0eda['outboundAnswerCallsDay']+=0x1;_0x3f0eda[_0x4250('0xb0')]+=0x1;_0x3f0eda[_0x4250('0x28')]+=0x1;ut[_0x4250('0x78')](_0x3f0eda,'[16]');_0x2bd5ec[_0x4250('0xb1')]=ut[_0x4250('0xb2')](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0x4,_0x4250('0xb3'));rpcDb['createCustomerHistory'](_0x2bd5ec,_0x4250('0xb4'));rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xb5'));rpcDb[_0x4250('0xb6')](_0x2bd5ec);_0x3f0eda[_0x4250('0x2c')]+=_0x2bd5ec[_0x4250('0xb7')];_0x3f0eda[_0x4250('0x2b')]+=_0x2bd5ec[_0x4250('0xb7')];logger[_0x4250('0x5a')]('[syncHangup][talking][decrement]',_0x2bd5ec['uniqueid'],'\x20Queue',_0x3f0eda[_0x4250('0x26')],'pTalking:\x20',_0x3f0eda[_0x4250('0x2a')]);delete this[_0x4250('0x13')][_0x36121a[_0x4250('0xa6')]];break;case _0x4250('0xb8'):_0x3f0eda[_0x4250('0x37')]+=0x1;_0x2bd5ec[_0x4250('0xb9')]+=0x1;_0x2bd5ec[_0x4250('0xb1')]=ut['totalGlobal'](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0x5,_0x4250('0xba'));ami[_0x4250('0x24')](_0x4250('0xbb'),ut['buildObj'](_0x2bd5ec,_0x4250('0xbc')));rpcDb['createCustomerHistory'](_0x2bd5ec,_0x4250('0xbd'));if(ut['totalGlobal'](_0x2bd5ec)>=_0x3f0eda[_0x4250('0x9f')]){_0x1a2f12=ut['cloneAction'](_0x2bd5ec,0xf,_0x4250('0xbe'));rpcDb[_0x4250('0x94')](_0x1a2f12,_0x4250('0xbf'));}else{if(_0x2bd5ec[_0x4250('0xb9')]>=_0x3f0eda[_0x4250('0xc0')]){rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xbd'));}else{rpcDb[_0x4250('0xa2')](ut['scheduledAt'](_0x2bd5ec,_0x4250('0xb9'),_0x3f0eda[_0x4250('0xc1')]),_0x2bd5ec[_0x4250('0xa5')],_0x2bd5ec[_0x4250('0xc2')]);}}break;case _0x4250('0xc3'):_0x3f0eda[_0x4250('0x3c')]+=0x1;_0x2bd5ec[_0x4250('0xc4')]+=0x1;_0x2bd5ec['countglobal']=ut[_0x4250('0xb2')](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0x3,_0x4250('0xc5'));ami[_0x4250('0x24')](_0x4250('0xc6'),ut[_0x4250('0xae')](_0x2bd5ec,'noanswer'));rpcDb[_0x4250('0x90')](_0x2bd5ec,_0x4250('0xc7'));if(ut[_0x4250('0xb2')](_0x2bd5ec)>=_0x3f0eda[_0x4250('0x9f')]){_0x1a2f12=ut[_0x4250('0xa0')](_0x2bd5ec,0xf,_0x4250('0xbe'));rpcDb[_0x4250('0x94')](_0x1a2f12,_0x4250('0xc8'));}else{if(_0x2bd5ec[_0x4250('0xc4')]>=_0x3f0eda['dialNoAnswerMaxRetry']){rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xc7'));}else{rpcDb[_0x4250('0xa2')](ut[_0x4250('0xa3')](_0x2bd5ec,_0x4250('0xc4'),_0x3f0eda[_0x4250('0xc9')]),_0x2bd5ec['unlockAgent'],_0x2bd5ec[_0x4250('0xc2')]);}}break;case _0x4250('0xca'):_0x3f0eda[_0x4250('0x38')]+=0x1;_0x2bd5ec['countcongestionretry']+=0x1;_0x2bd5ec[_0x4250('0xb1')]=ut[_0x4250('0xb2')](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0x8,_0x4250('0xcb'));ami[_0x4250('0x24')](_0x4250('0xcc'),ut[_0x4250('0xae')](_0x2bd5ec,_0x4250('0xcd')));rpcDb[_0x4250('0x90')](_0x2bd5ec,_0x4250('0xce'));if(ut[_0x4250('0xb2')](_0x2bd5ec)>=_0x3f0eda[_0x4250('0x9f')]){_0x1a2f12=ut[_0x4250('0xa0')](_0x2bd5ec,0xf,'Global');rpcDb[_0x4250('0x94')](_0x1a2f12,_0x4250('0xcf'));}else{if(_0x2bd5ec[_0x4250('0xd0')]>=_0x3f0eda['dialCongestionMaxRetry']){rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xce'));}else{rpcDb[_0x4250('0xa2')](ut[_0x4250('0xa3')](_0x2bd5ec,'countcongestionretry',_0x3f0eda[_0x4250('0xc1')]),_0x2bd5ec[_0x4250('0xa5')],_0x2bd5ec[_0x4250('0xc2')]);}}break;case'CANCEL':_0x3f0eda['outboundRejectCallsDay']+=0x1;_0x2bd5ec[_0x4250('0xd1')]+=0x1;_0x2bd5ec[_0x4250('0xb1')]=ut['totalGlobal'](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0x14,_0x4250('0xd2'));ami[_0x4250('0x24')](_0x4250('0xd3'),ut[_0x4250('0xae')](_0x2bd5ec,_0x4250('0xd4')));rpcDb[_0x4250('0x90')](_0x2bd5ec,_0x4250('0xd5'));if(ut['totalGlobal'](_0x2bd5ec)>=_0x3f0eda['dialGlobalMaxRetry']){_0x1a2f12=ut[_0x4250('0xa0')](_0x2bd5ec,0x14,'AgentReject');rpcDb[_0x4250('0x94')](_0x1a2f12,_0x4250('0xd6'));}else{if(_0x2bd5ec[_0x4250('0xd1')]>=_0x3f0eda[_0x4250('0xd7')]){rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xd6'));}else{rpcDb[_0x4250('0xa2')](ut['scheduledAt'](_0x2bd5ec,_0x4250('0xd1'),_0x3f0eda[_0x4250('0xd8')]),_0x2bd5ec['unlockAgent'],_0x2bd5ec[_0x4250('0xc2')]);}}break;case _0x4250('0xd9'):_0x3f0eda['outboundAbandonedCallsDay']+=0x1;_0x2bd5ec[_0x4250('0xda')]+=0x1;_0x2bd5ec['countglobal']=ut[_0x4250('0xb2')](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0xb,_0x4250('0xdb'));rpcDb[_0x4250('0x90')](_0x2bd5ec,_0x4250('0xdc'));if(ut[_0x4250('0xb2')](_0x2bd5ec)>=_0x3f0eda['dialGlobalMaxRetry']){_0x1a2f12=ut[_0x4250('0xa0')](_0x2bd5ec,0xf,_0x4250('0xbe'));rpcDb['createCustomerFinal'](_0x1a2f12,_0x4250('0xdc'));}else{if(_0x2bd5ec[_0x4250('0xdd')]>=_0x3f0eda[_0x4250('0xde')]){rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xdc'));}else{rpcDb[_0x4250('0xa2')](ut[_0x4250('0xa3')](_0x2bd5ec,_0x4250('0xda'),_0x3f0eda[_0x4250('0xdf')]),_0x2bd5ec[_0x4250('0xa5')],_0x2bd5ec[_0x4250('0xc2')]);}}break;default:if(_0x2bd5ec[_0x4250('0x6f')]){ut[_0x4250('0x78')](_0x3f0eda,'[default]');ut[_0x4250('0x79')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x3f0eda[_0x4250('0x26')],_0x36121a);}_0x3f0eda['outboundUnknownCallsDay']+=0x1;_0x2bd5ec[_0x4250('0xb1')]=ut[_0x4250('0xb2')](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0xc,_0x36121a[_0x4250('0xe0')]||_0x36121a[_0x4250('0xe1')]);rpcDb[_0x4250('0x90')](_0x2bd5ec,_0x4250('0xe2'));if(ut[_0x4250('0xb2')](_0x2bd5ec)>=_0x3f0eda[_0x4250('0x9f')]){_0x1a2f12=ut[_0x4250('0xa0')](_0x2bd5ec,0xf,_0x4250('0xbe'));rpcDb['createCustomerFinal'](_0x1a2f12,_0x4250('0xe3'));}else{rpcDb['createCustomerFinal'](_0x2bd5ec,_0x4250('0xe3'));}delete this[_0x4250('0x13')][_0x36121a[_0x4250('0xa6')]];}if(!(_0x2bd5ec['dialAnswer']&&_0x4f2dd4==='16')){ut[_0x4250('0x76')](_0x3f0eda,'[callProgressDetectingCustomer]');logger['info'](_0x4250('0xe4'),_0x2bd5ec[_0x4250('0xa9')],_0x4250('0xe5'),_0x3f0eda['name'],'originated:\x20',_0x3f0eda[_0x4250('0x4c')]);}if(_0x4f2dd4!==_0x4250('0xe6')){delete this[_0x4250('0x13')][_0x36121a[_0x4250('0xa6')]];delete this[_0x4250('0x13')][_0x36121a[_0x4250('0xe7')]];}}};Preview[_0x4250('0xc')][_0x4250('0xe8')]=function(_0x296d91,_0x2ede09,_0x53ed0c){if(_[_0x4250('0xe9')](_0x2ede09)&&_0x4250('0xea')!==typeof _0x2ede09){return;}if(_[_0x4250('0xe9')](_0x53ed0c)&&_0x4250('0xea')!==typeof _0x53ed0c){return;}switch(_0x53ed0c[_0x4250('0xeb')]){case'0':ut[_0x4250('0xec')](_0x296d91,0x0,_0x4250('0x9c'));rpcDb[_0x4250('0xed')](_0x296d91,_0x4250('0xee'));break;case'3':ut[_0x4250('0xec')](_0x296d91,0x3,_0x4250('0xc5'));rpcDb[_0x4250('0xed')](_0x296d91,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x4250('0xec')](_0x296d91,0x5,_0x4250('0xba'));rpcDb[_0x4250('0xed')](_0x296d91,_0x4250('0xef'));break;case'8':ut['logAgent'](_0x296d91,0x8,_0x4250('0xcb'));rpcDb[_0x4250('0xed')](_0x296d91,_0x4250('0xf0'));break;case'22':ut[_0x4250('0xec')](_0x296d91,0x16,'AnswerAGI');rpcDb[_0x4250('0xed')](_0x296d91,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x296d91,0xc,_0x53ed0c['reason']);rpcDb[_0x4250('0xed')](_0x296d91,_0x4250('0xf0'));}ut[_0x4250('0x76')](_0x2ede09,_0x4250('0xf1'));logger['info'](_0x4250('0xf2'),_0x296d91[_0x4250('0xa9')],_0x4250('0xe5'),_0x2ede09[_0x4250('0x26')],_0x4250('0xf3'),_0x2ede09['originated']);delete this[_0x4250('0x13')][_0x296d91[_0x4250('0xa9')]];};Preview['prototype'][_0x4250('0xf4')]=function(_0x4ec98b,_0x5d1434,_0x141449,_0xa6f271,_0x133fbf){var _0x39c68d=this;return new BPromise(function(_0x370cad,_0x1f5e45){if(_[_0x4250('0x6b')](_0x5d1434)||_[_0x4250('0x6b')](_0x5d1434[_0x4250('0xf5')])||_['isNil'](_0x5d1434['Contact'][_0x4250('0xf6')])||_[_0x4250('0x6b')](_0x5d1434[_0x4250('0xf7')])){_0x1f5e45(ut[_0x4250('0x4b')](_0x4250('0xf8'),_0xa6f271,_0x133fbf));return;}var _0xb3c02d=uuid['v4']();var _0x48d4a5=_0x39c68d[_0x4250('0x10')][_0x5d1434[_0x4250('0xf9')][_0x4250('0x26')]];var _0x4ca272=_0x141449?_0x39c68d[_0x4250('0x14')][_0x141449]['id']:undefined;_0x39c68d[_0x4250('0x13')][_0xb3c02d]=new Action(_0x5d1434,_0x48d4a5,_0xb3c02d,_0x141449,_0x4ca272);var _0x1e4d3e=_0x39c68d['actions'][_0xb3c02d];_0x1e4d3e[_0x4250('0xa5')]=_0xa6f271;_0x1e4d3e[_0x4250('0xc2')]=_0x133fbf;_0x1e4d3e[_0x4250('0xfa')]=_0x141449;if(_['isEmpty'](_0x4ec98b)){_0x39c68d[_0x4250('0xfb')](_0x1e4d3e,_0x48d4a5,_0x5d1434,_0x141449)[_0x4250('0x85')](function(_0x3aaca1){logger['info'](_0x4250('0xfc'),_0x4250('0xfd')+_0x1e4d3e[_0x4250('0x6d')]+_0x4250('0xfe')+_0x1e4d3e['idContact'],JSON[_0x4250('0x56')](_0x3aaca1));ami['emit']('custom:agentcalled',ut[_0x4250('0xae')](_0x1e4d3e,_0x4250('0xff')));_0x370cad(ut[_0x4250('0x4b')](_0x4250('0x100')));})[_0x4250('0x75')](function(_0x407cc0){ut[_0x4250('0x62')](_0x4250('0x101'),_0x407cc0);_0x1f5e45(ut[_0x4250('0x4b')](_0x4250('0x102'),_0xa6f271,_0x133fbf));});}else{_0x48d4a5['outboundBlacklistCallsDay']+=0x1;ut[_0x4250('0x103')](_0x1e4d3e);rpcDb[_0x4250('0x104')](_0x1e4d3e,'[Blacklist][error]');delete _0x39c68d[_0x4250('0x13')][_0xb3c02d];_0x1f5e45(ut[_0x4250('0x4b')](_0x4250('0x105'),_0xa6f271,_0x133fbf));}});};Preview[_0x4250('0xc')][_0x4250('0x98')]=function(_0xf7facd){return!_[_0x4250('0x6b')](_0xf7facd)&&!_[_0x4250('0x6b')](_0xf7facd[_0x4250('0x26')])&&!_[_0x4250('0x6b')](_0xf7facd[_0x4250('0x53')])&&_0xf7facd[_0x4250('0x53')]&&!_[_0x4250('0x6b')](this['trunks'][util[_0x4250('0x57')]('SIP/%s',_0xf7facd[_0x4250('0x26')])])&&!_[_0x4250('0x6b')](this[_0x4250('0x12')][util[_0x4250('0x57')](_0x4250('0x106'),_0xf7facd[_0x4250('0x26')])][_0x4250('0x73')])&&(this[_0x4250('0x12')][util[_0x4250('0x57')](_0x4250('0x106'),_0xf7facd[_0x4250('0x26')])][_0x4250('0x73')]===_0x4250('0x107')||this[_0x4250('0x12')][util[_0x4250('0x57')]('SIP/%s',_0xf7facd[_0x4250('0x26')])][_0x4250('0x73')]===_0x4250('0x108'));};Preview[_0x4250('0xc')][_0x4250('0x84')]=function(_0x1fa830,_0x45a79e){var _0xc683bd=this;return new BPromise(function(_0x458db1,_0x51d8fb){_0xc683bd[_0x4250('0x109')](_0x1fa830,_0x45a79e)['then'](function(_0x3c1faa){_0x458db1(_[_0x4250('0x10a')](_0x3c1faa,[_0x4250('0x4b')]));})[_0x4250('0x75')](function(_0x4b01e7){if(_0x4b01e7[_0x4250('0x10b')]){rpcDb[_0x4250('0x10c')](_0x1fa830);}if(_0x4b01e7[_0x4250('0x53')]){rpcDb[_0x4250('0x88')](_0x1fa830);}_0x51d8fb(_[_0x4250('0x10a')](_0x4b01e7,['message']));});});};Preview[_0x4250('0xc')][_0x4250('0x109')]=function(_0x37c741,_0x46f98f){var _0x5eb27e=this;return new BPromise(function(_0x5296a0,_0x5464ad){var _0x3f1dcf,_0x1a2306;rpcDb[_0x4250('0x10d')](_0x37c741)[_0x4250('0x85')](function(_0x3b0535){if(!_[_0x4250('0x6b')](_0x3b0535[0x0])){_0x1a2306=_0x3b0535[0x0][_0x4250('0x10e')]?![]:!![];_0x3f1dcf=_0x3b0535[0x0][_0x4250('0x10e')]?!![]:![];_0x3f1dcf=_0x46f98f?!![]:_0x3f1dcf;}var _0x4d1eb9=_0x5eb27e[_0x4250('0x10f')](_0x3b0535);if(_0x4d1eb9[_0x4250('0x110')]){rpcDb[_0x4250('0x111')](_[_0x4250('0x10a')](_0x3b0535[0x0],['VoiceQueueId',_0x4250('0x112')]))[_0x4250('0x85')](function(_0x5213e6){_0x5eb27e[_0x4250('0xf4')](_0x5213e6,_0x3b0535[0x0],_0x46f98f,_0x1a2306,_0x3f1dcf)[_0x4250('0x85')](function(_0x2fc5ab){_0x5296a0(_0x2fc5ab);})['catch'](function(_0xccf796){_0x5464ad(_0xccf796);});})['catch'](function(_0x23c18b){ut['logger']('[Preview][checkIsBlackList]',_0x23c18b);_0x5464ad(ut['message'](_0x4250('0x113'),_0x1a2306,_0x3f1dcf));});}else{_0x5464ad(ut[_0x4250('0x4b')](_0x4d1eb9['message'],_0x1a2306,_0x3f1dcf));}})['catch'](function(_0x51493c){ut['logger'](_0x4250('0x114'),_0x51493c);_0x5464ad(ut[_0x4250('0x4b')](_0x4250('0x113'),![],!![]));});});};Preview[_0x4250('0xc')]['validateContact']=function(_0x330eac){if(_['isNil'](_0x330eac)||_[_0x4250('0x115')](_0x330eac)||!_[_0x4250('0x6b')](_0x330eac[0x0][_0x4250('0x83')])&&_['isNil'](_0x330eac[0x0][_0x4250('0x83')][_0x4250('0x26')])){ut[_0x4250('0x62')]('[Preview][validateContact][Empty\x20Contact]',_0x330eac);return{'isValid':![],'message':_0x4250('0x116')};}var _0x4e4473=this[_0x4250('0x10')][_0x330eac[0x0]['Queue'][_0x4250('0x26')]];_0x4e4473[_0x4250('0x4b')]='ACTIVE';if(_['isNil'](_0x4e4473)){ut[_0x4250('0x62')](_0x4250('0x117'),_0x4e4473);return{'isValid':![],'message':_0x4250('0x118')};}if(!this['isTrunkReachable'](_0x4e4473[_0x4250('0x52')])){ut[_0x4250('0x62')](_0x4250('0x119'),_0x4250('0x11a')+_0x4e4473[_0x4250('0x26')]+_0x4250('0x11b'));if(!this['isTrunkReachable'](_0x4e4473[_0x4250('0x11c')])){ut['logger'](_0x4250('0x119'),_0x4e4473[_0x4250('0x26')]+_0x4250('0x11d'));return{'isValid':![],'message':_0x4250('0x11e')};}}if(!ut[_0x4250('0x97')](_0x4e4473[_0x4250('0x69')])){ut[_0x4250('0x62')](_0x4250('0x11f'),_0x4e4473['name']+_0x4250('0x120'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4e4473[_0x4250('0x26')]+_0x4250('0x120')};}return{'isValid':!![],'message':_0x4250('0x121')};};Preview[_0x4250('0xc')]['execCall']=function(_0x5507ac,_0x2e82e1,_0xd83704,_0x577485){var _0x52a109=this;return new BPromise(function(_0x342087,_0x5896d4){var _0x16545d=_0x5507ac['uniqueid'];var _0x355baa=_0x52a109['isTrunkReachable'](_0x2e82e1[_0x4250('0x52')])?util[_0x4250('0x57')](_0x4250('0x122'),_0x2e82e1['Trunk']['name'],_[_0x4250('0x6b')](_0x2e82e1[_0x4250('0x33')])?'':_0x2e82e1[_0x4250('0x33')][_0x4250('0x123')]()||'',_0x2e82e1[_0x4250('0x124')]>0x0?_0xd83704[_0x4250('0xf5')]['phone']['substring'](_0x2e82e1['dialCutDigit']):_0xd83704[_0x4250('0xf5')][_0x4250('0xf6')]):util[_0x4250('0x57')](_0x4250('0x122'),_['isNil'](_0x2e82e1[_0x4250('0x11c')])?_0x2e82e1[_0x4250('0x52')][_0x4250('0x26')]:_0x2e82e1[_0x4250('0x11c')][_0x4250('0x26')],_['isNil'](_0x2e82e1[_0x4250('0x33')])?'':_0x2e82e1['dialPrefix'][_0x4250('0x123')]()||'',_0x2e82e1[_0x4250('0x124')]>0x0?_0xd83704[_0x4250('0xf5')][_0x4250('0xf6')][_0x4250('0x125')](_0x2e82e1[_0x4250('0x124')]):_0xd83704['Contact'][_0x4250('0xf6')]);var _0x1b4145=_0x52a109['isTrunkReachable'](_0x2e82e1[_0x4250('0x52')])?ut[_0x4250('0x126')](_0x2e82e1[_0x4250('0x52')]['callerid'],_0x2e82e1[_0x4250('0x127')],_0x2e82e1['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x4250('0x128')](_0x2e82e1[_0x4250('0x31')],_0x2e82e1['dialRandomLastDigitCallerIdNumber']):_0x2e82e1[_0x4250('0x31')]):ut['getCallerId'](_[_0x4250('0x6b')](_0x2e82e1[_0x4250('0x11c')])?_0x2e82e1[_0x4250('0x52')]['callerid']:_0x2e82e1['TrunkBackup'][_0x4250('0x54')],_0x2e82e1[_0x4250('0x127')],_0x2e82e1['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x4250('0x128')](_0x2e82e1[_0x4250('0x31')],_0x2e82e1[_0x4250('0x129')]):_0x2e82e1[_0x4250('0x31')]);if(_0x1b4145){_0x5507ac[_0x4250('0x12a')]=ut[_0x4250('0x12b')](_0x1b4145);_0x5507ac[_0x4250('0x12c')]=ut[_0x4250('0x12d')](_0x1b4145);}var _0x5ac02f=ut[_0x4250('0x12e')](_0x2e82e1,_0xd83704,_0x355baa,_0x1b4145,_0x16545d,_0x5507ac);_[_0x4250('0x12f')](_0x5507ac,ut[_0x4250('0x130')](_0x5ac02f));_0x5507ac[_0x4250('0x131')]=moment()[_0x4250('0x57')](_0x4250('0x89'));ami['Action'](ut[_0x4250('0x132')](_0x5507ac,_0x2e82e1,_0x5ac02f,_0x5507ac[_0x4250('0xc2')],_0x577485))['then'](function(_0x5d439e){_0x2e82e1[_0x4250('0x4c')]+=0x1;logger[_0x4250('0x5a')]('[originated][increment]',_0x16545d,_0x4250('0xe5'),_0x2e82e1[_0x4250('0x26')],_0x4250('0xf3'),_0x2e82e1['originated']);_0x342087(_0x5d439e);})[_0x4250('0x75')](function(_0x1b78d4){ut['logAgent'](_0x5507ac,0xe,'OriginateError');rpcDb[_0x4250('0xed')](_0x5507ac,_0x4250('0x133'));_0x5896d4(_0x1b78d4);});});};Preview['prototype'][_0x4250('0x1f')]=function(_0x421b7c){if(this[_0x4250('0x13')][_0x421b7c[_0x4250('0xa6')]]){this['actions'][_0x421b7c[_0x4250('0xa6')]][_0x4250('0x74')]=_0x421b7c[_0x4250('0x74')];}};Preview[_0x4250('0xc')][_0x4250('0x17')]=function(_0x42f713){var _0x376651=this;var _0x3a553c=this[_0x4250('0x13')][_0x42f713['actionid']];if(_0x3a553c){if(_0x3a553c['lookAgent']&&this[_0x4250('0x14')][_0x3a553c['lookAgent']]){ut['logLookAgent'](_0x3a553c,this[_0x4250('0x14')][_0x3a553c['lookAgent']][_0x4250('0x26')],this['agents'][_0x3a553c['lookAgent']]['id']);}var _0xf1ec3e=_[_0x4250('0x134')](_0x3a553c);_0xf1ec3e[_0x4250('0xa7')]=moment()['format'](_0x4250('0x89'));var _0x536549=_0x376651[_0x4250('0x10')][_0x3a553c['queue']];if(ut[_0x4250('0x135')](_0x42f713[_0x4250('0x136')])){if(_0x3a553c[_0x4250('0xa5')]){rpcDb[_0x4250('0x10c')](_0x3a553c[_0x4250('0x137')]);}if(_0x3a553c['activeContact']){rpcDb['disableContact'](_0x3a553c[_0x4250('0x137')]);}ami[_0x4250('0x24')](_0x4250('0x138'),ut[_0x4250('0xae')](_0x3a553c,_0x4250('0x139')));this[_0x4250('0xe8')](_0xf1ec3e,_0x536549,_0x42f713);}else{_0x3a553c[_0x4250('0x131')]=moment()['format'](_0x4250('0x89'));ut[_0x4250('0xec')](_0xf1ec3e,0x4,_0x4250('0xb3'));rpcDb[_0x4250('0xed')](_0xf1ec3e,_0x4250('0x13a'));}}};Preview[_0x4250('0xc')]['syncHangup']=function(_0x1de032){var _0xf4b42f=this;var _0xe117b=this[_0x4250('0x13')][_0x1de032[_0x4250('0xa6')]];var _0x29cfe4;if(_0xe117b){_0x29cfe4=this[_0x4250('0x10')][_0xe117b[_0x4250('0x6d')]];logger['info']('[syncHangup][talking]',_0x1de032[_0x4250('0xa6')],'\x20Queue',_0x29cfe4[_0x4250('0x26')],_0x4250('0x6e'),_0x29cfe4[_0x4250('0x2a')]);}if(this[_0x4250('0x13')][_0x1de032[_0x4250('0xa6')]]&&_0x1de032['linkedid']!==_0x1de032[_0x4250('0xa9')]){if(_0x1de032[_0x4250('0x13b')]==='16'&&this[_0x4250('0x13')][_0x1de032['linkedid']][_0x4250('0x6f')]){this['callProgressDetectingCustomer'](_0x1de032,_0x1de032[_0x4250('0xa6')],_0x1de032['cause']);}else if(this[_0x4250('0x13')][_0x1de032[_0x4250('0xa6')]]['dialAnswer']){logger[_0x4250('0x5a')]('[syncHangup][talking][cause]',_0x1de032[_0x4250('0xa6')],_0x1de032['cause'],_0x4250('0xe5'),_0x29cfe4[_0x4250('0x26')],_0x4250('0x6e'),_0x29cfe4[_0x4250('0x2a')]);this[_0x4250('0x13c')](_0x1de032,_0x1de032[_0x4250('0xa6')],_0x1de032[_0x4250('0x13b')]);}}else if(_0xe117b&&_[_0x4250('0x6b')](_0xe117b[_0x4250('0x13d')])&&_0x29cfe4[_0x4250('0x13e')]&&_0x1de032[_0x4250('0xa6')]===_0x1de032[_0x4250('0xa9')]&&_[_0x4250('0x6b')](_0x1de032[_0x4250('0xeb')])&&_0x1de032[_0x4250('0x13b')]==='16'&&_0x1de032[_0x4250('0x13f')]==='6'&&_['isUndefined'](_0xe117b['transfer'])){if(_0xe117b[_0x4250('0xa5')]){rpcDb['unlockContact'](_0xe117b[_0x4250('0x137')]);}if(_0xe117b[_0x4250('0xc2')]){rpcDb[_0x4250('0x88')](_0xe117b[_0x4250('0x137')]);}_0x1de032[_0x4250('0xeb')]='22';this[_0x4250('0xe8')](_0xe117b,_0x29cfe4,_0x1de032);}else if(_0xe117b&&_0xe117b[_0x4250('0x140')]){if(_0x1de032['cause']==='16'&&this[_0x4250('0x13')][_0x1de032['linkedid']][_0x4250('0x6f')]){logger[_0x4250('0x5a')](_0x4250('0x141'),_0x1de032[_0x4250('0xa6')],_0x1de032['cause'],_0x4250('0xe5'),_0x29cfe4[_0x4250('0x26')],_0x4250('0x6e'),_0x29cfe4[_0x4250('0x2a')]);this['callProgressDetectingCustomer'](_0x1de032,_0x1de032[_0x4250('0xa6')],_0x1de032['cause']);}else if(this['actions'][_0x1de032[_0x4250('0xa6')]][_0x4250('0x6f')]){logger[_0x4250('0x5a')](_0x4250('0x142'),_0x1de032[_0x4250('0xa6')],_0x1de032['cause'],_0x4250('0xe5'),_0x29cfe4['name'],'pTalking:\x20',_0x29cfe4['pTalking']);this['callProgressDetectingCustomer'](_0x1de032,_0x1de032[_0x4250('0xa6')],_0x1de032[_0x4250('0x13b')]);}}};Preview[_0x4250('0xc')]['syncDialEnd']=function(_0x43d9a9){if(this[_0x4250('0x13')][_0x43d9a9[_0x4250('0xe7')]]&&_0x43d9a9['destlinkedid']!==_0x43d9a9[_0x4250('0x143')]){this['callProgressDetectingCustomer'](_0x43d9a9,_0x43d9a9[_0x4250('0xe7')],_0x43d9a9[_0x4250('0xe1')]);}};Preview[_0x4250('0xc')][_0x4250('0x1c')]=function(_0x143b00){if(this[_0x4250('0x13')][_0x143b00[_0x4250('0xa6')]]&&_0x143b00['linkedid']!==_0x143b00['uniqueid']&&!this[_0x4250('0x13')][_0x143b00['linkedid']][_0x4250('0x6f')]){if(_0x143b00[_0x4250('0x13b')]==='1'){this[_0x4250('0x13c')](_0x143b00,_0x143b00[_0x4250('0xa6')],_0x143b00[_0x4250('0x13b')]);}}};Preview[_0x4250('0xc')][_0x4250('0x144')]=function(_0x3427fe,_0x45efa7,_0xcc3c9a){if(this[_0x4250('0x13')][_0x3427fe]){if(_[_0x4250('0x6b')](this[_0x4250('0x13')][_0x3427fe][_0x4250('0x145')])){this['actions'][_0x3427fe][_0x4250('0x145')]={};}this[_0x4250('0x13')][_0x3427fe][_0x4250('0x145')][_0x45efa7]=_0xcc3c9a;}};Preview['prototype']['syncVarSet']=function(_0x4b3257){try{if(!_[_0x4250('0x6b')](_0x4b3257)){if(ut[_0x4250('0x146')](_[_0x4250('0x147')](_0x4b3257['variable'])[0x0])){this[_0x4250('0x144')](_0x4b3257[_0x4250('0xa9')],_[_0x4250('0x147')](_0x4b3257['variable'])[0x0],_0x4b3257[_0x4250('0x148')]);}}}catch(_0x27d2c5){logger[_0x4250('0x149')](_0x4250('0x14a'),util[_0x4250('0x14b')](_0x27d2c5,{'showHidden':![],'depth':null}));}};Preview[_0x4250('0xc')][_0x4250('0x14c')]=function(_0x3a5447){if(_0x3a5447){if(this[_0x4250('0x13')][_0x3a5447['transfertargetlinkedid']]){this['actions'][_0x3a5447['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x4250('0xc')][_0x4250('0x14d')]=function(_0xde378a){if(_0xde378a){if(this[_0x4250('0x13')][_0xde378a[_0x4250('0x14e')]]){this['actions'][_0xde378a[_0x4250('0x14e')]][_0x4250('0x140')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 7dbf6ed..6b77ea5 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 _0x5636=['createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then'];(function(_0x3b6d58,_0xb29c70){var _0x64d7dc=function(_0x2ac5e4){while(--_0x2ac5e4){_0x3b6d58['push'](_0x3b6d58['shift']());}};_0x64d7dc(++_0xb29c70);}(_0x5636,0x102));var _0x6563=function(_0x5d560e,_0x197493){_0x5d560e=_0x5d560e-0x0;var _0x3072cd=_0x5636[_0x5d560e];return _0x3072cd;};'use strict';var util=require(_0x6563('0x0'));var BPromise=require(_0x6563('0x1'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var cmHopper=require(_0x6563('0x2'));var cmHopperFinal=require(_0x6563('0x3'));var cmHopperHistory=require(_0x6563('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x6563('0x5'));var agentReportPreview=require(_0x6563('0x6'));var voiceQueueReport=require(_0x6563('0x7'));function loggerCatch(_0x39792f){return function(_0x29f687){logger[_0x6563('0x8')](_0x39792f,util[_0x6563('0x9')](_0x29f687,{'showHidden':![],'depth':null}));};}function create(_0x2d57d5){return BPromise[_0x6563('0xa')]()[_0x6563('0xb')](cmHopperHistory[_0x6563('0xc')](_0x2d57d5))[_0x6563('0xd')](loggerCatch(_0x6563('0xe')));}function createAgent(_0x516d1a){return BPromise['resolve']()[_0x6563('0xb')](agentReportPreview[_0x6563('0xc')](_0x516d1a))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5da960){return BPromise[_0x6563('0xa')]()[_0x6563('0xb')](cmHopper[_0x6563('0xf')](_0x5da960,!![]))[_0x6563('0xd')](loggerCatch(_0x6563('0x10')));}exports[_0x6563('0x11')]=function(_0x31d3fa){return BPromise[_0x6563('0xa')]()[_0x6563('0xb')](cmHopperBlack['checkIsBlackList'](_0x31d3fa))[_0x6563('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x6563('0x12')]=function(_0x59bee1){return BPromise[_0x6563('0xa')]()[_0x6563('0xb')](cmHopper['getContactPreview'](_0x59bee1))[_0x6563('0xd')](loggerCatch(_0x6563('0x13')));};exports[_0x6563('0xc')]=function(_0xd398ce,_0x4e7282){create(_0xd398ce)[_0x6563('0xd')](loggerCatch(_0x4e7282));moveContact(_0xd398ce)['catch'](loggerCatch(_0x4e7282));};exports['createAgentHistory']=function(_0x47972a,_0x14c6a6){createAgent(_0x47972a)['catch'](loggerCatch(_0x14c6a6));};exports['createCustomerHistory']=function(_0x27651b,_0x344f60){create(_0x27651b)[_0x6563('0xd')](loggerCatch(_0x344f60));};exports[_0x6563('0x14')]=function(_0xf8b544,_0x10811d){moveContact(_0xf8b544)[_0x6563('0xd')](loggerCatch(_0x10811d));};exports[_0x6563('0x15')]=function(_0x2a70f0,_0x5bf608,_0x2f2905){if(_0x5bf608){_0x2a70f0[_0x6563('0x16')]=null;}if(_0x2f2905){_0x2a70f0[_0x6563('0x17')]=![];}return BPromise['resolve']()[_0x6563('0xb')](cmHopper['rescheduleContact'](_0x2a70f0))[_0x6563('0xd')](loggerCatch(_0x6563('0x18')));};exports['countReScheduled']=function(_0x5773e2){return BPromise[_0x6563('0xa')]()['then'](cmHopper[_0x6563('0x19')](_0x5773e2))[_0x6563('0xd')](loggerCatch(_0x6563('0x1a')));};exports['unlockContact']=function(_0xd860d5){return BPromise['resolve']()[_0x6563('0xb')](cmHopper[_0x6563('0x1b')]({'UserId':null},_0xd860d5,0x1))['catch'](loggerCatch(_0x6563('0x1c')));};exports[_0x6563('0x1d')]=function(_0x49a824){return BPromise[_0x6563('0xa')]()['then'](cmHopper[_0x6563('0x1b')]({'active':![]},_0x49a824,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x6563('0x1e')]=function(_0x118d31){var _0x17326c={};_0x17326c[_0x6563('0x1f')]=_0x118d31[_0x6563('0x1f')];_0x17326c['uniqueid']=_0x118d31[_0x6563('0x20')];_0x17326c['calleridnum']=_0x118d31['calleridnum'];_0x17326c[_0x6563('0x21')]=_0x118d31[_0x6563('0x21')];_0x17326c[_0x6563('0x22')]=_0x118d31[_0x6563('0x22')];_0x17326c[_0x6563('0x23')]=_0x118d31[_0x6563('0x24')];_0x17326c[_0x6563('0x25')]=_0x118d31[_0x6563('0x24')];_0x17326c[_0x6563('0x26')]=0x1;_0x17326c[_0x6563('0x27')]=_0x118d31['endtime'];_0x17326c[_0x6563('0x28')]=_0x118d31[_0x6563('0x29')];_0x17326c[_0x6563('0x2a')]=_0x6563('0x2b');_0x17326c[_0x6563('0x2c')]=_0x6563('0x2d');_0x17326c[_0x6563('0x2e')]=0x0;_0x17326c['assigned']=0x1;_0x17326c[_0x6563('0x2f')]=_0x118d31[_0x6563('0x29')];_0x17326c[_0x6563('0x30')]=_0x6563('0x31');return BPromise[_0x6563('0xa')]()[_0x6563('0xb')](voiceQueueReport['create'](_0x17326c))[_0x6563('0xd')](loggerCatch(_0x6563('0x32')));};exports[_0x6563('0x33')]=function(_0x33aa0b,_0x2c03ac){return BPromise[_0x6563('0xa')]()[_0x6563('0xb')](cmHopper['getContactRecallMe'](_0x33aa0b,_0x2c03ac))[_0x6563('0xd')](loggerCatch(_0x6563('0x34')));};exports['rescheduleContactInQueue']=function(_0xf6b446){return BPromise[_0x6563('0xa')]()['then'](cmHopper['rescheduleContact'](_0xf6b446,!![],!![]))[_0x6563('0xd')](loggerCatch(_0x6563('0x35')));}; \ No newline at end of file +var _0x277c=['endtime','connectedlinename','membername','from-sip','exten','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','error','resolve','createHistory','catch','[createHistory]\x20','then','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercompleteAt'];(function(_0x176e12,_0x180e8a){var _0x4bef6d=function(_0x1e895a){while(--_0x1e895a){_0x176e12['push'](_0x176e12['shift']());}};_0x4bef6d(++_0x180e8a);}(_0x277c,0x153));var _0xc277=function(_0x3bf7b3,_0x305a6f){_0x3bf7b3=_0x3bf7b3-0x0;var _0x15157d=_0x277c[_0x3bf7b3];return _0x15157d;};'use strict';var util=require(_0xc277('0x0'));var BPromise=require('bluebird');var logger=require(_0xc277('0x1'))(_0xc277('0x2'));var _=require(_0xc277('0x3'));var cmHopper=require(_0xc277('0x4'));var cmHopperFinal=require(_0xc277('0x5'));var cmHopperHistory=require(_0xc277('0x6'));var cmHopperBlack=require(_0xc277('0x7'));var voiceQueueRt=require(_0xc277('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1a6582){return function(_0x5a4f03){logger[_0xc277('0x9')](_0x1a6582,util['inspect'](_0x5a4f03,{'showHidden':![],'depth':null}));};}function create(_0x378158){return BPromise[_0xc277('0xa')]()['then'](cmHopperHistory[_0xc277('0xb')](_0x378158))[_0xc277('0xc')](loggerCatch(_0xc277('0xd')));}function createAgent(_0x1b1db0){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](agentReportPreview['createHistory'](_0x1b1db0))['catch'](loggerCatch(_0xc277('0xd')));}function moveContact(_0x1632bb){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopper['moveContactManagedDialer'](_0x1632bb,!![]))[_0xc277('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xc277('0xf')]=function(_0x2bba87){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopperBlack['checkIsBlackList'](_0x2bba87))[_0xc277('0xc')](loggerCatch(_0xc277('0x10')));};exports[_0xc277('0x11')]=function(_0x4de960){return BPromise['resolve']()[_0xc277('0xe')](cmHopper['getContactPreview'](_0x4de960))[_0xc277('0xc')](loggerCatch('[getContactPreview]\x20'));};exports[_0xc277('0xb')]=function(_0x1162b9,_0x15f560){create(_0x1162b9)['catch'](loggerCatch(_0x15f560));moveContact(_0x1162b9)['catch'](loggerCatch(_0x15f560));};exports[_0xc277('0x12')]=function(_0x4d23a7,_0x4d8351){createAgent(_0x4d23a7)[_0xc277('0xc')](loggerCatch(_0x4d8351));};exports[_0xc277('0x13')]=function(_0x3b247e,_0x176dfb){create(_0x3b247e)[_0xc277('0xc')](loggerCatch(_0x176dfb));};exports[_0xc277('0x14')]=function(_0x391cc3,_0x4a7a79){moveContact(_0x391cc3)['catch'](loggerCatch(_0x4a7a79));};exports[_0xc277('0x15')]=function(_0x28900e,_0x2bdc25,_0x28b7b1){if(_0x2bdc25){_0x28900e[_0xc277('0x16')]=null;}if(_0x28b7b1){_0x28900e[_0xc277('0x17')]=![];}return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopper[_0xc277('0x15')](_0x28900e))[_0xc277('0xc')](loggerCatch(_0xc277('0x18')));};exports['countReScheduled']=function(_0x2b9936){return BPromise[_0xc277('0xa')]()['then'](cmHopper[_0xc277('0x19')](_0x2b9936))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xc277('0x1a')]=function(_0x57b03){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopper[_0xc277('0x1a')]({'UserId':null},_0x57b03,0x1))[_0xc277('0xc')](loggerCatch(_0xc277('0x1b')));};exports[_0xc277('0x1c')]=function(_0xf903ea){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopper['unlockContact']({'active':![]},_0xf903ea,0x1))['catch'](loggerCatch(_0xc277('0x1d')));};exports[_0xc277('0x1e')]=function(_0x4ebb0f){var _0x4efc1e={};_0x4efc1e[_0xc277('0x1f')]=_0x4ebb0f[_0xc277('0x1f')];_0x4efc1e[_0xc277('0x20')]=_0x4ebb0f[_0xc277('0x20')];_0x4efc1e[_0xc277('0x21')]=_0x4ebb0f['calleridnum'];_0x4efc1e[_0xc277('0x22')]=_0x4ebb0f['calleridname'];_0x4efc1e[_0xc277('0x23')]=_0x4ebb0f[_0xc277('0x23')];_0x4efc1e[_0xc277('0x24')]=_0x4ebb0f[_0xc277('0x25')];_0x4efc1e['queuecallerleaveAt']=_0x4ebb0f[_0xc277('0x25')];_0x4efc1e['queuecallercomplete']=0x1;_0x4efc1e[_0xc277('0x26')]=_0x4ebb0f[_0xc277('0x27')];_0x4efc1e[_0xc277('0x28')]=_0x4ebb0f[_0xc277('0x29')];_0x4efc1e['context']=_0xc277('0x2a');_0x4efc1e[_0xc277('0x2b')]='xcally-motion-preview';_0x4efc1e[_0xc277('0x2c')]=0x0;_0x4efc1e['assigned']=0x1;_0x4efc1e[_0xc277('0x2d')]=_0x4ebb0f[_0xc277('0x29')];_0x4efc1e[_0xc277('0x2e')]=_0xc277('0x2f');return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](voiceQueueReport[_0xc277('0x30')](_0x4efc1e))[_0xc277('0xc')](loggerCatch(_0xc277('0x31')));};exports[_0xc277('0x32')]=function(_0xdc94a1,_0x5b2329){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopper[_0xc277('0x32')](_0xdc94a1,_0x5b2329))['catch'](loggerCatch(_0xc277('0x33')));};exports[_0xc277('0x34')]=function(_0x18986b){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopper['rescheduleContact'](_0x18986b,!![],!![]))['catch'](loggerCatch(_0xc277('0x35')));}; \ 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 6ecba13..73477d8 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 _0xcdd2=['util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','info','loggerError','error','logger2','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','ringtime','responsetime','membername','UserId','logCustomer','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','lastevent','name','queue','interface','buildAcw','not_inuse','VoiceQueueId','CampaignId','filterKey','idContact','type','dialAnswer','countcongestionretry','countglobal','callbackuniqueid','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber'];(function(_0x243087,_0x14e197){var _0x3c7b95=function(_0x114da0){while(--_0x114da0){_0x243087['push'](_0x243087['shift']());}};_0x3c7b95(++_0x14e197);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x2cdd('0x0'));var _=require(_0x2cdd('0x1'));var moment=require(_0x2cdd('0x2'));var logger=require(_0x2cdd('0x3'))('preview');var ipAgi=process[_0x2cdd('0x4')][_0x2cdd('0x5')]||_0x2cdd('0x6');function getSeconds(_0x2b63a4,_0x5d1626){var _0x42dbf8=moment(_0x2b63a4)[_0x2cdd('0x7')](0x0);var _0x5f3b53=moment(_0x5d1626)[_0x2cdd('0x7')](0x0);return _0x42dbf8[_0x2cdd('0x8')](_0x5f3b53,_0x2cdd('0x9'));}exports[_0x2cdd('0xa')]=function(_0x506b09){return function(_0x569943){logger['error'](_0x506b09,util[_0x2cdd('0xb')](_0x569943,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x12cdca,_0x3e3cf0){logger[_0x2cdd('0xc')](_0x12cdca,util[_0x2cdd('0xb')](_0x3e3cf0,{'showHidden':![],'depth':null}));};exports[_0x2cdd('0xd')]=function(_0xa4b1b8,_0x315b10){logger[_0x2cdd('0xe')](_0xa4b1b8,util[_0x2cdd('0xb')](_0x315b10,{'showHidden':![],'depth':null}));};exports[_0x2cdd('0xf')]=function(_0x4a808b){return function(_0x53ea0b){logger[_0x2cdd('0xc')](_0x4a808b,util[_0x2cdd('0xb')](_0x53ea0b,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x500f4c,_0x2557b9,_0x345b45){return{'message':_0x500f4c,'unlock':_0x2557b9,'active':_0x345b45};};exports[_0x2cdd('0x10')]=function(_0x4093f,_0x5934bd,_0x367111){if(!_[_0x2cdd('0x11')](_0x367111)&&'string'===typeof _0x367111&&!_[_0x2cdd('0x12')](_0x367111)){if(!_[_0x2cdd('0x11')](_0x5934bd)&&_0x2cdd('0x13')===typeof _0x5934bd&&!_[_0x2cdd('0x12')](_0x5934bd)){return util[_0x2cdd('0x14')](_0x2cdd('0x15'),_0x5934bd,_0x367111);}return util['format'](_0x2cdd('0x15'),_0x367111,_0x367111);}if(!_[_0x2cdd('0x11')](_0x4093f)&&_0x2cdd('0x13')===typeof _0x4093f&&!_[_0x2cdd('0x12')](_0x4093f)){return _0x4093f;}return'\x22\x22\x20<>';};exports[_0x2cdd('0x16')]=function(_0x204543){if(_[_0x2cdd('0x17')](_0x204543)){return![];}return _0x204543;};exports[_0x2cdd('0x18')]=function(_0x3056e7,_0x871fd2,_0x2b0691,_0x442c18,_0x3dc9ec,_0x127179){var _0x5ac9d3={'XMD-QUEUE':_0x871fd2['Queue']?_0x871fd2[_0x2cdd('0x19')]['name']:'','XMD-CALLERID':_0x442c18,'XMD-CALLERID-PREVIEW':_0x127179?util['format'](_0x2cdd('0x15'),_0x127179[_0x2cdd('0x1a')],_0x127179[_0x2cdd('0x1b')]):_0x442c18,'XMD-DIALID':_0x3dc9ec,'XMD-CONTACTID':_0x871fd2[_0x2cdd('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x442c18,'XMD-VOICEQUEUEID':_0x871fd2['VoiceQueueId'],'XMD-DIALCHANNEL':_0x2b0691,'XMD-DIALTIMEOUT':_0x3056e7[_0x2cdd('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x2cdd('0x14')](_0x2cdd('0x1e'),_0x3056e7[_0x2cdd('0x1f')]?'g':'',_[_0x2cdd('0x12')](_0x3056e7[_0x2cdd('0x20')])?'':_0x2cdd('0x21')),'XMD-DIALURL':_0x3056e7['dialPreviewUrl']||'','XMD-AGI':_0x3056e7[_0x2cdd('0x22')]?util[_0x2cdd('0x14')](_0x2cdd('0x23'),ipAgi,_0x3056e7['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x3056e7['dialQueueProject2']?util[_0x2cdd('0x14')](_0x2cdd('0x23'),ipAgi,_0x3056e7['dialQueueProject2']):_0x2cdd('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x127179?_0x127179[_0x2cdd('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x127179?_0x127179[_0x2cdd('0x26')]:'','XMD-DESTINATION':_0x2cdd('0x27')};if(!_[_0x2cdd('0x12')](_0x3056e7[_0x2cdd('0x20')])){_0x5ac9d3[util['format']('%s',_0x2cdd('0x28'))]=_0x3056e7[_0x2cdd('0x20')];_0x5ac9d3[util[_0x2cdd('0x14')]('%s',_0x2cdd('0x29'))]=_0x3dc9ec;}if(_0x871fd2&&_0x871fd2['Contact']){for(var _0x447051 in _0x871fd2[_0x2cdd('0x2a')]){if(_0x871fd2['Contact'][_0x2cdd('0x2b')](_0x447051)){if(!_[_0x2cdd('0x17')](_0x871fd2[_0x2cdd('0x2a')][_0x447051])&&_0x447051!=='id'&&_0x447051!==_0x2cdd('0x2c')&&_0x447051!==_0x2cdd('0x2d')&&_0x447051!==_0x2cdd('0x2e')){_0x5ac9d3[util[_0x2cdd('0x14')](_0x2cdd('0x2f'),_0x2cdd('0x30'),_['toUpper'](_0x447051))]=_0x871fd2[_0x2cdd('0x2a')][_0x447051];}}}}return _0x5ac9d3;};exports[_0x2cdd('0x31')]=function(_0x3701f5){var _0x5a0fb4={};for(var _0x53fe46 in _0x3701f5){if(_0x3701f5['hasOwnProperty'](_0x53fe46)){_0x5a0fb4[util[_0x2cdd('0x14')]('%s',_[_0x2cdd('0x32')](_0x53fe46))]=_0x3701f5[_0x53fe46];}}return{'variables':_0x5a0fb4};};exports['updateOriginated']=function(_0x6c7f28,_0x3366dc){if(!_[_0x2cdd('0x17')](_0x6c7f28)){if(_0x6c7f28[_0x2cdd('0x2b')](_0x2cdd('0x33'))){if(_0x6c7f28['originated']>0x0){_0x6c7f28['originated']-=0x1;}else{logger[_0x2cdd('0xe')](_0x2cdd('0x34'),_0x3366dc);}}}else{logger[_0x2cdd('0xe')](_0x2cdd('0x35'),_0x3366dc);}};exports[_0x2cdd('0x36')]=function(_0x49a484){var _0x1db75a=moment()[_0x2cdd('0x14')](_0x2cdd('0x37'));_0x49a484[_0x2cdd('0x38')]=0xd;_0x49a484[_0x2cdd('0x39')]=_0x2cdd('0x3a');_0x49a484[_0x2cdd('0x3b')]=_0x1db75a;_0x49a484['responsetime']=_0x1db75a;_0x49a484[_0x2cdd('0x3c')]=_0x1db75a;};exports[_0x2cdd('0x3d')]=function(_0x2f8e8c,_0x42cbd7,_0x296359){var _0x113d5d=moment()[_0x2cdd('0x14')](_0x2cdd('0x37'));_0x2f8e8c[_0x2cdd('0x38')]=_0x42cbd7;_0x2f8e8c['statedesc']=_0x296359;_0x2f8e8c['responsetime']=_0x113d5d;_0x2f8e8c[_0x2cdd('0x3e')]=getSeconds(_0x2f8e8c[_0x2cdd('0x3f')],_0x2f8e8c[_0x2cdd('0x3b')]);};exports['logLookAgent']=function(_0x45e423,_0x59e7d8,_0x573bd4){_0x45e423[_0x2cdd('0x40')]=_0x59e7d8;_0x45e423[_0x2cdd('0x41')]=_0x573bd4;};exports[_0x2cdd('0x42')]=function(_0x721f29,_0xe00767,_0x2414bd){var _0x4388d7=moment()[_0x2cdd('0x14')](_0x2cdd('0x37'));_0x721f29['state']=_0xe00767;_0x721f29[_0x2cdd('0x39')]=_0x2414bd;_0x721f29[_0x2cdd('0x3f')]=_0x721f29[_0x2cdd('0x3f')]?_0x721f29['responsetime']:_0x4388d7;_0x721f29[_0x2cdd('0x3c')]=_0x721f29[_0x2cdd('0x3c')]?_0x721f29[_0x2cdd('0x3c')]:_0x4388d7;_0x721f29[_0x2cdd('0x3e')]=getSeconds(_0x721f29[_0x2cdd('0x3f')]||0x0,_0x721f29['starttime']||0x0);_0x721f29['talktime']=_0x721f29[_0x2cdd('0x43')]?getSeconds(_0x721f29[_0x2cdd('0x3c')],_0x721f29[_0x2cdd('0x43')]):0x0;};exports['isFailure']=function(_0x51c6c6){return _0x51c6c6===_0x2cdd('0x44');};exports[_0x2cdd('0x45')]=function(_0x5258fc,_0x4cbc66,_0x2cdfe9,_0xd66b97,_0x2cf9c2){var _0x441941=_0xd66b97?_0x2cdd('0x46'):_0x5258fc[_0x2cdd('0x1a')];_0x441941=_0x2cf9c2?_0x2cdd('0x47'):_0x441941;return{'actionid':_0x5258fc[_0x2cdd('0x48')],'action':_0x2cdd('0x49'),'channel':_0x5258fc[_0x2cdd('0x4a')],'callerid':util[_0x2cdd('0x14')]('\x22%s\x22\x20<%s>',_0x441941,_0x5258fc[_0x2cdd('0x1b')]),'Exten':_0x2cdd('0x27'),'Context':_0x2cdd('0x4b'),'Priority':'1','variable':_0x2cdfe9,'timeout':(_0x4cbc66['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5258fc[_0x2cdd('0x48')]};};exports['totalGlobal']=function(_0x5acb44){return _0x5acb44[_0x2cdd('0x4c')]+_0x5acb44['countcongestionretry']+_0x5acb44[_0x2cdd('0x4d')]+_0x5acb44[_0x2cdd('0x4e')]+_0x5acb44[_0x2cdd('0x4f')];};exports['cloneAction']=function(_0x2cb8db){var _0x130f65=_[_0x2cdd('0x50')](_0x2cb8db);_0x130f65[_0x2cdd('0x38')]=0xf;_0x130f65[_0x2cdd('0x39')]=_0x2cdd('0x51');return _0x130f65;};exports[_0x2cdd('0x52')]=function(_0x678f75,_0x5e2d57,_0x26089f){var _0x58e0d6={};_0x58e0d6[_0x5e2d57]=_0x678f75[_0x5e2d57];_0x58e0d6[_0x2cdd('0x53')]=![];_0x58e0d6[_0x2cdd('0x54')]=moment()[_0x2cdd('0x55')](_0x26089f,_0x2cdd('0x56'))['format'](_0x2cdd('0x37'));_0x58e0d6['ContactId']=_0x678f75['ContactId'];_0x58e0d6[_0x2cdd('0x57')]=_0x678f75[_0x2cdd('0x57')];_0x58e0d6['VoiceQueueId']=_0x678f75['VoiceQueueId']||undefined;return _0x58e0d6;};exports[_0x2cdd('0x58')]=function(_0x5071cf,_0x39f829){if(!_[_0x2cdd('0x17')](_0x5071cf)){if(_0x5071cf[_0x2cdd('0x59')]>0x0){_0x5071cf[_0x2cdd('0x59')]-=0x1;}else{logger['error'](_0x39f829,_0x2cdd('0x5a'));}}else{logger['error'](_0x39f829,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x4f9172){if(_0x4f9172<=0x0){return!![];}return![];};exports['buildObj']=function(_0x42eb07,_0x20bed3){_0x42eb07[_0x2cdd('0x5b')]=_0x20bed3;_0x42eb07[_0x2cdd('0x5c')]=_0x42eb07[_0x2cdd('0x5d')];_0x42eb07[_0x2cdd('0x5e')]=_0x42eb07[_0x2cdd('0x4a')];return _0x42eb07;};exports[_0x2cdd('0x5f')]=function(_0x4aec5e){var _0xe25adb={};_0xe25adb[_0x2cdd('0x5d')]=_0x4aec5e[_0x2cdd('0x5d')];_0xe25adb[_0x2cdd('0x5e')]=_0x4aec5e[_0x2cdd('0x4a')];_0xe25adb[_0x2cdd('0x48')]=_0x4aec5e[_0x2cdd('0x48')];return _0xe25adb;};exports['agentReadyId']=function(_0x148ba1){var _0x35568e=[];for(var _0x27dd05 in _0x148ba1){if(_0x148ba1[_0x2cdd('0x2b')](_0x27dd05)){if(!_[_0x2cdd('0x17')](_0x148ba1[_0x27dd05])&&_0x148ba1[_0x27dd05]['state']===_0x2cdd('0x60')&&_0x148ba1[_0x27dd05]['status']==='reachable'){_0x35568e['push'](_0x148ba1[_0x27dd05]['id']);}}}return _0x35568e;};exports['getDiff']=function(_0x23faf6){var _0x40cd36=moment()[_0x2cdd('0x7')](0x0);var _0x8427fb=moment(_0x23faf6)['milliseconds'](0x0);return _0x40cd36[_0x2cdd('0x8')](_0x8427fb,_0x2cdd('0x9'));};exports['createBody']=function(_0x3de339){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3de339[_0x2cdd('0x1c')],'ListId':_0x3de339[_0x2cdd('0x57')],'VoiceQueueId':_0x3de339[_0x2cdd('0x61')]||undefined,'CampaignId':_0x3de339[_0x2cdd('0x62')]||undefined};};exports[_0x2cdd('0x63')]=function(_0x207de0){if(_0x207de0==='uniqueid'||_0x207de0===_0x2cdd('0x64')||_0x207de0===_0x2cdd('0x5d')||_0x207de0===_0x2cdd('0x65')||_0x207de0==='campaigntype'||_0x207de0===_0x2cdd('0x66')||_0x207de0==='membername'||_0x207de0===_0x2cdd('0x4a')||_0x207de0===_0x2cdd('0x1a')||_0x207de0===_0x2cdd('0x53')||_0x207de0===_0x2cdd('0x1b')||_0x207de0==='scheduledat'||_0x207de0===_0x2cdd('0x4c')||_0x207de0===_0x2cdd('0x67')||_0x207de0===_0x2cdd('0x4d')||_0x207de0===_0x2cdd('0x68')||_0x207de0==='callback'||_0x207de0===_0x2cdd('0x69')||_0x207de0==='callbackat'||_0x207de0===_0x2cdd('0x6a')||_0x207de0===_0x2cdd('0x1c')||_0x207de0===_0x2cdd('0x57')||_0x207de0==='UserId'||_0x207de0===_0x2cdd('0x61')||_0x207de0===_0x2cdd('0x6b')||_0x207de0==='xmd-voicequeueid'||_0x207de0===_0x2cdd('0x6c')||_0x207de0===_0x2cdd('0x6d')||_0x207de0===_0x2cdd('0x6e')||_0x207de0==='xmd-dialurl'||_0x207de0==='xmd-dialtimeout'||_0x207de0==='xmd-dialoptions'||_0x207de0===_0x2cdd('0x6f')||_0x207de0==='xmd-dialchannel'||_0x207de0===_0x2cdd('0x70')||_0x207de0===_0x2cdd('0x71')||_0x207de0==='xmd-callerid'||_0x207de0===_0x2cdd('0x72')||_0x207de0==='xmd-agi'||_0x207de0===_0x2cdd('0x73')||_0x207de0===_0x2cdd('0x74')||_0x207de0===_0x2cdd('0x75')||_0x207de0===_0x2cdd('0x76')||_0x207de0==='rtpaudioqosloss'||_0x207de0==='rtpaudioqoslossbridged'||_0x207de0==='rtpaudioqosrtt'||_0x207de0===_0x2cdd('0x77')||_0x207de0===_0x2cdd('0x73')||_0x207de0==='rtpaudioqosbridged'||_0x207de0==='rtpaudioqosjitter'||_0x207de0===_0x2cdd('0x76')||_0x207de0==='rtpaudioqosloss'||_0x207de0===_0x2cdd('0x78')||_0x207de0===_0x2cdd('0x79')||_0x207de0===_0x2cdd('0x77')||_0x207de0===_0x2cdd('0x7a')||_0x207de0===_0x2cdd('0x7b')||_0x207de0==='state'||_0x207de0===_0x2cdd('0x39')){return![];}return!![];};exports[_0x2cdd('0x7c')]=function(_0x1ca33b,_0x4ea170){var _0x23f7ee,_0xd813e2,_0x573a3b;if(_0x4ea170<=0x0){_0x4ea170=0x1;}_0x23f7ee=new RegExp(_0x2cdd('0x7d')+_0x4ea170+'}$');_0xd813e2=Math[_0x2cdd('0x7e')](0xa,_0x4ea170-0x1);_0x573a3b=Math['pow'](0xa,_0x4ea170)-0x1;return util['format']('%s',_[_0x2cdd('0x7f')](_0x1ca33b,_0x23f7ee,_[_0x2cdd('0x80')](_0xd813e2,_0x573a3b)));};exports[_0x2cdd('0x81')]=function(_0x324978){var _0x13372a=_0x324978['match'](/"(.*?)"/);return _0x13372a?_0x13372a[0x1]:_0x324978;};exports[_0x2cdd('0x82')]=function(_0x5ae650){var _0x4098b6=_0x5ae650['match'](/<(.*?)>/);return _0x4098b6?_0x4098b6[0x1]:_0x5ae650;}; \ No newline at end of file +var _0xc5b3=['YYYY-MM-DD\x20HH:mm:ss','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledat','minutes','ListId','decrementTalkink','pTalking','IsNotLoggedIn','lastevent','interface','queue','agentReadyId','status','reachable','push','getDiff','milliseconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','diff','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent'];(function(_0xe909a7,_0x4e7e69){var _0x54bf8b=function(_0x11ea16){while(--_0x11ea16){_0xe909a7['push'](_0xe909a7['shift']());}};_0x54bf8b(++_0x4e7e69);}(_0xc5b3,0x1ee));var _0x3c5b=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0xc5b3[_0xd0cd0b];return _0x59cced;};'use strict';var util=require(_0x3c5b('0x0'));var _=require(_0x3c5b('0x1'));var moment=require(_0x3c5b('0x2'));var logger=require(_0x3c5b('0x3'))(_0x3c5b('0x4'));var ipAgi=process[_0x3c5b('0x5')][_0x3c5b('0x6')]||_0x3c5b('0x7');function getSeconds(_0x5c99ff,_0x3cd21d){var _0x721a26=moment(_0x5c99ff)['milliseconds'](0x0);var _0x320aa2=moment(_0x3cd21d)['milliseconds'](0x0);return _0x721a26[_0x3c5b('0x8')](_0x320aa2,_0x3c5b('0x9'));}exports[_0x3c5b('0xa')]=function(_0xae86a0){return function(_0x32586d){logger[_0x3c5b('0xb')](_0xae86a0,util[_0x3c5b('0xc')](_0x32586d,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x115ec1,_0x110772){logger[_0x3c5b('0xd')](_0x115ec1,util[_0x3c5b('0xc')](_0x110772,{'showHidden':![],'depth':null}));};exports[_0x3c5b('0xe')]=function(_0x575f2d,_0x127c2e){logger[_0x3c5b('0xb')](_0x575f2d,util[_0x3c5b('0xc')](_0x127c2e,{'showHidden':![],'depth':null}));};exports[_0x3c5b('0xf')]=function(_0x4454b0){return function(_0xf5a6a8){logger[_0x3c5b('0xd')](_0x4454b0,util['inspect'](_0xf5a6a8,{'showHidden':![],'depth':null}));};};exports[_0x3c5b('0x10')]=function(_0x4769e3,_0x1890d7,_0x287716){return{'message':_0x4769e3,'unlock':_0x1890d7,'active':_0x287716};};exports['getCallerId']=function(_0x6449c3,_0x5e5fbb,_0x12330d){if(!_[_0x3c5b('0x11')](_0x12330d)&&'string'===typeof _0x12330d&&!_[_0x3c5b('0x12')](_0x12330d)){if(!_[_0x3c5b('0x11')](_0x5e5fbb)&&'string'===typeof _0x5e5fbb&&!_[_0x3c5b('0x12')](_0x5e5fbb)){return util[_0x3c5b('0x13')](_0x3c5b('0x14'),_0x5e5fbb,_0x12330d);}return util['format'](_0x3c5b('0x14'),_0x12330d,_0x12330d);}if(!_['isUndefined'](_0x6449c3)&&_0x3c5b('0x15')===typeof _0x6449c3&&!_[_0x3c5b('0x12')](_0x6449c3)){return _0x6449c3;}return _0x3c5b('0x16');};exports[_0x3c5b('0x17')]=function(_0x37dfb0){if(_[_0x3c5b('0x18')](_0x37dfb0)){return![];}return _0x37dfb0;};exports['addVariables']=function(_0x4a76d5,_0xa074cc,_0x497947,_0x7b1e1,_0x1e1c0b,_0x135666){var _0x4cb3d3={'XMD-QUEUE':_0xa074cc[_0x3c5b('0x19')]?_0xa074cc['Queue'][_0x3c5b('0x1a')]:'','XMD-CALLERID':_0x7b1e1,'XMD-CALLERID-PREVIEW':_0x135666?util[_0x3c5b('0x13')](_0x3c5b('0x14'),_0x135666[_0x3c5b('0x1b')],_0x135666[_0x3c5b('0x1c')]):_0x7b1e1,'XMD-DIALID':_0x1e1c0b,'XMD-CONTACTID':_0xa074cc[_0x3c5b('0x1d')],'XMD-CDRTYPE':_0x3c5b('0x1e'),'CALLERID(all)':_0x7b1e1,'XMD-VOICEQUEUEID':_0xa074cc[_0x3c5b('0x1f')],'XMD-DIALCHANNEL':_0x497947,'XMD-DIALTIMEOUT':_0x4a76d5['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x3c5b('0x13')](_0x3c5b('0x20'),_0x4a76d5[_0x3c5b('0x21')]?'g':'',_['isEmpty'](_0x4a76d5[_0x3c5b('0x22')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4a76d5['dialPreviewUrl']||'','XMD-AGI':_0x4a76d5['dialQueueProject']?util['format'](_0x3c5b('0x23'),ipAgi,_0x4a76d5[_0x3c5b('0x24')]):_0x3c5b('0x25'),'XMD-AGIAFTER':_0x4a76d5['dialQueueProject2']?util[_0x3c5b('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4a76d5[_0x3c5b('0x21')]):_0x3c5b('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x135666?_0x135666[_0x3c5b('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x135666?_0x135666[_0x3c5b('0x27')]:'','XMD-DESTINATION':_0x3c5b('0x28')};if(!_[_0x3c5b('0x12')](_0x4a76d5[_0x3c5b('0x22')])){_0x4cb3d3[util[_0x3c5b('0x13')]('%s',_0x3c5b('0x29'))]=_0x4a76d5['monitor_format'];_0x4cb3d3[util[_0x3c5b('0x13')]('%s',_0x3c5b('0x2a'))]=_0x1e1c0b;}if(_0xa074cc&&_0xa074cc[_0x3c5b('0x2b')]){for(var _0x410ebf in _0xa074cc[_0x3c5b('0x2b')]){if(_0xa074cc[_0x3c5b('0x2b')][_0x3c5b('0x2c')](_0x410ebf)){if(!_[_0x3c5b('0x18')](_0xa074cc['Contact'][_0x410ebf])&&_0x410ebf!=='id'&&_0x410ebf!=='tags'&&_0x410ebf!==_0x3c5b('0x2d')&&_0x410ebf!==_0x3c5b('0x2e')){_0x4cb3d3[util['format'](_0x3c5b('0x2f'),_0x3c5b('0x30'),_['toUpper'](_0x410ebf))]=_0xa074cc[_0x3c5b('0x2b')][_0x410ebf];}}}}return _0x4cb3d3;};exports[_0x3c5b('0x31')]=function(_0x539da6){var _0xab01c0={};for(var _0x275d32 in _0x539da6){if(_0x539da6[_0x3c5b('0x2c')](_0x275d32)){_0xab01c0[util[_0x3c5b('0x13')]('%s',_[_0x3c5b('0x32')](_0x275d32))]=_0x539da6[_0x275d32];}}return{'variables':_0xab01c0};};exports[_0x3c5b('0x33')]=function(_0x281e53,_0x3029b0){if(!_[_0x3c5b('0x18')](_0x281e53)){if(_0x281e53[_0x3c5b('0x2c')](_0x3c5b('0x34'))){if(_0x281e53[_0x3c5b('0x34')]>0x0){_0x281e53[_0x3c5b('0x34')]-=0x1;}else{logger[_0x3c5b('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3029b0);}}}else{logger[_0x3c5b('0xb')](_0x3c5b('0x35'),_0x3029b0);}};exports[_0x3c5b('0x36')]=function(_0x561010){var _0x4ebc4c=moment()[_0x3c5b('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x561010[_0x3c5b('0x37')]=0xd;_0x561010[_0x3c5b('0x38')]=_0x3c5b('0x39');_0x561010[_0x3c5b('0x3a')]=_0x4ebc4c;_0x561010[_0x3c5b('0x3b')]=_0x4ebc4c;_0x561010[_0x3c5b('0x3c')]=_0x4ebc4c;};exports[_0x3c5b('0x3d')]=function(_0x5c2674,_0x4c16aa,_0x49c18f){var _0x30a18e=moment()['format'](_0x3c5b('0x3e'));_0x5c2674[_0x3c5b('0x37')]=_0x4c16aa;_0x5c2674[_0x3c5b('0x38')]=_0x49c18f;_0x5c2674[_0x3c5b('0x3b')]=_0x30a18e;_0x5c2674['ringtime']=getSeconds(_0x5c2674[_0x3c5b('0x3b')],_0x5c2674[_0x3c5b('0x3a')]);};exports[_0x3c5b('0x3f')]=function(_0x4b712f,_0x508cbb,_0x401deb){_0x4b712f[_0x3c5b('0x40')]=_0x508cbb;_0x4b712f[_0x3c5b('0x41')]=_0x401deb;};exports[_0x3c5b('0x42')]=function(_0x1175d7,_0x23ceb0,_0x5110b2){var _0x50bdd6=moment()['format'](_0x3c5b('0x3e'));_0x1175d7[_0x3c5b('0x37')]=_0x23ceb0;_0x1175d7[_0x3c5b('0x38')]=_0x5110b2;_0x1175d7['responsetime']=_0x1175d7['responsetime']?_0x1175d7[_0x3c5b('0x3b')]:_0x50bdd6;_0x1175d7[_0x3c5b('0x3c')]=_0x1175d7['endtime']?_0x1175d7[_0x3c5b('0x3c')]:_0x50bdd6;_0x1175d7['ringtime']=getSeconds(_0x1175d7['responsetime']||0x0,_0x1175d7[_0x3c5b('0x3a')]||0x0);_0x1175d7[_0x3c5b('0x43')]=_0x1175d7[_0x3c5b('0x44')]?getSeconds(_0x1175d7[_0x3c5b('0x3c')],_0x1175d7[_0x3c5b('0x44')]):0x0;};exports[_0x3c5b('0x45')]=function(_0x1c448d){return _0x1c448d===_0x3c5b('0x46');};exports[_0x3c5b('0x47')]=function(_0x324d27,_0x23bb3d,_0x5d724e,_0x1e61b5,_0x523281){var _0x4752b8=_0x1e61b5?'RECALL':_0x324d27[_0x3c5b('0x1b')];_0x4752b8=_0x523281?_0x3c5b('0x48'):_0x4752b8;return{'actionid':_0x324d27[_0x3c5b('0x49')],'action':_0x3c5b('0x4a'),'channel':_0x324d27[_0x3c5b('0x4b')],'callerid':util[_0x3c5b('0x13')](_0x3c5b('0x14'),_0x4752b8,_0x324d27[_0x3c5b('0x1c')]),'Exten':'xcally-motion-preview','Context':_0x3c5b('0x4c'),'Priority':'1','variable':_0x5d724e,'timeout':(_0x23bb3d[_0x3c5b('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x324d27[_0x3c5b('0x49')]};};exports[_0x3c5b('0x4e')]=function(_0x4e312a){return _0x4e312a[_0x3c5b('0x4f')]+_0x4e312a[_0x3c5b('0x50')]+_0x4e312a[_0x3c5b('0x51')]+_0x4e312a[_0x3c5b('0x52')]+_0x4e312a[_0x3c5b('0x53')];};exports[_0x3c5b('0x54')]=function(_0x24d4f6){var _0x159799=_[_0x3c5b('0x55')](_0x24d4f6);_0x159799[_0x3c5b('0x37')]=0xf;_0x159799[_0x3c5b('0x38')]=_0x3c5b('0x56');return _0x159799;};exports['scheduledAt']=function(_0x4b3232,_0x418b0c,_0x19a129){var _0xb6e9e={};_0xb6e9e[_0x418b0c]=_0x4b3232[_0x418b0c];_0xb6e9e['active']=![];_0xb6e9e[_0x3c5b('0x57')]=moment()['add'](_0x19a129,_0x3c5b('0x58'))[_0x3c5b('0x13')](_0x3c5b('0x3e'));_0xb6e9e[_0x3c5b('0x1d')]=_0x4b3232[_0x3c5b('0x1d')];_0xb6e9e[_0x3c5b('0x59')]=_0x4b3232[_0x3c5b('0x59')];_0xb6e9e[_0x3c5b('0x1f')]=_0x4b3232[_0x3c5b('0x1f')]||undefined;return _0xb6e9e;};exports[_0x3c5b('0x5a')]=function(_0x2267cd,_0x153a37){if(!_[_0x3c5b('0x18')](_0x2267cd)){if(_0x2267cd[_0x3c5b('0x5b')]>0x0){_0x2267cd[_0x3c5b('0x5b')]-=0x1;}else{logger[_0x3c5b('0xb')](_0x153a37,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x3c5b('0xb')](_0x153a37,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x3c5b('0x5c')]=function(_0x414251){if(_0x414251<=0x0){return!![];}return![];};exports['buildObj']=function(_0x3f05ea,_0x50982e){_0x3f05ea[_0x3c5b('0x5d')]=_0x50982e;_0x3f05ea[_0x3c5b('0x1a')]=_0x3f05ea['queue'];_0x3f05ea[_0x3c5b('0x5e')]=_0x3f05ea[_0x3c5b('0x4b')];return _0x3f05ea;};exports['buildAcw']=function(_0x190fae){var _0x28d62d={};_0x28d62d[_0x3c5b('0x5f')]=_0x190fae[_0x3c5b('0x5f')];_0x28d62d['interface']=_0x190fae[_0x3c5b('0x4b')];_0x28d62d[_0x3c5b('0x49')]=_0x190fae[_0x3c5b('0x49')];return _0x28d62d;};exports[_0x3c5b('0x60')]=function(_0x365b4d){var _0x46b647=[];for(var _0x4223d2 in _0x365b4d){if(_0x365b4d[_0x3c5b('0x2c')](_0x4223d2)){if(!_[_0x3c5b('0x18')](_0x365b4d[_0x4223d2])&&_0x365b4d[_0x4223d2][_0x3c5b('0x37')]==='not_inuse'&&_0x365b4d[_0x4223d2][_0x3c5b('0x61')]===_0x3c5b('0x62')){_0x46b647[_0x3c5b('0x63')](_0x365b4d[_0x4223d2]['id']);}}}return _0x46b647;};exports[_0x3c5b('0x64')]=function(_0x4b79f1){var _0x420ed0=moment()[_0x3c5b('0x65')](0x0);var _0x37aadb=moment(_0x4b79f1)[_0x3c5b('0x65')](0x0);return _0x420ed0[_0x3c5b('0x8')](_0x37aadb,_0x3c5b('0x9'));};exports[_0x3c5b('0x66')]=function(_0x1d6337){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1d6337[_0x3c5b('0x1d')],'ListId':_0x1d6337['ListId'],'VoiceQueueId':_0x1d6337['VoiceQueueId']||undefined,'CampaignId':_0x1d6337[_0x3c5b('0x67')]||undefined};};exports[_0x3c5b('0x68')]=function(_0x2e105e){if(_0x2e105e===_0x3c5b('0x49')||_0x2e105e===_0x3c5b('0x69')||_0x2e105e===_0x3c5b('0x5f')||_0x2e105e===_0x3c5b('0x6a')||_0x2e105e===_0x3c5b('0x6b')||_0x2e105e===_0x3c5b('0x6c')||_0x2e105e==='membername'||_0x2e105e===_0x3c5b('0x4b')||_0x2e105e===_0x3c5b('0x1b')||_0x2e105e==='active'||_0x2e105e==='calleridnum'||_0x2e105e===_0x3c5b('0x57')||_0x2e105e===_0x3c5b('0x4f')||_0x2e105e==='countcongestionretry'||_0x2e105e===_0x3c5b('0x51')||_0x2e105e===_0x3c5b('0x6d')||_0x2e105e===_0x3c5b('0x6e')||_0x2e105e==='callbackuniqueid'||_0x2e105e===_0x3c5b('0x6f')||_0x2e105e===_0x3c5b('0x70')||_0x2e105e===_0x3c5b('0x1d')||_0x2e105e==='ListId'||_0x2e105e===_0x3c5b('0x41')||_0x2e105e===_0x3c5b('0x1f')||_0x2e105e===_0x3c5b('0x71')||_0x2e105e===_0x3c5b('0x72')||_0x2e105e===_0x3c5b('0x73')||_0x2e105e===_0x3c5b('0x74')||_0x2e105e===_0x3c5b('0x75')||_0x2e105e==='xmd-dialurl'||_0x2e105e==='xmd-dialtimeout'||_0x2e105e==='xmd-dialoptions'||_0x2e105e===_0x3c5b('0x76')||_0x2e105e===_0x3c5b('0x77')||_0x2e105e===_0x3c5b('0x78')||_0x2e105e==='xmd-cdrtype'||_0x2e105e==='xmd-callerid'||_0x2e105e===_0x3c5b('0x79')||_0x2e105e===_0x3c5b('0x7a')||_0x2e105e===_0x3c5b('0x7b')||_0x2e105e===_0x3c5b('0x7c')||_0x2e105e===_0x3c5b('0x7d')||_0x2e105e==='rtpaudioqosjitterbridged'||_0x2e105e===_0x3c5b('0x7e')||_0x2e105e===_0x3c5b('0x7f')||_0x2e105e===_0x3c5b('0x80')||_0x2e105e===_0x3c5b('0x81')||_0x2e105e===_0x3c5b('0x7b')||_0x2e105e===_0x3c5b('0x7c')||_0x2e105e===_0x3c5b('0x7d')||_0x2e105e===_0x3c5b('0x82')||_0x2e105e===_0x3c5b('0x7e')||_0x2e105e===_0x3c5b('0x7f')||_0x2e105e==='rtpaudioqosrtt'||_0x2e105e===_0x3c5b('0x81')||_0x2e105e===_0x3c5b('0x83')||_0x2e105e==='bridgepvtcallid'||_0x2e105e==='state'||_0x2e105e===_0x3c5b('0x38')){return![];}return!![];};exports[_0x3c5b('0x84')]=function(_0x5bb775,_0x576da2){var _0x37a325,_0x4aa406,_0x2240e5;if(_0x576da2<=0x0){_0x576da2=0x1;}_0x37a325=new RegExp('\x5cw{0,'+_0x576da2+'}$');_0x4aa406=Math[_0x3c5b('0x85')](0xa,_0x576da2-0x1);_0x2240e5=Math[_0x3c5b('0x85')](0xa,_0x576da2)-0x1;return util['format']('%s',_[_0x3c5b('0x86')](_0x5bb775,_0x37a325,_[_0x3c5b('0x87')](_0x4aa406,_0x2240e5)));};exports[_0x3c5b('0x88')]=function(_0x441720){var _0x3fb875=_0x441720[_0x3c5b('0x89')](/"(.*?)"/);return _0x3fb875?_0x3fb875[0x1]:_0x441720;};exports[_0x3c5b('0x8a')]=function(_0x5d67cc){var _0x17c76c=_0x5d67cc[_0x3c5b('0x89')](/<(.*?)>/);return _0x17c76c?_0x17c76c[0x1]:_0x5d67cc;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 714ec3f..0d6bbd0 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x5b57ae,_0x31bac6){var _0x1877c2=function(_0x5c0bef){while(--_0x5c0bef){_0x5b57ae['push'](_0x5b57ae['shift']());}};_0x1877c2(++_0x31bac6);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c98c1,_0x524e3c){_0x3c98c1=_0x3c98c1-0x0;var _0x45c21b=_0xb10b[_0x3c98c1];return _0x45c21b;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x362fce,_0xd44c62){var _0x12c2b3=function(_0x1f6025){while(--_0x1f6025){_0x362fce['push'](_0x362fce['shift']());}};_0x12c2b3(++_0xd44c62);}(_0xb10b,0x12a));var _0xbb10=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0xb10b[_0x5302fb];return _0x43e6a4;};'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 3c3842b..8068d1d 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 _0xfd2d=['dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','SIP/%s','name','isNil','interface','hasOwnProperty','total','answered','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','sumHoldTime','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','mergeFromDatabase','initTelephones','initTrunks','isUndefined','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','zohoAccounts','initDeskAccounts','deskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerleaveAt','diff','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','seconds','queuecallercomplete','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd2d,0x15c));var _0xdfd2=function(_0x1d73ce,_0x499f7d){_0x1d73ce=_0x1d73ce-0x0;var _0x3be4f3=_0xfd2d[_0x1d73ce];return _0x3be4f3;};'use strict';var BPromise=require(_0xdfd2('0x0'));var util=require(_0xdfd2('0x1'));var _=require(_0xdfd2('0x2'));var moment=require(_0xdfd2('0x3'));var Agent=require(_0xdfd2('0x4'));var Telephone=require(_0xdfd2('0x5'));var Trunk=require(_0xdfd2('0x6'));var VoiceQueue=require(_0xdfd2('0x7'));var Trigger=require(_0xdfd2('0x8'));var Template=require(_0xdfd2('0x9'));var Campaign=require(_0xdfd2('0xa'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xdfd2('0xb'));var SalesforceAccount=require(_0xdfd2('0xc'));var FreshdeskAccount=require(_0xdfd2('0xd'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xdfd2('0xe'));var DeskAccount=require(_0xdfd2('0xf'));var VtigerAccount=require(_0xdfd2('0x10'));var ServicenowAccount=require(_0xdfd2('0x11'));var Dynamics365Account=require(_0xdfd2('0x12'));var FreshsalesAccount=require(_0xdfd2('0x13'));var FaxAccount=require(_0xdfd2('0x14'));var Realtime=function(){this[_0xdfd2('0x15')]={};this[_0xdfd2('0x16')]={};this[_0xdfd2('0x17')]={};this[_0xdfd2('0x18')]={};this[_0xdfd2('0x19')]={};this[_0xdfd2('0x1a')]={};this['templates']={};this[_0xdfd2('0x1b')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xdfd2('0x1c')]={};this[_0xdfd2('0x1d')]={};this[_0xdfd2('0x1e')]={};this[_0xdfd2('0x1f')]={};this[_0xdfd2('0x20')]={};this[_0xdfd2('0x21')]={};this[_0xdfd2('0x22')]={};this['sugarcrmAccounts']={};this[_0xdfd2('0x23')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xdfd2('0x24')]={};this[_0xdfd2('0x25')]={};this[_0xdfd2('0x26')]={};this['freshsalesAccounts']={};this[_0xdfd2('0x27')]={};};function freeIsNotKey(_0x4d6ec3,_0x55c4be,_0xa7198e){var _0x15d348=_[_0xdfd2('0x28')](_0x4d6ec3,function(_0x33ffdb,_0x50cffb){return _0x33ffdb[_0xa7198e];});for(var _0x8ec47a in _0x55c4be){if(_0x55c4be['hasOwnProperty'](_0x8ec47a)){if(!_0x15d348[_0x8ec47a]){delete _0x55c4be[_0x8ec47a];}}}}function freeIsNotKeySip(_0x534ea0,_0x1f6026){var _0x2a8a1d=_[_0xdfd2('0x28')](_0x534ea0,function(_0x340870,_0x49baa9){return util[_0xdfd2('0x29')](_0xdfd2('0x2a'),_0x340870[_0xdfd2('0x2b')]);});for(var _0x5b31d0 in _0x1f6026){if(_0x1f6026['hasOwnProperty'](_0x5b31d0)){if(!_0x2a8a1d[_0x5b31d0]){delete _0x1f6026[_0x5b31d0];}}}}function freeIsNotKeyAgent(_0x402e58,_0x4d64e8){var _0x2798bd=_[_0xdfd2('0x28')](_0x402e58,function(_0x31d525,_0x3e8892){var _0x17ab3a=_[_0xdfd2('0x2c')](_0x31d525[_0xdfd2('0x2d')])?util[_0xdfd2('0x29')](_0xdfd2('0x2a'),_0x31d525['name']):_0x31d525['interface'];return _0x17ab3a;});for(var _0x2ad498 in _0x4d64e8){if(_0x4d64e8[_0xdfd2('0x2e')](_0x2ad498)){if(!_0x2798bd[_0x2ad498]){delete _0x4d64e8[_0x2ad498];}}}}function clearVoiceCallReports(_0x4638cf){_0x4638cf[_0xdfd2('0x2f')]=0x0;_0x4638cf[_0xdfd2('0x30')]=0x0;_0x4638cf['sumHoldTime']=0x0;_0x4638cf['sumDuration']=0x0;_0x4638cf[_0xdfd2('0x31')]=0x0;}function clearCampaigns(_0x37451d){if(!_['isEmpty'](_0x37451d)){for(var _0x1f3617 in _0x37451d){if(_0x37451d[_0xdfd2('0x2e')](_0x1f3617)){_0x37451d[_0x1f3617][_0xdfd2('0x32')]=0x0;_0x37451d[_0x1f3617][_0xdfd2('0x33')]=0x0;}}}}function clearVoiceQueues(_0x2e2121){if(!_[_0xdfd2('0x34')](_0x2e2121)){for(var _0x295fbc in _0x2e2121){if(_0x2e2121[_0xdfd2('0x2e')](_0x295fbc)){_0x2e2121[_0x295fbc][_0xdfd2('0x2f')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x30')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x35')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x36')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x37')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x38')]=0x0;_0x2e2121[_0x295fbc]['sumBillable']=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x39')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x3a')]=0x0;_0x2e2121[_0x295fbc]['outboundBusyCallsDay']=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x3b')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x3c')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x3d')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x3e')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x3f')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x40')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x41')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x42')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x43')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x39')]=0x0;_0x2e2121[_0x295fbc]['outboundAnswerCallsDay']=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x44')]=!![];}}}}Realtime[_0xdfd2('0x45')]['mergeFromDatabase']=function(_0x557baf,_0x4edb58){for(var _0x490acc in _0x4edb58){if(_0x557baf[_0xdfd2('0x2e')](_0x490acc)){_0x557baf[_0x490acc]=_0x4edb58[_0x490acc];}}};Realtime[_0xdfd2('0x45')]['initAgents']=function(){var _0xffbdd8=this;return function(_0x36230b){if(_0x36230b){freeIsNotKeyAgent(_0x36230b,_0xffbdd8[_0xdfd2('0x15')]);for(var _0x3b925e=0x0,_0x180205={},_0x496645={};_0x3b925e<_0x36230b[_0xdfd2('0x46')];_0x3b925e+=0x1){_0x180205=_0x36230b[_0x3b925e];var _0x21f2e5=_[_0xdfd2('0x2c')](_0x180205[_0xdfd2('0x2d')])?util['format']('SIP/%s',_0x180205[_0xdfd2('0x2b')]):_0x180205[_0xdfd2('0x2d')];if(_['isUndefined'](_0xffbdd8['agents'][_0x21f2e5])){_0xffbdd8[_0xdfd2('0x15')][_0x21f2e5]=new Agent(_0x180205);}else{_0xffbdd8[_0xdfd2('0x47')](_0xffbdd8[_0xdfd2('0x15')][_0x21f2e5],_0x180205);}}}return _0xffbdd8[_0xdfd2('0x15')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x48')]=function(){var _0x30a7ee=this;return function(_0x3f131c){if(_0x3f131c){freeIsNotKeySip(_0x3f131c,_0x30a7ee[_0xdfd2('0x16')]);for(var _0xeac294=0x0,_0x5cf510={},_0x52afdf={};_0xeac294<_0x3f131c['length'];_0xeac294+=0x1){_0x5cf510=_0x3f131c[_0xeac294];if(_['isUndefined'](_0x30a7ee['telephones'][util['format'](_0xdfd2('0x2a'),_0x5cf510[_0xdfd2('0x2b')])])){_0x30a7ee[_0xdfd2('0x16')][util['format'](_0xdfd2('0x2a'),_0x5cf510[_0xdfd2('0x2b')])]=new Telephone(_0x5cf510);}else{_0x30a7ee[_0xdfd2('0x47')](_0x30a7ee[_0xdfd2('0x16')][util[_0xdfd2('0x29')](_0xdfd2('0x2a'),_0x5cf510['name'])],_0x5cf510);}}}return _0x30a7ee[_0xdfd2('0x16')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x49')]=function(){var _0x2fcad0=this;return function(_0x149645){if(_0x149645){freeIsNotKeySip(_0x149645,_0x2fcad0[_0xdfd2('0x17')]);for(var _0x5e7020=0x0,_0x286886={},_0x12efb2={};_0x5e7020<_0x149645[_0xdfd2('0x46')];_0x5e7020+=0x1){_0x286886=_0x149645[_0x5e7020];if(_[_0xdfd2('0x4a')](_0x2fcad0[_0xdfd2('0x17')][util[_0xdfd2('0x29')](_0xdfd2('0x2a'),_0x286886[_0xdfd2('0x2b')])])){_0x2fcad0[_0xdfd2('0x17')][util[_0xdfd2('0x29')](_0xdfd2('0x2a'),_0x286886[_0xdfd2('0x2b')])]=new Trunk(_0x286886);}else{_0x2fcad0[_0xdfd2('0x47')](_0x2fcad0[_0xdfd2('0x17')][util[_0xdfd2('0x29')](_0xdfd2('0x2a'),_0x286886[_0xdfd2('0x2b')])],_0x286886);}}}return _0x2fcad0[_0xdfd2('0x17')];};};Realtime[_0xdfd2('0x45')]['initVoiceQueues']=function(){var _0x1b24c7=this;return function(_0x6b7954){if(_0x6b7954){freeIsNotKey(_0x6b7954,_0x1b24c7[_0xdfd2('0x18')],'name');for(var _0x4822a0=0x0,_0x285dd0={},_0x5b57a4={};_0x4822a0<_0x6b7954[_0xdfd2('0x46')];_0x4822a0+=0x1){_0x285dd0=_0x6b7954[_0x4822a0];if(_['isUndefined'](_0x1b24c7[_0xdfd2('0x18')][_0x285dd0[_0xdfd2('0x2b')]])){_0x1b24c7['voiceQueues'][_0x285dd0[_0xdfd2('0x2b')]]=new VoiceQueue(_0x285dd0);}else{_0x1b24c7[_0xdfd2('0x47')](_0x1b24c7[_0xdfd2('0x18')][_0x285dd0[_0xdfd2('0x2b')]],_0x285dd0);}}}return _0x1b24c7['voiceQueues'];};};Realtime['prototype'][_0xdfd2('0x4b')]=function(){var _0x543e68=this;return function(_0x235402){if(_0x235402){freeIsNotKey(_0x235402,_0x543e68[_0xdfd2('0x19')],'id');for(var _0x9d60c=0x0,_0x647e73={},_0x1bba59={};_0x9d60c<_0x235402[_0xdfd2('0x46')];_0x9d60c+=0x1){_0x647e73=_0x235402[_0x9d60c];if(_[_0xdfd2('0x4a')](_0x543e68['triggers'][_0x647e73['id']])){_0x543e68[_0xdfd2('0x19')][_0x647e73['id']]=new Trigger(_0x647e73);}else{_0x543e68['mergeFromDatabase'](_0x543e68[_0xdfd2('0x19')][_0x647e73['id']],_0x647e73);}}}return _0x543e68[_0xdfd2('0x19')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x4c')]=function(){var _0x58ba58=this;return function(_0x2dcdcd){if(_0x2dcdcd){freeIsNotKey(_0x2dcdcd,_0x58ba58[_0xdfd2('0x4d')],'id');for(var _0xe977eb=0x0,_0x2f8871={},_0x27aae={};_0xe977eb<_0x2dcdcd[_0xdfd2('0x46')];_0xe977eb+=0x1){_0x2f8871=_0x2dcdcd[_0xe977eb];if(_[_0xdfd2('0x4a')](_0x58ba58[_0xdfd2('0x4d')][_0x2f8871['id']])){_0x58ba58[_0xdfd2('0x4d')][_0x2f8871['id']]=new Template(_0x2f8871);}else{_0x58ba58['mergeFromDatabase'](_0x58ba58['templates'][_0x2f8871['id']],_0x2f8871);}}}return _0x58ba58[_0xdfd2('0x4d')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x4e')]=function(){var _0xab00d5=this;return function(_0x369283){if(_0x369283){freeIsNotKey(_0x369283,_0xab00d5['zendeskAccounts'],'id');for(var _0xe71135=0x0,_0x1d7239={},_0xdbd7f={};_0xe71135<_0x369283['length'];_0xe71135+=0x1){_0x1d7239=_0x369283[_0xe71135];if(_['isUndefined'](_0xab00d5[_0xdfd2('0x21')][_0x1d7239['id']])){_0xab00d5[_0xdfd2('0x21')][_0x1d7239['id']]=new ZendeskAccount(_0x1d7239);}else{_0xab00d5[_0xdfd2('0x47')](_0xab00d5[_0xdfd2('0x21')][_0x1d7239['id']],_0x1d7239);}}}return _0xab00d5[_0xdfd2('0x21')];};};Realtime['prototype'][_0xdfd2('0x4f')]=function(){var _0xfdcb29=this;return function(_0x4b3772){if(_0x4b3772){freeIsNotKey(_0x4b3772,_0xfdcb29[_0xdfd2('0x22')],'id');for(var _0x56bafa=0x0,_0x599f50={},_0x159089={};_0x56bafa<_0x4b3772[_0xdfd2('0x46')];_0x56bafa+=0x1){_0x599f50=_0x4b3772[_0x56bafa];if(_[_0xdfd2('0x4a')](_0xfdcb29['salesforceAccounts'][_0x599f50['id']])){_0xfdcb29[_0xdfd2('0x22')][_0x599f50['id']]=new SalesforceAccount(_0x599f50);}else{_0xfdcb29['mergeFromDatabase'](_0xfdcb29[_0xdfd2('0x22')][_0x599f50['id']],_0x599f50);}}}return _0xfdcb29['salesforceAccounts'];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x50')]=function(){var _0x44c386=this;return function(_0x2f1590){if(_0x2f1590){freeIsNotKey(_0x2f1590,_0x44c386['freshdeskAccounts'],'id');for(var _0x3a8ae8=0x0,_0x412ce5={},_0x3beb16={};_0x3a8ae8<_0x2f1590[_0xdfd2('0x46')];_0x3a8ae8+=0x1){_0x412ce5=_0x2f1590[_0x3a8ae8];if(_[_0xdfd2('0x4a')](_0x44c386[_0xdfd2('0x23')][_0x412ce5['id']])){_0x44c386[_0xdfd2('0x23')][_0x412ce5['id']]=new FreshdeskAccount(_0x412ce5);}else{_0x44c386[_0xdfd2('0x47')](_0x44c386[_0xdfd2('0x23')][_0x412ce5['id']],_0x412ce5);}}}return _0x44c386[_0xdfd2('0x23')];};};Realtime[_0xdfd2('0x45')]['initZohoAccounts']=function(){var _0x5ccd4f=this;return function(_0x346993){if(_0x346993){freeIsNotKey(_0x346993,_0x5ccd4f[_0xdfd2('0x51')],'id');for(var _0xc5de43=0x0,_0x2654d0={},_0x5f5d4e={};_0xc5de43<_0x346993[_0xdfd2('0x46')];_0xc5de43+=0x1){_0x2654d0=_0x346993[_0xc5de43];if(_['isUndefined'](_0x5ccd4f['zohoAccounts'][_0x2654d0['id']])){_0x5ccd4f[_0xdfd2('0x51')][_0x2654d0['id']]=new ZohoAccount(_0x2654d0);}else{_0x5ccd4f[_0xdfd2('0x47')](_0x5ccd4f['zohoAccounts'][_0x2654d0['id']],_0x2654d0);}}}return _0x5ccd4f['zohoAccounts'];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x52')]=function(){var _0x2a5772=this;return function(_0x5d730a){if(_0x5d730a){freeIsNotKey(_0x5d730a,_0x2a5772[_0xdfd2('0x53')],'id');for(var _0xeb9083=0x0,_0x1cf1fb={},_0x14076b={};_0xeb9083<_0x5d730a[_0xdfd2('0x46')];_0xeb9083+=0x1){_0x1cf1fb=_0x5d730a[_0xeb9083];if(_[_0xdfd2('0x4a')](_0x2a5772[_0xdfd2('0x53')][_0x1cf1fb['id']])){_0x2a5772[_0xdfd2('0x53')][_0x1cf1fb['id']]=new DeskAccount(_0x1cf1fb);}else{_0x2a5772[_0xdfd2('0x47')](_0x2a5772[_0xdfd2('0x53')][_0x1cf1fb['id']],_0x1cf1fb);}}}return _0x2a5772[_0xdfd2('0x53')];};};Realtime[_0xdfd2('0x45')]['initSugarcrmAccounts']=function(){var _0x2fa757=this;return function(_0x5e6f59){if(_0x5e6f59){freeIsNotKey(_0x5e6f59,_0x2fa757[_0xdfd2('0x54')],'id');for(var _0x6c8f78=0x0,_0x153fef={},_0x498378={};_0x6c8f78<_0x5e6f59[_0xdfd2('0x46')];_0x6c8f78+=0x1){_0x153fef=_0x5e6f59[_0x6c8f78];if(_['isUndefined'](_0x2fa757[_0xdfd2('0x54')][_0x153fef['id']])){_0x2fa757[_0xdfd2('0x54')][_0x153fef['id']]=new SugarcrmAccount(_0x153fef);}else{_0x2fa757[_0xdfd2('0x47')](_0x2fa757[_0xdfd2('0x54')][_0x153fef['id']],_0x153fef);}}}return _0x2fa757['sugarcrmAccounts'];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x55')]=function(){var _0x34a15a=this;return function(_0x19d29e){if(_0x19d29e){freeIsNotKey(_0x19d29e,_0x34a15a[_0xdfd2('0x24')],'id');for(var _0x13cd7a=0x0,_0x52fd80={},_0x5344fc={};_0x13cd7a<_0x19d29e['length'];_0x13cd7a+=0x1){_0x52fd80=_0x19d29e[_0x13cd7a];if(_['isUndefined'](_0x34a15a[_0xdfd2('0x24')][_0x52fd80['id']])){_0x34a15a[_0xdfd2('0x24')][_0x52fd80['id']]=new VtigerAccount(_0x52fd80);}else{_0x34a15a[_0xdfd2('0x47')](_0x34a15a[_0xdfd2('0x24')][_0x52fd80['id']],_0x52fd80);}}}return _0x34a15a[_0xdfd2('0x24')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x56')]=function(){var _0x100437=this;return function(_0x3a0239){if(_0x3a0239){freeIsNotKey(_0x3a0239,_0x100437[_0xdfd2('0x25')],'id');for(var _0x256eb0=0x0,_0x1d7bfe={},_0x2c058d={};_0x256eb0<_0x3a0239[_0xdfd2('0x46')];_0x256eb0+=0x1){_0x1d7bfe=_0x3a0239[_0x256eb0];if(_[_0xdfd2('0x4a')](_0x100437[_0xdfd2('0x25')][_0x1d7bfe['id']])){_0x100437[_0xdfd2('0x25')][_0x1d7bfe['id']]=new ServicenowAccount(_0x1d7bfe);}else{_0x100437[_0xdfd2('0x47')](_0x100437[_0xdfd2('0x25')][_0x1d7bfe['id']],_0x1d7bfe);}}}return _0x100437[_0xdfd2('0x25')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x2ea4d7=this;return function(_0x350683){if(_0x350683){freeIsNotKey(_0x350683,_0x2ea4d7['dynamics365Accounts'],'id');for(var _0x82cbe2=0x0,_0x35932d={},_0x1d3587={};_0x82cbe2<_0x350683[_0xdfd2('0x46')];_0x82cbe2+=0x1){_0x35932d=_0x350683[_0x82cbe2];if(_[_0xdfd2('0x4a')](_0x2ea4d7['dynamics365Accounts'][_0x35932d['id']])){_0x2ea4d7['dynamics365Accounts'][_0x35932d['id']]=new Dynamics365Account(_0x35932d);}else{_0x2ea4d7[_0xdfd2('0x47')](_0x2ea4d7[_0xdfd2('0x26')][_0x35932d['id']],_0x35932d);}}}return _0x2ea4d7['dynamics365Accounts'];};};Realtime[_0xdfd2('0x45')]['initFreshsalesAccounts']=function(){var _0x5e45b3=this;return function(_0x5770ac){if(_0x5770ac){freeIsNotKey(_0x5770ac,_0x5e45b3[_0xdfd2('0x57')],'id');for(var _0x500a9d=0x0,_0x2d8a1d={},_0x7b2431={};_0x500a9d<_0x5770ac[_0xdfd2('0x46')];_0x500a9d+=0x1){_0x2d8a1d=_0x5770ac[_0x500a9d];if(_[_0xdfd2('0x4a')](_0x5e45b3[_0xdfd2('0x57')][_0x2d8a1d['id']])){_0x5e45b3[_0xdfd2('0x57')][_0x2d8a1d['id']]=new FreshsalesAccount(_0x2d8a1d);}else{_0x5e45b3['mergeFromDatabase'](_0x5e45b3[_0xdfd2('0x57')][_0x2d8a1d['id']],_0x2d8a1d);}}}return _0x5e45b3['freshsalesAccounts'];};};Realtime['prototype'][_0xdfd2('0x58')]=function(){var _0x2eba89=this;return function(_0x165d7b){for(var _0x591292=0x0;_0x591292<_0x165d7b[_0xdfd2('0x46')];_0x591292+=0x1){_[_0xdfd2('0x59')](_0x2eba89['voiceQueues'][_0x165d7b[_0x591292][_0xdfd2('0x2b')]],_0x165d7b[_0x591292]);}return _0x2eba89[_0xdfd2('0x18')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x5a')]=function(){var _0x18ae0f=this;return function(_0x1f7665){clearVoiceQueues(_0x18ae0f[_0xdfd2('0x18')]);if(_0x1f7665){_0x1f7665=_[_0xdfd2('0x5b')](_0x1f7665,'uniqueid');for(var _0x4d4f1d in _0x1f7665){if(_0x1f7665[_0xdfd2('0x2e')](_0x4d4f1d)){var _0x5710a0={};for(var _0x2d9382=0x0;_0x2d9382<_0x1f7665[_0x4d4f1d][_0xdfd2('0x46')];_0x2d9382+=0x1){var _0x8fe079=_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x5c')];if(_0x18ae0f[_0xdfd2('0x18')][_0x8fe079]){if(_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x5d')]){_0x18ae0f['voiceQueues'][_0x8fe079]['unmanaged']+=0x1;}if(_0x1f7665[_0x4d4f1d][_0x2d9382]['queuecallerabandon']){_0x18ae0f[_0xdfd2('0x18')][_0x8fe079][_0xdfd2('0x36')]+=0x1;}_0x18ae0f['voiceQueues'][_0x8fe079]['sumHoldTime']+=moment(_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x5e')])[_0xdfd2('0x5f')](moment(_0x1f7665[_0x4d4f1d][_0x2d9382]['queuecallerjoinAt']),'seconds')||0x0;if(_0x2d9382===_0x1f7665[_0x4d4f1d][_0xdfd2('0x46')]-0x1){_0x18ae0f[_0xdfd2('0x18')][_0x8fe079][_0xdfd2('0x38')]+=moment(_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x60')]||_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x61')]||_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x62')])['diff'](moment(_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x63')]),_0xdfd2('0x64'))||0x0;_0x18ae0f[_0xdfd2('0x18')][_0x8fe079][_0xdfd2('0x2f')]+=0x1;if(_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x65')]){_0x18ae0f[_0xdfd2('0x18')][_0x8fe079]['answered']+=0x1;_0x18ae0f['voiceQueues'][_0x8fe079]['sumBillable']+=moment(_0x1f7665[_0x4d4f1d][_0x2d9382]['queuecallercompleteAt'])[_0xdfd2('0x5f')](moment(_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x5e')]),_0xdfd2('0x64'))||0x0;}}else{_0x18ae0f[_0xdfd2('0x18')][_0x8fe079]['sumDuration']+=_0x18ae0f[_0xdfd2('0x18')][_0x8fe079]['sumHoldTime']||0x0;}}}}}}return _0x18ae0f['voiceQueues'];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x66')]=function(){var _0x19ffd9=this;return function(_0x269fb5){clearVoiceCallReports(_0x19ffd9['outbound']);if(_0x269fb5){for(var _0x26999f=0x0;_0x26999f<_0x269fb5[_0xdfd2('0x46')];_0x26999f+=0x1){_0x19ffd9[_0xdfd2('0x1b')][_0xdfd2('0x2f')]+=0x1;_0x19ffd9[_0xdfd2('0x1b')][_0xdfd2('0x38')]+=_0x269fb5[_0x26999f]['duration'];if(_0x269fb5[_0x26999f][_0xdfd2('0x67')]===_0xdfd2('0x68')){_0x19ffd9[_0xdfd2('0x1b')]['answered']+=0x1;_0x19ffd9[_0xdfd2('0x1b')]['sumHoldTime']+=_0x269fb5[_0x26999f][_0xdfd2('0x69')]-_0x269fb5[_0x26999f][_0xdfd2('0x6a')]||0x0;_0x19ffd9['outbound']['sumBillable']+=_0x269fb5[_0x26999f][_0xdfd2('0x6a')];}}}return _0x19ffd9['outbound'];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x6b')]=function(){var _0x3a833b=this;return function(_0x3873c5){if(_0x3873c5){freeIsNotKey(_0x3873c5,_0x3a833b['campaigns'],'name');for(var _0xddeb19=0x0,_0x20bdcc={};_0xddeb19<_0x3873c5[_0xdfd2('0x46')];_0xddeb19+=0x1){_0x20bdcc=_0x3873c5[_0xddeb19];if(_[_0xdfd2('0x4a')](_0x3a833b[_0xdfd2('0x1a')][_0x20bdcc['name']])){_0x3a833b[_0xdfd2('0x1a')][_0x20bdcc[_0xdfd2('0x2b')]]=new Campaign(_0x20bdcc);}else{_0x3a833b['mergeFromDatabase'](_0x3a833b[_0xdfd2('0x1a')][_0x20bdcc[_0xdfd2('0x2b')]],_0x20bdcc);_0x3a833b[_0xdfd2('0x1a')][_0x20bdcc[_0xdfd2('0x2b')]][_0xdfd2('0x6c')]=_0x20bdcc[_0xdfd2('0x6d')]?_0x20bdcc[_0xdfd2('0x6d')][_0xdfd2('0x2b')]:undefined;}}}return _0x3a833b[_0xdfd2('0x1a')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x6e')]=function(){var _0x1c79ab=this;return function(_0x3f20bf){if(_0x3f20bf){freeIsNotKey(_0x3f20bf,_0x1c79ab[_0xdfd2('0x1c')],'id');for(var _0x787002=0x0,_0x29bd45={};_0x787002<_0x3f20bf[_0xdfd2('0x46')];_0x787002+=0x1){_0x29bd45=_0x3f20bf[_0x787002];if(_['isUndefined'](_0x1c79ab[_0xdfd2('0x1c')][_0x29bd45['id']])){_0x1c79ab[_0xdfd2('0x1c')][_0x29bd45['id']]=new VoiceExtension(_0x29bd45);}else{_0x1c79ab[_0xdfd2('0x47')](_0x1c79ab[_0xdfd2('0x1c')][_0x29bd45['id']],_0x29bd45);}}}return _0x1c79ab[_0xdfd2('0x1c')];};};Realtime['prototype'][_0xdfd2('0x6f')]=function(){var _0x5b5338=this;return function(_0x3ffc5a){clearCampaigns(_0x5b5338[_0xdfd2('0x1a')]);for(var _0x3b3585=0x0;_0x3b3585<_0x3ffc5a[_0xdfd2('0x46')];_0x3b3585+=0x1){_[_0xdfd2('0x59')](_0x5b5338[_0xdfd2('0x1a')][_0x3ffc5a[_0x3b3585]['name']],_0x3ffc5a[_0x3b3585]);}return _0x5b5338['campaigns'];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x70')]=function(){var _0x49ac15=this;return function(_0x53cf57){if(_0x53cf57){freeIsNotKey(_0x53cf57,_0x49ac15[_0xdfd2('0x27')],'id');for(var _0x49686e=0x0,_0x5b317c={},_0x16f4b9={};_0x49686e<_0x53cf57['length'];_0x49686e+=0x1){_0x5b317c=_0x53cf57[_0x49686e];if(_['isUndefined'](_0x49ac15[_0xdfd2('0x27')][_0x5b317c['id']])){_0x49ac15[_0xdfd2('0x27')][_0x5b317c['id']]=new FaxAccount(_0x5b317c);}else{_0x49ac15[_0xdfd2('0x47')](_0x49ac15[_0xdfd2('0x27')][_0x5b317c['id']],_0x5b317c);}}}return _0x49ac15[_0xdfd2('0x27')];};};module[_0xdfd2('0x71')]=Realtime; \ No newline at end of file +var _0x4a8c=['../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','outbound','channels','outboundChannels','timers','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','hasOwnProperty','isNil','interface','name','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','zendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','sugarcrmAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount'];(function(_0x222c72,_0x496c56){var _0xebdd9b=function(_0x2228f0){while(--_0x2228f0){_0x222c72['push'](_0x222c72['shift']());}};_0xebdd9b(++_0x496c56);}(_0x4a8c,0x12f));var _0xc4a8=function(_0x3afd17,_0x1afe7b){_0x3afd17=_0x3afd17-0x0;var _0x5e6a06=_0x4a8c[_0x3afd17];return _0x5e6a06;};'use strict';var BPromise=require(_0xc4a8('0x0'));var util=require(_0xc4a8('0x1'));var _=require(_0xc4a8('0x2'));var moment=require('moment');var Agent=require(_0xc4a8('0x3'));var Telephone=require(_0xc4a8('0x4'));var Trunk=require(_0xc4a8('0x5'));var VoiceQueue=require(_0xc4a8('0x6'));var Trigger=require(_0xc4a8('0x7'));var Template=require(_0xc4a8('0x8'));var Campaign=require(_0xc4a8('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xc4a8('0xa'));var SugarcrmAccount=require(_0xc4a8('0xb'));var ZohoAccount=require(_0xc4a8('0xc'));var DeskAccount=require(_0xc4a8('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xc4a8('0xe'));var Dynamics365Account=require(_0xc4a8('0xf'));var FreshsalesAccount=require(_0xc4a8('0x10'));var FaxAccount=require(_0xc4a8('0x11'));var Realtime=function(){this[_0xc4a8('0x12')]={};this[_0xc4a8('0x13')]={};this[_0xc4a8('0x14')]={};this['voiceQueues']={};this[_0xc4a8('0x15')]={};this[_0xc4a8('0x16')]={};this[_0xc4a8('0x17')]={};this[_0xc4a8('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xc4a8('0x19')]={};this['queueChannels']={};this[_0xc4a8('0x1a')]={};this[_0xc4a8('0x1b')]={};this['zendeskAccounts']={};this[_0xc4a8('0x1c')]={};this['sugarcrmAccounts']={};this[_0xc4a8('0x1d')]={};this[_0xc4a8('0x1e')]={};this[_0xc4a8('0x1f')]={};this[_0xc4a8('0x20')]={};this['servicenowAccounts']={};this[_0xc4a8('0x21')]={};this[_0xc4a8('0x22')]={};this[_0xc4a8('0x23')]={};};function freeIsNotKey(_0x1bccdd,_0x383f4f,_0x1f5e25){var _0x177afa=_[_0xc4a8('0x24')](_0x1bccdd,function(_0x2a6ff5,_0x26dee1){return _0x2a6ff5[_0x1f5e25];});for(var _0x39dd00 in _0x383f4f){if(_0x383f4f['hasOwnProperty'](_0x39dd00)){if(!_0x177afa[_0x39dd00]){delete _0x383f4f[_0x39dd00];}}}}function freeIsNotKeySip(_0x2d1660,_0x22d790){var _0xe218b1=_[_0xc4a8('0x24')](_0x2d1660,function(_0x26d1d0,_0x3e0744){return util[_0xc4a8('0x25')](_0xc4a8('0x26'),_0x26d1d0['name']);});for(var _0x3f2aa3 in _0x22d790){if(_0x22d790[_0xc4a8('0x27')](_0x3f2aa3)){if(!_0xe218b1[_0x3f2aa3]){delete _0x22d790[_0x3f2aa3];}}}}function freeIsNotKeyAgent(_0x2bf273,_0x57617e){var _0x855e25=_[_0xc4a8('0x24')](_0x2bf273,function(_0x28ec8b,_0x453d68){var _0x78b002=_[_0xc4a8('0x28')](_0x28ec8b[_0xc4a8('0x29')])?util[_0xc4a8('0x25')]('SIP/%s',_0x28ec8b[_0xc4a8('0x2a')]):_0x28ec8b[_0xc4a8('0x29')];return _0x78b002;});for(var _0x3a4fd9 in _0x57617e){if(_0x57617e[_0xc4a8('0x27')](_0x3a4fd9)){if(!_0x855e25[_0x3a4fd9]){delete _0x57617e[_0x3a4fd9];}}}}function clearVoiceCallReports(_0x19d959){_0x19d959[_0xc4a8('0x2b')]=0x0;_0x19d959[_0xc4a8('0x2c')]=0x0;_0x19d959[_0xc4a8('0x2d')]=0x0;_0x19d959[_0xc4a8('0x2e')]=0x0;_0x19d959[_0xc4a8('0x2f')]=0x0;}function clearCampaigns(_0x209b6a){if(!_[_0xc4a8('0x30')](_0x209b6a)){for(var _0x17e7f4 in _0x209b6a){if(_0x209b6a['hasOwnProperty'](_0x17e7f4)){_0x209b6a[_0x17e7f4]['ivrTotalCallsDays']=0x0;_0x209b6a[_0x17e7f4][_0xc4a8('0x31')]=0x0;}}}}function clearVoiceQueues(_0x291571){if(!_[_0xc4a8('0x30')](_0x291571)){for(var _0xf50ec2 in _0x291571){if(_0x291571[_0xc4a8('0x27')](_0xf50ec2)){_0x291571[_0xf50ec2][_0xc4a8('0x2b')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x2c')]=0x0;_0x291571[_0xf50ec2]['unmanaged']=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x32')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x2d')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x2e')]=0x0;_0x291571[_0xf50ec2]['sumBillable']=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x33')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x34')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x35')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x36')]=0x0;_0x291571[_0xf50ec2]['outboundNoSuchCallsDay']=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x37')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x38')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x39')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x3a')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x3b')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x3c')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x3d')]=0x0;_0x291571[_0xf50ec2]['outboundAnswerAgiCallsDay']=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x3e')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x3f')]=!![];}}}}Realtime['prototype'][_0xc4a8('0x40')]=function(_0xdf7386,_0x553f1d){for(var _0x5868a3 in _0x553f1d){if(_0xdf7386[_0xc4a8('0x27')](_0x5868a3)){_0xdf7386[_0x5868a3]=_0x553f1d[_0x5868a3];}}};Realtime[_0xc4a8('0x41')][_0xc4a8('0x42')]=function(){var _0x2baa4c=this;return function(_0x380f16){if(_0x380f16){freeIsNotKeyAgent(_0x380f16,_0x2baa4c['agents']);for(var _0x1f9715=0x0,_0x4e28dc={},_0x26d2b0={};_0x1f9715<_0x380f16[_0xc4a8('0x43')];_0x1f9715+=0x1){_0x4e28dc=_0x380f16[_0x1f9715];var _0x14e364=_[_0xc4a8('0x28')](_0x4e28dc[_0xc4a8('0x29')])?util['format'](_0xc4a8('0x26'),_0x4e28dc[_0xc4a8('0x2a')]):_0x4e28dc[_0xc4a8('0x29')];if(_[_0xc4a8('0x44')](_0x2baa4c[_0xc4a8('0x12')][_0x14e364])){_0x2baa4c[_0xc4a8('0x12')][_0x14e364]=new Agent(_0x4e28dc);}else{_0x2baa4c[_0xc4a8('0x40')](_0x2baa4c[_0xc4a8('0x12')][_0x14e364],_0x4e28dc);}}}return _0x2baa4c[_0xc4a8('0x12')];};};Realtime['prototype'][_0xc4a8('0x45')]=function(){var _0x1d2cbc=this;return function(_0xf32ad0){if(_0xf32ad0){freeIsNotKeySip(_0xf32ad0,_0x1d2cbc[_0xc4a8('0x13')]);for(var _0x392549=0x0,_0x193dec={},_0x16d883={};_0x392549<_0xf32ad0[_0xc4a8('0x43')];_0x392549+=0x1){_0x193dec=_0xf32ad0[_0x392549];if(_['isUndefined'](_0x1d2cbc[_0xc4a8('0x13')][util[_0xc4a8('0x25')](_0xc4a8('0x26'),_0x193dec[_0xc4a8('0x2a')])])){_0x1d2cbc['telephones'][util[_0xc4a8('0x25')]('SIP/%s',_0x193dec[_0xc4a8('0x2a')])]=new Telephone(_0x193dec);}else{_0x1d2cbc[_0xc4a8('0x40')](_0x1d2cbc['telephones'][util[_0xc4a8('0x25')]('SIP/%s',_0x193dec[_0xc4a8('0x2a')])],_0x193dec);}}}return _0x1d2cbc[_0xc4a8('0x13')];};};Realtime['prototype'][_0xc4a8('0x46')]=function(){var _0x12dee4=this;return function(_0x4b8eb1){if(_0x4b8eb1){freeIsNotKeySip(_0x4b8eb1,_0x12dee4['trunks']);for(var _0x7f7b21=0x0,_0x16505e={},_0x5e9073={};_0x7f7b21<_0x4b8eb1[_0xc4a8('0x43')];_0x7f7b21+=0x1){_0x16505e=_0x4b8eb1[_0x7f7b21];if(_[_0xc4a8('0x44')](_0x12dee4['trunks'][util['format'](_0xc4a8('0x26'),_0x16505e[_0xc4a8('0x2a')])])){_0x12dee4[_0xc4a8('0x14')][util[_0xc4a8('0x25')]('SIP/%s',_0x16505e['name'])]=new Trunk(_0x16505e);}else{_0x12dee4[_0xc4a8('0x40')](_0x12dee4[_0xc4a8('0x14')][util[_0xc4a8('0x25')](_0xc4a8('0x26'),_0x16505e[_0xc4a8('0x2a')])],_0x16505e);}}}return _0x12dee4[_0xc4a8('0x14')];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x47')]=function(){var _0x2f60a9=this;return function(_0xd55257){if(_0xd55257){freeIsNotKey(_0xd55257,_0x2f60a9['voiceQueues'],_0xc4a8('0x2a'));for(var _0x4a5e2c=0x0,_0x175242={},_0x5b3382={};_0x4a5e2c<_0xd55257[_0xc4a8('0x43')];_0x4a5e2c+=0x1){_0x175242=_0xd55257[_0x4a5e2c];if(_['isUndefined'](_0x2f60a9[_0xc4a8('0x48')][_0x175242['name']])){_0x2f60a9['voiceQueues'][_0x175242[_0xc4a8('0x2a')]]=new VoiceQueue(_0x175242);}else{_0x2f60a9[_0xc4a8('0x40')](_0x2f60a9[_0xc4a8('0x48')][_0x175242[_0xc4a8('0x2a')]],_0x175242);}}}return _0x2f60a9['voiceQueues'];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x49')]=function(){var _0x2b2d92=this;return function(_0x441988){if(_0x441988){freeIsNotKey(_0x441988,_0x2b2d92[_0xc4a8('0x15')],'id');for(var _0x53c4ba=0x0,_0x19a39e={},_0x55cdb6={};_0x53c4ba<_0x441988[_0xc4a8('0x43')];_0x53c4ba+=0x1){_0x19a39e=_0x441988[_0x53c4ba];if(_[_0xc4a8('0x44')](_0x2b2d92[_0xc4a8('0x15')][_0x19a39e['id']])){_0x2b2d92[_0xc4a8('0x15')][_0x19a39e['id']]=new Trigger(_0x19a39e);}else{_0x2b2d92[_0xc4a8('0x40')](_0x2b2d92[_0xc4a8('0x15')][_0x19a39e['id']],_0x19a39e);}}}return _0x2b2d92[_0xc4a8('0x15')];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x4a')]=function(){var _0x59dd9c=this;return function(_0x40f280){if(_0x40f280){freeIsNotKey(_0x40f280,_0x59dd9c['templates'],'id');for(var _0x4024f7=0x0,_0x52bfe0={},_0x28d5be={};_0x4024f7<_0x40f280[_0xc4a8('0x43')];_0x4024f7+=0x1){_0x52bfe0=_0x40f280[_0x4024f7];if(_[_0xc4a8('0x44')](_0x59dd9c[_0xc4a8('0x17')][_0x52bfe0['id']])){_0x59dd9c['templates'][_0x52bfe0['id']]=new Template(_0x52bfe0);}else{_0x59dd9c[_0xc4a8('0x40')](_0x59dd9c[_0xc4a8('0x17')][_0x52bfe0['id']],_0x52bfe0);}}}return _0x59dd9c[_0xc4a8('0x17')];};};Realtime[_0xc4a8('0x41')]['initZendeskAccounts']=function(){var _0x2908ce=this;return function(_0x5575c0){if(_0x5575c0){freeIsNotKey(_0x5575c0,_0x2908ce[_0xc4a8('0x4b')],'id');for(var _0x4d83d6=0x0,_0x28408d={},_0x562abe={};_0x4d83d6<_0x5575c0[_0xc4a8('0x43')];_0x4d83d6+=0x1){_0x28408d=_0x5575c0[_0x4d83d6];if(_[_0xc4a8('0x44')](_0x2908ce[_0xc4a8('0x4b')][_0x28408d['id']])){_0x2908ce[_0xc4a8('0x4b')][_0x28408d['id']]=new ZendeskAccount(_0x28408d);}else{_0x2908ce[_0xc4a8('0x40')](_0x2908ce[_0xc4a8('0x4b')][_0x28408d['id']],_0x28408d);}}}return _0x2908ce[_0xc4a8('0x4b')];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x4c')]=function(){var _0xa31ee0=this;return function(_0x2b694e){if(_0x2b694e){freeIsNotKey(_0x2b694e,_0xa31ee0[_0xc4a8('0x1c')],'id');for(var _0x6cba4f=0x0,_0x22d41a={},_0x15b856={};_0x6cba4f<_0x2b694e['length'];_0x6cba4f+=0x1){_0x22d41a=_0x2b694e[_0x6cba4f];if(_[_0xc4a8('0x44')](_0xa31ee0[_0xc4a8('0x1c')][_0x22d41a['id']])){_0xa31ee0[_0xc4a8('0x1c')][_0x22d41a['id']]=new SalesforceAccount(_0x22d41a);}else{_0xa31ee0[_0xc4a8('0x40')](_0xa31ee0[_0xc4a8('0x1c')][_0x22d41a['id']],_0x22d41a);}}}return _0xa31ee0['salesforceAccounts'];};};Realtime[_0xc4a8('0x41')]['initFreshdeskAccounts']=function(){var _0x2b4fab=this;return function(_0x1b974c){if(_0x1b974c){freeIsNotKey(_0x1b974c,_0x2b4fab[_0xc4a8('0x1d')],'id');for(var _0x4a5cc0=0x0,_0x4d4c9c={},_0x77e227={};_0x4a5cc0<_0x1b974c[_0xc4a8('0x43')];_0x4a5cc0+=0x1){_0x4d4c9c=_0x1b974c[_0x4a5cc0];if(_[_0xc4a8('0x44')](_0x2b4fab[_0xc4a8('0x1d')][_0x4d4c9c['id']])){_0x2b4fab[_0xc4a8('0x1d')][_0x4d4c9c['id']]=new FreshdeskAccount(_0x4d4c9c);}else{_0x2b4fab[_0xc4a8('0x40')](_0x2b4fab[_0xc4a8('0x1d')][_0x4d4c9c['id']],_0x4d4c9c);}}}return _0x2b4fab[_0xc4a8('0x1d')];};};Realtime[_0xc4a8('0x41')]['initZohoAccounts']=function(){var _0x2b2a6e=this;return function(_0x29473c){if(_0x29473c){freeIsNotKey(_0x29473c,_0x2b2a6e['zohoAccounts'],'id');for(var _0x490fab=0x0,_0x1d1891={},_0x1db670={};_0x490fab<_0x29473c[_0xc4a8('0x43')];_0x490fab+=0x1){_0x1d1891=_0x29473c[_0x490fab];if(_[_0xc4a8('0x44')](_0x2b2a6e[_0xc4a8('0x1e')][_0x1d1891['id']])){_0x2b2a6e[_0xc4a8('0x1e')][_0x1d1891['id']]=new ZohoAccount(_0x1d1891);}else{_0x2b2a6e['mergeFromDatabase'](_0x2b2a6e[_0xc4a8('0x1e')][_0x1d1891['id']],_0x1d1891);}}}return _0x2b2a6e[_0xc4a8('0x1e')];};};Realtime[_0xc4a8('0x41')]['initDeskAccounts']=function(){var _0x375e4c=this;return function(_0x2bc420){if(_0x2bc420){freeIsNotKey(_0x2bc420,_0x375e4c[_0xc4a8('0x1f')],'id');for(var _0x1f4441=0x0,_0xc01881={},_0x402d23={};_0x1f4441<_0x2bc420[_0xc4a8('0x43')];_0x1f4441+=0x1){_0xc01881=_0x2bc420[_0x1f4441];if(_[_0xc4a8('0x44')](_0x375e4c['deskAccounts'][_0xc01881['id']])){_0x375e4c[_0xc4a8('0x1f')][_0xc01881['id']]=new DeskAccount(_0xc01881);}else{_0x375e4c[_0xc4a8('0x40')](_0x375e4c[_0xc4a8('0x1f')][_0xc01881['id']],_0xc01881);}}}return _0x375e4c[_0xc4a8('0x1f')];};};Realtime['prototype'][_0xc4a8('0x4d')]=function(){var _0x239318=this;return function(_0x166f65){if(_0x166f65){freeIsNotKey(_0x166f65,_0x239318[_0xc4a8('0x4e')],'id');for(var _0x5e3091=0x0,_0x53ea9a={},_0x400d2e={};_0x5e3091<_0x166f65[_0xc4a8('0x43')];_0x5e3091+=0x1){_0x53ea9a=_0x166f65[_0x5e3091];if(_['isUndefined'](_0x239318['sugarcrmAccounts'][_0x53ea9a['id']])){_0x239318[_0xc4a8('0x4e')][_0x53ea9a['id']]=new SugarcrmAccount(_0x53ea9a);}else{_0x239318[_0xc4a8('0x40')](_0x239318[_0xc4a8('0x4e')][_0x53ea9a['id']],_0x53ea9a);}}}return _0x239318['sugarcrmAccounts'];};};Realtime[_0xc4a8('0x41')]['initVtigerAccounts']=function(){var _0x937976=this;return function(_0x4ba114){if(_0x4ba114){freeIsNotKey(_0x4ba114,_0x937976[_0xc4a8('0x20')],'id');for(var _0x674c72=0x0,_0x3fe2a8={},_0x1f28f8={};_0x674c72<_0x4ba114[_0xc4a8('0x43')];_0x674c72+=0x1){_0x3fe2a8=_0x4ba114[_0x674c72];if(_[_0xc4a8('0x44')](_0x937976[_0xc4a8('0x20')][_0x3fe2a8['id']])){_0x937976['vtigerAccounts'][_0x3fe2a8['id']]=new VtigerAccount(_0x3fe2a8);}else{_0x937976[_0xc4a8('0x40')](_0x937976['vtigerAccounts'][_0x3fe2a8['id']],_0x3fe2a8);}}}return _0x937976['vtigerAccounts'];};};Realtime[_0xc4a8('0x41')]['initServicenowAccounts']=function(){var _0x54f004=this;return function(_0x5badd1){if(_0x5badd1){freeIsNotKey(_0x5badd1,_0x54f004[_0xc4a8('0x4f')],'id');for(var _0xc00298=0x0,_0x4c162b={},_0x1c4bb6={};_0xc00298<_0x5badd1[_0xc4a8('0x43')];_0xc00298+=0x1){_0x4c162b=_0x5badd1[_0xc00298];if(_[_0xc4a8('0x44')](_0x54f004['servicenowAccounts'][_0x4c162b['id']])){_0x54f004[_0xc4a8('0x4f')][_0x4c162b['id']]=new ServicenowAccount(_0x4c162b);}else{_0x54f004['mergeFromDatabase'](_0x54f004[_0xc4a8('0x4f')][_0x4c162b['id']],_0x4c162b);}}}return _0x54f004['servicenowAccounts'];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x50')]=function(){var _0x2201f1=this;return function(_0x5db2ff){if(_0x5db2ff){freeIsNotKey(_0x5db2ff,_0x2201f1['dynamics365Accounts'],'id');for(var _0x13271b=0x0,_0x3f86a5={},_0x10d616={};_0x13271b<_0x5db2ff[_0xc4a8('0x43')];_0x13271b+=0x1){_0x3f86a5=_0x5db2ff[_0x13271b];if(_[_0xc4a8('0x44')](_0x2201f1['dynamics365Accounts'][_0x3f86a5['id']])){_0x2201f1[_0xc4a8('0x21')][_0x3f86a5['id']]=new Dynamics365Account(_0x3f86a5);}else{_0x2201f1[_0xc4a8('0x40')](_0x2201f1[_0xc4a8('0x21')][_0x3f86a5['id']],_0x3f86a5);}}}return _0x2201f1[_0xc4a8('0x21')];};};Realtime['prototype'][_0xc4a8('0x51')]=function(){var _0x936807=this;return function(_0x15f3fa){if(_0x15f3fa){freeIsNotKey(_0x15f3fa,_0x936807['freshsalesAccounts'],'id');for(var _0x1db054=0x0,_0x232e9d={},_0x20d3d1={};_0x1db054<_0x15f3fa['length'];_0x1db054+=0x1){_0x232e9d=_0x15f3fa[_0x1db054];if(_[_0xc4a8('0x44')](_0x936807[_0xc4a8('0x22')][_0x232e9d['id']])){_0x936807['freshsalesAccounts'][_0x232e9d['id']]=new FreshsalesAccount(_0x232e9d);}else{_0x936807[_0xc4a8('0x40')](_0x936807[_0xc4a8('0x22')][_0x232e9d['id']],_0x232e9d);}}}return _0x936807[_0xc4a8('0x22')];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x52')]=function(){var _0x3c553f=this;return function(_0x341fa3){for(var _0x41451f=0x0;_0x41451f<_0x341fa3['length'];_0x41451f+=0x1){_[_0xc4a8('0x53')](_0x3c553f['voiceQueues'][_0x341fa3[_0x41451f][_0xc4a8('0x2a')]],_0x341fa3[_0x41451f]);}return _0x3c553f[_0xc4a8('0x48')];};};Realtime[_0xc4a8('0x41')]['initVoiceQueueReports']=function(){var _0x2597e5=this;return function(_0xed5ead){clearVoiceQueues(_0x2597e5[_0xc4a8('0x48')]);if(_0xed5ead){_0xed5ead=_[_0xc4a8('0x54')](_0xed5ead,'uniqueid');for(var _0x13230c in _0xed5ead){if(_0xed5ead['hasOwnProperty'](_0x13230c)){var _0x5f442d={};for(var _0x32cdae=0x0;_0x32cdae<_0xed5ead[_0x13230c][_0xc4a8('0x43')];_0x32cdae+=0x1){var _0x27b43a=_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x55')];if(_0x2597e5['voiceQueues'][_0x27b43a]){if(_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x56')]){_0x2597e5[_0xc4a8('0x48')][_0x27b43a][_0xc4a8('0x57')]+=0x1;}if(_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x58')]){_0x2597e5[_0xc4a8('0x48')][_0x27b43a][_0xc4a8('0x32')]+=0x1;}_0x2597e5['voiceQueues'][_0x27b43a]['sumHoldTime']+=moment(_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x59')])[_0xc4a8('0x5a')](moment(_0xed5ead[_0x13230c][_0x32cdae]['queuecallerjoinAt']),_0xc4a8('0x5b'))||0x0;if(_0x32cdae===_0xed5ead[_0x13230c][_0xc4a8('0x43')]-0x1){_0x2597e5[_0xc4a8('0x48')][_0x27b43a][_0xc4a8('0x2e')]+=moment(_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x5c')]||_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x5d')]||_0xed5ead[_0x13230c][_0x32cdae]['queuecallerexitAt'])[_0xc4a8('0x5a')](moment(_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x5e')]),'seconds')||0x0;_0x2597e5['voiceQueues'][_0x27b43a]['total']+=0x1;if(_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x5f')]){_0x2597e5[_0xc4a8('0x48')][_0x27b43a][_0xc4a8('0x2c')]+=0x1;_0x2597e5['voiceQueues'][_0x27b43a][_0xc4a8('0x2f')]+=moment(_0xed5ead[_0x13230c][_0x32cdae]['queuecallercompleteAt'])[_0xc4a8('0x5a')](moment(_0xed5ead[_0x13230c][_0x32cdae]['queuecallerleaveAt']),_0xc4a8('0x5b'))||0x0;}}else{_0x2597e5['voiceQueues'][_0x27b43a][_0xc4a8('0x2e')]+=_0x2597e5[_0xc4a8('0x48')][_0x27b43a][_0xc4a8('0x2d')]||0x0;}}}}}}return _0x2597e5['voiceQueues'];};};Realtime['prototype'][_0xc4a8('0x60')]=function(){var _0x49d56a=this;return function(_0x4abc88){clearVoiceCallReports(_0x49d56a['outbound']);if(_0x4abc88){for(var _0x1d84e1=0x0;_0x1d84e1<_0x4abc88[_0xc4a8('0x43')];_0x1d84e1+=0x1){_0x49d56a[_0xc4a8('0x18')][_0xc4a8('0x2b')]+=0x1;_0x49d56a['outbound'][_0xc4a8('0x2e')]+=_0x4abc88[_0x1d84e1][_0xc4a8('0x61')];if(_0x4abc88[_0x1d84e1][_0xc4a8('0x62')]==='ANSWERED'){_0x49d56a[_0xc4a8('0x18')][_0xc4a8('0x2c')]+=0x1;_0x49d56a[_0xc4a8('0x18')][_0xc4a8('0x2d')]+=_0x4abc88[_0x1d84e1]['duration']-_0x4abc88[_0x1d84e1][_0xc4a8('0x63')]||0x0;_0x49d56a[_0xc4a8('0x18')][_0xc4a8('0x2f')]+=_0x4abc88[_0x1d84e1][_0xc4a8('0x63')];}}}return _0x49d56a[_0xc4a8('0x18')];};};Realtime[_0xc4a8('0x41')]['initCampaigns']=function(){var _0x529fe5=this;return function(_0x478a9e){if(_0x478a9e){freeIsNotKey(_0x478a9e,_0x529fe5[_0xc4a8('0x16')],_0xc4a8('0x2a'));for(var _0x40a5c3=0x0,_0x55fd2b={};_0x40a5c3<_0x478a9e[_0xc4a8('0x43')];_0x40a5c3+=0x1){_0x55fd2b=_0x478a9e[_0x40a5c3];if(_[_0xc4a8('0x44')](_0x529fe5[_0xc4a8('0x16')][_0x55fd2b[_0xc4a8('0x2a')]])){_0x529fe5[_0xc4a8('0x16')][_0x55fd2b['name']]=new Campaign(_0x55fd2b);}else{_0x529fe5[_0xc4a8('0x40')](_0x529fe5['campaigns'][_0x55fd2b[_0xc4a8('0x2a')]],_0x55fd2b);_0x529fe5[_0xc4a8('0x16')][_0x55fd2b[_0xc4a8('0x2a')]][_0xc4a8('0x64')]=_0x55fd2b[_0xc4a8('0x65')]?_0x55fd2b[_0xc4a8('0x65')][_0xc4a8('0x2a')]:undefined;}}}return _0x529fe5[_0xc4a8('0x16')];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x66')]=function(){var _0x507b73=this;return function(_0x40c240){if(_0x40c240){freeIsNotKey(_0x40c240,_0x507b73[_0xc4a8('0x67')],'id');for(var _0x16bcdf=0x0,_0x7b375={};_0x16bcdf<_0x40c240[_0xc4a8('0x43')];_0x16bcdf+=0x1){_0x7b375=_0x40c240[_0x16bcdf];if(_['isUndefined'](_0x507b73[_0xc4a8('0x67')][_0x7b375['id']])){_0x507b73[_0xc4a8('0x67')][_0x7b375['id']]=new VoiceExtension(_0x7b375);}else{_0x507b73[_0xc4a8('0x40')](_0x507b73[_0xc4a8('0x67')][_0x7b375['id']],_0x7b375);}}}return _0x507b73['voiceExtensions'];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x68')]=function(){var _0x4d9736=this;return function(_0x23ba0b){clearCampaigns(_0x4d9736[_0xc4a8('0x16')]);for(var _0x1d92b7=0x0;_0x1d92b7<_0x23ba0b['length'];_0x1d92b7+=0x1){_[_0xc4a8('0x53')](_0x4d9736[_0xc4a8('0x16')][_0x23ba0b[_0x1d92b7][_0xc4a8('0x2a')]],_0x23ba0b[_0x1d92b7]);}return _0x4d9736[_0xc4a8('0x16')];};};Realtime['prototype'][_0xc4a8('0x69')]=function(){var _0x235cb0=this;return function(_0x3e8d3f){if(_0x3e8d3f){freeIsNotKey(_0x3e8d3f,_0x235cb0[_0xc4a8('0x23')],'id');for(var _0x1465aa=0x0,_0xc94402={},_0x512397={};_0x1465aa<_0x3e8d3f[_0xc4a8('0x43')];_0x1465aa+=0x1){_0xc94402=_0x3e8d3f[_0x1465aa];if(_[_0xc4a8('0x44')](_0x235cb0[_0xc4a8('0x23')][_0xc94402['id']])){_0x235cb0[_0xc4a8('0x23')][_0xc94402['id']]=new FaxAccount(_0xc94402);}else{_0x235cb0['mergeFromDatabase'](_0x235cb0[_0xc4a8('0x23')][_0xc94402['id']],_0xc94402);}}}return _0x235cb0[_0xc4a8('0x23')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index ec888d0..e57071f 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 _0xba4c=['disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','length','connectedlinenum','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','type','dialer','lastdata','queue','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','callerid','originatecalleridnum','disposition','calleridname','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','lastIndexOf','bluebird','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr'];(function(_0x585423,_0x34b2df){var _0x2d4de7=function(_0x4ed08a){while(--_0x4ed08a){_0x585423['push'](_0x585423['shift']());}};_0x2d4de7(++_0x34b2df);}(_0xba4c,0x8f));var _0xcba4=function(_0x5d38ce,_0xd88f81){_0x5d38ce=_0x5d38ce-0x0;var _0x5859ce=_0xba4c[_0x5d38ce];return _0x5859ce;};'use strict';var BPromise=require(_0xcba4('0x0'));var _=require(_0xcba4('0x1'));var moment=require('moment');var util=require(_0xcba4('0x2'));var config=require(_0xcba4('0x3'));var logger=require(_0xcba4('0x4'))(_0xcba4('0x5'));var ami=require(_0xcba4('0x6'));var RpcVoiceAgentReport=require(_0xcba4('0x7'));var RpcVoiceCallReport=require(_0xcba4('0x8'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xcba4('0x9'));var RpcVoiceQueueReport=require(_0xcba4('0xa'));var RpcVoiceRecording=require(_0xcba4('0xb'));var RpcVoiceTransferReport=require(_0xcba4('0xc'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xcba4('0xd'));var VoiceDialReport=require(_0xcba4('0xe'));var UserReport=require('./userReport');function Report(_0x5a7898){this[_0xcba4('0xf')]=_0x5a7898;this[_0xcba4('0x10')]=_0x5a7898['agents'];this[_0xcba4('0x11')]=_0x5a7898[_0xcba4('0x11')];}Report[_0xcba4('0x12')][_0xcba4('0x13')]=function(_0x258480){var _0x559bb7=new VoiceQueueReport(this[_0xcba4('0xf')]);var _0x35d3d3=new VoiceAgentReport(this[_0xcba4('0xf')]);var _0x3b97a2=new VoiceDialReport(this[_0xcba4('0xf')]);var _0x455839=new VoiceCallReport(this[_0xcba4('0xf')]);var _0x521253=new UserReport(this[_0xcba4('0xf')]);if(config['xdr']&&config[_0xcba4('0x14')][_0xcba4('0x15')]){ami['on'](_0xcba4('0x16'),this[_0xcba4('0x17')][_0xcba4('0x18')](this));ami['on'](_0xcba4('0x19'),this[_0xcba4('0x1a')]['bind'](this));ami['on'](_0xcba4('0x1b'),this['voiceAgentReport'][_0xcba4('0x18')](this));ami['on'](_0xcba4('0x1c'),this['voiceDialReport'][_0xcba4('0x18')](this));ami['on']('blindtransfer',this[_0xcba4('0x1d')][_0xcba4('0x18')](this));ami['on']('attendedtransfer',this[_0xcba4('0x1e')]['bind'](this));}};Report[_0xcba4('0x12')][_0xcba4('0x1f')]=function(_0x1f23dc){var _0x10cf2e=undefined;_0x10cf2e=_[_0xcba4('0x20')](this[_0xcba4('0x10')],function(_0x2d57b7){return _0x2d57b7[_0xcba4('0x21')]==_0x1f23dc||_0x2d57b7[_0xcba4('0x22')]==_0x1f23dc;});if(_[_0xcba4('0x23')](_0x10cf2e)){var _0xc38b7a=_[_0xcba4('0x20')](this[_0xcba4('0x11')],function(_0x262ed9){return _0x262ed9['accountcode']==_0x1f23dc||_0x262ed9[_0xcba4('0x22')]==_0x1f23dc;});if(_0xc38b7a){_0x10cf2e=_[_0xcba4('0x20')](this[_0xcba4('0x10')],function(_0x186b59){return _0x186b59['interface']==util[_0xcba4('0x24')](_0xcba4('0x25'),_0xc38b7a[_0xcba4('0x22')]);});}}return _0x10cf2e;};Report[_0xcba4('0x12')]['voiceQueueReport']=function(_0x2e132a){for(var _0x385ac7=0x0;_0x385ac7<_0x2e132a[_0xcba4('0x26')];_0x385ac7+=0x1){var _0x10b720=this[_0xcba4('0x1f')](_0x2e132a[_0x385ac7][_0xcba4('0x27')]);if(_0x10b720){_0x2e132a[_0x385ac7][_0xcba4('0x21')]=_0x10b720[_0xcba4('0x21')];_0x2e132a[_0x385ac7]['assigned']=!![];_0x2e132a[_0x385ac7][_0xcba4('0x28')]=_0x10b720['name'];_0x2e132a[_0x385ac7][_0xcba4('0x29')]=_['isNil'](_0x10b720[_0xcba4('0x29')])?util[_0xcba4('0x24')]('SIP/%s',_0x10b720['name']):_0x10b720[_0xcba4('0x29')];if(_0x2e132a[_0x385ac7][_0xcba4('0x2a')]){_0x2e132a[_0x385ac7][_0xcba4('0x2b')]=moment()[_0xcba4('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2e132a[_0x385ac7][_0xcba4('0x2c')]){_0x2e132a[_0x385ac7]['queuecallerexitAt']=moment()[_0xcba4('0x24')](_0xcba4('0x2d'));}RpcMemberReport[_0xcba4('0x17')](_0x2e132a[_0x385ac7]);}RpcVoiceQueueReport[_0xcba4('0x2e')](_0x2e132a[_0x385ac7]);}};function extractCalleridNumber(_0xc5d13f){var _0x5bf8e6=_0xc5d13f[_0xcba4('0x2f')](/<(.*?)>/);return _0x5bf8e6?_0x5bf8e6[0x1]:_0xc5d13f;}Report['prototype'][_0xcba4('0x1a')]=function(_0x58e37d){_0x58e37d['destination']=_0x58e37d[_0xcba4('0x30')]||_0x58e37d[_0xcba4('0x31')];if(_0x58e37d[_0xcba4('0x32')]==_0xcba4('0x33')){_0x58e37d['lastapplication']='queue';_0x58e37d[_0xcba4('0x34')]=_0x58e37d[_0xcba4('0x35')];if(_0x58e37d[_0xcba4('0x36')]=='from-voip-provider'){_0x58e37d[_0xcba4('0x21')]='';_0x58e37d[_0xcba4('0x30')]=extractCalleridNumber(_0x58e37d['callerid']);}else if(_0x58e37d[_0xcba4('0x36')]==_0xcba4('0x37')){if(_0x58e37d[_0xcba4('0x30')]==_0xcba4('0x38')){_0x58e37d[_0xcba4('0x30')]=extractCalleridNumber(_0x58e37d[_0xcba4('0x39')]);_0x58e37d[_0xcba4('0x3a')]=_0x58e37d['originatecalleridnum'];_0x58e37d[_0xcba4('0x3b')]=[_0x58e37d['channel'],_0x58e37d[_0xcba4('0x3c')]=_0x58e37d[_0xcba4('0x3b')]][0x0];_0x58e37d[_0xcba4('0x3d')]=_0x58e37d[_0xcba4('0x39')];}else{_0x58e37d[_0xcba4('0x30')]=_0x58e37d[_0xcba4('0x3a')];_0x58e37d['calleridnum']=_0x58e37d[_0xcba4('0x3e')];if(_0x58e37d[_0xcba4('0x3f')]=='ANSWERED'){_0x58e37d[_0xcba4('0x21')]=_0x58e37d['connectedlinenum'];}else{_0x58e37d['accountcode']='';}}}}else{_0x58e37d['callerid']=util[_0xcba4('0x24')]('\x22%s\x22\x20<%s>',_0x58e37d[_0xcba4('0x40')],_0x58e37d['calleridnum']);}RpcVoiceCallReport[_0xcba4('0x2e')](_0x58e37d);if(_0x58e37d[_0xcba4('0x41')]){for(var _0x41573f=0x0;_0x41573f<_0x58e37d[_0xcba4('0x42')][_0xcba4('0x26')];_0x41573f+=0x1){_0x58e37d[_0xcba4('0x43')]=_0x58e37d[_0xcba4('0x42')][_0x41573f][_0xcba4('0x44')];_0x58e37d[_0xcba4('0x45')]=_0x58e37d['monitors'][_0x41573f][_0xcba4('0x45')];if(_0x58e37d[_0xcba4('0x31')]==_0xcba4('0x38')){_0x58e37d['calleridnum']=_0x58e37d[_0xcba4('0x27')];_0x58e37d[_0xcba4('0x40')]=_0x58e37d[_0xcba4('0x46')];_0x58e37d['connectedlinenum']=_0x58e37d['accountcode'];_0x58e37d['connectedlinename']=_0x58e37d[_0xcba4('0x47')];_0x58e37d[_0xcba4('0x31')]=_0x58e37d[_0xcba4('0x3e')];}else if(_0x58e37d[_0xcba4('0x31')]==_0xcba4('0x48')){_0x58e37d[_0xcba4('0x3a')]=_0x58e37d[_0xcba4('0x30')];_0x58e37d[_0xcba4('0x31')]=_0x58e37d[_0xcba4('0x3e')];}RpcVoiceRecording[_0xcba4('0x2e')](_0x58e37d);}}};Report['prototype'][_0xcba4('0x49')]=function(_0x2d4c8f){if(_[_0xcba4('0x4a')](_0x2d4c8f)){_0x2d4c8f[_0xcba4('0x4b')](function(_0x29094b){RpcVoiceAgentReport[_0xcba4('0x2e')](_0x29094b);});}else{RpcVoiceAgentReport[_0xcba4('0x2e')](_0x2d4c8f);}};Report[_0xcba4('0x12')][_0xcba4('0x4c')]=function(_0x30a08f){RpcVoiceDialReport[_0xcba4('0x2e')](_0x30a08f);var _0xcf6b59=undefined;var _0x29ed34=_0x30a08f[_0xcba4('0x3c')];if(_[_0xcba4('0x4d')](_0x29ed34,_0xcba4('0x4e'))){var _0x1f4455=_0x29ed34[_0xcba4('0x4f')](_0x29ed34[_0xcba4('0x50')]('/')+0x1,_0x29ed34[_0xcba4('0x50')]('@'));_0xcf6b59=_[_0xcba4('0x20')](this[_0xcba4('0x10')],function(_0x4e5fa7){return _0x4e5fa7['mobile']==_0x1f4455||_0x4e5fa7['phone']==_0x1f4455||_0x4e5fa7[_0xcba4('0x21')]==_0x1f4455;});}else{var _0x1f4455=_0x29ed34['substring'](_0x29ed34[_0xcba4('0x50')]('/')+0x1,_0x29ed34[_0xcba4('0x51')]('-'));_0xcf6b59=this[_0xcba4('0x1f')](_0x1f4455);}if(_0xcf6b59){_0x30a08f[_0xcba4('0x29')]=_[_0xcba4('0x23')](_0xcf6b59['interface'])?util[_0xcba4('0x24')](_0xcba4('0x25'),_0xcf6b59[_0xcba4('0x22')]):_0xcf6b59[_0xcba4('0x29')];_0x30a08f['membername']=_0xcf6b59[_0xcba4('0x22')];_0x30a08f[_0xcba4('0x21')]=_0xcf6b59[_0xcba4('0x21')];RpcMemberReport['voiceDialReport'](_0x30a08f);}};Report['prototype']['blindTransfer']=function(_0x1b6f63){RpcVoiceTransferReport['blindTransfer'](_0x1b6f63);};Report[_0xcba4('0x12')][_0xcba4('0x1e')]=function(_0x24cfd7){RpcVoiceTransferReport['attendedTransfer'](_0x24cfd7);};module['exports']=Report; \ No newline at end of file +var _0xc67f=['assigned','lastAssignedTo','format','YYYY-MM-DD\x20HH:mm:ss','match','destination','exten','type','dialer','lastapplication','lastdata','queue','context','callerid','from-sip','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','monitorFilename','monitors','filename','createdAt','xcally-motion-preview','calleridname','connectedlinename','membername','xcally-motion-dialer','create','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','findAgent','SIP/%s','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','find','accountcode','name','isNil','interface','length','connectedlinenum'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xc67f,0x1b7));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xfc67('0x0'));var _=require(_0xfc67('0x1'));var moment=require(_0xfc67('0x2'));var util=require(_0xfc67('0x3'));var config=require(_0xfc67('0x4'));var logger=require(_0xfc67('0x5'))('ami');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xfc67('0x6'));var RpcVoiceCallReport=require(_0xfc67('0x7'));var RpcVoiceDialReport=require(_0xfc67('0x8'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xfc67('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xfc67('0xa'));var VoiceAgentReport=require(_0xfc67('0xb'));var VoiceDialReport=require(_0xfc67('0xc'));var UserReport=require(_0xfc67('0xd'));function Report(_0x410e49){this[_0xfc67('0xe')]=_0x410e49;this[_0xfc67('0xf')]=_0x410e49[_0xfc67('0xf')];this[_0xfc67('0x10')]=_0x410e49[_0xfc67('0x10')];}Report[_0xfc67('0x11')]['sync']=function(_0x44b4f8){var _0x406799=new VoiceQueueReport(this[_0xfc67('0xe')]);var _0x1ae763=new VoiceAgentReport(this[_0xfc67('0xe')]);var _0x42707b=new VoiceDialReport(this[_0xfc67('0xe')]);var _0x347166=new VoiceCallReport(this[_0xfc67('0xe')]);var _0x4409ab=new UserReport(this['realtime']);if(config[_0xfc67('0x12')]&&config[_0xfc67('0x12')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0xfc67('0x13')][_0xfc67('0x14')](this));ami['on']('custom:voiceCallReport',this[_0xfc67('0x15')][_0xfc67('0x14')](this));ami['on'](_0xfc67('0x16'),this[_0xfc67('0x17')][_0xfc67('0x14')](this));ami['on']('custom:voiceDialReport',this[_0xfc67('0x18')][_0xfc67('0x14')](this));ami['on'](_0xfc67('0x19'),this[_0xfc67('0x1a')][_0xfc67('0x14')](this));ami['on']('attendedtransfer',this[_0xfc67('0x1b')][_0xfc67('0x14')](this));}};Report[_0xfc67('0x11')]['findAgent']=function(_0x2a7aad){var _0x185f82=undefined;_0x185f82=_[_0xfc67('0x1c')](this[_0xfc67('0xf')],function(_0x464718){return _0x464718[_0xfc67('0x1d')]==_0x2a7aad||_0x464718[_0xfc67('0x1e')]==_0x2a7aad;});if(_[_0xfc67('0x1f')](_0x185f82)){var _0xa6ceb1=_['find'](this[_0xfc67('0x10')],function(_0x1b0a7a){return _0x1b0a7a[_0xfc67('0x1d')]==_0x2a7aad||_0x1b0a7a[_0xfc67('0x1e')]==_0x2a7aad;});if(_0xa6ceb1){_0x185f82=_['find'](this[_0xfc67('0xf')],function(_0x2b36b2){return _0x2b36b2[_0xfc67('0x20')]==util['format']('SIP/%s',_0xa6ceb1[_0xfc67('0x1e')]);});}}return _0x185f82;};Report[_0xfc67('0x11')][_0xfc67('0x13')]=function(_0x287a47){for(var _0x1d6131=0x0;_0x1d6131<_0x287a47[_0xfc67('0x21')];_0x1d6131+=0x1){var _0x514851=this['findAgent'](_0x287a47[_0x1d6131][_0xfc67('0x22')]);if(_0x514851){_0x287a47[_0x1d6131][_0xfc67('0x1d')]=_0x514851[_0xfc67('0x1d')];_0x287a47[_0x1d6131][_0xfc67('0x23')]=!![];_0x287a47[_0x1d6131][_0xfc67('0x24')]=_0x514851[_0xfc67('0x1e')];_0x287a47[_0x1d6131][_0xfc67('0x20')]=_[_0xfc67('0x1f')](_0x514851[_0xfc67('0x20')])?util[_0xfc67('0x25')]('SIP/%s',_0x514851[_0xfc67('0x1e')]):_0x514851[_0xfc67('0x20')];if(_0x287a47[_0x1d6131]['queuecallercomplete']){_0x287a47[_0x1d6131]['queuecallercompleteAt']=moment()[_0xfc67('0x25')](_0xfc67('0x26'));}if(_0x287a47[_0x1d6131]['queuecallerexit']){_0x287a47[_0x1d6131]['queuecallerexitAt']=moment()[_0xfc67('0x25')](_0xfc67('0x26'));}RpcMemberReport['voiceQueueReport'](_0x287a47[_0x1d6131]);}RpcVoiceQueueReport['create'](_0x287a47[_0x1d6131]);}};function extractCalleridNumber(_0xd3aa1e){var _0x411900=_0xd3aa1e[_0xfc67('0x27')](/<(.*?)>/);return _0x411900?_0x411900[0x1]:_0xd3aa1e;}Report[_0xfc67('0x11')][_0xfc67('0x15')]=function(_0x55ecca){_0x55ecca[_0xfc67('0x28')]=_0x55ecca[_0xfc67('0x28')]||_0x55ecca[_0xfc67('0x29')];if(_0x55ecca[_0xfc67('0x2a')]==_0xfc67('0x2b')){_0x55ecca[_0xfc67('0x2c')]='queue';_0x55ecca[_0xfc67('0x2d')]=_0x55ecca[_0xfc67('0x2e')];if(_0x55ecca[_0xfc67('0x2f')]=='from-voip-provider'){_0x55ecca[_0xfc67('0x1d')]='';_0x55ecca['destination']=extractCalleridNumber(_0x55ecca[_0xfc67('0x30')]);}else if(_0x55ecca['context']==_0xfc67('0x31')){if(_0x55ecca[_0xfc67('0x28')]=='xcally-motion-preview'){_0x55ecca[_0xfc67('0x28')]=extractCalleridNumber(_0x55ecca['calleridpreview']);_0x55ecca[_0xfc67('0x32')]=_0x55ecca[_0xfc67('0x33')];_0x55ecca[_0xfc67('0x34')]=[_0x55ecca[_0xfc67('0x35')],_0x55ecca[_0xfc67('0x35')]=_0x55ecca[_0xfc67('0x34')]][0x0];_0x55ecca['callerid']=_0x55ecca[_0xfc67('0x36')];}else{_0x55ecca[_0xfc67('0x28')]=_0x55ecca[_0xfc67('0x32')];_0x55ecca['calleridnum']=_0x55ecca[_0xfc67('0x33')];if(_0x55ecca[_0xfc67('0x37')]==_0xfc67('0x38')){_0x55ecca[_0xfc67('0x1d')]=_0x55ecca['connectedlinenum'];}else{_0x55ecca[_0xfc67('0x1d')]='';}}}}else{_0x55ecca['callerid']=util[_0xfc67('0x25')](_0xfc67('0x39'),_0x55ecca['calleridname'],_0x55ecca['calleridnum']);}RpcVoiceCallReport['create'](_0x55ecca);if(_0x55ecca['monitor']){for(var _0x5c96b6=0x0;_0x5c96b6<_0x55ecca['monitors']['length'];_0x5c96b6+=0x1){_0x55ecca[_0xfc67('0x3a')]=_0x55ecca[_0xfc67('0x3b')][_0x5c96b6][_0xfc67('0x3c')];_0x55ecca[_0xfc67('0x3d')]=_0x55ecca[_0xfc67('0x3b')][_0x5c96b6][_0xfc67('0x3d')];if(_0x55ecca[_0xfc67('0x29')]==_0xfc67('0x3e')){_0x55ecca[_0xfc67('0x32')]=_0x55ecca[_0xfc67('0x22')];_0x55ecca[_0xfc67('0x3f')]=_0x55ecca[_0xfc67('0x40')];_0x55ecca[_0xfc67('0x22')]=_0x55ecca[_0xfc67('0x1d')];_0x55ecca[_0xfc67('0x40')]=_0x55ecca[_0xfc67('0x41')];_0x55ecca[_0xfc67('0x29')]=_0x55ecca[_0xfc67('0x33')];}else if(_0x55ecca['exten']==_0xfc67('0x42')){_0x55ecca[_0xfc67('0x32')]=_0x55ecca['destination'];_0x55ecca['exten']=_0x55ecca[_0xfc67('0x33')];}RpcVoiceRecording[_0xfc67('0x43')](_0x55ecca);}}};Report['prototype'][_0xfc67('0x17')]=function(_0x21d712){if(_[_0xfc67('0x44')](_0x21d712)){_0x21d712[_0xfc67('0x45')](function(_0x2eeda5){RpcVoiceAgentReport[_0xfc67('0x43')](_0x2eeda5);});}else{RpcVoiceAgentReport['create'](_0x21d712);}};Report[_0xfc67('0x11')][_0xfc67('0x18')]=function(_0x5ce3a2){RpcVoiceDialReport[_0xfc67('0x43')](_0x5ce3a2);var _0x41f171=undefined;var _0x228b30=_0x5ce3a2[_0xfc67('0x35')];if(_[_0xfc67('0x46')](_0x228b30,_0xfc67('0x47'))){var _0x2b962c=_0x228b30[_0xfc67('0x48')](_0x228b30[_0xfc67('0x49')]('/')+0x1,_0x228b30[_0xfc67('0x49')]('@'));_0x41f171=_[_0xfc67('0x1c')](this[_0xfc67('0xf')],function(_0x5e7696){return _0x5e7696[_0xfc67('0x4a')]==_0x2b962c||_0x5e7696[_0xfc67('0x4b')]==_0x2b962c||_0x5e7696[_0xfc67('0x1d')]==_0x2b962c;});}else{var _0x2b962c=_0x228b30[_0xfc67('0x48')](_0x228b30[_0xfc67('0x49')]('/')+0x1,_0x228b30[_0xfc67('0x4c')]('-'));_0x41f171=this[_0xfc67('0x4d')](_0x2b962c);}if(_0x41f171){_0x5ce3a2[_0xfc67('0x20')]=_[_0xfc67('0x1f')](_0x41f171[_0xfc67('0x20')])?util[_0xfc67('0x25')](_0xfc67('0x4e'),_0x41f171[_0xfc67('0x1e')]):_0x41f171[_0xfc67('0x20')];_0x5ce3a2[_0xfc67('0x41')]=_0x41f171[_0xfc67('0x1e')];_0x5ce3a2[_0xfc67('0x1d')]=_0x41f171[_0xfc67('0x1d')];RpcMemberReport[_0xfc67('0x18')](_0x5ce3a2);}};Report[_0xfc67('0x11')][_0xfc67('0x1a')]=function(_0x2bdf1f){RpcVoiceTransferReport[_0xfc67('0x1a')](_0x2bdf1f);};Report[_0xfc67('0x11')]['attendedTransfer']=function(_0x166eb5){RpcVoiceTransferReport[_0xfc67('0x1b')](_0x166eb5);};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 862e7fc..2d7eaec 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 _0x410c=['trunk:save','[syncRegistry][UserReport]','inspect','isNotNull','device','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','telephone:%s','startsWith','Queue','substring','mobile','phone','accountcode','[syncDeviceState][UserReport]','syncPeerStatus','peer','registered','status','address','telephone:save','trunk:%s','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','ioredis','../../../config/environment','ami','../ami','redis','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','then','actionDeviceStateList','catch','error','actionSipPeerStatus','prototype','emit','find','username','state','merge','omit','actionid','format','name'];(function(_0x41c955,_0x309b4a){var _0x57d88b=function(_0x223d8b){while(--_0x223d8b){_0x41c955['push'](_0x41c955['shift']());}};_0x57d88b(++_0x309b4a);}(_0x410c,0x196));var _0xc410=function(_0x27c21d,_0x4de071){_0x27c21d=_0x27c21d-0x0;var _0x26378d=_0x410c[_0x27c21d];return _0x26378d;};'use strict';var _=require(_0xc410('0x0'));var moment=require(_0xc410('0x1'));var BPromise=require(_0xc410('0x2'));var util=require('util');var Redis=require(_0xc410('0x3'));var config=require(_0xc410('0x4'));var logger=require('../../../config/logger')(_0xc410('0x5'));var ami=require(_0xc410('0x6'));config[_0xc410('0x7')]=_['defaults'](config[_0xc410('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc410('0x7')]));function UserReport(_0x30d7e9){this[_0xc410('0x8')]=_0x30d7e9[_0xc410('0x8')];this[_0xc410('0x9')]=_0x30d7e9[_0xc410('0x9')];this[_0xc410('0xa')]=_0x30d7e9[_0xc410('0xa')];ami['on'](_0xc410('0xb'),this[_0xc410('0xc')]['bind'](this));ami['on']('registry',this['syncRegistry'][_0xc410('0xd')](this));ami['on'](_0xc410('0xe'),this[_0xc410('0xf')][_0xc410('0xd')](this));ami['on'](_0xc410('0x10'),this['syncPeerStatus'][_0xc410('0xd')](this));this[_0xc410('0x11')]();return BPromise[_0xc410('0x12')]()['then'](ami[_0xc410('0x13')]())[_0xc410('0x14')](ami[_0xc410('0x15')]())[_0xc410('0x14')](ami['actionSipPeerStatus']())[_0xc410('0x16')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x5c6ed2){return function(_0x5698f2){logger[_0xc410('0x17')](_0x5c6ed2,util['inspect'](_0x5698f2,{'showHidden':![],'depth':null}));};}UserReport['prototype']['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0xc410('0x12')]()['then'](ami['actionSipShowRegistry']())[_0xc410('0x14')](ami[_0xc410('0x15')]())[_0xc410('0x14')](ami[_0xc410('0x18')]())[_0xc410('0x16')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x4aff85){return _0x4aff85!==null&&!_['isUndefined'](_0x4aff85);};UserReport[_0xc410('0x19')][_0xc410('0x1a')]=function(_0x192eab,_0xa6f110,_0x4008ce){io['to'](_0x192eab)[_0xc410('0x1a')](_0xa6f110,_0x4008ce);};UserReport[_0xc410('0x19')][_0xc410('0xc')]=function(_0x3fe7fe){try{if(this['isNotNull'](_0x3fe7fe)){var _0x2a6b42=_[_0xc410('0x1b')](this[_0xc410('0x8')],{'registry':_0x3fe7fe[_0xc410('0x1c')]});if(_0x2a6b42){_0x3fe7fe['stateRegistry']=_0x3fe7fe[_0xc410('0x1d')];_[_0xc410('0x1e')](_0x2a6b42,_[_0xc410('0x1f')](_0x3fe7fe,['event',_0xc410('0x20'),_0xc410('0x1c'),_0xc410('0x1d')]));this[_0xc410('0x1a')](util[_0xc410('0x21')]('trunk:%s',_0x2a6b42[_0xc410('0x22')]),_0xc410('0x23'),_0x2a6b42);}}}catch(_0x3a8c33){logger[_0xc410('0x17')](_0xc410('0x24'),util[_0xc410('0x25')](_0x3a8c33,{'showHidden':![],'depth':null}));}};UserReport[_0xc410('0x19')][_0xc410('0xf')]=function(_0x268a9d){try{if(this[_0xc410('0x26')](_0x268a9d)){if(this[_0xc410('0x9')][_0x268a9d[_0xc410('0x27')]]){if(!this[_0xc410('0x9')][_0x268a9d[_0xc410('0x27')]]['local']||_0x268a9d['state'][_0xc410('0x28')]()==_0xc410('0x29')){this[_0xc410('0x9')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x2a')]=![];if(this[_0xc410('0x9')][_0x268a9d[_0xc410('0x27')]]['state']!==_0x268a9d[_0xc410('0x1d')][_0xc410('0x28')]()){this['agents'][_0x268a9d['device']][_0xc410('0x2b')]=_[_0xc410('0x2c')](moment()[_0xc410('0x21')]('x'));}this[_0xc410('0x9')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x1d')]=_0x268a9d[_0xc410('0x1d')]['toLowerCase']();this[_0xc410('0x9')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x2d')](_0x268a9d);}}else if(this[_0xc410('0xa')][_0x268a9d[_0xc410('0x27')]]){if(this[_0xc410('0xa')][_0x268a9d['device']][_0xc410('0x1d')]!==_0x268a9d[_0xc410('0x1d')][_0xc410('0x28')]()){this[_0xc410('0xa')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x2b')]=_['toNumber'](moment()[_0xc410('0x21')]('x'));}this[_0xc410('0xa')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x1d')]=_0x268a9d['state']['toLowerCase']();this[_0xc410('0x1a')](util[_0xc410('0x21')](_0xc410('0x2e'),this['telephones'][_0x268a9d['device']][_0xc410('0x22')]),'telephone:save',this[_0xc410('0xa')][_0x268a9d[_0xc410('0x27')]]);}else if(this[_0xc410('0x8')][_0x268a9d[_0xc410('0x27')]]){if(this[_0xc410('0x8')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x1d')]!==_0x268a9d['state'][_0xc410('0x28')]()){this['trunks'][_0x268a9d['device']][_0xc410('0x2b')]=_[_0xc410('0x2c')](moment()['format']('x'));}this[_0xc410('0x8')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x1d')]=_0x268a9d[_0xc410('0x1d')][_0xc410('0x28')]();this[_0xc410('0x1a')](util['format']('trunk:%s',this[_0xc410('0x8')][_0x268a9d['device']][_0xc410('0x22')]),_0xc410('0x23'),this[_0xc410('0x8')][_0x268a9d[_0xc410('0x27')]]);}else if(_[_0xc410('0x2f')](_0x268a9d[_0xc410('0x27')],_0xc410('0x30'))){}else if(_['startsWith'](_0x268a9d['device'],'Local')){var _0x1895d9=_0x268a9d[_0xc410('0x27')];var _0x2bfc99=_0x1895d9[_0xc410('0x31')](_0x1895d9['indexOf']('/')+0x1,_0x1895d9['indexOf']('@'));var _0x2c04ed=_[_0xc410('0x1b')](this[_0xc410('0x9')],function(_0x438c17){return _0x438c17[_0xc410('0x32')]==_0x2bfc99||_0x438c17[_0xc410('0x33')]==_0x2bfc99||_0x438c17[_0xc410('0x34')]==_0x2bfc99;});if(_0x2c04ed){if(_0x2c04ed[_0xc410('0x1d')]!==_0x268a9d[_0xc410('0x1d')][_0xc410('0x28')]()){_0x2c04ed[_0xc410('0x2b')]=_['toNumber'](moment()[_0xc410('0x21')]('x'));}_0x2c04ed['state']=_0x268a9d[_0xc410('0x1d')][_0xc410('0x28')]();_0x2c04ed['local']=!![];_0x2c04ed['updateStatusRealtime'](_0x268a9d);}}else{}}}catch(_0x4d7b89){logger['error'](_0xc410('0x35'),util[_0xc410('0x25')](_0x4d7b89,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xc410('0x36')]=function(_0x1d7565){try{if(this[_0xc410('0x26')](_0x1d7565)&&this['isNotNull'](_0x1d7565[_0xc410('0x10')])){if(this['agents'][_0x1d7565[_0xc410('0x37')]]){if(!this[_0xc410('0x9')][_0x1d7565[_0xc410('0x37')]][_0xc410('0x2a')]||_0x1d7565[_0xc410('0x10')][_0xc410('0x28')]()==_0xc410('0x38')){this[_0xc410('0x9')][_0x1d7565[_0xc410('0x37')]][_0xc410('0x2a')]=![];this['agents'][_0x1d7565[_0xc410('0x37')]][_0xc410('0x39')]=_0x1d7565[_0xc410('0x10')][_0xc410('0x28')]();this[_0xc410('0x9')][_0x1d7565[_0xc410('0x37')]]['address']=_0x1d7565[_0xc410('0x3a')];this[_0xc410('0x9')][_0x1d7565[_0xc410('0x37')]][_0xc410('0x2d')](_0x1d7565);}}else if(this[_0xc410('0xa')][_0x1d7565[_0xc410('0x37')]]){this['telephones'][_0x1d7565['peer']][_0xc410('0x39')]=_0x1d7565[_0xc410('0x10')][_0xc410('0x28')]();this[_0xc410('0xa')][_0x1d7565[_0xc410('0x37')]][_0xc410('0x3a')]=_0x1d7565[_0xc410('0x3a')];this[_0xc410('0x1a')](util[_0xc410('0x21')](_0xc410('0x2e'),this[_0xc410('0xa')][_0x1d7565[_0xc410('0x37')]][_0xc410('0x22')]),_0xc410('0x3b'),this[_0xc410('0xa')][_0x1d7565[_0xc410('0x37')]]);}else if(this[_0xc410('0x8')][_0x1d7565[_0xc410('0x37')]]){this[_0xc410('0x8')][_0x1d7565['peer']][_0xc410('0x39')]=_0x1d7565[_0xc410('0x10')]['toLowerCase']();this[_0xc410('0x8')][_0x1d7565['peer']][_0xc410('0x3a')]=_0x1d7565[_0xc410('0x3a')];this['emit'](util[_0xc410('0x21')](_0xc410('0x3c'),this[_0xc410('0x8')][_0x1d7565[_0xc410('0x37')]][_0xc410('0x22')]),'trunk:save',this['trunks'][_0x1d7565[_0xc410('0x37')]]);}else{}}}catch(_0x55abb5){logger[_0xc410('0x17')](_0xc410('0x3d'),util[_0xc410('0x25')](_0x55abb5,{'showHidden':![],'depth':null}));}};module[_0xc410('0x3e')]=UserReport; \ No newline at end of file +var _0x923a=['util','../../../config/logger','ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','actionSipPeerStatus','catch','error','inspect','prototype','loopSyncRealTimeShow','[loopSyncRealTimeShow]','isNotNull','isUndefined','emit','find','username','stateRegistry','state','merge','omit','event','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','stateTime','toNumber','format','telephone:%s','telephone:save','startsWith','Queue','Local','substring','indexOf','mobile','phone','[syncDeviceState][UserReport]','peer','registered','status','address','updateStatusRealtime','[syncPeerStatus][UserReport]','lodash','bluebird'];(function(_0x17b8aa,_0x542724){var _0x2a5923=function(_0x323f63){while(--_0x323f63){_0x17b8aa['push'](_0x17b8aa['shift']());}};_0x2a5923(++_0x542724);}(_0x923a,0xc4));var _0xa923=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x923a[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xa923('0x0'));var moment=require('moment');var BPromise=require(_0xa923('0x1'));var util=require(_0xa923('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xa923('0x3'))(_0xa923('0x4'));var ami=require('../ami');config['redis']=_[_0xa923('0x5')](config[_0xa923('0x6')],{'host':_0xa923('0x7'),'port':0x18eb});var io=require(_0xa923('0x8'))(new Redis(config['redis']));function UserReport(_0x404e91){this['trunks']=_0x404e91[_0xa923('0x9')];this[_0xa923('0xa')]=_0x404e91[_0xa923('0xa')];this[_0xa923('0xb')]=_0x404e91[_0xa923('0xb')];ami['on'](_0xa923('0xc'),this[_0xa923('0xd')][_0xa923('0xe')](this));ami['on'](_0xa923('0xf'),this[_0xa923('0xd')][_0xa923('0xe')](this));ami['on'](_0xa923('0x10'),this[_0xa923('0x11')]['bind'](this));ami['on'](_0xa923('0x12'),this[_0xa923('0x13')][_0xa923('0xe')](this));this['loopSyncRealTimeShow']();return BPromise[_0xa923('0x14')]()[_0xa923('0x15')](ami[_0xa923('0x16')]())[_0xa923('0x15')](ami['actionDeviceStateList']())[_0xa923('0x15')](ami[_0xa923('0x17')]())[_0xa923('0x18')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x1310f1){return function(_0x55f71e){logger[_0xa923('0x19')](_0x1310f1,util[_0xa923('0x1a')](_0x55f71e,{'showHidden':![],'depth':null}));};}UserReport[_0xa923('0x1b')][_0xa923('0x1c')]=function(){setInterval(function(){BPromise[_0xa923('0x14')]()[_0xa923('0x15')](ami[_0xa923('0x16')]())[_0xa923('0x15')](ami['actionDeviceStateList']())[_0xa923('0x15')](ami[_0xa923('0x17')]())[_0xa923('0x18')](loggerCatch(_0xa923('0x1d')));},0x32c8);};UserReport[_0xa923('0x1b')][_0xa923('0x1e')]=function(_0x5dc207){return _0x5dc207!==null&&!_[_0xa923('0x1f')](_0x5dc207);};UserReport[_0xa923('0x1b')][_0xa923('0x20')]=function(_0x277869,_0x49a503,_0x5f07d0){io['to'](_0x277869)[_0xa923('0x20')](_0x49a503,_0x5f07d0);};UserReport[_0xa923('0x1b')]['syncRegistry']=function(_0x8ddc9b){try{if(this['isNotNull'](_0x8ddc9b)){var _0x26efe7=_[_0xa923('0x21')](this['trunks'],{'registry':_0x8ddc9b[_0xa923('0x22')]});if(_0x26efe7){_0x8ddc9b[_0xa923('0x23')]=_0x8ddc9b[_0xa923('0x24')];_[_0xa923('0x25')](_0x26efe7,_[_0xa923('0x26')](_0x8ddc9b,[_0xa923('0x27'),'actionid',_0xa923('0x22'),_0xa923('0x24')]));this[_0xa923('0x20')](util['format'](_0xa923('0x28'),_0x26efe7[_0xa923('0x29')]),_0xa923('0x2a'),_0x26efe7);}}}catch(_0x2aa479){logger[_0xa923('0x19')](_0xa923('0x2b'),util[_0xa923('0x1a')](_0x2aa479,{'showHidden':![],'depth':null}));}};UserReport[_0xa923('0x1b')][_0xa923('0x11')]=function(_0xfbf69f){try{if(this[_0xa923('0x1e')](_0xfbf69f)){if(this[_0xa923('0xa')][_0xfbf69f[_0xa923('0x2c')]]){if(!this[_0xa923('0xa')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x2d')]||_0xfbf69f['state'][_0xa923('0x2e')]()=='inuse'){this[_0xa923('0xa')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x2d')]=![];if(this[_0xa923('0xa')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x24')]!==_0xfbf69f['state'][_0xa923('0x2e')]()){this[_0xa923('0xa')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x2f')]=_[_0xa923('0x30')](moment()[_0xa923('0x31')]('x'));}this[_0xa923('0xa')][_0xfbf69f['device']][_0xa923('0x24')]=_0xfbf69f[_0xa923('0x24')]['toLowerCase']();this[_0xa923('0xa')][_0xfbf69f[_0xa923('0x2c')]]['updateStatusRealtime'](_0xfbf69f);}}else if(this[_0xa923('0xb')][_0xfbf69f[_0xa923('0x2c')]]){if(this['telephones'][_0xfbf69f['device']][_0xa923('0x24')]!==_0xfbf69f[_0xa923('0x24')][_0xa923('0x2e')]()){this['telephones'][_0xfbf69f['device']][_0xa923('0x2f')]=_[_0xa923('0x30')](moment()[_0xa923('0x31')]('x'));}this[_0xa923('0xb')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x24')]=_0xfbf69f[_0xa923('0x24')][_0xa923('0x2e')]();this[_0xa923('0x20')](util[_0xa923('0x31')](_0xa923('0x32'),this['telephones'][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x29')]),_0xa923('0x33'),this[_0xa923('0xb')][_0xfbf69f[_0xa923('0x2c')]]);}else if(this[_0xa923('0x9')][_0xfbf69f[_0xa923('0x2c')]]){if(this[_0xa923('0x9')][_0xfbf69f[_0xa923('0x2c')]]['state']!==_0xfbf69f['state']['toLowerCase']()){this[_0xa923('0x9')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x2f')]=_['toNumber'](moment()[_0xa923('0x31')]('x'));}this['trunks'][_0xfbf69f['device']][_0xa923('0x24')]=_0xfbf69f[_0xa923('0x24')][_0xa923('0x2e')]();this[_0xa923('0x20')](util['format'](_0xa923('0x28'),this[_0xa923('0x9')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x29')]),_0xa923('0x2a'),this[_0xa923('0x9')][_0xfbf69f[_0xa923('0x2c')]]);}else if(_[_0xa923('0x34')](_0xfbf69f[_0xa923('0x2c')],_0xa923('0x35'))){}else if(_[_0xa923('0x34')](_0xfbf69f[_0xa923('0x2c')],_0xa923('0x36'))){var _0x1fc862=_0xfbf69f[_0xa923('0x2c')];var _0x16f114=_0x1fc862[_0xa923('0x37')](_0x1fc862[_0xa923('0x38')]('/')+0x1,_0x1fc862[_0xa923('0x38')]('@'));var _0x3dba51=_['find'](this[_0xa923('0xa')],function(_0x199d23){return _0x199d23[_0xa923('0x39')]==_0x16f114||_0x199d23[_0xa923('0x3a')]==_0x16f114||_0x199d23['accountcode']==_0x16f114;});if(_0x3dba51){if(_0x3dba51[_0xa923('0x24')]!==_0xfbf69f['state']['toLowerCase']()){_0x3dba51['stateTime']=_[_0xa923('0x30')](moment()[_0xa923('0x31')]('x'));}_0x3dba51['state']=_0xfbf69f[_0xa923('0x24')][_0xa923('0x2e')]();_0x3dba51[_0xa923('0x2d')]=!![];_0x3dba51['updateStatusRealtime'](_0xfbf69f);}}else{}}}catch(_0x34a9ee){logger['error'](_0xa923('0x3b'),util[_0xa923('0x1a')](_0x34a9ee,{'showHidden':![],'depth':null}));}};UserReport[_0xa923('0x1b')][_0xa923('0x13')]=function(_0x60359){try{if(this[_0xa923('0x1e')](_0x60359)&&this['isNotNull'](_0x60359['peerstatus'])){if(this['agents'][_0x60359[_0xa923('0x3c')]]){if(!this[_0xa923('0xa')][_0x60359[_0xa923('0x3c')]]['local']||_0x60359[_0xa923('0x12')]['toLowerCase']()==_0xa923('0x3d')){this['agents'][_0x60359[_0xa923('0x3c')]][_0xa923('0x2d')]=![];this[_0xa923('0xa')][_0x60359[_0xa923('0x3c')]][_0xa923('0x3e')]=_0x60359['peerstatus'][_0xa923('0x2e')]();this[_0xa923('0xa')][_0x60359[_0xa923('0x3c')]][_0xa923('0x3f')]=_0x60359[_0xa923('0x3f')];this[_0xa923('0xa')][_0x60359[_0xa923('0x3c')]][_0xa923('0x40')](_0x60359);}}else if(this[_0xa923('0xb')][_0x60359[_0xa923('0x3c')]]){this[_0xa923('0xb')][_0x60359[_0xa923('0x3c')]][_0xa923('0x3e')]=_0x60359[_0xa923('0x12')]['toLowerCase']();this['telephones'][_0x60359[_0xa923('0x3c')]][_0xa923('0x3f')]=_0x60359[_0xa923('0x3f')];this['emit'](util[_0xa923('0x31')](_0xa923('0x32'),this[_0xa923('0xb')][_0x60359['peer']][_0xa923('0x29')]),_0xa923('0x33'),this['telephones'][_0x60359[_0xa923('0x3c')]]);}else if(this[_0xa923('0x9')][_0x60359['peer']]){this[_0xa923('0x9')][_0x60359[_0xa923('0x3c')]][_0xa923('0x3e')]=_0x60359[_0xa923('0x12')][_0xa923('0x2e')]();this[_0xa923('0x9')][_0x60359[_0xa923('0x3c')]]['address']=_0x60359[_0xa923('0x3f')];this[_0xa923('0x20')](util[_0xa923('0x31')](_0xa923('0x28'),this[_0xa923('0x9')][_0x60359[_0xa923('0x3c')]][_0xa923('0x29')]),_0xa923('0x2a'),this['trunks'][_0x60359['peer']]);}else{}}}catch(_0x723f58){logger[_0xa923('0x19')](_0xa923('0x41'),util[_0xa923('0x1a')](_0x723f58,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index a7dc2c8..b5bb20c 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 _0x2156=['agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','reason','answered_elsewhere','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','inspect','agentringnoanswerAt','rejected','custom:agentringnoanswer','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','complete','talktime','transfer','agent','acw','agentacw','acwtime','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','variable','value','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','transfereruniqueid','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','syncMusicOnHoldStop','exports','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentringnoanswer','syncAgentRingNoAnswer','agentcomplete','syncAgentComplete','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','emit','prototype','isUndefined','isNotNull','uniqueid','destuniqueid','format','called','variables','queue','type','inbound','merge','omit','privilege','custom:agentcalled','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','syncAgentConnect','hasOwnProperty'];(function(_0x5b4e65,_0x30fda7){var _0x22e731=function(_0x5f50b6){while(--_0x5f50b6){_0x5b4e65['push'](_0x5b4e65['shift']());}};_0x22e731(++_0x30fda7);}(_0x2156,0x134));var _0x6215=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2156[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x6215('0x0'));var moment=require('moment');var util=require(_0x6215('0x1'));var Redis=require('ioredis');var config=require(_0x6215('0x2'));var logger=require(_0x6215('0x3'))(_0x6215('0x4'));var ami=require(_0x6215('0x5'));config['redis']=_[_0x6215('0x6')](config[_0x6215('0x7')],{'host':_0x6215('0x8'),'port':0x18eb});var io=require(_0x6215('0x9'))(new Redis(config[_0x6215('0x7')]));function VoiceAgentReport(_0xffcb99){this[_0x6215('0xa')]={};this[_0x6215('0xb')]=_0xffcb99[_0x6215('0xb')];this[_0x6215('0xc')]=_0xffcb99[_0x6215('0xc')];this['variables']={};ami['on'](_0x6215('0xd'),this[_0x6215('0xe')][_0x6215('0xf')](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x6215('0xf')](this));ami['on'](_0x6215('0x10'),this[_0x6215('0x11')][_0x6215('0xf')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x6215('0xf')](this));ami['on'](_0x6215('0x12'),this[_0x6215('0x13')][_0x6215('0xf')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on']('hangup',this[_0x6215('0x14')]['bind'](this));ami['on'](_0x6215('0x15'),this[_0x6215('0x16')][_0x6215('0xf')](this));ami['on'](_0x6215('0x17'),this['syncMusicOnHoldStop'][_0x6215('0xf')](this));ami['on'](_0x6215('0x18'),this['syncAttendedTransfer'][_0x6215('0xf')](this));ami['on']('blindtransfer',this[_0x6215('0x19')][_0x6215('0xf')](this));}VoiceAgentReport['prototype'][_0x6215('0x1a')]=function(_0x106162,_0x476778,_0x29c725){io['to'](_0x106162)[_0x6215('0x1a')](_0x476778,_0x29c725);};VoiceAgentReport[_0x6215('0x1b')]['isNotNull']=function(_0x5c385f){return _0x5c385f!==null&&!_[_0x6215('0x1c')](_0x5c385f);};VoiceAgentReport[_0x6215('0x1b')][_0x6215('0xe')]=function(_0x12f350){try{if(this[_0x6215('0x1d')](_0x12f350)){if(_[_0x6215('0x1c')](this[_0x6215('0xa')][_0x12f350[_0x6215('0x1e')]])){this[_0x6215('0xa')][_0x12f350[_0x6215('0x1e')]]={};}if(_[_0x6215('0x1c')](this[_0x6215('0xa')][_0x12f350['uniqueid']][_0x12f350[_0x6215('0x1f')]])){this[_0x6215('0xa')][_0x12f350['uniqueid']][_0x12f350['destuniqueid']]={'agentcalledAt':moment()[_0x6215('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x6215('0x21'),'variables':this[_0x6215('0x22')][_0x12f350[_0x6215('0x1e')]],'type':this['voiceQueues'][_0x12f350['queue']]?this[_0x6215('0xb')][_0x12f350[_0x6215('0x23')]][_0x6215('0x24')]||_0x6215('0x25'):_0x6215('0x25')};}_[_0x6215('0x26')](this[_0x6215('0xa')][_0x12f350['uniqueid']][_0x12f350[_0x6215('0x1f')]],_[_0x6215('0x27')](_0x12f350,['event',_0x6215('0x28')]));ami[_0x6215('0x1a')](_0x6215('0x29'),this[_0x6215('0xa')][_0x12f350[_0x6215('0x1e')]][_0x12f350[_0x6215('0x1f')]]);this[_0x6215('0x1a')](util[_0x6215('0x20')](_0x6215('0x2a'),_0x12f350[_0x6215('0x2b')]),_0x6215('0x2c'),this['channels'][_0x12f350[_0x6215('0x1e')]][_0x12f350[_0x6215('0x1f')]]);}}catch(_0x8c1500){logger[_0x6215('0x2d')](_0x6215('0x2e'),util['inspect'](_0x8c1500,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')][_0x6215('0x2f')]=function(_0x3f0190){try{if(this[_0x6215('0x1d')](_0x3f0190)){if(this['channels'][_0x3f0190[_0x6215('0x1e')]]){for(var _0x426d69 in this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]]){if(this['channels'][_0x3f0190[_0x6215('0x1e')]][_0x6215('0x30')](_0x426d69)){if(_0x3f0190[_0x6215('0x1f')]===_0x426d69){this['channels'][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x31')]=moment()[_0x6215('0x20')](_0x6215('0x32'));this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x33')]=_0x6215('0x34');this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69]['holdtime']=_0x3f0190[_0x6215('0x35')];this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x36')]=_0x3f0190[_0x6215('0x36')];this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x37')]=_0x3f0190['connectedlinename'];this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x38')]=_0x3f0190['destchannelstate'];this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x39')]=_0x3f0190['destchannelstatedesc'];_[_0x6215('0x26')](this[_0x6215('0xc')][_0x3f0190[_0x6215('0x3a')]],_[_0x6215('0x3b')](_0x3f0190,[_0x6215('0x23'),_0x6215('0x3c')]));this[_0x6215('0x1a')](util[_0x6215('0x20')](_0x6215('0x2a'),_0x3f0190['membername']),_0x6215('0x3d'),this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x3f0190[_0x6215('0x1f')]]);ami['emit'](_0x6215('0x3e'),this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69]);}else if(!this[_0x6215('0xa')][_0x3f0190['uniqueid']][_0x426d69][_0x6215('0x10')]&&!this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x12')]){this[_0x6215('0xa')][_0x3f0190['uniqueid']][_0x426d69][_0x6215('0x10')]=!![];this[_0x6215('0xa')][_0x3f0190['uniqueid']][_0x426d69]['agentringnoanswerAt']=moment()[_0x6215('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x3f')]=_0x6215('0x40');this['channels'][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x33')]='answered_elsewhere';this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69]['answeredelsewheredestinationuniqueid']=_0x3f0190['destuniqueid'];this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x41')]=_0x3f0190[_0x6215('0x2b')];ami[_0x6215('0x1a')](_0x6215('0x42'),this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69]);}}}}}}catch(_0x11372e){logger[_0x6215('0x2d')](_0x6215('0x43'),util[_0x6215('0x44')](_0x11372e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')]['syncAgentRingNoAnswer']=function(_0x391e57){try{if(this[_0x6215('0x1d')](_0x391e57)){if(this[_0x6215('0xa')][_0x391e57[_0x6215('0x1e')]]&&this[_0x6215('0xa')][_0x391e57[_0x6215('0x1e')]][_0x391e57[_0x6215('0x1f')]]){this['channels'][_0x391e57[_0x6215('0x1e')]][_0x391e57[_0x6215('0x1f')]][_0x6215('0x10')]=!![];this['channels'][_0x391e57[_0x6215('0x1e')]][_0x391e57[_0x6215('0x1f')]][_0x6215('0x45')]=moment()[_0x6215('0x20')](_0x6215('0x32'));this[_0x6215('0xa')][_0x391e57[_0x6215('0x1e')]][_0x391e57[_0x6215('0x1f')]][_0x6215('0x3f')]='rejected';this[_0x6215('0xa')][_0x391e57[_0x6215('0x1e')]][_0x391e57[_0x6215('0x1f')]][_0x6215('0x33')]=_0x6215('0x46');ami['emit'](_0x6215('0x47'),this['channels'][_0x391e57[_0x6215('0x1e')]][_0x391e57[_0x6215('0x1f')]]);}}}catch(_0x41ce65){logger[_0x6215('0x2d')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x6215('0x44')](_0x41ce65,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')]['syncQueueCallerAbandon']=function(_0x369da5){try{if(this[_0x6215('0x1d')](_0x369da5)){if(this['channels'][_0x369da5[_0x6215('0x1e')]]){for(var _0x2c9e45 in this[_0x6215('0xa')][_0x369da5[_0x6215('0x1e')]]){if(this[_0x6215('0xa')][_0x369da5[_0x6215('0x1e')]][_0x6215('0x30')](_0x2c9e45)&&!this['channels'][_0x369da5[_0x6215('0x1e')]][_0x2c9e45][_0x6215('0x10')]&&!this[_0x6215('0xa')][_0x369da5['uniqueid']][_0x2c9e45][_0x6215('0x12')]){this[_0x6215('0xa')][_0x369da5[_0x6215('0x1e')]][_0x2c9e45][_0x6215('0x10')]=!![];this['channels'][_0x369da5['uniqueid']][_0x2c9e45][_0x6215('0x45')]=moment()[_0x6215('0x20')](_0x6215('0x32'));this[_0x6215('0xa')][_0x369da5[_0x6215('0x1e')]][_0x2c9e45]['reason']=_0x6215('0x48');this['channels'][_0x369da5[_0x6215('0x1e')]][_0x2c9e45][_0x6215('0x33')]=_0x6215('0x48');ami[_0x6215('0x1a')](_0x6215('0x49'),this[_0x6215('0xa')][_0x369da5[_0x6215('0x1e')]][_0x2c9e45]);}}}}}catch(_0x99062f){logger[_0x6215('0x2d')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x6215('0x44')](_0x99062f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')][_0x6215('0x13')]=function(_0x371f72){try{if(this['isNotNull'](_0x371f72)){if(this[_0x6215('0xa')][_0x371f72[_0x6215('0x1e')]]){for(var _0x24a633 in this[_0x6215('0xa')][_0x371f72[_0x6215('0x1e')]]){if(this[_0x6215('0xa')][_0x371f72['uniqueid']][_0x6215('0x30')](_0x24a633)){if(this[_0x6215('0xa')][_0x371f72[_0x6215('0x1e')]][_0x24a633][_0x6215('0x31')]&&!this[_0x6215('0xa')][_0x371f72['uniqueid']][_0x24a633][_0x6215('0x12')]){this['channels'][_0x371f72['uniqueid']][_0x24a633][_0x6215('0x12')]=!![];this[_0x6215('0xa')][_0x371f72['uniqueid']][_0x24a633][_0x6215('0x4a')]=moment()['format'](_0x6215('0x32'));this['channels'][_0x371f72['uniqueid']][_0x24a633][_0x6215('0x33')]=_0x6215('0x4b');this[_0x6215('0xa')][_0x371f72['uniqueid']][_0x24a633][_0x6215('0x4c')]=_0x371f72[_0x6215('0x4c')];this[_0x6215('0xa')][_0x371f72[_0x6215('0x1e')]][_0x24a633][_0x6215('0x3f')]=_0x371f72['reason']==_0x6215('0x4d')?_0x6215('0x4e'):_0x371f72[_0x6215('0x3f')];if(this[_0x6215('0xb')][_0x371f72[_0x6215('0x23')]]&&this[_0x6215('0xb')][_0x371f72[_0x6215('0x23')]][_0x6215('0x4f')]){this['channels'][_0x371f72[_0x6215('0x1e')]][_0x24a633][_0x6215('0x50')]=!![];this['channels'][_0x371f72[_0x6215('0x1e')]][_0x24a633][_0x6215('0x51')]=this['voiceQueues'][_0x371f72[_0x6215('0x23')]]['acwTimeout'];}this[_0x6215('0xc')][_0x371f72[_0x6215('0x3a')]]=_[_0x6215('0x27')](this[_0x6215('0xc')][_0x371f72['interface']],[_0x6215('0x23'),_0x6215('0x3c')]);this[_0x6215('0x1a')](util[_0x6215('0x20')]('user:%s',_0x371f72[_0x6215('0x2b')]),_0x6215('0x52'),this['channels'][_0x371f72[_0x6215('0x1e')]][_0x24a633]);ami[_0x6215('0x1a')]('custom:agentcomplete',this[_0x6215('0xa')][_0x371f72[_0x6215('0x1e')]][_0x24a633]);}}}}}}catch(_0x231fc5){logger[_0x6215('0x2d')](_0x6215('0x53'),util[_0x6215('0x44')](_0x231fc5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x18b0c0){try{if(this[_0x6215('0x1d')](_0x18b0c0)){this[_0x6215('0x54')](_0x18b0c0[_0x6215('0x1e')],_['keys'](_0x18b0c0[_0x6215('0x55')])[0x0],_0x18b0c0[_0x6215('0x56')]);if(this[_0x6215('0xa')][_0x18b0c0[_0x6215('0x1e')]]){for(var _0x846bd3 in this[_0x6215('0xa')][_0x18b0c0[_0x6215('0x1e')]]){if(this[_0x6215('0xa')][_0x18b0c0['uniqueid']][_0x6215('0x30')](_0x846bd3)){if(_[_0x6215('0x1c')](this[_0x6215('0xa')][_0x18b0c0[_0x6215('0x1e')]][_0x846bd3][_0x6215('0x22')])){this[_0x6215('0xa')][_0x18b0c0[_0x6215('0x1e')]][_0x846bd3][_0x6215('0x22')]={};}this[_0x6215('0xa')][_0x18b0c0[_0x6215('0x1e')]][_0x846bd3][_0x6215('0x22')]=this[_0x6215('0x22')][_0x18b0c0[_0x6215('0x1e')]];}}}}}catch(_0xba8f26){logger[_0x6215('0x2d')]('[syncVarSet][VoiceAgentReport]',util[_0x6215('0x44')](_0xba8f26,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6215('0x54')]=function(_0x3d8129,_0x36ea52,_0x7f10a1){var _0x1ffed3=['rtpaudioqos',_0x6215('0x57'),_0x6215('0x58'),_0x6215('0x59'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x6215('0x5a'),_0x6215('0x5b'),'sipcallid',_0x6215('0x5c'),_0x6215('0x5d'),_0x6215('0x5e'),_0x6215('0x5f'),'memberdynamic',_0x6215('0x60'),_0x6215('0x61'),'membername',_0x6215('0x62'),_0x6215('0x63')];if(!_[_0x6215('0x64')](_0x36ea52)&&!_[_0x6215('0x65')](_0x1ffed3,_0x36ea52)){if(_[_0x6215('0x1c')](this['variables'][_0x3d8129])){this['variables'][_0x3d8129]={};}this['variables'][_0x3d8129][_0x36ea52]=_0x7f10a1;}};VoiceAgentReport[_0x6215('0x1b')]['syncHangup']=function(_0x3bfcff){try{if(this[_0x6215('0x1d')](_0x3bfcff)){if(this[_0x6215('0xa')][_0x3bfcff['uniqueid']]){for(var _0x16280f in this['channels'][_0x3bfcff[_0x6215('0x1e')]]){if(this[_0x6215('0xa')][_0x3bfcff['uniqueid']][_0x6215('0x30')](_0x16280f)){if(this[_0x6215('0xa')][_0x3bfcff[_0x6215('0x1e')]][_0x16280f][_0x6215('0x3f')]==_0x6215('0x4d')&&this[_0x6215('0xa')][_0x3bfcff[_0x6215('0x1e')]][_0x16280f][_0x6215('0x12')]){this[_0x6215('0xa')][_0x3bfcff[_0x6215('0x1e')]][_0x16280f][_0x6215('0x4a')]=moment()[_0x6215('0x20')](_0x6215('0x32'));}}}ami[_0x6215('0x1a')](_0x6215('0x66'),_[_0x6215('0x67')](this[_0x6215('0xa')][_0x3bfcff['uniqueid']]));delete this[_0x6215('0xa')][_0x3bfcff[_0x6215('0x1e')]];}if(this[_0x6215('0x22')][_0x3bfcff[_0x6215('0x1e')]]){delete this[_0x6215('0x22')][_0x3bfcff['uniqueid']];}}}catch(_0x31d85e){logger[_0x6215('0x2d')](_0x6215('0x68'),util[_0x6215('0x44')](_0x31d85e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')][_0x6215('0x69')]=function(_0x2a409e){try{if(this[_0x6215('0x1d')](_0x2a409e)){if(this[_0x6215('0xa')][_0x2a409e['transfereeuniqueid']]){for(var _0x590579 in this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6a')]]){if(this['channels'][_0x2a409e[_0x6215('0x6a')]][_0x6215('0x30')](_0x590579)){if(_0x2a409e[_0x6215('0x6b')]===_0x590579){var _0x3ecbcc=moment();this['channels'][_0x2a409e[_0x6215('0x6a')]][_0x590579][_0x6215('0x12')]=!![];this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6a')]][_0x590579]['agentcompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6a')]][_0x590579][_0x6215('0x3f')]='transfer';this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6a')]][_0x590579][_0x6215('0x33')]=_0x6215('0x4b');this['channels'][_0x2a409e[_0x6215('0x6a')]][_0x590579][_0x6215('0x4c')]=_0x3ecbcc[_0x6215('0x6c')](this[_0x6215('0xa')][_0x2a409e['transfereeuniqueid']][_0x590579][_0x6215('0x31')],_0x6215('0x6d'));}}}}if(this[_0x6215('0xa')][_0x2a409e['secondtransfereruniqueid']]){var _0xdd2fa3=this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6e')]];this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6e')]]=this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6a')]];this['channels'][_0x2a409e['transfereeuniqueid']]=_0xdd2fa3;}}}catch(_0x3c4d9e){logger['error']('[syncAttendedTransfer][VoiceAgentReport]',util['inspect'](_0x3c4d9e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6215('0x19')]=function(_0x282411){try{if(this[_0x6215('0x1d')](_0x282411)){if(this[_0x6215('0xa')][_0x282411['transfereeuniqueid']]){for(var _0x41575f in this['channels'][_0x282411['transfereeuniqueid']]){if(this[_0x6215('0xa')][_0x282411[_0x6215('0x6a')]]['hasOwnProperty'](_0x41575f)){if(_0x282411[_0x6215('0x6f')]===_0x41575f){var _0xbb583f=moment();this[_0x6215('0xa')][_0x282411[_0x6215('0x6a')]][_0x41575f][_0x6215('0x12')]=!![];this[_0x6215('0xa')][_0x282411[_0x6215('0x6a')]][_0x41575f][_0x6215('0x4a')]=_0xbb583f;this[_0x6215('0xa')][_0x282411[_0x6215('0x6a')]][_0x41575f][_0x6215('0x3f')]=_0x6215('0x4d');this[_0x6215('0xa')][_0x282411[_0x6215('0x6a')]][_0x41575f][_0x6215('0x33')]=_0x6215('0x4b');this[_0x6215('0xa')][_0x282411[_0x6215('0x6a')]][_0x41575f][_0x6215('0x4c')]=_0xbb583f[_0x6215('0x6c')](this['channels'][_0x282411[_0x6215('0x6a')]][_0x41575f][_0x6215('0x31')],_0x6215('0x6d'));}}}}}}catch(_0x48fa29){logger['error']('[syncBlindTransfer][VoiceAgentReport]',util[_0x6215('0x44')](_0x48fa29,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')][_0x6215('0x16')]=function(_0x20238a){var _0x1d308e='';try{if(this['isNotNull'](_0x20238a)){if(_0x20238a[_0x6215('0x70')]){_0x1d308e=_0x20238a[_0x6215('0x70')][_0x6215('0x71')](0x0,_0x20238a[_0x6215('0x70')][_0x6215('0x72')]('-'));if(this[_0x6215('0xc')][_0x1d308e]){this[_0x6215('0xc')][_0x1d308e][_0x6215('0x73')]=!![];}}}}catch(_0x6429cf){logger[_0x6215('0x2d')](_0x6215('0x74'),util['inspect'](_0x6429cf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')][_0x6215('0x75')]=function(_0x227734){var _0x38e961='';try{if(this[_0x6215('0x1d')](_0x227734)){if(_0x227734['channel']){_0x38e961=_0x227734[_0x6215('0x70')][_0x6215('0x71')](0x0,_0x227734[_0x6215('0x70')][_0x6215('0x72')]('-'));if(this[_0x6215('0xc')][_0x38e961]){this[_0x6215('0xc')][_0x38e961]['onhold']=![];}}}}catch(_0x5e2a73){logger[_0x6215('0x2d')]('[syncMusicOnHoldStop][VoiceAgentReport]',util['inspect'](_0x5e2a73,{'showHidden':![],'depth':null}));}};module[_0x6215('0x76')]=VoiceAgentReport; \ No newline at end of file +var _0x0661=['syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','isNotNull','isUndefined','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','uniqueid','queue','type','inbound','merge','omit','event','privilege','emit','custom:agentcalled','format','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstatedesc','interface','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswer','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','inspect','agentringnoanswerAt','rejected','custom:agentringnoanswer','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','complete','talktime','agent','acw','acwtime','acwTimeout','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','isNil','transfer','custom:voiceAgentReport','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','channel','substring','[syncMusicOnHoldStart][VoiceAgentReport]','lastIndexOf','onhold','[syncMusicOnHoldStop][VoiceAgentReport]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart'];(function(_0xccfcd5,_0x3ec100){var _0x409989=function(_0x4cf894){while(--_0x4cf894){_0xccfcd5['push'](_0xccfcd5['shift']());}};_0x409989(++_0x3ec100);}(_0x0661,0x162));var _0x1066=function(_0x28ca99,_0x4e900b){_0x28ca99=_0x28ca99-0x0;var _0x57b650=_0x0661[_0x28ca99];return _0x57b650;};'use strict';var _=require(_0x1066('0x0'));var moment=require(_0x1066('0x1'));var util=require('util');var Redis=require(_0x1066('0x2'));var config=require(_0x1066('0x3'));var logger=require(_0x1066('0x4'))('ami');var ami=require('../ami');config[_0x1066('0x5')]=_[_0x1066('0x6')](config[_0x1066('0x5')],{'host':_0x1066('0x7'),'port':0x18eb});var io=require(_0x1066('0x8'))(new Redis(config[_0x1066('0x5')]));function VoiceAgentReport(_0x37c6f5){this[_0x1066('0x9')]={};this[_0x1066('0xa')]=_0x37c6f5[_0x1066('0xa')];this[_0x1066('0xb')]=_0x37c6f5['agents'];this[_0x1066('0xc')]={};ami['on'](_0x1066('0xd'),this[_0x1066('0xe')]['bind'](this));ami['on'](_0x1066('0xf'),this[_0x1066('0x10')][_0x1066('0x11')](this));ami['on']('agentringnoanswer',this[_0x1066('0x12')][_0x1066('0x11')](this));ami['on'](_0x1066('0x13'),this['syncQueueCallerAbandon'][_0x1066('0x11')](this));ami['on'](_0x1066('0x14'),this[_0x1066('0x15')][_0x1066('0x11')](this));ami['on'](_0x1066('0x16'),this[_0x1066('0x17')][_0x1066('0x11')](this));ami['on'](_0x1066('0x18'),this[_0x1066('0x19')][_0x1066('0x11')](this));ami['on'](_0x1066('0x1a'),this[_0x1066('0x1b')][_0x1066('0x11')](this));ami['on']('musiconholdstop',this[_0x1066('0x1c')][_0x1066('0x11')](this));ami['on'](_0x1066('0x1d'),this[_0x1066('0x1e')][_0x1066('0x11')](this));ami['on'](_0x1066('0x1f'),this['syncBlindTransfer'][_0x1066('0x11')](this));}VoiceAgentReport[_0x1066('0x20')]['emit']=function(_0x4cfe46,_0x2ed4c1,_0x12e19e){io['to'](_0x4cfe46)['emit'](_0x2ed4c1,_0x12e19e);};VoiceAgentReport['prototype'][_0x1066('0x21')]=function(_0x3fee64){return _0x3fee64!==null&&!_[_0x1066('0x22')](_0x3fee64);};VoiceAgentReport[_0x1066('0x20')]['syncAgentCalled']=function(_0x3c53da){try{if(this[_0x1066('0x21')](_0x3c53da)){if(_[_0x1066('0x22')](this[_0x1066('0x9')][_0x3c53da['uniqueid']])){this[_0x1066('0x9')][_0x3c53da['uniqueid']]={};}if(_[_0x1066('0x22')](this[_0x1066('0x9')][_0x3c53da['uniqueid']][_0x3c53da[_0x1066('0x23')]])){this[_0x1066('0x9')][_0x3c53da['uniqueid']][_0x3c53da['destuniqueid']]={'agentcalledAt':moment()['format'](_0x1066('0x24')),'lastevent':_0x1066('0x25'),'variables':this[_0x1066('0xc')][_0x3c53da[_0x1066('0x26')]],'type':this[_0x1066('0xa')][_0x3c53da['queue']]?this['voiceQueues'][_0x3c53da[_0x1066('0x27')]][_0x1066('0x28')]||_0x1066('0x29'):_0x1066('0x29')};}_[_0x1066('0x2a')](this[_0x1066('0x9')][_0x3c53da[_0x1066('0x26')]][_0x3c53da[_0x1066('0x23')]],_[_0x1066('0x2b')](_0x3c53da,[_0x1066('0x2c'),_0x1066('0x2d')]));ami[_0x1066('0x2e')](_0x1066('0x2f'),this[_0x1066('0x9')][_0x3c53da[_0x1066('0x26')]][_0x3c53da['destuniqueid']]);this[_0x1066('0x2e')](util[_0x1066('0x30')](_0x1066('0x31'),_0x3c53da[_0x1066('0x32')]),_0x1066('0x33'),this[_0x1066('0x9')][_0x3c53da[_0x1066('0x26')]][_0x3c53da[_0x1066('0x23')]]);}}catch(_0x1c806d){logger[_0x1066('0x34')](_0x1066('0x35'),util['inspect'](_0x1c806d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x10')]=function(_0x2b5a44){try{if(this[_0x1066('0x21')](_0x2b5a44)){if(this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]]){for(var _0x197b5d in this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]]){if(this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x1066('0x36')](_0x197b5d)){if(_0x2b5a44[_0x1066('0x23')]===_0x197b5d){this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d][_0x1066('0x37')]=moment()[_0x1066('0x30')](_0x1066('0x24'));this[_0x1066('0x9')][_0x2b5a44['uniqueid']][_0x197b5d][_0x1066('0x38')]=_0x1066('0x39');this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d][_0x1066('0x3a')]=_0x2b5a44[_0x1066('0x3a')];this[_0x1066('0x9')][_0x2b5a44['uniqueid']][_0x197b5d]['connectedlinenum']=_0x2b5a44[_0x1066('0x3b')];this[_0x1066('0x9')][_0x2b5a44['uniqueid']][_0x197b5d][_0x1066('0x3c')]=_0x2b5a44[_0x1066('0x3c')];this['channels'][_0x2b5a44[_0x1066('0x26')]][_0x197b5d]['destchannelstate']=_0x2b5a44['destchannelstate'];this['channels'][_0x2b5a44[_0x1066('0x26')]][_0x197b5d]['destchannelstatedesc']=_0x2b5a44[_0x1066('0x3d')];_[_0x1066('0x2a')](this[_0x1066('0xb')][_0x2b5a44[_0x1066('0x3e')]],_['pick'](_0x2b5a44,[_0x1066('0x27'),_0x1066('0x3f')]));this[_0x1066('0x2e')](util[_0x1066('0x30')]('user:%s',_0x2b5a44['membername']),_0x1066('0x40'),this['channels'][_0x2b5a44[_0x1066('0x26')]][_0x2b5a44['destuniqueid']]);ami[_0x1066('0x2e')](_0x1066('0x41'),this[_0x1066('0x9')][_0x2b5a44['uniqueid']][_0x197b5d]);}else if(!this['channels'][_0x2b5a44['uniqueid']][_0x197b5d][_0x1066('0x42')]&&!this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d][_0x1066('0x14')]){this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d]['agentringnoanswer']=!![];this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d]['agentringnoanswerAt']=moment()[_0x1066('0x30')](_0x1066('0x24'));this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d][_0x1066('0x43')]=_0x1066('0x44');this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d]['lastevent']=_0x1066('0x44');this['channels'][_0x2b5a44[_0x1066('0x26')]][_0x197b5d][_0x1066('0x45')]=_0x2b5a44[_0x1066('0x23')];this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d][_0x1066('0x46')]=_0x2b5a44[_0x1066('0x32')];ami['emit'](_0x1066('0x47'),this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d]);}}}}}}catch(_0x18a57b){logger[_0x1066('0x34')](_0x1066('0x48'),util[_0x1066('0x49')](_0x18a57b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x12')]=function(_0x3b05ec){try{if(this[_0x1066('0x21')](_0x3b05ec)){if(this['channels'][_0x3b05ec[_0x1066('0x26')]]&&this['channels'][_0x3b05ec[_0x1066('0x26')]][_0x3b05ec[_0x1066('0x23')]]){this[_0x1066('0x9')][_0x3b05ec[_0x1066('0x26')]][_0x3b05ec[_0x1066('0x23')]][_0x1066('0x42')]=!![];this[_0x1066('0x9')][_0x3b05ec['uniqueid']][_0x3b05ec[_0x1066('0x23')]][_0x1066('0x4a')]=moment()[_0x1066('0x30')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3b05ec[_0x1066('0x26')]][_0x3b05ec[_0x1066('0x23')]][_0x1066('0x43')]='rejected';this[_0x1066('0x9')][_0x3b05ec[_0x1066('0x26')]][_0x3b05ec[_0x1066('0x23')]]['lastevent']=_0x1066('0x4b');ami[_0x1066('0x2e')](_0x1066('0x4c'),this[_0x1066('0x9')][_0x3b05ec[_0x1066('0x26')]][_0x3b05ec[_0x1066('0x23')]]);}}}catch(_0x31eb9c){logger[_0x1066('0x34')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x1066('0x49')](_0x31eb9c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x4d')]=function(_0x258dd2){try{if(this[_0x1066('0x21')](_0x258dd2)){if(this[_0x1066('0x9')][_0x258dd2[_0x1066('0x26')]]){for(var _0x5f50d3 in this['channels'][_0x258dd2[_0x1066('0x26')]]){if(this['channels'][_0x258dd2[_0x1066('0x26')]]['hasOwnProperty'](_0x5f50d3)&&!this[_0x1066('0x9')][_0x258dd2[_0x1066('0x26')]][_0x5f50d3]['agentringnoanswer']&&!this[_0x1066('0x9')][_0x258dd2[_0x1066('0x26')]][_0x5f50d3][_0x1066('0x14')]){this['channels'][_0x258dd2[_0x1066('0x26')]][_0x5f50d3]['agentringnoanswer']=!![];this[_0x1066('0x9')][_0x258dd2['uniqueid']][_0x5f50d3][_0x1066('0x4a')]=moment()[_0x1066('0x30')](_0x1066('0x24'));this[_0x1066('0x9')][_0x258dd2[_0x1066('0x26')]][_0x5f50d3]['reason']=_0x1066('0x4e');this[_0x1066('0x9')][_0x258dd2[_0x1066('0x26')]][_0x5f50d3][_0x1066('0x38')]='abandoned';ami[_0x1066('0x2e')](_0x1066('0x4f'),this[_0x1066('0x9')][_0x258dd2[_0x1066('0x26')]][_0x5f50d3]);}}}}}catch(_0xa8d001){logger[_0x1066('0x34')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x1066('0x49')](_0xa8d001,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x15')]=function(_0x25229e){try{if(this[_0x1066('0x21')](_0x25229e)){if(this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]]){for(var _0x4d969c in this['channels'][_0x25229e[_0x1066('0x26')]]){if(this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x1066('0x36')](_0x4d969c)){if(this['channels'][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x37')]&&!this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x14')]){this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x14')]=!![];this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x50')]=moment()[_0x1066('0x30')](_0x1066('0x24'));this['channels'][_0x25229e[_0x1066('0x26')]][_0x4d969c]['lastevent']=_0x1066('0x51');this['channels'][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x52')]=_0x25229e[_0x1066('0x52')];this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x43')]=_0x25229e[_0x1066('0x43')]=='transfer'?_0x1066('0x53'):_0x25229e[_0x1066('0x43')];if(this['voiceQueues'][_0x25229e[_0x1066('0x27')]]&&this['voiceQueues'][_0x25229e[_0x1066('0x27')]][_0x1066('0x54')]){this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c]['agentacw']=!![];this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x55')]=this[_0x1066('0xa')][_0x25229e[_0x1066('0x27')]][_0x1066('0x56')];}this[_0x1066('0xb')][_0x25229e[_0x1066('0x3e')]]=_['omit'](this[_0x1066('0xb')][_0x25229e[_0x1066('0x3e')]],[_0x1066('0x27'),_0x1066('0x3f')]);this[_0x1066('0x2e')](util[_0x1066('0x30')](_0x1066('0x31'),_0x25229e[_0x1066('0x32')]),_0x1066('0x57'),this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c]);ami[_0x1066('0x2e')](_0x1066('0x58'),this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c]);}}}}}}catch(_0x21fa3b){logger['error'](_0x1066('0x59'),util[_0x1066('0x49')](_0x21fa3b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1066('0x17')]=function(_0xf70a0c){try{if(this[_0x1066('0x21')](_0xf70a0c)){this[_0x1066('0x5a')](_0xf70a0c[_0x1066('0x26')],_[_0x1066('0x5b')](_0xf70a0c[_0x1066('0x5c')])[0x0],_0xf70a0c[_0x1066('0x5d')]);if(this[_0x1066('0x9')][_0xf70a0c[_0x1066('0x26')]]){for(var _0x15f208 in this[_0x1066('0x9')][_0xf70a0c[_0x1066('0x26')]]){if(this[_0x1066('0x9')][_0xf70a0c[_0x1066('0x26')]][_0x1066('0x36')](_0x15f208)){if(_[_0x1066('0x22')](this[_0x1066('0x9')][_0xf70a0c[_0x1066('0x26')]][_0x15f208]['variables'])){this[_0x1066('0x9')][_0xf70a0c['uniqueid']][_0x15f208][_0x1066('0xc')]={};}this[_0x1066('0x9')][_0xf70a0c[_0x1066('0x26')]][_0x15f208]['variables']=this[_0x1066('0xc')][_0xf70a0c[_0x1066('0x26')]];}}}}}catch(_0xa97c5d){logger[_0x1066('0x34')](_0x1066('0x5e'),util[_0x1066('0x49')](_0xa97c5d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x5a')]=function(_0x153743,_0x1b56b7,_0x2e7b01){var _0x346295=[_0x1066('0x5f'),_0x1066('0x60'),_0x1066('0x61'),_0x1066('0x62'),_0x1066('0x63'),_0x1066('0x64'),_0x1066('0x65'),'rtpaudioqosrttbridged',_0x1066('0x66'),_0x1066('0x67'),_0x1066('0x68'),_0x1066('0x69'),_0x1066('0x6a'),_0x1066('0x6b'),_0x1066('0x6c'),_0x1066('0x6d'),_0x1066('0x32'),'memberpenalty','memberrealtime'];if(!_[_0x1066('0x6e')](_0x1b56b7)&&!_['includes'](_0x346295,_0x1b56b7)){if(_['isUndefined'](this[_0x1066('0xc')][_0x153743])){this[_0x1066('0xc')][_0x153743]={};}this['variables'][_0x153743][_0x1b56b7]=_0x2e7b01;}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x19')]=function(_0x4d7301){try{if(this[_0x1066('0x21')](_0x4d7301)){if(this[_0x1066('0x9')][_0x4d7301[_0x1066('0x26')]]){for(var _0x46634a in this[_0x1066('0x9')][_0x4d7301['uniqueid']]){if(this[_0x1066('0x9')][_0x4d7301[_0x1066('0x26')]][_0x1066('0x36')](_0x46634a)){if(this[_0x1066('0x9')][_0x4d7301[_0x1066('0x26')]][_0x46634a][_0x1066('0x43')]==_0x1066('0x6f')&&this[_0x1066('0x9')][_0x4d7301['uniqueid']][_0x46634a][_0x1066('0x14')]){this['channels'][_0x4d7301[_0x1066('0x26')]][_0x46634a]['agentcompleteAt']=moment()[_0x1066('0x30')](_0x1066('0x24'));}}}ami[_0x1066('0x2e')](_0x1066('0x70'),_['values'](this['channels'][_0x4d7301[_0x1066('0x26')]]));delete this[_0x1066('0x9')][_0x4d7301['uniqueid']];}if(this[_0x1066('0xc')][_0x4d7301[_0x1066('0x26')]]){delete this[_0x1066('0xc')][_0x4d7301[_0x1066('0x26')]];}}}catch(_0xbc6514){logger[_0x1066('0x34')](_0x1066('0x71'),util['inspect'](_0xbc6514,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x1e')]=function(_0x3b1948){try{if(this[_0x1066('0x21')](_0x3b1948)){if(this['channels'][_0x3b1948[_0x1066('0x72')]]){for(var _0x1b3700 in this[_0x1066('0x9')][_0x3b1948[_0x1066('0x72')]]){if(this['channels'][_0x3b1948[_0x1066('0x72')]]['hasOwnProperty'](_0x1b3700)){if(_0x3b1948[_0x1066('0x73')]===_0x1b3700){var _0x1f4030=moment();this[_0x1066('0x9')][_0x3b1948[_0x1066('0x72')]][_0x1b3700][_0x1066('0x14')]=!![];this['channels'][_0x3b1948[_0x1066('0x72')]][_0x1b3700]['agentcompleteAt']=moment()[_0x1066('0x30')](_0x1066('0x24'));this['channels'][_0x3b1948['transfereeuniqueid']][_0x1b3700][_0x1066('0x43')]=_0x1066('0x6f');this[_0x1066('0x9')][_0x3b1948['transfereeuniqueid']][_0x1b3700][_0x1066('0x38')]=_0x1066('0x51');this[_0x1066('0x9')][_0x3b1948[_0x1066('0x72')]][_0x1b3700][_0x1066('0x52')]=_0x1f4030[_0x1066('0x74')](this[_0x1066('0x9')][_0x3b1948['transfereeuniqueid']][_0x1b3700]['agentconnectAt'],'seconds');}}}}if(this['channels'][_0x3b1948[_0x1066('0x75')]]){var _0x245971=this[_0x1066('0x9')][_0x3b1948[_0x1066('0x75')]];this[_0x1066('0x9')][_0x3b1948[_0x1066('0x75')]]=this[_0x1066('0x9')][_0x3b1948['transfereeuniqueid']];this[_0x1066('0x9')][_0x3b1948[_0x1066('0x72')]]=_0x245971;}}}catch(_0x468e45){logger[_0x1066('0x34')](_0x1066('0x76'),util[_0x1066('0x49')](_0x468e45,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x77')]=function(_0x16756b){try{if(this[_0x1066('0x21')](_0x16756b)){if(this[_0x1066('0x9')][_0x16756b['transfereeuniqueid']]){for(var _0x2ca028 in this[_0x1066('0x9')][_0x16756b[_0x1066('0x72')]]){if(this[_0x1066('0x9')][_0x16756b['transfereeuniqueid']][_0x1066('0x36')](_0x2ca028)){if(_0x16756b[_0x1066('0x78')]===_0x2ca028){var _0x15e397=moment();this['channels'][_0x16756b[_0x1066('0x72')]][_0x2ca028]['agentcomplete']=!![];this[_0x1066('0x9')][_0x16756b[_0x1066('0x72')]][_0x2ca028][_0x1066('0x50')]=_0x15e397;this[_0x1066('0x9')][_0x16756b[_0x1066('0x72')]][_0x2ca028][_0x1066('0x43')]=_0x1066('0x6f');this[_0x1066('0x9')][_0x16756b[_0x1066('0x72')]][_0x2ca028][_0x1066('0x38')]=_0x1066('0x51');this['channels'][_0x16756b['transfereeuniqueid']][_0x2ca028]['talktime']=_0x15e397[_0x1066('0x74')](this[_0x1066('0x9')][_0x16756b[_0x1066('0x72')]][_0x2ca028]['agentconnectAt'],'seconds');}}}}}}catch(_0x2218c6){logger[_0x1066('0x34')]('[syncBlindTransfer][VoiceAgentReport]',util[_0x1066('0x49')](_0x2218c6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')]['syncMusicOnHoldStart']=function(_0x1fc0c0){var _0x4073a3='';try{if(this[_0x1066('0x21')](_0x1fc0c0)){if(_0x1fc0c0[_0x1066('0x79')]){_0x4073a3=_0x1fc0c0[_0x1066('0x79')][_0x1066('0x7a')](0x0,_0x1fc0c0['channel']['lastIndexOf']('-'));if(this['agents'][_0x4073a3]){this['agents'][_0x4073a3]['onhold']=!![];}}}}catch(_0x466c5a){logger[_0x1066('0x34')](_0x1066('0x7b'),util[_0x1066('0x49')](_0x466c5a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x1c')]=function(_0x640029){var _0x4103bd='';try{if(this[_0x1066('0x21')](_0x640029)){if(_0x640029[_0x1066('0x79')]){_0x4103bd=_0x640029[_0x1066('0x79')][_0x1066('0x7a')](0x0,_0x640029[_0x1066('0x79')][_0x1066('0x7c')]('-'));if(this['agents'][_0x4103bd]){this[_0x1066('0xb')][_0x4103bd][_0x1066('0x7d')]=![];}}}}catch(_0x5798b8){logger[_0x1066('0x34')](_0x1066('0x7e'),util[_0x1066('0x49')](_0x5798b8,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 4caefed..3925e88 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 _0x212b=['sipcalluniqueid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','billableseconds','omit','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','moment','util','path','ioredis','../../../config/logger','ami','../ami','unknown','not_inuse','inuse','invalid','unavailable','ringinuse','onhold','set','agi','dial','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','prototype','isUndefined','isNotNull','uniqueid','linkedid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','destconnectedlinenum','exten','emit','name','split','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','appdata','applicationdata','subtract','duration','seconds','lastdata','cdr(','match','queue','[syncNewExten][VoiceCallReport]','inspect','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','monitor','endsWith','.wav49','replace','monitorFilename','isNil','monitors','push','rec','variable','mixmonitor_filename','syncMixMonitorFilename','value','xmd-phone','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid'];(function(_0x42e9df,_0x4140e0){var _0x1f425a=function(_0x3dd725){while(--_0x3dd725){_0x42e9df['push'](_0x42e9df['shift']());}};_0x1f425a(++_0x4140e0);}(_0x212b,0x148));var _0xb212=function(_0x557353,_0x230e10){_0x557353=_0x557353-0x0;var _0x4869e9=_0x212b[_0x557353];return _0x4869e9;};'use strict';var BPromise=require(_0xb212('0x0'));var _=require('lodash');var moment=require(_0xb212('0x1'));var util=require(_0xb212('0x2'));var path=require(_0xb212('0x3'));var Redis=require(_0xb212('0x4'));var config=require('../../../config/environment');var logger=require(_0xb212('0x5'))(_0xb212('0x6'));var ami=require(_0xb212('0x7'));var Channel=require('../model/channel');var statusDesc=[_0xb212('0x8'),_0xb212('0x9'),_0xb212('0xa'),'busy',_0xb212('0xb'),_0xb212('0xc'),'ringing',_0xb212('0xd'),_0xb212('0xe')];var applications=[_0xb212('0xf'),'queue',_0xb212('0x10'),_0xb212('0x11'),'playback','voicemail'];var dispositions=['NO\x20ANSWER',_0xb212('0x12'),'FAILED',_0xb212('0x13'),_0xb212('0x13'),_0xb212('0x13'),_0xb212('0x14'),_0xb212('0x15'),_0xb212('0x12'),_0xb212('0x12'),_0xb212('0x12')];var actions={};config[_0xb212('0x16')]=_[_0xb212('0x17')](config[_0xb212('0x16')],{'host':_0xb212('0x18'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x5c56e2){this['channels']=_0x5c56e2[_0xb212('0x19')];this[_0xb212('0x1a')]=_0x5c56e2[_0xb212('0x1a')];ami['on']('coreshowchannel',this[_0xb212('0x1b')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x1d'),this[_0xb212('0x1b')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x1e'),this[_0xb212('0x1f')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x20'),this[_0xb212('0x21')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x22'),this[_0xb212('0x23')]['bind'](this));ami['on']('hangup',this[_0xb212('0x24')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x25'),this[_0xb212('0x26')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x27'),this[_0xb212('0x28')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x29'),this[_0xb212('0x2a')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x2b'),this[_0xb212('0x2c')]['bind'](this));ami['on']('musiconholdstop',this[_0xb212('0x2d')][_0xb212('0x1c')](this));return BPromise[_0xb212('0x2e')]()[_0xb212('0x2f')](ami[_0xb212('0x30')]())[_0xb212('0x31')](function(_0x2aafe4){console['log'](_0x2aafe4);});}VoiceCallReport[_0xb212('0x32')]['isNotNull']=function(_0xd1180f){return _0xd1180f!==null&&!_[_0xb212('0x33')](_0xd1180f);};VoiceCallReport[_0xb212('0x32')]['emit']=function(_0x43d4b6,_0x2f9c0e,_0x42df2d){io['to'](_0x43d4b6)['emit'](_0x2f9c0e,_0x42df2d);};VoiceCallReport[_0xb212('0x32')][_0xb212('0x26')]=function(_0x882231){try{if(this[_0xb212('0x34')](_0x882231)){if(_0x882231[_0xb212('0x35')]===_0x882231[_0xb212('0x36')]){if(!_[_0xb212('0x33')](this[_0xb212('0x19')][_0x882231[_0xb212('0x35')]])){_[_0xb212('0x37')](this[_0xb212('0x19')][_0x882231[_0xb212('0x35')]],_[_0xb212('0x38')](_0x882231,_[_0xb212('0x39')](this[_0xb212('0x19')][_0x882231['uniqueid']])));}}}}catch(_0x4e727f){logger[_0xb212('0x3a')](_0xb212('0x3b'),util['inspect'](_0x4e727f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x1f')]=function(_0x36ce04){try{if(this[_0xb212('0x34')](_0x36ce04)){if(_0x36ce04[_0xb212('0x35')]===_0x36ce04[_0xb212('0x36')]&&_0x36ce04[_0xb212('0x3c')]!=_0xb212('0x3d')){if(_['isUndefined'](this['channels'][_0x36ce04[_0xb212('0x35')]])){this[_0xb212('0x19')][_0x36ce04[_0xb212('0x35')]]=new Channel();this[_0xb212('0x19')][_0x36ce04[_0xb212('0x35')]][_0xb212('0x3e')]=moment()[_0xb212('0x3f')](_0xb212('0x40'));this[_0xb212('0x19')][_0x36ce04[_0xb212('0x35')]][_0xb212('0x41')]=dispositions[_[_0xb212('0x42')](_0x36ce04[_0xb212('0x43')])];_['merge'](this[_0xb212('0x19')][_0x36ce04[_0xb212('0x35')]],_[_0xb212('0x38')](_0x36ce04,_[_0xb212('0x39')](this[_0xb212('0x19')][_0x36ce04['uniqueid']])));if(_0x36ce04[_0xb212('0x44')]===_0xb212('0x45')){if(this['agents'][_0x36ce04[_0xb212('0x3c')]['split']('-')[0x0]]){this[_0xb212('0x1a')][_0x36ce04[_0xb212('0x3c')]['split']('-')[0x0]][_0xb212('0x46')]=_0x36ce04[_0xb212('0x47')];this[_0xb212('0x48')](util[_0xb212('0x3f')]('user:%s',this[_0xb212('0x1a')][_0x36ce04[_0xb212('0x3c')]['split']('-')[0x0]][_0xb212('0x49')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x36ce04[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]][_0xb212('0x4b')],'destconnectedlinenum':_0x36ce04[_0xb212('0x47')]});}}}}}}catch(_0x2da0fc){logger[_0xb212('0x3a')](_0xb212('0x4c'),util['inspect'](_0x2da0fc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x1b')]=function(_0x104b36){try{if(this[_0xb212('0x34')](_0x104b36)){if(_0x104b36['uniqueid']===_0x104b36[_0xb212('0x36')]&&_0x104b36['exten']!='h'&&_0x104b36['channel']!=_0xb212('0x3d')){_0x104b36[_0xb212('0x4d')]=_0x104b36[_0xb212('0x4d')][_0xb212('0x4e')]();_0x104b36['applicationdata']=(_0x104b36[_0xb212('0x4f')]||_0x104b36[_0xb212('0x50')])[_0xb212('0x4e')]();if(_[_0xb212('0x33')](this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]])){this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]]=new Channel();this[_0xb212('0x19')][_0x104b36['uniqueid']][_0xb212('0x3e')]=_0x104b36['duration']?moment()[_0xb212('0x51')](moment['duration'](_0x104b36[_0xb212('0x52')])[_0xb212('0x53')](),'seconds')[_0xb212('0x3f')](_0xb212('0x40')):moment()[_0xb212('0x3f')](_0xb212('0x40'));this[_0xb212('0x19')][_0x104b36['uniqueid']]['disposition']=_0xb212('0x13');}_[_0xb212('0x37')](this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]],_[_0xb212('0x38')](_0x104b36,_[_0xb212('0x39')](this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]])));if(_['includes'](applications,_0x104b36['application'])){this['channels'][_0x104b36[_0xb212('0x35')]]['lastapplication']=_0x104b36[_0xb212('0x4d')];this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]][_0xb212('0x54')]=_0x104b36[_0xb212('0x50')];if(_0x104b36[_0xb212('0x4d')]===_0xb212('0xf')&&_['startsWith'](_0x104b36['applicationdata'],_0xb212('0x55'))){var _0x38cb6f=_0x104b36[_0xb212('0x50')]['split']('=');var _0x85db9b=_0x38cb6f[0x0][_0xb212('0x56')](/cdr\((.*)\)/);if(_0x85db9b){this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]][_0x85db9b[0x1]]=_0x38cb6f[0x1];}}else if(_0x104b36[_0xb212('0x4d')]===_0xb212('0x57')){this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]]['queue']=_0x104b36[_0xb212('0x50')][_0xb212('0x4a')](',')[0x0];}}}}}catch(_0x29bf2b){logger[_0xb212('0x3a')](_0xb212('0x58'),util[_0xb212('0x59')](_0x29bf2b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x21')]=function(_0x59d707){try{if(this['isNotNull'](_0x59d707)){if(_0x59d707[_0xb212('0x35')]!==_0x59d707[_0xb212('0x36')]){if(this['channels'][_0x59d707[_0xb212('0x36')]]){if(_0x59d707[_0xb212('0x43')]==='6'){if(!this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x5a')]){var _0x4a8110=moment();this['channels'][_0x59d707['linkedid']][_0xb212('0x5a')]=!![];this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x5b')]=_0x4a8110[_0xb212('0x3f')](_0xb212('0x40'));if(this['channels'][_0x59d707[_0xb212('0x36')]]['starttime']){this['channels'][_0x59d707[_0xb212('0x36')]][_0xb212('0x5c')]=_0x4a8110[_0xb212('0x5d')](this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x3e')],_0xb212('0x53'));}}this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x36')]=_0x59d707[_0xb212('0x35')];if(_0x59d707[_0xb212('0x5e')]!==_0xb212('0x5f')){this[_0xb212('0x19')][_0x59d707['linkedid']]['connectedlinenum']=_0x59d707['calleridnum'];}this['channels'][_0x59d707[_0xb212('0x36')]]['connectedlinename']=_0x59d707[_0xb212('0x60')];this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x61')]=_0x59d707[_0xb212('0x3c')];this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x41')]=dispositions[_[_0xb212('0x42')](_0x59d707[_0xb212('0x43')])];if(this['agents'][_0x59d707[_0xb212('0x3c')]['split']('-')[0x0]]){this['channels'][_0x59d707[_0xb212('0x36')]][_0xb212('0x62')]=this['agents'][_0x59d707[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]]['id'];this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x63')]=this[_0xb212('0x1a')][_0x59d707[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]][_0xb212('0x49')];}}}}else{if(this[_0xb212('0x19')][_0x59d707[_0xb212('0x35')]]){if(_0x59d707['channelstate']==='6'){if(this[_0xb212('0x1a')][_0x59d707[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]]){this[_0xb212('0x19')][_0x59d707[_0xb212('0x35')]][_0xb212('0x62')]=this['agents'][_0x59d707[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]]['id'];this[_0xb212('0x19')][_0x59d707[_0xb212('0x35')]][_0xb212('0x63')]=this[_0xb212('0x1a')][_0x59d707[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]][_0xb212('0x49')];}}}}}}catch(_0x8b5088){logger['error'](_0xb212('0x64'),util['inspect'](_0x8b5088,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')]['syncMixMonitorFilename']=function(_0x21a052,_0x19d342){if(this[_0xb212('0x19')][_0x21a052]){this[_0xb212('0x19')][_0x21a052][_0xb212('0x65')]=!![];if(_[_0xb212('0x66')](_0x19d342,_0xb212('0x67'))){_0x19d342=_0x19d342[_0xb212('0x68')](_0xb212('0x67'),'.WAV');}this[_0xb212('0x19')][_0x21a052][_0xb212('0x69')]=_0x19d342;var _0x214b2b=_['find'](this[_0xb212('0x19')][_0x21a052]['monitors'],{'filename':_0x19d342});if(_[_0xb212('0x6a')](_0x214b2b)){this[_0xb212('0x19')][_0x21a052][_0xb212('0x6b')][_0xb212('0x6c')]({'filename':_0x19d342,'createdAt':moment()[_0xb212('0x3f')](_0xb212('0x40')),'mixmonitorid':'','status':_0xb212('0x6d')});}}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x23')]=function(_0x401b60){try{if(this[_0xb212('0x34')](_0x401b60)){if(this[_0xb212('0x19')][_0x401b60['uniqueid']]&&_0x401b60[_0xb212('0x3c')]!=_0xb212('0x3d')){if(this['isNotNull'](_0x401b60[_0xb212('0x6e')])){if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')][_0xb212('0x6f')])){this[_0xb212('0x70')](_0x401b60[_0xb212('0x35')],_0x401b60[_0xb212('0x71')]);}else if(this['isNotNull'](_0x401b60[_0xb212('0x6e')][_0xb212('0x72')])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]]['calleridnum']=_0x401b60[_0xb212('0x71')];}else if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')]['xmd-callerid'])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]]['callerid']=_0x401b60[_0xb212('0x71')];}else if(this[_0xb212('0x34')](_0x401b60['variable'][_0xb212('0x73')])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]][_0xb212('0x74')]=_0x401b60[_0xb212('0x71')];}else if(this[_0xb212('0x34')](_0x401b60['variable'][_0xb212('0x75')])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]][_0xb212('0x57')]=_0x401b60['value'][_0xb212('0x4a')](',')[0x0];}else if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')][_0xb212('0x76')])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]][_0xb212('0x77')]=_0x401b60[_0xb212('0x71')];}else if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')]['xmd-destination'])){this['channels'][_0x401b60[_0xb212('0x35')]][_0xb212('0x78')]=_0x401b60[_0xb212('0x71')];}else if(this['isNotNull'](_0x401b60['variable'][_0xb212('0x79')])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]][_0xb212('0x7a')]=_0x401b60[_0xb212('0x71')];}else if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')][_0xb212('0x7b')])){this[_0xb212('0x19')][_0x401b60['uniqueid']][_0xb212('0x57')]=_0x401b60[_0xb212('0x71')];}else if(this['isNotNull'](_0x401b60['variable'][_0xb212('0x7c')])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]][_0xb212('0x7d')]=_0x401b60['value'];}}}else if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')][_0xb212('0x6f')])){if(_0x401b60[_0xb212('0x71')]){var _0x103b92=path['parse'](_0x401b60[_0xb212('0x71')])['name'];this[_0xb212('0x70')](_0x103b92,_0x401b60['value']);}}else if(this[_0xb212('0x19')][_0x401b60[_0xb212('0x36')]]){if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')])){if(this['isNotNull'](_0x401b60[_0xb212('0x6e')]['sipcallid'])){this['channels'][_0x401b60['linkedid']][_0xb212('0x7e')]=_0x401b60[_0xb212('0x71')];}}}}}catch(_0x1724bd){logger[_0xb212('0x3a')](_0xb212('0x7f'),util[_0xb212('0x59')](_0x1724bd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x24')]=function(_0x386e2f){try{if(this['isNotNull'](_0x386e2f)){if(this['channels'][_0x386e2f[_0xb212('0x35')]]){var _0x3ebadb=moment();this['channels'][_0x386e2f[_0xb212('0x35')]]['endtime']=_0x3ebadb[_0xb212('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb212('0x19')][_0x386e2f[_0xb212('0x35')]][_0xb212('0x52')]=_0x3ebadb['diff'](this[_0xb212('0x19')][_0x386e2f[_0xb212('0x35')]][_0xb212('0x3e')],_0xb212('0x53'));if(this[_0xb212('0x19')][_0x386e2f[_0xb212('0x35')]]['answered']){this[_0xb212('0x19')][_0x386e2f['uniqueid']][_0xb212('0x80')]=_0x3ebadb[_0xb212('0x5d')](this['channels'][_0x386e2f[_0xb212('0x35')]][_0xb212('0x5b')],_0xb212('0x53'));this[_0xb212('0x19')][_0x386e2f['uniqueid']][_0xb212('0x5c')]=this['channels'][_0x386e2f[_0xb212('0x35')]]['duration']-this['channels'][_0x386e2f[_0xb212('0x35')]][_0xb212('0x80')];}if(_0x386e2f[_0xb212('0x44')]===_0xb212('0x45')){if(this[_0xb212('0x1a')][_0x386e2f['channel'][_0xb212('0x4a')]('-')[0x0]]){this[_0xb212('0x1a')][_0x386e2f['channel'][_0xb212('0x4a')]('-')[0x0]]=_[_0xb212('0x81')](this[_0xb212('0x1a')][_0x386e2f[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]],['destconnectedlinenum']);this[_0xb212('0x48')](util[_0xb212('0x3f')]('user:%s',this[_0xb212('0x1a')][_0x386e2f['channel'][_0xb212('0x4a')]('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0xb212('0x1a')][_0x386e2f[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]]['accountcode']});}}ami[_0xb212('0x48')]('custom:voiceCallReport',this[_0xb212('0x19')][_0x386e2f[_0xb212('0x35')]]);delete this[_0xb212('0x19')][_0x386e2f['uniqueid']];}}}catch(_0x2b4a8d){logger[_0xb212('0x3a')](_0xb212('0x82'),util['inspect'](_0x2b4a8d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xb212('0x28')]=function(_0xf3aa88){try{if(this[_0xb212('0x34')](_0xf3aa88)){if(this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x83')]]){this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x83')]][_0xb212('0x84')]=_0xf3aa88[_0xb212('0x85')];this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x83')]][_0xb212('0x86')]=_0xf3aa88['transfertargetcalleridnum'];if(this[_0xb212('0x19')][_0xf3aa88['secondtransfereruniqueid']]){var _0x2ca534=this[_0xb212('0x19')][_0xf3aa88['secondtransfereruniqueid']];this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x87')]]=this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x83')]];this[_0xb212('0x19')][_0xf3aa88['transfereeuniqueid']]=_0x2ca534;}}else if(this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x88')]]){this['channels'][_0xf3aa88[_0xb212('0x88')]][_0xb212('0x84')]=_0xf3aa88[_0xb212('0x85')];this['channels'][_0xf3aa88[_0xb212('0x88')]][_0xb212('0x86')]=_0xf3aa88[_0xb212('0x89')];if(this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x8a')]]){var _0x2ca534=this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x8a')]];this[_0xb212('0x19')][_0xf3aa88['origtransfereruniqueid']]=this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x88')]];this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x88')]]=_0x2ca534;}}}}catch(_0x524401){logger[_0xb212('0x3a')](_0xb212('0x8b'),util[_0xb212('0x59')](_0x524401,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x2a')]=function(_0x8872af){try{if(this[_0xb212('0x34')](_0x8872af)){if(this[_0xb212('0x19')][_0x8872af[_0xb212('0x83')]]){this['channels'][_0x8872af[_0xb212('0x83')]][_0xb212('0x84')]=_0x8872af[_0xb212('0x8c')];this['channels'][_0x8872af[_0xb212('0x83')]]['transferconnectedlinenum']=_0x8872af[_0xb212('0x8d')];this[_0xb212('0x24')]({'event':_0xb212('0x8e'),'uniqueid':_0x8872af[_0xb212('0x83')],'context':_0x8872af['context'],'channel':_0x8872af[_0xb212('0x8f')]});}}}catch(_0x3362f2){logger[_0xb212('0x3a')](_0xb212('0x90'),util['inspect'](_0x3362f2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x2c')]=function(_0x56fa3c){try{if(this[_0xb212('0x34')](_0x56fa3c)){if(this[_0xb212('0x19')][_0x56fa3c[_0xb212('0x35')]]){if(!_[_0xb212('0x6a')](this[_0xb212('0x19')][_0x56fa3c[_0xb212('0x35')]][_0xb212('0x5b')])){this[_0xb212('0x19')][_0x56fa3c['uniqueid']][_0xb212('0x91')]=moment()['format'](_0xb212('0x40'));}}}}catch(_0x3a28cf){logger['error'](_0xb212('0x92'),util[_0xb212('0x59')](_0x3a28cf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x2d')]=function(_0x1dfbcb){try{if(this['isNotNull'](_0x1dfbcb)){if(this[_0xb212('0x19')][_0x1dfbcb[_0xb212('0x35')]]){if(!_[_0xb212('0x6a')](this['channels'][_0x1dfbcb[_0xb212('0x35')]][_0xb212('0x91')])){this[_0xb212('0x19')][_0x1dfbcb[_0xb212('0x35')]][_0xb212('0x93')]+=moment()[_0xb212('0x94')](0x0)[_0xb212('0x5d')](this[_0xb212('0x19')][_0x1dfbcb[_0xb212('0x35')]][_0xb212('0x91')],'seconds');delete this['channels'][_0x1dfbcb[_0xb212('0x35')]][_0xb212('0x91')];}}}}catch(_0x553490){logger[_0xb212('0x3a')](_0xb212('0x95'),util[_0xb212('0x59')](_0x553490,{'showHidden':![],'depth':null}));}};module[_0xb212('0x96')]=VoiceCallReport; \ No newline at end of file +var _0x3836=['secondtransfereruniqueid','transfertargetuniqueid','origtransferercalleridnum','syncBlindTransfer','transfercalleridnum','transfereecalleridnum','extension','syncHangup','BlindTransfer','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','defaults','redis','localhost','socket.io-emitter','channels','agents','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','actionCoreShowChannels','catch','log','prototype','isNotNull','emit','linkedid','isUndefined','merge','uniqueid','keys','error','[syncNewCallerId][VoiceCallReport]','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','pick','context','from-sip','channel','destconnectedlinenum','exten','user:%s','split','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','inspect','application','toLowerCase','applicationdata','appdata','subtract','duration','seconds','disposition','includes','lastdata','startsWith','cdr(','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','calleridnum','xcally-motion-preview','connectedlinename','calleridname','UserId','membername','monitor','endsWith','.wav49','.WAV','monitorFilename','find','isNil','monitors','push','rec','variable','mixmonitor_filename','syncMixMonitorFilename','value','xmd-phone','xmd-callerid','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','calleridpreview','xmcs-queue','sipcallid','[syncVarSet][VoiceCallReport]','endtime','diff','billableseconds','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transferconnectedlinenum','transfertargetcalleridnum'];(function(_0xf5c7bf,_0x3a157d){var _0x1425e6=function(_0x1124f1){while(--_0x1124f1){_0xf5c7bf['push'](_0xf5c7bf['shift']());}};_0x1425e6(++_0x3a157d);}(_0x3836,0x140));var _0x6383=function(_0x4ff145,_0x514ca9){_0x4ff145=_0x4ff145-0x0;var _0x159db2=_0x3836[_0x4ff145];return _0x159db2;};'use strict';var BPromise=require(_0x6383('0x0'));var _=require('lodash');var moment=require(_0x6383('0x1'));var util=require(_0x6383('0x2'));var path=require(_0x6383('0x3'));var Redis=require(_0x6383('0x4'));var config=require(_0x6383('0x5'));var logger=require(_0x6383('0x6'))('ami');var ami=require(_0x6383('0x7'));var Channel=require(_0x6383('0x8'));var statusDesc=[_0x6383('0x9'),_0x6383('0xa'),_0x6383('0xb'),_0x6383('0xc'),_0x6383('0xd'),_0x6383('0xe'),_0x6383('0xf'),'ringinuse','onhold'];var applications=[_0x6383('0x10'),_0x6383('0x11'),_0x6383('0x12'),_0x6383('0x13'),_0x6383('0x14'),_0x6383('0x15')];var dispositions=[_0x6383('0x16'),'FAILED','FAILED',_0x6383('0x16'),_0x6383('0x16'),_0x6383('0x16'),_0x6383('0x17'),_0x6383('0x18'),_0x6383('0x19'),_0x6383('0x19'),'FAILED'];var actions={};config['redis']=_[_0x6383('0x1a')](config[_0x6383('0x1b')],{'host':_0x6383('0x1c'),'port':0x18eb});var io=require(_0x6383('0x1d'))(new Redis(config[_0x6383('0x1b')]));function VoiceCallReport(_0x43c9e4){this[_0x6383('0x1e')]=_0x43c9e4[_0x6383('0x1e')];this[_0x6383('0x1f')]=_0x43c9e4[_0x6383('0x1f')];ami['on']('coreshowchannel',this[_0x6383('0x20')]['bind'](this));ami['on'](_0x6383('0x21'),this[_0x6383('0x20')][_0x6383('0x22')](this));ami['on'](_0x6383('0x23'),this[_0x6383('0x24')][_0x6383('0x22')](this));ami['on'](_0x6383('0x25'),this[_0x6383('0x26')][_0x6383('0x22')](this));ami['on'](_0x6383('0x27'),this[_0x6383('0x28')][_0x6383('0x22')](this));ami['on'](_0x6383('0x29'),this['syncHangup'][_0x6383('0x22')](this));ami['on'](_0x6383('0x2a'),this[_0x6383('0x2b')][_0x6383('0x22')](this));ami['on']('attendedtransfer',this[_0x6383('0x2c')]['bind'](this));ami['on'](_0x6383('0x2d'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x6383('0x2e'),this[_0x6383('0x2f')][_0x6383('0x22')](this));ami['on'](_0x6383('0x30'),this[_0x6383('0x31')][_0x6383('0x22')](this));return BPromise[_0x6383('0x32')]()['then'](ami[_0x6383('0x33')]())[_0x6383('0x34')](function(_0x3624d0){console[_0x6383('0x35')](_0x3624d0);});}VoiceCallReport[_0x6383('0x36')][_0x6383('0x37')]=function(_0x5bade1){return _0x5bade1!==null&&!_['isUndefined'](_0x5bade1);};VoiceCallReport[_0x6383('0x36')][_0x6383('0x38')]=function(_0x29b30f,_0x5f8d5c,_0x58e358){io['to'](_0x29b30f)[_0x6383('0x38')](_0x5f8d5c,_0x58e358);};VoiceCallReport[_0x6383('0x36')][_0x6383('0x2b')]=function(_0x3f2032){try{if(this[_0x6383('0x37')](_0x3f2032)){if(_0x3f2032['uniqueid']===_0x3f2032[_0x6383('0x39')]){if(!_[_0x6383('0x3a')](this[_0x6383('0x1e')][_0x3f2032['uniqueid']])){_[_0x6383('0x3b')](this[_0x6383('0x1e')][_0x3f2032[_0x6383('0x3c')]],_['pick'](_0x3f2032,_[_0x6383('0x3d')](this['channels'][_0x3f2032[_0x6383('0x3c')]])));}}}}catch(_0x5af3bf){logger[_0x6383('0x3e')](_0x6383('0x3f'),util['inspect'](_0x5af3bf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6383('0x36')][_0x6383('0x24')]=function(_0x2633ae){try{if(this[_0x6383('0x37')](_0x2633ae)){if(_0x2633ae[_0x6383('0x3c')]===_0x2633ae['linkedid']&&_0x2633ae['channel']!=_0x6383('0x40')){if(_[_0x6383('0x3a')](this[_0x6383('0x1e')][_0x2633ae[_0x6383('0x3c')]])){this['channels'][_0x2633ae[_0x6383('0x3c')]]=new Channel();this[_0x6383('0x1e')][_0x2633ae[_0x6383('0x3c')]][_0x6383('0x41')]=moment()[_0x6383('0x42')](_0x6383('0x43'));this[_0x6383('0x1e')][_0x2633ae[_0x6383('0x3c')]]['disposition']=dispositions[_[_0x6383('0x44')](_0x2633ae[_0x6383('0x45')])];_[_0x6383('0x3b')](this['channels'][_0x2633ae[_0x6383('0x3c')]],_[_0x6383('0x46')](_0x2633ae,_[_0x6383('0x3d')](this['channels'][_0x2633ae['uniqueid']])));if(_0x2633ae[_0x6383('0x47')]===_0x6383('0x48')){if(this['agents'][_0x2633ae[_0x6383('0x49')]['split']('-')[0x0]]){this[_0x6383('0x1f')][_0x2633ae['channel']['split']('-')[0x0]][_0x6383('0x4a')]=_0x2633ae[_0x6383('0x4b')];this[_0x6383('0x38')](util['format'](_0x6383('0x4c'),this[_0x6383('0x1f')][_0x2633ae[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]][_0x6383('0x4e')]),_0x6383('0x4f'),{'destaccountcode':this['agents'][_0x2633ae[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]][_0x6383('0x50')],'destconnectedlinenum':_0x2633ae['exten']});}}}}}}catch(_0x1ccb47){logger[_0x6383('0x3e')](_0x6383('0x51'),util[_0x6383('0x52')](_0x1ccb47,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6383('0x36')][_0x6383('0x20')]=function(_0x15108a){try{if(this[_0x6383('0x37')](_0x15108a)){if(_0x15108a['uniqueid']===_0x15108a[_0x6383('0x39')]&&_0x15108a[_0x6383('0x4b')]!='h'&&_0x15108a['channel']!=_0x6383('0x40')){_0x15108a[_0x6383('0x53')]=_0x15108a['application'][_0x6383('0x54')]();_0x15108a[_0x6383('0x55')]=(_0x15108a[_0x6383('0x56')]||_0x15108a['applicationdata'])[_0x6383('0x54')]();if(_[_0x6383('0x3a')](this[_0x6383('0x1e')][_0x15108a[_0x6383('0x3c')]])){this[_0x6383('0x1e')][_0x15108a['uniqueid']]=new Channel();this['channels'][_0x15108a[_0x6383('0x3c')]][_0x6383('0x41')]=_0x15108a['duration']?moment()[_0x6383('0x57')](moment['duration'](_0x15108a[_0x6383('0x58')])[_0x6383('0x59')](),'seconds')[_0x6383('0x42')](_0x6383('0x43')):moment()[_0x6383('0x42')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6383('0x1e')][_0x15108a[_0x6383('0x3c')]][_0x6383('0x5a')]='NO\x20ANSWER';}_[_0x6383('0x3b')](this[_0x6383('0x1e')][_0x15108a['uniqueid']],_[_0x6383('0x46')](_0x15108a,_['keys'](this[_0x6383('0x1e')][_0x15108a[_0x6383('0x3c')]])));if(_[_0x6383('0x5b')](applications,_0x15108a[_0x6383('0x53')])){this[_0x6383('0x1e')][_0x15108a['uniqueid']]['lastapplication']=_0x15108a[_0x6383('0x53')];this[_0x6383('0x1e')][_0x15108a[_0x6383('0x3c')]][_0x6383('0x5c')]=_0x15108a[_0x6383('0x55')];if(_0x15108a[_0x6383('0x53')]===_0x6383('0x10')&&_[_0x6383('0x5d')](_0x15108a['applicationdata'],_0x6383('0x5e'))){var _0x570cc6=_0x15108a[_0x6383('0x55')]['split']('=');var _0x475afa=_0x570cc6[0x0]['match'](/cdr\((.*)\)/);if(_0x475afa){this[_0x6383('0x1e')][_0x15108a['uniqueid']][_0x475afa[0x1]]=_0x570cc6[0x1];}}else if(_0x15108a['application']===_0x6383('0x11')){this[_0x6383('0x1e')][_0x15108a[_0x6383('0x3c')]][_0x6383('0x11')]=_0x15108a[_0x6383('0x55')][_0x6383('0x4d')](',')[0x0];}}}}}catch(_0x19147c){logger[_0x6383('0x3e')](_0x6383('0x5f'),util[_0x6383('0x52')](_0x19147c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6383('0x36')]['syncNewState']=function(_0x7923c1){try{if(this[_0x6383('0x37')](_0x7923c1)){if(_0x7923c1[_0x6383('0x3c')]!==_0x7923c1[_0x6383('0x39')]){if(this[_0x6383('0x1e')][_0x7923c1['linkedid']]){if(_0x7923c1['channelstate']==='6'){if(!this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x60')]){var _0x3f48f5=moment();this['channels'][_0x7923c1[_0x6383('0x39')]][_0x6383('0x60')]=!![];this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x61')]=_0x3f48f5['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x41')]){this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x62')]=_0x3f48f5['diff'](this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x41')],_0x6383('0x59'));}}this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x39')]=_0x7923c1[_0x6383('0x3c')];if(_0x7923c1[_0x6383('0x63')]!==_0x6383('0x64')){this[_0x6383('0x1e')][_0x7923c1['linkedid']]['connectedlinenum']=_0x7923c1[_0x6383('0x63')];}this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x65')]=_0x7923c1[_0x6383('0x66')];this['channels'][_0x7923c1[_0x6383('0x39')]]['destinationchannel']=_0x7923c1[_0x6383('0x49')];this['channels'][_0x7923c1[_0x6383('0x39')]][_0x6383('0x5a')]=dispositions[_[_0x6383('0x44')](_0x7923c1['channelstate'])];if(this[_0x6383('0x1f')][_0x7923c1[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]){this[_0x6383('0x1e')][_0x7923c1['linkedid']][_0x6383('0x67')]=this[_0x6383('0x1f')][_0x7923c1[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]['id'];this[_0x6383('0x1e')][_0x7923c1['linkedid']][_0x6383('0x68')]=this[_0x6383('0x1f')][_0x7923c1[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]][_0x6383('0x4e')];}}}}else{if(this[_0x6383('0x1e')][_0x7923c1['uniqueid']]){if(_0x7923c1[_0x6383('0x45')]==='6'){if(this[_0x6383('0x1f')][_0x7923c1[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]){this['channels'][_0x7923c1[_0x6383('0x3c')]][_0x6383('0x67')]=this[_0x6383('0x1f')][_0x7923c1[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]['id'];this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x3c')]][_0x6383('0x68')]=this[_0x6383('0x1f')][_0x7923c1[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]['name'];}}}}}}catch(_0x45e5a4){logger[_0x6383('0x3e')]('[syncNewState][VoiceCallReport]',util['inspect'](_0x45e5a4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6383('0x36')]['syncMixMonitorFilename']=function(_0x5508c7,_0x18eabd){if(this[_0x6383('0x1e')][_0x5508c7]){this[_0x6383('0x1e')][_0x5508c7][_0x6383('0x69')]=!![];if(_[_0x6383('0x6a')](_0x18eabd,'.wav49')){_0x18eabd=_0x18eabd['replace'](_0x6383('0x6b'),_0x6383('0x6c'));}this[_0x6383('0x1e')][_0x5508c7][_0x6383('0x6d')]=_0x18eabd;var _0x3c6eef=_[_0x6383('0x6e')](this[_0x6383('0x1e')][_0x5508c7]['monitors'],{'filename':_0x18eabd});if(_[_0x6383('0x6f')](_0x3c6eef)){this[_0x6383('0x1e')][_0x5508c7][_0x6383('0x70')][_0x6383('0x71')]({'filename':_0x18eabd,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x6383('0x72')});}}};VoiceCallReport['prototype'][_0x6383('0x28')]=function(_0x2ffc79){try{if(this[_0x6383('0x37')](_0x2ffc79)){if(this[_0x6383('0x1e')][_0x2ffc79[_0x6383('0x3c')]]&&_0x2ffc79['channel']!=_0x6383('0x40')){if(this['isNotNull'](_0x2ffc79[_0x6383('0x73')])){if(this[_0x6383('0x37')](_0x2ffc79['variable'][_0x6383('0x74')])){this[_0x6383('0x75')](_0x2ffc79['uniqueid'],_0x2ffc79[_0x6383('0x76')]);}else if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')][_0x6383('0x77')])){this[_0x6383('0x1e')][_0x2ffc79[_0x6383('0x3c')]]['calleridnum']=_0x2ffc79[_0x6383('0x76')];}else if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')][_0x6383('0x78')])){this[_0x6383('0x1e')][_0x2ffc79[_0x6383('0x3c')]]['callerid']=_0x2ffc79['value'];}else if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')]['xmd-cdrtype'])){this['channels'][_0x2ffc79[_0x6383('0x3c')]]['type']=_0x2ffc79['value'];}else if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')][_0x6383('0x79')])){this['channels'][_0x2ffc79[_0x6383('0x3c')]][_0x6383('0x11')]=_0x2ffc79[_0x6383('0x76')][_0x6383('0x4d')](',')[0x0];}else if(this['isNotNull'](_0x2ffc79[_0x6383('0x73')][_0x6383('0x7a')])){this[_0x6383('0x1e')][_0x2ffc79[_0x6383('0x3c')]][_0x6383('0x7b')]=_0x2ffc79['value'];}else if(this['isNotNull'](_0x2ffc79[_0x6383('0x73')][_0x6383('0x7c')])){this[_0x6383('0x1e')][_0x2ffc79[_0x6383('0x3c')]][_0x6383('0x7d')]=_0x2ffc79[_0x6383('0x76')];}else if(this[_0x6383('0x37')](_0x2ffc79['variable']['xmd-callerid-preview'])){this[_0x6383('0x1e')][_0x2ffc79[_0x6383('0x3c')]][_0x6383('0x7e')]=_0x2ffc79['value'];}else if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')][_0x6383('0x7f')])){this['channels'][_0x2ffc79[_0x6383('0x3c')]][_0x6383('0x11')]=_0x2ffc79[_0x6383('0x76')];}else if(this[_0x6383('0x37')](_0x2ffc79['variable'][_0x6383('0x80')])){this[_0x6383('0x1e')][_0x2ffc79['uniqueid']]['sipcalluniqueid']=_0x2ffc79[_0x6383('0x76')];}}}else if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')][_0x6383('0x74')])){if(_0x2ffc79['value']){var _0x1bf3e0=path['parse'](_0x2ffc79[_0x6383('0x76')])['name'];this[_0x6383('0x75')](_0x1bf3e0,_0x2ffc79[_0x6383('0x76')]);}}else if(this[_0x6383('0x1e')][_0x2ffc79['linkedid']]){if(this[_0x6383('0x37')](_0x2ffc79['variable'])){if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')][_0x6383('0x80')])){this[_0x6383('0x1e')][_0x2ffc79['linkedid']]['sipcalllinkedid']=_0x2ffc79[_0x6383('0x76')];}}}}}catch(_0x182082){logger[_0x6383('0x3e')](_0x6383('0x81'),util['inspect'](_0x182082,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6383('0x36')]['syncHangup']=function(_0x5ed227){try{if(this['isNotNull'](_0x5ed227)){if(this['channels'][_0x5ed227[_0x6383('0x3c')]]){var _0x387948=moment();this[_0x6383('0x1e')][_0x5ed227['uniqueid']][_0x6383('0x82')]=_0x387948[_0x6383('0x42')](_0x6383('0x43'));this['channels'][_0x5ed227['uniqueid']][_0x6383('0x58')]=_0x387948[_0x6383('0x83')](this[_0x6383('0x1e')][_0x5ed227['uniqueid']][_0x6383('0x41')],_0x6383('0x59'));if(this[_0x6383('0x1e')][_0x5ed227[_0x6383('0x3c')]]['answered']){this[_0x6383('0x1e')][_0x5ed227['uniqueid']][_0x6383('0x84')]=_0x387948[_0x6383('0x83')](this['channels'][_0x5ed227[_0x6383('0x3c')]][_0x6383('0x61')],_0x6383('0x59'));this[_0x6383('0x1e')][_0x5ed227['uniqueid']][_0x6383('0x62')]=this[_0x6383('0x1e')][_0x5ed227['uniqueid']]['duration']-this[_0x6383('0x1e')][_0x5ed227[_0x6383('0x3c')]][_0x6383('0x84')];}if(_0x5ed227[_0x6383('0x47')]===_0x6383('0x48')){if(this['agents'][_0x5ed227[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]){this[_0x6383('0x1f')][_0x5ed227[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]=_['omit'](this['agents'][_0x5ed227[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]],[_0x6383('0x4a')]);this[_0x6383('0x38')](util['format'](_0x6383('0x4c'),this[_0x6383('0x1f')][_0x5ed227[_0x6383('0x49')]['split']('-')[0x0]][_0x6383('0x4e')]),_0x6383('0x85'),{'destaccountcode':this[_0x6383('0x1f')][_0x5ed227[_0x6383('0x49')]['split']('-')[0x0]][_0x6383('0x50')]});}}ami[_0x6383('0x38')](_0x6383('0x86'),this[_0x6383('0x1e')][_0x5ed227[_0x6383('0x3c')]]);delete this[_0x6383('0x1e')][_0x5ed227[_0x6383('0x3c')]];}}}catch(_0x3bd535){logger[_0x6383('0x3e')](_0x6383('0x87'),util[_0x6383('0x52')](_0x3bd535,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6383('0x36')][_0x6383('0x2c')]=function(_0x348b35){try{if(this['isNotNull'](_0x348b35)){if(this[_0x6383('0x1e')][_0x348b35['transfereeuniqueid']]){this['channels'][_0x348b35[_0x6383('0x88')]]['transfercalleridnum']=_0x348b35['origtransferercalleridnum'];this[_0x6383('0x1e')][_0x348b35[_0x6383('0x88')]][_0x6383('0x89')]=_0x348b35[_0x6383('0x8a')];if(this['channels'][_0x348b35[_0x6383('0x8b')]]){var _0x35fc26=this[_0x6383('0x1e')][_0x348b35[_0x6383('0x8b')]];this['channels'][_0x348b35[_0x6383('0x8b')]]=this[_0x6383('0x1e')][_0x348b35[_0x6383('0x88')]];this['channels'][_0x348b35[_0x6383('0x88')]]=_0x35fc26;}}else if(this[_0x6383('0x1e')][_0x348b35[_0x6383('0x8c')]]){this['channels'][_0x348b35['transfertargetuniqueid']]['transfercalleridnum']=_0x348b35[_0x6383('0x8d')];this['channels'][_0x348b35['transfertargetuniqueid']][_0x6383('0x89')]=_0x348b35[_0x6383('0x8a')];if(this[_0x6383('0x1e')][_0x348b35['origtransfereruniqueid']]){var _0x35fc26=this[_0x6383('0x1e')][_0x348b35['origtransfereruniqueid']];this['channels'][_0x348b35['origtransfereruniqueid']]=this['channels'][_0x348b35[_0x6383('0x8c')]];this[_0x6383('0x1e')][_0x348b35[_0x6383('0x8c')]]=_0x35fc26;}}}}catch(_0x37b82d){logger['error']('[syncAttendedTransfer][VoiceCallReport]',util['inspect'](_0x37b82d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6383('0x8e')]=function(_0x29c834){try{if(this[_0x6383('0x37')](_0x29c834)){if(this[_0x6383('0x1e')][_0x29c834['transfereeuniqueid']]){this['channels'][_0x29c834[_0x6383('0x88')]][_0x6383('0x8f')]=_0x29c834[_0x6383('0x90')];this[_0x6383('0x1e')][_0x29c834[_0x6383('0x88')]][_0x6383('0x89')]=_0x29c834[_0x6383('0x91')];this[_0x6383('0x92')]({'event':_0x6383('0x93'),'uniqueid':_0x29c834[_0x6383('0x88')],'context':_0x29c834[_0x6383('0x47')],'channel':_0x29c834['transfererchannel']});}}}catch(_0x5a9cc4){logger[_0x6383('0x3e')]('[syncBlindTransfer][VoiceCallReport]',util[_0x6383('0x52')](_0x5a9cc4,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6383('0x2f')]=function(_0x205c68){try{if(this[_0x6383('0x37')](_0x205c68)){if(this['channels'][_0x205c68[_0x6383('0x3c')]]){if(!_[_0x6383('0x6f')](this[_0x6383('0x1e')][_0x205c68[_0x6383('0x3c')]][_0x6383('0x61')])){this[_0x6383('0x1e')][_0x205c68[_0x6383('0x3c')]]['mohstarttime']=moment()[_0x6383('0x42')](_0x6383('0x43'));}}}}catch(_0x30645e){logger['error'](_0x6383('0x94'),util[_0x6383('0x52')](_0x30645e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6383('0x31')]=function(_0x2e1b1b){try{if(this[_0x6383('0x37')](_0x2e1b1b)){if(this[_0x6383('0x1e')][_0x2e1b1b[_0x6383('0x3c')]]){if(!_[_0x6383('0x6f')](this[_0x6383('0x1e')][_0x2e1b1b[_0x6383('0x3c')]][_0x6383('0x95')])){this['channels'][_0x2e1b1b['uniqueid']][_0x6383('0x96')]+=moment()[_0x6383('0x97')](0x0)[_0x6383('0x83')](this[_0x6383('0x1e')][_0x2e1b1b[_0x6383('0x3c')]]['mohstarttime'],_0x6383('0x59'));delete this[_0x6383('0x1e')][_0x2e1b1b['uniqueid']][_0x6383('0x95')];}}}}catch(_0x4ae517){logger['error'](_0x6383('0x98'),util[_0x6383('0x52')](_0x4ae517,{'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 3b3b36d..e1bf65f 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 _0x8c4a=['lodash','moment','ioredis','../../../config/logger','ami','../ami','redis','defaults','channels','outboundChannels','outbound','dialbegin','dialend','bind','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','syncDialBegin','isNotNull','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','error','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','variables','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','duration','endtime','starttime','lastevent','complete','answered','holdtime','diff','seconds','billableseconds','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[syncHangup][VoiceDialReport]','exports'];(function(_0x1783db,_0x1adb41){var _0x174b12=function(_0x617efa){while(--_0x617efa){_0x1783db['push'](_0x1783db['shift']());}};_0x174b12(++_0x1adb41);}(_0x8c4a,0xb0));var _0xa8c4=function(_0x24f72f,_0x529660){_0x24f72f=_0x24f72f-0x0;var _0x513ab2=_0x8c4a[_0x24f72f];return _0x513ab2;};'use strict';var _=require(_0xa8c4('0x0'));var moment=require(_0xa8c4('0x1'));var util=require('util');var Redis=require(_0xa8c4('0x2'));var config=require('../../../config/environment');var logger=require(_0xa8c4('0x3'))(_0xa8c4('0x4'));var ami=require(_0xa8c4('0x5'));config[_0xa8c4('0x6')]=_[_0xa8c4('0x7')](config[_0xa8c4('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa8c4('0x6')]));function VoiceDialReport(_0x690746){this[_0xa8c4('0x8')]=_0x690746[_0xa8c4('0x9')];this['outbound']=_0x690746[_0xa8c4('0xa')];this['variables']={};ami['on'](_0xa8c4('0xb'),this['syncDialBegin']['bind'](this));ami['on'](_0xa8c4('0xc'),this['syncDialEnd'][_0xa8c4('0xd')](this));ami['on'](_0xa8c4('0xe'),this[_0xa8c4('0xf')][_0xa8c4('0xd')](this));ami['on'](_0xa8c4('0x10'),this[_0xa8c4('0x11')]['bind'](this));}VoiceDialReport[_0xa8c4('0x12')]['isNotNull']=function(_0x4fbbdf){return _0x4fbbdf!==null&&!_[_0xa8c4('0x13')](_0x4fbbdf);};VoiceDialReport[_0xa8c4('0x12')][_0xa8c4('0x14')]=function(_0x109817,_0x413974,_0x3e874b){io['to'](_0x109817)[_0xa8c4('0x14')](_0x413974,_0x3e874b);};VoiceDialReport[_0xa8c4('0x12')][_0xa8c4('0x15')]=function(_0x698526){try{if(this[_0xa8c4('0x16')](_0x698526)){if(this[_0xa8c4('0x8')][_0x698526[_0xa8c4('0x17')]]){_[_0xa8c4('0x18')](this[_0xa8c4('0x8')][_0x698526['uniqueid']],{'starttime':moment()[_0xa8c4('0x19')](_0xa8c4('0x1a')),'lastevent':_0xa8c4('0x1b'),'interface':_0x698526[_0xa8c4('0x1c')][_0xa8c4('0x1d')](0x0,_0x698526[_0xa8c4('0x1c')]['lastIndexOf']('-')),'membername':_0x698526[_0xa8c4('0x1c')][_0xa8c4('0x1d')](_0x698526['channel']['lastIndexOf']('/')+0x1,_0x698526[_0xa8c4('0x1c')][_0xa8c4('0x1e')]('-'))},_[_0xa8c4('0x1f')](_0x698526,[_0xa8c4('0x20'),_0xa8c4('0x21')]));this[_0xa8c4('0x14')](_0xa8c4('0x22'),_0xa8c4('0x23'),this[_0xa8c4('0x8')][_0x698526[_0xa8c4('0x17')]]);ami[_0xa8c4('0x14')](_0xa8c4('0x24'),this[_0xa8c4('0x8')][_0x698526['uniqueid']]);}}}catch(_0x313eda){logger['error'](_0xa8c4('0x25'),util[_0xa8c4('0x26')](_0x313eda,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa8c4('0x12')][_0xa8c4('0x27')]=function(_0x1c696b){try{if(this[_0xa8c4('0x16')](_0x1c696b)){if(this[_0xa8c4('0x8')][_0x1c696b[_0xa8c4('0x17')]]){this[_0xa8c4('0x8')][_0x1c696b[_0xa8c4('0x17')]][_0xa8c4('0x28')]=_0x1c696b[_0xa8c4('0x28')];if(_0x1c696b['dialstatus']===_0xa8c4('0x29')){this[_0xa8c4('0x8')][_0x1c696b['uniqueid']]['connectedlinenum']=_0x1c696b[_0xa8c4('0x2a')];this[_0xa8c4('0x8')][_0x1c696b[_0xa8c4('0x17')]][_0xa8c4('0x2b')]=_0x1c696b[_0xa8c4('0x2b')];this[_0xa8c4('0x8')][_0x1c696b[_0xa8c4('0x17')]][_0xa8c4('0x2c')]=moment()[_0xa8c4('0x19')](_0xa8c4('0x1a'));this[_0xa8c4('0x8')][_0x1c696b['uniqueid']]['lastevent']=_0xa8c4('0x2d');ami[_0xa8c4('0x14')]('custom:dialconnect',this[_0xa8c4('0x8')][_0x1c696b['uniqueid']]);}this[_0xa8c4('0x14')](_0xa8c4('0x22'),'voice_outbound_channel:save',this[_0xa8c4('0x8')][_0x1c696b[_0xa8c4('0x17')]]);}}}catch(_0x594bca){logger[_0xa8c4('0x2e')](_0xa8c4('0x2f'),util[_0xa8c4('0x26')](_0x594bca,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa8c4('0x12')][_0xa8c4('0xf')]=function(_0x59a6dc){try{if(this['isNotNull'](_0x59a6dc)){this[_0xa8c4('0x30')](_0x59a6dc[_0xa8c4('0x17')],_[_0xa8c4('0x31')](_0x59a6dc[_0xa8c4('0x32')])[0x0],_0x59a6dc[_0xa8c4('0x33')]);if(this[_0xa8c4('0x16')](_0x59a6dc[_0xa8c4('0x32')])&&this[_0xa8c4('0x16')](_0x59a6dc[_0xa8c4('0x32')][_0xa8c4('0x34')])){if(_[_0xa8c4('0x13')](this['channels'][_0x59a6dc[_0xa8c4('0x17')]])){this[_0xa8c4('0x8')][_0x59a6dc[_0xa8c4('0x17')]]={'routeId':_0x59a6dc[_0xa8c4('0x33')],'variables':this[_0xa8c4('0x35')][_0x59a6dc[_0xa8c4('0x17')]]};this[_0xa8c4('0x14')]('voice:outbound',_0xa8c4('0x23'),this['channels'][_0x59a6dc['uniqueid']]);}}}}catch(_0x261c94){logger[_0xa8c4('0x2e')](_0xa8c4('0x36'),util[_0xa8c4('0x26')](_0x261c94,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa8c4('0x30')]=function(_0x38d6e7,_0x587dae,_0x171a50){var _0x46f07c=[_0xa8c4('0x37'),_0xa8c4('0x38'),_0xa8c4('0x39'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0xa8c4('0x3a'),'bridgepeer',_0xa8c4('0x3b'),'membercalls',_0xa8c4('0x3c'),_0xa8c4('0x3d'),_0xa8c4('0x3e'),_0xa8c4('0x3f'),_0xa8c4('0x40'),_0xa8c4('0x41')];if(!_[_0xa8c4('0x42')](_0x587dae)&&!_[_0xa8c4('0x43')](_0x46f07c,_0x587dae)){if(_[_0xa8c4('0x13')](this[_0xa8c4('0x35')][_0x38d6e7])){this[_0xa8c4('0x35')][_0x38d6e7]={};}this[_0xa8c4('0x35')][_0x38d6e7][_0x587dae]=_0x171a50;}};VoiceDialReport[_0xa8c4('0x12')][_0xa8c4('0x11')]=function(_0x1ba1a6){try{if(this['isNotNull'](_0x1ba1a6)){if(this[_0xa8c4('0x8')][_0x1ba1a6['uniqueid']]){this['channels'][_0x1ba1a6[_0xa8c4('0x17')]]['endtime']=moment()[_0xa8c4('0x19')](_0xa8c4('0x1a'));this['channels'][_0x1ba1a6['uniqueid']][_0xa8c4('0x44')]=moment(this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]][_0xa8c4('0x45')])['diff'](this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]][_0xa8c4('0x46')],'seconds');this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]][_0xa8c4('0x47')]=_0xa8c4('0x48');this['outbound']['total']+=0x1;if(this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]][_0xa8c4('0x2c')]){this['outbound'][_0xa8c4('0x49')]+=0x1;this[_0xa8c4('0x8')][_0x1ba1a6['uniqueid']][_0xa8c4('0x4a')]=moment(this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]][_0xa8c4('0x2c')])[_0xa8c4('0x4b')](this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]]['starttime'],_0xa8c4('0x4c'));this[_0xa8c4('0x8')][_0x1ba1a6['uniqueid']][_0xa8c4('0x4d')]=moment(this[_0xa8c4('0x8')][_0x1ba1a6['uniqueid']]['endtime'])[_0xa8c4('0x4b')](this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]]['answertime'],_0xa8c4('0x4c'));this[_0xa8c4('0xa')]['sumHoldTime']+=this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]]['holdtime']||0x0;this[_0xa8c4('0xa')][_0xa8c4('0x4e')]+=this['channels'][_0x1ba1a6[_0xa8c4('0x17')]][_0xa8c4('0x4d')];}this[_0xa8c4('0xa')][_0xa8c4('0x4f')]+=this['channels'][_0x1ba1a6['uniqueid']]['duration'];ami[_0xa8c4('0x14')](_0xa8c4('0x50'),this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]]);ami[_0xa8c4('0x14')](_0xa8c4('0x51'),this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]]);this[_0xa8c4('0x14')](_0xa8c4('0x22'),_0xa8c4('0x52'),this[_0xa8c4('0xa')]);logger[_0xa8c4('0x53')](_0xa8c4('0x54'),JSON[_0xa8c4('0x55')](this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]]));this[_0xa8c4('0x14')](_0xa8c4('0x22'),'voice_outbound_channel:remove',this[_0xa8c4('0x8')][_0x1ba1a6['uniqueid']]);delete this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]];}if(this[_0xa8c4('0x35')][_0x1ba1a6[_0xa8c4('0x17')]]){delete this[_0xa8c4('0x35')][_0x1ba1a6['uniqueid']];}}}catch(_0x3a8dba){logger[_0xa8c4('0x2e')](_0xa8c4('0x56'),util[_0xa8c4('0x26')](_0x3a8dba,{'showHidden':![],'depth':null}));}};module[_0xa8c4('0x57')]=VoiceDialReport; \ No newline at end of file +var _0x79de=['answertime','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','isUndefined','variables','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','endtime','YYYY-MM-DD\x20HH:mm:ss','diff','starttime','complete','total','answered','holdtime','billableseconds','seconds','duration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','syncHangup','prototype','isNotNull','emit','uniqueid','format','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename'];(function(_0x5bc65a,_0x492ca3){var _0x21488e=function(_0x3e53ea){while(--_0x3e53ea){_0x5bc65a['push'](_0x5bc65a['shift']());}};_0x21488e(++_0x492ca3);}(_0x79de,0x1a8));var _0xe79d=function(_0x57b7ab,_0x1e565d){_0x57b7ab=_0x57b7ab-0x0;var _0x379c6d=_0x79de[_0x57b7ab];return _0x379c6d;};'use strict';var _=require(_0xe79d('0x0'));var moment=require('moment');var util=require(_0xe79d('0x1'));var Redis=require(_0xe79d('0x2'));var config=require(_0xe79d('0x3'));var logger=require(_0xe79d('0x4'))('ami');var ami=require('../ami');config[_0xe79d('0x5')]=_[_0xe79d('0x6')](config[_0xe79d('0x5')],{'host':_0xe79d('0x7'),'port':0x18eb});var io=require(_0xe79d('0x8'))(new Redis(config[_0xe79d('0x5')]));function VoiceDialReport(_0xa3af86){this[_0xe79d('0x9')]=_0xa3af86[_0xe79d('0xa')];this[_0xe79d('0xb')]=_0xa3af86[_0xe79d('0xb')];this['variables']={};ami['on'](_0xe79d('0xc'),this[_0xe79d('0xd')][_0xe79d('0xe')](this));ami['on'](_0xe79d('0xf'),this[_0xe79d('0x10')][_0xe79d('0xe')](this));ami['on'](_0xe79d('0x11'),this[_0xe79d('0x12')][_0xe79d('0xe')](this));ami['on']('hangup',this[_0xe79d('0x13')][_0xe79d('0xe')](this));}VoiceDialReport[_0xe79d('0x14')][_0xe79d('0x15')]=function(_0x30d4c4){return _0x30d4c4!==null&&!_['isUndefined'](_0x30d4c4);};VoiceDialReport[_0xe79d('0x14')]['emit']=function(_0x59516f,_0x5e5373,_0x203b95){io['to'](_0x59516f)[_0xe79d('0x16')](_0x5e5373,_0x203b95);};VoiceDialReport[_0xe79d('0x14')][_0xe79d('0xd')]=function(_0x16654b){try{if(this[_0xe79d('0x15')](_0x16654b)){if(this[_0xe79d('0x9')][_0x16654b[_0xe79d('0x17')]]){_['merge'](this[_0xe79d('0x9')][_0x16654b[_0xe79d('0x17')]],{'starttime':moment()[_0xe79d('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xe79d('0x19'),'interface':_0x16654b['channel']['substring'](0x0,_0x16654b[_0xe79d('0x1a')]['lastIndexOf']('-')),'membername':_0x16654b[_0xe79d('0x1a')][_0xe79d('0x1b')](_0x16654b[_0xe79d('0x1a')][_0xe79d('0x1c')]('/')+0x1,_0x16654b[_0xe79d('0x1a')][_0xe79d('0x1c')]('-'))},_[_0xe79d('0x1d')](_0x16654b,[_0xe79d('0x1e'),_0xe79d('0x1f')]));this[_0xe79d('0x16')](_0xe79d('0x20'),_0xe79d('0x21'),this['channels'][_0x16654b[_0xe79d('0x17')]]);ami['emit']('custom:dialbegin',this[_0xe79d('0x9')][_0x16654b[_0xe79d('0x17')]]);}}}catch(_0x37b499){logger[_0xe79d('0x22')](_0xe79d('0x23'),util[_0xe79d('0x24')](_0x37b499,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe79d('0x14')]['syncDialEnd']=function(_0x597a96){try{if(this[_0xe79d('0x15')](_0x597a96)){if(this['channels'][_0x597a96[_0xe79d('0x17')]]){this['channels'][_0x597a96[_0xe79d('0x17')]]['dialstatus']=_0x597a96[_0xe79d('0x25')];if(_0x597a96[_0xe79d('0x25')]===_0xe79d('0x26')){this['channels'][_0x597a96['uniqueid']]['connectedlinenum']=_0x597a96[_0xe79d('0x27')];this[_0xe79d('0x9')][_0x597a96[_0xe79d('0x17')]][_0xe79d('0x28')]=_0x597a96[_0xe79d('0x28')];this[_0xe79d('0x9')][_0x597a96[_0xe79d('0x17')]][_0xe79d('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xe79d('0x9')][_0x597a96[_0xe79d('0x17')]][_0xe79d('0x2a')]=_0xe79d('0x2b');ami[_0xe79d('0x16')](_0xe79d('0x2c'),this[_0xe79d('0x9')][_0x597a96[_0xe79d('0x17')]]);}this['emit'](_0xe79d('0x20'),_0xe79d('0x21'),this[_0xe79d('0x9')][_0x597a96['uniqueid']]);}}}catch(_0x28e4ef){logger[_0xe79d('0x22')](_0xe79d('0x2d'),util[_0xe79d('0x24')](_0x28e4ef,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe79d('0x14')][_0xe79d('0x12')]=function(_0x583e9c){try{if(this['isNotNull'](_0x583e9c)){this[_0xe79d('0x2e')](_0x583e9c['uniqueid'],_[_0xe79d('0x2f')](_0x583e9c[_0xe79d('0x30')])[0x0],_0x583e9c[_0xe79d('0x31')]);if(this[_0xe79d('0x15')](_0x583e9c[_0xe79d('0x30')])&&this[_0xe79d('0x15')](_0x583e9c[_0xe79d('0x30')][_0xe79d('0x32')])){if(_[_0xe79d('0x33')](this['channels'][_0x583e9c['uniqueid']])){this[_0xe79d('0x9')][_0x583e9c[_0xe79d('0x17')]]={'routeId':_0x583e9c[_0xe79d('0x31')],'variables':this[_0xe79d('0x34')][_0x583e9c[_0xe79d('0x17')]]};this['emit'](_0xe79d('0x20'),_0xe79d('0x21'),this[_0xe79d('0x9')][_0x583e9c[_0xe79d('0x17')]]);}}}}catch(_0x25a45c){logger[_0xe79d('0x22')](_0xe79d('0x35'),util['inspect'](_0x25a45c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe79d('0x14')][_0xe79d('0x2e')]=function(_0x5894ed,_0x46e1c3,_0x59dadd){var _0x495054=[_0xe79d('0x36'),'rtpaudioqosbridged',_0xe79d('0x37'),_0xe79d('0x38'),_0xe79d('0x39'),_0xe79d('0x3a'),_0xe79d('0x3b'),_0xe79d('0x3c'),_0xe79d('0x3d'),_0xe79d('0x3e'),_0xe79d('0x3f'),_0xe79d('0x40'),_0xe79d('0x41'),_0xe79d('0x42'),_0xe79d('0x43'),_0xe79d('0x44'),_0xe79d('0x45'),_0xe79d('0x46'),_0xe79d('0x47')];if(!_[_0xe79d('0x48')](_0x46e1c3)&&!_['includes'](_0x495054,_0x46e1c3)){if(_[_0xe79d('0x33')](this[_0xe79d('0x34')][_0x5894ed])){this['variables'][_0x5894ed]={};}this[_0xe79d('0x34')][_0x5894ed][_0x46e1c3]=_0x59dadd;}};VoiceDialReport[_0xe79d('0x14')][_0xe79d('0x13')]=function(_0x558f6b){try{if(this[_0xe79d('0x15')](_0x558f6b)){if(this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]]){this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x49')]=moment()[_0xe79d('0x18')](_0xe79d('0x4a'));this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]]['duration']=moment(this['channels'][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x49')])[_0xe79d('0x4b')](this['channels'][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x4c')],'seconds');this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x2a')]=_0xe79d('0x4d');this[_0xe79d('0xb')][_0xe79d('0x4e')]+=0x1;if(this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]]['answertime']){this[_0xe79d('0xb')][_0xe79d('0x4f')]+=0x1;this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x50')]=moment(this['channels'][_0x558f6b['uniqueid']]['answertime'])['diff'](this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x4c')],'seconds');this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x51')]=moment(this[_0xe79d('0x9')][_0x558f6b['uniqueid']]['endtime'])[_0xe79d('0x4b')](this['channels'][_0x558f6b[_0xe79d('0x17')]]['answertime'],_0xe79d('0x52'));this[_0xe79d('0xb')]['sumHoldTime']+=this['channels'][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x50')]||0x0;this[_0xe79d('0xb')]['sumBillable']+=this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]]['billableseconds'];}this[_0xe79d('0xb')]['sumDuration']+=this[_0xe79d('0x9')][_0x558f6b['uniqueid']][_0xe79d('0x53')];ami[_0xe79d('0x16')](_0xe79d('0x54'),this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]]);ami[_0xe79d('0x16')](_0xe79d('0x55'),this[_0xe79d('0x9')][_0x558f6b['uniqueid']]);this[_0xe79d('0x16')](_0xe79d('0x20'),_0xe79d('0x56'),this[_0xe79d('0xb')]);logger[_0xe79d('0x57')](_0xe79d('0x58'),JSON[_0xe79d('0x59')](this['channels'][_0x558f6b[_0xe79d('0x17')]]));this[_0xe79d('0x16')](_0xe79d('0x20'),_0xe79d('0x5a'),this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]]);delete this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]];}if(this['variables'][_0x558f6b[_0xe79d('0x17')]]){delete this[_0xe79d('0x34')][_0x558f6b['uniqueid']];}}}catch(_0x1b1319){logger[_0xe79d('0x22')](_0xe79d('0x5b'),util['inspect'](_0x1b1319,{'showHidden':![],'depth':null}));}};module[_0xe79d('0x5c')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 4f3c161..152f8b5 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 _0x1138=['loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','isNil','Action','channel','catch','message','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','variables','[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','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','Trunk','active','callerid','Interval','voice_queue:save','isNotNull','clearZombieChannels','queues','[queuesummary]','queue','countBy','callers','toNumber','loggedin','available','custom:queuesummary','syncNewExten','uniqueid','queuecallerjoinAt','position','count','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','last','connectedlinenum','connectedlinename','queuecallerexitreason','[syncAgentConnect][VoiceQueueReport]','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','variable','value','queuestatus','TIMEOUT','lastevent','timeout','queuecallerleaveAt','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','length','milliseconds','diff','custom:queuecallerunmanaged','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertype','ATTENDED','switch','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','syncBlindTransfer','BLINDTRANSFER','extension','syncHangup','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','util','ioredis','ami','../ami','../model/queueReport','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','voiceQueues','flagQueueSummary','campaigns','queuesummary','syncQueueSummary','bind','queuesummarycomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','syncAgentConnect','varset','syncVarSet','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary'];(function(_0x330832,_0x26beed){var _0x1978f7=function(_0x35632c){while(--_0x35632c){_0x330832['push'](_0x330832['shift']());}};_0x1978f7(++_0x26beed);}(_0x1138,0x165));var _0x8113=function(_0x23f7d9,_0x2977e8){_0x23f7d9=_0x23f7d9-0x0;var _0x546070=_0x1138[_0x23f7d9];return _0x546070;};'use strict';var _=require(_0x8113('0x0'));var moment=require(_0x8113('0x1'));var BPromise=require(_0x8113('0x2'));var util=require(_0x8113('0x3'));var md5=require('md5');var Redis=require(_0x8113('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x8113('0x5'));var ami=require(_0x8113('0x6'));var QueueReport=require(_0x8113('0x7'));config[_0x8113('0x8')]=_['defaults'](config[_0x8113('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x8113('0x9'))(new Redis(config[_0x8113('0x8')]));var Sequence=function(){};Sequence[_0x8113('0xa')][_0x8113('0xb')]=function(_0x2f0d0f){this[_0x8113('0xc')]=this['tail']?this[_0x8113('0xc')][_0x8113('0xd')](_0x2f0d0f):_0x2f0d0f();};function VoiceQueueReport(_0x4723c4){this[_0x8113('0xe')]=new Sequence();this[_0x8113('0xf')]={};this['agents']=_0x4723c4[_0x8113('0x10')];this[_0x8113('0x11')]=_0x4723c4['queueChannels'];this[_0x8113('0x12')]=_0x4723c4[_0x8113('0x12')];this[_0x8113('0x13')]=!![];this[_0x8113('0x14')]=_0x4723c4[_0x8113('0x14')];this['variables']={};ami['on'](_0x8113('0x15'),this[_0x8113('0x16')][_0x8113('0x17')](this));ami['on'](_0x8113('0x18'),this['syncQueueSummaryComplete'][_0x8113('0x17')](this));ami['on'](_0x8113('0x19'),this[_0x8113('0x1a')]['bind'](this));ami['on'](_0x8113('0x1b'),this[_0x8113('0x1c')]['bind'](this));ami['on'](_0x8113('0x1d'),this[_0x8113('0x1e')]['bind'](this));ami['on']('agentcomplete',this[_0x8113('0x1f')][_0x8113('0x17')](this));ami['on']('agentconnect',this[_0x8113('0x20')]['bind'](this));ami['on'](_0x8113('0x21'),this[_0x8113('0x22')][_0x8113('0x17')](this));ami['on']('hangup',this['syncHangup'][_0x8113('0x17')](this));ami['on'](_0x8113('0x23'),this[_0x8113('0x24')][_0x8113('0x17')](this));ami['on'](_0x8113('0x25'),this[_0x8113('0x26')][_0x8113('0x17')](this));ami['on'](_0x8113('0x27'),this[_0x8113('0x28')][_0x8113('0x17')](this));ami['on'](_0x8113('0x29'),this[_0x8113('0x2a')][_0x8113('0x17')](this));ami['on'](_0x8113('0x2b'),this['syncBlindTransfer'][_0x8113('0x17')](this));this[_0x8113('0x2c')]();this[_0x8113('0x2d')]();}function isNotNull(_0x530bc0){return _0x530bc0!==null&&!_[_0x8113('0x2e')](_0x530bc0);}function clearChannels(_0x771c7d){if(!_[_0x8113('0x2f')](_0x771c7d)){for(var _0x4acbf5 in _0x771c7d){if(_0x771c7d[_0x8113('0x30')](_0x4acbf5)){delete _0x771c7d[_0x4acbf5];}}}}function clearCampaigns(_0x108c96){if(!_['isEmpty'](_0x108c96)){for(var _0x32b722 in _0x108c96){if(_0x108c96[_0x8113('0x30')](_0x32b722)){_0x108c96[_0x32b722]['originated']=0x0;}}}}function clearVoiceQueues(_0x3349a2){if(!_[_0x8113('0x2f')](_0x3349a2)){for(var _0x32eff5 in _0x3349a2){if(_0x3349a2[_0x8113('0x30')](_0x32eff5)){_0x3349a2[_0x32eff5][_0x8113('0x31')]=0x0;_0x3349a2[_0x32eff5][_0x8113('0x32')]=0x0;_0x3349a2[_0x32eff5][_0x8113('0x33')]=0x0;_0x3349a2[_0x32eff5][_0x8113('0x34')]=0x0;_0x3349a2[_0x32eff5][_0x8113('0x35')]=!![];}}}}function clearAgentBooked(_0x1d8959){if(!_[_0x8113('0x2f')](_0x1d8959)){for(var _0x225cb5 in _0x1d8959){if(_0x1d8959[_0x8113('0x30')](_0x225cb5)){_0x1d8959[_0x225cb5][_0x8113('0x36')]=!![];}}}}VoiceQueueReport[_0x8113('0xa')]['clearZombieChannels']=function(){var _0xc3c9fd=this;for(var _0x2bfeb7 in this['channels']){if(this[_0x8113('0x11')][_0x8113('0x30')](_0x2bfeb7)&&!this[_0x8113('0x11')][_0x2bfeb7]['switch']){this[_0x8113('0xe')][_0x8113('0xb')](function(){if(!_[_0x8113('0x37')](_0xc3c9fd[_0x8113('0x11')][_0x2bfeb7])){return ami[_0x8113('0x38')]({'action':'status','channel':_0xc3c9fd[_0x8113('0x11')][_0x2bfeb7][_0x8113('0x39')]})[_0x8113('0x3a')](function(_0x791e25){if(_0x791e25[_0x8113('0x3b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xc3c9fd[_0x8113('0x11')][_0x2bfeb7]){delete _0xc3c9fd[_0x8113('0x11')][_0x2bfeb7];logger[_0x8113('0x3c')](_0x8113('0x3d'),_0x2bfeb7);}if(_0xc3c9fd['queueReports'][_0x2bfeb7]){delete _0xc3c9fd[_0x8113('0xf')][_0x2bfeb7];logger[_0x8113('0x3c')](_0x8113('0x3e'),_0x2bfeb7);}if(_0xc3c9fd[_0x8113('0x3f')][_0x2bfeb7]){delete _0xc3c9fd['variables'][_0x2bfeb7];logger[_0x8113('0x3c')]('[voiceQueueReport][checkVariables]',_0x2bfeb7);}},0x1f40);}});}});}}};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x24')]=function(){logger[_0x8113('0x3c')](_0x8113('0x40'));clearChannels(this[_0x8113('0x11')]);this[_0x8113('0x41')](this['queueReports']);clearAgentBooked(this[_0x8113('0x10')]);clearVoiceQueues(this[_0x8113('0x12')]);clearCampaigns(this[_0x8113('0x14')]);};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x41')]=function(_0x4f7827){var _0x1c8051=this;if(!_[_0x8113('0x2f')](_0x4f7827)){for(var _0x27499d in _0x4f7827){if(_0x4f7827[_0x8113('0x30')](_0x27499d)){_0x1c8051[_0x8113('0x42')](_0x4f7827[_0x27499d]);delete _0x4f7827[_0x27499d];}}}};function loggerCatch(_0x9fa5f3){return function(_0x1a97ac){logger['error'](_0x9fa5f3,util[_0x8113('0x43')](_0x1a97ac,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x8113('0xa')][_0x8113('0x44')]=function(_0x241be7,_0x24784b,_0x371469){io['to'](_0x241be7)[_0x8113('0x44')](_0x24784b,_0x371469);};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x45')]=function(_0x3a3170){this['emit'](util[_0x8113('0x46')](_0x8113('0x47'),_0x3a3170[_0x8113('0x48')]),_0x8113('0x49'),_0x3a3170);};VoiceQueueReport['prototype'][_0x8113('0x42')]=function(_0x582815){logger[_0x8113('0x4a')](_0x8113('0x4b'),JSON[_0x8113('0x4c')](_0x582815));this['emit'](util[_0x8113('0x46')]('voice:queue:%s',_0x582815[_0x8113('0x48')]),_0x8113('0x4d'),_0x582815);};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x4e')]=function(_0x3715fc){if(_0x3715fc[_0x8113('0x4f')]===_0x8113('0x50')){var _0x5678f7={'id':_0x3715fc['id'],'name':_0x3715fc[_0x8113('0x48')],'strategy':_0x3715fc[_0x8113('0x51')],'answered':_0x3715fc[_0x8113('0x52')],'available':_0x3715fc['available'],'loggedIn':_0x3715fc[_0x8113('0x53')],'pTalking':_0x3715fc[_0x8113('0x33')],'sumBillable':_0x3715fc[_0x8113('0x54')],'sumDuration':_0x3715fc[_0x8113('0x55')],'sumHoldTime':_0x3715fc[_0x8113('0x56')]||0x0,'talking':_0x3715fc['talking'],'total':_0x3715fc[_0x8113('0x57')],'type':_0x3715fc[_0x8113('0x4f')],'unmanaged':_0x3715fc[_0x8113('0x58')],'abandoned':_0x3715fc[_0x8113('0x59')],'waiting':_0x3715fc[_0x8113('0x34')]};if(_0x3715fc[_0x8113('0x5a')]){_0x5678f7[_0x8113('0x5a')]={'id':_0x3715fc['Trunk']['id'],'name':_0x3715fc[_0x8113('0x5a')][_0x8113('0x48')],'active':_0x3715fc[_0x8113('0x5a')][_0x8113('0x5b')],'callerid':_0x3715fc[_0x8113('0x5a')][_0x8113('0x5c')]};}if(_0x3715fc[_0x8113('0x5d')]){_0x5678f7['Interval']={'id':_0x3715fc[_0x8113('0x5d')]['id'],'name':_0x3715fc[_0x8113('0x5d')]['name']};}var _0x3ef6b6=md5(JSON[_0x8113('0x4c')](_0x5678f7));if(_0x3715fc['md5']!==_0x3ef6b6){_0x3715fc['md5']=_0x3ef6b6;this[_0x8113('0x44')](util[_0x8113('0x46')]('voice:queue:%s',_0x5678f7['name']),_0x8113('0x5e'),_0x5678f7);}}};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x5f')]=function(_0xb056c){return _0xb056c!==null&&!_[_0x8113('0x2e')](_0xb056c);};VoiceQueueReport[_0x8113('0xa')]['loopQueueShow']=function(){var _0x1d2b9f=this;setInterval(function(){_0x1d2b9f[_0x8113('0x60')]();ami[_0x8113('0x38')]({'action':_0x8113('0x61')})['catch'](loggerCatch('[queues]'));},0x2710);};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x2c')]=function(){var _0x56a3e0=this;setInterval(function(){if(_0x56a3e0[_0x8113('0x13')]){return ami['Action']({'action':_0x8113('0x15')})['then'](function(_0x2d97ee){_0x56a3e0['flagQueueSummary']=![];})[_0x8113('0x3a')](loggerCatch(_0x8113('0x62')));}},0x3e8);};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x16')]=function(_0x4bd96f){try{if(this['isNotNull'](_0x4bd96f)&&this[_0x8113('0x5f')](_0x4bd96f[_0x8113('0x63')])){if(this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]]){var _0x29ec89=_[_0x8113('0x64')](this[_0x8113('0x11')],_0x8113('0x63'))[_0x4bd96f[_0x8113('0x63')]]||0x0;var _0x4c1038=_0x29ec89-_0x4bd96f[_0x8113('0x65')];if(this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]][_0x8113('0x34')]!==_[_0x8113('0x66')](_0x4bd96f['callers'])||this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]]['loggedIn']!==_[_0x8113('0x66')](_0x4bd96f[_0x8113('0x67')])||this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]][_0x8113('0x68')]!==_[_0x8113('0x66')](_0x4bd96f['available'])||this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]]['talking']!==_0x4c1038){this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]]['waiting']=_[_0x8113('0x66')](_0x4bd96f[_0x8113('0x65')]);this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]][_0x8113('0x53')]=_[_0x8113('0x66')](_0x4bd96f['loggedin']);this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]]['available']=_[_0x8113('0x66')](_0x4bd96f[_0x8113('0x68')]);this[_0x8113('0x12')][_0x4bd96f['queue']][_0x8113('0x32')]=_0x4c1038>0x0?_0x4c1038:0x0;this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]][_0x8113('0x32')]=this['voiceQueues'][_0x4bd96f[_0x8113('0x63')]]['talking']>_[_0x8113('0x66')](_0x4bd96f[_0x8113('0x67')])?_[_0x8113('0x66')](_0x4bd96f['loggedin']):this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]][_0x8113('0x32')];this['emitVoiceQueueSummary'](this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]]);}ami[_0x8113('0x44')](_0x8113('0x69'),this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]]);}}}catch(_0x14996b){logger[_0x8113('0x3c')]('[syncQueueSummary][VoiceQueueReport]',util['inspect'](_0x14996b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x3bfe76){this[_0x8113('0x13')]=!![];};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x6a')]=function(_0x13f2cf){};VoiceQueueReport[_0x8113('0xa')]['syncQueueCallerJoin']=function(_0x251364){try{if(this[_0x8113('0x5f')](_0x251364)){if(_[_0x8113('0x2e')](this[_0x8113('0xf')][_0x251364['uniqueid']])){this[_0x8113('0xf')][_0x251364[_0x8113('0x6b')]]=[];this['channels'][_0x251364['uniqueid']]={};}var _0xdde8af=new QueueReport();_0xdde8af[_0x8113('0x48')]=_0x251364[_0x8113('0x63')];_0xdde8af[_0x8113('0x4f')]=this['voiceQueues'][_0xdde8af[_0x8113('0x48')]]&&this['voiceQueues'][_0xdde8af[_0x8113('0x48')]][_0x8113('0x4f')]?this['voiceQueues'][_0xdde8af['name']][_0x8113('0x4f')]||_0x8113('0x50'):'inbound';_0xdde8af[_0x8113('0x63')]=_0x251364['queue'];_0xdde8af[_0x8113('0x6c')]=moment()[_0x8113('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0xdde8af[_0x8113('0x6d')]=_0x251364[_0x8113('0x6d')];_0xdde8af[_0x8113('0x6e')]=_0x251364['count'];_['merge'](_0xdde8af,_[_0x8113('0x6f')](_0x251364,_[_0x8113('0x70')](_0xdde8af)));this[_0x8113('0xf')][_0x251364['uniqueid']][_0x8113('0x71')](_0xdde8af);this['channels'][_0x251364['uniqueid']]=_0xdde8af;this[_0x8113('0x45')](_0xdde8af);}}catch(_0x5d2c70){logger[_0x8113('0x3c')](_0x8113('0x72'),util['inspect'](_0x5d2c70,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8113('0xa')]['syncQueueCallerAbandon']=function(_0xeb009b){try{if(this[_0x8113('0x5f')](_0xeb009b)){if(this['queueReports'][_0xeb009b[_0x8113('0x6b')]]){var _0x3cfcca=_['last'](this[_0x8113('0xf')][_0xeb009b[_0x8113('0x6b')]]);_0x3cfcca[_0x8113('0x73')]=![];_0x3cfcca['queuecallercompleteAt']=null;_0x3cfcca['holdtime']=_0xeb009b[_0x8113('0x74')];_0x3cfcca[_0x8113('0x75')]=_0xeb009b[_0x8113('0x75')];_0x3cfcca[_0x8113('0x1b')]=!![];_0x3cfcca[_0x8113('0x76')]=moment()[_0x8113('0x46')](_0x8113('0x77'));_0x3cfcca['queuecallerexitreason']=_0x8113('0x78');_0x3cfcca[_0x8113('0x79')]=null;this['channels'][_0xeb009b[_0x8113('0x6b')]]=_0x3cfcca;this['emitVoiceQueueChannelRemove'](_0x3cfcca);}}}catch(_0x41e6af){logger[_0x8113('0x3c')]('[syncQueueCallerAbandon][VoiceQueueReport]',util['inspect'](_0x41e6af,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8113('0xa')]['syncQueueCallerLeave']=function(_0x53a559){try{if(this['isNotNull'](_0x53a559)){if(this['queueReports'][_0x53a559[_0x8113('0x6b')]]){var _0xbff381=_[_0x8113('0x7a')](this[_0x8113('0xf')][_0x53a559['uniqueid']]);_0xbff381['queuecallerleaveAt']=moment()['format'](_0x8113('0x77'));_0xbff381[_0x8113('0x7b')]=_0x53a559[_0x8113('0x7b')];_0xbff381[_0x8113('0x7c')]=_0x53a559[_0x8113('0x7c')];this[_0x8113('0x11')][_0x53a559['uniqueid']]=_0xbff381;this[_0x8113('0x45')](_0xbff381);}}}catch(_0x126285){logger[_0x8113('0x3c')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x8113('0x43')](_0x126285,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x20')]=function(_0x2a4c3c){try{if(this[_0x8113('0x5f')](_0x2a4c3c)){if(this[_0x8113('0xf')][_0x2a4c3c[_0x8113('0x6b')]]){var _0x5bebdd=_[_0x8113('0x7a')](this['queueReports'][_0x2a4c3c[_0x8113('0x6b')]]);_0x5bebdd[_0x8113('0x73')]=!![];_0x5bebdd[_0x8113('0x7d')]='COMPLETEDBYAGENT';}}}catch(_0x379e07){logger[_0x8113('0x3c')](_0x8113('0x7e'),util[_0x8113('0x43')](_0x379e07,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x1f')]=function(_0x585d91){try{if(this[_0x8113('0x5f')](_0x585d91)){if(this[_0x8113('0xf')][_0x585d91['uniqueid']]){var _0x3b6d90=_[_0x8113('0x7a')](this['queueReports'][_0x585d91[_0x8113('0x6b')]]);_0x3b6d90[_0x8113('0x1b')]=![];_0x3b6d90[_0x8113('0x76')]=null;_0x3b6d90[_0x8113('0x7f')]=!![];_0x3b6d90[_0x8113('0x79')]=_0x585d91[_0x8113('0x80')];_0x3b6d90[_0x8113('0x74')]=_0x585d91[_0x8113('0x74')];_0x3b6d90[_0x8113('0x73')]=!![];_0x3b6d90[_0x8113('0x81')]=![];_0x3b6d90[_0x8113('0x82')]=null;if(!_0x3b6d90[_0x8113('0x83')]){if(_0x585d91[_0x8113('0x84')]=='transfer'){_0x3b6d90[_0x8113('0x7d')]='COMPLETED';}else{if(_['startsWith'](_0x585d91[_0x8113('0x39')][_0x8113('0x85')](),_0x8113('0x86'))){if(this[_0x8113('0xf')][_0x585d91[_0x8113('0x87')]]){var _0x2eee9e=_[_0x8113('0x7a')](this[_0x8113('0xf')][_0x585d91['linkedid']]);_0x2eee9e[_0x8113('0x73')]=![];_0x2eee9e[_0x8113('0x81')]=!![];_0x2eee9e['queuecallerexitAt']=moment(_0x3b6d90[_0x8113('0x6c')])[_0x8113('0x88')](_0x585d91[_0x8113('0x74')],_0x8113('0x89'))[_0x8113('0x46')](_0x8113('0x77'));_0x2eee9e[_0x8113('0x7d')]=_0x8113('0x8a');_0x2eee9e[_0x8113('0x83')]=!![];_0x2eee9e['transfertype']=_0x8113('0x8b');_0x2eee9e[_0x8113('0x8c')]=_0x585d91[_0x8113('0x8d')];_0x2eee9e[_0x8113('0x8e')]=_0x585d91[_0x8113('0x6b')];var _0x2b41c9=this[_0x8113('0xf')][_0x585d91[_0x8113('0x87')]];this[_0x8113('0xf')][_0x585d91[_0x8113('0x87')]]=this[_0x8113('0xf')][_0x585d91[_0x8113('0x6b')]];this['queueReports'][_0x585d91[_0x8113('0x6b')]]=_0x2b41c9;}}else{_0x3b6d90[_0x8113('0x7d')]=_0x8113('0x8f')+_0x585d91[_0x8113('0x84')][_0x8113('0x90')]();}}}this[_0x8113('0x11')][_0x585d91['uniqueid']]=_0x3b6d90;this[_0x8113('0x42')](_0x3b6d90);}}}catch(_0x49efe4){logger[_0x8113('0x3c')](_0x8113('0x91'),util[_0x8113('0x43')](_0x49efe4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8113('0xa')]['syncVarSet']=function(_0xa64c55){try{if(this['isNotNull'](_0xa64c55)){this[_0x8113('0x92')](_0xa64c55['uniqueid'],_[_0x8113('0x70')](_0xa64c55[_0x8113('0x93')])[0x0],_0xa64c55[_0x8113('0x94')]);if(this[_0x8113('0xf')][_0xa64c55['uniqueid']]){var _0x4a6378=_['last'](this[_0x8113('0xf')][_0xa64c55[_0x8113('0x6b')]]);if(_0x4a6378){if(this[_0x8113('0x5f')](_0xa64c55[_0x8113('0x93')])&&this[_0x8113('0x5f')](_0xa64c55[_0x8113('0x93')][_0x8113('0x95')])){switch(_0xa64c55[_0x8113('0x94')]){case'CONTINUE':_0x4a6378[_0x8113('0x81')]=![];_0x4a6378[_0x8113('0x82')]=null;break;case _0x8113('0x96'):_0x4a6378[_0x8113('0x97')]=_0x8113('0x98');ami[_0x8113('0x44')]('custom:timeout',_0x4a6378);break;default:_0x4a6378[_0x8113('0x81')]=!![];_0x4a6378[_0x8113('0x82')]=moment()[_0x8113('0x46')](_0x8113('0x77'));_0x4a6378[_0x8113('0x99')]=moment()['format'](_0x8113('0x77'));}_0x4a6378[_0x8113('0x1b')]=![];_0x4a6378[_0x8113('0x76')]=null;_0x4a6378[_0x8113('0x7d')]=_0xa64c55[_0x8113('0x94')];this[_0x8113('0x11')][_0xa64c55[_0x8113('0x6b')]]=_0x4a6378;this['emitVoiceQueueChannelRemove'](_0x4a6378);}else if(this[_0x8113('0x5f')](_0xa64c55['variable'])&&this['isNotNull'](_0xa64c55[_0x8113('0x93')][_0x8113('0x9a')])){if(!_0x4a6378[_0x8113('0x1b')]){_0x4a6378[_0x8113('0x81')]=!![];_0x4a6378[_0x8113('0x82')]=moment()[_0x8113('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a6378[_0x8113('0x7d')]=_0x8113('0x9b');_0x4a6378[_0x8113('0x99')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x8113('0x11')][_0xa64c55['uniqueid']]=_0x4a6378;}}_0x4a6378['variables']=this[_0x8113('0x3f')][_0xa64c55[_0x8113('0x6b')]];}}}}catch(_0x146e99){logger['error'](_0x8113('0x9c'),util[_0x8113('0x43')](_0x146e99,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x4b6e93,_0x13ff4a,_0x32f746){var _0x26fd6c=['rtpaudioqos',_0x8113('0x9d'),_0x8113('0x9e'),_0x8113('0x9f'),_0x8113('0xa0'),_0x8113('0xa1'),_0x8113('0xa2'),'rtpaudioqosrttbridged',_0x8113('0xa3'),_0x8113('0xa4'),_0x8113('0xa5'),_0x8113('0xa6'),'membercalls',_0x8113('0xa7'),_0x8113('0xa8'),_0x8113('0xa9'),_0x8113('0x80'),_0x8113('0xaa'),'memberrealtime'];if(!_[_0x8113('0x37')](_0x13ff4a)&&!_[_0x8113('0xab')](_0x26fd6c,_0x13ff4a)){if(_['isUndefined'](this[_0x8113('0x3f')][_0x4b6e93])){this['variables'][_0x4b6e93]={};}this[_0x8113('0x3f')][_0x4b6e93][_0x13ff4a]=_0x32f746;}};VoiceQueueReport[_0x8113('0xa')]['syncHangup']=function(_0x2467a0){try{if(this[_0x8113('0x5f')](_0x2467a0)){if(this[_0x8113('0xf')][_0x2467a0['uniqueid']]){for(var _0x2e05b0=0x0,_0x2e7abc={};_0x2e05b00x0?_0x3cc077:0x0;this['voiceQueues'][_0x36c3cc[_0xcb10('0x63')]]['talking']=this[_0xcb10('0x12')][_0x36c3cc[_0xcb10('0x63')]][_0xcb10('0x30')]>_[_0xcb10('0x66')](_0x36c3cc[_0xcb10('0x67')])?_[_0xcb10('0x66')](_0x36c3cc[_0xcb10('0x67')]):this[_0xcb10('0x12')][_0x36c3cc[_0xcb10('0x63')]][_0xcb10('0x30')];this[_0xcb10('0x4b')](this[_0xcb10('0x12')][_0x36c3cc[_0xcb10('0x63')]]);}ami[_0xcb10('0x42')](_0xcb10('0x68'),this[_0xcb10('0x12')][_0x36c3cc[_0xcb10('0x63')]]);}}}catch(_0x9cfeb6){logger[_0xcb10('0x3c')]('[syncQueueSummary][VoiceQueueReport]',util[_0xcb10('0x69')](_0x9cfeb6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x18')]=function(_0x68543e){this[_0xcb10('0x61')]=!![];};VoiceQueueReport[_0xcb10('0xb')]['syncNewExten']=function(_0x1636c7){};VoiceQueueReport['prototype'][_0xcb10('0x1a')]=function(_0x45b2de){try{if(this[_0xcb10('0x5c')](_0x45b2de)){if(_[_0xcb10('0x6a')](this[_0xcb10('0x10')][_0x45b2de[_0xcb10('0x6b')]])){this['queueReports'][_0x45b2de[_0xcb10('0x6b')]]=[];this[_0xcb10('0x11')][_0x45b2de['uniqueid']]={};}var _0x3b1758=new QueueReport();_0x3b1758[_0xcb10('0x45')]=_0x45b2de[_0xcb10('0x63')];_0x3b1758[_0xcb10('0x53')]=this[_0xcb10('0x12')][_0x3b1758[_0xcb10('0x45')]]&&this[_0xcb10('0x12')][_0x3b1758['name']]['type']?this['voiceQueues'][_0x3b1758[_0xcb10('0x45')]][_0xcb10('0x53')]||'inbound':_0xcb10('0x4c');_0x3b1758[_0xcb10('0x63')]=_0x45b2de['queue'];_0x3b1758[_0xcb10('0x6c')]=moment()[_0xcb10('0x5a')](_0xcb10('0x6d'));_0x3b1758['position']=_0x45b2de[_0xcb10('0x6e')];_0x3b1758[_0xcb10('0x6f')]=_0x45b2de[_0xcb10('0x6f')];_[_0xcb10('0x70')](_0x3b1758,_[_0xcb10('0x71')](_0x45b2de,_[_0xcb10('0x72')](_0x3b1758)));this[_0xcb10('0x10')][_0x45b2de[_0xcb10('0x6b')]][_0xcb10('0x73')](_0x3b1758);this[_0xcb10('0x11')][_0x45b2de[_0xcb10('0x6b')]]=_0x3b1758;this['emitVoiceQueueChannelSave'](_0x3b1758);}}catch(_0x2df43d){logger['error'](_0xcb10('0x74'),util['inspect'](_0x2df43d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x1b')]=function(_0x3bb3e9){try{if(this[_0xcb10('0x5c')](_0x3bb3e9)){if(this[_0xcb10('0x10')][_0x3bb3e9['uniqueid']]){var _0x5b67f1=_['last'](this[_0xcb10('0x10')][_0x3bb3e9[_0xcb10('0x6b')]]);_0x5b67f1['queuecallercomplete']=![];_0x5b67f1['queuecallercompleteAt']=null;_0x5b67f1[_0xcb10('0x75')]=_0x3bb3e9[_0xcb10('0x75')];_0x5b67f1[_0xcb10('0x76')]=_0x3bb3e9[_0xcb10('0x76')];_0x5b67f1[_0xcb10('0x77')]=!![];_0x5b67f1['queuecallerabandonAt']=moment()[_0xcb10('0x5a')](_0xcb10('0x6d'));_0x5b67f1[_0xcb10('0x78')]='ABANDONED';_0x5b67f1[_0xcb10('0x79')]=null;this[_0xcb10('0x11')][_0x3bb3e9[_0xcb10('0x6b')]]=_0x5b67f1;this[_0xcb10('0x41')](_0x5b67f1);}}}catch(_0x2ef9f9){logger['error'](_0xcb10('0x7a'),util[_0xcb10('0x69')](_0x2ef9f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcb10('0xb')]['syncQueueCallerLeave']=function(_0x5e83bf){try{if(this[_0xcb10('0x5c')](_0x5e83bf)){if(this[_0xcb10('0x10')][_0x5e83bf[_0xcb10('0x6b')]]){var _0x4dbc7a=_[_0xcb10('0x7b')](this[_0xcb10('0x10')][_0x5e83bf[_0xcb10('0x6b')]]);_0x4dbc7a[_0xcb10('0x7c')]=moment()[_0xcb10('0x5a')](_0xcb10('0x6d'));_0x4dbc7a[_0xcb10('0x7d')]=_0x5e83bf[_0xcb10('0x7d')];_0x4dbc7a['connectedlinename']=_0x5e83bf[_0xcb10('0x7e')];this[_0xcb10('0x11')][_0x5e83bf[_0xcb10('0x6b')]]=_0x4dbc7a;this[_0xcb10('0x43')](_0x4dbc7a);}}}catch(_0x96d1cd){logger[_0xcb10('0x3c')](_0xcb10('0x7f'),util[_0xcb10('0x69')](_0x96d1cd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x1f')]=function(_0x17c08b){try{if(this[_0xcb10('0x5c')](_0x17c08b)){if(this['queueReports'][_0x17c08b[_0xcb10('0x6b')]]){var _0x3c9161=_[_0xcb10('0x7b')](this[_0xcb10('0x10')][_0x17c08b[_0xcb10('0x6b')]]);_0x3c9161['queuecallercomplete']=!![];_0x3c9161[_0xcb10('0x78')]=_0xcb10('0x80');}}}catch(_0x10cdf7){logger[_0xcb10('0x3c')](_0xcb10('0x81'),util[_0xcb10('0x69')](_0x10cdf7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x5346af){try{if(this[_0xcb10('0x5c')](_0x5346af)){if(this['queueReports'][_0x5346af[_0xcb10('0x6b')]]){var _0x1d575e=_[_0xcb10('0x7b')](this['queueReports'][_0x5346af[_0xcb10('0x6b')]]);_0x1d575e[_0xcb10('0x77')]=![];_0x1d575e[_0xcb10('0x82')]=null;_0x1d575e[_0xcb10('0x83')]=!![];_0x1d575e[_0xcb10('0x79')]=_0x5346af['membername'];_0x1d575e['holdtime']=_0x5346af['holdtime'];_0x1d575e[_0xcb10('0x84')]=!![];_0x1d575e[_0xcb10('0x85')]=![];_0x1d575e[_0xcb10('0x86')]=null;if(!_0x1d575e[_0xcb10('0x87')]){if(_0x5346af[_0xcb10('0x88')]=='transfer'){_0x1d575e[_0xcb10('0x78')]='COMPLETED';}else{if(_['startsWith'](_0x5346af[_0xcb10('0x39')][_0xcb10('0x89')](),_0xcb10('0x8a'))){if(this[_0xcb10('0x10')][_0x5346af[_0xcb10('0x8b')]]){var _0x1f9dfc=_[_0xcb10('0x7b')](this[_0xcb10('0x10')][_0x5346af[_0xcb10('0x8b')]]);_0x1f9dfc[_0xcb10('0x84')]=![];_0x1f9dfc[_0xcb10('0x85')]=!![];_0x1f9dfc[_0xcb10('0x86')]=moment(_0x1d575e['queuecallerjoinAt'])[_0xcb10('0x8c')](_0x5346af[_0xcb10('0x75')],'seconds')[_0xcb10('0x5a')](_0xcb10('0x6d'));_0x1f9dfc['queuecallerexitreason']='FORWARDTRANSFER';_0x1f9dfc[_0xcb10('0x87')]=!![];_0x1f9dfc['transfertype']=_0xcb10('0x8d');_0x1f9dfc[_0xcb10('0x8e')]=_0x5346af[_0xcb10('0x8f')];_0x1f9dfc[_0xcb10('0x90')]=_0x5346af['uniqueid'];var _0x2b0adf=this[_0xcb10('0x10')][_0x5346af[_0xcb10('0x8b')]];this[_0xcb10('0x10')][_0x5346af[_0xcb10('0x8b')]]=this[_0xcb10('0x10')][_0x5346af[_0xcb10('0x6b')]];this['queueReports'][_0x5346af[_0xcb10('0x6b')]]=_0x2b0adf;}}else{_0x1d575e['queuecallerexitreason']=_0xcb10('0x91')+_0x5346af[_0xcb10('0x88')][_0xcb10('0x92')]();}}}this['channels'][_0x5346af[_0xcb10('0x6b')]]=_0x1d575e;this[_0xcb10('0x41')](_0x1d575e);}}}catch(_0xa60624){logger[_0xcb10('0x3c')]('[syncAgentComplete][VoiceQueueReport]',util[_0xcb10('0x69')](_0xa60624,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x21')]=function(_0x319104){try{if(this[_0xcb10('0x5c')](_0x319104)){this[_0xcb10('0x93')](_0x319104[_0xcb10('0x6b')],_['keys'](_0x319104['variable'])[0x0],_0x319104[_0xcb10('0x94')]);if(this['queueReports'][_0x319104[_0xcb10('0x6b')]]){var _0x21aa1a=_['last'](this[_0xcb10('0x10')][_0x319104[_0xcb10('0x6b')]]);if(_0x21aa1a){if(this[_0xcb10('0x5c')](_0x319104[_0xcb10('0x95')])&&this[_0xcb10('0x5c')](_0x319104['variable'][_0xcb10('0x96')])){switch(_0x319104['value']){case'CONTINUE':_0x21aa1a[_0xcb10('0x85')]=![];_0x21aa1a[_0xcb10('0x86')]=null;break;case'TIMEOUT':_0x21aa1a[_0xcb10('0x97')]=_0xcb10('0x98');ami[_0xcb10('0x42')](_0xcb10('0x99'),_0x21aa1a);break;default:_0x21aa1a[_0xcb10('0x85')]=!![];_0x21aa1a[_0xcb10('0x86')]=moment()['format'](_0xcb10('0x6d'));_0x21aa1a[_0xcb10('0x7c')]=moment()[_0xcb10('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');}_0x21aa1a[_0xcb10('0x77')]=![];_0x21aa1a['queuecallerabandonAt']=null;_0x21aa1a[_0xcb10('0x78')]=_0x319104[_0xcb10('0x94')];this[_0xcb10('0x11')][_0x319104[_0xcb10('0x6b')]]=_0x21aa1a;this[_0xcb10('0x41')](_0x21aa1a);}else if(this[_0xcb10('0x5c')](_0x319104['variable'])&&this['isNotNull'](_0x319104['variable'][_0xcb10('0x9a')])){if(!_0x21aa1a[_0xcb10('0x77')]){_0x21aa1a[_0xcb10('0x85')]=!![];_0x21aa1a[_0xcb10('0x86')]=moment()[_0xcb10('0x5a')](_0xcb10('0x6d'));_0x21aa1a[_0xcb10('0x78')]=_0xcb10('0x9b');_0x21aa1a[_0xcb10('0x7c')]=moment()[_0xcb10('0x5a')](_0xcb10('0x6d'));this[_0xcb10('0x11')][_0x319104[_0xcb10('0x6b')]]=_0x21aa1a;}}_0x21aa1a[_0xcb10('0x14')]=this[_0xcb10('0x14')][_0x319104['uniqueid']];}}}}catch(_0x437360){logger[_0xcb10('0x3c')]('[syncVarSet][VoiceQueueReport]',util['inspect'](_0x437360,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcb10('0xb')]['addVariable']=function(_0x2e6813,_0x2199d9,_0x16faa2){var _0x4675a5=['rtpaudioqos','rtpaudioqosbridged',_0xcb10('0x9c'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0xcb10('0x9d'),_0xcb10('0x9e'),'bridgepeer','bridgepvtcallid',_0xcb10('0x9f'),_0xcb10('0xa0'),'memberinterface',_0xcb10('0xa1'),'membername',_0xcb10('0xa2'),'memberrealtime'];if(!_[_0xcb10('0x36')](_0x2199d9)&&!_['includes'](_0x4675a5,_0x2199d9)){if(_[_0xcb10('0x6a')](this['variables'][_0x2e6813])){this[_0xcb10('0x14')][_0x2e6813]={};}this[_0xcb10('0x14')][_0x2e6813][_0x2199d9]=_0x16faa2;}};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x23')]=function(_0x5a04c8){try{if(this[_0xcb10('0x5c')](_0x5a04c8)){if(this[_0xcb10('0x10')][_0x5a04c8[_0xcb10('0x6b')]]){for(var _0xe1a383=0x0,_0x4d7aff={};_0xe1a383=0x0?moment(_0x4d92c2[_0x66ff('0x17')])[_0x66ff('0xe')](_0x4d92c2[_0x66ff('0x18')],_0x66ff('0xf')):null,'data1':'outbound','data2':_0x4d92c2[_0x66ff('0x13')],'data3':_0x4d92c2[_0x66ff('0x19')],'data4':_0x4d92c2[_0x66ff('0x1a')]||null,'role':_0x66ff('0x12'),'internal':_0x4d92c2[_0x66ff('0x13')]?_['toNumber'](_0x4d92c2[_0x66ff('0x13')]):undefined,'uniqueid':_0x4d92c2[_0x66ff('0x1b')]},'log':_0x66ff('0x5')});}; \ No newline at end of file +var _0x647b=['TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime','endtime','accountcode','dialstring','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','format','SIP/%s'];(function(_0x4cd2da,_0x52288c){var _0x19ab6b=function(_0x3d2316){while(--_0x3d2316){_0x4cd2da['push'](_0x4cd2da['shift']());}};_0x19ab6b(++_0x52288c);}(_0x647b,0xa8));var _0xb647=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x647b[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require(_0xb647('0x0'));var _=require(_0xb647('0x1'));var util=require(_0xb647('0x2'));var client=require('../client');exports[_0xb647('0x3')]=function(_0x490d90){var _0x2f9841=_0x490d90[_0xb647('0x4')]||_0x490d90[_0xb647('0x5')];return client[_0xb647('0x6')]('CreateMemberReport',{'body':{'channel':_0xb647('0x7'),'membername':_0x490d90[_0xb647('0x8')],'interface':_[_0xb647('0x9')](_0x490d90['interface'])?util[_0xb647('0xa')](_0xb647('0xb'),_0x490d90[_0xb647('0x8')]):_0x490d90['interface'],'type':_0xb647('0xc'),'enterAt':_0x490d90[_0xb647('0xd')],'exitAt':_0x2f9841,'duration':moment(_0x2f9841)[_0xb647('0xe')](_0x490d90[_0xb647('0xd')],_0xb647('0xf')),'data1':_0xb647('0x10'),'data2':_0x490d90[_0xb647('0x11')],'data3':_0x490d90[_0xb647('0x12')],'data4':null,'data5':_0x490d90[_0xb647('0x13')],'role':_0xb647('0x14'),'internal':_0x490d90['accountcode']?_[_0xb647('0x15')](_0x490d90['accountcode']):undefined,'uniqueid':_0x490d90[_0xb647('0x16')]},'log':_0xb647('0x17')});};exports[_0xb647('0x18')]=function(_0x3daa57){return client['Request']('CreateMemberReport',{'body':{'channel':_0xb647('0x7'),'membername':_0x3daa57[_0xb647('0x19')],'interface':_0x3daa57['interface'],'type':_0xb647('0xc'),'enterAt':_0x3daa57[_0xb647('0x1a')],'exitAt':_0x3daa57[_0xb647('0x1b')],'duration':moment(_0x3daa57[_0xb647('0x1b')])[_0xb647('0xe')](_0x3daa57[_0xb647('0x1a')],_0xb647('0xf'))>=0x0?moment(_0x3daa57[_0xb647('0x1b')])['diff'](_0x3daa57['starttime'],_0xb647('0xf')):null,'data1':'outbound','data2':_0x3daa57[_0xb647('0x1c')],'data3':_0x3daa57['exten'],'data4':_0x3daa57[_0xb647('0x1d')]||null,'role':_0xb647('0x14'),'internal':_0x3daa57[_0xb647('0x1c')]?_['toNumber'](_0x3daa57[_0xb647('0x1c')]):undefined,'uniqueid':_0x3daa57[_0xb647('0x16')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 1b3f851..3ade2b6 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 _0xad95=['../client','getTemplates','GetTemplate','name'];(function(_0x3738ad,_0x4e25ae){var _0x253a25=function(_0x31954a){while(--_0x31954a){_0x3738ad['push'](_0x3738ad['shift']());}};_0x253a25(++_0x4e25ae);}(_0xad95,0x70));var _0x5ad9=function(_0xcb90a5,_0x3fe815){_0xcb90a5=_0xcb90a5-0x0;var _0x12ac8f=_0xad95[_0xcb90a5];return _0x12ac8f;};'use strict';var client=require(_0x5ad9('0x0'));exports[_0x5ad9('0x1')]=function(_0x1fe578){return function(_0x51c14c){return client['Request'](_0x5ad9('0x2'),{'options':{'raw':!![],'attributes':['id',_0x5ad9('0x3'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x073e=['GetTemplate','../client','getTemplates','html'];(function(_0x466101,_0x41dc92){var _0x562d55=function(_0x44ca99){while(--_0x44ca99){_0x466101['push'](_0x466101['shift']());}};_0x562d55(++_0x41dc92);}(_0x073e,0x181));var _0xe073=function(_0x37b32b,_0x3a8bfb){_0x37b32b=_0x37b32b-0x0;var _0x2c9ed0=_0x073e[_0x37b32b];return _0x2c9ed0;};'use strict';var client=require(_0xe073('0x0'));exports[_0xe073('0x1')]=function(_0x876bb9){return function(_0x358375){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0xe073('0x2')]},'log':_0xe073('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 3346c59..1204f7d 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 _0x685d=['data4','data5','data7','../client','GetTrigger','channel','Condition','operator','value','AnyConditions','Action','Actions','action','data1','data2','data3'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0x685d,0x1e3));var _0xd685=function(_0x53d38e,_0x5bf7d2){_0x53d38e=_0x53d38e-0x0;var _0x513b79=_0x685d[_0x53d38e];return _0x513b79;};'use strict';var client=require(_0xd685('0x0'));exports['getTriggers']=function(_0x5ab3bd){return function(_0x40ae24){return client['Request'](_0xd685('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xd685('0x2'),'status'],'include':[{'model':_0xd685('0x3'),'as':'AllConditions','attributes':['id','field',_0xd685('0x4'),_0xd685('0x5')]},{'model':_0xd685('0x3'),'as':_0xd685('0x6'),'attributes':['id','field',_0xd685('0x4'),'value']},{'model':_0xd685('0x7'),'as':_0xd685('0x8'),'attributes':['id',_0xd685('0x9'),_0xd685('0xa'),_0xd685('0xb'),_0xd685('0xc'),_0xd685('0xd'),_0xd685('0xe'),'data6',_0xd685('0xf')]}]},'log':_0xd685('0x1')});};}; \ No newline at end of file +var _0x0826=['data7','GetTrigger','../client','getTriggers','Request','Condition','AllConditions','field','operator','value','AnyConditions','Action','data3','data4','data6'];(function(_0x5338d3,_0x470835){var _0x8beb32=function(_0x718ac9){while(--_0x718ac9){_0x5338d3['push'](_0x5338d3['shift']());}};_0x8beb32(++_0x470835);}(_0x0826,0xc5));var _0x6082=function(_0x4414a6,_0x1dbf0e){_0x4414a6=_0x4414a6-0x0;var _0x5f009c=_0x0826[_0x4414a6];return _0x5f009c;};'use strict';var client=require(_0x6082('0x0'));exports[_0x6082('0x1')]=function(_0x9f03b7){return function(_0x6c27ac){return client[_0x6082('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel','status'],'include':[{'model':_0x6082('0x3'),'as':_0x6082('0x4'),'attributes':['id',_0x6082('0x5'),_0x6082('0x6'),_0x6082('0x7')]},{'model':'Condition','as':_0x6082('0x8'),'attributes':['id',_0x6082('0x5'),_0x6082('0x6'),_0x6082('0x7')]},{'model':_0x6082('0x9'),'as':'Actions','attributes':['id','action','data1','data2',_0x6082('0xa'),_0x6082('0xb'),'data5',_0x6082('0xc'),_0x6082('0xd')]}]},'log':_0x6082('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c8c542c..a43c58c 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 _0xf763=['../client','getTrunks','Request','GetTrunk','registry'];(function(_0x8c6d69,_0x332b04){var _0x18d108=function(_0x3b60d7){while(--_0x3b60d7){_0x8c6d69['push'](_0x8c6d69['shift']());}};_0x18d108(++_0x332b04);}(_0xf763,0x104));var _0x3f76=function(_0x1c5d8f,_0x3d1c94){_0x1c5d8f=_0x1c5d8f-0x0;var _0x58d07d=_0xf763[_0x1c5d8f];return _0x58d07d;};'use strict';var client=require(_0x3f76('0x0'));exports[_0x3f76('0x1')]=function(_0x17459c){return function(_0x5434af){return client[_0x3f76('0x2')](_0x3f76('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x3f76('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x2b12=['registry','../client','Request','name'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0x2b12,0x69));var _0x22b1=function(_0x5d84d6,_0x1a4671){_0x5d84d6=_0x5d84d6-0x0;var _0x2cd0f5=_0x2b12[_0x5d84d6];return _0x2cd0f5;};'use strict';var client=require(_0x22b1('0x0'));exports['getTrunks']=function(_0x1ac419){return function(_0x226c44){return client[_0x22b1('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x22b1('0x2'),_0x22b1('0x3')]},'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 c5ecd6e..d99aae9 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 _0x57c2=['name','accountcode','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','getTelephones','savePause','saveUnpause','UnpauseUser','getAgent','email','fullname','online','interface','getAgents','Request','GetUser','agent'];(function(_0x572418,_0x4ceaf6){var _0x2bf9d4=function(_0xdadb30){while(--_0xdadb30){_0x572418['push'](_0x572418['shift']());}};_0x2bf9d4(++_0x4ceaf6);}(_0x57c2,0xa4));var _0x257c=function(_0x11dcce,_0xae4932){_0x11dcce=_0x11dcce-0x0;var _0x52d134=_0x57c2[_0x11dcce];return _0x52d134;};'use strict';var client=require('../client');exports[_0x257c('0x0')]=function(){return function(){return client[_0x257c('0x1')](_0x257c('0x2'),{'options':{'raw':![],'where':{'role':_0x257c('0x3')},'attributes':['id',_0x257c('0x4'),'email',_0x257c('0x5'),'fullname','online',_0x257c('0x6'),_0x257c('0x7'),_0x257c('0x8'),_0x257c('0x9'),_0x257c('0xa'),_0x257c('0xb'),'interface']},'log':_0x257c('0x0')});};};exports[_0x257c('0xc')]=function(){return function(){return client['Request'](_0x257c('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x257c('0x4'),'accountcode','internal']},'log':_0x257c('0xc')});};};exports[_0x257c('0xd')]=function(_0x1c5bb2,_0x16b723,_0x5e40d7){return client['Request']('PauseUser',{'body':{'type':_0x16b723,'uniqueid':_0x5e40d7},'options':{'where':{'id':_0x1c5bb2['id']}},'log':'savePause'});};exports[_0x257c('0xe')]=function(_0x4e1439){return client[_0x257c('0x1')](_0x257c('0xf'),{'body':{},'options':{'where':{'id':_0x4e1439['id']}},'log':_0x257c('0xd')});};exports[_0x257c('0x10')]=function(_0x9d4126){return client[_0x257c('0x1')]('ShowUser',{'options':{'raw':![],'where':{'role':'agent','id':_0x9d4126},'attributes':['id',_0x257c('0x4'),_0x257c('0x11'),_0x257c('0x5'),_0x257c('0x12'),_0x257c('0x13'),_0x257c('0x6'),_0x257c('0x7'),_0x257c('0x8'),'voicePause',_0x257c('0x14')]},'log':_0x257c('0x10')});}; \ No newline at end of file +var _0xedf9=['fullname','pauseType','voicePause','mobile','interface','getTelephones','telephone','accountcode','internal','PauseUser','savePause','UnpauseUser','getAgent','ShowUser','online','lastPauseAt','getAgents','Request','agent','name','email'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xedf9,0x64));var _0x9edf=function(_0x37df7f,_0x4c827d){_0x37df7f=_0x37df7f-0x0;var _0x59fd67=_0xedf9[_0x37df7f];return _0x59fd67;};'use strict';var client=require('../client');exports[_0x9edf('0x0')]=function(){return function(){return client[_0x9edf('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':_0x9edf('0x2')},'attributes':['id',_0x9edf('0x3'),_0x9edf('0x4'),'accountcode',_0x9edf('0x5'),'online','lastLoginAt',_0x9edf('0x6'),'lastPauseAt',_0x9edf('0x7'),'phone',_0x9edf('0x8'),_0x9edf('0x9')]},'log':'getAgents'});};};exports[_0x9edf('0xa')]=function(){return function(){return client[_0x9edf('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x9edf('0xb')},'attributes':['id',_0x9edf('0x3'),_0x9edf('0xc'),_0x9edf('0xd')]},'log':_0x9edf('0xa')});};};exports['savePause']=function(_0x3f991b,_0x2bf6f1,_0x5ebb99){return client['Request'](_0x9edf('0xe'),{'body':{'type':_0x2bf6f1,'uniqueid':_0x5ebb99},'options':{'where':{'id':_0x3f991b['id']}},'log':_0x9edf('0xf')});};exports['saveUnpause']=function(_0x91bad){return client['Request'](_0x9edf('0x10'),{'body':{},'options':{'where':{'id':_0x91bad['id']}},'log':_0x9edf('0xf')});};exports[_0x9edf('0x11')]=function(_0x554e32){return client[_0x9edf('0x1')](_0x9edf('0x12'),{'options':{'raw':![],'where':{'role':_0x9edf('0x2'),'id':_0x554e32},'attributes':['id',_0x9edf('0x3'),'email',_0x9edf('0xc'),_0x9edf('0x5'),_0x9edf('0x13'),'lastLoginAt',_0x9edf('0x6'),_0x9edf('0x14'),'voicePause','interface']},'log':_0x9edf('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index afed7e1..3b61d88 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 _0xcbdd=['UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport','update'];(function(_0x142627,_0x59acfe){var _0x38f93e=function(_0x56041a){while(--_0x56041a){_0x142627['push'](_0x142627['shift']());}};_0x38f93e(++_0x59acfe);}(_0xcbdd,0xec));var _0xdcbd=function(_0x1f7749,_0x509d11){_0x1f7749=_0x1f7749-0x0;var _0x55a16a=_0xcbdd[_0x1f7749];return _0x55a16a;};'use strict';var client=require(_0xdcbd('0x0'));exports['create']=function(_0x342f40){return client[_0xdcbd('0x1')](_0xdcbd('0x2'),{'body':_0x342f40,'log':'CreateVoiceAgentReport'});};exports[_0xdcbd('0x3')]=function(_0x3b2849,_0x3d3e88,_0x5c0331){return client[_0xdcbd('0x1')]('UpdateVoiceAgentReport',{'body':_0x3b2849,'options':{'where':{'uniqueid':_0x3d3e88,'interface':_0x5c0331,'agentcomplete':!![]}},'log':_0xdcbd('0x4')});}; \ No newline at end of file +var _0x102f=['UpdateVoiceAgentReport','Request','update'];(function(_0x730f27,_0x4a8fa5){var _0x13fe15=function(_0xd14a9){while(--_0xd14a9){_0x730f27['push'](_0x730f27['shift']());}};_0x13fe15(++_0x4a8fa5);}(_0x102f,0x1d2));var _0xf102=function(_0x3833fd,_0x3d4f6a){_0x3833fd=_0x3833fd-0x0;var _0x111c26=_0x102f[_0x3833fd];return _0x111c26;};'use strict';var client=require('../client');exports['create']=function(_0x516df0){return client[_0xf102('0x0')]('CreateVoiceAgentReport',{'body':_0x516df0,'log':'CreateVoiceAgentReport'});};exports[_0xf102('0x1')]=function(_0x109fe0,_0xa8ad91,_0x62ef71){return client['Request'](_0xf102('0x2'),{'body':_0x109fe0,'options':{'where':{'uniqueid':_0xa8ad91,'interface':_0x62ef71,'agentcomplete':!![]}},'log':_0xf102('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 55cadbe..7672c54 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 _0xc681=['YYYY-MM-DD\x20HH:mm:ss','disposition','duration','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc681,0x97));var _0x1c68=function(_0x4fd642,_0x542c9c){_0x4fd642=_0x4fd642-0x0;var _0x22f7a8=_0xc681[_0x4fd642];return _0x22f7a8;};'use strict';var moment=require(_0x1c68('0x0'));var util=require(_0x1c68('0x1'));var _=require(_0x1c68('0x2'));var client=require(_0x1c68('0x3'));exports[_0x1c68('0x4')]=function(_0x2c0bb1){return client[_0x1c68('0x5')](_0x1c68('0x6'),{'body':_[_0x1c68('0x7')](_0x2c0bb1,{'source':_0x2c0bb1[_0x1c68('0x8')],'destinationcontext':_0x2c0bb1[_0x1c68('0x9')],'callerid':_0x2c0bb1[_0x1c68('0xa')],'amaflags':'DOCUMENTATION'}),'log':_0x1c68('0x6')});};exports[_0x1c68('0xb')]=function(){return function(){return client['Request'](_0x1c68('0xc'),{'options':{'where':{'type':[_0x1c68('0xd')],'createdAt':{'$between':[moment()[_0x1c68('0xe')](_0x1c68('0xf'))[_0x1c68('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x1c68('0xf'))[_0x1c68('0x10')](_0x1c68('0x11'))]}},'attributes':['type',_0x1c68('0x12'),_0x1c68('0x13'),'billableseconds']},'log':_0x1c68('0x14')});};}; \ No newline at end of file +var _0xc24c=['startOf','day','format','endOf','type','billableseconds','GetVoiceCallReports','moment','lodash','create','Request','CreateVoiceCallReport','merge','context','GetVoiceCallReport'];(function(_0x39fb6f,_0x4f8491){var _0x5c7720=function(_0x4211b2){while(--_0x4211b2){_0x39fb6f['push'](_0x39fb6f['shift']());}};_0x5c7720(++_0x4f8491);}(_0xc24c,0x17e));var _0xcc24=function(_0x23f1d8,_0x1be604){_0x23f1d8=_0x23f1d8-0x0;var _0x5ae398=_0xc24c[_0x23f1d8];return _0x5ae398;};'use strict';var moment=require(_0xcc24('0x0'));var util=require('util');var _=require(_0xcc24('0x1'));var client=require('../client');exports[_0xcc24('0x2')]=function(_0x12cab2){return client[_0xcc24('0x3')](_0xcc24('0x4'),{'body':_[_0xcc24('0x5')](_0x12cab2,{'source':_0x12cab2['calleridnum'],'destinationcontext':_0x12cab2[_0xcc24('0x6')],'callerid':_0x12cab2['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0xcc24('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xcc24('0x3')](_0xcc24('0x7'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xcc24('0x8')](_0xcc24('0x9'))[_0xcc24('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xcc24('0xb')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xcc24('0xc'),'disposition','duration',_0xcc24('0xd')]},'log':_0xcc24('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 7a76a1b..a85273b 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 _0xc098=['create','Request','CreateVoiceDialReport','../client'];(function(_0x504736,_0x40dfbb){var _0x644bc8=function(_0x5b7a8e){while(--_0x5b7a8e){_0x504736['push'](_0x504736['shift']());}};_0x644bc8(++_0x40dfbb);}(_0xc098,0x183));var _0x8c09=function(_0x54ffa5,_0x5cd665){_0x54ffa5=_0x54ffa5-0x0;var _0x3eb9d0=_0xc098[_0x54ffa5];return _0x3eb9d0;};'use strict';var client=require(_0x8c09('0x0'));exports[_0x8c09('0x1')]=function(_0x3a8d19){return client[_0x8c09('0x2')](_0x8c09('0x3'),{'body':_0x3a8d19,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x46d2=['../client','create','Request','CreateVoiceDialReport'];(function(_0x152457,_0x2d8546){var _0x50cec5=function(_0x46b166){while(--_0x46b166){_0x152457['push'](_0x152457['shift']());}};_0x50cec5(++_0x2d8546);}(_0x46d2,0x1cc));var _0x246d=function(_0x37456e,_0x475d2f){_0x37456e=_0x37456e-0x0;var _0x4e48ba=_0x46d2[_0x37456e];return _0x4e48ba;};'use strict';var client=require(_0x246d('0x0'));exports[_0x246d('0x1')]=function(_0x53708b){return client[_0x246d('0x2')]('CreateVoiceDialReport',{'body':_0x53708b,'log':_0x246d('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ee28789..56f53d4 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 _0x8863=['GetVoiceExtension','exten','getVoiceExtensions','Request'];(function(_0x8531f8,_0xe334b3){var _0x1ffe1b=function(_0x4f903c){while(--_0x4f903c){_0x8531f8['push'](_0x8531f8['shift']());}};_0x1ffe1b(++_0xe334b3);}(_0x8863,0x1b6));var _0x3886=function(_0x325af2,_0x250881){_0x325af2=_0x325af2-0x0;var _0x18d45d=_0x8863[_0x325af2];return _0x18d45d;};'use strict';var client=require('../client');exports[_0x3886('0x0')]=function(){return function(){return client[_0x3886('0x1')](_0x3886('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3886('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x25c2=['getVoiceExtensions','../client','Request','GetVoiceExtension','recordingFormat'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x25c2,0xdd));var _0x225c=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x25c2[_0x2ff238];return _0x204a56;};'use strict';var client=require(_0x225c('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x225c('0x1')](_0x225c('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x225c('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x225c('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index b52debb..143ef16 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 _0xea06=['monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','callerid','active','Pause','mandatoryDispositionPause','Trunk','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause'];(function(_0x1398e6,_0x116695){var _0xf62c23=function(_0x2d3f95){while(--_0x2d3f95){_0x1398e6['push'](_0x1398e6['shift']());}};_0xf62c23(++_0x116695);}(_0xea06,0x195));var _0x6ea0=function(_0x50f07f,_0x372d20){_0x50f07f=_0x50f07f-0x0;var _0x39714e=_0xea06[_0x50f07f];return _0x39714e;};'use strict';var client=require(_0x6ea0('0x0'));exports[_0x6ea0('0x1')]=function(){return function(){return client[_0x6ea0('0x2')](_0x6ea0('0x3'),{'options':{'raw':![],'attributes':['id',_0x6ea0('0x4'),_0x6ea0('0x5'),_0x6ea0('0x6'),_0x6ea0('0x7'),_0x6ea0('0x8'),_0x6ea0('0x9'),_0x6ea0('0xa'),_0x6ea0('0xb'),_0x6ea0('0xc'),_0x6ea0('0xd'),_0x6ea0('0xe'),_0x6ea0('0xf'),'dialPredictiveOptimizationPercentage',_0x6ea0('0x10'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout',_0x6ea0('0x11'),_0x6ea0('0x12'),_0x6ea0('0x13'),'dialCongestionMaxRetry',_0x6ea0('0x14'),_0x6ea0('0x15'),_0x6ea0('0x16'),_0x6ea0('0x17'),_0x6ea0('0x18'),_0x6ea0('0x19'),_0x6ea0('0x1a'),_0x6ea0('0x1b'),'dialPrefix',_0x6ea0('0x1c'),_0x6ea0('0x1d'),'dialAMDInitialSilence',_0x6ea0('0x1e'),_0x6ea0('0x1f'),'dialAMDTotalAnalysisTime',_0x6ea0('0x20'),_0x6ea0('0x21'),'dialAMDMaximumNumberOfWords',_0x6ea0('0x22'),_0x6ea0('0x23'),_0x6ea0('0x24'),_0x6ea0('0x25'),'dialRecallInQueue','dialOrderByScheduledAt',_0x6ea0('0x26'),'dialAgiAfterHangupClient',_0x6ea0('0x27'),_0x6ea0('0x8'),_0x6ea0('0x28'),_0x6ea0('0x29'),_0x6ea0('0x2a'),_0x6ea0('0x2b'),_0x6ea0('0x2c'),_0x6ea0('0x2d'),'dialDropRetryFrequency',_0x6ea0('0x2e'),_0x6ea0('0x2f'),'dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x6ea0('0x30'),_0x6ea0('0x31'),_0x6ea0('0x32'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x6ea0('0x4'),_0x6ea0('0x33'),_0x6ea0('0x34')]},{'model':_0x6ea0('0x35'),'as':_0x6ea0('0x36'),'attributes':['id',_0x6ea0('0x4')]},{'model':_0x6ea0('0x37'),'as':_0x6ea0('0x38'),'attributes':['id',_0x6ea0('0x4'),_0x6ea0('0x33'),_0x6ea0('0x34')]},{'model':_0x6ea0('0x39'),'as':'Interval','attributes':['id',_0x6ea0('0x4')],'include':[{'model':_0x6ea0('0x39'),'as':'Intervals','attributes':['id',_0x6ea0('0x4'),_0x6ea0('0x3a')]}]}]},'log':_0x6ea0('0x1')});};}; \ No newline at end of file +var _0x619e=['getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','TrunkBackup','Interval','Intervals','interval','../client'];(function(_0x2d25a7,_0x5950c5){var _0x5dafc9=function(_0x117515){while(--_0x117515){_0x2d25a7['push'](_0x2d25a7['shift']());}};_0x5dafc9(++_0x5950c5);}(_0x619e,0x1a3));var _0xe619=function(_0x2c4ca7,_0x5abe87){_0x2c4ca7=_0x2c4ca7-0x0;var _0xc82d75=_0x619e[_0x2c4ca7];return _0xc82d75;};'use strict';var client=require(_0xe619('0x0'));exports[_0xe619('0x1')]=function(){return function(){return client[_0xe619('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xe619('0x3'),_0xe619('0x4'),_0xe619('0x5'),_0xe619('0x6'),_0xe619('0x7'),_0xe619('0x8'),_0xe619('0x9'),'dialMethod',_0xe619('0xa'),'dialLimitQueue',_0xe619('0xb'),_0xe619('0xc'),_0xe619('0xd'),_0xe619('0xe'),'dialOriginateCallerIdName',_0xe619('0xf'),_0xe619('0x10'),_0xe619('0x11'),'dialQueueTimeout',_0xe619('0x12'),_0xe619('0x13'),'dialCongestionRetryFrequency',_0xe619('0x14'),_0xe619('0x15'),_0xe619('0x16'),_0xe619('0x17'),_0xe619('0x18'),_0xe619('0x19'),_0xe619('0x1a'),_0xe619('0x1b'),_0xe619('0x1c'),_0xe619('0x1d'),'dialAMDInitialSilence',_0xe619('0x1e'),_0xe619('0x1f'),_0xe619('0x20'),_0xe619('0x21'),_0xe619('0x22'),_0xe619('0x23'),_0xe619('0x24'),_0xe619('0x25'),_0xe619('0x26'),_0xe619('0x27'),'dialRecallInQueue',_0xe619('0x28'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xe619('0x29'),'monitor_format','strategy',_0xe619('0x2a'),_0xe619('0x2b'),'dialNoSuchNumberMaxRetry',_0xe619('0x2c'),_0xe619('0x2d'),_0xe619('0x2e'),_0xe619('0x2f'),_0xe619('0x30'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xe619('0x31'),_0xe619('0x32'),'mandatoryDisposition',_0xe619('0x33'),_0xe619('0x34')],'include':[{'model':_0xe619('0x35'),'as':_0xe619('0x35'),'attributes':['id',_0xe619('0x3'),_0xe619('0x36'),_0xe619('0x37')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0xe619('0x3')]},{'model':_0xe619('0x35'),'as':_0xe619('0x38'),'attributes':['id','name',_0xe619('0x36'),'active']},{'model':_0xe619('0x39'),'as':_0xe619('0x39'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xe619('0x3a'),'attributes':['id',_0xe619('0x3'),_0xe619('0x3b')]}]}]},'log':_0xe619('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 5d4f217..8b37e50 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 _0x6157=['format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexitAt','GetVoiceQueueReports','moment','lodash','create','CreateVoiceQueueReport','getVoiceQueueReports','Request','GetVoiceQueueReport','endOf','day'];(function(_0x327076,_0x38e16b){var _0x513a84=function(_0x701710){while(--_0x701710){_0x327076['push'](_0x327076['shift']());}};_0x513a84(++_0x38e16b);}(_0x6157,0x1a0));var _0x7615=function(_0x3b34b2,_0x26e311){_0x3b34b2=_0x3b34b2-0x0;var _0x306142=_0x6157[_0x3b34b2];return _0x306142;};'use strict';var moment=require(_0x7615('0x0'));var _=require(_0x7615('0x1'));var client=require('../client');exports[_0x7615('0x2')]=function(_0x2bf2bd){return client['Request'](_0x7615('0x3'),{'body':_0x2bf2bd,'log':_0x7615('0x3')});};exports[_0x7615('0x4')]=function(){return function(){return client[_0x7615('0x5')](_0x7615('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x7615('0x7')](_0x7615('0x8'))[_0x7615('0x9')](_0x7615('0xa'))]}},'attributes':[_0x7615('0xb'),'queue',_0x7615('0xc'),_0x7615('0xd'),'queuecallercomplete',_0x7615('0xe'),'queuecallerexit',_0x7615('0xf'),'queuecallerabandon','queuecallerabandonAt']},'log':_0x7615('0x10')});};}; \ No newline at end of file +var _0x73c6=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt'];(function(_0x5e0c74,_0x2b9f06){var _0x2dfde9=function(_0x29921a){while(--_0x29921a){_0x5e0c74['push'](_0x5e0c74['shift']());}};_0x2dfde9(++_0x2b9f06);}(_0x73c6,0x195));var _0x673c=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x73c6[_0x42bdad];return _0x122626;};'use strict';var moment=require(_0x673c('0x0'));var _=require('lodash');var client=require(_0x673c('0x1'));exports['create']=function(_0x4ab3b1){return client[_0x673c('0x2')](_0x673c('0x3'),{'body':_0x4ab3b1,'log':_0x673c('0x3')});};exports[_0x673c('0x4')]=function(){return function(){return client[_0x673c('0x2')](_0x673c('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x673c('0x6'))[_0x673c('0x7')](_0x673c('0x8')),moment()[_0x673c('0x9')](_0x673c('0x6'))[_0x673c('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x673c('0xa'),_0x673c('0xb'),_0x673c('0xc'),'queuecallerleaveAt',_0x673c('0xd'),_0x673c('0xe'),_0x673c('0xf'),_0x673c('0x10'),_0x673c('0x11'),_0x673c('0x12')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 87f5a33..bca052e 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 _0x29ea=['Request','GetVoiceQueueRtPauses','../client'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x29ea,0x104));var _0xa29e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x29ea[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xa29e('0x0'));exports['getVoiceQueueRtPauses']=function(_0x107046){return function(){return client[_0xa29e('0x1')](_0xa29e('0x2'),{'options':{'where':{'VoiceQueueId':_0x107046,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x458d=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x551f25,_0x34ca56){var _0x573dc2=function(_0x297cb6){while(--_0x297cb6){_0x551f25['push'](_0x551f25['shift']());}};_0x573dc2(++_0x34ca56);}(_0x458d,0xe2));var _0xd458=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x458d[_0x4a53d];return _0x27410e;};'use strict';var client=require(_0xd458('0x0'));exports[_0xd458('0x1')]=function(_0x33a9e1){return function(){return client[_0xd458('0x2')](_0xd458('0x3'),{'options':{'where':{'VoiceQueueId':_0x33a9e1,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 1c2f2f1..6e5ff3c 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 _0x2950=['merge','lodash','../client','create','Request','CreateVoiceRecording'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0x2950,0xcd));var _0x0295=function(_0x24f2c9,_0xea7547){_0x24f2c9=_0x24f2c9-0x0;var _0x74beea=_0x2950[_0x24f2c9];return _0x74beea;};'use strict';var _=require(_0x0295('0x0'));var client=require(_0x0295('0x1'));exports[_0x0295('0x2')]=function(_0x168a7d){return client[_0x0295('0x3')](_0x0295('0x4'),{'body':_[_0x0295('0x5')](_0x168a7d,{'value':_0x168a7d['monitorFilename']}),'log':_0x0295('0x4')});}; \ No newline at end of file +var _0x0221=['CreateVoiceRecording','lodash','../client','Request'];(function(_0x52b37c,_0x3a0940){var _0x44997d=function(_0x563f1e){while(--_0x563f1e){_0x52b37c['push'](_0x52b37c['shift']());}};_0x44997d(++_0x3a0940);}(_0x0221,0x141));var _0x1022=function(_0x53837f,_0x9b178e){_0x53837f=_0x53837f-0x0;var _0x5d8c8c=_0x0221[_0x53837f];return _0x5d8c8c;};'use strict';var _=require(_0x1022('0x0'));var client=require(_0x1022('0x1'));exports['create']=function(_0x5e6867){return client[_0x1022('0x2')]('CreateVoiceRecording',{'body':_['merge'](_0x5e6867,{'value':_0x5e6867['monitorFilename']}),'log':_0x1022('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 7e07dfd..fffef05 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 _0xfec1=['transfereeexten','transfereelinkedid','context','extension','blind','CreateVoiceTransferReport','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereecontext'];(function(_0x1df3f5,_0x2f7232){var _0x347f1a=function(_0x4759a5){while(--_0x4759a5){_0x1df3f5['push'](_0x1df3f5['shift']());}};_0x347f1a(++_0x2f7232);}(_0xfec1,0x163));var _0x1fec=function(_0xf794c7,_0x5a1632){_0xf794c7=_0xf794c7-0x0;var _0x37fc7f=_0xfec1[_0xf794c7];return _0x37fc7f;};'use strict';var client=require(_0x1fec('0x0'));exports['blindTransfer']=function(_0x23f41a){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x23f41a['result'],'transfererchannel':_0x23f41a[_0x1fec('0x1')],'transferercalleridnum':_0x23f41a[_0x1fec('0x2')],'transferercalleridname':_0x23f41a[_0x1fec('0x3')],'transfererconnectedlinenum':_0x23f41a[_0x1fec('0x4')],'transfererconnectedlinename':_0x23f41a[_0x1fec('0x5')],'transfereraccountcode':_0x23f41a[_0x1fec('0x6')],'transferercontext':_0x23f41a[_0x1fec('0x7')],'transfererexten':_0x23f41a[_0x1fec('0x8')],'transfererlinkedid':_0x23f41a[_0x1fec('0x9')],'transfereechannel':_0x23f41a['transfereechannel'],'transfereecalleridnum':_0x23f41a[_0x1fec('0xa')],'transfereecalleridname':_0x23f41a[_0x1fec('0xb')],'transfereeconnectedlinenum':_0x23f41a['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x23f41a[_0x1fec('0xc')],'transfereeaccountcode':_0x23f41a['transfereeaccountcode'],'transfereecontext':_0x23f41a[_0x1fec('0xd')],'transfereeexten':_0x23f41a[_0x1fec('0xe')],'transfereelinkedid':_0x23f41a[_0x1fec('0xf')],'isexternal':_0x23f41a['isexternal'],'context':_0x23f41a[_0x1fec('0x10')],'extension':_0x23f41a[_0x1fec('0x11')],'type':_0x1fec('0x12')},'log':_0x1fec('0x13')});};exports['attendedTransfer']=function(_0x2b0d8f){return client[_0x1fec('0x14')](_0x1fec('0x13'),{'body':{'result':_0x2b0d8f['result'],'transfererchannel':_0x2b0d8f[_0x1fec('0x15')],'transferercalleridnum':_0x2b0d8f[_0x1fec('0x16')],'transferercalleridname':_0x2b0d8f[_0x1fec('0x17')],'transfererconnectedlinenum':_0x2b0d8f[_0x1fec('0x18')],'transfererconnectedlinename':_0x2b0d8f[_0x1fec('0x19')],'transfereraccountcode':_0x2b0d8f[_0x1fec('0x1a')],'transferercontext':_0x2b0d8f[_0x1fec('0x1b')],'transfererexten':_0x2b0d8f[_0x1fec('0x1c')],'transfererlinkedid':_0x2b0d8f[_0x1fec('0x1d')],'transfereechannel':_0x2b0d8f[_0x1fec('0x1e')],'transfereecalleridnum':_0x2b0d8f['transfertargetcalleridnum'],'transfereecalleridname':_0x2b0d8f[_0x1fec('0x1f')],'transfereeconnectedlinenum':_0x2b0d8f[_0x1fec('0x20')],'transfereeconnectedlinename':_0x2b0d8f[_0x1fec('0x21')],'transfereeaccountcode':_0x2b0d8f[_0x1fec('0x22')],'transfereecontext':_0x2b0d8f[_0x1fec('0x23')],'transfereeexten':_0x2b0d8f['transfertargetexten'],'transfereelinkedid':_0x2b0d8f[_0x1fec('0x24')],'isexternal':_0x2b0d8f[_0x1fec('0x25')],'context':_0x2b0d8f[_0x1fec('0x26')],'extension':_0x2b0d8f[_0x1fec('0x27')],'type':_0x1fec('0x28')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xf4b0=['transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x2f99a9,_0x18c2ec){var _0xc446bb=function(_0x10cafc){while(--_0x10cafc){_0x2f99a9['push'](_0x2f99a9['shift']());}};_0xc446bb(++_0x18c2ec);}(_0xf4b0,0x10f));var _0x0f4b=function(_0x294b37,_0x4b3dfe){_0x294b37=_0x294b37-0x0;var _0x3d2f95=_0xf4b0[_0x294b37];return _0x3d2f95;};'use strict';var client=require(_0x0f4b('0x0'));exports['blindTransfer']=function(_0x17b631){return client[_0x0f4b('0x1')](_0x0f4b('0x2'),{'body':{'result':_0x17b631[_0x0f4b('0x3')],'transfererchannel':_0x17b631[_0x0f4b('0x4')],'transferercalleridnum':_0x17b631[_0x0f4b('0x5')],'transferercalleridname':_0x17b631['transferercalleridname'],'transfererconnectedlinenum':_0x17b631[_0x0f4b('0x6')],'transfererconnectedlinename':_0x17b631[_0x0f4b('0x7')],'transfereraccountcode':_0x17b631[_0x0f4b('0x8')],'transferercontext':_0x17b631['transferercontext'],'transfererexten':_0x17b631['transfererexten'],'transfererlinkedid':_0x17b631['transfererlinkedid'],'transfereechannel':_0x17b631['transfereechannel'],'transfereecalleridnum':_0x17b631[_0x0f4b('0x9')],'transfereecalleridname':_0x17b631[_0x0f4b('0xa')],'transfereeconnectedlinenum':_0x17b631['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x17b631[_0x0f4b('0xb')],'transfereeaccountcode':_0x17b631[_0x0f4b('0xc')],'transfereecontext':_0x17b631[_0x0f4b('0xd')],'transfereeexten':_0x17b631['transfereeexten'],'transfereelinkedid':_0x17b631[_0x0f4b('0xe')],'isexternal':_0x17b631['isexternal'],'context':_0x17b631[_0x0f4b('0xf')],'extension':_0x17b631[_0x0f4b('0x10')],'type':_0x0f4b('0x11')},'log':_0x0f4b('0x2')});};exports[_0x0f4b('0x12')]=function(_0x47abfa){return client['Request'](_0x0f4b('0x2'),{'body':{'result':_0x47abfa['result'],'transfererchannel':_0x47abfa[_0x0f4b('0x13')],'transferercalleridnum':_0x47abfa[_0x0f4b('0x14')],'transferercalleridname':_0x47abfa[_0x0f4b('0x15')],'transfererconnectedlinenum':_0x47abfa[_0x0f4b('0x16')],'transfererconnectedlinename':_0x47abfa['secondtransfererconnectedlinename'],'transfereraccountcode':_0x47abfa[_0x0f4b('0x17')],'transferercontext':_0x47abfa[_0x0f4b('0x18')],'transfererexten':_0x47abfa[_0x0f4b('0x19')],'transfererlinkedid':_0x47abfa[_0x0f4b('0x1a')],'transfereechannel':_0x47abfa[_0x0f4b('0x1b')],'transfereecalleridnum':_0x47abfa[_0x0f4b('0x1c')],'transfereecalleridname':_0x47abfa[_0x0f4b('0x1d')],'transfereeconnectedlinenum':_0x47abfa[_0x0f4b('0x1e')],'transfereeconnectedlinename':_0x47abfa[_0x0f4b('0x1f')],'transfereeaccountcode':_0x47abfa[_0x0f4b('0x20')],'transfereecontext':_0x47abfa[_0x0f4b('0x21')],'transfereeexten':_0x47abfa['transfertargetexten'],'transfereelinkedid':_0x47abfa[_0x0f4b('0x22')],'isexternal':_0x47abfa[_0x0f4b('0x23')],'context':_0x47abfa[_0x0f4b('0x24')],'extension':_0x47abfa[_0x0f4b('0x25')],'type':'attended'},'log':_0x0f4b('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 75f9878..c1b1f0c 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 _0xac3a=['destinationchannel','stop','filename','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','telephones','trunks','outboundChannels','campaigns','run','event','custom:','faxAccounts','send','checkAfterSend','server','listen','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','format','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','module','Action','message','catch','pick','command','action','Command','then','content','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','abandoned','waiting','type','outbound','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','startProgressive','Trunk','callerid','Interval','push','values','channels','length','voicechannel','map','find','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor'];(function(_0x3251ab,_0x2ce04b){var _0x194bc3=function(_0x59e4fa){while(--_0x59e4fa){_0x3251ab['push'](_0x3251ab['shift']());}};_0x194bc3(++_0x2ce04b);}(_0xac3a,0x128));var _0xaac3=function(_0x1d5ba8,_0x412a52){_0x1d5ba8=_0x1d5ba8-0x0;var _0x1022a2=_0xac3a[_0x1d5ba8];return _0x1022a2;};'use strict';var _=require(_0xaac3('0x0'));var util=require(_0xaac3('0x1'));var jayson=require(_0xaac3('0x2'));var schema=require(_0xaac3('0x3'));var BPromise=require(_0xaac3('0x4'));var moment=require(_0xaac3('0x5'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require('../ami');exports['listen']=function(_0x394302,_0x4dc4fb,_0x4dd0a2){return new BPromise(function(_0x184ef7,_0x594303){var _0x3691d1={'QueuePause':function(_0x54f166){return new Promise(function(_0xe86753,_0xd9d9a9){var _0x29ef51=util[_0xaac3('0x6')](_0xaac3('0x7'),_0xaac3('0x8'),_0x54f166[_0xaac3('0x9')]);if(_0x394302[_0xaac3('0xa')]&&_0x394302[_0xaac3('0xa')][_0x29ef51]&&_0x394302[_0xaac3('0xa')][_0x29ef51][_0xaac3('0xb')]){_0x394302['timers'][_0x29ef51]['updateAcw']();}if(_0x394302[_0xaac3('0xc')][_0x29ef51]){_0x394302['agents'][_0x29ef51][_0xaac3('0xd')]({'statePause':_0x54f166[_0xaac3('0xe')]?!![]:![]});}_0xe86753({'code':0xc8,'message':_0xaac3('0xf')});});},'Reload':function(_0x2b9e01){var _0x149730=this;return new Promise(function(_0x2d3636,_0x25c833){if(ami[_0xaac3('0x10')]()==![]){return _0x25c833(_0x149730[_0xaac3('0x11')](0x1f4,[config[_0xaac3('0x12')]['ip'],config['asterisk'][_0xaac3('0x13')],_0xaac3('0x14')][_0xaac3('0x15')]('\x20')));}_0x2b9e01=_['pick'](_0x2b9e01,_[_0xaac3('0x16')](properties[_0xaac3('0x17')]));_0x2b9e01['action']='Reload';return ami[_0xaac3('0x18')](_0x2b9e01)['then'](function(_0x3900bf){_0x2d3636({'code':0xc8,'message':_0x3900bf[_0xaac3('0x19')]});})[_0xaac3('0x1a')](function(_0x4214e2){_0x25c833(_0x149730[_0xaac3('0x11')](0x1f5,_0x4214e2[_0xaac3('0x19')]));});});},'Command':function(_0x51c3ae){var _0x3679b4=this;return new Promise(function(_0x189392,_0x832e8c){if(ami[_0xaac3('0x10')]()==![]){return _0x832e8c(_0x3679b4[_0xaac3('0x11')](0x1f4,[config[_0xaac3('0x12')]['ip'],config[_0xaac3('0x12')][_0xaac3('0x13')],'ami\x20disconnected'][_0xaac3('0x15')]('\x20')));}_0x51c3ae=_[_0xaac3('0x1b')](_0x51c3ae,_0xaac3('0x1c'));_0x51c3ae[_0xaac3('0x1d')]=_0xaac3('0x1e');return ami[_0xaac3('0x18')](_0x51c3ae)[_0xaac3('0x1f')](function(_0x1d546d){_0x189392({'code':0xc8,'message':_0x1d546d[_0xaac3('0x20')]});})['catch'](function(_0x2b08ee){_0x832e8c(_0x3679b4[_0xaac3('0x11')](0x1f5,_0x2b08ee[_0xaac3('0x19')]));});});},'VoiceQueues':function(_0x40f79e){return new Promise(function(_0x19db68,_0x43fdd8){var _0xea4c24=[];for(var _0x2878af in _0x394302[_0xaac3('0x21')]){if(_0x394302[_0xaac3('0x21')]['hasOwnProperty'](_0x2878af)){var _0x4fcc50=_0x394302['voiceQueues'][_0x2878af];var _0x14f261={'id':_0x4fcc50['id'],'name':_0x4fcc50[_0xaac3('0x9')],'strategy':_0x4fcc50[_0xaac3('0x22')],'answered':_0x4fcc50[_0xaac3('0x23')],'available':_0x4fcc50[_0xaac3('0x24')],'loggedIn':_0x4fcc50[_0xaac3('0x25')],'pTalking':_0x4fcc50[_0xaac3('0x26')],'sumBillable':_0x4fcc50[_0xaac3('0x27')],'sumDuration':_0x4fcc50['sumDuration'],'sumHoldTime':_0x4fcc50[_0xaac3('0x28')]||0x0,'talking':_0x4fcc50[_0xaac3('0x29')],'total':_0x4fcc50[_0xaac3('0x2a')],'type':_0x4fcc50['type'],'unmanaged':_0x4fcc50['unmanaged'],'abandoned':_0x4fcc50[_0xaac3('0x2b')],'waiting':_0x4fcc50[_0xaac3('0x2c')],'loggedInDb':_0x4fcc50['loggedInDb']};if(_0x4fcc50[_0xaac3('0x2d')]===_0xaac3('0x2e')){_0x14f261[_0xaac3('0x2f')]=_0x4fcc50['dialActive'];_0x14f261['dialMethod']=_0x4fcc50[_0xaac3('0x30')];_0x14f261[_0xaac3('0x31')]=_0x4fcc50[_0xaac3('0x31')];_0x14f261[_0xaac3('0x32')]=_0x4fcc50[_0xaac3('0x32')];_0x14f261[_0xaac3('0x33')]=_0x4fcc50[_0xaac3('0x33')];_0x14f261[_0xaac3('0x34')]=_0x4fcc50[_0xaac3('0x34')];_0x14f261[_0xaac3('0x35')]=_0x4fcc50[_0xaac3('0x35')];_0x14f261[_0xaac3('0x36')]=_0x4fcc50[_0xaac3('0x36')];_0x14f261[_0xaac3('0x37')]=_0x4fcc50['outboundBlacklistCallsDay'];_0x14f261['outboundBusyCallsDay']=_0x4fcc50['outboundBusyCallsDay'];_0x14f261['outboundCongestionCallsDay']=_0x4fcc50[_0xaac3('0x38')];_0x14f261[_0xaac3('0x39')]=_0x4fcc50[_0xaac3('0x39')];_0x14f261[_0xaac3('0x3a')]=_0x4fcc50[_0xaac3('0x3a')];_0x14f261[_0xaac3('0x3b')]=_0x4fcc50['outboundDropCallsDayTimeout'];_0x14f261[_0xaac3('0x3c')]=_0x4fcc50[_0xaac3('0x3c')];_0x14f261[_0xaac3('0x3d')]=_0x4fcc50[_0xaac3('0x3d')];_0x14f261['outboundOriginateFailureCallsDay']=_0x4fcc50[_0xaac3('0x3e')];_0x14f261[_0xaac3('0x3f')]=_0x4fcc50[_0xaac3('0x3f')];_0x14f261[_0xaac3('0x40')]=_0x4fcc50[_0xaac3('0x40')];_0x14f261[_0xaac3('0x41')]=_0x4fcc50[_0xaac3('0x41')];_0x14f261[_0xaac3('0x42')]=_0x4fcc50[_0xaac3('0x42')];_0x14f261[_0xaac3('0x43')]=_0x4fcc50[_0xaac3('0x43')];_0x14f261[_0xaac3('0x44')]=_0x4fcc50[_0xaac3('0x44')];_0x14f261[_0xaac3('0x45')]=_0x4fcc50[_0xaac3('0x45')];_0x14f261[_0xaac3('0x46')]=_0x4fcc50[_0xaac3('0x46')];_0x14f261[_0xaac3('0x47')]=_0x4fcc50['predictiveIntervalErlangCalls'];_0x14f261[_0xaac3('0x48')]=_0x4fcc50[_0xaac3('0x48')];_0x14f261[_0xaac3('0x49')]=_0x4fcc50[_0xaac3('0x49')];_0x14f261['predictiveIntervalMultiplicativeFactor']=_0x4fcc50[_0xaac3('0x4a')];_0x14f261['predictiveIntervalPauses']=_0x4fcc50[_0xaac3('0x4b')];_0x14f261[_0xaac3('0x4c')]=_0x4fcc50[_0xaac3('0x4c')];_0x14f261[_0xaac3('0x4d')]=_0x4fcc50[_0xaac3('0x4d')];_0x14f261[_0xaac3('0x19')]=_0x4fcc50['message'];_0x14f261[_0xaac3('0x4e')]=_0x4fcc50[_0xaac3('0x4e')];_0x14f261[_0xaac3('0x4f')]=_0x4fcc50[_0xaac3('0x4f')];_0x14f261[_0xaac3('0x50')]=_0x4fcc50[_0xaac3('0x50')];_0x14f261[_0xaac3('0x51')]=_0x4fcc50[_0xaac3('0x51')];_0x14f261[_0xaac3('0x52')]=_0x4fcc50['erlangBusyFactor'];_0x14f261[_0xaac3('0x53')]=_0x4fcc50['startPredictive'];_0x14f261[_0xaac3('0x54')]=_0x4fcc50[_0xaac3('0x54')];}if(_0x4fcc50[_0xaac3('0x55')]){_0x14f261['Trunk']={'id':_0x4fcc50[_0xaac3('0x55')]['id'],'name':_0x4fcc50[_0xaac3('0x55')][_0xaac3('0x9')],'active':_0x4fcc50[_0xaac3('0x55')]['active'],'callerid':_0x4fcc50[_0xaac3('0x55')][_0xaac3('0x56')]};}if(_0x4fcc50['Interval']){_0x14f261['Interval']={'id':_0x4fcc50[_0xaac3('0x57')]['id'],'name':_0x4fcc50[_0xaac3('0x57')][_0xaac3('0x9')]};}_0xea4c24[_0xaac3('0x58')](_0x14f261);}}_0x19db68({'count':_0xea4c24['length'],'rows':_0xea4c24});});},'VoiceChannels':function(_0x516734){return new Promise(function(_0x45975b,_0x4cf6b9){var _0x8ca1c5=_[_0xaac3('0x59')](_0x394302[_0xaac3('0x5a')]);_0x45975b({'count':_0x8ca1c5[_0xaac3('0x5b')],'rows':_0x8ca1c5});});},'VoiceChannelMixMonitor':function(_0x5d8f78){var _0x42f651=this;return new Promise(function(_0x124a51,_0x3ce349){if(ami[_0xaac3('0x10')]()==![]){return _0x3ce349(_0x42f651[_0xaac3('0x11')](0x1f4,[config[_0xaac3('0x12')]['ip'],config[_0xaac3('0x12')][_0xaac3('0x13')],_0xaac3('0x14')][_0xaac3('0x15')]('\x20')));}var _0xd0f314=schema(properties[_0xaac3('0x5c')])['validate'](_0x5d8f78);if(_0xd0f314[_0xaac3('0x5b')]>0x0){return _0x3ce349(_0x42f651[_0xaac3('0x11')](0x1f4,_[_0xaac3('0x5d')](_0xd0f314,_0xaac3('0x19'))[_0xaac3('0x15')](',\x20')));}var _0x428bc3=_[_0xaac3('0x5e')](_0x394302[_0xaac3('0x5a')],{'uniqueid':_0x5d8f78[_0xaac3('0x5f')]});if(_0x428bc3&&_0x428bc3[_0xaac3('0x60')]){var _0x1db68d=util['format'](_0xaac3('0x61'),_0x5d8f78['filename']||_0x5d8f78[_0xaac3('0x5f')],_0x5d8f78[_0xaac3('0x6')]||_0xaac3('0x62'));return ami[_0xaac3('0x18')]({'action':_0xaac3('0x63'),'channel':_0x428bc3[_0xaac3('0x60')],'file':_0x1db68d,'options':_0xaac3('0x64')})[_0xaac3('0x1f')](function(_0x41289){var _0x1f1a1a=_['find'](_0x428bc3['monitors'],{'filename':_0xaac3('0x65')+_0x1db68d[_0xaac3('0x66')]()});if(_[_0xaac3('0x67')](_0x1f1a1a)){_0x428bc3[_0xaac3('0x68')][_0xaac3('0x58')]({'filename':'/var/spool/asterisk/monitor/'+_0x1db68d[_0xaac3('0x66')](),'createdAt':moment()[_0xaac3('0x6')](_0xaac3('0x69')),'mixmonitorid':_0x41289[_0xaac3('0x6a')],'status':_0xaac3('0x6b')});}else{_0x1f1a1a[_0xaac3('0x6a')]=_0x41289[_0xaac3('0x6a')];_0x1f1a1a[_0xaac3('0x6c')]=_0xaac3('0x6b');}_0x124a51({'code':0xc8,'message':[_0x5d8f78['uniqueid'],_0xaac3('0x6d'),_0x41289[_0xaac3('0x6a')]]['join']('\x20'),'mixmonitorid':_0x41289['mixmonitorid']});})[_0xaac3('0x1a')](function(_0x12301e){_0x3ce349(_0x42f651[_0xaac3('0x11')](0x1f5,[_0x5d8f78[_0xaac3('0x5f')],_0x12301e[_0xaac3('0x19')]['toLowerCase']()]['join']('\x20')));});}else{return _0x3ce349(_0x42f651['error'](0x1f5,_0xaac3('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x16fa66){var _0x1c28b9=this;return new Promise(function(_0x17a3da,_0x1ace0e){if(ami[_0xaac3('0x10')]()==![]){return _0x1ace0e(_0x1c28b9[_0xaac3('0x11')](0x1f4,[config[_0xaac3('0x12')]['ip'],config['asterisk'][_0xaac3('0x13')],_0xaac3('0x14')][_0xaac3('0x15')]('\x20')));}var _0x4401dc=schema(properties[_0xaac3('0x5c')])[_0xaac3('0x3')](_0x16fa66);if(_0x4401dc['length']>0x0){return _0x1ace0e(_0x1c28b9['error'](0x1f4,_[_0xaac3('0x5d')](_0x4401dc,'message')[_0xaac3('0x15')](',\x20')));}var _0x3a7b37=_[_0xaac3('0x5e')](_0x394302[_0xaac3('0x5a')],{'uniqueid':_0x16fa66[_0xaac3('0x5f')]});if(_0x3a7b37){return BPromise['resolve']()[_0xaac3('0x1f')](function(){if(_0x3a7b37[_0xaac3('0x60')]){return ami[_0xaac3('0x18')]({'action':_0xaac3('0x6f'),'channel':_0x3a7b37[_0xaac3('0x60')],'mixmonitorid':_0x16fa66[_0xaac3('0x6a')]})[_0xaac3('0x1a')](function(_0x519c9a){});}})[_0xaac3('0x1f')](function(){if(_0x3a7b37[_0xaac3('0x70')]){return ami[_0xaac3('0x18')]({'action':_0xaac3('0x6f'),'channel':_0x3a7b37[_0xaac3('0x70')],'mixmonitorid':_0x16fa66[_0xaac3('0x6a')]})[_0xaac3('0x1a')](function(_0x7cec07){});}})['then'](function(_0x3c4493){var _0x29e09f=_[_0xaac3('0x5e')](_0x3a7b37['monitors'],{'mixmonitorid':_0x16fa66['mixmonitorid']});if(_0x29e09f){_0x29e09f[_0xaac3('0x6c')]=_0xaac3('0x71');}})[_0xaac3('0x1f')](function(){var _0x48f051=util[_0xaac3('0x6')](_0xaac3('0x61'),_0x16fa66[_0xaac3('0x72')]||_0x16fa66[_0xaac3('0x5f')],_0x16fa66[_0xaac3('0x6')]||'wav');var _0x22af15=_['find'](_0x3a7b37[_0xaac3('0x68')],{'filename':_0xaac3('0x65')+_0x48f051[_0xaac3('0x66')]()});if(_0x22af15){_0x22af15[_0xaac3('0x6c')]=_0xaac3('0x71');}})[_0xaac3('0x1f')](function(){_0x17a3da({'code':0xc8,'message':[_0x16fa66[_0xaac3('0x5f')],'StopMixMonitor\x20Success'][_0xaac3('0x15')]('\x20')});})['catch'](function(_0x2592bf){_0x1ace0e(_0x1c28b9[_0xaac3('0x11')](0x1f5,[_0x16fa66['uniqueid'],_0x2592bf['message']['toLowerCase']()][_0xaac3('0x15')]('\x20')));});}else{return _0x1ace0e(_0x1c28b9[_0xaac3('0x11')](0x1f5,_0xaac3('0x6e')));}});},'VoiceQueuesChannels':function(_0x199fdd){return new Promise(function(_0x34367a,_0x368ec8){var _0xa1b31d=_[_0xaac3('0x59')](_0x394302[_0xaac3('0x73')]);_0x34367a({'count':_0xa1b31d['length'],'rows':_0xa1b31d});});},'VoiceQueuesChannel':function(_0x2dfbe4){var _0x5db9e5=this;return new Promise(function(_0x3d7262,_0x4d3e08){var _0x5c9323=schema(properties[_0xaac3('0x74')])[_0xaac3('0x3')](_0x2dfbe4);if(_0x5c9323[_0xaac3('0x5b')]>0x0){return _0x4d3e08(_0x5db9e5[_0xaac3('0x11')](0x1f4,_[_0xaac3('0x5d')](_0x5c9323,_0xaac3('0x19'))['join'](',\x20')));}var _0x26652d=_[_0xaac3('0x5e')](_0x394302[_0xaac3('0x73')],{'uniqueid':_0x2dfbe4[_0xaac3('0x5f')]});if(_0x26652d){_0x3d7262(_0x26652d);}else{return _0x4d3e08(_0x5db9e5['error'](0x1f5,_0xaac3('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x65c21d){var _0x4fcdfc=this;return new Promise(function(_0x3d00ea,_0x43442e){if(ami['isConnected']()==![]){return _0x43442e(_0x4fcdfc[_0xaac3('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xaac3('0x12')][_0xaac3('0x13')],_0xaac3('0x14')][_0xaac3('0x15')]('\x20')));}var _0x3ef03e=schema(properties[_0xaac3('0x75')])['validate'](_0x65c21d);if(_0x3ef03e[_0xaac3('0x5b')]>0x0){return _0x43442e(_0x4fcdfc['error'](0x1f4,_[_0xaac3('0x5d')](_0x3ef03e,_0xaac3('0x19'))['join'](',\x20')));}var _0x48880f=_[_0xaac3('0x5e')](_0x394302['queueChannels'],{'uniqueid':_0x65c21d[_0xaac3('0x5f')]});if(_0x48880f&&_0x48880f[_0xaac3('0x60')]){return ami[_0xaac3('0x18')]({'action':_0xaac3('0x76'),'channel':_0x48880f[_0xaac3('0x60')]})['then'](function(_0x27a71b){_0x3d00ea({'code':0xc8,'message':[_0x65c21d[_0xaac3('0x5f')],_0x27a71b[_0xaac3('0x19')]['toLowerCase']()][_0xaac3('0x15')]('\x20')});})[_0xaac3('0x1a')](function(_0x5b861a){_0x43442e(_0x4fcdfc[_0xaac3('0x11')](0x1f5,[_0x65c21d[_0xaac3('0x5f')],_0x5b861a[_0xaac3('0x19')][_0xaac3('0x66')]()][_0xaac3('0x15')]('\x20')));});}else{return _0x43442e(_0x4fcdfc[_0xaac3('0x11')](0x1f5,_0xaac3('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x53c7f9){var _0x4ec063=this;return new Promise(function(_0x37c44a,_0xcad256){if(ami['isConnected']()==![]){return _0xcad256(_0x4ec063['error'](0x1f4,[config[_0xaac3('0x12')]['ip'],config[_0xaac3('0x12')][_0xaac3('0x13')],_0xaac3('0x14')][_0xaac3('0x15')]('\x20')));}var _0x571ced=schema(properties[_0xaac3('0x77')])[_0xaac3('0x3')](_0x53c7f9);if(_0x571ced[_0xaac3('0x5b')]>0x0){return _0xcad256(_0x4ec063[_0xaac3('0x11')](0x1f4,_[_0xaac3('0x5d')](_0x571ced,'message')[_0xaac3('0x15')](',\x20')));}var _0x370170=_[_0xaac3('0x5e')](_0x394302[_0xaac3('0x73')],{'uniqueid':_0x53c7f9[_0xaac3('0x5f')]});if(_0x370170&&_0x370170[_0xaac3('0x60')]){return ami['Action']({'action':_0xaac3('0x78'),'channel':_0x370170[_0xaac3('0x60')],'exten':_0x53c7f9[_0xaac3('0x79')],'context':_0x53c7f9['context']||_0x370170['context'],'priority':0x1})['then'](function(_0x107b1e){_0x37c44a({'code':0xc8,'message':[_0x53c7f9[_0xaac3('0x5f')],_0x107b1e[_0xaac3('0x19')][_0xaac3('0x66')]()]['join']('\x20')});})[_0xaac3('0x1a')](function(_0x548cb6){_0xcad256(_0x4ec063[_0xaac3('0x11')](0x1f5,[_0x53c7f9[_0xaac3('0x5f')],_0x548cb6[_0xaac3('0x19')][_0xaac3('0x66')]()][_0xaac3('0x15')]('\x20')));});}else{return _0xcad256(_0x4ec063[_0xaac3('0x11')](0x1f5,_0xaac3('0x6e')));}});},'Agents':function(_0x277141){return new Promise(function(_0xf4be9f,_0x38ab47){var _0x1ba1cf=_['values'](_0x394302[_0xaac3('0xc')]);_0xf4be9f({'count':_0x1ba1cf[_0xaac3('0x5b')],'rows':_0x1ba1cf});});},'Telephones':function(_0x475b8d){return new Promise(function(_0x35d948,_0x2c9cf3){var _0x4c25d6=_[_0xaac3('0x59')](_0x394302[_0xaac3('0x7a')]);_0x35d948({'count':_0x4c25d6[_0xaac3('0x5b')],'rows':_0x4c25d6});});},'Trunks':function(_0x8ac4eb){return new Promise(function(_0xe6f5c8,_0xd4230c){var _0x465d84=_[_0xaac3('0x59')](_0x394302[_0xaac3('0x7b')]);_0xe6f5c8({'count':_0x465d84[_0xaac3('0x5b')],'rows':_0x465d84});});},'OutboundChannels':function(_0x3cb136){return new Promise(function(_0x560f93,_0x2eecae){var _0x20c748=_['values'](_0x394302[_0xaac3('0x7c')]);_0x560f93({'count':_0x20c748[_0xaac3('0x5b')],'rows':_0x20c748});});},'Outbound':function(_0x4e9601){return new Promise(function(_0x573b6d,_0x401ab7){_0x573b6d(_0x394302[_0xaac3('0x2e')]);});},'Campaigns':function(_0x2925ce){return new Promise(function(_0x431011,_0x493586){var _0x568ec1=_[_0xaac3('0x59')](_0x394302[_0xaac3('0x7d')]);_0x431011({'count':_0x568ec1[_0xaac3('0x5b')],'rows':_0x568ec1});});},'VoiceQueuesPreview':function(_0x487098){var _0x6c0204=this;return new Promise(function(_0x4939ba,_0x43c288){_0x4dc4fb[_0xaac3('0x7e')](_0x487098['id'])[_0xaac3('0x1f')](function(_0x192059){_0x4939ba({'code':0xc8,'message':_0x192059[_0xaac3('0x19')]});})[_0xaac3('0x1a')](function(_0x5365d5){_0x43c288(_0x6c0204['error'](0x1f4,_0x5365d5['message']));});});},'EventManager':function(_0x237ad3){var _0x5b4fc4=this;return new Promise(function(_0x3b3128,_0x244a93){if(!_0x237ad3[_0xaac3('0x7f')]){return _0x244a93(_0x5b4fc4[_0xaac3('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0xaac3('0x80')+_0x237ad3['event'],_0x237ad3[_0xaac3('0x19')]);_0x3b3128({'code':0xc8,'message':_0x237ad3});});},'FaxAccounts':function(_0x2a3a7b){return new Promise(function(_0x4f94f3,_0x12f789){var _0x12c58a=_[_0xaac3('0x59')](_0x394302[_0xaac3('0x81')]);_0x4f94f3({'count':_0x12c58a[_0xaac3('0x5b')],'rows':_0x12c58a});});},'SendFax':function(_0x3a0253){var _0x225f99=this;return new Promise(function(_0x260ff5,_0x3d7a93){_0x4dd0a2[_0xaac3('0x82')](_0x3a0253)[_0xaac3('0x1f')](function(_0x1d7a23){_0x260ff5({'code':0xc8,'message':_0x1d7a23[_0xaac3('0x19')]});})[_0xaac3('0x1a')](function(_0x3e65e5){_0x3d7a93(_0x225f99[_0xaac3('0x11')](0x1f4,_0x3e65e5['message']));});});},'CheckAfterSend':function(_0x60ed11){var _0x465944=this;return new Promise(function(_0x46c1a6,_0x52832c){_0x4dd0a2[_0xaac3('0x83')](_0x60ed11)[_0xaac3('0x1f')](function(_0x224f70){_0x46c1a6({'code':0xc8,'message':_0x224f70[_0xaac3('0x19')]});})['catch'](function(_0x29655f){_0x52832c(_0x465944[_0xaac3('0x11')](0x1f4,_0x29655f[_0xaac3('0x19')]));});});}};var _0x29a8f6=jayson[_0xaac3('0x84')](_0x3691d1)['http']();_0x29a8f6['on'](_0xaac3('0x11'),function(_0x512e04){return _0x594303(_0x512e04);});_0x29a8f6[_0xaac3('0x85')](0x232a,_0xaac3('0x86'),function(){console['log'](_0xaac3('0x87'),0x232a);return _0x184ef7('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x8a38=['then','message','catch','ami\x20disconnected','join','action','Command','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','values','voicechannel','find','channels','uniqueid','channel','%s.%s','filename','wav','monitors','toLowerCase','isNil','push','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelredirect','exten','context','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','pick','keys','module','Reload','Action'];(function(_0x541e7c,_0x3683b8){var _0xa22516=function(_0xf63d6a){while(--_0xf63d6a){_0x541e7c['push'](_0x541e7c['shift']());}};_0xa22516(++_0x3683b8);}(_0x8a38,0x171));var _0x88a3=function(_0x57c029,_0x302ebd){_0x57c029=_0x57c029-0x0;var _0x6b7d44=_0x8a38[_0x57c029];return _0x6b7d44;};'use strict';var _=require(_0x88a3('0x0'));var util=require(_0x88a3('0x1'));var jayson=require(_0x88a3('0x2'));var schema=require(_0x88a3('0x3'));var BPromise=require('bluebird');var moment=require(_0x88a3('0x4'));var config=require(_0x88a3('0x5'));var properties=require(_0x88a3('0x6'));var ami=require(_0x88a3('0x7'));exports[_0x88a3('0x8')]=function(_0x736bc0,_0x4fb92a,_0x189268){return new BPromise(function(_0x3746b3,_0x58542b){var _0x280f8c={'QueuePause':function(_0x4a6b41){return new Promise(function(_0x332f48,_0x421cb0){var _0x3605f1=util[_0x88a3('0x9')](_0x88a3('0xa'),'SIP',_0x4a6b41[_0x88a3('0xb')]);if(_0x736bc0[_0x88a3('0xc')]&&_0x736bc0[_0x88a3('0xc')][_0x3605f1]&&_0x736bc0[_0x88a3('0xc')][_0x3605f1]['timer']){_0x736bc0[_0x88a3('0xc')][_0x3605f1][_0x88a3('0xd')]();}if(_0x736bc0[_0x88a3('0xe')][_0x3605f1]){_0x736bc0[_0x88a3('0xe')][_0x3605f1][_0x88a3('0xf')]({'statePause':_0x4a6b41[_0x88a3('0x10')]?!![]:![]});}_0x332f48({'code':0xc8,'message':_0x88a3('0x11')});});},'Reload':function(_0x24ba33){var _0x533045=this;return new Promise(function(_0x4eb69b,_0x270bc4){if(ami[_0x88a3('0x12')]()==![]){return _0x270bc4(_0x533045[_0x88a3('0x13')](0x1f4,[config[_0x88a3('0x14')]['ip'],config[_0x88a3('0x14')][_0x88a3('0x15')],'ami\x20disconnected']['join']('\x20')));}_0x24ba33=_[_0x88a3('0x16')](_0x24ba33,_[_0x88a3('0x17')](properties[_0x88a3('0x18')]));_0x24ba33['action']=_0x88a3('0x19');return ami[_0x88a3('0x1a')](_0x24ba33)[_0x88a3('0x1b')](function(_0x4ce980){_0x4eb69b({'code':0xc8,'message':_0x4ce980[_0x88a3('0x1c')]});})[_0x88a3('0x1d')](function(_0xa0ae84){_0x270bc4(_0x533045[_0x88a3('0x13')](0x1f5,_0xa0ae84['message']));});});},'Command':function(_0x5ca419){var _0xdf39d5=this;return new Promise(function(_0x49473e,_0x4324b2){if(ami[_0x88a3('0x12')]()==![]){return _0x4324b2(_0xdf39d5[_0x88a3('0x13')](0x1f4,[config[_0x88a3('0x14')]['ip'],config[_0x88a3('0x14')][_0x88a3('0x15')],_0x88a3('0x1e')][_0x88a3('0x1f')]('\x20')));}_0x5ca419=_[_0x88a3('0x16')](_0x5ca419,'command');_0x5ca419[_0x88a3('0x20')]=_0x88a3('0x21');return ami['Action'](_0x5ca419)[_0x88a3('0x1b')](function(_0x512226){_0x49473e({'code':0xc8,'message':_0x512226['content']});})[_0x88a3('0x1d')](function(_0x2afe1e){_0x4324b2(_0xdf39d5['error'](0x1f5,_0x2afe1e[_0x88a3('0x1c')]));});});},'VoiceQueues':function(_0x503f1a){return new Promise(function(_0xbb2426,_0x5afa43){var _0x23bc9e=[];for(var _0x121ee0 in _0x736bc0[_0x88a3('0x22')]){if(_0x736bc0['voiceQueues']['hasOwnProperty'](_0x121ee0)){var _0x18492f=_0x736bc0['voiceQueues'][_0x121ee0];var _0x19b3af={'id':_0x18492f['id'],'name':_0x18492f['name'],'strategy':_0x18492f[_0x88a3('0x23')],'answered':_0x18492f[_0x88a3('0x24')],'available':_0x18492f[_0x88a3('0x25')],'loggedIn':_0x18492f[_0x88a3('0x26')],'pTalking':_0x18492f[_0x88a3('0x27')],'sumBillable':_0x18492f['sumBillable'],'sumDuration':_0x18492f[_0x88a3('0x28')],'sumHoldTime':_0x18492f[_0x88a3('0x29')]||0x0,'talking':_0x18492f[_0x88a3('0x2a')],'total':_0x18492f[_0x88a3('0x2b')],'type':_0x18492f[_0x88a3('0x2c')],'unmanaged':_0x18492f['unmanaged'],'abandoned':_0x18492f[_0x88a3('0x2d')],'waiting':_0x18492f[_0x88a3('0x2e')],'loggedInDb':_0x18492f[_0x88a3('0x2f')]};if(_0x18492f[_0x88a3('0x2c')]===_0x88a3('0x30')){_0x19b3af[_0x88a3('0x31')]=_0x18492f['dialActive'];_0x19b3af[_0x88a3('0x32')]=_0x18492f['dialMethod'];_0x19b3af[_0x88a3('0x33')]=_0x18492f[_0x88a3('0x33')];_0x19b3af[_0x88a3('0x34')]=_0x18492f['dialOriginateCallerIdNumber'];_0x19b3af['dialOriginateTimeout']=_0x18492f[_0x88a3('0x35')];_0x19b3af[_0x88a3('0x36')]=_0x18492f[_0x88a3('0x36')];_0x19b3af[_0x88a3('0x37')]=_0x18492f[_0x88a3('0x37')];_0x19b3af[_0x88a3('0x38')]=_0x18492f[_0x88a3('0x38')];_0x19b3af[_0x88a3('0x39')]=_0x18492f[_0x88a3('0x39')];_0x19b3af['outboundBusyCallsDay']=_0x18492f[_0x88a3('0x3a')];_0x19b3af[_0x88a3('0x3b')]=_0x18492f['outboundCongestionCallsDay'];_0x19b3af['outboundDropCallsDayACS']=_0x18492f['outboundDropCallsDayACS'];_0x19b3af['outboundDropCallsDayCallersExit']=_0x18492f[_0x88a3('0x3c')];_0x19b3af[_0x88a3('0x3d')]=_0x18492f[_0x88a3('0x3d')];_0x19b3af[_0x88a3('0x3e')]=_0x18492f['outboundNoAnswerCallsDay'];_0x19b3af['outboundNoSuchCallsDay']=_0x18492f[_0x88a3('0x3f')];_0x19b3af[_0x88a3('0x40')]=_0x18492f['outboundOriginateFailureCallsDay'];_0x19b3af[_0x88a3('0x41')]=_0x18492f[_0x88a3('0x41')];_0x19b3af['outboundRejectCallsDay']=_0x18492f[_0x88a3('0x42')];_0x19b3af['outboundUnknownCallsDay']=_0x18492f['outboundUnknownCallsDay'];_0x19b3af['predictiveIntervalAnsweredCalls']=_0x18492f[_0x88a3('0x43')];_0x19b3af[_0x88a3('0x44')]=_0x18492f[_0x88a3('0x44')];_0x19b3af['predictiveIntervalAvgTalktime']=_0x18492f['predictiveIntervalAvgTalktime'];_0x19b3af[_0x88a3('0x45')]=_0x18492f[_0x88a3('0x45')];_0x19b3af[_0x88a3('0x46')]=_0x18492f[_0x88a3('0x46')];_0x19b3af[_0x88a3('0x47')]=_0x18492f[_0x88a3('0x47')];_0x19b3af[_0x88a3('0x48')]=_0x18492f[_0x88a3('0x48')];_0x19b3af['predictiveIntervalHitRate']=_0x18492f['predictiveIntervalHitRate'];_0x19b3af[_0x88a3('0x49')]=_0x18492f[_0x88a3('0x49')];_0x19b3af[_0x88a3('0x4a')]=_0x18492f[_0x88a3('0x4a')];_0x19b3af[_0x88a3('0x4b')]=_0x18492f[_0x88a3('0x4b')];_0x19b3af[_0x88a3('0x4c')]=_0x18492f[_0x88a3('0x4c')];_0x19b3af[_0x88a3('0x1c')]=_0x18492f[_0x88a3('0x1c')];_0x19b3af[_0x88a3('0x4d')]=_0x18492f[_0x88a3('0x4d')];_0x19b3af[_0x88a3('0x4e')]=_0x18492f[_0x88a3('0x4e')];_0x19b3af[_0x88a3('0x4f')]=_0x18492f[_0x88a3('0x4f')];_0x19b3af[_0x88a3('0x50')]=_0x18492f[_0x88a3('0x50')];_0x19b3af['erlangBusyFactor']=_0x18492f['erlangBusyFactor'];_0x19b3af[_0x88a3('0x51')]=_0x18492f[_0x88a3('0x51')];_0x19b3af[_0x88a3('0x52')]=_0x18492f[_0x88a3('0x52')];}if(_0x18492f['Trunk']){_0x19b3af[_0x88a3('0x53')]={'id':_0x18492f[_0x88a3('0x53')]['id'],'name':_0x18492f['Trunk']['name'],'active':_0x18492f[_0x88a3('0x53')][_0x88a3('0x54')],'callerid':_0x18492f[_0x88a3('0x53')][_0x88a3('0x55')]};}if(_0x18492f[_0x88a3('0x56')]){_0x19b3af['Interval']={'id':_0x18492f[_0x88a3('0x56')]['id'],'name':_0x18492f[_0x88a3('0x56')]['name']};}_0x23bc9e['push'](_0x19b3af);}}_0xbb2426({'count':_0x23bc9e[_0x88a3('0x57')],'rows':_0x23bc9e});});},'VoiceChannels':function(_0x390e2f){return new Promise(function(_0x30edcc,_0xe4c351){var _0x33fef9=_[_0x88a3('0x58')](_0x736bc0['channels']);_0x30edcc({'count':_0x33fef9['length'],'rows':_0x33fef9});});},'VoiceChannelMixMonitor':function(_0x2dea08){var _0x4270ee=this;return new Promise(function(_0x2a3b18,_0x1dde05){if(ami[_0x88a3('0x12')]()==![]){return _0x1dde05(_0x4270ee[_0x88a3('0x13')](0x1f4,[config[_0x88a3('0x14')]['ip'],config[_0x88a3('0x14')][_0x88a3('0x15')],_0x88a3('0x1e')]['join']('\x20')));}var _0x47c98f=schema(properties[_0x88a3('0x59')])[_0x88a3('0x3')](_0x2dea08);if(_0x47c98f['length']>0x0){return _0x1dde05(_0x4270ee[_0x88a3('0x13')](0x1f4,_['map'](_0x47c98f,_0x88a3('0x1c'))[_0x88a3('0x1f')](',\x20')));}var _0x571cf4=_[_0x88a3('0x5a')](_0x736bc0[_0x88a3('0x5b')],{'uniqueid':_0x2dea08[_0x88a3('0x5c')]});if(_0x571cf4&&_0x571cf4[_0x88a3('0x5d')]){var _0x16b807=util[_0x88a3('0x9')](_0x88a3('0x5e'),_0x2dea08[_0x88a3('0x5f')]||_0x2dea08['uniqueid'],_0x2dea08[_0x88a3('0x9')]||_0x88a3('0x60'));return ami['Action']({'action':'MixMonitor','channel':_0x571cf4['channel'],'file':_0x16b807,'options':'ai(mixmonitorid)'})[_0x88a3('0x1b')](function(_0x3f2bc1){var _0x5151dd=_['find'](_0x571cf4[_0x88a3('0x61')],{'filename':'/var/spool/asterisk/monitor/'+_0x16b807[_0x88a3('0x62')]()});if(_[_0x88a3('0x63')](_0x5151dd)){_0x571cf4['monitors'][_0x88a3('0x64')]({'filename':_0x88a3('0x65')+_0x16b807['toLowerCase'](),'createdAt':moment()['format'](_0x88a3('0x66')),'mixmonitorid':_0x3f2bc1[_0x88a3('0x67')],'status':_0x88a3('0x68')});}else{_0x5151dd['mixmonitorid']=_0x3f2bc1[_0x88a3('0x67')];_0x5151dd[_0x88a3('0x69')]=_0x88a3('0x68');}_0x2a3b18({'code':0xc8,'message':[_0x2dea08['uniqueid'],_0x88a3('0x6a'),_0x3f2bc1['mixmonitorid']][_0x88a3('0x1f')]('\x20'),'mixmonitorid':_0x3f2bc1[_0x88a3('0x67')]});})[_0x88a3('0x1d')](function(_0x2fa1b1){_0x1dde05(_0x4270ee[_0x88a3('0x13')](0x1f5,[_0x2dea08['uniqueid'],_0x2fa1b1[_0x88a3('0x1c')]['toLowerCase']()][_0x88a3('0x1f')]('\x20')));});}else{return _0x1dde05(_0x4270ee[_0x88a3('0x13')](0x1f5,_0x88a3('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x5e76cb){var _0xfe49be=this;return new Promise(function(_0x5df1e4,_0x55d02a){if(ami[_0x88a3('0x12')]()==![]){return _0x55d02a(_0xfe49be[_0x88a3('0x13')](0x1f4,[config[_0x88a3('0x14')]['ip'],config[_0x88a3('0x14')]['username'],_0x88a3('0x1e')][_0x88a3('0x1f')]('\x20')));}var _0x3b4b9f=schema(properties[_0x88a3('0x59')])[_0x88a3('0x3')](_0x5e76cb);if(_0x3b4b9f['length']>0x0){return _0x55d02a(_0xfe49be[_0x88a3('0x13')](0x1f4,_[_0x88a3('0x6c')](_0x3b4b9f,'message')[_0x88a3('0x1f')](',\x20')));}var _0x1c1467=_[_0x88a3('0x5a')](_0x736bc0['channels'],{'uniqueid':_0x5e76cb[_0x88a3('0x5c')]});if(_0x1c1467){return BPromise['resolve']()['then'](function(){if(_0x1c1467['channel']){return ami[_0x88a3('0x1a')]({'action':_0x88a3('0x6d'),'channel':_0x1c1467['channel'],'mixmonitorid':_0x5e76cb[_0x88a3('0x67')]})['catch'](function(_0x4da87f){});}})[_0x88a3('0x1b')](function(){if(_0x1c1467[_0x88a3('0x6e')]){return ami[_0x88a3('0x1a')]({'action':_0x88a3('0x6d'),'channel':_0x1c1467['destinationchannel'],'mixmonitorid':_0x5e76cb[_0x88a3('0x67')]})[_0x88a3('0x1d')](function(_0x1f7957){});}})[_0x88a3('0x1b')](function(_0x4b1ec5){var _0x38efc3=_[_0x88a3('0x5a')](_0x1c1467[_0x88a3('0x61')],{'mixmonitorid':_0x5e76cb['mixmonitorid']});if(_0x38efc3){_0x38efc3[_0x88a3('0x69')]=_0x88a3('0x6f');}})[_0x88a3('0x1b')](function(){var _0x304b68=util[_0x88a3('0x9')]('%s.%s',_0x5e76cb['filename']||_0x5e76cb[_0x88a3('0x5c')],_0x5e76cb[_0x88a3('0x9')]||'wav');var _0x4aee67=_['find'](_0x1c1467['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x304b68[_0x88a3('0x62')]()});if(_0x4aee67){_0x4aee67[_0x88a3('0x69')]=_0x88a3('0x6f');}})['then'](function(){_0x5df1e4({'code':0xc8,'message':[_0x5e76cb['uniqueid'],_0x88a3('0x70')][_0x88a3('0x1f')]('\x20')});})['catch'](function(_0x314160){_0x55d02a(_0xfe49be['error'](0x1f5,[_0x5e76cb[_0x88a3('0x5c')],_0x314160[_0x88a3('0x1c')][_0x88a3('0x62')]()]['join']('\x20')));});}else{return _0x55d02a(_0xfe49be[_0x88a3('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5ea1e9){return new Promise(function(_0x4b2179,_0x252317){var _0xc42605=_['values'](_0x736bc0[_0x88a3('0x71')]);_0x4b2179({'count':_0xc42605[_0x88a3('0x57')],'rows':_0xc42605});});},'VoiceQueuesChannel':function(_0x7892d3){var _0x21158e=this;return new Promise(function(_0x17d545,_0xe3e42e){var _0x4938da=schema(properties[_0x88a3('0x72')])['validate'](_0x7892d3);if(_0x4938da[_0x88a3('0x57')]>0x0){return _0xe3e42e(_0x21158e[_0x88a3('0x13')](0x1f4,_[_0x88a3('0x6c')](_0x4938da,_0x88a3('0x1c'))[_0x88a3('0x1f')](',\x20')));}var _0x34f81d=_[_0x88a3('0x5a')](_0x736bc0[_0x88a3('0x71')],{'uniqueid':_0x7892d3['uniqueid']});if(_0x34f81d){_0x17d545(_0x34f81d);}else{return _0xe3e42e(_0x21158e[_0x88a3('0x13')](0x1f5,_0x88a3('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0x4bf85c){var _0x40f651=this;return new Promise(function(_0x1b06c8,_0x5a05c4){if(ami[_0x88a3('0x12')]()==![]){return _0x5a05c4(_0x40f651[_0x88a3('0x13')](0x1f4,[config[_0x88a3('0x14')]['ip'],config[_0x88a3('0x14')][_0x88a3('0x15')],_0x88a3('0x1e')][_0x88a3('0x1f')]('\x20')));}var _0x2182b3=schema(properties['voicequeuechannelhangup'])[_0x88a3('0x3')](_0x4bf85c);if(_0x2182b3['length']>0x0){return _0x5a05c4(_0x40f651[_0x88a3('0x13')](0x1f4,_[_0x88a3('0x6c')](_0x2182b3,_0x88a3('0x1c'))[_0x88a3('0x1f')](',\x20')));}var _0x227cb6=_[_0x88a3('0x5a')](_0x736bc0['queueChannels'],{'uniqueid':_0x4bf85c[_0x88a3('0x5c')]});if(_0x227cb6&&_0x227cb6['channel']){return ami[_0x88a3('0x1a')]({'action':'Hangup','channel':_0x227cb6[_0x88a3('0x5d')]})['then'](function(_0x2e5824){_0x1b06c8({'code':0xc8,'message':[_0x4bf85c[_0x88a3('0x5c')],_0x2e5824[_0x88a3('0x1c')][_0x88a3('0x62')]()]['join']('\x20')});})[_0x88a3('0x1d')](function(_0x42c6ef){_0x5a05c4(_0x40f651['error'](0x1f5,[_0x4bf85c[_0x88a3('0x5c')],_0x42c6ef['message'][_0x88a3('0x62')]()][_0x88a3('0x1f')]('\x20')));});}else{return _0x5a05c4(_0x40f651[_0x88a3('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x268f08){var _0x5e175b=this;return new Promise(function(_0x31ba20,_0x410ced){if(ami[_0x88a3('0x12')]()==![]){return _0x410ced(_0x5e175b[_0x88a3('0x13')](0x1f4,[config[_0x88a3('0x14')]['ip'],config[_0x88a3('0x14')]['username'],'ami\x20disconnected'][_0x88a3('0x1f')]('\x20')));}var _0x36e857=schema(properties[_0x88a3('0x73')])[_0x88a3('0x3')](_0x268f08);if(_0x36e857['length']>0x0){return _0x410ced(_0x5e175b[_0x88a3('0x13')](0x1f4,_['map'](_0x36e857,_0x88a3('0x1c'))[_0x88a3('0x1f')](',\x20')));}var _0x35cf0d=_[_0x88a3('0x5a')](_0x736bc0[_0x88a3('0x71')],{'uniqueid':_0x268f08[_0x88a3('0x5c')]});if(_0x35cf0d&&_0x35cf0d['channel']){return ami[_0x88a3('0x1a')]({'action':'Redirect','channel':_0x35cf0d[_0x88a3('0x5d')],'exten':_0x268f08[_0x88a3('0x74')],'context':_0x268f08[_0x88a3('0x75')]||_0x35cf0d[_0x88a3('0x75')],'priority':0x1})[_0x88a3('0x1b')](function(_0x28a9fa){_0x31ba20({'code':0xc8,'message':[_0x268f08['uniqueid'],_0x28a9fa['message']['toLowerCase']()][_0x88a3('0x1f')]('\x20')});})['catch'](function(_0x2b3e38){_0x410ced(_0x5e175b['error'](0x1f5,[_0x268f08['uniqueid'],_0x2b3e38[_0x88a3('0x1c')]['toLowerCase']()][_0x88a3('0x1f')]('\x20')));});}else{return _0x410ced(_0x5e175b[_0x88a3('0x13')](0x1f5,_0x88a3('0x6b')));}});},'Agents':function(_0x4ed1f6){return new Promise(function(_0x2a9605,_0x548181){var _0x1087b3=_['values'](_0x736bc0[_0x88a3('0xe')]);_0x2a9605({'count':_0x1087b3[_0x88a3('0x57')],'rows':_0x1087b3});});},'Telephones':function(_0x41f22f){return new Promise(function(_0x457f74,_0x4ee75a){var _0xfe399d=_[_0x88a3('0x58')](_0x736bc0[_0x88a3('0x76')]);_0x457f74({'count':_0xfe399d[_0x88a3('0x57')],'rows':_0xfe399d});});},'Trunks':function(_0x914a92){return new Promise(function(_0x6418e1,_0x6531d9){var _0x580a16=_['values'](_0x736bc0[_0x88a3('0x77')]);_0x6418e1({'count':_0x580a16[_0x88a3('0x57')],'rows':_0x580a16});});},'OutboundChannels':function(_0x376cdf){return new Promise(function(_0x203a5a,_0x59731d){var _0x5de6a8=_[_0x88a3('0x58')](_0x736bc0['outboundChannels']);_0x203a5a({'count':_0x5de6a8[_0x88a3('0x57')],'rows':_0x5de6a8});});},'Outbound':function(_0xec65e7){return new Promise(function(_0x538abd,_0x31e0ad){_0x538abd(_0x736bc0[_0x88a3('0x30')]);});},'Campaigns':function(_0x5225ac){return new Promise(function(_0x3fac6c,_0x499128){var _0x204b96=_[_0x88a3('0x58')](_0x736bc0[_0x88a3('0x78')]);_0x3fac6c({'count':_0x204b96[_0x88a3('0x57')],'rows':_0x204b96});});},'VoiceQueuesPreview':function(_0x3af083){var _0x10c269=this;return new Promise(function(_0x1ec0e4,_0x5f4cbf){_0x4fb92a[_0x88a3('0x79')](_0x3af083['id'])['then'](function(_0x3b6382){_0x1ec0e4({'code':0xc8,'message':_0x3b6382['message']});})[_0x88a3('0x1d')](function(_0x39ae97){_0x5f4cbf(_0x10c269['error'](0x1f4,_0x39ae97[_0x88a3('0x1c')]));});});},'EventManager':function(_0xedf751){var _0x3ac587=this;return new Promise(function(_0x1b74b1,_0x1f096e){if(!_0xedf751[_0x88a3('0x7a')]){return _0x1f096e(_0x3ac587[_0x88a3('0x13')](0x1f4,_0x88a3('0x7b')));}ami['emit'](_0x88a3('0x7c')+_0xedf751[_0x88a3('0x7a')],_0xedf751[_0x88a3('0x1c')]);_0x1b74b1({'code':0xc8,'message':_0xedf751});});},'FaxAccounts':function(_0x10c491){return new Promise(function(_0x3b4ee5,_0x563320){var _0x10ccd3=_['values'](_0x736bc0[_0x88a3('0x7d')]);_0x3b4ee5({'count':_0x10ccd3[_0x88a3('0x57')],'rows':_0x10ccd3});});},'SendFax':function(_0x4559da){var _0x547758=this;return new Promise(function(_0x476cd7,_0x15e323){_0x189268['send'](_0x4559da)['then'](function(_0x292b87){_0x476cd7({'code':0xc8,'message':_0x292b87[_0x88a3('0x1c')]});})[_0x88a3('0x1d')](function(_0x33de2e){_0x15e323(_0x547758[_0x88a3('0x13')](0x1f4,_0x33de2e[_0x88a3('0x1c')]));});});},'CheckAfterSend':function(_0x12b523){var _0x3c3f72=this;return new Promise(function(_0x23e2f0,_0x48a0ed){_0x189268[_0x88a3('0x7e')](_0x12b523)[_0x88a3('0x1b')](function(_0x1e5824){_0x23e2f0({'code':0xc8,'message':_0x1e5824[_0x88a3('0x1c')]});})[_0x88a3('0x1d')](function(_0x476d37){_0x48a0ed(_0x3c3f72[_0x88a3('0x13')](0x1f4,_0x476d37['message']));});});}};var _0x1d2307=jayson[_0x88a3('0x7f')](_0x280f8c)[_0x88a3('0x80')]();_0x1d2307['on'](_0x88a3('0x13'),function(_0x2e42aa){return _0x58542b(_0x2e42aa);});_0x1d2307['listen'](0x232a,_0x88a3('0x81'),function(){console[_0x88a3('0x82')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3746b3(_0x88a3('0x83')+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 18a154b..6b80ec8 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 _0x917a=['error','[%s][%s]\x20Error\x20creating\x20contact','lodash','ioredis','../../../../config/environment','trigger','redis','defaults','[%s][%s]','stringify','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','calleridname','','uniqueid','destcalleridname','phone','destcalleridnum','resolve','showContact','omit','then','info','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','format','user:%s','name','trigger:%s','action','merge','[%s][%s]\x20Contact\x20not\x20found','[%s][%s]\x20Contact\x20created:%s','toLowerCase','catch'];(function(_0x15ece6,_0x51a965){var _0x3dc05c=function(_0x43e0c1){while(--_0x43e0c1){_0x15ece6['push'](_0x15ece6['shift']());}};_0x3dc05c(++_0x51a965);}(_0x917a,0x173));var _0xa917=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x917a[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xa917('0x0'));var Redis=require(_0xa917('0x1'));var config=require(_0xa917('0x2'));var logger=require('../../../../config/logger')(_0xa917('0x3'));var cmContactRpc=require('../../rpc/cmContact');config[_0xa917('0x4')]=_[_0xa917('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa917('0x4')]));function emit(_0x3be995,_0x1fe3a0,_0x24ab73,_0x4d3b0d){logger['info'](_0xa917('0x6'),_0x3be995,'',_0x1fe3a0,_0x24ab73,JSON[_0xa917('0x7')](_0x4d3b0d));io['to'](_0x1fe3a0)['emit'](_0x24ab73,_0x4d3b0d);}exports[_0xa917('0x8')]=function(_0x2ec5f1,_0x2e8ab7,_0x1f7939){_0x1f7939[_0xa917('0x9')]=0x0;if(_0x2e8ab7[_0xa917('0xa')]&&parseInt(_0x2e8ab7[_0xa917('0xa')],0xa)){var _0x39760b={'ListId':parseInt(_0x2e8ab7[_0xa917('0xb')],0xa),'phone':_0x1f7939[_0xa917('0xc')]};if(_[_0xa917('0xd')](_0x1f7939[_0xa917('0xe')])){_0x39760b[_0xa917('0xf')]=_0x1f7939[_0xa917('0x10')]&&_0x1f7939[_0xa917('0x10')]!==_0xa917('0x11')?_0x1f7939[_0xa917('0x10')]:_0x1f7939['calleridnum']||_0x1f7939[_0xa917('0x12')];}else{_0x39760b[_0xa917('0xf')]=_0x1f7939[_0xa917('0x13')]&&_0x1f7939['destcalleridname']!==_0xa917('0x11')?_0x1f7939['destcalleridname']:_0x1f7939['destcalleridnum']||_0x1f7939[_0xa917('0x12')];_0x39760b[_0xa917('0x14')]=_0x1f7939['destcalleridname']&&_0x1f7939[_0xa917('0x13')]!==_0xa917('0x11')?_0x1f7939['destcalleridname']:_0x1f7939[_0xa917('0x15')]||_0x1f7939['uniqueid'];}BPromise[_0xa917('0x16')]()['then'](cmContactRpc[_0xa917('0x17')]({'where':_[_0xa917('0x18')](_0x39760b,[_0xa917('0xf')])}))[_0xa917('0x19')](function(_0x104162){if(_0x104162){logger[_0xa917('0x1a')](_0xa917('0x1b'),_0x1f7939[_0xa917('0x12')],'',_0x104162['id']);if(_0x2ec5f1){_0x1f7939[_0xa917('0x1c')]=_0x104162['id'];emit(_0x1f7939[_0xa917('0x12')],util[_0xa917('0x1d')](_0xa917('0x1e'),_0x2ec5f1[_0xa917('0x1f')]),util['format'](_0xa917('0x20'),_0x2e8ab7[_0xa917('0x21')]['toLowerCase']()),_[_0xa917('0x22')](_0x1f7939,{'ListId':parseInt(_0x2e8ab7[_0xa917('0xb')],0xa)}));}return;}else{logger[_0xa917('0x1a')](_0xa917('0x23'),_0x1f7939[_0xa917('0x12')],'');return BPromise[_0xa917('0x16')]()[_0xa917('0x19')](cmContactRpc['createContact'](_0x39760b));}})[_0xa917('0x19')](function(_0x16a57e){if(_0x16a57e){logger[_0xa917('0x1a')](_0xa917('0x24'),_0x1f7939[_0xa917('0x12')],'',_0x16a57e['id']);if(_0x2ec5f1){_0x1f7939[_0xa917('0x1c')]=_0x16a57e['id'];emit(_0x1f7939[_0xa917('0x12')],util[_0xa917('0x1d')]('user:%s',_0x2ec5f1['name']),util[_0xa917('0x1d')](_0xa917('0x20'),_0x2e8ab7['action'][_0xa917('0x25')]()),_['merge'](_0x1f7939,{'ListId':parseInt(_0x2e8ab7[_0xa917('0xb')],0xa)}));}}})[_0xa917('0x26')](function(_0x1ccfc0){logger[_0xa917('0x27')](_0xa917('0x28'),_0x1f7939[_0xa917('0x12')],'',JSON[_0xa917('0x7')](_0x1ccfc0));});}else{if(_0x2ec5f1){logger[_0xa917('0x1a')]('[%s][%s]\x20Autocreate\x20disabled',_0x1f7939[_0xa917('0x12')],'');emit(_0x1f7939[_0xa917('0x12')],util[_0xa917('0x1d')]('user:%s',_0x2ec5f1[_0xa917('0x1f')]),util['format'](_0xa917('0x20'),_0x2e8ab7[_0xa917('0x21')]['toLowerCase']()),_[_0xa917('0x22')]({'ListId':parseInt(_0x2e8ab7[_0xa917('0xb')],0xa)},_0x1f7939));}}}; \ No newline at end of file +var _0xc0a6=['ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','stringify','exec','data2','data1','calleridnum','routeId','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','resolve','then','showContact','omit','[%s][%s]\x20Contact\x20found:%s','format','trigger:%s','action','toLowerCase','createContact','[%s][%s]\x20Contact\x20created:%s','user:%s','name','merge','catch','error','[%s][%s]\x20Error\x20creating\x20contact','bluebird','util'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xc0a6,0xcb));var _0x6c0a=function(_0x2ee6a2,_0x3b2bb5){_0x2ee6a2=_0x2ee6a2-0x0;var _0x3faa98=_0xc0a6[_0x2ee6a2];return _0x3faa98;};'use strict';var BPromise=require(_0x6c0a('0x0'));var util=require(_0x6c0a('0x1'));var _=require('lodash');var Redis=require(_0x6c0a('0x2'));var config=require(_0x6c0a('0x3'));var logger=require(_0x6c0a('0x4'))(_0x6c0a('0x5'));var cmContactRpc=require(_0x6c0a('0x6'));config[_0x6c0a('0x7')]=_[_0x6c0a('0x8')](config[_0x6c0a('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x6c0a('0x9'))(new Redis(config[_0x6c0a('0x7')]));function emit(_0x416ceb,_0x415ded,_0x48695b,_0x344873){logger[_0x6c0a('0xa')]('[%s][%s]',_0x416ceb,'',_0x415ded,_0x48695b,JSON[_0x6c0a('0xb')](_0x344873));io['to'](_0x415ded)['emit'](_0x48695b,_0x344873);}exports[_0x6c0a('0xc')]=function(_0x5e0d93,_0x5a28df,_0x4f20f2){_0x4f20f2['autoCreate']=0x0;if(_0x5a28df[_0x6c0a('0xd')]&&parseInt(_0x5a28df['data2'],0xa)){var _0x20fc6e={'ListId':parseInt(_0x5a28df[_0x6c0a('0xe')],0xa),'phone':_0x4f20f2[_0x6c0a('0xf')]};if(_['isNil'](_0x4f20f2[_0x6c0a('0x10')])){_0x20fc6e[_0x6c0a('0x11')]=_0x4f20f2[_0x6c0a('0x12')]&&_0x4f20f2[_0x6c0a('0x12')]!==_0x6c0a('0x13')?_0x4f20f2[_0x6c0a('0x12')]:_0x4f20f2['calleridnum']||_0x4f20f2[_0x6c0a('0x14')];}else{_0x20fc6e[_0x6c0a('0x11')]=_0x4f20f2[_0x6c0a('0x15')]&&_0x4f20f2[_0x6c0a('0x15')]!==_0x6c0a('0x13')?_0x4f20f2[_0x6c0a('0x15')]:_0x4f20f2[_0x6c0a('0x16')]||_0x4f20f2[_0x6c0a('0x14')];_0x20fc6e[_0x6c0a('0x17')]=_0x4f20f2[_0x6c0a('0x15')]&&_0x4f20f2[_0x6c0a('0x15')]!==_0x6c0a('0x13')?_0x4f20f2['destcalleridname']:_0x4f20f2[_0x6c0a('0x16')]||_0x4f20f2[_0x6c0a('0x14')];}BPromise[_0x6c0a('0x18')]()[_0x6c0a('0x19')](cmContactRpc[_0x6c0a('0x1a')]({'where':_[_0x6c0a('0x1b')](_0x20fc6e,[_0x6c0a('0x11')])}))[_0x6c0a('0x19')](function(_0x5e7962){if(_0x5e7962){logger[_0x6c0a('0xa')](_0x6c0a('0x1c'),_0x4f20f2['uniqueid'],'',_0x5e7962['id']);if(_0x5e0d93){_0x4f20f2['xmd-contactid2']=_0x5e7962['id'];emit(_0x4f20f2[_0x6c0a('0x14')],util[_0x6c0a('0x1d')]('user:%s',_0x5e0d93['name']),util[_0x6c0a('0x1d')](_0x6c0a('0x1e'),_0x5a28df[_0x6c0a('0x1f')][_0x6c0a('0x20')]()),_['merge'](_0x4f20f2,{'ListId':parseInt(_0x5a28df['data1'],0xa)}));}return;}else{logger[_0x6c0a('0xa')]('[%s][%s]\x20Contact\x20not\x20found',_0x4f20f2[_0x6c0a('0x14')],'');return BPromise[_0x6c0a('0x18')]()[_0x6c0a('0x19')](cmContactRpc[_0x6c0a('0x21')](_0x20fc6e));}})[_0x6c0a('0x19')](function(_0xb291d){if(_0xb291d){logger[_0x6c0a('0xa')](_0x6c0a('0x22'),_0x4f20f2[_0x6c0a('0x14')],'',_0xb291d['id']);if(_0x5e0d93){_0x4f20f2['xmd-contactid2']=_0xb291d['id'];emit(_0x4f20f2[_0x6c0a('0x14')],util[_0x6c0a('0x1d')](_0x6c0a('0x23'),_0x5e0d93[_0x6c0a('0x24')]),util[_0x6c0a('0x1d')](_0x6c0a('0x1e'),_0x5a28df[_0x6c0a('0x1f')][_0x6c0a('0x20')]()),_[_0x6c0a('0x25')](_0x4f20f2,{'ListId':parseInt(_0x5a28df[_0x6c0a('0xe')],0xa)}));}}})[_0x6c0a('0x26')](function(_0x1aee5c){logger[_0x6c0a('0x27')](_0x6c0a('0x28'),_0x4f20f2[_0x6c0a('0x14')],'',JSON['stringify'](_0x1aee5c));});}else{if(_0x5e0d93){logger['info']('[%s][%s]\x20Autocreate\x20disabled',_0x4f20f2[_0x6c0a('0x14')],'');emit(_0x4f20f2[_0x6c0a('0x14')],util[_0x6c0a('0x1d')]('user:%s',_0x5e0d93['name']),util[_0x6c0a('0x1d')](_0x6c0a('0x1e'),_0x5a28df[_0x6c0a('0x1f')]['toLowerCase']()),_[_0x6c0a('0x25')]({'ListId':parseInt(_0x5a28df[_0x6c0a('0xe')],0xa)},_0x4f20f2));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f7cf489..88dbc72 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 _0x57a7=['info','stringify','emit','prototype','clone','checkTriggers','interface','hasOwnProperty','status','merge','variables','length','Actions','action','contactmanager','data1','TemplateId','html','data2','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','data5','800','data6','600','winApplication','winArguments','format','name','trigger:%s:%s','toLowerCase','jscripty','user:%s','trigger:%s','exec','integration','queue','urlforward','script','query','checkTrigger','AllConditions','every','checkConditions','channel','some','AnyConditions','chat','ChatWebsiteId','value','AccountId','operator','upperFirst','interaction','event','membername','lastevent','routeId','exports','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../rpc/cmContact','../../../config/environment','defaults','localhost','socket.io-emitter','redis','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','vtigerAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x57a7,0xb4));var _0x757a=function(_0x1f8587,_0xb39f4d){_0x1f8587=_0x1f8587-0x0;var _0x18b12d=_0x57a7[_0x1f8587];return _0x18b12d;};'use strict';var util=require('util');var _=require(_0x757a('0x0'));var url=require(_0x757a('0x1'));var Mustache=require(_0x757a('0x2'));var Redis=require(_0x757a('0x3'));var urlforward=require(_0x757a('0x4'));var integration=require(_0x757a('0x5'));var cmContact=require(_0x757a('0x6'));var script=require(_0x757a('0x7'));var cmContactRpc=require(_0x757a('0x8'));var config=require(_0x757a('0x9'));var logger=require('../../../config/logger')('trigger');var ami=require('../ami');config['redis']=_[_0x757a('0xa')](config['redis'],{'host':_0x757a('0xb'),'port':0x18eb});var io=require(_0x757a('0xc'))(new Redis(config[_0x757a('0xd')]));var operators={'equals':function(_0x48870a,_0x24081c){return _0x48870a==_0x24081c;},'not_equals':function(_0x268e40,_0x33558a){return _0x268e40!=_0x33558a;}};var barAndWebActions=[_0x757a('0xe'),'url',_0x757a('0xf')];function Trigger(_0x5d59e3){this[_0x757a('0x10')]=_0x5d59e3[_0x757a('0x10')];this[_0x757a('0x11')]=_0x5d59e3[_0x757a('0x11')];this[_0x757a('0x12')]=_0x5d59e3[_0x757a('0x12')];this[_0x757a('0x13')]=_0x5d59e3[_0x757a('0x13')];this[_0x757a('0x14')]=_0x5d59e3['voiceExtensions'];this[_0x757a('0x15')]=_0x5d59e3[_0x757a('0x15')];this[_0x757a('0x16')]=_0x5d59e3[_0x757a('0x16')];this[_0x757a('0x17')]=_0x5d59e3[_0x757a('0x17')];this[_0x757a('0x18')]=_0x5d59e3[_0x757a('0x18')];this['zohoAccounts']=_0x5d59e3[_0x757a('0x19')];this[_0x757a('0x1a')]=_0x5d59e3['deskAccounts'];this['vtigerAccounts']=_0x5d59e3['vtigerAccounts'];this[_0x757a('0x1b')]=_0x5d59e3[_0x757a('0x1b')];this[_0x757a('0x1c')]=_0x5d59e3[_0x757a('0x1c')];this[_0x757a('0x1d')]=_0x5d59e3[_0x757a('0x1d')];this[_0x757a('0x1e')]={'zendesk':this[_0x757a('0x15')],'salesforce':this[_0x757a('0x17')],'freshdesk':this[_0x757a('0x16')],'sugarcrm':this[_0x757a('0x18')],'zoho':this[_0x757a('0x19')],'desk':this[_0x757a('0x1a')],'vtiger':this[_0x757a('0x1f')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x757a('0x1d')],'servicenow':this[_0x757a('0x1b')]};ami['on']('custom:agentcalled',this[_0x757a('0x20')][_0x757a('0x21')](this));ami['on'](_0x757a('0x22'),this[_0x757a('0x20')][_0x757a('0x21')](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent'][_0x757a('0x21')](this));ami['on'](_0x757a('0x23'),this[_0x757a('0x20')][_0x757a('0x21')](this));ami['on'](_0x757a('0x24'),this[_0x757a('0x20')][_0x757a('0x21')](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0x757a('0x21')](this));ami['on'](_0x757a('0x25'),this[_0x757a('0x20')][_0x757a('0x21')](this));ami['on'](_0x757a('0x26'),this[_0x757a('0x20')][_0x757a('0x21')](this));ami['on'](_0x757a('0x27'),this[_0x757a('0x20')][_0x757a('0x21')](this));ami['on']('custom:queuecallerabandon',this[_0x757a('0x20')][_0x757a('0x21')](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0x757a('0x21')](this));ami['on'](_0x757a('0x28'),this[_0x757a('0x29')][_0x757a('0x21')](this));ami['on'](_0x757a('0x2a'),this[_0x757a('0x29')][_0x757a('0x21')](this));ami['on'](_0x757a('0x2b'),this[_0x757a('0x29')][_0x757a('0x21')](this));ami['on'](_0x757a('0x2c'),this[_0x757a('0x20')][_0x757a('0x21')](this));ami['on'](_0x757a('0x2d'),this[_0x757a('0x20')][_0x757a('0x21')](this));ami['on'](_0x757a('0x2e'),this[_0x757a('0x20')][_0x757a('0x21')](this));ami['on'](_0x757a('0x2f'),this[_0x757a('0x20')][_0x757a('0x21')](this));ami['on'](_0x757a('0x30'),this['syncCustomEvent']['bind'](this));ami['on'](_0x757a('0x31'),this[_0x757a('0x20')][_0x757a('0x21')](this));}Trigger['prototype']['emit']=function(_0x24ebcb,_0xdc5b81,_0x3457c2){logger[_0x757a('0x32')](_0x24ebcb,_0xdc5b81,JSON[_0x757a('0x33')](_0x3457c2));io['to'](_0x24ebcb)[_0x757a('0x34')](_0xdc5b81,_0x3457c2);};Trigger[_0x757a('0x35')][_0x757a('0x20')]=function(_0x1f0178){var _0x39c78f=_[_0x757a('0x36')](_0x1f0178);this[_0x757a('0x37')](_0x39c78f);};Trigger['prototype']['syncAgentDial']=function(_0x4942be){if(this[_0x757a('0x11')][_0x4942be[_0x757a('0x38')]]){this[_0x757a('0x20')](_0x4942be);}};Trigger[_0x757a('0x35')]['checkTriggers']=function(_0xab968d){var _0x14b8e3;for(var _0x5143ff in this[_0x757a('0x10')]){if(this[_0x757a('0x10')][_0x757a('0x39')](_0x5143ff)){if(this[_0x757a('0x10')][_0x5143ff][_0x757a('0x3a')]){_0x14b8e3=this['checkTrigger'](this[_0x757a('0x10')][_0x5143ff],_0xab968d);if(_0x14b8e3){_[_0x757a('0x3b')](_0xab968d,_0xab968d[_0x757a('0x3c')]);for(var _0x5d58b7=0x0,_0x111abd,_0x2eb70a,_0x5c13d3;_0x5d58b70x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 059fad8..89b52a9 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 _0x8e19=['userEmail','length','catch','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','telephone1','contactid',']\x20Enduser\x20Created!','type','nameField','customField','idField','substring','indexOf','ticketType','incidents','getString','Descriptions','/contacts(','Fields','phonecalls','assign','Subjects','callDirection','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','remoteUri','stripTrailingSlash','serverUrl','queue','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\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',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','socket.io-emitter','POST','username','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','internalemailaddress','isdisabled','info','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!'];(function(_0x1c5425,_0x9771df){var _0x501096=function(_0x51396b){while(--_0x51396b){_0x1c5425['push'](_0x1c5425['shift']());}};_0x501096(++_0x9771df);}(_0x8e19,0x9a));var _0x98e1=function(_0x40c26d,_0x54bc4c){_0x40c26d=_0x40c26d-0x0;var _0x4c58d1=_0x8e19[_0x40c26d];return _0x4c58d1;};'use strict';var _=require('lodash');var BPromise=require(_0x98e1('0x0'));var rp=require(_0x98e1('0x1'));var util=require(_0x98e1('0x2'));var intUtil=require(_0x98e1('0x3'));var md5=require('md5');var Redis=require(_0x98e1('0x4'));var logger=require(_0x98e1('0x5'))('dynamics365');var config=require(_0x98e1('0x6'));config[_0x98e1('0x7')]=_['defaults'](config['redis'],{'host':_0x98e1('0x8'),'port':0x18eb});var io=require(_0x98e1('0x9'))(new Redis(config['redis']));function getAuthToken(_0x4ee06a,_0x5e7586,_0x214de5){var _0x4a9a2e={'method':_0x98e1('0xa'),'uri':_0x5e7586,'form':{'client_id':_0x4ee06a['clientId'],'resource':_0x4ee06a['remoteUri'],'username':_0x4ee06a[_0x98e1('0xb')],'password':_0x4ee06a[_0x98e1('0xc')],'grant_type':_0x98e1('0xc'),'client_secret':_0x4ee06a[_0x98e1('0xd')]},'json':!![]};return rp(_0x4a9a2e)['then'](function(_0x1ae416){return _0x1ae416[_0x98e1('0xe')];})['catch'](function(_0x7b632a){logger[_0x98e1('0xf')]('['+[_0x214de5[_0x98e1('0x10')]()]+_0x98e1('0x11'));return _0x7b632a[_0x98e1('0x12')];});}function getUser(_0x94eb5a,_0x3dd937,_0x2a3979,_0x3937ef,_0x4f7622,_0x1b35f0){return new BPromise(function(_0x78f371,_0x15cb10){return getAuthToken(_0x3dd937,_0x3937ef,_0x1b35f0)[_0x98e1('0x13')](function(_0x220405){var _0x22b8a0={'method':_0x98e1('0x14'),'uri':_0x4f7622+_0x98e1('0x15'),'headers':{'Authorization':_0x98e1('0x16')+_0x220405,'OData-Version':_0x98e1('0x17')},'json':!![]};return rp(_0x22b8a0);})[_0x98e1('0x13')](function(_0x207b8c){var _0x7ae529=_0x207b8c[_0x98e1('0x18')];var _0x16461f=![];var _0x2b7667=null;if(!_[_0x98e1('0x19')](_0x2a3979)){if(intUtil[_0x98e1('0x1a')](_0x2a3979[_0x98e1('0x1b')])){_0x94eb5a['userEmail']=_0x2a3979[_0x98e1('0x1b')];for(_0x2b7667=0x0;_0x2b7667<_0x7ae529['length'];_0x2b7667++){if(_0x7ae529[_0x2b7667][_0x98e1('0x1c')]===_0x2a3979[_0x98e1('0x1b')]&&!_0x7ae529[_0x2b7667][_0x98e1('0x1d')]){_0x16461f=!![];logger[_0x98e1('0x1e')]('['+[_0x1b35f0[_0x98e1('0x10')]()]+']\x20Agent\x20found\x20'+_0x7ae529[_0x2b7667]['systemuserid']+'!');_0x94eb5a[_0x98e1('0x1f')]=_0x7ae529[_0x2b7667][_0x98e1('0x20')];}}}}if(!_0x16461f){logger[_0x98e1('0x1e')]('['+[_0x1b35f0[_0x98e1('0x10')]()]+_0x98e1('0x21'));_0x94eb5a[_0x98e1('0x22')]=_0x3dd937[_0x98e1('0xb')];for(_0x2b7667=0x0;_0x2b7667<_0x7ae529[_0x98e1('0x23')];_0x2b7667++){if(_0x7ae529[_0x2b7667][_0x98e1('0x1c')]===_0x3dd937[_0x98e1('0xb')]){_0x94eb5a[_0x98e1('0x1f')]=_0x7ae529[_0x2b7667]['systemuserid'];}}}_0x78f371(_0x94eb5a);})[_0x98e1('0x24')](function(_0x5ab7c9){_0x15cb10(_0x5ab7c9[_0x98e1('0x12')]);});});}function createEndUser(_0xfde237,_0x1bff55,_0x34cc80,_0x225ee0,_0x5b09e6,_0x1cd85d){return new BPromise(function(_0x2f2d59,_0x236210){return getAuthToken(_0x1bff55,_0x34cc80,_0x1cd85d)['then'](function(_0x469af0){var _0x4a1fad=_0x1cd85d[_0x98e1('0x25')]()===_0x98e1('0x26')?_0x5b09e6[_0x98e1('0x27')]:_0x5b09e6[_0x98e1('0x28')];var _0x1bb955={'method':'POST','uri':_0x225ee0+'contacts','body':{'telephone1':_0x4a1fad,'fullname':_0x4a1fad,'firstname':_0x4a1fad,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x98e1('0x29')+_0xfde237['userId']+')'},'headers':{'Authorization':_0x98e1('0x16')+_0x469af0,'OData-Version':_0x98e1('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1bb955);})[_0x98e1('0x13')](function(_0x236b46){var _0x30f9be=_0x236b46[_0x98e1('0x2a')][_0x98e1('0x2b')];var _0x5ef6b1=_0x30f9be['substring'](_0x30f9be[_0x98e1('0x2c')]('(')+0x1,_0x30f9be[_0x98e1('0x2c')](')'));_0xfde237[_0x98e1('0x2d')]=_0x5ef6b1;_0x2f2d59(_0xfde237);})['catch'](function(_0x57e485){_0x236210(_0x57e485[_0x98e1('0x12')]);});});}function getEndUser(_0x3e22be,_0x428291,_0x4fbb56,_0x409bb4,_0x1aa491,_0x4e8f71){return new BPromise(function(_0x270c88,_0x21e21e){return getAuthToken(_0x428291,_0x4fbb56,_0x4e8f71)[_0x98e1('0x13')](function(_0x31493d){var _0x4874b7={'method':_0x98e1('0x14'),'uri':_0x409bb4+'contacts?$select=telephone1','headers':{'Authorization':_0x98e1('0x16')+_0x31493d,'If-None-Match':null,'OData-Version':_0x98e1('0x17')},'json':!![]};return rp(_0x4874b7);})[_0x98e1('0x13')](function(_0x33757e){var _0x2f09ec=null;if(_0x33757e){var _0x41b4bd=_0x33757e[_0x98e1('0x18')];var _0x51a422=![];for(_0x2f09ec=0x0;_0x2f09ec<_0x41b4bd[_0x98e1('0x23')];_0x2f09ec++){var _0x37091a=_0x4e8f71['toLowerCase']()==='outbound'?_0x1aa491[_0x98e1('0x27')]:_0x1aa491[_0x98e1('0x28')];if(_0x41b4bd[_0x2f09ec][_0x98e1('0x2e')]===_0x37091a){_0x51a422=!![];_0x3e22be['enduserId']=_0x41b4bd[_0x2f09ec][_0x98e1('0x2f')];}}if(_0x51a422){_0x270c88(_0x3e22be);}else{return createEndUser(_0x3e22be,_0x428291,_0x4fbb56,_0x409bb4,_0x1aa491,_0x4e8f71)['then'](function(_0x54c848){logger[_0x98e1('0x1e')]('['+[_0x4e8f71[_0x98e1('0x10')]()]+']\x20Enduser\x20created!',_0x54c848[_0x98e1('0x2d')]);_0x270c88(_0x54c848);});}}else{return createEndUser(_0x3e22be,_0x428291,_0x4fbb56,_0x409bb4,_0x1aa491,_0x4e8f71)[_0x98e1('0x13')](function(_0x57eda5){logger[_0x98e1('0x1e')]('['+[_0x4e8f71[_0x98e1('0x10')]()]+_0x98e1('0x30'),_0x57eda5[_0x98e1('0x2d')]);_0x270c88(_0x57eda5);});}});});}function getCustomFields(_0x29c7a3,_0x238da,_0x1d3ff6){var _0x3f796f={};if(_0x29c7a3[_0x98e1('0x23')]>0x0){_['forEach'](_0x29c7a3,function(_0x224d86){if(_0x224d86[_0x98e1('0x31')]==='string'&&_0x224d86[_0x98e1('0x32')]&&!_0x224d86[_0x98e1('0x33')]){var _0x4caea7=_0x224d86[_0x98e1('0x34')]['toLowerCase']();var _0x2530a3=_0x4caea7[_0x98e1('0x35')](0x0,_0x4caea7[_0x98e1('0x36')]('_'));var _0x5c706f=_0x4caea7[_0x98e1('0x35')](_0x4caea7[_0x98e1('0x36')]('_')+0x1);if(_0x2530a3===_0x1d3ff6){_0x3f796f[_0x5c706f]=_0x224d86['content'];}}});}return _0x3f796f;}function getTicket(_0x3734cc,_0x3b4437,_0x3d4099,_0x3af855,_0x29286e,_0xb74e12,_0x19fade){return new BPromise(function(_0x185563,_0x1895cc){var _0x3e817a;return getAuthToken(_0x3b4437,_0x3d4099,_0x19fade)[_0x98e1('0x13')](function(_0x5b6159){if(_0xb74e12[_0x98e1('0x37')]==='incident'){_0x3e817a={'method':_0x98e1('0xa'),'uri':_0x3af855+_0x98e1('0x38'),'body':Object['assign']({},{'title':intUtil['getString'](_0xb74e12['Subjects'],_0x29286e,'\x20'),'description':intUtil[_0x98e1('0x39')](_0xb74e12[_0x98e1('0x3a')],_0x29286e,'\x0a'),'customerid_contact@odata.bind':_0x98e1('0x3b')+_0x3734cc[_0x98e1('0x2d')]+')','ownerid@odata.bind':'/systemusers('+_0x3734cc[_0x98e1('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0xb74e12[_0x98e1('0x3c')],_0x29286e,_0xb74e12[_0x98e1('0x37')])),'headers':{'Authorization':_0x98e1('0x16')+_0x5b6159,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xb74e12['ticketType']==='phonecall'){_0x3e817a={'method':'POST','uri':_0x3af855+_0x98e1('0x3d'),'body':Object[_0x98e1('0x3e')]({},{'subject':intUtil['getString'](_0xb74e12[_0x98e1('0x3f')],_0x29286e,'\x20'),'phonenumber':String(_0x29286e[_0x98e1('0x28')]),'description':intUtil[_0x98e1('0x39')](_0xb74e12[_0x98e1('0x3a')],_0x29286e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x98e1('0x3b')+_0x3734cc['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x3734cc[_0x98e1('0x1f')]+')','directioncode':_0x3734cc[_0x98e1('0x40')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x98e1('0x29')+_0x3734cc[_0x98e1('0x1f')]+')','participationtypemask':_0x3734cc[_0x98e1('0x40')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x98e1('0x3b')+_0x3734cc[_0x98e1('0x2d')]+')','participationtypemask':_0x3734cc[_0x98e1('0x40')]==='queue'?0x1:0x2}]},getCustomFields(_0xb74e12[_0x98e1('0x3c')],_0x29286e,_0xb74e12[_0x98e1('0x37')])),'headers':{'Authorization':_0x98e1('0x16')+_0x5b6159,'OData-Version':_0x98e1('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3e817a);})[_0x98e1('0x13')](function(_0x4973d9){var _0x5cf607=_0x4973d9[_0x98e1('0x2a')]['odata-entityid'];var _0x11364b=_0x5cf607[_0x98e1('0x35')](_0x5cf607['lastIndexOf']('(')+0x1,_0x5cf607[_0x98e1('0x2c')](')'));_0x3734cc[_0x98e1('0x41')]=_0x11364b;_0x185563(_0x3734cc);})['catch'](function(_0x887450){_0x1895cc(_0x887450[_0x98e1('0x12')]);});});}function emit(_0x4f41d1,_0x244898,_0x4b3731,_0x5c57a9){var _0x4efefa={'uri':util['format'](_0x98e1('0x42'),_0x4f41d1,_0x4b3731,_0x5c57a9)};io['to'](util[_0x98e1('0x43')](_0x98e1('0x44'),_0x244898))[_0x98e1('0x45')]('trigger:browser:url',_0x4efefa);}exports['cs']=function(_0x4451ca,_0x8f7c3d,_0x86e867,_0x2cfc70,_0x2dd58b,_0x5c54c7,_0x504ee2,_0x48da1e){var _0x6ac401={};_0x5c54c7[_0x98e1('0x46')]=intUtil[_0x98e1('0x47')](_0x5c54c7[_0x98e1('0x46')]);_0x5c54c7['serverUrl']=intUtil[_0x98e1('0x47')](_0x5c54c7[_0x98e1('0x48')]);_0x6ac401[_0x98e1('0x40')]=_0x48da1e===_0x98e1('0x49')||_0x48da1e===_0x98e1('0x4a')?_0x98e1('0x49'):_0x98e1('0x26');var _0x84510=util[_0x98e1('0x43')](_0x98e1('0x4b'),_0x5c54c7[_0x98e1('0x46')]);var _0x2d2dca=util[_0x98e1('0x43')](_0x98e1('0x4c'),_0x5c54c7[_0x98e1('0x4d')]);var _0x583764=util[_0x98e1('0x43')](_0x98e1('0x4e'),_0x5c54c7['serverUrl'],_0x8f7c3d[_0x98e1('0x4f')],md5(_0x8f7c3d[_0x98e1('0x4f')]));if(_0x2dd58b&&_0x2dd58b[_0x98e1('0x50')]){logger[_0x98e1('0x1e')](_0x98e1('0x51'),_0x98e1('0x52'));_0x8f7c3d[_0x98e1('0x53')]=_0x583764;}else if(_0x504ee2&&_0x504ee2[_0x98e1('0x54')]&&_0x504ee2[_0x98e1('0x54')]!==_0x98e1('0x55')){logger['info']('[OUTBOUND]',_0x98e1('0x52'));_0x8f7c3d[_0x98e1('0x53')]=_0x583764;}else{_0x8f7c3d['recordingURL']='';}return getUser(_0x6ac401,_0x5c54c7,_0x2cfc70,_0x2d2dca,_0x84510,_0x48da1e)[_0x98e1('0x13')](function(_0x5253fa){logger['info']('['+_0x48da1e['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x5253fa[_0x98e1('0x1f')]);logger['info']('['+_0x48da1e['toUpperCase']()+_0x98e1('0x56'),_0x5253fa[_0x98e1('0x22')]);return getEndUser(_0x5253fa,_0x5c54c7,_0x2d2dca,_0x84510,_0x8f7c3d,_0x48da1e);})[_0x98e1('0x13')](function(_0x5f16f){logger[_0x98e1('0x1e')]('['+_0x48da1e[_0x98e1('0x10')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x5f16f[_0x98e1('0x2d')]);logger[_0x98e1('0x1e')]('['+_0x48da1e[_0x98e1('0x10')]()+_0x98e1('0x57'),_0x8f7c3d[_0x98e1('0x28')]);return getTicket(_0x5f16f,_0x5c54c7,_0x2d2dca,_0x84510,_0x8f7c3d,_0x86e867,_0x48da1e);})['then'](function(_0x3923a4){logger[_0x98e1('0x1e')](util[_0x98e1('0x43')]('['+_0x48da1e[_0x98e1('0x10')]()+_0x98e1('0x58'),_0x86e867[_0x98e1('0x37')],_0x3923a4['ticketId']));logger[_0x98e1('0x1e')](util['format']('['+_0x48da1e[_0x98e1('0x10')]()+_0x98e1('0x59'),_0x48da1e));if(_0x48da1e!==_0x98e1('0x4a')){logger[_0x98e1('0x1e')]('['+_0x48da1e[_0x98e1('0x10')]()+']',_0x98e1('0x5a'));emit(_0x5c54c7[_0x98e1('0x46')],_0x2cfc70[_0x98e1('0x5b')],_0x86e867[_0x98e1('0x37')],_0x3923a4[_0x98e1('0x41')]);}})[_0x98e1('0x24')](function(_0xc1d0d3){logger[_0x98e1('0xf')]('['+_0x48da1e[_0x98e1('0x10')]()+_0x98e1('0x5c'),util[_0x98e1('0x5d')](_0xc1d0d3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf9c6=['then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','message','toLowerCase','outbound','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contactid',']\x20Enduser\x20created!','forEach','type','string','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecalls','callDirection','queue','ticketId','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','format','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret'];(function(_0x47da8d,_0x517e13){var _0x5aabef=function(_0x2528d7){while(--_0x2528d7){_0x47da8d['push'](_0x47da8d['shift']());}};_0x5aabef(++_0x517e13);}(_0xf9c6,0x1d7));var _0x6f9c=function(_0x19101f,_0x3f1b9a){_0x19101f=_0x19101f-0x0;var _0x103bca=_0xf9c6[_0x19101f];return _0x103bca;};'use strict';var _=require(_0x6f9c('0x0'));var BPromise=require(_0x6f9c('0x1'));var rp=require(_0x6f9c('0x2'));var util=require(_0x6f9c('0x3'));var intUtil=require(_0x6f9c('0x4'));var md5=require(_0x6f9c('0x5'));var Redis=require(_0x6f9c('0x6'));var logger=require(_0x6f9c('0x7'))('dynamics365');var config=require(_0x6f9c('0x8'));config[_0x6f9c('0x9')]=_[_0x6f9c('0xa')](config[_0x6f9c('0x9')],{'host':_0x6f9c('0xb'),'port':0x18eb});var io=require(_0x6f9c('0xc'))(new Redis(config[_0x6f9c('0x9')]));function getAuthToken(_0x2d3d6b,_0x4ee7c6,_0x5f4917){var _0x6d8186={'method':_0x6f9c('0xd'),'uri':_0x4ee7c6,'form':{'client_id':_0x2d3d6b[_0x6f9c('0xe')],'resource':_0x2d3d6b[_0x6f9c('0xf')],'username':_0x2d3d6b[_0x6f9c('0x10')],'password':_0x2d3d6b[_0x6f9c('0x11')],'grant_type':_0x6f9c('0x11'),'client_secret':_0x2d3d6b[_0x6f9c('0x12')]},'json':!![]};return rp(_0x6d8186)[_0x6f9c('0x13')](function(_0xe27904){return _0xe27904[_0x6f9c('0x14')];})[_0x6f9c('0x15')](function(_0x5c32e6){logger[_0x6f9c('0x16')]('['+[_0x5f4917[_0x6f9c('0x17')]()]+_0x6f9c('0x18'));return _0x5c32e6['message'];});}function getUser(_0x2cab50,_0x30db75,_0xf1ce05,_0x3b20a3,_0x88a062,_0x3d41b9){return new BPromise(function(_0xc68ef5,_0x1aa11e){return getAuthToken(_0x30db75,_0x3b20a3,_0x3d41b9)[_0x6f9c('0x13')](function(_0x286443){var _0x46cf6e={'method':_0x6f9c('0x19'),'uri':_0x88a062+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x6f9c('0x1a')+_0x286443,'OData-Version':_0x6f9c('0x1b')},'json':!![]};return rp(_0x46cf6e);})[_0x6f9c('0x13')](function(_0x28ee3d){var _0x16c9a4=_0x28ee3d[_0x6f9c('0x1c')];var _0xcae7f7=![];var _0x446e4d=null;if(!_[_0x6f9c('0x1d')](_0xf1ce05)){if(intUtil[_0x6f9c('0x1e')](_0xf1ce05['email'])){_0x2cab50['userEmail']=_0xf1ce05[_0x6f9c('0x1f')];for(_0x446e4d=0x0;_0x446e4d<_0x16c9a4[_0x6f9c('0x20')];_0x446e4d++){if(_0x16c9a4[_0x446e4d][_0x6f9c('0x21')]===_0xf1ce05['email']&&!_0x16c9a4[_0x446e4d][_0x6f9c('0x22')]){_0xcae7f7=!![];logger[_0x6f9c('0x23')]('['+[_0x3d41b9[_0x6f9c('0x17')]()]+_0x6f9c('0x24')+_0x16c9a4[_0x446e4d][_0x6f9c('0x25')]+'!');_0x2cab50[_0x6f9c('0x26')]=_0x16c9a4[_0x446e4d]['systemuserid'];}}}}if(!_0xcae7f7){logger[_0x6f9c('0x23')]('['+[_0x3d41b9[_0x6f9c('0x17')]()]+_0x6f9c('0x27'));_0x2cab50[_0x6f9c('0x28')]=_0x30db75[_0x6f9c('0x10')];for(_0x446e4d=0x0;_0x446e4d<_0x16c9a4[_0x6f9c('0x20')];_0x446e4d++){if(_0x16c9a4[_0x446e4d][_0x6f9c('0x21')]===_0x30db75[_0x6f9c('0x10')]){_0x2cab50[_0x6f9c('0x26')]=_0x16c9a4[_0x446e4d][_0x6f9c('0x25')];}}}_0xc68ef5(_0x2cab50);})[_0x6f9c('0x15')](function(_0x2d4ebf){_0x1aa11e(_0x2d4ebf[_0x6f9c('0x29')]);});});}function createEndUser(_0x16cc2c,_0x3b6609,_0x4653dc,_0x348397,_0x5b2d01,_0x421c7c){return new BPromise(function(_0x21ccba,_0x457573){return getAuthToken(_0x3b6609,_0x4653dc,_0x421c7c)[_0x6f9c('0x13')](function(_0x199db1){var _0x150e9b=_0x421c7c[_0x6f9c('0x2a')]()===_0x6f9c('0x2b')?_0x5b2d01['destcalleridnum']:_0x5b2d01[_0x6f9c('0x2c')];var _0x50eab8={'method':_0x6f9c('0xd'),'uri':_0x348397+_0x6f9c('0x2d'),'body':{'telephone1':_0x150e9b,'fullname':_0x150e9b,'firstname':_0x150e9b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6f9c('0x2e')+_0x16cc2c[_0x6f9c('0x26')]+')'},'headers':{'Authorization':_0x6f9c('0x1a')+_0x199db1,'OData-Version':_0x6f9c('0x1b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x50eab8);})[_0x6f9c('0x13')](function(_0x7fbe3c){var _0x3036cb=_0x7fbe3c[_0x6f9c('0x2f')][_0x6f9c('0x30')];var _0x5659f5=_0x3036cb[_0x6f9c('0x31')](_0x3036cb['lastIndexOf']('(')+0x1,_0x3036cb[_0x6f9c('0x32')](')'));_0x16cc2c[_0x6f9c('0x33')]=_0x5659f5;_0x21ccba(_0x16cc2c);})['catch'](function(_0x352530){_0x457573(_0x352530['message']);});});}function getEndUser(_0xae8e95,_0x1924e6,_0x2c40c2,_0x1b4138,_0x518d54,_0x705d2c){return new BPromise(function(_0x1086f0,_0x501b21){return getAuthToken(_0x1924e6,_0x2c40c2,_0x705d2c)[_0x6f9c('0x13')](function(_0x349559){var _0x2b28f8={'method':_0x6f9c('0x19'),'uri':_0x1b4138+'contacts?$select=telephone1','headers':{'Authorization':_0x6f9c('0x1a')+_0x349559,'If-None-Match':null,'OData-Version':_0x6f9c('0x1b')},'json':!![]};return rp(_0x2b28f8);})[_0x6f9c('0x13')](function(_0x2d3b16){var _0x5e5ca0=null;if(_0x2d3b16){var _0x153306=_0x2d3b16['value'];var _0x297e0c=![];for(_0x5e5ca0=0x0;_0x5e5ca0<_0x153306[_0x6f9c('0x20')];_0x5e5ca0++){var _0x242e9a=_0x705d2c['toLowerCase']()===_0x6f9c('0x2b')?_0x518d54[_0x6f9c('0x34')]:_0x518d54['calleridnum'];if(_0x153306[_0x5e5ca0][_0x6f9c('0x35')]===_0x242e9a){_0x297e0c=!![];_0xae8e95[_0x6f9c('0x33')]=_0x153306[_0x5e5ca0][_0x6f9c('0x36')];}}if(_0x297e0c){_0x1086f0(_0xae8e95);}else{return createEndUser(_0xae8e95,_0x1924e6,_0x2c40c2,_0x1b4138,_0x518d54,_0x705d2c)[_0x6f9c('0x13')](function(_0x302ce7){logger[_0x6f9c('0x23')]('['+[_0x705d2c['toUpperCase']()]+_0x6f9c('0x37'),_0x302ce7[_0x6f9c('0x33')]);_0x1086f0(_0x302ce7);});}}else{return createEndUser(_0xae8e95,_0x1924e6,_0x2c40c2,_0x1b4138,_0x518d54,_0x705d2c)[_0x6f9c('0x13')](function(_0x198e20){logger[_0x6f9c('0x23')]('['+[_0x705d2c['toUpperCase']()]+']\x20Enduser\x20Created!',_0x198e20[_0x6f9c('0x33')]);_0x1086f0(_0x198e20);});}});});}function getCustomFields(_0x38f151,_0x4a56a2,_0x2abd95){var _0x1184d={};if(_0x38f151[_0x6f9c('0x20')]>0x0){_[_0x6f9c('0x38')](_0x38f151,function(_0x5cb40){if(_0x5cb40[_0x6f9c('0x39')]===_0x6f9c('0x3a')&&_0x5cb40[_0x6f9c('0x3b')]&&!_0x5cb40[_0x6f9c('0x3c')]){var _0x2d2ec6=_0x5cb40[_0x6f9c('0x3d')]['toLowerCase']();var _0x382afc=_0x2d2ec6['substring'](0x0,_0x2d2ec6[_0x6f9c('0x3e')]('_'));var _0x332076=_0x2d2ec6[_0x6f9c('0x31')](_0x2d2ec6['indexOf']('_')+0x1);if(_0x382afc===_0x2abd95){_0x1184d[_0x332076]=_0x5cb40[_0x6f9c('0x3f')];}}});}return _0x1184d;}function getTicket(_0x319026,_0x493e2c,_0x4533cf,_0xa40ea3,_0x589486,_0xdca517,_0x2de6c0){return new BPromise(function(_0xc8ab95,_0x7d9ec7){var _0xec5842;return getAuthToken(_0x493e2c,_0x4533cf,_0x2de6c0)[_0x6f9c('0x13')](function(_0x4b834e){if(_0xdca517[_0x6f9c('0x40')]===_0x6f9c('0x41')){_0xec5842={'method':_0x6f9c('0xd'),'uri':_0xa40ea3+'incidents','body':Object[_0x6f9c('0x42')]({},{'title':intUtil[_0x6f9c('0x43')](_0xdca517[_0x6f9c('0x44')],_0x589486,'\x20'),'description':intUtil[_0x6f9c('0x43')](_0xdca517[_0x6f9c('0x45')],_0x589486,'\x0a'),'customerid_contact@odata.bind':_0x6f9c('0x46')+_0x319026[_0x6f9c('0x33')]+')','ownerid@odata.bind':_0x6f9c('0x2e')+_0x319026[_0x6f9c('0x26')]+')','caseorigincode':'1'},getCustomFields(_0xdca517[_0x6f9c('0x47')],_0x589486,_0xdca517[_0x6f9c('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x4b834e,'OData-Version':_0x6f9c('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xdca517['ticketType']==='phonecall'){_0xec5842={'method':_0x6f9c('0xd'),'uri':_0xa40ea3+_0x6f9c('0x48'),'body':Object[_0x6f9c('0x42')]({},{'subject':intUtil['getString'](_0xdca517[_0x6f9c('0x44')],_0x589486,'\x20'),'phonenumber':String(_0x589486[_0x6f9c('0x2c')]),'description':intUtil[_0x6f9c('0x43')](_0xdca517[_0x6f9c('0x45')],_0x589486,'\x0a'),'regardingobjectid_contact@odata.bind':_0x6f9c('0x46')+_0x319026['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x319026['userId']+')','directioncode':_0x319026[_0x6f9c('0x49')]===_0x6f9c('0x4a')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x6f9c('0x2e')+_0x319026[_0x6f9c('0x26')]+')','participationtypemask':_0x319026[_0x6f9c('0x49')]===_0x6f9c('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0x6f9c('0x46')+_0x319026['enduserId']+')','participationtypemask':_0x319026[_0x6f9c('0x49')]===_0x6f9c('0x4a')?0x1:0x2}]},getCustomFields(_0xdca517[_0x6f9c('0x47')],_0x589486,_0xdca517['ticketType'])),'headers':{'Authorization':_0x6f9c('0x1a')+_0x4b834e,'OData-Version':_0x6f9c('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xec5842);})['then'](function(_0x320bba){var _0x40200a=_0x320bba[_0x6f9c('0x2f')][_0x6f9c('0x30')];var _0x4622e4=_0x40200a[_0x6f9c('0x31')](_0x40200a[_0x6f9c('0x32')]('(')+0x1,_0x40200a[_0x6f9c('0x32')](')'));_0x319026[_0x6f9c('0x4b')]=_0x4622e4;_0xc8ab95(_0x319026);})[_0x6f9c('0x15')](function(_0x1147d7){_0x7d9ec7(_0x1147d7[_0x6f9c('0x29')]);});});}function emit(_0x19a8b4,_0x36d219,_0x48f946,_0x1c5efb){var _0x4e36a9={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x19a8b4,_0x48f946,_0x1c5efb)};io['to'](util['format'](_0x6f9c('0x4c'),_0x36d219))[_0x6f9c('0x4d')](_0x6f9c('0x4e'),_0x4e36a9);}exports['cs']=function(_0x26536e,_0x5a99e0,_0x46793b,_0x50e3db,_0x4b4514,_0x3c63f0,_0x453d21,_0x2e5e32){var _0x4f8a8e={};_0x3c63f0[_0x6f9c('0xf')]=intUtil[_0x6f9c('0x4f')](_0x3c63f0[_0x6f9c('0xf')]);_0x3c63f0[_0x6f9c('0x50')]=intUtil[_0x6f9c('0x4f')](_0x3c63f0['serverUrl']);_0x4f8a8e[_0x6f9c('0x49')]=_0x2e5e32==='queue'||_0x2e5e32===_0x6f9c('0x51')?'queue':_0x6f9c('0x2b');var _0x30771f=util['format']('%s/api/data/v9.0/',_0x3c63f0[_0x6f9c('0xf')]);var _0x588b26=util['format'](_0x6f9c('0x52'),_0x3c63f0[_0x6f9c('0x53')]);var _0x550f00=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c63f0[_0x6f9c('0x50')],_0x5a99e0[_0x6f9c('0x54')],md5(_0x5a99e0[_0x6f9c('0x54')]));if(_0x4b4514&&_0x4b4514['monitor_format']){logger[_0x6f9c('0x23')](_0x6f9c('0x55'),_0x6f9c('0x56'));_0x5a99e0[_0x6f9c('0x57')]=_0x550f00;}else if(_0x453d21&&_0x453d21['recordingFormat']&&_0x453d21[_0x6f9c('0x58')]!==_0x6f9c('0x59')){logger['info'](_0x6f9c('0x5a'),_0x6f9c('0x56'));_0x5a99e0[_0x6f9c('0x57')]=_0x550f00;}else{_0x5a99e0[_0x6f9c('0x57')]='';}return getUser(_0x4f8a8e,_0x3c63f0,_0x50e3db,_0x588b26,_0x30771f,_0x2e5e32)['then'](function(_0x22ee7a){logger[_0x6f9c('0x23')]('['+_0x2e5e32[_0x6f9c('0x17')]()+_0x6f9c('0x5b'),_0x22ee7a[_0x6f9c('0x26')]);logger[_0x6f9c('0x23')]('['+_0x2e5e32[_0x6f9c('0x17')]()+_0x6f9c('0x5c'),_0x22ee7a['userEmail']);return getEndUser(_0x22ee7a,_0x3c63f0,_0x588b26,_0x30771f,_0x5a99e0,_0x2e5e32);})[_0x6f9c('0x13')](function(_0x2457bf){logger['info']('['+_0x2e5e32['toUpperCase']()+_0x6f9c('0x5d'),_0x2457bf[_0x6f9c('0x33')]);logger[_0x6f9c('0x23')]('['+_0x2e5e32[_0x6f9c('0x17')]()+_0x6f9c('0x5e'),_0x5a99e0[_0x6f9c('0x2c')]);return getTicket(_0x2457bf,_0x3c63f0,_0x588b26,_0x30771f,_0x5a99e0,_0x46793b,_0x2e5e32);})['then'](function(_0x5b3a78){logger[_0x6f9c('0x23')](util['format']('['+_0x2e5e32[_0x6f9c('0x17')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x46793b[_0x6f9c('0x40')],_0x5b3a78['ticketId']));logger['info'](util[_0x6f9c('0x5f')]('['+_0x2e5e32['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x2e5e32));if(_0x2e5e32!==_0x6f9c('0x51')){logger[_0x6f9c('0x23')]('['+_0x2e5e32['toUpperCase']()+']',_0x6f9c('0x60'));emit(_0x3c63f0[_0x6f9c('0xf')],_0x50e3db[_0x6f9c('0x61')],_0x46793b[_0x6f9c('0x40')],_0x5b3a78[_0x6f9c('0x4b')]);}})[_0x6f9c('0x15')](function(_0x55d7c0){logger[_0x6f9c('0x16')]('['+_0x2e5e32[_0x6f9c('0x17')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x55d7c0,{'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 63c4413..7333b12 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 _0x53b1=['application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','getString','Subjects','Descriptions','Tags','name','Fields','mapValues','keyBy','custom_fields','value','format','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','[QUEUE]','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter'];(function(_0x2518ca,_0x4fd780){var _0x32257d=function(_0x40988f){while(--_0x40988f){_0x2518ca['push'](_0x2518ca['shift']());}};_0x32257d(++_0x4fd780);}(_0x53b1,0x110));var _0x153b=function(_0x6b246,_0x550aaa){_0x6b246=_0x6b246-0x0;var _0x329992=_0x53b1[_0x6b246];return _0x329992;};'use strict';var _=require(_0x153b('0x0'));var rp=require(_0x153b('0x1'));var md5=require(_0x153b('0x2'));var util=require('util');var Redis=require(_0x153b('0x3'));var intUtil=require('./util');var config=require(_0x153b('0x4'));var logger=require(_0x153b('0x5'))(_0x153b('0x6'));config[_0x153b('0x7')]=_['defaults'](config['redis'],{'host':_0x153b('0x8'),'port':0x18eb});var io=require(_0x153b('0x9'))(new Redis(config[_0x153b('0x7')]));var headers={'Content-Type':_0x153b('0xa'),'Accept':_0x153b('0xa')};function emit(_0x3ba61c,_0x5cc40d,_0x33bdef){io['to'](_0x3ba61c)['emit'](_0x5cc40d,_0x33bdef);}function getTicket(_0x2b6826,_0x1b3d6b,_0x25b768,_0x1eeb0e,_0x31bb3f){logger[_0x153b('0xb')](_0x153b('0xc'));var _0x368574=_[_0x153b('0xd')]({'responder_id':_0x1b3d6b['id'],'requester_id':_0x25b768['id'],'name':util['format'](_0x153b('0xe'),_0x31bb3f['calleridname']),'phone':_0x31bb3f['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x153b('0xf')](_0x1eeb0e[_0x153b('0x10')],_0x31bb3f,'\x20'),'description':intUtil[_0x153b('0xf')](_0x1eeb0e[_0x153b('0x11')],_0x31bb3f,'
'),'tags':getTags(_0x1eeb0e[_0x153b('0x12')],_0x153b('0x13'))},getCustomFields(_0x1eeb0e[_0x153b('0x14')],_0x31bb3f));_0x368574['custom_fields']=_[_0x153b('0x15')](_[_0x153b('0x16')](_0x368574[_0x153b('0x17')],'id'),_0x153b('0x18'));return request({'uri':util[_0x153b('0x19')](_0x153b('0x1a'),_0x2b6826[_0x153b('0x1b')]),'method':_0x153b('0x1c'),'body':_0x368574})['then'](function(_0x4505fd){logger[_0x153b('0xb')](_0x153b('0x1d'));return _0x4505fd;});}function getUser(_0x5b5932,_0x4c0e04){if(intUtil['validateEmail'](_0x4c0e04)){return request({'uri':util[_0x153b('0x19')](_0x153b('0x1e'),_0x5b5932['remoteUri']),'qs':{'email':_0x4c0e04}})[_0x153b('0x1f')](function(_0x4e922d){if(_0x4e922d[_0x153b('0x20')]){logger['info'](_0x153b('0x21'));return _[_0x153b('0x22')](_0x4e922d,function(_0x1332c8){return _0x1332c8[_0x153b('0x23')]['email']===_0x4c0e04;});}else{logger[_0x153b('0xb')](_0x153b('0x24'));return request({'uri':util[_0x153b('0x19')](_0x153b('0x25'),_0x5b5932[_0x153b('0x1b')])})[_0x153b('0x1f')](function(_0x308e9a){logger[_0x153b('0xb')]('Admin\x20account\x20selected.');return _0x308e9a;});}});}else{logger[_0x153b('0xb')](_0x153b('0x26'));return request({'uri':util[_0x153b('0x19')](_0x153b('0x25'),_0x5b5932['remoteUri'])})[_0x153b('0x1f')](function(_0xa6eb70){logger[_0x153b('0xb')](_0x153b('0x27'));return _0xa6eb70;});}}function getEndUser(_0x4d3df8,_0x5693b2,_0x19ec92){logger[_0x153b('0xb')](_0x153b('0x28'),_0x19ec92);return request({'uri':util[_0x153b('0x19')](_0x153b('0x29'),_0x4d3df8['remoteUri']),'qs':{'phone':_0x19ec92}})['then'](function(_0xb64fb3){if(_0xb64fb3[_0x153b('0x20')]){logger['info'](_0x153b('0x2a'));return _['find'](_0xb64fb3,{'phone':_0x19ec92});}else{logger['info'](_0x153b('0x2b'));return request({'uri':util[_0x153b('0x19')](_0x153b('0x29'),_0x4d3df8[_0x153b('0x1b')]),'method':'POST','body':{'name':_0x5693b2,'phone':_0x19ec92}})[_0x153b('0x1f')](function(_0x2cc17b){logger['info'](_0x153b('0x2c'));return _0x2cc17b;});}});}function getAuth(_0x1ba6fa){return util[_0x153b('0x19')](_0x153b('0x2d'),new Buffer(_0x1ba6fa[_0x153b('0x2e')]+':X')[_0x153b('0x2f')](_0x153b('0x30')));}function request(_0x1e1ba8){logger[_0x153b('0x31')](_0x153b('0x32'),JSON[_0x153b('0x33')](_0x1e1ba8));return rp(_[_0x153b('0x34')](_0x1e1ba8,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4157eb,_0x4f51a5){var _0x2b83e3=[];if(_0x4157eb&&_0x4157eb[_0x153b('0x20')]>0x0){_0x2b83e3=_[_0x153b('0x35')](_0x4157eb,_0x4f51a5);}return _0x2b83e3;}function getCustomFields(_0x2cc5bc,_0x125722){var _0x27923f=[];var _0x4f0bbe={'custom_fields':[]};if(_0x2cc5bc[_0x153b('0x20')]>0x0){_[_0x153b('0x36')](_0x2cc5bc,function(_0x2af6b3){if(_0x2af6b3[_0x153b('0x37')]===_0x153b('0x38')&&_0x2af6b3[_0x153b('0x39')]&&!_0x2af6b3[_0x153b('0x3a')]){_0x4f0bbe[_0x2af6b3[_0x153b('0x39')][_0x153b('0x3b')]()]=_0x2af6b3[_0x153b('0x3c')][_0x153b('0x2f')]();}else if(_0x2af6b3[_0x153b('0x37')]==='string'&&_0x2af6b3[_0x153b('0x3d')]&&_0x2af6b3[_0x153b('0x3a')]){_0x4f0bbe['custom_fields'][_0x153b('0x3e')]({'id':_0x2af6b3[_0x153b('0x3d')],'value':_0x2af6b3['content']['toString']()});}else if(_0x2af6b3[_0x153b('0x37')]===_0x153b('0x3f')&&_0x2af6b3[_0x153b('0x40')]&&_0x2af6b3['idField']&&_0x2af6b3['customField']){_0x125722[_0x2af6b3[_0x153b('0x40')]]&&_0x4f0bbe[_0x153b('0x17')][_0x153b('0x3e')]({'id':_0x2af6b3['idField'],'value':_0x125722[_0x2af6b3['variableName']][_0x153b('0x2f')]()});}else if(_0x2af6b3[_0x153b('0x37')]===_0x153b('0x41')&&_0x2af6b3[_0x153b('0x42')]&&_0x2af6b3[_0x153b('0x42')][_0x153b('0x13')]&&_0x2af6b3[_0x153b('0x3d')]&&_0x2af6b3[_0x153b('0x3a')]){_0x125722[_0x2af6b3[_0x153b('0x42')]['name'][_0x153b('0x3b')]()]&&_0x4f0bbe[_0x153b('0x17')][_0x153b('0x3e')]({'id':_0x2af6b3[_0x153b('0x3d')],'value':_0x125722[_0x2af6b3['Variable'][_0x153b('0x13')][_0x153b('0x3b')]()][_0x153b('0x2f')]()});}});}return _0x4f0bbe;}exports[_0x153b('0x43')]=function(_0x583947,_0x39a2ea,_0x51878b,_0x42c139,_0x23678e,_0x4a3082){var _0x396bc1,_0x482872;_0x4a3082['remoteUri']=intUtil['stripTrailingSlash'](_0x4a3082[_0x153b('0x1b')]);_0x4a3082[_0x153b('0x44')]=intUtil[_0x153b('0x45')](_0x4a3082[_0x153b('0x44')]);if(_0x23678e&&_0x23678e[_0x153b('0x46')]){logger[_0x153b('0xb')]('[QUEUE]',_0x153b('0x47'));_0x39a2ea[_0x153b('0x48')]=util[_0x153b('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a3082['serverUrl'],_0x39a2ea[_0x153b('0x49')],md5(_0x39a2ea['uniqueid']));}else{_0x39a2ea[_0x153b('0x48')]='';}headers[_0x153b('0x4a')]=getAuth(_0x4a3082);return getUser(_0x4a3082,_0x42c139['email'])['then'](function(_0x348ca9){_0x396bc1=_0x348ca9;logger[_0x153b('0xb')](_0x153b('0x4b'),_0x396bc1['id']);return getEndUser(_0x4a3082,_0x39a2ea[_0x153b('0x4c')],_0x39a2ea[_0x153b('0x4d')]);})[_0x153b('0x1f')](function(_0x168008){_0x482872=_0x168008;logger['info']('The\x20Enduser\x20ID\x20is:',_0x482872['id']);return getTicket(_0x4a3082,_0x396bc1,_0x482872,_0x51878b,_0x39a2ea);})[_0x153b('0x1f')](function(_0x69f0c3){if(_0x69f0c3&&_0x69f0c3['id']){logger[_0x153b('0xb')](_0x153b('0x1d'));logger[_0x153b('0xb')](_0x153b('0x4e'),_0x69f0c3['id']);logger['info'](_0x153b('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x153b('0x19')]('user:%s',_0x42c139[_0x153b('0x13')]),_0x153b('0x50'),{'uri':util[_0x153b('0x19')](_0x153b('0x51'),_0x4a3082[_0x153b('0x1b')],_0x69f0c3['id'])});}})['catch'](function(_0x4198f3){logger[_0x153b('0x52')](_0x153b('0x4f'),JSON['stringify'](_0x4198f3));});};exports[_0x153b('0x53')]=function(_0x5cd981,_0x46d9ae,_0x453aa0,_0x227a07,_0x3c0870,_0x26ca0f,_0x11badd){var _0x4fccbb,_0xf1e6ef;_0x26ca0f[_0x153b('0x1b')]=intUtil[_0x153b('0x45')](_0x26ca0f[_0x153b('0x1b')]);_0x26ca0f[_0x153b('0x44')]=intUtil[_0x153b('0x45')](_0x26ca0f[_0x153b('0x44')]);if(_0x11badd&&_0x11badd[_0x153b('0x54')]&&_0x11badd[_0x153b('0x54')]!=='none'){logger[_0x153b('0xb')](_0x153b('0x55'),_0x153b('0x47'));_0x46d9ae[_0x153b('0x48')]=util['format'](_0x153b('0x56'),_0x26ca0f[_0x153b('0x44')],_0x46d9ae[_0x153b('0x49')],md5(_0x46d9ae[_0x153b('0x49')]));}headers[_0x153b('0x4a')]=getAuth(_0x26ca0f);return getUser(_0x26ca0f,_0x227a07['email'])['then'](function(_0x34b61b){_0x4fccbb=_0x34b61b;logger['info'](_0x153b('0x4b'),_0x4fccbb['id']);return getEndUser(_0x26ca0f,_0x46d9ae[_0x153b('0x57')],_0x46d9ae[_0x153b('0x58')]);})[_0x153b('0x1f')](function(_0x2db529){_0xf1e6ef=_0x2db529;logger[_0x153b('0xb')]('The\x20Enduser\x20ID\x20is:',_0xf1e6ef['id']);return getTicket(_0x26ca0f,_0x4fccbb,_0xf1e6ef,_0x453aa0,_0x46d9ae);})['then'](function(_0x2aaae6){if(_0x2aaae6&&_0x2aaae6['id']){logger['info'](_0x153b('0x1d'));logger[_0x153b('0xb')](_0x153b('0x4e'),_0x2aaae6['id']);logger[_0x153b('0xb')](_0x153b('0x55'),_0x153b('0x59'));emit(util[_0x153b('0x19')](_0x153b('0x5a'),_0x227a07[_0x153b('0x13')]),_0x153b('0x50'),{'uri':util[_0x153b('0x19')](_0x153b('0x51'),_0x26ca0f[_0x153b('0x1b')],_0x2aaae6['id'])});}})['catch'](function(_0x19f899){logger[_0x153b('0x52')](_0x153b('0x55'),JSON[_0x153b('0x33')](_0x19f899));});};exports[_0x153b('0x5b')]=function(_0x2b1333,_0x46e45d,_0x2deab7,_0x1773c0,_0x3a946,_0x2ddb2f){var _0xba7263,_0x43e389;_0x2ddb2f[_0x153b('0x1b')]=intUtil[_0x153b('0x45')](_0x2ddb2f[_0x153b('0x1b')]);_0x2ddb2f['serverUrl']=intUtil['stripTrailingSlash'](_0x2ddb2f[_0x153b('0x44')]);if(_0x3a946&&_0x3a946['monitor_format']){logger['info']('['+_0x46e45d[_0x153b('0x5c')][_0x153b('0x5d')]()+']',_0x153b('0x47'));_0x46e45d[_0x153b('0x48')]=util[_0x153b('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ddb2f['serverUrl'],_0x46e45d[_0x153b('0x49')],md5(_0x46e45d[_0x153b('0x49')]));}else{_0x46e45d[_0x153b('0x48')]='';}headers[_0x153b('0x4a')]=getAuth(_0x2ddb2f);return getUser(_0x2ddb2f,'')[_0x153b('0x1f')](function(_0x94d3bc){_0xba7263=_0x94d3bc;logger[_0x153b('0xb')](_0x153b('0x4b'),_0xba7263['id']);return getEndUser(_0x2ddb2f,_0x46e45d['calleridname'],_0x46e45d[_0x153b('0x4d')]);})[_0x153b('0x1f')](function(_0x30d21c){_0x43e389=_0x30d21c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x43e389['id']);return getTicket(_0x2ddb2f,_0xba7263,_0x43e389,_0x2deab7,_0x46e45d);})['then'](function(_0xa8a3d0){if(_0xa8a3d0){logger[_0x153b('0xb')](_0x153b('0x1d'));logger[_0x153b('0xb')](_0x153b('0x4e'),_0xa8a3d0['id']);}})['catch'](function(_0x26ef8c){logger[_0x153b('0x52')]('['+_0x46e45d[_0x153b('0x5c')][_0x153b('0x5d')]()+']',JSON[_0x153b('0x33')](_0x26ef8c));});}; \ No newline at end of file +var _0x17f1=['value','format','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','type','nameField','customField','toLowerCase','toString','string','push','content','variable','variableName','idField','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','error','[OUTBOUND]','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','Authorization','lodash','md5','util','ioredis','./util','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','name','custom_fields','mapValues'];(function(_0x403744,_0x26dc0e){var _0x4966cf=function(_0x4f2512){while(--_0x4f2512){_0x403744['push'](_0x403744['shift']());}};_0x4966cf(++_0x26dc0e);}(_0x17f1,0x1a6));var _0x117f=function(_0x58acd3,_0x31c811){_0x58acd3=_0x58acd3-0x0;var _0x549f13=_0x17f1[_0x58acd3];return _0x549f13;};'use strict';var _=require(_0x117f('0x0'));var rp=require('request-promise');var md5=require(_0x117f('0x1'));var util=require(_0x117f('0x2'));var Redis=require(_0x117f('0x3'));var intUtil=require(_0x117f('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x117f('0x5'));config[_0x117f('0x6')]=_[_0x117f('0x7')](config[_0x117f('0x6')],{'host':_0x117f('0x8'),'port':0x18eb});var io=require(_0x117f('0x9'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x117f('0xa')};function emit(_0x21e163,_0x2fe730,_0x5d677d){io['to'](_0x21e163)['emit'](_0x2fe730,_0x5d677d);}function getTicket(_0x5acc8c,_0x4e7178,_0x456761,_0x985e55,_0x55db8c){logger[_0x117f('0xb')](_0x117f('0xc'));var _0x235163=_[_0x117f('0xd')]({'responder_id':_0x4e7178['id'],'requester_id':_0x456761['id'],'name':util['format'](_0x117f('0xe'),_0x55db8c[_0x117f('0xf')]),'phone':_0x55db8c[_0x117f('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x117f('0x11')](_0x985e55['Subjects'],_0x55db8c,'\x20'),'description':intUtil['getString'](_0x985e55[_0x117f('0x12')],_0x55db8c,_0x117f('0x13')),'tags':getTags(_0x985e55['Tags'],_0x117f('0x14'))},getCustomFields(_0x985e55['Fields'],_0x55db8c));_0x235163[_0x117f('0x15')]=_[_0x117f('0x16')](_['keyBy'](_0x235163['custom_fields'],'id'),_0x117f('0x17'));return request({'uri':util[_0x117f('0x18')](_0x117f('0x19'),_0x5acc8c[_0x117f('0x1a')]),'method':'POST','body':_0x235163})[_0x117f('0x1b')](function(_0x31c15e){logger[_0x117f('0xb')](_0x117f('0x1c'));return _0x31c15e;});}function getUser(_0x301db6,_0x1d8a4b){if(intUtil[_0x117f('0x1d')](_0x1d8a4b)){return request({'uri':util[_0x117f('0x18')](_0x117f('0x1e'),_0x301db6[_0x117f('0x1a')]),'qs':{'email':_0x1d8a4b}})[_0x117f('0x1b')](function(_0x8fba21){if(_0x8fba21['length']){logger[_0x117f('0xb')](_0x117f('0x1f'));return _[_0x117f('0x20')](_0x8fba21,function(_0x22e558){return _0x22e558[_0x117f('0x21')]['email']===_0x1d8a4b;});}else{logger['info'](_0x117f('0x22'));return request({'uri':util[_0x117f('0x18')]('%s/api/v2/agents/me',_0x301db6['remoteUri'])})[_0x117f('0x1b')](function(_0x41b74e){logger[_0x117f('0xb')]('Admin\x20account\x20selected.');return _0x41b74e;});}});}else{logger['info'](_0x117f('0x23'));return request({'uri':util[_0x117f('0x18')]('%s/api/v2/agents/me',_0x301db6[_0x117f('0x1a')])})[_0x117f('0x1b')](function(_0x29183e){logger[_0x117f('0xb')](_0x117f('0x24'));return _0x29183e;});}}function getEndUser(_0x50d465,_0x3e905f,_0x5202df){logger[_0x117f('0xb')](_0x117f('0x25'),_0x5202df);return request({'uri':util['format'](_0x117f('0x26'),_0x50d465['remoteUri']),'qs':{'phone':_0x5202df}})[_0x117f('0x1b')](function(_0x2483cf){if(_0x2483cf[_0x117f('0x27')]){logger[_0x117f('0xb')](_0x117f('0x28'));return _[_0x117f('0x20')](_0x2483cf,{'phone':_0x5202df});}else{logger[_0x117f('0xb')](_0x117f('0x29'));return request({'uri':util[_0x117f('0x18')](_0x117f('0x26'),_0x50d465[_0x117f('0x1a')]),'method':_0x117f('0x2a'),'body':{'name':_0x3e905f,'phone':_0x5202df}})['then'](function(_0x2372c2){logger[_0x117f('0xb')](_0x117f('0x2b'));return _0x2372c2;});}});}function getAuth(_0x442562){return util[_0x117f('0x18')](_0x117f('0x2c'),new Buffer(_0x442562[_0x117f('0x2d')]+':X')['toString'](_0x117f('0x2e')));}function request(_0x3f7b05){logger[_0x117f('0x2f')](_0x117f('0x30'),JSON[_0x117f('0x31')](_0x3f7b05));return rp(_[_0x117f('0x7')](_0x3f7b05,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3c3c43,_0x113007){var _0x5e1bd0=[];if(_0x3c3c43&&_0x3c3c43[_0x117f('0x27')]>0x0){_0x5e1bd0=_['map'](_0x3c3c43,_0x113007);}return _0x5e1bd0;}function getCustomFields(_0x282b5d,_0x416913){var _0x14de7c=[];var _0x307d65={'custom_fields':[]};if(_0x282b5d[_0x117f('0x27')]>0x0){_['forEach'](_0x282b5d,function(_0x24b7dc){if(_0x24b7dc[_0x117f('0x32')]==='string'&&_0x24b7dc[_0x117f('0x33')]&&!_0x24b7dc[_0x117f('0x34')]){_0x307d65[_0x24b7dc[_0x117f('0x33')][_0x117f('0x35')]()]=_0x24b7dc['content'][_0x117f('0x36')]();}else if(_0x24b7dc[_0x117f('0x32')]===_0x117f('0x37')&&_0x24b7dc['idField']&&_0x24b7dc[_0x117f('0x34')]){_0x307d65['custom_fields'][_0x117f('0x38')]({'id':_0x24b7dc['idField'],'value':_0x24b7dc[_0x117f('0x39')][_0x117f('0x36')]()});}else if(_0x24b7dc['type']===_0x117f('0x3a')&&_0x24b7dc[_0x117f('0x3b')]&&_0x24b7dc[_0x117f('0x3c')]&&_0x24b7dc[_0x117f('0x34')]){_0x416913[_0x24b7dc[_0x117f('0x3b')]]&&_0x307d65[_0x117f('0x15')][_0x117f('0x38')]({'id':_0x24b7dc[_0x117f('0x3c')],'value':_0x416913[_0x24b7dc[_0x117f('0x3b')]]['toString']()});}else if(_0x24b7dc[_0x117f('0x32')]==='customVariable'&&_0x24b7dc[_0x117f('0x3d')]&&_0x24b7dc[_0x117f('0x3d')][_0x117f('0x14')]&&_0x24b7dc[_0x117f('0x3c')]&&_0x24b7dc[_0x117f('0x34')]){_0x416913[_0x24b7dc['Variable'][_0x117f('0x14')][_0x117f('0x35')]()]&&_0x307d65[_0x117f('0x15')][_0x117f('0x38')]({'id':_0x24b7dc[_0x117f('0x3c')],'value':_0x416913[_0x24b7dc[_0x117f('0x3d')]['name'][_0x117f('0x35')]()][_0x117f('0x36')]()});}});}return _0x307d65;}exports[_0x117f('0x3e')]=function(_0x2545d8,_0x930045,_0x59d302,_0x35efa2,_0x2d27bf,_0xda7df3){var _0xb795c8,_0x35d319;_0xda7df3[_0x117f('0x1a')]=intUtil[_0x117f('0x3f')](_0xda7df3[_0x117f('0x1a')]);_0xda7df3['serverUrl']=intUtil[_0x117f('0x3f')](_0xda7df3[_0x117f('0x40')]);if(_0x2d27bf&&_0x2d27bf['monitor_format']){logger[_0x117f('0xb')](_0x117f('0x41'),'Recording\x20is\x20enabled!');_0x930045[_0x117f('0x42')]=util[_0x117f('0x18')](_0x117f('0x43'),_0xda7df3[_0x117f('0x40')],_0x930045['uniqueid'],md5(_0x930045[_0x117f('0x44')]));}else{_0x930045['recordingURL']='';}headers['Authorization']=getAuth(_0xda7df3);return getUser(_0xda7df3,_0x35efa2[_0x117f('0x45')])[_0x117f('0x1b')](function(_0x639b7b){_0xb795c8=_0x639b7b;logger[_0x117f('0xb')]('The\x20User\x20ID\x20is:',_0xb795c8['id']);return getEndUser(_0xda7df3,_0x930045[_0x117f('0xf')],_0x930045[_0x117f('0x10')]);})[_0x117f('0x1b')](function(_0x40295d){_0x35d319=_0x40295d;logger[_0x117f('0xb')](_0x117f('0x46'),_0x35d319['id']);return getTicket(_0xda7df3,_0xb795c8,_0x35d319,_0x59d302,_0x930045);})[_0x117f('0x1b')](function(_0x2ebe57){if(_0x2ebe57&&_0x2ebe57['id']){logger['info'](_0x117f('0x1c'));logger[_0x117f('0xb')](_0x117f('0x47'),_0x2ebe57['id']);logger[_0x117f('0xb')](_0x117f('0x41'),_0x117f('0x48'));emit(util['format'](_0x117f('0x49'),_0x35efa2[_0x117f('0x14')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0xda7df3[_0x117f('0x1a')],_0x2ebe57['id'])});}})[_0x117f('0x4a')](function(_0x17d569){logger['error'](_0x117f('0x41'),JSON[_0x117f('0x31')](_0x17d569));});};exports[_0x117f('0x4b')]=function(_0x56e9b2,_0x1d1016,_0x3f70d0,_0x1ee97c,_0x135cda,_0x265c76,_0x12cded){var _0x19cee3,_0xb6e55b;_0x265c76[_0x117f('0x1a')]=intUtil[_0x117f('0x3f')](_0x265c76[_0x117f('0x1a')]);_0x265c76['serverUrl']=intUtil['stripTrailingSlash'](_0x265c76[_0x117f('0x40')]);if(_0x12cded&&_0x12cded[_0x117f('0x4c')]&&_0x12cded['recordingFormat']!==_0x117f('0x4d')){logger[_0x117f('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1d1016[_0x117f('0x42')]=util[_0x117f('0x18')](_0x117f('0x43'),_0x265c76[_0x117f('0x40')],_0x1d1016[_0x117f('0x44')],md5(_0x1d1016[_0x117f('0x44')]));}headers['Authorization']=getAuth(_0x265c76);return getUser(_0x265c76,_0x1ee97c[_0x117f('0x45')])[_0x117f('0x1b')](function(_0x17ccd5){_0x19cee3=_0x17ccd5;logger['info'](_0x117f('0x4e'),_0x19cee3['id']);return getEndUser(_0x265c76,_0x1d1016[_0x117f('0x4f')],_0x1d1016[_0x117f('0x50')]);})[_0x117f('0x1b')](function(_0x408c4e){_0xb6e55b=_0x408c4e;logger[_0x117f('0xb')](_0x117f('0x46'),_0xb6e55b['id']);return getTicket(_0x265c76,_0x19cee3,_0xb6e55b,_0x3f70d0,_0x1d1016);})[_0x117f('0x1b')](function(_0x1af254){if(_0x1af254&&_0x1af254['id']){logger[_0x117f('0xb')](_0x117f('0x1c'));logger[_0x117f('0xb')](_0x117f('0x47'),_0x1af254['id']);logger[_0x117f('0xb')]('[OUTBOUND]',_0x117f('0x48'));emit(util['format'](_0x117f('0x49'),_0x1ee97c[_0x117f('0x14')]),'trigger:browser:url',{'uri':util[_0x117f('0x18')](_0x117f('0x51'),_0x265c76[_0x117f('0x1a')],_0x1af254['id'])});}})['catch'](function(_0xfc3b05){logger[_0x117f('0x52')](_0x117f('0x53'),JSON[_0x117f('0x31')](_0xfc3b05));});};exports[_0x117f('0x54')]=function(_0x278e78,_0x387a21,_0x5cdb85,_0x1fb585,_0x458fc8,_0xecb23b){var _0x76199a,_0x404f36;_0xecb23b[_0x117f('0x1a')]=intUtil['stripTrailingSlash'](_0xecb23b['remoteUri']);_0xecb23b['serverUrl']=intUtil['stripTrailingSlash'](_0xecb23b[_0x117f('0x40')]);if(_0x458fc8&&_0x458fc8['monitor_format']){logger[_0x117f('0xb')]('['+_0x387a21[_0x117f('0x55')][_0x117f('0x56')]()+']',_0x117f('0x57'));_0x387a21['recordingURL']=util[_0x117f('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xecb23b['serverUrl'],_0x387a21[_0x117f('0x44')],md5(_0x387a21[_0x117f('0x44')]));}else{_0x387a21[_0x117f('0x42')]='';}headers[_0x117f('0x58')]=getAuth(_0xecb23b);return getUser(_0xecb23b,'')[_0x117f('0x1b')](function(_0x3b7819){_0x76199a=_0x3b7819;logger[_0x117f('0xb')](_0x117f('0x4e'),_0x76199a['id']);return getEndUser(_0xecb23b,_0x387a21[_0x117f('0xf')],_0x387a21[_0x117f('0x10')]);})[_0x117f('0x1b')](function(_0x4ad6d4){_0x404f36=_0x4ad6d4;logger[_0x117f('0xb')](_0x117f('0x46'),_0x404f36['id']);return getTicket(_0xecb23b,_0x76199a,_0x404f36,_0x5cdb85,_0x387a21);})[_0x117f('0x1b')](function(_0x371d8c){if(_0x371d8c){logger['info'](_0x117f('0x1c'));logger[_0x117f('0xb')](_0x117f('0x47'),_0x371d8c['id']);}})[_0x117f('0x4a')](function(_0xb0774a){logger[_0x117f('0x52')]('['+_0x387a21[_0x117f('0x55')][_0x117f('0x56')]()+']',JSON[_0x117f('0x31')](_0xb0774a));});}; \ 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 8bd9c07..87c272d 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 _0xb58d=['Displaying\x20task\x20in\x20a\x20new\x20tab...','lodash','request-promise','md5','bluebird','./util','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20with\x20email','userEmail','agentEmail','userId','Admin\x20selected','/api/contacts/filters','Getting\x20contacts\x20filter','forEach','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','work_number','contactNumber','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','catch','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Subjects','getString','add','ticketId','task','Task\x20created:','user:%s','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged'];(function(_0x5c080c,_0x31a668){var _0x211fd5=function(_0x5b6bcb){while(--_0x5b6bcb){_0x5c080c['push'](_0x5c080c['shift']());}};_0x211fd5(++_0x31a668);}(_0xb58d,0x141));var _0xdb58=function(_0x426ebd,_0x416f59){_0x426ebd=_0x426ebd-0x0;var _0x47f415=_0xb58d[_0x426ebd];return _0x47f415;};'use strict';var _=require(_0xdb58('0x0'));var rp=require(_0xdb58('0x1'));var md5=require(_0xdb58('0x2'));var util=require('util');var moment=require('moment');var Promise=require(_0xdb58('0x3'));var Redis=require('ioredis');var intUtil=require(_0xdb58('0x4'));var config=require('../../../../config/environment');var logger=require(_0xdb58('0x5'))(_0xdb58('0x6'));config[_0xdb58('0x7')]=_[_0xdb58('0x8')](config['redis'],{'host':_0xdb58('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x4f7440,_0x5567c7,_0x2d2918,_0x1d8472){return new Promise(function(_0x4eface,_0x40f717){var _0x1a82e3=![];var _0x2e2941={'method':_0xdb58('0xa'),'uri':_0x1d8472+_0xdb58('0xb'),'json':!![]};_0x2e2941[_0xdb58('0xc')]=_0x2d2918;logger[_0xdb58('0xd')](_0xdb58('0xe'));return rp(_0x2e2941)[_0xdb58('0xf')](function(_0x53a6fd){if(_0x53a6fd){var _0x43a284=_0x53a6fd[_0xdb58('0x10')];var _0x2f79b5=null;for(_0x2f79b5=0x0;_0x2f79b5<_0x43a284[_0xdb58('0x11')];_0x2f79b5++){if(_0x43a284[_0x2f79b5][_0xdb58('0x12')]===_0x4f7440[_0xdb58('0x13')]){_0x4f7440[_0xdb58('0x14')]=_0x43a284[_0x2f79b5]['id'];_0x1a82e3=!![];}}if(_0x1a82e3){logger[_0xdb58('0xd')](_0xdb58('0x15'),_0x4f7440['adminId']);_0x4eface(_0x4f7440);}else{_0x40f717({'statusCode':0x194,'message':_0xdb58('0x16')});}}else{_0x40f717({'statusCode':0x194,'message':_0xdb58('0x16')});}})['catch'](function(_0x4baf56){logger[_0xdb58('0x17')]('['+[_0x5567c7[_0xdb58('0x18')]()]+']',_0x4baf56[_0xdb58('0x19')]);_0x40f717(_0x4baf56);});});}function getUser(_0x1cb2b8,_0x4b7882,_0x3bc697){return function(_0x9218a2){return new Promise(function(_0x4844e4,_0x28c757){var _0x22fbde={'method':_0xdb58('0xa'),'uri':_0x3bc697+_0xdb58('0xb'),'json':!![]};_0x22fbde[_0xdb58('0xc')]=_0x4b7882;logger['info']('Getting\x20user\x20list');return rp(_0x22fbde)[_0xdb58('0xf')](function(_0x277f91){if(_0x277f91){var _0x4aae64=_0x277f91[_0xdb58('0x10')];var _0x455860=![];var _0x25c306=null;if(_0x9218a2['agentEmail']!==null){logger[_0xdb58('0xd')](_0xdb58('0x1a'),_0x9218a2['agentEmail']);_0x9218a2[_0xdb58('0x1b')]=_0x9218a2[_0xdb58('0x1c')];for(_0x25c306=0x0;_0x25c306<_0x4aae64[_0xdb58('0x11')];_0x25c306++){if(_0x4aae64[_0x25c306][_0xdb58('0x12')]===_0x9218a2[_0xdb58('0x1c')]){_0x455860=!![];_0x9218a2[_0xdb58('0x1d')]=_0x4aae64[_0x25c306]['id'];logger['info']('User\x20found:',_0x9218a2['userId']);}}}if(!_0x455860){logger[_0xdb58('0xd')](_0xdb58('0x1e'));_0x9218a2[_0xdb58('0x1b')]=_0x9218a2['adminEmail'];_0x9218a2['userId']=_0x9218a2[_0xdb58('0x14')];_0x455860=!![];}if(_0x455860){_0x4844e4(_0x9218a2);}else{_0x28c757({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x28c757({'statusCode':0x194,'message':_0xdb58('0x16')});}})['catch'](function(_0xcb68d7){logger['error']('['+[_0x1cb2b8[_0xdb58('0x18')]()]+']',_0xcb68d7['message']);_0x28c757(_0xcb68d7);});});};}function getEndUser(_0x3bda32,_0x4babd5,_0x4e9514){return function(_0x465d46){return new Promise(function(_0x3b349a,_0x28d283){var _0xa5af8a=0x0;var _0x1900dc={'method':'GET','uri':_0x4e9514+_0xdb58('0x1f'),'json':!![]};_0x1900dc[_0xdb58('0xc')]=_0x4babd5;logger[_0xdb58('0xd')](_0xdb58('0x20'));return rp(_0x1900dc)[_0xdb58('0xf')](function(_0x143519){_0x143519['filters'][_0xdb58('0x21')](function(_0x4daf4d){if(_0x4daf4d['name']==='All\x20Contacts'){_0xa5af8a=_0x4daf4d['id'];}});})[_0xdb58('0xf')](function(){logger['info'](_0xdb58('0x22'));var _0x5cfaf4={'method':'GET','uri':_0x4e9514+_0xdb58('0x23')+_0xa5af8a,'json':!![]};_0x5cfaf4[_0xdb58('0xc')]=_0x4babd5;return rp(_0x5cfaf4);})[_0xdb58('0xf')](function(_0x2b1fe1){logger[_0xdb58('0xd')](_0xdb58('0x24'),_0x465d46['contactNumber']);if(_0x2b1fe1[_0xdb58('0x25')][_0xdb58('0x11')]>0x0){var _0x22e200=_['find'](_0x2b1fe1[_0xdb58('0x25')],function(_0x54b00e){if(_0x54b00e[_0xdb58('0x26')]===_0x465d46[_0xdb58('0x27')]||_0x54b00e[_0xdb58('0x28')]===_0x465d46[_0xdb58('0x27')]){return _0x54b00e;}});if(_0x22e200){_0x465d46[_0xdb58('0x29')]=_0x22e200['id'];logger[_0xdb58('0xd')](_0xdb58('0x2a'),_0x465d46['endUserId']);_0x3b349a(_0x465d46);}else{return createEndUser(_0x465d46,_0x3bda32,_0x4babd5,_0x4e9514)[_0xdb58('0xf')](function(_0x10258b){logger[_0xdb58('0xd')](_0xdb58('0x2b'),_0x465d46['endUserId']);_0x3b349a(_0x10258b);});}}else{return createEndUser(_0x465d46,_0x3bda32,_0x4babd5,_0x4e9514)[_0xdb58('0xf')](function(_0x3800b3){logger[_0xdb58('0xd')](_0xdb58('0x2b'),_0x465d46['endUserId']);_0x3b349a(_0x3800b3);});}})[_0xdb58('0x2c')](function(_0x11a222){throw new Error(_0x11a222['message']);});});};}function createEndUser(_0x432130,_0x336fb5,_0x2126cd,_0x3a545d){return new Promise(function(_0x3d63f7,_0x380a6d){var _0x520e6b=moment();var _0x2a40e6={'method':_0xdb58('0x2d'),'uri':_0x3a545d+_0xdb58('0x2e'),'body':{'contact':{'last_name':_0x432130['contactNumber'],'work_number':_0x432130[_0xdb58('0x27')],'mobile_number':_0x432130[_0xdb58('0x27')],'owner_id':_0x432130[_0xdb58('0x1d')],'created_at':_0x520e6b[_0xdb58('0x2f')](_0xdb58('0x30'))}},'json':!![]};_0x2a40e6[_0xdb58('0xc')]=_0x2126cd;logger[_0xdb58('0xd')](_0xdb58('0x31'));return rp(_0x2a40e6)['then'](function(_0x2ddbfb){_0x432130[_0xdb58('0x29')]=_0x2ddbfb[_0xdb58('0x32')]['id'];_0x3d63f7(_0x432130);})[_0xdb58('0x2c')](function(_0x201719){logger['error']('['+[_0x336fb5[_0xdb58('0x18')]()]+']',_0x201719[_0xdb58('0x19')]);_0x380a6d(_0x201719[_0xdb58('0x19')]);});});}function getTicket(_0x48f69d,_0x536ab4,_0x22ec65,_0x18d18c,_0x362043){return function(_0x3da8e5){logger[_0xdb58('0xd')]('Creating\x20new\x20task');return new Promise(function(_0x459b69,_0xe58d24){var _0x48c9b5=moment();var _0x3ce7dd={'method':_0xdb58('0x2d'),'uri':_0x22ec65+'/api/tasks','body':{'title':intUtil['getString'](_0x18d18c[_0xdb58('0x33')],_0x362043,'\x20'),'description':intUtil[_0xdb58('0x34')](_0x18d18c['Descriptions'],_0x362043,'\x0a'),'owner_id':_0x3da8e5[_0xdb58('0x1d')],'creater_id':_0x3da8e5[_0xdb58('0x14')],'targetable_id':_0x3da8e5['endUserId'],'targetable_type':'Contact','created_at':_0x48c9b5[_0xdb58('0x2f')](_0xdb58('0x30')),'due_date':_0x48c9b5[_0xdb58('0x35')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3ce7dd[_0xdb58('0xc')]=_0x536ab4;return rp(_0x3ce7dd)[_0xdb58('0xf')](function(_0x2f257f){_0x3da8e5[_0xdb58('0x36')]=_0x2f257f[_0xdb58('0x37')]['id'];logger['info'](_0xdb58('0x38'),_0x3da8e5[_0xdb58('0x36')]);_0x459b69(_0x3da8e5);})[_0xdb58('0x2c')](function(_0x490b53){logger[_0xdb58('0x17')]('['+[_0x48f69d[_0xdb58('0x18')]()]+']',_0x490b53[_0xdb58('0x19')]);_0xe58d24(_0x490b53[_0xdb58('0x19')]);});});};}function emit(_0x3fd7b6,_0x46c0c7,_0x696db6){var _0x56eb05={'uri':_0x3fd7b6+'/contacts/'+_0x696db6};io['to'](util[_0xdb58('0x2f')](_0xdb58('0x39'),_0x46c0c7))['emit']('trigger:browser:url',_0x56eb05);}exports['cs']=function(_0x21252f,_0x36148a,_0x3320e4,_0x57aacf,_0x376690,_0x56458c,_0x2a5eff,_0x2a9f7e){var _0x544f8c={};var _0x3332c8={'Authorization':_0xdb58('0x3a')+_0x56458c[_0xdb58('0x3b')]};_0x56458c[_0xdb58('0x3c')]=intUtil[_0xdb58('0x3d')](_0x56458c['remoteUri']);_0x56458c['serverUrl']=intUtil[_0xdb58('0x3d')](_0x56458c[_0xdb58('0x3e')]);var _0x52d67b=_0x56458c[_0xdb58('0x3c')];_0x544f8c[_0xdb58('0x13')]=_0x56458c[_0xdb58('0x3f')];_0x544f8c['contactNumber']=_0x2a9f7e[_0xdb58('0x40')]()===_0xdb58('0x41')?_0x36148a[_0xdb58('0x42')]:_0x36148a['calleridnum'];_0x544f8c['callDirection']=_0x2a9f7e===_0xdb58('0x43')||_0x2a9f7e==='unmanaged'?'queue':'outbound';if(_0x57aacf){_0x544f8c['agentEmail']=_0x57aacf[_0xdb58('0x12')];}var _0x59aff5=util['format'](_0xdb58('0x44'),_0x56458c[_0xdb58('0x3e')],_0x36148a[_0xdb58('0x45')],md5(_0x36148a[_0xdb58('0x45')]));if(_0x376690&&_0x376690[_0xdb58('0x46')]){logger[_0xdb58('0xd')](_0xdb58('0x47'),_0xdb58('0x48'));_0x36148a[_0xdb58('0x49')]=_0x59aff5;}else if(_0x2a5eff&&_0x2a5eff['recordingFormat']&&_0x2a5eff[_0xdb58('0x4a')]!==_0xdb58('0x4b')){logger['info'](_0xdb58('0x4c'),_0xdb58('0x48'));_0x36148a[_0xdb58('0x49')]=_0x59aff5;}else{_0x36148a[_0xdb58('0x49')]='';}return getAdminId(_0x544f8c,_0x2a9f7e,_0x3332c8,_0x52d67b)[_0xdb58('0xf')](getUser(_0x2a9f7e,_0x3332c8,_0x52d67b))[_0xdb58('0xf')](getEndUser(_0x2a9f7e,_0x3332c8,_0x52d67b))[_0xdb58('0xf')](getTicket(_0x2a9f7e,_0x3332c8,_0x52d67b,_0x3320e4,_0x36148a))[_0xdb58('0xf')](function(_0x39fa08){logger[_0xdb58('0xd')](util[_0xdb58('0x2f')](_0xdb58('0x4d'),_0x39fa08['ticketId']));if(_0x2a9f7e!==_0xdb58('0x4e')){logger[_0xdb58('0xd')]('['+[_0x2a9f7e[_0xdb58('0x18')]()]+']',_0xdb58('0x4f'));emit(_0x52d67b,_0x57aacf['name'],_0x39fa08[_0xdb58('0x29')]);}})[_0xdb58('0x2c')](function(_0x15d7b8){logger[_0xdb58('0x17')]('['+[_0x2a9f7e[_0xdb58('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x15d7b8,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8c85=['adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','error','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','GET','then','filters','forEach','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','find','contacts','work_number','contactNumber','mobile_number','endUserId','Contact\x20created:','catch','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','toUpperCase','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','calleridnum','unmanaged','queue','outbound','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','Getting\x20admin\x20information','users','length','email'];(function(_0x8a30cf,_0x40f19b){var _0x20f439=function(_0x157a5d){while(--_0x157a5d){_0x8a30cf['push'](_0x8a30cf['shift']());}};_0x20f439(++_0x40f19b);}(_0x8c85,0x158));var _0x58c8=function(_0x423231,_0x3927cc){_0x423231=_0x423231-0x0;var _0x15d340=_0x8c85[_0x423231];return _0x15d340;};'use strict';var _=require(_0x58c8('0x0'));var rp=require(_0x58c8('0x1'));var md5=require(_0x58c8('0x2'));var util=require('util');var moment=require(_0x58c8('0x3'));var Promise=require(_0x58c8('0x4'));var Redis=require(_0x58c8('0x5'));var intUtil=require(_0x58c8('0x6'));var config=require(_0x58c8('0x7'));var logger=require(_0x58c8('0x8'))(_0x58c8('0x9'));config[_0x58c8('0xa')]=_[_0x58c8('0xb')](config[_0x58c8('0xa')],{'host':_0x58c8('0xc'),'port':0x18eb});var io=require(_0x58c8('0xd'))(new Redis(config['redis']));function getAdminId(_0x23a3f1,_0x5ac280,_0x133858,_0xdcb58b){return new Promise(function(_0x5c8001,_0xa8c49){var _0x4a5caa=![];var _0x81a69a={'method':'GET','uri':_0xdcb58b+_0x58c8('0xe'),'json':!![]};_0x81a69a[_0x58c8('0xf')]=_0x133858;logger['info'](_0x58c8('0x10'));return rp(_0x81a69a)['then'](function(_0x443b01){if(_0x443b01){var _0x125240=_0x443b01[_0x58c8('0x11')];var _0x119ae3=null;for(_0x119ae3=0x0;_0x119ae3<_0x125240[_0x58c8('0x12')];_0x119ae3++){if(_0x125240[_0x119ae3][_0x58c8('0x13')]===_0x23a3f1[_0x58c8('0x14')]){_0x23a3f1['adminId']=_0x125240[_0x119ae3]['id'];_0x4a5caa=!![];}}if(_0x4a5caa){logger[_0x58c8('0x15')](_0x58c8('0x16'),_0x23a3f1[_0x58c8('0x17')]);_0x5c8001(_0x23a3f1);}else{_0xa8c49({'statusCode':0x194,'message':_0x58c8('0x18')});}}else{_0xa8c49({'statusCode':0x194,'message':_0x58c8('0x18')});}})['catch'](function(_0x5b8682){logger[_0x58c8('0x19')]('['+[_0x5ac280['toUpperCase']()]+']',_0x5b8682[_0x58c8('0x1a')]);_0xa8c49(_0x5b8682);});});}function getUser(_0x7a5a4b,_0x36a588,_0x2da3a0){return function(_0x1fdaa2){return new Promise(function(_0x26ad7f,_0x271c35){var _0x4452f1={'method':'GET','uri':_0x2da3a0+_0x58c8('0xe'),'json':!![]};_0x4452f1[_0x58c8('0xf')]=_0x36a588;logger[_0x58c8('0x15')]('Getting\x20user\x20list');return rp(_0x4452f1)['then'](function(_0x2a329b){if(_0x2a329b){var _0x31124f=_0x2a329b[_0x58c8('0x11')];var _0x31e9b6=![];var _0x106b71=null;if(_0x1fdaa2[_0x58c8('0x1b')]!==null){logger[_0x58c8('0x15')](_0x58c8('0x1c'),_0x1fdaa2['agentEmail']);_0x1fdaa2[_0x58c8('0x1d')]=_0x1fdaa2['agentEmail'];for(_0x106b71=0x0;_0x106b71<_0x31124f[_0x58c8('0x12')];_0x106b71++){if(_0x31124f[_0x106b71][_0x58c8('0x13')]===_0x1fdaa2[_0x58c8('0x1b')]){_0x31e9b6=!![];_0x1fdaa2[_0x58c8('0x1e')]=_0x31124f[_0x106b71]['id'];logger['info'](_0x58c8('0x1f'),_0x1fdaa2[_0x58c8('0x1e')]);}}}if(!_0x31e9b6){logger[_0x58c8('0x15')]('Admin\x20selected');_0x1fdaa2[_0x58c8('0x1d')]=_0x1fdaa2[_0x58c8('0x14')];_0x1fdaa2[_0x58c8('0x1e')]=_0x1fdaa2[_0x58c8('0x17')];_0x31e9b6=!![];}if(_0x31e9b6){_0x26ad7f(_0x1fdaa2);}else{_0x271c35({'statusCode':0x194,'message':_0x58c8('0x18')});}}else{_0x271c35({'statusCode':0x194,'message':_0x58c8('0x18')});}})['catch'](function(_0x19c043){logger[_0x58c8('0x19')]('['+[_0x7a5a4b['toUpperCase']()]+']',_0x19c043[_0x58c8('0x1a')]);_0x271c35(_0x19c043);});});};}function getEndUser(_0x1c146d,_0xab2c72,_0x4c962d){return function(_0x5b7374){return new Promise(function(_0x48b777,_0x27a231){var _0x41e12f=0x0;var _0x53c86a={'method':_0x58c8('0x20'),'uri':_0x4c962d+'/api/contacts/filters','json':!![]};_0x53c86a[_0x58c8('0xf')]=_0xab2c72;logger[_0x58c8('0x15')]('Getting\x20contacts\x20filter');return rp(_0x53c86a)[_0x58c8('0x21')](function(_0x1b5535){_0x1b5535[_0x58c8('0x22')][_0x58c8('0x23')](function(_0x2f5f41){if(_0x2f5f41['name']===_0x58c8('0x24')){_0x41e12f=_0x2f5f41['id'];}});})[_0x58c8('0x21')](function(){logger['info'](_0x58c8('0x25'));var _0x3de9e8={'method':_0x58c8('0x20'),'uri':_0x4c962d+_0x58c8('0x26')+_0x41e12f,'json':!![]};_0x3de9e8[_0x58c8('0xf')]=_0xab2c72;return rp(_0x3de9e8);})['then'](function(_0xeaf85d){logger['info'](_0x58c8('0x27'),_0x5b7374['contactNumber']);if(_0xeaf85d['contacts'][_0x58c8('0x12')]>0x0){var _0x15ee77=_[_0x58c8('0x28')](_0xeaf85d[_0x58c8('0x29')],function(_0xb25242){if(_0xb25242[_0x58c8('0x2a')]===_0x5b7374[_0x58c8('0x2b')]||_0xb25242[_0x58c8('0x2c')]===_0x5b7374[_0x58c8('0x2b')]){return _0xb25242;}});if(_0x15ee77){_0x5b7374[_0x58c8('0x2d')]=_0x15ee77['id'];logger[_0x58c8('0x15')]('Contact\x20found:',_0x5b7374[_0x58c8('0x2d')]);_0x48b777(_0x5b7374);}else{return createEndUser(_0x5b7374,_0x1c146d,_0xab2c72,_0x4c962d)[_0x58c8('0x21')](function(_0x1fa59f){logger[_0x58c8('0x15')]('Contact\x20created:',_0x5b7374['endUserId']);_0x48b777(_0x1fa59f);});}}else{return createEndUser(_0x5b7374,_0x1c146d,_0xab2c72,_0x4c962d)[_0x58c8('0x21')](function(_0x4dc19f){logger[_0x58c8('0x15')](_0x58c8('0x2e'),_0x5b7374[_0x58c8('0x2d')]);_0x48b777(_0x4dc19f);});}})[_0x58c8('0x2f')](function(_0x1930c9){throw new Error(_0x1930c9['message']);});});};}function createEndUser(_0xd6f4d0,_0x179cbf,_0x1d567e,_0x307f8d){return new Promise(function(_0x55f294,_0x3361d8){var _0x3e723a=moment();var _0x22e0b0={'method':'POST','uri':_0x307f8d+_0x58c8('0x30'),'body':{'contact':{'last_name':_0xd6f4d0[_0x58c8('0x2b')],'work_number':_0xd6f4d0[_0x58c8('0x2b')],'mobile_number':_0xd6f4d0[_0x58c8('0x2b')],'owner_id':_0xd6f4d0[_0x58c8('0x1e')],'created_at':_0x3e723a[_0x58c8('0x31')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x22e0b0[_0x58c8('0xf')]=_0x1d567e;logger[_0x58c8('0x15')](_0x58c8('0x32'));return rp(_0x22e0b0)[_0x58c8('0x21')](function(_0x16e592){_0xd6f4d0[_0x58c8('0x2d')]=_0x16e592[_0x58c8('0x33')]['id'];_0x55f294(_0xd6f4d0);})['catch'](function(_0x292de9){logger[_0x58c8('0x19')]('['+[_0x179cbf['toUpperCase']()]+']',_0x292de9[_0x58c8('0x1a')]);_0x3361d8(_0x292de9[_0x58c8('0x1a')]);});});}function getTicket(_0x434f1c,_0x18ccb2,_0x473be8,_0x5b4e41,_0x5b82af){return function(_0x4c6c81){logger['info'](_0x58c8('0x34'));return new Promise(function(_0x292cbd,_0x5928b1){var _0x2d3b69=moment();var _0x3b38f0={'method':_0x58c8('0x35'),'uri':_0x473be8+_0x58c8('0x36'),'body':{'title':intUtil[_0x58c8('0x37')](_0x5b4e41[_0x58c8('0x38')],_0x5b82af,'\x20'),'description':intUtil['getString'](_0x5b4e41[_0x58c8('0x39')],_0x5b82af,'\x0a'),'owner_id':_0x4c6c81['userId'],'creater_id':_0x4c6c81['adminId'],'targetable_id':_0x4c6c81['endUserId'],'targetable_type':_0x58c8('0x3a'),'created_at':_0x2d3b69[_0x58c8('0x31')](_0x58c8('0x3b')),'due_date':_0x2d3b69[_0x58c8('0x3c')](0x1e,'m')[_0x58c8('0x31')](_0x58c8('0x3b'))},'json':!![]};_0x3b38f0[_0x58c8('0xf')]=_0x18ccb2;return rp(_0x3b38f0)[_0x58c8('0x21')](function(_0x368581){_0x4c6c81[_0x58c8('0x3d')]=_0x368581[_0x58c8('0x3e')]['id'];logger[_0x58c8('0x15')](_0x58c8('0x3f'),_0x4c6c81[_0x58c8('0x3d')]);_0x292cbd(_0x4c6c81);})['catch'](function(_0x11802d){logger[_0x58c8('0x19')]('['+[_0x434f1c[_0x58c8('0x40')]()]+']',_0x11802d[_0x58c8('0x1a')]);_0x5928b1(_0x11802d[_0x58c8('0x1a')]);});});};}function emit(_0x4d1a2d,_0x2b8037,_0x3cc111){var _0x4c0fd5={'uri':_0x4d1a2d+_0x58c8('0x41')+_0x3cc111};io['to'](util[_0x58c8('0x31')](_0x58c8('0x42'),_0x2b8037))['emit'](_0x58c8('0x43'),_0x4c0fd5);}exports['cs']=function(_0x2597f9,_0x2c1c56,_0x564e26,_0x1a0d68,_0x47adc7,_0x56a2f9,_0x18853a,_0x2db62){var _0x20fd46={};var _0x298d3a={'Authorization':_0x58c8('0x44')+_0x56a2f9[_0x58c8('0x45')]};_0x56a2f9[_0x58c8('0x46')]=intUtil[_0x58c8('0x47')](_0x56a2f9[_0x58c8('0x46')]);_0x56a2f9[_0x58c8('0x48')]=intUtil[_0x58c8('0x47')](_0x56a2f9[_0x58c8('0x48')]);var _0xa87568=_0x56a2f9['remoteUri'];_0x20fd46[_0x58c8('0x14')]=_0x56a2f9[_0x58c8('0x49')];_0x20fd46['contactNumber']=_0x2db62[_0x58c8('0x4a')]()==='outbound'?_0x2c1c56['destcalleridnum']:_0x2c1c56[_0x58c8('0x4b')];_0x20fd46['callDirection']=_0x2db62==='queue'||_0x2db62===_0x58c8('0x4c')?_0x58c8('0x4d'):_0x58c8('0x4e');if(_0x1a0d68){_0x20fd46[_0x58c8('0x1b')]=_0x1a0d68[_0x58c8('0x13')];}var _0x21c55d=util[_0x58c8('0x31')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56a2f9[_0x58c8('0x48')],_0x2c1c56[_0x58c8('0x4f')],md5(_0x2c1c56[_0x58c8('0x4f')]));if(_0x47adc7&&_0x47adc7[_0x58c8('0x50')]){logger[_0x58c8('0x15')](_0x58c8('0x51'),'Recording\x20is\x20enabled!');_0x2c1c56['recordingURL']=_0x21c55d;}else if(_0x18853a&&_0x18853a[_0x58c8('0x52')]&&_0x18853a[_0x58c8('0x52')]!==_0x58c8('0x53')){logger['info'](_0x58c8('0x54'),_0x58c8('0x55'));_0x2c1c56[_0x58c8('0x56')]=_0x21c55d;}else{_0x2c1c56[_0x58c8('0x56')]='';}return getAdminId(_0x20fd46,_0x2db62,_0x298d3a,_0xa87568)[_0x58c8('0x21')](getUser(_0x2db62,_0x298d3a,_0xa87568))[_0x58c8('0x21')](getEndUser(_0x2db62,_0x298d3a,_0xa87568))[_0x58c8('0x21')](getTicket(_0x2db62,_0x298d3a,_0xa87568,_0x564e26,_0x2c1c56))[_0x58c8('0x21')](function(_0x178875){logger[_0x58c8('0x15')](util[_0x58c8('0x31')](_0x58c8('0x57'),_0x178875[_0x58c8('0x3d')]));if(_0x2db62!==_0x58c8('0x4c')){logger['info']('['+[_0x2db62['toUpperCase']()]+']',_0x58c8('0x58'));emit(_0xa87568,_0x1a0d68[_0x58c8('0x59')],_0x178875[_0x58c8('0x2d')]);}})[_0x58c8('0x2f')](function(_0x5e3072){logger[_0x58c8('0x19')]('['+[_0x2db62[_0x58c8('0x40')]()]+_0x58c8('0x5a'),util['inspect'](_0x5e3072,{'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 3909c85..e225625 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 _0x34b7=['desk','vtiger','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshsales','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x34b7,0x196));var _0x734b=function(_0x8567ae,_0x118fcf){_0x8567ae=_0x8567ae-0x0;var _0x2f9e9b=_0x34b7[_0x8567ae];return _0x2f9e9b;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x734b('0x0'));var salesforce=require(_0x734b('0x1'));var sugarcrm=require(_0x734b('0x2'));var freshdesk=require(_0x734b('0x3'));var zoho=require(_0x734b('0x4'));var desk=require(_0x734b('0x5'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x734b('0x6'));var freshsales=require(_0x734b('0x7'));var integrations=[_0x734b('0x8'),_0x734b('0x9'),_0x734b('0xa'),_0x734b('0xb'),'zoho',_0x734b('0xc'),_0x734b('0xd'),'dynamics365','freshsales','servicenow'];exports[_0x734b('0xe')]=function(_0x598dee,_0x43c5e0,_0x333738,_0x2860a2,_0x222dc7,_0x3a442b){if(_0x333738){if(_[_0x734b('0xf')](integrations,_0x598dee[_0x734b('0x10')][_0x734b('0x11')]())){try{var _0x257657=null;var _0x1e0fca='';var _0x189a82=_0x333738[_0x598dee[_0x734b('0x10')][_0x734b('0x11')]()];if(_0x189a82){var _0x1c893d=_0x189a82[_0x598dee['data2']];if(_0x1c893d){var _0x18fc18=_[_0x734b('0x12')](_0x1c893d[_0x734b('0x13')],{'id':parseInt(_0x598dee[_0x734b('0x14')],0xa)});if(_0x18fc18){if(_0x2860a2){if(_0x222dc7&&_0x43c5e0[_0x734b('0x15')]){_0x1e0fca=_0x734b('0x15');}else if(_0x43c5e0[_0x734b('0x16')]){_0x1e0fca=_0x734b('0x17');}else{console[_0x734b('0x18')](_0x734b('0x19'),_0x43c5e0);}}else{_0x1e0fca=_0x734b('0x1a');}switch(_0x598dee['data1'][_0x734b('0x11')]()){case _0x734b('0x8'):zendesk[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0x9'):salesforce[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0xa'):sugarcrm[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case'freshdesk':freshdesk[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case'zoho':zoho[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0xc'):desk[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0xd'):vtiger[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0x1b'):freshsales['cs'](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b,_0x1e0fca);break;case _0x734b('0x1c'):servicenow['cs'](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b,_0x1e0fca);break;case _0x734b('0x1d'):dynamics365['cs'](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b,_0x1e0fca);break;default:console[_0x734b('0x18')](_0x734b('0x1e'));}}else{_0x257657=require(_0x734b('0x1f'))(_0x598dee[_0x734b('0x10')][_0x734b('0x11')]());_0x257657[_0x734b('0x20')](_0x734b('0x21'),util[_0x734b('0x22')](_0x734b('0x23'),_0x598dee['data1'][_0x734b('0x11')](),_0x598dee[_0x734b('0x14')]));}}else{_0x257657=require('../../../../config/logger')(_0x598dee[_0x734b('0x10')][_0x734b('0x11')]());_0x257657[_0x734b('0x20')](_0x734b('0x21'),util[_0x734b('0x22')](_0x734b('0x24'),_0x598dee[_0x734b('0x10')][_0x734b('0x11')](),_0x598dee[_0x734b('0x25')]));}}else{}}catch(_0x3abbe6){console[_0x734b('0x20')](_0x3abbe6);}}}}; \ No newline at end of file +var _0x8603=['zendesk','salesforce','sugarcrm','freshdesk','zoho','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./dynamics365'];(function(_0x13802c,_0x15cec9){var _0x1694b6=function(_0x58aed9){while(--_0x58aed9){_0x13802c['push'](_0x13802c['shift']());}};_0x1694b6(++_0x15cec9);}(_0x8603,0x190));var _0x3860=function(_0x41aa4d,_0x51e45f){_0x41aa4d=_0x41aa4d-0x0;var _0x3fb7d6=_0x8603[_0x41aa4d];return _0x3fb7d6;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var zendesk=require(_0x3860('0x1'));var salesforce=require(_0x3860('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x3860('0x3'));var desk=require(_0x3860('0x4'));var vtiger=require(_0x3860('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x3860('0x6'));var freshsales=require('./freshsales');var integrations=[_0x3860('0x7'),_0x3860('0x8'),_0x3860('0x9'),_0x3860('0xa'),_0x3860('0xb'),'desk','vtiger','dynamics365',_0x3860('0xc'),_0x3860('0xd')];exports['exec']=function(_0x2fb169,_0x38737e,_0x5909b8,_0x101263,_0x45ba50,_0x4cd35d){if(_0x5909b8){if(_[_0x3860('0xe')](integrations,_0x2fb169[_0x3860('0xf')]['toLowerCase']())){try{var _0x405510=null;var _0x8ad61d='';var _0x2428f6=_0x5909b8[_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]()];if(_0x2428f6){var _0x21ae4e=_0x2428f6[_0x2fb169[_0x3860('0x11')]];if(_0x21ae4e){var _0x12b23b=_[_0x3860('0x12')](_0x21ae4e[_0x3860('0x13')],{'id':parseInt(_0x2fb169['data3'],0xa)});if(_0x12b23b){if(_0x101263){if(_0x45ba50&&_0x38737e[_0x3860('0x14')]){_0x8ad61d=_0x3860('0x14');}else if(_0x38737e[_0x3860('0x15')]){_0x8ad61d=_0x3860('0x16');}else{console[_0x3860('0x17')](_0x3860('0x18'),_0x38737e);}}else{_0x8ad61d=_0x3860('0x19');}switch(_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]()){case _0x3860('0x7'):zendesk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x8'):salesforce[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x9'):sugarcrm[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case'freshdesk':freshdesk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case'zoho':zoho[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x1a'):desk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x1b'):vtiger[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0xc'):freshsales['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;case'servicenow':servicenow['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;case _0x3860('0x1c'):dynamics365['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;default:console[_0x3860('0x17')](_0x3860('0x1d'));}}else{_0x405510=require(_0x3860('0x1e'))(_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]());_0x405510[_0x3860('0x1f')](_0x3860('0x20'),util[_0x3860('0x21')](_0x3860('0x22'),_0x2fb169[_0x3860('0xf')][_0x3860('0x10')](),_0x2fb169[_0x3860('0x23')]));}}else{_0x405510=require(_0x3860('0x1e'))(_0x2fb169[_0x3860('0xf')]['toLowerCase']());_0x405510[_0x3860('0x1f')](_0x3860('0x20'),util[_0x3860('0x21')](_0x3860('0x24'),_0x2fb169[_0x3860('0xf')]['toLowerCase'](),_0x2fb169[_0x3860('0x11')]));}}else{}}catch(_0x568515){console['error'](_0x568515);}}}}; \ 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 7dc0134..9c83cdf 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 _0x44b6=['Salesforce\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]','lastevent','toUpperCase','calleridnum','Fields',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','ticketType','Task','assign','utc','getString','ContactId','create','isNil','validateEmail','sobject','User','find','execute','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','Contact','Lead','contact','Case','length','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','upperFirst','string','idField','content','toString','type','variableName','Variable','name','toLowerCase','concat','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','calleridname','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','stringify','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl'];(function(_0x1d5a18,_0x585dc8){var _0x411450=function(_0x3f4ad8){while(--_0x3f4ad8){_0x1d5a18['push'](_0x1d5a18['shift']());}};_0x411450(++_0x585dc8);}(_0x44b6,0xd8));var _0x644b=function(_0x2bb452,_0x2dbbc0){_0x2bb452=_0x2bb452-0x0;var _0x5f50a6=_0x44b6[_0x2bb452];return _0x5f50a6;};'use strict';var _=require(_0x644b('0x0'));var rp=require(_0x644b('0x1'));var moment=require(_0x644b('0x2'));var BPromise=require(_0x644b('0x3'));var md5=require(_0x644b('0x4'));var jsforce=require(_0x644b('0x5'));var util=require(_0x644b('0x6'));var Redis=require(_0x644b('0x7'));var intUtil=require(_0x644b('0x8'));var config=require(_0x644b('0x9'));var logger=require(_0x644b('0xa'))(_0x644b('0xb'));config[_0x644b('0xc')]=_[_0x644b('0xd')](config[_0x644b('0xc')],{'host':_0x644b('0xe'),'port':0x18eb});var io=require(_0x644b('0xf'))(new Redis(config['redis']));function emit(_0x3fa4bd,_0x148a13,_0x3083c9){io['to'](_0x3fa4bd)['emit'](_0x148a13,_0x3083c9);}function getTicket(_0x3ce1f8,_0x57adce,_0x4dbc06,_0x22b58a,_0xb60208,_0x301a5e,_0x2f9d57,_0x3562dd){var _0x121ff1={};if(_0x22b58a[_0x644b('0x10')]===_0x644b('0x11')){_0x121ff1=Object[_0x644b('0x12')]({},{'OwnerId':_0x57adce['id'],'ActivityDate':moment[_0x644b('0x13')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x22b58a['Subjects'],_0xb60208,'\x20'),'Description':intUtil[_0x644b('0x14')](_0x22b58a['Descriptions'],_0xb60208,'\x0a')},getCustomFields(_0x301a5e,_0xb60208));if(_0x4dbc06){_0x121ff1['WhoId']=_0x4dbc06['id'];}}else if(_0x22b58a[_0x644b('0x10')]==='Case'){_0x121ff1=Object[_0x644b('0x12')]({},{'OwnerId':_0x57adce['id'],'Subject':intUtil[_0x644b('0x14')](_0x22b58a['Subjects'],_0xb60208,'\x20'),'Description':intUtil['getString'](_0x22b58a['Descriptions'],_0xb60208,'\x0a')},getCustomFields(_0x301a5e,_0xb60208));if(_0x4dbc06){_0x121ff1[_0x644b('0x15')]=_0x4dbc06['id'];}}return _0x2f9d57['sobject'](_0x22b58a[_0x644b('0x10')])[_0x644b('0x16')](_0x121ff1);}function getUser(_0x489e69,_0x4d0a34,_0x172014){if(!_[_0x644b('0x17')](_0x4d0a34)&&intUtil[_0x644b('0x18')](_0x4d0a34)){var _0x2ae855={'Email':_0x4d0a34};var _0x1f4476={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x172014[_0x644b('0x19')](_0x644b('0x1a'))[_0x644b('0x1b')](_0x2ae855,_0x1f4476)[_0x644b('0x1c')]()['then'](function(_0x4a13ef){if(_0x4a13ef['length']){var _0x4a32a6=_[_0x644b('0x1b')](_0x4a13ef,function(_0x5c8134){return _0x5c8134[_0x644b('0x1d')]===_0x4d0a34;});if(_0x4a32a6){logger[_0x644b('0x1e')]('Agent\x20%s\x20found.',_0x4d0a34);return BPromise[_0x644b('0x1f')]({'id':_0x4a32a6['Id'],'name':_0x4a32a6[_0x644b('0x20')]});}}else{logger['info'](_0x644b('0x21'),_0x4d0a34);return _0x172014[_0x644b('0x22')]()[_0x644b('0x23')](function(_0x2b75bb){return BPromise[_0x644b('0x1f')]({'id':_0x2b75bb[_0x644b('0x24')],'name':_0x2b75bb[_0x644b('0x25')]});});}});}else{logger[_0x644b('0x1e')](_0x644b('0x21'),_0x4d0a34);return _0x172014[_0x644b('0x22')]()[_0x644b('0x23')](function(_0x511881){return BPromise['resolve']({'id':_0x511881[_0x644b('0x24')],'name':_0x511881[_0x644b('0x25')]});});}}function getEndUser(_0x1bbdd7,_0x2068c7,_0x2b0be3,_0x5b845c,_0x405f55){var _0x284e4e={'Phone':_0x5b845c};var _0x272445={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x644b('0x1f')]()['then'](function(){if(_0x2068c7[_0x644b('0x10')]===_0x644b('0x11')){logger[_0x644b('0x1e')](_0x644b('0x26'),_0x5b845c,_0x2068c7['moduleSearch']);switch(_0x2068c7['moduleSearch']){case _0x644b('0x27'):return _0x405f55[_0x644b('0x19')](_0x644b('0x28'))[_0x644b('0x1b')](_0x284e4e,_0x272445)[_0x644b('0x1c')]()[_0x644b('0x23')](function(_0x2b02cd){if(_0x2b02cd&&_0x2b02cd['length']){return _0x2b02cd;}else{return _0x405f55[_0x644b('0x19')](_0x644b('0x29'))[_0x644b('0x1b')](_0x284e4e,_0x272445);}});case _0x644b('0x2a'):return _0x405f55['sobject'](_0x644b('0x28'))[_0x644b('0x1b')](_0x284e4e,_0x272445)[_0x644b('0x1c')]();case'lead':return _0x405f55['sobject'](_0x644b('0x29'))['find'](_0x284e4e,_0x272445);default:return null;}}else if(_0x2068c7[_0x644b('0x10')]===_0x644b('0x2b')){logger[_0x644b('0x1e')](_0x644b('0x26'),_0x5b845c,'contact');return _0x405f55['sobject'](_0x644b('0x28'))[_0x644b('0x1b')](_0x284e4e,_0x272445)['execute']();}})['then'](function(_0x2723d9){if(_0x2723d9&&_0x2723d9[_0x644b('0x2c')]){var _0x146dfb=_[_0x644b('0x1b')](_0x2723d9,function(_0x3e509a){return _0x3e509a[_0x644b('0x2d')]===_0x5b845c;});if(_0x146dfb){return BPromise[_0x644b('0x1f')]({'id':_0x146dfb['Id'],'name':_0x146dfb[_0x644b('0x20')],'phone':_0x146dfb[_0x644b('0x2d')]});}}})[_0x644b('0x23')](function(_0x46eff3){if(_0x46eff3){logger[_0x644b('0x1e')](_0x644b('0x2e'),_0x5b845c);return BPromise['resolve'](_0x46eff3);}else{logger[_0x644b('0x1e')](_0x644b('0x2f'),_0x5b845c);var _0x587377={'LastName':_0x2b0be3!==''?_0x2b0be3:util['format'](_0x644b('0x30'),_0x5b845c),'Phone':_0x5b845c};if(_0x2068c7[_0x644b('0x31')]){if(_0x2068c7[_0x644b('0x31')]===_0x644b('0x2a')){logger[_0x644b('0x1e')](_0x644b('0x32'),_0x5b845c,_0x2068c7[_0x644b('0x31')]);}else if(_0x2068c7[_0x644b('0x31')]===_0x644b('0x33')&&_0x2068c7[_0x644b('0x10')]===_0x644b('0x11')){logger[_0x644b('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5b845c,_0x2068c7[_0x644b('0x31')]);_0x587377[_0x644b('0x34')]='No\x20Company';}else{return null;}}return _0x405f55['sobject'](_[_0x644b('0x35')](_0x2068c7[_0x644b('0x31')]))[_0x644b('0x16')](_0x587377);}});}function getCustomFields(_0x189fdc,_0x1f0477){var _0x9c7fa9={};if(_0x189fdc[_0x644b('0x2c')]>0x0){_['forEach'](_0x189fdc,function(_0x1ae53c){if(_0x1ae53c['type']===_0x644b('0x36')&&_0x1ae53c[_0x644b('0x37')]){_0x9c7fa9[_0x1ae53c['idField']]=_0x1ae53c[_0x644b('0x38')][_0x644b('0x39')]();}else if(_0x1ae53c[_0x644b('0x3a')]==='variable'&&_0x1ae53c['variableName']&&_0x1ae53c[_0x644b('0x37')]){_0x1f0477[_0x1ae53c[_0x644b('0x3b')]]&&(_0x9c7fa9[_0x1ae53c['idField']]=_0x1f0477[_0x1ae53c[_0x644b('0x3b')]][_0x644b('0x39')]());}else if(_0x1ae53c[_0x644b('0x3a')]==='customVariable'&&_0x1ae53c[_0x644b('0x3c')]&&_0x1ae53c['Variable'][_0x644b('0x3d')]&&_0x1ae53c['idField']){_0x1f0477[_0x1ae53c['Variable'][_0x644b('0x3d')][_0x644b('0x3e')]()]&&(_0x9c7fa9[_0x1ae53c[_0x644b('0x37')]]=_0x1f0477[_0x1ae53c[_0x644b('0x3c')][_0x644b('0x3d')][_0x644b('0x3e')]()][_0x644b('0x39')]());}});}return _0x9c7fa9;}function getConnection(_0x5c791e){var _0x363730=_0x5c791e['password'][_0x644b('0x3f')](_0x5c791e['securityToken']);var _0x1fa65c=new jsforce[(_0x644b('0x40'))]({'oauth2':{'loginUrl':_0x5c791e[_0x644b('0x41')]||_0x644b('0x42'),'clientId':_0x5c791e[_0x644b('0x43')],'clientSecret':_0x5c791e['clientSecret']}});return _0x1fa65c[_0x644b('0x44')](_0x5c791e[_0x644b('0x45')],_0x363730)[_0x644b('0x23')](function(){logger[_0x644b('0x1e')](_0x644b('0x46'));return _0x1fa65c;});}exports[_0x644b('0x47')]=function(_0x49787a,_0xd213ce,_0x22ee42,_0x316f0f,_0x51ecb5,_0x85df9e){var _0x584b08,_0x254db2,_0x37e29a,_0x59e357;_0x85df9e['serverUrl']=intUtil[_0x644b('0x48')](_0x85df9e['serverUrl']);_0x85df9e['remoteUri']=intUtil[_0x644b('0x48')](_0x85df9e[_0x644b('0x41')]);if(_0x51ecb5&&_0x51ecb5['monitor_format']){logger[_0x644b('0x1e')](_0x644b('0x49'),_0x644b('0x4a'));_0xd213ce[_0x644b('0x4b')]=util[_0x644b('0x4c')](_0x644b('0x4d'),_0x85df9e[_0x644b('0x4e')],_0xd213ce[_0x644b('0x4f')],md5(_0xd213ce[_0x644b('0x4f')]));}else{_0xd213ce[_0x644b('0x4b')]='';}return getConnection(_0x85df9e)[_0x644b('0x23')](function(_0xde0dcf){_0x59e357=_0xde0dcf;return getUser(_0x85df9e,_0x316f0f['email'],_0x59e357);})['then'](function(_0x318957){_0x584b08=_0x318957;return getEndUser(_0x85df9e,_0x22ee42,_0xd213ce[_0x644b('0x50')],_0xd213ce['calleridnum'],_0x59e357);})[_0x644b('0x23')](function(_0x2c23ed){_0x254db2=_0x2c23ed;return getTicket(_0x85df9e,_0x584b08,_0x254db2,_0x22ee42,_0xd213ce,_0x22ee42['Fields'],_0x59e357,'queue');})[_0x644b('0x23')](function(_0x3fa6d8){_0x37e29a=_0x3fa6d8;logger[_0x644b('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x37e29a['id']);logger[_0x644b('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x37e29a['id'],_0x316f0f[_0x644b('0x3d')],_0x85df9e[_0x644b('0x3a')]);switch(_0x85df9e[_0x644b('0x3a')]){case _0x644b('0x51'):emit(util[_0x644b('0x4c')](_0x644b('0x52'),_0x316f0f['name']),_0x644b('0x53'),{'recordId':_0x37e29a['id']});break;case _0x644b('0x54'):emit(util[_0x644b('0x4c')](_0x644b('0x52'),_0x316f0f[_0x644b('0x3d')]),_0x644b('0x55'),{'uri':util[_0x644b('0x4c')](_0x644b('0x56'),_0x59e357['instanceUrl'],_0x37e29a['id'])});break;default:logger[_0x644b('0x57')](_0x644b('0x58'));}})['catch'](function(_0x308746){logger[_0x644b('0x57')](_0x644b('0x49'),JSON[_0x644b('0x59')](_0x308746));});};exports[_0x644b('0x5a')]=function(_0x533177,_0x55dec3,_0x3b76e6,_0x1a5b92,_0x369225,_0x5a36b2,_0x25f9c1){var _0x3c8f5c,_0x53fc28,_0x3ece4a,_0x2c19ce;_0x5a36b2[_0x644b('0x4e')]=intUtil[_0x644b('0x48')](_0x5a36b2[_0x644b('0x4e')]);_0x5a36b2['remoteUri']=intUtil[_0x644b('0x48')](_0x5a36b2[_0x644b('0x41')]);if(_0x25f9c1&&_0x25f9c1['recordingFormat']&&_0x25f9c1[_0x644b('0x5b')]!==_0x644b('0x5c')){logger['info']('[OUTBOUND]',_0x644b('0x4a'));_0x55dec3[_0x644b('0x4b')]=util[_0x644b('0x4c')](_0x644b('0x4d'),_0x5a36b2[_0x644b('0x4e')],_0x55dec3[_0x644b('0x4f')],md5(_0x55dec3[_0x644b('0x4f')]));}return getConnection(_0x5a36b2)['then'](function(_0x14cabd){_0x2c19ce=_0x14cabd;return getUser(_0x5a36b2,_0x1a5b92['email'],_0x2c19ce);})['then'](function(_0x12daba){_0x3c8f5c=_0x12daba;return getEndUser(_0x5a36b2,_0x3b76e6,_0x55dec3[_0x644b('0x5d')],_0x55dec3['destcalleridnum'],_0x2c19ce);})[_0x644b('0x23')](function(_0x27a5b3){_0x53fc28=_0x27a5b3;return getTicket(_0x5a36b2,_0x3c8f5c,_0x53fc28,_0x3b76e6,_0x55dec3,_0x3b76e6['Fields'],_0x2c19ce,_0x644b('0x5a'));})[_0x644b('0x23')](function(_0x3bff6a){_0x3ece4a=_0x3bff6a;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x3ece4a['id']);logger[_0x644b('0x1e')](_0x644b('0x5e'),_0x3ece4a['id'],_0x1a5b92[_0x644b('0x3d')],_0x5a36b2[_0x644b('0x3a')]);switch(_0x5a36b2[_0x644b('0x3a')]){case _0x644b('0x51'):emit(util[_0x644b('0x4c')](_0x644b('0x52'),_0x1a5b92[_0x644b('0x3d')]),_0x644b('0x53'),{'recordId':_0x3ece4a['id']});break;case _0x644b('0x54'):emit(util['format'](_0x644b('0x52'),_0x1a5b92[_0x644b('0x3d')]),_0x644b('0x55'),{'uri':util[_0x644b('0x4c')](_0x644b('0x56'),_0x2c19ce[_0x644b('0x5f')],_0x3ece4a['id'])});break;default:logger[_0x644b('0x57')]('[OUTBOUND]',_0x644b('0x60'));}})[_0x644b('0x61')](function(_0x115e12){logger[_0x644b('0x57')](_0x644b('0x62'),JSON[_0x644b('0x59')](_0x115e12));});};exports['unmanaged']=function(_0xc78a14,_0x59f480,_0x402fa6,_0xaeb235,_0x4a70d1,_0x4fde95){var _0x3f94a3,_0xee80c8,_0x605563,_0x3ae251;_0x4fde95[_0x644b('0x4e')]=intUtil['stripTrailingSlash'](_0x4fde95[_0x644b('0x4e')]);_0x4fde95[_0x644b('0x41')]=intUtil[_0x644b('0x48')](_0x4fde95[_0x644b('0x41')]);if(_0x4a70d1&&_0x4a70d1['monitor_format']){logger['info']('['+_0x59f480[_0x644b('0x63')][_0x644b('0x64')]()+']',_0x644b('0x4a'));_0x59f480[_0x644b('0x4b')]=util[_0x644b('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4fde95[_0x644b('0x4e')],_0x59f480[_0x644b('0x4f')],md5(_0x59f480['uniqueid']));}else{_0x59f480['recordingURL']='';}return getConnection(_0x4fde95)[_0x644b('0x23')](function(_0xe52e08){_0x3ae251=_0xe52e08;if(!_[_0x644b('0x17')](_0xaeb235)){return getUser(_0x4fde95,_0xaeb235[_0x644b('0x3d')],_0x3ae251);}else{return getUser(_0x4fde95,null,_0x3ae251);}})[_0x644b('0x23')](function(_0x20fcf6){_0x3f94a3=_0x20fcf6;return getEndUser(_0x4fde95,_0x402fa6,_0x59f480['calleridname'],_0x59f480[_0x644b('0x65')],_0x3ae251);})[_0x644b('0x23')](function(_0x2ded85){_0xee80c8=_0x2ded85;return getTicket(_0x4fde95,_0x3f94a3,_0xee80c8,_0x402fa6,_0x59f480,_0x402fa6[_0x644b('0x66')],_0x3ae251);})[_0x644b('0x23')](function(_0xcec1d3){_0x605563=_0xcec1d3;logger[_0x644b('0x1e')]('['+_0x59f480[_0x644b('0x63')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x605563['id']);logger['info']('['+_0x59f480[_0x644b('0x63')][_0x644b('0x64')]()+_0x644b('0x67'),_0x4fde95['type']);})[_0x644b('0x61')](function(_0x123560){logger[_0x644b('0x57')]('['+_0x59f480[_0x644b('0x63')]['toUpperCase']()+']',JSON[_0x644b('0x59')](_0x123560));});}; \ No newline at end of file +var _0x5e1b=['Connection','remoteUri','https://login.salesforce.com','login','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','user:%s','%s/%s/e','instanceUrl','error','outbound','recordingFormat','none','[OUTBOUND]','trigger:salesforce:display','trigger:browser:url','unmanaged','lastevent','toUpperCase','isNil',']\x20Integration\x20account\x20type\x20%s.','catch','stringify','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','assign','getString','Subjects','Descriptions','WhoId','ContactId','sobject','create','User','find','execute','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','Lead','contact','lead','Case','length','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','securityToken'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x5e1b,0xfc));var _0xb5e1=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5e1b[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xb5e1('0x0'));var rp=require(_0xb5e1('0x1'));var moment=require(_0xb5e1('0x2'));var BPromise=require(_0xb5e1('0x3'));var md5=require('md5');var jsforce=require(_0xb5e1('0x4'));var util=require(_0xb5e1('0x5'));var Redis=require(_0xb5e1('0x6'));var intUtil=require('./util');var config=require(_0xb5e1('0x7'));var logger=require(_0xb5e1('0x8'))(_0xb5e1('0x9'));config[_0xb5e1('0xa')]=_[_0xb5e1('0xb')](config[_0xb5e1('0xa')],{'host':_0xb5e1('0xc'),'port':0x18eb});var io=require(_0xb5e1('0xd'))(new Redis(config[_0xb5e1('0xa')]));function emit(_0x29aced,_0x47884a,_0x59fff0){io['to'](_0x29aced)[_0xb5e1('0xe')](_0x47884a,_0x59fff0);}function getTicket(_0x52ef0a,_0x2e344a,_0x596f93,_0x184f6b,_0x547f6b,_0x6efcee,_0x5a3911,_0x7d7ca){var _0x330733={};if(_0x184f6b[_0xb5e1('0xf')]==='Task'){_0x330733=Object[_0xb5e1('0x10')]({},{'OwnerId':_0x2e344a['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xb5e1('0x11')](_0x184f6b[_0xb5e1('0x12')],_0x547f6b,'\x20'),'Description':intUtil[_0xb5e1('0x11')](_0x184f6b[_0xb5e1('0x13')],_0x547f6b,'\x0a')},getCustomFields(_0x6efcee,_0x547f6b));if(_0x596f93){_0x330733[_0xb5e1('0x14')]=_0x596f93['id'];}}else if(_0x184f6b[_0xb5e1('0xf')]==='Case'){_0x330733=Object[_0xb5e1('0x10')]({},{'OwnerId':_0x2e344a['id'],'Subject':intUtil['getString'](_0x184f6b[_0xb5e1('0x12')],_0x547f6b,'\x20'),'Description':intUtil[_0xb5e1('0x11')](_0x184f6b[_0xb5e1('0x13')],_0x547f6b,'\x0a')},getCustomFields(_0x6efcee,_0x547f6b));if(_0x596f93){_0x330733[_0xb5e1('0x15')]=_0x596f93['id'];}}return _0x5a3911[_0xb5e1('0x16')](_0x184f6b[_0xb5e1('0xf')])[_0xb5e1('0x17')](_0x330733);}function getUser(_0x3f0e4c,_0x453410,_0x38433f){if(!_['isNil'](_0x453410)&&intUtil['validateEmail'](_0x453410)){var _0xf50706={'Email':_0x453410};var _0x583554={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x38433f['sobject'](_0xb5e1('0x18'))[_0xb5e1('0x19')](_0xf50706,_0x583554)[_0xb5e1('0x1a')]()['then'](function(_0x508d68){if(_0x508d68['length']){var _0x16298b=_[_0xb5e1('0x19')](_0x508d68,function(_0x36596e){return _0x36596e[_0xb5e1('0x1b')]===_0x453410;});if(_0x16298b){logger[_0xb5e1('0x1c')]('Agent\x20%s\x20found.',_0x453410);return BPromise[_0xb5e1('0x1d')]({'id':_0x16298b['Id'],'name':_0x16298b[_0xb5e1('0x1e')]});}}else{logger[_0xb5e1('0x1c')](_0xb5e1('0x1f'),_0x453410);return _0x38433f['identity']()[_0xb5e1('0x20')](function(_0x4ced9f){return BPromise[_0xb5e1('0x1d')]({'id':_0x4ced9f[_0xb5e1('0x21')],'name':_0x4ced9f[_0xb5e1('0x22')]});});}});}else{logger['info'](_0xb5e1('0x1f'),_0x453410);return _0x38433f[_0xb5e1('0x23')]()['then'](function(_0x3c25a2){return BPromise[_0xb5e1('0x1d')]({'id':_0x3c25a2[_0xb5e1('0x21')],'name':_0x3c25a2[_0xb5e1('0x22')]});});}}function getEndUser(_0xbaa53e,_0x4050e2,_0x39d70,_0x5de443,_0x2fddc2){var _0x386a99={'Phone':_0x5de443};var _0x4653c6={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xb5e1('0x20')](function(){if(_0x4050e2[_0xb5e1('0xf')]===_0xb5e1('0x24')){logger[_0xb5e1('0x1c')](_0xb5e1('0x25'),_0x5de443,_0x4050e2[_0xb5e1('0x26')]);switch(_0x4050e2['moduleSearch']){case'contact_lead':return _0x2fddc2[_0xb5e1('0x16')](_0xb5e1('0x27'))[_0xb5e1('0x19')](_0x386a99,_0x4653c6)[_0xb5e1('0x1a')]()[_0xb5e1('0x20')](function(_0x4b2751){if(_0x4b2751&&_0x4b2751['length']){return _0x4b2751;}else{return _0x2fddc2[_0xb5e1('0x16')](_0xb5e1('0x28'))[_0xb5e1('0x19')](_0x386a99,_0x4653c6);}});case _0xb5e1('0x29'):return _0x2fddc2[_0xb5e1('0x16')]('Contact')[_0xb5e1('0x19')](_0x386a99,_0x4653c6)[_0xb5e1('0x1a')]();case _0xb5e1('0x2a'):return _0x2fddc2['sobject']('Lead')['find'](_0x386a99,_0x4653c6);default:return null;}}else if(_0x4050e2['ticketType']===_0xb5e1('0x2b')){logger['info'](_0xb5e1('0x25'),_0x5de443,_0xb5e1('0x29'));return _0x2fddc2[_0xb5e1('0x16')](_0xb5e1('0x27'))['find'](_0x386a99,_0x4653c6)[_0xb5e1('0x1a')]();}})['then'](function(_0x33b1b0){if(_0x33b1b0&&_0x33b1b0[_0xb5e1('0x2c')]){var _0x400381=_[_0xb5e1('0x19')](_0x33b1b0,function(_0x159dfc){return _0x159dfc[_0xb5e1('0x2d')]===_0x5de443;});if(_0x400381){return BPromise[_0xb5e1('0x1d')]({'id':_0x400381['Id'],'name':_0x400381['Name'],'phone':_0x400381['Phone']});}}})[_0xb5e1('0x20')](function(_0x12c620){if(_0x12c620){logger['info'](_0xb5e1('0x2e'),_0x5de443);return BPromise[_0xb5e1('0x1d')](_0x12c620);}else{logger[_0xb5e1('0x1c')](_0xb5e1('0x2f'),_0x5de443);var _0x552139={'LastName':_0x39d70!==_0xb5e1('0x30')?_0x39d70:util[_0xb5e1('0x31')](_0xb5e1('0x32'),_0x5de443),'Phone':_0x5de443};if(_0x4050e2[_0xb5e1('0x33')]){if(_0x4050e2[_0xb5e1('0x33')]===_0xb5e1('0x29')){logger[_0xb5e1('0x1c')](_0xb5e1('0x34'),_0x5de443,_0x4050e2[_0xb5e1('0x33')]);}else if(_0x4050e2[_0xb5e1('0x33')]===_0xb5e1('0x2a')&&_0x4050e2[_0xb5e1('0xf')]==='Task'){logger[_0xb5e1('0x1c')](_0xb5e1('0x34'),_0x5de443,_0x4050e2[_0xb5e1('0x33')]);_0x552139[_0xb5e1('0x35')]=_0xb5e1('0x36');}else{return null;}}return _0x2fddc2[_0xb5e1('0x16')](_[_0xb5e1('0x37')](_0x4050e2['moduleCreate']))[_0xb5e1('0x17')](_0x552139);}});}function getCustomFields(_0x1527b8,_0x29f371){var _0x3a5aa8={};if(_0x1527b8[_0xb5e1('0x2c')]>0x0){_[_0xb5e1('0x38')](_0x1527b8,function(_0x5c449f){if(_0x5c449f[_0xb5e1('0x39')]==='string'&&_0x5c449f[_0xb5e1('0x3a')]){_0x3a5aa8[_0x5c449f[_0xb5e1('0x3a')]]=_0x5c449f[_0xb5e1('0x3b')][_0xb5e1('0x3c')]();}else if(_0x5c449f[_0xb5e1('0x39')]===_0xb5e1('0x3d')&&_0x5c449f[_0xb5e1('0x3e')]&&_0x5c449f[_0xb5e1('0x3a')]){_0x29f371[_0x5c449f[_0xb5e1('0x3e')]]&&(_0x3a5aa8[_0x5c449f[_0xb5e1('0x3a')]]=_0x29f371[_0x5c449f['variableName']]['toString']());}else if(_0x5c449f['type']===_0xb5e1('0x3f')&&_0x5c449f[_0xb5e1('0x40')]&&_0x5c449f[_0xb5e1('0x40')]['name']&&_0x5c449f['idField']){_0x29f371[_0x5c449f['Variable'][_0xb5e1('0x41')][_0xb5e1('0x42')]()]&&(_0x3a5aa8[_0x5c449f[_0xb5e1('0x3a')]]=_0x29f371[_0x5c449f[_0xb5e1('0x40')][_0xb5e1('0x41')][_0xb5e1('0x42')]()][_0xb5e1('0x3c')]());}});}return _0x3a5aa8;}function getConnection(_0x49c2df){var _0x85e636=_0x49c2df[_0xb5e1('0x43')]['concat'](_0x49c2df[_0xb5e1('0x44')]);var _0x4accb8=new jsforce[(_0xb5e1('0x45'))]({'oauth2':{'loginUrl':_0x49c2df[_0xb5e1('0x46')]||_0xb5e1('0x47'),'clientId':_0x49c2df['clientId'],'clientSecret':_0x49c2df['clientSecret']}});return _0x4accb8[_0xb5e1('0x48')](_0x49c2df['username'],_0x85e636)[_0xb5e1('0x20')](function(){logger[_0xb5e1('0x1c')](_0xb5e1('0x49'));return _0x4accb8;});}exports[_0xb5e1('0x4a')]=function(_0x305c9b,_0x237df3,_0x50e0e9,_0x2f882c,_0x410087,_0xe20a06){var _0x13df47,_0x44895a,_0x4dec48,_0xd9a4b3;_0xe20a06['serverUrl']=intUtil[_0xb5e1('0x4b')](_0xe20a06[_0xb5e1('0x4c')]);_0xe20a06[_0xb5e1('0x46')]=intUtil[_0xb5e1('0x4b')](_0xe20a06['remoteUri']);if(_0x410087&&_0x410087[_0xb5e1('0x4d')]){logger[_0xb5e1('0x1c')](_0xb5e1('0x4e'),_0xb5e1('0x4f'));_0x237df3[_0xb5e1('0x50')]=util['format'](_0xb5e1('0x51'),_0xe20a06['serverUrl'],_0x237df3[_0xb5e1('0x52')],md5(_0x237df3['uniqueid']));}else{_0x237df3['recordingURL']='';}return getConnection(_0xe20a06)['then'](function(_0x5b8761){_0xd9a4b3=_0x5b8761;return getUser(_0xe20a06,_0x2f882c[_0xb5e1('0x53')],_0xd9a4b3);})[_0xb5e1('0x20')](function(_0x24d159){_0x13df47=_0x24d159;return getEndUser(_0xe20a06,_0x50e0e9,_0x237df3[_0xb5e1('0x54')],_0x237df3['calleridnum'],_0xd9a4b3);})['then'](function(_0x14e453){_0x44895a=_0x14e453;return getTicket(_0xe20a06,_0x13df47,_0x44895a,_0x50e0e9,_0x237df3,_0x50e0e9[_0xb5e1('0x55')],_0xd9a4b3,_0xb5e1('0x4a'));})['then'](function(_0x4acfe5){_0x4dec48=_0x4acfe5;logger['info'](_0xb5e1('0x56'),_0x4dec48['id']);logger['info'](_0xb5e1('0x57'),_0x4dec48['id'],_0x2f882c[_0xb5e1('0x41')],_0xe20a06['type']);switch(_0xe20a06[_0xb5e1('0x39')]){case _0xb5e1('0x58'):emit(util[_0xb5e1('0x31')]('user:%s',_0x2f882c[_0xb5e1('0x41')]),'trigger:salesforce:display',{'recordId':_0x4dec48['id']});break;case _0xb5e1('0x59'):emit(util[_0xb5e1('0x31')](_0xb5e1('0x5a'),_0x2f882c[_0xb5e1('0x41')]),'trigger:browser:url',{'uri':util[_0xb5e1('0x31')](_0xb5e1('0x5b'),_0xd9a4b3[_0xb5e1('0x5c')],_0x4dec48['id'])});break;default:logger[_0xb5e1('0x5d')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x51237){logger[_0xb5e1('0x5d')](_0xb5e1('0x4e'),JSON['stringify'](_0x51237));});};exports[_0xb5e1('0x5e')]=function(_0x4a598b,_0x19527a,_0x4a5233,_0x179392,_0x580e97,_0x19ad54,_0x4e8ea8){var _0x59359f,_0x26e5e6,_0x31cef2,_0x468f4a;_0x19ad54[_0xb5e1('0x4c')]=intUtil[_0xb5e1('0x4b')](_0x19ad54[_0xb5e1('0x4c')]);_0x19ad54[_0xb5e1('0x46')]=intUtil[_0xb5e1('0x4b')](_0x19ad54[_0xb5e1('0x46')]);if(_0x4e8ea8&&_0x4e8ea8[_0xb5e1('0x5f')]&&_0x4e8ea8[_0xb5e1('0x5f')]!==_0xb5e1('0x60')){logger[_0xb5e1('0x1c')](_0xb5e1('0x61'),'Recording\x20is\x20enabled!');_0x19527a[_0xb5e1('0x50')]=util['format'](_0xb5e1('0x51'),_0x19ad54[_0xb5e1('0x4c')],_0x19527a[_0xb5e1('0x52')],md5(_0x19527a[_0xb5e1('0x52')]));}return getConnection(_0x19ad54)['then'](function(_0x5aeb47){_0x468f4a=_0x5aeb47;return getUser(_0x19ad54,_0x179392[_0xb5e1('0x53')],_0x468f4a);})['then'](function(_0x1355fc){_0x59359f=_0x1355fc;return getEndUser(_0x19ad54,_0x4a5233,_0x19527a['destcalleridname'],_0x19527a['destcalleridnum'],_0x468f4a);})[_0xb5e1('0x20')](function(_0x2b89b1){_0x26e5e6=_0x2b89b1;return getTicket(_0x19ad54,_0x59359f,_0x26e5e6,_0x4a5233,_0x19527a,_0x4a5233[_0xb5e1('0x55')],_0x468f4a,'outbound');})[_0xb5e1('0x20')](function(_0x422a89){_0x31cef2=_0x422a89;logger[_0xb5e1('0x1c')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x31cef2['id']);logger[_0xb5e1('0x1c')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x31cef2['id'],_0x179392[_0xb5e1('0x41')],_0x19ad54['type']);switch(_0x19ad54['type']){case _0xb5e1('0x58'):emit(util['format']('user:%s',_0x179392[_0xb5e1('0x41')]),_0xb5e1('0x62'),{'recordId':_0x31cef2['id']});break;case'newTab':emit(util[_0xb5e1('0x31')](_0xb5e1('0x5a'),_0x179392[_0xb5e1('0x41')]),_0xb5e1('0x63'),{'uri':util[_0xb5e1('0x31')]('%s/%s/e',_0x468f4a[_0xb5e1('0x5c')],_0x31cef2['id'])});break;default:logger[_0xb5e1('0x5d')](_0xb5e1('0x61'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x388a80){logger[_0xb5e1('0x5d')]('[OUTBOUND]',JSON['stringify'](_0x388a80));});};exports[_0xb5e1('0x64')]=function(_0x1bcc59,_0x18237e,_0x3b4d01,_0x25b0fd,_0xc15fad,_0x5db1aa){var _0x4e8765,_0x3ce40a,_0x36b8e5,_0x349fc3;_0x5db1aa['serverUrl']=intUtil[_0xb5e1('0x4b')](_0x5db1aa['serverUrl']);_0x5db1aa['remoteUri']=intUtil[_0xb5e1('0x4b')](_0x5db1aa[_0xb5e1('0x46')]);if(_0xc15fad&&_0xc15fad['monitor_format']){logger['info']('['+_0x18237e[_0xb5e1('0x65')][_0xb5e1('0x66')]()+']',_0xb5e1('0x4f'));_0x18237e[_0xb5e1('0x50')]=util[_0xb5e1('0x31')](_0xb5e1('0x51'),_0x5db1aa['serverUrl'],_0x18237e[_0xb5e1('0x52')],md5(_0x18237e[_0xb5e1('0x52')]));}else{_0x18237e[_0xb5e1('0x50')]='';}return getConnection(_0x5db1aa)['then'](function(_0x48d307){_0x349fc3=_0x48d307;if(!_[_0xb5e1('0x67')](_0x25b0fd)){return getUser(_0x5db1aa,_0x25b0fd[_0xb5e1('0x41')],_0x349fc3);}else{return getUser(_0x5db1aa,null,_0x349fc3);}})['then'](function(_0x349ca9){_0x4e8765=_0x349ca9;return getEndUser(_0x5db1aa,_0x3b4d01,_0x18237e['calleridname'],_0x18237e['calleridnum'],_0x349fc3);})[_0xb5e1('0x20')](function(_0x412a5a){_0x3ce40a=_0x412a5a;return getTicket(_0x5db1aa,_0x4e8765,_0x3ce40a,_0x3b4d01,_0x18237e,_0x3b4d01[_0xb5e1('0x55')],_0x349fc3);})[_0xb5e1('0x20')](function(_0x115540){_0x36b8e5=_0x115540;logger[_0xb5e1('0x1c')]('['+_0x18237e[_0xb5e1('0x65')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x36b8e5['id']);logger[_0xb5e1('0x1c')]('['+_0x18237e[_0xb5e1('0x65')][_0xb5e1('0x66')]()+_0xb5e1('0x68'),_0x5db1aa[_0xb5e1('0x39')]);})[_0xb5e1('0x69')](function(_0x39c6ad){logger[_0xb5e1('0x5d')]('['+_0x18237e[_0xb5e1('0x65')][_0xb5e1('0x66')]()+']',JSON[_0xb5e1('0x6a')](_0x39c6ad));});}; \ 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 84384cb..1a08351 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 _0x814b=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','Variable','name','POST','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number','label','?sysparm_query=name%3D','ticketId','Incident\x20-\x20','forEach','push','all','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','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','unmanaged'];(function(_0x3b9c6f,_0x30ef61){var _0x48d2a9=function(_0x468501){while(--_0x468501){_0x3b9c6f['push'](_0x3b9c6f['shift']());}};_0x48d2a9(++_0x30ef61);}(_0x814b,0x1a2));var _0xb814=function(_0x153c6a,_0x2a217a){_0x153c6a=_0x153c6a-0x0;var _0xce898f=_0x814b[_0x153c6a];return _0xce898f;};'use strict';var _=require(_0xb814('0x0'));var Promise=require(_0xb814('0x1'));var rp=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var md5=require(_0xb814('0x4'));var Redis=require(_0xb814('0x5'));var intUtil=require('./util');var config=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));config[_0xb814('0x9')]=_[_0xb814('0xa')](config[_0xb814('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xb814('0xb'))(new Redis(config[_0xb814('0x9')]));function getAdminUser(_0x5c8539,_0x271af9,_0x2913a6,_0x186d5a,_0x41166c,_0x1fea33){return new Promise(function(_0x21d4a5,_0x1086f8){var _0x19aad8={'method':_0xb814('0xc'),'uri':_0x186d5a+_0xb814('0xd')+'&'+_0x41166c+'&'+_0x1fea33,'auth':_0x271af9,'json':!![]};return rp(_0x19aad8)[_0xb814('0xe')](function(_0x4b5f14){if(_0x4b5f14[_0xb814('0xf')]['length']>0x0){_0x2913a6[_0xb814('0x10')]=_0x4b5f14[_0xb814('0xf')][0x0][_0xb814('0x11')];}logger[_0xb814('0x12')]('['+[_0x5c8539[_0xb814('0x13')]()]+_0xb814('0x14'),_0x2913a6);_0x21d4a5(_0x2913a6);})[_0xb814('0x15')](function(_0x41ed7b){logger[_0xb814('0x16')]('['+[_0x5c8539[_0xb814('0x13')]()]+']',_0x41ed7b[_0xb814('0x17')]);_0x1086f8(_0x41ed7b[_0xb814('0x17')]);});});}function getUser(_0x17f5bd,_0x39bfcf,_0x303aca,_0x3a71d6,_0x45e0d0){return function(_0x265a83){logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x18'),_0x265a83);return new Promise(function(_0x48c9df,_0x168a48){if(intUtil['validateEmail'](_0x265a83[_0xb814('0x19')])){var _0xfac75b={'method':'GET','uri':_0x303aca+'sys_user?sysparm_query=email%3D'+_0x265a83['userEmail']+'&'+_0x3a71d6+'&'+_0x45e0d0,'auth':_0x39bfcf,'json':!![]};logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0xfac75b);return rp(_0xfac75b)[_0xb814('0xe')](function(_0x24211d){logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+_0xb814('0x1a'),_0x24211d);if(_0x24211d['result'][_0xb814('0x1b')]>0x0&&String(_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x1c')])===_0xb814('0x1d')){_0x265a83[_0xb814('0x1e')]=_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x11')];}else{_0x265a83['userId']=_0x265a83[_0xb814('0x10')];_0x265a83['userEmail']=_0x265a83[_0xb814('0x1f')];}logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x20'),_0x265a83);_0x48c9df(_0x265a83);})[_0xb814('0x15')](function(_0xb9e57d){logger[_0xb814('0x16')]('['+[_0x17f5bd['toUpperCase']()]+']',_0xb9e57d[_0xb814('0x17')]);_0x168a48(_0xb9e57d[_0xb814('0x17')]);});}else{logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x21'));_0x265a83[_0xb814('0x1e')]=_0x265a83[_0xb814('0x10')];_0x265a83[_0xb814('0x19')]=_0x265a83['adminEmail'];_0x48c9df(_0x265a83);}});};}function createEndUser(_0x271aa8,_0x328a08,_0x52ed64,_0x9008b2,_0x37d24d){logger[_0xb814('0x12')]('['+[_0x271aa8['toUpperCase']()]+_0xb814('0x22'),_0x52ed64);return new Promise(function(_0x2051d0,_0x58c3ca){var _0x338a28={'method':'POST','uri':_0x9008b2+_0xb814('0x23')+_0x37d24d,'body':{'user_name':_0x52ed64['endUserNumber'],'roles':'user','first_name':_0x52ed64[_0xb814('0x24')],'active':'true','date_format':_0xb814('0x25'),'phone':_0x52ed64[_0xb814('0x24')]},'auth':_0x328a08,'json':!![]};return rp(_0x338a28)[_0xb814('0xe')](function(_0x599f9f){logger['info']('['+[_0x271aa8[_0xb814('0x13')]()]+_0xb814('0x26'),_0x599f9f['result']);_0x52ed64[_0xb814('0x27')]=_0x599f9f[_0xb814('0xf')][_0xb814('0x11')];_0x2051d0(_0x52ed64);})[_0xb814('0x15')](function(_0x1b78de){logger[_0xb814('0x16')]('['+[_0x271aa8[_0xb814('0x13')]()]+']',_0x1b78de['message']);_0x58c3ca(_0x1b78de[_0xb814('0x17')]);});});}function getEndUser(_0x2263f6,_0x30de5a,_0x424e2b,_0x14100d,_0x4ff31a){return function(_0x16ef82){logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+_0xb814('0x28'),_0x16ef82);return new Promise(function(_0xe0f509,_0x492d5e){var _0x40b885={'method':_0xb814('0xc'),'uri':_0x424e2b+'sys_user?sysparm_query=phone%3D'+_0x16ef82[_0xb814('0x24')]+'&'+_0x14100d+'&'+_0x4ff31a,'auth':_0x30de5a,'json':!![]};return rp(_0x40b885)[_0xb814('0xe')](function(_0x1a8bd0){if(_0x1a8bd0[_0xb814('0xf')][_0xb814('0x1b')]>0x0){_0x16ef82[_0xb814('0x27')]=_0x1a8bd0['result'][0x0][_0xb814('0x11')];logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20getEndUser\x20crm',_0x16ef82);_0xe0f509(_0x16ef82);}else{return createEndUser(_0x2263f6,_0x30de5a,_0x16ef82,_0x424e2b,_0x14100d)[_0xb814('0xe')](function(_0x4b9233){logger[_0xb814('0x12')]('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20createEndUser\x20crm',_0x4b9233);_0xe0f509(_0x4b9233);});}})['catch'](function(_0x5dd6bc){logger['error']('['+[_0x2263f6[_0xb814('0x13')]()]+']',_0x5dd6bc[_0xb814('0x17')]);_0x492d5e(_0x5dd6bc[_0xb814('0x17')]);});});};}function getCustomFields(_0x42c2ed,_0x51cdba){var _0x47d782={};if(_0x42c2ed[_0xb814('0x1b')]>0x0){_['forEach'](_0x42c2ed,function(_0x2a93da){if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x2a')&&_0x2a93da[_0xb814('0x2b')]&&!_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x2a93da[_0xb814('0x2f')][_0xb814('0x30')]();}else if(_0x2a93da['type']==='string'&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da['idField'][_0xb814('0x2e')]()]=_0x2a93da['content'][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x31')&&_0x2a93da[_0xb814('0x32')]&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da[_0xb814('0x32')]][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]==='customVariable'&&_0x2a93da[_0xb814('0x33')]&&_0x2a93da[_0xb814('0x33')][_0xb814('0x34')]&&_0x2a93da[_0xb814('0x2d')]&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da['Variable']['name'][_0xb814('0x2e')]()][_0xb814('0x30')]();}});}return _0x47d782;}function getTicket(_0x4c08d6,_0x2bf906,_0x43f1b,_0x40e627,_0x24b697,_0x40af85){return function(_0x2eb9b6){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x2eb9b6);return new Promise(function(_0x37800a,_0x17510c){var _0x4a76bb=_0x4c08d6[_0xb814('0x2e')]()==='outbound'?_0x2eb9b6[_0xb814('0x1e')]:_0x2eb9b6[_0xb814('0x27')];var _0xc71270={'method':_0xb814('0x35'),'uri':_0x43f1b+_0xb814('0x36')+'?'+_0x40af85,'body':Object[_0xb814('0x37')]({},{'active':_0xb814('0x1d'),'caller_id':_0x4a76bb,'assigned_to':_0x2eb9b6[_0xb814('0x1e')],'short_description':intUtil[_0xb814('0x38')](_0x40e627[_0xb814('0x39')],_0x24b697,'\x20'),'description':intUtil['getString'](_0x40e627['Descriptions'],_0x24b697,'\x0a')},getCustomFields(_0x40e627[_0xb814('0x3a')],_0x24b697)),'auth':_0x2bf906,'json':!![]};return rp(_0xc71270)[_0xb814('0xe')](function(_0x4156d8){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+_0xb814('0x3b'),_0x4156d8[_0xb814('0xf')]);_0x2eb9b6['ticketId']=_0x4156d8[_0xb814('0xf')][_0xb814('0x11')];_0x2eb9b6[_0xb814('0x3c')]=_0x4156d8['result'][_0xb814('0x3d')];logger['info']('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20crm',_0x2eb9b6);_0x37800a(_0x2eb9b6);})[_0xb814('0x15')](function(_0x3cf8f8){logger['error']('['+[_0x4c08d6[_0xb814('0x13')]()]+']',_0x3cf8f8[_0xb814('0x17')]);_0x17510c(_0x3cf8f8[_0xb814('0x17')]);});});};}function createRemoteTag(_0x5209d1,_0x3da050,_0x5f0e58,_0x13bdcf){return new Promise(function(_0x158893,_0x4aed78){var _0x39952d={'method':'POST','uri':_0x5f0e58+'label'+'?'+_0x13bdcf,'body':{'short_description':_0x5209d1,'global':!![],'active':!![],'name':_0x5209d1},'auth':_0x3da050,'json':!![]};return rp(_0x39952d)[_0xb814('0xe')](function(_0x35f59a){var _0x34935b=_0x35f59a['result'][_0xb814('0x11')];_0x158893(_0x34935b);});});}function getRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5,_0x2db5a6){return new Promise(function(_0x5c32c2,_0x25a607){var _0x1656ed={'method':_0xb814('0xc'),'uri':_0x2174e5+_0xb814('0x3e')+_0xb814('0x3f')+_0x538b0f+'&'+_0x58d6e5,'auth':_0xf88d23,'json':!![]};return rp(_0x1656ed)[_0xb814('0xe')](function(_0x21d3e9){if(_0x21d3e9[_0xb814('0xf')]['length']>0x0){var _0x374532=_0x21d3e9[_0xb814('0xf')][0x0]['sys_id'];_0x5c32c2(_0x374532);}else{return createRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5)[_0xb814('0xe')](function(_0xe14249){_0x5c32c2(_0xe14249);});}});});}function assignTagToIncident(_0x4d13db,_0x371000,_0x58b9a6,_0x48362c,_0x2114ca){return new Promise(function(_0x5257be,_0x3ff213){var _0xd1cd8b={'method':_0xb814('0x35'),'uri':_0x58b9a6+'label_entry'+'?'+_0x2114ca,'body':{'label':_0x4d13db,'table':_0xb814('0x36'),'id_type':'Incident','table_key':_0x48362c[_0xb814('0x40')],'title':_0xb814('0x41')+_0x48362c[_0xb814('0x3c')],'id_display':_0x48362c[_0xb814('0x3c')]},'auth':_0x371000,'json':!![]};return rp(_0xd1cd8b)[_0xb814('0xe')](function(_0x3b374b){_0x5257be();})[_0xb814('0x15')](function(){_0x5257be();});});}function manageTags(_0x113350,_0x46014f,_0x4d611d,_0x211194,_0x111884,_0x3852ae,_0x1ac6d0){return new Promise(function(_0x3b35a8,_0x3d4843){var _0x52edfa=[];_0x46014f[_0xb814('0x42')](function(_0x4ccd94){_0x52edfa[_0xb814('0x43')](getRemoteTag(_0x4ccd94,_0x4d611d,_0x211194,_0x3852ae,_0x1ac6d0));});return Promise[_0xb814('0x44')](_0x52edfa)[_0xb814('0xe')](function(_0x4c884c){if(_0x4c884c[_0xb814('0x1b')]){logger['info']('['+[_0x113350[_0xb814('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4c884c);var _0x2f0c94=[];_0x4c884c[_0xb814('0x42')](function(_0xa03cd2){_0x2f0c94[_0xb814('0x43')](assignTagToIncident(_0xa03cd2,_0x4d611d,_0x211194,_0x111884,_0x3852ae));});return Promise[_0xb814('0x44')](_0x2f0c94)[_0xb814('0xe')](function(){_0x3b35a8();})[_0xb814('0x15')](function(){_0x3b35a8();});}else{_0x3b35a8();}});});}function getTags(_0x4d44e3,_0x44088d,_0x51ca51,_0x255047,_0x22c73f,_0x1b989d){return function(_0x3dcaeb){return new Promise(function(_0x19fa45,_0x139531){var _0x514dab=[];var _0x12882a=_0x255047[_0xb814('0x45')];if(_0x12882a&&_0x12882a['length']>0x0){_0x514dab=_[_0xb814('0x46')](_0x12882a,_0xb814('0x34'));}if(_0x514dab[_0xb814('0x1b')]>0x0){return manageTags(_0x4d44e3,_0x514dab,_0x44088d,_0x51ca51,_0x3dcaeb,_0x22c73f,_0x1b989d)[_0xb814('0xe')](function(){_0x19fa45(_0x3dcaeb);});}else{_0x19fa45(_0x3dcaeb);}});};}function emit(_0x2161eb,_0x51d834,_0x3a4d4b){var _0x5e8e8e=_0xb814('0x47')+_0xb814('0x48')+_0xb814('0x49')+_0xb814('0x4a');var _0x2e39b1={'uri':_0x2161eb+_0xb814('0x4b')+_0x3a4d4b+_0x5e8e8e};io['to'](util['format']('user:%s',_0x51d834))['emit'](_0xb814('0x4c'),_0x2e39b1);}exports['cs']=function(_0x490e5c,_0x45a8b9,_0x1d3954,_0x25db89,_0x5e966c,_0x1b76fa,_0x3e5ce8,_0xee204){var _0x5aabbe={};var _0x30f717={'user':_0x1b76fa[_0xb814('0x4d')],'pass':_0x1b76fa[_0xb814('0x4e')]};var _0x3564e0='sysparm_limit=1';var _0x5dedd7=_0xb814('0x4f');_0x1b76fa[_0xb814('0x50')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x50')]);_0x1b76fa[_0xb814('0x52')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x52')]);var _0xe47442=util[_0xb814('0x53')](_0xb814('0x54'),_0x1b76fa[_0xb814('0x50')]);_0x5aabbe[_0xb814('0x19')]=!_[_0xb814('0x55')](_0x25db89)?_0x25db89[_0xb814('0x56')]:null;_0x5aabbe[_0xb814('0x1f')]=_0x1b76fa['email'];_0x5aabbe[_0xb814('0x24')]=_0xee204[_0xb814('0x2e')]()===_0xb814('0x57')?_0x45a8b9[_0xb814('0x58')]:_0x45a8b9[_0xb814('0x59')];_0x5aabbe[_0xb814('0x5a')]=_0xee204==='queue'||_0xee204===_0xb814('0x5b')?'queue':_0xb814('0x57');var _0x39aa00=util[_0xb814('0x53')](_0xb814('0x5c'),_0x1b76fa[_0xb814('0x52')],_0x45a8b9['uniqueid'],md5(_0x45a8b9['uniqueid']));if(_0x5e966c&&_0x5e966c[_0xb814('0x5d')]){logger[_0xb814('0x12')](_0xb814('0x5e'),_0xb814('0x5f'));_0x45a8b9['recordingURL']=_0x39aa00;}else if(_0x3e5ce8&&_0x3e5ce8[_0xb814('0x60')]&&_0x3e5ce8['recordingFormat']!==_0xb814('0x61')){logger[_0xb814('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x45a8b9[_0xb814('0x62')]=_0x39aa00;}else{_0x45a8b9['recordingURL']='';}return getAdminUser(_0xee204,_0x30f717,_0x5aabbe,_0xe47442,_0x5dedd7,_0x3564e0)[_0xb814('0xe')](getUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getEndUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getTicket(_0xee204,_0x30f717,_0xe47442,_0x1d3954,_0x45a8b9,_0x5dedd7))[_0xb814('0xe')](function(_0x46784f){logger[_0xb814('0x12')](util[_0xb814('0x53')]('The\x20ticket\x20ID\x20is:\x20%s',_0x46784f[_0xb814('0x40')]));logger['info'](util[_0xb814('0x53')]('call\x20direction:\x20%s',_0xee204));if(_0xee204!==_0xb814('0x5b')){logger[_0xb814('0x12')]('['+[_0xee204['toUpperCase']()]+']',_0xb814('0x63'));emit(_0x1b76fa['remoteUri'],_0x25db89[_0xb814('0x34')],_0x46784f[_0xb814('0x40')]);}})['catch'](function(_0x5a0c4a){logger[_0xb814('0x16')]('['+[_0xee204[_0xb814('0x13')]()]+_0xb814('0x64'),util[_0xb814('0x65')](_0x5a0c4a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc4aa=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','POST','ticketNumber','push'];(function(_0x4235aa,_0x52f789){var _0x1f2014=function(_0x50430a){while(--_0x50430a){_0x4235aa['push'](_0x4235aa['shift']());}};_0x1f2014(++_0x52f789);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xac4a('0x0'));var Promise=require(_0xac4a('0x1'));var rp=require(_0xac4a('0x2'));var util=require(_0xac4a('0x3'));var md5=require(_0xac4a('0x4'));var Redis=require(_0xac4a('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xac4a('0x6'));config[_0xac4a('0x7')]=_[_0xac4a('0x8')](config[_0xac4a('0x7')],{'host':_0xac4a('0x9'),'port':0x18eb});var io=require(_0xac4a('0xa'))(new Redis(config[_0xac4a('0x7')]));function getAdminUser(_0x10525b,_0x5c6179,_0x5b8339,_0x1aba6d,_0x2a4d53,_0x26ec84){return new Promise(function(_0x4f4146,_0x1d182e){var _0x3a82de={'method':_0xac4a('0xb'),'uri':_0x1aba6d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2a4d53+'&'+_0x26ec84,'auth':_0x5c6179,'json':!![]};return rp(_0x3a82de)[_0xac4a('0xc')](function(_0x488e3c){if(_0x488e3c[_0xac4a('0xd')]['length']>0x0){_0x5b8339[_0xac4a('0xe')]=_0x488e3c[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}logger['info']('['+[_0x10525b[_0xac4a('0x10')]()]+_0xac4a('0x11'),_0x5b8339);_0x4f4146(_0x5b8339);})[_0xac4a('0x12')](function(_0x6e00d4){logger[_0xac4a('0x13')]('['+[_0x10525b[_0xac4a('0x10')]()]+']',_0x6e00d4[_0xac4a('0x14')]);_0x1d182e(_0x6e00d4[_0xac4a('0x14')]);});});}function getUser(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return function(_0x402fff){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x16'),_0x402fff);return new Promise(function(_0x3e88e3,_0x387a54){if(intUtil[_0xac4a('0x17')](_0x402fff[_0xac4a('0x18')])){var _0x546c5d={'method':'GET','uri':_0x11e101+_0xac4a('0x19')+_0x402fff[_0xac4a('0x18')]+'&'+_0x26dbb8+'&'+_0x4a2119,'auth':_0x42c7fc,'json':!![]};logger[_0xac4a('0x15')]('['+[_0x190418['toUpperCase']()]+_0xac4a('0x1a'),_0x546c5d);return rp(_0x546c5d)[_0xac4a('0xc')](function(_0x3752e4){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x1b'),_0x3752e4);if(_0x3752e4[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0&&String(_0x3752e4['result'][0x0][_0xac4a('0x1d')])===_0xac4a('0x1e')){_0x402fff['userId']=_0x3752e4[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}else{_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff['userEmail']=_0x402fff[_0xac4a('0x20')];}logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x21'),_0x402fff);_0x3e88e3(_0x402fff);})[_0xac4a('0x12')](function(_0x2b0dc2){logger[_0xac4a('0x13')]('['+[_0x190418[_0xac4a('0x10')]()]+']',_0x2b0dc2[_0xac4a('0x14')]);_0x387a54(_0x2b0dc2[_0xac4a('0x14')]);});}else{logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x22'));_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff[_0xac4a('0x18')]=_0x402fff['adminEmail'];_0x3e88e3(_0x402fff);}});};}function createEndUser(_0x23b061,_0x267a22,_0x42a33c,_0x2772fe,_0x116700){logger['info']('['+[_0x23b061['toUpperCase']()]+_0xac4a('0x23'),_0x42a33c);return new Promise(function(_0x7a948b,_0x1f12d5){var _0x546b65={'method':'POST','uri':_0x2772fe+_0xac4a('0x24')+_0x116700,'body':{'user_name':_0x42a33c[_0xac4a('0x25')],'roles':_0xac4a('0x26'),'first_name':_0x42a33c[_0xac4a('0x25')],'active':_0xac4a('0x1e'),'date_format':'System','phone':_0x42a33c[_0xac4a('0x25')]},'auth':_0x267a22,'json':!![]};return rp(_0x546b65)['then'](function(_0x30364b){logger['info']('['+[_0x23b061[_0xac4a('0x10')]()]+_0xac4a('0x27'),_0x30364b[_0xac4a('0xd')]);_0x42a33c[_0xac4a('0x28')]=_0x30364b[_0xac4a('0xd')][_0xac4a('0xf')];_0x7a948b(_0x42a33c);})[_0xac4a('0x12')](function(_0x1f13f3){logger[_0xac4a('0x13')]('['+[_0x23b061[_0xac4a('0x10')]()]+']',_0x1f13f3[_0xac4a('0x14')]);_0x1f12d5(_0x1f13f3[_0xac4a('0x14')]);});});}function getEndUser(_0x1a9be2,_0x1a9d4e,_0x5634e2,_0x30442d,_0x1c41fb){return function(_0x5a4e2b){logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x5a4e2b);return new Promise(function(_0x58804b,_0x11f0be){var _0x1ba096={'method':_0xac4a('0xb'),'uri':_0x5634e2+_0xac4a('0x29')+_0x5a4e2b['endUserNumber']+'&'+_0x30442d+'&'+_0x1c41fb,'auth':_0x1a9d4e,'json':!![]};return rp(_0x1ba096)[_0xac4a('0xc')](function(_0x2e56c6){if(_0x2e56c6['result'][_0xac4a('0x1c')]>0x0){_0x5a4e2b[_0xac4a('0x28')]=_0x2e56c6[_0xac4a('0xd')][0x0]['sys_id'];logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+_0xac4a('0x2a'),_0x5a4e2b);_0x58804b(_0x5a4e2b);}else{return createEndUser(_0x1a9be2,_0x1a9d4e,_0x5a4e2b,_0x5634e2,_0x30442d)['then'](function(_0x35bc94){logger[_0xac4a('0x15')]('['+[_0x1a9be2['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x35bc94);_0x58804b(_0x35bc94);});}})[_0xac4a('0x12')](function(_0x5e0926){logger['error']('['+[_0x1a9be2['toUpperCase']()]+']',_0x5e0926['message']);_0x11f0be(_0x5e0926[_0xac4a('0x14')]);});});};}function getCustomFields(_0x2bf8e8,_0x37834b){var _0x472484={};if(_0x2bf8e8[_0xac4a('0x1c')]>0x0){_[_0xac4a('0x2b')](_0x2bf8e8,function(_0x4220e2){if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x2e')]&&!_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')]['toLowerCase']()]=_0x4220e2['content']['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x4220e2[_0xac4a('0x32')][_0xac4a('0x33')]();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x34')&&_0x4220e2['variableName']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x35')]]['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x36')&&_0x4220e2['Variable']&&_0x4220e2[_0xac4a('0x37')]['name']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x37')][_0xac4a('0x38')][_0xac4a('0x31')]()][_0xac4a('0x33')]();}});}return _0x472484;}function getTicket(_0x98e0c4,_0xcb002b,_0x4fa9eb,_0x3b68b3,_0x569812,_0x1646ea){return function(_0x41d11d){logger[_0xac4a('0x15')]('['+[_0x98e0c4['toUpperCase']()]+_0xac4a('0x39'),_0x41d11d);return new Promise(function(_0x19276e,_0x5f54ff){var _0x42969b=_0x98e0c4['toLowerCase']()===_0xac4a('0x3a')?_0x41d11d[_0xac4a('0x1f')]:_0x41d11d[_0xac4a('0x28')];var _0x5e3581={'method':'POST','uri':_0x4fa9eb+_0xac4a('0x3b')+'?'+_0x1646ea,'body':Object['assign']({},{'active':_0xac4a('0x1e'),'caller_id':_0x42969b,'assigned_to':_0x41d11d['userId'],'short_description':intUtil[_0xac4a('0x3c')](_0x3b68b3['Subjects'],_0x569812,'\x20'),'description':intUtil[_0xac4a('0x3c')](_0x3b68b3[_0xac4a('0x3d')],_0x569812,'\x0a')},getCustomFields(_0x3b68b3[_0xac4a('0x3e')],_0x569812)),'auth':_0xcb002b,'json':!![]};return rp(_0x5e3581)[_0xac4a('0xc')](function(_0x54782f){logger[_0xac4a('0x15')]('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x3f'),_0x54782f[_0xac4a('0xd')]);_0x41d11d[_0xac4a('0x40')]=_0x54782f[_0xac4a('0xd')][_0xac4a('0xf')];_0x41d11d['ticketNumber']=_0x54782f[_0xac4a('0xd')][_0xac4a('0x41')];logger['info']('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x42'),_0x41d11d);_0x19276e(_0x41d11d);})[_0xac4a('0x12')](function(_0x3ac36e){logger['error']('['+[_0x98e0c4[_0xac4a('0x10')]()]+']',_0x3ac36e[_0xac4a('0x14')]);_0x5f54ff(_0x3ac36e[_0xac4a('0x14')]);});});};}function createRemoteTag(_0x129d58,_0x890910,_0x49fbc3,_0x179373){return new Promise(function(_0x564b10,_0x307441){var _0x2c04af={'method':'POST','uri':_0x49fbc3+'label'+'?'+_0x179373,'body':{'short_description':_0x129d58,'global':!![],'active':!![],'name':_0x129d58},'auth':_0x890910,'json':!![]};return rp(_0x2c04af)[_0xac4a('0xc')](function(_0x70fdc3){var _0x4d448f=_0x70fdc3[_0xac4a('0xd')][_0xac4a('0xf')];_0x564b10(_0x4d448f);});});}function getRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6,_0x108f7c){return new Promise(function(_0xb43fdb,_0xb5897b){var _0xdc80e3={'method':_0xac4a('0xb'),'uri':_0x48900f+_0xac4a('0x43')+'?sysparm_query=name%3D'+_0x26b582+'&'+_0x3057d6,'auth':_0x103d05,'json':!![]};return rp(_0xdc80e3)[_0xac4a('0xc')](function(_0xef51d0){if(_0xef51d0[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0){var _0x1b7231=_0xef51d0[_0xac4a('0xd')][0x0][_0xac4a('0xf')];_0xb43fdb(_0x1b7231);}else{return createRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6)[_0xac4a('0xc')](function(_0x159e43){_0xb43fdb(_0x159e43);});}});});}function assignTagToIncident(_0x786d9,_0x3b175a,_0x38dd4f,_0x400ac4,_0x2fe7df){return new Promise(function(_0x5222f3,_0x11c753){var _0x492aae={'method':_0xac4a('0x44'),'uri':_0x38dd4f+'label_entry'+'?'+_0x2fe7df,'body':{'label':_0x786d9,'table':_0xac4a('0x3b'),'id_type':'Incident','table_key':_0x400ac4[_0xac4a('0x40')],'title':'Incident\x20-\x20'+_0x400ac4[_0xac4a('0x45')],'id_display':_0x400ac4['ticketNumber']},'auth':_0x3b175a,'json':!![]};return rp(_0x492aae)['then'](function(_0x52c957){_0x5222f3();})[_0xac4a('0x12')](function(){_0x5222f3();});});}function manageTags(_0x3bcae2,_0x3c2f84,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa,_0x50dece){return new Promise(function(_0x34215e,_0x5d03e5){var _0x347880=[];_0x3c2f84[_0xac4a('0x2b')](function(_0x3da7e7){_0x347880[_0xac4a('0x46')](getRemoteTag(_0x3da7e7,_0x2f9940,_0xb7b884,_0x1e1ffa,_0x50dece));});return Promise[_0xac4a('0x47')](_0x347880)[_0xac4a('0xc')](function(_0x3abd57){if(_0x3abd57[_0xac4a('0x1c')]){logger[_0xac4a('0x15')]('['+[_0x3bcae2[_0xac4a('0x10')]()]+_0xac4a('0x48'),_0x3abd57);var _0x2498ad=[];_0x3abd57[_0xac4a('0x2b')](function(_0x2cc410){_0x2498ad[_0xac4a('0x46')](assignTagToIncident(_0x2cc410,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa));});return Promise[_0xac4a('0x47')](_0x2498ad)[_0xac4a('0xc')](function(){_0x34215e();})['catch'](function(){_0x34215e();});}else{_0x34215e();}});});}function getTags(_0xa90d71,_0x1672c0,_0x4fb812,_0x3c3576,_0x34bd1c,_0x2d24c7){return function(_0x2b8562){return new Promise(function(_0x357cac,_0x4d1440){var _0x47c6d8=[];var _0x45f3c3=_0x3c3576[_0xac4a('0x49')];if(_0x45f3c3&&_0x45f3c3[_0xac4a('0x1c')]>0x0){_0x47c6d8=_[_0xac4a('0x4a')](_0x45f3c3,_0xac4a('0x38'));}if(_0x47c6d8[_0xac4a('0x1c')]>0x0){return manageTags(_0xa90d71,_0x47c6d8,_0x1672c0,_0x4fb812,_0x2b8562,_0x34bd1c,_0x2d24c7)[_0xac4a('0xc')](function(){_0x357cac(_0x2b8562);});}else{_0x357cac(_0x2b8562);}});};}function emit(_0x2988d7,_0x44c60b,_0x295f21){var _0x278c09='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xac4a('0x4b')+_0xac4a('0x4c');var _0x2954fc={'uri':_0x2988d7+_0xac4a('0x4d')+_0x295f21+_0x278c09};io['to'](util[_0xac4a('0x4e')](_0xac4a('0x4f'),_0x44c60b))[_0xac4a('0x50')](_0xac4a('0x51'),_0x2954fc);}exports['cs']=function(_0x453d62,_0x2a5acc,_0xb09b89,_0xb12cc5,_0x5f0173,_0x13c854,_0xc74ce8,_0x26bd31){var _0x231932={};var _0x513976={'user':_0x13c854[_0xac4a('0x52')],'pass':_0x13c854['password']};var _0xab4305=_0xac4a('0x53');var _0x499abc='sysparm_display_value=true';_0x13c854[_0xac4a('0x54')]=intUtil[_0xac4a('0x55')](_0x13c854[_0xac4a('0x54')]);_0x13c854['serverUrl']=intUtil[_0xac4a('0x55')](_0x13c854['serverUrl']);var _0x114b11=util['format']('%s/api/now/table/',_0x13c854[_0xac4a('0x54')]);_0x231932['userEmail']=!_[_0xac4a('0x56')](_0xb12cc5)?_0xb12cc5['email']:null;_0x231932[_0xac4a('0x20')]=_0x13c854[_0xac4a('0x57')];_0x231932['endUserNumber']=_0x26bd31[_0xac4a('0x31')]()==='outbound'?_0x2a5acc[_0xac4a('0x58')]:_0x2a5acc[_0xac4a('0x59')];_0x231932['callDirection']=_0x26bd31===_0xac4a('0x5a')||_0x26bd31==='unmanaged'?'queue':_0xac4a('0x3a');var _0x4e3129=util[_0xac4a('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c854['serverUrl'],_0x2a5acc[_0xac4a('0x5b')],md5(_0x2a5acc[_0xac4a('0x5b')]));if(_0x5f0173&&_0x5f0173[_0xac4a('0x5c')]){logger['info']('[QUEUE]',_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else if(_0xc74ce8&&_0xc74ce8['recordingFormat']&&_0xc74ce8['recordingFormat']!==_0xac4a('0x5f')){logger[_0xac4a('0x15')](_0xac4a('0x60'),_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else{_0x2a5acc[_0xac4a('0x5e')]='';}return getAdminUser(_0x26bd31,_0x513976,_0x231932,_0x114b11,_0x499abc,_0xab4305)[_0xac4a('0xc')](getUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getEndUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getTicket(_0x26bd31,_0x513976,_0x114b11,_0xb09b89,_0x2a5acc,_0x499abc))['then'](function(_0x1201e8){logger[_0xac4a('0x15')](util[_0xac4a('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1201e8[_0xac4a('0x40')]));logger[_0xac4a('0x15')](util[_0xac4a('0x4e')](_0xac4a('0x61'),_0x26bd31));if(_0x26bd31!==_0xac4a('0x62')){logger['info']('['+[_0x26bd31[_0xac4a('0x10')]()]+']',_0xac4a('0x63'));emit(_0x13c854[_0xac4a('0x54')],_0xb12cc5[_0xac4a('0x38')],_0x1201e8[_0xac4a('0x40')]);}})[_0xac4a('0x12')](function(_0xd7bdd6){logger['error']('['+[_0x26bd31[_0xac4a('0x10')]()]+_0xac4a('0x64'),util[_0xac4a('0x65')](_0xd7bdd6,{'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 4df2944..c1bdd7c 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 _0xdbb1=['calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','toUpperCase','lastevent','lodash','util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','variableName','push','idField','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','content','customField','custom_fields','variable','customVariable','Variable','toLowerCase','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:'];(function(_0x4665b8,_0x234a28){var _0x54ba4c=function(_0x38064a){while(--_0x38064a){_0x4665b8['push'](_0x4665b8['shift']());}};_0x54ba4c(++_0x234a28);}(_0xdbb1,0x105));var _0x1dbb=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xdbb1[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0x1dbb('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x1dbb('0x1'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x1dbb('0x2'));var logger=require('../../../../config/logger')(_0x1dbb('0x3'));config[_0x1dbb('0x4')]=_['defaults'](config['redis'],{'host':_0x1dbb('0x5'),'port':0x18eb});var io=require(_0x1dbb('0x6'))(new Redis(config[_0x1dbb('0x4')]));var def={'method':_0x1dbb('0x7'),'json':!![]};function emit(_0x5e622c,_0x3ffb54,_0xf42424){io['to'](_0x5e622c)['emit'](_0x3ffb54,_0xf42424);}function getTicket(_0x208220,_0x232c1c,_0x1e7ac5,_0x3ce7e9,_0x40b115,_0x183120,_0x111841,_0x3321a0){logger[_0x1dbb('0x8')](_0x1dbb('0x9'));var _0x1d3f8b=new Date();var _0x5bf42d=[{'name':_0x1dbb('0xa'),'value':intUtil[_0x1dbb('0xb')](_0x3ce7e9[_0x1dbb('0xc')],_0x40b115,'\x20')},{'name':_0x1dbb('0xd'),'value':_0x232c1c['id']},{'name':'created_by','value':_0x232c1c['id']},{'name':'description','value':intUtil[_0x1dbb('0xb')](_0x3ce7e9[_0x1dbb('0xe')],_0x40b115,'\x0a')},{'name':_0x1dbb('0xf'),'value':_0x1d3f8b[_0x1dbb('0x10')]()[_0x1dbb('0x11')](0x0,0x13)['replace']('T','\x20')},{'name':_0x1dbb('0x12'),'value':'0'},{'name':_0x1dbb('0x13'),'value':'15'},{'name':_0x1dbb('0x14'),'value':_0x1e7ac5['id']},{'name':'parent_type','value':_0x1dbb('0x15')},{'name':_0x1dbb('0x16'),'value':_0x1e7ac5['name']},{'name':_0x1dbb('0x17'),'value':_0x3321a0}];if(_0x183120[_0x1dbb('0x18')]){_[_0x1dbb('0x19')](_0x183120,function(_0x440c9f){if(_0x40b115[_0x440c9f[_0x1dbb('0x1a')]]){_0x5bf42d[_0x1dbb('0x1b')]({'name':_0x440c9f[_0x1dbb('0x1c')],'value':_0x40b115[_0x440c9f[_0x1dbb('0x1a')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x1dbb('0x1d')]({'session':_0x111841['id'],'module_name':_0x1dbb('0x1e'),'name_value_list':_0x5bf42d})}});}function getAuth(_0x570896){return util[_0x1dbb('0x1f')](_0x1dbb('0x20'),new Buffer(_0x570896[_0x1dbb('0x21')]+':X')[_0x1dbb('0x22')](_0x1dbb('0x23')));}function getServerInfo(_0x3ddd80){return request({'form':{'method':_0x1dbb('0x24'),'input_type':_0x1dbb('0x25'),'response_type':_0x1dbb('0x25'),'rest_data':JSON[_0x1dbb('0x1d')]({'session':_0x3ddd80['id']})}});}function getUser(_0x2a2458,_0x2d1b0c,_0x2c0993){if(!_[_0x1dbb('0x26')](_0x2d1b0c)){logger[_0x1dbb('0x8')](_0x1dbb('0x27'),_0x2d1b0c);return request({'form':{'method':_0x1dbb('0x28'),'input_type':_0x1dbb('0x25'),'response_type':_0x1dbb('0x25'),'rest_data':JSON['stringify']({'session':_0x2c0993['id'],'module_name':_0x1dbb('0x29'),'query':util['format'](_0x1dbb('0x2a'),_0x2d1b0c),'order_by':'','offset':'0','select_fields':['id','name',_0x1dbb('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1dbb('0x2c')](function(_0x346372){if(_0x346372[_0x1dbb('0x2d')][_0x1dbb('0x18')]){var _0x47057d=_['find'](_0x346372[_0x1dbb('0x2d')],function(_0x410979){return _0x410979[_0x1dbb('0x2e')]['user_name']['value']===_0x2d1b0c;});if(_0x47057d){logger[_0x1dbb('0x8')]('Agent\x20found!');return BPromise['resolve']({'id':_0x47057d[_0x1dbb('0x2e')]['id'][_0x1dbb('0x2f')],'name':_0x47057d[_0x1dbb('0x2e')][_0x1dbb('0xa')][_0x1dbb('0x2f')]});}}logger[_0x1dbb('0x8')](_0x1dbb('0x30'));return BPromise[_0x1dbb('0x31')]({'id':_0x2c0993[_0x1dbb('0x2e')]['user_id']['value'],'name':_0x2c0993[_0x1dbb('0x2e')][_0x1dbb('0x2b')][_0x1dbb('0x2f')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1dbb('0x31')]({'id':_0x2c0993[_0x1dbb('0x2e')][_0x1dbb('0x32')]['value'],'name':_0x2c0993['name_value_list'][_0x1dbb('0x2b')][_0x1dbb('0x2f')]});}}function getEndUser(_0x596b07,_0x3c22f8,_0x15d934,_0x3fbaaf){logger[_0x1dbb('0x8')]('Searching\x20enduser\x20with\x20phone',_0x15d934);return request({'form':{'method':_0x1dbb('0x28'),'input_type':_0x1dbb('0x25'),'response_type':_0x1dbb('0x25'),'rest_data':JSON[_0x1dbb('0x1d')]({'session':_0x3fbaaf['id'],'module_name':_0x1dbb('0x15'),'query':util[_0x1dbb('0x1f')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x15d934),'order_by':'','offset':'0','select_fields':['id',_0x1dbb('0xa'),_0x1dbb('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x982054){if(_0x982054[_0x1dbb('0x2d')][_0x1dbb('0x18')]){var _0xde3241=_[_0x1dbb('0x34')](_0x982054['entry_list'],function(_0x394299){return _0x394299[_0x1dbb('0x2e')][_0x1dbb('0x33')][_0x1dbb('0x2f')]===_0x15d934;});if(_0xde3241){logger[_0x1dbb('0x8')](_0x1dbb('0x35'));return BPromise['resolve']({'id':_0xde3241[_0x1dbb('0x2e')]['id'][_0x1dbb('0x2f')],'name':_0xde3241['name_value_list'][_0x1dbb('0xa')][_0x1dbb('0x2f')],'phone':_0xde3241[_0x1dbb('0x2e')][_0x1dbb('0x33')][_0x1dbb('0x2f')]});}}else{logger[_0x1dbb('0x8')](_0x1dbb('0x36'));return request({'form':{'method':_0x1dbb('0x37'),'input_type':_0x1dbb('0x25'),'response_type':_0x1dbb('0x25'),'rest_data':JSON[_0x1dbb('0x1d')]({'session':_0x3fbaaf['id'],'module_name':_0x1dbb('0x15'),'name_value_list':[{'name':_0x1dbb('0x38'),'value':_0x3c22f8!==''?_0x3c22f8:util[_0x1dbb('0x1f')](_0x1dbb('0x39'),_0x15d934)},{'name':_0x1dbb('0x33'),'value':_0x15d934}]})}})[_0x1dbb('0x2c')](function(_0x124452){logger[_0x1dbb('0x8')](_0x1dbb('0x3a'));return BPromise[_0x1dbb('0x31')]({'id':_0x124452['id'],'name':_0x124452[_0x1dbb('0x2d')][_0x1dbb('0x38')][_0x1dbb('0x2f')],'phone':_0x124452[_0x1dbb('0x2d')][_0x1dbb('0x33')]['value']});});}});}function request(_0x148c2f){logger[_0x1dbb('0x3b')](_0x1dbb('0x3c'),JSON[_0x1dbb('0x1d')](_0x148c2f));return rp(_['merge'](def,_0x148c2f));}function getTags(_0x3fa964,_0x2b3b1b){var _0x12c16b=[];if(_0x3fa964&&_0x3fa964[_0x1dbb('0x18')]>0x0){_0x12c16b=_[_0x1dbb('0x3d')](_0x3fa964,_0x2b3b1b);}return _0x12c16b;}function getCustomFields(_0x26999e,_0xb13dd7){var _0x284a96=[];var _0x5d3c71={'custom_fields':[]};if(_0x26999e[_0x1dbb('0x18')]>0x0){_[_0x1dbb('0x19')](_0x26999e,function(_0x35b9f9){if(_0x35b9f9[_0x1dbb('0x3e')]===_0x1dbb('0x3f')&&_0x35b9f9[_0x1dbb('0x40')]&&!_0x35b9f9['customField']){_0x5d3c71[_0x35b9f9[_0x1dbb('0x40')]['toLowerCase']()]=_0x35b9f9[_0x1dbb('0x41')][_0x1dbb('0x22')]();}else if(_0x35b9f9['type']===_0x1dbb('0x3f')&&_0x35b9f9[_0x1dbb('0x1c')]&&_0x35b9f9[_0x1dbb('0x42')]){_0x5d3c71[_0x1dbb('0x43')][_0x1dbb('0x1b')]({'id':_0x35b9f9['idField'],'value':_0x35b9f9[_0x1dbb('0x41')][_0x1dbb('0x22')]()});}else if(_0x35b9f9[_0x1dbb('0x3e')]===_0x1dbb('0x44')&&_0x35b9f9[_0x1dbb('0x1a')]&&_0x35b9f9['idField']&&_0x35b9f9[_0x1dbb('0x42')]){_0xb13dd7[_0x35b9f9['variableName']]&&_0x5d3c71['custom_fields'][_0x1dbb('0x1b')]({'id':_0x35b9f9['idField'],'value':_0xb13dd7[_0x35b9f9[_0x1dbb('0x1a')]][_0x1dbb('0x22')]()});}else if(_0x35b9f9[_0x1dbb('0x3e')]===_0x1dbb('0x45')&&_0x35b9f9[_0x1dbb('0x46')]&&_0x35b9f9[_0x1dbb('0x46')]['name']&&_0x35b9f9[_0x1dbb('0x1c')]&&_0x35b9f9[_0x1dbb('0x42')]){_0xb13dd7[_0x35b9f9[_0x1dbb('0x46')][_0x1dbb('0xa')][_0x1dbb('0x47')]()]&&_0x5d3c71[_0x1dbb('0x43')]['push']({'id':_0x35b9f9['idField'],'value':_0xb13dd7[_0x35b9f9[_0x1dbb('0x46')]['name'][_0x1dbb('0x47')]()][_0x1dbb('0x22')]()});}});}return _0x5d3c71;}function getConnection(_0x3e2771){return request({'method':'POST','form':{'method':_0x1dbb('0x48'),'input_type':_0x1dbb('0x25'),'response_type':_0x1dbb('0x25'),'rest_data':JSON[_0x1dbb('0x1d')]({'user_auth':{'user_name':_0x3e2771['username'],'password':_0x3e2771[_0x1dbb('0x49')],'encryption':_0x1dbb('0x4a')},'application':_0x1dbb('0x4b')})}})[_0x1dbb('0x2c')](function(_0x441c36){var _0x358929=_0x441c36;if(_0x358929['id']){def[_0x1dbb('0x4c')]=_0x358929['id'];return BPromise[_0x1dbb('0x31')](_0x358929);}else{throw new Error(util[_0x1dbb('0x1f')](_0x1dbb('0x4d'),_0x3e2771['id']));}});}function setRelationship(_0xb22ae6,_0x2a727f,_0x3a9eab,_0x3ef0e0){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x1dbb('0x25'),'rest_data':JSON['stringify']({'session':_0xb22ae6['id'],'module_name':_0x1dbb('0x1e'),'module_id':_0x3a9eab['id'],'link_field_name':_0x3ef0e0,'related_ids':[_0x2a727f['id']]})}});}exports[_0x1dbb('0x4e')]=function(_0x838a1b,_0x4c0b32,_0x20c294,_0x23936d,_0x3525f2,_0x289f96){var _0x3252d1,_0x211c94,_0x153af4,_0x4a6ea5;_0x289f96[_0x1dbb('0x4f')]=intUtil[_0x1dbb('0x50')](_0x289f96['remoteUri']);_0x289f96[_0x1dbb('0x51')]=intUtil[_0x1dbb('0x50')](_0x289f96[_0x1dbb('0x51')]);def['uri']=util[_0x1dbb('0x1f')](_0x1dbb('0x52'),_0x289f96[_0x1dbb('0x4f')]);if(_0x3525f2&&_0x3525f2[_0x1dbb('0x53')]){logger[_0x1dbb('0x8')](_0x1dbb('0x54'),_0x1dbb('0x55'));_0x4c0b32[_0x1dbb('0x56')]=util[_0x1dbb('0x1f')](_0x1dbb('0x57'),_0x289f96[_0x1dbb('0x51')],_0x4c0b32[_0x1dbb('0x58')],md5(_0x4c0b32[_0x1dbb('0x58')]));}else{_0x4c0b32[_0x1dbb('0x56')]='';}return getConnection(_0x289f96)[_0x1dbb('0x2c')](function(_0xb3eab0){_0x4a6ea5=_0xb3eab0;return getUser(_0x289f96,_0x23936d[_0x1dbb('0xa')],_0x4a6ea5);})['then'](function(_0x2f53a0){_0x3252d1=_0x2f53a0;logger[_0x1dbb('0x8')](_0x1dbb('0x59'),_0x3252d1['id']);return getEndUser(_0x289f96,_0x4c0b32[_0x1dbb('0x5a')],_0x4c0b32[_0x1dbb('0x5b')],_0x4a6ea5);})[_0x1dbb('0x2c')](function(_0x47153d){_0x211c94=_0x47153d;logger[_0x1dbb('0x8')](_0x1dbb('0x5c'),_0x211c94['id']);return getTicket(_0x289f96,_0x3252d1,_0x211c94,_0x20c294,_0x4c0b32,_0x20c294[_0x1dbb('0x5d')],_0x4a6ea5,_0x1dbb('0x5e'));})['then'](function(_0x5d6117){_0x153af4=_0x5d6117;logger[_0x1dbb('0x8')](_0x1dbb('0x5f'));logger[_0x1dbb('0x8')](_0x1dbb('0x60'),_0x153af4['id']);return setRelationship(_0x4a6ea5,_0x3252d1,_0x153af4,'users');})['then'](function(){return setRelationship(_0x4a6ea5,_0x211c94,_0x153af4,_0x1dbb('0x61'));})[_0x1dbb('0x2c')](function(){return getServerInfo(_0x4a6ea5);})[_0x1dbb('0x2c')](function(_0x445980){var _0x2e42dc=parseInt(_0x445980[_0x1dbb('0x62')][_0x1dbb('0x63')](0x0));var _0x5b7de7=util[_0x1dbb('0x1f')](_0x1dbb('0x64'),_0x289f96[_0x1dbb('0x4f')],_0x153af4['id']);if(_0x2e42dc>0x6){_0x5b7de7=util[_0x1dbb('0x1f')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x289f96[_0x1dbb('0x4f')],_0x153af4['id']);}logger[_0x1dbb('0x8')](_0x1dbb('0x54'),_0x1dbb('0x65'));emit(util[_0x1dbb('0x1f')](_0x1dbb('0x66'),_0x23936d[_0x1dbb('0xa')]),_0x1dbb('0x67'),{'uri':_0x5b7de7});})[_0x1dbb('0x68')](function(_0x587c3d){logger[_0x1dbb('0x69')](_0x1dbb('0x54'),JSON[_0x1dbb('0x1d')](_0x587c3d));});};exports[_0x1dbb('0x6a')]=function(_0x39f3f3,_0x5c8f3c,_0x40927c,_0x299fa9,_0x48a091,_0x38a943,_0x2c4a2e){var _0x3d89bc,_0x1453c7,_0x144840,_0x38d79d;_0x38a943[_0x1dbb('0x4f')]=intUtil['stripTrailingSlash'](_0x38a943['remoteUri']);_0x38a943[_0x1dbb('0x51')]=intUtil[_0x1dbb('0x50')](_0x38a943[_0x1dbb('0x51')]);def[_0x1dbb('0x6b')]=util[_0x1dbb('0x1f')](_0x1dbb('0x52'),_0x38a943['remoteUri']);if(_0x2c4a2e&&_0x2c4a2e[_0x1dbb('0x6c')]&&_0x2c4a2e['recordingFormat']!=='none'){logger[_0x1dbb('0x8')](_0x1dbb('0x6d'),_0x1dbb('0x55'));_0x5c8f3c[_0x1dbb('0x56')]=util[_0x1dbb('0x1f')](_0x1dbb('0x57'),_0x38a943[_0x1dbb('0x51')],_0x5c8f3c[_0x1dbb('0x58')],md5(_0x5c8f3c['uniqueid']));}return getConnection(_0x38a943)[_0x1dbb('0x2c')](function(_0x12325d){_0x38d79d=_0x12325d;return getUser(_0x38a943,_0x299fa9[_0x1dbb('0xa')],_0x38d79d);})[_0x1dbb('0x2c')](function(_0x541cab){_0x3d89bc=_0x541cab;logger[_0x1dbb('0x8')]('The\x20User\x20ID\x20is:',_0x3d89bc['id']);return getEndUser(_0x38a943,_0x5c8f3c[_0x1dbb('0x6e')],_0x5c8f3c[_0x1dbb('0x6f')],_0x38d79d);})['then'](function(_0x241974){_0x1453c7=_0x241974;logger[_0x1dbb('0x8')](_0x1dbb('0x5c'),_0x1453c7['id']);return getTicket(_0x38a943,_0x3d89bc,_0x1453c7,_0x40927c,_0x5c8f3c,_0x40927c[_0x1dbb('0x5d')],_0x38d79d,_0x1dbb('0x70'));})['then'](function(_0x3a155d){_0x144840=_0x3a155d;logger[_0x1dbb('0x8')](_0x1dbb('0x5f'));logger[_0x1dbb('0x8')](_0x1dbb('0x60'),_0x144840['id']);return setRelationship(_0x38d79d,_0x3d89bc,_0x144840,_0x1dbb('0x71'));})['then'](function(){return setRelationship(_0x38d79d,_0x1453c7,_0x144840,_0x1dbb('0x61'));})['then'](function(){return getServerInfo(_0x38d79d);})['then'](function(_0x39b4e1){var _0x5e4db2=parseInt(_0x39b4e1[_0x1dbb('0x62')][_0x1dbb('0x63')](0x0));var _0x3990b8=util[_0x1dbb('0x1f')](_0x1dbb('0x64'),_0x38a943[_0x1dbb('0x4f')],_0x144840['id']);if(_0x5e4db2>0x6){_0x3990b8=util['format'](_0x1dbb('0x72'),_0x38a943[_0x1dbb('0x4f')],_0x144840['id']);}logger[_0x1dbb('0x8')](_0x1dbb('0x6d'),_0x1dbb('0x65'));emit(util['format']('user:%s',_0x299fa9[_0x1dbb('0xa')]),_0x1dbb('0x67'),{'uri':_0x3990b8});})['catch'](function(_0x20218a){logger[_0x1dbb('0x69')](_0x1dbb('0x6d'),JSON['stringify'](_0x20218a));});};exports['unmanaged']=function(_0x2968f5,_0x29be95,_0x16778f,_0x3500ce,_0x56cd19,_0x1bafe6){var _0x231c2d,_0x3e65d9,_0x43788f,_0x986f4f;_0x1bafe6['remoteUri']=intUtil[_0x1dbb('0x50')](_0x1bafe6[_0x1dbb('0x4f')]);_0x1bafe6[_0x1dbb('0x51')]=intUtil[_0x1dbb('0x50')](_0x1bafe6[_0x1dbb('0x51')]);def[_0x1dbb('0x6b')]=util[_0x1dbb('0x1f')](_0x1dbb('0x52'),_0x1bafe6[_0x1dbb('0x4f')]);if(_0x56cd19&&_0x56cd19['monitor_format']){logger[_0x1dbb('0x8')]('['+_0x29be95['lastevent'][_0x1dbb('0x73')]()+']','Recording\x20is\x20enabled!');_0x29be95[_0x1dbb('0x56')]=util[_0x1dbb('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1bafe6[_0x1dbb('0x51')],_0x29be95[_0x1dbb('0x58')],md5(_0x29be95[_0x1dbb('0x58')]));}else{_0x29be95[_0x1dbb('0x56')]='';}return getConnection(_0x1bafe6)[_0x1dbb('0x2c')](function(_0x5eaf4b){_0x986f4f=_0x5eaf4b;if(!_[_0x1dbb('0x26')](_0x3500ce)){return getUser(_0x1bafe6,_0x3500ce[_0x1dbb('0xa')],_0x986f4f);}else{return getUser(_0x1bafe6,null,_0x986f4f);}})[_0x1dbb('0x2c')](function(_0x1aae58){_0x231c2d=_0x1aae58;logger[_0x1dbb('0x8')](_0x1dbb('0x59'),_0x231c2d['id']);return getEndUser(_0x1bafe6,_0x29be95['calleridname'],_0x29be95[_0x1dbb('0x5b')],_0x986f4f);})[_0x1dbb('0x2c')](function(_0x2939a0){_0x3e65d9=_0x2939a0;logger[_0x1dbb('0x8')]('The\x20Enduser\x20ID\x20is:',_0x3e65d9['id']);return getTicket(_0x1bafe6,_0x231c2d,_0x3e65d9,_0x16778f,_0x29be95,_0x16778f[_0x1dbb('0x5d')],_0x986f4f,_0x1dbb('0x5e'));})[_0x1dbb('0x2c')](function(_0x21f16e){_0x43788f=_0x21f16e;logger[_0x1dbb('0x8')](_0x1dbb('0x5f'));logger[_0x1dbb('0x8')](_0x1dbb('0x60'),_0x43788f['id']);return setRelationship(_0x986f4f,_0x231c2d,_0x43788f,_0x1dbb('0x71'));})[_0x1dbb('0x2c')](function(){return setRelationship(_0x986f4f,_0x3e65d9,_0x43788f,_0x1dbb('0x61'));})[_0x1dbb('0x2c')](function(){return getServerInfo(_0x986f4f);})['catch'](function(_0x2e3fd8){logger[_0x1dbb('0x69')]('['+_0x29be95[_0x1dbb('0x74')]['toUpperCase']()+']',JSON[_0x1dbb('0x1d')](_0x2e3fd8));});}; \ No newline at end of file +var _0x90b1=['JSON','stringify','format','apiKey','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','push','toString','variable','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','localhost','socket.io-emitter','redis','POST','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','length','forEach','variableName','idField','set_entry'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x90b1,0x1bb));var _0x190b=function(_0xb9b6a6,_0x3691a2){_0xb9b6a6=_0xb9b6a6-0x0;var _0x296039=_0x90b1[_0xb9b6a6];return _0x296039;};'use strict';var _=require(_0x190b('0x0'));var rp=require(_0x190b('0x1'));var BPromise=require(_0x190b('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x190b('0x3'));var intUtil=require(_0x190b('0x4'));var config=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('sugarcrm');config['redis']=_['defaults'](config['redis'],{'host':_0x190b('0x7'),'port':0x18eb});var io=require(_0x190b('0x8'))(new Redis(config[_0x190b('0x9')]));var def={'method':_0x190b('0xa'),'json':!![]};function emit(_0x311161,_0x802924,_0x32c30c){io['to'](_0x311161)['emit'](_0x802924,_0x32c30c);}function getTicket(_0x14b93d,_0x186101,_0x163966,_0x33fd04,_0x41b788,_0x409aa3,_0x3e99a3,_0x1da225){logger['info'](_0x190b('0xb'));var _0x5cf995=new Date();var _0x5701ad=[{'name':_0x190b('0xc'),'value':intUtil[_0x190b('0xd')](_0x33fd04[_0x190b('0xe')],_0x41b788,'\x20')},{'name':_0x190b('0xf'),'value':_0x186101['id']},{'name':_0x190b('0x10'),'value':_0x186101['id']},{'name':_0x190b('0x11'),'value':intUtil[_0x190b('0xd')](_0x33fd04[_0x190b('0x12')],_0x41b788,'\x0a')},{'name':_0x190b('0x13'),'value':_0x5cf995[_0x190b('0x14')]()[_0x190b('0x15')](0x0,0x13)[_0x190b('0x16')]('T','\x20')},{'name':_0x190b('0x17'),'value':'0'},{'name':_0x190b('0x18'),'value':'15'},{'name':_0x190b('0x19'),'value':_0x163966['id']},{'name':_0x190b('0x1a'),'value':_0x190b('0x1b')},{'name':'parent_name','value':_0x163966[_0x190b('0xc')]},{'name':'direction','value':_0x1da225}];if(_0x409aa3[_0x190b('0x1c')]){_[_0x190b('0x1d')](_0x409aa3,function(_0x56d07a){if(_0x41b788[_0x56d07a[_0x190b('0x1e')]]){_0x5701ad['push']({'name':_0x56d07a[_0x190b('0x1f')],'value':_0x41b788[_0x56d07a[_0x190b('0x1e')]]});}});}return request({'form':{'method':_0x190b('0x20'),'input_type':_0x190b('0x21'),'response_type':_0x190b('0x21'),'rest_data':JSON[_0x190b('0x22')]({'session':_0x3e99a3['id'],'module_name':'Calls','name_value_list':_0x5701ad})}});}function getAuth(_0x3ed24c){return util[_0x190b('0x23')]('Basic\x20%s',new Buffer(_0x3ed24c[_0x190b('0x24')]+':X')['toString']('base64'));}function getServerInfo(_0xcd15e5){return request({'form':{'method':_0x190b('0x25'),'input_type':_0x190b('0x21'),'response_type':'JSON','rest_data':JSON[_0x190b('0x22')]({'session':_0xcd15e5['id']})}});}function getUser(_0x2e633e,_0x16e989,_0x292ce3){if(!_[_0x190b('0x26')](_0x16e989)){logger[_0x190b('0x27')](_0x190b('0x28'),_0x16e989);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x190b('0x21'),'rest_data':JSON[_0x190b('0x22')]({'session':_0x292ce3['id'],'module_name':'Employees','query':util['format'](_0x190b('0x29'),_0x16e989),'order_by':'','offset':'0','select_fields':['id','name',_0x190b('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x190b('0x2b')](function(_0x51f8b4){if(_0x51f8b4[_0x190b('0x2c')][_0x190b('0x1c')]){var _0x5c89ab=_[_0x190b('0x2d')](_0x51f8b4[_0x190b('0x2c')],function(_0x359b4a){return _0x359b4a['name_value_list']['user_name'][_0x190b('0x2e')]===_0x16e989;});if(_0x5c89ab){logger['info'](_0x190b('0x2f'));return BPromise[_0x190b('0x30')]({'id':_0x5c89ab['name_value_list']['id'][_0x190b('0x2e')],'name':_0x5c89ab['name_value_list'][_0x190b('0xc')]['value']});}}logger[_0x190b('0x27')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x190b('0x30')]({'id':_0x292ce3[_0x190b('0x31')]['user_id'][_0x190b('0x2e')],'name':_0x292ce3[_0x190b('0x31')][_0x190b('0x2a')][_0x190b('0x2e')]});});}else{logger[_0x190b('0x27')](_0x190b('0x32'));return BPromise[_0x190b('0x30')]({'id':_0x292ce3[_0x190b('0x31')]['user_id']['value'],'name':_0x292ce3[_0x190b('0x31')][_0x190b('0x2a')]['value']});}}function getEndUser(_0x51dea7,_0x2dcd39,_0x3e4dd8,_0x3fbba1){logger[_0x190b('0x27')](_0x190b('0x33'),_0x3e4dd8);return request({'form':{'method':_0x190b('0x34'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x190b('0x22')]({'session':_0x3fbba1['id'],'module_name':_0x190b('0x1b'),'query':util[_0x190b('0x23')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3e4dd8),'order_by':'','offset':'0','select_fields':['id',_0x190b('0xc'),_0x190b('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x190b('0x2b')](function(_0x5a9669){if(_0x5a9669[_0x190b('0x2c')]['length']){var _0x4f12db=_[_0x190b('0x2d')](_0x5a9669[_0x190b('0x2c')],function(_0x5dcaa8){return _0x5dcaa8[_0x190b('0x31')][_0x190b('0x35')][_0x190b('0x2e')]===_0x3e4dd8;});if(_0x4f12db){logger['info'](_0x190b('0x36'));return BPromise[_0x190b('0x30')]({'id':_0x4f12db['name_value_list']['id']['value'],'name':_0x4f12db[_0x190b('0x31')]['name'][_0x190b('0x2e')],'phone':_0x4f12db[_0x190b('0x31')][_0x190b('0x35')][_0x190b('0x2e')]});}}else{logger['info'](_0x190b('0x37'));return request({'form':{'method':'set_entry','input_type':_0x190b('0x21'),'response_type':_0x190b('0x21'),'rest_data':JSON['stringify']({'session':_0x3fbba1['id'],'module_name':_0x190b('0x1b'),'name_value_list':[{'name':_0x190b('0x38'),'value':_0x2dcd39!==_0x190b('0x39')?_0x2dcd39:util['format'](_0x190b('0x3a'),_0x3e4dd8)},{'name':'phone_home','value':_0x3e4dd8}]})}})['then'](function(_0x554486){logger[_0x190b('0x27')](_0x190b('0x3b'));return BPromise[_0x190b('0x30')]({'id':_0x554486['id'],'name':_0x554486[_0x190b('0x2c')]['first_name']['value'],'phone':_0x554486[_0x190b('0x2c')]['phone_home'][_0x190b('0x2e')]});});}});}function request(_0x3d67f0){logger['debug'](_0x190b('0x3c'),JSON[_0x190b('0x22')](_0x3d67f0));return rp(_[_0x190b('0x3d')](def,_0x3d67f0));}function getTags(_0x47e414,_0x4b6584){var _0x33597b=[];if(_0x47e414&&_0x47e414['length']>0x0){_0x33597b=_[_0x190b('0x3e')](_0x47e414,_0x4b6584);}return _0x33597b;}function getCustomFields(_0x596956,_0x1b8d35){var _0x12c276=[];var _0x1ce1f7={'custom_fields':[]};if(_0x596956['length']>0x0){_[_0x190b('0x1d')](_0x596956,function(_0x58e006){if(_0x58e006[_0x190b('0x3f')]===_0x190b('0x40')&&_0x58e006[_0x190b('0x41')]&&!_0x58e006[_0x190b('0x42')]){_0x1ce1f7[_0x58e006[_0x190b('0x41')][_0x190b('0x43')]()]=_0x58e006[_0x190b('0x44')]['toString']();}else if(_0x58e006[_0x190b('0x3f')]===_0x190b('0x40')&&_0x58e006[_0x190b('0x1f')]&&_0x58e006['customField']){_0x1ce1f7[_0x190b('0x45')][_0x190b('0x46')]({'id':_0x58e006[_0x190b('0x1f')],'value':_0x58e006[_0x190b('0x44')][_0x190b('0x47')]()});}else if(_0x58e006['type']===_0x190b('0x48')&&_0x58e006[_0x190b('0x1e')]&&_0x58e006[_0x190b('0x1f')]&&_0x58e006['customField']){_0x1b8d35[_0x58e006[_0x190b('0x1e')]]&&_0x1ce1f7[_0x190b('0x45')][_0x190b('0x46')]({'id':_0x58e006['idField'],'value':_0x1b8d35[_0x58e006['variableName']][_0x190b('0x47')]()});}else if(_0x58e006[_0x190b('0x3f')]===_0x190b('0x49')&&_0x58e006[_0x190b('0x4a')]&&_0x58e006[_0x190b('0x4a')][_0x190b('0xc')]&&_0x58e006['idField']&&_0x58e006[_0x190b('0x42')]){_0x1b8d35[_0x58e006[_0x190b('0x4a')][_0x190b('0xc')]['toLowerCase']()]&&_0x1ce1f7[_0x190b('0x45')][_0x190b('0x46')]({'id':_0x58e006[_0x190b('0x1f')],'value':_0x1b8d35[_0x58e006['Variable'][_0x190b('0xc')][_0x190b('0x43')]()][_0x190b('0x47')]()});}});}return _0x1ce1f7;}function getConnection(_0x3256c0){return request({'method':_0x190b('0xa'),'form':{'method':_0x190b('0x4b'),'input_type':_0x190b('0x21'),'response_type':_0x190b('0x21'),'rest_data':JSON[_0x190b('0x22')]({'user_auth':{'user_name':_0x3256c0[_0x190b('0x4c')],'password':_0x3256c0[_0x190b('0x4d')],'encryption':'PLAIN'},'application':_0x190b('0x4e')})}})['then'](function(_0x1141c6){var _0x18f361=_0x1141c6;if(_0x18f361['id']){def['sessionID']=_0x18f361['id'];return BPromise[_0x190b('0x30')](_0x18f361);}else{throw new Error(util[_0x190b('0x23')](_0x190b('0x4f'),_0x3256c0['id']));}});}function setRelationship(_0x347a23,_0x21b1c3,_0x25036d,_0x618748){return request({'form':{'method':_0x190b('0x50'),'input_type':'JSON','response_type':_0x190b('0x21'),'rest_data':JSON[_0x190b('0x22')]({'session':_0x347a23['id'],'module_name':_0x190b('0x51'),'module_id':_0x25036d['id'],'link_field_name':_0x618748,'related_ids':[_0x21b1c3['id']]})}});}exports['queue']=function(_0x447fc4,_0x4b009d,_0x4a3db4,_0x41b16,_0x4008c4,_0x158c54){var _0x150312,_0x38e63f,_0x20314b,_0x1383e5;_0x158c54[_0x190b('0x52')]=intUtil[_0x190b('0x53')](_0x158c54[_0x190b('0x52')]);_0x158c54[_0x190b('0x54')]=intUtil[_0x190b('0x53')](_0x158c54[_0x190b('0x54')]);def[_0x190b('0x55')]=util['format'](_0x190b('0x56'),_0x158c54[_0x190b('0x52')]);if(_0x4008c4&&_0x4008c4[_0x190b('0x57')]){logger[_0x190b('0x27')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4b009d[_0x190b('0x58')]=util[_0x190b('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x158c54[_0x190b('0x54')],_0x4b009d['uniqueid'],md5(_0x4b009d[_0x190b('0x59')]));}else{_0x4b009d[_0x190b('0x58')]='';}return getConnection(_0x158c54)[_0x190b('0x2b')](function(_0x4d2814){_0x1383e5=_0x4d2814;return getUser(_0x158c54,_0x41b16[_0x190b('0xc')],_0x1383e5);})[_0x190b('0x2b')](function(_0xffe7cb){_0x150312=_0xffe7cb;logger[_0x190b('0x27')](_0x190b('0x5a'),_0x150312['id']);return getEndUser(_0x158c54,_0x4b009d[_0x190b('0x5b')],_0x4b009d[_0x190b('0x5c')],_0x1383e5);})[_0x190b('0x2b')](function(_0x25e2a2){_0x38e63f=_0x25e2a2;logger['info']('The\x20Enduser\x20ID\x20is:',_0x38e63f['id']);return getTicket(_0x158c54,_0x150312,_0x38e63f,_0x4a3db4,_0x4b009d,_0x4a3db4[_0x190b('0x5d')],_0x1383e5,_0x190b('0x5e'));})[_0x190b('0x2b')](function(_0x2a4db8){_0x20314b=_0x2a4db8;logger['info'](_0x190b('0x5f'));logger[_0x190b('0x27')]('The\x20Ticket\x20ID\x20is:',_0x20314b['id']);return setRelationship(_0x1383e5,_0x150312,_0x20314b,_0x190b('0x60'));})[_0x190b('0x2b')](function(){return setRelationship(_0x1383e5,_0x38e63f,_0x20314b,_0x190b('0x61'));})[_0x190b('0x2b')](function(){return getServerInfo(_0x1383e5);})[_0x190b('0x2b')](function(_0x6eeb1e){var _0x8f95e9=parseInt(_0x6eeb1e[_0x190b('0x62')]['charAt'](0x0));var _0x14d1b8=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x158c54[_0x190b('0x52')],_0x20314b['id']);if(_0x8f95e9>0x6){_0x14d1b8=util[_0x190b('0x23')](_0x190b('0x63'),_0x158c54['remoteUri'],_0x20314b['id']);}logger['info'](_0x190b('0x64'),_0x190b('0x65'));emit(util[_0x190b('0x23')](_0x190b('0x66'),_0x41b16[_0x190b('0xc')]),_0x190b('0x67'),{'uri':_0x14d1b8});})[_0x190b('0x68')](function(_0x25ba8d){logger['error'](_0x190b('0x64'),JSON[_0x190b('0x22')](_0x25ba8d));});};exports[_0x190b('0x69')]=function(_0x20b9f0,_0x172f19,_0x5aa9cb,_0x13cda6,_0x3be030,_0x6fe403,_0x4c877e){var _0x5a0493,_0x19103f,_0x33703e,_0x2b0362;_0x6fe403['remoteUri']=intUtil[_0x190b('0x53')](_0x6fe403[_0x190b('0x52')]);_0x6fe403[_0x190b('0x54')]=intUtil[_0x190b('0x53')](_0x6fe403['serverUrl']);def[_0x190b('0x55')]=util['format'](_0x190b('0x56'),_0x6fe403[_0x190b('0x52')]);if(_0x4c877e&&_0x4c877e[_0x190b('0x6a')]&&_0x4c877e[_0x190b('0x6a')]!=='none'){logger[_0x190b('0x27')]('[OUTBOUND]',_0x190b('0x6b'));_0x172f19['recordingURL']=util['format'](_0x190b('0x6c'),_0x6fe403['serverUrl'],_0x172f19[_0x190b('0x59')],md5(_0x172f19[_0x190b('0x59')]));}return getConnection(_0x6fe403)[_0x190b('0x2b')](function(_0x3b6803){_0x2b0362=_0x3b6803;return getUser(_0x6fe403,_0x13cda6[_0x190b('0xc')],_0x2b0362);})['then'](function(_0x2f9922){_0x5a0493=_0x2f9922;logger[_0x190b('0x27')](_0x190b('0x5a'),_0x5a0493['id']);return getEndUser(_0x6fe403,_0x172f19['destcalleridname'],_0x172f19[_0x190b('0x6d')],_0x2b0362);})[_0x190b('0x2b')](function(_0x5f1e3c){_0x19103f=_0x5f1e3c;logger[_0x190b('0x27')](_0x190b('0x6e'),_0x19103f['id']);return getTicket(_0x6fe403,_0x5a0493,_0x19103f,_0x5aa9cb,_0x172f19,_0x5aa9cb[_0x190b('0x5d')],_0x2b0362,'Outbound');})[_0x190b('0x2b')](function(_0x26be58){_0x33703e=_0x26be58;logger[_0x190b('0x27')](_0x190b('0x5f'));logger['info'](_0x190b('0x6f'),_0x33703e['id']);return setRelationship(_0x2b0362,_0x5a0493,_0x33703e,_0x190b('0x60'));})[_0x190b('0x2b')](function(){return setRelationship(_0x2b0362,_0x19103f,_0x33703e,'contacts');})[_0x190b('0x2b')](function(){return getServerInfo(_0x2b0362);})[_0x190b('0x2b')](function(_0x2d969f){var _0x49bd3b=parseInt(_0x2d969f[_0x190b('0x62')][_0x190b('0x70')](0x0));var _0x71f228=util[_0x190b('0x23')](_0x190b('0x71'),_0x6fe403['remoteUri'],_0x33703e['id']);if(_0x49bd3b>0x6){_0x71f228=util['format'](_0x190b('0x63'),_0x6fe403[_0x190b('0x52')],_0x33703e['id']);}logger['info'](_0x190b('0x72'),_0x190b('0x65'));emit(util['format']('user:%s',_0x13cda6[_0x190b('0xc')]),_0x190b('0x67'),{'uri':_0x71f228});})['catch'](function(_0x5a7c9d){logger[_0x190b('0x73')](_0x190b('0x72'),JSON[_0x190b('0x22')](_0x5a7c9d));});};exports[_0x190b('0x74')]=function(_0x172dbf,_0x47c9c6,_0x5c9258,_0x189779,_0x4813ee,_0x254be3){var _0x82050a,_0x472dea,_0x3c9653,_0x16b41f;_0x254be3[_0x190b('0x52')]=intUtil[_0x190b('0x53')](_0x254be3[_0x190b('0x52')]);_0x254be3[_0x190b('0x54')]=intUtil[_0x190b('0x53')](_0x254be3[_0x190b('0x54')]);def['uri']=util[_0x190b('0x23')](_0x190b('0x56'),_0x254be3[_0x190b('0x52')]);if(_0x4813ee&&_0x4813ee['monitor_format']){logger['info']('['+_0x47c9c6[_0x190b('0x75')][_0x190b('0x76')]()+']','Recording\x20is\x20enabled!');_0x47c9c6[_0x190b('0x58')]=util[_0x190b('0x23')](_0x190b('0x6c'),_0x254be3['serverUrl'],_0x47c9c6[_0x190b('0x59')],md5(_0x47c9c6[_0x190b('0x59')]));}else{_0x47c9c6['recordingURL']='';}return getConnection(_0x254be3)[_0x190b('0x2b')](function(_0x2ba27b){_0x16b41f=_0x2ba27b;if(!_['isNil'](_0x189779)){return getUser(_0x254be3,_0x189779[_0x190b('0xc')],_0x16b41f);}else{return getUser(_0x254be3,null,_0x16b41f);}})['then'](function(_0x48c4d0){_0x82050a=_0x48c4d0;logger['info']('The\x20User\x20ID\x20is:',_0x82050a['id']);return getEndUser(_0x254be3,_0x47c9c6[_0x190b('0x5b')],_0x47c9c6[_0x190b('0x5c')],_0x16b41f);})['then'](function(_0x26e8ce){_0x472dea=_0x26e8ce;logger[_0x190b('0x27')]('The\x20Enduser\x20ID\x20is:',_0x472dea['id']);return getTicket(_0x254be3,_0x82050a,_0x472dea,_0x5c9258,_0x47c9c6,_0x5c9258[_0x190b('0x5d')],_0x16b41f,_0x190b('0x5e'));})[_0x190b('0x2b')](function(_0x9bd5ac){_0x3c9653=_0x9bd5ac;logger[_0x190b('0x27')](_0x190b('0x5f'));logger[_0x190b('0x27')](_0x190b('0x6f'),_0x3c9653['id']);return setRelationship(_0x16b41f,_0x82050a,_0x3c9653,_0x190b('0x60'));})['then'](function(){return setRelationship(_0x16b41f,_0x472dea,_0x3c9653,_0x190b('0x61'));})['then'](function(){return getServerInfo(_0x16b41f);})['catch'](function(_0x2c7328){logger[_0x190b('0x73')]('['+_0x47c9c6[_0x190b('0x75')][_0x190b('0x76')]()+']',JSON[_0x190b('0x22')](_0x2c7328));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index c387fa9..eb13504 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 _0x06c0=['stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','getString','length','type','string','content','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','keyContent','variable','%s:\x20%s'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0x06c0,0x10a));var _0x006c=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x06c0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x006c('0x0'));var util=require(_0x006c('0x1'));exports[_0x006c('0x2')]=function(_0xdcb84e,_0x1e1e1d,_0xc3efd1){var _0x4a4c8e=[];if(_0xdcb84e[_0x006c('0x3')]>0x0){var _0x3bab6f=_['sortBy'](_0xdcb84e,['id']);for(var _0x4d8399=0x0;_0x4d8399<_0x3bab6f[_0x006c('0x3')];_0x4d8399++){var _0x1fdddb=_0x3bab6f[_0x4d8399];if(_0x1fdddb[_0x006c('0x4')]===_0x006c('0x5')){_0x4a4c8e['push'](_0x1fdddb[_0x006c('0x6')]);}else if(_0x1fdddb['type']==='variable'&&_0x1fdddb[_0x006c('0x7')]){_0x1e1e1d[_0x1fdddb[_0x006c('0x7')]]&&_0x4a4c8e[_0x006c('0x8')](_0x1e1e1d[_0x1fdddb[_0x006c('0x7')]][_0x006c('0x9')]());}else if(_0x1fdddb['type']===_0x006c('0xa')&&_0x1fdddb[_0x006c('0xb')]&&_0x1fdddb[_0x006c('0xb')][_0x006c('0xc')]){_0x1e1e1d[_0x1fdddb['Variable']['name']['toLowerCase']()]&&_0x4a4c8e[_0x006c('0x8')](_0x1e1e1d[_0x1fdddb[_0x006c('0xb')][_0x006c('0xc')][_0x006c('0xd')]()][_0x006c('0x9')]());}else if(_0x1fdddb[_0x006c('0x4')]==='keyValue'){if(_0x1fdddb[_0x006c('0xe')]===_0x006c('0x5')&&_0x1fdddb[_0x006c('0xf')]){_0x4a4c8e['push'](util[_0x006c('0x10')]('%s:\x20%s',_0x1fdddb[_0x006c('0xf')],_0x1fdddb[_0x006c('0x11')]));}else if(_0x1fdddb[_0x006c('0xe')]===_0x006c('0x12')&&_0x1fdddb[_0x006c('0x7')]&&_0x1fdddb[_0x006c('0xf')]){_0x1e1e1d[_0x1fdddb[_0x006c('0x7')]]&&_0x4a4c8e['push'](util['format'](_0x006c('0x13'),_0x1fdddb[_0x006c('0xf')],_0x1e1e1d[_0x1fdddb[_0x006c('0x7')]]));}else if(_0x1fdddb[_0x006c('0xe')]===_0x006c('0xa')&&_0x1fdddb[_0x006c('0xb')]&&_0x1fdddb['Variable'][_0x006c('0xc')]&&_0x1fdddb[_0x006c('0xf')]){_0x1e1e1d[_0x1fdddb[_0x006c('0xb')][_0x006c('0xc')][_0x006c('0xd')]()]&&_0x4a4c8e[_0x006c('0x8')](util[_0x006c('0x10')](_0x006c('0x13'),_0x1fdddb[_0x006c('0xf')],_0x1e1e1d[_0x1fdddb['Variable']['name'][_0x006c('0xd')]()]));}}}}return _0x4a4c8e['join'](_0xc3efd1);};exports[_0x006c('0x14')]=function(_0x339f47){var _0x4c5e5b=_0x339f47[_0x006c('0x15')](-0x1);if(_0x4c5e5b==='/'){_0x339f47=_0x339f47[_0x006c('0x16')](0x0,_0x339f47['lastIndexOf'](_0x4c5e5b));}return _0x339f47;};exports[_0x006c('0x17')]=function(_0x595b6e){if(!_[_0x006c('0x18')](_0x595b6e)&&_0x595b6e!==''){var _0x217f10=/^(([^<>()\[\]\\.,;:\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 _0x217f10[_0x006c('0x19')](String(_0x595b6e)[_0x006c('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xff28=['push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','stripTrailingSlash','slice','substring','validateEmail','test','util','length','sortBy','type','string'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0xff28,0xd3));var _0x8ff2=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0xff28[_0x48f7cf];return _0xc201c0;};'use strict';var _=require('lodash');var util=require(_0x8ff2('0x0'));exports['getString']=function(_0xd2f6ab,_0x5f0fbd,_0xa15b82){var _0x42a4a4=[];if(_0xd2f6ab[_0x8ff2('0x1')]>0x0){var _0x3b9ce4=_[_0x8ff2('0x2')](_0xd2f6ab,['id']);for(var _0x57e2ba=0x0;_0x57e2ba<_0x3b9ce4['length'];_0x57e2ba++){var _0xe69a2d=_0x3b9ce4[_0x57e2ba];if(_0xe69a2d[_0x8ff2('0x3')]===_0x8ff2('0x4')){_0x42a4a4[_0x8ff2('0x5')](_0xe69a2d['content']);}else if(_0xe69a2d['type']===_0x8ff2('0x6')&&_0xe69a2d['variableName']){_0x5f0fbd[_0xe69a2d[_0x8ff2('0x7')]]&&_0x42a4a4[_0x8ff2('0x5')](_0x5f0fbd[_0xe69a2d['variableName']][_0x8ff2('0x8')]());}else if(_0xe69a2d[_0x8ff2('0x3')]===_0x8ff2('0x9')&&_0xe69a2d['Variable']&&_0xe69a2d[_0x8ff2('0xa')][_0x8ff2('0xb')]){_0x5f0fbd[_0xe69a2d[_0x8ff2('0xa')]['name'][_0x8ff2('0xc')]()]&&_0x42a4a4[_0x8ff2('0x5')](_0x5f0fbd[_0xe69a2d['Variable']['name'][_0x8ff2('0xc')]()][_0x8ff2('0x8')]());}else if(_0xe69a2d[_0x8ff2('0x3')]===_0x8ff2('0xd')){if(_0xe69a2d[_0x8ff2('0xe')]==='string'&&_0xe69a2d[_0x8ff2('0xf')]){_0x42a4a4['push'](util[_0x8ff2('0x10')](_0x8ff2('0x11'),_0xe69a2d[_0x8ff2('0xf')],_0xe69a2d['keyContent']));}else if(_0xe69a2d[_0x8ff2('0xe')]==='variable'&&_0xe69a2d['variableName']&&_0xe69a2d[_0x8ff2('0xf')]){_0x5f0fbd[_0xe69a2d[_0x8ff2('0x7')]]&&_0x42a4a4[_0x8ff2('0x5')](util[_0x8ff2('0x10')]('%s:\x20%s',_0xe69a2d[_0x8ff2('0xf')],_0x5f0fbd[_0xe69a2d[_0x8ff2('0x7')]]));}else if(_0xe69a2d[_0x8ff2('0xe')]==='customVariable'&&_0xe69a2d['Variable']&&_0xe69a2d[_0x8ff2('0xa')][_0x8ff2('0xb')]&&_0xe69a2d[_0x8ff2('0xf')]){_0x5f0fbd[_0xe69a2d['Variable']['name'][_0x8ff2('0xc')]()]&&_0x42a4a4[_0x8ff2('0x5')](util['format'](_0x8ff2('0x11'),_0xe69a2d[_0x8ff2('0xf')],_0x5f0fbd[_0xe69a2d[_0x8ff2('0xa')][_0x8ff2('0xb')][_0x8ff2('0xc')]()]));}}}}return _0x42a4a4[_0x8ff2('0x12')](_0xa15b82);};exports[_0x8ff2('0x13')]=function(_0x37a8d1){var _0x3400e5=_0x37a8d1[_0x8ff2('0x14')](-0x1);if(_0x3400e5==='/'){_0x37a8d1=_0x37a8d1[_0x8ff2('0x15')](0x0,_0x37a8d1['lastIndexOf'](_0x3400e5));}return _0x37a8d1;};exports[_0x8ff2('0x16')]=function(_0x4fdd30){if(!_['isNil'](_0x4fdd30)&&_0x4fdd30!==''){var _0x90707f=/^(([^<>()\[\]\\.,;:\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 _0x90707f[_0x8ff2('0x17')](String(_0x4fdd30)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index aee8f26..6af4cd4 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 _0xc315=['calleridnum','The\x20Enduser\x20ID\x20is:','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','vTiger','redis','localhost','emit','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','merge','Open','getString','Subjects','Descriptions','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','error','getUser','userId','Searching\x20end\x20user\x20with\x20phone','GET','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','lastname','phone','getEndUser','getchallenge','POST','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','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','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','trigger:browser:url','lastevent','toUpperCase'];(function(_0x509404,_0x32fbcf){var _0x14f242=function(_0xd3be3a){while(--_0xd3be3a){_0x509404['push'](_0x509404['shift']());}};_0x14f242(++_0x32fbcf);}(_0xc315,0x137));var _0x5c31=function(_0x59d72e,_0x43ccea){_0x59d72e=_0x59d72e-0x0;var _0x5c94c0=_0xc315[_0x59d72e];return _0x5c94c0;};'use strict';var _=require(_0x5c31('0x0'));var rp=require(_0x5c31('0x1'));var BPromise=require(_0x5c31('0x2'));var md5=require(_0x5c31('0x3'));var util=require(_0x5c31('0x4'));var Redis=require(_0x5c31('0x5'));var intUtil=require(_0x5c31('0x6'));var config=require('../../../../config/environment');var logger=require(_0x5c31('0x7'))(_0x5c31('0x8'));config[_0x5c31('0x9')]=_['defaults'](config[_0x5c31('0x9')],{'host':_0x5c31('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5c31('0x9')]));function emit(_0x159a44,_0x22c844,_0x30cda3){io['to'](_0x159a44)[_0x5c31('0xb')](_0x22c844,_0x30cda3);}function getCustomFields(_0x5c3a93,_0x1eb6a8){var _0x35f515={};if(_0x5c3a93['length']>0x0){_[_0x5c31('0xc')](_0x5c3a93,function(_0x23d689){if(_0x23d689[_0x5c31('0xd')]===_0x5c31('0xe')&&_0x23d689[_0x5c31('0xf')]){_0x35f515[_0x23d689['idField']]=_0x23d689[_0x5c31('0x10')][_0x5c31('0x11')]();}else if(_0x23d689[_0x5c31('0xd')]===_0x5c31('0x12')&&_0x23d689[_0x5c31('0x13')]&&_0x23d689[_0x5c31('0xf')]&&_0x1eb6a8[_0x23d689[_0x5c31('0x13')]]){_0x35f515[_0x23d689[_0x5c31('0xf')]]=_0x1eb6a8[_0x23d689[_0x5c31('0x13')]]['toString']();}else if(_0x23d689['type']===_0x5c31('0x14')&&_0x23d689[_0x5c31('0x15')]&&_0x23d689[_0x5c31('0x15')][_0x5c31('0x16')]&&_0x23d689['idField']&&_0x1eb6a8[_0x23d689['Variable'][_0x5c31('0x16')][_0x5c31('0x17')]()]){_0x35f515[_0x23d689['idField']]=_0x1eb6a8[_0x23d689[_0x5c31('0x15')][_0x5c31('0x16')][_0x5c31('0x17')]()]['toString']();}});}return _0x35f515;}function createTicket(_0x3423f4,_0x3955d7,_0x4deaa9,_0x16789b,_0xa57998,_0x2ac8ca,_0x1b478a){logger[_0x5c31('0x18')]('Creating\x20new\x20ticket...');var _0x1b910a=_[_0x5c31('0x19')]({'parent_id':'','assigned_user_id':_0x3955d7['id'],'ticketpriorities':'Normal','ticketstatus':_0x5c31('0x1a'),'ticket_title':intUtil[_0x5c31('0x1b')](_0x16789b[_0x5c31('0x1c')],_0xa57998,'\x20'),'description':intUtil[_0x5c31('0x1b')](_0x16789b[_0x5c31('0x1d')],_0xa57998,'\x0a'),'contact_id':_0x4deaa9['id']},getCustomFields(_0x2ac8ca,_0xa57998));var _0x2cde3c={'method':'POST','uri':util[_0x5c31('0x1e')](_0x5c31('0x1f'),_0x3423f4['remoteUri']),'form':{'operation':_0x5c31('0x20'),'username':_0x3423f4[_0x5c31('0x21')],'sessionName':_0x1b478a[_0x5c31('0x22')],'elementType':_0x5c31('0x23'),'element':JSON[_0x5c31('0x24')](_0x1b910a)},'json':!![]};return request(_0x2cde3c)[_0x5c31('0x25')](function(_0x1cbad5){if(_0x1cbad5[_0x5c31('0x26')]){return BPromise[_0x5c31('0x27')]({'id':_0x1cbad5[_0x5c31('0x28')]['id']});}else{throw new Error(util['format'](_0x5c31('0x29'),JSON[_0x5c31('0x24')](_0x1cbad5['error'])));}})['catch'](function(_0x1009b3){var _0x8b4d76=_0x1009b3[_0x5c31('0x2a')]||0x1f4;logger['error'](_0x5c31('0x2b'),_0x5c31('0x2c'),_0x8b4d76,JSON[_0x5c31('0x24')](_0x1009b3));});}function getUser(_0x7a164f,_0x30cc2f,_0x5f2ae3){if(intUtil[_0x5c31('0x2d')](_0x30cc2f)){logger['info'](_0x5c31('0x2e'),_0x30cc2f);return request({'method':'GET','uri':util[_0x5c31('0x1e')](_0x5c31('0x1f'),_0x7a164f[_0x5c31('0x2f')]),'qs':{'operation':_0x5c31('0x30'),'username':_0x7a164f[_0x5c31('0x21')],'sessionName':_0x5f2ae3[_0x5c31('0x22')],'query':util[_0x5c31('0x1e')](_0x5c31('0x31'),_0x30cc2f)},'json':!![]})[_0x5c31('0x25')](function(_0x65deda){if(_0x65deda[_0x5c31('0x26')]&&_0x65deda['result']['length']){logger[_0x5c31('0x18')]('Agent\x20found!');return BPromise[_0x5c31('0x27')]({'id':_0x65deda[_0x5c31('0x28')][0x0]['id'],'email':_0x65deda[_0x5c31('0x28')][0x0][_0x5c31('0x32')],'name':_0x65deda[_0x5c31('0x28')][0x0][_0x5c31('0x33')]+'\x20'+_0x65deda[_0x5c31('0x28')][_0x5c31('0x34')]});}else{logger[_0x5c31('0x18')](_0x5c31('0x35'));return BPromise['resolve']({'id':_0x5f2ae3['userId'],'email':_0x7a164f[_0x5c31('0x21')],'name':_0x5c31('0x36')});}})[_0x5c31('0x37')](function(_0x29803e){var _0x3cf279=_0x29803e[_0x5c31('0x2a')]||0x1f4;logger[_0x5c31('0x38')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x5c31('0x39'),_0x3cf279,JSON['stringify'](_0x29803e));});}else{logger[_0x5c31('0x18')](_0x5c31('0x35'));return BPromise[_0x5c31('0x27')]({'id':_0x5f2ae3[_0x5c31('0x3a')],'email':_0x7a164f[_0x5c31('0x21')],'name':_0x5c31('0x36')})[_0x5c31('0x37')](function(_0x1657aa){var _0x6267f9=_0x1657aa['statusCode']||0x1f4;logger[_0x5c31('0x38')](_0x5c31('0x2b'),_0x5c31('0x39'),_0x6267f9,JSON[_0x5c31('0x24')](_0x1657aa));});}}function getEndUser(_0x3dd55a,_0x4efda5,_0x3b73b4,_0x597bd9){logger['info'](_0x5c31('0x3b'),_0x3b73b4);return request({'method':_0x5c31('0x3c'),'uri':util[_0x5c31('0x1e')]('%s/webservice.php',_0x3dd55a[_0x5c31('0x2f')]),'qs':{'operation':_0x5c31('0x30'),'username':_0x3dd55a['username'],'sessionName':_0x597bd9[_0x5c31('0x22')],'query':util[_0x5c31('0x1e')]('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;',_0x3b73b4,_0x3b73b4,_0x3b73b4,_0x3b73b4,_0x3b73b4)},'json':!![]})[_0x5c31('0x25')](function(_0x3631c0){if(_0x3631c0['success']&&_0x3631c0[_0x5c31('0x28')][_0x5c31('0x3d')]){logger['info'](_0x5c31('0x3e'));return BPromise['resolve']({'id':_0x3631c0['result'][0x0]['id'],'name':_0x3631c0[_0x5c31('0x28')][0x0]['firstname']+'\x20'+_0x3631c0['result'][0x0]['lastname'],'phone':_0x3b73b4});}else{logger[_0x5c31('0x18')](_0x5c31('0x3f'));return request({'method':'POST','uri':util['format'](_0x5c31('0x1f'),_0x3dd55a[_0x5c31('0x2f')]),'form':{'operation':_0x5c31('0x20'),'sessionName':_0x597bd9[_0x5c31('0x22')],'elementType':'Contacts','element':JSON['stringify']({'lastname':_0x4efda5,'phone':_0x3b73b4,'assigned_user_id':'\x20'})},'json':!![]})[_0x5c31('0x25')](function(_0x300a0a){logger[_0x5c31('0x18')](_0x5c31('0x40'));return BPromise['resolve']({'id':_0x300a0a['result']['id'],'name':_0x300a0a[_0x5c31('0x28')][_0x5c31('0x41')],'phone':_0x300a0a[_0x5c31('0x28')][_0x5c31('0x42')]});})[_0x5c31('0x37')](function(_0x53692b){var _0x4ef663=_0x53692b[_0x5c31('0x2a')]||0x1f4;logger[_0x5c31('0x38')](_0x5c31('0x2b'),_0x5c31('0x43'),_0x4ef663,JSON['stringify'](_0x53692b));});}});}function getConnection(_0x115d30){var _0x5236bd=_0x115d30['username'];var _0x56c203=_0x115d30['accessKey'];return request({'method':'GET','uri':util['format'](_0x5c31('0x1f'),_0x115d30[_0x5c31('0x2f')]),'qs':{'operation':_0x5c31('0x44'),'username':_0x5236bd},'json':!![]})['then'](function(_0x57795e){if(_0x57795e[_0x5c31('0x26')]){return request({'method':_0x5c31('0x45'),'uri':util[_0x5c31('0x1e')](_0x5c31('0x1f'),_0x115d30[_0x5c31('0x2f')]),'form':{'operation':'login','username':_0x5236bd,'accessKey':md5(_0x57795e[_0x5c31('0x28')][_0x5c31('0x46')]+_0x56c203)},'json':!![]});}})[_0x5c31('0x25')](function(_0x380bae){if(_0x380bae[_0x5c31('0x26')]){return BPromise['resolve'](_0x380bae[_0x5c31('0x28')]);}else{throw new Error(util[_0x5c31('0x1e')](_0x5c31('0x47'),_0x115d30['id']));}})['catch'](function(_0x5d04f4){var _0x5ec8eb=_0x5d04f4[_0x5c31('0x2a')]||0x1f4;logger[_0x5c31('0x38')](_0x5c31('0x2b'),_0x5c31('0x48'),_0x5ec8eb,JSON[_0x5c31('0x24')](_0x5d04f4));});}function request(_0x32d1bc){logger['info'](_0x5c31('0x49'),JSON['stringify'](_0x32d1bc));return rp(_0x32d1bc);}exports[_0x5c31('0x4a')]=function(_0x40b342,_0xe81cc,_0xd96345,_0x272057,_0x2110f9,_0xb4631f){var _0x4dd485,_0x297ce2,_0x20efba,_0x5c4ebe;_0xb4631f[_0x5c31('0x2f')]=intUtil[_0x5c31('0x4b')](_0xb4631f[_0x5c31('0x2f')]);if(_0x2110f9&&_0x2110f9[_0x5c31('0x4c')]){logger['info'](_0x5c31('0x4d'),_0x5c31('0x4e'));_0xe81cc[_0x5c31('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb4631f[_0x5c31('0x50')],_0xe81cc['uniqueid'],md5(_0xe81cc[_0x5c31('0x51')]));}else{_0xe81cc[_0x5c31('0x4f')]='';}return getConnection(_0xb4631f)[_0x5c31('0x25')](function(_0x174087){_0x5c4ebe=_0x174087;return getUser(_0xb4631f,_0x272057[_0x5c31('0x52')],_0x5c4ebe);})[_0x5c31('0x25')](function(_0x4759e0){_0x4dd485=_0x4759e0;logger[_0x5c31('0x18')](_0x5c31('0x53'),_0x4dd485['id']);return getEndUser(_0xb4631f,_0xe81cc[_0x5c31('0x54')],_0xe81cc['calleridnum'],_0x5c4ebe);})[_0x5c31('0x25')](function(_0x267db0){_0x297ce2=_0x267db0;logger[_0x5c31('0x18')]('The\x20Enduser\x20ID\x20is:',_0x297ce2['id']);return createTicket(_0xb4631f,_0x4dd485,_0x297ce2,_0xd96345,_0xe81cc,_0xd96345[_0x5c31('0x55')],_0x5c4ebe);})['then'](function(_0x3c8af5){_0x20efba=_0x3c8af5;logger[_0x5c31('0x18')](_0x5c31('0x56'));logger['info'](_0x5c31('0x57'),_0x20efba['id']);var _0x40ef2d=util[_0x5c31('0x1e')](_0x5c31('0x58'),_0xb4631f[_0x5c31('0x2f')],_[_0x5c31('0x59')](_0x20efba['id'],'x')[0x1]);logger['info']('[QUEUE]',_0x5c31('0x5a'));emit(util[_0x5c31('0x1e')](_0x5c31('0x5b'),_0x272057['name']),'trigger:browser:url',{'uri':_0x40ef2d});})[_0x5c31('0x37')](function(_0x4683b8){logger['error'](_0x5c31('0x4d'),JSON[_0x5c31('0x24')](_0x4683b8));});};exports[_0x5c31('0x5c')]=function(_0x54f704,_0xfbc325,_0x350891,_0x2441ad,_0x33456d,_0x1a1885,_0x354370){var _0x96c04,_0x300ee1,_0x3c8b8f,_0x5117a1;_0x1a1885['remoteUri']=intUtil[_0x5c31('0x4b')](_0x1a1885[_0x5c31('0x2f')]);_0x1a1885[_0x5c31('0x50')]=intUtil[_0x5c31('0x4b')](_0x1a1885[_0x5c31('0x50')]);if(_0x354370&&_0x354370[_0x5c31('0x5d')]&&_0x354370[_0x5c31('0x5d')]!=='none'){logger[_0x5c31('0x18')](_0x5c31('0x5e'),_0x5c31('0x4e'));_0xfbc325[_0x5c31('0x4f')]=util[_0x5c31('0x1e')](_0x5c31('0x5f'),_0x1a1885[_0x5c31('0x50')],_0xfbc325['uniqueid'],md5(_0xfbc325['uniqueid']));}return getConnection(_0x1a1885)[_0x5c31('0x25')](function(_0xe19c76){_0x5117a1=_0xe19c76;return getUser(_0x1a1885,_0x2441ad[_0x5c31('0x52')],_0x5117a1);})[_0x5c31('0x25')](function(_0x23ceac){_0x96c04=_0x23ceac;logger[_0x5c31('0x18')](_0x5c31('0x53'),_0x96c04['id']);return getEndUser(_0x1a1885,_0xfbc325[_0x5c31('0x60')],_0xfbc325[_0x5c31('0x61')],_0x5117a1);})[_0x5c31('0x25')](function(_0x156e69){_0x300ee1=_0x156e69;logger['info']('The\x20Enduser\x20ID\x20is:',_0x300ee1['id']);return createTicket(_0x1a1885,_0x96c04,_0x300ee1,_0x350891,_0xfbc325,_0x350891[_0x5c31('0x55')],_0x5117a1);})[_0x5c31('0x25')](function(_0x2cfd3a){_0x3c8b8f=_0x2cfd3a;logger[_0x5c31('0x18')](_0x5c31('0x56'));logger[_0x5c31('0x18')](_0x5c31('0x57'),_0x3c8b8f['id']);var _0x34f58a=util[_0x5c31('0x1e')](_0x5c31('0x58'),_0x1a1885[_0x5c31('0x2f')],_[_0x5c31('0x59')](_0x3c8b8f['id'],'x')[0x1]);logger['info'](_0x5c31('0x5e'),_0x5c31('0x5a'));emit(util['format']('user:%s',_0x2441ad[_0x5c31('0x16')]),_0x5c31('0x62'),{'uri':_0x34f58a});})['catch'](function(_0x475a16){logger['error']('[OUTBOUND]',JSON['stringify'](_0x475a16));});};exports['unmanaged']=function(_0x20f658,_0x251440,_0x29b2f5,_0x479f37,_0x185c21,_0x6c36b0){var _0x2794a1,_0x210deb,_0x381b47,_0x2cbd71;_0x6c36b0[_0x5c31('0x2f')]=intUtil[_0x5c31('0x4b')](_0x6c36b0[_0x5c31('0x2f')]);_0x6c36b0[_0x5c31('0x50')]=intUtil[_0x5c31('0x4b')](_0x6c36b0[_0x5c31('0x50')]);if(_0x185c21&&_0x185c21[_0x5c31('0x4c')]){logger['info']('['+_0x251440[_0x5c31('0x63')][_0x5c31('0x64')]()+']','Recording\x20is\x20enabled!');_0x251440[_0x5c31('0x4f')]=util[_0x5c31('0x1e')](_0x5c31('0x5f'),_0x6c36b0[_0x5c31('0x50')],_0x251440[_0x5c31('0x51')],md5(_0x251440[_0x5c31('0x51')]));}else{_0x251440['recordingURL']='';}return getConnection(_0x6c36b0)['then'](function(_0x348117){_0x2cbd71=_0x348117;return getUser(_0x6c36b0,'',_0x2cbd71);})[_0x5c31('0x25')](function(_0x2408b4){_0x2794a1=_0x2408b4;logger[_0x5c31('0x18')](_0x5c31('0x53'),_0x2794a1['id']);return getEndUser(_0x6c36b0,_0x251440[_0x5c31('0x54')],_0x251440[_0x5c31('0x65')],_0x2cbd71);})['then'](function(_0xc66e4f){_0x210deb=_0xc66e4f;logger[_0x5c31('0x18')](_0x5c31('0x66'),_0x210deb['id']);return createTicket(_0x6c36b0,_0x2794a1,_0x210deb,_0x29b2f5,_0x251440,_0x29b2f5['Fields'],_0x2cbd71);})['then'](function(_0x1409b5){_0x381b47=_0x1409b5;logger[_0x5c31('0x18')](_0x5c31('0x56'));logger[_0x5c31('0x18')]('The\x20Ticket\x20ID\x20is:',_0x381b47['id']);})[_0x5c31('0x37')](function(_0x416694){logger['error']('['+_0x251440['lastevent'][_0x5c31('0x64')]()+']',JSON[_0x5c31('0x24')](_0x416694));});}; \ No newline at end of file +var _0x6bc4=['../../../../config/environment','../../../../config/logger','vTiger','defaults','redis','emit','length','forEach','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','format','%s/webservice.php','remoteUri','create','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','resolve','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','sessionName','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','lastname','POST','Contacts','Enduser\x20created.','phone','GET','getchallenge','getConnection','[HTTP]','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','email','destcalleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','toUpperCase','lodash','request-promise','util','ioredis'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0x6bc4,0x1c3));var _0x46bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6bc4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x46bc('0x0'));var rp=require(_0x46bc('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x46bc('0x2'));var Redis=require(_0x46bc('0x3'));var intUtil=require('./util');var config=require(_0x46bc('0x4'));var logger=require(_0x46bc('0x5'))(_0x46bc('0x6'));config['redis']=_[_0x46bc('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x46bc('0x8')]));function emit(_0x58e98e,_0x3e9cbd,_0x244050){io['to'](_0x58e98e)[_0x46bc('0x9')](_0x3e9cbd,_0x244050);}function getCustomFields(_0x448654,_0x4d7bdc){var _0x3ea31b={};if(_0x448654[_0x46bc('0xa')]>0x0){_[_0x46bc('0xb')](_0x448654,function(_0x2fa5fe){if(_0x2fa5fe[_0x46bc('0xc')]==='string'&&_0x2fa5fe[_0x46bc('0xd')]){_0x3ea31b[_0x2fa5fe[_0x46bc('0xd')]]=_0x2fa5fe[_0x46bc('0xe')]['toString']();}else if(_0x2fa5fe[_0x46bc('0xc')]===_0x46bc('0xf')&&_0x2fa5fe[_0x46bc('0x10')]&&_0x2fa5fe[_0x46bc('0xd')]&&_0x4d7bdc[_0x2fa5fe[_0x46bc('0x10')]]){_0x3ea31b[_0x2fa5fe[_0x46bc('0xd')]]=_0x4d7bdc[_0x2fa5fe['variableName']][_0x46bc('0x11')]();}else if(_0x2fa5fe[_0x46bc('0xc')]===_0x46bc('0x12')&&_0x2fa5fe[_0x46bc('0x13')]&&_0x2fa5fe[_0x46bc('0x13')]['name']&&_0x2fa5fe['idField']&&_0x4d7bdc[_0x2fa5fe[_0x46bc('0x13')][_0x46bc('0x14')]['toLowerCase']()]){_0x3ea31b[_0x2fa5fe[_0x46bc('0xd')]]=_0x4d7bdc[_0x2fa5fe[_0x46bc('0x13')][_0x46bc('0x14')][_0x46bc('0x15')]()][_0x46bc('0x11')]();}});}return _0x3ea31b;}function createTicket(_0xf68ef6,_0x261cc3,_0x107d3b,_0x56d32d,_0x445915,_0x335dd0,_0x4c6fe9){logger[_0x46bc('0x16')](_0x46bc('0x17'));var _0xac5fd3=_[_0x46bc('0x18')]({'parent_id':'','assigned_user_id':_0x261cc3['id'],'ticketpriorities':_0x46bc('0x19'),'ticketstatus':_0x46bc('0x1a'),'ticket_title':intUtil[_0x46bc('0x1b')](_0x56d32d['Subjects'],_0x445915,'\x20'),'description':intUtil[_0x46bc('0x1b')](_0x56d32d['Descriptions'],_0x445915,'\x0a'),'contact_id':_0x107d3b['id']},getCustomFields(_0x335dd0,_0x445915));var _0xf21a72={'method':'POST','uri':util[_0x46bc('0x1c')](_0x46bc('0x1d'),_0xf68ef6[_0x46bc('0x1e')]),'form':{'operation':_0x46bc('0x1f'),'username':_0xf68ef6['username'],'sessionName':_0x4c6fe9['sessionName'],'elementType':'HelpDesk','element':JSON['stringify'](_0xac5fd3)},'json':!![]};return request(_0xf21a72)[_0x46bc('0x20')](function(_0x146af7){if(_0x146af7['success']){return BPromise['resolve']({'id':_0x146af7[_0x46bc('0x21')]['id']});}else{throw new Error(util[_0x46bc('0x1c')](_0x46bc('0x22'),JSON[_0x46bc('0x23')](_0x146af7[_0x46bc('0x24')])));}})[_0x46bc('0x25')](function(_0x3ddb2c){var _0x26f24f=_0x3ddb2c[_0x46bc('0x26')]||0x1f4;logger[_0x46bc('0x24')]('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x26f24f,JSON[_0x46bc('0x23')](_0x3ddb2c));});}function getUser(_0x231854,_0x57e3d4,_0x190a95){if(intUtil['validateEmail'](_0x57e3d4)){logger[_0x46bc('0x16')]('Getting\x20agent\x20with\x20email',_0x57e3d4);return request({'method':'GET','uri':util[_0x46bc('0x1c')](_0x46bc('0x1d'),_0x231854[_0x46bc('0x1e')]),'qs':{'operation':_0x46bc('0x27'),'username':_0x231854[_0x46bc('0x28')],'sessionName':_0x190a95['sessionName'],'query':util[_0x46bc('0x1c')](_0x46bc('0x29'),_0x57e3d4)},'json':!![]})[_0x46bc('0x20')](function(_0xf0a0e8){if(_0xf0a0e8[_0x46bc('0x2a')]&&_0xf0a0e8[_0x46bc('0x21')]['length']){logger[_0x46bc('0x16')](_0x46bc('0x2b'));return BPromise[_0x46bc('0x2c')]({'id':_0xf0a0e8[_0x46bc('0x21')][0x0]['id'],'email':_0xf0a0e8[_0x46bc('0x21')][0x0][_0x46bc('0x2d')],'name':_0xf0a0e8['result'][0x0][_0x46bc('0x2e')]+'\x20'+_0xf0a0e8[_0x46bc('0x21')][_0x46bc('0x2f')]});}else{logger[_0x46bc('0x16')](_0x46bc('0x30'));return BPromise[_0x46bc('0x2c')]({'id':_0x190a95[_0x46bc('0x31')],'email':_0x231854[_0x46bc('0x28')],'name':_0x46bc('0x32')});}})[_0x46bc('0x25')](function(_0x91a66d){var _0x1af4bb=_0x91a66d[_0x46bc('0x26')]||0x1f4;logger[_0x46bc('0x24')](_0x46bc('0x33'),_0x46bc('0x34'),_0x1af4bb,JSON[_0x46bc('0x23')](_0x91a66d));});}else{logger[_0x46bc('0x16')](_0x46bc('0x30'));return BPromise['resolve']({'id':_0x190a95[_0x46bc('0x31')],'email':_0x231854['username'],'name':'admin'})[_0x46bc('0x25')](function(_0x4a3b05){var _0x4af885=_0x4a3b05[_0x46bc('0x26')]||0x1f4;logger[_0x46bc('0x24')](_0x46bc('0x33'),'getUser',_0x4af885,JSON[_0x46bc('0x23')](_0x4a3b05));});}}function getEndUser(_0x2b9667,_0x1616ec,_0x12aeff,_0x18e789){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x12aeff);return request({'method':'GET','uri':util[_0x46bc('0x1c')]('%s/webservice.php',_0x2b9667['remoteUri']),'qs':{'operation':_0x46bc('0x27'),'username':_0x2b9667['username'],'sessionName':_0x18e789[_0x46bc('0x35')],'query':util['format'](_0x46bc('0x36'),_0x12aeff,_0x12aeff,_0x12aeff,_0x12aeff,_0x12aeff)},'json':!![]})[_0x46bc('0x20')](function(_0x32048f){if(_0x32048f[_0x46bc('0x2a')]&&_0x32048f[_0x46bc('0x21')][_0x46bc('0xa')]){logger[_0x46bc('0x16')](_0x46bc('0x37'));return BPromise[_0x46bc('0x2c')]({'id':_0x32048f[_0x46bc('0x21')][0x0]['id'],'name':_0x32048f[_0x46bc('0x21')][0x0]['firstname']+'\x20'+_0x32048f['result'][0x0][_0x46bc('0x38')],'phone':_0x12aeff});}else{logger[_0x46bc('0x16')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x46bc('0x39'),'uri':util[_0x46bc('0x1c')](_0x46bc('0x1d'),_0x2b9667[_0x46bc('0x1e')]),'form':{'operation':_0x46bc('0x1f'),'sessionName':_0x18e789[_0x46bc('0x35')],'elementType':_0x46bc('0x3a'),'element':JSON[_0x46bc('0x23')]({'lastname':_0x1616ec,'phone':_0x12aeff,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x50e5a4){logger[_0x46bc('0x16')](_0x46bc('0x3b'));return BPromise[_0x46bc('0x2c')]({'id':_0x50e5a4[_0x46bc('0x21')]['id'],'name':_0x50e5a4['result'][_0x46bc('0x38')],'phone':_0x50e5a4['result'][_0x46bc('0x3c')]});})[_0x46bc('0x25')](function(_0xbbb7c3){var _0x26a1fb=_0xbbb7c3[_0x46bc('0x26')]||0x1f4;logger[_0x46bc('0x24')](_0x46bc('0x33'),'getEndUser',_0x26a1fb,JSON[_0x46bc('0x23')](_0xbbb7c3));});}});}function getConnection(_0x280122){var _0x3ceef2=_0x280122[_0x46bc('0x28')];var _0x28af21=_0x280122['accessKey'];return request({'method':_0x46bc('0x3d'),'uri':util[_0x46bc('0x1c')](_0x46bc('0x1d'),_0x280122[_0x46bc('0x1e')]),'qs':{'operation':_0x46bc('0x3e'),'username':_0x3ceef2},'json':!![]})[_0x46bc('0x20')](function(_0x384984){if(_0x384984[_0x46bc('0x2a')]){return request({'method':_0x46bc('0x39'),'uri':util[_0x46bc('0x1c')](_0x46bc('0x1d'),_0x280122[_0x46bc('0x1e')]),'form':{'operation':'login','username':_0x3ceef2,'accessKey':md5(_0x384984[_0x46bc('0x21')]['token']+_0x28af21)},'json':!![]});}})['then'](function(_0xdee44){if(_0xdee44['success']){return BPromise[_0x46bc('0x2c')](_0xdee44[_0x46bc('0x21')]);}else{throw new Error(util[_0x46bc('0x1c')]('Account\x20%d\x20is\x20not\x20valid',_0x280122['id']));}})[_0x46bc('0x25')](function(_0x1917c6){var _0x36cba7=_0x1917c6[_0x46bc('0x26')]||0x1f4;logger[_0x46bc('0x24')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x46bc('0x3f'),_0x36cba7,JSON[_0x46bc('0x23')](_0x1917c6));});}function request(_0x41a855){logger[_0x46bc('0x16')](_0x46bc('0x40'),JSON[_0x46bc('0x23')](_0x41a855));return rp(_0x41a855);}exports['queue']=function(_0x62bebb,_0x3c7afb,_0x5f42e9,_0x31144b,_0x55d7a0,_0x40dbf8){var _0x7e5230,_0x569082,_0x3377b3,_0x376dc8;_0x40dbf8['remoteUri']=intUtil[_0x46bc('0x41')](_0x40dbf8['remoteUri']);if(_0x55d7a0&&_0x55d7a0[_0x46bc('0x42')]){logger[_0x46bc('0x16')]('[QUEUE]',_0x46bc('0x43'));_0x3c7afb[_0x46bc('0x44')]=util[_0x46bc('0x1c')](_0x46bc('0x45'),_0x40dbf8[_0x46bc('0x46')],_0x3c7afb[_0x46bc('0x47')],md5(_0x3c7afb[_0x46bc('0x47')]));}else{_0x3c7afb[_0x46bc('0x44')]='';}return getConnection(_0x40dbf8)[_0x46bc('0x20')](function(_0x2c8e3a){_0x376dc8=_0x2c8e3a;return getUser(_0x40dbf8,_0x31144b['email'],_0x376dc8);})[_0x46bc('0x20')](function(_0x253169){_0x7e5230=_0x253169;logger['info'](_0x46bc('0x48'),_0x7e5230['id']);return getEndUser(_0x40dbf8,_0x3c7afb[_0x46bc('0x49')],_0x3c7afb[_0x46bc('0x4a')],_0x376dc8);})[_0x46bc('0x20')](function(_0x42d3b3){_0x569082=_0x42d3b3;logger['info'](_0x46bc('0x4b'),_0x569082['id']);return createTicket(_0x40dbf8,_0x7e5230,_0x569082,_0x5f42e9,_0x3c7afb,_0x5f42e9['Fields'],_0x376dc8);})[_0x46bc('0x20')](function(_0x5916d9){_0x3377b3=_0x5916d9;logger['info']('Ticket\x20created!');logger[_0x46bc('0x16')]('The\x20Ticket\x20ID\x20is:',_0x3377b3['id']);var _0x3a7dfe=util[_0x46bc('0x1c')](_0x46bc('0x4c'),_0x40dbf8[_0x46bc('0x1e')],_[_0x46bc('0x4d')](_0x3377b3['id'],'x')[0x1]);logger[_0x46bc('0x16')](_0x46bc('0x4e'),_0x46bc('0x4f'));emit(util[_0x46bc('0x1c')](_0x46bc('0x50'),_0x31144b['name']),_0x46bc('0x51'),{'uri':_0x3a7dfe});})['catch'](function(_0x3095ff){logger[_0x46bc('0x24')](_0x46bc('0x4e'),JSON[_0x46bc('0x23')](_0x3095ff));});};exports[_0x46bc('0x52')]=function(_0x424456,_0x136e83,_0x2760a0,_0x380ded,_0x19e090,_0x109923,_0x41ea6e){var _0x2c6162,_0x524ec2,_0x3bc913,_0x52ef9a;_0x109923[_0x46bc('0x1e')]=intUtil[_0x46bc('0x41')](_0x109923[_0x46bc('0x1e')]);_0x109923[_0x46bc('0x46')]=intUtil[_0x46bc('0x41')](_0x109923[_0x46bc('0x46')]);if(_0x41ea6e&&_0x41ea6e['recordingFormat']&&_0x41ea6e[_0x46bc('0x53')]!=='none'){logger[_0x46bc('0x16')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x136e83[_0x46bc('0x44')]=util[_0x46bc('0x1c')](_0x46bc('0x45'),_0x109923[_0x46bc('0x46')],_0x136e83[_0x46bc('0x47')],md5(_0x136e83[_0x46bc('0x47')]));}return getConnection(_0x109923)['then'](function(_0x488ccf){_0x52ef9a=_0x488ccf;return getUser(_0x109923,_0x380ded[_0x46bc('0x54')],_0x52ef9a);})[_0x46bc('0x20')](function(_0xee7079){_0x2c6162=_0xee7079;logger['info']('The\x20User\x20ID\x20is:',_0x2c6162['id']);return getEndUser(_0x109923,_0x136e83['destcalleridname'],_0x136e83[_0x46bc('0x55')],_0x52ef9a);})[_0x46bc('0x20')](function(_0x1443a1){_0x524ec2=_0x1443a1;logger['info'](_0x46bc('0x4b'),_0x524ec2['id']);return createTicket(_0x109923,_0x2c6162,_0x524ec2,_0x2760a0,_0x136e83,_0x2760a0[_0x46bc('0x56')],_0x52ef9a);})[_0x46bc('0x20')](function(_0x52cb64){_0x3bc913=_0x52cb64;logger['info'](_0x46bc('0x57'));logger['info'](_0x46bc('0x58'),_0x3bc913['id']);var _0x5ca9bb=util[_0x46bc('0x1c')](_0x46bc('0x4c'),_0x109923[_0x46bc('0x1e')],_[_0x46bc('0x4d')](_0x3bc913['id'],'x')[0x1]);logger['info'](_0x46bc('0x59'),_0x46bc('0x4f'));emit(util[_0x46bc('0x1c')]('user:%s',_0x380ded[_0x46bc('0x14')]),_0x46bc('0x51'),{'uri':_0x5ca9bb});})[_0x46bc('0x25')](function(_0x3a7440){logger[_0x46bc('0x24')](_0x46bc('0x59'),JSON[_0x46bc('0x23')](_0x3a7440));});};exports['unmanaged']=function(_0x46f37a,_0x22c5fc,_0x5479c1,_0x25404b,_0x15d6c4,_0x1a74e6){var _0x1d29fe,_0x11d14f,_0x5d3be7,_0x2ee929;_0x1a74e6[_0x46bc('0x1e')]=intUtil['stripTrailingSlash'](_0x1a74e6['remoteUri']);_0x1a74e6[_0x46bc('0x46')]=intUtil[_0x46bc('0x41')](_0x1a74e6['serverUrl']);if(_0x15d6c4&&_0x15d6c4[_0x46bc('0x42')]){logger[_0x46bc('0x16')]('['+_0x22c5fc['lastevent'][_0x46bc('0x5a')]()+']',_0x46bc('0x43'));_0x22c5fc[_0x46bc('0x44')]=util[_0x46bc('0x1c')](_0x46bc('0x45'),_0x1a74e6[_0x46bc('0x46')],_0x22c5fc['uniqueid'],md5(_0x22c5fc[_0x46bc('0x47')]));}else{_0x22c5fc[_0x46bc('0x44')]='';}return getConnection(_0x1a74e6)[_0x46bc('0x20')](function(_0x9c4c6d){_0x2ee929=_0x9c4c6d;return getUser(_0x1a74e6,'',_0x2ee929);})[_0x46bc('0x20')](function(_0x1efb79){_0x1d29fe=_0x1efb79;logger[_0x46bc('0x16')]('The\x20User\x20ID\x20is:',_0x1d29fe['id']);return getEndUser(_0x1a74e6,_0x22c5fc['calleridname'],_0x22c5fc[_0x46bc('0x4a')],_0x2ee929);})[_0x46bc('0x20')](function(_0x3f9d41){_0x11d14f=_0x3f9d41;logger['info'](_0x46bc('0x4b'),_0x11d14f['id']);return createTicket(_0x1a74e6,_0x1d29fe,_0x11d14f,_0x5479c1,_0x22c5fc,_0x5479c1[_0x46bc('0x56')],_0x2ee929);})[_0x46bc('0x20')](function(_0x167118){_0x5d3be7=_0x167118;logger[_0x46bc('0x16')]('Ticket\x20created!');logger[_0x46bc('0x16')]('The\x20Ticket\x20ID\x20is:',_0x5d3be7['id']);})[_0x46bc('0x25')](function(_0x289a01){logger[_0x46bc('0x24')]('['+_0x22c5fc['lastevent'][_0x46bc('0x5a')]()+']',JSON['stringify'](_0x289a01));});}; \ 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 e01543a..3034267 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 _0x0fd9=['toString','base64','debug','[HTTP]','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','push','variableName','customVariable','Variable','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20Ticket\x20ID\x20is:','integrationTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','request-promise','md5','util','ioredis','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s'];(function(_0x105342,_0x5fb601){var _0x52b1d9=function(_0x26097f){while(--_0x26097f){_0x105342['push'](_0x105342['shift']());}};_0x52b1d9(++_0x5fb601);}(_0x0fd9,0xa3));var _0x90fd=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0x0fd9[_0x2f48cd];return _0x193ae2;};'use strict';var _=require('lodash');var rp=require(_0x90fd('0x0'));var md5=require(_0x90fd('0x1'));var util=require(_0x90fd('0x2'));var Redis=require(_0x90fd('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x90fd('0x4'))(_0x90fd('0x5'));config[_0x90fd('0x6')]=_[_0x90fd('0x7')](config[_0x90fd('0x6')],{'host':_0x90fd('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x128c17,_0x50c778,_0x5a604a){io['to'](_0x128c17)[_0x90fd('0x9')](_0x50c778,_0x5a604a);}var headers={'Content-Type':_0x90fd('0xa'),'Accept':'application/json'};function getTicket(_0x234ba9,_0x464236,_0x3c0592,_0x3262f6,_0x289693){logger[_0x90fd('0xb')](_0x90fd('0xc'));return request({'uri':util[_0x90fd('0xd')](_0x90fd('0xe'),_0x234ba9['remoteUri']),'method':_0x90fd('0xf'),'body':{'ticket':_[_0x90fd('0x10')]({'requester_id':_0x3c0592['id'],'submitter_id':_0x464236?_0x464236['id']:undefined,'assignee_id':_0x464236?_0x464236['id']:undefined,'tags':getTags(_0x3262f6['Tags'],_0x90fd('0x11')),'subject':intUtil[_0x90fd('0x12')](_0x3262f6[_0x90fd('0x13')],_0x289693,'\x20'),'description':intUtil['getString'](_0x3262f6[_0x90fd('0x14')],_0x289693,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x3262f6[_0x90fd('0x14')],_0x289693,'\x0a')}},getCustomFields(_0x3262f6[_0x90fd('0x15')],_0x289693))}})[_0x90fd('0x16')](function(_0x1b3f3b){logger[_0x90fd('0xb')](_0x90fd('0x17'));return _0x1b3f3b[_0x90fd('0x18')];});}function getUser(_0x4eb953,_0x4f6b7b){if(intUtil[_0x90fd('0x19')](_0x4f6b7b)){logger[_0x90fd('0xb')]('Getting\x20agent\x20with\x20email',_0x4f6b7b);return request({'uri':util[_0x90fd('0xd')](_0x90fd('0x1a'),_0x4eb953[_0x90fd('0x1b')]),'qs':{'query':util['format'](_0x90fd('0x1c'),_0x4f6b7b)}})[_0x90fd('0x16')](function(_0x16d8a7){if(_0x16d8a7[_0x90fd('0x1d')]){logger[_0x90fd('0xb')](_0x90fd('0x1e'));return _[_0x90fd('0x1f')](_0x16d8a7[_0x90fd('0x20')],{'email':_0x4f6b7b,'role':_0x90fd('0x21')});}else{logger[_0x90fd('0xb')](_0x90fd('0x22'));return request({'uri':util[_0x90fd('0xd')](_0x90fd('0x23'),_0x4eb953[_0x90fd('0x1b')])})[_0x90fd('0x16')](function(_0x493c26){logger[_0x90fd('0xb')](_0x90fd('0x24'));return _0x493c26[_0x90fd('0x25')];});}});}else{logger[_0x90fd('0xb')](_0x90fd('0x22'));return request({'uri':util[_0x90fd('0xd')](_0x90fd('0x23'),_0x4eb953[_0x90fd('0x1b')])})['then'](function(_0x25d19d){logger['info'](_0x90fd('0x24'));return _0x25d19d[_0x90fd('0x25')];});}}function getEndUser(_0x2ffea2,_0x31667c,_0x18beb5){logger['info'](_0x90fd('0x26'),_0x18beb5);return request({'uri':util[_0x90fd('0xd')](_0x90fd('0x1a'),_0x2ffea2[_0x90fd('0x1b')]),'qs':{'query':util[_0x90fd('0xd')](_0x90fd('0x27'),_0x18beb5)}})['then'](function(_0x5671fc){var _0xbf1c9b;if(_0x5671fc[_0x90fd('0x20')][_0x90fd('0x28')]){_0x5671fc[_0x90fd('0x20')]=_[_0x90fd('0x29')](_0x5671fc['results'],{'suspended':![],'role':'end-user'});if(_0x5671fc[_0x90fd('0x20')][_0x90fd('0x28')]){_0xbf1c9b=_[_0x90fd('0x2a')](_0x5671fc[_0x90fd('0x20')]);}}if(_0xbf1c9b){logger['info']('Enduser\x20found!');return _0xbf1c9b;}else{logger[_0x90fd('0xb')](_0x90fd('0x2b'));return request({'uri':util[_0x90fd('0xd')](_0x90fd('0x2c'),_0x2ffea2['remoteUri']),'method':_0x90fd('0xf'),'body':{'user':{'role':_0x90fd('0x2d'),'name':util[_0x90fd('0xd')](_0x90fd('0x2e'),_0x31667c||_0x18beb5),'phone':_0x18beb5}}})[_0x90fd('0x16')](function(_0x204255){logger[_0x90fd('0xb')](_0x90fd('0x2f'));return _0x204255[_0x90fd('0x25')];});}});}function getAuth(_0x244381){var _0x7da2c;if(_0x244381[_0x90fd('0x30')]===_0x90fd('0x31')){_0x7da2c=util[_0x90fd('0xd')](_0x90fd('0x32'),_0x244381[_0x90fd('0x33')],_0x244381['password']);}else if(_0x244381[_0x90fd('0x30')]===_0x90fd('0x34')){_0x7da2c=util[_0x90fd('0xd')](_0x90fd('0x35'),_0x244381[_0x90fd('0x33')],_0x244381[_0x90fd('0x34')]);}return util[_0x90fd('0xd')](_0x90fd('0x36'),new Buffer(_0x7da2c)[_0x90fd('0x37')](_0x90fd('0x38')));}function request(_0xc8a0d6){logger[_0x90fd('0x39')](_0x90fd('0x3a'),JSON['stringify'](_0xc8a0d6));return rp(_[_0x90fd('0x7')](_0xc8a0d6,{'method':_0x90fd('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x1ea5da,_0x35a4a9){var _0x53cac2=[];if(_0x1ea5da&&_0x1ea5da[_0x90fd('0x28')]>0x0){_0x53cac2=_[_0x90fd('0x3c')](_0x1ea5da,_0x35a4a9);}return _0x53cac2;}function getCustomFields(_0xb37e41,_0x591a4e){var _0x543a3e=[];var _0x421177={'custom_fields':[]};if(_0xb37e41[_0x90fd('0x28')]>0x0){_[_0x90fd('0x3d')](_0xb37e41,function(_0xb7c342){if(_0xb7c342[_0x90fd('0x3e')]===_0x90fd('0x3f')&&_0xb7c342[_0x90fd('0x40')]&&!_0xb7c342[_0x90fd('0x41')]){_0x421177[_0xb7c342[_0x90fd('0x40')][_0x90fd('0x42')]()]=_0xb7c342[_0x90fd('0x43')][_0x90fd('0x37')]();}else if(_0xb7c342[_0x90fd('0x3e')]===_0x90fd('0x3f')&&_0xb7c342[_0x90fd('0x44')]&&_0xb7c342[_0x90fd('0x41')]){_0x421177[_0x90fd('0x45')][_0x90fd('0x46')]({'id':_0xb7c342['idField'],'value':_0xb7c342[_0x90fd('0x43')][_0x90fd('0x37')]()});}else if(_0xb7c342[_0x90fd('0x3e')]==='variable'&&_0xb7c342['variableName']&&_0xb7c342['idField']&&_0xb7c342[_0x90fd('0x41')]){_0x591a4e[_0xb7c342[_0x90fd('0x47')]]&&_0x421177[_0x90fd('0x45')][_0x90fd('0x46')]({'id':_0xb7c342[_0x90fd('0x44')],'value':_0x591a4e[_0xb7c342[_0x90fd('0x47')]][_0x90fd('0x37')]()});}else if(_0xb7c342[_0x90fd('0x3e')]===_0x90fd('0x48')&&_0xb7c342[_0x90fd('0x49')]&&_0xb7c342[_0x90fd('0x49')][_0x90fd('0x11')]&&_0xb7c342[_0x90fd('0x44')]&&_0xb7c342[_0x90fd('0x41')]){_0x591a4e[_0xb7c342[_0x90fd('0x49')]['name']['toLowerCase']()]&&_0x421177[_0x90fd('0x45')][_0x90fd('0x46')]({'id':_0xb7c342[_0x90fd('0x44')],'value':_0x591a4e[_0xb7c342['Variable']['name'][_0x90fd('0x42')]()][_0x90fd('0x37')]()});}});}return _0x421177;}exports['queue']=function(_0x4f7cab,_0x3f2769,_0x5fc82e,_0x5604d3,_0x50d4e2,_0x260d16){var _0x24c640,_0x169832;_0x260d16['remoteUri']=intUtil[_0x90fd('0x4a')](_0x260d16[_0x90fd('0x1b')]);_0x260d16['serverUrl']=intUtil['stripTrailingSlash'](_0x260d16['serverUrl']);if(_0x50d4e2&&_0x50d4e2[_0x90fd('0x4b')]){logger[_0x90fd('0xb')]('[QUEUE]',_0x90fd('0x4c'));_0x3f2769[_0x90fd('0x4d')]=util[_0x90fd('0xd')](_0x90fd('0x4e'),_0x260d16[_0x90fd('0x4f')],_0x3f2769['uniqueid'],md5(_0x3f2769['uniqueid']));}else{_0x3f2769[_0x90fd('0x4d')]='';}headers[_0x90fd('0x50')]=getAuth(_0x260d16);return getUser(_0x260d16,_0x5604d3[_0x90fd('0x51')])[_0x90fd('0x16')](function(_0x1c17e9){_0x24c640=_0x1c17e9;logger[_0x90fd('0xb')](_0x90fd('0x52'),_0x24c640['id']);return getEndUser(_0x260d16,_0x3f2769[_0x90fd('0x53')],_0x3f2769[_0x90fd('0x54')]);})[_0x90fd('0x16')](function(_0x491696){_0x169832=_0x491696;logger[_0x90fd('0xb')](_0x90fd('0x55'),_0x169832['id']);return getTicket(_0x260d16,_0x24c640,_0x169832,_0x5fc82e,_0x3f2769);})[_0x90fd('0x16')](function(_0x38021b){if(_0x38021b){logger['info']('The\x20Ticket\x20ID\x20is:',_0x38021b['id']);switch(_0x260d16[_0x90fd('0x3e')]){case'integrationTab':logger['info'](_0x90fd('0x56'),_0x90fd('0x57'));return request({'uri':util[_0x90fd('0xd')](_0x90fd('0x58'),_0x260d16[_0x90fd('0x1b')],_0x24c640['id'],_0x38021b['id']),'method':_0x90fd('0xf')});case _0x90fd('0x59'):logger['info']('[QUEUE]',_0x90fd('0x5a'));emit(util[_0x90fd('0xd')](_0x90fd('0x5b'),_0x5604d3['name']),_0x90fd('0x5c'),{'uri':util[_0x90fd('0xd')](_0x90fd('0x5d'),_0x260d16[_0x90fd('0x1b')],_0x38021b['id'])});break;default:logger[_0x90fd('0x5e')](_0x90fd('0x56'),_0x90fd('0x5f'));}}})[_0x90fd('0x60')](function(_0x4ec476){logger['error'](_0x90fd('0x61'),util[_0x90fd('0x62')](_0x4ec476,{'showHidden':!![],'depth':null}));});};exports[_0x90fd('0x63')]=function(_0x4a1ea1,_0x1147d7,_0x47703e,_0x29b880,_0x24229f,_0x43f75a,_0x408e8d){var _0x59e265,_0x1af513;_0x43f75a['remoteUri']=intUtil[_0x90fd('0x4a')](_0x43f75a['remoteUri']);_0x43f75a[_0x90fd('0x4f')]=intUtil[_0x90fd('0x4a')](_0x43f75a[_0x90fd('0x4f')]);if(_0x408e8d&&_0x408e8d[_0x90fd('0x64')]&&_0x408e8d['recordingFormat']!==_0x90fd('0x65')){logger[_0x90fd('0xb')](_0x90fd('0x66'),_0x90fd('0x4c'));_0x1147d7[_0x90fd('0x4d')]=util[_0x90fd('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x43f75a['serverUrl'],_0x1147d7['uniqueid'],md5(_0x1147d7['uniqueid']));}headers['Authorization']=getAuth(_0x43f75a);return getUser(_0x43f75a,_0x29b880[_0x90fd('0x51')])[_0x90fd('0x16')](function(_0x278db5){_0x59e265=_0x278db5;logger[_0x90fd('0xb')](_0x90fd('0x52'),_0x59e265['id']);return getEndUser(_0x43f75a,_0x1147d7['destcalleridname'],_0x1147d7['destcalleridnum']);})['then'](function(_0x23b9db){_0x1af513=_0x23b9db;logger[_0x90fd('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1af513['id']);return getTicket(_0x43f75a,_0x59e265,_0x1af513,_0x47703e,_0x1147d7);})[_0x90fd('0x16')](function(_0x137df0){if(_0x137df0){logger[_0x90fd('0xb')](_0x90fd('0x67'),_0x137df0['id']);switch(_0x43f75a[_0x90fd('0x3e')]){case _0x90fd('0x68'):logger[_0x90fd('0xb')](_0x90fd('0x66'),_0x90fd('0x57'));return request({'uri':util['format'](_0x90fd('0x58'),_0x43f75a[_0x90fd('0x1b')],_0x59e265['id'],_0x137df0['id']),'method':_0x90fd('0xf')});case'newTab':logger['info'](_0x90fd('0x66'),_0x90fd('0x5a'));emit(util['format'](_0x90fd('0x5b'),_0x29b880['name']),'trigger:browser:url',{'uri':util[_0x90fd('0xd')](_0x90fd('0x5d'),_0x43f75a[_0x90fd('0x1b')],_0x137df0['id'])});break;default:logger[_0x90fd('0x5e')](_0x90fd('0x66'),_0x90fd('0x5f'));}}})[_0x90fd('0x60')](function(_0x337bf9){logger['error'](_0x90fd('0x69'),util[_0x90fd('0x62')](_0x337bf9,{'showHidden':!![],'depth':null}));});};exports[_0x90fd('0x6a')]=function(_0x5afdc7,_0x2d0f4b,_0x4636d5,_0x52c920,_0x5cb475,_0x1a4d3f){var _0x333c8d,_0x122794;_0x1a4d3f['remoteUri']=intUtil[_0x90fd('0x4a')](_0x1a4d3f['remoteUri']);_0x1a4d3f['serverUrl']=intUtil[_0x90fd('0x4a')](_0x1a4d3f['serverUrl']);if(_0x5cb475&&_0x5cb475[_0x90fd('0x4b')]){logger[_0x90fd('0xb')]('['+_0x2d0f4b['lastevent'][_0x90fd('0x6b')]()+']',_0x90fd('0x4c'));_0x2d0f4b[_0x90fd('0x4d')]=util[_0x90fd('0xd')](_0x90fd('0x4e'),_0x1a4d3f[_0x90fd('0x4f')],_0x2d0f4b['uniqueid'],md5(_0x2d0f4b['uniqueid']));}else{_0x2d0f4b['recordingURL']='';}headers['Authorization']=getAuth(_0x1a4d3f);return getUser(_0x1a4d3f)[_0x90fd('0x16')](function(_0x3d55d1){_0x333c8d=_0x3d55d1;logger[_0x90fd('0xb')]('The\x20User\x20ID\x20is:',_0x333c8d['id']);return getEndUser(_0x1a4d3f,_0x2d0f4b[_0x90fd('0x53')],_0x2d0f4b[_0x90fd('0x54')]);})['then'](function(_0x44465e){_0x122794=_0x44465e;logger[_0x90fd('0xb')](_0x90fd('0x55'),_0x122794['id']);return getTicket(_0x1a4d3f,_0x333c8d,_0x122794,_0x4636d5,_0x2d0f4b);})[_0x90fd('0x16')](function(_0x5acecb){if(_0x5acecb){logger[_0x90fd('0xb')](_0x90fd('0x67'),_0x5acecb['id']);}})['catch'](function(_0x4a841e){logger['error']('['+_0x2d0f4b[_0x90fd('0x6c')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x90fd('0x62')](_0x4a841e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4ea3=['trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','%s/token:%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','push','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','recordingURL','destcalleridname','[OUTBOUND]','user:%s'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0x4ea3,0x70));var _0x34ea=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ea3[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x34ea('0x0'));var rp=require(_0x34ea('0x1'));var md5=require(_0x34ea('0x2'));var util=require(_0x34ea('0x3'));var Redis=require('ioredis');var intUtil=require(_0x34ea('0x4'));var config=require('../../../../config/environment');var logger=require(_0x34ea('0x5'))('zendesk');config['redis']=_[_0x34ea('0x6')](config[_0x34ea('0x7')],{'host':_0x34ea('0x8'),'port':0x18eb});var io=require(_0x34ea('0x9'))(new Redis(config[_0x34ea('0x7')]));function emit(_0x18b461,_0x22b09e,_0x5bec7c){io['to'](_0x18b461)[_0x34ea('0xa')](_0x22b09e,_0x5bec7c);}var headers={'Content-Type':_0x34ea('0xb'),'Accept':_0x34ea('0xb')};function getTicket(_0x5132c4,_0x301b98,_0xea1be2,_0x5126de,_0x4a76b1){logger[_0x34ea('0xc')](_0x34ea('0xd'));return request({'uri':util[_0x34ea('0xe')]('%s/tickets.json',_0x5132c4[_0x34ea('0xf')]),'method':_0x34ea('0x10'),'body':{'ticket':_[_0x34ea('0x11')]({'requester_id':_0xea1be2['id'],'submitter_id':_0x301b98?_0x301b98['id']:undefined,'assignee_id':_0x301b98?_0x301b98['id']:undefined,'tags':getTags(_0x5126de[_0x34ea('0x12')],_0x34ea('0x13')),'subject':intUtil[_0x34ea('0x14')](_0x5126de[_0x34ea('0x15')],_0x4a76b1,'\x20'),'description':intUtil[_0x34ea('0x14')](_0x5126de[_0x34ea('0x16')],_0x4a76b1,'\x0a'),'comment':{'public':![],'body':intUtil[_0x34ea('0x14')](_0x5126de[_0x34ea('0x16')],_0x4a76b1,'\x0a')}},getCustomFields(_0x5126de['Fields'],_0x4a76b1))}})[_0x34ea('0x17')](function(_0x89e3f2){logger[_0x34ea('0xc')](_0x34ea('0x18'));return _0x89e3f2[_0x34ea('0x19')];});}function getUser(_0x56b2d7,_0x6a84a7){if(intUtil[_0x34ea('0x1a')](_0x6a84a7)){logger[_0x34ea('0xc')](_0x34ea('0x1b'),_0x6a84a7);return request({'uri':util['format'](_0x34ea('0x1c'),_0x56b2d7[_0x34ea('0xf')]),'qs':{'query':util[_0x34ea('0xe')]('type:user\x20role:agent\x20email:%s',_0x6a84a7)}})[_0x34ea('0x17')](function(_0x1353de){if(_0x1353de[_0x34ea('0x1d')]){logger[_0x34ea('0xc')]('Agent\x20found!');return _[_0x34ea('0x1e')](_0x1353de[_0x34ea('0x1f')],{'email':_0x6a84a7,'role':_0x34ea('0x20')});}else{logger[_0x34ea('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x34ea('0x21'),_0x56b2d7[_0x34ea('0xf')])})[_0x34ea('0x17')](function(_0x51022f){logger['info'](_0x34ea('0x22'));return _0x51022f[_0x34ea('0x23')];});}});}else{logger[_0x34ea('0xc')](_0x34ea('0x24'));return request({'uri':util[_0x34ea('0xe')](_0x34ea('0x21'),_0x56b2d7['remoteUri'])})[_0x34ea('0x17')](function(_0x46671f){logger[_0x34ea('0xc')](_0x34ea('0x22'));return _0x46671f['user'];});}}function getEndUser(_0x56f320,_0x564d1b,_0x142709){logger[_0x34ea('0xc')](_0x34ea('0x25'),_0x142709);return request({'uri':util[_0x34ea('0xe')]('%s/search.json',_0x56f320[_0x34ea('0xf')]),'qs':{'query':util[_0x34ea('0xe')](_0x34ea('0x26'),_0x142709)}})['then'](function(_0x4cded8){var _0x5b4727;if(_0x4cded8['results'][_0x34ea('0x27')]){_0x4cded8[_0x34ea('0x1f')]=_[_0x34ea('0x28')](_0x4cded8[_0x34ea('0x1f')],{'suspended':![],'role':'end-user'});if(_0x4cded8[_0x34ea('0x1f')]['length']){_0x5b4727=_[_0x34ea('0x29')](_0x4cded8['results']);}}if(_0x5b4727){logger[_0x34ea('0xc')](_0x34ea('0x2a'));return _0x5b4727;}else{logger[_0x34ea('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x34ea('0xe')](_0x34ea('0x2b'),_0x56f320['remoteUri']),'method':_0x34ea('0x10'),'body':{'user':{'role':'end-user','name':util[_0x34ea('0xe')](_0x34ea('0x2c'),_0x564d1b||_0x142709),'phone':_0x142709}}})[_0x34ea('0x17')](function(_0x5ead76){logger['info'](_0x34ea('0x2d'));return _0x5ead76['user'];});}});}function getAuth(_0x151fac){var _0x359a31;if(_0x151fac['authType']===_0x34ea('0x2e')){_0x359a31=util[_0x34ea('0xe')](_0x34ea('0x2f'),_0x151fac[_0x34ea('0x30')],_0x151fac['password']);}else if(_0x151fac['authType']==='token'){_0x359a31=util[_0x34ea('0xe')](_0x34ea('0x31'),_0x151fac[_0x34ea('0x30')],_0x151fac['token']);}return util['format']('Basic\x20%s',new Buffer(_0x359a31)[_0x34ea('0x32')](_0x34ea('0x33')));}function request(_0x583e2d){logger[_0x34ea('0x34')](_0x34ea('0x35'),JSON[_0x34ea('0x36')](_0x583e2d));return rp(_[_0x34ea('0x6')](_0x583e2d,{'method':_0x34ea('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x185883,_0x4e99e4){var _0x2faf49=[];if(_0x185883&&_0x185883[_0x34ea('0x27')]>0x0){_0x2faf49=_[_0x34ea('0x38')](_0x185883,_0x4e99e4);}return _0x2faf49;}function getCustomFields(_0x3a73a1,_0x4f05fc){var _0x5c44ab=[];var _0x6f024c={'custom_fields':[]};if(_0x3a73a1[_0x34ea('0x27')]>0x0){_[_0x34ea('0x39')](_0x3a73a1,function(_0x19f401){if(_0x19f401[_0x34ea('0x3a')]==='string'&&_0x19f401[_0x34ea('0x3b')]&&!_0x19f401[_0x34ea('0x3c')]){_0x6f024c[_0x19f401[_0x34ea('0x3b')][_0x34ea('0x3d')]()]=_0x19f401[_0x34ea('0x3e')][_0x34ea('0x32')]();}else if(_0x19f401[_0x34ea('0x3a')]===_0x34ea('0x3f')&&_0x19f401[_0x34ea('0x40')]&&_0x19f401[_0x34ea('0x3c')]){_0x6f024c[_0x34ea('0x41')][_0x34ea('0x42')]({'id':_0x19f401[_0x34ea('0x40')],'value':_0x19f401[_0x34ea('0x3e')][_0x34ea('0x32')]()});}else if(_0x19f401[_0x34ea('0x3a')]==='variable'&&_0x19f401[_0x34ea('0x43')]&&_0x19f401['idField']&&_0x19f401[_0x34ea('0x3c')]){_0x4f05fc[_0x19f401[_0x34ea('0x43')]]&&_0x6f024c[_0x34ea('0x41')][_0x34ea('0x42')]({'id':_0x19f401[_0x34ea('0x40')],'value':_0x4f05fc[_0x19f401[_0x34ea('0x43')]][_0x34ea('0x32')]()});}else if(_0x19f401[_0x34ea('0x3a')]===_0x34ea('0x44')&&_0x19f401['Variable']&&_0x19f401[_0x34ea('0x45')]['name']&&_0x19f401[_0x34ea('0x40')]&&_0x19f401[_0x34ea('0x3c')]){_0x4f05fc[_0x19f401[_0x34ea('0x45')][_0x34ea('0x13')][_0x34ea('0x3d')]()]&&_0x6f024c[_0x34ea('0x41')]['push']({'id':_0x19f401[_0x34ea('0x40')],'value':_0x4f05fc[_0x19f401[_0x34ea('0x45')]['name'][_0x34ea('0x3d')]()][_0x34ea('0x32')]()});}});}return _0x6f024c;}exports[_0x34ea('0x46')]=function(_0x37de77,_0xf5f2a3,_0x5d8dc9,_0x4384cc,_0x180444,_0x3f7456){var _0x2487bd,_0x3e2e61;_0x3f7456[_0x34ea('0xf')]=intUtil['stripTrailingSlash'](_0x3f7456['remoteUri']);_0x3f7456[_0x34ea('0x47')]=intUtil[_0x34ea('0x48')](_0x3f7456[_0x34ea('0x47')]);if(_0x180444&&_0x180444['monitor_format']){logger[_0x34ea('0xc')]('[QUEUE]',_0x34ea('0x49'));_0xf5f2a3['recordingURL']=util[_0x34ea('0xe')](_0x34ea('0x4a'),_0x3f7456[_0x34ea('0x47')],_0xf5f2a3['uniqueid'],md5(_0xf5f2a3[_0x34ea('0x4b')]));}else{_0xf5f2a3['recordingURL']='';}headers[_0x34ea('0x4c')]=getAuth(_0x3f7456);return getUser(_0x3f7456,_0x4384cc[_0x34ea('0x4d')])[_0x34ea('0x17')](function(_0xb8246e){_0x2487bd=_0xb8246e;logger['info'](_0x34ea('0x4e'),_0x2487bd['id']);return getEndUser(_0x3f7456,_0xf5f2a3[_0x34ea('0x4f')],_0xf5f2a3[_0x34ea('0x50')]);})[_0x34ea('0x17')](function(_0x3df3c8){_0x3e2e61=_0x3df3c8;logger[_0x34ea('0xc')](_0x34ea('0x51'),_0x3e2e61['id']);return getTicket(_0x3f7456,_0x2487bd,_0x3e2e61,_0x5d8dc9,_0xf5f2a3);})['then'](function(_0x1059dc){if(_0x1059dc){logger[_0x34ea('0xc')](_0x34ea('0x52'),_0x1059dc['id']);switch(_0x3f7456[_0x34ea('0x3a')]){case _0x34ea('0x53'):logger[_0x34ea('0xc')](_0x34ea('0x54'),_0x34ea('0x55'));return request({'uri':util[_0x34ea('0xe')](_0x34ea('0x56'),_0x3f7456[_0x34ea('0xf')],_0x2487bd['id'],_0x1059dc['id']),'method':_0x34ea('0x10')});case _0x34ea('0x57'):logger['info'](_0x34ea('0x54'),_0x34ea('0x58'));emit(util[_0x34ea('0xe')]('user:%s',_0x4384cc[_0x34ea('0x13')]),'trigger:browser:url',{'uri':util[_0x34ea('0xe')](_0x34ea('0x59'),_0x3f7456['remoteUri'],_0x1059dc['id'])});break;default:logger[_0x34ea('0x5a')](_0x34ea('0x54'),_0x34ea('0x5b'));}}})['catch'](function(_0x50935b){logger[_0x34ea('0x5a')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x50935b,{'showHidden':!![],'depth':null}));});};exports[_0x34ea('0x5c')]=function(_0x4df7bf,_0x3808ee,_0x2e77c7,_0x3918c5,_0x443c98,_0x46e912,_0x3f844f){var _0x41da1a,_0x6a3da3;_0x46e912[_0x34ea('0xf')]=intUtil[_0x34ea('0x48')](_0x46e912[_0x34ea('0xf')]);_0x46e912[_0x34ea('0x47')]=intUtil[_0x34ea('0x48')](_0x46e912[_0x34ea('0x47')]);if(_0x3f844f&&_0x3f844f[_0x34ea('0x5d')]&&_0x3f844f[_0x34ea('0x5d')]!=='none'){logger[_0x34ea('0xc')]('[OUTBOUND]',_0x34ea('0x49'));_0x3808ee[_0x34ea('0x5e')]=util[_0x34ea('0xe')](_0x34ea('0x4a'),_0x46e912[_0x34ea('0x47')],_0x3808ee[_0x34ea('0x4b')],md5(_0x3808ee['uniqueid']));}headers[_0x34ea('0x4c')]=getAuth(_0x46e912);return getUser(_0x46e912,_0x3918c5[_0x34ea('0x4d')])[_0x34ea('0x17')](function(_0x36c5a0){_0x41da1a=_0x36c5a0;logger[_0x34ea('0xc')]('The\x20User\x20ID\x20is:',_0x41da1a['id']);return getEndUser(_0x46e912,_0x3808ee[_0x34ea('0x5f')],_0x3808ee['destcalleridnum']);})['then'](function(_0x54dc5e){_0x6a3da3=_0x54dc5e;logger[_0x34ea('0xc')]('The\x20Enduser\x20ID\x20is:',_0x6a3da3['id']);return getTicket(_0x46e912,_0x41da1a,_0x6a3da3,_0x2e77c7,_0x3808ee);})[_0x34ea('0x17')](function(_0x53aafe){if(_0x53aafe){logger[_0x34ea('0xc')]('The\x20Ticket\x20ID\x20is:',_0x53aafe['id']);switch(_0x46e912[_0x34ea('0x3a')]){case'integrationTab':logger[_0x34ea('0xc')](_0x34ea('0x60'),_0x34ea('0x55'));return request({'uri':util[_0x34ea('0xe')](_0x34ea('0x56'),_0x46e912['remoteUri'],_0x41da1a['id'],_0x53aafe['id']),'method':'POST'});case _0x34ea('0x57'):logger[_0x34ea('0xc')](_0x34ea('0x60'),_0x34ea('0x58'));emit(util[_0x34ea('0xe')](_0x34ea('0x61'),_0x3918c5[_0x34ea('0x13')]),_0x34ea('0x62'),{'uri':util[_0x34ea('0xe')]('%s/agent/tickets/%s',_0x46e912[_0x34ea('0xf')],_0x53aafe['id'])});break;default:logger[_0x34ea('0x5a')](_0x34ea('0x60'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x13e9c1){logger[_0x34ea('0x5a')](_0x34ea('0x63'),util['inspect'](_0x13e9c1,{'showHidden':!![],'depth':null}));});};exports[_0x34ea('0x64')]=function(_0x3fa4cf,_0x38542d,_0x483c71,_0xeb203a,_0x26a73a,_0x4bba99){var _0x1f3978,_0x2cbc92;_0x4bba99[_0x34ea('0xf')]=intUtil['stripTrailingSlash'](_0x4bba99[_0x34ea('0xf')]);_0x4bba99['serverUrl']=intUtil[_0x34ea('0x48')](_0x4bba99[_0x34ea('0x47')]);if(_0x26a73a&&_0x26a73a[_0x34ea('0x65')]){logger[_0x34ea('0xc')]('['+_0x38542d['lastevent'][_0x34ea('0x66')]()+']',_0x34ea('0x49'));_0x38542d['recordingURL']=util[_0x34ea('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bba99[_0x34ea('0x47')],_0x38542d[_0x34ea('0x4b')],md5(_0x38542d[_0x34ea('0x4b')]));}else{_0x38542d['recordingURL']='';}headers[_0x34ea('0x4c')]=getAuth(_0x4bba99);return getUser(_0x4bba99)[_0x34ea('0x17')](function(_0x2cf2c9){_0x1f3978=_0x2cf2c9;logger[_0x34ea('0xc')]('The\x20User\x20ID\x20is:',_0x1f3978['id']);return getEndUser(_0x4bba99,_0x38542d[_0x34ea('0x4f')],_0x38542d[_0x34ea('0x50')]);})[_0x34ea('0x17')](function(_0x405da9){_0x2cbc92=_0x405da9;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2cbc92['id']);return getTicket(_0x4bba99,_0x1f3978,_0x2cbc92,_0x483c71,_0x38542d);})[_0x34ea('0x17')](function(_0x3200f7){if(_0x3200f7){logger['info'](_0x34ea('0x52'),_0x3200f7['id']);}})[_0x34ea('0x67')](function(_0x30a609){logger['error']('['+_0x38542d['lastevent']['toUpperCase']()+']'+_0x34ea('0x68'),util['inspect'](_0x30a609,{'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 a0abade..fa70c28 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 _0x1775=['trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','monitor_format','calleridname','toUpperCase','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientSecret','refresh_token','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','role','first_name','last_name','SUCCESS','details','startCase','moduleCreate','log','CREATE\x20ERROR','Zoho-oauthtoken\x20','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','lead','Leads','nothing','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','utc','talktime','mm:ss','answertime','endtime','Call_Duration','diff','starttime','called','Call_Result','Called','connect','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','host','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x59c20e,_0x4977bd){var _0x16a81a=function(_0x2c0f48){while(--_0x2c0f48){_0x59c20e['push'](_0x59c20e['shift']());}};_0x16a81a(++_0x4977bd);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var rp=require(_0x5177('0x0'));var md5=require(_0x5177('0x1'));var util=require(_0x5177('0x2'));var intUtil=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var Redis=require(_0x5177('0x5'));var BPromise=require(_0x5177('0x6'));var config=require(_0x5177('0x7'));var logger=require(_0x5177('0x8'))(_0x5177('0x9'));config[_0x5177('0xa')]=_[_0x5177('0xb')](config[_0x5177('0xa')],{'host':_0x5177('0xc'),'port':0x18eb});var io=require(_0x5177('0xd'))(new Redis(config[_0x5177('0xa')]));function emit(_0x363611,_0x3ce288,_0x16e7a7){io['to'](_0x363611)[_0x5177('0xe')](_0x3ce288,_0x16e7a7);}function request(_0x2c23d8){logger[_0x5177('0xf')]('[HTTP]',JSON['stringify'](_0x2c23d8));return rp(_0x2c23d8);}function getCustomFields(_0x13c7f6,_0x1d7116){var _0xf3ce11={};if(_0x13c7f6[_0x5177('0x10')]>0x0){_[_0x5177('0x11')](_0x13c7f6,function(_0x49704c){if(_0x49704c[_0x5177('0x12')]===_0x5177('0x13')&&_0x49704c[_0x5177('0x14')]){_0xf3ce11[_0x49704c[_0x5177('0x14')]]=_0x49704c[_0x5177('0x15')][_0x5177('0x16')]();}else if(_0x49704c[_0x5177('0x12')]===_0x5177('0x17')&&_0x49704c[_0x5177('0x18')]&&_0x49704c[_0x5177('0x14')]&&_0x1d7116[_0x49704c[_0x5177('0x18')]]){_0xf3ce11[_0x49704c[_0x5177('0x14')]]=_0x1d7116[_0x49704c[_0x5177('0x18')]][_0x5177('0x16')]();}else if(_0x49704c[_0x5177('0x12')]===_0x5177('0x19')&&_0x49704c[_0x5177('0x1a')]&&_0x49704c[_0x5177('0x1a')][_0x5177('0x1b')]&&_0x49704c['idField']&&_0x1d7116[_0x49704c[_0x5177('0x1a')][_0x5177('0x1b')][_0x5177('0x1c')]()]){_0xf3ce11[_0x49704c[_0x5177('0x14')]]=_0x1d7116[_0x49704c['Variable'][_0x5177('0x1b')][_0x5177('0x1c')]()][_0x5177('0x16')]();}});}return _0xf3ce11;}function getName(_0x5b5918){if(_0x5b5918[_0x5177('0x1d')]('\x20')>0x0){var _0x4cf600=_0x5b5918[_0x5177('0x1e')](/ (.+)/);if(_0x4cf600[0x1]){return _0x4cf600;}}return[_0x5b5918,_0x5b5918];}var accountsTokens={};function getAccessToken(_0xe221b3){return new Promise(function(_0x219744,_0x27b732){if(!_[_0x5177('0x1f')](accountsTokens[_0xe221b3['id']])&&!_[_0x5177('0x1f')](accountsTokens[_0xe221b3['id']][_0x5177('0x20')])){if(moment()[_0x5177('0x21')](accountsTokens[_0xe221b3['id']][_0x5177('0x22')])){_0x219744(accountsTokens[_0xe221b3['id']][_0x5177('0x20')]);}}var _0x23dad2;switch(_0xe221b3[_0x5177('0x23')]){case'US':_0x23dad2='https://accounts.zoho.com';break;case'AU':_0x23dad2=_0x5177('0x24');break;case'EU':_0x23dad2='https://accounts.zoho.eu';break;case'IN':_0x23dad2=_0x5177('0x25');break;case'CN':_0x23dad2=_0x5177('0x26');break;default:_0x23dad2=_0x5177('0x27');break;}var _0x2d51d0={'method':'POST','uri':_0x23dad2+_0x5177('0x28'),'qs':{'refresh_token':_0xe221b3['refreshToken'],'client_id':_0xe221b3['clientId'],'client_secret':_0xe221b3[_0x5177('0x29')],'grant_type':_0x5177('0x2a')},'json':!![]};return rp(_0x2d51d0)['then'](function(_0x3285b3){accountsTokens[_0xe221b3['id']]={'access_token':_0x3285b3['access_token'],'expires_in':moment()[_0x5177('0x2b')](_0x3285b3[_0x5177('0x22')],'seconds')};_0x219744(_0x3285b3[_0x5177('0x20')]);})[_0x5177('0x2c')](function(_0x3c4248){logger[_0x5177('0x2d')](_0x5177('0x2e'),_0x3c4248[_0x5177('0x2f')]);_0x27b732(_0x3c4248);});});}function getUser(_0x5577bb,_0x498fcd,_0x45cf20,_0x1c660e){logger[_0x5177('0x30')](_0x5177('0x31'));return request({'method':_0x5177('0x32'),'uri':util[_0x5177('0x33')](_0x5177('0x34'),_0x498fcd),'qs':{'type':_0x5177('0x35')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5577bb},'json':!![]})[_0x5177('0x36')](function(_0x2233a2){if(_0x2233a2['users']){var _0x32bea9=-0x1;if(_['isArrayLikeObject'](_0x2233a2[_0x5177('0x37')])){if(!_[_0x5177('0x1f')](_0x1c660e)){_0x32bea9=_[_0x5177('0x38')](_0x2233a2['users'],function(_0x4f70df){return _0x4f70df[_0x5177('0x39')]===_0x1c660e;});}if(_0x32bea9>=0x0){logger[_0x5177('0x30')](_0x5177('0x3a'));}else{logger[_0x5177('0x30')](_0x5177('0x3b'));_0x32bea9=_[_0x5177('0x38')](_0x2233a2[_0x5177('0x37')],function(_0x390b74){return _0x390b74['profile'][_0x5177('0x1b')]===_0x5177('0x3c');});}return _0x2233a2['users'][_0x32bea9];}else{if(_0x2233a2[_0x5177('0x3d')][_0x5177('0x3e')][_0x5177('0x1b')]===_0x5177('0x3c')){logger[_0x5177('0x30')](_0x5177('0x3b'));user=_0x2233a2['user'];return user;}else{logger[_0x5177('0x2d')](_0x5177('0x3f'),JSON[_0x5177('0x40')](_0x2233a2));throw new Error(_0x5177('0x41')+JSON[_0x5177('0x40')](_0x2233a2));}}}else{logger[_0x5177('0x2d')](_0x5177('0x3f'),JSON['stringify'](_0x2233a2));throw new Error(_0x5177('0x41')+JSON[_0x5177('0x40')](_0x2233a2));}})['catch'](function(_0x486dd5){console[_0x5177('0x2d')](_0x486dd5);});}function getZohoUser(_0x188cec,_0x22365a){return new BPromise(function(_0x182c78,_0x3285c3){request(_0x188cec)[_0x5177('0x36')](function(_0x38cadb){var _0x24fd92=null;if(_0x38cadb){_0x24fd92=_0x38cadb[_0x5177('0x42')][0x0];_0x24fd92[_0x5177('0x43')]=_0x22365a;}_0x182c78(_0x24fd92);})[_0x5177('0x2c')](function(_0x1f15f8){_0x3285c3(_0x1f15f8);});});}function createEndUser(_0xd61bc4,_0x55722e,_0x90fb65,_0x2a4db1,_0x4e3677,_0x7341c0){var _0x90fb65=getName(_0x90fb65);return request({'method':_0x5177('0x44'),'uri':_0x5177('0x45')+_0x55722e+_0x5177('0x46')+_['startCase'](_0x7341c0['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x90fb65[0x1],'First_Name':_0x90fb65[0x0],'Phone':_0x2a4db1,'Owner':{'name':!_[_0x5177('0x1f')](_0x4e3677[_0x5177('0x47')][_0x5177('0x1b')])?_0x4e3677[_0x5177('0x47')][_0x5177('0x1b')]:!_[_0x5177('0x1f')](_0x4e3677[_0x5177('0x48')])?_0x4e3677[_0x5177('0x48')]+'\x20'+_0x4e3677['last_name']:_0x4e3677[_0x5177('0x49')],'id':_0x4e3677['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xd61bc4},'json':!![]})['then'](function(_0x30e4f3){if(_0x30e4f3&&_0x30e4f3[_0x5177('0x42')][0x0]['code']===_0x5177('0x4a')){var _0x508178=_0x30e4f3['data'][0x0][_0x5177('0x4b')];_0x508178[_0x5177('0x43')]=_[_0x5177('0x4c')](_0x7341c0[_0x5177('0x4d')])+'s';return _0x508178;}logger[_0x5177('0x2d')](_0x5177('0x3f'),JSON[_0x5177('0x40')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x5177('0x2c')](function(_0x511dc0){console[_0x5177('0x4e')](_0x5177('0x4f'),_0x511dc0);});}function getEndUser(_0x11b846,_0x3ed103,_0x570812,_0x3b7f96,_0x24fe77,_0x363c63,_0x18b045){var _0x2bff80={'method':_0x5177('0x32'),'uri':'','headers':{'Authorization':_0x5177('0x50')+_0x11b846},'json':!![]};switch(_0x18b045[_0x5177('0x51')]){case _0x5177('0x52'):_0x2bff80[_0x5177('0x53')]=_0x5177('0x45')+_0x3ed103+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x24fe77+'))';return getZohoUser(_0x2bff80,_0x5177('0x54'))['then'](function(_0x58a4e6){if(_0x58a4e6)return _0x58a4e6;_0x2bff80['uri']=_0x5177('0x45')+_0x3ed103+_0x5177('0x55')+_0x24fe77+'))';return getZohoUser(_0x2bff80,'Leads')[_0x5177('0x36')](function(_0x2913a2){if(_0x2913a2)return _0x2913a2;if(_0x18b045[_0x5177('0x4d')]!='nothing'){return createEndUser(_0x11b846,_0x3ed103,_0x3b7f96,_0x24fe77,_0x363c63,_0x18b045);}else{return{};}});});break;case _0x5177('0x56'):_0x2bff80['uri']='https://www.zohoapis.'+_0x3ed103+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x24fe77+'))';return getZohoUser(_0x2bff80,_0x5177('0x54'))[_0x5177('0x36')](function(_0x1300d7){if(_0x1300d7)return _0x1300d7;if(_0x18b045['moduleCreate']!='nothing'){return createEndUser(_0x11b846,_0x3ed103,_0x3b7f96,_0x24fe77,_0x363c63,_0x18b045);}else{return{};}});break;case _0x5177('0x57'):_0x2bff80['uri']=_0x5177('0x45')+_0x3ed103+_0x5177('0x55')+_0x24fe77+'))';return getZohoUser(_0x2bff80,_0x5177('0x58'))[_0x5177('0x36')](function(_0x84233c){if(_0x84233c)return _0x84233c;if(_0x18b045[_0x5177('0x4d')]!=_0x5177('0x59')){return createEndUser(_0x11b846,_0x3ed103,_0x3b7f96,_0x24fe77,_0x363c63,_0x18b045);}else{return{};}});break;}}function getCall(_0x12dd42,_0x26c878,_0x217aca,_0x89fe3a,_0xb08267,_0x422d6c,_0x4c2068,_0x59376b){logger[_0x5177('0x30')]('Creating\x20new\x20call...');var _0x649c6f={};_0x649c6f['Owner']={'name':!_[_0x5177('0x1f')](_0x89fe3a[_0x5177('0x47')][_0x5177('0x1b')])&&!_['isNil'](_0x89fe3a['profile'][_0x5177('0x1b')])&&_0x89fe3a[_0x5177('0x3e')][_0x5177('0x1b')]===_0x5177('0x5a')?_0x89fe3a['role']['name']:!_[_0x5177('0x1f')](_0x89fe3a[_0x5177('0x48')])?_0x89fe3a[_0x5177('0x48')]+'\x20'+_0x89fe3a[_0x5177('0x49')]:_0x89fe3a['last_name'],'id':_0x89fe3a['id']};_0x649c6f[_0x5177('0x5b')]=intUtil[_0x5177('0x5c')](_0x422d6c[_0x5177('0x5d')],_0x4c2068,'\x20');_0x649c6f['Description']=intUtil[_0x5177('0x5c')](_0x422d6c[_0x5177('0x5e')],_0x4c2068,'\x0a');if(_0xb08267[_0x5177('0x43')]==='Contacts'){_0x649c6f[_0x5177('0x5f')]={'name':!_['isNil'](_0xb08267[_0x5177('0x60')])?_0xb08267[_0x5177('0x60')]:!_[_0x5177('0x1f')](_0xb08267['First_Name'])?_0xb08267[_0x5177('0x61')]+'\x20'+_0xb08267[_0x5177('0x62')]:_0xb08267[_0x5177('0x62')],'id':_0xb08267['id']};}if(_0xb08267[_0x5177('0x43')]===_0x5177('0x58')){_0x649c6f[_0x5177('0x63')]={'name':!_[_0x5177('0x1f')](_0xb08267[_0x5177('0x60')])?_0xb08267['Full_Name']:!_['isNil'](_0xb08267['First_Name'])?_0xb08267[_0x5177('0x61')]+'\x20'+_0xb08267[_0x5177('0x62')]:_0xb08267[_0x5177('0x62')],'id':_0xb08267['id']};_0x649c6f[_0x5177('0x64')]=_[_0x5177('0x4c')](_0xb08267[_0x5177('0x43')]);}if(_0x4c2068['talktime']){_0x649c6f['Call_Duration']=moment[_0x5177('0x65')](parseInt(_0x4c2068[_0x5177('0x66')])*0x3e8)[_0x5177('0x33')](_0x5177('0x67'));}else if(_0x4c2068[_0x5177('0x68')]&&_0x4c2068[_0x5177('0x69')]){_0x649c6f[_0x5177('0x6a')]=moment[_0x5177('0x65')](moment(_0x4c2068[_0x5177('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0x5177('0x6b')](moment(_0x4c2068[_0x5177('0x6c')],'YYYY-MM-DDTHH:mm:ss')))[_0x5177('0x33')](_0x5177('0x67'));}switch(_0x4c2068['lastevent']){case _0x5177('0x6d'):_0x649c6f[_0x5177('0x6e')]=_0x5177('0x6f');break;case'complete':case _0x5177('0x70'):_0x649c6f[_0x5177('0x6e')]='Answered';break;case'rejected':_0x649c6f[_0x5177('0x6e')]='Rejected';break;case _0x5177('0x71'):_0x649c6f['Call_Result']=_0x5177('0x72');break;case _0x5177('0x73'):_0x649c6f['Call_Result']=_0x5177('0x74');default:}_0x649c6f[_0x5177('0x75')]=(_0x59376b===_0x5177('0x76')?moment(_0x4c2068[_0x5177('0x6c')])[_0x5177('0x33')](_0x5177('0x77')):moment(_0x4c2068[_0x5177('0x78')])['format'](_0x5177('0x77')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x649c6f[_0x5177('0x79')]=_0x59376b||_0x5177('0x7a');_0x649c6f=_['merge'](_0x649c6f,getCustomFields(_0x422d6c[_0x5177('0x7b')],_0x4c2068));return request({'method':_0x5177('0x44'),'uri':_0x5177('0x45')+_0x26c878+_0x5177('0x7c'),'headers':{'Authorization':_0x5177('0x50')+_0x12dd42},'body':{'data':[_0x649c6f]},'json':!![]})[_0x5177('0x36')](function(_0xe22e2a){if(_0xe22e2a&&_0xe22e2a[_0x5177('0x42')][0x0]['code']==='SUCCESS'){logger[_0x5177('0x30')](_0x5177('0x7d'));return{'id':_0xe22e2a[_0x5177('0x42')][0x0][_0x5177('0x4b')]['id']};}})[_0x5177('0x2c')](function(_0x3dd58f){logger['info'](_0x5177('0x7e'),_0x3dd58f[_0x5177('0x2f')]);console[_0x5177('0x4e')](_0x5177('0x7e'),_0x3dd58f);});}exports['queue']=function(_0x2e26c6,_0x95f83a,_0x124935,_0x22da9d,_0x282cbc,_0x5130e6){var _0x2734fc,_0x4aa8d3,_0x1a6499;_0x5130e6[_0x5177('0x7f')]=intUtil['stripTrailingSlash'](_0x5130e6[_0x5177('0x7f')]);_0x5130e6[_0x5177('0x80')]=intUtil[_0x5177('0x81')](_0x5130e6[_0x5177('0x80')]);if(_0x282cbc&&_0x282cbc['monitor_format']){logger[_0x5177('0x30')](_0x5177('0x82'),_0x5177('0x83'));_0x95f83a[_0x5177('0x84')]=_0x5130e6['serverUrl']+_0x5177('0x85')+_0x95f83a[_0x5177('0x86')]+_0x5177('0x87')+md5(_0x95f83a['uniqueid']);}else{_0x95f83a['recordingURL']='';}var _0x3a399f=_0x5130e6[_0x5177('0x7f')]===_0x5177('0x88')?'eu':_0x5177('0x89');return getAccessToken(_0x5130e6)[_0x5177('0x36')](function(_0x37ed49){_0x1a6499=_0x37ed49;return getUser(_0x1a6499,_0x3a399f,_0x5130e6,_0x22da9d[_0x5177('0x39')]);})[_0x5177('0x36')](function(_0x83d5af){_0x2734fc=_0x83d5af;logger['info']('The\x20User\x20ID\x20is:',_0x2734fc['id']);return getEndUser(_0x1a6499,_0x3a399f,_0x5130e6,_0x95f83a['calleridname'],_0x95f83a[_0x5177('0x8a')],_0x2734fc,_0x124935);})['then'](function(_0x29d690){_0x4aa8d3=_0x29d690;return getCall(_0x1a6499,_0x3a399f,_0x5130e6,_0x2734fc,_0x4aa8d3,_0x124935,_0x95f83a,_0x5177('0x7a'));})[_0x5177('0x36')](function(_0x7474){if(_0x7474){logger[_0x5177('0x30')]('The\x20Call\x20ID\x20is:',_0x7474['id']);logger[_0x5177('0x30')](_0x5177('0x82'),_0x5177('0x8b'));emit(util['format'](_0x5177('0x8c'),_0x22da9d['name']),_0x5177('0x8d'),{'uri':_0x5177('0x8e')+_0x5130e6['host']+_0x5177('0x8f')+_0x7474['id']});}})[_0x5177('0x2c')](function(_0x53ccd8){logger['error'](_0x5177('0x82'),JSON['stringify'](_0x53ccd8));});};exports[_0x5177('0x76')]=function(_0x2f4edb,_0x5a9bc8,_0x698518,_0x115be0,_0xcbbb73,_0x20ceb9,_0x43a584){var _0x45bb3a,_0xbc8f9f,_0x10b062;_0x20ceb9['host']=intUtil[_0x5177('0x81')](_0x20ceb9['host']);_0x20ceb9[_0x5177('0x80')]=intUtil[_0x5177('0x81')](_0x20ceb9[_0x5177('0x80')]);if(_0x43a584&&_0x43a584[_0x5177('0x90')]&&_0x43a584['recordingFormat']!==_0x5177('0x91')){logger[_0x5177('0x30')]('[OUTBOUND]',_0x5177('0x83'));_0x5a9bc8[_0x5177('0x84')]=_0x20ceb9['serverUrl']+_0x5177('0x85')+_0x5a9bc8['uniqueid']+_0x5177('0x87')+md5(_0x5a9bc8['uniqueid']);}var _0x55fa0a=_0x20ceb9['host']===_0x5177('0x88')?'eu':_0x5177('0x89');return getAccessToken(_0x20ceb9)[_0x5177('0x36')](function(_0x516d0b){_0x10b062=_0x516d0b;return getUser(_0x10b062,_0x55fa0a,_0x20ceb9,_0x115be0[_0x5177('0x39')]);})[_0x5177('0x36')](function(_0x3adb47){_0x45bb3a=_0x3adb47;logger[_0x5177('0x30')](_0x5177('0x92'),_0x45bb3a['id']);return getEndUser(_0x10b062,_0x55fa0a,_0x20ceb9,_0x5a9bc8['destcalleridname'],_0x5a9bc8[_0x5177('0x93')],_0x45bb3a,_0x698518);})[_0x5177('0x36')](function(_0x53b367){_0xbc8f9f=_0x53b367;return getCall(_0x10b062,_0x55fa0a,_0x20ceb9,_0x45bb3a,_0xbc8f9f,_0x698518,_0x5a9bc8,_0x5177('0x94'));})['then'](function(_0x5b8953){if(_0x5b8953){logger['info'](_0x5177('0x95'),_0x5b8953['id']);logger[_0x5177('0x30')](_0x5177('0x96'),_0x5177('0x8b'));emit(util[_0x5177('0x33')](_0x5177('0x8c'),_0x115be0['name']),'trigger:browser:url',{'uri':_0x5177('0x8e')+_0x20ceb9[_0x5177('0x7f')]+_0x5177('0x8f')+_0x5b8953['id']});}})['catch'](function(_0x405b03){logger[_0x5177('0x2d')]('[OUTBOUND]',JSON[_0x5177('0x40')](_0x405b03));});};exports['unmanaged']=function(_0x125b08,_0x134b2f,_0x451c23,_0x593262,_0x33b82b,_0x5eb5f5){var _0x11dbd1,_0x26574f,_0x5a40f1;_0x5eb5f5['host']=intUtil['stripTrailingSlash'](_0x5eb5f5[_0x5177('0x7f')]);_0x5eb5f5['serverUrl']=intUtil[_0x5177('0x81')](_0x5eb5f5[_0x5177('0x80')]);if(_0x33b82b&&_0x33b82b[_0x5177('0x97')]){logger['info']('['+_0x134b2f['lastevent']['toUpperCase']()+']',_0x5177('0x83'));_0x134b2f[_0x5177('0x84')]=_0x5eb5f5[_0x5177('0x80')]+'/api/voice/recordings/'+_0x134b2f[_0x5177('0x86')]+_0x5177('0x87')+md5(_0x134b2f['uniqueid']);}else{_0x134b2f[_0x5177('0x84')]='';}var _0x526459=_0x5eb5f5[_0x5177('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x5eb5f5)['then'](function(_0x3940dd){_0x5a40f1=_0x3940dd;return getUser(_0x5a40f1,_0x526459,_0x5eb5f5);})['then'](function(_0x16426e){_0x11dbd1=_0x16426e;logger[_0x5177('0x30')](_0x5177('0x92'),_0x11dbd1['id']);return getEndUser(_0x5a40f1,_0x526459,_0x5eb5f5,_0x134b2f[_0x5177('0x98')],_0x134b2f[_0x5177('0x8a')],_0x11dbd1,_0x451c23);})[_0x5177('0x36')](function(_0x580d34){_0x26574f=_0x580d34;return getCall(_0x5a40f1,_0x526459,_0x5eb5f5,_0x11dbd1,_0x26574f,_0x451c23,_0x134b2f,_0x5177('0x7a'));})[_0x5177('0x36')](function(_0x5465f0){if(_0x5465f0){logger[_0x5177('0x30')](_0x5177('0x95'),_0x5465f0['id']);}})[_0x5177('0x2c')](function(_0x51f7ce){logger['error']('['+_0x134b2f['lastevent'][_0x5177('0x99')]()+']',JSON[_0x5177('0x40')](_0x51f7ce));});}; \ No newline at end of file +var _0x62c0=['Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','mm:ss','answertime','utc','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','details','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','calleridnum','toUpperCase','lodash','request-promise','md5','util','bluebird','../../../../config/logger','zoho','redis','localhost','emit','debug','[HTTP]','stringify','length','forEach','string','idField','toString','variable','variableName','type','customVariable','name','Variable','toLowerCase','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','data','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','info','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','enduserType'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x62c0,0xdb));var _0x062c=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x62c0[_0x38b14f];return _0x22a324;};'use strict';var _=require(_0x062c('0x0'));var rp=require(_0x062c('0x1'));var md5=require(_0x062c('0x2'));var util=require(_0x062c('0x3'));var intUtil=require('./util');var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x062c('0x4'));var config=require('../../../../config/environment');var logger=require(_0x062c('0x5'))(_0x062c('0x6'));config[_0x062c('0x7')]=_['defaults'](config[_0x062c('0x7')],{'host':_0x062c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x062c('0x7')]));function emit(_0x47c929,_0x15312a,_0x2d2526){io['to'](_0x47c929)[_0x062c('0x9')](_0x15312a,_0x2d2526);}function request(_0x3dfecd){logger[_0x062c('0xa')](_0x062c('0xb'),JSON[_0x062c('0xc')](_0x3dfecd));return rp(_0x3dfecd);}function getCustomFields(_0x599f88,_0x4200fc){var _0x4246cc={};if(_0x599f88[_0x062c('0xd')]>0x0){_[_0x062c('0xe')](_0x599f88,function(_0x4e3bd3){if(_0x4e3bd3['type']===_0x062c('0xf')&&_0x4e3bd3[_0x062c('0x10')]){_0x4246cc[_0x4e3bd3[_0x062c('0x10')]]=_0x4e3bd3['content'][_0x062c('0x11')]();}else if(_0x4e3bd3['type']===_0x062c('0x12')&&_0x4e3bd3[_0x062c('0x13')]&&_0x4e3bd3[_0x062c('0x10')]&&_0x4200fc[_0x4e3bd3[_0x062c('0x13')]]){_0x4246cc[_0x4e3bd3[_0x062c('0x10')]]=_0x4200fc[_0x4e3bd3[_0x062c('0x13')]]['toString']();}else if(_0x4e3bd3[_0x062c('0x14')]===_0x062c('0x15')&&_0x4e3bd3['Variable']&&_0x4e3bd3['Variable'][_0x062c('0x16')]&&_0x4e3bd3[_0x062c('0x10')]&&_0x4200fc[_0x4e3bd3[_0x062c('0x17')][_0x062c('0x16')][_0x062c('0x18')]()]){_0x4246cc[_0x4e3bd3[_0x062c('0x10')]]=_0x4200fc[_0x4e3bd3[_0x062c('0x17')][_0x062c('0x16')][_0x062c('0x18')]()][_0x062c('0x11')]();}});}return _0x4246cc;}function getName(_0x543db0){if(_0x543db0['indexOf']('\x20')>0x0){var _0x411bc2=_0x543db0['split'](/ (.+)/);if(_0x411bc2[0x1]){return _0x411bc2;}}return[_0x543db0,_0x543db0];}var accountsTokens={};function getAccessToken(_0x2429ec){return new Promise(function(_0x38b0a7,_0x7a0dce){if(!_['isNil'](accountsTokens[_0x2429ec['id']])&&!_['isNil'](accountsTokens[_0x2429ec['id']][_0x062c('0x19')])){if(moment()[_0x062c('0x1a')](accountsTokens[_0x2429ec['id']]['expires_in'])){_0x38b0a7(accountsTokens[_0x2429ec['id']][_0x062c('0x19')]);}}var _0x286938;switch(_0x2429ec[_0x062c('0x1b')]){case'US':_0x286938=_0x062c('0x1c');break;case'AU':_0x286938='https://accounts.zoho.com.au';break;case'EU':_0x286938=_0x062c('0x1d');break;case'IN':_0x286938=_0x062c('0x1e');break;case'CN':_0x286938=_0x062c('0x1f');break;default:_0x286938=_0x062c('0x1d');break;}var _0x7b03e9={'method':_0x062c('0x20'),'uri':_0x286938+'/oauth/v2/token','qs':{'refresh_token':_0x2429ec[_0x062c('0x21')],'client_id':_0x2429ec[_0x062c('0x22')],'client_secret':_0x2429ec[_0x062c('0x23')],'grant_type':_0x062c('0x24')},'json':!![]};return rp(_0x7b03e9)[_0x062c('0x25')](function(_0x120f40){accountsTokens[_0x2429ec['id']]={'access_token':_0x120f40['access_token'],'expires_in':moment()[_0x062c('0x26')](_0x120f40[_0x062c('0x27')],_0x062c('0x28'))};_0x38b0a7(_0x120f40['access_token']);})[_0x062c('0x29')](function(_0x570eb2){logger[_0x062c('0x2a')](_0x062c('0x2b'),_0x570eb2[_0x062c('0x2c')]);_0x7a0dce(_0x570eb2);});});}function getUser(_0x537b08,_0x4a648e,_0x337551,_0x3caadf){logger['info'](_0x062c('0x2d'));return request({'method':_0x062c('0x2e'),'uri':util[_0x062c('0x2f')](_0x062c('0x30'),_0x4a648e),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x062c('0x31')+_0x537b08},'json':!![]})[_0x062c('0x25')](function(_0x5c6fba){if(_0x5c6fba[_0x062c('0x32')]){var _0x5997d5=-0x1;if(_[_0x062c('0x33')](_0x5c6fba[_0x062c('0x32')])){if(!_[_0x062c('0x34')](_0x3caadf)){_0x5997d5=_[_0x062c('0x35')](_0x5c6fba[_0x062c('0x32')],function(_0x4a02c5){return _0x4a02c5[_0x062c('0x36')]===_0x3caadf;});}if(_0x5997d5>=0x0){logger['info'](_0x062c('0x37'));}else{logger['info'](_0x062c('0x38'));_0x5997d5=_[_0x062c('0x35')](_0x5c6fba[_0x062c('0x32')],function(_0x424fe8){return _0x424fe8[_0x062c('0x39')]['name']===_0x062c('0x3a');});}return _0x5c6fba[_0x062c('0x32')][_0x5997d5];}else{if(_0x5c6fba['user'][_0x062c('0x39')][_0x062c('0x16')]==='Administrator'){logger['info']('Using\x20the\x20admin\x20account!');user=_0x5c6fba[_0x062c('0x3b')];return user;}else{logger['error'](_0x062c('0x3c'),JSON['stringify'](_0x5c6fba));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x062c('0xc')](_0x5c6fba));}}}else{logger[_0x062c('0x2a')](_0x062c('0x3c'),JSON[_0x062c('0xc')](_0x5c6fba));throw new Error(_0x062c('0x3d')+JSON[_0x062c('0xc')](_0x5c6fba));}})[_0x062c('0x29')](function(_0x9be984){console[_0x062c('0x2a')](_0x9be984);});}function getZohoUser(_0x262277,_0x48eb7c){return new BPromise(function(_0x9a4194,_0x245c65){request(_0x262277)['then'](function(_0x14babd){var _0x4ef105=null;if(_0x14babd){_0x4ef105=_0x14babd['data'][0x0];_0x4ef105['enduserType']=_0x48eb7c;}_0x9a4194(_0x4ef105);})[_0x062c('0x29')](function(_0x2fe970){_0x245c65(_0x2fe970);});});}function createEndUser(_0x3c2d33,_0xead944,_0xf58271,_0x2f21c3,_0x41feb8,_0xb4306e){var _0xf58271=getName(_0xf58271);return request({'method':'POST','uri':_0x062c('0x3e')+_0xead944+_0x062c('0x3f')+_[_0x062c('0x40')](_0xb4306e['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0xf58271[0x1],'First_Name':_0xf58271[0x0],'Phone':_0x2f21c3,'Owner':{'name':!_[_0x062c('0x34')](_0x41feb8[_0x062c('0x41')][_0x062c('0x16')])?_0x41feb8[_0x062c('0x41')]['name']:!_[_0x062c('0x34')](_0x41feb8[_0x062c('0x42')])?_0x41feb8[_0x062c('0x42')]+'\x20'+_0x41feb8[_0x062c('0x43')]:_0x41feb8[_0x062c('0x43')],'id':_0x41feb8['id']}}]},'headers':{'Authorization':_0x062c('0x31')+_0x3c2d33},'json':!![]})[_0x062c('0x25')](function(_0x1b50b8){if(_0x1b50b8&&_0x1b50b8['data'][0x0][_0x062c('0x44')]==='SUCCESS'){var _0x4f520c=_0x1b50b8[_0x062c('0x45')][0x0]['details'];_0x4f520c['enduserType']=_[_0x062c('0x40')](_0xb4306e[_0x062c('0x46')])+'s';return _0x4f520c;}logger['error'](_0x062c('0x3c'),JSON[_0x062c('0xc')](data));throw new Error(_0x062c('0x47')+JSON[_0x062c('0xc')](data));})['catch'](function(_0x3c028f){console[_0x062c('0x48')](_0x062c('0x49'),_0x3c028f);});}function getEndUser(_0x334886,_0x37ebc1,_0x57908e,_0x1f7304,_0x3895b1,_0x41101f,_0x9cfeba){var _0x4a0ff7={'method':'GET','uri':'','headers':{'Authorization':_0x062c('0x31')+_0x334886},'json':!![]};switch(_0x9cfeba[_0x062c('0x4a')]){case _0x062c('0x4b'):_0x4a0ff7[_0x062c('0x4c')]=_0x062c('0x3e')+_0x37ebc1+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3895b1+'))';return getZohoUser(_0x4a0ff7,_0x062c('0x4d'))[_0x062c('0x25')](function(_0x17dbc4){if(_0x17dbc4)return _0x17dbc4;_0x4a0ff7[_0x062c('0x4c')]='https://www.zohoapis.'+_0x37ebc1+_0x062c('0x4e')+_0x3895b1+'))';return getZohoUser(_0x4a0ff7,'Leads')[_0x062c('0x25')](function(_0x583b73){if(_0x583b73)return _0x583b73;if(_0x9cfeba[_0x062c('0x46')]!=_0x062c('0x4f')){return createEndUser(_0x334886,_0x37ebc1,_0x1f7304,_0x3895b1,_0x41101f,_0x9cfeba);}else{return{};}});});break;case _0x062c('0x50'):_0x4a0ff7[_0x062c('0x4c')]='https://www.zohoapis.'+_0x37ebc1+_0x062c('0x51')+_0x3895b1+'))';return getZohoUser(_0x4a0ff7,'Contacts')[_0x062c('0x25')](function(_0x1e4588){if(_0x1e4588)return _0x1e4588;if(_0x9cfeba['moduleCreate']!='nothing'){return createEndUser(_0x334886,_0x37ebc1,_0x1f7304,_0x3895b1,_0x41101f,_0x9cfeba);}else{return{};}});break;case _0x062c('0x52'):_0x4a0ff7[_0x062c('0x4c')]=_0x062c('0x3e')+_0x37ebc1+_0x062c('0x4e')+_0x3895b1+'))';return getZohoUser(_0x4a0ff7,_0x062c('0x53'))[_0x062c('0x25')](function(_0x5a382e){if(_0x5a382e)return _0x5a382e;if(_0x9cfeba[_0x062c('0x46')]!=_0x062c('0x4f')){return createEndUser(_0x334886,_0x37ebc1,_0x1f7304,_0x3895b1,_0x41101f,_0x9cfeba);}else{return{};}});break;}}function getCall(_0x3624ed,_0x8d7828,_0x50f2a4,_0x5c22a5,_0xbd182f,_0x24b0a7,_0x44f3c6,_0x222f14){logger[_0x062c('0x54')](_0x062c('0x55'));var _0x10cfdb={};_0x10cfdb[_0x062c('0x56')]={'name':!_[_0x062c('0x34')](_0x5c22a5[_0x062c('0x41')][_0x062c('0x16')])&&!_[_0x062c('0x34')](_0x5c22a5[_0x062c('0x39')][_0x062c('0x16')])&&_0x5c22a5[_0x062c('0x39')][_0x062c('0x16')]===_0x062c('0x57')?_0x5c22a5[_0x062c('0x41')][_0x062c('0x16')]:!_[_0x062c('0x34')](_0x5c22a5[_0x062c('0x42')])?_0x5c22a5['first_name']+'\x20'+_0x5c22a5[_0x062c('0x43')]:_0x5c22a5['last_name'],'id':_0x5c22a5['id']};_0x10cfdb[_0x062c('0x58')]=intUtil['getString'](_0x24b0a7[_0x062c('0x59')],_0x44f3c6,'\x20');_0x10cfdb[_0x062c('0x5a')]=intUtil[_0x062c('0x5b')](_0x24b0a7['Descriptions'],_0x44f3c6,'\x0a');if(_0xbd182f[_0x062c('0x5c')]===_0x062c('0x4d')){_0x10cfdb['Who_Id']={'name':!_['isNil'](_0xbd182f['Full_Name'])?_0xbd182f[_0x062c('0x5d')]:!_[_0x062c('0x34')](_0xbd182f['First_Name'])?_0xbd182f[_0x062c('0x5e')]+'\x20'+_0xbd182f[_0x062c('0x5f')]:_0xbd182f[_0x062c('0x5f')],'id':_0xbd182f['id']};}if(_0xbd182f[_0x062c('0x5c')]===_0x062c('0x53')){_0x10cfdb[_0x062c('0x60')]={'name':!_[_0x062c('0x34')](_0xbd182f['Full_Name'])?_0xbd182f['Full_Name']:!_['isNil'](_0xbd182f['First_Name'])?_0xbd182f['First_Name']+'\x20'+_0xbd182f[_0x062c('0x5f')]:_0xbd182f['Last_Name'],'id':_0xbd182f['id']};_0x10cfdb[_0x062c('0x61')]=_[_0x062c('0x40')](_0xbd182f['enduserType']);}if(_0x44f3c6['talktime']){_0x10cfdb[_0x062c('0x62')]=moment['utc'](parseInt(_0x44f3c6[_0x062c('0x63')])*0x3e8)['format'](_0x062c('0x64'));}else if(_0x44f3c6[_0x062c('0x65')]&&_0x44f3c6['endtime']){_0x10cfdb[_0x062c('0x62')]=moment[_0x062c('0x66')](moment(_0x44f3c6[_0x062c('0x67')],'YYYY-MM-DDTHH:mm:ss')[_0x062c('0x68')](moment(_0x44f3c6[_0x062c('0x69')],_0x062c('0x6a'))))['format']('mm:ss');}switch(_0x44f3c6[_0x062c('0x6b')]){case _0x062c('0x6c'):_0x10cfdb[_0x062c('0x6d')]=_0x062c('0x6e');break;case'complete':case _0x062c('0x6f'):_0x10cfdb['Call_Result']=_0x062c('0x70');break;case _0x062c('0x71'):_0x10cfdb[_0x062c('0x6d')]=_0x062c('0x72');break;case _0x062c('0x73'):_0x10cfdb[_0x062c('0x6d')]=_0x062c('0x74');break;case'timeout':_0x10cfdb[_0x062c('0x6d')]=_0x062c('0x75');default:}_0x10cfdb[_0x062c('0x76')]=(_0x222f14==='outbound'?moment(_0x44f3c6['starttime'])[_0x062c('0x2f')](_0x062c('0x6a')):moment(_0x44f3c6[_0x062c('0x77')])[_0x062c('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x062c('0x6a'));_0x10cfdb[_0x062c('0x78')]=_0x222f14||_0x062c('0x79');_0x10cfdb=_[_0x062c('0x7a')](_0x10cfdb,getCustomFields(_0x24b0a7[_0x062c('0x7b')],_0x44f3c6));return request({'method':'POST','uri':_0x062c('0x3e')+_0x8d7828+_0x062c('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3624ed},'body':{'data':[_0x10cfdb]},'json':!![]})[_0x062c('0x25')](function(_0x443c15){if(_0x443c15&&_0x443c15[_0x062c('0x45')][0x0][_0x062c('0x44')]==='SUCCESS'){logger[_0x062c('0x54')]('Call\x20created!');return{'id':_0x443c15[_0x062c('0x45')][0x0][_0x062c('0x7d')]['id']};}})[_0x062c('0x29')](function(_0x554d49){logger[_0x062c('0x54')]('err',_0x554d49['stack']);console[_0x062c('0x48')](_0x062c('0x7e'),_0x554d49);});}exports[_0x062c('0x7f')]=function(_0xcd1094,_0x2aad86,_0x5b22ed,_0x39b527,_0x517c98,_0x251c27){var _0x241f1b,_0x132823,_0x362923;_0x251c27[_0x062c('0x80')]=intUtil['stripTrailingSlash'](_0x251c27[_0x062c('0x80')]);_0x251c27[_0x062c('0x81')]=intUtil[_0x062c('0x82')](_0x251c27[_0x062c('0x81')]);if(_0x517c98&&_0x517c98[_0x062c('0x83')]){logger[_0x062c('0x54')](_0x062c('0x84'),'Recording\x20is\x20enabled!');_0x2aad86['recordingURL']=_0x251c27[_0x062c('0x81')]+_0x062c('0x85')+_0x2aad86[_0x062c('0x86')]+_0x062c('0x87')+md5(_0x2aad86[_0x062c('0x86')]);}else{_0x2aad86[_0x062c('0x88')]='';}var _0x1ae5cd=_0x251c27[_0x062c('0x80')]===_0x062c('0x89')?'eu':_0x062c('0x8a');return getAccessToken(_0x251c27)['then'](function(_0x14f03c){_0x362923=_0x14f03c;return getUser(_0x362923,_0x1ae5cd,_0x251c27,_0x39b527['email']);})[_0x062c('0x25')](function(_0xec200e){_0x241f1b=_0xec200e;logger['info'](_0x062c('0x8b'),_0x241f1b['id']);return getEndUser(_0x362923,_0x1ae5cd,_0x251c27,_0x2aad86[_0x062c('0x8c')],_0x2aad86['calleridnum'],_0x241f1b,_0x5b22ed);})[_0x062c('0x25')](function(_0x3cc59a){_0x132823=_0x3cc59a;return getCall(_0x362923,_0x1ae5cd,_0x251c27,_0x241f1b,_0x132823,_0x5b22ed,_0x2aad86,_0x062c('0x79'));})[_0x062c('0x25')](function(_0x6b9c5d){if(_0x6b9c5d){logger['info'](_0x062c('0x8d'),_0x6b9c5d['id']);logger[_0x062c('0x54')](_0x062c('0x84'),_0x062c('0x8e'));emit(util[_0x062c('0x2f')](_0x062c('0x8f'),_0x39b527[_0x062c('0x16')]),_0x062c('0x90'),{'uri':'https://crm.'+_0x251c27[_0x062c('0x80')]+_0x062c('0x91')+_0x6b9c5d['id']});}})[_0x062c('0x29')](function(_0xc4147d){logger[_0x062c('0x2a')](_0x062c('0x84'),JSON[_0x062c('0xc')](_0xc4147d));});};exports['outbound']=function(_0x590857,_0x4254fd,_0x24f9ee,_0x3adee1,_0x59d9c5,_0x5f2f64,_0x4b9535){var _0x304b2b,_0x5dee0a,_0x17ba3b;_0x5f2f64[_0x062c('0x80')]=intUtil[_0x062c('0x82')](_0x5f2f64['host']);_0x5f2f64[_0x062c('0x81')]=intUtil[_0x062c('0x82')](_0x5f2f64[_0x062c('0x81')]);if(_0x4b9535&&_0x4b9535['recordingFormat']&&_0x4b9535[_0x062c('0x92')]!==_0x062c('0x93')){logger[_0x062c('0x54')]('[OUTBOUND]',_0x062c('0x94'));_0x4254fd[_0x062c('0x88')]=_0x5f2f64[_0x062c('0x81')]+'/api/voice/recordings/'+_0x4254fd[_0x062c('0x86')]+_0x062c('0x87')+md5(_0x4254fd[_0x062c('0x86')]);}var _0xfc9d98=_0x5f2f64[_0x062c('0x80')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x5f2f64)[_0x062c('0x25')](function(_0x3ab5c1){_0x17ba3b=_0x3ab5c1;return getUser(_0x17ba3b,_0xfc9d98,_0x5f2f64,_0x3adee1[_0x062c('0x36')]);})[_0x062c('0x25')](function(_0x1edccf){_0x304b2b=_0x1edccf;logger[_0x062c('0x54')]('The\x20User\x20ID\x20is:',_0x304b2b['id']);return getEndUser(_0x17ba3b,_0xfc9d98,_0x5f2f64,_0x4254fd[_0x062c('0x95')],_0x4254fd[_0x062c('0x96')],_0x304b2b,_0x24f9ee);})[_0x062c('0x25')](function(_0x35b55c){_0x5dee0a=_0x35b55c;return getCall(_0x17ba3b,_0xfc9d98,_0x5f2f64,_0x304b2b,_0x5dee0a,_0x24f9ee,_0x4254fd,_0x062c('0x97'));})[_0x062c('0x25')](function(_0x5acc7f){if(_0x5acc7f){logger[_0x062c('0x54')](_0x062c('0x8d'),_0x5acc7f['id']);logger[_0x062c('0x54')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x062c('0x8f'),_0x3adee1[_0x062c('0x16')]),_0x062c('0x90'),{'uri':'https://crm.'+_0x5f2f64[_0x062c('0x80')]+_0x062c('0x91')+_0x5acc7f['id']});}})[_0x062c('0x29')](function(_0x56e36d){logger['error'](_0x062c('0x98'),JSON[_0x062c('0xc')](_0x56e36d));});};exports[_0x062c('0x99')]=function(_0x1497e1,_0xc2e608,_0x124861,_0x4bbdec,_0x78b4cd,_0x24be9d){var _0x4b71bd,_0x5dbf69,_0x1f3145;_0x24be9d['host']=intUtil[_0x062c('0x82')](_0x24be9d[_0x062c('0x80')]);_0x24be9d[_0x062c('0x81')]=intUtil[_0x062c('0x82')](_0x24be9d[_0x062c('0x81')]);if(_0x78b4cd&&_0x78b4cd['monitor_format']){logger[_0x062c('0x54')]('['+_0xc2e608[_0x062c('0x6b')]['toUpperCase']()+']',_0x062c('0x94'));_0xc2e608[_0x062c('0x88')]=_0x24be9d[_0x062c('0x81')]+'/api/voice/recordings/'+_0xc2e608[_0x062c('0x86')]+_0x062c('0x87')+md5(_0xc2e608[_0x062c('0x86')]);}else{_0xc2e608[_0x062c('0x88')]='';}var _0x4b6b84=_0x24be9d['host']===_0x062c('0x89')?'eu':_0x062c('0x8a');return getAccessToken(_0x24be9d)[_0x062c('0x25')](function(_0x49d868){_0x1f3145=_0x49d868;return getUser(_0x1f3145,_0x4b6b84,_0x24be9d);})['then'](function(_0x554e2c){_0x4b71bd=_0x554e2c;logger[_0x062c('0x54')](_0x062c('0x8b'),_0x4b71bd['id']);return getEndUser(_0x1f3145,_0x4b6b84,_0x24be9d,_0xc2e608[_0x062c('0x8c')],_0xc2e608[_0x062c('0x9a')],_0x4b71bd,_0x124861);})['then'](function(_0x39b535){_0x5dbf69=_0x39b535;return getCall(_0x1f3145,_0x4b6b84,_0x24be9d,_0x4b71bd,_0x5dbf69,_0x124861,_0xc2e608,_0x062c('0x79'));})['then'](function(_0x42cbfc){if(_0x42cbfc){logger['info'](_0x062c('0x8d'),_0x42cbfc['id']);}})['catch'](function(_0x6906f4){logger['error']('['+_0xc2e608['lastevent'][_0x062c('0x9b')]()+']',JSON['stringify'](_0x6906f4));});}; \ 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 4863327..8956509 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(_0x15ebc1,_0x745164){var _0x32142f=function(_0x5679d7){while(--_0x5679d7){_0x15ebc1['push'](_0x15ebc1['shift']());}};_0x32142f(++_0x745164);}(_0x7a54,0x106));var _0x47a5=function(_0x474633,_0x11a287){_0x474633=_0x474633-0x0;var _0x45fc20=_0x7a54[_0x474633];return _0x45fc20;};'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(_0x1f21c7,_0x5bd3f2){var _0x48c32e=function(_0x51980b){while(--_0x51980b){_0x1f21c7['push'](_0x1f21c7['shift']());}};_0x48c32e(++_0x5bd3f2);}(_0x7a54,0x106));var _0x47a5=function(_0x179b46,_0x57a372){_0x179b46=_0x179b46-0x0;var _0x4a2035=_0x7a54[_0x179b46];return _0x4a2035;};'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 f5efcc4..d3512a5 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 _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(_0x4b3674,_0x4a38fc){var _0x17b735=function(_0x8a1f71){while(--_0x8a1f71){_0x4b3674['push'](_0x4b3674['shift']());}};_0x17b735(++_0x4a38fc);}(_0x7a54,0x106));var _0x47a5=function(_0x18c720,_0x5949c4){_0x18c720=_0x18c720-0x0;var _0x1a331d=_0x7a54[_0x18c720];return _0x1a331d;};'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 +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x5e3b7d,_0x4f429f){var _0x4aa9f5=function(_0x35a802){while(--_0x35a802){_0x5e3b7d['push'](_0x5e3b7d['shift']());}};_0x4aa9f5(++_0x4f429f);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a91d9,_0x47cedb){_0x5a91d9=_0x5a91d9-0x0;var _0x5275e2=_0xb10b[_0x5a91d9];return _0x5275e2;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index a272506..c9f9dda 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 _0x9c5a=['Request','request','debug','error','message','rpc','exports','jayson/promise','bluebird','routing','client','http'];(function(_0x2603e5,_0x430456){var _0xeb036=function(_0x1d393e){while(--_0x1d393e){_0x2603e5['push'](_0x2603e5['shift']());}};_0xeb036(++_0x430456);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3554c6,_0x208de0){_0x3554c6=_0x3554c6-0x0;var _0x57a1e4=_0x9c5a[_0x3554c6];return _0x57a1e4;};'use strict';var jayson=require(_0xa9c5('0x0'));var BPromise=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var client=jayson[_0xa9c5('0x3')][_0xa9c5('0x4')]({'port':0x2329});client[_0xa9c5('0x5')]=function(_0x4f5552,_0x2acfaf){return new BPromise(function(_0x3051b1,_0x4e9403){return client[_0xa9c5('0x6')](_0x4f5552,_0x2acfaf)['then'](function(_0x394d84){logger[_0xa9c5('0x7')]('rpc','routing',_0x4f5552,_0x2acfaf,_0x394d84);if(_0x394d84[_0xa9c5('0x8')]){logger[_0xa9c5('0x8')]('rpc',_0xa9c5('0x2'),_0x4f5552,_0x394d84[_0xa9c5('0x8')]['message'],_0x2acfaf);return _0x4e9403(_0x394d84[_0xa9c5('0x8')][_0xa9c5('0x9')]);}else{return _0x3051b1(_0x394d84['result']);}})['catch'](function(_0x38e106){logger[_0xa9c5('0x8')](_0xa9c5('0xa'),_0xa9c5('0x2'),_0x4f5552,_0x38e106,_0x2acfaf);return _0x4e9403(_0x38e106);});});};module[_0xa9c5('0xb')]=client; \ No newline at end of file +var _0x98a7=['error','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','debug','rpc'];(function(_0x137cf4,_0x467afd){var _0x3f25ca=function(_0x1cc0d4){while(--_0x1cc0d4){_0x137cf4['push'](_0x137cf4['shift']());}};_0x3f25ca(++_0x467afd);}(_0x98a7,0x9e));var _0x798a=function(_0xbac363,_0x55c3ab){_0xbac363=_0xbac363-0x0;var _0x51d69a=_0x98a7[_0xbac363];return _0x51d69a;};'use strict';var jayson=require(_0x798a('0x0'));var BPromise=require(_0x798a('0x1'));var logger=require(_0x798a('0x2'))(_0x798a('0x3'));var client=jayson[_0x798a('0x4')][_0x798a('0x5')]({'port':0x2329});client[_0x798a('0x6')]=function(_0x5d1e77,_0x15c97c){return new BPromise(function(_0x3c85b6,_0x4dc381){return client['request'](_0x5d1e77,_0x15c97c)[_0x798a('0x7')](function(_0x451a05){logger[_0x798a('0x8')](_0x798a('0x9'),_0x798a('0x3'),_0x5d1e77,_0x15c97c,_0x451a05);if(_0x451a05[_0x798a('0xa')]){logger[_0x798a('0xa')](_0x798a('0x9'),'routing',_0x5d1e77,_0x451a05[_0x798a('0xa')][_0x798a('0xb')],_0x15c97c);return _0x4dc381(_0x451a05[_0x798a('0xa')][_0x798a('0xb')]);}else{return _0x3c85b6(_0x451a05['result']);}})[_0x798a('0xc')](function(_0x33db74){logger[_0x798a('0xa')](_0x798a('0x9'),_0x798a('0x3'),_0x5d1e77,_0x33db74,_0x15c97c);return _0x4dc381(_0x33db74);});});};module[_0x798a('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 23bc311..eeef11d 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 _0x556b=['resolve','then','getMailAccounts','initMailAccounts','listen','Setting','findOne','loginMailFrequency','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x4a5265,_0x1ab0bf){var _0x5c31fe=function(_0x5f47f5){while(--_0x5f47f5){_0x4a5265['push'](_0x4a5265['shift']());}};_0x5c31fe(++_0x1ab0bf);}(_0x556b,0x1d7));var _0xb556=function(_0x4d84ba,_0x5cfb49){_0x4d84ba=_0x4d84ba-0x0;var _0x53267c=_0x556b[_0x4d84ba];return _0x53267c;};'use strict';var BPromise=require(_0xb556('0x0'));var server=require(_0xb556('0x1'));var Realtime=require(_0xb556('0x2'));var EmailChannel=require(_0xb556('0x3'));var mailAccount=require(_0xb556('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xb556('0x5')]()[_0xb556('0x6')](mailAccount[_0xb556('0x7')]())[_0xb556('0x6')](realtime[_0xb556('0x8')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xb556('0x9')](realtime,email)[_0xb556('0x6')](function(_0x1cc8a1){return initRealtime();})[_0xb556('0x6')](function(_0xe45310){return db[_0xb556('0xa')][_0xb556('0xb')]({'attributes':['id',_0xb556('0xc')],'raw':!![]});})['then'](function(_0x52425c){return setInterval(initRealtime,_0x52425c[_0xb556('0xc')]*0x3e8);})['catch'](function(_0x1c33a3){console[_0xb556('0xd')](_0x1c33a3);});}main(); \ No newline at end of file +var _0x7fd6=['Setting','findOne','loginMailFrequency','catch','log','bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','listen'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fd6,0x157));var _0x67fd=function(_0x5897bb,_0x94d79d){_0x5897bb=_0x5897bb-0x0;var _0x1ad763=_0x7fd6[_0x5897bb];return _0x1ad763;};'use strict';var BPromise=require(_0x67fd('0x0'));var server=require('./server');var Realtime=require(_0x67fd('0x1'));var EmailChannel=require(_0x67fd('0x2'));var mailAccount=require(_0x67fd('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x67fd('0x4'))['db'];function initRealtime(){return BPromise[_0x67fd('0x5')]()[_0x67fd('0x6')](mailAccount['getMailAccounts']())[_0x67fd('0x6')](realtime['initMailAccounts']())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x67fd('0x7')](realtime,email)[_0x67fd('0x6')](function(_0x21d7b1){return initRealtime();})[_0x67fd('0x6')](function(_0x74be46){return db[_0x67fd('0x8')][_0x67fd('0x9')]({'attributes':['id',_0x67fd('0xa')],'raw':!![]});})['then'](function(_0x25ce35){return setInterval(initRealtime,_0x25ce35[_0x67fd('0xa')]*0x3e8);})[_0x67fd('0xb')](function(_0x65f39c){console[_0x67fd('0xc')](_0x65f39c);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 37c5b3e..ac00f42 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 _0x3fc4=['emit','name','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','prototype','hasOwnProperty','handleImapBox','bind','handleImapEnd','error','handleImapError','disabled','status','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','smtp','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts'];(function(_0x3a8eed,_0x2e6f77){var _0x1c5f54=function(_0x302640){while(--_0x302640){_0x3a8eed['push'](_0x3a8eed['shift']());}};_0x1c5f54(++_0x2e6f77);}(_0x3fc4,0x15d));var _0x43fc=function(_0x240503,_0x17c0d3){_0x240503=_0x240503-0x0;var _0x36e70b=_0x3fc4[_0x240503];return _0x36e70b;};'use strict';var _=require(_0x43fc('0x0'));var moment=require(_0x43fc('0x1'));var BPromise=require('bluebird');var md5=require(_0x43fc('0x2'));var Redis=require(_0x43fc('0x3'));var config=require(_0x43fc('0x4'));var logger=require(_0x43fc('0x5'))(_0x43fc('0x6'));config[_0x43fc('0x7')]=_[_0x43fc('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x43fc('0x9'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x43fc('0xa'));var mailAccount=require(_0x43fc('0xb'));var md5Accounts={};function EmailChannel(_0x5c7c15){logger[_0x43fc('0xc')]('start\x20email\x20channel');this[_0x43fc('0xd')]=_0x5c7c15[_0x43fc('0xd')];this[_0x43fc('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x43fc('0xf')]=function(_0x48d303){var _0x3da506=this[_0x43fc('0xd')][_0x48d303];var _0x26f5c0={'id':_0x3da506['id'],'name':_0x3da506[_0x43fc('0x10')],'key':_0x3da506[_0x43fc('0x11')],'active':_0x3da506[_0x43fc('0x12')],'Imap':{'status':_0x3da506[_0x43fc('0x13')]['status'],'messageStatus':_0x3da506[_0x43fc('0x13')][_0x43fc('0x14')],'total':_0x3da506[_0x43fc('0x13')][_0x43fc('0x15')]}};if(_[_0x43fc('0x16')](md5Accounts[_0x48d303])){md5Accounts[_0x48d303]={};}var _0x3942ea=md5(JSON[_0x43fc('0x17')](_0x26f5c0));if(md5Accounts[_0x48d303][_0x43fc('0x2')]!==_0x3942ea){md5Accounts[_0x48d303]['md5']=_0x3942ea;io[_0x43fc('0xf')](_0x43fc('0x18'),_0x26f5c0);}};EmailChannel[_0x43fc('0x19')]['refresh']=function(_0x1b68af){for(var _0x40a6c7 in _0x1b68af){if(_0x1b68af[_0x43fc('0x1a')](_0x40a6c7)){if(_0x1b68af[_0x40a6c7][_0x43fc('0x13')]&&_0x1b68af[_0x40a6c7][_0x43fc('0x12')]){var _0x5271b6=_0x1b68af[_0x40a6c7]['Imap'];if(!this['imapAccounts'][_0x43fc('0x1a')](_0x5271b6['id'])){this[_0x43fc('0xe')][_0x5271b6['id']]=new EmailImap(_0x5271b6,_0x1b68af[_0x40a6c7][_0x43fc('0x6')]);this[_0x43fc('0xe')][_0x5271b6['id']]['on']('box',this[_0x43fc('0x1b')][_0x43fc('0x1c')](this,_0x40a6c7));this[_0x43fc('0xe')][_0x5271b6['id']]['on'](_0x43fc('0x6'),this['handleImapEmail'][_0x43fc('0x1c')](this,_0x40a6c7));this['imapAccounts'][_0x5271b6['id']]['on']('end',this[_0x43fc('0x1d')]['bind'](this,_0x40a6c7));this[_0x43fc('0xe')][_0x5271b6['id']]['on'](_0x43fc('0x1e'),this[_0x43fc('0x1f')][_0x43fc('0x1c')](this,_0x40a6c7));}}else{if(_[_0x43fc('0x16')](this[_0x43fc('0xd')][_0x40a6c7][_0x43fc('0x13')])){this['mailAccounts'][_0x40a6c7][_0x43fc('0x13')]={};}this[_0x43fc('0xd')][_0x40a6c7][_0x43fc('0x13')]['status']=_0x43fc('0x20');this[_0x43fc('0xd')][_0x40a6c7]['Imap'][_0x43fc('0x14')]='';this['emit'](_0x40a6c7);}}}};EmailChannel[_0x43fc('0x19')][_0x43fc('0x1b')]=function(_0x285824,_0x27b8b3){if(this['mailAccounts'][_0x285824]){this[_0x43fc('0xd')][_0x285824][_0x43fc('0x13')][_0x43fc('0x21')]='connected';this[_0x43fc('0xd')][_0x285824][_0x43fc('0x13')][_0x43fc('0x14')]=_0x27b8b3[_0x43fc('0x10')];if(_0x27b8b3['messages']){this[_0x43fc('0xd')][_0x285824][_0x43fc('0x13')]['total']=_0x27b8b3[_0x43fc('0x22')][_0x43fc('0x15')];}return this['emit'](_0x285824);}};EmailChannel[_0x43fc('0x19')][_0x43fc('0x23')]=function(_0x552507,_0x49b2c9){logger[_0x43fc('0xc')](_0x43fc('0x24'),_0x49b2c9[_0x43fc('0x25')],_0x49b2c9[_0x43fc('0x26')],_0x49b2c9['from'],_0x552507);if(this[_0x43fc('0xd')][_0x552507]){return mailAccount[_0x43fc('0x27')](_0x552507,_0x49b2c9)[_0x43fc('0x28')](function(_0x324ad9){if(_0x324ad9){logger[_0x43fc('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0x43fc('0x29')](function(_0x4c6928){logger[_0x43fc('0x1e')](_0x43fc('0x2a'),JSON[_0x43fc('0x17')](_0x4c6928));});}};EmailChannel[_0x43fc('0x19')][_0x43fc('0x1d')]=function(_0x5a8dda){if(this[_0x43fc('0xd')][_0x5a8dda]&&this['mailAccounts'][_0x5a8dda][_0x43fc('0x13')]){if(this[_0x43fc('0xe')][this['mailAccounts'][_0x5a8dda]['Imap']['id']]){delete this[_0x43fc('0xe')][this[_0x43fc('0xd')][_0x5a8dda][_0x43fc('0x13')]['id']];}this[_0x43fc('0xd')][_0x5a8dda][_0x43fc('0x13')]['lastSync']=moment();this[_0x43fc('0xf')](_0x5a8dda);}};EmailChannel[_0x43fc('0x19')][_0x43fc('0x1f')]=function(_0x5a7434,_0x139eb3){if(this['mailAccounts'][_0x5a7434]){this[_0x43fc('0xd')][_0x5a7434][_0x43fc('0x13')][_0x43fc('0x21')]='error';this[_0x43fc('0xd')][_0x5a7434][_0x43fc('0x13')][_0x43fc('0x14')]=_0x139eb3;return this['emit'](_0x5a7434);}};EmailChannel[_0x43fc('0x19')][_0x43fc('0x2b')]=function(_0x242ab6,_0x158238){return this['smtp'][_0x43fc('0x2c')](_0x242ab6,_0x158238);};EmailChannel[_0x43fc('0x19')][_0x43fc('0x2d')]=function(_0x532b47){var _0x23a4b3=this;if(this['mailAccounts'][_0x532b47['id']]){if(_[_0x43fc('0x16')](this[_0x43fc('0xd')][_0x532b47['id']][_0x43fc('0x2e')])){this['mailAccounts'][_0x532b47['id']][_0x43fc('0x2e')]={};}this[_0x43fc('0xd')][_0x532b47['id']][_0x43fc('0x2e')][_0x43fc('0x2f')]=moment();return new BPromise(function(_0x5d3984,_0x5775cd){return _0x23a4b3['smtp'][_0x43fc('0x30')](_0x532b47)['then'](function(_0x5960ba){_0x23a4b3[_0x43fc('0xd')][_0x532b47['id']][_0x43fc('0x2e')]['status']=_0x43fc('0x31');_0x23a4b3[_0x43fc('0xd')][_0x532b47['id']]['Smtp'][_0x43fc('0x14')]='';_0x23a4b3['emit'](_0x532b47['id']);_0x5d3984(_0x5960ba);})[_0x43fc('0x29')](function(_0xa79eec){_0x23a4b3['mailAccounts'][_0x532b47['id']][_0x43fc('0x2e')]['status']='error';_0x23a4b3['mailAccounts'][_0x532b47['id']][_0x43fc('0x2e')]['messageStatus']=_0xa79eec;_0x23a4b3[_0x43fc('0xf')](_0x532b47['id']);_0x5775cd(_0xa79eec);});});}return this[_0x43fc('0x32')][_0x43fc('0x30')](_0x532b47);};module[_0x43fc('0x33')]=EmailChannel; \ No newline at end of file +var _0x3c95=['handleImapError','disabled','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','error'];(function(_0x1411d8,_0x5d8a99){var _0x2572c7=function(_0x44515c){while(--_0x44515c){_0x1411d8['push'](_0x1411d8['shift']());}};_0x2572c7(++_0x5d8a99);}(_0x3c95,0x177));var _0x53c9=function(_0x2ea271,_0x5373b3){_0x2ea271=_0x2ea271-0x0;var _0x306656=_0x3c95[_0x2ea271];return _0x306656;};'use strict';var _=require(_0x53c9('0x0'));var moment=require(_0x53c9('0x1'));var BPromise=require(_0x53c9('0x2'));var md5=require(_0x53c9('0x3'));var Redis=require(_0x53c9('0x4'));var config=require(_0x53c9('0x5'));var logger=require('../../../config/logger')(_0x53c9('0x6'));config[_0x53c9('0x7')]=_['defaults'](config[_0x53c9('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x53c9('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x53c9('0x9'));var EmailSmtp=require(_0x53c9('0xa'));var mailAccount=require(_0x53c9('0xb'));var md5Accounts={};function EmailChannel(_0x41bc03){logger[_0x53c9('0xc')]('start\x20email\x20channel');this['mailAccounts']=_0x41bc03[_0x53c9('0xd')];this[_0x53c9('0xe')]={};this[_0x53c9('0xf')]=new EmailSmtp();}EmailChannel[_0x53c9('0x10')][_0x53c9('0x11')]=function(_0x1b14ad){var _0x3bc19b=this[_0x53c9('0xd')][_0x1b14ad];var _0x2b029b={'id':_0x3bc19b['id'],'name':_0x3bc19b['name'],'key':_0x3bc19b[_0x53c9('0x12')],'active':_0x3bc19b[_0x53c9('0x13')],'Imap':{'status':_0x3bc19b[_0x53c9('0x14')][_0x53c9('0x15')],'messageStatus':_0x3bc19b[_0x53c9('0x14')][_0x53c9('0x16')],'total':_0x3bc19b['Imap'][_0x53c9('0x17')]}};if(_['isNil'](md5Accounts[_0x1b14ad])){md5Accounts[_0x1b14ad]={};}var _0x4d8152=md5(JSON[_0x53c9('0x18')](_0x2b029b));if(md5Accounts[_0x1b14ad][_0x53c9('0x3')]!==_0x4d8152){md5Accounts[_0x1b14ad][_0x53c9('0x3')]=_0x4d8152;io[_0x53c9('0x11')](_0x53c9('0x19'),_0x2b029b);}};EmailChannel['prototype'][_0x53c9('0x1a')]=function(_0x787a56){for(var _0x5cfcb7 in _0x787a56){if(_0x787a56['hasOwnProperty'](_0x5cfcb7)){if(_0x787a56[_0x5cfcb7]['Imap']&&_0x787a56[_0x5cfcb7][_0x53c9('0x13')]){var _0x5331d3=_0x787a56[_0x5cfcb7][_0x53c9('0x14')];if(!this[_0x53c9('0xe')][_0x53c9('0x1b')](_0x5331d3['id'])){this[_0x53c9('0xe')][_0x5331d3['id']]=new EmailImap(_0x5331d3,_0x787a56[_0x5cfcb7][_0x53c9('0x6')]);this[_0x53c9('0xe')][_0x5331d3['id']]['on']('box',this[_0x53c9('0x1c')][_0x53c9('0x1d')](this,_0x5cfcb7));this['imapAccounts'][_0x5331d3['id']]['on']('email',this[_0x53c9('0x1e')][_0x53c9('0x1d')](this,_0x5cfcb7));this[_0x53c9('0xe')][_0x5331d3['id']]['on'](_0x53c9('0x1f'),this['handleImapEnd']['bind'](this,_0x5cfcb7));this[_0x53c9('0xe')][_0x5331d3['id']]['on'](_0x53c9('0x20'),this[_0x53c9('0x21')][_0x53c9('0x1d')](this,_0x5cfcb7));}}else{if(_['isNil'](this[_0x53c9('0xd')][_0x5cfcb7]['Imap'])){this[_0x53c9('0xd')][_0x5cfcb7][_0x53c9('0x14')]={};}this['mailAccounts'][_0x5cfcb7][_0x53c9('0x14')][_0x53c9('0x15')]=_0x53c9('0x22');this[_0x53c9('0xd')][_0x5cfcb7]['Imap']['messageStatus']='';this['emit'](_0x5cfcb7);}}}};EmailChannel[_0x53c9('0x10')][_0x53c9('0x1c')]=function(_0x449bf3,_0x194762){if(this[_0x53c9('0xd')][_0x449bf3]){this[_0x53c9('0xd')][_0x449bf3]['Imap']['status']='connected';this[_0x53c9('0xd')][_0x449bf3][_0x53c9('0x14')][_0x53c9('0x16')]=_0x194762[_0x53c9('0x23')];if(_0x194762['messages']){this[_0x53c9('0xd')][_0x449bf3][_0x53c9('0x14')][_0x53c9('0x17')]=_0x194762[_0x53c9('0x24')]['total'];}return this[_0x53c9('0x11')](_0x449bf3);}};EmailChannel[_0x53c9('0x10')]['handleImapEmail']=function(_0x35abb2,_0x2d761f){logger['info'](_0x53c9('0x25'),_0x2d761f[_0x53c9('0x26')],_0x2d761f[_0x53c9('0x27')],_0x2d761f[_0x53c9('0x28')],_0x35abb2);if(this[_0x53c9('0xd')][_0x35abb2]){return mailAccount['notify'](_0x35abb2,_0x2d761f)[_0x53c9('0x29')](function(_0x369ec2){if(_0x369ec2){logger[_0x53c9('0xc')](_0x53c9('0x2a'));}})[_0x53c9('0x2b')](function(_0x5a2509){logger[_0x53c9('0x20')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x53c9('0x18')](_0x5a2509));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x22e168){if(this[_0x53c9('0xd')][_0x22e168]&&this[_0x53c9('0xd')][_0x22e168]['Imap']){if(this['imapAccounts'][this[_0x53c9('0xd')][_0x22e168][_0x53c9('0x14')]['id']]){delete this[_0x53c9('0xe')][this[_0x53c9('0xd')][_0x22e168][_0x53c9('0x14')]['id']];}this['mailAccounts'][_0x22e168][_0x53c9('0x14')][_0x53c9('0x2c')]=moment();this[_0x53c9('0x11')](_0x22e168);}};EmailChannel[_0x53c9('0x10')][_0x53c9('0x21')]=function(_0x374491,_0x34c5d7){if(this[_0x53c9('0xd')][_0x374491]){this[_0x53c9('0xd')][_0x374491]['Imap'][_0x53c9('0x15')]=_0x53c9('0x20');this[_0x53c9('0xd')][_0x374491][_0x53c9('0x14')]['messageStatus']=_0x34c5d7;return this[_0x53c9('0x11')](_0x374491);}};EmailChannel['prototype'][_0x53c9('0x2d')]=function(_0x2ecf66,_0x37ca15){return this[_0x53c9('0xf')]['send'](_0x2ecf66,_0x37ca15);};EmailChannel[_0x53c9('0x10')][_0x53c9('0x2e')]=function(_0x41249f){var _0x25a73b=this;if(this[_0x53c9('0xd')][_0x41249f['id']]){if(_['isNil'](this[_0x53c9('0xd')][_0x41249f['id']][_0x53c9('0x2f')])){this[_0x53c9('0xd')][_0x41249f['id']][_0x53c9('0x2f')]={};}this[_0x53c9('0xd')][_0x41249f['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x3f6ef5,_0x20ad1a){return _0x25a73b[_0x53c9('0xf')][_0x53c9('0x30')](_0x41249f)[_0x53c9('0x29')](function(_0x35395b){_0x25a73b[_0x53c9('0xd')][_0x41249f['id']][_0x53c9('0x2f')][_0x53c9('0x15')]=_0x53c9('0x31');_0x25a73b[_0x53c9('0xd')][_0x41249f['id']][_0x53c9('0x2f')][_0x53c9('0x16')]='';_0x25a73b[_0x53c9('0x11')](_0x41249f['id']);_0x3f6ef5(_0x35395b);})['catch'](function(_0x1244a5){_0x25a73b[_0x53c9('0xd')][_0x41249f['id']][_0x53c9('0x2f')][_0x53c9('0x15')]=_0x53c9('0x20');_0x25a73b[_0x53c9('0xd')][_0x41249f['id']][_0x53c9('0x2f')][_0x53c9('0x16')]=_0x1244a5;_0x25a73b[_0x53c9('0x11')](_0x41249f['id']);_0x20ad1a(_0x1244a5);});});}return this[_0x53c9('0xf')]['verify'](_0x41249f);};module[_0x53c9('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 5857e87..ddf1455 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 _0x8439=['emit','closeBox','handleFetchError','handleEnd','stringify','textCode','upperFirst','exports','util','imap','lodash','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','account','once','ready','handleReady','bind','error','handleError','connect','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','prototype','box','readUnseen','handleCloseBox','search','UNSEEN','fetch','message','handleFetchMessage','end','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser'];(function(_0x4c32ab,_0x56af52){var _0x4176f1=function(_0x5a9bcd){while(--_0x5a9bcd){_0x4c32ab['push'](_0x4c32ab['shift']());}};_0x4176f1(++_0x56af52);}(_0x8439,0xf8));var _0x9843=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x8439[_0x2261ce];return _0x524640;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x9843('0x0'));var Imap=require(_0x9843('0x1'));var _=require(_0x9843('0x2'));var rs=require('randomstring');var simpleParser=require(_0x9843('0x3'))[_0x9843('0x4')];var Iconv=require(_0x9843('0x5'))[_0x9843('0x6')];var EventEmitter=require(_0x9843('0x7'))['EventEmitter'];var utils=require(_0x9843('0x8'));var logger=require(_0x9843('0x9'))(_0x9843('0xa'));function EmailImap(_0x125aa1,_0x3320e6){this[_0x9843('0xb')]=_0x9843('0xc');this[_0x9843('0xd')]=this['getAccount'](_0x125aa1,_0x3320e6);this[_0x9843('0x1')]=new Imap(this['account']);this[_0x9843('0x1')][_0x9843('0xe')](_0x9843('0xf'),this[_0x9843('0x10')][_0x9843('0x11')](this));this[_0x9843('0x1')][_0x9843('0xe')]('end',this['handleEnd'][_0x9843('0x11')](this));this[_0x9843('0x1')]['on'](_0x9843('0x12'),this[_0x9843('0x13')][_0x9843('0x11')](this));this['imap'][_0x9843('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x11db2f,_0x340557){var _0x3b4772={'connTimeout':_0x11db2f[_0x9843('0x15')]?_0x11db2f[_0x9843('0x15')]*0x3e8:0x2710,'authTimeout':_0x11db2f[_0x9843('0x16')]?_0x11db2f[_0x9843('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x11db2f[_0x9843('0x17')])){if(_0x11db2f[_0x9843('0x18')]){_0x3b4772[_0x9843('0x19')]=_0x11db2f['user'];_0x3b4772[_0x9843('0x1a')]=_0x11db2f[_0x9843('0x1a')];}_0x3b4772[_0x9843('0x1b')]=_0x11db2f[_0x9843('0x1b')];_0x3b4772[_0x9843('0x1c')]=_0x11db2f['port']||0x3e1;if(_0x11db2f['tls']){_0x3b4772[_0x9843('0x1d')]=!![];}else{_0x3b4772[_0x9843('0x1d')]=![];_0x3b4772[_0x9843('0x1e')]=_0x9843('0x1f');}}else{_0x3b4772['user']=_0x11db2f[_0x9843('0x19')];_0x3b4772[_0x9843('0x1a')]=_0x11db2f[_0x9843('0x1a')];_0x3b4772['host']=utils[_0x9843('0x20')](_0x11db2f['service']);_0x3b4772[_0x9843('0x1c')]=0x3e1;_0x3b4772[_0x9843('0x1d')]=!![];}_0x3b4772[_0x9843('0xa')]=_0x340557||_0x11db2f[_0x9843('0x19')]||_0x9843('0x21');return _0x3b4772;};EmailImap['prototype'][_0x9843('0x10')]=function(){this['imap'][_0x9843('0x22')](this[_0x9843('0xb')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x9843('0x23')]['handleOpenBox']=function(_0x56457a,_0xb627a8){if(_0x56457a){this['handleError'](_0x56457a,!![]);}else{this['emit'](_0x9843('0x24'),_0xb627a8);this[_0x9843('0x25')]();}};EmailImap[_0x9843('0x23')][_0x9843('0x26')]=function(_0x29486d){if(_0x29486d){this['handleError'](_0x29486d,!![]);}else{this[_0x9843('0x1')]['end']();}};EmailImap[_0x9843('0x23')][_0x9843('0x25')]=function(){this[_0x9843('0x1')][_0x9843('0x27')]([_0x9843('0x28')],this['handleReadUnseen'][_0x9843('0x11')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x4482b2,_0x2340e4){if(_0x4482b2){this[_0x9843('0x13')](_0x4482b2,!![]);}else{if(_0x2340e4['length']){try{var _0x15d2a0=this[_0x9843('0x1')][_0x9843('0x29')](_0x2340e4,{'bodies':'','markSeen':!![]});_0x15d2a0['on'](_0x9843('0x2a'),this[_0x9843('0x2b')][_0x9843('0x11')](this));_0x15d2a0[_0x9843('0xe')](_0x9843('0x12'),this['handleFetchError']['bind'](this));_0x15d2a0[_0x9843('0xe')](_0x9843('0x2c'),this['handleFetchEnd'][_0x9843('0x11')](this));}catch(_0x799b41){logger[_0x9843('0x12')](_0x799b41);}}else{this[_0x9843('0x1')]['closeBox'](!![],this[_0x9843('0x26')][_0x9843('0x11')](this));}}};EmailImap[_0x9843('0x23')][_0x9843('0x2b')]=function(_0xbfdf41,_0x33339d){_0xbfdf41['on'](_0x9843('0x2d'),this[_0x9843('0x2e')][_0x9843('0x11')](this));_0xbfdf41[_0x9843('0xe')](_0x9843('0x2f'),this[_0x9843('0x30')]['bind'](this));_0xbfdf41[_0x9843('0xe')](_0x9843('0x2c'),this[_0x9843('0x31')]['bind'](this));};EmailImap[_0x9843('0x23')][_0x9843('0x2e')]=function(_0x11ca10,_0x2df837){simpleParser(_0x11ca10,{'Iconv':Iconv},this[_0x9843('0x32')][_0x9843('0x11')](this));};EmailImap['prototype'][_0x9843('0x30')]=function(_0x801d8c){};EmailImap['prototype'][_0x9843('0x31')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x16c5f2,_0x593239){if(_0x16c5f2){logger[_0x9843('0x12')](_0x16c5f2);}else{var _0x150b27=this;utils[_0x9843('0x33')](this[_0x9843('0xd')],_0x593239,function(_0x2e2aa3){_0x150b27[_0x9843('0x34')](_0x9843('0xa'),_0x2e2aa3);});}};EmailImap[_0x9843('0x23')]['handleFetchEnd']=function(){this[_0x9843('0x1')][_0x9843('0x35')](!![],this[_0x9843('0x26')][_0x9843('0x11')](this));};EmailImap[_0x9843('0x23')][_0x9843('0x36')]=function(_0x3edd4f){this[_0x9843('0x13')](_0x3edd4f);this[_0x9843('0x1')]['closeBox'](!![],this[_0x9843('0x26')][_0x9843('0x11')](this));};EmailImap[_0x9843('0x23')][_0x9843('0x37')]=function(){this[_0x9843('0x34')](_0x9843('0x2c'));};EmailImap['prototype'][_0x9843('0x13')]=function(_0x2f1c57,_0x570feb){logger[_0x9843('0x12')](_0x9843('0x13'),this[_0x9843('0xd')][_0x9843('0xa')],JSON[_0x9843('0x38')](_0x2f1c57));var _0x51981b='';if(_0x2f1c57){if(_0x2f1c57[_0x9843('0x39')]){_0x51981b=_0x2f1c57[_0x9843('0x39')];}else{for(var _0x4e22f8 in _0x2f1c57){if(_0x2f1c57['hasOwnProperty'](_0x4e22f8)){_0x51981b+=_[_0x9843('0x3a')](_0x4e22f8)+':\x20'+_0x2f1c57[_0x4e22f8]+'\x0a';}}}}if(_0x570feb){this[_0x9843('0x1')][_0x9843('0x2c')]();}else{this[_0x9843('0x34')](_0x9843('0x12'),_0x51981b);this[_0x9843('0x34')](_0x9843('0x2c'));}};module[_0x9843('0x3b')]=EmailImap; \ No newline at end of file +var _0x7c0a=['prototype','getAccount','authTimeout','isNil','service','authentication','password','host','port','tls','autotls','user','getHost','handleOpenBox','emit','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','path','imap','lodash','randomstring','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits'];(function(_0x29f095,_0x5c23ac){var _0x180061=function(_0x49c12d){while(--_0x49c12d){_0x29f095['push'](_0x29f095['shift']());}};_0x180061(++_0x5c23ac);}(_0x7c0a,0x1d0));var _0xa7c0=function(_0x481a17,_0x6fcb3c){_0x481a17=_0x481a17-0x0;var _0x1fd04d=_0x7c0a[_0x481a17];return _0x1fd04d;};'use strict';var fs=require('fs');var path=require(_0xa7c0('0x0'));var util=require('util');var Imap=require(_0xa7c0('0x1'));var _=require(_0xa7c0('0x2'));var rs=require(_0xa7c0('0x3'));var simpleParser=require(_0xa7c0('0x4'))[_0xa7c0('0x5')];var Iconv=require('iconv')[_0xa7c0('0x6')];var EventEmitter=require(_0xa7c0('0x7'))[_0xa7c0('0x8')];var utils=require(_0xa7c0('0x9'));var logger=require(_0xa7c0('0xa'))(_0xa7c0('0xb'));function EmailImap(_0x155645,_0x4d6c57){this[_0xa7c0('0xc')]='INBOX';this[_0xa7c0('0xd')]=this['getAccount'](_0x155645,_0x4d6c57);this[_0xa7c0('0x1')]=new Imap(this['account']);this[_0xa7c0('0x1')][_0xa7c0('0xe')](_0xa7c0('0xf'),this[_0xa7c0('0x10')][_0xa7c0('0x11')](this));this[_0xa7c0('0x1')][_0xa7c0('0xe')](_0xa7c0('0x12'),this[_0xa7c0('0x13')][_0xa7c0('0x11')](this));this[_0xa7c0('0x1')]['on'](_0xa7c0('0x14'),this[_0xa7c0('0x15')][_0xa7c0('0x11')](this));this[_0xa7c0('0x1')][_0xa7c0('0x16')]();}util[_0xa7c0('0x17')](EmailImap,EventEmitter);EmailImap[_0xa7c0('0x18')][_0xa7c0('0x19')]=function(_0x60660e,_0x32da5c){var _0x1daac1={'connTimeout':_0x60660e['connTimeout']?_0x60660e['connTimeout']*0x3e8:0x2710,'authTimeout':_0x60660e[_0xa7c0('0x1a')]?_0x60660e['authTimeout']*0x3e8:0x1388};if(_[_0xa7c0('0x1b')](_0x60660e[_0xa7c0('0x1c')])){if(_0x60660e[_0xa7c0('0x1d')]){_0x1daac1['user']=_0x60660e['user'];_0x1daac1[_0xa7c0('0x1e')]=_0x60660e[_0xa7c0('0x1e')];}_0x1daac1['host']=_0x60660e[_0xa7c0('0x1f')];_0x1daac1['port']=_0x60660e[_0xa7c0('0x20')]||0x3e1;if(_0x60660e['tls']){_0x1daac1['tls']=!![];}else{_0x1daac1[_0xa7c0('0x21')]=![];_0x1daac1[_0xa7c0('0x22')]='required';}}else{_0x1daac1[_0xa7c0('0x23')]=_0x60660e[_0xa7c0('0x23')];_0x1daac1[_0xa7c0('0x1e')]=_0x60660e[_0xa7c0('0x1e')];_0x1daac1[_0xa7c0('0x1f')]=utils[_0xa7c0('0x24')](_0x60660e[_0xa7c0('0x1c')]);_0x1daac1[_0xa7c0('0x20')]=0x3e1;_0x1daac1[_0xa7c0('0x21')]=!![];}_0x1daac1[_0xa7c0('0xb')]=_0x32da5c||_0x60660e[_0xa7c0('0x23')]||'anonymous@xcally.com';return _0x1daac1;};EmailImap[_0xa7c0('0x18')]['handleReady']=function(){this[_0xa7c0('0x1')]['openBox'](this[_0xa7c0('0xc')],![],this[_0xa7c0('0x25')][_0xa7c0('0x11')](this));};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x25')]=function(_0x2d0865,_0x1cec1a){if(_0x2d0865){this[_0xa7c0('0x15')](_0x2d0865,!![]);}else{this[_0xa7c0('0x26')]('box',_0x1cec1a);this['readUnseen']();}};EmailImap['prototype']['handleCloseBox']=function(_0x503435){if(_0x503435){this['handleError'](_0x503435,!![]);}else{this[_0xa7c0('0x1')][_0xa7c0('0x12')]();}};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x27')]=function(){this['imap'][_0xa7c0('0x28')]([_0xa7c0('0x29')],this[_0xa7c0('0x2a')]['bind'](this));};EmailImap[_0xa7c0('0x18')]['handleReadUnseen']=function(_0x4727e3,_0x21a62b){if(_0x4727e3){this['handleError'](_0x4727e3,!![]);}else{if(_0x21a62b[_0xa7c0('0x2b')]){try{var _0x958c1d=this[_0xa7c0('0x1')][_0xa7c0('0x2c')](_0x21a62b,{'bodies':'','markSeen':!![]});_0x958c1d['on'](_0xa7c0('0x2d'),this[_0xa7c0('0x2e')][_0xa7c0('0x11')](this));_0x958c1d['once'](_0xa7c0('0x14'),this[_0xa7c0('0x2f')][_0xa7c0('0x11')](this));_0x958c1d[_0xa7c0('0xe')](_0xa7c0('0x12'),this['handleFetchEnd'][_0xa7c0('0x11')](this));}catch(_0x2e4dc0){logger[_0xa7c0('0x14')](_0x2e4dc0);}}else{this['imap'][_0xa7c0('0x30')](!![],this[_0xa7c0('0x31')][_0xa7c0('0x11')](this));}}};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x2e')]=function(_0x38c799,_0x593801){_0x38c799['on'](_0xa7c0('0x32'),this[_0xa7c0('0x33')]['bind'](this));_0x38c799[_0xa7c0('0xe')](_0xa7c0('0x34'),this[_0xa7c0('0x35')][_0xa7c0('0x11')](this));_0x38c799['once'](_0xa7c0('0x12'),this['handleMessageEnd'][_0xa7c0('0x11')](this));};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x33')]=function(_0x31e586,_0xcfb6c0){simpleParser(_0x31e586,{'Iconv':Iconv},this['handleSimpleParser'][_0xa7c0('0x11')](this));};EmailImap[_0xa7c0('0x18')]['handleMessageAttributes']=function(_0x53e48b){};EmailImap['prototype'][_0xa7c0('0x36')]=function(){};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x37')]=function(_0x42891e,_0x2ed732){if(_0x42891e){logger[_0xa7c0('0x14')](_0x42891e);}else{var _0x7b3d94=this;utils[_0xa7c0('0x38')](this['account'],_0x2ed732,function(_0x5c1b4b){_0x7b3d94[_0xa7c0('0x26')](_0xa7c0('0xb'),_0x5c1b4b);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0xa7c0('0x1')][_0xa7c0('0x30')](!![],this[_0xa7c0('0x31')][_0xa7c0('0x11')](this));};EmailImap[_0xa7c0('0x18')]['handleFetchError']=function(_0x3494d2){this['handleError'](_0x3494d2);this[_0xa7c0('0x1')][_0xa7c0('0x30')](!![],this[_0xa7c0('0x31')][_0xa7c0('0x11')](this));};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x13')]=function(){this[_0xa7c0('0x26')](_0xa7c0('0x12'));};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x15')]=function(_0x2af757,_0x1410bc){logger['error'](_0xa7c0('0x15'),this[_0xa7c0('0xd')][_0xa7c0('0xb')],JSON[_0xa7c0('0x39')](_0x2af757));var _0x48fa4e='';if(_0x2af757){if(_0x2af757[_0xa7c0('0x3a')]){_0x48fa4e=_0x2af757[_0xa7c0('0x3a')];}else{for(var _0x2ffdd7 in _0x2af757){if(_0x2af757[_0xa7c0('0x3b')](_0x2ffdd7)){_0x48fa4e+=_[_0xa7c0('0x3c')](_0x2ffdd7)+':\x20'+_0x2af757[_0x2ffdd7]+'\x0a';}}}}if(_0x1410bc){this[_0xa7c0('0x1')]['end']();}else{this[_0xa7c0('0x26')](_0xa7c0('0x14'),_0x48fa4e);this['emit'](_0xa7c0('0x12'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index c0a2517..5e61ac2 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 _0x2a3d=['Not\x20verifired','exports','nodemailer','createTransport','use','sendMail','toString','prototype','verify'];(function(_0x2d0e1b,_0x1bb236){var _0xf44590=function(_0xfabe4f){while(--_0xfabe4f){_0x2d0e1b['push'](_0x2d0e1b['shift']());}};_0xf44590(++_0x1bb236);}(_0x2a3d,0x1b2));var _0xd2a3=function(_0x5ecd2e,_0x239987){_0x5ecd2e=_0x5ecd2e-0x0;var _0x1b8de5=_0x2a3d[_0x5ecd2e];return _0x1b8de5;};'use strict';var nodemailer=require(_0xd2a3('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x30c477,_0x4fd547){return new BPromise(function(_0x2a02fd,_0xa513f){var _0x5d84b3=nodemailer[_0xd2a3('0x1')](_0x30c477);_0x5d84b3[_0xd2a3('0x2')]('compile',inlineBase64());_0x5d84b3[_0xd2a3('0x3')](_0x4fd547,function(_0x5035b9,_0x1e2357){if(_0x5035b9){_0xa513f(_0x5035b9[_0xd2a3('0x4')]());}else{_0x2a02fd(_0x1e2357);}});});};EmailSmtp[_0xd2a3('0x5')][_0xd2a3('0x6')]=function(_0x5ecc8c){return new BPromise(function(_0x5e70dc,_0x341bb8){var _0x50441b=nodemailer[_0xd2a3('0x1')](_0x5ecc8c);_0x50441b['verify'](function(_0x37e02e,_0x41f63a){if(_0x37e02e){_0x341bb8(_0x37e02e[_0xd2a3('0x4')]());}else{if(_0x41f63a){_0x5e70dc(_0x41f63a);}else{_0x341bb8(_0xd2a3('0x7'));}}});});};module[_0xd2a3('0x8')]=EmailSmtp; \ No newline at end of file +var _0x861a=['compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use'];(function(_0x33cd79,_0x52b92e){var _0x43d081=function(_0x191d93){while(--_0x191d93){_0x33cd79['push'](_0x33cd79['shift']());}};_0x43d081(++_0x52b92e);}(_0x861a,0x19d));var _0xa861=function(_0x286063,_0x5445bb){_0x286063=_0x286063-0x0;var _0x5bb1ed=_0x861a[_0x286063];return _0x5bb1ed;};'use strict';var nodemailer=require(_0xa861('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xa861('0x1'));function EmailSmtp(){}EmailSmtp[_0xa861('0x2')]['send']=function(_0x5aff15,_0xf1128c){return new BPromise(function(_0x4c8a67,_0x4d129e){var _0x53c937=nodemailer[_0xa861('0x3')](_0x5aff15);_0x53c937[_0xa861('0x4')](_0xa861('0x5'),inlineBase64());_0x53c937[_0xa861('0x6')](_0xf1128c,function(_0x30452f,_0x5ddf50){if(_0x30452f){_0x4d129e(_0x30452f[_0xa861('0x7')]());}else{_0x4c8a67(_0x5ddf50);}});});};EmailSmtp[_0xa861('0x2')][_0xa861('0x8')]=function(_0xa61dff){return new BPromise(function(_0x220e14,_0x38bdf1){var _0x2ebea6=nodemailer['createTransport'](_0xa61dff);_0x2ebea6[_0xa861('0x8')](function(_0x14f396,_0x569582){if(_0x14f396){_0x38bdf1(_0x14f396['toString']());}else{if(_0x569582){_0x220e14(_0x569582);}else{_0x38bdf1(_0xa861('0x9'));}}});});};module[_0xa861('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 99f74bd..ab15c7e 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 _0x78fd=['application/ms-tnef','info','messageId','parseBuffer','first','BodyHTML','Attachments','push','Data','

Empty\x20message

','getHost','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','@xcally.com','value','name','split','length','slice','join','Anonymous','pop','isEmpty','generate','html','test','replace','body','textAsHtml','0x1?_0xf078f7[_0xd78f('0x13')]():'';}return'';}function getMails(_0x52591b,_0x246eb8){var _0x37d642='';for(var _0x33d5ca=0x0;_0x33d5ca<_0x246eb8[_0xd78f('0xc')][_0xd78f('0xf')];_0x33d5ca+=0x1){if(_0x246eb8[_0xd78f('0xc')][_0x33d5ca][_0xd78f('0x9')]!==_0x52591b){if(!_[_0xd78f('0x14')](_0x37d642)){_0x37d642+=',';}_0x37d642+=_0x246eb8['value'][_0x33d5ca][_0xd78f('0xd')]||_0x246eb8[_0xd78f('0xc')][_0x33d5ca][_0xd78f('0x9')]||'';_0x37d642+='\x20<';_0x37d642+=_0x246eb8[_0xd78f('0xc')][_0x33d5ca]['address']?_0x246eb8[_0xd78f('0xc')][_0x33d5ca][_0xd78f('0x9')]:'anonymous'+random[_0xd78f('0x15')](0x6)+_0xd78f('0xb');_0x37d642+='>';}}return _0x37d642;}function parseEmail(_0x2cf4fa,_0x4453f2,_0x673a96){if(_0x4453f2[_0xd78f('0x16')]){var _0x45241f=/)<[^<]*)*<\/script>/gi;while(_0x45241f[_0xd78f('0x17')](_0x4453f2[_0xd78f('0x16')])){_0x4453f2[_0xd78f('0x16')]=_0x4453f2[_0xd78f('0x16')][_0xd78f('0x18')](_0x45241f,'');}_0x673a96['body']=_0x4453f2['html'];}else{_0x673a96[_0xd78f('0x19')]=_0x4453f2[_0xd78f('0x1a')];}if(_0x673a96[_0xd78f('0x19')]){_0x673a96[_0xd78f('0x19')]=_0x673a96['body'][_0xd78f('0x18')](/Empty\x20message

';if(_0x3bef2d[_0xd78f('0x37')]){for(var _0x3affcb=0x0;_0x3affcb<_0x3bef2d[_0xd78f('0x37')][_0xd78f('0xf')];_0x3affcb++){var _0x5d1763=_0x3bef2d[_0xd78f('0x37')][_0x3affcb];_0x42b34e['message'][_0xd78f('0x20')][_0xd78f('0x38')]({'filename':_0x5d1763['Title'],'content':new Buffer(_0x5d1763[_0xd78f('0x39')])});}}}_0x309a74(parseEmail(_0x464fd2,_0x4a28a1,_0x42b34e));});}else{_0x4a28a1['html']=_0xd78f('0x3a');_0x309a74(parseEmail(_0x464fd2,_0x4a28a1,_0x42b34e));}}else{_0x309a74(parseEmail(_0x464fd2,_0x4a28a1,_0x42b34e));}};exports[_0xd78f('0x3b')]=function(_0x393796){switch(_0x393796){case'gmail':return'imap.gmail.com';case _0xd78f('0x3c'):return _0xd78f('0x3d');case _0xd78f('0x3e'):return'imap-mail.outlook.com';case _0xd78f('0x3f'):return _0xd78f('0x40');}return _0xd78f('0x41');}; \ No newline at end of file +var _0xce82=['test','replace','body','textAsHtml','message','originTo','originCc','includes','attachments','type','attachment','filename','format','%s-%s','now','server/files/attachments/','writeFileSync','content','contentType','parser','from','subject','messageId','inReplyTo','date','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','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','split','length','slice','join','Anonymous','pop','isEmpty','generate','html'];(function(_0x41c99a,_0x12414d){var _0x303bf9=function(_0x219646){while(--_0x219646){_0x41c99a['push'](_0x41c99a['shift']());}};_0x303bf9(++_0x12414d);}(_0xce82,0x182));var _0x2ce8=function(_0x3db137,_0x66740){_0x3db137=_0x3db137-0x0;var _0x569d1f=_0xce82[_0x3db137];return _0x569d1f;};'use strict';var _=require(_0x2ce8('0x0'));var moment=require(_0x2ce8('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0x2ce8('0x2'));var tnef=require(_0x2ce8('0x3'));var logger=require(_0x2ce8('0x4'))(_0x2ce8('0x5'));var config=require(_0x2ce8('0x6'));function getAddress(_0x1ecb25){var _0x2ba0ef=_[_0x2ce8('0x7')](_0x1ecb25[_0x2ce8('0x8')]);return _0x2ba0ef&&_0x2ba0ef[_0x2ce8('0x9')]?_0x2ba0ef[_0x2ce8('0x9')]:_0x2ce8('0xa')+random['generate'](0x6)+_0x2ce8('0xb');}function getFirstName(_0x476c05){var _0x3d68bd=_[_0x2ce8('0x7')](_0x476c05['value']);if(_0x3d68bd&&_0x3d68bd['name']){var _0x12c03c=_0x3d68bd[_0x2ce8('0xc')][_0x2ce8('0xd')](/\s+/);return _0x12c03c[_0x2ce8('0xe')]?_0x12c03c[_0x2ce8('0xf')](0x0,-0x1)[_0x2ce8('0x10')]('\x20'):_0x3d68bd[_0x2ce8('0xc')];}return _0x2ce8('0x11');}function getLastName(_0x169230){var _0xabc506=_[_0x2ce8('0x7')](_0x169230[_0x2ce8('0x8')]);if(_0xabc506&&_0xabc506[_0x2ce8('0xc')]){var _0x159d99=_0xabc506['name'][_0x2ce8('0xd')](/\s+/);return _0x159d99[_0x2ce8('0xe')]>0x1?_0x159d99[_0x2ce8('0x12')]():'';}return'';}function getMails(_0x46e152,_0x12964a){var _0x382b33='';for(var _0xc0651a=0x0;_0xc0651a<_0x12964a[_0x2ce8('0x8')]['length'];_0xc0651a+=0x1){if(_0x12964a[_0x2ce8('0x8')][_0xc0651a][_0x2ce8('0x9')]!==_0x46e152){if(!_[_0x2ce8('0x13')](_0x382b33)){_0x382b33+=',';}_0x382b33+=_0x12964a[_0x2ce8('0x8')][_0xc0651a][_0x2ce8('0xc')]||_0x12964a['value'][_0xc0651a][_0x2ce8('0x9')]||'';_0x382b33+='\x20<';_0x382b33+=_0x12964a[_0x2ce8('0x8')][_0xc0651a][_0x2ce8('0x9')]?_0x12964a['value'][_0xc0651a][_0x2ce8('0x9')]:_0x2ce8('0xa')+random[_0x2ce8('0x14')](0x6)+_0x2ce8('0xb');_0x382b33+='>';}}return _0x382b33;}function parseEmail(_0x1e5800,_0x4c19d8,_0x1dbc66){if(_0x4c19d8[_0x2ce8('0x15')]){var _0xcc5cb=/)<[^<]*)*<\/script>/gi;while(_0xcc5cb[_0x2ce8('0x16')](_0x4c19d8[_0x2ce8('0x15')])){_0x4c19d8[_0x2ce8('0x15')]=_0x4c19d8[_0x2ce8('0x15')][_0x2ce8('0x17')](_0xcc5cb,'');}_0x1dbc66[_0x2ce8('0x18')]=_0x4c19d8[_0x2ce8('0x15')];}else{_0x1dbc66[_0x2ce8('0x18')]=_0x4c19d8[_0x2ce8('0x19')];}if(_0x1dbc66[_0x2ce8('0x18')]){_0x1dbc66[_0x2ce8('0x18')]=_0x1dbc66[_0x2ce8('0x18')][_0x2ce8('0x17')](/0x0){if(this[_0x154451+_0xeb62('0x2b')]>0x0&&this[_0x154451+_0xeb62('0x2a')]>=this[_0x154451+'Capacity']){return'maxcapacity';}else{return _0xeb62('0x2c');}}else{return _0xeb62('0x2d');}};Agent[_0xeb62('0x2e')][_0xeb62('0x2f')]=function(){var _0x55a169=['mail',_0xeb62('0x30'),'openchannel',_0xeb62('0x31'),'sms',_0xeb62('0x32')];for(var _0x516a72=0x0;_0x516a72<_0x55a169[_0xeb62('0x33')];_0x516a72+=0x1){var _0x6bfbbc=this[_0xeb62('0x29')](_0x55a169[_0x516a72]);if(this[_0x55a169[_0x516a72]+'Status']!==_0x6bfbbc){this[_0x55a169[_0x516a72]+_0xeb62('0x34')]=_[_0xeb62('0x35')](moment()[_0xeb62('0x36')]('x'));}this[_0x55a169[_0x516a72]+_0xeb62('0x37')]=_0x6bfbbc;}var _0x42f486={'id':this['id'],'name':this[_0xeb62('0x8')],'online':this['online'],'voicePause':this[_0xeb62('0xa')],'chatPause':this[_0xeb62('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0xeb62('0xd')],'faxPause':this[_0xeb62('0xc')],'openchannelPause':this[_0xeb62('0xe')],'chatStatus':this[_0xeb62('0xf')],'chatStatusTime':this[_0xeb62('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xeb62('0x14')],'mailStatusTime':this[_0xeb62('0x15')],'mailCapacity':this[_0xeb62('0x16')],'mailCurrentCapacity':this[_0xeb62('0x17')],'faxStatus':this[_0xeb62('0x18')],'faxStatusTime':this[_0xeb62('0x19')],'faxCapacity':this[_0xeb62('0x1a')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xeb62('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xeb62('0x1e')],'whatsappStatus':this[_0xeb62('0x1f')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xeb62('0x21')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xeb62('0x23')],'openchannelStatusTime':this[_0xeb62('0x24')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xeb62('0x26')],'busy':this[_0xeb62('0x27')],'busyQueue':this['busyQueue']};var _0x1b3a60=md5(JSON[_0xeb62('0x38')](_0x42f486));if(this[_0xeb62('0x2')]!==_0x1b3a60){this[_0xeb62('0x2')]=_0x1b3a60;io['emit'](_0xeb62('0x39'),_0x42f486);}};module[_0xeb62('0x3a')]=Agent; \ No newline at end of file +var _0x2547=['smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','chat','openchannel','fax','sms','length','Status','toNumber','format','mailPause','stringify','emit','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus'];(function(_0x401ec9,_0x77c73f){var _0x8ef3a1=function(_0x171c3c){while(--_0x171c3c){_0x401ec9['push'](_0x401ec9['shift']());}};_0x8ef3a1(++_0x77c73f);}(_0x2547,0x1cd));var _0x7254=function(_0x11af27,_0x4f4ebe){_0x11af27=_0x11af27-0x0;var _0x2266e3=_0x2547[_0x11af27];return _0x2266e3;};'use strict';var _=require('lodash');var moment=require(_0x7254('0x0'));var md5=require(_0x7254('0x1'));var Redis=require(_0x7254('0x2'));var config=require(_0x7254('0x3'));config[_0x7254('0x4')]=_[_0x7254('0x5')](config[_0x7254('0x4')],{'host':_0x7254('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7254('0x4')]));function Agent(_0x59705f){this['id']=_0x59705f['id']||0x0;this[_0x7254('0x7')]=_0x59705f[_0x7254('0x7')]||'';this['online']=_0x59705f[_0x7254('0x8')]||!![];this[_0x7254('0x9')]=_0x59705f[_0x7254('0x9')]||![];this['chatPause']=_0x59705f[_0x7254('0xa')]||![];this['mailPause']=_0x59705f['mailPause']||![];this['faxPause']=_0x59705f[_0x7254('0xb')]||![];this[_0x7254('0xc')]=_0x59705f[_0x7254('0xc')]||![];this[_0x7254('0xd')]=_0x59705f[_0x7254('0xd')]||![];this[_0x7254('0xe')]='unknown';this[_0x7254('0xf')]=0x0;this['chatCapacity']=_0x59705f[_0x7254('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x7254('0x11')]=_0x7254('0x12');this[_0x7254('0x13')]=0x0;this[_0x7254('0x14')]=_0x59705f[_0x7254('0x14')]||0x0;this[_0x7254('0x15')]=0x0;this[_0x7254('0x16')]=_0x7254('0x12');this[_0x7254('0x17')]=0x0;this[_0x7254('0x18')]=_0x59705f[_0x7254('0x18')]||0x0;this[_0x7254('0x19')]=0x0;this[_0x7254('0x1a')]='unknown';this[_0x7254('0x1b')]=0x0;this[_0x7254('0x1c')]=_0x59705f[_0x7254('0x1c')]||0x0;this[_0x7254('0x1d')]=0x0;this[_0x7254('0x1e')]=_0x7254('0x12');this[_0x7254('0x1f')]=0x0;this['whatsappCapacity']=_0x59705f[_0x7254('0x20')]||0x0;this[_0x7254('0x21')]=0x0;this[_0x7254('0x22')]=_0x7254('0x12');this[_0x7254('0x23')]=0x0;this[_0x7254('0x24')]=_0x59705f[_0x7254('0x24')]||0x0;this[_0x7254('0x25')]=0x0;this[_0x7254('0x26')]=![];this[_0x7254('0x27')]=undefined;this[_0x7254('0x1')]='';this[_0x7254('0x28')]();}Agent[_0x7254('0x29')][_0x7254('0x2a')]=function(_0x42d828){if(this[_0x42d828+_0x7254('0x2b')]>0x0){if(this[_0x42d828+_0x7254('0x2c')]>0x0&&this[_0x42d828+_0x7254('0x2b')]>=this[_0x42d828+_0x7254('0x2c')]){return _0x7254('0x2d');}else{return _0x7254('0x2e');}}else{return'idle';}};Agent['prototype'][_0x7254('0x28')]=function(){var _0xd91c1f=[_0x7254('0x2f'),_0x7254('0x30'),_0x7254('0x31'),_0x7254('0x32'),_0x7254('0x33'),'whatsapp'];for(var _0x133287=0x0;_0x133287<_0xd91c1f[_0x7254('0x34')];_0x133287+=0x1){var _0x2b4f46=this['getChannelStatus'](_0xd91c1f[_0x133287]);if(this[_0xd91c1f[_0x133287]+_0x7254('0x35')]!==_0x2b4f46){this[_0xd91c1f[_0x133287]+'StatusTime']=_[_0x7254('0x36')](moment()[_0x7254('0x37')]('x'));}this[_0xd91c1f[_0x133287]+'Status']=_0x2b4f46;}var _0x17bb46={'id':this['id'],'name':this[_0x7254('0x7')],'online':this['online'],'voicePause':this[_0x7254('0x9')],'chatPause':this[_0x7254('0xa')],'mailPause':this[_0x7254('0x38')],'smsPause':this[_0x7254('0xc')],'faxPause':this[_0x7254('0xb')],'openchannelPause':this[_0x7254('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x7254('0xf')],'chatCapacity':this[_0x7254('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x7254('0x11')],'mailStatusTime':this[_0x7254('0x13')],'mailCapacity':this[_0x7254('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x7254('0x16')],'faxStatusTime':this[_0x7254('0x17')],'faxCapacity':this[_0x7254('0x18')],'faxCurrentCapacity':this[_0x7254('0x19')],'smsStatus':this[_0x7254('0x1a')],'smsStatusTime':this[_0x7254('0x1b')],'smsCapacity':this[_0x7254('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x7254('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x7254('0x21')],'openchannelStatus':this[_0x7254('0x22')],'openchannelStatusTime':this[_0x7254('0x23')],'openchannelCapacity':this[_0x7254('0x24')],'openchannelCurrentCapacity':this[_0x7254('0x25')],'busy':this[_0x7254('0x26')],'busyQueue':this[_0x7254('0x27')]};var _0x147cef=md5(JSON[_0x7254('0x39')](_0x17bb46));if(this[_0x7254('0x1')]!==_0x147cef){this[_0x7254('0x1')]=_0x147cef;io[_0x7254('0x3a')](_0x7254('0x3b'),_0x17bb46);}};module[_0x7254('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a504acb..fcacb74 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 _0x51d1=['chatPause','available','stringify','format','chat_queue:save','exports','lodash','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','loggedIn','paused'];(function(_0x53a03e,_0x44260a){var _0x553067=function(_0xa1d45b){while(--_0xa1d45b){_0x53a03e['push'](_0x53a03e['shift']());}};_0x553067(++_0x44260a);}(_0x51d1,0x196));var _0x151d=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0x51d1[_0x5c1cdc];return _0x2e8317;};'use strict';var _=require(_0x151d('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x151d('0x1'));config['redis']=_['defaults'](config[_0x151d('0x2')],{'host':_0x151d('0x3'),'port':0x18eb});var io=require(_0x151d('0x4'))(new Redis(config[_0x151d('0x2')]));function ChatQueue(_0x27d5a6){this['id']=_0x27d5a6['id']||0x0;this[_0x151d('0x5')]=_0x27d5a6['name']||'';this[_0x151d('0x6')]=_0x27d5a6['timeout']||0xa;this[_0x151d('0x7')]=_0x27d5a6[_0x151d('0x7')]||_0x151d('0x8');this['Agents']=_0x27d5a6[_0x151d('0x9')];this['mapAgentsId']={};this[_0x151d('0xa')]=0x0;this[_0x151d('0xb')]='';this[_0x151d('0xc')]();this[_0x151d('0xd')]();}ChatQueue[_0x151d('0xe')]['updateRouting']=function(){var _0x4bb431=this[_0x151d('0xf')]['_rr'];this[_0x151d('0xf')]=_[_0x151d('0x10')](this[_0x151d('0x9')],'id');this[_0x151d('0xf')]['_rr']=_0x4bb431;};ChatQueue[_0x151d('0xe')][_0x151d('0xd')]=function(){this[_0x151d('0x11')]=0x0;this[_0x151d('0x12')]=0x0;for(var _0x2b461d=0x0;_0x2b461d=0x0?this['available']:0x0;var _0x45b60a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x151d('0x11')],'name':this[_0x151d('0x5')],'paused':this[_0x151d('0x12')],'waiting':this[_0x151d('0xa')]};var _0x5305b1=md5(JSON[_0x151d('0x15')](_0x45b60a));if(this[_0x151d('0xb')]!==_0x5305b1){this[_0x151d('0xb')]=_0x5305b1;io['to'](util[_0x151d('0x16')]('chat:queue:%s',_0x45b60a['name']))['emit'](_0x151d('0x17'),_0x45b60a);}};module[_0x151d('0x18')]=ChatQueue; \ No newline at end of file +var _0x7c01=['waiting','updateRouting','prototype','map','paused','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x7c01,0xd3));var _0x17c0=function(_0x133ef7,_0x4ffae8){_0x133ef7=_0x133ef7-0x0;var _0x30fbbd=_0x7c01[_0x133ef7];return _0x30fbbd;};'use strict';var _=require('lodash');var md5=require(_0x17c0('0x0'));var util=require(_0x17c0('0x1'));var Redis=require(_0x17c0('0x2'));var config=require(_0x17c0('0x3'));config[_0x17c0('0x4')]=_['defaults'](config[_0x17c0('0x4')],{'host':_0x17c0('0x5'),'port':0x18eb});var io=require(_0x17c0('0x6'))(new Redis(config[_0x17c0('0x4')]));function ChatQueue(_0x1e463a){this['id']=_0x1e463a['id']||0x0;this[_0x17c0('0x7')]=_0x1e463a['name']||'';this['timeout']=_0x1e463a[_0x17c0('0x8')]||0xa;this[_0x17c0('0x9')]=_0x1e463a['strategy']||_0x17c0('0xa');this[_0x17c0('0xb')]=_0x1e463a[_0x17c0('0xb')];this[_0x17c0('0xc')]={};this[_0x17c0('0xd')]=0x0;this[_0x17c0('0x0')]='';this[_0x17c0('0xe')]();this['updateRealtime']();}ChatQueue[_0x17c0('0xf')][_0x17c0('0xe')]=function(){var _0x5b2fc3=this[_0x17c0('0xc')]['_rr'];this[_0x17c0('0xc')]=_[_0x17c0('0x10')](this['Agents'],'id');this[_0x17c0('0xc')]['_rr']=_0x5b2fc3;};ChatQueue[_0x17c0('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x17c0('0x11')]=0x0;for(var _0x1c4b87=0x0;_0x1c4b87=0x0?this[_0x17c0('0x16')]:0x0;var _0x234acc={'id':this['id'],'available':this[_0x17c0('0x16')],'loggedIn':this[_0x17c0('0x14')],'name':this[_0x17c0('0x7')],'paused':this[_0x17c0('0x11')],'waiting':this[_0x17c0('0xd')]};var _0x30f759=md5(JSON[_0x17c0('0x17')](_0x234acc));if(this[_0x17c0('0x0')]!==_0x30f759){this['md5']=_0x30f759;io['to'](util[_0x17c0('0x18')](_0x17c0('0x19'),_0x234acc[_0x17c0('0x7')]))['emit'](_0x17c0('0x1a'),_0x234acc);}};module[_0x17c0('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 407acb8..def7066 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(_0x466cab,_0x4ad2a3){var _0x9d1660=function(_0x186960){while(--_0x186960){_0x466cab['push'](_0x466cab['shift']());}};_0x9d1660(++_0x4ad2a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x22351d,_0xd02174){var _0x4c311b=function(_0x509c7b){while(--_0x509c7b){_0x22351d['push'](_0x22351d['shift']());}};_0x4c311b(++_0xd02174);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 048cb58..671b0ba 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 _0x564d=['exports','Intervals'];(function(_0x19b545,_0x1cfb48){var _0x1cfff6=function(_0x53597c){while(--_0x53597c){_0x19b545['push'](_0x19b545['shift']());}};_0x1cfff6(++_0x1cfb48);}(_0x564d,0xeb));var _0xd564=function(_0x13ab80,_0x401573){_0x13ab80=_0x13ab80-0x0;var _0x4df7bb=_0x564d[_0x13ab80];return _0x4df7bb;};'use strict';function Interval(_0x4bef83){this['id']=_0x4bef83['id']||0x0;this['name']=_0x4bef83['name']||'';this[_0xd564('0x0')]=_0x4bef83[_0xd564('0x0')]||{};}module[_0xd564('0x1')]=Interval; \ No newline at end of file +var _0xcb87=['name','Intervals'];(function(_0x52799c,_0x5d6fa4){var _0x1804c2=function(_0x35264e){while(--_0x35264e){_0x52799c['push'](_0x52799c['shift']());}};_0x1804c2(++_0x5d6fa4);}(_0xcb87,0xa6));var _0x7cb8=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xcb87[_0x3f0b30];return _0x2748a5;};'use strict';function Interval(_0x4c2985){this['id']=_0x4c2985['id']||0x0;this['name']=_0x4c2985[_0x7cb8('0x0')]||'';this[_0x7cb8('0x1')]=_0x4c2985[_0x7cb8('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index c4eefa2..cfe1f46 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 _0x3e90=['online','mailPause','available','name','mail:queue:%s','emit','mail_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length'];(function(_0x15a4cb,_0x1ba80d){var _0x25523b=function(_0x1ae06e){while(--_0x1ae06e){_0x15a4cb['push'](_0x15a4cb['shift']());}};_0x25523b(++_0x1ba80d);}(_0x3e90,0xf0));var _0x03e9=function(_0x5307e5,_0x340b0c){_0x5307e5=_0x5307e5-0x0;var _0x563881=_0x3e90[_0x5307e5];return _0x563881;};'use strict';var _=require('lodash');var md5=require(_0x03e9('0x0'));var util=require('util');var Redis=require(_0x03e9('0x1'));var config=require(_0x03e9('0x2'));config[_0x03e9('0x3')]=_[_0x03e9('0x4')](config[_0x03e9('0x3')],{'host':_0x03e9('0x5'),'port':0x18eb});var io=require(_0x03e9('0x6'))(new Redis(config[_0x03e9('0x3')]));function MailQueue(_0x4816db){this['id']=_0x4816db['id']||0x0;this['name']=_0x4816db['name']||'';this[_0x03e9('0x7')]=_0x4816db[_0x03e9('0x7')]||0xa;this['strategy']=_0x4816db[_0x03e9('0x8')]||_0x03e9('0x9');this[_0x03e9('0xa')]=_0x4816db['Agents'];this[_0x03e9('0xb')]={};this[_0x03e9('0xc')]=0x0;this[_0x03e9('0x0')]='';this[_0x03e9('0xd')]();this[_0x03e9('0xe')]();}MailQueue[_0x03e9('0xf')][_0x03e9('0xd')]=function(){var _0x39e61c=this[_0x03e9('0xb')]['_rr'];this[_0x03e9('0xb')]=_[_0x03e9('0x10')](this['Agents'],'id');this[_0x03e9('0xb')][_0x03e9('0x11')]=_0x39e61c;};MailQueue[_0x03e9('0xf')]['updateRealtime']=function(){this[_0x03e9('0x12')]=0x0;this[_0x03e9('0x13')]=0x0;for(var _0x5c6b7b=0x0;_0x5c6b7b=0x0?this[_0x03e9('0x17')]:0x0;var _0x15053a={'id':this['id'],'available':this[_0x03e9('0x17')],'loggedIn':this[_0x03e9('0x12')],'name':this[_0x03e9('0x18')],'paused':this[_0x03e9('0x13')],'waiting':this[_0x03e9('0xc')]};var _0x32f0b0=md5(JSON['stringify'](_0x15053a));if(this[_0x03e9('0x0')]!==_0x32f0b0){this[_0x03e9('0x0')]=_0x32f0b0;io['to'](util['format'](_0x03e9('0x19'),_0x15053a[_0x03e9('0x18')]))[_0x03e9('0x1a')](_0x03e9('0x1b'),_0x15053a);}};module[_0x03e9('0x1c')]=MailQueue; \ No newline at end of file +var _0xd86f=['available','stringify','format','mail:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online'];(function(_0x121957,_0x1b2fd5){var _0x276907=function(_0x2f768a){while(--_0x2f768a){_0x121957['push'](_0x121957['shift']());}};_0x276907(++_0x1b2fd5);}(_0xd86f,0x180));var _0xfd86=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xd86f[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xfd86('0x0'));var md5=require(_0xfd86('0x1'));var util=require(_0xfd86('0x2'));var Redis=require(_0xfd86('0x3'));var config=require(_0xfd86('0x4'));config[_0xfd86('0x5')]=_['defaults'](config[_0xfd86('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x1368f3){this['id']=_0x1368f3['id']||0x0;this[_0xfd86('0x6')]=_0x1368f3[_0xfd86('0x6')]||'';this[_0xfd86('0x7')]=_0x1368f3['timeout']||0xa;this[_0xfd86('0x8')]=_0x1368f3['strategy']||'beepall';this[_0xfd86('0x9')]=_0x1368f3[_0xfd86('0x9')];this[_0xfd86('0xa')]={};this[_0xfd86('0xb')]=0x0;this['md5']='';this[_0xfd86('0xc')]();this[_0xfd86('0xd')]();}MailQueue['prototype'][_0xfd86('0xc')]=function(){var _0x68a2dc=this[_0xfd86('0xa')][_0xfd86('0xe')];this[_0xfd86('0xa')]=_[_0xfd86('0xf')](this[_0xfd86('0x9')],'id');this[_0xfd86('0xa')][_0xfd86('0xe')]=_0x68a2dc;};MailQueue[_0xfd86('0x10')][_0xfd86('0xd')]=function(){this[_0xfd86('0x11')]=0x0;this[_0xfd86('0x12')]=0x0;for(var _0x5a8eec=0x0;_0x5a8eec=0x0?this['available']:0x0;var _0x3cb1c6={'id':this['id'],'available':this[_0xfd86('0x15')],'loggedIn':this[_0xfd86('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xfd86('0xb')]};var _0x39d2eb=md5(JSON[_0xfd86('0x16')](_0x3cb1c6));if(this[_0xfd86('0x1')]!==_0x39d2eb){this[_0xfd86('0x1')]=_0x39d2eb;io['to'](util[_0xfd86('0x17')](_0xfd86('0x18'),_0x3cb1c6[_0xfd86('0x6')]))[_0xfd86('0x19')]('mail_queue:save',_0x3cb1c6);}};module[_0xfd86('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index daf7b31..16f7086 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 _0x85be=['mapAgentsId','_rr','map','loggedIn','paused','length','openchannelPause','available','stringify','emit','openchannel_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype'];(function(_0x267d29,_0x27f1fe){var _0x4cd7c9=function(_0x4526d4){while(--_0x4526d4){_0x267d29['push'](_0x267d29['shift']());}};_0x4cd7c9(++_0x27f1fe);}(_0x85be,0x1cc));var _0xe85b=function(_0x1153fc,_0x358dec){_0x1153fc=_0x1153fc-0x0;var _0x2348b5=_0x85be[_0x1153fc];return _0x2348b5;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xe85b('0x0'));var Redis=require(_0xe85b('0x1'));var config=require(_0xe85b('0x2'));config[_0xe85b('0x3')]=_[_0xe85b('0x4')](config['redis'],{'host':_0xe85b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe85b('0x3')]));function OpenchannelQueue(_0x3c1e22){this['id']=_0x3c1e22['id']||0x0;this[_0xe85b('0x6')]=_0x3c1e22['name']||'';this['timeout']=_0x3c1e22[_0xe85b('0x7')]||0xa;this[_0xe85b('0x8')]=_0x3c1e22['strategy']||_0xe85b('0x9');this[_0xe85b('0xa')]=_0x3c1e22[_0xe85b('0xa')];this['mapAgentsId']={};this[_0xe85b('0xb')]=0x0;this[_0xe85b('0xc')]='';this[_0xe85b('0xd')]();this[_0xe85b('0xe')]();}OpenchannelQueue[_0xe85b('0xf')]['updateRouting']=function(){var _0x5d5827=this[_0xe85b('0x10')][_0xe85b('0x11')];this[_0xe85b('0x10')]=_[_0xe85b('0x12')](this[_0xe85b('0xa')],'id');this[_0xe85b('0x10')][_0xe85b('0x11')]=_0x5d5827;};OpenchannelQueue[_0xe85b('0xf')]['updateRealtime']=function(){this[_0xe85b('0x13')]=0x0;this[_0xe85b('0x14')]=0x0;for(var _0x3a56cb=0x0;_0x3a56cb=0x0?this[_0xe85b('0x17')]:0x0;var _0x1ded1f={'id':this['id'],'available':this[_0xe85b('0x17')],'loggedIn':this[_0xe85b('0x13')],'name':this[_0xe85b('0x6')],'paused':this[_0xe85b('0x14')],'waiting':this[_0xe85b('0xb')]};var _0x560bc3=md5(JSON[_0xe85b('0x18')](_0x1ded1f));if(this[_0xe85b('0xc')]!==_0x560bc3){this['md5']=_0x560bc3;io['to'](util['format']('openchannel:queue:%s',_0x1ded1f[_0xe85b('0x6')]))[_0xe85b('0x19')](_0xe85b('0x1a'),_0x1ded1f);}};module[_0xe85b('0x1b')]=OpenchannelQueue; \ No newline at end of file +var _0xa1d7=['prototype','updateRealtime','loggedIn','length','online','paused','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','map','_rr'];(function(_0x44a406,_0x17c91f){var _0x506c5a=function(_0xdd1d60){while(--_0xdd1d60){_0x44a406['push'](_0x44a406['shift']());}};_0x506c5a(++_0x17c91f);}(_0xa1d7,0xfe));var _0x7a1d=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xa1d7[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0x7a1d('0x0'));var md5=require(_0x7a1d('0x1'));var util=require(_0x7a1d('0x2'));var Redis=require(_0x7a1d('0x3'));var config=require(_0x7a1d('0x4'));config['redis']=_[_0x7a1d('0x5')](config[_0x7a1d('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function OpenchannelQueue(_0xcdfc16){this['id']=_0xcdfc16['id']||0x0;this[_0x7a1d('0x7')]=_0xcdfc16[_0x7a1d('0x7')]||'';this['timeout']=_0xcdfc16[_0x7a1d('0x8')]||0xa;this[_0x7a1d('0x9')]=_0xcdfc16[_0x7a1d('0x9')]||_0x7a1d('0xa');this[_0x7a1d('0xb')]=_0xcdfc16['Agents'];this[_0x7a1d('0xc')]={};this['waiting']=0x0;this[_0x7a1d('0x1')]='';this[_0x7a1d('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x7a1d('0xd')]=function(){var _0x249860=this[_0x7a1d('0xc')]['_rr'];this[_0x7a1d('0xc')]=_[_0x7a1d('0xe')](this[_0x7a1d('0xb')],'id');this[_0x7a1d('0xc')][_0x7a1d('0xf')]=_0x249860;};OpenchannelQueue[_0x7a1d('0x10')][_0x7a1d('0x11')]=function(){this[_0x7a1d('0x12')]=0x0;this['paused']=0x0;for(var _0x4ca029=0x0;_0x4ca029=0x0?this['available']:0x0;var _0x1fe8b1={'id':this['id'],'available':this[_0x7a1d('0x16')],'loggedIn':this[_0x7a1d('0x12')],'name':this[_0x7a1d('0x7')],'paused':this[_0x7a1d('0x15')],'waiting':this[_0x7a1d('0x17')]};var _0x4e4c51=md5(JSON[_0x7a1d('0x18')](_0x1fe8b1));if(this['md5']!==_0x4e4c51){this[_0x7a1d('0x1')]=_0x4e4c51;io['to'](util[_0x7a1d('0x19')](_0x7a1d('0x1a'),_0x1fe8b1[_0x7a1d('0x7')]))[_0x7a1d('0x1b')](_0x7a1d('0x1c'),_0x1fe8b1);}};module[_0x7a1d('0x1d')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ae2f0cc..9bd230b 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 _0x757a=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','length','online','loggedIn','smsPause','paused','available','format','sms:queue:%s','emit','md5','util','defaults'];(function(_0x3d0366,_0x50211a){var _0x5ce75e=function(_0xc70777){while(--_0xc70777){_0x3d0366['push'](_0x3d0366['shift']());}};_0x5ce75e(++_0x50211a);}(_0x757a,0xde));var _0xa757=function(_0x54ca7b,_0x5165df){_0x54ca7b=_0x54ca7b-0x0;var _0x3c27cc=_0x757a[_0x54ca7b];return _0x3c27cc;};'use strict';var _=require('lodash');var md5=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xa757('0x2')](config[_0xa757('0x3')],{'host':_0xa757('0x4'),'port':0x18eb});var io=require(_0xa757('0x5'))(new Redis(config[_0xa757('0x3')]));function SmsQueue(_0x3caeb0){this['id']=_0x3caeb0['id']||0x0;this['name']=_0x3caeb0[_0xa757('0x6')]||'';this[_0xa757('0x7')]=_0x3caeb0['timeout']||0xa;this[_0xa757('0x8')]=_0x3caeb0[_0xa757('0x8')]||_0xa757('0x9');this[_0xa757('0xa')]=_0x3caeb0[_0xa757('0xa')];this['mapAgentsId']={};this[_0xa757('0xb')]=0x0;this[_0xa757('0x0')]='';this[_0xa757('0xc')]();this[_0xa757('0xd')]();}SmsQueue[_0xa757('0xe')][_0xa757('0xc')]=function(){var _0x17408b=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xa757('0xf')]['_rr']=_0x17408b;};SmsQueue['prototype'][_0xa757('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32112b=0x0;_0x32112b=0x0?this['available']:0x0;var _0x54b305={'id':this['id'],'available':this[_0xa757('0x15')],'loggedIn':this[_0xa757('0x12')],'name':this[_0xa757('0x6')],'paused':this[_0xa757('0x14')],'waiting':this[_0xa757('0xb')]};var _0xe2d567=md5(JSON['stringify'](_0x54b305));if(this[_0xa757('0x0')]!==_0xe2d567){this['md5']=_0xe2d567;io['to'](util[_0xa757('0x16')](_0xa757('0x17'),_0x54b305[_0xa757('0x6')]))[_0xa757('0x18')]('sms_queue:save',_0x54b305);}};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(_0x42b658,_0x440700){var _0x10a203=function(_0x5986b9){while(--_0x5986b9){_0x42b658['push'](_0x42b658['shift']());}};_0x10a203(++_0x440700);}(_0xb7e7,0x121));var _0x7b7e=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xb7e7[_0x468b0f];return _0x3e74d9;};'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 c23cad4..d56c1b3 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 _0x8e05=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify','format','exports','md5','util','ioredis','redis','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x38377d,_0x239472){var _0x386ec5=function(_0xaf8a2a){while(--_0xaf8a2a){_0x38377d['push'](_0x38377d['shift']());}};_0x386ec5(++_0x239472);}(_0x8e05,0xa6));var _0x58e0=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0x8e05[_0x4a9beb];return _0x2d4c58;};'use strict';var _=require('lodash');var md5=require(_0x58e0('0x0'));var util=require(_0x58e0('0x1'));var Redis=require(_0x58e0('0x2'));var config=require('../../../config/environment');config[_0x58e0('0x3')]=_['defaults'](config[_0x58e0('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x58e0('0x4'))(new Redis(config[_0x58e0('0x3')]));function WhatsappQueue(_0x5568a5){this['id']=_0x5568a5['id']||0x0;this[_0x58e0('0x5')]=_0x5568a5['name']||'';this[_0x58e0('0x6')]=_0x5568a5[_0x58e0('0x6')]||0xa;this[_0x58e0('0x7')]=_0x5568a5[_0x58e0('0x7')]||'beepall';this[_0x58e0('0x8')]=_0x5568a5[_0x58e0('0x8')];this[_0x58e0('0x9')]={};this[_0x58e0('0xa')]=0x0;this[_0x58e0('0x0')]='';this[_0x58e0('0xb')]();this[_0x58e0('0xc')]();}WhatsappQueue[_0x58e0('0xd')][_0x58e0('0xb')]=function(){var _0x322322=this[_0x58e0('0x9')]['_rr'];this[_0x58e0('0x9')]=_[_0x58e0('0xe')](this[_0x58e0('0x8')],'id');this['mapAgentsId'][_0x58e0('0xf')]=_0x322322;};WhatsappQueue[_0x58e0('0xd')]['updateRealtime']=function(){this[_0x58e0('0x10')]=0x0;this[_0x58e0('0x11')]=0x0;for(var _0x250228=0x0;_0x250228=0x0?this[_0x58e0('0x15')]:0x0;var _0x5d5b3b={'id':this['id'],'available':this[_0x58e0('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x58e0('0xa')]};var _0x13c97e=md5(JSON[_0x58e0('0x16')](_0x5d5b3b));if(this[_0x58e0('0x0')]!==_0x13c97e){this[_0x58e0('0x0')]=_0x13c97e;io['to'](util[_0x58e0('0x17')]('whatsapp:queue:%s',_0x5d5b3b[_0x58e0('0x5')]))['emit']('whatsapp_queue:save',_0x5d5b3b);}};module[_0x58e0('0x18')]=WhatsappQueue; \ No newline at end of file +var _0x732e=['strategy','beepall','mapAgentsId','updateRealtime','prototype','_rr','map','Agents','loggedIn','paused','length','online','available','waiting','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout'];(function(_0x66184b,_0x1987be){var _0xa0b01b=function(_0x2110d5){while(--_0x2110d5){_0x66184b['push'](_0x66184b['shift']());}};_0xa0b01b(++_0x1987be);}(_0x732e,0xa5));var _0xe732=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0x732e[_0x163691];return _0x543ae5;};'use strict';var _=require(_0xe732('0x0'));var md5=require(_0xe732('0x1'));var util=require('util');var Redis=require(_0xe732('0x2'));var config=require(_0xe732('0x3'));config[_0xe732('0x4')]=_[_0xe732('0x5')](config[_0xe732('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe732('0x6'))(new Redis(config[_0xe732('0x4')]));function WhatsappQueue(_0x14c29b){this['id']=_0x14c29b['id']||0x0;this[_0xe732('0x7')]=_0x14c29b[_0xe732('0x7')]||'';this[_0xe732('0x8')]=_0x14c29b['timeout']||0xa;this[_0xe732('0x9')]=_0x14c29b[_0xe732('0x9')]||_0xe732('0xa');this['Agents']=_0x14c29b['Agents'];this[_0xe732('0xb')]={};this['waiting']=0x0;this[_0xe732('0x1')]='';this['updateRouting']();this[_0xe732('0xc')]();}WhatsappQueue[_0xe732('0xd')]['updateRouting']=function(){var _0xf7e4c5=this[_0xe732('0xb')][_0xe732('0xe')];this['mapAgentsId']=_[_0xe732('0xf')](this[_0xe732('0x10')],'id');this['mapAgentsId'][_0xe732('0xe')]=_0xf7e4c5;};WhatsappQueue[_0xe732('0xd')][_0xe732('0xc')]=function(){this[_0xe732('0x11')]=0x0;this[_0xe732('0x12')]=0x0;for(var _0x2e654b=0x0;_0x2e654b=0x0?this['available']:0x0;var _0x339d5f={'id':this['id'],'available':this[_0xe732('0x15')],'loggedIn':this[_0xe732('0x11')],'name':this[_0xe732('0x7')],'paused':this[_0xe732('0x12')],'waiting':this[_0xe732('0x16')]};var _0x4643bb=md5(JSON[_0xe732('0x17')](_0x339d5f));if(this[_0xe732('0x1')]!==_0x4643bb){this[_0xe732('0x1')]=_0x4643bb;io['to'](util[_0xe732('0x18')](_0xe732('0x19'),_0x339d5f[_0xe732('0x7')]))[_0xe732('0x1a')](_0xe732('0x1b'),_0x339d5f);}};module[_0xe732('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 15a2dcf..7223d21 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 _0x7fbe=['../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','lodash','moment'];(function(_0x2bdd67,_0x2ca1a0){var _0x3cd3fe=function(_0x3c5805){while(--_0x3c5805){_0x2bdd67['push'](_0x2bdd67['shift']());}};_0x3cd3fe(++_0x2ca1a0);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x27097a,_0x1b7f8b){_0x27097a=_0x27097a-0x0;var _0x26378b=_0x7fbe[_0x27097a];return _0x26378b;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xe7fb('0x0'));var moment=require(_0xe7fb('0x1'));var Agent=require(_0xe7fb('0x2'));var Interval=require(_0xe7fb('0x3'));var OpenchannelQueue=require(_0xe7fb('0x4'));var ChatQueue=require(_0xe7fb('0x5'));var SmsQueue=require(_0xe7fb('0x6'));var MailQueue=require(_0xe7fb('0x7'));var FaxQueue=require(_0xe7fb('0x8'));var WhatsappQueue=require(_0xe7fb('0x9'));var Realtime=function(){this[_0xe7fb('0xa')]={};this[_0xe7fb('0xb')]={};this[_0xe7fb('0xc')]={};this[_0xe7fb('0xd')]={};this['smsQueues']={};this[_0xe7fb('0xe')]={};this[_0xe7fb('0xf')]={};this[_0xe7fb('0x10')]={};this[_0xe7fb('0x11')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xe7fb('0x12')]={};this[_0xe7fb('0x13')]={};this[_0xe7fb('0x14')]={};};function freeIsNotKey(_0x348a73,_0x2a2223,_0x42435c){var _0x3e934b=_[_0xe7fb('0x15')](_0x348a73,function(_0x325035,_0x2fe8ab){return _0x325035[_0x42435c];});for(var _0x2437d4 in _0x2a2223){if(_0x2a2223[_0xe7fb('0x16')](_0x2437d4)){if(!_0x3e934b[_0x2437d4]){delete _0x2a2223[_0x2437d4];}}}}Realtime[_0xe7fb('0x17')][_0xe7fb('0x18')]=function(_0x7fe4d3,_0x598729){for(var _0x278b75 in _0x598729){if(_0x7fe4d3[_0xe7fb('0x16')](_0x278b75)){_0x7fe4d3[_0x278b75]=_0x598729[_0x278b75];}}};Realtime['prototype'][_0xe7fb('0x19')]=function(){var _0x37eb9f=this;return function(_0x482f7d){if(_0x482f7d){freeIsNotKey(_0x482f7d,_0x37eb9f[_0xe7fb('0xa')],'id');for(var _0x559129=0x0,_0x12fff6={},_0x18d23c={};_0x559129<_0x482f7d[_0xe7fb('0x1a')];_0x559129+=0x1){_0x12fff6=_0x482f7d[_0x559129];if(_[_0xe7fb('0x1b')](_0x37eb9f['agents'][_0x12fff6['id']])){_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']]=new Agent(_0x12fff6);}else{_0x37eb9f['mergeFromDatabase'](_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']],_0x12fff6);}}}return _0x37eb9f['agents'];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1c')]=function(){var _0x3f96a7=this;return function(_0x182269){if(_0x182269){freeIsNotKey(_0x182269,_0x3f96a7['intervals'],'id');for(var _0x44466e=0x0,_0x5d1c87={},_0x11cae0={};_0x44466e<_0x182269['length'];_0x44466e+=0x1){_0x5d1c87=_0x182269[_0x44466e];if(_[_0xe7fb('0x1b')](_0x3f96a7['intervals'][_0x5d1c87['id']])){_0x3f96a7[_0xe7fb('0xb')][_0x5d1c87['id']]=new Interval(_0x5d1c87);}else{_0x3f96a7[_0xe7fb('0x18')](_0x3f96a7['intervals'][_0x5d1c87['id']],_0x5d1c87);}}}return _0x3f96a7[_0xe7fb('0xb')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1d')]=function(){var _0x4dcb4b=this;return function(_0x469d50){if(_0x469d50){freeIsNotKey(_0x469d50,_0x4dcb4b[_0xe7fb('0xc')],'id');for(var _0x5da3d9=0x0,_0x5bea27={},_0x52f08b={};_0x5da3d9<_0x469d50[_0xe7fb('0x1a')];_0x5da3d9+=0x1){_0x5bea27=_0x469d50[_0x5da3d9];if(_['isUndefined'](_0x4dcb4b['openchannelQueues'][_0x5bea27['id']])){_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']]=new OpenchannelQueue(_0x5bea27);}else{_0x4dcb4b[_0xe7fb('0x18')](_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']],_0x5bea27);}_0x4dcb4b['openchannelQueues'][_0x5bea27['id']][_0xe7fb('0x1e')]();_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']][_0xe7fb('0x1f')]();}}return _0x4dcb4b[_0xe7fb('0xc')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x20')]=function(){var _0x380130=this;return function(_0x59e015){if(_0x59e015){freeIsNotKey(_0x59e015,_0x380130['chatQueues'],'id');for(var _0x1086e6=0x0,_0x3bdee9={},_0xead63={};_0x1086e6<_0x59e015['length'];_0x1086e6+=0x1){_0x3bdee9=_0x59e015[_0x1086e6];if(_[_0xe7fb('0x1b')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']])){_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]=new ChatQueue(_0x3bdee9);}else{_0x380130[_0xe7fb('0x18')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']],_0x3bdee9);}_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']][_0xe7fb('0x1e')]();_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]['updateRealtime']();}}return _0x380130[_0xe7fb('0xd')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x21')]=function(){var _0x547a04=this;return function(_0x517d70){if(_0x517d70){freeIsNotKey(_0x517d70,_0x547a04[_0xe7fb('0x22')],'id');for(var _0x4a9fea=0x0,_0xac56b4={},_0x2f8774={};_0x4a9fea<_0x517d70[_0xe7fb('0x1a')];_0x4a9fea+=0x1){_0xac56b4=_0x517d70[_0x4a9fea];if(_[_0xe7fb('0x1b')](_0x547a04['smsQueues'][_0xac56b4['id']])){_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']]=new SmsQueue(_0xac56b4);}else{_0x547a04[_0xe7fb('0x18')](_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']],_0xac56b4);}_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']][_0xe7fb('0x1e')]();_0x547a04['smsQueues'][_0xac56b4['id']][_0xe7fb('0x1f')]();}}return _0x547a04[_0xe7fb('0x22')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x23')]=function(){var _0x46f430=this;return function(_0x25e925){if(_0x25e925){freeIsNotKey(_0x25e925,_0x46f430[_0xe7fb('0xe')],'id');for(var _0x147eb1=0x0,_0x389903={},_0x59f9df={};_0x147eb1<_0x25e925[_0xe7fb('0x1a')];_0x147eb1+=0x1){_0x389903=_0x25e925[_0x147eb1];if(_[_0xe7fb('0x1b')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']])){_0x46f430['mailQueues'][_0x389903['id']]=new MailQueue(_0x389903);}else{_0x46f430[_0xe7fb('0x18')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']],_0x389903);}_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1e')]();_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1f')]();}}return _0x46f430[_0xe7fb('0xe')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x24')]=function(){var _0xebfe1d=this;return function(_0x29c34a){if(_0x29c34a){freeIsNotKey(_0x29c34a,_0xebfe1d[_0xe7fb('0xf')],'id');for(var _0x1544f2=0x0,_0x1c81fe={},_0xeb7c29={};_0x1544f2<_0x29c34a[_0xe7fb('0x1a')];_0x1544f2+=0x1){_0x1c81fe=_0x29c34a[_0x1544f2];if(_[_0xe7fb('0x1b')](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']])){_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]=new FaxQueue(_0x1c81fe);}else{_0xebfe1d['mergeFromDatabase'](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']],_0x1c81fe);}_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']][_0xe7fb('0x1e')]();_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]['updateRealtime']();}}return _0xebfe1d[_0xe7fb('0xf')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x25')]=function(){var _0x413a13=this;return function(_0x49fe9d){if(_0x49fe9d){freeIsNotKey(_0x49fe9d,_0x413a13[_0xe7fb('0x10')],'id');for(var _0x451a6c=0x0,_0x34265f={},_0x62a8a1={};_0x451a6c<_0x49fe9d[_0xe7fb('0x1a')];_0x451a6c+=0x1){_0x34265f=_0x49fe9d[_0x451a6c];if(_[_0xe7fb('0x1b')](_0x413a13['whatsappQueues'][_0x34265f['id']])){_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]=new WhatsappQueue(_0x34265f);}else{_0x413a13[_0xe7fb('0x18')](_0x413a13[_0xe7fb('0x10')][_0x34265f['id']],_0x34265f);}_0x413a13['whatsappQueues'][_0x34265f['id']][_0xe7fb('0x1e')]();_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]['updateRealtime']();}}return _0x413a13['whatsappQueues'];};};module['exports']=Realtime; \ No newline at end of file +var _0x3e74=['initIntervals','mergeFromDatabase','initOpenchannelQueues','openchannelQueues','updateRealtime','updateRouting','initSmsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','bluebird','lodash','moment','../model/agent','../model/chatQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','length','isUndefined'];(function(_0x413b89,_0x4dbd14){var _0x2f80c1=function(_0xb83b2c){while(--_0xb83b2c){_0x413b89['push'](_0x413b89['shift']());}};_0x2f80c1(++_0x4dbd14);}(_0x3e74,0x175));var _0x43e7=function(_0x120c77,_0x13235a){_0x120c77=_0x120c77-0x0;var _0xa15d52=_0x3e74[_0x120c77];return _0xa15d52;};'use strict';var BPromise=require(_0x43e7('0x0'));var util=require('util');var _=require(_0x43e7('0x1'));var moment=require(_0x43e7('0x2'));var Agent=require(_0x43e7('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x43e7('0x4'));var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x43e7('0x5'));var FaxQueue=require(_0x43e7('0x6'));var WhatsappQueue=require(_0x43e7('0x7'));var Realtime=function(){this[_0x43e7('0x8')]={};this[_0x43e7('0x9')]={};this['openchannelQueues']={};this[_0x43e7('0xa')]={};this[_0x43e7('0xb')]={};this[_0x43e7('0xc')]={};this[_0x43e7('0xd')]={};this[_0x43e7('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x43e7('0xf')]={};this['openchannelQueuesWaitingInteractions']={};this['smsQueuesWaitingInteractions']={};this[_0x43e7('0x10')]={};this[_0x43e7('0x11')]={};};function freeIsNotKey(_0x5c34f4,_0x2803d9,_0x513707){var _0xf7c520=_[_0x43e7('0x12')](_0x5c34f4,function(_0x4ebc8e,_0x3eb206){return _0x4ebc8e[_0x513707];});for(var _0xc960ea in _0x2803d9){if(_0x2803d9[_0x43e7('0x13')](_0xc960ea)){if(!_0xf7c520[_0xc960ea]){delete _0x2803d9[_0xc960ea];}}}}Realtime[_0x43e7('0x14')]['mergeFromDatabase']=function(_0x583d85,_0x2fcb36){for(var _0x21fdd3 in _0x2fcb36){if(_0x583d85[_0x43e7('0x13')](_0x21fdd3)){_0x583d85[_0x21fdd3]=_0x2fcb36[_0x21fdd3];}}};Realtime['prototype']['initAgents']=function(){var _0x16849c=this;return function(_0x14c146){if(_0x14c146){freeIsNotKey(_0x14c146,_0x16849c[_0x43e7('0x8')],'id');for(var _0x328445=0x0,_0x4de324={},_0x5c4eaa={};_0x328445<_0x14c146[_0x43e7('0x15')];_0x328445+=0x1){_0x4de324=_0x14c146[_0x328445];if(_[_0x43e7('0x16')](_0x16849c[_0x43e7('0x8')][_0x4de324['id']])){_0x16849c['agents'][_0x4de324['id']]=new Agent(_0x4de324);}else{_0x16849c['mergeFromDatabase'](_0x16849c[_0x43e7('0x8')][_0x4de324['id']],_0x4de324);}}}return _0x16849c[_0x43e7('0x8')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x17')]=function(){var _0x3776f5=this;return function(_0x1f24fb){if(_0x1f24fb){freeIsNotKey(_0x1f24fb,_0x3776f5[_0x43e7('0x9')],'id');for(var _0x1441ef=0x0,_0x2377a3={},_0xab63cf={};_0x1441ef<_0x1f24fb[_0x43e7('0x15')];_0x1441ef+=0x1){_0x2377a3=_0x1f24fb[_0x1441ef];if(_[_0x43e7('0x16')](_0x3776f5['intervals'][_0x2377a3['id']])){_0x3776f5[_0x43e7('0x9')][_0x2377a3['id']]=new Interval(_0x2377a3);}else{_0x3776f5[_0x43e7('0x18')](_0x3776f5['intervals'][_0x2377a3['id']],_0x2377a3);}}}return _0x3776f5[_0x43e7('0x9')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x19')]=function(){var _0x28aacc=this;return function(_0x4077fb){if(_0x4077fb){freeIsNotKey(_0x4077fb,_0x28aacc[_0x43e7('0x1a')],'id');for(var _0x54a9e7=0x0,_0x454359={},_0x4eea52={};_0x54a9e7<_0x4077fb['length'];_0x54a9e7+=0x1){_0x454359=_0x4077fb[_0x54a9e7];if(_[_0x43e7('0x16')](_0x28aacc[_0x43e7('0x1a')][_0x454359['id']])){_0x28aacc['openchannelQueues'][_0x454359['id']]=new OpenchannelQueue(_0x454359);}else{_0x28aacc[_0x43e7('0x18')](_0x28aacc['openchannelQueues'][_0x454359['id']],_0x454359);}_0x28aacc[_0x43e7('0x1a')][_0x454359['id']]['updateRouting']();_0x28aacc[_0x43e7('0x1a')][_0x454359['id']][_0x43e7('0x1b')]();}}return _0x28aacc[_0x43e7('0x1a')];};};Realtime[_0x43e7('0x14')]['initChatQueues']=function(){var _0x52b7b3=this;return function(_0x805b54){if(_0x805b54){freeIsNotKey(_0x805b54,_0x52b7b3['chatQueues'],'id');for(var _0x2dd5f=0x0,_0x40dc8f={},_0x3565cf={};_0x2dd5f<_0x805b54[_0x43e7('0x15')];_0x2dd5f+=0x1){_0x40dc8f=_0x805b54[_0x2dd5f];if(_['isUndefined'](_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']])){_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']]=new ChatQueue(_0x40dc8f);}else{_0x52b7b3[_0x43e7('0x18')](_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']],_0x40dc8f);}_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']][_0x43e7('0x1c')]();_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']][_0x43e7('0x1b')]();}}return _0x52b7b3[_0x43e7('0xa')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1d')]=function(){var _0x19725a=this;return function(_0x2bde44){if(_0x2bde44){freeIsNotKey(_0x2bde44,_0x19725a[_0x43e7('0xb')],'id');for(var _0x4bdb17=0x0,_0x238321={},_0x44f6b0={};_0x4bdb17<_0x2bde44[_0x43e7('0x15')];_0x4bdb17+=0x1){_0x238321=_0x2bde44[_0x4bdb17];if(_[_0x43e7('0x16')](_0x19725a[_0x43e7('0xb')][_0x238321['id']])){_0x19725a['smsQueues'][_0x238321['id']]=new SmsQueue(_0x238321);}else{_0x19725a[_0x43e7('0x18')](_0x19725a[_0x43e7('0xb')][_0x238321['id']],_0x238321);}_0x19725a[_0x43e7('0xb')][_0x238321['id']][_0x43e7('0x1c')]();_0x19725a['smsQueues'][_0x238321['id']]['updateRealtime']();}}return _0x19725a['smsQueues'];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1e')]=function(){var _0x117c07=this;return function(_0x234fe6){if(_0x234fe6){freeIsNotKey(_0x234fe6,_0x117c07[_0x43e7('0xc')],'id');for(var _0xde7ed=0x0,_0x485c6c={},_0x47baee={};_0xde7ed<_0x234fe6['length'];_0xde7ed+=0x1){_0x485c6c=_0x234fe6[_0xde7ed];if(_['isUndefined'](_0x117c07['mailQueues'][_0x485c6c['id']])){_0x117c07['mailQueues'][_0x485c6c['id']]=new MailQueue(_0x485c6c);}else{_0x117c07['mergeFromDatabase'](_0x117c07[_0x43e7('0xc')][_0x485c6c['id']],_0x485c6c);}_0x117c07['mailQueues'][_0x485c6c['id']][_0x43e7('0x1c')]();_0x117c07[_0x43e7('0xc')][_0x485c6c['id']][_0x43e7('0x1b')]();}}return _0x117c07[_0x43e7('0xc')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1f')]=function(){var _0x101d45=this;return function(_0x4f1a5f){if(_0x4f1a5f){freeIsNotKey(_0x4f1a5f,_0x101d45['faxQueues'],'id');for(var _0x5d84f4=0x0,_0xfa0474={},_0xfe70e9={};_0x5d84f4<_0x4f1a5f[_0x43e7('0x15')];_0x5d84f4+=0x1){_0xfa0474=_0x4f1a5f[_0x5d84f4];if(_[_0x43e7('0x16')](_0x101d45[_0x43e7('0xd')][_0xfa0474['id']])){_0x101d45[_0x43e7('0xd')][_0xfa0474['id']]=new FaxQueue(_0xfa0474);}else{_0x101d45[_0x43e7('0x18')](_0x101d45[_0x43e7('0xd')][_0xfa0474['id']],_0xfa0474);}_0x101d45['faxQueues'][_0xfa0474['id']][_0x43e7('0x1c')]();_0x101d45[_0x43e7('0xd')][_0xfa0474['id']]['updateRealtime']();}}return _0x101d45[_0x43e7('0xd')];};};Realtime['prototype'][_0x43e7('0x20')]=function(){var _0x2ad008=this;return function(_0x1c6f45){if(_0x1c6f45){freeIsNotKey(_0x1c6f45,_0x2ad008[_0x43e7('0xe')],'id');for(var _0x35ac85=0x0,_0x234d8f={},_0x5e731b={};_0x35ac85<_0x1c6f45['length'];_0x35ac85+=0x1){_0x234d8f=_0x1c6f45[_0x35ac85];if(_[_0x43e7('0x16')](_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']])){_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']]=new WhatsappQueue(_0x234d8f);}else{_0x2ad008[_0x43e7('0x18')](_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']],_0x234d8f);}_0x2ad008['whatsappQueues'][_0x234d8f['id']][_0x43e7('0x1c')]();_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']]['updateRealtime']();}}return _0x2ad008[_0x43e7('0xe')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 736d2e6..4d9427a 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 _0x71bf=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x2e917a,_0x552ffb){var _0x4b41d5=function(_0x78aa19){while(--_0x78aa19){_0x2e917a['push'](_0x2e917a['shift']());}};_0x4b41d5(++_0x552ffb);}(_0x71bf,0x16d));var _0xf71b=function(_0x26cd05,_0x1f7d74){_0x26cd05=_0x26cd05-0x0;var _0x3e13b9=_0x71bf[_0x26cd05];return _0x3e13b9;};'use strict';var client=require('../client');exports[_0xf71b('0x0')]=function(_0x41bef7,_0x3266d9){return client[_0xf71b('0x1')](_0xf71b('0x2'),{'body':_0x3266d9,'options':{'where':{'id':_0x41bef7}},'log':_0xf71b('0x3')});};exports[_0xf71b('0x4')]=function(_0x29376c,_0x4cd367){return client['Request']('AddTagsToChatInteraction',{'body':_0x4cd367,'options':{'where':{'id':_0x29376c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xd70e=['update','Request','addTags','addTagsToChatInteraction','../client'];(function(_0x1bdb2c,_0x2a139b){var _0x307233=function(_0x15da39){while(--_0x15da39){_0x1bdb2c['push'](_0x1bdb2c['shift']());}};_0x307233(++_0x2a139b);}(_0xd70e,0x15d));var _0xed70=function(_0x3ab5d0,_0x2b71e9){_0x3ab5d0=_0x3ab5d0-0x0;var _0x3a6fd5=_0xd70e[_0x3ab5d0];return _0x3a6fd5;};'use strict';var client=require(_0xed70('0x0'));exports[_0xed70('0x1')]=function(_0x164cd6,_0x1a3a30){return client[_0xed70('0x2')]('UpdateChatInteraction',{'body':_0x1a3a30,'options':{'where':{'id':_0x164cd6}},'log':'updateChatInteraction'});};exports[_0xed70('0x3')]=function(_0xe2f5ee,_0x55803d){return client[_0xed70('0x2')]('AddTagsToChatInteraction',{'body':_0x55803d,'options':{'where':{'id':_0xe2f5ee}},'log':_0xed70('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2121411..c1213f4 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 _0x5f84=['../client','create','createChatMessage'];(function(_0x51d71a,_0x596fda){var _0xff01f1=function(_0x30480f){while(--_0x30480f){_0x51d71a['push'](_0x51d71a['shift']());}};_0xff01f1(++_0x596fda);}(_0x5f84,0xd8));var _0x45f8=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x5f84[_0x46698a];return _0x356db0;};'use strict';var client=require(_0x45f8('0x0'));exports[_0x45f8('0x1')]=function(_0x4404aa){return client['Request']('CreateChatMessage',{'body':_0x4404aa,'log':_0x45f8('0x2')});}; \ No newline at end of file +var _0x82cb=['CreateChatMessage','create','Request'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x82cb,0x100));var _0xb82c=function(_0x1e318d,_0x2ebdc1){_0x1e318d=_0x1e318d-0x0;var _0x310859=_0x82cb[_0x1e318d];return _0x310859;};'use strict';var client=require('../client');exports[_0xb82c('0x0')]=function(_0x2f3db2){return client[_0xb82c('0x1')](_0xb82c('0x2'),{'body':_0x2f3db2,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 7a9e219..d652078 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 _0xd03a=['strategy','User','Agents','name','online','chatPause','../client','getChatQueues','Request','GetChatQueue','timeout'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd03a,0x1ea));var _0xad03=function(_0x5e56b3,_0x3f92f2){_0x5e56b3=_0x5e56b3-0x0;var _0x27d2db=_0xd03a[_0x5e56b3];return _0x27d2db;};'use strict';var client=require(_0xad03('0x0'));exports[_0xad03('0x1')]=function(){return function(){return client[_0xad03('0x2')](_0xad03('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xad03('0x4'),_0xad03('0x5')],'include':[{'model':_0xad03('0x6'),'as':_0xad03('0x7'),'attributes':['id',_0xad03('0x8'),_0xad03('0x9'),_0xad03('0xa')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xbe39=['User','Agents','name','chatPause','getChatQueues','Request','GetChatQueue','timeout','strategy'];(function(_0x2b608e,_0x2b9d76){var _0x2aca67=function(_0x1a6ac5){while(--_0x1a6ac5){_0x2b608e['push'](_0x2b608e['shift']());}};_0x2aca67(++_0x2b9d76);}(_0xbe39,0xaf));var _0x9be3=function(_0x52fd51,_0x2a2e7c){_0x52fd51=_0x52fd51-0x0;var _0x43f99f=_0xbe39[_0x52fd51];return _0x43f99f;};'use strict';var client=require('../client');exports[_0x9be3('0x0')]=function(){return function(){return client[_0x9be3('0x1')](_0x9be3('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9be3('0x3'),_0x9be3('0x4')],'include':[{'model':_0x9be3('0x5'),'as':_0x9be3('0x6'),'attributes':['id',_0x9be3('0x7'),'online',_0x9be3('0x8')]}]},'log':_0x9be3('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index bffa73b..ef9c4d8 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 _0xae53=['UpdateChatQueueReport','../client','Request','CreateChatQueueReport','update'];(function(_0xe22169,_0x53b4a0){var _0x2716a1=function(_0x56c094){while(--_0x56c094){_0xe22169['push'](_0xe22169['shift']());}};_0x2716a1(++_0x53b4a0);}(_0xae53,0x16e));var _0x3ae5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xae53[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x3ae5('0x0'));exports['create']=function(_0x1afe71){return client[_0x3ae5('0x1')](_0x3ae5('0x2'),{'body':_0x1afe71,'log':'CreateChatQueueReport'});};exports[_0x3ae5('0x3')]=function(_0x2d4c0b,_0x293589){return client[_0x3ae5('0x1')](_0x3ae5('0x4'),{'body':_0x293589,'options':{'where':{'uniqueid':_0x2d4c0b},'order':[['id','DESC']],'limit':0x1},'log':_0x3ae5('0x4')});}; \ No newline at end of file +var _0x167e=['DESC','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x49693f,_0x4d994f){var _0x1b0f6e=function(_0x4b2c16){while(--_0x4b2c16){_0x49693f['push'](_0x49693f['shift']());}};_0x1b0f6e(++_0x4d994f);}(_0x167e,0xa3));var _0xe167=function(_0x5d1fbe,_0x491dd1){_0x5d1fbe=_0x5d1fbe-0x0;var _0x4a26a9=_0x167e[_0x5d1fbe];return _0x4a26a9;};'use strict';var client=require(_0xe167('0x0'));exports[_0xe167('0x1')]=function(_0x2a44c5){return client[_0xe167('0x2')](_0xe167('0x3'),{'body':_0x2a44c5,'log':_0xe167('0x3')});};exports[_0xe167('0x4')]=function(_0x62d76c,_0x5e4863){return client[_0xe167('0x2')]('UpdateChatQueueReport',{'body':_0x5e4863,'options':{'where':{'uniqueid':_0x62d76c},'order':[['id',_0xe167('0x5')]],'limit':0x1},'log':_0xe167('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ce43f9d..2860b2d 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 _0xc3ea=['updateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update','Request','UpdateFaxInteraction'];(function(_0x33e55a,_0x3d5690){var _0x542283=function(_0x4eba1d){while(--_0x4eba1d){_0x33e55a['push'](_0x33e55a['shift']());}};_0x542283(++_0x3d5690);}(_0xc3ea,0x8f));var _0xac3e=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0xc3ea[_0x204eb7];return _0x37e444;};'use strict';var client=require(_0xac3e('0x0'));exports[_0xac3e('0x1')]=function(_0x16ac4d,_0x5903d2){return client[_0xac3e('0x2')](_0xac3e('0x3'),{'body':_0x5903d2,'options':{'where':{'id':_0x16ac4d}},'log':_0xac3e('0x4')});};exports[_0xac3e('0x5')]=function(_0x50eadb,_0x37567d){return client[_0xac3e('0x2')](_0xac3e('0x6'),{'body':_0x37567d,'options':{'where':{'id':_0x50eadb}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0xe751=['addTags','Request','AddTagsToFaxInteraction','../client','update','UpdateFaxInteraction'];(function(_0x19148b,_0x3ab03c){var _0x51fbad=function(_0x3334ce){while(--_0x3334ce){_0x19148b['push'](_0x19148b['shift']());}};_0x51fbad(++_0x3ab03c);}(_0xe751,0xed));var _0x1e75=function(_0x3c3a6a,_0x53569a){_0x3c3a6a=_0x3c3a6a-0x0;var _0x2f7b5c=_0xe751[_0x3c3a6a];return _0x2f7b5c;};'use strict';var client=require(_0x1e75('0x0'));exports[_0x1e75('0x1')]=function(_0x3f68e3,_0x4c17a9){return client['Request'](_0x1e75('0x2'),{'body':_0x4c17a9,'options':{'where':{'id':_0x3f68e3}},'log':'updateFaxInteraction'});};exports[_0x1e75('0x3')]=function(_0xb4388d,_0x17ac90){return client[_0x1e75('0x4')](_0x1e75('0x5'),{'body':_0x17ac90,'options':{'where':{'id':_0xb4388d}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 09c3ad8..03e86cb 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 _0xdb3f=['createFaxMessage','../client','create','CreateFaxMessage'];(function(_0x24dac7,_0x2ffbaa){var _0x32c81f=function(_0x5e6475){while(--_0x5e6475){_0x24dac7['push'](_0x24dac7['shift']());}};_0x32c81f(++_0x2ffbaa);}(_0xdb3f,0xcd));var _0xfdb3=function(_0x2e6252,_0x418a7d){_0x2e6252=_0x2e6252-0x0;var _0x100e3e=_0xdb3f[_0x2e6252];return _0x100e3e;};'use strict';var client=require(_0xfdb3('0x0'));exports[_0xfdb3('0x1')]=function(_0xf4f3f0){return client['Request'](_0xfdb3('0x2'),{'body':_0xf4f3f0,'log':_0xfdb3('0x3')});}; \ No newline at end of file +var _0xf5c6=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x498af6,_0x3e0604){var _0x24a2b0=function(_0x5051ce){while(--_0x5051ce){_0x498af6['push'](_0x498af6['shift']());}};_0x24a2b0(++_0x3e0604);}(_0xf5c6,0x1ed));var _0x6f5c=function(_0x5e4bfd,_0x42e1dd){_0x5e4bfd=_0x5e4bfd-0x0;var _0x2386e2=_0xf5c6[_0x5e4bfd];return _0x2386e2;};'use strict';var client=require(_0x6f5c('0x0'));exports[_0x6f5c('0x1')]=function(_0x45390a){return client[_0x6f5c('0x2')](_0x6f5c('0x3'),{'body':_0x45390a,'log':_0x6f5c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 8edc384..2b5c7c3 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 _0xc92f=['strategy','name','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout'];(function(_0x3e7254,_0x180fc6){var _0x4afe4b=function(_0x7412a4){while(--_0x7412a4){_0x3e7254['push'](_0x3e7254['shift']());}};_0x4afe4b(++_0x180fc6);}(_0xc92f,0x1e3));var _0xfc92=function(_0x1a9d9f,_0x164b01){_0x1a9d9f=_0x1a9d9f-0x0;var _0x43eb59=_0xc92f[_0x1a9d9f];return _0x43eb59;};'use strict';var client=require(_0xfc92('0x0'));exports[_0xfc92('0x1')]=function(){return function(){return client[_0xfc92('0x2')](_0xfc92('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xfc92('0x4'),_0xfc92('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xfc92('0x6'),'online',_0xfc92('0x7')]}]},'log':_0xfc92('0x1')});};}; \ No newline at end of file +var _0x84e5=['getFaxQueues','Request','GetFaxQueue','name','timeout','online','faxPause','../client'];(function(_0x4c08bb,_0x456c0a){var _0x29e288=function(_0x9d91f5){while(--_0x9d91f5){_0x4c08bb['push'](_0x4c08bb['shift']());}};_0x29e288(++_0x456c0a);}(_0x84e5,0xe7));var _0x584e=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x84e5[_0x19b3f9];return _0x18c3f6;};'use strict';var client=require(_0x584e('0x0'));exports[_0x584e('0x1')]=function(){return function(){return client[_0x584e('0x2')](_0x584e('0x3'),{'options':{'raw':![],'attributes':['id',_0x584e('0x4'),_0x584e('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x584e('0x6'),_0x584e('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index c582e1c..51b4c2f 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 _0x9f14=['Request','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x1faf7a,_0x3bc094){var _0x409677=function(_0x30652d){while(--_0x30652d){_0x1faf7a['push'](_0x1faf7a['shift']());}};_0x409677(++_0x3bc094);}(_0x9f14,0x185));var _0x49f1=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9f14[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0x49f1('0x0'));exports['create']=function(_0x29b516){return client[_0x49f1('0x1')]('CreateFaxQueueReport',{'body':_0x29b516,'log':'CreateFaxQueueReport'});};exports[_0x49f1('0x2')]=function(_0xc78c47,_0x2486d2){return client[_0x49f1('0x1')](_0x49f1('0x3'),{'body':_0x2486d2,'options':{'where':{'uniqueid':_0xc78c47},'order':[['id',_0x49f1('0x4')]],'limit':0x1},'log':_0x49f1('0x3')});}; \ No newline at end of file +var _0x0488=['CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create','Request'];(function(_0x4146bf,_0x25c865){var _0x5d189a=function(_0x179884){while(--_0x179884){_0x4146bf['push'](_0x4146bf['shift']());}};_0x5d189a(++_0x25c865);}(_0x0488,0x17d));var _0x8048=function(_0x38b27f,_0x4b9a43){_0x38b27f=_0x38b27f-0x0;var _0x5b9c4d=_0x0488[_0x38b27f];return _0x5b9c4d;};'use strict';var client=require(_0x8048('0x0'));exports[_0x8048('0x1')]=function(_0x276a5a){return client[_0x8048('0x2')](_0x8048('0x3'),{'body':_0x276a5a,'log':_0x8048('0x3')});};exports[_0x8048('0x4')]=function(_0x2edbd2,_0xe1c552){return client[_0x8048('0x2')](_0x8048('0x5'),{'body':_0xe1c552,'options':{'where':{'uniqueid':_0x2edbd2},'order':[['id','DESC']],'limit':0x1},'log':_0x8048('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 48ee530..3ca66ab 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 _0xd824=['Intervals','interval','../client','getIntervals','name','Interval'];(function(_0x1c4baa,_0x322e0e){var _0x37ba01=function(_0x557aa2){while(--_0x557aa2){_0x1c4baa['push'](_0x1c4baa['shift']());}};_0x37ba01(++_0x322e0e);}(_0xd824,0xc2));var _0x4d82=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd824[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x4d82('0x0'));exports[_0x4d82('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4d82('0x2')],'include':[{'model':_0x4d82('0x3'),'as':_0x4d82('0x4'),'attributes':['id',_0x4d82('0x2'),_0x4d82('0x5')]}]},'log':_0x4d82('0x1')});};}; \ No newline at end of file +var _0xa571=['getIntervals','Request','GetInterval','Interval','Intervals','../client'];(function(_0x4b0eab,_0x4862cb){var _0x373dd3=function(_0x4a81ed){while(--_0x4a81ed){_0x4b0eab['push'](_0x4b0eab['shift']());}};_0x373dd3(++_0x4862cb);}(_0xa571,0x107));var _0x1a57=function(_0x276a08,_0xf0f5a1){_0x276a08=_0x276a08-0x0;var _0x1941c2=_0xa571[_0x276a08];return _0x1941c2;};'use strict';var client=require(_0x1a57('0x0'));exports[_0x1a57('0x1')]=function(){return function(){return client[_0x1a57('0x2')](_0x1a57('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x1a57('0x4'),'as':_0x1a57('0x5'),'attributes':['id','name','interval']}]},'log':_0x1a57('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index bc6fcb2..8c4dec0 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 _0x2d84=['update','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction'];(function(_0x12afd8,_0x5355c2){var _0xa255c8=function(_0x1d707d){while(--_0x1d707d){_0x12afd8['push'](_0x12afd8['shift']());}};_0xa255c8(++_0x5355c2);}(_0x2d84,0xa0));var _0x42d8=function(_0x188a96,_0x5b1bf2){_0x188a96=_0x188a96-0x0;var _0x4efbfc=_0x2d84[_0x188a96];return _0x4efbfc;};'use strict';var client=require('../client');exports[_0x42d8('0x0')]=function(_0x5e07a6,_0x4061b1){return client['Request'](_0x42d8('0x1'),{'body':_0x4061b1,'options':{'where':{'id':_0x5e07a6}},'log':_0x42d8('0x2')});};exports[_0x42d8('0x3')]=function(_0x47f968,_0x495cd9){return client['Request']('AddTagsToMailInteraction',{'body':_0x495cd9,'options':{'where':{'id':_0x47f968}},'log':_0x42d8('0x4')});}; \ No newline at end of file +var _0xbda2=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xbda2,0x111));var _0x2bda=function(_0x5b9a39,_0x3c501c){_0x5b9a39=_0x5b9a39-0x0;var _0x5b05ea=_0xbda2[_0x5b9a39];return _0x5b05ea;};'use strict';var client=require(_0x2bda('0x0'));exports[_0x2bda('0x1')]=function(_0x19785a,_0x3a4628){return client[_0x2bda('0x2')](_0x2bda('0x3'),{'body':_0x3a4628,'options':{'where':{'id':_0x19785a}},'log':_0x2bda('0x4')});};exports[_0x2bda('0x5')]=function(_0x73cf2b,_0xfdc31a){return client[_0x2bda('0x2')](_0x2bda('0x6'),{'body':_0xfdc31a,'options':{'where':{'id':_0x73cf2b}},'log':_0x2bda('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2c6aa2a..6ed7f70 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 _0xec42=['CreateMailMessage','../client','Request'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0xec42,0x1c0));var _0x2ec4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec42[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x2ec4('0x0'));exports['create']=function(_0x2717ed){return client[_0x2ec4('0x1')](_0x2ec4('0x2'),{'body':_0x2717ed,'log':'createMailMessage'});}; \ No newline at end of file +var _0x6bc9=['createMailMessage','create','Request'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0x6bc9,0x136));var _0x96bc=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0x6bc9[_0x5cc3d4];return _0x17ca31;};'use strict';var client=require('../client');exports[_0x96bc('0x0')]=function(_0x3765d2){return client[_0x96bc('0x1')]('CreateMailMessage',{'body':_0x3765d2,'log':_0x96bc('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e62c036..37242ef 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 _0x2adf=['strategy','User','Agents','mailPause','../client','getMailQueues','GetMailQueue','name','timeout'];(function(_0x1e16b1,_0x957ca1){var _0x565bbc=function(_0x1c9485){while(--_0x1c9485){_0x1e16b1['push'](_0x1e16b1['shift']());}};_0x565bbc(++_0x957ca1);}(_0x2adf,0x1e1));var _0xf2ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2adf[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf2ad('0x0'));exports[_0xf2ad('0x1')]=function(){return function(){return client['Request'](_0xf2ad('0x2'),{'options':{'raw':![],'attributes':['id',_0xf2ad('0x3'),_0xf2ad('0x4'),_0xf2ad('0x5')],'include':[{'model':_0xf2ad('0x6'),'as':_0xf2ad('0x7'),'attributes':['id','name','online',_0xf2ad('0x8')]}]},'log':_0xf2ad('0x1')});};}; \ No newline at end of file +var _0xa81c=['../client','getMailQueues','GetMailQueue','strategy','Agents','name','mailPause'];(function(_0x404e15,_0x4ee833){var _0x199c97=function(_0x18a6ab){while(--_0x18a6ab){_0x404e15['push'](_0x404e15['shift']());}};_0x199c97(++_0x4ee833);}(_0xa81c,0x19d));var _0xca81=function(_0x5a79a5,_0x344a86){_0x5a79a5=_0x5a79a5-0x0;var _0x1e66d3=_0xa81c[_0x5a79a5];return _0x1e66d3;};'use strict';var client=require(_0xca81('0x0'));exports[_0xca81('0x1')]=function(){return function(){return client['Request'](_0xca81('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xca81('0x3')],'include':[{'model':'User','as':_0xca81('0x4'),'attributes':['id',_0xca81('0x5'),'online',_0xca81('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b517859..0c4016a 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 _0x14fa=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x14fa,0xb4));var _0xa14f=function(_0x1e02a7,_0x4d8558){_0x1e02a7=_0x1e02a7-0x0;var _0x5db9f6=_0x14fa[_0x1e02a7];return _0x5db9f6;};'use strict';var client=require(_0xa14f('0x0'));exports[_0xa14f('0x1')]=function(_0x7c5234){return client[_0xa14f('0x2')](_0xa14f('0x3'),{'body':_0x7c5234,'log':_0xa14f('0x3')});};exports[_0xa14f('0x4')]=function(_0x538ffd,_0x1e11aa){return client[_0xa14f('0x2')](_0xa14f('0x5'),{'body':_0x1e11aa,'options':{'where':{'uniqueid':_0x538ffd},'order':[['id',_0xa14f('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x951e=['DESC','../client','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x4cf77b,_0x2b7491){var _0x1d1bee=function(_0x29779a){while(--_0x29779a){_0x4cf77b['push'](_0x4cf77b['shift']());}};_0x1d1bee(++_0x2b7491);}(_0x951e,0xa9));var _0xe951=function(_0x7f66,_0x16f2ae){_0x7f66=_0x7f66-0x0;var _0x478705=_0x951e[_0x7f66];return _0x478705;};'use strict';var client=require(_0xe951('0x0'));exports['create']=function(_0x5a634e){return client[_0xe951('0x1')](_0xe951('0x2'),{'body':_0x5a634e,'log':_0xe951('0x2')});};exports[_0xe951('0x3')]=function(_0x58ec22,_0x1c3831){return client[_0xe951('0x1')](_0xe951('0x4'),{'body':_0x1c3831,'options':{'where':{'uniqueid':_0x58ec22},'order':[['id',_0xe951('0x5')]],'limit':0x1},'log':_0xe951('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 61ad72c..0f7ab8c 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 _0x2084=['addTagsToChatInteraction','../client','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x2084,0xd3));var _0x4208=function(_0x1f0fca,_0x34fafd){_0x1f0fca=_0x1f0fca-0x0;var _0x1d315b=_0x2084[_0x1f0fca];return _0x1d315b;};'use strict';var client=require(_0x4208('0x0'));exports['update']=function(_0x3303a5,_0x48e6c6){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x48e6c6,'options':{'where':{'id':_0x3303a5}},'log':'updateOpenchannelInteraction'});};exports[_0x4208('0x1')]=function(_0x2650f0,_0x4afce9){return client[_0x4208('0x2')](_0x4208('0x3'),{'body':_0x4afce9,'options':{'where':{'id':_0x2650f0}},'log':_0x4208('0x4')});}; \ No newline at end of file +var _0xee6d=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xee6d,0x186));var _0xdee6=function(_0x5474b4,_0x5027aa){_0x5474b4=_0x5474b4-0x0;var _0x33a0b5=_0xee6d[_0x5474b4];return _0x33a0b5;};'use strict';var client=require(_0xdee6('0x0'));exports[_0xdee6('0x1')]=function(_0x27a791,_0x344c75){return client[_0xdee6('0x2')](_0xdee6('0x3'),{'body':_0x344c75,'options':{'where':{'id':_0x27a791}},'log':_0xdee6('0x4')});};exports['addTags']=function(_0x2efbb7,_0x4b42f4){return client[_0xdee6('0x2')](_0xdee6('0x5'),{'body':_0x4b42f4,'options':{'where':{'id':_0x2efbb7}},'log':_0xdee6('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e0d185d..2c0495d 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['create','Request','createOpenchannelMessage','../client'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xaa88,0x137));var _0x8aa8=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xaa88[_0x3207aa];return _0x51758f;};'use strict';var client=require(_0x8aa8('0x0'));exports[_0x8aa8('0x1')]=function(_0x1643a6){return client[_0x8aa8('0x2')]('CreateOpenchannelMessage',{'body':_0x1643a6,'log':_0x8aa8('0x3')});}; \ No newline at end of file +var _0xbdb7=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x3f2cc8,_0x1db3a4){var _0x4a16bb=function(_0x366d5a){while(--_0x366d5a){_0x3f2cc8['push'](_0x3f2cc8['shift']());}};_0x4a16bb(++_0x1db3a4);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xbdb7[_0x2601b4];return _0x3e3661;};'use strict';var client=require(_0x7bdb('0x0'));exports[_0x7bdb('0x1')]=function(_0x44467d){return client[_0x7bdb('0x2')](_0x7bdb('0x3'),{'body':_0x44467d,'log':_0x7bdb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index de19537..38cae51 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 _0x8162=['name','online','openchannelPause','../client','getOpenchannelQueues','Request','timeout','strategy','User','Agents'];(function(_0x12ff37,_0x17c717){var _0x10b851=function(_0x2d3243){while(--_0x2d3243){_0x12ff37['push'](_0x12ff37['shift']());}};_0x10b851(++_0x17c717);}(_0x8162,0x193));var _0x2816=function(_0x2c99c6,_0x383aa1){_0x2c99c6=_0x2c99c6-0x0;var _0x132b5e=_0x8162[_0x2c99c6];return _0x132b5e;};'use strict';var client=require(_0x2816('0x0'));exports[_0x2816('0x1')]=function(){return function(){return client[_0x2816('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x2816('0x3'),_0x2816('0x4')],'include':[{'model':_0x2816('0x5'),'as':_0x2816('0x6'),'attributes':['id',_0x2816('0x7'),_0x2816('0x8'),_0x2816('0x9')]}]},'log':_0x2816('0x1')});};}; \ No newline at end of file +var _0x960d=['Agents','online','openchannelPause','../client','getOpenchannelQueues','name','strategy','User'];(function(_0x30b6cb,_0x832e62){var _0x4455a1=function(_0xd3aaab){while(--_0xd3aaab){_0x30b6cb['push'](_0x30b6cb['shift']());}};_0x4455a1(++_0x832e62);}(_0x960d,0xfb));var _0xd960=function(_0x449623,_0x3dd8a7){_0x449623=_0x449623-0x0;var _0x1ee95f=_0x960d[_0x449623];return _0x1ee95f;};'use strict';var client=require(_0xd960('0x0'));exports[_0xd960('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xd960('0x2'),'timeout',_0xd960('0x3')],'include':[{'model':_0xd960('0x4'),'as':_0xd960('0x5'),'attributes':['id',_0xd960('0x2'),_0xd960('0x6'),_0xd960('0x7')]}]},'log':_0xd960('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 93853c0..a732d74 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 _0x33a3=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x33a3,0xa6));var _0x333a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x33a3[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x333a('0x0'));exports[_0x333a('0x1')]=function(_0x48559d){return client[_0x333a('0x2')](_0x333a('0x3'),{'body':_0x48559d,'log':_0x333a('0x3')});};exports[_0x333a('0x4')]=function(_0x488dda,_0x54b407){return client['Request'](_0x333a('0x5'),{'body':_0x54b407,'options':{'where':{'uniqueid':_0x488dda},'order':[['id',_0x333a('0x6')]],'limit':0x1},'log':_0x333a('0x5')});}; \ No newline at end of file +var _0x3ee8=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','../client','create'];(function(_0x3e837c,_0x5f4036){var _0x5b406f=function(_0xd76956){while(--_0xd76956){_0x3e837c['push'](_0x3e837c['shift']());}};_0x5b406f(++_0x5f4036);}(_0x3ee8,0x178));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x83ee('0x0'));exports[_0x83ee('0x1')]=function(_0x4ac038){return client['Request'](_0x83ee('0x2'),{'body':_0x4ac038,'log':_0x83ee('0x2')});};exports[_0x83ee('0x3')]=function(_0x5cd61f,_0x43ecc5){return client[_0x83ee('0x4')]('UpdateOpenchannelQueueReport',{'body':_0x43ecc5,'options':{'where':{'uniqueid':_0x5cd61f},'order':[['id','DESC']],'limit':0x1},'log':_0x83ee('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1602cb4..bf6fb9c 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 _0xacea=['UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x4b6c5d,_0x3cbbdf){var _0x4e4d47=function(_0x311028){while(--_0x311028){_0x4b6c5d['push'](_0x4b6c5d['shift']());}};_0x4e4d47(++_0x3cbbdf);}(_0xacea,0x1d2));var _0xaace=function(_0x555564,_0x2f2ed2){_0x555564=_0x555564-0x0;var _0x438e7d=_0xacea[_0x555564];return _0x438e7d;};'use strict';var client=require(_0xaace('0x0'));exports[_0xaace('0x1')]=function(_0x192719,_0x53318b){return client[_0xaace('0x2')](_0xaace('0x3'),{'body':_0x53318b,'options':{'where':{'id':_0x192719}},'log':'updateSmsInteraction'});};exports[_0xaace('0x4')]=function(_0x5bbad5,_0x3917a6){return client[_0xaace('0x2')](_0xaace('0x5'),{'body':_0x3917a6,'options':{'where':{'id':_0x5bbad5}},'log':_0xaace('0x6')});}; \ No newline at end of file +var _0x9ad7=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client'];(function(_0x233c64,_0x2da2c1){var _0x331f8d=function(_0x445ec1){while(--_0x445ec1){_0x233c64['push'](_0x233c64['shift']());}};_0x331f8d(++_0x2da2c1);}(_0x9ad7,0x84));var _0x79ad=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x9ad7[_0x21a9d9];return _0x46adce;};'use strict';var client=require(_0x79ad('0x0'));exports[_0x79ad('0x1')]=function(_0x2cf92d,_0x55cbbc){return client[_0x79ad('0x2')](_0x79ad('0x3'),{'body':_0x55cbbc,'options':{'where':{'id':_0x2cf92d}},'log':_0x79ad('0x4')});};exports[_0x79ad('0x5')]=function(_0x427730,_0x3b2692){return client[_0x79ad('0x2')](_0x79ad('0x6'),{'body':_0x3b2692,'options':{'where':{'id':_0x427730}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index a10c67e..daab829 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 _0x2bdb=['../client','CreateSmsMessage','createSmsMessage'];(function(_0x3c30c7,_0x3b3991){var _0x37beff=function(_0xae977c){while(--_0xae977c){_0x3c30c7['push'](_0x3c30c7['shift']());}};_0x37beff(++_0x3b3991);}(_0x2bdb,0x105));var _0xb2bd=function(_0x925aa5,_0x56c95b){_0x925aa5=_0x925aa5-0x0;var _0x2ac879=_0x2bdb[_0x925aa5];return _0x2ac879;};'use strict';var client=require(_0xb2bd('0x0'));exports['create']=function(_0x156a93){return client['Request'](_0xb2bd('0x1'),{'body':_0x156a93,'log':_0xb2bd('0x2')});}; \ No newline at end of file +var _0xc992=['createSmsMessage','../client','Request'];(function(_0x5cd1a4,_0xfc6df){var _0x8eba7f=function(_0x2e4061){while(--_0x2e4061){_0x5cd1a4['push'](_0x5cd1a4['shift']());}};_0x8eba7f(++_0xfc6df);}(_0xc992,0xbb));var _0x2c99=function(_0x576ebb,_0x142be8){_0x576ebb=_0x576ebb-0x0;var _0x87048=_0xc992[_0x576ebb];return _0x87048;};'use strict';var client=require(_0x2c99('0x0'));exports['create']=function(_0x37d606){return client[_0x2c99('0x1')]('CreateSmsMessage',{'body':_0x37d606,'log':_0x2c99('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 38dc15f..29d0cf9 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 _0x9a05=['online','../client','getSmsQueues','GetSmsQueue','name','timeout','strategy','User','Agents'];(function(_0xb7d6f1,_0x48c8a4){var _0x183dfd=function(_0x4206a3){while(--_0x4206a3){_0xb7d6f1['push'](_0xb7d6f1['shift']());}};_0x183dfd(++_0x48c8a4);}(_0x9a05,0x14e));var _0x59a0=function(_0x35747b,_0x3459c8){_0x35747b=_0x35747b-0x0;var _0x23fc88=_0x9a05[_0x35747b];return _0x23fc88;};'use strict';var client=require(_0x59a0('0x0'));exports[_0x59a0('0x1')]=function(){return function(){return client['Request'](_0x59a0('0x2'),{'options':{'raw':![],'attributes':['id',_0x59a0('0x3'),_0x59a0('0x4'),_0x59a0('0x5')],'include':[{'model':_0x59a0('0x6'),'as':_0x59a0('0x7'),'attributes':['id','name',_0x59a0('0x8'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x86c4=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','User','Agents','online','../client'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x86c4,0x17b));var _0x486c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86c4[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x486c('0x0'));exports[_0x486c('0x1')]=function(){return function(){return client[_0x486c('0x2')](_0x486c('0x3'),{'options':{'raw':![],'attributes':['id',_0x486c('0x4'),_0x486c('0x5'),_0x486c('0x6')],'include':[{'model':_0x486c('0x7'),'as':_0x486c('0x8'),'attributes':['id',_0x486c('0x4'),_0x486c('0x9'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index e0dea6a..febb9cd 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 _0x3c1a=['DESC','../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x4903de,_0x2623b8){var _0x439a9c=function(_0x2debd8){while(--_0x2debd8){_0x4903de['push'](_0x4903de['shift']());}};_0x439a9c(++_0x2623b8);}(_0x3c1a,0xda));var _0xa3c1=function(_0x45ee03,_0x2f5319){_0x45ee03=_0x45ee03-0x0;var _0x13d535=_0x3c1a[_0x45ee03];return _0x13d535;};'use strict';var client=require(_0xa3c1('0x0'));exports[_0xa3c1('0x1')]=function(_0x238f91){return client[_0xa3c1('0x2')](_0xa3c1('0x3'),{'body':_0x238f91,'log':_0xa3c1('0x3')});};exports[_0xa3c1('0x4')]=function(_0x53a47c,_0x3db9f5){return client['Request'](_0xa3c1('0x5'),{'body':_0x3db9f5,'options':{'where':{'uniqueid':_0x53a47c},'order':[['id',_0xa3c1('0x6')]],'limit':0x1},'log':_0xa3c1('0x5')});}; \ No newline at end of file +var _0x779d=['../client','Request','CreateSmsQueueReport','update','DESC','UpdateSmsQueueReport'];(function(_0x52a250,_0x219324){var _0x32290e=function(_0x42db4b){while(--_0x42db4b){_0x52a250['push'](_0x52a250['shift']());}};_0x32290e(++_0x219324);}(_0x779d,0x1c2));var _0xd779=function(_0x21c65e,_0xa19a77){_0x21c65e=_0x21c65e-0x0;var _0x5c4599=_0x779d[_0x21c65e];return _0x5c4599;};'use strict';var client=require(_0xd779('0x0'));exports['create']=function(_0x380dec){return client[_0xd779('0x1')](_0xd779('0x2'),{'body':_0x380dec,'log':_0xd779('0x2')});};exports[_0xd779('0x3')]=function(_0x32bec9,_0x318f81){return client['Request']('UpdateSmsQueueReport',{'body':_0x318f81,'options':{'where':{'uniqueid':_0x32bec9},'order':[['id',_0xd779('0x4')]],'limit':0x1},'log':_0xd779('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6b65b0b..037703b 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 _0x2449=['mailPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','openchannelCapacity','../client','getAgents','Request','agent','name','online','pauseType','voicePause','chatPause'];(function(_0x58d716,_0x2834e2){var _0x2fd85f=function(_0x1c1468){while(--_0x1c1468){_0x58d716['push'](_0x58d716['shift']());}};_0x2fd85f(++_0x2834e2);}(_0x2449,0x16d));var _0x9244=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2449[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x9244('0x0'));exports[_0x9244('0x1')]=function(){return function(){return client[_0x9244('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x9244('0x3')},'attributes':['id',_0x9244('0x4'),_0x9244('0x5'),_0x9244('0x6'),'lastPauseAt',_0x9244('0x7'),_0x9244('0x8'),_0x9244('0x9'),'faxPause',_0x9244('0xa'),_0x9244('0xb'),_0x9244('0xc'),_0x9244('0xd'),_0x9244('0xe'),_0x9244('0xf'),'smsCapacity','whatsappCapacity',_0x9244('0x10')]},'log':_0x9244('0x1')});};}; \ No newline at end of file +var _0x75bf=['name','online','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','GetUser'];(function(_0x332012,_0x16cfa1){var _0x169a9c=function(_0x840696){while(--_0x840696){_0x332012['push'](_0x332012['shift']());}};_0x169a9c(++_0x16cfa1);}(_0x75bf,0x119));var _0xf75b=function(_0xabae44,_0x3105e0){_0xabae44=_0xabae44-0x0;var _0x24cea2=_0x75bf[_0xabae44];return _0x24cea2;};'use strict';var client=require(_0xf75b('0x0'));exports[_0xf75b('0x1')]=function(){return function(){return client[_0xf75b('0x2')](_0xf75b('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xf75b('0x4'),_0xf75b('0x5'),_0xf75b('0x6'),_0xf75b('0x7'),_0xf75b('0x8'),_0xf75b('0x9'),_0xf75b('0xa'),'faxPause',_0xf75b('0xb'),_0xf75b('0xc'),_0xf75b('0xd'),'chatCapacity',_0xf75b('0xe'),_0xf75b('0xf'),_0xf75b('0x10'),_0xf75b('0x11'),_0xf75b('0x12')]},'log':_0xf75b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index e72f98f..07fb06d 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 _0xa0bc=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0xe4fe17,_0x12ad94){var _0x52ffe1=function(_0x2faba4){while(--_0x2faba4){_0xe4fe17['push'](_0xe4fe17['shift']());}};_0x52ffe1(++_0x12ad94);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xca0b('0x0')]=function(_0x19838b,_0x544ad3){return client[_0xca0b('0x1')](_0xca0b('0x2'),{'body':_0x544ad3,'options':{'where':{'id':_0x19838b}},'log':_0xca0b('0x3')});};exports[_0xca0b('0x4')]=function(_0x2f7b56,_0x3a53b4){return client[_0xca0b('0x1')](_0xca0b('0x5'),{'body':_0x3a53b4,'options':{'where':{'id':_0x2f7b56}},'log':_0xca0b('0x6')});}; \ No newline at end of file +var _0x279d=['Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','updateWhatsappInteraction','addTags'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x279d,0x1d8));var _0xd279=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x279d[_0x39096d];return _0x13da4f;};'use strict';var client=require(_0xd279('0x0'));exports[_0xd279('0x1')]=function(_0x17cebd,_0x368457){return client['Request']('UpdateWhatsappInteraction',{'body':_0x368457,'options':{'where':{'id':_0x17cebd}},'log':_0xd279('0x2')});};exports[_0xd279('0x3')]=function(_0x47cfee,_0x15d034){return client[_0xd279('0x4')](_0xd279('0x5'),{'body':_0x15d034,'options':{'where':{'id':_0x47cfee}},'log':_0xd279('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 28c5ebb..9e62ec1 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 _0xac70=['createWhatsappMessage','../client','create','CreateWhatsappMessage'];(function(_0x5dbb01,_0x37a32d){var _0x321c2b=function(_0x348231){while(--_0x348231){_0x5dbb01['push'](_0x5dbb01['shift']());}};_0x321c2b(++_0x37a32d);}(_0xac70,0x165));var _0x0ac7=function(_0x270f18,_0x8155e9){_0x270f18=_0x270f18-0x0;var _0x39d745=_0xac70[_0x270f18];return _0x39d745;};'use strict';var client=require(_0x0ac7('0x0'));exports[_0x0ac7('0x1')]=function(_0x20c2f6){return client['Request'](_0x0ac7('0x2'),{'body':_0x20c2f6,'log':_0x0ac7('0x3')});}; \ No newline at end of file +var _0xa708=['Request','CreateWhatsappMessage','../client','create'];(function(_0x470a4a,_0x1b674d){var _0x38504c=function(_0x139e55){while(--_0x139e55){_0x470a4a['push'](_0x470a4a['shift']());}};_0x38504c(++_0x1b674d);}(_0xa708,0xba));var _0x8a70=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa708[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x8a70('0x0'));exports[_0x8a70('0x1')]=function(_0x5c780d){return client[_0x8a70('0x2')](_0x8a70('0x3'),{'body':_0x5c780d,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 29fa6fa..22c0eda 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 _0x3423=['whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online'];(function(_0x330efd,_0xd97da2){var _0x26a09c=function(_0xa41e0f){while(--_0xa41e0f){_0x330efd['push'](_0x330efd['shift']());}};_0x26a09c(++_0xd97da2);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x3342('0x0')](_0x3342('0x1'),{'options':{'raw':![],'attributes':['id',_0x3342('0x2'),_0x3342('0x3'),_0x3342('0x4')],'include':[{'model':_0x3342('0x5'),'as':_0x3342('0x6'),'attributes':['id',_0x3342('0x2'),_0x3342('0x7'),_0x3342('0x8')]}]},'log':_0x3342('0x9')});};}; \ No newline at end of file +var _0x6cb4=['timeout','strategy','User','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6cb4,0xff));var _0x46cb=function(_0x48e71f,_0x4f2493){_0x48e71f=_0x48e71f-0x0;var _0x483ca4=_0x6cb4[_0x48e71f];return _0x483ca4;};'use strict';var client=require(_0x46cb('0x0'));exports[_0x46cb('0x1')]=function(){return function(){return client[_0x46cb('0x2')](_0x46cb('0x3'),{'options':{'raw':![],'attributes':['id',_0x46cb('0x4'),_0x46cb('0x5'),_0x46cb('0x6')],'include':[{'model':_0x46cb('0x7'),'as':_0x46cb('0x8'),'attributes':['id','name',_0x46cb('0x9'),'whatsappPause']}]},'log':_0x46cb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index cd7fca9..7eab72a 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 _0xf014=['Request','UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport','update'];(function(_0x39cb96,_0x5dbaa9){var _0x3170d5=function(_0x3993f3){while(--_0x3993f3){_0x39cb96['push'](_0x39cb96['shift']());}};_0x3170d5(++_0x5dbaa9);}(_0xf014,0xb2));var _0x4f01=function(_0x33d4a2,_0x2baaf4){_0x33d4a2=_0x33d4a2-0x0;var _0x2c793f=_0xf014[_0x33d4a2];return _0x2c793f;};'use strict';var client=require(_0x4f01('0x0'));exports[_0x4f01('0x1')]=function(_0x5e9b5b){return client['Request'](_0x4f01('0x2'),{'body':_0x5e9b5b,'log':_0x4f01('0x2')});};exports[_0x4f01('0x3')]=function(_0x46d87b,_0x42b55b){return client[_0x4f01('0x4')](_0x4f01('0x5'),{'body':_0x42b55b,'options':{'where':{'uniqueid':_0x46d87b},'order':[['id',_0x4f01('0x6')]],'limit':0x1},'log':_0x4f01('0x5')});}; \ No newline at end of file +var _0x312f=['DESC','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x312f,0x85));var _0xf312=function(_0x3d616d,_0x15f9de){_0x3d616d=_0x3d616d-0x0;var _0x324082=_0x312f[_0x3d616d];return _0x324082;};'use strict';var client=require('../client');exports[_0xf312('0x0')]=function(_0x26f8bd){return client[_0xf312('0x1')](_0xf312('0x2'),{'body':_0x26f8bd,'log':'CreateWhatsappQueueReport'});};exports[_0xf312('0x3')]=function(_0x7a5ca2,_0xa26c49){return client['Request'](_0xf312('0x4'),{'body':_0xa26c49,'options':{'where':{'uniqueid':_0x7a5ca2},'order':[['id',_0xf312('0x5')]],'limit':0x1},'log':_0xf312('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index c765c47..1bcadf1 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 _0xf23f=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','message','join','find','timeout','atimeout','channel','info','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','stop','complete','close','next','agent'];(function(_0xf3d297,_0x3b8952){var _0x296e32=function(_0x31b92a){while(--_0x31b92a){_0xf3d297['push'](_0xf3d297['shift']());}};_0x296e32(++_0x3b8952);}(_0xf23f,0x14e));var _0xff23=function(_0x2cb1bd,_0x42b64c){_0x2cb1bd=_0x2cb1bd-0x0;var _0x393fdf=_0xf23f[_0x2cb1bd];return _0x393fdf;};'use strict';var schema=require(_0xff23('0x0'));var _=require(_0xff23('0x1'));var util=require('util');var seqqueue=require(_0xff23('0x2'));var logger=require(_0xff23('0x3'))(_0xff23('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xff23('0x5')},'timeout':{'type':_0xff23('0x6'),'message':_0xff23('0x7')}});function writeLog(_0x3dd290,_0x54c66b,_0x249ba3){return logger['info'](util[_0xff23('0x8')](_0xff23('0x9'),_0x3dd290,_0x54c66b[_0xff23('0xa')],_0x249ba3));}function handleFindAgent(_0x1564ad){return function(_0x35d3c1){return _0x35d3c1['name'][_0xff23('0xb')]()===_0x1564ad[_0xff23('0xb')]();};}exports['consequence']=function(_0x254172,_0x35651c,_0x2b6713,_0x236fb8){return function(_0x334f86){try{var _0xb11eec={'name':_0x35651c[0x0],'timeout':_0x35651c[0x1]};var _0x366284=queue[_0xff23('0x0')](_0xb11eec,{'typecast':!![]});if(_0x366284[_0xff23('0xc')]){logger[_0xff23('0xd')](_0xff23('0xe'),_0x254172,_['map'](_0x366284,_0xff23('0xf'))[_0xff23('0x10')](',\x20'));_0x334f86['stop']();}else{var _0x5e321b=_[_0xff23('0x11')](_0x2b6713['agents'],handleFindAgent(_0xb11eec[_0xff23('0xa')]));if(_0x5e321b){var _0x454901=(_0xb11eec[_0xff23('0x12')]||0xa)*0x3e8;var _0x5c0426,_0x3650c5;var _0x4e5141=seqqueue['createQueue'](_0x454901);_0x4e5141['id']=_0x254172;_0x4e5141[_0xff23('0x13')]=_0x454901;_0x4e5141[_0xff23('0x14')]=_0x236fb8[_0xff23('0x14')];writeLog(_0x254172,_0x5e321b,util['format']('START:%s',_0x454901));_0x2b6713['rules'][_0x254172]['on']('end',function(){logger[_0xff23('0x15')](_0xff23('0x16'),_0x254172);clearTimeout(_0x3650c5);_0x3650c5=undefined;_0x4e5141['close']();if(_0x2b6713[_0xff23('0x17')][_0x254172]){delete _0x2b6713[_0xff23('0x17')][_0x254172];}_0x334f86[_0xff23('0x18')]();});_0x2b6713[_0xff23('0x17')][_0x254172]['on'](_0xff23('0x19'),function(){if(_0x2b6713['rules'][_0x254172]){delete _0x2b6713[_0xff23('0x17')][_0x254172];}});_0x3650c5=setTimeout(function(){logger[_0xff23('0x15')]('[%s][AGENT]\x20ROUTING\x20END',_0x254172);clearTimeout(_0x3650c5);_0x4e5141[_0xff23('0x1a')]();_0x334f86[_0xff23('0x1b')]();},_0x454901);strategy[_0xff23('0x1c')](_0x4e5141,_0x5e321b,_0x2b6713,_0x236fb8);}else{logger[_0xff23('0xd')](_0xff23('0x1d'),_0x254172,_0xb11eec[_0xff23('0xa')]);_0x334f86[_0xff23('0x18')]();}}}catch(_0x1c5c73){console[_0xff23('0x1e')](_0x1c5c73);logger[_0xff23('0xd')](_0xff23('0x1f'),_0x254172,_0x1c5c73[_0xff23('0x20')]);_0x334f86[_0xff23('0x18')]();}};}; \ No newline at end of file +var _0xbef9=['toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','name'];(function(_0x41c4c8,_0x28de17){var _0x56c4e4=function(_0x17290e){while(--_0x17290e){_0x41c4c8['push'](_0x41c4c8['shift']());}};_0x56c4e4(++_0x28de17);}(_0xbef9,0xff));var _0x9bef=function(_0x1d4f79,_0x4d2aca){_0x1d4f79=_0x1d4f79-0x0;var _0x382ed5=_0xbef9[_0x1d4f79];return _0x382ed5;};'use strict';var schema=require('validate');var _=require(_0x9bef('0x0'));var util=require(_0x9bef('0x1'));var seqqueue=require(_0x9bef('0x2'));var logger=require(_0x9bef('0x3'))(_0x9bef('0x4'));var strategy=require(_0x9bef('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x9bef('0x6')},'timeout':{'type':'number','message':_0x9bef('0x7')}});function writeLog(_0x1a8173,_0x3a6b88,_0x36e5db){return logger[_0x9bef('0x8')](util[_0x9bef('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1a8173,_0x3a6b88[_0x9bef('0xa')],_0x36e5db));}function handleFindAgent(_0x37b41c){return function(_0x55c7ff){return _0x55c7ff[_0x9bef('0xa')][_0x9bef('0xb')]()===_0x37b41c['toLowerCase']();};}exports[_0x9bef('0xc')]=function(_0x49e467,_0x894b9,_0x3200ce,_0x55e082){return function(_0x20bc79){try{var _0x35c46c={'name':_0x894b9[0x0],'timeout':_0x894b9[0x1]};var _0x416640=queue[_0x9bef('0xd')](_0x35c46c,{'typecast':!![]});if(_0x416640[_0x9bef('0xe')]){logger[_0x9bef('0xf')](_0x9bef('0x10'),_0x49e467,_[_0x9bef('0x11')](_0x416640,_0x9bef('0x12'))[_0x9bef('0x13')](',\x20'));_0x20bc79[_0x9bef('0x14')]();}else{var _0x515d84=_['find'](_0x3200ce[_0x9bef('0x15')],handleFindAgent(_0x35c46c[_0x9bef('0xa')]));if(_0x515d84){var _0x150a52=(_0x35c46c[_0x9bef('0x16')]||0xa)*0x3e8;var _0x1c795d,_0x2dfda0;var _0x484a4a=seqqueue[_0x9bef('0x17')](_0x150a52);_0x484a4a['id']=_0x49e467;_0x484a4a[_0x9bef('0x18')]=_0x150a52;_0x484a4a[_0x9bef('0x19')]=_0x55e082[_0x9bef('0x19')];writeLog(_0x49e467,_0x515d84,util['format'](_0x9bef('0x1a'),_0x150a52));_0x3200ce[_0x9bef('0x1b')][_0x49e467]['on'](_0x9bef('0x1c'),function(){logger[_0x9bef('0x8')](_0x9bef('0x1d'),_0x49e467);clearTimeout(_0x2dfda0);_0x2dfda0=undefined;_0x484a4a['close']();if(_0x3200ce['rules'][_0x49e467]){delete _0x3200ce[_0x9bef('0x1b')][_0x49e467];}_0x20bc79['stop']();});_0x3200ce[_0x9bef('0x1b')][_0x49e467]['on'](_0x9bef('0x1e'),function(){if(_0x3200ce[_0x9bef('0x1b')][_0x49e467]){delete _0x3200ce['rules'][_0x49e467];}});_0x2dfda0=setTimeout(function(){logger['info'](_0x9bef('0x1f'),_0x49e467);clearTimeout(_0x2dfda0);_0x484a4a[_0x9bef('0x20')]();_0x20bc79[_0x9bef('0x21')]();},_0x150a52);strategy['agent'](_0x484a4a,_0x515d84,_0x3200ce,_0x55e082);}else{logger['error'](_0x9bef('0x22'),_0x49e467,_0x35c46c[_0x9bef('0xa')]);_0x20bc79[_0x9bef('0x14')]();}}}catch(_0x51db40){console[_0x9bef('0x23')](_0x51db40);logger[_0x9bef('0xf')](_0x9bef('0x24'),_0x49e467,_0x51db40[_0x9bef('0x25')]);_0x20bc79[_0x9bef('0x14')]();}};}; \ 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 36de7f9..0c78f36 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 _0x2ef3=['../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','ChatWebsiteId','upperFirst','account','isEmpty','body','getMustacheRender','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','toString','postText','Message','create','then','dialogState','Failed','stringify','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage'];(function(_0x17c00a,_0x12377c){var _0x556332=function(_0x4fa67a){while(--_0x4fa67a){_0x17c00a['push'](_0x17c00a['shift']());}};_0x556332(++_0x12377c);}(_0x2ef3,0xba));var _0x32ef=function(_0x6a9d94,_0x44f79f){_0x6a9d94=_0x6a9d94-0x0;var _0xf4237a=_0x2ef3[_0x6a9d94];return _0xf4237a;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var AWS=require(_0x32ef('0x2'));var utils=require(_0x32ef('0x3'));var logger=require(_0x32ef('0x4'))(_0x32ef('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x32ef('0x6')),'mailMessage':require(_0x32ef('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x32ef('0x8')),'whatsappMessage':require(_0x32ef('0x9'))};exports['consequence']=function(_0x5dfa09,_0x2c0089){return function(_0x4bfcf8){try{if(!_[_0x32ef('0xa')](this[_0x32ef('0xb')][_0x32ef('0xc')])){logger[_0x32ef('0xd')](_0x32ef('0xe'),_0x5dfa09,_0x32ef('0xf'));return _0x4bfcf8[_0x32ef('0x10')]();}var _0x77df79={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x32ef('0x11')),'direction':_0x32ef('0x12')};var _0x45bfd5=this[_0x32ef('0x13')];if(_0x45bfd5==='chat'){_0x77df79[_0x32ef('0x14')]=this['account']['id'];}else{_0x77df79[_[_0x32ef('0x15')](_0x45bfd5)+'AccountId']=this[_0x32ef('0x16')]['id'];}_0x77df79[_[_0x32ef('0x15')](_0x45bfd5)+'InteractionId']=this['interaction']['id'];if(this[_0x32ef('0xb')]['created']){var _0x326fce=_0x2c0089[0x4];if(!_[_0x32ef('0x17')](_0x326fce)){_0x77df79[_0x32ef('0x18')]=utils[_0x32ef('0x19')](_0x326fce,this);return rpc[_0x45bfd5+'Message']['create'](_0x77df79)['then'](function(_0x13db1a){logger[_0x32ef('0xd')](_0x32ef('0xe'),_0x5dfa09,_0x77df79['body']);})['catch'](function(_0x1eb468){logger[_0x32ef('0x1a')](_0x32ef('0xe'),_0x5dfa09,JSON['stringify'](_0x1eb468));})[_0x32ef('0x1b')](function(){logger[_0x32ef('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5dfa09);_0x4bfcf8[_0x32ef('0x1c')]();});}else{logger[_0x32ef('0xd')](_0x32ef('0x1d'),_0x5dfa09);_0x4bfcf8[_0x32ef('0x1c')]();}}else{var _0x445cda=this;var _0x3aec05=new AWS['LexRuntime']({'accessKeyId':_0x2c0089[0x0],'secretAccessKey':_0x2c0089[0x1],'region':_0x2c0089[0x2]});var _0x3c5b78={'botAlias':'$LATEST','botName':_0x2c0089[0x3],'inputText':this[_0x32ef('0x1e')][_0x32ef('0x18')],'userId':this['channel']+':'+this[_0x32ef('0xb')]['id'][_0x32ef('0x1f')]()};_0x3aec05[_0x32ef('0x20')](_0x3c5b78,function(_0x55f7f2,_0x57f5e5){if(_0x55f7f2){logger[_0x32ef('0x1a')](_0x32ef('0xe'),_0x5dfa09,_0x55f7f2[_0x32ef('0x1e')]);_0x4bfcf8['next']();}else if(_0x57f5e5&&_0x57f5e5['message']){_0x445cda[_0x32ef('0x18')]['amazonlex']=_0x57f5e5;_0x77df79['body']=_0x57f5e5[_0x32ef('0x1e')];return rpc[_0x45bfd5+_0x32ef('0x21')][_0x32ef('0x22')](_0x77df79)[_0x32ef('0x23')](function(_0x15ce54){logger[_0x32ef('0xd')](_0x32ef('0xe'),_0x5dfa09,_0x77df79[_0x32ef('0x18')]);if(_0x57f5e5[_0x32ef('0x24')]==_0x32ef('0x25')){_0x4bfcf8[_0x32ef('0x10')]();}else{_0x4bfcf8[_0x32ef('0x1c')]();}})['catch'](function(_0xd65fde){logger[_0x32ef('0x1a')]('[%s][AMAZONLEX]\x20%s',_0x5dfa09,JSON[_0x32ef('0x26')](_0xd65fde));_0x4bfcf8[_0x32ef('0x10')]();});}else{_0x4bfcf8[_0x32ef('0x10')]();}});}}catch(_0x26e207){logger['error'](_0x32ef('0xe'),_0x5dfa09,JSON[_0x32ef('0x26')](_0x26e207));_0x4bfcf8[_0x32ef('0x1c')]();}};}; \ No newline at end of file +var _0x4819=['created','isEmpty','getMustacheRender','Message','then','[%s][AMAZONLEX]\x20%s','body','catch','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','error','next','create','dialogState','Failed','stringify','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId'];(function(_0x2348bd,_0x4eba3f){var _0x2049ca=function(_0xb2a64c){while(--_0xb2a64c){_0x2348bd['push'](_0x2348bd['shift']());}};_0x2049ca(++_0x4eba3f);}(_0x4819,0xcd));var _0x9481=function(_0x860520,_0x20520a){_0x860520=_0x860520-0x0;var _0x22ce80=_0x4819[_0x860520];return _0x22ce80;};'use strict';var _=require('lodash');var moment=require(_0x9481('0x0'));var AWS=require(_0x9481('0x1'));var utils=require(_0x9481('0x2'));var logger=require(_0x9481('0x3'))(_0x9481('0x4'));var rpc={'chatMessage':require(_0x9481('0x5')),'openchannelMessage':require(_0x9481('0x6')),'mailMessage':require(_0x9481('0x7')),'smsMessage':require(_0x9481('0x8')),'faxMessage':require(_0x9481('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return function(_0x14e05a){try{if(!_[_0x9481('0xb')](this[_0x9481('0xc')][_0x9481('0xd')])){logger[_0x9481('0xe')]('[%s][AMAZONLEX]\x20%s',_0x5def07,_0x9481('0xf'));return _0x14e05a['next']();}var _0x2fabf1={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9481('0x10')](_0x9481('0x11')),'direction':_0x9481('0x12')};var _0x3ffe85=this[_0x9481('0x13')];if(_0x3ffe85===_0x9481('0x14')){_0x2fabf1[_0x9481('0x15')]=this[_0x9481('0x16')]['id'];}else{_0x2fabf1[_[_0x9481('0x17')](_0x3ffe85)+'AccountId']=this['account']['id'];}_0x2fabf1[_[_0x9481('0x17')](_0x3ffe85)+_0x9481('0x18')]=this[_0x9481('0xc')]['id'];if(this[_0x9481('0xc')][_0x9481('0x19')]){var _0xc7a0b5=_0x54cc78[0x4];if(!_[_0x9481('0x1a')](_0xc7a0b5)){_0x2fabf1['body']=utils[_0x9481('0x1b')](_0xc7a0b5,this);return rpc[_0x3ffe85+_0x9481('0x1c')]['create'](_0x2fabf1)[_0x9481('0x1d')](function(_0x518150){logger[_0x9481('0xe')](_0x9481('0x1e'),_0x5def07,_0x2fabf1[_0x9481('0x1f')]);})[_0x9481('0x20')](function(_0x546fce){logger['error'](_0x9481('0x1e'),_0x5def07,JSON['stringify'](_0x546fce));})['finally'](function(){logger[_0x9481('0xe')](_0x9481('0x21'),_0x5def07);_0x14e05a[_0x9481('0x22')]();});}else{logger[_0x9481('0xe')](_0x9481('0x23'),_0x5def07);_0x14e05a[_0x9481('0x22')]();}}else{var _0x55a1bd=this;var _0x2cf1aa=new AWS[(_0x9481('0x24'))]({'accessKeyId':_0x54cc78[0x0],'secretAccessKey':_0x54cc78[0x1],'region':_0x54cc78[0x2]});var _0x45f9df={'botAlias':_0x9481('0x25'),'botName':_0x54cc78[0x3],'inputText':this[_0x9481('0x26')]['body'],'userId':this[_0x9481('0x13')]+':'+this[_0x9481('0xc')]['id']['toString']()};_0x2cf1aa[_0x9481('0x27')](_0x45f9df,function(_0xd1cd1a,_0x352b3a){if(_0xd1cd1a){logger[_0x9481('0x28')](_0x9481('0x1e'),_0x5def07,_0xd1cd1a['message']);_0x14e05a[_0x9481('0x29')]();}else if(_0x352b3a&&_0x352b3a[_0x9481('0x26')]){_0x55a1bd['body']['amazonlex']=_0x352b3a;_0x2fabf1[_0x9481('0x1f')]=_0x352b3a[_0x9481('0x26')];return rpc[_0x3ffe85+'Message'][_0x9481('0x2a')](_0x2fabf1)[_0x9481('0x1d')](function(_0xeff0a5){logger[_0x9481('0xe')]('[%s][AMAZONLEX]\x20%s',_0x5def07,_0x2fabf1[_0x9481('0x1f')]);if(_0x352b3a[_0x9481('0x2b')]==_0x9481('0x2c')){_0x14e05a['next']();}else{_0x14e05a[_0x9481('0x22')]();}})['catch'](function(_0x2e1eff){logger[_0x9481('0x28')](_0x9481('0x1e'),_0x5def07,JSON[_0x9481('0x2d')](_0x2e1eff));_0x14e05a[_0x9481('0x29')]();});}else{_0x14e05a['next']();}});}}catch(_0x2aa9ff){logger[_0x9481('0x28')](_0x9481('0x1e'),_0x5def07,JSON['stringify'](_0x2aa9ff));_0x14e05a['stop']();}};}; \ 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 58b786c..57d9ce6 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 _0x9e65=['[RPC][%s][AUTOREPLY]\x20%s','next','catch','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','isNil','interaction','created','info','getMustacheRender','contact','format','out','message','from','phone','read','subject','startsWith','Re:','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','mail','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','html','','body','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','[%s][AUTOREPLY]\x20%s','stringify','error'];(function(_0x32c25f,_0x4bda8c){var _0x626ab2=function(_0x151ae3){while(--_0x151ae3){_0x32c25f['push'](_0x32c25f['shift']());}};_0x626ab2(++_0x4bda8c);}(_0x9e65,0x1e3));var _0x59e6=function(_0x4279e1,_0x39cda4){_0x4279e1=_0x4279e1-0x0;var _0x1e33ea=_0x9e65[_0x4279e1];return _0x1e33ea;};'use strict';var _=require(_0x59e6('0x0'));var moment=require(_0x59e6('0x1'));var utils=require(_0x59e6('0x2'));var logger=require(_0x59e6('0x3'))('routing');var rpc={'chatMessage':require(_0x59e6('0x4')),'openchannelMessage':require(_0x59e6('0x5')),'mailMessage':require(_0x59e6('0x6')),'smsMessage':require(_0x59e6('0x7')),'faxMessage':require(_0x59e6('0x8')),'whatsappMessage':require(_0x59e6('0x9'))};var mailRpc=require(_0x59e6('0xa'));exports['consequence']=function(_0x59356d,_0x23a7a3){return function(_0x4c5a2c){try{if(_0x23a7a3[0x0]==='1'&&(_[_0x59e6('0xb')](this[_0x59e6('0xc')][_0x59e6('0xd')])||!this[_0x59e6('0xc')][_0x59e6('0xd')])){logger[_0x59e6('0xe')]('[%s][AUTOREPLY]\x20%s',_0x59356d,'Autoreply\x20already\x20sent');return _0x4c5a2c['next']();}var _0x28dd0d=this['channel'];var _0xe468ef={'body':utils[_0x59e6('0xf')](_0x23a7a3[0x1],this),'ContactId':this[_0x59e6('0x10')]['id'],'sentAt':moment()[_0x59e6('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x59e6('0x12')};if(this['message']){_0xe468ef['to']=this[_0x59e6('0x13')][_0x59e6('0x14')]||'';_0xe468ef['cc']=this['message']['cc']||'';_0xe468ef[_0x59e6('0x14')]=this[_0x59e6('0x13')]['to']||'';_0xe468ef['phone']=this[_0x59e6('0x13')][_0x59e6('0x15')]||'';_0xe468ef[_0x59e6('0x16')]=!![];if(this[_0x59e6('0x13')][_0x59e6('0x17')]){_0xe468ef[_0x59e6('0x17')]='';_0xe468ef['subject']+=_[_0x59e6('0x18')](this[_0x59e6('0x13')]['subject'],_0x59e6('0x19'))?'':'Re:\x20';_0xe468ef[_0x59e6('0x17')]+=this[_0x59e6('0x13')][_0x59e6('0x17')];}}if(this[_0x59e6('0x1a')]===_0x59e6('0x1b')){_0xe468ef[_0x59e6('0x1c')]=this[_0x59e6('0x1d')]['id'];}else{_0xe468ef[_['upperFirst'](this['channel'])+'AccountId']=this[_0x59e6('0x1d')]['id'];}_0xe468ef[_[_0x59e6('0x1e')](this[_0x59e6('0x1a')])+_0x59e6('0x1f')]=this[_0x59e6('0xc')]['id'];if(rpc[this[_0x59e6('0x1a')]+_0x59e6('0x20')]){if(this[_0x59e6('0x1a')]===_0x59e6('0x21')){var _0x58c281={'tls':{'rejectUnauthorized':![]}};if(this[_0x59e6('0x1d')][_0x59e6('0x22')]['service']){_0x58c281[_0x59e6('0x23')]=this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x23')];}else{_0x58c281[_0x59e6('0x24')]=this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x24')];_0x58c281[_0x59e6('0x25')]=this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x25')];_0x58c281[_0x59e6('0x26')]=this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x26')];}if(this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x27')]){_0x58c281[_0x59e6('0x28')]={'user':this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x29')],'pass':this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x2a')]};}_0xe468ef[_0x59e6('0x2b')]=this['message']['messageId'];_0xe468ef[_0x59e6('0x2c')]=_0x59e6('0x2d')+_['replace'](_0xe468ef[_0x59e6('0x2e')],_0x59e6('0x2f'),'','replace','body','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT'];(function(_0x266dfd,_0x415138){var _0x4d11f6=function(_0x138453){while(--_0x138453){_0x266dfd['push'](_0x266dfd['shift']());}};_0x4d11f6(++_0x415138);}(_0x6537,0x11a));var _0x7653=function(_0x3d78c7,_0x589804){_0x3d78c7=_0x3d78c7-0x0;var _0x18efae=_0x6537[_0x3d78c7];return _0x18efae;};'use strict';var _=require(_0x7653('0x0'));var moment=require(_0x7653('0x1'));var utils=require(_0x7653('0x2'));var logger=require(_0x7653('0x3'))(_0x7653('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7653('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x7653('0x6')),'whatsappMessage':require(_0x7653('0x7'))};var mailRpc=require(_0x7653('0x8'));exports['consequence']=function(_0x2ed66a,_0xedd054){return function(_0x33ae60){try{if(_0xedd054[0x0]==='1'&&(_[_0x7653('0x9')](this[_0x7653('0xa')][_0x7653('0xb')])||!this['interaction']['created'])){logger[_0x7653('0xc')]('[%s][AUTOREPLY]\x20%s',_0x2ed66a,_0x7653('0xd'));return _0x33ae60[_0x7653('0xe')]();}var _0x4956f8=this[_0x7653('0xf')];var _0x46bf18={'body':utils[_0x7653('0x10')](_0xedd054[0x1],this),'ContactId':this[_0x7653('0x11')]['id'],'sentAt':moment()[_0x7653('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7653('0x13')};if(this[_0x7653('0x14')]){_0x46bf18['to']=this[_0x7653('0x14')][_0x7653('0x15')]||'';_0x46bf18['cc']=this[_0x7653('0x14')]['cc']||'';_0x46bf18['from']=this[_0x7653('0x14')]['to']||'';_0x46bf18['phone']=this['message']['phone']||'';_0x46bf18['read']=!![];if(this[_0x7653('0x14')]['subject']){_0x46bf18[_0x7653('0x16')]='';_0x46bf18['subject']+=_['startsWith'](this[_0x7653('0x14')][_0x7653('0x16')],'Re:')?'':'Re:\x20';_0x46bf18['subject']+=this[_0x7653('0x14')][_0x7653('0x16')];}}if(this[_0x7653('0xf')]===_0x7653('0x17')){_0x46bf18[_0x7653('0x18')]=this[_0x7653('0x19')]['id'];}else{_0x46bf18[_[_0x7653('0x1a')](this[_0x7653('0xf')])+_0x7653('0x1b')]=this['account']['id'];}_0x46bf18[_[_0x7653('0x1a')](this['channel'])+_0x7653('0x1c')]=this[_0x7653('0xa')]['id'];if(rpc[this['channel']+_0x7653('0x1d')]){if(this[_0x7653('0xf')]===_0x7653('0x1e')){var _0x2bfae4={'tls':{'rejectUnauthorized':![]}};if(this[_0x7653('0x19')][_0x7653('0x1f')][_0x7653('0x20')]){_0x2bfae4['service']=this['account'][_0x7653('0x1f')][_0x7653('0x20')];}else{_0x2bfae4['host']=this['account'][_0x7653('0x1f')]['host'];_0x2bfae4[_0x7653('0x21')]=this[_0x7653('0x19')][_0x7653('0x1f')]['port'];_0x2bfae4['secure']=this[_0x7653('0x19')][_0x7653('0x1f')]['secure'];}if(this[_0x7653('0x19')][_0x7653('0x1f')][_0x7653('0x22')]){_0x2bfae4[_0x7653('0x23')]={'user':this['account'][_0x7653('0x1f')]['user'],'pass':this[_0x7653('0x19')][_0x7653('0x1f')][_0x7653('0x24')]};}_0x46bf18[_0x7653('0x25')]=this['message'][_0x7653('0x26')];_0x46bf18[_0x7653('0x27')]=_0x7653('0x28')+_[_0x7653('0x29')](_0x46bf18[_0x7653('0x2a')],_0x7653('0x2b'),']+(>|$)/g,''),'priorityTrue':_0xf75a6f[0x1],'priorityFalse':_0xf75a6f[0x2]};var _0x577053=gotoif[_0xa146('0x0')](_0x4cae3e,{'typecast':!![]});if(_0x577053[_0xa146('0xd')]){logger[_0xa146('0xe')]('[%s][GOTOIF]\x20%s',_0x42da7,_[_0xa146('0xf')](_0x577053,'message')[_0xa146('0x10')](',\x20'));_0x3ee20d[_0xa146('0x11')]();}else{try{var _0xd7f08=eval('('+_0x4cae3e[_0xa146('0x12')]+')');var _0x420d66=_0xd7f08?_0x4cae3e[_0xa146('0x13')]:_0x4cae3e[_0xa146('0x14')];logger[_0xa146('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x42da7,_0x4cae3e[_0xa146('0x12')],_0xd7f08,_0x420d66||_0xa146('0x16'));if(_0x420d66){var _0x18c8d1=_[_0xa146('0x17')](_0x3ee20d[_0xa146('0x18')](),{'p':_0x420d66});if(_0x18c8d1>=0x0){logger[_0xa146('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x42da7,_0x420d66||_0xa146('0x16'),_0x18c8d1);_0x3ee20d[_0xa146('0x16')](_0x18c8d1);}else{logger[_0xa146('0x15')](_0xa146('0x19'),_0x42da7,_0x420d66||_0xa146('0x16'));_0x3ee20d[_0xa146('0x11')]();}}else{_0x3ee20d[_0xa146('0x16')]();}}catch(_0x5d7bff){logger[_0xa146('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x42da7,_0x5d7bff['message']);_0x3ee20d['stop']();}}}catch(_0xd4c46c){logger[_0xa146('0xe')]('[%s][GOTOIF]\x20%s',_0x42da7,JSON[_0xa146('0x1a')](_0xd4c46c));_0x3ee20d[_0xa146('0x11')]();}};}; \ No newline at end of file +var _0x3b5d=['error','[%s][GOTOIF]\x20%s','join','stop','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','message','validate','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','length'];(function(_0x440064,_0x15230d){var _0x4f32c7=function(_0x21c549){while(--_0x21c549){_0x440064['push'](_0x440064['shift']());}};_0x4f32c7(++_0x15230d);}(_0x3b5d,0x1b7));var _0xd3b5=function(_0x2b2583,_0x2a154b){_0x2b2583=_0x2b2583-0x0;var _0x4cd668=_0x3b5d[_0x2b2583];return _0x4cd668;};'use strict';var schema=require(_0xd3b5('0x0'));var _=require('lodash');var htmlToText=require(_0xd3b5('0x1'));var utils=require(_0xd3b5('0x2'));var logger=require('../../../../config/logger')(_0xd3b5('0x3'));var gotoif=schema({'condition':{'type':_0xd3b5('0x4'),'required':!![],'message':_0xd3b5('0x5')},'priorityTrue':{'type':_0xd3b5('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xd3b5('0x6'),'message':_0xd3b5('0x7')}});exports[_0xd3b5('0x8')]=function(_0x59904e,_0x2bc7b3){return function(_0x31fc3b){try{var _0x54dbb9={'condition':htmlToText[_0xd3b5('0x9')](utils['getMustacheRender'](_0x2bc7b3[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2bc7b3[0x1],'priorityFalse':_0x2bc7b3[0x2]};var _0x43b190=gotoif[_0xd3b5('0x0')](_0x54dbb9,{'typecast':!![]});if(_0x43b190[_0xd3b5('0xa')]){logger[_0xd3b5('0xb')](_0xd3b5('0xc'),_0x59904e,_['map'](_0x43b190,'message')[_0xd3b5('0xd')](',\x20'));_0x31fc3b[_0xd3b5('0xe')]();}else{try{var _0x710f22=eval('('+_0x54dbb9[_0xd3b5('0xf')]+')');var _0x524602=_0x710f22?_0x54dbb9['priorityTrue']:_0x54dbb9[_0xd3b5('0x10')];logger['info'](_0xd3b5('0x11'),_0x59904e,_0x54dbb9[_0xd3b5('0xf')],_0x710f22,_0x524602||_0xd3b5('0x12'));if(_0x524602){var _0x44db0e=_[_0xd3b5('0x13')](_0x31fc3b[_0xd3b5('0x14')](),{'p':_0x524602});if(_0x44db0e>=0x0){logger['info'](_0xd3b5('0x15'),_0x59904e,_0x524602||_0xd3b5('0x12'),_0x44db0e);_0x31fc3b[_0xd3b5('0x12')](_0x44db0e);}else{logger[_0xd3b5('0x16')](_0xd3b5('0x17'),_0x59904e,_0x524602||_0xd3b5('0x12'));_0x31fc3b['stop']();}}else{_0x31fc3b[_0xd3b5('0x12')]();}}catch(_0x419512){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x59904e,_0x419512[_0xd3b5('0x18')]);_0x31fc3b[_0xd3b5('0xe')]();}}}catch(_0x3d4da5){logger[_0xd3b5('0xb')](_0xd3b5('0xc'),_0x59904e,JSON['stringify'](_0x3d4da5));_0x31fc3b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index f0688d7..4606969 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 _0xd317=['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','stringify','validate','lodash','../../../../config/logger','consequence','length','[%s][GOTOP]\x20%s','map','message'];(function(_0x4ceed9,_0x3a0f06){var _0x513790=function(_0x521853){while(--_0x521853){_0x4ceed9['push'](_0x4ceed9['shift']());}};_0x513790(++_0x3a0f06);}(_0xd317,0x1c0));var _0x7d31=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd317[_0x465a0c];return _0x1e202e;};'use strict';var schema=require(_0x7d31('0x0'));var _=require(_0x7d31('0x1'));var logger=require(_0x7d31('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x7d31('0x3')]=function(_0x229edc,_0x1588a3){return function(_0xa50885){try{var _0x3bee9e={'priority':_0x1588a3[0x0]};var _0x474687=gotop['validate'](_0x3bee9e,{'typecast':!![]});if(_0x474687[_0x7d31('0x4')]){logger['error'](_0x7d31('0x5'),_0x229edc,_[_0x7d31('0x6')](_0x474687,_0x7d31('0x7'))[_0x7d31('0x8')](',\x20'));_0xa50885[_0x7d31('0x9')]();}else{logger[_0x7d31('0xa')](_0x7d31('0xb'),_0x229edc,_0x3bee9e[_0x7d31('0xc')]);if(_0x3bee9e[_0x7d31('0xc')]){var _0x5c47ab=_[_0x7d31('0xd')](_0xa50885['rules'](),{'p':_0x3bee9e[_0x7d31('0xc')]});if(_0x5c47ab>=0x0){logger['info'](_0x7d31('0xe'),_0x229edc,_0x3bee9e['priority']||'next',_0x5c47ab);_0xa50885[_0x7d31('0xf')](_0x5c47ab);}else{logger['info'](_0x7d31('0x10'),_0x229edc,_0x3bee9e[_0x7d31('0xc')]||'next');_0xa50885[_0x7d31('0x9')]();}}else{_0xa50885[_0x7d31('0xf')]();}}}catch(_0x2b0429){logger[_0x7d31('0x11')]('[%s][GOTOP]\x20%s',_0x229edc,JSON[_0x7d31('0x12')](_0x2b0429));_0xa50885[_0x7d31('0x9')]();}};}; \ No newline at end of file +var _0x19a6=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','map','message','join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','error','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','routing'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x19a6,0x88));var _0x619a=function(_0x140d62,_0x5a4caf){_0x140d62=_0x140d62-0x0;var _0x423476=_0x19a6[_0x140d62];return _0x423476;};'use strict';var schema=require(_0x619a('0x0'));var _=require(_0x619a('0x1'));var logger=require(_0x619a('0x2'))(_0x619a('0x3'));var gotop=schema({'priority':{'type':_0x619a('0x4'),'required':!![],'message':_0x619a('0x5')}});exports[_0x619a('0x6')]=function(_0x2ce94f,_0x41e8b8){return function(_0x5906e5){try{var _0x186a47={'priority':_0x41e8b8[0x0]};var _0x5945f9=gotop[_0x619a('0x0')](_0x186a47,{'typecast':!![]});if(_0x5945f9['length']){logger['error']('[%s][GOTOP]\x20%s',_0x2ce94f,_[_0x619a('0x7')](_0x5945f9,_0x619a('0x8'))[_0x619a('0x9')](',\x20'));_0x5906e5[_0x619a('0xa')]();}else{logger[_0x619a('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x2ce94f,_0x186a47[_0x619a('0xc')]);if(_0x186a47[_0x619a('0xc')]){var _0x27a0c0=_[_0x619a('0xd')](_0x5906e5['rules'](),{'p':_0x186a47[_0x619a('0xc')]});if(_0x27a0c0>=0x0){logger[_0x619a('0xb')](_0x619a('0xe'),_0x2ce94f,_0x186a47[_0x619a('0xc')]||'next',_0x27a0c0);_0x5906e5['next'](_0x27a0c0);}else{logger[_0x619a('0xb')](_0x619a('0xf'),_0x2ce94f,_0x186a47['priority']||'next');_0x5906e5[_0x619a('0xa')]();}}else{_0x5906e5[_0x619a('0x10')]();}}}catch(_0x54e05a){logger[_0x619a('0x11')](_0x619a('0x12'),_0x2ce94f,JSON[_0x619a('0x13')](_0x54e05a));_0x5906e5[_0x619a('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index e131889..c56d962 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 _0x2a4f=['next','catch','error','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','contact','channel','ChatWebsiteId','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x2a4f,0xac));var _0xf2a4=function(_0x51156d,_0xe9e50){_0x51156d=_0x51156d-0x0;var _0x598764=_0x2a4f[_0x51156d];return _0x598764;};'use strict';var _=require('lodash');var utils=require(_0xf2a4('0x0'));var logger=require(_0xf2a4('0x1'))(_0xf2a4('0x2'));var rpc={'chatMessage':require(_0xf2a4('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf2a4('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf2a4('0x5'))};exports[_0xf2a4('0x6')]=function(_0x5d5b88,_0x18438e){return function(_0x2df18a){try{var _0x108baf={'body':utils['getMustacheRender'](_0x18438e[0x0],this),'ContactId':this[_0xf2a4('0x7')]['id']};if(this[_0xf2a4('0x8')]==='chat'){_0x108baf[_0xf2a4('0x9')]=this['account']['id'];}else{_0x108baf[_[_0xf2a4('0xa')](this[_0xf2a4('0x8')])+_0xf2a4('0xb')]=this['account']['id'];}_0x108baf[_['upperFirst'](this['channel'])+_0xf2a4('0xc')]=this[_0xf2a4('0xd')]['id'];if(rpc[this['channel']+_0xf2a4('0xe')]){return rpc[this[_0xf2a4('0x8')]+'Message'][_0xf2a4('0xf')](_0x108baf)[_0xf2a4('0x10')](function(_0x78718d){logger[_0xf2a4('0x11')](_0xf2a4('0x12'),_0x5d5b88,_0x108baf[_0xf2a4('0x13')]);_0x2df18a[_0xf2a4('0x14')]();})[_0xf2a4('0x15')](function(_0x2cea2e){logger[_0xf2a4('0x16')](_0xf2a4('0x12'),_0x5d5b88,JSON['stringify'](_0x2cea2e));_0x2df18a[_0xf2a4('0x17')]();});}}catch(_0x555109){logger[_0xf2a4('0x16')](_0xf2a4('0x12'),_0x5d5b88,JSON['stringify'](_0x555109));_0x2df18a[_0xf2a4('0x17')]();}};}; \ No newline at end of file +var _0x6089=['ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat'];(function(_0x2758f8,_0x49a1ee){var _0x1ef670=function(_0x9f86d0){while(--_0x9f86d0){_0x2758f8['push'](_0x2758f8['shift']());}};_0x1ef670(++_0x49a1ee);}(_0x6089,0x189));var _0x9608=function(_0x3e4c67,_0xbeeeb9){_0x3e4c67=_0x3e4c67-0x0;var _0x8d7261=_0x6089[_0x3e4c67];return _0x8d7261;};'use strict';var _=require(_0x9608('0x0'));var utils=require('./utils');var logger=require(_0x9608('0x1'))(_0x9608('0x2'));var rpc={'chatMessage':require(_0x9608('0x3')),'openchannelMessage':require(_0x9608('0x4')),'mailMessage':require(_0x9608('0x5')),'smsMessage':require(_0x9608('0x6')),'faxMessage':require(_0x9608('0x7')),'whatsappMessage':require(_0x9608('0x8'))};exports[_0x9608('0x9')]=function(_0x2ea9b1,_0x518020){return function(_0x2567ac){try{var _0x25520e={'body':utils['getMustacheRender'](_0x518020[0x0],this),'ContactId':this[_0x9608('0xa')]['id']};if(this[_0x9608('0xb')]===_0x9608('0xc')){_0x25520e[_0x9608('0xd')]=this[_0x9608('0xe')]['id'];}else{_0x25520e[_[_0x9608('0xf')](this[_0x9608('0xb')])+_0x9608('0x10')]=this[_0x9608('0xe')]['id'];}_0x25520e[_[_0x9608('0xf')](this[_0x9608('0xb')])+_0x9608('0x11')]=this[_0x9608('0x12')]['id'];if(rpc[this['channel']+_0x9608('0x13')]){return rpc[this[_0x9608('0xb')]+_0x9608('0x13')][_0x9608('0x14')](_0x25520e)['then'](function(_0x29f277){logger[_0x9608('0x15')](_0x9608('0x16'),_0x2ea9b1,_0x25520e[_0x9608('0x17')]);_0x2567ac[_0x9608('0x18')]();})[_0x9608('0x19')](function(_0x360f27){logger['error'](_0x9608('0x16'),_0x2ea9b1,JSON[_0x9608('0x1a')](_0x360f27));_0x2567ac[_0x9608('0x1b')]();});}}catch(_0x5bd985){logger[_0x9608('0x1c')](_0x9608('0x16'),_0x2ea9b1,JSON[_0x9608('0x1a')](_0x5bd985));_0x2567ac[_0x9608('0x1b')]();}};}; \ 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 1a95d0a..caaa043 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 _0x8826=['consequence','info','[%s][NOOP]\x20%s','next','error','stringify','./utils','../../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8826,0x17e));var _0x6882=function(_0xdb9089,_0x11ec02){_0xdb9089=_0xdb9089-0x0;var _0x316f82=_0x8826[_0xdb9089];return _0x316f82;};'use strict';var utils=require(_0x6882('0x0'));var logger=require(_0x6882('0x1'))('routing');exports[_0x6882('0x2')]=function(_0x44cbfc,_0x55892b){return function(_0x2e4c09){try{logger[_0x6882('0x3')](_0x6882('0x4'),_0x44cbfc,utils['getMustacheRender'](_0x55892b[0x0],this));_0x2e4c09[_0x6882('0x5')]();}catch(_0x2cca07){logger[_0x6882('0x6')](_0x6882('0x4'),_0x44cbfc,JSON[_0x6882('0x7')](_0x2cca07));_0x2e4c09['stop']();}};}; \ No newline at end of file +var _0x990f=['routing','info','getMustacheRender','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger'];(function(_0x439b05,_0x552f4b){var _0x48f241=function(_0x22d57b){while(--_0x22d57b){_0x439b05['push'](_0x439b05['shift']());}};_0x48f241(++_0x552f4b);}(_0x990f,0x1bf));var _0xf990=function(_0x260165,_0x187de6){_0x260165=_0x260165-0x0;var _0x134e69=_0x990f[_0x260165];return _0x134e69;};'use strict';var utils=require('./utils');var logger=require(_0xf990('0x0'))(_0xf990('0x1'));exports['consequence']=function(_0x1f63a0,_0x1dec34){return function(_0x5f1afa){try{logger[_0xf990('0x2')]('[%s][NOOP]\x20%s',_0x1f63a0,utils[_0xf990('0x3')](_0x1dec34[0x0],this));_0x5f1afa['next']();}catch(_0x5f0769){logger['error'](_0xf990('0x4'),_0x1f63a0,JSON[_0xf990('0x5')](_0x5f0769));_0x5f1afa[_0xf990('0x6')]();}};}; \ 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 b203736..fba612f 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 _0x55ca=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','map','join','find','Queues','createQueue','atimeout','rules','end','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0x21b122,_0x4ce262){var _0xebd215=function(_0x4eda63){while(--_0x4eda63){_0x21b122['push'](_0x21b122['shift']());}};_0xebd215(++_0x4ce262);}(_0x55ca,0x126));var _0xa55c=function(_0xdf5fc5,_0x37255b){_0xdf5fc5=_0xdf5fc5-0x0;var _0x52f5a5=_0x55ca[_0xdf5fc5];return _0x52f5a5;};'use strict';var schema=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));var strategy=require(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));var attributes=['id',_0xa55c('0xa'),_0xa55c('0xb'),'queue',_0xa55c('0xc'),_0xa55c('0xd')];function emit(_0x52a3bc,_0x5849ad,_0x473d0e){io['to'](_0x52a3bc)[_0xa55c('0xe')](_0x5849ad,_0x473d0e);}function emitChannelQueueInteraction(_0x381d07,_0x5d8e5a,_0x31646d,_0xe6d826,_0x508342,_0x70c2de,_0x3998f7,_0x15eec8){var _0x5d47ff=_['clone'](_0x31646d);_0x5d47ff[_0xa55c('0xa')]=_0x15eec8;_0x5d47ff['queue']=_0x5d8e5a;_0x5d47ff['account']=_0xe6d826;_0x5d47ff['id']=_0x508342;if(_0x70c2de){_0x3998f7[util['format'](_0xa55c('0xf'),_0x381d07)][_0x508342]=_[_0xa55c('0x10')](_0x5d47ff,attributes);}else{delete _0x3998f7[util[_0xa55c('0x11')](_0xa55c('0xf'),_0x381d07)][_0x508342];}emit(util[_0xa55c('0x11')](_0xa55c('0x12'),_0x381d07,_0x5d8e5a),util['format'](_0xa55c('0x13'),_0x381d07,_0x70c2de?_0xa55c('0x14'):_0xa55c('0x15')),_[_0xa55c('0x10')](_0x5d47ff,attributes));}var rpc={'openchannelQueueReport':require(_0xa55c('0x16')),'mailQueueReport':require(_0xa55c('0x17')),'chatQueueReport':require(_0xa55c('0x18')),'smsQueueReport':require(_0xa55c('0x19')),'faxQueueReport':require(_0xa55c('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa55c('0x1b'),'required':!![],'message':_0xa55c('0x1c')},'timeout':{'type':_0xa55c('0x1d'),'message':_0xa55c('0x1e')}});function startRouting(_0x23a1ae,_0x5426e5,_0x4c0daf,_0x5f5158){if(_0x23a1ae&&_0x5426e5&&_0x4c0daf){_0x5426e5[_0xa55c('0x1f')]+=0x1;var _0x3776ac={'uniqueid':_0x23a1ae,'from':_0x4c0daf[_0xa55c('0x20')]?_0x4c0daf['body'][_0xa55c('0xc')]:'','joinAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c0daf[_0xa55c('0x21')]?_0x4c0daf[_0xa55c('0x21')]['id']:null,'ListId':_0x4c0daf[_0xa55c('0x22')]?_0x4c0daf[_0xa55c('0x22')]['id']:null};_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf['channel'])+_0xa55c('0x24')]=_0x5426e5['id']||null;_0x3776ac[_['upperFirst'](_0x4c0daf['channel'])+'InteractionId']=_0x4c0daf[_0xa55c('0x25')]?_0x4c0daf['interaction']['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+_0xa55c('0x27')]=_0x4c0daf[_0xa55c('0x28')]?_0x4c0daf[_0xa55c('0x28')]['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+(_0x4c0daf[_0xa55c('0x26')]!==_0xa55c('0x29')?_0xa55c('0x2a'):_0xa55c('0x2b'))]=_0x4c0daf['account']?_0x4c0daf[_0xa55c('0xb')]['id']:null;logger[_0xa55c('0x2c')](util[_0xa55c('0x11')](_0xa55c('0x2d'),_0x23a1ae,_0x5426e5['name']));emitChannelQueueInteraction(_0x4c0daf[_0xa55c('0x26')],_0x5426e5[_0xa55c('0x2e')],_0x3776ac,_0x4c0daf[_0xa55c('0xb')][_0xa55c('0x2e')],_0x4c0daf[_0xa55c('0x28')]['id'],!![],_0x5f5158,_0x5426e5['id']);if(rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport']){return rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport'][_0xa55c('0x2f')](_0x3776ac)[_0xa55c('0x30')](function(_0x1cc53e){logger[_0xa55c('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x3d28fb,_0x2096ae,_0x331e58,_0x20da31){if(_0x3d28fb&&_0x2096ae){_0x2096ae[_0xa55c('0x1f')]-=0x1;var _0x1225c3={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'acceptAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'reason':_0xa55c('0x33')};logger['info'](util['format'](_0xa55c('0x34'),_0x3d28fb,_0x2096ae[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x331e58['channel'],_0x2096ae[_0xa55c('0x2e')],_0x331e58[_0xa55c('0x20')],_0x331e58[_0xa55c('0xb')][_0xa55c('0x2e')],_0x331e58[_0xa55c('0x28')]['id'],![],_0x20da31,_0x2096ae['id']);if(rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]){return rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]['update'](_0x3d28fb,_0x1225c3)['catch'](function(_0x4b23d3){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function endRouting(_0x2bb4f0,_0x5802e4,_0x768408,_0x547930){if(_0x2bb4f0&&_0x5802e4){_0x5802e4[_0xa55c('0x1f')]-=0x1;var _0x4ad813={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'exitAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa55c('0x37')};logger[_0xa55c('0x2c')](util['format'](_0xa55c('0x38'),_0x2bb4f0,_0x5802e4[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x768408['channel'],_0x5802e4['name'],_0x768408[_0xa55c('0x20')],_0x768408['account'][_0xa55c('0x2e')],_0x768408[_0xa55c('0x28')]['id'],![],_0x547930);if(rpc[_0x768408['channel']+'QueueReport']){return rpc[_0x768408['channel']+'QueueReport'][_0xa55c('0x39')](_0x2bb4f0,_0x4ad813)[_0xa55c('0x30')](function(_0x429336){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function handleFindQueue(_0x56d17c){return function(_0x3d52d8){return _0x3d52d8[_0xa55c('0x2e')][_0xa55c('0x3a')]()===_0x56d17c[_0xa55c('0x3a')]();};}exports[_0xa55c('0x3b')]=function(_0x23cef5,_0x554620,_0x386e34,_0x5ee63d){return function(_0x57a972){try{var _0x404e7f={'name':_0x554620[0x0],'timeout':_0x554620[0x1]};var _0x1f63d8=queue['validate'](_0x404e7f,{'typecast':!![]});if(_0x1f63d8[_0xa55c('0x3c')]){logger['error']('[%s][QUEUE]\x20%s',_0x23cef5,_[_0xa55c('0x3d')](_0x1f63d8,_0xa55c('0x28'))[_0xa55c('0x3e')](',\x20'));_0x57a972['stop']();}else{var _0x1b2708=_[_0xa55c('0x3f')](_0x386e34[_0x5ee63d['channel']+_0xa55c('0x40')],handleFindQueue(_0x404e7f['name']));if(_0x1b2708){startRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);var _0x39886a=(_0x1b2708[_0xa55c('0x37')]||0xa)*0x3e8;var _0x5be43f=(_0x404e7f[_0xa55c('0x37')]||0x14)*0x3e8;var _0x1dae70,_0x5d834d;if(_0x39886a>_0x5be43f){_0x5be43f=_0x39886a;}var _0x40c352=seqqueue[_0xa55c('0x41')](_0x39886a);_0x40c352['id']=_0x23cef5;_0x40c352[_0xa55c('0x42')]=_0x39886a;_0x40c352['qtimeout']=_0x5be43f;_0x40c352[_0xa55c('0x26')]=_0x5ee63d['channel'];_0x386e34[_0xa55c('0x43')][_0x23cef5]['on'](_0xa55c('0x44'),function(){logger[_0xa55c('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x23cef5);stopRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x1dae70=undefined;_0x40c352[_0xa55c('0x45')](!![]);if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34['rules'][_0x23cef5];}_0x57a972[_0xa55c('0x46')]();});_0x386e34[_0xa55c('0x43')][_0x23cef5]['on']('complete',function(){if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34[_0xa55c('0x43')][_0x23cef5];}});_0x1dae70=setTimeout(function(){logger['info'](_0xa55c('0x47'),_0x23cef5);endRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x40c352[_0xa55c('0x45')](!![]);_0x57a972[_0xa55c('0x48')]();},_0x5be43f);switch(_0x1b2708[_0xa55c('0x49')]){case'rrmemory':strategy[_0xa55c('0x4a')](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);break;default:strategy['beepall'](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);}}else{logger[_0xa55c('0x31')](_0xa55c('0x4b'),_0x23cef5,_0x404e7f[_0xa55c('0x2e')]);_0x57a972['stop']();}}}catch(_0x39bd3d){console[_0xa55c('0x4c')](_0x39bd3d);logger['error'](_0xa55c('0x4d'),_0x23cef5,_0x39bd3d[_0xa55c('0x4e')]);_0x57a972[_0xa55c('0x46')]();}};}; \ No newline at end of file +var _0x9c44=['[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','atimeout','rules','end','close','complete','next','strategy','rrmemory','beepall','log','stack','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','QueueId','upperFirst','channel','InteractionId','message','AccountId','info','name','QueueReport','create','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','update\x20queue\x20report','timeout'];(function(_0x56e0e8,_0x16ef91){var _0x2dab50=function(_0x4fe720){while(--_0x4fe720){_0x56e0e8['push'](_0x56e0e8['shift']());}};_0x2dab50(++_0x16ef91);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x49c4('0x0'));var seqqueue=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var config=require(_0x49c4('0x4'));var logger=require(_0x49c4('0x5'))('routing');var strategy=require('./strategy');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));var attributes=['id',_0x49c4('0x9'),'account',_0x49c4('0xa'),_0x49c4('0xb'),_0x49c4('0xc')];function emit(_0x4487ca,_0x4c7d3a,_0x5ab4a3){io['to'](_0x4487ca)[_0x49c4('0xd')](_0x4c7d3a,_0x5ab4a3);}function emitChannelQueueInteraction(_0x313e73,_0x58cad7,_0xb611a1,_0x459d09,_0x4adb3c,_0x536d42,_0x1d19bf,_0x6d1b08){var _0x5487cd=_[_0x49c4('0xe')](_0xb611a1);_0x5487cd[_0x49c4('0x9')]=_0x6d1b08;_0x5487cd['queue']=_0x58cad7;_0x5487cd[_0x49c4('0xf')]=_0x459d09;_0x5487cd['id']=_0x4adb3c;if(_0x536d42){_0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c]=_[_0x49c4('0x12')](_0x5487cd,attributes);}else{delete _0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c];}emit(util[_0x49c4('0x10')](_0x49c4('0x13'),_0x313e73,_0x58cad7),util['format'](_0x49c4('0x14'),_0x313e73,_0x536d42?_0x49c4('0x15'):_0x49c4('0x16')),_[_0x49c4('0x12')](_0x5487cd,attributes));}var rpc={'openchannelQueueReport':require(_0x49c4('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x49c4('0x18')),'smsQueueReport':require(_0x49c4('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x49c4('0x1a'),'required':!![],'message':_0x49c4('0x1b')},'timeout':{'type':_0x49c4('0x1c'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x24856d,_0x50b151,_0x2cbd50,_0x1806c2){if(_0x24856d&&_0x50b151&&_0x2cbd50){_0x50b151[_0x49c4('0x1d')]+=0x1;var _0x291526={'uniqueid':_0x24856d,'from':_0x2cbd50[_0x49c4('0x1e')]?_0x2cbd50[_0x49c4('0x1e')][_0x49c4('0xb')]:'','joinAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'ContactId':_0x2cbd50['contact']?_0x2cbd50['contact']['id']:null,'ListId':_0x2cbd50['list']?_0x2cbd50[_0x49c4('0x20')]['id']:null};_0x291526[_['upperFirst'](_0x2cbd50['channel'])+_0x49c4('0x21')]=_0x50b151['id']||null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+_0x49c4('0x24')]=_0x2cbd50['interaction']?_0x2cbd50['interaction']['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+'MessageId']=_0x2cbd50[_0x49c4('0x25')]?_0x2cbd50[_0x49c4('0x25')]['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+(_0x2cbd50['channel']!=='chat'?_0x49c4('0x26'):'WebsiteId')]=_0x2cbd50[_0x49c4('0xf')]?_0x2cbd50[_0x49c4('0xf')]['id']:null;logger[_0x49c4('0x27')](util[_0x49c4('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x24856d,_0x50b151[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2cbd50[_0x49c4('0x23')],_0x50b151[_0x49c4('0x28')],_0x291526,_0x2cbd50[_0x49c4('0xf')][_0x49c4('0x28')],_0x2cbd50[_0x49c4('0x25')]['id'],!![],_0x1806c2,_0x50b151['id']);if(rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2a')](_0x291526)['catch'](function(_0x4f4495){logger['error'](_0x49c4('0x2b'));});}}}function stopRouting(_0x7ee704,_0x1eb035,_0x27e467,_0x28eb47){if(_0x7ee704&&_0x1eb035){_0x1eb035['waiting']-=0x1;var _0x38ad77={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'acceptAt':moment()[_0x49c4('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x49c4('0x27')](util[_0x49c4('0x10')](_0x49c4('0x2c'),_0x7ee704,_0x1eb035[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x27e467[_0x49c4('0x23')],_0x1eb035['name'],_0x27e467[_0x49c4('0x1e')],_0x27e467[_0x49c4('0xf')][_0x49c4('0x28')],_0x27e467['message']['id'],![],_0x28eb47,_0x1eb035['id']);if(rpc[_0x27e467['channel']+_0x49c4('0x29')]){return rpc[_0x27e467[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2d')](_0x7ee704,_0x38ad77)[_0x49c4('0x2e')](function(_0x2cf897){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function endRouting(_0x3209cd,_0x4e0209,_0x2d34ca,_0x5b96df){if(_0x3209cd&&_0x4e0209){_0x4e0209[_0x49c4('0x1d')]-=0x1;var _0x349791={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'exitAt':moment()['format'](_0x49c4('0x1f')),'reason':_0x49c4('0x31')};logger[_0x49c4('0x27')](util['format'](_0x49c4('0x32'),_0x3209cd,_0x4e0209[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2d34ca[_0x49c4('0x23')],_0x4e0209[_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x1e')],_0x2d34ca[_0x49c4('0xf')][_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x25')]['id'],![],_0x5b96df);if(rpc[_0x2d34ca[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2d34ca[_0x49c4('0x23')]+'QueueReport'][_0x49c4('0x2d')](_0x3209cd,_0x349791)[_0x49c4('0x2e')](function(_0x32b172){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function handleFindQueue(_0x29dd5d){return function(_0x1be62d){return _0x1be62d[_0x49c4('0x28')][_0x49c4('0x33')]()===_0x29dd5d[_0x49c4('0x33')]();};}exports[_0x49c4('0x34')]=function(_0xa3d59e,_0x326142,_0x4e38bc,_0x212366){return function(_0x49829e){try{var _0x104efb={'name':_0x326142[0x0],'timeout':_0x326142[0x1]};var _0x4915bc=queue[_0x49c4('0x35')](_0x104efb,{'typecast':!![]});if(_0x4915bc[_0x49c4('0x36')]){logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_['map'](_0x4915bc,'message')[_0x49c4('0x38')](',\x20'));_0x49829e[_0x49c4('0x39')]();}else{var _0x38349b=_[_0x49c4('0x3a')](_0x4e38bc[_0x212366['channel']+_0x49c4('0x3b')],handleFindQueue(_0x104efb[_0x49c4('0x28')]));if(_0x38349b){startRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);var _0x2ccd47=(_0x38349b[_0x49c4('0x31')]||0xa)*0x3e8;var _0x81a674=(_0x104efb[_0x49c4('0x31')]||0x14)*0x3e8;var _0x1a9593,_0x3351c1;if(_0x2ccd47>_0x81a674){_0x81a674=_0x2ccd47;}var _0x3c4a1d=seqqueue['createQueue'](_0x2ccd47);_0x3c4a1d['id']=_0xa3d59e;_0x3c4a1d[_0x49c4('0x3c')]=_0x2ccd47;_0x3c4a1d['qtimeout']=_0x81a674;_0x3c4a1d[_0x49c4('0x23')]=_0x212366[_0x49c4('0x23')];_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x3e'),function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xa3d59e);stopRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x1a9593=undefined;_0x3c4a1d[_0x49c4('0x3f')](!![]);if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc[_0x49c4('0x3d')][_0xa3d59e];}_0x49829e[_0x49c4('0x39')]();});_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x40'),function(){if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc['rules'][_0xa3d59e];}});_0x1a9593=setTimeout(function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20APPLICATION\x20END',_0xa3d59e);endRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x3c4a1d[_0x49c4('0x3f')](!![]);_0x49829e[_0x49c4('0x41')]();},_0x81a674);switch(_0x38349b[_0x49c4('0x42')]){case _0x49c4('0x43'):strategy[_0x49c4('0x43')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);break;default:strategy[_0x49c4('0x44')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);}}else{logger[_0x49c4('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xa3d59e,_0x104efb[_0x49c4('0x28')]);_0x49829e[_0x49c4('0x39')]();}}}catch(_0x4a5c34){console[_0x49c4('0x45')](_0x4a5c34);logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_0x4a5c34[_0x49c4('0x46')]);_0x49829e['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 9878cac..6d8bab2 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 _0x83b1=['routing','notificationId','squeue','realtime','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','info','agent','forcedOwnership','agents','channel','busy','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','exports','lodash','./util','../../../../../config/logger'];(function(_0x7c8786,_0xe0dc5e){var _0x269380=function(_0x15b204){while(--_0x15b204){_0x7c8786['push'](_0x7c8786['shift']());}};_0x269380(++_0xe0dc5e);}(_0x83b1,0x98));var _0x183b=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x83b1[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x183b('0x0'));var uuid=require('uuid');var util=require(_0x183b('0x1'));var logger=require(_0x183b('0x2'))(_0x183b('0x3'));var Agent=function(_0x1e3d71,_0x2fb48b,_0x235a2c,_0x534cd1){this[_0x183b('0x4')]=uuid['v4']();this[_0x183b('0x5')]=_0x1e3d71;this['agent']=_0x2fb48b;this[_0x183b('0x6')]=_0x235a2c;this[_0x183b('0x3')]=_0x534cd1;this[_0x183b('0x5')][_0x183b('0x7')](this[_0x183b('0x8')]['bind'](this),this[_0x183b('0x9')][_0x183b('0xa')](this));this[_0x183b('0x5')]['on'](_0x183b('0xb'),this['handleTimeout'][_0x183b('0xa')](this));this[_0x183b('0x5')]['on'](_0x183b('0xc'),this[_0x183b('0xd')]['bind'](this));};Agent[_0x183b('0xe')][_0x183b('0x7')]=function(){this[_0x183b('0x5')]['push'](this[_0x183b('0x8')][_0x183b('0xa')](this),this['handleTimeout'][_0x183b('0xa')](this));};Agent['prototype']['handleDrained']=function(){this[_0x183b('0x9')](!![]);};Agent[_0x183b('0xe')]['handleRun']=function(_0x3c8e77){logger[_0x183b('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this['agent']['id']);if(_['isNil'](this[_0x183b('0x6')]['agents'][this[_0x183b('0x10')]['id']])){logger[_0x183b('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x183b('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x183b('0x7')][_0x183b('0xa')](this),0x3e8);}else{if(this[_0x183b('0x3')][_0x183b('0x11')]||util['isAgentAvailable'](this[_0x183b('0x5')]['id'],this[_0x183b('0x6')][_0x183b('0x12')][this[_0x183b('0x10')]['id']],this[_0x183b('0x5')][_0x183b('0x13')],![])){this[_0x183b('0x6')]['agents'][this[_0x183b('0x10')]['id']][_0x183b('0x14')]=!![];this['realtime'][_0x183b('0x12')][this[_0x183b('0x10')]['id']][_0x183b('0x15')]=undefined;util['showNotification'](this[_0x183b('0x4')],this[_0x183b('0x5')]['id'],this['realtime'][_0x183b('0x12')][this['agent']['id']],null,this[_0x183b('0x3')]);util[_0x183b('0x16')](this[_0x183b('0x5')]['id'],this[_0x183b('0x6')][_0x183b('0x12')][this[_0x183b('0x10')]['id']],_0x183b('0x17')+(this[_0x183b('0x3')]['forcedOwnership']?_0x183b('0x18'):''));}else{logger['info'](_0x183b('0x19'),this[_0x183b('0x5')]['id'],this[_0x183b('0x10')]['id']);setTimeout(this[_0x183b('0x7')]['bind'](this),0x3e8);}}};Agent[_0x183b('0xe')][_0x183b('0x9')]=function(_0x5b2609){if(_['isNil'](this[_0x183b('0x6')][_0x183b('0x12')][this[_0x183b('0x10')]['id']])){return logger['info'](_0x183b('0x1a'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x183b('0xf')](_0x183b('0x1b'),this[_0x183b('0x5')]['id'],this['agent']['id']);util[_0x183b('0x1c')](this[_0x183b('0x4')],this[_0x183b('0x5')]['id'],this[_0x183b('0x6')][_0x183b('0x12')][this[_0x183b('0x10')]['id']],null,this[_0x183b('0x3')]);this[_0x183b('0x6')][_0x183b('0x12')][this[_0x183b('0x10')]['id']][_0x183b('0x14')]=![];this['realtime'][_0x183b('0x12')][this[_0x183b('0x10')]['id']]['busyQueue']=undefined;util[_0x183b('0x16')](this[_0x183b('0x5')]['id'],this['realtime'][_0x183b('0x12')][this[_0x183b('0x10')]['id']],_0x5b2609?_0x183b('0x1d'):'TIMEOUT');}if(!_0x5b2609){setTimeout(this[_0x183b('0x7')][_0x183b('0xa')](this),0x3e8);}};function agent(_0x167d4a,_0x488168,_0x927d07,_0x367690){return new Agent(_0x167d4a,_0x488168,_0x927d07,_0x367690);}module[_0x183b('0x1e')]=agent; \ No newline at end of file +var _0xebf3=['notificationId','writeLog','RINGING','isNil','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','showNotification'];(function(_0x10ac54,_0x32120e){var _0x2723cc=function(_0x3edb4d){while(--_0x3edb4d){_0x10ac54['push'](_0x10ac54['shift']());}};_0x2723cc(++_0x32120e);}(_0xebf3,0x114));var _0x3ebf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xebf3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3ebf('0x0'));var uuid=require(_0x3ebf('0x1'));var util=require(_0x3ebf('0x2'));var logger=require(_0x3ebf('0x3'))(_0x3ebf('0x4'));var Agent=function(_0x5ef09b,_0x46b69c,_0x334be6,_0x219c40){this['notificationId']=uuid['v4']();this[_0x3ebf('0x5')]=_0x5ef09b;this[_0x3ebf('0x6')]=_0x46b69c;this[_0x3ebf('0x7')]=_0x334be6;this[_0x3ebf('0x4')]=_0x219c40;this[_0x3ebf('0x5')][_0x3ebf('0x8')](this[_0x3ebf('0x9')][_0x3ebf('0xa')](this),this[_0x3ebf('0xb')]['bind'](this));this[_0x3ebf('0x5')]['on'](_0x3ebf('0xc'),this[_0x3ebf('0xb')][_0x3ebf('0xa')](this));this[_0x3ebf('0x5')]['on']('drained',this['handleDrained']['bind'](this));};Agent['prototype'][_0x3ebf('0x8')]=function(){this[_0x3ebf('0x5')][_0x3ebf('0x8')](this['handleRun'][_0x3ebf('0xa')](this),this[_0x3ebf('0xb')][_0x3ebf('0xa')](this));};Agent[_0x3ebf('0xd')][_0x3ebf('0xe')]=function(){this[_0x3ebf('0xb')](!![]);};Agent[_0x3ebf('0xd')][_0x3ebf('0x9')]=function(_0x23150c){logger[_0x3ebf('0xf')](_0x3ebf('0x10'),this[_0x3ebf('0x5')]['id'],this[_0x3ebf('0x6')]['id']);if(_['isNil'](this[_0x3ebf('0x7')][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']])){logger[_0x3ebf('0xf')](_0x3ebf('0x12'),this[_0x3ebf('0x5')]['id'],this[_0x3ebf('0x6')]['id']);setTimeout(this[_0x3ebf('0x8')][_0x3ebf('0xa')](this),0x3e8);}else{if(this[_0x3ebf('0x4')][_0x3ebf('0x13')]||util['isAgentAvailable'](this[_0x3ebf('0x5')]['id'],this['realtime'][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']],this[_0x3ebf('0x5')][_0x3ebf('0x14')],![])){this['realtime'][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']][_0x3ebf('0x15')]=!![];this[_0x3ebf('0x7')][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']][_0x3ebf('0x16')]=undefined;util[_0x3ebf('0x17')](this[_0x3ebf('0x18')],this['squeue']['id'],this[_0x3ebf('0x7')]['agents'][this['agent']['id']],null,this[_0x3ebf('0x4')]);util[_0x3ebf('0x19')](this[_0x3ebf('0x5')]['id'],this['realtime']['agents'][this[_0x3ebf('0x6')]['id']],_0x3ebf('0x1a')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger[_0x3ebf('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x3ebf('0x6')]['id']);setTimeout(this[_0x3ebf('0x8')][_0x3ebf('0xa')](this),0x3e8);}}};Agent['prototype'][_0x3ebf('0xb')]=function(_0x2c9926){if(_[_0x3ebf('0x1b')](this[_0x3ebf('0x7')][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3ebf('0x5')]['id'],this[_0x3ebf('0x6')]['id']);}else{logger[_0x3ebf('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x3ebf('0x5')]['id'],this[_0x3ebf('0x6')]['id']);util['hideNotification'](this[_0x3ebf('0x18')],this[_0x3ebf('0x5')]['id'],this[_0x3ebf('0x7')][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']],null,this['routing']);this[_0x3ebf('0x7')][_0x3ebf('0x11')][this['agent']['id']][_0x3ebf('0x15')]=![];this['realtime'][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']][_0x3ebf('0x16')]=undefined;util['writeLog'](this[_0x3ebf('0x5')]['id'],this[_0x3ebf('0x7')][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']],_0x2c9926?_0x3ebf('0x1c'):_0x3ebf('0x1d'));}if(!_0x2c9926){setTimeout(this[_0x3ebf('0x8')][_0x3ebf('0xa')](this),0x3e8);}};function agent(_0xcfcc01,_0xd173bf,_0xce218b,_0x576445){return new Agent(_0xcfcc01,_0xd173bf,_0xce218b,_0x576445);}module['exports']=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 681079f..68b13ee 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 _0x7125=['busyQueue','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','writeLog','STOP','TIMEOUT','busy','exports','lodash','./util','../../../../../config/logger','routing','notificationId','queue','realtime','push','handleTimeout','bind','squeue','timeout','drained','handleDrained','prototype','handleRun','isNil','length','Agents','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING'];(function(_0xb65c08,_0x11afe4){var _0xa073fe=function(_0x3f8c48){while(--_0x3f8c48){_0xb65c08['push'](_0xb65c08['shift']());}};_0xa073fe(++_0x11afe4);}(_0x7125,0x91));var _0x5712=function(_0x4effc0,_0x111999){_0x4effc0=_0x4effc0-0x0;var _0x1f432c=_0x7125[_0x4effc0];return _0x1f432c;};'use strict';var _=require(_0x5712('0x0'));var uuid=require('uuid');var util=require(_0x5712('0x1'));var logger=require(_0x5712('0x2'))(_0x5712('0x3'));var Beepall=function(_0x3ae779,_0x429e51,_0x5a29de,_0x2b72b5){this[_0x5712('0x4')]=uuid['v4']();this['squeue']=_0x3ae779;this[_0x5712('0x5')]=_0x429e51;this[_0x5712('0x6')]=_0x5a29de;this[_0x5712('0x3')]=_0x2b72b5;this['squeue'][_0x5712('0x7')](this['handleRun']['bind'](this),this[_0x5712('0x8')][_0x5712('0x9')](this));this[_0x5712('0xa')]['on'](_0x5712('0xb'),this[_0x5712('0x8')][_0x5712('0x9')](this));this[_0x5712('0xa')]['on'](_0x5712('0xc'),this[_0x5712('0xd')][_0x5712('0x9')](this));};Beepall[_0x5712('0xe')][_0x5712('0x7')]=function(){this[_0x5712('0xa')][_0x5712('0x7')](this[_0x5712('0xf')][_0x5712('0x9')](this),this[_0x5712('0x8')][_0x5712('0x9')](this));};Beepall[_0x5712('0xe')]['handleDrained']=function(_0x1c7f0f){this['handleTimeout'](!![]);};Beepall['prototype'][_0x5712('0xf')]=function(_0x417a38){var _0x358014=!![];if(!_[_0x5712('0x10')](this['queue'])&&!_[_0x5712('0x10')](this[_0x5712('0x5')]['Agents'])&&this[_0x5712('0x5')]['Agents'][_0x5712('0x11')]>0x0){for(var _0x434b4b=0x0,_0x42dacf;_0x434b4b0x0){for(var _0x345929=0x0,_0x4ac93e;_0x3459290x0&&_0x480c6e[_0x41112c+_0x66db('0x26')]>=_0x480c6e[_0x41112c+_0x66db('0x25')]){writeLog(_0x4a73ee,_0x480c6e,_0x41112c[_0x66db('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x267e1d,_0x55f254,_0x3146a4,_0x537c77,_0x466aba){return sendNotification(!![],_0x267e1d,_0x55f254,_0x3146a4,_0x537c77,_0x466aba);};exports[_0x66db('0x28')]=function(_0x5cef62,_0x300c06,_0x2976bb,_0x3da3b8,_0x3cfca5){return sendNotification(![],_0x5cef62,_0x300c06,_0x2976bb,_0x3da3b8,_0x3cfca5);};exports[_0x66db('0x29')]=writeLog; \ No newline at end of file +var _0x5cfa=['[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','hideNotification','lodash','../utils','defaults','redis','socket.io-emitter','emit','user:%s','user:save','split','name','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','format','notification:%s','remove','info'];(function(_0xad2449,_0x56f3be){var _0x143a4c=function(_0x109886){while(--_0x109886){_0xad2449['push'](_0xad2449['shift']());}};_0x143a4c(++_0x56f3be);}(_0x5cfa,0x12b));var _0xa5cf=function(_0x2f7fce,_0x4cbb5c){_0x2f7fce=_0x2f7fce-0x0;var _0x2df10b=_0x5cfa[_0x2f7fce];return _0x2df10b;};'use strict';var _=require(_0xa5cf('0x0'));var util=require('util');var utils=require(_0xa5cf('0x1'));var Mustache=require('mustache');var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')('routing');config['redis']=_[_0xa5cf('0x2')](config[_0xa5cf('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xa5cf('0x4'))(new Redis(config[_0xa5cf('0x3')]));function emit(_0x1d106f,_0x52e32c,_0x3b107a){io['to'](_0x1d106f)[_0xa5cf('0x5')](_0x52e32c,_0x3b107a);}function sendNotification(_0x3e7b02,_0x2a6ee8,_0x22b435,_0x482025,_0x451bca,_0x2a7ca4){io['to'](util['format'](_0xa5cf('0x6'),_0x482025['name']))[_0xa5cf('0x5')](_0xa5cf('0x7'),_0x482025);var _0x437268=_0x2a7ca4||{};var _0x533e1c=_0x22b435[_0xa5cf('0x8')]('.');var _0x31e07f={'uniqueid':_0x2a6ee8,'channel':_0x533e1c[0x0],'id':_0x533e1c[0x1],'title':_0x533e1c[0x0]+'\x20interaction','interactionId':_0x533e1c[0x2],'queue':_0x451bca?_0x451bca[_0xa5cf('0x9')]:null,'sound':_0x437268[_0xa5cf('0xa')][_0xa5cf('0xb')],'shake':_0x437268[_0xa5cf('0xa')][_0xa5cf('0xc')]};try{if(!_0x437268['body']){_0x437268['body']={};}if(_0x451bca){_0x437268[_0xa5cf('0xd')][_0xa5cf('0xe')]=_0x451bca;}else if(_0x437268['body'][_0xa5cf('0xe')]){delete _0x437268['body'][_0xa5cf('0xe')];}_0x31e07f['msg']=utils[_0xa5cf('0xf')](_0x437268[_0xa5cf('0xa')][_0xa5cf('0x10')],_0x437268);}catch(_0x4c3db5){_0x31e07f[_0xa5cf('0x11')]=_0xa5cf('0x12');logger['error'](util['format'](_0xa5cf('0x13'),_0x2a6ee8,_0x4c3db5[_0xa5cf('0x14')]));}io['to'](util['format'](_0xa5cf('0x6'),_0x482025['name']))[_0xa5cf('0x5')](util[_0xa5cf('0x15')](_0xa5cf('0x16'),_0x3e7b02?'save':_0xa5cf('0x17')),_0x31e07f);}function writeLog(_0x28a755,_0x481ba3,_0xdca3e0){return logger[_0xa5cf('0x18')](util[_0xa5cf('0x15')](_0xa5cf('0x19'),_0x28a755,_0x481ba3['name'],_0xdca3e0));}exports[_0xa5cf('0x1a')]=function(_0x537b9c,_0x18f0c6,_0x281ed3,_0x5a6cca){if(_0x18f0c6[_0xa5cf('0x1b')]){writeLog(_0x537b9c,_0x18f0c6,_0xa5cf('0x1c'));return![];}if(!_0x18f0c6['online']){writeLog(_0x537b9c,_0x18f0c6,_0xa5cf('0x1d'));return![];}if(_0x18f0c6[_0x281ed3+_0xa5cf('0x1e')]){writeLog(_0x537b9c,_0x18f0c6,'PAUSE');return![];}if(_0x5a6cca&&_0x18f0c6['hasOwnProperty'](_0x281ed3+'Capacity')&&_0x18f0c6['hasOwnProperty'](_0x281ed3+_0xa5cf('0x1f'))){if(_0x18f0c6[_0x281ed3+_0xa5cf('0x20')]>0x0&&_0x18f0c6[_0x281ed3+_0xa5cf('0x1f')]>=_0x18f0c6[_0x281ed3+'Capacity']){writeLog(_0x537b9c,_0x18f0c6,_0x281ed3[_0xa5cf('0x21')]()+_0xa5cf('0x22'));return![];}}return!![];};exports['showNotification']=function(_0x550241,_0x2688b5,_0x116f03,_0x24f3c8,_0x38420d){return sendNotification(!![],_0x550241,_0x2688b5,_0x116f03,_0x24f3c8,_0x38420d);};exports[_0xa5cf('0x23')]=function(_0x38b80b,_0x34ead8,_0xa4b703,_0x188de8,_0x279197){return sendNotification(![],_0x38b80b,_0x34ead8,_0xa4b703,_0x188de8,_0x279197);};exports['writeLog']=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 5f2c786..2546609 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 _0x66bb=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info'];(function(_0x3ed054,_0x4d4f16){var _0x16dd95=function(_0xc0c19c){while(--_0xc0c19c){_0x3ed054['push'](_0x3ed054['shift']());}};_0x16dd95(++_0x4d4f16);}(_0x66bb,0x102));var _0xb66b=function(_0x15d8b4,_0x26c85e){_0x15d8b4=_0x15d8b4-0x0;var _0x374bf4=_0x66bb[_0x15d8b4];return _0x374bf4;};'use strict';var schema=require('validate');var sh=require(_0xb66b('0x0'));var _=require(_0xb66b('0x1'));var utils=require(_0xb66b('0x2'));var logger=require(_0xb66b('0x3'))(_0xb66b('0x4'));var system=schema({'command':{'type':_0xb66b('0x5'),'required':!![],'message':_0xb66b('0x6')}});exports[_0xb66b('0x7')]=function(_0x4d91d3,_0x199473){return function(_0x3795e3){try{var _0x30b18d={'command':_0x199473[0x0]};var _0x23cde1=system[_0xb66b('0x8')](_0x30b18d,{'typecast':!![]});if(_0x23cde1[_0xb66b('0x9')]){logger[_0xb66b('0xa')](_0xb66b('0xb'),_0x4d91d3,_[_0xb66b('0xc')](_0x23cde1,_0xb66b('0xd'))['join'](',\x20'));logger['info'](_0xb66b('0xe'),_0x4d91d3);_0x3795e3[_0xb66b('0xf')]();}else{var _0x183742=this;var _0x211b27=utils['getMustacheRender'](_0x199473[0x0],this);logger[_0xb66b('0x10')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x4d91d3,_0x211b27);sh['exec'](_[_0xb66b('0x11')](_0x211b27),function(_0x50a801,_0x3d072f){logger['info'](_0xb66b('0x12'),_0x4d91d3,_0x50a801);if(_0x50a801==0x0){var _0x28b3b5=_0x3d072f[_0xb66b('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xb66b('0x14')](_0x199473[0x1])||_['isEmpty'](_0x199473[0x1])){logger[_0xb66b('0x10')](_0xb66b('0x15'),_0x4d91d3);_0x183742[_0xb66b('0x16')][_0x199473[0x1]]=_0x28b3b5;}else{logger['info'](_0xb66b('0x17'),_0x4d91d3,_0x199473[0x1],_0x28b3b5);_0x183742['body'][_0x199473[0x1]]=_0x28b3b5;}}_0x3795e3[_0xb66b('0xf')]();});}}catch(_0x4c8634){logger[_0xb66b('0xa')](_0xb66b('0xb'),_0x4d91d3,_['isObject'](_0x4c8634)?JSON[_0xb66b('0x18')](_0x4c8634):_0x4c8634);logger[_0xb66b('0x10')](_0xb66b('0xe'),_0x4d91d3);_0x3795e3[_0xb66b('0xf')]();}};}; \ No newline at end of file +var _0x232a=['body','error','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable'];(function(_0xa2f9f6,_0x246de1){var _0x51fc05=function(_0x42be7c){while(--_0x42be7c){_0xa2f9f6['push'](_0xa2f9f6['shift']());}};_0x51fc05(++_0x246de1);}(_0x232a,0x1b5));var _0xa232=function(_0x40cb32,_0x4e63e5){_0x40cb32=_0x40cb32-0x0;var _0x199ef2=_0x232a[_0x40cb32];return _0x199ef2;};'use strict';var schema=require(_0xa232('0x0'));var sh=require(_0xa232('0x1'));var _=require('lodash');var utils=require(_0xa232('0x2'));var logger=require(_0xa232('0x3'))(_0xa232('0x4'));var system=schema({'command':{'type':_0xa232('0x5'),'required':!![],'message':_0xa232('0x6')}});exports[_0xa232('0x7')]=function(_0x2fd571,_0x22fbd0){return function(_0x455fcc){try{var _0x90bf78={'command':_0x22fbd0[0x0]};var _0x56268a=system[_0xa232('0x0')](_0x90bf78,{'typecast':!![]});if(_0x56268a[_0xa232('0x8')]){logger['error'](_0xa232('0x9'),_0x2fd571,_[_0xa232('0xa')](_0x56268a,_0xa232('0xb'))[_0xa232('0xc')](',\x20'));logger[_0xa232('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2fd571);_0x455fcc[_0xa232('0xe')]();}else{var _0x1ffb10=this;var _0x46e9a7=utils['getMustacheRender'](_0x22fbd0[0x0],this);logger[_0xa232('0xd')](_0xa232('0xf'),_0x2fd571,_0x46e9a7);sh[_0xa232('0x10')](_[_0xa232('0x11')](_0x46e9a7),function(_0x453e2e,_0x19f6dc){logger['info'](_0xa232('0x12'),_0x2fd571,_0x453e2e);if(_0x453e2e==0x0){var _0x588274=_0x19f6dc['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xa232('0x13')](_0x22fbd0[0x1])||_[_0xa232('0x14')](_0x22fbd0[0x1])){logger[_0xa232('0xd')](_0xa232('0x15'),_0x2fd571);_0x1ffb10[_0xa232('0x16')][_0x22fbd0[0x1]]=_0x588274;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2fd571,_0x22fbd0[0x1],_0x588274);_0x1ffb10['body'][_0x22fbd0[0x1]]=_0x588274;}}_0x455fcc[_0xa232('0xe')]();});}}catch(_0x556cb7){logger[_0xa232('0x17')](_0xa232('0x9'),_0x2fd571,_[_0xa232('0x18')](_0x556cb7)?JSON[_0xa232('0x19')](_0x556cb7):_0x556cb7);logger[_0xa232('0xd')](_0xa232('0x1a'),_0x2fd571);_0x455fcc[_0xa232('0xe')]();}};}; \ 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 872813e..41f87cf 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 _0x60ac=['info','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','consequence','length','[%s][TAG]\x20%s','map','message','join','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','isObject'];(function(_0x5e6fe1,_0x8f80ad){var _0x5a6018=function(_0x1f1225){while(--_0x1f1225){_0x5e6fe1['push'](_0x5e6fe1['shift']());}};_0x5a6018(++_0x8f80ad);}(_0x60ac,0xe1));var _0xc60a=function(_0x4939b7,_0x24bdc5){_0x4939b7=_0x4939b7-0x0;var _0x548128=_0x60ac[_0x4939b7];return _0x548128;};'use strict';var schema=require(_0xc60a('0x0'));var _=require(_0xc60a('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xc60a('0x2')),'smsInteraction':require(_0xc60a('0x3')),'mailInteraction':require(_0xc60a('0x4')),'faxInteraction':require(_0xc60a('0x5')),'whatsappInteraction':require(_0xc60a('0x6'))};var logger=require('../../../../config/logger')(_0xc60a('0x7'));var tag=schema({'tag':{'type':_0xc60a('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xc60a('0x9')]=function(_0x5d6252,_0x586046,_0x30dda6,_0x5e6240){return function(_0x7399e8){try{var _0x21c60e={'tag':_0x586046[0x0]};var _0x497196=tag[_0xc60a('0x0')](_0x21c60e,{'typecast':!![]});if(_0x497196[_0xc60a('0xa')]){logger['error'](_0xc60a('0xb'),_0x5d6252,_[_0xc60a('0xc')](_0x497196,_0xc60a('0xd'))[_0xc60a('0xe')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5d6252);_0x7399e8['next']();}else{var _0x29fae4={'ids':[_0x586046[0x0]]};if(rpc[_0x5e6240[_0xc60a('0xf')]+'Interaction']){rpc[_0x5e6240['channel']+_0xc60a('0x10')][_0xc60a('0x11')](_0x5e6240[_0xc60a('0x12')]['id'],_0x29fae4)[_0xc60a('0x13')](function(_0x1f8c29){logger['info'](_0xc60a('0x14'),_0x5d6252,_0x586046[0x1],_0x5e6240[_0xc60a('0xf')],_0x5e6240[_0xc60a('0x12')]['id']);})[_0xc60a('0x15')](function(_0x50b41d){logger[_0xc60a('0x16')](_0xc60a('0xb'),_0x5d6252,JSON[_0xc60a('0x17')](_0x50b41d));logger['info'](_0xc60a('0x18'),_0x5d6252);})['finally'](function(){_0x7399e8[_0xc60a('0x19')]();});}}}catch(_0x162611){logger['error']('[%s][TAG]\x20%s',_0x5d6252,_[_0xc60a('0x1a')](_0x162611)?JSON[_0xc60a('0x17')](_0x162611):_0x162611);logger[_0xc60a('0x1b')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5d6252);_0x7399e8['next']();}};}; \ No newline at end of file +var _0xe4ad=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','info','finally','next','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x571573,_0x2442e4){var _0x1b6bce=function(_0x2ed7c6){while(--_0x2ed7c6){_0x571573['push'](_0x571573['shift']());}};_0x1b6bce(++_0x2442e4);}(_0xe4ad,0x192));var _0xde4a=function(_0x4936a6,_0x201849){_0x4936a6=_0x4936a6-0x0;var _0x331100=_0xe4ad[_0x4936a6];return _0x331100;};'use strict';var schema=require(_0xde4a('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xde4a('0x1')),'openchannelInteraction':require(_0xde4a('0x2')),'smsInteraction':require(_0xde4a('0x3')),'mailInteraction':require(_0xde4a('0x4')),'faxInteraction':require(_0xde4a('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xde4a('0x6'))('routing');var tag=schema({'tag':{'type':_0xde4a('0x7'),'required':!![],'message':_0xde4a('0x8')}});exports[_0xde4a('0x9')]=function(_0x3dcefd,_0x4b067e,_0x55a28c,_0x1f2c3e){return function(_0x254053){try{var _0x164a3d={'tag':_0x4b067e[0x0]};var _0x53b521=tag[_0xde4a('0x0')](_0x164a3d,{'typecast':!![]});if(_0x53b521[_0xde4a('0xa')]){logger[_0xde4a('0xb')]('[%s][TAG]\x20%s',_0x3dcefd,_[_0xde4a('0xc')](_0x53b521,_0xde4a('0xd'))[_0xde4a('0xe')](',\x20'));logger['info'](_0xde4a('0xf'),_0x3dcefd);_0x254053['next']();}else{var _0x28ada7={'ids':[_0x4b067e[0x0]]};if(rpc[_0x1f2c3e[_0xde4a('0x10')]+_0xde4a('0x11')]){rpc[_0x1f2c3e[_0xde4a('0x10')]+'Interaction'][_0xde4a('0x12')](_0x1f2c3e[_0xde4a('0x13')]['id'],_0x28ada7)[_0xde4a('0x14')](function(_0x55d1dc){logger['info'](_0xde4a('0x15'),_0x3dcefd,_0x4b067e[0x1],_0x1f2c3e[_0xde4a('0x10')],_0x1f2c3e[_0xde4a('0x13')]['id']);})[_0xde4a('0x16')](function(_0x263a59){logger[_0xde4a('0xb')](_0xde4a('0x17'),_0x3dcefd,JSON[_0xde4a('0x18')](_0x263a59));logger[_0xde4a('0x19')](_0xde4a('0xf'),_0x3dcefd);})[_0xde4a('0x1a')](function(){_0x254053[_0xde4a('0x1b')]();});}}}catch(_0x45223f){logger[_0xde4a('0xb')]('[%s][TAG]\x20%s',_0x3dcefd,_[_0xde4a('0x1c')](_0x45223f)?JSON[_0xde4a('0x18')](_0x45223f):_0x45223f);logger[_0xde4a('0x19')](_0xde4a('0xf'),_0x3dcefd);_0x254053[_0xde4a('0x1b')]();}};}; \ 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 43c4aa5..6db6862 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 _0x94dc=['merge','contact','message','account','interaction','list','mustache','exports','render'];(function(_0x2a99f1,_0x198fd7){var _0x6948e5=function(_0x2ae413){while(--_0x2ae413){_0x2a99f1['push'](_0x2a99f1['shift']());}};_0x6948e5(++_0x198fd7);}(_0x94dc,0xb1));var _0xc94d=function(_0x28745a,_0x26b590){_0x28745a=_0x28745a-0x0;var _0x318e3d=_0x94dc[_0x28745a];return _0x318e3d;};'use strict';var Mustache=require(_0xc94d('0x0'));var _=require('lodash');module[_0xc94d('0x1')]={'getMustacheRender':function(_0x53939f,_0x1645b0){return Mustache[_0xc94d('0x2')](_0x53939f,_[_0xc94d('0x3')](_0x1645b0['body'],{'contact':_0x1645b0[_0xc94d('0x4')],'message':_0x1645b0[_0xc94d('0x5')],'account':_0x1645b0[_0xc94d('0x6')],'interaction':_0x1645b0[_0xc94d('0x7')],'list':_0x1645b0[_0xc94d('0x8')]}))||'';}}; \ No newline at end of file +var _0xf822=['render','merge','body','message','account','interaction','mustache','exports'];(function(_0x41d1ce,_0x37f542){var _0x38d022=function(_0x57d3ff){while(--_0x57d3ff){_0x41d1ce['push'](_0x41d1ce['shift']());}};_0x38d022(++_0x37f542);}(_0xf822,0x19e));var _0x2f82=function(_0x4e6f48,_0x4d7b34){_0x4e6f48=_0x4e6f48-0x0;var _0x266a39=_0xf822[_0x4e6f48];return _0x266a39;};'use strict';var Mustache=require(_0x2f82('0x0'));var _=require('lodash');module[_0x2f82('0x1')]={'getMustacheRender':function(_0x2e79de,_0x45ab5e){return Mustache[_0x2f82('0x2')](_0x2e79de,_[_0x2f82('0x3')](_0x45ab5e[_0x2f82('0x4')],{'contact':_0x45ab5e['contact'],'message':_0x45ab5e[_0x2f82('0x5')],'account':_0x45ab5e[_0x2f82('0x6')],'interaction':_0x45ab5e[_0x2f82('0x7')],'list':_0x45ab5e['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 24020bd..bd67805 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 _0x2737=['mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','Intervals','map','IntervalId','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','split','push','slice','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','matchPath','rules','emit','complete','end','UserId','error\x20update\x20queue\x20report','stack','agent','agents','busy','busyQueue','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','name','mailQueues','waiting','openchannelQueues','available','smsQueues','loggedIn','paused','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions'];(function(_0x410a2b,_0x4e3c0d){var _0x5b3031=function(_0x1220ee){while(--_0x1220ee){_0x410a2b['push'](_0x410a2b['shift']());}};_0x5b3031(++_0x4e3c0d);}(_0x2737,0x1da));var _0x7273=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2737[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7273('0x0'));var util=require('util');var path=require(_0x7273('0x1'));var fs=require('fs');var jayson=require(_0x7273('0x2'));var BPromise=require(_0x7273('0x3'));var uuid=require(_0x7273('0x4'));var config=require(_0x7273('0x5'));var logger=require(_0x7273('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x7273('0x7')),'mailQueueReport':require(_0x7273('0x8')),'chatQueueReport':require(_0x7273('0x9')),'smsQueueReport':require(_0x7273('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x7273('0xb'))};var RuleEngine=require(_0x7273('0xc'));function getId(_0x2d2c96,_0x4a49db,_0x62d140){return util[_0x7273('0xd')](_0x7273('0xe'),_0x2d2c96,_0x4a49db||0x0,_0x62d140||0x0);}function getIntervals(_0x3849d8,_0x3b3206){var _0x2a7e8a=[];if(!_['isNil'](_0x3b3206['IntervalId'])&&!_['isNil'](_0x3849d8[_0x3b3206['IntervalId']])&&!_[_0x7273('0xf')](_0x3849d8[_0x3b3206['IntervalId']][_0x7273('0x10')])){_0x2a7e8a=_[_0x7273('0x11')](_0x3849d8[_0x3b3206[_0x7273('0x12')]][_0x7273('0x10')],_0x7273('0x13'));}else if(!_[_0x7273('0xf')](_0x3b3206['interval'])){_0x2a7e8a=[_0x3b3206[_0x7273('0x13')]];}return _0x2a7e8a;}exports[_0x7273('0x14')]=function(_0x402181){_0x402181['rules']={};return new BPromise(function(_0x162174,_0x2bad58){var _0x11280e={'Start':function(_0x16a177){var _0x15fb83=this;return new Promise(function(_0x5f10d8,_0x3e88f7){if(_0x16a177){try{var _0x34e703=[];var _0x5a9c88=getId(_0x16a177[_0x7273('0x15')],_0x16a177[_0x7273('0x16')]?_0x16a177[_0x7273('0x16')]['id']:0x0,_0x16a177[_0x7273('0x17')]?_0x16a177[_0x7273('0x17')]['id']:0x0);if(_0x16a177[_0x7273('0x18')]&&_[_0x7273('0x19')](_0x16a177[_0x7273('0x18')])&&_0x16a177['applications'][_0x7273('0x1a')]){for(var _0x287660=0x0;_0x287660<_0x16a177[_0x7273('0x18')][_0x7273('0x1a')];_0x287660+=0x1){var _0x54bf55=_0x16a177[_0x7273('0x18')][_0x287660];if(fs[_0x7273('0x1b')](path[_0x7273('0x1c')](__dirname,'applications',_0x54bf55[_0x7273('0x1d')]+_0x7273('0x1e')))){var _0x10a089=[];switch(_0x54bf55[_0x7273('0x1d')][_0x7273('0x1f')]()){case'autoreply':var _0x3897bf=_0x54bf55[_0x7273('0x20')][_0x7273('0x21')](',');_0x10a089['push'](_0x3897bf[0x0]);_0x10a089[_0x7273('0x22')](_0x3897bf[_0x7273('0x23')](0x1,_0x3897bf[_0x7273('0x1a')])[_0x7273('0x1c')](','));break;case'dialogflow':var _0x4b8645=_0x54bf55[_0x7273('0x20')][_0x7273('0x21')](',');_0x10a089[_0x7273('0x22')](_0x4b8645[0x0]);_0x10a089[_0x7273('0x22')](_0x4b8645[0x1]);_0x10a089[_0x7273('0x22')](_0x4b8645[_0x7273('0x23')](0x2,_0x4b8645['length'])['join'](','));break;case _0x7273('0x24'):var _0x49342d=_0x54bf55[_0x7273('0x20')][_0x7273('0x21')](',');_0x10a089[_0x7273('0x22')](_0x49342d[0x0]);_0x10a089[_0x7273('0x22')](_0x49342d[0x1]);_0x10a089['push'](_0x49342d[0x2]);_0x10a089['push'](_0x49342d[0x3]);_0x10a089[_0x7273('0x22')](_0x49342d[_0x7273('0x23')](0x4,_0x49342d[_0x7273('0x1a')])[_0x7273('0x1c')](','));break;case _0x7273('0x16'):_0x10a089[_0x7273('0x22')](_0x54bf55[_0x7273('0x20')]);break;case _0x7273('0x25'):_0x10a089[_0x7273('0x22')](_0x54bf55[_0x7273('0x26')]);_0x10a089[_0x7273('0x22')](_0x54bf55[_0x7273('0x20')]);break;default:_0x10a089=_[_0x7273('0xf')](_0x54bf55['appdata'])?[]:_0x54bf55[_0x7273('0x20')][_0x7273('0x21')](',');}var _0x11a20f={'id':util[_0x7273('0xd')](_0x7273('0x27'),_0x5a9c88,_0x54bf55['id'],_0x54bf55[_0x7273('0x1d')]),'condition':require(_0x7273('0x28'))[_0x7273('0x29')](_0x5a9c88,getIntervals(_0x402181['intervals'],_0x54bf55),_0x402181),'consequence':require('./applications/'+_0x54bf55[_0x7273('0x1d')])[_0x7273('0x2a')](_0x5a9c88,_0x10a089,_0x402181,_0x16a177),'p':_0x54bf55[_0x7273('0x2b')]||0x0};logger[_0x7273('0x2c')](_0x7273('0x2d'),_0x11a20f['id'],_0x7273('0x2e'),getIntervals(_0x402181[_0x7273('0x2f')],_0x54bf55)['join'](_0x7273('0x30')));_0x34e703['push'](_0x11a20f);}else{logger[_0x7273('0x31')](_0x7273('0x32'),path[_0x7273('0x1c')](__dirname,'applications',_0x54bf55[_0x7273('0x1d')]+_0x7273('0x1e')));}}_0x402181['rules'][_0x5a9c88]=new RuleEngine(_0x34e703);_0x402181['rules'][_0x5a9c88]['execute'](_0x16a177,function(_0x364ed8){logger['info'](_0x7273('0x33'),JSON[_0x7273('0x34')](_0x364ed8[_0x7273('0x35')]));if(_0x402181[_0x7273('0x36')][_0x5a9c88]){_0x402181['rules'][_0x5a9c88][_0x7273('0x37')](_0x7273('0x38'));}});return _0x5f10d8({'code':0xc8,'message':_0x16a177});}else{logger[_0x7273('0x2c')]('No\x20applications\x20to\x20execute');return _0x5f10d8({'code':0xc8,'message':_0x16a177});}}catch(_0x232edf){logger['error'](_0x232edf['stack']);return _0x3e88f7(_0x15fb83[_0x7273('0x31')](0x1f4,_0x232edf));}}return _0x3e88f7('routing\x20is\x20empty');});},'AcceptMessage':function(_0x5ac32a){var _0x3fc2dd=this;return new Promise(function(_0x4fb261,_0x8f32dc){if(_0x5ac32a[_0x7273('0x16')]&&_0x5ac32a[_0x7273('0x16')]['id']){try{var _0x5d8625=getId(_0x5ac32a[_0x7273('0x15')],_0x5ac32a['message']?_0x5ac32a[_0x7273('0x16')]['id']:0x0,_0x5ac32a[_0x7273('0x17')]?_0x5ac32a['interaction']['id']:0x0);if(_0x402181[_0x7273('0x36')][_0x5d8625]){_0x402181['rules'][_0x5d8625][_0x7273('0x37')](_0x7273('0x39'));if(rpc[_0x5ac32a[_0x7273('0x15')]+'QueueReport']){rpc[_0x5ac32a[_0x7273('0x15')]+'QueueReport']['update'](_0x5d8625,{'UserId':_0x5ac32a[_0x7273('0x16')][_0x7273('0x3a')]})['catch'](function(_0x1ac9f5){logger[_0x7273('0x31')](_0x7273('0x3b'));});}}return _0x4fb261({'code':0xc8,'message':_0x5ac32a});}catch(_0x48bde0){logger[_0x7273('0x31')](_0x48bde0[_0x7273('0x3c')]);return _0x8f32dc(_0x3fc2dd[_0x7273('0x31')](0x1f4,_0x48bde0));}}logger[_0x7273('0x31')]('message\x20is\x20empty');return _0x8f32dc(_0x3fc2dd[_0x7273('0x31')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x6351d7){var _0x520361=this;return new Promise(function(_0x5668d7,_0x13ccb1){if(_0x6351d7[_0x7273('0x3d')]&&_0x6351d7[_0x7273('0x3d')]['id']){try{if(_0x402181[_0x7273('0x3e')][_0x6351d7['agent']['id']]){_0x402181[_0x7273('0x3e')][_0x6351d7[_0x7273('0x3d')]['id']][_0x7273('0x3f')]=![];_0x402181[_0x7273('0x3e')][_0x6351d7[_0x7273('0x3d')]['id']][_0x7273('0x40')]=undefined;}return _0x5668d7({'code':0xc8,'message':_0x6351d7});}catch(_0x328862){logger[_0x7273('0x31')](_0x328862[_0x7273('0x3c')]);return _0x13ccb1(_0x520361[_0x7273('0x31')](0x1f4,_0x328862));}}logger[_0x7273('0x31')](_0x7273('0x41'));return _0x13ccb1(_0x520361['error'](0x1f4,_0x7273('0x41')));});},'AbandonInteraction':function(_0x10e73c){var _0x5dc894=this;return new Promise(function(_0x48bb78,_0x7223e){if(_0x10e73c[_0x7273('0x15')]&&_0x10e73c[_0x7273('0x17')]&&_0x10e73c[_0x7273('0x17')]['id']){try{var _0x13dd3a=getId(_0x10e73c[_0x7273('0x15')],_0x10e73c[_0x7273('0x16')]?_0x10e73c[_0x7273('0x16')]['id']:0x0,_0x10e73c[_0x7273('0x17')]?_0x10e73c[_0x7273('0x17')]['id']:0x0);if(_0x402181[_0x7273('0x36')][_0x13dd3a]){_0x402181[_0x7273('0x36')][_0x13dd3a][_0x7273('0x37')](_0x7273('0x39'));}return _0x48bb78({'code':0xc8,'message':_0x10e73c});}catch(_0x50d9b0){logger[_0x7273('0x31')](_0x50d9b0[_0x7273('0x3c')]);return _0x7223e(_0x5dc894[_0x7273('0x31')](0x1f4,_0x50d9b0));}}logger['error'](_0x7273('0x41'));return _0x7223e(_0x5dc894[_0x7273('0x31')](0x1f4,_0x7273('0x41')));});},'AgentCapacity':function(_0x1a15a0){var _0x26841f=this;return new Promise(function(_0x2b2f37,_0x1e43a1){if(_0x402181[_0x7273('0x3e')][_0x7273('0x42')](_0x1a15a0['id'])){for(var _0x494244 in _0x1a15a0[_0x7273('0x43')]){if(_0x1a15a0[_0x7273('0x43')][_0x7273('0x42')](_0x494244)){if(_0x402181['agents'][_0x1a15a0['id']][_0x7273('0x42')](_0x494244+_0x7273('0x44'))){_0x402181['agents'][_0x1a15a0['id']][_0x494244+_0x7273('0x44')]=parseInt(_0x1a15a0[_0x7273('0x43')][_0x494244],0xa);}}}_0x402181['agents'][_0x1a15a0['id']][_0x7273('0x45')]();return _0x2b2f37({'code':0xc8,'message':_0x402181[_0x7273('0x3e')][_0x1a15a0['id']]});}else{return _0x1e43a1(_0x26841f[_0x7273('0x31')](0x1f4,_0x7273('0x46')));}});},'Agents':function(_0x2b3266){return new Promise(function(_0x13b9c0,_0xfdf404){var _0x351245=_['values'](_0x402181[_0x7273('0x3e')]);_0x13b9c0({'count':_0x351245[_0x7273('0x1a')],'rows':_0x351245});});},'ChatQueues':function(_0xff826f){return new Promise(function(_0x1abbc4,_0x1badc2){var _0x15b787=[];for(var _0x3ddfed in _0x402181[_0x7273('0x47')]){if(_0x402181['chatQueues'][_0x7273('0x42')](_0x3ddfed)){var _0x45dc41=_0x402181[_0x7273('0x47')][_0x3ddfed];var _0x11ea50={'id':_0x45dc41['id'],'available':_0x45dc41['available'],'loggedIn':_0x45dc41['loggedIn'],'name':_0x45dc41[_0x7273('0x48')],'paused':_0x45dc41['paused'],'waiting':_0x45dc41['waiting']};_0x15b787[_0x7273('0x22')](_0x11ea50);}}_0x1abbc4({'count':_0x15b787[_0x7273('0x1a')],'rows':_0x15b787});});},'MailQueues':function(_0x421827){return new Promise(function(_0x5e83be,_0x2ee56c){var _0x1ae2f8=[];for(var _0x4f92e5 in _0x402181['mailQueues']){if(_0x402181[_0x7273('0x49')][_0x7273('0x42')](_0x4f92e5)){var _0x2538ec=_0x402181['mailQueues'][_0x4f92e5];var _0x310abf={'id':_0x2538ec['id'],'available':_0x2538ec['available'],'loggedIn':_0x2538ec['loggedIn'],'name':_0x2538ec['name'],'paused':_0x2538ec['paused'],'waiting':_0x2538ec[_0x7273('0x4a')]};_0x1ae2f8[_0x7273('0x22')](_0x310abf);}}_0x5e83be({'count':_0x1ae2f8[_0x7273('0x1a')],'rows':_0x1ae2f8});});},'OpenchannelQueues':function(_0x198dc4){return new Promise(function(_0x20a93a,_0x372b29){var _0x1c2c76=[];for(var _0x49137e in _0x402181['openchannelQueues']){if(_0x402181[_0x7273('0x4b')][_0x7273('0x42')](_0x49137e)){var _0x18011a=_0x402181[_0x7273('0x4b')][_0x49137e];var _0x16d923={'id':_0x18011a['id'],'available':_0x18011a[_0x7273('0x4c')],'loggedIn':_0x18011a['loggedIn'],'name':_0x18011a[_0x7273('0x48')],'paused':_0x18011a['paused'],'waiting':_0x18011a[_0x7273('0x4a')]};_0x1c2c76[_0x7273('0x22')](_0x16d923);}}_0x20a93a({'count':_0x1c2c76[_0x7273('0x1a')],'rows':_0x1c2c76});});},'SmsQueues':function(_0xaa09bd){return new Promise(function(_0x18878a,_0xbd7f1a){var _0x260993=[];for(var _0x125906 in _0x402181[_0x7273('0x4d')]){if(_0x402181[_0x7273('0x4d')]['hasOwnProperty'](_0x125906)){var _0x481501=_0x402181[_0x7273('0x4d')][_0x125906];var _0x2f7bf8={'id':_0x481501['id'],'available':_0x481501[_0x7273('0x4c')],'loggedIn':_0x481501[_0x7273('0x4e')],'name':_0x481501[_0x7273('0x48')],'paused':_0x481501[_0x7273('0x4f')],'waiting':_0x481501['waiting']};_0x260993[_0x7273('0x22')](_0x2f7bf8);}}_0x18878a({'count':_0x260993[_0x7273('0x1a')],'rows':_0x260993});});},'FaxQueues':function(_0x2e9bb3){return new Promise(function(_0x1be56c,_0x16ffaa){var _0x222e29=[];for(var _0x277d5f in _0x402181['faxQueues']){if(_0x402181[_0x7273('0x50')][_0x7273('0x42')](_0x277d5f)){var _0x18e8fc=_0x402181[_0x7273('0x50')][_0x277d5f];var _0x5cccd1={'id':_0x18e8fc['id'],'available':_0x18e8fc[_0x7273('0x4c')],'loggedIn':_0x18e8fc['loggedIn'],'name':_0x18e8fc[_0x7273('0x48')],'paused':_0x18e8fc[_0x7273('0x4f')],'waiting':_0x18e8fc['waiting']};_0x222e29[_0x7273('0x22')](_0x5cccd1);}}_0x1be56c({'count':_0x222e29[_0x7273('0x1a')],'rows':_0x222e29});});},'WhatsappQueues':function(_0x162ecd){return new Promise(function(_0xe4b08f,_0x40c69f){var _0x40f33b=[];for(var _0x47f07c in _0x402181[_0x7273('0x51')]){if(_0x402181['whatsappQueues'][_0x7273('0x42')](_0x47f07c)){var _0x4065b2=_0x402181[_0x7273('0x51')][_0x47f07c];var _0x48f238={'id':_0x4065b2['id'],'available':_0x4065b2[_0x7273('0x4c')],'loggedIn':_0x4065b2[_0x7273('0x4e')],'name':_0x4065b2[_0x7273('0x48')],'paused':_0x4065b2['paused'],'waiting':_0x4065b2['waiting']};_0x40f33b[_0x7273('0x22')](_0x48f238);}}_0xe4b08f({'count':_0x40f33b[_0x7273('0x1a')],'rows':_0x40f33b});});},'ChatQueuesWaitingInteractions':function(_0x45610d){return new Promise(function(_0x3f6be9,_0x279968){var _0xb69e80=_[_0x7273('0x52')](_0x402181[_0x7273('0x53')]);_0x3f6be9({'count':_0xb69e80[_0x7273('0x1a')],'rows':_0xb69e80});});},'MailQueuesWaitingInteractions':function(_0x302f24){return new Promise(function(_0x452715,_0x48bea6){var _0x5bdaa4=_[_0x7273('0x52')](_0x402181[_0x7273('0x54')]);_0x452715({'count':_0x5bdaa4['length'],'rows':_0x5bdaa4});});},'OpenchannelQueuesWaitingInteractions':function(_0x26ffe1){return new Promise(function(_0x1c38c3,_0x449623){var _0x252003=_[_0x7273('0x52')](_0x402181['openchannelQueuesWaitingInteractions']);_0x1c38c3({'count':_0x252003[_0x7273('0x1a')],'rows':_0x252003});});},'SmsQueuesWaitingInteractions':function(_0x323517){return new Promise(function(_0x376d13,_0x5772cc){var _0x2c6516=_[_0x7273('0x52')](_0x402181[_0x7273('0x55')]);_0x376d13({'count':_0x2c6516['length'],'rows':_0x2c6516});});},'FaxQueuesWaitingInteractions':function(_0x124dc3){return new Promise(function(_0x48572c,_0x3ce8de){var _0x451096=_[_0x7273('0x52')](_0x402181[_0x7273('0x56')]);_0x48572c({'count':_0x451096[_0x7273('0x1a')],'rows':_0x451096});});},'WhatsappQueuesWaitingInteractions':function(_0x2d5f23){return new Promise(function(_0x5e597b,_0x592ca5){var _0x432735=_['values'](_0x402181[_0x7273('0x57')]);_0x5e597b({'count':_0x432735[_0x7273('0x1a')],'rows':_0x432735});});}};var _0x410f34=jayson['server'](_0x11280e)[_0x7273('0x58')]();_0x410f34['on'](_0x7273('0x31'),function(_0xb1a58b){logger['error'](JSON[_0x7273('0x34')](_0xb1a58b));return _0x2bad58(_0xb1a58b);});_0x410f34[_0x7273('0x14')](0x232c,_0x7273('0x59'),function(){console[_0x7273('0x5a')](_0x7273('0x5b'),0x232c);return _0x162174(_0x7273('0x5c')+0x232c);});});}; \ No newline at end of file +var _0x98ba=['execute','info','emit','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/environment','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','format','IntervalId','isNil','map','Intervals','interval','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','autoreply','split','push','dialogflow','appdata','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under'];(function(_0x30a528,_0x1d04f2){var _0x3e029c=function(_0x4e4b97){while(--_0x4e4b97){_0x30a528['push'](_0x30a528['shift']());}};_0x3e029c(++_0x1d04f2);}(_0x98ba,0x19e));var _0xa98b=function(_0x1a0dfa,_0x1208b0){_0x1a0dfa=_0x1a0dfa-0x0;var _0x50499d=_0x98ba[_0x1a0dfa];return _0x50499d;};'use strict';var _=require(_0xa98b('0x0'));var util=require(_0xa98b('0x1'));var path=require(_0xa98b('0x2'));var fs=require('fs');var jayson=require(_0xa98b('0x3'));var BPromise=require(_0xa98b('0x4'));var uuid=require('uuid');var config=require(_0xa98b('0x5'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0xa98b('0x6')),'mailQueueReport':require(_0xa98b('0x7')),'chatQueueReport':require(_0xa98b('0x8')),'smsQueueReport':require(_0xa98b('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa98b('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x36b46f,_0x21b4b3,_0xccddbe){return util[_0xa98b('0xb')]('%s.%s.%s',_0x36b46f,_0x21b4b3||0x0,_0xccddbe||0x0);}function getIntervals(_0x5451ee,_0x199d1b){var _0x4ecf3e=[];if(!_['isNil'](_0x199d1b[_0xa98b('0xc')])&&!_[_0xa98b('0xd')](_0x5451ee[_0x199d1b['IntervalId']])&&!_[_0xa98b('0xd')](_0x5451ee[_0x199d1b['IntervalId']]['Intervals'])){_0x4ecf3e=_[_0xa98b('0xe')](_0x5451ee[_0x199d1b[_0xa98b('0xc')]][_0xa98b('0xf')],'interval');}else if(!_[_0xa98b('0xd')](_0x199d1b['interval'])){_0x4ecf3e=[_0x199d1b[_0xa98b('0x10')]];}return _0x4ecf3e;}exports['listen']=function(_0x2b1ca2){_0x2b1ca2[_0xa98b('0x11')]={};return new BPromise(function(_0x337d8d,_0x598106){var _0xa93b34={'Start':function(_0xccff88){var _0x320e62=this;return new Promise(function(_0x14bcef,_0x31ef50){if(_0xccff88){try{var _0x372369=[];var _0x7d5a2e=getId(_0xccff88[_0xa98b('0x12')],_0xccff88[_0xa98b('0x13')]?_0xccff88[_0xa98b('0x13')]['id']:0x0,_0xccff88[_0xa98b('0x14')]?_0xccff88[_0xa98b('0x14')]['id']:0x0);if(_0xccff88['applications']&&_[_0xa98b('0x15')](_0xccff88['applications'])&&_0xccff88[_0xa98b('0x16')][_0xa98b('0x17')]){for(var _0x47626c=0x0;_0x47626c<_0xccff88['applications']['length'];_0x47626c+=0x1){var _0x33eebb=_0xccff88[_0xa98b('0x16')][_0x47626c];if(fs[_0xa98b('0x18')](path[_0xa98b('0x19')](__dirname,_0xa98b('0x16'),_0x33eebb[_0xa98b('0x1a')]+_0xa98b('0x1b')))){var _0x490b01=[];switch(_0x33eebb['app']['toLowerCase']()){case _0xa98b('0x1c'):var _0x458182=_0x33eebb['appdata'][_0xa98b('0x1d')](',');_0x490b01['push'](_0x458182[0x0]);_0x490b01[_0xa98b('0x1e')](_0x458182['slice'](0x1,_0x458182[_0xa98b('0x17')])[_0xa98b('0x19')](','));break;case _0xa98b('0x1f'):var _0x40ee5a=_0x33eebb[_0xa98b('0x20')]['split'](',');_0x490b01[_0xa98b('0x1e')](_0x40ee5a[0x0]);_0x490b01[_0xa98b('0x1e')](_0x40ee5a[0x1]);_0x490b01[_0xa98b('0x1e')](_0x40ee5a['slice'](0x2,_0x40ee5a[_0xa98b('0x17')])[_0xa98b('0x19')](','));break;case _0xa98b('0x21'):var _0xb82456=_0x33eebb['appdata'][_0xa98b('0x1d')](',');_0x490b01[_0xa98b('0x1e')](_0xb82456[0x0]);_0x490b01[_0xa98b('0x1e')](_0xb82456[0x1]);_0x490b01[_0xa98b('0x1e')](_0xb82456[0x2]);_0x490b01[_0xa98b('0x1e')](_0xb82456[0x3]);_0x490b01[_0xa98b('0x1e')](_0xb82456['slice'](0x4,_0xb82456['length'])[_0xa98b('0x19')](','));break;case _0xa98b('0x13'):_0x490b01['push'](_0x33eebb[_0xa98b('0x20')]);break;case _0xa98b('0x22'):_0x490b01[_0xa98b('0x1e')](_0x33eebb[_0xa98b('0x23')]);_0x490b01[_0xa98b('0x1e')](_0x33eebb[_0xa98b('0x20')]);break;default:_0x490b01=_['isNil'](_0x33eebb[_0xa98b('0x20')])?[]:_0x33eebb['appdata'][_0xa98b('0x1d')](',');}var _0x3d690f={'id':util[_0xa98b('0xb')](_0xa98b('0x24'),_0x7d5a2e,_0x33eebb['id'],_0x33eebb[_0xa98b('0x1a')]),'condition':require(_0xa98b('0x25'))[_0xa98b('0x26')](_0x7d5a2e,getIntervals(_0x2b1ca2[_0xa98b('0x27')],_0x33eebb),_0x2b1ca2),'consequence':require(_0xa98b('0x28')+_0x33eebb[_0xa98b('0x1a')])['consequence'](_0x7d5a2e,_0x490b01,_0x2b1ca2,_0xccff88),'p':_0x33eebb[_0xa98b('0x29')]||0x0};logger['info'](_0xa98b('0x2a'),_0x3d690f['id'],_0xa98b('0x2b'),getIntervals(_0x2b1ca2[_0xa98b('0x27')],_0x33eebb)[_0xa98b('0x19')](_0xa98b('0x2c')));_0x372369['push'](_0x3d690f);}else{logger['error'](_0xa98b('0x2d'),path[_0xa98b('0x19')](__dirname,_0xa98b('0x16'),_0x33eebb['app']+_0xa98b('0x1b')));}}_0x2b1ca2[_0xa98b('0x11')][_0x7d5a2e]=new RuleEngine(_0x372369);_0x2b1ca2[_0xa98b('0x11')][_0x7d5a2e][_0xa98b('0x2e')](_0xccff88,function(_0x583a52){logger[_0xa98b('0x2f')]('Applications\x20executed',JSON['stringify'](_0x583a52['matchPath']));if(_0x2b1ca2[_0xa98b('0x11')][_0x7d5a2e]){_0x2b1ca2[_0xa98b('0x11')][_0x7d5a2e][_0xa98b('0x30')](_0xa98b('0x31'));}});return _0x14bcef({'code':0xc8,'message':_0xccff88});}else{logger[_0xa98b('0x2f')](_0xa98b('0x32'));return _0x14bcef({'code':0xc8,'message':_0xccff88});}}catch(_0x3ac1e9){logger[_0xa98b('0x33')](_0x3ac1e9[_0xa98b('0x34')]);return _0x31ef50(_0x320e62['error'](0x1f4,_0x3ac1e9));}}return _0x31ef50(_0xa98b('0x35'));});},'AcceptMessage':function(_0x28469d){var _0x4d032a=this;return new Promise(function(_0x35558f,_0x18751f){if(_0x28469d['message']&&_0x28469d[_0xa98b('0x13')]['id']){try{var _0x36888f=getId(_0x28469d[_0xa98b('0x12')],_0x28469d[_0xa98b('0x13')]?_0x28469d[_0xa98b('0x13')]['id']:0x0,_0x28469d['interaction']?_0x28469d[_0xa98b('0x14')]['id']:0x0);if(_0x2b1ca2[_0xa98b('0x11')][_0x36888f]){_0x2b1ca2['rules'][_0x36888f]['emit'](_0xa98b('0x36'));if(rpc[_0x28469d['channel']+_0xa98b('0x37')]){rpc[_0x28469d['channel']+_0xa98b('0x37')][_0xa98b('0x38')](_0x36888f,{'UserId':_0x28469d[_0xa98b('0x13')][_0xa98b('0x39')]})[_0xa98b('0x3a')](function(_0x40736f){logger['error'](_0xa98b('0x3b'));});}}return _0x35558f({'code':0xc8,'message':_0x28469d});}catch(_0x48e7e8){logger[_0xa98b('0x33')](_0x48e7e8[_0xa98b('0x34')]);return _0x18751f(_0x4d032a['error'](0x1f4,_0x48e7e8));}}logger[_0xa98b('0x33')](_0xa98b('0x3c'));return _0x18751f(_0x4d032a['error'](0x1f4,_0xa98b('0x3c')));});},'RejectMessage':function(_0x37d609){var _0x1323b4=this;return new Promise(function(_0x12104c,_0x12431a){if(_0x37d609[_0xa98b('0x3d')]&&_0x37d609[_0xa98b('0x3d')]['id']){try{if(_0x2b1ca2[_0xa98b('0x3e')][_0x37d609[_0xa98b('0x3d')]['id']]){_0x2b1ca2[_0xa98b('0x3e')][_0x37d609[_0xa98b('0x3d')]['id']][_0xa98b('0x3f')]=![];_0x2b1ca2[_0xa98b('0x3e')][_0x37d609[_0xa98b('0x3d')]['id']][_0xa98b('0x40')]=undefined;}return _0x12104c({'code':0xc8,'message':_0x37d609});}catch(_0x3d9324){logger[_0xa98b('0x33')](_0x3d9324[_0xa98b('0x34')]);return _0x12431a(_0x1323b4['error'](0x1f4,_0x3d9324));}}logger[_0xa98b('0x33')]('message\x20is\x20empty');return _0x12431a(_0x1323b4[_0xa98b('0x33')](0x1f4,_0xa98b('0x3c')));});},'AbandonInteraction':function(_0x1fb998){var _0x431d99=this;return new Promise(function(_0x4a23f6,_0x14e878){if(_0x1fb998[_0xa98b('0x12')]&&_0x1fb998[_0xa98b('0x14')]&&_0x1fb998[_0xa98b('0x14')]['id']){try{var _0x2553df=getId(_0x1fb998[_0xa98b('0x12')],_0x1fb998['message']?_0x1fb998[_0xa98b('0x13')]['id']:0x0,_0x1fb998[_0xa98b('0x14')]?_0x1fb998[_0xa98b('0x14')]['id']:0x0);if(_0x2b1ca2[_0xa98b('0x11')][_0x2553df]){_0x2b1ca2[_0xa98b('0x11')][_0x2553df][_0xa98b('0x30')](_0xa98b('0x36'));}return _0x4a23f6({'code':0xc8,'message':_0x1fb998});}catch(_0x3d9f63){logger['error'](_0x3d9f63['stack']);return _0x14e878(_0x431d99[_0xa98b('0x33')](0x1f4,_0x3d9f63));}}logger[_0xa98b('0x33')]('message\x20is\x20empty');return _0x14e878(_0x431d99['error'](0x1f4,_0xa98b('0x3c')));});},'AgentCapacity':function(_0xe85ee9){var _0x5159a6=this;return new Promise(function(_0x35a578,_0x2d5174){if(_0x2b1ca2['agents']['hasOwnProperty'](_0xe85ee9['id'])){for(var _0x3e0f71 in _0xe85ee9['capacity']){if(_0xe85ee9[_0xa98b('0x41')][_0xa98b('0x42')](_0x3e0f71)){if(_0x2b1ca2[_0xa98b('0x3e')][_0xe85ee9['id']]['hasOwnProperty'](_0x3e0f71+_0xa98b('0x43'))){_0x2b1ca2[_0xa98b('0x3e')][_0xe85ee9['id']][_0x3e0f71+_0xa98b('0x43')]=parseInt(_0xe85ee9[_0xa98b('0x41')][_0x3e0f71],0xa);}}}_0x2b1ca2['agents'][_0xe85ee9['id']][_0xa98b('0x44')]();return _0x35a578({'code':0xc8,'message':_0x2b1ca2[_0xa98b('0x3e')][_0xe85ee9['id']]});}else{return _0x2d5174(_0x5159a6[_0xa98b('0x33')](0x1f4,_0xa98b('0x45')));}});},'Agents':function(_0xf6e0e9){return new Promise(function(_0x5330f7,_0x1bebbb){var _0x159cc2=_[_0xa98b('0x46')](_0x2b1ca2[_0xa98b('0x3e')]);_0x5330f7({'count':_0x159cc2[_0xa98b('0x17')],'rows':_0x159cc2});});},'ChatQueues':function(_0x22f7eb){return new Promise(function(_0x34b2d8,_0x3ca901){var _0x1e1b35=[];for(var _0x1b835d in _0x2b1ca2[_0xa98b('0x47')]){if(_0x2b1ca2[_0xa98b('0x47')]['hasOwnProperty'](_0x1b835d)){var _0x5267bc=_0x2b1ca2[_0xa98b('0x47')][_0x1b835d];var _0x1324c2={'id':_0x5267bc['id'],'available':_0x5267bc[_0xa98b('0x48')],'loggedIn':_0x5267bc[_0xa98b('0x49')],'name':_0x5267bc[_0xa98b('0x4a')],'paused':_0x5267bc[_0xa98b('0x4b')],'waiting':_0x5267bc['waiting']};_0x1e1b35[_0xa98b('0x1e')](_0x1324c2);}}_0x34b2d8({'count':_0x1e1b35[_0xa98b('0x17')],'rows':_0x1e1b35});});},'MailQueues':function(_0x1e6e61){return new Promise(function(_0x4b2f09,_0x29f8e5){var _0x2bc086=[];for(var _0x2b90aa in _0x2b1ca2['mailQueues']){if(_0x2b1ca2[_0xa98b('0x4c')][_0xa98b('0x42')](_0x2b90aa)){var _0x1e5b55=_0x2b1ca2[_0xa98b('0x4c')][_0x2b90aa];var _0x32d661={'id':_0x1e5b55['id'],'available':_0x1e5b55['available'],'loggedIn':_0x1e5b55[_0xa98b('0x49')],'name':_0x1e5b55[_0xa98b('0x4a')],'paused':_0x1e5b55[_0xa98b('0x4b')],'waiting':_0x1e5b55[_0xa98b('0x4d')]};_0x2bc086[_0xa98b('0x1e')](_0x32d661);}}_0x4b2f09({'count':_0x2bc086['length'],'rows':_0x2bc086});});},'OpenchannelQueues':function(_0x1024f6){return new Promise(function(_0x19e21b,_0x3f4bf6){var _0x464f6b=[];for(var _0x2cfbf0 in _0x2b1ca2[_0xa98b('0x4e')]){if(_0x2b1ca2[_0xa98b('0x4e')][_0xa98b('0x42')](_0x2cfbf0)){var _0x2343c1=_0x2b1ca2[_0xa98b('0x4e')][_0x2cfbf0];var _0xae243c={'id':_0x2343c1['id'],'available':_0x2343c1['available'],'loggedIn':_0x2343c1[_0xa98b('0x49')],'name':_0x2343c1[_0xa98b('0x4a')],'paused':_0x2343c1[_0xa98b('0x4b')],'waiting':_0x2343c1['waiting']};_0x464f6b[_0xa98b('0x1e')](_0xae243c);}}_0x19e21b({'count':_0x464f6b['length'],'rows':_0x464f6b});});},'SmsQueues':function(_0x48a3e2){return new Promise(function(_0x1e14c3,_0x2b5c68){var _0x23d549=[];for(var _0x336ad6 in _0x2b1ca2['smsQueues']){if(_0x2b1ca2[_0xa98b('0x4f')][_0xa98b('0x42')](_0x336ad6)){var _0x2bbd37=_0x2b1ca2[_0xa98b('0x4f')][_0x336ad6];var _0x550842={'id':_0x2bbd37['id'],'available':_0x2bbd37[_0xa98b('0x48')],'loggedIn':_0x2bbd37[_0xa98b('0x49')],'name':_0x2bbd37[_0xa98b('0x4a')],'paused':_0x2bbd37['paused'],'waiting':_0x2bbd37[_0xa98b('0x4d')]};_0x23d549['push'](_0x550842);}}_0x1e14c3({'count':_0x23d549[_0xa98b('0x17')],'rows':_0x23d549});});},'FaxQueues':function(_0x43bd55){return new Promise(function(_0x1f85a2,_0x7c553b){var _0x5df01b=[];for(var _0xfc3a12 in _0x2b1ca2[_0xa98b('0x50')]){if(_0x2b1ca2['faxQueues'][_0xa98b('0x42')](_0xfc3a12)){var _0x43059a=_0x2b1ca2[_0xa98b('0x50')][_0xfc3a12];var _0x2cad4d={'id':_0x43059a['id'],'available':_0x43059a[_0xa98b('0x48')],'loggedIn':_0x43059a['loggedIn'],'name':_0x43059a[_0xa98b('0x4a')],'paused':_0x43059a['paused'],'waiting':_0x43059a[_0xa98b('0x4d')]};_0x5df01b[_0xa98b('0x1e')](_0x2cad4d);}}_0x1f85a2({'count':_0x5df01b['length'],'rows':_0x5df01b});});},'WhatsappQueues':function(_0x54abf7){return new Promise(function(_0xe32bd4,_0x577cc3){var _0xf63b81=[];for(var _0x75ba2d in _0x2b1ca2[_0xa98b('0x51')]){if(_0x2b1ca2[_0xa98b('0x51')][_0xa98b('0x42')](_0x75ba2d)){var _0x4fd61a=_0x2b1ca2[_0xa98b('0x51')][_0x75ba2d];var _0x50f9a8={'id':_0x4fd61a['id'],'available':_0x4fd61a[_0xa98b('0x48')],'loggedIn':_0x4fd61a[_0xa98b('0x49')],'name':_0x4fd61a['name'],'paused':_0x4fd61a[_0xa98b('0x4b')],'waiting':_0x4fd61a[_0xa98b('0x4d')]};_0xf63b81[_0xa98b('0x1e')](_0x50f9a8);}}_0xe32bd4({'count':_0xf63b81['length'],'rows':_0xf63b81});});},'ChatQueuesWaitingInteractions':function(_0x149d2c){return new Promise(function(_0x5977f1,_0x11536a){var _0x588bf9=_[_0xa98b('0x46')](_0x2b1ca2[_0xa98b('0x52')]);_0x5977f1({'count':_0x588bf9[_0xa98b('0x17')],'rows':_0x588bf9});});},'MailQueuesWaitingInteractions':function(_0x8406ea){return new Promise(function(_0x3927a2,_0x1465ab){var _0x823e2d=_['values'](_0x2b1ca2['mailQueuesWaitingInteractions']);_0x3927a2({'count':_0x823e2d[_0xa98b('0x17')],'rows':_0x823e2d});});},'OpenchannelQueuesWaitingInteractions':function(_0x5001d6){return new Promise(function(_0x324a24,_0x1a0288){var _0x22aaa6=_[_0xa98b('0x46')](_0x2b1ca2[_0xa98b('0x53')]);_0x324a24({'count':_0x22aaa6[_0xa98b('0x17')],'rows':_0x22aaa6});});},'SmsQueuesWaitingInteractions':function(_0x427a7b){return new Promise(function(_0x25f97a,_0x225c90){var _0x4445b6=_[_0xa98b('0x46')](_0x2b1ca2[_0xa98b('0x54')]);_0x25f97a({'count':_0x4445b6[_0xa98b('0x17')],'rows':_0x4445b6});});},'FaxQueuesWaitingInteractions':function(_0x287a49){return new Promise(function(_0x2d6629,_0x3ed0a7){var _0x1da291=_[_0xa98b('0x46')](_0x2b1ca2[_0xa98b('0x55')]);_0x2d6629({'count':_0x1da291[_0xa98b('0x17')],'rows':_0x1da291});});},'WhatsappQueuesWaitingInteractions':function(_0x109c55){return new Promise(function(_0x558974,_0x51c6d5){var _0x5e5e4b=_[_0xa98b('0x46')](_0x2b1ca2[_0xa98b('0x56')]);_0x558974({'count':_0x5e5e4b[_0xa98b('0x17')],'rows':_0x5e5e4b});});}};var _0x265593=jayson[_0xa98b('0x57')](_0xa93b34)[_0xa98b('0x58')]();_0x265593['on'](_0xa98b('0x33'),function(_0x179a76){logger['error'](JSON['stringify'](_0x179a76));return _0x598106(_0x179a76);});_0x265593[_0xa98b('0x59')](0x232c,'127.0.0.1',function(){console[_0xa98b('0x5a')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x337d8d(_0xa98b('0x5b')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index f5adf4d..cec7e48 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 _0x161d=['message','indexOf','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','util','lodash','routing','client','http','request','error','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','then'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x161d,0x90));var _0xd161=function(_0x194242,_0x5b813a){_0x194242=_0x194242-0x0;var _0x2bb6c8=_0x161d[_0x194242];return _0x2bb6c8;};'use strict';var util=require(_0xd161('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xd161('0x1'));var logger=require('../../../config/logger')(_0xd161('0x2'));var client=jayson[_0xd161('0x3')][_0xd161('0x4')]({'port':0x232a});function request(_0x1996b4,_0x3cdd82){return new BPromise(function(_0x517cae,_0x2fc728){return client[_0xd161('0x5')](_0x1996b4,_0x3cdd82)['then'](function(_0x1a5ae9){if(_0x1a5ae9['error']){return _0x2fc728(_0x1a5ae9[_0xd161('0x6')]['message']);}else{return _0x517cae(_0x1a5ae9['result']);}})[_0xd161('0x7')](function(_0x5df54a){return _0x2fc728(_0x5df54a);});});}exports[_0xd161('0x8')]=function(_0x5d39e0,_0x5563d0,_0x7ce032){return function(_0x41f748){if(_0x7ce032[_0xd161('0x9')]&&!_0x7ce032[_0xd161('0x9')][_0x5d39e0]){logger[_0xd161('0xa')](_0xd161('0xb'),_0x5d39e0);return _0x41f748[_0xd161('0xc')]();}var _0x46a905=[];for(var _0x4a0be9=0x0;_0x4a0be9<_0x5563d0[_0xd161('0xd')];_0x4a0be9+=0x1){_0x46a905[_0xd161('0xe')](request(_0xd161('0xf'),{'command':util[_0xd161('0x10')]('iftime\x20%s',_0x5563d0[_0x4a0be9])})[_0xd161('0x11')](function(_0x15d020){return _0x15d020&&_0x15d020[_0xd161('0x12')]&&_0x15d020[_0xd161('0x12')][_0xd161('0x13')]('true')>=0x0?!![]:![];})['catch'](function(_0x11a24a){logger['error'](_0xd161('0x14'),_0x5d39e0,_0x5563d0[_0x4a0be9]);}));}BPromise[_0xd161('0x15')](_0x46a905)[_0xd161('0x11')](function(_0x7c71c6){var _0x1ea5e3=_['some'](_0x7c71c6);logger[_0xd161('0xa')](_0xd161('0x16'),_0x5d39e0,_0x5563d0[_0xd161('0x17')]('\x20|\x20'),_0x1ea5e3);_0x41f748[_0xd161('0x18')](_0x1ea5e3);})[_0xd161('0x7')](function(_0x25dcf2){console[_0xd161('0x19')](_0x25dcf2);logger[_0xd161('0x6')](_0xd161('0x16'),_0x5d39e0,_0x5563d0[_0xd161('0x17')](_0xd161('0x1a')),_0x25dcf2['stack']);_0x41f748[_0xd161('0xc')]();});};}; \ No newline at end of file +var _0x5f8f=['stack','util','bluebird','routing','client','http','then','message','result','rules','info','stop','length','push','Command','iftime\x20%s','indexOf','true','catch','error','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','when','log','join','\x20|\x20'];(function(_0x16bd44,_0x3c91ba){var _0x368a61=function(_0x1c68ab){while(--_0x1c68ab){_0x16bd44['push'](_0x16bd44['shift']());}};_0x368a61(++_0x3c91ba);}(_0x5f8f,0x17b));var _0xf5f8=function(_0x5a4b51,_0x10bd62){_0x5a4b51=_0x5a4b51-0x0;var _0x4767fa=_0x5f8f[_0x5a4b51];return _0x4767fa;};'use strict';var util=require(_0xf5f8('0x0'));var BPromise=require(_0xf5f8('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require('../../../config/logger')(_0xf5f8('0x2'));var client=jayson[_0xf5f8('0x3')][_0xf5f8('0x4')]({'port':0x232a});function request(_0x29ecaa,_0x4a0ac2){return new BPromise(function(_0x1de02c,_0x4fc9cd){return client['request'](_0x29ecaa,_0x4a0ac2)[_0xf5f8('0x5')](function(_0x31c18e){if(_0x31c18e['error']){return _0x4fc9cd(_0x31c18e['error'][_0xf5f8('0x6')]);}else{return _0x1de02c(_0x31c18e[_0xf5f8('0x7')]);}})['catch'](function(_0xeff7b8){return _0x4fc9cd(_0xeff7b8);});});}exports['condition']=function(_0x2bd37e,_0x1fd9d9,_0x3e6213){return function(_0x2433ee){if(_0x3e6213['rules']&&!_0x3e6213[_0xf5f8('0x8')][_0x2bd37e]){logger[_0xf5f8('0x9')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x2bd37e);return _0x2433ee[_0xf5f8('0xa')]();}var _0x557ce1=[];for(var _0x390059=0x0;_0x390059<_0x1fd9d9[_0xf5f8('0xb')];_0x390059+=0x1){_0x557ce1[_0xf5f8('0xc')](request(_0xf5f8('0xd'),{'command':util['format'](_0xf5f8('0xe'),_0x1fd9d9[_0x390059])})[_0xf5f8('0x5')](function(_0x2310c4){return _0x2310c4&&_0x2310c4['message']&&_0x2310c4['message'][_0xf5f8('0xf')](_0xf5f8('0x10'))>=0x0?!![]:![];})[_0xf5f8('0x11')](function(_0x27d8f1){logger[_0xf5f8('0x12')](_0xf5f8('0x13'),_0x2bd37e,_0x1fd9d9[_0x390059]);}));}BPromise[_0xf5f8('0x14')](_0x557ce1)[_0xf5f8('0x5')](function(_0x5270bb){var _0x2db773=_['some'](_0x5270bb);logger[_0xf5f8('0x9')](_0xf5f8('0x15'),_0x2bd37e,_0x1fd9d9['join']('\x20|\x20'),_0x2db773);_0x2433ee[_0xf5f8('0x16')](_0x2db773);})[_0xf5f8('0x11')](function(_0x377f32){console[_0xf5f8('0x17')](_0x377f32);logger[_0xf5f8('0x12')](_0xf5f8('0x15'),_0x2bd37e,_0x1fd9d9[_0xf5f8('0x18')](_0xf5f8('0x19')),_0x377f32[_0xf5f8('0x1a')]);_0x2433ee[_0xf5f8('0xa')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index db69081..a556f53 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 _0x2547=['error','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','includes','abandoned','agentconnect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','stack','agentcomplete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','agententerreason','transfereeuniqueid','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','cause','rejected','splice','agent','agentconnectAt','util','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','membername','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','acw','acwtime','agentacw','request','CreateVoiceAgentReport','destuniqueid','agentcalledAt','now','connectedlinename'];(function(_0x24396d,_0x40695e){var _0x5cbf77=function(_0xe3edbf){while(--_0xe3edbf){_0x24396d['push'](_0x24396d['shift']());}};_0x5cbf77(++_0x40695e);}(_0x2547,0xbb));var _0x7254=function(_0x1908cd,_0x5cd175){_0x1908cd=_0x1908cd-0x0;var _0x3b0e04=_0x2547[_0x1908cd];return _0x3b0e04;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1703de,_0x4a294a){utils[_0x7254('0x1')](util['format'](_0x7254('0x2'),_0x1703de[_0x7254('0x3')],_0x1703de['channel'],_0x1703de['queue'],_0x1703de[_0x7254('0x4')],_0x1703de['interface'],_0x1703de['calleridnum'],_0x1703de[_0x7254('0x5')],_0x1703de[_0x7254('0x6')]));if(_0x1703de[_0x7254('0x7')]){utils[_0x7254('0x8')](_0x1703de[_0x7254('0x7')])[_0x7254('0x9')](function(_0x188436){if(_0x188436){_0x1703de[_0x7254('0xa')]=_0x188436['type'];_0x1703de['agentacw']=_0x1703de['agentcomplete']?_0x188436[_0x7254('0xb')]:![];_0x1703de[_0x7254('0xc')]=_0x1703de[_0x7254('0xd')]?_0x188436['acwTimeout']:0x0;}utils[_0x7254('0xe')](_0x7254('0xf'),_0x1703de);});}else{utils[_0x7254('0xe')](_0x7254('0xf'),_0x1703de);}if(_0x4a294a){delete transfers[_0x1703de[_0x7254('0x3')]];}else{delete agents[_0x1703de['destuniqueid']];}}exports['agentcalled']=function(_0xaf9301){try{agents[_0xaf9301[_0x7254('0x10')]]=_0xaf9301;agents[_0xaf9301[_0x7254('0x10')]][_0x7254('0x11')]=utils[_0x7254('0x12')]();agents[_0xaf9301[_0x7254('0x10')]][_0x7254('0x6')]='called';agents[_0xaf9301[_0x7254('0x10')]][_0x7254('0x5')]=null;agents[_0xaf9301[_0x7254('0x10')]][_0x7254('0x13')]=null;}catch(_0x30b39e){utils[_0x7254('0x14')](_0x30b39e['stack']);}};exports[_0x7254('0x15')]=function(_0x4f789f){try{if(!_[_0x7254('0x16')](agents[_0x4f789f['destuniqueid']])){agents[_0x4f789f[_0x7254('0x10')]]['agentringnoanswer']=!![];agents[_0x4f789f['destuniqueid']][_0x7254('0x17')]=utils[_0x7254('0x12')]();agents[_0x4f789f[_0x7254('0x10')]][_0x7254('0x6')]=_0x7254('0x18');agents[_0x4f789f[_0x7254('0x10')]][_0x7254('0x19')]=_0x7254('0x18');agents[_0x4f789f[_0x7254('0x10')]][_0x7254('0x1a')]=_0x4f789f[_0x7254('0x1b')]?parseInt(_0x4f789f[_0x7254('0x1b')])/0x3e8:0x0;agents[_0x4f789f[_0x7254('0x10')]][_0x7254('0x1c')]=0x0;unanswered[_0x7254('0x1d')](_0x4f789f[_0x7254('0x10')]);}}catch(_0x2f2097){utils[_0x7254('0x14')](_0x2f2097['stack']);}};exports['queuecallerabandon']=function(_0x371077){try{_[_0x7254('0x1e')](agents,function(_0x1139cf,_0x2661f9){if(_0x1139cf[_0x7254('0x3')]==_0x371077['uniqueid']&&!_[_0x7254('0x1f')](unanswered,_0x1139cf['destuniqueid'])){_0x1139cf[_0x7254('0x15')]=!![];_0x1139cf[_0x7254('0x17')]=utils['now']();_0x1139cf['lastevent']=_0x7254('0x20');_0x1139cf[_0x7254('0x19')]=_0x7254('0x20');_0x1139cf[_0x7254('0x1a')]=_0x371077[_0x7254('0x1a')];_0x1139cf[_0x7254('0x1c')]=0x0;writeDB(_0x1139cf);}});}catch(_0x409cca){utils['error'](_0x409cca['stack']);}};exports[_0x7254('0x21')]=function(_0x4d4ea9){try{if(agents[_0x4d4ea9[_0x7254('0x10')]]){agents[_0x4d4ea9[_0x7254('0x10')]]['agentconnectAt']=utils[_0x7254('0x12')]();agents[_0x4d4ea9['destuniqueid']][_0x7254('0x5')]=_0x4d4ea9[_0x7254('0x5')];agents[_0x4d4ea9[_0x7254('0x10')]][_0x7254('0x13')]=_0x4d4ea9[_0x7254('0x13')];agents[_0x4d4ea9[_0x7254('0x10')]]['holdtime']=_0x4d4ea9[_0x7254('0x1b')];agents[_0x4d4ea9['destuniqueid']][_0x7254('0x6')]='connect';_[_0x7254('0x1e')](agents,function(_0x41e937,_0x4c51db){if(_0x41e937[_0x7254('0x10')]!=_0x4d4ea9[_0x7254('0x10')]&&_0x41e937['uniqueid']==_0x4d4ea9['uniqueid']){_0x41e937[_0x7254('0x1c')]=0x0;_0x41e937[_0x7254('0x1a')]=_0x4d4ea9[_0x7254('0x1b')];_0x41e937['agentringnoanswer']=!![];_0x41e937[_0x7254('0x17')]=utils[_0x7254('0x12')]();_0x41e937['lastevent']=_0x7254('0x22');_0x41e937[_0x7254('0x19')]=_0x7254('0x22');_0x41e937[_0x7254('0x23')]=_0x4d4ea9[_0x7254('0x10')];_0x41e937[_0x7254('0x24')]=_0x4d4ea9['membername'];writeDB(_0x41e937);}});}}catch(_0x5b00dd){utils[_0x7254('0x14')](_0x5b00dd[_0x7254('0x25')]);}};exports[_0x7254('0x26')]=function(_0x4e8022){try{if(!_[_0x7254('0x16')](agents[_0x4e8022[_0x7254('0x10')]])){agents[_0x4e8022['destuniqueid']][_0x7254('0x26')]=!![];agents[_0x4e8022['destuniqueid']]['agentcompleteAt']=utils[_0x7254('0x12')]();agents[_0x4e8022[_0x7254('0x10')]]['talktime']=utils[_0x7254('0x27')](agents[_0x4e8022['destuniqueid']][_0x7254('0x28')],agents[_0x4e8022['destuniqueid']]['agentconnectAt']);agents[_0x4e8022[_0x7254('0x10')]]['reason']=_0x4e8022['reason'];agents[_0x4e8022[_0x7254('0x10')]][_0x7254('0x6')]=_0x7254('0x29');writeDB(agents[_0x4e8022[_0x7254('0x10')]]);}}catch(_0x4312a7){utils[_0x7254('0x14')](_0x4312a7[_0x7254('0x25')]);}};exports[_0x7254('0x2a')]=function(_0x218fd0){try{if(!_['isNil'](agents[_0x218fd0[_0x7254('0x2b')]])){agents[_0x218fd0[_0x7254('0x2b')]][_0x7254('0x2c')]=!![];agents[_0x218fd0[_0x7254('0x2b')]][_0x7254('0x2d')]=_0x7254('0x2e');agents[_0x218fd0[_0x7254('0x2b')]]['transferexten']=_0x218fd0[_0x7254('0x2f')];agents[_0x218fd0[_0x7254('0x2b')]][_0x7254('0x30')]=agents[_0x218fd0['transfereruniqueid']][_0x7254('0x3')];}}catch(_0x596fd2){utils[_0x7254('0x14')](_0x596fd2[_0x7254('0x25')]);}};exports[_0x7254('0x31')]=function(_0x23385a){try{if(_0x23385a[_0x7254('0x32')]==_0x23385a['origtransfererlinkedid']){if(!_[_0x7254('0x16')](agents[_0x23385a[_0x7254('0x33')]])){agents[_0x23385a[_0x7254('0x33')]]['transfer']=!![];agents[_0x23385a[_0x7254('0x33')]][_0x7254('0x2d')]=_0x7254('0x34');agents[_0x23385a[_0x7254('0x33')]][_0x7254('0x35')]=_0x23385a[_0x7254('0x36')];agents[_0x23385a[_0x7254('0x33')]][_0x7254('0x30')]=_0x23385a['origtransfereruniqueid'];}if(_0x23385a['transfereeuniqueid']&&agents[_0x23385a['transfereeuniqueid']]){agents[_0x23385a['transfereeuniqueid']][_0x7254('0x37')]=0x1;transfers[_0x23385a['transfereeuniqueid']]=_['clone'](agents[_0x23385a[_0x7254('0x38')]]);transfers[_0x23385a[_0x7254('0x38')]][_0x7254('0x39')]=agents[_0x23385a[_0x7254('0x33')]][_0x7254('0x39')];transfers[_0x23385a['transfereeuniqueid']][_0x7254('0x3a')]=agents[_0x23385a[_0x7254('0x33')]][_0x7254('0x3a')];transfers[_0x23385a[_0x7254('0x38')]]['agentcalledAt']=utils[_0x7254('0x12')]();transfers[_0x23385a[_0x7254('0x38')]]['agentconnectAt']=utils['now']();transfers[_0x23385a['transfereeuniqueid']][_0x7254('0x1a')]=0x0;transfers[_0x23385a[_0x7254('0x38')]][_0x7254('0x37')]=0x2;}}else if(_0x23385a[_0x7254('0x33')]==_0x23385a[_0x7254('0x3b')]){if(!_[_0x7254('0x16')](agents[_0x23385a[_0x7254('0x32')]])){agents[_0x23385a['origtransfereruniqueid']][_0x7254('0x2c')]=!![];agents[_0x23385a[_0x7254('0x32')]]['transfertype']=_0x7254('0x34');agents[_0x23385a['origtransfereruniqueid']][_0x7254('0x35')]=_0x23385a[_0x7254('0x3c')];agents[_0x23385a[_0x7254('0x32')]][_0x7254('0x30')]=_0x23385a[_0x7254('0x33')];}if(_0x23385a[_0x7254('0x3d')]&&agents[_0x23385a['transfertargetuniqueid']]){agents[_0x23385a[_0x7254('0x3d')]]['agententerreason']=0x1;transfers[_0x23385a[_0x7254('0x3d')]]=_[_0x7254('0x3e')](agents[_0x23385a['transfertargetuniqueid']]);transfers[_0x23385a['transfertargetuniqueid']][_0x7254('0x39')]=agents[_0x23385a[_0x7254('0x32')]][_0x7254('0x39')];transfers[_0x23385a[_0x7254('0x3d')]][_0x7254('0x3a')]=agents[_0x23385a[_0x7254('0x32')]][_0x7254('0x3a')];transfers[_0x23385a[_0x7254('0x3d')]][_0x7254('0x11')]=utils[_0x7254('0x12')]();transfers[_0x23385a[_0x7254('0x3d')]]['agentconnectAt']=utils[_0x7254('0x12')]();transfers[_0x23385a[_0x7254('0x3d')]]['holdtime']=0x0;transfers[_0x23385a[_0x7254('0x3d')]][_0x7254('0x37')]=0x2;}}}catch(_0x1387bd){utils[_0x7254('0x14')](_0x1387bd[_0x7254('0x25')]);}};exports[_0x7254('0x3f')]=function(_0x191c86){try{if(agents[_0x191c86[_0x7254('0x3')]]&&agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x19')]===_0x7254('0x18')){if(_0x191c86[_0x7254('0x40')]==='21'){agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x19')]=_0x7254('0x41');agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x6')]=_0x7254('0x41');}writeDB(agents[_0x191c86[_0x7254('0x3')]]);var _0xb64e43=unanswered['indexOf'](_0x191c86['uniqueid']);if(_0xb64e43>-0x1)unanswered[_0x7254('0x42')](_0xb64e43,0x1);}if(transfers[_0x191c86[_0x7254('0x3')]]){transfers[_0x191c86[_0x7254('0x3')]][_0x7254('0x26')]=!![];transfers[_0x191c86[_0x7254('0x3')]][_0x7254('0x28')]=utils['now']();transfers[_0x191c86[_0x7254('0x3')]][_0x7254('0x1c')]=utils['diffTime'](transfers[_0x191c86[_0x7254('0x3')]][_0x7254('0x28')],transfers[_0x191c86[_0x7254('0x3')]]['agentconnectAt']);transfers[_0x191c86[_0x7254('0x3')]][_0x7254('0x19')]=_0x7254('0x43');transfers[_0x191c86[_0x7254('0x3')]]['lastevent']=_0x7254('0x29');writeDB(transfers[_0x191c86[_0x7254('0x3')]],!![]);}if(agents[_0x191c86[_0x7254('0x3')]]&&agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x44')]){agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x26')]=!![];agents[_0x191c86[_0x7254('0x3')]]['agentcompleteAt']=utils[_0x7254('0x12')]();agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x1c')]=utils['diffTime'](agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x28')],agents[_0x191c86['uniqueid']][_0x7254('0x44')]);agents[_0x191c86['uniqueid']][_0x7254('0x19')]=agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x2c')]?'transfer':_0x7254('0x43');agents[_0x191c86['uniqueid']][_0x7254('0x6')]=_0x7254('0x29');writeDB(agents[_0x191c86[_0x7254('0x3')]]);}}catch(_0x5a3e6b){utils[_0x7254('0x14')](_0x5a3e6b['stack']);}}; \ No newline at end of file +var _0x42b1=['connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','reason','timeout','ringtime','talktime','push','queuecallerabandon','uniqueid','abandoned','holdtime','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheremembername','membername','agentcompleteAt','diffTime','blindtransfer','transfereruniqueid','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','transfertype','ATTENDED','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','transferexten','secondtransfererexten','transfertargetuniqueid','clone','hangup','cause','rejected','indexOf','splice','agent','complete','lodash','util','./utils','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','queue','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','agentcalledAt','now','lastevent','called'];(function(_0x3ba963,_0x26436b){var _0x5d0bc4=function(_0x136c03){while(--_0x136c03){_0x3ba963['push'](_0x3ba963['shift']());}};_0x5d0bc4(++_0x26436b);}(_0x42b1,0xc2));var _0x142b=function(_0x5a35fa,_0x4f6a88){_0x5a35fa=_0x5a35fa-0x0;var _0x35f574=_0x42b1[_0x5a35fa];return _0x35f574;};'use strict';var _=require(_0x142b('0x0'));var util=require(_0x142b('0x1'));var utils=require(_0x142b('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x268b33,_0x455db9){utils[_0x142b('0x3')](util['format'](_0x142b('0x4'),_0x268b33['uniqueid'],_0x268b33['channel'],_0x268b33[_0x142b('0x5')],_0x268b33['membername'],_0x268b33[_0x142b('0x6')],_0x268b33[_0x142b('0x7')],_0x268b33[_0x142b('0x8')],_0x268b33['lastevent']));if(_0x268b33[_0x142b('0x5')]){utils[_0x142b('0x9')](_0x268b33['queue'])[_0x142b('0xa')](function(_0x34e95c){if(_0x34e95c){_0x268b33['type']=_0x34e95c[_0x142b('0xb')];_0x268b33[_0x142b('0xc')]=_0x268b33[_0x142b('0xd')]?_0x34e95c[_0x142b('0xe')]:![];_0x268b33[_0x142b('0xf')]=_0x268b33['agentacw']?_0x34e95c[_0x142b('0x10')]:0x0;}utils[_0x142b('0x11')](_0x142b('0x12'),_0x268b33);});}else{utils['request']('CreateVoiceAgentReport',_0x268b33);}if(_0x455db9){delete transfers[_0x268b33['uniqueid']];}else{delete agents[_0x268b33['destuniqueid']];}}exports[_0x142b('0x13')]=function(_0x46d6a7){try{agents[_0x46d6a7[_0x142b('0x14')]]=_0x46d6a7;agents[_0x46d6a7[_0x142b('0x14')]][_0x142b('0x15')]=utils[_0x142b('0x16')]();agents[_0x46d6a7[_0x142b('0x14')]][_0x142b('0x17')]=_0x142b('0x18');agents[_0x46d6a7['destuniqueid']]['connectedlinenum']=null;agents[_0x46d6a7[_0x142b('0x14')]][_0x142b('0x19')]=null;}catch(_0x44df0a){utils[_0x142b('0x1a')](_0x44df0a[_0x142b('0x1b')]);}};exports[_0x142b('0x1c')]=function(_0x19eb91){try{if(!_[_0x142b('0x1d')](agents[_0x19eb91['destuniqueid']])){agents[_0x19eb91[_0x142b('0x14')]][_0x142b('0x1c')]=!![];agents[_0x19eb91[_0x142b('0x14')]][_0x142b('0x1e')]=utils[_0x142b('0x16')]();agents[_0x19eb91[_0x142b('0x14')]][_0x142b('0x17')]='timeout';agents[_0x19eb91[_0x142b('0x14')]][_0x142b('0x1f')]=_0x142b('0x20');agents[_0x19eb91[_0x142b('0x14')]]['holdtime']=_0x19eb91[_0x142b('0x21')]?parseInt(_0x19eb91[_0x142b('0x21')])/0x3e8:0x0;agents[_0x19eb91[_0x142b('0x14')]][_0x142b('0x22')]=0x0;unanswered[_0x142b('0x23')](_0x19eb91['destuniqueid']);}}catch(_0x2ec2d5){utils[_0x142b('0x1a')](_0x2ec2d5[_0x142b('0x1b')]);}};exports[_0x142b('0x24')]=function(_0xfa473f){try{_['forIn'](agents,function(_0x1feb0a,_0x4f24e0){if(_0x1feb0a['uniqueid']==_0xfa473f[_0x142b('0x25')]&&!_['includes'](unanswered,_0x1feb0a['destuniqueid'])){_0x1feb0a[_0x142b('0x1c')]=!![];_0x1feb0a[_0x142b('0x1e')]=utils[_0x142b('0x16')]();_0x1feb0a[_0x142b('0x17')]=_0x142b('0x26');_0x1feb0a[_0x142b('0x1f')]='abandoned';_0x1feb0a[_0x142b('0x27')]=_0xfa473f['holdtime'];_0x1feb0a[_0x142b('0x22')]=0x0;writeDB(_0x1feb0a);}});}catch(_0x304fb0){utils[_0x142b('0x1a')](_0x304fb0['stack']);}};exports['agentconnect']=function(_0x58fb2c){try{if(agents[_0x58fb2c[_0x142b('0x14')]]){agents[_0x58fb2c[_0x142b('0x14')]][_0x142b('0x28')]=utils['now']();agents[_0x58fb2c[_0x142b('0x14')]]['connectedlinenum']=_0x58fb2c[_0x142b('0x8')];agents[_0x58fb2c['destuniqueid']][_0x142b('0x19')]=_0x58fb2c[_0x142b('0x19')];agents[_0x58fb2c[_0x142b('0x14')]][_0x142b('0x27')]=_0x58fb2c[_0x142b('0x21')];agents[_0x58fb2c['destuniqueid']]['lastevent']=_0x142b('0x29');_[_0x142b('0x2a')](agents,function(_0x533158,_0x61334a){if(_0x533158[_0x142b('0x14')]!=_0x58fb2c[_0x142b('0x14')]&&_0x533158[_0x142b('0x25')]==_0x58fb2c[_0x142b('0x25')]){_0x533158['talktime']=0x0;_0x533158[_0x142b('0x27')]=_0x58fb2c[_0x142b('0x21')];_0x533158['agentringnoanswer']=!![];_0x533158[_0x142b('0x1e')]=utils['now']();_0x533158[_0x142b('0x17')]=_0x142b('0x2b');_0x533158[_0x142b('0x1f')]=_0x142b('0x2b');_0x533158['answeredelsewheredestinationuniqueid']=_0x58fb2c['destuniqueid'];_0x533158[_0x142b('0x2c')]=_0x58fb2c[_0x142b('0x2d')];writeDB(_0x533158);}});}}catch(_0x3a9428){utils[_0x142b('0x1a')](_0x3a9428[_0x142b('0x1b')]);}};exports[_0x142b('0xd')]=function(_0x4f8e04){try{if(!_[_0x142b('0x1d')](agents[_0x4f8e04[_0x142b('0x14')]])){agents[_0x4f8e04[_0x142b('0x14')]]['agentcomplete']=!![];agents[_0x4f8e04[_0x142b('0x14')]][_0x142b('0x2e')]=utils[_0x142b('0x16')]();agents[_0x4f8e04[_0x142b('0x14')]]['talktime']=utils[_0x142b('0x2f')](agents[_0x4f8e04[_0x142b('0x14')]][_0x142b('0x2e')],agents[_0x4f8e04['destuniqueid']]['agentconnectAt']);agents[_0x4f8e04[_0x142b('0x14')]][_0x142b('0x1f')]=_0x4f8e04['reason'];agents[_0x4f8e04[_0x142b('0x14')]][_0x142b('0x17')]='complete';writeDB(agents[_0x4f8e04[_0x142b('0x14')]]);}}catch(_0x10422c){utils[_0x142b('0x1a')](_0x10422c['stack']);}};exports[_0x142b('0x30')]=function(_0x5c6a8b){try{if(!_['isNil'](agents[_0x5c6a8b['transfereruniqueid']])){agents[_0x5c6a8b[_0x142b('0x31')]]['transfer']=!![];agents[_0x5c6a8b[_0x142b('0x31')]]['transfertype']='blind';agents[_0x5c6a8b[_0x142b('0x31')]]['transferexten']=_0x5c6a8b[_0x142b('0x32')];agents[_0x5c6a8b['transfereruniqueid']][_0x142b('0x33')]=agents[_0x5c6a8b['transfereruniqueid']]['uniqueid'];}}catch(_0x1ca5f8){utils[_0x142b('0x1a')](_0x1ca5f8[_0x142b('0x1b')]);}};exports['attendedtransfer']=function(_0x45104b){try{if(_0x45104b[_0x142b('0x34')]==_0x45104b[_0x142b('0x35')]){if(!_[_0x142b('0x1d')](agents[_0x45104b[_0x142b('0x36')]])){agents[_0x45104b[_0x142b('0x36')]][_0x142b('0x37')]=!![];agents[_0x45104b[_0x142b('0x36')]][_0x142b('0x38')]=_0x142b('0x39');agents[_0x45104b[_0x142b('0x36')]]['transferexten']=_0x45104b['origtransfererexten'];agents[_0x45104b['secondtransfereruniqueid']][_0x142b('0x33')]=_0x45104b[_0x142b('0x34')];}if(_0x45104b[_0x142b('0x3a')]&&agents[_0x45104b[_0x142b('0x3a')]]){agents[_0x45104b[_0x142b('0x3a')]][_0x142b('0x3b')]=0x1;transfers[_0x45104b[_0x142b('0x3a')]]=_['clone'](agents[_0x45104b[_0x142b('0x3a')]]);transfers[_0x45104b['transfereeuniqueid']][_0x142b('0x7')]=agents[_0x45104b['secondtransfereruniqueid']][_0x142b('0x7')];transfers[_0x45104b[_0x142b('0x3a')]][_0x142b('0x3c')]=agents[_0x45104b[_0x142b('0x36')]][_0x142b('0x3c')];transfers[_0x45104b[_0x142b('0x3a')]][_0x142b('0x15')]=utils[_0x142b('0x16')]();transfers[_0x45104b[_0x142b('0x3a')]][_0x142b('0x28')]=utils['now']();transfers[_0x45104b[_0x142b('0x3a')]][_0x142b('0x27')]=0x0;transfers[_0x45104b[_0x142b('0x3a')]]['agententerreason']=0x2;}}else if(_0x45104b[_0x142b('0x36')]==_0x45104b[_0x142b('0x3d')]){if(!_[_0x142b('0x1d')](agents[_0x45104b[_0x142b('0x34')]])){agents[_0x45104b[_0x142b('0x34')]]['transfer']=!![];agents[_0x45104b[_0x142b('0x34')]][_0x142b('0x38')]=_0x142b('0x39');agents[_0x45104b[_0x142b('0x34')]][_0x142b('0x3e')]=_0x45104b[_0x142b('0x3f')];agents[_0x45104b['origtransfereruniqueid']][_0x142b('0x33')]=_0x45104b['secondtransfereruniqueid'];}if(_0x45104b['transfertargetuniqueid']&&agents[_0x45104b[_0x142b('0x40')]]){agents[_0x45104b[_0x142b('0x40')]][_0x142b('0x3b')]=0x1;transfers[_0x45104b[_0x142b('0x40')]]=_[_0x142b('0x41')](agents[_0x45104b['transfertargetuniqueid']]);transfers[_0x45104b[_0x142b('0x40')]][_0x142b('0x7')]=agents[_0x45104b[_0x142b('0x34')]][_0x142b('0x7')];transfers[_0x45104b[_0x142b('0x40')]][_0x142b('0x3c')]=agents[_0x45104b['origtransfereruniqueid']][_0x142b('0x3c')];transfers[_0x45104b[_0x142b('0x40')]][_0x142b('0x15')]=utils[_0x142b('0x16')]();transfers[_0x45104b[_0x142b('0x40')]][_0x142b('0x28')]=utils[_0x142b('0x16')]();transfers[_0x45104b[_0x142b('0x40')]][_0x142b('0x27')]=0x0;transfers[_0x45104b[_0x142b('0x40')]]['agententerreason']=0x2;}}}catch(_0x4bc65f){utils[_0x142b('0x1a')](_0x4bc65f[_0x142b('0x1b')]);}};exports[_0x142b('0x42')]=function(_0x4b8f5b){try{if(agents[_0x4b8f5b['uniqueid']]&&agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x1f')]===_0x142b('0x20')){if(_0x4b8f5b[_0x142b('0x43')]==='21'){agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x1f')]=_0x142b('0x44');agents[_0x4b8f5b[_0x142b('0x25')]]['lastevent']=_0x142b('0x44');}writeDB(agents[_0x4b8f5b['uniqueid']]);var _0x3cf129=unanswered[_0x142b('0x45')](_0x4b8f5b[_0x142b('0x25')]);if(_0x3cf129>-0x1)unanswered[_0x142b('0x46')](_0x3cf129,0x1);}if(transfers[_0x4b8f5b[_0x142b('0x25')]]){transfers[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0xd')]=!![];transfers[_0x4b8f5b['uniqueid']][_0x142b('0x2e')]=utils[_0x142b('0x16')]();transfers[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x22')]=utils[_0x142b('0x2f')](transfers[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x2e')],transfers[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x28')]);transfers[_0x4b8f5b['uniqueid']][_0x142b('0x1f')]=_0x142b('0x47');transfers[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x17')]=_0x142b('0x48');writeDB(transfers[_0x4b8f5b[_0x142b('0x25')]],!![]);}if(agents[_0x4b8f5b[_0x142b('0x25')]]&&agents[_0x4b8f5b[_0x142b('0x25')]]['agentconnectAt']){agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0xd')]=!![];agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x2e')]=utils[_0x142b('0x16')]();agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x22')]=utils[_0x142b('0x2f')](agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x2e')],agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x28')]);agents[_0x4b8f5b['uniqueid']][_0x142b('0x1f')]=agents[_0x4b8f5b['uniqueid']][_0x142b('0x37')]?'transfer':_0x142b('0x47');agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x17')]='complete';writeDB(agents[_0x4b8f5b[_0x142b('0x25')]]);}}catch(_0x561049){utils[_0x142b('0x1a')](_0x561049['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index fa0f99c..0a6cd5f 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 _0x28e7=['isNil','channelstate','systemanswertime','transfer','destinationchannel','answertime','toNumber','stack','hangup','calleridname','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','error','musiconholdstart','musiconholdstop','musiconholdstartAt','mohtime','variable','xmd-originatecalleridnum','source','value','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','noop','gotoif','lastapplication','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','type','callerid','disposition','accountcode','getUserByInternal','then','CreateVoiceCallReport','request','uniqueid','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','context','now','newstate'];(function(_0x3fa366,_0x13499d){var _0x46991c=function(_0x246145){while(--_0x246145){_0x3fa366['push'](_0x3fa366['shift']());}};_0x46991c(++_0x13499d);}(_0x28e7,0x185));var _0x728e=function(_0x1319a3,_0x30f18c){_0x1319a3=_0x1319a3-0x0;var _0x37228c=_0x28e7[_0x1319a3];return _0x37228c;};'use strict';var _=require(_0x728e('0x0'));var util=require('util');var utils=require(_0x728e('0x1'));var dispositions=[_0x728e('0x2'),_0x728e('0x3'),_0x728e('0x3'),'NO\x20ANSWER',_0x728e('0x2'),_0x728e('0x2'),_0x728e('0x4'),_0x728e('0x5'),_0x728e('0x3'),'FAILED',_0x728e('0x3')];var channels={};function writeDB(_0x5e4c30){utils[_0x728e('0x6')](util[_0x728e('0x7')](_0x728e('0x8'),_0x5e4c30['uniqueid'],_0x5e4c30[_0x728e('0x9')],_0x5e4c30[_0x728e('0xa')],_0x5e4c30['accountcode'],_0x5e4c30['source'],_0x5e4c30['destination'],_0x5e4c30[_0x728e('0xb')],_0x5e4c30[_0x728e('0xc')]));if(_0x5e4c30[_0x728e('0xd')]){utils[_0x728e('0xe')](_0x5e4c30[_0x728e('0xd')])[_0x728e('0xf')](function(_0x2cddab){if(_0x2cddab){_0x5e4c30['UserId']=_0x2cddab['id'];}utils['request'](_0x728e('0x10'),_0x5e4c30);});}else{utils[_0x728e('0x11')]('CreateVoiceCallReport',_0x5e4c30);}if(channels[_0x5e4c30['uniqueid']]){delete channels[_0x5e4c30[_0x728e('0x12')]];}}exports[_0x728e('0x13')]=function(_0x407549){try{if(_0x407549['uniqueid']==_0x407549[_0x728e('0x14')]&&_0x407549[_0x728e('0x9')]!=_0x728e('0x15')){channels[_0x407549[_0x728e('0x12')]]={'uniqueid':_0x407549[_0x728e('0x12')],'accountcode':_0x407549[_0x728e('0xd')],'source':_0x407549[_0x728e('0x16')],'destination':_0x407549['exten'],'destinationcontext':_0x407549[_0x728e('0x17')],'channel':_0x407549['channel'],'starttime':utils[_0x728e('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x728e('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x49bdb9){utils['error'](_0x49bdb9['stack']);}};exports[_0x728e('0x19')]=function(_0x5c9709){try{if(!_[_0x728e('0x1a')](channels[_0x5c9709['uniqueid']])&&_0x5c9709[_0x728e('0x1b')]==0x6){if(_[_0x728e('0x1a')](channels[_0x5c9709[_0x728e('0x12')]]['systemanswertime'])){channels[_0x5c9709[_0x728e('0x12')]][_0x728e('0x1c')]=utils['now']();}}else if(!_['isNil'](channels[_0x5c9709[_0x728e('0x14')]])&&_0x5c9709[_0x728e('0x1b')]==0x6&&_0x5c9709[_0x728e('0x17')]!=_0x728e('0x1d')){channels[_0x5c9709['linkedid']][_0x728e('0xd')]=_0x5c9709[_0x728e('0xd')];channels[_0x5c9709[_0x728e('0x14')]][_0x728e('0x1e')]=_0x5c9709[_0x728e('0x9')];if(_[_0x728e('0x1a')](channels[_0x5c9709['linkedid']][_0x728e('0x1f')])){channels[_0x5c9709[_0x728e('0x14')]][_0x728e('0x1f')]=utils['now']();}channels[_0x5c9709['linkedid']][_0x728e('0xc')]=dispositions[_[_0x728e('0x20')](_0x5c9709[_0x728e('0x1b')])]||_0x728e('0x4');}}catch(_0x4c83ac){utils['error'](_0x4c83ac[_0x728e('0x21')]);}};exports[_0x728e('0x22')]=function(_0x403ff8){try{if(!_[_0x728e('0x1a')](channels[_0x403ff8[_0x728e('0x12')]])){if(_[_0x728e('0x1a')](channels[_0x403ff8[_0x728e('0x12')]][_0x728e('0xb')])){channels[_0x403ff8['uniqueid']]['callerid']=_0x403ff8[_0x728e('0x23')]+'\x20<'+_0x403ff8['calleridnum']+'>';}channels[_0x403ff8[_0x728e('0x12')]][_0x728e('0x24')]=utils[_0x728e('0x18')]();channels[_0x403ff8['uniqueid']]['duration']=utils['diffTime'](channels[_0x403ff8[_0x728e('0x12')]][_0x728e('0x24')],channels[_0x403ff8[_0x728e('0x12')]][_0x728e('0x25')]);channels[_0x403ff8[_0x728e('0x12')]][_0x728e('0x26')]=channels[_0x403ff8['uniqueid']][_0x728e('0x1f')]?utils[_0x728e('0x27')](channels[_0x403ff8[_0x728e('0x12')]][_0x728e('0x24')],channels[_0x403ff8[_0x728e('0x12')]]['answertime']):0x0;writeDB(channels[_0x403ff8['uniqueid']]);}}catch(_0x495d94){utils['error'](_0x495d94['stack']);}};exports[_0x728e('0x28')]=function(_0x1469de){try{if(!_[_0x728e('0x1a')](channels[_0x1469de['localtwolinkedid']])){if(channels[_0x1469de[_0x728e('0x29')]][_0x728e('0x9')]==_0x1469de[_0x728e('0x2a')]){channels[_0x1469de['localtwolinkedid']]['destinationchannel']=_0x1469de[_0x728e('0x2b')];channels[_0x1469de[_0x728e('0x29')]][_0x728e('0x2c')]=_0x728e('0x2d');}else if(channels[_0x1469de[_0x728e('0x29')]]['channel']=_0x1469de[_0x728e('0x2e')]){channels[_0x1469de[_0x728e('0x29')]][_0x728e('0x1e')]=_0x1469de[_0x728e('0x2f')];channels[_0x1469de[_0x728e('0x29')]][_0x728e('0x2c')]=_0x728e('0x2d');}}}catch(_0x421dbe){utils[_0x728e('0x30')](_0x421dbe[_0x728e('0x21')]);}};exports[_0x728e('0x31')]=function(_0x2003d5){try{if(!_[_0x728e('0x1a')](channels[_0x2003d5[_0x728e('0x12')]])){channels[_0x2003d5[_0x728e('0x12')]]['musiconholdstartAt']=utils[_0x728e('0x18')]();}}catch(_0x31fb59){utils['error'](_0x31fb59[_0x728e('0x21')]);}};exports[_0x728e('0x32')]=function(_0x459958){try{if(!_['isNil'](channels[_0x459958[_0x728e('0x12')]])){if(!_[_0x728e('0x1a')](channels[_0x459958[_0x728e('0x12')]][_0x728e('0x33')])){channels[_0x459958[_0x728e('0x12')]][_0x728e('0x34')]+=utils[_0x728e('0x27')](utils[_0x728e('0x18')](),channels[_0x459958[_0x728e('0x12')]][_0x728e('0x33')]);delete channels[_0x459958[_0x728e('0x12')]][_0x728e('0x33')];}}}catch(_0x565221){utils['error'](_0x565221[_0x728e('0x21')]);}};exports['varset']=function(_0x36facd){try{if(!_[_0x728e('0x1a')](channels[_0x36facd['uniqueid']])){if(!_[_0x728e('0x1a')](_0x36facd[_0x728e('0x35')][_0x728e('0x36')])){channels[_0x36facd[_0x728e('0x12')]][_0x728e('0x37')]=_0x36facd[_0x728e('0x38')];}if(!_['isNil'](_0x36facd['variable']['xmd-phone'])){channels[_0x36facd[_0x728e('0x12')]][_0x728e('0x39')]=_0x36facd[_0x728e('0x38')];channels[_0x36facd[_0x728e('0x12')]][_0x728e('0xb')]='\x22'+_0x36facd[_0x728e('0x38')]+'\x22\x20<'+_0x36facd[_0x728e('0x38')]+'>';}if(!_['isNil'](_0x36facd['variable'][_0x728e('0x3a')])||!_[_0x728e('0x1a')](_0x36facd[_0x728e('0x35')][_0x728e('0x3b')])){channels[_0x36facd[_0x728e('0x12')]][_0x728e('0xb')]=_0x36facd['value'];}if(!_[_0x728e('0x1a')](_0x36facd['variable'][_0x728e('0x3c')])||!_[_0x728e('0x1a')](_0x36facd['variable'][_0x728e('0x3d')])){channels[_0x36facd[_0x728e('0x12')]]['lastapplication']=_0x728e('0x3e');channels[_0x36facd[_0x728e('0x12')]][_0x728e('0x3f')]=_0x36facd[_0x728e('0x38')];channels[_0x36facd['uniqueid']][_0x728e('0x40')]=!![];}if(!_[_0x728e('0x1a')](_0x36facd['variable'][_0x728e('0x41')])){channels[_0x36facd[_0x728e('0x12')]][_0x728e('0x42')]=_0x36facd['value'];}if(!_['isNil'](_0x36facd[_0x728e('0x35')][_0x728e('0x43')])){channels[_0x36facd[_0x728e('0x12')]][_0x728e('0xa')]=_0x36facd[_0x728e('0x38')];}if(!_['isNil'](_0x36facd[_0x728e('0x35')][_0x728e('0x44')])){channels[_0x36facd['uniqueid']][_0x728e('0x45')]=_0x36facd[_0x728e('0x38')];}if(!_[_0x728e('0x1a')](_0x36facd[_0x728e('0x35')][_0x728e('0x46')])){channels[_0x36facd[_0x728e('0x12')]][_0x728e('0x46')]=_0x36facd[_0x728e('0x38')];}}}catch(_0xfd29d){utils[_0x728e('0x30')](_0xfd29d[_0x728e('0x21')]);}};exports[_0x728e('0x47')]=function(_0x24c5e0){try{if(!_['isNil'](channels[_0x24c5e0[_0x728e('0x12')]])){if(_0x24c5e0[_0x728e('0x48')][_0x728e('0x49')]()==_0x728e('0x4a')&&_[_0x728e('0x4b')](_0x24c5e0[_0x728e('0x4c')]['toLowerCase'](),'cdr')){var _0x11accb=_0x24c5e0[_0x728e('0x4c')][_0x728e('0x4d')]('=');var _0x1e5381=_0x11accb[0x0][_0x728e('0x4e')](_0x11accb[0x0]['lastIndexOf']('(')+0x1,_0x11accb[0x0][_0x728e('0x4f')](')'));var _0x3900f1=_0x11accb[0x1];channels[_0x24c5e0[_0x728e('0x12')]][_0x1e5381]=_0x3900f1;}if(!_['includes']([_0x728e('0x22'),_0x728e('0x50'),'execif',_0x728e('0x4a'),_0x728e('0x51')],_0x24c5e0[_0x728e('0x48')][_0x728e('0x49')]())){channels[_0x24c5e0[_0x728e('0x12')]][_0x728e('0x52')]=_0x24c5e0[_0x728e('0x48')];channels[_0x24c5e0[_0x728e('0x12')]][_0x728e('0x3f')]=_0x24c5e0['appdata'];}}}catch(_0x149270){utils[_0x728e('0x30')](_0x149270['stack']);}}; \ No newline at end of file +var _0x769c=['xmd-originatecalleridnum','source','value','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','Queue','lastdata','queue','xmd-contactid','outboundrouteid','routeid','sipcallid','toLowerCase','set','appdata','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','application','lastapplication','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','destination','callerid','disposition','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','exten','DOCUMENTATION','error','stack','isNil','systemanswertime','now','context','transfer','destinationchannel','answertime','toNumber','hangup','calleridname','duration','endtime','starttime','diffTime','attendedtransfer','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','musiconholdstart','musiconholdstartAt','mohtime','varset','variable'];(function(_0x345409,_0x24cf70){var _0x2d0dda=function(_0x5d6027){while(--_0x5d6027){_0x345409['push'](_0x345409['shift']());}};_0x2d0dda(++_0x24cf70);}(_0x769c,0x156));var _0xc769=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x769c[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xc769('0x0'));var util=require(_0xc769('0x1'));var utils=require(_0xc769('0x2'));var dispositions=[_0xc769('0x3'),_0xc769('0x4'),'FAILED',_0xc769('0x3'),'NO\x20ANSWER','NO\x20ANSWER','ANSWERED',_0xc769('0x5'),_0xc769('0x4'),_0xc769('0x4'),_0xc769('0x4')];var channels={};function writeDB(_0x2763e9){utils[_0xc769('0x6')](util[_0xc769('0x7')](_0xc769('0x8'),_0x2763e9[_0xc769('0x9')],_0x2763e9[_0xc769('0xa')],_0x2763e9[_0xc769('0xb')],_0x2763e9[_0xc769('0xc')],_0x2763e9['source'],_0x2763e9[_0xc769('0xd')],_0x2763e9[_0xc769('0xe')],_0x2763e9[_0xc769('0xf')]));if(_0x2763e9[_0xc769('0xc')]){utils[_0xc769('0x10')](_0x2763e9[_0xc769('0xc')])['then'](function(_0xd4aea5){if(_0xd4aea5){_0x2763e9[_0xc769('0x11')]=_0xd4aea5['id'];}utils[_0xc769('0x12')]('CreateVoiceCallReport',_0x2763e9);});}else{utils[_0xc769('0x12')](_0xc769('0x13'),_0x2763e9);}if(channels[_0x2763e9[_0xc769('0x9')]]){delete channels[_0x2763e9[_0xc769('0x9')]];}}exports[_0xc769('0x14')]=function(_0x1d3c6a){try{if(_0x1d3c6a['uniqueid']==_0x1d3c6a[_0xc769('0x15')]&&_0x1d3c6a[_0xc769('0xa')]!=_0xc769('0x16')){channels[_0x1d3c6a['uniqueid']]={'uniqueid':_0x1d3c6a['uniqueid'],'accountcode':_0x1d3c6a[_0xc769('0xc')],'source':_0x1d3c6a[_0xc769('0x17')],'destination':_0x1d3c6a[_0xc769('0x18')],'destinationcontext':_0x1d3c6a['context'],'channel':_0x1d3c6a[_0xc769('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc769('0x3'),'amaflags':_0xc769('0x19')};}}catch(_0x2e634d){utils[_0xc769('0x1a')](_0x2e634d[_0xc769('0x1b')]);}};exports['newstate']=function(_0xe034d7){try{if(!_[_0xc769('0x1c')](channels[_0xe034d7[_0xc769('0x9')]])&&_0xe034d7['channelstate']==0x6){if(_[_0xc769('0x1c')](channels[_0xe034d7['uniqueid']][_0xc769('0x1d')])){channels[_0xe034d7['uniqueid']][_0xc769('0x1d')]=utils[_0xc769('0x1e')]();}}else if(!_[_0xc769('0x1c')](channels[_0xe034d7[_0xc769('0x15')]])&&_0xe034d7['channelstate']==0x6&&_0xe034d7[_0xc769('0x1f')]!=_0xc769('0x20')){channels[_0xe034d7['linkedid']][_0xc769('0xc')]=_0xe034d7[_0xc769('0xc')];channels[_0xe034d7[_0xc769('0x15')]][_0xc769('0x21')]=_0xe034d7['channel'];if(_['isNil'](channels[_0xe034d7['linkedid']][_0xc769('0x22')])){channels[_0xe034d7[_0xc769('0x15')]][_0xc769('0x22')]=utils[_0xc769('0x1e')]();}channels[_0xe034d7['linkedid']]['disposition']=dispositions[_[_0xc769('0x23')](_0xe034d7['channelstate'])]||'ANSWERED';}}catch(_0x4a19cc){utils[_0xc769('0x1a')](_0x4a19cc['stack']);}};exports[_0xc769('0x24')]=function(_0x16531f){try{if(!_['isNil'](channels[_0x16531f['uniqueid']])){if(_['isNil'](channels[_0x16531f[_0xc769('0x9')]][_0xc769('0xe')])){channels[_0x16531f[_0xc769('0x9')]][_0xc769('0xe')]=_0x16531f[_0xc769('0x25')]+'\x20<'+_0x16531f[_0xc769('0x17')]+'>';}channels[_0x16531f[_0xc769('0x9')]]['endtime']=utils[_0xc769('0x1e')]();channels[_0x16531f[_0xc769('0x9')]][_0xc769('0x26')]=utils['diffTime'](channels[_0x16531f[_0xc769('0x9')]][_0xc769('0x27')],channels[_0x16531f[_0xc769('0x9')]][_0xc769('0x28')]);channels[_0x16531f[_0xc769('0x9')]]['billableseconds']=channels[_0x16531f[_0xc769('0x9')]][_0xc769('0x22')]?utils[_0xc769('0x29')](channels[_0x16531f[_0xc769('0x9')]][_0xc769('0x27')],channels[_0x16531f[_0xc769('0x9')]][_0xc769('0x22')]):0x0;writeDB(channels[_0x16531f[_0xc769('0x9')]]);}}catch(_0x10879e){utils[_0xc769('0x1a')](_0x10879e['stack']);}};exports[_0xc769('0x2a')]=function(_0x1c26e0){try{if(!_['isNil'](channels[_0x1c26e0['localtwolinkedid']])){if(channels[_0x1c26e0['localtwolinkedid']][_0xc769('0xa')]==_0x1c26e0['transfereechannel']){channels[_0x1c26e0[_0xc769('0x2b')]][_0xc769('0x21')]=_0x1c26e0[_0xc769('0x2c')];channels[_0x1c26e0[_0xc769('0x2b')]][_0xc769('0x2d')]=_0xc769('0x2e');}else if(channels[_0x1c26e0[_0xc769('0x2b')]]['channel']=_0x1c26e0[_0xc769('0x2f')]){channels[_0x1c26e0[_0xc769('0x2b')]][_0xc769('0x21')]=_0x1c26e0['origtransfererchannel'];channels[_0x1c26e0[_0xc769('0x2b')]]['userfield']=_0xc769('0x2e');}}}catch(_0xe940b9){utils['error'](_0xe940b9[_0xc769('0x1b')]);}};exports[_0xc769('0x30')]=function(_0x3db027){try{if(!_[_0xc769('0x1c')](channels[_0x3db027[_0xc769('0x9')]])){channels[_0x3db027[_0xc769('0x9')]][_0xc769('0x31')]=utils[_0xc769('0x1e')]();}}catch(_0x57b9f2){utils[_0xc769('0x1a')](_0x57b9f2[_0xc769('0x1b')]);}};exports['musiconholdstop']=function(_0x45d14a){try{if(!_[_0xc769('0x1c')](channels[_0x45d14a[_0xc769('0x9')]])){if(!_['isNil'](channels[_0x45d14a[_0xc769('0x9')]][_0xc769('0x31')])){channels[_0x45d14a['uniqueid']][_0xc769('0x32')]+=utils['diffTime'](utils[_0xc769('0x1e')](),channels[_0x45d14a[_0xc769('0x9')]][_0xc769('0x31')]);delete channels[_0x45d14a[_0xc769('0x9')]][_0xc769('0x31')];}}}catch(_0x31288d){utils[_0xc769('0x1a')](_0x31288d[_0xc769('0x1b')]);}};exports[_0xc769('0x33')]=function(_0x553adb){try{if(!_[_0xc769('0x1c')](channels[_0x553adb['uniqueid']])){if(!_['isNil'](_0x553adb[_0xc769('0x34')][_0xc769('0x35')])){channels[_0x553adb[_0xc769('0x9')]][_0xc769('0x36')]=_0x553adb[_0xc769('0x37')];}if(!_[_0xc769('0x1c')](_0x553adb[_0xc769('0x34')]['xmd-phone'])){channels[_0x553adb['uniqueid']][_0xc769('0xd')]=_0x553adb['value'];channels[_0x553adb['uniqueid']]['callerid']='\x22'+_0x553adb[_0xc769('0x37')]+_0xc769('0x38')+_0x553adb['value']+'>';}if(!_[_0xc769('0x1c')](_0x553adb[_0xc769('0x34')][_0xc769('0x39')])||!_['isNil'](_0x553adb[_0xc769('0x34')][_0xc769('0x3a')])){channels[_0x553adb['uniqueid']][_0xc769('0xe')]=_0x553adb[_0xc769('0x37')];}if(!_[_0xc769('0x1c')](_0x553adb[_0xc769('0x34')]['xmd-queue'])||!_[_0xc769('0x1c')](_0x553adb[_0xc769('0x34')][_0xc769('0x3b')])){channels[_0x553adb[_0xc769('0x9')]]['lastapplication']=_0xc769('0x3c');channels[_0x553adb[_0xc769('0x9')]][_0xc769('0x3d')]=_0x553adb['value'];channels[_0x553adb[_0xc769('0x9')]][_0xc769('0x3e')]=!![];}if(!_[_0xc769('0x1c')](_0x553adb['variable'][_0xc769('0x3f')])){channels[_0x553adb[_0xc769('0x9')]]['ContactId']=_0x553adb[_0xc769('0x37')];}if(!_[_0xc769('0x1c')](_0x553adb[_0xc769('0x34')]['xmd-cdrtype'])){channels[_0x553adb['uniqueid']][_0xc769('0xb')]=_0x553adb['value'];}if(!_[_0xc769('0x1c')](_0x553adb['variable'][_0xc769('0x40')])){channels[_0x553adb[_0xc769('0x9')]][_0xc769('0x41')]=_0x553adb[_0xc769('0x37')];}if(!_[_0xc769('0x1c')](_0x553adb[_0xc769('0x34')][_0xc769('0x42')])){channels[_0x553adb[_0xc769('0x9')]][_0xc769('0x42')]=_0x553adb[_0xc769('0x37')];}}}catch(_0x7f6dcf){utils['error'](_0x7f6dcf[_0xc769('0x1b')]);}};exports['newexten']=function(_0xaf1c66){try{if(!_[_0xc769('0x1c')](channels[_0xaf1c66['uniqueid']])){if(_0xaf1c66['application'][_0xc769('0x43')]()==_0xc769('0x44')&&_['startsWith'](_0xaf1c66[_0xc769('0x45')][_0xc769('0x43')](),_0xc769('0x46'))){var _0xa13bff=_0xaf1c66[_0xc769('0x45')]['split']('=');var _0x3a443f=_0xa13bff[0x0][_0xc769('0x47')](_0xa13bff[0x0][_0xc769('0x48')]('(')+0x1,_0xa13bff[0x0][_0xc769('0x48')](')'));var _0x29ad8c=_0xa13bff[0x1];channels[_0xaf1c66['uniqueid']][_0x3a443f]=_0x29ad8c;}if(!_[_0xc769('0x49')](['hangup',_0xc769('0x4a'),_0xc769('0x4b'),_0xc769('0x44'),_0xc769('0x4c')],_0xaf1c66[_0xc769('0x4d')]['toLowerCase']())){channels[_0xaf1c66['uniqueid']][_0xc769('0x4e')]=_0xaf1c66[_0xc769('0x4d')];channels[_0xaf1c66[_0xc769('0x9')]][_0xc769('0x3d')]=_0xaf1c66[_0xc769('0x45')];}}}catch(_0x41c07e){utils[_0xc769('0x1a')](_0x41c07e[_0xc769('0x1b')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index c1419d7..c2e454b 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(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4e1208,_0x2ba3a5){_0x4e1208=_0x4e1208-0x0;var _0x4f86ae=_0x1cb9[_0x4e1208];return _0x4f86ae;};'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 _0x2d72=['FULLYBOOTED','error','CLOSE','./utils','lodash','connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted'];(function(_0xb837f5,_0x3f80a9){var _0x357368=function(_0x432e64){while(--_0x432e64){_0xb837f5['push'](_0xb837f5['shift']());}};_0x357368(++_0x3f80a9);}(_0x2d72,0xa8));var _0x22d7=function(_0x2ae6e9,_0x3e0adf){_0x2ae6e9=_0x2ae6e9-0x0;var _0x2e7c47=_0x2d72[_0x2ae6e9];return _0x2e7c47;};'use strict';var utils=require(_0x22d7('0x0'));var _=require(_0x22d7('0x1'));exports[_0x22d7('0x2')]=function(){utils[_0x22d7('0x3')](_0x22d7('0x4'));};exports[_0x22d7('0x5')]=function(){utils[_0x22d7('0x3')](_0x22d7('0x6'));};exports[_0x22d7('0x7')]=function(){utils[_0x22d7('0x3')](_0x22d7('0x8'));};exports[_0x22d7('0x9')]=function(_0x208b5b){utils[_0x22d7('0x9')](_0x208b5b);};exports['close']=function(){utils[_0x22d7('0x3')](_0x22d7('0xa'));};exports['managerevent']=function(_0x3b12cd){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 897278c..3acceb1 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 _0xdc7e=['ANSWER','answertime','hangup','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','dialstring','connectedlinenum','request','CreateVoiceDialReport','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','stack','varset','isNil','error','dialbegin','assign','starttime','now','lastevent','called','dialend','dialstatus'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xdc7e,0x1e9));var _0xedc7=function(_0x4c884a,_0x2603ae){_0x4c884a=_0x4c884a-0x0;var _0x8ffffb=_0xdc7e[_0x4c884a];return _0x8ffffb;};'use strict';var _=require(_0xedc7('0x0'));var util=require(_0xedc7('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x2d67c8){utils[_0xedc7('0x2')](util[_0xedc7('0x3')](_0xedc7('0x4'),_0x2d67c8[_0xedc7('0x5')],_0x2d67c8['channel'],_0x2d67c8[_0xedc7('0x6')],_0x2d67c8['calleridnum'],_0x2d67c8[_0xedc7('0x7')],_0x2d67c8['dialstatus']));utils[_0xedc7('0x8')](_0xedc7('0x9'),_0x2d67c8);delete dials[_0x2d67c8[_0xedc7('0x5')]];}exports['newexten']=function(_0x47717e){try{if(_0x47717e[_0xedc7('0xa')][_0xedc7('0xb')]()==_0xedc7('0xc')&&_[_0xedc7('0xd')](_0x47717e[_0xedc7('0xe')][_0xedc7('0xb')](),_0xedc7('0xf'))){var _0xf8f244=_0x47717e[_0xedc7('0xe')][_0xedc7('0x10')]('=');dials[_0x47717e['uniqueid']]={'routeId':_0xf8f244[0x1]};}}catch(_0x2c91f3){utils['error'](_0x2c91f3[_0xedc7('0x11')]);}};exports[_0xedc7('0x12')]=function(_0x1e5414){try{if(!_[_0xedc7('0x13')](_0x1e5414['variable']['outboundrouteid'])){dials[_0x1e5414[_0xedc7('0x5')]]={'routeId':_0x1e5414['value']};}}catch(_0x32337e){utils[_0xedc7('0x14')](_0x32337e[_0xedc7('0x11')]);}};exports[_0xedc7('0x15')]=function(_0x3338f8){try{if(!_['isNil'](dials[_0x3338f8[_0xedc7('0x5')]])){dials[_0x3338f8[_0xedc7('0x5')]]=_[_0xedc7('0x16')](dials[_0x3338f8[_0xedc7('0x5')]],_0x3338f8);dials[_0x3338f8[_0xedc7('0x5')]][_0xedc7('0x17')]=utils[_0xedc7('0x18')]();dials[_0x3338f8['uniqueid']][_0xedc7('0x19')]=_0xedc7('0x1a');}}catch(_0x810fae){utils['error'](_0x810fae[_0xedc7('0x11')]);}};exports[_0xedc7('0x1b')]=function(_0x286853){try{if(!_[_0xedc7('0x13')](dials[_0x286853[_0xedc7('0x5')]])){dials[_0x286853[_0xedc7('0x5')]][_0xedc7('0x1c')]=_0x286853[_0xedc7('0x1c')];if(_0x286853[_0xedc7('0x1c')]==_0xedc7('0x1d')){dials[_0x286853['uniqueid']]=_[_0xedc7('0x16')](dials[_0x286853['uniqueid']],_0x286853);dials[_0x286853[_0xedc7('0x5')]][_0xedc7('0x1e')]=utils[_0xedc7('0x18')]();dials[_0x286853['uniqueid']]['lastevent']='connect';}}}catch(_0x668f57){utils[_0xedc7('0x14')](_0x668f57[_0xedc7('0x11')]);}};exports[_0xedc7('0x1f')]=function(_0x1efd9d){try{if(!_[_0xedc7('0x13')](dials[_0x1efd9d[_0xedc7('0x5')]])){dials[_0x1efd9d[_0xedc7('0x5')]]=_['assign'](dials[_0x1efd9d[_0xedc7('0x5')]],{'endtime':utils[_0xedc7('0x18')](),'lastevent':_0xedc7('0x20')});dials[_0x1efd9d[_0xedc7('0x5')]]['duration']=utils[_0xedc7('0x21')](dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x22')],dials[_0x1efd9d[_0xedc7('0x5')]]['starttime']);dials[_0x1efd9d['uniqueid']][_0xedc7('0x23')]=utils[_0xedc7('0x21')](dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x1e')]||dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x22')],dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x17')]);dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x24')]=dials[_0x1efd9d['uniqueid']][_0xedc7('0x1e')]?utils[_0xedc7('0x21')](dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x22')],dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x1e')]):0x0;writeDB(dials[_0x1efd9d[_0xedc7('0x5')]]);}}catch(_0x366674){utils[_0xedc7('0x14')](_0x366674[_0xedc7('0x11')]);}}; \ No newline at end of file +var _0x2083=['CreateVoiceDialReport','newexten','application','toLowerCase','set','cdr(routeid)','appdata','error','stack','varset','isNil','variable','outboundrouteid','value','dialbegin','assign','starttime','now','lastevent','called','dialend','dialstatus','ANSWER','answertime','connect','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','request'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x2083,0x137));var _0x3208=function(_0x2b2c4a,_0xe845d7){_0x2b2c4a=_0x2b2c4a-0x0;var _0x536e6e=_0x2083[_0x2b2c4a];return _0x536e6e;};'use strict';var _=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x282228){utils[_0x3208('0x2')](util[_0x3208('0x3')](_0x3208('0x4'),_0x282228[_0x3208('0x5')],_0x282228[_0x3208('0x6')],_0x282228[_0x3208('0x7')],_0x282228['calleridnum'],_0x282228['connectedlinenum'],_0x282228['dialstatus']));utils[_0x3208('0x8')](_0x3208('0x9'),_0x282228);delete dials[_0x282228[_0x3208('0x5')]];}exports[_0x3208('0xa')]=function(_0x564ff6){try{if(_0x564ff6[_0x3208('0xb')][_0x3208('0xc')]()==_0x3208('0xd')&&_['startsWith'](_0x564ff6['appdata'][_0x3208('0xc')](),_0x3208('0xe'))){var _0x336c54=_0x564ff6[_0x3208('0xf')]['split']('=');dials[_0x564ff6['uniqueid']]={'routeId':_0x336c54[0x1]};}}catch(_0x418dbd){utils[_0x3208('0x10')](_0x418dbd[_0x3208('0x11')]);}};exports[_0x3208('0x12')]=function(_0x174620){try{if(!_[_0x3208('0x13')](_0x174620[_0x3208('0x14')][_0x3208('0x15')])){dials[_0x174620[_0x3208('0x5')]]={'routeId':_0x174620[_0x3208('0x16')]};}}catch(_0x3deca8){utils[_0x3208('0x10')](_0x3deca8[_0x3208('0x11')]);}};exports[_0x3208('0x17')]=function(_0x49785f){try{if(!_[_0x3208('0x13')](dials[_0x49785f[_0x3208('0x5')]])){dials[_0x49785f[_0x3208('0x5')]]=_[_0x3208('0x18')](dials[_0x49785f[_0x3208('0x5')]],_0x49785f);dials[_0x49785f['uniqueid']][_0x3208('0x19')]=utils[_0x3208('0x1a')]();dials[_0x49785f['uniqueid']][_0x3208('0x1b')]=_0x3208('0x1c');}}catch(_0x3b45bf){utils[_0x3208('0x10')](_0x3b45bf[_0x3208('0x11')]);}};exports[_0x3208('0x1d')]=function(_0x50d1ba){try{if(!_[_0x3208('0x13')](dials[_0x50d1ba[_0x3208('0x5')]])){dials[_0x50d1ba[_0x3208('0x5')]][_0x3208('0x1e')]=_0x50d1ba[_0x3208('0x1e')];if(_0x50d1ba[_0x3208('0x1e')]==_0x3208('0x1f')){dials[_0x50d1ba['uniqueid']]=_[_0x3208('0x18')](dials[_0x50d1ba[_0x3208('0x5')]],_0x50d1ba);dials[_0x50d1ba['uniqueid']][_0x3208('0x20')]=utils[_0x3208('0x1a')]();dials[_0x50d1ba[_0x3208('0x5')]][_0x3208('0x1b')]=_0x3208('0x21');}}}catch(_0x2ce30e){utils[_0x3208('0x10')](_0x2ce30e['stack']);}};exports['hangup']=function(_0xd9ad58){try{if(!_[_0x3208('0x13')](dials[_0xd9ad58[_0x3208('0x5')]])){dials[_0xd9ad58[_0x3208('0x5')]]=_[_0x3208('0x18')](dials[_0xd9ad58[_0x3208('0x5')]],{'endtime':utils['now'](),'lastevent':_0x3208('0x22')});dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x23')]=utils[_0x3208('0x24')](dials[_0xd9ad58['uniqueid']][_0x3208('0x25')],dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x19')]);dials[_0xd9ad58['uniqueid']][_0x3208('0x26')]=utils[_0x3208('0x24')](dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x20')]||dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x25')],dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x19')]);dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x27')]=dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x20')]?utils[_0x3208('0x24')](dials[_0xd9ad58[_0x3208('0x5')]]['endtime'],dials[_0xd9ad58['uniqueid']][_0x3208('0x20')]):0x0;writeDB(dials[_0xd9ad58[_0x3208('0x5')]]);}}catch(_0x10e1ea){utils['error'](_0x10e1ea[_0x3208('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8621ffe..9f97ead 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 _0xd4fb=['agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','./utils','asterisk','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange'];(function(_0x2f68b1,_0x531d50){var _0x213190=function(_0x4874eb){while(--_0x4874eb){_0x2f68b1['push'](_0x2f68b1['shift']());}};_0x213190(++_0x531d50);}(_0xd4fb,0x15b));var _0xbd4f=function(_0x197090,_0x3f928a){_0x197090=_0x197090-0x0;var _0x2b55e2=_0xd4fb[_0x197090];return _0x2b55e2;};var AsteriskManager=require(_0xbd4f('0x0'));var config=require('../../config/environment');var utils=require(_0xbd4f('0x1'));var ami=new AsteriskManager(config[_0xbd4f('0x2')]['port'],config[_0xbd4f('0x2')]['ip'],config[_0xbd4f('0x2')][_0xbd4f('0x3')],config[_0xbd4f('0x2')][_0xbd4f('0x4')],!![]);ami[_0xbd4f('0x5')]();if(config[_0xbd4f('0x6')]&&config[_0xbd4f('0x6')]['disabled']){utils[_0xbd4f('0x7')](_0xbd4f('0x8'));}else{var agents=require(_0xbd4f('0x9'));var calls=require(_0xbd4f('0xa'));var queues=require('./queues.controller');var recordings=require(_0xbd4f('0xb'));var members=require(_0xbd4f('0xc'));var dials=require('./dials.controller');var transfers=require(_0xbd4f('0xd'));var core=require(_0xbd4f('0xe'));ami['on'](_0xbd4f('0xf'),core[_0xbd4f('0xf')]);ami['on'](_0xbd4f('0x10'),core[_0xbd4f('0x10')]);ami['on'](_0xbd4f('0x11'),core[_0xbd4f('0x11')]);ami['on']('error',core[_0xbd4f('0x12')]);ami['on']('close',core[_0xbd4f('0x13')]);ami['on'](_0xbd4f('0x14'),core['managerevent']);ami['on'](_0xbd4f('0x15'),function(_0x7152ff){try{members[_0xbd4f('0x15')](_0x7152ff);}catch(_0x4970a5){utils[_0xbd4f('0x12')](_0x4970a5);}});ami['on']('agentcalled',function(_0x40afc3){try{agents[_0xbd4f('0x16')](_0x40afc3);}catch(_0x3505fd){utils[_0xbd4f('0x12')](_0x3505fd);}});ami['on'](_0xbd4f('0x17'),function(_0x172e01){try{agents[_0xbd4f('0x17')](_0x172e01);}catch(_0x4fc7c7){utils['error'](_0x4fc7c7);}});ami['on']('agentconnect',function(_0xa3221a){try{agents[_0xbd4f('0x18')](_0xa3221a);queues[_0xbd4f('0x18')](_0xa3221a);}catch(_0x33cc4d){utils[_0xbd4f('0x12')](_0x33cc4d);}});ami['on']('agentcomplete',function(_0x555492){try{agents[_0xbd4f('0x19')](_0x555492);queues[_0xbd4f('0x19')](_0x555492);members[_0xbd4f('0x19')](_0x555492);}catch(_0x544b2d){utils[_0xbd4f('0x12')](_0x544b2d);}});ami['on']('queuecallerabandon',function(_0x1378b2){try{agents[_0xbd4f('0x1a')](_0x1378b2);queues['queuecallerabandon'](_0x1378b2);}catch(_0x30f937){utils['error'](_0x30f937);}});ami['on'](_0xbd4f('0x1b'),function(_0x233b7a){try{queues[_0xbd4f('0x1b')](_0x233b7a);recordings[_0xbd4f('0x1b')](_0x233b7a);}catch(_0x4d0daa){utils[_0xbd4f('0x12')](_0x4d0daa);}});ami['on'](_0xbd4f('0x1c'),function(_0x4a1b49){try{queues[_0xbd4f('0x1c')](_0x4a1b49);}catch(_0x2c9da7){utils['error'](_0x2c9da7);}});ami['on'](_0xbd4f('0x1d'),function(_0xedd504){try{queues[_0xbd4f('0x1d')](_0xedd504);calls[_0xbd4f('0x1d')](_0xedd504);}catch(_0x4f285c){utils['error'](_0x4f285c);}});ami['on'](_0xbd4f('0x1e'),function(_0x5acde){try{queues[_0xbd4f('0x1e')](_0x5acde);calls[_0xbd4f('0x1e')](_0x5acde);}catch(_0x30600b){utils[_0xbd4f('0x12')](_0x30600b);}});ami['on'](_0xbd4f('0x1f'),function(_0xbe5438){try{calls[_0xbd4f('0x1f')](_0xbe5438);recordings[_0xbd4f('0x1f')](_0xbe5438);}catch(_0x341e0e){utils[_0xbd4f('0x12')](_0x341e0e);}});ami['on']('hangup',function(_0x309b11){try{calls[_0xbd4f('0x20')](_0x309b11);recordings['hangup'](_0x309b11);dials['hangup'](_0x309b11);agents[_0xbd4f('0x20')](_0x309b11);queues[_0xbd4f('0x20')](_0x309b11);}catch(_0x2af31c){utils[_0xbd4f('0x12')](_0x2af31c);}});ami['on'](_0xbd4f('0x21'),function(_0x396e2b){try{members[_0xbd4f('0x21')](_0x396e2b);}catch(_0x3a1fde){utils[_0xbd4f('0x12')](_0x3a1fde);}});ami['on']('blindtransfer',function(_0x32ad82){try{queues[_0xbd4f('0x22')](_0x32ad82);agents[_0xbd4f('0x22')](_0x32ad82);transfers[_0xbd4f('0x22')](_0x32ad82);}catch(_0x5d6ce8){utils[_0xbd4f('0x12')](_0x5d6ce8);}});ami['on'](_0xbd4f('0x23'),function(_0x5aeb98){try{queues[_0xbd4f('0x23')](_0x5aeb98);transfers['attendedtransfer'](_0x5aeb98);agents['attendedtransfer'](_0x5aeb98);calls[_0xbd4f('0x23')](_0x5aeb98);}catch(_0x4bb905){utils[_0xbd4f('0x12')](_0x4bb905);}});ami['on']('varset',function(_0x48bf9c){try{queues[_0xbd4f('0x24')](_0x48bf9c);recordings[_0xbd4f('0x24')](_0x48bf9c);calls[_0xbd4f('0x24')](_0x48bf9c);dials['varset'](_0x48bf9c);}catch(_0x132c98){utils[_0xbd4f('0x12')](_0x132c98);}});ami['on'](_0xbd4f('0x25'),function(_0x3061fe){try{calls[_0xbd4f('0x25')](_0x3061fe);recordings['newexten'](_0x3061fe);dials[_0xbd4f('0x25')](_0x3061fe);}catch(_0x2e7465){utils['error'](_0x2e7465);}});ami['on'](_0xbd4f('0x26'),function(_0x45427a){try{calls['newchannel'](_0x45427a);recordings['newchannel'](_0x45427a);}catch(_0x80c6cf){utils['error'](_0x80c6cf);}});ami['on'](_0xbd4f('0x27'),function(_0x2fda8b){try{dials['dialbegin'](_0x2fda8b);}catch(_0x90f5fc){utils['error'](_0x90f5fc);}});ami['on'](_0xbd4f('0x28'),function(_0x3041bc){try{dials[_0xbd4f('0x28')](_0x3041bc);}catch(_0x4f0764){utils['error'](_0x4f0764);}});} \ No newline at end of file +var _0xe5b9=['./utils','asterisk','port','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xe5b9,0xa2));var _0x9e5b=function(_0x203ebe,_0x2c80c4){_0x203ebe=_0x203ebe-0x0;var _0x328b0=_0xe5b9[_0x203ebe];return _0x328b0;};var AsteriskManager=require(_0x9e5b('0x0'));var config=require(_0x9e5b('0x1'));var utils=require(_0x9e5b('0x2'));var ami=new AsteriskManager(config[_0x9e5b('0x3')][_0x9e5b('0x4')],config[_0x9e5b('0x3')]['ip'],config[_0x9e5b('0x3')]['username'],config['asterisk'][_0x9e5b('0x5')],!![]);ami[_0x9e5b('0x6')]();if(config[_0x9e5b('0x7')]&&config[_0x9e5b('0x7')][_0x9e5b('0x8')]){utils[_0x9e5b('0x9')](_0x9e5b('0xa'));}else{var agents=require(_0x9e5b('0xb'));var calls=require(_0x9e5b('0xc'));var queues=require(_0x9e5b('0xd'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x9e5b('0xe'));var transfers=require(_0x9e5b('0xf'));var core=require(_0x9e5b('0x10'));ami['on'](_0x9e5b('0x11'),core[_0x9e5b('0x11')]);ami['on'](_0x9e5b('0x12'),core[_0x9e5b('0x12')]);ami['on'](_0x9e5b('0x13'),core[_0x9e5b('0x13')]);ami['on']('error',core[_0x9e5b('0x14')]);ami['on']('close',core['close']);ami['on'](_0x9e5b('0x15'),core['managerevent']);ami['on']('devicestatechange',function(_0xfbfd6c){try{members['devicestatechange'](_0xfbfd6c);}catch(_0x12192d){utils[_0x9e5b('0x14')](_0x12192d);}});ami['on'](_0x9e5b('0x16'),function(_0xbf7fa9){try{agents[_0x9e5b('0x16')](_0xbf7fa9);}catch(_0x3df398){utils[_0x9e5b('0x14')](_0x3df398);}});ami['on'](_0x9e5b('0x17'),function(_0x5c3f2f){try{agents[_0x9e5b('0x17')](_0x5c3f2f);}catch(_0x11ecf1){utils[_0x9e5b('0x14')](_0x11ecf1);}});ami['on'](_0x9e5b('0x18'),function(_0x5a0be7){try{agents[_0x9e5b('0x18')](_0x5a0be7);queues[_0x9e5b('0x18')](_0x5a0be7);}catch(_0x3f5ec5){utils[_0x9e5b('0x14')](_0x3f5ec5);}});ami['on']('agentcomplete',function(_0x79656c){try{agents['agentcomplete'](_0x79656c);queues[_0x9e5b('0x19')](_0x79656c);members[_0x9e5b('0x19')](_0x79656c);}catch(_0x4daf4d){utils[_0x9e5b('0x14')](_0x4daf4d);}});ami['on'](_0x9e5b('0x1a'),function(_0x1f001f){try{agents[_0x9e5b('0x1a')](_0x1f001f);queues[_0x9e5b('0x1a')](_0x1f001f);}catch(_0xaa87a6){utils[_0x9e5b('0x14')](_0xaa87a6);}});ami['on'](_0x9e5b('0x1b'),function(_0x74c29d){try{queues[_0x9e5b('0x1b')](_0x74c29d);recordings[_0x9e5b('0x1b')](_0x74c29d);}catch(_0x3c998b){utils['error'](_0x3c998b);}});ami['on'](_0x9e5b('0x1c'),function(_0x2ffba5){try{queues['queuecallerleave'](_0x2ffba5);}catch(_0x2ca4a1){utils[_0x9e5b('0x14')](_0x2ca4a1);}});ami['on'](_0x9e5b('0x1d'),function(_0x1de18f){try{queues[_0x9e5b('0x1d')](_0x1de18f);calls[_0x9e5b('0x1d')](_0x1de18f);}catch(_0x11b65b){utils['error'](_0x11b65b);}});ami['on'](_0x9e5b('0x1e'),function(_0x4bc03a){try{queues[_0x9e5b('0x1e')](_0x4bc03a);calls[_0x9e5b('0x1e')](_0x4bc03a);}catch(_0x3ebf74){utils[_0x9e5b('0x14')](_0x3ebf74);}});ami['on'](_0x9e5b('0x1f'),function(_0x331271){try{calls['newstate'](_0x331271);recordings[_0x9e5b('0x1f')](_0x331271);}catch(_0x2e9472){utils[_0x9e5b('0x14')](_0x2e9472);}});ami['on'](_0x9e5b('0x20'),function(_0x561072){try{calls[_0x9e5b('0x20')](_0x561072);recordings[_0x9e5b('0x20')](_0x561072);dials[_0x9e5b('0x20')](_0x561072);agents['hangup'](_0x561072);queues[_0x9e5b('0x20')](_0x561072);}catch(_0x5a5915){utils[_0x9e5b('0x14')](_0x5a5915);}});ami['on'](_0x9e5b('0x21'),function(_0xb6c9b3){try{members[_0x9e5b('0x21')](_0xb6c9b3);}catch(_0x424ce4){utils[_0x9e5b('0x14')](_0x424ce4);}});ami['on'](_0x9e5b('0x22'),function(_0x5efc85){try{queues[_0x9e5b('0x22')](_0x5efc85);agents[_0x9e5b('0x22')](_0x5efc85);transfers[_0x9e5b('0x22')](_0x5efc85);}catch(_0x3dd4ab){utils['error'](_0x3dd4ab);}});ami['on']('attendedtransfer',function(_0x2d2309){try{queues[_0x9e5b('0x23')](_0x2d2309);transfers[_0x9e5b('0x23')](_0x2d2309);agents['attendedtransfer'](_0x2d2309);calls[_0x9e5b('0x23')](_0x2d2309);}catch(_0x5e37a3){utils[_0x9e5b('0x14')](_0x5e37a3);}});ami['on']('varset',function(_0x2b06fe){try{queues['varset'](_0x2b06fe);recordings[_0x9e5b('0x24')](_0x2b06fe);calls['varset'](_0x2b06fe);dials['varset'](_0x2b06fe);}catch(_0x19e9ff){utils['error'](_0x19e9ff);}});ami['on']('newexten',function(_0x4fb1ce){try{calls[_0x9e5b('0x25')](_0x4fb1ce);recordings[_0x9e5b('0x25')](_0x4fb1ce);dials[_0x9e5b('0x25')](_0x4fb1ce);}catch(_0x362aeb){utils[_0x9e5b('0x14')](_0x362aeb);}});ami['on'](_0x9e5b('0x26'),function(_0x394e2b){try{calls[_0x9e5b('0x26')](_0x394e2b);recordings[_0x9e5b('0x26')](_0x394e2b);}catch(_0x1c4472){utils[_0x9e5b('0x14')](_0x1c4472);}});ami['on'](_0x9e5b('0x27'),function(_0x165a84){try{dials[_0x9e5b('0x27')](_0x165a84);}catch(_0x5591ea){utils[_0x9e5b('0x14')](_0x5591ea);}});ami['on']('dialend',function(_0x4d72e0){try{dials[_0x9e5b('0x28')](_0x4d72e0);}catch(_0x217ee6){utils[_0x9e5b('0x14')](_0x217ee6);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 293bb6c..8c199cf 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 _0x1142=['request','split','name','CreateMemberReport','catch','error','some','state','INUSE','BUSY','device','voice','TALKING','now','agent','exitAt','diffTime','enterAt','isNil','assign','queue','data3','destination','uniqueid','destinationchannel','data1','source','lodash','util','Queue:','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','data2','membername','type','then','internal'];(function(_0x52491c,_0x41d2e6){var _0x157cea=function(_0x4aeb08){while(--_0x4aeb08){_0x52491c['push'](_0x52491c['shift']());}};_0x157cea(++_0x41d2e6);}(_0x1142,0x153));var _0x2114=function(_0x2a7a6f,_0xa18f3a){_0x2a7a6f=_0x2a7a6f-0x0;var _0x45b5ce=_0x1142[_0x2a7a6f];return _0x45b5ce;};'use strict';var _=require(_0x2114('0x0'));var util=require(_0x2114('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0x2114('0x2')];function writeDB(_0x5ea863){utils['info'](util[_0x2114('0x3')](_0x2114('0x4'),_0x5ea863['uniqueid'],_0x5ea863[_0x2114('0x5')],_0x5ea863[_0x2114('0x6')],_0x5ea863[_0x2114('0x7')],_0x5ea863[_0x2114('0x8')],_0x5ea863[_0x2114('0x9')]));if(_0x5ea863[_0x2114('0x5')]){utils['getUserByInterface'](_0x5ea863[_0x2114('0x5')])[_0x2114('0xa')](function(_0x2b19e7){if(_0x2b19e7){_0x5ea863[_0x2114('0x8')]=_0x2b19e7['name'];_0x5ea863['internal']=_0x2b19e7[_0x2114('0xb')];utils[_0x2114('0xc')]('CreateMemberReport',_0x5ea863);}else{utils['getUserByName'](_0x5ea863[_0x2114('0x5')][_0x2114('0xd')]('/')[0x1])[_0x2114('0xa')](function(_0x14b757){if(_0x14b757){_0x5ea863[_0x2114('0x8')]=_0x14b757[_0x2114('0xe')];_0x5ea863['internal']=_0x14b757[_0x2114('0xb')];utils[_0x2114('0xc')](_0x2114('0xf'),_0x5ea863);}});}})[_0x2114('0x10')](function(_0x133cbc){utils[_0x2114('0x11')](_0x133cbc);});}delete members[_0x5ea863['interface']];}function startsWith(_0x45b192,_0x17355c){return _[_0x2114('0x12')](_0x45b192,function(_0x46b407){return _['startsWith'](_0x17355c,_0x46b407);});}exports['devicestatechange']=function(_0x438f9d){switch(_0x438f9d[_0x2114('0x13')]){case _0x2114('0x14'):case _0x2114('0x15'):if(!startsWith(exclude,_0x438f9d[_0x2114('0x16')])){members[_0x438f9d[_0x2114('0x16')]]={'channel':_0x2114('0x17'),'interface':_0x438f9d[_0x2114('0x16')],'type':_0x2114('0x18'),'enterAt':utils[_0x2114('0x19')](),'role':_0x2114('0x1a')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x438f9d['device']])){members[_0x438f9d[_0x2114('0x16')]][_0x2114('0x1b')]=utils['now']();members[_0x438f9d[_0x2114('0x16')]]['duration']=utils[_0x2114('0x1c')](members[_0x438f9d[_0x2114('0x16')]][_0x2114('0x1b')],members[_0x438f9d['device']][_0x2114('0x1d')]);if(members[_0x438f9d['device']]['uniqueid']){writeDB(members[_0x438f9d['device']]);}}default:break;}};exports['agentcomplete']=function(_0x1814ec){if(!_[_0x2114('0x1e')](members[_0x1814ec[_0x2114('0x5')]])){members[_0x1814ec[_0x2114('0x5')]]=_[_0x2114('0x1f')](members[_0x1814ec[_0x2114('0x5')]],{'data4':_0x1814ec[_0x2114('0x20')],'uniqueid':_0x1814ec['uniqueid']});}};exports['cdr']=function(_0x31479f){if(_0x31479f[_0x2114('0x6')]){var _0x5f0c5d=_0x31479f[_0x2114('0x6')][_0x2114('0xd')]('-')[0x0];if(!_[_0x2114('0x1e')](members[_0x5f0c5d])){members[_0x5f0c5d]=_[_0x2114('0x1f')](members[_0x5f0c5d],{'data1':members[_0x5f0c5d]['data1']||_0x31479f['type'],'data2':members[_0x5f0c5d][_0x2114('0x7')]||_0x31479f['source'],'data3':members[_0x5f0c5d][_0x2114('0x21')]||_0x31479f[_0x2114('0x22')],'uniqueid':members[_0x5f0c5d][_0x2114('0x23')]||_0x31479f[_0x2114('0x23')]});if(members[_0x5f0c5d][_0x2114('0x1b')]){writeDB(members[_0x5f0c5d]);}}}if(_0x31479f[_0x2114('0x24')]){var _0xf07275=_0x31479f[_0x2114('0x24')][_0x2114('0xd')]('-')[0x0];if(!_[_0x2114('0x1e')](members[_0xf07275])){members[_0xf07275]=_[_0x2114('0x1f')](members[_0xf07275],{'data1':members[_0xf07275][_0x2114('0x25')]||_0x31479f['type'],'data2':members[_0xf07275][_0x2114('0x7')]||_0x31479f[_0x2114('0x26')],'data3':members[_0xf07275][_0x2114('0x21')]||_0x31479f['destination'],'uniqueid':members[_0xf07275][_0x2114('0x23')]||_0x31479f['uniqueid']});if(members[_0xf07275][_0x2114('0x1b')]){writeDB(members[_0xf07275]);}}}}; \ No newline at end of file +var _0x3add=['membername','type','getUserByInterface','internal','CreateMemberReport','getUserByName','split','then','name','request','catch','error','some','devicestatechange','state','INUSE','device','voice','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','uniqueid','assign','queue','cdr','data1','source','data3','destination','destinationchannel','lodash','util','./utils','Local/_attended@transfer','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','data2'];(function(_0x3aab9e,_0x3c9d51){var _0x295a01=function(_0x25f7a6){while(--_0x25f7a6){_0x3aab9e['push'](_0x3aab9e['shift']());}};_0x295a01(++_0x3c9d51);}(_0x3add,0xce));var _0xd3ad=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x3add[_0x10dbf6];return _0x452147;};'use strict';var _=require(_0xd3ad('0x0'));var util=require(_0xd3ad('0x1'));var utils=require(_0xd3ad('0x2'));var members={};var exclude=[_0xd3ad('0x3'),'Queue:'];function writeDB(_0x4dddd1){utils['info'](util[_0xd3ad('0x4')](_0xd3ad('0x5'),_0x4dddd1['uniqueid'],_0x4dddd1[_0xd3ad('0x6')],_0x4dddd1[_0xd3ad('0x7')],_0x4dddd1[_0xd3ad('0x8')],_0x4dddd1[_0xd3ad('0x9')],_0x4dddd1[_0xd3ad('0xa')]));if(_0x4dddd1['interface']){utils[_0xd3ad('0xb')](_0x4dddd1[_0xd3ad('0x6')])['then'](function(_0xb0aec0){if(_0xb0aec0){_0x4dddd1[_0xd3ad('0x9')]=_0xb0aec0['name'];_0x4dddd1[_0xd3ad('0xc')]=_0xb0aec0[_0xd3ad('0xc')];utils['request'](_0xd3ad('0xd'),_0x4dddd1);}else{utils[_0xd3ad('0xe')](_0x4dddd1[_0xd3ad('0x6')][_0xd3ad('0xf')]('/')[0x1])[_0xd3ad('0x10')](function(_0x3e3d34){if(_0x3e3d34){_0x4dddd1[_0xd3ad('0x9')]=_0x3e3d34[_0xd3ad('0x11')];_0x4dddd1[_0xd3ad('0xc')]=_0x3e3d34[_0xd3ad('0xc')];utils[_0xd3ad('0x12')](_0xd3ad('0xd'),_0x4dddd1);}});}})[_0xd3ad('0x13')](function(_0x1e9a21){utils[_0xd3ad('0x14')](_0x1e9a21);});}delete members[_0x4dddd1[_0xd3ad('0x6')]];}function startsWith(_0x271250,_0x2ce702){return _[_0xd3ad('0x15')](_0x271250,function(_0x4e629e){return _['startsWith'](_0x2ce702,_0x4e629e);});}exports[_0xd3ad('0x16')]=function(_0x211727){switch(_0x211727[_0xd3ad('0x17')]){case _0xd3ad('0x18'):case'BUSY':if(!startsWith(exclude,_0x211727[_0xd3ad('0x19')])){members[_0x211727[_0xd3ad('0x19')]]={'channel':_0xd3ad('0x1a'),'interface':_0x211727['device'],'type':'TALKING','enterAt':utils[_0xd3ad('0x1b')](),'role':'agent'};}break;case _0xd3ad('0x1c'):if(!_[_0xd3ad('0x1d')](members[_0x211727[_0xd3ad('0x19')]])){members[_0x211727[_0xd3ad('0x19')]][_0xd3ad('0x1e')]=utils[_0xd3ad('0x1b')]();members[_0x211727[_0xd3ad('0x19')]][_0xd3ad('0x1f')]=utils[_0xd3ad('0x20')](members[_0x211727['device']][_0xd3ad('0x1e')],members[_0x211727[_0xd3ad('0x19')]][_0xd3ad('0x21')]);if(members[_0x211727[_0xd3ad('0x19')]][_0xd3ad('0x22')]){writeDB(members[_0x211727[_0xd3ad('0x19')]]);}}default:break;}};exports['agentcomplete']=function(_0x22db3f){if(!_['isNil'](members[_0x22db3f[_0xd3ad('0x6')]])){members[_0x22db3f[_0xd3ad('0x6')]]=_[_0xd3ad('0x23')](members[_0x22db3f[_0xd3ad('0x6')]],{'data4':_0x22db3f[_0xd3ad('0x24')],'uniqueid':_0x22db3f[_0xd3ad('0x22')]});}};exports[_0xd3ad('0x25')]=function(_0x36eee4){if(_0x36eee4[_0xd3ad('0x7')]){var _0x3fb6e9=_0x36eee4[_0xd3ad('0x7')][_0xd3ad('0xf')]('-')[0x0];if(!_['isNil'](members[_0x3fb6e9])){members[_0x3fb6e9]=_[_0xd3ad('0x23')](members[_0x3fb6e9],{'data1':members[_0x3fb6e9][_0xd3ad('0x26')]||_0x36eee4['type'],'data2':members[_0x3fb6e9][_0xd3ad('0x8')]||_0x36eee4[_0xd3ad('0x27')],'data3':members[_0x3fb6e9][_0xd3ad('0x28')]||_0x36eee4[_0xd3ad('0x29')],'uniqueid':members[_0x3fb6e9]['uniqueid']||_0x36eee4['uniqueid']});if(members[_0x3fb6e9][_0xd3ad('0x1e')]){writeDB(members[_0x3fb6e9]);}}}if(_0x36eee4[_0xd3ad('0x2a')]){var _0x487d18=_0x36eee4['destinationchannel'][_0xd3ad('0xf')]('-')[0x0];if(!_[_0xd3ad('0x1d')](members[_0x487d18])){members[_0x487d18]=_[_0xd3ad('0x23')](members[_0x487d18],{'data1':members[_0x487d18][_0xd3ad('0x26')]||_0x36eee4[_0xd3ad('0xa')],'data2':members[_0x487d18]['data2']||_0x36eee4[_0xd3ad('0x27')],'data3':members[_0x487d18]['data3']||_0x36eee4['destination'],'uniqueid':members[_0x487d18]['uniqueid']||_0x36eee4[_0xd3ad('0x22')]});if(members[_0x487d18][_0xd3ad('0x1e')]){writeDB(members[_0x487d18]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 89aea21..bc36840 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 _0x679b=['transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','transfertargetlinkedid','queuecallerenterreason','error','stack','musiconholdstartAt','musiconholdstop','lodash','util','./utils','info','QUEUE|%s|%s|%s|%s|%s|%s|%s','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','uniqueid','assign','position','now','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','varset','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queuecallerexitreason','variable','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','assigned','destaccountcode','membername','agentcomplete','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension'];(function(_0x154292,_0x5d9a74){var _0x2cc2fc=function(_0x455449){while(--_0x455449){_0x154292['push'](_0x154292['shift']());}};_0x2cc2fc(++_0x5d9a74);}(_0x679b,0xad));var _0xb679=function(_0x1130ce,_0x15f4e3){_0x1130ce=_0x1130ce-0x0;var _0x133eb8=_0x679b[_0x1130ce];return _0x133eb8;};'use strict';var _=require(_0xb679('0x0'));var util=require(_0xb679('0x1'));var utils=require(_0xb679('0x2'));var queues={};function writeDB(_0x27d9d2){utils[_0xb679('0x3')](util['format'](_0xb679('0x4'),_0x27d9d2['uniqueid'],_0x27d9d2[_0xb679('0x5')],_0x27d9d2[_0xb679('0x6')],_0x27d9d2[_0xb679('0x7')],_0x27d9d2[_0xb679('0x8')],_0x27d9d2[_0xb679('0x9')],_0x27d9d2['queuecallerexitreason']));if(_0x27d9d2['queue']){utils[_0xb679('0xa')](_0x27d9d2['queue'])[_0xb679('0xb')](function(_0x3d3992){if(_0x3d3992){_0x27d9d2[_0xb679('0xc')]=_0x3d3992[_0xb679('0xc')];}utils['request'](_0xb679('0xd'),_0x27d9d2);});}else{utils[_0xb679('0xe')](_0xb679('0xd'),_0x27d9d2);}if(_0x27d9d2[_0xb679('0xf')]){delete queues[_0x27d9d2[_0xb679('0xf')]];}else{delete queues[_0x27d9d2['uniqueid']];}}exports[_0xb679('0x10')]=function(_0x38cd94){queues[_0x38cd94[_0xb679('0x11')]]=_[_0xb679('0x12')](_0x38cd94,{'originalposition':_0x38cd94[_0xb679('0x13')],'queuecallerjoinAt':utils[_0xb679('0x14')](),'mohtime':0x0});};exports[_0xb679('0x15')]=function(_0x3c5fe2){if(!_[_0xb679('0x16')](queues[_0x3c5fe2[_0xb679('0x11')]])){if(queues[_0x3c5fe2[_0xb679('0x11')]]['queuecallerleaveAt']){if(!queues[_0x3c5fe2[_0xb679('0x11')]][_0xb679('0x17')]&&!queues[_0x3c5fe2['uniqueid']][_0xb679('0x18')]){queues[_0x3c5fe2[_0xb679('0x11')]][_0xb679('0x19')]=!![];queues[_0x3c5fe2[_0xb679('0x11')]][_0xb679('0x1a')]=utils['now']();queues[_0x3c5fe2[_0xb679('0x11')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}writeDB(queues[_0x3c5fe2['uniqueid']]);}else{if(queues[_0x3c5fe2[_0xb679('0x11')]]['transfereduniqueid']){queues[queues[_0x3c5fe2['uniqueid']][_0xb679('0xf')]]=queues[_0x3c5fe2[_0xb679('0x11')]];queues[queues[_0x3c5fe2[_0xb679('0x11')]][_0xb679('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x3c5fe2[_0xb679('0x11')]];}}}};exports[_0xb679('0x1b')]=function(_0x408821){if(!_[_0xb679('0x16')](_0x408821['variable']['queuestatus'])&&_0x408821[_0xb679('0x1c')][_0xb679('0x1d')]()!==_0xb679('0x1e')){if(!_['isNil'](queues[_0x408821[_0xb679('0x11')]])){queues[_0x408821[_0xb679('0x11')]]['queuecallerabandon']=![];queues[_0x408821['uniqueid']][_0xb679('0x1f')]=null;queues[_0x408821[_0xb679('0x11')]][_0xb679('0x18')]=!![];queues[_0x408821[_0xb679('0x11')]][_0xb679('0x20')]=utils[_0xb679('0x14')]();queues[_0x408821[_0xb679('0x11')]][_0xb679('0x21')]=_0x408821['value']['toUpperCase']();writeDB(queues[_0x408821['uniqueid']]);}}else if(!_[_0xb679('0x16')](_0x408821[_0xb679('0x22')]['queueposition'])){if(!_[_0xb679('0x16')](queues[_0x408821[_0xb679('0x11')]])&&!queues[_0x408821[_0xb679('0x11')]][_0xb679('0x17')]){queues[_0x408821[_0xb679('0x11')]]['queuecallerabandon']=![];queues[_0x408821[_0xb679('0x11')]]['queuecallerabandonAt']=null;queues[_0x408821[_0xb679('0x11')]][_0xb679('0x18')]=!![];queues[_0x408821[_0xb679('0x11')]][_0xb679('0x20')]=utils[_0xb679('0x14')]();queues[_0x408821[_0xb679('0x11')]][_0xb679('0x21')]=_0xb679('0x23');}}};exports[_0xb679('0x17')]=function(_0x15acc8){if(!_['isNil'](queues[_0x15acc8['uniqueid']])){queues[_0x15acc8[_0xb679('0x11')]][_0xb679('0x18')]=![];queues[_0x15acc8[_0xb679('0x11')]][_0xb679('0x20')]=null;queues[_0x15acc8['uniqueid']][_0xb679('0x17')]=!![];queues[_0x15acc8['uniqueid']][_0xb679('0x1f')]=utils[_0xb679('0x14')]();queues[_0x15acc8[_0xb679('0x11')]]['queuecallerexitreason']=_0xb679('0x24');}};exports[_0xb679('0x25')]=function(_0x2071cc){if(!_['isNil'](queues[_0x2071cc[_0xb679('0x11')]])){queues[_0x2071cc['uniqueid']]['queuecallerleave']=!![];queues[_0x2071cc[_0xb679('0x11')]][_0xb679('0x26')]=utils['now']();queues[_0x2071cc[_0xb679('0x11')]][_0xb679('0x27')]=utils[_0xb679('0x28')](queues[_0x2071cc['uniqueid']][_0xb679('0x26')],queues[_0x2071cc['uniqueid']][_0xb679('0x29')]);queues[_0x2071cc[_0xb679('0x11')]][_0xb679('0x13')]=_0x2071cc[_0xb679('0x13')];queues[_0x2071cc['uniqueid']][_0xb679('0x2a')]=_0x2071cc[_0xb679('0x2a')];queues[_0x2071cc[_0xb679('0x11')]]['connectedlinenum']=_0x2071cc[_0xb679('0x2b')];queues[_0x2071cc[_0xb679('0x11')]][_0xb679('0x2c')]=_0x2071cc[_0xb679('0x2c')];}};exports['agentconnect']=function(_0x1328b5){if(!_[_0xb679('0x16')](queues[_0x1328b5[_0xb679('0x11')]])){queues[_0x1328b5[_0xb679('0x11')]]['queuecallerabandon']=![];queues[_0x1328b5['uniqueid']]['queuecallerabandon']=![];queues[_0x1328b5[_0xb679('0x11')]]['queuecallerabandonAt']=null;queues[_0x1328b5[_0xb679('0x11')]]['queuecallerexit']=![];queues[_0x1328b5[_0xb679('0x11')]]['queuecallerexitreason']=null;queues[_0x1328b5[_0xb679('0x11')]]['queuecallerexitAt']=null;queues[_0x1328b5['uniqueid']][_0xb679('0x2d')]=!![];queues[_0x1328b5[_0xb679('0x11')]][_0xb679('0x9')]=_0x1328b5[_0xb679('0x2e')];queues[_0x1328b5[_0xb679('0x11')]][_0xb679('0x7')]=_0x1328b5[_0xb679('0x2f')];}};exports[_0xb679('0x30')]=function(_0x13a8bd){if(!_['isNil'](queues[_0x13a8bd['uniqueid']])){if(queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x26')]){queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x17')]=![];queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x17')]=![];queues[_0x13a8bd['uniqueid']]['queuecallerabandonAt']=null;queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x18')]=![];queues[_0x13a8bd['uniqueid']]['queuecallerexitAt']=null;queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x2d')]=!![];queues[_0x13a8bd['uniqueid']]['lastAssignedTo']=_0x13a8bd['membername'];queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x19')]=!![];queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x1a')]=utils[_0xb679('0x14')]();if(_0x13a8bd['reason']==_0xb679('0x31')){if(!queues[_0x13a8bd[_0xb679('0x11')]]['transfer']){queues[_0x13a8bd['uniqueid']]['queuecallerexitreason']=_0xb679('0x32');}}else{queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x21')]=_0xb679('0x33')+_0x13a8bd['reason'][_0xb679('0x1d')]();}writeDB(queues[_0x13a8bd['uniqueid']]);}}};exports[_0xb679('0x34')]=function(_0x5eb438){if(!_[_0xb679('0x16')](queues[_0x5eb438['transfereeuniqueid']])){queues[_0x5eb438[_0xb679('0x35')]][_0xb679('0x31')]=!![];queues[_0x5eb438[_0xb679('0x35')]][_0xb679('0x36')]=_0xb679('0x37');queues[_0x5eb438[_0xb679('0x35')]][_0xb679('0x38')]=_0x5eb438[_0xb679('0x39')];queues[_0x5eb438[_0xb679('0x35')]][_0xb679('0x3a')]=_0x5eb438[_0xb679('0x35')];queues[_0x5eb438['transfereeuniqueid']]['queuecallerexitreason']='BLINDTRANSFER';}};exports[_0xb679('0x3b')]=function(_0xd728a6){try{if(_0xd728a6[_0xb679('0x3c')]==_0xd728a6['origtransfererlinkedid']){if(!_['isNil'](queues[_0xd728a6[_0xb679('0x3d')]])){queues[_0xd728a6['secondtransfererlinkedid']][_0xb679('0x31')]=!![];queues[_0xd728a6[_0xb679('0x3d')]]['transfertype']=_0xb679('0x3e');queues[_0xd728a6['secondtransfererlinkedid']][_0xb679('0x38')]=_0xd728a6['origtransfererexten'];queues[_0xd728a6[_0xb679('0x3d')]][_0xb679('0x3a')]=_0xd728a6[_0xb679('0x3c')];queues[_0xd728a6[_0xb679('0x3d')]][_0xb679('0x21')]=_0xb679('0x3f');}if(!_[_0xb679('0x16')](queues[_0xd728a6[_0xb679('0x40')]])){if(_0xd728a6[_0xb679('0x41')]&&queues[_0xd728a6[_0xb679('0x41')]]){queues[_0xd728a6[_0xb679('0x41')]]['queuecallerenterreason']=0x1;queues[_0xd728a6[_0xb679('0x35')]]=_[_0xb679('0x42')](queues[_0xd728a6[_0xb679('0x41')]]);queues[_0xd728a6[_0xb679('0x35')]][_0xb679('0xf')]=_0xd728a6[_0xb679('0x43')];queues[_0xd728a6[_0xb679('0x35')]]['queuecallerenterreason']=0x2;queues[_0xd728a6[_0xb679('0x35')]][_0xb679('0x8')]=queues[_0xd728a6['secondtransfererlinkedid']][_0xb679('0x8')];queues[_0xd728a6[_0xb679('0x35')]]['calleridname']=queues[_0xd728a6[_0xb679('0x3d')]][_0xb679('0x44')];queues[_0xd728a6['transfereeuniqueid']][_0xb679('0x29')]=utils['now']();queues[_0xd728a6['transfereeuniqueid']][_0xb679('0x26')]=utils[_0xb679('0x14')]();queues[_0xd728a6[_0xb679('0x35')]][_0xb679('0x27')]=0x0;queues[_0xd728a6['transfereeuniqueid']][_0xb679('0x45')]=0x0;}else{queues[_0xd728a6[_0xb679('0x40')]][_0xb679('0xf')]=_0xd728a6[_0xb679('0x3d')];}}}else if(_0xd728a6[_0xb679('0x46')]==_0xd728a6[_0xb679('0x3d')]){if(!_[_0xb679('0x16')](queues[_0xd728a6[_0xb679('0x40')]])){queues[_0xd728a6[_0xb679('0x40')]]['transfer']=!![];queues[_0xd728a6[_0xb679('0x40')]]['transfertype']=_0xb679('0x3e');queues[_0xd728a6['origtransfererlinkedid']][_0xb679('0x38')]=_0xd728a6['secondtransfererexten'];queues[_0xd728a6[_0xb679('0x40')]]['transferuniqueid']=_0xd728a6[_0xb679('0x46')];queues[_0xd728a6[_0xb679('0x40')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0xd728a6['secondtransfererlinkedid']])){if(_0xd728a6[_0xb679('0x47')]&&queues[_0xd728a6['transfertargetlinkedid']]){queues[_0xd728a6['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0xd728a6[_0xb679('0x43')]]=_['clone'](queues[_0xd728a6[_0xb679('0x47')]]);queues[_0xd728a6[_0xb679('0x43')]][_0xb679('0xf')]=_0xd728a6[_0xb679('0x43')];queues[_0xd728a6['transfertargetuniqueid']][_0xb679('0x48')]=0x2;queues[_0xd728a6[_0xb679('0x43')]]['calleridnum']=queues[_0xd728a6[_0xb679('0x40')]]['calleridnum'];queues[_0xd728a6['transfertargetuniqueid']][_0xb679('0x44')]=queues[_0xd728a6[_0xb679('0x40')]]['calleridname'];queues[_0xd728a6['transfertargetuniqueid']][_0xb679('0x29')]=utils[_0xb679('0x14')]();queues[_0xd728a6[_0xb679('0x43')]][_0xb679('0x26')]=utils[_0xb679('0x14')]();queues[_0xd728a6[_0xb679('0x43')]][_0xb679('0x27')]=0x0;queues[_0xd728a6[_0xb679('0x43')]][_0xb679('0x45')]=0x0;}else{queues[_0xd728a6[_0xb679('0x3d')]][_0xb679('0xf')]=_0xd728a6[_0xb679('0x40')];}}}}catch(_0x12999a){utils[_0xb679('0x49')](_0x12999a[_0xb679('0x4a')]);}};exports['musiconholdstart']=function(_0x117764){if(!_[_0xb679('0x16')](queues[_0x117764['uniqueid']])){queues[_0x117764[_0xb679('0x11')]][_0xb679('0x4b')]=utils[_0xb679('0x14')]();}};exports[_0xb679('0x4c')]=function(_0x476dc0){if(!_[_0xb679('0x16')](queues[_0x476dc0[_0xb679('0x11')]])){if(!_[_0xb679('0x16')](queues[_0x476dc0[_0xb679('0x11')]][_0xb679('0x4b')])){queues[_0x476dc0[_0xb679('0x11')]]['mohtime']+=utils[_0xb679('0x28')](utils[_0xb679('0x14')](),queues[_0x476dc0[_0xb679('0x11')]][_0xb679('0x4b')]);delete queues[_0x476dc0[_0xb679('0x11')]][_0xb679('0x4b')];}}}; \ No newline at end of file +var _0xdadb=['type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','assign','position','now','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','queueposition','queuecallerabandonAt','EXITWITHKEY','ABANDONED','queuecallerleave','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','assigned','accountcode','destaccountcode','lastAssignedTo','membername','transfer','TRANSFER','COMPLETEDBY','reason','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','origtransfereruniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridnum','holdtime','mohtime','secondtransfereruniqueid','ATTENDED','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','calleridname','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','info','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queuecallerexitreason','getVoiceQueueByName','queue','then'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xdadb,0x12f));var _0xbdad=function(_0x2611c7,_0x33f9c8){_0x2611c7=_0x2611c7-0x0;var _0xfbe54d=_0xdadb[_0x2611c7];return _0xfbe54d;};'use strict';var _=require(_0xbdad('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x1cd2a1){utils[_0xbdad('0x1')](util['format'](_0xbdad('0x2'),_0x1cd2a1[_0xbdad('0x3')],_0x1cd2a1[_0xbdad('0x4')],_0x1cd2a1['queue'],_0x1cd2a1['lastAssignedTo'],_0x1cd2a1['calleridnum'],_0x1cd2a1['accountcode'],_0x1cd2a1[_0xbdad('0x5')]));if(_0x1cd2a1['queue']){utils[_0xbdad('0x6')](_0x1cd2a1[_0xbdad('0x7')])[_0xbdad('0x8')](function(_0x184846){if(_0x184846){_0x1cd2a1['type']=_0x184846[_0xbdad('0x9')];}utils['request'](_0xbdad('0xa'),_0x1cd2a1);});}else{utils[_0xbdad('0xb')]('CreateVoiceQueueReport',_0x1cd2a1);}if(_0x1cd2a1[_0xbdad('0xc')]){delete queues[_0x1cd2a1[_0xbdad('0xc')]];}else{delete queues[_0x1cd2a1[_0xbdad('0x3')]];}}exports[_0xbdad('0xd')]=function(_0x4aca59){queues[_0x4aca59['uniqueid']]=_[_0xbdad('0xe')](_0x4aca59,{'originalposition':_0x4aca59[_0xbdad('0xf')],'queuecallerjoinAt':utils[_0xbdad('0x10')](),'mohtime':0x0});};exports['hangup']=function(_0x3641df){if(!_[_0xbdad('0x11')](queues[_0x3641df['uniqueid']])){if(queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0x12')]){if(!queues[_0x3641df['uniqueid']][_0xbdad('0x13')]&&!queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0x14')]){queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0x15')]=!![];queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0x16')]=utils['now']();queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0x5')]=_0xbdad('0x17');}writeDB(queues[_0x3641df['uniqueid']]);}else{if(queues[_0x3641df[_0xbdad('0x3')]]['transfereduniqueid']){queues[queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0xc')]]=queues[_0x3641df[_0xbdad('0x3')]];queues[queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0xc')]][_0xbdad('0x18')]=0x2;delete queues[_0x3641df[_0xbdad('0x3')]];}}}};exports['varset']=function(_0x105a2c){if(!_[_0xbdad('0x11')](_0x105a2c[_0xbdad('0x19')][_0xbdad('0x1a')])&&_0x105a2c[_0xbdad('0x1b')][_0xbdad('0x1c')]()!==_0xbdad('0x1d')){if(!_[_0xbdad('0x11')](queues[_0x105a2c[_0xbdad('0x3')]])){queues[_0x105a2c['uniqueid']]['queuecallerabandon']=![];queues[_0x105a2c[_0xbdad('0x3')]]['queuecallerabandonAt']=null;queues[_0x105a2c[_0xbdad('0x3')]][_0xbdad('0x14')]=!![];queues[_0x105a2c[_0xbdad('0x3')]][_0xbdad('0x1e')]=utils[_0xbdad('0x10')]();queues[_0x105a2c[_0xbdad('0x3')]]['queuecallerexitreason']=_0x105a2c['value']['toUpperCase']();writeDB(queues[_0x105a2c[_0xbdad('0x3')]]);}}else if(!_[_0xbdad('0x11')](_0x105a2c['variable'][_0xbdad('0x1f')])){if(!_[_0xbdad('0x11')](queues[_0x105a2c[_0xbdad('0x3')]])&&!queues[_0x105a2c[_0xbdad('0x3')]][_0xbdad('0x13')]){queues[_0x105a2c[_0xbdad('0x3')]][_0xbdad('0x13')]=![];queues[_0x105a2c['uniqueid']][_0xbdad('0x20')]=null;queues[_0x105a2c[_0xbdad('0x3')]][_0xbdad('0x14')]=!![];queues[_0x105a2c[_0xbdad('0x3')]][_0xbdad('0x1e')]=utils['now']();queues[_0x105a2c[_0xbdad('0x3')]]['queuecallerexitreason']=_0xbdad('0x21');}}};exports[_0xbdad('0x13')]=function(_0x448ef7){if(!_[_0xbdad('0x11')](queues[_0x448ef7['uniqueid']])){queues[_0x448ef7[_0xbdad('0x3')]]['queuecallerexit']=![];queues[_0x448ef7[_0xbdad('0x3')]][_0xbdad('0x1e')]=null;queues[_0x448ef7['uniqueid']][_0xbdad('0x13')]=!![];queues[_0x448ef7[_0xbdad('0x3')]][_0xbdad('0x20')]=utils[_0xbdad('0x10')]();queues[_0x448ef7[_0xbdad('0x3')]][_0xbdad('0x5')]=_0xbdad('0x22');}};exports['queuecallerleave']=function(_0x4d4dd7){if(!_[_0xbdad('0x11')](queues[_0x4d4dd7[_0xbdad('0x3')]])){queues[_0x4d4dd7[_0xbdad('0x3')]][_0xbdad('0x23')]=!![];queues[_0x4d4dd7['uniqueid']][_0xbdad('0x12')]=utils[_0xbdad('0x10')]();queues[_0x4d4dd7[_0xbdad('0x3')]]['holdtime']=utils[_0xbdad('0x24')](queues[_0x4d4dd7[_0xbdad('0x3')]]['queuecallerleaveAt'],queues[_0x4d4dd7[_0xbdad('0x3')]][_0xbdad('0x25')]);queues[_0x4d4dd7[_0xbdad('0x3')]][_0xbdad('0xf')]=_0x4d4dd7[_0xbdad('0xf')];queues[_0x4d4dd7['uniqueid']][_0xbdad('0x26')]=_0x4d4dd7['count'];queues[_0x4d4dd7[_0xbdad('0x3')]][_0xbdad('0x27')]=_0x4d4dd7[_0xbdad('0x27')];queues[_0x4d4dd7[_0xbdad('0x3')]][_0xbdad('0x28')]=_0x4d4dd7[_0xbdad('0x28')];}};exports['agentconnect']=function(_0x4be480){if(!_['isNil'](queues[_0x4be480[_0xbdad('0x3')]])){queues[_0x4be480[_0xbdad('0x3')]][_0xbdad('0x13')]=![];queues[_0x4be480[_0xbdad('0x3')]]['queuecallerabandon']=![];queues[_0x4be480[_0xbdad('0x3')]][_0xbdad('0x20')]=null;queues[_0x4be480[_0xbdad('0x3')]][_0xbdad('0x14')]=![];queues[_0x4be480[_0xbdad('0x3')]][_0xbdad('0x5')]=null;queues[_0x4be480[_0xbdad('0x3')]][_0xbdad('0x1e')]=null;queues[_0x4be480[_0xbdad('0x3')]][_0xbdad('0x29')]=!![];queues[_0x4be480['uniqueid']][_0xbdad('0x2a')]=_0x4be480[_0xbdad('0x2b')];queues[_0x4be480[_0xbdad('0x3')]]['lastAssignedTo']=_0x4be480['membername'];}};exports['agentcomplete']=function(_0x4e5f16){if(!_[_0xbdad('0x11')](queues[_0x4e5f16[_0xbdad('0x3')]])){if(queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x12')]){queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x13')]=![];queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x13')]=![];queues[_0x4e5f16[_0xbdad('0x3')]]['queuecallerabandonAt']=null;queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x14')]=![];queues[_0x4e5f16['uniqueid']][_0xbdad('0x1e')]=null;queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x29')]=!![];queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x2c')]=_0x4e5f16[_0xbdad('0x2d')];queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x15')]=!![];queues[_0x4e5f16['uniqueid']][_0xbdad('0x16')]=utils[_0xbdad('0x10')]();if(_0x4e5f16['reason']==_0xbdad('0x2e')){if(!queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x2e')]){queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x5')]=_0xbdad('0x2f');}}else{queues[_0x4e5f16['uniqueid']][_0xbdad('0x5')]=_0xbdad('0x30')+_0x4e5f16[_0xbdad('0x31')][_0xbdad('0x1c')]();}writeDB(queues[_0x4e5f16[_0xbdad('0x3')]]);}}};exports[_0xbdad('0x32')]=function(_0x5b294b){if(!_[_0xbdad('0x11')](queues[_0x5b294b[_0xbdad('0x33')]])){queues[_0x5b294b[_0xbdad('0x33')]][_0xbdad('0x2e')]=!![];queues[_0x5b294b['transfereeuniqueid']][_0xbdad('0x34')]=_0xbdad('0x35');queues[_0x5b294b[_0xbdad('0x33')]][_0xbdad('0x36')]=_0x5b294b[_0xbdad('0x37')];queues[_0x5b294b[_0xbdad('0x33')]][_0xbdad('0x38')]=_0x5b294b[_0xbdad('0x33')];queues[_0x5b294b[_0xbdad('0x33')]][_0xbdad('0x5')]='BLINDTRANSFER';}};exports[_0xbdad('0x39')]=function(_0x576ca2){try{if(_0x576ca2['origtransfereruniqueid']==_0x576ca2[_0xbdad('0x3a')]){if(!_[_0xbdad('0x11')](queues[_0x576ca2[_0xbdad('0x3b')]])){queues[_0x576ca2[_0xbdad('0x3b')]]['transfer']=!![];queues[_0x576ca2['secondtransfererlinkedid']][_0xbdad('0x34')]='ATTENDED';queues[_0x576ca2[_0xbdad('0x3b')]][_0xbdad('0x36')]=_0x576ca2['origtransfererexten'];queues[_0x576ca2[_0xbdad('0x3b')]]['transferuniqueid']=_0x576ca2[_0xbdad('0x3c')];queues[_0x576ca2[_0xbdad('0x3b')]][_0xbdad('0x5')]=_0xbdad('0x3d');}if(!_['isNil'](queues[_0x576ca2[_0xbdad('0x3a')]])){if(_0x576ca2[_0xbdad('0x3e')]&&queues[_0x576ca2[_0xbdad('0x3e')]]){queues[_0x576ca2[_0xbdad('0x3e')]][_0xbdad('0x18')]=0x1;queues[_0x576ca2[_0xbdad('0x33')]]=_[_0xbdad('0x3f')](queues[_0x576ca2[_0xbdad('0x3e')]]);queues[_0x576ca2[_0xbdad('0x33')]][_0xbdad('0xc')]=_0x576ca2['transfertargetuniqueid'];queues[_0x576ca2['transfereeuniqueid']][_0xbdad('0x18')]=0x2;queues[_0x576ca2['transfereeuniqueid']][_0xbdad('0x40')]=queues[_0x576ca2[_0xbdad('0x3b')]]['calleridnum'];queues[_0x576ca2[_0xbdad('0x33')]]['calleridname']=queues[_0x576ca2['secondtransfererlinkedid']]['calleridname'];queues[_0x576ca2['transfereeuniqueid']][_0xbdad('0x25')]=utils[_0xbdad('0x10')]();queues[_0x576ca2[_0xbdad('0x33')]][_0xbdad('0x12')]=utils[_0xbdad('0x10')]();queues[_0x576ca2['transfereeuniqueid']][_0xbdad('0x41')]=0x0;queues[_0x576ca2[_0xbdad('0x33')]][_0xbdad('0x42')]=0x0;}else{queues[_0x576ca2[_0xbdad('0x3a')]][_0xbdad('0xc')]=_0x576ca2[_0xbdad('0x3b')];}}}else if(_0x576ca2[_0xbdad('0x43')]==_0x576ca2[_0xbdad('0x3b')]){if(!_['isNil'](queues[_0x576ca2[_0xbdad('0x3a')]])){queues[_0x576ca2[_0xbdad('0x3a')]][_0xbdad('0x2e')]=!![];queues[_0x576ca2[_0xbdad('0x3a')]][_0xbdad('0x34')]=_0xbdad('0x44');queues[_0x576ca2[_0xbdad('0x3a')]][_0xbdad('0x36')]=_0x576ca2[_0xbdad('0x45')];queues[_0x576ca2[_0xbdad('0x3a')]]['transferuniqueid']=_0x576ca2[_0xbdad('0x43')];queues[_0x576ca2[_0xbdad('0x3a')]][_0xbdad('0x5')]=_0xbdad('0x3d');}if(!_['isNil'](queues[_0x576ca2[_0xbdad('0x3b')]])){if(_0x576ca2[_0xbdad('0x46')]&&queues[_0x576ca2[_0xbdad('0x46')]]){queues[_0x576ca2[_0xbdad('0x46')]][_0xbdad('0x18')]=0x1;queues[_0x576ca2[_0xbdad('0x47')]]=_[_0xbdad('0x3f')](queues[_0x576ca2[_0xbdad('0x46')]]);queues[_0x576ca2[_0xbdad('0x47')]][_0xbdad('0xc')]=_0x576ca2[_0xbdad('0x47')];queues[_0x576ca2[_0xbdad('0x47')]][_0xbdad('0x18')]=0x2;queues[_0x576ca2[_0xbdad('0x47')]][_0xbdad('0x40')]=queues[_0x576ca2[_0xbdad('0x3a')]]['calleridnum'];queues[_0x576ca2[_0xbdad('0x47')]][_0xbdad('0x48')]=queues[_0x576ca2['origtransfererlinkedid']][_0xbdad('0x48')];queues[_0x576ca2[_0xbdad('0x47')]][_0xbdad('0x25')]=utils['now']();queues[_0x576ca2[_0xbdad('0x47')]][_0xbdad('0x12')]=utils[_0xbdad('0x10')]();queues[_0x576ca2[_0xbdad('0x47')]]['holdtime']=0x0;queues[_0x576ca2['transfertargetuniqueid']][_0xbdad('0x42')]=0x0;}else{queues[_0x576ca2[_0xbdad('0x3b')]][_0xbdad('0xc')]=_0x576ca2[_0xbdad('0x3a')];}}}}catch(_0x16e23d){utils[_0xbdad('0x49')](_0x16e23d[_0xbdad('0x4a')]);}};exports[_0xbdad('0x4b')]=function(_0xd96f2a){if(!_['isNil'](queues[_0xd96f2a['uniqueid']])){queues[_0xd96f2a['uniqueid']][_0xbdad('0x4c')]=utils[_0xbdad('0x10')]();}};exports[_0xbdad('0x4d')]=function(_0x4015d1){if(!_[_0xbdad('0x11')](queues[_0x4015d1[_0xbdad('0x3')]])){if(!_['isNil'](queues[_0x4015d1[_0xbdad('0x3')]][_0xbdad('0x4c')])){queues[_0x4015d1['uniqueid']][_0xbdad('0x42')]+=utils[_0xbdad('0x24')](utils[_0xbdad('0x10')](),queues[_0x4015d1['uniqueid']]['musiconholdstartAt']);delete queues[_0x4015d1[_0xbdad('0x3')]][_0xbdad('0x4c')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index e341302..453d28e 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 _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(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x34e8,0x12c));var _0x834e=function(_0x133fd0,_0x48b6d2){_0x133fd0=_0x133fd0-0x0;var _0xf336f8=_0x34e8[_0x133fd0];return _0xf336f8;};'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 +var _0x70e0=['.WAV','find','monitors','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','set','appdata','toLowerCase','split','lastIndexOf','queuecallerjoin','queue','lodash','./utils','getUserByInternal','accountcode','then','name','request','newchannel','uniqueid','linkedid','channel','error','stack','newstate','isNil','channelstate','transfer','variable','endsWith','value','.wav49'];(function(_0x5ba1a9,_0x150164){var _0x57860f=function(_0x4b4ddd){while(--_0x4b4ddd){_0x5ba1a9['push'](_0x5ba1a9['shift']());}};_0x57860f(++_0x150164);}(_0x70e0,0x17b));var _0x070e=function(_0x367444,_0x1b1dd8){_0x367444=_0x367444-0x0;var _0x371d48=_0x70e0[_0x367444];return _0x371d48;};'use strict';var _=require(_0x070e('0x0'));var utils=require(_0x070e('0x1'));var recordings={};function writeDB(_0x198c2e){utils['debug'](_0x198c2e);if(_0x198c2e['accountcode']){utils[_0x070e('0x2')](_0x198c2e[_0x070e('0x3')])[_0x070e('0x4')](function(_0x2593e5){if(_0x2593e5){_0x198c2e['membername']=_0x2593e5[_0x070e('0x5')];_0x198c2e['UserId']=_0x2593e5['id'];}utils[_0x070e('0x6')]('CreateVoiceRecording',_0x198c2e);});}else{utils['request']('CreateVoiceRecording',_0x198c2e);}}exports[_0x070e('0x7')]=function(_0x1e11f0){try{if(_0x1e11f0[_0x070e('0x8')]==_0x1e11f0[_0x070e('0x9')]){recordings[_0x1e11f0[_0x070e('0x8')]]={'uniqueid':_0x1e11f0[_0x070e('0x8')],'accountcode':_0x1e11f0[_0x070e('0x3')],'exten':_0x1e11f0['exten'],'context':_0x1e11f0['context'],'channel':_0x1e11f0[_0x070e('0xa')],'monitors':[]};}}catch(_0x2e3e5e){utils[_0x070e('0xb')](_0x2e3e5e[_0x070e('0xc')]);}};exports[_0x070e('0xd')]=function(_0xffcdd6){try{if(!_[_0x070e('0xe')](recordings[_0xffcdd6[_0x070e('0x8')]])&&_0xffcdd6[_0x070e('0xf')]==0x6){}else if(!_[_0x070e('0xe')](recordings[_0xffcdd6[_0x070e('0x9')]])&&_0xffcdd6['channelstate']==0x6&&_0xffcdd6['context']!=_0x070e('0x10')){recordings[_0xffcdd6['linkedid']]['accountcode']=_0xffcdd6['accountcode'];}}catch(_0x11d2ce){utils[_0x070e('0xb')](_0x11d2ce['stack']);}};exports['varset']=function(_0x373d86){try{if(!_[_0x070e('0xe')](_0x373d86[_0x070e('0x11')])&&!_[_0x070e('0xe')](_0x373d86['variable']['mixmonitor_filename'])){if(_[_0x070e('0x12')](_0x373d86[_0x070e('0x13')],_0x070e('0x14'))){_0x373d86[_0x070e('0x13')]=_0x373d86[_0x070e('0x13')]['replace'](_0x070e('0x14'),_0x070e('0x15'));}if(recordings[_0x373d86[_0x070e('0x9')]]){var _0x3ea105=_[_0x070e('0x16')](recordings[_0x373d86['linkedid']]['monitors'],{'value':_0x373d86['value']});if(_[_0x070e('0xe')](_0x3ea105)){recordings[_0x373d86[_0x070e('0x9')]][_0x070e('0x17')]['push']({'value':_0x373d86[_0x070e('0x13')]});}}}}catch(_0x5dc5d2){utils[_0x070e('0xb')](_0x5dc5d2[_0x070e('0xc')]);}};exports[_0x070e('0x18')]=function(_0x33e8c6){try{if(!_[_0x070e('0xe')](recordings[_0x33e8c6[_0x070e('0x8')]])){recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x19')]=_0x33e8c6['calleridnum'];recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1a')]=_0x33e8c6[_0x070e('0x1a')];recordings[_0x33e8c6['uniqueid']][_0x070e('0x1b')]=_0x33e8c6['connectedlinenum'];recordings[_0x33e8c6['uniqueid']][_0x070e('0x1c')]=_0x33e8c6[_0x070e('0x1c')];if(recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1d')]==_0x070e('0x1e')&&recordings[_0x33e8c6['uniqueid']][_0x070e('0x3')]){recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1b')]=recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x3')];recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1c')]='';}recordings[_0x33e8c6[_0x070e('0x8')]]['monitors'][_0x070e('0x1f')](_0x351641=>{var _0x3a16d0=_['clone'](recordings[_0x33e8c6['uniqueid']]);_0x3a16d0[_0x070e('0x13')]=_0x351641[_0x070e('0x13')];writeDB(_0x3a16d0);});delete recordings[_0x33e8c6[_0x070e('0x8')]];}}catch(_0x51402c){utils[_0x070e('0xb')](_0x51402c[_0x070e('0xc')]);}};exports[_0x070e('0x20')]=function(_0x5f2bee){try{if(!_['isNil'](recordings[_0x5f2bee['uniqueid']])){if(_0x5f2bee['application']['toLowerCase']()==_0x070e('0x21')&&_['startsWith'](_0x5f2bee[_0x070e('0x22')][_0x070e('0x23')](),'cdr')){var _0x47a739=_0x5f2bee[_0x070e('0x22')][_0x070e('0x24')]('=');var _0x55288a=_0x47a739[0x0]['substring'](_0x47a739[0x0][_0x070e('0x25')]('(')+0x1,_0x47a739[0x0][_0x070e('0x25')](')'));var _0x444d02=_0x47a739[0x1];recordings[_0x5f2bee[_0x070e('0x8')]][_0x55288a]=_0x444d02;}}}catch(_0x18f0ad){utils['error'](_0x18f0ad['stack']);}};exports[_0x070e('0x26')]=function(_0x3011c4){try{if(!_[_0x070e('0xe')](recordings[_0x3011c4[_0x070e('0x8')]])){recordings[_0x3011c4[_0x070e('0x8')]]['queue']=_0x3011c4[_0x070e('0x27')];}}catch(_0x1927f4){utils['error'](_0x1927f4[_0x070e('0xc')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index bd224b0..daa1b09 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 _0x27c9=['TRANSFER|%s','request','CreateVoiceTransferReport','blindtransfer','type','error','stack','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format'];(function(_0x3c6b92,_0x3af491){var _0x2bed99=function(_0x259885){while(--_0x259885){_0x3c6b92['push'](_0x3c6b92['shift']());}};_0x2bed99(++_0x3af491);}(_0x27c9,0x1af));var _0x927c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x27c9[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x927c('0x0'));var util=require(_0x927c('0x1'));var utils=require(_0x927c('0x2'));function writeDB(_0x9fa3df){utils['info'](util[_0x927c('0x3')](_0x927c('0x4'),_0x9fa3df['type']));utils[_0x927c('0x5')](_0x927c('0x6'),_0x9fa3df);}exports[_0x927c('0x7')]=function(_0x20e0d2){try{_0x20e0d2[_0x927c('0x8')]='blind';writeDB(_0x20e0d2);}catch(_0x1622e3){utils[_0x927c('0x9')](_0x1622e3[_0x927c('0xa')]);}};exports['attendedtransfer']=function(_0x40050f){try{_0x40050f=_[_0x927c('0xb')](_0x40050f,{'transfererchannel':_0x40050f[_0x927c('0xc')],'transferercalleridnum':_0x40050f['origtransferercalleridnum'],'transferercalleridname':_0x40050f[_0x927c('0xd')],'transfererconnectedlinenum':_0x40050f[_0x927c('0xe')],'transfererconnectedlinename':_0x40050f[_0x927c('0xf')],'transfereraccountcode':_0x40050f[_0x927c('0x10')],'transferercontext':_0x40050f[_0x927c('0x11')],'transfererexten':_0x40050f[_0x927c('0x12')],'transfererlinkedid':_0x40050f[_0x927c('0x13')],'context':_0x40050f[_0x927c('0x14')],'extension':_0x40050f['origtransfererexten'],'type':'attended'});if(_[_0x927c('0x15')](_0x40050f[_0x927c('0x16')])){_0x40050f=_[_0x927c('0xb')](_0x40050f,{'transfereechannel':_0x40050f[_0x927c('0x17')],'transfereecalleridnum':_0x40050f['transfertargetcalleridnum'],'transfereecalleridname':_0x40050f[_0x927c('0x18')],'transfereeconnectedlinenum':_0x40050f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x40050f['transfertargetconnectedlinename'],'transfereeaccountcode':_0x40050f[_0x927c('0x19')],'transfereecontext':_0x40050f[_0x927c('0x1a')],'transfereeexten':_0x40050f[_0x927c('0x1b')],'transfereelinkedid':_0x40050f[_0x927c('0x1c')]});}writeDB(_0x40050f);}catch(_0x41a09b){utils[_0x927c('0x9')](_0x41a09b[_0x927c('0xa')]);}}; \ No newline at end of file +var _0x5900=['origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','attended','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','TRANSFER|%s','request','CreateVoiceTransferReport','type','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x5900,0xd2));var _0x0590=function(_0x2f0195,_0x185bbb){_0x2f0195=_0x2f0195-0x0;var _0x3a43ec=_0x5900[_0x2f0195];return _0x3a43ec;};'use strict';var _=require('lodash');var util=require(_0x0590('0x0'));var utils=require(_0x0590('0x1'));function writeDB(_0x5bee11){utils[_0x0590('0x2')](util[_0x0590('0x3')](_0x0590('0x4'),_0x5bee11['type']));utils[_0x0590('0x5')](_0x0590('0x6'),_0x5bee11);}exports['blindtransfer']=function(_0x154fe4){try{_0x154fe4[_0x0590('0x7')]='blind';writeDB(_0x154fe4);}catch(_0x469e15){utils[_0x0590('0x8')](_0x469e15[_0x0590('0x9')]);}};exports[_0x0590('0xa')]=function(_0x1eab42){try{_0x1eab42=_[_0x0590('0xb')](_0x1eab42,{'transfererchannel':_0x1eab42[_0x0590('0xc')],'transferercalleridnum':_0x1eab42[_0x0590('0xd')],'transferercalleridname':_0x1eab42[_0x0590('0xe')],'transfererconnectedlinenum':_0x1eab42['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1eab42[_0x0590('0xf')],'transfereraccountcode':_0x1eab42[_0x0590('0x10')],'transferercontext':_0x1eab42['secondtransferercontext'],'transfererexten':_0x1eab42[_0x0590('0x11')],'transfererlinkedid':_0x1eab42[_0x0590('0x12')],'context':_0x1eab42['origtransferercontext'],'extension':_0x1eab42['origtransfererexten'],'type':_0x0590('0x13')});if(_['isNil'](_0x1eab42[_0x0590('0x14')])){_0x1eab42=_[_0x0590('0xb')](_0x1eab42,{'transfereechannel':_0x1eab42[_0x0590('0x15')],'transfereecalleridnum':_0x1eab42[_0x0590('0x16')],'transfereecalleridname':_0x1eab42[_0x0590('0x17')],'transfereeconnectedlinenum':_0x1eab42['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1eab42[_0x0590('0x18')],'transfereeaccountcode':_0x1eab42[_0x0590('0x19')],'transfereecontext':_0x1eab42['transfertargetcontext'],'transfereeexten':_0x1eab42[_0x0590('0x1a')],'transfereelinkedid':_0x1eab42[_0x0590('0x1b')]});}writeDB(_0x1eab42);}catch(_0x9568fb){utils['error'](_0x9568fb[_0x0590('0x9')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index d8aaa79..dc04d59 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 _0xf66b=['subtract','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','isAfter','isBefore','jayson/promise','moment','bluebird','xdr','info','debug','error','stack','request','then','stringify','GetUser','internal','name','interface','GETUSER|','length','FOUND','result','catch','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','GETVOICEQUEUEBYNAME|'];(function(_0x3721cf,_0xb922a6){var _0x5c7dc6=function(_0x149783){while(--_0x149783){_0x3721cf['push'](_0x3721cf['shift']());}};_0x5c7dc6(++_0xb922a6);}(_0xf66b,0xb7));var _0xbf66=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xf66b[_0x47e7cb];return _0x2a8874;};'use strict';var jayson=require(_0xbf66('0x0'));var moment=require(_0xbf66('0x1'));var BPromise=require(_0xbf66('0x2'));var client=jayson['client']['http']({'port':0x2329});var logger=require('../../config/logger')(_0xbf66('0x3'));exports[_0xbf66('0x4')]=function(_0x5649ba){logger['info'](_0x5649ba);};exports[_0xbf66('0x5')]=function(_0x4e833f){logger[_0xbf66('0x5')](JSON['stringify'](_0x4e833f));};exports[_0xbf66('0x6')]=function(_0x40c2e1){logger[_0xbf66('0x6')](_0x40c2e1[_0xbf66('0x7')]);};exports[_0xbf66('0x8')]=function(_0x32f528,_0x411152){return client['request'](_0x32f528,{'body':_0x411152})[_0xbf66('0x9')](function(_0x373309){logger[_0xbf66('0x5')](JSON[_0xbf66('0xa')](_0x373309));})['catch'](function(_0xc237e1){logger[_0xbf66('0x6')](_0xc237e1[_0xbf66('0x7')]);});};function getUser(_0x4ec2b0){return client[_0xbf66('0x8')](_0xbf66('0xb'),{'options':{'raw':!![],'attributes':['id',_0xbf66('0xc'),_0xbf66('0xd'),_0xbf66('0xe')],'where':_0x4ec2b0,'limit':0x1}})['then'](function(_0x13c185){logger[_0xbf66('0x4')](_0xbf66('0xf')+JSON[_0xbf66('0xa')](_0x4ec2b0)+'|'+(_0x13c185['result'][_0xbf66('0x10')]?_0xbf66('0x11'):'NOTFOUND'));return _0x13c185[_0xbf66('0x12')]['length']?_0x13c185[_0xbf66('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x3b4b9b){return new BPromise(function(_0x1fd514,_0x418466){if(_0x3b4b9b){return getUser({'internal':_0x3b4b9b})[_0xbf66('0x9')](function(_0x4ff264){return _0x1fd514(_0x4ff264);})[_0xbf66('0x13')](function(_0x27f956){logger[_0xbf66('0x6')](_0x27f956['stack']);return _0x1fd514(null);});}else{return _0x1fd514(null);}});};exports[_0xbf66('0x14')]=function(_0x7dc809){return new BPromise(function(_0x1b5480,_0x57244d){if(_0x7dc809){return getUser({'interface':_0x7dc809})[_0xbf66('0x9')](function(_0x405694){return _0x1b5480(_0x405694);})['catch'](function(_0x5eb303){logger[_0xbf66('0x6')](_0x5eb303[_0xbf66('0x7')]);return _0x1b5480(null);});}else{return _0x1b5480(null);}});};exports[_0xbf66('0x15')]=function(_0x44c38e){return new BPromise(function(_0x1f2f87,_0x2c2a97){if(_0x44c38e){return getUser({'name':_0x44c38e})['then'](function(_0x4cd0f2){return _0x1f2f87(_0x4cd0f2);})[_0xbf66('0x13')](function(_0x2a628a){logger[_0xbf66('0x6')](_0x2a628a[_0xbf66('0x7')]);return _0x1f2f87(null);});}else{return _0x1f2f87(null);}});};exports[_0xbf66('0x16')]=function(_0x50eaa8){return new BPromise(function(_0x31c54b,_0x14a251){if(_0x50eaa8){return client[_0xbf66('0x8')](_0xbf66('0x17'),{'options':{'raw':!![],'attributes':['id',_0xbf66('0xd'),'type',_0xbf66('0x18'),_0xbf66('0x19')],'where':{'name':_0x50eaa8},'limit':0x1}})[_0xbf66('0x9')](function(_0x1ea597){logger[_0xbf66('0x4')](_0xbf66('0x1a')+_0x50eaa8+'|'+(_0x1ea597['result'][_0xbf66('0x10')]?'FOUND':'NOTFOUND'));return _0x31c54b(_0x1ea597['result'][_0xbf66('0x10')]?_0x1ea597[_0xbf66('0x12')][0x0]:null);})[_0xbf66('0x13')](function(_0x4b1910){logger[_0xbf66('0x6')](_0x4b1910[_0xbf66('0x7')]);return _0x31c54b(null);});}else{return _0x31c54b(null);}});};exports['addTime']=function(_0x478629,_0x548c0f){return moment(_0x478629)['add'](_0x548c0f,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x5af4ea,_0x263bb0){return moment(_0x5af4ea)[_0xbf66('0x1b')](_0x263bb0,_0xbf66('0x1c'))[_0xbf66('0x1d')](_0xbf66('0x1e'));};exports[_0xbf66('0x1f')]=function(_0x3f7c13,_0x5583ee){return moment(_0x3f7c13)[_0xbf66('0x20')](moment(_0x5583ee),_0xbf66('0x1c'));};exports['sumTime']=function(_0x49985c,_0x6a0f31){return parseInt(_0x49985c,0xa)+parseInt(_0x6a0f31,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xbf66('0x21')]=function(_0x13c353,_0x53825e){if(_0x53825e){return moment(_0x13c353)[_0xbf66('0x21')](_0x53825e);}else{return!![];}};exports[_0xbf66('0x22')]=function(_0x48c125,_0x5bb9d8){if(_0x5bb9d8){return moment(_0x48c125)['isBefore'](_0x5bb9d8);}else if(_0x48c125){return!![];}else{return![];}}; \ No newline at end of file +var _0xb710=['internal','name','GETUSER|','result','length','NOTFOUND','getUserByInternal','getUserByInterface','getVoiceQueueByName','GetVoiceQueue','type','acw','GETVOICEQUEUEBYNAME|','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diff','now','isAfter','isBefore','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error','stack','then','catch','request','GetUser'];(function(_0x35ed2d,_0x87f170){var _0x54e182=function(_0x48fbe8){while(--_0x48fbe8){_0x35ed2d['push'](_0x35ed2d['shift']());}};_0x54e182(++_0x87f170);}(_0xb710,0x1b9));var _0x0b71=function(_0x417c18,_0x48b392){_0x417c18=_0x417c18-0x0;var _0xf2306=_0xb710[_0x417c18];return _0xf2306;};'use strict';var jayson=require('jayson/promise');var moment=require(_0x0b71('0x0'));var BPromise=require(_0x0b71('0x1'));var client=jayson[_0x0b71('0x2')][_0x0b71('0x3')]({'port':0x2329});var logger=require(_0x0b71('0x4'))(_0x0b71('0x5'));exports[_0x0b71('0x6')]=function(_0x200128){logger[_0x0b71('0x6')](_0x200128);};exports['debug']=function(_0x21b18b){logger[_0x0b71('0x7')](JSON[_0x0b71('0x8')](_0x21b18b));};exports[_0x0b71('0x9')]=function(_0x5f3f1b){logger[_0x0b71('0x9')](_0x5f3f1b[_0x0b71('0xa')]);};exports['request']=function(_0x13fa00,_0x20db8e){return client['request'](_0x13fa00,{'body':_0x20db8e})[_0x0b71('0xb')](function(_0x325d6d){logger[_0x0b71('0x7')](JSON['stringify'](_0x325d6d));})[_0x0b71('0xc')](function(_0xc6cced){logger[_0x0b71('0x9')](_0xc6cced['stack']);});};function getUser(_0x19e9d7){return client[_0x0b71('0xd')](_0x0b71('0xe'),{'options':{'raw':!![],'attributes':['id',_0x0b71('0xf'),_0x0b71('0x10'),'interface'],'where':_0x19e9d7,'limit':0x1}})['then'](function(_0x2ac646){logger['info'](_0x0b71('0x11')+JSON[_0x0b71('0x8')](_0x19e9d7)+'|'+(_0x2ac646[_0x0b71('0x12')][_0x0b71('0x13')]?'FOUND':_0x0b71('0x14')));return _0x2ac646[_0x0b71('0x12')][_0x0b71('0x13')]?_0x2ac646[_0x0b71('0x12')][0x0]:null;});}exports[_0x0b71('0x15')]=function(_0x1c242f){return new BPromise(function(_0x4d405f,_0x4d5dfe){if(_0x1c242f){return getUser({'internal':_0x1c242f})[_0x0b71('0xb')](function(_0x287549){return _0x4d405f(_0x287549);})[_0x0b71('0xc')](function(_0x449c8e){logger[_0x0b71('0x9')](_0x449c8e[_0x0b71('0xa')]);return _0x4d405f(null);});}else{return _0x4d405f(null);}});};exports[_0x0b71('0x16')]=function(_0xaef9ad){return new BPromise(function(_0x4ae11f,_0x505879){if(_0xaef9ad){return getUser({'interface':_0xaef9ad})[_0x0b71('0xb')](function(_0x5aa971){return _0x4ae11f(_0x5aa971);})[_0x0b71('0xc')](function(_0x590586){logger['error'](_0x590586[_0x0b71('0xa')]);return _0x4ae11f(null);});}else{return _0x4ae11f(null);}});};exports['getUserByName']=function(_0xc92e3d){return new BPromise(function(_0x1d023d,_0x4b1ecc){if(_0xc92e3d){return getUser({'name':_0xc92e3d})[_0x0b71('0xb')](function(_0x283758){return _0x1d023d(_0x283758);})[_0x0b71('0xc')](function(_0x2c5439){logger[_0x0b71('0x9')](_0x2c5439[_0x0b71('0xa')]);return _0x1d023d(null);});}else{return _0x1d023d(null);}});};exports[_0x0b71('0x17')]=function(_0x25420a){return new BPromise(function(_0x5af4e6,_0x546d87){if(_0x25420a){return client[_0x0b71('0xd')](_0x0b71('0x18'),{'options':{'raw':!![],'attributes':['id',_0x0b71('0x10'),_0x0b71('0x19'),_0x0b71('0x1a'),'acwTimeout'],'where':{'name':_0x25420a},'limit':0x1}})['then'](function(_0xd98d27){logger[_0x0b71('0x6')](_0x0b71('0x1b')+_0x25420a+'|'+(_0xd98d27[_0x0b71('0x12')]['length']?'FOUND':_0x0b71('0x14')));return _0x5af4e6(_0xd98d27[_0x0b71('0x12')][_0x0b71('0x13')]?_0xd98d27[_0x0b71('0x12')][0x0]:null);})[_0x0b71('0xc')](function(_0x51973e){logger[_0x0b71('0x9')](_0x51973e[_0x0b71('0xa')]);return _0x5af4e6(null);});}else{return _0x5af4e6(null);}});};exports[_0x0b71('0x1c')]=function(_0x11ed02,_0x14eaf9){return moment(_0x11ed02)[_0x0b71('0x1d')](_0x14eaf9,_0x0b71('0x1e'))[_0x0b71('0x1f')](_0x0b71('0x20'));};exports[_0x0b71('0x21')]=function(_0xb7beab,_0x2f5e58){return moment(_0xb7beab)['subtract'](_0x2f5e58,'seconds')[_0x0b71('0x1f')](_0x0b71('0x20'));};exports['diffTime']=function(_0x3f8804,_0x48f664){return moment(_0x3f8804)[_0x0b71('0x22')](moment(_0x48f664),_0x0b71('0x1e'));};exports['sumTime']=function(_0x311305,_0x66f4a8){return parseInt(_0x311305,0xa)+parseInt(_0x66f4a8,0xa);};exports[_0x0b71('0x23')]=function(){return moment()[_0x0b71('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0b71('0x24')]=function(_0x3f1564,_0x3be4c2){if(_0x3be4c2){return moment(_0x3f1564)[_0x0b71('0x24')](_0x3be4c2);}else{return!![];}};exports[_0x0b71('0x25')]=function(_0x2aec79,_0xb19eb7){if(_0xb19eb7){return moment(_0x2aec79)[_0x0b71('0x25')](_0xb19eb7);}else if(_0x2aec79){return!![];}else{return![];}}; \ No newline at end of file